@imtbl/checkout-widgets 2.0.0-alpha.2 → 2.0.0-alpha.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/AddTokensWidget-TM4L24PP.js +15 -0
- package/dist/browser/BridgeWidget-2JZZV7LZ.js +17 -1
- package/dist/browser/CommerceWidget-NRMKQO2X.js +41 -0
- package/dist/browser/ConnectWidget-ZM6T4NZJ.js +11 -1
- package/dist/browser/OnRampWidget-CXSJR4D2.js +10 -1
- package/dist/browser/SaleWidget-NS5UQNBN.js +29 -1
- package/dist/browser/SwapWidget-3DWYEOCD.js +18 -1
- package/dist/browser/WalletWidget-XWB6VELR.js +10 -1
- package/dist/browser/chunk-3AHRPZYV.js +15 -2
- package/dist/browser/chunk-5AVK5XOU.js +17 -2
- package/dist/browser/chunk-5U7AR7XV.js +5 -1
- package/dist/browser/chunk-65KT4KZW.js +6 -1
- package/dist/browser/chunk-AWLYHJ5L.js +6 -2
- package/dist/browser/chunk-BVF4MRFQ.js +9 -2
- package/dist/browser/chunk-DVUYKTGV.js +27 -2
- package/dist/browser/chunk-ECAH5RC3.js +7 -1
- package/dist/browser/chunk-EEDQFEKZ.js +20 -2
- package/dist/browser/chunk-EZWBOX2K.js +6 -1
- package/dist/browser/chunk-I3HZNWUF.js +6 -1
- package/dist/browser/chunk-JF3XWEEL.js +10 -2
- package/dist/browser/chunk-JV43EWXA.js +6 -1
- package/dist/browser/chunk-K3KIUMY7.js +7 -1
- package/dist/browser/chunk-KOBELCOG.js +7 -1
- package/dist/browser/{chunk-QPBIRWVO.js → chunk-LY53FASO.js} +31 -2
- package/dist/browser/chunk-MADECDXT.js +10 -2
- package/dist/browser/chunk-ME7FB46X.js +6 -1
- package/dist/browser/chunk-NNMZJ5NV.js +7 -2
- package/dist/browser/chunk-OPMBNAY3.js +6 -1
- package/dist/browser/chunk-P7Y5EGBN.js +12 -1
- package/dist/browser/chunk-QJTHBCR2.js +12 -1
- package/dist/browser/chunk-QPOHDTWR.js +13 -2
- package/dist/browser/chunk-R5TRMOBS.js +6 -1
- package/dist/browser/chunk-R7NCCCUY.js +6 -1
- package/dist/browser/chunk-RTSPX46P.js +7 -1
- package/dist/browser/chunk-UNEH2WXY.js +10 -1
- package/dist/browser/chunk-UNLLKACC.js +6 -1
- package/dist/browser/chunk-WCTMM2S2.js +24 -2
- package/dist/browser/chunk-WWUSGIQB.js +18 -2
- package/dist/browser/chunk-XE2T4YRZ.js +27 -2
- package/dist/browser/chunk-Y7N65KJX.js +8 -1
- package/dist/browser/chunk-YOCWSYBR.js +12 -1
- package/dist/browser/chunk-Z52PVTUZ.js +13 -2
- package/dist/browser/index.cdn.js +1 -1
- package/dist/browser/index.js +33 -3
- package/dist/node/{AddTokensWidget-EDEZT3WU.cjs → AddTokensWidget-4FGS24JD.cjs} +1 -1
- package/dist/node/{AddTokensWidget-3VRQJPK4.js → AddTokensWidget-WY3G5Z35.js} +1 -1
- package/dist/node/{CommerceWidget-SS5YH6AS.cjs → CommerceWidget-KTK7XCY5.cjs} +1 -1
- package/dist/node/{CommerceWidget-Q5YRUGMH.js → CommerceWidget-N7CELEEE.js} +1 -1
- package/dist/node/{chunk-JVDN4WI2.cjs → chunk-AOVPOH6S.cjs} +1 -1
- package/dist/node/{chunk-FI3JDTB2.js → chunk-HEO2MY2D.js} +1 -1
- package/dist/node/index.cjs +1 -1
- package/dist/node/index.js +1 -1
- package/package.json +8 -8
- package/dist/browser/AddTokensWidget-KL5Q2LI3.js +0 -1
- package/dist/browser/CommerceWidget-SWRL7ZWK.js +0 -1
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* @copyright 2023 Jason Mulligan <jason.mulligan@avoidwork.com>
|
|
6
6
|
* @license BSD-3-Clause
|
|
7
7
|
* @version 11.2.5
|
|
8
|
-
*/class LRU{constructor(e=0,t=0,r=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=e,this.resetTtl=r,this.size=0,this.ttl=t}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(e){if(this.has(e)){const t=this.items[e];delete this.items[e],this.size--,null!==t.prev&&(t.prev.next=t.next),null!==t.next&&(t.next.prev=t.prev),this.first===t&&(this.first=t.next),this.last===t&&(this.last=t.prev)}return this}entries(e=this.keys()){return e.map((e=>[e,this.get(e)]))}evict(e=!1){if(e||this.size>0){const e=this.first;delete this.items[e.key],0==--this.size?(this.first=null,this.last=null):(this.first=e.next,this.first.prev=null)}return this}expiresAt(e){let t;return this.has(e)&&(t=this.items[e].expiry),t}get(e){let t;if(this.has(e)){const r=this.items[e];this.ttl>0&&r.expiry<=Date.now()?this.delete(e):(t=r.value,this.set(e,t,!0))}return t}has(e){return e in this.items}keys(){const e=[];let t=this.first;for(;null!==t;)e.push(t.key),t=t.next;return e}set(e,t,r=!1,n=this.resetTtl){let i;if(r||this.has(e)){if(i=this.items[e],i.value=t,!1===r&&n&&(i.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.last!==i){const e=this.last,t=i.next,r=i.prev;this.first===i&&(this.first=i.next),i.next=null,i.prev=this.last,e.next=i,null!==r&&(r.next=t),null!==t&&(t.prev=r)}}else this.max>0&&this.size===this.max&&this.evict(!0),i=this.items[e]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:e,prev:this.last,next:null,value:t},1==++this.size?this.first=i:this.last.next=i;return this.last=i,this}values(e=this.keys()){return e.map((e=>this.get(e)))}}function lru(e=1e3,t=0,r=!1){if(isNaN(e)||e<0)throw new TypeError("Invalid max value");if(isNaN(t)||t<0)throw new TypeError("Invalid ttl value");if("boolean"!=typeof r)throw new TypeError("Invalid resetTtl value");return new LRU(e,t,r)}const defaultLRUOptions={max:1e3},memorise=(e,t={})=>{const{cache:r,cacheKeyResolver:n=defaultGenCacheKey,onHit:i,lruOptions:o={}}=t,a={...defaultLRUOptions,...o},s=r||lru(a.max,a.ttl);function c(...t){const r=n(...t),o=s.get(r);if(s.has(r))return i&&i(r,o,s),o;const a=e.apply(this,t);return s.set(r,a),a}return c._cache=s,c},defaultGenCacheKey=(...e)=>0===e.length?"no-args":e.map((e=>void 0===e?"undefined":null===e?"null":Array.isArray(e)?`[${defaultGenCacheKey(...e)}]`:"object"==typeof e?`{${defaultGenCacheKey(...sortedObjectEntries(e))}}`:JSON.stringify(e))).join(","),sortedObjectEntries=e=>Object.entries(e).sort(((e,t)=>e[0]<t[0]?-1:1));var commonjsGlobal$1="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function getDefaultExportFromCjs$2(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function getAugmentedNamespace(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var r=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})})),r}var lib$N={};Object.defineProperty(lib$N,"__esModule",{value:!0}),lib$N.clearGlobalNamespace=getGlobalisedValue_1=lib$N.getGlobalisedValue=void 0;const GLOBALISE_KEY_PREFIX="globalise__singleton__",fallbackGlobal={},getGlobalObject=()=>"undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:fallbackGlobal,validateInputs=(e,t)=>{if("string"!=typeof e)throw"Invalid namespace key";if("string"!=typeof t)throw"Invalid item key"},createGlobalisedKey=e=>`${GLOBALISE_KEY_PREFIX}${e}`,getGlobalScopedObject=e=>{const t=getGlobalObject(),r=createGlobalisedKey(e);return t[r]||(t[r]={}),t[r]},getSingleton=(e,t)=>getGlobalScopedObject(e)[t]||void 0,setSingleton=(e,t,r)=>{getGlobalScopedObject(e)[t]=r},getGlobalisedValue=(e,t,r)=>{validateInputs(e,t);const n=getSingleton(e,t);return void 0!==n?n:(setSingleton(e,t,r),r)};var getGlobalisedValue_1=lib$N.getGlobalisedValue=getGlobalisedValue;const clearGlobalNamespace=e=>{const t=getGlobalObject(),r=createGlobalisedKey(e);void 0!==t[r]&&delete t[r]};lib$N.clearGlobalNamespace=clearGlobalNamespace;var Ut$3=Object.defineProperty,St$2=(e,t)=>{for(var r in t)Ut$3(e,r,{get:t[r],enumerable:!0})};function Br$2(e){throw new Error("Node.js process "+e+" is not supported by JSPM core outside of Node.js")}var G$8=[],tr$3=!1,W$7,cr$7=-1;function kt$3(){!tr$3||!W$7||(tr$3=!1,W$7.length?G$8=W$7.concat(G$8):cr$7=-1,G$8.length&&Vr$2())}function Vr$2(){if(!tr$3){var e=setTimeout(kt$3,0);tr$3=!0;for(var t=G$8.length;t;){for(W$7=G$8,G$8=[];++cr$7<t;)W$7&&W$7[cr$7].run();cr$7=-1,t=G$8.length}W$7=null,tr$3=!1,clearTimeout(e)}}function _t$3(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];G$8.push(new Gr$2(e,t)),1===G$8.length&&!tr$3&&setTimeout(Vr$2,0)}function Gr$2(e,t){this.fun=e,this.array=t}Gr$2.prototype.run=function(){this.fun.apply(null,this.array)};var Pt$3="browser",Rt$3="x64",bt$3="browser",Nt$3={PATH:"/usr/bin",LANG:navigator.language+".UTF-8",PWD:"/",HOME:"/home",TMP:"/tmp"},vt$2=["/usr/bin/node"],Mt$2=[],Ct$4="v16.8.0",Lt$4={},Dt$3=function(e,t){console.warn((t?t+": ":"")+e)},$t$4=function(e){Br$2("binding")},Ft$3=function(e){return 0},Ot$5=function(){return"/"},Vt$3=function(e){},Gt$4={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};function N$7(){}var Yt$4=N$7,Kt$5=[];function Ht$4(e){Br$2("_linkedBinding")}var Wt$4={},jt$3=!1,Xt$6={};function qt$5(e){Br$2("dlopen")}function Jt$6(){return[]}function zt$4(){return[]}var Qt$3=N$7,Zt$4=N$7,Tr$3=function(){return{}},re$a=Tr$3,te$7=Tr$3,ee$6=N$7,ne$7=N$7,ie$8=N$7,oe$8={};function se$7(e,t){if(!e)throw new Error(t||"assertion error")}var ue$5={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},ae$6=N$7,ce$5=N$7;function pe$5(){return!1}var le$6=N$7,fe$6=N$7,he$5=N$7,de$8=N$7,me$7=N$7,we$6=void 0,ge$7=void 0,ye$7=void 0,Ee$6=N$7,Ie$4=2,Be$7=1,Te$3="/bin/usr/node",Ae$6=9229,xe$6="node",Ue$8=[],Se$5=N$7,K$b={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0},yr$4;function ke$8(){return K$b.now()/1e3}void 0===K$b.now&&(yr$4=Date.now(),K$b.timing&&K$b.timing.navigationStart&&(yr$4=K$b.timing.navigationStart),K$b.now=()=>Date.now()-yr$4);var Er$3=1e9;function Ir$3(e){var t=Math.floor(.001*(Date.now()-K$b.now())),r=.001*K$b.now(),n=Math.floor(r)+t,i=Math.floor(r%1*1e9);return e&&(n-=e[0],(i-=e[1])<0&&(n--,i+=Er$3)),[n,i]}Ir$3.bigint=function(e){var t=Ir$3(e);return typeof BigInt>"u"?t[0]*Er$3+t[1]:BigInt(t[0]*Er$3)+BigInt(t[1])};var _e$6=10,Pe$7={},Re$8=0;function H$8(){return A$6}var be$6=H$8,Ne$4=H$8,ve$7=H$8,Me$4=H$8,Ce$7=H$8,Le$6=N$7,De$7=H$8,$e$7=H$8;function Fe$6(e){return[]}var A$6={version:Ct$4,versions:Lt$4,arch:Rt$3,platform:bt$3,release:Gt$4,_rawDebug:Yt$4,moduleLoadList:Kt$5,binding:$t$4,_linkedBinding:Ht$4,_events:Pe$7,_eventsCount:Re$8,_maxListeners:_e$6,on:H$8,addListener:be$6,once:Ne$4,off:ve$7,removeListener:Me$4,removeAllListeners:Ce$7,emit:Le$6,prependListener:De$7,prependOnceListener:$e$7,listeners:Fe$6,domain:Wt$4,_exiting:jt$3,config:Xt$6,dlopen:qt$5,uptime:ke$8,_getActiveRequests:Jt$6,_getActiveHandles:zt$4,reallyExit:Qt$3,_kill:Zt$4,cpuUsage:Tr$3,resourceUsage:re$a,memoryUsage:te$7,kill:ee$6,exit:ne$7,openStdin:ie$8,allowedNodeEnvironmentFlags:oe$8,assert:se$7,features:ue$5,_fatalExceptions:ae$6,setUncaughtExceptionCaptureCallback:ce$5,hasUncaughtExceptionCaptureCallback:pe$5,emitWarning:Dt$3,nextTick:_t$3,_tickCallback:le$6,_debugProcess:fe$6,_debugEnd:he$5,_startProfilerIdleNotifier:de$8,_stopProfilerIdleNotifier:me$7,stdout:we$6,stdin:ye$7,stderr:ge$7,abort:Ee$6,umask:Ft$3,chdir:Vt$3,cwd:Ot$5,env:Nt$3,title:Pt$3,argv:vt$2,execArgv:Mt$2,pid:Ie$4,ppid:Be$7,execPath:Te$3,debugPort:Ae$6,hrtime:Ir$3,argv0:xe$6,_preload_modules:Ue$8,setSourceMapsEnabled:Se$5},nr$5={},Yr$1=!1;function Oe$5(){if(Yr$1)return nr$5;Yr$1=!0,nr$5.byteLength=function(e){var t=o(e),r=t[0],n=t[1];return 3*(r+n)/4-n},nr$5.toByteArray=function(e){var n,i,a=o(e),s=a[0],c=a[1],l=new r(function(e,t,r){return 3*(t+r)/4-r}(0,s,c)),u=0,d=c>0?s-4:s;for(i=0;i<d;i+=4)n=t[e.charCodeAt(i)]<<18|t[e.charCodeAt(i+1)]<<12|t[e.charCodeAt(i+2)]<<6|t[e.charCodeAt(i+3)],l[u++]=n>>16&255,l[u++]=n>>8&255,l[u++]=255&n;return 2===c&&(n=t[e.charCodeAt(i)]<<2|t[e.charCodeAt(i+1)]>>4,l[u++]=255&n),1===c&&(n=t[e.charCodeAt(i)]<<10|t[e.charCodeAt(i+1)]<<4|t[e.charCodeAt(i+2)]>>2,l[u++]=n>>8&255,l[u++]=255&n),l},nr$5.fromByteArray=function(t){for(var r,n=t.length,i=n%3,o=[],a=16383,c=0,l=n-i;c<l;c+=a)o.push(s(t,c,c+a>l?l:c+a));return 1===i?(r=t[n-1],o.push(e[r>>2]+e[r<<4&63]+"==")):2===i&&(r=(t[n-2]<<8)+t[n-1],o.push(e[r>>10]+e[r>>4&63]+e[r<<2&63]+"=")),o.join("")};for(var e=[],t=[],r=typeof Uint8Array<"u"?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0;i<64;++i)e[i]=n[i],t[n.charCodeAt(i)]=i;function o(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function a(t){return e[t>>18&63]+e[t>>12&63]+e[t>>6&63]+e[63&t]}function s(e,t,r){for(var n,i=[],o=t;o<r;o+=3)n=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(255&e[o+2]),i.push(a(n));return i.join("")}return t[45]=62,t[95]=63,nr$5}var pr$4={},Kr$3=!1;function Ve$5(){return Kr$3||(Kr$3=!0,pr$4.read=function(e,t,r,n,i){var o,a,s=8*i-n-1,c=(1<<s)-1,l=c>>1,u=-7,d=r?i-1:0,p=r?-1:1,f=e[t+d];for(d+=p,o=f&(1<<-u)-1,f>>=-u,u+=s;u>0;o=256*o+e[t+d],d+=p,u-=8);for(a=o&(1<<-u)-1,o>>=-u,u+=n;u>0;a=256*a+e[t+d],d+=p,u-=8);if(0===o)o=1-l;else{if(o===c)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,n),o-=l}return(f?-1:1)*a*Math.pow(2,o-n)},pr$4.write=function(e,t,r,n,i,o){var a,s,c,l=8*o-i-1,u=(1<<l)-1,d=u>>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:o-1,h=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=u):(a=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-a))<1&&(a--,c*=2),(t+=a+d>=1?p/c:p*Math.pow(2,1-d))*c>=2&&(a++,c/=2),a+d>=u?(s=0,a=u):a+d>=1?(s=(t*c-1)*Math.pow(2,i),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),a=0));i>=8;e[r+f]=255&s,f+=h,s/=256,i-=8);for(a=a<<i|s,l+=i;l>0;e[r+f]=255&a,f+=h,a/=256,l-=8);e[r+f-h]|=128*g}),pr$4}var j$9={},Hr$2=!1;function Ge$7(){if(Hr$2)return j$9;Hr$2=!0;let e=Oe$5(),t=Ve$5(),r="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;j$9.Buffer=o,j$9.SlowBuffer=function(e){return+e!=e&&(e=0),o.alloc(+e)},j$9.INSPECT_MAX_BYTES=50;let n=2147483647;function i(e){if(e>n)throw new RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,o.prototype),t}function o(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return c(e)}return a(e,t,r)}function a(e,t,r){if("string"==typeof e)return function(e,t){if(("string"!=typeof t||""===t)&&(t="utf8"),!o.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let r=0|p(e,t),n=i(r),a=n.write(e,t);return a!==r&&(n=n.slice(0,a)),n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(V(e,Uint8Array)){let t=new Uint8Array(e);return u(t.buffer,t.byteOffset,t.byteLength)}return l(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(V(e,ArrayBuffer)||e&&V(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(V(e,SharedArrayBuffer)||e&&V(e.buffer,SharedArrayBuffer)))return u(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');let n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return o.from(n,t,r);let a=function(e){if(o.isBuffer(e)){let t=0|d(e.length),r=i(t);return 0===r.length||e.copy(r,0,0,t),r}if(void 0!==e.length)return"number"!=typeof e.length||z(e.length)?i(0):l(e);if("Buffer"===e.type&&Array.isArray(e.data))return l(e.data)}(e);if(a)return a;if(typeof Symbol<"u"&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return o.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function s(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function c(e){return s(e),i(e<0?0:0|d(e))}function l(e){let t=e.length<0?0:0|d(e.length),r=i(t);for(let n=0;n<t;n+=1)r[n]=255&e[n];return r}function u(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(n,o.prototype),n}function d(e){if(e>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return 0|e}function p(e,t){if(o.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||V(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return H(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return G(e).length;default:if(i)return n?-1:H(e).length;t=(""+t).toLowerCase(),i=!0}}function f(e,t,r){let n=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0)||(r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return x(this,t,r);case"utf8":case"utf-8":return C(this,t,r);case"ascii":return w(this,t,r);case"latin1":case"binary":return S(this,t,r);case"base64":return _(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function h(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}function g(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),z(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=o.from(t,n)),o.isBuffer(t))return 0===t.length?-1:A(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):A(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function A(e,t,r,n,i){let o,a=1,s=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;a=2,s/=2,c/=2,r/=2}function l(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){let n=-1;for(o=r;o<s;o++)if(l(e,o)===l(t,-1===n?0:o-n)){if(-1===n&&(n=o),o-n+1===c)return n*a}else-1!==n&&(o-=o-n),n=-1}else for(r+c>s&&(r=s-c),o=r;o>=0;o--){let r=!0;for(let n=0;n<c;n++)if(l(e,o+n)!==l(t,n)){r=!1;break}if(r)return o}return-1}function m(e,t,r,n){r=Number(r)||0;let i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;let o,a=t.length;for(n>a/2&&(n=a/2),o=0;o<n;++o){let n=parseInt(t.substr(2*o,2),16);if(z(n))return o;e[r+o]=n}return o}function y(e,t,r,n){return q(H(t,e.length-r),e,r,n)}function b(e,t,r,n){return q(function(e){let t=[];for(let r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function v(e,t,r,n){return q(G(t),e,r,n)}function I(e,t,r,n){return q(function(e,t){let r,n,i,o=[];for(let a=0;a<e.length&&!((t-=2)<0);++a)r=e.charCodeAt(a),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function _(t,r,n){return 0===r&&n===t.length?e.fromByteArray(t):e.fromByteArray(t.slice(r,n))}function C(e,t,r){r=Math.min(e.length,r);let n=[],i=t;for(;i<r;){let t=e[i],o=null,a=t>239?4:t>223?3:t>191?2:1;if(i+a<=r){let r,n,s,c;switch(a){case 1:t<128&&(o=t);break;case 2:r=e[i+1],128==(192&r)&&(c=(31&t)<<6|63&r,c>127&&(o=c));break;case 3:r=e[i+1],n=e[i+2],128==(192&r)&&128==(192&n)&&(c=(15&t)<<12|(63&r)<<6|63&n,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:r=e[i+1],n=e[i+2],s=e[i+3],128==(192&r)&&128==(192&n)&&128==(192&s)&&(c=(15&t)<<18|(63&r)<<12|(63&n)<<6|63&s,c>65535&&c<1114112&&(o=c))}}null===o?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=a}return function(e){let t=e.length;if(t<=E)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=E));return r}(n)}j$9.kMaxLength=n,o.TYPED_ARRAY_SUPPORT=function(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch{return!1}}(),!o.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&"function"==typeof console.error&&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."),Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}}),o.poolSize=8192,o.from=function(e,t,r){return a(e,t,r)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array),o.alloc=function(e,t,r){return function(e,t,r){return s(e),e<=0?i(e):void 0!==t?"string"==typeof r?i(e).fill(t,r):i(e).fill(t):i(e)}(e,t,r)},o.allocUnsafe=function(e){return c(e)},o.allocUnsafeSlow=function(e){return c(e)},o.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==o.prototype},o.compare=function(e,t){if(V(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),V(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(e)||!o.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,n=t.length;for(let i=0,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},o.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}},o.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return o.alloc(0);let r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;let n=o.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){let t=e[r];if(V(t,Uint8Array))i+t.length>n.length?(o.isBuffer(t)||(t=o.from(t)),t.copy(n,i)):Uint8Array.prototype.set.call(n,t,i);else{if(!o.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(n,i)}i+=t.length}return n},o.byteLength=p,o.prototype._isBuffer=!0,o.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 t=0;t<e;t+=2)h(this,t,t+1);return this},o.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 t=0;t<e;t+=4)h(this,t,t+3),h(this,t+1,t+2);return this},o.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 t=0;t<e;t+=8)h(this,t,t+7),h(this,t+1,t+6),h(this,t+2,t+5),h(this,t+3,t+4);return this},o.prototype.toString=function(){let e=this.length;return 0===e?"":0===arguments.length?C(this,0,e):f.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(e){if(!o.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===o.compare(this,e)},o.prototype.inspect=function(){let e="",t=j$9.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"},r&&(o.prototype[r]=o.prototype.inspect),o.prototype.compare=function(e,t,r,n,i){if(V(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;let a=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),c=Math.min(a,s),l=this.slice(n,i),u=e.slice(t,r);for(let e=0;e<c;++e)if(l[e]!==u[e]){a=l[e],s=u[e];break}return a<s?-1:s<a?1:0},o.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},o.prototype.indexOf=function(e,t,r){return g(this,e,t,r,!0)},o.prototype.lastIndexOf=function(e,t,r){return g(this,e,t,r,!1)},o.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}let i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return m(this,e,t,r);case"utf8":case"utf-8":return y(this,e,t,r);case"ascii":case"latin1":case"binary":return b(this,e,t,r);case"base64":return v(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};let E=4096;function w(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function S(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function x(e,t,r){let n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=t;n<r;++n)i+=K[e[n]];return i}function T(e,t,r){let n=e.slice(t,r),i="";for(let e=0;e<n.length-1;e+=2)i+=String.fromCharCode(n[e]+256*n[e+1]);return i}function B(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function $(e,t,r,n,i,a){if(!o.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<a)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function k(e,t,r,n,i){F(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=a,a>>=8,e[r++]=a,a>>=8,e[r++]=a,a>>=8,e[r++]=a,r}function P(e,t,r,n,i){F(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r+7]=o,o>>=8,e[r+6]=o,o>>=8,e[r+5]=o,o>>=8,e[r+4]=o;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=a,a>>=8,e[r+2]=a,a>>=8,e[r+1]=a,a>>=8,e[r]=a,r+8}function O(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function R(e,r,n,i,o){return r=+r,n>>>=0,o||O(e,0,n,4),t.write(e,r,n,i,23,4),n+4}function D(e,r,n,i,o){return r=+r,n>>>=0,o||O(e,0,n,8),t.write(e,r,n,i,52,8),n+8}o.prototype.slice=function(e,t){let r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);let n=this.subarray(e,t);return Object.setPrototypeOf(n,o.prototype),n},o.prototype.readUintLE=o.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||B(e,t,this.length);let n=this[e],i=1,o=0;for(;++o<t&&(i*=256);)n+=this[e+o]*i;return n},o.prototype.readUintBE=o.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||B(e,t,this.length);let n=this[e+--t],i=1;for(;t>0&&(i*=256);)n+=this[e+--t]*i;return n},o.prototype.readUint8=o.prototype.readUInt8=function(e,t){return e>>>=0,t||B(e,1,this.length),this[e]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(e,t){return e>>>=0,t||B(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(e,t){return e>>>=0,t||B(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(e,t){return e>>>=0,t||B(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(e,t){return e>>>=0,t||B(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readBigUInt64LE=W((function(e){L(e>>>=0,"offset");let t=this[e],r=this[e+7];(void 0===t||void 0===r)&&U(e,this.length-8);let n=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(n)+(BigInt(i)<<BigInt(32))})),o.prototype.readBigUInt64BE=W((function(e){L(e>>>=0,"offset");let t=this[e],r=this[e+7];(void 0===t||void 0===r)&&U(e,this.length-8);let n=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<<BigInt(32))+BigInt(i)})),o.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||B(e,t,this.length);let n=this[e],i=1,o=0;for(;++o<t&&(i*=256);)n+=this[e+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*t)),n},o.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||B(e,t,this.length);let n=t,i=1,o=this[e+--n];for(;n>0&&(i*=256);)o+=this[e+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},o.prototype.readInt8=function(e,t){return e>>>=0,t||B(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},o.prototype.readInt16LE=function(e,t){e>>>=0,t||B(e,2,this.length);let r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt16BE=function(e,t){e>>>=0,t||B(e,2,this.length);let r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt32LE=function(e,t){return e>>>=0,t||B(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return e>>>=0,t||B(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readBigInt64LE=W((function(e){L(e>>>=0,"offset");let t=this[e],r=this[e+7];(void 0===t||void 0===r)&&U(e,this.length-8);let n=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),o.prototype.readBigInt64BE=W((function(e){L(e>>>=0,"offset");let t=this[e],r=this[e+7];(void 0===t||void 0===r)&&U(e,this.length-8);let n=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+r)})),o.prototype.readFloatLE=function(e,r){return e>>>=0,r||B(e,4,this.length),t.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,r){return e>>>=0,r||B(e,4,this.length),t.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,r){return e>>>=0,r||B(e,8,this.length),t.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,r){return e>>>=0,r||B(e,8,this.length),t.read(this,e,!1,52,8)},o.prototype.writeUintLE=o.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){$(this,e,t,r,Math.pow(2,8*r)-1,0)}let i=1,o=0;for(this[t]=255&e;++o<r&&(i*=256);)this[t+o]=e/i&255;return t+r},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){$(this,e,t,r,Math.pow(2,8*r)-1,0)}let i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},o.prototype.writeUint8=o.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,1,255,0),this[t]=255&e,t+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeBigUInt64LE=W((function(e,t=0){return k(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),o.prototype.writeBigUInt64BE=W((function(e,t=0){return P(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),o.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){let n=Math.pow(2,8*r-1);$(this,e,t,r,n-1,-n)}let i=0,o=1,a=0;for(this[t]=255&e;++i<r&&(o*=256);)e<0&&0===a&&0!==this[t+i-1]&&(a=1),this[t+i]=(e/o|0)-a&255;return t+r},o.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){let n=Math.pow(2,8*r-1);$(this,e,t,r,n-1,-n)}let i=r-1,o=1,a=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/o|0)-a&255;return t+r},o.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},o.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeBigInt64LE=W((function(e,t=0){return k(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),o.prototype.writeBigInt64BE=W((function(e,t=0){return P(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),o.prototype.writeFloatLE=function(e,t,r){return R(this,e,t,!0,r)},o.prototype.writeFloatBE=function(e,t,r){return R(this,e,t,!1,r)},o.prototype.writeDoubleLE=function(e,t,r){return D(this,e,t,!0,r)},o.prototype.writeDoubleBE=function(e,t,r){return D(this,e,t,!1,r)},o.prototype.copy=function(e,t,r,n){if(!o.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),!n&&0!==n&&(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r||0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);let i=n-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),t),i},o.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!o.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){let t=e.charCodeAt(0);("utf8"===n&&t<128||"latin1"===n)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;let i;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{let a=o.isBuffer(e)?e:o.from(e,n),s=a.length;if(0===s)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=a[i%s]}return this};let N={};function M(e,t,r){N[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function j(e){let t="",r=e.length,n="-"===e[0]?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function F(e,t,r,n,i,o){if(e>r||e<t){let r,n="bigint"==typeof t?"n":"";throw r=0===t||t===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(o+1)}${n}`:`>= -(2${n} ** ${8*(o+1)-1}${n}) and < 2 ** ${8*(o+1)-1}${n}`,new N.ERR_OUT_OF_RANGE("value",r,e)}!function(e,t,r){L(t,"offset"),(void 0===e[t]||void 0===e[t+r])&&U(t,e.length-(r+1))}(n,i,o)}function L(e,t){if("number"!=typeof e)throw new N.ERR_INVALID_ARG_TYPE(t,"number",e)}function U(e,t,r){throw Math.floor(e)!==e?(L(e,r),new N.ERR_OUT_OF_RANGE("offset","an integer",e)):t<0?new N.ERR_BUFFER_OUT_OF_BOUNDS:new N.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${t}`,e)}M("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),M("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),M("ERR_OUT_OF_RANGE",(function(e,t,r){let n=`The value of "${e}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=j(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=j(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n}),RangeError);let Q=/[^+/0-9A-Za-z-_]/g;function H(e,t){t=t||1/0;let r,n=e.length,i=null,o=[];for(let a=0;a<n;++a){if(r=e.charCodeAt(a),r>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function G(t){return e.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(Q,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(t))}function q(e,t,r,n){let i;for(i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function V(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function z(e){return e!=e}let K=function(){let e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){let n=16*r;for(let i=0;i<16;++i)t[n+i]=e[r]+e[i]}return t}();function W(e){return typeof BigInt>"u"?J:e}function J(){throw new Error("BigInt not supported")}return j$9}var X$7=Ge$7();X$7.Buffer,X$7.SlowBuffer,X$7.INSPECT_MAX_BYTES,X$7.kMaxLength;var k$8=X$7.Buffer;X$7.INSPECT_MAX_BYTES,X$7.kMaxLength;var Ur$3={};St$2(Ur$3,{deleteItem:()=>We$8,getItem:()=>fr$3,setItem:()=>or$5});var ir$5=()=>typeof window>"u",lr$4=()=>!ir$5(),Ye$7="__IMX-",Ar$4=()=>lr$4()&&window.localStorage,Ke$4=e=>{if(null!==e)try{return JSON.parse(e)}catch{return e}},He$6=e=>"string"==typeof e?e:JSON.stringify(e),xr$4=e=>`${Ye$7}${e}`;function fr$3(e){if(Ar$4())return Ke$4(window.localStorage.getItem(xr$4(e)))}var or$5=(e,t)=>!!Ar$4()&&(window.localStorage.setItem(xr$4(e),He$6(t)),!0),We$8=e=>!!Ar$4()&&(window.localStorage.removeItem(xr$4(e)),!0),Sr$3=0,Wr$1=e=>{let t=1e3*parseInt(e,10),r=new Date(t),n=new Date;return Sr$3=r.getTime()-n.getTime()},jr$3=()=>{let e=(new Date).getTime()+Sr$3;return new Date(e).toISOString()},sr$5=(e=>(e.RUNTIME_ID="rid",e.PASSPORT_CLIENT_ID="passportClientId",e.ENVIRONMENT="env",e.PUBLISHABLE_API_KEY="pak",e.IDENTITY="uid",e.DOMAIN="domain",e.SDK_VERSION="sdkVersion",e))(sr$5||{}),Xe$6="https://api.immutable.com";async function hr$5(e,t){let r=axios$1.create({baseURL:Xe$6}),n=JSON.stringify(t),i={payload:k$8.from(n).toString("base64")};return(await r.post(e,i)).data}var q$b,J$6,qe$6=()=>{q$b=fr$3("metrics-events")||[],J$6=fr$3("metrics-runtime")||{}};qe$6();var V$b=(e,t)=>{J$6={...J$6,[e]:t},or$5("metrics-runtime",J$6)},ur$4=e=>{if(void 0!==J$6[e])return J$6[e]},Xr$1=()=>J$6,qr$2=()=>q$b,Jr$2=e=>{q$b.push(e),or$5("metrics-events",q$b)},zr$2=e=>{q$b=q$b.slice(e),or$5("metrics-events",q$b)},dr$5=e=>{let t=[];return Object.entries(e).forEach((([e,r])=>{("string"==typeof e||"string"==typeof r||"number"==typeof r||"boolean"==typeof r)&&t.push([e,r.toString()])})),t},kr$3="2.0.0-alpha.2",Je$5=()=>ir$5()?"":window.location.ancestorOrigins&&window.location.ancestorOrigins.length>0?new URL(window.location.ancestorOrigins[0]).hostname:document.referrer?new URL(window.document.referrer).hostname:"",ze$6=()=>{if(ir$5())return"";let e;try{window.self!==window.top&&(e=Je$5())}catch{}return e||(e=window.location.hostname),e},Qe$6=()=>{if(V$b("sdkVersion",kr$3),ir$5())return{browser:"nodejs",sdkVersion:kr$3};let e=ze$6();return e&&V$b("domain",e),{sdkVersion:kr$3,browser:window.navigator.userAgent,domain:e,tz:Intl.DateTimeFormat().resolvedOptions().timeZone,screen:`${window.screen.width}x${window.screen.height}`}},_r$3=!1,Qr$2=()=>_r$3,Zr$1=async()=>{_r$3=!0;try{let e=dr$5(Qe$6()),t=ur$4("rid"),r=ur$4("uid"),n=await hr$5("/v1/sdk/initialise",{version:1,data:{runtimeDetails:e,runtimeId:t,uId:r}}),{runtimeId:i,sTime:o}=n;V$b("rid",i),Wr$1(o)}catch{_r$3=!1}};function P$6(e,t){return(...r)=>{try{let n=e(...r);return n instanceof Promise?n.catch((()=>t)):n}catch{return t}}}function Ze$5(){return!(lr$4()||typeof A$6>"u")&&void 0!==A$6.env.JEST_WORKER_ID}var rt$5=P$6(Ze$5,!1),et$5="imtbl__metrics",tn$2=5e3,en$2=1e3,z$c=(e,t)=>getGlobalisedValue_1(et$5,e,t),nt$3=(e,t)=>{let r=memorise(t,{lruOptions:{ttl:tn$2,max:en$2}});return getGlobalisedValue_1(et$5,e,r)},nn$1=5e3,on$1=(e,t,r)=>{let n={event:`${e}.${t}`,time:jr$3(),...r&&{properties:dr$5(r)}};Jr$2(n)},Q$a=P$6(nt$3("track",on$1)),sn$1=async()=>{if(!1===Qr$2())return void await Zr$1();let e=qr$2();if(0===e.length)return;let t=e.length,r=Xr$1();await hr$5("/v1/sdk/metrics",{version:1,data:{events:e,details:r}})instanceof Error||zr$2(t)},un=P$6(sn$1),ot$4=async()=>{await un(),setTimeout(ot$4,nn$1)},it$3=!1,an$1=()=>{it$3||(it$3=!0,ot$4())};rt$5()||P$6(z$c("startFlushing",an$1))();var Pr$4=(e,t,r,n)=>Q$a(e,t,{...n||{},duration:Math.round(r)}),st$5=()=>{let e=()=>Math.floor(65536*(1+Math.random())).toString(16).substring(1);return`${e()}${e()}-${e()}-${e()}-${e()}-${e()}${e()}${e()}`},cn$1=(...e)=>{if(!e.some((e=>!!e)))return{};let t={};return e.forEach((e=>{e&&(t={...t,...e})})),t},pn$1=e=>e.replace(/[^a-zA-Z0-9\s\-_]/g,""),ln$1=(e,t)=>`${e}_${pn$1(t)}`,fn$1=(e,t,r)=>{let n=st$5(),i=Date.now(),o=0,a=0,s={},c=(...e)=>cn$1(s,...e,{flowId:n,flowName:t});s=c(r);let l=(r,n)=>{let i=ln$1(t,r),s=0,l=performance.now();o>0&&(s=l-a);let u=c(n,{flowEventName:r,flowStep:o});Pr$4(e,i,s,u),o++,a=l};return l("Start"),{details:{moduleName:e,flowName:t,flowId:n,flowStartTime:i},addEvent:P$6(l),addFlowProperties:P$6((e=>{e&&(s=c(e))}))}},hn=P$6(fn$1),dn$2=(e,t,r,n)=>{let{message:i}=r,o=r.stack||"",{cause:a}=r;a instanceof Error&&(o=`${o} \nCause: ${a.message}\n ${a.stack}`),Q$a(e,`trackError_${t}`,{...n||{},errorMessage:i,errorStack:o,isTrackError:!0})},mn$1=P$6(dn$2),En$1=e=>{V$b("env",e)},In$1=P$6(z$c("setEnvironment",En$1)),Bn=e=>{V$b("passportClientId",e)};P$6(z$c("setPassportClientId",Bn));var An=e=>{V$b("pak",e)};P$6(z$c("setPublishableApiKey",An)),P$6(z$c("getDetail",ur$4));var K$a=(e=>(e.PRODUCTION="production",e.SANDBOX="sandbox",e))(K$a||{}),u$6=(e=>(e.API_KEY="x-immutable-api-key",e.PUBLISHABLE_KEY="x-immutable-publishable-key",e.RATE_LIMITING_KEY="x-api-key",e))(u$6||{}),r$d=class{environment;rateLimitingKey;apiKey;publishableKey;constructor(e){this.environment=e.environment,this.publishableKey=e.publishableKey,this.apiKey=e.apiKey,this.rateLimitingKey=e.rateLimitingKey,In$1(e.environment),Q$a("config","created_imtbl_config")}};const version$9="6.13.4";function checkType(e,t,r){const n=t.split("|").map((e=>e.trim()));for(let r=0;r<n.length;r++)switch(t){case"any":return;case"bigint":case"boolean":case"number":case"string":if(typeof e===t)return}const i=new Error(`invalid value for type ${t}`);throw i.code="INVALID_ARGUMENT",i.argument=`value.${r}`,i.value=e,i}async function resolveProperties(e){const t=Object.keys(e),r=await Promise.all(t.map((t=>Promise.resolve(e[t]))));return r.reduce(((e,r,n)=>(e[t[n]]=r,e)),{})}function defineProperties$2(e,t,r){for(let n in t){let i=t[n];const o=r?r[n]:null;o&&checkType(i,o,n),Object.defineProperty(e,n,{enumerable:!0,value:i,writable:!1})}}function stringify$4(e){if(null==e)return"null";if(Array.isArray(e))return"[ "+e.map(stringify$4).join(", ")+" ]";if(e instanceof Uint8Array){const t="0123456789abcdef";let r="0x";for(let n=0;n<e.length;n++)r+=t[e[n]>>4],r+=t[15&e[n]];return r}if("object"==typeof e&&"function"==typeof e.toJSON)return stringify$4(e.toJSON());switch(typeof e){case"boolean":case"symbol":case"number":return e.toString();case"bigint":return BigInt(e).toString();case"string":return JSON.stringify(e);case"object":{const t=Object.keys(e);return t.sort(),"{ "+t.map((t=>`${stringify$4(t)}: ${stringify$4(e[t])}`)).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function isError$1(e,t){return e&&e.code===t}function isCallException(e){return isError$1(e,"CALL_EXCEPTION")}function makeError(e,t,r){let n,i=e;{const n=[];if(r){if("message"in r||"code"in r||"name"in r)throw new Error(`value will overwrite populated values: ${stringify$4(r)}`);for(const e in r){if("shortMessage"===e)continue;const t=r[e];n.push(e+"="+stringify$4(t))}}n.push(`code=${t}`),n.push(`version=${version$9}`),n.length&&(e+=" ("+n.join(", ")+")")}switch(t){case"INVALID_ARGUMENT":n=new TypeError(e);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":n=new RangeError(e);break;default:n=new Error(e)}return defineProperties$2(n,{code:t}),r&&Object.assign(n,r),null==n.shortMessage&&defineProperties$2(n,{shortMessage:i}),n}function assert$j(e,t,r,n){if(!e)throw makeError(t,r,n)}function assertArgument(e,t,r,n){assert$j(e,t,"INVALID_ARGUMENT",{argument:r,value:n})}function assertArgumentCount(e,t,r){null==r&&(r=""),r&&(r=": "+r),assert$j(e>=t,"missing arguemnt"+r,"MISSING_ARGUMENT",{count:e,expectedCount:t}),assert$j(e<=t,"too many arguments"+r,"UNEXPECTED_ARGUMENT",{count:e,expectedCount:t})}function assertPrivate(e,t,r){if(null==r&&(r=""),e!==t){let e=r,t="new";r&&(e+=".",t+=" "+r),assert$j(!1,`private constructor; use ${e}from* methods`,"UNSUPPORTED_OPERATION",{operation:t})}}function _getBytes(e,t,r){if(e instanceof Uint8Array)return r?new Uint8Array(e):e;if("string"==typeof e&&e.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)){const t=new Uint8Array((e.length-2)/2);let r=2;for(let n=0;n<t.length;n++)t[n]=parseInt(e.substring(r,r+2),16),r+=2;return t}assertArgument(!1,"invalid BytesLike value",t||"value",e)}function getBytes(e,t){return _getBytes(e,t,!1)}function getBytesCopy(e,t){return _getBytes(e,t,!0)}function isHexString$1(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(("number"!=typeof t||e.length===2+2*t)&&(!0!==t||e.length%2==0))}function isBytesLike(e){return isHexString$1(e,!0)||e instanceof Uint8Array}["NFD","NFC","NFKD","NFKC"].reduce(((e,t)=>{try{if("test"!=="test".normalize(t))throw new Error("bad");if("NFD"===t){const e=String.fromCharCode(233).normalize("NFD");if(e!==String.fromCharCode(101,769))throw new Error("broken")}e.push(t)}catch(e){}return e}),[]);const HexCharacters="0123456789abcdef";function hexlify(e){const t=getBytes(e);let r="0x";for(let e=0;e<t.length;e++){const n=t[e];r+=HexCharacters[(240&n)>>4]+HexCharacters[15&n]}return r}function concat$5(e){return"0x"+e.map((e=>hexlify(e).substring(2))).join("")}function dataLength(e){return isHexString$1(e,!0)?(e.length-2)/2:getBytes(e).length}function dataSlice(e,t,r){const n=getBytes(e);return null!=r&&r>n.length&&assert$j(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:n,length:n.length,offset:r}),hexlify(n.slice(null==t?0:t,null==r?n.length:r))}function zeroPad(e,t,r){const n=getBytes(e);assert$j(t>=n.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(n),length:t,offset:t+1});const i=new Uint8Array(t);return i.fill(0),r?i.set(n,t-n.length):i.set(n,0),hexlify(i)}function zeroPadValue(e,t){return zeroPad(e,t,!0)}function zeroPadBytes(e,t){return zeroPad(e,t,!1)}const BN_0$9=BigInt(0),BN_1$4=BigInt(1),maxValue=9007199254740991;function fromTwos(e,t){const r=getUint(e,"value"),n=BigInt(getNumber(t,"width"));if(assert$j(r>>n===BN_0$9,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:e}),r>>n-BN_1$4){return-((~r&(BN_1$4<<n)-BN_1$4)+BN_1$4)}return r}function toTwos(e,t){let r=getBigInt(e,"value");const n=BigInt(getNumber(t,"width")),i=BN_1$4<<n-BN_1$4;if(r<BN_0$9){r=-r,assert$j(r<=i,"too low","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:e});return(~r&(BN_1$4<<n)-BN_1$4)+BN_1$4}return assert$j(r<i,"too high","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:e}),r}function mask(e,t){const r=getUint(e,"value"),n=BigInt(getNumber(t,"bits"));return r&(BN_1$4<<n)-BN_1$4}function getBigInt(e,t){switch(typeof e){case"bigint":return e;case"number":return assertArgument(Number.isInteger(e),"underflow",t||"value",e),assertArgument(e>=-maxValue&&e<=maxValue,"overflow",t||"value",e),BigInt(e);case"string":try{if(""===e)throw new Error("empty string");return"-"===e[0]&&"-"!==e[1]?-BigInt(e.substring(1)):BigInt(e)}catch(r){assertArgument(!1,`invalid BigNumberish string: ${r.message}`,t||"value",e)}}assertArgument(!1,"invalid BigNumberish value",t||"value",e)}function getUint(e,t){const r=getBigInt(e,t);return assert$j(r>=BN_0$9,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:e}),r}const Nibbles="0123456789abcdef";function toBigInt(e){if(e instanceof Uint8Array){let t="0x0";for(const r of e)t+=Nibbles[r>>4],t+=Nibbles[15&r];return BigInt(t)}return getBigInt(e)}function getNumber(e,t){switch(typeof e){case"bigint":return assertArgument(e>=-maxValue&&e<=maxValue,"overflow",t||"value",e),Number(e);case"number":return assertArgument(Number.isInteger(e),"underflow",t||"value",e),assertArgument(e>=-maxValue&&e<=maxValue,"overflow",t||"value",e),e;case"string":try{if(""===e)throw new Error("empty string");return getNumber(BigInt(e),t)}catch(r){assertArgument(!1,`invalid numeric string: ${r.message}`,t||"value",e)}}assertArgument(!1,"invalid numeric value",t||"value",e)}function toNumber$3(e){return getNumber(toBigInt(e))}function toBeHex(e,t){let r=getUint(e,"value").toString(16);if(null==t)r.length%2&&(r="0"+r);else{const n=getNumber(t,"width");for(assert$j(2*n>=r.length,`value exceeds width (${n} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:e});r.length<2*n;)r="0"+r}return"0x"+r}function toBeArray(e){const t=getUint(e,"value");if(t===BN_0$9)return new Uint8Array([]);let r=t.toString(16);r.length%2&&(r="0"+r);const n=new Uint8Array(r.length/2);for(let e=0;e<n.length;e++){const t=2*e;n[e]=parseInt(r.substring(t,t+2),16)}return n}function toQuantity(e){let t=hexlify(isBytesLike(e)?e:toBeArray(e)).substring(2);for(;t.startsWith("0");)t=t.substring(1);return""===t&&(t="0"),"0x"+t}const Alphabet="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";BigInt(0);const BN_58=BigInt(58);function encodeBase58(e){const t=getBytes(e);let r=toBigInt(t),n="";for(;r;)n=Alphabet[Number(r%BN_58)]+n,r/=BN_58;for(let e=0;e<t.length&&!t[e];e++)n=Alphabet[0]+n;return n}function decodeBase64(e){e=atob(e);const t=new Uint8Array(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return getBytes(t)}function encodeBase64(e){const t=getBytes(e);let r="";for(let e=0;e<t.length;e++)r+=String.fromCharCode(t[e]);return btoa(r)}class EventPayload{filter;emitter;#e;constructor(e,t,r){this.#e=t,defineProperties$2(this,{emitter:e,filter:r})}async removeListener(){null!=this.#e&&await this.emitter.off(this.filter,this.#e)}}function errorFunc(e,t,r,n,i){assertArgument(!1,`invalid codepoint at offset ${t}; ${e}`,"bytes",r)}function ignoreFunc(e,t,r,n,i){if("BAD_PREFIX"===e||"UNEXPECTED_CONTINUE"===e){let e=0;for(let n=t+1;n<r.length&&r[n]>>6==2;n++)e++;return e}return"OVERRUN"===e?r.length-t-1:0}function replaceFunc(e,t,r,n,i){return"OVERLONG"===e?(assertArgument("number"==typeof i,"invalid bad code point for replacement","badCodepoint",i),n.push(i),0):(n.push(65533),ignoreFunc(e,t,r))}const Utf8ErrorFuncs=Object.freeze({error:errorFunc,ignore:ignoreFunc,replace:replaceFunc});function getUtf8CodePoints(e,t){null==t&&(t=Utf8ErrorFuncs.error);const r=getBytes(e,"bytes"),n=[];let i=0;for(;i<r.length;){const e=r[i++];if(!(e>>7)){n.push(e);continue}let o=null,a=null;if(192==(224&e))o=1,a=127;else if(224==(240&e))o=2,a=2047;else{if(240!=(248&e)){i+=t(128==(192&e)?"UNEXPECTED_CONTINUE":"BAD_PREFIX",i-1,r,n);continue}o=3,a=65535}if(i-1+o>=r.length){i+=t("OVERRUN",i-1,r,n);continue}let s=e&(1<<8-o-1)-1;for(let e=0;e<o;e++){let e=r[i];if(128!=(192&e)){i+=t("MISSING_CONTINUE",i,r,n),s=null;break}s=s<<6|63&e,i++}null!==s&&(s>1114111?i+=t("OUT_OF_RANGE",i-1-o,r,n,s):s>=55296&&s<=57343?i+=t("UTF16_SURROGATE",i-1-o,r,n,s):s<=a?i+=t("OVERLONG",i-1-o,r,n,s):n.push(s))}return n}function toUtf8Bytes(e,t){assertArgument("string"==typeof e,"invalid string value","str",e);let r=[];for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);if(n<128)r.push(n);else if(n<2048)r.push(n>>6|192),r.push(63&n|128);else if(55296==(64512&n)){t++;const i=e.charCodeAt(t);assertArgument(t<e.length&&56320==(64512&i),"invalid surrogate pair","str",e);const o=65536+((1023&n)<<10)+(1023&i);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(63&o|128)}else r.push(n>>12|224),r.push(n>>6&63|128),r.push(63&n|128)}return new Uint8Array(r)}function _toUtf8String(e){return e.map((e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10&1023),56320+(1023&e))))).join("")}function toUtf8String(e,t){return _toUtf8String(getUtf8CodePoints(e,t))}function createGetUrl(e){return async function(e,t){assert$j(null==t||!t.cancelled,"request cancelled before sending","CANCELLED");const r=e.url.split(":")[0].toLowerCase();assert$j("http"===r||"https"===r,`unsupported protocol ${r}`,"UNSUPPORTED_OPERATION",{info:{protocol:r},operation:"request"}),assert$j("https"===r||!e.credentials||e.allowInsecureAuthentication,"insecure authorized connections unsupported","UNSUPPORTED_OPERATION",{operation:"request"});let n=null;const i=new AbortController,o=setTimeout((()=>{n=makeError("request timeout","TIMEOUT"),i.abort()}),e.timeout);t&&t.addListener((()=>{n=makeError("request cancelled","CANCELLED"),i.abort()}));const a={method:e.method,headers:new Headers(Array.from(e)),body:e.body||void 0,signal:i.signal};let s;try{s=await fetch(e.url,a)}catch(e){if(clearTimeout(o),n)throw n;throw e}clearTimeout(o);const c={};s.headers.forEach(((e,t)=>{c[t.toLowerCase()]=e}));const l=await s.arrayBuffer(),u=null==l?null:new Uint8Array(l);return{statusCode:s.status,statusMessage:s.statusText,headers:c,body:u}}}const MAX_ATTEMPTS=12,SLOT_INTERVAL=250;let defaultGetUrlFunc=createGetUrl();const reData=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),reIpfs=new RegExp("^ipfs://(ipfs/)?(.*)$","i");let locked$1=!1;async function dataGatewayFunc(e,t){try{const t=e.match(reData);if(!t)throw new Error("invalid data");return new FetchResponse(200,"OK",{"content-type":t[1]||"text/plain"},t[2]?decodeBase64(t[3]):unpercent(t[3]))}catch(t){return new FetchResponse(599,"BAD REQUEST (invalid data: URI)",{},null,new FetchRequest(e))}}function getIpfsGatewayFunc(e){return async function(t,r){try{const r=t.match(reIpfs);if(!r)throw new Error("invalid link");return new FetchRequest(`${e}${r[2]}`)}catch(e){return new FetchResponse(599,"BAD REQUEST (invalid IPFS URI)",{},null,new FetchRequest(t))}}}const Gateways={data:dataGatewayFunc,ipfs:getIpfsGatewayFunc("https://gateway.ipfs.io/ipfs/")},fetchSignals=new WeakMap;class FetchCancelSignal{#t;#r;constructor(e){this.#t=[],this.#r=!1,fetchSignals.set(e,(()=>{if(!this.#r){this.#r=!0;for(const e of this.#t)setTimeout((()=>{e()}),0);this.#t=[]}}))}addListener(e){assert$j(!this.#r,"singal already cancelled","UNSUPPORTED_OPERATION",{operation:"fetchCancelSignal.addCancelListener"}),this.#t.push(e)}get cancelled(){return this.#r}checkSignal(){assert$j(!this.cancelled,"cancelled","CANCELLED",{})}}function checkSignal(e){if(null==e)throw new Error("missing signal; should not happen");return e.checkSignal(),e}class FetchRequest{#n;#i;#o;#a;#s;#c;#l;#u;#d;#p;#f;#h;#g;#A;#m;get url(){return this.#c}set url(e){this.#c=String(e)}get body(){return null==this.#l?null:new Uint8Array(this.#l)}set body(e){if(null==e)this.#l=void 0,this.#u=void 0;else if("string"==typeof e)this.#l=toUtf8Bytes(e),this.#u="text/plain";else if(e instanceof Uint8Array)this.#l=e,this.#u="application/octet-stream";else{if("object"!=typeof e)throw new Error("invalid body");this.#l=toUtf8Bytes(JSON.stringify(e)),this.#u="application/json"}}hasBody(){return null!=this.#l}get method(){return this.#a?this.#a:this.hasBody()?"POST":"GET"}set method(e){null==e&&(e=""),this.#a=String(e).toUpperCase()}get headers(){const e=Object.assign({},this.#o);return this.#d&&(e.authorization=`Basic ${encodeBase64(toUtf8Bytes(this.#d))}`),this.allowGzip&&(e["accept-encoding"]="gzip"),null==e["content-type"]&&this.#u&&(e["content-type"]=this.#u),this.body&&(e["content-length"]=String(this.body.length)),e}getHeader(e){return this.headers[e.toLowerCase()]}setHeader(e,t){this.#o[String(e).toLowerCase()]=String(t)}clearHeaders(){this.#o={}}[Symbol.iterator](){const e=this.headers,t=Object.keys(e);let r=0;return{next:()=>{if(r<t.length){const n=t[r++];return{value:[n,e[n]],done:!1}}return{value:void 0,done:!0}}}}get credentials(){return this.#d||null}setCredentials(e,t){assertArgument(!e.match(/:/),"invalid basic authentication username","username","[REDACTED]"),this.#d=`${e}:${t}`}get allowGzip(){return this.#i}set allowGzip(e){this.#i=!!e}get allowInsecureAuthentication(){return!!this.#n}set allowInsecureAuthentication(e){this.#n=!!e}get timeout(){return this.#s}set timeout(e){assertArgument(e>=0,"timeout must be non-zero","timeout",e),this.#s=e}get preflightFunc(){return this.#p||null}set preflightFunc(e){this.#p=e}get processFunc(){return this.#f||null}set processFunc(e){this.#f=e}get retryFunc(){return this.#h||null}set retryFunc(e){this.#h=e}get getUrlFunc(){return this.#m||defaultGetUrlFunc}set getUrlFunc(e){this.#m=e}constructor(e){this.#c=String(e),this.#n=!1,this.#i=!0,this.#o={},this.#a="",this.#s=3e5,this.#A={slotInterval:SLOT_INTERVAL,maxAttempts:MAX_ATTEMPTS},this.#m=null}toString(){return`<FetchRequest method=${JSON.stringify(this.method)} url=${JSON.stringify(this.url)} headers=${JSON.stringify(this.headers)} body=${this.#l?hexlify(this.#l):"null"}>`}setThrottleParams(e){null!=e.slotInterval&&(this.#A.slotInterval=e.slotInterval),null!=e.maxAttempts&&(this.#A.maxAttempts=e.maxAttempts)}async#y(e,t,r,n,i){if(e>=this.#A.maxAttempts)return i.makeServerError("exceeded maximum retry limit");assert$j(getTime$1()<=t,"timeout","TIMEOUT",{operation:"request.send",reason:"timeout",request:n}),r>0&&await wait(r);let o=this.clone();const a=(o.url.split(":")[0]||"").toLowerCase();if(a in Gateways){const e=await Gateways[a](o.url,checkSignal(n.#g));if(e instanceof FetchResponse){let t=e;if(this.processFunc){checkSignal(n.#g);try{t=await this.processFunc(o,t)}catch(e){null!=e.throttle&&"number"==typeof e.stall||t.makeServerError("error in post-processing function",e).assertOk()}}return t}o=e}this.preflightFunc&&(o=await this.preflightFunc(o));const s=await this.getUrlFunc(o,checkSignal(n.#g));let c=new FetchResponse(s.statusCode,s.statusMessage,s.headers,s.body,n);if(301===c.statusCode||302===c.statusCode){try{const r=c.headers.location||"";return o.redirect(r).#y(e+1,t,0,n,c)}catch(e){}return c}if(429===c.statusCode&&(null==this.retryFunc||await this.retryFunc(o,c,e))){const r=c.headers["retry-after"];let i=this.#A.slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return"string"==typeof r&&r.match(/^[1-9][0-9]*$/)&&(i=parseInt(r)),o.clone().#y(e+1,t,i,n,c)}if(this.processFunc){checkSignal(n.#g);try{c=await this.processFunc(o,c)}catch(r){null!=r.throttle&&"number"==typeof r.stall||c.makeServerError("error in post-processing function",r).assertOk();let i=this.#A.slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return r.stall>=0&&(i=r.stall),o.clone().#y(e+1,t,i,n,c)}}return c}send(){return assert$j(null==this.#g,"request already sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.send"}),this.#g=new FetchCancelSignal(this),this.#y(0,getTime$1()+this.timeout,0,this,new FetchResponse(0,"",{},null,this))}cancel(){assert$j(null!=this.#g,"request has not been sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.cancel"});const e=fetchSignals.get(this);if(!e)throw new Error("missing signal; should not happen");e()}redirect(e){const t=this.url.split(":")[0].toLowerCase(),r=e.split(":")[0].toLowerCase();assert$j("GET"===this.method&&("https"!==t||"http"!==r)&&e.match(/^https?:/),"unsupported redirect","UNSUPPORTED_OPERATION",{operation:`redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(e)})`});const n=new FetchRequest(e);return n.method="GET",n.allowGzip=this.allowGzip,n.timeout=this.timeout,n.#o=Object.assign({},this.#o),this.#l&&(n.#l=new Uint8Array(this.#l)),n.#u=this.#u,n}clone(){const e=new FetchRequest(this.url);return e.#a=this.#a,this.#l&&(e.#l=this.#l),e.#u=this.#u,e.#o=Object.assign({},this.#o),e.#d=this.#d,this.allowGzip&&(e.allowGzip=!0),e.timeout=this.timeout,this.allowInsecureAuthentication&&(e.allowInsecureAuthentication=!0),e.#p=this.#p,e.#f=this.#f,e.#h=this.#h,e.#A=Object.assign({},this.#A),e.#m=this.#m,e}static lockConfig(){locked$1=!0}static getGateway(e){return Gateways[e.toLowerCase()]||null}static registerGateway(e,t){if("http"===(e=e.toLowerCase())||"https"===e)throw new Error(`cannot intercept ${e}; use registerGetUrl`);if(locked$1)throw new Error("gateways locked");Gateways[e]=t}static registerGetUrl(e){if(locked$1)throw new Error("gateways locked");defaultGetUrlFunc=e}static createGetUrlFunc(e){return createGetUrl()}static createDataGateway(){return dataGatewayFunc}static createIpfsGatewayFunc(e){return getIpfsGatewayFunc(e)}}class FetchResponse{#b;#v;#o;#l;#I;#_;toString(){return`<FetchResponse status=${this.statusCode} body=${this.#l?hexlify(this.#l):"null"}>`}get statusCode(){return this.#b}get statusMessage(){return this.#v}get headers(){return Object.assign({},this.#o)}get body(){return null==this.#l?null:new Uint8Array(this.#l)}get bodyText(){try{return null==this.#l?"":toUtf8String(this.#l)}catch(e){assert$j(!1,"response body is not valid UTF-8 data","UNSUPPORTED_OPERATION",{operation:"bodyText",info:{response:this}})}}get bodyJson(){try{return JSON.parse(this.bodyText)}catch(e){assert$j(!1,"response body is not valid JSON","UNSUPPORTED_OPERATION",{operation:"bodyJson",info:{response:this}})}}[Symbol.iterator](){const e=this.headers,t=Object.keys(e);let r=0;return{next:()=>{if(r<t.length){const n=t[r++];return{value:[n,e[n]],done:!1}}return{value:void 0,done:!0}}}}constructor(e,t,r,n,i){this.#b=e,this.#v=t,this.#o=Object.keys(r).reduce(((e,t)=>(e[t.toLowerCase()]=String(r[t]),e)),{}),this.#l=null==n?null:new Uint8Array(n),this.#I=i||null,this.#_={message:""}}makeServerError(e,t){let r;r=e?`CLIENT ESCALATED SERVER ERROR (${this.statusCode} ${this.statusMessage}; ${e})`:`CLIENT ESCALATED SERVER ERROR (${e=`${this.statusCode} ${this.statusMessage}`})`;const n=new FetchResponse(599,r,this.headers,this.body,this.#I||void 0);return n.#_={message:e,error:t},n}throwThrottleError(e,t){null==t?t=-1:assertArgument(Number.isInteger(t)&&t>=0,"invalid stall timeout","stall",t);const r=new Error(e||"throttling requests");throw defineProperties$2(r,{stall:t,throttle:!0}),r}getHeader(e){return this.headers[e.toLowerCase()]}hasBody(){return null!=this.#l}get request(){return this.#I}ok(){return""===this.#_.message&&this.statusCode>=200&&this.statusCode<300}assertOk(){if(this.ok())return;let{message:e,error:t}=this.#_;""===e&&(e=`server response ${this.statusCode} ${this.statusMessage}`);let r=null;this.request&&(r=this.request.url);let n=null;try{this.#l&&(n=toUtf8String(this.#l))}catch(e){}assert$j(!1,e,"SERVER_ERROR",{request:this.request||"unknown request",response:this,error:t,info:{requestUrl:r,responseBody:n,responseStatus:`${this.statusCode} ${this.statusMessage}`}})}}function getTime$1(){return(new Date).getTime()}function unpercent(e){return toUtf8Bytes(e.replace(/%([0-9a-f][0-9a-f])/gi,((e,t)=>String.fromCharCode(parseInt(t,16)))))}function wait(e){return new Promise((t=>setTimeout(t,e)))}const BN_N1=BigInt(-1),BN_0$8=BigInt(0),BN_1$3=BigInt(1),BN_5=BigInt(5),_guard$3={};let Zeros$1="0000";for(;Zeros$1.length<80;)Zeros$1+=Zeros$1;function getTens(e){let t=Zeros$1;for(;t.length<e;)t+=t;return BigInt("1"+t.substring(0,e))}function checkValue(e,t,r){const n=BigInt(t.width);if(t.signed){const t=BN_1$3<<n-BN_1$3;assert$j(null==r||e>=-t&&e<t,"overflow","NUMERIC_FAULT",{operation:r,fault:"overflow",value:e}),e=e>BN_0$8?fromTwos(mask(e,n),n):-fromTwos(mask(-e,n),n)}else{const t=BN_1$3<<n;assert$j(null==r||e>=0&&e<t,"overflow","NUMERIC_FAULT",{operation:r,fault:"overflow",value:e}),e=(e%t+t)%t&t-BN_1$3}return e}function getFormat(e){"number"==typeof e&&(e=`fixed128x${e}`);let t=!0,r=128,n=18;if("string"==typeof e)if("fixed"===e);else if("ufixed"===e)t=!1;else{const i=e.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);assertArgument(i,"invalid fixed format","format",e),t="u"!==i[1],r=parseInt(i[2]),n=parseInt(i[3])}else if(e){const i=e,o=(e,t,r)=>null==i[e]?r:(assertArgument(typeof i[e]===t,"invalid fixed format ("+e+" not "+t+")","format."+e,i[e]),i[e]);t=o("signed","boolean",t),r=o("width","number",r),n=o("decimals","number",n)}assertArgument(r%8==0,"invalid FixedNumber width (not byte aligned)","format.width",r),assertArgument(n<=80,"invalid FixedNumber decimals (too large)","format.decimals",n);return{signed:t,width:r,decimals:n,name:(t?"":"u")+"fixed"+String(r)+"x"+String(n)}}function toString$6(e,t){let r="";e<BN_0$8&&(r="-",e*=BN_N1);let n=e.toString();if(0===t)return r+n;for(;n.length<=t;)n=Zeros$1+n;const i=n.length-t;for(n=n.substring(0,i)+"."+n.substring(i);"0"===n[0]&&"."!==n[1];)n=n.substring(1);for(;"0"===n[n.length-1]&&"."!==n[n.length-2];)n=n.substring(0,n.length-1);return r+n}class FixedNumber{format;#C;#E;#w;_value;constructor(e,t,r){assertPrivate(e,_guard$3,"FixedNumber"),this.#E=t,this.#C=r;const n=toString$6(t,r.decimals);defineProperties$2(this,{format:r.name,_value:n}),this.#w=getTens(r.decimals)}get signed(){return this.#C.signed}get width(){return this.#C.width}get decimals(){return this.#C.decimals}get value(){return this.#E}#S(e){assertArgument(this.format===e.format,"incompatible format; use fixedNumber.toFormat","other",e)}#x(e,t){return e=checkValue(e,this.#C,t),new FixedNumber(_guard$3,e,this.#C)}#T(e,t){return this.#S(e),this.#x(this.#E+e.#E,t)}addUnsafe(e){return this.#T(e)}add(e){return this.#T(e,"add")}#B(e,t){return this.#S(e),this.#x(this.#E-e.#E,t)}subUnsafe(e){return this.#B(e)}sub(e){return this.#B(e,"sub")}#$(e,t){return this.#S(e),this.#x(this.#E*e.#E/this.#w,t)}mulUnsafe(e){return this.#$(e)}mul(e){return this.#$(e,"mul")}mulSignal(e){this.#S(e);const t=this.#E*e.#E;return assert$j(t%this.#w===BN_0$8,"precision lost during signalling mul","NUMERIC_FAULT",{operation:"mulSignal",fault:"underflow",value:this}),this.#x(t/this.#w,"mulSignal")}#k(e,t){return assert$j(e.#E!==BN_0$8,"division by zero","NUMERIC_FAULT",{operation:"div",fault:"divide-by-zero",value:this}),this.#S(e),this.#x(this.#E*this.#w/e.#E,t)}divUnsafe(e){return this.#k(e)}div(e){return this.#k(e,"div")}divSignal(e){assert$j(e.#E!==BN_0$8,"division by zero","NUMERIC_FAULT",{operation:"div",fault:"divide-by-zero",value:this}),this.#S(e);const t=this.#E*this.#w;return assert$j(t%e.#E===BN_0$8,"precision lost during signalling div","NUMERIC_FAULT",{operation:"divSignal",fault:"underflow",value:this}),this.#x(t/e.#E,"divSignal")}cmp(e){let t=this.value,r=e.value;const n=this.decimals-e.decimals;return n>0?r*=getTens(n):n<0&&(t*=getTens(-n)),t<r?-1:t>r?1:0}eq(e){return 0===this.cmp(e)}lt(e){return this.cmp(e)<0}lte(e){return this.cmp(e)<=0}gt(e){return this.cmp(e)>0}gte(e){return this.cmp(e)>=0}floor(){let e=this.#E;return this.#E<BN_0$8&&(e-=this.#w-BN_1$3),e=this.#E/this.#w*this.#w,this.#x(e,"floor")}ceiling(){let e=this.#E;return this.#E>BN_0$8&&(e+=this.#w-BN_1$3),e=this.#E/this.#w*this.#w,this.#x(e,"ceiling")}round(e){if(null==e&&(e=0),e>=this.decimals)return this;const t=this.decimals-e,r=BN_5*getTens(t-1);let n=this.value+r;const i=getTens(t);return n=n/i*i,checkValue(n,this.#C,"round"),new FixedNumber(_guard$3,n,this.#C)}isZero(){return this.#E===BN_0$8}isNegative(){return this.#E<BN_0$8}toString(){return this._value}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return FixedNumber.fromString(this.toString(),e)}static fromValue(e,t,r){const n=null==t?0:getNumber(t),i=getFormat(r);let o=getBigInt(e,"value");const a=n-i.decimals;if(a>0){const t=getTens(a);assert$j(o%t===BN_0$8,"value loses precision for format","NUMERIC_FAULT",{operation:"fromValue",fault:"underflow",value:e}),o/=t}else a<0&&(o*=getTens(-a));return checkValue(o,i,"fromValue"),new FixedNumber(_guard$3,o,i)}static fromString(e,t){const r=e.match(/^(-?)([0-9]*)\.?([0-9]*)$/);assertArgument(r&&r[2].length+r[3].length>0,"invalid FixedNumber string value","value",e);const n=getFormat(t);let i=r[2]||"0",o=r[3]||"";for(;o.length<n.decimals;)o+=Zeros$1;assert$j(o.substring(n.decimals).match(/^0*$/),"too many decimals for format","NUMERIC_FAULT",{operation:"fromString",fault:"underflow",value:e}),o=o.substring(0,n.decimals);const a=BigInt(r[1]+i+o);return checkValue(a,n,"fromString"),new FixedNumber(_guard$3,a,n)}static fromBytes(e,t){let r=toBigInt(getBytes(e,"value"));const n=getFormat(t);return n.signed&&(r=fromTwos(r,n.width)),checkValue(r,n,"fromBytes"),new FixedNumber(_guard$3,r,n)}}function hexlifyByte(e){let t=e.toString(16);for(;t.length<2;)t="0"+t;return"0x"+t}function unarrayifyInteger(e,t,r){let n=0;for(let i=0;i<r;i++)n=256*n+e[t+i];return n}function _decodeChildren(e,t,r,n){const i=[];for(;r<t+1+n;){const o=_decode(e,r);i.push(o.result),assert$j((r+=o.consumed)<=t+1+n,"child data too short","BUFFER_OVERRUN",{buffer:e,length:n,offset:t})}return{consumed:1+n,result:i}}function _decode(e,t){assert$j(0!==e.length,"data too short","BUFFER_OVERRUN",{buffer:e,length:0,offset:1});const r=t=>{assert$j(t<=e.length,"data short segment too short","BUFFER_OVERRUN",{buffer:e,length:e.length,offset:t})};if(e[t]>=248){const n=e[t]-247;r(t+1+n);const i=unarrayifyInteger(e,t+1,n);return r(t+1+n+i),_decodeChildren(e,t,t+1+n,n+i)}if(e[t]>=192){const n=e[t]-192;return r(t+1+n),_decodeChildren(e,t,t+1,n)}if(e[t]>=184){const n=e[t]-183;r(t+1+n);const i=unarrayifyInteger(e,t+1,n);r(t+1+n+i);return{consumed:1+n+i,result:hexlify(e.slice(t+1+n,t+1+n+i))}}if(e[t]>=128){const n=e[t]-128;r(t+1+n);return{consumed:1+n,result:hexlify(e.slice(t+1,t+1+n))}}return{consumed:1,result:hexlifyByte(e[t])}}function decodeRlp(e){const t=getBytes(e,"data"),r=_decode(t,0);return assertArgument(r.consumed===t.length,"unexpected junk after rlp payload","data",e),r.result}function arrayifyInteger(e){const t=[];for(;e;)t.unshift(255&e),e>>=8;return t}function _encode(e){if(Array.isArray(e)){let t=[];if(e.forEach((function(e){t=t.concat(_encode(e))})),t.length<=55)return t.unshift(192+t.length),t;const r=arrayifyInteger(t.length);return r.unshift(247+r.length),r.concat(t)}const t=Array.prototype.slice.call(getBytes(e,"object"));if(1===t.length&&t[0]<=127)return t;if(t.length<=55)return t.unshift(128+t.length),t;const r=arrayifyInteger(t.length);return r.unshift(183+r.length),r.concat(t)}const nibbles="0123456789abcdef";function encodeRlp(e){let t="0x";for(const r of _encode(e))t+=nibbles[r>>4],t+=nibbles[15&r];return t}const names=["wei","kwei","mwei","gwei","szabo","finney","ether"];function formatUnits(e,t){let r=18;if("string"==typeof t){const e=names.indexOf(t);assertArgument(e>=0,"invalid unit","unit",t),r=3*e}else null!=t&&(r=getNumber(t,"unit"));return FixedNumber.fromValue(e,r,{decimals:r,width:512}).toString()}function parseUnits$1(e,t){assertArgument("string"==typeof e,"value must be a string","value",e);let r=18;if("string"==typeof t){const e=names.indexOf(t);assertArgument(e>=0,"invalid unit","unit",t),r=3*e}else null!=t&&(r=getNumber(t,"unit"));return FixedNumber.fromString(e,{decimals:r,width:512}).value}function parseEther(e){return parseUnits$1(e,18)}const WordSize=32,Padding=new Uint8Array(WordSize),passProperties$1=["then"],_guard$2={},resultNames=new WeakMap;function getNames(e){return resultNames.get(e)}function setNames(e,t){resultNames.set(e,t)}function throwError$1(e,t){const r=new Error(`deferred error during ABI decoding triggered accessing ${e}`);throw r.error=t,r}function toObject(e,t,r){return e.indexOf(null)>=0?t.map(((e,t)=>e instanceof Result?toObject(getNames(e),e,r):e)):e.reduce(((e,n,i)=>{let o=t.getValue(n);return n in e||(r&&o instanceof Result&&(o=toObject(getNames(o),o,r)),e[n]=o),e}),{})}class Result extends Array{#P;constructor(...e){const t=e[0];let r=e[1],n=(e[2]||[]).slice(),i=!0;t!==_guard$2&&(r=e,n=[],i=!1),super(r.length),r.forEach(((e,t)=>{this[t]=e}));const o=n.reduce(((e,t)=>("string"==typeof t&&e.set(t,(e.get(t)||0)+1),e)),new Map);if(setNames(this,Object.freeze(r.map(((e,t)=>{const r=n[t];return null!=r&&1===o.get(r)?r:null})))),this.#P=[],null==this.#P&&this.#P,!i)return;Object.freeze(this);const a=new Proxy(this,{get:(e,t,r)=>{if("string"==typeof t){if(t.match(/^[0-9]+$/)){const r=getNumber(t,"%index");if(r<0||r>=this.length)throw new RangeError("out of result range");const n=e[r];return n instanceof Error&&throwError$1(`index ${r}`,n),n}if(passProperties$1.indexOf(t)>=0)return Reflect.get(e,t,r);const n=e[t];if(n instanceof Function)return function(...t){return n.apply(this===r?e:this,t)};if(!(t in e))return e.getValue.apply(this===r?e:this,[t])}return Reflect.get(e,t,r)}});return setNames(a,getNames(this)),a}toArray(e){const t=[];return this.forEach(((r,n)=>{r instanceof Error&&throwError$1(`index ${n}`,r),e&&r instanceof Result&&(r=r.toArray(e)),t.push(r)})),t}toObject(e){const t=getNames(this);return t.reduce(((r,n,i)=>(assert$j(null!=n,`value at index ${i} unnamed`,"UNSUPPORTED_OPERATION",{operation:"toObject()"}),toObject(t,this,e))),{})}slice(e,t){null==e&&(e=0),e<0&&(e+=this.length)<0&&(e=0),null==t&&(t=this.length),t<0&&(t+=this.length)<0&&(t=0),t>this.length&&(t=this.length);const r=getNames(this),n=[],i=[];for(let o=e;o<t;o++)n.push(this[o]),i.push(r[o]);return new Result(_guard$2,n,i)}filter(e,t){const r=getNames(this),n=[],i=[];for(let o=0;o<this.length;o++){const a=this[o];a instanceof Error&&throwError$1(`index ${o}`,a),e.call(t,a,o,this)&&(n.push(a),i.push(r[o]))}return new Result(_guard$2,n,i)}map(e,t){const r=[];for(let n=0;n<this.length;n++){const i=this[n];i instanceof Error&&throwError$1(`index ${n}`,i),r.push(e.call(t,i,n,this))}return r}getValue(e){const t=getNames(this).indexOf(e);if(-1===t)return;const r=this[t];return r instanceof Error&&throwError$1(`property ${JSON.stringify(e)}`,r.error),r}static fromItems(e,t){return new Result(_guard$2,e,t)}}function getValue$3(e){let t=toBeArray(e);return assert$j(t.length<=WordSize,"value out-of-bounds","BUFFER_OVERRUN",{buffer:t,length:WordSize,offset:t.length}),t.length!==WordSize&&(t=getBytesCopy(concat$5([Padding.slice(t.length%WordSize),t]))),t}class Coder{name;type;localName;dynamic;constructor(e,t,r,n){defineProperties$2(this,{name:e,type:t,localName:r,dynamic:n},{name:"string",type:"string",localName:"string",dynamic:"boolean"})}_throwError(e,t){assertArgument(!1,e,this.localName,t)}}let Writer$4=class{#O;#R;constructor(){this.#O=[],this.#R=0}get data(){return concat$5(this.#O)}get length(){return this.#R}#D(e){return this.#O.push(e),this.#R+=e.length,e.length}appendWriter(e){return this.#D(getBytesCopy(e.data))}writeBytes(e){let t=getBytesCopy(e);const r=t.length%WordSize;return r&&(t=getBytesCopy(concat$5([t,Padding.slice(r)]))),this.#D(t)}writeValue(e){return this.#D(getValue$3(e))}writeUpdatableValue(){const e=this.#O.length;return this.#O.push(Padding),this.#R+=WordSize,t=>{this.#O[e]=getValue$3(t)}}},Reader$4=class e{allowLoose;#O;#N;#M;#j;#F;constructor(e,t,r){defineProperties$2(this,{allowLoose:!!t}),this.#O=getBytesCopy(e),this.#M=0,this.#j=null,this.#F=null!=r?r:1024,this.#N=0}get data(){return hexlify(this.#O)}get dataLength(){return this.#O.length}get consumed(){return this.#N}get bytes(){return new Uint8Array(this.#O)}#L(e){if(this.#j)return this.#j.#L(e);this.#M+=e,assert$j(this.#F<1||this.#M<=this.#F*this.dataLength,`compressed ABI data exceeds inflation ratio of ${this.#F} ( see: https://github.com/ethers-io/ethers.js/issues/4537 )`,"BUFFER_OVERRUN",{buffer:getBytesCopy(this.#O),offset:this.#N,length:e,info:{bytesRead:this.#M,dataLength:this.dataLength}})}#U(e,t,r){let n=Math.ceil(t/WordSize)*WordSize;return this.#N+n>this.#O.length&&(this.allowLoose&&r&&this.#N+t<=this.#O.length?n=t:assert$j(!1,"data out-of-bounds","BUFFER_OVERRUN",{buffer:getBytesCopy(this.#O),length:this.#O.length,offset:this.#N+n})),this.#O.slice(this.#N,this.#N+n)}subReader(t){const r=new e(this.#O.slice(this.#N+t),this.allowLoose,this.#F);return r.#j=this,r}readBytes(e,t){let r=this.#U(0,e,!!t);return this.#L(e),this.#N+=r.length,r.slice(0,e)}readValue(){return toBigInt(this.readBytes(WordSize))}readIndex(){return toNumber$3(this.readBytes(WordSize))}};function number$5(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function bytes$3(e,...t){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function hash$9(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");number$5(e.outputLen),number$5(e.blockLen)}function exists$2(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function output$1(e,t){bytes$3(e);const r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}const crypto$7="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,u8a$1=e=>e instanceof Uint8Array,u32=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),createView=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),rotr=(e,t)=>e<<32-t|e>>>t,isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0];
|
|
8
|
+
*/class LRU{constructor(e=0,t=0,r=!1){this.first=null,this.items=Object.create(null),this.last=null,this.max=e,this.resetTtl=r,this.size=0,this.ttl=t}clear(){return this.first=null,this.items=Object.create(null),this.last=null,this.size=0,this}delete(e){if(this.has(e)){const t=this.items[e];delete this.items[e],this.size--,null!==t.prev&&(t.prev.next=t.next),null!==t.next&&(t.next.prev=t.prev),this.first===t&&(this.first=t.next),this.last===t&&(this.last=t.prev)}return this}entries(e=this.keys()){return e.map((e=>[e,this.get(e)]))}evict(e=!1){if(e||this.size>0){const e=this.first;delete this.items[e.key],0==--this.size?(this.first=null,this.last=null):(this.first=e.next,this.first.prev=null)}return this}expiresAt(e){let t;return this.has(e)&&(t=this.items[e].expiry),t}get(e){let t;if(this.has(e)){const r=this.items[e];this.ttl>0&&r.expiry<=Date.now()?this.delete(e):(t=r.value,this.set(e,t,!0))}return t}has(e){return e in this.items}keys(){const e=[];let t=this.first;for(;null!==t;)e.push(t.key),t=t.next;return e}set(e,t,r=!1,n=this.resetTtl){let i;if(r||this.has(e)){if(i=this.items[e],i.value=t,!1===r&&n&&(i.expiry=this.ttl>0?Date.now()+this.ttl:this.ttl),this.last!==i){const e=this.last,t=i.next,r=i.prev;this.first===i&&(this.first=i.next),i.next=null,i.prev=this.last,e.next=i,null!==r&&(r.next=t),null!==t&&(t.prev=r)}}else this.max>0&&this.size===this.max&&this.evict(!0),i=this.items[e]={expiry:this.ttl>0?Date.now()+this.ttl:this.ttl,key:e,prev:this.last,next:null,value:t},1==++this.size?this.first=i:this.last.next=i;return this.last=i,this}values(e=this.keys()){return e.map((e=>this.get(e)))}}function lru(e=1e3,t=0,r=!1){if(isNaN(e)||e<0)throw new TypeError("Invalid max value");if(isNaN(t)||t<0)throw new TypeError("Invalid ttl value");if("boolean"!=typeof r)throw new TypeError("Invalid resetTtl value");return new LRU(e,t,r)}const defaultLRUOptions={max:1e3},memorise=(e,t={})=>{const{cache:r,cacheKeyResolver:n=defaultGenCacheKey,onHit:i,lruOptions:o={}}=t,a={...defaultLRUOptions,...o},s=r||lru(a.max,a.ttl);function c(...t){const r=n(...t),o=s.get(r);if(s.has(r))return i&&i(r,o,s),o;const a=e.apply(this,t);return s.set(r,a),a}return c._cache=s,c},defaultGenCacheKey=(...e)=>0===e.length?"no-args":e.map((e=>void 0===e?"undefined":null===e?"null":Array.isArray(e)?`[${defaultGenCacheKey(...e)}]`:"object"==typeof e?`{${defaultGenCacheKey(...sortedObjectEntries(e))}}`:JSON.stringify(e))).join(","),sortedObjectEntries=e=>Object.entries(e).sort(((e,t)=>e[0]<t[0]?-1:1));var commonjsGlobal$1="undefined"!=typeof globalThis?globalThis:"undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:{};function getDefaultExportFromCjs$2(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}function getAugmentedNamespace(e){if(e.__esModule)return e;var t=e.default;if("function"==typeof t){var r=function e(){return this instanceof e?Reflect.construct(t,arguments,this.constructor):t.apply(this,arguments)};r.prototype=t.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(e).forEach((function(t){var n=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,n.get?n:{enumerable:!0,get:function(){return e[t]}})})),r}var lib$N={};Object.defineProperty(lib$N,"__esModule",{value:!0}),lib$N.clearGlobalNamespace=getGlobalisedValue_1=lib$N.getGlobalisedValue=void 0;const GLOBALISE_KEY_PREFIX="globalise__singleton__",fallbackGlobal={},getGlobalObject=()=>"undefined"!=typeof window?window:"undefined"!=typeof globalThis?globalThis:fallbackGlobal,validateInputs=(e,t)=>{if("string"!=typeof e)throw"Invalid namespace key";if("string"!=typeof t)throw"Invalid item key"},createGlobalisedKey=e=>`${GLOBALISE_KEY_PREFIX}${e}`,getGlobalScopedObject=e=>{const t=getGlobalObject(),r=createGlobalisedKey(e);return t[r]||(t[r]={}),t[r]},getSingleton=(e,t)=>getGlobalScopedObject(e)[t]||void 0,setSingleton=(e,t,r)=>{getGlobalScopedObject(e)[t]=r},getGlobalisedValue=(e,t,r)=>{validateInputs(e,t);const n=getSingleton(e,t);return void 0!==n?n:(setSingleton(e,t,r),r)};var getGlobalisedValue_1=lib$N.getGlobalisedValue=getGlobalisedValue;const clearGlobalNamespace=e=>{const t=getGlobalObject(),r=createGlobalisedKey(e);void 0!==t[r]&&delete t[r]};lib$N.clearGlobalNamespace=clearGlobalNamespace;var Ut$3=Object.defineProperty,St$2=(e,t)=>{for(var r in t)Ut$3(e,r,{get:t[r],enumerable:!0})};function Br$2(e){throw new Error("Node.js process "+e+" is not supported by JSPM core outside of Node.js")}var G$8=[],tr$3=!1,W$7,cr$7=-1;function kt$3(){!tr$3||!W$7||(tr$3=!1,W$7.length?G$8=W$7.concat(G$8):cr$7=-1,G$8.length&&Vr$2())}function Vr$2(){if(!tr$3){var e=setTimeout(kt$3,0);tr$3=!0;for(var t=G$8.length;t;){for(W$7=G$8,G$8=[];++cr$7<t;)W$7&&W$7[cr$7].run();cr$7=-1,t=G$8.length}W$7=null,tr$3=!1,clearTimeout(e)}}function _t$3(e){var t=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)t[r-1]=arguments[r];G$8.push(new Gr$2(e,t)),1===G$8.length&&!tr$3&&setTimeout(Vr$2,0)}function Gr$2(e,t){this.fun=e,this.array=t}Gr$2.prototype.run=function(){this.fun.apply(null,this.array)};var Pt$3="browser",Rt$3="x64",bt$3="browser",Nt$3={PATH:"/usr/bin",LANG:navigator.language+".UTF-8",PWD:"/",HOME:"/home",TMP:"/tmp"},vt$2=["/usr/bin/node"],Mt$2=[],Ct$4="v16.8.0",Lt$4={},Dt$3=function(e,t){console.warn((t?t+": ":"")+e)},$t$4=function(e){Br$2("binding")},Ft$3=function(e){return 0},Ot$5=function(){return"/"},Vt$3=function(e){},Gt$4={name:"node",sourceUrl:"",headersUrl:"",libUrl:""};function N$7(){}var Yt$4=N$7,Kt$5=[];function Ht$4(e){Br$2("_linkedBinding")}var Wt$4={},jt$3=!1,Xt$6={};function qt$5(e){Br$2("dlopen")}function Jt$6(){return[]}function zt$4(){return[]}var Qt$3=N$7,Zt$4=N$7,Tr$3=function(){return{}},re$a=Tr$3,te$7=Tr$3,ee$6=N$7,ne$7=N$7,ie$8=N$7,oe$8={};function se$7(e,t){if(!e)throw new Error(t||"assertion error")}var ue$5={inspector:!1,debug:!1,uv:!1,ipv6:!1,tls_alpn:!1,tls_sni:!1,tls_ocsp:!1,tls:!1,cached_builtins:!0},ae$6=N$7,ce$5=N$7;function pe$5(){return!1}var le$6=N$7,fe$6=N$7,he$5=N$7,de$8=N$7,me$7=N$7,we$6=void 0,ge$7=void 0,ye$7=void 0,Ee$6=N$7,Ie$4=2,Be$7=1,Te$3="/bin/usr/node",Ae$6=9229,xe$6="node",Ue$8=[],Se$5=N$7,K$b={now:typeof performance<"u"?performance.now.bind(performance):void 0,timing:typeof performance<"u"?performance.timing:void 0},yr$4;function ke$8(){return K$b.now()/1e3}void 0===K$b.now&&(yr$4=Date.now(),K$b.timing&&K$b.timing.navigationStart&&(yr$4=K$b.timing.navigationStart),K$b.now=()=>Date.now()-yr$4);var Er$3=1e9;function Ir$3(e){var t=Math.floor(.001*(Date.now()-K$b.now())),r=.001*K$b.now(),n=Math.floor(r)+t,i=Math.floor(r%1*1e9);return e&&(n-=e[0],(i-=e[1])<0&&(n--,i+=Er$3)),[n,i]}Ir$3.bigint=function(e){var t=Ir$3(e);return typeof BigInt>"u"?t[0]*Er$3+t[1]:BigInt(t[0]*Er$3)+BigInt(t[1])};var _e$6=10,Pe$7={},Re$8=0;function H$8(){return A$6}var be$6=H$8,Ne$4=H$8,ve$7=H$8,Me$4=H$8,Ce$7=H$8,Le$6=N$7,De$7=H$8,$e$7=H$8;function Fe$6(e){return[]}var A$6={version:Ct$4,versions:Lt$4,arch:Rt$3,platform:bt$3,release:Gt$4,_rawDebug:Yt$4,moduleLoadList:Kt$5,binding:$t$4,_linkedBinding:Ht$4,_events:Pe$7,_eventsCount:Re$8,_maxListeners:_e$6,on:H$8,addListener:be$6,once:Ne$4,off:ve$7,removeListener:Me$4,removeAllListeners:Ce$7,emit:Le$6,prependListener:De$7,prependOnceListener:$e$7,listeners:Fe$6,domain:Wt$4,_exiting:jt$3,config:Xt$6,dlopen:qt$5,uptime:ke$8,_getActiveRequests:Jt$6,_getActiveHandles:zt$4,reallyExit:Qt$3,_kill:Zt$4,cpuUsage:Tr$3,resourceUsage:re$a,memoryUsage:te$7,kill:ee$6,exit:ne$7,openStdin:ie$8,allowedNodeEnvironmentFlags:oe$8,assert:se$7,features:ue$5,_fatalExceptions:ae$6,setUncaughtExceptionCaptureCallback:ce$5,hasUncaughtExceptionCaptureCallback:pe$5,emitWarning:Dt$3,nextTick:_t$3,_tickCallback:le$6,_debugProcess:fe$6,_debugEnd:he$5,_startProfilerIdleNotifier:de$8,_stopProfilerIdleNotifier:me$7,stdout:we$6,stdin:ye$7,stderr:ge$7,abort:Ee$6,umask:Ft$3,chdir:Vt$3,cwd:Ot$5,env:Nt$3,title:Pt$3,argv:vt$2,execArgv:Mt$2,pid:Ie$4,ppid:Be$7,execPath:Te$3,debugPort:Ae$6,hrtime:Ir$3,argv0:xe$6,_preload_modules:Ue$8,setSourceMapsEnabled:Se$5},nr$5={},Yr$1=!1;function Oe$5(){if(Yr$1)return nr$5;Yr$1=!0,nr$5.byteLength=function(e){var t=o(e),r=t[0],n=t[1];return 3*(r+n)/4-n},nr$5.toByteArray=function(e){var n,i,a=o(e),s=a[0],c=a[1],l=new r(function(e,t,r){return 3*(t+r)/4-r}(0,s,c)),u=0,d=c>0?s-4:s;for(i=0;i<d;i+=4)n=t[e.charCodeAt(i)]<<18|t[e.charCodeAt(i+1)]<<12|t[e.charCodeAt(i+2)]<<6|t[e.charCodeAt(i+3)],l[u++]=n>>16&255,l[u++]=n>>8&255,l[u++]=255&n;return 2===c&&(n=t[e.charCodeAt(i)]<<2|t[e.charCodeAt(i+1)]>>4,l[u++]=255&n),1===c&&(n=t[e.charCodeAt(i)]<<10|t[e.charCodeAt(i+1)]<<4|t[e.charCodeAt(i+2)]>>2,l[u++]=n>>8&255,l[u++]=255&n),l},nr$5.fromByteArray=function(t){for(var r,n=t.length,i=n%3,o=[],a=16383,c=0,l=n-i;c<l;c+=a)o.push(s(t,c,c+a>l?l:c+a));return 1===i?(r=t[n-1],o.push(e[r>>2]+e[r<<4&63]+"==")):2===i&&(r=(t[n-2]<<8)+t[n-1],o.push(e[r>>10]+e[r>>4&63]+e[r<<2&63]+"=")),o.join("")};for(var e=[],t=[],r=typeof Uint8Array<"u"?Uint8Array:Array,n="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",i=0;i<64;++i)e[i]=n[i],t[n.charCodeAt(i)]=i;function o(e){var t=e.length;if(t%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");return-1===r&&(r=t),[r,r===t?0:4-r%4]}function a(t){return e[t>>18&63]+e[t>>12&63]+e[t>>6&63]+e[63&t]}function s(e,t,r){for(var n,i=[],o=t;o<r;o+=3)n=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(255&e[o+2]),i.push(a(n));return i.join("")}return t[45]=62,t[95]=63,nr$5}var pr$4={},Kr$3=!1;function Ve$5(){return Kr$3||(Kr$3=!0,pr$4.read=function(e,t,r,n,i){var o,a,s=8*i-n-1,c=(1<<s)-1,l=c>>1,u=-7,d=r?i-1:0,p=r?-1:1,f=e[t+d];for(d+=p,o=f&(1<<-u)-1,f>>=-u,u+=s;u>0;o=256*o+e[t+d],d+=p,u-=8);for(a=o&(1<<-u)-1,o>>=-u,u+=n;u>0;a=256*a+e[t+d],d+=p,u-=8);if(0===o)o=1-l;else{if(o===c)return a?NaN:1/0*(f?-1:1);a+=Math.pow(2,n),o-=l}return(f?-1:1)*a*Math.pow(2,o-n)},pr$4.write=function(e,t,r,n,i,o){var a,s,c,l=8*o-i-1,u=(1<<l)-1,d=u>>1,p=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,f=n?0:o-1,h=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,a=u):(a=Math.floor(Math.log(t)/Math.LN2),t*(c=Math.pow(2,-a))<1&&(a--,c*=2),(t+=a+d>=1?p/c:p*Math.pow(2,1-d))*c>=2&&(a++,c/=2),a+d>=u?(s=0,a=u):a+d>=1?(s=(t*c-1)*Math.pow(2,i),a+=d):(s=t*Math.pow(2,d-1)*Math.pow(2,i),a=0));i>=8;e[r+f]=255&s,f+=h,s/=256,i-=8);for(a=a<<i|s,l+=i;l>0;e[r+f]=255&a,f+=h,a/=256,l-=8);e[r+f-h]|=128*g}),pr$4}var j$9={},Hr$2=!1;function Ge$7(){if(Hr$2)return j$9;Hr$2=!0;let e=Oe$5(),t=Ve$5(),r="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;j$9.Buffer=o,j$9.SlowBuffer=function(e){return+e!=e&&(e=0),o.alloc(+e)},j$9.INSPECT_MAX_BYTES=50;let n=2147483647;function i(e){if(e>n)throw new RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,o.prototype),t}function o(e,t,r){if("number"==typeof e){if("string"==typeof t)throw new TypeError('The "string" argument must be of type string. Received type number');return c(e)}return a(e,t,r)}function a(e,t,r){if("string"==typeof e)return function(e,t){if(("string"!=typeof t||""===t)&&(t="utf8"),!o.isEncoding(t))throw new TypeError("Unknown encoding: "+t);let r=0|p(e,t),n=i(r),a=n.write(e,t);return a!==r&&(n=n.slice(0,a)),n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(V(e,Uint8Array)){let t=new Uint8Array(e);return u(t.buffer,t.byteOffset,t.byteLength)}return l(e)}(e);if(null==e)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(V(e,ArrayBuffer)||e&&V(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(V(e,SharedArrayBuffer)||e&&V(e.buffer,SharedArrayBuffer)))return u(e,t,r);if("number"==typeof e)throw new TypeError('The "value" argument must not be of type number. Received type number');let n=e.valueOf&&e.valueOf();if(null!=n&&n!==e)return o.from(n,t,r);let a=function(e){if(o.isBuffer(e)){let t=0|d(e.length),r=i(t);return 0===r.length||e.copy(r,0,0,t),r}if(void 0!==e.length)return"number"!=typeof e.length||z(e.length)?i(0):l(e);if("Buffer"===e.type&&Array.isArray(e.data))return l(e.data)}(e);if(a)return a;if(typeof Symbol<"u"&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return o.from(e[Symbol.toPrimitive]("string"),t,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function s(e){if("number"!=typeof e)throw new TypeError('"size" argument must be of type number');if(e<0)throw new RangeError('The value "'+e+'" is invalid for option "size"')}function c(e){return s(e),i(e<0?0:0|d(e))}function l(e){let t=e.length<0?0:0|d(e.length),r=i(t);for(let n=0;n<t;n+=1)r[n]=255&e[n];return r}function u(e,t,r){if(t<0||e.byteLength<t)throw new RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),Object.setPrototypeOf(n,o.prototype),n}function d(e){if(e>=n)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+n.toString(16)+" bytes");return 0|e}function p(e,t){if(o.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||V(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof e);let r=e.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(t){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return H(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return G(e).length;default:if(i)return n?-1:H(e).length;t=(""+t).toLowerCase(),i=!0}}function f(e,t,r){let n=!1;if((void 0===t||t<0)&&(t=0),t>this.length||((void 0===r||r>this.length)&&(r=this.length),r<=0)||(r>>>=0)<=(t>>>=0))return"";for(e||(e="utf8");;)switch(e){case"hex":return x(this,t,r);case"utf8":case"utf-8":return C(this,t,r);case"ascii":return w(this,t,r);case"latin1":case"binary":return S(this,t,r);case"base64":return _(this,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(this,t,r);default:if(n)throw new TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),n=!0}}function h(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}function g(e,t,r,n,i){if(0===e.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),z(r=+r)&&(r=i?0:e.length-1),r<0&&(r=e.length+r),r>=e.length){if(i)return-1;r=e.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof t&&(t=o.from(t,n)),o.isBuffer(t))return 0===t.length?-1:A(e,t,r,n,i);if("number"==typeof t)return t&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(e,t,r):Uint8Array.prototype.lastIndexOf.call(e,t,r):A(e,[t],r,n,i);throw new TypeError("val must be string, number or Buffer")}function A(e,t,r,n,i){let o,a=1,s=e.length,c=t.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(e.length<2||t.length<2)return-1;a=2,s/=2,c/=2,r/=2}function l(e,t){return 1===a?e[t]:e.readUInt16BE(t*a)}if(i){let n=-1;for(o=r;o<s;o++)if(l(e,o)===l(t,-1===n?0:o-n)){if(-1===n&&(n=o),o-n+1===c)return n*a}else-1!==n&&(o-=o-n),n=-1}else for(r+c>s&&(r=s-c),o=r;o>=0;o--){let r=!0;for(let n=0;n<c;n++)if(l(e,o+n)!==l(t,n)){r=!1;break}if(r)return o}return-1}function m(e,t,r,n){r=Number(r)||0;let i=e.length-r;n?(n=Number(n))>i&&(n=i):n=i;let o,a=t.length;for(n>a/2&&(n=a/2),o=0;o<n;++o){let n=parseInt(t.substr(2*o,2),16);if(z(n))return o;e[r+o]=n}return o}function y(e,t,r,n){return q(H(t,e.length-r),e,r,n)}function b(e,t,r,n){return q(function(e){let t=[];for(let r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(t),e,r,n)}function v(e,t,r,n){return q(G(t),e,r,n)}function I(e,t,r,n){return q(function(e,t){let r,n,i,o=[];for(let a=0;a<e.length&&!((t-=2)<0);++a)r=e.charCodeAt(a),n=r>>8,i=r%256,o.push(i),o.push(n);return o}(t,e.length-r),e,r,n)}function _(t,r,n){return 0===r&&n===t.length?e.fromByteArray(t):e.fromByteArray(t.slice(r,n))}function C(e,t,r){r=Math.min(e.length,r);let n=[],i=t;for(;i<r;){let t=e[i],o=null,a=t>239?4:t>223?3:t>191?2:1;if(i+a<=r){let r,n,s,c;switch(a){case 1:t<128&&(o=t);break;case 2:r=e[i+1],128==(192&r)&&(c=(31&t)<<6|63&r,c>127&&(o=c));break;case 3:r=e[i+1],n=e[i+2],128==(192&r)&&128==(192&n)&&(c=(15&t)<<12|(63&r)<<6|63&n,c>2047&&(c<55296||c>57343)&&(o=c));break;case 4:r=e[i+1],n=e[i+2],s=e[i+3],128==(192&r)&&128==(192&n)&&128==(192&s)&&(c=(15&t)<<18|(63&r)<<12|(63&n)<<6|63&s,c>65535&&c<1114112&&(o=c))}}null===o?(o=65533,a=1):o>65535&&(o-=65536,n.push(o>>>10&1023|55296),o=56320|1023&o),n.push(o),i+=a}return function(e){let t=e.length;if(t<=E)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=E));return r}(n)}j$9.kMaxLength=n,o.TYPED_ARRAY_SUPPORT=function(){try{let e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),42===e.foo()}catch{return!1}}(),!o.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&"function"==typeof console.error&&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."),Object.defineProperty(o.prototype,"parent",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.buffer}}),Object.defineProperty(o.prototype,"offset",{enumerable:!0,get:function(){if(o.isBuffer(this))return this.byteOffset}}),o.poolSize=8192,o.from=function(e,t,r){return a(e,t,r)},Object.setPrototypeOf(o.prototype,Uint8Array.prototype),Object.setPrototypeOf(o,Uint8Array),o.alloc=function(e,t,r){return function(e,t,r){return s(e),e<=0?i(e):void 0!==t?"string"==typeof r?i(e).fill(t,r):i(e).fill(t):i(e)}(e,t,r)},o.allocUnsafe=function(e){return c(e)},o.allocUnsafeSlow=function(e){return c(e)},o.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==o.prototype},o.compare=function(e,t){if(V(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),V(t,Uint8Array)&&(t=o.from(t,t.offset,t.byteLength)),!o.isBuffer(e)||!o.isBuffer(t))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(e===t)return 0;let r=e.length,n=t.length;for(let i=0,o=Math.min(r,n);i<o;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},o.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}},o.concat=function(e,t){if(!Array.isArray(e))throw new TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return o.alloc(0);let r;if(void 0===t)for(t=0,r=0;r<e.length;++r)t+=e[r].length;let n=o.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){let t=e[r];if(V(t,Uint8Array))i+t.length>n.length?(o.isBuffer(t)||(t=o.from(t)),t.copy(n,i)):Uint8Array.prototype.set.call(n,t,i);else{if(!o.isBuffer(t))throw new TypeError('"list" argument must be an Array of Buffers');t.copy(n,i)}i+=t.length}return n},o.byteLength=p,o.prototype._isBuffer=!0,o.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 t=0;t<e;t+=2)h(this,t,t+1);return this},o.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 t=0;t<e;t+=4)h(this,t,t+3),h(this,t+1,t+2);return this},o.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 t=0;t<e;t+=8)h(this,t,t+7),h(this,t+1,t+6),h(this,t+2,t+5),h(this,t+3,t+4);return this},o.prototype.toString=function(){let e=this.length;return 0===e?"":0===arguments.length?C(this,0,e):f.apply(this,arguments)},o.prototype.toLocaleString=o.prototype.toString,o.prototype.equals=function(e){if(!o.isBuffer(e))throw new TypeError("Argument must be a Buffer");return this===e||0===o.compare(this,e)},o.prototype.inspect=function(){let e="",t=j$9.INSPECT_MAX_BYTES;return e=this.toString("hex",0,t).replace(/(.{2})/g,"$1 ").trim(),this.length>t&&(e+=" ... "),"<Buffer "+e+">"},r&&(o.prototype[r]=o.prototype.inspect),o.prototype.compare=function(e,t,r,n,i){if(V(e,Uint8Array)&&(e=o.from(e,e.offset,e.byteLength)),!o.isBuffer(e))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof e);if(void 0===t&&(t=0),void 0===r&&(r=e?e.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),t<0||r>e.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return-1;if(t>=r)return 1;if(this===e)return 0;let a=(i>>>=0)-(n>>>=0),s=(r>>>=0)-(t>>>=0),c=Math.min(a,s),l=this.slice(n,i),u=e.slice(t,r);for(let e=0;e<c;++e)if(l[e]!==u[e]){a=l[e],s=u[e];break}return a<s?-1:s<a?1:0},o.prototype.includes=function(e,t,r){return-1!==this.indexOf(e,t,r)},o.prototype.indexOf=function(e,t,r){return g(this,e,t,r,!0)},o.prototype.lastIndexOf=function(e,t,r){return g(this,e,t,r,!1)},o.prototype.write=function(e,t,r,n){if(void 0===t)n="utf8",r=this.length,t=0;else if(void 0===r&&"string"==typeof t)n=t,r=this.length,t=0;else{if(!isFinite(t))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}let i=this.length-t;if((void 0===r||r>i)&&(r=i),e.length>0&&(r<0||t<0)||t>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let o=!1;for(;;)switch(n){case"hex":return m(this,e,t,r);case"utf8":case"utf-8":return y(this,e,t,r);case"ascii":case"latin1":case"binary":return b(this,e,t,r);case"base64":return v(this,e,t,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,t,r);default:if(o)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),o=!0}},o.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};let E=4096;function w(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(127&e[i]);return n}function S(e,t,r){let n="";r=Math.min(e.length,r);for(let i=t;i<r;++i)n+=String.fromCharCode(e[i]);return n}function x(e,t,r){let n=e.length;(!t||t<0)&&(t=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=t;n<r;++n)i+=K[e[n]];return i}function T(e,t,r){let n=e.slice(t,r),i="";for(let e=0;e<n.length-1;e+=2)i+=String.fromCharCode(n[e]+256*n[e+1]);return i}function B(e,t,r){if(e%1!=0||e<0)throw new RangeError("offset is not uint");if(e+t>r)throw new RangeError("Trying to access beyond buffer length")}function $(e,t,r,n,i,a){if(!o.isBuffer(e))throw new TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<a)throw new RangeError('"value" argument is out of bounds');if(r+n>e.length)throw new RangeError("Index out of range")}function k(e,t,r,n,i){F(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=a,a>>=8,e[r++]=a,a>>=8,e[r++]=a,a>>=8,e[r++]=a,r}function P(e,t,r,n,i){F(t,n,i,e,r,7);let o=Number(t&BigInt(4294967295));e[r+7]=o,o>>=8,e[r+6]=o,o>>=8,e[r+5]=o,o>>=8,e[r+4]=o;let a=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=a,a>>=8,e[r+2]=a,a>>=8,e[r+1]=a,a>>=8,e[r]=a,r+8}function O(e,t,r,n,i,o){if(r+n>e.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function R(e,r,n,i,o){return r=+r,n>>>=0,o||O(e,0,n,4),t.write(e,r,n,i,23,4),n+4}function D(e,r,n,i,o){return r=+r,n>>>=0,o||O(e,0,n,8),t.write(e,r,n,i,52,8),n+8}o.prototype.slice=function(e,t){let r=this.length;(e=~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),(t=void 0===t?r:~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),t<e&&(t=e);let n=this.subarray(e,t);return Object.setPrototypeOf(n,o.prototype),n},o.prototype.readUintLE=o.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||B(e,t,this.length);let n=this[e],i=1,o=0;for(;++o<t&&(i*=256);)n+=this[e+o]*i;return n},o.prototype.readUintBE=o.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||B(e,t,this.length);let n=this[e+--t],i=1;for(;t>0&&(i*=256);)n+=this[e+--t]*i;return n},o.prototype.readUint8=o.prototype.readUInt8=function(e,t){return e>>>=0,t||B(e,1,this.length),this[e]},o.prototype.readUint16LE=o.prototype.readUInt16LE=function(e,t){return e>>>=0,t||B(e,2,this.length),this[e]|this[e+1]<<8},o.prototype.readUint16BE=o.prototype.readUInt16BE=function(e,t){return e>>>=0,t||B(e,2,this.length),this[e]<<8|this[e+1]},o.prototype.readUint32LE=o.prototype.readUInt32LE=function(e,t){return e>>>=0,t||B(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},o.prototype.readUint32BE=o.prototype.readUInt32BE=function(e,t){return e>>>=0,t||B(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},o.prototype.readBigUInt64LE=W((function(e){L(e>>>=0,"offset");let t=this[e],r=this[e+7];(void 0===t||void 0===r)&&U(e,this.length-8);let n=t+256*this[++e]+65536*this[++e]+this[++e]*2**24,i=this[++e]+256*this[++e]+65536*this[++e]+r*2**24;return BigInt(n)+(BigInt(i)<<BigInt(32))})),o.prototype.readBigUInt64BE=W((function(e){L(e>>>=0,"offset");let t=this[e],r=this[e+7];(void 0===t||void 0===r)&&U(e,this.length-8);let n=t*2**24+65536*this[++e]+256*this[++e]+this[++e],i=this[++e]*2**24+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<<BigInt(32))+BigInt(i)})),o.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||B(e,t,this.length);let n=this[e],i=1,o=0;for(;++o<t&&(i*=256);)n+=this[e+o]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*t)),n},o.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||B(e,t,this.length);let n=t,i=1,o=this[e+--n];for(;n>0&&(i*=256);)o+=this[e+--n]*i;return i*=128,o>=i&&(o-=Math.pow(2,8*t)),o},o.prototype.readInt8=function(e,t){return e>>>=0,t||B(e,1,this.length),128&this[e]?-1*(255-this[e]+1):this[e]},o.prototype.readInt16LE=function(e,t){e>>>=0,t||B(e,2,this.length);let r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt16BE=function(e,t){e>>>=0,t||B(e,2,this.length);let r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},o.prototype.readInt32LE=function(e,t){return e>>>=0,t||B(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},o.prototype.readInt32BE=function(e,t){return e>>>=0,t||B(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},o.prototype.readBigInt64LE=W((function(e){L(e>>>=0,"offset");let t=this[e],r=this[e+7];(void 0===t||void 0===r)&&U(e,this.length-8);let n=this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+this[++e]*2**24)})),o.prototype.readBigInt64BE=W((function(e){L(e>>>=0,"offset");let t=this[e],r=this[e+7];(void 0===t||void 0===r)&&U(e,this.length-8);let n=(t<<24)+65536*this[++e]+256*this[++e]+this[++e];return(BigInt(n)<<BigInt(32))+BigInt(this[++e]*2**24+65536*this[++e]+256*this[++e]+r)})),o.prototype.readFloatLE=function(e,r){return e>>>=0,r||B(e,4,this.length),t.read(this,e,!0,23,4)},o.prototype.readFloatBE=function(e,r){return e>>>=0,r||B(e,4,this.length),t.read(this,e,!1,23,4)},o.prototype.readDoubleLE=function(e,r){return e>>>=0,r||B(e,8,this.length),t.read(this,e,!0,52,8)},o.prototype.readDoubleBE=function(e,r){return e>>>=0,r||B(e,8,this.length),t.read(this,e,!1,52,8)},o.prototype.writeUintLE=o.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){$(this,e,t,r,Math.pow(2,8*r)-1,0)}let i=1,o=0;for(this[t]=255&e;++o<r&&(i*=256);)this[t+o]=e/i&255;return t+r},o.prototype.writeUintBE=o.prototype.writeUIntBE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){$(this,e,t,r,Math.pow(2,8*r)-1,0)}let i=r-1,o=1;for(this[t+i]=255&e;--i>=0&&(o*=256);)this[t+i]=e/o&255;return t+r},o.prototype.writeUint8=o.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,1,255,0),this[t]=255&e,t+1},o.prototype.writeUint16LE=o.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeUint16BE=o.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeUint32LE=o.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=255&e,t+4},o.prototype.writeUint32BE=o.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeBigUInt64LE=W((function(e,t=0){return k(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),o.prototype.writeBigUInt64BE=W((function(e,t=0){return P(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))})),o.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){let n=Math.pow(2,8*r-1);$(this,e,t,r,n-1,-n)}let i=0,o=1,a=0;for(this[t]=255&e;++i<r&&(o*=256);)e<0&&0===a&&0!==this[t+i-1]&&(a=1),this[t+i]=(e/o|0)-a&255;return t+r},o.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){let n=Math.pow(2,8*r-1);$(this,e,t,r,n-1,-n)}let i=r-1,o=1,a=0;for(this[t+i]=255&e;--i>=0&&(o*=256);)e<0&&0===a&&0!==this[t+i+1]&&(a=1),this[t+i]=(e/o|0)-a&255;return t+r},o.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},o.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},o.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},o.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,4,2147483647,-2147483648),this[t]=255&e,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},o.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||$(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=255&e,t+4},o.prototype.writeBigInt64LE=W((function(e,t=0){return k(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),o.prototype.writeBigInt64BE=W((function(e,t=0){return P(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),o.prototype.writeFloatLE=function(e,t,r){return R(this,e,t,!0,r)},o.prototype.writeFloatBE=function(e,t,r){return R(this,e,t,!1,r)},o.prototype.writeDoubleLE=function(e,t,r){return D(this,e,t,!0,r)},o.prototype.writeDoubleBE=function(e,t,r){return D(this,e,t,!1,r)},o.prototype.copy=function(e,t,r,n){if(!o.isBuffer(e))throw new TypeError("argument should be a Buffer");if(r||(r=0),!n&&0!==n&&(n=this.length),t>=e.length&&(t=e.length),t||(t=0),n>0&&n<r&&(n=r),n===r||0===e.length||0===this.length)return 0;if(t<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),e.length-t<n-r&&(n=e.length-t+r);let i=n-r;return this===e&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(t,r,n):Uint8Array.prototype.set.call(e,this.subarray(r,n),t),i},o.prototype.fill=function(e,t,r,n){if("string"==typeof e){if("string"==typeof t?(n=t,t=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!o.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===e.length){let t=e.charCodeAt(0);("utf8"===n&&t<128||"latin1"===n)&&(e=t)}}else"number"==typeof e?e&=255:"boolean"==typeof e&&(e=Number(e));if(t<0||this.length<t||this.length<r)throw new RangeError("Out of range index");if(r<=t)return this;let i;if(t>>>=0,r=void 0===r?this.length:r>>>0,e||(e=0),"number"==typeof e)for(i=t;i<r;++i)this[i]=e;else{let a=o.isBuffer(e)?e:o.from(e,n),s=a.length;if(0===s)throw new TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=a[i%s]}return this};let N={};function M(e,t,r){N[e]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:t.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${e}]`,this.stack,delete this.name}get code(){return e}set code(e){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:e,writable:!0})}toString(){return`${this.name} [${e}]: ${this.message}`}}}function j(e){let t="",r=e.length,n="-"===e[0]?1:0;for(;r>=n+4;r-=3)t=`_${e.slice(r-3,r)}${t}`;return`${e.slice(0,r)}${t}`}function F(e,t,r,n,i,o){if(e>r||e<t){let r,n="bigint"==typeof t?"n":"";throw r=0===t||t===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(o+1)}${n}`:`>= -(2${n} ** ${8*(o+1)-1}${n}) and < 2 ** ${8*(o+1)-1}${n}`,new N.ERR_OUT_OF_RANGE("value",r,e)}!function(e,t,r){L(t,"offset"),(void 0===e[t]||void 0===e[t+r])&&U(t,e.length-(r+1))}(n,i,o)}function L(e,t){if("number"!=typeof e)throw new N.ERR_INVALID_ARG_TYPE(t,"number",e)}function U(e,t,r){throw Math.floor(e)!==e?(L(e,r),new N.ERR_OUT_OF_RANGE("offset","an integer",e)):t<0?new N.ERR_BUFFER_OUT_OF_BOUNDS:new N.ERR_OUT_OF_RANGE("offset",`>= 0 and <= ${t}`,e)}M("ERR_BUFFER_OUT_OF_BOUNDS",(function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),M("ERR_INVALID_ARG_TYPE",(function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`}),TypeError),M("ERR_OUT_OF_RANGE",(function(e,t,r){let n=`The value of "${e}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=j(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=j(i)),i+="n"),n+=` It must be ${t}. Received ${i}`,n}),RangeError);let Q=/[^+/0-9A-Za-z-_]/g;function H(e,t){t=t||1/0;let r,n=e.length,i=null,o=[];for(let a=0;a<n;++a){if(r=e.charCodeAt(a),r>55295&&r<57344){if(!i){if(r>56319){(t-=3)>-1&&o.push(239,191,189);continue}if(a+1===n){(t-=3)>-1&&o.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&o.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(t-=3)>-1&&o.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;o.push(r)}else if(r<2048){if((t-=2)<0)break;o.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;o.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((t-=4)<0)break;o.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return o}function G(t){return e.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(Q,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(t))}function q(e,t,r,n){let i;for(i=0;i<n&&!(i+r>=t.length||i>=e.length);++i)t[i+r]=e[i];return i}function V(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}function z(e){return e!=e}let K=function(){let e="0123456789abcdef",t=new Array(256);for(let r=0;r<16;++r){let n=16*r;for(let i=0;i<16;++i)t[n+i]=e[r]+e[i]}return t}();function W(e){return typeof BigInt>"u"?J:e}function J(){throw new Error("BigInt not supported")}return j$9}var X$7=Ge$7();X$7.Buffer,X$7.SlowBuffer,X$7.INSPECT_MAX_BYTES,X$7.kMaxLength;var k$8=X$7.Buffer;X$7.INSPECT_MAX_BYTES,X$7.kMaxLength;var Ur$3={};St$2(Ur$3,{deleteItem:()=>We$8,getItem:()=>fr$3,setItem:()=>or$5});var ir$5=()=>typeof window>"u",lr$4=()=>!ir$5(),Ye$7="__IMX-",Ar$4=()=>lr$4()&&window.localStorage,Ke$4=e=>{if(null!==e)try{return JSON.parse(e)}catch{return e}},He$6=e=>"string"==typeof e?e:JSON.stringify(e),xr$4=e=>`${Ye$7}${e}`;function fr$3(e){if(Ar$4())return Ke$4(window.localStorage.getItem(xr$4(e)))}var or$5=(e,t)=>!!Ar$4()&&(window.localStorage.setItem(xr$4(e),He$6(t)),!0),We$8=e=>!!Ar$4()&&(window.localStorage.removeItem(xr$4(e)),!0),Sr$3=0,Wr$1=e=>{let t=1e3*parseInt(e,10),r=new Date(t),n=new Date;return Sr$3=r.getTime()-n.getTime()},jr$3=()=>{let e=(new Date).getTime()+Sr$3;return new Date(e).toISOString()},sr$5=(e=>(e.RUNTIME_ID="rid",e.PASSPORT_CLIENT_ID="passportClientId",e.ENVIRONMENT="env",e.PUBLISHABLE_API_KEY="pak",e.IDENTITY="uid",e.DOMAIN="domain",e.SDK_VERSION="sdkVersion",e))(sr$5||{}),Xe$6="https://api.immutable.com";async function hr$5(e,t){let r=axios$1.create({baseURL:Xe$6}),n=JSON.stringify(t),i={payload:k$8.from(n).toString("base64")};return(await r.post(e,i)).data}var q$b,J$6,qe$6=()=>{q$b=fr$3("metrics-events")||[],J$6=fr$3("metrics-runtime")||{}};qe$6();var V$b=(e,t)=>{J$6={...J$6,[e]:t},or$5("metrics-runtime",J$6)},ur$4=e=>{if(void 0!==J$6[e])return J$6[e]},Xr$1=()=>J$6,qr$2=()=>q$b,Jr$2=e=>{q$b.push(e),or$5("metrics-events",q$b)},zr$2=e=>{q$b=q$b.slice(e),or$5("metrics-events",q$b)},dr$5=e=>{let t=[];return Object.entries(e).forEach((([e,r])=>{("string"==typeof e||"string"==typeof r||"number"==typeof r||"boolean"==typeof r)&&t.push([e,r.toString()])})),t},kr$3="2.0.0-alpha.3",Je$5=()=>ir$5()?"":window.location.ancestorOrigins&&window.location.ancestorOrigins.length>0?new URL(window.location.ancestorOrigins[0]).hostname:document.referrer?new URL(window.document.referrer).hostname:"",ze$6=()=>{if(ir$5())return"";let e;try{window.self!==window.top&&(e=Je$5())}catch{}return e||(e=window.location.hostname),e},Qe$6=()=>{if(V$b("sdkVersion",kr$3),ir$5())return{browser:"nodejs",sdkVersion:kr$3};let e=ze$6();return e&&V$b("domain",e),{sdkVersion:kr$3,browser:window.navigator.userAgent,domain:e,tz:Intl.DateTimeFormat().resolvedOptions().timeZone,screen:`${window.screen.width}x${window.screen.height}`}},_r$3=!1,Qr$2=()=>_r$3,Zr$1=async()=>{_r$3=!0;try{let e=dr$5(Qe$6()),t=ur$4("rid"),r=ur$4("uid"),n=await hr$5("/v1/sdk/initialise",{version:1,data:{runtimeDetails:e,runtimeId:t,uId:r}}),{runtimeId:i,sTime:o}=n;V$b("rid",i),Wr$1(o)}catch{_r$3=!1}};function P$6(e,t){return(...r)=>{try{let n=e(...r);return n instanceof Promise?n.catch((()=>t)):n}catch{return t}}}function Ze$5(){return!(lr$4()||typeof A$6>"u")&&void 0!==A$6.env.JEST_WORKER_ID}var rt$5=P$6(Ze$5,!1),et$5="imtbl__metrics",tn$2=5e3,en$2=1e3,z$c=(e,t)=>getGlobalisedValue_1(et$5,e,t),nt$3=(e,t)=>{let r=memorise(t,{lruOptions:{ttl:tn$2,max:en$2}});return getGlobalisedValue_1(et$5,e,r)},nn$1=5e3,on$1=(e,t,r)=>{let n={event:`${e}.${t}`,time:jr$3(),...r&&{properties:dr$5(r)}};Jr$2(n)},Q$a=P$6(nt$3("track",on$1)),sn$1=async()=>{if(!1===Qr$2())return void await Zr$1();let e=qr$2();if(0===e.length)return;let t=e.length,r=Xr$1();await hr$5("/v1/sdk/metrics",{version:1,data:{events:e,details:r}})instanceof Error||zr$2(t)},un=P$6(sn$1),ot$4=async()=>{await un(),setTimeout(ot$4,nn$1)},it$3=!1,an$1=()=>{it$3||(it$3=!0,ot$4())};rt$5()||P$6(z$c("startFlushing",an$1))();var Pr$4=(e,t,r,n)=>Q$a(e,t,{...n||{},duration:Math.round(r)}),st$5=()=>{let e=()=>Math.floor(65536*(1+Math.random())).toString(16).substring(1);return`${e()}${e()}-${e()}-${e()}-${e()}-${e()}${e()}${e()}`},cn$1=(...e)=>{if(!e.some((e=>!!e)))return{};let t={};return e.forEach((e=>{e&&(t={...t,...e})})),t},pn$1=e=>e.replace(/[^a-zA-Z0-9\s\-_]/g,""),ln$1=(e,t)=>`${e}_${pn$1(t)}`,fn$1=(e,t,r)=>{let n=st$5(),i=Date.now(),o=0,a=0,s={},c=(...e)=>cn$1(s,...e,{flowId:n,flowName:t});s=c(r);let l=(r,n)=>{let i=ln$1(t,r),s=0,l=performance.now();o>0&&(s=l-a);let u=c(n,{flowEventName:r,flowStep:o});Pr$4(e,i,s,u),o++,a=l};return l("Start"),{details:{moduleName:e,flowName:t,flowId:n,flowStartTime:i},addEvent:P$6(l),addFlowProperties:P$6((e=>{e&&(s=c(e))}))}},hn=P$6(fn$1),dn$2=(e,t,r,n)=>{let{message:i}=r,o=r.stack||"",{cause:a}=r;a instanceof Error&&(o=`${o} \nCause: ${a.message}\n ${a.stack}`),Q$a(e,`trackError_${t}`,{...n||{},errorMessage:i,errorStack:o,isTrackError:!0})},mn$1=P$6(dn$2),En$1=e=>{V$b("env",e)},In$1=P$6(z$c("setEnvironment",En$1)),Bn=e=>{V$b("passportClientId",e)};P$6(z$c("setPassportClientId",Bn));var An=e=>{V$b("pak",e)};P$6(z$c("setPublishableApiKey",An)),P$6(z$c("getDetail",ur$4));var K$a=(e=>(e.PRODUCTION="production",e.SANDBOX="sandbox",e))(K$a||{}),u$6=(e=>(e.API_KEY="x-immutable-api-key",e.PUBLISHABLE_KEY="x-immutable-publishable-key",e.RATE_LIMITING_KEY="x-api-key",e))(u$6||{}),r$d=class{environment;rateLimitingKey;apiKey;publishableKey;constructor(e){this.environment=e.environment,this.publishableKey=e.publishableKey,this.apiKey=e.apiKey,this.rateLimitingKey=e.rateLimitingKey,In$1(e.environment),Q$a("config","created_imtbl_config")}};const version$9="6.13.4";function checkType(e,t,r){const n=t.split("|").map((e=>e.trim()));for(let r=0;r<n.length;r++)switch(t){case"any":return;case"bigint":case"boolean":case"number":case"string":if(typeof e===t)return}const i=new Error(`invalid value for type ${t}`);throw i.code="INVALID_ARGUMENT",i.argument=`value.${r}`,i.value=e,i}async function resolveProperties(e){const t=Object.keys(e),r=await Promise.all(t.map((t=>Promise.resolve(e[t]))));return r.reduce(((e,r,n)=>(e[t[n]]=r,e)),{})}function defineProperties$2(e,t,r){for(let n in t){let i=t[n];const o=r?r[n]:null;o&&checkType(i,o,n),Object.defineProperty(e,n,{enumerable:!0,value:i,writable:!1})}}function stringify$4(e){if(null==e)return"null";if(Array.isArray(e))return"[ "+e.map(stringify$4).join(", ")+" ]";if(e instanceof Uint8Array){const t="0123456789abcdef";let r="0x";for(let n=0;n<e.length;n++)r+=t[e[n]>>4],r+=t[15&e[n]];return r}if("object"==typeof e&&"function"==typeof e.toJSON)return stringify$4(e.toJSON());switch(typeof e){case"boolean":case"symbol":case"number":return e.toString();case"bigint":return BigInt(e).toString();case"string":return JSON.stringify(e);case"object":{const t=Object.keys(e);return t.sort(),"{ "+t.map((t=>`${stringify$4(t)}: ${stringify$4(e[t])}`)).join(", ")+" }"}}return"[ COULD NOT SERIALIZE ]"}function isError$1(e,t){return e&&e.code===t}function isCallException(e){return isError$1(e,"CALL_EXCEPTION")}function makeError(e,t,r){let n,i=e;{const n=[];if(r){if("message"in r||"code"in r||"name"in r)throw new Error(`value will overwrite populated values: ${stringify$4(r)}`);for(const e in r){if("shortMessage"===e)continue;const t=r[e];n.push(e+"="+stringify$4(t))}}n.push(`code=${t}`),n.push(`version=${version$9}`),n.length&&(e+=" ("+n.join(", ")+")")}switch(t){case"INVALID_ARGUMENT":n=new TypeError(e);break;case"NUMERIC_FAULT":case"BUFFER_OVERRUN":n=new RangeError(e);break;default:n=new Error(e)}return defineProperties$2(n,{code:t}),r&&Object.assign(n,r),null==n.shortMessage&&defineProperties$2(n,{shortMessage:i}),n}function assert$j(e,t,r,n){if(!e)throw makeError(t,r,n)}function assertArgument(e,t,r,n){assert$j(e,t,"INVALID_ARGUMENT",{argument:r,value:n})}function assertArgumentCount(e,t,r){null==r&&(r=""),r&&(r=": "+r),assert$j(e>=t,"missing arguemnt"+r,"MISSING_ARGUMENT",{count:e,expectedCount:t}),assert$j(e<=t,"too many arguments"+r,"UNEXPECTED_ARGUMENT",{count:e,expectedCount:t})}function assertPrivate(e,t,r){if(null==r&&(r=""),e!==t){let e=r,t="new";r&&(e+=".",t+=" "+r),assert$j(!1,`private constructor; use ${e}from* methods`,"UNSUPPORTED_OPERATION",{operation:t})}}function _getBytes(e,t,r){if(e instanceof Uint8Array)return r?new Uint8Array(e):e;if("string"==typeof e&&e.match(/^0x(?:[0-9a-f][0-9a-f])*$/i)){const t=new Uint8Array((e.length-2)/2);let r=2;for(let n=0;n<t.length;n++)t[n]=parseInt(e.substring(r,r+2),16),r+=2;return t}assertArgument(!1,"invalid BytesLike value",t||"value",e)}function getBytes(e,t){return _getBytes(e,t,!1)}function getBytesCopy(e,t){return _getBytes(e,t,!0)}function isHexString$1(e,t){return!("string"!=typeof e||!e.match(/^0x[0-9A-Fa-f]*$/))&&(("number"!=typeof t||e.length===2+2*t)&&(!0!==t||e.length%2==0))}function isBytesLike(e){return isHexString$1(e,!0)||e instanceof Uint8Array}["NFD","NFC","NFKD","NFKC"].reduce(((e,t)=>{try{if("test"!=="test".normalize(t))throw new Error("bad");if("NFD"===t){const e=String.fromCharCode(233).normalize("NFD");if(e!==String.fromCharCode(101,769))throw new Error("broken")}e.push(t)}catch(e){}return e}),[]);const HexCharacters="0123456789abcdef";function hexlify(e){const t=getBytes(e);let r="0x";for(let e=0;e<t.length;e++){const n=t[e];r+=HexCharacters[(240&n)>>4]+HexCharacters[15&n]}return r}function concat$5(e){return"0x"+e.map((e=>hexlify(e).substring(2))).join("")}function dataLength(e){return isHexString$1(e,!0)?(e.length-2)/2:getBytes(e).length}function dataSlice(e,t,r){const n=getBytes(e);return null!=r&&r>n.length&&assert$j(!1,"cannot slice beyond data bounds","BUFFER_OVERRUN",{buffer:n,length:n.length,offset:r}),hexlify(n.slice(null==t?0:t,null==r?n.length:r))}function zeroPad(e,t,r){const n=getBytes(e);assert$j(t>=n.length,"padding exceeds data length","BUFFER_OVERRUN",{buffer:new Uint8Array(n),length:t,offset:t+1});const i=new Uint8Array(t);return i.fill(0),r?i.set(n,t-n.length):i.set(n,0),hexlify(i)}function zeroPadValue(e,t){return zeroPad(e,t,!0)}function zeroPadBytes(e,t){return zeroPad(e,t,!1)}const BN_0$9=BigInt(0),BN_1$4=BigInt(1),maxValue=9007199254740991;function fromTwos(e,t){const r=getUint(e,"value"),n=BigInt(getNumber(t,"width"));if(assert$j(r>>n===BN_0$9,"overflow","NUMERIC_FAULT",{operation:"fromTwos",fault:"overflow",value:e}),r>>n-BN_1$4){return-((~r&(BN_1$4<<n)-BN_1$4)+BN_1$4)}return r}function toTwos(e,t){let r=getBigInt(e,"value");const n=BigInt(getNumber(t,"width")),i=BN_1$4<<n-BN_1$4;if(r<BN_0$9){r=-r,assert$j(r<=i,"too low","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:e});return(~r&(BN_1$4<<n)-BN_1$4)+BN_1$4}return assert$j(r<i,"too high","NUMERIC_FAULT",{operation:"toTwos",fault:"overflow",value:e}),r}function mask(e,t){const r=getUint(e,"value"),n=BigInt(getNumber(t,"bits"));return r&(BN_1$4<<n)-BN_1$4}function getBigInt(e,t){switch(typeof e){case"bigint":return e;case"number":return assertArgument(Number.isInteger(e),"underflow",t||"value",e),assertArgument(e>=-maxValue&&e<=maxValue,"overflow",t||"value",e),BigInt(e);case"string":try{if(""===e)throw new Error("empty string");return"-"===e[0]&&"-"!==e[1]?-BigInt(e.substring(1)):BigInt(e)}catch(r){assertArgument(!1,`invalid BigNumberish string: ${r.message}`,t||"value",e)}}assertArgument(!1,"invalid BigNumberish value",t||"value",e)}function getUint(e,t){const r=getBigInt(e,t);return assert$j(r>=BN_0$9,"unsigned value cannot be negative","NUMERIC_FAULT",{fault:"overflow",operation:"getUint",value:e}),r}const Nibbles="0123456789abcdef";function toBigInt(e){if(e instanceof Uint8Array){let t="0x0";for(const r of e)t+=Nibbles[r>>4],t+=Nibbles[15&r];return BigInt(t)}return getBigInt(e)}function getNumber(e,t){switch(typeof e){case"bigint":return assertArgument(e>=-maxValue&&e<=maxValue,"overflow",t||"value",e),Number(e);case"number":return assertArgument(Number.isInteger(e),"underflow",t||"value",e),assertArgument(e>=-maxValue&&e<=maxValue,"overflow",t||"value",e),e;case"string":try{if(""===e)throw new Error("empty string");return getNumber(BigInt(e),t)}catch(r){assertArgument(!1,`invalid numeric string: ${r.message}`,t||"value",e)}}assertArgument(!1,"invalid numeric value",t||"value",e)}function toNumber$3(e){return getNumber(toBigInt(e))}function toBeHex(e,t){let r=getUint(e,"value").toString(16);if(null==t)r.length%2&&(r="0"+r);else{const n=getNumber(t,"width");for(assert$j(2*n>=r.length,`value exceeds width (${n} bytes)`,"NUMERIC_FAULT",{operation:"toBeHex",fault:"overflow",value:e});r.length<2*n;)r="0"+r}return"0x"+r}function toBeArray(e){const t=getUint(e,"value");if(t===BN_0$9)return new Uint8Array([]);let r=t.toString(16);r.length%2&&(r="0"+r);const n=new Uint8Array(r.length/2);for(let e=0;e<n.length;e++){const t=2*e;n[e]=parseInt(r.substring(t,t+2),16)}return n}function toQuantity(e){let t=hexlify(isBytesLike(e)?e:toBeArray(e)).substring(2);for(;t.startsWith("0");)t=t.substring(1);return""===t&&(t="0"),"0x"+t}const Alphabet="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";BigInt(0);const BN_58=BigInt(58);function encodeBase58(e){const t=getBytes(e);let r=toBigInt(t),n="";for(;r;)n=Alphabet[Number(r%BN_58)]+n,r/=BN_58;for(let e=0;e<t.length&&!t[e];e++)n=Alphabet[0]+n;return n}function decodeBase64(e){e=atob(e);const t=new Uint8Array(e.length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return getBytes(t)}function encodeBase64(e){const t=getBytes(e);let r="";for(let e=0;e<t.length;e++)r+=String.fromCharCode(t[e]);return btoa(r)}class EventPayload{filter;emitter;#e;constructor(e,t,r){this.#e=t,defineProperties$2(this,{emitter:e,filter:r})}async removeListener(){null!=this.#e&&await this.emitter.off(this.filter,this.#e)}}function errorFunc(e,t,r,n,i){assertArgument(!1,`invalid codepoint at offset ${t}; ${e}`,"bytes",r)}function ignoreFunc(e,t,r,n,i){if("BAD_PREFIX"===e||"UNEXPECTED_CONTINUE"===e){let e=0;for(let n=t+1;n<r.length&&r[n]>>6==2;n++)e++;return e}return"OVERRUN"===e?r.length-t-1:0}function replaceFunc(e,t,r,n,i){return"OVERLONG"===e?(assertArgument("number"==typeof i,"invalid bad code point for replacement","badCodepoint",i),n.push(i),0):(n.push(65533),ignoreFunc(e,t,r))}const Utf8ErrorFuncs=Object.freeze({error:errorFunc,ignore:ignoreFunc,replace:replaceFunc});function getUtf8CodePoints(e,t){null==t&&(t=Utf8ErrorFuncs.error);const r=getBytes(e,"bytes"),n=[];let i=0;for(;i<r.length;){const e=r[i++];if(!(e>>7)){n.push(e);continue}let o=null,a=null;if(192==(224&e))o=1,a=127;else if(224==(240&e))o=2,a=2047;else{if(240!=(248&e)){i+=t(128==(192&e)?"UNEXPECTED_CONTINUE":"BAD_PREFIX",i-1,r,n);continue}o=3,a=65535}if(i-1+o>=r.length){i+=t("OVERRUN",i-1,r,n);continue}let s=e&(1<<8-o-1)-1;for(let e=0;e<o;e++){let e=r[i];if(128!=(192&e)){i+=t("MISSING_CONTINUE",i,r,n),s=null;break}s=s<<6|63&e,i++}null!==s&&(s>1114111?i+=t("OUT_OF_RANGE",i-1-o,r,n,s):s>=55296&&s<=57343?i+=t("UTF16_SURROGATE",i-1-o,r,n,s):s<=a?i+=t("OVERLONG",i-1-o,r,n,s):n.push(s))}return n}function toUtf8Bytes(e,t){assertArgument("string"==typeof e,"invalid string value","str",e);let r=[];for(let t=0;t<e.length;t++){const n=e.charCodeAt(t);if(n<128)r.push(n);else if(n<2048)r.push(n>>6|192),r.push(63&n|128);else if(55296==(64512&n)){t++;const i=e.charCodeAt(t);assertArgument(t<e.length&&56320==(64512&i),"invalid surrogate pair","str",e);const o=65536+((1023&n)<<10)+(1023&i);r.push(o>>18|240),r.push(o>>12&63|128),r.push(o>>6&63|128),r.push(63&o|128)}else r.push(n>>12|224),r.push(n>>6&63|128),r.push(63&n|128)}return new Uint8Array(r)}function _toUtf8String(e){return e.map((e=>e<=65535?String.fromCharCode(e):(e-=65536,String.fromCharCode(55296+(e>>10&1023),56320+(1023&e))))).join("")}function toUtf8String(e,t){return _toUtf8String(getUtf8CodePoints(e,t))}function createGetUrl(e){return async function(e,t){assert$j(null==t||!t.cancelled,"request cancelled before sending","CANCELLED");const r=e.url.split(":")[0].toLowerCase();assert$j("http"===r||"https"===r,`unsupported protocol ${r}`,"UNSUPPORTED_OPERATION",{info:{protocol:r},operation:"request"}),assert$j("https"===r||!e.credentials||e.allowInsecureAuthentication,"insecure authorized connections unsupported","UNSUPPORTED_OPERATION",{operation:"request"});let n=null;const i=new AbortController,o=setTimeout((()=>{n=makeError("request timeout","TIMEOUT"),i.abort()}),e.timeout);t&&t.addListener((()=>{n=makeError("request cancelled","CANCELLED"),i.abort()}));const a={method:e.method,headers:new Headers(Array.from(e)),body:e.body||void 0,signal:i.signal};let s;try{s=await fetch(e.url,a)}catch(e){if(clearTimeout(o),n)throw n;throw e}clearTimeout(o);const c={};s.headers.forEach(((e,t)=>{c[t.toLowerCase()]=e}));const l=await s.arrayBuffer(),u=null==l?null:new Uint8Array(l);return{statusCode:s.status,statusMessage:s.statusText,headers:c,body:u}}}const MAX_ATTEMPTS=12,SLOT_INTERVAL=250;let defaultGetUrlFunc=createGetUrl();const reData=new RegExp("^data:([^;:]*)?(;base64)?,(.*)$","i"),reIpfs=new RegExp("^ipfs://(ipfs/)?(.*)$","i");let locked$1=!1;async function dataGatewayFunc(e,t){try{const t=e.match(reData);if(!t)throw new Error("invalid data");return new FetchResponse(200,"OK",{"content-type":t[1]||"text/plain"},t[2]?decodeBase64(t[3]):unpercent(t[3]))}catch(t){return new FetchResponse(599,"BAD REQUEST (invalid data: URI)",{},null,new FetchRequest(e))}}function getIpfsGatewayFunc(e){return async function(t,r){try{const r=t.match(reIpfs);if(!r)throw new Error("invalid link");return new FetchRequest(`${e}${r[2]}`)}catch(e){return new FetchResponse(599,"BAD REQUEST (invalid IPFS URI)",{},null,new FetchRequest(t))}}}const Gateways={data:dataGatewayFunc,ipfs:getIpfsGatewayFunc("https://gateway.ipfs.io/ipfs/")},fetchSignals=new WeakMap;class FetchCancelSignal{#t;#r;constructor(e){this.#t=[],this.#r=!1,fetchSignals.set(e,(()=>{if(!this.#r){this.#r=!0;for(const e of this.#t)setTimeout((()=>{e()}),0);this.#t=[]}}))}addListener(e){assert$j(!this.#r,"singal already cancelled","UNSUPPORTED_OPERATION",{operation:"fetchCancelSignal.addCancelListener"}),this.#t.push(e)}get cancelled(){return this.#r}checkSignal(){assert$j(!this.cancelled,"cancelled","CANCELLED",{})}}function checkSignal(e){if(null==e)throw new Error("missing signal; should not happen");return e.checkSignal(),e}class FetchRequest{#n;#i;#o;#a;#s;#c;#l;#u;#d;#p;#f;#h;#g;#A;#m;get url(){return this.#c}set url(e){this.#c=String(e)}get body(){return null==this.#l?null:new Uint8Array(this.#l)}set body(e){if(null==e)this.#l=void 0,this.#u=void 0;else if("string"==typeof e)this.#l=toUtf8Bytes(e),this.#u="text/plain";else if(e instanceof Uint8Array)this.#l=e,this.#u="application/octet-stream";else{if("object"!=typeof e)throw new Error("invalid body");this.#l=toUtf8Bytes(JSON.stringify(e)),this.#u="application/json"}}hasBody(){return null!=this.#l}get method(){return this.#a?this.#a:this.hasBody()?"POST":"GET"}set method(e){null==e&&(e=""),this.#a=String(e).toUpperCase()}get headers(){const e=Object.assign({},this.#o);return this.#d&&(e.authorization=`Basic ${encodeBase64(toUtf8Bytes(this.#d))}`),this.allowGzip&&(e["accept-encoding"]="gzip"),null==e["content-type"]&&this.#u&&(e["content-type"]=this.#u),this.body&&(e["content-length"]=String(this.body.length)),e}getHeader(e){return this.headers[e.toLowerCase()]}setHeader(e,t){this.#o[String(e).toLowerCase()]=String(t)}clearHeaders(){this.#o={}}[Symbol.iterator](){const e=this.headers,t=Object.keys(e);let r=0;return{next:()=>{if(r<t.length){const n=t[r++];return{value:[n,e[n]],done:!1}}return{value:void 0,done:!0}}}}get credentials(){return this.#d||null}setCredentials(e,t){assertArgument(!e.match(/:/),"invalid basic authentication username","username","[REDACTED]"),this.#d=`${e}:${t}`}get allowGzip(){return this.#i}set allowGzip(e){this.#i=!!e}get allowInsecureAuthentication(){return!!this.#n}set allowInsecureAuthentication(e){this.#n=!!e}get timeout(){return this.#s}set timeout(e){assertArgument(e>=0,"timeout must be non-zero","timeout",e),this.#s=e}get preflightFunc(){return this.#p||null}set preflightFunc(e){this.#p=e}get processFunc(){return this.#f||null}set processFunc(e){this.#f=e}get retryFunc(){return this.#h||null}set retryFunc(e){this.#h=e}get getUrlFunc(){return this.#m||defaultGetUrlFunc}set getUrlFunc(e){this.#m=e}constructor(e){this.#c=String(e),this.#n=!1,this.#i=!0,this.#o={},this.#a="",this.#s=3e5,this.#A={slotInterval:SLOT_INTERVAL,maxAttempts:MAX_ATTEMPTS},this.#m=null}toString(){return`<FetchRequest method=${JSON.stringify(this.method)} url=${JSON.stringify(this.url)} headers=${JSON.stringify(this.headers)} body=${this.#l?hexlify(this.#l):"null"}>`}setThrottleParams(e){null!=e.slotInterval&&(this.#A.slotInterval=e.slotInterval),null!=e.maxAttempts&&(this.#A.maxAttempts=e.maxAttempts)}async#y(e,t,r,n,i){if(e>=this.#A.maxAttempts)return i.makeServerError("exceeded maximum retry limit");assert$j(getTime$1()<=t,"timeout","TIMEOUT",{operation:"request.send",reason:"timeout",request:n}),r>0&&await wait(r);let o=this.clone();const a=(o.url.split(":")[0]||"").toLowerCase();if(a in Gateways){const e=await Gateways[a](o.url,checkSignal(n.#g));if(e instanceof FetchResponse){let t=e;if(this.processFunc){checkSignal(n.#g);try{t=await this.processFunc(o,t)}catch(e){null!=e.throttle&&"number"==typeof e.stall||t.makeServerError("error in post-processing function",e).assertOk()}}return t}o=e}this.preflightFunc&&(o=await this.preflightFunc(o));const s=await this.getUrlFunc(o,checkSignal(n.#g));let c=new FetchResponse(s.statusCode,s.statusMessage,s.headers,s.body,n);if(301===c.statusCode||302===c.statusCode){try{const r=c.headers.location||"";return o.redirect(r).#y(e+1,t,0,n,c)}catch(e){}return c}if(429===c.statusCode&&(null==this.retryFunc||await this.retryFunc(o,c,e))){const r=c.headers["retry-after"];let i=this.#A.slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return"string"==typeof r&&r.match(/^[1-9][0-9]*$/)&&(i=parseInt(r)),o.clone().#y(e+1,t,i,n,c)}if(this.processFunc){checkSignal(n.#g);try{c=await this.processFunc(o,c)}catch(r){null!=r.throttle&&"number"==typeof r.stall||c.makeServerError("error in post-processing function",r).assertOk();let i=this.#A.slotInterval*Math.trunc(Math.random()*Math.pow(2,e));return r.stall>=0&&(i=r.stall),o.clone().#y(e+1,t,i,n,c)}}return c}send(){return assert$j(null==this.#g,"request already sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.send"}),this.#g=new FetchCancelSignal(this),this.#y(0,getTime$1()+this.timeout,0,this,new FetchResponse(0,"",{},null,this))}cancel(){assert$j(null!=this.#g,"request has not been sent","UNSUPPORTED_OPERATION",{operation:"fetchRequest.cancel"});const e=fetchSignals.get(this);if(!e)throw new Error("missing signal; should not happen");e()}redirect(e){const t=this.url.split(":")[0].toLowerCase(),r=e.split(":")[0].toLowerCase();assert$j("GET"===this.method&&("https"!==t||"http"!==r)&&e.match(/^https?:/),"unsupported redirect","UNSUPPORTED_OPERATION",{operation:`redirect(${this.method} ${JSON.stringify(this.url)} => ${JSON.stringify(e)})`});const n=new FetchRequest(e);return n.method="GET",n.allowGzip=this.allowGzip,n.timeout=this.timeout,n.#o=Object.assign({},this.#o),this.#l&&(n.#l=new Uint8Array(this.#l)),n.#u=this.#u,n}clone(){const e=new FetchRequest(this.url);return e.#a=this.#a,this.#l&&(e.#l=this.#l),e.#u=this.#u,e.#o=Object.assign({},this.#o),e.#d=this.#d,this.allowGzip&&(e.allowGzip=!0),e.timeout=this.timeout,this.allowInsecureAuthentication&&(e.allowInsecureAuthentication=!0),e.#p=this.#p,e.#f=this.#f,e.#h=this.#h,e.#A=Object.assign({},this.#A),e.#m=this.#m,e}static lockConfig(){locked$1=!0}static getGateway(e){return Gateways[e.toLowerCase()]||null}static registerGateway(e,t){if("http"===(e=e.toLowerCase())||"https"===e)throw new Error(`cannot intercept ${e}; use registerGetUrl`);if(locked$1)throw new Error("gateways locked");Gateways[e]=t}static registerGetUrl(e){if(locked$1)throw new Error("gateways locked");defaultGetUrlFunc=e}static createGetUrlFunc(e){return createGetUrl()}static createDataGateway(){return dataGatewayFunc}static createIpfsGatewayFunc(e){return getIpfsGatewayFunc(e)}}class FetchResponse{#b;#v;#o;#l;#I;#_;toString(){return`<FetchResponse status=${this.statusCode} body=${this.#l?hexlify(this.#l):"null"}>`}get statusCode(){return this.#b}get statusMessage(){return this.#v}get headers(){return Object.assign({},this.#o)}get body(){return null==this.#l?null:new Uint8Array(this.#l)}get bodyText(){try{return null==this.#l?"":toUtf8String(this.#l)}catch(e){assert$j(!1,"response body is not valid UTF-8 data","UNSUPPORTED_OPERATION",{operation:"bodyText",info:{response:this}})}}get bodyJson(){try{return JSON.parse(this.bodyText)}catch(e){assert$j(!1,"response body is not valid JSON","UNSUPPORTED_OPERATION",{operation:"bodyJson",info:{response:this}})}}[Symbol.iterator](){const e=this.headers,t=Object.keys(e);let r=0;return{next:()=>{if(r<t.length){const n=t[r++];return{value:[n,e[n]],done:!1}}return{value:void 0,done:!0}}}}constructor(e,t,r,n,i){this.#b=e,this.#v=t,this.#o=Object.keys(r).reduce(((e,t)=>(e[t.toLowerCase()]=String(r[t]),e)),{}),this.#l=null==n?null:new Uint8Array(n),this.#I=i||null,this.#_={message:""}}makeServerError(e,t){let r;r=e?`CLIENT ESCALATED SERVER ERROR (${this.statusCode} ${this.statusMessage}; ${e})`:`CLIENT ESCALATED SERVER ERROR (${e=`${this.statusCode} ${this.statusMessage}`})`;const n=new FetchResponse(599,r,this.headers,this.body,this.#I||void 0);return n.#_={message:e,error:t},n}throwThrottleError(e,t){null==t?t=-1:assertArgument(Number.isInteger(t)&&t>=0,"invalid stall timeout","stall",t);const r=new Error(e||"throttling requests");throw defineProperties$2(r,{stall:t,throttle:!0}),r}getHeader(e){return this.headers[e.toLowerCase()]}hasBody(){return null!=this.#l}get request(){return this.#I}ok(){return""===this.#_.message&&this.statusCode>=200&&this.statusCode<300}assertOk(){if(this.ok())return;let{message:e,error:t}=this.#_;""===e&&(e=`server response ${this.statusCode} ${this.statusMessage}`);let r=null;this.request&&(r=this.request.url);let n=null;try{this.#l&&(n=toUtf8String(this.#l))}catch(e){}assert$j(!1,e,"SERVER_ERROR",{request:this.request||"unknown request",response:this,error:t,info:{requestUrl:r,responseBody:n,responseStatus:`${this.statusCode} ${this.statusMessage}`}})}}function getTime$1(){return(new Date).getTime()}function unpercent(e){return toUtf8Bytes(e.replace(/%([0-9a-f][0-9a-f])/gi,((e,t)=>String.fromCharCode(parseInt(t,16)))))}function wait(e){return new Promise((t=>setTimeout(t,e)))}const BN_N1=BigInt(-1),BN_0$8=BigInt(0),BN_1$3=BigInt(1),BN_5=BigInt(5),_guard$3={};let Zeros$1="0000";for(;Zeros$1.length<80;)Zeros$1+=Zeros$1;function getTens(e){let t=Zeros$1;for(;t.length<e;)t+=t;return BigInt("1"+t.substring(0,e))}function checkValue(e,t,r){const n=BigInt(t.width);if(t.signed){const t=BN_1$3<<n-BN_1$3;assert$j(null==r||e>=-t&&e<t,"overflow","NUMERIC_FAULT",{operation:r,fault:"overflow",value:e}),e=e>BN_0$8?fromTwos(mask(e,n),n):-fromTwos(mask(-e,n),n)}else{const t=BN_1$3<<n;assert$j(null==r||e>=0&&e<t,"overflow","NUMERIC_FAULT",{operation:r,fault:"overflow",value:e}),e=(e%t+t)%t&t-BN_1$3}return e}function getFormat(e){"number"==typeof e&&(e=`fixed128x${e}`);let t=!0,r=128,n=18;if("string"==typeof e)if("fixed"===e);else if("ufixed"===e)t=!1;else{const i=e.match(/^(u?)fixed([0-9]+)x([0-9]+)$/);assertArgument(i,"invalid fixed format","format",e),t="u"!==i[1],r=parseInt(i[2]),n=parseInt(i[3])}else if(e){const i=e,o=(e,t,r)=>null==i[e]?r:(assertArgument(typeof i[e]===t,"invalid fixed format ("+e+" not "+t+")","format."+e,i[e]),i[e]);t=o("signed","boolean",t),r=o("width","number",r),n=o("decimals","number",n)}assertArgument(r%8==0,"invalid FixedNumber width (not byte aligned)","format.width",r),assertArgument(n<=80,"invalid FixedNumber decimals (too large)","format.decimals",n);return{signed:t,width:r,decimals:n,name:(t?"":"u")+"fixed"+String(r)+"x"+String(n)}}function toString$6(e,t){let r="";e<BN_0$8&&(r="-",e*=BN_N1);let n=e.toString();if(0===t)return r+n;for(;n.length<=t;)n=Zeros$1+n;const i=n.length-t;for(n=n.substring(0,i)+"."+n.substring(i);"0"===n[0]&&"."!==n[1];)n=n.substring(1);for(;"0"===n[n.length-1]&&"."!==n[n.length-2];)n=n.substring(0,n.length-1);return r+n}class FixedNumber{format;#C;#E;#w;_value;constructor(e,t,r){assertPrivate(e,_guard$3,"FixedNumber"),this.#E=t,this.#C=r;const n=toString$6(t,r.decimals);defineProperties$2(this,{format:r.name,_value:n}),this.#w=getTens(r.decimals)}get signed(){return this.#C.signed}get width(){return this.#C.width}get decimals(){return this.#C.decimals}get value(){return this.#E}#S(e){assertArgument(this.format===e.format,"incompatible format; use fixedNumber.toFormat","other",e)}#x(e,t){return e=checkValue(e,this.#C,t),new FixedNumber(_guard$3,e,this.#C)}#T(e,t){return this.#S(e),this.#x(this.#E+e.#E,t)}addUnsafe(e){return this.#T(e)}add(e){return this.#T(e,"add")}#B(e,t){return this.#S(e),this.#x(this.#E-e.#E,t)}subUnsafe(e){return this.#B(e)}sub(e){return this.#B(e,"sub")}#$(e,t){return this.#S(e),this.#x(this.#E*e.#E/this.#w,t)}mulUnsafe(e){return this.#$(e)}mul(e){return this.#$(e,"mul")}mulSignal(e){this.#S(e);const t=this.#E*e.#E;return assert$j(t%this.#w===BN_0$8,"precision lost during signalling mul","NUMERIC_FAULT",{operation:"mulSignal",fault:"underflow",value:this}),this.#x(t/this.#w,"mulSignal")}#k(e,t){return assert$j(e.#E!==BN_0$8,"division by zero","NUMERIC_FAULT",{operation:"div",fault:"divide-by-zero",value:this}),this.#S(e),this.#x(this.#E*this.#w/e.#E,t)}divUnsafe(e){return this.#k(e)}div(e){return this.#k(e,"div")}divSignal(e){assert$j(e.#E!==BN_0$8,"division by zero","NUMERIC_FAULT",{operation:"div",fault:"divide-by-zero",value:this}),this.#S(e);const t=this.#E*this.#w;return assert$j(t%e.#E===BN_0$8,"precision lost during signalling div","NUMERIC_FAULT",{operation:"divSignal",fault:"underflow",value:this}),this.#x(t/e.#E,"divSignal")}cmp(e){let t=this.value,r=e.value;const n=this.decimals-e.decimals;return n>0?r*=getTens(n):n<0&&(t*=getTens(-n)),t<r?-1:t>r?1:0}eq(e){return 0===this.cmp(e)}lt(e){return this.cmp(e)<0}lte(e){return this.cmp(e)<=0}gt(e){return this.cmp(e)>0}gte(e){return this.cmp(e)>=0}floor(){let e=this.#E;return this.#E<BN_0$8&&(e-=this.#w-BN_1$3),e=this.#E/this.#w*this.#w,this.#x(e,"floor")}ceiling(){let e=this.#E;return this.#E>BN_0$8&&(e+=this.#w-BN_1$3),e=this.#E/this.#w*this.#w,this.#x(e,"ceiling")}round(e){if(null==e&&(e=0),e>=this.decimals)return this;const t=this.decimals-e,r=BN_5*getTens(t-1);let n=this.value+r;const i=getTens(t);return n=n/i*i,checkValue(n,this.#C,"round"),new FixedNumber(_guard$3,n,this.#C)}isZero(){return this.#E===BN_0$8}isNegative(){return this.#E<BN_0$8}toString(){return this._value}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return FixedNumber.fromString(this.toString(),e)}static fromValue(e,t,r){const n=null==t?0:getNumber(t),i=getFormat(r);let o=getBigInt(e,"value");const a=n-i.decimals;if(a>0){const t=getTens(a);assert$j(o%t===BN_0$8,"value loses precision for format","NUMERIC_FAULT",{operation:"fromValue",fault:"underflow",value:e}),o/=t}else a<0&&(o*=getTens(-a));return checkValue(o,i,"fromValue"),new FixedNumber(_guard$3,o,i)}static fromString(e,t){const r=e.match(/^(-?)([0-9]*)\.?([0-9]*)$/);assertArgument(r&&r[2].length+r[3].length>0,"invalid FixedNumber string value","value",e);const n=getFormat(t);let i=r[2]||"0",o=r[3]||"";for(;o.length<n.decimals;)o+=Zeros$1;assert$j(o.substring(n.decimals).match(/^0*$/),"too many decimals for format","NUMERIC_FAULT",{operation:"fromString",fault:"underflow",value:e}),o=o.substring(0,n.decimals);const a=BigInt(r[1]+i+o);return checkValue(a,n,"fromString"),new FixedNumber(_guard$3,a,n)}static fromBytes(e,t){let r=toBigInt(getBytes(e,"value"));const n=getFormat(t);return n.signed&&(r=fromTwos(r,n.width)),checkValue(r,n,"fromBytes"),new FixedNumber(_guard$3,r,n)}}function hexlifyByte(e){let t=e.toString(16);for(;t.length<2;)t="0"+t;return"0x"+t}function unarrayifyInteger(e,t,r){let n=0;for(let i=0;i<r;i++)n=256*n+e[t+i];return n}function _decodeChildren(e,t,r,n){const i=[];for(;r<t+1+n;){const o=_decode(e,r);i.push(o.result),assert$j((r+=o.consumed)<=t+1+n,"child data too short","BUFFER_OVERRUN",{buffer:e,length:n,offset:t})}return{consumed:1+n,result:i}}function _decode(e,t){assert$j(0!==e.length,"data too short","BUFFER_OVERRUN",{buffer:e,length:0,offset:1});const r=t=>{assert$j(t<=e.length,"data short segment too short","BUFFER_OVERRUN",{buffer:e,length:e.length,offset:t})};if(e[t]>=248){const n=e[t]-247;r(t+1+n);const i=unarrayifyInteger(e,t+1,n);return r(t+1+n+i),_decodeChildren(e,t,t+1+n,n+i)}if(e[t]>=192){const n=e[t]-192;return r(t+1+n),_decodeChildren(e,t,t+1,n)}if(e[t]>=184){const n=e[t]-183;r(t+1+n);const i=unarrayifyInteger(e,t+1,n);r(t+1+n+i);return{consumed:1+n+i,result:hexlify(e.slice(t+1+n,t+1+n+i))}}if(e[t]>=128){const n=e[t]-128;r(t+1+n);return{consumed:1+n,result:hexlify(e.slice(t+1,t+1+n))}}return{consumed:1,result:hexlifyByte(e[t])}}function decodeRlp(e){const t=getBytes(e,"data"),r=_decode(t,0);return assertArgument(r.consumed===t.length,"unexpected junk after rlp payload","data",e),r.result}function arrayifyInteger(e){const t=[];for(;e;)t.unshift(255&e),e>>=8;return t}function _encode(e){if(Array.isArray(e)){let t=[];if(e.forEach((function(e){t=t.concat(_encode(e))})),t.length<=55)return t.unshift(192+t.length),t;const r=arrayifyInteger(t.length);return r.unshift(247+r.length),r.concat(t)}const t=Array.prototype.slice.call(getBytes(e,"object"));if(1===t.length&&t[0]<=127)return t;if(t.length<=55)return t.unshift(128+t.length),t;const r=arrayifyInteger(t.length);return r.unshift(183+r.length),r.concat(t)}const nibbles="0123456789abcdef";function encodeRlp(e){let t="0x";for(const r of _encode(e))t+=nibbles[r>>4],t+=nibbles[15&r];return t}const names=["wei","kwei","mwei","gwei","szabo","finney","ether"];function formatUnits(e,t){let r=18;if("string"==typeof t){const e=names.indexOf(t);assertArgument(e>=0,"invalid unit","unit",t),r=3*e}else null!=t&&(r=getNumber(t,"unit"));return FixedNumber.fromValue(e,r,{decimals:r,width:512}).toString()}function parseUnits$1(e,t){assertArgument("string"==typeof e,"value must be a string","value",e);let r=18;if("string"==typeof t){const e=names.indexOf(t);assertArgument(e>=0,"invalid unit","unit",t),r=3*e}else null!=t&&(r=getNumber(t,"unit"));return FixedNumber.fromString(e,{decimals:r,width:512}).value}function parseEther(e){return parseUnits$1(e,18)}const WordSize=32,Padding=new Uint8Array(WordSize),passProperties$1=["then"],_guard$2={},resultNames=new WeakMap;function getNames(e){return resultNames.get(e)}function setNames(e,t){resultNames.set(e,t)}function throwError$1(e,t){const r=new Error(`deferred error during ABI decoding triggered accessing ${e}`);throw r.error=t,r}function toObject(e,t,r){return e.indexOf(null)>=0?t.map(((e,t)=>e instanceof Result?toObject(getNames(e),e,r):e)):e.reduce(((e,n,i)=>{let o=t.getValue(n);return n in e||(r&&o instanceof Result&&(o=toObject(getNames(o),o,r)),e[n]=o),e}),{})}class Result extends Array{#P;constructor(...e){const t=e[0];let r=e[1],n=(e[2]||[]).slice(),i=!0;t!==_guard$2&&(r=e,n=[],i=!1),super(r.length),r.forEach(((e,t)=>{this[t]=e}));const o=n.reduce(((e,t)=>("string"==typeof t&&e.set(t,(e.get(t)||0)+1),e)),new Map);if(setNames(this,Object.freeze(r.map(((e,t)=>{const r=n[t];return null!=r&&1===o.get(r)?r:null})))),this.#P=[],null==this.#P&&this.#P,!i)return;Object.freeze(this);const a=new Proxy(this,{get:(e,t,r)=>{if("string"==typeof t){if(t.match(/^[0-9]+$/)){const r=getNumber(t,"%index");if(r<0||r>=this.length)throw new RangeError("out of result range");const n=e[r];return n instanceof Error&&throwError$1(`index ${r}`,n),n}if(passProperties$1.indexOf(t)>=0)return Reflect.get(e,t,r);const n=e[t];if(n instanceof Function)return function(...t){return n.apply(this===r?e:this,t)};if(!(t in e))return e.getValue.apply(this===r?e:this,[t])}return Reflect.get(e,t,r)}});return setNames(a,getNames(this)),a}toArray(e){const t=[];return this.forEach(((r,n)=>{r instanceof Error&&throwError$1(`index ${n}`,r),e&&r instanceof Result&&(r=r.toArray(e)),t.push(r)})),t}toObject(e){const t=getNames(this);return t.reduce(((r,n,i)=>(assert$j(null!=n,`value at index ${i} unnamed`,"UNSUPPORTED_OPERATION",{operation:"toObject()"}),toObject(t,this,e))),{})}slice(e,t){null==e&&(e=0),e<0&&(e+=this.length)<0&&(e=0),null==t&&(t=this.length),t<0&&(t+=this.length)<0&&(t=0),t>this.length&&(t=this.length);const r=getNames(this),n=[],i=[];for(let o=e;o<t;o++)n.push(this[o]),i.push(r[o]);return new Result(_guard$2,n,i)}filter(e,t){const r=getNames(this),n=[],i=[];for(let o=0;o<this.length;o++){const a=this[o];a instanceof Error&&throwError$1(`index ${o}`,a),e.call(t,a,o,this)&&(n.push(a),i.push(r[o]))}return new Result(_guard$2,n,i)}map(e,t){const r=[];for(let n=0;n<this.length;n++){const i=this[n];i instanceof Error&&throwError$1(`index ${n}`,i),r.push(e.call(t,i,n,this))}return r}getValue(e){const t=getNames(this).indexOf(e);if(-1===t)return;const r=this[t];return r instanceof Error&&throwError$1(`property ${JSON.stringify(e)}`,r.error),r}static fromItems(e,t){return new Result(_guard$2,e,t)}}function getValue$3(e){let t=toBeArray(e);return assert$j(t.length<=WordSize,"value out-of-bounds","BUFFER_OVERRUN",{buffer:t,length:WordSize,offset:t.length}),t.length!==WordSize&&(t=getBytesCopy(concat$5([Padding.slice(t.length%WordSize),t]))),t}class Coder{name;type;localName;dynamic;constructor(e,t,r,n){defineProperties$2(this,{name:e,type:t,localName:r,dynamic:n},{name:"string",type:"string",localName:"string",dynamic:"boolean"})}_throwError(e,t){assertArgument(!1,e,this.localName,t)}}let Writer$4=class{#O;#R;constructor(){this.#O=[],this.#R=0}get data(){return concat$5(this.#O)}get length(){return this.#R}#D(e){return this.#O.push(e),this.#R+=e.length,e.length}appendWriter(e){return this.#D(getBytesCopy(e.data))}writeBytes(e){let t=getBytesCopy(e);const r=t.length%WordSize;return r&&(t=getBytesCopy(concat$5([t,Padding.slice(r)]))),this.#D(t)}writeValue(e){return this.#D(getValue$3(e))}writeUpdatableValue(){const e=this.#O.length;return this.#O.push(Padding),this.#R+=WordSize,t=>{this.#O[e]=getValue$3(t)}}},Reader$4=class e{allowLoose;#O;#N;#M;#j;#F;constructor(e,t,r){defineProperties$2(this,{allowLoose:!!t}),this.#O=getBytesCopy(e),this.#M=0,this.#j=null,this.#F=null!=r?r:1024,this.#N=0}get data(){return hexlify(this.#O)}get dataLength(){return this.#O.length}get consumed(){return this.#N}get bytes(){return new Uint8Array(this.#O)}#L(e){if(this.#j)return this.#j.#L(e);this.#M+=e,assert$j(this.#F<1||this.#M<=this.#F*this.dataLength,`compressed ABI data exceeds inflation ratio of ${this.#F} ( see: https://github.com/ethers-io/ethers.js/issues/4537 )`,"BUFFER_OVERRUN",{buffer:getBytesCopy(this.#O),offset:this.#N,length:e,info:{bytesRead:this.#M,dataLength:this.dataLength}})}#U(e,t,r){let n=Math.ceil(t/WordSize)*WordSize;return this.#N+n>this.#O.length&&(this.allowLoose&&r&&this.#N+t<=this.#O.length?n=t:assert$j(!1,"data out-of-bounds","BUFFER_OVERRUN",{buffer:getBytesCopy(this.#O),length:this.#O.length,offset:this.#N+n})),this.#O.slice(this.#N,this.#N+n)}subReader(t){const r=new e(this.#O.slice(this.#N+t),this.allowLoose,this.#F);return r.#j=this,r}readBytes(e,t){let r=this.#U(0,e,!!t);return this.#L(e),this.#N+=r.length,r.slice(0,e)}readValue(){return toBigInt(this.readBytes(WordSize))}readIndex(){return toNumber$3(this.readBytes(WordSize))}};function number$5(e){if(!Number.isSafeInteger(e)||e<0)throw new Error(`Wrong positive integer: ${e}`)}function bytes$3(e,...t){if(!(e instanceof Uint8Array))throw new Error("Expected Uint8Array");if(t.length>0&&!t.includes(e.length))throw new Error(`Expected Uint8Array of length ${t}, not of length=${e.length}`)}function hash$9(e){if("function"!=typeof e||"function"!=typeof e.create)throw new Error("Hash should be wrapped by utils.wrapConstructor");number$5(e.outputLen),number$5(e.blockLen)}function exists$2(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function output$1(e,t){bytes$3(e);const r=t.outputLen;if(e.length<r)throw new Error(`digestInto() expects output buffer of length at least ${r}`)}const crypto$7="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,u8a$1=e=>e instanceof Uint8Array,u32=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),createView=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),rotr=(e,t)=>e<<32-t|e>>>t,isLE=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0];
|
|
9
9
|
/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */if(!isLE)throw new Error("Non little-endian hardware is not supported");function utf8ToBytes$2(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}function toBytes(e){if("string"==typeof e&&(e=utf8ToBytes$2(e)),!u8a$1(e))throw new Error("expected Uint8Array, got "+typeof e);return e}function concatBytes$1(...e){const t=new Uint8Array(e.reduce(((e,t)=>e+t.length),0));let r=0;return e.forEach((e=>{if(!u8a$1(e))throw new Error("Uint8Array expected");t.set(e,r),r+=e.length})),t}let Hash$1=class{clone(){return this._cloneInto()}};function wrapConstructor(e){const t=t=>e().update(toBytes(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function randomBytes(e=32){if(crypto$7&&"function"==typeof crypto$7.getRandomValues)return crypto$7.getRandomValues(new Uint8Array(e));throw new Error("crypto.getRandomValues must be defined")}let HMAC$1=class extends Hash$1{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,hash$9(e);const r=toBytes(t);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const n=this.blockLen,i=new Uint8Array(n);i.set(r.length>n?e.create().update(r).digest():r);for(let e=0;e<i.length;e++)i[e]^=54;this.iHash.update(i),this.oHash=e.create();for(let e=0;e<i.length;e++)i[e]^=106;this.oHash.update(i),i.fill(0)}update(e){return exists$2(this),this.iHash.update(e),this}digestInto(e){exists$2(this),bytes$3(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:t,iHash:r,finished:n,destroyed:i,blockLen:o,outputLen:a}=this;return e.finished=n,e.destroyed=i,e.blockLen=o,e.outputLen=a,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};const hmac$9=(e,t,r)=>new HMAC$1(e,t).update(r).digest();function setBigUint64$1(e,t,r,n){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,n);const i=BigInt(32),o=BigInt(4294967295),a=Number(r>>i&o),s=Number(r&o),c=n?4:0,l=n?0:4;e.setUint32(t+c,a,n),e.setUint32(t+l,s,n)}hmac$9.create=(e,t)=>new HMAC$1(e,t);class SHA2 extends Hash$1{constructor(e,t,r,n){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=createView(this.buffer)}update(e){exists$2(this);const{view:t,buffer:r,blockLen:n}=this,i=(e=toBytes(e)).length;for(let o=0;o<i;){const a=Math.min(n-this.pos,i-o);if(a!==n)r.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===n&&(this.process(t,0),this.pos=0);else{const t=createView(e);for(;n<=i-o;o+=n)this.process(t,o)}}return this.length+=e.length,this.roundClean(),this}digestInto(e){exists$2(this),output$1(e,this),this.finished=!0;const{buffer:t,view:r,blockLen:n,isLE:i}=this;let{pos:o}=this;t[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>n-o&&(this.process(r,0),o=0);for(let e=o;e<n;e++)t[e]=0;setBigUint64$1(r,n-8,BigInt(8*this.length),i),this.process(r,0);const a=createView(e),s=this.outputLen;if(s%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=s/4,l=this.get();if(c>l.length)throw new Error("_sha2: outputLen bigger than state");for(let e=0;e<c;e++)a.setUint32(4*e,l[e],i)}digest(){const{buffer:e,outputLen:t}=this;this.digestInto(e);const r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:t,buffer:r,length:n,finished:i,destroyed:o,pos:a}=this;return e.length=n,e.pos=a,e.finished=i,e.destroyed=o,n%t&&e.buffer.set(r),e}}const Chi$1=(e,t,r)=>e&t^~e&r,Maj$1=(e,t,r)=>e&t^e&r^t&r,SHA256_K$1=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),IV=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),SHA256_W$1=new Uint32Array(64);let SHA256$3=class extends SHA2{constructor(){super(64,32,8,!1),this.A=0|IV[0],this.B=0|IV[1],this.C=0|IV[2],this.D=0|IV[3],this.E=0|IV[4],this.F=0|IV[5],this.G=0|IV[6],this.H=0|IV[7]}get(){const{A:e,B:t,C:r,D:n,E:i,F:o,G:a,H:s}=this;return[e,t,r,n,i,o,a,s]}set(e,t,r,n,i,o,a,s){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|o,this.G=0|a,this.H=0|s}process(e,t){for(let r=0;r<16;r++,t+=4)SHA256_W$1[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){const t=SHA256_W$1[e-15],r=SHA256_W$1[e-2],n=rotr(t,7)^rotr(t,18)^t>>>3,i=rotr(r,17)^rotr(r,19)^r>>>10;SHA256_W$1[e]=i+SHA256_W$1[e-7]+n+SHA256_W$1[e-16]|0}let{A:r,B:n,C:i,D:o,E:a,F:s,G:c,H:l}=this;for(let e=0;e<64;e++){const t=l+(rotr(a,6)^rotr(a,11)^rotr(a,25))+Chi$1(a,s,c)+SHA256_K$1[e]+SHA256_W$1[e]|0,u=(rotr(r,2)^rotr(r,13)^rotr(r,22))+Maj$1(r,n,i)|0;l=c,c=s,s=a,a=o+t|0,o=i,i=n,n=r,r=t+u|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,o=o+this.D|0,a=a+this.E|0,s=s+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(r,n,i,o,a,s,c,l)}roundClean(){SHA256_W$1.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}};const sha256$6=wrapConstructor((()=>new SHA256$3)),U32_MASK64$1=BigInt(2**32-1),_32n$1=BigInt(32);function fromBig$1(e,t=!1){return t?{h:Number(e&U32_MASK64$1),l:Number(e>>_32n$1&U32_MASK64$1)}:{h:0|Number(e>>_32n$1&U32_MASK64$1),l:0|Number(e&U32_MASK64$1)}}function split$2(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let i=0;i<e.length;i++){const{h:o,l:a}=fromBig$1(e[i],t);[r[i],n[i]]=[o,a]}return[r,n]}const toBig$1=(e,t)=>BigInt(e>>>0)<<_32n$1|BigInt(t>>>0),shrSH$1=(e,t,r)=>e>>>r,shrSL$1=(e,t,r)=>e<<32-r|t>>>r,rotrSH$1=(e,t,r)=>e>>>r|t<<32-r,rotrSL$1=(e,t,r)=>e<<32-r|t>>>r,rotrBH$1=(e,t,r)=>e<<64-r|t>>>r-32,rotrBL$1=(e,t,r)=>e>>>r-32|t<<64-r,rotr32H$1=(e,t)=>t,rotr32L$1=(e,t)=>e,rotlSH$1=(e,t,r)=>e<<r|t>>>32-r,rotlSL$1=(e,t,r)=>t<<r|e>>>32-r,rotlBH$1=(e,t,r)=>t<<r-32|e>>>64-r,rotlBL$1=(e,t,r)=>e<<r-32|t>>>64-r;function add$1(e,t,r,n){const i=(t>>>0)+(n>>>0);return{h:e+r+(i/2**32|0)|0,l:0|i}}const add3L$1=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),add3H$1=(e,t,r,n)=>t+r+n+(e/2**32|0)|0,add4L$1=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),add4H$1=(e,t,r,n,i)=>t+r+n+i+(e/2**32|0)|0,add5L$1=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0),add5H$1=(e,t,r,n,i,o)=>t+r+n+i+o+(e/2**32|0)|0,u64$1={fromBig:fromBig$1,split:split$2,toBig:toBig$1,shrSH:shrSH$1,shrSL:shrSL$1,rotrSH:rotrSH$1,rotrSL:rotrSL$1,rotrBH:rotrBH$1,rotrBL:rotrBL$1,rotr32H:rotr32H$1,rotr32L:rotr32L$1,rotlSH:rotlSH$1,rotlSL:rotlSL$1,rotlBH:rotlBH$1,rotlBL:rotlBL$1,add:add$1,add3L:add3L$1,add3H:add3H$1,add4L:add4L$1,add4H:add4H$1,add5H:add5H$1,add5L:add5L$1},[SHA512_Kh$1,SHA512_Kl$1]=(()=>u64$1.split(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0x5cb0a9dcbd41fbd4","0x76f988da831153b5","0x983e5152ee66dfab","0xa831c66d2db43210","0xb00327c898fb213f","0xbf597fc7beef0ee4","0xc6e00bf33da88fc2","0xd5a79147930aa725","0x06ca6351e003826f","0x142929670a0e6e70","0x27b70a8546d22ffc","0x2e1b21385c26c926","0x4d2c6dfc5ac42aed","0x53380d139d95b3df","0x650a73548baf63de","0x766a0abb3c77b2a8","0x81c2c92e47edaee6","0x92722c851482353b","0xa2bfe8a14cf10364","0xa81a664bbc423001","0xc24b8b70d0f89791","0xc76c51a30654be30","0xd192e819d6ef5218","0xd69906245565a910","0xf40e35855771202a","0x106aa07032bbd1b8","0x19a4c116b8d2d0c8","0x1e376c085141ab53","0x2748774cdf8eeb99","0x34b0bcb5e19b48a8","0x391c0cb3c5c95a63","0x4ed8aa4ae3418acb","0x5b9cca4f7763e373","0x682e6ff3d6b2b8a3","0x748f82ee5defb2fc","0x78a5636f43172f60","0x84c87814a1f0ab72","0x8cc702081a6439ec","0x90befffa23631e28","0xa4506cebde82bde9","0xbef9a3f7b2c67915","0xc67178f2e372532b","0xca273eceea26619c","0xd186b8c721c0c207","0xeada7dd6cde0eb1e","0xf57d4f7fee6ed178","0x06f067aa72176fba","0x0a637dc5a2c898a6","0x113f9804bef90dae","0x1b710b35131c471b","0x28db77f523047d84","0x32caab7b40c72493","0x3c9ebe0a15c9bebc","0x431d67c49c100d4c","0x4cc5d4becb3e42b6","0x597f299cfc657e2a","0x5fcb6fab3ad6faec","0x6c44198c4a475817"].map((e=>BigInt(e)))))(),SHA512_W_H$1=new Uint32Array(80),SHA512_W_L$1=new Uint32Array(80);let SHA512$3=class extends SHA2{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:t,Bh:r,Bl:n,Ch:i,Cl:o,Dh:a,Dl:s,Eh:c,El:l,Fh:u,Fl:d,Gh:p,Gl:f,Hh:h,Hl:g}=this;return[e,t,r,n,i,o,a,s,c,l,u,d,p,f,h,g]}set(e,t,r,n,i,o,a,s,c,l,u,d,p,f,h,g){this.Ah=0|e,this.Al=0|t,this.Bh=0|r,this.Bl=0|n,this.Ch=0|i,this.Cl=0|o,this.Dh=0|a,this.Dl=0|s,this.Eh=0|c,this.El=0|l,this.Fh=0|u,this.Fl=0|d,this.Gh=0|p,this.Gl=0|f,this.Hh=0|h,this.Hl=0|g}process(e,t){for(let r=0;r<16;r++,t+=4)SHA512_W_H$1[r]=e.getUint32(t),SHA512_W_L$1[r]=e.getUint32(t+=4);for(let e=16;e<80;e++){const t=0|SHA512_W_H$1[e-15],r=0|SHA512_W_L$1[e-15],n=u64$1.rotrSH(t,r,1)^u64$1.rotrSH(t,r,8)^u64$1.shrSH(t,r,7),i=u64$1.rotrSL(t,r,1)^u64$1.rotrSL(t,r,8)^u64$1.shrSL(t,r,7),o=0|SHA512_W_H$1[e-2],a=0|SHA512_W_L$1[e-2],s=u64$1.rotrSH(o,a,19)^u64$1.rotrBH(o,a,61)^u64$1.shrSH(o,a,6),c=u64$1.rotrSL(o,a,19)^u64$1.rotrBL(o,a,61)^u64$1.shrSL(o,a,6),l=u64$1.add4L(i,c,SHA512_W_L$1[e-7],SHA512_W_L$1[e-16]),u=u64$1.add4H(l,n,s,SHA512_W_H$1[e-7],SHA512_W_H$1[e-16]);SHA512_W_H$1[e]=0|u,SHA512_W_L$1[e]=0|l}let{Ah:r,Al:n,Bh:i,Bl:o,Ch:a,Cl:s,Dh:c,Dl:l,Eh:u,El:d,Fh:p,Fl:f,Gh:h,Gl:g,Hh:A,Hl:m}=this;for(let e=0;e<80;e++){const t=u64$1.rotrSH(u,d,14)^u64$1.rotrSH(u,d,18)^u64$1.rotrBH(u,d,41),y=u64$1.rotrSL(u,d,14)^u64$1.rotrSL(u,d,18)^u64$1.rotrBL(u,d,41),b=u&p^~u&h,v=d&f^~d&g,I=u64$1.add5L(m,y,v,SHA512_Kl$1[e],SHA512_W_L$1[e]),_=u64$1.add5H(I,A,t,b,SHA512_Kh$1[e],SHA512_W_H$1[e]),C=0|I,E=u64$1.rotrSH(r,n,28)^u64$1.rotrBH(r,n,34)^u64$1.rotrBH(r,n,39),w=u64$1.rotrSL(r,n,28)^u64$1.rotrBL(r,n,34)^u64$1.rotrBL(r,n,39),S=r&i^r&a^i&a,x=n&o^n&s^o&s;A=0|h,m=0|g,h=0|p,g=0|f,p=0|u,f=0|d,({h:u,l:d}=u64$1.add(0|c,0|l,0|_,0|C)),c=0|a,l=0|s,a=0|i,s=0|o,i=0|r,o=0|n;const T=u64$1.add3L(C,w,x);r=u64$1.add3H(T,_,E,S),n=0|T}({h:r,l:n}=u64$1.add(0|this.Ah,0|this.Al,0|r,0|n)),({h:i,l:o}=u64$1.add(0|this.Bh,0|this.Bl,0|i,0|o)),({h:a,l:s}=u64$1.add(0|this.Ch,0|this.Cl,0|a,0|s)),({h:c,l:l}=u64$1.add(0|this.Dh,0|this.Dl,0|c,0|l)),({h:u,l:d}=u64$1.add(0|this.Eh,0|this.El,0|u,0|d)),({h:p,l:f}=u64$1.add(0|this.Fh,0|this.Fl,0|p,0|f)),({h:h,l:g}=u64$1.add(0|this.Gh,0|this.Gl,0|h,0|g)),({h:A,l:m}=u64$1.add(0|this.Hh,0|this.Hl,0|A,0|m)),this.set(r,n,i,o,a,s,c,l,u,d,p,f,h,g,A,m)}roundClean(){SHA512_W_H$1.fill(0),SHA512_W_L$1.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}};const sha512$5=wrapConstructor((()=>new SHA512$3));function getGlobal$2(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("unable to locate global object")}const anyGlobal=getGlobal$2();function createHash(e){switch(e){case"sha256":return sha256$6.create();case"sha512":return sha512$5.create()}assertArgument(!1,"invalid hashing algorithm name","algorithm",e)}anyGlobal.crypto||anyGlobal.msCrypto;const[SHA3_PI$1,SHA3_ROTL$1,_SHA3_IOTA$1]=[[],[],[]],_0n$5=BigInt(0),_1n$6=BigInt(1),_2n$4=BigInt(2),_7n$1=BigInt(7),_256n$1=BigInt(256),_0x71n$1=BigInt(113);for(let e=0,t=_1n$6,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],SHA3_PI$1.push(2*(5*n+r)),SHA3_ROTL$1.push((e+1)*(e+2)/2%64);let i=_0n$5;for(let e=0;e<7;e++)t=(t<<_1n$6^(t>>_7n$1)*_0x71n$1)%_256n$1,t&_2n$4&&(i^=_1n$6<<(_1n$6<<BigInt(e))-_1n$6);_SHA3_IOTA$1.push(i)}const[SHA3_IOTA_H$1,SHA3_IOTA_L$1]=split$2(_SHA3_IOTA$1,!0),rotlH$1=(e,t,r)=>r>32?rotlBH$1(e,t,r):rotlSH$1(e,t,r),rotlL$1=(e,t,r)=>r>32?rotlBL$1(e,t,r):rotlSL$1(e,t,r);function keccakP$1(e,t=24){const r=new Uint32Array(10);for(let n=24-t;n<24;n++){for(let t=0;t<10;t++)r[t]=e[t]^e[t+10]^e[t+20]^e[t+30]^e[t+40];for(let t=0;t<10;t+=2){const n=(t+8)%10,i=(t+2)%10,o=r[i],a=r[i+1],s=rotlH$1(o,a,1)^r[n],c=rotlL$1(o,a,1)^r[n+1];for(let r=0;r<50;r+=10)e[t+r]^=s,e[t+r+1]^=c}let t=e[2],i=e[3];for(let r=0;r<24;r++){const n=SHA3_ROTL$1[r],o=rotlH$1(t,i,n),a=rotlL$1(t,i,n),s=SHA3_PI$1[r];t=e[s],i=e[s+1],e[s]=o,e[s+1]=a}for(let t=0;t<50;t+=10){for(let n=0;n<10;n++)r[n]=e[t+n];for(let n=0;n<10;n++)e[t+n]^=~r[(n+2)%10]&r[(n+4)%10]}e[0]^=SHA3_IOTA_H$1[n],e[1]^=SHA3_IOTA_L$1[n]}r.fill(0)}let Keccak$1=class e extends Hash$1{constructor(e,t,r,n=!1,i=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=n,this.rounds=i,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,number$5(r),0>=this.blockLen||this.blockLen>=200)throw new Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=u32(this.state)}keccak(){keccakP$1(this.state32,this.rounds),this.posOut=0,this.pos=0}update(e){exists$2(this);const{blockLen:t,state:r}=this,n=(e=toBytes(e)).length;for(let i=0;i<n;){const o=Math.min(t-this.pos,n-i);for(let t=0;t<o;t++)r[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:t,pos:r,blockLen:n}=this;e[r]^=t,128&t&&r===n-1&&this.keccak(),e[n-1]^=128,this.keccak()}writeInto(e){exists$2(this,!1),bytes$3(e),this.finish();const t=this.state,{blockLen:r}=this;for(let n=0,i=e.length;n<i;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,i-n);e.set(t.subarray(this.posOut,this.posOut+o),n),this.posOut+=o,n+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return number$5(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(output$1(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,this.state.fill(0)}_cloneInto(t){const{blockLen:r,suffix:n,outputLen:i,rounds:o,enableXOF:a}=this;return t||(t=new e(r,n,i,a,o)),t.state32.set(this.state32),t.pos=this.pos,t.posOut=this.posOut,t.finished=this.finished,t.rounds=o,t.suffix=n,t.outputLen=i,t.enableXOF=a,t.destroyed=this.destroyed,t}};const gen$1=(e,t,r)=>wrapConstructor((()=>new Keccak$1(t,e,r))),keccak_256=gen$1(1,136,32);let locked=!1;const _keccak256=function(e){return keccak_256(e)};let __keccak256=_keccak256;function keccak256$2(e){const t=getBytes(e,"data");return hexlify(__keccak256(t))}keccak256$2._=_keccak256,keccak256$2.lock=function(){locked=!0},keccak256$2.register=function(e){if(locked)throw new TypeError("keccak256 is locked");__keccak256=e},Object.freeze(keccak256$2);const _sha256=function(e){return createHash("sha256").update(e).digest()};let __sha256=_sha256,locked256=!1;function sha256$5(e){const t=getBytes(e,"data");return hexlify(__sha256(t))}sha256$5._=_sha256,sha256$5.lock=function(){locked256=!0},sha256$5.register=function(e){if(locked256)throw new Error("sha256 is locked");__sha256=e},Object.freeze(sha256$5),Object.freeze(sha256$5);
|
|
10
10
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
11
11
|
const _0n$4=BigInt(0),_1n$5=BigInt(1),_2n$3=BigInt(2),u8a=e=>e instanceof Uint8Array,hexes=Array.from({length:256},((e,t)=>t.toString(16).padStart(2,"0")));function bytesToHex(e){if(!u8a(e))throw new Error("Uint8Array expected");let t="";for(let r=0;r<e.length;r++)t+=hexes[e[r]];return t}function numberToHexUnpadded(e){const t=e.toString(16);return 1&t.length?`0${t}`:t}function hexToNumber(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);return BigInt(""===e?"0":`0x${e}`)}function hexToBytes(e){if("string"!=typeof e)throw new Error("hex string expected, got "+typeof e);const t=e.length;if(t%2)throw new Error("padded hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(t/2);for(let t=0;t<r.length;t++){const n=2*t,i=e.slice(n,n+2),o=Number.parseInt(i,16);if(Number.isNaN(o)||o<0)throw new Error("Invalid byte sequence");r[t]=o}return r}function bytesToNumberBE(e){return hexToNumber(bytesToHex(e))}function bytesToNumberLE(e){if(!u8a(e))throw new Error("Uint8Array expected");return hexToNumber(bytesToHex(Uint8Array.from(e).reverse()))}function numberToBytesBE(e,t){return hexToBytes(e.toString(16).padStart(2*t,"0"))}function numberToBytesLE(e,t){return numberToBytesBE(e,t).reverse()}function numberToVarBytesBE(e){return hexToBytes(numberToHexUnpadded(e))}function ensureBytes$1(e,t,r){let n;if("string"==typeof t)try{n=hexToBytes(t)}catch(r){throw new Error(`${e} must be valid hex string, got "${t}". Cause: ${r}`)}else{if(!u8a(t))throw new Error(`${e} must be hex string or Uint8Array`);n=Uint8Array.from(t)}const i=n.length;if("number"==typeof r&&i!==r)throw new Error(`${e} expected ${r} bytes, got ${i}`);return n}function concatBytes(...e){const t=new Uint8Array(e.reduce(((e,t)=>e+t.length),0));let r=0;return e.forEach((e=>{if(!u8a(e))throw new Error("Uint8Array expected");t.set(e,r),r+=e.length})),t}function equalBytes(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++)if(e[r]!==t[r])return!1;return!0}function utf8ToBytes$1(e){if("string"!=typeof e)throw new Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array((new TextEncoder).encode(e))}function bitLen(e){let t;for(t=0;e>_0n$4;e>>=_1n$5,t+=1);return t}function bitGet(e,t){return e>>BigInt(t)&_1n$5}const bitSet=(e,t,r)=>e|(r?_1n$5:_0n$4)<<BigInt(t),bitMask=e=>(_2n$3<<BigInt(e-1))-_1n$5,u8n=e=>new Uint8Array(e),u8fr=e=>Uint8Array.from(e);function createHmacDrbg(e,t,r){if("number"!=typeof e||e<2)throw new Error("hashLen must be a number");if("number"!=typeof t||t<2)throw new Error("qByteLen must be a number");if("function"!=typeof r)throw new Error("hmacFn must be a function");let n=u8n(e),i=u8n(e),o=0;const a=()=>{n.fill(1),i.fill(0),o=0},s=(...e)=>r(i,n,...e),c=(e=u8n())=>{i=s(u8fr([0]),e),n=s(),0!==e.length&&(i=s(u8fr([1]),e),n=s())},l=()=>{if(o++>=1e3)throw new Error("drbg: tried 1000 values");let e=0;const r=[];for(;e<t;){n=s();const t=n.slice();r.push(t),e+=n.length}return concatBytes(...r)};return(e,t)=>{let r;for(a(),c(e);!(r=t(l()));)c();return a(),r}}const validatorFns={bigint:e=>"bigint"==typeof e,function:e=>"function"==typeof e,boolean:e=>"boolean"==typeof e,string:e=>"string"==typeof e,stringOrUint8Array:e=>"string"==typeof e||e instanceof Uint8Array,isSafeInteger:e=>Number.isSafeInteger(e),array:e=>Array.isArray(e),field:(e,t)=>t.Fp.isValid(e),hash:e=>"function"==typeof e&&Number.isSafeInteger(e.outputLen)};function validateObject(e,t,r={}){const n=(t,r,n)=>{const i=validatorFns[r];if("function"!=typeof i)throw new Error(`Invalid validator "${r}", expected function`);const o=e[t];if(!(n&&void 0===o||i(o,e)))throw new Error(`Invalid param ${String(t)}=${o} (${typeof o}), expected ${r}`)};for(const[e,r]of Object.entries(t))n(e,r,!1);for(const[e,t]of Object.entries(r))n(e,t,!0);return e}var ut$3=Object.freeze({__proto__:null,bitGet:bitGet,bitLen:bitLen,bitMask:bitMask,bitSet:bitSet,bytesToHex:bytesToHex,bytesToNumberBE:bytesToNumberBE,bytesToNumberLE:bytesToNumberLE,concatBytes:concatBytes,createHmacDrbg:createHmacDrbg,ensureBytes:ensureBytes$1,equalBytes:equalBytes,hexToBytes:hexToBytes,hexToNumber:hexToNumber,numberToBytesBE:numberToBytesBE,numberToBytesLE:numberToBytesLE,numberToHexUnpadded:numberToHexUnpadded,numberToVarBytesBE:numberToVarBytesBE,utf8ToBytes:utf8ToBytes$1,validateObject:validateObject});
|