@joclaim/browser-extension-sdk 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build/174.bundle.js +1 -0
- package/build/JoclaimExtensionSDK-mv2.bundle.js +1 -1
- package/build/JoclaimExtensionSDK.bundle.js +1 -1
- package/build/content/components/reclaim-provider-verification-popup.css +666 -0
- package/build/content/components/reclaim-provider-verification-popup.html +138 -0
- package/build/content/content.bundle.js +11 -0
- package/build/content/content.bundle.js.map +1 -0
- package/build/interceptor/injection-scripts.bundle.js +2 -0
- package/build/interceptor/injection-scripts.bundle.js.map +1 -0
- package/build/interceptor/network-interceptor.bundle.js +2 -0
- package/build/interceptor/network-interceptor.bundle.js.map +1 -0
- package/build/offscreen/offscreen.bundle.js +121 -0
- package/build/offscreen/offscreen.bundle.js.map +1 -0
- package/build/offscreen/offscreen.html +15 -0
- package/build/scripts/download-circuits.js +1 -0
- package/build/scripts/install-assets.js +2 -0
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_joclaim_browser_extension_sdk=self.webpackChunk_joclaim_browser_extension_sdk||[]).push([[174],{7174(){}}]);
|
|
@@ -19,5 +19,5 @@ function Ot(e){return{hash:e,hmac:(t,...r)=>ut(e,t,function(...e){const t=new Ui
|
|
|
19
19
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
20
20
|
const It=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),St=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),wt=BigInt(1),At=BigInt(2),Rt=(e,t)=>(e+t/At)/t;function Tt(e){const t=It,r=BigInt(3),n=BigInt(6),o=BigInt(11),i=BigInt(22),s=BigInt(23),a=BigInt(44),c=BigInt(88),u=e*e*e%t,l=u*u*e%t,f=tt(l,r,t)*l%t,h=tt(f,r,t)*l%t,d=tt(h,At,t)*u%t,p=tt(d,o,t)*d%t,g=tt(p,i,t)*p%t,y=tt(g,a,t)*g%t,m=tt(y,c,t)*y%t,E=tt(m,a,t)*g%t,b=tt(E,r,t)*l%t,v=tt(b,s,t)*p%t,O=tt(v,n,t)*u%t,I=tt(O,At,t);if(!_t.eql(_t.sqr(I),e))throw new Error("Cannot find square root");return I}const _t=function(e,t,r=!1,n={}){if(e<=Ye)throw new Error(`Expected Field ORDER > 0, got ${e}`);const{nBitLength:o,nByteLength:i}=it(e,t);if(i>2048)throw new Error("Field lengths over 2048 bytes are not supported");const s=nt(e),a=Object.freeze({ORDER:e,BITS:o,BYTES:i,MASK:Me(o),ZERO:Ye,ONE:qe,create:t=>Ze(t,e),isValid:t=>{if("bigint"!=typeof t)throw new Error("Invalid field element: expected bigint, got "+typeof t);return Ye<=t&&t<e},is0:e=>e===Ye,isOdd:e=>(e&qe)===qe,neg:t=>Ze(-t,e),eql:(e,t)=>e===t,sqr:t=>Ze(t*t,e),add:(t,r)=>Ze(t+r,e),sub:(t,r)=>Ze(t-r,e),mul:(t,r)=>Ze(t*r,e),pow:(e,t)=>function(e,t,r){if(r<Ye)throw new Error("Expected power > 0");if(r===Ye)return e.ONE;if(r===qe)return t;let n=e.ONE,o=t;for(;r>Ye;)r&qe&&(n=e.mul(n,o)),o=e.sqr(o),r>>=qe;return n}(a,e,t),div:(t,r)=>Ze(t*rt(r,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>rt(t,e),sqrt:n.sqrt||(e=>s(a,e)),invertBatch:e=>function(e,t){const r=new Array(t.length),n=t.reduce((t,n,o)=>e.is0(n)?t:(r[o]=t,e.mul(t,n)),e.ONE),o=e.inv(n);return t.reduceRight((t,n,o)=>e.is0(n)?t:(r[o]=e.mul(t,r[o]),e.mul(t,n)),o),r}(a,e),cmov:(e,t,r)=>r?t:e,toBytes:e=>r?ke(e,i):Ge(e,i),fromBytes:e=>{if(e.length!==i)throw new Error(`Fp.fromBytes: expected ${i}, got ${e.length}`);return r?xe(e):Ue(e)}});return Object.freeze(a)}(It,void 0,void 0,{sqrt:Tt}),Nt=function(e,t){const r=t=>vt({...e,...Ot(t)});return Object.freeze({...r(t),create:r})}({a:BigInt(0),b:BigInt(7),Fp:_t,n:St,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{const t=St,r=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),n=-wt*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),o=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=r,s=BigInt("0x100000000000000000000000000000000"),a=Rt(i*e,t),c=Rt(-n*e,t);let u=Ze(e-a*r-c*o,t),l=Ze(-a*n-c*i,t);const f=u>s,h=l>s;if(f&&(u=t-u),h&&(l=t-l),u>s||l>s)throw new Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:f,k1:u,k2neg:h,k2:l}}}},Re);BigInt(0);Nt.ProjectivePoint;const Ct=BigInt(0),Pt=BigInt(1),Lt=9007199254740991;function Dt(e,t){switch(typeof e){case"bigint":return e;case"number":return Z(Number.isInteger(e),"underflow",t||"value",e),Z(e>=-Lt&&e<=Lt,"overflow",t||"value",e),BigInt(e);case"string":try{if(""===e)throw new Error("empty string");return"-"===e[0]&&"-"!==e[1]?-BigInt(e.substring(1)):BigInt(e)}catch(r){Z(!1,`invalid BigNumberish string: ${r.message}`,t||"value",e)}}Z(!1,"invalid BigNumberish value",t||"value",e)}function Ut(e,t){const r=Dt(e,t);return Q(r>=Ct,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:e}),r}const xt="0123456789abcdef";function Gt(e){if(e instanceof Uint8Array){let t="0x0";for(const r of e)t+=xt[r>>4],t+=xt[15&r];return BigInt(t)}return Dt(e)}function kt(e,t){switch(typeof e){case"bigint":return Z(e>=-Lt&&e<=Lt,"overflow",t||"value",e),Number(e);case"number":return Z(Number.isInteger(e),"underflow",t||"value",e),Z(e>=-Lt&&e<=Lt,"overflow",t||"value",e),e;case"string":try{if(""===e)throw new Error("empty string");return kt(BigInt(e),t)}catch(r){Z(!1,`invalid numeric string: ${r.message}`,t||"value",e)}}Z(!1,"invalid numeric value",t||"value",e)}function Ft(e,t){const r=Ut(e,"value");let n=r.toString(16);if(null==t)n.length%2&&(n="0"+n);else{const o=kt(t,"width");if(0===o&&r===Ct)return"0x";for(Q(2*o>=n.length,`value exceeds width (${o} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:e});n.length<2*o;)n="0"+n}return"0x"+n}function Bt(e,t){const r=Ut(e,"value");if(r===Ct){const e=null!=t?kt(t,"width"):0;return new Uint8Array(e)}let n=r.toString(16);if(n.length%2&&(n="0"+n),null!=t){const r=kt(t,"width");for(;n.length<2*r;)n="00"+n;Q(2*r===n.length,`value exceeds width (${r} bytes)`,"NUMERIC_FAULT",{operation:"toBeArray",fault:"overflow",value:e})}const o=new Uint8Array(n.length/2);for(let e=0;e<o.length;e++){const t=2*e;o[e]=parseInt(n.substring(t,t+2),16)}return o}const Mt="0x0000000000000000000000000000000000000000000000000000000000000000",jt=BigInt(0),Kt=BigInt(1),$t=BigInt(2),Vt=BigInt(27),Ht=BigInt(28),Yt=BigInt(35),qt=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),zt=qt/$t,Wt=Symbol.for("nodejs.util.inspect.custom"),Jt={};function Xt(e){return pe(Bt(e),32)}class Qt{#e;#t;#r;#n;get r(){return this.#e}set r(e){Z(32===fe(e),"invalid r","value",e),this.#e=ue(e)}get s(){return Z(parseInt(this.#t.substring(0,3))<8,"non-canonical s; use ._s","s",this.#t),this.#t}set s(e){Z(32===fe(e),"invalid s","value",e),this.#t=ue(e)}get _s(){return this.#t}isValid(){return BigInt(this.#t)<=zt}get v(){return this.#r}set v(e){const t=kt(e,"value");Z(27===t||28===t,"invalid v","v",e),this.#r=t}get networkV(){return this.#n}get legacyChainId(){const e=this.networkV;return null==e?null:Qt.getChainId(e)}get yParity(){return 27===this.v?0:1}get yParityAndS(){const e=oe(this.s);return this.yParity&&(e[0]|=128),ue(e)}get compactSerialized(){return le([this.r,this.yParityAndS])}get serialized(){return le([this.r,this.s,this.yParity?"0x1c":"0x1b"])}constructor(e,t,r,n){re(e,Jt,"Signature"),this.#e=t,this.#t=r,this.#r=n,this.#n=null}getCanonical(){if(this.isValid())return this;const e=qt-BigInt(this._s),t=55-this.v,r=new Qt(Jt,this.r,Xt(e),t);return this.networkV&&(r.#n=this.networkV),r}clone(){const e=new Qt(Jt,this.r,this._s,this.v);return this.networkV&&(e.#n=this.networkV),e}toJSON(){const e=this.networkV;return{_type:"signature",networkV:null!=e?e.toString():null,r:this.r,s:this._s,v:this.v}}[Wt](){return this.toString()}toString(){return this.isValid()?`Signature { r: ${this.r}, s: ${this._s}, v: ${this.v} }`:`Signature { r: ${this.r}, s: ${this._s}, v: ${this.v}, valid: false }`}static getChainId(e){const t=Dt(e,"v");return t==Vt||t==Ht?jt:(Z(t>=Yt,"invalid EIP-155 v","v",e),(t-Yt)/$t)}static getChainIdV(e,t){return Dt(e)*$t+BigInt(35+t-27)}static getNormalizedV(e){const t=Dt(e);return t===jt||t===Vt?27:t===Kt||t===Ht?28:(Z(t>=Yt,"invalid v","v",e),t&Kt?27:28)}static from(e){function t(t,r){Z(t,r,"signature",e)}if(null==e)return new Qt(Jt,Mt,Mt,27);if("string"==typeof e){const r=oe(e,"signature");if(64===r.length){const e=ue(r.slice(0,32)),t=r.slice(32,64),n=128&t[0]?28:27;return t[0]&=127,new Qt(Jt,e,ue(t),n)}if(65===r.length){const e=ue(r.slice(0,32)),t=ue(r.slice(32,64)),n=Qt.getNormalizedV(r[64]);return new Qt(Jt,e,t,n)}t(!1,"invalid raw signature length")}if(e instanceof Qt)return e.clone();const r=e.r;t(null!=r,"missing r");const n=Xt(r),o=function(e,r){if(null!=e)return Xt(e);if(null!=r){t(se(r,32),"invalid yParityAndS");const e=oe(r);return e[0]&=127,ue(e)}t(!1,"missing s")}(e.s,e.yParityAndS),{networkV:i,v:s}=function(e,r,n){if(null!=e){const t=Dt(e);return{networkV:t>=Yt?t:void 0,v:Qt.getNormalizedV(t)}}if(null!=r)return t(se(r,32),"invalid yParityAndS"),{v:128&oe(r)[0]?28:27};if(null!=n){switch(kt(n,"sig.yParity")){case 0:return{v:27};case 1:return{v:28}}t(!1,"invalid yParity")}t(!1,"missing v")}(e.v,e.yParityAndS,e.yParity),a=new Qt(Jt,n,o,s);return i&&(a.#n=i),t(null==e.yParity||kt(e.yParity,"sig.yParity")===a.yParity,"yParity mismatch"),t(null==e.yParityAndS||e.yParityAndS===a.yParityAndS,"yParityAndS mismatch"),a}}class Zt{#o;constructor(e){Z(32===fe(e),"invalid private key","privateKey","[REDACTED]"),this.#o=ue(e)}get privateKey(){return this.#o}get publicKey(){return Zt.computePublicKey(this.#o)}get compressedPublicKey(){return Zt.computePublicKey(this.#o,!0)}sign(e){Z(32===fe(e),"invalid digest length","digest",e);const t=Nt.sign(ie(e),ie(this.#o),{lowS:!0});return Qt.from({r:Ft(t.r,32),s:Ft(t.s,32),v:t.recovery?28:27})}computeSharedSecret(e){const t=Zt.computePublicKey(e);return ue(Nt.getSharedSecret(ie(this.#o),oe(t),!1))}static computePublicKey(e,t){let r=oe(e,"key");if(32===r.length){return ue(Nt.getPublicKey(r,!!t))}if(64===r.length){const e=new Uint8Array(65);e[0]=4,e.set(r,1),r=e}return ue(Nt.ProjectivePoint.fromHex(r).toRawBytes(t))}static recoverPublicKey(e,t){Z(32===fe(e),"invalid digest length","digest",e);const r=Qt.from(t);let n=Nt.Signature.fromCompact(ie(le([r.r,r.s])));n=n.addRecoveryBit(r.yParity);const o=n.recoverPublicKey(ie(e));return Z(null!=o,"invalid signature for digest","signature",t),"0x"+o.toHex(!1)}static addPoints(e,t,r){const n=Nt.ProjectivePoint.fromHex(Zt.computePublicKey(e).substring(2)),o=Nt.ProjectivePoint.fromHex(Zt.computePublicKey(t).substring(2));return"0x"+n.add(o).toHex(!!r)}}const er=BigInt(0),tr=BigInt(36);function rr(e){const t=(e=e.toLowerCase()).substring(2).split(""),r=new Uint8Array(40);for(let e=0;e<40;e++)r[e]=t[e].charCodeAt(0);const n=oe(Ee(r));for(let e=0;e<40;e+=2)n[e>>1]>>4>=8&&(t[e]=t[e].toUpperCase()),(15&n[e>>1])>=8&&(t[e+1]=t[e+1].toUpperCase());return"0x"+t.join("")}const nr={};for(let e=0;e<10;e++)nr[String(e)]=String(e);for(let e=0;e<26;e++)nr[String.fromCharCode(65+e)]=String(10+e);function or(e){let t=(e=(e=e.toUpperCase()).substring(4)+e.substring(0,2)+"00").split("").map(e=>nr[e]).join("");for(;t.length>=15;){let e=t.substring(0,15);t=parseInt(e,10)%97+t.substring(e.length)}let r=String(98-parseInt(t,10)%97);for(;r.length<2;)r="0"+r;return r}const ir=function(){const e={};for(let t=0;t<36;t++){e["0123456789abcdefghijklmnopqrstuvwxyz"[t]]=BigInt(t)}return e}();function sr(e){if(Z("string"==typeof e,"invalid address","address",e),e.match(/^(0x)?[0-9a-fA-F]{40}$/)){e.startsWith("0x")||(e="0x"+e);const t=rr(e);return Z(!e.match(/([A-F].*[a-f])|([a-f].*[A-F])/)||t===e,"bad address checksum","address",e),t}if(e.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){Z(e.substring(2,4)===or(e),"bad icap checksum","address",e);let t=function(e){e=e.toLowerCase();let t=er;for(let r=0;r<e.length;r++)t=t*tr+ir[e[r]];return t}(e.substring(4)).toString(16);for(;t.length<40;)t="0"+t;return rr("0x"+t)}Z(!1,"invalid address","address",e)}async function ar(e,t){const r=await t;return null!=r&&"0x0000000000000000000000000000000000000000"!==r||(Q("string"!=typeof e,"unconfigured name","UNCONFIGURED_NAME",{value:e}),Z(!1,"invalid AddressLike value; did not resolve to a value address","target",e)),sr(r)}function cr(e,t){return"string"==typeof e?e.match(/^0x[0-9a-f]{40}$/i)?sr(e):(Q(null!=t,"ENS resolution requires a provider","UNSUPPORTED_OPERATION",{operation:"resolveName"}),ar(e,t.resolveName(e))):(r=e)&&"function"==typeof r.getAddress?ar(e,e.getAddress()):e&&"function"==typeof e.then?ar(e,e):void Z(!1,"unsupported addressable value","target",e);var r}function ur(e,t,r,n,o){if("BAD_PREFIX"===e||"UNEXPECTED_CONTINUE"===e){let e=0;for(let n=t+1;n<r.length&&r[n]>>6==2;n++)e++;return e}return"OVERRUN"===e?r.length-t-1:0}Object.freeze({error:function(e,t,r,n,o){Z(!1,`invalid codepoint at offset ${t}; ${e}`,"bytes",r)},ignore:ur,replace:function(e,t,r,n,o){return"OVERLONG"===e?(Z("number"==typeof o,"invalid bad code point for replacement","badCodepoint",o),n.push(o),0):(n.push(65533),ur(e,t,r))}});function lr(e,t){Z("string"==typeof e,"invalid string value","str",e),null!=t&&(te(t),e=e.normalize(t));let r=[];for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);if(n<128)r.push(n);else if(n<2048)r.push(n>>6|192),r.push(63&n|128);else if(55296==(64512&n)){t++;const o=e.charCodeAt(t);Z(t<e.length&&56320==(64512&o),"invalid surrogate pair","str",e);const i=65536+((1023&n)<<10)+(1023&o);r.push(i>>18|240),r.push(i>>12&63|128),r.push(i>>6&63|128),r.push(63&i|128)}else r.push(n>>12|224),r.push(n>>6&63|128),r.push(63&n|128)}return new Uint8Array(r)}function fr(e){return"string"==typeof e&&(e=lr(e)),Ee(le([lr("Ethereum Signed Message:\n"),lr(String(e.length)),e]))}function hr(e){const t=[];for(;e;)t.unshift(255&e),e>>=8;return t}function dr(e){if(Array.isArray(e)){let t=[];if(e.forEach(function(e){t=t.concat(dr(e))}),t.length<=55)return t.unshift(192+t.length),t;const r=hr(t.length);return r.unshift(247+r.length),r.concat(t)}const t=Array.prototype.slice.call(oe(e,"object"));if(1===t.length&&t[0]<=127)return t;if(t.length<=55)return t.unshift(128+t.length),t;const r=hr(t.length);return r.unshift(183+r.length),r.concat(t)}const pr="0123456789abcdef";function gr(e){let t="0x";for(const r of dr(e))t+=pr[r>>4],t+=pr[15&r];return t}function yr(e){return Z("string"==typeof e.address,"invalid address for hashAuthorization","auth.address",e),Ee(le(["0x05",gr([null!=e.chainId?Bt(e.chainId):"0x",sr(e.address),null!=e.nonce?Bt(e.nonce):"0x"])]))}function mr(e){return Ee(lr(e))}const Er=new Uint8Array(32);Er.fill(0);const br=BigInt(-1),vr=BigInt(0),Or=BigInt(1),Ir=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff");const Sr=Ft(Or,32),wr=Ft(vr,32),Ar={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},Rr=["name","version","chainId","verifyingContract","salt"];function Tr(e){return function(t){return Z("string"==typeof t,`invalid domain value for ${JSON.stringify(e)}`,`domain.${e}`,t),t}}const _r={name:Tr("name"),version:Tr("version"),chainId:function(e){const t=Dt(e,"domain.chainId");return Z(t>=0,"invalid chain ID","domain.chainId",e),Number.isSafeInteger(t)?Number(t):function(e){let t=ue(ae(e)?e:Bt(e)).substring(2);for(;t.startsWith("0");)t=t.substring(1);return""===t&&(t="0"),"0x"+t}(t)},verifyingContract:function(e){try{return sr(e).toLowerCase()}catch(e){}Z(!1,'invalid domain value "verifyingContract"',"domain.verifyingContract",e)},salt:function(e){const t=oe(e,"domain.salt");return Z(32===t.length,'invalid domain value "salt"',"domain.salt",e),ue(t)}};function Nr(e){{const t=e.match(/^(u?)int(\d+)$/);if(t){const r=""===t[1],n=parseInt(t[2]);Z(n%8==0&&0!==n&&n<=256&&t[2]===String(n),"invalid numeric width","type",e);const o=function(e,t){const r=Ut(e,"value"),n=BigInt(kt(t,"bits"));return r&(Pt<<n)-Pt}(Ir,r?n-1:n),i=r?(o+Or)*br:vr;return function(t){const n=Dt(t,"value");return Z(n>=i&&n<=o,`value out-of-bounds for ${e}`,"value",n),Ft(r?function(e,t){let r=Dt(e,"value");const n=BigInt(kt(t,"width")),o=Pt<<n-Pt;if(r<Ct)return r=-r,Q(r<=o,"too low","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:e}),(~r&(Pt<<n)-Pt)+Pt;return Q(r<o,"too high","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:e}),r}(n,256):n,32)}}}{const t=e.match(/^bytes(\d+)$/);if(t){const r=parseInt(t[1]);return Z(0!==r&&r<=32&&t[1]===String(r),"invalid bytes width","type",e),function(t){return Z(oe(t).length===r,`invalid length for ${e}`,"value",t),function(e){const t=oe(e),r=t.length%32;return r?le([t,Er.slice(r)]):ue(t)}(t)}}}switch(e){case"address":return function(e){return pe(sr(e),32)};case"bool":return function(e){return e?Sr:wr};case"bytes":return function(e){return Ee(e)};case"string":return function(e){return mr(e)}}return null}function Cr(e,t){return`${e}(${t.map(({name:e,type:t})=>t+" "+e).join(",")})`}function Pr(e){const t=e.match(/^([^\x5b]*)((\x5b\d*\x5d)*)(\x5b(\d*)\x5d)$/);return t?{base:t[1],index:t[2]+t[4],array:{base:t[1],prefix:t[1]+t[2],count:t[5]?parseInt(t[5]):-1}}:{base:e}}class Lr{primaryType;#i;get types(){return JSON.parse(this.#i)}#s;#a;constructor(e){this.#s=new Map,this.#a=new Map;const t=new Map,r=new Map,n=new Map,o={};Object.keys(e).forEach(i=>{o[i]=e[i].map(({name:t,type:r})=>{let{base:n,index:o}=Pr(r);return"int"!==n||e.int||(n="int256"),"uint"!==n||e.uint||(n="uint256"),{name:t,type:n+(o||"")}}),t.set(i,new Set),r.set(i,[]),n.set(i,new Set)}),this.#i=JSON.stringify(o);for(const n in o){const i=new Set;for(const s of o[n]){Z(!i.has(s.name),`duplicate variable name ${JSON.stringify(s.name)} in ${JSON.stringify(n)}`,"types",e),i.add(s.name);const o=Pr(s.type).base;Z(o!==n,`circular type reference to ${JSON.stringify(o)}`,"types",e);Nr(o)||(Z(r.has(o),`unknown type ${JSON.stringify(o)}`,"types",e),r.get(o).push(n),t.get(n).add(o))}}const i=Array.from(r.keys()).filter(e=>0===r.get(e).length);Z(0!==i.length,"missing primary type","types",e),Z(1===i.length,`ambiguous primary types or unused types: ${i.map(e=>JSON.stringify(e)).join(", ")}`,"types",e),W(this,{primaryType:i[0]}),function o(i,s){Z(!s.has(i),`circular type reference to ${JSON.stringify(i)}`,"types",e),s.add(i);for(const e of t.get(i))if(r.has(e)){o(e,s);for(const t of s)n.get(t).add(e)}s.delete(i)}(this.primaryType,new Set);for(const[e,t]of n){const r=Array.from(t);r.sort(),this.#s.set(e,Cr(e,o[e])+r.map(e=>Cr(e,o[e])).join(""))}}getEncoder(e){let t=this.#a.get(e);return t||(t=this.#c(e),this.#a.set(e,t)),t}#c(e){{const t=Nr(e);if(t)return t}const t=Pr(e).array;if(t){const e=t.prefix,r=this.getEncoder(e);return n=>{Z(-1===t.count||t.count===n.length,`array length mismatch; expected length ${t.count}`,"value",n);let o=n.map(r);return this.#s.has(e)&&(o=o.map(Ee)),Ee(le(o))}}const r=this.types[e];if(r){const t=mr(this.#s.get(e));return e=>{const n=r.map(({name:t,type:r})=>{const n=this.getEncoder(r)(e[t]);return this.#s.has(r)?Ee(n):n});return n.unshift(t),le(n)}}Z(!1,`unknown type: ${e}`,"type",e)}encodeType(e){const t=this.#s.get(e);return Z(t,`unknown type: ${JSON.stringify(e)}`,"name",e),t}encodeData(e,t){return this.getEncoder(e)(t)}hashStruct(e,t){return Ee(this.encodeData(e,t))}encode(e){return this.encodeData(this.primaryType,e)}hash(e){return this.hashStruct(this.primaryType,e)}_visit(e,t,r){if(Nr(e))return r(e,t);const n=Pr(e).array;if(n)return Z(-1===n.count||n.count===t.length,`array length mismatch; expected length ${n.count}`,"value",t),t.map(e=>this._visit(n.prefix,e,r));const o=this.types[e];if(o)return o.reduce((e,{name:n,type:o})=>(e[n]=this._visit(o,t[n],r),e),{});Z(!1,`unknown type: ${e}`,"type",e)}visit(e,t){return this._visit(this.primaryType,e,t)}static from(e){return new Lr(e)}static getPrimaryType(e){return Lr.from(e).primaryType}static hashStruct(e,t,r){return Lr.from(t).hashStruct(e,r)}static hashDomain(e){const t=[];for(const r in e){if(null==e[r])continue;const n=Ar[r];Z(n,`invalid typed-data domain key: ${JSON.stringify(r)}`,"domain",e),t.push({name:r,type:n})}return t.sort((e,t)=>Rr.indexOf(e.name)-Rr.indexOf(t.name)),Lr.hashStruct("EIP712Domain",{EIP712Domain:t},e)}static encode(e,t,r){return le(["0x1901",Lr.hashDomain(e),Lr.from(t).hash(r)])}static hash(e,t,r){return Ee(Lr.encode(e,t,r))}static async resolveNames(e,t,r,n){e=Object.assign({},e);for(const t in e)null==e[t]&&delete e[t];const o={};e.verifyingContract&&!se(e.verifyingContract,20)&&(o[e.verifyingContract]="0x");const i=Lr.from(t);i.visit(r,(e,t)=>("address"!==e||se(t,20)||(o[t]="0x"),t));for(const e in o)o[e]=await n(e);return e.verifyingContract&&o[e.verifyingContract]&&(e.verifyingContract=o[e.verifyingContract]),{domain:e,value:r=i.visit(r,(e,t)=>"address"===e&&o[t]?o[t]:t)}}static getPayload(e,t,r){Lr.hashDomain(e);const n={},o=[];Rr.forEach(t=>{const r=e[t];null!=r&&(n[t]=_r[t](r),o.push({name:t,type:Ar[t]}))});const i=Lr.from(t);t=i.types;const s=Object.assign({},t);return Z(null==s.EIP712Domain,"types must not contain EIP712Domain type","types.EIP712Domain",t),s.EIP712Domain=o,i.encode(r),{types:s,domain:n,primaryType:i.primaryType,message:i.visit(r,(e,t)=>{if(e.match(/^bytes(\d*)/))return ue(oe(t));if(e.match(/^u?int/))return Dt(t).toString();switch(e){case"address":return t.toLowerCase();case"bool":return!!t;case"string":return Z("string"==typeof t,"invalid string","value",t),t}Z(!1,"unsupported type","type",e)})}}}const Dr="0x0000000000000000000000000000000000000000";function Ur(e,r,n,o){i(e);const s=T({dkLen:32,asyncTick:10},o),{c:a,dkLen:c,asyncTick:u}=s;if(t(a),t(c),t(u),a<1)throw new Error("PBKDF2: iterations (c) should be >= 1");const l=w(r),f=w(n),h=new Uint8Array(c),d=ut.create(e,l),p=d._cloneInto().update(f);return{c:a,dkLen:c,asyncTick:u,DK:h,PRF:d,PRFSalt:p}}function xr(e,t,r,n,o){return e.destroy(),t.destroy(),n&&n.destroy(),o.fill(0),r}function Gr(e,t,r,n){const{c:o,dkLen:i,DK:s,PRF:a,PRFSalt:c}=Ur(e,t,r,n);let u;const l=new Uint8Array(4),f=v(l),h=new Uint8Array(a.outputLen);for(let e=1,t=0;t<i;e++,t+=a.outputLen){const r=s.subarray(t,t+a.outputLen);f.setInt32(0,e,!1),(u=c._cloneInto(u)).update(l).digestInto(h),r.set(h.subarray(0,r.length));for(let e=1;e<o;e++){a._cloneInto(u).update(h).digestInto(h);for(let e=0;e<r.length;e++)r[e]^=h[e]}}return xr(a,c,s,u,h)}const[kr,Fr]=(()=>y.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map(e=>BigInt(e))))(),Br=new Uint32Array(80),Mr=new Uint32Array(80);class jr extends be{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:t,Bh:r,Bl:n,Ch:o,Cl:i,Dh:s,Dl:a,Eh:c,El:u,Fh:l,Fl:f,Gh:h,Gl:d,Hh:p,Hl:g}=this;return[e,t,r,n,o,i,s,a,c,u,l,f,h,d,p,g]}set(e,t,r,n,o,i,s,a,c,u,l,f,h,d,p,g){this.Ah=0|e,this.Al=0|t,this.Bh=0|r,this.Bl=0|n,this.Ch=0|o,this.Cl=0|i,this.Dh=0|s,this.Dl=0|a,this.Eh=0|c,this.El=0|u,this.Fh=0|l,this.Fl=0|f,this.Gh=0|h,this.Gl=0|d,this.Hh=0|p,this.Hl=0|g}process(e,t){for(let r=0;r<16;r++,t+=4)Br[r]=e.getUint32(t),Mr[r]=e.getUint32(t+=4);for(let e=16;e<80;e++){const t=0|Br[e-15],r=0|Mr[e-15],n=y.rotrSH(t,r,1)^y.rotrSH(t,r,8)^y.shrSH(t,r,7),o=y.rotrSL(t,r,1)^y.rotrSL(t,r,8)^y.shrSL(t,r,7),i=0|Br[e-2],s=0|Mr[e-2],a=y.rotrSH(i,s,19)^y.rotrBH(i,s,61)^y.shrSH(i,s,6),c=y.rotrSL(i,s,19)^y.rotrBL(i,s,61)^y.shrSL(i,s,6),u=y.add4L(o,c,Mr[e-7],Mr[e-16]),l=y.add4H(u,n,a,Br[e-7],Br[e-16]);Br[e]=0|l,Mr[e]=0|u}let{Ah:r,Al:n,Bh:o,Bl:i,Ch:s,Cl:a,Dh:c,Dl:u,Eh:l,El:f,Fh:h,Fl:d,Gh:p,Gl:g,Hh:m,Hl:E}=this;for(let e=0;e<80;e++){const t=y.rotrSH(l,f,14)^y.rotrSH(l,f,18)^y.rotrBH(l,f,41),b=y.rotrSL(l,f,14)^y.rotrSL(l,f,18)^y.rotrBL(l,f,41),v=l&h^~l&p,O=f&d^~f&g,I=y.add5L(E,b,O,Fr[e],Mr[e]),S=y.add5H(I,m,t,v,kr[e],Br[e]),w=0|I,A=y.rotrSH(r,n,28)^y.rotrBH(r,n,34)^y.rotrBH(r,n,39),R=y.rotrSL(r,n,28)^y.rotrBL(r,n,34)^y.rotrBL(r,n,39),T=r&o^r&s^o&s,_=n&i^n&a^i&a;m=0|p,E=0|g,p=0|h,g=0|d,h=0|l,d=0|f,({h:l,l:f}=y.add(0|c,0|u,0|S,0|w)),c=0|s,u=0|a,s=0|o,a=0|i,o=0|r,i=0|n;const N=y.add3L(w,R,_);r=y.add3H(N,S,A,T),n=0|N}({h:r,l:n}=y.add(0|this.Ah,0|this.Al,0|r,0|n)),({h:o,l:i}=y.add(0|this.Bh,0|this.Bl,0|o,0|i)),({h:s,l:a}=y.add(0|this.Ch,0|this.Cl,0|s,0|a)),({h:c,l:u}=y.add(0|this.Dh,0|this.Dl,0|c,0|u)),({h:l,l:f}=y.add(0|this.Eh,0|this.El,0|l,0|f)),({h,l:d}=y.add(0|this.Fh,0|this.Fl,0|h,0|d)),({h:p,l:g}=y.add(0|this.Gh,0|this.Gl,0|p,0|g)),({h:m,l:E}=y.add(0|this.Hh,0|this.Hl,0|m,0|E)),this.set(r,n,o,i,s,a,c,u,l,f,h,d,p,g,m,E)}roundClean(){Br.fill(0),Mr.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const Kr=_(()=>new jr);const $r=function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==r.g)return r.g;throw new Error("unable to locate global object")}(),Vr=$r.crypto||$r.msCrypto;function Hr(e){switch(e){case"sha256":return Re.create();case"sha512":return Kr.create()}Z(!1,"invalid hashing algorithm name","algorithm",e)}const Yr=function(e){return Hr("sha256").update(e).digest()},qr=function(e){return Hr("sha512").update(e).digest()};let zr=Yr,Wr=qr,Jr=!1,Xr=!1;function Qr(e){const t=oe(e,"data");return ue(zr(t))}function Zr(e){const t=oe(e,"data");return ue(Wr(t))}function en(e){let t=e.toString(16);for(;t.length<2;)t="0"+t;return"0x"+t}function tn(e,t,r){let n=0;for(let o=0;o<r;o++)n=256*n+e[t+o];return n}function rn(e,t,r,n){const o=[];for(;r<t+1+n;){const i=nn(e,r);o.push(i.result),Q((r+=i.consumed)<=t+1+n,"child data too short","BUFFER_OVERRUN",{buffer:e,length:n,offset:t})}return{consumed:1+n,result:o}}function nn(e,t){Q(0!==e.length,"data too short","BUFFER_OVERRUN",{buffer:e,length:0,offset:1});const r=t=>{Q(t<=e.length,"data short segment too short","BUFFER_OVERRUN",{buffer:e,length:e.length,offset:t})};if(e[t]>=248){const n=e[t]-247;r(t+1+n);const o=tn(e,t+1,n);return r(t+1+n+o),rn(e,t,t+1+n,n+o)}if(e[t]>=192){const n=e[t]-192;return r(t+1+n),rn(e,t,t+1,n)}if(e[t]>=184){const n=e[t]-183;r(t+1+n);const o=tn(e,t+1,n);r(t+1+n+o);return{consumed:1+n+o,result:ue(e.slice(t+1+n,t+1+n+o))}}if(e[t]>=128){const n=e[t]-128;r(t+1+n);return{consumed:1+n,result:ue(e.slice(t+1,t+1+n))}}return{consumed:1,result:en(e[t])}}function on(e){const t=oe(e,"data"),r=nn(t,0);return Z(r.consumed===t.length,"unexpected junk after rlp payload","data",e),r.result}function sn(e,t){return{address:sr(e),storageKeys:t.map((e,t)=>(Z(se(e,32),"invalid slot",`storageKeys[${t}]`,e),e.toLowerCase()))}}function an(e){if(Array.isArray(e))return e.map((t,r)=>Array.isArray(t)?(Z(2===t.length,"invalid slot set",`value[${r}]`,t),sn(t[0],t[1])):(Z(null!=t&&"object"==typeof t,"invalid address-slot set","value",e),sn(t.address,t.storageKeys)));Z(null!=e&&"object"==typeof e,"invalid access list","value",e);const t=Object.keys(e).map(t=>{const r=e[t].reduce((e,t)=>(e[t]=!0,e),{});return sn(t,Object.keys(r).sort())});return t.sort((e,t)=>e.address.localeCompare(t.address)),t}function cn(e){let t;return t="string"==typeof e?Zt.computePublicKey(e,!1):e.publicKey,sr(Ee("0x"+t.substring(4)).substring(26))}Qr._=Yr,Qr.lock=function(){Jr=!0},Qr.register=function(e){if(Jr)throw new Error("sha256 is locked");zr=e},Object.freeze(Qr),Zr._=qr,Zr.lock=function(){Xr=!0},Zr.register=function(e){if(Xr)throw new Error("sha512 is locked");Wr=e},Object.freeze(Qr);const un=BigInt(0),ln=BigInt(2),fn=BigInt(27),hn=BigInt(28),dn=BigInt(35),pn=BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),gn=Symbol.for("nodejs.util.inspect.custom"),yn=131072,mn=128;function En(e,t){let r=e.toString(16);for(;r.length<2;)r="0"+r;return r+=Qr(t).substring(4),"0x"+r}function bn(e){return"0x"===e?null:sr(e)}function vn(e,t){try{return an(e)}catch(r){Z(!1,r.message,t,e)}}function On(e,t){try{if(!Array.isArray(e))throw new Error("authorizationList: invalid array");const t=[];for(let r=0;r<e.length;r++){const n=e[r];if(!Array.isArray(n))throw new Error(`authorization[${r}]: invalid array`);if(6!==n.length)throw new Error(`authorization[${r}]: wrong length`);if(!n[1])throw new Error(`authorization[${r}]: null address`);t.push({address:bn(n[1]),nonce:Sn(n[2],"nonce"),chainId:Sn(n[0],"chainId"),signature:Qt.from({yParity:In(n[3],"yParity"),r:pe(n[4],32),s:pe(n[5],32)})})}return t}catch(r){Z(!1,r.message,t,e)}}function In(e,t){return"0x"===e?0:kt(e,t)}function Sn(e,t){if("0x"===e)return un;const r=Dt(e,t);return Z(r<=pn,"value exceeds uint size",t,r),r}function wn(e,t){const r=Dt(e,"value"),n=Bt(r);return Z(n.length<=32,"value too large",`tx.${t}`,r),n}function An(e){return an(e).map(e=>[e.address,e.storageKeys])}function Rn(e,t){Z(Array.isArray(e),`invalid ${t}`,"value",e);for(let t=0;t<e.length;t++)Z(se(e[t],32),"invalid ${ param } hash",`value[${t}]`,e[t]);return e}function Tn(e,t){let r;try{if(r=In(t[0],"yParity"),0!==r&&1!==r)throw new Error("bad yParity")}catch(e){Z(!1,"invalid yParity","yParity",t[0])}const n=pe(t[1],32),o=pe(t[2],32),i=Qt.from({r:n,s:o,yParity:r});e.signature=i}class _n{#u;#l;#f;#h;#d;#p;#g;#y;#m;#E;#b;#v;#O;#I;#S;#w;#A;#R;get type(){return this.#u}set type(e){switch(e){case null:this.#u=null;break;case 0:case"legacy":this.#u=0;break;case 1:case"berlin":case"eip-2930":this.#u=1;break;case 2:case"london":case"eip-1559":this.#u=2;break;case 3:case"cancun":case"eip-4844":this.#u=3;break;case 4:case"pectra":case"eip-7702":this.#u=4;break;default:Z(!1,"unsupported transaction type","type",e)}}get typeName(){switch(this.type){case 0:return"legacy";case 1:return"eip-2930";case 2:return"eip-1559";case 3:return"eip-4844";case 4:return"eip-7702"}return null}get to(){const e=this.#l;return null==e&&3===this.type?Dr:e}set to(e){this.#l=null==e?null:sr(e)}get nonce(){return this.#h}set nonce(e){this.#h=kt(e,"value")}get gasLimit(){return this.#d}set gasLimit(e){this.#d=Dt(e)}get gasPrice(){const e=this.#p;return null!=e||0!==this.type&&1!==this.type?e:un}set gasPrice(e){this.#p=null==e?null:Dt(e,"gasPrice")}get maxPriorityFeePerGas(){const e=this.#g;return null==e?2===this.type||3===this.type?un:null:e}set maxPriorityFeePerGas(e){this.#g=null==e?null:Dt(e,"maxPriorityFeePerGas")}get maxFeePerGas(){const e=this.#y;return null==e?2===this.type||3===this.type?un:null:e}set maxFeePerGas(e){this.#y=null==e?null:Dt(e,"maxFeePerGas")}get data(){return this.#f}set data(e){this.#f=ue(e)}get value(){return this.#m}set value(e){this.#m=Dt(e,"value")}get chainId(){return this.#E}set chainId(e){this.#E=Dt(e)}get signature(){return this.#b||null}set signature(e){this.#b=null==e?null:Qt.from(e)}isValid(){const e=this.signature;if(e&&!e.isValid())return!1;const t=this.authorizationList;if(t)for(const e of t)if(!e.signature.isValid())return!1;return!0}get accessList(){const e=this.#v||null;return null==e?1===this.type||2===this.type||3===this.type?[]:null:e}set accessList(e){this.#v=null==e?null:an(e)}get authorizationList(){const e=this.#A||null;return null==e&&4===this.type?[]:e}set authorizationList(e){this.#A=null==e?null:e.map(e=>{return{address:sr((t=e).address),nonce:Dt(null!=t.nonce?t.nonce:0),chainId:Dt(null!=t.chainId?t.chainId:0),signature:Qt.from(t.signature)};var t})}get maxFeePerBlobGas(){const e=this.#O;return null==e&&3===this.type?un:e}set maxFeePerBlobGas(e){this.#O=null==e?null:Dt(e,"maxFeePerBlobGas")}get blobVersionedHashes(){let e=this.#I;return null==e&&3===this.type?[]:e}set blobVersionedHashes(e){if(null!=e){Z(Array.isArray(e),"blobVersionedHashes must be an Array","value",e),e=e.slice();for(let t=0;t<e.length;t++)Z(se(e[t],32),"invalid blobVersionedHash",`value[${t}]`,e[t])}this.#I=e}get blobs(){return null==this.#w?null:this.#w.map(e=>Object.assign({},e))}set blobs(e){if(null==e)return void(this.#w=null);const t=[],r=[];for(let n=0;n<e.length;n++){const o=e[n];if(ae(o)){Q(this.#S,"adding a raw blob requires a KZG library","UNSUPPORTED_OPERATION",{operation:"set blobs()"});let e=oe(o);if(Z(e.length<=yn,"blob is too large",`blobs[${n}]`,o),e.length!==yn){const t=new Uint8Array(yn);t.set(e),e=t}const i=this.#S.blobToKzgCommitment(e),s=ue(this.#S.computeBlobKzgProof(e,i));t.push({data:ue(e),commitment:ue(i),proof:s}),r.push(En(1,i))}else{const e=ue(o.data),n=ue(o.commitment),i=ue(o.proof);t.push({data:e,commitment:n,proof:i}),r.push(En(1,n))}}this.#w=t,this.#I=r}get kzg(){return this.#S}set kzg(e){this.#S=null==e?null:function(e){return{blobToKzgCommitment:t=>{if("computeBlobProof"in e){if("blobToKzgCommitment"in e&&"function"==typeof e.blobToKzgCommitment)return oe(e.blobToKzgCommitment(ue(t)))}else if("blobToKzgCommitment"in e&&"function"==typeof e.blobToKzgCommitment)return oe(e.blobToKzgCommitment(t));if("blobToKZGCommitment"in e&&"function"==typeof e.blobToKZGCommitment)return oe(e.blobToKZGCommitment(ue(t)));Z(!1,"unsupported KZG library","kzg",e)},computeBlobKzgProof:(t,r)=>"computeBlobProof"in e&&"function"==typeof e.computeBlobProof?oe(e.computeBlobProof(ue(t),ue(r))):"computeBlobKzgProof"in e&&"function"==typeof e.computeBlobKzgProof?e.computeBlobKzgProof(t,r):"computeBlobKZGProof"in e&&"function"==typeof e.computeBlobKZGProof?oe(e.computeBlobKZGProof(ue(t),ue(r))):void Z(!1,"unsupported KZG library","kzg",e)}}(e)}get blobWrapperVersion(){return this.#R}set blobWrapperVersion(e){this.#R=e}constructor(){this.#u=null,this.#l=null,this.#h=0,this.#d=un,this.#p=null,this.#g=null,this.#y=null,this.#f="0x",this.#m=un,this.#E=un,this.#b=null,this.#v=null,this.#O=null,this.#I=null,this.#S=null,this.#w=null,this.#A=null,this.#R=null}get hash(){return null==this.signature?null:Ee(this.#T(!0,!1))}get unsignedHash(){return Ee(this.unsignedSerialized)}get from(){return null==this.signature?null:(e=this.unsignedHash,t=this.signature.getCanonical(),cn(Zt.recoverPublicKey(e,t)));var e,t}get fromPublicKey(){return null==this.signature?null:Zt.recoverPublicKey(this.unsignedHash,this.signature.getCanonical())}isSigned(){return null!=this.signature}#T(e,t){Q(!e||null!=this.signature,"cannot serialize unsigned transaction; maybe you meant .unsignedSerialized","UNSUPPORTED_OPERATION",{operation:".serialized"});const r=e?this.signature:null;switch(this.inferType()){case 0:return function(e,t){const r=[wn(e.nonce,"nonce"),wn(e.gasPrice||0,"gasPrice"),wn(e.gasLimit,"gasLimit"),e.to||"0x",wn(e.value,"value"),e.data];let n=un;if(e.chainId!=un)n=Dt(e.chainId,"tx.chainId"),Z(!t||null==t.networkV||t.legacyChainId===n,"tx.chainId/sig.v mismatch","sig",t);else if(e.signature){const t=e.signature.legacyChainId;null!=t&&(n=t)}if(!t)return n!==un&&(r.push(Bt(n)),r.push("0x"),r.push("0x")),gr(r);let o=BigInt(27+t.yParity);return n!==un?o=Qt.getChainIdV(n,t.v):BigInt(t.v)!==o&&Z(!1,"tx.chainId/sig.v mismatch","sig",t),r.push(Bt(o)),r.push(Bt(t.r)),r.push(Bt(t._s)),gr(r)}(this,r);case 1:return function(e,t){const r=[wn(e.chainId,"chainId"),wn(e.nonce,"nonce"),wn(e.gasPrice||0,"gasPrice"),wn(e.gasLimit,"gasLimit"),e.to||"0x",wn(e.value,"value"),e.data,An(e.accessList||[])];return t&&(r.push(wn(t.yParity,"recoveryParam")),r.push(Bt(t.r)),r.push(Bt(t.s))),le(["0x01",gr(r)])}(this,r);case 2:return function(e,t){const r=[wn(e.chainId,"chainId"),wn(e.nonce,"nonce"),wn(e.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),wn(e.maxFeePerGas||0,"maxFeePerGas"),wn(e.gasLimit,"gasLimit"),e.to||"0x",wn(e.value,"value"),e.data,An(e.accessList||[])];return t&&(r.push(wn(t.yParity,"yParity")),r.push(Bt(t.r)),r.push(Bt(t.s))),le(["0x02",gr(r)])}(this,r);case 3:return function(e,t,r){const n=[wn(e.chainId,"chainId"),wn(e.nonce,"nonce"),wn(e.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),wn(e.maxFeePerGas||0,"maxFeePerGas"),wn(e.gasLimit,"gasLimit"),e.to||Dr,wn(e.value,"value"),e.data,An(e.accessList||[]),wn(e.maxFeePerBlobGas||0,"maxFeePerBlobGas"),Rn(e.blobVersionedHashes||[],"blobVersionedHashes")];if(t&&(n.push(wn(t.yParity,"yParity")),n.push(Bt(t.r)),n.push(Bt(t.s)),r)){if(null!=e.blobWrapperVersion){const t=Bt(e.blobWrapperVersion),o=[];for(const{proof:e}of r){const t=oe(e),r=t.length/mn;for(let e=0;e<t.length;e+=r)o.push(t.subarray(e,e+r))}return le(["0x03",gr([n,t,r.map(e=>e.data),r.map(e=>e.commitment),o])])}return le(["0x03",gr([n,r.map(e=>e.data),r.map(e=>e.commitment),r.map(e=>e.proof)])])}return le(["0x03",gr(n)])}(this,r,t?this.blobs:null);case 4:return function(e,t){const r=[wn(e.chainId,"chainId"),wn(e.nonce,"nonce"),wn(e.maxPriorityFeePerGas||0,"maxPriorityFeePerGas"),wn(e.maxFeePerGas||0,"maxFeePerGas"),wn(e.gasLimit,"gasLimit"),e.to||"0x",wn(e.value,"value"),e.data,An(e.accessList||[]),(n=e.authorizationList||[],n.map(e=>[wn(e.chainId,"chainId"),e.address,wn(e.nonce,"nonce"),wn(e.signature.yParity,"yParity"),Bt(e.signature.r),Bt(e.signature._s)]))];var n;return t&&(r.push(wn(t.yParity,"yParity")),r.push(Bt(t.r)),r.push(Bt(t.s))),le(["0x04",gr(r)])}(this,r)}Q(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:".serialized"})}get serialized(){return this.#T(!0,!0)}get unsignedSerialized(){return this.#T(!1,!1)}inferType(){const e=this.inferTypes();return e.indexOf(2)>=0?2:e.pop()}inferTypes(){const e=null!=this.gasPrice,t=null!=this.maxFeePerGas||null!=this.maxPriorityFeePerGas,r=null!=this.accessList,n=null!=this.#O||this.#I;null!=this.maxFeePerGas&&null!=this.maxPriorityFeePerGas&&Q(this.maxFeePerGas>=this.maxPriorityFeePerGas,"priorityFee cannot be more than maxFee","BAD_DATA",{value:this}),Q(!t||0!==this.type&&1!==this.type,"transaction type cannot have maxFeePerGas or maxPriorityFeePerGas","BAD_DATA",{value:this}),Q(0!==this.type||!r,"legacy transaction cannot have accessList","BAD_DATA",{value:this});const o=[];return null!=this.type?o.push(this.type):this.authorizationList&&this.authorizationList.length?o.push(4):t?o.push(2):e?(o.push(1),r||o.push(0)):r?(o.push(1),o.push(2)):(n&&this.to||(o.push(0),o.push(1),o.push(2)),o.push(3)),o.sort(),o}isLegacy(){return 0===this.type}isBerlin(){return 1===this.type}isLondon(){return 2===this.type}isCancun(){return 3===this.type}clone(){return _n.from(this)}toJSON(){const e=e=>null==e?null:e.toString();return{type:this.type,to:this.to,data:this.data,nonce:this.nonce,gasLimit:e(this.gasLimit),gasPrice:e(this.gasPrice),maxPriorityFeePerGas:e(this.maxPriorityFeePerGas),maxFeePerGas:e(this.maxFeePerGas),value:e(this.value),chainId:e(this.chainId),sig:this.signature?this.signature.toJSON():null,accessList:this.accessList}}[gn](){return this.toString()}toString(){const e=[],t=t=>{let r=this[t];"string"==typeof r&&(r=JSON.stringify(r)),e.push(`${t}: ${r}`)};this.type&&t("type"),t("to"),t("data"),t("nonce"),t("gasLimit"),t("value"),null!=this.chainId&&t("chainId"),this.signature&&(t("from"),e.push(`signature: ${this.signature.toString()}`));const r=this.authorizationList;if(r){const t=[];for(const e of r){const r=[];r.push(`address: ${JSON.stringify(e.address)}`),null!=e.nonce&&r.push(`nonce: ${e.nonce}`),null!=e.chainId&&r.push(`chainId: ${e.chainId}`),e.signature&&r.push(`signature: ${e.signature.toString()}`),t.push(`Authorization { ${r.join(", ")} }`)}e.push(`authorizations: [ ${t.join(", ")} ]`)}return`Transaction { ${e.join(", ")} }`}static from(e){if(null==e)return new _n;if("string"==typeof e){const t=oe(e);if(t[0]>=127)return _n.from(function(e){const t=on(e);Z(Array.isArray(t)&&(9===t.length||6===t.length),"invalid field count for legacy transaction","data",e);const r={type:0,nonce:In(t[0],"nonce"),gasPrice:Sn(t[1],"gasPrice"),gasLimit:Sn(t[2],"gasLimit"),to:bn(t[3]),value:Sn(t[4],"value"),data:ue(t[5]),chainId:un};if(6===t.length)return r;const n=Sn(t[6],"v"),o=Sn(t[7],"r"),i=Sn(t[8],"s");if(o===un&&i===un)r.chainId=n;else{let e=(n-dn)/ln;e<un&&(e=un),r.chainId=e,Z(e!==un||n===fn||n===hn,"non-canonical legacy v","v",t[6]),r.signature=Qt.from({r:pe(t[7],32),s:pe(t[8],32),v:n})}return r}(t));switch(t[0]){case 1:return _n.from(function(e){const t=on(oe(e).slice(1));Z(Array.isArray(t)&&(8===t.length||11===t.length),"invalid field count for transaction type: 1","data",ue(e));const r={type:1,chainId:Sn(t[0],"chainId"),nonce:In(t[1],"nonce"),gasPrice:Sn(t[2],"gasPrice"),gasLimit:Sn(t[3],"gasLimit"),to:bn(t[4]),value:Sn(t[5],"value"),data:ue(t[6]),accessList:vn(t[7],"accessList")};return 8===t.length||Tn(r,t.slice(8)),r}(t));case 2:return _n.from(function(e){const t=on(oe(e).slice(1));Z(Array.isArray(t)&&(9===t.length||12===t.length),"invalid field count for transaction type: 2","data",ue(e));const r={type:2,chainId:Sn(t[0],"chainId"),nonce:In(t[1],"nonce"),maxPriorityFeePerGas:Sn(t[2],"maxPriorityFeePerGas"),maxFeePerGas:Sn(t[3],"maxFeePerGas"),gasPrice:null,gasLimit:Sn(t[4],"gasLimit"),to:bn(t[5]),value:Sn(t[6],"value"),data:ue(t[7]),accessList:vn(t[8],"accessList")};return 9===t.length||Tn(r,t.slice(9)),r}(t));case 3:return _n.from(function(e){let t=on(oe(e).slice(1)),r="3",n=null,o=null;if(4===t.length&&Array.isArray(t[0])){r="3 (network format)";const e=t[1],n=t[2],i=t[3];Z(Array.isArray(e),"invalid network format: blobs not an array","fields[1]",e),Z(Array.isArray(n),"invalid network format: commitments not an array","fields[2]",n),Z(Array.isArray(i),"invalid network format: proofs not an array","fields[3]",i),Z(e.length===n.length,"invalid network format: blobs/commitments length mismatch","fields",t),Z(e.length===i.length,"invalid network format: blobs/proofs length mismatch","fields",t),o=[];for(let r=0;r<t[1].length;r++)o.push({data:e[r],commitment:n[r],proof:i[r]});t=t[0]}else if(5===t.length&&Array.isArray(t[0])){r="3 (EIP-7594 network format)",n=kt(t[1]);const e=t[2],i=t[3],s=t[4];Z(1===n,`unsupported EIP-7594 network format version: ${n}`,"fields[1]",n),Z(Array.isArray(e),"invalid EIP-7594 network format: blobs not an array","fields[2]",e),Z(Array.isArray(i),"invalid EIP-7594 network format: commitments not an array","fields[3]",i),Z(Array.isArray(s),"invalid EIP-7594 network format: proofs not an array","fields[4]",s),Z(e.length===i.length,"invalid network format: blobs/commitments length mismatch","fields",t),Z(e.length*mn===s.length,"invalid network format: blobs/proofs length mismatch","fields",t),o=[];for(let t=0;t<e.length;t++){const r=[];for(let e=0;e<mn;e++)r.push(s[t*mn+e]);o.push({data:e[t],commitment:i[t],proof:le(r)})}t=t[0]}Z(Array.isArray(t)&&(11===t.length||14===t.length),`invalid field count for transaction type: ${r}`,"data",ue(e));const i={type:3,chainId:Sn(t[0],"chainId"),nonce:In(t[1],"nonce"),maxPriorityFeePerGas:Sn(t[2],"maxPriorityFeePerGas"),maxFeePerGas:Sn(t[3],"maxFeePerGas"),gasPrice:null,gasLimit:Sn(t[4],"gasLimit"),to:bn(t[5]),value:Sn(t[6],"value"),data:ue(t[7]),accessList:vn(t[8],"accessList"),maxFeePerBlobGas:Sn(t[9],"maxFeePerBlobGas"),blobVersionedHashes:t[10],blobWrapperVersion:n};o&&(i.blobs=o),Z(null!=i.to,`invalid address for transaction type: ${r}`,"data",e),Z(Array.isArray(i.blobVersionedHashes),"invalid blobVersionedHashes: must be an array","data",e);for(let t=0;t<i.blobVersionedHashes.length;t++)Z(se(i.blobVersionedHashes[t],32),`invalid blobVersionedHash at index ${t}: must be length 32`,"data",e);return 11===t.length||Tn(i,t.slice(11)),i}(t));case 4:return _n.from(function(e){const t=on(oe(e).slice(1));Z(Array.isArray(t)&&(10===t.length||13===t.length),"invalid field count for transaction type: 4","data",ue(e));const r={type:4,chainId:Sn(t[0],"chainId"),nonce:In(t[1],"nonce"),maxPriorityFeePerGas:Sn(t[2],"maxPriorityFeePerGas"),maxFeePerGas:Sn(t[3],"maxFeePerGas"),gasPrice:null,gasLimit:Sn(t[4],"gasLimit"),to:bn(t[5]),value:Sn(t[6],"value"),data:ue(t[7]),accessList:vn(t[8],"accessList"),authorizationList:On(t[9],"authorizationList")};return 10===t.length||Tn(r,t.slice(10)),r}(t))}Q(!1,"unsupported transaction type","UNSUPPORTED_OPERATION",{operation:"from"})}const t=new _n;return null!=e.type&&(t.type=e.type),null!=e.to&&(t.to=e.to),null!=e.nonce&&(t.nonce=e.nonce),null!=e.gasLimit&&(t.gasLimit=e.gasLimit),null!=e.gasPrice&&(t.gasPrice=e.gasPrice),null!=e.maxPriorityFeePerGas&&(t.maxPriorityFeePerGas=e.maxPriorityFeePerGas),null!=e.maxFeePerGas&&(t.maxFeePerGas=e.maxFeePerGas),null!=e.maxFeePerBlobGas&&(t.maxFeePerBlobGas=e.maxFeePerBlobGas),null!=e.data&&(t.data=e.data),null!=e.value&&(t.value=e.value),null!=e.chainId&&(t.chainId=e.chainId),null!=e.signature&&(t.signature=Qt.from(e.signature)),null!=e.accessList&&(t.accessList=e.accessList),null!=e.authorizationList&&(t.authorizationList=e.authorizationList),null!=e.blobVersionedHashes&&(t.blobVersionedHashes=e.blobVersionedHashes),null!=e.kzg&&(t.kzg=e.kzg),null!=e.blobWrapperVersion&&(t.blobWrapperVersion=e.blobWrapperVersion),null!=e.blobs&&(t.blobs=e.blobs),null!=e.hash&&(Z(t.isSigned(),"unsigned transaction cannot define '.hash'","tx",e),Z(t.hash===e.hash,"hash mismatch","tx",e)),null!=e.from&&(Z(t.isSigned(),"unsigned transaction cannot define '.from'","tx",e),Z(t.from.toLowerCase()===(e.from||"").toLowerCase(),"from mismatch","tx",e)),t}}BigInt(0);function Nn(e){const t={};e.to&&(t.to=e.to),e.from&&(t.from=e.from),e.data&&(t.data=ue(e.data));const r="chainId,gasLimit,gasPrice,maxFeePerBlobGas,maxFeePerGas,maxPriorityFeePerGas,value".split(/,/);for(const n of r)n in e&&null!=e[n]&&(t[n]=Dt(e[n],`request.${n}`));const n="type,nonce".split(/,/);for(const r of n)r in e&&null!=e[r]&&(t[r]=kt(e[r],`request.${r}`));return e.accessList&&(t.accessList=an(e.accessList)),e.authorizationList&&(t.authorizationList=e.authorizationList.slice()),"blockTag"in e&&(t.blockTag=e.blockTag),"enableCcipRead"in e&&(t.enableCcipRead=!!e.enableCcipRead),"customData"in e&&(t.customData=e.customData),"blobVersionedHashes"in e&&e.blobVersionedHashes&&(t.blobVersionedHashes=e.blobVersionedHashes.slice()),"kzg"in e&&(t.kzg=e.kzg),"blobWrapperVersion"in e&&(t.blobWrapperVersion=e.blobWrapperVersion),"blobs"in e&&e.blobs&&(t.blobs=e.blobs.map(e=>ae(e)?ue(e):Object.assign({},e))),t}Symbol.iterator;Symbol.iterator;function Cn(e,t){if(e.provider)return e.provider;Q(!1,"missing provider","UNSUPPORTED_OPERATION",{operation:t})}async function Pn(e,t){let r=Nn(t);if(null!=r.to&&(r.to=cr(r.to,e)),null!=r.from){const t=r.from;r.from=Promise.all([e.getAddress(),cr(t,e)]).then(([e,t])=>(Z(e.toLowerCase()===t.toLowerCase(),"transaction from mismatch","tx.from",t),e))}else r.from=e.getAddress();return await z(r)}class Ln{provider;constructor(e){W(this,{provider:e||null})}async getNonce(e){return Cn(this,"getTransactionCount").getTransactionCount(await this.getAddress(),e)}async populateCall(e){return await Pn(this,e)}async populateTransaction(e){const t=Cn(this,"populateTransaction"),r=await Pn(this,e);null==r.nonce&&(r.nonce=await this.getNonce("pending")),null==r.gasLimit&&(r.gasLimit=await this.estimateGas(r));const n=await this.provider.getNetwork();if(null!=r.chainId){Z(Dt(r.chainId)===n.chainId,"transaction chainId mismatch","tx.chainId",e.chainId)}else r.chainId=n.chainId;const o=null!=r.maxFeePerGas||null!=r.maxPriorityFeePerGas;if(null==r.gasPrice||2!==r.type&&!o?0!==r.type&&1!==r.type||!o||Z(!1,"pre-eip-1559 transaction do not support maxFeePerGas/maxPriorityFeePerGas","tx",e):Z(!1,"eip-1559 transaction do not support gasPrice","tx",e),2!==r.type&&null!=r.type||null==r.maxFeePerGas||null==r.maxPriorityFeePerGas)if(0===r.type||1===r.type){const e=await t.getFeeData();Q(null!=e.gasPrice,"network does not support gasPrice","UNSUPPORTED_OPERATION",{operation:"getGasPrice"}),null==r.gasPrice&&(r.gasPrice=e.gasPrice)}else{const e=await t.getFeeData();if(null==r.type)if(null!=e.maxFeePerGas&&null!=e.maxPriorityFeePerGas)if(r.authorizationList&&r.authorizationList.length?r.type=4:r.type=2,null!=r.gasPrice){const e=r.gasPrice;delete r.gasPrice,r.maxFeePerGas=e,r.maxPriorityFeePerGas=e}else null==r.maxFeePerGas&&(r.maxFeePerGas=e.maxFeePerGas),null==r.maxPriorityFeePerGas&&(r.maxPriorityFeePerGas=e.maxPriorityFeePerGas);else null!=e.gasPrice?(Q(!o,"network does not support EIP-1559","UNSUPPORTED_OPERATION",{operation:"populateTransaction"}),null==r.gasPrice&&(r.gasPrice=e.gasPrice),r.type=0):Q(!1,"failed to get consistent fee data","UNSUPPORTED_OPERATION",{operation:"signer.getFeeData"});else 2!==r.type&&3!==r.type&&4!==r.type||(null==r.maxFeePerGas&&(r.maxFeePerGas=e.maxFeePerGas),null==r.maxPriorityFeePerGas&&(r.maxPriorityFeePerGas=e.maxPriorityFeePerGas))}else r.type=2;return await z(r)}async populateAuthorization(e){const t=Object.assign({},e);return null==t.chainId&&(t.chainId=(await Cn(this,"getNetwork").getNetwork()).chainId),null==t.nonce&&(t.nonce=await this.getNonce()),t}async estimateGas(e){return Cn(this,"estimateGas").estimateGas(await this.populateCall(e))}async call(e){return Cn(this,"call").call(await this.populateCall(e))}async resolveName(e){const t=Cn(this,"resolveName");return await t.resolveName(e)}async sendTransaction(e){const t=Cn(this,"sendTransaction"),r=await this.populateTransaction(e);delete r.from;const n=_n.from(r);return await t.broadcastTransaction(await this.signTransaction(n))}authorize(e){Q(!1,"authorization not implemented for this signer","UNSUPPORTED_OPERATION",{operation:"authorize"})}}class Dn extends Ln{address;constructor(e,t){super(t),W(this,{address:e})}async getAddress(){return this.address}connect(e){return new Dn(this.address,e)}#_(e,t){Q(!1,`VoidSigner cannot sign ${e}`,"UNSUPPORTED_OPERATION",{operation:t})}async signTransaction(e){this.#_("transactions","signTransaction")}async signMessage(e){this.#_("messages","signMessage")}async signTypedData(e,t,r){this.#_("typed-data","signTypedData")}}class Un extends Ln{address;#N;constructor(e,t){super(t),Z(e&&"function"==typeof e.sign,"invalid private key","privateKey","[ REDACTED ]"),this.#N=e;W(this,{address:cn(this.signingKey.publicKey)})}get signingKey(){return this.#N}get privateKey(){return this.signingKey.privateKey}async getAddress(){return this.address}connect(e){return new Un(this.#N,e)}async signTransaction(e){e=Nn(e);const{to:t,from:r}=await z({to:e.to?cr(e.to,this):void 0,from:e.from?cr(e.from,this):void 0});null!=t&&(e.to=t),null!=r&&(e.from=r),null!=e.from&&(Z(sr(e.from)===this.address,"transaction from address mismatch","tx.from",e.from),delete e.from);const n=_n.from(e);return n.signature=this.signingKey.sign(n.unsignedHash),n.serialized}async signMessage(e){return this.signMessageSync(e)}signMessageSync(e){return this.signingKey.sign(fr(e)).serialized}authorizeSync(e){Z("string"==typeof e.address,"invalid address for authorizeSync","auth.address",e);const t=this.signingKey.sign(yr(e));return Object.assign({},{address:sr(e.address),nonce:Dt(e.nonce||0),chainId:Dt(e.chainId||0)},{signature:t})}async authorize(e){return e=Object.assign({},e,{address:await cr(e.address,this)}),this.authorizeSync(await this.populateAuthorization(e))}async signTypedData(e,t,r){const n=await Lr.resolveNames(e,t,r,async e=>{Q(null!=this.provider,"cannot resolve ENS names without a provider","UNSUPPORTED_OPERATION",{operation:"resolveName",info:{name:e}});const t=await this.provider.resolveName(e);return Q(null!=t,"unconfigured ENS name","UNCONFIGURED_NAME",{value:e}),t});return this.signingKey.sign(Lr.hash(n.domain,t,n.value)).serialized}}let xn=!1;const Gn=function(e,t,r){return function(e,t){const r={sha256:Re,sha512:Kr}[e];return Z(null!=r,"invalid hmac algorithm","algorithm",e),ut.create(r,t)}(e,t).update(r).digest()};let kn=Gn;function Fn(e,t,r){const n=oe(t,"key"),o=oe(r,"data");return ue(kn(e,n,o))}Fn._=Gn,Fn.lock=function(){xn=!0},Fn.register=function(e){if(xn)throw new Error("computeHmac is locked");kn=e},Object.freeze(Fn);const Bn=new Uint8Array([7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8]),Mn=Uint8Array.from({length:16},(e,t)=>t);let jn=[Mn],Kn=[Mn.map(e=>(9*e+5)%16)];for(let e=0;e<4;e++)for(let t of[jn,Kn])t.push(t[e].map(e=>Bn[e]));const $n=[[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8],[12,13,11,15,6,9,9,7,12,15,11,13,7,8,7,7],[13,15,14,11,7,7,6,8,13,14,13,12,5,5,6,9],[14,11,12,14,8,6,5,5,15,12,15,14,9,9,8,6],[15,12,13,13,9,5,8,6,14,11,12,11,8,6,5,5]].map(e=>new Uint8Array(e)),Vn=jn.map((e,t)=>e.map(e=>$n[t][e])),Hn=Kn.map((e,t)=>e.map(e=>$n[t][e])),Yn=new Uint32Array([0,1518500249,1859775393,2400959708,2840853838]),qn=new Uint32Array([1352829926,1548603684,1836072691,2053994217,0]),zn=(e,t)=>e<<t|e>>>32-t;function Wn(e,t,r,n){return 0===e?t^r^n:1===e?t&r|~t&n:2===e?(t|~r)^n:3===e?t&n|r&~n:t^(r|~n)}const Jn=new Uint32Array(16);class Xn extends be{constructor(){super(64,20,8,!0),this.h0=1732584193,this.h1=-271733879,this.h2=-1732584194,this.h3=271733878,this.h4=-1009589776}get(){const{h0:e,h1:t,h2:r,h3:n,h4:o}=this;return[e,t,r,n,o]}set(e,t,r,n,o){this.h0=0|e,this.h1=0|t,this.h2=0|r,this.h3=0|n,this.h4=0|o}process(e,t){for(let r=0;r<16;r++,t+=4)Jn[r]=e.getUint32(t,!0);let r=0|this.h0,n=r,o=0|this.h1,i=o,s=0|this.h2,a=s,c=0|this.h3,u=c,l=0|this.h4,f=l;for(let e=0;e<5;e++){const t=4-e,h=Yn[e],d=qn[e],p=jn[e],g=Kn[e],y=Vn[e],m=Hn[e];for(let t=0;t<16;t++){const n=zn(r+Wn(e,o,s,c)+Jn[p[t]]+h,y[t])+l|0;r=l,l=c,c=0|zn(s,10),s=o,o=n}for(let e=0;e<16;e++){const r=zn(n+Wn(t,i,a,u)+Jn[g[e]]+d,m[e])+f|0;n=f,f=u,u=0|zn(a,10),a=i,i=r}}this.set(this.h1+s+u|0,this.h2+c+f|0,this.h3+l+n|0,this.h4+r+i|0,this.h0+o+a|0)}roundClean(){Jn.fill(0)}destroy(){this.destroyed=!0,this.buffer.fill(0),this.set(0,0,0,0,0)}}const Qn=_(()=>new Xn);let Zn=!1;const eo=function(e){return Qn(e)};let to=eo;function ro(e){const t=oe(e,"data");return ue(to(t))}ro._=eo,ro.lock=function(){Zn=!0},ro.register=function(e){if(Zn)throw new TypeError("ripemd160 is locked");to=e},Object.freeze(ro);let no=!1;const oo=function(e){return new Uint8Array(function(e){Q(null!=Vr,"platform does not support secure random numbers","UNSUPPORTED_OPERATION",{operation:"randomBytes"}),Z(Number.isInteger(e)&&e>0&&e<=1024,"invalid length","length",e);const t=new Uint8Array(e);return Vr.getRandomValues(t),t}(e))};let io=oo;function so(e){return io(e)}so._=oo,so.lock=function(){no=!0},so.register=function(e){if(no)throw new Error("randomBytes is locked");io=e},Object.freeze(so);const ao="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";let co=null;function uo(e){if(null==co){co={};for(let e=0;e<58;e++)co[ao[e]]=BigInt(e)}const t=co[e];return Z(null!=t,"invalid base58 value","letter",e),t}const lo=BigInt(0),fo=BigInt(58);const ho=" !#$%&'()*+,-./<=>?@[]^_`{|}~",po=/^[a-z]*$/i;function go(e,t){let r=97;return e.reduce((e,n)=>(n===t?r++:n.match(po)?e.push(String.fromCharCode(r)+n):(r=97,e.push(n)),e),[])}function yo(e){return Z("0"===e[0],"unsupported auwl data","data",e),function(e,t){for(let r=28;r>=0;r--)e=e.split(ho[r]).join(t.substring(2*r,2*r+2));const r=[],n=e.replace(/(:|([0-9])|([A-Z][a-z]*))/g,(e,t,n,o)=>{if(n)for(let e=parseInt(n);e>=0;e--)r.push(";");else r.push(t.toLowerCase());return""});if(n)throw new Error(`leftovers: ${JSON.stringify(n)}`);return go(go(r,";"),":")}(e.substring(59),e.substring(1,59))}class mo{locale;constructor(e){W(this,{locale:e})}split(e){return e.toLowerCase().split(/\s+/g)}join(e){return e.join(" ")}}class Eo extends mo{#f;#C;constructor(e,t,r){super(e),this.#f=t,this.#C=r,this.#P=null}get _data(){return this.#f}_decodeWords(){return yo(this.#f)}#P;#L(){if(null==this.#P){const e=this._decodeWords();if(mr(e.join("\n")+"\n")!==this.#C)throw new Error(`BIP39 Wordlist for ${this.locale} FAILED`);this.#P=e}return this.#P}getWord(e){const t=this.#L();return Z(e>=0&&e<t.length,`invalid word index: ${e}`,"index",e),t[e]}getWordIndex(e){return this.#L().indexOf(e)}}let bo=null;class vo extends Eo{constructor(){super("en","0erleonalorenseinceregesticitStanvetearctssi#ch2Athck&tneLl0And#Il.yLeOutO=S|S%b/ra@SurdU'0Ce[Cid|CountCu'Hie=IdOu,-Qui*Ro[TT]T%T*[Tu$0AptDD-tD*[Ju,M.UltV<)Vi)0Rob-0FairF%dRaid0A(EEntRee0Ead0MRRp%tS!_rmBumCoholErtI&LLeyLowMo,O}PhaReadySoT Ways0A>urAz(gOngOuntU'd0Aly,Ch%Ci|G G!GryIm$K!Noun)Nu$O` Sw T&naTiqueXietyY1ArtOlogyPe?P!Pro=Ril1ChCt-EaEnaGueMMedM%MyOundR<+Re,Ri=RowTTefa@Ti,Tw%k0KPe@SaultSetSi,SumeThma0H!>OmTa{T&dT.udeTra@0Ct]D.Gu,NtTh%ToTumn0Era+OcadoOid0AkeA*AyEsomeFulKw?d0Is:ByChel%C#D+GL<)Lc#y~MbooN<aNn RRelyRga(R*lSeS-SketTt!3A^AnAutyCau'ComeEfF%eG(Ha=H(dLie=LowLtN^Nef./TrayTt Twe&Y#d3Cyc!DKeNdOlogyRdR`Tt _{AdeAmeAnketA,EakE[IndOodO[omOu'UeUrUsh_rdAtDyIlMbNeNusOkO,Rd R(gRrowSsTtomUn)XY_{etA(AndA[A=EadEezeI{Id+IefIghtIngIskOccoliOk&OnzeOomO` OwnUsh2Bb!DdyD+tFf$oIldLbLkL!tNd!Nk Rd&Rg R,SS(e[SyTt Y Zz:Bba+B(B!CtusGeKe~LmM aMpNN$N)lNdyNn#NoeNvasNy#Pab!P.$Pta(RRb#RdRgoRpetRryRtSeShS(o/!Su$TT$ogT^Teg%yTt!UghtU'Ut]Ve3Il(gL yM|NsusNturyRe$Rta(_irAlkAmp]An+AosApt Ar+A'AtEapE{Ee'EfErryE,I{&IefIldIm}yOi)Oo'R#-U{!UnkUrn0G?Nnam#Rc!Tiz&TyVil_imApArifyAwAyE<ErkEv I{I|IffImbIn-IpO{OgO'O`OudOwnUbUmpU, Ut^_^A,C#utDeFfeeIlInL!@L%LumnMb(eMeMf%tM-Mm#Mp<yNc tNdu@NfirmNg*[N}@Nsid NtrolNv()OkOlPp PyR$ReRnR*@/Tt#U^UntryUp!Ur'Us(V Yo>_{Ad!AftAmA}AshAt AwlAzyEamEd.EekEwI{etImeIspIt-OpO[Ou^OwdUci$UelUi'Umb!Un^UshYY,$2BeLtu*PPbo?dRiousRr|Rta(R=Sh]/omTe3C!:DMa+MpN)Ng R(gShUght WnY3AlBa>BrisCadeCemb CideCl(eC%a>C*a'ErF&'F(eFyG*eLayLiv M<dMi'Ni$Nti,NyP?tP&dPos.P`PutyRi=ScribeS tSignSkSpair/royTailTe@VelopVi)Vo>3AgramAlAm#dAryCeE'lEtFf G.$Gn.yLemmaNn NosaurRe@RtSag*eScov Sea'ShSmi[S%d Splay/<)V tVideV%)Zzy5Ct%Cum|G~Lph(Ma(Na>NkeyN%OrSeUb!Ve_ftAg#AmaA,-AwEamE[IftIllInkIpI=OpUmY2CkMbNeR(g/T^Ty1Arf1Nam-:G G!RlyRnR`Sily/Sy1HoOlogyOnomy0GeItUca>1F%t0G1GhtTh 2BowD E@r-Eg<tEm|Eph<tEvat%I>Se0B?kBodyBra)Er+Ot]PloyPow Pty0Ab!A@DD![D%'EmyErgyF%)Ga+G(eH<)JoyLi,OughR-hRollSu*T Ti*TryVelope1Isode0U$Uip0AA'OdeOs]R%Upt0CapeSayS&)Ta>0Ern$H-s1Id&)IlOkeOl=1A@Amp!Ce[Ch<+C.eCludeCu'Ecu>Erci'Hau,Hib.I!I,ItOt-P<dPe@Pi*Pla(Po'P*[T&dTra0EEbrow:Br-CeCultyDeIntI`~L'MeMilyMousNNcyNtasyRmSh]TT$Th TigueUltV%.e3Atu*Bru?yD $EEdElMa!N)/iv$T^V W3B Ct]EldGu*LeLmLt N$NdNeNg NishReRmR,Sc$ShTT}[X_gAmeAshAtAv%EeIghtIpOatO{O%Ow UidUshY_mCusGIlLd~owOdOtR)Re,R+tRkRtu}RumRw?dSsil/ UndX_gi!AmeEqu|EshI&dIn+OgOntO,OwnOz&U.2ElNNnyRna)RyTu*:D+tInLaxy~ yMePRa+Rba+Rd&Rl-Rm|SSpTeTh U+Ze3N $NiusN*Nt!Nu(e/u*2O,0AntFtGg!Ng RaffeRlVe_dAn)A*A[IdeImp'ObeOomOryO=OwUe_tDde[LdOdO'RillaSpelSsipV nWn_bA)A(AntApeA[Av.yEatE&IdIefItOc yOupOwUnt_rdE[IdeIltIt?N3M:B.IrLfMm M, NdPpyRb%RdRshR=,TVeWkZ?d3AdAl`ArtAvyD+hogIght~oLmetLpNRo3Dd&Gh~NtPRe/%y5BbyCkeyLdLeLiday~owMeNeyOdPeRnRr%R'Sp.$/TelUrV 5BGeM<Mb!M%Nd*dNgryNtRd!RryRtSb<d3Brid:1EOn0EaEntifyLe2N%e4LLeg$L}[0A+Ita>M&'Mu}Pa@Po'Pro=Pul'0ChCludeComeC*a'DexD-a>Do%Du,ryF<tFl-tF%mHa!H .Iti$Je@JuryMa>N Noc|PutQuiryS<eSe@SideSpi*/$lTa@T e,ToVe,V.eVol=3On0L<dOla>Sue0Em1Ory:CketGu?RZz3AlousAns~yWel9BInKeUr}yY5D+I)MpNg!Ni%Nk/:Ng?oo3EnEpT^upY3CkDD}yNdNgdomSsTT^&TeTt&Wi4EeIfeO{Ow:BBelB%Dd DyKeMpNgua+PtopR+T T(UghUndryVaWWnWsu.Y Zy3Ad AfArnA=Ctu*FtGG$G&dIsu*M#NdNg`NsOp?dSs#Tt Vel3ArB tyBr?yC&'FeFtGhtKeMbM.NkOnQuid/Tt!VeZ?d5AdAnB, C$CkG-NelyNgOpTt yUdUn+VeY$5CkyGga+Mb N?N^Xury3R-s:Ch(eDG-G}tIdIlInJ%KeMm$NNa+Nda>NgoNs]Nu$P!Rb!R^Rg(R(eRketRria+SkSs/ T^T i$ThTrixTt XimumZe3AdowAnAsu*AtCh<-D$DiaLodyLtMb M%yNt]NuRcyR+R.RryShSsa+T$Thod3Dd!DnightLk~]M-NdNimumN%Nu>Rac!Rr%S ySs/akeXXedXtu*5Bi!DelDifyMM|N.%NkeyN, N`OnR$ReRn(gSqu.oTh T]T%Unta(U'VeVie5ChFf(LeLtiplySc!SeumShroomS-/Tu$3Self/ yTh:I=MePk(Rrow/yT]Tu*3ArCkEdGati=G!@I` PhewR=/TTw%kUtr$V WsXt3CeGht5B!I'M(eeOd!Rm$R`SeTab!TeTh(gTi)VelW5C!?Mb R'T:K0EyJe@Li+Scu*S =Ta(Vious0CurE<Tob 0Or1FF Fi)T&2L1Ay0DI=Ymp-0It0CeEI#L(eLy1EnEraIn]Po'T]1An+B.Ch?dD D(?yG<I|Ig($Ph<0Tr-h0H 0Tdo%T TputTside0AlEnEr0NN 0Yg&0/ 0O}:CtDd!GeIrLa)LmNdaNelN-N` P RadeR|RkRrotRtySsT^ThTi|TrolTt nU'VeYm|3A)AnutArAs<tL-<NN$tyNcilOp!Pp Rfe@Rm.Rs#T2O}OtoRa'Ys-$0AnoCn-Ctu*E)GGe#~LotNkO} Pe/olT^Zza_)A}tA,-A>AyEa'Ed+U{UgUn+2EmEtIntL?LeLi)NdNyOlPul?Rt]S.]Ssib!/TatoTt yV tyWd W _@i)Ai'Ed-tEf Epa*Es|EttyEv|I)IdeIm?yIntI%.yIs#Iva>IzeOb!mO)[Odu)Of.OgramOje@Omo>OofOp tyOsp O>@OudOvide2Bl-Dd(g~LpL'Mpk(N^PilPpyR^a'R.yRpo'R'ShTZz!3Ramid:99Al.yAntumArt E,]I{ItIzO>:Bb.Cco#CeCkD?DioIlInI'~yMpN^NdomN+PidReTeTh V&WZ%3AdyAlAs#BelBuildC$lCei=CipeC%dCyc!Du)F!@F%mFu'G]G*tGul?Je@LaxLea'LiefLyMa(Memb M(dMo=Nd NewNtOp&PairPeatPla)P%tQui*ScueSemb!Si,Sour)Sp#'SultTi*T*atTurnUn]Ve$ViewW?d2Y`m0BBb#CeChDeD+F!GhtGidNgOtPp!SkTu$V$V 5AdA,BotBu,CketM<)OfOkieOmSeTa>UghUndU>Y$5Bb DeGLeNNwayR$:DDd!D}[FeIlLadLm#L#LtLu>MeMp!NdTisfyToshiU)Usa+VeY1A!AnA*Att E}HemeHoolI&)I[%sOrp]OutRapRe&RiptRub1AAr^As#AtC#dC*tCt]Cur.yEdEkGm|Le@~M(?Ni%N'Nt&)RiesRvi)Ss]Tt!TupV&_dowAftAllowA*EdEllEriffIeldIftI}IpIv O{OeOotOpOrtOuld O=RimpRugUff!Y0Bl(gCkDeE+GhtGnL|Lk~yLv Mil?Mp!N)NgR&/ Tua>XZe1A>Et^IIllInIrtUll0AbAmEepEnd I)IdeIghtImOg<OtOwUsh0AllArtI!OkeOo`0A{AkeApIffOw0ApCc Ci$CkDaFtL?Ldi LidLut]L=Me#eNgOnRryRtUlUndUpUr)U`0A)A*Ati$AwnEakEci$EedEllEndH eI)Id IkeInIr.L.OilOns%O#OrtOtRayReadR(gY0Ua*UeezeUir*l_b!AdiumAffA+AirsAmpAndArtA>AyEakEelEmEpE*oI{IllIngO{Oma^O}OolOryO=Ra>gyReetRikeR#gRugg!Ud|UffUmb!Y!0Bje@Bm.BwayC)[ChDd&Ff G?G+,ItMm NNnyN'tP PplyP*meReRfa)R+Rpri'RroundR=ySpe@/a(1AllowAmpApArmE?EetIftImIngIt^Ord1MbolMptomRup/em:B!Ck!GIlL|LkNkPeR+tSk/eTtooXi3A^Am~NN<tNnisNtRm/Xt_nkAtEmeEnE%yE*EyIngIsOughtReeRi=RowUmbUnd 0CketDeG LtMb MeNyPRedSsueT!5A,BaccoDayDdl EGe` I!tK&MatoM%rowNeNgueNightOlO`PP-Pp!R^RnadoRtoi'SsT$Uri,W?dW WnY_{AdeAff-Ag-A(Ansf ApAshA=lAyEatEeEndI$IbeI{Igg ImIpOphyOub!U{UeUlyUmpetU,U`Y2BeIt]Mb!NaN}lRkeyRnRt!1El=EntyI)InI,O1PeP-$:5Ly5B*lla0Ab!Awa*C!Cov D DoFairFoldHappyIf%mIqueItIv 'KnownLo{TilUsu$Veil1Da>GradeHoldOnP Set1B<Ge0A+EEdEfulE![U$0Il.y:C<tCuumGueLidL!yL=NNishP%Rious/Ult3H-!L=tNd%Ntu*NueRbRifyRs]RyS'lT <3Ab!Br<tCiousCt%yDeoEw~a+Nta+Ol(Rtu$RusSaS.Su$T$Vid5C$I)IdLc<oLumeTeYa+:GeG#ItLk~LnutNtRfa*RmRri%ShSp/eT VeY3Al`Ap#ArA'lA` BDd(gEk&dIrdLcome/T_!AtEatEelEnE*IpIsp 0DeD`FeLd~NNdowNeNgNkNn Nt ReSdomSeShT}[5LfM<Nd OdOlRdRkRldRryR`_pE{E,!I,I>Ong::Rd3Ar~ow9UUngU`:3BraRo9NeO","0x3c8acc1e7b08d8e76f9fda015ef48dc8c710a73cb7e0f77b2c18a9b5a7adde60")}static wordlist(){return null==bo&&(bo=new vo),bo}}let Oo=!1;const Io=function(e,t,r,n,o){return function(e,t,r,n,o){const i={sha256:Re,sha512:Kr}[o];return Z(null!=i,"invalid pbkdf2 algorithm","algorithm",o),Gr(i,e,t,{c:r,dkLen:n})}(e,t,r,n,o)};let So=Io;function wo(e,t,r,n,o){const i=oe(e,"password"),s=oe(t,"salt");return ue(So(i,s,r,n,o))}function Ao(e){return(1<<e)-1<<8-e&255}function Ro(e){return(1<<e)-1&255}function To(e,t){te("NFKD"),null==t&&(t=vo.wordlist());const r=t.split(e);Z(r.length%3==0&&r.length>=12&&r.length<=24,"invalid mnemonic length","mnemonic","[ REDACTED ]");const n=new Uint8Array(Math.ceil(11*r.length/8));let o=0;for(let e=0;e<r.length;e++){let i=t.getWordIndex(r[e].normalize("NFKD"));Z(i>=0,`invalid mnemonic word at index ${e}`,"mnemonic","[ REDACTED ]");for(let e=0;e<11;e++)i&1<<10-e&&(n[o>>3]|=1<<7-o%8),o++}const i=32*r.length/3,s=Ao(r.length/3);return Z((oe(Qr(n.slice(0,i/8)))[0]&s)===(n[n.length-1]&s),"invalid mnemonic checksum","mnemonic","[ REDACTED ]"),ue(n.slice(0,i/8))}function _o(e,t){Z(e.length%4==0&&e.length>=16&&e.length<=32,"invalid entropy size","entropy","[ REDACTED ]"),null==t&&(t=vo.wordlist());const r=[0];let n=11;for(let t=0;t<e.length;t++)n>8?(r[r.length-1]<<=8,r[r.length-1]|=e[t],n-=8):(r[r.length-1]<<=n,r[r.length-1]|=e[t]>>8-n,r.push(e[t]&Ro(8-n)),n+=3);const o=e.length/4,i=parseInt(Qr(e).substring(2,4),16)&Ao(o);return r[r.length-1]<<=o,r[r.length-1]|=i>>8-o,t.join(r.map(e=>t.getWord(e)))}wo._=Io,wo.lock=function(){Oo=!0},wo.register=function(e){if(Oo)throw new Error("pbkdf2 is locked");So=e},Object.freeze(wo);const No={};class Co{phrase;password;wordlist;entropy;constructor(e,t,r,n,o){null==n&&(n=""),null==o&&(o=vo.wordlist()),re(e,No,"Mnemonic"),W(this,{phrase:r,password:n,wordlist:o,entropy:t})}computeSeed(){const e=lr("mnemonic"+this.password,"NFKD");return wo(lr(this.phrase,"NFKD"),e,2048,64,"sha512")}static fromPhrase(e,t,r){const n=To(e,r);return e=_o(oe(n),r),new Co(No,n,e,t,r)}static fromEntropy(e,t,r){const n=oe(e,"entropy"),o=_o(n,r);return new Co(No,ue(n),o,t,r)}static entropyToPhrase(e,t){return _o(oe(e,"entropy"),t)}static phraseToEntropy(e,t){return To(e,t)}static isValidMnemonic(e,t){try{return To(e,t),!0}catch(e){}return!1}}
|
|
21
21
|
/*! MIT License. Copyright 2015-2022 Richard Moore <me@ricmoo.com>. See LICENSE.txt. */
|
|
22
|
-
var Po,Lo,Do,Uo=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},xo=function(e,t,r,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(e,r):o?o.value=r:t.set(e,r),r};const Go={16:10,24:12,32:14},ko=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],Fo=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],Bo=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],Mo=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],jo=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],Ko=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],$o=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],Vo=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],Ho=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],Yo=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],qo=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],zo=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],Wo=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],Jo=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],Xo=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function Qo(e){const t=[];for(let r=0;r<e.length;r+=4)t.push(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3]);return t}class Zo{get key(){return Uo(this,Po,"f").slice()}constructor(e){if(Po.set(this,void 0),Lo.set(this,void 0),Do.set(this,void 0),!(this instanceof Zo))throw Error("AES must be instanitated with `new`");xo(this,Po,new Uint8Array(e),"f");const t=Go[this.key.length];if(null==t)throw new TypeError("invalid key size (must be 16, 24 or 32 bytes)");xo(this,Do,[],"f"),xo(this,Lo,[],"f");for(let e=0;e<=t;e++)Uo(this,Do,"f").push([0,0,0,0]),Uo(this,Lo,"f").push([0,0,0,0]);const r=4*(t+1),n=this.key.length/4,o=Qo(this.key);let i;for(let e=0;e<n;e++)i=e>>2,Uo(this,Do,"f")[i][e%4]=o[e],Uo(this,Lo,"f")[t-i][e%4]=o[e];let s,a=0,c=n;for(;c<r;){if(s=o[n-1],o[0]^=Fo[s>>16&255]<<24^Fo[s>>8&255]<<16^Fo[255&s]<<8^Fo[s>>24&255]^ko[a]<<24,a+=1,8!=n)for(let e=1;e<n;e++)o[e]^=o[e-1];else{for(let e=1;e<n/2;e++)o[e]^=o[e-1];s=o[n/2-1],o[n/2]^=Fo[255&s]^Fo[s>>8&255]<<8^Fo[s>>16&255]<<16^Fo[s>>24&255]<<24;for(let e=n/2+1;e<n;e++)o[e]^=o[e-1]}let e,i,u=0;for(;u<n&&c<r;)e=c>>2,i=c%4,Uo(this,Do,"f")[e][i]=o[u],Uo(this,Lo,"f")[t-e][i]=o[u++],c++}for(let e=1;e<t;e++)for(let t=0;t<4;t++)s=Uo(this,Lo,"f")[e][t],Uo(this,Lo,"f")[e][t]=zo[s>>24&255]^Wo[s>>16&255]^Jo[s>>8&255]^Xo[255&s]}encrypt(e){if(16!=e.length)throw new TypeError("invalid plaintext size (must be 16 bytes)");const t=Uo(this,Do,"f").length-1,r=[0,0,0,0];let n=Qo(e);for(let e=0;e<4;e++)n[e]^=Uo(this,Do,"f")[0][e];for(let e=1;e<t;e++){for(let t=0;t<4;t++)r[t]=Mo[n[t]>>24&255]^jo[n[(t+1)%4]>>16&255]^Ko[n[(t+2)%4]>>8&255]^$o[255&n[(t+3)%4]]^Uo(this,Do,"f")[e][t];n=r.slice()}const o=new Uint8Array(16);let i=0;for(let e=0;e<4;e++)i=Uo(this,Do,"f")[t][e],o[4*e]=255&(Fo[n[e]>>24&255]^i>>24),o[4*e+1]=255&(Fo[n[(e+1)%4]>>16&255]^i>>16),o[4*e+2]=255&(Fo[n[(e+2)%4]>>8&255]^i>>8),o[4*e+3]=255&(Fo[255&n[(e+3)%4]]^i);return o}decrypt(e){if(16!=e.length)throw new TypeError("invalid ciphertext size (must be 16 bytes)");const t=Uo(this,Lo,"f").length-1,r=[0,0,0,0];let n=Qo(e);for(let e=0;e<4;e++)n[e]^=Uo(this,Lo,"f")[0][e];for(let e=1;e<t;e++){for(let t=0;t<4;t++)r[t]=Vo[n[t]>>24&255]^Ho[n[(t+3)%4]>>16&255]^Yo[n[(t+2)%4]>>8&255]^qo[255&n[(t+1)%4]]^Uo(this,Lo,"f")[e][t];n=r.slice()}const o=new Uint8Array(16);let i=0;for(let e=0;e<4;e++)i=Uo(this,Lo,"f")[t][e],o[4*e]=255&(Bo[n[e]>>24&255]^i>>24),o[4*e+1]=255&(Bo[n[(e+3)%4]>>16&255]^i>>16),o[4*e+2]=255&(Bo[n[(e+2)%4]>>8&255]^i>>8),o[4*e+3]=255&(Bo[255&n[(e+1)%4]]^i);return o}}Po=new WeakMap,Lo=new WeakMap,Do=new WeakMap;class ei{constructor(e,t,r){if(r&&!(this instanceof r))throw new Error(`${e} must be instantiated with "new"`);Object.defineProperties(this,{aes:{enumerable:!0,value:new Zo(t)},name:{enumerable:!0,value:e}})}}var ti,ri,ni=function(e,t,r,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(e,r):o?o.value=r:t.set(e,r),r},oi=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};class ii extends ei{constructor(e,t){if(super("ECC",e,ii),ti.set(this,void 0),ri.set(this,void 0),t){if(t.length%16)throw new TypeError("invalid iv size (must be 16 bytes)");ni(this,ti,new Uint8Array(t),"f")}else ni(this,ti,new Uint8Array(16),"f");ni(this,ri,this.iv,"f")}get iv(){return new Uint8Array(oi(this,ti,"f"))}encrypt(e){if(e.length%16)throw new TypeError("invalid plaintext size (must be multiple of 16 bytes)");const t=new Uint8Array(e.length);for(let r=0;r<e.length;r+=16){for(let t=0;t<16;t++)oi(this,ri,"f")[t]^=e[r+t];ni(this,ri,this.aes.encrypt(oi(this,ri,"f")),"f"),t.set(oi(this,ri,"f"),r)}return t}decrypt(e){if(e.length%16)throw new TypeError("invalid ciphertext size (must be multiple of 16 bytes)");const t=new Uint8Array(e.length);for(let r=0;r<e.length;r+=16){const n=this.aes.decrypt(e.subarray(r,r+16));for(let o=0;o<16;o++)t[r+o]=n[o]^oi(this,ri,"f")[o],oi(this,ri,"f")[o]=e[r+o]}return t}}ti=new WeakMap,ri=new WeakMap;var si,ai=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};new WeakMap,si=new WeakMap,new WeakSet;var ci,ui,li,fi=function(e,t,r,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(e,r):o?o.value=r:t.set(e,r),r},hi=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};class di extends ei{constructor(e,t){super("CTR",e,di),ci.set(this,void 0),ui.set(this,void 0),li.set(this,void 0),fi(this,li,new Uint8Array(16),"f"),hi(this,li,"f").fill(0),fi(this,ci,hi(this,li,"f"),"f"),fi(this,ui,16,"f"),null==t&&(t=1),"number"==typeof t?this.setCounterValue(t):this.setCounterBytes(t)}get counter(){return new Uint8Array(hi(this,li,"f"))}setCounterValue(e){if(!Number.isInteger(e)||e<0||e>Number.MAX_SAFE_INTEGER)throw new TypeError("invalid counter initial integer value");for(let t=15;t>=0;--t)hi(this,li,"f")[t]=e%256,e=Math.floor(e/256)}setCounterBytes(e){if(16!==e.length)throw new TypeError("invalid counter initial Uint8Array value length");hi(this,li,"f").set(e)}increment(){for(let e=15;e>=0;e--){if(255!==hi(this,li,"f")[e]){hi(this,li,"f")[e]++;break}hi(this,li,"f")[e]=0}}encrypt(e){var t,r;const n=new Uint8Array(e);for(let e=0;e<n.length;e++)16===hi(this,ui,"f")&&(fi(this,ci,this.aes.encrypt(hi(this,li,"f")),"f"),fi(this,ui,0,"f"),this.increment()),n[e]^=hi(this,ci,"f")[(fi(this,ui,(r=hi(this,ui,"f"),t=r++,r),"f"),t)];return n}decrypt(e){return this.encrypt(e)}}ci=new WeakMap,ui=new WeakMap,li=new WeakMap;new WeakMap,new WeakMap,new WeakMap;const pi=(e,t)=>e<<t|e>>>32-t;function gi(e,t,r,n,o,i){let s=e[t++]^r[n++],a=e[t++]^r[n++],c=e[t++]^r[n++],u=e[t++]^r[n++],l=e[t++]^r[n++],f=e[t++]^r[n++],h=e[t++]^r[n++],d=e[t++]^r[n++],p=e[t++]^r[n++],g=e[t++]^r[n++],y=e[t++]^r[n++],m=e[t++]^r[n++],E=e[t++]^r[n++],b=e[t++]^r[n++],v=e[t++]^r[n++],O=e[t++]^r[n++],I=s,S=a,w=c,A=u,R=l,T=f,_=h,N=d,C=p,P=g,L=y,D=m,U=E,x=b,G=v,k=O;for(let e=0;e<8;e+=2)R^=pi(I+U|0,7),C^=pi(R+I|0,9),U^=pi(C+R|0,13),I^=pi(U+C|0,18),P^=pi(T+S|0,7),x^=pi(P+T|0,9),S^=pi(x+P|0,13),T^=pi(S+x|0,18),G^=pi(L+_|0,7),w^=pi(G+L|0,9),_^=pi(w+G|0,13),L^=pi(_+w|0,18),A^=pi(k+D|0,7),N^=pi(A+k|0,9),D^=pi(N+A|0,13),k^=pi(D+N|0,18),S^=pi(I+A|0,7),w^=pi(S+I|0,9),A^=pi(w+S|0,13),I^=pi(A+w|0,18),_^=pi(T+R|0,7),N^=pi(_+T|0,9),R^=pi(N+_|0,13),T^=pi(R+N|0,18),D^=pi(L+P|0,7),C^=pi(D+L|0,9),P^=pi(C+D|0,13),L^=pi(P+C|0,18),U^=pi(k+G|0,7),x^=pi(U+k|0,9),G^=pi(x+U|0,13),k^=pi(G+x|0,18);o[i++]=s+I|0,o[i++]=a+S|0,o[i++]=c+w|0,o[i++]=u+A|0,o[i++]=l+R|0,o[i++]=f+T|0,o[i++]=h+_|0,o[i++]=d+N|0,o[i++]=p+C|0,o[i++]=g+P|0,o[i++]=y+L|0,o[i++]=m+D|0,o[i++]=E+U|0,o[i++]=b+x|0,o[i++]=v+G|0,o[i++]=O+k|0}function yi(e,t,r,n,o){let i=n+0,s=n+16*o;for(let n=0;n<16;n++)r[s+n]=e[t+16*(2*o-1)+n];for(let n=0;n<o;n++,i+=16,t+=16)gi(r,s,e,t,r,i),n>0&&(s+=16),gi(r,i,e,t+=16,r,s)}function mi(e,r,n){const o=T({dkLen:32,asyncTick:10,maxmem:1073742848},n),{N:i,r:s,p:a,dkLen:c,asyncTick:u,maxmem:l,onProgress:f}=o;if(t(i),t(s),t(a),t(c),t(u),t(l),void 0!==f&&"function"!=typeof f)throw new Error("progressCb should be function");const h=128*s,d=h/4;if(i<=1||i&i-1||i>=2**(h/8)||i>2**32)throw new Error("Scrypt: N must be larger than 1, a power of 2, less than 2^(128 * r / 8) and less than 2^32");if(a<0||a>137438953440/h)throw new Error("Scrypt: p must be a positive integer less than or equal to ((2^32 - 1) * 32) / (128 * r)");if(c<0||c>137438953440)throw new Error("Scrypt: dkLen should be positive integer less than or equal to (2^32 - 1) * 32");const p=h*(i+a);if(p>l)throw new Error(`Scrypt: parameters too large, ${p} (128 * r * (N + p)) > ${l} (maxmem)`);const g=Gr(Re,e,r,{c:1,dkLen:h*a}),y=b(g),m=b(new Uint8Array(h*i)),E=b(new Uint8Array(h));let v=()=>{};if(f){const e=2*i*a,t=Math.max(Math.floor(e/1e4),1);let r=0;v=()=>{r++,!f||r%t&&r!==e||f(r/e)}}return{N:i,r:s,p:a,dkLen:c,blockSize32:d,V:m,B32:y,B:g,tmp:E,blockMixCb:v,asyncTick:u}}function Ei(e,t,r,n,o){const i=Gr(Re,e,r,{c:1,dkLen:t});return r.fill(0),n.fill(0),o.fill(0),i}let bi=!1,vi=!1;const Oi=async function(e,t,r,n,o,i,s){return await async function(e,t,r){const{N:n,r:o,p:i,dkLen:s,blockSize32:a,V:c,B32:u,B:l,tmp:f,blockMixCb:h,asyncTick:d}=mi(e,t,r);for(let e=0;e<i;e++){const t=a*e;for(let e=0;e<a;e++)c[e]=u[t+e];let r=0;await S(n-1,d,()=>{yi(c,r,c,r+=a,o),h()}),yi(c,(n-1)*a,u,t,o),h(),await S(n,d,()=>{const e=u[t+a-16]%n;for(let r=0;r<a;r++)f[r]=u[t+r]^c[e*a+r];yi(f,0,u,t,o),h()})}return Ei(e,s,l,c,f)}(e,t,{N:r,r:n,p:o,dkLen:i,onProgress:s})},Ii=function(e,t,r,n,o,i){return function(e,t,r){const{N:n,r:o,p:i,dkLen:s,blockSize32:a,V:c,B32:u,B:l,tmp:f,blockMixCb:h}=mi(e,t,r);for(let e=0;e<i;e++){const t=a*e;for(let e=0;e<a;e++)c[e]=u[t+e];for(let e=0,t=0;e<n-1;e++)yi(c,t,c,t+=a,o),h();yi(c,(n-1)*a,u,t,o),h();for(let e=0;e<n;e++){const e=u[t+a-16]%n;for(let r=0;r<a;r++)f[r]=u[t+r]^c[e*a+r];yi(f,0,u,t,o),h()}}return Ei(e,s,l,c,f)}(e,t,{N:r,r:n,p:o,dkLen:i})};let Si=Oi,wi=Ii;async function Ai(e,t,r,n,o,i,s){const a=oe(e,"passwd"),c=oe(t,"salt");return ue(await Si(a,c,r,n,o,i,s))}function Ri(e,t,r,n,o,i){const s=oe(e,"passwd"),a=oe(t,"salt");return ue(wi(s,a,r,n,o,i))}function Ti(e){const t=oe(e,"randomBytes");t[6]=15&t[6]|64,t[8]=63&t[8]|128;const r=ue(t);return[r.substring(2,10),r.substring(10,14),r.substring(14,18),r.substring(18,22),r.substring(22,34)].join("-")}function _i(e){return"string"!=typeof e||e.startsWith("0x")||(e="0x"+e),ie(e)}function Ni(e,t){for(e=String(e);e.length<t;)e="0"+e;return e}function Ci(e){return"string"==typeof e?lr(e,"NFKC"):ie(e)}function Pi(e,t){const r=t.match(/^([a-z0-9$_.-]*)(:([a-z]+))?(!)?$/i);Z(null!=r,"invalid path","path",t);const n=r[1],o=r[3],i="!"===r[4];let s=e;for(const e of n.toLowerCase().split(".")){if(Array.isArray(s)){if(!e.match(/^[0-9]+$/))break;s=s[parseInt(e)]}else if("object"==typeof s){let t=null;for(const r in s)if(r.toLowerCase()===e){t=s[r];break}s=t}else s=null;if(null==s)break}if(Z(!i||null!=s,"missing required value","path",n),o&&null!=s){if("int"===o){if("string"==typeof s&&s.match(/^-?[0-9]+$/))return parseInt(s);if(Number.isSafeInteger(s))return s}if("number"===o&&"string"==typeof s&&s.match(/^-?[0-9.]*$/))return parseFloat(s);if("data"===o&&"string"==typeof s)return _i(s);if("array"===o&&Array.isArray(s))return s;if(o===typeof s)return s;Z(!1,`wrong type found for ${o} `,"path",n)}return s}Ai._=Oi,Ai.lock=function(){vi=!0},Ai.register=function(e){if(vi)throw new Error("scrypt is locked");Si=e},Object.freeze(Ai),Ri._=Ii,Ri.lock=function(){bi=!0},Ri.register=function(e){if(bi)throw new Error("scryptSync is locked");wi=e},Object.freeze(Ri);const Li="m/44'/60'/0'/0/0";function Di(e){try{const t=JSON.parse(e);if(3===(null!=t.version?parseInt(t.version):0))return!0}catch(e){}return!1}function Ui(e,t){const r=oe(t),n=Pi(e,"crypto.ciphertext:data!");Z(ue(Ee(le([r.slice(16,32),n]))).substring(2)===Pi(e,"crypto.mac:string!").toLowerCase(),"incorrect password","password","[ REDACTED ]");const o=function(e,t,r){if("aes-128-ctr"===Pi(e,"crypto.cipher:string")){const n=Pi(e,"crypto.cipherparams.iv:data!");return ue(new di(t,n).decrypt(r))}Q(!1,"unsupported cipher","UNSUPPORTED_OPERATION",{operation:"decrypt"})}(e,r.slice(0,16),n),i=cn(o);if(e.address){let t=e.address.toLowerCase();t.startsWith("0x")||(t="0x"+t),Z(sr(t)===i,"keystore address/privateKey mismatch","address",e.address)}const s={address:i,privateKey:o};if("0.1"===Pi(e,"x-ethers.version:string")){const t=r.slice(32,64),n=Pi(e,"x-ethers.mnemonicCiphertext:data!"),o=Pi(e,"x-ethers.mnemonicCounter:data!"),i=new di(t,o);s.mnemonic={path:Pi(e,"x-ethers.path:string")||Li,locale:Pi(e,"x-ethers.locale:string")||"en",entropy:ue(oe(i.decrypt(n)))}}return s}function xi(e){const t=Pi(e,"crypto.kdf:string");if(t&&"string"==typeof t){if("scrypt"===t.toLowerCase()){const r=Pi(e,"crypto.kdfparams.salt:data!"),n=Pi(e,"crypto.kdfparams.n:int!"),o=Pi(e,"crypto.kdfparams.r:int!"),i=Pi(e,"crypto.kdfparams.p:int!");Z(n>0&&!(n&n-1),"invalid kdf.N","kdf.N",n),Z(o>0&&i>0,"invalid kdf","kdf",t);const s=Pi(e,"crypto.kdfparams.dklen:int!");return Z(32===s,"invalid kdf.dklen","kdf.dflen",s),{name:"scrypt",salt:r,N:n,r:o,p:i,dkLen:64}}if("pbkdf2"===t.toLowerCase()){const t=Pi(e,"crypto.kdfparams.salt:data!"),r=Pi(e,"crypto.kdfparams.prf:string!"),n=r.split("-").pop();Z("sha256"===n||"sha512"===n,"invalid kdf.pdf","kdf.pdf",r);const o=Pi(e,"crypto.kdfparams.c:int!"),i=Pi(e,"crypto.kdfparams.dklen:int!");return Z(32===i,"invalid kdf.dklen","kdf.dklen",i),{name:"pbkdf2",salt:t,count:o,dkLen:i,algorithm:n}}}Z(!1,"unsupported key-derivation function","kdf",t)}function Gi(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function ki(e){const t=null!=e.salt?oe(e.salt,"options.salt"):so(32);let r=1<<17,n=8,o=1;return e.scrypt&&(e.scrypt.N&&(r=e.scrypt.N),e.scrypt.r&&(n=e.scrypt.r),e.scrypt.p&&(o=e.scrypt.p)),Z("number"==typeof r&&r>0&&Number.isSafeInteger(r)&&(BigInt(r)&BigInt(r-1))===BigInt(0),"invalid scrypt N parameter","options.N",r),Z("number"==typeof n&&n>0&&Number.isSafeInteger(n),"invalid scrypt r parameter","options.r",n),Z("number"==typeof o&&o>0&&Number.isSafeInteger(o),"invalid scrypt p parameter","options.p",o),{name:"scrypt",dkLen:32,salt:t,N:r,r:n,p:o}}function Fi(e,t,r,n){const o=oe(r.privateKey,"privateKey"),i=null!=n.iv?oe(n.iv,"options.iv"):so(16);Z(16===i.length,"invalid options.iv length","options.iv",n.iv);const s=null!=n.uuid?oe(n.uuid,"options.uuid"):so(16);Z(16===s.length,"invalid options.uuid length","options.uuid",n.iv);const a=e.slice(0,16),c=e.slice(16,32),u=oe(new di(a,i).encrypt(o)),l=Ee(le([c,u])),f={address:r.address.substring(2).toLowerCase(),id:Ti(s),version:3,Crypto:{cipher:"aes-128-ctr",cipherparams:{iv:ue(i).substring(2)},ciphertext:ue(u).substring(2),kdf:"scrypt",kdfparams:{salt:ue(t.salt).substring(2),n:t.N,dklen:32,p:t.p,r:t.r},mac:l.substring(2)}};if(r.mnemonic){const t=null!=n.client?n.client:`ethers/${Y}`,o=r.mnemonic.path||Li,i=r.mnemonic.locale||"en",s=e.slice(32,64),a=oe(r.mnemonic.entropy,"account.mnemonic.entropy"),c=so(16),u=oe(new di(s,c).encrypt(a)),l=new Date,h="UTC--"+(l.getUTCFullYear()+"-"+Ni(l.getUTCMonth()+1,2)+"-"+Ni(l.getUTCDate(),2)+"T"+Ni(l.getUTCHours(),2)+"-"+Ni(l.getUTCMinutes(),2)+"-"+Ni(l.getUTCSeconds(),2)+".0Z")+"--"+f.address;f["x-ethers"]={client:t,gethFilename:h,path:o,locale:i,mnemonicCounter:ue(c).substring(2),mnemonicCiphertext:ue(u).substring(2),version:"0.1"}}return JSON.stringify(f)}function Bi(e,t,r){null==r&&(r={});const n=Ci(t),o=ki(r);return Fi(oe(Ri(n,o.salt,o.N,o.r,o.p,64)),o,e,r)}async function Mi(e,t,r){null==r&&(r={});const n=Ci(t),o=ki(r);return Fi(oe(await Ai(n,o.salt,o.N,o.r,o.p,64,r.progressCallback)),o,e,r)}const ji="m/44'/60'/0'/0/0",Ki=new Uint8Array([66,105,116,99,111,105,110,32,115,101,101,100]),$i=2147483648,Vi=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");function Hi(e,t){let r="";for(;e;)r="0123456789abcdef"[e%16]+r,e=Math.trunc(e/16);for(;r.length<2*t;)r="0"+r;return"0x"+r}function Yi(e){const t=oe(e);return function(e){const t=oe(e);let r=Gt(t),n="";for(;r;)n=ao[Number(r%fo)]+n,r/=fo;for(let e=0;e<t.length&&!t[e];e++)n=ao[0]+n;return n}(le([t,he(Qr(Qr(t)),0,4)]))}const qi={};function zi(e,t,r,n){const o=new Uint8Array(37);e&$i?(Q(null!=n,"cannot derive child of neutered node","UNSUPPORTED_OPERATION",{operation:"deriveChild"}),o.set(oe(n),1)):o.set(oe(r));for(let t=24;t>=0;t-=8)o[33+(t>>3)]=e>>24-t&255;const i=oe(Fn("sha512",t,o));return{IL:i.slice(0,32),IR:i.slice(32)}}function Wi(e,t){const r=t.split("/");Z(r.length>0,"invalid path","path",t),"m"===r[0]&&(Z(0===e.depth,`cannot derive root path (i.e. path starting with "m/") for a node at non-zero depth ${e.depth}`,"path",t),r.shift());let n=e;for(let e=0;e<r.length;e++){const t=r[e];if(t.match(/^[0-9]+'$/)){const r=parseInt(t.substring(0,t.length-1));Z(r<$i,"invalid path index",`path[${e}]`,t),n=n.deriveChild($i+r)}else if(t.match(/^[0-9]+$/)){const r=parseInt(t);Z(r<$i,"invalid path index",`path[${e}]`,t),n=n.deriveChild(r)}else Z(!1,"invalid path component",`path[${e}]`,t)}return n}class Ji extends Un{publicKey;fingerprint;parentFingerprint;mnemonic;chainCode;path;index;depth;constructor(e,t,r,n,o,i,s,a,c){super(t,c),re(e,qi,"HDNodeWallet"),W(this,{publicKey:t.compressedPublicKey});W(this,{parentFingerprint:r,fingerprint:he(ro(Qr(this.publicKey)),0,4),chainCode:n,path:o,index:i,depth:s}),W(this,{mnemonic:a})}connect(e){return new Ji(qi,this.signingKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,this.mnemonic,e)}#D(){const e={address:this.address,privateKey:this.privateKey},t=this.mnemonic;return this.path&&t&&"en"===t.wordlist.locale&&""===t.password&&(e.mnemonic={path:this.path,locale:"en",entropy:t.entropy}),e}async encrypt(e,t){return await Mi(this.#D(),e,{progressCallback:t})}encryptSync(e){return Bi(this.#D(),e)}get extendedKey(){return Q(this.depth<256,"Depth too deep","UNSUPPORTED_OPERATION",{operation:"extendedKey"}),Yi(le(["0x0488ADE4",Hi(this.depth,1),this.parentFingerprint,Hi(this.index,4),this.chainCode,le(["0x00",this.privateKey])]))}hasPath(){return null!=this.path}neuter(){return new Xi(qi,this.address,this.publicKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,this.provider)}deriveChild(e){const t=kt(e,"index");Z(t<=4294967295,"invalid index","index",t);let r=this.path;r&&(r+="/"+(2147483647&t),t&$i&&(r+="'"));const{IR:n,IL:o}=zi(t,this.chainCode,this.publicKey,this.privateKey),i=new Zt(Ft((Gt(o)+BigInt(this.privateKey))%Vi,32));return new Ji(qi,i,this.fingerprint,ue(n),r,t,this.depth+1,this.mnemonic,this.provider)}derivePath(e){return Wi(this,e)}static#U(e,t){Z(ae(e),"invalid seed","seed","[REDACTED]");const r=oe(e,"seed");Z(r.length>=16&&r.length<=64,"invalid seed","seed","[REDACTED]");const n=oe(Fn("sha512",Ki,r)),o=new Zt(ue(n.slice(0,32)));return new Ji(qi,o,"0x00000000",ue(n.slice(32)),"m",0,0,t,null)}static fromExtendedKey(e){const t=Bt(function(e){let t=lo;for(let r=0;r<e.length;r++)t*=fo,t+=uo(e[r]);return t}(e));Z(82===t.length||Yi(t.slice(0,78))===e,"invalid extended key","extendedKey","[ REDACTED ]");const r=t[4],n=ue(t.slice(5,9)),o=parseInt(ue(t.slice(9,13)).substring(2),16),i=ue(t.slice(13,45)),s=t.slice(45,78);switch(ue(t.slice(0,4))){case"0x0488b21e":case"0x043587cf":{const e=ue(s);return new Xi(qi,cn(e),e,n,i,null,o,r,null)}case"0x0488ade4":case"0x04358394 ":if(0!==s[0])break;return new Ji(qi,new Zt(s.slice(1)),n,i,null,o,r,null,null)}Z(!1,"invalid extended key prefix","extendedKey","[ REDACTED ]")}static createRandom(e,t,r){null==e&&(e=""),null==t&&(t=ji),null==r&&(r=vo.wordlist());const n=Co.fromEntropy(so(16),e,r);return Ji.#U(n.computeSeed(),n).derivePath(t)}static fromMnemonic(e,t){return t||(t=ji),Ji.#U(e.computeSeed(),e).derivePath(t)}static fromPhrase(e,t,r,n){null==t&&(t=""),null==r&&(r=ji),null==n&&(n=vo.wordlist());const o=Co.fromPhrase(e,t,n);return Ji.#U(o.computeSeed(),o).derivePath(r)}static fromSeed(e){return Ji.#U(e,null)}}class Xi extends Dn{publicKey;fingerprint;parentFingerprint;chainCode;path;index;depth;constructor(e,t,r,n,o,i,s,a,c){super(t,c),re(e,qi,"HDNodeVoidWallet"),W(this,{publicKey:r});W(this,{publicKey:r,fingerprint:he(ro(Qr(r)),0,4),parentFingerprint:n,chainCode:o,path:i,index:s,depth:a})}connect(e){return new Xi(qi,this.address,this.publicKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,e)}get extendedKey(){return Q(this.depth<256,"Depth too deep","UNSUPPORTED_OPERATION",{operation:"extendedKey"}),Yi(le(["0x0488B21E",Hi(this.depth,1),this.parentFingerprint,Hi(this.index,4),this.chainCode,this.publicKey]))}hasPath(){return null!=this.path}deriveChild(e){const t=kt(e,"index");Z(t<=4294967295,"invalid index","index",t);let r=this.path;r&&(r+="/"+(2147483647&t),t&$i&&(r+="'"));const{IR:n,IL:o}=zi(t,this.chainCode,this.publicKey,null),i=Zt.addPoints(o,this.publicKey,!0),s=cn(i);return new Xi(qi,s,i,this.fingerprint,ue(n),r,t,this.depth+1,this.provider)}derivePath(e){return Wi(this,e)}}function Qi(e){try{if(JSON.parse(e).encseed)return!0}catch(e){}return!1}function Zi(e,t){const r=JSON.parse(e),n=Ci(t),o=sr(Pi(r,"ethaddr:string!")),i=_i(Pi(r,"encseed:string!"));Z(i&&i.length%16==0,"invalid encseed","json",e);const s=oe(wo(n,n,2e3,32,"sha256")).slice(0,16),a=i.slice(0,16),c=i.slice(16),u=function(e){if(e.length<16)throw new TypeError("PKCS#7 invalid length");const t=e[e.length-1];if(t>16)throw new TypeError("PKCS#7 padding byte out of range");const r=e.length-t;for(let n=0;n<t;n++)if(e[r+n]!==t)throw new TypeError("PKCS#7 invalid padding byte");return new Uint8Array(e.subarray(0,r))}(oe(new ii(s,a).decrypt(c)));let l="";for(let e=0;e<u.length;e++)l+=String.fromCharCode(u[e]);return{address:o,privateKey:mr(l)}}function es(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}class ts extends Un{constructor(e,t){"string"!=typeof e||e.startsWith("0x")||(e="0x"+e),super("string"==typeof e?new Zt(e):e,t)}connect(e){return new ts(this.signingKey,e)}async encrypt(e,t){const r={address:this.address,privateKey:this.privateKey};return await Mi(r,e,{progressCallback:t})}encryptSync(e){return Bi({address:this.address,privateKey:this.privateKey},e)}static#x(e){if(Z(e,"invalid JSON wallet","json","[ REDACTED ]"),"mnemonic"in e&&e.mnemonic&&"en"===e.mnemonic.locale){const t=Co.fromEntropy(e.mnemonic.entropy),r=Ji.fromMnemonic(t,e.mnemonic.path);if(r.address===e.address&&r.privateKey===e.privateKey)return r;console.log("WARNING: JSON mismatch address/privateKey != mnemonic; fallback onto private key")}const t=new ts(e.privateKey);return Z(t.address===e.address,"address/privateKey mismatch","json","[ REDACTED ]"),t}static async fromEncryptedJson(e,t,r){let n=null;return Di(e)?n=await async function(e,t,r){const n=JSON.parse(e),o=Ci(t),i=xi(n);if("pbkdf2"===i.name){r&&(r(0),await Gi(0));const{salt:e,count:t,dkLen:s,algorithm:a}=i,c=wo(o,e,t,s,a);return r&&(r(1),await Gi(0)),Ui(n,c)}Q("scrypt"===i.name,"cannot be reached","UNKNOWN_ERROR",{params:i});const{salt:s,N:a,r:c,p:u,dkLen:l}=i;return Ui(n,await Ai(o,s,a,c,u,l,r))}(e,t,r):Qi(e)&&(r&&(r(0),await es(0)),n=Zi(e,t),r&&(r(1),await es(0))),ts.#x(n)}static fromEncryptedJsonSync(e,t){let r=null;return Di(e)?r=function(e,t){const r=JSON.parse(e),n=Ci(t),o=xi(r);if("pbkdf2"===o.name){const{salt:e,count:t,dkLen:i,algorithm:s}=o;return Ui(r,wo(n,e,t,i,s))}Q("scrypt"===o.name,"cannot be reached","UNKNOWN_ERROR",{params:o});const{salt:i,N:s,r:a,p:c,dkLen:u}=o;return Ui(r,Ri(n,i,s,a,c,u))}(e,t):Qi(e)?r=Zi(e,t):Z(!1,"invalid JSON wallet","json","[ REDACTED ]"),ts.#x(r)}static createRandom(e){const t=Ji.createRandom();return e?t.connect(e):t}static fromPhrase(e,t){const r=Ji.fromPhrase(e);return t?r.connect(t):r}}var rs=r(455),ns=r(952),os=r(770);function is(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return ss(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ss(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){a=!0,i=e},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw i}}}}function ss(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function as(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof a?n:a,u=Object.create(c.prototype);return cs(u,"_invoke",function(r,n,o){var i,a,c,u=0,l=o||[],f=!1,h={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return i=t,a=0,c=e,h.n=r,s}};function d(r,n){for(a=r,c=n,t=0;!f&&u&&!o&&t<l.length;t++){var o,i=l[t],d=h.p,p=i[2];r>3?(o=p===n)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(a=0,h.v=n,h.n=i[1]):d<p&&(o=r<3||i[0]>n||n>p)&&(i[4]=r,i[5]=n,h.n=p,a=0))}if(o||r>1)return s;throw f=!0,n}return function(o,l,p){if(u>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,p),a=l,c=p;(t=a<2?e:c)||!f;){i||(a?a<3?(a>1&&(h.n=-1),d(a,c)):h.n=c:h.v=c);try{if(u=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=h.n<0)?c:r.call(n,h))!==s)break}catch(t){i=e,a=1,c=t}finally{u=1}}return{value:t,done:f}}}(r,o,i),!0),u}var s={};function a(){}function c(){}function u(){}t=Object.getPrototypeOf;var l=[][n]?t(t([][n]())):(cs(t={},n,function(){return this}),t),f=u.prototype=a.prototype=Object.create(l);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,cs(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=u,cs(f,"constructor",u),cs(u,"constructor",c),c.displayName="GeneratorFunction",cs(u,o,"GeneratorFunction"),cs(f),cs(f,o,"Generator"),cs(f,n,function(){return this}),cs(f,"toString",function(){return"[object Generator]"}),(as=function(){return{w:i,m:h}})()}function cs(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}cs=function(e,t,r,n){function i(t,r){cs(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(i("next",0),i("throw",1),i("return",2))},cs(e,t,r,n)}function us(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function ls(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?us(Object(r),!0).forEach(function(t){fs(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):us(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function fs(e,t,r){return(t=ys(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function hs(e){return hs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},hs(e)}function ds(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ps(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,ys(n.key),n)}}function gs(e,t,r){return t&&ps(e.prototype,t),r&&ps(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function ys(e){var t=function(e,t){if("object"!=hs(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=hs(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==hs(t)?t:t+""}function ms(e,t,r,n,o,i,s){try{var a=e[i](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function Es(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function s(e){ms(i,n,o,s,a,"next",e)}function a(e){ms(i,n,o,s,a,"throw",e)}s(void 0)})}}var bs=[],vs=!1,Os="0.3.2";function Is(e){return new Promise(function(t,r){bs.push({task:e,resolve:t,reject:r}),Ss()})}function Ss(){return ws.apply(this,arguments)}function ws(){return(ws=Es(as().m(function e(){var t,r,n;return as().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!vs){e.n=1;break}return e.a(2);case 1:if(t=bs.shift()){e.n=2;break}return e.a(2);case 2:return vs=!0,e.p=3,e.n=4,t.task();case 4:r=e.v,t.resolve(r),e.n=6;break;case 5:e.p=5,n=e.v,t.reject(n);case 6:return e.p=6,vs=!1,Ss(),e.f(6);case 7:return e.a(2)}},e,null,[[3,5,6,7]])}))).apply(this,arguments)}var As=function(){function e(t,r){var n,o=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(ds(this,e),this.applicationId=t,this.providerId=r,this.sessionId="",this.signature="",this.timestamp=Date.now().toString(),this.parameters={},this.context={contextAddress:"0x0",contextMessage:"sample context"},this.redirectUrl="",this.sdkVersion="ext-".concat(Os),this.resolvedProviderVersion="",this.jsonProofResponse=!1,this.extensionID=i.extensionID||"",this.providerVersion=i.providerVersion||"",this.acceptAiProviders=!!i.acceptAiProviders,this.callbackUrl=i.callbackUrl||"",this._backgroundInitialized=!1,this._ctx=null,this._listeners={started:new Set,completed:new Set,error:new Set,progress:new Set},this._boundWindowListener=this._handleWindowMessage.bind(this),window.addEventListener("message",this._boundWindowListener),this._mode="undefined"!=typeof chrome&&chrome.runtime&&"chrome-extension:"===(null===(n=location)||void 0===n?void 0:n.protocol)?"extension":"web","extension"===this._mode){this._boundChromeHandler=function(e){var t=e||{},r=t.action,n=t.data,i=t.error,s=null==n?void 0:n.sessionId;if(!o.sessionId||o.sessionId===s)if("PROOF_SUBMITTED"===r){var a=(null==n?void 0:n.formattedProofs)||(null==n?void 0:n.proof)||n;o._emit("completed",a)}else"PROOF_SUBMISSION_FAILED"!==r&&"PROOF_GENERATION_FAILED"!==r||o._emit("error",i||new Error("Verification failed"))};try{chrome.runtime.onMessage.addListener(this._boundChromeHandler)}catch(e){}}}return gs(e,[{key:"setAppCallbackUrl",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e||"string"!=typeof e)throw new Error("callbackUrl must be a non-empty string");this.callbackUrl=e,this.jsonProofResponse=!!t}},{key:"setRedirectUrl",value:function(e){if(!e||"string"!=typeof e)throw new Error("redirectUrl must be a non-empty string");this.redirectUrl=e}},{key:"addContext",value:function(e,t){if(!e||!t)throw new Error("Both address and message are required");this.context={contextAddress:String(e),contextMessage:String(t)}}},{key:"setParams",value:function(e){if(!e||"object"!==hs(e))throw new Error("params must be an object");this.parameters=ls(ls({},this.parameters),e)}},{key:"getStatusUrl",value:function(){if(!this.sessionId)throw new Error("Session not initialized");return ns.Sn.STATUS_URL(this.sessionId)}},{key:"on",value:function(e,t){var r=this;if(!this._listeners[e])throw new Error("Unknown event: ".concat(e));return this._listeners[e].add(t),function(){return r.off(e,t)}}},{key:"off",value:function(e,t){this._listeners[e]&&this._listeners[e].delete(t)}},{key:"startVerification",value:(i=Es(as().m(function e(){var t=this;return as().w(function(e){for(;;)if(0===e.n)return e.a(2,Is(function(){return t._startVerificationInternal()}))},e)})),function(){return i.apply(this,arguments)})},{key:"cancel",value:(o=Es(as().m(function e(){var t,r=this,n=arguments;return as().w(function(e){for(;;)switch(e.n){case 0:if(t=n.length>0&&void 0!==n[0]?n[0]:5e3,this.sessionId){e.n=1;break}return e.a(2);case 1:return e.a(2,new Promise(function(e){var n=!1,o=r.on("error",function(){n||(n=!0,o(),e(!0))});window.postMessage({action:ns.RECLAIM_SDK_ACTIONS.CANCEL_VERIFICATION,messageId:r.sessionId,extensionID:r.extensionID},"*"),setTimeout(function(){n||(o(),e(!1))},t)}))}},e,this)})),function(){return o.apply(this,arguments)})},{key:"_startVerificationInternal",value:(n=Es(as().m(function e(){var t,r,n=this;return as().w(function(e){for(;;)switch(e.n){case 0:if(this.sessionId){e.n=1;break}throw new Error("Session not initialized");case 1:if(this.signature){e.n=2;break}throw new Error("Signature not set");case 2:return t={sessionId:this.sessionId,providerId:this.providerId,applicationId:this.applicationId,signature:this.signature,timestamp:this.timestamp,callbackUrl:this.callbackUrl||"",context:JSON.stringify(this.context||{}),parameters:this.parameters||{},redirectUrl:this.redirectUrl||"",acceptAiProviders:!!this.acceptAiProviders,sdkVersion:this.sdkVersion,providerVersion:this.providerVersion||"",resolvedProviderVersion:this.resolvedProviderVersion||"",jsonProofResponse:!!this.jsonProofResponse},r=this.sessionId,e.a(2,new Promise(function(e,o){var i=n.on("started",function(){}),s=n.on("completed",function(t){c(),e(t)}),a=n.on("error",function(e){c(),o(e)}),c=function(){i&&i(),s&&s(),a&&a()};if("extension"===n._mode)try{chrome.runtime.sendMessage({action:"START_VERIFICATION",source:"content-script",target:"background",data:t},function(e){e&&e.success&&n._emit("started",{sessionId:n.sessionId,messageId:r})})}catch(e){n._emit("error",e instanceof Error?e:new Error(String(e)))}else{if(!n.extensionID)return void n._emit("error",new Error("extensionID is required when running on a web page"));window.postMessage({action:ns.RECLAIM_SDK_ACTIONS.START_VERIFICATION,messageId:r,data:t,extensionID:n.extensionID},"*")}}))}},e,this)})),function(){return n.apply(this,arguments)})},{key:"dispose",value:function(){var e;if(window.removeEventListener("message",this._boundWindowListener),this._boundChromeHandler&&null!==(e=chrome)&&void 0!==e&&null!==(e=e.runtime)&&void 0!==e&&null!==(e=e.onMessage)&&void 0!==e&&e.removeListener)try{chrome.runtime.onMessage.removeListener(this._boundChromeHandler)}catch(e){}this._listeners.started.clear(),this._listeners.completed.clear(),this._listeners.error.clear(),this._listeners.progress.clear()}},{key:"_initSession",value:(r=Es(as().m(function e(t){var r,n;return as().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,fetch("".concat(ns.fn,"/api/sdk/init/session/"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});case 1:return r=e.v,e.n=2,r.json().catch(function(){return{}});case 2:if(n=e.v,r.ok){e.n=3;break}throw new Error((null==n?void 0:n.message)||"Failed to initialize session");case 3:return e.a(2,n)}},e)})),function(e){return r.apply(this,arguments)})},{key:"_emit",value:function(e,t){if(this._listeners[e]){var r,n=is(this._listeners[e]);try{for(n.s();!(r=n.n()).done;){var o=r.value;try{o(t)}catch(e){}}}catch(e){n.e(e)}finally{n.f()}}}},{key:"_handleWindowMessage",value:function(e){if(e.source===window){var t=e.data||{},r=t.action,n=t.messageId,o=t.data,i=t.error;if(!this.sessionId||this.sessionId===n)if(r!==ns.RECLAIM_SDK_ACTIONS.VERIFICATION_COMPLETED)r!==ns.RECLAIM_SDK_ACTIONS.VERIFICATION_FAILED?r!==ns.RECLAIM_SDK_ACTIONS.VERIFICATION_STARTED||this._emit("started",{sessionId:this.sessionId,messageId:n}):this._emit("error",i||new Error("Verification failed"));else{var s=(null==o?void 0:o.proofs)||(null==o?void 0:o.formattedProofs)||o;this._emit("completed",s)}}}}],[{key:"init",value:(t=Es(as().m(function t(r,n,o){var i,s,a,c,u,l,f,h=arguments;return as().w(function(t){for(;;)switch(t.n){case 0:if(i=h.length>3&&void 0!==h[3]?h[3]:{},r&&"string"==typeof r){t.n=1;break}throw new Error("applicationId must be a non-empty string");case 1:if(n&&"string"==typeof n){t.n=2;break}throw new Error("appSecret must be a non-empty string");case 2:if(o&&"string"==typeof o){t.n=3;break}throw new Error("providerId must be a non-empty string");case 3:return s=new e(r,o,i),a='{"providerId":"'.concat(o,'","timestamp":"').concat(s.timestamp,'"}'),c=Ee((new TextEncoder).encode(a)),u=new ts(n),t.n=4,u.signMessage(oe(c));case 4:return l=t.v,s.signature=l,t.n=5,s._initSession({providerId:o,appId:r,timestamp:s.timestamp,signature:l,versionNumber:s.providerVersion||""});case 5:return f=t.v,s.sessionId=f.sessionId||"",s.resolvedProviderVersion=f.resolvedProviderVersion||"",t.a(2,s)}},t)})),function(e,r,n){return t.apply(this,arguments)})},{key:"fromJsonString",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r="string"==typeof e?JSON.parse(e):e;return this.fromConfig(r,t)}},{key:"fromConfig",value:function(t){var r,n,o,i,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!t||"object"!==hs(t))throw new Error("invalid config");var a=new e(String(t.applicationId||""),String(t.providerId||""),s||{});return a.sessionId=String(t.sessionId||""),a.signature=String(t.signature||""),a.timestamp=String(t.timeStamp||t.timestamp||Date.now()),a.parameters=t.parameters||{},a.context=t.context||a.context,a.callbackUrl=String(t.appCallbackUrl||t.callbackUrl||""),a.jsonProofResponse=!!(null!==(r=t.jsonProofResponse)&&void 0!==r?r:a.jsonProofResponse),a.resolvedProviderVersion=String(t.resolvedProviderVersion||""),a.providerVersion=String(t.providerVersion||""),a.redirectUrl=String(t.redirectUrl||""),a.acceptAiProviders=!!(null!==(n=null!==(o=t.acceptAiProviders)&&void 0!==o?o:null===(i=t.options)||void 0===i?void 0:i.acceptAiProviders)&&void 0!==n?n:a.acceptAiProviders),null!=s&&s.extensionID&&(a.extensionID=String(s.extensionID)),a}}]);var t,r,n,o,i}(),Rs=function(){return gs(function e(){var t;ds(this,e),this._backgroundInitialized=!1,this._ctx=null,this._mode="undefined"!=typeof chrome&&chrome.runtime&&"chrome-extension:"===(null===(t=location)||void 0===t?void 0:t.protocol)?"extension":"web"},[{key:"initializeBackground",value:function(){if(this._backgroundInitialized)return this._ctx;try{var e=(0,rs.A)();return this._backgroundInitialized=!0,this._ctx=e,e}catch(e){throw e}}},{key:"isExtensionInstalled",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.extensionID,r=e.timeout,n=void 0===r?500:r;return new Promise(function(e){var r="reclaim-check-".concat(Date.now()),o=function(t){var n,i;t.source===window&&(null===(n=t.data)||void 0===n?void 0:n.action)===ns.RECLAIM_SDK_ACTIONS.EXTENSION_RESPONSE&&(null===(i=t.data)||void 0===i?void 0:i.messageId)===r&&(window.removeEventListener("message",o),e(!!t.data.installed))};window.addEventListener("message",o),window.postMessage({action:ns.RECLAIM_SDK_ACTIONS.CHECK_EXTENSION,extensionID:t,messageId:r},"*"),setTimeout(function(){window.removeEventListener("message",o),e(!1)},n)})}},{key:"getVersion",value:function(){return Os}},{key:"init",value:(e=Es(as().m(function e(t,r,n){var o,i=arguments;return as().w(function(e){for(;;)switch(e.n){case 0:return o=i.length>3&&void 0!==i[3]?i[3]:{},e.n=1,As.init(t,r,n,o);case 1:return e.a(2,e.v)}},e)})),function(t,r,n){return e.apply(this,arguments)})},{key:"fromJsonString",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return As.fromJsonString(e,t)}},{key:"setLogConfig",value:function(e,t){os.Ow.setConfig(e);try{var n;if("extension"===this._mode&&"undefined"!=typeof chrome&&null!==(n=chrome.storage)&&void 0!==n&&n.local){var o=r(859).LOG_CONFIG_STORAGE_KEY;return void chrome.storage.local.set(fs({},o,ls(ls({},os.Ow.config),e)))}}catch(e){}window.postMessage({action:ns.RECLAIM_SDK_ACTIONS.SET_LOG_CONFIG,extensionID:t,data:{config:e}},"*")}},{key:"getLogConfig",value:function(){return os.Ow.config}}]);var e}(),Ts=new Rs;const _s=Rs})(),module.exports=n})();
|
|
22
|
+
var Po,Lo,Do,Uo=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},xo=function(e,t,r,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(e,r):o?o.value=r:t.set(e,r),r};const Go={16:10,24:12,32:14},ko=[1,2,4,8,16,32,64,128,27,54,108,216,171,77,154,47,94,188,99,198,151,53,106,212,179,125,250,239,197,145],Fo=[99,124,119,123,242,107,111,197,48,1,103,43,254,215,171,118,202,130,201,125,250,89,71,240,173,212,162,175,156,164,114,192,183,253,147,38,54,63,247,204,52,165,229,241,113,216,49,21,4,199,35,195,24,150,5,154,7,18,128,226,235,39,178,117,9,131,44,26,27,110,90,160,82,59,214,179,41,227,47,132,83,209,0,237,32,252,177,91,106,203,190,57,74,76,88,207,208,239,170,251,67,77,51,133,69,249,2,127,80,60,159,168,81,163,64,143,146,157,56,245,188,182,218,33,16,255,243,210,205,12,19,236,95,151,68,23,196,167,126,61,100,93,25,115,96,129,79,220,34,42,144,136,70,238,184,20,222,94,11,219,224,50,58,10,73,6,36,92,194,211,172,98,145,149,228,121,231,200,55,109,141,213,78,169,108,86,244,234,101,122,174,8,186,120,37,46,28,166,180,198,232,221,116,31,75,189,139,138,112,62,181,102,72,3,246,14,97,53,87,185,134,193,29,158,225,248,152,17,105,217,142,148,155,30,135,233,206,85,40,223,140,161,137,13,191,230,66,104,65,153,45,15,176,84,187,22],Bo=[82,9,106,213,48,54,165,56,191,64,163,158,129,243,215,251,124,227,57,130,155,47,255,135,52,142,67,68,196,222,233,203,84,123,148,50,166,194,35,61,238,76,149,11,66,250,195,78,8,46,161,102,40,217,36,178,118,91,162,73,109,139,209,37,114,248,246,100,134,104,152,22,212,164,92,204,93,101,182,146,108,112,72,80,253,237,185,218,94,21,70,87,167,141,157,132,144,216,171,0,140,188,211,10,247,228,88,5,184,179,69,6,208,44,30,143,202,63,15,2,193,175,189,3,1,19,138,107,58,145,17,65,79,103,220,234,151,242,207,206,240,180,230,115,150,172,116,34,231,173,53,133,226,249,55,232,28,117,223,110,71,241,26,113,29,41,197,137,111,183,98,14,170,24,190,27,252,86,62,75,198,210,121,32,154,219,192,254,120,205,90,244,31,221,168,51,136,7,199,49,177,18,16,89,39,128,236,95,96,81,127,169,25,181,74,13,45,229,122,159,147,201,156,239,160,224,59,77,174,42,245,176,200,235,187,60,131,83,153,97,23,43,4,126,186,119,214,38,225,105,20,99,85,33,12,125],Mo=[3328402341,4168907908,4000806809,4135287693,4294111757,3597364157,3731845041,2445657428,1613770832,33620227,3462883241,1445669757,3892248089,3050821474,1303096294,3967186586,2412431941,528646813,2311702848,4202528135,4026202645,2992200171,2387036105,4226871307,1101901292,3017069671,1604494077,1169141738,597466303,1403299063,3832705686,2613100635,1974974402,3791519004,1033081774,1277568618,1815492186,2118074177,4126668546,2211236943,1748251740,1369810420,3521504564,4193382664,3799085459,2883115123,1647391059,706024767,134480908,2512897874,1176707941,2646852446,806885416,932615841,168101135,798661301,235341577,605164086,461406363,3756188221,3454790438,1311188841,2142417613,3933566367,302582043,495158174,1479289972,874125870,907746093,3698224818,3025820398,1537253627,2756858614,1983593293,3084310113,2108928974,1378429307,3722699582,1580150641,327451799,2790478837,3117535592,0,3253595436,1075847264,3825007647,2041688520,3059440621,3563743934,2378943302,1740553945,1916352843,2487896798,2555137236,2958579944,2244988746,3151024235,3320835882,1336584933,3992714006,2252555205,2588757463,1714631509,293963156,2319795663,3925473552,67240454,4269768577,2689618160,2017213508,631218106,1269344483,2723238387,1571005438,2151694528,93294474,1066570413,563977660,1882732616,4059428100,1673313503,2008463041,2950355573,1109467491,537923632,3858759450,4260623118,3218264685,2177748300,403442708,638784309,3287084079,3193921505,899127202,2286175436,773265209,2479146071,1437050866,4236148354,2050833735,3362022572,3126681063,840505643,3866325909,3227541664,427917720,2655997905,2749160575,1143087718,1412049534,999329963,193497219,2353415882,3354324521,1807268051,672404540,2816401017,3160301282,369822493,2916866934,3688947771,1681011286,1949973070,336202270,2454276571,201721354,1210328172,3093060836,2680341085,3184776046,1135389935,3294782118,965841320,831886756,3554993207,4068047243,3588745010,2345191491,1849112409,3664604599,26054028,2983581028,2622377682,1235855840,3630984372,2891339514,4092916743,3488279077,3395642799,4101667470,1202630377,268961816,1874508501,4034427016,1243948399,1546530418,941366308,1470539505,1941222599,2546386513,3421038627,2715671932,3899946140,1042226977,2521517021,1639824860,227249030,260737669,3765465232,2084453954,1907733956,3429263018,2420656344,100860677,4160157185,470683154,3261161891,1781871967,2924959737,1773779408,394692241,2579611992,974986535,664706745,3655459128,3958962195,731420851,571543859,3530123707,2849626480,126783113,865375399,765172662,1008606754,361203602,3387549984,2278477385,2857719295,1344809080,2782912378,59542671,1503764984,160008576,437062935,1707065306,3622233649,2218934982,3496503480,2185314755,697932208,1512910199,504303377,2075177163,2824099068,1841019862,739644986],jo=[2781242211,2230877308,2582542199,2381740923,234877682,3184946027,2984144751,1418839493,1348481072,50462977,2848876391,2102799147,434634494,1656084439,3863849899,2599188086,1167051466,2636087938,1082771913,2281340285,368048890,3954334041,3381544775,201060592,3963727277,1739838676,4250903202,3930435503,3206782108,4149453988,2531553906,1536934080,3262494647,484572669,2923271059,1783375398,1517041206,1098792767,49674231,1334037708,1550332980,4098991525,886171109,150598129,2481090929,1940642008,1398944049,1059722517,201851908,1385547719,1699095331,1587397571,674240536,2704774806,252314885,3039795866,151914247,908333586,2602270848,1038082786,651029483,1766729511,3447698098,2682942837,454166793,2652734339,1951935532,775166490,758520603,3000790638,4004797018,4217086112,4137964114,1299594043,1639438038,3464344499,2068982057,1054729187,1901997871,2534638724,4121318227,1757008337,0,750906861,1614815264,535035132,3363418545,3988151131,3201591914,1183697867,3647454910,1265776953,3734260298,3566750796,3903871064,1250283471,1807470800,717615087,3847203498,384695291,3313910595,3617213773,1432761139,2484176261,3481945413,283769337,100925954,2180939647,4037038160,1148730428,3123027871,3813386408,4087501137,4267549603,3229630528,2315620239,2906624658,3156319645,1215313976,82966005,3747855548,3245848246,1974459098,1665278241,807407632,451280895,251524083,1841287890,1283575245,337120268,891687699,801369324,3787349855,2721421207,3431482436,959321879,1469301956,4065699751,2197585534,1199193405,2898814052,3887750493,724703513,2514908019,2696962144,2551808385,3516813135,2141445340,1715741218,2119445034,2872807568,2198571144,3398190662,700968686,3547052216,1009259540,2041044702,3803995742,487983883,1991105499,1004265696,1449407026,1316239930,504629770,3683797321,168560134,1816667172,3837287516,1570751170,1857934291,4014189740,2797888098,2822345105,2754712981,936633572,2347923833,852879335,1133234376,1500395319,3084545389,2348912013,1689376213,3533459022,3762923945,3034082412,4205598294,133428468,634383082,2949277029,2398386810,3913789102,403703816,3580869306,2297460856,1867130149,1918643758,607656988,4049053350,3346248884,1368901318,600565992,2090982877,2632479860,557719327,3717614411,3697393085,2249034635,2232388234,2430627952,1115438654,3295786421,2865522278,3633334344,84280067,33027830,303828494,2747425121,1600795957,4188952407,3496589753,2434238086,1486471617,658119965,3106381470,953803233,334231800,3005978776,857870609,3151128937,1890179545,2298973838,2805175444,3056442267,574365214,2450884487,550103529,1233637070,4289353045,2018519080,2057691103,2399374476,4166623649,2148108681,387583245,3664101311,836232934,3330556482,3100665960,3280093505,2955516313,2002398509,287182607,3413881008,4238890068,3597515707,975967766],Ko=[1671808611,2089089148,2006576759,2072901243,4061003762,1807603307,1873927791,3310653893,810573872,16974337,1739181671,729634347,4263110654,3613570519,2883997099,1989864566,3393556426,2191335298,3376449993,2106063485,4195741690,1508618841,1204391495,4027317232,2917941677,3563566036,2734514082,2951366063,2629772188,2767672228,1922491506,3227229120,3082974647,4246528509,2477669779,644500518,911895606,1061256767,4144166391,3427763148,878471220,2784252325,3845444069,4043897329,1905517169,3631459288,827548209,356461077,67897348,3344078279,593839651,3277757891,405286936,2527147926,84871685,2595565466,118033927,305538066,2157648768,3795705826,3945188843,661212711,2999812018,1973414517,152769033,2208177539,745822252,439235610,455947803,1857215598,1525593178,2700827552,1391895634,994932283,3596728278,3016654259,695947817,3812548067,795958831,2224493444,1408607827,3513301457,0,3979133421,543178784,4229948412,2982705585,1542305371,1790891114,3410398667,3201918910,961245753,1256100938,1289001036,1491644504,3477767631,3496721360,4012557807,2867154858,4212583931,1137018435,1305975373,861234739,2241073541,1171229253,4178635257,33948674,2139225727,1357946960,1011120188,2679776671,2833468328,1374921297,2751356323,1086357568,2408187279,2460827538,2646352285,944271416,4110742005,3168756668,3066132406,3665145818,560153121,271589392,4279952895,4077846003,3530407890,3444343245,202643468,322250259,3962553324,1608629855,2543990167,1154254916,389623319,3294073796,2817676711,2122513534,1028094525,1689045092,1575467613,422261273,1939203699,1621147744,2174228865,1339137615,3699352540,577127458,712922154,2427141008,2290289544,1187679302,3995715566,3100863416,339486740,3732514782,1591917662,186455563,3681988059,3762019296,844522546,978220090,169743370,1239126601,101321734,611076132,1558493276,3260915650,3547250131,2901361580,1655096418,2443721105,2510565781,3828863972,2039214713,3878868455,3359869896,928607799,1840765549,2374762893,3580146133,1322425422,2850048425,1823791212,1459268694,4094161908,3928346602,1706019429,2056189050,2934523822,135794696,3134549946,2022240376,628050469,779246638,472135708,2800834470,3032970164,3327236038,3894660072,3715932637,1956440180,522272287,1272813131,3185336765,2340818315,2323976074,1888542832,1044544574,3049550261,1722469478,1222152264,50660867,4127324150,236067854,1638122081,895445557,1475980887,3117443513,2257655686,3243809217,489110045,2662934430,3778599393,4162055160,2561878936,288563729,1773916777,3648039385,2391345038,2493985684,2612407707,505560094,2274497927,3911240169,3460925390,1442818645,678973480,3749357023,2358182796,2717407649,2306869641,219617805,3218761151,3862026214,1120306242,1756942440,1103331905,2578459033,762796589,252780047,2966125488,1425844308,3151392187,372911126],$o=[1667474886,2088535288,2004326894,2071694838,4075949567,1802223062,1869591006,3318043793,808472672,16843522,1734846926,724270422,4278065639,3621216949,2880169549,1987484396,3402253711,2189597983,3385409673,2105378810,4210693615,1499065266,1195886990,4042263547,2913856577,3570689971,2728590687,2947541573,2627518243,2762274643,1920112356,3233831835,3082273397,4261223649,2475929149,640051788,909531756,1061110142,4160160501,3435941763,875846760,2779116625,3857003729,4059105529,1903268834,3638064043,825316194,353713962,67374088,3351728789,589522246,3284360861,404236336,2526454071,84217610,2593830191,117901582,303183396,2155911963,3806477791,3958056653,656894286,2998062463,1970642922,151591698,2206440989,741110872,437923380,454765878,1852748508,1515908788,2694904667,1381168804,993742198,3604373943,3014905469,690584402,3823320797,791638366,2223281939,1398011302,3520161977,0,3991743681,538992704,4244381667,2981218425,1532751286,1785380564,3419096717,3200178535,960056178,1246420628,1280103576,1482221744,3486468741,3503319995,4025428677,2863326543,4227536621,1128514950,1296947098,859002214,2240123921,1162203018,4193849577,33687044,2139062782,1347481760,1010582648,2678045221,2829640523,1364325282,2745433693,1077985408,2408548869,2459086143,2644360225,943212656,4126475505,3166494563,3065430391,3671750063,555836226,269496352,4294908645,4092792573,3537006015,3452783745,202118168,320025894,3974901699,1600119230,2543297077,1145359496,387397934,3301201811,2812801621,2122220284,1027426170,1684319432,1566435258,421079858,1936954854,1616945344,2172753945,1330631070,3705438115,572679748,707427924,2425400123,2290647819,1179044492,4008585671,3099120491,336870440,3739122087,1583276732,185277718,3688593069,3772791771,842159716,976899700,168435220,1229577106,101059084,606366792,1549591736,3267517855,3553849021,2897014595,1650632388,2442242105,2509612081,3840161747,2038008818,3890688725,3368567691,926374254,1835907034,2374863873,3587531953,1313788572,2846482505,1819063512,1448540844,4109633523,3941213647,1701162954,2054852340,2930698567,134748176,3132806511,2021165296,623210314,774795868,471606328,2795958615,3031746419,3334885783,3907527627,3722280097,1953799400,522133822,1263263126,3183336545,2341176845,2324333839,1886425312,1044267644,3048588401,1718004428,1212733584,50529542,4143317495,235803164,1633788866,892690282,1465383342,3115962473,2256965911,3250673817,488449850,2661202215,3789633753,4177007595,2560144171,286339874,1768537042,3654906025,2391705863,2492770099,2610673197,505291324,2273808917,3924369609,3469625735,1431699370,673740880,3755965093,2358021891,2711746649,2307489801,218961690,3217021541,3873845719,1111672452,1751693520,1094828930,2576986153,757954394,252645662,2964376443,1414855848,3149649517,370555436],Vo=[1374988112,2118214995,437757123,975658646,1001089995,530400753,2902087851,1273168787,540080725,2910219766,2295101073,4110568485,1340463100,3307916247,641025152,3043140495,3736164937,632953703,1172967064,1576976609,3274667266,2169303058,2370213795,1809054150,59727847,361929877,3211623147,2505202138,3569255213,1484005843,1239443753,2395588676,1975683434,4102977912,2572697195,666464733,3202437046,4035489047,3374361702,2110667444,1675577880,3843699074,2538681184,1649639237,2976151520,3144396420,4269907996,4178062228,1883793496,2403728665,2497604743,1383856311,2876494627,1917518562,3810496343,1716890410,3001755655,800440835,2261089178,3543599269,807962610,599762354,33778362,3977675356,2328828971,2809771154,4077384432,1315562145,1708848333,101039829,3509871135,3299278474,875451293,2733856160,92987698,2767645557,193195065,1080094634,1584504582,3178106961,1042385657,2531067453,3711829422,1306967366,2438237621,1908694277,67556463,1615861247,429456164,3602770327,2302690252,1742315127,2968011453,126454664,3877198648,2043211483,2709260871,2084704233,4169408201,0,159417987,841739592,504459436,1817866830,4245618683,260388950,1034867998,908933415,168810852,1750902305,2606453969,607530554,202008497,2472011535,3035535058,463180190,2160117071,1641816226,1517767529,470948374,3801332234,3231722213,1008918595,303765277,235474187,4069246893,766945465,337553864,1475418501,2943682380,4003061179,2743034109,4144047775,1551037884,1147550661,1543208500,2336434550,3408119516,3069049960,3102011747,3610369226,1113818384,328671808,2227573024,2236228733,3535486456,2935566865,3341394285,496906059,3702665459,226906860,2009195472,733156972,2842737049,294930682,1206477858,2835123396,2700099354,1451044056,573804783,2269728455,3644379585,2362090238,2564033334,2801107407,2776292904,3669462566,1068351396,742039012,1350078989,1784663195,1417561698,4136440770,2430122216,775550814,2193862645,2673705150,1775276924,1876241833,3475313331,3366754619,270040487,3902563182,3678124923,3441850377,1851332852,3969562369,2203032232,3868552805,2868897406,566021896,4011190502,3135740889,1248802510,3936291284,699432150,832877231,708780849,3332740144,899835584,1951317047,4236429990,3767586992,866637845,4043610186,1106041591,2144161806,395441711,1984812685,1139781709,3433712980,3835036895,2664543715,1282050075,3240894392,1181045119,2640243204,25965917,4203181171,4211818798,3009879386,2463879762,3910161971,1842759443,2597806476,933301370,1509430414,3943906441,3467192302,3076639029,3776767469,2051518780,2631065433,1441952575,404016761,1942435775,1408749034,1610459739,3745345300,2017778566,3400528769,3110650942,941896748,3265478751,371049330,3168937228,675039627,4279080257,967311729,135050206,3635733660,1683407248,2076935265,3576870512,1215061108,3501741890],Ho=[1347548327,1400783205,3273267108,2520393566,3409685355,4045380933,2880240216,2471224067,1428173050,4138563181,2441661558,636813900,4233094615,3620022987,2149987652,2411029155,1239331162,1730525723,2554718734,3781033664,46346101,310463728,2743944855,3328955385,3875770207,2501218972,3955191162,3667219033,768917123,3545789473,692707433,1150208456,1786102409,2029293177,1805211710,3710368113,3065962831,401639597,1724457132,3028143674,409198410,2196052529,1620529459,1164071807,3769721975,2226875310,486441376,2499348523,1483753576,428819965,2274680428,3075636216,598438867,3799141122,1474502543,711349675,129166120,53458370,2592523643,2782082824,4063242375,2988687269,3120694122,1559041666,730517276,2460449204,4042459122,2706270690,3446004468,3573941694,533804130,2328143614,2637442643,2695033685,839224033,1973745387,957055980,2856345839,106852767,1371368976,4181598602,1033297158,2933734917,1179510461,3046200461,91341917,1862534868,4284502037,605657339,2547432937,3431546947,2003294622,3182487618,2282195339,954669403,3682191598,1201765386,3917234703,3388507166,0,2198438022,1211247597,2887651696,1315723890,4227665663,1443857720,507358933,657861945,1678381017,560487590,3516619604,975451694,2970356327,261314535,3535072918,2652609425,1333838021,2724322336,1767536459,370938394,182621114,3854606378,1128014560,487725847,185469197,2918353863,3106780840,3356761769,2237133081,1286567175,3152976349,4255350624,2683765030,3160175349,3309594171,878443390,1988838185,3704300486,1756818940,1673061617,3403100636,272786309,1075025698,545572369,2105887268,4174560061,296679730,1841768865,1260232239,4091327024,3960309330,3497509347,1814803222,2578018489,4195456072,575138148,3299409036,446754879,3629546796,4011996048,3347532110,3252238545,4270639778,915985419,3483825537,681933534,651868046,2755636671,3828103837,223377554,2607439820,1649704518,3270937875,3901806776,1580087799,4118987695,3198115200,2087309459,2842678573,3016697106,1003007129,2802849917,1860738147,2077965243,164439672,4100872472,32283319,2827177882,1709610350,2125135846,136428751,3874428392,3652904859,3460984630,3572145929,3593056380,2939266226,824852259,818324884,3224740454,930369212,2801566410,2967507152,355706840,1257309336,4148292826,243256656,790073846,2373340630,1296297904,1422699085,3756299780,3818836405,457992840,3099667487,2135319889,77422314,1560382517,1945798516,788204353,1521706781,1385356242,870912086,325965383,2358957921,2050466060,2388260884,2313884476,4006521127,901210569,3990953189,1014646705,1503449823,1062597235,2031621326,3212035895,3931371469,1533017514,350174575,2256028891,2177544179,1052338372,741876788,1606591296,1914052035,213705253,2334669897,1107234197,1899603969,3725069491,2631447780,2422494913,1635502980,1893020342,1950903388,1120974935],Yo=[2807058932,1699970625,2764249623,1586903591,1808481195,1173430173,1487645946,59984867,4199882800,1844882806,1989249228,1277555970,3623636965,3419915562,1149249077,2744104290,1514790577,459744698,244860394,3235995134,1963115311,4027744588,2544078150,4190530515,1608975247,2627016082,2062270317,1507497298,2200818878,567498868,1764313568,3359936201,2305455554,2037970062,1047239e3,1910319033,1337376481,2904027272,2892417312,984907214,1243112415,830661914,861968209,2135253587,2011214180,2927934315,2686254721,731183368,1750626376,4246310725,1820824798,4172763771,3542330227,48394827,2404901663,2871682645,671593195,3254988725,2073724613,145085239,2280796200,2779915199,1790575107,2187128086,472615631,3029510009,4075877127,3802222185,4107101658,3201631749,1646252340,4270507174,1402811438,1436590835,3778151818,3950355702,3963161475,4020912224,2667994737,273792366,2331590177,104699613,95345982,3175501286,2377486676,1560637892,3564045318,369057872,4213447064,3919042237,1137477952,2658625497,1119727848,2340947849,1530455833,4007360968,172466556,266959938,516552836,0,2256734592,3980931627,1890328081,1917742170,4294704398,945164165,3575528878,958871085,3647212047,2787207260,1423022939,775562294,1739656202,3876557655,2530391278,2443058075,3310321856,547512796,1265195639,437656594,3121275539,719700128,3762502690,387781147,218828297,3350065803,2830708150,2848461854,428169201,122466165,3720081049,1627235199,648017665,4122762354,1002783846,2117360635,695634755,3336358691,4234721005,4049844452,3704280881,2232435299,574624663,287343814,612205898,1039717051,840019705,2708326185,793451934,821288114,1391201670,3822090177,376187827,3113855344,1224348052,1679968233,2361698556,1058709744,752375421,2431590963,1321699145,3519142200,2734591178,188127444,2177869557,3727205754,2384911031,3215212461,2648976442,2450346104,3432737375,1180849278,331544205,3102249176,4150144569,2952102595,2159976285,2474404304,766078933,313773861,2570832044,2108100632,1668212892,3145456443,2013908262,418672217,3070356634,2594734927,1852171925,3867060991,3473416636,3907448597,2614737639,919489135,164948639,2094410160,2997825956,590424639,2486224549,1723872674,3157750862,3399941250,3501252752,3625268135,2555048196,3673637356,1343127501,4130281361,3599595085,2957853679,1297403050,81781910,3051593425,2283490410,532201772,1367295589,3926170974,895287692,1953757831,1093597963,492483431,3528626907,1446242576,1192455638,1636604631,209336225,344873464,1015671571,669961897,3375740769,3857572124,2973530695,3747192018,1933530610,3464042516,935293895,3454686199,2858115069,1863638845,3683022916,4085369519,3292445032,875313188,1080017571,3279033885,621591778,1233856572,2504130317,24197544,3017672716,3835484340,3247465558,2220981195,3060847922,1551124588,1463996600],qo=[4104605777,1097159550,396673818,660510266,2875968315,2638606623,4200115116,3808662347,821712160,1986918061,3430322568,38544885,3856137295,718002117,893681702,1654886325,2975484382,3122358053,3926825029,4274053469,796197571,1290801793,1184342925,3556361835,2405426947,2459735317,1836772287,1381620373,3196267988,1948373848,3764988233,3385345166,3263785589,2390325492,1480485785,3111247143,3780097726,2293045232,548169417,3459953789,3746175075,439452389,1362321559,1400849762,1685577905,1806599355,2174754046,137073913,1214797936,1174215055,3731654548,2079897426,1943217067,1258480242,529487843,1437280870,3945269170,3049390895,3313212038,923313619,679998e3,3215307299,57326082,377642221,3474729866,2041877159,133361907,1776460110,3673476453,96392454,878845905,2801699524,777231668,4082475170,2330014213,4142626212,2213296395,1626319424,1906247262,1846563261,562755902,3708173718,1040559837,3871163981,1418573201,3294430577,114585348,1343618912,2566595609,3186202582,1078185097,3651041127,3896688048,2307622919,425408743,3371096953,2081048481,1108339068,2216610296,0,2156299017,736970802,292596766,1517440620,251657213,2235061775,2933202493,758720310,265905162,1554391400,1532285339,908999204,174567692,1474760595,4002861748,2610011675,3234156416,3693126241,2001430874,303699484,2478443234,2687165888,585122620,454499602,151849742,2345119218,3064510765,514443284,4044981591,1963412655,2581445614,2137062819,19308535,1928707164,1715193156,4219352155,1126790795,600235211,3992742070,3841024952,836553431,1669664834,2535604243,3323011204,1243905413,3141400786,4180808110,698445255,2653899549,2989552604,2253581325,3252932727,3004591147,1891211689,2487810577,3915653703,4237083816,4030667424,2100090966,865136418,1229899655,953270745,3399679628,3557504664,4118925222,2061379749,3079546586,2915017791,983426092,2022837584,1607244650,2118541908,2366882550,3635996816,972512814,3283088770,1568718495,3499326569,3576539503,621982671,2895723464,410887952,2623762152,1002142683,645401037,1494807662,2595684844,1335535747,2507040230,4293295786,3167684641,367585007,3885750714,1865862730,2668221674,2960971305,2763173681,1059270954,2777952454,2724642869,1320957812,2194319100,2429595872,2815956275,77089521,3973773121,3444575871,2448830231,1305906550,4021308739,2857194700,2516901860,3518358430,1787304780,740276417,1699839814,1592394909,2352307457,2272556026,188821243,1729977011,3687994002,274084841,3594982253,3613494426,2701949495,4162096729,322734571,2837966542,1640576439,484830689,1202797690,3537852828,4067639125,349075736,3342319475,4157467219,4255800159,1030690015,1155237496,2951971274,1757691577,607398968,2738905026,499347990,3794078908,1011452712,227885567,2818666809,213114376,3034881240,1455525988,3414450555,850817237,1817998408,3092726480],zo=[0,235474187,470948374,303765277,941896748,908933415,607530554,708780849,1883793496,2118214995,1817866830,1649639237,1215061108,1181045119,1417561698,1517767529,3767586992,4003061179,4236429990,4069246893,3635733660,3602770327,3299278474,3400528769,2430122216,2664543715,2362090238,2193862645,2835123396,2801107407,3035535058,3135740889,3678124923,3576870512,3341394285,3374361702,3810496343,3977675356,4279080257,4043610186,2876494627,2776292904,3076639029,3110650942,2472011535,2640243204,2403728665,2169303058,1001089995,899835584,666464733,699432150,59727847,226906860,530400753,294930682,1273168787,1172967064,1475418501,1509430414,1942435775,2110667444,1876241833,1641816226,2910219766,2743034109,2976151520,3211623147,2505202138,2606453969,2302690252,2269728455,3711829422,3543599269,3240894392,3475313331,3843699074,3943906441,4178062228,4144047775,1306967366,1139781709,1374988112,1610459739,1975683434,2076935265,1775276924,1742315127,1034867998,866637845,566021896,800440835,92987698,193195065,429456164,395441711,1984812685,2017778566,1784663195,1683407248,1315562145,1080094634,1383856311,1551037884,101039829,135050206,437757123,337553864,1042385657,807962610,573804783,742039012,2531067453,2564033334,2328828971,2227573024,2935566865,2700099354,3001755655,3168937228,3868552805,3902563182,4203181171,4102977912,3736164937,3501741890,3265478751,3433712980,1106041591,1340463100,1576976609,1408749034,2043211483,2009195472,1708848333,1809054150,832877231,1068351396,766945465,599762354,159417987,126454664,361929877,463180190,2709260871,2943682380,3178106961,3009879386,2572697195,2538681184,2236228733,2336434550,3509871135,3745345300,3441850377,3274667266,3910161971,3877198648,4110568485,4211818798,2597806476,2497604743,2261089178,2295101073,2733856160,2902087851,3202437046,2968011453,3936291284,3835036895,4136440770,4169408201,3535486456,3702665459,3467192302,3231722213,2051518780,1951317047,1716890410,1750902305,1113818384,1282050075,1584504582,1350078989,168810852,67556463,371049330,404016761,841739592,1008918595,775550814,540080725,3969562369,3801332234,4035489047,4269907996,3569255213,3669462566,3366754619,3332740144,2631065433,2463879762,2160117071,2395588676,2767645557,2868897406,3102011747,3069049960,202008497,33778362,270040487,504459436,875451293,975658646,675039627,641025152,2084704233,1917518562,1615861247,1851332852,1147550661,1248802510,1484005843,1451044056,933301370,967311729,733156972,632953703,260388950,25965917,328671808,496906059,1206477858,1239443753,1543208500,1441952575,2144161806,1908694277,1675577880,1842759443,3610369226,3644379585,3408119516,3307916247,4011190502,3776767469,4077384432,4245618683,2809771154,2842737049,3144396420,3043140495,2673705150,2438237621,2203032232,2370213795],Wo=[0,185469197,370938394,487725847,741876788,657861945,975451694,824852259,1483753576,1400783205,1315723890,1164071807,1950903388,2135319889,1649704518,1767536459,2967507152,3152976349,2801566410,2918353863,2631447780,2547432937,2328143614,2177544179,3901806776,3818836405,4270639778,4118987695,3299409036,3483825537,3535072918,3652904859,2077965243,1893020342,1841768865,1724457132,1474502543,1559041666,1107234197,1257309336,598438867,681933534,901210569,1052338372,261314535,77422314,428819965,310463728,3409685355,3224740454,3710368113,3593056380,3875770207,3960309330,4045380933,4195456072,2471224067,2554718734,2237133081,2388260884,3212035895,3028143674,2842678573,2724322336,4138563181,4255350624,3769721975,3955191162,3667219033,3516619604,3431546947,3347532110,2933734917,2782082824,3099667487,3016697106,2196052529,2313884476,2499348523,2683765030,1179510461,1296297904,1347548327,1533017514,1786102409,1635502980,2087309459,2003294622,507358933,355706840,136428751,53458370,839224033,957055980,605657339,790073846,2373340630,2256028891,2607439820,2422494913,2706270690,2856345839,3075636216,3160175349,3573941694,3725069491,3273267108,3356761769,4181598602,4063242375,4011996048,3828103837,1033297158,915985419,730517276,545572369,296679730,446754879,129166120,213705253,1709610350,1860738147,1945798516,2029293177,1239331162,1120974935,1606591296,1422699085,4148292826,4233094615,3781033664,3931371469,3682191598,3497509347,3446004468,3328955385,2939266226,2755636671,3106780840,2988687269,2198438022,2282195339,2501218972,2652609425,1201765386,1286567175,1371368976,1521706781,1805211710,1620529459,2105887268,1988838185,533804130,350174575,164439672,46346101,870912086,954669403,636813900,788204353,2358957921,2274680428,2592523643,2441661558,2695033685,2880240216,3065962831,3182487618,3572145929,3756299780,3270937875,3388507166,4174560061,4091327024,4006521127,3854606378,1014646705,930369212,711349675,560487590,272786309,457992840,106852767,223377554,1678381017,1862534868,1914052035,2031621326,1211247597,1128014560,1580087799,1428173050,32283319,182621114,401639597,486441376,768917123,651868046,1003007129,818324884,1503449823,1385356242,1333838021,1150208456,1973745387,2125135846,1673061617,1756818940,2970356327,3120694122,2802849917,2887651696,2637442643,2520393566,2334669897,2149987652,3917234703,3799141122,4284502037,4100872472,3309594171,3460984630,3545789473,3629546796,2050466060,1899603969,1814803222,1730525723,1443857720,1560382517,1075025698,1260232239,575138148,692707433,878443390,1062597235,243256656,91341917,409198410,325965383,3403100636,3252238545,3704300486,3620022987,3874428392,3990953189,4042459122,4227665663,2460449204,2578018489,2226875310,2411029155,3198115200,3046200461,2827177882,2743944855],Jo=[0,218828297,437656594,387781147,875313188,958871085,775562294,590424639,1750626376,1699970625,1917742170,2135253587,1551124588,1367295589,1180849278,1265195639,3501252752,3720081049,3399941250,3350065803,3835484340,3919042237,4270507174,4085369519,3102249176,3051593425,2734591178,2952102595,2361698556,2177869557,2530391278,2614737639,3145456443,3060847922,2708326185,2892417312,2404901663,2187128086,2504130317,2555048196,3542330227,3727205754,3375740769,3292445032,3876557655,3926170974,4246310725,4027744588,1808481195,1723872674,1910319033,2094410160,1608975247,1391201670,1173430173,1224348052,59984867,244860394,428169201,344873464,935293895,984907214,766078933,547512796,1844882806,1627235199,2011214180,2062270317,1507497298,1423022939,1137477952,1321699145,95345982,145085239,532201772,313773861,830661914,1015671571,731183368,648017665,3175501286,2957853679,2807058932,2858115069,2305455554,2220981195,2474404304,2658625497,3575528878,3625268135,3473416636,3254988725,3778151818,3963161475,4213447064,4130281361,3599595085,3683022916,3432737375,3247465558,3802222185,4020912224,4172763771,4122762354,3201631749,3017672716,2764249623,2848461854,2331590177,2280796200,2431590963,2648976442,104699613,188127444,472615631,287343814,840019705,1058709744,671593195,621591778,1852171925,1668212892,1953757831,2037970062,1514790577,1463996600,1080017571,1297403050,3673637356,3623636965,3235995134,3454686199,4007360968,3822090177,4107101658,4190530515,2997825956,3215212461,2830708150,2779915199,2256734592,2340947849,2627016082,2443058075,172466556,122466165,273792366,492483431,1047239e3,861968209,612205898,695634755,1646252340,1863638845,2013908262,1963115311,1446242576,1530455833,1277555970,1093597963,1636604631,1820824798,2073724613,1989249228,1436590835,1487645946,1337376481,1119727848,164948639,81781910,331544205,516552836,1039717051,821288114,669961897,719700128,2973530695,3157750862,2871682645,2787207260,2232435299,2283490410,2667994737,2450346104,3647212047,3564045318,3279033885,3464042516,3980931627,3762502690,4150144569,4199882800,3070356634,3121275539,2904027272,2686254721,2200818878,2384911031,2570832044,2486224549,3747192018,3528626907,3310321856,3359936201,3950355702,3867060991,4049844452,4234721005,1739656202,1790575107,2108100632,1890328081,1402811438,1586903591,1233856572,1149249077,266959938,48394827,369057872,418672217,1002783846,919489135,567498868,752375421,209336225,24197544,376187827,459744698,945164165,895287692,574624663,793451934,1679968233,1764313568,2117360635,1933530610,1343127501,1560637892,1243112415,1192455638,3704280881,3519142200,3336358691,3419915562,3907448597,3857572124,4075877127,4294704398,3029510009,3113855344,2927934315,2744104290,2159976285,2377486676,2594734927,2544078150],Xo=[0,151849742,303699484,454499602,607398968,758720310,908999204,1059270954,1214797936,1097159550,1517440620,1400849762,1817998408,1699839814,2118541908,2001430874,2429595872,2581445614,2194319100,2345119218,3034881240,3186202582,2801699524,2951971274,3635996816,3518358430,3399679628,3283088770,4237083816,4118925222,4002861748,3885750714,1002142683,850817237,698445255,548169417,529487843,377642221,227885567,77089521,1943217067,2061379749,1640576439,1757691577,1474760595,1592394909,1174215055,1290801793,2875968315,2724642869,3111247143,2960971305,2405426947,2253581325,2638606623,2487810577,3808662347,3926825029,4044981591,4162096729,3342319475,3459953789,3576539503,3693126241,1986918061,2137062819,1685577905,1836772287,1381620373,1532285339,1078185097,1229899655,1040559837,923313619,740276417,621982671,439452389,322734571,137073913,19308535,3871163981,4021308739,4104605777,4255800159,3263785589,3414450555,3499326569,3651041127,2933202493,2815956275,3167684641,3049390895,2330014213,2213296395,2566595609,2448830231,1305906550,1155237496,1607244650,1455525988,1776460110,1626319424,2079897426,1928707164,96392454,213114376,396673818,514443284,562755902,679998e3,865136418,983426092,3708173718,3557504664,3474729866,3323011204,4180808110,4030667424,3945269170,3794078908,2507040230,2623762152,2272556026,2390325492,2975484382,3092726480,2738905026,2857194700,3973773121,3856137295,4274053469,4157467219,3371096953,3252932727,3673476453,3556361835,2763173681,2915017791,3064510765,3215307299,2156299017,2307622919,2459735317,2610011675,2081048481,1963412655,1846563261,1729977011,1480485785,1362321559,1243905413,1126790795,878845905,1030690015,645401037,796197571,274084841,425408743,38544885,188821243,3613494426,3731654548,3313212038,3430322568,4082475170,4200115116,3780097726,3896688048,2668221674,2516901860,2366882550,2216610296,3141400786,2989552604,2837966542,2687165888,1202797690,1320957812,1437280870,1554391400,1669664834,1787304780,1906247262,2022837584,265905162,114585348,499347990,349075736,736970802,585122620,972512814,821712160,2595684844,2478443234,2293045232,2174754046,3196267988,3079546586,2895723464,2777952454,3537852828,3687994002,3234156416,3385345166,4142626212,4293295786,3841024952,3992742070,174567692,57326082,410887952,292596766,777231668,660510266,1011452712,893681702,1108339068,1258480242,1343618912,1494807662,1715193156,1865862730,1948373848,2100090966,2701949495,2818666809,3004591147,3122358053,2235061775,2352307457,2535604243,2653899549,3915653703,3764988233,4219352155,4067639125,3444575871,3294430577,3746175075,3594982253,836553431,953270745,600235211,718002117,367585007,484830689,133361907,251657213,2041877159,1891211689,1806599355,1654886325,1568718495,1418573201,1335535747,1184342925];function Qo(e){const t=[];for(let r=0;r<e.length;r+=4)t.push(e[r]<<24|e[r+1]<<16|e[r+2]<<8|e[r+3]);return t}class Zo{get key(){return Uo(this,Po,"f").slice()}constructor(e){if(Po.set(this,void 0),Lo.set(this,void 0),Do.set(this,void 0),!(this instanceof Zo))throw Error("AES must be instanitated with `new`");xo(this,Po,new Uint8Array(e),"f");const t=Go[this.key.length];if(null==t)throw new TypeError("invalid key size (must be 16, 24 or 32 bytes)");xo(this,Do,[],"f"),xo(this,Lo,[],"f");for(let e=0;e<=t;e++)Uo(this,Do,"f").push([0,0,0,0]),Uo(this,Lo,"f").push([0,0,0,0]);const r=4*(t+1),n=this.key.length/4,o=Qo(this.key);let i;for(let e=0;e<n;e++)i=e>>2,Uo(this,Do,"f")[i][e%4]=o[e],Uo(this,Lo,"f")[t-i][e%4]=o[e];let s,a=0,c=n;for(;c<r;){if(s=o[n-1],o[0]^=Fo[s>>16&255]<<24^Fo[s>>8&255]<<16^Fo[255&s]<<8^Fo[s>>24&255]^ko[a]<<24,a+=1,8!=n)for(let e=1;e<n;e++)o[e]^=o[e-1];else{for(let e=1;e<n/2;e++)o[e]^=o[e-1];s=o[n/2-1],o[n/2]^=Fo[255&s]^Fo[s>>8&255]<<8^Fo[s>>16&255]<<16^Fo[s>>24&255]<<24;for(let e=n/2+1;e<n;e++)o[e]^=o[e-1]}let e,i,u=0;for(;u<n&&c<r;)e=c>>2,i=c%4,Uo(this,Do,"f")[e][i]=o[u],Uo(this,Lo,"f")[t-e][i]=o[u++],c++}for(let e=1;e<t;e++)for(let t=0;t<4;t++)s=Uo(this,Lo,"f")[e][t],Uo(this,Lo,"f")[e][t]=zo[s>>24&255]^Wo[s>>16&255]^Jo[s>>8&255]^Xo[255&s]}encrypt(e){if(16!=e.length)throw new TypeError("invalid plaintext size (must be 16 bytes)");const t=Uo(this,Do,"f").length-1,r=[0,0,0,0];let n=Qo(e);for(let e=0;e<4;e++)n[e]^=Uo(this,Do,"f")[0][e];for(let e=1;e<t;e++){for(let t=0;t<4;t++)r[t]=Mo[n[t]>>24&255]^jo[n[(t+1)%4]>>16&255]^Ko[n[(t+2)%4]>>8&255]^$o[255&n[(t+3)%4]]^Uo(this,Do,"f")[e][t];n=r.slice()}const o=new Uint8Array(16);let i=0;for(let e=0;e<4;e++)i=Uo(this,Do,"f")[t][e],o[4*e]=255&(Fo[n[e]>>24&255]^i>>24),o[4*e+1]=255&(Fo[n[(e+1)%4]>>16&255]^i>>16),o[4*e+2]=255&(Fo[n[(e+2)%4]>>8&255]^i>>8),o[4*e+3]=255&(Fo[255&n[(e+3)%4]]^i);return o}decrypt(e){if(16!=e.length)throw new TypeError("invalid ciphertext size (must be 16 bytes)");const t=Uo(this,Lo,"f").length-1,r=[0,0,0,0];let n=Qo(e);for(let e=0;e<4;e++)n[e]^=Uo(this,Lo,"f")[0][e];for(let e=1;e<t;e++){for(let t=0;t<4;t++)r[t]=Vo[n[t]>>24&255]^Ho[n[(t+3)%4]>>16&255]^Yo[n[(t+2)%4]>>8&255]^qo[255&n[(t+1)%4]]^Uo(this,Lo,"f")[e][t];n=r.slice()}const o=new Uint8Array(16);let i=0;for(let e=0;e<4;e++)i=Uo(this,Lo,"f")[t][e],o[4*e]=255&(Bo[n[e]>>24&255]^i>>24),o[4*e+1]=255&(Bo[n[(e+3)%4]>>16&255]^i>>16),o[4*e+2]=255&(Bo[n[(e+2)%4]>>8&255]^i>>8),o[4*e+3]=255&(Bo[255&n[(e+1)%4]]^i);return o}}Po=new WeakMap,Lo=new WeakMap,Do=new WeakMap;class ei{constructor(e,t,r){if(r&&!(this instanceof r))throw new Error(`${e} must be instantiated with "new"`);Object.defineProperties(this,{aes:{enumerable:!0,value:new Zo(t)},name:{enumerable:!0,value:e}})}}var ti,ri,ni=function(e,t,r,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(e,r):o?o.value=r:t.set(e,r),r},oi=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};class ii extends ei{constructor(e,t){if(super("ECC",e,ii),ti.set(this,void 0),ri.set(this,void 0),t){if(t.length%16)throw new TypeError("invalid iv size (must be 16 bytes)");ni(this,ti,new Uint8Array(t),"f")}else ni(this,ti,new Uint8Array(16),"f");ni(this,ri,this.iv,"f")}get iv(){return new Uint8Array(oi(this,ti,"f"))}encrypt(e){if(e.length%16)throw new TypeError("invalid plaintext size (must be multiple of 16 bytes)");const t=new Uint8Array(e.length);for(let r=0;r<e.length;r+=16){for(let t=0;t<16;t++)oi(this,ri,"f")[t]^=e[r+t];ni(this,ri,this.aes.encrypt(oi(this,ri,"f")),"f"),t.set(oi(this,ri,"f"),r)}return t}decrypt(e){if(e.length%16)throw new TypeError("invalid ciphertext size (must be multiple of 16 bytes)");const t=new Uint8Array(e.length);for(let r=0;r<e.length;r+=16){const n=this.aes.decrypt(e.subarray(r,r+16));for(let o=0;o<16;o++)t[r+o]=n[o]^oi(this,ri,"f")[o],oi(this,ri,"f")[o]=e[r+o]}return t}}ti=new WeakMap,ri=new WeakMap;var si,ai=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};new WeakMap,si=new WeakMap,new WeakSet;var ci,ui,li,fi=function(e,t,r,n,o){if("m"===n)throw new TypeError("Private method is not writable");if("a"===n&&!o)throw new TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!o:!t.has(e))throw new TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?o.call(e,r):o?o.value=r:t.set(e,r),r},hi=function(e,t,r,n){if("a"===r&&!n)throw new TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw new TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)};class di extends ei{constructor(e,t){super("CTR",e,di),ci.set(this,void 0),ui.set(this,void 0),li.set(this,void 0),fi(this,li,new Uint8Array(16),"f"),hi(this,li,"f").fill(0),fi(this,ci,hi(this,li,"f"),"f"),fi(this,ui,16,"f"),null==t&&(t=1),"number"==typeof t?this.setCounterValue(t):this.setCounterBytes(t)}get counter(){return new Uint8Array(hi(this,li,"f"))}setCounterValue(e){if(!Number.isInteger(e)||e<0||e>Number.MAX_SAFE_INTEGER)throw new TypeError("invalid counter initial integer value");for(let t=15;t>=0;--t)hi(this,li,"f")[t]=e%256,e=Math.floor(e/256)}setCounterBytes(e){if(16!==e.length)throw new TypeError("invalid counter initial Uint8Array value length");hi(this,li,"f").set(e)}increment(){for(let e=15;e>=0;e--){if(255!==hi(this,li,"f")[e]){hi(this,li,"f")[e]++;break}hi(this,li,"f")[e]=0}}encrypt(e){var t,r;const n=new Uint8Array(e);for(let e=0;e<n.length;e++)16===hi(this,ui,"f")&&(fi(this,ci,this.aes.encrypt(hi(this,li,"f")),"f"),fi(this,ui,0,"f"),this.increment()),n[e]^=hi(this,ci,"f")[(fi(this,ui,(r=hi(this,ui,"f"),t=r++,r),"f"),t)];return n}decrypt(e){return this.encrypt(e)}}ci=new WeakMap,ui=new WeakMap,li=new WeakMap;new WeakMap,new WeakMap,new WeakMap;const pi=(e,t)=>e<<t|e>>>32-t;function gi(e,t,r,n,o,i){let s=e[t++]^r[n++],a=e[t++]^r[n++],c=e[t++]^r[n++],u=e[t++]^r[n++],l=e[t++]^r[n++],f=e[t++]^r[n++],h=e[t++]^r[n++],d=e[t++]^r[n++],p=e[t++]^r[n++],g=e[t++]^r[n++],y=e[t++]^r[n++],m=e[t++]^r[n++],E=e[t++]^r[n++],b=e[t++]^r[n++],v=e[t++]^r[n++],O=e[t++]^r[n++],I=s,S=a,w=c,A=u,R=l,T=f,_=h,N=d,C=p,P=g,L=y,D=m,U=E,x=b,G=v,k=O;for(let e=0;e<8;e+=2)R^=pi(I+U|0,7),C^=pi(R+I|0,9),U^=pi(C+R|0,13),I^=pi(U+C|0,18),P^=pi(T+S|0,7),x^=pi(P+T|0,9),S^=pi(x+P|0,13),T^=pi(S+x|0,18),G^=pi(L+_|0,7),w^=pi(G+L|0,9),_^=pi(w+G|0,13),L^=pi(_+w|0,18),A^=pi(k+D|0,7),N^=pi(A+k|0,9),D^=pi(N+A|0,13),k^=pi(D+N|0,18),S^=pi(I+A|0,7),w^=pi(S+I|0,9),A^=pi(w+S|0,13),I^=pi(A+w|0,18),_^=pi(T+R|0,7),N^=pi(_+T|0,9),R^=pi(N+_|0,13),T^=pi(R+N|0,18),D^=pi(L+P|0,7),C^=pi(D+L|0,9),P^=pi(C+D|0,13),L^=pi(P+C|0,18),U^=pi(k+G|0,7),x^=pi(U+k|0,9),G^=pi(x+U|0,13),k^=pi(G+x|0,18);o[i++]=s+I|0,o[i++]=a+S|0,o[i++]=c+w|0,o[i++]=u+A|0,o[i++]=l+R|0,o[i++]=f+T|0,o[i++]=h+_|0,o[i++]=d+N|0,o[i++]=p+C|0,o[i++]=g+P|0,o[i++]=y+L|0,o[i++]=m+D|0,o[i++]=E+U|0,o[i++]=b+x|0,o[i++]=v+G|0,o[i++]=O+k|0}function yi(e,t,r,n,o){let i=n+0,s=n+16*o;for(let n=0;n<16;n++)r[s+n]=e[t+16*(2*o-1)+n];for(let n=0;n<o;n++,i+=16,t+=16)gi(r,s,e,t,r,i),n>0&&(s+=16),gi(r,i,e,t+=16,r,s)}function mi(e,r,n){const o=T({dkLen:32,asyncTick:10,maxmem:1073742848},n),{N:i,r:s,p:a,dkLen:c,asyncTick:u,maxmem:l,onProgress:f}=o;if(t(i),t(s),t(a),t(c),t(u),t(l),void 0!==f&&"function"!=typeof f)throw new Error("progressCb should be function");const h=128*s,d=h/4;if(i<=1||i&i-1||i>=2**(h/8)||i>2**32)throw new Error("Scrypt: N must be larger than 1, a power of 2, less than 2^(128 * r / 8) and less than 2^32");if(a<0||a>137438953440/h)throw new Error("Scrypt: p must be a positive integer less than or equal to ((2^32 - 1) * 32) / (128 * r)");if(c<0||c>137438953440)throw new Error("Scrypt: dkLen should be positive integer less than or equal to (2^32 - 1) * 32");const p=h*(i+a);if(p>l)throw new Error(`Scrypt: parameters too large, ${p} (128 * r * (N + p)) > ${l} (maxmem)`);const g=Gr(Re,e,r,{c:1,dkLen:h*a}),y=b(g),m=b(new Uint8Array(h*i)),E=b(new Uint8Array(h));let v=()=>{};if(f){const e=2*i*a,t=Math.max(Math.floor(e/1e4),1);let r=0;v=()=>{r++,!f||r%t&&r!==e||f(r/e)}}return{N:i,r:s,p:a,dkLen:c,blockSize32:d,V:m,B32:y,B:g,tmp:E,blockMixCb:v,asyncTick:u}}function Ei(e,t,r,n,o){const i=Gr(Re,e,r,{c:1,dkLen:t});return r.fill(0),n.fill(0),o.fill(0),i}let bi=!1,vi=!1;const Oi=async function(e,t,r,n,o,i,s){return await async function(e,t,r){const{N:n,r:o,p:i,dkLen:s,blockSize32:a,V:c,B32:u,B:l,tmp:f,blockMixCb:h,asyncTick:d}=mi(e,t,r);for(let e=0;e<i;e++){const t=a*e;for(let e=0;e<a;e++)c[e]=u[t+e];let r=0;await S(n-1,d,()=>{yi(c,r,c,r+=a,o),h()}),yi(c,(n-1)*a,u,t,o),h(),await S(n,d,()=>{const e=u[t+a-16]%n;for(let r=0;r<a;r++)f[r]=u[t+r]^c[e*a+r];yi(f,0,u,t,o),h()})}return Ei(e,s,l,c,f)}(e,t,{N:r,r:n,p:o,dkLen:i,onProgress:s})},Ii=function(e,t,r,n,o,i){return function(e,t,r){const{N:n,r:o,p:i,dkLen:s,blockSize32:a,V:c,B32:u,B:l,tmp:f,blockMixCb:h}=mi(e,t,r);for(let e=0;e<i;e++){const t=a*e;for(let e=0;e<a;e++)c[e]=u[t+e];for(let e=0,t=0;e<n-1;e++)yi(c,t,c,t+=a,o),h();yi(c,(n-1)*a,u,t,o),h();for(let e=0;e<n;e++){const e=u[t+a-16]%n;for(let r=0;r<a;r++)f[r]=u[t+r]^c[e*a+r];yi(f,0,u,t,o),h()}}return Ei(e,s,l,c,f)}(e,t,{N:r,r:n,p:o,dkLen:i})};let Si=Oi,wi=Ii;async function Ai(e,t,r,n,o,i,s){const a=oe(e,"passwd"),c=oe(t,"salt");return ue(await Si(a,c,r,n,o,i,s))}function Ri(e,t,r,n,o,i){const s=oe(e,"passwd"),a=oe(t,"salt");return ue(wi(s,a,r,n,o,i))}function Ti(e){const t=oe(e,"randomBytes");t[6]=15&t[6]|64,t[8]=63&t[8]|128;const r=ue(t);return[r.substring(2,10),r.substring(10,14),r.substring(14,18),r.substring(18,22),r.substring(22,34)].join("-")}function _i(e){return"string"!=typeof e||e.startsWith("0x")||(e="0x"+e),ie(e)}function Ni(e,t){for(e=String(e);e.length<t;)e="0"+e;return e}function Ci(e){return"string"==typeof e?lr(e,"NFKC"):ie(e)}function Pi(e,t){const r=t.match(/^([a-z0-9$_.-]*)(:([a-z]+))?(!)?$/i);Z(null!=r,"invalid path","path",t);const n=r[1],o=r[3],i="!"===r[4];let s=e;for(const e of n.toLowerCase().split(".")){if(Array.isArray(s)){if(!e.match(/^[0-9]+$/))break;s=s[parseInt(e)]}else if("object"==typeof s){let t=null;for(const r in s)if(r.toLowerCase()===e){t=s[r];break}s=t}else s=null;if(null==s)break}if(Z(!i||null!=s,"missing required value","path",n),o&&null!=s){if("int"===o){if("string"==typeof s&&s.match(/^-?[0-9]+$/))return parseInt(s);if(Number.isSafeInteger(s))return s}if("number"===o&&"string"==typeof s&&s.match(/^-?[0-9.]*$/))return parseFloat(s);if("data"===o&&"string"==typeof s)return _i(s);if("array"===o&&Array.isArray(s))return s;if(o===typeof s)return s;Z(!1,`wrong type found for ${o} `,"path",n)}return s}Ai._=Oi,Ai.lock=function(){vi=!0},Ai.register=function(e){if(vi)throw new Error("scrypt is locked");Si=e},Object.freeze(Ai),Ri._=Ii,Ri.lock=function(){bi=!0},Ri.register=function(e){if(bi)throw new Error("scryptSync is locked");wi=e},Object.freeze(Ri);const Li="m/44'/60'/0'/0/0";function Di(e){try{const t=JSON.parse(e);if(3===(null!=t.version?parseInt(t.version):0))return!0}catch(e){}return!1}function Ui(e,t){const r=oe(t),n=Pi(e,"crypto.ciphertext:data!");Z(ue(Ee(le([r.slice(16,32),n]))).substring(2)===Pi(e,"crypto.mac:string!").toLowerCase(),"incorrect password","password","[ REDACTED ]");const o=function(e,t,r){if("aes-128-ctr"===Pi(e,"crypto.cipher:string")){const n=Pi(e,"crypto.cipherparams.iv:data!");return ue(new di(t,n).decrypt(r))}Q(!1,"unsupported cipher","UNSUPPORTED_OPERATION",{operation:"decrypt"})}(e,r.slice(0,16),n),i=cn(o);if(e.address){let t=e.address.toLowerCase();t.startsWith("0x")||(t="0x"+t),Z(sr(t)===i,"keystore address/privateKey mismatch","address",e.address)}const s={address:i,privateKey:o};if("0.1"===Pi(e,"x-ethers.version:string")){const t=r.slice(32,64),n=Pi(e,"x-ethers.mnemonicCiphertext:data!"),o=Pi(e,"x-ethers.mnemonicCounter:data!"),i=new di(t,o);s.mnemonic={path:Pi(e,"x-ethers.path:string")||Li,locale:Pi(e,"x-ethers.locale:string")||"en",entropy:ue(oe(i.decrypt(n)))}}return s}function xi(e){const t=Pi(e,"crypto.kdf:string");if(t&&"string"==typeof t){if("scrypt"===t.toLowerCase()){const r=Pi(e,"crypto.kdfparams.salt:data!"),n=Pi(e,"crypto.kdfparams.n:int!"),o=Pi(e,"crypto.kdfparams.r:int!"),i=Pi(e,"crypto.kdfparams.p:int!");Z(n>0&&!(n&n-1),"invalid kdf.N","kdf.N",n),Z(o>0&&i>0,"invalid kdf","kdf",t);const s=Pi(e,"crypto.kdfparams.dklen:int!");return Z(32===s,"invalid kdf.dklen","kdf.dflen",s),{name:"scrypt",salt:r,N:n,r:o,p:i,dkLen:64}}if("pbkdf2"===t.toLowerCase()){const t=Pi(e,"crypto.kdfparams.salt:data!"),r=Pi(e,"crypto.kdfparams.prf:string!"),n=r.split("-").pop();Z("sha256"===n||"sha512"===n,"invalid kdf.pdf","kdf.pdf",r);const o=Pi(e,"crypto.kdfparams.c:int!"),i=Pi(e,"crypto.kdfparams.dklen:int!");return Z(32===i,"invalid kdf.dklen","kdf.dklen",i),{name:"pbkdf2",salt:t,count:o,dkLen:i,algorithm:n}}}Z(!1,"unsupported key-derivation function","kdf",t)}function Gi(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}function ki(e){const t=null!=e.salt?oe(e.salt,"options.salt"):so(32);let r=1<<17,n=8,o=1;return e.scrypt&&(e.scrypt.N&&(r=e.scrypt.N),e.scrypt.r&&(n=e.scrypt.r),e.scrypt.p&&(o=e.scrypt.p)),Z("number"==typeof r&&r>0&&Number.isSafeInteger(r)&&(BigInt(r)&BigInt(r-1))===BigInt(0),"invalid scrypt N parameter","options.N",r),Z("number"==typeof n&&n>0&&Number.isSafeInteger(n),"invalid scrypt r parameter","options.r",n),Z("number"==typeof o&&o>0&&Number.isSafeInteger(o),"invalid scrypt p parameter","options.p",o),{name:"scrypt",dkLen:32,salt:t,N:r,r:n,p:o}}function Fi(e,t,r,n){const o=oe(r.privateKey,"privateKey"),i=null!=n.iv?oe(n.iv,"options.iv"):so(16);Z(16===i.length,"invalid options.iv length","options.iv",n.iv);const s=null!=n.uuid?oe(n.uuid,"options.uuid"):so(16);Z(16===s.length,"invalid options.uuid length","options.uuid",n.iv);const a=e.slice(0,16),c=e.slice(16,32),u=oe(new di(a,i).encrypt(o)),l=Ee(le([c,u])),f={address:r.address.substring(2).toLowerCase(),id:Ti(s),version:3,Crypto:{cipher:"aes-128-ctr",cipherparams:{iv:ue(i).substring(2)},ciphertext:ue(u).substring(2),kdf:"scrypt",kdfparams:{salt:ue(t.salt).substring(2),n:t.N,dklen:32,p:t.p,r:t.r},mac:l.substring(2)}};if(r.mnemonic){const t=null!=n.client?n.client:`ethers/${Y}`,o=r.mnemonic.path||Li,i=r.mnemonic.locale||"en",s=e.slice(32,64),a=oe(r.mnemonic.entropy,"account.mnemonic.entropy"),c=so(16),u=oe(new di(s,c).encrypt(a)),l=new Date,h="UTC--"+(l.getUTCFullYear()+"-"+Ni(l.getUTCMonth()+1,2)+"-"+Ni(l.getUTCDate(),2)+"T"+Ni(l.getUTCHours(),2)+"-"+Ni(l.getUTCMinutes(),2)+"-"+Ni(l.getUTCSeconds(),2)+".0Z")+"--"+f.address;f["x-ethers"]={client:t,gethFilename:h,path:o,locale:i,mnemonicCounter:ue(c).substring(2),mnemonicCiphertext:ue(u).substring(2),version:"0.1"}}return JSON.stringify(f)}function Bi(e,t,r){null==r&&(r={});const n=Ci(t),o=ki(r);return Fi(oe(Ri(n,o.salt,o.N,o.r,o.p,64)),o,e,r)}async function Mi(e,t,r){null==r&&(r={});const n=Ci(t),o=ki(r);return Fi(oe(await Ai(n,o.salt,o.N,o.r,o.p,64,r.progressCallback)),o,e,r)}const ji="m/44'/60'/0'/0/0",Ki=new Uint8Array([66,105,116,99,111,105,110,32,115,101,101,100]),$i=2147483648,Vi=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141");function Hi(e,t){let r="";for(;e;)r="0123456789abcdef"[e%16]+r,e=Math.trunc(e/16);for(;r.length<2*t;)r="0"+r;return"0x"+r}function Yi(e){const t=oe(e);return function(e){const t=oe(e);let r=Gt(t),n="";for(;r;)n=ao[Number(r%fo)]+n,r/=fo;for(let e=0;e<t.length&&!t[e];e++)n=ao[0]+n;return n}(le([t,he(Qr(Qr(t)),0,4)]))}const qi={};function zi(e,t,r,n){const o=new Uint8Array(37);e&$i?(Q(null!=n,"cannot derive child of neutered node","UNSUPPORTED_OPERATION",{operation:"deriveChild"}),o.set(oe(n),1)):o.set(oe(r));for(let t=24;t>=0;t-=8)o[33+(t>>3)]=e>>24-t&255;const i=oe(Fn("sha512",t,o));return{IL:i.slice(0,32),IR:i.slice(32)}}function Wi(e,t){const r=t.split("/");Z(r.length>0,"invalid path","path",t),"m"===r[0]&&(Z(0===e.depth,`cannot derive root path (i.e. path starting with "m/") for a node at non-zero depth ${e.depth}`,"path",t),r.shift());let n=e;for(let e=0;e<r.length;e++){const t=r[e];if(t.match(/^[0-9]+'$/)){const r=parseInt(t.substring(0,t.length-1));Z(r<$i,"invalid path index",`path[${e}]`,t),n=n.deriveChild($i+r)}else if(t.match(/^[0-9]+$/)){const r=parseInt(t);Z(r<$i,"invalid path index",`path[${e}]`,t),n=n.deriveChild(r)}else Z(!1,"invalid path component",`path[${e}]`,t)}return n}class Ji extends Un{publicKey;fingerprint;parentFingerprint;mnemonic;chainCode;path;index;depth;constructor(e,t,r,n,o,i,s,a,c){super(t,c),re(e,qi,"HDNodeWallet"),W(this,{publicKey:t.compressedPublicKey});W(this,{parentFingerprint:r,fingerprint:he(ro(Qr(this.publicKey)),0,4),chainCode:n,path:o,index:i,depth:s}),W(this,{mnemonic:a})}connect(e){return new Ji(qi,this.signingKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,this.mnemonic,e)}#D(){const e={address:this.address,privateKey:this.privateKey},t=this.mnemonic;return this.path&&t&&"en"===t.wordlist.locale&&""===t.password&&(e.mnemonic={path:this.path,locale:"en",entropy:t.entropy}),e}async encrypt(e,t){return await Mi(this.#D(),e,{progressCallback:t})}encryptSync(e){return Bi(this.#D(),e)}get extendedKey(){return Q(this.depth<256,"Depth too deep","UNSUPPORTED_OPERATION",{operation:"extendedKey"}),Yi(le(["0x0488ADE4",Hi(this.depth,1),this.parentFingerprint,Hi(this.index,4),this.chainCode,le(["0x00",this.privateKey])]))}hasPath(){return null!=this.path}neuter(){return new Xi(qi,this.address,this.publicKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,this.provider)}deriveChild(e){const t=kt(e,"index");Z(t<=4294967295,"invalid index","index",t);let r=this.path;r&&(r+="/"+(2147483647&t),t&$i&&(r+="'"));const{IR:n,IL:o}=zi(t,this.chainCode,this.publicKey,this.privateKey),i=new Zt(Ft((Gt(o)+BigInt(this.privateKey))%Vi,32));return new Ji(qi,i,this.fingerprint,ue(n),r,t,this.depth+1,this.mnemonic,this.provider)}derivePath(e){return Wi(this,e)}static#U(e,t){Z(ae(e),"invalid seed","seed","[REDACTED]");const r=oe(e,"seed");Z(r.length>=16&&r.length<=64,"invalid seed","seed","[REDACTED]");const n=oe(Fn("sha512",Ki,r)),o=new Zt(ue(n.slice(0,32)));return new Ji(qi,o,"0x00000000",ue(n.slice(32)),"m",0,0,t,null)}static fromExtendedKey(e){const t=Bt(function(e){let t=lo;for(let r=0;r<e.length;r++)t*=fo,t+=uo(e[r]);return t}(e));Z(82===t.length||Yi(t.slice(0,78))===e,"invalid extended key","extendedKey","[ REDACTED ]");const r=t[4],n=ue(t.slice(5,9)),o=parseInt(ue(t.slice(9,13)).substring(2),16),i=ue(t.slice(13,45)),s=t.slice(45,78);switch(ue(t.slice(0,4))){case"0x0488b21e":case"0x043587cf":{const e=ue(s);return new Xi(qi,cn(e),e,n,i,null,o,r,null)}case"0x0488ade4":case"0x04358394 ":if(0!==s[0])break;return new Ji(qi,new Zt(s.slice(1)),n,i,null,o,r,null,null)}Z(!1,"invalid extended key prefix","extendedKey","[ REDACTED ]")}static createRandom(e,t,r){null==e&&(e=""),null==t&&(t=ji),null==r&&(r=vo.wordlist());const n=Co.fromEntropy(so(16),e,r);return Ji.#U(n.computeSeed(),n).derivePath(t)}static fromMnemonic(e,t){return t||(t=ji),Ji.#U(e.computeSeed(),e).derivePath(t)}static fromPhrase(e,t,r,n){null==t&&(t=""),null==r&&(r=ji),null==n&&(n=vo.wordlist());const o=Co.fromPhrase(e,t,n);return Ji.#U(o.computeSeed(),o).derivePath(r)}static fromSeed(e){return Ji.#U(e,null)}}class Xi extends Dn{publicKey;fingerprint;parentFingerprint;chainCode;path;index;depth;constructor(e,t,r,n,o,i,s,a,c){super(t,c),re(e,qi,"HDNodeVoidWallet"),W(this,{publicKey:r});W(this,{publicKey:r,fingerprint:he(ro(Qr(r)),0,4),parentFingerprint:n,chainCode:o,path:i,index:s,depth:a})}connect(e){return new Xi(qi,this.address,this.publicKey,this.parentFingerprint,this.chainCode,this.path,this.index,this.depth,e)}get extendedKey(){return Q(this.depth<256,"Depth too deep","UNSUPPORTED_OPERATION",{operation:"extendedKey"}),Yi(le(["0x0488B21E",Hi(this.depth,1),this.parentFingerprint,Hi(this.index,4),this.chainCode,this.publicKey]))}hasPath(){return null!=this.path}deriveChild(e){const t=kt(e,"index");Z(t<=4294967295,"invalid index","index",t);let r=this.path;r&&(r+="/"+(2147483647&t),t&$i&&(r+="'"));const{IR:n,IL:o}=zi(t,this.chainCode,this.publicKey,null),i=Zt.addPoints(o,this.publicKey,!0),s=cn(i);return new Xi(qi,s,i,this.fingerprint,ue(n),r,t,this.depth+1,this.provider)}derivePath(e){return Wi(this,e)}}function Qi(e){try{if(JSON.parse(e).encseed)return!0}catch(e){}return!1}function Zi(e,t){const r=JSON.parse(e),n=Ci(t),o=sr(Pi(r,"ethaddr:string!")),i=_i(Pi(r,"encseed:string!"));Z(i&&i.length%16==0,"invalid encseed","json",e);const s=oe(wo(n,n,2e3,32,"sha256")).slice(0,16),a=i.slice(0,16),c=i.slice(16),u=function(e){if(e.length<16)throw new TypeError("PKCS#7 invalid length");const t=e[e.length-1];if(t>16)throw new TypeError("PKCS#7 padding byte out of range");const r=e.length-t;for(let n=0;n<t;n++)if(e[r+n]!==t)throw new TypeError("PKCS#7 invalid padding byte");return new Uint8Array(e.subarray(0,r))}(oe(new ii(s,a).decrypt(c)));let l="";for(let e=0;e<u.length;e++)l+=String.fromCharCode(u[e]);return{address:o,privateKey:mr(l)}}function es(e){return new Promise(t=>{setTimeout(()=>{t()},e)})}class ts extends Un{constructor(e,t){"string"!=typeof e||e.startsWith("0x")||(e="0x"+e),super("string"==typeof e?new Zt(e):e,t)}connect(e){return new ts(this.signingKey,e)}async encrypt(e,t){const r={address:this.address,privateKey:this.privateKey};return await Mi(r,e,{progressCallback:t})}encryptSync(e){return Bi({address:this.address,privateKey:this.privateKey},e)}static#x(e){if(Z(e,"invalid JSON wallet","json","[ REDACTED ]"),"mnemonic"in e&&e.mnemonic&&"en"===e.mnemonic.locale){const t=Co.fromEntropy(e.mnemonic.entropy),r=Ji.fromMnemonic(t,e.mnemonic.path);if(r.address===e.address&&r.privateKey===e.privateKey)return r;console.log("WARNING: JSON mismatch address/privateKey != mnemonic; fallback onto private key")}const t=new ts(e.privateKey);return Z(t.address===e.address,"address/privateKey mismatch","json","[ REDACTED ]"),t}static async fromEncryptedJson(e,t,r){let n=null;return Di(e)?n=await async function(e,t,r){const n=JSON.parse(e),o=Ci(t),i=xi(n);if("pbkdf2"===i.name){r&&(r(0),await Gi(0));const{salt:e,count:t,dkLen:s,algorithm:a}=i,c=wo(o,e,t,s,a);return r&&(r(1),await Gi(0)),Ui(n,c)}Q("scrypt"===i.name,"cannot be reached","UNKNOWN_ERROR",{params:i});const{salt:s,N:a,r:c,p:u,dkLen:l}=i;return Ui(n,await Ai(o,s,a,c,u,l,r))}(e,t,r):Qi(e)&&(r&&(r(0),await es(0)),n=Zi(e,t),r&&(r(1),await es(0))),ts.#x(n)}static fromEncryptedJsonSync(e,t){let r=null;return Di(e)?r=function(e,t){const r=JSON.parse(e),n=Ci(t),o=xi(r);if("pbkdf2"===o.name){const{salt:e,count:t,dkLen:i,algorithm:s}=o;return Ui(r,wo(n,e,t,i,s))}Q("scrypt"===o.name,"cannot be reached","UNKNOWN_ERROR",{params:o});const{salt:i,N:s,r:a,p:c,dkLen:u}=o;return Ui(r,Ri(n,i,s,a,c,u))}(e,t):Qi(e)?r=Zi(e,t):Z(!1,"invalid JSON wallet","json","[ REDACTED ]"),ts.#x(r)}static createRandom(e){const t=Ji.createRandom();return e?t.connect(e):t}static fromPhrase(e,t){const r=Ji.fromPhrase(e);return t?r.connect(t):r}}var rs=r(455),ns=r(952),os=r(770);function is(e,t){var r="undefined"!=typeof Symbol&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=function(e,t){if(e){if("string"==typeof e)return ss(e,t);var r={}.toString.call(e).slice(8,-1);return"Object"===r&&e.constructor&&(r=e.constructor.name),"Map"===r||"Set"===r?Array.from(e):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ss(e,t):void 0}}(e))||t&&e&&"number"==typeof e.length){r&&(e=r);var n=0,o=function(){};return{s:o,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(e){throw e},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,s=!0,a=!1;return{s:function(){r=r.call(e)},n:function(){var e=r.next();return s=e.done,e},e:function(e){a=!0,i=e},f:function(){try{s||null==r.return||r.return()}finally{if(a)throw i}}}}function ss(e,t){(null==t||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function as(){/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/babel/babel/blob/main/packages/babel-helpers/LICENSE */var e,t,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var c=n&&n.prototype instanceof a?n:a,u=Object.create(c.prototype);return cs(u,"_invoke",function(r,n,o){var i,a,c,u=0,l=o||[],f=!1,h={p:0,n:0,v:e,a:d,f:d.bind(e,4),d:function(t,r){return i=t,a=0,c=e,h.n=r,s}};function d(r,n){for(a=r,c=n,t=0;!f&&u&&!o&&t<l.length;t++){var o,i=l[t],d=h.p,p=i[2];r>3?(o=p===n)&&(c=i[(a=i[4])?5:(a=3,3)],i[4]=i[5]=e):i[0]<=d&&((o=r<2&&d<i[1])?(a=0,h.v=n,h.n=i[1]):d<p&&(o=r<3||i[0]>n||n>p)&&(i[4]=r,i[5]=n,h.n=p,a=0))}if(o||r>1)return s;throw f=!0,n}return function(o,l,p){if(u>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,p),a=l,c=p;(t=a<2?e:c)||!f;){i||(a?a<3?(a>1&&(h.n=-1),d(a,c)):h.n=c:h.v=c);try{if(u=2,i){if(a||(o="next"),t=i[o]){if(!(t=t.call(i,c)))throw TypeError("iterator result is not an object");if(!t.done)return t;c=t.value,a<2&&(a=0)}else 1===a&&(t=i.return)&&t.call(i),a<2&&(c=TypeError("The iterator does not provide a '"+o+"' method"),a=1);i=e}else if((t=(f=h.n<0)?c:r.call(n,h))!==s)break}catch(t){i=e,a=1,c=t}finally{u=1}}return{value:t,done:f}}}(r,o,i),!0),u}var s={};function a(){}function c(){}function u(){}t=Object.getPrototypeOf;var l=[][n]?t(t([][n]())):(cs(t={},n,function(){return this}),t),f=u.prototype=a.prototype=Object.create(l);function h(e){return Object.setPrototypeOf?Object.setPrototypeOf(e,u):(e.__proto__=u,cs(e,o,"GeneratorFunction")),e.prototype=Object.create(f),e}return c.prototype=u,cs(f,"constructor",u),cs(u,"constructor",c),c.displayName="GeneratorFunction",cs(u,o,"GeneratorFunction"),cs(f),cs(f,o,"Generator"),cs(f,n,function(){return this}),cs(f,"toString",function(){return"[object Generator]"}),(as=function(){return{w:i,m:h}})()}function cs(e,t,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(e){o=0}cs=function(e,t,r,n){function i(t,r){cs(e,t,function(e){return this._invoke(t,r,e)})}t?o?o(e,t,{value:r,enumerable:!n,configurable:!n,writable:!n}):e[t]=r:(i("next",0),i("throw",1),i("return",2))},cs(e,t,r,n)}function us(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function ls(e){for(var t=1;t<arguments.length;t++){var r=null!=arguments[t]?arguments[t]:{};t%2?us(Object(r),!0).forEach(function(t){fs(e,t,r[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):us(Object(r)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(r,t))})}return e}function fs(e,t,r){return(t=ys(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function hs(e){return hs="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},hs(e)}function ds(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function ps(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,ys(n.key),n)}}function gs(e,t,r){return t&&ps(e.prototype,t),r&&ps(e,r),Object.defineProperty(e,"prototype",{writable:!1}),e}function ys(e){var t=function(e,t){if("object"!=hs(e)||!e)return e;var r=e[Symbol.toPrimitive];if(void 0!==r){var n=r.call(e,t||"default");if("object"!=hs(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return("string"===t?String:Number)(e)}(e,"string");return"symbol"==hs(t)?t:t+""}function ms(e,t,r,n,o,i,s){try{var a=e[i](s),c=a.value}catch(e){return void r(e)}a.done?t(c):Promise.resolve(c).then(n,o)}function Es(e){return function(){var t=this,r=arguments;return new Promise(function(n,o){var i=e.apply(t,r);function s(e){ms(i,n,o,s,a,"next",e)}function a(e){ms(i,n,o,s,a,"throw",e)}s(void 0)})}}var bs=[],vs=!1,Os="0.3.3";function Is(e){return new Promise(function(t,r){bs.push({task:e,resolve:t,reject:r}),Ss()})}function Ss(){return ws.apply(this,arguments)}function ws(){return(ws=Es(as().m(function e(){var t,r,n;return as().w(function(e){for(;;)switch(e.p=e.n){case 0:if(!vs){e.n=1;break}return e.a(2);case 1:if(t=bs.shift()){e.n=2;break}return e.a(2);case 2:return vs=!0,e.p=3,e.n=4,t.task();case 4:r=e.v,t.resolve(r),e.n=6;break;case 5:e.p=5,n=e.v,t.reject(n);case 6:return e.p=6,vs=!1,Ss(),e.f(6);case 7:return e.a(2)}},e,null,[[3,5,6,7]])}))).apply(this,arguments)}var As=function(){function e(t,r){var n,o=this,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};if(ds(this,e),this.applicationId=t,this.providerId=r,this.sessionId="",this.signature="",this.timestamp=Date.now().toString(),this.parameters={},this.context={contextAddress:"0x0",contextMessage:"sample context"},this.redirectUrl="",this.sdkVersion="ext-".concat(Os),this.resolvedProviderVersion="",this.jsonProofResponse=!1,this.extensionID=i.extensionID||"",this.providerVersion=i.providerVersion||"",this.acceptAiProviders=!!i.acceptAiProviders,this.callbackUrl=i.callbackUrl||"",this._backgroundInitialized=!1,this._ctx=null,this._listeners={started:new Set,completed:new Set,error:new Set,progress:new Set},this._boundWindowListener=this._handleWindowMessage.bind(this),window.addEventListener("message",this._boundWindowListener),this._mode="undefined"!=typeof chrome&&chrome.runtime&&"chrome-extension:"===(null===(n=location)||void 0===n?void 0:n.protocol)?"extension":"web","extension"===this._mode){this._boundChromeHandler=function(e){var t=e||{},r=t.action,n=t.data,i=t.error,s=null==n?void 0:n.sessionId;if(!o.sessionId||o.sessionId===s)if("PROOF_SUBMITTED"===r){var a=(null==n?void 0:n.formattedProofs)||(null==n?void 0:n.proof)||n;o._emit("completed",a)}else"PROOF_SUBMISSION_FAILED"!==r&&"PROOF_GENERATION_FAILED"!==r||o._emit("error",i||new Error("Verification failed"))};try{chrome.runtime.onMessage.addListener(this._boundChromeHandler)}catch(e){}}}return gs(e,[{key:"setAppCallbackUrl",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(!e||"string"!=typeof e)throw new Error("callbackUrl must be a non-empty string");this.callbackUrl=e,this.jsonProofResponse=!!t}},{key:"setRedirectUrl",value:function(e){if(!e||"string"!=typeof e)throw new Error("redirectUrl must be a non-empty string");this.redirectUrl=e}},{key:"addContext",value:function(e,t){if(!e||!t)throw new Error("Both address and message are required");this.context={contextAddress:String(e),contextMessage:String(t)}}},{key:"setParams",value:function(e){if(!e||"object"!==hs(e))throw new Error("params must be an object");this.parameters=ls(ls({},this.parameters),e)}},{key:"getStatusUrl",value:function(){if(!this.sessionId)throw new Error("Session not initialized");return ns.Sn.STATUS_URL(this.sessionId)}},{key:"on",value:function(e,t){var r=this;if(!this._listeners[e])throw new Error("Unknown event: ".concat(e));return this._listeners[e].add(t),function(){return r.off(e,t)}}},{key:"off",value:function(e,t){this._listeners[e]&&this._listeners[e].delete(t)}},{key:"startVerification",value:(i=Es(as().m(function e(){var t=this;return as().w(function(e){for(;;)if(0===e.n)return e.a(2,Is(function(){return t._startVerificationInternal()}))},e)})),function(){return i.apply(this,arguments)})},{key:"cancel",value:(o=Es(as().m(function e(){var t,r=this,n=arguments;return as().w(function(e){for(;;)switch(e.n){case 0:if(t=n.length>0&&void 0!==n[0]?n[0]:5e3,this.sessionId){e.n=1;break}return e.a(2);case 1:return e.a(2,new Promise(function(e){var n=!1,o=r.on("error",function(){n||(n=!0,o(),e(!0))});window.postMessage({action:ns.RECLAIM_SDK_ACTIONS.CANCEL_VERIFICATION,messageId:r.sessionId,extensionID:r.extensionID},"*"),setTimeout(function(){n||(o(),e(!1))},t)}))}},e,this)})),function(){return o.apply(this,arguments)})},{key:"_startVerificationInternal",value:(n=Es(as().m(function e(){var t,r,n=this;return as().w(function(e){for(;;)switch(e.n){case 0:if(this.sessionId){e.n=1;break}throw new Error("Session not initialized");case 1:if(this.signature){e.n=2;break}throw new Error("Signature not set");case 2:return t={sessionId:this.sessionId,providerId:this.providerId,applicationId:this.applicationId,signature:this.signature,timestamp:this.timestamp,callbackUrl:this.callbackUrl||"",context:JSON.stringify(this.context||{}),parameters:this.parameters||{},redirectUrl:this.redirectUrl||"",acceptAiProviders:!!this.acceptAiProviders,sdkVersion:this.sdkVersion,providerVersion:this.providerVersion||"",resolvedProviderVersion:this.resolvedProviderVersion||"",jsonProofResponse:!!this.jsonProofResponse},r=this.sessionId,e.a(2,new Promise(function(e,o){var i=n.on("started",function(){}),s=n.on("completed",function(t){c(),e(t)}),a=n.on("error",function(e){c(),o(e)}),c=function(){i&&i(),s&&s(),a&&a()};if("extension"===n._mode)try{chrome.runtime.sendMessage({action:"START_VERIFICATION",source:"content-script",target:"background",data:t},function(e){e&&e.success&&n._emit("started",{sessionId:n.sessionId,messageId:r})})}catch(e){n._emit("error",e instanceof Error?e:new Error(String(e)))}else{if(!n.extensionID)return void n._emit("error",new Error("extensionID is required when running on a web page"));window.postMessage({action:ns.RECLAIM_SDK_ACTIONS.START_VERIFICATION,messageId:r,data:t,extensionID:n.extensionID},"*")}}))}},e,this)})),function(){return n.apply(this,arguments)})},{key:"dispose",value:function(){var e;if(window.removeEventListener("message",this._boundWindowListener),this._boundChromeHandler&&null!==(e=chrome)&&void 0!==e&&null!==(e=e.runtime)&&void 0!==e&&null!==(e=e.onMessage)&&void 0!==e&&e.removeListener)try{chrome.runtime.onMessage.removeListener(this._boundChromeHandler)}catch(e){}this._listeners.started.clear(),this._listeners.completed.clear(),this._listeners.error.clear(),this._listeners.progress.clear()}},{key:"_initSession",value:(r=Es(as().m(function e(t){var r,n;return as().w(function(e){for(;;)switch(e.n){case 0:return e.n=1,fetch("".concat(ns.fn,"/api/sdk/init/session/"),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(t)});case 1:return r=e.v,e.n=2,r.json().catch(function(){return{}});case 2:if(n=e.v,r.ok){e.n=3;break}throw new Error((null==n?void 0:n.message)||"Failed to initialize session");case 3:return e.a(2,n)}},e)})),function(e){return r.apply(this,arguments)})},{key:"_emit",value:function(e,t){if(this._listeners[e]){var r,n=is(this._listeners[e]);try{for(n.s();!(r=n.n()).done;){var o=r.value;try{o(t)}catch(e){}}}catch(e){n.e(e)}finally{n.f()}}}},{key:"_handleWindowMessage",value:function(e){if(e.source===window){var t=e.data||{},r=t.action,n=t.messageId,o=t.data,i=t.error;if(!this.sessionId||this.sessionId===n)if(r!==ns.RECLAIM_SDK_ACTIONS.VERIFICATION_COMPLETED)r!==ns.RECLAIM_SDK_ACTIONS.VERIFICATION_FAILED?r!==ns.RECLAIM_SDK_ACTIONS.VERIFICATION_STARTED||this._emit("started",{sessionId:this.sessionId,messageId:n}):this._emit("error",i||new Error("Verification failed"));else{var s=(null==o?void 0:o.proofs)||(null==o?void 0:o.formattedProofs)||o;this._emit("completed",s)}}}}],[{key:"init",value:(t=Es(as().m(function t(r,n,o){var i,s,a,c,u,l,f,h=arguments;return as().w(function(t){for(;;)switch(t.n){case 0:if(i=h.length>3&&void 0!==h[3]?h[3]:{},r&&"string"==typeof r){t.n=1;break}throw new Error("applicationId must be a non-empty string");case 1:if(n&&"string"==typeof n){t.n=2;break}throw new Error("appSecret must be a non-empty string");case 2:if(o&&"string"==typeof o){t.n=3;break}throw new Error("providerId must be a non-empty string");case 3:return s=new e(r,o,i),a='{"providerId":"'.concat(o,'","timestamp":"').concat(s.timestamp,'"}'),c=Ee((new TextEncoder).encode(a)),u=new ts(n),t.n=4,u.signMessage(oe(c));case 4:return l=t.v,s.signature=l,t.n=5,s._initSession({providerId:o,appId:r,timestamp:s.timestamp,signature:l,versionNumber:s.providerVersion||""});case 5:return f=t.v,s.sessionId=f.sessionId||"",s.resolvedProviderVersion=f.resolvedProviderVersion||"",t.a(2,s)}},t)})),function(e,r,n){return t.apply(this,arguments)})},{key:"fromJsonString",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r="string"==typeof e?JSON.parse(e):e;return this.fromConfig(r,t)}},{key:"fromConfig",value:function(t){var r,n,o,i,s=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};if(!t||"object"!==hs(t))throw new Error("invalid config");var a=new e(String(t.applicationId||""),String(t.providerId||""),s||{});return a.sessionId=String(t.sessionId||""),a.signature=String(t.signature||""),a.timestamp=String(t.timeStamp||t.timestamp||Date.now()),a.parameters=t.parameters||{},a.context=t.context||a.context,a.callbackUrl=String(t.appCallbackUrl||t.callbackUrl||""),a.jsonProofResponse=!!(null!==(r=t.jsonProofResponse)&&void 0!==r?r:a.jsonProofResponse),a.resolvedProviderVersion=String(t.resolvedProviderVersion||""),a.providerVersion=String(t.providerVersion||""),a.redirectUrl=String(t.redirectUrl||""),a.acceptAiProviders=!!(null!==(n=null!==(o=t.acceptAiProviders)&&void 0!==o?o:null===(i=t.options)||void 0===i?void 0:i.acceptAiProviders)&&void 0!==n?n:a.acceptAiProviders),null!=s&&s.extensionID&&(a.extensionID=String(s.extensionID)),a}}]);var t,r,n,o,i}(),Rs=function(){return gs(function e(){var t;ds(this,e),this._backgroundInitialized=!1,this._ctx=null,this._mode="undefined"!=typeof chrome&&chrome.runtime&&"chrome-extension:"===(null===(t=location)||void 0===t?void 0:t.protocol)?"extension":"web"},[{key:"initializeBackground",value:function(){if(this._backgroundInitialized)return this._ctx;try{var e=(0,rs.A)();return this._backgroundInitialized=!0,this._ctx=e,e}catch(e){throw e}}},{key:"isExtensionInstalled",value:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},t=e.extensionID,r=e.timeout,n=void 0===r?500:r;return new Promise(function(e){var r="reclaim-check-".concat(Date.now()),o=function(t){var n,i;t.source===window&&(null===(n=t.data)||void 0===n?void 0:n.action)===ns.RECLAIM_SDK_ACTIONS.EXTENSION_RESPONSE&&(null===(i=t.data)||void 0===i?void 0:i.messageId)===r&&(window.removeEventListener("message",o),e(!!t.data.installed))};window.addEventListener("message",o),window.postMessage({action:ns.RECLAIM_SDK_ACTIONS.CHECK_EXTENSION,extensionID:t,messageId:r},"*"),setTimeout(function(){window.removeEventListener("message",o),e(!1)},n)})}},{key:"getVersion",value:function(){return Os}},{key:"init",value:(e=Es(as().m(function e(t,r,n){var o,i=arguments;return as().w(function(e){for(;;)switch(e.n){case 0:return o=i.length>3&&void 0!==i[3]?i[3]:{},e.n=1,As.init(t,r,n,o);case 1:return e.a(2,e.v)}},e)})),function(t,r,n){return e.apply(this,arguments)})},{key:"fromJsonString",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return As.fromJsonString(e,t)}},{key:"setLogConfig",value:function(e,t){os.Ow.setConfig(e);try{var n;if("extension"===this._mode&&"undefined"!=typeof chrome&&null!==(n=chrome.storage)&&void 0!==n&&n.local){var o=r(859).LOG_CONFIG_STORAGE_KEY;return void chrome.storage.local.set(fs({},o,ls(ls({},os.Ow.config),e)))}}catch(e){}window.postMessage({action:ns.RECLAIM_SDK_ACTIONS.SET_LOG_CONFIG,extensionID:t,data:{config:e}},"*")}},{key:"getLogConfig",value:function(){return os.Ow.config}}]);var e}(),Ts=new Rs;const _s=Rs})(),module.exports=n})();
|
|
23
23
|
//# sourceMappingURL=JoclaimExtensionSDK-mv2.bundle.js.map
|