Files
to_session/web_process/MetaMask 12.16.1/common-3.js

5 lines
741 KiB
JavaScript
Raw Normal View History

2025-11-12 12:54:37 +08:00
LavaPack.loadBundle([[2313,{"./assert.cjs":2311,"./hex.cjs":2320,"@scure/base":3027,buffer:4074},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){(function(t){(function(){Object.defineProperty(n,"__esModule",{value:!0}),n.createDataView=n.concatBytes=n.valueToBytes=n.base64ToBytes=n.stringToBytes=n.numberToBytes=n.signedBigIntToBytes=n.bigIntToBytes=n.hexToBytes=n.bytesToBase64=n.bytesToString=n.bytesToNumber=n.bytesToSignedBigInt=n.bytesToBigInt=n.bytesToHex=n.assertIsBytes=n.isBytes=void 0;const s=e("@scure/base"),r=e("./assert.cjs"),i=e("./hex.cjs"),a=48,o=58,c=87;const u=function(){const e=[];return()=>{if(0===e.length)for(let t=0;t<256;t++)e.push(t.toString(16).padStart(2,"0"));return e}}();function l(e){return e instanceof Uint8Array}function d(e){(0,r.assert)(l(e),"Value must be a Uint8Array.")}function m(e){if(d(e),0===e.length)return"0x";const t=u(),n=new Array(e.length);for(let s=0;s<e.length;s++)n[s]=t[e[s]];return(0,i.add0x)(n.join(""))}function p(e){d(e);const t=m(e);return BigInt(t)}function h(e){if("0x"===e?.toLowerCase?.())return new Uint8Array;(0,i.assertIsHexString)(e);const t=(0,i.remove0x)(e).toLowerCase(),n=t.length%2==0?t:`0${t}`,s=new Uint8Array(n.length/2);for(let e=0;e<s.length;e++){const t=n.charCodeAt(2*e),r=n.charCodeAt(2*e+1),i=t-(t<o?a:c),u=r-(r<o?a:c);s[e]=16*i+u}return s}function f(e){(0,r.assert)("bigint"==typeof e,"Value must be a bigint."),(0,r.assert)(e>=BigInt(0),"Value must be a non-negative bigint.");return h(e.toString(16))}function g(e){(0,r.assert)("number"==typeof e,"Value must be a number."),(0,r.assert)(e>=0,"Value must be a non-negative number."),(0,r.assert)(Number.isSafeInteger(e),"Value is not a safe integer. Use `bigIntToBytes` instead.");return h(e.toString(16))}function y(e){return(0,r.assert)("string"==typeof e,"Value must be a string."),(new TextEncoder).encode(e)}function b(e){if("bigint"==typeof e)return f(e);if("number"==typeof e)return g(e);if("string"==typeof e)return e.startsWith("0x")?h(e):y(e);if(l(e))return e;throw new TypeError(`Unsupported value type: "${typeof e}".`)}n.isBytes=l,n.assertIsBytes=d,n.bytesToHex=m,n.bytesToBigInt=p,n.bytesToSignedBigInt=function(e){d(e);let t=BigInt(0);for(const n of e)t=(t<<BigInt(8))+BigInt(n);return BigInt.asIntN(8*e.length,t)},n.bytesToNumber=function(e){d(e);const t=p(e);return(0,r.assert)(t<=BigInt(Number.MAX_SAFE_INTEGER),"Number is not a safe integer. Use `bytesToBigInt` instead."),Number(t)},n.bytesToString=function(e){return d(e),(new TextDecoder).decode(e)},n.bytesToBase64=function(e){return d(e),s.base64.encode(e)},n.hexToBytes=h,n.bigIntToBytes=f,n.signedBigIntToBytes=function(e,t){(0,r.assert)("bigint"==typeof e,"Value must be a bigint."),(0,r.assert)("number"==typeof t,"Byte length must be a number."),(0,r.assert)(t>0,"Byte length must be greater than 0."),(0,r.assert)(function(e,t){(0,r.assert)(t>0);const n=e>>BigInt(31);return!((~e&n)+(e&~n)>>BigInt(8*t-1))}(e,t),"Byte length is too small to represent the given value.");let n=e;const s=new Uint8Array(t);for(let e=0;e<s.length;e++)s[e]=Number(BigInt.asUintN(8,n)),n>>=BigInt(8);return s.reverse()},n.numberToBytes=g,n.stringToBytes=y,n.base64ToBytes=function(e){return(0,r.assert)("string"==typeof e,"Value must be a string."),s.base64.decode(e)},n.valueToBytes=b,n.concatBytes=function(e){const t=new Array(e.length);let n=0;for(let s=0;s<e.length;s++){const r=b(e[s]);t[s]=r,n+=r.length}const s=new Uint8Array(n);for(let e=0,n=0;e<t.length;e++)s.set(t[e],n),n+=t[e].length;return s},n.createDataView=function(e){if(void 0!==t&&e instanceof t){const t=e.buffer.slice(e.byteOffset,e.byteOffset+e.byteLength);return new DataView(t)}return new DataView(e.buffer,e.byteOffset,e.byteLength)}}).call(this)}).call(this,e("buffer").Buffer)}}},{package:"@metamask/network-controller>@metamask/utils",file:"node_modules/@metamask/network-controller/node_modules/@metamask/utils/dist/bytes.cjs"}],[2314,{"@metamask/superstruct":2872},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";ret
/*! scure-bip39 - MIT License (c) 2022 Patricio Palladino, Paul Miller (paulmillr.com) */
const s=e("@noble/hashes/_assert"),r=e("@noble/hashes/pbkdf2"),i=e("@noble/hashes/sha256"),a=e("@noble/hashes/sha512"),o=e("@noble/hashes/utils"),c=e("@scure/base");function u(e){if("string"!=typeof e)throw new TypeError("Invalid mnemonic type: "+typeof e);return e.normalize("NFKD")}function l(e){const t=u(e),n=t.split(" ");if(![12,15,18,21,24].includes(n.length))throw new Error("Invalid mnemonic");return{nfkd:t,words:n}}function d(e){s.default.bytes(e,16,20,24,28,32)}n.generateMnemonic=function(e,t=128){if(s.default.number(t),t%32!=0||t>256)throw new TypeError("Invalid entropy");return f((0,o.randomBytes)(t/8),e)};const m=e=>{const t=8-e.length/4;return new Uint8Array([(0,i.sha256)(e)[0]>>t<<t])};function p(e){if(!Array.isArray(e)||2048!==e.length||"string"!=typeof e[0])throw new Error("Worlist: expected array of 2048 strings");return e.forEach((e=>{if("string"!=typeof e)throw new Error(`Wordlist: non-string element: ${e}`)})),c.utils.chain(c.utils.checksum(1,m),c.utils.radix2(11,!0),c.utils.alphabet(e))}function h(e,t){let n;if("string"==typeof e){const{words:s}=l(e);n=p(t).decode(s)}else n=p(t).decode(Array.from(new Uint16Array(e.buffer)).map((e=>t[e])));return d(n),n}function f(e,t){d(e);const n=p(t).encode(e).map((e=>t.indexOf(e)));return new Uint8Array(new Uint16Array(n).buffer)}n.mnemonicToEntropy=h,n.entropyToMnemonic=f,n.validateMnemonic=function(e,t){try{h(e,t)}catch(e){return!1}return!0};const g=e=>u(`mnemonic${e}`);function y(e,t){let n;return n="string"==typeof e?(new TextEncoder).encode(l(e).nfkd):(new TextEncoder).encode(Array.from(new Uint16Array(e.buffer)).map((e=>t[e])).join(" ")),n}n.mnemonicToSeed=function(e,t,n=""){const s=y(e,t);return(0,r.pbkdf2Async)(a.sha512,s,g(n),{c:2048,dkLen:64})},n.mnemonicToSeedSync=function(e,t,n=""){const s=y(e,t);return(0,r.pbkdf2)(a.sha512,s,g(n),{c:2048,dkLen:64})}}}},{package:"@metamask/scure-bip39",file:"node_modules/@metamask/scure-bip39/dist/index.js"}],[2558,{},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){Object.defineProperty(n,"__esModule",{value:!0}),n.wordlist=void 0,n.wordlist="abandon\nability\nable\nabout\nabove\nabsent\nabsorb\nabstract\nabsurd\nabuse\naccess\naccident\naccount\naccuse\nachieve\nacid\nacoustic\nacquire\nacross\nact\naction\nactor\nactress\nactual\nadapt\nadd\naddict\naddress\nadjust\nadmit\nadult\nadvance\nadvice\naerobic\naffair\nafford\nafraid\nagain\nage\nagent\nagree\nahead\naim\nair\nairport\naisle\nalarm\nalbum\nalcohol\nalert\nalien\nall\nalley\nallow\nalmost\nalone\nalpha\nalready\nalso\nalter\nalways\namateur\namazing\namong\namount\namused\nanalyst\nanchor\nancient\nanger\nangle\nangry\nanimal\nankle\nannounce\nannual\nanother\nanswer\nantenna\nantique\nanxiety\nany\napart\napology\nappear\napple\napprove\napril\narch\narctic\narea\narena\nargue\narm\narmed\narmor\narmy\naround\narrange\narrest\narrive\narrow\nart\nartefact\nartist\nartwork\nask\naspect\nassault\nasset\nassist\nassume\nasthma\nathlete\natom\nattack\nattend\nattitude\nattract\nauction\naudit\naugust\naunt\nauthor\nauto\nautumn\naverage\navocado\navoid\nawake\naware\naway\nawesome\nawful\nawkward\naxis\nbaby\nbachelor\nbacon\nbadge\nbag\nbalance\nbalcony\nball\nbamboo\nbanana\nbanner\nbar\nbarely\nbargain\nbarrel\nbase\nbasic\nbasket\nbattle\nbeach\nbean\nbeauty\nbecause\nbecome\nbeef\nbefore\nbegin\nbehave\nbehind\nbelieve\nbelow\nbelt\nbench\nbenefit\nbest\nbetray\nbetter\nbetween\nbeyond\nbicycle\nbid\nbike\nbind\nbiology\nbird\nbirth\nbitter\nblack\nblade\nblame\nblanket\nblast\nbleak\nbless\nblind\nblood\nblossom\nblouse\nblue\nblur\nblush\nboard\nboat\nbody\nboil\nbomb\nbone\nbonus\nbook\nboost\nborder\nboring\nborrow\nboss\nbottom\nbounce\nbox\nboy\nbracket\nbrain\nbrand\nbrass\nbrave\nbread\nbreeze\nbrick\nbridge\nbrief\nbright\nbring\nbrisk\nbroccoli\nbroken\nbronze\nbroom\nbrother\nbrown\nbrush\nbubble\nbuddy\nbudget\nbuffalo\nbuild\nbulb\nbulk\nbullet\nbundle\nbunker\nburden\nburger\nburst\nbus\nbusiness\nbusy\nbutter\nbuyer\nbuzz\ncabbage\ncabin\ncable\ncactus\ncage\ncake\ncall\ncalm\nc
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */
Object.defineProperty(n,"__esModule",{value:!0}),n.randomBytes=n.wrapXOFConstructorWithOpts=n.wrapConstructorWithOpts=n.wrapConstructor=n.checkOpts=n.Hash=n.concatBytes=n.toBytes=n.utf8ToBytes=n.asyncLoop=n.nextTick=n.hexToBytes=n.bytesToHex=n.isLE=n.rotr=n.createView=n.u32=n.u8=void 0;const s=e("@noble/hashes/crypto");n.u8=e=>new Uint8Array(e.buffer,e.byteOffset,e.byteLength);function r(e){return e instanceof Uint8Array||null!=e&&"object"==typeof e&&"Uint8Array"===e.constructor.name}n.u32=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4));n.createView=e=>new DataView(e.buffer,e.byteOffset,e.byteLength);if(n.rotr=(e,t)=>e<<32-t|e>>>t,n.isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0],!n.isLE)throw new Error("Non little-endian hardware is not supported");const i=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));n.bytesToHex=function(e){if(!r(e))throw new Error("Uint8Array expected");let t="";for(let n=0;n<e.length;n++)t+=i[e[n]];return t};const a={_0:48,_9:57,_A:65,_F:70,_a:97,_f:102};function o(e){return e>=a._0&&e<=a._9?e-a._0:e>=a._A&&e<=a._F?e-(a._A-10):e>=a._a&&e<=a._f?e-(a._a-10):void 0}n.hexToBytes=function(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length,n=t/2;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const s=new Uint8Array(n);for(let t=0,r=0;t<n;t++,r+=2){const n=o(e.charCodeAt(r)),i=o(e.charCodeAt(r+1));if(n===undefined||i===undefined){const t=e[r]+e[r+1];throw new Error('hex string expected, got non-hex character "'+t+'" at index '+r)}s[t]=16*n+i}return s};function c(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}function u(e){if("string"==typeof e&&(e=c(e)),!r(e))throw new Error("expected Uint8Array, got "+typeof e);return e}n.nextTick=async()=>{},n.asyncLoop=async function(e,t,s){let r=Date.now();for(let i=0;i<e;i++){s(i);const e=Date.now()-r;e>=0&&e<t||(await(0,n.nextTick)(),r+=e)}},n.utf8ToBytes=c,n.toBytes=u,n.concatBytes=function(...e){let t=0;for(let n=0;n<e.length;n++){const s=e[n];if(!r(s))throw new Error("Uint8Array expected");t+=s.length}const n=new Uint8Array(t);for(let t=0,s=0;t<e.length;t++){const r=e[t];n.set(r,s),s+=r.length}return n};n.Hash=class{clone(){return this._cloneInto()}};const l={}.toString;n.checkOpts=function(e,t){if(t!==undefined&&"[object Object]"!==l.call(t))throw new Error("Options should be object or undefined");return Object.assign(e,t)},n.wrapConstructor=function(e){const t=t=>e().update(u(t)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t},n.wrapConstructorWithOpts=function(e){const t=(t,n)=>e(n).update(u(t)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=t=>e(t),t},n.wrapXOFConstructorWithOpts=function(e){const t=(t,n)=>e(n).update(u(t)).digest(),n=e({});return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=t=>e(t),t},n.randomBytes=function(e=32){if(s.crypto&&"function"==typeof s.crypto.getRandomValues)return s.crypto.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}}}},{package:"@metamask/scure-bip39>@noble/hashes",file:"node_modules/@metamask/scure-bip39/node_modules/@noble/hashes/utils.js"}],[2576,{"./logger.cjs":2578,"./types.cjs":2579,"./utils/decoding-api.cjs":2580,"./utils/normalize.cjs":2581,"./utils/validation.cjs":2582,"@metamask/base-controller":1383,"@metamask/controller-utils":1474,"@metamask/keyring-controller":1990,"@metamask/logging-controller":2070,events:4399,uuid:5663},function(){with(this.scopeTerminator)with(this.globalThis)return function(){"use strict";return function(e,t,n){var s,r,i,a,o,c,u,l,d,m,p,h,f,g,y,b,x,S,k,v,w,T,_=this&&this.__classPrivateFieldSet||function(e,t,n,s,r){if("m"===s)throw new TypeError("Private method is not writable");if("a"===s&&!r)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!r:!t.has(e))throw new TypeError("Cannot write pri