@imtbl/wallet 2.10.7-alpha.4 → 2.10.7-alpha.6

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.
@@ -1,28 +1,28 @@
1
- import { TypedEventEmitter, AuthEvents, isUserImx, isUserZkEvm } from '@imtbl/auth';
2
- export { AuthEvents, TypedEventEmitter, isUserImx, isUserZkEvm } from '@imtbl/auth';
3
- import * as Ur from '@imtbl/generated-clients';
1
+ import { TypedEventEmitter, AuthEvents, isUserZkEvm } from '@imtbl/auth';
2
+ export { AuthEvents, TypedEventEmitter, isUserZkEvm } from '@imtbl/auth';
3
+ import * as Ki from '@imtbl/generated-clients';
4
4
  import { createConfig, MultiRollupApiClients, mr as mr$1, MagicTeeApiClients } from '@imtbl/generated-clients';
5
5
  import { utils, trackError, trackFlow, identify, trackDuration } from '@imtbl/metrics';
6
6
  import { ZeroAddress, AbiCoder, keccak256, Contract, isError, solidityPacked, getBytes, Interface, TypedDataEncoder, hashMessage, JsonRpcProvider, toBeHex, AbstractSigner, stripZerosLeft, toUtf8String } from 'ethers';
7
7
  import { walletContracts } from '@0xsequence/abi';
8
8
  import { v1 } from '@0xsequence/core';
9
- import tn, { isAxiosError } from 'axios';
9
+ import No, { isAxiosError } from 'axios';
10
10
  import { v4 } from 'uuid';
11
11
 
12
- var En=Object.create;var hr=Object.defineProperty;var Mn=Object.getOwnPropertyDescriptor;var An=Object.getOwnPropertyNames;var Tn=Object.getPrototypeOf,Cn=Object.prototype.hasOwnProperty;var ur=(o,a)=>()=>(o&&(a=o(o=0)),a);var ee=(o,a)=>()=>(a||o((a={exports:{}}).exports,a),a.exports),In=(o,a)=>{for(var h in a)hr(o,h,{get:a[h],enumerable:!0});},Rn=(o,a,h,v)=>{if(a&&typeof a=="object"||typeof a=="function")for(let s of An(a))!Cn.call(o,s)&&s!==h&&hr(o,s,{get:()=>a[s],enumerable:!(v=Mn(a,s))||v.enumerable});return o};var ri=(o,a,h)=>(h=o!=null?En(Tn(o)):{},Rn(hr(h,"default",{value:o,enumerable:!0}),o));var R=ur(()=>{});function _n(){if(ii)return re;ii=!0,re.byteLength=I,re.toByteArray=O,re.fromByteArray=z;for(var o=[],a=[],h=typeof Uint8Array<"u"?Uint8Array:Array,v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,A=v.length;s<A;++s)o[s]=v[s],a[v.charCodeAt(s)]=s;a[45]=62,a[95]=63;function d(P){var F=P.length;if(F%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var $=P.indexOf("=");$===-1&&($=F);var q=$===F?0:4-$%4;return [$,q]}function I(P){var F=d(P),$=F[0],q=F[1];return ($+q)*3/4-q}function x(P,F,$){return (F+$)*3/4-$}function O(P){var F,$=d(P),q=$[0],ct=$[1],et=new h(x(P,q,ct)),Bt=0,nt=ct>0?q-4:q,Pt;for(Pt=0;Pt<nt;Pt+=4)F=a[P.charCodeAt(Pt)]<<18|a[P.charCodeAt(Pt+1)]<<12|a[P.charCodeAt(Pt+2)]<<6|a[P.charCodeAt(Pt+3)],et[Bt++]=F>>16&255,et[Bt++]=F>>8&255,et[Bt++]=F&255;return ct===2&&(F=a[P.charCodeAt(Pt)]<<2|a[P.charCodeAt(Pt+1)]>>4,et[Bt++]=F&255),ct===1&&(F=a[P.charCodeAt(Pt)]<<10|a[P.charCodeAt(Pt+1)]<<4|a[P.charCodeAt(Pt+2)]>>2,et[Bt++]=F>>8&255,et[Bt++]=F&255),et}function L(P){return o[P>>18&63]+o[P>>12&63]+o[P>>6&63]+o[P&63]}function Z(P,F,$){for(var q,ct=[],et=F;et<$;et+=3)q=(P[et]<<16&16711680)+(P[et+1]<<8&65280)+(P[et+2]&255),ct.push(L(q));return ct.join("")}function z(P){for(var F,$=P.length,q=$%3,ct=[],et=16383,Bt=0,nt=$-q;Bt<nt;Bt+=et)ct.push(Z(P,Bt,Bt+et>nt?nt:Bt+et));return q===1?(F=P[$-1],ct.push(o[F>>2]+o[F<<4&63]+"==")):q===2&&(F=(P[$-2]<<8)+P[$-1],ct.push(o[F>>10]+o[F>>4&63]+o[F<<2&63]+"=")),ct.join("")}return re}function xn(){if(ni)return ve;ni=!0;return ve.read=function(o,a,h,v,s){var A,d,I=s*8-v-1,x=(1<<I)-1,O=x>>1,L=-7,Z=h?s-1:0,z=h?-1:1,P=o[a+Z];for(Z+=z,A=P&(1<<-L)-1,P>>=-L,L+=I;L>0;A=A*256+o[a+Z],Z+=z,L-=8);for(d=A&(1<<-L)-1,A>>=-L,L+=v;L>0;d=d*256+o[a+Z],Z+=z,L-=8);if(A===0)A=1-O;else {if(A===x)return d?NaN:(P?-1:1)*(1/0);d=d+Math.pow(2,v),A=A-O;}return (P?-1:1)*d*Math.pow(2,A-v)},ve.write=function(o,a,h,v,s,A){var d,I,x,O=A*8-s-1,L=(1<<O)-1,Z=L>>1,z=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,P=v?0:A-1,F=v?1:-1,$=a<0||a===0&&1/a<0?1:0;for(a=Math.abs(a),isNaN(a)||a===1/0?(I=isNaN(a)?1:0,d=L):(d=Math.floor(Math.log(a)/Math.LN2),a*(x=Math.pow(2,-d))<1&&(d--,x*=2),d+Z>=1?a+=z/x:a+=z*Math.pow(2,1-Z),a*x>=2&&(d++,x/=2),d+Z>=L?(I=0,d=L):d+Z>=1?(I=(a*x-1)*Math.pow(2,s),d=d+Z):(I=a*Math.pow(2,Z-1)*Math.pow(2,s),d=0));s>=8;o[h+P]=I&255,P+=F,I/=256,s-=8);for(d=d<<s|I,O+=s;O>0;o[h+P]=d&255,P+=F,d/=256,O-=8);o[h+P-F]|=$*128;},ve}function bn(){if(oi)return Gt;oi=!0;let o=_n(),a=xn(),h=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Gt.Buffer=d,Gt.SlowBuffer=ct,Gt.INSPECT_MAX_BYTES=50;let v=2147483647;Gt.kMaxLength=v,d.TYPED_ARRAY_SUPPORT=s(),!d.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function s(){try{let l=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(l,e),l.foo()===42}catch{return !1}}Object.defineProperty(d.prototype,"parent",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.buffer}}),Object.defineProperty(d.prototype,"offset",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.byteOffset}});function A(l){if(l>v)throw new RangeError('The value "'+l+'" is invalid for option "size"');let e=new Uint8Array(l);return Object.setPrototypeOf(e,d.prototype),e}function d(l,e,r){if(typeof l=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return L(l)}return I(l,e,r)}d.poolSize=8192;function I(l,e,r){if(typeof l=="string")return Z(l,e);if(ArrayBuffer.isView(l))return P(l);if(l==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof l);if(Y(l,ArrayBuffer)||l&&Y(l.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Y(l,SharedArrayBuffer)||l&&Y(l.buffer,SharedArrayBuffer)))return F(l,e,r);if(typeof l=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let c=l.valueOf&&l.valueOf();if(c!=null&&c!==l)return d.from(c,e,r);let w=$(l);if(w)return w;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof l[Symbol.toPrimitive]=="function")return d.from(l[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof l)}d.from=function(l,e,r){return I(l,e,r)},Object.setPrototypeOf(d.prototype,Uint8Array.prototype),Object.setPrototypeOf(d,Uint8Array);function x(l){if(typeof l!="number")throw new TypeError('"size" argument must be of type number');if(l<0)throw new RangeError('The value "'+l+'" is invalid for option "size"')}function O(l,e,r){return x(l),l<=0?A(l):e!==void 0?typeof r=="string"?A(l).fill(e,r):A(l).fill(e):A(l)}d.alloc=function(l,e,r){return O(l,e,r)};function L(l){return x(l),A(l<0?0:q(l)|0)}d.allocUnsafe=function(l){return L(l)},d.allocUnsafeSlow=function(l){return L(l)};function Z(l,e){if((typeof e!="string"||e==="")&&(e="utf8"),!d.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=et(l,e)|0,c=A(r),w=c.write(l,e);return w!==r&&(c=c.slice(0,w)),c}function z(l){let e=l.length<0?0:q(l.length)|0,r=A(e);for(let c=0;c<e;c+=1)r[c]=l[c]&255;return r}function P(l){if(Y(l,Uint8Array)){let e=new Uint8Array(l);return F(e.buffer,e.byteOffset,e.byteLength)}return z(l)}function F(l,e,r){if(e<0||l.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(l.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let c;return e===void 0&&r===void 0?c=new Uint8Array(l):r===void 0?c=new Uint8Array(l,e):c=new Uint8Array(l,e,r),Object.setPrototypeOf(c,d.prototype),c}function $(l){if(d.isBuffer(l)){let e=q(l.length)|0,r=A(e);return r.length===0||l.copy(r,0,0,e),r}if(l.length!==void 0)return typeof l.length!="number"||qt(l.length)?A(0):z(l);if(l.type==="Buffer"&&Array.isArray(l.data))return z(l.data)}function q(l){if(l>=v)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+v.toString(16)+" bytes");return l|0}function ct(l){return +l!=l&&(l=0),d.alloc(+l)}d.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==d.prototype},d.compare=function(e,r){if(Y(e,Uint8Array)&&(e=d.from(e,e.offset,e.byteLength)),Y(r,Uint8Array)&&(r=d.from(r,r.offset,r.byteLength)),!d.isBuffer(e)||!d.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;let c=e.length,w=r.length;for(let T=0,C=Math.min(c,w);T<C;++T)if(e[T]!==r[T]){c=e[T],w=r[T];break}return c<w?-1:w<c?1:0},d.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return !0;default:return !1}},d.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return d.alloc(0);let c;if(r===void 0)for(r=0,c=0;c<e.length;++c)r+=e[c].length;let w=d.allocUnsafe(r),T=0;for(c=0;c<e.length;++c){let C=e[c];if(Y(C,Uint8Array))T+C.length>w.length?(d.isBuffer(C)||(C=d.from(C)),C.copy(w,T)):Uint8Array.prototype.set.call(w,C,T);else if(d.isBuffer(C))C.copy(w,T);else throw new TypeError('"list" argument must be an Array of Buffers');T+=C.length;}return w};function et(l,e){if(d.isBuffer(l))return l.length;if(ArrayBuffer.isView(l)||Y(l,ArrayBuffer))return l.byteLength;if(typeof l!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof l);let r=l.length,c=arguments.length>2&&arguments[2]===!0;if(!c&&r===0)return 0;let w=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return $t(l).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return te(l).length;default:if(w)return c?-1:$t(l).length;e=(""+e).toLowerCase(),w=!0;}}d.byteLength=et;function Bt(l,e,r){let c=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return "";for(l||(l="utf8");;)switch(l){case"hex":return m(this,e,r);case"utf8":case"utf-8":return y(this,e,r);case"ascii":return u(this,e,r);case"latin1":case"binary":return f(this,e,r);case"base64":return Lt(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,r);default:if(c)throw new TypeError("Unknown encoding: "+l);l=(l+"").toLowerCase(),c=!0;}}d.prototype._isBuffer=!0;function nt(l,e,r){let c=l[e];l[e]=l[r],l[r]=c;}d.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;r<e;r+=2)nt(this,r,r+1);return this},d.prototype.swap32=function(){let e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let r=0;r<e;r+=4)nt(this,r,r+3),nt(this,r+1,r+2);return this},d.prototype.swap64=function(){let e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let r=0;r<e;r+=8)nt(this,r,r+7),nt(this,r+1,r+6),nt(this,r+2,r+5),nt(this,r+3,r+4);return this},d.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?y(this,0,e):Bt.apply(this,arguments)},d.prototype.toLocaleString=d.prototype.toString,d.prototype.equals=function(e){if(!d.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:d.compare(this,e)===0},d.prototype.inspect=function(){let e="",r=Gt.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},h&&(d.prototype[h]=d.prototype.inspect),d.prototype.compare=function(e,r,c,w,T){if(Y(e,Uint8Array)&&(e=d.from(e,e.offset,e.byteLength)),!d.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),c===void 0&&(c=e?e.length:0),w===void 0&&(w=0),T===void 0&&(T=this.length),r<0||c>e.length||w<0||T>this.length)throw new RangeError("out of range index");if(w>=T&&r>=c)return 0;if(w>=T)return -1;if(r>=c)return 1;if(r>>>=0,c>>>=0,w>>>=0,T>>>=0,this===e)return 0;let C=T-w,B=c-r,it=Math.min(C,B),V=this.slice(w,T),G=e.slice(r,c);for(let K=0;K<it;++K)if(V[K]!==G[K]){C=V[K],B=G[K];break}return C<B?-1:B<C?1:0};function Pt(l,e,r,c,w){if(l.length===0)return -1;if(typeof r=="string"?(c=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,qt(r)&&(r=w?0:l.length-1),r<0&&(r=l.length+r),r>=l.length){if(w)return -1;r=l.length-1;}else if(r<0)if(w)r=0;else return -1;if(typeof e=="string"&&(e=d.from(e,c)),d.isBuffer(e))return e.length===0?-1:Nt(l,e,r,c,w);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?w?Uint8Array.prototype.indexOf.call(l,e,r):Uint8Array.prototype.lastIndexOf.call(l,e,r):Nt(l,[e],r,c,w);throw new TypeError("val must be string, number or Buffer")}function Nt(l,e,r,c,w){let T=1,C=l.length,B=e.length;if(c!==void 0&&(c=String(c).toLowerCase(),c==="ucs2"||c==="ucs-2"||c==="utf16le"||c==="utf-16le")){if(l.length<2||e.length<2)return -1;T=2,C/=2,B/=2,r/=2;}function it(G,K){return T===1?G[K]:G.readUInt16BE(K*T)}let V;if(w){let G=-1;for(V=r;V<C;V++)if(it(l,V)===it(e,G===-1?0:V-G)){if(G===-1&&(G=V),V-G+1===B)return G*T}else G!==-1&&(V-=V-G),G=-1;}else for(r+B>C&&(r=C-B),V=r;V>=0;V--){let G=!0;for(let K=0;K<B;K++)if(it(l,V+K)!==it(e,K)){G=!1;break}if(G)return V}return -1}d.prototype.includes=function(e,r,c){return this.indexOf(e,r,c)!==-1},d.prototype.indexOf=function(e,r,c){return Pt(this,e,r,c,!0)},d.prototype.lastIndexOf=function(e,r,c){return Pt(this,e,r,c,!1)};function Zt(l,e,r,c){r=Number(r)||0;let w=l.length-r;c?(c=Number(c),c>w&&(c=w)):c=w;let T=e.length;c>T/2&&(c=T/2);let C;for(C=0;C<c;++C){let B=parseInt(e.substr(C*2,2),16);if(qt(B))return C;l[r+C]=B;}return C}function me(l,e,r,c){return rt($t(e,l.length-r),l,r,c)}function ge(l,e,r,c){return rt(lt(e),l,r,c)}function Qt(l,e,r,c){return rt(te(e),l,r,c)}function ot(l,e,r,c){return rt(ht(e,l.length-r),l,r,c)}d.prototype.write=function(e,r,c,w){if(r===void 0)w="utf8",c=this.length,r=0;else if(c===void 0&&typeof r=="string")w=r,c=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(c)?(c=c>>>0,w===void 0&&(w="utf8")):(w=c,c=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let T=this.length-r;if((c===void 0||c>T)&&(c=T),e.length>0&&(c<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");w||(w="utf8");let C=!1;for(;;)switch(w){case"hex":return Zt(this,e,r,c);case"utf8":case"utf-8":return me(this,e,r,c);case"ascii":case"latin1":case"binary":return ge(this,e,r,c);case"base64":return Qt(this,e,r,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ot(this,e,r,c);default:if(C)throw new TypeError("Unknown encoding: "+w);w=(""+w).toLowerCase(),C=!0;}},d.prototype.toJSON=function(){return {type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function Lt(l,e,r){return e===0&&r===l.length?o.fromByteArray(l):o.fromByteArray(l.slice(e,r))}function y(l,e,r){r=Math.min(l.length,r);let c=[],w=e;for(;w<r;){let T=l[w],C=null,B=T>239?4:T>223?3:T>191?2:1;if(w+B<=r){let it,V,G,K;switch(B){case 1:T<128&&(C=T);break;case 2:it=l[w+1],(it&192)===128&&(K=(T&31)<<6|it&63,K>127&&(C=K));break;case 3:it=l[w+1],V=l[w+2],(it&192)===128&&(V&192)===128&&(K=(T&15)<<12|(it&63)<<6|V&63,K>2047&&(K<55296||K>57343)&&(C=K));break;case 4:it=l[w+1],V=l[w+2],G=l[w+3],(it&192)===128&&(V&192)===128&&(G&192)===128&&(K=(T&15)<<18|(it&63)<<12|(V&63)<<6|G&63,K>65535&&K<1114112&&(C=K));}}C===null?(C=65533,B=1):C>65535&&(C-=65536,c.push(C>>>10&1023|55296),C=56320|C&1023),c.push(C),w+=B;}return n(c)}let t=4096;function n(l){let e=l.length;if(e<=t)return String.fromCharCode.apply(String,l);let r="",c=0;for(;c<e;)r+=String.fromCharCode.apply(String,l.slice(c,c+=t));return r}function u(l,e,r){let c="";r=Math.min(l.length,r);for(let w=e;w<r;++w)c+=String.fromCharCode(l[w]&127);return c}function f(l,e,r){let c="";r=Math.min(l.length,r);for(let w=e;w<r;++w)c+=String.fromCharCode(l[w]);return c}function m(l,e,r){let c=l.length;(!e||e<0)&&(e=0),(!r||r<0||r>c)&&(r=c);let w="";for(let T=e;T<r;++T)w+=ut[l[T]];return w}function E(l,e,r){let c=l.slice(e,r),w="";for(let T=0;T<c.length-1;T+=2)w+=String.fromCharCode(c[T]+c[T+1]*256);return w}d.prototype.slice=function(e,r){let c=this.length;e=~~e,r=r===void 0?c:~~r,e<0?(e+=c,e<0&&(e=0)):e>c&&(e=c),r<0?(r+=c,r<0&&(r=0)):r>c&&(r=c),r<e&&(r=e);let w=this.subarray(e,r);return Object.setPrototypeOf(w,d.prototype),w};function M(l,e,r){if(l%1!==0||l<0)throw new RangeError("offset is not uint");if(l+e>r)throw new RangeError("Trying to access beyond buffer length")}d.prototype.readUintLE=d.prototype.readUIntLE=function(e,r,c){e=e>>>0,r=r>>>0,c||M(e,r,this.length);let w=this[e],T=1,C=0;for(;++C<r&&(T*=256);)w+=this[e+C]*T;return w},d.prototype.readUintBE=d.prototype.readUIntBE=function(e,r,c){e=e>>>0,r=r>>>0,c||M(e,r,this.length);let w=this[e+--r],T=1;for(;r>0&&(T*=256);)w+=this[e+--r]*T;return w},d.prototype.readUint8=d.prototype.readUInt8=function(e,r){return e=e>>>0,r||M(e,1,this.length),this[e]},d.prototype.readUint16LE=d.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||M(e,2,this.length),this[e]|this[e+1]<<8},d.prototype.readUint16BE=d.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||M(e,2,this.length),this[e]<<8|this[e+1]},d.prototype.readUint32LE=d.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||M(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},d.prototype.readUint32BE=d.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||M(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},d.prototype.readBigUInt64LE=tt(function(e){e=e>>>0,j(e,"offset");let r=this[e],c=this[e+7];(r===void 0||c===void 0)&&Dt(e,this.length-8);let w=r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,T=this[++e]+this[++e]*2**8+this[++e]*2**16+c*2**24;return BigInt(w)+(BigInt(T)<<BigInt(32))}),d.prototype.readBigUInt64BE=tt(function(e){e=e>>>0,j(e,"offset");let r=this[e],c=this[e+7];(r===void 0||c===void 0)&&Dt(e,this.length-8);let w=r*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],T=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+c;return (BigInt(w)<<BigInt(32))+BigInt(T)}),d.prototype.readIntLE=function(e,r,c){e=e>>>0,r=r>>>0,c||M(e,r,this.length);let w=this[e],T=1,C=0;for(;++C<r&&(T*=256);)w+=this[e+C]*T;return T*=128,w>=T&&(w-=Math.pow(2,8*r)),w},d.prototype.readIntBE=function(e,r,c){e=e>>>0,r=r>>>0,c||M(e,r,this.length);let w=r,T=1,C=this[e+--w];for(;w>0&&(T*=256);)C+=this[e+--w]*T;return T*=128,C>=T&&(C-=Math.pow(2,8*r)),C},d.prototype.readInt8=function(e,r){return e=e>>>0,r||M(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},d.prototype.readInt16LE=function(e,r){e=e>>>0,r||M(e,2,this.length);let c=this[e]|this[e+1]<<8;return c&32768?c|4294901760:c},d.prototype.readInt16BE=function(e,r){e=e>>>0,r||M(e,2,this.length);let c=this[e+1]|this[e]<<8;return c&32768?c|4294901760:c},d.prototype.readInt32LE=function(e,r){return e=e>>>0,r||M(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},d.prototype.readInt32BE=function(e,r){return e=e>>>0,r||M(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},d.prototype.readBigInt64LE=tt(function(e){e=e>>>0,j(e,"offset");let r=this[e],c=this[e+7];(r===void 0||c===void 0)&&Dt(e,this.length-8);let w=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(c<<24);return (BigInt(w)<<BigInt(32))+BigInt(r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)}),d.prototype.readBigInt64BE=tt(function(e){e=e>>>0,j(e,"offset");let r=this[e],c=this[e+7];(r===void 0||c===void 0)&&Dt(e,this.length-8);let w=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return (BigInt(w)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+c)}),d.prototype.readFloatLE=function(e,r){return e=e>>>0,r||M(e,4,this.length),a.read(this,e,!0,23,4)},d.prototype.readFloatBE=function(e,r){return e=e>>>0,r||M(e,4,this.length),a.read(this,e,!1,23,4)},d.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||M(e,8,this.length),a.read(this,e,!0,52,8)},d.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||M(e,8,this.length),a.read(this,e,!1,52,8)};function p(l,e,r,c,w,T){if(!d.isBuffer(l))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>w||e<T)throw new RangeError('"value" argument is out of bounds');if(r+c>l.length)throw new RangeError("Index out of range")}d.prototype.writeUintLE=d.prototype.writeUIntLE=function(e,r,c,w){if(e=+e,r=r>>>0,c=c>>>0,!w){let B=Math.pow(2,8*c)-1;p(this,e,r,c,B,0);}let T=1,C=0;for(this[r]=e&255;++C<c&&(T*=256);)this[r+C]=e/T&255;return r+c},d.prototype.writeUintBE=d.prototype.writeUIntBE=function(e,r,c,w){if(e=+e,r=r>>>0,c=c>>>0,!w){let B=Math.pow(2,8*c)-1;p(this,e,r,c,B,0);}let T=c-1,C=1;for(this[r+T]=e&255;--T>=0&&(C*=256);)this[r+T]=e/C&255;return r+c},d.prototype.writeUint8=d.prototype.writeUInt8=function(e,r,c){return e=+e,r=r>>>0,c||p(this,e,r,1,255,0),this[r]=e&255,r+1},d.prototype.writeUint16LE=d.prototype.writeUInt16LE=function(e,r,c){return e=+e,r=r>>>0,c||p(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2},d.prototype.writeUint16BE=d.prototype.writeUInt16BE=function(e,r,c){return e=+e,r=r>>>0,c||p(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2},d.prototype.writeUint32LE=d.prototype.writeUInt32LE=function(e,r,c){return e=+e,r=r>>>0,c||p(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4},d.prototype.writeUint32BE=d.prototype.writeUInt32BE=function(e,r,c){return e=+e,r=r>>>0,c||p(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function i(l,e,r,c,w){Q(e,c,w,l,r,7);let T=Number(e&BigInt(4294967295));l[r++]=T,T=T>>8,l[r++]=T,T=T>>8,l[r++]=T,T=T>>8,l[r++]=T;let C=Number(e>>BigInt(32)&BigInt(4294967295));return l[r++]=C,C=C>>8,l[r++]=C,C=C>>8,l[r++]=C,C=C>>8,l[r++]=C,r}function g(l,e,r,c,w){Q(e,c,w,l,r,7);let T=Number(e&BigInt(4294967295));l[r+7]=T,T=T>>8,l[r+6]=T,T=T>>8,l[r+5]=T,T=T>>8,l[r+4]=T;let C=Number(e>>BigInt(32)&BigInt(4294967295));return l[r+3]=C,C=C>>8,l[r+2]=C,C=C>>8,l[r+1]=C,C=C>>8,l[r]=C,r+8}d.prototype.writeBigUInt64LE=tt(function(e,r=0){return i(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))}),d.prototype.writeBigUInt64BE=tt(function(e,r=0){return g(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))}),d.prototype.writeIntLE=function(e,r,c,w){if(e=+e,r=r>>>0,!w){let it=Math.pow(2,8*c-1);p(this,e,r,c,it-1,-it);}let T=0,C=1,B=0;for(this[r]=e&255;++T<c&&(C*=256);)e<0&&B===0&&this[r+T-1]!==0&&(B=1),this[r+T]=(e/C>>0)-B&255;return r+c},d.prototype.writeIntBE=function(e,r,c,w){if(e=+e,r=r>>>0,!w){let it=Math.pow(2,8*c-1);p(this,e,r,c,it-1,-it);}let T=c-1,C=1,B=0;for(this[r+T]=e&255;--T>=0&&(C*=256);)e<0&&B===0&&this[r+T+1]!==0&&(B=1),this[r+T]=(e/C>>0)-B&255;return r+c},d.prototype.writeInt8=function(e,r,c){return e=+e,r=r>>>0,c||p(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1},d.prototype.writeInt16LE=function(e,r,c){return e=+e,r=r>>>0,c||p(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2},d.prototype.writeInt16BE=function(e,r,c){return e=+e,r=r>>>0,c||p(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2},d.prototype.writeInt32LE=function(e,r,c){return e=+e,r=r>>>0,c||p(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4},d.prototype.writeInt32BE=function(e,r,c){return e=+e,r=r>>>0,c||p(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4},d.prototype.writeBigInt64LE=tt(function(e,r=0){return i(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),d.prototype.writeBigInt64BE=tt(function(e,r=0){return g(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function b(l,e,r,c,w,T){if(r+c>l.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function S(l,e,r,c,w){return e=+e,r=r>>>0,w||b(l,e,r,4),a.write(l,e,r,c,23,4),r+4}d.prototype.writeFloatLE=function(e,r,c){return S(this,e,r,!0,c)},d.prototype.writeFloatBE=function(e,r,c){return S(this,e,r,!1,c)};function N(l,e,r,c,w){return e=+e,r=r>>>0,w||b(l,e,r,8),a.write(l,e,r,c,52,8),r+8}d.prototype.writeDoubleLE=function(e,r,c){return N(this,e,r,!0,c)},d.prototype.writeDoubleBE=function(e,r,c){return N(this,e,r,!1,c)},d.prototype.copy=function(e,r,c,w){if(!d.isBuffer(e))throw new TypeError("argument should be a Buffer");if(c||(c=0),!w&&w!==0&&(w=this.length),r>=e.length&&(r=e.length),r||(r=0),w>0&&w<c&&(w=c),w===c||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(c<0||c>=this.length)throw new RangeError("Index out of range");if(w<0)throw new RangeError("sourceEnd out of bounds");w>this.length&&(w=this.length),e.length-r<w-c&&(w=e.length-r+c);let T=w-c;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,c,w):Uint8Array.prototype.set.call(e,this.subarray(c,w),r),T},d.prototype.fill=function(e,r,c,w){if(typeof e=="string"){if(typeof r=="string"?(w=r,r=0,c=this.length):typeof c=="string"&&(w=c,c=this.length),w!==void 0&&typeof w!="string")throw new TypeError("encoding must be a string");if(typeof w=="string"&&!d.isEncoding(w))throw new TypeError("Unknown encoding: "+w);if(e.length===1){let C=e.charCodeAt(0);(w==="utf8"&&C<128||w==="latin1")&&(e=C);}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(r<0||this.length<r||this.length<c)throw new RangeError("Out of range index");if(c<=r)return this;r=r>>>0,c=c===void 0?this.length:c>>>0,e||(e=0);let T;if(typeof e=="number")for(T=r;T<c;++T)this[T]=e;else {let C=d.isBuffer(e)?e:d.from(e,w),B=C.length;if(B===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(T=0;T<c-r;++T)this[T+r]=C[T%B];}return this};let D={};function J(l,e,r){D[l]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${l}]`,this.stack,delete this.name;}get code(){return l}set code(w){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:w,writable:!0});}toString(){return `${this.name} [${l}]: ${this.message}`}};}J("ERR_BUFFER_OUT_OF_BOUNDS",function(l){return l?`${l} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),J("ERR_INVALID_ARG_TYPE",function(l,e){return `The "${l}" argument must be of type number. Received type ${typeof e}`},TypeError),J("ERR_OUT_OF_RANGE",function(l,e,r){let c=`The value of "${l}" is out of range.`,w=r;return Number.isInteger(r)&&Math.abs(r)>2**32?w=X(String(r)):typeof r=="bigint"&&(w=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(w=X(w)),w+="n"),c+=` It must be ${e}. Received ${w}`,c},RangeError);function X(l){let e="",r=l.length,c=l[0]==="-"?1:0;for(;r>=c+4;r-=3)e=`_${l.slice(r-3,r)}${e}`;return `${l.slice(0,r)}${e}`}function Ut(l,e,r){j(e,"offset"),(l[e]===void 0||l[e+r]===void 0)&&Dt(e,l.length-(r+1));}function Q(l,e,r,c,w,T){if(l>r||l<e){let C=typeof e=="bigint"?"n":"",B;throw e===0||e===BigInt(0)?B=`>= 0${C} and < 2${C} ** ${(T+1)*8}${C}`:B=`>= -(2${C} ** ${(T+1)*8-1}${C}) and < 2 ** ${(T+1)*8-1}${C}`,new D.ERR_OUT_OF_RANGE("value",B,l)}Ut(c,w,T);}function j(l,e){if(typeof l!="number")throw new D.ERR_INVALID_ARG_TYPE(e,"number",l)}function Dt(l,e,r){throw Math.floor(l)!==l?(j(l,r),new D.ERR_OUT_OF_RANGE("offset","an integer",l)):e<0?new D.ERR_BUFFER_OUT_OF_BOUNDS:new D.ERR_OUT_OF_RANGE("offset",`>= ${0} and <= ${e}`,l)}let at=/[^+/0-9A-Za-z-_]/g;function st(l){if(l=l.split("=")[0],l=l.trim().replace(at,""),l.length<2)return "";for(;l.length%4!==0;)l=l+"=";return l}function $t(l,e){e=e||1/0;let r,c=l.length,w=null,T=[];for(let C=0;C<c;++C){if(r=l.charCodeAt(C),r>55295&&r<57344){if(!w){if(r>56319){(e-=3)>-1&&T.push(239,191,189);continue}else if(C+1===c){(e-=3)>-1&&T.push(239,191,189);continue}w=r;continue}if(r<56320){(e-=3)>-1&&T.push(239,191,189),w=r;continue}r=(w-55296<<10|r-56320)+65536;}else w&&(e-=3)>-1&&T.push(239,191,189);if(w=null,r<128){if((e-=1)<0)break;T.push(r);}else if(r<2048){if((e-=2)<0)break;T.push(r>>6|192,r&63|128);}else if(r<65536){if((e-=3)<0)break;T.push(r>>12|224,r>>6&63|128,r&63|128);}else if(r<1114112){if((e-=4)<0)break;T.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128);}else throw new Error("Invalid code point")}return T}function lt(l){let e=[];for(let r=0;r<l.length;++r)e.push(l.charCodeAt(r)&255);return e}function ht(l,e){let r,c,w,T=[];for(let C=0;C<l.length&&!((e-=2)<0);++C)r=l.charCodeAt(C),c=r>>8,w=r%256,T.push(w),T.push(c);return T}function te(l){return o.toByteArray(st(l))}function rt(l,e,r,c){let w;for(w=0;w<c&&!(w+r>=e.length||w>=l.length);++w)e[w+r]=l[w];return w}function Y(l,e){return l instanceof e||l!=null&&l.constructor!=null&&l.constructor.name!=null&&l.constructor.name===e.name}function qt(l){return l!==l}let ut=function(){let l="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){let c=r*16;for(let w=0;w<16;++w)e[c+w]=l[r]+l[w];}return e}();function tt(l){return typeof BigInt>"u"?ye:l}function ye(){throw new Error("BigInt not supported")}return Gt}var re,ii,ve,ni,Gt,oi,Wt,k,ai=ur(()=>{_();R();re={},ii=!1;ve={},ni=!1;Gt={},oi=!1;Wt=bn();Wt.Buffer;Wt.SlowBuffer;Wt.INSPECT_MAX_BYTES;Wt.kMaxLength;k=Wt.Buffer,Wt.INSPECT_MAX_BYTES,Wt.kMaxLength;});var _=ur(()=>{ai();});var Ei=ee((ls,wi)=>{_();R();wi.exports={};});var Ai=ee((Mi,yr)=>{_();R();(function(o,a){function h(y,t){if(!y)throw new Error(t||"Assertion failed")}function v(y,t){y.super_=t;var n=function(){};n.prototype=t.prototype,y.prototype=new n,y.prototype.constructor=y;}function s(y,t,n){if(s.isBN(y))return y;this.negative=0,this.words=null,this.length=0,this.red=null,y!==null&&((t==="le"||t==="be")&&(n=t,t=10),this._init(y||0,t||10,n||"be"));}typeof o=="object"?o.exports=s:a.BN=s,s.BN=s,s.wordSize=26;var A;try{typeof window<"u"&&typeof window.Buffer<"u"?A=window.Buffer:A=Ei().Buffer;}catch{}s.isBN=function(t){return t instanceof s?!0:t!==null&&typeof t=="object"&&t.constructor.wordSize===s.wordSize&&Array.isArray(t.words)},s.max=function(t,n){return t.cmp(n)>0?t:n},s.min=function(t,n){return t.cmp(n)<0?t:n},s.prototype._init=function(t,n,u){if(typeof t=="number")return this._initNumber(t,n,u);if(typeof t=="object")return this._initArray(t,n,u);n==="hex"&&(n=16),h(n===(n|0)&&n>=2&&n<=36),t=t.toString().replace(/\s+/g,"");var f=0;t[0]==="-"&&(f++,this.negative=1),f<t.length&&(n===16?this._parseHex(t,f,u):(this._parseBase(t,n,f),u==="le"&&this._initArray(this.toArray(),n,u)));},s.prototype._initNumber=function(t,n,u){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[t&67108863],this.length=1):t<4503599627370496?(this.words=[t&67108863,t/67108864&67108863],this.length=2):(h(t<9007199254740992),this.words=[t&67108863,t/67108864&67108863,1],this.length=3),u==="le"&&this._initArray(this.toArray(),n,u);},s.prototype._initArray=function(t,n,u){if(h(typeof t.length=="number"),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var f=0;f<this.length;f++)this.words[f]=0;var m,E,M=0;if(u==="be")for(f=t.length-1,m=0;f>=0;f-=3)E=t[f]|t[f-1]<<8|t[f-2]<<16,this.words[m]|=E<<M&67108863,this.words[m+1]=E>>>26-M&67108863,M+=24,M>=26&&(M-=26,m++);else if(u==="le")for(f=0,m=0;f<t.length;f+=3)E=t[f]|t[f+1]<<8|t[f+2]<<16,this.words[m]|=E<<M&67108863,this.words[m+1]=E>>>26-M&67108863,M+=24,M>=26&&(M-=26,m++);return this._strip()};function d(y,t){var n=y.charCodeAt(t);if(n>=48&&n<=57)return n-48;if(n>=65&&n<=70)return n-55;if(n>=97&&n<=102)return n-87;h(!1,"Invalid character in "+y);}function I(y,t,n){var u=d(y,n);return n-1>=t&&(u|=d(y,n-1)<<4),u}s.prototype._parseHex=function(t,n,u){this.length=Math.ceil((t.length-n)/6),this.words=new Array(this.length);for(var f=0;f<this.length;f++)this.words[f]=0;var m=0,E=0,M;if(u==="be")for(f=t.length-1;f>=n;f-=2)M=I(t,n,f)<<m,this.words[E]|=M&67108863,m>=18?(m-=18,E+=1,this.words[E]|=M>>>26):m+=8;else {var p=t.length-n;for(f=p%2===0?n+1:n;f<t.length;f+=2)M=I(t,n,f)<<m,this.words[E]|=M&67108863,m>=18?(m-=18,E+=1,this.words[E]|=M>>>26):m+=8;}this._strip();};function x(y,t,n,u){for(var f=0,m=0,E=Math.min(y.length,n),M=t;M<E;M++){var p=y.charCodeAt(M)-48;f*=u,p>=49?m=p-49+10:p>=17?m=p-17+10:m=p,h(p>=0&&m<u,"Invalid character"),f+=m;}return f}s.prototype._parseBase=function(t,n,u){this.words=[0],this.length=1;for(var f=0,m=1;m<=67108863;m*=n)f++;f--,m=m/n|0;for(var E=t.length-u,M=E%f,p=Math.min(E,E-M)+u,i=0,g=u;g<p;g+=f)i=x(t,g,g+f,n),this.imuln(m),this.words[0]+i<67108864?this.words[0]+=i:this._iaddn(i);if(M!==0){var b=1;for(i=x(t,g,t.length,n),g=0;g<M;g++)b*=n;this.imuln(b),this.words[0]+i<67108864?this.words[0]+=i:this._iaddn(i);}this._strip();},s.prototype.copy=function(t){t.words=new Array(this.length);for(var n=0;n<this.length;n++)t.words[n]=this.words[n];t.length=this.length,t.negative=this.negative,t.red=this.red;};function O(y,t){y.words=t.words,y.length=t.length,y.negative=t.negative,y.red=t.red;}if(s.prototype._move=function(t){O(t,this);},s.prototype.clone=function(){var t=new s(null);return this.copy(t),t},s.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},s.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=L;}catch{s.prototype.inspect=L;}else s.prototype.inspect=L;function L(){return (this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var Z=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],z=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],P=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(t,n){t=t||10,n=n|0||1;var u;if(t===16||t==="hex"){u="";for(var f=0,m=0,E=0;E<this.length;E++){var M=this.words[E],p=((M<<f|m)&16777215).toString(16);m=M>>>24-f&16777215,f+=2,f>=26&&(f-=26,E--),m!==0||E!==this.length-1?u=Z[6-p.length]+p+u:u=p+u;}for(m!==0&&(u=m.toString(16)+u);u.length%n!==0;)u="0"+u;return this.negative!==0&&(u="-"+u),u}if(t===(t|0)&&t>=2&&t<=36){var i=z[t],g=P[t];u="";var b=this.clone();for(b.negative=0;!b.isZero();){var S=b.modrn(g).toString(t);b=b.idivn(g),b.isZero()?u=S+u:u=Z[i-S.length]+S+u;}for(this.isZero()&&(u="0"+u);u.length%n!==0;)u="0"+u;return this.negative!==0&&(u="-"+u),u}h(!1,"Base should be between 2 and 36");},s.prototype.toNumber=function(){var t=this.words[0];return this.length===2?t+=this.words[1]*67108864:this.length===3&&this.words[2]===1?t+=4503599627370496+this.words[1]*67108864:this.length>2&&h(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-t:t},s.prototype.toJSON=function(){return this.toString(16,2)},A&&(s.prototype.toBuffer=function(t,n){return this.toArrayLike(A,t,n)}),s.prototype.toArray=function(t,n){return this.toArrayLike(Array,t,n)};var F=function(t,n){return t.allocUnsafe?t.allocUnsafe(n):new t(n)};s.prototype.toArrayLike=function(t,n,u){this._strip();var f=this.byteLength(),m=u||Math.max(1,f);h(f<=m,"byte array longer than desired length"),h(m>0,"Requested array length <= 0");var E=F(t,m),M=n==="le"?"LE":"BE";return this["_toArrayLike"+M](E,f),E},s.prototype._toArrayLikeLE=function(t,n){for(var u=0,f=0,m=0,E=0;m<this.length;m++){var M=this.words[m]<<E|f;t[u++]=M&255,u<t.length&&(t[u++]=M>>8&255),u<t.length&&(t[u++]=M>>16&255),E===6?(u<t.length&&(t[u++]=M>>24&255),f=0,E=0):(f=M>>>24,E+=2);}if(u<t.length)for(t[u++]=f;u<t.length;)t[u++]=0;},s.prototype._toArrayLikeBE=function(t,n){for(var u=t.length-1,f=0,m=0,E=0;m<this.length;m++){var M=this.words[m]<<E|f;t[u--]=M&255,u>=0&&(t[u--]=M>>8&255),u>=0&&(t[u--]=M>>16&255),E===6?(u>=0&&(t[u--]=M>>24&255),f=0,E=0):(f=M>>>24,E+=2);}if(u>=0)for(t[u--]=f;u>=0;)t[u--]=0;},Math.clz32?s.prototype._countBits=function(t){return 32-Math.clz32(t)}:s.prototype._countBits=function(t){var n=t,u=0;return n>=4096&&(u+=13,n>>>=13),n>=64&&(u+=7,n>>>=7),n>=8&&(u+=4,n>>>=4),n>=2&&(u+=2,n>>>=2),u+n},s.prototype._zeroBits=function(t){if(t===0)return 26;var n=t,u=0;return n&8191||(u+=13,n>>>=13),n&127||(u+=7,n>>>=7),n&15||(u+=4,n>>>=4),n&3||(u+=2,n>>>=2),n&1||u++,u},s.prototype.bitLength=function(){var t=this.words[this.length-1],n=this._countBits(t);return (this.length-1)*26+n};function $(y){for(var t=new Array(y.bitLength()),n=0;n<t.length;n++){var u=n/26|0,f=n%26;t[n]=y.words[u]>>>f&1;}return t}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,n=0;n<this.length;n++){var u=this._zeroBits(this.words[n]);if(t+=u,u!==26)break}return t},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(t){return this.negative!==0?this.abs().inotn(t).iaddn(1):this.clone()},s.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},s.prototype.isNeg=function(){return this.negative!==0},s.prototype.neg=function(){return this.clone().ineg()},s.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},s.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var n=0;n<t.length;n++)this.words[n]=this.words[n]|t.words[n];return this._strip()},s.prototype.ior=function(t){return h((this.negative|t.negative)===0),this.iuor(t)},s.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},s.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},s.prototype.iuand=function(t){var n;this.length>t.length?n=t:n=this;for(var u=0;u<n.length;u++)this.words[u]=this.words[u]&t.words[u];return this.length=n.length,this._strip()},s.prototype.iand=function(t){return h((this.negative|t.negative)===0),this.iuand(t)},s.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},s.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},s.prototype.iuxor=function(t){var n,u;this.length>t.length?(n=this,u=t):(n=t,u=this);for(var f=0;f<u.length;f++)this.words[f]=n.words[f]^u.words[f];if(this!==n)for(;f<n.length;f++)this.words[f]=n.words[f];return this.length=n.length,this._strip()},s.prototype.ixor=function(t){return h((this.negative|t.negative)===0),this.iuxor(t)},s.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},s.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},s.prototype.inotn=function(t){h(typeof t=="number"&&t>=0);var n=Math.ceil(t/26)|0,u=t%26;this._expand(n),u>0&&n--;for(var f=0;f<n;f++)this.words[f]=~this.words[f]&67108863;return u>0&&(this.words[f]=~this.words[f]&67108863>>26-u),this._strip()},s.prototype.notn=function(t){return this.clone().inotn(t)},s.prototype.setn=function(t,n){h(typeof t=="number"&&t>=0);var u=t/26|0,f=t%26;return this._expand(u+1),n?this.words[u]=this.words[u]|1<<f:this.words[u]=this.words[u]&~(1<<f),this._strip()},s.prototype.iadd=function(t){var n;if(this.negative!==0&&t.negative===0)return this.negative=0,n=this.isub(t),this.negative^=1,this._normSign();if(this.negative===0&&t.negative!==0)return t.negative=0,n=this.isub(t),t.negative=1,n._normSign();var u,f;this.length>t.length?(u=this,f=t):(u=t,f=this);for(var m=0,E=0;E<f.length;E++)n=(u.words[E]|0)+(f.words[E]|0)+m,this.words[E]=n&67108863,m=n>>>26;for(;m!==0&&E<u.length;E++)n=(u.words[E]|0)+m,this.words[E]=n&67108863,m=n>>>26;if(this.length=u.length,m!==0)this.words[this.length]=m,this.length++;else if(u!==this)for(;E<u.length;E++)this.words[E]=u.words[E];return this},s.prototype.add=function(t){var n;return t.negative!==0&&this.negative===0?(t.negative=0,n=this.sub(t),t.negative^=1,n):t.negative===0&&this.negative!==0?(this.negative=0,n=t.sub(this),this.negative=1,n):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},s.prototype.isub=function(t){if(t.negative!==0){t.negative=0;var n=this.iadd(t);return t.negative=1,n._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var u=this.cmp(t);if(u===0)return this.negative=0,this.length=1,this.words[0]=0,this;var f,m;u>0?(f=this,m=t):(f=t,m=this);for(var E=0,M=0;M<m.length;M++)n=(f.words[M]|0)-(m.words[M]|0)+E,E=n>>26,this.words[M]=n&67108863;for(;E!==0&&M<f.length;M++)n=(f.words[M]|0)+E,E=n>>26,this.words[M]=n&67108863;if(E===0&&M<f.length&&f!==this)for(;M<f.length;M++)this.words[M]=f.words[M];return this.length=Math.max(this.length,M),f!==this&&(this.negative=1),this._strip()},s.prototype.sub=function(t){return this.clone().isub(t)};function q(y,t,n){n.negative=t.negative^y.negative;var u=y.length+t.length|0;n.length=u,u=u-1|0;var f=y.words[0]|0,m=t.words[0]|0,E=f*m,M=E&67108863,p=E/67108864|0;n.words[0]=M;for(var i=1;i<u;i++){for(var g=p>>>26,b=p&67108863,S=Math.min(i,t.length-1),N=Math.max(0,i-y.length+1);N<=S;N++){var D=i-N|0;f=y.words[D]|0,m=t.words[N]|0,E=f*m+b,g+=E/67108864|0,b=E&67108863;}n.words[i]=b|0,p=g|0;}return p!==0?n.words[i]=p|0:n.length--,n._strip()}var ct=function(t,n,u){var f=t.words,m=n.words,E=u.words,M=0,p,i,g,b=f[0]|0,S=b&8191,N=b>>>13,D=f[1]|0,J=D&8191,X=D>>>13,Ut=f[2]|0,Q=Ut&8191,j=Ut>>>13,Dt=f[3]|0,at=Dt&8191,st=Dt>>>13,$t=f[4]|0,lt=$t&8191,ht=$t>>>13,te=f[5]|0,rt=te&8191,Y=te>>>13,qt=f[6]|0,ut=qt&8191,tt=qt>>>13,ye=f[7]|0,l=ye&8191,e=ye>>>13,r=f[8]|0,c=r&8191,w=r>>>13,T=f[9]|0,C=T&8191,B=T>>>13,it=m[0]|0,V=it&8191,G=it>>>13,K=m[1]|0,pt=K&8191,dt=K>>>13,zr=m[2]|0,mt=zr&8191,gt=zr>>>13,jr=m[3]|0,yt=jr&8191,vt=jr>>>13,Yr=m[4]|0,wt=Yr&8191,Et=Yr>>>13,Kr=m[5]|0,Mt=Kr&8191,At=Kr>>>13,Xr=m[6]|0,Tt=Xr&8191,Ct=Xr>>>13,Qr=m[7]|0,It=Qr&8191,Rt=Qr>>>13,ti=m[8]|0,_t=ti&8191,xt=ti>>>13,ei=m[9]|0,bt=ei&8191,St=ei>>>13;u.negative=t.negative^n.negative,u.length=19,p=Math.imul(S,V),i=Math.imul(S,G),i=i+Math.imul(N,V)|0,g=Math.imul(N,G);var Ze=(M+p|0)+((i&8191)<<13)|0;M=(g+(i>>>13)|0)+(Ze>>>26)|0,Ze&=67108863,p=Math.imul(J,V),i=Math.imul(J,G),i=i+Math.imul(X,V)|0,g=Math.imul(X,G),p=p+Math.imul(S,pt)|0,i=i+Math.imul(S,dt)|0,i=i+Math.imul(N,pt)|0,g=g+Math.imul(N,dt)|0;var $e=(M+p|0)+((i&8191)<<13)|0;M=(g+(i>>>13)|0)+($e>>>26)|0,$e&=67108863,p=Math.imul(Q,V),i=Math.imul(Q,G),i=i+Math.imul(j,V)|0,g=Math.imul(j,G),p=p+Math.imul(J,pt)|0,i=i+Math.imul(J,dt)|0,i=i+Math.imul(X,pt)|0,g=g+Math.imul(X,dt)|0,p=p+Math.imul(S,mt)|0,i=i+Math.imul(S,gt)|0,i=i+Math.imul(N,mt)|0,g=g+Math.imul(N,gt)|0;var qe=(M+p|0)+((i&8191)<<13)|0;M=(g+(i>>>13)|0)+(qe>>>26)|0,qe&=67108863,p=Math.imul(at,V),i=Math.imul(at,G),i=i+Math.imul(st,V)|0,g=Math.imul(st,G),p=p+Math.imul(Q,pt)|0,i=i+Math.imul(Q,dt)|0,i=i+Math.imul(j,pt)|0,g=g+Math.imul(j,dt)|0,p=p+Math.imul(J,mt)|0,i=i+Math.imul(J,gt)|0,i=i+Math.imul(X,mt)|0,g=g+Math.imul(X,gt)|0,p=p+Math.imul(S,yt)|0,i=i+Math.imul(S,vt)|0,i=i+Math.imul(N,yt)|0,g=g+Math.imul(N,vt)|0;var Je=(M+p|0)+((i&8191)<<13)|0;M=(g+(i>>>13)|0)+(Je>>>26)|0,Je&=67108863,p=Math.imul(lt,V),i=Math.imul(lt,G),i=i+Math.imul(ht,V)|0,g=Math.imul(ht,G),p=p+Math.imul(at,pt)|0,i=i+Math.imul(at,dt)|0,i=i+Math.imul(st,pt)|0,g=g+Math.imul(st,dt)|0,p=p+Math.imul(Q,mt)|0,i=i+Math.imul(Q,gt)|0,i=i+Math.imul(j,mt)|0,g=g+Math.imul(j,gt)|0,p=p+Math.imul(J,yt)|0,i=i+Math.imul(J,vt)|0,i=i+Math.imul(X,yt)|0,g=g+Math.imul(X,vt)|0,p=p+Math.imul(S,wt)|0,i=i+Math.imul(S,Et)|0,i=i+Math.imul(N,wt)|0,g=g+Math.imul(N,Et)|0;var ze=(M+p|0)+((i&8191)<<13)|0;M=(g+(i>>>13)|0)+(ze>>>26)|0,ze&=67108863,p=Math.imul(rt,V),i=Math.imul(rt,G),i=i+Math.imul(Y,V)|0,g=Math.imul(Y,G),p=p+Math.imul(lt,pt)|0,i=i+Math.imul(lt,dt)|0,i=i+Math.imul(ht,pt)|0,g=g+Math.imul(ht,dt)|0,p=p+Math.imul(at,mt)|0,i=i+Math.imul(at,gt)|0,i=i+Math.imul(st,mt)|0,g=g+Math.imul(st,gt)|0,p=p+Math.imul(Q,yt)|0,i=i+Math.imul(Q,vt)|0,i=i+Math.imul(j,yt)|0,g=g+Math.imul(j,vt)|0,p=p+Math.imul(J,wt)|0,i=i+Math.imul(J,Et)|0,i=i+Math.imul(X,wt)|0,g=g+Math.imul(X,Et)|0,p=p+Math.imul(S,Mt)|0,i=i+Math.imul(S,At)|0,i=i+Math.imul(N,Mt)|0,g=g+Math.imul(N,At)|0;var je=(M+p|0)+((i&8191)<<13)|0;M=(g+(i>>>13)|0)+(je>>>26)|0,je&=67108863,p=Math.imul(ut,V),i=Math.imul(ut,G),i=i+Math.imul(tt,V)|0,g=Math.imul(tt,G),p=p+Math.imul(rt,pt)|0,i=i+Math.imul(rt,dt)|0,i=i+Math.imul(Y,pt)|0,g=g+Math.imul(Y,dt)|0,p=p+Math.imul(lt,mt)|0,i=i+Math.imul(lt,gt)|0,i=i+Math.imul(ht,mt)|0,g=g+Math.imul(ht,gt)|0,p=p+Math.imul(at,yt)|0,i=i+Math.imul(at,vt)|0,i=i+Math.imul(st,yt)|0,g=g+Math.imul(st,vt)|0,p=p+Math.imul(Q,wt)|0,i=i+Math.imul(Q,Et)|0,i=i+Math.imul(j,wt)|0,g=g+Math.imul(j,Et)|0,p=p+Math.imul(J,Mt)|0,i=i+Math.imul(J,At)|0,i=i+Math.imul(X,Mt)|0,g=g+Math.imul(X,At)|0,p=p+Math.imul(S,Tt)|0,i=i+Math.imul(S,Ct)|0,i=i+Math.imul(N,Tt)|0,g=g+Math.imul(N,Ct)|0;var Ye=(M+p|0)+((i&8191)<<13)|0;M=(g+(i>>>13)|0)+(Ye>>>26)|0,Ye&=67108863,p=Math.imul(l,V),i=Math.imul(l,G),i=i+Math.imul(e,V)|0,g=Math.imul(e,G),p=p+Math.imul(ut,pt)|0,i=i+Math.imul(ut,dt)|0,i=i+Math.imul(tt,pt)|0,g=g+Math.imul(tt,dt)|0,p=p+Math.imul(rt,mt)|0,i=i+Math.imul(rt,gt)|0,i=i+Math.imul(Y,mt)|0,g=g+Math.imul(Y,gt)|0,p=p+Math.imul(lt,yt)|0,i=i+Math.imul(lt,vt)|0,i=i+Math.imul(ht,yt)|0,g=g+Math.imul(ht,vt)|0,p=p+Math.imul(at,wt)|0,i=i+Math.imul(at,Et)|0,i=i+Math.imul(st,wt)|0,g=g+Math.imul(st,Et)|0,p=p+Math.imul(Q,Mt)|0,i=i+Math.imul(Q,At)|0,i=i+Math.imul(j,Mt)|0,g=g+Math.imul(j,At)|0,p=p+Math.imul(J,Tt)|0,i=i+Math.imul(J,Ct)|0,i=i+Math.imul(X,Tt)|0,g=g+Math.imul(X,Ct)|0,p=p+Math.imul(S,It)|0,i=i+Math.imul(S,Rt)|0,i=i+Math.imul(N,It)|0,g=g+Math.imul(N,Rt)|0;var Ke=(M+p|0)+((i&8191)<<13)|0;M=(g+(i>>>13)|0)+(Ke>>>26)|0,Ke&=67108863,p=Math.imul(c,V),i=Math.imul(c,G),i=i+Math.imul(w,V)|0,g=Math.imul(w,G),p=p+Math.imul(l,pt)|0,i=i+Math.imul(l,dt)|0,i=i+Math.imul(e,pt)|0,g=g+Math.imul(e,dt)|0,p=p+Math.imul(ut,mt)|0,i=i+Math.imul(ut,gt)|0,i=i+Math.imul(tt,mt)|0,g=g+Math.imul(tt,gt)|0,p=p+Math.imul(rt,yt)|0,i=i+Math.imul(rt,vt)|0,i=i+Math.imul(Y,yt)|0,g=g+Math.imul(Y,vt)|0,p=p+Math.imul(lt,wt)|0,i=i+Math.imul(lt,Et)|0,i=i+Math.imul(ht,wt)|0,g=g+Math.imul(ht,Et)|0,p=p+Math.imul(at,Mt)|0,i=i+Math.imul(at,At)|0,i=i+Math.imul(st,Mt)|0,g=g+Math.imul(st,At)|0,p=p+Math.imul(Q,Tt)|0,i=i+Math.imul(Q,Ct)|0,i=i+Math.imul(j,Tt)|0,g=g+Math.imul(j,Ct)|0,p=p+Math.imul(J,It)|0,i=i+Math.imul(J,Rt)|0,i=i+Math.imul(X,It)|0,g=g+Math.imul(X,Rt)|0,p=p+Math.imul(S,_t)|0,i=i+Math.imul(S,xt)|0,i=i+Math.imul(N,_t)|0,g=g+Math.imul(N,xt)|0;var Xe=(M+p|0)+((i&8191)<<13)|0;M=(g+(i>>>13)|0)+(Xe>>>26)|0,Xe&=67108863,p=Math.imul(C,V),i=Math.imul(C,G),i=i+Math.imul(B,V)|0,g=Math.imul(B,G),p=p+Math.imul(c,pt)|0,i=i+Math.imul(c,dt)|0,i=i+Math.imul(w,pt)|0,g=g+Math.imul(w,dt)|0,p=p+Math.imul(l,mt)|0,i=i+Math.imul(l,gt)|0,i=i+Math.imul(e,mt)|0,g=g+Math.imul(e,gt)|0,p=p+Math.imul(ut,yt)|0,i=i+Math.imul(ut,vt)|0,i=i+Math.imul(tt,yt)|0,g=g+Math.imul(tt,vt)|0,p=p+Math.imul(rt,wt)|0,i=i+Math.imul(rt,Et)|0,i=i+Math.imul(Y,wt)|0,g=g+Math.imul(Y,Et)|0,p=p+Math.imul(lt,Mt)|0,i=i+Math.imul(lt,At)|0,i=i+Math.imul(ht,Mt)|0,g=g+Math.imul(ht,At)|0,p=p+Math.imul(at,Tt)|0,i=i+Math.imul(at,Ct)|0,i=i+Math.imul(st,Tt)|0,g=g+Math.imul(st,Ct)|0,p=p+Math.imul(Q,It)|0,i=i+Math.imul(Q,Rt)|0,i=i+Math.imul(j,It)|0,g=g+Math.imul(j,Rt)|0,p=p+Math.imul(J,_t)|0,i=i+Math.imul(J,xt)|0,i=i+Math.imul(X,_t)|0,g=g+Math.imul(X,xt)|0,p=p+Math.imul(S,bt)|0,i=i+Math.imul(S,St)|0,i=i+Math.imul(N,bt)|0,g=g+Math.imul(N,St)|0;var Qe=(M+p|0)+((i&8191)<<13)|0;M=(g+(i>>>13)|0)+(Qe>>>26)|0,Qe&=67108863,p=Math.imul(C,pt),i=Math.imul(C,dt),i=i+Math.imul(B,pt)|0,g=Math.imul(B,dt),p=p+Math.imul(c,mt)|0,i=i+Math.imul(c,gt)|0,i=i+Math.imul(w,mt)|0,g=g+Math.imul(w,gt)|0,p=p+Math.imul(l,yt)|0,i=i+Math.imul(l,vt)|0,i=i+Math.imul(e,yt)|0,g=g+Math.imul(e,vt)|0,p=p+Math.imul(ut,wt)|0,i=i+Math.imul(ut,Et)|0,i=i+Math.imul(tt,wt)|0,g=g+Math.imul(tt,Et)|0,p=p+Math.imul(rt,Mt)|0,i=i+Math.imul(rt,At)|0,i=i+Math.imul(Y,Mt)|0,g=g+Math.imul(Y,At)|0,p=p+Math.imul(lt,Tt)|0,i=i+Math.imul(lt,Ct)|0,i=i+Math.imul(ht,Tt)|0,g=g+Math.imul(ht,Ct)|0,p=p+Math.imul(at,It)|0,i=i+Math.imul(at,Rt)|0,i=i+Math.imul(st,It)|0,g=g+Math.imul(st,Rt)|0,p=p+Math.imul(Q,_t)|0,i=i+Math.imul(Q,xt)|0,i=i+Math.imul(j,_t)|0,g=g+Math.imul(j,xt)|0,p=p+Math.imul(J,bt)|0,i=i+Math.imul(J,St)|0,i=i+Math.imul(X,bt)|0,g=g+Math.imul(X,St)|0;var tr=(M+p|0)+((i&8191)<<13)|0;M=(g+(i>>>13)|0)+(tr>>>26)|0,tr&=67108863,p=Math.imul(C,mt),i=Math.imul(C,gt),i=i+Math.imul(B,mt)|0,g=Math.imul(B,gt),p=p+Math.imul(c,yt)|0,i=i+Math.imul(c,vt)|0,i=i+Math.imul(w,yt)|0,g=g+Math.imul(w,vt)|0,p=p+Math.imul(l,wt)|0,i=i+Math.imul(l,Et)|0,i=i+Math.imul(e,wt)|0,g=g+Math.imul(e,Et)|0,p=p+Math.imul(ut,Mt)|0,i=i+Math.imul(ut,At)|0,i=i+Math.imul(tt,Mt)|0,g=g+Math.imul(tt,At)|0,p=p+Math.imul(rt,Tt)|0,i=i+Math.imul(rt,Ct)|0,i=i+Math.imul(Y,Tt)|0,g=g+Math.imul(Y,Ct)|0,p=p+Math.imul(lt,It)|0,i=i+Math.imul(lt,Rt)|0,i=i+Math.imul(ht,It)|0,g=g+Math.imul(ht,Rt)|0,p=p+Math.imul(at,_t)|0,i=i+Math.imul(at,xt)|0,i=i+Math.imul(st,_t)|0,g=g+Math.imul(st,xt)|0,p=p+Math.imul(Q,bt)|0,i=i+Math.imul(Q,St)|0,i=i+Math.imul(j,bt)|0,g=g+Math.imul(j,St)|0;var er=(M+p|0)+((i&8191)<<13)|0;M=(g+(i>>>13)|0)+(er>>>26)|0,er&=67108863,p=Math.imul(C,yt),i=Math.imul(C,vt),i=i+Math.imul(B,yt)|0,g=Math.imul(B,vt),p=p+Math.imul(c,wt)|0,i=i+Math.imul(c,Et)|0,i=i+Math.imul(w,wt)|0,g=g+Math.imul(w,Et)|0,p=p+Math.imul(l,Mt)|0,i=i+Math.imul(l,At)|0,i=i+Math.imul(e,Mt)|0,g=g+Math.imul(e,At)|0,p=p+Math.imul(ut,Tt)|0,i=i+Math.imul(ut,Ct)|0,i=i+Math.imul(tt,Tt)|0,g=g+Math.imul(tt,Ct)|0,p=p+Math.imul(rt,It)|0,i=i+Math.imul(rt,Rt)|0,i=i+Math.imul(Y,It)|0,g=g+Math.imul(Y,Rt)|0,p=p+Math.imul(lt,_t)|0,i=i+Math.imul(lt,xt)|0,i=i+Math.imul(ht,_t)|0,g=g+Math.imul(ht,xt)|0,p=p+Math.imul(at,bt)|0,i=i+Math.imul(at,St)|0,i=i+Math.imul(st,bt)|0,g=g+Math.imul(st,St)|0;var rr=(M+p|0)+((i&8191)<<13)|0;M=(g+(i>>>13)|0)+(rr>>>26)|0,rr&=67108863,p=Math.imul(C,wt),i=Math.imul(C,Et),i=i+Math.imul(B,wt)|0,g=Math.imul(B,Et),p=p+Math.imul(c,Mt)|0,i=i+Math.imul(c,At)|0,i=i+Math.imul(w,Mt)|0,g=g+Math.imul(w,At)|0,p=p+Math.imul(l,Tt)|0,i=i+Math.imul(l,Ct)|0,i=i+Math.imul(e,Tt)|0,g=g+Math.imul(e,Ct)|0,p=p+Math.imul(ut,It)|0,i=i+Math.imul(ut,Rt)|0,i=i+Math.imul(tt,It)|0,g=g+Math.imul(tt,Rt)|0,p=p+Math.imul(rt,_t)|0,i=i+Math.imul(rt,xt)|0,i=i+Math.imul(Y,_t)|0,g=g+Math.imul(Y,xt)|0,p=p+Math.imul(lt,bt)|0,i=i+Math.imul(lt,St)|0,i=i+Math.imul(ht,bt)|0,g=g+Math.imul(ht,St)|0;var ir=(M+p|0)+((i&8191)<<13)|0;M=(g+(i>>>13)|0)+(ir>>>26)|0,ir&=67108863,p=Math.imul(C,Mt),i=Math.imul(C,At),i=i+Math.imul(B,Mt)|0,g=Math.imul(B,At),p=p+Math.imul(c,Tt)|0,i=i+Math.imul(c,Ct)|0,i=i+Math.imul(w,Tt)|0,g=g+Math.imul(w,Ct)|0,p=p+Math.imul(l,It)|0,i=i+Math.imul(l,Rt)|0,i=i+Math.imul(e,It)|0,g=g+Math.imul(e,Rt)|0,p=p+Math.imul(ut,_t)|0,i=i+Math.imul(ut,xt)|0,i=i+Math.imul(tt,_t)|0,g=g+Math.imul(tt,xt)|0,p=p+Math.imul(rt,bt)|0,i=i+Math.imul(rt,St)|0,i=i+Math.imul(Y,bt)|0,g=g+Math.imul(Y,St)|0;var nr=(M+p|0)+((i&8191)<<13)|0;M=(g+(i>>>13)|0)+(nr>>>26)|0,nr&=67108863,p=Math.imul(C,Tt),i=Math.imul(C,Ct),i=i+Math.imul(B,Tt)|0,g=Math.imul(B,Ct),p=p+Math.imul(c,It)|0,i=i+Math.imul(c,Rt)|0,i=i+Math.imul(w,It)|0,g=g+Math.imul(w,Rt)|0,p=p+Math.imul(l,_t)|0,i=i+Math.imul(l,xt)|0,i=i+Math.imul(e,_t)|0,g=g+Math.imul(e,xt)|0,p=p+Math.imul(ut,bt)|0,i=i+Math.imul(ut,St)|0,i=i+Math.imul(tt,bt)|0,g=g+Math.imul(tt,St)|0;var or=(M+p|0)+((i&8191)<<13)|0;M=(g+(i>>>13)|0)+(or>>>26)|0,or&=67108863,p=Math.imul(C,It),i=Math.imul(C,Rt),i=i+Math.imul(B,It)|0,g=Math.imul(B,Rt),p=p+Math.imul(c,_t)|0,i=i+Math.imul(c,xt)|0,i=i+Math.imul(w,_t)|0,g=g+Math.imul(w,xt)|0,p=p+Math.imul(l,bt)|0,i=i+Math.imul(l,St)|0,i=i+Math.imul(e,bt)|0,g=g+Math.imul(e,St)|0;var ar=(M+p|0)+((i&8191)<<13)|0;M=(g+(i>>>13)|0)+(ar>>>26)|0,ar&=67108863,p=Math.imul(C,_t),i=Math.imul(C,xt),i=i+Math.imul(B,_t)|0,g=Math.imul(B,xt),p=p+Math.imul(c,bt)|0,i=i+Math.imul(c,St)|0,i=i+Math.imul(w,bt)|0,g=g+Math.imul(w,St)|0;var sr=(M+p|0)+((i&8191)<<13)|0;M=(g+(i>>>13)|0)+(sr>>>26)|0,sr&=67108863,p=Math.imul(C,bt),i=Math.imul(C,St),i=i+Math.imul(B,bt)|0,g=Math.imul(B,St);var lr=(M+p|0)+((i&8191)<<13)|0;return M=(g+(i>>>13)|0)+(lr>>>26)|0,lr&=67108863,E[0]=Ze,E[1]=$e,E[2]=qe,E[3]=Je,E[4]=ze,E[5]=je,E[6]=Ye,E[7]=Ke,E[8]=Xe,E[9]=Qe,E[10]=tr,E[11]=er,E[12]=rr,E[13]=ir,E[14]=nr,E[15]=or,E[16]=ar,E[17]=sr,E[18]=lr,M!==0&&(E[19]=M,u.length++),u};Math.imul||(ct=q);function et(y,t,n){n.negative=t.negative^y.negative,n.length=y.length+t.length;for(var u=0,f=0,m=0;m<n.length-1;m++){var E=f;f=0;for(var M=u&67108863,p=Math.min(m,t.length-1),i=Math.max(0,m-y.length+1);i<=p;i++){var g=m-i,b=y.words[g]|0,S=t.words[i]|0,N=b*S,D=N&67108863;E=E+(N/67108864|0)|0,D=D+M|0,M=D&67108863,E=E+(D>>>26)|0,f+=E>>>26,E&=67108863;}n.words[m]=M,u=E,E=f;}return u!==0?n.words[m]=u:n.length--,n._strip()}function Bt(y,t,n){return et(y,t,n)}s.prototype.mulTo=function(t,n){var u,f=this.length+t.length;return this.length===10&&t.length===10?u=ct(this,t,n):f<63?u=q(this,t,n):f<1024?u=et(this,t,n):u=Bt(this,t,n),u};s.prototype.mul=function(t){var n=new s(null);return n.words=new Array(this.length+t.length),this.mulTo(t,n)},s.prototype.mulf=function(t){var n=new s(null);return n.words=new Array(this.length+t.length),Bt(this,t,n)},s.prototype.imul=function(t){return this.clone().mulTo(t,this)},s.prototype.imuln=function(t){var n=t<0;n&&(t=-t),h(typeof t=="number"),h(t<67108864);for(var u=0,f=0;f<this.length;f++){var m=(this.words[f]|0)*t,E=(m&67108863)+(u&67108863);u>>=26,u+=m/67108864|0,u+=E>>>26,this.words[f]=E&67108863;}return u!==0&&(this.words[f]=u,this.length++),n?this.ineg():this},s.prototype.muln=function(t){return this.clone().imuln(t)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(t){var n=$(t);if(n.length===0)return new s(1);for(var u=this,f=0;f<n.length&&n[f]===0;f++,u=u.sqr());if(++f<n.length)for(var m=u.sqr();f<n.length;f++,m=m.sqr())n[f]!==0&&(u=u.mul(m));return u},s.prototype.iushln=function(t){h(typeof t=="number"&&t>=0);var n=t%26,u=(t-n)/26,f=67108863>>>26-n<<26-n,m;if(n!==0){var E=0;for(m=0;m<this.length;m++){var M=this.words[m]&f,p=(this.words[m]|0)-M<<n;this.words[m]=p|E,E=M>>>26-n;}E&&(this.words[m]=E,this.length++);}if(u!==0){for(m=this.length-1;m>=0;m--)this.words[m+u]=this.words[m];for(m=0;m<u;m++)this.words[m]=0;this.length+=u;}return this._strip()},s.prototype.ishln=function(t){return h(this.negative===0),this.iushln(t)},s.prototype.iushrn=function(t,n,u){h(typeof t=="number"&&t>=0);var f;n?f=(n-n%26)/26:f=0;var m=t%26,E=Math.min((t-m)/26,this.length),M=67108863^67108863>>>m<<m,p=u;if(f-=E,f=Math.max(0,f),p){for(var i=0;i<E;i++)p.words[i]=this.words[i];p.length=E;}if(E!==0)if(this.length>E)for(this.length-=E,i=0;i<this.length;i++)this.words[i]=this.words[i+E];else this.words[0]=0,this.length=1;var g=0;for(i=this.length-1;i>=0&&(g!==0||i>=f);i--){var b=this.words[i]|0;this.words[i]=g<<26-m|b>>>m,g=b&M;}return p&&g!==0&&(p.words[p.length++]=g),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(t,n,u){return h(this.negative===0),this.iushrn(t,n,u)},s.prototype.shln=function(t){return this.clone().ishln(t)},s.prototype.ushln=function(t){return this.clone().iushln(t)},s.prototype.shrn=function(t){return this.clone().ishrn(t)},s.prototype.ushrn=function(t){return this.clone().iushrn(t)},s.prototype.testn=function(t){h(typeof t=="number"&&t>=0);var n=t%26,u=(t-n)/26,f=1<<n;if(this.length<=u)return !1;var m=this.words[u];return !!(m&f)},s.prototype.imaskn=function(t){h(typeof t=="number"&&t>=0);var n=t%26,u=(t-n)/26;if(h(this.negative===0,"imaskn works only with positive numbers"),this.length<=u)return this;if(n!==0&&u++,this.length=Math.min(u,this.length),n!==0){var f=67108863^67108863>>>n<<n;this.words[this.length-1]&=f;}return this._strip()},s.prototype.maskn=function(t){return this.clone().imaskn(t)},s.prototype.iaddn=function(t){return h(typeof t=="number"),h(t<67108864),t<0?this.isubn(-t):this.negative!==0?this.length===1&&(this.words[0]|0)<=t?(this.words[0]=t-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},s.prototype._iaddn=function(t){this.words[0]+=t;for(var n=0;n<this.length&&this.words[n]>=67108864;n++)this.words[n]-=67108864,n===this.length-1?this.words[n+1]=1:this.words[n+1]++;return this.length=Math.max(this.length,n+1),this},s.prototype.isubn=function(t){if(h(typeof t=="number"),h(t<67108864),t<0)return this.iaddn(-t);if(this.negative!==0)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var n=0;n<this.length&&this.words[n]<0;n++)this.words[n]+=67108864,this.words[n+1]-=1;return this._strip()},s.prototype.addn=function(t){return this.clone().iaddn(t)},s.prototype.subn=function(t){return this.clone().isubn(t)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(t,n,u){var f=t.length+u,m;this._expand(f);var E,M=0;for(m=0;m<t.length;m++){E=(this.words[m+u]|0)+M;var p=(t.words[m]|0)*n;E-=p&67108863,M=(E>>26)-(p/67108864|0),this.words[m+u]=E&67108863;}for(;m<this.length-u;m++)E=(this.words[m+u]|0)+M,M=E>>26,this.words[m+u]=E&67108863;if(M===0)return this._strip();for(h(M===-1),M=0,m=0;m<this.length;m++)E=-(this.words[m]|0)+M,M=E>>26,this.words[m]=E&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(t,n){var u=this.length-t.length,f=this.clone(),m=t,E=m.words[m.length-1]|0,M=this._countBits(E);u=26-M,u!==0&&(m=m.ushln(u),f.iushln(u),E=m.words[m.length-1]|0);var p=f.length-m.length,i;if(n!=="mod"){i=new s(null),i.length=p+1,i.words=new Array(i.length);for(var g=0;g<i.length;g++)i.words[g]=0;}var b=f.clone()._ishlnsubmul(m,1,p);b.negative===0&&(f=b,i&&(i.words[p]=1));for(var S=p-1;S>=0;S--){var N=(f.words[m.length+S]|0)*67108864+(f.words[m.length+S-1]|0);for(N=Math.min(N/E|0,67108863),f._ishlnsubmul(m,N,S);f.negative!==0;)N--,f.negative=0,f._ishlnsubmul(m,1,S),f.isZero()||(f.negative^=1);i&&(i.words[S]=N);}return i&&i._strip(),f._strip(),n!=="div"&&u!==0&&f.iushrn(u),{div:i||null,mod:f}},s.prototype.divmod=function(t,n,u){if(h(!t.isZero()),this.isZero())return {div:new s(0),mod:new s(0)};var f,m,E;return this.negative!==0&&t.negative===0?(E=this.neg().divmod(t,n),n!=="mod"&&(f=E.div.neg()),n!=="div"&&(m=E.mod.neg(),u&&m.negative!==0&&m.iadd(t)),{div:f,mod:m}):this.negative===0&&t.negative!==0?(E=this.divmod(t.neg(),n),n!=="mod"&&(f=E.div.neg()),{div:f,mod:E.mod}):this.negative&t.negative?(E=this.neg().divmod(t.neg(),n),n!=="div"&&(m=E.mod.neg(),u&&m.negative!==0&&m.isub(t)),{div:E.div,mod:m}):t.length>this.length||this.cmp(t)<0?{div:new s(0),mod:this}:t.length===1?n==="div"?{div:this.divn(t.words[0]),mod:null}:n==="mod"?{div:null,mod:new s(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new s(this.modrn(t.words[0]))}:this._wordDiv(t,n)},s.prototype.div=function(t){return this.divmod(t,"div",!1).div},s.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},s.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},s.prototype.divRound=function(t){var n=this.divmod(t);if(n.mod.isZero())return n.div;var u=n.div.negative!==0?n.mod.isub(t):n.mod,f=t.ushrn(1),m=t.andln(1),E=u.cmp(f);return E<0||m===1&&E===0?n.div:n.div.negative!==0?n.div.isubn(1):n.div.iaddn(1)},s.prototype.modrn=function(t){var n=t<0;n&&(t=-t),h(t<=67108863);for(var u=(1<<26)%t,f=0,m=this.length-1;m>=0;m--)f=(u*f+(this.words[m]|0))%t;return n?-f:f},s.prototype.modn=function(t){return this.modrn(t)},s.prototype.idivn=function(t){var n=t<0;n&&(t=-t),h(t<=67108863);for(var u=0,f=this.length-1;f>=0;f--){var m=(this.words[f]|0)+u*67108864;this.words[f]=m/t|0,u=m%t;}return this._strip(),n?this.ineg():this},s.prototype.divn=function(t){return this.clone().idivn(t)},s.prototype.egcd=function(t){h(t.negative===0),h(!t.isZero());var n=this,u=t.clone();n.negative!==0?n=n.umod(t):n=n.clone();for(var f=new s(1),m=new s(0),E=new s(0),M=new s(1),p=0;n.isEven()&&u.isEven();)n.iushrn(1),u.iushrn(1),++p;for(var i=u.clone(),g=n.clone();!n.isZero();){for(var b=0,S=1;!(n.words[0]&S)&&b<26;++b,S<<=1);if(b>0)for(n.iushrn(b);b-- >0;)(f.isOdd()||m.isOdd())&&(f.iadd(i),m.isub(g)),f.iushrn(1),m.iushrn(1);for(var N=0,D=1;!(u.words[0]&D)&&N<26;++N,D<<=1);if(N>0)for(u.iushrn(N);N-- >0;)(E.isOdd()||M.isOdd())&&(E.iadd(i),M.isub(g)),E.iushrn(1),M.iushrn(1);n.cmp(u)>=0?(n.isub(u),f.isub(E),m.isub(M)):(u.isub(n),E.isub(f),M.isub(m));}return {a:E,b:M,gcd:u.iushln(p)}},s.prototype._invmp=function(t){h(t.negative===0),h(!t.isZero());var n=this,u=t.clone();n.negative!==0?n=n.umod(t):n=n.clone();for(var f=new s(1),m=new s(0),E=u.clone();n.cmpn(1)>0&&u.cmpn(1)>0;){for(var M=0,p=1;!(n.words[0]&p)&&M<26;++M,p<<=1);if(M>0)for(n.iushrn(M);M-- >0;)f.isOdd()&&f.iadd(E),f.iushrn(1);for(var i=0,g=1;!(u.words[0]&g)&&i<26;++i,g<<=1);if(i>0)for(u.iushrn(i);i-- >0;)m.isOdd()&&m.iadd(E),m.iushrn(1);n.cmp(u)>=0?(n.isub(u),f.isub(m)):(u.isub(n),m.isub(f));}var b;return n.cmpn(1)===0?b=f:b=m,b.cmpn(0)<0&&b.iadd(t),b},s.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var n=this.clone(),u=t.clone();n.negative=0,u.negative=0;for(var f=0;n.isEven()&&u.isEven();f++)n.iushrn(1),u.iushrn(1);do{for(;n.isEven();)n.iushrn(1);for(;u.isEven();)u.iushrn(1);var m=n.cmp(u);if(m<0){var E=n;n=u,u=E;}else if(m===0||u.cmpn(1)===0)break;n.isub(u);}while(!0);return u.iushln(f)},s.prototype.invm=function(t){return this.egcd(t).a.umod(t)},s.prototype.isEven=function(){return (this.words[0]&1)===0},s.prototype.isOdd=function(){return (this.words[0]&1)===1},s.prototype.andln=function(t){return this.words[0]&t},s.prototype.bincn=function(t){h(typeof t=="number");var n=t%26,u=(t-n)/26,f=1<<n;if(this.length<=u)return this._expand(u+1),this.words[u]|=f,this;for(var m=f,E=u;m!==0&&E<this.length;E++){var M=this.words[E]|0;M+=m,m=M>>>26,M&=67108863,this.words[E]=M;}return m!==0&&(this.words[E]=m,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(t){var n=t<0;if(this.negative!==0&&!n)return -1;if(this.negative===0&&n)return 1;this._strip();var u;if(this.length>1)u=1;else {n&&(t=-t),h(t<=67108863,"Number is too big");var f=this.words[0]|0;u=f===t?0:f<t?-1:1;}return this.negative!==0?-u|0:u},s.prototype.cmp=function(t){if(this.negative!==0&&t.negative===0)return -1;if(this.negative===0&&t.negative!==0)return 1;var n=this.ucmp(t);return this.negative!==0?-n|0:n},s.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return -1;for(var n=0,u=this.length-1;u>=0;u--){var f=this.words[u]|0,m=t.words[u]|0;if(f!==m){f<m?n=-1:f>m&&(n=1);break}}return n},s.prototype.gtn=function(t){return this.cmpn(t)===1},s.prototype.gt=function(t){return this.cmp(t)===1},s.prototype.gten=function(t){return this.cmpn(t)>=0},s.prototype.gte=function(t){return this.cmp(t)>=0},s.prototype.ltn=function(t){return this.cmpn(t)===-1},s.prototype.lt=function(t){return this.cmp(t)===-1},s.prototype.lten=function(t){return this.cmpn(t)<=0},s.prototype.lte=function(t){return this.cmp(t)<=0},s.prototype.eqn=function(t){return this.cmpn(t)===0},s.prototype.eq=function(t){return this.cmp(t)===0},s.red=function(t){return new ot(t)},s.prototype.toRed=function(t){return h(!this.red,"Already a number in reduction context"),h(this.negative===0,"red works only with positives"),t.convertTo(this)._forceRed(t)},s.prototype.fromRed=function(){return h(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(t){return this.red=t,this},s.prototype.forceRed=function(t){return h(!this.red,"Already a number in reduction context"),this._forceRed(t)},s.prototype.redAdd=function(t){return h(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},s.prototype.redIAdd=function(t){return h(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},s.prototype.redSub=function(t){return h(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},s.prototype.redISub=function(t){return h(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},s.prototype.redShl=function(t){return h(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},s.prototype.redMul=function(t){return h(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},s.prototype.redIMul=function(t){return h(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},s.prototype.redSqr=function(){return h(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return h(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return h(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return h(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return h(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(t){return h(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var Pt={k256:null,p224:null,p192:null,p25519:null};function Nt(y,t){this.name=y,this.p=new s(t,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp();}Nt.prototype._tmp=function(){var t=new s(null);return t.words=new Array(Math.ceil(this.n/13)),t},Nt.prototype.ireduce=function(t){var n=t,u;do this.split(n,this.tmp),n=this.imulK(n),n=n.iadd(this.tmp),u=n.bitLength();while(u>this.n);var f=u<this.n?-1:n.ucmp(this.p);return f===0?(n.words[0]=0,n.length=1):f>0?n.isub(this.p):n.strip!==void 0?n.strip():n._strip(),n},Nt.prototype.split=function(t,n){t.iushrn(this.n,0,n);},Nt.prototype.imulK=function(t){return t.imul(this.k)};function Zt(){Nt.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f");}v(Zt,Nt),Zt.prototype.split=function(t,n){for(var u=4194303,f=Math.min(t.length,9),m=0;m<f;m++)n.words[m]=t.words[m];if(n.length=f,t.length<=9){t.words[0]=0,t.length=1;return}var E=t.words[9];for(n.words[n.length++]=E&u,m=10;m<t.length;m++){var M=t.words[m]|0;t.words[m-10]=(M&u)<<4|E>>>22,E=M;}E>>>=22,t.words[m-10]=E,E===0&&t.length>10?t.length-=10:t.length-=9;},Zt.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var n=0,u=0;u<t.length;u++){var f=t.words[u]|0;n+=f*977,t.words[u]=n&67108863,n=f*64+(n/67108864|0);}return t.words[t.length-1]===0&&(t.length--,t.words[t.length-1]===0&&t.length--),t};function me(){Nt.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001");}v(me,Nt);function ge(){Nt.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff");}v(ge,Nt);function Qt(){Nt.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed");}v(Qt,Nt),Qt.prototype.imulK=function(t){for(var n=0,u=0;u<t.length;u++){var f=(t.words[u]|0)*19+n,m=f&67108863;f>>>=26,t.words[u]=m,n=f;}return n!==0&&(t.words[t.length++]=n),t},s._prime=function(t){if(Pt[t])return Pt[t];var n;if(t==="k256")n=new Zt;else if(t==="p224")n=new me;else if(t==="p192")n=new ge;else if(t==="p25519")n=new Qt;else throw new Error("Unknown prime "+t);return Pt[t]=n,n};function ot(y){if(typeof y=="string"){var t=s._prime(y);this.m=t.p,this.prime=t;}else h(y.gtn(1),"modulus must be greater than 1"),this.m=y,this.prime=null;}ot.prototype._verify1=function(t){h(t.negative===0,"red works only with positives"),h(t.red,"red works only with red numbers");},ot.prototype._verify2=function(t,n){h((t.negative|n.negative)===0,"red works only with positives"),h(t.red&&t.red===n.red,"red works only with red numbers");},ot.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(O(t,t.umod(this.m)._forceRed(this)),t)},ot.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},ot.prototype.add=function(t,n){this._verify2(t,n);var u=t.add(n);return u.cmp(this.m)>=0&&u.isub(this.m),u._forceRed(this)},ot.prototype.iadd=function(t,n){this._verify2(t,n);var u=t.iadd(n);return u.cmp(this.m)>=0&&u.isub(this.m),u},ot.prototype.sub=function(t,n){this._verify2(t,n);var u=t.sub(n);return u.cmpn(0)<0&&u.iadd(this.m),u._forceRed(this)},ot.prototype.isub=function(t,n){this._verify2(t,n);var u=t.isub(n);return u.cmpn(0)<0&&u.iadd(this.m),u},ot.prototype.shl=function(t,n){return this._verify1(t),this.imod(t.ushln(n))},ot.prototype.imul=function(t,n){return this._verify2(t,n),this.imod(t.imul(n))},ot.prototype.mul=function(t,n){return this._verify2(t,n),this.imod(t.mul(n))},ot.prototype.isqr=function(t){return this.imul(t,t.clone())},ot.prototype.sqr=function(t){return this.mul(t,t)},ot.prototype.sqrt=function(t){if(t.isZero())return t.clone();var n=this.m.andln(3);if(h(n%2===1),n===3){var u=this.m.add(new s(1)).iushrn(2);return this.pow(t,u)}for(var f=this.m.subn(1),m=0;!f.isZero()&&f.andln(1)===0;)m++,f.iushrn(1);h(!f.isZero());var E=new s(1).toRed(this),M=E.redNeg(),p=this.m.subn(1).iushrn(1),i=this.m.bitLength();for(i=new s(2*i*i).toRed(this);this.pow(i,p).cmp(M)!==0;)i.redIAdd(M);for(var g=this.pow(i,f),b=this.pow(t,f.addn(1).iushrn(1)),S=this.pow(t,f),N=m;S.cmp(E)!==0;){for(var D=S,J=0;D.cmp(E)!==0;J++)D=D.redSqr();h(J<N);var X=this.pow(g,new s(1).iushln(N-J-1));b=b.redMul(X),g=X.redSqr(),S=S.redMul(g),N=J;}return b},ot.prototype.invm=function(t){var n=t._invmp(this.m);return n.negative!==0?(n.negative=0,this.imod(n).redNeg()):this.imod(n)},ot.prototype.pow=function(t,n){if(n.isZero())return new s(1).toRed(this);if(n.cmpn(1)===0)return t.clone();var u=4,f=new Array(1<<u);f[0]=new s(1).toRed(this),f[1]=t;for(var m=2;m<f.length;m++)f[m]=this.mul(f[m-1],t);var E=f[0],M=0,p=0,i=n.bitLength()%26;for(i===0&&(i=26),m=n.length-1;m>=0;m--){for(var g=n.words[m],b=i-1;b>=0;b--){var S=g>>b&1;if(E!==f[0]&&(E=this.sqr(E)),S===0&&M===0){p=0;continue}M<<=1,M|=S,p++,!(p!==u&&(m!==0||b!==0))&&(E=this.mul(E,f[M]),p=0,M=0);}i=26;}return E},ot.prototype.convertTo=function(t){var n=t.umod(this.m);return n===t?n.clone():n},ot.prototype.convertFrom=function(t){var n=t.clone();return n.red=null,n},s.mont=function(t){return new Lt(t)};function Lt(y){ot.call(this,y),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv);}v(Lt,ot),Lt.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},Lt.prototype.convertFrom=function(t){var n=this.imod(t.mul(this.rinv));return n.red=null,n},Lt.prototype.imul=function(t,n){if(t.isZero()||n.isZero())return t.words[0]=0,t.length=1,t;var u=t.imul(n),f=u.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),m=u.isub(f).iushrn(this.shift),E=m;return m.cmp(this.m)>=0?E=m.isub(this.m):m.cmpn(0)<0&&(E=m.iadd(this.m)),E._forceRed(this)},Lt.prototype.mul=function(t,n){if(t.isZero()||n.isZero())return new s(0)._forceRed(this);var u=t.mul(n),f=u.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),m=u.isub(f).iushrn(this.shift),E=m;return m.cmp(this.m)>=0?E=m.isub(this.m):m.cmpn(0)<0&&(E=m.iadd(this.m)),E._forceRed(this)},Lt.prototype.invm=function(t){var n=this.imod(t._invmp(this.m).mul(this.r2));return n._forceRed(this)};})(typeof yr>"u"||yr,Mi);});var wr=ee((ps,Ii)=>{_();R();Ii.exports=vr;vr.strict=Ti;vr.loose=Ci;var Wn=Object.prototype.toString,Zn={"[object Int8Array]":!0,"[object Int16Array]":!0,"[object Int32Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Uint16Array]":!0,"[object Uint32Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0};function vr(o){return Ti(o)||Ci(o)}function Ti(o){return o instanceof Int8Array||o instanceof Int16Array||o instanceof Int32Array||o instanceof Uint8Array||o instanceof Uint8ClampedArray||o instanceof Uint16Array||o instanceof Uint32Array||o instanceof Float32Array||o instanceof Float64Array}function Ci(o){return Zn[Wn.call(o)]}});var _i=ee((gs,Ri)=>{_();R();var $n=wr().strict;Ri.exports=function(a){if($n(a)){var h=k.from(a.buffer);return a.byteLength!==a.buffer.byteLength&&(h=h.slice(a.byteOffset,a.byteOffset+a.byteLength)),h}else return k.from(a)};});var Gi=ee(U=>{_();R();var xi=U&&U.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(U,"__esModule",{value:!0});var qn=xi(wr()),Jn=xi(_i()),Er="hex",Mr="utf8",zn="binary",jn="buffer",Yn="array",Kn="typed-array",Xn="array-buffer",oe="0";function Ie(o){return new Uint8Array(o)}U.bufferToArray=Ie;function Ar(o,a=!1){let h=o.toString(Er);return a?Se(h):h}U.bufferToHex=Ar;function Tr(o){return o.toString(Mr)}U.bufferToUtf8=Tr;function bi(o){return o.readUIntBE(0,o.length)}U.bufferToNumber=bi;function Qn(o){return Re(Ie(o))}U.bufferToBinary=Qn;function ae(o){return Jn.default(o)}U.arrayToBuffer=ae;function Si(o,a=!1){return Ar(ae(o),a)}U.arrayToHex=Si;function Bi(o){return Tr(ae(o))}U.arrayToUtf8=Bi;function Cr(o){return bi(ae(o))}U.arrayToNumber=Cr;function Re(o){return Array.from(o).map(se).join("")}U.arrayToBinary=Re;function Ir(o){return k.from(be(o),Er)}U.hexToBuffer=Ir;function Rr(o){return Ie(Ir(o))}U.hexToArray=Rr;function to(o){return Tr(Ir(o))}U.hexToUtf8=to;function eo(o){return Cr(Rr(o))}U.hexToNumber=eo;function Pi(o){return Re(Rr(o))}U.hexToBinary=Pi;function _r(o){return k.from(o,Mr)}U.utf8ToBuffer=_r;function Ni(o){return Ie(_r(o))}U.utf8ToArray=Ni;function ro(o,a=!1){return Ar(_r(o),a)}U.utf8ToHex=ro;function io(o){let a=parseInt(o,10);return Co(To(a),"Number can only safely store up to 53 bits"),a}U.utf8ToNumber=io;function no(o){return Re(Ni(o))}U.utf8ToBinary=no;function oo(o){return Oi(se(o))}U.numberToBuffer=oo;function ao(o){return Jt(se(o))}U.numberToArray=ao;function so(o,a){return xr(se(o),a)}U.numberToHex=so;function lo(o){return `${o}`}U.numberToUtf8=lo;function se(o){let a=(o>>>0).toString(2);return xe(a)}U.numberToBinary=se;function Oi(o){return ae(Jt(o))}U.binaryToBuffer=Oi;function Jt(o){return new Uint8Array(Sr(o).map(a=>parseInt(a,2)))}U.binaryToArray=Jt;function xr(o,a){return Si(Jt(o),a)}U.binaryToHex=xr;function ho(o){return Bi(Jt(o))}U.binaryToUtf8=ho;function uo(o){return Cr(Jt(o))}U.binaryToNumber=uo;function Ui(o){return !(typeof o!="string"||!new RegExp(/^[01]+$/).test(o)||o.length%8!==0)}U.isBinaryString=Ui;function Li(o,a){return !(typeof o!="string"||!o.match(/^0x[0-9A-Fa-f]*$/)||a&&o.length!==2+2*a)}U.isHexString=Li;function _e(o){return k.isBuffer(o)}U.isBuffer=_e;function br(o){return qn.default.strict(o)&&!_e(o)}U.isTypedArray=br;function ki(o){return !br(o)&&!_e(o)&&typeof o.byteLength<"u"}U.isArrayBuffer=ki;function fo(o){return _e(o)?jn:br(o)?Kn:ki(o)?Xn:Array.isArray(o)?Yn:typeof o}U.getType=fo;function co(o){return Ui(o)?zn:Li(o)?Er:Mr}U.getEncoding=co;function po(...o){return k.concat(o)}U.concatBuffers=po;function mo(...o){let a=[];return o.forEach(h=>a=a.concat(Array.from(h))),new Uint8Array([...a])}U.concatArrays=mo;function go(o,a){let h=o.length-a;return h>0&&(o=o.slice(h)),o}U.trimLeft=go;function yo(o,a){return o.slice(0,a)}U.trimRight=yo;function Di(o,a=8){let h=o%a;return h?(o-h)/a*a+a:o}U.calcByteLength=Di;function Sr(o,a=8){let h=xe(o).match(new RegExp(`.{${a}}`,"gi"));return Array.from(h||[])}U.splitBytes=Sr;function Fi(o){return Sr(o).map(Io).join("")}U.swapBytes=Fi;function vo(o){return xr(Fi(Pi(o)))}U.swapHex=vo;function xe(o,a=8,h=oe){return Hi(o,Di(o.length,a),h)}U.sanitizeBytes=xe;function Hi(o,a,h=oe){return Vi(o,a,!0,h)}U.padLeft=Hi;function wo(o,a,h=oe){return Vi(o,a,!1,h)}U.padRight=wo;function be(o){return o.replace(/^0x/,"")}U.removeHexPrefix=be;function Se(o){return o.startsWith("0x")?o:`0x${o}`}U.addHexPrefix=Se;function Eo(o){return o=be(o),o=xe(o,2),o&&(o=Se(o)),o}U.sanitizeHex=Eo;function Mo(o){let a=o.startsWith("0x");return o=be(o),o=o.startsWith(oe)?o.substring(1):o,a?Se(o):o}U.removeHexLeadingZeros=Mo;function Ao(o){return typeof o>"u"}function To(o){return !Ao(o)}function Co(o,a){if(!o)throw new Error(a)}function Io(o){return o.split("").reverse().join("")}function Vi(o,a,h,v=oe){let s=a-o.length,A=o;if(s>0){let d=v.repeat(s);A=h?d+o:o+d;}return A}});_();R();_();R();_();R();_();R();_();R();var si=(a=>(a.ACCOUNTS_REQUESTED="accountsRequested",a))(si||{}),Sn=(a=>(a.ACCOUNTS_CHANGED="accountsChanged",a))(Sn||{}),Bn=(d=>(d.PENDING="PENDING",d.SUBMITTED="SUBMITTED",d.SUCCESSFUL="SUCCESSFUL",d.REVERTED="REVERTED",d.FAILED="FAILED",d.CANCELLED="CANCELLED",d))(Bn||{});_();R();var vi={};In(vi,{coerceNonceSpace:()=>gi,digestOfTransactionsAndNonce:()=>mi,encodeMessageSubDigest:()=>Me,encodeNonce:()=>yi,encodedTransactions:()=>dr,getEip155ChainId:()=>Ot,getNonce:()=>ie,getNormalisedTransactions:()=>Ee,packSignatures:()=>Te,signAndPackTypedData:()=>mr,signERC191Message:()=>gr,signMetaTransactions:()=>Ae});_();R();var ci=1,Fn=1,Hn=2,pi="02",Vn="",di=`tuple(
12
+ var vn=Object.create;var lr=Object.defineProperty;var wn=Object.getOwnPropertyDescriptor;var En=Object.getOwnPropertyNames;var Mn=Object.getPrototypeOf,Tn=Object.prototype.hasOwnProperty;var hr=(o,a)=>()=>(o&&(a=o(o=0)),a);var te=(o,a)=>()=>(a||o((a={exports:{}}).exports,a),a.exports),An=(o,a)=>{for(var u in a)lr(o,u,{get:a[u],enumerable:!0});},Cn=(o,a,u,v)=>{if(a&&typeof a=="object"||typeof a=="function")for(let s of En(a))!Tn.call(o,s)&&s!==u&&lr(o,s,{get:()=>a[s],enumerable:!(v=wn(a,s))||v.enumerable});return o};var ei=(o,a,u)=>(u=o!=null?vn(Mn(o)):{},Cn(lr(u,"default",{value:o,enumerable:!0}),o));var R=hr(()=>{});function In(){if(ri)return ee;ri=!0,ee.byteLength=I,ee.toByteArray=U,ee.fromByteArray=z;for(var o=[],a=[],u=typeof Uint8Array<"u"?Uint8Array:Array,v="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",s=0,T=v.length;s<T;++s)o[s]=v[s],a[v.charCodeAt(s)]=s;a[45]=62,a[95]=63;function d(P){var F=P.length;if(F%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var $=P.indexOf("=");$===-1&&($=F);var J=$===F?0:4-$%4;return [$,J]}function I(P){var F=d(P),$=F[0],J=F[1];return ($+J)*3/4-J}function b(P,F,$){return (F+$)*3/4-$}function U(P){var F,$=d(P),J=$[0],at=$[1],et=new u(b(P,J,at)),Pt=0,nt=at>0?J-4:J,Bt;for(Bt=0;Bt<nt;Bt+=4)F=a[P.charCodeAt(Bt)]<<18|a[P.charCodeAt(Bt+1)]<<12|a[P.charCodeAt(Bt+2)]<<6|a[P.charCodeAt(Bt+3)],et[Pt++]=F>>16&255,et[Pt++]=F>>8&255,et[Pt++]=F&255;return at===2&&(F=a[P.charCodeAt(Bt)]<<2|a[P.charCodeAt(Bt+1)]>>4,et[Pt++]=F&255),at===1&&(F=a[P.charCodeAt(Bt)]<<10|a[P.charCodeAt(Bt+1)]<<4|a[P.charCodeAt(Bt+2)]>>2,et[Pt++]=F>>8&255,et[Pt++]=F&255),et}function k(P){return o[P>>18&63]+o[P>>12&63]+o[P>>6&63]+o[P&63]}function Z(P,F,$){for(var J,at=[],et=F;et<$;et+=3)J=(P[et]<<16&16711680)+(P[et+1]<<8&65280)+(P[et+2]&255),at.push(k(J));return at.join("")}function z(P){for(var F,$=P.length,J=$%3,at=[],et=16383,Pt=0,nt=$-J;Pt<nt;Pt+=et)at.push(Z(P,Pt,Pt+et>nt?nt:Pt+et));return J===1?(F=P[$-1],at.push(o[F>>2]+o[F<<4&63]+"==")):J===2&&(F=(P[$-2]<<8)+P[$-1],at.push(o[F>>10]+o[F>>4&63]+o[F<<2&63]+"=")),at.join("")}return ee}function Rn(){if(ii)return ye;ii=!0;return ye.read=function(o,a,u,v,s){var T,d,I=s*8-v-1,b=(1<<I)-1,U=b>>1,k=-7,Z=u?s-1:0,z=u?-1:1,P=o[a+Z];for(Z+=z,T=P&(1<<-k)-1,P>>=-k,k+=I;k>0;T=T*256+o[a+Z],Z+=z,k-=8);for(d=T&(1<<-k)-1,T>>=-k,k+=v;k>0;d=d*256+o[a+Z],Z+=z,k-=8);if(T===0)T=1-U;else {if(T===b)return d?NaN:(P?-1:1)*(1/0);d=d+Math.pow(2,v),T=T-U;}return (P?-1:1)*d*Math.pow(2,T-v)},ye.write=function(o,a,u,v,s,T){var d,I,b,U=T*8-s-1,k=(1<<U)-1,Z=k>>1,z=s===23?Math.pow(2,-24)-Math.pow(2,-77):0,P=v?0:T-1,F=v?1:-1,$=a<0||a===0&&1/a<0?1:0;for(a=Math.abs(a),isNaN(a)||a===1/0?(I=isNaN(a)?1:0,d=k):(d=Math.floor(Math.log(a)/Math.LN2),a*(b=Math.pow(2,-d))<1&&(d--,b*=2),d+Z>=1?a+=z/b:a+=z*Math.pow(2,1-Z),a*b>=2&&(d++,b/=2),d+Z>=k?(I=0,d=k):d+Z>=1?(I=(a*b-1)*Math.pow(2,s),d=d+Z):(I=a*Math.pow(2,Z-1)*Math.pow(2,s),d=0));s>=8;o[u+P]=I&255,P+=F,I/=256,s-=8);for(d=d<<s|I,U+=s;U>0;o[u+P]=d&255,P+=F,d/=256,U-=8);o[u+P-F]|=$*128;},ye}function _n(){if(ni)return Gt;ni=!0;let o=In(),a=Rn(),u=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;Gt.Buffer=d,Gt.SlowBuffer=at,Gt.INSPECT_MAX_BYTES=50;let v=2147483647;Gt.kMaxLength=v,d.TYPED_ARRAY_SUPPORT=s(),!d.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function s(){try{let l=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(l,e),l.foo()===42}catch{return !1}}Object.defineProperty(d.prototype,"parent",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.buffer}}),Object.defineProperty(d.prototype,"offset",{enumerable:!0,get:function(){if(d.isBuffer(this))return this.byteOffset}});function T(l){if(l>v)throw new RangeError('The value "'+l+'" is invalid for option "size"');let e=new Uint8Array(l);return Object.setPrototypeOf(e,d.prototype),e}function d(l,e,r){if(typeof l=="number"){if(typeof e=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return k(l)}return I(l,e,r)}d.poolSize=8192;function I(l,e,r){if(typeof l=="string")return Z(l,e);if(ArrayBuffer.isView(l))return P(l);if(l==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof l);if(j(l,ArrayBuffer)||l&&j(l.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(j(l,SharedArrayBuffer)||l&&j(l.buffer,SharedArrayBuffer)))return F(l,e,r);if(typeof l=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');let c=l.valueOf&&l.valueOf();if(c!=null&&c!==l)return d.from(c,e,r);let w=$(l);if(w)return w;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof l[Symbol.toPrimitive]=="function")return d.from(l[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof l)}d.from=function(l,e,r){return I(l,e,r)},Object.setPrototypeOf(d.prototype,Uint8Array.prototype),Object.setPrototypeOf(d,Uint8Array);function b(l){if(typeof l!="number")throw new TypeError('"size" argument must be of type number');if(l<0)throw new RangeError('The value "'+l+'" is invalid for option "size"')}function U(l,e,r){return b(l),l<=0?T(l):e!==void 0?typeof r=="string"?T(l).fill(e,r):T(l).fill(e):T(l)}d.alloc=function(l,e,r){return U(l,e,r)};function k(l){return b(l),T(l<0?0:J(l)|0)}d.allocUnsafe=function(l){return k(l)},d.allocUnsafeSlow=function(l){return k(l)};function Z(l,e){if((typeof e!="string"||e==="")&&(e="utf8"),!d.isEncoding(e))throw new TypeError("Unknown encoding: "+e);let r=et(l,e)|0,c=T(r),w=c.write(l,e);return w!==r&&(c=c.slice(0,w)),c}function z(l){let e=l.length<0?0:J(l.length)|0,r=T(e);for(let c=0;c<e;c+=1)r[c]=l[c]&255;return r}function P(l){if(j(l,Uint8Array)){let e=new Uint8Array(l);return F(e.buffer,e.byteOffset,e.byteLength)}return z(l)}function F(l,e,r){if(e<0||l.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(l.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let c;return e===void 0&&r===void 0?c=new Uint8Array(l):r===void 0?c=new Uint8Array(l,e):c=new Uint8Array(l,e,r),Object.setPrototypeOf(c,d.prototype),c}function $(l){if(d.isBuffer(l)){let e=J(l.length)|0,r=T(e);return r.length===0||l.copy(r,0,0,e),r}if(l.length!==void 0)return typeof l.length!="number"||qt(l.length)?T(0):z(l);if(l.type==="Buffer"&&Array.isArray(l.data))return z(l.data)}function J(l){if(l>=v)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+v.toString(16)+" bytes");return l|0}function at(l){return +l!=l&&(l=0),d.alloc(+l)}d.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==d.prototype},d.compare=function(e,r){if(j(e,Uint8Array)&&(e=d.from(e,e.offset,e.byteLength)),j(r,Uint8Array)&&(r=d.from(r,r.offset,r.byteLength)),!d.isBuffer(e)||!d.isBuffer(r))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===r)return 0;let c=e.length,w=r.length;for(let A=0,C=Math.min(c,w);A<C;++A)if(e[A]!==r[A]){c=e[A],w=r[A];break}return c<w?-1:w<c?1:0},d.isEncoding=function(e){switch(String(e).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return !0;default:return !1}},d.concat=function(e,r){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(e.length===0)return d.alloc(0);let c;if(r===void 0)for(r=0,c=0;c<e.length;++c)r+=e[c].length;let w=d.allocUnsafe(r),A=0;for(c=0;c<e.length;++c){let C=e[c];if(j(C,Uint8Array))A+C.length>w.length?(d.isBuffer(C)||(C=d.from(C)),C.copy(w,A)):Uint8Array.prototype.set.call(w,C,A);else if(d.isBuffer(C))C.copy(w,A);else throw new TypeError('"list" argument must be an Array of Buffers');A+=C.length;}return w};function et(l,e){if(d.isBuffer(l))return l.length;if(ArrayBuffer.isView(l)||j(l,ArrayBuffer))return l.byteLength;if(typeof l!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof l);let r=l.length,c=arguments.length>2&&arguments[2]===!0;if(!c&&r===0)return 0;let w=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return $t(l).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return r*2;case"hex":return r>>>1;case"base64":return Qt(l).length;default:if(w)return c?-1:$t(l).length;e=(""+e).toLowerCase(),w=!0;}}d.byteLength=et;function Pt(l,e,r){let c=!1;if((e===void 0||e<0)&&(e=0),e>this.length||((r===void 0||r>this.length)&&(r=this.length),r<=0)||(r>>>=0,e>>>=0,r<=e))return "";for(l||(l="utf8");;)switch(l){case"hex":return m(this,e,r);case"utf8":case"utf-8":return y(this,e,r);case"ascii":return h(this,e,r);case"latin1":case"binary":return f(this,e,r);case"base64":return kt(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,e,r);default:if(c)throw new TypeError("Unknown encoding: "+l);l=(l+"").toLowerCase(),c=!0;}}d.prototype._isBuffer=!0;function nt(l,e,r){let c=l[e];l[e]=l[r],l[r]=c;}d.prototype.swap16=function(){let e=this.length;if(e%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let r=0;r<e;r+=2)nt(this,r,r+1);return this},d.prototype.swap32=function(){let e=this.length;if(e%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let r=0;r<e;r+=4)nt(this,r,r+3),nt(this,r+1,r+2);return this},d.prototype.swap64=function(){let e=this.length;if(e%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let r=0;r<e;r+=8)nt(this,r,r+7),nt(this,r+1,r+6),nt(this,r+2,r+5),nt(this,r+3,r+4);return this},d.prototype.toString=function(){let e=this.length;return e===0?"":arguments.length===0?y(this,0,e):Pt.apply(this,arguments)},d.prototype.toLocaleString=d.prototype.toString,d.prototype.equals=function(e){if(!d.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e?!0:d.compare(this,e)===0},d.prototype.inspect=function(){let e="",r=Gt.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},u&&(d.prototype[u]=d.prototype.inspect),d.prototype.compare=function(e,r,c,w,A){if(j(e,Uint8Array)&&(e=d.from(e,e.offset,e.byteLength)),!d.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(r===void 0&&(r=0),c===void 0&&(c=e?e.length:0),w===void 0&&(w=0),A===void 0&&(A=this.length),r<0||c>e.length||w<0||A>this.length)throw new RangeError("out of range index");if(w>=A&&r>=c)return 0;if(w>=A)return -1;if(r>=c)return 1;if(r>>>=0,c>>>=0,w>>>=0,A>>>=0,this===e)return 0;let C=A-w,B=c-r,it=Math.min(C,B),V=this.slice(w,A),G=e.slice(r,c);for(let K=0;K<it;++K)if(V[K]!==G[K]){C=V[K],B=G[K];break}return C<B?-1:B<C?1:0};function Bt(l,e,r,c,w){if(l.length===0)return -1;if(typeof r=="string"?(c=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),r=+r,qt(r)&&(r=w?0:l.length-1),r<0&&(r=l.length+r),r>=l.length){if(w)return -1;r=l.length-1;}else if(r<0)if(w)r=0;else return -1;if(typeof e=="string"&&(e=d.from(e,c)),d.isBuffer(e))return e.length===0?-1:Nt(l,e,r,c,w);if(typeof e=="number")return e=e&255,typeof Uint8Array.prototype.indexOf=="function"?w?Uint8Array.prototype.indexOf.call(l,e,r):Uint8Array.prototype.lastIndexOf.call(l,e,r):Nt(l,[e],r,c,w);throw new TypeError("val must be string, number or Buffer")}function Nt(l,e,r,c,w){let A=1,C=l.length,B=e.length;if(c!==void 0&&(c=String(c).toLowerCase(),c==="ucs2"||c==="ucs-2"||c==="utf16le"||c==="utf-16le")){if(l.length<2||e.length<2)return -1;A=2,C/=2,B/=2,r/=2;}function it(G,K){return A===1?G[K]:G.readUInt16BE(K*A)}let V;if(w){let G=-1;for(V=r;V<C;V++)if(it(l,V)===it(e,G===-1?0:V-G)){if(G===-1&&(G=V),V-G+1===B)return G*A}else G!==-1&&(V-=V-G),G=-1;}else for(r+B>C&&(r=C-B),V=r;V>=0;V--){let G=!0;for(let K=0;K<B;K++)if(it(l,V+K)!==it(e,K)){G=!1;break}if(G)return V}return -1}d.prototype.includes=function(e,r,c){return this.indexOf(e,r,c)!==-1},d.prototype.indexOf=function(e,r,c){return Bt(this,e,r,c,!0)},d.prototype.lastIndexOf=function(e,r,c){return Bt(this,e,r,c,!1)};function Zt(l,e,r,c){r=Number(r)||0;let w=l.length-r;c?(c=Number(c),c>w&&(c=w)):c=w;let A=e.length;c>A/2&&(c=A/2);let C;for(C=0;C<c;++C){let B=parseInt(e.substr(C*2,2),16);if(qt(B))return C;l[r+C]=B;}return C}function de(l,e,r,c){return rt($t(e,l.length-r),l,r,c)}function me(l,e,r,c){return rt(ht(e),l,r,c)}function Xt(l,e,r,c){return rt(Qt(e),l,r,c)}function ot(l,e,r,c){return rt(ut(e,l.length-r),l,r,c)}d.prototype.write=function(e,r,c,w){if(r===void 0)w="utf8",c=this.length,r=0;else if(c===void 0&&typeof r=="string")w=r,c=this.length,r=0;else if(isFinite(r))r=r>>>0,isFinite(c)?(c=c>>>0,w===void 0&&(w="utf8")):(w=c,c=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let A=this.length-r;if((c===void 0||c>A)&&(c=A),e.length>0&&(c<0||r<0)||r>this.length)throw new RangeError("Attempt to write outside buffer bounds");w||(w="utf8");let C=!1;for(;;)switch(w){case"hex":return Zt(this,e,r,c);case"utf8":case"utf-8":return de(this,e,r,c);case"ascii":case"latin1":case"binary":return me(this,e,r,c);case"base64":return Xt(this,e,r,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return ot(this,e,r,c);default:if(C)throw new TypeError("Unknown encoding: "+w);w=(""+w).toLowerCase(),C=!0;}},d.prototype.toJSON=function(){return {type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function kt(l,e,r){return e===0&&r===l.length?o.fromByteArray(l):o.fromByteArray(l.slice(e,r))}function y(l,e,r){r=Math.min(l.length,r);let c=[],w=e;for(;w<r;){let A=l[w],C=null,B=A>239?4:A>223?3:A>191?2:1;if(w+B<=r){let it,V,G,K;switch(B){case 1:A<128&&(C=A);break;case 2:it=l[w+1],(it&192)===128&&(K=(A&31)<<6|it&63,K>127&&(C=K));break;case 3:it=l[w+1],V=l[w+2],(it&192)===128&&(V&192)===128&&(K=(A&15)<<12|(it&63)<<6|V&63,K>2047&&(K<55296||K>57343)&&(C=K));break;case 4:it=l[w+1],V=l[w+2],G=l[w+3],(it&192)===128&&(V&192)===128&&(G&192)===128&&(K=(A&15)<<18|(it&63)<<12|(V&63)<<6|G&63,K>65535&&K<1114112&&(C=K));}}C===null?(C=65533,B=1):C>65535&&(C-=65536,c.push(C>>>10&1023|55296),C=56320|C&1023),c.push(C),w+=B;}return n(c)}let t=4096;function n(l){let e=l.length;if(e<=t)return String.fromCharCode.apply(String,l);let r="",c=0;for(;c<e;)r+=String.fromCharCode.apply(String,l.slice(c,c+=t));return r}function h(l,e,r){let c="";r=Math.min(l.length,r);for(let w=e;w<r;++w)c+=String.fromCharCode(l[w]&127);return c}function f(l,e,r){let c="";r=Math.min(l.length,r);for(let w=e;w<r;++w)c+=String.fromCharCode(l[w]);return c}function m(l,e,r){let c=l.length;(!e||e<0)&&(e=0),(!r||r<0||r>c)&&(r=c);let w="";for(let A=e;A<r;++A)w+=ft[l[A]];return w}function E(l,e,r){let c=l.slice(e,r),w="";for(let A=0;A<c.length-1;A+=2)w+=String.fromCharCode(c[A]+c[A+1]*256);return w}d.prototype.slice=function(e,r){let c=this.length;e=~~e,r=r===void 0?c:~~r,e<0?(e+=c,e<0&&(e=0)):e>c&&(e=c),r<0?(r+=c,r<0&&(r=0)):r>c&&(r=c),r<e&&(r=e);let w=this.subarray(e,r);return Object.setPrototypeOf(w,d.prototype),w};function M(l,e,r){if(l%1!==0||l<0)throw new RangeError("offset is not uint");if(l+e>r)throw new RangeError("Trying to access beyond buffer length")}d.prototype.readUintLE=d.prototype.readUIntLE=function(e,r,c){e=e>>>0,r=r>>>0,c||M(e,r,this.length);let w=this[e],A=1,C=0;for(;++C<r&&(A*=256);)w+=this[e+C]*A;return w},d.prototype.readUintBE=d.prototype.readUIntBE=function(e,r,c){e=e>>>0,r=r>>>0,c||M(e,r,this.length);let w=this[e+--r],A=1;for(;r>0&&(A*=256);)w+=this[e+--r]*A;return w},d.prototype.readUint8=d.prototype.readUInt8=function(e,r){return e=e>>>0,r||M(e,1,this.length),this[e]},d.prototype.readUint16LE=d.prototype.readUInt16LE=function(e,r){return e=e>>>0,r||M(e,2,this.length),this[e]|this[e+1]<<8},d.prototype.readUint16BE=d.prototype.readUInt16BE=function(e,r){return e=e>>>0,r||M(e,2,this.length),this[e]<<8|this[e+1]},d.prototype.readUint32LE=d.prototype.readUInt32LE=function(e,r){return e=e>>>0,r||M(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},d.prototype.readUint32BE=d.prototype.readUInt32BE=function(e,r){return e=e>>>0,r||M(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},d.prototype.readBigUInt64LE=tt(function(e){e=e>>>0,Y(e,"offset");let r=this[e],c=this[e+7];(r===void 0||c===void 0)&&Dt(e,this.length-8);let w=r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24,A=this[++e]+this[++e]*2**8+this[++e]*2**16+c*2**24;return BigInt(w)+(BigInt(A)<<BigInt(32))}),d.prototype.readBigUInt64BE=tt(function(e){e=e>>>0,Y(e,"offset");let r=this[e],c=this[e+7];(r===void 0||c===void 0)&&Dt(e,this.length-8);let w=r*2**24+this[++e]*2**16+this[++e]*2**8+this[++e],A=this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+c;return (BigInt(w)<<BigInt(32))+BigInt(A)}),d.prototype.readIntLE=function(e,r,c){e=e>>>0,r=r>>>0,c||M(e,r,this.length);let w=this[e],A=1,C=0;for(;++C<r&&(A*=256);)w+=this[e+C]*A;return A*=128,w>=A&&(w-=Math.pow(2,8*r)),w},d.prototype.readIntBE=function(e,r,c){e=e>>>0,r=r>>>0,c||M(e,r,this.length);let w=r,A=1,C=this[e+--w];for(;w>0&&(A*=256);)C+=this[e+--w]*A;return A*=128,C>=A&&(C-=Math.pow(2,8*r)),C},d.prototype.readInt8=function(e,r){return e=e>>>0,r||M(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},d.prototype.readInt16LE=function(e,r){e=e>>>0,r||M(e,2,this.length);let c=this[e]|this[e+1]<<8;return c&32768?c|4294901760:c},d.prototype.readInt16BE=function(e,r){e=e>>>0,r||M(e,2,this.length);let c=this[e+1]|this[e]<<8;return c&32768?c|4294901760:c},d.prototype.readInt32LE=function(e,r){return e=e>>>0,r||M(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},d.prototype.readInt32BE=function(e,r){return e=e>>>0,r||M(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},d.prototype.readBigInt64LE=tt(function(e){e=e>>>0,Y(e,"offset");let r=this[e],c=this[e+7];(r===void 0||c===void 0)&&Dt(e,this.length-8);let w=this[e+4]+this[e+5]*2**8+this[e+6]*2**16+(c<<24);return (BigInt(w)<<BigInt(32))+BigInt(r+this[++e]*2**8+this[++e]*2**16+this[++e]*2**24)}),d.prototype.readBigInt64BE=tt(function(e){e=e>>>0,Y(e,"offset");let r=this[e],c=this[e+7];(r===void 0||c===void 0)&&Dt(e,this.length-8);let w=(r<<24)+this[++e]*2**16+this[++e]*2**8+this[++e];return (BigInt(w)<<BigInt(32))+BigInt(this[++e]*2**24+this[++e]*2**16+this[++e]*2**8+c)}),d.prototype.readFloatLE=function(e,r){return e=e>>>0,r||M(e,4,this.length),a.read(this,e,!0,23,4)},d.prototype.readFloatBE=function(e,r){return e=e>>>0,r||M(e,4,this.length),a.read(this,e,!1,23,4)},d.prototype.readDoubleLE=function(e,r){return e=e>>>0,r||M(e,8,this.length),a.read(this,e,!0,52,8)},d.prototype.readDoubleBE=function(e,r){return e=e>>>0,r||M(e,8,this.length),a.read(this,e,!1,52,8)};function p(l,e,r,c,w,A){if(!d.isBuffer(l))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>w||e<A)throw new RangeError('"value" argument is out of bounds');if(r+c>l.length)throw new RangeError("Index out of range")}d.prototype.writeUintLE=d.prototype.writeUIntLE=function(e,r,c,w){if(e=+e,r=r>>>0,c=c>>>0,!w){let B=Math.pow(2,8*c)-1;p(this,e,r,c,B,0);}let A=1,C=0;for(this[r]=e&255;++C<c&&(A*=256);)this[r+C]=e/A&255;return r+c},d.prototype.writeUintBE=d.prototype.writeUIntBE=function(e,r,c,w){if(e=+e,r=r>>>0,c=c>>>0,!w){let B=Math.pow(2,8*c)-1;p(this,e,r,c,B,0);}let A=c-1,C=1;for(this[r+A]=e&255;--A>=0&&(C*=256);)this[r+A]=e/C&255;return r+c},d.prototype.writeUint8=d.prototype.writeUInt8=function(e,r,c){return e=+e,r=r>>>0,c||p(this,e,r,1,255,0),this[r]=e&255,r+1},d.prototype.writeUint16LE=d.prototype.writeUInt16LE=function(e,r,c){return e=+e,r=r>>>0,c||p(this,e,r,2,65535,0),this[r]=e&255,this[r+1]=e>>>8,r+2},d.prototype.writeUint16BE=d.prototype.writeUInt16BE=function(e,r,c){return e=+e,r=r>>>0,c||p(this,e,r,2,65535,0),this[r]=e>>>8,this[r+1]=e&255,r+2},d.prototype.writeUint32LE=d.prototype.writeUInt32LE=function(e,r,c){return e=+e,r=r>>>0,c||p(this,e,r,4,4294967295,0),this[r+3]=e>>>24,this[r+2]=e>>>16,this[r+1]=e>>>8,this[r]=e&255,r+4},d.prototype.writeUint32BE=d.prototype.writeUInt32BE=function(e,r,c){return e=+e,r=r>>>0,c||p(this,e,r,4,4294967295,0),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4};function i(l,e,r,c,w){Q(e,c,w,l,r,7);let A=Number(e&BigInt(4294967295));l[r++]=A,A=A>>8,l[r++]=A,A=A>>8,l[r++]=A,A=A>>8,l[r++]=A;let C=Number(e>>BigInt(32)&BigInt(4294967295));return l[r++]=C,C=C>>8,l[r++]=C,C=C>>8,l[r++]=C,C=C>>8,l[r++]=C,r}function g(l,e,r,c,w){Q(e,c,w,l,r,7);let A=Number(e&BigInt(4294967295));l[r+7]=A,A=A>>8,l[r+6]=A,A=A>>8,l[r+5]=A,A=A>>8,l[r+4]=A;let C=Number(e>>BigInt(32)&BigInt(4294967295));return l[r+3]=C,C=C>>8,l[r+2]=C,C=C>>8,l[r+1]=C,C=C>>8,l[r]=C,r+8}d.prototype.writeBigUInt64LE=tt(function(e,r=0){return i(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))}),d.prototype.writeBigUInt64BE=tt(function(e,r=0){return g(this,e,r,BigInt(0),BigInt("0xffffffffffffffff"))}),d.prototype.writeIntLE=function(e,r,c,w){if(e=+e,r=r>>>0,!w){let it=Math.pow(2,8*c-1);p(this,e,r,c,it-1,-it);}let A=0,C=1,B=0;for(this[r]=e&255;++A<c&&(C*=256);)e<0&&B===0&&this[r+A-1]!==0&&(B=1),this[r+A]=(e/C>>0)-B&255;return r+c},d.prototype.writeIntBE=function(e,r,c,w){if(e=+e,r=r>>>0,!w){let it=Math.pow(2,8*c-1);p(this,e,r,c,it-1,-it);}let A=c-1,C=1,B=0;for(this[r+A]=e&255;--A>=0&&(C*=256);)e<0&&B===0&&this[r+A+1]!==0&&(B=1),this[r+A]=(e/C>>0)-B&255;return r+c},d.prototype.writeInt8=function(e,r,c){return e=+e,r=r>>>0,c||p(this,e,r,1,127,-128),e<0&&(e=255+e+1),this[r]=e&255,r+1},d.prototype.writeInt16LE=function(e,r,c){return e=+e,r=r>>>0,c||p(this,e,r,2,32767,-32768),this[r]=e&255,this[r+1]=e>>>8,r+2},d.prototype.writeInt16BE=function(e,r,c){return e=+e,r=r>>>0,c||p(this,e,r,2,32767,-32768),this[r]=e>>>8,this[r+1]=e&255,r+2},d.prototype.writeInt32LE=function(e,r,c){return e=+e,r=r>>>0,c||p(this,e,r,4,2147483647,-2147483648),this[r]=e&255,this[r+1]=e>>>8,this[r+2]=e>>>16,this[r+3]=e>>>24,r+4},d.prototype.writeInt32BE=function(e,r,c){return e=+e,r=r>>>0,c||p(this,e,r,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[r]=e>>>24,this[r+1]=e>>>16,this[r+2]=e>>>8,this[r+3]=e&255,r+4},d.prototype.writeBigInt64LE=tt(function(e,r=0){return i(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),d.prototype.writeBigInt64BE=tt(function(e,r=0){return g(this,e,r,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))});function x(l,e,r,c,w,A){if(r+c>l.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function S(l,e,r,c,w){return e=+e,r=r>>>0,w||x(l,e,r,4),a.write(l,e,r,c,23,4),r+4}d.prototype.writeFloatLE=function(e,r,c){return S(this,e,r,!0,c)},d.prototype.writeFloatBE=function(e,r,c){return S(this,e,r,!1,c)};function N(l,e,r,c,w){return e=+e,r=r>>>0,w||x(l,e,r,8),a.write(l,e,r,c,52,8),r+8}d.prototype.writeDoubleLE=function(e,r,c){return N(this,e,r,!0,c)},d.prototype.writeDoubleBE=function(e,r,c){return N(this,e,r,!1,c)},d.prototype.copy=function(e,r,c,w){if(!d.isBuffer(e))throw new TypeError("argument should be a Buffer");if(c||(c=0),!w&&w!==0&&(w=this.length),r>=e.length&&(r=e.length),r||(r=0),w>0&&w<c&&(w=c),w===c||e.length===0||this.length===0)return 0;if(r<0)throw new RangeError("targetStart out of bounds");if(c<0||c>=this.length)throw new RangeError("Index out of range");if(w<0)throw new RangeError("sourceEnd out of bounds");w>this.length&&(w=this.length),e.length-r<w-c&&(w=e.length-r+c);let A=w-c;return this===e&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(r,c,w):Uint8Array.prototype.set.call(e,this.subarray(c,w),r),A},d.prototype.fill=function(e,r,c,w){if(typeof e=="string"){if(typeof r=="string"?(w=r,r=0,c=this.length):typeof c=="string"&&(w=c,c=this.length),w!==void 0&&typeof w!="string")throw new TypeError("encoding must be a string");if(typeof w=="string"&&!d.isEncoding(w))throw new TypeError("Unknown encoding: "+w);if(e.length===1){let C=e.charCodeAt(0);(w==="utf8"&&C<128||w==="latin1")&&(e=C);}}else typeof e=="number"?e=e&255:typeof e=="boolean"&&(e=Number(e));if(r<0||this.length<r||this.length<c)throw new RangeError("Out of range index");if(c<=r)return this;r=r>>>0,c=c===void 0?this.length:c>>>0,e||(e=0);let A;if(typeof e=="number")for(A=r;A<c;++A)this[A]=e;else {let C=d.isBuffer(e)?e:d.from(e,w),B=C.length;if(B===0)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(A=0;A<c-r;++A)this[A+r]=C[A%B];}return this};let D={};function q(l,e,r){D[l]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${l}]`,this.stack,delete this.name;}get code(){return l}set code(w){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:w,writable:!0});}toString(){return `${this.name} [${l}]: ${this.message}`}};}q("ERR_BUFFER_OUT_OF_BOUNDS",function(l){return l?`${l} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),q("ERR_INVALID_ARG_TYPE",function(l,e){return `The "${l}" argument must be of type number. Received type ${typeof e}`},TypeError),q("ERR_OUT_OF_RANGE",function(l,e,r){let c=`The value of "${l}" is out of range.`,w=r;return Number.isInteger(r)&&Math.abs(r)>2**32?w=X(String(r)):typeof r=="bigint"&&(w=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(w=X(w)),w+="n"),c+=` It must be ${e}. Received ${w}`,c},RangeError);function X(l){let e="",r=l.length,c=l[0]==="-"?1:0;for(;r>=c+4;r-=3)e=`_${l.slice(r-3,r)}${e}`;return `${l.slice(0,r)}${e}`}function Ut(l,e,r){Y(e,"offset"),(l[e]===void 0||l[e+r]===void 0)&&Dt(e,l.length-(r+1));}function Q(l,e,r,c,w,A){if(l>r||l<e){let C=typeof e=="bigint"?"n":"",B;throw e===0||e===BigInt(0)?B=`>= 0${C} and < 2${C} ** ${(A+1)*8}${C}`:B=`>= -(2${C} ** ${(A+1)*8-1}${C}) and < 2 ** ${(A+1)*8-1}${C}`,new D.ERR_OUT_OF_RANGE("value",B,l)}Ut(c,w,A);}function Y(l,e){if(typeof l!="number")throw new D.ERR_INVALID_ARG_TYPE(e,"number",l)}function Dt(l,e,r){throw Math.floor(l)!==l?(Y(l,r),new D.ERR_OUT_OF_RANGE("offset","an integer",l)):e<0?new D.ERR_BUFFER_OUT_OF_BOUNDS:new D.ERR_OUT_OF_RANGE("offset",`>= ${0} and <= ${e}`,l)}let st=/[^+/0-9A-Za-z-_]/g;function lt(l){if(l=l.split("=")[0],l=l.trim().replace(st,""),l.length<2)return "";for(;l.length%4!==0;)l=l+"=";return l}function $t(l,e){e=e||1/0;let r,c=l.length,w=null,A=[];for(let C=0;C<c;++C){if(r=l.charCodeAt(C),r>55295&&r<57344){if(!w){if(r>56319){(e-=3)>-1&&A.push(239,191,189);continue}else if(C+1===c){(e-=3)>-1&&A.push(239,191,189);continue}w=r;continue}if(r<56320){(e-=3)>-1&&A.push(239,191,189),w=r;continue}r=(w-55296<<10|r-56320)+65536;}else w&&(e-=3)>-1&&A.push(239,191,189);if(w=null,r<128){if((e-=1)<0)break;A.push(r);}else if(r<2048){if((e-=2)<0)break;A.push(r>>6|192,r&63|128);}else if(r<65536){if((e-=3)<0)break;A.push(r>>12|224,r>>6&63|128,r&63|128);}else if(r<1114112){if((e-=4)<0)break;A.push(r>>18|240,r>>12&63|128,r>>6&63|128,r&63|128);}else throw new Error("Invalid code point")}return A}function ht(l){let e=[];for(let r=0;r<l.length;++r)e.push(l.charCodeAt(r)&255);return e}function ut(l,e){let r,c,w,A=[];for(let C=0;C<l.length&&!((e-=2)<0);++C)r=l.charCodeAt(C),c=r>>8,w=r%256,A.push(w),A.push(c);return A}function Qt(l){return o.toByteArray(lt(l))}function rt(l,e,r,c){let w;for(w=0;w<c&&!(w+r>=e.length||w>=l.length);++w)e[w+r]=l[w];return w}function j(l,e){return l instanceof e||l!=null&&l.constructor!=null&&l.constructor.name!=null&&l.constructor.name===e.name}function qt(l){return l!==l}let ft=function(){let l="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){let c=r*16;for(let w=0;w<16;++w)e[c+w]=l[r]+l[w];}return e}();function tt(l){return typeof BigInt>"u"?ge:l}function ge(){throw new Error("BigInt not supported")}return Gt}var ee,ri,ye,ii,Gt,ni,Wt,L,oi=hr(()=>{_();R();ee={},ri=!1;ye={},ii=!1;Gt={},ni=!1;Wt=_n();Wt.Buffer;Wt.SlowBuffer;Wt.INSPECT_MAX_BYTES;Wt.kMaxLength;L=Wt.Buffer,Wt.INSPECT_MAX_BYTES,Wt.kMaxLength;});var _=hr(()=>{oi();});var vi=te((as,yi)=>{_();R();yi.exports={};});var Ei=te((wi,gr)=>{_();R();(function(o,a){function u(y,t){if(!y)throw new Error(t||"Assertion failed")}function v(y,t){y.super_=t;var n=function(){};n.prototype=t.prototype,y.prototype=new n,y.prototype.constructor=y;}function s(y,t,n){if(s.isBN(y))return y;this.negative=0,this.words=null,this.length=0,this.red=null,y!==null&&((t==="le"||t==="be")&&(n=t,t=10),this._init(y||0,t||10,n||"be"));}typeof o=="object"?o.exports=s:a.BN=s,s.BN=s,s.wordSize=26;var T;try{typeof window<"u"&&typeof window.Buffer<"u"?T=window.Buffer:T=vi().Buffer;}catch{}s.isBN=function(t){return t instanceof s?!0:t!==null&&typeof t=="object"&&t.constructor.wordSize===s.wordSize&&Array.isArray(t.words)},s.max=function(t,n){return t.cmp(n)>0?t:n},s.min=function(t,n){return t.cmp(n)<0?t:n},s.prototype._init=function(t,n,h){if(typeof t=="number")return this._initNumber(t,n,h);if(typeof t=="object")return this._initArray(t,n,h);n==="hex"&&(n=16),u(n===(n|0)&&n>=2&&n<=36),t=t.toString().replace(/\s+/g,"");var f=0;t[0]==="-"&&(f++,this.negative=1),f<t.length&&(n===16?this._parseHex(t,f,h):(this._parseBase(t,n,f),h==="le"&&this._initArray(this.toArray(),n,h)));},s.prototype._initNumber=function(t,n,h){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[t&67108863],this.length=1):t<4503599627370496?(this.words=[t&67108863,t/67108864&67108863],this.length=2):(u(t<9007199254740992),this.words=[t&67108863,t/67108864&67108863,1],this.length=3),h==="le"&&this._initArray(this.toArray(),n,h);},s.prototype._initArray=function(t,n,h){if(u(typeof t.length=="number"),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var f=0;f<this.length;f++)this.words[f]=0;var m,E,M=0;if(h==="be")for(f=t.length-1,m=0;f>=0;f-=3)E=t[f]|t[f-1]<<8|t[f-2]<<16,this.words[m]|=E<<M&67108863,this.words[m+1]=E>>>26-M&67108863,M+=24,M>=26&&(M-=26,m++);else if(h==="le")for(f=0,m=0;f<t.length;f+=3)E=t[f]|t[f+1]<<8|t[f+2]<<16,this.words[m]|=E<<M&67108863,this.words[m+1]=E>>>26-M&67108863,M+=24,M>=26&&(M-=26,m++);return this._strip()};function d(y,t){var n=y.charCodeAt(t);if(n>=48&&n<=57)return n-48;if(n>=65&&n<=70)return n-55;if(n>=97&&n<=102)return n-87;u(!1,"Invalid character in "+y);}function I(y,t,n){var h=d(y,n);return n-1>=t&&(h|=d(y,n-1)<<4),h}s.prototype._parseHex=function(t,n,h){this.length=Math.ceil((t.length-n)/6),this.words=new Array(this.length);for(var f=0;f<this.length;f++)this.words[f]=0;var m=0,E=0,M;if(h==="be")for(f=t.length-1;f>=n;f-=2)M=I(t,n,f)<<m,this.words[E]|=M&67108863,m>=18?(m-=18,E+=1,this.words[E]|=M>>>26):m+=8;else {var p=t.length-n;for(f=p%2===0?n+1:n;f<t.length;f+=2)M=I(t,n,f)<<m,this.words[E]|=M&67108863,m>=18?(m-=18,E+=1,this.words[E]|=M>>>26):m+=8;}this._strip();};function b(y,t,n,h){for(var f=0,m=0,E=Math.min(y.length,n),M=t;M<E;M++){var p=y.charCodeAt(M)-48;f*=h,p>=49?m=p-49+10:p>=17?m=p-17+10:m=p,u(p>=0&&m<h,"Invalid character"),f+=m;}return f}s.prototype._parseBase=function(t,n,h){this.words=[0],this.length=1;for(var f=0,m=1;m<=67108863;m*=n)f++;f--,m=m/n|0;for(var E=t.length-h,M=E%f,p=Math.min(E,E-M)+h,i=0,g=h;g<p;g+=f)i=b(t,g,g+f,n),this.imuln(m),this.words[0]+i<67108864?this.words[0]+=i:this._iaddn(i);if(M!==0){var x=1;for(i=b(t,g,t.length,n),g=0;g<M;g++)x*=n;this.imuln(x),this.words[0]+i<67108864?this.words[0]+=i:this._iaddn(i);}this._strip();},s.prototype.copy=function(t){t.words=new Array(this.length);for(var n=0;n<this.length;n++)t.words[n]=this.words[n];t.length=this.length,t.negative=this.negative,t.red=this.red;};function U(y,t){y.words=t.words,y.length=t.length,y.negative=t.negative,y.red=t.red;}if(s.prototype._move=function(t){U(t,this);},s.prototype.clone=function(){var t=new s(null);return this.copy(t),t},s.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},s.prototype._strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},s.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=k;}catch{s.prototype.inspect=k;}else s.prototype.inspect=k;function k(){return (this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var Z=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],z=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],P=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];s.prototype.toString=function(t,n){t=t||10,n=n|0||1;var h;if(t===16||t==="hex"){h="";for(var f=0,m=0,E=0;E<this.length;E++){var M=this.words[E],p=((M<<f|m)&16777215).toString(16);m=M>>>24-f&16777215,f+=2,f>=26&&(f-=26,E--),m!==0||E!==this.length-1?h=Z[6-p.length]+p+h:h=p+h;}for(m!==0&&(h=m.toString(16)+h);h.length%n!==0;)h="0"+h;return this.negative!==0&&(h="-"+h),h}if(t===(t|0)&&t>=2&&t<=36){var i=z[t],g=P[t];h="";var x=this.clone();for(x.negative=0;!x.isZero();){var S=x.modrn(g).toString(t);x=x.idivn(g),x.isZero()?h=S+h:h=Z[i-S.length]+S+h;}for(this.isZero()&&(h="0"+h);h.length%n!==0;)h="0"+h;return this.negative!==0&&(h="-"+h),h}u(!1,"Base should be between 2 and 36");},s.prototype.toNumber=function(){var t=this.words[0];return this.length===2?t+=this.words[1]*67108864:this.length===3&&this.words[2]===1?t+=4503599627370496+this.words[1]*67108864:this.length>2&&u(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-t:t},s.prototype.toJSON=function(){return this.toString(16,2)},T&&(s.prototype.toBuffer=function(t,n){return this.toArrayLike(T,t,n)}),s.prototype.toArray=function(t,n){return this.toArrayLike(Array,t,n)};var F=function(t,n){return t.allocUnsafe?t.allocUnsafe(n):new t(n)};s.prototype.toArrayLike=function(t,n,h){this._strip();var f=this.byteLength(),m=h||Math.max(1,f);u(f<=m,"byte array longer than desired length"),u(m>0,"Requested array length <= 0");var E=F(t,m),M=n==="le"?"LE":"BE";return this["_toArrayLike"+M](E,f),E},s.prototype._toArrayLikeLE=function(t,n){for(var h=0,f=0,m=0,E=0;m<this.length;m++){var M=this.words[m]<<E|f;t[h++]=M&255,h<t.length&&(t[h++]=M>>8&255),h<t.length&&(t[h++]=M>>16&255),E===6?(h<t.length&&(t[h++]=M>>24&255),f=0,E=0):(f=M>>>24,E+=2);}if(h<t.length)for(t[h++]=f;h<t.length;)t[h++]=0;},s.prototype._toArrayLikeBE=function(t,n){for(var h=t.length-1,f=0,m=0,E=0;m<this.length;m++){var M=this.words[m]<<E|f;t[h--]=M&255,h>=0&&(t[h--]=M>>8&255),h>=0&&(t[h--]=M>>16&255),E===6?(h>=0&&(t[h--]=M>>24&255),f=0,E=0):(f=M>>>24,E+=2);}if(h>=0)for(t[h--]=f;h>=0;)t[h--]=0;},Math.clz32?s.prototype._countBits=function(t){return 32-Math.clz32(t)}:s.prototype._countBits=function(t){var n=t,h=0;return n>=4096&&(h+=13,n>>>=13),n>=64&&(h+=7,n>>>=7),n>=8&&(h+=4,n>>>=4),n>=2&&(h+=2,n>>>=2),h+n},s.prototype._zeroBits=function(t){if(t===0)return 26;var n=t,h=0;return n&8191||(h+=13,n>>>=13),n&127||(h+=7,n>>>=7),n&15||(h+=4,n>>>=4),n&3||(h+=2,n>>>=2),n&1||h++,h},s.prototype.bitLength=function(){var t=this.words[this.length-1],n=this._countBits(t);return (this.length-1)*26+n};function $(y){for(var t=new Array(y.bitLength()),n=0;n<t.length;n++){var h=n/26|0,f=n%26;t[n]=y.words[h]>>>f&1;}return t}s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,n=0;n<this.length;n++){var h=this._zeroBits(this.words[n]);if(t+=h,h!==26)break}return t},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(t){return this.negative!==0?this.abs().inotn(t).iaddn(1):this.clone()},s.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},s.prototype.isNeg=function(){return this.negative!==0},s.prototype.neg=function(){return this.clone().ineg()},s.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},s.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var n=0;n<t.length;n++)this.words[n]=this.words[n]|t.words[n];return this._strip()},s.prototype.ior=function(t){return u((this.negative|t.negative)===0),this.iuor(t)},s.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},s.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},s.prototype.iuand=function(t){var n;this.length>t.length?n=t:n=this;for(var h=0;h<n.length;h++)this.words[h]=this.words[h]&t.words[h];return this.length=n.length,this._strip()},s.prototype.iand=function(t){return u((this.negative|t.negative)===0),this.iuand(t)},s.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},s.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},s.prototype.iuxor=function(t){var n,h;this.length>t.length?(n=this,h=t):(n=t,h=this);for(var f=0;f<h.length;f++)this.words[f]=n.words[f]^h.words[f];if(this!==n)for(;f<n.length;f++)this.words[f]=n.words[f];return this.length=n.length,this._strip()},s.prototype.ixor=function(t){return u((this.negative|t.negative)===0),this.iuxor(t)},s.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},s.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},s.prototype.inotn=function(t){u(typeof t=="number"&&t>=0);var n=Math.ceil(t/26)|0,h=t%26;this._expand(n),h>0&&n--;for(var f=0;f<n;f++)this.words[f]=~this.words[f]&67108863;return h>0&&(this.words[f]=~this.words[f]&67108863>>26-h),this._strip()},s.prototype.notn=function(t){return this.clone().inotn(t)},s.prototype.setn=function(t,n){u(typeof t=="number"&&t>=0);var h=t/26|0,f=t%26;return this._expand(h+1),n?this.words[h]=this.words[h]|1<<f:this.words[h]=this.words[h]&~(1<<f),this._strip()},s.prototype.iadd=function(t){var n;if(this.negative!==0&&t.negative===0)return this.negative=0,n=this.isub(t),this.negative^=1,this._normSign();if(this.negative===0&&t.negative!==0)return t.negative=0,n=this.isub(t),t.negative=1,n._normSign();var h,f;this.length>t.length?(h=this,f=t):(h=t,f=this);for(var m=0,E=0;E<f.length;E++)n=(h.words[E]|0)+(f.words[E]|0)+m,this.words[E]=n&67108863,m=n>>>26;for(;m!==0&&E<h.length;E++)n=(h.words[E]|0)+m,this.words[E]=n&67108863,m=n>>>26;if(this.length=h.length,m!==0)this.words[this.length]=m,this.length++;else if(h!==this)for(;E<h.length;E++)this.words[E]=h.words[E];return this},s.prototype.add=function(t){var n;return t.negative!==0&&this.negative===0?(t.negative=0,n=this.sub(t),t.negative^=1,n):t.negative===0&&this.negative!==0?(this.negative=0,n=t.sub(this),this.negative=1,n):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},s.prototype.isub=function(t){if(t.negative!==0){t.negative=0;var n=this.iadd(t);return t.negative=1,n._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var h=this.cmp(t);if(h===0)return this.negative=0,this.length=1,this.words[0]=0,this;var f,m;h>0?(f=this,m=t):(f=t,m=this);for(var E=0,M=0;M<m.length;M++)n=(f.words[M]|0)-(m.words[M]|0)+E,E=n>>26,this.words[M]=n&67108863;for(;E!==0&&M<f.length;M++)n=(f.words[M]|0)+E,E=n>>26,this.words[M]=n&67108863;if(E===0&&M<f.length&&f!==this)for(;M<f.length;M++)this.words[M]=f.words[M];return this.length=Math.max(this.length,M),f!==this&&(this.negative=1),this._strip()},s.prototype.sub=function(t){return this.clone().isub(t)};function J(y,t,n){n.negative=t.negative^y.negative;var h=y.length+t.length|0;n.length=h,h=h-1|0;var f=y.words[0]|0,m=t.words[0]|0,E=f*m,M=E&67108863,p=E/67108864|0;n.words[0]=M;for(var i=1;i<h;i++){for(var g=p>>>26,x=p&67108863,S=Math.min(i,t.length-1),N=Math.max(0,i-y.length+1);N<=S;N++){var D=i-N|0;f=y.words[D]|0,m=t.words[N]|0,E=f*m+x,g+=E/67108864|0,x=E&67108863;}n.words[i]=x|0,p=g|0;}return p!==0?n.words[i]=p|0:n.length--,n._strip()}var at=function(t,n,h){var f=t.words,m=n.words,E=h.words,M=0,p,i,g,x=f[0]|0,S=x&8191,N=x>>>13,D=f[1]|0,q=D&8191,X=D>>>13,Ut=f[2]|0,Q=Ut&8191,Y=Ut>>>13,Dt=f[3]|0,st=Dt&8191,lt=Dt>>>13,$t=f[4]|0,ht=$t&8191,ut=$t>>>13,Qt=f[5]|0,rt=Qt&8191,j=Qt>>>13,qt=f[6]|0,ft=qt&8191,tt=qt>>>13,ge=f[7]|0,l=ge&8191,e=ge>>>13,r=f[8]|0,c=r&8191,w=r>>>13,A=f[9]|0,C=A&8191,B=A>>>13,it=m[0]|0,V=it&8191,G=it>>>13,K=m[1]|0,ct=K&8191,pt=K>>>13,Jr=m[2]|0,dt=Jr&8191,mt=Jr>>>13,zr=m[3]|0,gt=zr&8191,yt=zr>>>13,Yr=m[4]|0,vt=Yr&8191,wt=Yr>>>13,jr=m[5]|0,Et=jr&8191,Mt=jr>>>13,Kr=m[6]|0,Tt=Kr&8191,At=Kr>>>13,Xr=m[7]|0,Ct=Xr&8191,It=Xr>>>13,Qr=m[8]|0,Rt=Qr&8191,_t=Qr>>>13,ti=m[9]|0,bt=ti&8191,xt=ti>>>13;h.negative=t.negative^n.negative,h.length=19,p=Math.imul(S,V),i=Math.imul(S,G),i=i+Math.imul(N,V)|0,g=Math.imul(N,G);var We=(M+p|0)+((i&8191)<<13)|0;M=(g+(i>>>13)|0)+(We>>>26)|0,We&=67108863,p=Math.imul(q,V),i=Math.imul(q,G),i=i+Math.imul(X,V)|0,g=Math.imul(X,G),p=p+Math.imul(S,ct)|0,i=i+Math.imul(S,pt)|0,i=i+Math.imul(N,ct)|0,g=g+Math.imul(N,pt)|0;var Ze=(M+p|0)+((i&8191)<<13)|0;M=(g+(i>>>13)|0)+(Ze>>>26)|0,Ze&=67108863,p=Math.imul(Q,V),i=Math.imul(Q,G),i=i+Math.imul(Y,V)|0,g=Math.imul(Y,G),p=p+Math.imul(q,ct)|0,i=i+Math.imul(q,pt)|0,i=i+Math.imul(X,ct)|0,g=g+Math.imul(X,pt)|0,p=p+Math.imul(S,dt)|0,i=i+Math.imul(S,mt)|0,i=i+Math.imul(N,dt)|0,g=g+Math.imul(N,mt)|0;var $e=(M+p|0)+((i&8191)<<13)|0;M=(g+(i>>>13)|0)+($e>>>26)|0,$e&=67108863,p=Math.imul(st,V),i=Math.imul(st,G),i=i+Math.imul(lt,V)|0,g=Math.imul(lt,G),p=p+Math.imul(Q,ct)|0,i=i+Math.imul(Q,pt)|0,i=i+Math.imul(Y,ct)|0,g=g+Math.imul(Y,pt)|0,p=p+Math.imul(q,dt)|0,i=i+Math.imul(q,mt)|0,i=i+Math.imul(X,dt)|0,g=g+Math.imul(X,mt)|0,p=p+Math.imul(S,gt)|0,i=i+Math.imul(S,yt)|0,i=i+Math.imul(N,gt)|0,g=g+Math.imul(N,yt)|0;var qe=(M+p|0)+((i&8191)<<13)|0;M=(g+(i>>>13)|0)+(qe>>>26)|0,qe&=67108863,p=Math.imul(ht,V),i=Math.imul(ht,G),i=i+Math.imul(ut,V)|0,g=Math.imul(ut,G),p=p+Math.imul(st,ct)|0,i=i+Math.imul(st,pt)|0,i=i+Math.imul(lt,ct)|0,g=g+Math.imul(lt,pt)|0,p=p+Math.imul(Q,dt)|0,i=i+Math.imul(Q,mt)|0,i=i+Math.imul(Y,dt)|0,g=g+Math.imul(Y,mt)|0,p=p+Math.imul(q,gt)|0,i=i+Math.imul(q,yt)|0,i=i+Math.imul(X,gt)|0,g=g+Math.imul(X,yt)|0,p=p+Math.imul(S,vt)|0,i=i+Math.imul(S,wt)|0,i=i+Math.imul(N,vt)|0,g=g+Math.imul(N,wt)|0;var Je=(M+p|0)+((i&8191)<<13)|0;M=(g+(i>>>13)|0)+(Je>>>26)|0,Je&=67108863,p=Math.imul(rt,V),i=Math.imul(rt,G),i=i+Math.imul(j,V)|0,g=Math.imul(j,G),p=p+Math.imul(ht,ct)|0,i=i+Math.imul(ht,pt)|0,i=i+Math.imul(ut,ct)|0,g=g+Math.imul(ut,pt)|0,p=p+Math.imul(st,dt)|0,i=i+Math.imul(st,mt)|0,i=i+Math.imul(lt,dt)|0,g=g+Math.imul(lt,mt)|0,p=p+Math.imul(Q,gt)|0,i=i+Math.imul(Q,yt)|0,i=i+Math.imul(Y,gt)|0,g=g+Math.imul(Y,yt)|0,p=p+Math.imul(q,vt)|0,i=i+Math.imul(q,wt)|0,i=i+Math.imul(X,vt)|0,g=g+Math.imul(X,wt)|0,p=p+Math.imul(S,Et)|0,i=i+Math.imul(S,Mt)|0,i=i+Math.imul(N,Et)|0,g=g+Math.imul(N,Mt)|0;var ze=(M+p|0)+((i&8191)<<13)|0;M=(g+(i>>>13)|0)+(ze>>>26)|0,ze&=67108863,p=Math.imul(ft,V),i=Math.imul(ft,G),i=i+Math.imul(tt,V)|0,g=Math.imul(tt,G),p=p+Math.imul(rt,ct)|0,i=i+Math.imul(rt,pt)|0,i=i+Math.imul(j,ct)|0,g=g+Math.imul(j,pt)|0,p=p+Math.imul(ht,dt)|0,i=i+Math.imul(ht,mt)|0,i=i+Math.imul(ut,dt)|0,g=g+Math.imul(ut,mt)|0,p=p+Math.imul(st,gt)|0,i=i+Math.imul(st,yt)|0,i=i+Math.imul(lt,gt)|0,g=g+Math.imul(lt,yt)|0,p=p+Math.imul(Q,vt)|0,i=i+Math.imul(Q,wt)|0,i=i+Math.imul(Y,vt)|0,g=g+Math.imul(Y,wt)|0,p=p+Math.imul(q,Et)|0,i=i+Math.imul(q,Mt)|0,i=i+Math.imul(X,Et)|0,g=g+Math.imul(X,Mt)|0,p=p+Math.imul(S,Tt)|0,i=i+Math.imul(S,At)|0,i=i+Math.imul(N,Tt)|0,g=g+Math.imul(N,At)|0;var Ye=(M+p|0)+((i&8191)<<13)|0;M=(g+(i>>>13)|0)+(Ye>>>26)|0,Ye&=67108863,p=Math.imul(l,V),i=Math.imul(l,G),i=i+Math.imul(e,V)|0,g=Math.imul(e,G),p=p+Math.imul(ft,ct)|0,i=i+Math.imul(ft,pt)|0,i=i+Math.imul(tt,ct)|0,g=g+Math.imul(tt,pt)|0,p=p+Math.imul(rt,dt)|0,i=i+Math.imul(rt,mt)|0,i=i+Math.imul(j,dt)|0,g=g+Math.imul(j,mt)|0,p=p+Math.imul(ht,gt)|0,i=i+Math.imul(ht,yt)|0,i=i+Math.imul(ut,gt)|0,g=g+Math.imul(ut,yt)|0,p=p+Math.imul(st,vt)|0,i=i+Math.imul(st,wt)|0,i=i+Math.imul(lt,vt)|0,g=g+Math.imul(lt,wt)|0,p=p+Math.imul(Q,Et)|0,i=i+Math.imul(Q,Mt)|0,i=i+Math.imul(Y,Et)|0,g=g+Math.imul(Y,Mt)|0,p=p+Math.imul(q,Tt)|0,i=i+Math.imul(q,At)|0,i=i+Math.imul(X,Tt)|0,g=g+Math.imul(X,At)|0,p=p+Math.imul(S,Ct)|0,i=i+Math.imul(S,It)|0,i=i+Math.imul(N,Ct)|0,g=g+Math.imul(N,It)|0;var je=(M+p|0)+((i&8191)<<13)|0;M=(g+(i>>>13)|0)+(je>>>26)|0,je&=67108863,p=Math.imul(c,V),i=Math.imul(c,G),i=i+Math.imul(w,V)|0,g=Math.imul(w,G),p=p+Math.imul(l,ct)|0,i=i+Math.imul(l,pt)|0,i=i+Math.imul(e,ct)|0,g=g+Math.imul(e,pt)|0,p=p+Math.imul(ft,dt)|0,i=i+Math.imul(ft,mt)|0,i=i+Math.imul(tt,dt)|0,g=g+Math.imul(tt,mt)|0,p=p+Math.imul(rt,gt)|0,i=i+Math.imul(rt,yt)|0,i=i+Math.imul(j,gt)|0,g=g+Math.imul(j,yt)|0,p=p+Math.imul(ht,vt)|0,i=i+Math.imul(ht,wt)|0,i=i+Math.imul(ut,vt)|0,g=g+Math.imul(ut,wt)|0,p=p+Math.imul(st,Et)|0,i=i+Math.imul(st,Mt)|0,i=i+Math.imul(lt,Et)|0,g=g+Math.imul(lt,Mt)|0,p=p+Math.imul(Q,Tt)|0,i=i+Math.imul(Q,At)|0,i=i+Math.imul(Y,Tt)|0,g=g+Math.imul(Y,At)|0,p=p+Math.imul(q,Ct)|0,i=i+Math.imul(q,It)|0,i=i+Math.imul(X,Ct)|0,g=g+Math.imul(X,It)|0,p=p+Math.imul(S,Rt)|0,i=i+Math.imul(S,_t)|0,i=i+Math.imul(N,Rt)|0,g=g+Math.imul(N,_t)|0;var Ke=(M+p|0)+((i&8191)<<13)|0;M=(g+(i>>>13)|0)+(Ke>>>26)|0,Ke&=67108863,p=Math.imul(C,V),i=Math.imul(C,G),i=i+Math.imul(B,V)|0,g=Math.imul(B,G),p=p+Math.imul(c,ct)|0,i=i+Math.imul(c,pt)|0,i=i+Math.imul(w,ct)|0,g=g+Math.imul(w,pt)|0,p=p+Math.imul(l,dt)|0,i=i+Math.imul(l,mt)|0,i=i+Math.imul(e,dt)|0,g=g+Math.imul(e,mt)|0,p=p+Math.imul(ft,gt)|0,i=i+Math.imul(ft,yt)|0,i=i+Math.imul(tt,gt)|0,g=g+Math.imul(tt,yt)|0,p=p+Math.imul(rt,vt)|0,i=i+Math.imul(rt,wt)|0,i=i+Math.imul(j,vt)|0,g=g+Math.imul(j,wt)|0,p=p+Math.imul(ht,Et)|0,i=i+Math.imul(ht,Mt)|0,i=i+Math.imul(ut,Et)|0,g=g+Math.imul(ut,Mt)|0,p=p+Math.imul(st,Tt)|0,i=i+Math.imul(st,At)|0,i=i+Math.imul(lt,Tt)|0,g=g+Math.imul(lt,At)|0,p=p+Math.imul(Q,Ct)|0,i=i+Math.imul(Q,It)|0,i=i+Math.imul(Y,Ct)|0,g=g+Math.imul(Y,It)|0,p=p+Math.imul(q,Rt)|0,i=i+Math.imul(q,_t)|0,i=i+Math.imul(X,Rt)|0,g=g+Math.imul(X,_t)|0,p=p+Math.imul(S,bt)|0,i=i+Math.imul(S,xt)|0,i=i+Math.imul(N,bt)|0,g=g+Math.imul(N,xt)|0;var Xe=(M+p|0)+((i&8191)<<13)|0;M=(g+(i>>>13)|0)+(Xe>>>26)|0,Xe&=67108863,p=Math.imul(C,ct),i=Math.imul(C,pt),i=i+Math.imul(B,ct)|0,g=Math.imul(B,pt),p=p+Math.imul(c,dt)|0,i=i+Math.imul(c,mt)|0,i=i+Math.imul(w,dt)|0,g=g+Math.imul(w,mt)|0,p=p+Math.imul(l,gt)|0,i=i+Math.imul(l,yt)|0,i=i+Math.imul(e,gt)|0,g=g+Math.imul(e,yt)|0,p=p+Math.imul(ft,vt)|0,i=i+Math.imul(ft,wt)|0,i=i+Math.imul(tt,vt)|0,g=g+Math.imul(tt,wt)|0,p=p+Math.imul(rt,Et)|0,i=i+Math.imul(rt,Mt)|0,i=i+Math.imul(j,Et)|0,g=g+Math.imul(j,Mt)|0,p=p+Math.imul(ht,Tt)|0,i=i+Math.imul(ht,At)|0,i=i+Math.imul(ut,Tt)|0,g=g+Math.imul(ut,At)|0,p=p+Math.imul(st,Ct)|0,i=i+Math.imul(st,It)|0,i=i+Math.imul(lt,Ct)|0,g=g+Math.imul(lt,It)|0,p=p+Math.imul(Q,Rt)|0,i=i+Math.imul(Q,_t)|0,i=i+Math.imul(Y,Rt)|0,g=g+Math.imul(Y,_t)|0,p=p+Math.imul(q,bt)|0,i=i+Math.imul(q,xt)|0,i=i+Math.imul(X,bt)|0,g=g+Math.imul(X,xt)|0;var Qe=(M+p|0)+((i&8191)<<13)|0;M=(g+(i>>>13)|0)+(Qe>>>26)|0,Qe&=67108863,p=Math.imul(C,dt),i=Math.imul(C,mt),i=i+Math.imul(B,dt)|0,g=Math.imul(B,mt),p=p+Math.imul(c,gt)|0,i=i+Math.imul(c,yt)|0,i=i+Math.imul(w,gt)|0,g=g+Math.imul(w,yt)|0,p=p+Math.imul(l,vt)|0,i=i+Math.imul(l,wt)|0,i=i+Math.imul(e,vt)|0,g=g+Math.imul(e,wt)|0,p=p+Math.imul(ft,Et)|0,i=i+Math.imul(ft,Mt)|0,i=i+Math.imul(tt,Et)|0,g=g+Math.imul(tt,Mt)|0,p=p+Math.imul(rt,Tt)|0,i=i+Math.imul(rt,At)|0,i=i+Math.imul(j,Tt)|0,g=g+Math.imul(j,At)|0,p=p+Math.imul(ht,Ct)|0,i=i+Math.imul(ht,It)|0,i=i+Math.imul(ut,Ct)|0,g=g+Math.imul(ut,It)|0,p=p+Math.imul(st,Rt)|0,i=i+Math.imul(st,_t)|0,i=i+Math.imul(lt,Rt)|0,g=g+Math.imul(lt,_t)|0,p=p+Math.imul(Q,bt)|0,i=i+Math.imul(Q,xt)|0,i=i+Math.imul(Y,bt)|0,g=g+Math.imul(Y,xt)|0;var tr=(M+p|0)+((i&8191)<<13)|0;M=(g+(i>>>13)|0)+(tr>>>26)|0,tr&=67108863,p=Math.imul(C,gt),i=Math.imul(C,yt),i=i+Math.imul(B,gt)|0,g=Math.imul(B,yt),p=p+Math.imul(c,vt)|0,i=i+Math.imul(c,wt)|0,i=i+Math.imul(w,vt)|0,g=g+Math.imul(w,wt)|0,p=p+Math.imul(l,Et)|0,i=i+Math.imul(l,Mt)|0,i=i+Math.imul(e,Et)|0,g=g+Math.imul(e,Mt)|0,p=p+Math.imul(ft,Tt)|0,i=i+Math.imul(ft,At)|0,i=i+Math.imul(tt,Tt)|0,g=g+Math.imul(tt,At)|0,p=p+Math.imul(rt,Ct)|0,i=i+Math.imul(rt,It)|0,i=i+Math.imul(j,Ct)|0,g=g+Math.imul(j,It)|0,p=p+Math.imul(ht,Rt)|0,i=i+Math.imul(ht,_t)|0,i=i+Math.imul(ut,Rt)|0,g=g+Math.imul(ut,_t)|0,p=p+Math.imul(st,bt)|0,i=i+Math.imul(st,xt)|0,i=i+Math.imul(lt,bt)|0,g=g+Math.imul(lt,xt)|0;var er=(M+p|0)+((i&8191)<<13)|0;M=(g+(i>>>13)|0)+(er>>>26)|0,er&=67108863,p=Math.imul(C,vt),i=Math.imul(C,wt),i=i+Math.imul(B,vt)|0,g=Math.imul(B,wt),p=p+Math.imul(c,Et)|0,i=i+Math.imul(c,Mt)|0,i=i+Math.imul(w,Et)|0,g=g+Math.imul(w,Mt)|0,p=p+Math.imul(l,Tt)|0,i=i+Math.imul(l,At)|0,i=i+Math.imul(e,Tt)|0,g=g+Math.imul(e,At)|0,p=p+Math.imul(ft,Ct)|0,i=i+Math.imul(ft,It)|0,i=i+Math.imul(tt,Ct)|0,g=g+Math.imul(tt,It)|0,p=p+Math.imul(rt,Rt)|0,i=i+Math.imul(rt,_t)|0,i=i+Math.imul(j,Rt)|0,g=g+Math.imul(j,_t)|0,p=p+Math.imul(ht,bt)|0,i=i+Math.imul(ht,xt)|0,i=i+Math.imul(ut,bt)|0,g=g+Math.imul(ut,xt)|0;var rr=(M+p|0)+((i&8191)<<13)|0;M=(g+(i>>>13)|0)+(rr>>>26)|0,rr&=67108863,p=Math.imul(C,Et),i=Math.imul(C,Mt),i=i+Math.imul(B,Et)|0,g=Math.imul(B,Mt),p=p+Math.imul(c,Tt)|0,i=i+Math.imul(c,At)|0,i=i+Math.imul(w,Tt)|0,g=g+Math.imul(w,At)|0,p=p+Math.imul(l,Ct)|0,i=i+Math.imul(l,It)|0,i=i+Math.imul(e,Ct)|0,g=g+Math.imul(e,It)|0,p=p+Math.imul(ft,Rt)|0,i=i+Math.imul(ft,_t)|0,i=i+Math.imul(tt,Rt)|0,g=g+Math.imul(tt,_t)|0,p=p+Math.imul(rt,bt)|0,i=i+Math.imul(rt,xt)|0,i=i+Math.imul(j,bt)|0,g=g+Math.imul(j,xt)|0;var ir=(M+p|0)+((i&8191)<<13)|0;M=(g+(i>>>13)|0)+(ir>>>26)|0,ir&=67108863,p=Math.imul(C,Tt),i=Math.imul(C,At),i=i+Math.imul(B,Tt)|0,g=Math.imul(B,At),p=p+Math.imul(c,Ct)|0,i=i+Math.imul(c,It)|0,i=i+Math.imul(w,Ct)|0,g=g+Math.imul(w,It)|0,p=p+Math.imul(l,Rt)|0,i=i+Math.imul(l,_t)|0,i=i+Math.imul(e,Rt)|0,g=g+Math.imul(e,_t)|0,p=p+Math.imul(ft,bt)|0,i=i+Math.imul(ft,xt)|0,i=i+Math.imul(tt,bt)|0,g=g+Math.imul(tt,xt)|0;var nr=(M+p|0)+((i&8191)<<13)|0;M=(g+(i>>>13)|0)+(nr>>>26)|0,nr&=67108863,p=Math.imul(C,Ct),i=Math.imul(C,It),i=i+Math.imul(B,Ct)|0,g=Math.imul(B,It),p=p+Math.imul(c,Rt)|0,i=i+Math.imul(c,_t)|0,i=i+Math.imul(w,Rt)|0,g=g+Math.imul(w,_t)|0,p=p+Math.imul(l,bt)|0,i=i+Math.imul(l,xt)|0,i=i+Math.imul(e,bt)|0,g=g+Math.imul(e,xt)|0;var or=(M+p|0)+((i&8191)<<13)|0;M=(g+(i>>>13)|0)+(or>>>26)|0,or&=67108863,p=Math.imul(C,Rt),i=Math.imul(C,_t),i=i+Math.imul(B,Rt)|0,g=Math.imul(B,_t),p=p+Math.imul(c,bt)|0,i=i+Math.imul(c,xt)|0,i=i+Math.imul(w,bt)|0,g=g+Math.imul(w,xt)|0;var ar=(M+p|0)+((i&8191)<<13)|0;M=(g+(i>>>13)|0)+(ar>>>26)|0,ar&=67108863,p=Math.imul(C,bt),i=Math.imul(C,xt),i=i+Math.imul(B,bt)|0,g=Math.imul(B,xt);var sr=(M+p|0)+((i&8191)<<13)|0;return M=(g+(i>>>13)|0)+(sr>>>26)|0,sr&=67108863,E[0]=We,E[1]=Ze,E[2]=$e,E[3]=qe,E[4]=Je,E[5]=ze,E[6]=Ye,E[7]=je,E[8]=Ke,E[9]=Xe,E[10]=Qe,E[11]=tr,E[12]=er,E[13]=rr,E[14]=ir,E[15]=nr,E[16]=or,E[17]=ar,E[18]=sr,M!==0&&(E[19]=M,h.length++),h};Math.imul||(at=J);function et(y,t,n){n.negative=t.negative^y.negative,n.length=y.length+t.length;for(var h=0,f=0,m=0;m<n.length-1;m++){var E=f;f=0;for(var M=h&67108863,p=Math.min(m,t.length-1),i=Math.max(0,m-y.length+1);i<=p;i++){var g=m-i,x=y.words[g]|0,S=t.words[i]|0,N=x*S,D=N&67108863;E=E+(N/67108864|0)|0,D=D+M|0,M=D&67108863,E=E+(D>>>26)|0,f+=E>>>26,E&=67108863;}n.words[m]=M,h=E,E=f;}return h!==0?n.words[m]=h:n.length--,n._strip()}function Pt(y,t,n){return et(y,t,n)}s.prototype.mulTo=function(t,n){var h,f=this.length+t.length;return this.length===10&&t.length===10?h=at(this,t,n):f<63?h=J(this,t,n):f<1024?h=et(this,t,n):h=Pt(this,t,n),h};s.prototype.mul=function(t){var n=new s(null);return n.words=new Array(this.length+t.length),this.mulTo(t,n)},s.prototype.mulf=function(t){var n=new s(null);return n.words=new Array(this.length+t.length),Pt(this,t,n)},s.prototype.imul=function(t){return this.clone().mulTo(t,this)},s.prototype.imuln=function(t){var n=t<0;n&&(t=-t),u(typeof t=="number"),u(t<67108864);for(var h=0,f=0;f<this.length;f++){var m=(this.words[f]|0)*t,E=(m&67108863)+(h&67108863);h>>=26,h+=m/67108864|0,h+=E>>>26,this.words[f]=E&67108863;}return h!==0&&(this.words[f]=h,this.length++),n?this.ineg():this},s.prototype.muln=function(t){return this.clone().imuln(t)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(t){var n=$(t);if(n.length===0)return new s(1);for(var h=this,f=0;f<n.length&&n[f]===0;f++,h=h.sqr());if(++f<n.length)for(var m=h.sqr();f<n.length;f++,m=m.sqr())n[f]!==0&&(h=h.mul(m));return h},s.prototype.iushln=function(t){u(typeof t=="number"&&t>=0);var n=t%26,h=(t-n)/26,f=67108863>>>26-n<<26-n,m;if(n!==0){var E=0;for(m=0;m<this.length;m++){var M=this.words[m]&f,p=(this.words[m]|0)-M<<n;this.words[m]=p|E,E=M>>>26-n;}E&&(this.words[m]=E,this.length++);}if(h!==0){for(m=this.length-1;m>=0;m--)this.words[m+h]=this.words[m];for(m=0;m<h;m++)this.words[m]=0;this.length+=h;}return this._strip()},s.prototype.ishln=function(t){return u(this.negative===0),this.iushln(t)},s.prototype.iushrn=function(t,n,h){u(typeof t=="number"&&t>=0);var f;n?f=(n-n%26)/26:f=0;var m=t%26,E=Math.min((t-m)/26,this.length),M=67108863^67108863>>>m<<m,p=h;if(f-=E,f=Math.max(0,f),p){for(var i=0;i<E;i++)p.words[i]=this.words[i];p.length=E;}if(E!==0)if(this.length>E)for(this.length-=E,i=0;i<this.length;i++)this.words[i]=this.words[i+E];else this.words[0]=0,this.length=1;var g=0;for(i=this.length-1;i>=0&&(g!==0||i>=f);i--){var x=this.words[i]|0;this.words[i]=g<<26-m|x>>>m,g=x&M;}return p&&g!==0&&(p.words[p.length++]=g),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(t,n,h){return u(this.negative===0),this.iushrn(t,n,h)},s.prototype.shln=function(t){return this.clone().ishln(t)},s.prototype.ushln=function(t){return this.clone().iushln(t)},s.prototype.shrn=function(t){return this.clone().ishrn(t)},s.prototype.ushrn=function(t){return this.clone().iushrn(t)},s.prototype.testn=function(t){u(typeof t=="number"&&t>=0);var n=t%26,h=(t-n)/26,f=1<<n;if(this.length<=h)return !1;var m=this.words[h];return !!(m&f)},s.prototype.imaskn=function(t){u(typeof t=="number"&&t>=0);var n=t%26,h=(t-n)/26;if(u(this.negative===0,"imaskn works only with positive numbers"),this.length<=h)return this;if(n!==0&&h++,this.length=Math.min(h,this.length),n!==0){var f=67108863^67108863>>>n<<n;this.words[this.length-1]&=f;}return this._strip()},s.prototype.maskn=function(t){return this.clone().imaskn(t)},s.prototype.iaddn=function(t){return u(typeof t=="number"),u(t<67108864),t<0?this.isubn(-t):this.negative!==0?this.length===1&&(this.words[0]|0)<=t?(this.words[0]=t-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},s.prototype._iaddn=function(t){this.words[0]+=t;for(var n=0;n<this.length&&this.words[n]>=67108864;n++)this.words[n]-=67108864,n===this.length-1?this.words[n+1]=1:this.words[n+1]++;return this.length=Math.max(this.length,n+1),this},s.prototype.isubn=function(t){if(u(typeof t=="number"),u(t<67108864),t<0)return this.iaddn(-t);if(this.negative!==0)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var n=0;n<this.length&&this.words[n]<0;n++)this.words[n]+=67108864,this.words[n+1]-=1;return this._strip()},s.prototype.addn=function(t){return this.clone().iaddn(t)},s.prototype.subn=function(t){return this.clone().isubn(t)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(t,n,h){var f=t.length+h,m;this._expand(f);var E,M=0;for(m=0;m<t.length;m++){E=(this.words[m+h]|0)+M;var p=(t.words[m]|0)*n;E-=p&67108863,M=(E>>26)-(p/67108864|0),this.words[m+h]=E&67108863;}for(;m<this.length-h;m++)E=(this.words[m+h]|0)+M,M=E>>26,this.words[m+h]=E&67108863;if(M===0)return this._strip();for(u(M===-1),M=0,m=0;m<this.length;m++)E=-(this.words[m]|0)+M,M=E>>26,this.words[m]=E&67108863;return this.negative=1,this._strip()},s.prototype._wordDiv=function(t,n){var h=this.length-t.length,f=this.clone(),m=t,E=m.words[m.length-1]|0,M=this._countBits(E);h=26-M,h!==0&&(m=m.ushln(h),f.iushln(h),E=m.words[m.length-1]|0);var p=f.length-m.length,i;if(n!=="mod"){i=new s(null),i.length=p+1,i.words=new Array(i.length);for(var g=0;g<i.length;g++)i.words[g]=0;}var x=f.clone()._ishlnsubmul(m,1,p);x.negative===0&&(f=x,i&&(i.words[p]=1));for(var S=p-1;S>=0;S--){var N=(f.words[m.length+S]|0)*67108864+(f.words[m.length+S-1]|0);for(N=Math.min(N/E|0,67108863),f._ishlnsubmul(m,N,S);f.negative!==0;)N--,f.negative=0,f._ishlnsubmul(m,1,S),f.isZero()||(f.negative^=1);i&&(i.words[S]=N);}return i&&i._strip(),f._strip(),n!=="div"&&h!==0&&f.iushrn(h),{div:i||null,mod:f}},s.prototype.divmod=function(t,n,h){if(u(!t.isZero()),this.isZero())return {div:new s(0),mod:new s(0)};var f,m,E;return this.negative!==0&&t.negative===0?(E=this.neg().divmod(t,n),n!=="mod"&&(f=E.div.neg()),n!=="div"&&(m=E.mod.neg(),h&&m.negative!==0&&m.iadd(t)),{div:f,mod:m}):this.negative===0&&t.negative!==0?(E=this.divmod(t.neg(),n),n!=="mod"&&(f=E.div.neg()),{div:f,mod:E.mod}):this.negative&t.negative?(E=this.neg().divmod(t.neg(),n),n!=="div"&&(m=E.mod.neg(),h&&m.negative!==0&&m.isub(t)),{div:E.div,mod:m}):t.length>this.length||this.cmp(t)<0?{div:new s(0),mod:this}:t.length===1?n==="div"?{div:this.divn(t.words[0]),mod:null}:n==="mod"?{div:null,mod:new s(this.modrn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new s(this.modrn(t.words[0]))}:this._wordDiv(t,n)},s.prototype.div=function(t){return this.divmod(t,"div",!1).div},s.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},s.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},s.prototype.divRound=function(t){var n=this.divmod(t);if(n.mod.isZero())return n.div;var h=n.div.negative!==0?n.mod.isub(t):n.mod,f=t.ushrn(1),m=t.andln(1),E=h.cmp(f);return E<0||m===1&&E===0?n.div:n.div.negative!==0?n.div.isubn(1):n.div.iaddn(1)},s.prototype.modrn=function(t){var n=t<0;n&&(t=-t),u(t<=67108863);for(var h=(1<<26)%t,f=0,m=this.length-1;m>=0;m--)f=(h*f+(this.words[m]|0))%t;return n?-f:f},s.prototype.modn=function(t){return this.modrn(t)},s.prototype.idivn=function(t){var n=t<0;n&&(t=-t),u(t<=67108863);for(var h=0,f=this.length-1;f>=0;f--){var m=(this.words[f]|0)+h*67108864;this.words[f]=m/t|0,h=m%t;}return this._strip(),n?this.ineg():this},s.prototype.divn=function(t){return this.clone().idivn(t)},s.prototype.egcd=function(t){u(t.negative===0),u(!t.isZero());var n=this,h=t.clone();n.negative!==0?n=n.umod(t):n=n.clone();for(var f=new s(1),m=new s(0),E=new s(0),M=new s(1),p=0;n.isEven()&&h.isEven();)n.iushrn(1),h.iushrn(1),++p;for(var i=h.clone(),g=n.clone();!n.isZero();){for(var x=0,S=1;!(n.words[0]&S)&&x<26;++x,S<<=1);if(x>0)for(n.iushrn(x);x-- >0;)(f.isOdd()||m.isOdd())&&(f.iadd(i),m.isub(g)),f.iushrn(1),m.iushrn(1);for(var N=0,D=1;!(h.words[0]&D)&&N<26;++N,D<<=1);if(N>0)for(h.iushrn(N);N-- >0;)(E.isOdd()||M.isOdd())&&(E.iadd(i),M.isub(g)),E.iushrn(1),M.iushrn(1);n.cmp(h)>=0?(n.isub(h),f.isub(E),m.isub(M)):(h.isub(n),E.isub(f),M.isub(m));}return {a:E,b:M,gcd:h.iushln(p)}},s.prototype._invmp=function(t){u(t.negative===0),u(!t.isZero());var n=this,h=t.clone();n.negative!==0?n=n.umod(t):n=n.clone();for(var f=new s(1),m=new s(0),E=h.clone();n.cmpn(1)>0&&h.cmpn(1)>0;){for(var M=0,p=1;!(n.words[0]&p)&&M<26;++M,p<<=1);if(M>0)for(n.iushrn(M);M-- >0;)f.isOdd()&&f.iadd(E),f.iushrn(1);for(var i=0,g=1;!(h.words[0]&g)&&i<26;++i,g<<=1);if(i>0)for(h.iushrn(i);i-- >0;)m.isOdd()&&m.iadd(E),m.iushrn(1);n.cmp(h)>=0?(n.isub(h),f.isub(m)):(h.isub(n),m.isub(f));}var x;return n.cmpn(1)===0?x=f:x=m,x.cmpn(0)<0&&x.iadd(t),x},s.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var n=this.clone(),h=t.clone();n.negative=0,h.negative=0;for(var f=0;n.isEven()&&h.isEven();f++)n.iushrn(1),h.iushrn(1);do{for(;n.isEven();)n.iushrn(1);for(;h.isEven();)h.iushrn(1);var m=n.cmp(h);if(m<0){var E=n;n=h,h=E;}else if(m===0||h.cmpn(1)===0)break;n.isub(h);}while(!0);return h.iushln(f)},s.prototype.invm=function(t){return this.egcd(t).a.umod(t)},s.prototype.isEven=function(){return (this.words[0]&1)===0},s.prototype.isOdd=function(){return (this.words[0]&1)===1},s.prototype.andln=function(t){return this.words[0]&t},s.prototype.bincn=function(t){u(typeof t=="number");var n=t%26,h=(t-n)/26,f=1<<n;if(this.length<=h)return this._expand(h+1),this.words[h]|=f,this;for(var m=f,E=h;m!==0&&E<this.length;E++){var M=this.words[E]|0;M+=m,m=M>>>26,M&=67108863,this.words[E]=M;}return m!==0&&(this.words[E]=m,this.length++),this},s.prototype.isZero=function(){return this.length===1&&this.words[0]===0},s.prototype.cmpn=function(t){var n=t<0;if(this.negative!==0&&!n)return -1;if(this.negative===0&&n)return 1;this._strip();var h;if(this.length>1)h=1;else {n&&(t=-t),u(t<=67108863,"Number is too big");var f=this.words[0]|0;h=f===t?0:f<t?-1:1;}return this.negative!==0?-h|0:h},s.prototype.cmp=function(t){if(this.negative!==0&&t.negative===0)return -1;if(this.negative===0&&t.negative!==0)return 1;var n=this.ucmp(t);return this.negative!==0?-n|0:n},s.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return -1;for(var n=0,h=this.length-1;h>=0;h--){var f=this.words[h]|0,m=t.words[h]|0;if(f!==m){f<m?n=-1:f>m&&(n=1);break}}return n},s.prototype.gtn=function(t){return this.cmpn(t)===1},s.prototype.gt=function(t){return this.cmp(t)===1},s.prototype.gten=function(t){return this.cmpn(t)>=0},s.prototype.gte=function(t){return this.cmp(t)>=0},s.prototype.ltn=function(t){return this.cmpn(t)===-1},s.prototype.lt=function(t){return this.cmp(t)===-1},s.prototype.lten=function(t){return this.cmpn(t)<=0},s.prototype.lte=function(t){return this.cmp(t)<=0},s.prototype.eqn=function(t){return this.cmpn(t)===0},s.prototype.eq=function(t){return this.cmp(t)===0},s.red=function(t){return new ot(t)},s.prototype.toRed=function(t){return u(!this.red,"Already a number in reduction context"),u(this.negative===0,"red works only with positives"),t.convertTo(this)._forceRed(t)},s.prototype.fromRed=function(){return u(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(t){return this.red=t,this},s.prototype.forceRed=function(t){return u(!this.red,"Already a number in reduction context"),this._forceRed(t)},s.prototype.redAdd=function(t){return u(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},s.prototype.redIAdd=function(t){return u(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},s.prototype.redSub=function(t){return u(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},s.prototype.redISub=function(t){return u(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},s.prototype.redShl=function(t){return u(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},s.prototype.redMul=function(t){return u(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},s.prototype.redIMul=function(t){return u(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},s.prototype.redSqr=function(){return u(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return u(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return u(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return u(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return u(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(t){return u(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var Bt={k256:null,p224:null,p192:null,p25519:null};function Nt(y,t){this.name=y,this.p=new s(t,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp();}Nt.prototype._tmp=function(){var t=new s(null);return t.words=new Array(Math.ceil(this.n/13)),t},Nt.prototype.ireduce=function(t){var n=t,h;do this.split(n,this.tmp),n=this.imulK(n),n=n.iadd(this.tmp),h=n.bitLength();while(h>this.n);var f=h<this.n?-1:n.ucmp(this.p);return f===0?(n.words[0]=0,n.length=1):f>0?n.isub(this.p):n.strip!==void 0?n.strip():n._strip(),n},Nt.prototype.split=function(t,n){t.iushrn(this.n,0,n);},Nt.prototype.imulK=function(t){return t.imul(this.k)};function Zt(){Nt.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f");}v(Zt,Nt),Zt.prototype.split=function(t,n){for(var h=4194303,f=Math.min(t.length,9),m=0;m<f;m++)n.words[m]=t.words[m];if(n.length=f,t.length<=9){t.words[0]=0,t.length=1;return}var E=t.words[9];for(n.words[n.length++]=E&h,m=10;m<t.length;m++){var M=t.words[m]|0;t.words[m-10]=(M&h)<<4|E>>>22,E=M;}E>>>=22,t.words[m-10]=E,E===0&&t.length>10?t.length-=10:t.length-=9;},Zt.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var n=0,h=0;h<t.length;h++){var f=t.words[h]|0;n+=f*977,t.words[h]=n&67108863,n=f*64+(n/67108864|0);}return t.words[t.length-1]===0&&(t.length--,t.words[t.length-1]===0&&t.length--),t};function de(){Nt.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001");}v(de,Nt);function me(){Nt.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff");}v(me,Nt);function Xt(){Nt.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed");}v(Xt,Nt),Xt.prototype.imulK=function(t){for(var n=0,h=0;h<t.length;h++){var f=(t.words[h]|0)*19+n,m=f&67108863;f>>>=26,t.words[h]=m,n=f;}return n!==0&&(t.words[t.length++]=n),t},s._prime=function(t){if(Bt[t])return Bt[t];var n;if(t==="k256")n=new Zt;else if(t==="p224")n=new de;else if(t==="p192")n=new me;else if(t==="p25519")n=new Xt;else throw new Error("Unknown prime "+t);return Bt[t]=n,n};function ot(y){if(typeof y=="string"){var t=s._prime(y);this.m=t.p,this.prime=t;}else u(y.gtn(1),"modulus must be greater than 1"),this.m=y,this.prime=null;}ot.prototype._verify1=function(t){u(t.negative===0,"red works only with positives"),u(t.red,"red works only with red numbers");},ot.prototype._verify2=function(t,n){u((t.negative|n.negative)===0,"red works only with positives"),u(t.red&&t.red===n.red,"red works only with red numbers");},ot.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):(U(t,t.umod(this.m)._forceRed(this)),t)},ot.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},ot.prototype.add=function(t,n){this._verify2(t,n);var h=t.add(n);return h.cmp(this.m)>=0&&h.isub(this.m),h._forceRed(this)},ot.prototype.iadd=function(t,n){this._verify2(t,n);var h=t.iadd(n);return h.cmp(this.m)>=0&&h.isub(this.m),h},ot.prototype.sub=function(t,n){this._verify2(t,n);var h=t.sub(n);return h.cmpn(0)<0&&h.iadd(this.m),h._forceRed(this)},ot.prototype.isub=function(t,n){this._verify2(t,n);var h=t.isub(n);return h.cmpn(0)<0&&h.iadd(this.m),h},ot.prototype.shl=function(t,n){return this._verify1(t),this.imod(t.ushln(n))},ot.prototype.imul=function(t,n){return this._verify2(t,n),this.imod(t.imul(n))},ot.prototype.mul=function(t,n){return this._verify2(t,n),this.imod(t.mul(n))},ot.prototype.isqr=function(t){return this.imul(t,t.clone())},ot.prototype.sqr=function(t){return this.mul(t,t)},ot.prototype.sqrt=function(t){if(t.isZero())return t.clone();var n=this.m.andln(3);if(u(n%2===1),n===3){var h=this.m.add(new s(1)).iushrn(2);return this.pow(t,h)}for(var f=this.m.subn(1),m=0;!f.isZero()&&f.andln(1)===0;)m++,f.iushrn(1);u(!f.isZero());var E=new s(1).toRed(this),M=E.redNeg(),p=this.m.subn(1).iushrn(1),i=this.m.bitLength();for(i=new s(2*i*i).toRed(this);this.pow(i,p).cmp(M)!==0;)i.redIAdd(M);for(var g=this.pow(i,f),x=this.pow(t,f.addn(1).iushrn(1)),S=this.pow(t,f),N=m;S.cmp(E)!==0;){for(var D=S,q=0;D.cmp(E)!==0;q++)D=D.redSqr();u(q<N);var X=this.pow(g,new s(1).iushln(N-q-1));x=x.redMul(X),g=X.redSqr(),S=S.redMul(g),N=q;}return x},ot.prototype.invm=function(t){var n=t._invmp(this.m);return n.negative!==0?(n.negative=0,this.imod(n).redNeg()):this.imod(n)},ot.prototype.pow=function(t,n){if(n.isZero())return new s(1).toRed(this);if(n.cmpn(1)===0)return t.clone();var h=4,f=new Array(1<<h);f[0]=new s(1).toRed(this),f[1]=t;for(var m=2;m<f.length;m++)f[m]=this.mul(f[m-1],t);var E=f[0],M=0,p=0,i=n.bitLength()%26;for(i===0&&(i=26),m=n.length-1;m>=0;m--){for(var g=n.words[m],x=i-1;x>=0;x--){var S=g>>x&1;if(E!==f[0]&&(E=this.sqr(E)),S===0&&M===0){p=0;continue}M<<=1,M|=S,p++,!(p!==h&&(m!==0||x!==0))&&(E=this.mul(E,f[M]),p=0,M=0);}i=26;}return E},ot.prototype.convertTo=function(t){var n=t.umod(this.m);return n===t?n.clone():n},ot.prototype.convertFrom=function(t){var n=t.clone();return n.red=null,n},s.mont=function(t){return new kt(t)};function kt(y){ot.call(this,y),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv);}v(kt,ot),kt.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},kt.prototype.convertFrom=function(t){var n=this.imod(t.mul(this.rinv));return n.red=null,n},kt.prototype.imul=function(t,n){if(t.isZero()||n.isZero())return t.words[0]=0,t.length=1,t;var h=t.imul(n),f=h.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),m=h.isub(f).iushrn(this.shift),E=m;return m.cmp(this.m)>=0?E=m.isub(this.m):m.cmpn(0)<0&&(E=m.iadd(this.m)),E._forceRed(this)},kt.prototype.mul=function(t,n){if(t.isZero()||n.isZero())return new s(0)._forceRed(this);var h=t.mul(n),f=h.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),m=h.isub(f).iushrn(this.shift),E=m;return m.cmp(this.m)>=0?E=m.isub(this.m):m.cmpn(0)<0&&(E=m.iadd(this.m)),E._forceRed(this)},kt.prototype.invm=function(t){var n=this.imod(t._invmp(this.m).mul(this.r2));return n._forceRed(this)};})(typeof gr>"u"||gr,wi);});var vr=te((fs,Ai)=>{_();R();Ai.exports=yr;yr.strict=Mi;yr.loose=Ti;var Vn=Object.prototype.toString,Gn={"[object Int8Array]":!0,"[object Int16Array]":!0,"[object Int32Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Uint16Array]":!0,"[object Uint32Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0};function yr(o){return Mi(o)||Ti(o)}function Mi(o){return o instanceof Int8Array||o instanceof Int16Array||o instanceof Int32Array||o instanceof Uint8Array||o instanceof Uint8ClampedArray||o instanceof Uint16Array||o instanceof Uint32Array||o instanceof Float32Array||o instanceof Float64Array}function Ti(o){return Gn[Vn.call(o)]}});var Ii=te((ds,Ci)=>{_();R();var Wn=vr().strict;Ci.exports=function(a){if(Wn(a)){var u=L.from(a.buffer);return a.byteLength!==a.buffer.byteLength&&(u=u.slice(a.byteOffset,a.byteOffset+a.byteLength)),u}else return L.from(a)};});var Hi=te(O=>{_();R();var Ri=O&&O.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(O,"__esModule",{value:!0});var Zn=Ri(vr()),$n=Ri(Ii()),wr="hex",Er="utf8",qn="binary",Jn="buffer",zn="array",Yn="typed-array",jn="array-buffer",ne="0";function Ce(o){return new Uint8Array(o)}O.bufferToArray=Ce;function Mr(o,a=!1){let u=o.toString(wr);return a?xe(u):u}O.bufferToHex=Mr;function Tr(o){return o.toString(Er)}O.bufferToUtf8=Tr;function _i(o){return o.readUIntBE(0,o.length)}O.bufferToNumber=_i;function Kn(o){return Ie(Ce(o))}O.bufferToBinary=Kn;function oe(o){return $n.default(o)}O.arrayToBuffer=oe;function bi(o,a=!1){return Mr(oe(o),a)}O.arrayToHex=bi;function xi(o){return Tr(oe(o))}O.arrayToUtf8=xi;function Ar(o){return _i(oe(o))}O.arrayToNumber=Ar;function Ie(o){return Array.from(o).map(ae).join("")}O.arrayToBinary=Ie;function Cr(o){return L.from(be(o),wr)}O.hexToBuffer=Cr;function Ir(o){return Ce(Cr(o))}O.hexToArray=Ir;function Xn(o){return Tr(Cr(o))}O.hexToUtf8=Xn;function Qn(o){return Ar(Ir(o))}O.hexToNumber=Qn;function Si(o){return Ie(Ir(o))}O.hexToBinary=Si;function Rr(o){return L.from(o,Er)}O.utf8ToBuffer=Rr;function Bi(o){return Ce(Rr(o))}O.utf8ToArray=Bi;function to(o,a=!1){return Mr(Rr(o),a)}O.utf8ToHex=to;function eo(o){let a=parseInt(o,10);return To(Mo(a),"Number can only safely store up to 53 bits"),a}O.utf8ToNumber=eo;function ro(o){return Ie(Bi(o))}O.utf8ToBinary=ro;function io(o){return Pi(ae(o))}O.numberToBuffer=io;function no(o){return Jt(ae(o))}O.numberToArray=no;function oo(o,a){return _r(ae(o),a)}O.numberToHex=oo;function ao(o){return `${o}`}O.numberToUtf8=ao;function ae(o){let a=(o>>>0).toString(2);return _e(a)}O.numberToBinary=ae;function Pi(o){return oe(Jt(o))}O.binaryToBuffer=Pi;function Jt(o){return new Uint8Array(xr(o).map(a=>parseInt(a,2)))}O.binaryToArray=Jt;function _r(o,a){return bi(Jt(o),a)}O.binaryToHex=_r;function so(o){return xi(Jt(o))}O.binaryToUtf8=so;function lo(o){return Ar(Jt(o))}O.binaryToNumber=lo;function Ni(o){return !(typeof o!="string"||!new RegExp(/^[01]+$/).test(o)||o.length%8!==0)}O.isBinaryString=Ni;function Oi(o,a){return !(typeof o!="string"||!o.match(/^0x[0-9A-Fa-f]*$/)||a&&o.length!==2+2*a)}O.isHexString=Oi;function Re(o){return L.isBuffer(o)}O.isBuffer=Re;function br(o){return Zn.default.strict(o)&&!Re(o)}O.isTypedArray=br;function Ui(o){return !br(o)&&!Re(o)&&typeof o.byteLength<"u"}O.isArrayBuffer=Ui;function ho(o){return Re(o)?Jn:br(o)?Yn:Ui(o)?jn:Array.isArray(o)?zn:typeof o}O.getType=ho;function uo(o){return Ni(o)?qn:Oi(o)?wr:Er}O.getEncoding=uo;function fo(...o){return L.concat(o)}O.concatBuffers=fo;function co(...o){let a=[];return o.forEach(u=>a=a.concat(Array.from(u))),new Uint8Array([...a])}O.concatArrays=co;function po(o,a){let u=o.length-a;return u>0&&(o=o.slice(u)),o}O.trimLeft=po;function mo(o,a){return o.slice(0,a)}O.trimRight=mo;function ki(o,a=8){let u=o%a;return u?(o-u)/a*a+a:o}O.calcByteLength=ki;function xr(o,a=8){let u=_e(o).match(new RegExp(`.{${a}}`,"gi"));return Array.from(u||[])}O.splitBytes=xr;function Li(o){return xr(o).map(Ao).join("")}O.swapBytes=Li;function go(o){return _r(Li(Si(o)))}O.swapHex=go;function _e(o,a=8,u=ne){return Di(o,ki(o.length,a),u)}O.sanitizeBytes=_e;function Di(o,a,u=ne){return Fi(o,a,!0,u)}O.padLeft=Di;function yo(o,a,u=ne){return Fi(o,a,!1,u)}O.padRight=yo;function be(o){return o.replace(/^0x/,"")}O.removeHexPrefix=be;function xe(o){return o.startsWith("0x")?o:`0x${o}`}O.addHexPrefix=xe;function vo(o){return o=be(o),o=_e(o,2),o&&(o=xe(o)),o}O.sanitizeHex=vo;function wo(o){let a=o.startsWith("0x");return o=be(o),o=o.startsWith(ne)?o.substring(1):o,a?xe(o):o}O.removeHexLeadingZeros=wo;function Eo(o){return typeof o>"u"}function Mo(o){return !Eo(o)}function To(o,a){if(!o)throw new Error(a)}function Ao(o){return o.split("").reverse().join("")}function Fi(o,a,u,v=ne){let s=a-o.length,T=o;if(s>0){let d=v.repeat(s);T=u?d+o:o+d;}return T}});_();R();_();R();_();R();_();R();_();R();var ai=(a=>(a.ACCOUNTS_REQUESTED="accountsRequested",a))(ai||{}),bn=(a=>(a.ACCOUNTS_CHANGED="accountsChanged",a))(bn||{}),xn=(d=>(d.PENDING="PENDING",d.SUBMITTED="SUBMITTED",d.SUCCESSFUL="SUCCESSFUL",d.REVERTED="REVERTED",d.FAILED="FAILED",d.CANCELLED="CANCELLED",d))(xn||{});_();R();var gi={};An(gi,{coerceNonceSpace:()=>di,digestOfTransactionsAndNonce:()=>pi,encodeMessageSubDigest:()=>Ee,encodeNonce:()=>mi,encodedTransactions:()=>pr,getEip155ChainId:()=>Ot,getNonce:()=>re,getNormalisedTransactions:()=>we,packSignatures:()=>Te,signAndPackTypedData:()=>dr,signERC191Message:()=>mr,signMetaTransactions:()=>Me});_();R();var ui=1,Ln=1,Dn=2,fi="02",Fn="",ci=`tuple(
13
13
  bool delegateCall,
14
14
  bool revertOnError,
15
15
  uint256 gasLimit,
16
16
  address target,
17
17
  uint256 value,
18
18
  bytes data
19
- )[]`,Ee=o=>o.map(a=>({delegateCall:a.delegateCall===!0,revertOnError:a.revertOnError===!0,gasLimit:a.gasLimit??BigInt(0),target:a.to??ZeroAddress,value:a.value??BigInt(0),data:a.data??"0x"})),mi=(o,a)=>{let h=AbiCoder.defaultAbiCoder().encode(["uint256",di],[o,a]);return keccak256(h)},dr=o=>AbiCoder.defaultAbiCoder().encode([di],[o]),gi=o=>o||0n,yi=(o,a)=>{let h=BigInt(o)*2n**96n;return BigInt(a)+h},ie=async(o,a,h)=>{try{let v=new Contract(a,walletContracts.mainModule.abi,o),s=gi(h),A=await v.readNonce(s);if(typeof A=="bigint")return yi(s,A);throw new Error("Unexpected result from contract.nonce() call.")}catch(v){if(isError(v,"BAD_DATA"))return BigInt(0);throw v}},Me=(o,a,h)=>solidityPacked(["string","uint256","address","bytes32"],[Vn,o,a,h]),Ae=async(o,a,h,v,s)=>{let A=Ee(o),d=mi(a,A),I=Me(h,v,d),x=keccak256(I),O=getBytes(x),Z=`${await s.signMessage(O)}${pi}`,z=v1.signature.encodeSignature({version:1,threshold:Fn,signers:[{isDynamic:!1,unrecovered:!0,weight:ci,signature:Z}]}),P=new Interface(walletContracts.mainModule.abi);return P.encodeFunctionData(P.getFunction("execute")??"",[A,a,z])},Gn=o=>{let a=`0x0000${o}`;return v1.signature.decodeSignature(a)},Te=(o,a,h)=>{let v=`${o}${pi}`,{signers:s}=Gn(h),d=[...s,{isDynamic:!1,unrecovered:!0,weight:ci,signature:v,address:a}].sort((I,x)=>{let O=BigInt(I.address??0),L=BigInt(x.address??0);return O<=L?-1:O===L?0:1});return v1.signature.encodeSignature({version:1,threshold:Hn,signers:d})},mr=async(o,a,h,v,s)=>{let A={...o.types};delete A.EIP712Domain;let d=TypedDataEncoder.hash(o.domain,A,o.message),I=Me(h,v,d),x=keccak256(I),O=getBytes(x),L=await s.signMessage(O),Z=await s.getAddress();return Te(L,Z,a)},gr=async(o,a,h,v)=>{let s=hashMessage(a),A=Me(o,v,s),d=keccak256(A),I=getBytes(d);return h.signMessage(I)},Ot=o=>`eip155:${o}`;var ne=class o{config;rpcProvider;authManager;constructor({config:a,rpcProvider:h,authManager:v}){this.config=a,this.rpcProvider=h,this.authManager=v;}static getResponsePreview(a){return a.length>100?`${a.substring(0,50)}...${a.substring(a.length-50)}`:a}async postToRelayer(a){let h={id:1,jsonrpc:"2.0",...a},v=await this.authManager.getUserZkEvm(),s=await fetch(`${this.config.relayerUrl}/v1/transactions`,{method:"POST",headers:{Authorization:`Bearer ${v.accessToken}`,"Content-Type":"application/json"},body:JSON.stringify(h)}),A=await s.text();if(!s.ok){let I=o.getResponsePreview(A);throw new Error(`Relayer HTTP error: ${s.status}. Content: "${I}"`)}let d;try{d=JSON.parse(A);}catch(I){let x=o.getResponsePreview(A);throw new Error(`Relayer JSON parse error: ${I instanceof Error?I.message:"Unknown error"}. Content: "${x}"`)}if(d.error)throw new Error(d.error);return d}async ethSendTransaction(a,h){let{chainId:v}=await this.rpcProvider.getNetwork(),s={method:"eth_sendTransaction",params:[{to:a,data:h,chainId:Ot(Number(v))}]},{result:A}=await this.postToRelayer(s);return A}async imGetTransactionByHash(a){let h={method:"im_getTransactionByHash",params:[a]},{result:v}=await this.postToRelayer(h);return v}async imGetFeeOptions(a,h){let{chainId:v}=await this.rpcProvider.getNetwork(),s={method:"im_getFeeOptions",params:[{userAddress:a,data:h,chainId:Ot(Number(v))}]},{result:A}=await this.postToRelayer(s);return A}async imSignTypedData(a,h){let{chainId:v}=await this.rpcProvider.getNetwork(),s={method:"im_signTypedData",params:[{address:a,eip712Payload:h,chainId:Ot(Number(v))}]},{result:A}=await this.postToRelayer(s);return A}async imSign(a,h){let{chainId:v}=await this.rpcProvider.getNetwork(),s={method:"im_sign",params:[{address:a,message:h,chainId:Ot(Number(v))}]},{result:A}=await this.postToRelayer(s);return A}};_();R();var Ce=(s=>(s[s.USER_REJECTED_REQUEST=4001]="USER_REJECTED_REQUEST",s[s.UNAUTHORIZED=4100]="UNAUTHORIZED",s[s.UNSUPPORTED_METHOD=4200]="UNSUPPORTED_METHOD",s[s.DISCONNECTED=4900]="DISCONNECTED",s))(Ce||{}),kt=(I=>(I[I.RPC_SERVER_ERROR=-32e3]="RPC_SERVER_ERROR",I[I.INVALID_REQUEST=-32600]="INVALID_REQUEST",I[I.METHOD_NOT_FOUND=-32601]="METHOD_NOT_FOUND",I[I.INVALID_PARAMS=-32602]="INVALID_PARAMS",I[I.INTERNAL_ERROR=-32603]="INTERNAL_ERROR",I[I.PARSE_ERROR=-32700]="PARSE_ERROR",I[I.TRANSACTION_REJECTED=-32003]="TRANSACTION_REJECTED",I))(kt||{}),H=class extends Error{message;code;constructor(a,h){super(h),this.message=h,this.code=a;}};_();R();_();R();_();R();var Ft=ri(Ai()),Ht=ri(Gi());function Ro(o){return Ht.addHexPrefix(Ht.padLeft(o.r.toString(16),64)+Ht.padLeft(o.s.toString(16),64)+Ht.padLeft(o.recoveryParam?.toString(16)||"",2))}function _o(o){let a=new Ft.default(o,16).cmp(new Ft.default(27))!==-1?new Ft.default(o,16).sub(new Ft.default(27)).toNumber():new Ft.default(o,16).toNumber();return o.trim()?a:void 0}function xo(o,a=64){let h=Ht.removeHexPrefix(o);return {r:new Ft.default(h.substring(0,a),"hex"),s:new Ft.default(h.substring(a,a*2),"hex"),recoveryParam:_o(h.substring(a*2,a*2+2))}}async function Wi(o,a){let h=xo(await a.signMessage(o));return Ro(h)}var bo="Only sign this message from Immutable Passport";async function Zi({authManager:o,ethSigner:a,multiRollupApiClients:h,accessToken:v,rpcProvider:s,flow:A}){let d=a.getAddress();d.then(()=>A.addEvent("endGetAddress"));let I=Wi(bo,a);I.then(()=>A.addEvent("endSignRaw"));let x=s.getNetwork();x.then(()=>A.addEvent("endDetectNetwork"));let O=h.chainsApi.listChains();O.then(()=>A.addEvent("endListChains"));let[L,Z,z,P]=await Promise.all([d,I,x,O]),F=Ot(Number(z.chainId)),$=P.data?.result?.find(q=>q.id===F)?.name;if(!$)throw new H(-32603,`Chain name does not exist on for chain id ${z.chainId}`);try{let q=await h.passportApi.createCounterfactualAddressV2({chainName:$,createCounterfactualAddressRequest:{ethereum_address:L,ethereum_signature:Z}},{headers:{Authorization:`Bearer ${v}`}});return A.addEvent("endCreateCounterfactualAddress"),o.forceUserRefreshInBackground(),q.data.counterfactual_address}catch(q){throw new H(-32603,`Failed to create counterfactual address: ${q}`)}}_();R();_();R();_();R();_();R();_();R();var le="imx_passport_confirmation";_();R();var Be=({url:o,title:a,width:h,height:v})=>{let s=Math.max(0,Math.round(window.screenX+(window.outerWidth-h)/2)),A=Math.max(0,Math.round(window.screenY+(window.outerHeight-v)/2)),d=window.open(o,a,`
19
+ )[]`,we=o=>o.map(a=>({delegateCall:a.delegateCall===!0,revertOnError:a.revertOnError===!0,gasLimit:a.gasLimit??BigInt(0),target:a.to??ZeroAddress,value:a.value??BigInt(0),data:a.data??"0x"})),pi=(o,a)=>{let u=AbiCoder.defaultAbiCoder().encode(["uint256",ci],[o,a]);return keccak256(u)},pr=o=>AbiCoder.defaultAbiCoder().encode([ci],[o]),di=o=>o||0n,mi=(o,a)=>{let u=BigInt(o)*2n**96n;return BigInt(a)+u},re=async(o,a,u)=>{try{let v=new Contract(a,walletContracts.mainModule.abi,o),s=di(u),T=await v.readNonce(s);if(typeof T=="bigint")return mi(s,T);throw new Error("Unexpected result from contract.nonce() call.")}catch(v){if(isError(v,"BAD_DATA"))return BigInt(0);throw v}},Ee=(o,a,u)=>solidityPacked(["string","uint256","address","bytes32"],[Fn,o,a,u]),Me=async(o,a,u,v,s)=>{let T=we(o),d=pi(a,T),I=Ee(u,v,d),b=keccak256(I),U=getBytes(b),Z=`${await s.signMessage(U)}${fi}`,z=v1.signature.encodeSignature({version:1,threshold:Ln,signers:[{isDynamic:!1,unrecovered:!0,weight:ui,signature:Z}]}),P=new Interface(walletContracts.mainModule.abi);return P.encodeFunctionData(P.getFunction("execute")??"",[T,a,z])},Hn=o=>{let a=`0x0000${o}`;return v1.signature.decodeSignature(a)},Te=(o,a,u)=>{let v=`${o}${fi}`,{signers:s}=Hn(u),d=[...s,{isDynamic:!1,unrecovered:!0,weight:ui,signature:v,address:a}].sort((I,b)=>{let U=BigInt(I.address??0),k=BigInt(b.address??0);return U<=k?-1:U===k?0:1});return v1.signature.encodeSignature({version:1,threshold:Dn,signers:d})},dr=async(o,a,u,v,s)=>{let T={...o.types};delete T.EIP712Domain;let d=TypedDataEncoder.hash(o.domain,T,o.message),I=Ee(u,v,d),b=keccak256(I),U=getBytes(b),k=await s.signMessage(U),Z=await s.getAddress();return Te(k,Z,a)},mr=async(o,a,u,v)=>{let s=hashMessage(a),T=Ee(o,v,s),d=keccak256(T),I=getBytes(d);return u.signMessage(I)},Ot=o=>`eip155:${o}`;var ie=class o{config;rpcProvider;auth;constructor({config:a,rpcProvider:u,auth:v}){this.config=a,this.rpcProvider=u,this.auth=v;}static getResponsePreview(a){return a.length>100?`${a.substring(0,50)}...${a.substring(a.length-50)}`:a}async postToRelayer(a){let u={id:1,jsonrpc:"2.0",...a},v=await this.auth.getUserZkEvm(),s=await fetch(`${this.config.relayerUrl}/v1/transactions`,{method:"POST",headers:{Authorization:`Bearer ${v.accessToken}`,"Content-Type":"application/json"},body:JSON.stringify(u)}),T=await s.text();if(!s.ok){let I=o.getResponsePreview(T);throw new Error(`Relayer HTTP error: ${s.status}. Content: "${I}"`)}let d;try{d=JSON.parse(T);}catch(I){let b=o.getResponsePreview(T);throw new Error(`Relayer JSON parse error: ${I instanceof Error?I.message:"Unknown error"}. Content: "${b}"`)}if(d.error)throw new Error(d.error);return d}getPreferredFeeTokenSymbol(){return this.config.feeTokenSymbol}async ethSendTransaction(a,u){let{chainId:v}=await this.rpcProvider.getNetwork(),s={method:"eth_sendTransaction",params:[{to:a,data:u,chainId:Ot(Number(v))}]},{result:T}=await this.postToRelayer(s);return T}async imGetTransactionByHash(a){let u={method:"im_getTransactionByHash",params:[a]},{result:v}=await this.postToRelayer(u);return v}async imGetFeeOptions(a,u){let{chainId:v}=await this.rpcProvider.getNetwork(),s={method:"im_getFeeOptions",params:[{userAddress:a,data:u,chainId:Ot(Number(v))}]},{result:T}=await this.postToRelayer(s);return T}async imSignTypedData(a,u){let{chainId:v}=await this.rpcProvider.getNetwork(),s={method:"im_signTypedData",params:[{address:a,eip712Payload:u,chainId:Ot(Number(v))}]},{result:T}=await this.postToRelayer(s);return T}async imSign(a,u){let{chainId:v}=await this.rpcProvider.getNetwork(),s={method:"im_sign",params:[{address:a,message:u,chainId:Ot(Number(v))}]},{result:T}=await this.postToRelayer(s);return T}};_();R();var Ae=(s=>(s[s.USER_REJECTED_REQUEST=4001]="USER_REJECTED_REQUEST",s[s.UNAUTHORIZED=4100]="UNAUTHORIZED",s[s.UNSUPPORTED_METHOD=4200]="UNSUPPORTED_METHOD",s[s.DISCONNECTED=4900]="DISCONNECTED",s))(Ae||{}),Lt=(I=>(I[I.RPC_SERVER_ERROR=-32e3]="RPC_SERVER_ERROR",I[I.INVALID_REQUEST=-32600]="INVALID_REQUEST",I[I.METHOD_NOT_FOUND=-32601]="METHOD_NOT_FOUND",I[I.INVALID_PARAMS=-32602]="INVALID_PARAMS",I[I.INTERNAL_ERROR=-32603]="INTERNAL_ERROR",I[I.PARSE_ERROR=-32700]="PARSE_ERROR",I[I.TRANSACTION_REJECTED=-32003]="TRANSACTION_REJECTED",I))(Lt||{}),H=class extends Error{message;code;constructor(a,u){super(u),this.message=u,this.code=a;}};_();R();_();R();_();R();var Ft=ei(Ei()),Ht=ei(Hi());function Co(o){return Ht.addHexPrefix(Ht.padLeft(o.r.toString(16),64)+Ht.padLeft(o.s.toString(16),64)+Ht.padLeft(o.recoveryParam?.toString(16)||"",2))}function Io(o){let a=new Ft.default(o,16).cmp(new Ft.default(27))!==-1?new Ft.default(o,16).sub(new Ft.default(27)).toNumber():new Ft.default(o,16).toNumber();return o.trim()?a:void 0}function Ro(o,a=64){let u=Ht.removeHexPrefix(o);return {r:new Ft.default(u.substring(0,a),"hex"),s:new Ft.default(u.substring(a,a*2),"hex"),recoveryParam:Io(u.substring(a*2,a*2+2))}}async function Vi(o,a){let u=Ro(await a.signMessage(o));return Co(u)}var _o="Only sign this message from Immutable Passport";async function Gi({auth:o,ethSigner:a,multiRollupApiClients:u,accessToken:v,rpcProvider:s,flow:T}){let d=a.getAddress();d.then(()=>T.addEvent("endGetAddress"));let I=Vi(_o,a);I.then(()=>T.addEvent("endSignRaw"));let b=s.getNetwork();b.then(()=>T.addEvent("endDetectNetwork"));let U=u.chainsApi.listChains();U.then(()=>T.addEvent("endListChains"));let[k,Z,z,P]=await Promise.all([d,I,b,U]),F=Ot(Number(z.chainId)),$=P.data?.result?.find(J=>J.id===F)?.name;if(!$)throw new H(-32603,`Chain name does not exist on for chain id ${z.chainId}`);try{let J=await u.passportApi.createCounterfactualAddressV2({chainName:$,createCounterfactualAddressRequest:{ethereum_address:k,ethereum_signature:Z}},{headers:{Authorization:`Bearer ${v}`}});return T.addEvent("endCreateCounterfactualAddress"),o.forceUserRefreshInBackground(),J.data.counterfactual_address}catch(J){throw new H(-32603,`Failed to create counterfactual address: ${J}`)}}_();R();_();R();_();R();_();R();_();R();var se="imx_passport_confirmation";_();R();var Se=({url:o,title:a,width:u,height:v})=>{let s=Math.max(0,Math.round(window.screenX+(window.outerWidth-u)/2)),T=Math.max(0,Math.round(window.screenY+(window.outerHeight-v)/2)),d=window.open(o,a,`
20
20
  scrollbars=yes,
21
- width=${h},
21
+ width=${u},
22
22
  height=${v},
23
- top=${A},
23
+ top=${T},
24
24
  left=${s}
25
- `);if(!d)throw new Error("Failed to open confirmation screen");return d.focus(),d};_();R();_();R();var he="passport-overlay",$i="passport-overlay-contents",Pe=`${he}-close`,Ne=`${he}-try-again`,qi=`
25
+ `);if(!d)throw new Error("Failed to open confirmation screen");return d.focus(),d};_();R();_();R();var le="passport-overlay",Wi="passport-overlay-contents",Be=`${le}-close`,Pe=`${le}-try-again`,Zi=`
26
26
  <svg
27
27
  viewBox="0 0 20 20"
28
28
  fill="none"
@@ -34,7 +34,7 @@ var En=Object.create;var hr=Object.defineProperty;var Mn=Object.getOwnPropertyDe
34
34
  fill="#F3F3F3"
35
35
  />
36
36
  </svg>
37
- `,Ji=`
37
+ `,$i=`
38
38
  <svg
39
39
  viewBox="0 0 17 16"
40
40
  fill="none"
@@ -48,7 +48,7 @@ var En=Object.create;var hr=Object.defineProperty;var Mn=Object.getOwnPropertyDe
48
48
  fill="#E01A3D"
49
49
  />
50
50
  </svg>
51
- `,Br=`
51
+ `,Sr=`
52
52
  <svg
53
53
  style="
54
54
  max-width: 123px !important;
@@ -231,9 +231,9 @@ var En=Object.create;var hr=Object.defineProperty;var Mn=Object.getOwnPropertyDe
231
231
  </clipPath>
232
232
  </defs>
233
233
  </svg>
234
- `;_();R();var So=()=>`
234
+ `;_();R();var bo=()=>`
235
235
  <button
236
- id="${Pe}"
236
+ id="${Be}"
237
237
  style="
238
238
  background: #f3f3f326 !important;
239
239
  border: none !important;
@@ -249,11 +249,11 @@ var En=Object.create;var hr=Object.defineProperty;var Mn=Object.getOwnPropertyDe
249
249
  justify-content: center !important;
250
250
  "
251
251
  >
252
- ${qi}
252
+ ${Zi}
253
253
  </button>
254
- `,zi=()=>`
254
+ `,qi=()=>`
255
255
  <button
256
- id="${Ne}"
256
+ id="${Pe}"
257
257
  style="
258
258
  margin-top: 27px !important;
259
259
  color: #f3f3f3 !important;
@@ -268,8 +268,8 @@ var En=Object.create;var hr=Object.defineProperty;var Mn=Object.getOwnPropertyDe
268
268
  >
269
269
  Try again
270
270
  </button>
271
- `,Bo=()=>`
272
- ${Br}
271
+ `,xo=()=>`
272
+ ${Sr}
273
273
  <div
274
274
  style="
275
275
  color: #e01a3d !important;
@@ -279,7 +279,7 @@ var En=Object.create;var hr=Object.defineProperty;var Mn=Object.getOwnPropertyDe
279
279
  margin-bottom: 10px !important;
280
280
  "
281
281
  >
282
- ${Ji}
282
+ ${$i}
283
283
  Pop-up blocked
284
284
  </div>
285
285
  <p style="
@@ -292,9 +292,9 @@ var En=Object.create;var hr=Object.defineProperty;var Mn=Object.getOwnPropertyDe
292
292
  If the problem continues, adjust your<br />
293
293
  browser settings.
294
294
  </p>
295
- ${zi()}
296
- `,Po=()=>`
297
- ${Br}
295
+ ${qi()}
296
+ `,So=()=>`
297
+ ${Sr}
298
298
  <p style="
299
299
  color: #b6b6b6 !important;
300
300
  text-align: center !important;
@@ -303,10 +303,10 @@ var En=Object.create;var hr=Object.defineProperty;var Mn=Object.getOwnPropertyDe
303
303
  >
304
304
  Secure pop-up not showing?<br />We'll help you re-launch
305
305
  </p>
306
- ${zi()}
307
- `,ji=o=>`
306
+ ${qi()}
307
+ `,Ji=o=>`
308
308
  <div
309
- id="${he}"
309
+ id="${le}"
310
310
  style="
311
311
  position: fixed !important;
312
312
  top: 0 !important;
@@ -329,9 +329,9 @@ var En=Object.create;var hr=Object.defineProperty;var Mn=Object.getOwnPropertyDe
329
329
  z-index: 2147483647 !important;
330
330
  "
331
331
  >
332
- ${So()}
332
+ ${bo()}
333
333
  <div
334
- id="${$i}"
334
+ id="${Wi}"
335
335
  style="
336
336
  display: flex !important;
337
337
  flex-direction: column !important;
@@ -342,6 +342,6 @@ var En=Object.create;var hr=Object.defineProperty;var Mn=Object.getOwnPropertyDe
342
342
  ${o??""}
343
343
  </div>
344
344
  </div>
345
- `;function Oe({id:o,href:a,rel:h,crossOrigin:v}){let s=`${he}-${o}`;if(!document.getElementById(s)){let A=document.createElement("link");A.id=s,A.href=a,h&&(A.rel=h),v&&(A.crossOrigin=v),document.head.appendChild(A);}}var Yi=()=>ji(Bo()),Ki=()=>ji(Po());var zt=class{disableGenericPopupOverlay;disableBlockedPopupOverlay;overlay;isBlockedOverlay;tryAgainListener;onCloseListener;constructor(a,h=!1){this.disableBlockedPopupOverlay=a.disableBlockedPopupOverlay||!1,this.disableGenericPopupOverlay=a.disableGenericPopupOverlay||!1,this.isBlockedOverlay=h;}append(a,h){this.shouldAppendOverlay()&&(this.appendOverlay(),this.updateTryAgainButton(a),this.updateCloseButton(h));}update(a){this.updateTryAgainButton(a);}remove(){this.overlay&&this.overlay.remove();}shouldAppendOverlay(){return !(this.disableGenericPopupOverlay&&this.disableBlockedPopupOverlay||this.disableGenericPopupOverlay&&!this.isBlockedOverlay||this.disableBlockedPopupOverlay&&this.isBlockedOverlay)}appendOverlay(){if(!this.overlay){Oe({id:"link-googleapis",href:"https://fonts.googleapis.com"}),Oe({id:"link-gstatic",href:"https://fonts.gstatic.com",crossOrigin:"anonymous"}),Oe({id:"link-roboto",href:"https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&display=swap",rel:"stylesheet"});let h=document.createElement("div");h.innerHTML=this.isBlockedOverlay?Yi():Ki(),document.body.insertAdjacentElement("beforeend",h),this.overlay=h;}}updateTryAgainButton(a){let h=document.getElementById(Ne);h&&(this.tryAgainListener&&h.removeEventListener("click",this.tryAgainListener),this.tryAgainListener=a,h.addEventListener("click",a));}updateCloseButton(a){let h=document.getElementById(Pe);h&&(this.onCloseListener&&h.removeEventListener("click",this.onCloseListener),this.onCloseListener=a,h.addEventListener("click",a));}};var Pr="Confirm this transaction",Nr=720,Or=480,Xi=1e3;var jt=class{config;confirmationWindow;popupOptions;overlay;overlayClosed;timer;constructor(a){this.config=a,this.overlayClosed=!1;}getHref(a,h){let v=`${this.config.passportDomain}/transaction-confirmation/${a}`;if(h){let s=h?Object.keys(h).map(A=>`${A}=${h[A]}`).join("&"):"";v=`${v}?${s}`;}return v}requestConfirmation(a,h,v,s){return new Promise((A,d)=>{let I=({data:O,origin:L})=>{if(!(L!==this.config.passportDomain||O.eventType!==le))switch(O.messageType){case"confirmation_window_ready":{this.confirmationWindow?.postMessage({eventType:le,messageType:"confirmation_start"},this.config.passportDomain);break}case"transaction_confirmed":{this.closeWindow(),A({confirmed:!0});break}case"transaction_rejected":{this.closeWindow(),A({confirmed:!1});break}case"transaction_error":{this.closeWindow(),d(new Error("Error during transaction confirmation"));break}default:this.closeWindow(),d(new Error("Unsupported message type"));}},x="";v===Ur.mr.TransactionApprovalRequestChainTypeEnum.Starkex?x=this.getHref("transaction",{transactionId:a,etherAddress:h,chainType:v}):x=this.getHref("zkevm/transaction",{transactionID:a,etherAddress:h,chainType:v,chainID:s}),window.addEventListener("message",I),this.showConfirmationScreen(x,I,A);})}requestMessageConfirmation(a,h,v){return new Promise((s,A)=>{let d=({data:x,origin:O})=>{if(!(O!==this.config.passportDomain||x.eventType!==le))switch(x.messageType){case"confirmation_window_ready":{this.confirmationWindow?.postMessage({eventType:le,messageType:"confirmation_start"},this.config.passportDomain);break}case"message_confirmed":{this.closeWindow(),s({confirmed:!0});break}case"message_rejected":{this.closeWindow(),s({confirmed:!1});break}case"message_error":{this.closeWindow(),A(new Error("Error during message confirmation"));break}default:this.closeWindow(),A(new Error("Unsupported message type"));}};window.addEventListener("message",d);let I=this.getHref("zkevm/message",{messageID:a,etherAddress:h,...v?{messageType:v}:{}});this.showConfirmationScreen(I,d,s);})}showServiceUnavailable(){return new Promise((a,h)=>{this.showConfirmationScreen(this.getHref("unavailable"),()=>{},()=>{this.closeWindow(),h(new Error("Service unavailable"));});})}loading(a){if(!this.config.crossSdkBridgeEnabled){this.popupOptions=a;try{this.confirmationWindow=Be({url:this.getHref("loading"),title:Pr,width:a?.width||Or,height:a?.height||Nr}),this.overlay=new zt(this.config.popupOverlayOptions||{});}catch(h){let v=h instanceof Error?h.message:String(h);trackError("passport","confirmationPopupDenied",new Error(v)),this.overlay=new zt(this.config.popupOverlayOptions||{},!0);}this.overlay.append(()=>{try{this.confirmationWindow?.close(),this.confirmationWindow=Be({url:this.getHref("loading"),title:Pr,width:this.popupOptions?.width||Or,height:this.popupOptions?.height||Nr});}catch{}},()=>{this.overlayClosed=!0,this.closeWindow();});}}closeWindow(){this.confirmationWindow?.close(),this.overlay?.remove(),this.overlay=void 0;}showConfirmationScreen(a,h,v){if(this.confirmationWindow&&(this.confirmationWindow.location.href=a),!this.overlay){this.overlayClosed=!1,v({confirmed:!1});return}let s=()=>{(this.confirmationWindow?.closed||this.overlayClosed)&&(clearInterval(this.timer),window.removeEventListener("message",h),v({confirmed:!1}),this.overlayClosed=!1,this.confirmationWindow=void 0);};this.timer=setInterval(s,Xi),this.overlay.update(()=>this.recreateConfirmationWindow(a,s));}recreateConfirmationWindow(a,h){try{clearInterval(this.timer),this.confirmationWindow?.close(),this.confirmationWindow=Be({url:a,title:Pr,width:this.popupOptions?.width||Or,height:this.popupOptions?.height||Nr}),this.timer=setInterval(h,Xi);}catch{}}};_();R();var Oo=o=>new Promise(a=>{setTimeout(()=>a(),o);}),Yt=async(o,a)=>{let{retries:h=3,interval:v=1e3,finalErr:s=Error("Retry failed"),finallyFn:A=()=>{}}=a||{};try{return await o()}catch{return h<=0?Promise.reject(s):(await Oo(v),Yt(o,{retries:h-1,finalErr:s,finallyFn:A}))}finally{h<=0&&A();}};_();R();var ue=(I=>(I.WALLET_CONNECTION_ERROR="WALLET_CONNECTION_ERROR",I.TRANSACTION_REJECTED="TRANSACTION_REJECTED",I.INVALID_CONFIGURATION="INVALID_CONFIGURATION",I.UNAUTHORIZED="UNAUTHORIZED",I.GUARDIAN_ERROR="GUARDIAN_ERROR",I.SERVICE_UNAVAILABLE_ERROR="SERVICE_UNAVAILABLE_ERROR",I.NOT_LOGGED_IN_ERROR="NOT_LOGGED_IN_ERROR",I))(ue||{}),ft=class extends Error{type;constructor(a,h){super(a),this.name="WalletError",this.type=h;}};var Ue="Transaction requires confirmation but this functionality is not supported in this environment. Please contact Immutable support if you need to enable this feature.",Le=o=>BigInt(o).toString(),Lo=o=>{try{return o.map(a=>({delegateCall:a.delegateCall===!0,revertOnError:a.revertOnError===!0,gasLimit:a.gasLimit?Le(a.gasLimit):"0",target:a.to??ZeroAddress,value:a.value?Le(a.value):"0",data:a.data?a.data.toString():"0x"}))}catch(a){let h=a instanceof Error?a.message:String(a);throw new H(-32602,`Transaction failed to parsing: ${h}`)}},Kt=class{guardianApi;confirmationScreen;crossSdkBridgeEnabled;authManager;constructor({config:a,authManager:h,guardianApi:v,authConfig:s}){this.confirmationScreen=new jt(s),this.crossSdkBridgeEnabled=a.crossSdkBridgeEnabled,this.guardianApi=v,this.authManager=h;}withConfirmationScreen(a){return h=>this.withConfirmationScreenTask(a)(h)()}withConfirmationScreenTask(a){return h=>async()=>{this.confirmationScreen.loading(a);try{return await h()}catch(v){throw v instanceof ft&&v.type==="SERVICE_UNAVAILABLE_ERROR"?(await this.confirmationScreen.showServiceUnavailable(),v):(this.confirmationScreen.closeWindow(),v)}}}withDefaultConfirmationScreenTask(a){return this.withConfirmationScreenTask()(a)}async evaluateImxTransaction({payloadHash:a}){try{let h=()=>{this.confirmationScreen.closeWindow();},v=await this.authManager.getUserImx(),s={Authorization:`Bearer ${v.accessToken}`};if(!(await Yt(async()=>this.guardianApi.getTransactionByID({transactionID:a,chainType:"starkex"},{headers:s}),{finallyFn:h})).data.id)throw new Error("Transaction doesn't exists");let d=await this.guardianApi.evaluateTransaction({id:a,transactionEvaluationRequest:{chainType:"starkex"}},{headers:s}),{confirmationRequired:I}=d.data;if(I){if(this.crossSdkBridgeEnabled)throw new Error(Ue);if(!(await this.confirmationScreen.requestConfirmation(a,v.imx.ethAddress,Ur.mr.TransactionApprovalRequestChainTypeEnum.Starkex)).confirmed)throw new Error("Transaction rejected by user")}else this.confirmationScreen.closeWindow();}catch(h){throw tn.isAxiosError(h)&&h.response?.status===403?new ft("Service unavailable","SERVICE_UNAVAILABLE_ERROR"):h}}async evaluateEVMTransaction({chainId:a,nonce:h,metaTransactions:v}){let s=await this.authManager.getUserZkEvm(),A={Authorization:`Bearer ${s.accessToken}`},d=Lo(v);try{return (await this.guardianApi.evaluateTransaction({id:"evm",transactionEvaluationRequest:{chainType:"evm",chainId:a,transactionData:{nonce:h,userAddress:s.zkEvm.ethAddress,metaTransactions:d}}},{headers:A})).data}catch(I){if(tn.isAxiosError(I)&&I.response?.status===403)throw new ft("Service unavailable","SERVICE_UNAVAILABLE_ERROR");let x=I instanceof Error?I.message:String(I);throw new H(-32603,`Transaction failed to validate with error: ${x}`)}}async validateEVMTransaction({chainId:a,nonce:h,metaTransactions:v,isBackgroundTransaction:s}){let A=await this.evaluateEVMTransaction({chainId:a,nonce:h,metaTransactions:v}),{confirmationRequired:d,transactionId:I}=A;if(d&&this.crossSdkBridgeEnabled)throw new H(-32003,Ue);if(d&&I){let x=await this.authManager.getUserZkEvm();if(!(await this.confirmationScreen.requestConfirmation(I,x.zkEvm.ethAddress,Ur.mr.TransactionApprovalRequestChainTypeEnum.Evm,a)).confirmed)throw new H(-32003,"Transaction rejected by user")}else s||this.confirmationScreen.closeWindow();}async handleEIP712MessageEvaluation({chainID:a,payload:h}){try{let v=await this.authManager.getUserZkEvm();if(v===null)throw new H(4100,"User not logged in. Please log in first.");return (await this.guardianApi.evaluateMessage({messageEvaluationRequest:{chainID:a,payload:h}},{headers:{Authorization:`Bearer ${v.accessToken}`}})).data}catch(v){let s=v instanceof Error?v.message:String(v);throw new H(-32603,`Message failed to validate with error: ${s}`)}}async evaluateEIP712Message({chainID:a,payload:h}){let{messageId:v,confirmationRequired:s}=await this.handleEIP712MessageEvaluation({chainID:a,payload:h});if(s&&this.crossSdkBridgeEnabled)throw new H(-32003,Ue);if(s&&v){let A=await this.authManager.getUserZkEvm();if(!(await this.confirmationScreen.requestMessageConfirmation(v,A.zkEvm.ethAddress,"eip712")).confirmed)throw new H(-32003,"Signature rejected by user")}else this.confirmationScreen.closeWindow();}async handleERC191MessageEvaluation({chainID:a,payload:h}){try{let v=await this.authManager.getUserZkEvm();if(v===null)throw new H(4100,"User not logged in. Please log in first.");return (await this.guardianApi.evaluateErc191Message({eRC191MessageEvaluationRequest:{chainID:Ot(Number(a)),payload:h}},{headers:{Authorization:`Bearer ${v.accessToken}`}})).data}catch(v){let s=v instanceof Error?v.message:String(v);throw new H(-32603,`Message failed to validate with error: ${s}`)}}async evaluateERC191Message({chainID:a,payload:h}){let{messageId:v,confirmationRequired:s}=await this.handleERC191MessageEvaluation({chainID:a,payload:h});if(s&&this.crossSdkBridgeEnabled)throw new H(-32003,Ue);if(s&&v){let A=await this.authManager.getUserZkEvm();if(!(await this.confirmationScreen.requestMessageConfirmation(v,A.zkEvm.ethAddress,"erc191")).confirmed)throw new H(-32003,"Signature rejected by user")}else this.confirmationScreen.closeWindow();}};var ko=30,Do=1e3,Fo=async(o,a,h)=>{let v=Ee([o]),s=dr(v),A=await h.imGetFeeOptions(a,s);if(!A||!Array.isArray(A))throw new Error("Invalid fee options received from relayer");let d=A.find(I=>I.tokenSymbol==="IMX");if(!d)throw new Error("Failed to retrieve fees for IMX token");return d},Ho=async(o,a,h,v,s)=>{if(!o.to)throw new H(-32602,'eth_sendTransaction requires a "to" field');let A={to:o.to.toString(),data:o.data,nonce:BigInt(0),value:o.value,revertOnError:!0},[d,I]=await Promise.all([ie(a,v,s),Fo(A,v,h)]),x=[{...A,nonce:d}],O=BigInt(I.tokenPrice);return O!==BigInt(0)&&x.push({nonce:d,to:I.recipientAddress,value:O,revertOnError:!0}),x},ke=async(o,a,h)=>{let s=await Yt(async()=>{let A=await o.imGetTransactionByHash(a);if(A.status==="PENDING")throw new Error;return A},{retries:ko,interval:Do,finalErr:new H(-32e3,"transaction hash not generated in time")});if(h.addEvent("endRetrieveRelayerTransaction"),!["SUBMITTED","SUCCESSFUL"].includes(s.status)){let A=`Transaction failed to submit with status ${s.status}.`;throw s.statusMessage&&(A+=` Error message: ${s.statusMessage}`),new H(-32e3,A)}return s},De=async({transactionRequest:o,ethSigner:a,rpcProvider:h,guardianClient:v,relayerClient:s,zkEvmAddress:A,flow:d,nonceSpace:I,isBackgroundTransaction:x})=>{let{chainId:O}=await h.getNetwork(),L=BigInt(O);d.addEvent("endDetectNetwork");let Z=await Ho(o,h,s,A,I);d.addEvent("endBuildMetaTransactions");let{nonce:z}=Z[0];if(typeof z>"u")throw new Error("Failed to retrieve nonce from the smart wallet");let P=async()=>{await v.validateEVMTransaction({chainId:Ot(Number(O)),nonce:Le(z),metaTransactions:Z,isBackgroundTransaction:x}),d.addEvent("endValidateEVMTransaction");},F=async()=>{let ct=await Ae(Z,z,L,A,a);return d.addEvent("endGetSignedMetaTransactions"),ct},[,$]=await Promise.all([P(),F()]),q=await s.ethSendTransaction(A,$);return d.addEvent("endRelayerSendTransaction"),{signedTransactions:$,relayerId:q,nonce:z}},Vo=async o=>{if(!o.to)throw new H(-32602,'im_signEjectionTransaction requires a "to" field');if(typeof o.nonce>"u")throw new H(-32602,'im_signEjectionTransaction requires a "nonce" field');if(!o.chainId)throw new H(-32602,'im_signEjectionTransaction requires a "chainId" field');return [{to:o.to.toString(),data:o.data,nonce:o.nonce??void 0,value:o.value,revertOnError:!0}]},en=async({transactionRequest:o,ethSigner:a,zkEvmAddress:h,flow:v})=>{let s=await Vo(o);v.addEvent("endBuildMetaTransactions");let A=await Ae(s,o.nonce,BigInt(o.chainId??0),h,a);return v.addEvent("endGetSignedMetaTransactions"),{to:h,data:A,chainId:Ot(Number(o.chainId??0))}};var Lr=async({params:o,ethSigner:a,rpcProvider:h,relayerClient:v,guardianClient:s,zkEvmAddress:A,flow:d,nonceSpace:I,isBackgroundTransaction:x=!1})=>{let O=o[0],{relayerId:L}=await De({transactionRequest:O,ethSigner:a,rpcProvider:h,guardianClient:s,relayerClient:v,zkEvmAddress:A,flow:d,nonceSpace:I,isBackgroundTransaction:x}),{hash:Z}=await ke(v,L,d);return Z};_();R();var rn=["types","domain","primaryType","message"],Go=o=>rn.every(a=>a in o),Wo=(o,a)=>{let h;if(typeof o=="string")try{h=JSON.parse(o);}catch(s){throw new H(-32602,`Failed to parse typed data JSON: ${s}`)}else if(typeof o=="object")h=o;else throw new H(-32602,`Invalid typed data argument: ${o}`);if(!Go(h))throw new H(-32602,`Invalid typed data argument. The following properties are required: ${rn.join(", ")}`);let v=h.domain?.chainId;if(v&&(typeof v=="string"&&(v.startsWith("0x")?h.domain.chainId=parseInt(v,16).toString():h.domain.chainId=parseInt(v,10).toString()),BigInt(h.domain.chainId??0)!==a))throw new H(-32602,`Invalid chainId, expected ${a}`);return h},nn=async({params:o,method:a,ethSigner:h,rpcProvider:v,relayerClient:s,guardianClient:A,flow:d})=>{let I=o[0],x=o[1];if(!I||!x)throw new H(-32602,`${a} requires an address and a typed data JSON`);let{chainId:O}=await v.getNetwork(),L=Wo(x,O);d.addEvent("endDetectNetwork"),await A.evaluateEIP712Message({chainID:String(O),payload:L}),d.addEvent("endValidateMessage");let Z=await s.imSignTypedData(I,L);d.addEvent("endRelayerSignTypedData");let z=await mr(L,Z,BigInt(O),I,h);return d.addEvent("getSignedTypedData"),z};_();R();_();R();var on=o=>{if(!o)return o;try{let a=stripZerosLeft(getBytes(o));return toUtf8String(a)}catch{return o}};var Fe=async({params:o,ethSigner:a,zkEvmAddress:h,rpcProvider:v,guardianClient:s,relayerClient:A,flow:d})=>{let I=o[0],x=o[1];if(!x||!I)throw new H(-32602,"personal_sign requires an address and a message");if(x.toLowerCase()!==h.toLowerCase())throw new H(-32602,"personal_sign requires the signer to be the from address");let O=on(I),{chainId:L}=await v.getNetwork();d.addEvent("endDetectNetwork");let Z=BigInt(L),z=gr(Z,O,a,x);z.then(()=>d.addEvent("endEOASignature")),await s.evaluateERC191Message({chainID:L,payload:O}),d.addEvent("endEvaluateERC191Message");let[P,F]=await Promise.all([z,A.imSign(x,O)]);d.addEvent("endRelayerSign");let $=await a.getAddress();return d.addEvent("endGetEOAAddress"),Te(P,$,F)};_();R();_();R();var zo="/v1/sdk/session-activity/check",He,an=o=>{He||(He=tn.create({baseURL:o}));};async function sn(o){if(!He)throw new Error("Client not initialised");return He.get(zo,{params:o}).then(a=>a.data).catch(a=>{if(a.response.status!==404)throw a})}_();R();function hn(o,a){return (...h)=>{try{let v=o(...h);return v instanceof Promise?v.catch(s=>(s instanceof Error&&trackError("passport","sessionActivityError",s),a)):v}catch(v){return v instanceof Error&&trackError("passport","sessionActivityError",v),a}}}var{getItem:un,setItem:kr}=utils.localStorage,Dr="sessionActivitySendCount",fn="sessionActivityDate",Fr={},Vt={},Ve={},cn=()=>{Vt=un(Dr)||{};let o=un(fn),a=new Date,h=a.getFullYear(),v=`${a.getMonth()+1}`.padStart(2,"0"),s=`${a.getDate()}`.padStart(2,"0"),A=`${h}-${v}-${s}`;(!o||o!==A)&&(Vt={}),kr(fn,A),kr(Dr,Vt);};cn();var Qo=o=>{cn(),Vt[o]||(Vt[o]=0),Vt[o]++,kr(Dr,Vt),Fr[o]=0;},ta=async o=>new Promise(a=>{setTimeout(a,o*1e3);}),ea=async o=>{let a=o.flow||trackFlow("passport","sendSessionActivity"),h=o.passportClient;if(!h)throw a.addEvent("No Passport Client ID"),new Error("No Passport Client ID provided");if(Ve[h])return;Ve[h]=!0;let{sendTransaction:v,sessionActivityApiUrl:s}=o;if(!v)throw new Error("No sendTransaction function provided");if(!s)throw new Error("No session activity API URL provided");an(s);let A=o.walletAddress;if(!A)throw a.addEvent("No Passport Wallet Address"),new Error("No wallet address");let d;try{if(d=await sn({clientId:h,wallet:A,checkCount:Fr[h]||0,sendCount:Vt[h]||0}),Fr[h]++,!d)return}catch(I){throw a.addEvent("Failed to fetch details"),new Error("Failed to get details",{cause:I})}if(d&&d.contractAddress&&d.functionName){let x=new Interface([`function ${d.functionName}()`]).encodeFunctionData(d.functionName),O=d.contractAddress;try{a.addEvent("Start Sending Transaction");let L=await o.sendTransaction([{to:O,from:A,data:x}],a);Qo(h),a.addEvent("Transaction Sent",{tx:L});}catch(L){a.addEvent("Failed to send Transaction");let Z=new Error("Failed to send transaction",{cause:L});trackError("passport","sessionActivityError",Z,{flowId:a.details.flowId});}}d&&d.delay&&d.delay>0&&(a.addEvent("Delaying Transaction",{delay:d.delay}),await ta(d.delay),setTimeout(()=>{a.addEvent("Retrying after Delay"),Ve[h]=!1,pn({...o,flow:a});},0));},pn=o=>hn(ea)(o).then(()=>{Ve[o.passportClient]=!1;}),dn=pn;_();R();var mn=async({params:o,ethSigner:a,rpcProvider:h,relayerClient:v,guardianClient:s,zkEvmAddress:A,flow:d})=>{let I={to:A,value:0},{relayerId:x}=await De({transactionRequest:I,ethSigner:a,rpcProvider:h,guardianClient:s,relayerClient:v,zkEvmAddress:A,flow:d});return s.withConfirmationScreen()(async()=>{let O=await Fe({params:o,ethSigner:a,zkEvmAddress:A,rpcProvider:h,guardianClient:s,relayerClient:v,flow:d});return await ke(v,x,d),O})};_();R();var gn=async({params:o,ethSigner:a,zkEvmAddress:h,flow:v})=>{if(!o||o.length!==1)throw new H(-32602,"im_signEjectionTransaction requires a singular param (hash)");let s=o[0];return await en({transactionRequest:s,ethSigner:a,zkEvmAddress:h,flow:v})};var Ge=o=>"zkEvm"in o,pe=class{#o;#s;#h;#a;#u;#e;#t;#f;#n;#r;isPassport=!0;constructor({authManager:a,config:h,multiRollupApiClients:v,passportEventEmitter:s,guardianClient:A,ethSigner:d,user:I,sessionActivityApiUrl:x}){this.#o=a,this.#s=h,this.#e=A,this.#u=s,this.#h=x,this.#r=d,this.#t=new JsonRpcProvider(this.#s.zkEvmRpcUrl,void 0,{staticNetwork:!0}),this.#n=new ne({config:this.#s,rpcProvider:this.#t,authManager:this.#o}),this.#f=v,this.#a=new TypedEventEmitter,I&&Ge(I)&&this.#l(I.zkEvm.ethAddress),s.on(AuthEvents.LOGGED_IN,O=>{Ge(O)&&this.#l(O.zkEvm.ethAddress);}),s.on(AuthEvents.LOGGED_OUT,this.#c),s.on("accountsRequested",dn);}#c=()=>{this.#a.emit("accountsChanged",[]);};async#l(a,h){if(!this.#h)return;let v=BigInt(1),s=async(A,d)=>await Lr({params:A,ethSigner:this.#r,guardianClient:this.#e,rpcProvider:this.#t,relayerClient:this.#n,zkEvmAddress:a,flow:d,nonceSpace:v,isBackgroundTransaction:!0});this.#u.emit("accountsRequested",{sessionActivityApiUrl:this.#h,sendTransaction:s,walletAddress:a,passportClient:h||"wallet"});}async#i(){try{let a=await this.#o.getUser();return a&&Ge(a)?a.zkEvm.ethAddress:void 0}catch{return}}async#p(a){switch(a.method){case"eth_requestAccounts":{let h=await this.#i();if(h)return [h];let v=trackFlow("passport","ethRequestAccounts");try{let s=await this.#o.getUserOrLogin();v.addEvent("endGetUserOrLogin");let A;return Ge(s)?A=s.zkEvm.ethAddress:(v.addEvent("startUserRegistration"),A=await Zi({ethSigner:this.#r,authManager:this.#o,multiRollupApiClients:this.#f,accessToken:s.accessToken,rpcProvider:this.#t,flow:v}),v.addEvent("endUserRegistration")),this.#a.emit("accountsChanged",[A]),identify({passportId:s.profile.sub}),this.#l(A),[A]}catch(s){throw s instanceof Error?trackError("passport","ethRequestAccounts",s,{flowId:v.details.flowId}):v.addEvent("errored"),s}finally{v.addEvent("End");}}case"eth_sendTransaction":{let h=await this.#i();if(!h)throw new H(4100,"Unauthorised - call eth_requestAccounts first");let v=trackFlow("passport","ethSendTransaction");try{return await this.#e.withConfirmationScreen({width:480,height:720})(async()=>await Lr({params:a.params||[],ethSigner:this.#r,guardianClient:this.#e,rpcProvider:this.#t,relayerClient:this.#n,zkEvmAddress:h,flow:v}))}catch(s){throw s instanceof Error?trackError("passport","eth_sendTransaction",s,{flowId:v.details.flowId}):v.addEvent("errored"),s}finally{v.addEvent("End");}}case"eth_accounts":{let h=await this.#i();return h?[h]:[]}case"personal_sign":{let h=await this.#i();if(!h)throw new H(4100,"Unauthorised - call eth_requestAccounts first");let v=trackFlow("passport","personalSign");try{return await this.#e.withConfirmationScreen({width:480,height:720})(async()=>this.#s.forceScwDeployBeforeMessageSignature&&!(await ie(this.#t,h)>BigInt(0))?await mn({params:a.params||[],zkEvmAddress:h,ethSigner:this.#r,rpcProvider:this.#t,guardianClient:this.#e,relayerClient:this.#n,flow:v}):await Fe({params:a.params||[],zkEvmAddress:h,ethSigner:this.#r,rpcProvider:this.#t,guardianClient:this.#e,relayerClient:this.#n,flow:v}))}catch(s){throw s instanceof Error?trackError("passport","personal_sign",s,{flowId:v.details.flowId}):v.addEvent("errored"),s}finally{v.addEvent("End");}}case"eth_signTypedData":case"eth_signTypedData_v4":{if(!await this.#i())throw new H(4100,"Unauthorised - call eth_requestAccounts first");let v=trackFlow("passport","ethSignTypedDataV4");try{return await this.#e.withConfirmationScreen({width:480,height:720})(async()=>await nn({method:a.method,params:a.params||[],ethSigner:this.#r,rpcProvider:this.#t,relayerClient:this.#n,guardianClient:this.#e,flow:v}))}catch(s){throw s instanceof Error?trackError("passport","eth_signTypedData",s,{flowId:v.details.flowId}):v.addEvent("errored"),s}finally{v.addEvent("End");}}case"eth_chainId":{let{chainId:h}=await this.#t.getNetwork();return toBeHex(h)}case"eth_getBalance":case"eth_getCode":case"eth_getTransactionCount":{let[h,v]=a.params||[];return this.#t.send(a.method,[h,v||"latest"])}case"eth_getStorageAt":{let[h,v,s]=a.params||[];return this.#t.send(a.method,[h,v,s||"latest"])}case"eth_call":case"eth_estimateGas":{let[h,v]=a.params||[];return this.#t.send(a.method,[h,v||"latest"])}case"eth_gasPrice":case"eth_blockNumber":case"eth_getBlockByHash":case"eth_getBlockByNumber":case"eth_getTransactionByHash":case"eth_getTransactionReceipt":return this.#t.send(a.method,a.params||[]);case"im_signEjectionTransaction":{let h=await this.#i();if(!h)throw new H(4100,"Unauthorised - call eth_requestAccounts first");let v=trackFlow("passport","imSignEjectionTransaction");try{return await gn({params:a.params||[],ethSigner:this.#r,zkEvmAddress:h,flow:v})}catch(s){throw s instanceof Error?trackError("passport","imSignEjectionTransaction",s,{flowId:v.details.flowId}):v.addEvent("errored"),s}finally{v.addEvent("End");}}case"im_addSessionActivity":{let[h]=a.params||[],v=await this.#i();return v&&this.#l(v,h),null}default:throw new H(4200,"Method not supported")}}async request(a){try{return this.#p(a)}catch(h){throw h instanceof H?h:h instanceof Error?new H(-32603,h.message):new H(-32603,"Internal error")}}on(a,h){this.#a.on(a,h);}removeListener(a,h){this.#a.removeListener(a,h);}};_();R();var de=class{passportDomain;zkEvmRpcUrl;relayerUrl;indexerMrBasePath;jsonRpcReferrer;forceScwDeployBeforeMessageSignature;crossSdkBridgeEnabled;constructor(a){this.passportDomain=a.passportDomain,this.zkEvmRpcUrl=a.zkEvmRpcUrl,this.relayerUrl=a.relayerUrl,this.indexerMrBasePath=a.indexerMrBasePath,this.jsonRpcReferrer=a.jsonRpcReferrer,this.forceScwDeployBeforeMessageSignature=a.forceScwDeployBeforeMessageSignature||!1,this.crossSdkBridgeEnabled=a.crossSdkBridgeEnabled||!1;}};_();R();_();R();var Hr=async(o,a,h=!0,v=!0)=>{let s=trackFlow("passport",a,h);try{return await o(s)}catch(A){throw A instanceof Error?trackError("passport",a,A,{flowId:s.details.flowId}):s.addEvent("errored"),A}finally{v&&s.addEvent("End");}};var wn="ETH",Xt=class o extends AbstractSigner{authManager;magicTeeApiClient;userWallet=null;createWalletPromise=null;constructor(a,h){super(),this.authManager=a,this.magicTeeApiClient=h;}async getUserWallet(){let{userWallet:a}=this;a||(a=await this.createWallet());let h=await this.getUserOrThrow();if(h.profile.sub!==a.userIdentifier&&(a=await this.createWallet(h)),isUserImx(h)&&h.imx.userAdminAddress.toLowerCase()!==a.walletAddress.toLowerCase())throw new ft(`Wallet address mismatch.Rollup: IMX, TEE address: ${a.walletAddress}, profile address: ${h.imx.userAdminAddress}`,"WALLET_CONNECTION_ERROR");if(isUserZkEvm(h)&&h.zkEvm.userAdminAddress.toLowerCase()!==a.walletAddress.toLowerCase())throw new ft(`Wallet address mismatch.Rollup: zkEVM, TEE address: ${a.walletAddress}, profile address: ${h.zkEvm.userAdminAddress}`,"WALLET_CONNECTION_ERROR");return a}async createWallet(a){return this.createWalletPromise?this.createWalletPromise:(this.createWalletPromise=new Promise(async(h,v)=>{try{this.userWallet=null;let s=a||await this.getUserOrThrow(),A=o.getHeaders(s);await Hr(async d=>{try{let I=performance.now(),x=await this.magicTeeApiClient.walletApi.createWalletV1WalletPost({xMagicChain:wn},{headers:A});return trackDuration("passport",d.details.flowName,Math.round(performance.now()-I)),this.userWallet={userIdentifier:s.profile.sub,walletAddress:x.data.public_address},h(this.userWallet)}catch(I){let x="MagicTEE: Failed to initialise EOA";return isAxiosError(I)?I.response?x+=` with status ${I.response.status}: ${JSON.stringify(I.response.data)}`:x+=`: ${I.message}`:x+=`: ${I.message}`,v(new Error(x))}},"magicCreateWallet");}catch(s){v(s);}finally{this.createWalletPromise=null;}}),this.createWalletPromise)}async getUserOrThrow(){let a=await this.authManager.getUser();if(!a)throw new ft("User has been logged out","NOT_LOGGED_IN_ERROR");return a}static getHeaders(a){if(!a)throw new ft("User has been logged out","NOT_LOGGED_IN_ERROR");return {Authorization:`Bearer ${a.idToken}`}}async getAddress(){return (await this.getUserWallet()).walletAddress}async signMessage(a){await this.getUserWallet();let h=a instanceof Uint8Array?`0x${k.from(a).toString("hex")}`:a,v=await this.getUserOrThrow(),s=await o.getHeaders(v);return Hr(async A=>{try{let d=performance.now(),I=await this.magicTeeApiClient.signOperationsApi.signMessageV1WalletSignMessagePost({signMessageRequest:{message_base64:k.from(h,"utf-8").toString("base64")},xMagicChain:wn},{headers:s});return trackDuration("passport",A.details.flowName,Math.round(performance.now()-d)),I.data.signature}catch(d){let I="MagicTEE: Failed to sign message using EOA";throw isAxiosError(d)?d.response?I+=` with status ${d.response.status}: ${JSON.stringify(d.response.data)}`:I+=`: ${d.message}`:I+=`: ${d.message}`,new Error(I)}},"magicSignMessage")}connect(){throw new Error("Method not implemented.")}signTransaction(){throw new Error("Method not implemented.")}signTypedData(){throw new Error("Method not implemented.")}};_();R();var Vr={icon:'data:image/svg+xml,<svg viewBox="0 0 48 48" class="SvgIcon undefined Logo Logo--PassportSymbolOutlined css-1dn9atd" xmlns="http://www.w3.org/2000/svg"><g data-testid="undefined__g"><circle cx="24" cy="24" r="22.5" fill="url(%23paint0_radial_6324_83922)"></circle><circle cx="24" cy="24" r="22.5" fill="url(%23paint1_radial_6324_83922)"></circle><path d="M24 0C10.7452 0 0 10.7452 0 24C0 37.2548 10.7452 48 24 48C37.2548 48 48 37.2548 48 24C48 10.7452 37.2548 0 24 0ZM23.0718 9.16608C23.7383 8.83951 24.4406 8.86188 25.087 9.2287C27.3282 10.5059 29.5627 11.7942 31.786 13.096C32.5018 13.5165 32.8686 14.1897 32.8708 15.0173C32.8843 17.9184 32.8798 20.8171 32.8708 23.7182C32.8708 23.8255 32.8015 23.9821 32.7143 24.0335C31.8531 24.548 30.9808 25.0423 30.0347 25.5881V25.1318C30.0347 22.148 30.0257 19.1664 30.0414 16.1827C30.0436 15.6101 29.8468 15.241 29.339 14.9525C26.7377 13.474 24.1499 11.9687 21.5575 10.4723C21.4457 10.4075 21.3361 10.3381 21.1661 10.2352C21.8326 9.85722 22.4321 9.47698 23.0673 9.16608H23.0718ZM22.5953 38.8451C22.45 38.7713 22.3426 38.7198 22.2375 38.6595C18.8041 36.68 15.3752 34.687 11.9307 32.7232C10.9644 32.173 10.5238 31.3879 10.5349 30.2852C10.5551 27.9411 10.5484 25.597 10.5372 23.2507C10.5327 22.1927 10.9622 21.4255 11.8926 20.8977C14.3105 19.5221 16.715 18.1264 19.1195 16.7284C19.3275 16.6076 19.4796 16.5875 19.6965 16.7172C20.5264 17.216 21.3719 17.6924 22.2554 18.2024C22.0876 18.3031 21.9601 18.3791 21.8304 18.4552C19.2268 19.9582 16.6278 21.4658 14.0175 22.9599C13.5903 23.2037 13.3912 23.5213 13.3957 24.0179C13.4091 25.8654 13.4114 27.713 13.3957 29.5605C13.3912 30.0705 13.5948 30.3948 14.0332 30.6453C16.7866 32.2199 19.5288 33.8125 22.28 35.3916C22.5126 35.5258 22.611 35.6645 22.6065 35.9418C22.5864 36.888 22.5998 37.8363 22.5998 38.8473L22.5953 38.8451ZM22.5953 33.553C22.356 33.4166 22.1838 33.3204 22.0116 33.2198C19.8285 31.9605 17.6477 30.6967 15.4602 29.4464C15.2231 29.3122 15.1359 29.1668 15.1381 28.8917C15.1538 27.4714 15.1471 26.0511 15.1426 24.6308C15.1426 24.4384 15.1717 24.3064 15.3618 24.1991C16.167 23.7495 16.9633 23.2798 17.7618 22.8212C17.8199 22.7877 17.8826 22.7631 17.9877 22.7116V24.3064C17.9877 25.1698 18.0011 26.0354 17.9832 26.8988C17.972 27.3909 18.1622 27.7241 18.5916 27.9657C19.8285 28.6636 21.0498 29.3883 22.2867 30.0839C22.5305 30.2203 22.6043 30.3724 22.5998 30.6408C22.5842 31.5847 22.5931 32.5308 22.5931 33.5508L22.5953 33.553ZM20.0746 14.91C19.6116 14.6371 19.2157 14.6393 18.7527 14.91C16.1581 16.4265 13.5523 17.9228 10.9487 19.4259C10.8391 19.4908 10.7251 19.5489 10.5305 19.6541C10.5998 18.6654 10.3873 17.7327 10.7251 16.8291C10.9085 16.3348 11.2529 15.9635 11.7092 15.6995C13.8811 14.4447 16.0507 13.1877 18.227 11.9396C19.0211 11.4833 19.8308 11.4945 20.6248 11.953C23.0964 13.3756 25.5657 14.8026 28.0306 16.2341C28.1357 16.2945 28.2677 16.4309 28.2677 16.5338C28.2856 17.5493 28.2788 18.567 28.2788 19.6563C27.3819 19.1396 26.5543 18.6609 25.7267 18.1823C23.8412 17.093 21.9512 16.0149 20.0746 14.91ZM37.4427 30.8779C37.3778 31.6764 36.9103 32.2423 36.2192 32.6404C33.5732 34.1614 30.9294 35.6913 28.2856 37.2168C27.4557 37.6954 26.6259 38.1741 25.7938 38.6527C25.6932 38.7109 25.5903 38.7601 25.4539 38.8317C25.4449 38.693 25.4337 38.5924 25.4337 38.4917C25.4337 37.6149 25.4382 36.7404 25.4293 35.8636C25.4293 35.6645 25.4762 35.5437 25.6596 35.4386C29.5157 33.2198 33.3696 30.9942 37.2212 28.7709C37.2794 28.7374 37.3443 28.7105 37.4539 28.6591C37.4539 29.4375 37.4986 30.1622 37.4427 30.8779ZM37.4628 25.3577C37.4561 26.2658 36.9663 26.9033 36.1901 27.3506C33.175 29.0841 30.1622 30.8265 27.1493 32.5666C26.5991 32.8842 26.0466 33.1996 25.4561 33.5396C25.4472 33.3897 25.436 33.2913 25.436 33.1907C25.436 32.3273 25.4449 31.4617 25.4293 30.5983C25.4248 30.3523 25.5075 30.2226 25.72 30.0995C28.46 28.5271 31.1911 26.9368 33.9355 25.3733C34.4231 25.096 34.6378 24.7538 34.6334 24.1812C34.6132 21.1974 34.6244 18.2136 34.6244 15.2298V14.7087C35.3402 15.1404 36.0112 15.496 36.624 15.9299C37.1832 16.3258 37.465 16.9253 37.4673 17.6164C37.4762 20.1976 37.4829 22.7788 37.465 25.3599L37.4628 25.3577Z" fill="%230D0D0D"></path><path fill-rule="evenodd" d="M24 0C10.7452 0 0 10.7452 0 24C0 37.2548 10.7452 48 24 48C37.2548 48 48 37.2548 48 24C48 10.7452 37.2548 0 24 0ZM24 2C11.8497 2 2 11.8497 2 24C2 36.1503 11.8497 46 24 46C36.1503 46 46 36.1503 46 24C46 11.8497 36.1503 2 24 2Z" fill="url(%23paint2_radial_6324_83922)"></path><path fill-rule="evenodd" d="M24 0C10.7452 0 0 10.7452 0 24C0 37.2548 10.7452 48 24 48C37.2548 48 48 37.2548 48 24C48 10.7452 37.2548 0 24 0ZM24 2C11.8497 2 2 11.8497 2 24C2 36.1503 11.8497 46 24 46C36.1503 46 46 36.1503 46 24C46 11.8497 36.1503 2 24 2Z" fill="url(%23paint3_radial_6324_83922)"></path><defs><radialGradient id="paint0_radial_6324_83922" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(13.4442 13.3899) rotate(44.9817) scale(46.7487 99.1435)"><stop stop-color="%23A3EEF8"></stop><stop offset="0.177083" stop-color="%23A4DCF5"></stop><stop offset="0.380208" stop-color="%23A6AEEC"></stop><stop offset="1" stop-color="%23ECBEE1"></stop></radialGradient><radialGradient id="paint1_radial_6324_83922" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(25.9515 43.7068) rotate(84.265) scale(24.2138 46.3215)"><stop stop-color="%23FCF5EE"></stop><stop offset="0.715135" stop-color="%23ECBEE1" stop-opacity="0"></stop></radialGradient><radialGradient id="paint2_radial_6324_83922" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(12.7405 12.6825) rotate(44.9817) scale(49.8653 105.753)"><stop stop-color="%23A3EEF8"></stop><stop offset="0.177083" stop-color="%23A4DCF5"></stop><stop offset="0.380208" stop-color="%23A6AEEC"></stop><stop offset="1" stop-color="%23ECBEE1"></stop></radialGradient><radialGradient id="paint3_radial_6324_83922" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(26.0816 45.0206) rotate(84.265) scale(25.828 49.4096)"><stop stop-color="%23FCF5EE"></stop><stop offset="0.715135" stop-color="%23ECBEE1" stop-opacity="0"></stop></radialGradient></defs></g></svg>',name:"Immutable Passport",rdns:"com.immutable.passport",uuid:v4()};function Gr(o){if(typeof window>"u")return;let a=new CustomEvent("eip6963:announceProvider",{detail:Object.freeze(o)});window.dispatchEvent(a);let h=()=>window.dispatchEvent(a);window.addEventListener("eip6963:requestProvider",h);}_();R();_();R();var Wr=13371,Zr=13473,$r={13371:{magicPublishableApiKey:"pk_live_D02F278E25B3E5F3",magicProviderId:"imtbl-immutable-zkEVM"},13473:{magicPublishableApiKey:"pk_live_620E2F8860D1D79E",magicProviderId:"imtbl-immutable-zkEVM-testnet"}};var qr={chainId:13371,name:"Immutable zkEVM",rpcUrl:"https://rpc.immutable.com",relayerUrl:"https://api.immutable.com/relayer-mr",apiUrl:"https://api.immutable.com",passportDomain:"https://passport.immutable.com",magicPublishableApiKey:"pk_live_D02F278E25B3E5F3",magicProviderId:"imtbl-immutable-zkEVM",magicTeeBasePath:"https://tee.express.magiclabs.com"},Jr={chainId:13473,name:"Immutable zkEVM Testnet",rpcUrl:"https://rpc.testnet.immutable.com",relayerUrl:"https://api.sandbox.immutable.com/relayer-mr",apiUrl:"https://api.sandbox.immutable.com",passportDomain:"https://passport.sandbox.immutable.com",magicPublishableApiKey:"pk_live_620E2F8860D1D79E",magicProviderId:"imtbl-immutable-zkEVM-testnet",magicTeeBasePath:"https://tee.express.magiclabs.com"},We=[Jr,qr],ua={chains:[qr]},fa={chains:[Jr]},ca={chains:We};function va(o){return o in $r}function wa(o){if(o.magicPublishableApiKey&&o.magicProviderId)return {magicPublishableApiKey:o.magicPublishableApiKey,magicProviderId:o.magicProviderId};let{chainId:a}=o;if(va(a))return $r[a];throw new Error(`No Magic configuration available for chain ${o.chainId}. Please provide magicPublishableApiKey and magicProviderId in ChainConfig.`)}async function Ea(o){let a=o.chains&&o.chains.length>0?o.chains:We,h=o.initialChainId||a[0].chainId,v=a.find(Bt=>Bt.chainId===h);if(!v)throw new Error(`Initial chain ${h} not found in chains configuration`);let s=createConfig({basePath:v.apiUrl}),A=new MultiRollupApiClients({indexer:s,orderBook:s,passport:s}),d=o.auth.getAuthManager(),I=o.auth.getConfig(),x=await o.auth.getUser(),O=new de({passportDomain:v.passportDomain||v.apiUrl.replace("api.","passport."),zkEvmRpcUrl:v.rpcUrl,relayerUrl:v.relayerUrl,indexerMrBasePath:v.apiUrl,jsonRpcReferrer:o.jsonRpcReferrer,forceScwDeployBeforeMessageSignature:o.forceScwDeployBeforeMessageSignature,crossSdkBridgeEnabled:o.crossSdkBridgeEnabled}),L=new mr$1.GuardianApi(s),Z=new Kt({config:O,authManager:d,guardianApi:L,authConfig:I}),z=wa(v),P=v.magicTeeBasePath||"https://tee.express.magiclabs.com",F=new MagicTeeApiClients({basePath:P,timeout:1e4,magicPublishableApiKey:z.magicPublishableApiKey,magicProviderId:z.magicProviderId}),$=new Xt(d,F),q=null;v.chainId===13371?q="https://api.immutable.com":v.chainId===13473?q="https://api.sandbox.immutable.com":v.apiUrl&&(q=v.apiUrl);let ct=o.passportEventEmitter||new TypedEventEmitter,et=new pe({authManager:d,config:O,multiRollupApiClients:A,passportEventEmitter:ct,guardianClient:Z,ethSigner:$,user:x,sessionActivityApiUrl:q});return o.announceProvider!==!1&&Gr({info:Vr,provider:et}),et}_();R();function Ra(o){return typeof o=="object"&&o!==null&&"code"in o&&"message"in o}async function _a(o,a){let h=await o.getUser();if(!h?.profile.sub)return [];let v={Authorization:`Bearer ${h.accessToken}`},{data:s}=await a.passportProfileApi.getUserInfo({headers:v});return s.linked_addresses}async function xa(o,a,h){let v=trackFlow("wallet","linkExternalWallet");try{let s=await o.getUser();if(!s)throw new ft("User is not logged in","NOT_LOGGED_IN_ERROR");let A=isUserImx(s),d=isUserZkEvm(s);if(!A&&!d)throw new ft("User has not been registered","WALLET_CONNECTION_ERROR");let I={Authorization:`Bearer ${s.accessToken}`},x={type:h.type,wallet_address:h.walletAddress,signature:h.signature,nonce:h.nonce};return {...(await a.passportProfileApi.linkWalletV2({linkWalletV2Request:x},{headers:I})).data}}catch(s){if(s instanceof Error?trackError("wallet","linkExternalWallet",s):v.addEvent("errored"),isAxiosError(s)&&s.response){if(s.response.data&&Ra(s.response.data)){let{code:d,message:I}=s.response.data;switch(d){case"ALREADY_LINKED":throw new ft(I,"WALLET_CONNECTION_ERROR");case"MAX_WALLETS_LINKED":throw new ft(I,"WALLET_CONNECTION_ERROR");case"DUPLICATE_NONCE":throw new ft(I,"WALLET_CONNECTION_ERROR");case"VALIDATION_ERROR":throw new ft(I,"WALLET_CONNECTION_ERROR");default:throw new ft(I,"WALLET_CONNECTION_ERROR")}}else if(s.response.status)throw new ft(`Link wallet request failed with status code ${s.response.status}`,"WALLET_CONNECTION_ERROR")}let A="Link wallet request failed";throw s instanceof Error&&(A+=`: ${s.message}`),new ft(A,"WALLET_CONNECTION_ERROR")}finally{v.addEvent("End");}}/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
345
+ `;function Ne({id:o,href:a,rel:u,crossOrigin:v}){let s=`${le}-${o}`;if(!document.getElementById(s)){let T=document.createElement("link");T.id=s,T.href=a,u&&(T.rel=u),v&&(T.crossOrigin=v),document.head.appendChild(T);}}var zi=()=>Ji(xo()),Yi=()=>Ji(So());var zt=class{disableGenericPopupOverlay;disableBlockedPopupOverlay;overlay;isBlockedOverlay;tryAgainListener;onCloseListener;constructor(a,u=!1){this.disableBlockedPopupOverlay=a.disableBlockedPopupOverlay||!1,this.disableGenericPopupOverlay=a.disableGenericPopupOverlay||!1,this.isBlockedOverlay=u;}append(a,u){this.shouldAppendOverlay()&&(this.appendOverlay(),this.updateTryAgainButton(a),this.updateCloseButton(u));}update(a){this.updateTryAgainButton(a);}remove(){this.overlay&&this.overlay.remove();}shouldAppendOverlay(){return !(this.disableGenericPopupOverlay&&this.disableBlockedPopupOverlay||this.disableGenericPopupOverlay&&!this.isBlockedOverlay||this.disableBlockedPopupOverlay&&this.isBlockedOverlay)}appendOverlay(){if(!this.overlay){Ne({id:"link-googleapis",href:"https://fonts.googleapis.com"}),Ne({id:"link-gstatic",href:"https://fonts.gstatic.com",crossOrigin:"anonymous"}),Ne({id:"link-roboto",href:"https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,400;0,500;0,700;1,400;1,500;1,700&display=swap",rel:"stylesheet"});let u=document.createElement("div");u.innerHTML=this.isBlockedOverlay?zi():Yi(),document.body.insertAdjacentElement("beforeend",u),this.overlay=u;}}updateTryAgainButton(a){let u=document.getElementById(Pe);u&&(this.tryAgainListener&&u.removeEventListener("click",this.tryAgainListener),this.tryAgainListener=a,u.addEventListener("click",a));}updateCloseButton(a){let u=document.getElementById(Be);u&&(this.onCloseListener&&u.removeEventListener("click",this.onCloseListener),this.onCloseListener=a,u.addEventListener("click",a));}};var Br="Confirm this transaction",Pr=720,Nr=480,ji=1e3;var Yt=class{config;confirmationWindow;popupOptions;overlay;overlayClosed;timer;constructor(a){this.config=a,this.overlayClosed=!1;}getHref(a,u){let v=`${this.config.passportDomain}/transaction-confirmation/${a}`;if(u){let s=u?Object.keys(u).map(T=>`${T}=${u[T]}`).join("&"):"";v=`${v}?${s}`;}return v}requestConfirmation(a,u,v,s){return new Promise((T,d)=>{let I=({data:U,origin:k})=>{if(!(k!==this.config.passportDomain||U.eventType!==se))switch(U.messageType){case"confirmation_window_ready":{this.confirmationWindow?.postMessage({eventType:se,messageType:"confirmation_start"},this.config.passportDomain);break}case"transaction_confirmed":{this.closeWindow(),T({confirmed:!0});break}case"transaction_rejected":{this.closeWindow(),T({confirmed:!1});break}case"transaction_error":{this.closeWindow(),d(new Error("Error during transaction confirmation"));break}default:this.closeWindow(),d(new Error("Unsupported message type"));}},b="";v===Ki.mr.TransactionApprovalRequestChainTypeEnum.Starkex?b=this.getHref("transaction",{transactionId:a,etherAddress:u,chainType:v}):b=this.getHref("zkevm/transaction",{transactionID:a,etherAddress:u,chainType:v,chainID:s}),window.addEventListener("message",I),this.showConfirmationScreen(b,I,T);})}requestMessageConfirmation(a,u,v){return new Promise((s,T)=>{let d=({data:b,origin:U})=>{if(!(U!==this.config.passportDomain||b.eventType!==se))switch(b.messageType){case"confirmation_window_ready":{this.confirmationWindow?.postMessage({eventType:se,messageType:"confirmation_start"},this.config.passportDomain);break}case"message_confirmed":{this.closeWindow(),s({confirmed:!0});break}case"message_rejected":{this.closeWindow(),s({confirmed:!1});break}case"message_error":{this.closeWindow(),T(new Error("Error during message confirmation"));break}default:this.closeWindow(),T(new Error("Unsupported message type"));}};window.addEventListener("message",d);let I=this.getHref("zkevm/message",{messageID:a,etherAddress:u,...v?{messageType:v}:{}});this.showConfirmationScreen(I,d,s);})}showServiceUnavailable(){return new Promise((a,u)=>{this.showConfirmationScreen(this.getHref("unavailable"),()=>{},()=>{this.closeWindow(),u(new Error("Service unavailable"));});})}loading(a){if(!this.config.crossSdkBridgeEnabled){this.popupOptions=a;try{this.confirmationWindow=Se({url:this.getHref("loading"),title:Br,width:a?.width||Nr,height:a?.height||Pr}),this.overlay=new zt(this.config.popupOverlayOptions||{});}catch(u){let v=u instanceof Error?u.message:String(u);trackError("passport","confirmationPopupDenied",new Error(v)),this.overlay=new zt(this.config.popupOverlayOptions||{},!0);}this.overlay.append(()=>{try{this.confirmationWindow?.close(),this.confirmationWindow=Se({url:this.getHref("loading"),title:Br,width:this.popupOptions?.width||Nr,height:this.popupOptions?.height||Pr});}catch{}},()=>{this.overlayClosed=!0,this.closeWindow();});}}closeWindow(){this.confirmationWindow?.close(),this.overlay?.remove(),this.overlay=void 0;}showConfirmationScreen(a,u,v){if(this.confirmationWindow&&(this.confirmationWindow.location.href=a),!this.overlay){this.overlayClosed=!1,v({confirmed:!1});return}let s=()=>{(this.confirmationWindow?.closed||this.overlayClosed)&&(clearInterval(this.timer),window.removeEventListener("message",u),v({confirmed:!1}),this.overlayClosed=!1,this.confirmationWindow=void 0);};this.timer=setInterval(s,ji),this.overlay.update(()=>this.recreateConfirmationWindow(a,s));}recreateConfirmationWindow(a,u){try{clearInterval(this.timer),this.confirmationWindow?.close(),this.confirmationWindow=Se({url:a,title:Br,width:this.popupOptions?.width||Nr,height:this.popupOptions?.height||Pr}),this.timer=setInterval(u,ji);}catch{}}};_();R();var he=(I=>(I.WALLET_CONNECTION_ERROR="WALLET_CONNECTION_ERROR",I.TRANSACTION_REJECTED="TRANSACTION_REJECTED",I.INVALID_CONFIGURATION="INVALID_CONFIGURATION",I.UNAUTHORIZED="UNAUTHORIZED",I.GUARDIAN_ERROR="GUARDIAN_ERROR",I.SERVICE_UNAVAILABLE_ERROR="SERVICE_UNAVAILABLE_ERROR",I.NOT_LOGGED_IN_ERROR="NOT_LOGGED_IN_ERROR",I))(he||{}),St=class extends Error{type;constructor(a,u){super(a),this.name="WalletError",this.type=u;}};var Or="Transaction requires confirmation but this functionality is not supported in this environment. Please contact Immutable support if you need to enable this feature.",Oe=o=>BigInt(o).toString(),Oo=o=>{try{return o.map(a=>({delegateCall:a.delegateCall===!0,revertOnError:a.revertOnError===!0,gasLimit:a.gasLimit?Oe(a.gasLimit):"0",target:a.to??ZeroAddress,value:a.value?Oe(a.value):"0",data:a.data?a.data.toString():"0x"}))}catch(a){let u=a instanceof Error?a.message:String(a);throw new H(-32602,`Transaction failed to parsing: ${u}`)}},jt=class{guardianApi;confirmationScreen;crossSdkBridgeEnabled;auth;constructor({config:a,auth:u,guardianApi:v,authConfig:s}){this.confirmationScreen=new Yt(s),this.crossSdkBridgeEnabled=a.crossSdkBridgeEnabled,this.guardianApi=v,this.auth=u;}withConfirmationScreen(a){return u=>this.withConfirmationScreenTask(a)(u)()}withConfirmationScreenTask(a){return u=>async()=>{this.confirmationScreen.loading(a);try{return await u()}catch(v){throw v instanceof St&&v.type==="SERVICE_UNAVAILABLE_ERROR"?(await this.confirmationScreen.showServiceUnavailable(),v):(this.confirmationScreen.closeWindow(),v)}}}withDefaultConfirmationScreenTask(a){return this.withConfirmationScreenTask()(a)}async evaluateEVMTransaction({chainId:a,nonce:u,metaTransactions:v}){let s=await this.auth.getUserZkEvm(),T={Authorization:`Bearer ${s.accessToken}`},d=Oo(v);try{return (await this.guardianApi.evaluateTransaction({id:"evm",transactionEvaluationRequest:{chainType:"evm",chainId:a,transactionData:{nonce:u,userAddress:s.zkEvm.ethAddress,metaTransactions:d}}},{headers:T})).data}catch(I){if(No.isAxiosError(I)&&I.response?.status===403)throw new St("Service unavailable","SERVICE_UNAVAILABLE_ERROR");let b=I instanceof Error?I.message:String(I);throw new H(-32603,`Transaction failed to validate with error: ${b}`)}}async validateEVMTransaction({chainId:a,nonce:u,metaTransactions:v,isBackgroundTransaction:s}){let T=await this.evaluateEVMTransaction({chainId:a,nonce:u,metaTransactions:v}),{confirmationRequired:d,transactionId:I}=T;if(d&&this.crossSdkBridgeEnabled)throw new H(-32003,Or);if(d&&I){let b=await this.auth.getUserZkEvm();if(!(await this.confirmationScreen.requestConfirmation(I,b.zkEvm.ethAddress,Ki.mr.TransactionApprovalRequestChainTypeEnum.Evm,a)).confirmed)throw new H(-32003,"Transaction rejected by user")}else s||this.confirmationScreen.closeWindow();}async handleEIP712MessageEvaluation({chainID:a,payload:u}){try{let v=await this.auth.getUserZkEvm();if(v===null)throw new H(4100,"User not logged in. Please log in first.");return (await this.guardianApi.evaluateMessage({messageEvaluationRequest:{chainID:a,payload:u}},{headers:{Authorization:`Bearer ${v.accessToken}`}})).data}catch(v){let s=v instanceof Error?v.message:String(v);throw new H(-32603,`Message failed to validate with error: ${s}`)}}async evaluateEIP712Message({chainID:a,payload:u}){let{messageId:v,confirmationRequired:s}=await this.handleEIP712MessageEvaluation({chainID:a,payload:u});if(s&&this.crossSdkBridgeEnabled)throw new H(-32003,Or);if(s&&v){let T=await this.auth.getUserZkEvm();if(!(await this.confirmationScreen.requestMessageConfirmation(v,T.zkEvm.ethAddress,"eip712")).confirmed)throw new H(-32003,"Signature rejected by user")}else this.confirmationScreen.closeWindow();}async handleERC191MessageEvaluation({chainID:a,payload:u}){try{let v=await this.auth.getUserZkEvm();if(v===null)throw new H(4100,"User not logged in. Please log in first.");return (await this.guardianApi.evaluateErc191Message({eRC191MessageEvaluationRequest:{chainID:Ot(Number(a)),payload:u}},{headers:{Authorization:`Bearer ${v.accessToken}`}})).data}catch(v){let s=v instanceof Error?v.message:String(v);throw new H(-32603,`Message failed to validate with error: ${s}`)}}async evaluateERC191Message({chainID:a,payload:u}){let{messageId:v,confirmationRequired:s}=await this.handleERC191MessageEvaluation({chainID:a,payload:u});if(s&&this.crossSdkBridgeEnabled)throw new H(-32003,Or);if(s&&v){let T=await this.auth.getUserZkEvm();if(!(await this.confirmationScreen.requestMessageConfirmation(v,T.zkEvm.ethAddress,"erc191")).confirmed)throw new H(-32003,"Signature rejected by user")}else this.confirmationScreen.closeWindow();}};_();R();var Uo=o=>new Promise(a=>{setTimeout(()=>a(),o);}),Ue=async(o,a)=>{let{retries:u=3,interval:v=1e3,finalErr:s=Error("Retry failed"),finallyFn:T=()=>{}}=a||{};try{return await o()}catch{return u<=0?Promise.reject(s):(await Uo(v),Ue(o,{retries:u-1,finalErr:s,finallyFn:T}))}finally{u<=0&&T();}};var ko=30,Lo=1e3,Do=async(o,a,u)=>{let v=we([o]),s=pr(v),T=await u.imGetFeeOptions(a,s);if(!T||!Array.isArray(T))throw new Error("Invalid fee options received from relayer");let d=u.getPreferredFeeTokenSymbol(),I=T.find(b=>b.tokenSymbol===d);if(!I)throw new Error(`Failed to retrieve fees for ${d} token`);return I},Fo=async(o,a,u,v,s)=>{if(!o.to)throw new H(-32602,'eth_sendTransaction requires a "to" field');let T={to:o.to.toString(),data:o.data,nonce:BigInt(0),value:o.value,revertOnError:!0},[d,I]=await Promise.all([re(a,v,s),Do(T,v,u)]),b=[{...T,nonce:d}],U=BigInt(I.tokenPrice);return U!==BigInt(0)&&b.push({nonce:d,to:I.recipientAddress,value:U,revertOnError:!0}),b},ke=async(o,a,u)=>{let s=await Ue(async()=>{let T=await o.imGetTransactionByHash(a);if(T.status==="PENDING")throw new Error;return T},{retries:ko,interval:Lo,finalErr:new H(-32e3,"transaction hash not generated in time")});if(u.addEvent("endRetrieveRelayerTransaction"),!["SUBMITTED","SUCCESSFUL"].includes(s.status)){let T=`Transaction failed to submit with status ${s.status}.`;throw s.statusMessage&&(T+=` Error message: ${s.statusMessage}`),new H(-32e3,T)}return s},Le=async({transactionRequest:o,ethSigner:a,rpcProvider:u,guardianClient:v,relayerClient:s,zkEvmAddress:T,flow:d,nonceSpace:I,isBackgroundTransaction:b})=>{let{chainId:U}=await u.getNetwork(),k=BigInt(U);d.addEvent("endDetectNetwork");let Z=await Fo(o,u,s,T,I);d.addEvent("endBuildMetaTransactions");let{nonce:z}=Z[0];if(typeof z>"u")throw new Error("Failed to retrieve nonce from the smart wallet");let P=async()=>{await v.validateEVMTransaction({chainId:Ot(Number(U)),nonce:Oe(z),metaTransactions:Z,isBackgroundTransaction:b}),d.addEvent("endValidateEVMTransaction");},F=async()=>{let at=await Me(Z,z,k,T,a);return d.addEvent("endGetSignedMetaTransactions"),at},[,$]=await Promise.all([P(),F()]),J=await s.ethSendTransaction(T,$);return d.addEvent("endRelayerSendTransaction"),{signedTransactions:$,relayerId:J,nonce:z}},Ho=async o=>{if(!o.to)throw new H(-32602,'im_signEjectionTransaction requires a "to" field');if(typeof o.nonce>"u")throw new H(-32602,'im_signEjectionTransaction requires a "nonce" field');if(!o.chainId)throw new H(-32602,'im_signEjectionTransaction requires a "chainId" field');return [{to:o.to.toString(),data:o.data,nonce:o.nonce??void 0,value:o.value,revertOnError:!0}]},Qi=async({transactionRequest:o,ethSigner:a,zkEvmAddress:u,flow:v})=>{let s=await Ho(o);v.addEvent("endBuildMetaTransactions");let T=await Me(s,o.nonce,BigInt(o.chainId??0),u,a);return v.addEvent("endGetSignedMetaTransactions"),{to:u,data:T,chainId:Ot(Number(o.chainId??0))}};var Ur=async({params:o,ethSigner:a,rpcProvider:u,relayerClient:v,guardianClient:s,zkEvmAddress:T,flow:d,nonceSpace:I,isBackgroundTransaction:b=!1})=>{let U=o[0],{relayerId:k}=await Le({transactionRequest:U,ethSigner:a,rpcProvider:u,guardianClient:s,relayerClient:v,zkEvmAddress:T,flow:d,nonceSpace:I,isBackgroundTransaction:b}),{hash:Z}=await ke(v,k,d);return Z};_();R();var tn=["types","domain","primaryType","message"],Vo=o=>tn.every(a=>a in o),Go=(o,a)=>{let u;if(typeof o=="string")try{u=JSON.parse(o);}catch(s){throw new H(-32602,`Failed to parse typed data JSON: ${s}`)}else if(typeof o=="object")u=o;else throw new H(-32602,`Invalid typed data argument: ${o}`);if(!Vo(u))throw new H(-32602,`Invalid typed data argument. The following properties are required: ${tn.join(", ")}`);let v=u.domain?.chainId;if(v&&(typeof v=="string"&&(v.startsWith("0x")?u.domain.chainId=parseInt(v,16).toString():u.domain.chainId=parseInt(v,10).toString()),BigInt(u.domain.chainId??0)!==a))throw new H(-32602,`Invalid chainId, expected ${a}`);return u},en=async({params:o,method:a,ethSigner:u,rpcProvider:v,relayerClient:s,guardianClient:T,flow:d})=>{let I=o[0],b=o[1];if(!I||!b)throw new H(-32602,`${a} requires an address and a typed data JSON`);let{chainId:U}=await v.getNetwork(),k=Go(b,U);d.addEvent("endDetectNetwork"),await T.evaluateEIP712Message({chainID:String(U),payload:k}),d.addEvent("endValidateMessage");let Z=await s.imSignTypedData(I,k);d.addEvent("endRelayerSignTypedData");let z=await dr(k,Z,BigInt(U),I,u);return d.addEvent("getSignedTypedData"),z};_();R();_();R();var rn=o=>{if(!o)return o;try{let a=stripZerosLeft(getBytes(o));return toUtf8String(a)}catch{return o}};var De=async({params:o,ethSigner:a,zkEvmAddress:u,rpcProvider:v,guardianClient:s,relayerClient:T,flow:d})=>{let I=o[0],b=o[1];if(!b||!I)throw new H(-32602,"personal_sign requires an address and a message");if(b.toLowerCase()!==u.toLowerCase())throw new H(-32602,"personal_sign requires the signer to be the from address");let U=rn(I),{chainId:k}=await v.getNetwork();d.addEvent("endDetectNetwork");let Z=BigInt(k),z=mr(Z,U,a,b);z.then(()=>d.addEvent("endEOASignature")),await s.evaluateERC191Message({chainID:k,payload:U}),d.addEvent("endEvaluateERC191Message");let[P,F]=await Promise.all([z,T.imSign(b,U)]);d.addEvent("endRelayerSign");let $=await a.getAddress();return d.addEvent("endGetEOAAddress"),Te(P,$,F)};_();R();_();R();var Jo="/v1/sdk/session-activity/check",Fe,nn=o=>{Fe||(Fe=No.create({baseURL:o}));};async function on(o){if(!Fe)throw new Error("Client not initialised");return Fe.get(Jo,{params:o}).then(a=>a.data).catch(a=>{if(a.response.status!==404)throw a})}_();R();function sn(o,a){return (...u)=>{try{let v=o(...u);return v instanceof Promise?v.catch(s=>(s instanceof Error&&trackError("passport","sessionActivityError",s),a)):v}catch(v){return v instanceof Error&&trackError("passport","sessionActivityError",v),a}}}var{getItem:ln,setItem:kr}=utils.localStorage,Lr="sessionActivitySendCount",hn="sessionActivityDate",Dr={},Vt={},He={},un=()=>{Vt=ln(Lr)||{};let o=ln(hn),a=new Date,u=a.getFullYear(),v=`${a.getMonth()+1}`.padStart(2,"0"),s=`${a.getDate()}`.padStart(2,"0"),T=`${u}-${v}-${s}`;(!o||o!==T)&&(Vt={}),kr(hn,T),kr(Lr,Vt);};un();var Xo=o=>{un(),Vt[o]||(Vt[o]=0),Vt[o]++,kr(Lr,Vt),Dr[o]=0;},Qo=async o=>new Promise(a=>{setTimeout(a,o*1e3);}),ta=async o=>{let a=o.flow||trackFlow("passport","sendSessionActivity"),u=o.passportClient;if(!u)throw a.addEvent("No Passport Client ID"),new Error("No Passport Client ID provided");if(He[u])return;He[u]=!0;let{sendTransaction:v,sessionActivityApiUrl:s}=o;if(!v)throw new Error("No sendTransaction function provided");if(!s)throw new Error("No session activity API URL provided");nn(s);let T=o.walletAddress;if(!T)throw a.addEvent("No Passport Wallet Address"),new Error("No wallet address");let d;try{if(d=await on({clientId:u,wallet:T,checkCount:Dr[u]||0,sendCount:Vt[u]||0}),Dr[u]++,!d)return}catch(I){throw a.addEvent("Failed to fetch details"),new Error("Failed to get details",{cause:I})}if(d&&d.contractAddress&&d.functionName){let b=new Interface([`function ${d.functionName}()`]).encodeFunctionData(d.functionName),U=d.contractAddress;try{a.addEvent("Start Sending Transaction");let k=await o.sendTransaction([{to:U,from:T,data:b}],a);Xo(u),a.addEvent("Transaction Sent",{tx:k});}catch(k){a.addEvent("Failed to send Transaction");let Z=new Error("Failed to send transaction",{cause:k});trackError("passport","sessionActivityError",Z,{flowId:a.details.flowId});}}d&&d.delay&&d.delay>0&&(a.addEvent("Delaying Transaction",{delay:d.delay}),await Qo(d.delay),setTimeout(()=>{a.addEvent("Retrying after Delay"),He[u]=!1,fn({...o,flow:a});},0));},fn=o=>sn(ta)(o).then(()=>{He[o.passportClient]=!1;}),cn=fn;_();R();var pn=async({params:o,ethSigner:a,rpcProvider:u,relayerClient:v,guardianClient:s,zkEvmAddress:T,flow:d})=>{let I={to:T,value:0},{relayerId:b}=await Le({transactionRequest:I,ethSigner:a,rpcProvider:u,guardianClient:s,relayerClient:v,zkEvmAddress:T,flow:d});return s.withConfirmationScreen()(async()=>{let U=await De({params:o,ethSigner:a,zkEvmAddress:T,rpcProvider:u,guardianClient:s,relayerClient:v,flow:d});return await ke(v,b,d),U})};_();R();var dn=async({params:o,ethSigner:a,zkEvmAddress:u,flow:v})=>{if(!o||o.length!==1)throw new H(-32602,"im_signEjectionTransaction requires a singular param (hash)");let s=o[0];return await Qi({transactionRequest:s,ethSigner:a,zkEvmAddress:u,flow:v})};var Ve=o=>"zkEvm"in o,ce=class{#n;#s;#h;#a;#u;#e;#t;#f;#o;#r;isPassport=!0;constructor({auth:a,config:u,multiRollupApiClients:v,passportEventEmitter:s,guardianClient:T,ethSigner:d,user:I,sessionActivityApiUrl:b}){this.#n=a,this.#s=u,this.#e=T,this.#u=s,this.#h=b,this.#r=d,this.#t=new JsonRpcProvider(this.#s.zkEvmRpcUrl,void 0,{staticNetwork:!0}),this.#o=new ie({config:this.#s,rpcProvider:this.#t,auth:this.#n}),this.#f=v,this.#a=new TypedEventEmitter,I&&Ve(I)&&this.#l(I.zkEvm.ethAddress),s.on(AuthEvents.LOGGED_IN,U=>{Ve(U)&&this.#l(U.zkEvm.ethAddress);}),s.on(AuthEvents.LOGGED_OUT,this.#c),s.on("accountsRequested",cn);}#c=()=>{this.#a.emit("accountsChanged",[]);};async#l(a,u){if(!this.#h)return;let v=BigInt(1),s=async(T,d)=>await Ur({params:T,ethSigner:this.#r,guardianClient:this.#e,rpcProvider:this.#t,relayerClient:this.#o,zkEvmAddress:a,flow:d,nonceSpace:v,isBackgroundTransaction:!0});this.#u.emit("accountsRequested",{sessionActivityApiUrl:this.#h,sendTransaction:s,walletAddress:a,passportClient:u||await this.#n.getClientId()});}async#i(){try{let a=await this.#n.getUser();return a&&Ve(a)?a.zkEvm.ethAddress:void 0}catch{return}}async#p(a){switch(a.method){case"eth_requestAccounts":{let u=await this.#i();if(u)return [u];let v=trackFlow("passport","ethRequestAccounts");try{let s=await this.#n.getUserOrLogin();v.addEvent("endGetUserOrLogin");let T;return Ve(s)?T=s.zkEvm.ethAddress:(v.addEvent("startUserRegistration"),T=await Gi({ethSigner:this.#r,auth:this.#n,multiRollupApiClients:this.#f,accessToken:s.accessToken,rpcProvider:this.#t,flow:v}),v.addEvent("endUserRegistration")),this.#a.emit("accountsChanged",[T]),identify({passportId:s.profile.sub}),this.#l(T),[T]}catch(s){throw s instanceof Error?trackError("passport","ethRequestAccounts",s,{flowId:v.details.flowId}):v.addEvent("errored"),s}finally{v.addEvent("End");}}case"eth_sendTransaction":{let u=await this.#i();if(!u)throw new H(4100,"Unauthorised - call eth_requestAccounts first");let v=trackFlow("passport","ethSendTransaction");try{return await this.#e.withConfirmationScreen({width:480,height:720})(async()=>await Ur({params:a.params||[],ethSigner:this.#r,guardianClient:this.#e,rpcProvider:this.#t,relayerClient:this.#o,zkEvmAddress:u,flow:v}))}catch(s){throw s instanceof Error?trackError("passport","eth_sendTransaction",s,{flowId:v.details.flowId}):v.addEvent("errored"),s}finally{v.addEvent("End");}}case"eth_accounts":{let u=await this.#i();return u?[u]:[]}case"personal_sign":{let u=await this.#i();if(!u)throw new H(4100,"Unauthorised - call eth_requestAccounts first");let v=trackFlow("passport","personalSign");try{return await this.#e.withConfirmationScreen({width:480,height:720})(async()=>this.#s.forceScwDeployBeforeMessageSignature&&!(await re(this.#t,u)>BigInt(0))?await pn({params:a.params||[],zkEvmAddress:u,ethSigner:this.#r,rpcProvider:this.#t,guardianClient:this.#e,relayerClient:this.#o,flow:v}):await De({params:a.params||[],zkEvmAddress:u,ethSigner:this.#r,rpcProvider:this.#t,guardianClient:this.#e,relayerClient:this.#o,flow:v}))}catch(s){throw s instanceof Error?trackError("passport","personal_sign",s,{flowId:v.details.flowId}):v.addEvent("errored"),s}finally{v.addEvent("End");}}case"eth_signTypedData":case"eth_signTypedData_v4":{if(!await this.#i())throw new H(4100,"Unauthorised - call eth_requestAccounts first");let v=trackFlow("passport","ethSignTypedDataV4");try{return await this.#e.withConfirmationScreen({width:480,height:720})(async()=>await en({method:a.method,params:a.params||[],ethSigner:this.#r,rpcProvider:this.#t,relayerClient:this.#o,guardianClient:this.#e,flow:v}))}catch(s){throw s instanceof Error?trackError("passport","eth_signTypedData",s,{flowId:v.details.flowId}):v.addEvent("errored"),s}finally{v.addEvent("End");}}case"eth_chainId":{let{chainId:u}=await this.#t.getNetwork();return toBeHex(u)}case"eth_getBalance":case"eth_getCode":case"eth_getTransactionCount":{let[u,v]=a.params||[];return this.#t.send(a.method,[u,v||"latest"])}case"eth_getStorageAt":{let[u,v,s]=a.params||[];return this.#t.send(a.method,[u,v,s||"latest"])}case"eth_call":case"eth_estimateGas":{let[u,v]=a.params||[];return this.#t.send(a.method,[u,v||"latest"])}case"eth_gasPrice":case"eth_blockNumber":case"eth_getBlockByHash":case"eth_getBlockByNumber":case"eth_getTransactionByHash":case"eth_getTransactionReceipt":return this.#t.send(a.method,a.params||[]);case"im_signEjectionTransaction":{let u=await this.#i();if(!u)throw new H(4100,"Unauthorised - call eth_requestAccounts first");let v=trackFlow("passport","imSignEjectionTransaction");try{return await dn({params:a.params||[],ethSigner:this.#r,zkEvmAddress:u,flow:v})}catch(s){throw s instanceof Error?trackError("passport","imSignEjectionTransaction",s,{flowId:v.details.flowId}):v.addEvent("errored"),s}finally{v.addEvent("End");}}case"im_addSessionActivity":{let[u]=a.params||[],v=await this.#i();return v&&this.#l(v,u),null}default:throw new H(4200,"Method not supported")}}async request(a){try{return this.#p(a)}catch(u){throw u instanceof H?u:u instanceof Error?new H(-32603,u.message):new H(-32603,"Internal error")}}on(a,u){this.#a.on(a,u);}removeListener(a,u){this.#a.removeListener(a,u);}};_();R();var pe=class{passportDomain;zkEvmRpcUrl;relayerUrl;indexerMrBasePath;jsonRpcReferrer;forceScwDeployBeforeMessageSignature;crossSdkBridgeEnabled;feeTokenSymbol;constructor(a){this.passportDomain=a.passportDomain,this.zkEvmRpcUrl=a.zkEvmRpcUrl,this.relayerUrl=a.relayerUrl,this.indexerMrBasePath=a.indexerMrBasePath,this.jsonRpcReferrer=a.jsonRpcReferrer,this.forceScwDeployBeforeMessageSignature=a.forceScwDeployBeforeMessageSignature||!1,this.crossSdkBridgeEnabled=a.crossSdkBridgeEnabled||!1,this.feeTokenSymbol=a.feeTokenSymbol||"IMX";}};_();R();_();R();var Fr=async(o,a,u=!0,v=!0)=>{let s=trackFlow("passport",a,u);try{return await o(s)}catch(T){throw T instanceof Error?trackError("passport",a,T,{flowId:s.details.flowId}):s.addEvent("errored"),T}finally{v&&s.addEvent("End");}};var yn="ETH",Kt=class o extends AbstractSigner{auth;magicTeeApiClient;userWallet=null;createWalletPromise=null;constructor(a,u){super(),this.auth=a,this.magicTeeApiClient=u;}async getUserWallet(){let{userWallet:a}=this;a||(a=await this.createWallet());let u=await this.getUserOrThrow();if(u.profile.sub!==a.userIdentifier&&(a=await this.createWallet(u)),isUserZkEvm(u)&&u.zkEvm.userAdminAddress.toLowerCase()!==a.walletAddress.toLowerCase())throw new St(`Wallet address mismatch.Rollup: zkEVM, TEE address: ${a.walletAddress}, profile address: ${u.zkEvm.userAdminAddress}`,"WALLET_CONNECTION_ERROR");return a}async createWallet(a){return this.createWalletPromise?this.createWalletPromise:(this.createWalletPromise=new Promise(async(u,v)=>{try{this.userWallet=null;let s=a||await this.getUserOrThrow(),T=o.getHeaders(s);await Fr(async d=>{try{let I=performance.now(),b=await this.magicTeeApiClient.walletApi.createWalletV1WalletPost({xMagicChain:yn},{headers:T});return trackDuration("passport",d.details.flowName,Math.round(performance.now()-I)),this.userWallet={userIdentifier:s.profile.sub,walletAddress:b.data.public_address},u(this.userWallet)}catch(I){let b="MagicTEE: Failed to initialise EOA";return isAxiosError(I)?I.response?b+=` with status ${I.response.status}: ${JSON.stringify(I.response.data)}`:b+=`: ${I.message}`:b+=`: ${I.message}`,v(new Error(b))}},"magicCreateWallet");}catch(s){v(s);}finally{this.createWalletPromise=null;}}),this.createWalletPromise)}async getUserOrThrow(){let a=await this.auth.getUser();if(!a)throw new St("User has been logged out","NOT_LOGGED_IN_ERROR");return a}static getHeaders(a){if(!a)throw new St("User has been logged out","NOT_LOGGED_IN_ERROR");return {Authorization:`Bearer ${a.idToken}`}}async getAddress(){return (await this.getUserWallet()).walletAddress}async signMessage(a){await this.getUserWallet();let u=a instanceof Uint8Array?`0x${L.from(a).toString("hex")}`:a,v=await this.getUserOrThrow(),s=await o.getHeaders(v);return Fr(async T=>{try{let d=performance.now(),I=await this.magicTeeApiClient.signOperationsApi.signMessageV1WalletSignMessagePost({signMessageRequest:{message_base64:L.from(u,"utf-8").toString("base64")},xMagicChain:yn},{headers:s});return trackDuration("passport",T.details.flowName,Math.round(performance.now()-d)),I.data.signature}catch(d){let I="MagicTEE: Failed to sign message using EOA";throw isAxiosError(d)?d.response?I+=` with status ${d.response.status}: ${JSON.stringify(d.response.data)}`:I+=`: ${d.message}`:I+=`: ${d.message}`,new Error(I)}},"magicSignMessage")}connect(){throw new Error("Method not implemented.")}signTransaction(){throw new Error("Method not implemented.")}signTypedData(){throw new Error("Method not implemented.")}};_();R();var Hr={icon:'data:image/svg+xml,<svg viewBox="0 0 48 48" class="SvgIcon undefined Logo Logo--PassportSymbolOutlined css-1dn9atd" xmlns="http://www.w3.org/2000/svg"><g data-testid="undefined__g"><circle cx="24" cy="24" r="22.5" fill="url(%23paint0_radial_6324_83922)"></circle><circle cx="24" cy="24" r="22.5" fill="url(%23paint1_radial_6324_83922)"></circle><path d="M24 0C10.7452 0 0 10.7452 0 24C0 37.2548 10.7452 48 24 48C37.2548 48 48 37.2548 48 24C48 10.7452 37.2548 0 24 0ZM23.0718 9.16608C23.7383 8.83951 24.4406 8.86188 25.087 9.2287C27.3282 10.5059 29.5627 11.7942 31.786 13.096C32.5018 13.5165 32.8686 14.1897 32.8708 15.0173C32.8843 17.9184 32.8798 20.8171 32.8708 23.7182C32.8708 23.8255 32.8015 23.9821 32.7143 24.0335C31.8531 24.548 30.9808 25.0423 30.0347 25.5881V25.1318C30.0347 22.148 30.0257 19.1664 30.0414 16.1827C30.0436 15.6101 29.8468 15.241 29.339 14.9525C26.7377 13.474 24.1499 11.9687 21.5575 10.4723C21.4457 10.4075 21.3361 10.3381 21.1661 10.2352C21.8326 9.85722 22.4321 9.47698 23.0673 9.16608H23.0718ZM22.5953 38.8451C22.45 38.7713 22.3426 38.7198 22.2375 38.6595C18.8041 36.68 15.3752 34.687 11.9307 32.7232C10.9644 32.173 10.5238 31.3879 10.5349 30.2852C10.5551 27.9411 10.5484 25.597 10.5372 23.2507C10.5327 22.1927 10.9622 21.4255 11.8926 20.8977C14.3105 19.5221 16.715 18.1264 19.1195 16.7284C19.3275 16.6076 19.4796 16.5875 19.6965 16.7172C20.5264 17.216 21.3719 17.6924 22.2554 18.2024C22.0876 18.3031 21.9601 18.3791 21.8304 18.4552C19.2268 19.9582 16.6278 21.4658 14.0175 22.9599C13.5903 23.2037 13.3912 23.5213 13.3957 24.0179C13.4091 25.8654 13.4114 27.713 13.3957 29.5605C13.3912 30.0705 13.5948 30.3948 14.0332 30.6453C16.7866 32.2199 19.5288 33.8125 22.28 35.3916C22.5126 35.5258 22.611 35.6645 22.6065 35.9418C22.5864 36.888 22.5998 37.8363 22.5998 38.8473L22.5953 38.8451ZM22.5953 33.553C22.356 33.4166 22.1838 33.3204 22.0116 33.2198C19.8285 31.9605 17.6477 30.6967 15.4602 29.4464C15.2231 29.3122 15.1359 29.1668 15.1381 28.8917C15.1538 27.4714 15.1471 26.0511 15.1426 24.6308C15.1426 24.4384 15.1717 24.3064 15.3618 24.1991C16.167 23.7495 16.9633 23.2798 17.7618 22.8212C17.8199 22.7877 17.8826 22.7631 17.9877 22.7116V24.3064C17.9877 25.1698 18.0011 26.0354 17.9832 26.8988C17.972 27.3909 18.1622 27.7241 18.5916 27.9657C19.8285 28.6636 21.0498 29.3883 22.2867 30.0839C22.5305 30.2203 22.6043 30.3724 22.5998 30.6408C22.5842 31.5847 22.5931 32.5308 22.5931 33.5508L22.5953 33.553ZM20.0746 14.91C19.6116 14.6371 19.2157 14.6393 18.7527 14.91C16.1581 16.4265 13.5523 17.9228 10.9487 19.4259C10.8391 19.4908 10.7251 19.5489 10.5305 19.6541C10.5998 18.6654 10.3873 17.7327 10.7251 16.8291C10.9085 16.3348 11.2529 15.9635 11.7092 15.6995C13.8811 14.4447 16.0507 13.1877 18.227 11.9396C19.0211 11.4833 19.8308 11.4945 20.6248 11.953C23.0964 13.3756 25.5657 14.8026 28.0306 16.2341C28.1357 16.2945 28.2677 16.4309 28.2677 16.5338C28.2856 17.5493 28.2788 18.567 28.2788 19.6563C27.3819 19.1396 26.5543 18.6609 25.7267 18.1823C23.8412 17.093 21.9512 16.0149 20.0746 14.91ZM37.4427 30.8779C37.3778 31.6764 36.9103 32.2423 36.2192 32.6404C33.5732 34.1614 30.9294 35.6913 28.2856 37.2168C27.4557 37.6954 26.6259 38.1741 25.7938 38.6527C25.6932 38.7109 25.5903 38.7601 25.4539 38.8317C25.4449 38.693 25.4337 38.5924 25.4337 38.4917C25.4337 37.6149 25.4382 36.7404 25.4293 35.8636C25.4293 35.6645 25.4762 35.5437 25.6596 35.4386C29.5157 33.2198 33.3696 30.9942 37.2212 28.7709C37.2794 28.7374 37.3443 28.7105 37.4539 28.6591C37.4539 29.4375 37.4986 30.1622 37.4427 30.8779ZM37.4628 25.3577C37.4561 26.2658 36.9663 26.9033 36.1901 27.3506C33.175 29.0841 30.1622 30.8265 27.1493 32.5666C26.5991 32.8842 26.0466 33.1996 25.4561 33.5396C25.4472 33.3897 25.436 33.2913 25.436 33.1907C25.436 32.3273 25.4449 31.4617 25.4293 30.5983C25.4248 30.3523 25.5075 30.2226 25.72 30.0995C28.46 28.5271 31.1911 26.9368 33.9355 25.3733C34.4231 25.096 34.6378 24.7538 34.6334 24.1812C34.6132 21.1974 34.6244 18.2136 34.6244 15.2298V14.7087C35.3402 15.1404 36.0112 15.496 36.624 15.9299C37.1832 16.3258 37.465 16.9253 37.4673 17.6164C37.4762 20.1976 37.4829 22.7788 37.465 25.3599L37.4628 25.3577Z" fill="%230D0D0D"></path><path fill-rule="evenodd" d="M24 0C10.7452 0 0 10.7452 0 24C0 37.2548 10.7452 48 24 48C37.2548 48 48 37.2548 48 24C48 10.7452 37.2548 0 24 0ZM24 2C11.8497 2 2 11.8497 2 24C2 36.1503 11.8497 46 24 46C36.1503 46 46 36.1503 46 24C46 11.8497 36.1503 2 24 2Z" fill="url(%23paint2_radial_6324_83922)"></path><path fill-rule="evenodd" d="M24 0C10.7452 0 0 10.7452 0 24C0 37.2548 10.7452 48 24 48C37.2548 48 48 37.2548 48 24C48 10.7452 37.2548 0 24 0ZM24 2C11.8497 2 2 11.8497 2 24C2 36.1503 11.8497 46 24 46C36.1503 46 46 36.1503 46 24C46 11.8497 36.1503 2 24 2Z" fill="url(%23paint3_radial_6324_83922)"></path><defs><radialGradient id="paint0_radial_6324_83922" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(13.4442 13.3899) rotate(44.9817) scale(46.7487 99.1435)"><stop stop-color="%23A3EEF8"></stop><stop offset="0.177083" stop-color="%23A4DCF5"></stop><stop offset="0.380208" stop-color="%23A6AEEC"></stop><stop offset="1" stop-color="%23ECBEE1"></stop></radialGradient><radialGradient id="paint1_radial_6324_83922" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(25.9515 43.7068) rotate(84.265) scale(24.2138 46.3215)"><stop stop-color="%23FCF5EE"></stop><stop offset="0.715135" stop-color="%23ECBEE1" stop-opacity="0"></stop></radialGradient><radialGradient id="paint2_radial_6324_83922" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(12.7405 12.6825) rotate(44.9817) scale(49.8653 105.753)"><stop stop-color="%23A3EEF8"></stop><stop offset="0.177083" stop-color="%23A4DCF5"></stop><stop offset="0.380208" stop-color="%23A6AEEC"></stop><stop offset="1" stop-color="%23ECBEE1"></stop></radialGradient><radialGradient id="paint3_radial_6324_83922" cx="0" cy="0" r="1" gradientUnits="userSpaceOnUse" gradientTransform="translate(26.0816 45.0206) rotate(84.265) scale(25.828 49.4096)"><stop stop-color="%23FCF5EE"></stop><stop offset="0.715135" stop-color="%23ECBEE1" stop-opacity="0"></stop></radialGradient></defs></g></svg>',name:"Immutable Passport",rdns:"com.immutable.passport",uuid:v4()};function Vr(o){if(typeof window>"u")return;let a=new CustomEvent("eip6963:announceProvider",{detail:Object.freeze(o)});window.dispatchEvent(a);let u=()=>window.dispatchEvent(a);window.addEventListener("eip6963:requestProvider",u);}_();R();_();R();var Gr=13371,Wr=13473,Zr={13371:{magicPublishableApiKey:"pk_live_D02F278E25B3E5F3",magicProviderId:"imtbl-immutable-zkEVM"},13473:{magicPublishableApiKey:"pk_live_620E2F8860D1D79E",magicProviderId:"imtbl-immutable-zkEVM-testnet"}};var $r={chainId:13371,name:"Immutable zkEVM",rpcUrl:"https://rpc.immutable.com",relayerUrl:"https://api.immutable.com/relayer-mr",apiUrl:"https://api.immutable.com",passportDomain:"https://passport.immutable.com",magicPublishableApiKey:"pk_live_D02F278E25B3E5F3",magicProviderId:"imtbl-immutable-zkEVM",magicTeeBasePath:"https://tee.express.magiclabs.com"},qr={chainId:13473,name:"Immutable zkEVM Testnet",rpcUrl:"https://rpc.testnet.immutable.com",relayerUrl:"https://api.sandbox.immutable.com/relayer-mr",apiUrl:"https://api.sandbox.immutable.com",passportDomain:"https://passport.sandbox.immutable.com",magicPublishableApiKey:"pk_live_620E2F8860D1D79E",magicProviderId:"imtbl-immutable-zkEVM-testnet",magicTeeBasePath:"https://tee.express.magiclabs.com"},Ge=[qr,$r],ha={chains:[$r]},ua={chains:[qr]},fa={chains:Ge};function ya(o){return o in Zr}function va(o){if(o.magicPublishableApiKey&&o.magicProviderId)return {magicPublishableApiKey:o.magicPublishableApiKey,magicProviderId:o.magicProviderId};let{chainId:a}=o;if(ya(a))return Zr[a];throw new Error(`No Magic configuration available for chain ${o.chainId}. Please provide magicPublishableApiKey and magicProviderId in ChainConfig.`)}async function wa(o){let a=o.chains&&o.chains.length>0?o.chains:Ge,u=o.initialChainId||a[0].chainId,v=a.find(et=>et.chainId===u);if(!v)throw new Error(`Initial chain ${u} not found in chains configuration`);let s=createConfig({basePath:v.apiUrl}),T=new MultiRollupApiClients({indexer:s,orderBook:s,passport:s}),d=o.auth.getConfig(),I=await o.auth.getUser(),b=new pe({passportDomain:v.passportDomain||v.apiUrl.replace("api.","passport."),zkEvmRpcUrl:v.rpcUrl,relayerUrl:v.relayerUrl,indexerMrBasePath:v.apiUrl,jsonRpcReferrer:o.jsonRpcReferrer,forceScwDeployBeforeMessageSignature:o.forceScwDeployBeforeMessageSignature,crossSdkBridgeEnabled:o.crossSdkBridgeEnabled,feeTokenSymbol:o.feeTokenSymbol}),U=new mr$1.GuardianApi(s),k=new jt({config:b,auth:o.auth,guardianApi:U,authConfig:d}),Z=va(v),z=v.magicTeeBasePath||"https://tee.express.magiclabs.com",P=new MagicTeeApiClients({basePath:z,timeout:1e4,magicPublishableApiKey:Z.magicPublishableApiKey,magicProviderId:Z.magicProviderId}),F=new Kt(o.auth,P),$=null;v.chainId===13371?$="https://api.immutable.com":v.chainId===13473?$="https://api.sandbox.immutable.com":v.apiUrl&&($=v.apiUrl);let J=o.passportEventEmitter||new TypedEventEmitter,at=new ce({auth:o.auth,config:b,multiRollupApiClients:T,passportEventEmitter:J,guardianClient:k,ethSigner:F,user:I,sessionActivityApiUrl:$});return o.announceProvider!==!1&&Vr({info:Hr,provider:at}),at}_();R();function Ca(o){return typeof o=="object"&&o!==null&&"code"in o&&"message"in o}async function Ia(o,a){let u=await o.getUser();if(!u?.profile.sub)return [];let v={Authorization:`Bearer ${u.accessToken}`},{data:s}=await a.passportProfileApi.getUserInfo({headers:v});return s.linked_addresses}async function Ra(o,a,u){let v=trackFlow("wallet","linkExternalWallet");try{let s=await o.getUser();if(!s)throw new St("User is not logged in","NOT_LOGGED_IN_ERROR");if(!isUserZkEvm(s))throw new St("User has not been registered on Immutable zkEVM","WALLET_CONNECTION_ERROR");let d={Authorization:`Bearer ${s.accessToken}`},I={type:u.type,wallet_address:u.walletAddress,signature:u.signature,nonce:u.nonce};return {...(await a.passportProfileApi.linkWalletV2({linkWalletV2Request:I},{headers:d})).data}}catch(s){if(s instanceof Error?trackError("wallet","linkExternalWallet",s):v.addEvent("errored"),isAxiosError(s)&&s.response){if(s.response.data&&Ca(s.response.data)){let{code:d,message:I}=s.response.data;switch(d){case"ALREADY_LINKED":throw new St(I,"WALLET_CONNECTION_ERROR");case"MAX_WALLETS_LINKED":throw new St(I,"WALLET_CONNECTION_ERROR");case"DUPLICATE_NONCE":throw new St(I,"WALLET_CONNECTION_ERROR");case"VALIDATION_ERROR":throw new St(I,"WALLET_CONNECTION_ERROR");default:throw new St(I,"WALLET_CONNECTION_ERROR")}}else if(s.response.status)throw new St(`Link wallet request failed with status code ${s.response.status}`,"WALLET_CONNECTION_ERROR")}let T="Link wallet request failed";throw s instanceof Error&&(T+=`: ${s.message}`),new St(T,"WALLET_CONNECTION_ERROR")}finally{v.addEvent("End");}}/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
346
346
 
347
- export { jt as ConfirmationScreen, We as DEFAULT_CHAINS, Kt as GuardianClient, ua as IMMUTABLE_ZKEVM_MAINNET, qr as IMMUTABLE_ZKEVM_MAINNET_CHAIN, Wr as IMMUTABLE_ZKEVM_MAINNET_CHAIN_ID, ca as IMMUTABLE_ZKEVM_MULTICHAIN, fa as IMMUTABLE_ZKEVM_TESTNET, Jr as IMMUTABLE_ZKEVM_TESTNET_CHAIN, Zr as IMMUTABLE_ZKEVM_TESTNET_CHAIN_ID, H as JsonRpcError, Xt as MagicTEESigner, Ce as ProviderErrorCode, Sn as ProviderEvent, ne as RelayerClient, Bn as RelayerTransactionStatus, kt as RpcErrorCode, de as WalletConfiguration, ft as WalletError, ue as WalletErrorType, si as WalletEvents, pe as ZkEvmProvider, Gr as announceProvider, Ea as connectWallet, _a as getLinkedAddresses, xa as linkExternalWallet, Vr as passportProviderInfo, Yt as retryWithDelay, vi as walletHelpers };
347
+ export { Yt as ConfirmationScreen, Ge as DEFAULT_CHAINS, jt as GuardianClient, ha as IMMUTABLE_ZKEVM_MAINNET, $r as IMMUTABLE_ZKEVM_MAINNET_CHAIN, Gr as IMMUTABLE_ZKEVM_MAINNET_CHAIN_ID, fa as IMMUTABLE_ZKEVM_MULTICHAIN, ua as IMMUTABLE_ZKEVM_TESTNET, qr as IMMUTABLE_ZKEVM_TESTNET_CHAIN, Wr as IMMUTABLE_ZKEVM_TESTNET_CHAIN_ID, H as JsonRpcError, Kt as MagicTEESigner, Ae as ProviderErrorCode, bn as ProviderEvent, ie as RelayerClient, xn as RelayerTransactionStatus, Lt as RpcErrorCode, pe as WalletConfiguration, St as WalletError, he as WalletErrorType, ai as WalletEvents, ce as ZkEvmProvider, Vr as announceProvider, wa as connectWallet, Ia as getLinkedAddresses, Ra as linkExternalWallet, Hr as passportProviderInfo, Ue as retryWithDelay, gi as walletHelpers };