1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8687],{22130:function(e){"use strict";var t=Object.prototype.hasOwnProperty,r="~";function n(){}function i(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function s(e,t,n,s,o){if("function"!=typeof n)throw TypeError("The listener must be a function");var a=new i(n,s||e,o),l=r?r+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],a]:e._events[l].push(a):(e._events[l]=a,e._eventsCount++),e}function o(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function a(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1)),a.prototype.eventNames=function(){var e,n,i=[];if(0===this._eventsCount)return i;for(n in e=this._events)t.call(e,n)&&i.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},a.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,s=n.length,o=Array(s);i<s;i++)o[i]=n[i].fn;return o},a.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},a.prototype.emit=function(e,t,n,i,s,o){var a=r?r+e:e;if(!this._events[a])return!1;var l,c,u=this._events[a],f=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),f){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,n),!0;case 4:return u.fn.call(u.context,t,n,i),!0;case 5:return u.fn.call(u.context,t,n,i,s),!0;case 6:return u.fn.call(u.context,t,n,i,s,o),!0}for(c=1,l=Array(f-1);c<f;c++)l[c-1]=arguments[c];u.fn.apply(u.context,l)}else{var h,d=u.length;for(c=0;c<d;c++)switch(u[c].once&&this.removeListener(e,u[c].fn,void 0,!0),f){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,t);break;case 3:u[c].fn.call(u[c].context,t,n);break;case 4:u[c].fn.call(u[c].context,t,n,i);break;default:if(!l)for(h=1,l=Array(f-1);h<f;h++)l[h-1]=arguments[h];u[c].fn.apply(u[c].context,l)}}return!0},a.prototype.on=function(e,t,r){return s(this,e,t,r,!1)},a.prototype.once=function(e,t,r){return s(this,e,t,r,!0)},a.prototype.removeListener=function(e,t,n,i){var s=r?r+e:e;if(!this._events[s])return this;if(!t)return o(this,s),this;var a=this._events[s];if(a.fn)a.fn!==t||i&&!a.once||n&&a.context!==n||o(this,s);else{for(var l=0,c=[],u=a.length;l<u;l++)(a[l].fn!==t||i&&!a[l].once||n&&a[l].context!==n)&&c.push(a[l]);c.length?this._events[s]=1===c.length?c[0]:c:o(this,s)}return this},a.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&o(this,t)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=r,a.EventEmitter=a,e.exports=a},24459:function(e,t,r){"use strict";t._O=t.Jq=t.KB=t.u8=t.cv=void 0,t.Ik=t.A9=t.n_=t.gM=void 0;let n=r(9109);function i(e){if(!(e instanceof Uint8Array))throw TypeError("b must be a Uint8Array")}function s(e){return i(e),n.Buffer.from(e.buffer,e.byteOffset,e.length)}class o{constructor(e,t){if(!Number.isInteger(e))throw TypeError("span must be an integer");this.span=e,this.property=t}makeDestinationObject(){return{}}getSpan(e,t){if(0>this.span)throw RangeError("indeterminate span");return this.span}replicate(e){let t=Object.create(this.constructor.prototype);return Object.assign(t,this),t.property=e,t}fromArray(e){}}function a(e,t){return t.property?e+"["+t.property+"]":e}class l extends o{isCount(){throw Error("ExternalLayout is abstract")}}class c extends l{constructor(e,t=0,r){if(!(e instanceof o))throw TypeError("layout must be a Layout");if(!Number.isInteger(t))throw TypeError("offset must be integer or undefined");super(e.span,r||e.property),this.layout=e,this.offset=t}isCount(){return this.layout instanceof u||this.layout instanceof f}decode(e,t=0){return this.layout.decode(e,t+this.offset)}encode(e,t,r=0){return this.layout.encode(e,t,r+this.offset)}}class u extends o{constructor(e,t){if(super(e,t),6<this.span)throw RangeError("span must not exceed 6 bytes")}decode(e,t=0){return s(e).readUIntLE(t,this.span)}encode(e,t,r=0){return s(t).writeUIntLE(e,r,this.span),this.span}}class f extends o{constructor(e,t){if(super(e,t),6<this.span)throw RangeError("span must not exceed 6 bytes")}decode(e,t=0){return s(e).readUIntBE(t,this.span)}encode(e,t,r=0){return s(t).writeUIntBE(e,r,this.span),this.span}}function h(e){let t=Math.floor(e/4294967296);return{hi32:t,lo32:e-4294967296*t}}function d(e,t){return 4294967296*e+t}class p extends o{constructor(e){super(8,e)}decode(e,t=0){let r=s(e),n=r.readUInt32LE(t);return d(r.readUInt32LE(t+4),n)}encode(e,t,r=0){let n=h(e),i=s(t);return i.writeUInt32LE(n.lo32,r),i.writeUInt32LE(n.hi32,r+4),8}}class g extends o{constructor(e){super(8,e)}decode(e,t=0){let r=s(e),n=r.readUInt32LE(t);return d(r.readInt32LE(t+4),n)}encode(e,t,r=0){let n=h(e),i=s(t);return i.writeUInt32LE(n.lo32,r),i.writeInt32LE(n.hi32,r+4),8}}class y extends o{constructor(e,t,r){if(!(e instanceof o))throw TypeError("elementLayout must be a Layout");if(!(t instanceof l&&t.isCount()||Number.isInteger(t)&&0<=t))throw TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let n=-1;t instanceof l||!(0<e.span)||(n=t*e.span),super(n,r),this.elementLayout=e,this.count=t}getSpan(e,t=0){if(0<=this.span)return this.span;let r=0,n=this.count;if(n instanceof l&&(n=n.decode(e,t)),0<this.elementLayout.span)r=n*this.elementLayout.span;else{let i=0;for(;i<n;)r+=this.elementLayout.getSpan(e,t+r),++i}return r}decode(e,t=0){let r=[],n=0,i=this.count;for(i instanceof l&&(i=i.decode(e,t));n<i;)r.push(this.elementLayout.decode(e,t)),t+=this.elementLayout.getSpan(e,t),n+=1;return r}encode(e,t,r=0){let n=this.elementLayout,i=e.reduce((e,i)=>e+n.encode(i,t,r+e),0);return this.count instanceof l&&this.count.encode(e.length,t,r),i}}class m extends o{constructor(e,t,r){if(!(Array.isArray(e)&&e.reduce((e,t)=>
1e&&t instanceof o,!0)))throw TypeError("fields must be array of Layout instances");for(let n of("boolean"==typeof t&&void 0===r&&(r=t,t=void 0),e))if(0>n.span&&void 0===n.property)throw Error("fields cannot contain unnamed variable-length layout");let n=-1;try{n=e.reduce((e,t)=>e+t.getSpan(),0)}catch(e){}super(n,t),this.fields=e,this.decodePrefixes=!!r}getSpan(e,t=0){if(0<=this.span)return this.span;let r=0;try{r=this.fields.reduce((r,n)=>{let i=n.getSpan(e,t);return t+=i,r+i},0)}catch(e){throw RangeError("indeterminate span")}return r}decode(e,t=0){i(e);let r=this.makeDestinationObject();for(let n of this.fields)if(void 0!==n.property&&(r[n.property]=n.decode(e,t)),t+=n.getSpan(e,t),this.decodePrefixes&&e.length===t)break;return r}encode(e,t,r=0){let n=r,i=0,s=0;for(let n of this.fields){let o=n.span;if(s=0<o?o:0,void 0!==n.property){let i=e[n.property];void 0!==i&&(s=n.encode(i,t,r),0>o&&(o=n.getSpan(t,r)))}i=r,r+=o}return i+s-n}fromArray(e){let t=this.makeDestinationObject();for(let r of this.fields)void 0!==r.property&&0<e.length&&(t[r.property]=e.shift());return t}layoutFor(e){if("string"!=typeof e)throw TypeError("property must be string");for(let t of this.fields)if(t.property===e)return t}offsetOf(e){if("string"!=typeof e)throw TypeError("property must be string");let t=0;for(let r of this.fields){if(r.property===e)return t;0>r.span?t=-1:0<=t&&(t+=r.span)}}}class b{constructor(e){this.property=e}decode(e,t){throw Error("UnionDiscriminator is abstract")}encode(e,t,r){throw Error("UnionDiscriminator is abstract")}}class w extends b{constructor(e,t){if(!(e instanceof l&&e.isCount()))throw TypeError("layout must be an unsigned integer ExternalLayout");super(t||e.property||"variant"),this.layout=e}decode(e,t){return this.layout.decode(e,t)}encode(e,t,r){return this.layout.encode(e,t,r)}}class v extends o{constructor(e,t,r){let n;if(e instanceof u||e instanceof f)n=new w(new c(e));else if(e instanceof l&&e.isCount())n=new w(e);else if(e instanceof b)n=e;else throw TypeError("discr must be a UnionDiscriminator or an unsigned integer layout");if(void 0===t&&(t=null),!(null===t||t instanceof o))throw TypeError("defaultLayout must be null or a Layout");if(null!==t){if(0>t.span)throw Error("defaultLayout must have constant span");void 0===t.property&&(t=t.replicate("content"))}let i=-1;t&&0<=(i=t.span)&&(e instanceof u||e instanceof f)&&(i+=n.layout.span),super(i,r),this.discriminator=n,this.usesPrefixDiscriminator=e instanceof u||e instanceof f,this.defaultLayout=t,this.registry={};let s=this.defaultGetSourceVariant.bind(this);this.getSourceVariant=function(e){return s(e)},this.configGetSourceVariant=function(e){s=e.bind(this)}}getSpan(e,t=0){if(0<=this.span)return this.span;let r=this.getVariant(e,t);if(!r)throw Error("unable to determine span for unrecognized variant");return r.getSpan(e,t)}defaultGetSourceVariant(e){if(Object.prototype.hasOwnProperty.call(e,this.discriminator.property)){if(this.defaultLayout&&this.defaultLayout.property&&Object.prototype.hasOwnProperty.call(e,this.defaultLayout.property))return;let t=this.registry[e[this.discriminator.property]];if(t&&(!t.layout||t.property&&Object.prototype.hasOwnProperty.call(e,t.property)))return t}else for(let t in this.registry){let r=this.registry[t];if(r.property&&Object.prototype.hasOwnProperty.call(e,r.property))return r}throw Error("unable to infer src variant")}decode(e,t=0){let r;let n=this.discriminator,i=n.decode(e,t),s=this.registry[i];if(void 0===s){let s=this.defaultLayout,o=0;this.usesPrefixDiscriminator&&(o=n.layout.span),(r=this.makeDestinationObject())[n.property]=i,r[s.property]=s.decode(e,t+o)}else r=s.decode(e,t);return r}encode(e,t,r=0){let n=this.getSourceVariant(e);if(void 0===n){let n=this.discriminator,i=this.defaultLayout,s=0;return this.usesPrefixDiscriminator&&(s=n.layout.span),n.encode(e[n.property],t,r),s+i.encode(e[i.property],t,r+s)}return n.encode(e,t,r)}addVariant(e,t,r){let n=new E(this,e,t,r);return this.registry[e]=n,n}getVariant(e,t=0){let r;return e instanceof Uint8Array?r=this.discriminator.decode(e,t):r=e,this.registry[r]}}class E extends o{constructor(e,t,r,n){if(!(e instanceof v))throw TypeError("union must be a Union");if(!Number.isInteger(t)||0>t)throw TypeError("variant must be a (non-negative) integer");if("string"==typeof r&&void 0===n&&(n=r,r=null),r){if(!(r instanceof o))throw TypeError("layout must be a Layout");
1if(null!==e.defaultLayout&&0<=r.span&&r.span>e.defaultLayout.span)throw Error("variant span exceeds span of containing union");if("string"!=typeof n)throw TypeError("variant must have a String property")}let i=e.span;0>e.span&&0<=(i=r?r.span:0)&&e.usesPrefixDiscriminator&&(i+=e.discriminator.layout.span),super(i,n),this.union=e,this.variant=t,this.layout=r||null}getSpan(e,t=0){if(0<=this.span)return this.span;let r=0;this.union.usesPrefixDiscriminator&&(r=this.union.discriminator.layout.span);let n=0;return this.layout&&(n=this.layout.getSpan(e,t+r)),r+n}decode(e,t=0){let r=this.makeDestinationObject();if(this!==this.union.getVariant(e,t))throw Error("variant mismatch");let n=0;return this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),this.layout?r[this.property]=this.layout.decode(e,t+n):this.property?r[this.property]=!0:this.union.usesPrefixDiscriminator&&(r[this.union.discriminator.property]=this.variant),r}encode(e,t,r=0){let n=0;if(this.union.usesPrefixDiscriminator&&(n=this.union.discriminator.layout.span),this.layout&&!Object.prototype.hasOwnProperty.call(e,this.property))throw TypeError("variant lacks property "+this.property);this.union.discriminator.encode(this.variant,t,r);let i=n;if(this.layout&&(this.layout.encode(e[this.property],t,r+n),i+=this.layout.getSpan(t,r+n),0<=this.union.span&&i>this.union.span))throw Error("encoded variant overruns containing union");return i}fromArray(e){if(this.layout)return this.layout.fromArray(e)}}function x(e){return 0>e&&(e+=4294967296),e}class _ extends o{constructor(e,t,r){if(!(e instanceof u||e instanceof f))throw TypeError("word must be a UInt or UIntBE layout");if("string"==typeof t&&void 0===r&&(r=t,t=!1),4<e.span)throw RangeError("word cannot exceed 32 bits");super(e.span,r),this.word=e,this.msb=!!t,this.fields=[];let n=0;this._packedSetValue=function(e){return n=x(e),this},this._packedGetValue=function(){return n}}decode(e,t=0){let r=this.makeDestinationObject(),n=this.word.decode(e,t);for(let t of(this._packedSetValue(n),this.fields))void 0!==t.property&&(r[t.property]=t.decode(e));return r}encode(e,t,r=0){let n=this.word.decode(t,r);for(let t of(this._packedSetValue(n),this.fields))if(void 0!==t.property){let r=e[t.property];void 0!==r&&t.encode(r)}return this.word.encode(this._packedGetValue(),t,r)}addField(e,t){let r=new A(this,e,t);return this.fields.push(r),r}addBoolean(e){let t=new S(this,e);return this.fields.push(t),t}fieldFor(e){if("string"!=typeof e)throw TypeError("property must be string");for(let t of this.fields)if(t.property===e)return t}}class A{constructor(e,t,r){if(!(e instanceof _))throw TypeError("container must be a BitStructure");if(!Number.isInteger(t)||0>=t)throw TypeError("bits must be positive integer");let n=8*e.span,i=e.fields.reduce((e,t)=>e+t.bits,0);if(t+i>n)throw Error("bits too long for span remainder ("+(n-i)+" of "+n+" remain)");this.container=e,this.bits=t,this.valueMask=(1<<t)-1,32===t&&(this.valueMask=4294967295),this.start=i,this.container.msb&&(this.start=n-i-t),this.wordMask=x(this.valueMask<<this.start),this.property=r}decode(e,t){return x(this.container._packedGetValue()&this.wordMask)>>>this.start}encode(e){if("number"!=typeof e||!Number.isInteger(e)||e!==x(e&this.valueMask))throw TypeError(a("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);let t=this.container._packedGetValue(),r=x(e<<this.start);this.container._packedSetValue(x(t&~this.wordMask)|r)}}class S extends A{constructor(e,t){super(e,1,t)}decode(e,t){return!!super.decode(e,t)}encode(e){"boolean"==typeof e&&(e=+e),super.encode(e)}}class I extends o{constructor(e,t){if(!(e instanceof l&&e.isCount()||Number.isInteger(e)&&0<=e))throw TypeError("length must be positive integer or an unsigned integer ExternalLayout");let r=-1;e instanceof l||(r=e),super(r,t),this.length=e}getSpan(e,t){let r=this.span;return 0>r&&(r=this.length.decode(e,t)),r}decode(e,t=0){let r=this.span;return 0>r&&(r=this.length.decode(e,t)),s(e).slice(t,t+r)}encode(e,t,r){let n=this.length;if(this.length instanceof l&&(n=e.length),!(e instanceof Uint8Array&&n===e.length))throw TypeError(a("Blob.encode",this)+" requires (length "+n+") Uint8Array as src");if(r+n>t.length)throw RangeError("encoding overruns Uint8Array");let i=s(e);return s(t).write(i.toString("hex"),r,n,"hex"),this.length instanceof l&&this.length.encode(n,t,r),n}}t.cv=(e,t,r)=>new c(e,t,r),t.u8=e=>new u(1,e),t.KB=e=>
1new u(2,e),t.Jq=e=>new u(4,e),t._O=e=>new p(e),t.gM=e=>new g(e),t.n_=(e,t,r)=>new m(e,t,r),t.A9=(e,t,r)=>new y(e,t,r),t.Ik=(e,t)=>new I(e,t)},15545:function(e,t,r){"use strict";var n=r(10632).Buffer;e.exports=function(e){if(e.length>=255)throw TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r<t.length;r++)t[r]=255;for(var i=0;i<e.length;i++){var s=e.charAt(i),o=s.charCodeAt(0);if(255!==t[o])throw TypeError(s+" is ambiguous");t[o]=i}var a=e.length,l=e.charAt(0),c=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function f(e){if("string"!=typeof e)throw TypeError("Expected String");if(0===e.length)return n.alloc(0);for(var r=0,i=0,s=0;e[r]===l;)i++,r++;for(var o=(e.length-r)*c+1>>>0,u=new Uint8Array(o);r<e.length;){var f=e.charCodeAt(r);if(f>255)return;var h=t[f];if(255===h)return;for(var d=0,p=o-1;(0!==h||d<s)&&-1!==p;p--,d++)h+=a*u[p]>>>0,u[p]=h%256>>>0,h=h/256>>>0;if(0!==h)throw Error("Non-zero carry");s=d,r++}for(var g=o-s;g!==o&&0===u[g];)g++;var y=n.allocUnsafe(i+(o-g));y.fill(0,0,i);for(var m=i;g!==o;)y[m++]=u[g++];return y}return{encode:function(t){if((Array.isArray(t)||t instanceof Uint8Array)&&(t=n.from(t)),!n.isBuffer(t))throw TypeError("Expected Buffer");if(0===t.length)return"";for(var r=0,i=0,s=0,o=t.length;s!==o&&0===t[s];)s++,r++;for(var c=(o-s)*u+1>>>0,f=new Uint8Array(c);s!==o;){for(var h=t[s],d=0,p=c-1;(0!==h||d<i)&&-1!==p;p--,d++)h+=256*f[p]>>>0,f[p]=h%a>>>0,h=h/a>>>0;if(0!==h)throw Error("Non-zero carry");i=d,s++}for(var g=c-i;g!==c&&0===f[g];)g++;for(var y=l.repeat(r);g<c;++g)y+=e.charAt(f[g]);return y},decodeUnsafe:f,decode:function(e){var t=f(e);if(t)return t;throw Error("Non-base"+a+" character")}}}},88443:function(e,t,r){var n=r(15545);e.exports=n("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},39016:function(e,t,r){"use strict";function n(){return(null===r.g||void 0===r.g?void 0:r.g.crypto)||(null===r.g||void 0===r.g?void 0:r.g.msCrypto)||{}}function i(){let e=n();return e.subtle||e.webkitSubtle}Object.defineProperty(t,"__esModule",{value:!0}),t.isBrowserCryptoAvailable=t.getSubtleCrypto=t.getBrowerCrypto=void 0,t.getBrowerCrypto=n,t.getSubtleCrypto=i,t.isBrowserCryptoAvailable=function(){return!!n()&&!!i()}},56010:function(e,t,r){"use strict";var n=r(25566);function i(){return"undefined"==typeof document&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product}function s(){return void 0!==n&&void 0!==n.versions&&void 0!==n.versions.node}Object.defineProperty(t,"__esModule",{value:!0}),t.isBrowser=t.isNode=t.isReactNative=void 0,t.isReactNative=i,t.isNode=s,t.isBrowser=function(){return!i()&&!s()}},60092:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let n=r(69637);n.__exportStar(r(39016),t),n.__exportStar(r(56010),t)},69637:function(e,t,r){"use strict";r.r(t),r.d(t,{__assign:function(){return s},__asyncDelegator:function(){return v},__asyncGenerator:function(){return w},__asyncValues:function(){return E},__await:function(){return b},__awaiter:function(){return u},__classPrivateFieldGet:function(){return S},__classPrivateFieldSet:function(){return I},__createBinding:function(){return h},__decorate:function(){return a},__exportStar:function(){return d},__extends:function(){return i},__generator:function(){return f},__importDefault:function(){return A},__importStar:function(){return _}
vendor: 5,093 bytes, lines 1-14
1,__makeTemplateObject:function(){return x},__metadata:function(){return c},__param:function(){return l},__read:function(){return g},__rest:function(){return o},__spread:function(){return y},__spreadArrays:function(){return m},__values:function(){return p}});/*! ***************************************************************************** 2Copyright (c) Microsoft Corporation. 3 4Permission to use, copy, modify, and/or distribute this software for any 5purpose with or without fee is hereby granted. 6 7THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 8REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 9AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 10INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 11LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 12OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 13PERFORMANCE OF THIS SOFTWARE. 14***************************************************************************** */var n=function(e,t){return(n=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function i(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var s=function(){return(s=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function o(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)0>t.indexOf(n[i])&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}function a(e,t,r,n){var i,s=arguments.length,o=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(o=(s<3?i(o):s>3?i(t,r,o):i(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o}function l(e,t){return function(r,n){t(r,n,e)}}function c(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function u(e,t,r,n){return new(r||(r=Promise))(function(i,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})}function f(e,t){var r,n,i,s,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(r)throw TypeError("Generator is already executing.");for(;o;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===s[0]||2===s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}}function h(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}function d(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||(t[r]=e[r])}function p(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function g(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,s=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=s.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(i)throw i.error}}return o}function y(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(g(arguments[t]));return e}function m(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;for(var n=Array(e),i=0,t=0;t<r;t++)for(var s=arguments[t],o=0,a=s.length;o<a;o++,i++)n[i]=s[o];return n}function b(e){return this instanceof b?(this.v=e,this):new b(e)}function w(e,t,r){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var n,i=r.apply(e,t||[]),s=[];return n={},o("next"),o("throw"),o("return"),n[Symbol.asyncIterator]=function(){return this},n;function o(e){i[e]&&(n[e]=function(t){return new Promise(function(r,n){
14s.push([e,t,r,n])>1||a(e,t)})})}function a(e,t){try{var r;(r=i[e](t)).value instanceof b?Promise.resolve(r.value.v).then(l,c):u(s[0][2],r)}catch(e){u(s[0][3],e)}}function l(e){a("next",e)}function c(e){a("throw",e)}function u(e,t){e(t),s.shift(),s.length&&a(s[0][0],s[0][1])}}function v(e){var t,r;return t={},n("next"),n("throw",function(e){throw e}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,i){t[n]=e[n]?function(t){return(r=!r)?{value:b(e[n](t)),done:"return"===n}:i?i(t):t}:i}}function E(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=p(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise(function(n,i){!function(e,t,r,n){Promise.resolve(n).then(function(t){e({value:t,done:r})},t)}(n,i,(t=e[r](t)).done,t.value)})}}}function x(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function _(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function A(e){return e&&e.__esModule?e:{default:e}}function S(e,t){if(!t.has(e))throw TypeError("attempted to get private field on non-instance");return t.get(e)}function I(e,t,r){if(!t.has(e))throw TypeError("attempted to set private field on non-instance");return t.set(e,r),r}},5942:function(e,t,r){"use strict";r.d(t,{q:function(){return n}});class n{}},77330:function(e,t,r){"use strict";r.d(t,{C$:function(){return c},Lx:function(){return l}});var n=r(68885),i=r(54574),s=r(5942);class o extends s.q{constructor(e){super()}}let a=i.FIVE_SECONDS,l={pulse:"heartbeat_pulse"};class c extends o{constructor(e){super(e),this.events=new n.EventEmitter,this.interval=a,this.interval=e?.interval||a}static async init(e){let t=new c(e);return await t.init(),t}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),(0,i.toMiliseconds)(this.interval))}pulse(){this.events.emit(l.pulse)}}},33374:function(e,t,r){"use strict";r.d(t,{Z:function(){return b},k:function(){return b}});var n=r(68885),i=r(55151),s=r.n(i),o=r(54112),a=r(40),l=Object.defineProperty,c=Object.defineProperties,u=Object.getOwnPropertyDescriptors,f=Object.getOwnPropertySymbols,h=Object.prototype.hasOwnProperty,d=Object.prototype.propertyIsEnumerable,p=(e,t,r)=>t in e?l(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,g=(e,t)=>{for(var r in t||(t={}))h.call(t,r)&&p(e,r,t[r]);if(f)for(var r of f(t))d.call(t,r)&&p(e,r,t[r]);return e},y=(e,t)=>c(e,u(t));let m={headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"};class b{constructor(e,t=!1){if(this.url=e,this.disableProviderPing=t,this.events=new n.EventEmitter,this.isAvailable=!1,this.registering=!1,!(0,a.isHttpUrl)(e))throw Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=t}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{let t=(0,o.u)(e),r=await (await s()(this.url,y(g({},m),{body:t}))).json();this.onPayload({data:r})}catch(t){this.onError(e.id,t)}}async register(e=this.url){if(!(0,a.isHttpUrl)(e))throw Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){let e=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=e||this.events.listenerCount("open")>=e)&&this.events.setMaxListeners(e+1),new Promise((e,t)=>{this.events.once("register_error",e=>{this.resetMaxListeners(),t(e)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return t(Error("HTTP connection is missing or invalid"));e()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){let t=(0,o.u)({id:1,jsonrpc:"2.0",method:"test",params:[]});await s()(e,y(g({},m),{body:t}))}this.onOpen()}catch(t){let e=this.parseError(t);throw this.events.emit("register_error",e),this.onClose(),e}}onOpen(){this.isAvailable=!0,this.registering=!1,this.events.emit("open")}onClose(){this.isAvailable=!1,this.registering=!1,this.events.emit("close")}onPayload(e){if(typeof e.data>"u")return;let t="string"==typeof e.data?(0,o.D)(e.data):e.data;this.events.emit("payload",t)}onError(e,t){let r=this.parseError(t),n=r.message||r.toString(),i=(0,a.formatJsonRpcError)(e,n);this.events.emit("payload",i)}parseError(e,t=this.url){return(0,a.parseConnectionError)(e,t,"HTTP")}
14resetMaxListeners(){this.events.getMaxListeners()>10&&this.events.setMaxListeners(10)}}},65657:function(e,t,r){"use strict";r.d(t,{r:function(){return s}});var n=r(68885),i=r(40);class s extends i.IJsonRpcProvider{constructor(e){super(e),this.events=new n.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async request(e,t){return this.requestStrict((0,i.formatJsonRpcRequest)(e.method,e.params||[],e.id||(0,i.getBigIntRpcId)().toString()),t)}async requestStrict(e,t){return new Promise(async(r,n)=>{if(!this.connection.connected)try{await this.open()}catch(e){n(e)}this.events.on(`${e.id}`,e=>{(0,i.isJsonRpcError)(e)?n(e.error):r(e.result)});try{await this.connection.send(e,t)}catch(e){n(e)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),(0,i.isJsonRpcResponse)(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&3e3===e.code&&this.events.emit("error",Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),"string"==typeof e&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}}},97924:function(e,t,r){"use strict";r.d(t,{CA:function(){return i},JV:function(){return a},O4:function(){return n},dQ:function(){return s},xK:function(){return o}});let n="INTERNAL_ERROR",i="SERVER_ERROR",s=[-32700,-32600,-32601,-32602,-32603],o={PARSE_ERROR:{code:-32700,message:"Parse error"},INVALID_REQUEST:{code:-32600,message:"Invalid Request"},METHOD_NOT_FOUND:{code:-32601,message:"Method not found"},INVALID_PARAMS:{code:-32602,message:"Invalid params"},[n]:{code:-32603,message:"Internal error"},[i]:{code:-32e3,message:"Server error"}},a=i},38225:function(e,t,r){"use strict";var n=r(60092);r.o(n,"IJsonRpcProvider")&&r.d(t,{IJsonRpcProvider:function(){return n.IJsonRpcProvider}}),r.o(n,"formatJsonRpcError")&&r.d(t,{formatJsonRpcError:function(){return n.formatJsonRpcError}}),r.o(n,"formatJsonRpcRequest")&&r.d(t,{formatJsonRpcRequest:function(){return n.formatJsonRpcRequest}}),r.o(n,"formatJsonRpcResult")&&r.d(t,{formatJsonRpcResult:function(){return n.formatJsonRpcResult}}),r.o(n,"getBigIntRpcId")&&r.d(t,{getBigIntRpcId:function(){return n.getBigIntRpcId}}),r.o(n,"isHttpUrl")&&r.d(t,{isHttpUrl:function(){return n.isHttpUrl}}),r.o(n,"isJsonRpcError")&&r.d(t,{isJsonRpcError:function(){return n.isJsonRpcError}}),r.o(n,"isJsonRpcRequest")&&r.d(t,{isJsonRpcRequest:function(){return n.isJsonRpcRequest}}),r.o(n,"isJsonRpcResponse")&&r.d(t,{isJsonRpcResponse:function(){return n.isJsonRpcResponse}}),r.o(n,"isJsonRpcResult")&&r.d(t,{isJsonRpcResult:function(){return n.isJsonRpcResult}}),r.o(n,"isLocalhostUrl")&&r.d(t,{isLocalhostUrl:function(){return n.isLocalhostUrl}}),r.o(n,"isReactNative")&&r.d(t,{isReactNative:function(){return n.isReactNative}}),r.o(n,"isWsUrl")&&r.d(t,{isWsUrl:function(){return n.isWsUrl}}),r.o(n,"payloadId")&&r.d(t,{payloadId:function(){return n.payloadId}})},11053:function(e,t,r){"use strict";r.d(t,{CX:function(){return a},L2:function(){return o},by:function(){return s},i5:function(){return i}});var n=r(97924);function i(e){return n.dQ.includes(e)}function s(e){return Object.keys(n.xK).includes(e)?n.xK[e]:n.xK[n.JV]}function o(e){return Object.values(n.xK).find(t=>t.code===e)||n.xK[n.JV]}function a(e,t,r){return e.message.includes("getaddrinfo ENOTFOUND")||e.message.includes("connect ECONNREFUSED")?Error(`Unavailable ${r} RPC url at ${t}`):e}},48917:function(e,t,r){"use strict";r.d(t,{CS:function(){return o},RI:function(){return c},o0:function(){return s},sT:function(){return a},tm:function(){return l}});var n=r(11053),i=r(97924);
14function s(e=3){return Date.now()*Math.pow(10,e)+Math.floor(Math.random()*Math.pow(10,e))}function o(e=6){return BigInt(s(e))}function a(e,t,r){return{id:r||s(),jsonrpc:"2.0",method:e,params:t}}function l(e,t){return{id:e,jsonrpc:"2.0",result:t}}function c(e,t,r){var s;return{id:e,jsonrpc:"2.0",error:void 0===(s=t)?(0,n.by)(i.O4):("string"==typeof s&&(s=Object.assign(Object.assign({},(0,n.by)(i.CA)),{message:s})),void 0!==r&&(s.data=r),(0,n.i5)(s.code)&&(s=(0,n.L2)(s.code)),s)}}},40:function(e,t,r){"use strict";r.d(t,{IJsonRpcProvider:function(){return o.x0},formatJsonRpcError:function(){return s.RI},formatJsonRpcRequest:function(){return s.sT},formatJsonRpcResult:function(){return s.tm},getBigIntRpcId:function(){return s.CS},isHttpUrl:function(){return a.jK},isJsonRpcError:function(){return l.jg},isJsonRpcRequest:function(){return l.DW},isJsonRpcResponse:function(){return l.u},isJsonRpcResult:function(){return l.k4},isLocalhostUrl:function(){return a.JF},isWsUrl:function(){return a.UZ},parseConnectionError:function(){return n.CX},payloadId:function(){return s.o0}}),r(97924);var n=r(11053),i=r(38225);r.o(i,"IJsonRpcProvider")&&r.d(t,{IJsonRpcProvider:function(){return i.IJsonRpcProvider}}),r.o(i,"formatJsonRpcError")&&r.d(t,{formatJsonRpcError:function(){return i.formatJsonRpcError}}),r.o(i,"formatJsonRpcRequest")&&r.d(t,{formatJsonRpcRequest:function(){return i.formatJsonRpcRequest}}),r.o(i,"formatJsonRpcResult")&&r.d(t,{formatJsonRpcResult:function(){return i.formatJsonRpcResult}}),r.o(i,"getBigIntRpcId")&&r.d(t,{getBigIntRpcId:function(){return i.getBigIntRpcId}}),r.o(i,"isHttpUrl")&&r.d(t,{isHttpUrl:function(){return i.isHttpUrl}}),r.o(i,"isJsonRpcError")&&r.d(t,{isJsonRpcError:function(){return i.isJsonRpcError}}),r.o(i,"isJsonRpcRequest")&&r.d(t,{isJsonRpcRequest:function(){return i.isJsonRpcRequest}}),r.o(i,"isJsonRpcResponse")&&r.d(t,{isJsonRpcResponse:function(){return i.isJsonRpcResponse}}),r.o(i,"isJsonRpcResult")&&r.d(t,{isJsonRpcResult:function(){return i.isJsonRpcResult}}),r.o(i,"isLocalhostUrl")&&r.d(t,{isLocalhostUrl:function(){return i.isLocalhostUrl}}),r.o(i,"isReactNative")&&r.d(t,{isReactNative:function(){return i.isReactNative}}),r.o(i,"isWsUrl")&&r.d(t,{isWsUrl:function(){return i.isWsUrl}}),r.o(i,"payloadId")&&r.d(t,{payloadId:function(){return i.payloadId}});var s=r(48917),o=r(82271),a=r(89033),l=r(49272)},82271:function(e,t,r){"use strict";r.d(t,{x0:function(){return s}});class n{}class i extends n{constructor(){super()}}class s extends i{constructor(e){super()}}},89033:function(e,t,r){"use strict";function n(e,t){let r=function(e){let t=e.match(RegExp(/^\w+:/,"gi"));if(t&&t.length)return t[0]}(e);return void 0!==r&&new RegExp(t).test(r)}function i(e){return n(e,"^https?:")}function s(e){return n(e,"^wss?:")}function o(e){return RegExp("wss?://localhost(:d{2,5})?").test(e)}r.d(t,{JF:function(){return o},UZ:function(){return s},jK:function(){return i}})},49272:function(e,t,r){"use strict";function n(e){return"object"==typeof e&&"id"in e&&"jsonrpc"in e&&"2.0"===e.jsonrpc}function i(e){return n(e)&&"method"in e}function s(e){return n(e)&&(o(e)||a(e))}function o(e){return"result"in e}function a(e){return"error"in e}r.d(t,{DW:function(){return i},jg:function(){return a},k4:function(){return o},u:function(){return s}})},35575:function(e,t,r){"use strict";r.d(t,{Z:function(){return c}});var n=r(68885),i=r(54112),s=r(40);let o=()=>"u">typeof WebSocket||"u">typeof r.g&&"u">typeof r.g.WebSocket||"u">typeof window&&"u">typeof window.WebSocket||"u">typeof self&&"u">typeof self.WebSocket,a=e=>e.split("?")[0],l="u">typeof WebSocket?WebSocket:"u">typeof r.g&&"u">typeof r.g.WebSocket?r.g.WebSocket:"u">typeof window&&"u">typeof window.WebSocket?window.WebSocket:"u">typeof self&&"u">typeof self.WebSocket?self.WebSocket:r(27185);class c{constructor(e){if(this.url=e,this.events=new n.EventEmitter,this.registering=!1,!(0,s.isWsUrl)(e))throw Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return"u">typeof this.socket}get connecting(){return this.registering}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,t)=>
14{if(typeof this.socket>"u"){t(Error("Connection already closed"));return}this.socket.onclose=t=>{this.onClose(t),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send((0,i.u)(e))}catch(t){this.onError(e.id,t)}}register(e=this.url){if(!(0,s.isWsUrl)(e))throw Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){let e=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=e||this.events.listenerCount("open")>=e)&&this.events.setMaxListeners(e+1),new Promise((e,t)=>{this.events.once("register_error",e=>{this.resetMaxListeners(),t(e)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return t(Error("WebSocket connection is missing or invalid"));e(this.socket)})})}return this.url=e,this.registering=!0,new Promise((t,r)=>{let n=(0,s.isReactNative)()?void 0:{rejectUnauthorized:!(0,s.isLocalhostUrl)(e)},i=new l(e,[],n);o()?i.onerror=e=>{r(this.emitError(e.error))}:i.on("error",e=>{r(this.emitError(e))}),i.onopen=()=>{this.onOpen(i),t(i)}})}onOpen(e){e.onmessage=e=>this.onPayload(e),e.onclose=e=>this.onClose(e),this.socket=e,this.registering=!1,this.events.emit("open")}onClose(e){this.socket=void 0,this.registering=!1,this.events.emit("close",e)}onPayload(e){if(typeof e.data>"u")return;let t="string"==typeof e.data?(0,i.D)(e.data):e.data;this.events.emit("payload",t)}onError(e,t){let r=this.parseError(t),n=r.message||r.toString(),i=(0,s.formatJsonRpcError)(e,n);this.events.emit("payload",i)}parseError(e,t=this.url){return(0,s.parseConnectionError)(e,a(t),"WS")}resetMaxListeners(){this.events.getMaxListeners()>10&&this.events.setMaxListeners(10)}emitError(e){let t=this.parseError(Error(e?.message||`WebSocket connection failed for host: ${a(this.url)}`));return this.events.emit("register_error",t),t}}},27185:function(e){"use strict";e.exports=function(){throw Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},48261:function(e,t,r){"use strict";let n;r.d(t,{Z:function(){return O}});var i=r(10259),s=r(9109).Buffer;function o(e,...t){try{var r;return(r=e(...t))&&"function"==typeof r.then?r:Promise.resolve(r)}catch(e){return Promise.reject(e)}}function a(e){if(function(e){let t=typeof e;return null===e||"object"!==t&&"function"!==t}(e))return String(e);if(function(e){let t=Object.getPrototypeOf(e);return!t||t.isPrototypeOf(Object)}(e)||Array.isArray(e))return JSON.stringify(e);if("function"==typeof e.toJSON)return a(e.toJSON());throw Error("[unstorage] Cannot stringify value!")}let l="base64:";function c(e){return e&&e.split("?")[0]?.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,"")||""}function u(e){return(e=c(e))?e+":":""}let f=()=>{let e=new Map;return{name:"memory",getInstance:()=>e,hasItem:t=>e.has(t),getItem:t=>e.get(t)??null,getItemRaw:t=>e.get(t)??null,setItem(t,r){e.set(t,r)},setItemRaw(t,r){e.set(t,r)},removeItem(t){e.delete(t)},getKeys:()=>[...e.keys()],clear(){e.clear()},dispose(){e.clear()}}};function h(e,t,r){return e.watch?e.watch((e,n)=>t(e,r+n)):()=>{}}async function d(e){"function"==typeof e.dispose&&await o(e.dispose)}function p(e){return new Promise((t,r)=>{e.oncomplete=e.onsuccess=()=>t(e.result),e.onabort=e.onerror=()=>r(e.error)})}function g(e,t){let r;let n=()=>{if(r)return r;let n=indexedDB.open(e);return n.onupgradeneeded=()=>n.result.createObjectStore(t),(r=p(n)).then(e=>{e.onclose=()=>r=void 0},()=>{}),r};return(e,r)=>n().then(n=>r(n.transaction(t,e).objectStore(t)))}function y(){return n||(n=g("keyval-store","keyval")),n}function m(e,t=y()){return t("readonly",t=>p(t.get(e)))}var b=r(54112),w=(e={})=>{let t;let r=e.base&&e.base.length>0?`${e.base}:`:"",n=e=>r+e;return e.dbName&&e.storeName&&(t=g(e.dbName,e.storeName)),{name:"idb-keyval",options:e,hasItem:async e=>!(typeof await m(n(e),t)>"u"),getItem:async e=>await m(n(e),t)??null,setItem:(e,r)=>(function(e,t,r=y()){return r("readwrite",r=>(r.put(t,e),p(r.transaction)))})(n(e),r,t),removeItem:e=>(function(e,t=y()){return t("readwrite",t=>(t.delete(e),p(t.transaction)))})(n(e),t),getKeys:()=>(function(e=y()){return e("readonly",e=>{var t;if(e.getAllKeys)return p(e.getAllKeys());let r=[];return(t=e=>r.push(e.key),e.openCursor().onsuccess=function(){this.result&&(t(this.result),this.result.continue())},p(e.transaction)).then(()=>r)})})(t),clear:()=>(function(e=y()){return e("readwrite",e=>(e.clear(),p(e.transaction)))})(t)}};class v{constructor(){this.indexedDb=function(e={}){let t={mounts:{"":e.driver||f()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}}
14,r=e=>{for(let r of t.mountpoints)if(e.startsWith(r))return{base:r,relativeKey:e.slice(r.length),driver:t.mounts[r]};return{base:"",relativeKey:e,driver:t.mounts[""]}},n=(e,r)=>t.mountpoints.filter(t=>t.startsWith(e)||r&&e.startsWith(t)).map(r=>({relativeBase:e.length>r.length?e.slice(r.length):void 0,mountpoint:r,driver:t.mounts[r]})),p=(e,r)=>{if(t.watching)for(let n of(r=c(r),t.watchListeners))n(e,r)},g=async()=>{if(!t.watching)for(let e in t.watching=!0,t.mounts)t.unwatch[e]=await h(t.mounts[e],p,e)},y=async()=>{if(t.watching){for(let e in t.unwatch)await t.unwatch[e]();t.unwatch={},t.watching=!1}},m=(e,t,n)=>{let i=new Map,s=e=>{let t=i.get(e.base);return t||(t={driver:e.driver,base:e.base,items:[]},i.set(e.base,t)),t};for(let n of e){let e="string"==typeof n,i=c(e?n:n.key),o=e?void 0:n.value,a=e||!n.options?t:{...t,...n.options},l=r(i);s(l).items.push({key:i,value:o,relativeKey:l.relativeKey,options:a})}return Promise.all([...i.values()].map(e=>n(e))).then(e=>e.flat())},b={hasItem(e,t={}){let{relativeKey:n,driver:i}=r(e=c(e));return o(i.hasItem,n,t)},getItem(e,t={}){let{relativeKey:n,driver:s}=r(e=c(e));return o(s.getItem,n,t).then(e=>(0,i.ZP)(e))},getItems:(e,t={})=>m(e,t,e=>e.driver.getItems?o(e.driver.getItems,e.items.map(e=>({key:e.relativeKey,options:e.options})),t).then(t=>t.map(t=>({key:function(...e){return c(e.join(":"))}(e.base,t.key),value:(0,i.ZP)(t.value)}))):Promise.all(e.items.map(t=>o(e.driver.getItem,t.relativeKey,t.options).then(e=>({key:t.key,value:(0,i.ZP)(e)}))))),getItemRaw(e,t={}){let{relativeKey:n,driver:i}=r(e=c(e));return i.getItemRaw?o(i.getItemRaw,n,t):o(i.getItem,n,t).then(e=>{var t;return"string"==typeof e&&e.startsWith(l)?(t=e.slice(l.length),globalThis.Buffer?s.from(t,"base64"):Uint8Array.from(globalThis.atob(t),e=>e.codePointAt(0))):e})},async setItem(e,t,n={}){if(void 0===t)return b.removeItem(e);let{relativeKey:i,driver:s}=r(e=c(e));s.setItem&&(await o(s.setItem,i,a(t),n),s.watch||p("update",e))},async setItems(e,t){await m(e,t,async e=>{if(e.driver.setItems)return o(e.driver.setItems,e.items.map(e=>({key:e.relativeKey,value:a(e.value),options:e.options})),t);e.driver.setItem&&await Promise.all(e.items.map(t=>o(e.driver.setItem,t.relativeKey,a(t.value),t.options)))})},async setItemRaw(e,t,n={}){if(void 0===t)return b.removeItem(e,n);let{relativeKey:i,driver:a}=r(e=c(e));if(a.setItemRaw)await o(a.setItemRaw,i,t,n);else{if(!a.setItem)return;await o(a.setItem,i,"string"==typeof t?t:l+(globalThis.Buffer?s.from(t).toString("base64"):globalThis.btoa(String.fromCodePoint(...t))),n)}a.watch||p("update",e)},async removeItem(e,t={}){"boolean"==typeof t&&(t={removeMeta:t});let{relativeKey:n,driver:i}=r(e=c(e));i.removeItem&&(await o(i.removeItem,n,t),(t.removeMeta||t.removeMata)&&await o(i.removeItem,n+"$",t),i.watch||p("remove",e))},async getMeta(e,t={}){"boolean"==typeof t&&(t={nativeOnly:t});let{relativeKey:n,driver:s}=r(e=c(e)),a=Object.create(null);if(s.getMeta&&Object.assign(a,await o(s.getMeta,n,t)),!t.nativeOnly){let e=await o(s.getItem,n+"$",t).then(e=>(0,i.ZP)(e));e&&"object"==typeof e&&("string"==typeof e.atime&&(e.atime=new Date(e.atime)),"string"==typeof e.mtime&&(e.mtime=new Date(e.mtime)),Object.assign(a,e))}return a},setMeta(e,t,r={}){return this.setItem(e+"$",t,r)},removeMeta(e,t={}){return this.removeItem(e+"$",t)},async getKeys(e,t={}){let r=n(e=u(e),!0),i=[],s=[],a=!0;for(let e of r){for(let r of(e.driver.flags?.maxDepth||(a=!1),await o(e.driver.getKeys,e.relativeBase,t))){let t=e.mountpoint+c(r);i.some(e=>t.startsWith(e))||s.push(t)}i=[e.mountpoint,...i.filter(t=>!t.startsWith(e.mountpoint))]}let l=void 0!==t.maxDepth&&!a;return s.filter(r=>{var n;return(!l||function(e,t){if(void 0===t)return!0;let r=0,n=e.indexOf(":");for(;n>-1;)r++,n=e.indexOf(":",n+1);return r<=t}(r,t.maxDepth))&&((n=e)?r.startsWith(n)&&"$"!==r[r.length-1]:"$"!==r[r.length-1])})},async clear(e,t={}){e=u(e),await Promise.all(n(e,!1).map(async e=>e.driver.clear?o(e.driver.clear,e.relativeBase,t):e.driver.removeItem?Promise.all((await e.driver.getKeys(e.relativeBase||"",t)).map(r=>e.driver.removeItem(r,t))):void 0))},async dispose(){await Promise.all(Object.values(t.mounts).map(e=>d(e)))},watch:async e=>(await g(),t.watchListeners.push(e),async()=>{t.watchListeners=t.watchListeners.filter(t=>t!==e),0===t.watchListeners.length&&await y()}),async unwatch(){t.watchListeners=[],await y()},mount(e,r){if((e=u(e))&&t.mounts[e])throw Error(`already mounted at ${e}`);return e&&(t.mountpoints.push(e),t.mountpoints.sort((e,t)=>
14t.length-e.length)),t.mounts[e]=r,t.watching&&Promise.resolve(h(r,p,e)).then(r=>{t.unwatch[e]=r}).catch(console.error),b},async unmount(e,r=!0){(e=u(e))&&t.mounts[e]&&(t.watching&&e in t.unwatch&&(t.unwatch[e]?.(),delete t.unwatch[e]),r&&await d(t.mounts[e]),t.mountpoints=t.mountpoints.filter(t=>t!==e),delete t.mounts[e])},getMount(e=""){let t=r(e=c(e)+":");return{driver:t.driver,base:t.base}},getMounts:(e="",t={})=>n(e=c(e),t.parents).map(e=>({driver:e.driver,base:e.mountpoint})),keys:(e,t={})=>b.getKeys(e,t),get:(e,t={})=>b.getItem(e,t),set:(e,t,r={})=>b.setItem(e,t,r),has:(e,t={})=>b.hasItem(e,t),del:(e,t={})=>b.removeItem(e,t),remove:(e,t={})=>b.removeItem(e,t)};return b}({driver:w({dbName:"WALLET_CONNECT_V2_INDEXED_DB",storeName:"keyvaluestorage"})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){let t=await this.indexedDb.getItem(e);if(null!==t)return t}async setItem(e,t){await this.indexedDb.setItem(e,(0,b.u)(t))}async removeItem(e){await this.indexedDb.removeItem(e)}}var E="u">typeof globalThis?globalThis:"u">typeof window?window:"u">typeof r.g?r.g:"u">typeof self?self:{},x={exports:{}};function _(e){var t;return[e[0],(0,b.D)(null!=(t=e[1])?t:"")]}!function(){function e(){}e.prototype.getItem=function(e){return this.hasOwnProperty(e)?String(this[e]):null},e.prototype.setItem=function(e,t){this[e]=String(t)},e.prototype.removeItem=function(e){delete this[e]},e.prototype.clear=function(){let e=this;Object.keys(e).forEach(function(t){e[t]=void 0,delete e[t]})},e.prototype.key=function(e){return e=e||0,Object.keys(this)[e]},e.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),"u">typeof E&&E.localStorage?x.exports=E.localStorage:"u">typeof window&&window.localStorage?x.exports=window.localStorage:x.exports=new e}();class A{constructor(){this.localStorage=x.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(_)}async getItem(e){let t=this.localStorage.getItem(e);if(null!==t)return(0,b.D)(t)}async setItem(e,t){this.localStorage.setItem(e,(0,b.u)(t))}async removeItem(e){this.localStorage.removeItem(e)}}let S=async(e,t,r)=>{let n="wc_storage_version",i=await t.getItem(n);if(i&&i>=1){r(t);return}let s=await e.getKeys();if(!s.length){r(t);return}let o=[];for(;s.length;){let r=s.shift();if(!r)continue;let n=r.toLowerCase();if(n.includes("wc@")||n.includes("walletconnect")||n.includes("wc_")||n.includes("wallet_connect")){let n=await e.getItem(r);await t.setItem(r,n),o.push(r)}}await t.setItem(n,1),r(t),I(e,o)},I=async(e,t)=>{t.length&&t.forEach(async t=>{await e.removeItem(t)})};class O{constructor(){this.initialized=!1,this.setInitialized=e=>{this.storage=e,this.initialized=!0};let e=new A;this.storage=e;try{let t=new v;S(e,t,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,t){return await this.initialize(),this.storage.setItem(e,t)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{let t=setInterval(()=>{this.initialized&&(clearInterval(t),e())},20)})}}},57711:function(e,t,r){"use strict";r.d(t,{iO:function(){return n}});let n={waku:{publish:"waku_publish",batchPublish:"waku_batchPublish",subscribe:"waku_subscribe",batchSubscribe:"waku_batchSubscribe",subscription:"waku_subscription",unsubscribe:"waku_unsubscribe",batchUnsubscribe:"waku_batchUnsubscribe",batchFetchMessages:"waku_batchFetchMessages"},irn:{publish:"irn_publish",batchPublish:"irn_batchPublish",subscribe:"irn_subscribe",batchSubscribe:"irn_batchSubscribe",subscription:"irn_subscription",unsubscribe:"irn_unsubscribe",batchUnsubscribe:"irn_batchUnsubscribe",batchFetchMessages:"irn_batchFetchMessages"},iridium:{publish:"iridium_publish",batchPublish:"iridium_batchPublish",subscribe:"iridium_subscribe",batchSubscribe:"iridium_batchSubscribe",subscription:"iridium_subscription",unsubscribe:"iridium_unsubscribe",batchUnsubscribe:"iridium_batchUnsubscribe",batchFetchMessages:"iridium_batchFetchMessages"}}},28699:function(e,t,r){"use strict";r.d(t,{Au:function(){return tS},bG:function(){return t_},vf:function(){return tI},xp:function(){return tA}});var n=r(54574),i=r(54112);function s(e,...t){if(!(e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name))throw Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw Error("Uint8Array expected of length "+t+", got length="+e.length)}function o(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}let a="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,l=e=>new DataView(e.buffer,e.byteOffset,e.byteLength);/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function c(e){return"string"==typeof e&&(e=function(e){if("string"!=typeof e)throw Error("utf8ToBytes expected string, got "+typeof e);return new Uint8Array(new TextEncoder().encode(e))}(e)),s(e),e}class u{clone(){return this._cloneInto()}}function f(e=32){if(a&&"function"==typeof a.getRandomValues)return a.getRandomValues(new Uint8Array(e));if(a&&"function"==typeof a.randomBytes)return a.randomBytes(e);throw Error("crypto.getRandomValues must be defined")}class h extends u{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=l(this.buffer)}update(e){o(this);let{view:t,buffer:r,blockLen:n}=this,i=(e=c(e)).length;for(let s=0;s<i;){let o=Math.min(n-this.pos,i-s);if(o===n){let t=l(e);for(;n<=i-s;
14s+=n)this.process(t,s);continue}r.set(e.subarray(s,s+o),this.pos),this.pos+=o,s+=o,this.pos===n&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){o(this),function(e,t){s(e);let r=t.outputLen;if(e.length<r)throw Error("digestInto() expects output buffer of length at least "+r)}(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:n,isLE:i}=this,{pos:a}=this;t[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>n-a&&(this.process(r,0),a=0);for(let e=a;e<n;e++)t[e]=0;(function(e,t,r,n){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,n);let i=BigInt(32),s=BigInt(4294967295),o=Number(r>>i&s),a=Number(r&s),l=n?4:0,c=n?0:4;e.setUint32(t+l,o,n),e.setUint32(t+c,a,n)})(r,n-8,BigInt(8*this.length),i),this.process(r,0);let c=l(e),u=this.outputLen;if(u%4)throw Error("_sha2: outputLen should be aligned to 32bit");let f=u/4,h=this.get();if(f>h.length)throw Error("_sha2: outputLen bigger than state");for(let e=0;e<f;e++)c.setUint32(4*e,h[e],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:r,length:n,finished:i,destroyed:s,pos:o}=this;return e.length=n,e.pos=o,e.finished=i,e.destroyed=s,n%t&&e.buffer.set(r),e}}let d=BigInt(4294967296-1),p=BigInt(32),g={split:function(e,t=!1){let r=new Uint32Array(e.length),n=new Uint32Array(e.length);for(let i=0;i<e.length;i++){let{h:s,l:o}=function(e,t=!1){return t?{h:Number(e&d),l:Number(e>>p&d)}:{h:0|Number(e>>p&d),l:0|Number(e&d)}}(e[i],t);[r[i],n[i]]=[s,o]}return[r,n]},shrSH:(e,t,r)=>e>>>r,shrSL:(e,t,r)=>e<<32-r|t>>>r,rotrSH:(e,t,r)=>e>>>r|t<<32-r,rotrSL:(e,t,r)=>e<<32-r|t>>>r,rotrBH:(e,t,r)=>e<<64-r|t>>>r-32,rotrBL:(e,t,r)=>e>>>r-32|t<<64-r,add:function(e,t,r,n){let i=(t>>>0)+(n>>>0);return{h:e+r+(i/4294967296|0)|0,l:0|i}},add3L:(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),add3H:(e,t,r,n)=>t+r+n+(e/4294967296|0)|0,add4L:(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),add4H:(e,t,r,n,i)=>t+r+n+i+(e/4294967296|0)|0,add5H:(e,t,r,n,i,s)=>t+r+n+i+s+(e/4294967296|0)|0,add5L:(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0)},[y,m]=g.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","0xf40e3585
145771202a","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))),b=new Uint32Array(80),w=new Uint32Array(80);class v extends h{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(){let{Ah:e,Al:t,Bh:r,Bl:n,Ch:i,Cl:s,Dh:o,Dl:a,Eh:l,El:c,Fh:u,Fl:f,Gh:h,Gl:d,Hh:p,Hl:g}=this;return[e,t,r,n,i,s,o,a,l,c,u,f,h,d,p,g]}set(e,t,r,n,i,s,o,a,l,c,u,f,h,d,p,g){this.Ah=0|e,this.Al=0|t,this.Bh=0|r,this.Bl=0|n,this.Ch=0|i,this.Cl=0|s,this.Dh=0|o,this.Dl=0|a,this.Eh=0|l,this.El=0|c,this.Fh=0|u,this.Fl=0|f,this.Gh=0|h,this.Gl=0|d,this.Hh=0|p,this.Hl=0|g}process(e,t){for(let r=0;r<16;r++,t+=4)b[r]=e.getUint32(t),w[r]=e.getUint32(t+=4);for(let e=16;e<80;e++){let t=0|b[e-15],r=0|w[e-15],n=g.rotrSH(t,r,1)^g.rotrSH(t,r,8)^g.shrSH(t,r,7),i=g.rotrSL(t,r,1)^g.rotrSL(t,r,8)^g.shrSL(t,r,7),s=0|b[e-2],o=0|w[e-2],a=g.rotrSH(s,o,19)^g.rotrBH(s,o,61)^g.shrSH(s,o,6),l=g.rotrSL(s,o,19)^g.rotrBL(s,o,61)^g.shrSL(s,o,6),c=g.add4L(i,l,w[e-7],w[e-16]),u=g.add4H(c,n,a,b[e-7],b[e-16]);b[e]=0|u,w[e]=0|c}let{Ah:r,Al:n,Bh:i,Bl:s,Ch:o,Cl:a,Dh:l,Dl:c,Eh:u,El:f,Fh:h,Fl:d,Gh:p,Gl:v,Hh:E,Hl:x}=this;for(let e=0;e<80;e++){let t=g.rotrSH(u,f,14)^g.rotrSH(u,f,18)^g.rotrBH(u,f,41),_=g.rotrSL(u,f,14)^g.rotrSL(u,f,18)^g.rotrBL(u,f,41),A=u&h^~u&p,S=f&d^~f&v,I=g.add5L(x,_,S,m[e],w[e]),O=g.add5H(I,E,t,A,y[e],b[e]),P=0|I,C=g.rotrSH(r,n,28)^g.rotrBH(r,n,34)^g.rotrBH(r,n,39),k=g.rotrSL(r,n,28)^g.rotrBL(r,n,34)^g.rotrBL(r,n,39),T=r&i^r&o^i&o,B=n&s^n&a^s&a;E=0|p,x=0|v,p=0|h,v=0|d,h=0|u,d=0|f,({h:u,l:f}=g.add(0|l,0|c,0|O,0|P)),l=0|o,c=0|a,o=0|i,a=0|s,i=0|r,s=0|n;let R=g.add3L(P,k,B);r=g.add3H(R,O,C,T),n=0|R}({h:r,l:n}=g.add(0|this.Ah,0|this.Al,0|r,0|n)),({h:i,l:s}=g.add(0|this.Bh,0|this.Bl,0|i,0|s)),({h:o,l:a}=g.add(0|this.Ch,0|this.Cl,0|o,0|a)),({h:l,l:c}=g.add(0|this.Dh,0|this.Dl,0|l,0|c)),({h:u,l:f}=g.add(0|this.Eh,0|this.El,0|u,0|f)),({h:h,l:d}=g.add(0|this.Fh,0|this.Fl,0|h,0|d)),({h:p,l:v}=g.add(0|this.Gh,0|this.Gl,0|p,0|v)),({h:E,l:x}=g.add(0|this.Hh,0|this.Hl,0|E,0|x)),this.set(r,n,i,s,o,a,l,c,u,f,h,d,p,v,E,x)}roundClean(){b.fill(0),w.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)}}let E=function(e){let t=t=>e().update(c(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}(()=>new v),x=BigInt(0),_=BigInt(1),A=BigInt(2);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function S(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function I(e){if(!S(e))throw Error("Uint8Array expected")}function O(e,t){if("boolean"!=typeof t)throw Error(e+" boolean expected, got "+t)}let P=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function C(e){I(e);let t="";for(let r=0;r<e.length;r++)t+=P[e[r]];return t}function k(e){if("string"!=typeof e)throw Error("hex string expected, got "+typeof e);return""===e?x:BigInt("0x"+e)}let T={_0:48,_9:57,A:65,F:70,a:97,f:102};function B(e){return e>=T._0&&e<=T._9?e-T._0:e>=T.A&&e<=T.F?e-(T.A-10):e>=T.a&&e<=T.f?e-(T.a-10):void 0}function R(e){if("string"!=typeof e)throw Error("hex string expected, got "+typeof e);let t=e.length,r=t/2;if(t%2)throw Error("hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(r);for(let t=0,i=0;t<r;t++,i+=2){let r=B(e.charCodeAt(i)),s=B(e.charCodeAt(i+1));if(void 0===r||void 0===s)throw Error('hex string expected, got non-hex character "'+(e[i]+e[i+1])+'" at index '+i);n[t]=16*r+s}return n}function D(e){return I(e),k(C(Uint8Array.from(e).reverse()))}function U(e,t){return R(e.toString(16).padStart(2*t,"0"))}function M(e,t){return U(e,t).reverse()}function N(e,t,r){let n;if("string"==typeof t)try{n=R(t)}catch(t){throw Error(e+" must be hex string or Uint8Array, cause: "+t)}else if(S(t))n=Uint8Array.from(t);else throw Error(e+" must be hex string or Uint8Array");let i=n.length;if("number"==typeof r&&i!==r)throw Error(e+" of length "+r+" expected, got "+i);return n}function j(...e){let t=0;for(let r=0;r<e.length;r++){let n=e[r];I(n),t+=n.length}let r=new Uint8Array(t);for(let t=0,n=0;t<e.length;t++){let i=e[t];r.set(i,n),n+=i.length}return r}let L=e=>"bigint"==typeof e&&x<=e;function $(e,t,r,n){if(!(L(t)&&L(r)&&L(n))||!(r<=t)||!(t<n))throw Error("expected valid "+e+": "+r+" <= n < "+n+", got "+t)}let z=e=>(A<<BigInt(e-1))-_,F={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||S(e),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 q(e,t,r={}){let n=(t,r,n)=>{let i=F[r];if("function"!=typeof i)throw Error("invalid validator function");let s=e[t];if(!(n&&void 0===s)&&!i(s,e))throw Error("param "+String(t)+" is invali
14d. Expected "+r+", got "+s)};for(let[e,r]of Object.entries(t))n(e,r,!1);for(let[e,t]of Object.entries(r))n(e,t,!0);return e}function W(e){let t=new WeakMap;return(r,...n)=>{let i=t.get(r);if(void 0!==i)return i;let s=e(r,...n);return t.set(r,s),s}}let V=BigInt(0),H=BigInt(1),G=BigInt(2),K=BigInt(3),Z=BigInt(4),J=BigInt(5),Y=BigInt(8);function X(e,t){let r=e%t;return r>=V?r:t+r}function Q(e,t,r){let n=e;for(;t-- >V;)n*=n,n%=r;return n}function ee(e,t){if(e===V)throw Error("invert: expected non-zero number");if(t<=V)throw Error("invert: expected positive modulus, got "+t);let r=X(e,t),n=t,i=V,s=H;for(;r!==V;){let e=n/r,t=n%r,o=i-s*e;n=r,r=t,i=s,s=o}if(n!==H)throw Error("invert: does not exist");return X(i,t)}let et=(e,t)=>(X(e,t)&H)===H,er=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function en(e,t){let r=void 0!==t?t:e.toString(2).length;return{nBitLength:r,nByteLength:Math.ceil(r/8)}}function ei(e,t,r=!1,n={}){let i;if(e<=V)throw Error("invalid field: expected ORDER > 0, got "+e);let{nBitLength:s,nByteLength:o}=en(e,t);if(o>2048)throw Error("invalid field: expected ORDER of <= 2048 bytes");let a=Object.freeze({ORDER:e,isLE:r,BITS:s,BYTES:o,MASK:z(s),ZERO:V,ONE:H,create:t=>X(t,e),isValid:t=>{if("bigint"!=typeof t)throw Error("invalid field element: expected bigint, got "+typeof t);return V<=t&&t<e},is0:e=>e===V,isOdd:e=>(e&H)===H,neg:t=>X(-t,e),eql:(e,t)=>e===t,sqr:t=>X(t*t,e),add:(t,r)=>X(t+r,e),sub:(t,r)=>X(t-r,e),mul:(t,r)=>X(t*r,e),pow:(e,t)=>(function(e,t,r){if(r<V)throw Error("invalid exponent, negatives unsupported");if(r===V)return e.ONE;if(r===H)return t;let n=e.ONE,i=t;for(;r>V;)r&H&&(n=e.mul(n,i)),i=e.sqr(i),r>>=H;return n})(a,e,t),div:(t,r)=>X(t*ee(r,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>ee(t,e),sqrt:n.sqrt||(t=>(i||(i=function(e){if(e%Z===K){let t=(e+H)/Z;return function(e,r){let n=e.pow(r,t);if(!e.eql(e.sqr(n),r))throw Error("Cannot find square root");return n}}if(e%Y===J){let t=(e-J)/Y;return function(e,r){let n=e.mul(r,G),i=e.pow(n,t),s=e.mul(r,i),o=e.mul(e.mul(s,G),i),a=e.mul(s,e.sub(o,e.ONE));if(!e.eql(e.sqr(a),r))throw Error("Cannot find square root");return a}}return function(e){let t,r,n;let i=(e-H)/G;for(t=e-H,r=0;t%G===V;t/=G,r++);for(n=G;n<e&&function(e,t,r){if(t<V)throw Error("invalid exponent, negatives unsupported");if(r<=V)throw Error("invalid modulus");if(r===H)return V;let n=H;for(;t>V;)t&H&&(n=n*e%r),e=e*e%r,t>>=H;return n}(n,i,e)!==e-H;n++)if(n>1e3)throw Error("Cannot find square root: likely non-prime P");if(1===r){let t=(e+H)/Z;return function(e,r){let n=e.pow(r,t);if(!e.eql(e.sqr(n),r))throw Error("Cannot find square root");return n}}let s=(t+H)/G;return function(e,o){if(e.pow(o,i)===e.neg(e.ONE))throw Error("Cannot find square root");let a=r,l=e.pow(e.mul(e.ONE,n),t),c=e.pow(o,s),u=e.pow(o,t);for(;!e.eql(u,e.ONE);){if(e.eql(u,e.ZERO))return e.ZERO;let t=1;for(let r=e.sqr(u);t<a&&!e.eql(r,e.ONE);t++)r=e.sqr(r);let r=e.pow(l,H<<BigInt(a-t-1));l=e.sqr(r),c=e.mul(c,r),u=e.mul(u,l),a=t}return c}}(e)}(e)),i(a,t))),invertBatch:e=>(function(e,t){let r=Array(t.length),n=t.reduce((t,n,i)=>e.is0(n)?t:(r[i]=t,e.mul(t,n)),e.ONE),i=e.inv(n);return t.reduceRight((t,n,i)=>e.is0(n)?t:(r[i]=e.mul(t,r[i]),e.mul(t,n)),i),r})(a,e),cmov:(e,t,r)=>r?t:e,toBytes:e=>r?M(e,o):U(e,o),fromBytes:e=>{if(e.length!==o)throw Error("Field.fromBytes: expected "+o+" bytes, got "+e.length);return r?D(e):k(C(e))}});return Object.freeze(a)}let es=BigInt(0),eo=BigInt(1);function ea(e,t){let r=t.negate();return e?r:t}function el(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw Error("invalid window size, expected [1.."+t+"], got W="+e)}function ec(e,t){return el(e,t),{windows:Math.ceil(t/e)+1,windowSize:2**(e-1)}}let eu=new WeakMap,ef=new WeakMap;function eh(e){return ef.get(e)||1}let ed=BigInt(0),ep=BigInt(1),eg=BigInt(2),ey=BigInt(8),em={zip215:!0};BigInt(0),BigInt(1);let eb=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),ew=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt(0);let ev=BigInt(1),eE=BigInt(2);BigInt(3);let ex=BigInt(5),e_=BigInt(8),eA=ei(eb,void 0,!0),eS=function(e){var t;let r=function(e){let t=(q(e.Fp,er.reduce((e,t)=>
14(e[t]="function",e),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),q(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...en(e.n,e.nBitLength),...e,p:e.Fp.ORDER}));return q(e,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}(e),{Fp:n,n:i,prehash:s,hash:o,randomBytes:a,nByteLength:l,h:c}=r,u=eg<<BigInt(8*l)-ep,f=n.create,h=ei(r.n,r.nBitLength),d=r.uvRatio||((e,t)=>{try{return{isValid:!0,value:n.sqrt(e*n.inv(t))}}catch{return{isValid:!1,value:ed}}}),p=r.adjustScalarBytes||(e=>e),g=r.domain||((e,t,r)=>{if(O("phflag",r),t.length||r)throw Error("Contexts/pre-hash are not supported");return e});function y(e,t){$("coordinate "+e,t,ed,u)}function m(e){if(!(e instanceof v))throw Error("ExtendedPoint expected")}let b=W((e,t)=>{let{ex:r,ey:i,ez:s}=e,o=e.is0();null==t&&(t=o?ey:n.inv(s));let a=f(r*t),l=f(i*t),c=f(s*t);if(o)return{x:ed,y:ep};if(c!==ep)throw Error("invZ was invalid");return{x:a,y:l}}),w=W(e=>{let{a:t,d:n}=r;if(e.is0())throw Error("bad point: ZERO");let{ex:i,ey:s,ez:o,et:a}=e,l=f(i*i),c=f(s*s),u=f(o*o),h=f(u*u),d=f(l*t);if(f(u*f(d+c))!==f(h+f(n*f(l*c))))throw Error("bad point: equation left != right (1)");if(f(i*s)!==f(o*a))throw Error("bad point: equation left != right (2)");return!0});class v{constructor(e,t,r,n){this.ex=e,this.ey=t,this.ez=r,this.et=n,y("x",e),y("y",t),y("z",r),y("t",n),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(e){if(e instanceof v)throw Error("extended point not allowed");let{x:t,y:r}=e||{};return y("x",t),y("y",r),new v(t,r,ep,f(t*r))}static normalizeZ(e){let t=n.invertBatch(e.map(e=>e.ez));return e.map((e,r)=>e.toAffine(t[r])).map(v.fromAffine)}static msm(e,t){return function(e,t,r,n){if(function(e,t){if(!Array.isArray(e))throw Error("array expected");e.forEach((e,r)=>{if(!(e instanceof t))throw Error("invalid point at index "+r)})}(r,e),function(e,t){if(!Array.isArray(e))throw Error("array of scalars expected");e.forEach((e,r)=>{if(!t.isValid(e))throw Error("invalid scalar at index "+r)})}(n,t),r.length!==n.length)throw Error("arrays of points and scalars must have equal length");let i=e.ZERO,s=function(e){let t;for(t=0;e>x;e>>=_,t+=1);return t}(BigInt(r.length)),o=s>12?s-3:s>4?s-2:s?2:1,a=(1<<o)-1,l=Array(a+1).fill(i),c=Math.floor((t.BITS-1)/o)*o,u=i;for(let e=c;e>=0;e-=o){l.fill(i);for(let t=0;t<n.length;t++){let i=Number(n[t]>>BigInt(e)&BigInt(a));l[i]=l[i].add(r[t])}let t=i;for(let e=l.length-1,r=i;e>0;e--)r=r.add(l[e]),t=t.add(r);if(u=u.add(t),0!==e)for(let e=0;e<o;e++)u=u.double()}return u}(v,h,e,t)}_setWindowSize(e){S.setWindowSize(this,e)}assertValidity(){w(this)}equals(e){m(e);let{ex:t,ey:r,ez:n}=this,{ex:i,ey:s,ez:o}=e,a=f(t*o),l=f(i*n),c=f(r*o),u=f(s*n);return a===l&&c===u}is0(){return this.equals(v.ZERO)}negate(){return new v(f(-this.ex),this.ey,this.ez,f(-this.et))}double(){let{a:e}=r,{ex:t,ey:n,ez:i}=this,s=f(t*t),o=f(n*n),a=f(eg*f(i*i)),l=f(e*s),c=t+n,u=f(f(c*c)-s-o),h=l+o,d=h-a,p=l-o,g=f(u*d),y=f(h*p),m=f(u*p);return new v(g,y,f(d*h),m)}add(e){m(e);let{a:t,d:n}=r,{ex:i,ey:s,ez:o,et:a}=this,{ex:l,ey:c,ez:u,et:h}=e;if(t===BigInt(-1)){let e=f((s-i)*(c+l)),t=f((s+i)*(c-l)),r=f(t-e);if(r===ed)return this.double();let n=f(o*eg*h),d=f(a*eg*u),p=d+n,g=t+e,y=d-n,m=f(p*r),b=f(g*y),w=f(p*y);return new v(m,b,f(r*g),w)}let d=f(i*l),p=f(s*c),g=f(a*n*h),y=f(o*u),b=f((i+s)*(l+c)-d-p),w=y-g,E=y+g,x=f(p-t*d),_=f(b*w),A=f(E*x),S=f(b*x);return new v(_,A,f(w*E),S)}subtract(e){return this.add(e.negate())}wNAF(e){return S.wNAFCached(this,e,v.normalizeZ)}multiply(e){$("scalar",e,ep,i);let{p:t,f:r}=this.wNAF(e);return v.normalizeZ([t,r])[0]}multiplyUnsafe(e,t=v.ZERO){return $("scalar",e,ed,i),e===ed?A:this.is0()||e===ep?this:S.wNAFCachedUnsafe(this,e,v.normalizeZ,t)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}isTorsionFree(){return S.unsafeLadder(this,i).is0()}toAffine(e){return b(this,e)}clearCofactor(){let{h:e}=r;return e===ep?this:this.multiplyUnsafe(e)}static fromHex(e,t=!1){let{d:i,a:s}=r,o=n.BYTES;e=N("pointHex",e,o),O("zip215",t);let a=e.slice(),l=e[o-1];a[o-1]=-129&l;let c=D(a);$("pointHex.y",c,ed,t?u:n.ORDER);let h=f(c*c),{isValid:p,value:g}=d(f(h-ep),f(i*h-s));
14if(!p)throw Error("Point.fromHex: invalid y coordinate");let y=(g&ep)===ep,m=(128&l)!=0;if(!t&&g===ed&&m)throw Error("Point.fromHex: x=0 and x_0=1");return m!==y&&(g=f(-g)),v.fromAffine({x:g,y:c})}static fromPrivateKey(e){return I(e).point}toRawBytes(){let{x:e,y:t}=this.toAffine(),r=M(t,n.BYTES);return r[r.length-1]|=e&ep?128:0,r}toHex(){return C(this.toRawBytes())}}v.BASE=new v(r.Gx,r.Gy,ep,f(r.Gx*r.Gy)),v.ZERO=new v(ed,ep,ep,ed);let{BASE:E,ZERO:A}=v,S=(t=8*l,{constTimeNegate:ea,hasPrecomputes:e=>1!==eh(e),unsafeLadder(e,t,r=v.ZERO){let n=e;for(;t>es;)t&eo&&(r=r.add(n)),n=n.double(),t>>=eo;return r},precomputeWindow(e,r){let{windows:n,windowSize:i}=ec(r,t),s=[],o=e,a=o;for(let e=0;e<n;e++){a=o,s.push(a);for(let e=1;e<i;e++)a=a.add(o),s.push(a);o=a.double()}return s},wNAF(e,r,n){let{windows:i,windowSize:s}=ec(e,t),o=v.ZERO,a=v.BASE,l=BigInt(2**e-1),c=2**e,u=BigInt(e);for(let e=0;e<i;e++){let t=e*s,i=Number(n&l);n>>=u,i>s&&(i-=c,n+=eo);let f=t+Math.abs(i)-1,h=e%2!=0,d=i<0;0===i?a=a.add(ea(h,r[t])):o=o.add(ea(d,r[f]))}return{p:o,f:a}},wNAFUnsafe(e,r,n,i=v.ZERO){let{windows:s,windowSize:o}=ec(e,t),a=BigInt(2**e-1),l=2**e,c=BigInt(e);for(let e=0;e<s;e++){let t=e*o;if(n===es)break;let s=Number(n&a);if(n>>=c,s>o&&(s-=l,n+=eo),0===s)continue;let u=r[t+Math.abs(s)-1];s<0&&(u=u.negate()),i=i.add(u)}return i},getPrecomputes(e,t,r){let n=eu.get(t);return n||(n=this.precomputeWindow(t,e),1!==e&&eu.set(t,r(n))),n},wNAFCached(e,t,r){let n=eh(e);return this.wNAF(n,this.getPrecomputes(n,e,r),t)},wNAFCachedUnsafe(e,t,r,n){let i=eh(e);return 1===i?this.unsafeLadder(e,t,n):this.wNAFUnsafe(i,this.getPrecomputes(i,e,r),t,n)},setWindowSize(e,r){el(r,t),ef.set(e,r),eu.delete(e)}});function I(e){let t=n.BYTES;e=N("private key",e,t);let r=N("hashed private key",o(e),2*t),s=p(r.slice(0,t)),a=r.slice(t,2*t),l=X(D(s),i),c=E.multiply(l),u=c.toRawBytes();return{head:s,prefix:a,scalar:l,point:c,pointBytes:u}}function P(e=new Uint8Array,...t){return X(D(o(g(j(...t),N("context",e),!!s))),i)}return E._setWindowSize(8),{CURVE:r,getPublicKey:function(e){return I(e).pointBytes},sign:function(e,t,r={}){e=N("message",e),s&&(e=s(e));let{prefix:o,scalar:a,pointBytes:l}=I(t),c=P(r.context,o,e),u=E.multiply(c).toRawBytes(),f=X(c+P(r.context,u,l,e)*a,i);return $("signature.s",f,ed,i),N("result",j(u,M(f,n.BYTES)),2*n.BYTES)},verify:function(e,t,r,i=em){let o,a,l;let{context:c,zip215:u}=i,f=n.BYTES;e=N("signature",e,2*f),t=N("message",t),r=N("publicKey",r,f),void 0!==u&&O("zip215",u),s&&(t=s(t));let h=D(e.slice(f,2*f));try{o=v.fromHex(r,u),a=v.fromHex(e.slice(0,f),u),l=E.multiplyUnsafe(h)}catch{return!1}if(!u&&o.isSmallOrder())return!1;let d=P(c,a.toRawBytes(),o.toRawBytes(),t);return a.add(o.multiplyUnsafe(d)).subtract(l).clearCofactor().equals(v.ZERO)},ExtendedPoint:v,utils:{getExtendedPublicKey:I,randomPrivateKey:()=>a(n.BYTES),precompute:(e=8,t=v.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)}}}({a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:eA,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:e_,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:E,randomBytes:f,adjustScalarBytes:function(e){return e[0]&=248,e[31]&=127,e[31]|=64,e},uvRatio:function(e,t){let r=X(t*t*t,eb),n=function(e){let t=BigInt(10),r=BigInt(20),n=BigInt(40),i=BigInt(80),s=e*e%eb*e%eb,o=Q(s,eE,eb)*s%eb,a=Q(o,ev,eb)*e%eb,l=Q(a,ex,eb)*a%eb,c=Q(l,t,eb)*l%eb,u=Q(c,r,eb)*c%eb,f=Q(u,n,eb)*u%eb,h=Q(f,i,eb)*f%eb,d=Q(h,i,eb)*f%eb,p=Q(d,t,eb)*l%eb;return{pow_p_5_8:Q(p,eE,eb)*e%eb,b2:s}}(e*X(r*r*t,eb)).pow_p_5_8,i=X(e*r*n,eb),s=X(t*i*i,eb),o=i,a=X(i*ew,eb),l=s===e,c=s===X(-e,eb),u=s===X(-e*ew,eb);return l&&(i=o),(c||u)&&(i=a),et(i,eb)&&(i=X(-i,eb)),{isValid:l||c,value:i}}}),eI="base64url",eO="utf8",eP="utf8",eC="base58btc";function ek(e){return null!=globalThis.Buffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}function eT(e=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?ek(globalThis.Buffer.allocUnsafe(e)):new Uint8Array(e)}function eB(e,t){t||(t=e.reduce((e,t)=>
14e+t.length,0));let r=eT(t),n=0;for(let t of e)r.set(t,n),n+=t.length;return ek(r)}var eR=function(e,t){if(e.length>=255)throw TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<e.length;i++){var s=e.charAt(i),o=s.charCodeAt(0);if(255!==r[o])throw TypeError(s+" is ambiguous");r[o]=i}var a=e.length,l=e.charAt(0),c=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function f(e){if("string"!=typeof e)throw TypeError("Expected String");if(0===e.length)return new Uint8Array;var t=0;if(" "!==e[0]){for(var n=0,i=0;e[t]===l;)n++,t++;for(var s=(e.length-t)*c+1>>>0,o=new Uint8Array(s);e[t];){var u=r[e.charCodeAt(t)];if(255===u)return;for(var f=0,h=s-1;(0!==u||f<i)&&-1!==h;h--,f++)u+=a*o[h]>>>0,o[h]=u%256>>>0,u=u/256>>>0;if(0!==u)throw Error("Non-zero carry");i=f,t++}if(" "!==e[t]){for(var d=s-i;d!==s&&0===o[d];)d++;for(var p=new Uint8Array(n+(s-d)),g=n;d!==s;)p[g++]=o[d++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,i=0,s=t.length;i!==s&&0===t[i];)i++,r++;for(var o=(s-i)*u+1>>>0,c=new Uint8Array(o);i!==s;){for(var f=t[i],h=0,d=o-1;(0!==f||h<n)&&-1!==d;d--,h++)f+=256*c[d]>>>0,c[d]=f%a>>>0,f=f/a>>>0;if(0!==f)throw Error("Non-zero carry");n=h,i++}for(var p=o-n;p!==o&&0===c[p];)p++;for(var g=l.repeat(r);p<o;++p)g+=e.charAt(c[p]);return g},decodeUnsafe:f,decode:function(e){var r=f(e);if(r)return r;throw Error(`Non-${t} character`)}}};let eD=e=>{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw Error("Unknown type, must be binary type")},eU=e=>new TextEncoder().encode(e),eM=e=>new TextDecoder().decode(e);class eN{constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class ej{constructor(e,t,r){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=r}decode(e){if("string"==typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return e$(this,e)}}class eL{constructor(e){this.decoders=e}or(e){return e$(this,e)}decode(e){let t=e[0],r=this.decoders[t];if(r)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}let e$=(e,t)=>new eL({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class ez{constructor(e,t,r,n){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new eN(e,t,r),this.decoder=new ej(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}let eF=({name:e,prefix:t,encode:r,decode:n})=>new ez(e,t,r,n),eq=({prefix:e,name:t,alphabet:r})=>{let{encode:n,decode:i}=eR(r,t);return eF({prefix:e,name:t,encode:n,decode:e=>eD(i(e))})},eW=(e,t,r,n)=>{let i={};for(let e=0;e<t.length;++e)i[t[e]]=e;let s=e.length;for(;"="===e[s-1];)--s;let o=new Uint8Array(s*r/8|0),a=0,l=0,c=0;for(let t=0;t<s;++t){let s=i[e[t]];if(void 0===s)throw SyntaxError(`Non-${n} character`);l=l<<r|s,(a+=r)>=8&&(a-=8,o[c++]=255&l>>a)}if(a>=r||255&l<<8-a)throw SyntaxError("Unexpected end of data");return o},eV=(e,t,r)=>{let n="="===t[t.length-1],i=(1<<r)-1,s="",o=0,a=0;for(let n=0;n<e.length;++n)for(a=a<<8|e[n],o+=8;o>r;)o-=r,s+=t[i&a>>o];if(o&&(s+=t[i&a<<r-o]),n)for(;s.length*r&7;)s+="=";return s},eH=({name:e,prefix:t,bitsPerChar:r,alphabet:n})=>eF({prefix:t,name:e,encode:e=>eV(e,n,r),decode:t=>eW(t,n,r,e)});var eG=Object.freeze({__proto__:null,identity:eF({prefix:"\0",name:"identity",encode:e=>eM(e),decode:e=>eU(e)})}),eK=Object.freeze({__proto__:null,base2:eH({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})}),eZ=Object.freeze({__proto__:null,base8:eH({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})}),eJ=Object.freeze({__proto__:null,base10:eq({prefix:"9",name:"base10",alphabet:"0123456789"})}),eY=Object.freeze({__proto__:null,base16:eH({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),base16upper:eH({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});let eX=eH({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),eQ=eH({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),e0=eH({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),e1=eH({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),e2=eH({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),e6=eH({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5});var e5=Object.freeze({__proto__:null,base32:eX,base32upper:eQ,base32pad:e0,base32padupper:e1,base32hex:e2,base32hexupper:e6,base32hexpad:eH({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),base32hexpadupper:eH({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),base32z:eH({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})}),e8=Object.freeze({__proto__:null,base36:eq({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),base36upper:eq({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})}),e3=Object.freeze({__proto__:null,base58btc:eq({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),base58flickr:eq({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});let e4=eH({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
14+/",bitsPerChar:6});var e9=Object.freeze({__proto__:null,base64:e4,base64pad:eH({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),base64url:eH({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),base64urlpad:eH({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});let e7=Array.from("\uD83D\uDE80\uD83E\uDE90â\uD83D\uDEF0\uD83C\uDF0C\uD83C\uDF11\uD83C\uDF12\uD83C\uDF13\uD83C\uDF14\uD83C\uDF15\uD83C\uDF16\uD83C\uDF17\uD83C\uDF18\uD83C\uDF0D\uD83C\uDF0F\uD83C\uDF0E\uD83D\uDC09â\uD83D\uDCBB\uD83D\uDDA5\uD83D\uDCBE\uD83D\uDCBF\uD83D\uDE02â¤\uD83D\uDE0D\uD83E\uDD23\uD83D\uDE0A\uD83D\uDE4F\uD83D\uDC95\uD83D\uDE2D\uD83D\uDE18\uD83D\uDC4D\uD83D\uDE05\uD83D\uDC4F\uD83D\uDE01\uD83D\uDD25\uD83E\uDD70\uD83D\uDC94\uD83D\uDC96\uD83D\uDC99\uD83D\uDE22\uD83E\uDD14\uD83D\uDE06\uD83D\uDE44\uD83D\uDCAA\uD83D\uDE09âº\uD83D\uDC4C\uD83E\uDD17\uD83D\uDC9C\uD83D\uDE14\uD83D\uDE0E\uD83D\uDE07\uD83C\uDF39\uD83E\uDD26\uD83C\uDF89\uD83D\uDC9Eââ¨\uD83E\uDD37\uD83D\uDE31\uD83D\uDE0C\uD83C\uDF38\uD83D\uDE4C\uD83D\uDE0B\uD83D\uDC97\uD83D\uDC9A\uD83D\uDE0F\uD83D\uDC9B\uD83D\uDE42\uD83D\uDC93\uD83E\uDD29\uD83D\uDE04\uD83D\uDE00\uD83D\uDDA4\uD83D\uDE03\uD83D\uDCAF\uD83D\uDE48\uD83D\uDC47\uD83C\uDFB6\uD83D\uDE12\uD83E\uDD2Dâ£\uD83D\uDE1C\uD83D\uDC8B\uD83D\uDC40\uD83D\uDE2A\uD83D\uDE11\uD83D\uDCA5\uD83D\uDE4B\uD83D\uDE1E\uD83D\uDE29\uD83D\uDE21\uD83E\uDD2A\uD83D\uDC4A\uD83E\uDD73\uD83D\uDE25\uD83E\uDD24\uD83D\uDC49\uD83D\uDC83\uD83D\uDE33â\uD83D\uDE1A\uD83D\uDE1D\uD83D\uDE34\uD83C\uDF1F\uD83D\uDE2C\uD83D\uDE43\uD83C\uDF40\uD83C\uDF37\uD83D\uDE3B\uD83D\uDE13ââ
\uD83E\uDD7A\uD83C\uDF08\uD83D\uDE08\uD83E\uDD18\uD83D\uDCA6â\uD83D\uDE23\uD83C\uDFC3\uD83D\uDC90â¹\uD83C\uDF8A\uD83D\uDC98\uD83D\uDE20â\uD83D\uDE15\uD83C\uDF3A\uD83C\uDF82\uD83C\uDF3B\uD83D\uDE10\uD83D\uDD95\uD83D\uDC9D\uD83D\uDE4A\uD83D\uDE39\uD83D\uDDE3\uD83D\uDCAB\uD83D\uDC80\uD83D\uDC51\uD83C\uDFB5\uD83E\uDD1E\uD83D\uDE1B\uD83D\uDD34\uD83D\uDE24\uD83C\uDF3C\uD83D\uDE2Bâ½\uD83E\uDD19â\uD83C\uDFC6\uD83E\uDD2B\uD83D\uDC48\uD83D\uDE2E\uD83D\uDE46\uD83C\uDF7B\uD83C\uDF43\uD83D\uDC36\uD83D\uDC81\uD83D\uDE32\uD83C\uDF3F\uD83E\uDDE1\uD83C\uDF81â¡\uD83C\uDF1E\uD83C\uDF88ââ\uD83D\uDC4B\uD83D\uDE30\uD83E\uDD28\uD83D\uDE36\uD83E\uDD1D\uD83D\uDEB6\uD83D\uDCB0\uD83C\uDF53\uD83D\uDCA2\uD83E\uDD1F\uD83D\uDE41\uD83D\uDEA8\uD83D\uDCA8\uD83E\uDD2Câ\uD83C\uDF80\uD83C\uDF7A\uD83E\uDD13\uD83D\uDE19\uD83D\uDC9F\uD83C\uDF31\uD83D\uDE16\uD83D\uDC76\uD83E\uDD74â¶â¡â\uD83D\uDC8E\uD83D\uDCB8â¬\uD83D\uDE28\uD83C\uDF1A\uD83E\uDD8B\uD83D\uDE37\uD83D\uDD7Aâ \uD83D\uDE45\uD83D\uDE1F\uD83D\uDE35\uD83D\uDC4E\uD83E\uDD32\uD83E\uDD20\uD83E\uDD27\uD83D\uDCCC\uD83D\uDD35\uD83D\uDC85\uD83E\uDDD0\uD83D\uDC3E\uD83C\uDF52\uD83D\uDE17\uD83E\uDD11\uD83C\uDF0A\uD83E\uDD2F\uD83D\uDC37â\uD83D\uDCA7\uD83D\uDE2F\uD83D\uDC86\uD83D\uDC46\uD83C\uDFA4\uD83D\uDE47\uD83C\uDF51â\uD83C\uDF34\uD83D\uDCA3\uD83D\uDC38\uD83D\uDC8C\uD83D\uDCCD\uD83E\uDD40\uD83E\uDD22\uD83D\uDC45\uD83D\uDCA1\uD83D\uDCA9\uD83D\uDC50\uD83D\uDCF8\uD83D\uDC7B\uD83E\uDD10\uD83E\uDD2E\uD83C\uDFBC\uD83E\uDD75\uD83D\uDEA9\uD83C\uDF4E\uD83C\uDF4A\uD83D\uDC7C\uD83D\uDC8D\uD83D\uDCE3\uD83E\uDD42"),te=e7.reduce((e,t,r)=>(e[r]=t,e),[]),tt=e7.reduce((e,t,r)=>(e[t.codePointAt(0)]=r,e),[]);var tr=Object.freeze({__proto__:null,base256emoji:eF({prefix:"\uD83D\uDE80",name:"base256emoji",encode:function(e){return e.reduce((e,t)=>e+=te[t],"")},decode:function(e){let t=[];for(let r of e){let e=tt[r.codePointAt(0)];if(void 0===e)throw Error(`Non-base256emoji character: ${r}`);t.push(e)}return new Uint8Array(t)}})});function tn(e,t){var r,n=0,t=t||0,i=0,s=t,o=e.length;do{if(s>=o)throw tn.bytes=0,RangeError("Could not decode varint");r=e[s++],n+=i<28?(127&r)<<i:(127&r)*Math.pow(2,i),i+=7}while(r>=128);return tn.bytes=s-t,n}var ti=function e(t,r,n){r=r||[],n=n||0;for(var i=n;t>=2147483648;)r[n++]=255&t|128,t/=128;for(;-128&t;)r[n++]=255&t|128,t>>>=7;return r[n]=0|t,e.bytes=n-i+1,r};let ts=(e,t,r=0)=>(ti(e,t,r),t),to=e=>e<128?1:e<16384?2:e<2097152?3:e<268435456?4:e<34359738368?5:e<4398046511104?6:e<562949953421312?7:e<72057594037927940?8:e<0x7fffffffffffffff?9:10,ta=(e,t)=>{let r=t.byteLength,n=to(e),i=n+to(r),s=new Uint8Array(i+r);return ts(e,s,0),ts(r,s,n),s.set(t,i),new tl(e,r,t,s)};
14class tl{constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}}let tc=({name:e,code:t,encode:r})=>new tu(e,t,r);class tu{constructor(e,t,r){this.name=e,this.code=t,this.encode=r}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?ta(this.code,t):t.then(e=>ta(this.code,e))}throw Error("Unknown type, must be binary type")}}let tf=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t));var th=Object.freeze({__proto__:null,sha256:tc({name:"sha2-256",code:18,encode:tf("SHA-256")}),sha512:tc({name:"sha2-512",code:19,encode:tf("SHA-512")})}),td=Object.freeze({__proto__:null,identity:{code:0,name:"identity",encode:eD,digest:e=>ta(0,eD(e))}});new TextEncoder,new TextDecoder;let tp={...eG,...eK,...eZ,...eJ,...eY,...e5,...e8,...e3,...e9,...tr};function tg(e,t,r,n){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:n}}}({...th,...td});let ty=tg("utf8","u",e=>"u"+new TextDecoder("utf8").decode(e),e=>new TextEncoder().encode(e.substring(1))),tm=tg("ascii","a",e=>{let t="a";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},e=>{let t=eT((e=e.substring(1)).length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}),tb={utf8:ty,"utf-8":ty,hex:tp.base16,latin1:tm,ascii:tm,binary:tm,...tp};function tw(e,t="utf8"){let r=tb[t];if(!r)throw Error(`Unsupported encoding "${t}"`);return("utf8"===t||"utf-8"===t)&&null!=globalThis.Buffer&&null!=globalThis.Buffer.from?globalThis.Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("utf8"):r.encoder.encode(e).substring(1)}function tv(e,t="utf8"){let r=tb[t];if(!r)throw Error(`Unsupported encoding "${t}"`);return("utf8"===t||"utf-8"===t)&&null!=globalThis.Buffer&&null!=globalThis.Buffer.from?ek(globalThis.Buffer.from(e,"utf-8")):r.decoder.decode(`${r.prefix}${e}`)}function tE(e){return(0,i.D)(tw(tv(e,eI),eO))}function tx(e){return tw(tv((0,i.u)(e),eO),eI)}function t_(e){return["did","key","z"+tw(eB([tv("K36",eC),e]),eC)].join(":")}function tA(e){let t=e.split("."),r=tE(t[0]);return{header:r,payload:tE(t[1]),signature:tv(t[2],eI),data:tv(t.slice(0,2).join("."),eP)}}function tS(e=f(32)){let t=eS.getPublicKey(e);return{secretKey:eB([e,t]),publicKey:t}}async function tI(e,t,r,i,s=(0,n.fromMiliseconds)(Date.now())){var o,a;let l={alg:"EdDSA",typ:"JWT"},c={iss:t_(i.publicKey),sub:e,aud:t,iat:s,exp:s+r},u=tv([tx((o={header:l,payload:c}).header),tx(o.payload)].join("."),eP);return[tx((a={header:l,payload:c,signature:eS.sign(u,i.secretKey.slice(0,32))}).header),tx(a.payload),tw(a.signature,eI)].join(".")}},54112:function(e,t,r){"use strict";r.d(t,{D:function(){return s},u:function(){return o}});let n=e=>JSON.stringify(e,(e,t)=>"bigint"==typeof t?t.toString()+"n":t),i=e=>JSON.parse(e.replace(/([\[:])?(\d{17,}|(?:[9](?:[1-9]07199254740991|0[1-9]7199254740991|00[8-9]199254740991|007[2-9]99254740991|007199[3-9]54740991|0071992[6-9]4740991|00719925[5-9]740991|007199254[8-9]40991|0071992547[5-9]0991|00719925474[1-9]991|00719925474099[2-9])))([,\}\]])/g,'$1"$2n"$3'),(e,t)=>"string"==typeof t&&t.match(/^\d+n$/)?BigInt(t.substring(0,t.length-1)):t);function s(e){if("string"!=typeof e)throw Error(`Cannot safe json parse value of type ${typeof e}`);try{return i(e)}catch(t){return e}}function o(e){return"string"==typeof e?e:n(e)||""}},71851:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let n=r(24011);n.__exportStar(r(47036),t),n.__exportStar(r(62703),t)},47036:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ONE_THOUSAND=t.ONE_HUNDRED=void 0,t.ONE_HUNDRED=100,t.ONE_THOUSAND=1e3},62703:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.ONE_YEAR=t.FOUR_WEEKS=t.THREE_WEEKS=t.TWO_WEEKS=t.ONE_WEEK=t.THIRTY_DAYS=t.SEVEN_DAYS=t.FIVE_DAYS=t.THREE_DAYS=t.ONE_DAY=t.TWENTY_FOUR_HOURS=t.TWELVE_HOURS=t.SIX_HOURS=t.THREE_HOURS=t.ONE_HOUR=t.SIXTY_MINUTES=t.THIRTY_MINUTES=t.TEN_MINUTES=t.FIVE_MINUTES=t.ONE_MINUTE=t.SIXTY_SECONDS=t.THIRTY_SECONDS=t.TEN_SECONDS=t.FIVE_SECONDS=t.ONE_SECOND=void 0,t.ONE_SECOND=1,t.FIVE_SECONDS=5,t.TEN_SECONDS=10,t.THIRTY_SECONDS=30,t.SIXTY_SECONDS=60,t.ONE_MINUTE=t.SIXTY_SECONDS,t.FIVE_MINUTES=5*t.ONE_MINUTE,t.TEN_MINUTES=10*t.ONE_MINUTE,t.THIRTY_MINUTES=30*t.ONE_MINUTE,t.SIXTY_MINUTES=60*t.ONE_MINUTE,t.ONE_HOUR=t.SIXTY_MINUTES,t.THREE_HOURS=3*t.ONE_HOUR,t.SIX_HOURS=6*t.ONE_HOUR,t.TWELVE_HOURS=12*t.ONE_HOUR,t.TWENTY_FOUR_HOURS=24*t.ONE_HOUR,t.ONE_DAY=t.TWENTY_FOUR_HOURS,t.THREE_DAYS=3*t.ONE_DAY,t.FIVE_DAYS=5*t.ONE_DAY,t.SEVEN_DAYS=7*t.ONE_DAY,t.THIRTY_DAYS=30*t.ONE_DAY,t.ONE_WEEK=t.SEVEN_DAYS,t.TWO_WEEKS=2*t.ONE_WEEK,t.THREE_WEEKS=3*t.ONE_WEEK,t.FOUR_W
14EEKS=4*t.ONE_WEEK,t.ONE_YEAR=365*t.ONE_DAY},54574:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let n=r(24011);n.__exportStar(r(91268),t),n.__exportStar(r(32674),t),n.__exportStar(r(79165),t),n.__exportStar(r(71851),t)},79165:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(24011).__exportStar(r(34760),t)},34760:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IWatch=void 0;class r{}t.IWatch=r},25115:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fromMiliseconds=t.toMiliseconds=void 0;let n=r(71851);t.toMiliseconds=function(e){return e*n.ONE_THOUSAND},t.fromMiliseconds=function(e){return Math.floor(e/n.ONE_THOUSAND)}},23396:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.delay=void 0,t.delay=function(e){return new Promise(t=>{setTimeout(()=>{t(!0)},e)})}},91268:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let n=r(24011);n.__exportStar(r(23396),t),n.__exportStar(r(25115),t)},32674:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.Watch=void 0;class r{constructor(){this.timestamps=new Map}start(e){if(this.timestamps.has(e))throw Error(`Watch already started for label: ${e}`);this.timestamps.set(e,{started:Date.now()})}stop(e){let t=this.get(e);if(void 0!==t.elapsed)throw Error(`Watch already stopped for label: ${e}`);let r=Date.now()-t.started;this.timestamps.set(e,{started:t.started,elapsed:r})}get(e){let t=this.timestamps.get(e);if(void 0===t)throw Error(`No timestamp found for label: ${e}`);return t}elapsed(e){let t=this.get(e);return t.elapsed||Date.now()-t.started}}t.Watch=r,t.default=r},24011:function(e,t,r){"use strict";r.r(t),r.d(t,{__assign:function(){return s},__asyncDelegator:function(){return v},__asyncGenerator:function(){return w},__asyncValues:function(){return E},__await:function(){return b},__awaiter:function(){return u},__classPrivateFieldGet:function(){return S},__classPrivateFieldSet:function(){return I},__createBinding:function(){return h},__decorate:function(){return a},__exportStar:function(){return d},__extends:function(){return i},__generator:function(){return f},__importDefault:function(){return A},__importStar:function(){return _}
vendor: 5,093 bytes, lines 14-27
14,__makeTemplateObject:function(){return x},__metadata:function(){return c},__param:function(){return l},__read:function(){return g},__rest:function(){return o},__spread:function(){return y},__spreadArrays:function(){return m},__values:function(){return p}});/*! ***************************************************************************** 15Copyright (c) Microsoft Corporation. 16 17Permission to use, copy, modify, and/or distribute this software for any 18purpose with or without fee is hereby granted. 19 20THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH 21REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY 22AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, 23INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM 24LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR 25OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR 26PERFORMANCE OF THIS SOFTWARE. 27***************************************************************************** */var n=function(e,t){return(n=Object.setPrototypeOf||({__proto__:[]})instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(e,t)};function i(e,t){function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}var s=function(){return(s=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function o(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&0>t.indexOf(n)&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var i=0,n=Object.getOwnPropertySymbols(e);i<n.length;i++)0>t.indexOf(n[i])&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]]);return r}function a(e,t,r,n){var i,s=arguments.length,o=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(o=(s<3?i(o):s>3?i(t,r,o):i(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o}function l(e,t){return function(r,n){t(r,n,e)}}function c(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}function u(e,t,r,n){return new(r||(r=Promise))(function(i,s){function o(e){try{l(n.next(e))}catch(e){s(e)}}function a(e){try{l(n.throw(e))}catch(e){s(e)}}function l(e){var t;e.done?i(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,a)}l((n=n.apply(e,t||[])).next())})}function f(e,t){var r,n,i,s,o={label:0,sent:function(){if(1&i[0])throw i[1];return i[1]},trys:[],ops:[]};return s={next:a(0),throw:a(1),return:a(2)},"function"==typeof Symbol&&(s[Symbol.iterator]=function(){return this}),s;function a(s){return function(a){return function(s){if(r)throw TypeError("Generator is already executing.");for(;o;)try{if(r=1,n&&(i=2&s[0]?n.return:s[0]?n.throw||((i=n.return)&&i.call(n),0):n.next)&&!(i=i.call(n,s[1])).done)return i;switch(n=0,i&&(s=[2&s[0],i.value]),s[0]){case 0:case 1:i=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,n=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(i=(i=o.trys).length>0&&i[i.length-1])&&(6===s[0]||2===s[0])){o=0;continue}if(3===s[0]&&(!i||s[1]>i[0]&&s[1]<i[3])){o.label=s[1];break}if(6===s[0]&&o.label<i[1]){o.label=i[1],i=s;break}if(i&&o.label<i[2]){o.label=i[2],o.ops.push(s);break}i[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],n=0}finally{r=i=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}}function h(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}function d(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||(t[r]=e[r])}function p(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&n>=e.length&&(e=void 0),{value:e&&e[n++],done:!e}}};throw TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function g(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,s=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(n=s.next()).done;)o.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=s.return)&&r.call(s)}finally{if(i)throw i.error}}return o}function y(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(g(arguments[t]));return e}function m(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;for(var n=Array(e),i=0,t=0;t<r;t++)for(var s=arguments[t],o=0,a=s.length;o<a;o++,i++)n[i]=s[o];return n}function b(e){return this instanceof b?(this.v=e,this):new b(e)}function w(e,t,r){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var n,i=r.apply(e,t||[]),s=[];return n={},o("next"),o("throw"),o("return"),n[Symbol.asyncIterator]=function(){return this},n;function o(e){i[e]&&(n[e]=function(t){return new Promise(function(r,n){
27s.push([e,t,r,n])>1||a(e,t)})})}function a(e,t){try{var r;(r=i[e](t)).value instanceof b?Promise.resolve(r.value.v).then(l,c):u(s[0][2],r)}catch(e){u(s[0][3],e)}}function l(e){a("next",e)}function c(e){a("throw",e)}function u(e,t){e(t),s.shift(),s.length&&a(s[0][0],s[0][1])}}function v(e){var t,r;return t={},n("next"),n("throw",function(e){throw e}),n("return"),t[Symbol.iterator]=function(){return this},t;function n(n,i){t[n]=e[n]?function(t){return(r=!r)?{value:b(e[n](t)),done:"return"===n}:i?i(t):t}:i}}function E(e){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var t,r=e[Symbol.asyncIterator];return r?r.call(e):(e=p(e),t={},n("next"),n("throw"),n("return"),t[Symbol.asyncIterator]=function(){return this},t);function n(r){t[r]=e[r]&&function(t){return new Promise(function(n,i){!function(e,t,r,n){Promise.resolve(n).then(function(t){e({value:t,done:r})},t)}(n,i,(t=e[r](t)).done,t.value)})}}}function x(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function _(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)Object.hasOwnProperty.call(e,r)&&(t[r]=e[r]);return t.default=e,t}function A(e){return e&&e.__esModule?e:{default:e}}function S(e,t){if(!t.has(e))throw TypeError("attempted to get private field on non-instance");return t.get(e)}function I(e,t,r){if(!t.has(e))throw TypeError("attempted to set private field on non-instance");return t.set(e,r),r}},25527:function(e,t){"use strict";function r(e){let t;return"undefined"!=typeof window&&void 0!==window[e]&&(t=window[e]),t}function n(e){let t=r(e);if(!t)throw Error(`${e} is not defined in Window`);return t}Object.defineProperty(t,"__esModule",{value:!0}),t.getLocalStorage=t.getLocalStorageOrThrow=t.getCrypto=t.getCryptoOrThrow=t.getLocation=t.getLocationOrThrow=t.getNavigator=t.getNavigatorOrThrow=t.getDocument=t.getDocumentOrThrow=t.getFromWindowOrThrow=t.getFromWindow=void 0,t.getFromWindow=r,t.getFromWindowOrThrow=n,t.getDocumentOrThrow=function(){return n("document")},t.getDocument=function(){return r("document")},t.getNavigatorOrThrow=function(){return n("navigator")},t.getNavigator=function(){return r("navigator")},t.getLocationOrThrow=function(){return n("location")},t.getLocation=function(){return r("location")},t.getCryptoOrThrow=function(){return n("crypto")},t.getCrypto=function(){return r("crypto")},t.getLocalStorageOrThrow=function(){return n("localStorage")},t.getLocalStorage=function(){return r("localStorage")}},70053:function(e,t,r){"use strict";t.D=void 0;let n=r(25527);t.D=function(){let e,t,r;try{e=n.getDocumentOrThrow(),t=n.getLocationOrThrow()}catch(e){return null}function i(...t){let r=e.getElementsByTagName("meta");for(let e=0;e<r.length;e++){let n=r[e],i=["itemprop","property","name"].map(e=>n.getAttribute(e)).filter(e=>!!e&&t.includes(e));if(i.length&&i){let e=n.getAttribute("content");if(e)return e}}return""}let s=((r=i("name","og:site_name","og:title","twitter:title"))||(r=e.title),r),o=i("description","og:description","twitter:description","keywords");return{description:o,url:t.origin,icons:function(){let r=e.getElementsByTagName("link"),n=[];for(let e=0;e<r.length;e++){let i=r[e],s=i.getAttribute("rel");if(s&&s.toLowerCase().indexOf("icon")>-1){let e=i.getAttribute("href");if(e){if(-1===e.toLowerCase().indexOf("https:")&&-1===e.toLowerCase().indexOf("http:")&&0!==e.indexOf("//")){let r=t.protocol+"//"+t.host;if(0===e.indexOf("/"))r+=e;else{let n=t.pathname.split("/");n.pop(),r+=n.join("/")+"/"+e}n.push(r)}else if(0===e.indexOf("//")){let r=t.protocol+e;n.push(r)}else n.push(e)}}}return n}(),name:s}}},48738:function(e,t){"use strict";t.byteLength=function(e){var t=l(e),r=t[0],n=t[1];return(r+n)*3/4-n},t.toByteArray=function(e){var t,r,s=l(e),o=s[0],a=s[1],c=new i((o+a)*3/4-a),u=0,f=a>0?o-4:o;for(r=0;r<f;r+=4)t=n[e.charCodeAt(r)]<<18|n[e.charCodeAt(r+1)]<<12|n[e.charCodeAt(r+2)]<<6|n[e.charCodeAt(r+3)],c[u++]=t>>16&255,c[u++]=t>>8&255,c[u++]=255&t;return 2===a&&(t=n[e.charCodeAt(r)]<<2|n[e.charCodeAt(r+1)]>>4,c[u++]=255&t),1===a&&(t=n[e.charCodeAt(r)]<<10|n[e.charCodeAt(r+1)]<<4|n[e.charCodeAt(r+2)]>>2,c[u++]=t>>8&255,c[u++]=255&t),c},t.fromByteArray=function(e){for(var t,n=e.length,i=n%3,s=[],o=0,a=n-i;o<a;o+=16383)s.push(function(e,t,n){for(var i,s=[],o=t;o<n;o+=3)s.push(r[(i=(e[o]<<16&16711680)+(e[o+1]<<8&65280)+(255&e[o+2]))>>18&63]+r[i>>12&63]+r[i>>6&63]+r[63&i]);return s.join("")}(e,o,o+16383>a?a:o+16383));return 1===i?s.push(r[(t=e[n-1])>>2]+r[t<<4&63]+"=="):2===i&&s.push(r[(t=(e[n-2]<<8)+e[n-1])>>10]+r[t>>4&63]+r[t<<2&63]+"="),s.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
27+/",o=0,a=s.length;o<a;++o)r[o]=s[o],n[s.charCodeAt(o)]=o;function l(e){var t=e.length;if(t%4>0)throw Error("Invalid string. Length must be a multiple of 4");var r=e.indexOf("=");-1===r&&(r=t);var n=r===t?0:4-r%4;return[r,n]}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},18421:function(e,t,r){let n=r(28796);function i(e,t,r){let n=e[t]+e[r],i=e[t+1]+e[r+1];n>=4294967296&&i++,e[t]=n,e[t+1]=i}function s(e,t,r,n){let i=e[t]+r;r<0&&(i+=4294967296);let s=e[t+1]+n;i>=4294967296&&s++,e[t]=i,e[t+1]=s}function o(e,t){return e[t]^e[t+1]<<8^e[t+2]<<16^e[t+3]<<24}function a(e,t,r,n,o,a){let l=f[o],c=f[o+1],h=f[a],d=f[a+1];i(u,e,t),s(u,e,l,c);let p=u[n]^u[e],g=u[n+1]^u[e+1];u[n]=g,u[n+1]=p,i(u,r,n),p=u[t]^u[r],g=u[t+1]^u[r+1],u[t]=p>>>24^g<<8,u[t+1]=g>>>24^p<<8,i(u,e,t),s(u,e,h,d),p=u[n]^u[e],g=u[n+1]^u[e+1],u[n]=p>>>16^g<<16,u[n+1]=g>>>16^p<<16,i(u,r,n),p=u[t]^u[r],g=u[t+1]^u[r+1],u[t]=g>>>31^p<<1,u[t+1]=p>>>31^g<<1}let l=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),c=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3].map(function(e){return 2*e})),u=new Uint32Array(32),f=new Uint32Array(32);function h(e,t){let r=0;for(r=0;r<16;r++)u[r]=e.h[r],u[r+16]=l[r];for(u[24]=u[24]^e.t,u[25]=u[25]^e.t/4294967296,t&&(u[28]=~u[28],u[29]=~u[29]),r=0;r<32;r++)f[r]=o(e.b,4*r);for(r=0;r<12;r++)a(0,8,16,24,c[16*r+0],c[16*r+1]),a(2,10,18,26,c[16*r+2],c[16*r+3]),a(4,12,20,28,c[16*r+4],c[16*r+5]),a(6,14,22,30,c[16*r+6],c[16*r+7]),a(0,10,20,30,c[16*r+8],c[16*r+9]),a(2,12,22,24,c[16*r+10],c[16*r+11]),a(4,14,16,26,c[16*r+12],c[16*r+13]),a(6,8,18,28,c[16*r+14],c[16*r+15]);for(r=0;r<16;r++)e.h[r]=e.h[r]^u[r]^u[r+16]}let d=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function p(e,t,r,n){if(0===e||e>64)throw Error("Illegal output length, expected 0 < length <= 64");if(t&&t.length>64)throw Error("Illegal key, expected Uint8Array with 0 < length <= 64");if(r&&16!==r.length)throw Error("Illegal salt, expected Uint8Array with length is 16");if(n&&16!==n.length)throw Error("Illegal personal, expected Uint8Array with length is 16");let i={b:new Uint8Array(128),h:new Uint32Array(16),t:0,c:0,outlen:e};d.fill(0),d[0]=e,t&&(d[1]=t.length),d[2]=1,d[3]=1,r&&d.set(r,32),n&&d.set(n,48);for(let e=0;e<16;e++)i.h[e]=l[e]^o(d,4*e);return t&&(g(i,t),i.c=128),i}function g(e,t){for(let r=0;r<t.length;r++)128===e.c&&(e.t+=e.c,h(e,!1),e.c=0),e.b[e.c++]=t[r]}function y(e){for(e.t+=e.c;e.c<128;)e.b[e.c++]=0;h(e,!0);let t=new Uint8Array(e.outlen);for(let r=0;r<e.outlen;r++)t[r]=e.h[r>>2]>>8*(3&r);return t}function m(e,t,r,i,s){r=r||64,e=n.normalizeInput(e),i&&(i=n.normalizeInput(i)),s&&(s=n.normalizeInput(s));let o=p(r,t,i,s);return g(o,e),y(o)}e.exports={blake2b:m,blake2bHex:function(e,t,r,i,s){let o=m(e,t,r,i,s);return n.toHex(o)},blake2bInit:p,blake2bUpdate:g,blake2bFinal:y}},39005:function(e,t,r){let n=r(28796);function i(e,t,r,n,i,o){l[e]=l[e]+l[t]+i,l[n]=s(l[n]^l[e],16),l[r]=l[r]+l[n],l[t]=s(l[t]^l[r],12),l[e]=l[e]+l[t]+o,l[n]=s(l[n]^l[e],8),l[r]=l[r]+l[n],l[t]=s(l[t]^l[r],7)}function s(e,t){return e>>>t^e<<32-t}let o=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),a=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0]),l=new Uint32Array(16),c=new Uint32Array(16);function u(e,t){let r=0;for(r=0;r<8;r++)l[r]=e.h[r],l[r+8]=o[r];for(l[12]^=e.t,l[13]^=e.t/4294967296,t&&(l[14]=~l[14]),r=0;r<16;r++){var n,s;c[r]=(n=e.b)[s=4*r]^n[s+1]<<8^n[s+2]<<16^n[s+3]<<24}for(r=0;r<10;r++)i(0,4,8,12,c[a[16*r+0]],c[a[16*r+1]]),i(1,5,9,13,c[a[16*r+2]],c[a[16*r+3]]),i(2,6,10,14,c[a[16*r+4]],c[a[16*r+5]]),i(3,7,11,15,c[a[16*r+6]],c[a[16*r+7]]),i(0,5,10,15,c[a[16*r+8]],c[a[16*r+9]]),i(1,6,11,12,c[a[16*r+10]],c[a[16*r+11]]),i(2,7,8,13,c[a[16*r+12]],c[a[16*r+13]]),i(3,4,9,14,c[a[16*r+14]],c[a[16*r+15]]);for(r=0;r<8;r++)e.h[r]^=l[r]^l[r+8]}function f(e,t){if(!(e>0&&e<=32))throw Error("Incorrect output length, should be in [1, 32]");let r=t?t.length:0;if(t&&!(r>0&&r<=32))throw Error("Incorrect key length, should be in [1, 32]");let n={h:new Uint32Array(o),b:new Uint8Array(64),c:0,t:0,outlen:e};return n.h[0]^=16842752^r<<8^e,r>0&&(h(n,t),n.c=64),n}function h(e,t){for(let r=0;r<t.length;r++)64===e.c&&(e.t+=e.c,u(e,!1),e.c=0),e.b[e.c++]=t[r]}function d(e){for(e.t+=e.c;e.c<64;)e.b[e.c++]=0;u(e,!0);let t=new Uint8Array(e.outlen);for(let r=0;r<e.outlen;r++)t[r]=e.h[r>>2]>>8*(3&r)&255;return t}function p(e,t,r){r=r||32,e=n.normalizeInput(e);let i=f(r,t);return h(i,e),d(i)}e.exports={blake2s:p,blake2sHex:function(e,t,r){let i=p(e,t,r);return n.toHex(i)},blake2sInit:f,blake2sUpdate:h,blake2sFinal:d}},9534:function(e,t,r){let n=r(18421),i=r(39005);e.exports={blake2b:n.blake2b,blake2bHex:n.blake2bHex,blake2bInit:n.blake2bInit,blake2bUpdate:n.blake2bUpdate,blake2bFinal:n.blake2bFinal,blake2s:i.blake2s,blake2sHex:i.blake2sHex,blake2sInit:i.blake2sInit,blake2sUpdate:i.blake2sUpdate,blake2sFinal:i.blake2sFinal}},28796:function(e){function t(e){return(4294967296+e).toString(16).substring(1)}e.exports={normalizeInput:function(e){let t;if(e instanceof Uint8Array)t=e;else if("string"==typeof e)t=new TextEncoder().encode(e);else throw Error("Input must be an string, Buffer or Uint8Array");return t},toHex:function(e){return Array.prototype.map.call(e,function(e){return(e<16?"0":"")+e.toString(16)}).join("")},debugPrint:function(e,r,n){let i="\n"+e+" = ";for(let s=0;s<r.length;s+=2){if(32===n)i+=t(r[s]).toUpperCase()+" "+t(r[s+1]).toUpperCase();else if(64===n)i+=t(r[s+1]).toUpperCase()+t(r[s]).toUpperCase();else throw Error("Invalid size "+n);s%6==4?i+="\n"+Array(e.length+4).join(" "):s<r.length-2&&(i+=" ")}console.log(i)},testSpeed:function(e,t,r){let n=new Date().getTime(),i=new Uint8Array(t);for(let e=0;e<t;e++)i[e]=e%256;let s=new Date().getTime();console.log("Generated random input in "+(s-n)+"ms"),n=s;for(let s=0;s<r;s++){let r=e(i),s=new Date().getTime(),o=s-n;n=s,console.log("Hashed in "+o+"ms: "+r.substring(0,20)+"..."),console.log(Math.round(t/1048576/(o/1e3)*100)/100+" MB PER SECOND")}}}},58171:function(e,t,r){!function(e,t){"use strict";function n(e,t){if(!e)throw Error(t||"Assertion failed")}function i(e,t){e.super_=t;var r=function(){};r.prototype=t.prototype,e.prototype=new r,e.prototype.constructor=e}function s(e,t,r){if(s.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,null!==e&&(("le"===t||"be"===t)&&(r=t,t=10),this._init(e||0,t||10,r||"be"))}
vendor: 9,217 bytes, line 27
27"object"==typeof e?e.exports=s:t.BN=s,s.BN=s,s.wordSize=26;try{f="undefined"!=typeof window&&void 0!==window.Buffer?window.Buffer:r(46601).Buffer}catch(e){}function o(e,t){var r=e.charCodeAt(t);return r>=48&&r<=57?r-48:r>=65&&r<=70?r-55:r>=97&&r<=102?r-87:void n(!1,"Invalid character in "+e)}function a(e,t,r){var n=o(e,r);return r-1>=t&&(n|=o(e,r-1)<<4),n}function l(e,t,r,i){for(var s=0,o=0,a=Math.min(e.length,r),l=t;l<a;l++){var c=e.charCodeAt(l)-48;s*=i,o=c>=49?c-49+10:c>=17?c-17+10:c,n(c>=0&&o<i,"Invalid character"),s+=o}return s}function c(e,t){e.words=t.words,e.length=t.length,e.negative=t.negative,e.red=t.red}if(s.isBN=function(e){return e instanceof s||null!==e&&"object"==typeof e&&e.constructor.wordSize===s.wordSize&&Array.isArray(e.words)},s.max=function(e,t){return e.cmp(t)>0?e:t},s.min=function(e,t){return 0>e.cmp(t)?e:t},s.prototype._init=function(e,t,r){if("number"==typeof e)return this._initNumber(e,t,r);if("object"==typeof e)return this._initArray(e,t,r);"hex"===t&&(t=16),n(t===(0|t)&&t>=2&&t<=36);var i=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(i++,this.negative=1),i<e.length&&(16===t?this._parseHex(e,i,r):(this._parseBase(e,t,i),"le"===r&&this._initArray(this.toArray(),t,r)))},s.prototype._initNumber=function(e,t,r){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[67108863&e],this.length=1):e<4503599627370496?(this.words=[67108863&e,e/67108864&67108863],this.length=2):(n(e<9007199254740992),this.words=[67108863&e,e/67108864&67108863,1],this.length=3),"le"===r&&this._initArray(this.toArray(),t,r)},s.prototype._initArray=function(e,t,r){if(n("number"==typeof e.length),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=Array(this.length);for(var i,s,o=0;o<this.length;o++)this.words[o]=0;var a=0;if("be"===r)for(o=e.length-1,i=0;o>=0;o-=3)s=e[o]|e[o-1]<<8|e[o-2]<<16,this.words[i]|=s<<a&67108863,this.words[i+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,i++);else if("le"===r)for(o=0,i=0;o<e.length;o+=3)s=e[o]|e[o+1]<<8|e[o+2]<<16,this.words[i]|=s<<a&67108863,this.words[i+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,i++);return this._strip()},s.prototype._parseHex=function(e,t,r){this.length=Math.ceil((e.length-t)/6),this.words=Array(this.length);for(var n,i=0;i<this.length;i++)this.words[i]=0;var s=0,o=0;if("be"===r)for(i=e.length-1;i>=t;i-=2)n=a(e,t,i)<<s,this.words[o]|=67108863&n,s>=18?(s-=18,o+=1,this.words[o]|=n>>>26):s+=8;else for(i=(e.length-t)%2==0?t+1:t;i<e.length;i+=2)n=a(e,t,i)<<s,this.words[o]|=67108863&n,s>=18?(s-=18,o+=1,this.words[o]|=n>>>26):s+=8;this._strip()},s.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var n=0,i=1;i<=67108863;i*=t)n++;n--,i=i/t|0;for(var s=e.length-r,o=s%n,a=Math.min(s,s-o)+r,c=0,u=r;u<a;u+=n)c=l(e,u,u+n,t),this.imuln(i),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c);if(0!==o){var f=1;for(c=l(e,u,e.length,t),u=0;u<o;u++)f*=t;this.imuln(f),this.words[0]+c<67108864?this.words[0]+=c:this._iaddn(c)}this._strip()},s.prototype.copy=function(e){e.words=Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},s.prototype._move=function(e){c(e,this)},s.prototype.clone=function(){var e=new s(null);return this.copy(e),e},s.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},s.prototype._strip=function(){for(;this.length>1&&0===this.words[this.length-1];)this.length--;return this._normSign()},s.prototype._normSign=function(){return 1===this.length&&0===this.words[0]&&(this.negative=0),this},"undefined"!=typeof Symbol&&"function"==typeof Symbol.for)try{s.prototype[Symbol.for("nodejs.util.inspect.custom")]=u}catch(e){s.prototype.inspect=u}else s.prototype.inspect=u;function u(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"}var f,h=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],d=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],p=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];function g(e,t,r){r.negative=t.negative^e.negative;var n=e.length+t.length|0;r.length=n,n=n-1|0;var i=0|e.words[0],s=0|t.words[0],o=i*s,a=67108863&o,l=o/67108864|0;r.words[0]=a;for(var c=1;c<n;c++){for(var u=l>>>26,f=67108863&l,h=Math.min(c,t.length-1),d=Math.max(0,c-e.length+1);d<=h;d++){var p=c-d|0;u+=(o=(i=0|e.words[p])*(s=0|t.words[d])+f)/67108864|0,f=67108863&o}r.words[c]=0|f,l=0|u}return 0!==l?r.words[c]=0|l:r.length--,r._strip()}s.prototype.toString=function(e,t){if(t=0|t||1,16===(e=e||10)||"hex"===e){r="";for(var r,i=0,s=0,o=0;o<this.length;o++){var a=this.words[o],l=((a<<i|s)&16777215).toString(16);s=a>>>24-i&16777215,(i+=2)>=26&&(i-=26,o--),r=0!==s||o!==this.length-1?h[6-l.length]+l+r:l+r}for(0!==s&&(r=s.toString(16)+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}if(e===(0|e)&&e>=2&&e<=36){var c=d[e],u=p[e];r="";var f=this.clone();for(f.negative=0;!f.isZero();){var g=f.modrn(u).toString(e);r=(f=f.idivn(u)).isZero()?g+r:h[c-g.length]+g+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}n(!1,"Base should be between 2 and 36")},s.prototype.toNumber=function(){var e=this.words[0];return 2===this.length?e+=67108864*this.words[1]:3===this.length&&1===this.words[2]?e+=4503599627370496+67108864*this.words[1]:this.length>2&&n(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},s.prototype.toJSON=function(){return this.toString(16,2)},f&&(s.prototype.toBuffer=function(e,t){return this.toArrayLike(f,e,t)}),s.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},s.prototype.toArrayLike=function(e,t,r){this._strip();var i=this.byteLength(),s=r||Math.max(1,i);n(i<=s,"byte array longer than desired length"),n(s>0,"Requested array length <= 0");var o=e.allocUnsafe?e.allocUnsafe(s):new e(s);return this["_toArrayLike"+("le"===t?"LE":"BE")](o,i),o},s.prototype._toArrayLikeLE=function(e,t){for(var r=0,n=0,i=0,s=0;i<this.length;i++){var o=this.words[i]<<s|n;e[r++]=255&o,r<e.length&&(e[r++]=o>>8&255),r<e.length&&(e[r++]=o>>16&255),6===s?(r<e.length&&(e[r++]=o>>24&255),n=0,s=0):(n=o>>>24,s+=2)}if(r<e.length)for(e[r++]=n;r<e.length;)e[r++]=0},s.prototype._toArrayLikeBE=function(e,t){for(var r=e.length-1,n=0,i=0,s=0;i<this.length;i++){var o=this.words[i]<<s|n;e[r--]=255&o,r>=0&&(e[r--]=o>>8&255),r>=0&&(e[r--]=o>>16&255),6===s?(r>=0&&(e[r--]=o>>24&255),n=0,s=0):(n=o>>>24,s+=2)}if(r>=0)for(e[r--]=n;r>=0;)e[r--]=0},Math.clz32?s.prototype._countBits=function(e){return 32-Math.clz32(e)}:s.prototype._countBits=function(e){var t=e,r=0;return t>=4096&&(r+=13,t>>>=13),t>=64&&(r+=7,t>>>=7),t>=8&&(r+=4,t>>>=4),t>=2&&(r+=2,t>>>=2),r+t},s.prototype._zeroBits=function(e){if(0===e)return 26;var t=e,r=0;return(8191&t)==0&&(r+=13,t>>>=13),(127&t)==0&&(r+=7,t>>>=7),(15&t)==0&&(r+=4,t>>>=4),(3&t)==0&&(r+=2,t>>>=2),(1&t)==0&&r++,r},s.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return(this.length-1)*26+t},s.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var r=this._zeroBits(this.words[t]);if(e+=r,26!==r)break}return e},s.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},s.prototype.toTwos=function(e){return 0!==this.negative?this.abs().inotn(e).iaddn(1):this.clone()},s.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},s.prototype.isNeg=function(){return 0!==this.negative},s.prototype.neg=function(){return this.clone().ineg()},s.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},s.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this._strip()},s.prototype.ior=function(e){return n((this.negative|e.negative)==0),this.iuor(e)},s.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},s.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},s.prototype.iuand=function(e){var t;t=this.length>e.length?e:this;for(var r=0;r<t.length;r++)this.words[r]=this.words[r]&e.words[r];return this.length=t.length,this._strip()},s.prototype.iand=function(e){return n((this.negative|e.negative)==0),this.iuand(e)},s.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},s.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},s.prototype.iuxor=function(e){this.length>e.length?(t=this,r=e):(t=e,r=this);for(var t,r,n=0;n<r.length;
vendor: 11,848 bytes, line 27
27n++)this.words[n]=t.words[n]^r.words[n];if(this!==t)for(;n<t.length;n++)this.words[n]=t.words[n];return this.length=t.length,this._strip()},s.prototype.ixor=function(e){return n((this.negative|e.negative)==0),this.iuxor(e)},s.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},s.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},s.prototype.inotn=function(e){n("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var i=0;i<t;i++)this.words[i]=67108863&~this.words[i];return r>0&&(this.words[i]=~this.words[i]&67108863>>26-r),this._strip()},s.prototype.notn=function(e){return this.clone().inotn(e)},s.prototype.setn=function(e,t){n("number"==typeof e&&e>=0);var r=e/26|0,i=e%26;return this._expand(r+1),t?this.words[r]=this.words[r]|1<<i:this.words[r]=this.words[r]&~(1<<i),this._strip()},s.prototype.iadd=function(e){if(0!==this.negative&&0===e.negative)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(0===this.negative&&0!==e.negative)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();this.length>e.length?(r=this,n=e):(r=e,n=this);for(var t,r,n,i=0,s=0;s<n.length;s++)t=(0|r.words[s])+(0|n.words[s])+i,this.words[s]=67108863&t,i=t>>>26;for(;0!==i&&s<r.length;s++)t=(0|r.words[s])+i,this.words[s]=67108863&t,i=t>>>26;if(this.length=r.length,0!==i)this.words[this.length]=i,this.length++;else if(r!==this)for(;s<r.length;s++)this.words[s]=r.words[s];return this},s.prototype.add=function(e){var t;return 0!==e.negative&&0===this.negative?(e.negative=0,t=this.sub(e),e.negative^=1,t):0===e.negative&&0!==this.negative?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},s.prototype.isub=function(e){if(0!==e.negative){e.negative=0;var t,r,n=this.iadd(e);return e.negative=1,n._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var i=this.cmp(e);if(0===i)return this.negative=0,this.length=1,this.words[0]=0,this;i>0?(t=this,r=e):(t=e,r=this);for(var s=0,o=0;o<r.length;o++)s=(n=(0|t.words[o])-(0|r.words[o])+s)>>26,this.words[o]=67108863&n;for(;0!==s&&o<t.length;o++)s=(n=(0|t.words[o])+s)>>26,this.words[o]=67108863&n;if(0===s&&o<t.length&&t!==this)for(;o<t.length;o++)this.words[o]=t.words[o];return this.length=Math.max(this.length,o),t!==this&&(this.negative=1),this._strip()},s.prototype.sub=function(e){return this.clone().isub(e)};var y=function(e,t,r){var n,i,s,o=e.words,a=t.words,l=r.words,c=0,u=0|o[0],f=8191&u,h=u>>>13,d=0|o[1],p=8191&d,g=d>>>13,y=0|o[2],m=8191&y,b=y>>>13,w=0|o[3],v=8191&w,E=w>>>13,x=0|o[4],_=8191&x,A=x>>>13,S=0|o[5],I=8191&S,O=S>>>13,P=0|o[6],C=8191&P,k=P>>>13,T=0|o[7],B=8191&T,R=T>>>13,D=0|o[8],U=8191&D,M=D>>>13,N=0|o[9],j=8191&N,L=N>>>13,$=0|a[0],z=8191&$,F=$>>>13,q=0|a[1],W=8191&q,V=q>>>13,H=0|a[2],G=8191&H,K=H>>>13,Z=0|a[3],J=8191&Z,Y=Z>>>13,X=0|a[4],Q=8191&X,ee=X>>>13,et=0|a[5],er=8191&et,en=et>>>13,ei=0|a[6],es=8191&ei,eo=ei>>>13,ea=0|a[7],el=8191&ea,ec=ea>>>13,eu=0|a[8],ef=8191&eu,eh=eu>>>13,ed=0|a[9],ep=8191&ed,eg=ed>>>13;r.negative=e.negative^t.negative,r.length=19;var ey=(c+(n=Math.imul(f,z))|0)+((8191&(i=(i=Math.imul(f,F))+Math.imul(h,z)|0))<<13)|0;c=((s=Math.imul(h,F))+(i>>>13)|0)+(ey>>>26)|0,ey&=67108863,n=Math.imul(p,z),i=(i=Math.imul(p,F))+Math.imul(g,z)|0,s=Math.imul(g,F);var em=(c+(n=n+Math.imul(f,W)|0)|0)+((8191&(i=(i=i+Math.imul(f,V)|0)+Math.imul(h,W)|0))<<13)|0;c=((s=s+Math.imul(h,V)|0)+(i>>>13)|0)+(em>>>26)|0,em&=67108863,n=Math.imul(m,z),i=(i=Math.imul(m,F))+Math.imul(b,z)|0,s=Math.imul(b,F),n=n+Math.imul(p,W)|0,i=(i=i+Math.imul(p,V)|0)+Math.imul(g,W)|0,s=s+Math.imul(g,V)|0;var eb=(c+(n=n+Math.imul(f,G)|0)|0)+((8191&(i=(i=i+Math.imul(f,K)|0)+Math.imul(h,G)|0))<<13)|0;c=((s=s+Math.imul(h,K)|0)+(i>>>13)|0)+(eb>>>26)|0,eb&=67108863,n=Math.imul(v,z),i=(i=Math.imul(v,F))+Math.imul(E,z)|0,s=Math.imul(E,F),n=n+Math.imul(m,W)|0,i=(i=i+Math.imul(m,V)|0)+Math.imul(b,W)|0,s=s+Math.imul(b,V)|0,n=n+Math.imul(p,G)|0,i=(i=i+Math.imul(p,K)|0)+Math.imul(g,G)|0,s=s+Math.imul(g,K)|0;var ew=(c+(n=n+Math.imul(f,J)|0)|0)+((8191&(i=(i=i+Math.imul(f,Y)|0)+Math.imul(h,J)|0))<<13)|0;c=((s=s+Math.imul(h,Y)|0)+(i>>>13)|0)+(ew>>>26)|0,ew&=67108863,n=Math.imul(_,z),i=(i=Math.imul(_,F))+Math.imul(A,z)|0,s=Math.imul(A,F),n=n+Math.imul(v,W)|0,i=(i=i+Math.imul(v,V)|0)+Math.imul(E,W)|0,s=s+Math.imul(E,V)|0,n=n+Math.imul(m,G)|0,i=(i=i+Math.imul(m,K)|0)+Math.imul(b,G)|0,s=s+Math.imul(b,K)|0,n=n+Math.imul(p,J)|0,i=(i=i+Math.imul(p,Y)|0)+Math.imul(g,J)|0,s=s+Math.imul(g,Y)|0;var ev=(c+(n=n+Math.imul(f,Q)|0)|0)+((8191&(i=(i=i+Math.imul(f,ee)|0)+Math.imul(h,Q)|0))<<13)|0;c=((s=s+Math.imul(h,ee)|0)+(i>>>13)|0)+(ev>>>26)|0,ev&=67108863,n=Math.imul(I,z),i=(i=Math.imul(I,F))+Math.imul(O,z)|0,s=Math.imul(O,F),n=n+Math.imul(_,W)|0,i=(i=i+Math.imul(_,V)|0)+Math.imul(A,W)|0,s=s+Math.imul(A,V)|0,n=n+Math.imul(v,G)|0,i=(i=i+Math.imul(v,K)|0)+Math.imul(E,G)|0,s=s+Math.imul(E,K)|0,n=n+Math.imul(m,J)|0,i=(i=i+Math.imul(m,Y)|0)+Math.imul(b,J)|0,s=s+Math.imul(b,Y)|0,n=n+Math.imul(p,Q)|0,i=(i=i+Math.imul(p,ee)|0)+Math.imul(g,Q)|0,s=s+Math.imul(g,ee)|0;var eE=(c+(n=n+Math.imul(f,er)|0)|0)+((8191&(i=(i=i+Math.imul(f,en)|0)+Math.imul(h,er)|0))<<13)|0;c=((s=s+Math.imul(h,en)|0)+(i>>>13)|0)+(eE>>>26)|0,eE&=67108863,n=Math.imul(C,z),i=(i=Math.imul(C,F))+Math.imul(k,z)|0,s=Math.imul(k,F),n=n+Math.imul(I,W)|0,i=(i=i+Math.imul(I,V)|0)+Math.imul(O,W)|0,s=s+Math.imul(O,V)|0,n=n+Math.imul(_,G)|0,i=(i=i+Math.imul(_,K)|0)+Math.imul(A,G)|0,s=s+Math.imul(A,K)|0,n=n+Math.imul(v,J)|0,i=(i=i+Math.imul(v,Y)|0)+Math.imul(E,J)|0,s=s+Math.imul(E,Y)|0,n=n+Math.imul(m,Q)|0,i=(i=i+Math.imul(m,ee)|0)+Math.imul(b,Q)|0,s=s+Math.imul(b,ee)|0,n=n+Math.imul(p,er)|0,i=(i=i+Math.imul(p,en)|0)+Math.imul(g,er)|0,s=s+Math.imul(g,en)|0;var ex=(c+(n=n+Math.imul(f,es)|0)|0)+((8191&(i=(i=i+Math.imul(f,eo)|0)+Math.imul(h,es)|0))<<13)|0;c=((s=s+Math.imul(h,eo)|0)+(i>>>13)|0)+(ex>>>26)|0,ex&=67108863,n=Math.imul(B,z),i=(i=Math.imul(B,F))+Math.imul(R,z)|0,s=Math.imul(R,F),n=n+Math.imul(C,W)|0,i=(i=i+Math.imul(C,V)|0)+Math.imul(k,W)|0,s=s+Math.imul(k,V)|0,n=n+Math.imul(I,G)|0,i=(i=i+Math.imul(I,K)|0)+Math.imul(O,G)|0,s=s+Math.imul(O,K)|0,n=n+Math.imul(_,J)|0,i=(i=i+Math.imul(_,Y)|0)+Math.imul(A,J)|0,s=s+Math.imul(A,Y)|0,n=n+Math.imul(v,Q)|0,i=(i=i+Math.imul(v,ee)|0)+Math.imul(E,Q)|0,s=s+Math.imul(E,ee)|0,n=n+Math.imul(m,er)|0,i=(i=i+Math.imul(m,en)|0)+Math.imul(b,er)|0,s=s+Math.imul(b,en)|0,n=n+Math.imul(p,es)|0,i=(i=i+Math.imul(p,eo)|0)+Math.imul(g,es)|0,s=s+Math.imul(g,eo)|0;var e_=(c+(n=n+Math.imul(f,el)|0)|0)+((8191&(i=(i=i+Math.imul(f,ec)|0)+Math.imul(h,el)|0))<<13)|0;c=((s=s+Math.imul(h,ec)|0)+(i>>>13)|0)+(e_>>>26)|0,e_&=67108863,n=Math.imul(U,z),i=(i=Math.imul(U,F))+Math.imul(M,z)|0,s=Math.imul(M,F),n=n+Math.imul(B,W)|0,i=(i=i+Math.imul(B,V)|0)+Math.imul(R,W)|0,s=s+Math.imul(R,V)|0,n=n+Math.imul(C,G)|0,i=(i=i+Math.imul(C,K)|0)+Math.imul(k,G)|0,s=s+Math.imul(k,K)|0,n=n+Math.imul(I,J)|0,i=(i=i+Math.imul(I,Y)|0)+Math.imul(O,J)|0,s=s+Math.imul(O,Y)|0,n=n+Math.imul(_,Q)|0,i=(i=i+Math.imul(_,ee)|0)+Math.imul(A,Q)|0,s=s+Math.imul(A,ee)|0,n=n+Math.imul(v,er)|0,i=(i=i+Math.imul(v,en)|0)+Math.imul(E,er)|0,s=s+Math.imul(E,en)|0,n=n+Math.imul(m,es)|0,i=(i=i+Math.imul(m,eo)|0)+Math.imul(b,es)|0,s=s+Math.imul(b,eo)|0,n=n+Math.imul(p,el)|0,i=(i=i+Math.imul(p,ec)|0)+Math.imul(g,el)|0,s=s+Math.imul(g,ec)|0;var eA=(c+(n=n+Math.imul(f,ef)|0)|0)+((8191&(i=(i=i+Math.imul(f,eh)|0)+Math.imul(h,ef)|0))<<13)|0;c=((s=s+Math.imul(h,eh)|0)+(i>>>13)|0)+(eA>>>26)|0,eA&=67108863,n=Math.imul(j,z),i=(i=Math.imul(j,F))+Math.imul(L,z)|0,s=Math.imul(L,F),n=n+Math.imul(U,W)|0,i=(i=i+Math.imul(U,V)|0)+Math.imul(M,W)|0,s=s+Math.imul(M,V)|0,n=n+Math.imul(B,G)|0,i=(i=i+Math.imul(B,K)|0)+Math.imul(R,G)|0,s=s+Math.imul(R,K)|0,n=n+Math.imul(C,J)|0,i=(i=i+Math.imul(C,Y)|0)+Math.imul(k,J)|0,s=s+Math.imul(k,Y)|0,n=n+Math.imul(I,Q)|0,i=(i=i+Math.imul(I,ee)|0)+Math.imul(O,Q)|0,s=s+Math.imul(O,ee)|0,n=n+Math.imul(_,er)|0,i=(i=i+Math.imul(_,en)|0)+Math.imul(A,er)|0,s=s+Math.imul(A,en)|0,n=n+Math.imul(v,es)|0,i=(i=i+Math.imul(v,eo)|0)+Math.imul(E,es)|0,s=s+Math.imul(E,eo)|0,n=n+Math.imul(m,el)|0,i=(i=i+Math.imul(m,ec)|0)+Math.imul(b,el)|0,s=s+Math.imul(b,ec)|0,n=n+Math.imul(p,ef)|0,i=(i=i+Math.imul(p,eh)|0)+Math.imul(g,ef)|0,s=s+Math.imul(g,eh)|0;var eS=(c+(n=n+Math.imul(f,ep)|0)|0)+((8191&(i=(i=i+Math.imul(f,eg)|0)+Math.imul(h,ep)|0))<<13)|0;c=((s=s+Math.imul(h,eg)|0)+(i>>>13)|0)+(eS>>>26)|0,eS&=67108863,n=Math.imul(j,W),i=(i=Math.imul(j,V))+Math.imul(L,W)|0,s=Math.imul(L,V),n=n+Math.imul(U,G)|0,i=(i=i+Math.imul(U,K)|0)+Math.imul(M,G)|0,s=s+Math.imul(M,K)|0,n=n+Math.imul(B,J)|0,i=(i=i+Math.imul(B,Y)|0)+Math.imul(R,J)|0,s=s+Math.imul(R,Y)|0,n=n+Math.imul(C,Q)|0,i=(i=i+Math.imul(C,ee)|0)+Math.imul(k,Q)|0,s=s+Math.imul(k,ee)|0,n=n+Math.imul(I,er)|0,i=(i=i+Math.imul(I,en)|0)+Math.imul(O,er)|0,s=s+Math.imul(O,en)|0,n=n+Math.imul(_,es)|0,i=(i=i+Math.imul(_,eo)|0)+Math.imul(A,es)|0,s=s+Math.imul(A,eo)|0,n=n+Math.imul(v,el)|0,i=(i=i+Math.imul(v,ec)|0)+Math.imul(E,el)|0,s=s+Math.imul(E,ec)|0,n=n+Math.imul(m,ef)|0,i=(i=i+Math.imul(m,eh)|0)+Math.imul(b,ef)|0,s=s+Math.imul(b,eh)|0;var eI=(c+(n=n+Math.imul(p,ep)|0)|0)+((8191&(i=(i=i+Math.imul(p,eg)|0)+Math.imul(g,ep)|0))<<13)|0;c=((s=s+Math.imul(g,eg)|0)+(i>>>13)|0)+(eI>>>26)|0,eI&=67108863,n=Math.imul(j,G),i=(i=Math.imul(j,K))+Math.imul(L,G)|0,s=Math.imul(L,K),n=n+Math.imul(U,J)|0,i=(i=i+Math.imul(U,Y)|0)+Math.imul(M,J)|0,s=s+Math.imul(M,Y)|0,n=n+Math.imul(B,Q)|0,i=(i=i+Math.imul(B,ee)|0)+Math.imul(R,Q)|0,s=s+Math.imul(R,ee)|0,n=n+Math.imul(C,er)|0,i=(i=i+Math.imul(C,en)|0)+Math.imul(k,er)|0,s=s+Math.imul(k,en)|0,n=n+Math.imul(I,es)|0,i=(i=i+Math.imul(I,eo)|0)+Math.imul(O,es)|0,s=s+Math.imul(O,eo)|0,n=n+Math.imul(_,el)|0,i=(i=i+Math.imul(_,ec)|0)+Math.imul(A,el)|0,s=s+Math.imul(A,ec)|0,n=n+Math.imul(v,ef)|0,i=(i=i+Math.imul(v,eh)|0)+Math.imul(E,ef)|0,s=s+Math.imul(E,eh)|0;var eO=(c+(n=n+Math.imul(m,ep)|0)|0)+((8191&(i=(i=i+Math.imul(m,eg)|0)+Math.imul(b,ep)|0))<<13)|0;c=((s=s+Math.imul(b,eg)|0)+(i>>>13)|0)+(eO>>>26)|0,eO&=67108863,n=Math.imul(j,J),i=(i=Math.imul(j,Y))+Math.imul(L,J)|0,s=Math.imul(L,Y),n=n+Math.imul(U,Q)|0,i=(i=i+Math.imul(U,ee)|0)+Math.imul(M,Q)|0,s=s+Math.imul(M,ee)|0,n=n+Math.imul(B,er)|0,i=(i=i+Math.imul(B,en)|0)+Math.imul(R,er)|0,s=s+Math.imul(R,en)|0,n=n+Math.imul(C,es)|0,i=(i=i+Math.imul(C,eo)|0)+Math.imul(k,es)|0,s=s+Math.imul(k,eo)|0,n=n+Math.imul(I,el)|0,i=(i=i+Math.imul(I,ec)|0)+Math.imul(O,el)|0,s=s+Math.imul(O,ec)|0,n=n+Math.imul(_,ef)|0,i=(i=i+Math.imul(_,eh)|0)+Math.imul(A,ef)|0,s=s+Math.imul(A,eh)|0;var eP=(c+(n=n+Math.imul(v,ep)|0)|0)+((8191&(i=(i=i+Math.imul(v,eg)|0)+Math.imul(E,ep)|0))<<13)|0;c=((s=s+Math.imul(E,eg)|0)+(i>>>13)|0)+(eP>>>26)|0,eP&=67108863,n=Math.imul(j,Q),i=(i=Math.imul(j,ee))+Math.imul(L,Q)|0,s=Math.imul(L,ee),n=n+Math.imul(U,er)|0,i=(i=i+Math.imul(U,en)|0)+Math.imul(M,er)|0,s=s+Math.imul(M,en)|0,n=n+Math.imul(B,es)|0,i=(i=i+Math.imul(B,eo)|0)+Math.imul(R,es)|0,s=s+Math.imul(R,eo)|0,n=n+Math.imul(C,el)|0,i=(i=i+Math.imul(C,ec)|0)+Math.imul(k,el)|0,s=s+Math.imul(k,ec)|0,n=n+Math.imul(I,ef)|0,i=(i=i+Math.imul(I,eh)|0)+Math.imul(O,ef)|0,s=s+Math.imul(O,eh)|0;var eC=(c+(n=n+Math.imul(_,ep)|0)|0)+((8191&(i=(i=i+Math.imul(_,eg)|0)+Math.imul(A,ep)|0))<<13)|0;c=((s=s+Math.imul(A,eg)|0)+(i>>>13)|0)+(eC>>>26)|0,eC&=67108863,n=Math.imul(j,er),i=(i=Math.imul(j,en))+Math.imul(L,er)|0,s=Math.imul(L,en),n=n+Math.imul(U,es)|0,i=(i=i+Math.imul(U,eo)|0)+Math.imul(M,es)|0,s=s+Math.imul(M,eo)|0,n=n+Math.imul(B,el)|0,i=(i=i+Math.imul(B,ec)|0)+Math.imul(R,el)|0,s=s+Math.imul(R,ec)|0,n=n+Math.imul(C,ef)|0,i=(i=i+Math.imul(C,eh)|0)+Math.imul(k,ef)|0,s=s+Math.imul(k,eh)|0;var ek=(c+(n=n+Math.imul(I,ep)|0)|0)+((8191&(i=(i=i+Math.imul(I,eg)|0)+Math.imul(O,ep)|0))<<13)|0;c=((s=s+Math.imul(O,eg)|0)+(i>>>13)|0)+(ek>>>
vendor: 28,257 bytes, line 27
2726)|0,ek&=67108863,n=Math.imul(j,es),i=(i=Math.imul(j,eo))+Math.imul(L,es)|0,s=Math.imul(L,eo),n=n+Math.imul(U,el)|0,i=(i=i+Math.imul(U,ec)|0)+Math.imul(M,el)|0,s=s+Math.imul(M,ec)|0,n=n+Math.imul(B,ef)|0,i=(i=i+Math.imul(B,eh)|0)+Math.imul(R,ef)|0,s=s+Math.imul(R,eh)|0;var eT=(c+(n=n+Math.imul(C,ep)|0)|0)+((8191&(i=(i=i+Math.imul(C,eg)|0)+Math.imul(k,ep)|0))<<13)|0;c=((s=s+Math.imul(k,eg)|0)+(i>>>13)|0)+(eT>>>26)|0,eT&=67108863,n=Math.imul(j,el),i=(i=Math.imul(j,ec))+Math.imul(L,el)|0,s=Math.imul(L,ec),n=n+Math.imul(U,ef)|0,i=(i=i+Math.imul(U,eh)|0)+Math.imul(M,ef)|0,s=s+Math.imul(M,eh)|0;var eB=(c+(n=n+Math.imul(B,ep)|0)|0)+((8191&(i=(i=i+Math.imul(B,eg)|0)+Math.imul(R,ep)|0))<<13)|0;c=((s=s+Math.imul(R,eg)|0)+(i>>>13)|0)+(eB>>>26)|0,eB&=67108863,n=Math.imul(j,ef),i=(i=Math.imul(j,eh))+Math.imul(L,ef)|0,s=Math.imul(L,eh);var eR=(c+(n=n+Math.imul(U,ep)|0)|0)+((8191&(i=(i=i+Math.imul(U,eg)|0)+Math.imul(M,ep)|0))<<13)|0;c=((s=s+Math.imul(M,eg)|0)+(i>>>13)|0)+(eR>>>26)|0,eR&=67108863;var eD=(c+(n=Math.imul(j,ep))|0)+((8191&(i=(i=Math.imul(j,eg))+Math.imul(L,ep)|0))<<13)|0;return c=((s=Math.imul(L,eg))+(i>>>13)|0)+(eD>>>26)|0,eD&=67108863,l[0]=ey,l[1]=em,l[2]=eb,l[3]=ew,l[4]=ev,l[5]=eE,l[6]=ex,l[7]=e_,l[8]=eA,l[9]=eS,l[10]=eI,l[11]=eO,l[12]=eP,l[13]=eC,l[14]=ek,l[15]=eT,l[16]=eB,l[17]=eR,l[18]=eD,0!==c&&(l[19]=c,r.length++),r};function m(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var n=0,i=0,s=0;s<r.length-1;s++){var o=i;i=0;for(var a=67108863&n,l=Math.min(s,t.length-1),c=Math.max(0,s-e.length+1);c<=l;c++){var u=s-c,f=(0|e.words[u])*(0|t.words[c]),h=67108863&f;o=o+(f/67108864|0)|0,a=67108863&(h=h+a|0),i+=(o=o+(h>>>26)|0)>>>26,o&=67108863}r.words[s]=a,n=o,o=i}return 0!==n?r.words[s]=n:r.length--,r._strip()}function b(e,t){this.x=e,this.y=t}Math.imul||(y=g),s.prototype.mulTo=function(e,t){var r,n=this.length+e.length;return 10===this.length&&10===e.length?y(this,e,t):n<63?g(this,e,t):m(this,e,t)},b.prototype.makeRBT=function(e){for(var t=Array(e),r=s.prototype._countBits(e)-1,n=0;n<e;n++)t[n]=this.revBin(n,r,e);return t},b.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var n=0,i=0;i<t;i++)n|=(1&e)<<t-i-1,e>>=1;return n},b.prototype.permute=function(e,t,r,n,i,s){for(var o=0;o<s;o++)n[o]=t[e[o]],i[o]=r[e[o]]},b.prototype.transform=function(e,t,r,n,i,s){this.permute(s,e,t,r,n,i);for(var o=1;o<i;o<<=1)for(var a=o<<1,l=Math.cos(2*Math.PI/a),c=Math.sin(2*Math.PI/a),u=0;u<i;u+=a)for(var f=l,h=c,d=0;d<o;d++){var p=r[u+d],g=n[u+d],y=r[u+d+o],m=n[u+d+o],b=f*y-h*m;m=f*m+h*y,y=b,r[u+d]=p+y,n[u+d]=g+m,r[u+d+o]=p-y,n[u+d+o]=g-m,d!==a&&(b=l*f-c*h,h=l*h+c*f,f=b)}},b.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),n=1&r,i=0;for(r=r/2|0;r;r>>>=1)i++;return 1<<i+1+n},b.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var n=0;n<r/2;n++){var i=e[n];e[n]=e[r-n-1],e[r-n-1]=i,i=t[n],t[n]=-t[r-n-1],t[r-n-1]=-i}},b.prototype.normalize13b=function(e,t){for(var r=0,n=0;n<t/2;n++){var i=8192*Math.round(e[2*n+1]/t)+Math.round(e[2*n]/t)+r;e[n]=67108863&i,r=i<67108864?0:i/67108864|0}return e},b.prototype.convert13b=function(e,t,r,i){for(var s=0,o=0;o<t;o++)s+=0|e[o],r[2*o]=8191&s,s>>>=13,r[2*o+1]=8191&s,s>>>=13;for(o=2*t;o<i;++o)r[o]=0;n(0===s),n((-8192&s)==0)},b.prototype.stub=function(e){for(var t=Array(e),r=0;r<e;r++)t[r]=0;return t},b.prototype.mulp=function(e,t,r){var n=2*this.guessLen13b(e.length,t.length),i=this.makeRBT(n),s=this.stub(n),o=Array(n),a=Array(n),l=Array(n),c=Array(n),u=Array(n),f=Array(n),h=r.words;h.length=n,this.convert13b(e.words,e.length,o,n),this.convert13b(t.words,t.length,c,n),this.transform(o,s,a,l,n,i),this.transform(c,s,u,f,n,i);for(var d=0;d<n;d++){var p=a[d]*u[d]-l[d]*f[d];l[d]=a[d]*f[d]+l[d]*u[d],a[d]=p}return this.conjugate(a,l,n),this.transform(a,l,h,s,n,i),this.conjugate(h,s,n),this.normalize13b(h,n),r.negative=e.negative^t.negative,r.length=e.length+t.length,r._strip()},s.prototype.mul=function(e){var t=new s(null);return t.words=Array(this.length+e.length),this.mulTo(e,t)},s.prototype.mulf=function(e){var t=new s(null);return t.words=Array(this.length+e.length),m(this,e,t)},s.prototype.imul=function(e){return this.clone().mulTo(e,this)},s.prototype.imuln=function(e){var t=e<0;t&&(e=-e),n("number"==typeof e),n(e<67108864);for(var r=0,i=0;i<this.length;i++){var s=(0|this.words[i])*e,o=(67108863&s)+(67108863&r);r>>=26,r+=(s/67108864|0)+(o>>>26),this.words[i]=67108863&o}return 0!==r&&(this.words[i]=r,this.length++),this.length=0===e?1:this.length,t?this.ineg():this},s.prototype.muln=function(e){return this.clone().imuln(e)},s.prototype.sqr=function(){return this.mul(this)},s.prototype.isqr=function(){return this.imul(this.clone())},s.prototype.pow=function(e){var t=function(e){for(var t=Array(e.bitLength()),r=0;r<t.length;r++){var n=r/26|0,i=r%26;t[r]=e.words[n]>>>i&1}return t}(e);if(0===t.length)return new s(1);for(var r=this,n=0;n<t.length&&0===t[n];n++,r=r.sqr());if(++n<t.length)for(var i=r.sqr();n<t.length;n++,i=i.sqr())0!==t[n]&&(r=r.mul(i));return r},s.prototype.iushln=function(e){n("number"==typeof e&&e>=0);var t,r=e%26,i=(e-r)/26,s=67108863>>>26-r<<26-r;if(0!==r){var o=0;for(t=0;t<this.length;t++){var a=this.words[t]&s,l=(0|this.words[t])-a<<r;this.words[t]=l|o,o=a>>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==i){for(t=this.length-1;t>=0;t--)this.words[t+i]=this.words[t];for(t=0;t<i;t++)this.words[t]=0;this.length+=i}return this._strip()},s.prototype.ishln=function(e){return n(0===this.negative),this.iushln(e)},s.prototype.iushrn=function(e,t,r){n("number"==typeof e&&e>=0),i=t?(t-t%26)/26:0;var i,s=e%26,o=Math.min((e-s)/26,this.length),a=67108863^67108863>>>s<<s;if(i-=o,i=Math.max(0,i),r){for(var l=0;l<o;l++)r.words[l]=this.words[l];r.length=o}if(0===o);else if(this.length>o)for(this.length-=o,l=0;l<this.length;l++)this.words[l]=this.words[l+o];else this.words[0]=0,this.length=1;var c=0;for(l=this.length-1;l>=0&&(0!==c||l>=i);l--){var u=0|this.words[l];this.words[l]=c<<26-s|u>>>s,c=u&a}return r&&0!==c&&(r.words[r.length++]=c),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(e,t,r){return n(0===this.negative),this.iushrn(e,t,r)},s.prototype.shln=function(e){return this.clone().ishln(e)},s.prototype.ushln=function(e){return this.clone().iushln(e)},s.prototype.shrn=function(e){return this.clone().ishrn(e)},s.prototype.ushrn=function(e){return this.clone().iushrn(e)},s.prototype.testn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;return!(this.length<=r)&&!!(this.words[r]&1<<t)},s.prototype.imaskn=function(e){n("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;return(n(0===this.negative,"imaskn works only with positive numbers"),this.length<=r)?this:(0!==t&&r++,this.length=Math.min(r,this.length),0!==t&&(this.words[this.length-1]&=67108863^67108863>>>t<<t),0===this.length&&(this.words[0]=0,this.length=1),this._strip())},s.prototype.maskn=function(e){return this.clone().imaskn(e)},s.prototype.iaddn=function(e){return(n("number"==typeof e),n(e<67108864),e<0)?this.isubn(-e):0!==this.negative?(1===this.length&&(0|this.words[0])<=e?(this.words[0]=e-(0|this.words[0]),this.negative=0):(this.negative=0,this.isubn(e),this.negative=1),this):this._iaddn(e)},s.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},s.prototype.isubn=function(e){if(n("number"==typeof e),n(e<67108864),e<0)return this.iaddn(-e);if(0!==this.negative)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,1===this.length&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this._strip()},s.prototype.addn=function(e){return this.clone().iaddn(e)},s.prototype.subn=function(e){return this.clone().isubn(e)},s.prototype.iabs=function(){return this.negative=0,this},s.prototype.abs=function(){return this.clone().iabs()},s.prototype._ishlnsubmul=function(e,t,r){var i,s,o=e.length+r;this._expand(o);var a=0;for(i=0;i<e.length;i++){s=(0|this.words[i+r])+a;var l=(0|e.words[i])*t;s-=67108863&l,a=(s>>26)-(l/67108864|0),this.words[i+r]=67108863&s}for(;i<this.length-r;i++)a=(s=(0|this.words[i+r])+a)>>26,this.words[i+r]=67108863&s;if(0===a)return this._strip();for(n(-1===a),a=0,i=0;i<this.length;i++)a=(s=-(0|this.words[i])+a)>>26,this.words[i]=67108863&s;return this.negative=1,this._strip()},s.prototype._wordDiv=function(e,t){var r,n=this.length-e.length,i=this.clone(),o=e,a=0|o.words[o.length-1];0!=(n=26-this._countBits(a))&&(o=o.ushln(n),i.iushln(n),a=0|o.words[o.length-1]);var l=i.length-o.length;if("mod"!==t){(r=new s(null)).length=l+1,r.words=Array(r.length);for(var c=0;c<r.length;c++)r.words[c]=0}var u=i.clone()._ishlnsubmul(o,1,l);0===u.negative&&(i=u,r&&(r.words[l]=1));for(var f=l-1;f>=0;f--){var h=(0|i.words[o.length+f])*67108864+(0|i.words[o.length+f-1]);for(h=Math.min(h/a|0,67108863),i._ishlnsubmul(o,h,f);0!==i.negative;)h--,i.negative=0,i._ishlnsubmul(o,1,f),i.isZero()||(i.negative^=1);r&&(r.words[f]=h)}return r&&r._strip(),i._strip(),"div"!==t&&0!==n&&i.iushrn(n),{div:r||null,mod:i}},s.prototype.divmod=function(e,t,r){var i,o,a;return(n(!e.isZero()),this.isZero())?{div:new s(0),mod:new s(0)}:0!==this.negative&&0===e.negative?(a=this.neg().divmod(e,t),"mod"!==t&&(i=a.div.neg()),"div"!==t&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(e)),{div:i,mod:o}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(i=a.div.neg()),{div:i,mod:a.mod}):(this.negative&e.negative)!=0?(a=this.neg().divmod(e.neg(),t),"div"!==t&&(o=a.mod.neg(),r&&0!==o.negative&&o.isub(e)),{div:a.div,mod:o}):e.length>this.length||0>this.cmp(e)?{div:new s(0),mod:this}:1===e.length?"div"===t?{div:this.divn(e.words[0]),mod:null}:"mod"===t?{div:null,mod:new s(this.modrn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new s(this.modrn(e.words[0]))}:this._wordDiv(e,t)},s.prototype.div=function(e){return this.divmod(e,"div",!1).div},s.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},s.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},s.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var r=0!==t.div.negative?t.mod.isub(e):t.mod,n=e.ushrn(1),i=e.andln(1),s=r.cmp(n);return s<0||1===i&&0===s?t.div:0!==t.div.negative?t.div.isubn(1):t.div.iaddn(1)},s.prototype.modrn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=67108864%e,i=0,s=this.length-1;s>=0;s--)i=(r*i+(0|this.words[s]))%e;return t?-i:i},s.prototype.modn=function(e){return this.modrn(e)},s.prototype.idivn=function(e){var t=e<0;t&&(e=-e),n(e<=67108863);for(var r=0,i=this.length-1;i>=0;i--){var s=(0|this.words[i])+67108864*r;this.words[i]=s/e|0,r=s%e}return this._strip(),t?this.ineg():this},s.prototype.divn=function(e){return this.clone().idivn(e)},s.prototype.egcd=function(e){n(0===e.negative),n(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var i=new s(1),o=new s(0),a=new s(0),l=new s(1),c=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++c;for(var u=r.clone(),f=t.clone();!t.isZero();){for(var h=0,d=1;(t.words[0]&d)==0&&h<26;++h,d<<=1);if(h>0)for(t.iushrn(h);h-- >0;)(i.isOdd()||o.isOdd())&&(i.iadd(u),o.isub(f)),i.iushrn(1),o.iushrn(1);for(var p=0,g=1;(r.words[0]&g)==0&&p<26;++p,g<<=1);if(p>0)for(r.iushrn(p);p-- >0;)(a.isOdd()||l.isOdd())&&(a.iadd(u),l.isub(f)),a.iushrn(1),l.iushrn(1);t.cmp(r)>=0?(t.isub(r),i.isub(a),o.isub(l)):(r.isub(t),a.isub(i),l.isub(o))}return{a:a,b:l,gcd:r.iushln(c)}},s.prototype._invmp=function(e){n(0===e.negative),n(!e.isZero());var t,r=this,i=e.clone();r=0!==r.negative?r.umod(e):r.clone();for(var o=new s(1),a=new s(0),l=i.clone();r.cmpn(1)>0&&i.cmpn(1)>0;){for(var c=0,u=1;(r.words[0]&u)==0&&c<26;++c,u<<=1);if(c>0)for(r.iushrn(c);c-- >0;)o.isOdd()&&o.iadd(l),o.iushrn(1);for(var f=0,h=1;(i.words[0]&h)==0&&f<26;++f,h<<=1);if(f>0)for(i.iushrn(f);f-- >0;)a.isOdd()&&a.iadd(l),a.iushrn(1);r.cmp(i)>=0?(r.isub(i),o.isub(a)):(i.isub(r),a.isub(o))}return 0>(t=0===r.cmpn(1)?o:a).cmpn(0)&&t.iadd(e),t},s.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),r=e.clone();t.negative=0,r.negative=0;for(var n=0;t.isEven()&&r.isEven();n++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var i=t.cmp(r);if(i<0){var s=t;t=r,r=s}else if(0===i||0===r.cmpn(1))break;t.isub(r)}return r.iushln(n)},s.prototype.invm=function(e){return this.egcd(e).a.umod(e)},s.prototype.isEven=function(){return(1&this.words[0])==0},s.prototype.isOdd=function(){return(1&this.words[0])==1},s.prototype.andln=function(e){return this.words[0]&e},s.prototype.bincn=function(e){n("number"==typeof e);var t=e%26,r=(e-t)/26,i=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=i,this;for(var s=i,o=r;0!==s&&o<this.length;o++){var a=0|this.words[o];a+=s,s=a>>>26,a&=67108863,this.words[o]=a}return 0!==s&&(this.words[o]=s,this.length++),this},s.prototype.isZero=function(){return 1===this.length&&0===this.words[0]},s.prototype.cmpn=function(e){var t,r=e<0;if(0!==this.negative&&!r)return -1;if(0===this.negative&&r)return 1;if(this._strip(),this.length>1)t=1;else{r&&(e=-e),n(e<=67108863,"Number is too big");var i=0|this.words[0];t=i===e?0:i<e?-1:1}return 0!==this.negative?0|-t:t},s.prototype.cmp=function(e){if(0!==this.negative&&0===e.negative)return -1;if(0===this.negative&&0!==e.negative)return 1;var t=this.ucmp(e);return 0!==this.negative?0|-t:t},s.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return -1;for(var t=0,r=this.length-1;r>=0;r--){var n=0|this.words[r],i=0|e.words[r];if(n!==i){n<i?t=-1:n>i&&(t=1);break}}return t},s.prototype.gtn=function(e){return 1===this.cmpn(e)},s.prototype.gt=function(e){return 1===this.cmp(e)},s.prototype.gten=function(e){return this.cmpn(e)>=0},s.prototype.gte=function(e){return this.cmp(e)>=0},s.prototype.ltn=function(e){return -1===this.cmpn(e)},s.prototype.lt=function(e){return -1===this.cmp(e)},s.prototype.lten=function(e){return 0>=this.cmpn(e)},s.prototype.lte=function(e){return 0>=this.cmp(e)},s.prototype.eqn=function(e){return 0===this.cmpn(e)},s.prototype.eq=function(e){return 0===this.cmp(e)},s.red=function(e){return new S(e)},s.prototype.toRed=function(e){return n(!this.red,"Already a number in reduction context"),n(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},s.prototype.fromRed=function(){return n(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},s.prototype._forceRed=function(e){return this.red=e,this},s.prototype.forceRed=function(e){return n(!this.red,"Already a number in reduction context"),this._forceRed(e)},s.prototype.redAdd=function(e){return n(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},s.prototype.redIAdd=function(e){return n(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},s.prototype.redSub=function(e){return n(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},s.prototype.redISub=function(e){return n(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},s.prototype.redShl=function(e){return n(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},s.prototype.redMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},s.prototype.redIMul=function(e){return n(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},s.prototype.redSqr=function(){return n(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return n(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return n(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return n(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return n(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(e){return n(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var w={k256:null,p224:null,p192:null,p25519:null};function v(e,t){this.name=e,this.p=new s(t,16),this.n=this.p.bitLength(),this.k=new s(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}function E(){v.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}function x(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function _(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function A(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function S(e){if("string"==typeof e){var t=s._prime(e);this.m=t.p,this.prime=t}else n(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function I(e){S.call(this,e),this.shift=this.m.bitLength(),this.shift%26!=0&&(this.shift+=26-this.shift%26),this.r=new s(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v.prototype._tmp=function(){var e=new s(null);return e.words=Array(Math.ceil(this.n/13)),e},v.prototype.ireduce=function(e){var t,r=e;do this.split(r,this.tmp),t=(r=(r=this.imulK(r)).iadd(this.tmp)).bitLength();while(t>this.n);var n=t<this.n?-1:r.ucmp(this.p);return 0===n?(r.words[0]=0,r.length=1):n>0?r.isub(this.p):void 0!==r.strip?r.strip():r._strip(),r},v.prototype.split=function(e,t){e.iushrn(this.n,0,t)},v.prototype.imulK=function(e){return e.imul(this.k)},i(E,v),E.prototype.split=function(e,t){for(var r=Math.min(e.length,9),n=0;n<r;n++)t.words[n]=e.words[n];if(t.length=r,e.length<=9){e.words[0]=0,e.length=1;return}var i=e.words[9];for(n=10,t.words[t.length++]=4194303&i;n<e.length;n++){var s=0|e.words[n];e.words[n-10]=(4194303&s)<<4|i>>>22,i=s}i>>>=22,e.words[n-10]=i,0===i&&e.length>10?e.length-=10:e.length-=9},E.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,r=0;r<e.length;r++){var n=0|e.words[r];t+=977*n,e.words[r]=67108863&t,t=64*n+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},i(x,v),i(_,v),i(A,v),A.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var n=(0|e.words[r])*19+t,i=67108863&n;n>>>=26,e.words[r]=i,t=n}return 0!==t&&(e.words[e.length++]=t),e},s._prime=function(e){var t;if(w[e])return w[e];if("k256"===e)t=new E;else if("p224"===e)t=new x;else if("p192"===e)t=new _;else if("p25519"===e)t=new A;else throw Error("Unknown prime "+e);return w[e]=t,t},S.prototype._verify1=function(e){n(0===e.negative,"red works only with positives"),n(e.red,"red works only with red numbers")},S.prototype._verify2=function(e,t){n((e.negative|t.negative)==0,"red works only with positives"),n(e.red&&e.red===t.red,"red works only with red numbers")},S.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(c(e,e.umod(this.m)._forceRed(this)),e)},S.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},S.prototype.add=function(e,t){this._verify2(e,t);var r=e.add(t);return r.cmp(this.m)>=0&&r.isub(this.m),r._forceRed(this)},S.prototype.iadd=function(e,t){this._verify2(e,t);var r=e.iadd(t);return r.cmp(this.m)>=0&&r.isub(this.m),r},S.prototype.sub=function(e,t){this._verify2(e,t);var r=e.sub(t);return 0>r.cmpn(0)&&r.iadd(this.m),r._forceRed(this)},S.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return 0>r.cmpn(0)&&r.iadd(this.m),r},S.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},S.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},S.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},S.prototype.isqr=function(e){return this.imul(e,e.clone())},S.prototype.sqr=function(e){return this.mul(e,e)},S.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(n(t%2==1),3===t){var r=this.m.add(new s(1)).iushrn(2);return this.pow(e,r)}for(var i=this.m.subn(1),o=0;!i.isZero()&&0===i.andln(1);)o++,i.iushrn(1);n(!i.isZero());var a=new s(1).toRed(this),l=a.redNeg(),c=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new s(2*u*u).toRed(this);0!==this.pow(u,c).cmp(l);)u.redIAdd(l);for(var f=this.pow(u,i),h=this.pow(e,i.addn(1).iushrn(1)),d=this.pow(e,i),p=o;0!==d.cmp(a);){for(var g=d,y=0;0!==g.cmp(a);y++)g=g.redSqr();n(y<p);var m=this.pow(f,new s(1).iushln(p-y-1));h=h.redMul(m),f=m.redSqr(),d=d.redMul(f),p=y}return h},S.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},S.prototype.pow=function(e,t){if(t.isZero())return new s(1).toRed(this);if(0===t.cmpn(1))return e.clone();var r=Array(16);r[0]=new s(1).toRed(this),r[1]=e;for(var n=2;n<r.length;n++)r[n]=this.mul(r[n-1],e);var i=r[0],o=0,a=0,l=t.bitLength()%26;for(0===l&&(l=26),n=t.length-1;n>=0;n--){for(var c=t.words[n],u=l-1;u>=0;u--){var f=c>>u&1;if(i!==r[0]&&(i=this.sqr(i)),0===f&&0===o){a=0;continue}o<<=1,o|=f,(4==++a||0===n&&0===u)&&(i=this.mul(i,r[o]),a=0,o=0)}l=26}return i},S.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},S.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},s.mont=function(e){return new I(e)},i(I,S),I.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},I.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},I.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),s=i;return i.cmp(this.m)>=0?s=i.isub(this.m):0>i.cmpn(0)&&(s=i.iadd(this.m)),s._forceRed(this)},I.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new s(0)._forceRed(this);var r=e.mul(t),n=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),i=r.isub(n).iushrn(this.shift),o=i;return i.cmp(this.m)>=0?o=i.isub(this.m):0>i.cmpn(0)&&(o=i.iadd(this.m)),o._forceRed(this)},I.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},5810:function(e,t,r){"use strict";var n=r(9109).Buffer,i=this&&this.__createBinding||(Object.create?function(e,t,r,n){void 0===n&&(n=r),Object.defineProperty(e,n,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,n){void 0===n&&(n=r),e[n]=t[r]}),s=this&&this.__setModuleDefault||(Object.create?function(e,t){Object.defineProperty(e,"default",{enumerable:!0,value:t})}:function(e,t){e.default=t}),o=this&&this.__decorate||function(e,t,r,n){var i,s=arguments.length,o=s<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var a=e.length-1;a>=0;a--)(i=e[a])&&(o=(s<3?i(o):s>3?i(t,r,o):i(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o},a=this&&this.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(null!=e)for(var r in e)"default"!==r&&Object.hasOwnProperty.call(e,r)&&i(t,e,r);return s(t,e),t},l=this&&this.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(t,"__esModule",{value:!0}),t.deserializeUnchecked=t.deserialize=t.serialize=t.BinaryReader=t.BinaryWriter=t.BorshError=t.baseDecode=t.baseEncode=void 0;let c=l(r(58171)),u=l(r(75824)),f=a(r(57139)),h=new("function"!=typeof TextDecoder?f.TextDecoder:TextDecoder)("utf-8",{fatal:!0});t.baseEncode=function(e){return"string"==typeof e&&(e=n.from(e,"utf8")),u.default.encode(n.from(e))},t.baseDecode=function(e){return n.from(u.default.decode(e))};class d extends Error{constructor(e){super(e),this.fieldPath=[],this.originalMessage=e}addToFieldPath(e){this.fieldPath.splice(0,0,e),this.message=this.originalMessage+": "+this.fieldPath.join(".")}}t.BorshError=d;class p{constructor(){this.buf=n.alloc(1024),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=n.concat([this.buf,n.alloc(1024)]))}writeU8(e){this.maybeResize(),this.buf.writeUInt8(e,this.length),this.length+=1}writeU16(e){this.maybeResize(),this.buf.writeUInt16LE(e,this.length),this.length+=2}writeU32(e){this.maybeResize(),this.buf.writeUInt32LE(e,this.length),this.length+=4}writeU64(e){this.maybeResize(),this.writeBuffer(n.from(new c.default(e).toArray("le",8)))}writeU128(e){this.maybeResize(),this.writeBuffer(n.from(new c.default(e).toArray("le",16)))}writeU256(e){this.maybeResize(),this.writeBuffer(n.from(new c.default(e).toArray("le",32)))}writeU512(e){this.maybeResize(),this.writeBuffer(n.from(new c.default(e).toArray("le",64)))}writeBuffer(e){this.buf=n.concat([n.from(this.buf.subarray(0,this.length)),e,n.alloc(1024)]),this.length+=e.length}writeString(e){this.maybeResize();let t=n.from(e,"utf8");this.writeU32(t.length),this.writeBuffer(t)}writeFixedArray(e){this.writeBuffer(n.from(e))}writeArray(e,t){for(let r of(this.maybeResize(),this.writeU32(e.length),e))this.maybeResize(),t(r)}toArray(){return this.buf.subarray(0,this.length)}}function g(e,t,r){let n=r.value;r.value=function(...e){try{return n.apply(this,e)}catch(e){if(e instanceof RangeError&&["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(e.code)>=0)throw new d("Reached the end of buffer when deserializing");throw e}}}t.BinaryWriter=p;class y{constructor(e){this.buf=e,this.offset=0}readU8(){let e=this.buf.readUInt8(this.offset);return this.offset+=1,e}readU16(){let e=this.buf.readUInt16LE(this.offset);return this.offset+=2,e}readU32(){let e=this.buf.readUInt32LE(this.offset);return this.offset+=4,e}readU64(){let e=this.readBuffer(8);return new c.default(e,"le")}readU128(){let e=this.readBuffer(16);return new c.default(e,"le")}readU256(){let e=this.readBuffer(32);return new c.default(e,"le")}readU512(){let e=this.readBuffer(64);return new c.default(e,"le")}readBuffer(e){if(this.offset+e>this.buf.length)throw new d(`Expected buffer length ${e} isn't within bounds`);let t=this.buf.slice(this.offset,this.offset+e);return this.offset+=e,t}readString(){let e=this.readU32(),t=this.readBuffer(e);try{return h.decode(t)}catch(e){throw new d(`Error decoding UTF-8 string: ${e}`)}}readFixedArray(e){return new Uint8Array(this.readBuffer(e))}readArray(e){let t=this.readU32(),r=[];for(let n=0;n<t;++n)r.push(e());return r}}function m(e){return e.charAt(0).toUpperCase()+e.slice(1)}function b(e,t,r,n,i){try{if("string"==typeof n)i[`write${m(n)}`](r);else if(n instanceof Array){if("number"==typeof n[0]){if(r.length!==n[0])throw new d(`Expecting byte array of length ${n[0]}, but got ${r.length} bytes`);i.writeFixedArray(r)}else if(2===n.length&&"number"==typeof n[1]){if(r.length!==n[1])throw new d(`Expecting byte array of length ${n[1]}, but got ${r.length} bytes`);for(let t=0;t<n[1];t++)b(e,null,r[t],n[0],i)}else i.writeArray(r,r=>{b(e,t,r,n[0],i)})}else if(void 0!==n.kind)switch(n.kind){case"option":null==r?i.writeU8(0):(i.writeU8(1),b(e,t,r,n.type,i));break;case"map":i.writeU32(r.size),r.forEach((r,s)=>{b(e,t,s,n.key,i),b(e,t,r,n.value,i)});break;default:throw new d(`FieldType ${n} unrecognized`)}else w(e,r,i)}catch(e){throw e instanceof d&&e.addToFieldPath(t),e}}function w(e,t,r){if("function"==typeof t.borshSerialize){t.borshSerialize(r);return}let n=e.get(t.constructor);if(!n)throw new d(`Class ${t.constructor.name} is missing in schema`);if("struct"===n.kind)n.fields.map(([n,i])=>{b(e,n,t[n],i,r)});else if("enum"===n.kind){let i=t[n.field];for(let s=0;s<n.values.length;++s){let[o,a]=n.values[s];if(o===i){r.writeU8(s),b(e,o,t[o],a,r);break}}}else throw new d(`Unexpected schema kind: ${n.kind} for ${t.constructor.name}`)}function v(e,t,r,n){try{if("string"==typeof r)return n[`read${m(r)}`]();if(r instanceof Array){if("number"==typeof r[0])return n.readFixedArray(r[0]);if("number"!=typeof r[1])return n.readArray(()=>
27v(e,t,r[0],n));{let t=[];for(let i=0;i<r[1];i++)t.push(v(e,null,r[0],n));return t}}if("option"===r.kind){if(n.readU8())return v(e,t,r.type,n);return}if("map"===r.kind){let i=new Map,s=n.readU32();for(let o=0;o<s;o++){let s=v(e,t,r.key,n),o=v(e,t,r.value,n);i.set(s,o)}return i}return E(e,r,n)}catch(e){throw e instanceof d&&e.addToFieldPath(t),e}}function E(e,t,r){if("function"==typeof t.borshDeserialize)return t.borshDeserialize(r);let n=e.get(t);if(!n)throw new d(`Class ${t.name} is missing in schema`);if("struct"===n.kind){let n={};for(let[i,s]of e.get(t).fields)n[i]=v(e,i,s,r);return new t(n)}if("enum"===n.kind){let i=r.readU8();if(i>=n.values.length)throw new d(`Enum index: ${i} is out of range`);let[s,o]=n.values[i],a=v(e,s,o,r);return new t({[s]:a})}throw new d(`Unexpected schema kind: ${n.kind} for ${t.constructor.name}`)}o([g],y.prototype,"readU8",null),o([g],y.prototype,"readU16",null),o([g],y.prototype,"readU32",null),o([g],y.prototype,"readU64",null),o([g],y.prototype,"readU128",null),o([g],y.prototype,"readU256",null),o([g],y.prototype,"readU512",null),o([g],y.prototype,"readString",null),o([g],y.prototype,"readFixedArray",null),o([g],y.prototype,"readArray",null),t.BinaryReader=y,t.serialize=function(e,t,r=p){let n=new r;return w(e,t,n),n.toArray()},t.deserialize=function(e,t,r,n=y){let i=new n(r),s=E(e,t,i);if(i.offset<r.length)throw new d(`Unexpected ${r.length-i.offset} bytes after deserialized data`);return s},t.deserializeUnchecked=function(e,t,r,n=y){return E(e,t,new n(r))}},9500:function(e,t,r){"use strict";var n=r(10632).Buffer;e.exports=function(e){if(e.length>=255)throw TypeError("Alphabet too long");for(var t=new Uint8Array(256),r=0;r<t.length;r++)t[r]=255;for(var i=0;i<e.length;i++){var s=e.charAt(i),o=s.charCodeAt(0);if(255!==t[o])throw TypeError(s+" is ambiguous");t[o]=i}var a=e.length,l=e.charAt(0),c=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function f(e){if("string"!=typeof e)throw TypeError("Expected String");if(0===e.length)return n.alloc(0);for(var r=0,i=0,s=0;e[r]===l;)i++,r++;for(var o=(e.length-r)*c+1>>>0,u=new Uint8Array(o);r<e.length;){var f=e.charCodeAt(r);if(f>255)return;var h=t[f];if(255===h)return;for(var d=0,p=o-1;(0!==h||d<s)&&-1!==p;p--,d++)h+=a*u[p]>>>0,u[p]=h%256>>>0,h=h/256>>>0;if(0!==h)throw Error("Non-zero carry");s=d,r++}for(var g=o-s;g!==o&&0===u[g];)g++;var y=n.allocUnsafe(i+(o-g));y.fill(0,0,i);for(var m=i;g!==o;)y[m++]=u[g++];return y}return{encode:function(t){if((Array.isArray(t)||t instanceof Uint8Array)&&(t=n.from(t)),!n.isBuffer(t))throw TypeError("Expected Buffer");if(0===t.length)return"";for(var r=0,i=0,s=0,o=t.length;s!==o&&0===t[s];)s++,r++;for(var c=(o-s)*u+1>>>0,f=new Uint8Array(c);s!==o;){for(var h=t[s],d=0,p=c-1;(0!==h||d<i)&&-1!==p;p--,d++)h+=256*f[p]>>>0,f[p]=h%a>>>0,h=h/a>>>0;if(0!==h)throw Error("Non-zero carry");i=d,s++}for(var g=c-i;g!==c&&0===f[g];)g++;for(var y=l.repeat(r);g<c;++g)y+=e.charAt(f[g]);return y},decodeUnsafe:f,decode:function(e){var t=f(e);if(t)return t;throw Error("Non-base"+a+" character")}}}},75824:function(e,t,r){var n=r(9500);e.exports=n("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},9109:function(e,t,r){"use strict";/*! 28 * The buffer module from node.js, for the browser. 29 * 30 * @author Feross Aboukhadijeh <https://feross.org> 31 * @license MIT 32 */let n=r(48738),i=r(6868),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;function o(e){if(e>2147483647)throw RangeError('The value "'+e+'" is invalid for option "size"');let t=new Uint8Array(e);return Object.setPrototypeOf(t,a.prototype),t}function a(e,t,r){if("number"==typeof e){if("string"==typeof t)throw TypeError('The "string" argument must be of type string. Received type number');return u(e)}return l(e,t,r)}function l(e,t,r){if("string"==typeof e)return function(e,t){if(("string"!=typeof t||""===t)&&(t="utf8"),!a.isEncoding(t))throw TypeError("Unknown encoding: "+t);let r=0|p(e,t),n=o(r),i=n.write(e,t);return i!==r&&(n=n.slice(0,i)),n}(e,t);if(ArrayBuffer.isView(e))return function(e){if(N(e,Uint8Array)){let t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return f(e)}(e);if(null==e)throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e);if(N(e,ArrayBuffer)||e&&N(e.buffer,ArrayBuffer)||"undefined"!=typeof SharedArrayBuffer&&(N(e,SharedArrayBuffer)||e&&N(e.buffer,SharedArrayBuffer)))return h(e,t,r);if("number"==typeof e)throw 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 a.from(n,t,r);let i=function(e){var t;if(a.isBuffer(e)){let t=0|d(e.length),r=o(t);return 0===r.length||e.copy(r,0,0,t),r}return void 0!==e.length?"number"!=typeof e.length||(t=e.length)!=t?o(0):f(e):"Buffer"===e.type&&Array.isArray(e.data)?f(e.data):void 0}(e);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof e[Symbol.toPrimitive])return a.from(e[Symbol.toPrimitive]("string"),t,r);throw TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof e)}function c(e){if("number"!=typeof e)throw TypeError('"size" argument must be of type number');
vendor: 19,324 bytes, line 32
32if(e<0)throw RangeError('The value "'+e+'" is invalid for option "size"')}function u(e){return c(e),o(e<0?0:0|d(e))}function f(e){let t=e.length<0?0:0|d(e.length),r=o(t);for(let n=0;n<t;n+=1)r[n]=255&e[n];return r}function h(e,t,r){let n;if(t<0||e.byteLength<t)throw RangeError('"offset" is outside of buffer bounds');if(e.byteLength<t+(r||0))throw RangeError('"length" is outside of buffer bounds');return Object.setPrototypeOf(n=void 0===t&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,t):new Uint8Array(e,t,r),a.prototype),n}function d(e){if(e>=2147483647)throw RangeError("Attempt to allocate Buffer larger than maximum size: 0x7fffffff bytes");return 0|e}function p(e,t){if(a.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||N(e,ArrayBuffer))return e.byteLength;if("string"!=typeof e)throw 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 D(e).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return U(e).length;default:if(i)return n?-1:D(e).length;t=(""+t).toLowerCase(),i=!0}}function g(e,t,r){let i=!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 function(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+=j[e[n]];return i}(this,t,r);case"utf8":case"utf-8":return w(this,t,r);case"ascii":return function(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}(this,t,r);case"latin1":case"binary":return function(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}(this,t,r);case"base64":var s,o;return s=t,o=r,0===s&&o===this.length?n.fromByteArray(this):n.fromByteArray(this.slice(s,o));case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return function(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}(this,t,r);default:if(i)throw TypeError("Unknown encoding: "+e);e=(e+"").toLowerCase(),i=!0}}function y(e,t,r){let n=e[t];e[t]=e[r],e[r]=n}function m(e,t,r,n,i){var s;if(0===e.length)return -1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),(s=r=+r)!=s&&(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=a.from(t,n)),a.isBuffer(t))return 0===t.length?-1:b(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):b(e,[t],r,n,i);throw TypeError("val must be string, number or Buffer")}function b(e,t,r,n,i){let s,o=1,a=e.length,l=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;o=2,a/=2,l/=2,r/=2}function c(e,t){return 1===o?e[t]:e.readUInt16BE(t*o)}if(i){let n=-1;for(s=r;s<a;s++)if(c(e,s)===c(t,-1===n?0:s-n)){if(-1===n&&(n=s),s-n+1===l)return n*o}else -1!==n&&(s-=s-n),n=-1}else for(r+l>a&&(r=a-l),s=r;s>=0;s--){let r=!0;for(let n=0;n<l;n++)if(c(e,s+n)!==c(t,n)){r=!1;break}if(r)return s}return -1}function w(e,t,r){r=Math.min(e.length,r);let n=[],i=t;for(;i<r;){let t=e[i],s=null,o=t>239?4:t>223?3:t>191?2:1;if(i+o<=r){let r,n,a,l;switch(o){case 1:t<128&&(s=t);break;case 2:(192&(r=e[i+1]))==128&&(l=(31&t)<<6|63&r)>127&&(s=l);break;case 3:r=e[i+1],n=e[i+2],(192&r)==128&&(192&n)==128&&(l=(15&t)<<12|(63&r)<<6|63&n)>2047&&(l<55296||l>57343)&&(s=l);break;case 4:r=e[i+1],n=e[i+2],a=e[i+3],(192&r)==128&&(192&n)==128&&(192&a)==128&&(l=(15&t)<<18|(63&r)<<12|(63&n)<<6|63&a)>65535&&l<1114112&&(s=l)}}null===s?(s=65533,o=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),i+=o}return function(e){let t=e.length;if(t<=4096)return String.fromCharCode.apply(String,e);let r="",n=0;for(;n<t;)r+=String.fromCharCode.apply(String,e.slice(n,n+=4096));return r}(n)}function v(e,t,r){if(e%1!=0||e<0)throw RangeError("offset is not uint");if(e+t>r)throw RangeError("Trying to access beyond buffer length")}function E(e,t,r,n,i,s){if(!a.isBuffer(e))throw TypeError('"buffer" argument must be a Buffer instance');if(t>i||t<s)throw RangeError('"value" argument is out of bounds');if(r+n>e.length)throw RangeError("Index out of range")}function x(e,t,r,n,i){k(t,n,i,e,r,7);let s=Number(t&BigInt(4294967295));e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s,s>>=8,e[r++]=s;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,o>>=8,e[r++]=o,r}function _(e,t,r,n,i){k(t,n,i,e,r,7);let s=Number(t&BigInt(4294967295));e[r+7]=s,s>>=8,e[r+6]=s,s>>=8,e[r+5]=s,s>>=8,e[r+4]=s;let o=Number(t>>BigInt(32)&BigInt(4294967295));return e[r+3]=o,o>>=8,e[r+2]=o,o>>=8,e[r+1]=o,o>>=8,e[r]=o,r+8}function A(e,t,r,n,i,s){if(r+n>e.length||r<0)throw RangeError("Index out of range")}function S(e,t,r,n,s){return t=+t,r>>>=0,s||A(e,t,r,4,34028234663852886e22,-34028234663852886e22),i.write(e,t,r,n,23,4),r+4}function I(e,t,r,n,s){return t=+t,r>>>=0,s||A(e,t,r,8,17976931348623157e292,-17976931348623157e292),i.write(e,t,r,n,52,8),r+8}t.Buffer=a,t.SlowBuffer=function(e){return+e!=e&&(e=0),a.alloc(+e)},t.INSPECT_MAX_BYTES=50,t.kMaxLength=2147483647,a.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(e){return!1}}(),a.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"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(a.prototype,"parent",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.buffer}}),Object.defineProperty(a.prototype,"offset",{enumerable:!0,get:function(){if(a.isBuffer(this))return this.byteOffset}}),a.poolSize=8192,a.from=function(e,t,r){return l(e,t,r)},Object.setPrototypeOf(a.prototype,Uint8Array.prototype),Object.setPrototypeOf(a,Uint8Array),a.alloc=function(e,t,r){return(c(e),e<=0)?o(e):void 0!==t?"string"==typeof r?o(e).fill(t,r):o(e).fill(t):o(e)},a.allocUnsafe=function(e){return u(e)},a.allocUnsafeSlow=function(e){return u(e)},a.isBuffer=function(e){return null!=e&&!0===e._isBuffer&&e!==a.prototype},a.compare=function(e,t){if(N(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),N(t,Uint8Array)&&(t=a.from(t,t.offset,t.byteLength)),!a.isBuffer(e)||!a.isBuffer(t))throw 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,s=Math.min(r,n);i<s;++i)if(e[i]!==t[i]){r=e[i],n=t[i];break}return r<n?-1:n<r?1:0},a.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}},a.concat=function(e,t){let r;if(!Array.isArray(e))throw TypeError('"list" argument must be an Array of Buffers');if(0===e.length)return a.alloc(0);if(void 0===t)for(r=0,t=0;r<e.length;++r)t+=e[r].length;let n=a.allocUnsafe(t),i=0;for(r=0;r<e.length;++r){let t=e[r];if(N(t,Uint8Array))i+t.length>n.length?(a.isBuffer(t)||(t=a.from(t)),t.copy(n,i)):Uint8Array.prototype.set.call(n,t,i);else if(a.isBuffer(t))t.copy(n,i);else throw TypeError('"list" argument must be an Array of Buffers');i+=t.length}return n},a.byteLength=p,a.prototype._isBuffer=!0,a.prototype.swap16=function(){let e=this.length;if(e%2!=0)throw RangeError("Buffer size must be a multiple of 16-bits");for(let t=0;t<e;t+=2)y(this,t,t+1);return this},a.prototype.swap32=function(){let e=this.length;if(e%4!=0)throw RangeError("Buffer size must be a multiple of 32-bits");for(let t=0;t<e;t+=4)y(this,t,t+3),y(this,t+1,t+2);return this},a.prototype.swap64=function(){let e=this.length;if(e%8!=0)throw RangeError("Buffer size must be a multiple of 64-bits");for(let t=0;t<e;t+=8)y(this,t,t+7),y(this,t+1,t+6),y(this,t+2,t+5),y(this,t+3,t+4);return this},a.prototype.toString=function(){let e=this.length;return 0===e?"":0==arguments.length?w(this,0,e):g.apply(this,arguments)},a.prototype.toLocaleString=a.prototype.toString,a.prototype.equals=function(e){if(!a.isBuffer(e))throw TypeError("Argument must be a Buffer");return this===e||0===a.compare(this,e)},a.prototype.inspect=function(){let e="",r=t.INSPECT_MAX_BYTES;return e=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(e+=" ... "),"<Buffer "+e+">"},s&&(a.prototype[s]=a.prototype.inspect),a.prototype.compare=function(e,t,r,n,i){if(N(e,Uint8Array)&&(e=a.from(e,e.offset,e.byteLength)),!a.isBuffer(e))throw 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 RangeError("out of range index");if(n>=i&&t>=r)return 0;if(n>=i)return -1;if(t>=r)return 1;if(t>>>=0,r>>>=0,n>>>=0,i>>>=0,this===e)return 0;let s=i-n,o=r-t,l=Math.min(s,o),c=this.slice(n,i),u=e.slice(t,r);for(let e=0;e<l;++e)if(c[e]!==u[e]){s=c[e],o=u[e];break}return s<o?-1:o<s?1:0},a.prototype.includes=function(e,t,r){return -1!==this.indexOf(e,t,r)},a.prototype.indexOf=function(e,t,r){return m(this,e,t,r,!0)},a.prototype.lastIndexOf=function(e,t,r){return m(this,e,t,r,!1)},a.prototype.write=function(e,t,r,n){var i,s,o,a,l,c,u,f;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))t>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0);else throw Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");let h=this.length-t;if((void 0===r||r>h)&&(r=h),e.length>0&&(r<0||t<0)||t>this.length)throw RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let d=!1;for(;;)switch(n){case"hex":return function(e,t,r,n){let i;r=Number(r)||0;let s=e.length-r;n?(n=Number(n))>s&&(n=s):n=s;let o=t.length;for(n>o/2&&(n=o/2),i=0;i<n;++i){let n=parseInt(t.substr(2*i,2),16);if(n!=n)break;e[r+i]=n}return i}(this,e,t,r);case"utf8":case"utf-8":return i=t,s=r,M(D(e,this.length-i),this,i,s);case"ascii":case"latin1":case"binary":return o=t,a=r,M(function(e){let t=[];for(let r=0;r<e.length;++r)t.push(255&e.charCodeAt(r));return t}(e),this,o,a);case"base64":return l=t,c=r,M(U(e),this,l,c);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return u=t,f=r,M(function(e,t){let r,n;let i=[];for(let s=0;s<e.length&&!((t-=2)<0);++s)n=(r=e.charCodeAt(s))>>8,i.push(r%256),i.push(n);return i}(e,this.length-u),this,u,f);default:if(d)throw TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),d=!0}},a.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}},a.prototype.slice=function(e,t){let r=this.length;e=~~e,t=void 0===t?r:~~t,e<0?(e+=r)<0&&(e=0):e>r&&(e=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,a.prototype),n},a.prototype.readUintLE=a.prototype.readUIntLE=function(e,t,r){e>>>=0,t>>>=0,r||v(e,t,this.length);let n=this[e],i=1,s=0;for(;++s<t&&(i*=256);)n+=this[e+s]*i;return n},a.prototype.readUintBE=a.prototype.readUIntBE=function(e,t,r){e>>>=0,t>>>=0,r||v(e,t,this.length);let n=this[e+--t],i=1;for(;t>0&&(i*=256);)n+=this[e+--t]*i;return n},a.prototype.readUint8=a.prototype.readUInt8=function(e,t){return e>>>=0,t||v(e,1,this.length),this[e]},a.prototype.readUint16LE=a.prototype.readUInt16LE=function(e,t){return e>>>=0,t||v(e,2,this.length),this[e]|this[e+1]<<8},a.prototype.readUint16BE=a.prototype.readUInt16BE=function(e,t){return e>>>=0,t||v(e,2,this.length),this[e]<<8|this[e+1]},a.prototype.readUint32LE=a.prototype.readUInt32LE=function(e,t){return e>>>=0,t||v(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+16777216*this[e+3]},a.prototype.readUint32BE=a.prototype.readUInt32BE=function(e,t){return e>>>=0,t||v(e,4,this.length),16777216*this[e]+(this[e+1]<<16|this[e+2]<<8|this[e+3])},a.prototype.readBigUInt64LE=L(function(e){T(e>>>=0,"offset");let t=this[e],r=this[e+7];(void 0===t||void 0===r)&&B(e,this.length-8);let n=t+256*this[++e]+65536*this[++e]+16777216*this[++e],i=this[++e]+256*this[++e]+65536*this[++e]+16777216*r;return BigInt(n)+(BigInt(i)<<BigInt(32))}),a.prototype.readBigUInt64BE=L(function(e){T(e>>>=0,"offset");let t=this[e],r=this[e+7];(void 0===t||void 0===r)&&B(e,this.length-8);let n=16777216*t+65536*this[++e]+256*this[++e]+this[++e],i=16777216*this[++e]+65536*this[++e]+256*this[++e]+r;return(BigInt(n)<<BigInt(32))+BigInt(i)}),a.prototype.readIntLE=function(e,t,r){e>>>=0,t>>>=0,r||v(e,t,this.length);let n=this[e],i=1,s=0;for(;++s<t&&(i*=256);)n+=this[e+s]*i;return n>=(i*=128)&&(n-=Math.pow(2,8*t)),n},a.prototype.readIntBE=function(e,t,r){e>>>=0,t>>>=0,r||v(e,t,this.length);let n=t,i=1,s=this[e+--n];for(;n>0&&(i*=256);)s+=this[e+--n]*i;return s>=(i*=128)&&(s-=Math.pow(2,8*t)),s},a.prototype.readInt8=function(e,t){return(e>>>=0,t||v(e,1,this.length),128&this[e])?-((255-this[e]+1)*1):this[e]},a.prototype.readInt16LE=function(e,t){e>>>=0,t||v(e,2,this.length);let r=this[e]|this[e+1]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt16BE=function(e,t){e>>>=0,t||v(e,2,this.length);let r=this[e+1]|this[e]<<8;return 32768&r?4294901760|r:r},a.prototype.readInt32LE=function(e,t){return e>>>=0,t||v(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},a.prototype.readInt32BE=function(e,t){return e>>>=0,t||v(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},a.prototype.readBigInt64LE=L(function(e){T(e>>>=0,"offset");let t=this[e],r=this[e+7];return(void 0===t||void 0===r)&&B(e,this.length-8),(BigInt(this[e+4]+256*this[e+5]+65536*this[e+6]+(r<<24))<<BigInt(32))+BigInt(t+256*this[++e]+65536*this[++e]+16777216*this[++e])}),a.prototype.readBigInt64BE=L(function(e){T(e>>>=0,"offset");let t=this[e],r=this[e+7];return(void 0===t||void 0===r)&&B(e,this.length-8),(BigInt((t<<24)+65536*this[++e]+256*this[++e]+this[++e])<<BigInt(32))+BigInt(16777216*this[++e]+65536*this[++e]+256*this[++e]+r)}),a.prototype.readFloatLE=function(e,t){return e>>>=0,t||v(e,4,this.length),i.read(this,e,!0,23,4)},a.prototype.readFloatBE=function(e,t){return e>>>=0,t||v(e,4,this.length),i.read(this,e,!1,23,4)},a.prototype.readDoubleLE=function(e,t){return e>>>=0,t||v(e,8,this.length),i.read(this,e,!0,52,8)},a.prototype.readDoubleBE=function(e,t){return e>>>=0,t||v(e,8,this.length),i.read(this,e,!1,52,8)},a.prototype.writeUintLE=a.prototype.writeUIntLE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){let n=Math.pow(2,8*r)-1;E(this,e,t,r,n,0)}let i=1,s=0;for(this[t]=255&e;++s<r&&(i*=256);)this[t+s]=e/i&255;return t+r},a.prototype.writeUintBE=a.prototype.writeUIntBE=function(e,t,r,n){if(e=+e,t>>>=0,r>>>=0,!n){let n=Math.pow(2,8*r)-1;E(this,e,t,r,n,0)}let i=r-1,s=1;for(this[t+i]=255&e;--i>=0&&(s*=256);)this[t+i]=e/s&255;return t+r},a.prototype.writeUint8=a.prototype.writeUInt8=function(e,t,r){return e=+e,t>>>=0,r||E(this,e,t,1,255,0),this[t]=255&e,t+1},a.prototype.writeUint16LE=a.prototype.writeUInt16LE=function(e,t,r){return e=+e,t>>>=0,r||E(this,e,t,2,65535,0),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeUint16BE=a.prototype.writeUInt16BE=function(e,t,r){return e=+e,t>>>=0,r||E(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeUint32LE=a.prototype.writeUInt32LE=function(e,t,r){return e=+e,t>>>=0,r||E(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},a.prototype.writeUint32BE=a.prototype.writeUInt32BE=function(e,t,r){return e=+e,t>>>=0,r||E(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},a.prototype.writeBigUInt64LE=L(function(e,t=0){return x(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeBigUInt64BE=L(function(e,t=0){return _(this,e,t,BigInt(0),BigInt("0xffffffffffffffff"))}),a.prototype.writeIntLE=function(e,t,r,n){if(e=+e,t>>>=0,!n){let n=Math.pow(2,8*r-1);E(this,e,t,r,n-1,-n)}let i=0,s=1,o=0;for(this[t]=255&e;++i<r&&(s*=256);)e<0&&0===o&&0!==this[t+i-1]&&(o=1),this[t+i]=(e/s>>0)-o&255;return t+r},a.prototype.writeIntBE=function(e,t,r,n){if(e=+e,t>>>=0,!n){let n=Math.pow(2,8*r-1);E(this,e,t,r,n-1,-n)}let i=r-1,s=1,o=0;for(this[t+i]=255&e;--i>=0&&(s*=256);)e<0&&0===o&&0!==this[t+i+1]&&(o=1),this[t+i]=(e/s>>0)-o&255;return t+r},a.prototype.writeInt8=function(e,t,r){return e=+e,t>>>=0,r||E(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=255&e,t+1},a.prototype.writeInt16LE=function(e,t,r){return e=+e,t>>>=0,r||E(this,e,t,2,32767,-32768),this[t]=255&e,this[t+1]=e>>>8,t+2},a.prototype.writeInt16BE=function(e,t,r){return e=+e,t>>>=0,r||E(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=255&e,t+2},a.prototype.writeInt32LE=function(e,t,r){return e=+e,t>>>=0,r||E(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},a.prototype.writeInt32BE=function(e,t,r){return e=+e,t>>>=0,r||E(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},a.prototype.writeBigInt64LE=L(function(e,t=0){return x(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeBigInt64BE=L(function(e,t=0){return _(this,e,t,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))}),a.prototype.writeFloatLE=function(e,t,r){return S(this,e,t,!0,r)},a.prototype.writeFloatBE=function(e,t,r){return S(this,e,t,!1,r)},a.prototype.writeDoubleLE=function(e,t,r){return I(this,e,t,!0,r)},a.prototype.writeDoubleBE=function(e,t,r){return I(this,e,t,!1,r)},a.prototype.copy=function(e,t,r,n){if(!a.isBuffer(e))throw 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 RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw RangeError("Index out of range");if(n<0)throw 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},a.prototype.fill=function(e,t,r,n){let i;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 TypeError("encoding must be a string");if("string"==typeof n&&!a.isEncoding(n))throw 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 RangeError("Out of range index");if(r<=t)return this;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 s=a.isBuffer(e)?e:a.from(e,n),o=s.length;
32if(0===o)throw TypeError('The value "'+e+'" is invalid for argument "value"');for(i=0;i<r-t;++i)this[i+t]=s[i%o]}return this};let O={};function P(e,t,r){O[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 C(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 k(e,t,r,n,i,s){if(e>r||e<t){let n;let i="bigint"==typeof t?"n":"";throw n=s>3?0===t||t===BigInt(0)?`>= 0${i} and < 2${i} ** ${(s+1)*8}${i}`:`>= -(2${i} ** ${(s+1)*8-1}${i}) and < 2 ** ${(s+1)*8-1}${i}`:`>= ${t}${i} and <= ${r}${i}`,new O.ERR_OUT_OF_RANGE("value",n,e)}T(i,"offset"),(void 0===n[i]||void 0===n[i+s])&&B(i,n.length-(s+1))}function T(e,t){if("number"!=typeof e)throw new O.ERR_INVALID_ARG_TYPE(t,"number",e)}function B(e,t,r){if(Math.floor(e)!==e)throw T(e,r),new O.ERR_OUT_OF_RANGE(r||"offset","an integer",e);if(t<0)throw new O.ERR_BUFFER_OUT_OF_BOUNDS;throw new O.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${t}`,e)}P("ERR_BUFFER_OUT_OF_BOUNDS",function(e){return e?`${e} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"},RangeError),P("ERR_INVALID_ARG_TYPE",function(e,t){return`The "${e}" argument must be of type number. Received type ${typeof t}`},TypeError),P("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)>4294967296?i=C(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=C(i)),i+="n"),n+=` It must be ${t}. Received ${i}`},RangeError);let R=/[^+/0-9A-Za-z-_]/g;function D(e,t){let r;t=t||1/0;let n=e.length,i=null,s=[];for(let o=0;o<n;++o){if((r=e.charCodeAt(o))>55295&&r<57344){if(!i){if(r>56319||o+1===n){(t-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(t-=3)>-1&&s.push(239,191,189),i=r;continue}r=(i-55296<<10|r-56320)+65536}else i&&(t-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((t-=1)<0)break;s.push(r)}else if(r<2048){if((t-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((t-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else if(r<1114112){if((t-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}else throw Error("Invalid code point")}return s}function U(e){return n.toByteArray(function(e){if((e=(e=e.split("=")[0]).trim().replace(R,"")).length<2)return"";for(;e.length%4!=0;)e+="=";return e}(e))}function M(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 N(e,t){return e instanceof t||null!=e&&null!=e.constructor&&null!=e.constructor.name&&e.constructor.name===t.name}let j=function(){let e="0123456789abcdef",t=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 L(e){return"undefined"==typeof BigInt?$:e}function $(){throw Error("BigInt not supported")}},81524:function(e){"use strict";e.exports=function e(t){if("number"==typeof t&&isNaN(t))throw Error("NaN is not allowed");if("number"==typeof t&&!isFinite(t))throw Error("Infinity is not allowed");if(null===t||"object"!=typeof t)return JSON.stringify(t);if(t.toJSON instanceof Function)return e(t.toJSON());if(Array.isArray(t)){let r=t.reduce((t,r,n)=>`${t}${0===n?"":","}${e(void 0===r||"symbol"==typeof r?null:r)}`,"");return`[${r}]`}let r=Object.keys(t).sort().reduce((r,n)=>{if(void 0===t[n]||"symbol"==typeof t[n])return r;let i=0===r.length?"":",";return`${r}${i}${e(n)}:${e(t[n])}`},"");return`{${r}}`}},55151:function(e,t,r){var n="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==r.g&&r.g,i=function(){function e(){this.fetch=!1,this.DOMException=n.DOMException}return e.prototype=n,new e}();(function(e){var t=void 0!==i&&i||"undefined"!=typeof self&&self||void 0!==r.g&&r.g||{},n={searchParams:"URLSearchParams"in t,iterable:"Symbol"in t&&"iterator"in Symbol,blob:"FileReader"in t&&"Blob"in t&&function(){try{return new Blob,!0}catch(e){return!1}}(),formData:"FormData"in t,arrayBuffer:"ArrayBuffer"in t};if(n.arrayBuffer)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array
32]"],o=ArrayBuffer.isView||function(e){return e&&s.indexOf(Object.prototype.toString.call(e))>-1};function a(e){if("string"!=typeof e&&(e=String(e)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(e)||""===e)throw TypeError('Invalid character in header field name: "'+e+'"');return e.toLowerCase()}function l(e){return"string"!=typeof e&&(e=String(e)),e}function c(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return n.iterable&&(t[Symbol.iterator]=function(){return t}),t}function u(e){this.map={},e instanceof u?e.forEach(function(e,t){this.append(t,e)},this):Array.isArray(e)?e.forEach(function(e){if(2!=e.length)throw TypeError("Headers constructor: expected name/value pair to be length 2, found"+e.length);this.append(e[0],e[1])},this):e&&Object.getOwnPropertyNames(e).forEach(function(t){this.append(t,e[t])},this)}function f(e){if(!e._noBody){if(e.bodyUsed)return Promise.reject(TypeError("Already read"));e.bodyUsed=!0}}function h(e){return new Promise(function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}})}function d(e){var t=new FileReader,r=h(t);return t.readAsArrayBuffer(e),r}function p(e){if(e.slice)return e.slice(0);var t=new Uint8Array(e.byteLength);return t.set(new Uint8Array(e)),t.buffer}function g(){return this.bodyUsed=!1,this._initBody=function(e){if(this.bodyUsed=this.bodyUsed,this._bodyInit=e,e){if("string"==typeof e)this._bodyText=e;else if(n.blob&&Blob.prototype.isPrototypeOf(e))this._bodyBlob=e;else if(n.formData&&FormData.prototype.isPrototypeOf(e))this._bodyFormData=e;else if(n.searchParams&&URLSearchParams.prototype.isPrototypeOf(e))this._bodyText=e.toString();else{var t;n.arrayBuffer&&n.blob&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=p(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):n.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||o(e))?this._bodyArrayBuffer=p(e):this._bodyText=e=Object.prototype.toString.call(e)}}else this._noBody=!0,this._bodyText="";!this.headers.get("content-type")&&("string"==typeof e?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):n.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},n.blob&&(this.blob=function(){var e=f(this);if(e)return e;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(!this._bodyFormData)return Promise.resolve(new Blob([this._bodyText]));throw Error("could not read FormData body as blob")}),this.arrayBuffer=function(){if(this._bodyArrayBuffer)return f(this)||(ArrayBuffer.isView(this._bodyArrayBuffer)?Promise.resolve(this._bodyArrayBuffer.buffer.slice(this._bodyArrayBuffer.byteOffset,this._bodyArrayBuffer.byteOffset+this._bodyArrayBuffer.byteLength)):Promise.resolve(this._bodyArrayBuffer));if(n.blob)return this.blob().then(d);throw Error("could not read as ArrayBuffer")},this.text=function(){var e,t,r,n,i,s=f(this);if(s)return s;if(this._bodyBlob)return e=this._bodyBlob,r=h(t=new FileReader),i=(n=/charset=([A-Za-z0-9_-]+)/.exec(e.type))?n[1]:"utf-8",t.readAsText(e,i),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=Array(t.length),n=0;n<t.length;n++)r[n]=String.fromCharCode(t[n]);return r.join("")}(this._bodyArrayBuffer));if(!this._bodyFormData)return Promise.resolve(this._bodyText);throw Error("could not read FormData body as text")},n.formData&&(this.formData=function(){return this.text().then(b)}),this.json=function(){return this.text().then(JSON.parse)},this}u.prototype.append=function(e,t){e=a(e),t=l(t);var r=this.map[e];this.map[e]=r?r+", "+t:t},u.prototype.delete=function(e){delete this.map[a(e)]},u.prototype.get=function(e){return e=a(e),this.has(e)?this.map[e]:null},u.prototype.has=function(e){return this.map.hasOwnProperty(a(e))},u.prototype.set=function(e,t){this.map[a(e)]=l(t)},u.prototype.forEach=function(e,t){for(var r in this.map)this.map.hasOwnProperty(r)&&e.call(t,this.map[r],r,this)},u.prototype.keys=function(){var e=[];return this.forEach(function(t,r){e.push(r)}),c(e)},u.prototype.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),c(e)},u.prototype.entries=function(){var e=[];return this.forEach(function(t,r){e.push([r,t])}),c(e)},n.iterable&&(u.prototype[Symbol.iterator]=u.prototype.entries);var y=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function m(e,r){if(!(this instanceof m))throw TypeError('Please use the "new" operator, this DOM object c
32onstructor cannot be called as a function.');var n,i,s=(r=r||{}).body;if(e instanceof m){if(e.bodyUsed)throw TypeError("Already read");this.url=e.url,this.credentials=e.credentials,r.headers||(this.headers=new u(e.headers)),this.method=e.method,this.mode=e.mode,this.signal=e.signal,s||null==e._bodyInit||(s=e._bodyInit,e.bodyUsed=!0)}else this.url=String(e);if(this.credentials=r.credentials||this.credentials||"same-origin",(r.headers||!this.headers)&&(this.headers=new u(r.headers)),this.method=(i=(n=r.method||this.method||"GET").toUpperCase(),y.indexOf(i)>-1?i:n),this.mode=r.mode||this.mode||null,this.signal=r.signal||this.signal||function(){if("AbortController"in t)return new AbortController().signal}(),this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&s)throw TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(s),("GET"===this.method||"HEAD"===this.method)&&("no-store"===r.cache||"no-cache"===r.cache)){var o=/([?&])_=[^&]*/;o.test(this.url)?this.url=this.url.replace(o,"$1_="+new Date().getTime()):this.url+=(/\?/.test(this.url)?"&":"?")+"_="+new Date().getTime()}}function b(e){var t=new FormData;return e.trim().split("&").forEach(function(e){if(e){var r=e.split("="),n=r.shift().replace(/\+/g," "),i=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(n),decodeURIComponent(i))}}),t}function w(e,t){if(!(this instanceof w))throw TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(t||(t={}),this.type="default",this.status=void 0===t.status?200:t.status,this.status<200||this.status>599)throw RangeError("Failed to construct 'Response': The status provided (0) is outside the range [200, 599].");this.ok=this.status>=200&&this.status<300,this.statusText=void 0===t.statusText?"":""+t.statusText,this.headers=new u(t.headers),this.url=t.url||"",this._initBody(e)}m.prototype.clone=function(){return new m(this,{body:this._bodyInit})},g.call(m.prototype),g.call(w.prototype),w.prototype.clone=function(){return new w(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new u(this.headers),url:this.url})},w.error=function(){var e=new w(null,{status:200,statusText:""});return e.ok=!1,e.status=0,e.type="error",e};var v=[301,302,303,307,308];w.redirect=function(e,t){if(-1===v.indexOf(t))throw RangeError("Invalid status code");return new w(null,{status:t,headers:{location:e}})},e.DOMException=t.DOMException;try{new e.DOMException}catch(t){e.DOMException=function(e,t){this.message=e,this.name=t;var r=Error(e);this.stack=r.stack},e.DOMException.prototype=Object.create(Error.prototype),e.DOMException.prototype.constructor=e.DOMException}function E(r,i){return new Promise(function(s,o){var c=new m(r,i);if(c.signal&&c.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var f=new XMLHttpRequest;function h(){f.abort()}if(f.onload=function(){var e,t,r={statusText:f.statusText,headers:(e=f.getAllResponseHeaders()||"",t=new u,e.replace(/\r?\n[\t ]+/g," ").split("\r").map(function(e){return 0===e.indexOf("\n")?e.substr(1,e.length):e}).forEach(function(e){var r=e.split(":"),n=r.shift().trim();if(n){var i=r.join(":").trim();try{t.append(n,i)}catch(e){console.warn("Response "+e.message)}}}),t)};0===c.url.indexOf("file://")&&(f.status<200||f.status>599)?r.status=200:r.status=f.status,r.url="responseURL"in f?f.responseURL:r.headers.get("X-Request-URL");var n="response"in f?f.response:f.responseText;setTimeout(function(){s(new w(n,r))},0)},f.onerror=function(){setTimeout(function(){o(TypeError("Network request failed"))},0)},f.ontimeout=function(){setTimeout(function(){o(TypeError("Network request timed out"))},0)},f.onabort=function(){setTimeout(function(){o(new e.DOMException("Aborted","AbortError"))},0)},f.open(c.method,function(e){try{return""===e&&t.location.href?t.location.href:e}catch(t){return e}}(c.url),!0),"include"===c.credentials?f.withCredentials=!0:"omit"===c.credentials&&(f.withCredentials=!1),"responseType"in f&&(n.blob?f.responseType="blob":n.arrayBuffer&&(f.responseType="arraybuffer")),i&&"object"==typeof i.headers&&!(i.headers instanceof u||t.Headers&&i.headers instanceof t.Headers)){var d=[];
32Object.getOwnPropertyNames(i.headers).forEach(function(e){d.push(a(e)),f.setRequestHeader(e,l(i.headers[e]))}),c.headers.forEach(function(e,t){-1===d.indexOf(t)&&f.setRequestHeader(t,e)})}else c.headers.forEach(function(e,t){f.setRequestHeader(t,e)});c.signal&&(c.signal.addEventListener("abort",h),f.onreadystatechange=function(){4===f.readyState&&c.signal.removeEventListener("abort",h)}),f.send(void 0===c._bodyInit?null:c._bodyInit)})}E.polyfill=!0,t.fetch||(t.fetch=E,t.Headers=u,t.Request=m,t.Response=w),e.Headers=u,e.Request=m,e.Response=w,e.fetch=E,Object.defineProperty(e,"__esModule",{value:!0})})({}),i.fetch.ponyfill=!0,delete i.fetch.polyfill;var s=n.fetch?n:i;(t=s.fetch).default=s.fetch,t.fetch=s.fetch,t.Headers=s.Headers,t.Request=s.Request,t.Response=s.Response,e.exports=t},52159:function(e,t,r){"use strict";r.d(t,{qY:function(){return d}});var n=r(25566),i=function(e,t,r){if(r||2==arguments.length)for(var n,i=0,s=t.length;i<s;i++)!n&&i in t||(n||(n=Array.prototype.slice.call(t,0,i)),n[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))},s=function(e,t,r){this.name=e,this.version=t,this.os=r,this.type="browser"},o=function(e){this.version=e,this.type="node",this.name="node",this.os=n.platform},a=function(e,t,r,n){this.name=e,this.version=t,this.os=r,this.bot=n,this.type="bot-device"},l=function(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null},c=function(){this.type="react-native",this.name="react-native",this.version=null,this.os=null},u=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,f=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["pie",/^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/],["pie",/^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/],["netfront",/^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FB[AS]V\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["curl",/^curl\/([0-9\.]+)$/],["searchbot",/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/]],h=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Windows CE",/Windows CE|WinCE|Microsoft Pocket Internet Explorer/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function d(e){return e?p(e):"undefined"==typeof document&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product?new c:"undefined"!=typeof navigator?p(navigator.userAgent):void 0!==n&&n.version?new o(n.version.slice(1)):null}function p(e){var t=""!==e&&f.reduce(function(t,r){var n=r[0],i=r[1];if(t)return t;var s=i.exec(e);return!!s&&[n,s]},!1);if(!t)return null;var r=t[0],n=t[1];if("searchbot"===r)return new l;var o=n[1]&&n[1].split(".").join("_").split("_").slice(0,3);o?o.length<3&&(o=i(i([],o,!0),function(e){for(var t=[],r=0;r<e;r++)t.push("0");return t}(3-o.length),!0)):o=[];var c=o.join("."),d=function(e){for(var t=0,r=h.length;t<r;t++){var n=h[t],i=n[0];if(n[1].exec(e))return i}return null}(e),p=u.exec(e);return p&&p[1]?new a(r,c,d,p[1]):new s(r,c,d)}},68885:function(e){"use strict";var t,r="object"==typeof Reflect?Reflect:null,n=r&&"function"==typeof r.apply?r.apply:function(e,t,r){return Function.prototype.apply.call(e,t,r)};t=r&&"function"==typeof r.ownKeys?r.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};var i=Number.isNaN||function(e){return e!=e};function s(){s.init.call(this)}e.exports=s,e.exports.once=function(e,t){return new Promise(function(r,n){var i;function s(r){e.removeListener(t,o),n(r)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",s),r([].slice.call(arguments))}g(e,t,o,{once:!0}),"error"!==t&&(i={once:!0},"function"==typeof e.on&&g(e,"error",s,i))})},s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var o=10;function a(e){if("function"!=typeof e)throw TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}function l(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}function c(e,t,r,n){if(a(r),void 0===(s=e._events)?(s=e._events=Object.create(null),e._eventsCount=0):(void 0!==s.newListener&&(e.emit("newListener",t,r.listener?r.listener:r),s=e._events),o=s[t]),void 0===o)o=s[t]=r,++e._eventsCount;else if("function"==typeof o?o=s[t]=n?[r,o]:[o,r]:n?o.unshift(r):o.push(r),(i=l(e))>0&&o.length>i&&!o.warned){o.warned=!0;var i,s,o,c=Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");c.name="MaxListenersExceededWarning",c.emitter=e,c.type=t,c.count=o.length,console&&console.warn&&console.warn(c)}return e}function u(){if(!this.fired)return(this.target.removeListener(this.type,this.wrapFn),this.fired=!0,0==arguments.length)?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function f(e,t,r){var n={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},i=u.bind(n);return i.listener=r,n.wrapFn=i,i}function h(e,t,r){var n=e._events;if(void 0===n)return[];var i=n[t];return void 0===i?[]:"function"==typeof i?r?[i.listener||i]:[i]:r?function(e){for(var t=Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(i):p(i,i.length)}function d(e){var t=this._events;if(void 0!==t){var r=t[e];if("function"==typeof r)return 1;if(void 0!==r)return r.length}return 0}function p(e,t){for(var r=Array(t),n=0;n<t;++n)r[n]=e[n];return r}function g(e,t,r,n){if("function"==typeof e.on)n.once?e.once(t,r):e.on(t,r);else if("function"==typeof e.addEventListener)e.addEventListener(t,function i(s){n.once&&e.removeEventListener(t,i),r(s)});else throw TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof e)}Object.defineProperty(s,"defaultMaxListeners",{enumerable:!0,get:function(){return o}
32,set:function(e){if("number"!=typeof e||e<0||i(e))throw RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");o=e}}),s.init=function(){(void 0===this._events||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if("number"!=typeof e||e<0||i(e))throw RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+e+".");return this._maxListeners=e,this},s.prototype.getMaxListeners=function(){return l(this)},s.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var i="error"===e,s=this._events;if(void 0!==s)i=i&&void 0===s.error;else if(!i)return!1;if(i){if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var o,a=Error("Unhandled error."+(o?" ("+o.message+")":""));throw a.context=o,a}var l=s[e];if(void 0===l)return!1;if("function"==typeof l)n(l,this,t);else for(var c=l.length,u=p(l,c),r=0;r<c;++r)n(u[r],this,t);return!0},s.prototype.addListener=function(e,t){return c(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return c(this,e,t,!0)},s.prototype.once=function(e,t){return a(t),this.on(e,f(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,f(this,e,t)),this},s.prototype.removeListener=function(e,t){var r,n,i,s,o;if(a(t),void 0===(n=this._events)||void 0===(r=n[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete n[e],n.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(i=-1,s=r.length-1;s>=0;s--)if(r[s]===t||r[s].listener===t){o=r[s].listener,i=s;break}if(i<0)return this;0===i?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,i),1===r.length&&(n[e]=r[0]),void 0!==n.removeListener&&this.emit("removeListener",e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,r,n;if(void 0===(r=this._events))return this;if(void 0===r.removeListener)return 0==arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==r[e]&&(0==--this._eventsCount?this._events=Object.create(null):delete r[e]),this;if(0==arguments.length){var i,s=Object.keys(r);for(n=0;n<s.length;++n)"removeListener"!==(i=s[n])&&this.removeAllListeners(i);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(t=r[e]))this.removeListener(e,t);else if(void 0!==t)for(n=t.length-1;n>=0;n--)this.removeListener(e,t[n]);return this},s.prototype.listeners=function(e){return h(this,e,!0)},s.prototype.rawListeners=function(e){return h(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):d.call(e,t)},s.prototype.listenerCount=d,s.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},6868:function(e,t){/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */t.read=function(e,t,r,n,i){var s,o,a=8*i-n-1,l=(1<<a)-1,c=l>>1,u=-7,f=r?i-1:0,h=r?-1:1,d=e[t+f];for(f+=h,s=d&(1<<-u)-1,d>>=-u,u+=a;u>0;s=256*s+e[t+f],f+=h,u-=8);for(o=s&(1<<-u)-1,s>>=-u,u+=n;u>0;o=256*o+e[t+f],f+=h,u-=8);if(0===s)s=1-c;else{if(s===l)return o?NaN:1/0*(d?-1:1);o+=Math.pow(2,n),s-=c}return(d?-1:1)*o*Math.pow(2,s-n)},t.write=function(e,t,r,n,i,s){var o,a,l,c=8*s-i-1,u=(1<<c)-1,f=u>>1,h=23===i?5960464477539062e-23:0,d=n?0:s-1,p=n?1:-1,g=t<0||0===t&&1/t<0?1:0;for(isNaN(t=Math.abs(t))||t===1/0?(a=isNaN(t)?1:0,o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(l=Math.pow(2,-o))<1&&(o--,l*=2),o+f>=1?t+=h/l:t+=h*Math.pow(2,1-f),t*l>=2&&(o++,l/=2),o+f>=u?(a=0,o=u):o+f>=1?(a=(t*l-1)*Math.pow(2,i),o+=f):(a=t*Math.pow(2,f-1)*Math.pow(2,i),o=0));i>=8;e[r+d]=255&a,d+=p,a/=256,i-=8);for(o=o<<i|a,c+=i;c>0;e[r+d]=255&o,d+=p,o/=256,c-=8);e[r+d-p]|=128*g}},4531:function(e,t,r){"use strict";let n=r(3538).v4,i=r(62309),s=function(e,t){if(!(this instanceof s))return new s(e,t);t||(t={}),this.options={reviver:void 0!==t.reviver?t.reviver:null,replacer:void 0!==t.replacer?t.replacer:null,generator:void 0!==t.generator?t.generator:function(){return n()},version:void 0!==t.version?t.version:2,notificationIdNull:"boolean"==typeof t.notificationIdNull&&t.notificationIdNull},this.callServer=e};e.exports=s,s.prototype.request=function(e,t,r,n){let s;let o=this,a=null,l=Array.isArray(e)&&"function"==typeof t;if(1===this.options.version&&l)throw TypeError("JSON-RPC 1.0 does not support batching");let c=!l&&e&&"object"==typeof e&&"function"==typeof t;if(l||c)n=t,a=e;else{"function"==typeof r&&(n=r,r=void 0);let s="function"==typeof n;try{a=i(e,t,r,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(e){if(s){n(e);return}throw e}if(!s)return a}try{s=JSON.stringify(a,this.options.replacer)}catch(e){n(e);return}return this.callServer(s,function(e,t){o._parseResponse(e,t,n)}),a},s.prototype._parseResponse=function(e,t,r){let n;if(e){r(e);return}if(!t){r();return}try{n=JSON.parse(t,this.options.reviver)}catch(e){r(e);return}if(3===r.length){if(Array.isArray(n)){let e=function(e){return void 0!==e.error};r(null,n.filter(e),n.filter(function(t){return!e(t)}));return}r(null,n.error,n.result);return}r(null,n)}},62309:function(e,t,r){"use strict";let n=r(3538).v4;e.exports=function(e,t,r,i){if("string"!=typeof e)throw TypeError(e+" must be a string");let s="number"==typeof(i=i||{}).version?i.version:2;if(1!==s&&2!==s)throw TypeError(s+" must be 1 or 2");let o={method:e};if(2===s&&(o.jsonrpc="2.0"),t){if("object"!=typeof t&&!Array.isArray(t))throw TypeError(t+" must be an object, array or omitted");o.params=t}if(void 0===r){let e="function"==typeof i.generator?i.generator:function(){return n()};o.id=e(o,i)}else 2===s&&null===r?i.notificationIdNull&&(o.id=null):o.id=r;return o}},57963:function(e){"use strict";function t(e){try{return JSON.stringify(e)}catch(e){return'"[Circular]"'}}e.exports=function(e,r,n){var i=n&&n.stringify||t;if("object"==typeof e&&null!==e){var s=r.length+1;if(1===s)return e;var o=Array(s);o[0]=i(e);for(var a=1;a<s;a++)o[a]=i(r[a]);return o.join(" ")}if("string"!=typeof e)return e;var l=r.length;if(0===l)return e;for(var c="",u=0,f=-1,h=e&&e.length||0,d=0;d<h;){if(37===e.charCodeAt(d)&&d+1<h){switch(f=f>-1?f:0,e.charCodeAt(d+1)){case 100:case 102:if(u>=l||null==r[u])break;f<d&&(c+=e.slice(f,d)),c+=Number(r[u]),f=d+2,d++;break;case 105:if(u>=l||null==r[u])break;f<d&&(c+=e.slice(f,d)),c+=Math.floor(Number(r[u])),f=d+2,d++;break;case 79:case 111:case 106:if(u>=l||void 0===r[u])break;f<d&&(c+=e.slice(f,d));var p=typeof r[u];if("string"===p){c+="'"+r[u]+"'",f=d+2,d++;break}if("function"===p){c+=r[u].name||"<anonymous>",f=d+2,d++;break}c+=i(r[u]),f=d+2,d++;break;case 115:if(u>=l)break;f<d&&(c+=e.slice(f,d)),c+=String(r[u]),f=d+2,d++;break;
32case 37:f<d&&(c+=e.slice(f,d)),c+="%",f=d+2,d++,u--}++u}++d}return -1===f?e:(f<h&&(c+=e.slice(f)),c)}},63858:function(e,t,r){"use strict";var n,i,s,o,a,l,c=r(2265);c&&"object"==typeof c&&"default"in c&&c.default;var u=r(17914),f=new u,h=f.getBrowser(),d=f.getCPU(),p=f.getDevice(),g=f.getEngine(),y=f.getOS(),m=f.getUA(),b={Mobile:"mobile",Tablet:"tablet",SmartTv:"smarttv",Console:"console",Wearable:"wearable",Embedded:"embedded",Browser:void 0},w={Chrome:"Chrome",Firefox:"Firefox",Opera:"Opera",Yandex:"Yandex",Safari:"Safari",InternetExplorer:"Internet Explorer",Edge:"Edge",Chromium:"Chromium",Ie:"IE",MobileSafari:"Mobile Safari",MIUI:"MIUI Browser",SamsungBrowser:"Samsung Browser"},v=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"none";return e||t},E=function(){return!!("undefined"!=typeof window&&(window.navigator||navigator))&&(window.navigator||navigator)},x=function(e){var t=E();return t&&t.platform&&(-1!==t.platform.indexOf(e)||"MacIntel"===t.platform&&t.maxTouchPoints>1&&!window.MSStream)},_=function(e){return e.type===b.Browser},A=function(e){return e.name===w.Edge},S=function(e){return"string"==typeof e&&-1!==e.indexOf("Edg/")},I=function(){return x("iPad")};p.type,b.SmartTv,p.type,b.Console,p.type,b.Wearable,p.type,b.Embedded,h.name===w.MobileSafari||I(),h.name,w.Chromium;var O=(n=p.type)===b.Mobile||n===b.Tablet||I(),P=(p.type,b.Mobile,p.type===b.Tablet||I(),_(p),_(p),"Android"===y.name),C=(y.name,"iOS"===y.name||I()),k=(h.name,w.Chrome,h.name===w.Firefox),T=(i=h.name)===w.Safari||i===w.MobileSafari;h.name,w.Opera,(s=h.name)===w.InternetExplorer||w.Ie,v(y.version),v(y.name),v(h.version),v(h.major),v(h.name),v(p.vendor),v(p.model),v(g.name),v(g.version),v(m),A(h)||S(m),h.name,w.Yandex,v(p.type,"browser"),(o=E())&&(/iPad|iPhone|iPod/.test(o.platform)||"MacIntel"===o.platform&&o.maxTouchPoints>1)&&window.MSStream,I(),x("iPhone"),x("iPod"),"string"==typeof(l=(a=E())&&a.userAgent&&a.userAgent.toLowerCase())&&/electron/.test(l),S(m),A(h)&&S(m),y.name,y.name,h.name,w.MIUI,h.name,w.SamsungBrowser,t.Dt=P,t.vU=k,t.gn=C,t.tq=O,t.G6=T},23466:function(e){"use strict";var t=Object.prototype.hasOwnProperty,r="~";function n(){}function i(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function s(e,t,n,s,o){if("function"!=typeof n)throw TypeError("The listener must be a function");var a=new i(n,s||e,o),l=r?r+t:t;return e._events[l]?e._events[l].fn?e._events[l]=[e._events[l],a]:e._events[l].push(a):(e._events[l]=a,e._eventsCount++),e}function o(e,t){0==--e._eventsCount?e._events=new n:delete e._events[t]}function a(){this._events=new n,this._eventsCount=0}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1)),a.prototype.eventNames=function(){var e,n,i=[];if(0===this._eventsCount)return i;for(n in e=this._events)t.call(e,n)&&i.push(r?n.slice(1):n);return Object.getOwnPropertySymbols?i.concat(Object.getOwnPropertySymbols(e)):i},a.prototype.listeners=function(e){var t=r?r+e:e,n=this._events[t];if(!n)return[];if(n.fn)return[n.fn];for(var i=0,s=n.length,o=Array(s);i<s;i++)o[i]=n[i].fn;return o},a.prototype.listenerCount=function(e){var t=r?r+e:e,n=this._events[t];return n?n.fn?1:n.length:0},a.prototype.emit=function(e,t,n,i,s,o){var a=r?r+e:e;if(!this._events[a])return!1;var l,c,u=this._events[a],f=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),f){case 1:return u.fn.call(u.context),!0;case 2:return u.fn.call(u.context,t),!0;case 3:return u.fn.call(u.context,t,n),!0;case 4:return u.fn.call(u.context,t,n,i),!0;case 5:return u.fn.call(u.context,t,n,i,s),!0;case 6:return u.fn.call(u.context,t,n,i,s,o),!0}for(c=1,l=Array(f-1);c<f;c++)l[c-1]=arguments[c];u.fn.apply(u.context,l)}else{var h,d=u.length;for(c=0;c<d;c++)switch(u[c].once&&this.removeListener(e,u[c].fn,void 0,!0),f){case 1:u[c].fn.call(u[c].context);break;case 2:u[c].fn.call(u[c].context,t);break;case 3:u[c].fn.call(u[c].context,t,n);break;case 4:u[c].fn.call(u[c].context,t,n,i);break;default:if(!l)for(h=1,l=Array(f-1);h<f;h++)l[h-1]=arguments[h];u[c].fn.apply(u[c].context,l)}}return!0},a.prototype.on=function(e,t,r){return s(this,e,t,r,!1)},a.prototype.once=function(e,t,r){return s(this,e,t,r,!0)},a.prototype.removeListener=function(e,t,n,i){var s=r?r+e:e;if(!this._events[s])return this;if(!t)return o(this,s),this;var a=this._events[s];if(a.fn)a.fn!==t||i&&!a.once||n&&a.context!==n||o(this,s);else{for(var l=0,c=[],u=a.length;l<u;l++)(a[l].fn!==t||i&&!a[l].once||n&&a[l].context!==n)&&c.push(a[l]);c.length?this._events[s]=1===c.length?c[0]:c:o(this,s)}return this},a.prototype.removeAllListeners=function(e){var t;return e?(t=r?r+e:e,this._events[t]&&o(this,t)):(this._events=new n,this._eventsCount=0),this},a.prototype.off=a.prototype.removeListener,a.prototype.addListener=a.prototype.on,a.prefixed=r,a.EventEmitter=a,e.exports=a},10632:function(e,t,r){/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */var n=r(9109),i=n.Buffer;function s(e,t){for(var r in e)t[r]=e[r]}function o(e,t,r){return i(e,t,r)}i.from&&i.alloc&&i.allocUnsafe&&i.allocUnsafeSlow?e.exports=n:(s(n,t),t.Buffer=o),o.prototype=Object.create(i.prototype),s(i,o),o.from=function(e,t,r){if("number"==typeof e)throw TypeError("Argument must not be a number");return i(e,t,r)},o.alloc=function(e,t,r){if("number"!=typeof e)throw TypeError("Argument must be a number");var n=i(e);return void 0!==t?"string"==typeof r?n.fill(t,r):n.fill(t):n.fill(0),n},o.allocUnsafe=function(e){if("number"!=typeof e)throw TypeError("Argument must be a number");return i(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw TypeError("Argument must be a number");return n.SlowBuffer(e)}},78404:function(e,t,r){"use strict";r.d(t,{vJ:function(){return tv},iv:function(){return ty},F4:function(){return tx},zo:function(){return tb}});var n,i,s,o=r(2265),a="-ms-",l="-moz-",c="-webkit-",u="comm",f="rule",h="decl",d="@keyframes",p=Math.abs,g=String.fromCharCode,y=Object.assign;function m(e,t){return(e=t.exec(e))?e[0]:e}function b(e,t,r){return e.replace(t,r)}function w(e,t,r){return e.indexOf(t,r)}function v(e,t){return 0|e.charCodeAt(t)}function E(e,t,r){return e.slice(t,r)}function x(e){return e.length}function _(e,t){return t.push(e),e}function A(e,t){return e.filter(function(e){return!m(e,t)})}var S=1,I=1,O=0,P=0,C=0,k="";function T(e,t,r,n,i,s,o,a){return{value:e,root:t,parent:r,type:n,props:i,children:s,line:S,column:I,length:o,return:"",siblings:a}}function B(e,t){return y(T("",null,null,"",null,null,0,e.siblings),e,{length:-e.length},t)}function R(e){for(;e.root;)e=B(e.root,{children:[e]});_(e,e.siblings)}function D(){return C=P<O?v(k,P++):0,I++,10===C&&(I=1,S++),C}function U(){return v(k,P)}function M(e){switch(e){case 0:case 9:case 10:case 13:case 32:return 5;case 33:case 43:case 44:case 47:case 62:case 64:case 126:case 59:case 123:case 125:return 4;case 58:return 3;case 34:case 39:case 40:case 91:return 2;case 41:case 93:return 1}return 0}function N(e){var t,r;return(t=P-1,r=function e(t){for(;D();)switch(C){case t:return P;case 34:case 39:34!==t&&39!==t&&e(C);break;case 40:41===t&&e(t);break;case 92:D()}return P}(91===e?e+2:40===e?e+1:e),E(k,t,r)).trim()}function j(e,t){for(var r="",n=0;n<e.length;n++)r+=t(e[n],n,e,t)||"";return r}function L(e,t,r,n){switch(e.type){case"@layer":if(e.children.length)break;case"@import":case"@namespace":case h:return e.return=e.return||e.value;case u:return"";case d:return e.return=e.value+"{"+j(e.children,n)+"}";case f:if(!x(e.value=e.props.join(",")))return""}return x(r=j(e.children,n))?e.return=e.value+"{"+r+"}":""}function $(e,t,r,n){if(e.length>-1&&!e.return)switch(e.type){case h:e.return=function e(t,r,n){var i;switch(i=r,45^v(t,0)?(((i<<2^v(t,0))<<2^v(t,1))<<2^v(t,2))<<2^v(t,3):0){case 5103:return c+"print-"+t+t;case 5737:case 4201:case 3177:case 3433:case 1641:case 4457:case 2921:case 5572:case 6356:case 5844:case 3191:case 6645:case 3005:case 4215:case 6389:case 5109:case 5365:case 5621:case 3829:case 6391:case 5879:case 5623:case 6135:case 4599:return c+t+t;case 4855:return c+t.replace("add","source-over").replace("substract","source-out").replace("intersect","source-in").replace("exclude","xor")+t;case 4789:return l+t+t;
32case 5349:case 4246:case 4810:case 6968:case 2756:return c+t+l+t+a+t+t;case 5936:switch(v(t,r+11)){case 114:return c+t+a+b(t,/[svh]\w+-[tblr]{2}/,"tb")+t;case 108:return c+t+a+b(t,/[svh]\w+-[tblr]{2}/,"tb-rl")+t;case 45:return c+t+a+b(t,/[svh]\w+-[tblr]{2}/,"lr")+t}case 6828:case 4268:case 2903:return c+t+a+t+t;case 6165:return c+t+a+"flex-"+t+t;case 5187:return c+t+b(t,/(\w+).+(:[^]+)/,c+"box-$1$2"+a+"flex-$1$2")+t;case 5443:return c+t+a+"flex-item-"+b(t,/flex-|-self/g,"")+(m(t,/flex-|baseline/)?"":a+"grid-row-"+b(t,/flex-|-self/g,""))+t;case 4675:return c+t+a+"flex-line-pack"+b(t,/align-content|flex-|-self/g,"")+t;case 5548:return c+t+a+b(t,"shrink","negative")+t;case 5292:return c+t+a+b(t,"basis","preferred-size")+t;case 6060:return c+"box-"+b(t,"-grow","")+c+t+a+b(t,"grow","positive")+t;case 4554:return c+b(t,/([^-])(transform)/g,"$1"+c+"$2")+t;case 6187:return b(b(b(t,/(zoom-|grab)/,c+"$1"),/(image-set)/,c+"$1"),t,"")+t;case 5495:case 3959:return b(t,/(image-set\([^]*)/,c+"$1$`$1");case 4968:return b(b(t,/(.+:)(flex-)?(.*)/,c+"box-pack:$3"+a+"flex-pack:$3"),/space-between/,"justify")+c+t+t;case 4200:if(!m(t,/flex-|baseline/))return a+"grid-column-align"+E(t,r)+t;break;case 2592:case 3360:return a+b(t,"template-","")+t;case 4384:case 3616:if(n&&n.some(function(e,t){return r=t,m(e.props,/grid-\w+-end/)}))return~w(t+(n=n[r].value),"span",0)?t:a+b(t,"-start","")+t+a+"grid-row-span:"+(~w(n,"span",0)?m(n,/\d+/):+m(n,/\d+/)-+m(t,/\d+/))+";";return a+b(t,"-start","")+t;case 4896:case 4128:return n&&n.some(function(e){return m(e.props,/grid-\w+-start/)})?t:a+b(b(t,"-end","-span"),"span ","")+t;case 4095:case 3583:case 4068:case 2532:return b(t,/(.+)-inline(.+)/,c+"$1$2")+t;case 8116:case 7059:case 5753:case 5535:case 5445:case 5701:case 4933:case 4677:case 5533:case 5789:case 5021:case 4765:if(x(t)-1-r>6)switch(v(t,r+1)){case 109:if(45!==v(t,r+4))break;case 102:return b(t,/(.+:)(.+)-([^]+)/,"$1"+c+"$2-$3$1"+l+(108==v(t,r+3)?"$3":"$2-$3"))+t;case 115:return~w(t,"stretch",0)?e(b(t,"stretch","fill-available"),r,n)+t:t}break;case 5152:case 5920:return b(t,/(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/,function(e,r,n,i,s,o,l){return a+r+":"+n+l+(i?a+r+"-span:"+(s?o:+o-+n)+l:"")+t});case 4949:if(121===v(t,r+6))return b(t,":",":"+c)+t;break;case 6444:switch(v(t,45===v(t,14)?18:11)){case 120:return b(t,/(.+:)([^;\s!]+)(;|(\s+)?!.+)?/,"$1"+c+(45===v(t,14)?"inline-":"")+"box$3$1"+c+"$2$3$1"+a+"$2box$3")+t;case 100:return b(t,":",":"+a)+t}break;case 5719:case 2647:case 2135:case 3927:case 2391:return b(t,"scroll-","scroll-snap-")+t}return t}(e.value,e.length,r);return;case d:return j([B(e,{value:b(e.value,"@","@"+c)})],n);case f:if(e.length){var i,s;return i=r=e.props,s=function(t){switch(m(t,n=/(::plac\w+|:read-\w+)/)){case":read-only":case":read-write":R(B(e,{props:[b(t,/:(read-\w+)/,":"+l+"$1")]})),R(B(e,{props:[t]})),y(e,{props:A(r,n)});break;case"::placeholder":R(B(e,{props:[b(t,/:(plac\w+)/,":"+c+"input-$1")]})),R(B(e,{props:[b(t,/:(plac\w+)/,":"+l+"$1")]})),R(B(e,{props:[b(t,/:(plac\w+)/,a+"input-$1")]})),R(B(e,{props:[t]})),y(e,{props:A(r,n)})}return""},i.map(s).join("")}}}function z(e,t,r,n,i,s,o,a,l,c,u,h){for(var d=i-1,g=0===i?s:[""],y=g.length,m=0,w=0,v=0;m<n;++m)for(var x=0,_=E(e,d+1,d=p(w=o[m])),A=e;x<y;++x)(A=(w>0?g[x]+" "+_:b(_,/&\f/g,g[x])).trim())&&(l[v++]=A);return T(e,t,r,0===i?f:a,l,c,u,h)}function F(e,t,r,n,i){return T(e,t,r,h,E(e,0,n),E(e,n+1,-1),n,i)}var q=r(25566);let W=void 0!==q&&void 0!==q.env&&(q.env.REACT_APP_SC_ATTR||q.env.SC_ATTR)||"data-styled",V="active",H="data-styled-version",G="6.4.2",K="/*!sc*/\n",Z="undefined"!=typeof window&&"undefined"!=typeof document;function J(e){if(void 0!==q&&void 0!==q.env){let t=q.env[e];if(void 0!==t&&""!==t)return"false"!==t}}let Y=!!("boolean"==typeof SC_DISABLE_SPEEDY?SC_DISABLE_SPEEDY:null!==(i=null!==(n=J("REACT_APP_SC_DISABLE_SPEEDY"))&&void 0!==n?n:J("SC_DISABLE_SPEEDY"))&&void 0!==i?i:void 0!==q&&void 0!==q.env&&!1),X="sc-keyframes-",Q={};function ee(e,...t){return Error(`An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#${e} for more information.${t.length>0?` Args: ${t.join(", ")}`:""}`)}let et=new Map,er=new Map,en=1,ei=e=>{if(et.has(e))return et.get(e);for(;er.has(en);)en++;let t=en++;return et.set(e,t),er.set(t,e),t},es=e=>er.get(e),eo=(e,t)=>{en=t+1,et.set(e,t),er.set(t,e)},ea=Object.freeze([]),el=Object.freeze({});function ec(e,t,r=el){return e.theme!==r.theme&&e.theme||t||r.theme}let eu=/[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g,ef=/(^-|-$)/g;function eh(e){return e.replace(eu,"-").replace(ef,"")}let ed=/(a)(d)/gi,ep=e=>String.fromCharCode(e+(e>25?39:97));function eg(e){let t,r="";for(t=Math.abs(e);t>52;t=t/52|0)r=ep(t%52)+r;return(ep(t%52)+r).replace(ed,"$1-$2")}let ey=(e,t)=>{let r=t.length;for(;r;)e=33*e^t.charCodeAt(--r);return e},em=e=>ey(5381,e);function eb(e){return eg(em(e)>>>0)}function ew(e){return"string"==typeof e}let ev=Symbol.for("react.memo"),eE=Symbol.for("react.forward_ref"),ex={contextType:!0,defaultProps:!0,displayName:!0,getDerivedStateFromError:!0,getDerivedStateFromProps:!0,propTypes:!0,type:!0},e_={name:!0,length:!0,prototype:!0,caller:!0,callee:!0,arguments:!0,arity:!0},eA={$$typeof:!0,compare:!0,defaultProps:!0,displayName:!0,propTypes:!0,type:!0},eS={[eE]:{$$typeof:!0,render:!0,defaultProps:!0,displayName:!0,propTypes:!0},[ev]:eA};function eI(e){return("type"in e&&e.type.$$typeof)===ev?eA:"$$typeof"in e?eS[e.$$typeof]:ex}let eO=Object.defineProperty,eP=Object.getOwnPropertyNames,eC=Object.getOwnPropertySymbols,ek=Object.getOwnPropertyDescriptor,eT=Object.getPrototypeOf,eB=Object.prototype;function eR(e){return"function"==typeof e}let eD=Symbol.for("react.forward_ref");function eU(e){return null!=e&&("object"==typeof e||"function"==typeof e)&&e.$$typeof===eD&&"styledComponentId"in e}function eM(e,t){return e&&t?e+" "+t:e||t||""}function eN(e,t){return e.join(t||"")}function ej(e){return null!==e&&"object"==typeof e&&e.constructor.name===Object.name&&!("props"in e&&e.$$typeof)}function eL(e,t){Object.defineProperty(e,"toString",{value:t})}let e$=class{constructor(e){this.groupSizes=new Uint32Array(512),this.length=512,this.tag=e,this._cGroup=0,this._cIndex=0}indexOfGroup(e){if(e===this._cGroup)return this._cIndex;let t=this._cIndex;if(e>this._cGroup)for(let r=this._cGroup;r<e;r++)t+=this.groupSizes[r];else for(let r=this._cGroup-1;r>=e;r--)t-=this.groupSizes[r];return this._cGroup=e,this._cIndex=t,t}insertRules(e,t){if(e>=this.groupSizes.length){let t=this.groupSizes,r=t.length,n=r;for(;e>=n;)if((n<<=1)<0)throw ee(16,`${e}`);this.groupSizes=new Uint32Array(n),this.groupSizes.set(t),this.length=n;for(let e=r;e<n;e++)this.groupSizes[e]=0}let r=this.indexOfGroup(e+1),n=0;for(let i=0,s=t.length;i<s;i++)this.tag.insertRule(r,t[i])&&(this.groupSizes[e]++,r++,n++);n>0&&this._cGroup>e&&(this._cIndex+=n)}clearGroup(e){if(e<this.length){let t=this.groupSizes[e],r=this.indexOfGroup(e),n=r+t;this.groupSizes[e]=0;for(let e=r;e<n;e++)this.tag.deleteRule(r);t>0&&this._cGroup>e&&(this._cIndex-=t)}}getGroup(e){let t="";if(e>=this.length||0===this.groupSizes[e])return t;let r=this.groupSizes[e],n=this.indexOfGroup(e),i=n+r;for(let e=n;e<i;e++)t+=this.tag.getRule(e)+K;return t}},ez=`style[${W}][${H}="${G}"]`,eF=RegExp(`^${W}\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)`),eq=e=>"undefined"!=typeof ShadowRoot&&e instanceof ShadowRoot||"host"in e&&11===e.nodeType,eW=e=>{if(!e)return document;if(eq(e))return e;if("getRootNode"in e){let t=e.getRootNode();if(eq(t))return t}return document},eV=(e,t,r)=>{let n;let i=r.split(",");for(let r=0,s=i.length;r<s;r++)(n=i[r])&&e.registerName(t,n)},eH=(e,t)=>{var r;let n=(null!==(r=t.textContent)&&void 0!==r?r:"").split(K),i=[];for(let t=0,r=n.length;t<r;t++){let r=n[t].trim();if(!r)continue;let s=r.match(eF);if(s){let t=0|parseInt(s[1],10),r=s[2];0!==t&&(eo(r,t),eV(e,r,s[3]),e.getTag().insertRules(t,i)),i.length=0}else i.push(r)}},eG=e=>{let t=eW(e.options.target).querySelectorAll(ez);for(let r=0,n=t.length;r<n;r++){let n=t[r];n&&n.getAttribute(W)!==V&&(eH(e,n),n.parentNode&&n.parentNode.removeChild(n))}},eK=!1,eZ=(e,t)=>{let n=document.head,i=e||n,s=document.createElement("style"),o=(e=>{let t=Array.from(e.querySelectorAll(`style[${W}]`));return t[t.length-1]})(i),a=void 0!==o?o.nextSibling:null;s.setAttribute(W,V),s.setAttribute(H,G);let l=t||function(){if(!1!==eK)return eK;if("undefined"!=typeof document){let e=document.head.querySelector('meta[property="csp-nonce"]');if(e)return eK=e.nonce||e.getAttribute("content")||void 0;let t=document.head.querySelector('meta[name="sc-nonce"]');if(t)return eK=t.getAttribute("content")||void 0}return eK=r.nc}();return l&&s.setAttribute("nonce",l),i.insertBefore(s,a),s},eJ=class{constructor(e,t){this.element=eZ(e,t),this.element.appendChild(document.createTextNode("")),this.sheet=(e=>{var t;if(e.sheet)return e.sheet;let r=null!==(t=e.getRootNode().styleSheets)&&void 0!==t?t:document.styleSheets;for(let t=0,n=r.length;t<n;t++){let n=r[t];if(n.ownerNode===e)return n}throw ee(17)})(this.element),this.length=0}insertRule(e,t){try{return this.sheet.insertRule(t,e),this.length++,!0}catch(e){return!1}}deleteRule(e){this.sheet.deleteRule(e),this.length--}getRule(e){let t=this.sheet.cssRules[e];return t&&t.cssText?t.cssText:""}}
32,eY=class{constructor(e,t){this.element=eZ(e,t),this.nodes=this.element.childNodes,this.length=0}insertRule(e,t){if(e<=this.length&&e>=0){let r=document.createTextNode(t);return this.element.insertBefore(r,this.nodes[e]||null),this.length++,!0}return!1}deleteRule(e){this.element.removeChild(this.nodes[e]),this.length--}getRule(e){return e<this.length?this.nodes[e].textContent:""}},eX=Z,eQ={isServer:!Z,useCSSOMInjection:!Y};class e0{static registerId(e){return ei(e)}constructor(e=el,t={},r){this.options=Object.assign(Object.assign({},eQ),e),this.gs=t,this.keyframeIds=new Set,this.names=new Map(r),this.server=!!e.isServer,!this.server&&Z&&eX&&(eX=!1,eG(this)),eL(this,()=>(e=>{let t=e.getTag(),{length:r}=t,n="";for(let i=0;i<r;i++){let r=es(i);if(void 0===r)continue;let s=e.names.get(r);if(void 0===s||!s.size)continue;let o=t.getGroup(i);if(0===o.length)continue;let a=W+".g"+i+'[id="'+r+'"]',l="";for(let e of s)e.length>0&&(l+=e+",");n+=o+a+'{content:"'+l+'"}'+K}return n})(this))}rehydrate(){!this.server&&Z&&eG(this)}reconstructWithOptions(e,t=!0){let r=new e0(Object.assign(Object.assign({},this.options),e),this.gs,t&&this.names||void 0);return r.keyframeIds=new Set(this.keyframeIds),!this.server&&Z&&e.target!==this.options.target&&eW(this.options.target)!==eW(e.target)&&eG(r),r}allocateGSInstance(e){return this.gs[e]=(this.gs[e]||0)+1}getTag(){return this.tag||(this.tag=new e$((({useCSSOMInjection:e,target:t,nonce:r})=>e?new eJ(t,r):new eY(t,r))(this.options)))}hasNameForId(e,t){var r,n;return null!==(n=null===(r=this.names.get(e))||void 0===r?void 0:r.has(t))&&void 0!==n&&n}registerName(e,t){ei(e),e.startsWith(X)&&this.keyframeIds.add(e);let r=this.names.get(e);r?r.add(t):this.names.set(e,new Set([t]))}insertRules(e,t,r){this.registerName(e,t),this.getTag().insertRules(ei(e),r)}clearNames(e){this.names.has(e)&&this.names.get(e).clear()}clearRules(e){this.getTag().clearGroup(ei(e)),this.clearNames(e)}clearTag(){this.tag=void 0}}let e1=new WeakSet,e2={animationIterationCount:1,aspectRatio:1,borderImageOutset:1,borderImageSlice:1,borderImageWidth:1,columnCount:1,columns:1,flex:1,flexGrow:1,flexShrink:1,gridRow:1,gridRowEnd:1,gridRowSpan:1,gridRowStart:1,gridColumn:1,gridColumnEnd:1,gridColumnSpan:1,gridColumnStart:1,fontWeight:1,lineHeight:1,opacity:1,order:1,orphans:1,scale:1,tabSize:1,widows:1,zIndex:1,zoom:1,WebkitLineClamp:1,fillOpacity:1,floodOpacity:1,stopOpacity:1,strokeDasharray:1,strokeDashoffset:1,strokeMiterlimit:1,strokeOpacity:1,strokeWidth:1};function e6(e){if(45===e.charCodeAt(0)&&45===e.charCodeAt(1))return e;let t="";for(let r=0;r<e.length;r++){let n=e.charCodeAt(r);t+=n>=65&&n<=90?"-"+String.fromCharCode(n+32):e[r]}return t.startsWith("ms-")?"-"+t:t}let e5=Symbol.for("sc-keyframes");function e8(e){return eR(e)&&!(e.prototype&&e.prototype.isReactComponent)}let e3=e=>
32null==e||!1===e||""===e,e4=Symbol.for("react.client.reference");function e9(e){return e.$$typeof===e4}function e7(e,t,r,n,i=[]){if(e3(e))return i;let s=typeof e;if("string"===s)return i.push(e),i;if("function"===s)return e9(e)?i:e8(e)&&t?e7(e(t),t,r,n,i):(i.push(e),i);if(Array.isArray(e)){for(let s=0;s<e.length;s++)e7(e[s],t,r,n,i);return i}return eU(e)?i.push(`.${e.styledComponentId}`):"object"==typeof e&&null!==e&&e5 in e?r?(e.inject(r,n),i.push(e.getName(n))):i.push(e):e9(e)||(ej(e)?e.toString!==Object.prototype.toString?i.push(e.toString()):function e(t,r){for(let n in t){let i=t[n];t.hasOwnProperty(n)&&!e3(i)&&(Array.isArray(i)&&e1.has(i)||eR(i)?r.push(e6(n)+":",i,";"):ej(i)?(r.push(n+" {"),e(i,r),r.push("}")):r.push(e6(n)+": "+(null==i||"boolean"==typeof i||""===i?"":"number"!=typeof i||0===i||n in e2||n.startsWith("--")?String(i).trim():i+"px")+";"))}}(e,i):i.push(e.toString())),i}let te=em(G);class tt{constructor(e,t,r){this.rules=e,this.componentId=t,this.baseHash=ey(te,t),this.baseStyle=r,e0.registerId(t)}generateAndInjectStyles(e,t,r){let n=this.baseStyle?this.baseStyle.generateAndInjectStyles(e,t,r):"";{let i="";for(let n=0;n<this.rules.length;n++){let s=this.rules[n];if("string"==typeof s)i+=s;else if(s){if(e8(s)){let n=s(e);"string"==typeof n?i+=n:null!=n&&!1!==n&&(i+=eN(e7(n,e,t,r)))}else i+=eN(e7(s,e,t,r))}}if(i){this.dynamicNameCache||(this.dynamicNameCache=new Map);let e=r.hash?r.hash+i:i,s=this.dynamicNameCache.get(e);if(!s){if(s=eg(ey(ey(this.baseHash,r.hash),i)>>>0),this.dynamicNameCache.size>=200){let e=this.dynamicNameCache.keys().next().value;void 0!==e&&this.dynamicNameCache.delete(e)}this.dynamicNameCache.set(e,s)}if(!t.hasNameForId(this.componentId,s)){let e=r(i,"."+s,void 0,this.componentId);t.insertRules(this.componentId,s,e)}n=eM(n,s)}}return n}}let tr=/&/g;function tn(e,t){let r=0;for(;--t>=0&&92===e.charCodeAt(t);)r++;return!(1&~r)}function ti(e){let t=e.length,r="",n=0,i=0,s=0,o=!1,a=!1;for(let l=0;l<t;l++){let c=e.charCodeAt(l);if(0!==s||o||47!==c||42!==e.charCodeAt(l+1)){if(o)42===c&&47===e.charCodeAt(l+1)&&(o=!1,l++);else if(34!==c&&39!==c||tn(e,l)){if(0===s){if(123===c)i++;else if(125===c){if(--i<0){a=!0;let r=l+1;for(;r<t;){let t=e.charCodeAt(r);if(59===t||10===t)break;r++}r<t&&59===e.charCodeAt(r)&&r++,i=0,l=r-1,n=r;continue}0===i&&(r+=e.substring(n,l+1),n=l+1)}else 59===c&&0===i&&(r+=e.substring(n,l+1),n=l+1)}}else 0===s?s=c:s===c&&(s=0)}else o=!0,l++}return a||0!==i||0!==s?(n<t&&0===i&&0===s&&(r+=e.substring(n)),r):e}let ts=new e0,to=function({options:e=el,plugins:t=ea}=el){var r,n,i;let s,o,a;let l=(e,t,r)=>r.startsWith(o)&&r.endsWith(o)&&r.replaceAll(o,"").length>0?`.${s}`:e,c=t.slice();c.push(e=>{e.type===f&&e.value.includes("&")&&(a||(a=RegExp(`\\${o}\\b`,"g")),e.props[0]=e.props[0].replace(tr,o).replace(a,l))}),e.prefix&&c.push($),c.push(L);let h=[],d=(i=(n=c.concat((r=e=>h.push(e),function(e){!e.root&&(e=e.return)&&r(e)}))).length,function(e,t,r,s){for(var o="",a=0;a<i;a++)o+=n[a](e,t,r,s)||"";return o}),y=(t,r="",n="",i="&")=>{var l,c,f;s=i,o=r,a=void 0;let y=function(e){let t=-1!==e.indexOf("//"),r=-1!==e.indexOf("}");if(!t&&!r)return e;if(!t)return ti(e);let n=e.length,i="",s=0,o=0,a=0,l=0,c=0,u=!1;for(;o<n;){let t=e.charCodeAt(o);if(34!==t&&39!==t||tn(e,o)){if(0===a){if(47===t&&o+1<n&&42===e.charCodeAt(o+1)){for(o+=2;o+1<n&&(42!==e.charCodeAt(o)||47!==e.charCodeAt(o+1));)o++;o+=2}else if(40!==t){if(41!==t){if(l>0)o++;else if(42===t&&o+1<n&&47===e.charCodeAt(o+1))i+=e.substring(s,o),o+=2,
32s=o,u=!0;else if(47===t&&o+1<n&&47===e.charCodeAt(o+1)){for(i+=e.substring(s,o);o<n&&10!==e.charCodeAt(o);)o++;s=o,u=!0}else 123===t?c++:125===t&&c--,o++}else l>0&&l--,o++}else l++,o++}else o++}else 0===a?a=t:a===t&&(a=0),o++}return u?(s<n&&(i+=e.substring(s)),0===c?i:ti(i)):0===c?e:ti(e)}(t),m=(f=function e(t,r,n,i,s,o,a,l,c){for(var f,h=0,d=0,y=a,m=0,A=0,O=0,B=1,R=1,j=1,L=0,$="",q=s,W=o,V=i,H=$;R;)switch(O=L,L=D()){case 40:if(108!=O&&58==v(H,y-1)){-1!=w(H+=b(N(L),"&","&\f"),"&\f",p(h?l[h-1]:0))&&(j=-1);break}case 34:case 39:case 91:H+=N(L);break;case 9:case 10:case 13:case 32:H+=function(e){for(;C=U();)if(C<33)D();else break;return M(e)>2||M(C)>3?"":" "}(O);break;case 92:H+=function(e,t){for(var r;--t&&D()&&!(C<48)&&!(C>102)&&(!(C>57)||!(C<65))&&(!(C>70)||!(C<97)););return r=P+(t<6&&32==U()&&32==D()),E(k,e,r)}(P-1,7);continue;case 47:switch(U()){case 42:case 47:_(T(f=function(e,t){for(;D();)if(e+C===57)break;else if(e+C===84&&47===U())break;return"/*"+E(k,t,P-1)+"*"+g(47===e?e:D())}(D(),P),r,n,u,g(C),E(f,2,-2),0,c),c),(5==M(O||1)||5==M(U()||1))&&x(H)&&" "!==E(H,-1,void 0)&&(H+=" ");break;default:H+="/"}break;case 123*B:l[h++]=x(H)*j;case 125*B:case 59:case 0:switch(L){case 0:case 125:R=0;case 59+d:-1==j&&(H=b(H,/\f/g,"")),A>0&&(x(H)-y||0===B&&47===O)&&_(A>32?F(H+";",i,n,y-1,c):F(b(H," ","")+";",i,n,y-2,c),c);break;case 59:H+=";";default:if(_(V=z(H,r,n,h,d,s,l,$,q=[],W=[],y,o),o),123===L){if(0===d)e(H,r,V,V,q,o,y,l,W);else{switch(m){case 99:if(110===v(H,3))break;case 108:if(97===v(H,2))break;default:d=0;case 100:case 109:case 115:}d?e(t,V,V,i&&_(z(t,V,V,0,0,s,l,$,s,q=[],y,W),W),s,W,y,l,i?q:W):e(H,V,V,V,[""],W,0,l,W)}}}h=d=A=0,B=j=1,$=H="",y=a;break;case 58:y=1+x(H),A=O;default:if(B<1){if(123==L)--B;else if(125==L&&0==B++&&125==(C=P>0?v(k,--P):0,I--,10===C&&(I=1,S--),C))continue}switch(H+=g(L),L*B){case 38:j=d>0?1:(H+="\f",-1);break;case 44:l[h++]=(x(H)-1)*j,j=1;break;case 64:45===U()&&(H+=N(D())),m=U(),d=y=x($=H+=function(e){for(;!M(U());)D();return E(k,e,P)}(P)),L++;break;case 45:45===O&&2==x(H)&&(B=0)}}return o}("",null,null,null,[""],(c=l=n||r?n+" "+r+" { "+y+" }":y,S=I=1,O=x(k=c),P=0,l=[]),0,[0],l),k="",f);return e.namespace&&(m=function e(t,r){let n=r+" ",i=","+n;for(let s=0;s<t.length;s++){let o=t[s];if("rule"===o.type){o.value=(n+o.value).replaceAll(",",i);let e=o.props,t=[];for(let r=0;r<e.length;r++)t[r]=n+e[r];o.props=t}Array.isArray(o.children)&&"@keyframes"!==o.type&&e(o.children,r)}return t}(m,e.namespace)),h=[],j(m,d),h},m=5381;for(let e=0;e<t.length;e++)t[e].name||ee(15),m=ey(m,t[e].name);return(null==e?void 0:e.namespace)&&(m=ey(m,e.namespace)),(null==e?void 0:e.prefix)&&(m=ey(m,"p")),y.hash=5381!==m?m.toString():"",y}(),ta=o.createContext({shouldForwardProp:void 0,styleSheet:ts,stylis:to,stylisPlugins:void 0});function tl(){return o.useContext(ta)}ta.Consumer;let tc=o.createContext(void 0);tc.Consumer;let tu=Object.prototype.hasOwnProperty,tf={};function th(e,t,r){let n=eU(e),i=!ew(e),{attrs:s=ea,componentId:a=function(e,t){let r="string"!=typeof e?"sc":eh(e);tf[r]=(tf[r]||0)+1;let n=r+"-"+eb(G+r+tf[r]);return t?t+"-"+n:n}(t.displayName,t.parentComponentId),displayName:l=ew(e)?`styled.${e}`:`Styled(${e.displayName||e.name||"Component"})`}=t,c=t.displayName&&t.componentId?eh(t.displayName)+"-"+t.componentId:t.componentId||a,u=n&&e.attrs?e.attrs.concat(s).filter(Boolean):s,{shouldForwardProp:f}=t;if(n&&e.shouldForwardProp){let r=e.shouldForwardProp;if(t.shouldForwardProp){let e=t.shouldForwardProp;f=(t,n)=>r(t,n)&&e(t,n)}else f=r}let h=new tt(r,c,n?e.componentStyle:void 0);function d(e,t){return function(e,t,r){let n,i;let{attrs:s,componentStyle:a,defaultProps:l,foldedComponentIds:c,styledComponentId:u,target:f}=e,h=o.useContext(tc),d=tl(),p=e.shouldForwardProp||d.shouldForwardProp,g=ec(t,h,l)||el;{let e=o.useRef(null),r=e.current;if(null!==r&&r[1]===g&&r[2]===d.styleSheet&&r[3]===d.stylis&&r[7]===a&&function(e,t,r){let n=0;for(let r in t)if(tu.call(t,r)&&(n++,e[r]!==t[r]))return!1;return n===r}(r[0],t,r[4]))n=r[5],i=r[6];else{var y,m,b;y=n=function(e,t,r){let n=Object.assign(Object.assign({},t),{className:void 0,theme:r}),i=e.length>1;for(let r=0;r<e.length;r++){let s=e[r],o=eR(s)?s(i?Object.assign({},n):n):s;for(let e in o)"className"===e?n.className=eM(n.className,o[e]):"style"===e?n.style=Object.assign(Object.assign({},n.style),o[e]):e in t&&void 0===t[e]||(n[e]=o[e])}return"className"in t&&"string"==typeof t.className&&(n.className=eM(n.className,t.className)),n}(s,t,g),m=d.styleSheet,b=d.stylis,i=a.generateAndInjectStyles(y,m,b);let r=0;for(let e in t)tu.call(t,e)&&r++;e.current=[t,g,d.styleSheet,d.stylis,r,n,i,a]}}let w=n.as||f,v=function(e,t,r,n){let i={};for(let s in e)void 0===e[s]||"$"===s[0]||"as"===s||"theme"===s&&e.theme===r||("forwardedAs"===s?i.as=e.forwardedAs:n&&!n(s,t)||(i[s]=e[s]));return i}(n,w,g,p),E=eM(c,u);return i&&(E+=" "+i),n.className&&(E+=" "+n.className),v[ew(w)&&w.includes("-")?"class":"className"]=E,r&&(v.ref=r),(0,o.createElement)(w,v)}(p,e,t)}d.displayName=l;let p=o.forwardRef(d);return p.attrs=u,p.componentStyle=h,p.displayName=l,p.shouldForwardProp=f,p.foldedComponentIds=n?eM(e.foldedComponentIds,e.styledComponentId):"",p.styledComponentId=c,p.target=n?e.target:e,Object.defineProperty(p,"defaultProps",{get(){return this._foldedDefaultProps},set(t){this._foldedDefaultProps=n?function(e,...t){for(let r of t)(function e(t,r,n=!1){if(!n&&!ej(t)&&!Array.isArray(t))return r;if(Array.isArray(r))for(let n=0;n<r.length;n++)t[n]=e(t[n],r[n]);else if(ej(r))for(let n in r)t[n]=e(t[n],r[n]);return t})(e,r,!0);return e}({},e.defaultProps,t):t}}),eL(p,()=>`.${p.styledComponentId}`),i&&function e(t,r,n){if("string"!=typeof r){let i=eT(r);i&&i!==eB&&e(t,i,n);let s=eP(r).concat(eC(r)),o=eI(t),a=eI(r);for(let e=0;e<s.length;++e){let i=s[e];
32if(!(i in e_||n&&n[i]||a&&i in a||o&&i in o)){let e=ek(r,i);try{eO(t,i,e)}catch(e){}}}}return t}(p,e,{attrs:!0,componentStyle:!0,displayName:!0,foldedComponentIds:!0,shouldForwardProp:!0,styledComponentId:!0,target:!0}),p}var td=new Set(["a","abbr","address","area","article","aside","audio","b","bdi","bdo","blockquote","body","button","br","canvas","caption","cite","code","col","colgroup","data","datalist","dd","del","details","dfn","dialog","div","dl","dt","em","embed","fieldset","figcaption","figure","footer","form","h1","h2","h3","h4","h5","h6","header","hgroup","hr","html","i","iframe","img","input","ins","kbd","label","legend","li","main","map","mark","menu","meter","nav","object","ol","optgroup","option","output","p","picture","pre","progress","q","rp","rt","ruby","s","samp","search","section","select","slot","small","span","strong","sub","summary","sup","table","tbody","td","template","textarea","tfoot","th","thead","time","tr","u","ul","var","video","wbr","circle","clipPath","defs","ellipse","feBlend","feColorMatrix","feComponentTransfer","feComposite","feConvolveMatrix","feDiffuseLighting","feDisplacementMap","feDistantLight","feDropShadow","feFlood","feFuncA","feFuncB","feFuncG","feFuncR","feGaussianBlur","feImage","feMerge","feMergeNode","feMorphology","feOffset","fePointLight","feSpecularLighting","feSpotLight","feTile","feTurbulence","filter","foreignObject","g","image","line","linearGradient","marker","mask","path","pattern","polygon","polyline","radialGradient","rect","stop","svg","switch","symbol","text","textPath","tspan","use"]);function tp(e,t){let r=[e[0]];for(let n=0,i=t.length;n<i;n+=1)r.push(t[n],e[n+1]);return r}let tg=e=>(e1.add(e),e);function ty(e,...t){return eR(e)||ej(e)?tg(e7(tp(ea,[e,...t]))):0===t.length&&1===e.length&&"string"==typeof e[0]?e7(e):tg(e7(tp(e,t)))}let tm=e=>(function e(t,r,n=el){if(!r)throw ee(1,r);let i=(e,...i)=>t(r,n,ty(e,...i));return i.attrs=i=>e(t,r,Object.assign(Object.assign({},n),{attrs:Array.prototype.concat(n.attrs,i).filter(Boolean)})),i.withConfig=i=>e(t,r,Object.assign(Object.assign({},n),i)),i})(th,e),tb=tm;td.forEach(e=>{tb[e]=tm(e)});class tw{constructor(e,t){this.instanceRules=new Map,this.rules=e,this.componentId=t,this.isStatic=function(e){for(let t=0;t<e.length;t+=1){let r=e[t];if(eR(r)&&!eU(r))return!1}return!0}(e),e0.registerId(this.componentId)}removeStyles(e,t){this.instanceRules.delete(e),this.rebuildGroup(t)}renderStyles(e,t,r,n){let i=this.componentId;if(this.isStatic){if(r.hasNameForId(i,i+e))this.instanceRules.has(e)||this.computeRules(e,t,r,n);else{let s=this.computeRules(e,t,r,n);r.insertRules(i,s.name,s.rules)}return}let s=this.instanceRules.get(e);if(this.computeRules(e,t,r,n),!r.server&&s){let t=s.rules,r=this.instanceRules.get(e).rules;if(t.length===r.length){let e=!0;for(let n=0;n<t.length;n++)if(t[n]!==r[n]){e=!1;break}if(e)return}}this.rebuildGroup(r)}computeRules(e,t,r,n){let i=eN(e7(this.rules,t,r,n)),s={name:this.componentId+e,rules:n(i,"")};return this.instanceRules.set(e,s),s}rebuildGroup(e){let t=this.componentId;for(let r of(e.clearRules(t),this.instanceRules.values()))e.insertRules(t,r.name,r.rules)}}function tv(e,...t){let r=ty(e,...t),n=`sc-global-${eb(JSON.stringify(r))}`,i=new tw(r,n),s=e=>{let t;let r=tl(),s=o.useContext(tc);{let e=o.useRef(null);null===e.current&&(e.current=r.styleSheet.allocateGSInstance(n)),t=e.current}r.styleSheet.server&&a(t,e,r.styleSheet,s,r.stylis);{let l=i.isStatic?[t,r.styleSheet,i]:[t,e,r.styleSheet,s,r.stylis,i],c=o.useRef(i);o.useLayoutEffect(()=>{r.styleSheet.server||(c.current!==i&&(r.styleSheet.clearRules(n),c.current=i),a(t,e,r.styleSheet,s,r.stylis))},l),o.useLayoutEffect(()=>()=>{r.styleSheet.server||i.removeStyles(t,r.styleSheet)},[t,r.styleSheet,i])}return r.styleSheet.server&&i.instanceRules.delete(t),null};function a(e,t,r,n,o){if(i.isStatic)i.renderStyles(e,Q,r,o);else{let a=Object.assign(Object.assign({},t),{theme:ec(t,n,s.defaultProps)});i.renderStyles(e,a,r,o)}}return o.memo(s)}class tE{constructor(e,t){this[s]=!0,this.inject=(e,t=to)=>{let r=this.getName(t);if(!e.hasNameForId(this.id,r)){let n=t(this.rules,r,"@keyframes");e.insertRules(this.id,r,n)}},this.name=e,this.id=X+e,this.rules=t,ei(this.id),eL(this,()=>{throw ee(12,String(this.name))})}getName(e=to){return e.hash?this.name+eg(+e.hash>>>0):this.name}}function tx(e,...t){let r=eN(ty(e,...t));return new tE(eb(r),r)}s=e5},57139:function(e,t){"use strict";function r(e,t,r){return t<=e&&e<=r}function n(e){if(void 0===e)return{};if(e===Object(e))return e;throw TypeError("Could not convert argument to dictionary")}function i(e){this.tokens=[].slice.call(e)}function s(e,t){if(e)throw TypeError("Decoder error");return t||65533}
vendor: 4,140 bytes, line 32
32i.prototype={endOfStream:function(){return!this.tokens.length},read:function(){return this.tokens.length?this.tokens.shift():-1},prepend:function(e){if(Array.isArray(e))for(;e.length;)this.tokens.unshift(e.pop());else this.tokens.unshift(e)},push:function(e){if(Array.isArray(e))for(;e.length;)this.tokens.push(e.shift());else this.tokens.push(e)}};var o="utf-8";function a(e,t){if(!(this instanceof a))return new a(e,t);if((e=void 0!==e?String(e).toLowerCase():o)!==o)throw Error("Encoding not supported. Only utf-8 is supported");t=n(t),this._streaming=!1,this._BOMseen=!1,this._decoder=null,this._fatal=!!t.fatal,this._ignoreBOM=!!t.ignoreBOM,Object.defineProperty(this,"encoding",{value:"utf-8"}),Object.defineProperty(this,"fatal",{value:this._fatal}),Object.defineProperty(this,"ignoreBOM",{value:this._ignoreBOM})}function l(e,t){if(!(this instanceof l))return new l(e,t);if((e=void 0!==e?String(e).toLowerCase():o)!==o)throw Error("Encoding not supported. Only utf-8 is supported");t=n(t),this._streaming=!1,this._encoder=null,this._options={fatal:!!t.fatal},Object.defineProperty(this,"encoding",{value:"utf-8"})}function c(e){var t=e.fatal,n=0,i=0,o=0,a=128,l=191;this.handler=function(e,c){if(-1===c&&0!==o)return o=0,s(t);if(-1===c)return -1;if(0===o){if(r(c,0,127))return c;if(r(c,194,223))o=1,n=c-192;else if(r(c,224,239))224===c&&(a=160),237===c&&(l=159),o=2,n=c-224;else{if(!r(c,240,244))return s(t);240===c&&(a=144),244===c&&(l=143),o=3,n=c-240}return n<<=6*o,null}if(!r(c,a,l))return n=o=i=0,a=128,l=191,e.prepend(c),s(t);if(a=128,l=191,i+=1,n+=c-128<<6*(o-i),i!==o)return null;var u=n;return n=o=i=0,u}}function u(e){e.fatal,this.handler=function(e,t){if(-1===t)return -1;if(r(t,0,127))return t;r(t,128,2047)?(n=1,i=192):r(t,2048,65535)?(n=2,i=224):r(t,65536,1114111)&&(n=3,i=240);for(var n,i,s=[(t>>6*n)+i];n>0;){var o=t>>6*(n-1);s.push(128|63&o),n-=1}return s}}a.prototype={decode:function(e,t){r="object"==typeof e&&e instanceof ArrayBuffer?new Uint8Array(e):"object"==typeof e&&"buffer"in e&&e.buffer instanceof ArrayBuffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(0),t=n(t),this._streaming||(this._decoder=new c({fatal:this._fatal}),this._BOMseen=!1),this._streaming=!!t.stream;for(var r,s,o=new i(r),a=[];!o.endOfStream()&&-1!==(s=this._decoder.handler(o,o.read()));)null!==s&&(Array.isArray(s)?a.push.apply(a,s):a.push(s));if(!this._streaming){do{if(-1===(s=this._decoder.handler(o,o.read())))break;if(null===s)continue;Array.isArray(s)?a.push.apply(a,s):a.push(s)}while(!o.endOfStream());this._decoder=null}return!a.length||-1===["utf-8"].indexOf(this.encoding)||this._ignoreBOM||this._BOMseen||(65279===a[0]?(this._BOMseen=!0,a.shift()):this._BOMseen=!0),function(e){for(var t="",r=0;r<e.length;++r){var n=e[r];n<=65535?t+=String.fromCharCode(n):(n-=65536,t+=String.fromCharCode((n>>10)+55296,(1023&n)+56320))}return t}(a)}},l.prototype={encode:function(e,t){e=e?String(e):"",t=n(t),this._streaming||(this._encoder=new u(this._options)),this._streaming=!!t.stream;for(var r,s=[],o=new i(function(e){for(var t=String(e),r=t.length,n=0,i=[];n<r;){var s=t.charCodeAt(n);if(s<55296||s>57343)i.push(s);else if(56320<=s&&s<=57343)i.push(65533);else if(55296<=s&&s<=56319){if(n===r-1)i.push(65533);else{var o=e.charCodeAt(n+1);if(56320<=o&&o<=57343){var a=1023&s,l=1023&o;i.push(65536+(a<<10)+l),n+=1}else i.push(65533)}}n+=1}return i}(e));!o.endOfStream()&&-1!==(r=this._encoder.handler(o,o.read()));)Array.isArray(r)?s.push.apply(s,r):s.push(r);if(!this._streaming){for(;-1!==(r=this._encoder.handler(o,o.read()));)Array.isArray(r)?s.push.apply(s,r):s.push(r);this._encoder=null}return new Uint8Array(s)}},t.TextEncoder=l,t.TextDecoder=a},17914:function(e,t,r){var n;!function(i,s){"use strict";var o="function",a="undefined",l="object",c="string",u="major",f="model",h="name",d="type",p="vendor",g="version",y="architecture",m="console",b="mobile",w="tablet",v="smarttv",E="wearable",x="embedded",_="Amazon",A="Apple",S="ASUS",I="BlackBerry",O="Browser",P="Chrome",C="Firefox",k="Google",T="Honor",B="Huawei",R="Microsoft",D="Motorola",U="Nvidia",M="OnePlus",N="Opera",j="OPPO",L="Samsung",$
vendor: 2,623 bytes, line 32
32="Sharp",z="Sony",F="Xiaomi",q="Zebra",W="Facebook",V="Chromium OS",H="Mac OS",G=" Browser",K=function(e,t){var r={};for(var n in e)t[n]&&t[n].length%2==0?r[n]=t[n].concat(e[n]):r[n]=e[n];return r},Z=function(e){for(var t={},r=0;r<e.length;r++)t[e[r].toUpperCase()]=e[r];return t},J=function(e,t){return typeof e===c&&-1!==Y(t).indexOf(Y(e))},Y=function(e){return e.toLowerCase()},X=function(e,t){if(typeof e===c)return e=e.replace(/^\s\s*/,""),typeof t===a?e:e.substring(0,500)},Q=function(e,t){for(var r,n,i,a,c,u,f=0;f<t.length&&!c;){var h=t[f],d=t[f+1];for(r=n=0;r<h.length&&!c&&h[r];)if(c=h[r++].exec(e))for(i=0;i<d.length;i++)u=c[++n],typeof(a=d[i])===l&&a.length>0?2===a.length?typeof a[1]==o?this[a[0]]=a[1].call(this,u):this[a[0]]=a[1]:3===a.length?typeof a[1]!==o||a[1].exec&&a[1].test?this[a[0]]=u?u.replace(a[1],a[2]):void 0:this[a[0]]=u?a[1].call(this,u,a[2]):void 0:4===a.length&&(this[a[0]]=u?a[3].call(this,u.replace(a[1],a[2])):void 0):this[a]=u||s;f+=2}},ee=function(e,t){for(var r in t)if(typeof t[r]===l&&t[r].length>0){for(var n=0;n<t[r].length;n++)if(J(t[r][n],e))return"?"===r?s:r}else if(J(t[r],e))return"?"===r?s:r;return t.hasOwnProperty("*")?t["*"]:e},et={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2e3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2",8.1:"NT 6.3",10:["NT 6.4","NT 10.0"],RT:"ARM"},er={browser:[[/\b(?:crmo|crios)\/([\w\.]+)/i],[g,[h,"Chrome"]],[/edg(?:e|ios|a)?\/([\w\.]+)/i],[g,[h,"Edge"]],[/(opera mini)\/([-\w\.]+)/i,/(opera [mobiletab]{3,6})\b.+version\/([-\w\.]+)/i,/(opera)(?:.+version\/|[\/ ]+)([\w\.]+)/i],[h,g],[/opios[\/ ]+([\w\.]+)/i],[g,[h,N+" Mini"]],[/\bop(?:rg)?x\/([\w\.]+)/i],[g,[h,N+" GX"]],[/\bopr\/([\w\.]+)/i],[g,[h,N]],[/\bb[ai]*d(?:uhd|[ub]*[aekoprswx]{5,6})[\/ ]?([\w\.]+)/i],[g,[h,"Baidu"]],[/\b(?:mxbrowser|mxios|myie2)\/?([-\w\.]*)\b/i],[g,[h,"Maxthon"]],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer|sleipnir)[\/ ]?([\w\.]*)/i,/(avant|iemobile|slim(?:browser|boat|jet))[\/ ]?([\d\.]*)/i,/(?:ms|\()(ie) ([\w\.]+)/i,/(flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|qupzilla|falkon|rekonq|puffin|brave|whale(?!.+naver)|qqbrowserlite|duckduckgo|klar|helio|(?=comodo_)?dragon)\/([-\w\.]+)/i,/(heytap|ovi|115)browser\/([\d\.]+)/i,/(weibo)__([\d\.]+)/i],[h,g],[/quark(?:pc)?\/([-\w\.]+)/i],[g,[h,"Quark"]],[/\bddg\/([\w\.]+)/i],[g,[h,"DuckDuckGo"]],[/(?:\buc? ?browser|(?:juc.+)ucweb)[\/ ]?([\w\.]+)/i],[g,[h,"UC"+O]],[/microm.+\bqbcore\/([\w\.]+)/i,/\bqbcore\/([\w\.]+).+microm/i,/micromessenger\/([\w\.]+)/i],[g,[h,"WeChat"]],[/konqueror\/([\w\.]+)/i],[g,[h,"
32Konqueror"]],[/trident.+rv[: ]([\w\.]{1,9})\b.+like gecko/i],[g,[h,"IE"]],[/ya(?:search)?browser\/([\w\.]+)/i],[g,[h,"Yandex"]],[/slbrowser\/([\w\.]+)/i],[g,[h,"Smart Lenovo "+O]],[/(avast|avg)\/([\w\.]+)/i],[[h,/(.+)/,"$1 Secure "+O],g],[/\bfocus\/([\w\.]+)/i],[g,[h,C+" Focus"]],[/\bopt\/([\w\.]+)/i],[g,[h,N+" Touch"]],[/coc_coc\w+\/([\w\.]+)/i],[g,[h,"Coc Coc"]],[/dolfin\/([\w\.]+)/i],[g,[h,"Dolphin"]],[/coast\/([\w\.]+)/i],[g,[h,N+" Coast"]],[/miuibrowser\/([\w\.]+)/i],[g,[h,"MIUI"+G]],[/fxios\/([\w\.-]+)/i],[g,[h,C]],[/\bqihoobrowser\/?([\w\.]*)/i],[g,[h,"360"]],[/\b(qq)\/([\w\.]+)/i],[[h,/(.+)/,"$1Browser"],g],[/(oculus|sailfish|huawei|vivo|pico)browser\/([\w\.]+)/i],[[h,/(.+)/,"$1"+G],g],[/samsungbrowser\/([\w\.]+)/i],[g,[h,L+" Internet"]],[/metasr[\/ ]?([\d\.]+)/i],[g,[h,"Sogou Explorer"]],[/(sogou)mo\w+\/([\d\.]+)/i],[[h,"Sogou Mobile"],g],[/(electron)\/([\w\.]+) safari/i,/(tesla)(?: qtcarbrowser|\/(20\d\d\.[-\w\.]+))/i,/m?(qqbrowser|2345(?=browser|chrome|explorer))\w*[\/ ]?v?([\w\.]+)/i],[h,g],[/(lbbrowser|rekonq)/i,/\[(linkedin)app\]/i],[h],[/ome\/([\w\.]+) \w* ?(iron) saf/i,/ome\/([\w\.]+).+qihu (360)[es]e/i],[g,h],[/((?:fban\/fbios|fb_iab\/fb4a)(?!.+fbav)|;fbav\/([\w\.]+);)/i],[[h,W],g],[/(Klarna)\/([\w\.]+)/i,/(kakao(?:talk|story))[\/ ]([\w\.]+)/i,/(naver)\(.*?(\d+\.[\w\.]+).*\)/i,/(daum)apps[\/ ]([\w\.]+)/i,/safari (line)\/([\w\.]+)/i,/\b(line)\/([\w\.]+)\/iab/i,/(alipay)client\/([\w\.]+)/i,/(twitter)(?:and| f.+e\/([\w\.]+))/i,/(chromium|instagram|snapchat)[\/ ]([-\w\.]+)/i],[h,g],[/\bgsa\/([\w\.]+) .*safari\//i],[g,[h,"GSA"]],[/musical_ly(?:.+app_?version\/|_)([\w\.]+)/i],[g,[h,"TikTok"]],[/headlesschrome(?:\/([\w\.]+)| )/i],[g,[h,P+" Headless"]],[/ wv\).+(chrome)\/([\w\.]+)/i],[[h,P+" WebView"],g],[/droid.+ version\/([\w\.]+)\b.+(?:mobile safari|safari)/i],[g,[h,"Android "+O]],[/(chrome|omniweb|arora|[tizenoka]{5} ?browser)\/v?([\w\.]+)/i],[h,g],[/version\/([\w\.\,]+) .*mobile\/\w+ (safari)/i],[g,[h,"Mobile Safari"]],[/version\/([\w(\.|\,)]+) .*(mobile ?safari|safari)/i],[g,h],[/webkit.+?(mobile ?safari|safari)(\/[\w\.]+)/i],[h,[g,ee,{"1.0":"/8",1.2:"/1",1.3:"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],[h,g],[/(navigator|netscape\d?)\/([-\w\.]+)/i],[[h,"Netscape"],g],[/(wolvic|librewolf)\/([\w\.]+)/i],[h,g],[/mobile vr; rv:([\w\.]+)\).+firefox/i],[g,[h,C+" Reality"]],[/ekiohf.+(flow)\/([\w\.]+)/i,/(swiftfox)/i,/(icedragon|iceweasel|camino|chimera|fennec|maemo browser|minimo|conkeror)[\/ ]?([\w\.\+]+)/i,/(seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([-\w\.]+)$/i,/(firefox)\/([\w\.]+)/i,/(mozilla)\/([\w\.]+) .+rv\:.+gecko\/\d+/i,/(amaya|dillo|doris|icab|ladybird|lynx|mosaic|netsurf|obigo|polaris|w3m|(?:go|ice|up)[\. ]?browser)[-\/ ]?v?([\w\.]+)/i,/\b(links) \(([\w\.]+)/i],[h,[g,/_/g,"."]],[/(cobalt)\/([\w\.]+)/i],[h,[g,/master.|lts./,""]]],cpu:[[/\b((amd|x|x86[-_]?|wow|win)64)\b/i],[[y,"amd64"]],[/(ia32(?=;))/i,/\b((i[346]|x)86)(pc)?\b/i],[[y,"ia32"]],[/\b(aarch64|arm(v?[89]e?l?|_?64))\b/i],[[y,"arm64"]],[/\b(arm(v[67])?ht?n?[fl]p?)\b/i],[[y,"armhf"]],[/( (ce|mobile); ppc;|\/[\w\.]+arm\b)/i],[[y,"arm"]],[/((ppc|powerpc)(64)?)( mac|;|\))/i],[[y,/ower/,"",Y]],[/ sun4\w[;\)]/i],[[y,"sparc"]],[/\b(avr32|ia64(?=;)|68k(?=\))|\barm(?=v([1-7]|[5-7]1)l?|;|eabi)|(irix|mips|sparc)(64)?\b|pa-risc)/i],[[y,Y]]],device:[[/\b(sch-i[89]0\d|shw-m380s|sm-[ptx]\w{2,4}|gt-[pn]\d{2,4}|sgh-t8[56]9|nexus 10)/i],[f,[p,L],[d,w]],[/\b((?:s[cgp]h|gt|sm)-(?![lr])\w+|sc[g-]?[\d]+a?|galaxy nexus)/i,/samsung[- ]((?!sm-[lr])[-\w]+)/i,/sec-(sgh\w+)/i],[f,[p,L],[d,b]],[/(?:\/|\()(ip(?:hone|od)[\w, ]*)(?:\/|;)/i],[f,[p,A],[d,b]],[/\((ipad);[-\w\),; ]+apple/i,/applecoremedia\/[\w\.]+ \((ipad)/i,/\b(ipad)\d\d?,\d\d?[;\]].+ios/i],[f,[p,A],[d,w]],[/(macintosh);/i],[f,[p,A]],[/\b(sh-?[altvz]?\d\d[a-ekm]?)/i],[f,[p,$],[d,b]],[/\b((?:brt|eln|hey2?|gdi|jdn)-a?[lnw]09|(?:ag[rm]3?|jdn2|kob2)-a?[lw]0[09]hn)(?: bui|\)|;)/i],[f,[p,T],[d,w]],[/honor([-\w ]+)[;\)]/i],[f,[p,T],[d,b]],[/\b((?:ag[rs][2356]?k?|bah[234]?|bg[2o]|bt[kv]|cmr|cpn|db[ry]2?|jdn2|got|kob2?k?|mon|pce|scm|sht?|[tw]gr|vrd)-[ad]?[lw][0125][09]b?|605hw|bg2-u03|(?:gem|fdr|m2|ple|t1)-[7a]0[1-4][lu]|t1-a2[13][lw]|mediapad[\w\. ]*(?= bui|\)))\b(?!.+d\/s)/i],[f,[p,B],[d,w]],[/(?:huawei)([-\w ]+)[;\)]/i,/\b(nexus 6p|\w{2,4}e?-[atu]?[ln][\dx][012359c][adn]?)\b(?!.+d\/s)/i],[f,[p,B],[d,b]],[/oid[^\)]+; (2[\dbc]{4}(182|283|rp\w{2})[cgl]|m2105k81a?c)(?: bui|\))/i,/\b((?:red)?mi[-_ ]?pad[\w- ]*)(?: bui|\))/i],[[f,/_/g," "],[p,F],[d,w]],[/\b(poco[\w ]+|m2\d{3}j\d\d[a-z]{2})(?: bui|\))/i,/\b; (\w+) build\/hm\1/i,/\b(hm[-_ ]?note?[_ ]?(?:\d\w)?) bui/i,/\b(redmi[\-_ ]?(?:note|k)?[\w_ ]+)(?: bui|\))/i,/oid[^\)]+; (m?[12][0-389][01]\w{3,6}[c-y])( bui|; wv|\))/i,/\b(mi[-_ ]?(?:a\d|one|one[_ ]plus|note lte|max|cc)?[_ ]?(?:\d?\w?)[_ ]?(?:plus|se|lite|pro)?)(?: bui|\))/i,/ ([\w ]+) miui\/v?\d/i],[[f,/_/g," "],[p,F],[d,b]],[/; (\w+) bui.+ oppo/i,/\b(cph[12]\d{3}|p(?:af|c[al]|d\w|e[ar])[mt]\d0|x9007|a101op)\b/i],[f,[p,j],[d,b]],[/\b(opd2(\d{3}a?))(?: bui|\))/i],[f,[p,ee,{OnePlus:["304","403","203"],"*":j}],[d,w]],[/vivo (\w+)(?: bui|\))/i,/\b(v[12]\d{3}\w?[at])(?: bui|;)/i],[f,[p,"Vivo"],[d,b]],[/\b(rmx[1-3]\d{3})(?: bui|;|\))/i],[f,[p,"Realme"],[d,b]],[/\b(milestone|droid(?:[2-4x]| (?:bionic|x2|pro|razr))?:?( 4g)?)\b[\w ]+build\//i,/\bmot(?:orola)?[- ](\w*)/i,/((?:moto(?! 360)[\w\(\) ]+|xt\d{3,4}|nexus 6)(?= bui|\)))/i],[f,[p,D],[d,b]],[/\b(mz60\d|xoom[2 ]{0,2}) build\//i],[f,[p,D],[d,w]],[/((?=lg)?[vl]k\-?\d{3}) bui| 3\.[-\w; ]{10}lg?-([06cv9]{3,4})/i],[f,[p,"LG"],[d,w]],[/(lm(?:-?f100[nv]?|-[\w\.]+)(?= bui|\))|nexus [45])/i,/\blg[-e;\/ ]+((?!browser|netcast|android tv|watch)\w+)/i,/\blg-?([\d\w]+) bui/i],[f,[p,"LG"],[d,b]],[/(ideatab[-\w ]+|602lv|d-42a|a101lv|a2109a|a3500-hv|s[56]000|pb-6505[my]|tb-?x?\d{3,4}
vendor: 5,513 bytes, line 32
32(?:f[cu]|xu|[av])|yt\d?-[jx]?\d+[lfmx])( bui|;|\)|\/)/i,/lenovo ?(b[68]0[08]0-?[hf]?|tab(?:[\w- ]+?)|tb[\w-]{6,7})( bui|;|\)|\/)/i],[f,[p,"Lenovo"],[d,w]],[/(nokia) (t[12][01])/i],[p,f,[d,w]],[/(?:maemo|nokia).*(n900|lumia \d+|rm-\d+)/i,/nokia[-_ ]?(([-\w\. ]*))/i],[[f,/_/g," "],[d,b],[p,"Nokia"]],[/(pixel (c|tablet))\b/i],[f,[p,k],[d,w]],[/droid.+; (pixel[\daxl ]{0,6})(?: bui|\))/i],[f,[p,k],[d,b]],[/droid.+; (a?\d[0-2]{2}so|[c-g]\d{4}|so[-gl]\w+|xq-a\w[4-7][12])(?= bui|\).+chrome\/(?![1-6]{0,1}\d\.))/i],[f,[p,z],[d,b]],[/sony tablet [ps]/i,/\b(?:sony)?sgp\w+(?: bui|\))/i],[[f,"Xperia Tablet"],[p,z],[d,w]],[/ (kb2005|in20[12]5|be20[12][59])\b/i,/(?:one)?(?:plus)? (a\d0\d\d)(?: b|\))/i],[f,[p,M],[d,b]],[/(alexa)webm/i,/(kf[a-z]{2}wi|aeo(?!bc)\w\w)( bui|\))/i,/(kf[a-z]+)( bui|\)).+silk\//i],[f,[p,_],[d,w]],[/((?:sd|kf)[0349hijorstuw]+)( bui|\)).+silk\//i],[[f,/(.+)/g,"Fire Phone $1"],[p,_],[d,b]],[/(playbook);[-\w\),; ]+(rim)/i],[f,p,[d,w]],[/\b((?:bb[a-f]|st[hv])100-\d)/i,/\(bb10; (\w+)/i],[f,[p,I],[d,b]],[/(?:\b|asus_)(transfo[prime ]{4,10} \w+|eeepc|slider \w+|nexus 7|padfone|p00[cj])/i],[f,[p,S],[d,w]],[/ (z[bes]6[027][012][km][ls]|zenfone \d\w?)\b/i],[f,[p,S],[d,b]],[/(nexus 9)/i],[f,[p,"HTC"],[d,w]],[/(htc)[-;_ ]{1,2}([\w ]+(?=\)| bui)|\w+)/i,/(zte)[- ]([\w ]+?)(?: bui|\/|\))/i,/(alcatel|geeksphone|nexian|panasonic(?!(?:;|\.))|sony(?!-bra))[-_ ]?([-\w]*)/i],[p,[f,/_/g," "],[d,b]],[/droid [\w\.]+; ((?:8[14]9[16]|9(?:0(?:48|60|8[01])|1(?:3[27]|66)|2(?:6[69]|9[56])|466))[gqswx])\w*(\)| bui)/i],[f,[p,"TCL"],[d,w]],[/(itel) ((\w+))/i],[[p,Y],f,[d,ee,{tablet:["p10001l","w7001"],"*":"mobile"}]],[/droid.+; ([ab][1-7]-?[0178a]\d\d?)/i],[f,[p,"Acer"],[d,w]],[/droid.+; (m[1-5] note) bui/i,/\bmz-([-\w]{2,})/i],[f,[p,"Meizu"],[d,b]],[/; ((?:power )?armor(?:[\w ]{0,8}))(?: bui|\))/i],[f,[p,"Ulefone"],[d,b]],[/; (energy ?\w+)(?: bui|\))/i,/; energizer ([\w ]+)(?: bui|\))/i],[f,[p,"Energizer"],[d,b]],[/; cat (b35);/i,/; (b15q?|s22 flip|s48c|s62 pro)(?: bui|\))/i],[f,[p,"Cat"],[d,b]],[/((?:new )?andromax[\w- ]+)(?: bui|\))/i],[f,[p,"Smartfren"],[d,b]],[/droid.+; (a(?:015|06[35]|142p?))/i],[f,[p,"Nothing"],[d,b]],[/; (x67 5g|tikeasy \w+|ac[1789]\d\w+)( b|\))/i,/archos ?(5|gamepad2?|([\w ]*[t1789]|hello) ?\d+[\w ]*)( b|\))/i],[f,[p,"Archos"],[d,w]],[/archos ([\w ]+)( b|\))/i,/; (ac[3-6]\d\w{2,8})( b|\))/i],[f,[p,"Archos"],[d,b]],[/(imo) (tab \w+)/i,/(infinix) (x1101b?)/i],[p,f,[d,w]],[/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus(?! zenw)|dell|jolla|meizu|motorola|polytron|infinix|tecno|micromax|advan)[-_ ]?([-\w]*)/i,/; (hmd|imo) ([\w ]+?)(?: bui|\))/i,/(hp) ([\w ]+\w)/i,/(microsoft); (lumia[\w ]+)/i,/(lenovo)[-_ ]?([-\w ]+?)(?: bui|\)|\/)/i,/(oppo) ?([\w ]+) bui/i],[p,f,[d,b]],[/(kobo)\s(ereader|touch)/i,/(hp).+(touchpad(?!.+tablet)|tablet)/i,/(kindle)\/([\w\.]+)/i,/(nook)[\w ]+build\/(\w+)/i,/(dell) (strea[kpr\d ]*[\dko])/i,/(le[- ]+pan)[- ]+(\w{1,9}) bui/i,/(trinity)[- ]*(t\d{3}) bui/i,/(gigaset)[- ]+(q\w{1,9}) bui/i,/(vodafone) ([\w ]+)(?:\)| bui)/i],[p,f,[d,w]],[/(surface duo)/i],[f,[p,R],[d,w]],[/droid [\d\.]+; (fp\du?)(?: b|\))/i],[f,[p,"Fairphone"],[d,b]],[/(u304aa)/i],[f,[p,"AT&T"],[d,b]],[/\bsie-(\w*)/i],[f,[p,"Siemens"],[d,b]],[/\b(rct\w+) b/i],[f,[p,"RCA"],[d,w]],[/\b(venue[\d ]{2,7}) b/i],[f,[p,"Dell"],[d,w]],[/\b(q(?:mv|ta)\w+) b/i],[f,[p,"Verizon"],[d,w]],[/\b(?:barnes[& ]+noble |bn[rt])([\w\+ ]*) b/i],[f,[p,"Barnes & Noble"],[d,w]],[/\b(tm\d{3}\w+) b/i],[f,[p,"NuVision"],[d,w]],[/\b(k88) b/i],[f,[p,"ZTE"],[d,w]],[/\b(nx\d{3}j) b/i],[f,[p,"ZTE"],[d,b]],[/\b(gen\d{3}) b.+49h/i],[f,[p,"Swiss"],[d,b]],[/\b(zur\d{3}) b/i],[f,[p,"Swiss"],[d,w]],[/\b((zeki)?tb.*\b) b/i],[f,[p,"Zeki"],[d,w]],[/\b([yr]\d{2}) b/i,/\b(dragon[- ]+touch |dt)(\w{5}) b/i],[[p,"Dragon Touch"],f,[d,w]],[/\b(ns-?\w{0,9}) b/i],[f,[p,"Insignia"],[d,w]],[/\b((nxa|next)-?\w{0,9}) b/i],[f,[p,"NextBook"],[d,w]],[/\b(xtreme\_)?(v(1[045]|2[015]|[3469]0|7[05])) b/i],[[p,"Voice"],f,[d,b]],[/\b(lvtel\-)?(v1[12]) b/i],[[p,"LvTel"],f,[d,b]],[/\b(ph-1) /i],[f,[p,"Essential"],[d,b]],[/\b(v(100md|700na|7011|917g).*\b) b/i],[f,[p,"Envizen"],[d,w]],[/\b(trio[-\w\. ]+) b/i],[f,[p,"MachSpeed"],[d,w]],[/\btu_(1491) b/i],[f,[p,"Rotor"],[d,w]],[/((?:tegranote|shield t(?!.+d tv))[\w- ]*?)(?: b|\))/i],[f,[p,U],[d,w]],[/(sprint) (\w+)/i],[p,f,[d,b]],[/(kin\.[onetw]{3})/i],[[f,/\./g," "],[p,R],[d,b]],[/droid.+; (cc6666?|et5[16]|mc[239][23]x?|vc8[03]x?)\)/i],[f,[p,q],[d,w]],[/droid.+; (ec30|ps20|tc[2-8]\d[kx])\)/i],[f,[p,q],[d,b]],[/smart-tv.+(samsung)/i],[p,[d,v]],[/hbbtv.+maple;(\d+)/i],[[f,/^/,"SmartTV"],[p,L],[d,v]],[/(nux; netcast.+smarttv|lg (netcast\.tv-201\d|android tv))/i],[[p,"LG"],[d,v]],[/(apple) ?tv/i],[p,[f,A+" TV"],[d,v]],[/crkey/i],[[f,P+"cast"],[p,k],[d,v]],[/droid.+aft(\w+)( bui|\))/i],[f,[p,_],[d,v]],[/(shield \w+ tv)/i],[f,[p,U],[d,v]],[/\(dtv[\);].+(aquos)/i,/(aquos-tv[\w ]+)\)/i],[f,[p,$],[d,v]],[/(bravia[\w ]+)( bui|\))/i],[f,[p,z],[d,v]],[/(mi(tv|box)-?\w+) bui/i],[f,[p,F],[d,v]],[/Hbbtv.*(technisat) (.*);/i],[p,f,[d,v]],[/\b(roku)[\dx]*[\)\/]((?:dvp-)?[\d\.]*)/i,/hbbtv\/\d+\.\d+\.\d+ +\([\w\+ ]*; *([\w\d][^;]*);([^;]*)/i],[[p,X],[f,X],[d,v]],[/droid.+; ([\w- ]+) (?:android tv|smart[- ]?tv)/i],[f,[d,v]],[/\b(android tv|smart[- ]?tv|opera tv|tv; rv:)\b/i],[[d,v]],[/(ouya)/i,/(nintendo) ([wids3utch]+)/i],[p,f,[d,m]],[/droid.+; (shield)( bui|\))/i],[f,[p,U],[d,m]],[/(playstation \w+)/i],[f,[p,z],[d,m]],[/\b(xbox(?: one)?(?!; xbox))[\); ]/i],[f,[p,R],[d,m]],[/\b(sm-[lr]\d\d[0156][fnuw]?s?|gear live)\b/i],[f,[p,L],[d,E]],[/((pebble))app/i,/(asu
32s|google|lg|oppo) ((pixel |zen)?watch[\w ]*)( bui|\))/i],[p,f,[d,E]],[/(ow(?:19|20)?we?[1-3]{1,3})/i],[f,[p,j],[d,E]],[/(watch)(?: ?os[,\/]|\d,\d\/)[\d\.]+/i],[f,[p,A],[d,E]],[/(opwwe\d{3})/i],[f,[p,M],[d,E]],[/(moto 360)/i],[f,[p,D],[d,E]],[/(smartwatch 3)/i],[f,[p,z],[d,E]],[/(g watch r)/i],[f,[p,"LG"],[d,E]],[/droid.+; (wt63?0{2,3})\)/i],[f,[p,q],[d,E]],[/droid.+; (glass) \d/i],[f,[p,k],[d,E]],[/(pico) (4|neo3(?: link|pro)?)/i],[p,f,[d,E]],[/; (quest( \d| pro)?)/i],[f,[p,W],[d,E]],[/(tesla)(?: qtcarbrowser|\/[-\w\.]+)/i],[p,[d,x]],[/(aeobc)\b/i],[f,[p,_],[d,x]],[/(homepod).+mac os/i],[f,[p,A],[d,x]],[/windows iot/i],[[d,x]],[/droid .+?; ([^;]+?)(?: bui|; wv\)|\) applew).+? mobile safari/i],[f,[d,b]],[/droid .+?; ([^;]+?)(?: bui|\) applew).+?(?! mobile) safari/i],[f,[d,w]],[/\b((tablet|tab)[;\/]|focus\/\d(?!.+mobile))/i],[[d,w]],[/(phone|mobile(?:[;\/]| [ \w\/\.]*safari)|pda(?=.+windows ce))/i],[[d,b]],[/droid .+?; ([\w\. -]+)( bui|\))/i],[f,[p,"Generic"]]],engine:[[/windows.+ edge\/([\w\.]+)/i],[g,[h,"EdgeHTML"]],[/(arkweb)\/([\w\.]+)/i],[h,g],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],[g,[h,"Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna|servo)\/([\w\.]+)/i,/ekioh(flow)\/([\w\.]+)/i,/(khtml|tasman|links)[\/ ]\(?([\w\.]+)/i,/(icab)[\/ ]([23]\.[\d\.]+)/i,/\b(libweb)/i],[h,g],[/ladybird\//i],[[h,"LibWeb"]],[/rv\:([\w\.]{1,9})\b.+(gecko)/i],[g,h]],os:[[/microsoft (windows) (vista|xp)/i],[h,g],[/(windows (?:phone(?: os)?|mobile|iot))[\/ ]?([\d\.\w ]*)/i],[h,[g,ee,et]],[/windows nt 6\.2; (arm)/i,/windows[\/ ]([ntce\d\. ]+\w)(?!.+xbox)/i,/(?:win(?=3|9|n)|win 9x )([nt\d\.]+)/i],[[g,ee,et],[h,"Windows"]],[/[adehimnop]{4,7}\b(?:.*os ([\w]+) like mac|; opera)/i,/(?:ios;fbsv\/|iphone.+ios[\/ ])([\d\.]+)/i,/cfnetwork\/.+darwin/i],[[g,/_/g,"."],[h,"iOS"]],[/(mac os x) ?([\w\. ]*)/i,/(macintosh|mac_powerpc\b)(?!.+haiku)/i],[[h,H],[g,/_/g,"."]],[/droid ([\w\.]+)\b.+(android[- ]x86|harmonyos)/i],[g,h],[/(ubuntu) ([\w\.]+) like android/i],[[h,/(.+)/,"$1 Touch"],g],[/(android|bada|blackberry|kaios|maemo|meego|openharmony|qnx|rim tablet os|sailfish|series40|symbian|tizen|webos)\w*[-\/; ]?([\d\.]*)/i],[h,g],[/\(bb(10);/i],[g,[h,I]],[/(?:symbian ?os|symbos|s60(?=;)|series ?60)[-\/ ]?([\w\.]*)/i],[g,[h,"Symbian"]],[/mozilla\/[\d\.]+ \((?:mobile|tablet|tv|mobile; [\w ]+); rv:.+ gecko\/([\w\.]+)/i],[g,[h,C+" OS"]],[/web0s;.+rt(tv)/i,/\b(?:hp)?wos(?:browser)?\/([\w\.]+)/i],[g,[h,"webOS"]],[/watch(?: ?os[,\/]|\d,\d\/)([\d\.]+)/i],[g,[h,"watchOS"]],[/crkey\/([\d\.]+)/i],[g,[h,P+"cast"]],[/(cros) [\w]+(?:\)| ([\w\.]+)\b)/i],[[h,V],g],[/panasonic;(viera)/i,/(netrange)mmh/i,/(nettv)\/(\d+\.[\w\.]+)/i,/(nintendo|playstation) ([wids345portablevuch]+)/i,/(xbox); +xbox ([^\);]+)/i,/\b(joli|palm)\b ?(?:os)?\/?([\w\.]*)/i,/(mint)[\/\(\) ]?(\w*)/i,/(mageia|vectorlinux)[; ]/i,/([kxln]?ubuntu|debian|suse|opensuse|gentoo|arch(?= linux)|slackware|fedora|mandriva|centos|pclinuxos|red ?hat|zenwalk|linpus|raspbian|plan 9|minix|risc os|contiki|deepin|manjaro|elementary os|sabayon|linspire)(?: gnu\/linux)?(?: enterprise)?(?:[- ]linux)?(?:-gnu)?[-\/ ]?(?!chrom|package)([-\w\.]*)/i,/(hurd|linux)(?: arm\w*| x86\w*| ?)([\w\.]*)/i,/(gnu) ?([\w\.]*)/i,/\b([-frentopcghs]{0,5}bsd|dragonfly)[\/ ]?(?!amd|[ix346]{1,2}86)([\w\.]*)/i,/(haiku) (\w+)/i],[h,g],[/(sunos) ?([\w\.\d]*)/i],[[h,"Solaris"],g],[/((?:open)?solaris)[-\/ ]?([\w\.]*)/i,/(aix) ((\d)(?=\.|\)| )[\w\.])*/i,/\b(beos|os\/2|amigaos|morphos|openvms|fuchsia|hp-ux|serenityos)/i,/(unix) ?([\w\.]*)/i],[h,g]]},en=function(e,t){if(typeof e===l&&(t=e,e=s),!(this instanceof en))return new en(e,t).getResult();var r=typeof i!==a&&i.navigator?i.navigator:s,n=e||(r&&r.userAgent?r.userAgent:""),m=r&&r.userAgentData?r.userAgentData:s,v=t?K(er,t):er,E=r&&r.userAgent==n;return this.getBrowser=function(){var e,t={};return t[h]=s,t[g]=s,Q.call(t,n,v.browser),t[u]=typeof(e=t[g])===c?e.replace(/[^\d\.]/g,"").split(".")[0]:s,E&&r&&r.brave&&typeof r.brave.isBrave==o&&(t[h]="Brave"),t},this.getCPU=function(){var e={};return e[y]=s,Q.call(e,n,v.cpu),e},this.getDevice=function(){var e={};return e[p]=s,e[f]=s,e[d]=s,Q.call(e,n,v.device),E&&!e[d]&&m&&m.mobile&&(e[d]=b),E&&"Macintosh"==e[f]&&r&&typeof r.standalone!==a&&r.maxTouchPoints&&r.maxTouchPoints>2&&(e[f]="iPad",e[d]=w),e},this.getEngine=function(){var e={};return e[h]=s,e[g]=s,Q.call(e,n,v.engine),e},this.getOS=function(){var e={};return e[h]=s,e[g]=s,Q.call(e,n,v.os),E&&!e[h]&&m&&m.platform&&"Unknown"!=m.platform&&(e[h]=m.platform.replace(/chrome os/i,V).replace(/macos/i,H)),e},this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}},this.getUA=function(){return n},this.setUA=function(e){return n=typeof e===c&&e.length>500?X(e,500):e,this},this.setUA(n),this};en.VERSION="1.0.41",en.BROWSER=Z([h,g,u]),en.CPU=Z([y]),en.DEVICE=Z([f,p,d,m,b,v,w,E,x]),en.ENGINE=en.OS=Z([h,g]),typeof t!==a?(e.exports&&(t=e.exports=en),t.UAParser=en):r.amdO?s!==(n=(function(){return en}).call(t,r,t,e))&&(e.exports=n):typeof i!==a&&(i.UAParser=en);var ei=typeof i!==a&&(i.jQuery||i.Zepto);if(ei&&!ei.ua){var es=new en;ei.ua=es.getResult(),ei.ua.get=function(){return es.getUA()},ei.ua.set=function(e){es.setUA(e);var t=es.getResult();for(var r in t)ei.ua[r]=t[r]}}}("object"==typeof window?window:this)},46246:function(e,t,r){"use strict";/** 33 * @license React 34 * use-sync-external-store-shim.production.js 35 * 36 * Copyright (c) Meta Platforms, Inc. and affiliates. 37 * 38 * This source code is licensed under the MIT license found in the 39 * LICENSE file in the root directory of this source tree. 40 */var n=r(2265),i="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},s=n.useState,o=n.useEffect,a=n.useLayoutEffect,l=n.useDebugValue;function c(e){var t=e.getSnapshot;e=e.value;try{var r=t();return!i(e,r)}catch(e){return!0}}var u="undefined"==typeof window||void 0===window.document||void 0===window.document.createElement?function(e,t){return t()}:function(e,t){var r=t(),n=s({inst:{value:r,getSnapshot:t}}),i=n[0].inst,u=n[1];return a(function(){i.value=r,i.getSnapshot=t,c(i)&&u({inst:i})},[e,r,t]),o(function(){return c(i)&&u({inst:i}),e(function(){c(i)&&u({inst:i})})},[e]),l(r),r};t.useSyncExternalStore=void 0!==n.useSyncExternalStore?n.useSyncExternalStore:u},94453:function(e,t,r){"use strict";/** 41 * @license React 42 * use-sync-external-store-shim/with-selector.production.js 43 * 44 * Copyright (c) Meta Platforms, Inc. and affiliates. 45 * 46 * This source code is licensed under the MIT license found in the 47 * LICENSE file in the root directory of this source tree. 48 */var n=r(2265),i=r(10554),s="function"==typeof Object.is?Object.is:function(e,t){return e===t&&(0!==e||1/e==1/t)||e!=e&&t!=t},o=i.useSyncExternalStore,a=n.useRef,l=n.useEffect,c=n.useMemo,u=n.useDebugValue;t.useSyncExternalStoreWithSelector=function(e,t,r,n,i){var f=a(null);if(null===f.current){var h={hasValue:!1,value:null};f.current=h}else h=f.current;var d=o(e,(f=c(function(){function e(e){if(!l){if(l=!0,o=e,e=n(e),void 0!==i&&h.hasValue){var t=h.value;if(i(t,e))return a=t}return a=e}if(t=a,s(o,e))return t;var r=n(e);return void 0!==i&&i(t,r)?(o=e,t):(o=e,a=r)}var o,a,l=!1,c=void 0===r?null:r;return[function(){return e(t())},null===c?void 0:function(){return e(c())}]},[t,r,n,i]))[0],f[1]);return l(function(){h.hasValue=!0,h.value=d},[d]),u(d),d}},10554:function(e,t,r){"use strict";e.exports=r(46246)},35006:function(e,t,r){"use strict";e.exports=r(94453)},3538:function(e,t,r){"use strict";r.d(t,{v4:function(){return c}});for(var n,i=new Uint8Array(16),s=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,o=[],a=0;a<256;++a)o.push((a+256).toString(16).substr(1));var l=function(e){var t=arguments.length>
481&&void 0!==arguments[1]?arguments[1]:0,r=(o[e[t+0]]+o[e[t+1]]+o[e[t+2]]+o[e[t+3]]+"-"+o[e[t+4]]+o[e[t+5]]+"-"+o[e[t+6]]+o[e[t+7]]+"-"+o[e[t+8]]+o[e[t+9]]+"-"+o[e[t+10]]+o[e[t+11]]+o[e[t+12]]+o[e[t+13]]+o[e[t+14]]+o[e[t+15]]).toLowerCase();if(!("string"==typeof r&&s.test(r)))throw TypeError("Stringified UUID is invalid");return r},c=function(e,t,r){var s=(e=e||{}).random||(e.rng||function(){if(!n&&!(n="undefined"!=typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!=typeof msCrypto&&"function"==typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto)))throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return n(i)})();if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,t){r=r||0;for(var o=0;o<16;++o)t[r+o]=s[o];return t}return l(s)}},72625:function(e,t,r){"use strict";let n=r(57963);e.exports=u;let i=function(){function e(e){return void 0!==e&&e}try{if("undefined"!=typeof globalThis)return globalThis;return Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch(t){return e(self)||e(window)||e(this)||{}}}().console||{};function s(e,t){return"silent"===e?1/0:t.levels.values[e]}let o=Symbol("pino.logFuncs"),a=Symbol("pino.hierarchy"),l={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function c(e,t){let r={logger:t,parent:e[a]};t[a]=r}function u(e){var t,r;(e=e||{}).browser=e.browser||{};let n=e.browser.transmit;if(n&&"function"!=typeof n.send)throw Error("pino: transmit option must have a send function");let a=e.browser.write||i;e.browser.write&&(e.browser.asObject=!0);let p=e.serializers||{},g=Array.isArray(t=e.browser.serialize)?t.filter(function(e){return"!stdSerializers.err"!==e}):!0===t&&Object.keys(p),y=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(y=!1);let v=Object.keys(e.customLevels||{}),E=["error","fatal","warn","info","debug","trace"].concat(v);"function"==typeof a&&E.forEach(function(e){a[e]=a}),(!1===e.enabled||e.browser.disabled)&&(e.level="silent");let x=e.level||"info",_=Object.create(a);_.log||(_.log=m),function(e,t,r){let n={};t.forEach(e=>{n[e]=r[e]?r[e]:i[e]||i[l[e]||"log"]||m}),e[o]=n}(_,E,a),c({},_),Object.defineProperty(_,"levelVal",{get:function(){return s(this.level,this)}}),Object.defineProperty(_,"level",{get:function(){return this._level},set:function(e){if("silent"!==e&&!this.levels.values[e])throw Error("unknown level "+e);this._level=e,f(this,A,_,"error"),f(this,A,_,"fatal"),f(this,A,_,"warn"),f(this,A,_,"info"),f(this,A,_,"debug"),f(this,A,_,"trace"),v.forEach(e=>{f(this,A,_,e)})}});let A={transmit:n,serialize:g,asObject:e.browser.asObject,asObjectBindingsOnly:e.browser.asObjectBindingsOnly,formatters:e.browser.formatters,levels:E,timestamp:"function"==typeof(r=e).timestamp?r.timestamp:!1===r.timestamp?b:w,messageKey:e.messageKey||"msg",onChild:e.onChild||m};function S(t,r,i){if(!r)throw Error("missing bindings for child Pino");i=i||{},g&&r.serializers&&(i.serializers=r.serializers);let s=i.serializers;if(g&&s){var o=Object.assign({},p,s),a=!0===e.browser.serialize?Object.keys(o):g;delete r.serializers,h([r],a,o,this._stdErrSerialize)}function l(e){this._childLevel=(0|e._childLevel)+1,this.bindings=r,o&&(this.serializers=o,this._serialize=a),n&&(this._logEvent=d([].concat(e._logEvent.bindings,r)))}l.prototype=this;let u=new l(this);return c(this,u),u.child=function(...e){return S.call(this,t,...e)},u.level=i.level||this.level,t.onChild(u),u}return _.levels=function(e){let t=e.customLevels||{};return{values:Object.assign({},u.levels.values,t),labels:Object.assign({},u.levels.labels,function(e){let t={};return Object.keys(e).forEach(function(r){t[e[r]]=r}),t}(t))}}(e),_.level=x,_.isLevelEnabled=function(e){return!!this.levels.values[e]&&this.levels.values[e]>=this.levels.values[this.level]},_.setMaxListeners=_.getMaxListeners=_.emit=_.addListener=_.on=_.prependListener=_.once=_.prependOnceListener=_.removeListener=_.removeAllListeners=_.listeners=_.listenerCount=_.eventNames=_.write=_.flush=m,_.serializers=p,_._serialize=g,_._stdErrSerialize=y,_.child=function(...e){return S.call(this,A,...e)},n&&(_._logEvent=d()),_}function f(e,t,r,l){var c,u;if(Object.defineProperty(e,l,{value:s(e.level,r)>s(l,r)?m:r[o][l],writable:!0,enumerable:!0,configurable:!0}),e[l]===m){if(!t.transmit)return;let n=s(t.transmit.level||e.level,r);if(s(l,r)<n)return}e[l]=(c=e[o][l],function(){let o=t.timestamp(),a=Array(arguments.length),u=Object.getPrototypeOf&&Object.getPrototypeOf(this)===i?i:this;for(var f=0;f<a.length;f++)a[f]=arguments[f];var p=!1;if(t.serialize&&(h(a,this._serialize,this.serializers,this._stdErrSerialize),p=!0),t.asObject||t.formatters?c.call(u,...function(e,t,r,i,s){let{level:o,log:a=e=>e}=s.formatters||{},l=r.slice(),c=l[0],u={},f=(0|e._childLevel)+1;if(f<1&&(f=1),i&&(u.time=i),o?Object.assign(u,o(t,e.levels.values[t])):u.level=e.levels.values[t],s.asObjectBindingsOnly){if(null!==c&&"object"==typeof c)for(;f--&&"object"==typeof l[0];)Object.assign(u,l.shift());return[a(u),...l]}if(null!==c&&"object"==typeof c){for(;f--&&"object"==typeof l[0];)Object.assign(u,l.shift());c=l.length?n(l.shift(),l):void 0}else"string"==typeof c&&(c=n(l.shift(),l));return void 0!==c&&(u[s.messageKey]=c),[a(u)]}(this,l,a,o,t)):c.apply(u,a),t.transmit){let n=t.transmit.level||e._level,i=s(n,r),c=s(l,r);if(c<i)return;(function(e,t,r,n=!1){let i=t.send,s=t.ts,o=t.methodLevel,a=t.methodValue,l=t.val,c=e._logEvent.bindings;
48n||h(r,e._serialize||Object.keys(e.serializers),e.serializers,void 0===e._stdErrSerialize||e._stdErrSerialize),e._logEvent.ts=s,e._logEvent.messages=r.filter(function(e){return -1===c.indexOf(e)}),e._logEvent.level.label=o,e._logEvent.level.value=a,i(o,e._logEvent,l),e._logEvent=d(c)})(this,{ts:o,methodLevel:l,methodValue:c,transmitLevel:n,transmitValue:r.levels.values[t.transmit.level||e._level],send:t.transmit.send,val:s(e._level,r)},a,p)}});let f=function(e){let t=[];e.bindings&&t.push(e.bindings);let r=e[a];for(;r.parent;)(r=r.parent).logger.bindings&&t.push(r.logger.bindings);return t.reverse()}(e);0!==f.length&&(e[l]=(u=e[l],function(){return u.apply(this,[...f,...arguments])}))}function h(e,t,r,n){for(let i in e)if(n&&e[i]instanceof Error)e[i]=u.stdSerializers.err(e[i]);else if("object"==typeof e[i]&&!Array.isArray(e[i])&&t)for(let n in e[i])t.indexOf(n)>-1&&n in r&&(e[i][n]=r[n](e[i][n]))}function d(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function p(e){let t={type:e.constructor.name,msg:e.message,stack:e.stack};for(let r in e)void 0===t[r]&&(t[r]=e[r]);return t}function g(){return{}}function y(e){return e}function m(){}function b(){return!1}function w(){return Date.now()}u.levels={values:{fatal:60,error:50,warn:40,info:30,debug:20,trace:10},labels:{10:"trace",20:"debug",30:"info",40:"warn",50:"error",60:"fatal"}},u.stdSerializers={mapHttpRequest:g,mapHttpResponse:g,wrapRequestSerializer:y,wrapResponseSerializer:y,wrapErrorSerializer:y,req:g,res:g,err:p,errWithCause:p},u.stdTimeFunctions=Object.assign({},{nullTime:b,epochTime:w,unixTime:function(){return Math.round(Date.now()/1e3)},isoTime:function(){return new Date(Date.now()).toISOString()}}),e.exports.default=u,e.exports.pino=u},38306:function(e,t,r){"use strict";r.d(t,{_:function(){return n}});class n extends Error{constructor(e){super(e),Object.setPrototypeOf(this,Object.create(n.prototype)),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:n.name})}}},72283:function(e,t,r){"use strict";r.d(t,{n:function(){return a}});class n{constructor(e,t){this.type=e,this.data=t}}var i=r(38306),s=r(16321);let o={type:-1,encode:function(e){return e instanceof Date?function({sec:e,nsec:t}){if(e>=0&&t>=0&&e<=17179869183){if(0===t&&e<=4294967295){let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e),t}{let r=e/4294967296,n=new Uint8Array(8),i=new DataView(n.buffer);return i.setUint32(0,t<<2|3&r),i.setUint32(4,4294967295&e),n}}{let r=new Uint8Array(12),n=new DataView(r.buffer);return n.setUint32(0,t),(0,s.zT)(n,4,e),r}}(function(e){let t=e.getTime(),r=Math.floor(t/1e3),n=(t-1e3*r)*1e6,i=Math.floor(n/1e9);return{sec:r+i,nsec:n-1e9*i}}(e)):null},decode:function(e){let t=function(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength);switch(e.byteLength){case 4:return{sec:t.getUint32(0),nsec:0};case 8:{let e=t.getUint32(0);return{sec:(3&e)*4294967296+t.getUint32(4),nsec:e>>>2}}case 12:return{sec:(0,s.eu)(t,4),nsec:t.getUint32(0)};default:throw new i._(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${e.length}`)}}(e);return new Date(1e3*t.sec+t.nsec/1e6)}};class a{constructor(){this.builtInEncoders=[],this.builtInDecoders=[],this.encoders=[],this.decoders=[],this.register(o)}register({type:e,encode:t,decode:r}){if(e>=0)this.encoders[e]=t,this.decoders[e]=r;else{let n=-1-e;this.builtInEncoders[n]=t,this.builtInDecoders[n]=r}}tryToEncode(e,t){for(let r=0;r<this.builtInEncoders.length;r++){let i=this.builtInEncoders[r];if(null!=i){let s=i(e,t);if(null!=s)return new n(-1-r,s)}}for(let r=0;r<this.encoders.length;r++){let i=this.encoders[r];if(null!=i){let s=i(e,t);if(null!=s)return new n(r,s)}}return e instanceof n?e:null}decode(e,t,r){let i=t<0?this.builtInDecoders[-1-t]:this.decoders[t];return i?i(e,t,r):new n(t,e)}}a.defaultCodec=new a},58980:function(e,t,r){"use strict";function n(e){return`${e<0?"-":""}0x${Math.abs(e).toString(16).padStart(2,"0")}`}r.d(t,{J:function(){return v}});var i=r(72283),s=r(16321),o=r(85762),a=r(81591);class l{constructor(e=16,t=16){this.hit=0,this.miss=0,this.maxKeyLength=e,this.maxLengthPerKey=t,this.caches=[];for(let e=0;e<this.maxKeyLength;e++)this.caches.push([])}canBeCached(e){return e>0&&e<=this.maxKeyLength}find(e,t,r){let n=this.caches[r-1];e:for(let i of n){let n=i.bytes;for(let i=0;i<r;i++)if(n[i]!==e[t+i])continue e;return i.str}return null}store(e,t){let r=this.caches[e.length-1],n={bytes:e,str:t};r.length>=this.maxLengthPerKey?r[Math.random()*r.length|0]=n:r.push(n)}decode(e,t,r){let n=this.find(e,t,r);if(null!=n)return this.hit++,n;this.miss++;let i=(0,o.zV)(e,t,r),s=Uint8Array.prototype.slice.call(e,t,t+r);return this.store(s,i),i}}var c=r(38306);
48let u="array",f="map_key",h="map_value",d=e=>{if("string"==typeof e||"number"==typeof e)return e;throw new c._("The type of key must be string or number but "+typeof e)};class p{constructor(){this.stack=[],this.stackHeadPosition=-1}get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(e){let t=this.getUninitializedStateFromPool();t.type=u,t.position=0,t.size=e,t.array=Array(e)}pushMapState(e){let t=this.getUninitializedStateFromPool();t.type=f,t.readCount=0,t.size=e,t.map={}}getUninitializedStateFromPool(){return this.stackHeadPosition++,this.stackHeadPosition===this.stack.length&&this.stack.push({type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null}),this.stack[this.stackHeadPosition]}release(e){if(this.stack[this.stackHeadPosition]!==e)throw Error("Invalid stack state. Released state is not on top of the stack.");e.type===u&&(e.size=0,e.array=void 0,e.position=0,e.type=void 0),(e.type===f||e.type===h)&&(e.size=0,e.map=void 0,e.readCount=0,e.type=void 0),this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}}let g=new DataView(new ArrayBuffer(0)),y=new Uint8Array(g.buffer);try{g.getInt8(0)}catch(e){if(!(e instanceof RangeError))throw Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}let m=RangeError("Insufficient data"),b=new l;class w{constructor(e){this.totalPos=0,this.pos=0,this.view=g,this.bytes=y,this.headByte=-1,this.stack=new p,this.entered=!1,this.extensionCodec=e?.extensionCodec??i.n.defaultCodec,this.context=e?.context,this.useBigInt64=e?.useBigInt64??!1,this.rawStrings=e?.rawStrings??!1,this.maxStrLength=e?.maxStrLength??s.x5,this.maxBinLength=e?.maxBinLength??s.x5,this.maxArrayLength=e?.maxArrayLength??s.x5,this.maxMapLength=e?.maxMapLength??s.x5,this.maxExtLength=e?.maxExtLength??s.x5,this.keyDecoder=e?.keyDecoder!==void 0?e.keyDecoder:b,this.mapKeyConverter=e?.mapKeyConverter??d}clone(){return new w({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=-1,this.stack.reset()}setBuffer(e){let t=(0,a.z)(e);this.bytes=t,this.view=new DataView(t.buffer,t.byteOffset,t.byteLength),this.pos=0}appendBuffer(e){if(-1!==this.headByte||this.hasRemaining(1)){let t=this.bytes.subarray(this.pos),r=(0,a.z)(e),n=new Uint8Array(t.length+r.length);n.set(t),n.set(r,t.length),this.setBuffer(n)}else this.setBuffer(e)}hasRemaining(e){return this.view.byteLength-this.pos>=e}createExtraByteError(e){let{view:t,pos:r}=this;return RangeError(`Extra ${t.byteLength-r} of ${t.byteLength} byte(s) found at buffer[${e}]`)}decode(e){if(this.entered)return this.clone().decode(e);try{this.entered=!0,this.reinitializeState(),this.setBuffer(e);let t=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return t}finally{this.entered=!1}}*decodeMulti(e){if(this.entered){let t=this.clone();yield*t.decodeMulti(e);return}try{for(this.entered=!0,this.reinitializeState(),this.setBuffer(e);this.hasRemaining(1);)yield this.doDecodeSync()}finally{this.entered=!1}}async decodeAsync(e){if(this.entered)return this.clone().decodeAsync(e);try{let t;this.entered=!0;let r=!1;for await(let n of e){if(r)throw this.entered=!1,this.createExtraByteError(this.totalPos);this.appendBuffer(n);try{t=this.doDecodeSync(),r=!0}catch(e){if(!(e instanceof RangeError))throw e}this.totalPos+=this.pos}if(r){if(this.hasRemaining(1))throw this.createExtraByteError(this.totalPos);return t}let{headByte:i,pos:s,totalPos:o}=this;throw RangeError(`Insufficient data in parsing ${n(i)} at ${o} (${s} in the current buffer)`)}finally{this.entered=!1}}decodeArrayStream(e){return this.decodeMultiAsync(e,!0)}decodeStream(e){return this.decodeMultiAsync(e,!1)}async *decodeMultiAsync(e,t){if(this.entered){let r=this.clone();yield*r.decodeMultiAsync(e,t);return}try{this.entered=!0;let r=t,n=-1;for await(let i of e){if(t&&0===n)throw this.createExtraByteError(this.totalPos);this.appendBuffer(i),r&&(n=this.readArraySize(),r=!1,this.complete());try{for(;yield this.doDecodeSync(),0!=--n;);}catch(e){if(!(e instanceof RangeError))throw e}this.totalPos+=this.pos}}finally{this.entered=!1}}doDecodeSync(){t:for(;;){let e;let t=this.readHeadByte();if(t>=224)e=t-256;else if(t<192){if(t<128)e=t;else if(t<144){let r=t-128;if(0!==r){this.pushMapState(r),this.complete();continue}e={}}else if(t<160){let r=t-144;if(0!==r){this.pushArrayState(r),this.complete();continue}e=[]}else{let r=t-160;e=this.decodeString(r,0)}}else if(192===t)e=null;else if(194===t)e=!1;else if(195===t)e=!0;else if(202===t)e=this.readF32();else if(203===t)e=this.readF64();else if(204===t)e=this.readU8();else if(205===t)e=this.readU16();else if(206===t)e=this.readU32();else if(207===t)e=this.useBigInt64?this.readU64AsBigInt():this.readU64();else if(208===t)e=this.readI8();else if(209===t)e=this.readI16();else if(210===t)e=this.readI32();else if(211===t)e=this.useBigInt64?this.readI64AsBigInt():this.readI64();else if(217===t){let t=this.lookU8();e=this.decodeString(t,1)}else if(218===t){let t=this.lookU16();e=this.decodeString(t,2)}else if(219===t){let t=this.lookU32();e=this.decodeString(t,4)}else if(220===t){let t=this.readU16();if(0!==t){this.pushArrayState(t),this.complete();continue}e=[]}else if(221===t){let t=this.readU32();if(0!==t){this.pushArrayState(t),this.complete();continue}e=[]}else if(222===t){let t=this.readU16();if(0!==t){this.pushMapState(t),this.complete();continue}e={}}else if(223===t){let t=this.readU32();if(0!==t){this.pushMapState(t),this.complete();continue}e={}}else if(196===t){let t=this.lookU8();e=this.decodeBinary(t,1)}else if(197===t){let t=this.lookU16();e=this.decodeBinary(t,2)}else if(198===t){let t=this.lookU32();e=this.decodeBinary(t,4)}else if(212===t)e=this.decodeExtension(1,0);else if(213===t)e=this.decodeExtension(2,0);else if(214===t)e=this.decodeExtension(4,0);else if(215===t)e=this.decodeExtension(8,0);else if(216===t)e=this.decodeExtension(16,0);else if(199===t){let t=this.lookU8();e=this.decodeExtension(t,1)}else if(200===t){let t=this.lookU16();e=this.decodeExtension(t,2)}else if(201===t){let t=this.lookU32();e=this.decodeExtension(t,4)}else throw new c._(`Unrecognized type byte: ${n(t)}`);this.complete();let r=this.stack;for(;r.length>0;){let t=r.top();if(t.type===u){if(t.array[t.position]=e,t.position++,t.position===t.size)e=t.array,r.release(t);else continue t}else if(t.type===f){if("__proto__"===e)throw new c._("The key __proto__ is not allowed");t.key=this.mapKeyConverter(e),t.type=h;continue t}else if(t.map[t.key]=e,t.readCount++,t.readCount===t.size)e=t.map,r.release(t);else{t.key=null,t.type=f;
48continue t}}return e}}readHeadByte(){return -1===this.headByte&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=-1}readArraySize(){let e=this.readHeadByte();switch(e){case 220:return this.readU16();case 221:return this.readU32();default:if(e<160)return e-144;throw new c._(`Unrecognized array type byte: ${n(e)}`)}}pushMapState(e){if(e>this.maxMapLength)throw new c._(`Max length exceeded: map length (${e}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(e)}pushArrayState(e){if(e>this.maxArrayLength)throw new c._(`Max length exceeded: array length (${e}) > maxArrayLength (${this.maxArrayLength})`);this.stack.pushArrayState(e)}decodeString(e,t){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(e,t):this.decodeBinary(e,t)}decodeUtf8String(e,t){let r;if(e>this.maxStrLength)throw new c._(`Max length exceeded: UTF-8 byte length (${e}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+t+e)throw m;let n=this.pos+t;return r=this.stateIsMapKey()&&this.keyDecoder?.canBeCached(e)?this.keyDecoder.decode(this.bytes,n,e):(0,o.xI)(this.bytes,n,e),this.pos+=t+e,r}stateIsMapKey(){return this.stack.length>0&&this.stack.top().type===f}decodeBinary(e,t){if(e>this.maxBinLength)throw new c._(`Max length exceeded: bin length (${e}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(e+t))throw m;let r=this.pos+t,n=this.bytes.subarray(r,r+e);return this.pos+=t+e,n}decodeExtension(e,t){if(e>this.maxExtLength)throw new c._(`Max length exceeded: ext length (${e}) > maxExtLength (${this.maxExtLength})`);let r=this.view.getInt8(this.pos+t),n=this.decodeBinary(e,t+1);return this.extensionCodec.decode(n,r,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){let e=this.view.getUint8(this.pos);return this.pos++,e}readI8(){let e=this.view.getInt8(this.pos);return this.pos++,e}readU16(){let e=this.view.getUint16(this.pos);return this.pos+=2,e}readI16(){let e=this.view.getInt16(this.pos);return this.pos+=2,e}readU32(){let e=this.view.getUint32(this.pos);return this.pos+=4,e}readI32(){let e=this.view.getInt32(this.pos);return this.pos+=4,e}readU64(){let e=(0,s.Lz)(this.view,this.pos);return this.pos+=8,e}readI64(){let e=(0,s.eu)(this.view,this.pos);return this.pos+=8,e}readU64AsBigInt(){let e=this.view.getBigUint64(this.pos);return this.pos+=8,e}readI64AsBigInt(){let e=this.view.getBigInt64(this.pos);return this.pos+=8,e}readF32(){let e=this.view.getFloat32(this.pos);return this.pos+=4,e}readF64(){let e=this.view.getFloat64(this.pos);return this.pos+=8,e}}function v(e,t){return new w(t).decode(e)}},4143:function(e,t,r){"use strict";r.d(t,{c:function(){return l}});var n=r(85762),i=r(72283),s=r(16321),o=r(81591);class a{constructor(e){this.entered=!1,this.extensionCodec=e?.extensionCodec??i.n.defaultCodec,this.context=e?.context,this.useBigInt64=e?.useBigInt64??!1,this.maxDepth=e?.maxDepth??100,this.initialBufferSize=e?.initialBufferSize??2048,this.sortKeys=e?.sortKeys??!1,this.forceFloat32=e?.forceFloat32??!1,this.ignoreUndefined=e?.ignoreUndefined??!1,this.forceIntegerToFloat=e?.forceIntegerToFloat??!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}clone(){return new a({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,maxDepth:this.maxDepth,initialBufferSize:this.initialBufferSize,sortKeys:this.sortKeys,forceFloat32:this.forceFloat32,ignoreUndefined:this.ignoreUndefined,forceIntegerToFloat:this.forceIntegerToFloat})}reinitializeState(){this.pos=0}encodeSharedRef(e){if(this.entered)return this.clone().encodeSharedRef(e);try{return this.entered=!0,this.reinitializeState(),this.doEncode(e,1),this.bytes.subarray(0,this.pos)}finally{this.entered=!1}}encode(e){if(this.entered)return this.clone().encode(e);try{return this.entered=!0,this.reinitializeState(),this.doEncode(e,1),this.bytes.slice(0,this.pos)}finally{this.entered=!1}}doEncode(e,t){if(t>this.maxDepth)throw Error(`Too deep objects in depth ${t}`);null==e?this.encodeNil():"boolean"==typeof e?this.encodeBoolean(e):"number"==typeof e?this.forceIntegerToFloat?this.encodeNumberAsFloat(e):this.encodeNumber(e):"str
48ing"==typeof e?this.encodeString(e):this.useBigInt64&&"bigint"==typeof e?this.encodeBigInt64(e):this.encodeObject(e,t)}ensureBufferSizeToWrite(e){let t=this.pos+e;this.view.byteLength<t&&this.resizeBuffer(2*t)}resizeBuffer(e){let t=new ArrayBuffer(e),r=new Uint8Array(t),n=new DataView(t);r.set(this.bytes),this.view=n,this.bytes=r}encodeNil(){this.writeU8(192)}encodeBoolean(e){!1===e?this.writeU8(194):this.writeU8(195)}encodeNumber(e){!this.forceIntegerToFloat&&Number.isSafeInteger(e)?e>=0?e<128?this.writeU8(e):e<256?(this.writeU8(204),this.writeU8(e)):e<65536?(this.writeU8(205),this.writeU16(e)):e<4294967296?(this.writeU8(206),this.writeU32(e)):this.useBigInt64?this.encodeNumberAsFloat(e):(this.writeU8(207),this.writeU64(e)):e>=-32?this.writeU8(224|e+32):e>=-128?(this.writeU8(208),this.writeI8(e)):e>=-32768?(this.writeU8(209),this.writeI16(e)):e>=-2147483648?(this.writeU8(210),this.writeI32(e)):this.useBigInt64?this.encodeNumberAsFloat(e):(this.writeU8(211),this.writeI64(e)):this.encodeNumberAsFloat(e)}encodeNumberAsFloat(e){this.forceFloat32?(this.writeU8(202),this.writeF32(e)):(this.writeU8(203),this.writeF64(e))}encodeBigInt64(e){e>=BigInt(0)?(this.writeU8(207),this.writeBigUint64(e)):(this.writeU8(211),this.writeBigInt64(e))}writeStringHeader(e){if(e<32)this.writeU8(160+e);else if(e<256)this.writeU8(217),this.writeU8(e);else if(e<65536)this.writeU8(218),this.writeU16(e);else if(e<4294967296)this.writeU8(219),this.writeU32(e);else throw Error(`Too long string: ${e} bytes in UTF-8`)}encodeString(e){let t=(0,n.ZR)(e);this.ensureBufferSizeToWrite(5+t),this.writeStringHeader(t),(0,n.Rn)(e,this.bytes,this.pos),this.pos+=t}encodeObject(e,t){let r=this.extensionCodec.tryToEncode(e,this.context);if(null!=r)this.encodeExtension(r);else if(Array.isArray(e))this.encodeArray(e,t);else if(ArrayBuffer.isView(e))this.encodeBinary(e);else if("object"==typeof e)this.encodeMap(e,t);else throw Error(`Unrecognized object: ${Object.prototype.toString.apply(e)}`)}encodeBinary(e){let t=e.byteLength;if(t<256)this.writeU8(196),this.writeU8(t);else if(t<65536)this.writeU8(197),this.writeU16(t);else if(t<4294967296)this.writeU8(198),this.writeU32(t);else throw Error(`Too large binary: ${t}`);let r=(0,o.z)(e);this.writeU8a(r)}encodeArray(e,t){let r=e.length;if(r<16)this.writeU8(144+r);else if(r<65536)this.writeU8(220),this.writeU16(r);else if(r<4294967296)this.writeU8(221),this.writeU32(r);else throw Error(`Too large array: ${r}`);for(let r of e)this.doEncode(r,t+1)}countWithoutUndefined(e,t){let r=0;for(let n of t)void 0!==e[n]&&r++;return r}encodeMap(e,t){let r=Object.keys(e);this.sortKeys&&r.sort();let n=this.ignoreUndefined?this.countWithoutUndefined(e,r):r.length;if(n<16)this.writeU8(128+n);else if(n<65536)this.writeU8(222),this.writeU16(n);else if(n<4294967296)this.writeU8(223),this.writeU32(n);else throw Error(`Too large map object: ${n}`);for(let n of r){let r=e[n];this.ignoreUndefined&&void 0===r||(this.encodeString(n),this.doEncode(r,t+1))}}encodeExtension(e){if("function"==typeof e.data){let t=e.data(this.pos+6),r=t.length;if(r>=4294967296)throw Error(`Too large extension object: ${r}`);this.writeU8(201),this.writeU32(r),this.writeI8(e.type),this.writeU8a(t);return}let t=e.data.length;if(1===t)this.writeU8(212);else if(2===t)this.writeU8(213);else if(4===t)this.writeU8(214);else if(8===t)this.writeU8(215);else if(16===t)this.writeU8(216);else if(t<256)this.writeU8(199),this.writeU8(t);else if(t<65536)this.writeU8(200),this.writeU16(t);else if(t<4294967296)this.writeU8(201),this.writeU32(t);else throw Error(`Too large extension object: ${t}`);this.writeI8(e.type),this.writeU8a(e.data)}writeU8(e){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,e),this.pos++}writeU8a(e){let t=e.length;this.ensureBufferSizeToWrite(t),this.bytes.set(e,this.pos),this.pos+=t}writeI8(e){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,e),this.pos++}writeU16(e){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,e),this.pos+=2}writeI16(e){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,e),this.pos+=2}writeU32(e){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,e),this.pos+=4}writeI32(e){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,e),this.pos+=4}writeF32(e){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,e),this.pos+=4}writeF64(e){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,e),this.pos+=8}writeU64(e){this.ensureBufferSizeToWrite(8),(0,s.$t)(this.view,this.pos,e),this.pos+=8}writeI64(e){this.ensureBufferSizeToWrite(8),(0,s.zT)(this.view,this.pos,e),this.pos+=8}writeBigUint64(e){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,e),this.pos+=8}writeBigInt64(e){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,e),this.pos+=8}}function l(e,t){return new a(t).encodeSharedRef(e)}},16321:function(e,t,r){"use strict";r.d(t,{$t:function(){return i},Lz:function(){return a},eu:function(){return o},x5:function(){return n},zT:function(){return s}});let n=4294967295;function i(e,t,r){e.setUint32(t,r/4294967296),e.setUint32(t+4,r)}function s(e,t,r){e.setUint32(t,Math.floor(r/4294967296)),e.setUint32(t+4,r)}function o(e,t){return 4294967296*e.getInt32(t)+e.getUint32(t+4)}function a(e,t){return 4294967296*e.getUint32(t)+e.getUint32(t+4)}},81591:function(e,t,r){"use strict";function n(e){return e instanceof Uint8Array?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e instanceof ArrayBuffer||"undefined"!=typeof SharedArrayBuffer&&e instanceof SharedArrayBuffer?new Uint8Array(e):Uint8Array.from(e)}r.d(t,{z:function(){return n}})},85762:function(e,t,r){"use strict";function n(e){let t=e.length,r=0,n=0;for(;n<t;){let i=e.charCodeAt(n++);if((4294967168&i)==0){r++;continue}if((4294965248&i)==0)r+=2;else{if(i>=55296&&i<=56319&&n<t){let t=e.charCodeAt(n);(64512&t)==56320&&(++n,i=((1023&i)<<10)+(1023&t)+65536)}(4294901760&i)==0?r+=3:r+=4}}return r}r.d(t,{Rn:function(){return s},ZR:function(){return n},xI:function(){return l},zV:function(){return o}});let i=new TextEncoder;function s(e,t,r){e.length>50?i.encodeInto(e,t.subarray(r)):!function(e,t,r){let n=e.length,i=r,s=0;for(;s<n;){let r=e.charCodeAt(s++);if((4294967168&r)==0){t[i++]=r;continue}if((4294965248&r)==0)t[i++]=r>>6&31|192;else{if(r>=55296&&r<=56319&&s<n){let t=e.charCodeAt(s);(64512&t)==56320&&(++s,r=((1023&r)<<10)+(1023&t)+65536)}(4294901760&r)==0?t[i++]=r>>12&15|224:(t[i++]=r>>18&7|240,t[i++]=r>>12&63|128),t[i++]=r>>6&63|128}t[i++]=63&r|128}}(e,t,r)}function o(e,t,r){let n=t,i=n+r,s=[],o="";for(;n<i;){let t=e[n++];if((128&t)==0)s.push(t);else if((224&t)==192){let r=63&e[n++];s.push((31&t)<<6|r)}else if((240&t)==224){let r=63&e[n++],i=63&e[n++];s.push((31&t)<<12|r<<6|i)}else if((248&t)==240){let r=(7&t)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++];r>65535&&(r-=65536,s.push(r>>>10&1023|55296),r=56320|1023&r),s.push(r)}else s.push(t);s.length>=4096&&(o+=String.fromCharCode(...s),s.length=0)}return s.length>0&&(o+=String.fromCharCode(...s)),o}let a=new TextDecoder;function l(e,t,r){return r>200?function(e,t,r){let n=e.subarray(t,t+r);return a.decode(n)}(e,t,r):o(e,t,r)}},65332:function(e,t,r){"use strict";r.d(t,{A1:function(){return l},D1:function(){return b},Mx:function(){return y},N6:function(){return m},rO:function(){return v},xg:function(){return a}});var n=r(22904),i=r(53554);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */let s=BigInt(0),o=BigInt(1);function a(e,t){let r=t.negate();return e?r:t}function l(e,t){let r=(0,i.Eg)(e.Fp,t.map(e=>e.Z));return t.map((t,n)=>e.fromAffine(t.toAffine(r[n])))}function c(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw Error("invalid window size, expected [1.."+t+"], got W="+e)}function u(e,t){c(e,t);let r=Math.ceil(t/e)+1,i=2**(e-1),s=2**e;return{windows:r,windowSize:i,mask:(0,n.dQ)(e),maxNumber:s,shiftBy:BigInt(e)}}function f(e,t,r){let{windowSize:n,mask:i,maxNumber:s,shiftBy:a}=r,l=Number(e&i),c=e>>a;l>n&&(l-=s,c+=o);let u=t*n,f=u+Math.abs(l)-1;return{nextN:c,offset:f,isZero:0===l,isNeg:l<0,isNegF:t%2!=0,offsetF:u}}let h=new WeakMap,d=new WeakMap;function p(e){return d.get(e)||1}function g(e){if(e!==s)throw Error("invalid wNAF")}class y{constructor(e,t){this.BASE=e.BASE,this.ZERO=e.ZERO,this.Fn=e.Fn,this.bits=t}_unsafeLadder(e,t,r=this.ZERO){let n=e;for(;t>s;)t&o&&(r=r.add(n)),n=n.double(),t>>=o;return r}precomputeWindow(e,t){let{windows:r,windowSize:n}=u(t,this.bits),i=[],s=e,o=s;for(let e=0;e<r;e++){o=s,i.push(o);for(let e=1;e<n;e++)o=o.add(s),i.push(o);s=o.double()}return i}wNAF(e,t,r){if(!this.Fn.isValid(r))throw Error("invalid scalar");let n=this.ZERO,i=this.BASE,s=u(e,this.bits);for(let e=0;e<s.windows;e++){let{nextN:o,offset:l,isZero:c,isNeg:u,isNegF:h,offsetF:d}=f(r,e,s);r=o,c?i=i.add(a(h,t[d])):n=n.add(a(u,t[l]))}return g(r),{p:n,f:i}
vendor: 13,589 bytes, line 48
48}wNAFUnsafe(e,t,r,n=this.ZERO){let i=u(e,this.bits);for(let e=0;e<i.windows&&r!==s;e++){let{nextN:s,offset:o,isZero:a,isNeg:l}=f(r,e,i);if(r=s,!a){let e=t[o];n=n.add(l?e.negate():e)}}return g(r),n}getPrecomputes(e,t,r){let n=h.get(t);return n||(n=this.precomputeWindow(t,e),1!==e&&("function"==typeof r&&(n=r(n)),h.set(t,n))),n}cached(e,t,r){let n=p(e);return this.wNAF(n,this.getPrecomputes(n,e,r),t)}unsafe(e,t,r,n){let i=p(e);return 1===i?this._unsafeLadder(e,t,n):this.wNAFUnsafe(i,this.getPrecomputes(i,e,r),t,n)}createCache(e,t){c(t,this.bits),d.set(e,t),h.delete(e)}hasCache(e){return 1!==p(e)}}function m(e,t,r,n){let i=t,a=e.ZERO,l=e.ZERO;for(;r>s||n>s;)r&o&&(a=a.add(i)),n&o&&(l=l.add(i)),i=i.double(),r>>=o,n>>=o;return{p1:a,p2:l}}function b(e,t,r,i){!function(e,t){if(!Array.isArray(e))throw Error("array expected");e.forEach((e,r)=>{if(!(e instanceof t))throw Error("invalid point at index "+r)})}(r,e),function(e,t){if(!Array.isArray(e))throw Error("array of scalars expected");e.forEach((e,r)=>{if(!t.isValid(e))throw Error("invalid scalar at index "+r)})}(i,t);let s=r.length,o=i.length;if(s!==o)throw Error("arrays of points and scalars must have equal length");let a=e.ZERO,l=(0,n.Dd)(BigInt(s)),c=1;l>12?c=l-3:l>4?c=l-2:l>0&&(c=2);let u=(0,n.dQ)(c),f=Array(Number(u)+1).fill(a),h=Math.floor((t.BITS-1)/c)*c,d=a;for(let e=h;e>=0;e-=c){f.fill(a);for(let t=0;t<o;t++){let n=Number(i[t]>>BigInt(e)&u);f[n]=f[n].add(r[t])}let t=a;for(let e=f.length-1,r=a;e>0;e--)r=r.add(f[e]),t=t.add(r);if(d=d.add(t),0!==e)for(let e=0;e<c;e++)d=d.double()}return d}function w(e,t,r){if(!t)return(0,i.gN)(e,{isLE:r});if(t.ORDER!==e)throw Error("Field.ORDER must match order: Fp == p, Fn == n");return(0,i.OP)(t),t}function v(e,t,r={},n){if(void 0===n&&(n="edwards"===e),!t||"object"!=typeof t)throw Error(`expected valid ${e} CURVE object`);for(let e of["p","n","h"]){let r=t[e];if(!("bigint"==typeof r&&r>s))throw Error(`CURVE.${e} must be positive bigint`)}let i=w(t.p,r.Fp,n),o=w(t.n,r.Fn,n);for(let r of["Gx","Gy","a","weierstrass"===e?"b":"d"])if(!i.isValid(t[r]))throw Error(`CURVE.${r} must be valid field element of CURVE.Fp`);return{CURVE:t=Object.freeze(Object.assign({},t)),Fp:i,Fn:o}}},53554:function(e,t,r){"use strict";r.d(t,{Eg:function(){return S},OP:function(){return A},PS:function(){return k},Tu:function(){return x},Us:function(){return T},gN:function(){return P},kK:function(){return O},oA:function(){return y},wQ:function(){return g}});var n=r(22904),i=r(21007);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */let s=BigInt(0),o=BigInt(1),a=BigInt(2),l=BigInt(3),c=BigInt(4),u=BigInt(5),f=BigInt(7),h=BigInt(8),d=BigInt(9),p=BigInt(16);function g(e,t){let r=e%t;return r>=s?r:t+r}function y(e,t,r){let n=e;for(;t-- >s;)n*=n,n%=r;return n}function m(e,t){if(e===s)throw Error("invert: expected non-zero number");if(t<=s)throw Error("invert: expected positive modulus, got "+t);let r=g(e,t),n=t,i=s,a=o,l=o,c=s;for(;r!==s;){let e=n/r,t=n%r,s=i-l*e,o=a-c*e;n=r,r=t,i=l,a=c,l=s,c=o}if(n!==o)throw Error("invert: does not exist");return g(i,t)}function b(e,t,r){if(!e.eql(e.sqr(t),r))throw Error("Cannot find square root")}function w(e,t){let r=(e.ORDER+o)/c,n=e.pow(t,r);return b(e,n,t),n}function v(e,t){let r=(e.ORDER-u)/h,n=e.mul(t,a),i=e.pow(n,r),s=e.mul(t,i),o=e.mul(e.mul(s,a),i),l=e.mul(s,e.sub(o,e.ONE));return b(e,l,t),l}function E(e){if(e<l)throw Error("sqrt is not defined for small field");let t=e-o,r=0;for(;t%a===s;)t/=a,r++;let n=a,i=P(e);for(;1===I(i,n);)if(n++>1e3)throw Error("Cannot find square root: probably non-prime P");if(1===r)return w;let c=i.pow(n,t),u=(t+o)/a;return function(e,n){if(e.is0(n))return n;if(1!==I(e,n))throw Error("Cannot find square root");let i=r,s=e.mul(e.ONE,c),a=e.pow(n,t),l=e.pow(n,u);for(;!e.eql(a,e.ONE);){if(e.is0(a))return e.ZERO;let t=1,r=e.sqr(a);for(;!e.eql(r,e.ONE);)if(t++,r=e.sqr(r),t===i)throw Error("Cannot find square root");let n=o<<BigInt(i-t-1),c=e.pow(s,n);i=t,s=e.sqr(c),a=e.mul(a,s),l=e.mul(l,c)}return l}}let x=(e,t)=>(g(e,t)&o)===o,_=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function A(e){let t=_.reduce((e,t)=>(e[t]="function",e),{ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"});return(0,n.fA)(e,t),e}function S(e,t,r=!1){let n=Array(t.length).fill(r?e.ZERO:void 0),i=t.reduce((t,r,i)=>e.is0(r)?t:(n[i]=t,e.mul(t,r)),e.ONE),s=e.inv(i);return t.reduceRight((t,r,i)=>e.is0(r)?t:(n[i]=e.mul(t,n[i]),e.mul(t,r)),s),n}function I(e,t){let r=(e.ORDER-o)/a,n=e.pow(t,r),i=e.eql(n,e.ONE),s=e.eql(n,e.ZERO),l=e.eql(n,e.neg(e.ONE));if(!i&&!s&&!l)throw Error("invalid Legendre symbol result");return i?1:s?0:-1}function O(e,t){void 0!==t&&(0,i.k8)(t);let r=void 0!==t?t:e.toString(2).length;return{nBitLength:r,nByteLength:Math.ceil(r/8)}}function P(e,t,r=!1,i={}){let a,y,x,_;if(e<=s)throw Error("invalid field: expected ORDER > 0, got "+e);let A=!1;if("object"==typeof t&&null!=t){if(i.sqrt||r)throw Error("cannot specify opts in two arguments");t.BITS&&(y=t.BITS),t.sqrt&&(x=t.sqrt),"boolean"==typeof t.isLE&&(r=t.isLE),"boolean"==typeof t.modFromBytes&&(A=t.modFromBytes),_=t.allowedLengths}else"number"==typeof t&&(y=t),i.sqrt&&(x=i.sqrt);let{nBitLength:I,nByteLength:C}=O(e,y);if(C>2048)throw Error("invalid field: expected ORDER of <= 2048 bytes");let k=Object.freeze({ORDER:e,isLE:r,BITS:I,BYTES:C,MASK:(0,n.dQ)(I),ZERO:s,ONE:o,allowedLengths:_,create:t=>g(t,e),isValid:t=>{if("bigint"!=typeof t)throw Error("invalid field element: expected bigint, got "+typeof t);return s<=t&&t<e},is0:e=>e===s,isValidNot0:e=>!k.is0(e)&&k.isValid(e),isOdd:e=>(e&o)===o,neg:t=>g(-t,e),eql:(e,t)=>e===t,sqr:t=>g(t*t,e),add:(t,r)=>g(t+r,e),sub:(t,r)=>g(t-r,e),mul:(t,r)=>g(t*r,e),pow:(e,t)=>(function(e,t,r){if(r<s)throw Error("invalid exponent, negatives unsupported");if(r===s)return e.ONE;if(r===o)return t;let n=e.ONE,i=t;for(;r>s;)r&o&&(n=e.mul(n,i)),i=e.sqr(i),r>>=o;return n})(k,e,t),div:(t,r)=>g(t*m(r,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>m(t,e),sqrt:x||(t=>(!a&&(a=e%c===l?w:e%h===u?v:e%p===d?function(e){let t=P(e),r=E(e),n=r(t,t.neg(t.ONE)),i=r(t,n),s=r(t,t.neg(n)),o=(e+f)/p;return(e,t)=>{let r=e.pow(t,o),a=e.mul(r,n),l=e.mul(r,i),c=e.mul(r,s),u=e.eql(e.sqr(a),t),f=e.eql(e.sqr(l),t);r=e.cmov(r,a,u),a=e.cmov(c,l,f);let h=e.eql(e.sqr(a),t),d=e.cmov(r,a,h);return b(e,d,t),d}}(e):E(e)),a(k,t))),toBytes:e=>r?(0,n.S5)(e,C):(0,n.tL)(e,C),fromBytes:(t,i=!0)=>{if(_){if(!_.includes(t.length)||t.length>C)throw Error("Field.fromBytes: expected "+_+" bytes, got "+t.length);let e=new Uint8Array(C);e.set(t,r?0:e.length-t.length),t=e}if(t.length!==C)throw Error("Field.fromBytes: expected "+C+" bytes, got "+t.length);let s=r?(0,n.ty)(t):(0,n.Hv)(t);if(A&&(s=g(s,e)),!i&&!k.isValid(s))throw Error("invalid field element: outside of range 0..ORDER");return s},invertBatch:e=>S(k,e),cmov:(e,t,r)=>r?t:e});return Object.freeze(k)}function C(e){if("bigint"!=typeof e)throw Error("field order must be bigint");return Math.ceil(e.toString(2).length/8)}function k(e){let t=C(e);return t+Math.ceil(t/2)}function T(e,t,r=!1){let i=e.length,s=C(t),a=k(t);if(i<16||i<a||i>1024)throw Error("expected "+a+"-1024 bytes of input, got "+i);let l=g(r?(0,n.ty)(e):(0,n.Hv)(e),t-o)+o;return r?(0,n.S5)(l,s):(0,n.tL)(l,s)}},42717:function(e,t,r){"use strict";r.d(t,{UN:function(){return S}});var n=r(73246),i=r(21007),s=r(65332),o=r(22904),a=r(53554);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */let l=BigInt(0),c=BigInt(1),u=BigInt(2),f=BigInt(8);class h{constructor(e){this.ep=e}static fromBytes(e){(0,o.EQ)()}static fromHex(e){(0,o.EQ)()}get x(){return this.toAffine().x}get y(){return this.toAffine().y}clearCofactor(){return this}assertValidity(){this.ep.assertValidity()}toAffine(e){return this.ep.toAffine(e)}toHex(){return(0,i.ci)(this.toBytes())}toString(){return this.toHex()}isTorsionFree(){return!0}isSmallOrder(){return!1}add(e){return this.assertSame(e),this.init(this.ep.add(e.ep))}subtract(e){return this.assertSame(e),this.init(this.ep.subtract(e.ep))}multiply(e){return this.init(this.ep.multiply(e))}multiplyUnsafe(e){return this.init(this.ep.multiplyUnsafe(e))}double(){return this.init(this.ep.double())}negate(){return this.init(this.ep.negate())}precompute(e,t){return this.init(this.ep.precompute(e,t))}toRawBytes(){return this.toBytes()}}function d(e){if(!Number.isSafeInteger(e))throw Error("number expected")}(0,i.iY)("HashToScalar-");let p=BigInt(0),g=BigInt(1),y=BigInt(2);BigInt(3);let m=BigInt(5),b=BigInt(8),w=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"),v={p:w,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:b,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")},E=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");function x(e,t){let r=(0,a.wQ)(t*t*t,w),n=function(e){let t=BigInt(10),r=BigInt(20),n=BigInt(40),i=BigInt(80),s=e*e%w*e%w,o=(0,a.oA)(s,y,w)*s%w,l=(0,a.oA)(o,g,w)*e%w,c=(0,a.oA)(l,m,w)*l%w,u=(0,a.oA)(c,t,w)*c%w,f=(0,a.oA)(u,r,w)*u%w,h=(0,a.oA)(f,n,w)*f%w,d=(0,a.oA)(h,i,w)*h%w,p=(0,a.oA)(d,i,w)*h%w,b=(0,a.oA)(p,t,w)*c%w;return{pow_p_5_8:(0,a.oA)(b,y,w)*e%w,b2:s}}(e*(0,a.wQ)(r*r*t,w)).pow_p_5_8,i=(0,a.wQ)(e*r*n,w),s=(0,a.wQ)(t*i*i,w),o=i,l=(0,a.wQ)(i*E,w),c=s===e,u=s===(0,a.wQ)(-e,w),f=s===(0,a.wQ)(-e*E,w);return c&&(i=o),(u||f)&&(i=l),(0,a.Tu)(i,w)&&(i=(0,a.wQ)(-i,w)),{isValid:c||u,value:i}}let _=(0,a.gN)(v.p,{isLE:!0}),A=(0,a.gN)(v.n,{isLE:!0}),S=function(e){let{CURVE:t,curveOpts:r,hash:n,eddsaOpts:h}=function(e){let t={a:e.a,d:e.d,p:e.Fp.ORDER,n:e.n,h:e.h,Gx:e.Gx,Gy:e.Gy},r={Fp:e.Fp,Fn:(0,a.gN)(t.n,e.nBitLength,!0),uvRatio:e.uvRatio},n={randomBytes:e.randomBytes,adjustScalarBytes:e.adjustScalarBytes,domain:e.domain,prehash:e.prehash,mapToCurve:e.mapToCurve};return{CURVE:t,curveOpts:r,hash:e.hash,eddsaOpts:n}}(e);return function(e,t){let r=t.Point;return Object.assign({},t,{ExtendedPoint:r,CURVE:e,nBitLength:r.Fn.BITS,nByteLength:r.Fn.BYTES})}(e,function(e,t,r={}){if("function"!=typeof t)throw Error('"hash" function param is required');(0,o.fA)(r,{},{adjustScalarBytes:"function",randomBytes:"function",domain:"function",prehash:"function",mapToCurve:"function"});let{prehash:n}=r,{BASE:s,Fp:a,Fn:l}=e,u=r.randomBytes||i.O6,f=r.adjustScalarBytes||(e=>e),h=r.domain||((e,t,r)=>{if((0,o.po)(r,"phflag"),t.length||r)throw Error("Contexts/pre-hash are not supported");return e});function d(e){return l.create((0,o.ty)(e))}function p(e){let{head:r,prefix:n,scalar:i}=function(e){let r=w.secretKey;e=(0,o.ql)("private key",e,r);let n=(0,o.ql)("hashed private key",t(e),2*r),i=f(n.slice(0,r)),s=n.slice(r,2*r),a=d(i);return{head:i,prefix:s,scalar:a}}(e),a=s.multiply(i),l=a.toBytes();return{head:r,prefix:n,scalar:i,point:a,pointBytes:l}}function g(e){return p(e).pointBytes}function y(e=Uint8Array.of(),...r){return d(t(h((0,i.eV)(...r),(0,o.ql)("context",e),!!n)))}let m={zip215:!0},b=a.BYTES,w={secretKey:b,publicKey:b,signature:2*b,seed:b};function v(e=u(w.seed)){return(0,o.GB)(e,w.seed,"seed")}let E={getExtendedPublicKey:p,randomSecretKey:v,isValidSecretKey:function(e){return(0,i._t)(e)&&e.length===l.BYTES},isValidPublicKey:function(t,r){try{return!!e.fromBytes(t,r)}catch(e){return!1}},toMontgomery(t){let{y:r}=e.fromBytes(t),n=w.publicKey,i=32===n;if(!i&&57!==n)throw Error("only defined for 25519 and 448");let s=i?a.div(c+r,c-r):a.div(r-c,r+c);return a.toBytes(s)},toMontgomerySecret(e){let r=w.secretKey;return(0,o.GB)(e,r),f(t(e.subarray(0,r))).subarray(0,r)},randomPrivateKey:v,precompute:(t=8,r=e.BASE)=>r.precompute(t,!1)};return Object.freeze({keygen:function(e){let t=E.randomSecretKey(e);return{secretKey:t,publicKey:g(t)}},getPublicKey:g,sign:function(e,t,r={}){e=(0,o.ql)("message",e),n&&(e=n(e));let{prefix:a,scalar:c,pointBytes:u}=p(t),f=y(r.context,a,e),h=s.multiply(f).toBytes(),d=y(r.context,h,u,e),g=l.create(f+d*c);if(!l.isValid(g))throw Error("sign failed: invalid s");let m=(0,i.eV)(h,l.toBytes(g));return(0,o.GB)(m,w.signature,"result")},verify:function(t,r,i,a=m){let l,c,u;let{context:f,zip215:h}=a,d=w.signature;t=(0,o.ql)("signature",t,d),r=(0,o.ql)("message",r),i=(0,o.ql)("publicKey",i,w.publicKey),void 0!==h&&(0,o.po)(h,"zip215"),n&&(r=n(r));let p=d/2,g=t.subarray(0,p),b=(0,o.ty)(t.subarray(p,d));try{l=e.fromBytes(i,h),c=e.fromBytes(g,h),u=s.multiplyUnsafe(b)}catch(e){return!1}if(!h&&l.isSmallOrder())return!1;let v=y(f,c.toBytes(),l.toBytes(),r);return c.add(l.multiplyUnsafe(v)).subtract(u).clearCofactor().is0()},utils:E,Point:e,lengths:w})}(function(e,t={}){let r=(0,s.rO)("edwards",e,t,t.FpFnLE),{Fp:n,Fn:a}=r,h=r.CURVE,{h:d}=h;(0,o.fA)(t,{},{uvRatio:"function"});let p=u<<BigInt(8*a.BYTES)-c,g=e=>n.create(e),y=t.uvRatio||((e,t)=>{try{return{isValid:!0,value:n.sqrt(n.div(e,t))}}catch(e){return{isValid:!1,value:l}}});if(!function(e,t,r,n){let i=e.sqr(r),s=e.sqr(n),o=e.add(e.mul(t.a,i),s),a=e.add(e.ONE,e.mul(t.d,e.mul(i,s)));return e.eql(o,a)}(n,h,h.Gx,h.Gy))throw Error("bad curve params: generator point");function m(e,t,r=!1){let n=r?c:l;return(0,o.Fy)("coordinate "+e,t,n,p),t}function b(e){if(!(e instanceof E))throw Error("ExtendedPoint expected")}let w=(0,o.H9)((e,t)=>{let{X:r,Y:i,Z:s}=e,o=e.is0();null==t&&(t=o?f:n.inv(s));let a=g(r*t),u=g(i*t),h=n.mul(s,t);if(o)return{x:l,y:c};
48if(h!==c)throw Error("invZ was invalid");return{x:a,y:u}}),v=(0,o.H9)(e=>{let{a:t,d:r}=h;if(e.is0())throw Error("bad point: ZERO");let{X:n,Y:i,Z:s,T:o}=e,a=g(n*n),l=g(i*i),c=g(s*s),u=g(c*c),f=g(a*t);if(g(c*g(f+l))!==g(u+g(r*g(a*l))))throw Error("bad point: equation left != right (1)");if(g(n*i)!==g(s*o))throw Error("bad point: equation left != right (2)");return!0});class E{constructor(e,t,r,n){this.X=m("x",e),this.Y=m("y",t),this.Z=m("z",r,!0),this.T=m("t",n),Object.freeze(this)}static CURVE(){return h}static fromAffine(e){if(e instanceof E)throw Error("extended point not allowed");let{x:t,y:r}=e||{};return m("x",t),m("y",r),new E(t,r,c,g(t*r))}static fromBytes(e,t=!1){let r=n.BYTES,{a:i,d:s}=h;e=(0,o.HV)((0,o.GB)(e,r,"point")),(0,o.po)(t,"zip215");let a=(0,o.HV)(e),u=e[r-1];a[r-1]=-129&u;let f=(0,o.ty)(a),d=t?p:n.ORDER;(0,o.Fy)("point.y",f,l,d);let m=g(f*f),{isValid:b,value:w}=y(g(m-c),g(s*m-i));if(!b)throw Error("bad point: invalid y coordinate");let v=(w&c)===c,x=(128&u)!=0;if(!t&&w===l&&x)throw Error("bad point: x=0 and x_0=1");return x!==v&&(w=g(-w)),E.fromAffine({x:w,y:f})}static fromHex(e,t=!1){return E.fromBytes((0,o.ql)("point",e),t)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(e=8,t=!0){return x.createCache(this,e),t||this.multiply(u),this}assertValidity(){v(this)}equals(e){b(e);let{X:t,Y:r,Z:n}=this,{X:i,Y:s,Z:o}=e,a=g(t*o),l=g(i*n),c=g(r*o),u=g(s*n);return a===l&&c===u}is0(){return this.equals(E.ZERO)}negate(){return new E(g(-this.X),this.Y,this.Z,g(-this.T))}double(){let{a:e}=h,{X:t,Y:r,Z:n}=this,i=g(t*t),s=g(r*r),o=g(u*g(n*n)),a=g(e*i),l=t+r,c=g(g(l*l)-i-s),f=a+s,d=f-o,p=a-s,y=g(c*d),m=g(f*p),b=g(c*p);return new E(y,m,g(d*f),b)}add(e){b(e);let{a:t,d:r}=h,{X:n,Y:i,Z:s,T:o}=this,{X:a,Y:l,Z:c,T:u}=e,f=g(n*a),d=g(i*l),p=g(o*r*u),y=g(s*c),m=g((n+i)*(a+l)-f-d),w=y-p,v=y+p,x=g(d-t*f),_=g(m*w),A=g(v*x),S=g(m*x);return new E(_,A,g(w*v),S)}subtract(e){return this.add(e.negate())}multiply(e){if(!a.isValidNot0(e))throw Error("invalid scalar: expected 1 <= sc < curve.n");let{p:t,f:r}=x.cached(this,e,e=>(0,s.A1)(E,e));return(0,s.A1)(E,[t,r])[0]}multiplyUnsafe(e,t=E.ZERO){if(!a.isValid(e))throw Error("invalid scalar: expected 0 <= sc < curve.n");return e===l?E.ZERO:this.is0()||e===c?this:x.unsafe(this,e,e=>(0,s.A1)(E,e),t)}isSmallOrder(){return this.multiplyUnsafe(d).is0()}isTorsionFree(){return x.unsafe(this,h.n).is0()}toAffine(e){return w(this,e)}clearCofactor(){return d===c?this:this.multiplyUnsafe(d)}toBytes(){let{x:e,y:t}=this.toAffine(),r=n.toBytes(t);return r[r.length-1]|=e&c?128:0,r}toHex(){return(0,i.ci)(this.toBytes())}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get ex(){return this.X}get ey(){return this.Y}get ez(){return this.Z}get et(){return this.T}static normalizeZ(e){return(0,s.A1)(E,e)}static msm(e,t){return(0,s.D1)(E,a,e,t)}_setWindowSize(e){this.precompute(e)}toRawBytes(){return this.toBytes()}}E.BASE=new E(h.Gx,h.Gy,c,g(h.Gx*h.Gy)),E.ZERO=new E(l,c,c,l),E.Fp=n,E.Fn=a;let x=new s.Mx(E,a.BITS);return E.BASE.precompute(8),E}(t,r),n,h))}({...v,Fp:_,hash:n.o,adjustScalarBytes:function(e){return e[0]&=248,e[31]&=127,e[31]|=64,e},uvRatio:x}),I=BigInt("25063068953384623474111414158702152701244531502492656460079210482610430750235"),O=BigInt("54469307008909316920995813868745141605393597292927456921205312896311721017578"),P=BigInt("1159843021668779879193775521855586647937357759715417654439879720876111806838"),C=BigInt("40440834346308536858101042469323190826248399146238708352240133220865137265952"),k=e=>x(g,e),T=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),B=e=>S.Point.Fp.create((0,o.ty)(e)&T);function R(e){let{d:t}=v,r=e=>_.create(e),n=r(E*e*e),i=r((n+g)*P),s=BigInt(-1),o=r((s-t*n)*r(n+t)),{isValid:l,value:c}=x(i,o),u=r(c*e);(0,a.Tu)(u,w)||(u=r(-u)),l||(c=u),l||(s=n);let f=r(s*(n-g)*C-o),h=c*c,d=r((c+c)*o),p=r(f*I),y=r(g-h),m=r(g+h);return new S.Point(r(d*m),r(y*p),r(p*m),r(d*y))}class D extends h{constructor(e){super(e)}static fromAffine(e){return new D(S.Point.fromAffine(e))}assertSame(e){if(!(e instanceof D))throw Error("RistrettoPoint expected")}init(e){return new D(e)}static hashToCurve(e){return function(e){(0,i.gk)(e,64);let t=R(B(e.subarray(0,32))),r=R(B(e.subarray(32,64)));return new D(t.add(r))}((0,o.ql)("ristrettoHash",e,64))}static fromBytes(e){(0,i.gk)(e,32);let{a:t,d:r}=v,n=e=>_.create(e),s=B(e);if(!(0,o.Wd)(_.toBytes(s),e)||(0,a.Tu)(s,w))throw Error("invalid ristretto255 encoding 1");let l=n(s*s),c=n(g+t*l),u=n(g-t*l),f=n(c*c),h=n(u*u),d=n(t*r*f-h),{isValid:y,value:m}=k(n(d*h)),b=n(m*u),E=n(m*b*d),x=n((s+s)*b);(0,a.Tu)(x,w)&&(x=n(-x));let A=n(c*E),I=n(x*A);if(!y||(0,a.Tu)(I,w)||A===p)throw Error("invalid ristretto255 encoding 2");return new D(new S.Point(x,A,g,I))}static fromHex(e){return D.fromBytes((0,o.ql)("ristrettoHex",e,32))}static msm(e,t){return(0,s.D1)(D,S.Point.Fn,e,t)}toBytes(){let e,{X:t,Y:r,Z:n,T:i}=this.ep,s=e=>_.create(e),o=s(s(n+r)*s(n-r)),l=s(t*r),c=s(l*l),{value:u}=k(s(o*c)),f=s(u*o),h=s(u*l),d=s(f*h*i);if((0,a.Tu)(i*d,w)){let n=s(r*E),i=s(t*E);t=n,r=i,e=s(f*O)}else e=h;(0,a.Tu)(t*d,w)&&(r=s(-r));let p=s((n-r)*e);return(0,a.Tu)(p,w)&&(p=s(-p)),_.toBytes(p)}
vendor: 21,668 bytes, line 48
48equals(e){this.assertSame(e);let{X:t,Y:r}=this.ep,{X:n,Y:i}=e.ep,s=e=>_.create(e),o=s(t*i)===s(r*n),a=s(r*i)===s(t*n);return o||a}is0(){return this.equals(D.ZERO)}}D.BASE=new D(S.Point.BASE),D.ZERO=new D(S.Point.ZERO),D.Fp=_,D.Fn=A},4077:function(e,t,r){"use strict";r.d(t,{kA:function(){return O}});var n=r(73246),i=r(21007);class s extends i.kb{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,(0,i.z3)(e);let r=(0,i.O0)(t);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let n=this.blockLen,s=new Uint8Array(n);s.set(r.length>n?e.create().update(r).digest():r);for(let e=0;e<s.length;e++)s[e]^=54;this.iHash.update(s),this.oHash=e.create();for(let e=0;e<s.length;e++)s[e]^=106;this.oHash.update(s),(0,i.ru)(s)}update(e){return(0,i.$h)(this),this.iHash.update(e),this}digestInto(e){(0,i.$h)(this),(0,i.gk)(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));let{oHash:t,iHash:r,finished:n,destroyed:i,blockLen:s,outputLen:o}=this;return e.finished=n,e.destroyed=i,e.blockLen=s,e.outputLen=o,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}let o=(e,t,r)=>new s(e,t).update(r).digest();o.create=(e,t)=>new s(e,t);var a=r(22904),l=r(65332),c=r(53554);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */let u=(e,t)=>(e+(e>=0?t:-t)/m)/t;function f(e){if(!["compact","recovered","der"].includes(e))throw Error('Signature format must be "compact", "recovered", or "der"');return e}function h(e,t){let r={};for(let n of Object.keys(t))r[n]=void 0===e[n]?t[n]:e[n];return(0,a.po)(r.lowS,"lowS"),(0,a.po)(r.prehash,"prehash"),void 0!==r.format&&f(r.format),r}class d extends Error{constructor(e=""){super(e)}}let p={Err:d,_tlv:{encode:(e,t)=>{let{Err:r}=p;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(1&t.length)throw new r("tlv.encode: unpadded data");let n=t.length/2,i=(0,a.uz)(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");let s=n>127?(0,a.uz)(i.length/2|128):"";return(0,a.uz)(e)+s+i+t},decode(e,t){let{Err:r}=p,n=0;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(t.length<2||t[n++]!==e)throw new r("tlv.decode: wrong tlv");let i=t[n++],s=0;if(128&i){let e=127&i;if(!e)throw new r("tlv.decode(long): indefinite length not supported");if(e>4)throw new r("tlv.decode(long): byte length is too big");let o=t.subarray(n,n+e);if(o.length!==e)throw new r("tlv.decode: length bytes not complete");if(0===o[0])throw new r("tlv.decode(long): zero leftmost byte");for(let e of o)s=s<<8|e;if(n+=e,s<128)throw new r("tlv.decode(long): not minimal encoding")}else s=i;let o=t.subarray(n,n+s);if(o.length!==s)throw new r("tlv.decode: wrong value length");return{v:o,l:t.subarray(n+s)}}},_int:{encode(e){let{Err:t}=p;if(e<g)throw new t("integer: negative integers are not allowed");let r=(0,a.uz)(e);if(8&Number.parseInt(r[0],16)&&(r="00"+r),1&r.length)throw new t("unexpected DER parsing assertion: unpadded hex");return r},decode(e){let{Err:t}=p;if(128&e[0])throw new t("invalid signature integer: negative");if(0===e[0]&&!(128&e[1]))throw new t("invalid signature integer: unnecessary leading zero");return(0,a.Hv)(e)}},toSig(e){let{Err:t,_int:r,_tlv:n}=p,i=(0,a.ql)("signature",e),{v:s,l:o}=n.decode(48,i);if(o.length)throw new t("invalid signature: left bytes after parsing");let{v:l,l:c}=n.decode(2,s),{v:u,l:f}=n.decode(2,c);if(f.length)throw new t("invalid signature: left bytes after parsing");return{r:r.decode(l),s:r.decode(u)}},hexFromSig(e){let{_tlv:t,_int:r}=p,n=t.encode(2,r.encode(e.r)),i=t.encode(2,r.encode(e.s));return t.encode(48,n+i)}},g=BigInt(0),y=BigInt(1),m=BigInt(2),b=BigInt(3),w=BigInt(4);function v(e,t){let r;let{BYTES:n}=e;if("bigint"==typeof t)r=t;else{let i=(0,a.ql)("private key",t);try{r=e.fromBytes(i)}catch(e){throw Error(`invalid private key: expected ui8a of size ${n}, got ${typeof t}`)}}if(!e.isValidNot0(r))throw Error("invalid private key: out of range [1..N-1]");return r}function E(e){return Uint8Array.of(e?2:3)}function x(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */let _={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},A={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},S=BigInt(2),I=(0,c.gN)(_.p,{sqrt:function(e){let t=_.p,r=BigInt(3),n=BigInt(6),i=BigInt(11),s=BigInt(22),o=BigInt(23),a=BigInt(44),l=BigInt(88),u=e*e*e%t,f=u*u*e%t,h=(0,c.oA)(f,r,t)*f%t,d=(0,c.oA)(h,r,t)*f%t,p=(0,c.oA)(d,S,t)*u%t,g=(0,c.oA)(p,i,t)*p%t,y=(0,c.oA)(g,s,t)*g%t,m=(0,c.oA)(y,a,t)*y%t,b=(0,c.oA)(m,l,t)*m%t,w=(0,c.oA)(b,a,t)*y%t,v=(0,c.oA)(w,r,t)*f%t,E=(0,c.oA)(v,o,t)*g%t,x=(0,c.oA)(E,n,t)*u%t,A=(0,c.oA)(x,S,t);if(!I.eql(I.sqr(A),e))throw Error("Cannot find square root");return A}}),O=function(e,t){let r=t=>(function(e){let{CURVE:t,curveOpts:r,hash:n,ecdsaOpts:s}=function(e){let{CURVE:t,curveOpts:r}=function(e){let t={a:e.a,b:e.b,p:e.Fp.ORDER,n:e.n,h:e.h,Gx:e.Gx,Gy:e.Gy},r=e.Fp,n=e.allowedPrivateKeyLengths?Array.from(new Set(e.allowedPrivateKeyLengths.map(e=>Math.ceil(e/2)))):void 0,i={Fp:r,Fn:(0,c.gN)(t.n,{BITS:e.nBitLength,allowedLengths:n,modFromBytes:e.wrapPrivateKey}),allowInfinityPoint:e.allowInfinityPoint,endo:e.endo,isTorsionFree:e.isTorsionFree,clearCofactor:e.clearCofactor,fromBytes:e.fromBytes,toBytes:e.toBytes};return{CURVE:t,curveOpts:i}}(e),n={hmac:e.hmac,randomBytes:e.randomBytes,lowS:e.lowS,bits2int:e.bits2int,bits2int_modN:e.bits2int_modN};return{CURVE:t,curveOpts:r,hash:e.hash,ecdsaOpts:n}}(e);return function(e,t){let r=t.Point;return Object.assign({},t,{ProjectivePoint:r,CURVE:Object.assign({},e,(0,c.kK)(r.Fn.ORDER,r.Fn.BITS))})}(e,function(e,t,r={}){(0,i.z3)(t),(0,a.fA)(r,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});let n=r.randomBytes||i.O6,s=r.hmac||((e,...r)=>o(t,e,(0,i.eV)(...r))),{Fp:l,Fn:u}=e,{ORDER:d,BITS:b}=u,{keygen:w,getPublicKey:_,getSharedSecret:A,utils:S,lengths:I}=function(e,t={}){let{Fn:r}=e,n=t.randomBytes||i.O6,s=Object.assign(x(e.Fp,r),{seed:(0,c.PS)(r.ORDER)});function o(e){try{return!!v(r,e)}catch(e){return!1}}function l(e=n(s.seed)){return(0,c.Us)((0,a.GB)(e,s.seed,"seed"),r.ORDER)}function u(t,n=!0){return e.BASE.multiply(v(r,t)).toBytes(n)}function f(t){if("bigint"==typeof t)return!1;if(t instanceof e)return!0;let{secretKey:n,publicKey:i,publicKeyUncompressed:o}=s;if(r.allowedLengths||n===i)return;let l=(0,a.ql)("key",t).length;return l===i||l===o}return Object.freeze({getPublicKey:u,getSharedSecret:function(t,n,i=!0){if(!0===f(t))throw Error("first arg must be private key");if(!1===f(n))throw Error("second arg must be public key");let s=v(r,t);return e.fromHex(n).multiply(s).toBytes(i)},keygen:function(e){let t=l(e);return{secretKey:t,publicKey:u(t)}},Point:e,utils:{isValidSecretKey:o,isValidPublicKey:function(t,r){let{publicKey:n,publicKeyUncompressed:i}=s;try{let s=t.length;if(!0===r&&s!==n||!1===r&&s!==i)return!1;return!!e.fromBytes(t)}catch(e){return!1}},randomSecretKey:l,isValidPrivateKey:o,randomPrivateKey:l,normPrivateKeyToScalar:e=>v(r,e),precompute:(t=8,r=e.BASE)=>r.precompute(t,!1)},lengths:s})}(e,r),O={prehash:!1,lowS:"boolean"==typeof r.lowS&&r.lowS,format:void 0,extraEntropy:!1},P="compact";function C(e,t){if(!u.isValidNot0(t))throw Error(`invalid signature ${e}: out of range 1..Point.Fn.ORDER`);return t}class k{constructor(e,t,r){this.r=C("r",e),this.s=C("s",t),null!=r&&(this.recovery=r),Object.freeze(this)}static fromBytes(e,t=P){let r;if(!function(e,t){f(t);let r=I.signature;(0,a.GB)(e,"compact"===t?r:"recovered"===t?r+1:void 0,`${t} signature`)}(e,t),"der"===t){let{r:t,s:r}=p.toSig((0,a.GB)(e));return new k(t,r)}"recovered"===t&&(r=e[0],t="compact",e=e.subarray(1));let n=u.BYTES,i=e.subarray(0,n),s=e.subarray(n,2*n);return new k(u.fromBytes(i),u.fromBytes(s),r)}static fromHex(e,t){return this.fromBytes((0,i.nr)(e),t)}addRecoveryBit(e){return new k(this.r,this.s,e)}recoverPublicKey(t){let r=l.ORDER,{r:n,s,recovery:o}=this;if(null==o||![0,1,2,3].includes(o))throw Error("recovery id invalid");if(d*m<r&&o>1)throw Error("recovery id is ambiguous for h>1 curve");let c=2===o||3===o?n+d:n;if(!l.isValid(c))throw Error("recovery id 2 or 3 invalid");let f=l.toBytes(c),h=e.fromBytes((0,i.eV)(E((1&o)==0),f)),p=u.inv(c),g=B((0,a.ql)("msgHash",t)),y=u.create(-g*p),b=u.create(s*p),w=e.BASE.multiplyUnsafe(y).add(h.multiplyUnsafe(b));if(w.is0())throw Error("point at infinify");return w.assertValidity(),w}hasHighS(){return this.s>d>>y}toBytes(e=P){if(f(e),"der"===e)return(0,i.nr)(p.hexFromSig(this));let t=u.toBytes(this.r),r=u.toBytes(this.s);if("recovered"===e){if(null==this.recovery)throw Error("recovery bit must be present");return(0,i.eV)(Uint8Array.of(this.recovery),t,r)}return(0,i.eV)(t,r)}toHex(e){return(0,i.ci)(this.toBytes(e))}assertValidity(){}static fromCompact(e){return k.fromBytes((0,a.ql)("sig",e),"compact")}static fromDER(e){return k.fromBytes((0,a.ql)("sig",e),"der")}normalizeS(){return this.hasHighS()?new k(this.r,u.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return(0,i.ci)(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return(0,i.ci)(this.toBytes("compact"))}}let T=r.bits2int||function(e){if(e.length>8192)throw Error("input is too large");let t=(0,a.Hv)(e),r=8*e.length-b;return r>0?t>>BigInt(r):t},B=r.bits2int_modN||function(e){return u.create(T(e))},R=(0,a.dQ)(b);function D(e){return(0,a.Fy)("num < 2^"+b,e,g,R),u.toBytes(e)}function U(e,r){return(0,a.GB)(e,void 0,"message"),r?(0,a.GB)(t(e),void 0,"prehashed message"):e}return Object.freeze({keygen:w,getPublicKey:_,getSharedSecret:A,utils:S,lengths:I,Point:e,sign:function(r,o,l={}){let{seed:c,k2sig:f}=function(t,r,s){if(["recovered","canonical"].some(e=>e in s))throw Error("sign() legacy options not supported");let{lowS:o,prehash:l,extraEntropy:c}=h(s,O),f=B(t=U(t,l)),p=v(u,r),m=[D(p),D(f)];if(null!=c&&!1!==c){let e=!0===c?n(I.secretKey):c;m.push((0,a.ql)("extraEntropy",e))}return{seed:(0,i.eV)(...m),k2sig:function(t){let r=T(t);if(!u.isValidNot0(r))return;let n=u.inv(r),i=e.BASE.multiply(r).toAffine(),s=u.create(i.x);if(s===g)return;let a=u.create(n*u.create(f+s*p));if(a===g)return;let l=(i.x===s?0:2)|Number(i.y&y),c=a;return o&&a>d>>y&&(c=u.neg(a),l^=1),new k(s,c,l)}}}(r=(0,a.ql)("message",r),o,l);return(0,a.n$)(t.outputLen,u.BYTES,s)(c,f)},verify:function(t,r,n,s={}){let{lowS:o,prehash:l,format:c}=h(s,O);if(n=(0,a.ql)("publicKey",n),r=U((0,a.ql)("message",r),l),"strict"in s)throw Error("options.strict was renamed to lowS");let f=void 0===c?function(e){let t;let r="string"==typeof e||(0,i._t)(e),n=!r&&null!==e&&"object"==typeof e&&"bigint"==typeof e.r&&"bigint"==typeof e.s;if(!r&&!n)throw Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(n)t=new k(e.r,e.s);else if(r){try{t=k.fromBytes((0,a.ql)("sig",e),"der")}catch(e){if(!(e instanceof p.Err))throw e}if(!t)try{t=k.fromBytes((0,a.ql)("sig",e),"compact")}catch(e){return!1}}return!!t&&t}(t):k.fromBytes((0,a.ql)("sig",t),c);if(!1===f)return!1;try{let t=e.fromBytes(n);if(o&&f.hasHighS())return!1;let{r:i,s}=f,a=B(r),l=u.inv(s),c=u.create(a*l),h=u.create(i*l),d=e.BASE.multiplyUnsafe(c).add(t.multiplyUnsafe(h));if(d.is0())return!1;return u.create(d.x)===i}catch(e){return!1}},recoverPublicKey:function(e,t,r={}){let{prehash:n}=h(r,O);return t=U(t,n),k.fromBytes(e,"recovered").recoverPublicKey(t).toBytes()},Signature:k,hash:t})}(function(e,t={}){let r=(0,l.rO)("weierstrass",e,t),{Fp:n,Fn:s}=r,o=r.CURVE,{h:c,n:f}=o;(0,a.fA)(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});let{endo:h}=t;if(h&&(!n.is0(o.a)||"bigint"!=typeof h.beta||!Array.isArray(h.basises)))throw Error('invalid endo: expected "beta": bigint and "basises": array');let d=x(n,s);function p(){if(!n.isOdd)throw Error("compression is not supported: Field does not have .isOdd()")}let m=t.toBytes||function(e,t,r){let{x:s,y:o}=t.toAffine(),l=n.toBytes(s);if((0,a.po)(r,"isCompressed"),!r)return(0,i.eV)(Uint8Array.of(4),l,n.toBytes(o));{p();let e=!n.isOdd(o);return(0,i.eV)(E(e),l)}},_=t.fromBytes||function(e){(0,a.GB)(e,void 0,"Point");let{publicKey:t,publicKeyUncompressed:r}=d,i=e.length,s=e[0],o=e.subarray(1);if(i===t&&(2===s||3===s)){let e;let t=n.fromBytes(o);if(!n.isValid(t))throw Error("bad point: is not on curve, wrong x");let r=A(t);try{e=n.sqrt(r)}catch(e){throw Error("bad point: is not on curve, sqrt error"+(e instanceof Error?": "+e.message:""))}return p(),(1&s)==1!==n.isOdd(e)&&(e=n.neg(e)),{x:t,y:e}}if(i===r&&4===s){let e=n.BYTES,t=n.fromBytes(o.subarray(0,e)),r=n.fromBytes(o.subarray(e,2*e));if(!S(t,r))throw Error("bad point: is not on curve");return{x:t,y:r}}throw Error(`bad point: got length ${i}, expected compressed=${t} or uncompressed=${r}`)};function A(e){let t=n.sqr(e),r=n.mul(t,e);return n.add(n.add(r,n.mul(e,o.a)),o.b)}function S(e,t){let r=n.sqr(t),i=A(e);return n.eql(r,i)}if(!S(o.Gx,o.Gy))throw Error("bad curve params: generator point");let I=n.mul(n.pow(o.a,b),w),O=n.mul(n.sqr(o.b),BigInt(27));if(n.is0(n.add(I,O)))throw Error("bad curve params: a or b");function P(e,t,r=!1){if(!n.isValid(t)||r&&n.is0(t))throw Error(`bad point coordinate ${e}`);return t}function C(e){if(!(e instanceof D))throw Error("ProjectivePoint expected")}function k(e){if(!h||!h.basises)throw Error("no endo");return function(e,t,r){let[[n,i],[s,o]]=t,l=u(o*e,r),c=u(-i*e,r),f=e-l*n-c*s,h=-l*i-c*o,d=f<g,p=h<g;d&&(f=-f),p&&(h=-h);let m=(0,a.dQ)(Math.ceil((0,a.Dd)(r)/2))+y;if(f<g||f>=m||h<g||h>=m)throw Error("splitScalar (endomorphism): failed, k="+e);return{k1neg:d,k1:f,k2neg:p,k2:h}}(e,h.basises,s.ORDER)}let T=(0,a.H9)((e,t)=>{let{X:r,Y:i,Z:s}=e;if(n.eql(s,n.ONE))return{x:r,y:i};let o=e.is0();null==t&&(t=o?n.ONE:n.inv(s));let a=n.mul(r,t),l=n.mul(i,t),c=n.mul(s,t);if(o)return{x:n.ZERO,y:n.ZERO};if(!n.eql(c,n.ONE))throw Error("invZ was invalid");return{x:a,y:l}}),B=(0,a.H9)(e=>{if(e.is0()){if(t.allowInfinityPoint&&!n.is0(e.Y))return;throw Error("bad point: ZERO")}let{x:r,y:i}=e.toAffine();if(!n.isValid(r)||!n.isValid(i))throw Error("bad point: x or y not field elements");if(!S(r,i))throw Error("bad point: equation left != right");if(!e.isTorsionFree())throw Error("bad point: not in prime-order subgroup");return!0});function R(e,t,r,i,s){return r=new D(n.mul(r.X,e),r.Y,r.Z),t=(0,l.xg)(i,t),r=(0,l.xg)(s,r),t.add(r)}class D{constructor(e,t,r){this.X=P("x",e),this.Y=P("y",t,!0),this.Z=P("z",r),Object.freeze(this)}static CURVE(){return o}static fromAffine(e){let{x:t,y:r}=e||{};if(!e||!n.isValid(t)||!n.isValid(r))throw Error("invalid affine point");if(e instanceof D)throw Error("projective point not allowed");return n.is0(t)&&n.is0(r)?D.ZERO:new D(t,r,n.ONE)}static fromBytes(e){let t=D.fromAffine(_((0,a.GB)(e,void 0,"point")));return t.assertValidity(),t}static fromHex(e){return D.fromBytes((0,a.ql)("pointHex",e))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(e=8,t=!0){return M.createCache(this,e),t||this.multiply(b),this}assertValidity(){B(this)}hasEvenY(){let{y:e}=this.toAffine();if(!n.isOdd)throw Error("Field doesn't support isOdd");return!n.isOdd(e)}equals(e){C(e);let{X:t,Y:r,Z:i}=this,{X:s,Y:o,Z:a}=e,l=n.eql(n.mul(t,a),n.mul(s,i)),c=n.eql(n.mul(r,a),n.mul(o,i));return l&&c}negate(){return new D(this.X,n.neg(this.Y),this.Z)}double(){let{a:e,b:t}=o,r=n.mul(t,b),{X:i,Y:s,Z:a}=this,l=n.ZERO,c=n.ZERO,u=n.ZERO,f=n.mul(i,i),h=n.mul(s,s),d=n.mul(a,a),p=n.mul(i,s);return p=n.add(p,p),u=n.mul(i,a),u=n.add(u,u),l=n.mul(e,u),c=n.mul(r,d),c=n.add(l,c),l=n.sub(h,c),c=n.add(h,c),c=n.mul(l,c),l=n.mul(p,l),u=n.mul(r,u),d=n.mul(e,d),p=n.sub(f,d),p=n.mul(e,p),p=n.add(p,u),u=n.add(f,f),f=n.add(u,f),f=n.add(f,d),f=n.mul(f,p),c=n.add(c,f),d=n.mul(s,a),d=n.add(d,d),f=n.mul(d,p),l=n.sub(l,f),u=n.mul(d,h),u=n.add(u,u),new D(l,c,u=n.add(u,u))}add(e){C(e);let{X:t,Y:r,Z:i}=this,{X:s,Y:a,Z:l}=e,c=n.ZERO,u=n.ZERO,f=n.ZERO,h=o.a,d=n.mul(o.b,b),p=n.mul(t,s),g=n.mul(r,a),y=n.mul(i,l),m=n.add(t,r),w=n.add(s,a);m=n.mul(m,w),w=n.add(p,g),m=n.sub(m,w),w=n.add(t,i);let v=n.add(s,l);return w=n.mul(w,v),v=n.add(p,y),w=n.sub(w,v),v=n.add(r,i),c=n.add(a,l),v=n.mul(v,c),c=n.add(g,y),v=n.sub(v,c),f=n.mul(h,w),c=n.mul(d,y),f=n.add(c,f),c=n.sub(g,f),f=n.add(g,f),u=n.mul(c,f),g=n.add(p,p),g=n.add(g,p),y=n.mul(h,y),w=n.mul(d,w),g=n.add(g,y),y=n.sub(p,y),y=n.mul(h,y),w=n.add(w,y),p=n.mul(g,w),u=n.add(u,p),p=n.mul(v,w),c=n.mul(m,c),c=n.sub(c,p),p=n.mul(m,g),f=n.mul(v,f),new D(c,u,f=n.add(f,p))}subtract(e){return this.add(e.negate())}is0(){return this.equals(D.ZERO)}multiply(e){let r,n;let{endo:i}=t;if(!s.isValidNot0(e))throw Error("invalid scalar: out of range");let o=e=>M.cached(this,e,e=>(0,l.A1)(D,e));if(i){let{k1neg:t,k1:s,k2neg:a,k2:l}=k(e),{p:c,f:u}=o(s),{p:f,f:h}=o(l);n=u.add(h),r=R(i.beta,c,f,t,a)}else{let{p:t,f:i}=o(e);r=t,n=i}return(0,l.A1)(D,[r,n])[0]}multiplyUnsafe(e){let{endo:r}=t;if(!s.isValid(e))throw Error("invalid scalar: out of range");if(e===g||this.is0())return D.ZERO;if(e===y)return this;if(M.hasCache(this))return this.multiply(e);if(!r)return M.unsafe(this,e);{let{k1neg:t,k1:n,k2neg:i,k2:s}=k(e),{p1:o,p2:a}=(0,l.N6)(D,this,n,s);return R(r.beta,o,a,t,i)}}multiplyAndAddUnsafe(e,t,r){let n=this.multiplyUnsafe(t).add(e.multiplyUnsafe(r));return n.is0()?void 0:n}toAffine(e){return T(this,e)}isTorsionFree(){let{isTorsionFree:e}=t;return c===y||(e?e(D,this):M.unsafe(this,f).is0())}clearCofactor(){let{clearCofactor:e}=t;return c===y?this:e?e(D,this):this.multiplyUnsafe(c)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}toBytes(e=!0){return(0,a.po)(e,"isCompressed"),this.assertValidity(),m(D,this,e)}toHex(e=!0){return(0,i.ci)(this.toBytes(e))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(e=!0){return this.toBytes(e)}_setWindowSize(e){this.precompute(e)}static normalizeZ(e){return(0,l.A1)(D,e)}static msm(e,t){return(0,l.D1)(D,s,e,t)}static fromPrivateKey(e){return D.BASE.multiply(v(s,e))}}D.BASE=new D(o.Gx,o.Gy,n.ONE),D.ZERO=new D(n.ZERO,n.ONE,n.ZERO),D.Fp=n,D.Fn=s;let U=s.BITS,M=new l.Mx(D,t.endo?Math.ceil(U/2):U);return D.BASE.precompute(8),D}(t,r),n,s))})({...e,hash:t});return{...r(t),create:r}}({..._,Fp:I,lowS:!0,endo:A},n.JQ)},22904:function(e,t,r){"use strict";r.d(t,{Dd:function(){return w},EQ:function(){return _},Fy:function(){return b},GB:function(){return a},H9:function(){return A},HV:function(){return y},Hv:function(){return u},S5:function(){return d},Wd:function(){return g},dQ:function(){return v},fA:function(){return x},n$:function(){return E},po:function(){return o},ql:function(){return p},tL:function(){return h},ty:function(){return f},uz:function(){return l}});var n=r(21007);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */let i=BigInt(0),s=BigInt(1);function o(e,t=""){if("boolean"!=typeof e)throw Error((t&&`"${t}"`)+"expected boolean, got type="+typeof e);return e}function a(e,t,r=""){let i=(0,n._t)(e),s=e?.length,o=void 0!==t;if(!i||o&&s!==t)throw Error((r&&`"${r}" `)+"expected Uint8Array"+(o?` of length ${t}`:"")+", got "+(i?`length=${s}`:`type=${typeof e}`));return e}function l(e){let t=e.toString(16);return 1&t.length?"0"+t:t}function c(e){if("string"!=typeof e)throw Error("hex string expected, got "+typeof e);return""===e?i:BigInt("0x"+e)}function u(e){return c((0,n.ci)(e))}function f(e){return(0,n.gk)(e),c((0,n.ci)(Uint8Array.from(e).reverse()))}function h(e,t){return(0,n.nr)(e.toString(16).padStart(2*t,"0"))}function d(e,t){return h(e,t).reverse()}function p(e,t,r){let i;if("string"==typeof t)try{i=(0,n.nr)(t)}catch(t){throw Error(e+" must be hex string or Uint8Array, cause: "+t)}else if((0,n._t)(t))i=Uint8Array.from(t);else throw Error(e+" must be hex string or Uint8Array");let s=i.length;if("number"==typeof r&&s!==r)throw Error(e+" of length "+r+" expected, got "+s);return i}function g(e,t){if(e.length!==t.length)return!1;let r=0;for(let n=0;n<e.length;n++)r|=e[n]^t[n];return 0===r}function y(e){return Uint8Array.from(e)}let m=e=>"bigint"==typeof e&&i<=e;function b(e,t,r,n){if(!(m(t)&&m(r)&&m(n))||!(r<=t)||!(t<n))throw Error("expected valid "+e+": "+r+" <= n < "+n+", got "+t)}function w(e){let t;for(t=0;e>i;e>>=s,t+=1);return t}let v=e=>(s<<BigInt(e))-s;function E(e,t,r){if("number"!=typeof e||e<2)throw Error("hashLen must be a number");if("number"!=typeof t||t<2)throw Error("qByteLen must be a number");if("function"!=typeof r)throw Error("hmacFn must be a function");let i=e=>new Uint8Array(e),s=e=>Uint8Array.of(e),o=i(e),a=i(e),l=0,c=()=>{o.fill(1),a.fill(0),l=0},u=(...e)=>
vendor: 5,708 bytes, line 48
48r(a,o,...e),f=(e=i(0))=>{a=u(s(0),e),o=u(),0!==e.length&&(a=u(s(1),e),o=u())},h=()=>{if(l++>=1e3)throw Error("drbg: tried 1000 values");let e=0,r=[];for(;e<t;){let t=(o=u()).slice();r.push(t),e+=o.length}return(0,n.eV)(...r)};return(e,t)=>{let r;for(c(),f(e);!(r=t(h()));)f();return c(),r}}function x(e,t,r={}){if(!e||"object"!=typeof e)throw Error("expected valid options object");function n(t,r,n){let i=e[t];if(n&&void 0===i)return;let s=typeof i;if(s!==r||null===i)throw Error(`param "${t}" is invalid: expected ${r}, got ${s}`)}Object.entries(t).forEach(([e,t])=>n(e,t,!1)),Object.entries(r).forEach(([e,t])=>n(e,t,!0))}let _=()=>{throw Error("not implemented")};function A(e){let t=new WeakMap;return(r,...n)=>{let i=t.get(r);if(void 0!==i)return i;let s=e(r,...n);return t.set(r,s),s}}},73246:function(e,t,r){"use strict";r.d(t,{JQ:function(){return T},o:function(){return B}});var n=r(21007);class i extends n.kb{constructor(e,t,r,i){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=i,this.buffer=new Uint8Array(e),this.view=(0,n.GL)(this.buffer)}update(e){(0,n.$h)(this),e=(0,n.O0)(e),(0,n.gk)(e);let{view:t,buffer:r,blockLen:i}=this,s=e.length;for(let o=0;o<s;){let a=Math.min(i-this.pos,s-o);if(a===i){let t=(0,n.GL)(e);for(;i<=s-o;o+=i)this.process(t,o);continue}r.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===i&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){(0,n.$h)(this),(0,n.eB)(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:i,isLE:s}=this,{pos:o}=this;t[o++]=128,(0,n.ru)(this.buffer.subarray(o)),this.padOffset>i-o&&(this.process(r,0),o=0);for(let e=o;e<i;e++)t[e]=0;!function(e,t,r,n){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,n);let i=BigInt(32),s=BigInt(4294967295),o=Number(r>>i&s),a=Number(r&s),l=n?4:0,c=n?0:4;e.setUint32(t+l,o,n),e.setUint32(t+c,a,n)}(r,i-8,BigInt(8*this.length),s),this.process(r,0);let a=(0,n.GL)(e),l=this.outputLen;if(l%4)throw Error("_sha2: outputLen should be aligned to 32bit");let c=l/4,u=this.get();if(c>u.length)throw Error("_sha2: outputLen bigger than state");for(let e=0;e<c;e++)a.setUint32(4*e,u[e],s)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:r,length:n,finished:i,destroyed:s,pos:o}=this;return e.destroyed=s,e.finished=i,e.length=n,e.pos=o,n%t&&e.buffer.set(r),e}clone(){return this._cloneInto()}}let s=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),o=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),a=BigInt(4294967296-1),l=BigInt(32),c=(e,t,r)=>e>>>r,u=(e,t,r)=>e<<32-r|t>>>r,f=(e,t,r)=>e>>>r|t<<32-r,h=(e,t,r)=>e<<32-r|t>>>r,d=(e,t,r)=>e<<64-r|t>>>r-32,p=(e,t,r)=>e>>>r-32|t<<64-r;function g(e,t,r,n){let i=(t>>>0)+(n>>>0);return{h:e+r+(i/4294967296|0)|0,l:0|i}}let y=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),m=(e,t,r,n)=>t+r+n+(e/4294967296|0)|0,b=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),w=(e,t,r,n,i)=>t+r+n+i+(e/4294967296|0)|0,v=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0),E=(e,t,r,n,i,s)=>t+r+n+i+s+(e/4294967296|0)|0,x=Uint32Array.from([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]),_=new Uint32Array(64);class A extends i{constructor(e=32){super(64,e,8,!1),this.A=0|s[0],this.B=0|s[1],this.C=0|s[2],this.D=0|s[3],this.E=0|s[4],this.F=0|s[5],this.G=0|s[6],this.H=0|s[7]}get(){let{A:e,B:t,C:r,D:n,E:i,F:s,G:o,H:a}=this;return[e,t,r,n,i,s,o,a]}set(e,t,r,n,i,s,o,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|s,this.G=0|o,this.H=0|a}process(e,t){for(let r=0;r<16;r++,t+=4)_[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=_[e-15],r=_[e-2],i=(0,n.np)(t,7)^(0,n.np)(t,18)^t>>>3,s=(0,n.np)(r,17)^(0,n.np)(r,19)^r>>>10;_[e]=s+_[e-7]+i+_[e-16]|0}let{A:r,B:i,C:s,D:o,E:a,F:l,G:c,H:u}=this;for(let e=0;e<64;e++){var f,h,d,p;let t=u+((0,n.np)(a,6)^(0,n.np)(a,11)^(0,n.np)(a,25))+((f=a)&l^~f&c)+x[e]+_[e]|0,g=((0,n.np)(r,2)^(0,n.np)(r,13)^(0,n.np)(r,22))+((h=r)&(d=i)^h&(p=s)^d&p)|0;u=c,c=l,l=a,a=o+t|0,o=s,s=i,i=r,r=t+g|0}r=r+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,a=a+this.E|0,l=l+this.F|0,c=c+this.G|0,u=u+this.H|0,this.set(r,i,s,o,a,l,c,u)}roundClean(){(0,n.ru)(_)}destroy(){this.set(0,0,0,0,0,0,0,0),(0,n.ru)(this.buffer)}}let S=function(e,t=!1){let r=e.length,n=new Uint32Array(r),i=new Uint32Array(r);for(let s=0;s<r;s++){let{h:r,l:o}=function(e,t=!1){return t?{h:Number(e&a),l:Number(e>>l&a)}:{h:0|Number(e>>l&a),l:0|Number(e&a)}}(e[s],t);[n[s],i[s]]=[r,o]}return[n,i]}(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b89
486f","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))),I=S[0],O=S[1],P=new Uint32Array(80),C=new Uint32Array(80);class k extends i{constructor(e=64){super(128,e,16,!1),this.Ah=0|o[0],this.Al=0|o[1],this.Bh=0|o[2],this.Bl=0|o[3],this.Ch=0|o[4],this.Cl=0|o[5],this.Dh=0|o[6],this.Dl=0|o[7],this.Eh=0|o[8],this.El=0|o[9],this.Fh=0|o[10],this.Fl=0|o[11],this.Gh=0|o[12],this.Gl=0|o[13],this.Hh=0|o[14],this.Hl=0|o[15]}get(){let{Ah:e,Al:t,Bh:r,Bl:n,Ch:i,Cl:s,Dh:o,Dl:a,Eh:l,El:c,Fh:u,Fl:f,Gh:h,Gl:d,Hh:p,Hl:g}=this;return[e,t,r,n,i,s,o,a,l,c,u,f,h,d,p,g]}set(e,t,r,n,i,s,o,a,l,c,u,f,h,d,p,g){this.Ah=0|e,this.Al=0|t,this.Bh=0|r,this.Bl=0|n,this.Ch=0|i,this.Cl=0|s,this.Dh=0|o,this.Dl=0|a,this.Eh=0|l,this.El=0|c,this.Fh=0|u,this.Fl=0|f,this.Gh=0|h,this.Gl=0|d,this.Hh=0|p,this.Hl=0|g}process(e,t){for(let r=0;r<16;r++,t+=4)P[r]=e.getUint32(t),C[r]=e.getUint32(t+=4);for(let e=16;e<80;e++){let t=0|P[e-15],r=0|C[e-15],n=f(t,r,1)^f(t,r,8)^c(t,r,7),i=h(t,r,1)^h(t,r,8)^u(t,r,7),s=0|P[e-2],o=0|C[e-2],a=f(s,o,19)^d(s,o,61)^c(s,o,6),l=b(i,h(s,o,19)^p(s,o,61)^u(s,o,6),C[e-7],C[e-16]),g=w(l,n,a,P[e-7],P[e-16]);P[e]=0|g,C[e]=0|l}let{Ah:r,Al:n,Bh:i,Bl:s,Ch:o,Cl:a,Dh:l,Dl:x,Eh:_,El:A,Fh:S,Fl:k,Gh:T,Gl:B,Hh:R,Hl:D}=this;for(let e=0;e<80;e++){let t=f(_,A,14)^f(_,A,18)^d(_,A,41),c=h(_,A,14)^h(_,A,18)^p(_,A,41),u=_&S^~_&T,b=v(D,c,A&k^~A&B,O[e],C[e]),w=E(b,R,t,u,I[e],P[e]),U=0|b,M=f(r,n,28)^d(r,n,34)^d(r,n,39),N=h(r,n,28)^p(r,n,34)^p(r,n,39),j=r&i^r&o^i&o,L=n&s^n&a^s&a;R=0|T,D=0|B,T=0|S,B=0|k,S=0|_,k=0|A,({h:_,l:A}=g(0|l,0|x,0|w,0|U)),l=0|o,x=0|a,o=0|i,a=0|s,i=0|r,s=0|n;let $=y(U,N,L);r=m($,w,M,j),n=0|$}({h:r,l:n}=g(0|this.Ah,0|this.Al,0|r,0|n)),({h:i,l:s}=g(0|this.Bh,0|this.Bl,0|i,0|s)),({h:o,l:a}=g(0|this.Ch,0|this.Cl,0|o,0|a)),({h:l,l:x}=g(0|this.Dh,0|this.Dl,0|l,0|x)),({h:_,l:A}=g(0|this.Eh,0|this.El,0|_,0|A)),({h:S,l:k}=g(0|this.Fh,0|this.Fl,0|S,0|k)),({h:T,l:B}=g(0|this.Gh,0|this.Gl,0|T,0|B)),({h:R,l:D}=g(0|this.Hh,0|this.Hl,0|R,0|D)),this.set(r,n,i,s,o,a,l,x,_,A,S,k,T,B,R,D)}roundClean(){(0,n.ru)(P,C)}destroy(){(0,n.ru)(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}let T=(0,n.V1)(()=>new A),B=(0,n.V1)(()=>new k)},21007:function(e,t,r){"use strict";r.d(t,{kb:function(){return x},gk:function(){return o},$h:function(){return l},z3:function(){return a},k8:function(){return s},eB:function(){return c},ci:function(){return g},ru:function(){return u},eV:function(){return E},V1:function(){return _},GL:function(){return f},nr:function(){return b},_t:function(){return i},O6:function(){return A},np:function(){return h},O0:function(){return v},iY:function(){return w}});let n="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function i(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function s(e){if(!Number.isSafeInteger(e)||e<0)throw Error("positive integer expected, got "+e)}function o(e,...t){if(!i(e))throw Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw Error("Uint8Array expected of length "+t+", got length="+e.length)}function a(e){if("function"!=typeof e||"function"!=typeof e.create)throw Error("Hash should be wrapped by utils.createHasher");s(e.outputLen),s(e.blockLen)}function l(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}function c(e,t){o(e);let r=t.outputLen;if(e.length<r)throw Error("digestInto() expects output buffer of length at least "+r)}function u(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function f(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function h(e,t){return e<<32-t|e>>>t}let d="function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex,p=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function g(e){if(o(e),d)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=p[e[r]];return t}let y={_0:48,_9:57,A:65,F:70,a:97,f:102};function m(e){return e>=y._0&&e<=y._9?e-y._0:e>=y.A&&e<=y.F?e-(y.A-10):e>=y.a&&e<=y.f?e-(y.a-10):void 0}function b(e){if("string"!=typeof e)throw Error("hex string expected, got "+typeof e);if(d)return Uint8Array.fromHex(e);let t=e.length,r=t/2;if(t%2)throw Error("hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(r);for(let t=0,i=0;t<r;t++,i+=2){let r=m(e.charCodeAt(i)),s=m(e.charCodeAt(i+1));if(void 0===r||void 0===s)throw Error('hex string expected, got non-hex character "'+(e[i]+e[i+1])+'" at index '+i);n[t]=16*r+s}return n}function w(e){if("string"!=typeof e)throw Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function v(e){return"string"==typeof e&&(e=w(e)),o(e),e}function E(...e){let t=0;for(let r=0;r<e.length;r++){let n=e[r];o(n),t+=n.length}let r=new Uint8Array(t);for(let t=0,n=0;t<e.length;t++){let i=e[t];r.set(i,n),n+=i.length}return r}class x{}function _(e){let t=t=>e().update(v(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function A(e=32){if(n&&"function"==typeof n.getRandomValues)return n.getRandomValues(new Uint8Array(e));if(n&&"function"==typeof n.randomBytes)return Uint8Array.from(n.randomBytes(e));throw Error("crypto.getRandomValues must be defined")}},90626:function(e,t,r){"use strict";r.d(t,{G:function(){return i}});var n=r(520);let i=e=>e.map(e=>{if(e.rpcUrls.privyWalletOverride)return e;let t=n.B.find(t=>
48t.id===e.id),r=t?.rpcUrls.privy?.http[0];return r?{...e,rpcUrls:{...e.rpcUrls,privy:{http:[r]}}}:e})},520:function(e,t,r){"use strict";r.d(t,{B:function(){return b},e:function(){return w}});var n=r(85470),i=r(8891),s=r(1229),o=r(93352),a=r(26072),l=r(3265),c=r(48744),u=r(71683),f=r(21207),h=r(23561),d=r(38795),p=r(7455),g=r(93784),y=r(16914),m=r(88253);let b=[f.R,y.F,{id:17e3,name:"Holesky",network:"holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://ethereum-holesky.publicnode.com"]},public:{http:["https://ethereum-holesky.publicnode.com"]}},blockExplorers:{etherscan:{name:"EtherScan",url:"https://holesky.etherscan.io"},default:{name:"EtherScan",url:"https://holesky.etherscan.io"}}},n.y,i.Z,h.v,d.O,p.y,g.v,c.D,{id:44787,name:"Celo Alfajores Testnet",network:"celo-alfajores",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://alfajores-forno.celo-testnet.org"]},infura:{http:["https://celo-alfajores.infura.io/v3"]},public:{http:["https://alfajores-forno.celo-testnet.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/alfajores"},etherscan:{name:"CeloScan",url:"https://alfajores.celoscan.io/"}},testnet:!0},{id:314,name:"Filecoin - Mainnet",network:"filecoin-mainnet",nativeCurrency:{decimals:18,name:"filecoin",symbol:"FIL"},rpcUrls:{default:{http:["https://api.node.glif.io/rpc/v1"]},public:{http:["https://api.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filfox",url:"https://filfox.info/en"},filscan:{name:"Filscan",url:"https://filscan.io"},filscout:{name:"Filscout",url:"https://filscout.io/en"},glif:{name:"Glif",url:"https://explorer.glif.io"}}},{id:314159,name:"Filecoin - Calibration testnet",network:"filecoin-calibration",nativeCurrency:{decimals:18,name:"testnet filecoin",symbol:"tFIL"},rpcUrls:{default:{http:["https://api.calibration.node.glif.io/rpc/v1"]},public:{http:["https://api.calibration.node.glif.io/rpc/v1"]}},blockExplorers:{default:{name:"Filscan",url:"https://calibration.filscan.io"}}},a.u,l.L,{id:80085,network:"berachain-artio",name:"Berachain Artio",nativeCurrency:{name:"BERA",symbol:"BERA",decimals:18},rpcUrls:{default:{http:["https://berachain-artio.rpc.privy.systems"]},public:{http:["https://berachain-artio.rpc.privy.systems"]}},blockExplorers:{default:{name:"Beratrail",url:"https://artio.beratrail.io"}},testnet:!0},{id:56,network:"bsc",name:"Binance Smart Chain",nativeCurrency:{name:"BNB",symbol:"BNB",decimals:18},rpcUrls:{privy:{http:["https://bsc-mainnet.rpc.privy.systems"]},default:{http:["https://56.rpc.thirdweb.com"]},public:{http:["https://56.rpc.thirdweb.com"]}},blockExplorers:{etherscan:{name:"BscScan",url:"https://bscscan.com"},default:{name:"BscScan",url:"https://bscscan.com"}}},{id:43419,name:"Gunz Mainnet",network:"gunz",nativeCurrency:{name:"GUN",symbol:"GUN",decimals:18},rpcUrls:{privy:{http:["https://gunz-mainnet.rpc.privy.systems"]},default:{http:["https://rpc.gunzchain.io/ext/bc/2M47TxWHGnhNtq6pM5zPXdATBtuqubxn5EPFgFmEawCQr9WFML/rpc"]},public:{http:["https://rpc.gunzchain.io/ext/bc/2M47TxWHGnhNtq6pM5zPXdATBtuqubxn5EPFgFmEawCQr9WFML/rpc"]}},blockExplorers:{default:{name:"Gunz Explorer",url:"https://gunzscan.io"}}},{id:13371,name:"Immutable zkEVM",network:"immutable-zkevm",nativeCurrency:{name:"Immutable Coin",symbol:"IMX",decimals:18},rpcUrls:{privy:{http:["https://immutable-mainnet.rpc.privy.systems"]},default:{http:["https://rpc.immutable.com"]},public:{http:["https://rpc.immutable.com"]}},blockExplorers:{default:{name:"Immutable Explorer",url:"https://explorer.immutable.com"}}},{id:42,network:"lukso",name:"LUKSO",nativeCurrency:{name:"LUKSO",symbol:"LYX",decimals:18},rpcUrls:{default:{http:["https://rpc.mainnet.lukso.network"],webSocket:["wss://ws-rpc.mainnet.lukso.network"]}},blockExplorers:{default:{name:"LUKSO Mainnet Explorer",url:"https://explorer.execution.mainnet.lukso.network"}}},u.P,{id:59140,network:"linea-testnet",name:"Linea Goerli Testnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{infura:{http:["https://linea-goerli.infura.io/v3"],webSocket:["wss://linea-goerli.infura.io/ws/v3"]},default:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]},public:{http:["https://rpc.goerli.linea.build"],webSocket:["wss://rpc.goerli.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://goerli.lineascan.build"},etherscan:{name:"Etherscan",url:"https://goerli.lineascan.build"}},testnet:!0},s.p,o.c,{id:1868,name:"Soneium Mainnet",network:"soneium",nativeCurrency:{name:"Ether",symbol
48:"ETH",decimals:18},rpcUrls:{privy:{http:["https://soneium-mainnet.rpc.privy.systems"]},default:{http:["https://rpc.soneium.org"]},public:{http:["https://rpc.soneium.org"]}},blockExplorers:{default:{name:"Blockscout",url:"https://soneium.blockscout.com"}}},{id:130,name:"Unichain",network:"unichain",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://unichain-mainnet.rpc.privy.systems"]},default:{http:["https://mainnet.unichain.org"]},public:{http:["https://mainnet.unichain.org"]}},blockExplorers:{default:{name:"Uniscan",url:"https://uniscan.xyz"}}},m.l,{id:999,name:"Zora Goerli Testnet",network:"zora-testnet",nativeCurrency:{decimals:18,name:"Zora Goerli",symbol:"ETH"},rpcUrls:{default:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]},public:{http:["https://testnet.rpc.zora.energy"],webSocket:["wss://testnet.rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://testnet.explorer.zora.energy"}},testnet:!0},{id:999999999,name:"Zora Sepolia",network:"zora-sepolia",nativeCurrency:{decimals:18,name:"Zora Sepolia",symbol:"ETH"},rpcUrls:{default:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]},public:{http:["https://sepolia.rpc.zora.energy"],webSocket:["wss://sepolia.rpc.zora.energy"]}},blockExplorers:{default:{name:"Zora Sepolia Explorer",url:"https://sepolia.explorer.zora.energy/"}},testnet:!0},{id:690,name:"Redstone",network:"redstone",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.redstonechain.com"]},public:{http:["https://rpc.redstonechain.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.redstone.xyz/"}}},{id:17069,name:"Garnet Holesky",network:"garnet-holesky",nativeCurrency:{name:"ETH",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.garnetchain.com"]},public:{http:["https://rpc.garnetchain.com"]}},blockExplorers:{default:{name:"Blockscout",url:"https://explorer.garnetchain.com"}}}],w=new Set(b.map(e=>e.id))},85470:function(e,t,r){"use strict";r.d(t,{y:function(){return n}});let n={id:42161,name:"Arbitrum One",network:"arbitrum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://arbitrum-mainnet.rpc.privy.systems"]},alchemy:{http:["https://arb-mainnet.g.alchemy.com/v2"],webSocket:["wss://arb-mainnet.g.alchemy.com/v2"]},infura:{http:["https://arbitrum-mainnet.infura.io/v3"],webSocket:["wss://arbitrum-mainnet.infura.io/ws/v3"]},default:{http:["https://arb1.arbitrum.io/rpc"]},public:{http:["https://arb1.arbitrum.io/rpc"]}},blockExplorers:{etherscan:{name:"Arbiscan",url:"https://arbiscan.io"},default:{name:"Arbiscan",url:"https://arbiscan.io"}}}},8891:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});let n={id:421614,name:"Arbitrum Sepolia",network:"arbitrum-sepolia",nativeCurrency:{name:"Arbitrum Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://arbitrum-sepolia.rpc.privy.systems"]}
48,default:{http:["https://sepolia-rollup.arbitrum.io/rpc"]},public:{http:["https://sepolia-rollup.arbitrum.io/rpc"]}},blockExplorers:{default:{name:"Blockscout",url:"https://sepolia-explorer.arbitrum.io"}},testnet:!0}},1229:function(e,t,r){"use strict";r.d(t,{p:function(){return n}});let n={id:43114,name:"Avalanche",network:"avalanche",nativeCurrency:{decimals:18,name:"Avalanche",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax.network/ext/bc/C/rpc"]},public:{http:["https://api.avax.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://snowtrace.io"},default:{name:"SnowTrace",url:"https://snowtrace.io"}}}},93352:function(e,t,r){"use strict";r.d(t,{c:function(){return n}});let n={id:43113,name:"Avalanche Fuji",network:"avalanche-fuji",nativeCurrency:{decimals:18,name:"Avalanche Fuji",symbol:"AVAX"},rpcUrls:{default:{http:["https://api.avax-test.network/ext/bc/C/rpc"]},public:{http:["https://api.avax-test.network/ext/bc/C/rpc"]}},blockExplorers:{etherscan:{name:"SnowTrace",url:"https://testnet.snowtrace.io"},default:{name:"SnowTrace",url:"https://testnet.snowtrace.io"}},testnet:!0}},26072:function(e,t,r){"use strict";r.d(t,{u:function(){return n}});let n={id:8453,network:"base",name:"Base",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://base-mainnet.rpc.privy.systems"]},default:{http:["https://mainnet.base.org"]},public:{http:["https://mainnet.base.org"]}},blockExplorers:{etherscan:{name:"Basescan",url:"https://basescan.org"},default:{name:"Basescan",url:"https://basescan.org"}}}},3265:function(e,t,r){"use strict";r.d(t,{L:function(){return n}});let n={id:84532,network:"base-sepolia",name:"Base Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://base-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia.base.org"]},public:{http:["https://sepolia.base.org"]}},blockExplorers:{default:{name:"Blockscout",url:"https://base-sepolia.blockscout.com"}},testnet:!0}},48744:function(e,t,r){"use strict";r.d(t,{D:function(){return n}});let n={id:42220,name:"Celo Mainnet",network:"celo",nativeCurrency:{decimals:18,name:"CELO",symbol:"CELO"},rpcUrls:{default:{http:["https://forno.celo.org"]},infura:{http:["https://celo-mainnet.infura.io/v3"]},public:{http:["https://forno.celo.org"]}},blockExplorers:{default:{name:"Celo Explorer",url:"https://explorer.celo.org/mainnet"},etherscan:{name:"CeloScan",url:"https://celoscan.io"}},testnet:!1}},71683:function(e,t,r){"use strict";r.d(t,{P:function(){return n}});let n={id:59144,network:"linea-mainnet",name:"Linea Mainnet",nativeCurrency:{name:"Linea Ether",symbol:"ETH",decimals:18},rpcUrls:{default:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]},public:{http:["https://rpc.linea.build"],webSocket:["wss://rpc.linea.build"]}},blockExplorers:{default:{name:"Etherscan",url:"https://lineascan.build"},etherscan:{name:"Etherscan",url:"https://lineascan.build"}},testnet:!1}},21207:function(e,t,r){"use strict";r.d(t,{R:function(){return n}});let n={id:1,network:"homestead",name:"Ethereum",nativeCurrency:{name:"Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://mainnet.rpc.privy.systems"]},alchemy:{http:["https://eth-mainnet.g.alchemy.com/v2"],webSocket:["wss://eth-mainnet.g.alchemy.com/v2"]},infura:{http:["https://mainnet.infura.io/v3"],webSocket:["wss://mainnet.infura.io/ws/v3"]},default:{http:["https://cloudflare-eth.com"]},public:{http:["https://cloudflare-eth.com"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://etherscan.io"},default:{name:"Etherscan",url:"https://etherscan.io"}}}},76470:function(e,t,r){"use strict";r.d(t,{m:function(){return n}});let n={id:143,name:"Monad",network:"monad",nativeCurrency:{name:"Monad",symbol:"MON",decimals:18},rpcUrls:{privy:{http:["https://monad-mainnet.rpc.privy.systems"]},default:{http:["https://rpc.monad.xyz"]},public:{http:["https://rpc.monad.xyz"]}},blockExplorers:{default:{name:"Monadscan",url:"https://mainnet-beta.monvision.io"}}}},23561:function(e,t,r){"use strict";r.d(t,{v:function(){return n}});let n={id:10,name:"OP Mainnet",network:"optimism",nativeCurrency:{name:"Ether",symbol
48:"ETH",decimals:18},rpcUrls:{privy:{http:["https://optimism-mainnet.rpc.privy.systems"]},alchemy:{http:["https://opt-mainnet.g.alchemy.com/v2"],webSocket:["wss://opt-mainnet.g.alchemy.com/v2"]},infura:{http:["https://optimism-mainnet.infura.io/v3"],webSocket:["wss://optimism-mainnet.infura.io/ws/v3"]},default:{http:["https://mainnet.optimism.io"]},public:{http:["https://mainnet.optimism.io"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://optimistic.etherscan.io"},default:{name:"Optimism Explorer",url:"https://explorer.optimism.io"}}}},38795:function(e,t,r){"use strict";r.d(t,{O:function(){return n}});let n={id:11155420,name:"Optimism Sepolia",network:"optimism-sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"ETH",decimals:18},rpcUrls:{privy:{http:["https://optimism-sepolia.rpc.privy.systems"]},default:{http:["https://sepolia.optimism.io"]},public:{http:["https://sepolia.optimism.io"]},infura:{http:["https://optimism-sepolia.infura.io/v3"]}},blockExplorers:{default:{name:"Blockscout",url:"https://optimism-sepolia.blockscout.com"}},testnet:!0}},7455:function(e,t,r){"use strict";r.d(t,{y:function(){return n}});let n={id:137,name:"Polygon Mainnet",network:"polygon",nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{privy:{http:["https://polygon-mainnet.rpc.privy.systems"]},alchemy:{http:["https://polygon-mainnet.g.alchemy.com/v2"],webSocket:["wss://polygon-mainnet.g.alchemy.com/v2"]},infura:{http:["https://polygon-mainnet.infura.io/v3"],webSocket:["wss://polygon-mainnet.infura.io/ws/v3"]},default:{http:["https://polygon-rpc.com"]},public:{http:["https://polygon-rpc.com"]}},blockExplorers:{etherscan:{name:"PolygonScan",url:"https://polygonscan.com"},default:{name:"PolygonScan",url:"https://polygonscan.com"}}}},93784:function(e,t,r){"use strict";r.d(t,{v:function(){return n}});let n={id:80002,name:"Polygon Amoy",network:"polygon-amoy",nativeCurrency:{name:"POL",symbol:"POL",decimals:18},rpcUrls:{privy:{http:["https://polygon-amoy.rpc.privy.systems"]},infura:{http:["https://polygon-amoy.infura.io/v3"],webSocket:["wss://polygon-amoy.infura.io/ws/v3"]},default:{http:["https://rpc-amoy.polygon.technology"]}},blockExplorers:{default:{name:"OK LINK",url:"https://www.oklink.com/amoy"}},testnet:!0}},16914:function(e,t,r){"use strict";r.d(t,{F:function(){return n}});let n={id:11155111,network:"sepolia",name:"Sepolia",nativeCurrency:{name:"Sepolia Ether",symbol:"SEP",decimals:18},rpcUrls:{privy:{http:["https://sepolia.rpc.privy.systems"]},alchemy:{http:["https://eth-sepolia.g.alchemy.com/v2"],webSocket:["wss://eth-sepolia.g.alchemy.com/v2"]},infura:{http:["https://sepolia.infura.io/v3"],webSocket:["wss://sepolia.infura.io/ws/v3"]},default:{http:["https://rpc.sepolia.org"]},public:{http:["https://rpc.sepolia.org"]}},blockExplorers:{etherscan:{name:"Etherscan",url:"https://sepolia.etherscan.io"},default:{name:"Etherscan",url:"https://sepolia.etherscan.io"}},testnet:!0}},88253:function(e,t,r){"use strict";r.d(t,{l:function(){return n}});let n={id:7777777,name:"Zora",network:"zora",nativeCurrency:{decimals:18,name:"Ether",symbol:"ETH"},rpcUrls:{privy:{http:["https://zora-mainnet.rpc.privy.systems"]},default:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]},public:{http:["https://rpc.zora.energy"],webSocket:["wss://rpc.zora.energy"]}},blockExplorers:{default:{name:"Explorer",url:"https://explorer.zora.energy"}}}},84736:function(e,t,r){"use strict";r.d(t,{j:function(){return o}});var n=r(91799);let i=new TextEncoder,s=new TextDecoder,o={utf8:{fromBytes:e=>s.decode(e),toBytes:e=>Uint8Array.from(i.encode(e))},base64:{fromBytes:e=>n.US.encode(e),toBytes:e=>{try{return Uint8Array.from(n.US.decode(e))}catch(t){if(t instanceof Error&&t.message.includes("string should have whole number of bytes"))return Uint8Array.from(n.Yd.decode(e));throw t}}},base64url:{fromBytes:e=>n.tH.encode(e),toBytes:e=>Uint8Array.from(n.tH.decode(e))},hex:{fromBytes:e=>n.$v.encode(e),toBytes:e=>Uint8Array.from(n.$v.decode(e))}}},67037:function(e,t,r){"use strict";r.d(t,{Wh:function(){return s},dx:function(){return i},fP:function(){return n}});
48class n extends Error{constructor({error:e,code:t,status:r}){super(e),this.name="PrivyApiError",this.error=e,this.code=t,this.status=r}}class i extends Error{constructor({error:e,code:t}){super(e),this.code=t,this.error=e}}class s extends Error{constructor({error:e,code:t,response:r}){super(e),this.code=t,this.error=e,this.response=r}}},87201:function(e,t,r){"use strict";var n;r.d(t,{C5:function(){return l},M9:function(){return a},AY:function(){return o},M_:function(){return c},YS:function(){return u}});let i=["error","invalid_request_arguments","wallet_not_on_device","invalid_recovery_pin","insufficient_funds","mfa_timeout","missing_or_invalid_mfa","mfa_verification_max_attempts_reached"];(n={}).MISSING_OR_INVALID_PRIVY_APP_ID="missing_or_invalid_privy_app_id",n.MISSING_OR_INVALID_PRIVY_ACCOUNT_ID="missing_or_invalid_privy_account_id",n.INVALID_DATA="invalid_data",n.LINKED_TO_ANOTHER_USER="linked_to_another_user",n.ALLOWLIST_REJECTED="allowlist_rejected",n.OAUTH_USER_DENIED="oauth_user_denied",n.UNKNOWN_AUTH_ERROR="unknown_auth_error",n.USER_EXITED_AUTH_FLOW="exited_auth_flow",n.MUST_BE_AUTHENTICATED="must_be_authenticated",n.UNKNOWN_CONNECT_WALLET_ERROR="unknown_connect_wallet_error",n.GENERIC_CONNECT_WALLET_ERROR="generic_connect_wallet_error",n.CLIENT_REQUEST_TIMEOUT="client_request_timeout",n.INVALID_CREDENTIALS="invalid_credentials";class s extends Error{toString(){return`${this.type}${this.privyErrorCode?`-${this.privyErrorCode}`:""}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}constructor(e,t,r){super(e),t instanceof Error&&(this.cause=t),this.privyErrorCode=r}}class o extends Error{constructor(e,t){super(t),this.type=e}}class a extends s{constructor(e,t,r){super(e,t,r),this.type="connector_error"}}class l extends Error{constructor(e,t,r){super(e),this.code=t,this.data=r}}let c={UNKNOWN_ERROR:{eipCode:0,message:"Unknown error",detail:"Unknown error",retryable:!0},E4001_DEFAULT_USER_REJECTED_REQUEST:{eipCode:4001,message:"User Rejected Request",detail:"The user rejected the request.",default:!0,retryable:!0},E4100_DEFAULT_UNAUTHORIZED:{eipCode:4100,message:"Unauthorized",detail:"The requested method and/or account has not been authorized by the user.",default:!0,retryable:!1},E4200_DEFAULT_UNSUPPORTED_METHOD:{eipCode:4200,message:"Unsupported Method",detail:"The Provider does not support the requested method.",default:!0,retryable:!1},E4900_DEFAULT_DISCONNECTED:{eipCode:4900,message:"Disconnected",detail:"The Provider is disconnected from all chains.",default:!0,retryable:!0},E4901_DEFAULT_CHAIN_DISCONNECTED:{eipCode:4901,message:"Chain Disconnected",detail:"The Provider is not connected to the requested chain.",default:!0,retryable:!0},E32700_DEFAULT_PARSE_ERROR:{eipCode:-32700,message:"Parse error",detail:"Invalid JSON",default:!0,retryable:!1},E32600_DEFAULT_INVALID_REQUEST:{eipCode:-32600,message:"Invalid request",detail:"JSON is not a valid request object",default:!0,retryable:!1},E32601_DEFAULT_METHOD_NOT_FOUND:{eipCode:-32601,message:"Method not found",detail:"Method does not exist",default:!0,retryable:!1},E32602_DEFAULT_INVALID_PARAMS:{eipCode:-32602,message:"Invalid params",detail:"Invalid method parameters",default:!0,retryable:!1},E32603_DEFAULT_INTERNAL_ERROR:{eipCode:-32603,message:"Internal error",detail:"Internal JSON-RPC error",default:!0,retryable:!0},E32000_DEFAULT_INVALID_INPUT:{eipCode:-32e3,message:"Invalid input",detail:"Missing or invalid parameters",default:!0,retryable:!1},E32001_DEFAULT_RESOURCE_NOT_FOUND:{eipCode:-32001,message:"Resource not found",detail:"Requested resource not found",default:!0,retryable:!1},E32002_DEFAULT_RESOURCE_UNAVAILABLE:{eipCode:-32002,message:"Resource unavailable",detail:"Requested resource not available",default:!0,retryable:!0},E32003_DEFAULT_TRANSACTION_REJECTED:{eipCode:-32003,message:"Transaction rejected",detail:"Transaction creation failed",default:!0,retryable:!0},E32004_DEFAULT_METHOD_NOT_SUPPORTED:{eipCode:-32004,message:"Method not supported",detail:"Method is not implemented",default:!0,retryable:!1},E32005_DEFAULT_LIMIT_EXCEEDED:{eipCode:-32005,message:"Limit exceeded",detail
48:"Request exceeds defined limit",default:!0,retryable:!1},E32006_DEFAULT_JSON_RPC_VERSION_NOT_SUPPORTED:{eipCode:-32006,message:"JSON-RPC version not supported",detail:"Version of JSON-RPC protocol is not supported",default:!0,retryable:!1},E32002_CONNECTION_ALREADY_PENDING:{eipCode:-32002,message:"Connection request already pending",detail:"Donât see your wallet? Check your other browser windows.",retryable:!1},E32002_REQUEST_ALREADY_PENDING:{eipCode:-32002,message:"Resource request already pending",detail:"Donât see your wallet? Check your other browser windows.",retryable:!1},E32002_WALLET_LOCKED:{eipCode:-32002,message:"Wallet might be locked",detail:"Donât see your wallet? Check your other browser windows.",retryable:!1},E4001_USER_REJECTED_REQUEST:{eipCode:4001,message:"Signature rejected",detail:"Please try signing again.",retryable:!0}};function u(e){let t;return"string"==typeof(t=e.type)&&i.includes(t)&&"wallet_not_on_device"===e.type}},5653:function(e,t,r){"use strict";function n(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}r.d(t,{O:function(){return l}});var i=0;function s(e){return"__private_"+i+++"_"+e}var o=s("_wallet"),a=s("_account");class l{get standardWallet(){return n(this,o)[o]}get address(){return n(this,a)[a].address}async disconnect(){if(!n(this,o)[o].features["standard:disconnect"]?.disconnect)throw Error("Wallet does not support disconnect");await n(this,o)[o].features["standard:disconnect"].disconnect()}async signMessage(...e){if(!n(this,o)[o].features["solana:signMessage"]?.signMessage)throw Error("Wallet does not support signMessage");let t=await n(this,o)[o].features["solana:signMessage"].signMessage(...e.map(e=>({...e,account:n(this,a)[a]})));return 1===e.length?t[0]:[...t]}async signTransaction(...e){if(!n(this,o)[o].features["solana:signTransaction"]?.signTransaction)throw Error("Wallet does not support signTransaction");let t=await n(this,o)[o].features["solana:signTransaction"].signTransaction(...e.map(e=>({...e,account:n(this,a)[a]})));return 1===e.length?t[0]:[...t]}async signAndSendTransaction(...e){if(!n(this,o)[o].features["solana:signAndSendTransaction"]?.signAndSendTransaction)throw Error("Wallet does not support signAndSendTransaction");let t=await n(this,o)[o].features["solana:signAndSendTransaction"].signAndSendTransaction(...e.map(e=>({...e,account:n(this,a)[a]})));return 1===e.length?t[0]:[...t]}async signAndSendAllTransactions(e){if(!n(this,o)[o].features["solana:signAndSendTransaction"]?.signAndSendTransaction)throw Error("Wallet does not support signAndSendTransaction");return[...await n(this,o)[o].features["solana:signAndSendTransaction"].signAndSendTransaction(...e.map(e=>({...e,account:n(this,a)[a]})))]}constructor({wallet:e,account:t}){Object.defineProperty(this,o,{writable:!0,value:void 0}),Object.defineProperty(this,a,{writable:!0,value:void 0}),n(this,o)[o]=e,n(this,a)[a]=t}}},8764:function(e,t,r){"use strict";r.d(t,{U:function(){return i}});var n=r(2725);async function i(e,{request:t,headers:r}){return await e.fetchPrivyRoute(n.zd,{body:t,headers:r})}},1064:function(e,t,r){"use strict";r.d(t,{f:function(){return c}});var n=r(2725),i=r(81524),s=r(84736),o=r(67037);async function a(e,t){let r;if(t instanceof Uint8Array)r=s.j.base64.fromBytes(t);else{let e=i(t);if(void 0===e)throw new o.dx({error:"Failed to prepare the payload for signing",code:"invalid_input"});r=s.j.base64.fromBytes(s.j.utf8.toBytes(e))}let{signature:n}=await e({message:r});return{signature:n}}let l="privy-request-expiry";async function c(e,t,{wallet_id:r,...i}){let s=e.getCompiledPath(n.dQ,{params:{wallet_id:r}}),o=String(Date.now()+18e5),c={version:1,url:s,method:n.dQ.method,headers:{"privy-app-id":e.app.appId,[l]:o},body:{...i}},{signature:u}=await a(t,c);return await e.fetchPrivyRoute(n.dQ,{body:i,params:{wallet_id:r},headers:{"privy-authorization-signature":u,[l]:o}})}},7756:function(e,t,r){"use strict";r.d(t,{X:function(){return i}});let n=({w:e,h:t})=>{let r=void 0!==window.screenLeft?window.screenLeft:window.screenX,n=void 0!==window.screenTop?window.screenTop:window.screenY,i=window.innerWidth?window.innerWidth:document.documentElement.clientWidth?document.documentElement.clientWidth:screen.width,s=window.innerHeight?window.innerHeight:document.documentElement.clientHeight?document.documentElement.clientHeight:screen.height;return`toolbar=0,location=0,menubar=0,height=${t},width=${e}
48,popup=1,left=${(i-e)/2/(i/window.screen.availWidth)+r},top=${(s-t)/2/(s/window.screen.availHeight)+n}`},i=e=>window.open(e?.location,void 0,n({w:440,h:680}))},97629:function(e,t,r){"use strict";r.d(t,{P:function(){return o},a:function(){return a},g:function(){return l},u:function(){return c}});var n=r(57437),i=r(2265);let s=(0,r(75709).U)(()=>({})),o=({children:e,configPlugins:t})=>((0,i.useEffect)(()=>{if(t&&0!==t.length)return s.setState(Object.fromEntries(t.map(e=>[e.id,e]))),()=>{s.setState(Object.fromEntries(t.map(e=>[e.id,void 0])))}},[t]),(0,n.jsx)(n.Fragment,{children:e})),a=e=>{(0,i.useEffect)(()=>(s.setState({[e.id]:e}),()=>{s.setState({[e.id]:void 0})}),[e])},l=e=>s.getState()[e],c=()=>(0,i.useCallback)(e=>l(e),[])},26558:function(e,t,r){"use strict";r.d(t,{C:function(){return O},D:function(){return $},H:function(){return P},I:function(){return v},M:function(){return N},O:function(){return C},P:function(){return w},R:function(){return m},S:function(){return I},V:function(){return p},W:function(){return U},a:function(){return g},b:function(){return S},c:function(){return x},d:function(){return y},e:function(){return b},f:function(){return E},g:function(){return A},h:function(){return c},i:function(){return u},j:function(){return _},k:function(){return T},l:function(){return ei},m:function(){return es},n:function(){return er},o:function(){return B},p:function(){return k},q:function(){return D},r:function(){return f},s:function(){return h},t:function(){return R},u:function(){return en},v:function(){return d},w:function(){return M},x:function(){return L},y:function(){return j}});var n=r(57437),i=r(2265),s=r(90626),o=r(520),a=r(21207),l=r(13130);let c="https://auth.privy.io",u=2e4,f=1400,h=2500,d=4e3,p="3.26.1",g="privy:token",y="privy-token",m="privy:refresh_token",b="privy-refresh-token",w="privy:pat",v="privy:id_token",E="privy-id-token",x="privy-session",_="privy:caid",A=e=>`privy:guest:${e}`,S=e=>`privy:cross-app:${e}`,I="privy:state_code",O="privy:code_verifier",P="privy:headless_oauth",C="privy:oauth_disable_signup",k=e=>`privy:wallet:${e}`,T="privy:connections",B=12e4,R=1,D="0x1",U=3e4,M="https://api.moonpay.com/v1",N="https://api.moonpay.com/v1",j="pk_live_hirbpu0cVcLHrjktC9l7fbc9ctjv0SL",L="pk_test_fqWjXZMSFwloh7orvJsRfjiUHXJqFzI",$="deprecated",z={appearance:{landingHeader:"Log in or sign up",theme:"light",walletList:["detected_ethereum_wallets","detected_solana_wallets","metamask","coinbase_wallet","rainbow","base_account","wallet_connect","phantom"]},walletConnectCloudProjectId:"34357d3c125c2bcf2ce2bc3309d98715",_render:{standalone:!1},fundingMethodConfig:{moonpay:{useSandbox:!1}}},F=new Set(["coinbase_wallet","base_account","cryptocom","metamask","okx_wallet","phantom","rainbow","uniswap","zerion","universal_profile","bybit_wallet","ronin_wallet","haha_wallet","wallet_connect","wallet_connect_qr","wallet_connect_qr_solana","detected_solana_wallets","detected_ethereum_wallets","rabby_wallet","safe","solflare","backpack","jupiter","binance","binanceus","bitget_wallet","kraken_wallet"]),q=e=>F.has(e),W=(e,t,r)=>r.indexOf(e)===t,V=({input:e,overrides:t})=>t?t.primary.concat(t.overflow??[]).filter(q).filter(W):e?e.filter(q).filter(W):z.appearance.walletList,H=/paymaster\.biconomy\.io\/api/i,G={mode:"SPONSORED",calculateGasLimits:!0,expiryDuration:300,sponsorshipInfo:{webhookData:{},smartAccountInfo:{name:"BICONOMY",version:"2.0.0"}}},K=(e,t)=>e&&H.test(e)?G:t&&t.policy_id?{policyId:t.policy_id}:void 0;function Z(e,t){let r=Math.max(0,Math.min(1,e.toHsl().l+t));return(0,l.Z)({...e.toHsl(),l:r})}function J(e,t){let r=e.getLuminance(),n=t.getLuminance();return(Math.max(r,n)+.05)/(Math.min(r,n)+.05)}let Y={background:{default:"#020713",elevated:"#1A2230","default-hover":"#101724","default-clicked":"#1A2230","default-disabled":"#020713",success:"#0E3E2D",warning:"#373827",error:"#2E0C18",interactive:"#8B86FF","error-hover":"#441821","interactive-hover":"#7B73E5","interactive-clicked":"#6560CC","interactive-disabled":"#141824",info:"#1F2937","info-hover":"#141824"},icon:{default:"#F8F8F8",muted:"#9BA2AE",subtle:"#7B8491",inverse:"#020713",success:"#88E3B5",warning:"#FDF27B",error:"#EF4444",interactive:"#88B6FF","default-hover":"#F8F8F8","muted-hover":"#AEB3BD","subtle-hover":"#8B939E","default-clicked":"#F8F8F8","muted-clicked":"#9097A5","subtle-clicked":"#78818E","default-disabled":"#404452","muted-disabled":"#404452","subtle-disabled":"#404452","error-hover":"#F05555","interactive-hover":"#7B73E5","error-clicked":"#
48EF4444","interactive-clicked":"#6560CC"},text:{default:"#F8F8F8",muted:"#9BA2AE",placeholder:"#7B8491",success:"#ACEECB",warning:"#FEF9A0",error:"#FCA5A5",interactive:"#A29EFF","default-disabled":"#404452","interactive-hover":"#8C88E5"},border:{default:"#1F2937",interactive:"#88B0FF",focused:"#F8F8FC",info:"#5B83D3",success:"#317056",warning:"#FBBF24",error:"#F87171","default-hover":"#34304A","interactive-hover":"#88B0FF"}},X={background:{default:"#FFFFFF",elevated:"#F1F2F9","default-hover":"#F8F9FC","default-clicked":"#F1F2F9","default-disabled":"#FFFFFF",success:"#DCFCE7",warning:"#FEF3C7",error:"#FEE2E2",interactive:"#5B4FFF","error-hover":"#FECACA","interactive-hover":"#4F46E5","interactive-clicked":"#4338CA","interactive-disabled":"#F1F2F9",info:"#E0E7FF","info-hover":"#EEF2FF"},icon:{default:"#110F2A",muted:"#64668B",subtle:"#9498B8",inverse:"#FFFFFF",success:"#33B287",warning:"#F59E0B",error:"#EF4444",interactive:"#564FFF","default-hover":"#1D1B35","muted-hover":"#64668B","subtle-hover":"#888AAE","default-clicked":"#060C23","muted-clicked":"#64668B","subtle-clicked":"#788804","default-disabled":"#CBCDE1","muted-disabled":"#CBCDE1","subtle-disabled":"#CBCDE1","error-hover":"#F06060","interactive-hover":"#4F46E5","error-clicked":"#DC3838","interactive-clicked":"#2BA482"},text:{default:"#040217",muted:"#64668B",placeholder:"#9498B8",success:"#135638",warning:"#906218",error:"#991B1B",interactive:"#5B4FFF","default-disabled":"#CBCDE1","interactive-hover":"#5B4FFF"},border:{default:"#E2E3F0",interactive:"#5B4FFF",focused:"#949DF9",info:"#F1F2F9",success:"#87D7B7",warning:"#FACD63",error:"#F69393","default-hover":"#E2E3F0","interactive-hover":"#5B4FFF"}};function Q(e,t,r,n,i){let c,u,f,h,d,p,g,y,m,b,w,v,E,x,_,A,S,I,O=r?console.warn:()=>{},P=[];if(t?.loginMethods)for(let e of(c=t.loginMethods.includes("email"),u=t.loginMethods.includes("sms"),h=t.loginMethods.includes("wallet"),d=t.loginMethods.includes("google"),p=t.loginMethods.includes("twitter"),g=t.loginMethods.includes("discord"),w=t.loginMethods.includes("spotify"),v=t.loginMethods.includes("instagram"),y=t.loginMethods.includes("tiktok"),m=t.loginMethods.includes("line"),b=t.loginMethods.includes("twitch"),x=t.loginMethods.includes("github"),E=t.loginMethods.includes("linkedin"),_=t.loginMethods.includes("apple"),A=t.loginMethods.includes("farcaster"),S=t.loginMethods.includes("telegram"),f=t.loginMethods.includes("passkey"),t.loginMethods))"string"==typeof e&&e.startsWith("privy:")&&P.push(e);else c=e.email_auth,u=e.sms_auth,h=e.wallet_auth||e.solana_wallet_auth,d=e.google_oauth,p=e.twitter_oauth,g=e.discord_oauth,x=e.github_oauth,w=e.spotify_oauth,v=e.instagram_oauth,y=e.tiktok_oauth,m=e.line_oauth,b=e.twitch_oauth,E=e.linkedin_oauth,_=e.apple_oauth,A=e.farcaster_auth,S=e.telegram_auth,f=e.passkey_auth,I=e.custom_jwt_auth;e.passkey_auth&&(f=!0),"undefined"!=typeof window&&"function"!=typeof window.PublicKeyCredential&&(f=!1);let C=[c,u].filter(Boolean),k=[d,p,g,x,w,v,y,m,b,E,_,A,S].filter(Boolean),T=[h].filter(Boolean),B=t?.loginMethods?.includes("passkey")??!1,R=e.passkeys_for_signup_enabled??!1,D=[f&&(R||B)].filter(Boolean),U=[I].filter(Boolean);if(C.length+k.length+T.length+D.length+U.length+P.length===0)throw Error("You must enable at least one login method");let M=void 0!==t?.appearance?.showWalletLoginFirst?t?.appearance?.showWalletLoginFirst:e.show_wallet_login_first;M&&0===T.length?(O("You should only enable `showWalletLoginFirst` when `wallet` logins are also enabled. `showWalletLoginFirst` has been set to false"),M=!1):M||k.length+C.length!==0||(O("You should only disable `showWalletLoginFirst` when `email`, `sms`, or social logins are also enabled. `showWalletLoginFirst` has been set to true"),M=!0);let N=t?.externalWallets?.walletConnect?.enabled??!0;t?.loginMethods&&t.loginMethodsAndOrder&&O("You should only configure one of `loginMethods` or `loginMethodsAndOrder`");let j=V({input:t?.appearance?.walletList,overrides:t?.loginMethodsAndOrder});if((j.includes("wallet_connect_qr")||j.includes("wallet_connect"))&&j.includes("wallet_connect_qr_solana"))throw Error("wallet_connect_qr and wallet_connect_qr_solana cannot both be present in
48walletList due to WalletConnect session conflicts.");let L=(({input:e})=>{if(!e||!e.primary[0])return;let t=[e.primary[0]],r=[];for(let r of(e.primary.length>4&&console.warn("You should not specify greater than 4 login methods in `loginMethodsAndOrder.primary`"),e.primary.slice(1)))t.includes(r)?console.warn(`Duplicated login method: ${r}`):t.push(r);for(let n of e.overflow??[])t.includes(n)||r.includes(n)?console.warn(`Duplicated login method: ${n}`):r.push(n);return{primary:t,overflow:r}})({input:t?.loginMethodsAndOrder}),$=t?.intl?.defaultCountry??"US",{chains:F,defaultChain:q}=function({supportedChains:e,defaultChainFromConfig:t}){let r;if(e){if(0===e.length)throw Error("`supportedChains` must contain at least one chain");r=(0,s.G)(e)}else r=[...o.B];let n=e?r[0]:a.R,i=t??n;if(!r.find(e=>e.id===i.id))throw Error("`defaultChain` must be included in `supportedChains`");return{chains:r,defaultChain:i}}({supportedChains:t?.supportedChains,defaultChainFromConfig:t?.defaultChain}),W=!!t?.defaultChain,H=t?.customAuth?.getCustomAccessToken&&!1!==t?.customAuth?.enabled,G=H?"all-users":e.embedded_wallet_config.ethereum.create_on_login,Q=e.embedded_wallet_config.solana.create_on_login;e.solana_wallet_auth&&!t?.externalWallets?.solana?.connectors&&console.warn("App configuration has Solana wallet login enabled, but no Solana wallet connectors have been passed to Privy. Make sure to pass Solana connectors to the `config.externalWallets.solana.connectors` field of the `PrivyProvider`");let ee=e.telegram_auth_config?{botId:e.telegram_auth_config.bot_id,botName:e.telegram_auth_config.bot_name,linkEnabled:e.telegram_auth_config.link_enabled,seamlessAuthEnabled:e.telegram_auth_config.seamless_auth_enabled}:void 0,et=e.funding_config?{methods:e.funding_config.methods,options:e.funding_config.options,defaultRecommendedAmount:e.funding_config.default_recommended_amount,defaultRecommendedCurrency:e.funding_config.default_recommended_currency,promptFundingOnWalletCreation:e.funding_config.prompt_funding_on_wallet_creation,crossChainBridgingEnabled:e.funding_config.cross_chain_bridging_enabled}:void 0,er=e.smart_wallet_config;return{id:e.id,appClientId:i,name:e.name,scriptNonce:t?.scriptNonce,allowlistConfig:{errorTitle:e.allowlist_config.error_title,errorDetail:e.allowlist_config.error_detail,errorCtaText:e.allowlist_config.cta_text,errorCtaLink:e.allowlist_config.cta_link},legacyWalletUiConfig:e.legacy_wallet_ui_config,appearance:{logo:t?.appearance?.logo??e.logo_url??void 0,emailDomain:t?.appearance?.emailDomain,landingHeader:t?.appearance?.landingHeader??z.appearance.landingHeader,loginMessage:"string"==typeof t?.appearance?.loginMessage?t?.appearance?.loginMessage.slice(0,100):t?.appearance?.loginMessage,footerLogo:t?.appearance?.footerLogo,palette:function({backgroundTheme:e,accentHex:t}){let r,n,i,s,o,a,c;"light"===e?r=!1:"dark"===e?r=!0:(r=.5>=(0,l.Z)(e).getLuminance(),n=(0,l.Z)(e).toHslString());let u=r?"dark":"light",f=r?Y:X,{accent:h,accentLight:d,accentHover:p,accentDark:g,accentDarkest:y}=function(e,t){if(!e){let e=t?Y:X;return{accent:(0,l.Z)(e.background.interactive),accentLight:(0,l.Z)(e.background.interactive),accentHover:(0,l.Z)(e.background["interactive-hover"]),accentDark:(0,l.Z)(e.background["interactive-clicked"]),accentDarkest:(0,l.Z)(e.background["interactive-disabled"])}}let r=(0,l.Z)(e);return{accent:r,accentLight:Z(r,.15),accentHover:Z(r,.3),accentDark:Z(r,-.06),accentDarkest:Z(r,-.6)}}(t,r),m=(i=(0,l.Z)(X.text.default),s=(0,l.Z)(Y.text.default),o=J(h,i),a=J(h,s),(c=h.toHsl()).h>=220&&c.h<=300&&a>=3?Y.text.default:o>a?X.text.default:Y.text.default),b=(0,l.Z)(m),w=J(h,(0,l.Z)(f.background.default))>=3;return{colorScheme:u,background:n||f.background.default,background2:f.background.elevated,background3:f.background.interactive,foreground:f.text.default,foreground2:f.text.muted,foreground3:f.text.placeholder,foreground4:f.border.default,accent:h.toHslString(),accentLight:d.toHslString(),accentHover:p.toHslString(),accentDark:g.toHslString(),accentDarkest:y.toHslString(),foregroundAccent:b.toHslString(),success:f.background.success,successDark:f.text.success,successLight:f.background.success,error:f.text.error,errorLight:f.background.error,warn:f.background.warning,warnLight:f.background.warning,warningDark:f.text.warning,errorDark:f.text.error,successBg:f.background.success,errorBg:f.background.error,errorBgHover:f.background["error-hover"],warnBg:f.background.warning,infoBg:f.background.info,infoBgHover:f.background["info-hover"],borderDefault:f.border.default,borderHover:f.border["default-hover"],borderFocus:f.border.focused,borderError:f.border.error,borderSuccess:f.border.success,borderWarning:f.border.warning,borderInfo:f.border.info,borderInteractive:f.border.interactive,borderInteractiveHover:f.border["interactive-hover"],backgroundHover:f.background["default-hover"],backgroundClicked:f.background["default-clicked"],backgroundDisabled:f.background["default-disabled"],backgroundInteractive:f.background.interactive,backgroundInteractiveHover:f.background["interactive-hover"],backgroundInteractiveClicked:f.background["interactive-clicked"],backgroundInteractiveDisabled:f.background["interactive-disabled"],foregroundHover:f.text.default,foregroundClicked:f.text.default,foregroundDisabled:f.text["default-disabled"],foregroundInteractive:f.text.interactive,foregroundInteractiveHover:f.text["interactive-hover"],accentHasGoodContrast:w?"1":"0",linkNavigationColor:w?h.toHslString():f.text.default,linkNavigationDecoration:w?"none":"underline",iconDefault:f.icon.default,iconMuted:f.icon.muted,iconSubtle:f.icon.subtle,iconInverse:f.icon.inverse,iconSuccess:f.icon.success,iconWarning:f.icon.warning,iconError:f.icon.error,iconInteractive:f.icon.interactive,iconDefaultHover:f.icon["default-hover"],iconMutedHover:f.icon["muted-hover"],iconSubtleHover:f.icon["subtle-hover"],iconDefaultClicked:f.icon["default-clicked"],iconMutedClicked:f.icon["muted-clicked"],iconSubtleClicked:f.icon["subtle-clicked"],iconDefaultDisabled:f.icon["default-disabled"],iconMutedDisabled:f.icon["muted-disabled"],iconSubtleDisabled:f.icon["subtle-disabled"],iconErrorHover:f.icon["error-hover"],iconInteractiveHover:f.icon["interactive-hover"],iconErrorClicked:f.icon["error-clicked"],iconInteractiveClicked:f.icon["interactive-clicked"],iconMutedDisabledAlt:f.icon["muted-disabled"],iconSubtleDisabledAlt:f.icon["subtle-disabled"]}}({backgroundTheme:t?.appearance?.theme??z.appearance.theme,accentHex:t?.appearance?.accentColor??e.accent_color}),loginGroupPriority:M?"web3-first":"web2-first",hideDirectWeb2Inputs:!!t?.appearance?.hideDirectWeb2Inputs,walletList:j,walletChainType:t?.appearance?.walletChainType??(({evmWalletAuth:e,solanaWalletAuth:t})=>e&&t?"ethereum-and-solana":e?"ethereum-only":t?"solana-only":"ethereum-only")({evmWalletAuth:e.wallet_auth??!1,solanaWalletAuth:e.solana_wallet_auth??!1})},loginMethods:{wallet:h,email:c,sms:u,passkey:f,google:d,twitter:p,discord:g,github:x,spotify:w,instagram:v,tiktok:y,line:m,twitch:b,linkedin:E,apple:_,farcaster:A,telegram:S},globalDisablePasskeys:t?.globalDisablePasskeys??!1,customOAuthProviders:(e.custom_oauth_providers??[]).filter(e=>!1!==e.enabled),crossAppProviders:P,disablePlusEmails:e.disable_plus_emails,loginMethodsAndOrder:L,legal:{termsAndConditionsUrl:t?.legal?.termsAndConditionsUrl??e.terms_and_conditions_url,privacyPolicyUrl:t?.legal?.privacyPolicyUrl??e.privacy_policy_url,requireUsersAcceptTerms:e.require_users_accept_terms??!1},walletConnectCloudProjectId:t?.walletConnectCloudProjectId??e.wallet_connect_cloud_project_id??z.walletConnectCloudProjectId,rpcConfig:{rpcUrls:{},rpcTimeouts:t?.externalWallets?.signatureRequestTimeouts??{}},chains:F,defaultChain:q,intl:{defaultCountry:$,textLocalization:t?.intl?.textLocalization},shouldEnforceDefaultChainOnConnect:W,captcha:{enabledProvider:e.enabled_captcha_provider??null,siteKey:e.captcha_site_key}
48,externalWallets:{coinbaseWallet:{config:{appName:e.name,appLogoUrl:e.logo_url,preference:{options:"all",...t?.externalWallets?.coinbaseWallet?.config?.preference},...t?.externalWallets?.coinbaseWallet?.config}},baseAccount:{config:{appName:e.name,appLogoUrl:e.logo_url,...t?.externalWallets?.baseAccount?.config,preference:{...t?.externalWallets?.baseAccount?.config?.preference,telemetry:!1}}},walletConnect:{enabled:N},solana:{connectors:t?.externalWallets?.solana?.connectors},disableAllExternalWallets:t?.externalWallets?.disableAllExternalWallets??!1},embeddedWallets:{requireUserOwnedRecoveryOnCreate:!H&&(e.embedded_wallet_config.require_user_owned_recovery_on_create??!1),userOwnedRecoveryOptions:H?["user-passcode"]:e.embedded_wallet_config.user_owned_recovery_options,priceDisplay:t?.embeddedWallets?.priceDisplay??{primary:"fiat-currency",secondary:"native-token"},ethereum:{createOnLogin:t?.embeddedWallets?.ethereum?.createOnLogin??G},solana:{createOnLogin:t?.embeddedWallets?.solana?.createOnLogin??Q},disableAutomaticMigration:t?.embeddedWallets?.disableAutomaticMigration??!1,mode:e.embedded_wallet_config.mode,showWalletUIs:t?.embeddedWallets?.showWalletUIs??e.enforce_wallet_uis??!0,extendedCalldataDecoding:t?.embeddedWallets?.extendedCalldataDecoding??!1,transactionScanning:{enabled:t?.embeddedWallets?.transactionScanning?.enabled??!1,domain:t?.embeddedWallets?.transactionScanning?.domain??n??"https://auth.privy.io"}}
48,mfa:{methods:e.mfa_methods??[],noPromptOnMfaRequired:t?.mfa?.noPromptOnMfaRequired??!1},passkeys:{shouldUnlinkOnUnenrollMfa:t?.passkeys?.shouldUnlinkOnUnenrollMfa,shouldUnenrollMfaOnUnlink:t?.passkeys?.shouldUnenrollMfaOnUnlink,registration:t?.passkeys?.registration},customAuth:H?{enabled:!0,...t.customAuth}:void 0,loginConfig:{telegramAuthConfiguration:ee,passkeysForSignupEnabled:e.passkeys_for_signup_enabled},headless:!!t?.headless,render:{standalone:t?._render?.standalone??z._render.standalone},fundingConfig:et,fundingMethodConfig:{...t?.fundingMethodConfig??z.fundingMethodConfig,moonpay:{...t?.fundingMethodConfig?.moonpay??z.fundingMethodConfig.moonpay,useSandbox:t?.fundingMethodConfig?.moonpay.useSandbox??z.fundingMethodConfig.moonpay.useSandbox}},whatsAppEnabled:!!e.whatsapp_enabled,customOAuthRedirectUrl:t?.customOAuthRedirectUrl,allowOAuthInEmbeddedBrowsers:t?.allowOAuthInEmbeddedBrowsers??!1,solanaRpcs:{"solana:mainnet":t?.solana?.rpcs?.["solana:mainnet"]??null,"solana:devnet":t?.solana?.rpcs?.["solana:devnet"]??null,"solana:testnet":t?.solana?.rpcs?.["solana:testnet"]??null},smartWallets:er?.enabled?{enabled:er.enabled,smartWalletVersion:er.smart_wallet_version,smartWalletType:er.smart_wallet_type,configuredNetworks:er.configured_networks.map(e=>({chainId:e.chain_id,bundlerUrl:e.bundler_url,paymasterUrl:e.paymaster_url,paymasterContext:K(e.paymaster_url,e.paymaster_context)}))}:{enabled:er?.enabled??!1},connectorsDebugLogs:t?.connectorsDebugLogs??!1}}let ee={show_wallet_login_first:!0,allowlist_config:{error_title:null,error_detail:null,cta_text:null,cta_link:null},wallet_auth:!0,email_auth:!0,sms_auth:!1,google_oauth:!1,twitter_oauth:!1,discord_oauth:!1,github_oauth:!1,linkedin_oauth:!1,apple_oauth:!1,disable_plus_emails:!1,terms_and_conditions_url:null,privacy_policy_url:null,embedded_wallet_config:{create_on_login:"off",ethereum:{create_on_login:"off"},solana:{create_on_login:"off"},require_user_owned_recovery_on_create:!1,user_owned_recovery_options:["user-passcode"],mode:"user-controlled-server-wallets-only"},captcha_site_key:"",enforce_wallet_uis:!1,legacy_wallet_ui_config:!1,id:"",name:"",passkeys_for_signup_enabled:!1,whatsapp_enabled:!1},et=(0,i.createContext)({appConfig:Q(ee,void 0,!1),isServerConfigLoaded:!1,initializationError:null,setInitializationError:()=>{}}),er=({children:e,client:t,legacyClient:r,clientConfig:s,appClientId:o})=>{let[a,l]=(0,i.useState)(null),[c,u]=(0,i.useState)(null),f=(0,i.useMemo)(()=>Q(a??ee,s,!!a,"undefined"!=typeof window?window.location.origin:void 0,o),[a,s,o]);return(0,i.useEffect)(()=>{if(!a)return;let e=function(e){if(!e)return{};let{appearance:t,scriptNonce:r,supportedChains:n,defaultChain:i,externalWallets:s,...o}=e;return{...o,...n?{supportedChains:n.map(e=>e.id)}:void 0,...i?{defaultChain:i.id}:void 0,...s?{walletConnect:s.walletConnect?{enabled:s.walletConnect.enabled}
48:void 0,coinbaseWallet:s.coinbaseWallet,solana:{connectors:s.solana?.connectors?.get().map(e=>e.walletClientType)}}:void 0}}(s),t=(function(e,t=0){let r=3735928559^t,n=1103547991^t;for(let t,i=0;i<e.length;i++)r=Math.imul(r^(t=e.charCodeAt(i)),2654435761),n=Math.imul(n^t,1597334677);return r=Math.imul(r^r>>>16,2246822507)^Math.imul(n^n>>>13,3266489909),4294967296*(2097151&(n=Math.imul(n^n>>>16,2246822507)^Math.imul(r^r>>>13,3266489909)))+(r>>>0)})(JSON.stringify(e)).toString(),n=`privy:sent:${a.id}:${t}`;localStorage.getItem(n)||(r.createAnalyticsEvent({eventName:"sdk_initialize",payload:e}),localStorage.setItem(n,"t"))},[s,a]),(0,i.useEffect)(()=>{a||(async()=>{try{await t.initialize();let e=t.app.getConfig();e.custom_api_url&&r.updateApiUrl(e.custom_api_url),l(e)}catch(t){let e=t instanceof Error?t:Error(String(t));u(e),console.warn("Error generating app config: ",e)}})()},[]),(0,n.jsx)(et.Provider,{value:{appConfig:f,isServerConfigLoaded:!!a,initializationError:c,setInitializationError:u},children:e})},en=()=>{let{appConfig:e}=(0,i.useContext)(et);return e},ei=()=>{let{isServerConfigLoaded:e}=(0,i.useContext)(et);return e},es=()=>{let{initializationError:e,setInitializationError:t}=(0,i.useContext)(et);return{initializationError:e,setInitializationError:t}}},24257:function(e,t,r){"use strict";r.d(t,{P:function(){return s},a:function(){return c},e:function(){return l},p:function(){return i},u:function(){return a}});var n=r(2265);let i={login:{onComplete:[],onError:[]},logout:{onSuccess:[]},connectWallet:{onSuccess:[],onError:[]},connectOrCreateWallet:{onSuccess:[],onError:[]},createWallet:{onSuccess:[],onError:[]},linkAccount:{onSuccess:[],onError:[]},update:{onSuccess:[],onError:[]},configureMfa:{onMfaRequired:[]},setWalletPassword:{onSuccess:[],onError:[]},setWalletRecovery:{onSuccess:[],onError:[]},signMessage:{onSuccess:[],onError:[]},signTypedData:{onSuccess:[],onError:[]},sendTransaction:{onSuccess:[],onError:[]},signTransaction:{onSuccess:[],onError:[]},accessToken:{onAccessTokenGranted:[],onAccessTokenRemoved:[]},oAuthAuthorization:{onOAuthTokenGrant:[]},fundWallet:{onUserExited:[]},fundSolanaWallet:{onUserExited:[]},customAuth:{onAuthenticated:[],onUnauthenticated:[]}},s=(0,n.createContext)(void 0),o=()=>(0,n.useContext)(s);function a(e,t){if(!t)return;let r=o().current[e];return(0,n.useEffect)(()=>{for(let[n,i]of Object.entries(t))Object.prototype.hasOwnProperty.call(r,n)||console.warn(`Invalid event type "${n}" for action "${e}"`),r[n]?.push(i);return()=>{for(let[n,i]of Object.entries(t))Object.prototype.hasOwnProperty.call(r,n)||console.warn(`Invalid event type "${n}" for action "${e}"`),r[n]=r[n]?.filter(e=>e!==i)}},[t])}function l(e,t,r,...n){for(let i of e.current[t][r])i(...n)}function c(){let e=o();return(t,r,...n)=>l(e,t,r,...n)}},22931:function(e,t,r){"use strict";r.d(t,{P:function(){return g},a:function(){return d},b:function(){return w},c:function(){return y},d:function(){return f},e:function(){return h},g:function(){return u},s:function(){return p},t:function(){return b},u:function(){return m}});var n=r(72077),i=r(44151),s=r(97422),o=r(2265),a=r(98868),l=r(75709),c=r(3266);let u=(e,t,r,o)=>{let a=Number(e),l=t.find(e=>e.id===a);if(!l)throw new s.P(`Unsupported chainId ${e}`,4901);return(0,n.v)({transport:(0,i.d)(f(l,r,o.appId)),chain:l})},f=(e,t,r)=>{let n,i=e.id,o=Number(e.id);if(e.rpcUrls.privyWalletOverride&&e.rpcUrls.privyWalletOverride.http[0])n=e.rpcUrls.privyWalletOverride.http[0];else if(t.rpcUrls&&t.rpcUrls[o])n=t.rpcUrls[o];else if(e.rpcUrls.privy?.http[0]){let t=new URL(e.rpcUrls.privy.http[0]);t.searchParams.append("privyAppId",r),n=t.toString()}else n=e.rpcUrls.public?.http[0]?e.rpcUrls.public.http[0]:e.rpcUrls.default?.http[0];if(!n)throw new s.P(`No RPC url found for ${i}`);return n},h=(e,{chainType:t,walletIndex:r}={})=>e?.linkedAccounts.filter(e=>!("wallet"!==e.type||"privy"!==e.walletClientType||void 0!==r&&e.walletIndex!==r||void 0!==t&&e.chainType!==t))??[],d=(0,l.U)(()=>({ethereumExternal:[],areExternalConnectorsReady:!1,ethereumEmbedded:[]})),p=e=>d.setState({areExternalConnectorsReady:e}),g=(0,o.createContext)(!1),y=()=>
48{if((0,o.useContext)(g))throw new s.b("Multiple PrivyProvider instances found","Found multiple instances of PrivyProvider, ensure there is only one mounted in your application tree.")};function m(){let e=(0,o.useContext)(g),t=(0,s.u)(),r=d(e=>e.ethereumEmbedded),n=d(e=>e.ethereumExternal),i=d(e=>e.areExternalConnectorsReady),l=(0,a.u)(e=>e.user),c=(0,a.u)(e=>e.hasResolvedInitialUser),u=(0,o.useMemo)(()=>[...r,...n].sort((e,t)=>t.connectedAt-e.connectedAt),[r,n]),f=h(l,{chainType:"ethereum"}).length>0,p=r.length>0,y=!!i&&!!c&&!!t.walletProxy&&(!f||p);return e?(0,o.useMemo)(()=>({wallets:u,ready:y}),[u,y]):(console.warn("`useWallets` was called outside the PrivyProvider component"),{wallets:[],ready:!1})}let b=e=>{if("ethereum"===e.chainType)return{entropyId:e.address,entropyIdVerifier:"ethereum-address-verifier"};if("solana"===e.chainType)return{entropyId:e.address,entropyIdVerifier:"solana-address-verifier"};throw Error("Failed to get account entropy details")},w=(e,t)=>{if(t?.imported)return b(t);let r=(0,c.g)(e);if(!r)throw Error("Failed to find primary wallet");return b(r)}},97422:function(e,t,r){"use strict";r.d(t,{I:function(){return x},P:function(){return u},a:function(){return c},b:function(){return l},c:function(){return d},d:function(){return h},e:function(){return a},f:function(){return f},g:function(){return o},h:function(){return E},i:function(){return p},j:function(){return b},k:function(){return m},l:function(){return v},m:function(){return g},n:function(){return w},o:function(){return y},u:function(){return _}});var n,i=r(94498),s=r(2265);class o extends Error{toString(){return`${this.type}${this.privyErrorCode?`-${this.privyErrorCode}`:""}: ${this.message}${this.cause?` [cause: ${this.cause}]`:""}`}constructor(e,t,r){super(e),t instanceof Error&&(this.cause=t),this.privyErrorCode=r}}class a extends o{constructor(e,t,r,n,i,s){super(r,n,i),this.type=e,this.status=t,this.data=s}}class l extends o{constructor(e,t,r){super(e,t,r),this.type="client_error"}}class c extends l{constructor(){super("Request timed out",void 0,"client_request_timeout")}}class u extends o{constructor(e,t,r){super(e,t,r),this.type="connector_error"}}let f=e=>{if(e instanceof o)return e;if(!(e instanceof i.F))return h(e);if(!e.response)return new a("api_error",null,e.message,e);let{type:t,message:r,error:n,code:s}=e.data;return new a(t||"ApiError",e.response.status,r||n,e,s,e.data)},h=e=>e instanceof o?e:e instanceof Error?new l(e.message,e):new l(`Internal error: ${e}`);var d=((n={}).OAUTH_ACCOUNT_SUSPENDED="oauth_account_suspended",n.MISSING_OR_INVALID_PRIVY_APP_ID="missing_or_invalid_privy_app_id",n.MISSING_OR_INVALID_PRIVY_ACCOUNT_ID="missing_or_invalid_privy_account_id",n.MISSING_OR_INVALID_TOKEN="missing_or_invalid_token",n.INVALID_DATA="invalid_data",n.INVALID_CAPTCHA="invalid_captcha",n.LINKED_TO_ANOTHER_USER="linked_to_another_user",n.CANNOT_LINK_MORE_OF_TYPE="cannot_link_more_of_type",n.FAILED_TO_LINK_ACCOUNT="failed_to_link_account",n.FAILED_TO_UPDATE_ACCOUNT="failed_to_update_account",n.USER_EXITED_UPDATE_FLOW="exited_update_flow",n.ALLOWLIST_REJECTED="allowlist_rejected",n.OAUTH_USER_DENIED="oauth_user_denied",n.OAUTH_UNEXPECTED="oauth_unexpected",n.UNKNOWN_AUTH_ERROR="unknown_auth_error",n.USER_EXITED_AUTH_FLOW="exited_auth_flow",n.USER_EXITED_LINK_FLOW="exited_link_flow",n.USER_EXITED_SET_PASSWORD_FLOW="user_exited_set_password_flow",n.MUST_BE_AUTHENTICATED="must_be_authenticated",n.UNKNOWN_CONNECT_WALLET_ERROR="unknown_connect_wallet_error",n.GENERIC_CONNECT_WALLET_ERROR="generic_connect_wallet_error",n.CLIENT_REQUEST_TIMEOUT="client_request_timeout",n.INVALID_CREDENTIALS="invalid_credentials",n.MISSING_MFA_CREDENTIALS="missing_or_invalid_mfa",n.UNKNOWN_MFA_ERROR="unknown_mfa_error",n.EMBEDDED_WALLET_ALREADY_EXISTS="embedded_wallet_already_exists",n.EMBEDDED_WALLET_NOT_FOUND="embedded_wallet_not_found",n.EMBEDDED_WALLET_CREATE_ERROR="embedded_wallet_create_error",n.UNKNOWN_EMBEDDED_WALLET_ERROR="unknown_embedded_wallet_error",n.EMBEDDED_WALLET_PASSWORD_UNCONFIRMED="embedded_wallet_password_unconfirmed",n.EMBEDDED_WALLET_PASSWORD_ALREADY_EXISTS="embedded_wallet_password_already_exists",n.EMBEDDED_WALLET_RECOVERY_ALREADY_EXISTS="embedded_wallet_recovery_already_exists",n.TRANSACTION_FAILURE="transaction_failure",n.UNSUPPORTED_CHAIN_ID="unsupported_chain_id",n.NOT_SUPPORTED="not_supported",n.CAPTCHA_TIMEOUT="captcha_timeout",n.INVALID_MESSAGE="invalid_message",n.UNABLE_TO_SIGN="unable_to_sign",n.CAPTCHA_FAILURE="captcha_failure",n.CAPTCHA_DISABLED="captcha_disabled",n.SESSION_STORAGE_UNAVAILABLE="session_storage_unavailable",n.TOO_MANY_REQUESTS="too_many_requests",n.USER_LIMIT_REACHED="max_accounts_reached",n.DISALLOWED_LOGIN_METHOD="disallowed_login_method",n.DISALLOWED_PLUS_EMAIL="disallowed_plus_email",n.PASSKEY_NOT_ALLOWED="passkey_not_allowed",n.USER_DOES_NOT_EXIST="user_does_not_exist",n.INSUFFICIENT_BALANCE="insufficient_balance",n.ACCOUNT_TRANSFER_REQUIRED="account_transfer_required",n.BUFFER_NOT_DEFINED="buffer_not_defined",n.UNSUPPORTED_WALLET_TYPE="unsupported_wallet_type",n.NO_SOLANA_ACCOUNTS="no_solana_accounts",n.UNKNOWN_FUNDING_ERROR="unknown_funding_error",n);class p extends l{constructor(){super("Method called before `ready`. Ensure you wait until `ready` is true before calling.")}}class g extends l{constructor(e="Embedded wallet error",t){super(e,t,"unknown_embedded_wallet_error")}}class y extends l{constructor(e="User must be authenticated"){super(e,void 0,"must_be_authenticated")}}class m extends l{constructor(e){super("This application is in development mode and must be upgraded to production to log in new users.",e,"max_accounts_reached")}}class b extends u{constructor(){super("No Solana accounts found in wallet",void 0,"no_solana_accounts")}}let w=()=>{throw Error("You need to wrap your application with the <PrivyProvider> initialized with your app id.")},v=e=>()=>{throw Error(e.trim())},E=()=>{},x=(0,s.createContext)({setAuthenticated:w,setUser:w,setIsNewUser:w,isNewUserThisSession:!1,walletConnectionStatus:null,setWalletConnectionStatus:w,connectors:[],rpcConfig:{rpcUrls:{}},showFiatPrices:!0,chains:[],clientAnalyticsId:null,pendingTransaction:null,client:null,privy:null,appId:"notAdded",hideWalletUIs:{current:!1},nativeTokenSymbolForChainId:w,initializeWalletProxy:w,getAuthMeta:w,getAuthFlow:w,closePrivyModal:w,openPrivyModal:w,connectWallet:w,initLoginWithWallet:w,loginWithWallet:w,initLoginWithFarcaster:w,loginWithFarcaster:w,loginWithCode:w,initLoginWithEmail:w,initLoginWithSms:w,initUpdateEmail:w,initUpdatePhone:w,resendEmailCode:w,resendSmsCode:w,initLoginWithHeadlessOAuth:w,loginWithHeadlessOAuth:w,crossAppAuthFlow:w,initLoginWithOAuth:w,loginWithOAuth:w,passkeyAuthState:{status:"initial"},setPasskeyAuthState:w,initSignupWithPasskey:w,signupWithPasskey:w,initLoginWithPasskey:w,loginWithPasskey:w,initLinkWithPasskey:w,linkWithPasskey:w,refreshSessionAndUser:w,walletProxy:null,createAnalyticsEvent:w,acceptTerms:w,getUsdTokenPrice:w,getUsdPriceForSol:w,get
48SplTokenMetadata:w,recoverEmbeddedWallet:w,updateWallets:w,fundWallet:w,openModal:w,setReadyToTrue:w,requestFarcasterSignerStatus:w,initLoginWithTelegram:w,loginWithTelegram:w,generateSiweMessage:w,generateSiweMessageForSmartWallet:w,loginWithSiwe:w,linkWithSiwe:w,linkSmartWallet:w,delegateWallet:w,revokeDelegatedWallets:w,connectCoinbaseSmartWallet:w,connectBaseAccount:w,initiateAccountTransfer:w,emailOtpState:{status:"initial"},setEmailOtpState:w,smsOtpState:{status:"initial"},setSmsOtpState:w,siweState:{status:"initial"},setSiweState:w,oAuthState:{status:"initial"},setOAuthState:w,telegramAuthState:{status:"initial"},setTelegramAuthState:w,isHeadlessOAuthLoading:!1,isHeadlessSigning:w,inProgressAuthFlowRef:{current:null},inProgressLoginOrLinkMethodRef:{current:null},baseAccountSdk:void 0,setBaseAccountSdk:w}),_=()=>(0,s.useContext)(x)},23406:function(e,t,r){"use strict";r.d(t,{$:function(){return V},A:function(){return J},B:function(){return el},C:function(){return es},D:function(){return eo},E:function(){return ea},F:function(){return s},G:function(){return o},H:function(){return a},I:function(){return l},J:function(){return f},K:function(){return h},L:function(){return j},M:function(){return g},N:function(){return Y},O:function(){return E},P:function(){return u},Q:function(){return R},R:function(){return O},S:function(){return d},T:function(){return ec},U:function(){return eu},V:function(){return m},W:function(){return b},X:function(){return y},Y:function(){return w},Z:function(){return G},_:function(){return H},a:function(){return i},a0:function(){return W},a1:function(){return q},a2:function(){return F},a3:function(){return K},a4:function(){return Z},a8:function(){return z},a9:function(){return $},aa:function(){return L},b:function(){return et},c:function(){return er},d:function(){return en},e:function(){return A},f:function(){return x},g:function(){return ei},h:function(){return M},i:function(){return D},j:function(){return T},k:function(){return C},l:function(){return P},m:function(){return B},n:function(){return X},o:function(){return U},p:function(){return _},q:function(){return Q},r:function(){return ee},s:function(){return n},t:function(){return S},u:function(){return I},v:function(){return k},w:function(){return c},x:function(){return p},y:function(){return N},z:function(){return v}});let n="/api/v1/sessions",i="/api/v1/sessions/logout",s="/api/v1/siwe/init",o="/api/v1/siwe/authenticate",a="/api/v1/siwe/link",l="/api/v1/siwe/link_smart_wallet",c="/api/v1/siwe/unlink",u="/api/v1/siwe/transfer",f="/api/v1/siws/init",h="/api/v1/siws/authenticate",d="/api/v1/siws/link",p="/api/v1/siws/unlink",g="/api/v1/siws/transfer",y="/api/v1/farcaster/init",m="/api/v1/farcaster/authenticate",b="/api/v1/farcaster/link",w="/api/v1/farcaster/status",v="/api/v1/farcaster/unlink",E="/api/v1/farcaster/transfer",x="/api/v1/passwordless/init",_="/api/v1/passwordless/authenticate",A="/api/v1/passwordless/link",S="/api/v1/passwordless/unlink",I="/api/v1/passwordless/update",O="/api/v1/passwordless/transfer",P="/api/v1/passwordless_sms/init",C="/api/v1/passwordless_sms/link",k="/api/v1/passwordless_sms/unlink",T="/api/v1/passwordless_sms/authenticate",B="/api/v1/passwordless_sms/update",R="/api/v1/passwordless_sms/transfer",D="/api/v1/oauth/init",U="/api/v1/oauth/authenticate",M="/api/v1/oauth/link",N="/api/v1/oauth/unlink",j="/api/v1/oauth/transfer",L="/api/v1/recovery/oauth/init",$="/api/v1/recovery/oauth/init_icloud",z="/api/v1/recovery/oauth/authenticate",F="/api/v1/passkeys/link/init",q="/api/v1/passkeys/authenticate/init",W="/api/v1/passkeys/register/init",V="/api/v1/passkeys/link",H="/api/v1/passkeys/authenticate",G="/api/v1/passkeys/register",K="/api/v1/telegram/authenticate",Z="/api/v1/telegram/link",J="/api/v1/telegram/unlink",Y="/api/v1/telegram/transfer",X="/api/v1/mfa/passwordless_sms/init",Q="/api/v1/mfa/passkeys/init",ee="/api/v1/users/me/accept_terms",et="/api/v1/analytics_events",er="/api/v1/custom_jwt_account/authenticate",en="/api/v1/custom_jwt_account/link",ei="/api/v1/guest/authenticate",es="/api/v1/plugins/moonpay_on_ramp/sign",eo="/api/v1/funding/coinbase_on_ramp/init",ea="/api/v1/funding/coinbase_on_ramp/status",el="/api/v1/wallets/revoke",e
48c="/api/v1/users/me",eu="/api/v1/scan/transaction"},3266:function(e,t,r){"use strict";r.d(t,{M:function(){return eI},P:function(){return eP},a:function(){return eO},b:function(){return eu},c:function(){return e_},d:function(){return ed},e:function(){return eb},f:function(){return em},g:function(){return ex},h:function(){return ew},i:function(){return ec},j:function(){return ev},k:function(){return eE},m:function(){return ey},u:function(){return eC}});let n="2.47.12",i={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:r})=>t?`${e??"https://viem.sh"}${t}${r?`#${r}`:""}`:void 0,version:`viem@${n}`};class s extends Error{constructor(e,t={}){let r=t.cause instanceof s?t.cause.details:t.cause?.message?t.cause.message:t.details,o=t.cause instanceof s&&t.cause.docsPath||t.docsPath,a=i.getDocsUrl?.({...t,docsPath:o});super([e||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...a?[`Docs: ${a}`]:[],...r?[`Details: ${r}`]:[],...i.version?[`Version: ${i.version}`]:[]].join("\n"),t.cause?{cause:t.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=o,this.metaMessages=t.metaMessages,this.name=t.name??this.name,this.shortMessage=e,this.version=n}walk(e){return function e(t,r){return r?.(t)?t:t&&"object"==typeof t&&"cause"in t&&void 0!==t.cause?e(t.cause,r):r?null:t}(this,e)}}class o extends s{constructor({address:e}){super(`Address "${e}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}function a(e,{strict:t=!0}={}){return!!e&&"string"==typeof e&&(t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x"))}class l extends s{constructor({size:e,targetSize:t,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${e}) exceeds padding size (${t}).`,{name:"SizeExceedsPaddingSizeError"})}}function c(e,{dir:t,size:r=32}={}){return"string"==typeof e?function(e,{dir:t,size:r=32}={}){if(null===r)return e;let n=e.replace("0x","");if(n.length>2*r)throw new l({size:Math.ceil(n.length/2),targetSize:r,type:"hex"});return`0x${n["right"===t?"padEnd":"padStart"](2*r,"0")}`}(e,{dir:t,size:r}):function(e,{dir:t,size:r=32}={}){if(null===r)return e;if(e.length>r)throw new l({size:e.length,targetSize:r,type:"bytes"});let n=new Uint8Array(r);for(let i=0;i<r;i++){let s="right"===t;n[s?i:r-i-1]=e[s?i:e.length-i-1]}return n}(e,{dir:t,size:r})}class u extends s{constructor({max:e,min:t,signed:r,size:n,value:i}){super(`Number "${i}" is not in safe ${n?`${8*n}-bit ${r?"signed":"unsigned"} `:""}integer range ${e?`(${t} to ${e})`:`(above ${t})`}`,{name:"IntegerOutOfRangeError"})}}class f extends s{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}}function h(e){return a(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}function d(e,{size:t}){if(h(e)>t)throw new f({givenSize:h(e),maxSize:t})}let p=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function g(e,t={}){let r="";for(let t=0;t<e.length;t++)r+=p[e[t]];let n=`0x${r}`;return"number"==typeof t.size?(d(n,{size:t.size}),c(n,{dir:"right",size:t.size})):n}function y(e,t={}){let r;let{signed:n,size:i}=t,s=BigInt(e);i?r=n?(1n<<8n*BigInt(i)-1n)-1n:2n**(8n*BigInt(i))-1n:"number"==typeof e&&(r=BigInt(Number.MAX_SAFE_INTEGER));let o="bigint"==typeof r&&n?-r-1n:0;if(r&&s>r||s<o){let t="bigint"==typeof e?"n":"";throw new u({max:r?`${r}${t}`:void 0,min:`${o}${t}`,signed:n,size:i,value:`${e}${t}`})}let a=`0x${(n&&s<0?(1n<<BigInt(8*i))+BigInt(s):s).toString(16)}`;return i?c(a,{size:i}):a}let m=new TextEncoder,b=new TextEncoder,w={zero:48,nine:57,A:65,F:70,a:97,f:102};function v(e){return e>=w.zero&&e<=w.nine?e-w.zero:e>=w.A&&e<=w.F?e-(w.A-10):e>=w.a&&e<=w.f?e-(w.a-10):void 0}function E(e,t={}){let r=e;t.size&&(d(r,{size:t.size}),r=c(r,{dir:"right",size:t.size}));let n=r.slice(2);n.length%2&&(n=`0${n}`);let i=n.length/2,o=new Uint8Array(i);for(let e=0,t=0;e<i;e++){let r=v(n.charCodeAt(t++)),i=v(n.charCodeAt(t++));if(void 0===r||void 0===i)throw new s(`Invalid byte sequence ("${n[t-2]}${n[t-1]}" in "${n}").`);o[e]=16*r+i}return o}function x(e,t={}){let r=b.encode(e);return"number"==typeof t.size?(d(r,{size:t.size}),c(r,{dir:"right",size:t.size})):r}
48let _=BigInt(4294967296-1),A=BigInt(32),S=(e,t,r)=>e<<r|t>>>32-r,I=(e,t,r)=>t<<r|e>>>32-r,O=(e,t,r)=>t<<r-32|e>>>64-r,P=(e,t,r)=>e<<r-32|t>>>64-r;function C(e){if(!Number.isSafeInteger(e)||e<0)throw Error("positive integer expected, got "+e)}function k(e,...t){if(!(e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name))throw Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw Error("Uint8Array expected of length "+t+", got length="+e.length)}function T(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}function B(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}let R=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0]?e=>e:function(e){for(let r=0;r<e.length;r++){var t;e[r]=(t=e[r])<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}return e};function D(e){return"string"==typeof e&&(e=function(e){if("string"!=typeof e)throw Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}(e)),k(e),e}class U{}let M=BigInt(0),N=BigInt(1),j=BigInt(2),L=BigInt(7),$=BigInt(256),z=BigInt(113),F=[],q=[],W=[];for(let e=0,t=N,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],F.push(2*(5*n+r)),q.push((e+1)*(e+2)/2%64);let i=M;for(let e=0;e<7;e++)(t=(t<<N^(t>>L)*z)%$)&j&&(i^=N<<(N<<BigInt(e))-N);W.push(i)}let V=function(e,t=!1){let r=e.length,n=new Uint32Array(r),i=new Uint32Array(r);for(let s=0;s<r;s++){let{h:r,l:o}=function(e,t=!1){return t?{h:Number(e&_),l:Number(e>>A&_)}:{h:0|Number(e>>A&_),l:0|Number(e&_)}}(e[s],t);[n[s],i[s]]=[r,o]}return[n,i]}(W,!0),H=V[0],G=V[1],K=(e,t,r)=>r>32?O(e,t,r):S(e,t,r),Z=(e,t,r)=>r>32?P(e,t,r):I(e,t,r);class J extends U{constructor(e,t,r,n=!1,i=24){var s;if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=n,this.rounds=i,C(r),!(0<e&&e<200))throw Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=new Uint32Array((s=this.state).buffer,s.byteOffset,Math.floor(s.byteLength/4))}clone(){return this._cloneInto()}keccak(){R(this.state32),function(e,t=24){let 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){let n=(t+8)%10,i=(t+2)%10,s=r[i],o=r[i+1],a=K(s,o,1)^r[n],l=Z(s,o,1)^r[n+1];for(let r=0;r<50;r+=10)e[t+r]^=a,e[t+r+1]^=l}let t=e[2],i=e[3];for(let r=0;r<24;r++){let n=q[r],s=K(t,i,n),o=Z(t,i,n),a=F[r];t=e[a],i=e[a+1],e[a]=s,e[a+1]=o}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]^=H[n],e[1]^=G[n]}B(r)}(this.state32,this.rounds),R(this.state32),this.posOut=0,this.pos=0}update(e){T(this),k(e=D(e));let{blockLen:t,state:r}=this,n=e.length;for(let i=0;i<n;){let s=Math.min(t-this.pos,n-i);for(let t=0;t<s;t++)r[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:e,suffix:t,pos:r,blockLen:n}=this;e[r]^=t,(128&t)!=0&&r===n-1&&this.keccak(),e[n-1]^=128,this.keccak()}writeInto(e){T(this,!1),k(e),this.finish();let t=this.state,{blockLen:r}=this;for(let n=0,i=e.length;n<i;){this.posOut>=r&&this.keccak();let s=Math.min(r-this.posOut,i-n);e.set(t.subarray(this.posOut,this.posOut+s),n),this.posOut+=s,n+=s}return e}xofInto(e){if(!this.enableXOF)throw Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return C(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(!function(e,t){k(e);let r=t.outputLen;if(e.length<r)throw Error("digestInto() expects output buffer of length at least "+r)}(e,this),this.finished)throw Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,B(this.state)}_cloneInto(e){let{blockLen:t,suffix:r,outputLen:n,rounds:i,enableXOF:s}=this;return e||(e=new J(t,r,n,s,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=r,e.outputLen=n,e.enableXOF=s,e.destroyed=this.destroyed,e}}let Y=function(e){let t=t=>e().update(D(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}(()=>new J(136,1,32));class X extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){let t=super.get(e);return super.has(e)&&(super.delete(e),super.set(e,t)),t}set(e,t){if(super.has(e)&&super.delete(e),super.set(e,t),this.maxSize&&this.size>this.maxSize){let e=super.keys().next().value;void 0!==e&&super.delete(e)}return this}}let Q=/^0x[a-fA-F0-9]{40}$/,ee=new X(8192),et=new X(8192);function er(e,t){if(et.has(`${e}.${t}`))return et.get(`${e}.${t}`);let r=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),n=function(e,t){let r=Y(a(e,{strict:!1})?function(e,t={}){return"number"==typeof e||"bigint"==typeof e?E(y(e,t)):"boolean"==typeof e?function(e,t={}){let r=new Uint8Array(1);return(r[0]=Number(e),"number"==typeof t.size)?(d(r,{size:t.size}),c(r,{size:t.size})):r}(e,t):a(e)?E(e,t):x(e,t)}(e):e);return"bytes"===(t||"hex")?r:function(e,t={}){return"number"==typeof e||"bigint"==typeof e?y(e,t):"string"==typeof e?function(e,t={}){return g(m.encode(e),t)}(e,t):"boolean"==typeof e?function(e,t={}){let r=`0x${Number(e)}`;return"number"==typeof t.size?(d(r,{size:t.size}),c(r,{size:t.size})):r}(e,t):g(e,t)}(r)}(x(r),"bytes"),i=(t?r.substring(`${t}0x`.length):r).split("");for(let e=0;e<40;e+=2)n[e>>1]>>4>=8&&i[e]&&(i[e]=i[e].toUpperCase()),(15&n[e>>1])>
48=8&&i[e+1]&&(i[e+1]=i[e+1].toUpperCase());let s=`0x${i.join("")}`;return et.set(`${e}.${t}`,s),s}function en(e,t){if(!function(e,t){let{strict:r=!0}=t??{},n=`${e}.${r}`;if(ee.has(n))return ee.get(n);let i=!!Q.test(e)&&(e.toLowerCase()===e||!r||er(e)===e);return ee.set(n,i),i}(e,{strict:!1}))throw new o({address:e});return er(e,t)}let ei=(e,t)=>e===t||!(!e.startsWith("0x")||!t.startsWith("0x"))&&42===e.length&&42===t.length&&en(e)===en(t);var es=r(57437),eo=r(2265),ea=r(26558),el=r(97422);function ec(e){return"string"==typeof e&&/^custom:[a-zA-Z0-9_-]+$/i.test(e)}let eu=e=>!!e.id&&"privy-v2"===e.recoveryMethod;function ef(e){return e?new Date(1e3*e):null}function eh(e,t){return e.slice().sort((e,t)=>(e.firstVerifiedAt?.getTime()??0)-(t.firstVerifiedAt?.getTime()??0)).find(e=>e.type===t)}let ed=e=>e?ep(e).find(e=>0===e.walletIndex)??null:null,ep=e=>e?eg(e,"ethereum"):[],eg=(e,t)=>e.linkedAccounts.filter(e=>"wallet"===e.type&&"privy"===e.walletClientType&&!e.imported&&e.chainType===t),ey=e=>e?eg(e,"solana"):[],em=e=>e?ey(e).find(e=>0===e.walletIndex)??null:null,eb=e=>(e?.linkedAccounts??[]).filter(e=>"wallet"===e.type&&"privy"===e.walletClientType&&e.imported&&"ethereum"===e.chainType),ew=e=>(e?.linkedAccounts??[]).filter(e=>"wallet"===e.type&&e.imported&&"privy"===e.walletClientType&&"solana"===e.chainType),ev=(e,t)=>e?.linkedAccounts.find(e=>"wallet"===e.type&&"privy"===e.walletClientType&&ei(e.address,t))||null,eE=(e,t)=>e.find(e=>ei(e.address,t))||null,ex=e=>{let t=ed(e),r=em(e);return t&&r&&!eu(r)&&eu(t)?r:ed(e)??em(e)};function e_(e){if(!e)return null;let t=function(e){let t=[];for(let r of e){let e=r.type;switch(r.type){case"wallet":let n={id:r.id,address:r.address,type:r.type,imported:r.imported,delegated:r.delegated,firstVerifiedAt:ef(r.first_verified_at),latestVerifiedAt:ef(r.latest_verified_at),chainType:r.chain_type,walletClientType:r.wallet_client_type,connectorType:r.connector_type,recoveryMethod:r.recovery_method,walletIndex:r.wallet_index,publicKey:r.public_key};t.push(n);break;case"smart_wallet":let i={address:r.address,type:r.type,firstVerifiedAt:ef(r.first_verified_at),latestVerifiedAt:ef(r.latest_verified_at),smartWalletType:r.smart_wallet_type,smartWalletVersion:r.smart_wallet_version};t.push(i);break;case"cross_app":let s={type:r.type,subject:r.subject,embeddedWallets:r.embedded_wallets,smartWallets:r.smart_wallets,providerApp:{id:r.provider_app_id},firstVerifiedAt:ef(r.first_verified_at),latestVerifiedAt:ef(r.latest_verified_at)};t.push(s);break;case"email":let o={address:r.address,type:r.type,firstVerifiedAt:ef(r.first_verified_at),latestVerifiedAt:ef(r.latest_verified_at)};t.push(o);break;case"phone":let a={number:r.phoneNumber,type:r.type,firstVerifiedAt:ef(r.first_verified_at),latestVerifiedAt:ef(r.latest_verified_at)};t.push(a);break;case"google_oauth":let l={subject:r.subject,email:r.email,name:r.name,type:r.type,firstVerifiedAt:ef(r.first_verified_at),latestVerifiedAt:ef(r.latest_verified_at)};t.push(l);break;case"spotify_oauth":let c={subject:r.subject,email:r.email,name:r.name,type:r.type,firstVerifiedAt:ef(r.first_verified_at),latestVerifiedAt:ef(r.latest_verified_at)};t.push(c);break;case"instagram_oauth":let u={subject:r.subject,username:r.username,type:r.type,firstVerifiedAt:ef(r.first_verified_at),latestVerifiedAt:ef(r.latest_verified_at)};t.push(u);break;case"twitter_oauth":let f={subject:r.subject,username:r.username,name:r.name,type:r.type,profilePictureUrl:r.profile_picture_url,firstVerifiedAt:ef(r.first_verified_at),latestVerifiedAt:ef(r.latest_verified_at)};t.push(f);break;case"discord_oauth":let h={subject:r.subject,username:r.username,email:r.email,type:r.type,firstVerifiedAt:ef(r.first_verified_at),latestVerifiedAt:ef(r.latest_verified_at)};t.push(h);break;case"github_oauth":let d={subject:r.subject,username:r.username,name:r.name,email:r.email,type:r.type,firstVerifiedAt:ef(r.first_verified_at),latestVerifiedAt:ef(r.latest_verified_at)};t.push(d);break;case"tiktok_oauth":let p={subject:r.subject,username:r.username,name:r.name,type:r.type,firstVerifiedAt:ef(r.first_verified_at),latestVerifiedAt:ef(r.latest_verified_at)};t.push(p);break;case"line_oauth":let g={subject:r.subject,name:r.name,email:r.email,profilePictureUrl:r.profile_picture_url,type:r.type,firstVerifiedAt:ef(r.first_verified_at),latestVerifiedAt:ef(r.latest_verified_at)};t.push(g);break;case"twitch_oauth":let y={subject:r.subject,username:r.username,type:r.type,firstVerifiedAt:ef(r.first_verified_at),latestVerifiedAt:ef(r.latest_verified_at)};t.push(y);break;case"linkedin_oauth":let m={subject:r.subject,name:r.name,email:r.email,vanityName:r.vanity_name,type:r.type,firstVerifiedAt:ef(r.first_verified_at),latestVerifiedAt:ef(r.latest_verified_at)};t.push(m);break;case"apple_oauth":let b={subject:r.subject,email:r.email,type:r.type,firstVerifiedAt:ef(r.first_verified_at),latestVerifiedAt:ef(r.latest_verified_at)};t.push(b);break;case"custom_auth":t.push({type:r.type,customUserId:r.custom_user_id,firstVerifiedAt:ef(r.first_verified_at),latestVerifiedAt:ef(r.latest_verified_at)});break;case"farcaster":let w={type:r.type,fid:r.fid,ownerAddress:r.owner_address,displayName:r.display_name,username:r.username,bio:r.bio,pfp:r.profile_picture_url,url:r.homepage_url,firstVerifiedAt:ef(r.first_verified_at),latestVerifiedAt:ef(r.latest_verified_at),signerPublicKey:r.signer_public_key};t.push(w);break;case"passkey":let v={type:r.type,enrolledInMfa:r.enrolled_in_mfa,credentialId:r.credential_id,publicKey:r.public_key,authenticatorName:r.authenticator_name,createdWithDevice:r.created_with_device,createdWithOs:r.created_with_os,createdWithBrowser:r.created_with_browser,firstVerifiedAt:ef(r.first_verified_at),latestVerifiedAt:ef(r.latest_verified_at)};t.push(v);break;case"telegram":let E={type:r.type,telegramUserId:r.telegram_user_id,firstName:r.first_name,lastName:r.last_name,username:r.username,photoUrl:r.photo_url,firstVerifiedAt:ef(r.first_verified_at),latestVerifiedAt:ef(r.latest_verified_at)};t.push(E);break;default:if(ec(r.type)){let e={type:r.type,subject:r.subject,name:r.name,username:r.username,email:r.email,profilePictureUrl:r.profile_picture_url,firstVerifiedAt:ef(r.first_verified_at),latestVerifiedAt:ef(r.latest_verified_at)};t.push(e);break}console.warn(`Unrecognized account type: ${e}. Please consider upgrading the Privy SDK.`)}}return t}(e.linked_accounts),r=eh(t,"wallet"),n=eh(t,"smart_wallet"),i=eh(t,"email"),s=eh(t,"phone"),o=eh(t,"google_oauth"),a=eh(t,"twitter_oauth"),l=eh(t,"discord_oauth"),c=eh(t,"github_oauth"),u=eh(t,"spotify_oauth"),f=eh(t,"instagram_oauth"),h=eh(t,"tiktok_oauth"),d=eh(t,"line_oauth"),p=eh(t,"twitch_oauth"),g=eh(t,"linkedin_oauth"),y=eh(t,"apple_oauth"),m=eh(t,"farcaster"),b=eh(t,"telegram"),w=e.mfa_methods.map(({type:e,verified_at:t})=>({type:e,verifiedAt:ef(t)}));return{id:e.id,createdAt:ef(e.created_at),linkedAccounts:t,email:i&&{address:i?.address},phone:s&&{number:s?.number},wallet:r&&{id:r.id,address:r.address,chainType:r.chainType,walletClientType:r.walletClientType,connectorType:r.connectorType,recoveryMethod:r.re
48coveryMethod,imported:r.imported,delegated:r.delegated,walletIndex:r.walletIndex,publicKey:r.publicKey},smartWallet:n&&{address:n.address,smartWalletType:n.smartWalletType,smartWalletVersion:n.smartWalletVersion},google:o&&{subject:o.subject,email:o.email,name:o.name},twitter:a&&{subject:a.subject,username:a.username,name:a.name,profilePictureUrl:a.profilePictureUrl},discord:l&&{subject:l.subject,username:l.username,email:l.email},github:c&&{subject:c.subject,username:c.username,name:c.name,email:c.email},spotify:u&&{subject:u.subject,email:u.email,name:u.name},instagram:f&&{subject:f.subject,username:f.username},tiktok:h&&{subject:h.subject,username:h.username,name:h.name},line:d&&{subject:d.subject,name:d.name,email:d.email,profilePictureUrl:d.profilePictureUrl},twitch:p&&{subject:p.subject,username:p.username},linkedin:g&&{subject:g.subject,name:g.name,email:g.email,vanityName:g.vanityName},apple:y&&{subject:y.subject,email:y.email},farcaster:m&&{fid:m.fid,ownerAddress:m.ownerAddress,displayName:m.displayName,username:m.username,bio:m.bio,pfp:m.pfp,url:m.url,signerPublicKey:m.signerPublicKey},telegram:b&&{telegramUserId:b.telegramUserId,firstName:b.firstName,lastName:b.lastName,username:b.username,photoUrl:b.photoUrl},delegatedWallets:[],mfaMethods:w.map(e=>e.type),hasAcceptedTerms:e.has_accepted_terms??!1,isGuest:e.is_guest,customMetadata:e.custom_metadata}}function eA({src:e,...t}){return(0,es.jsx)("img",{src:e,...t,style:{display:"none"}})}let eS=(0,eo.createContext)({currentScreen:null,lastScreen:null,navigate:el.n,navigateBack:el.n,resetNavigation:el.n,setModalData:el.n,onUserCloseViaDialogOrKeybindRef:void 0}),eI=e=>{let t=(0,ea.u)(),[r,n]=(0,eo.useState)(e.initialScreen),i=(0,eo.useRef)(null);(0,eo.useEffect)(()=>{e.open||(i.current=null)},[e.open]),(0,eo.useEffect)(()=>{i.current=null},[e.initialScreen]);let s={data:e.data,setModalData:e.setModalData,currentScreen:e.initialScreen,lastScreen:r,navigate:(t,r=!0)=>{e.setInitialScreen(t),r&&n(e.initialScreen)},navigateBack:()=>{e.setInitialScreen(r)},resetNavigation:()=>{e.setInitialScreen(null),n(null)},onUserCloseViaDialogOrKeybindRef:i};return(0,es.jsxs)(eS.Provider,{value:s,children:[("string"==typeof t.appearance.logo||"img"===t.appearance.logo?.type)&&(0,es.jsx)(eA,{src:"string"==typeof t.appearance.logo?t.appearance.logo:t.a
48ppearance.logo.props.src}),e.children]})},eO=()=>(0,eo.useContext)(eS),eP=(0,eo.createContext)({ready:!1,authenticated:!1,user:null,error:null,walletConnectors:null,connectWallet:el.n,login:el.n,connectOrCreateWallet:el.n,linkEmail:el.n,linkPhone:el.n,linkFarcaster:el.n,linkWallet:el.n,linkGoogle:el.n,linkTwitter:el.n,linkTwitch:el.n,linkDiscord:el.n,linkGithub:el.n,linkSpotify:el.n,linkInstagram:el.n,linkTelegram:el.n,linkTiktok:el.n,linkLine:el.n,linkLinkedIn:el.n,linkApple:el.n,linkPasskey:el.n,linkOAuth:el.n,updateEmail:el.n,updatePhone:el.n,logout:el.n,getAccessToken:el.n,signMessage:el.n,signTypedData:el.n,enrollInMfa:el.n,initEnrollmentWithSms:el.n,initEnrollmentWithTotp:el.n,initEnrollmentWithPasskey:el.n,promptMfa:el.n,init:el.n,submitEnrollmentWithSms:el.n,submitEnrollmentWithTotp:el.n,submitEnrollmentWithPasskey:el.n,unenroll:el.n,submit:el.n,cancel:el.n,sendTransaction:el.n,signTransaction:el.n,setWalletPassword:el.n,setWalletRecovery:el.n,isModalOpen:!1,mfaMethods:[]}),eC=()=>(0,eo.useContext)(eP)},73903:function(e,t,r){"use strict";let n,i,s;r.d(t,{ou:function(){return d_},Vn:function(){return pg},Qj:function(){return pp}}),r(2265);var o,a,l=r(20545),c=r(10541),u=r(21672);r(86772);var f=r(72788),h=r(67550),d=r(56408),p=r(50040),g=r(97629),y=r(72669),m=r(91799),b=r(29319),w=r(65891),v=r(64767),E=((o=E||{})[o.AddMemo=0]="AddMemo",o),x=r(71787),_=function(e,t,r,n){if("a"===r&&!n)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!n:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?n:"a"===r?n.call(e):n?n.value:t.get(e)},A=function(e,t,r,n,i){if("m"===n)throw TypeError("Private method is not writable");if("a"===n&&!i)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!i:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===n?i.call(e,r):i?i.value=r:t.set(e,r),r};let S=new Set,I={};function O(...e){return(e=e.filter(e=>!S.has(e))).length?(e.forEach(e=>{n=void 0,S.add(e)}),I.register?.forEach(t=>k(()=>t(...e))),function(){e.forEach(e=>{n=void 0,S.delete(e)}),I.unregister?.forEach(t=>k(()=>t(...e)))}):()=>{}}function P(){return n||(n=[...S]),n}function C(e,t){return I[e]?.push(t)||(I[e]=[t]),function(){I[e]=I[e]?.filter(e=>t!==e)}}function k(e){try{e()}catch(e){console.error(e)}}class T extends Event{get detail(){return _(this,a,"f")}get type(){return"wallet-standard:app-ready"}constructor(e){super("wallet-standard:app-ready",{bubbles:!1,cancelable:!1,composed:!1}),a.set(this,void 0),A(this,a,e,"f")}preventDefault(){throw Error("preventDefault cannot be called")}stopImmediatePropagation(){throw Error("stopImmediatePropagation cannot be called")}stopPropagation(){throw Error("stopPropagation cannot be called")}}a=new WeakMap;var B=r(68885),R=r(77330),D=r(48261),U=r(72625),M=r.n(U),N=r(54112);let j={level:"info"},L="custom_context";var $=Object.defineProperty,z=(e,t,r)=>t in e?$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,F=(e,t,r)=>z(e,"symbol"!=typeof t?t+"":t,r);class q{constructor(e){F(this,"nodeValue"),F(this,"sizeInBytes"),F(this,"next"),this.nodeValue=e,this.sizeInBytes=new TextEncoder().encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}}class W{constructor(e){F(this,"lengthInNodes"),F(this,"sizeInBytes"),F(this,"head"),F(this,"tail"),F(this,"maxSizeInBytes"),this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){let t=new q(e);if(t.size>this.maxSizeInBytes)throw Error(`[LinkedList] Value too big to insert into list: ${e} with size ${t.size}`);for(;this.size+t.size>this.maxSizeInBytes;)this.shift();this.head?this.tail&&(this.tail.next=t):this.head=t,this.tail=t,this.lengthInNodes++,this.sizeInBytes+=t.size}shift(){if(!this.head)return;let e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=e.size}toArray(){let e=[],t=this.head;for(;null!==t;)e.push(t.value),t=t.next;return e}get length(){return this.lengthInNodes}get size(){return this.sizeInBytes}toOrderedArray(){return Array.from(this)}[Symbol.iterator](){let e=this.head;return{next:()=>{if(!e)return{done:!0,value:null};let t=e.value;return e=e.next,{done:!1,value:t}}}}}var V=Object.defineProperty,H=(e,t,r)=>t in e?V(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,G=(e,t,r)=>H(e,"symbol"!=typeof t?t+"":t,r);class K{constructor(e,t=1024e3){G(this,"logs"),G(this,"level"),G(this,"levelValue"),G(this,"MAX_LOG_SIZE_IN_BYTES"),this.level=e??"error",this.levelValue=U.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=t,this.logs=new W(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,t){t===U.levels.values.error?console.error(e):t===U.levels.values.warn?console.warn(e):t===U.levels.values.debug?console.debug(e):t===U.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append((0,N.u)({timestamp:new Date().toISOString(),log:e}));let t="string"==typeof e?JSON.parse(e).level:e.level;t>=this.levelValue&&this.forwardToConsole(e,t)}getLogs(){return this.logs}clearLogs(){this.logs=new W(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){let t=this.getLogArray();return t.push((0,N.u)({extraMetadata:e})),new Blob(t,{type:"application/json"})}}var Z=Object.defineProperty,J=(e,t,r)=>t in e?Z(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,Y=(e,t,r)=>J(e,"symbol"!=typeof t?t+"":t,r);class X{constructor(e,t=1024e3){Y(this,"baseChunkLogger"),this.baseChunkLogger=new K(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}downloadLogsBlobInBrowser(e){let t=URL.createObjectURL(this.logsToBlob(e)),r=document.createElement("a");r.href=t,r.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(r),r.click(),document.body.removeChild(r),URL.revokeObjectURL(t)}}var Q=Object.defineProperty,ee=(e,t,r)=>t in e?Q(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,et=(e,t,r)=>ee(e,"symbol"!=typeof t?t+"":t,r);class er{constructor(e,t=1024e3){et(this,"baseChunkLogger"),this.baseChunkLogger=new K(e,t)}write(e){this.baseChunkLogger.appendToLogs(e)}getLogs(){return this.baseChunkLogger.getLogs()}clearLogs(){this.baseChunkLogger.clearLogs()}getLogArray(){return this.baseChunkLogger.getLogArray()}logsToBlob(e){return this.baseChunkLogger.logsToBlob(e)}}var en=Object.defineProperty,ei=Object.defineProperties,es=Object.getOwnPropertyDescriptors,eo=Object.getOwnPropertySymbols,ea=Object.prototype.hasOwnProperty,el=Object.prototype.propertyIsEnumerable,ec=(e,t,r)=>t in e?en(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,eu=(e,t)=>
48{for(var r in t||(t={}))ea.call(t,r)&&ec(e,r,t[r]);if(eo)for(var r of eo(t))el.call(t,r)&&ec(e,r,t[r]);return e},ef=(e,t)=>ei(e,es(t));function eh(e,t=L){return e[t]||""}function ed(e,t,r=L){let n=function(e,t,r=L){let n=eh(e,r);return n.trim()?`${n}/${t}`:t}(e,t,r);return function(e,t,r=L){return e[r]=t,e}(e.child({context:n}),n,r)}function ep(e){return"u">typeof e.loggerOverride&&"string"!=typeof e.loggerOverride?{logger:e.loggerOverride,chunkLoggerController:null}:"u">typeof window?function(e){var t,r;let n=new X(null==(t=e.opts)?void 0:t.level,e.maxSizeInBytes);return{logger:M()(ef(eu({},e.opts),{level:"trace",browser:ef(eu({},null==(r=e.opts)?void 0:r.browser),{write:e=>n.write(e)})})),chunkLoggerController:n}}(e):function(e){var t;let r=new er(null==(t=e.opts)?void 0:t.level,e.maxSizeInBytes);return{logger:M()(ef(eu({},e.opts),{level:"trace"}),r),chunkLoggerController:r}}(e)}var eg=r(5942),ey=Object.defineProperty,em=(e,t,r)=>t in e?ey(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,eb=(e,t,r)=>em(e,"symbol"!=typeof t?t+"":t,r);class ew extends eg.q{constructor(e){super(),this.opts=e,eb(this,"protocol","wc"),eb(this,"version",2)}}var ev=Object.defineProperty,eE=(e,t,r)=>t in e?ev(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ex=(e,t,r)=>eE(e,"symbol"!=typeof t?t+"":t,r);class e_ extends eg.q{constructor(e,t){super(),this.core=e,this.logger=t,ex(this,"records",new Map)}}class eA{constructor(e,t){this.logger=e,this.core=t}}class eS extends eg.q{constructor(e,t){super(),this.relayer=e,this.logger=t}}class eI extends eg.q{constructor(e){super()}}class eO{constructor(e,t,r,n){this.core=e,this.logger=t,this.name=r}}class eP extends eg.q{constructor(e,t){super(),this.relayer=e,this.logger=t}}class eC extends eg.q{constructor(e,t){super(),this.core=e,this.logger=t}}class ek{constructor(e,t,r){this.core=e,this.logger=t,this.store=r}}class eT{constructor(e,t){this.projectId=e,this.logger=t}}class eB{constructor(e,t,r){this.core=e,this.logger=t,this.telemetryEnabled=r}}var eR=Object.defineProperty,eD=(e,t,r)=>t in e?eR(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,eU=(e,t,r)=>eD(e,"symbol"!=typeof t?t+"":t,r);class eM{constructor(e){this.opts=e,eU(this,"protocol","wc"),eU(this,"version",2)}}class eN{constructor(e){this.client=e}}var ej=r(54574),eL=r(28699),e$=r(52159),ez=r(25527),eF=r(70053);class eq extends Error{constructor(e,t={}){let r=(()=>{if(t.cause instanceof eq){if(t.cause.details)return t.cause.details;if(t.cause.shortMessage)return t.cause.shortMessage}return t.cause&&"details"in t.cause&&"string"==typeof t.cause.details?t.cause.details:t.cause?.message?t.cause.message:t.details})(),n=t.cause instanceof eq&&t.cause.docsPath||t.docsPath,i=`https://oxlib.sh${n??""}`;super([e||"An error occurred.",...t.metaMessages?["",...t.metaMessages]:[],...r||n?["",r?`Details: ${r}`:void 0,n?`See: ${i}`:void 0]:[]].filter(e=>"string"==typeof e).join("\n"),t.cause?{cause:t.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:"[email protected]"}),this.cause=t.cause,this.details=r,this.docs=i,this.docsPath=n,this.shortMessage=e}walk(e){return function e(t,r){return r?.(t)?t:t&&"object"==typeof t&&"cause"in t&&t.cause?e(t.cause,r):r?null:t}(this,e)}}function eW(e,t){if(eQ(e)>t)throw new e6({givenSize:eQ(e),maxSize:t})}function eV(e,t={}){let{dir:r,size:n=32}=t;if(0===n)return e;let i=e.replace("0x","");if(i.length>2*n)throw new e8({size:Math.ceil(i.length/2),targetSize:n,type:"Hex"});return`0x${i["right"===r?"padEnd":"padStart"](2*n,"0")}`}function eH(e,t,r){return JSON.stringify(e,(e,r)=>"function"==typeof t?t(e,r):"bigint"==typeof r?r.toString()+"#__bigint":r,r)}let eG=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function eK(e){return e instanceof Uint8Array?eZ(e):Array.isArray(e)?eZ(new Uint8Array(e)):e}function eZ(e,t={}){let r="";for(let t=0;t<e.length;t++)r+=eG[e[t]];let n=`0x${r}`;return"number"==typeof t.size?(eW(n,t.size),eY(n,t.size)):n}function eJ(e,t={}){let r;let{signed:n,size:i}=t,s=BigInt(e);i?r=n?(1n<<8n*BigInt(i)-1n)-1n:2n**(8n*BigInt(i))-1n:"number"==typeof e&&(r=BigInt(Number.MAX_SAFE_INTEGER));let o="bigint"==typeof r&&n?-r-1n:0;if(r&&s>r||s<o){let t="bigint"==typeof e?"n":"";throw new e0({max:r?`${r}${t}`:void 0,min:`${o}${t}`,signed:n,size:i,value:`${e}${t}`})}let a=(n&&s<0?(1n<<BigInt(8*i))+BigInt(s):s).toString(16),l=`0x${a}`;return i?eV(l,{dir:"left",size:i}):l}function eY(e,t){return eV(e,{dir:"right",size:t})}function eX(e,t,r,n={}){let{strict:i}=n;!function(e,t){if("number"==typeof t&&t>0&&t>eQ(e)-1)throw new e5({offset:t,position:"start",size:eQ(e)})}(e,t);let s=`0x${e.replace("0x","").slice((t??0)*2,(r??e.length)*2)}`;return i&&function(e,t,r){if("number"==typeof t&&"number"==typeof r&&eQ(e)!==r-t)throw new e5({offset:r,position:"end",size:eQ(e)})}(s,t,r),s}function eQ(e){return Math.ceil((e.length-2)/2)}class e0 extends eq{constructor({max:e,min:t,signed:r,size:n,value:i}
vendor: 9,980 bytes, line 48
48){super(`Number \`${i}\` is not in safe${n?` ${8*n}-bit`:""}${r?" signed":" unsigned"} integer range ${e?`(\`${t}\` to \`${e}\`)`:`(above \`${t}\`)`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.IntegerOutOfRangeError"})}}class e1 extends eq{constructor(e){super(`Value \`${"object"==typeof e?eH(e):e}\` of type \`${typeof e}\` is an invalid hex type.`,{metaMessages:['Hex types must be represented as `"0x${string}"`.']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexTypeError"})}}class e2 extends eq{constructor(e){super(`Value \`${e}\` is an invalid hex value.`,{metaMessages:['Hex values must start with `"0x"` and contain only hexadecimal characters (0-9, a-f, A-F).']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexValueError"})}}class e6 extends eq{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed \`${t}\` bytes. Given size: \`${e}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeOverflowError"})}}class e5 extends eq{constructor({offset:e,position:t,size:r}){super(`Slice ${"start"===t?"starting":"ending"} at offset \`${e}\` is out-of-bounds (size: \`${r}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SliceOffsetOutOfBoundsError"})}}class e8 extends eq{constructor({size:e,targetSize:t,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${e}\`) exceeds padding size (\`${t}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeExceedsPaddingSizeError"})}}class e3 extends eq{constructor({signature:e}){super(`Value \`${e}\` is an invalid signature size.`,{metaMessages:["Expected: 64 bytes or 65 bytes.",`Received ${eQ(eK(e))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSerializedSizeError"})}}class e4 extends eq{constructor({value:e}){super(`Value \`${e}\` is an invalid y-parity value. Y-parity must be 0 or 1.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidYParityError"})}}class e9 extends eq{constructor({value:e}){super(`Value \`${e}\` is an invalid v value. v must be 27, 28 or >=35.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidVError"})}}var e7=r(65086),te=r(23115),tt=r(79047);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */let tr=BigInt(0),tn=BigInt(1);function ti(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function ts(e){if(!ti(e))throw Error("Uint8Array expected")}function to(e,t){if("boolean"!=typeof t)throw Error(e+" boolean expected, got "+t)}function ta(e){let t=e.toString(16);return 1&t.length?"0"+t:t}function tl(e){if("string"!=typeof e)throw Error("hex string expected, got "+typeof e);return""===e?tr:BigInt("0x"+e)}let tc="function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex,tu=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function tf(e){if(ts(e),tc)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=tu[e[r]];return t}let th={_0:48,_9:57,A:65,F:70,a:97,f:102};function td(e){return e>=th._0&&e<=th._9?e-th._0:e>=th.A&&e<=th.F?e-(th.A-10):e>=th.a&&e<=th.f?e-(th.a-10):void 0}function tp(e){if("string"!=typeof e)throw Error("hex string expected, got "+typeof e);if(tc)return Uint8Array.fromHex(e);let t=e.length,r=t/2;if(t%2)throw Error("hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(r);for(let t=0,i=0;t<r;t++,i+=2){let r=td(e.charCodeAt(i)),s=td(e.charCodeAt(i+1));if(void 0===r||void 0===s)throw Error('hex string expected, got non-hex character "'+(e[i]+e[i+1])+'" at index '+i);n[t]=16*r+s}return n}function tg(e){return tl(tf(e))}function ty(e){return ts(e),tl(tf(Uint8Array.from(e).reverse()))}function tm(e,t){return tp(e.toString(16).padStart(2*t,"0"))}function tb(e,t){return tm(e,t).reverse()}function tw(e,t,r){let n;if("string"==typeof t)try{n=tp(t)}catch(t){throw Error(e+" must be hex string or Uint8Array, cause: "+t)}else if(ti(t))n=Uint8Array.from(t);else throw Error(e+" must be hex string or Uint8Array");let i=n.length;if("number"==typeof r&&i!==r)throw Error(e+" of length "+r+" expected, got "+i);return n}function tv(...e){let t=0;for(let r=0;r<e.length;r++){let n=e[r];ts(n),t+=n.length}let r=new Uint8Array(t);for(let t=0,n=0;t<e.length;t++){let i=e[t];r.set(i,n),n+=i.length}return r}let tE=e=>"bigint"==typeof e&&tr<=e;function tx(e,t,r){return tE(e)&&tE(t)&&tE(r)&&t<=e&&e<r}function t_(e,t,r,n){if(!tx(t,r,n))throw Error("expected valid "+e+": "+r+" <= n < "+n+", got "+t)}let tA=e=>(tn<<BigInt(e))-tn,tS=e=>new Uint8Array(e),tI=e=>Uint8Array.from(e),tO={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||ti(e),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 tP(e,t,r={}){let n=(t,r,n)=>{let i=tO[r];if("function"!=typeof i)throw Error("invalid validator function");let s=e[t];if((!n||void 0!==s)&&!i(s,e))throw Error("param "+String(t)+" is invalid. Expected "+r+", got "+s)};for(let[e,r]of Object.entries(t))n(e,r,!1);for(let[e,t]of Object.entries(r))n(e,t,!0);return e}function tC(e){let t=new WeakMap;return(r,...n)=>{let i=t.get(r);if(void 0!==i)return i;let s=e(r,...n);return t.set(r,s),s}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */let tk=BigInt(0),tT=BigInt(1),tB=BigInt(2),tR=BigInt(3),tD=BigInt(4),tU=BigInt(5),tM=BigInt(8);function tN(e,t){let r=e%t;return r>=tk?r:t+r}function tj(e,t,r){let n=e;for(;t-- >tk;)n*=n,n%=r;return n}function tL(e,t){if(e===tk)throw Error("invert: expected non-zero number");if(t<=tk)throw Error("invert: expected positive modulus, got "+t);let r=tN(e,t),n=t,i=tk,s=tT,o=tT,a=tk;for(;r!==tk;){let e=n/r,t=n%r,l=i-o*e,c=s-a*e;n=r,r=t,i=o,s=a,o=l,a=c}if(n!==tT)throw Error("invert: does not exist");return tN(i,t)}function t$(e,t){let r=(e.ORDER+tT)/tD,n=e.pow(t,r);if(!e.eql(e.sqr(n),t))throw Error("Cannot find square root");return n}function tz(e,t){let r=(e.ORDER-tU)/tM,n=e.mul(t,tB),i=e.pow(n,r),s=e.mul(t,i),o=e.mul(e.mul(s,tB),i),a=e.mul(s,e.sub(o,e.ONE));if(!e.eql(e.sqr(a),t))throw Error("Cannot find square root");return a}let tF=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function tq(e,t,r=!1){let n=Array(t.length).fill(r?e.ZERO:void 0),i=t.reduce((t,r,i)=>e.is0(r)?t:(n[i]=t,e.mul(t,r)),e.ONE),s=e.inv(i);return t.reduceRight((t,r,i)=>e.is0(r)?t:(n[i]=e.mul(t,n[i]),e.mul(t,r)),s),n}function tW(e,t){let r=(e.ORDER-tT)/tB,n=e.pow(t,r),i=e.eql(n,e.ONE),s=e.eql(n,e.ZERO),o=e.eql(n,e.neg(e.ONE));if(!i&&!s&&!o)throw Error("invalid Legendre symbol result");return i?1:s?0:-1}function tV(e,t){void 0!==t&&(0,tt.k8)(t);let r=void 0!==t?t:e.toString(2).length;return{nBitLength:r,nByteLength:Math.ceil(r/8)}}function tH(e,t,r=!1,n={}){let i;if(e<=tk)throw Error("invalid field: expected ORDER > 0, got "+e);let{nBitLength:s,nByteLength:o}=tV(e,t);if(o>2048)throw Error("invalid field: expected ORDER of <= 2048 bytes");let a=Object.freeze({ORDER:e,isLE:r,BITS:s,BYTES:o,MASK:tA(s),ZERO:tk,ONE:tT,create:t=>tN(t,e),isValid:t=>{if("bigint"!=typeof t)throw Error("invalid field element: expected bigint, got "+typeof t);return tk<=t&&t<e},is0:e=>e===tk,isOdd:e=>(e&tT)===tT,neg:t=>tN(-t,e),eql:(e,t)=>e===t,sqr:t=>tN(t*t,e),add:(t,r)=>tN(t+r,e),sub:(t,r)=>tN(t-r,e),mul:(t,r)=>tN(t*r,e),pow:(e,t)=>(function(e,t,r){if(r<tk)throw Error("invalid exponent, negatives unsupported");if(r===tk)return e.ONE;if(r===tT)return t;let n=e.ONE,i=t;for(;r>tk;)r&tT&&(n=e.mul(n,i)),i=e.sqr(i),r>>=tT;return n})(a,e,t),div:(t,r)=>tN(t*tL(r,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>tL(t,e),sqrt:n.sqrt||(t=>(!i&&(i=e%tD===tR?t$:e%tM===tU?tz:function(e){if(e<BigInt(3))throw Error("sqrt is not defined for small field");let t=e-tT,r=0;for(;t%tB===tk;)t/=tB,r++;let n=tB,i=tH(e);for(;1===tW(i,n);)if(n++>1e3)throw Error("Cannot find square root: probably non-prime P");if(1===r)return t$;let s=i.pow(n,t),o=(t+tT)/tB;return function(e,n){if(e.is0(n))return n;if(1!==tW(e,n))throw Error("Cannot find square root");let i=r,a=e.mul(e.ONE,s),l=e.pow(n,t),c=e.pow(n,o);for(;!e.eql(l,e.ONE);){if(e.is0(l))return e.ZERO;let t=1,r=e.sqr(l);for(;!e.eql(r,e.ONE);)if(t++,r=e.sqr(r),t===i)throw Error("Cannot find square root");let n=tT<<BigInt(i-t-1),s=e.pow(a,n);i=t,a=e.sqr(s),l=e.mul(l,a),c=e.mul(c,s)}return c}}(e)),i(a,t))),toBytes:e=>r?tb(e,o):tm(e,o),fromBytes:e=>{if(e.length!==o)throw Error("Field.fromBytes: expected "+o+" bytes, got "+e.length);return r?ty(e):tg(e)},invertBatch:e=>tq(a,e),cmov:(e,t,r)=>r?t:e});return Object.freeze(a)}function tG(e){if("bigint"!=typeof e)throw Error("field order must be bigint");return Math.ceil(e.toString(2).length/8)}function tK(e){let t=tG(e);return t+Math.ceil(t/2)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */let tZ=BigInt(0),tJ=BigInt(1);function tY(e,t){let r=t.negate();return e?r:t}function tX(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw Error("invalid window size, expected [1.."+t+"], got W="+e)}function tQ(e,t){tX(e,t);let r=Math.ceil(t/e)+1,n=2**(e-1),i=2**e;return{windows:r,windowSize:n,mask:tA(e),maxNumber:i,shiftBy:BigInt(e)}}function t0(e,t,r){let{windowSize:n,mask:i,maxNumber:s,shiftBy:o}=r,a=Number(e&i),l=e>>o;a>n&&(a-=s,l+=tJ);let c=t*n,u=c+Math.abs(a)-1;return{nextN:l,offset:u,isZero:0===a,isNeg:a<0,isNegF:t%2!=0,offsetF:c}}let t1=new WeakMap,t2=new WeakMap;function t6(e){return t2.get(e)||1}function t5(e){return tP(e.Fp,tF.reduce((e,t)=>
vendor: 20,744 bytes, line 48
48(e[t]="function",e),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),tP(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...tV(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function t8(e){void 0!==e.lowS&&to("lowS",e.lowS),void 0!==e.prehash&&to("prehash",e.prehash)}class t3 extends Error{constructor(e=""){super(e)}}let t4={Err:t3,_tlv:{encode:(e,t)=>{let{Err:r}=t4;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(1&t.length)throw new r("tlv.encode: unpadded data");let n=t.length/2,i=ta(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");let s=n>127?ta(i.length/2|128):"";return ta(e)+s+i+t},decode(e,t){let{Err:r}=t4,n=0;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(t.length<2||t[n++]!==e)throw new r("tlv.decode: wrong tlv");let i=t[n++],s=0;if(128&i){let e=127&i;if(!e)throw new r("tlv.decode(long): indefinite length not supported");if(e>4)throw new r("tlv.decode(long): byte length is too big");let o=t.subarray(n,n+e);if(o.length!==e)throw new r("tlv.decode: length bytes not complete");if(0===o[0])throw new r("tlv.decode(long): zero leftmost byte");for(let e of o)s=s<<8|e;if(n+=e,s<128)throw new r("tlv.decode(long): not minimal encoding")}else s=i;let o=t.subarray(n,n+s);if(o.length!==s)throw new r("tlv.decode: wrong value length");return{v:o,l:t.subarray(n+s)}}},_int:{encode(e){let{Err:t}=t4;if(e<t9)throw new t("integer: negative integers are not allowed");let r=ta(e);if(8&Number.parseInt(r[0],16)&&(r="00"+r),1&r.length)throw new t("unexpected DER parsing assertion: unpadded hex");return r},decode(e){let{Err:t}=t4;if(128&e[0])throw new t("invalid signature integer: negative");if(0===e[0]&&!(128&e[1]))throw new t("invalid signature integer: unnecessary leading zero");return tg(e)}},toSig(e){let{Err:t,_int:r,_tlv:n}=t4,i=tw("signature",e),{v:s,l:o}=n.decode(48,i);if(o.length)throw new t("invalid signature: left bytes after parsing");let{v:a,l:l}=n.decode(2,s),{v:c,l:u}=n.decode(2,l);if(u.length)throw new t("invalid signature: left bytes after parsing");return{r:r.decode(a),s:r.decode(c)}},hexFromSig(e){let{_tlv:t,_int:r}=t4,n=t.encode(2,r.encode(e.r)),i=t.encode(2,r.encode(e.s));return t.encode(48,n+i)}},t9=BigInt(0),t7=BigInt(1),re=(BigInt(2),BigInt(3)),rt=BigInt(4),rr=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),rn=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),ri=BigInt(0),rs=BigInt(1),ro=BigInt(2),ra=(e,t)=>(e+t/ro)/t,rl=tH(rr,void 0,void 0,{sqrt:function(e){let t=BigInt(3),r=BigInt(6),n=BigInt(11),i=BigInt(22),s=BigInt(23),o=BigInt(44),a=BigInt(88),l=e*e*e%rr,c=l*l*e%rr,u=tj(c,t,rr)*c%rr,f=tj(u,t,rr)*c%rr,h=tj(f,ro,rr)*l%rr,d=tj(h,n,rr)*h%rr,p=tj(d,i,rr)*d%rr,g=tj(p,o,rr)*p%rr,y=tj(g,a,rr)*g%rr,m=tj(y,o,rr)*p%rr,b=tj(m,t,rr)*c%rr,w=tj(b,s,rr)*d%rr,v=tj(w,r,rr)*l%rr,E=tj(v,ro,rr);if(!rl.eql(rl.sqr(E),e))throw Error("Cannot find square root");return E}}),rc=function(e,t){let r=t=>(function(e){let t=function(e){let t=t5(e);return tP(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}(e),{Fp:r,n:n,nByteLength:i,nBitLength:s}=t,o=r.BYTES+1,a=2*r.BYTES+1;function l(e){return tN(e,n)}let{ProjectivePoint:c,normPrivateKeyToScalar:u,weierstrassEquation:f,isWithinCurveOrder:h}=function(e){var t;let r=function(e){let t=t5(e);tP(t,{a:"field",b:"field"},{allowInfinityPoint:"boolean",allowedPrivateKeyLengths:"array",clearCofactor:"function",fromBytes:"function",isTorsionFree:"function",toBytes:"function",wrapPrivateKey:"boolean"});let{endo:r,Fp:n,a:i}=t;if(r){if(!n.eql(i,n.ZERO))throw Error("invalid endo: CURVE.a must be 0");if("object"!=typeof r||"bigint"!=typeof r.beta||"function"!=typeof r.splitScalar)throw Error('invalid endo: expected "beta": bigint and "splitScalar": function')}return Object.freeze({...t})}(e),{Fp:n}=r,i=tH(r.n,r.nBitLength),s=r.toBytes||((e,t,r)=>{let i=t.toAffine();return tv(Uint8Array.from([4]),n.toBytes(i.x),n.toBytes(i.y))}),o=r.fromBytes||(e=>{let t=e.subarray(1);return{x:n.fromBytes(t.subarray(0,n.BYTES)),y:n.fromBytes(t.subarray(n.BYTES,2*n.BYTES))}});function a(e){let{a:t,b:i}=r,s=n.sqr(e),o=n.mul(s,e);return n.add(n.add(o,n.mul(e,t)),i)}function l(e,t){let r=n.sqr(t),i=a(e);return n.eql(r,i)}if(!l(r.Gx,r.Gy))throw Error("bad curve params: generator point");let c=n.mul(n.pow(r.a,re),rt),u=n.mul(n.sqr(r.b),BigInt(27));if(n.is0(n.add(c,u)))throw Error("bad curve params: a or b");function f(e){let t;let{allowedPrivateKeyLengths:n,nByteLength:i,wrapPrivateKey:s,n:o}=r;if(n&&"bigint"!=typeof e){if(ti(e)&&(e=tf(e)),"string"!=typeof e||!n.includes(e.length))throw Error("invalid private key");e=e.padStart(2*i,"0")}try{t="bigint"==typeof e?e:tg(tw("private key",e,i))}catch(t){throw Error("invalid private key, expected hex or "+i+" bytes, got "+typeof e)}return s&&(t=tN(t,o)),t_("private key",t,t7,o),t}function h(e){if(!(e instanceof g))throw Error("ProjectivePoint expected")}let d=tC((e,t)=>{let{px:r,py:i,pz:s}=e;if(n.eql(s,n.ONE))return{x:r,y:i};let o=e.is0();null==t&&(t=o?n.ONE:n.inv(s));let a=n.mul(r,t),l=n.mul(i,t),c=n.mul(s,t);if(o)return{x:n.ZERO,y:n.ZERO};if(!n.eql(c,n.ONE))throw Error("invZ was invalid");return{x:a,y:l}}),p=tC(e=>{if(e.is0()){if(r.allowInfinityPoint&&!n.is0(e.py))return;throw Error("bad point: ZERO")}let{x:t,y:i}=e.toAffine();if(!n.isValid(t)||!n.isValid(i))throw Error("bad point: x or y not FE");if(!l(t,i))throw Error("bad point: equation left != right");if(!e.isTorsionFree())throw Error("bad point: not in prime-order subgroup");return!0});class g{constructor(e,t,r){if(null==e||!n.isValid(e))throw Error("x required");if(null==t||!n.isValid(t)||n.is0(t))throw Error("y required");if(null==r||!n.isValid(r))throw Error("z required");this.px=e,this.py=t,this.pz=r,Object.freeze(this)}static fromAffine(e){let{x:t,y:r}=e||{};if(!e||!n.isValid(t)||!n.isValid(r))throw Error("invalid affine point");if(e instanceof g)throw Error("projective point not allowed");let i=e=>n.eql(e,n.ZERO);return i(t)&&i(r)?g.ZERO:new g(t,r,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(e){let t=tq(n,e.map(e=>e.pz));return e.map((e,r)=>e.toAffine(t[r])).map(g.fromAffine)}static fromHex(e){let t=g.fromAffine(o(tw("pointHex",e)));return t.assertValidity(),t}static fromPrivateKey(e){return g.BASE.multiply(f(e))}static msm(e,t){return function(e,t,r,n){!function(e,t){if(!Array.isArray(e))throw Error("array expected");e.forEach((e,r)=>{if(!(e instanceof t))throw Error("invalid point at index "+r)})}(r,e),function(e,t){if(!Array.isArray(e))throw Error("array of scalars expected");e.forEach((e,r)=>{if(!t.isValid(e))throw Error("invalid scalar at index "+r)})}(n,t);let i=r.length,s=n.length;if(i!==s)throw Error("arrays of points and scalars must have equal length");let o=e.ZERO,a=function(e){let t;for(t=0;e>tr;e>>=tn,t+=1);return t}(BigInt(i)),l=1;a>12?l=a-3:a>4?l=a-2:a>0&&(l=2);let c=tA(l),u=Array(Number(c)+1).fill(o),f=Math.floor((t.BITS-1)/l)*l,h=o;for(let e=f;e>=0;e-=l){u.fill(o);for(let t=0;t<s;t++){let i=Number(n[t]>>BigInt(e)&c);u[i]=u[i].add(r[t])}let t=o;for(let e=u.length-1,r=o;e>0;e--)r=r.add(u[e]),t=t.add(r);if(h=h.add(t),0!==e)for(let e=0;e<l;e++)h=h.double()}return h}(g,i,e,t)}_setWindowSize(e){b.setWindowSize(this,e)}assertValidity(){p(this)}hasEvenY(){let{y:e}=this.toAffine();if(n.isOdd)return!n.isOdd(e);throw Error("Field doesn't support isOdd")}equals(e){h(e);let{px:t,py:r,pz:i}=this,{px:s,py:o,pz:a}=e,l=n.eql(n.mul(t,a),n.mul(s,i)),c=n.eql(n.mul(r,a),n.mul(o,i));return l&&c}negate(){return new g(this.px,n.neg(this.py),this.pz)}double(){let{a:e,b:t}=r,i=n.mul(t,re),{px:s,py:o,pz:a}=this,l=n.ZERO,c=n.ZERO,u=n.ZERO,f=n.mul(s,s),h=n.mul(o,o),d=n.mul(a,a),p=n.mul(s,o);return p=n.add(p,p),u=n.mul(s,a),u=n.add(u,u),l=n.mul(e,u),c=n.mul(i,d),c=n.add(l,c),l=n.sub(h,c),c=n.add(h,c),c=n.mul(l,c),l=n.mul(p,l),u=n.mul(i,u),d=n.mul(e,d),p=n.sub(f,d),p=n.mul(e,p),p=n.add(p,u),u=n.add(f,f),f=n.add(u,f),f=n.add(f,d),f=n.mul(f,p),c=n.add(c,f),d=n.mul(o,a),d=n.add(d,d),f=n.mul(d,p),l=n.sub(l,f),u=n.mul(d,h),u=n.add(u,u),new g(l,c,u=n.add(u,u))}add(e){h(e);let{px:t,py:i,pz:s}=this,{px:o,py:a,pz:l}=e,c=n.ZERO,u=n.ZERO,f=n.ZERO,d=r.a,p=n.mul(r.b,re),y=n.mul(t,o),m=n.mul(i,a),b=n.mul(s,l),w=n.add(t,i),v=n.add(o,a);w=n.mul(w,v),v=n.add(y,m),w=n.sub(w,v),v=n.add(t,s);let E=n.add(o,l);return v=n.mul(v,E),E=n.add(y,b),v=n.sub(v,E),E=n.add(i,s),c=n.add(a,l),E=n.mul(E,c),c=n.add(m,b),E=n.sub(E,c),f=n.mul(d,v),c=n.mul(p,b),f=n.add(c,f),c=n.sub(m,f),f=n.add(m,f),u=n.mul(c,f),m=n.add(y,y),m=n.add(m,y),b=n.mul(d,b),v=n.mul(p,v),m=n.add(m,b),b=n.sub(y,b),b=n.mul(d,b),v=n.add(v,b),y=n.mul(m,v),u=n.add(u,y),y=n.mul(E,v),c=n.mul(w,c),c=n.sub(c,y),y=n.mul(w,m),f=n.mul(E,f),new g(c,u,f=n.add(f,y))}subtract(e){return this.add(e.negate())}is0(){return this.equals(g.ZERO)}wNAF(e){return b.wNAFCached(this,e,g.normalizeZ)}multiplyUnsafe(e){let{endo:t,n:i}=r;t_("scalar",e,t9,i);let s=g.ZERO;if(e===t9)return s;if(this.is0()||e===t7)return this;if(!t||b.hasPrecomputes(this))return b.wNAFCachedUnsafe(this,e,g.normalizeZ);let{k1neg:o,k1:a,k2neg:l,k2:c}=t.splitScalar(e),u=s,f=s,h=this;for(;a>t9||c>t9;)a&t7&&(u=u.add(h)),c&t7&&(f=f.add(h)),h=h.double(),a>>=t7,c>>=t7;return o&&(u=u.negate()),l&&(f=f.negate()),f=new g(n.mul(f.px,t.beta),f.py,f.pz),u.add(f)}multiply(e){let t,i;let{endo:s,n:o}=r;if(t_("scalar",e,t7,o),s){let{k1neg:r,k1:o,k2neg:a,k2:l}=s.splitScalar(e),{p:c,f:u}=this.wNAF(o),{p:f,f:h}=this.wNAF(l);c=b.constTimeNegate(r,c),f=b.constTimeNegate(a,f),f=new g(n.mul(f.px,s.beta),f.py,f.pz),t=c.add(f),i=u.add(h)}else{let{p:r,f:n}=this.wNAF(e);t=r,i=n}return g.normalizeZ([t,i])[0]}multiplyAndAddUnsafe(e,t,r){let n=g.BASE,i=(e,t)=>t!==t9&&t!==t7&&e.equals(n)?e.multiply(t):e.multiplyUnsafe(t),s=i(this,t).add(i(e,r));return s.is0()?void 0:s}toAffine(e){return d(this,e)}isTorsionFree(){let{h:e,isTorsionFree:t}=r;if(e===t7)return!0;if(t)return t(g,this);throw Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:e,clearCofactor:t}=r;return e===t7?this:t?t(g,this):this.multiplyUnsafe(r.h)}toRawBytes(e=!0){return to("isCompressed",e),this.assertValidity(),s(g,this,e)}toHex(e=!0){return to("isCompressed",e),tf(this.toRawBytes(e))}}g.BASE=new g(r.Gx,r.Gy,n.ONE),g.ZERO=new g(n.ZERO,n.ONE,n.ZERO);let{endo:y,nBitLength:m}=r,b=(t=y?Math.ceil(m/2):m,{constTimeNegate:tY,hasPrecomputes:e=>1!==t6(e),unsafeLadder(e,t,r=g.ZERO){let n=e;for(;t>tZ;)t&tJ&&(r=r.add(n)),n=n.double(),t>>=tJ;return r},precomputeWindow(e,r){let{windows:n,windowSize:i}=tQ(r,t),s=[],o=e,a=o;for(let e=0;e<n;e++){a=o,s.push(a);for(let e=1;e<i;e++)a=a.add(o),s.push(a);o=a.double()}return s},wNAF(e,r,n){let i=g.ZERO,s=g.BASE,o=tQ(e,t);for(let e=0;e<o.windows;e++){let{nextN:t,offset:a,isZero:l,isNeg:c,isNegF:u,offsetF:f}=t0(n,e,o);n=t,l?s=s.add(tY(u,r[f])):i=i.add(tY(c,r[a]))}return{p:i,f:s}},wNAFUnsafe(e,r,n,i=g.ZERO){let s=tQ(e,t);for(let e=0;e<s.windows&&n!==tZ;e++){let{nextN:t,offset:o,isZero:a,isNeg:l}=t0(n,e,s);if(n=t,!a){let e=r[o];i=i.add(l?e.negate():e)}}return i},getPrecomputes(e,t,r){let n=t1.get(t);return n||(n=this.precomputeWindow(t,e),1!==e&&t1.set(t,r(n))),n},wNAFCached(e,t,r){let n=t6(e);return this.wNAF(n,this.getPrecomputes(n,e,r),t)},wNAFCachedUnsafe(e,t,r,n){let i=t6(e);return 1===i?this.unsafeLadder(e,t,n):this.wNAFUnsafe(i,this.getPrecomputes(i,e,r),t,n)},setWindowSize(e,r){tX(r,t),t2.set(e,r),t1.delete(e)}});return{CURVE:r,ProjectivePoint:g,normPrivateKeyToScalar:f,weierstrassEquation:a,isWithinCurveOrder:function(e){return tx(e,t7,r.n)}}}({...t,toBytes(e,t,n){let i=t.toAffine(),s=r.toBytes(i.x);return(to("isCompressed",n),n)?tv(Uint8Array.from([t.hasEvenY()?2:3]),s):tv(Uint8Array.from([4]),s,r.toBytes(i.y))},fromBytes(e){let t=e.length,n=e[0],i=e.subarray(1);if(t===o&&(2===n||3===n)){let e;let t=tg(i);if(!tx(t,t7,r.ORDER))throw Error("Point is not on curve");let s=f(t);try{e=r.sqrt(s)}catch(e){throw Error("Point is not on curve"+(e instanceof Error?": "+e.message:""))}return(1&n)==1!=((e&t7)===t7)&&(e=r.neg(e)),{x:t,y:e}}if(t===a&&4===n)return{x:r.fromBytes(i.subarray(0,r.BYTES)),y:r.fromBytes(i.subarray(r.BYTES,2*r.BYTES))};throw Error("invalid Point, expected length of "+o+", or uncompressed "+a+", got "+t)}}),d=(e,t,r)=>tg(e.slice(t,r));class p{constructor(e,t,r){t_("r",e,t7,n),t_("s",t,t7,n),this.r=e,this.s=t,null!=r&&(this.recovery=r),Object.freeze(this)}static fromCompact(e){return new p(d(e=tw("compactSignature",e,2*i),0,i),d(e,i,2*i))}static fromDER(e){let{r:t,s:r}=t4.toSig(tw("DER",e));return new p(t,r)}assertValidity(){}addRecoveryBit(e){return new p(this.r,this.s,e)}recoverPublicKey(e){let{r:i,s,recovery:o}=this,a=m(tw("msgHash",e));if(null==o||![0,1,2,3].includes(o))throw Error("recovery id invalid");let u=2===o||3===o?i+t.n:i;if(u>=r.ORDER)throw Error("recovery id 2 or 3 invalid");let f=(1&o)==0?"02":"03",h=c.fromHex(f+tf(tm(u,r.BYTES))),d=tL(u,n),p=l(-a*d),g=l(s*d),y=c.BASE.multiplyAndAddUnsafe(h,p,g);if(!y)throw Error("point at infinify");return y.assertValidity(),y}hasHighS(){return this.s>n>>t7}normalizeS(){return this.hasHighS()?new p(this.r,l(-this.s),this.recovery):this}toDERRawBytes(){return tp(this.toDERHex())}toDERHex(){return t4.hexFromSig(this)}toCompactRawBytes(){return tp(this.toCompactHex())}toCompactHex(){return tf(tm(this.r,i))+tf(tm(this.s,i))}}function g(e){if("bigint"==typeof e)return!1;if(e instanceof c)return!0;let n=tw("key",e).length,s=r.BYTES,o=s+1;if(!t.allowedPrivateKeyLengths&&i!==o)return n===o||n===2*s+1}let y=t.bits2int||function(e){if(e.length>8192)throw Error("input is too large");let t=tg(e),r=8*e.length-s;return r>0?t>>BigInt(r):t},m=t.bits2int_modN||function(e){return l(y(e))},b=tA(s);function w(e){return t_("num < 2^"+s,e,t9,b),tm(e,i)}let v={lowS:t.lowS,prehash:!1},E={lowS:t.lowS,prehash:!1};return c.BASE._setWindowSize(8),{CURVE:t,getPublicKey:function(e,t=!0){return c.fromPrivateKey(e).toRawBytes(t)},getSharedSecret:function(e,t,r=!0){if(!0===g(e))throw Error("first arg must be private key");if(!1===g(t))throw Error("second arg must be public key");return c.fromHex(t).multiply(u(e)).toRawBytes(r)},sign:function(e,i,s=v){let{seed:o,k2sig:a}=function(e,i,s=v){if(["recovered","canonical"].some(e=>e in s))throw Error("sign() legacy options not supported");let{hash:o,randomBytes:a}=t,{lowS:f,prehash:d,extraEntropy:g}=s;null==f&&(f=!0),e=tw("msgHash",e),t8(s),d&&(e=tw("prehashed msgHash",o(e)));let b=m(e),E=u(i),x=[w(E),w(b)];if(null!=g&&!1!==g){let e=!0===g?a(r.BYTES):g;x.push(tw("extraEntropy",e))}return{seed:tv(...x),k2sig:function(e){let t=y(e);if(!h(t))return;let r=tL(t,n),i=c.BASE.multiply(t).toAffine(),s=l(i.x);if(s===t9)return;let o=l(r*l(b+s*E));if(o===t9)return;let a=(i.x===s?0:2)|Number(i.y&t7),u=o;if(f&&o>n>>t7)u=o>n>>t7?l(-o):o,a^=1;return new p(s,u,a)}}}(e,i,s);return(function(e,t,r){if("number"!=typeof e||e<2)throw Error("hashLen must be a number");if("number"!=typeof t||t<2)throw Error("qByteLen must be a number");if("function"!=typeof r)throw Error("hmacFn must be a function");let n=tS(e),i=tS(e),s=0,o=()=>{n.fill(1),i.fill(0),s=0},a=(...e)=>r(i,n,...e),l=(e=tS(0))=>{i=a(tI([0]),e),n=a(),0!==e.length&&(i=a(tI([1]),e),n=a())},c=()=>{if(s++>=1e3)throw Error("drbg: tried 1000 values");let e=0,r=[];for(;e<t;){let t=(n=a()).slice();r.push(t),e+=n.length}return tv(...r)};return(e,t)=>{let r;for(o(),l(e);!(r=t(c()));)l();return o(),r}})(t.hash.outputLen,t.nByteLength,t.hmac)(o,a)},verify:function(e,r,i,s=E){let o,a;r=tw("msgHash",r),i=tw("publicKey",i);let{lowS:u,prehash:f,format:h}=s;if(t8(s),"strict"in s)throw Error("options.strict was renamed to lowS");if(void 0!==h&&"compact"!==h&&"der"!==h)throw Error("format must be compact or der");let d="string"==typeof e||ti(e),g=!d&&!h&&"object"==typeof e&&null!==e&&"bigint"==typeof e.r&&"bigint"==typeof e.s;if(!d&&!g)throw Error("invalid signature, expected Uint8Array, hex string or Signature instance");try{if(g&&(a=new p(e.r,e.s)),d){try{"compact"!==h&&(a=p.fromDER(e))}catch(e){if(!(e instanceof t4.Err))throw e}a||"der"===h||(a=p.fromCompact(e))}o=c.fromHex(i)}catch(e){return!1}if(!a||u&&a.hasHighS())return!1;f&&(r=t.hash(r));let{r:y,s:b}=a,w=m(r),v=tL(b,n),x=l(w*v),_=l(y*v),A=c.BASE.multiplyAndAddUnsafe(o,x,_)?.toAffine();return!!A&&l(A.x)===y},ProjectivePoint:c,Signature:p,utils:{isValidPrivateKey(e){try{return u(e),!0}catch(e){return!1}},normPrivateKeyToScalar:u,randomPrivateKey:()=>{let e=tK(t.n);return function(e,t,r=!1){let n=e.length,i=tG(t),s=tK(t);if(n<16||n<s||n>1024)throw Error("expected "+s+"-1024 bytes of input, got "+n);let o=tN(r?ty(e):tg(e),t-tT)+tT;return r?tb(o,i):tm(o,i)}(t.randomBytes(e),t.n)},precompute:(e=8,t=c.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)}}})({...e,hash:t,hmac:(e,...r)=>(0,te.b)(t,e,(0,tt.eV)(...r)),randomBytes:tt.O6});return{...r(t),create:r}}({a:ri,b:BigInt(7),Fp:rl,n:rn,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{let t=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-rs*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),n=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=BigInt("0x100000000000000000000000000000000"),s=ra(t*e,rn),o=ra(-r*e,rn),a=tN(e-s*t-o*n,rn),l=tN(-s*r-o*t,rn),c=a>i,u=l>i;if(c&&(a=rn-a),u&&(l=rn-l),a>i||l>i)throw Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:c,k1:a,k2neg:u,k2:l}}}},e7.JQ),ru={zero:48,nine:57,A:65,F:70,a:97,f:102};function rf(e){return e>=ru.zero&&e<=ru.nine?e-ru.zero:e>=ru.A&&e<=ru.F?e-(ru.A-10):e>=ru.a&&e<=ru.f?e-(ru.a-10):void 0}let rh=new TextEncoder;class rd extends eq{constructor(e){super(`Value \`${"object"==typeof e?eH(e):e}\` of type \`${typeof e}\` is an invalid Bytes value.`,{metaMessages:["Bytes values must be of type `Bytes`."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.InvalidBytesTypeError"})}}class rp extends eq{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed \`${t}\` bytes. Given size: \`${e}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeOverflowError"})}}class rg extends eq{constructor({size:e,targetSize:t,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${e}\`) exceeds padding size (\`${t}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeExceedsPaddingSizeError"})}}class ry extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){let t=super.get(e);return super.has(e)&&void 0!==t&&(this.delete(e),super.set(e,t)),t}set(e,t){if(super.set(e,t),this.maxSize&&this.size>this.maxSize){let e=this.keys().next().value;e&&this.delete(e)}return this}}let rm={checksum:new ry(8192)}.checksum;var rb=r(61694);function rw(e,t={}){let{as:r="string"==typeof e?"Hex":"Bytes"}=t,n=(0,rb.fr)(e instanceof Uint8Array?e:"string"==typeof e?function(e,t={}){let{size:r}=t,n=e;r&&(eW(e,r),n=eY(e,r));let i=n.slice(2);i.length%2&&(i=`0${i}`);let s=i.length/2,o=new Uint8Array(s);for(let e=0,t=0;e<s;e++){let r=rf(i.charCodeAt(t++)),n=rf(i.charCodeAt(t++));if(void 0===r||void 0===n)throw new eq(`Invalid byte sequence ("${i[t-2]}${i[t-1]}" in "${i}").`);o[e]=16*r+n}return o}(e):e instanceof Uint8Array?e:new Uint8Array(e));return"Bytes"===r?n:eZ(n)}function rv(e,t={}){let{compressed:r}=t,{prefix:n,x:i,y:s}=e;if(!1===r||"bigint"==typeof i&&"bigint"==typeof s){if(4!==n)throw new r_({prefix:n,cause:new rS});return}if(!0===r||"bigint"==typeof i&&void 0===s){if(3!==n&&2!==n)throw new r_({prefix:n,cause:new rA});return}throw new rx({publicKey:e})}function rE(e){if(132!==e.length&&130!==e.length&&68!==e.length)throw new rI({publicKey:e});return 130===e.length?{prefix:4,x:BigInt(eX(e,0,32)),y:BigInt(eX(e,32,64))}:132===e.length?{prefix:Number(eX(e,0,1)),x:BigInt(eX(e,1,33)),y:BigInt(eX(e,33,65))}:{prefix:Number(eX(e,0,1)),x:BigInt(eX(e,1,33))}}class rx extends eq{constructor({publicKey:e}){super(`Value \`${eH(e)}\` is not a valid public key.`,{metaMessages:["Public key must contain:","- an `x` and `prefix` value (compressed)","- an `x`, `y`, and `prefix` value (uncompressed)"]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidError"})}}class r_ extends eq{constructor({prefix:e,cause:t}){super(`Prefix "${e}
48" is invalid.`,{cause:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidPrefixError"})}}class rA extends eq{constructor(){super("Prefix must be 2 or 3 for compressed public keys."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidCompressedPrefixError"})}}class rS extends eq{constructor(){super("Prefix must be 4 for uncompressed public keys."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidUncompressedPrefixError"})}}class rI extends eq{constructor({publicKey:e}){super(`Value \`${e}\` is an invalid public key size.`,{metaMessages:["Expected: 33 bytes (compressed + prefix), 64 bytes (uncompressed) or 65 bytes (uncompressed + prefix).",`Received ${eQ(eK(e))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidSerializedSizeError"})}}let rO=/^0x[a-fA-F0-9]{40}$/;function rP(e,t={}){let{strict:r=!0}=t;if(!rO.test(e))throw new rk({address:e,cause:new rT});if(r){if(e.toLowerCase()===e)return;if(rC(e)!==e)throw new rk({address:e,cause:new rB})}}function rC(e){if(rm.has(e))return rm.get(e);rP(e,{strict:!1});let t=e.substring(2).toLowerCase(),r=rw(function(e,t={}){let{size:r}=t,n=rh.encode(e);return"number"==typeof r?(!function(e,t){if(e.length>t)throw new rp({givenSize:e.length,maxSize:t})}(n,r),function(e,t={}){let{dir:r,size:n=32}=t;if(0===n)return e;if(e.length>n)throw new rg({size:e.length,targetSize:n,type:"Bytes"});let i=new Uint8Array(n);for(let t=0;t<n;t++){let s="right"===r;i[s?t:n-t-1]=e[s?t:e.length-t-1]}return i}(n,{dir:"right",size:r})):n}(t),{as:"Bytes"}),n=t.split("");for(let e=0;e<40;e+=2)r[e>>1]>>4>=8&&n[e]&&(n[e]=n[e].toUpperCase()),(15&r[e>>1])>=8&&n[e+1]&&(n[e+1]=n[e+1].toUpperCase());let i=`0x${n.join("")}`;return rm.set(e,i),i}class rk extends eq{constructor({address:e,cause:t}){super(`Address "${e}" is invalid.`,{cause:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidAddressError"})}}class rT extends eq{constructor(){super("Address is not a 20 byte (40 hexadecimal character) value."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidInputError"})}}class rB extends eq{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}}var rR=r(33559),rD=r(58980),rU=r(4143);function rM(e){return null!=globalThis.Buffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}function rN(e=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?rM(globalThis.Buffer.allocUnsafe(e)):new Uint8Array(e)}function rj(e,t){t||(t=e.reduce((e,t)=>e+t.length,0));let r=rN(t),n=0;for(let t of e)r.set(t,n),n+=t.length;return rM(r)}var rL=r(5693);function r$(e,t,r,n){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:n}}}let rz=r$("utf8","u",e=>"u"+new TextDecoder("utf8").decode(e),e=>new TextEncoder().encode(e.substring(1))),rF=r$("ascii","a",e=>{let t="a";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},e=>{let t=rN((e=e.substring(1)).length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}),rq={utf8:rz,"utf-8":rz,hex:rL.gh.base16,latin1:rF,ascii:rF,binary:rF,...rL.gh};function rW(e,t="utf8"){let r=rq[t];if(!r)throw Error(`Unsupported encoding "${t}"`);return("utf8"===t||"utf-8"===t)&&null!=globalThis.Buffer&&null!=globalThis.Buffer.from?rM(globalThis.Buffer.from(e,"utf-8")):r.decoder.decode(`${r.prefix}${e}`)}function rV(e,t="utf8"){let r=rq[t];if(!r)throw Error(`Unsupported encoding "${t}"`);return("utf8"===t||"utf-8"===t)&&null!=globalThis.Buffer&&null!=globalThis.Buffer.from?globalThis.Buffer.from(e.buffer,e.byteOffset,e.byteLength).toString("utf8"):r.encoder.encode(e).substring(1)}var rH=r(57711),rG=r(9534),rK=r(25566),rZ=r(9109).Buffer;function rJ(e){let[t,r]=e.split(":");return{namespace:t,reference:r}}function rY(e,t){return e.includes(":")?[e]:t.chains||[]}var rX=Object.defineProperty,rQ=Object.defineProperties,r0=Object.getOwnPropertyDescriptors,r1=Object.getOwnPropertySymbols,r2=Object.prototype.hasOwnProperty,r6=Object.prototype.propertyIsEnumerable,r5=(e,t,r)=>t in e?rX(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,r8=(e,t)=>
48{for(var r in t||(t={}))r2.call(t,r)&&r5(e,r,t[r]);if(r1)for(var r of r1(t))r6.call(t,r)&&r5(e,r,t[r]);return e},r3=(e,t)=>rQ(e,r0(t)),r4=(e,t,r)=>r5(e,"symbol"!=typeof t?t+"":t,r);let r9={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"};function r7(){return"u">typeof rK&&"u">typeof rK.versions&&"u">typeof rK.versions.node}function ne(){return!(0,ez.getDocument)()&&!!(0,ez.getNavigator)()&&"ReactNative"===navigator.product}function nt(){return!r7()&&!!(0,ez.getNavigator)()&&!!(0,ez.getDocument)()}function nr(){return ne()?r9.reactNative:r7()?r9.node:nt()?r9.browser:r9.unknown}function nn(){var e;try{return ne()&&"u">typeof global&&"u">typeof(null==global?void 0:global.Application)?null==(e=global.Application)?void 0:e.applicationId:void 0}catch{return}}function ni(){return(0,eF.D)()||{name:"",description:"",url:"",icons:[""]}}function ns(e,t,r){let n=function(){if(nr()===r9.reactNative&&"u">typeof global&&"u">typeof(null==global?void 0:global.Platform)){let{OS:e,Version:t}=global.Platform;return[e,t].join("-")}let e=(0,e$.qY)();if(null===e)return"unknown";let t=e.os?e.os.replace(" ","").toLowerCase():"unknown";return"browser"===e.type?[t,e.name,e.version].join("-"):[t,e.version].join("-")}(),i=function(){var e;let t=nr();return t===r9.browser?[t,(null==(e=(0,ez.getLocation)())?void 0:e.host)||"unknown"].join(":"):t}();return[[e,t].join("-"),["js",r].join("-"),n,i].join("/")}function no(e,t){return e.filter(e=>t.includes(e)).length===e.length}function na(e){return Object.fromEntries(e.entries())}function nl(e){return new Map(Object.entries(e))}function nc(e=ej.FIVE_MINUTES,t){let r,n,i,s;let o=(0,ej.toMiliseconds)(e||ej.FIVE_MINUTES);return{resolve:e=>{i&&r&&(clearTimeout(i),r(e),s=Promise.resolve(e))},reject:e=>{i&&n&&(clearTimeout(i),n(e))},done:()=>new Promise((e,a)=>{if(s)return e(s);i=setTimeout(()=>{let e=Error(t);s=Promise.reject(e),a(e)},o),r=e,n=a})}}function nu(e,t,r){return new Promise(async(n,i)=>{let s=setTimeout(()=>i(Error(r)),t);try{let t=await e;n(t)}catch(e){i(e)}clearTimeout(s)})}function nf(e,t){if("string"==typeof t&&t.startsWith(`${e}:`))return t;if("topic"===e.toLowerCase()){if("string"!=typeof t)throw Error('Value must be "string" for expirer target type: topic');return`topic:${t}`}if("id"===e.toLowerCase()){if("number"!=typeof t)throw Error('Value must be "number" for expirer target type: id');return`id:${t}`}throw Error(`Unknown expirer target type: ${e}`)}function nh(e){let[t,r]=e.split(":"),n={id:void 0,topic:void 0};if("topic"===t&&"string"==typeof r)n.topic=r;else if("id"===t&&Number.isInteger(Number(r)))n.id=Number(r);else throw Error(`Invalid target, expected id:number or topic:string, got ${t}:${r}`);return n}function nd(e,t){return(0,ej.fromMiliseconds)((t||Date.now())+(0,ej.toMiliseconds)(e))}function np(e){return Date.now()>=(0,ej.toMiliseconds)(e)}function ng(e,t){return`${e}${t?`:${t}`:""}`}function ny(e=[],t=[]){return[...new Set([...e,...t])]}async function nm({id:e,topic:t,wcDeepLink:r}){var n;try{if(!r)return;let i="string"==typeof r?JSON.parse(r):r,s=i?.href;if("string"!=typeof s)return;let o=function(e,t,r){let n=`requestId=${t}&sessionTopic=${r}`;e.endsWith("/")&&(e=e.slice(0,-1));let i=`${e}`;if(e.startsWith("https://t.me")){let t=e.includes("?")?"&startapp=":"?startapp=";i=`${i}${t}${function(e,t=!1){let r=rZ.from(e).toString("base64");return t?r.replace(/[=]/g,""):r}(n,!0)}`}else i=`${i}/wc?${n}`;return i}(s,e,t),a=nr();if(a===r9.browser){let e;if(!(null!=(n=(0,ez.getDocument)())&&n.hasFocus())){console.warn("Document does not have focus, skipping deeplink.");return}e="_self",function(){try{return window.self!==window.top}catch{return!1}}()?e="_top":("u">typeof window&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)||o.startsWith("https://")||o.startsWith("http://"))&&(e="_blank"),window.open(o,e,"noreferrer noopener")}else a===r9.reactNative&&"u">typeof(null==global?void 0:global.Linking)&&await global.Linking.openURL(o)}catch(e){console.error(e)}}async function nb(e,t){let r="";try{if(nt()&&(r=localStorage.getItem(t)))return r;r=await e.getItem(t)}catch(e){console.error(e)}return r}function nw(e,t){if(!e.includes(t))return null;let r=e.split(/([&,?,=])/),n=r.indexOf(t);return r[n+2]}function nv(){return"u">typeof crypto&&null!=crypto&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,e=>{let t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)})}function nE(){return"u">typeof rK&&"true"===rK.env.IS_VITEST}function nx(e){return rZ.from(e,"base64").toString("utf-8")}class n_{constructor({limit:e}){r4(this,"limit"),r4(this,"set"),this.limit=e,this.set=new Set}
48add(e){if(!this.set.has(e)){if(this.set.size>=this.limit){let e=this.set.values().next().value;e&&this.set.delete(e)}this.set.add(e)}}has(e){return this.set.has(e)}}let nA=BigInt(4294967296-1),nS=BigInt(32);function nI(e,t=!1){return t?{h:Number(e&nA),l:Number(e>>nS&nA)}:{h:0|Number(e>>nS&nA),l:0|Number(e&nA)}}function nO(e,t=!1){let r=e.length,n=new Uint32Array(r),i=new Uint32Array(r);for(let s=0;s<r;s++){let{h:r,l:o}=nI(e[s],t);[n[s],i[s]]=[r,o]}return[n,i]}let nP=(e,t,r)=>e>>>r,nC=(e,t,r)=>e<<32-r|t>>>r,nk=(e,t,r)=>e>>>r|t<<32-r,nT=(e,t,r)=>e<<32-r|t>>>r,nB=(e,t,r)=>e<<64-r|t>>>r-32,nR=(e,t,r)=>e>>>r-32|t<<64-r,nD=(e,t)=>t,nU=(e,t)=>e,nM=(e,t,r)=>e<<r|t>>>32-r,nN=(e,t,r)=>t<<r|e>>>32-r,nj=(e,t,r)=>t<<r-32|e>>>64-r,nL=(e,t,r)=>e<<r-32|t>>>64-r;function n$(e,t,r,n){let i=(t>>>0)+(n>>>0);return{h:e+r+(i/4294967296|0)|0,l:0|i}}let nz=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),nF=(e,t,r,n)=>t+r+n+(e/4294967296|0)|0,nq=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),nW=(e,t,r,n,i)=>t+r+n+i+(e/4294967296|0)|0,nV=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0),nH=(e,t,r,n,i,s)=>t+r+n+i+s+(e/4294967296|0)|0,nG="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;function nK(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function nZ(e){if(!Number.isSafeInteger(e)||e<0)throw Error("positive integer expected, got "+e)}function nJ(e,...t){if(!nK(e))throw Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw Error("Uint8Array expected of length "+t+", got length="+e.length)}function nY(e){if("function"!=typeof e||"function"!=typeof e.create)throw Error("Hash should be wrapped by utils.createHasher");nZ(e.outputLen),nZ(e.blockLen)}function nX(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}function nQ(e,t){nJ(e);let r=t.outputLen;if(e.length<r)throw Error("digestInto() expects output buffer of length at least "+r)}function n0(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function n1(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function n2(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function n6(e,t){return e<<32-t|e>>>t}let n5=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0];function n8(e){return e<<24&4278190080|e<<8&16711680|e>>>8&65280|e>>>24&255}let n3=n5?e=>e:e=>n8(e),n4=n5?e=>e:function(e){for(let t=0;t<e.length;t++)e[t]=n8(e[t]);return e},n9="function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex,n7=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function ie(e){if(nJ(e),n9)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=n7[e[r]];return t}let it={_0:48,_9:57,A:65,F:70,a:97,f:102};function ir(e){return e>=it._0&&e<=it._9?e-it._0:e>=it.A&&e<=it.F?e-(it.A-10):e>=it.a&&e<=it.f?e-(it.a-10):void 0}function ii(e){if("string"!=typeof e)throw Error("hex string expected, got "+typeof e);if(n9)return Uint8Array.fromHex(e);let t=e.length,r=t/2;if(t%2)throw Error("hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(r);for(let t=0,i=0;t<r;t++,i+=2){let r=ir(e.charCodeAt(i)),s=ir(e.charCodeAt(i+1));if(void 0===r||void 0===s)throw Error('hex string expected, got non-hex character "'+(e[i]+e[i+1])+'" at index '+i);n[t]=16*r+s}return n}function is(e){if("string"!=typeof e)throw Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function io(e){return"string"==typeof e&&(e=is(e)),nJ(e),e}function ia(...e){let t=0;for(let r=0;r<e.length;r++){let n=e[r];nJ(n),t+=n.length}let r=new Uint8Array(t);for(let t=0,n=0;t<e.length;t++){let i=e[t];r.set(i,n),n+=i.length}return r}class il{}function ic(e){let t=t=>e().update(io(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function iu(e=32){if(nG&&"function"==typeof nG.getRandomValues)return nG.getRandomValues(new Uint8Array(e));if(nG&&"function"==typeof nG.randomBytes)return Uint8Array.from(nG.randomBytes(e));throw Error("crypto.getRandomValues must be defined")}let ih=BigInt(0),id=BigInt(1),ip=BigInt(2),ig=BigInt(7),iy=BigInt(256),im=BigInt(113),ib=[],iw=[],iv=[];for(let e=0,t=id,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],ib.push(2*(5*n+r)),iw.push((e+1)*(e+2)/2%64);let i=ih;for(let e=0;e<7;e++)(t=(t<<id^(t>>ig)*im)%iy)&ip&&(i^=id<<(id<<BigInt(e))-id);iv.push(i)}let iE=nO(iv,!0),ix=iE[0],i_=iE[1],iA=(e,t,r)=>r>32?nj(e,t,r):nM(e,t,r),iS=(e,t,r)=>r>32?nL(e,t,r):nN(e,t,r);class iI extends il{constructor(e,t,r,n=!1,i=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=n,this.rounds=i,nZ(r),!(0<e&&e<200))throw Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=n0(this.state)}clone(){return this._cloneInto()}keccak(){n4(this.state32),function(e,t=24){let 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){let n=(t+8)%10,i=(t+2)%10,s=r[i],o=r[i+1],a=iA(s,o,1)^r[n],l=iS(s,o,1)^r[n+1];for(let r=0;r<50;r+=10)e[t+r]^=a,e[t+r+1]^=l}let t=e[2],i=e[3];for(let r=0;r<24;r++){let n=iw[r],s=iA(t,i,n),o=iS(t,i,n),a=ib[r];t=e[a],i=e[a+1],e[a]=s,e[a+1]=o}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]^=ix[n],e[1]^=i_[n]}n1(r)}(this.state32,this.rounds),n4(this.state32),this.posOut=0,this.pos=0}update(e){nX(this),nJ(e=io(e));let{blockLen:t,state:r}=this,n=e.length;for(let i=0;i<n;){let s=Math.min(t-this.pos,n-i);for(let t=0;t<s;t++)r[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:e,suffix:t,pos:r,blockLen:n}=this;e[r]^=t,(128&t)!=0&&r===n-1&&this.keccak(),e[n-1]^=128,this.keccak()}writeInto(e){nX(this,!1),nJ(e),this.finish();let t=this.state,{blockLen:r}=this;for(let n=0,i=e.length;n<i;){this.posOut>=r&&this.keccak();let s=Math.min(r-this.posOut,i-n);e.set(t.subarray(this.posOut,this.posOut+s),n),this.posOut+=s,n+=s}return e}xofInto(e){if(!this.enableXOF)throw Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return nZ(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(nQ(e,this),this.finished)throw Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,n1(this.state)}_cloneInto(e){let{blockLen:t,suffix:r,outputLen:n,rounds:i,enableXOF:s}=this;return e||(e=new iI(t,r,n,s,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=r,e.outputLen=n,e.enableXOF=s,e.destroyed=this.destroyed,e}}let iO=ic(()=>new iI(136,1,32));class iP extends il{constructor(e,t,r,n){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=n,this.buffer=new Uint8Array(e),this.view=n2(this.buffer)}update(e){nX(this),nJ(e=io(e));let{view:t,buffer:r,blockLen:n}=this,i=e.length;for(let s=0;s<i;){let o=Math.min(n-this.pos,i-s);if(o===n){let t=n2(e);for(;n<=i-s;
48s+=n)this.process(t,s);continue}r.set(e.subarray(s,s+o),this.pos),this.pos+=o,s+=o,this.pos===n&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){nX(this),nQ(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:n,isLE:i}=this,{pos:s}=this;t[s++]=128,n1(this.buffer.subarray(s)),this.padOffset>n-s&&(this.process(r,0),s=0);for(let e=s;e<n;e++)t[e]=0;(function(e,t,r,n){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,n);let i=BigInt(32),s=BigInt(4294967295),o=Number(r>>i&s),a=Number(r&s),l=n?4:0,c=n?0:4;e.setUint32(t+l,o,n),e.setUint32(t+c,a,n)})(r,n-8,BigInt(8*this.length),i),this.process(r,0);let o=n2(e),a=this.outputLen;if(a%4)throw Error("_sha2: outputLen should be aligned to 32bit");let l=a/4,c=this.get();if(l>c.length)throw Error("_sha2: outputLen bigger than state");for(let e=0;e<l;e++)o.setUint32(4*e,c[e],i)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:r,length:n,finished:i,destroyed:s,pos:o}=this;return e.destroyed=s,e.finished=i,e.length=n,e.pos=o,n%t&&e.buffer.set(r),e}clone(){return this._cloneInto()}}let iC=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),ik=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),iT=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),iB=Uint32Array.from([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]),iR=new Uint32Array(64);class iD extends iP{constructor(e=32){super(64,e,8,!1),this.A=0|iC[0],this.B=0|iC[1],this.C=0|iC[2],this.D=0|iC[3],this.E=0|iC[4],this.F=0|iC[5],this.G=0|iC[6],this.H=0|iC[7]}get(){let{A:e,B:t,C:r,D:n,E:i,F:s,G:o,H:a}=this;return[e,t,r,n,i,s,o,a]}set(e,t,r,n,i,s,o,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|s,this.G=0|o,this.H=0|a}process(e,t){for(let r=0;r<16;r++,t+=4)iR[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=iR[e-15],r=iR[e-2],n=n6(t,7)^n6(t,18)^t>>>3,i=n6(r,17)^n6(r,19)^r>>>10;iR[e]=i+iR[e-7]+n+iR[e-16]|0}let{A:r,B:n,C:i,D:s,E:o,F:a,G:l,H:c}=this;for(let e=0;e<64;e++){var u,f,h,d;let t=c+(n6(o,6)^n6(o,11)^n6(o,25))+((u=o)&a^~u&l)+iB[e]+iR[e]|0,p=(n6(r,2)^n6(r,13)^n6(r,22))+((f=r)&(h=n)^f&(d=i)^h&d)|0;c=l,l=a,a=o,o=s+t|0,s=i,i=n,n=r,r=t+p|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,s=s+this.D|0,o=o+this.E|0,a=a+this.F|0,l=l+this.G|0,c=c+this.H|0,this.set(r,n,i,s,o,a,l,c)}roundClean(){n1(iR)}destroy(){this.set(0,0,0,0,0,0,0,0),n1(this.buffer)}}let iU=nO(["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","0x27b70a854
486d22ffc","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))),iM=iU[0],iN=iU[1],ij=new Uint32Array(80),iL=new Uint32Array(80);class i$ extends iP{constructor(e=64){super(128,e,16,!1),this.Ah=0|iT[0],this.Al=0|iT[1],this.Bh=0|iT[2],this.Bl=0|iT[3],this.Ch=0|iT[4],this.Cl=0|iT[5],this.Dh=0|iT[6],this.Dl=0|iT[7],this.Eh=0|iT[8],this.El=0|iT[9],this.Fh=0|iT[10],this.Fl=0|iT[11],this.Gh=0|iT[12],this.Gl=0|iT[13],this.Hh=0|iT[14],this.Hl=0|iT[15]}get(){let{Ah:e,Al:t,Bh:r,Bl:n,Ch:i,Cl:s,Dh:o,Dl:a,Eh:l,El:c,Fh:u,Fl:f,Gh:h,Gl:d,Hh:p,Hl:g}=this;return[e,t,r,n,i,s,o,a,l,c,u,f,h,d,p,g]}set(e,t,r,n,i,s,o,a,l,c,u,f,h,d,p,g){this.Ah=0|e,this.Al=0|t,this.Bh=0|r,this.Bl=0|n,this.Ch=0|i,this.Cl=0|s,this.Dh=0|o,this.Dl=0|a,this.Eh=0|l,this.El=0|c,this.Fh=0|u,this.Fl=0|f,this.Gh=0|h,this.Gl=0|d,this.Hh=0|p,this.Hl=0|g}process(e,t){for(let r=0;r<16;r++,t+=4)ij[r]=e.getUint32(t),iL[r]=e.getUint32(t+=4);for(let e=16;e<80;e++){let t=0|ij[e-15],r=0|iL[e-15],n=nk(t,r,1)^nk(t,r,8)^nP(t,r,7),i=nT(t,r,1)^nT(t,r,8)^nC(t,r,7),s=0|ij[e-2],o=0|iL[e-2],a=nk(s,o,19)^nB(s,o,61)^nP(s,o,6),l=nq(i,nT(s,o,19)^nR(s,o,61)^nC(s,o,6),iL[e-7],iL[e-16]),c=nW(l,n,a,ij[e-7],ij[e-16]);ij[e]=0|c,iL[e]=0|l}let{Ah:r,Al:n,Bh:i,Bl:s,Ch:o,Cl:a,Dh:l,Dl:c,Eh:u,El:f,Fh:h,Fl:d,Gh:p,Gl:g,Hh:y,Hl:m}=this;for(let e=0;e<80;e++){let t=nk(u,f,14)^nk(u,f,18)^nB(u,f,41),b=nT(u,f,14)^nT(u,f,18)^nR(u,f,41),w=u&h^~u&p,v=nV(m,b,f&d^~f&g,iN[e],iL[e]),E=nH(v,y,t,w,iM[e],ij[e]),x=0|v,_=nk(r,n,28)^nB(r,n,34)^nB(r,n,39),A=nT(r,n,28)^nR(r,n,34)^nR(r,n,39),S=r&i^r&o^i&o,I=n&s^n&a^s&a;y=0|p,m=0|g,p=0|h,g=0|d,h=0|u,d=0|f,({h:u,l:f}=n$(0|l,0|c,0|E,0|x)),l=0|o,c=0|a,o=0|i,a=0|s,i=0|r,s=0|n;let O=nz(x,A,I);
48r=nF(O,E,_,S),n=0|O}({h:r,l:n}=n$(0|this.Ah,0|this.Al,0|r,0|n)),({h:i,l:s}=n$(0|this.Bh,0|this.Bl,0|i,0|s)),({h:o,l:a}=n$(0|this.Ch,0|this.Cl,0|o,0|a)),({h:l,l:c}=n$(0|this.Dh,0|this.Dl,0|l,0|c)),({h:u,l:f}=n$(0|this.Eh,0|this.El,0|u,0|f)),({h,l:d}=n$(0|this.Fh,0|this.Fl,0|h,0|d)),({h:p,l:g}=n$(0|this.Gh,0|this.Gl,0|p,0|g)),({h:y,l:m}=n$(0|this.Hh,0|this.Hl,0|y,0|m)),this.set(r,n,i,s,o,a,l,c,u,f,h,d,p,g,y,m)}roundClean(){n1(ij,iL)}destroy(){n1(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}class iz extends i${constructor(){super(48),this.Ah=0|ik[0],this.Al=0|ik[1],this.Bh=0|ik[2],this.Bl=0|ik[3],this.Ch=0|ik[4],this.Cl=0|ik[5],this.Dh=0|ik[6],this.Dl=0|ik[7],this.Eh=0|ik[8],this.El=0|ik[9],this.Fh=0|ik[10],this.Fl=0|ik[11],this.Gh=0|ik[12],this.Gl=0|ik[13],this.Hh=0|ik[14],this.Hl=0|ik[15]}}let iF=Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);class iq extends i${constructor(){super(32),this.Ah=0|iF[0],this.Al=0|iF[1],this.Bh=0|iF[2],this.Bl=0|iF[3],this.Ch=0|iF[4],this.Cl=0|iF[5],this.Dh=0|iF[6],this.Dl=0|iF[7],this.Eh=0|iF[8],this.El=0|iF[9],this.Fh=0|iF[10],this.Fl=0|iF[11],this.Gh=0|iF[12],this.Gl=0|iF[13],this.Hh=0|iF[14],this.Hl=0|iF[15]}}let iW=ic(()=>new iD),iV=ic(()=>new i$),iH=ic(()=>new iz),iG=ic(()=>new iq),iK=Uint8Array.from([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9]),iZ=Uint32Array.from([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),iJ=new Uint32Array(32);function iY(e,t,r,n,i,s){let o=i[s],a=i[s+1],l=iJ[2*e],c=iJ[2*e+1],u=iJ[2*t],f=iJ[2*t+1],h=iJ[2*r],d=iJ[2*r+1],p=iJ[2*n],g=iJ[2*n+1],y=nz(l,u,o);c=nF(y,c,f,a),l=0|y,({Dh:g,Dl:p}={Dh:g^c,Dl:p^l}),({Dh:g,Dl:p}={Dh:nD(g,p),Dl:nU(g)}),({h:d,l:h}=n$(d,h,g,p)),({Bh:f,Bl:u}={Bh:f^d,Bl:u^h}),({Bh:f,Bl:u}={Bh:nk(f,u,24),Bl:nT(f,u,24)}),iJ[2*e]=l,iJ[2*e+1]=c,iJ[2*t]=u,iJ[2*t+1]=f,iJ[2*r]=h,iJ[2*r+1]=d,iJ[2*n]=p,iJ[2*n+1]=g}function iX(e,t,r,n,i,s){let o=i[s],a=i[s+1],l=iJ[2*e],c=iJ[2*e+1],u=iJ[2*t],f=iJ[2*t+1],h=iJ[2*r],d=iJ[2*r+1],p=iJ[2*n],g=iJ[2*n+1],y=nz(l,u,o);c=nF(y,c,f,a),l=0|y,({Dh:g,Dl:p}={Dh:g^c,Dl:p^l}),({Dh:g,Dl:p}={Dh:nk(g,p,16),Dl:nT(g,p,16)}),({h:d,l:h}=n$(d,h,g,p)),({Bh:f,Bl:u}={Bh:f^d,Bl:u^h}),({Bh:f,Bl:u}={Bh:nB(f,u,63),Bl:nR(f,u,63)}),iJ[2*e]=l,iJ[2*e+1]=c,iJ[2*t]=u,iJ[2*t+1]=f,iJ[2*r]=h,iJ[2*r+1]=d,iJ[2*n]=p,iJ[2*n+1]=g}class iQ extends il{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,this.length=0,this.pos=0,nZ(e),nZ(t),this.blockLen=e,this.outputLen=t,this.buffer=new Uint8Array(e),this.buffer32=n0(this.buffer)}update(e){nX(this),nJ(e=io(e));let{blockLen:t,buffer:r,buffer32:n}=this,i=e.length,s=e.byteOffset,o=e.buffer;for(let a=0;a<i;){this.pos===t&&(n4(n),this.compress(n,0,!1),n4(n),this.pos=0);let l=Math.min(t-this.pos,i-a),c=s+a;if(l===t&&!(c%4)&&a+l<i){let e=new Uint32Array(o,c,Math.floor((i-a)/4));n4(e);for(let r=0;a+t<i;r+=n.length,a+=t)this.length+=t,this.compress(e,r,!1);n4(e);continue}r.set(e.subarray(a,a+l),this.pos),this.pos+=l,this.length+=l,a+=l}return this}digestInto(e){nX(this),nQ(e,this);let{pos:t,buffer32:r}=this;this.finished=!0,n1(this.buffer.subarray(t)),n4(r),this.compress(r,0,!0),n4(r);let n=n0(e);this.get().forEach((e,t)=>n[t]=n3(e))}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){let{buffer:t,length:r,finished:n,destroyed:i,outputLen:s,pos:o}=this;return e||(e=new this.constructor({dkLen:s})),e.set(...this.get()),e.buffer.set(t),e.destroyed=i,e.finished=n,e.length=r,e.pos=o,e.outputLen=s,e}clone(){return this._cloneInto()}}class i0 extends iQ{constructor(e={}){let t=void 0===e.dkLen?64:e.dkLen;super(128,t),this.v0l=0|iZ[0],this.v0h=0|iZ[1],this.v1l=0|iZ[2],this.v1h=0|iZ[3],this.v2l=0|iZ[4],this.v2h=0|iZ[5],this.v3l=0|iZ[6],this.v3h=0|iZ[7],this.v4l=0|iZ[8],this.v4h=0|iZ[9],this.v5l=0|iZ[10],this.v5h=0|iZ[11],this.v6l=0|iZ[12],this.v6h=0|iZ[13],this.v7l=0|iZ[14],this.v7h=0|iZ[15],function(e,t={},r,n,i){if(nZ(64),e<0||e>64)throw Error("outputLen bigger than keyLen");let{key:s,salt:o,personalization:a}=t;if(void 0!==s&&(s.length<1||s.length>64))throw Error("key length must be undefined or 1.."+r);if(void 0!==o&&16!==o.length)throw Error("salt must be undefined or 16");if(void 0!==a&&16!==a.length)throw Error("personalization must be undefined or 16")}(t,e,64,0,0);let{key:r,personalization:n,salt:i}=e,s=0;if(void 0!==r&&(s=(r=io(r)).length),this.v0l^=this.outputLen|s<<8|16842752,void 0!==i){let e=n0(i=io(i));this.v4l^=n3(e[0]),this.v4h^=n3(e[1]),this.v5l^=n3(e[2]),this.v5h^=n3(e[3])}if(void 0!==n){let e=n0(n=io(n));this.v6l^=n3(e[0]),this.v6h^=n3(e[1]),this.v7l^=n3(e[2]),this.v7h^=n3(e[3])}if(void 0!==r){let e=new Uint8Array(this.blockLen);e.set(r),this.update(e)}}
48get(){let{v0l:e,v0h:t,v1l:r,v1h:n,v2l:i,v2h:s,v3l:o,v3h:a,v4l:l,v4h:c,v5l:u,v5h:f,v6l:h,v6h:d,v7l:p,v7h:g}=this;return[e,t,r,n,i,s,o,a,l,c,u,f,h,d,p,g]}set(e,t,r,n,i,s,o,a,l,c,u,f,h,d,p,g){this.v0l=0|e,this.v0h=0|t,this.v1l=0|r,this.v1h=0|n,this.v2l=0|i,this.v2h=0|s,this.v3l=0|o,this.v3h=0|a,this.v4l=0|l,this.v4h=0|c,this.v5l=0|u,this.v5h=0|f,this.v6l=0|h,this.v6h=0|d,this.v7l=0|p,this.v7h=0|g}compress(e,t,r){this.get().forEach((e,t)=>iJ[t]=e),iJ.set(iZ,16);let{h:n,l:i}=nI(BigInt(this.length));iJ[24]=iZ[8]^i,iJ[25]=iZ[9]^n,r&&(iJ[28]=~iJ[28],iJ[29]=~iJ[29]);let s=0;for(let r=0;r<12;r++)iY(0,4,8,12,e,t+2*iK[s++]),iX(0,4,8,12,e,t+2*iK[s++]),iY(1,5,9,13,e,t+2*iK[s++]),iX(1,5,9,13,e,t+2*iK[s++]),iY(2,6,10,14,e,t+2*iK[s++]),iX(2,6,10,14,e,t+2*iK[s++]),iY(3,7,11,15,e,t+2*iK[s++]),iX(3,7,11,15,e,t+2*iK[s++]),iY(0,5,10,15,e,t+2*iK[s++]),iX(0,5,10,15,e,t+2*iK[s++]),iY(1,6,11,12,e,t+2*iK[s++]),iX(1,6,11,12,e,t+2*iK[s++]),iY(2,7,8,13,e,t+2*iK[s++]),iX(2,7,8,13,e,t+2*iK[s++]),iY(3,4,9,14,e,t+2*iK[s++]),iX(3,4,9,14,e,t+2*iK[s++]);this.v0l^=iJ[0]^iJ[16],this.v0h^=iJ[1]^iJ[17],this.v1l^=iJ[2]^iJ[18],this.v1h^=iJ[3]^iJ[19],this.v2l^=iJ[4]^iJ[20],this.v2h^=iJ[5]^iJ[21],this.v3l^=iJ[6]^iJ[22],this.v3h^=iJ[7]^iJ[23],this.v4l^=iJ[8]^iJ[24],this.v4h^=iJ[9]^iJ[25],this.v5l^=iJ[10]^iJ[26],this.v5h^=iJ[11]^iJ[27],this.v6l^=iJ[12]^iJ[28],this.v6h^=iJ[13]^iJ[29],this.v7l^=iJ[14]^iJ[30],this.v7h^=iJ[15]^iJ[31],n1(iJ)}destroy(){this.destroyed=!0,n1(this.buffer32),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}let i1=function(e){let t=(t,r)=>e(r).update(io(t)).digest(),r=e({});return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t}(e=>new i0(e));function i2(e){let t=`�Ethereum Signed Message: 49${e.length}`,r=new TextEncoder().encode(t+e);return"0x"+rZ.from(iO(r)).toString("hex")}async function i6(e,t,r,n,i,s){switch(r.t){case"eip191":return await function(e,t,r){let n=function(e){if(130!==e.length&&132!==e.length)throw new e3({signature:e});let t=BigInt(eX(e,0,32)),r=BigInt(eX(e,32,64)),n=(()=>{let t=Number(`0x${e.slice(130)}`);if(!Number.isNaN(t))try{return function(e){if(0===e||27===e)return 0;if(1===e||28===e)return 1;if(e>=35)return e%2==0?1:0;throw new e9({value:e})}(t)}catch{throw new e4({value:t})}})();return void 0===n?{r:t,s:r}:{r:t,s:r,yParity:n}}(r);return(function(e,t={}){let r=rw(`0x${(function(e,t={}){rv(e);let{prefix:r,x:n,y:i}=e,{includePrefix:s=!0}=t;return function(...e){return`0x${e.reduce((e,t)=>e+t.replace("0x",""),"")}`}(s?eJ(r,{size:1}):"0x",eJ(n,{size:32}),"bigint"==typeof i?eJ(i,{size:32}):"0x")})(e).slice(4)}`).substring(26);return function(e,t={}){let{checksum:r=!1}=t;return(rP(e),r)?rC(e):e}(`0x${r}`,t)})(function(e){let{payload:t,signature:r}=e,{r:n,s:i,yParity:s}=r;return function(e){let t=(()=>{if(function(e,t={}){let{strict:r=!1}=t;try{return!function(e,t={}){let{strict:r=!1}=t;if(!e||"string"!=typeof e)throw new e1(e);if(r&&!/^0x[0-9a-fA-F]*$/.test(e)||!e.startsWith("0x"))throw new e2(e)}(e,{strict:r}),!0}catch{return!1}}(e))return rE(e);if(function(e){try{return!function(e){if(!(e instanceof Uint8Array)&&(!e||"object"!=typeof e||!("BYTES_PER_ELEMENT"in e)||1!==e.BYTES_PER_ELEMENT||"Uint8Array"!==e.constructor.name))throw new rd(e)}(e),!0}catch{return!1}}(e))return rE(eZ(e));let{prefix:t,x:r,y:n}=e;return"bigint"==typeof r&&"bigint"==typeof n?{prefix:t??4,x:r,y:n}:{prefix:t,x:r}})();return rv(t),t}(new rc.Signature(BigInt(n),BigInt(i)).addRecoveryBit(s).recoverPublicKey(eK(t).substring(2)))}({payload:i2(t),signature:n})).toLowerCase()===e.toLowerCase()}(e,t,r.s);case"eip1271":return await i5(e,t,r.s,n,i,s);default:throw Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}async function i5(e,t,r,n,i,s){let o=rJ(n);if(!o.namespace||!o.reference)throw Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${n}`);try{let o="0x1626ba7e",a=r.substring(2),l=(a.length/2).toString(16).padStart(64,"0"),c=(t.startsWith("0x")?t:i2(t)).substring(2),u=await fetch(`${s||"https://rpc.walletconnect.org/v1"}/?chainId=${n}&projectId=${i}`,{headers:{"Content-Type":"application/json"},method:"POST",body:JSON.stringify({id:Date.now()+Math.floor(1e3*Math.random()),jsonrpc:"2.0",method:"eth_call",params:[{to:e,data:o+c+"0000000000000000000000000000000000000000000000000000000000000040"+l+a},"latest"]})}),{result:f}=await u.json();return!!f&&f.slice(0,o.length).toLowerCase()===o.toLowerCase()}catch(e){return console.error("isValidEip1271Signature: ",e),!1}}function i8(e){let t=new Uint8Array(iW(function(e){if(e instanceof Uint8Array)return e;if(Array.isArray(e))return new Uint8Array(e);if("object"==typeof e&&null!=e&&e.data)return new Uint8Array(Object.values(e.data));if("object"==typeof e&&e)return new Uint8Array(Object.values(e));throw Error("getNearUint8ArrayFromBytes: Unexpected result type from bytes array")}(e)));return rR.Z.encode(t)}function i3(e){let t=rZ.from(e,"base64"),r=(0,rD.J)(t).txn;if(!r)throw Error("Invalid signed transaction: missing 'txn' field");let n=(0,rU.c)(r),i=rZ.from("TX"),s=iG(rZ.concat([i,rZ.from(n)]));return m.pJ.encode(s).replace(/=+$/,"")}function i4(e){let t=[],r=BigInt(e);for(;r>=BigInt(128);)t.push(Number(r&BigInt(127)|BigInt(128))),r>>=BigInt(7);return t.push(Number(r)),rZ.from(t)}var i9=Object.defineProperty,i7=Object.defineProperties,se=Object.getOwnPropertyDescriptors,st=Object.getOwnPropertySymbols,sr=Object.prototype.hasOwnProperty,sn=Object.prototype.propertyIsEnumerable,si=(e,t,r)=>t in e?i9(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ss=(e,t)=>{for(var r in t||(t={}))sr.call(t,r)&&si(e,r,t[r]);if(st)for(var r of st(t))sn.call(t,r)&&si(e,r,t[r]);return e},so=(e,t)=>i7(e,se(t));let sa=e=>e?.split(":"),sl=e=>{let t=e&&sa(e);if(t)return e.includes("did:pkh:")?t[3]:t[1]},sc=e=>{let t=e&&sa(e);if(t)return t[2]+":"+t[3]},su=e=>{let t=e&&sa(e);if(t)return t.pop()};async function sf(e){let{cacao:t,projectId:r}=e,{s:n,p:i}=t,s=sh(i,i.iss),o=su(i.iss);return await i6(o,s,n,sc(i.iss),r)}let sh=(e,t)=>{let r=`${e.domain} wants you to sign in with your Ethereum account:`,n=su(t);if(!e.aud&&!e.uri)throw Error("Either `aud` or `uri` is required to construct the message");let i=e.statement||void 0,s=`URI: ${e.aud||e.uri}
49`,o=`Version: ${e.version}`,a=`Chain ID: ${sl(t)}`,l=`Nonce: ${e.nonce}`,c=`Issued At: ${e.iat}`,u=e.exp?`Expiration Time: ${e.exp}`:void 0,f=e.nbf?`Not Before: ${e.nbf}`:void 0,h=e.requestId?`Request ID: ${e.requestId}`:void 0,d=e.resources?`Resources:${e.resources.map(e=>` 50- ${e}`).join("")}`:void 0,p=sb(e.resources);return p&&(i=function(e="",t){sd(t);let r="I further authorize the stated URI to perform the following actions on my behalf: ";if(e.includes(r))return e;let n=[],i=0;Object.keys(t.att).forEach(e=>{let r=Object.keys(t.att[e]).map(e=>({ability:e.split("/")[0],action:e.split("/")[1]}));r.sort((e,t)=>e.action.localeCompare(t.action));let s={};r.forEach(e=>{s[e.ability]||(s[e.ability]=[]),s[e.ability].push(e.action)});let o=Object.keys(s).map(t=>(i++,`(${i}) '${t}': '${s[t].join("', '")}' for '${e}'.`));n.push(o.join(", ").replace(".,","."))});let s=n.join(" "),o=`${r}${s}`;return`${e?e+" ":""}${o}`}(i,sg(p))),[r,n,"",i,"",s,o,a,l,c,u,f,h,d].filter(e=>null!=e).join(` 51`)};function sd(e){if(!e)throw Error("No recap provided, value is undefined");if(!e.att)throw Error("No `att` property found");let t=Object.keys(e.att);if(!(null!=t&&t.length))throw Error("No resources found in `att` property");t.forEach(t=>{let r=e.att[t];if(Array.isArray(r)||"object"!=typeof r)throw Error(`Resource must be an object: ${t}`);if(!Object.keys(r).length)throw Error(`Resource object is empty: ${t}`);Object.keys(r).forEach(e=>{let t=r[e];if(!Array.isArray(t))throw Error(`Ability limits ${e} must be an array of objects, found: ${t}`);if(!t.length)throw Error(`Value of ${e} is empty array, must be an array with objects`);t.forEach(t=>{if("object"!=typeof t)throw Error(`Ability limits (${e}) must be an array of objects, found: ${t}`)})})})}function sp(e){return sd(e),`urn:recap:${rZ.from(JSON.stringify(e)).toString("base64").replace(/=/g,"")}`}function sg(e){var t;let r=(t=e.replace("urn:recap:",""),JSON.parse(rZ.from(t,"base64").toString("utf-8")));return sd(r),r}function sy(e){var t;let r=sg(e);sd(r);let n=null==(t=r.att)?void 0:t.eip155;return n?Object.keys(n).map(e=>e.split("/")[1]):[]}function sm(e){let t=sg(e);sd(t);let r=[];return Object.values(t.att).forEach(e=>{Object.values(e).forEach(e=>{var t;null!=(t=e?.[0])&&t.chains&&r.push(e[0].chains)})}),[...new Set(r.flat())]}function sb(e){if(!e)return;let t=e?.[e.length-1];return t&&t.includes("urn:recap:")?t:void 0}/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */function sw(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function sv(e){if("boolean"!=typeof e)throw Error(`boolean expected, not ${e}`)}function sE(e){if(!Number.isSafeInteger(e)||e<0)throw Error("positive integer expected, got "+e)}function sx(e,...t){if(!sw(e))throw Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw Error("Uint8Array expected of length "+t+", got length="+e.length)}function s_(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}function sA(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function sS(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}let sI=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0];function sO(e){if("string"==typeof e)e=function(e){if("string"!=typeof e)throw Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}(e);else if(sw(e))e=sk(e);else throw Error("Uint8Array expected, got "+typeof e);return e}function sP(e,t,r=!0){if(void 0===t)return new Uint8Array(e);if(t.length!==e)throw Error("invalid output length, expected "+e+", got: "+t.length);if(r&&t.byteOffset%4!=0)throw Error("invalid output, must be aligned");return t}function sC(e,t,r,n){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,n);let i=BigInt(32),s=BigInt(4294967295),o=Number(r>>i&s),a=Number(r&s),l=n?4:0,c=n?0:4;e.setUint32(t+l,o,n),e.setUint32(t+c,a,n)}function sk(e){return Uint8Array.from(e)}let sT=e=>Uint8Array.from(e.split("").map(e=>e.charCodeAt(0))),sB=sT("expand 16-byte k"),sR=sT("expand 32-byte k"),sD=sA(sB),sU=sA(sR);function sM(e,t){return e<<t|e>>>32-t}function sN(e){return e.byteOffset%4==0}let sj=4294967296-1,sL=new Uint32Array,s$=(e,t)=>
51255&e[t++]|(255&e[t++])<<8;class sz{constructor(e){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,sx(e=sO(e),32);let t=s$(e,0),r=s$(e,2),n=s$(e,4),i=s$(e,6),s=s$(e,8),o=s$(e,10),a=s$(e,12),l=s$(e,14);this.r[0]=8191&t,this.r[1]=(t>>>13|r<<3)&8191,this.r[2]=(r>>>10|n<<6)&7939,this.r[3]=(n>>>7|i<<9)&8191,this.r[4]=(i>>>4|s<<12)&255,this.r[5]=s>>>1&8190,this.r[6]=(s>>>14|o<<2)&8191,this.r[7]=(o>>>11|a<<5)&8065,this.r[8]=(a>>>8|l<<8)&8191,this.r[9]=l>>>5&127;for(let t=0;t<8;t++)this.pad[t]=s$(e,16+2*t)}process(e,t,r=!1){let{h:n,r:i}=this,s=i[0],o=i[1],a=i[2],l=i[3],c=i[4],u=i[5],f=i[6],h=i[7],d=i[8],p=i[9],g=s$(e,t+0),y=s$(e,t+2),m=s$(e,t+4),b=s$(e,t+6),w=s$(e,t+8),v=s$(e,t+10),E=s$(e,t+12),x=s$(e,t+14),_=n[0]+(8191&g),A=n[1]+((g>>>13|y<<3)&8191),S=n[2]+((y>>>10|m<<6)&8191),I=n[3]+((m>>>7|b<<9)&8191),O=n[4]+((b>>>4|w<<12)&8191),P=n[5]+(w>>>1&8191),C=n[6]+((w>>>14|v<<2)&8191),k=n[7]+((v>>>11|E<<5)&8191),T=n[8]+((E>>>8|x<<8)&8191),B=n[9]+(x>>>5|(r?0:2048)),R=0,D=0+_*s+5*p*A+5*d*S+5*h*I+5*f*O;R=D>>>13,D&=8191,D+=5*u*P+5*c*C+5*l*k+5*a*T+5*o*B,R+=D>>>13,D&=8191;let U=R+_*o+A*s+5*p*S+5*d*I+5*h*O;R=U>>>13,U&=8191,U+=5*f*P+5*u*C+5*c*k+5*l*T+5*a*B,R+=U>>>13,U&=8191;let M=R+_*a+A*o+S*s+5*p*I+5*d*O;R=M>>>13,M&=8191,M+=5*h*P+5*f*C+5*u*k+5*c*T+5*l*B,R+=M>>>13,M&=8191;let N=R+_*l+A*a+S*o+I*s+5*p*O;R=N>>>13,N&=8191,N+=5*d*P+5*h*C+5*f*k+5*u*T+5*c*B,R+=N>>>13,N&=8191;let j=R+_*c+A*l+S*a+I*o+O*s;R=j>>>13,j&=8191,j+=5*p*P+5*d*C+5*h*k+5*f*T+5*u*B,R+=j>>>13,j&=8191;let L=R+_*u+A*c+S*l+I*a+O*o;R=L>>>13,L&=8191,L+=P*s+5*p*C+5*d*k+5*h*T+5*f*B,R+=L>>>13,L&=8191;let $=R+_*f+A*u+S*c+I*l+O*a;R=$>>>13,$&=8191,$+=P*o+C*s+5*p*k+5*d*T+5*h*B,R+=$>>>13,$&=8191;let z=R+_*h+A*f+S*u+I*c+O*l;R=z>>>13,z&=8191,z+=P*a+C*o+k*s+5*p*T+5*d*B,R+=z>>>13,z&=8191;let F=R+_*d+A*h+S*f+I*u+O*c;R=F>>>13,F&=8191,F+=P*l+C*a+k*o+T*s+5*p*B,R+=F>>>13,F&=8191;let q=R+_*p+A*d+S*h+I*f+O*u;R=q>>>13,q&=8191,q+=P*c+C*l+k*a+T*o+B*s,R+=q>>>13,q&=8191,D=8191&(R=(R=(R<<2)+R|0)+D|0),R>>>=13,U+=R,n[0]=D,n[1]=U,n[2]=M,n[3]=N,n[4]=j,n[5]=L,n[6]=$,n[7]=z,n[8]=F,n[9]=q}finalize(){let{h:e,pad:t}=this,r=new Uint16Array(10),n=e[1]>>>13;e[1]&=8191;for(let t=2;t<10;t++)e[t]+=n,n=e[t]>>>13,e[t]&=8191;e[0]+=5*n,n=e[0]>>>13,e[0]&=8191,e[1]+=n,n=e[1]>>>13,e[1]&=8191,e[2]+=n,r[0]=e[0]+5,n=r[0]>>>13,r[0]&=8191;for(let t=1;t<10;t++)r[t]=e[t]+n,n=r[t]>>>13,r[t]&=8191;r[9]-=8192;let i=(1^n)-1;for(let e=0;e<10;e++)r[e]&=i;i=~i;for(let t=0;t<10;t++)e[t]=e[t]&i|r[t];e[0]=(e[0]|e[1]<<13)&65535,e[1]=(e[1]>>>3|e[2]<<10)&65535,e[2]=(e[2]>>>6|e[3]<<7)&65535,e[3]=(e[3]>>>9|e[4]<<4)&65535,e[4]=(e[4]>>>12|e[5]<<1|e[6]<<14)&65535,e[5]=(e[6]>>>2|e[7]<<11)&65535,e[6]=(e[7]>>>5|e[8]<<8)&65535,e[7]=(e[8]>>>8|e[9]<<5)&65535;let s=e[0]+t[0];e[0]=65535&s;for(let r=1;r<8;r++)s=(e[r]+t[r]|0)+(s>>>16)|0,e[r]=65535&s;sS(r)}update(e){s_(this),sx(e=sO(e));let{buffer:t,blockLen:r}=this,n=e.length;for(let i=0;i<n;){let s=Math.min(r-this.pos,n-i);if(s===r){for(;r<=n-i;i+=r)this.process(e,i);continue}t.set(e.subarray(i,i+s),this.pos),this.pos+=s,i+=s,this.pos===r&&(this.process(t,0,!1),this.pos=0)}return this}destroy(){sS(this.h,this.r,this.buffer,this.pad)}digestInto(e){s_(this),function(e,t){sx(e);let r=t.outputLen;if(e.length<r)throw Error("digestInto() expects output buffer of length at least "+r)}(e,this),this.finished=!0;let{buffer:t,h:r}=this,{pos:n}=this;if(n){for(t[n++]=1;n<16;n++)t[n]=0;this.process(t,0,!0)}this.finalize();let i=0;for(let t=0;t<8;t++)e[i++]=r[t]>>>0,e[i++]=r[t]>>>8;return e}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}}let sF=function(e){let t=(t,r)=>e(r).update(sO(t)).digest(),r=e(new Uint8Array(32));return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t}(e=>new sz(e)),sq=function(e,t){let{allowShortKeys:r,extendNonceFn:n,counterLength:i,counterRight:s,rounds:o}=function(e,t){if(null==t||"object"!=typeof t)throw Error("options must be defined");return Object.assign(e,t)}({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);
51if("function"!=typeof e)throw Error("core must be a function");return sE(i),sE(o),sv(s),sv(r),(t,a,l,c,u=0)=>{sx(t),sx(a),sx(l);let f=l.length;if(void 0===c&&(c=new Uint8Array(f)),sx(c),sE(u),u<0||u>=sj)throw Error("arx: counter overflow");if(c.length<f)throw Error(`arx: output (${c.length}) is shorter than data (${f})`);let h=[],d=t.length,p,g;if(32===d)h.push(p=sk(t)),g=sU;else if(16===d&&r)(p=new Uint8Array(32)).set(t),p.set(t,16),g=sD,h.push(p);else throw Error(`arx: invalid 32-byte key, got length=${d}`);sN(a)||h.push(a=sk(a));let y=sA(p);if(n){if(24!==a.length)throw Error("arx: extended nonce must be 24 bytes");n(g,y,sA(a.subarray(0,16)),y),a=a.subarray(16)}let m=16-i;if(m!==a.length)throw Error(`arx: nonce must be ${m} or 16 bytes`);if(12!==m){let e=new Uint8Array(12);e.set(a,s?0:12-a.length),a=e,h.push(a)}return function(e,t,r,n,i,s,o,a){let l=i.length,c=new Uint8Array(64),u=sA(c),f=sN(i)&&sN(s),h=f?sA(i):sL,d=f?sA(s):sL;for(let p=0;p<l;o++){if(e(t,r,n,u,o,a),o>=sj)throw Error("arx: counter overflow");let g=Math.min(64,l-p);if(f&&64===g){let e=p/4;if(p%4!=0)throw Error("arx: invalid block position");for(let t=0,r;t<16;t++)d[r=e+t]=h[r]^u[t];p+=64;continue}for(let e=0,t;e<g;e++)s[t=p+e]=i[t]^c[e];p+=g}}(e,g,y,sA(a),l,c,u,o),sS(...h),c}}(function(e,t,r,n,i,s=20){let o=e[0],a=e[1],l=e[2],c=e[3],u=t[0],f=t[1],h=t[2],d=t[3],p=t[4],g=t[5],y=t[6],m=t[7],b=r[0],w=r[1],v=r[2],E=o,x=a,_=l,A=c,S=u,I=f,O=h,P=d,C=p,k=g,T=y,B=m,R=i,D=b,U=w,M=v;for(let e=0;e<s;e+=2)C=C+(R=sM(R^(E=E+S|0),16))|0,E=E+(S=sM(S^C,12))|0,C=C+(R=sM(R^E,8))|0,S=sM(S^C,7),k=k+(D=sM(D^(x=x+I|0),16))|0,x=x+(I=sM(I^k,12))|0,k=k+(D=sM(D^x,8))|0,I=sM(I^k,7),T=T+(U=sM(U^(_=_+O|0),16))|0,_=_+(O=sM(O^T,12))|0,T=T+(U=sM(U^_,8))|0,O=sM(O^T,7),B=B+(M=sM(M^(A=A+P|0),16))|0,A=A+(P=sM(P^B,12))|0,B=B+(M=sM(M^A,8))|0,P=sM(P^B,7),T=T+(M=sM(M^(E=E+I|0),16))|0,E=E+(I=sM(I^T,12))|0,T=T+(M=sM(M^E,8))|0,I=sM(I^T,7),B=B+(R=sM(R^(x=x+O|0),16))|0,x=x+(O=sM(O^B,12))|0,B=B+(R=sM(R^x,8))|0,O=sM(O^B,7),C=C+(D=sM(D^(_=_+P|0),16))|0,_=_+(P=sM(P^C,12))|0,C=C+(D=sM(D^_,8))|0,P=sM(P^C,7),k=k+(U=sM(U^(A=A+S|0),16))|0,A=A+(S=sM(S^k,12))|0,k=k+(U=sM(U^A,8))|0,S=sM(S^k,7);let N=0;n[N++]=o+E|0,n[N++]=a+x|0,n[N++]=l+_|0,n[N++]=c+A|0,n[N++]=u+S|0,n[N++]=f+I|0,n[N++]=h+O|0,n[N++]=d+P|0,n[N++]=p+C|0,n[N++]=g+k|0,n[N++]=y+T|0,n[N++]=m+B|0,n[N++]=i+R|0,n[N++]=b+D|0,n[N++]=w+U|0,n[N++]=v+M|0},{counterRight:!1,counterLength:4,allowShortKeys:!1}),sW=new Uint8Array(16),sV=(e,t)=>{e.update(t);let r=t.length%16;r&&e.update(sW.subarray(r))},sH=new Uint8Array(32);function sG(e,t,r,n,i){let s=e(t,r,sH),o=sF.create(s);i&&sV(o,i),sV(o,n);let a=function(e,t,r){sv(r);let n=new Uint8Array(16),i=new DataView(n.buffer,n.byteOffset,n.byteLength);return sC(i,0,BigInt(t),r),sC(i,8,BigInt(e),r),n}(n.length,i?i.length:0,!0);o.update(a);let l=o.digest();return sS(s,a),l}let sK=((e,t)=>{function r(n,...i){if(sx(n),!sI)throw Error("Non little-endian hardware is not yet supported");if(void 0!==e.nonceLength){let t=i[0];if(!t)throw Error("nonce / iv required");e.varSizeNonce?sx(t):sx(t,e.nonceLength)}let s=e.tagLength;s&&void 0!==i[1]&&sx(i[1]);let o=t(n,...i),a=(e,t)=>{if(void 0!==t){if(2!==e)throw Error("cipher output not supported");sx(t)}},l=!1;return{encrypt(e,t){if(l)throw Error("cannot encrypt() twice with same key + nonce");return l=!0,sx(e),a(o.encrypt.length,t),o.encrypt(e,t)},decrypt(e,t){if(sx(e),s&&e.length<s)throw Error("invalid ciphertext length: smaller than tagLength="+s);return a(o.decrypt.length,t),o.decrypt(e,t)}}}return Object.assign(r,e),r})({blockSize:64,nonceLength:12,tagLength:16},(e,t,r)=>({encrypt(n,i){let s=n.length;(i=sP(s+16,i,!1)).set(n);let o=i.subarray(0,-16);sq(e,t,o,o,1);let a=sG(sq,e,t,o,r);return i.set(a,s),sS(a),i},decrypt(n,i){i=sP(n.length-16,i,!1);let s=n.subarray(0,-16),o=n.subarray(-16),a=sG(sq,e,t,s,r);if(!function(e,t){if(e.length!==t.length)return!1;let r=0;for(let n=0;n<e.length;n++)r|=e[n]^t[n];return 0===r}(o,a))throw Error("invalid tag");return i.set(n.subarray(0,-16)),sq(e,t,i,i,1),sS(a),i}}));class sZ extends il{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,nY(e);let r=io(t);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let 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),n1(i)}update(e){return nX(this),this.iHash.update(e),this}digestInto(e){nX(this),nJ(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));let{oHash:t,iHash:r,finished:n,destroyed:i,blockLen:s,outputLen:o}=this;return e.finished=n,e.destroyed=i,e.blockLen=s,e.outputLen=o,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}let sJ=(e,t,r)=>new sZ(e,t).update(r).digest();sJ.create=(e,t)=>
51new sZ(e,t);let sY=Uint8Array.from([0]),sX=Uint8Array.of(),sQ=(e,t,r,n,i)=>{var s;return function(e,t,r,n=32){nY(e),nZ(n);let i=e.outputLen;if(n>255*i)throw Error("Length should be <= 255*HashLen");let s=Math.ceil(n/i);void 0===r&&(r=sX);let o=new Uint8Array(s*i),a=sJ.create(e,t),l=a._cloneInto(),c=new Uint8Array(a.outputLen);for(let e=0;e<s;e++)sY[0]=e+1,l.update(0===e?sX:c).update(r).update(sY).digestInto(c),o.set(c,i*e),a._cloneInto(l);return a.destroy(),l.destroy(),n1(c,sY),o.slice(0,n)}(e,(s=r,nY(e),void 0===s&&(s=new Uint8Array(e.outputLen)),sJ(e,io(s),io(t))),n,i)},s0=BigInt(0),s1=BigInt(1);function s2(e,t=""){if("boolean"!=typeof e)throw Error((t&&`"${t}"`)+"expected boolean, got type="+typeof e);return e}function s6(e,t,r=""){let n=nK(e),i=e?.length,s=void 0!==t;if(!n||s&&i!==t)throw Error((r&&`"${r}" `)+"expected Uint8Array"+(s?` of length ${t}`:"")+", got "+(n?`length=${i}`:`type=${typeof e}`));return e}function s5(e){let t=e.toString(16);return 1&t.length?"0"+t:t}function s8(e){if("string"!=typeof e)throw Error("hex string expected, got "+typeof e);return""===e?s0:BigInt("0x"+e)}function s3(e){return nJ(e),s8(ie(Uint8Array.from(e).reverse()))}function s4(e,t){return ii(e.toString(16).padStart(2*t,"0"))}function s9(e,t){return s4(e,t).reverse()}function s7(e,t,r){let n;if("string"==typeof t)try{n=ii(t)}catch(t){throw Error(e+" must be hex string or Uint8Array, cause: "+t)}else if(nK(t))n=Uint8Array.from(t);else throw Error(e+" must be hex string or Uint8Array");let i=n.length;if("number"==typeof r&&i!==r)throw Error(e+" of length "+r+" expected, got "+i);return n}let oe=e=>"bigint"==typeof e&&s0<=e;function ot(e,t,r,n){if(!(oe(t)&&oe(r)&&oe(n))||!(r<=t)||!(t<n))throw Error("expected valid "+e+": "+r+" <= n < "+n+", got "+t)}function or(e){let t;for(t=0;e>s0;e>>=s1,t+=1);return t}let on=e=>(s1<<BigInt(e))-s1;function oi(e,t,r={}){if(!e||"object"!=typeof e)throw Error("expected valid options object");function n(t,r,n){let i=e[t];if(n&&void 0===i)return;let s=typeof i;if(s!==r||null===i)throw Error(`param "${t}" is invalid: expected ${r}, got ${s}`)}Object.entries(t).forEach(([e,t])=>n(e,t,!1)),Object.entries(r).forEach(([e,t])=>n(e,t,!0))}function os(e){let t=new WeakMap;return(r,...n)=>{let i=t.get(r);if(void 0!==i)return i;let s=e(r,...n);return t.set(r,s),s}}let oo=BigInt(0),oa=BigInt(1),ol=BigInt(2),oc=BigInt(3),ou=BigInt(4),of=BigInt(5),oh=BigInt(7),od=BigInt(8),op=BigInt(9),og=BigInt(16);function oy(e,t){let r=e%t;return r>=oo?r:t+r}function om(e,t,r){let n=e;for(;t-- >oo;)n*=n,n%=r;return n}function ob(e,t){if(e===oo)throw Error("invert: expected non-zero number");if(t<=oo)throw Error("invert: expected positive modulus, got "+t);let r=oy(e,t),n=t,i=oo,s=oa;for(;r!==oo;){let e=n/r,t=n%r,o=i-s*e;n=r,r=t,i=s,s=o}if(n!==oa)throw Error("invert: does not exist");return oy(i,t)}function ow(e,t,r){if(!e.eql(e.sqr(t),r))throw Error("Cannot find square root")}function ov(e,t){let r=(e.ORDER+oa)/ou,n=e.pow(t,r);return ow(e,n,t),n}function oE(e,t){let r=(e.ORDER-of)/od,n=e.mul(t,ol),i=e.pow(n,r),s=e.mul(t,i),o=e.mul(e.mul(s,ol),i),a=e.mul(s,e.sub(o,e.ONE));return ow(e,a,t),a}function ox(e){if(e<oc)throw Error("sqrt is not defined for small field");let t=e-oa,r=0;for(;t%ol===oo;)t/=ol,r++;let n=ol,i=oO(e);for(;1===oS(i,n);)if(n++>1e3)throw Error("Cannot find square root: probably non-prime P");if(1===r)return ov;let s=i.pow(n,t),o=(t+oa)/ol;return function(e,n){if(e.is0(n))return n;if(1!==oS(e,n))throw Error("Cannot find square root");let i=r,a=e.mul(e.ONE,s),l=e.pow(n,t),c=e.pow(n,o);for(;!e.eql(l,e.ONE);){if(e.is0(l))return e.ZERO;let t=1,r=e.sqr(l);for(;!e.eql(r,e.ONE);)if(t++,r=e.sqr(r),t===i)throw Error("Cannot find square root");let n=oa<<BigInt(i-t-1),s=e.pow(a,n);i=t,a=e.sqr(s),l=e.mul(l,a),c=e.mul(c,s)}return c}}let o_=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function oA(e,t,r=!1){let n=Array(t.length).fill(r?e.ZERO:void 0),i=t.reduce((t,r,i)=>e.is0(r)?t:(n[i]=t,e.mul(t,r)),e.ONE),s=e.inv(i);return t.reduceRight((t,r,i)=>e.is0(r)?t:(n[i]=e.mul(t,n[i]),e.mul(t,r)),s),n}function oS(e,t){let r=(e.ORDER-oa)/ol,n=e.pow(t,r),i=e.eql(n,e.ONE),s=e.eql(n,e.ZERO),o=e.eql(n,e.neg(e.ONE));if(!i&&!s&&!o)throw Error("invalid Legendre symbol result");return i?1:s?0:-1}function oI(e,t){void 0!==t&&nZ(t);let r=void 0!==t?t:e.toString(2).length;return{nBitLength:r,nByteLength:Math.ceil(r/8)}}function oO(e,t,r=!1,n={}){let i;if(e<=oo)throw Error("invalid field: expected ORDER > 0, got "+e);let s,o,a=!1,l;if("object"==typeof t&&null!=t){if(n.sqrt||r)throw Error("cannot specify opts in two arguments");
vendor: 4,255 bytes, line 51
51t.BITS&&(s=t.BITS),t.sqrt&&(o=t.sqrt),"boolean"==typeof t.isLE&&(r=t.isLE),"boolean"==typeof t.modFromBytes&&(a=t.modFromBytes),l=t.allowedLengths}else"number"==typeof t&&(s=t),n.sqrt&&(o=n.sqrt);let{nBitLength:c,nByteLength:u}=oI(e,s);if(u>2048)throw Error("invalid field: expected ORDER of <= 2048 bytes");let f=Object.freeze({ORDER:e,isLE:r,BITS:c,BYTES:u,MASK:on(c),ZERO:oo,ONE:oa,allowedLengths:l,create:t=>oy(t,e),isValid:t=>{if("bigint"!=typeof t)throw Error("invalid field element: expected bigint, got "+typeof t);return oo<=t&&t<e},is0:e=>e===oo,isValidNot0:e=>!f.is0(e)&&f.isValid(e),isOdd:e=>(e&oa)===oa,neg:t=>oy(-t,e),eql:(e,t)=>e===t,sqr:t=>oy(t*t,e),add:(t,r)=>oy(t+r,e),sub:(t,r)=>oy(t-r,e),mul:(t,r)=>oy(t*r,e),pow:(e,t)=>(function(e,t,r){if(r<oo)throw Error("invalid exponent, negatives unsupported");if(r===oo)return e.ONE;if(r===oa)return t;let n=e.ONE,i=t;for(;r>oo;)r&oa&&(n=e.mul(n,i)),i=e.sqr(i),r>>=oa;return n})(f,e,t),div:(t,r)=>oy(t*ob(r,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>ob(t,e),sqrt:o||(t=>(i||(i=e%ou===oc?ov:e%od===of?oE:e%og===op?function(e){let t=oO(e),r=ox(e),n=r(t,t.neg(t.ONE)),i=r(t,n),s=r(t,t.neg(n)),o=(e+oh)/og;return(e,t)=>{let r=e.pow(t,o),a=e.mul(r,n),l=e.mul(r,i),c=e.mul(r,s),u=e.eql(e.sqr(a),t),f=e.eql(e.sqr(l),t);r=e.cmov(r,a,u),a=e.cmov(c,l,f);let h=e.eql(e.sqr(a),t),d=e.cmov(r,a,h);return ow(e,d,t),d}}(e):ox(e)),i(f,t))),toBytes:e=>r?s9(e,u):s4(e,u),fromBytes:(t,n=!0)=>{if(l){if(!l.includes(t.length)||t.length>u)throw Error("Field.fromBytes: expected "+l+" bytes, got "+t.length);let e=new Uint8Array(u);e.set(t,r?0:e.length-t.length),t=e}if(t.length!==u)throw Error("Field.fromBytes: expected "+u+" bytes, got "+t.length);let i=r?s3(t):s8(ie(t));if(a&&(i=oy(i,e)),!n&&!f.isValid(i))throw Error("invalid field element: outside of range 0..ORDER");return i},invertBatch:e=>oA(f,e),cmov:(e,t,r)=>r?t:e});return Object.freeze(f)}function oP(e){if("bigint"!=typeof e)throw Error("field order must be bigint");return Math.ceil(e.toString(2).length/8)}function oC(e){let t=oP(e);return t+Math.ceil(t/2)}let ok=BigInt(0),oT=BigInt(1);function oB(e,t){let r=t.negate();return e?r:t}function oR(e,t){let r=oA(e.Fp,t.map(e=>e.Z));return t.map((t,n)=>e.fromAffine(t.toAffine(r[n])))}function oD(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw Error("invalid window size, expected [1.."+t+"], got W="+e)}function oU(e,t){oD(e,t);let r=Math.ceil(t/e)+1,n=2**(e-1),i=2**e;return{windows:r,windowSize:n,mask:on(e),maxNumber:i,shiftBy:BigInt(e)}}function oM(e,t,r){let{windowSize:n,mask:i,maxNumber:s,shiftBy:o}=r,a=Number(e&i),l=e>>o;a>n&&(a-=s,l+=oT);let c=t*n;return{nextN:l,offset:c+Math.abs(a)-1,isZero:0===a,isNeg:a<0,isNegF:t%2!=0,offsetF:c}}let oN=new WeakMap,oj=new WeakMap;function oL(e){return oj.get(e)||1}function o$(e){if(e!==ok)throw Error("invalid wNAF")}class oz{constructor(e,t){this.BASE=e.BASE,this.ZERO=e.ZERO,this.Fn=e.Fn,this.bits=t}_unsafeLadder(e,t,r=this.ZERO){let n=e;for(;t>ok;)t&oT&&(r=r.add(n)),n=n.double(),t>>=oT;return r}precomputeWindow(e,t){let{windows:r,windowSize:n}=oU(t,this.bits),i=[],s=e,o=s;for(let e=0;e<r;e++){o=s,i.push(o);for(let e=1;e<n;e++)o=o.add(s),i.push(o);s=o.double()}return i}wNAF(e,t,r){if(!this.Fn.isValid(r))throw Error("invalid scalar");let n=this.ZERO,i=this.BASE,s=oU(e,this.bits);for(let e=0;e<s.windows;e++){let{nextN:o,offset:a,isZero:l,isNeg:c,isNegF:u,offsetF:f}=oM(r,e,s);r=o,l?i=i.add(oB(u,t[f])):n=n.add(oB(c,t[a]))}return o$(r),{p:n,f:i}}wNAFUnsafe(e,t,r,n=this.ZERO){let i=oU(e,this.bits);for(let e=0;e<i.windows&&r!==ok;e++){let{nextN:s,offset:o,isZero:a,isNeg:l}=oM(r,e,i);if(r=s,!a){let e=t[o];n=n.add(l?e.negate():e)}}return o$(r),n}getPrecomputes(e,t,r){let n=oN.get(t);return n||(n=this.precomputeWindow(t,e),1!==e&&("function"==typeof r&&(n=r(n)),oN.set(t,n))),n}cached(e,t,r){let n=oL(e);return this.wNAF(n,this.getPrecomputes(n,e,r),t)}unsafe(e,t,r,n){let i=oL(e);return 1===i?this._unsafeLadder(e,t,n):this.wNAFUnsafe(i,this.getPrecomputes(i,e,r),t,n)}createCache(e,t){oD(t,this.bits),oj.set(e,t),oN.delete(e)}hasCache(e){return 1!==oL(e)}}function oF(e,t,r){if(!t)return oO(e,{isLE:r});if(t.ORDER!==e)throw Error("Field.ORDER must match order: Fp == p, Fn == n");return oi(t,o_.reduce((e,t)=>
51(e[t]="function",e),{ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"})),t}BigInt(0),BigInt(1),BigInt(2),BigInt(8),is("HashToScalar-");let oq=BigInt(0),oW=BigInt(1),oV=BigInt(2),oH=BigInt(1),oG=BigInt(2),oK=BigInt(3),oZ=BigInt(5),oJ=BigInt(8),oY=BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed");function oX(e){return e[0]&=248,e[31]&=127,e[31]|=64,e}let oQ=oO({p:oY,n:BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),h:oJ,a:BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),d:BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),Gx:BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),Gy:BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")}.p,{isLE:!0}),o0=(()=>{let e=oQ.ORDER;return function(e){let{P:t,type:r,adjustScalarBytes:n,powPminus2:i,randomBytes:s}=(oi(e,{adjustScalarBytes:"function",powPminus2:"function"}),Object.freeze({...e})),o="x25519"===r;if(!o&&"x448"!==r)throw Error("invalid type");let a=s||iu,l=o?255:448,c=o?32:56,u=BigInt(o?9:5),f=BigInt(o?121665:39081),h=o?oV**BigInt(254):oV**BigInt(447),d=h+(o?BigInt(8)*oV**BigInt(251)-oW:BigInt(4)*oV**BigInt(445)-oW)+oW,p=e=>oy(e,t),g=s9(p(u),c);function y(e,r){let s=function(e,r){ot("u",e,oq,t),ot("scalar",r,h,d);let n=oW,s=oq,o=e,a=oW,c=oq;for(let t=BigInt(l-1);t>=oq;t--){let i=r>>t&oW;c^=i,({x_2:n,x_3:o}=b(c,n,o)),({x_2:s,x_3:a}=b(c,s,a)),c=i;let l=n+s,u=p(l*l),h=n-s,d=p(h*h),g=u-d,y=o+a,m=p((o-a)*l),w=p(y*h),v=m+w,E=m-w;o=p(v*v),a=p(e*p(E*E)),n=p(u*d),s=p(g*(u+p(f*g)))}return{x_2:n,x_3:o}=b(c,n,o),{x_2:s,x_3:a}=b(c,s,a),p(n*i(s))}(function(e){let t=s7("u coordinate",e,c);return o&&(t[31]&=127),p(s3(t))}(r),s3(n(s7("scalar",e,c))));if(s===oq)throw Error("invalid private or public key received");return s9(p(s),c)}function m(e){return y(e,g)}function b(e,t,r){let n=p(e*(t-r));return{x_2:t=p(t-n),x_3:r=p(r+n)}}let w={secretKey:c,publicKey:c,seed:c},v=(e=a(c))=>(nJ(e,w.seed),e);return{keygen:function(e){let t=v(e);return{secretKey:t,publicKey:m(t)}},getSharedSecret:(e,t)=>y(e,t),getPublicKey:e=>m(e),scalarMult:y,scalarMultBase:m,utils:{randomSecretKey:v,randomPrivateKey:v},GuBytes:g.slice(),lengths:w}}({P:e,type:"x25519",powPminus2:t=>{let{pow_p_5_8:r,b2:n}=function(e){let t=BigInt(10),r=BigInt(20),n=BigInt(40),i=BigInt(80),s=e*e%oY*e%oY,o=om(s,oG,oY)*s%oY,a=om(o,oH,oY)*e%oY,l=om(a,oZ,oY)*a%oY,c=om(l,t,oY)*l%oY,u=om(c,r,oY)*c%oY,f=om(u,n,oY)*u%oY,h=om(f,i,oY)*f%oY,d=om(h,i,oY)*f%oY,p=om(d,t,oY)*l%oY;return{pow_p_5_8:om(p,oG,oY)*e%oY,b2:s}}(t);return oy(om(r,oK,e)*n,e)},adjustScalarBytes:oX})})(),o1=(e,t)=>(e+(e>=0?t:-t)/o9)/t;function o2(e){if(!["compact","recovered","der"].includes(e))throw Error('Signature format must be "compact", "recovered", or "der"');return e}function o6(e,t){let r={};for(let n of Object.keys(t))r[n]=void 0===e[n]?t[n]:e[n];return s2(r.lowS,"lowS"),s2(r.prehash,"prehash"),void 0!==r.format&&o2(r.format),r}class o5 extends Error{constructor(e=""){super(e)}}let o8={Err:o5,_tlv:{encode:(e,t)=>{let{Err:r}=o8;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(1&t.length)throw new r("tlv.encode: unpadded data");let n=t.length/2,i=s5(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");let s=n>127?s5(i.length/2|128):"";return s5(e)+s+i+t},decode(e,t){let{Err:r}=o8,n=0;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(t.length<2||t[n++]!==e)throw new r("tlv.decode: wrong tlv");let i=t[n++],s=0;if(128&i){let e=127&i;if(!e)throw new r("tlv.decode(long): indefinite length not supported");if(e>4)throw new r("tlv.decode(long): byte length is too big");let o=t.subarray(n,n+e);if(o.length!==e)throw new r("tlv.decode: length bytes not complete");if(0===o[0])throw new r("tlv.decode(long): zero leftmost byte");for(let e of o)s=s<<8|e;if(n+=e,s<128)throw new r("tlv.decode(long): not minimal encoding")}else s=i;let o=t.subarray(n,n+s);if(o.length!==s)throw new r("tlv.decode: wrong value length");return{v:o,l:t.subarray(n+s)}}},_int:{encode(e){let{Err:t}=o8;if(e<o3)throw new t("integer: negative integers are not allowed");let r=s5(e);if(8&Number.parseInt(r[0],16)&&(r="00"+r),1&r.length)throw new t("unexpected DER parsing assertion: unpadded hex");return r},decode(e){let{Err:t}=o8;if(128&e[0])throw new t("invalid signature integer: negative");if(0===e[0]&&!(128&e[1]))throw new t("invalid signature integer: unnecessary leading zero");return s8(ie(e))}},toSig(e){let{Err:t,_int:r,_tlv:n}=o8,i=s7("signature",e),{v:s,l:o}=n.decode(48,i);if(o.length)throw new t("invalid signature: left bytes after parsing");let{v:a,l:l}=n.decode(2,s),{v:c,l:u}=n.decode(2,l);if(u.length)throw new t("invalid signature: left bytes after parsing");return{r:r.decode(a),s:r.decode(c)}},hexFromSig(e){let{_tlv:t,_int:r}=o8,n=t.encode(2,r.encode(e.r)),i=t.encode(2,r.encode(e.s));return t.encode(48,n+i)}},o3=BigInt(0),o4=BigInt(1),o9=BigInt(2),o7=BigInt(3),ae=BigInt(4);function at(e,t){let r;let{BYTES:n}=e;if("bigint"==typeof t)r=t;else{let i=s7("private key",t);try{r=e.fromBytes(i)}catch{throw Error(`invalid private key: expected ui8a of size ${n}, got ${typeof t}`)}}if(!e.isValidNot0(r))throw Error("invalid private key: out of range [1..N-1]");return r}function ar(e){return Uint8Array.of(e?2:3)}function an(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function ai(e,t){let r=t=>(function(e){let{CURVE:t,curveOpts:r,hash:n,ecdsaOpts:i}=function(e){let{CURVE:t,curveOpts:r}=function(e){let t={a:e.a,b:e.b,p:e.Fp.ORDER,n:e.n,h:e.h,Gx:e.Gx,Gy:e.Gy},r=e.Fp,n=e.allowedPrivateKeyLengths?Array.from(new Set(e.allowedPrivateKeyLengths.map(e=>Math.ceil(e/2)))):void 0,i={Fp:r,Fn:oO(t.n,{BITS:e.nBitLength,allowedLengths:n,modFromBytes:e.wrapPrivateKey}),allowInfinityPoint:e.allowInfinityPoint,endo:e.endo,isTorsionFree:e.isTorsionFree,clearCofactor:e.clearCofactor,fromBytes:e.fromBytes,toBytes:e.toBytes};return{CURVE:t,curveOpts:i}}(e),n={hmac:e.hmac,randomBytes:e.randomBytes,lowS:e.lowS,bits2int:e.bits2int,bits2int_modN:e.bits2int_modN};return{CURVE:t,curveOpts:r,hash:e.hash,ecdsaOpts:n}}(e);return function(e,t){let r=t.Point;return Object.assign({},t,{ProjectivePoint:r,CURVE:Object.assign({},e,oI(r.Fn.ORDER,r.Fn.BITS))})}(e,function(e,t,r={}){nY(t),oi(r,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});let n=r.randomBytes||iu,i=r.hmac||((e,...r)=>sJ(t,e,ia(...r))),{Fp:s,Fn:o}=e,{ORDER:a,BITS:l}=o,{keygen:c,getPublicKey:u,getSharedSecret:f,utils:h,lengths:d}=function(e,t={}){let{Fn:r}=e,n=t.randomBytes||iu,i=Object.assign(an(e.Fp,r),{seed:oC(r.ORDER)});function s(e){try{return!!at(r,e)}catch{return!1}}function o(e=n(i.seed)){return function(e,t,r=!1){let n=e.length,i=oP(t),s=oC(t);if(n<16||n<s||n>1024)throw Error("expected "+s+"-1024 bytes of input, got "+n);let o=oy(r?s3(e):s8(ie(e)),t-oa)+oa;return r?s9(o,i):s4(o,i)}(s6(e,i.seed,"seed"),r.ORDER)}function a(t,n=!0){return e.BASE.multiply(at(r,t)).toBytes(n)}function l(t){if("bigint"==typeof t)return!1;if(t instanceof e)return!0;let{secretKey:n,publicKey:s,publicKeyUncompressed:o}=i;if(r.allowedLengths||n===s)return;let a=s7("key",t).length;return a===s||a===o}return Object.freeze({getPublicKey:a,getSharedSecret:function(t,n,i=!0){if(!0===l(t))throw Error("first arg must be private key");if(!1===l(n))throw Error("second arg must be public key");let s=at(r,t);return e.fromHex(n).multiply(s).toBytes(i)},keygen:function(e){let t=o(e);return{secretKey:t,publicKey:a(t)}},Point:e,utils:{isValidSecretKey:s,isValidPublicKey:function(t,r){let{publicKey:n,publicKeyUncompressed:s}=i;try{let i=t.length;return(!0!==r||i===n)&&(!1!==r||i===s)&&!!e.fromBytes(t)}catch{return!1}},randomSecretKey:o,isValidPrivateKey:s,randomPrivateKey:o,normPrivateKeyToScalar:e=>
vendor: 9,881 bytes, line 51
51at(r,e),precompute:(t=8,r=e.BASE)=>r.precompute(t,!1)},lengths:i})}(e,r),p={prehash:!1,lowS:"boolean"==typeof r.lowS&&r.lowS,format:void 0,extraEntropy:!1},g="compact";function y(e,t){if(!o.isValidNot0(t))throw Error(`invalid signature ${e}: out of range 1..Point.Fn.ORDER`);return t}class m{constructor(e,t,r){this.r=y("r",e),this.s=y("s",t),null!=r&&(this.recovery=r),Object.freeze(this)}static fromBytes(e,t=g){let r;if(!function(e,t){o2(t);let r=d.signature;s6(e,"compact"===t?r:"recovered"===t?r+1:void 0,`${t} signature`)}(e,t),"der"===t){let{r:t,s:r}=o8.toSig(s6(e));return new m(t,r)}"recovered"===t&&(r=e[0],t="compact",e=e.subarray(1));let n=o.BYTES,i=e.subarray(0,n),s=e.subarray(n,2*n);return new m(o.fromBytes(i),o.fromBytes(s),r)}static fromHex(e,t){return this.fromBytes(ii(e),t)}addRecoveryBit(e){return new m(this.r,this.s,e)}recoverPublicKey(t){let r=s.ORDER,{r:n,s:i,recovery:l}=this;if(null==l||![0,1,2,3].includes(l))throw Error("recovery id invalid");if(a*o9<r&&l>1)throw Error("recovery id is ambiguous for h>1 curve");let c=2===l||3===l?n+a:n;if(!s.isValid(c))throw Error("recovery id 2 or 3 invalid");let u=s.toBytes(c),f=e.fromBytes(ia(ar((1&l)==0),u)),h=o.inv(c),d=w(s7("msgHash",t)),p=o.create(-d*h),g=o.create(i*h),y=e.BASE.multiplyUnsafe(p).add(f.multiplyUnsafe(g));if(y.is0())throw Error("point at infinify");return y.assertValidity(),y}hasHighS(){return this.s>a>>o4}toBytes(e=g){if(o2(e),"der"===e)return ii(o8.hexFromSig(this));let t=o.toBytes(this.r),r=o.toBytes(this.s);if("recovered"===e){if(null==this.recovery)throw Error("recovery bit must be present");return ia(Uint8Array.of(this.recovery),t,r)}return ia(t,r)}toHex(e){return ie(this.toBytes(e))}assertValidity(){}static fromCompact(e){return m.fromBytes(s7("sig",e),"compact")}static fromDER(e){return m.fromBytes(s7("sig",e),"der")}normalizeS(){return this.hasHighS()?new m(this.r,o.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return ie(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return ie(this.toBytes("compact"))}}let b=r.bits2int||function(e){if(e.length>8192)throw Error("input is too large");let t=s8(ie(e)),r=8*e.length-l;return r>0?t>>BigInt(r):t},w=r.bits2int_modN||function(e){return o.create(b(e))},v=on(l);function E(e){return ot("num < 2^"+l,e,o3,v),o.toBytes(e)}function x(e,r){return s6(e,void 0,"message"),r?s6(t(e),void 0,"prehashed message"):e}return Object.freeze({keygen:c,getPublicKey:u,getSharedSecret:f,utils:h,lengths:d,Point:e,sign:function(r,s,l={}){let{seed:c,k2sig:u}=function(t,r,i){if(["recovered","canonical"].some(e=>e in i))throw Error("sign() legacy options not supported");let{lowS:s,prehash:l,extraEntropy:c}=o6(i,p),u=w(t=x(t,l)),f=at(o,r),h=[E(f),E(u)];if(null!=c&&!1!==c){let e=!0===c?n(d.secretKey):c;h.push(s7("extraEntropy",e))}return{seed:ia(...h),k2sig:function(t){let r=b(t);if(!o.isValidNot0(r))return;let n=o.inv(r),i=e.BASE.multiply(r).toAffine(),l=o.create(i.x);if(l===o3)return;let c=o.create(n*o.create(u+l*f));if(c===o3)return;let h=(i.x===l?0:2)|Number(i.y&o4),d=c;return s&&c>a>>o4&&(d=o.neg(c),h^=1),new m(l,d,h)}}}(r=s7("message",r),s,l);return(function(e,t,r){if("number"!=typeof e||e<2)throw Error("hashLen must be a number");if("number"!=typeof t||t<2)throw Error("qByteLen must be a number");if("function"!=typeof r)throw Error("hmacFn must be a function");let n=e=>new Uint8Array(e),i=e=>Uint8Array.of(e),s=n(e),o=n(e),a=0,l=()=>{s.fill(1),o.fill(0),a=0},c=(...e)=>r(o,s,...e),u=(e=n(0))=>{o=c(i(0),e),s=c(),0!==e.length&&(o=c(i(1),e),s=c())},f=()=>{if(a++>=1e3)throw Error("drbg: tried 1000 values");let e=0,r=[];for(;e<t;){let t=(s=c()).slice();r.push(t),e+=s.length}return ia(...r)};return(e,t)=>{let r;for(l(),u(e);!(r=t(f()));)u();return l(),r}})(t.outputLen,o.BYTES,i)(c,u)},verify:function(t,r,n,i={}){let{lowS:s,prehash:a,format:l}=o6(i,p);if(n=s7("publicKey",n),r=x(s7("message",r),a),"strict"in i)throw Error("options.strict was renamed to lowS");let c=void 0===l?function(e){let t;let r="string"==typeof e||nK(e),n=!r&&null!==e&&"object"==typeof e&&"bigint"==typeof e.r&&"bigint"==typeof e.s;if(!r&&!n)throw Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(n)t=new m(e.r,e.s);else if(r){try{t=m.fromBytes(s7("sig",e),"der")}catch(e){if(!(e instanceof o8.Err))throw e}if(!t)try{t=m.fromBytes(s7("sig",e),"compact")}catch{return!1}}return t||!1}(t):m.fromBytes(s7("sig",t),l);if(!1===c)return!1;try{let t=e.fromBytes(n);if(s&&c.hasHighS())return!1;let{r:i,s:a}=c,l=w(r),u=o.inv(a),f=o.create(l*u),h=o.create(i*u),d=e.BASE.multiplyUnsafe(f).add(t.multiplyUnsafe(h));return!d.is0()&&o.create(d.x)===i}catch{return!1}},recoverPublicKey:function(e,t,r={}){let{prehash:n}=o6(r,p);return t=x(t,n),m.fromBytes(e,"recovered").recoverPublicKey(t).toBytes()},Signature:m,hash:t})}(function(e,t={}){let r=function(e,t,r={},n){if(void 0===n&&(n="edwards"===e),!t||"object"!=typeof t)throw Error(`expected valid ${e} CURVE object`);for(let e of["p","n","h"]){let r=t[e];if(!("bigint"==typeof r&&r>ok))throw Error(`CURVE.${e} must be positive bigint`)}let i=oF(t.p,r.Fp,n),s=oF(t.n,r.Fn,n);for(let r of["Gx","Gy","a","weierstrass"===e?"b":"d"])if(!i.isValid(t[r]))throw Error(`CURVE.${r} must be valid field element of CURVE.Fp`);return{CURVE:t=Object.freeze(Object.assign({},t)),Fp:i,Fn:s}}("weierstrass",e,t),{Fp:n,Fn:i}=r,s=r.CURVE,{h:o,n:a}=s;oi(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});let{endo:l}=t;if(l&&(!n.is0(s.a)||"bigint"!=typeof l.beta||!Array.isArray(l.basises)))throw Error('invalid endo: expected "beta": bigint and "basises": array');let c=an(n,i);function u(){if(!n.isOdd)throw Error("compression is not supported: Field does not have .isOdd()")}let f=t.toBytes||function(e,t,r){let{x:i,y:s}=t.toAffine(),o=n.toBytes(i);return(s2(r,"isCompressed"),r)?(u(),ia(ar(!n.isOdd(s)),o)):ia(Uint8Array.of(4),o,n.toBytes(s))},h=t.fromBytes||function(e){s6(e,void 0,"Point");let{publicKey:t,publicKeyUncompressed:r}=c,i=e.length,s=e[0],o=e.subarray(1);if(i===t&&(2===s||3===s)){let e;let t=n.fromBytes(o);if(!n.isValid(t))throw Error("bad point: is not on curve, wrong x");let r=d(t);try{e=n.sqrt(r)}catch(e){throw Error("bad point: is not on curve, sqrt error"+(e instanceof Error?": "+e.message:""))}return u(),(1&s)==1!==n.isOdd(e)&&(e=n.neg(e)),{x:t,y:e}}if(i===r&&4===s){let e=n.BYTES,t=n.fromBytes(o.subarray(0,e)),r=n.fromBytes(o.subarray(e,2*e));if(!p(t,r))throw Error("bad point: is not on curve");return{x:t,y:r}}throw Error(`bad point: got length ${i}, expected compressed=${t} or uncompressed=${r}`)};function d(e){let t=n.sqr(e),r=n.mul(t,e);return n.add(n.add(r,n.mul(e,s.a)),s.b)}function p(e,t){let r=n.sqr(t),i=d(e);return n.eql(r,i)}if(!p(s.Gx,s.Gy))throw Error("bad curve params: generator point");let g=n.mul(n.pow(s.a,o7),ae),y=n.mul(n.sqr(s.b),BigInt(27));if(n.is0(n.add(g,y)))throw Error("bad curve params: a or b");function m(e,t,r=!1){if(!n.isValid(t)||r&&n.is0(t))throw Error(`bad point coordinate ${e}`);return t}function b(e){if(!(e instanceof _))throw Error("ProjectivePoint expected")}function w(e){if(!l||!l.basises)throw Error("no endo");return function(e,t,r){let[[n,i],[s,o]]=t,a=o1(o*e,r),l=o1(-i*e,r),c=e-a*n-l*s,u=-a*i-l*o,f=c<o3,h=u<o3;f&&(c=-c),h&&(u=-u);let d=on(Math.ceil(or(r)/2))+o4;if(c<o3||c>=d||u<o3||u>=d)throw Error("splitScalar (endomorphism): failed, k="+e);return{k1neg:f,k1:c,k2neg:h,k2:u}}(e,l.basises,i.ORDER)}let v=os((e,t)=>{let{X:r,Y:i,Z:s}=e;if(n.eql(s,n.ONE))return{x:r,y:i};let o=e.is0();null==t&&(t=o?n.ONE:n.inv(s));let a=n.mul(r,t),l=n.mul(i,t),c=n.mul(s,t);if(o)return{x:n.ZERO,y:n.ZERO};if(!n.eql(c,n.ONE))throw Error("invZ was invalid");return{x:a,y:l}}),E=os(e=>{if(e.is0()){if(t.allowInfinityPoint&&!n.is0(e.Y))return;throw Error("bad point: ZERO")}let{x:r,y:i}=e.toAffine();if(!n.isValid(r)||!n.isValid(i))throw Error("bad point: x or y not field elements");if(!p(r,i))throw Error("bad point: equation left != right");if(!e.isTorsionFree())throw Error("bad point: not in prime-order subgroup");return!0});function x(e,t,r,i,s){return r=new _(n.mul(r.X,e),r.Y,r.Z),t=oB(i,t),r=oB(s,r),t.add(r)}class _{constructor(e,t,r){this.X=m("x",e),this.Y=m("y",t,!0),this.Z=m("z",r),Object.freeze(this)}static CURVE(){return s}static fromAffine(e){let{x:t,y:r}=e||{};if(!e||!n.isValid(t)||!n.isValid(r))throw Error("invalid affine point");if(e instanceof _)throw Error("projective point not allowed");return n.is0(t)&&n.is0(r)?_.ZERO:new _(t,r,n.ONE)}static fromBytes(e){let t=_.fromAffine(h(s6(e,void 0,"point")));return t.assertValidity(),t}static fromHex(e){return _.fromBytes(s7("pointHex",e))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(e=8,t=!0){return S.createCache(this,e),t||this.multiply(o7),this}assertValidity(){E(this)}hasEvenY(){let{y:e}=this.toAffine();if(!n.isOdd)throw Error("Field doesn't support isOdd");return!n.isOdd(e)}equals(e){b(e);let{X:t,Y:r,Z:i}=this,{X:s,Y:o,Z:a}=e,l=n.eql(n.mul(t,a),n.mul(s,i)),c=n.eql(n.mul(r,a),n.mul(o,i));return l&&c}negate(){return new _(this.X,n.neg(this.Y),this.Z)}double(){let{a:e,b:t}=s,r=n.mul(t,o7),{X:i,Y:o,Z:a}=this,l=n.ZERO,c=n.ZERO,u=n.ZERO,f=n.mul(i,i),h=n.mul(o,o),d=n.mul(a,a),p=n.mul(i,o);return p=n.add(p,p),u=n.mul(i,a),u=n.add(u,u),l=n.mul(e,u),c=n.mul(r,d),c=n.add(l,c),l=n.sub(h,c),c=n.add(h,c),c=n.mul(l,c),l=n.mul(p,l),u=n.mul(r,u),d=n.mul(e,d),p=n.sub(f,d),p=n.mul(e,p),p=n.add(p,u),u=n.add(f,f),f=n.add(u,f),f=n.add(f,d),f=n.mul(f,p),c=n.add(c,f),d=n.mul(o,a),d=n.add(d,d),f=n.mul(d,p),l=n.sub(l,f),u=n.mul(d,h),u=n.add(u,u),new _(l,c,u=n.add(u,u))}add(e){b(e);let{X:t,Y:r,Z:i}=this,{X:o,Y:a,Z:l}=e,c=n.ZERO,u=n.ZERO,f=n.ZERO,h=s.a,d=n.mul(s.b,o7),p=n.mul(t,o),g=n.mul(r,a),y=n.mul(i,l),m=n.add(t,r),w=n.add(o,a);
vendor: 1,176 bytes, line 51
51m=n.mul(m,w),w=n.add(p,g),m=n.sub(m,w),w=n.add(t,i);let v=n.add(o,l);return w=n.mul(w,v),v=n.add(p,y),w=n.sub(w,v),v=n.add(r,i),c=n.add(a,l),v=n.mul(v,c),c=n.add(g,y),v=n.sub(v,c),f=n.mul(h,w),c=n.mul(d,y),f=n.add(c,f),c=n.sub(g,f),f=n.add(g,f),u=n.mul(c,f),g=n.add(p,p),g=n.add(g,p),y=n.mul(h,y),w=n.mul(d,w),g=n.add(g,y),y=n.sub(p,y),y=n.mul(h,y),w=n.add(w,y),p=n.mul(g,w),u=n.add(u,p),p=n.mul(v,w),c=n.mul(m,c),c=n.sub(c,p),p=n.mul(m,g),f=n.mul(v,f),new _(c,u,f=n.add(f,p))}subtract(e){return this.add(e.negate())}is0(){return this.equals(_.ZERO)}multiply(e){let r,n;let{endo:s}=t;if(!i.isValidNot0(e))throw Error("invalid scalar: out of range");let o=e=>S.cached(this,e,e=>oR(_,e));if(s){let{k1neg:t,k1:i,k2neg:a,k2:l}=w(e),{p:c,f:u}=o(i),{p:f,f:h}=o(l);n=u.add(h),r=x(s.beta,c,f,t,a)}else{let{p:t,f:i}=o(e);r=t,n=i}return oR(_,[r,n])[0]}multiplyUnsafe(e){let{endo:r}=t;if(!i.isValid(e))throw Error("invalid scalar: out of range");if(e===o3||this.is0())return _.ZERO;if(e===o4)return this;if(S.hasCache(this))return this.multiply(e);if(!r)return S.unsafe(this,e);{let{k1neg:t,k1:n,k2neg:i,k2:s}=w(e),{p1:o,p2:a}=function(e,t,r,n){let i=t,s=e.ZERO,o=e.ZERO;for(;r>ok||n>ok;
51)r&oT&&(s=s.add(i)),n&oT&&(o=o.add(i)),i=i.double(),r>>=oT,n>>=oT;return{p1:s,p2:o}}(_,this,n,s);return x(r.beta,o,a,t,i)}}multiplyAndAddUnsafe(e,t,r){let n=this.multiplyUnsafe(t).add(e.multiplyUnsafe(r));return n.is0()?void 0:n}toAffine(e){return v(this,e)}isTorsionFree(){let{isTorsionFree:e}=t;return o===o4||(e?e(_,this):S.unsafe(this,a).is0())}clearCofactor(){let{clearCofactor:e}=t;return o===o4?this:e?e(_,this):this.multiplyUnsafe(o)}isSmallOrder(){return this.multiplyUnsafe(o).is0()}toBytes(e=!0){return s2(e,"isCompressed"),this.assertValidity(),f(_,this,e)}toHex(e=!0){return ie(this.toBytes(e))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(e=!0){return this.toBytes(e)}_setWindowSize(e){this.precompute(e)}static normalizeZ(e){return oR(_,e)}static msm(e,t){return function(e,t,r,n){(function(e,t){if(!Array.isArray(e))throw Error("array expected");e.forEach((e,r)=>{if(!(e instanceof t))throw Error("invalid point at index "+r)})})(r,e),function(e,t){if(!Array.isArray(e))throw Error("array of scalars expected");e.forEach((e,r)=>{if(!t.isValid(e))throw Error("invalid scalar at index "+r)})}(n,t);let i=r.length,s=n.length;if(i!==s)throw Error("arrays of points and scalars must have equal length");let o=e.ZERO,a=or(BigInt(i)),l=1;a>12?l=a-3:a>4?l=a-2:a>0&&(l=2);let c=on(l),u=Array(Number(c)+1).fill(o),f=Math.floor((t.BITS-1)/l)*l,h=o;for(let e=f;e>=0;e-=l){u.fill(o);for(let t=0;t<s;t++){let i=Number(n[t]>>BigInt(e)&c);u[i]=u[i].add(r[t])}let t=o;for(let e=u.length-1,r=o;e>0;e--)r=r.add(u[e]),t=t.add(r);if(h=h.add(t),0!==e)for(let e=0;e<l;e++)h=h.double()}return h}(_,i,e,t)}static fromPrivateKey(e){return _.BASE.multiply(at(i,e))}}_.BASE=new _(s.Gx,s.Gy,n.ONE),_.ZERO=new _(n.ZERO,n.ONE,n.ZERO),_.Fp=n,_.Fn=i;let A=i.BITS,S=new oz(_,t.endo?Math.ceil(A/2):A);return _.BASE.precompute(8),_}(t,r),n,i))})({...e,hash:t});return{...r(t),create:r}}let as={p:BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),h:BigInt(1),a:BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")},ao={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff"),n:BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973"),h:BigInt(1),a:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000fffffffc"),b:BigInt("0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef"),Gx:BigInt("0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7"),Gy:BigInt("0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f")},aa={p:BigInt("0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),n:BigInt("0x01fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e91386409"),h:BigInt(1),a:BigInt("0x1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc"),b:BigInt("0x0051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00"),Gx:BigInt("0x00c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66"),Gy:BigInt("0x011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650")},al=oO(as.p),ac=oO(ao.p),au=oO(aa.p),af=ai({...as,Fp:al,lowS:!1},iW);ai({...ao,Fp:ac,lowS:!1},iH),ai({...aa,Fp:au,lowS:!1,allowedPrivateKeyLengths:[130,131,132]},iV);let ah="base10",ad="base16",ap="base64pad",ag="base64url",ay="utf8";function am(){return rV(iu(32),ad)}function ab(e){return rV(iW(rW(e,ad)),ad)}function aw(e){return rV(iW(rW(e,ay)),ad)}function av(e){return Number(rV(e,ah))}function aE(e){return e.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function ax(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r=(4-t.length%4)%4;return t+"=".repeat(r)}function a_(e){if(2===av(e.type))return rV(rj([e.type,e.sealed]),ap);if(1===av(e.type)){if(typeof e.senderPublicKey>"u")throw Error("Missing sender public key for type 1 envelope");
51return rV(rj([e.type,e.senderPublicKey,e.iv,e.sealed]),ap)}return rV(rj([e.type,e.iv,e.sealed]),ap)}function aA(e){let t=rW((e.encoding||ap)===ag?ax(e.encoded):e.encoded,ap),r=t.slice(0,1);if(1===av(r)){let e=t.slice(1,33),n=t.slice(33,45);return{type:r,sealed:t.slice(45),iv:n,senderPublicKey:e}}if(2===av(r))return{type:r,sealed:t.slice(1),iv:iu(12)};let n=t.slice(1,13);return{type:r,sealed:t.slice(13),iv:n}}function aS(e){let t=e?.type||0;if(1===t){if(typeof e?.senderPublicKey>"u")throw Error("missing sender public key");if(typeof e?.receiverPublicKey>"u")throw Error("missing receiver public key")}return{type:t,senderPublicKey:e?.senderPublicKey,receiverPublicKey:e?.receiverPublicKey}}function aI(e){return 1===e.type&&"string"==typeof e.senderPublicKey&&"string"==typeof e.receiverPublicKey}function aO(e){return e?.relay||{protocol:"irn"}}function aP(e){let t=rH.iO[e];if(typeof t>"u")throw Error(`Relay Protocol not supported: ${e}`);return t}var aC=Object.defineProperty,ak=Object.defineProperties,aT=Object.getOwnPropertyDescriptors,aB=Object.getOwnPropertySymbols,aR=Object.prototype.hasOwnProperty,aD=Object.prototype.propertyIsEnumerable,aU=(e,t,r)=>t in e?aC(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,aM=(e,t)=>{for(var r in t||(t={}))aR.call(t,r)&&aU(e,r,t[r]);if(aB)for(var r of aB(t))aD.call(t,r)&&aU(e,r,t[r]);return e},aN=(e,t)=>ak(e,aT(t));function aj(e){var t;if(!e.includes("wc:")){let t=nx(e);null!=t&&t.includes("wc:")&&(e=t)}let r=(e=(e=e.includes("wc://")?e.replace("wc://",""):e).includes("wc:")?e.replace("wc:",""):e).indexOf(":"),n=-1!==e.indexOf("?")?e.indexOf("?"):void 0,i=e.substring(0,r),s=e.substring(r+1,n).split("@"),o=Object.fromEntries(new URLSearchParams("u">typeof n?e.substring(n):"").entries()),a="string"==typeof o.methods?o.methods.split(","):void 0;return{protocol:i,topic:(t=s[0]).startsWith("//")?t.substring(2):t,version:parseInt(s[1],10),symKey:o.symKey,relay:function(e,t="-"){let r={},n="relay"+t;return Object.keys(e).forEach(t=>{if(t.startsWith(n)){let i=t.replace(n,""),s=e[t];r[i]=s}}),r}(o),methods:a,expiryTimestamp:o.expiryTimestamp?parseInt(o.expiryTimestamp,10):void 0}}function aL(e){let t=new URLSearchParams;return Object.entries(aM(aM(aN(aM({},function(e,t="-"){let r={};return Object.keys(e).forEach(n=>{e[n]&&(r["relay"+t+n]=e[n])}),r}(e.relay)),{symKey:e.symKey}),e.expiryTimestamp&&{expiryTimestamp:e.expiryTimestamp.toString()}),e.methods&&{methods:e.methods.join(",")})).sort(([e],[t])=>e.localeCompare(t)).forEach(([e,r])=>{void 0!==r&&t.append(e,String(r))}),`${e.protocol}:${e.topic}@${e.version}?${t}`}function a$(e,t,r){return`${e}?wc_ev=${r}&topic=${t}`}var az=Object.defineProperty,aF=Object.defineProperties,aq=Object.getOwnPropertyDescriptors,aW=Object.getOwnPropertySymbols,aV=Object.prototype.hasOwnProperty,aH=Object.prototype.propertyIsEnumerable,aG=(e,t,r)=>t in e?az(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,aK=(e,t)=>{for(var r in t||(t={}))aV.call(t,r)&&aG(e,r,t[r]);if(aW)for(var r of aW(t))aH.call(t,r)&&aG(e,r,t[r]);return e},aZ=(e,t)=>aF(e,aq(t));function aJ(e){let t=[];return e.forEach(e=>{let[r,n]=e.split(":");t.push(`${r}:${n}`)}),t}function aY(e){return e.includes(":")}function aX(e){return aY(e)?e.split(":")[0]:e}function aQ(e){var t,r,n;let i={};if(!a3(e))return i;for(let[s,o]of Object.entries(e)){let e=aY(s)?[s]:o.chains,a=o.methods||[],l=o.events||[],c=aX(s);i[c]=aZ(aK({},i[c]),{chains:ny(e,null==(t=i[c])?void 0:t.chains),methods:ny(a,null==(r=i[c])?void 0:r.methods),events:ny(l,null==(n=i[c])?void 0:n.events)})}return i}function a0(e,t){let r=function(e){let t={};return e?.forEach(e=>{var r;let[n,i]=e.split(":");t[n]||(t[n]={accounts:[],chains:[],events:[],methods:[]}),t[n].accounts.push(e),null==(r=t[n].chains)||r.push(`${n}:${i}`)}),t}(t=t.map(e=>e.replace("did:pkh:","")));for(let[t,n]of Object.entries(r))n.methods?n.methods=ny(n.methods,e):n.methods=e,n.events=["chainChanged","accountsChanged"];return r}let a1={INVALID_METHOD:{message:"Invalid method.",code:1001},INVALID_EVENT:{message:"Invalid event.",code:1002},INVALID_UPDATE_REQUEST:{message:"Invalid update request.",code:1003},INVALID_EXTEND_REQUEST:{message:"Invalid extend request.",code:1004},INVALID_SESSION_SETTLE_REQUEST:{message:"Invalid session settle request.",code:1005},UNAUTHORIZED_METHOD:{message:"Unauthorized method.",code:3001},UNAUTHORIZED_EVENT:{message:"Unauthorized event.",code:3002},UNAUTHORIZED_UPDATE_REQUEST:{message:"Unauthorized update request.",code:3003},UNAUTHORIZED_EXTEND_REQUEST:{message:"Unauthorized extend request.",code:3004},USER_REJECTED:{message:"User rejected.",code:5e3},USER_REJECTED_CHAINS:{message:"User rejected chains.",code:5001},USER_REJECTED_METHODS:{message:"User rejected methods.",code:5002},USER_REJECTED_EVENTS:{message:"User rejected events.",code:5003},UNSUPPORTED_CHAINS:{message:"Unsupported chains.",code:5100},UNSUPPORTED_METHODS:{message:"Unsupported methods.",code:5101},UNSUPPORTED_EVENTS:{message:"Unsupported events.",code:5102},UNSUPPORTED_ACCOUNTS:{message:"Unsupported accounts.",code:5103},UNSUPPORTED_NAMESPACE_KEY:{message:"Unsupported namespace key.",code:5104},USER_DISCONNECTED:{message:"User disconnected.",code:6e3},SESSION_SETTLEMENT_FAILED:{message:"Session settlement failed.",code:7e3},WC_METHOD_UNSUPPORTED:{message:"Unsupported wc_ method.",code:10001}},a2={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function a6(e,t){let{message:r,code:n}=a2[e];return{message:t?`${r} ${t}`:r,code:n}}function a5(e,t){let{message:r,code:n}=a1[e];return{message:t?`${r} ${t}`:r,code:n}}function a8(e,t){return!!Array.isArray(e)&&(!("u">typeof t)||!e.length||e.every(t))}function a3(e){return Object.getPrototypeOf(e)===Object.prototype&&Object.keys(e).length}function a4(e){return typeof e>"u"}function a9(e,t){return!!(t&&a4(e))||"string"==typeof e&&!!e.trim().length}function a7(e,t){return!!(t&&a4(e))||"number"==typeof e&&!isNaN(e)}function le(e){return!!(a9(e,!1)&&e.includes(":"))&&2===e.split(":").length}function lt(e){let t=!0;return a8(e)?e.length&&(t=e.every(e=>
51a9(e,!1))):t=!1,t}function lr(e,t){let r=null;return Object.values(e).forEach(e=>{var n;let i;if(r)return;let s=(n=`${t}, namespace`,i=null,lt(e?.methods)?lt(e?.events)||(i=a5("UNSUPPORTED_EVENTS",`${n}, events should be an array of strings or empty array for no events`)):i=a5("UNSUPPORTED_METHODS",`${n}, methods should be an array of strings or empty array for no methods`),i);s&&(r=s)}),r}function ln(e,t){let r=null;if(e&&a3(e)){let n;let i=lr(e,t);i&&(r=i);let s=(n=null,Object.values(e).forEach(e=>{var r,i;let s;if(n)return;let o=(r=e?.accounts,i=`${t} namespace`,s=null,a8(r)?r.forEach(e=>{s||function(e){if(a9(e,!1)&&e.includes(":")){let t=e.split(":");if(3===t.length){let e=t[0]+":"+t[1];return!!t[2]&&le(e)}}return!1}(e)||(s=a5("UNSUPPORTED_ACCOUNTS",`${i}, account ${e} should be a string and conform to "namespace:chainId:address" format`))}):s=a5("UNSUPPORTED_ACCOUNTS",`${i}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),s);o&&(n=o)}),n);s&&(r=s)}else r=a6("MISSING_OR_INVALID",`${t}, namespaces should be an object with data`);return r}function li(e){return a9(e.protocol,!0)}function ls(e){return"u">typeof e}function lo(e,t){return!(!le(t)||!(function(e){let t=[];return Object.values(e).forEach(e=>{t.push(...aJ(e.accounts))}),t})(e).includes(t))}function la(e,t,r){let n=null,i=function(e){let t={};return Object.keys(e).forEach(r=>{var n;r.includes(":")?t[r]=e[r]:null==(n=e[r].chains)||n.forEach(n=>{t[n]={methods:e[r].methods,events:e[r].events}})}),t}(e),s=function(e){let t={};return Object.keys(e).forEach(r=>{if(r.includes(":"))t[r]=e[r];else{let n=aJ(e[r].accounts);n?.forEach(n=>{t[n]={accounts:e[r].accounts.filter(e=>e.includes(`${n}:`)),methods:e[r].methods,events:e[r].events}})}}),t}(t),o=Object.keys(i),a=Object.keys(s),l=ll(Object.keys(e)),c=ll(Object.keys(t)),u=l.filter(e=>!c.includes(e));return u.length&&(n=a6("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces. 52 Required: ${u.toString()} 53 Received: ${Object.keys(t).toString()}`)),no(o,a)||(n=a6("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces. 54 Required: ${o.toString()} 55 Approved: ${a.toString()}`)),Object.keys(t).forEach(e=>{if(!e.includes(":")||n)return;let i=aJ(t[e].accounts);i.includes(e)||(n=a6("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${e} 56 Required: ${e} 57 Approved: ${i.toString()}`))}),o.forEach(e=>{n||(no(i[e].methods,s[e].methods)?no(i[e].events,s[e].events)||(n=a6("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${e}`)):n=a6("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${e}`))}),n}function ll(e){return[...new Set(e.map(e=>e.includes(":")?e.split(":")[0]:e))]}function lc(){let e=nr();return new Promise(t=>{switch(e){case r9.browser:t(nt()&&navigator?.onLine);break;case r9.reactNative:t(lu());break;case r9.node:default:t(!0)}})}async function lu(){if(ne()&&"u">typeof global&&null!=global&&global.NetInfo){let e=await (null==global?void 0:global.NetInfo.fetch());return e?.isConnected}return!0}let lf={};class lh{static get(e){return lf[e]}static set(e,t){lf[e]=t}static delete(e){delete lf[e]}}function ld(e){return new Uint8Array(e.replace(/^0x/,"").match(/.{1,2}/g).map(e=>parseInt(e,16)))}function lp({logger:e,name:t}){let r="string"==typeof e?ep({opts:{level:e,name:t}}).logger:e;return r.level="string"==typeof e?e:e.level,r}var lg=r(65657),ly=r(40),lm=r(35575),lb=r(9109).Buffer,lw=r(25566);let lv="core",lE=`wc@2:${lv}:`,lx={logger:"error"},l_={database:":memory:"},lA="client_ed25519_seed",lS=ej.ONE_DAY,lI=ej.SIX_HOURS,lO="wss://relay.walletconnect.org",lP={message:"relayer_message",message_ack:"relayer_message_ack",connect:"relayer_connect",disconnect:"relayer_disconnect",error:"relayer_error",connection_stalled:"relayer_connection_stalled",publish:"relayer_publish"},lC={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},lk="2.22.4",lT={link_mode:"link_mode",relay:"relay"},lB={inbound:"inbound",outbound:"outbound"},lR="WALLETCONNECT_LINK_MODE_APPS",lD={created:"subscription_created",deleted:"subscription_deleted",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},lU=(ej.FIVE_SECONDS,{wc_pairingDelete:{req:{ttl:ej.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:ej.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:ej.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:ej.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:ej.ONE_DAY,prompt:!1,tag:0},res:{ttl:ej.ONE_DAY,prompt:!1,tag:0}}}),lM={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},lN={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},lj={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},lL="https://verify.walletconnect.org",l$=`${lL}/v3`,lz=["https://verify.walletconnect.com",lL],lF={pairing_started:"pairing_started",pairing_uri_validation_success:"pairing_uri_validation_success",pairing_uri_not_expired:"pairing_uri_not_expired",store_new_pairing:"store_new_pairing",subscribing_pairing_topic:"subscribing_pairing_topic",subscribe_pairing_topic_success:"subscribe_pairing_topic_success",existing_pairing:"existing_pairing",pairing_not_expired:"pairing_not_expired",emit_inactive_pairing:"emit_inactive_pairing",emit_session_proposal:"emit_session_proposal"},lq={no_internet_connection:"no_internet_connection",malformed_pairing_uri:"malformed_pairing_uri",active_pairing_already_exists:"active_pairing_already_exists",subscribe_pairing_topic_failure:"subscribe_pairing_topic_failure",pairing_expired:"pairing_expired",proposal_listener_not_found:"proposal_listener_not_found"},lW={session_approve_started:"session_approve_started",session_namespaces_validation_success:"session_namespaces_validation_success",subscribing_session_topic:"subscribing_session_topic",subscribe_session_topic_success:"subscribe_session_topic_success",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",session_request_response_started:"session_request_response_started",session_request_response_validation_success:"session_request_response_validation_success",session_request_response_publish_started:"session_request_response_publish_started"},lV={no_internet_connection:"no_internet_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found",session_request_response_validation_failure:"session_request_response_validation_failure",session_request_response_publish_failure:"session_request_response_publish_failure"},lH={authenticated_session_approve_started:"authenticated_session_approve_started",create_authenticated_session_topic:"create_authenticated_session_topic",cacaos_verified:"cacaos_verified",store_authenticated_session:"store_authenticated_session",subscribing_authenticated_session_topic:"subscribing_authenticated_session_topic",subscribe_authenticated_session_topic_success:"subscribe_authenticated_session_topic_success",publishing_authenticated_session_approve:"publishing_authenticated_session_approve"}
57,lG={no_internet_connection:"no_internet_connection",invalid_cacao:"invalid_cacao",subscribe_authenticated_session_topic_failure:"subscribe_authenticated_session_topic_failure",authenticated_session_approve_publish_failure:"authenticated_session_approve_publish_failure",authenticated_session_pending_request_not_found:"authenticated_session_pending_request_not_found"};var lK=function(e,t){if(e.length>=255)throw TypeError("Alphabet too long");for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<e.length;i++){var s=e.charAt(i),o=s.charCodeAt(0);if(255!==r[o])throw TypeError(s+" is ambiguous");r[o]=i}var a=e.length,l=e.charAt(0),c=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function f(e){if("string"!=typeof e)throw TypeError("Expected String");if(0===e.length)return new Uint8Array;var t=0;if(" "!==e[0]){for(var n=0,i=0;e[t]===l;)n++,t++;for(var s=(e.length-t)*c+1>>>0,o=new Uint8Array(s);e[t];){var u=r[e.charCodeAt(t)];if(255===u)return;for(var f=0,h=s-1;(0!==u||f<i)&&-1!==h;h--,f++)u+=a*o[h]>>>0,o[h]=u%256>>>0,u=u/256>>>0;if(0!==u)throw Error("Non-zero carry");i=f,t++}if(" "!==e[t]){for(var d=s-i;d!==s&&0===o[d];)d++;for(var p=new Uint8Array(n+(s-d)),g=n;d!==s;)p[g++]=o[d++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,i=0,s=t.length;i!==s&&0===t[i];)i++,r++;for(var o=(s-i)*u+1>>>0,c=new Uint8Array(o);i!==s;){for(var f=t[i],h=0,d=o-1;(0!==f||h<n)&&-1!==d;d--,h++)f+=256*c[d]>>>0,c[d]=f%a>>>0,f=f/a>>>0;if(0!==f)throw Error("Non-zero carry");n=h,i++}for(var p=o-n;p!==o&&0===c[p];)p++;for(var g=l.repeat(r);p<o;++p)g+=e.charAt(c[p]);return g},decodeUnsafe:f,decode:function(e){var r=f(e);if(r)return r;throw Error(`Non-${t} character`)}}};let lZ=e=>{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw Error("Unknown type, must be binary type")},lJ=e=>new TextEncoder().encode(e),lY=e=>new TextDecoder().decode(e);class lX{constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class lQ{constructor(e,t,r){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=r}decode(e){if("string"==typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return l1(this,e)}}class l0{constructor(e){this.decoders=e}or(e){return l1(this,e)}decode(e){let t=e[0],r=this.decoders[t];if(r)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}let l1=(e,t)=>new l0({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class l2{constructor(e,t,r,n){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new lX(e,t,r),this.decoder=new lQ(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}let l6=({name:e,prefix:t,encode:r,decode:n})=>new l2(e,t,r,n),l5=({prefix:e,name:t,alphabet:r})=>{let{encode:n,decode:i}=lK(r,t);return l6({prefix:e,name:t,encode:n,decode:e=>lZ(i(e))})},l8=(e,t,r,n)=>{let i={};for(let e=0;e<t.length;++e)i[t[e]]=e;let s=e.length;for(;"="===e[s-1];)--s;let o=new Uint8Array(s*r/8|0),a=0,l=0,c=0;for(let t=0;t<s;++t){let s=i[e[t]];if(void 0===s)throw SyntaxError(`Non-${n} character`);l=l<<r|s,(a+=r)>=8&&(a-=8,o[c++]=255&l>>a)}if(a>=r||255&l<<8-a)throw SyntaxError("Unexpected end of data");return o},l3=(e,t,r)=>{let n="="===t[t.length-1],i=(1<<r)-1,s="",o=0,a=0;for(let n=0;n<e.length;++n)for(a=a<<8|e[n],o+=8;o>r;)o-=r,s+=t[i&a>>o];if(o&&(s+=t[i&a<<r-o]),n)for(;s.length*r&7;)s+="=";return s},l4=({name:e,prefix:t,bitsPerChar:r,alphabet:n})=>l6({prefix:t,name:e,encode:e=>l3(e,n,r),decode:t=>l8(t,n,r,e)});var l9=Object.freeze({__proto__:null,identity:l6({prefix:"\0",name:"identity",encode:e=>lY(e),decode:e=>lJ(e)})}),l7=Object.freeze({__proto__:null,base2:l4({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})}),ce=Object.freeze({__proto__:null,base8:l4({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})}),ct=Object.freeze({__proto__:null,base10:l5({prefix:"9",name:"base10",alphabet:"0123456789"})}),cr=Object.freeze({__proto__:null,base16:l4({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),base16upper:l4({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});let cn=l4({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ci=l4({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),cs=l4({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),co=l4({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),ca=l4({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),cl=l4({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5});var cc=Object.freeze({__proto__:null,base32:cn,base32upper:ci,base32pad:cs,base32padupper:co,base32hex:ca,base32hexupper:cl,base32hexpad:l4({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),base32hexpadupper:l4({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),base32z:l4({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})}),cu=Object.freeze({__proto__:null,base36:l5({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),base36upper:l5({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})}),cf=Object.freeze({__proto__:null,base58btc:l5({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),base58flickr:l5({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});let ch=l4({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
57+/",bitsPerChar:6});var cd=Object.freeze({__proto__:null,base64:ch,base64pad:l4({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),base64url:l4({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),base64urlpad:l4({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});let cp=Array.from("\uD83D\uDE80\uD83E\uDE90â\uD83D\uDEF0\uD83C\uDF0C\uD83C\uDF11\uD83C\uDF12\uD83C\uDF13\uD83C\uDF14\uD83C\uDF15\uD83C\uDF16\uD83C\uDF17\uD83C\uDF18\uD83C\uDF0D\uD83C\uDF0F\uD83C\uDF0E\uD83D\uDC09â\uD83D\uDCBB\uD83D\uDDA5\uD83D\uDCBE\uD83D\uDCBF\uD83D\uDE02â¤\uD83D\uDE0D\uD83E\uDD23\uD83D\uDE0A\uD83D\uDE4F\uD83D\uDC95\uD83D\uDE2D\uD83D\uDE18\uD83D\uDC4D\uD83D\uDE05\uD83D\uDC4F\uD83D\uDE01\uD83D\uDD25\uD83E\uDD70\uD83D\uDC94\uD83D\uDC96\uD83D\uDC99\uD83D\uDE22\uD83E\uDD14\uD83D\uDE06\uD83D\uDE44\uD83D\uDCAA\uD83D\uDE09âº\uD83D\uDC4C\uD83E\uDD17\uD83D\uDC9C\uD83D\uDE14\uD83D\uDE0E\uD83D\uDE07\uD83C\uDF39\uD83E\uDD26\uD83C\uDF89\uD83D\uDC9Eââ¨\uD83E\uDD37\uD83D\uDE31\uD83D\uDE0C\uD83C\uDF38\uD83D\uDE4C\uD83D\uDE0B\uD83D\uDC97\uD83D\uDC9A\uD83D\uDE0F\uD83D\uDC9B\uD83D\uDE42\uD83D\uDC93\uD83E\uDD29\uD83D\uDE04\uD83D\uDE00\uD83D\uDDA4\uD83D\uDE03\uD83D\uDCAF\uD83D\uDE48\uD83D\uDC47\uD83C\uDFB6\uD83D\uDE12\uD83E\uDD2Dâ£\uD83D\uDE1C\uD83D\uDC8B\uD83D\uDC40\uD83D\uDE2A\uD83D\uDE11\uD83D\uDCA5\uD83D\uDE4B\uD83D\uDE1E\uD83D\uDE29\uD83D\uDE21\uD83E\uDD2A\uD83D\uDC4A\uD83E\uDD73\uD83D\uDE25\uD83E\uDD24\uD83D\uDC49\uD83D\uDC83\uD83D\uDE33â\uD83D\uDE1A\uD83D\uDE1D\uD83D\uDE34\uD83C\uDF1F\uD83D\uDE2C\uD83D\uDE43\uD83C\uDF40\uD83C\uDF37\uD83D\uDE3B\uD83D\uDE13ââ
\uD83E\uDD7A\uD83C\uDF08\uD83D\uDE08\uD83E\uDD18\uD83D\uDCA6â\uD83D\uDE23\uD83C\uDFC3\uD83D\uDC90â¹\uD83C\uDF8A\uD83D\uDC98\uD83D\uDE20â\uD83D\uDE15\uD83C\uDF3A\uD83C\uDF82\uD83C\uDF3B\uD83D\uDE10\uD83D\uDD95\uD83D\uDC9D\uD83D\uDE4A\uD83D\uDE39\uD83D\uDDE3\uD83D\uDCAB\uD83D\uDC80\uD83D\uDC51\uD83C\uDFB5\uD83E\uDD1E\uD83D\uDE1B\uD83D\uDD34\uD83D\uDE24\uD83C\uDF3C\uD83D\uDE2Bâ½\uD83E\uDD19â\uD83C\uDFC6\uD83E\uDD2B\uD83D\uDC48\uD83D\uDE2E\uD83D\uDE46\uD83C\uDF7B\uD83C\uDF43\uD83D\uDC36\uD83D\uDC81\uD83D\uDE32\uD83C\uDF3F\uD83E\uDDE1\uD83C\uDF81â¡\uD83C\uDF1E\uD83C\uDF88ââ\uD83D\uDC4B\uD83D\uDE30\uD83E\uDD28\uD83D\uDE36\uD83E\uDD1D\uD83D\uDEB6\uD83D\uDCB0\uD83C\uDF53\uD83D\uDCA2\uD83E\uDD1F\uD83D\uDE41\uD83D\uDEA8\uD83D\uDCA8\uD83E\uDD2Câ\uD83C\uDF80\uD83C\uDF7A\uD83E\uDD13\uD83D\uDE19\uD83D\uDC9F\uD83C\uDF31\uD83D\uDE16\uD83D\uDC76\uD83E\uDD74â¶â¡â\uD83D\uDC8E\uD83D\uDCB8â¬\uD83D\uDE28\uD83C\uDF1A\uD83E\uDD8B\uD83D\uDE37\uD83D\uDD7Aâ \uD83D\uDE45\uD83D\uDE1F\uD83D\uDE35\uD83D\uDC4E\uD83E\uDD32\uD83E\uDD20\uD83E\uDD27\uD83D\uDCCC\uD83D\uDD35\uD83D\uDC85\uD83E\uDDD0\uD83D\uDC3E\uD83C\uDF52\uD83D\uDE17\uD83E\uDD11\uD83C\uDF0A\uD83E\uDD2F\uD83D\uDC37â\uD83D\uDCA7\uD83D\uDE2F\uD83D\uDC86\uD83D\uDC46\uD83C\uDFA4\uD83D\uDE47\uD83C\uDF51â\uD83C\uDF34\uD83D\uDCA3\uD83D\uDC38\uD83D\uDC8C\uD83D\uDCCD\uD83E\uDD40\uD83E\uDD22\uD83D\uDC45\uD83D\uDCA1\uD83D\uDCA9\uD83D\uDC50\uD83D\uDCF8\uD83D\uDC7B\uD83E\uDD10\uD83E\uDD2E\uD83C\uDFBC\uD83E\uDD75\uD83D\uDEA9\uD83C\uDF4E\uD83C\uDF4A\uD83D\uDC7C\uD83D\uDC8D\uD83D\uDCE3\uD83E\uDD42"),cg=cp.reduce((e,t,r)=>(e[r]=t,e),[]),cy=cp.reduce((e,t,r)=>(e[t.codePointAt(0)]=r,e),[]);var cm=Object.freeze({__proto__:null,base256emoji:l6({prefix:"\uD83D\uDE80",name:"base256emoji",encode:function(e){return e.reduce((e,t)=>e+=cg[t],"")},decode:function(e){let t=[];for(let r of e){let e=cy[r.codePointAt(0)];if(void 0===e)throw Error(`Non-base256emoji character: ${r}`);t.push(e)}return new Uint8Array(t)}})});function cb(e,t){var r,n=0,t=t||0,i=0,s=t,o=e.length;do{if(s>=o)throw cb.bytes=0,RangeError("Could not decode varint");r=e[s++],n+=i<28?(127&r)<<i:(127&r)*Math.pow(2,i),i+=7}while(r>=128);return cb.bytes=s-t,n}var cw=function e(t,r,n){r=r||[],n=n||0;for(var i=n;t>=2147483648;)r[n++]=255&t|128,t/=128;for(;-128&t;)r[n++]=255&t|128,t>>>=7;return r[n]=0|t,e.bytes=n-i+1,r};let cv=(e,t,r=0)=>(cw(e,t,r),t),cE=e=>e<128?1:e<16384?2:e<2097152?3:e<268435456?4:e<34359738368?5:e<4398046511104?6:e<562949953421312?7:e<72057594037927940?8:e<0x7fffffffffffffff?9:10,cx=(e,t)=>{let r=t.byteLength,n=cE(e),i=n+cE(r),s=new Uint8Array(i+r);return cv(e,s,0),cv(r,s,n),s.set(t,i),new c_(e,r,t,s)};
57class c_{constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}}let cA=({name:e,code:t,encode:r})=>new cS(e,t,r);class cS{constructor(e,t,r){this.name=e,this.code=t,this.encode=r}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?cx(this.code,t):t.then(e=>cx(this.code,e))}throw Error("Unknown type, must be binary type")}}let cI=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t));var cO=Object.freeze({__proto__:null,sha256:cA({name:"sha2-256",code:18,encode:cI("SHA-256")}),sha512:cA({name:"sha2-512",code:19,encode:cI("SHA-512")})}),cP=Object.freeze({__proto__:null,identity:{code:0,name:"identity",encode:lZ,digest:e=>cx(0,lZ(e))}});new TextEncoder,new TextDecoder;let cC={...l9,...l7,...ce,...ct,...cr,...cc,...cu,...cf,...cd,...cm};function ck(e){return null!=globalThis.Buffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}function cT(e,t,r,n){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:n}}}({...cO,...cP});let cB=cT("utf8","u",e=>"u"+new TextDecoder("utf8").decode(e),e=>new TextEncoder().encode(e.substring(1))),cR=cT("ascii","a",e=>{let t="a";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},e=>{let t=function(e=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?ck(globalThis.Buffer.allocUnsafe(e)):new Uint8Array(e)}((e=e.substring(1)).length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}),cD={utf8:cB,"utf-8":cB,hex:cC.base16,latin1:cR,ascii:cR,binary:cR,...cC};var cU=Object.defineProperty,cM=(e,t,r)=>t in e?cU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,cN=(e,t,r)=>cM(e,"symbol"!=typeof t?t+"":t,r);class cj{constructor(e,t){this.core=e,this.logger=t,cN(this,"keychain",new Map),cN(this,"name","keychain"),cN(this,"version","0.3"),cN(this,"initialized",!1),cN(this,"storagePrefix",lE),cN(this,"init",async()=>{if(!this.initialized){let e=await this.getKeyChain();"u">typeof e&&(this.keychain=e),this.initialized=!0}}),cN(this,"has",e=>(this.isInitialized(),this.keychain.has(e))),cN(this,"set",async(e,t)=>{this.isInitialized(),this.keychain.set(e,t),await this.persist()}),cN(this,"get",e=>{this.isInitialized();let t=this.keychain.get(e);if(typeof t>"u"){let{message:t}=a6("NO_MATCHING_KEY",`${this.name}: ${e}`);throw Error(t)}return t}),cN(this,"del",async e=>{this.isInitialized(),this.keychain.delete(e),await this.persist()}),this.core=e,this.logger=ed(t,this.name)}get context(){return eh(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,na(e))}async getKeyChain(){let e=await this.core.storage.getItem(this.storageKey);return"u">typeof e?nl(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){let{message:e}=a6("NOT_INITIALIZED",this.name);throw Error(e)}}}var cL=Object.defineProperty,c$=(e,t,r)=>t in e?cL(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,cz=(e,t,r)=>c$(e,"symbol"!=typeof t?t+"":t,r);class cF{constructor(e,t,r){this.core=e,this.logger=t,cz(this,"name","crypto"),cz(this,"keychain"),cz(this,"randomSessionIdentifier",am()),cz(this,"initialized",!1),cz(this,"clientId"),cz(this,"init",async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)}),cz(this,"hasKeys",e=>(this.isInitialized(),this.keychain.has(e))),cz(this,"getClientId",async()=>{if(this.isInitialized(),this.clientId)return this.clientId;let e=await this.getClientSeed(),t=eL.Au(e),r=eL.bG(t.publicKey);return this.clientId=r,r}),cz(this,"generateKeyPair",()=>{this.isInitialized();let e=function(){let e=o0.utils.randomPrivateKey(),t=o0.getPublicKey(e);return{privateKey:rV(e,ad),publicKey:rV(t,ad)}}();return this.setPrivateKey(e.publicKey,e.privateKey)}),cz(this,"signJWT",async e=>{this.isInitialized();let t=await this.getClientSeed(),r=eL.Au(t),n=this.randomSessionIdentifier;return await eL.vf(n,e,lS,r)}),cz(this,"generateSharedKey",(e,t,r)=>{var n;this.isInitialized();let i=(n=this.getPrivateKey(e),rV(sQ(iW,o0.getSharedSecret(rW(n,ad),rW(t,ad)),void 0,void 0,32),ad));return this.setSymKey(i,r)}),cz(this,"setSymKey",async(e,t)=>{this.isInitialized();let r=t||ab(e);return await this.keychain.set(r,e),r}),cz(this,"deleteKeyPair",async e=>{this.isInitialized(),await this.keychain.del(e)}),cz(this,"deleteSymKey",async e=>{this.isInitialized(),await this.keychain.del(e)}),cz(this,"encode",async(e,t,r)=>{this.isInitialized();let n=aS(r),i=(0,N.u)(t);if(2===n.type)return function(e,t){let r=rW("2",ah),n=iu(12),i=a_({type:r,sealed:rW(e,ay),iv:n});return t===ag?aE(i):i}(i,r?.encoding);
57if(aI(n)){let t=n.senderPublicKey,r=n.receiverPublicKey;e=await this.generateSharedKey(t,r)}let s=this.getSymKey(e),{type:o,senderPublicKey:a}=n;return function(e){var t;let r=(t="u">typeof e.type?e.type:0,rW(`${t}`,ah));if(1===av(r)&&typeof e.senderPublicKey>"u")throw Error("Missing sender public key for type 1 envelope");let n="u">typeof e.senderPublicKey?rW(e.senderPublicKey,ad):void 0,i="u">typeof e.iv?rW(e.iv,ad):iu(12),s=a_({type:r,sealed:sK(rW(e.symKey,ad),i).encrypt(rW(e.message,ay)),iv:i,senderPublicKey:n});return e.encoding===ag?aE(s):s}({type:o,symKey:s,message:i,senderPublicKey:a,encoding:r?.encoding})}),cz(this,"decode",async(e,t,r)=>{this.isInitialized();let n=function(e,t){let r=aA({encoded:e,encoding:t?.encoding});return aS({type:av(r.type),senderPublicKey:"u">typeof r.senderPublicKey?rV(r.senderPublicKey,ad):void 0,receiverPublicKey:t?.receiverPublicKey})}(t,r);if(2===n.type){let e=function(e,t){let{sealed:r}=aA({encoded:e,encoding:t});return rV(r,ay)}(t,r?.encoding);return(0,N.D)(e)}if(aI(n)){let t=n.receiverPublicKey,r=n.senderPublicKey;e=await this.generateSharedKey(t,r)}try{let n=this.getSymKey(e),i=function(e){let t=rW(e.symKey,ad),{sealed:r,iv:n}=aA({encoded:e.encoded,encoding:e.encoding}),i=sK(t,n).decrypt(r);if(null===i)throw Error("Failed to decrypt");return rV(i,ay)}({symKey:n,encoded:t,encoding:r?.encoding});return(0,N.D)(i)}catch(t){this.logger.error(`Failed to decode message from topic: '${e}', clientId: '${await this.getClientId()}'`),this.logger.error(t)}}),cz(this,"getPayloadType",(e,t=ap)=>av(aA({encoded:e,encoding:t}).type)),cz(this,"getPayloadSenderPublicKey",(e,t=ap)=>{let r=aA({encoded:e,encoding:t});return r.senderPublicKey?rV(r.senderPublicKey,ad):void 0}),this.core=e,this.logger=ed(t,this.name),this.keychain=r||new cj(this.core,this.logger)}get context(){return eh(this.logger)}async setPrivateKey(e,t){return await this.keychain.set(e,t),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(lA)}catch{e=am(),await this.keychain.set(lA,e)}return function(e,t="utf8"){let r=cD[t];if(!r)throw Error(`Unsupported encoding "${t}"`);return("utf8"===t||"utf-8"===t)&&null!=globalThis.Buffer&&null!=globalThis.Buffer.from?ck(globalThis.Buffer.from(e,"utf-8")):r.decoder.decode(`${r.prefix}${e}`)}(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){let{message:e}=a6("NOT_INITIALIZED",this.name);throw Error(e)}}}var cq=Object.defineProperty,cW=Object.defineProperties,cV=Object.getOwnPropertyDescriptors,cH=Object.getOwnPropertySymbols,cG=Object.prototype.hasOwnProperty,cK=Object.prototype.propertyIsEnumerable,cZ=(e,t,r)=>t in e?cq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,cJ=(e,t)=>{for(var r in t||(t={}))cG.call(t,r)&&cZ(e,r,t[r]);if(cH)for(var r of cH(t))cK.call(t,r)&&cZ(e,r,t[r]);return e},cY=(e,t)=>cW(e,cV(t)),cX=(e,t,r)=>cZ(e,"symbol"!=typeof t?t+"":t,r);class cQ extends eA{constructor(e,t){super(e,t),this.logger=e,this.core=t,cX(this,"messages",new Map),cX(this,"messagesWithoutClientAck",new Map),cX(this,"name","messages"),cX(this,"version","0.3"),cX(this,"initialized",!1),cX(this,"storagePrefix",lE),cX(this,"init",async()=>{if(!this.initialized){this.logger.trace("Initialized");try{let e=await this.getRelayerMessages();"u">typeof e&&(this.messages=e);let t=await this.getRelayerMessagesWithoutClientAck();"u">typeof t&&(this.messagesWithoutClientAck=t),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}finally{this.initialized=!0}}}),cX(this,"set",async(e,t,r)=>{this.isInitialized();let n=aw(t),i=this.messages.get(e);if(typeof i>"u"&&(i={}),"u">typeof i[n])return n;if(i[n]=t,this.messages.set(e,i),r===lB.inbound){let r=this.messagesWithoutClientAck.get(e)||{};this.messagesWithoutClientAck.set(e,cY(cJ({},r),{[n]:t}))}return await this.persist(),n}),cX(this,"get",e=>{this.isInitialized();let t=this.messages.get(e);return typeof t>"u"&&(t={}),t}),cX(this,"getWithoutAck",e=>{this.isInitialized();let t={};for(let r of e){let e=this.messagesWithoutClientAck.get(r)||{};t[r]=Object.values(e)}return t}),cX(this,"has",(e,t)=>(this.isInitialized(),"u">typeof this.get(e)[aw(t)])),cX(this,"ack",async(e,t)=>{this.isInitialized();let r=this.messagesWithoutClientAck.get(e);if(typeof r>"u")return;let n=aw(t);delete r[n],0===Object.keys(r).length?this.messagesWithoutClientAck.delete(e):this.messagesWithoutClientAck.set(e,r),await this.persist()}),cX(this,"del",async e=>{this.isInitialized(),this.messages.delete(e),this.messagesWithoutClientAck.delete(e),await this.persist()}),this.logger=ed(e,this.name),this.core=t}
57get context(){return eh(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get storageKeyWithoutClientAck(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name+"_withoutClientAck"}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,na(e))}async setRelayerMessagesWithoutClientAck(e){await this.core.storage.setItem(this.storageKeyWithoutClientAck,na(e))}async getRelayerMessages(){let e=await this.core.storage.getItem(this.storageKey);return"u">typeof e?nl(e):void 0}async getRelayerMessagesWithoutClientAck(){let e=await this.core.storage.getItem(this.storageKeyWithoutClientAck);return"u">typeof e?nl(e):void 0}async persist(){await this.setRelayerMessages(this.messages),await this.setRelayerMessagesWithoutClientAck(this.messagesWithoutClientAck)}isInitialized(){if(!this.initialized){let{message:e}=a6("NOT_INITIALIZED",this.name);throw Error(e)}}}var c0=Object.defineProperty,c1=Object.defineProperties,c2=Object.getOwnPropertyDescriptors,c6=Object.getOwnPropertySymbols,c5=Object.prototype.hasOwnProperty,c8=Object.prototype.propertyIsEnumerable,c3=(e,t,r)=>t in e?c0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,c4=(e,t)=>{for(var r in t||(t={}))c5.call(t,r)&&c3(e,r,t[r]);if(c6)for(var r of c6(t))c8.call(t,r)&&c3(e,r,t[r]);return e},c9=(e,t)=>c1(e,c2(t)),c7=(e,t,r)=>c3(e,"symbol"!=typeof t?t+"":t,r);class ue extends eS{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,c7(this,"events",new B.EventEmitter),c7(this,"name","publisher"),c7(this,"queue",new Map),c7(this,"publishTimeout",(0,ej.toMiliseconds)(ej.ONE_MINUTE)),c7(this,"initialPublishTimeout",(0,ej.toMiliseconds)(15*ej.ONE_SECOND)),c7(this,"needsTransportRestart",!1),c7(this,"publish",async(e,t,r)=>{var n,i,s,o,a;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:e,message:t,opts:r}});let l=r?.ttl||lI,c=r?.prompt||!1,u=r?.tag||0,f=r?.id||(0,ly.getBigIntRpcId)().toString(),h=aP(aO().protocol),d={id:f,method:r?.publishMethod||h.publish,params:c4({topic:e,message:t,ttl:l,prompt:c,tag:u,attestation:r?.attestation},r?.tvf)},p=`Failed to publish payload, please try again. id:${f} tag:${u}`;try{a4(null==(n=d.params)?void 0:n.prompt)&&(null==(i=d.params)||delete i.prompt),a4(null==(s=d.params)?void 0:s.tag)&&(null==(o=d.params)||delete o.tag);let a=new Promise(async e=>{let t=({id:r})=>{var n;(null==(n=d.id)?void 0:n.toString())===r.toString()&&(this.removeRequestFromQueue(r),this.relayer.events.removeListener(lP.publish,t),e())};this.relayer.events.on(lP.publish,t);let n=nu(new Promise((e,t)=>{this.rpcPublish(d,r).then(e).catch(e=>{this.logger.warn(e,e?.message),t(e)})}),this.initialPublishTimeout,`Failed initial publish, retrying.... id:${f} tag:${u}`);try{await n,this.events.removeListener(lP.publish,t)}catch(e){this.queue.set(f,{request:d,opts:r,attempt:1}),this.logger.warn(e,e?.message)}});this.logger.trace({type:"method",method:"publish",params:{id:f,topic:e,message:t,opts:r}}),await nu(a,this.publishTimeout,p)}catch(e){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(e),null!=(a=r?.internal)&&a.throwOnFailedPublish)throw e}finally{this.queue.delete(f)}}),c7(this,"publishCustom",async e=>{var t,r,n,i,s;this.logger.debug("Publishing custom payload"),this.logger.trace({type:"method",method:"publishCustom",params:e});let{payload:o,opts:a={}}=e,{attestation:l,tvf:c,publishMethod:u,prompt:f,tag:h,ttl:d=ej.FIVE_MINUTES}=a,p=a.id||(0,ly.getBigIntRpcId)().toString(),g=aP(aO().protocol),y=u||g.publish,m={id:p,method:y,params:c4(c9(c4({},o),{ttl:d,prompt:f,tag:h,attestation:l}),c)},b=`Failed to publish custom payload, please try again. id:${p} tag:${h}`;try{a4(null==(t=m.params)?void 0:t.prompt)&&(null==(r=m.params)||delete r.prompt),a4(null==(n=m.params)?void 0:n.tag)&&(null==(i=m.params)||delete i.tag);let e=new Promise(async e=>{let t=({id:r})=>{var n;(null==(n=m.id)?void 0:n.toString())===r.toString()&&(this.removeRequestFromQueue(r),this.relayer.events.removeListener(lP.publish,t),e())};this.relayer.events.on(lP.publish,t);let r=nu(new Promise((e,t)=>
57{this.rpcPublish(m,a).then(e).catch(e=>{this.logger.warn(e,e?.message),t(e)})}),this.initialPublishTimeout,`Failed initial custom payload publish, retrying.... method:${y} id:${p} tag:${h}`);try{await r,this.events.removeListener(lP.publish,t)}catch(e){this.queue.set(p,{request:m,opts:a,attempt:1}),this.logger.warn(e,e?.message)}});this.logger.trace({type:"method",method:"publish",params:{id:p,payload:o,opts:a}}),await nu(e,this.publishTimeout,b)}catch(e){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(e),null!=(s=a?.internal)&&s.throwOnFailedPublish)throw e}finally{this.queue.delete(p)}}),c7(this,"on",(e,t)=>{this.events.on(e,t)}),c7(this,"once",(e,t)=>{this.events.once(e,t)}),c7(this,"off",(e,t)=>{this.events.off(e,t)}),c7(this,"removeListener",(e,t)=>{this.events.removeListener(e,t)}),this.relayer=e,this.logger=ed(t,this.name),this.registerEventListeners()}get context(){return eh(this.logger)}async rpcPublish(e,t){this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:e});let r=await this.relayer.request(e);return this.relayer.events.emit(lP.publish,c4(c4({},e),t)),this.logger.debug("Successfully Published Payload"),r}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async(e,t)=>{var r;let n=e.attempt+1;this.queue.set(t,c9(c4({},e),{attempt:n})),this.logger.warn({},`Publisher: queue->publishing: ${e.request.id}, tag: ${null==(r=e.request.params)?void 0:r.tag}, attempt: ${n}`),await this.rpcPublish(e.request,e.opts),this.logger.warn({},`Publisher: queue->published: ${e.request.id}`)})}registerEventListeners(){this.relayer.core.heartbeat.on(R.Lx.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(lP.connection_stalled);return}this.checkQueue()}),this.relayer.on(lP.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}var ut=Object.defineProperty,ur=(e,t,r)=>t in e?ut(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,un=(e,t,r)=>ur(e,"symbol"!=typeof t?t+"":t,r);class ui{constructor(){un(this,"map",new Map),un(this,"set",(e,t)=>{let r=this.get(e);this.exists(e,t)||this.map.set(e,[...r,t])}),un(this,"get",e=>this.map.get(e)||[]),un(this,"exists",(e,t)=>this.get(e).includes(t)),un(this,"delete",(e,t)=>{if(typeof t>"u"){this.map.delete(e);return}if(!this.map.has(e))return;let r=this.get(e);if(!this.exists(e,t))return;let n=r.filter(e=>e!==t);if(!n.length){this.map.delete(e);return}this.map.set(e,n)}),un(this,"clear",()=>{this.map.clear()})}get topics(){return Array.from(this.map.keys())}}var us=Object.defineProperty,uo=Object.defineProperties,ua=Object.getOwnPropertyDescriptors,ul=Object.getOwnPropertySymbols,uc=Object.prototype.hasOwnProperty,uu=Object.prototype.propertyIsEnumerable,uf=(e,t,r)=>t in e?us(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,uh=(e,t)=>{for(var r in t||(t={}))uc.call(t,r)&&uf(e,r,t[r]);if(ul)for(var r of ul(t))uu.call(t,r)&&uf(e,r,t[r]);return e},ud=(e,t)=>uo(e,ua(t)),up=(e,t,r)=>uf(e,"symbol"!=typeof t?t+"":t,r);class ug extends eP{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,up(this,"subscriptions",new Map),up(this,"topicMap",new ui),up(this,"events",new B.EventEmitter),up(this,"name","subscription"),up(this,"version","0.3"),up(this,"pending",new Map),up(this,"cached",[]),up(this,"initialized",!1),up(this,"storagePrefix",lE),up(this,"subscribeTimeout",(0,ej.toMiliseconds)(ej.ONE_MINUTE)),up(this,"initialSubscribeTimeout",(0,ej.toMiliseconds)(15*ej.ONE_SECOND)),up(this,"clientId"),up(this,"batchSubscribeTopicsLimit",500),up(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),await this.restore()),this.initialized=!0}),up(this,"subscribe",async(e,t)=>{var r;this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:e,opts:t}});try{let n=aO(t),i={topic:e,relay:n,transportType:t?.transportType};null!=(r=t?.internal)&&r.skipSubscribe||this.pending.set(e,i);let s=await this.rpcSubscribe(e,n,t);return"string"==typeof s&&(this.onSubscribe(s,i),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:e,opts:t}})),s}catch(e){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(e),e}}),up(this,"unsubscribe",async(e,t)=>{this.isInitialized(),"u">typeof t?.id?await this.unsubscribeById(e,t.id,t):await this.unsubscribeByTopic(e,t)}),up(this,"isSubscribed",e=>new Promise(t=>{t(this.topicMap.topics.includes(e))})),up(this,"isKnownTopic",e=>new Promise(t=>{t(this.topicMap.topics.includes(e)||this.pending.has(e)||this.cached.some(t=>t.topic===e))})),up(this,"on",(e,t)=>{this.events.on(e,t)}),up(this,"once",(e,t)=>{this.events.once(e,t)}),up(this,"off",(e,t)=>{this.events.off(e,t)}),up(this,"removeListener",(e,t)=>{this.events.removeListener(e,t)}),up(this,"start",async()=>{await this.onConnect()}),up(this,"stop",async()=>{await this.onDisconnect()}),up(this,"restart",async()=>
57{await this.restore(),await this.onRestart()}),up(this,"checkPending",async()=>{if(0===this.pending.size&&(!this.initialized||!this.relayer.connected))return;let e=[];this.pending.forEach(t=>{e.push(t)}),await this.batchSubscribe(e)}),up(this,"registerEventListeners",()=>{this.relayer.core.heartbeat.on(R.Lx.pulse,async()=>{await this.checkPending()}),this.events.on(lD.created,async e=>{let t=lD.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()}),this.events.on(lD.deleted,async e=>{let t=lD.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()})}),this.relayer=e,this.logger=ed(t,this.name),this.clientId=""}get context(){return eh(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.relayer.core.customStoragePrefix+"//"+this.name}get length(){return this.subscriptions.size}get ids(){return Array.from(this.subscriptions.keys())}get values(){return Array.from(this.subscriptions.values())}get topics(){return this.topicMap.topics}get hasAnyTopics(){return this.topicMap.topics.length>0||this.pending.size>0||this.cached.length>0||this.subscriptions.size>0}hasSubscription(e,t){let r=!1;try{r=this.getSubscription(e).topic===t}catch{}return r}reset(){this.cached=[],this.initialized=!0}onDisable(){this.values.length>0&&(this.cached=this.values),this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,t){let r=this.topicMap.get(e);await Promise.all(r.map(async r=>await this.unsubscribeById(e,r,t)))}async unsubscribeById(e,t,r){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:r}});try{let n=aO(r);await this.restartToComplete({topic:e,id:t,relay:n}),await this.rpcUnsubscribe(e,t,n);let i=a5("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,t,i),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:t,opts:r}})}catch(e){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(e),e}}async rpcSubscribe(e,t,r){var n,i;
57let s=await this.getSubscriptionId(e);if(null!=(n=r?.internal)&&n.skipSubscribe)return s;r&&r?.transportType!==lT.relay||await this.restartToComplete({topic:e,id:e,relay:t});let o={method:aP(t.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:o});let a=null==(i=r?.internal)?void 0:i.throwOnFailedPublish;try{if(r?.transportType===lT.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(o).catch(e=>this.logger.warn(e))},(0,ej.toMiliseconds)(ej.ONE_SECOND)),s;let t=new Promise(async t=>{let r=n=>{n.topic===e&&(this.events.removeListener(lD.created,r),t(n.id))};this.events.on(lD.created,r);try{let n=await nu(new Promise((e,t)=>{this.relayer.request(o).catch(e=>{this.logger.warn(e,e?.message),t(e)}).then(e)}),this.initialSubscribeTimeout,`Subscribing to ${e} failed, please try again`);this.events.removeListener(lD.created,r),t(n)}catch{}}),n=await nu(t,this.subscribeTimeout,`Subscribing to ${e} failed, please try again`);if(!n&&a)throw Error(`Subscribing to ${e} failed, please try again`);return n?s:null}catch(e){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(lP.connection_stalled),a)throw e}return null}async rpcBatchSubscribe(e){if(!e.length)return;let t={method:aP(e[0].relay.protocol).batchSubscribe,params:{topics:e.map(e=>e.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:t});try{await await nu(new Promise(e=>{this.relayer.request(t).catch(e=>this.logger.warn(e)).then(e)}),this.subscribeTimeout,"rpcBatchSubscribe failed, please try again")}catch{this.relayer.events.emit(lP.connection_stalled)}}async rpcBatchFetchMessages(e){let t;if(!e.length)return;let r={method:aP(e[0].relay.protocol).batchFetchMessages,params:{topics:e.map(e=>e.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:r});try{t=await await nu(new Promise((e,t)=>{this.relayer.request(r).catch(e=>{this.logger.warn(e),t(e)}).then(e)}),this.subscribeTimeout,"rpcBatchFetchMessages failed, please try again")}catch{this.relayer.events.emit(lP.connection_stalled)}return t}rpcUnsubscribe(e,t,r){let n={method:aP(r.protocol).unsubscribe,params:{topic:e,id:t}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n}),this.relayer.request(n)}onSubscribe(e,t){this.setSubscription(e,ud(uh({},t),{id:e})),this.pending.delete(t.topic)}onBatchSubscribe(e){e.length&&e.forEach(e=>{this.setSubscription(e.id,uh({},e)),this.pending.delete(e.topic)})}async onUnsubscribe(e,t,r){this.events.removeAllListeners(t),this.hasSubscription(t,e)&&this.deleteSubscription(t,r),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,t){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:t}),this.addSubscription(e,t)}addSubscription(e,t){this.subscriptions.set(e,uh({},t)),this.topicMap.set(t.topic,e),this.events.emit(lD.created,t)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});let t=this.subscriptions.get(e);if(!t){let{message:t}=a6("NO_MATCHING_KEY",`${this.name}: ${e}`);throw Error(t)}return t}deleteSubscription(e,t){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:t});let r=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(r.topic,e),this.events.emit(lD.deleted,ud(uh({},r),{reason:t}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(lD.sync)}async onRestart(){if(this.cached.length){let e=[...this.cached],t=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let r=0;r<t;r++){let t=e.splice(0,this.batchSubscribeTopicsLimit);await this.batchSubscribe(t)}}this.events.emit(lD.resubscribed)}
57async restore(){try{let e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size&&!e.every(e=>{var t;return e.topic===(null==(t=this.subscriptions.get(e.id))?void 0:t.topic)})){let{message:e}=a6("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),Error(e)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){e.length&&(await this.rpcBatchSubscribe(e),this.onBatchSubscribe(await Promise.all(e.map(async e=>ud(uh({},e),{id:await this.getSubscriptionId(e.topic)})))))}async batchFetchMessages(e){var t;if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);let r=await this.rpcBatchFetchMessages(e);r&&r.messages&&(await (t=(0,ej.toMiliseconds)(ej.ONE_SECOND),new Promise(e=>setTimeout(e,t))),await this.relayer.handleBatchMessageEvents(r.messages))}async onConnect(){await this.restart(),this.reset()}onDisconnect(){this.onDisable()}isInitialized(){if(!this.initialized){let{message:e}=a6("NOT_INITIALIZED",this.name);throw Error(e)}}async restartToComplete(e){this.relayer.connected||this.relayer.connecting||(this.cached.push(e),await this.relayer.transportOpen())}async getClientId(){return this.clientId||(this.clientId=await this.relayer.core.crypto.getClientId()),this.clientId}async getSubscriptionId(e){return aw(e+await this.getClientId())}}var uy=Object.defineProperty,um=Object.getOwnPropertySymbols,ub=Object.prototype.hasOwnProperty,uw=Object.prototype.propertyIsEnumerable,uv=(e,t,r)=>t in e?uy(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,uE=(e,t)=>{for(var r in t||(t={}))ub.call(t,r)&&uv(e,r,t[r]);if(um)for(var r of um(t))uw.call(t,r)&&uv(e,r,t[r]);return e},ux=(e,t,r)=>uv(e,"symbol"!=typeof t?t+"":t,r);class u_ extends eI{constructor(e){var t;super(e),ux(this,"protocol","wc"),ux(this,"version",2),ux(this,"core"),ux(this,"logger"),ux(this,"events",new B.EventEmitter),ux(this,"provider"),ux(this,"messages"),ux(this,"subscriber"),ux(this,"publisher"),ux(this,"name","relayer"),ux(this,"transportExplicitlyClosed",!1),ux(this,"initialized",!1),ux(this,"connectionAttemptInProgress",!1),ux(this,"relayUrl"),ux(this,"projectId"),ux(this,"packageName"),ux(this,"bundleId"),ux(this,"hasExperiencedNetworkDisruption",!1),ux(this,"pingTimeout"),ux(this,"heartBeatTimeout",(0,ej.toMiliseconds)(ej.THIRTY_SECONDS+ej.FIVE_SECONDS)),ux(this,"reconnectTimeout"),ux(this,"connectPromise"),ux(this,"reconnectInProgress",!1),ux(this,"requestsInFlight",[]),ux(this,"connectTimeout",(0,ej.toMiliseconds)(15*ej.ONE_SECOND)),ux(this,"request",async e=>{var t,r;this.logger.debug("Publishing Request Payload");let n=e.id||(0,ly.getBigIntRpcId)().toString();await this.toEstablishConnection();try{this.logger.trace({id:n,method:e.method,topic:null==(t=e.params)?void 0:t.topic},"relayer.request - publishing...");let i=`${n}:${(null==(r=e.params)?void 0:r.tag)||""}`;this.requestsInFlight.push(i);let s=await this.provider.request(e);return this.requestsInFlight=this.requestsInFlight.filter(e=>e!==i),s}catch(e){throw this.logger.debug(`Failed to Publish Request: ${n}`),e}}),ux(this,"resetPingTimeout",()=>{r7()&&(clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var e,t,r,n;try{this.logger.debug({},"pingTimeout: Connection stalled, terminating..."),null==(n=null==(r=null==(t=null==(e=this.provider)?void 0:e.connection)?void 0:t.socket)?void 0:r.terminate)||n.call(r)}catch(e){this.logger.warn(e,e?.message)}},this.heartBeatTimeout))}),ux(this,"onPayloadHandler",e=>{this.onProviderPayload(e),this.resetPingTimeout()}),ux(this,"onConnectHandler",()=>{this.logger.warn({},"Relayer connected \uD83D\uDEDC"),this.startPingTimeout(),this.events.emit(lP.connect)}),ux(this,"onDisconnectHandler",()=>{this.logger.warn({},"Relayer disconnected \uD83D\uDED1"),this.requestsInFlight=[],this.onProviderDisconnect()}),ux(this,"onProviderErrorHandler",e=>{this.logger.fatal(`Fatal socket error: ${e.message}`),this.events.emit(lP.error,e),this.logger.fatal("Fatal socket error received, closing transport"),this.transportClose()}),ux(this,"registerProviderListeners",()=>{this.provider.on(lC.payload,this.onPayloadHandler),this.provider.on(lC.connect,this.onConnectHandler),this.provider.on(lC.disconnect,this.onDisconnectHandler),this.provider.on(lC.error,this.onProviderErrorHandler)}),this.core=e.core,this.logger=lp({logger:null!=(t=e.logger)?t:"error",name:this.name}),this.messages=new cQ(this.logger,e.core),this.subscriber=new ug(this,this.logger),this.publisher=new ue(this,this.logger),this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||lO,ne()&&"u">typeof global&&"u">typeof(null==global?void 0:global.Platform)&&(null==global?void 0:global.Platform.OS)==="android"?this.packageName=nn():ne()&&"u">typeof global&&"u">typeof(null==global?void 0:global.Platform)&&(null==global?void 0:global.Platform.OS)==="ios"&&(this.bundleId=nn()),this.provider={}}
57async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.transportOpen().catch(e=>this.logger.warn(e,e?.message))}get context(){return eh(this.logger)}get connected(){var e,t,r;return(null==(r=null==(t=null==(e=this.provider)?void 0:e.connection)?void 0:t.socket)?void 0:r.readyState)===1}get connecting(){var e,t,r;return(null==(r=null==(t=null==(e=this.provider)?void 0:e.connection)?void 0:t.socket)?void 0:r.readyState)===0||void 0!==this.connectPromise}async publish(e,t,r){this.isInitialized(),await this.publisher.publish(e,t,r),await this.recordMessageEvent({topic:e,message:t,publishedAt:Date.now(),transportType:lT.relay},lB.outbound)}async publishCustom(e){this.isInitialized(),await this.publisher.publishCustom(e)}async subscribe(e,t){var r,n,i;this.isInitialized(),null!=t&&t.transportType&&t?.transportType!=="relay"||await this.toEstablishConnection();let s=typeof(null==(r=t?.internal)?void 0:r.throwOnFailedPublish)>
57"u"||(null==(n=t?.internal)?void 0:n.throwOnFailedPublish),o=(null==(i=this.subscriber.topicMap.get(e))?void 0:i[0])||"",a,l=t=>{t.topic===e&&(this.subscriber.off(lD.created,l),a())};return await Promise.all([new Promise(e=>{a=e,this.subscriber.on(lD.created,l)}),new Promise(async(r,n)=>{o=await this.subscriber.subscribe(e,uE({internal:{throwOnFailedPublish:s}},t)).catch(e=>{s&&n(e)})||o,r()})]),o}async unsubscribe(e,t){this.isInitialized(),await this.subscriber.unsubscribe(e,t)}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}off(e,t){this.events.off(e,t)}removeListener(e,t){this.events.removeListener(e,t)}async transportDisconnect(){this.provider.disconnect&&(this.hasExperiencedNetworkDisruption||this.connected)?await nu(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){if(!this.subscriber.hasAnyTopics){this.logger.info("Starting WS connection skipped because the client has no topics to work with.");return}if(this.connectPromise?(this.logger.debug({},"Waiting for existing connection attempt to resolve..."),await this.connectPromise,this.logger.debug({},"Existing connection attempt resolved")):(this.connectPromise=new Promise(async(t,r)=>{await this.connect(e).then(t).catch(r).finally(()=>{this.connectPromise=void 0})}),await this.connectPromise),!this.connected)throw Error(`Couldn't establish socket connection to the relay server: ${this.relayUrl}`)}async restartTransport(e){this.logger.debug({},"Restarting transport..."),this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await lc())throw Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if(e?.length===0){this.logger.trace("Batch message events is empty. Ignoring...");return}let t=e.sort((e,t)=>e.publishedAt-t.publishedAt);for(let e of(this.logger.debug(`Batch of ${t.length} message events sorted`),t))try{await this.onMessageEvent(e)}catch(e){this.logger.warn(e,"Error while processing batch message event: "+e?.message)}this.logger.trace(`Batch of ${t.length} message events processed`)}async onLinkMessageEvent(e,t){let{topic:r}=e;if(!t.sessionExists){let e=nd(ej.FIVE_MINUTES);await this.core.pairing.pairings.set(r,{topic:r,expiry:e,relay:{protocol:"irn"},active:!1})}this.events.emit(lP.message,e),await this.recordMessageEvent(e,lB.inbound)}async connect(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;let t=1;for(;t<6;){try{if(this.transportExplicitlyClosed)break;this.logger.debug({},`Connecting to ${this.relayUrl}, attempt: ${t}...`),await this.createProvider(),await new Promise(async(e,t)=>{let r=()=>{t(Error("Connection interrupted while trying to connect"))};this.provider.once(lC.disconnect,r),await nu(new Promise((e,t)=>{this.provider.connect().then(e).catch(t)}),this.connectTimeout,`Socket stalled when trying to connect to ${this.relayUrl}`).catch(e=>{t(e)}).finally(()=>{this.provider.off(lC.disconnect,r),clearTimeout(this.reconnectTimeout)}),await new Promise(async(e,r)=>{let n=()=>{t(Error("Connection interrupted while trying to subscribe"))};this.provider.once(lC.disconnect,n),await this.subscriber.start().then(e).catch(r).finally(()=>{this.provider.off(lC.disconnect,n)})}),this.hasExperiencedNetworkDisruption=!1,e()})}catch(e){await this.subscriber.stop(),this.logger.warn({},e.message),this.hasExperiencedNetworkDisruption=!0}finally{this.connectionAttemptInProgress=!1}if(this.connected){this.logger.debug({},`Connected to ${this.relayUrl} successfully on attempt: ${t}`);break}await new Promise(e=>setTimeout(e,(0,ej.toMiliseconds)(1*t))),t++}}startPingTimeout(){var e,t,r,n,i;if(r7())try{null!=(t=null==(e=this.provider)?void 0:e.connection)&&t.socket&&(null==(i=null==(n=null==(r=this.provider)?void 0:r.connection)?void 0:n.socket)||i.on("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(e){this.logger.warn(e,e?.message)}}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();let e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new lg.r(new lm.Z(function({protocol:e,version:t,relayUrl:r,sdkVersion:n,auth:i,projectId:s,useOnCloseEvent:o,bundleId:a,packageName:l}){let c=r.split("?"),u=ns(e,t,n),f=function(e,t){let r=new URLSearchParams(e);return Object.entries(t).sort(([e],[t])=>
57e.localeCompare(t)).forEach(([e,t])=>{null!=t&&r.set(e,String(t))}),r.toString()}(c[1]||"",{auth:i,ua:u,projectId:s,useOnCloseEvent:o||void 0,packageName:l||void 0,bundleId:a||void 0});return c[0]+"?"+f}({sdkVersion:lk,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId,packageName:this.packageName}))),this.registerProviderListeners()}async recordMessageEvent(e,t){let{topic:r,message:n}=e;await this.messages.set(r,n,t)}async shouldIgnoreMessageEvent(e){let{topic:t,message:r}=e;if(!r||0===r.length)return this.logger.warn(`Ignoring invalid/empty message: ${r}`),!0;if(!await this.subscriber.isKnownTopic(t))return this.logger.warn(`Ignoring message for unknown topic ${t}`),!0;let n=this.messages.has(t,r);return n&&this.logger.warn(`Ignoring duplicate message: ${r}`),n}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),(0,ly.isJsonRpcRequest)(e)){if(!e.method.endsWith("_subscription"))return;let t=e.params,{topic:r,message:n,publishedAt:i,attestation:s}=t.data,o={topic:r,message:n,publishedAt:i,transportType:lT.relay,attestation:s};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(uE({type:"event",event:t.id},o)),this.events.emit(t.id,o),await this.acknowledgePayload(e),await this.onMessageEvent(o)}else(0,ly.isJsonRpcResponse)(e)&&this.events.emit(lP.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(await this.recordMessageEvent(e,lB.inbound),this.events.emit(lP.message,e))}async acknowledgePayload(e){let t=(0,ly.formatJsonRpcResult)(e.id,!0);await this.provider.connection.send(t)}unregisterProviderListeners(){this.provider.off(lC.payload,this.onPayloadHandler),this.provider.off(lC.connect,this.onConnectHandler),this.provider.off(lC.disconnect,this.onDisconnectHandler),this.provider.off(lC.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await lc();(function(e){switch(nr()){case r9.browser:!ne()&&nt()&&(window.addEventListener("online",()=>e(!0)),window.addEventListener("offline",()=>e(!1)));break;case r9.reactNative:ne()&&"u">typeof global&&null!=global&&global.NetInfo&&global?.NetInfo.addEventListener(t=>e(t?.isConnected));case r9.node:}})(async t=>{e!==t&&(e=t,t?await this.transportOpen().catch(e=>this.logger.error(e,e?.message)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))}),this.core.heartbeat.on(R.Lx.pulse,async()=>{var e;if(!this.transportExplicitlyClosed&&!this.connected&&(!(nt()&&(0,ez.getDocument)())||(null==(e=(0,ez.getDocument)())?void 0:e.visibilityState)==="visible"))try{await this.confirmOnlineStateOrThrow(),await this.transportOpen()}catch(e){this.logger.warn(e,e?.message)}})}async onProviderDisconnect(){clearTimeout(this.pingTimeout),this.events.emit(lP.disconnect),this.connectionAttemptInProgress=!1,!this.reconnectInProgress&&(this.reconnectInProgress=!0,await this.subscriber.stop(),this.subscriber.hasAnyTopics&&(this.transportExplicitlyClosed||(this.reconnectTimeout=setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e,e?.message)),this.reconnectTimeout=void 0,this.reconnectInProgress=!1},(0,ej.toMiliseconds)(.1)))))}isInitialized(){if(!this.initialized){let{message:e}=a6("NOT_INITIALIZED",this.name);throw Error(e)}}async toEstablishConnection(){if(await this.confirmOnlineStateOrThrow(),!this.connected){if(this.connectPromise){await this.connectPromise;return}await this.connect()}}}function uA(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function uS(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}let uI="[object Arguments]",uO="[object Object]";function uP(){}function uC(e){if(!e||"object"!=typeof e)return!1;let t=Object.getPrototypeOf(e);return(null===t||t===Object.prototype||null===Object.getPrototypeOf(t))&&"[object Object]"===Object.prototype.toString.call(e)}var uk=Object.defineProperty,uT=Object.getOwnPropertySymbols,uB=Object.prototype.hasOwnProperty,uR=Object.prototype.propertyIsEnumerable,uD=(e,t,r)=>t in e?uk(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,uU=(e,t)=>{for(var r in t||(t={}))uB.call(t,r)&&uD(e,r,t[r]);
57if(uT)for(var r of uT(t))uR.call(t,r)&&uD(e,r,t[r]);return e},uM=(e,t,r)=>uD(e,"symbol"!=typeof t?t+"":t,r);class uN extends eO{constructor(e,t,r,n=lE,i){super(e,t,r,n),this.core=e,this.logger=t,this.name=r,uM(this,"map",new Map),uM(this,"version","0.3"),uM(this,"cached",[]),uM(this,"initialized",!1),uM(this,"getKey"),uM(this,"storagePrefix",lE),uM(this,"recentlyDeleted",[]),uM(this,"recentlyDeletedLimit",200),uM(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(e=>{var t;this.getKey&&null!==e&&!a4(e)?this.map.set(this.getKey(e),e):(null==(t=e?.proposer)?void 0:t.publicKey)?this.map.set(e.id,e):e?.topic&&this.map.set(e.topic,e)}),this.cached=[],this.initialized=!0)}),uM(this,"set",async(e,t)=>{this.isInitialized(),this.map.has(e)?await this.update(e,t):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:e,value:t}),this.map.set(e,t),await this.persist())}),uM(this,"get",e=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:e}),this.getData(e))),uM(this,"getAll",e=>(this.isInitialized(),e?this.values.filter(t=>Object.keys(e).every(r=>(function e(t,r,n,i,s,o,a){let l=a(t,r,n,i,s,o);if(void 0!==l)return l;if(typeof t==typeof r)switch(typeof t){case"bigint":case"string":case"boolean":case"symbol":case"undefined":case"function":return t===r;case"number":return t===r||Object.is(t,r)}return function t(r,n,i,s){if(Object.is(r,n))return!0;let o=uS(r),a=uS(n);if(o===uI&&(o=uO),a===uI&&(a=uO),o!==a)return!1;switch(o){case"[object String]":return r.toString()===n.toString();case"[object Number]":{let e=r.valueOf(),t=n.valueOf();return e===t||Number.isNaN(e)&&Number.isNaN(t)}case"[object Boolean]":case"[object Date]":case"[object Symbol]":return Object.is(r.valueOf(),n.valueOf());case"[object RegExp]":return r.source===n.source&&r.flags===n.flags;case"[object Function]":return r===n}let l=(i=i??new Map).get(r),c=i.get(n);if(null!=l&&null!=c)return l===n;i.set(r,n),i.set(n,r);try{switch(o){case"[object Map]":if(r.size!==n.size)return!1;for(let[t,o]of r.entries())if(!n.has(t)||!e(o,n.get(t),t,r,n,i,s))return!1;return!0;case"[object Set]":{if(r.size!==n.size)return!1;let t=Array.from(r.values()),o=Array.from(n.values());for(let a=0;a<t.length;a++){let l=t[a],c=o.findIndex(t=>e(l,t,void 0,r,n,i,s));if(-1===c)return!1;o.splice(c,1)}return!0}case"[object Array]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":case"[object BigUint64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object BigInt64Array]":case"[object Float32Array]":case"[object Float64Array]":if("u">typeof lb&&lb.isBuffer(r)!==lb.isBuffer(n)||r.length!==n.length)return!1;for(let t=0;t<r.length;t++)if(!e(r[t],n[t],t,r,n,i,s))return!1;return!0;case"[object ArrayBuffer]":return r.byteLength===n.byteLength&&t(new Uint8Array(r),new Uint8Array(n),i,s);case"[object DataView]":return r.byteLength===n.byteLength&&r.byteOffset===n.byteOffset&&t(new Uint8Array(r),new Uint8Array(n),i,s);case"[object Error]":return r.name===n.name&&r.message===n.message;case uO:{if(!(t(r.constructor,n.constructor,i,s)||uC(r)&&uC(n)))return!1;let o=[...Object.keys(r),...uA(r)],a=[...Object.keys(n),...uA(n)];if(o.length!==a.length)return!1;for(let t=0;t<o.length;t++){let a=o[t],l=r[a];if(!Object.hasOwn(n,a))return!1;let c=n[a];if(!e(l,c,a,r,n,i,s))return!1}return!0}default:return!1}}finally{i.delete(r),i.delete(n)}}(t,r,o,a)})(t[r],e[r],void 0,void 0,void 0,void 0,uP))):this.values)),uM(this,"update",async(e,t)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:e,update:t});let r=uU(uU({},this.getData(e)),t);this.map.set(e,r),await this.persist()}),uM(this,"delete",async(e,t)=>{this.isInitialized(),this.map.has(e)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:e,reason:t}),this.map.delete(e),this.addToRecentlyDeleted(e),await this.persist())}),this.logger=ed(t,this.name),this.storagePrefix=n,this.getKey=i}get context(){return eh(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}
57get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){let t=this.map.get(e);if(!t){if(this.recentlyDeleted.includes(e)){let{message:t}=a6("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(t),Error(t)}let{message:t}=a6("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(t),Error(t)}return t}async persist(){await this.setDataStore(this.values)}async restore(){try{let e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){let{message:e}=a6("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),Error(e)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){let{message:e}=a6("NOT_INITIALIZED",this.name);throw Error(e)}}}var uj=Object.defineProperty,uL=(e,t,r)=>t in e?uj(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,u$=(e,t,r)=>uL(e,"symbol"!=typeof t?t+"":t,r);class uz{constructor(e,t){this.core=e,this.logger=t,u$(this,"name","pairing"),u$(this,"version","0.3"),u$(this,"events",new B),u$(this,"pairings"),u$(this,"initialized",!1),u$(this,"storagePrefix",lE),u$(this,"ignoredPayloadTypes",[1]),u$(this,"registeredMethods",[]),u$(this,"init",async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))}),u$(this,"register",({methods:e})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...e])]}),u$(this,"create",async e=>{this.isInitialized();let t=am(),r=await this.core.crypto.setSymKey(t),n=nd(ej.FIVE_MINUTES),i={protocol:"irn"},s={topic:r,expiry:n,relay:i,active:!1,methods:e?.methods},o=aL({protocol:this.core.protocol,version:this.core.version,topic:r,symKey:t,relay:i,expiryTimestamp:n,methods:e?.methods});return this.events.emit(lM.create,s),this.core.expirer.set(r,n),await this.pairings.set(r,s),await this.core.relayer.subscribe(r,{transportType:e?.transportType,internal:e?.internal}),{topic:r,uri:o}}),u$(this,"pair",async e=>{let t;this.isInitialized();let r=this.core.eventClient.createEvent({properties:{topic:e?.uri,trace:[lF.pairing_started]}});this.isValidPair(e,r);let{topic:n,symKey:i,relay:s,expiryTimestamp:o,methods:a}=aj(e.uri);if(r.props.properties.topic=n,r.addTrace(lF.pairing_uri_validation_success),r.addTrace(lF.pairing_uri_not_expired),this.pairings.keys.includes(n)){if(t=this.pairings.get(n),r.addTrace(lF.existing_pairing),t.active)throw r.setError(lq.active_pairing_already_exists),Error(`Pairing already exists: ${n}. Please try again with a new connection URI.`);r.addTrace(lF.pairing_not_expired)}let l=o||nd(ej.FIVE_MINUTES),c={topic:n,relay:s,expiry:l,active:!1,methods:a};this.core.expirer.set(n,l),await this.pairings.set(n,c),r.addTrace(lF.store_new_pairing),e.activatePairing&&await this.activate({topic:n}),this.events.emit(lM.create,c),r.addTrace(lF.emit_inactive_pairing),this.core.crypto.keychain.has(n)||await this.core.crypto.setSymKey(i,n),r.addTrace(lF.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{r.setError(lq.no_internet_connection)}try{await this.core.relayer.subscribe(n,{relay:s})}catch(e){throw r.setError(lq.subscribe_pairing_topic_failure),e}return r.addTrace(lF.subscribe_pairing_topic_success),c}),u$(this,"activate",async({topic:e})=>{this.isInitialized();let t=nd(ej.FIVE_MINUTES);this.core.expirer.set(e,t),await this.pairings.update(e,{active:!0,expiry:t})}),u$(this,"ping",async e=>{this.isInitialized(),await this.isValidPing(e),this.logger.warn("ping() is deprecated and will be removed in the next major release.");let{topic:t}=e;if(this.pairings.keys.includes(t)){let e=await this.sendRequest(t,"wc_pairingPing",{}),{done:r,resolve:n,reject:i}=nc();this.events.once(ng("pairing_ping",e),({error:e})=>{e?i(e):n()}),await r()}}),u$(this,"updateExpiry",async({topic:e,expiry:t})=>{this.isInitialized(),await this.pairings.update(e,{expiry:t})}),u$(this,"updateMetadata",async({topic:e,metadata:t})=>{this.isInitialized(),await this.pairings.update(e,{peerMetadata:t})}),u$(this,"getPairings",()=>(this.isInitialized(),this.pairings.values)),u$(this,"disconnect",async e=>{this.isInitialized(),await this.isValidDisconnect(e);let{topic:t}=e;this.pairings.keys.includes(t)&&(await this.sendRequest(t,"wc_pairingDelete",a5("USER_DISCONNECTED")),await this.deletePairing(t))}),u$(this,"formatUriFromPairing",e=>{this.isInitialized();let{topic:t,relay:r,expiry:n,methods:i}=e,s=this.core.crypto.keychain.get(t);return aL({protocol:this.core.protocol,version:this.core.version,topic:t,symKey:s,relay:r,expiryTimestamp:n,methods:i})}),u$(this,"sendRequest",async(e,t,r)=>{let n=(0,ly.formatJsonRpcRequest)(t,r),i=await this.core.crypto.encode(e,n),s=lU[t].req;return this.core.history.set(e,n),this.core.relayer.publish(e,i,s),n.id}),u$(this,"sendResult",async(e,t,r)=>{let n=(0,ly.formatJsonRpcResult)(e,r),i=await this.core.crypto.encode(t,n),s=lU[(await this.core.history.get(t,e)).request.method].res;await this.core.relayer.publish(t,i,s),await this.core.history.resolve(n)}),u$(this,"sendError",async(e,t,r)=>{let n=(0,ly.formatJsonRpcError)(e,r),i=await this.core.crypto.encode(t,n),s=(await this.core.history.get(t,e)).request.method,o=lU[s]?lU[s].res:lU.unregistered_method.res;await this.core.relayer.publish(t,i,o),await this.core.history.resolve(n)}),u$(this,"deletePairing",async(e,t)=>{await this.core.relayer.unsubscribe(e),await Promise.all([this.pairings.delete(e,a5("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(e),t?Promise.resolve():this.core.expirer.del(e)])}),u$(this,"cleanup",async()=>{let e=this.pairings.getAll().filter(e=>np(e.expiry));await Promise.all(e.map(e=>this.deletePairing(e.topic)))}),u$(this,"onRelayEventRequest",async e=>{let{topic:t,payload:r}=e;switch(r.method){case"wc_pairingPing":return await this.onPairingPingRequest(t,r);case"wc_pairingDelete":return await this.onPairingDeleteRequest(t,r);default:return await this.onUnknownRpcMethodRequest(t,r)}}),u$(this,"onRelayEventResponse",async e=>{let{topic:t,payload:r}=e,n=(await this.core.history.get(t,r.id)).request.method;return"wc_pairingPing"===n?this.onPairingPingResponse(t,r):this.onUnknownRpcMethodResponse(n)}),u$(this,"onPairingPingRequest",async(e,t)=>{let{id:r}=t;try{this.isValidPing({topic:e}),await this.sendResult(r,e,!0),this.events.emit(lM.ping,{id:r,topic:e})}catch(t){await this.sendError(r,e,t),this.logger.error(t)}}),u$(this,"onPairingPingResponse",(e,t)=>{let{id:r}=t;setTimeout(()=>{(0,ly.isJsonRpcResult)(t)?this.events.emit(ng("pairing_ping",r),{}):(0,ly.isJsonRpcError)(t)&&this.events.emit(ng("pairing_ping",r),{error:t.error})},500)}),u$(this,"onPairingDeleteRequest",async(e,t)=>{let{id:r}=t;try{this.isValidDisconnect({topic:e}),await this.deletePairing(e),this.events.emit(lM.delete,{id:r,topic:e})}catch(t){await this.sendError(r,e,t),this.logger.error(t)}}),u$(this,"onUnknownRpcMethodRequest",async(e,t)=>{let{id:r,method:n}=t;try{if(this.registeredMethods.includes(n))return;let t=a5("WC_METHOD_UNSUPPORTED",n);await this.sendError(r,e,t),this.logger.error(t)}catch(t){await this.sendError(r,e,t),this.logger.error(t)}}),u$(this,"onUnknownRpcMethodResponse",e=>{this.registeredMethods.includes(e)||this.logger.error(a5("WC_METHOD_UNSUPPORTED",e))}),u$(this,"isValidPair",(e,t)=>{var r;if(!ls(e)){let{message:r}=a6("MISSING_OR_INVALID",`pair() params: ${e}`);throw t.setError(lq.malformed_pairing_uri),Error(r)}if(!function(e){function t(e){try{return"u">typeof new URL(e)}catch{return!1}}try{if(a9(e,!1)){if(t(e))return!0;let r=nx(e);return t(r)}}catch{}return!1}(e.uri)){let{message:r}=a6("MISSING_OR_INVALID",`pair() uri: ${e.uri}`);throw t.setError(lq.malformed_pairing_uri),Error(r)}let n=aj(e?.uri);if(!(null!=(r=n?.relay)&&r.protocol)){let{message:e}=a6("MISSING_OR_INVALID","pair() uri#relay-protocol");throw t.setError(lq.malformed_pairing_uri),Error(e)}if(!(null!=n&&n.symKey)){let{message:e}=a6("MISSING_OR_INVALID","pair() uri#symKey");throw t.setError(lq.malformed_pairing_uri),Error(e)}if(null!=n&&n.expiryTimestamp&&(0,ej.toMiliseconds)(n?.expiryTimestamp)<Date.now()){t.setError(lq.pairing_expired);let{message:e}=a6("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw Error(e)}}),u$(this,"isValidPing",async e=>{if(!ls(e)){let{message:t}=a6("MISSING_OR_INVALID",`ping() params: ${e}`);throw Error(t)}let{topic:t}=e;await this.isValidPairingTopic(t)}),u$(this,"isValidDisconnect",async e=>{if(!ls(e)){let{message:t}=a6("MISSING_OR_INVALID",`disconnect() params: ${e}`);throw Error(t)}let{topic:t}=e;await this.isValidPairingTopic(t)}),u$(this,"isValidPairingTopic",async e=>{if(!a9(e,!1)){let{message:t}=a6("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw Error(t)}if(!this.pairings.keys.includes(e)){let{message:t}=a6("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw Error(t)}if(np(this.pairings.get(e).expiry)){await this.deletePairing(e);let{message:t}=a6("EXPIRED",`pairing topic: ${e}`);throw Error(t)}}),this.core=e,this.logger=ed(t,this.name),this.pairings=new uN(this.core,this.logger,this.name,this.storagePrefix)}get context(){return eh(this.logger)}isInitialized(){if(!this.initialized){let{message:e}=a6("NOT_INITIALIZED",this.name);throw Error(e)}}registerRelayerEvents(){this.core.relayer.on(lP.message,async e=>{let{topic:t,message:r,transportType:n}=e;if(this.pairings.keys.includes(t)&&n!==lT.link_mode&&!this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(r)))try{let e=await this.core.crypto.decode(t,r);(0,ly.isJsonRpcRequest)(e)?(this.core.history.set(t,e),await this.onRelayEventRequest({topic:t,payload:e})):(0,ly.isJsonRpcResponse)(e)&&(await this.core.history.resolve(e),await this.onRelayEventResponse({topic:t,payload:e}),this.core.history.delete(t,e.id)),await this.core.relayer.messages.ack(t,r)}catch(e){this.logger.error(e)}})}registerExpirerEvents(){this.core.expirer.on(lj.expired,async e=>{let{topic:t}
57=nh(e.target);t&&this.pairings.keys.includes(t)&&(await this.deletePairing(t,!0),this.events.emit(lM.expire,{topic:t}))})}}var uF=Object.defineProperty,uq=(e,t,r)=>t in e?uF(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,uW=(e,t,r)=>uq(e,"symbol"!=typeof t?t+"":t,r);class uV extends e_{constructor(e,t){super(e,t),this.core=e,this.logger=t,uW(this,"records",new Map),uW(this,"events",new B.EventEmitter),uW(this,"name","history"),uW(this,"version","0.3"),uW(this,"cached",[]),uW(this,"initialized",!1),uW(this,"storagePrefix",lE),uW(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(e=>this.records.set(e.id,e)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),uW(this,"set",(e,t,r)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:e,request:t,chainId:r}),this.records.has(t.id))return;let n={id:t.id,topic:e,request:{method:t.method,params:t.params||null},chainId:r,expiry:nd(ej.THIRTY_DAYS)};this.records.set(n.id,n),this.persist(),this.events.emit(lN.created,n)}),uW(this,"resolve",async e=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:e}),!this.records.has(e.id))return;let t=await this.getRecord(e.id);typeof t.response>"u"&&(t.response=(0,ly.isJsonRpcError)(e)?{error:e.error}:{result:e.result},this.records.set(t.id,t),this.persist(),this.events.emit(lN.updated,t))}),uW(this,"get",async(e,t)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:e,id:t}),await this.getRecord(t))),uW(this,"delete",(e,t)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:t}),this.values.forEach(r=>{r.topic!==e||"u">typeof t&&r.id!==t||(this.records.delete(r.id),this.events.emit(lN.deleted,r))}),this.persist()}),uW(this,"exists",async(e,t)=>(this.isInitialized(),!!this.records.has(t)&&(await this.getRecord(t)).topic===e)),uW(this,"on",(e,t)=>{this.events.on(e,t)}),uW(this,"once",(e,t)=>{this.events.once(e,t)}),uW(this,"off",(e,t)=>{this.events.off(e,t)}),uW(this,"removeListener",(e,t)=>{this.events.removeListener(e,t)}),this.logger=ed(t,this.name)}get context(){return eh(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get size(){return this.records.size}get keys(){return Array.from(this.records.keys())}get values(){return Array.from(this.records.values())}get pending(){let e=[];return this.values.forEach(t=>{if("u">typeof t.response)return;let r={topic:t.topic,request:(0,ly.formatJsonRpcRequest)(t.request.method,t.request.params,t.id),chainId:t.chainId};return e.push(r)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();let t=this.records.get(e);if(!t){let{message:t}=a6("NO_MATCHING_KEY",`${this.name}: ${e}`);throw Error(t)}return t}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(lN.sync)}async restore(){try{let e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){let{message:e}=a6("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),Error(e)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(lN.created,e=>{let t=lN.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.events.on(lN.updated,e=>{let t=lN.updated;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.events.on(lN.deleted,e=>{let t=lN.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.core.heartbeat.on(R.Lx.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(t=>{(0,ej.toMiliseconds)(t.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${t.id}`),this.records.delete(t.id),this.events.emit(lN.deleted,t,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){let{message:e}=a6("NOT_INITIALIZED",this.name);throw Error(e)}}}var uH=Object.defineProperty,uG=(e,t,r)=>t in e?uH(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,uK=(e,t,r)=>uG(e,"symbol"!=typeof t?t+"":t,r);class uZ extends eC{constructor(e,t){super(e,t),this.core=e,this.logger=t,uK(this,"expirations",new Map),uK(this,"events",new B.EventEmitter),uK(this,"name","expirer"),uK(this,"version","0.3"),uK(this,"cac
57hed",[]),uK(this,"initialized",!1),uK(this,"storagePrefix",lE),uK(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(e=>this.expirations.set(e.target,e)),this.cached=[],this.registerEventListeners(),this.initialized=!0)}),uK(this,"has",e=>{try{let t=this.formatTarget(e);return"u">typeof this.getExpiration(t)}catch{return!1}}),uK(this,"set",(e,t)=>{this.isInitialized();let r=this.formatTarget(e),n={target:r,expiry:t};this.expirations.set(r,n),this.checkExpiry(r,n),this.events.emit(lj.created,{target:r,expiration:n})}),uK(this,"get",e=>{this.isInitialized();let t=this.formatTarget(e);return this.getExpiration(t)}),uK(this,"del",e=>{if(this.isInitialized(),this.has(e)){let t=this.formatTarget(e),r=this.getExpiration(t);this.expirations.delete(t),this.events.emit(lj.deleted,{target:t,expiration:r})}}),uK(this,"on",(e,t)=>{this.events.on(e,t)}),uK(this,"once",(e,t)=>{this.events.once(e,t)}),uK(this,"off",(e,t)=>{this.events.off(e,t)}),uK(this,"removeListener",(e,t)=>{this.events.removeListener(e,t)}),this.logger=ed(t,this.name)}get context(){return eh(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.expirations.size}get keys(){return Array.from(this.expirations.keys())}get values(){return Array.from(this.expirations.values())}formatTarget(e){if("string"==typeof e)return nf("topic",e);if("number"==typeof e)return nf("id",e);let{message:t}=a6("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw Error(t)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(lj.sync)}async restore(){try{let e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){let{message:e}=a6("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(e),Error(e)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){let t=this.expirations.get(e);if(!t){let{message:t}=a6("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(t),Error(t)}return t}checkExpiry(e,t){let{expiry:r}=t;(0,ej.toMiliseconds)(r)-Date.now()<=0&&this.expire(e,t)}expire(e,t){this.expirations.delete(e),this.events.emit(lj.expired,{target:e,expiration:t})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,t)=>this.checkExpiry(t,e))}registerEventListeners(){this.core.heartbeat.on(R.Lx.pulse,()=>this.checkExpirations()),this.events.on(lj.created,e=>{let t=lj.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(lj.expired,e=>{let t=lj.expired;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(lj.deleted,e=>{let t=lj.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=a6("NOT_INITIALIZED",this.name);throw Error(e)}}}var uJ=Object.defineProperty,uY=(e,t,r)=>t in e?uJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,uX=(e,t,r)=>uY(e,"symbol"!=typeof t?t+"":t,r);class uQ extends ek{constructor(e,t,r){super(e,t,r),this.core=e,this.logger=t,this.store=r,uX(this,"name","verify-api"),uX(this,"abortController"),uX(this,"isDevEnv"),uX(this,"verifyUrlV3",l$),uX(this,"storagePrefix",lE),uX(this,"version",2),uX(this,"publicKey"),uX(this,"fetchPromise"),uX(this,"init",async()=>{var e;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&(0,ej.toMiliseconds)(null==(e=this.publicKey)?void 0:e.expiresAt)<Date.now()&&(this.logger.debug("verify v2 public key expired"),await this.removePublicKey()))}),uX(this,"register",async e=>{if(!nt()||this.isDevEnv)return;let t=window.location.origin,{id:r,decryptedId:n}=e,i=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${t}&id=${r}&decryptedId=${n}`;try{let e=(0,ez.getDocument)(),t=this.startAbortTimer(5*ej.ONE_SECOND),n=await new Promise((n,s)=>{let o=()=>{window.removeEventListener("message",l),e.body.removeChild(a),s("attestation aborted")};this.abortController.signal.addEventListener("abort",o);let a=e.createElement("iframe");a.src=i,a.style.display="none",a.addEventListener("error",o,{signal:this.abortController.signal});let l=i=>{if(i.data&&"string"==typeof i.data)try{let s=JSON.parse(i.data);if("verify_attestation"===s.type){if((0,eL.xp)(s.attestation).payload.id!==r)return;clearInterval(t),e.body.removeChild(a),this.abortController.signal.removeEventListener("abort",o),window.removeEventListener("message",l),n(null===s.attestation?"":s.attestation)}}catch(e){this.logger.warn(e)}};e.body.appendChild(a),window.addEventListener("message",l,{signal:this.abortController.signal})});return this.logger.debug(n,"jwt attestation"),n}catch(e){this.logger.warn(e)}return""}),uX(this,"resolve",async e=>{if(this.isDevEnv)return"";let{attestationId:t,hash:r,encryptedId:n}=e;if(""===t){this.logger.debug("resolve: attestationId is empty, skipping");return}if(t){if((0,eL.xp)(t).payload.id!==n)return;let e=await this.isValidJwtAttestation(t);
57if(e){if(!e.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return e}}if(!r)return;let i=this.getVerifyUrl(e?.verifyUrl);return this.fetchAttestation(r,i)}),uX(this,"fetchAttestation",async(e,t)=>{this.logger.debug(`resolving attestation: ${e} from url: ${t}`);let r=this.startAbortTimer(5*ej.ONE_SECOND),n=await fetch(`${t}/attestation/${e}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(r),200===n.status?await n.json():void 0}),uX(this,"getVerifyUrl",e=>{let t=e||lL;return lz.includes(t)||(this.logger.info(`verify url: ${t}, not included in trusted list, assigning default: ${lL}`),t=lL),t}),uX(this,"fetchPublicKey",async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);let e=this.startAbortTimer(ej.FIVE_SECONDS),t=await fetch(`${this.verifyUrlV3}/public-key`,{signal:this.abortController.signal});return clearTimeout(e),await t.json()}catch(e){this.logger.warn(e)}}),uX(this,"persistPublicKey",async e=>{this.logger.debug(e,"persisting public key to local storage"),await this.store.setItem(this.storeKey,e),this.publicKey=e}),uX(this,"removePublicKey",async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0}),uX(this,"isValidJwtAttestation",async e=>{let t=await this.getPublicKey();try{if(t)return this.validateAttestation(e,t)}catch(e){this.logger.error(e),this.logger.warn("error validating attestation")}let r=await this.fetchAndPersistPublicKey();try{if(r)return this.validateAttestation(e,r)}catch(e){this.logger.error(e),this.logger.warn("error validating attestation")}}),uX(this,"getPublicKey",async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey()),uX(this,"fetchAndPersistPublicKey",async()=>{if(this.fetchPromise)return await this.fetchPromise,this.publicKey;this.fetchPromise=new Promise(async e=>{let t=await this.fetchPublicKey();t&&(await this.persistPublicKey(t),e(t))});let e=await this.fetchPromise;return this.fetchPromise=void 0,e}),uX(this,"validateAttestation",(e,t)=>{let r=function(e,t){let[r,n,i]=e.split("."),s=rZ.from(ax(i),"base64");if(64!==s.length)throw Error("Invalid signature length");let o=s.slice(0,32),a=s.slice(32,64),l=iW(`${r}.${n}`),c=function(e){let t=rZ.from(e.x,"base64"),r=rZ.from(e.y,"base64");return rj([new Uint8Array([4]),t,r])}(t);if(!af.verify(rj([o,a]),l,c))throw Error("Invalid signature");return(0,eL.xp)(e).payload}(e,t.publicKey),n={hasExpired:(0,ej.toMiliseconds)(r.exp)<Date.now(),payload:r};if(n.hasExpired)throw this.logger.warn("resolve: jwt attestation expired"),Error("JWT attestation expired");return{origin:n.payload.origin,isScam:n.payload.isScam,isVerified:n.payload.isVerified}}),this.logger=ed(t,this.name),this.abortController=new AbortController,this.isDevEnv=nE(),this.init()}get storeKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//verify:public:key"}get context(){return eh(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),(0,ej.toMiliseconds)(e))}}var u0=Object.defineProperty,u1=(e,t,r)=>t in e?u0(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,u2=(e,t,r)=>u1(e,"symbol"!=typeof t?t+"":t,r);class u6 extends eT{constructor(e,t){super(e,t),this.projectId=e,this.logger=t,u2(this,"context","echo"),u2(this,"registerDeviceToken",async e=>{let{clientId:t,token:r,notificationType:n,enableEncrypted:i=!1}=e,s=`https://echo.walletconnect.com/${this.projectId}/clients`;await fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:t,type:n,token:r,always_raw:i})})}),this.logger=ed(t,this.context)}}var u5=Object.defineProperty,u8=Object.getOwnPropertySymbols,u3=Object.prototype.hasOwnProperty,u4=Object.prototype.propertyIsEnumerable,u9=(e,t,r)=>t in e?u5(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,u7=(e,t)=>{for(var r in t||(t={}))u3.call(t,r)&&u9(e,r,t[r]);if(u8)for(var r of u8(t))u4.call(t,r)&&u9(e,r,t[r]);return e},fe=(e,t,r)=>u9(e,"symbol"!=typeof t?t+"":t,r);class ft extends eB{constructor(e,t,r=!0){super(e,t,r),this.core=e,this.logger=t,fe(this,"context","event-client"),fe(this,"storagePrefix",lE),fe(this,"storageVersion",.1),fe(this,"events",new Map),fe(this,"shouldPersist",!1),fe(this,"init",async()=>
57{if(!nE())try{let e={eventId:nv(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:ns(this.core.relayer.protocol,this.core.relayer.version,lk)}}};await this.sendEvent([e])}catch(e){this.logger.warn(e)}}),fe(this,"createEvent",e=>{let{event:t="ERROR",type:r="",properties:{topic:n,trace:i}}=e,s=nv(),o=this.core.projectId||"",a=u7({eventId:s,timestamp:Date.now(),props:{event:t,type:r,properties:{topic:n,trace:i}},bundleId:o,domain:this.getAppDomain()},this.setMethods(s));return this.telemetryEnabled&&(this.events.set(s,a),this.shouldPersist=!0),a}),fe(this,"getEvent",e=>{let{eventId:t,topic:r}=e;if(t)return this.events.get(t);let n=Array.from(this.events.values()).find(e=>e.props.properties.topic===r);if(n)return u7(u7({},n),this.setMethods(n.eventId))}),fe(this,"deleteEvent",e=>{let{eventId:t}=e;this.events.delete(t),this.shouldPersist=!0}),fe(this,"setEventListeners",()=>{this.core.heartbeat.on(R.Lx.pulse,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(e=>{(0,ej.fromMiliseconds)(Date.now())-(0,ej.fromMiliseconds)(e.timestamp)>86400&&(this.events.delete(e.eventId),this.shouldPersist=!0)})})}),fe(this,"setMethods",e=>({addTrace:t=>this.addTrace(e,t),setError:t=>this.setError(e,t)})),fe(this,"addTrace",(e,t)=>{let r=this.events.get(e);r&&(r.props.properties.trace.push(t),this.events.set(e,r),this.shouldPersist=!0)}),fe(this,"setError",(e,t)=>{let r=this.events.get(e);r&&(r.props.type=t,r.timestamp=Date.now(),this.events.set(e,r),this.shouldPersist=!0)}),fe(this,"persist",async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1}),fe(this,"restore",async()=>{try{let e=await this.core.storage.getItem(this.storageKey)||[];if(!e.length)return;e.forEach(e=>{this.events.set(e.eventId,u7(u7({},e),this.setMethods(e.eventId)))})}catch(e){this.logger.warn(e)}}),fe(this,"submit",async()=>{if(!this.telemetryEnabled||0===this.events.size)return;let e=[];for(let[t,r]of this.events)r.props.type&&e.push(r);if(0!==e.length)try{if((await this.sendEvent(e)).ok)for(let t of e)this.events.delete(t.eventId),this.shouldPersist=!0}catch(e){this.logger.warn(e)}}),fe(this,"sendEvent",async e=>{let t=this.getAppDomain()?"":"&sp=desktop";return await fetch(`https://pulse.walletconnect.org/batch?projectId=${this.core.projectId}&st=events_sdk&sv=js-${lk}${t}`,{method:"POST",body:JSON.stringify(e)})}),fe(this,"getAppDomain",()=>ni().url),this.logger=ed(t,this.context),this.telemetryEnabled=r,r?this.restore().then(async()=>{await this.submit(),this.setEventListeners()}):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var fr=Object.defineProperty,fn=Object.getOwnPropertySymbols,fi=Object.prototype.hasOwnProperty,fs=Object.prototype.propertyIsEnumerable,fo=(e,t,r)=>t in e?fr(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,fa=(e,t)=>{for(var r in t||(t={}))fi.call(t,r)&&fo(e,r,t[r]);if(fn)for(var r of fn(t))fs.call(t,r)&&fo(e,r,t[r]);return e},fl=(e,t,r)=>fo(e,"symbol"!=typeof t?t+"":t,r);class fc extends ew{constructor(e){var t,r;super(e),fl(this,"protocol","wc"),fl(this,"version",2),fl(this,"name",lv),fl(this,"relayUrl"),fl(this,"projectId"),fl(this,"customStoragePrefix"),fl(this,"events",new B.EventEmitter),fl(this,"logger"),fl(this,"heartbeat"),fl(this,"relayer"),fl(this,"crypto"),fl(this,"storage"),fl(this,"history"),fl(this,"expirer"),fl(this,"pairing"),fl(this,"verify"),fl(this,"echoClient"),fl(this,"linkModeSupportedApps"),fl(this,"eventClient"),fl(this,"initialized",!1),fl(this,"logChunkController"),fl(this,"on",(e,t)=>this.events.on(e,t)),fl(this,"once",(e,t)=>this.events.once(e,t)),fl(this,"off",(e,t)=>this.events.off(e,t)),fl(this,"removeListener",(e,t)=>this.events.removeListener(e,t)),fl(this,"dispatchEnvelope",({topic:e,message:t,sessionExists:r})=>{if(!e||!t)return;let n={topic:e,message:t,publishedAt:Date.now(),transportType:lT.link_mode};this.relayer.onLinkMessageEvent(n,{sessionExists:r})});let n=this.getGlobalCore(e?.customStoragePrefix);if(n)try{return this.customStoragePrefix=n.customStoragePrefix,this.logger=n.logger,this.heartbeat=n.heartbeat,this.crypto=n.crypto,this.history=n.history,this.expirer=n.expirer,this.storage=n.storage,this.relayer=n.relayer,this.pairing=n.pairing,this.verify=n.verify,this.echoClient=n.echoClient,this.linkModeSupportedApps=n.linkModeSupportedApps,this.eventClient=n.eventClient,this.initialized=n.initialized,this.logChunkController=n.logChunkController,n}catch(e){console.warn("Failed to copy global core",e)}this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||lO,this.customStoragePrefix=null!=e&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";let{logger:i,chunkLoggerController:s}=ep({opts:ef(eu({},r={level:"string"==typeof e?.logger&&e.logger?e.logger:lx.logger,name:lv}),{level:r?.level||j.level}),maxSizeInBytes:e?.maxLogBlobSizeInBytes,loggerOverride:e?.logger});this.logChunkController=s,null!=(t=this.logChunkController)&&t.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var e,t;null!=(e=this.logChunkController)&&e.downloadLogsBlobInBrowser&&(null==(t=this.logChunkController)||t.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=ed(i,this.name),this.heartbeat=new R.C$,this.crypto=new cF(this,this.logger,e?.keychain),this.history=new uV(this,this.logger),this.expirer=new uZ(this,this.logger),this.storage=null!=e&&e.storage?e.storage:new D.Z(fa(fa({},l_),e?.storageOptions)),this.relayer=new u_({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new uz(this,this.logger),this.verify=new uQ(this,this.logger,this.storage),this.echoClient=new u6(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new ft(this,this.logger,e?.telemetryEnabled),this.setGlobalCore(this)}static async init(e){let t=new fc(e);await t.initialize();let r=await t.crypto.getClientId();return await t.storage.setItem("WALLETCONNECT_CLIENT_ID",r),t}get context(){return eh(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return null==(e=this.logChunkController)?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async addLinkModeSupportedApp(e){this.linkModeSupportedApps.includes(e)||(this.linkModeSupportedApps.push(e),await this.storage.setItem(lR,this.linkModeSupportedApps))}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(
57),await this.pairing.init(),this.linkModeSupportedApps=await this.storage.getItem(lR)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(e,`Core Initialization Failure at epoch ${Date.now()}`),this.logger.error(e.message),e}}getGlobalCore(e=""){try{if(this.isGlobalCoreDisabled())return;let t=`_walletConnectCore_${e}`,r=`${t}_count`;return globalThis[r]=(globalThis[r]||0)+1,globalThis[r]>1&&console.warn(`WalletConnect Core is already initialized. This is probably a mistake and can lead to unexpected behavior. Init() was called ${globalThis[r]} times.`),globalThis[t]}catch(e){console.warn("Failed to get global WalletConnect core",e);return}}setGlobalCore(e){var t;try{if(this.isGlobalCoreDisabled())return;let r=`_walletConnectCore_${(null==(t=e.opts)?void 0:t.customStoragePrefix)||""}`;globalThis[r]=e}catch(e){console.warn("Failed to set global WalletConnect core",e)}}isGlobalCoreDisabled(){try{return"u">typeof lw&&"true"===lw.env.DISABLE_GLOBAL_CORE}catch{return!0}}}let fu="client",ff=`wc@2:${fu}:`,fh={name:fu,logger:"error"},fd="WALLETCONNECT_DEEPLINK_CHOICE",fp="Proposal expired",fg=ej.SEVEN_DAYS,fy={wc_sessionPropose:{req:{ttl:ej.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:ej.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:ej.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:ej.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:ej.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:ej.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:ej.ONE_DAY,prompt:!1,tag:1104},res:{ttl:ej.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:ej.ONE_DAY,prompt:!1,tag:1106},res:{ttl:ej.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:ej.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:ej.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:ej.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:ej.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:ej.ONE_DAY,prompt:!1,tag:1112},res:{ttl:ej.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:ej.ONE_DAY,prompt:!1,tag:1114},res:{ttl:ej.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:ej.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:ej.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:ej.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:ej.FIVE_MINUTES,prompt:!1,tag:1119}}},fm={min:ej.FIVE_MINUTES,max:ej.SEVEN_DAYS},fb={idle:"IDLE",active:"ACTIVE"},fw={eth_sendTransaction:{key:""},eth_sendRawTransaction:{key:""},wallet_sendCalls:{key:""},solana_signTransaction:{key:"signature"},solana_signAllTransactions:{key:"transactions"},solana_signAndSendTransaction:{key:"signature"},sui_signAndExecuteTransaction:{key:"digest"},sui_signTransaction:{key:""},hedera_signAndExecuteTransaction:{key:"transactionId"},hedera_executeTransaction:{key:"transactionId"},near_signTransaction:{key:""},near_signTransactions:{key:""},tron_signTransaction:{key:"txID"},xrpl_signTransaction:{key:""},xrpl_signTransactionFor:{key:""},algo_signTxn:{key:""},sendTransfer:{key:"txid"},stacks_stxTransfer:{key:"txId"},polkadot_signTransaction:{key:""},cosmos_signDirect:{key:""}},fv=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],fE="[email protected]:auth:",fx=`${fE}:PUB_KEY`;var f_=Object.defineProperty,fA=Object.defineProperties,fS=Object.getOwnPropertyDescriptors,fI=Object.getOwnPropertySymbols,fO=Object.prototype.hasOwnProperty,fP=Object.prototype.propertyIsEnumerable,fC=(e,t,r)=>t in e?f_(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,fk=(e,t)=>{for(var r in t||(t={}))fO.call(t,r)&&fC(e,r,t[r]);if(fI)for(var r of fI(t))fP.call(t,r)&&fC(e,r,t[r]);return e},fT=(e,t)=>fA(e,fS(t)),fB=(e,t,r)=>fC(e,"symbol"!=typeof t?t+"":t,r);class fR extends eN{constructor(e){super(e),fB(this,"name","engine"),fB(this,"events",new B),fB(this,"initialized",!1),fB(this,"requestQueue",{state:fb.idle,queue:[]}),fB(this,"sessionRequestQueue",{state:fb.idle,queue:[]}),fB(this,"emittedSessionRequests",new n_({limit:500})),fB(this,"requestQueueDelay",ej.ONE_SECOND),fB(this,"expectedPairingMethodMap",new Map),fB(this,"recentlyDeletedMap",new Map),fB(this,"recentlyDeletedLimit",200),fB(this,"relayMessageCache",[]),fB(this,"pendingSessions",new Map),fB(this,"init",async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),await this.registerLinkModeListeners(),this.client.core.pairing.register({methods:Object.keys(fy)}),this.initialized=!0,setTimeout(async()=>{await this.processPendingMessageEvents(),this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},(0,ej.toMiliseconds)(this.requestQueueDelay)))}),fB(this,"connect",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();let t=fT(fk({},e),{requiredNamespaces:e.requiredNamespaces||{},optionalNamespaces:e.optionalNamespaces||{}});await this.isValidConnect(t),t.optionalNamespaces=function(e,t){var r,n,i,s,o,a;let l=aQ(e),c=aQ(t),u={};for(let e of Object.keys(l).concat(Object.keys(c)))u[e]={chains:ny(null==(r=l[e])?void 0:r.chains,null==(n=c[e])?void 0:n.chains),methods:ny(null==(i=l[e])?void 0:i.methods,null==(s=c[e])?void 0:s.methods),events:ny(null==(o=l[e])?void 0:o.events,null==(a=c[e])?void 0:a.events)};return u}(t.requiredNamespaces,t.optionalNamespaces),t.requiredNamespaces={};let{pairingTopic:r,requiredNamespaces:n,optionalNamespaces:i,sessionProperties:s,scopedProperties:o,relays:a}=t,l=r,c,u=!1;try{if(l){let e=this.client.core.pairing.pairings.get(l);this.client.logger.warn("connect() with existing pairing topic is deprecated and will be removed in the next major release."),u=e.active}}catch(e){throw this.client.logger.error(`connect() -> pairing.get(${l}) failed`),e}if(!l||!u){let{topic:e,uri:t}=await this.client.core.pairing.create({internal:{skipSubscribe:!0}});l=e,c=t}if(!l){let{message:e}=a6("NO_MATCHING_KEY",`connect() pairing topic: ${l}`);throw Error(e)}let f=await this.client.core.crypto.generateKeyPair(),h=fy.wc_sessionPropose.req.ttl||ej.FIVE_MINUTES,d=nd(h),p=fT(fk(fk({requiredNamespaces:n,optionalNamespaces:i,relays:a??[{protocol:"irn"}],proposer:{publicKey:f,metadata:this.client.metadata},expiryTimestamp:d,pairingTopic:l},s&&{sessionProperties:s}),o&&{scopedProperties:o}),{id:(0,ly.payloadId)()}),g=ng("session_connect",p.id),{reject:y,resolve:m,done:b}=nc(h,fp),w=({id:e})=>{e===p.id&&(this.client.events.off("proposal_expire",w),this.pendingSessions.delete(p.id),this.events.emit(g,{error:{message:fp,code:0}}))};return this.client.events.on("proposal_expire",w),this.events.once(g,({error:e,session:t})=>{this.client.events.off("proposal_expire",w),e?y(e):t&&m(t)}),await this.sendProposeSession({proposal:p,publishOpts:{internal:{throwOnFailedPublish:!0},tvf:{correlationId:p.id}}}),await this.setProposal(p.id,p),{uri:c,approval:b}}),fB(this,"pair",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{return await this.client.core.pairing.pair(e)}catch(e){throw this.client.logger.error("pair() failed"),e}}),fB(this,"approve",async e=>{var t,r,n;let i=this.client.core.eventClient.createEvent({properties:{topic:null==(t=e?.id)?void 0:t.toString(),trace:[lW.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(e){throw i.setError(lV.no_internet_connection),e}try{await this.isValidProposalId(e?.id)}catch(t){throw this.client.logger.error(`approve() -> proposal.get(${e?.id}) failed`),i.setError(lV.proposal_not_found),t}try{await this.isValidApprove(e)}catch(e){throw this.client.logger.error("approve() -> isValidApprove() failed"),i.setError(lV.session_approve_namespace_validation_failure),e}let{id:s,relayProtocol:o,namespaces:a,sessionProperties:l,scopedProperties:c,sessionConfig:u}=e,f=this.client.proposal.get(s);this.client.core.eventClient.deleteEvent({eventId:i.eventId});let{pairingTopic:h,proposer:d,requiredNamespaces:p,optionalNamespaces:g}=f,y=null==(r=this.client.core.eventClient)?void 0:r.getEvent({topic:h});y||(y=null==(n=this.client.core.eventClient)?void 0:n.createEvent({type:lW.session_approve_started,properties:{topic:h,trace:[lW.session_approve_started,lW.session_namespaces_validation_success]}}));let m=await this.client.core.crypto.generateKeyPair(),b=d.publicKey,w=await this.client.core.crypto.generateSharedKey(m,b),v=fk(fk(fk({relay:{protocol:o??"irn"},namespaces:a,controller:{publicKey:m,metadata:this.client.metadata},expiry:nd(fg)},l&&{sessionProperties:l}),c&&{scopedProperties:c}),u&&{sessionConfig:u}),E=lT.relay;y.addTrace(lW.subscribing_session_topic);try{await this.client.core.relayer.subscribe(w,{transportType:E,internal:{skipSubscribe:!0}})}catch(e){throw y.setError(lV.subscribe_session_topic_failure),e}y.addTrace(lW.subscribe_session_topic_success);let x=fT(fk({},v),{topic:w,requiredNamespaces:p,optionalNamespaces:g,pairingTopic:h,acknowledged:!1,self:v.controller,peer:{publicKey:d.publicKey,metadata:d.metadata},controller:m,transportType:lT.relay});await this.client.session.set(w,x),y.addTrace(lW.store_session);try{await this.sendApproveSession({sessionTopic:w,proposal:f,pairingProposalResponse:{relay:{protocol:o??"irn"},responderPublicKey:m},sessionSettleRequest:v,publishOpts:{internal:{throwOnFailedPublish:!0},tvf:{correlationId:s}}}),y.addTrace(lW.session_approve_publish_success)}catch(e){throw this.client.logger.error(e),this.client.session.delete(w,a5("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(w),e}return this.client.core.eventClient.deleteEvent({eventId:y.eventId}),await this.client.core.pairing.updateMetadata({topic:h,metadata:d.metadata}),await this.deleteProposal(s),await this.client.core.pairing.activate({topic:h}),await this.setExpiry(w,nd(fg)),{topic:w,acknowledged:()=>Promise.resolve(this.client.session.get(w))}}),fB(this,"reject",async e=>{let t;this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidReject(e)}catch(e){throw this.client.logger.error("reject() -> isValidReject() failed"),e}let{id:r,reason:n}=e;try{t=this.client.proposal.get(r).pairingTopic}catch(e){throw this.client.logger.error(`reject() -> proposal.get(${r}) failed`),e}
57t&&await this.sendError({id:r,topic:t,error:n,rpcOpts:fy.wc_sessionPropose.reject}),await this.deleteProposal(r)}),fB(this,"update",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidUpdate(e)}catch(e){throw this.client.logger.error("update() -> isValidUpdate() failed"),e}let{topic:t,namespaces:r}=e,{done:n,resolve:i,reject:s}=nc(),o=(0,ly.payloadId)(),a=(0,ly.getBigIntRpcId)().toString(),l=this.client.session.get(t).namespaces;return this.events.once(ng("session_update",o),({error:e})=>{e?s(e):i()}),await this.client.session.update(t,{namespaces:r}),await this.sendRequest({topic:t,method:"wc_sessionUpdate",params:{namespaces:r},throwOnFailedPublish:!0,clientRpcId:o,relayRpcId:a}).catch(e=>{this.client.logger.error(e),this.client.session.update(t,{namespaces:l}),s(e)}),{acknowledged:n}}),fB(this,"extend",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidExtend(e)}catch(e){throw this.client.logger.error("extend() -> isValidExtend() failed"),e}let{topic:t}=e,r=(0,ly.payloadId)(),{done:n,resolve:i,reject:s}=nc();return this.events.once(ng("session_extend",r),({error:e})=>{e?s(e):i()}),await this.setExpiry(t,nd(fg)),this.sendRequest({topic:t,method:"wc_sessionExtend",params:{},clientRpcId:r,throwOnFailedPublish:!0}).catch(e=>{s(e)}),{acknowledged:n}}),fB(this,"request",async e=>{this.isInitialized();try{await this.isValidRequest(e)}catch(e){throw this.client.logger.error("request() -> isValidRequest() failed"),e}let{chainId:t,request:r,topic:n,expiry:i=fy.wc_sessionRequest.req.ttl}=e,s=this.client.session.get(n);s?.transportType===lT.relay&&await this.confirmOnlineStateOrThrow();let o=(0,ly.payloadId)(),a=(0,ly.getBigIntRpcId)().toString(),{done:l,resolve:c,reject:u}=nc(i,"Request expired. Please try again.");this.events.once(ng("session_request",o),({error:e,result:t})=>{e?u(e):c(t)});let f="wc_sessionRequest",h=this.getAppLinkIfEnabled(s.peer.metadata,s.transportType);if(h)return await this.sendRequest({clientRpcId:o,relayRpcId:a,topic:n,method:f,params:{request:fT(fk({},r),{expiryTimestamp:nd(i)}),chainId:t},expiry:i,throwOnFailedPublish:!0,appLink:h}).catch(e=>u(e)),this.client.events.emit("session_request_sent",{topic:n,request:r,chainId:t,id:o}),await l();let d={request:fT(fk({},r),{expiryTimestamp:nd(i)}),chainId:t};return await Promise.all([new Promise(async e=>{await this.sendRequest({clientRpcId:o,relayRpcId:a,topic:n,method:f,params:d,expiry:i,throwOnFailedPublish:!0,tvf:this.getTVFParams(o,d)}).catch(e=>u(e)),this.client.events.emit("session_request_sent",{topic:n,request:r,chainId:t,id:o}),e()}),new Promise(async e=>{var t;if(!(null!=(t=s.sessionConfig)&&t.disableDeepLink)){let e=await nb(this.client.core.storage,fd);await nm({id:o,topic:n,wcDeepLink:e})}e()}),l()]).then(e=>e[2])}),fB(this,"respond",async e=>{var t,r;this.isInitialized();let n=this.client.core.eventClient.createEvent({properties:{topic:e?.topic||(null==(r=null==(t=e?.response)?void 0:t.id)?void 0:r.toString()),trace:[lW.session_request_response_started]}});try{await this.isValidRespond(e)}catch(e){throw n.addTrace(e?.message),n.setError(lV.session_request_response_validation_failure),e}n.addTrace(lW.session_request_response_validation_success);let{topic:i,response:s}=e,{id:o}=s,a=this.client.session.get(i);a.transportType===lT.relay&&await this.confirmOnlineStateOrThrow();let l=this.getAppLinkIfEnabled(a.peer.metadata,a.transportType);try{n.addTrace(lW.session_request_response_publish_started),(0,ly.isJsonRpcResult)(s)?await this.sendResult({id:o,topic:i,result:s.result,throwOnFailedPublish:!0,appLink:l}):(0,ly.isJsonRpcError)(s)&&await this.sendError({id:o,topic:i,error:s.error,appLink:l}),this.cleanupAfterResponse(e)}catch(e){throw n.addTrace(e?.message),n.setError(lV.session_request_response_publish_failure),e}}),fB(this,"ping",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();try{await this.isValidPing(e)}catch(e){throw this.client.logger.error("ping() -> isValidPing() failed"),e}let{topic:t}=e;if(this.client.session.keys.includes(t)){let e=(0,ly.payloadId)(),r=(0,ly.getBigIntRpcId)().toString(),{done:n,resolve:i,reject:s}=nc();this.events.once(ng("session_ping",e),({error:e})=>{e?s(e):i()}),await Promise.all([this.sendRequest({topic:t,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:e,relayRpcId:r}),n()])}else this.client.core.pairing.pairings.keys.includes(t)&&(this.client.logger.warn("ping() on pairing topic is deprecated and will be removed in the next major release."),await this.client.core.pairing.ping({topic:t}))}),fB(this,"emit",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(e);let{topic:t,event:r,chainId:n}=e,i=(0,ly.getBigIntRpcId)().toString(),s=(0,ly.payloadId)();await this.sendRequest({topic:t,method:"wc_sessionEvent",params:{event:r,chainId:n},throwOnFailedPublish:!0,relayRpcId:i,clientRpcId:s})}),fB(this,"disconnect",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidDisconnect(e);let{topic:t}=e;if(this.client.session.keys.includes(t))await this.sendRequest({topic:t,method:"wc_sessionDelete",params:a5("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:t,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(t))await this.client.core.pairing.disconnect({topic:t});else{let{message:e}=a6("MISMATCHED_TOPIC",`Session or pairing topic not found: ${t}`);throw Error(e)}}),fB(this,"find",e=>(this.isInitialized(),this.client.session.getAll().filter(t=>(function(e,t){let{requiredNamespaces:r}=t,n=Object.keys(e.namespaces),i=Object.keys(r),s=!0;return!!no(i,n)&&(n.forEach(t=>{let{accounts:n,methods:i,events:o}=e.namespaces[t],a=aJ(n),l=r[t];no(rY(t,l),a)&&no(l.methods,i)&&no(l.events,o)||(s=!1)}),s)})(t,e)))),fB(this,"getPendingSessionRequests",()=>
57this.client.pendingRequest.getAll()),fB(this,"authenticate",async(e,t)=>{var r,n,i;let s;this.isInitialized(),this.isValidAuthenticate(e);let o=t&&this.client.core.linkModeSupportedApps.includes(t)&&(null==(r=this.client.metadata.redirect)?void 0:r.linkMode),a=o?lT.link_mode:lT.relay;a===lT.relay&&await this.confirmOnlineStateOrThrow();let{chains:l,statement:c="",uri:u,domain:f,nonce:h,type:d,exp:p,nbf:g,methods:y=[],expiry:m}=e,b=[...e.resources||[]],{topic:w,uri:v}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:a});this.client.logger.info({message:"Generated new pairing",pairing:{topic:w,uri:v}});let E=await this.client.core.crypto.generateKeyPair(),x=ab(E);if(await Promise.all([this.client.auth.authKeys.set(fx,{responseTopic:x,publicKey:E}),this.client.auth.pairingTopics.set(x,{topic:x,pairingTopic:w})]),await this.client.core.relayer.subscribe(x,{transportType:a}),this.client.logger.info(`sending request to new pairing topic: ${w}`),y.length>0){let{namespace:e}=rJ(l[0]),t=sp(function(e,t,r,n={}){return r?.sort((e,t)=>e.localeCompare(t)),{att:{[e]:function(e,t,r={}){return Object.assign({},...(t=t?.sort((e,t)=>e.localeCompare(t))).map(t=>({[`${e}/${t}`]:[r]})))}(t,r,n)}}}(e,"request",y));sb(b)&&(n=t,i=b.pop(),t=sp(function(e,t){sd(e),sd(t);let r=Object.keys(e.att).concat(Object.keys(t.att)).sort((e,t)=>e.localeCompare(t)),n={att:{}};return r.forEach(r=>{var i,s;Object.keys((null==(i=e.att)?void 0:i[r])||{}).concat(Object.keys((null==(s=t.att)?void 0:s[r])||{})).sort((e,t)=>e.localeCompare(t)).forEach(i=>{var s,o;n.att[r]=so(ss({},n.att[r]),{[i]:(null==(s=e.att[r])?void 0:s[i])||(null==(o=t.att[r])?void 0:o[i])})})}),n}(sg(n),sg(i)))),b.push(t)}let _=m&&m>fy.wc_sessionAuthenticate.req.ttl?m:fy.wc_sessionAuthenticate.req.ttl,A={authPayload:{type:d??"caip122",chains:l,statement:c,aud:u,domain:f,version:"1",nonce:h,iat:new Date().toISOString(),exp:p,nbf:g,resources:b},requester:{publicKey:E,metadata:this.client.metadata},expiryTimestamp:nd(_)},S={requiredNamespaces:{},optionalNamespaces:{eip155:{chains:l,methods:[...new Set(["personal_sign",...y])],events:["chainChanged","accountsChanged"]}},relays:[{protocol:"irn"}],pairingTopic:w,proposer:{publicKey:E,metadata:this.client.metadata},expiryTimestamp:nd(fy.wc_sessionPropose.req.ttl),id:(0,ly.payloadId)()},{done:I,resolve:O,reject:P}=nc(_,"Request expired"),C=(0,ly.payloadId)(),k=ng("session_connect",S.id),T=ng("session_request",C),B=async({error:e,session:t})=>{this.events.off(T,R),e?P(e):t&&O({session:t})},R=async e=>{var r,n,i;let s;if(await this.deletePendingAuthRequest(C,{message:"fulfilled",code:0}),e.error){let t=a5("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return e.error.code===t.code?void 0:(this.events.off(k,B),P(e.error.message))}await this.deleteProposal(S.id),this.events.off(k,B);let{cacaos:o,responder:l}=e.result,c=[],u=[];for(let e of o){await sf({cacao:e,projectId:this.client.core.projectId})||(this.client.logger.error(e,"Signature verification failed"),P(a5("SESSION_SETTLEMENT_FAILED","Signature verification failed")));let{p:t}=e,r=sb(t.resources),n=[sc(t.iss)],i=su(t.iss);if(r){let e=sy(r),t=sm(r);c.push(...e),n.push(...t)}for(let e of n)u.push(`${e}:${i}`)}let f=await this.client.core.crypto.generateSharedKey(E,l.publicKey);c.length>0&&(s={topic:f,acknowledged:!0,self:{publicKey:E,metadata:this.client.metadata},peer:l,controller:l.publicKey,expiry:nd(fg),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:w,namespaces:a0([...new Set(c)],[...new Set(u)]),transportType:a},await this.client.core.relayer.subscribe(f,{transportType:a}),await this.client.session.set(f,s),w&&await this.client.core.pairing.updateMetadata({topic:w,metadata:l.metadata}),s=this.client.session.get(f)),null!=(r=this.client.metadata.redirect)&&r.linkMode&&null!=(n=l.metadata.redirect)&&n.linkMode&&null!=(i=l.metadata.redirect)&&i.universal&&t&&(this.client.core.addLinkModeSupportedApp(l.metadata.redirect.universal),this.client.session.update(f,{transportType:lT.link_mode})),O({auths:o,session:s})};this.events.once(k,B),this.events.once(T,R);try{if(o){let e=(0,ly.formatJsonRpcRequest)("wc_sessionAuthenticate",A,C);this.client.core.history.set(w,e);let r=await this.client.core.crypto.encode("",e,{type:2,encoding:ag});s=a$(t,w,r)}else await Promise.all([this.sendRequest({topic:w,method:"wc_sessionAuthenticate",params:A,expiry:e.expiry,throwOnFailedPublish:!0,clientRpcId:C}),this.sendRequest({topic:w,method:"wc_sessionPropose",params:S,expiry:fy.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:S.id})])}catch(e){throw this.events.off(k,B),this.events.off(T,R),e}return await this.setProposal(S.id,S),await this.setAuthRequest(C,{request:fT(fk({},A),{verifyContext:{}}),pairingTopic:w,transportType:a}),{uri:s??v,response:I}}),fB(this,"approveSessionAuthenticate",async e=>{let t;let{id:r,auths:n}=e,i=this.client.core.eventClient.createEvent({properties:{topic:r.toString(),trace:[lH.authenticated_session_approve_started]}});try{this.isInitialized()}catch(e){throw i.setError(lG.no_internet_connection),e}let s=this.getPendingAuthRequest(r);if(!s)throw i.setError(lG.authenticated_session_pending_request_not_found),Error(`Could not find pending auth request with id ${r}`);let o=s.transportType||lT.relay;o===lT.relay&&await this.confirmOnlineStateOrThrow();let a=s.requester.publicKey,l=await this.client.core.crypto.generateKeyPair(),c=ab(a),u={type:1,receiverPublicKey:a,senderPublicKey:l},f=[],h=[];for(let e of n){if(!await sf({cacao:e,projectId:this.client.core.projectId})){i.setError(lG.invalid_cacao);let e=a5("SESSION_SETTLEMENT_FAILED","Signature verification failed");
57throw await this.sendError({id:r,topic:c,error:e,encodeOpts:u}),Error(e.message)}i.addTrace(lH.cacaos_verified);let{p:t}=e,n=sb(t.resources),s=[sc(t.iss)],o=su(t.iss);if(n){let e=sy(n),t=sm(n);f.push(...e),s.push(...t)}for(let e of s)h.push(`${e}:${o}`)}let d=await this.client.core.crypto.generateSharedKey(l,a);if(i.addTrace(lH.create_authenticated_session_topic),f?.length>0){t={topic:d,acknowledged:!0,self:{publicKey:l,metadata:this.client.metadata},peer:{publicKey:a,metadata:s.requester.metadata},controller:a,expiry:nd(fg),authentication:n,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:s.pairingTopic,namespaces:a0([...new Set(f)],[...new Set(h)]),transportType:o},i.addTrace(lH.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(d,{transportType:o})}catch(e){throw i.setError(lG.subscribe_authenticated_session_topic_failure),e}i.addTrace(lH.subscribe_authenticated_session_topic_success),await this.client.session.set(d,t),i.addTrace(lH.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:s.pairingTopic,metadata:s.requester.metadata})}i.addTrace(lH.publishing_authenticated_session_approve);try{await this.sendResult({topic:c,id:r,result:{cacaos:n,responder:{publicKey:l,metadata:this.client.metadata}},encodeOpts:u,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(s.requester.metadata,o)})}catch(e){throw i.setError(lG.authenticated_session_approve_publish_failure),e}return await this.client.auth.requests.delete(r,{message:"fulfilled",code:0}),await this.client.core.pairing.activate({topic:s.pairingTopic}),this.client.core.eventClient.deleteEvent({eventId:i.eventId}),{session:t}}),fB(this,"rejectSessionAuthenticate",async e=>{this.isInitialized();let{id:t,reason:r}=e,n=this.getPendingAuthRequest(t);if(!n)throw Error(`Could not find pending auth request with id ${t}`);n.transportType===lT.relay&&await this.confirmOnlineStateOrThrow();let i=n.requester.publicKey,s=await this.client.core.crypto.generateKeyPair(),o=ab(i);await this.sendError({id:t,topic:o,error:r,encodeOpts:{type:1,receiverPublicKey:i,senderPublicKey:s},rpcOpts:fy.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(n.requester.metadata,n.transportType)}),await this.client.auth.requests.delete(t,{message:"rejected",code:0}),await this.deleteProposal(t)}),fB(this,"formatAuthMessage",e=>{this.isInitialized();let{request:t,iss:r}=e;return sh(t,r)}),fB(this,"processRelayMessageCache",()=>{setTimeout(async()=>{if(0!==this.relayMessageCache.length)for(;this.relayMessageCache.length>0;)try{let e=this.relayMessageCache.shift();e&&await this.onRelayMessage(e)}catch(e){this.client.logger.error(e)}},50)}),fB(this,"cleanupDuplicatePairings",async e=>{if(e.pairingTopic)try{let t=this.client.core.pairing.pairings.get(e.pairingTopic),r=this.client.core.pairing.pairings.getAll().filter(r=>{var n,i;return(null==(n=r.peerMetadata)?void 0:n.url)&&(null==(i=r.peerMetadata)?void 0:i.url)===e.peer.metadata.url&&r.topic&&r.topic!==t.topic});if(0===r.length)return;this.client.logger.info(`Cleaning up ${r.length} duplicate pairing(s)`),await Promise.all(r.map(e=>this.client.core.pairing.disconnect({topic:e.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(e){this.client.logger.error(e)}}),fB(this,"deleteSession",async e=>{var t;let{topic:r,expirerHasDeleted:n=!1,emitEvent:i=!0,id:s=0}=e,{self:o}=this.client.session.get(r);await this.client.core.relayer.unsubscribe(r),await this.client.session.delete(r,a5("USER_DISCONNECTED")),this.addToRecentlyDeleted(r,"session"),this.client.core.crypto.keychain.has(o.publicKey)&&await this.client.core.crypto.deleteKeyPair(o.publicKey),this.client.core.crypto.keychain.has(r)&&await this.client.core.crypto.deleteSymKey(r),n||this.client.core.expirer.del(r),this.client.core.storage.removeItem(fd).catch(e=>this.client.logger.warn(e)),this.getPendingSessionRequests().forEach(e=>{e.topic===r&&this.deletePendingSessionRequest(e.id,a5("USER_DISCONNECTED"))}),r===(null==(t=this.sessionRequestQueue.queue[0])?void 0:t.topic)&&(this.sessionRequestQueue.state=fb.idle),i&&this.client.events.emit("session_delete",{id:s,topic:r})}),fB(this,"deleteProposal",async(e,t)=>{if(t)try{let t=this.client.proposal.get(e),r=this.client.core.eventClient.getEvent({topic:t.pairingTopic});r?.setError(lV.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(e,a5("USER_DISCONNECTED")),t?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"proposal")}),fB(this,"deletePendingSessionRequest",async(e,t,r=!1)=>
57{await Promise.all([this.client.pendingRequest.delete(e,t),r?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(t=>t.id!==e),r&&(this.sessionRequestQueue.state=fb.idle,this.client.events.emit("session_request_expire",{id:e}))}),fB(this,"deletePendingAuthRequest",async(e,t,r=!1)=>{await Promise.all([this.client.auth.requests.delete(e,t),r?Promise.resolve():this.client.core.expirer.del(e)])}),fB(this,"setExpiry",async(e,t)=>{this.client.session.keys.includes(e)&&(this.client.core.expirer.set(e,t),await this.client.session.update(e,{expiry:t}))}),fB(this,"setProposal",async(e,t)=>{this.client.core.expirer.set(e,nd(fy.wc_sessionPropose.req.ttl)),await this.client.proposal.set(e,t)}),fB(this,"setAuthRequest",async(e,t)=>{let{request:r,pairingTopic:n,transportType:i=lT.relay}=t;this.client.core.expirer.set(e,r.expiryTimestamp),await this.client.auth.requests.set(e,{authPayload:r.authPayload,requester:r.requester,expiryTimestamp:r.expiryTimestamp,id:e,pairingTopic:n,verifyContext:r.verifyContext,transportType:i})}),fB(this,"setPendingSessionRequest",async e=>{let{id:t,topic:r,params:n,verifyContext:i}=e,s=n.request.expiryTimestamp||nd(fy.wc_sessionRequest.req.ttl);this.client.core.expirer.set(t,s),await this.client.pendingRequest.set(t,{id:t,topic:r,params:n,verifyContext:i})}),fB(this,"sendRequest",async e=>{let t,r;let{topic:n,method:i,params:s,expiry:o,relayRpcId:a,clientRpcId:l,throwOnFailedPublish:c,appLink:u,tvf:f,publishOpts:h={}}=e,d=(0,ly.formatJsonRpcRequest)(i,s,l),p=!!u;try{let e=p?ag:ap;t=await this.client.core.crypto.encode(n,d,{encoding:e})}catch(e){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),e}if(fv.includes(i)){let e=aw(JSON.stringify(d)),n=aw(t);r=await this.client.core.verify.register({id:n,decryptedId:e})}let g=fk(fk({},fy[i].req),h);if(g.attestation=r,o&&(g.ttl=o),a&&(g.id=a),this.client.core.history.set(n,d),p){let e=a$(u,n,t);await global.Linking.openURL(e,this.client.name)}else g.tvf=fT(fk({},f),{correlationId:d.id}),c?(g.internal=fT(fk({},g.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,t,g)):this.client.core.relayer.publish(n,t,g).catch(e=>this.client.logger.error(e));return d.id}),fB(this,"sendProposeSession",async e=>{let{proposal:t,publishOpts:r}=e,n=(0,ly.formatJsonRpcRequest)("wc_sessionPropose",t,t.id);this.client.core.history.set(t.pairingTopic,n);let i=await this.client.core.crypto.encode(t.pairingTopic,n,{encoding:ap}),s=aw(JSON.stringify(n)),o=aw(i),a=await this.client.core.verify.register({id:o,decryptedId:s});await this.client.core.relayer.publishCustom({payload:{pairingTopic:t.pairingTopic,sessionProposal:i},opts:fT(fk({},r),{publishMethod:"wc_proposeSession",attestation:a})})}),fB(this,"sendApproveSession",async e=>{let{sessionTopic:t,pairingProposalResponse:r,proposal:n,sessionSettleRequest:i,publishOpts:s}=e,o=(0,ly.formatJsonRpcResult)(n.id,r),a=await this.client.core.crypto.encode(n.pairingTopic,o,{encoding:ap}),l=(0,ly.formatJsonRpcRequest)("wc_sessionSettle",i,s?.id),c=await this.client.core.crypto.encode(t,l,{encoding:ap});this.client.core.history.set(t,l),await this.client.core.relayer.publishCustom({payload:{sessionTopic:t,pairingTopic:n.pairingTopic,sessionProposalResponse:a,sessionSettlementRequest:c},opts:fT(fk({},s),{publishMethod:"wc_approveSession"})})}),fB(this,"sendResult",async e=>{let t,r,n;let{id:i,topic:s,result:o,throwOnFailedPublish:a,encodeOpts:l,appLink:c}=e,u=(0,ly.formatJsonRpcResult)(i,o),f=c&&"u">typeof(null==global?void 0:global.Linking);try{let e=f?ag:ap;t=await this.client.core.crypto.encode(s,u,fT(fk({},l||{}),{encoding:e}))}catch(e){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${s} failed`),e}try{let e=(r=await this.client.core.history.get(s,i)).request;try{n=this.getTVFParams(i,e.params,o)}catch(e){this.client.logger.warn(`sendResult() -> getTVFParams() failed: ${e?.message}`)}}catch(e){throw this.client.logger.error(`sendResult() -> history.get(${s}, ${i}) failed`),e}if(f){let e=a$(c,s,t);await global.Linking.openURL(e,this.client.name)}else{let e=fy[r.request.method].res;e.tvf=fT(fk({}
57,n),{correlationId:i}),a?(e.internal=fT(fk({},e.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(s,t,e)):this.client.core.relayer.publish(s,t,e).catch(e=>this.client.logger.error(e))}await this.client.core.history.resolve(u)}),fB(this,"sendError",async e=>{let t,r;let{id:n,topic:i,error:s,encodeOpts:o,rpcOpts:a,appLink:l}=e,c=(0,ly.formatJsonRpcError)(n,s),u=l&&"u">typeof(null==global?void 0:global.Linking);try{let e=u?ag:ap;t=await this.client.core.crypto.encode(i,c,fT(fk({},o||{}),{encoding:e}))}catch(e){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${i} failed`),e}try{r=await this.client.core.history.get(i,n)}catch(e){throw this.client.logger.error(`sendError() -> history.get(${i}, ${n}) failed`),e}if(u){let e=a$(l,i,t);await global.Linking.openURL(e,this.client.name)}else{let e=r.request.method,n=a||fy[e].res;this.client.core.relayer.publish(i,t,n)}await this.client.core.history.resolve(c)}),fB(this,"cleanup",async()=>{let e=[],t=[];this.client.session.getAll().forEach(t=>{let r=!1;np(t.expiry)&&(r=!0),this.client.core.crypto.keychain.has(t.topic)||(r=!0),r&&e.push(t.topic)}),this.client.proposal.getAll().forEach(e=>{np(e.expiryTimestamp)&&t.push(e.id)}),await Promise.all([...e.map(e=>this.deleteSession({topic:e})),...t.map(e=>this.deleteProposal(e))])}),fB(this,"onProviderMessageEvent",async e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):await this.onRelayMessage(e)}),fB(this,"onRelayEventRequest",async e=>{this.requestQueue.queue.push(e),await this.processRequestsQueue()}),fB(this,"processRequestsQueue",async()=>{if(this.requestQueue.state===fb.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=fb.active;let e=this.requestQueue.queue.shift();if(e)try{await this.processRequest(e)}catch(e){this.client.logger.warn(e)}}this.requestQueue.state=fb.idle}),fB(this,"processRequest",async e=>{let{topic:t,payload:r,attestation:n,transportType:i,encryptedId:s}=e,o=r.method;if(!this.shouldIgnorePairingRequest({topic:t,requestMethod:o}))switch(o){case"wc_sessionPropose":return await this.onSessionProposeRequest
57({topic:t,payload:r,attestation:n,encryptedId:s});case"wc_sessionSettle":return await this.onSessionSettleRequest(t,r);case"wc_sessionUpdate":return await this.onSessionUpdateRequest(t,r);case"wc_sessionExtend":return await this.onSessionExtendRequest(t,r);case"wc_sessionPing":return await this.onSessionPingRequest(t,r);case"wc_sessionDelete":return await this.onSessionDeleteRequest(t,r);case"wc_sessionRequest":return await this.onSessionRequest({topic:t,payload:r,attestation:n,encryptedId:s,transportType:i});case"wc_sessionEvent":return await this.onSessionEventRequest(t,r);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:t,payload:r,attestation:n,encryptedId:s,transportType:i});default:return this.client.logger.info(`Unsupported request method ${o}`)}}),fB(this,"onRelayEventResponse",async e=>{let{topic:t,payload:r,transportType:n}=e,i=(await this.client.core.history.get(t,r.id)).request.method;switch(i){case"wc_sessionPropose":return this.onSessionProposeResponse(t,r,n);case"wc_sessionSettle":return this.onSessionSettleResponse(t,r);case"wc_sessionUpdate":return this.onSessionUpdateResponse(t,r);case"wc_sessionExtend":return this.onSessionExtendResponse(t,r);case"wc_sessionPing":return this.onSessionPingResponse(t,r);case"wc_sessionRequest":return this.onSessionRequestResponse(t,r);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(t,r);default:return this.client.logger.info(`Unsupported response method ${i}`)}}),fB(this,"onRelayEventUnknownPayload",e=>{let{topic:t}=e,{message:r}=a6("MISSING_OR_INVALID",`Decoded payload on topic ${t} is not identifiable as a JSON-RPC request or a response.`);throw Error(r)}),fB(this,"shouldIgnorePairingRequest",e=>{let{topic:t,requestMethod:r}=e,n=this.expectedPairingMethodMap.get(t);return!(!n||n.includes(r))&&!!(n.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)}),fB(this,"onSessionProposeRequest",async e=>{let{topic:t,payload:r,attestation:n,encryptedId:i}=e,{params:s,id:o}=r;try{let e=this.client.core.eventClient.getEvent({topic:t});0===this.client.events.listenerCount("session_proposal")&&(console.warn("No listener for session_proposal event"),e?.setError(lq.proposal_listener_not_found)),this.isValidConnect(fk({},r.params));let a=s.expiryTimestamp||nd(fy.wc_sessionPropose.req.ttl),l=fk({id:o,pairingTopic:t,expiryTimestamp:a,attestation:n,encryptedId:i},s);await this.setProposal(o,l);let c=await this.getVerifyContext({attestationId:n,hash:aw(JSON.stringify(r)),encryptedId:i,metadata:l.proposer.metadata});e?.addTrace(lF.emit_session_proposal),this.client.events.emit("session_proposal",{id:o,params:l,verifyContext:c})}catch(e){await this.sendError({id:o,topic:t,error:e,rpcOpts:fy.wc_sessionPropose.autoReject}),this.client.logger.error(e)}}),fB(this,"onSessionProposeResponse",async(e,t,r)=>{let{id:n}=t;if((0,ly.isJsonRpcResult)(t)){let{result:i}=t;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:i});let s=this.client.proposal.get(n);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:s});let o=s.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:o});let a=i.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:a});let l=await this.client.core.crypto.generateSharedKey(o,a);this.pendingSessions.set(n,{sessionTopic:l,pairingTopic:e,proposalId:n,publicKey:o});let c=await this.client.core.relayer.subscribe(l,{transportType:r});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:c}),await this.client.core.pairing.activate({topic:e})}else if((0,ly.isJsonRpcError)(t)){await this.deleteProposal(n);let e=ng("session_connect",n);if(0===this.events.listenerCount(e))throw Error(`emitting ${e} without any listeners, 954`);this.events.emit(e,{error:t.error})}}),fB(this,"onSessionSettleRequest",async(e,t)=>{let{id:r,params:n}=t;try{this.isValidSessionSettleRequest(n);let{relay:r,controller:i,expiry:s,namespaces:o,sessionProperties:a,scopedProperties:l,sessionConfig:c}=t.params,u=[...this.pendingSessions.values()].find(t=>t.sessionTopic===e);if(!u)return this.client.logger.error(`Pending session not found for topic ${e}`);let f=this.client.proposal.get(u.proposalId),h=fT(fk(fk(fk({topic:e,relay:r,expiry:s,namespaces:o,acknowledged:!0,pairingTopic:u.pairingTopic,requiredNamespaces:f.requiredNamespaces,optionalNamespaces:f.optionalNamespaces,controller:i.publicKey,self:{publicKey:u.publicKey,metadata:this.client.metadata},peer:{publicKey:i.publicKey,metadata:i.metadata}},a&&{sessionProperties:a}),l&&{scopedProperties:l}),c&&{sessionConfig:c}
57),{transportType:lT.relay});await this.client.session.set(h.topic,h),await this.setExpiry(h.topic,h.expiry),await this.client.core.pairing.updateMetadata({topic:u.pairingTopic,metadata:h.peer.metadata}),this.client.events.emit("session_connect",{session:h}),this.events.emit(ng("session_connect",u.proposalId),{session:h}),this.pendingSessions.delete(u.proposalId),this.deleteProposal(u.proposalId,!1),this.cleanupDuplicatePairings(h),await this.sendResult({id:t.id,topic:e,result:!0})}catch(t){await this.sendError({id:r,topic:e,error:t}),this.client.logger.error(t)}}),fB(this,"onSessionSettleResponse",async(e,t)=>{let{id:r}=t;(0,ly.isJsonRpcResult)(t)?(await this.client.session.update(e,{acknowledged:!0}),this.events.emit(ng("session_approve",r),{})):(0,ly.isJsonRpcError)(t)&&(await this.client.session.delete(e,a5("USER_DISCONNECTED")),this.events.emit(ng("session_approve",r),{error:t.error}))}),fB(this,"onSessionUpdateRequest",async(e,t)=>{let{params:r,id:n}=t;try{let t=`${e}_session_update`,i=lh.get(t);if(i&&this.isRequestOutOfSync(i,n)){this.client.logger.warn(`Discarding out of sync request - ${n}`),this.sendError({id:n,topic:e,error:a5("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(fk({topic:e},r));try{lh.set(t,n),await this.client.session.update(e,{namespaces:r.namespaces}),await this.sendResult({id:n,topic:e,result:!0})}catch(e){throw lh.delete(t),e}this.client.events.emit("session_update",{id:n,topic:e,params:r})}catch(t){await this.sendError({id:n,topic:e,error:t}),this.client.logger.error(t)}}),fB(this,"isRequestOutOfSync",(e,t)=>t.toString().slice(0,-3)<e.toString().slice(0,-3)),fB(this,"onSessionUpdateResponse",(e,t)=>{let{id:r}=t,n=ng("session_update",r);if(0===this.events.listenerCount(n))throw Error(`emitting ${n} without any listeners`);(0,ly.isJsonRpcResult)(t)?this.events.emit(ng("session_update",r),{}):(0,ly.isJsonRpcError)(t)&&this.events.emit(ng("session_update",r),{error:t.error})}),fB(this,"onSessionExtendRequest",async(e,t)=>{let{id:r}=t;try{this.isValidExtend({topic:e}),await this.setExpiry(e,nd(fg)),await this.sendResult({id:r,topic:e,result:!0}),this.client.events.emit("session_extend",{id:r,topic:e})}catch(t){await this.sendError({id:r,topic:e,error:t}),this.client.logger.error(t)}}),fB(this,"onSessionExtendResponse",(e,t)=>{let{id:r}=t,n=ng("session_extend",r);if(0===this.events.listenerCount(n))throw Error(`emitting ${n} without any listeners`);(0,ly.isJsonRpcResult)(t)?this.events.emit(ng("session_extend",r),{}):(0,ly.isJsonRpcError)(t)&&this.events.emit(ng("session_extend",r),{error:t.error})}),fB(this,"onSessionPingRequest",async(e,t)=>{let{id:r}=t;try{this.isValidPing({topic:e}),await this.sendResult({id:r,topic:e,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:r,topic:e})}catch(t){await this.sendError({id:r,topic:e,error:t}),this.client.logger.error(t)}}),fB(this,"onSessionPingResponse",(e,t)=>{let{id:r}=t,n=ng("session_ping",r);setTimeout(()=>{if(0===this.events.listenerCount(n))throw Error(`emitting ${n} without any listeners 2176`);(0,ly.isJsonRpcResult)(t)?this.events.emit(ng("session_ping",r),{}):(0,ly.isJsonRpcError)(t)&&this.events.emit(ng("session_ping",r),{error:t.error})},500)}),fB(this,"onSessionDeleteRequest",async(e,t)=>{let{id:r}=t;try{this.isValidDisconnect({topic:e,reason:t.params}),await Promise.all([new Promise(t=>{this.client.core.relayer.once(lP.publish,async()=>{t(await this.deleteSession({topic:e,id:r}))})}),this.sendResult({id:r,topic:e,result:!0}),this.cleanupPendingSentRequestsForTopic({topic:e,error:a5("USER_DISCONNECTED")})]).catch(e=>this.client.logger.error(e))}catch(e){this.client.logger.error(e)}}),fB(this,"onSessionRequest",async e=>{var t,r,n;let{topic:i,payload:s,attestation:o,encryptedId:a,transportType:l}=e,{id:c,params:u}=s;try{await this.isValidRequest(fk({topic:i},u));let e=this.client.session.get(i),s=await this.getVerifyContext({attestationId:o,hash:aw(JSON.stringify((0,ly.formatJsonRpcRequest)("wc_sessionRequest",u,c))),encryptedId:a,metadata:e.peer.metadata,transportType:l}),f={id:c,topic:i,params:u,verifyContext:s};await this.setPendingSessionRequest(f),l===lT.link_mode&&null!=(t=e.peer.metadata.redirect)&&t.universal&&this.client.core.addLinkModeSupportedApp(null==(r=e.peer.metadata.redirect)?void 0:r.universal),null!=(n=this.client.signConfig)&&n.disableRequestQueue?this.emitSessionRequest(f):(this.addSessionRequestToSessionRequestQueue(f),this.processSessionRequestQueue())}
57catch(e){await this.sendError({id:c,topic:i,error:e}),this.client.logger.error(e)}}),fB(this,"onSessionRequestResponse",(e,t)=>{let{id:r}=t,n=ng("session_request",r);if(0===this.events.listenerCount(n))throw Error(`emitting ${n} without any listeners`);(0,ly.isJsonRpcResult)(t)?this.events.emit(ng("session_request",r),{result:t.result}):(0,ly.isJsonRpcError)(t)&&this.events.emit(ng("session_request",r),{error:t.error})}),fB(this,"onSessionEventRequest",async(e,t)=>{let{id:r,params:n}=t;try{let t=`${e}_session_event_${n.event.name}`,i=lh.get(t);if(i&&this.isRequestOutOfSync(i,r)){this.client.logger.info(`Discarding out of sync request - ${r}`);return}this.isValidEmit(fk({topic:e},n)),this.client.events.emit("session_event",{id:r,topic:e,params:n}),lh.set(t,r)}catch(t){await this.sendError({id:r,topic:e,error:t}),this.client.logger.error(t)}}),fB(this,"onSessionAuthenticateResponse",(e,t)=>{let{id:r}=t;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:e,payload:t}),(0,ly.isJsonRpcResult)(t)?this.events.emit(ng("session_request",r),{result:t.result}):(0,ly.isJsonRpcError)(t)&&this.events.emit(ng("session_request",r),{error:t.error})}),fB(this,"onSessionAuthenticateRequest",async e=>{var t;let{topic:r,payload:n,attestation:i,encryptedId:s,transportType:o}=e;try{let{requester:e,authPayload:a,expiryTimestamp:l}=n.params,c=await this.getVerifyContext({attestationId:i,hash:aw(JSON.stringify(n)),encryptedId:s,metadata:e.metadata,transportType:o}),u={requester:e,pairingTopic:r,id:n.id,authPayload:a,verifyContext:c,expiryTimestamp:l};await this.setAuthRequest(n.id,{request:u,pairingTopic:r,transportType:o}),o===lT.link_mode&&null!=(t=e.metadata.redirect)&&t.universal&&this.client.core.addLinkModeSupportedApp(e.metadata.redirect.universal),this.client.events.emit("session_authenticate",{topic:r,params:n.params,id:n.id,verifyContext:c})}catch(s){this.client.logger.error(s);let e=n.params.requester.publicKey,t=await this.client.core.crypto.generateKeyPair(),i=this.getAppLinkIfEnabled(n.params.requester.metadata,o);await this.sendError({id:n.id,topic:r,error:s,encodeOpts:{type:1,receiverPublicKey:e,senderPublicKey:t},rpcOpts:fy.wc_sessionAuthenticate.autoReject,appLink:i})}}),fB(this,"addSessionRequestToSessionRequestQueue",e=>{this.sessionRequestQueue.queue.push(e)}),fB(this,"cleanupAfterResponse",e=>{this.deletePendingSessionRequest(e.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=fb.idle,this.processSessionRequestQueue()},(0,ej.toMiliseconds)(this.requestQueueDelay))}),fB(this,"cleanupPendingSentRequestsForTopic",({topic:e,error:t})=>{let r=this.client.core.history.pending;r.length>0&&r.filter(t=>t.topic===e&&"wc_sessionRequest"===t.request.method).forEach(e=>{let r=ng("session_request",e.request.id);if(0===this.events.listenerCount(r))throw Error(`emitting ${r} without any listeners`);this.events.emit(ng("session_request",e.request.id),{error:t})})}),fB(this,"processSessionRequestQueue",()=>{if(this.sessionRequestQueue.state===fb.active){this.client.logger.info("session request queue is already active.");return}let e=this.sessionRequestQueue.queue[0];if(!e){this.client.logger.info("session request queue is empty.");return}try{this.emitSessionRequest(e)}catch(e){this.client.logger.error(e)}}),fB(this,"emitSessionRequest",e=>{if(this.emittedSessionRequests.has(e.id)){this.client.logger.warn({id:e.id},`Skipping emitting \`session_request\` event for duplicate request. id: ${e.id}`);return}this.sessionRequestQueue.state=fb.active,this.emittedSessionRequests.add(e.id),this.client.events.emit("session_request",e)}),fB(this,"onPairingCreated",e=>{if(e.methods&&this.expectedPairingMethodMap.set(e.topic,e.methods),e.active)return;let t=this.client.proposal.getAll().find(t=>t.pairingTopic===e.topic);
57t&&this.onSessionProposeRequest({topic:e.topic,payload:(0,ly.formatJsonRpcRequest)("wc_sessionPropose",fT(fk({},t),{requiredNamespaces:t.requiredNamespaces,optionalNamespaces:t.optionalNamespaces,relays:t.relays,proposer:t.proposer,sessionProperties:t.sessionProperties,scopedProperties:t.scopedProperties}),t.id),attestation:t.attestation,encryptedId:t.encryptedId})}),fB(this,"isValidConnect",async e=>{let t;if(!ls(e)){let{message:t}=a6("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(e)}`);throw Error(t)}let{pairingTopic:r,requiredNamespaces:n,optionalNamespaces:i,sessionProperties:s,scopedProperties:o,relays:a}=e;if(a4(r)||await this.isValidPairingTopic(r),t=!1,a?a&&a8(a)&&a.length&&a.forEach(e=>{t=li(e)}):t=!0,!t){let{message:e}=a6("MISSING_OR_INVALID",`connect() relays: ${a}`);throw Error(e)}if(n&&!a4(n)&&0!==a3(n)){let e="requiredNamespaces are deprecated and are automatically assigned to optionalNamespaces";["fatal","error","silent"].includes(this.client.logger.level)?console.warn(e):this.client.logger.warn(e),this.validateNamespaces(n,"requiredNamespaces")}if(i&&!a4(i)&&0!==a3(i)&&this.validateNamespaces(i,"optionalNamespaces"),s&&!a4(s)&&this.validateSessionProps(s,"sessionProperties"),o&&!a4(o)){this.validateSessionProps(o,"scopedProperties");let e=Object.keys(n||{}).concat(Object.keys(i||{}));if(!Object.keys(o).every(t=>e.includes(t.split(":")[0])))throw Error(`Scoped properties must be a subset of required/optional namespaces, received: ${JSON.stringify(o)}, required/optional namespaces: ${JSON.stringify(e)}`)}}),fB(this,"validateNamespaces",(e,t)=>{let r=function(e,t,r){let n=null;if(e&&a3(e)){let i;let s=lr(e,t);s&&(n=s);let o=(i=null,Object.entries(e).forEach(([e,n])=>{var s,o;let a;if(i)return;let l=(s=rY(e,n),o=`${t} ${r}`,a=null,a8(s)&&s.length?s.forEach(e=>{a||le(e)||(a=a5("UNSUPPORTED_CHAINS",`${o}, chain ${e} should be a string and conform to "namespace:chainId" format`))}):le(e)||(a=a5("UNSUPPORTED_CHAINS",`${o}, chains must be defined as "namespace:chainId" e.g. "eip155:1": {...} in the namespace key OR as an array of CAIP-2 chainIds e.g. eip155: { chains: ["eip155:1", "eip155:5"] }`)),a);l&&(i=l)}),i);o&&(n=o)}else n=a6("MISSING_OR_INVALID",`${t}, ${r} should be an object with data`);return n}(e,"connect()",t);if(r)throw Error(r.message)}),fB(this,"isValidApprove",async e=>{if(!ls(e))throw Error(a6("MISSING_OR_INVALID",`approve() params: ${e}`).message);let{id:t,namespaces:r,relayProtocol:n,sessionProperties:i,scopedProperties:s}=e;this.checkRecentlyDeleted(t),await this.isValidProposalId(t);let o=this.client.proposal.get(t),a=ln(r,"approve()");if(a)throw Error(a.message);let l=la(o.requiredNamespaces,r,"approve()");if(l)throw Error(l.message);if(!a9(n,!0)){let{message:e}=a6("MISSING_OR_INVALID",`approve() relayProtocol: ${n}`);throw Error(e)}if(i&&!a4(i)&&this.validateSessionProps(i,"sessionProperties"),s&&!a4(s)){this.validateSessionProps(s,"scopedProperties");let e=new Set(Object.keys(r));if(!Object.keys(s).every(t=>e.has(t.split(":")[0])))throw Error(`Scoped properties must be a subset of approved namespaces, received: ${JSON.stringify(s)}, approved namespaces: ${Array.from(e).join(", ")}`)}}),fB(this,"isValidReject",async e=>{if(!ls(e)){let{message:t}=a6("MISSING_OR_INVALID",`reject() params: ${e}`);throw Error(t)}let{id:t,reason:r}=e;if(this.checkRecentlyDeleted(t),await this.isValidProposalId(t),!r||"object"!=typeof r||!r.code||!a7(r.code,!1)||!r.message||!a9(r.message,!1)){let{message:e}=a6("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(r)}`);throw Error(e)}}),fB(this,"isValidSessionSettleRequest",e=>{let t;if(!ls(e)){let{message:t}=a6("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${e}`);throw Error(t)}let{relay:r,controller:n,namespaces:i,expiry:s}=e;if(!li(r)){let{message:e}=a6("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw Error(e)}let o=(t=null,a9(n?.publicKey,!1)||(t=a6("MISSING_OR_INVALID","onSessionSettleRequest() controller public key should be a string")),t);if(o)throw Error(o.message);let a=ln(i,"onSessionSettleRequest()");if(a)throw Error(a.message);if(np(s)){let{message:e}=a6("EXPIRED","onSessionSettleRequest()");throw Error(e)}}),fB(this,"isValidUpdate",async e=>{if(!ls(e)){let{message:t}=a6("MISSING_OR_INVALID",`update() params: ${e}`);throw Error(t)}let{topic:t,namespaces:r}=e;this.checkRecentlyDeleted(t),await this.isValidSessionTopic(t);
57let n=this.client.session.get(t),i=ln(r,"update()");if(i)throw Error(i.message);let s=la(n.requiredNamespaces,r,"update()");if(s)throw Error(s.message)}),fB(this,"isValidExtend",async e=>{if(!ls(e)){let{message:t}=a6("MISSING_OR_INVALID",`extend() params: ${e}`);throw Error(t)}let{topic:t}=e;this.checkRecentlyDeleted(t),await this.isValidSessionTopic(t)}),fB(this,"isValidRequest",async e=>{var t;if(!ls(e)){let{message:t}=a6("MISSING_OR_INVALID",`request() params: ${e}`);throw Error(t)}let{topic:r,request:n,chainId:i,expiry:s}=e;this.checkRecentlyDeleted(r),await this.isValidSessionTopic(r);let{namespaces:o}=this.client.session.get(r);if(!lo(o,i)){let{message:e}=a6("MISSING_OR_INVALID",`request() chainId: ${i}`);throw Error(e)}if(a4(n)||!a9(n.method,!1)){let{message:e}=a6("MISSING_OR_INVALID",`request() ${JSON.stringify(n)}`);throw Error(e)}if(!(a9(t=n.method,!1)&&(function(e,t){let r=[];return Object.values(e).forEach(e=>{aJ(e.accounts).includes(t)&&r.push(...e.methods)}),r})(o,i).includes(t))){let{message:e}=a6("MISSING_OR_INVALID",`request() method: ${n.method}`);throw Error(e)}if(s&&(!a7(s,!1)||!(s<=fm.max)||!(s>=fm.min))){let{message:e}=a6("MISSING_OR_INVALID",`request() expiry: ${s}. Expiry must be a number (in seconds) between ${fm.min} and ${fm.max}`);throw Error(e)}}),fB(this,"isValidRespond",async e=>{var t;if(!ls(e)){let{message:t}=a6("MISSING_OR_INVALID",`respond() params: ${e}`);throw Error(t)}let{topic:r,response:n}=e;try{await this.isValidSessionTopic(r)}catch(r){throw null!=(t=e?.response)&&t.id&&this.cleanupAfterResponse(e),r}if(a4(n)||a4(n.result)&&a4(n.error)||!a7(n.id,!1)||!a9(n.jsonrpc,!1)){let{message:e}=a6("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(n)}`);throw Error(e)}let i=this.client.pendingRequest.get(n.id);if(i.topic!==r){let{message:e}=a6("MISMATCHED_TOPIC",`Request response topic mismatch. reqId: ${n.id}, expected topic: ${i.topic}, received topic: ${r}`);throw Error(e)}}),fB(this,"isValidPing",async e=>{if(!ls(e)){let{message:t}=a6("MISSING_OR_INVALID",`ping() params: ${e}`);throw Error(t)}let{topic:t}=e;await this.isValidSessionOrPairingTopic(t)}),fB(this,"isValidEmit",async e=>{var t;if(!ls(e)){let{message:t}=a6("MISSING_OR_INVALID",`emit() params: ${e}`);throw Error(t)}let{topic:r,event:n,chainId:i}=e;await this.isValidSessionTopic(r);let{namespaces:s}=this.client.session.get(r);if(!lo(s,i)){let{message:e}=a6("MISSING_OR_INVALID",`emit() chainId: ${i}`);throw Error(e)}if(a4(n)||!a9(n.name,!1)){let{message:e}=a6("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw Error(e)}if(!(a9(t=n.name,!1)&&(function(e,t){let r=[];return Object.values(e).forEach(e=>{aJ(e.accounts).includes(t)&&r.push(...e.events)}),r})(s,i).includes(t))){let{message:e}=a6("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(n)}`);throw Error(e)}}),fB(this,"isValidDisconnect",async e=>{if(!ls(e)){let{message:t}=a6("MISSING_OR_INVALID",`disconnect() params: ${e}`);throw Error(t)}let{topic:t}=e;await this.isValidSessionOrPairingTopic(t)}),fB(this,"isValidAuthenticate",e=>{let{chains:t,uri:r,domain:n,nonce:i}=e;if(!Array.isArray(t)||0===t.length)throw Error("chains is required and must be a non-empty array");if(!a9(r,!1))throw Error("uri is required parameter");if(!a9(n,!1))throw Error("domain is required parameter");if(!a9(i,!1))throw Error("nonce is required parameter");if([...new Set(t.map(e=>rJ(e).namespace))].length>1)throw Error("Multi-namespace requests are not supported. Please request single namespace only.");let{namespace:s}=rJ(t[0]);if("eip155"!==s)throw Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")}),fB(this,"getVerifyContext",async e=>{let{attestationId:t,hash:r,encryptedId:n,metadata:i,transportType:s}=e,o={verified:{verifyUrl:i.verifyUrl||lL,validation:"UNKNOWN",origin:i.url||""}};try{if(s===lT.link_mode){let e=this.getAppLinkIfEnabled(i,s);return o.verified.validation=e&&new URL(e).origin===new URL(i.url).origin?"VALID":"INVALID",o}let e=await this.client.core.verify.resolve({attestationId:t,hash:r,encryptedId:n,verifyUrl:i.verifyUrl});e&&(o.verified.origin=e.origin,o.verified.isScam=e.isScam,o.verified.validation=e.origin===new URL(i.url).origin?"VALID":"INVALID")}catch(e){this.client.logger.warn(e)}return this.client.logger.debug(`Verify context: ${JSON.stringify(o)}`),o}),fB(this,"validateSessionProps",(e,t)=>{Object.values(e).forEach((r,n)=>{if(null==r){let{message:i}=a6("MISSING_OR_INVALID",`${t} must contain an existing value for each key. Received: ${r} for key ${Object.keys(e)[n]}`);throw Error(i)}})}),fB(this,"getPendingAuthRequest",e=>{let t=this.client.auth.requests.get(e);return"object"==typeof t?t:void 0}),fB(this,"addToRecentlyDeleted",(e,t)=>{if(this.recentlyDeletedMap.set(e,t),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let e=0,t=this.recentlyDeletedLimit/2;
57for(let r of this.recentlyDeletedMap.keys()){if(e++>=t)break;this.recentlyDeletedMap.delete(r)}}}),fB(this,"checkRecentlyDeleted",e=>{let t=this.recentlyDeletedMap.get(e);if(t){let{message:r}=a6("MISSING_OR_INVALID",`Record was recently deleted - ${t}: ${e}`);throw Error(r)}}),fB(this,"isLinkModeEnabled",(e,t)=>{var r,n,i,s,o,a,l,c,u;return!!e&&t===lT.link_mode&&(null==(n=null==(r=this.client.metadata)?void 0:r.redirect)?void 0:n.linkMode)===!0&&(null==(s=null==(i=this.client.metadata)?void 0:i.redirect)?void 0:s.universal)!==void 0&&(null==(a=null==(o=this.client.metadata)?void 0:o.redirect)?void 0:a.universal)!==""&&(null==(l=e?.redirect)?void 0:l.universal)!==void 0&&(null==(c=e?.redirect)?void 0:c.universal)!==""&&(null==(u=e?.redirect)?void 0:u.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(e.redirect.universal)&&"u">typeof(null==global?void 0:global.Linking)}),fB(this,"getAppLinkIfEnabled",(e,t)=>{var r;return this.isLinkModeEnabled(e,t)?null==(r=e?.redirect)?void 0:r.universal:void 0}),fB(this,"handleLinkModeMessage",({url:e})=>{if(!e||!e.includes("wc_ev")||!e.includes("topic"))return;let t=nw(e,"topic")||"",r=decodeURIComponent(nw(e,"wc_ev")||""),n=this.client.session.keys.includes(t);n&&this.client.session.update(t,{transportType:lT.link_mode}),this.client.core.dispatchEnvelope({topic:t,message:r,sessionExists:n})}),fB(this,"registerLinkModeListeners",async()=>{var e;if(nE()||ne()&&null!=(e=this.client.metadata.redirect)&&e.linkMode){let e=null==global?void 0:global.Linking;if("u">typeof e){e.addEventListener("url",this.handleLinkModeMessage,this.client.name);let t=await e.getInitialURL();t&&setTimeout(()=>{this.handleLinkModeMessage({url:t})},50)}}}),fB(this,"getTVFParams",(e,t,r)=>{var n,i,s;if(!(null!=(n=t.request)&&n.method))return{};let o={correlationId:e,rpcMethods:[t.request.method],chainId:t.chainId};try{let e=this.extractTxHashesFromResult(t.request,r);o.txHashes=e,o.contractAddresses=this.isValidContractData(t.request.params)?[null==(s=null==(i=t.request.params)?void 0:i[0])?void 0:s.to]:[]}catch(e){this.client.logger.warn(e,"Error getting TVF params")}return o}),fB(this,"isValidContractData",e=>{var t;if(!e)return!1;try{let r=e?.data||(null==(t=e?.[0])?void 0:t.data);if(!r.startsWith("0x"))return!1;let n=r.slice(2);return!!/^[0-9a-fA-F]*$/.test(n)&&n.length%2==0}catch{}return!1}),fB(this,"extractTxHashesFromResult",(e,t)=>{var r;try{if(!t)return[];let n=e.method,i=fw[n];if("sui_signTransaction"===n)return[function(e){let t=new Uint8Array(rZ.from(e,"base64")),r=Array.from("TransactionData::").map(e=>e.charCodeAt(0)),n=new Uint8Array(r.length+t.length);n.set(r),n.set(t,r.length);let i=i1(n,{dkLen:32});return rR.Z.encode(i)}(t.transactionBytes)];if("near_signTransaction"===n)return[i8(t)];if("near_signTransactions"===n)return t.map(e=>i8(e));if("xrpl_signTransactionFor"===n||"xrpl_signTransaction"===n)return[null==(r=t.tx_json)?void 0:r.hash];if("polkadot_signTransaction"===n)return[function(e){let t=Uint8Array.from(rZ.from(e.signature,"hex")),r=function({publicKey:e,signature:t,payload:r}){var n,i;let s=ld(r.method),o=128|parseInt((null==(n=r.version)?void 0:n.toString())||"4"),a=function(e){let t=rR.Z.decode(e)[0];return 42===t?0:60===t?2:1}(r.address),l="00"===r.era?new Uint8Array([0]):ld(r.era);if(1!==l.length&&2!==l.length)throw Error("Invalid era length");let c=parseInt(r.nonce,16),u=new Uint8Array([255&c,c>>8&255]),f=new Uint8Array([0,...e,a,...t,...l,...u,...function(e){if(e<BigInt(1)<<BigInt(6))return new Uint8Array([Number(e<<BigInt(2))]);if(e<BigInt(1)<<BigInt(14)){let t=e<<BigInt(2)|BigInt(1);return new Uint8Array([Number(t&BigInt(255)),Number(t>>BigInt(8)&BigInt(255))])}if(e<BigInt(1)<<BigInt(30)){let t=e<<BigInt(2)|BigInt(2);return new Uint8Array([Number(t&BigInt(255)),Number(t>>BigInt(8)&BigInt(255)),Number(t>>BigInt(16)&BigInt(255)),Number(t>>BigInt(24)&BigInt(255))])}throw Error("BigInt compact encoding not supported > 2^30")}(BigInt(`0x${(i=r.tip).startsWith("0x")?i.slice(2):i}`)),...s]);return new Uint8Array([...function(e){if(e<64)return new Uint8Array([e<<2]);if(e<16384){let t=e<<2|1;return new Uint8Array([255&t,t>>8&255])}if(e<1073741824){let t=e<<2|2;return new Uint8Array([255&t,t>>8&255,t>>16&255,t>>24&255])}throw Error("Compact encoding > 2^30 not supported")}(f.length+1),o,...f])}({publicKey:function(e){let t=rR.Z.decode(e);if(t.length<33)throw Error("Too short to contain a public key");return t.slice(1,33)}(e.transaction.address),signature:t,payload:e.transaction});return function(e){let t=ld(e),r=(0,rG.blake2b)(t,void 0,32);return"0x"+rZ.from(r).toString("hex")}(rZ.from(r).toString("hex"))}({transaction:e.params.transactionPayload,signature:t.signature})];if("algo_signTxn"===n)return a8(t)?t.map(e=>i3(e)):[i3(t)];
57if("cosmos_signDirect"===n)return[function(e){let t=rZ.from(e.signed.bodyBytes,"base64"),r=rZ.from(e.signed.authInfoBytes,"base64"),n=rZ.from(e.signature.signature,"base64"),i=[];i.push(rZ.from([10])),i.push(i4(t.length)),i.push(t),i.push(rZ.from([18])),i.push(i4(r.length)),i.push(r),i.push(rZ.from([26])),i.push(i4(n.length)),i.push(n);let s=iW(rZ.concat(i));return rZ.from(s).toString("hex").toUpperCase()}(t)];if("wallet_sendCalls"===n)return function(e){var t,r;let n=[];try{if("string"==typeof e)return n.push(e),n;if("object"!=typeof e)return n;null!=e&&e.id&&n.push(e.id);let i=null==(r=null==(t=e?.capabilities)?void 0:t.caip345)?void 0:r.transactionHashes;i&&n.push(...i)}catch(e){console.warn("getWalletSendCallsHashes failed: ",e)}return n}(t);if("string"==typeof t)return[t];let s=t[i.key];if(a8(s))return"solana_signAllTransactions"===n?s.map(e=>(function(e){let t=atob(e),r=new Uint8Array(t.length);for(let e=0;e<t.length;e++)r[e]=t.charCodeAt(e);let n=r[0];if(0===n)throw Error("No signatures found");if(r.length<1+64*n)throw Error("Transaction data too short for claimed signature count");if(r.length<100)throw Error("Transaction too short");let i=rZ.from(e,"base64").slice(1,65);return rR.Z.encode(i)})(e)):s;if("string"==typeof s)return[s]}catch(e){this.client.logger.warn(e,"Error extracting tx hashes from result")}return[]})}async processPendingMessageEvents(){try{let e=this.client.session.keys,t=this.client.core.relayer.messages.getWithoutAck(e);for(let[e,r]of Object.entries(t))for(let t of r)try{await this.onProviderMessageEvent({topic:e,message:t,publishedAt:Date.now()})}catch{this.client.logger.warn(`Error processing pending message event for topic: ${e}, message: ${t}`)}}catch(e){this.client.logger.warn(e,"processPendingMessageEvents failed")}}isInitialized(){if(!this.initialized){let{message:e}=a6("NOT_INITIALIZED",this.name);throw Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(lP.message,e=>{this.onProviderMessageEvent(e)})}async onRelayMessage(e){let{topic:t,message:r,attestation:n,transportType:i}=e,{publicKey:s}=this.client.auth.authKeys.keys.includes(fx)?this.client.auth.authKeys.get(fx):{responseTopic:void 0,publicKey:void 0};try{let e=await this.client.core.crypto.decode(t,r,{receiverPublicKey:s,encoding:i===lT.link_mode?ag:ap});(0,ly.isJsonRpcRequest)(e)?(this.client.core.history.set(t,e),await this.onRelayEventRequest({topic:t,payload:e,attestation:n,transportType:i,encryptedId:aw(r)})):(0,ly.isJsonRpcResponse)(e)?(await this.client.core.history.resolve(e),await this.onRelayEventResponse({topic:t,payload:e,transportType:i}),this.client.core.history.delete(t,e.id)):await this.onRelayEventUnknownPayload({topic:t,payload:e,transportType:i}),await this.client.core.relayer.messages.ack(t,r)}catch(e){this.client.logger.error(e)}}registerExpirerEvents(){this.client.core.expirer.on(lj.expired,async e=>{let{topic:t,id:r}=nh(e.target);return r&&this.client.pendingRequest.keys.includes(r)?await this.deletePendingSessionRequest(r,a6("EXPIRED"),!0):r&&this.client.auth.requests.keys.includes(r)?await this.deletePendingAuthRequest(r,a6("EXPIRED"),!0):void(t?this.client.session.keys.includes(t)&&(await this.deleteSession({topic:t,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:t})):r&&(await this.deleteProposal(r,!0),this.client.events.emit("proposal_expire",{id:r})))})}registerPairingEvents(){this.client.core.pairing.events.on(lM.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(lM.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!a9(e,!1)){let{message:t}=a6("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw Error(t)}if(!this.client.core.pairing.pairings.keys.includes(e)){let{message:t}=a6("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw Error(t)}if(np(this.client.core.pairing.pairings.get(e).expiry)){let{message:t}=a6("EXPIRED",`pairing topic: ${e}`);throw Error(t)}}async isValidSessionTopic(e){if(!a9(e,!1)){let{message:t}=a6("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw Error(t)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){let{message:t}=a6("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw Error(t)}if(np(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});let{message:t}=a6("EXPIRED",`session topic: ${e}`);throw Error(t)}if(!this.client.core.crypto.keychain.has(e)){let{message:t}=a6("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),Error(t)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(a9(e,!1)){let{message:t}=a6("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw Error(t)}else{let{message:t}=a6("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw Error(t)}}async isValidProposalId(e){if("number"!=typeof e){let{message:t}=a6("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw Error(t)}if(!this.client.proposal.keys.includes(e)){let{message:t}=a6("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw Error(t)}if(np(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);let{message:t}=a6("EXPIRED",`proposal id: ${e}`);throw Error(t)}}}class fD extends uN{constructor(e,t){super(e,t,"proposal",ff),this.core=e,this.logger=t}}class fU extends uN{constructor(e,t){super(e,t,"session",ff),this.core=e,this.logger=t}}class fM extends uN{constructor(e,t){super(e,t,"request",ff,e=>e.id),this.core=e,this.logger=t}}class fN extends uN{constructor(e,t){super(e,t,"authKeys",fE,()=>fx),this.core=e,this.logger=t}}class fj extends uN{constructor(e,t){super(e,t,"pairingTopics",fE),this.core=e,this.logger=t}}class fL extends uN{constructor(e,t){super(e,t,"requests",fE,e=>e.id),this.core=e,this.logger=t}}var f$=Object.defineProperty,fz=(e,t,r)=>t in e?f$(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,fF=(e,t,r)=>fz(e,"symbol"!=typeof t?t+"":t,r);class fq{constructor(e,t){this.core=e,this.logger=t,fF(this,"authKeys"),fF(this,"pairingTopics"),fF(this,"requests"),this.authKeys=new fN(this.core,this.logger),this.pairingTopics=new fj(this.core,this.logger),this.requests=new fL(this.core,this.logger)}
57async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}var fW=Object.defineProperty,fV=(e,t,r)=>t in e?fW(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,fH=(e,t,r)=>fV(e,"symbol"!=typeof t?t+"":t,r);class fG extends eM{constructor(e){super(e),fH(this,"protocol","wc"),fH(this,"version",2),fH(this,"name",fh.name),fH(this,"metadata"),fH(this,"core"),fH(this,"logger"),fH(this,"events",new B.EventEmitter),fH(this,"engine"),fH(this,"session"),fH(this,"proposal"),fH(this,"pendingRequest"),fH(this,"auth"),fH(this,"signConfig"),fH(this,"on",(e,t)=>this.events.on(e,t)),fH(this,"once",(e,t)=>this.events.once(e,t)),fH(this,"off",(e,t)=>this.events.off(e,t)),fH(this,"removeListener",(e,t)=>this.events.removeListener(e,t)),fH(this,"removeAllListeners",e=>this.events.removeAllListeners(e)),fH(this,"connect",async e=>{try{return await this.engine.connect(e)}catch(e){throw this.logger.error(e.message),e}}),fH(this,"pair",async e=>{try{return await this.engine.pair(e)}catch(e){throw this.logger.error(e.message),e}}),fH(this,"approve",async e=>{try{return await this.engine.approve(e)}catch(e){throw this.logger.error(e.message),e}}),fH(this,"reject",async e=>{try{return await this.engine.reject(e)}catch(e){throw this.logger.error(e.message),e}}),fH(this,"update",async e=>{try{return await this.engine.update(e)}catch(e){throw this.logger.error(e.message),e}}),fH(this,"extend",async e=>{try{return await this.engine.extend(e)}catch(e){throw this.logger.error(e.message),e}}),fH(this,"request",async e=>{try{return await this.engine.request(e)}catch(e){throw this.logger.error(e.message),e}}),fH(this,"respond",async e=>{try{return await this.engine.respond(e)}catch(e){throw this.logger.error(e.message),e}}),fH(this,"ping",async e=>{try{return await this.engine.ping(e)}catch(e){throw this.logger.error(e.message),e}}),fH(this,"emit",async e=>{try{return await this.engine.emit(e)}catch(e){throw this.logger.error(e.message),e}}),fH(this,"disconnect",async e=>{try{return await this.engine.disconnect(e)}catch(e){throw this.logger.error(e.message),e}}),fH(this,"find",e=>{try{return this.engine.find(e)}catch(e){throw this.logger.error(e.message),e}}),fH(this,"getPendingSessionRequests",()=>{try{return this.engine.getPendingSessionRequests()}catch(e){throw this.logger.error(e.message),e}}),fH(this,"authenticate",async(e,t)=>{try{return await this.engine.authenticate(e,t)}catch(e){throw this.logger.error(e.message),e}}),fH(this,"formatAuthMessage",e=>{try{return this.engine.formatAuthMessage(e)}catch(e){throw this.logger.error(e.message),e}}),fH(this,"approveSessionAuthenticate",async e=>{try{return await this.engine.approveSessionAuthenticate(e)}catch(e){throw this.logger.error(e.message),e}}),fH(this,"rejectSessionAuthenticate",async e=>{try{return await this.engine.rejectSessionAuthenticate(e)}catch(e){throw this.logger.error(e.message),e}}),this.name=e?.name||fh.name,this.metadata=function(e){var t,r;let n=ni();try{return null!=e&&e.url&&n.url&&new URL(e.url).host!==new URL(n.url).host&&(console.warn(`The configured WalletConnect 'metadata.url':${e.url} differs from the actual page url:${n.url}. This is probably unintended and can lead to issues.`),e.url=n.url),null!=(t=e?.icons)&&t.length&&e.icons.length>0&&(e.icons=e.icons.filter(e=>""!==e)),r3(r8(r8({},n),e),{url:e?.url||n.url,name:e?.name||n.name,description:e?.description||n.description,icons:null!=(r=e?.icons)&&r.length&&e.icons.length>0?e.icons:n.icons})}catch(t){return console.warn("Error populating app metadata",t),e||n}}(e?.metadata),this.signConfig=e?.signConfig;let t=lp({logger:e?.logger||fh.logger,name:this.name});this.logger=t,this.core=e?.core||new fc(e),this.session=new fU(this.core,this.logger),this.proposal=new fD(this.core,this.logger),this.pendingRequest=new fM(this.core,this.logger),this.engine=new fR(this),this.auth=new fq(this.core,this.logger)}static async init(e){let t=new fG(e);return await t.initialize(),t}get context(){return eh(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.auth.init(),await this.engine.init(),this.logger.info("SignClient Initialization Success")}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var fK=r(33374),fZ=r(9109).Buffer;function fJ(e){return null==e||"object"!=typeof e&&"function"!=typeof e}function fY(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}
57function fX(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}let fQ="[object String]",f0="[object Number]",f1="[object Boolean]",f2="[object Arguments]";function f6(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function f5(e,t,r,n=new Map,i){let s=i?.(e,t,r,n);if(null!=s)return s;if(fJ(e))return e;if(n.has(e))return n.get(e);if(Array.isArray(e)){let t=Array(e.length);n.set(e,t);for(let s=0;s<e.length;s++)t[s]=f5(e[s],s,r,n,i);return Object.hasOwn(e,"index")&&(t.index=e.index),Object.hasOwn(e,"input")&&(t.input=e.input),t}if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp){let t=new RegExp(e.source,e.flags);return t.lastIndex=e.lastIndex,t}if(e instanceof Map){let t=new Map;for(let[s,o]of(n.set(e,t),e))t.set(s,f5(o,s,r,n,i));return t}if(e instanceof Set){let t=new Set;for(let s of(n.set(e,t),e))t.add(f5(s,void 0,r,n,i));return t}if("u">typeof fZ&&fZ.isBuffer(e))return e.subarray();if(f6(e)){let t=new(Object.getPrototypeOf(e)).constructor(e.length);n.set(e,t);for(let s=0;s<e.length;s++)t[s]=f5(e[s],s,r,n,i);return t}if(e instanceof ArrayBuffer||"u">typeof SharedArrayBuffer&&e instanceof SharedArrayBuffer)return e.slice(0);if(e instanceof DataView){let t=new DataView(e.buffer.slice(0),e.byteOffset,e.byteLength);return n.set(e,t),f8(t,e,r,n,i),t}if("u">typeof File&&e instanceof File){let t=new File([e],e.name,{type:e.type});return n.set(e,t),f8(t,e,r,n,i),t}if(e instanceof Blob){let t=new Blob([e],{type:e.type});return n.set(e,t),f8(t,e,r,n,i),t}if(e instanceof Error){let t=new e.constructor;return n.set(e,t),t.message=e.message,t.name=e.name,t.stack=e.stack,t.cause=e.cause,f8(t,e,r,n,i),t}if("object"==typeof e&&function(e){switch(fX(e)){case f2:case"[object Array]":case"[object ArrayBuffer]":case"[object DataView]":case f1:case"[object Date]":case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Map]":case f0:case"[object Object]":case"[object RegExp]":case"[object Set]":case fQ:case"[object Symbol]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return!0;default:return!1}}(e)){let t=Object.create(Object.getPrototypeOf(e));return n.set(e,t),f8(t,e,r,n,i),t}return e}function f8(e,t,r=e,n,i){let s=[...Object.keys(t),...fY(t)];for(let o=0;o<s.length;o++){let a=s[o],l=Object.getOwnPropertyDescriptor(e,a);(null==l||l.writable)&&(e[a]=f5(t[a],a,r,n,i))}}function f3(e){var t;return t=(t,r,n,i)=>{let s=void 0;if(null!=s)return s;if("object"==typeof e)switch(Object.prototype.toString.call(e)){case f0:case fQ:case f1:{let t=new e.constructor(e?.valueOf());return f8(t,e),t}case f2:{let t={};return f8(t,e),t.length=e.length,t[Symbol.iterator]=e[Symbol.iterator],t}default:return}},f5(e,void 0,e,new Map,t)}function f4(e){return null!==e&&"object"==typeof e&&"[object Arguments]"===fX(e)}function f9(e){return"object"==typeof e&&null!==e}function f7(){}let he="error",ht="universal_provider",hr=`wc@2:${ht}:`,hn="https://rpc.walletconnect.org/v1/",hi="generic",hs=`${hn}bundler`,ho="call_status",ha="default_chain_changed";var hl=Object.defineProperty,hc=Object.defineProperties,hu=Object.getOwnPropertyDescriptors,hf=Object.getOwnPropertySymbols,hh=Object.prototype.hasOwnProperty,hd=Object.prototype.propertyIsEnumerable,hp=(e,t,r)=>t in e?hl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,hg=(e,t)=>{for(var r in t||(t={}))hh.call(t,r)&&hp(e,r,t[r]);if(hf)for(var r of hf(t))hd.call(t,r)&&hp(e,r,t[r]);return e},hy=(e,t)=>hc(e,hu(t));function hm(e,t,r){var n;let i=rJ(e);return(null==(n=t.rpcMap)?void 0:n[i.reference])||`${hn}?chainId=${i.namespace}:${i.reference}&projectId=${r}`}function hb(e){return e.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function hw(e){return Object.fromEntries(Object.entries(e).filter(([e,t])=>{var r,n;return(null==(r=t?.chains)?void 0:r.length)&&(null==(n=t?.chains)?void 0:n.length)>0}))}function hv(e={},t={}){return function(e,...t){return function(e,...t){let r=t.slice(0,-1),n=t[t.length-1],i=e;for(let e=0;e<r.length;e++)i=function e(t,r,n,i){if(fJ(t)&&(t=Object(t)),null==r||"object"!=typeof r)return t;if(i.has(r))return function(e){if(fJ(e))return e;if(Array.isArray(e)||f6(e)||e instanceof ArrayBuffer||"u">typeof SharedArrayBuffer&&e instanceof SharedArrayBuffer)return e.slice(0);let t=Object.getPrototypeOf(e),r=t.constructor;if(e instanceof Date||e instanceof Map||e instanceof Set)return new r(e);if(e instanceof RegExp){let t=new r(e);return t.lastIndex=e.lastIndex,t}if(e instanceof DataView)return new r(e.buffer.slice(0));if(e instanceof Error){let t=new r(e.message);return t.stack=e.stack,t.name=e.name,t.cause=e.cause,t}return"u">typeof File&&e instanceof File?new r([e],e.name,{type:e.type,lastModified:e.lastModified}):"object"==typeof e?Object.assign(Object.create(t),e):e}(i.get(r));if(i.set(r,t),Array.isArray(r)){r=r.slice();for(let e=0;e<r.length;e++)r[e]=r[e]??void 0}let s=[...Object.keys(r),...fY(r)];for(let o=0;o<s.length;o++){let a=s[o],l=r[a],c=t[a];if(f4(l)&&(l={...l}),f4(c)&&(c={...c}),"u">typeof fZ&&fZ.isBuffer(l)&&(l=f3(l)),Array.isArray(l)){if("object"==typeof c&&null!=c){let e=[],t=Reflect.ownKeys(c);for(let r=0;r<t.length;r++){let n=t[r];e[n]=c[n]}c=e}else c=[]}let u=n(c,l,a,t,r,i);null!=u?t[a]=u:Array.isArray(l)||f9(c)&&f9(l)?t[a]=e(c,l,n,i):null==c&&function(e){if("object"!=typeof e||null==e)return!1;if(null===Object.getPrototypeOf(e))return!0;
57if("[object Object]"!==Object.prototype.toString.call(e)){let t=e[Symbol.toStringTag];return!!(null!=t&&Object.getOwnPropertyDescriptor(e,Symbol.toStringTag)?.writable)&&e.toString()===`[object ${t}]`}let t=e;for(;null!==Object.getPrototypeOf(t);)t=Object.getPrototypeOf(t);return Object.getPrototypeOf(e)===t}(l)?t[a]=e({},l,n,i):null==c&&f6(l)?t[a]=f3(l):(void 0===c||void 0!==l)&&(t[a]=l)}return t}(i,r[e],n,new Map);return i}(e,...t,f7)}(hw(hE(e)),hw(hE(t)))}function hE(e){var t,r,n,i,s;let o={};if(!a3(e))return o;for(let[a,l]of Object.entries(e)){let e=aY(a)?[a]:l.chains,c=l.methods||[],u=l.events||[],f=l.rpcMap||{},h=aX(a);o[h]=hy(hg(hg({},o[h]),l),{chains:ny(e,null==(t=o[h])?void 0:t.chains),methods:ny(c,null==(r=o[h])?void 0:r.methods),events:ny(u,null==(n=o[h])?void 0:n.events)}),(a3(f)||a3((null==(i=o[h])?void 0:i.rpcMap)||{}))&&(o[h].rpcMap=hg(hg({},f),null==(s=o[h])?void 0:s.rpcMap))}return o}function hx(e){return e.includes(":")?e.split(":")[2]:e}function h_(e){let t={};for(let[r,n]of Object.entries(e)){let e=n.methods||[],i=n.events||[],s=n.accounts||[],o=aY(r)?[r]:n.chains?n.chains:hb(n.accounts);t[r]={chains:o,methods:e,events:i,accounts:s}}return t}function hA(e){return"number"==typeof e?e:e.includes("0x")?parseInt(e,16):isNaN(Number(e=e.includes(":")?e.split(":")[1]:e))?e:Number(e)}let hS={},hI=e=>hS[e],hO=(e,t)=>{hS[e]=t};var hP=Object.defineProperty,hC=Object.getOwnPropertySymbols,hk=Object.prototype.hasOwnProperty,hT=Object.prototype.propertyIsEnumerable,hB=(e,t,r)=>t in e?hP(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,hR=(e,t)=>{for(var r in t||(t={}))hk.call(t,r)&&hB(e,r,t[r]);if(hC)for(var r of hC(t))hT.call(t,r)&&hB(e,r,t[r]);return e};let hD="eip155",hU=["atomic","flow-control","paymasterService","sessionKeys","auxiliaryFunds"],hM=e=>e&&e.startsWith("0x")?BigInt(e).toString(10):e,hN=e=>e&&e.startsWith("0x")?e:`0x${BigInt(e).toString(16)}`,hj=e=>Object.keys(e).filter(e=>hU.includes(e)).reduce((t,r)=>(t[r]=hL(e[r]),t),{}),hL=e=>"string"==typeof e&&function(e){try{let t=JSON.parse(e);return"object"==typeof t&&null!==t&&!Array.isArray(t)}catch{return!1}}(e)?JSON.parse(e):e,h$=(e,t,r)=>{let{sessionProperties:n={},scopedProperties:i={}}=e,s={};if(!a3(i)&&!a3(n))return;let o=hj(n);for(let e of r){let r=hM(e);if(!r)continue;s[hN(r)]=o;let n=i?.[`${hD}:${r}`];if(n){let e=n?.[`${hD}:${r}:${t}`];s[hN(r)]=hR(hR({},s[hN(r)]),hj(e||n))}}for(let[e,t]of Object.entries(s))0===Object.keys(t).length&&delete s[e];return Object.keys(s).length>0?s:void 0};var hz=Object.defineProperty,hF=(e,t,r)=>t in e?hz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,hq=(e,t,r)=>hF(e,"symbol"!=typeof t?t+"":t,r);class hW{constructor(e){hq(this,"storage"),this.storage=e}async getItem(e){return await this.storage.getItem(e)}async setItem(e,t){return await this.storage.setItem(e,t)}async removeItem(e){return await this.storage.removeItem(e)}static getStorage(e){return i||(i=new hW(e)),i}}var hV=Object.defineProperty,hH=Object.defineProperties,hG=Object.getOwnPropertyDescriptors,hK=Object.getOwnPropertySymbols,hZ=Object.prototype.hasOwnProperty,hJ=Object.prototype.propertyIsEnumerable,hY=(e,t,r)=>t in e?hV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,hX=(e,t)=>{for(var r in t||(t={}))hZ.call(t,r)&&hY(e,r,t[r]);if(hK)for(var r of hK(t))hJ.call(t,r)&&hY(e,r,t[r]);return e},hQ=(e,t)=>hH(e,hG(t));async function h0(e,t){let r;let n=rJ(e.result.capabilities.caip345.caip2),i=e.result.capabilities.caip345.transactionHashes,s=await Promise.allSettled(i.map(e=>h1(n.reference,e,t))),o=s.filter(e=>"fulfilled"===e.status).map(e=>e.value).filter(e=>e);s.filter(e=>"rejected"===e.status).forEach(e=>console.warn("Failed to fetch transaction receipt:",e.reason));let a=!o.length||o.some(e=>!e),l=o.every(e=>e?.status==="0x1"),c=o.every(e=>e?.status==="0x0"),u=o.some(e=>e?.status==="0x0");return a?r=100:l?r=200:c?r=500:u&&(r=600),{id:e.result.id,version:e.request.version,atomic:e.request.atomicRequired,chainId:e.request.chainId,capabilities:e.result.capabilities,receipts:o,status:r}}async function h1(e,t,r){return await r(parseInt(e)).request((0,ly.formatJsonRpcRequest)("eth_getTransactionReceipt",[t]))}async function h2({sendCalls:e,storage:t}){let r=await t.getItem(ho);await t.setItem(ho,hQ(hX({},r),{[e.result.id]:{request:e.request,result:e.result,expiry:nd(86400)}}))}async function h6({resultId:e,storage:t}){let r=await t.getItem(ho);if(r){for(let n in delete r[e],await t.setItem(ho,r),r)np(r[n].expiry)&&delete r[n];await t.setItem(ho,r)}}async function h5({resultId:e,storage:t}){let r=await t.getItem(ho),n=r?.[e];
57if(n&&!np(n.expiry))return n;await h6({resultId:e,storage:t})}var h8=Object.defineProperty,h3=Object.defineProperties,h4=Object.getOwnPropertyDescriptors,h9=Object.getOwnPropertySymbols,h7=Object.prototype.hasOwnProperty,de=Object.prototype.propertyIsEnumerable,dt=(e,t,r)=>t in e?h8(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,dr=(e,t)=>{for(var r in t||(t={}))h7.call(t,r)&&dt(e,r,t[r]);if(h9)for(var r of h9(t))de.call(t,r)&&dt(e,r,t[r]);return e},dn=(e,t)=>h3(e,h4(t)),di=(e,t,r)=>dt(e,"symbol"!=typeof t?t+"":t,r);class ds{constructor(e){di(this,"name","eip155"),di(this,"client"),di(this,"chainId"),di(this,"namespace"),di(this,"httpProviders"),di(this,"events"),di(this,"storage"),this.namespace=e.namespace,this.events=hI("events"),this.client=hI("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain()),this.storage=hW.getStorage(this.client.core.storage)}async request(e){switch(e.request.method){case"eth_requestAccounts":case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain());case"wallet_getCapabilities":return await this.getCapabilities(e);case"wallet_getCallsStatus":return await this.getCallStatus(e);case"wallet_sendCalls":return await this.sendCalls(e)}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(parseInt(e),t);let r=this.chainId;this.chainId=parseInt(e),this.events.emit(ha,{currentCaipChainId:`${this.name}:${e}`,previousCaipChainId:`${this.name}:${r}`})}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,t){let r=t||hm(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new lg.r(new fK.k(r,hI("disableProviderPing")))}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{var r;let n=parseInt(t.includes(":")?t.split(":")[1]:t);e[n]=this.createHttpProvider(n,null==(r=this.namespace.rpcMap)?void 0:r[t])}),e}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}getHttpProvider(e){let t=e||this.chainId;return this.httpProviders[t]||(this.httpProviders=dn(dr({},this.httpProviders),{[t]:this.createHttpProvider(t)}),this.httpProviders[t])}async handleSwitchChain(e){var t,r;let n=e.request.params?null==(t=e.request.params[0])?void 0:t.chainId:"0x0",i=parseInt(n=n.startsWith("0x")?n:`0x${n}`,16);if(this.isChainApproved(i))this.setDefaultChain(`${i}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:n}]},chainId:null==(r=this.namespace.chains)?void 0:r[0]}),this.setDefaultChain(`${i}`);else throw Error(`Failed to switch to chain 'eip155:${i}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}async getCapabilities(e){var t,r,n,i,s;let o;let a=null==(r=null==(t=e.request)?void 0:t.params)?void 0:r[0],l=(null==(i=null==(n=e.request)?void 0:n.params)?void 0:i[1])||[];if(!a)throw Error("Missing address parameter in `wallet_getCapabilities` request");let c=this.client.session.get(e.topic),u=(null==(s=c?.sessionProperties)?void 0:s.capabilities)||{},f=`${a}${l.join(",")}`,h=u?.[f];if(h)return h;try{o=h$(c,a,l)}catch(e){console.warn("Failed to extract capabilities from session",e)}if(o)return o;let d=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:dn(dr({},c.sessionProperties||{}),{capabilities:dn(dr({},u||{}),{[f]:d})})})}catch(e){console.warn("Failed to update session with capabilities",e)}return d}async getCallStatus(e){var t,r,n;let i=this.client.session.get(e.topic),s=null==(t=i.sessionProperties)?void 0:t.bundler_name;if(s){let t=this.getBundlerUrl(e.chainId,s);try{return await this.getUserOperationReceipt(t,e)}catch(e){console.warn("Failed to fetch call status from bundler",e,t)}}let o=null==(r=i.sessionProperties)?void 0:r.bundler_url;if(o)try{return await this.getUserOperationReceipt(o,e)}catch(e){console.warn("Failed to fetch call status from custom bundler",e,o)}let a=await h5({resultId:null==(n=e.request.params)?void 0:n[0],storage:this.storage});if(a)try{return await h0(a,this.getHttpProvider.bind(this))}catch(e){console.warn("Failed to fetch call status from stored send calls",e,a)}if(this.namespace.methods.includes(e.request.method))return await this.client.request(e);throw Error("Fetching call status not approved by the wallet.")}async getUserOperationReceipt(e,t){var r;let n=new URL(e),i=await fetch(n,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify((0,ly.formatJsonRpcRequest)("eth_getUserOperationReceipt",[null==(r=t.request.params)?void 0:r[0]]))});if(!i.ok)throw Error(`Failed to fetch user operation receipt - ${i.status}`);return await i.json()}
57getBundlerUrl(e,t){return`${hs}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${t}`}async sendCalls(e){var t,r,n;let i=await this.client.request(e),s=null==(t=e.request.params)?void 0:t[0],o=i?.id,a=i?.capabilities||{},l=null==(r=a?.caip345)?void 0:r.caip2,c=null==(n=a?.caip345)?void 0:n.transactionHashes;return o&&l&&null!=c&&c.length&&await h2({sendCalls:{request:s,result:i},storage:this.storage}),i}}var da=Object.defineProperty,dl=(e,t,r)=>t in e?da(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,dc=(e,t,r)=>dl(e,"symbol"!=typeof t?t+"":t,r);class du{constructor(e){dc(this,"name",hi),dc(this,"client"),dc(this,"httpProviders"),dc(this,"events"),dc(this,"namespace"),dc(this,"chainId"),this.namespace=e.namespace,this.events=hI("events"),this.client=hI("client"),this.chainId=this.getDefaultChain(),this.name=this.getNamespaceName(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t);let r=this.chainId;this.chainId=e,this.events.emit(ha,{currentCaipChainId:`${this.name}:${e}`,previousCaipChainId:`${this.name}:${r}`})}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return e.split(":")[1]}getNamespaceName(){let e=this.namespace.chains[0];if(!e)throw Error("ChainId not found");return rJ(e).namespace}getAccounts(){let e=this.namespace.accounts;return e?[...new Set(e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2]))]:[]}createHttpProviders(){var e,t;let r={};return null==(t=null==(e=this.namespace)?void 0:e.accounts)||t.forEach(e=>{var t,n;let i=rJ(e),s=null==(n=null==(t=this.namespace)?void 0:t.rpcMap)?void 0:n[`${i.namespace}:${i.reference}`];r[i.reference]=this.createHttpProvider(e,s)}),r}getHttpProvider(e){let t=rJ(e).reference,r=this.httpProviders[t];if(typeof r>"u")throw Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||hm(e,this.namespace,this.client.core.projectId);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new lg.r(new fK.Z(r,hI("disableProviderPing")))}}var df=Object.defineProperty,dh=Object.defineProperties,dd=Object.getOwnPropertyDescriptors,dp=Object.getOwnPropertySymbols,dg=Object.prototype.hasOwnProperty,dy=Object.prototype.propertyIsEnumerable,dm=(e,t,r)=>t in e?df(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,db=(e,t)=>{for(var r in t||(t={}))dg.call(t,r)&&dm(e,r,t[r]);if(dp)for(var r of dp(t))dy.call(t,r)&&dm(e,r,t[r]);return e},dw=(e,t)=>dh(e,dd(t)),dv=(e,t,r)=>dm(e,"symbol"!=typeof t?t+"":t,r);class dE{constructor(e){var t,r;dv(this,"client"),dv(this,"namespaces"),dv(this,"optionalNamespaces"),dv(this,"sessionProperties"),dv(this,"scopedProperties"),dv(this,"events",new B),dv(this,"rpcProviders",{}),dv(this,"session"),dv(this,"providerOpts"),dv(this,"logger"),dv(this,"uri"),dv(this,"disableProviderPing",!1),this.providerOpts=e,this.logger=lp({logger:null!=(t=e.logger)?t:he,name:null!=(r=this.providerOpts.name)?r:ht}),this.disableProviderPing=e?.disableProviderPing||!1}static async init(e){let t=new dE(e);return await t.initialize(),t}async request(e,t,r){let[n,i]=this.validateChain(t);if(!this.session)throw Error("Please call connect() before request()");return await this.getProvider(n).request({request:db({},e),chainId:`${n}:${i}`,topic:this.session.topic,expiry:r})}sendAsync(e,t,r,n){let i=new Date().getTime();this.request(e,r,n).then(e=>t(null,(0,ly.formatJsonRpcResult)(i,e))).catch(e=>t(e,void 0))}async enable(){if(!this.client)throw Error("Sign Client not initialized");
57return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties,scopedProperties:this.scopedProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw Error("Please call connect() before enable()");await this.client.disconnect({topic:null==(e=this.session)?void 0:e.topic,reason:a5("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw Error("Sign Client not initialized");if(this.setNamespaces(e),this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e,t){if(!this.client)throw Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();let{uri:r,response:n}=await this.client.authenticate(e,t);r&&(this.uri=r,this.events.emit("display_uri",r));let i=await n();if(this.session=i.session,this.session){let e=h_(this.session.namespaces);this.namespaces=hv(this.namespaces,e),await this.persist("namespaces",this.namespaces),this.onConnect()}return i}on(e,t){this.events.on(e,t)}once(e,t){this.events.once(e,t)}removeListener(e,t){this.events.removeListener(e,t)}off(e,t){this.events.off(e,t)}get isWalletConnect(){return!0}async pair(e){let{uri:t,approval:r}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties,scopedProperties:this.scopedProperties});t&&(this.uri=t,this.events.emit("display_uri",t));let n=await r();this.session=n;let i=h_(n.namespaces);return this.namespaces=hv(this.namespaces,i),await this.persist("namespaces",this.namespaces),await this.persist("optionalNamespaces",this.optionalNamespaces),this.onConnect(),this.session}setDefaultChain(e,t){try{if(!this.session)return;let[r,n]=this.validateChain(e);this.getProvider(r).setDefaultChain(n,t)}catch(e){if(!/Please call connect/.test(e.message))throw e}}async cleanupPendingPairings(e={}){try{this.logger.info("Cleaning up inactive pairings...");let t=this.client.pairing.getAll();if(!a8(t))return;for(let r of t)e.deletePairings?this.client.core.expirer.set(r.topic,0):await this.client.core.relayer.subscriber.unsubscribe(r.topic);this.logger.info(`Inactive pairings cleared: ${t.length}`)}catch(e){this.logger.warn(e,"Failed to cleanup pending pairings")}}abortPairingAttempt(){this.logger.warn("abortPairingAttempt is deprecated. This is now a no-op.")}async checkStorage(){this.namespaces=await this.getFromStore("namespaces")||{},this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.session&&this.createProviders()}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){var e,t;if(this.client=this.providerOpts.client||await fG.init({core:this.providerOpts.core,logger:this.providerOpts.logger||he,relayUrl:this.providerOpts.relayUrl||"wss://relay.walletconnect.org",projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name,customStoragePrefix:this.providerOpts.customStoragePrefix,telemetryEnabled:this.providerOpts.telemetryEnabled}),this.providerOpts.session)try{this.session=this.client.session.get(this.providerOpts.session.topic)}catch(r){throw this.logger.error(r,"Failed to get session"),Error(`The provided session: ${null==(t=null==(e=this.providerOpts)?void 0:e.session)?void 0:t.topic} doesn't exist in the Sign client`)}else{let e=this.client.session.getAll();this.session=e[0]}this.logger.trace("SignClient Initialized")}createProviders(){if(!this.client)throw Error("Sign Client not initialized");if(!this.session)throw Error("Session not initialized. Please call connect() before enable()");let e=[...new Set(Object.keys(this.session.namespaces).map(e=>aX(e)))];hO("client",this.client),hO("events",this.events),hO("disableProviderPing",this.disableProviderPing),e.forEach(e=>{if(!this.session)return;let t=function(e,t){let r=Object.keys(t.namespaces).filter(t=>t.includes(e));if(!r.length)return[];let n=[];
57return r.forEach(e=>{let r=t.namespaces[e].accounts;n.push(...r)}),n}(e,this.session);if(t?.length===0)return;let r=hb(t),n=dw(db({},hv(this.namespaces,this.optionalNamespaces)[e]),{accounts:t,chains:r});"eip155"===e?this.rpcProviders[e]=new ds({namespace:n}):this.rpcProviders[e]=new du({namespace:n})})}registerEventListeners(){if(typeof this.client>"u")throw Error("Sign Client is not initialized");this.client.on("session_ping",e=>{var t;let{topic:r}=e;r===(null==(t=this.session)?void 0:t.topic)&&this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{var t;let{params:r,topic:n}=e;if(n!==(null==(t=this.session)?void 0:t.topic))return;let{event:i}=r;if("accountsChanged"===i.name){let e=i.data;e&&a8(e)&&this.events.emit("accountsChanged",e.map(hx))}else if("chainChanged"===i.name){let e=r.chainId,t=r.event.data,n=aX(e),i=hA(e)!==hA(t)?`${n}:${hA(t)}`:e;this.onChainChanged({currentCaipChainId:i})}else this.events.emit(i.name,i.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:t})=>{var r,n;if(e!==(null==(r=this.session)?void 0:r.topic))return;let{namespaces:i}=t,s=null==(n=this.client)?void 0:n.session.get(e);this.session=dw(db({},s),{namespaces:i}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:t})}),this.client.on("session_delete",async e=>{var t;e.topic===(null==(t=this.session)?void 0:t.topic)&&(await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",dw(db({},a5("USER_DISCONNECTED")),{data:e.topic})))}),this.on(ha,e=>{this.onChainChanged(dw(db({},e),{internal:!0}))})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[hi]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var t;this.getProvider(e).updateNamespace(null==(t=this.session)?void 0:t.namespaces[e])})}setNamespaces(e){let{namespaces:t={},optionalNamespaces:r={},sessionProperties:n,scopedProperties:i}=e;this.optionalNamespaces=hv(t,r),this.sessionProperties=n,this.scopedProperties=i}validateChain(e){let[t,r]=e?.split(":")||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[t,r];if(t&&!Object.keys(this.namespaces||{}).map(e=>aX(e)).includes(t))throw Error(`Namespace '${t}' is not configured. Please call connect() first with namespace config.`);if(t&&r)return[t,r];let n=aX(Object.keys(this.namespaces)[0]),i=this.rpcProviders[n].getDefaultChain();return[n,i]}async requestAccounts(){let[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}async onChainChanged({currentCaipChainId:e,previousCaipChainId:t,internal:r=!1}){if(!this.namespaces)return;let[n,i]=this.validateChain(e);i&&(this.updateNamespaceChain(n,i),r?(this.events.emit("chainChanged",i),this.emitAccountsChangedOnChainChange({namespace:n,currentCaipChainId:e,previousCaipChainId:t})):this.getProvider(n).setDefaultChain(i),await this.persist("namespaces",this.namespaces))}emitAccountsChangedOnChainChange({namespace:e,currentCaipChainId:t,previousCaipChainId:r}){var n,i;try{if(r===t)return;let s=null==(i=null==(n=this.session)?void 0:n.namespaces[e])?void 0:i.accounts;if(!s)return;let o=s.filter(e=>e.includes(`${t}:`)).map(hx);if(!a8(o))return;this.events.emit("accountsChanged",o)}catch(e){this.logger.warn(e,"Failed to emit accountsChanged on chain change")}}updateNamespaceChain(e,t){if(!this.namespaces)return;let r=this.namespaces[e]?e:`${e}:${t}`;this.namespaces[r]?this.namespaces[r]&&(this.namespaces[r].defaultChain=t):this.namespaces[r]={chains:[],methods:[],events:[],defaultChain:t}}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,await this.deleteFromStore("namespaces"),await this.deleteFromStore("optionalNamespaces"),await this.deleteFromStore("sessionProperties"),this.session=void 0,this.cleanupPendingPairings({deletePairings:!0}),await this.cleanupStorage()}async persist(e,t){var r;let n=(null==(r=this.session)?void 0:r.topic)||"";await this.client.core.storage.setItem(`${hr}/${e}${n}`,t)}async getFromStore(e){var t;let r=(null==(t=this.session)?void 0:t.topic)||"";return await this.client.core.storage.getItem(`${hr}/${e}${r}`)}async deleteFromStore(e){var t;let r=(null==(t=this.session)?void 0:t.topic)||"";await this.client.core.storage.removeItem(`${hr}/${e}${r}`)}async cleanupStorage(){var e;try{if((null==(e=this.client)?void 0:e.session.length)>0)return;for(let e of(await this.client.core.storage.getKeys()))e.startsWith(hr)&&await this.client.core.storage.removeItem(e)}catch(e){this.logger.warn(e,"Failed to cleanup storage")}}}var dx=r(63858);r(57437),r(13130),r(18415),r(9109).Buffer;let d_=e=>{let t,{get:r,on:n}=function(){if(s||(s=Object.freeze({register:O,get:P,on:C}),"undefined"==typeof window))return s;let e=Object.freeze({register:O});try{window.addEventListener("wallet-standard:register-wallet",({detail
57:t})=>t(e))}catch(e){console.error("wallet-standard:register-wallet event listener could not be added\n",e)}try{window.dispatchEvent(new T(e))}catch(e){console.error("wallet-standard:app-ready event could not be dispatched\n",e)}return s}(),i=e?.shouldAutoConnect??!0,o=new x.S(new pl,i),a=new Map,l=[];function c(...e){e.forEach(e=>{!(e.features["privy:"]&&"isPrivyWallet"in e&&e.isPrivyWallet||a.has(e.name))&&e.chains.some(e=>"string"==typeof e&&e.startsWith("solana:"))&&a.set(e.name,e)}),l=Array.from(a.values()).map(e=>new x.S(e,i)).concat(o),t?.(l)}function u(...e){Array.from(a.values()).forEach(t=>!e.includes(t)&&a.delete(t.name)),l=Array.from(a.values()).map(e=>new x.S(e,i)).concat(o),t?.(l)}let f=[n("register",c),n("unregister",u)];return c(...r()),{_setOnConnectorsUpdated:e=>{t=e},onMount:()=>{f[0]||(f[0]=n("register",c)),f[1]||(f[1]=n("unregister",u))},onUnmount:()=>{let e=f.pop();for(;e;)e(),e=f.pop()},get:()=>l}};function dA(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}var dS=0;function dI(e){return"__private_"+dS+++"_"+e}var dO=dI("_address"),dP=dI("_publicKey"),dC=dI("_chains"),dk=dI("_features"),dT=dI("_label"),dB=dI("_icon");class dR{get address(){return dA(this,dO)[dO]}get publicKey(){return dA(this,dP)[dP].slice()}get chains(){return dA(this,dC)[dC].slice()}get features(){return dA(this,dk)[dk].slice()}get label(){return dA(this,dT)[dT]}get icon(){return dA(this,dB)[dB]}constructor({address:e,publicKey:t,label:r,icon:n}){Object.defineProperty(this,dO,{writable:!0,value:void 0}),Object.defineProperty(this,dP,{writable:!0,value:void 0}),Object.defineProperty(this,dC,{writable:!0,value:void 0}),Object.defineProperty(this,dk,{writable:!0,value:void 0}),Object.defineProperty(this,dT,{writable:!0,value:void 0}),Object.defineProperty(this,dB,{writable:!0,value:void 0}),dA(this,dO)[dO]=e,dA(this,dP)[dP]=t,dA(this,dC)[dC]=y.S,dA(this,dk)[dk]=["solana:signAndSendTransaction","solana:signTransaction","solana:signMessage"],dA(this,dT)[dT]=r,dA(this,dB)[dB]=n}}function dD(e){if("string"==typeof e)return m.Jq.decode(e);if(e instanceof Uint8Array)return e;let t=e.signature;return"string"==typeof t?m.Jq.decode(t):t}function dU(e){if("string"==typeof e){try{return m.Jq.decode(e)}catch{}return m.US.decode(e)}if(e instanceof Uint8Array)return e;let t=e.transaction??e.signature;if(!t)throw Error("Invalid result from signTransaction or signAndSendTransaction attempt");if("string"==typeof t){try{return m.Jq.decode(t)}catch{}return m.US.decode(t)}return t}function dM(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}var dN=0;function dj(e){return"__private_"+dN+++"_"+e}let dL="solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",d$="solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1";var dz=dj("_listeners"),dF=dj("_version"),dq=dj("_name"),dW=dj("_icon"),dV=dj("_provider"),dH=dj("_accounts"),dG=dj("_privyAppName"),dK=dj("_walletConnectCloudProjectId"),dZ=dj("_walletEntry"),dJ=dj("_onDisplayUriCallback"),dY=dj("_providerEventListeners"),dX=dj("_on"),dQ=dj("_emit"),d0=dj("_off"),d1=dj("_connected"),d2=dj("_disconnected"),d6=dj("_connect"),d5=dj("_disconnect"),d8=dj("_signMessage"),d3=dj("_signAndSendTransaction"),d4=dj("_signTransaction"),d9=dj("_getOrCreateProvider"),d7=dj("_getOrCreateSession"),pe=dj("_getAllSignClientSessions"),pt=dj("_assignSessionToProvider"),pr=dj("_restoreSession"),pn=dj("_addProviderEventListener"),pi=dj("_destroySession"),ps=dj("_makeRpcRequest"),po=dj("_onDisplayUri"),pa=dj("_onSessionDelete");class pl{get version(){return dM(this,dF)[dF]}get name(){return dM(this,dq)[dq]}get icon(){return dM(this,dW)[dW]}get chains(){return y.S.slice()}get features(){return{"standard:connect":{version:"1.0.0",connect:dM(this,d6)[d6]},"standard:disconnect":{version:"1.0.0",disconnect:dM(this,d5)[d5]},"standard:events":{version:"1.0.0",on:dM(this,dX)[dX]},"solana:signAndSendTransaction":{version:"1.0.0",supportedTransactionVersions:["legacy",0],signAndSendTransaction:dM(this,d3)[d3]},"solana:signTransaction":{version:"1.0.0",supportedTransactionVersions:["legacy",0],signTransaction:dM(this,d4)[d4]},"solana:signMessage":{version:"1.0.0",signMessage:dM(this,d8)[d8]}}}get accounts(){return dM(this,dH)[dH].slice()}get isWalletConnectSolana(){return!0}async initialize({walletConnectCloudProjectId:e,privyAppName:t}){await this.initializeProvider({walletConnectCloudProjectId:e,privyAppName:t}),await this.restoreSession()}async initializeProvider({walletConnectCloudProjectId:e,privyAppName:t}){x.c.debug("Initializing WalletConnect Solana provider"),dM(this,dK)[dK]=e,dM(this,dG)[dG]=t,await dM(this,d9)[d9]()}async restoreSession(){await dM(this,pr)[pr]()}async hideSolanaSessionsFromSignClient(){let e=dM(this,dV)[dV]?.client;if(!e?.session)return[];let t=dM(this,pe)[pe]().filter(e=>!!e.namespaces?.solana);
57for(let r of t)await e.session.delete(r.topic,{code:0,message:""});return t}async unhideSolanaSessionsInSignClient(e){let t=dM(this,dV)[dV]?.client;if(t?.session)for(let r of e)await t.session.set(r.topic,r)}setWalletEntry(e,t){dM(this,dZ)[dZ]=e,dM(this,dJ)[dJ]=t}constructor(){Object.defineProperty(this,dQ,{value:pc}),Object.defineProperty(this,d0,{value:pu}),Object.defineProperty(this,dz,{writable:!0,value:void 0}),Object.defineProperty(this,dF,{writable:!0,value:void 0}),Object.defineProperty(this,dq,{writable:!0,value:void 0}),Object.defineProperty(this,dW,{writable:!0,value:void 0}),Object.defineProperty(this,dV,{writable:!0,value:void 0}),Object.defineProperty(this,dH,{writable:!0,value:void 0}),Object.defineProperty(this,dG,{writable:!0,value:void 0}),Object.defineProperty(this,dK,{writable:!0,value:void 0}),Object.defineProperty(this,dZ,{writable:!0,value:void 0}),Object.defineProperty(this,dJ,{writable:!0,value:void 0}),Object.defineProperty(this,dY,{writable:!0,value:void 0}),Object.defineProperty(this,dX,{writable:!0,value:void 0}),Object.defineProperty(this,d1,{writable:!0,value:void 0}),Object.defineProperty(this,d2,{writable:!0,value:void 0}),Object.defineProperty(this,d6,{writable:!0,value:void 0}),Object.defineProperty(this,d5,{writable:!0,value:void 0}),Object.defineProperty(this,d8,{writable:!0,value:void 0}),Object.defineProperty(this,d3,{writable:!0,value:void 0}),Object.defineProperty(this,d4,{writable:!0,value:void 0}),Object.defineProperty(this,d9,{writable:!0,value:void 0}),Object.defineProperty(this,d7,{writable:!0,value:void 0}),Object.defineProperty(this,pe,{writable:!0,value:void 0}),Object.defineProperty(this,pt,{writable:!0,value:void 0}),Object.defineProperty(this,pr,{writable:!0,value:void 0}),Object.defineProperty(this,pn,{writable:!0,value:void 0}),Object.defineProperty(this,pi,{writable:!0,value:void 0}),Object.defineProperty(this,ps,{writable:!0,value:void 0}),Object.defineProperty(this,po,{writable:!0,value:void 0}),Object.defineProperty(this,pa,{writable:!0,value:void 0}),dM(this,dz)[dz]={},dM(this,dF)[dF]="1.0.0",dM(this,dq)[dq]="WalletConnect",dM(this,dW)[dW]=x.W,dM(this,dV)[dV]=null,dM(this,dH)[dH]=[],dM(this,dG)[dG]="",dM(this,dK)[dK]="",dM(this,dY)[dY]=new Map,dM(this,dX)[dX]=(e,t)=>(dM(this,dz)[dz][e]?.push(t)||(dM(this,dz)[dz][e]=[t]),()=>dM(this,d0)[d0](e,t)),dM(this,d1)[d1]=e=>{dM(this,dq)[dq]=dM(this,dV)[dV]?.session?.peer?.metadata?.name||dM(this,dZ)[dZ]?.name||"WalletConnect",dM(this,dW)[dW]=dM(this,dV)[dV]?.session?.peer?.metadata?.icons?.[0]||dM(this,dZ)[dZ]?.image_url?.sm||dM(this,dW)[dW],dM(this,dH)[dH]=e.map(e=>new dR({address:e,publicKey:m.Jq.decode(e),label:dM(this,dq)[dq],icon:dM(this,dW)[dW]})),dM(this,dQ)[dQ]("change",{accounts:this.accounts})},dM(this,d2)[d2]=()=>{dM(this,dH)[dH]=[],dM(this,dQ)[dQ]("change",{accounts:this.accounts})},dM(this,d6)[d6]=async()=>(this.accounts.length||await dM(this,d7)[d7](),{accounts:this.accounts}),dM(this,d5)[d5]=async()=>{await dM(this,pi)[pi](),dM(this,dQ)[dQ]("change",{accounts:this.accounts})},dM(this,d8)[d8]=async(...e)=>{let t=[];for(let{account:r,message:n}of e){let e=m.Jq.encode(n);try{let i=await dM(this,ps)[ps]("solana_signMessage",{message:e,pubkey:r.address},ph("solana:mainnet"));t.push({signedMessage:n,signature:dD(i)})}catch(i){if(i?.message?.includes("Missing or invalid")){let i=await dM(this,ps)[ps]("solana:signMessage",{message:e,pubkey:r.address},ph("solana:mainnet"));t.push({signedMessage:n,signature:dD(i)})}throw i}}return t},dM(this,d3)[d3]=async(...e)=>{let t=[];for(let{account:r,chain:n,transaction:i,options:s}of e){let e=m.US.encode(i);try{let i=await dM(this,ps)[ps]("solana_signAndSendTransaction",{transaction:e,pubkey:r.address,sendOptions:s},ph(n));t.push({signature:dD(i)})}catch(i){if(i?.message?.includes("Missing or invalid")){let i=await dM(this,ps)[ps]("solana:signAndSendTransaction",{transaction:e,pubkey:r.address,sendOptions:s},ph(n));t.push({signature:dD(i)})}}}return t},dM(this,d4)[d4]=async(...e)=>{let t=[];for(let{account:r,chain:n,transaction:i}of e){let e=m.US.encode(i);try{let i=await dM(this,ps)[ps]("solana_signTransaction",{transaction:e,pubkey:r.address},ph(n||"solana:mainnet"));t.push({signedTransaction:dU(i)})}catch(i){if(i?.message?.includes("Missing or invalid")){let i=await dM(this,ps)[ps]("solana:signTransaction",{transaction:e,pubkey:r.address},ph(n||"solana:mainnet"));t.push({signedTransaction:dU(i)})}}}return t},dM(this,d9)[d9]=async()=>
57{if(dM(this,dV)[dV])return dM(this,dV)[dV];if(!dM(this,dK)[dK])throw Error("WalletConnect Cloud Project ID is required");return dM(this,dV)[dV]=await dE.init({projectId:dM(this,dK)[dK],metadata:{name:dM(this,dG)[dG],description:dM(this,dG)[dG],url:window.location.origin,icons:[]},relayUrl:"wss://relay.walletconnect.com",telemetryEnabled:!1}),dM(this,pn)[pn]("display_uri",dM(this,po)[po]),dM(this,pn)[pn]("session_delete",dM(this,pa)[pa]),dM(this,pn)[pn]("session_ping",()=>{}),dM(this,pn)[pn]("session_event",()=>{}),dM(this,pn)[pn]("session_update",()=>{}),dM(this,dV)[dV]},dM(this,d7)[d7]=async()=>{if(!dM(this,dV)[dV])throw Error("WalletConnectSolana: Failed to get or create session. Provider not initialized");if(dM(this,dV)[dV].session)return x.c.debug("Using existing Solana WalletConnect session"),dM(this,dV)[dV].session;let e=["solana_signMessage","solana_signTransaction","solana_signAndSendTransaction"];x.c.debug("Creating new Solana WalletConnect session",{requestedChains:["mainnet","devnet"],requestedMethods:e.length});let t=await dM(this,dV)[dV].connect({optionalNamespaces:{solana:{chains:[dL,d$],methods:e,events:[]}}});if(!t)throw Error("WalletConnectSolana: Failed to create new session");let r=pf(t);return x.c.debug("Solana WalletConnect session created",{accountsCount:r.length,peerName:t.peer?.metadata?.name}),dM(this,d1)[d1](r),t},dM(this,pe)[pe]=()=>dM(this,dV)[dV]?.client?.session?.getAll?.()||[],dM(this,pt)[pt]=(e,t)=>{e.session=t,e.namespaces=t.namespaces,e.createProviders?.()},dM(this,pr)[pr]=async()=>{if(!dM(this,dV)[dV])return;let e=dM(this,dV)[dV].session;if(e?.namespaces?.solana){let t=pf(e);return x.c.debug("Restored Solana WalletConnect session",{accountsCount:t.length,peerName:e.peer?.metadata?.name}),void dM(this,d1)[d1](t)}e&&(dM(this,dV)[dV].session=void 0);let t=dM(this,pe)[pe]().find(e=>!!e.namespaces?.solana);if(!t)return void x.c.debug("No existing Solana WalletConnect session found");dM(this,pt)[pt](dM(this,dV)[dV],t);let r=pf(t);x.c.debug("Restored Solana WalletConnect session",{accountsCount:r.length,peerName:t.peer?.metadata?.name}),dM(this,d1)[d1](r)},dM(this,pn)[pn]=(e,t)=>{let r=dM(this,dY)[dY].get(e);r&&(dM(this,dV)[dV]?.off(e,r),dM(this,dY)[dY].delete(e)),dM(this,dV)[dV]?.on(e,t),dM(this,dY)[dY].set(e,t)},dM(this,pi)[pi]=async()=>{x.c.debug("Destroying Solana WalletConnect session");try{if(dM(this,dV)[dV]?.session&&await dM(this,dV)[dV]?.disconnect().catch(e=>x.c.error("Error disconnecting Solana WalletConnect session",e)),dM(this,dV)[dV]?.client){let e=dM(this,dV)[dV].client.proposal.getAll();await Promise.allSettled(e.map(e=>dM(this,dV)[dV]?.client.proposal.delete(e.id,{code:6e3,message:"User disconnected"})));let t=dM(this,dV)[dV].client.pairing.getAll();await Promise.allSettled(t.map(e=>dM(this,dV)[dV]?.client.pairing.delete(e.topic,{code:6e3,message:"User disconnected"})))}x.c.debug("Solana WalletConnect session destroyed"),dM(this,d2)[d2]()}catch(e){x.c.error("Error destroying Solana WalletConnect session",e)}},dM(this,ps)[ps]=async(e,t,r)=>{x.c.debug("Solana WalletConnect RPC request",{method:e,chainId:r});try{let n=await dM(this,dV)[dV].request({method:e,params:t},r);return x.c.debug("Solana WalletConnect RPC response",{method:e,success:!0}),n}catch(t){if(x.c.error("Solana WalletConnect RPC error",t,{method:e,chainId:r}),t?.message?.includes("without any listeners")&&t.result)return x.c.debug("Ignoring WalletConnect listener warning, result available",{method:e}),t.result;if(t?.message?.includes("session topic does not exist in keychain"))throw Error("WalletConnectSolana: Wallet connection lost. Please reconnect.");throw t}},dM(this,po)[po]=e=>{if(x.c.debug("Solana WalletConnect display_uri received",{isMobile:dx.tq,hasWalletEntry:!!dM(this,dZ)[dZ]}),dx.tq&&dM(this,dZ)[dZ]){let{redirect:t}=(0,l.b)(e,dM(this,dZ)[dZ]),r=t.startsWith("http");return x.c.debug("Opening Solana mobile wallet deep link",{wallet:dM(this,dZ)[dZ].name,linkType:r?"universal":"native"}),void(null==dM(this,dJ)[dJ]||dM(this,dJ)[dJ].call(this,{native:t,universal:t}))}x.c.debug("Displaying Solana WalletConnect QR code"),null==dM(this,dJ)[dJ]||dM(this,dJ)[dJ].call(this,{native:e,universal:void 0})},dM(this,pa)[pa]=()=>{x.c.debug("Solana WalletConnect session deleted"),dM(this,d2)[d2]()}}}
57function pc(e,...t){dM(this,dz)[dz][e]?.forEach(e=>e.apply(null,t))}function pu(e,t){dM(this,dz)[dz][e]=dM(this,dz)[dz][e]?.filter(e=>t!==e)}function pf(e){return e.namespaces.solana.accounts.reduce((e,t)=>{let r=t.split(":").at(-1);return e.includes(r)||e.push(r),e},[])}function ph(e){switch(e){case"solana:mainnet":return dL;case"solana:devnet":return d$;default:return e}}l.S,p.g,p.s,y.g,p.f;var pd={id:l.l,createSiwsMemoTransaction:({address:e,nonce:t})=>{let r=function(e,t){let r={...e};return Object.freeze({accounts:(r.signers??[]).map(e=>({address:e.address,role:v.g4.READONLY_SIGNER,signer:e})),data:(0,b.Q5)([["memo",(0,w.io)()]]).encode(r),programAddress:(void 0)??"MemoSq4gqABAXKb96qnH8TysNcWxMyWCqXgDLGmfcHr"})}({memo:(0,l.p)({address:(0,h.Lk)(e),nonce:t})});return(0,c.z)((0,u.fy)({version:"legacy"}),t=>(0,u.DC)((0,h.Lk)(e),t),e=>(0,u.bV)({blockhash:(0,d.Jt)("GfVcyD5fWFJ6hRm8bsy7CoVPsLSoJhtJKRJYk8T2VVFN"),lastValidBlockHeight:0n},e),e=>(0,u.t9)([r],e),e=>(0,f.qy)(e),e=>m.US.encode(Uint8Array.from((0,f.Kt)().encode(e))))},getSignatureFromTransaction:(e,t)=>{let r=(0,f.x7)().decode(e).signatures[t];if(!r)throw Error(`Missing transaction signature for address: ${t}`);return m.US.encode(r)}},pp=()=>(0,g.a)(pd);function pg(){let{create:e}=(0,l.n)();return{createWallet:async t=>{t&&"target"in t&&t&&(t=void 0);let{account:r}=await e({chainType:"solana",options:t});return{wallet:r}}}}},18825:function(e,t,r){"use strict";r.d(t,{a:function(){return c}});var n=r(26558),i=r(97422),s=r(3266),o=r(71787),a=r(2265),l=r(22931);function c(){let{user:e,getAccessToken:t}=(0,s.u)(),{walletProxy:r,openModal:c,client:u}=(0,i.u)(),{setModalData:f}=(0,s.a)(),h=(0,n.u)();return(0,a.useMemo)(()=>({exportWallet:n=>new Promise(async(a,d)=>{if(!e)return void d(new i.b("User must be authenticated before exporting their Privy wallet"));let p=n?.address?(0,s.j)(e,n.address):(0,s.f)(e);if(!p)return void d(new i.b("User must have an embedded wallet."));if(!(0,o.b)(p))return void d(Error(`Export is not supported for ${p.chainType} wallets`));let g=(0,s.b)(p),{entropyId:y,entropyIdVerifier:m}=(0,l.b)(e,p);await t()?r?(f({connectWallet:{recoveryMethod:p.recoveryMethod,connectingWalletAddress:p.address,isUnifiedWallet:g,entropyId:y,entropyIdVerifier:m,onCompleteNavigateTo:"EmbeddedWalletKeyExportScreen",onFailure:d,shouldForceMFA:!0},keyExport:{appId:h.id,appClientId:h.appClientId,origin:u.apiUrl,address:p.address,entropyId:y,entropyIdVerifier:m,hdWalletIndex:p.walletIndex,chainType:p.chainType,walletId:p.id,isUnifiedWallet:g,imported:p.imported,onSuccess:a,onFailure:d,showBackButton:n?.showBackButton}}),c("EmbeddedWalletConnectingScreen")):d(new i.b("Wallet not ready for export")):d(new i.b("Must have valid access token."))})}),[e,t,r,c,u,f,h])}},71787:function(e,t,r){"use strict";r.d(t,{A:function(){return C},B:function(){return ec},C:function(){return Q},D:function(){return k},E:function(){return T},F:function(){return W},G:function(){return F},H:function(){return Y},I:function(){return eo},J:function(){return R},P:function(){return X},S:function(){return ea},W:function(){return eu},a:function(){return er},b:function(){return ef},c:function(){return K},d:function(){return L},e:function(){return et},f:function(){return J},g:function(){return z},h:function(){return ed},i:function(){return M},j:function(){return q},k:function(){return eg},l:function(){return ei},m:function(){return D},n:function(){return $},o:function(){return eh},p:function(){return U},q:function(){return V},r:function(){return en},s:function(){return N},t:function(){return j},u:function(){return em},v:function(){return eb},w:function(){return B},x:function(){return Z},y:function(){return ey},z:function(){return P}});var n=r(97422),i=r(22931),s=r(87201),o=r(5653),a=r(21207),l=r(16914),c=r(23561),u=r(38795),f=r(7455),h=r(93784),d=r(26072),p=r(3265),g=r(1229),y=r(93352),m=r(85470),b=r(8891),w=r(76470),v=r(18415),E=r(26558),x=r(57437),_=r(2265),A=r(40053),S=r(3266);let I=e=>e.isApexWallet?"Apex Wallet":e.isAvalanche?"Core Wallet":e.isBackpack?"Backpack":e.isBifrost?"Bifrost Wallet":e.isBitKeep?"BitKeep":e.isBitski?"Bitski":e.isBlockWallet?"BlockWallet":e.isBraveWallet?"Brave Wallet":e.isClover?"Clover":e.isCoin98?"Coin98 Wallet":e.isCoinbaseWallet?"Coinbase Wallet":e.isDawn?"Dawn Wallet":e.isDefiant?"Defiant":e.isDesig?"Desig Wallet":e.isEnkrypt?"Enkrypt":e.isExodus?"Exodus":e.isFordefi?"Fordefi":e.isFrame?"Frame":e.isFrontier?"Frontier Wallet":e.isGamestop?"GameStop Wallet":e.isHaqqWallet?"HAQQ Wallet":e.isHyperPay?"HyperPay Wallet":e.isImToken?"ImToken":e.isHaloWallet?"Halo Wallet":e.isKuCoinWallet?"KuCoin Wallet":e.isMathWallet?"MathWallet":e.isNovaWallet?"Nova Wallet":e.isOkxWallet||e.isOKExWallet?"OKX Wallet":e.isOneInchIOSWallet||e.isOneInchAndroidWallet?"1inch Wallet":e.isOneKey?"OneKey Wallet":e.isOpera?"Opera":e.isPhantom||"isPhantom"in e?"Phantom":e.isPortal?"Ripio Portal":e.isRabby?"Rabby Wallet":e.isRainbow?"Rainbow":e.isSafePal?"SafePal Wallet":e.isStatus?"Status":e.isSubWallet?"SubWallet":e.isTalisman?"Talisman":e.isTally||e.isTaho?"Taho":e.isTokenPocket?"TokenPocket":e.isTokenary?"Tokenary":e.isTrust||e.isTrustWallet?"Trust Wallet":e.isTTWallet?"TTWallet":e.isXDEFI?"XDEFI Wallet":e.isZeal?"Zeal":e.isZerion?"Zerion":e.isMetaMask?"MetaMask":void 0,O=(e,t)=>{if(!e.isMetaMask)return!1;if(e.isMetaMask&&!t)return!0;
57if(e.isBraveWallet&&!e._events&&!e._state||"MetaMask"!==I(e))return!1;if(e.providers){for(let t of e.providers)if(!O(t))return!1}return!0},P=()=>{let e=window;if(!e.ethereum)return!1;if(e.ethereum.isCoinbaseWallet)return!0;if(e.ethereum.providers){for(let t of e.ethereum.providers)if(t&&t.isCoinbaseWallet)return!0}return!1},C=(e,t)=>{let r=[],n=[];for(let[i,s]of e.entries())i<t?r.push(s):n.push(s);return[r,n]},k=e=>!!String(e).toLowerCase().match(/^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/),T=(e,t)=>{let r=e.slice(0),n=[];for(;r.length;)n.push(r.splice(0,t));return n},B=(e,t=3,r=4,n="ethereum")=>{if(!e)return"";let i="ethereum"===n?2:0;return t+r+i+3>=e.length?e:`${e.slice(0,i+t)}...${e.slice(e.length-r,e.length)}`},R=(e,t=3,r=4)=>B(e,t,r,"solana"),D=e=>new Promise(t=>setTimeout(t,e));function U(e,{interval:t=100,timeout:r=5e3}={}){return new Promise((n,i)=>{let s,o=0,a=()=>{o>=r?i("Max attempts reached without result"):(s=e(),o+=t,null==s?setTimeout(a,t):n(s))};a()})}let M=(e,t={})=>{let r=t.delayMs||150,n=t.maxAttempts||270;return new Promise(async(i,s)=>{let o=!1,a=0;for(;!o&&a<n;){if(t.abortSignal?.aborted)return;e().then(e=>{o=!0,i(e)},(...e)=>{o=!0,s(...e)}),a+=1,await D(r)}o||s(Error("Exceeded max attempts before resolving function"))})},N=e=>e.replace(/([\u2700-\u27BF]|[\uE000-\uF8FF]|\uD83C[\uDC00-\uDFFF]|\uD83D[\uDC00-\uDFFF]|[\u2011-\u26FF]|\uD83E[\uDD10-\uDDFF])/g,""),j=e=>"string"==typeof e?e:"0x"+e.toString(16);async function L({store:e,walletList:t,externalWalletConfig:r,walletChainType:n,timeout:i=3e3}){let s=!1,o=window;return new Promise(a=>{function l(){if(s)return;s=!0,window.removeEventListener("ethereum#initialized",l);let i=e.getProviders();console.debug("Detected injected providers:",i.map(e=>e.info));let o=[];for(let e of i)t.includes("coinbase_wallet")&&"com.coinbase.wallet"===e.info.rdns||"solana-only"===n&&"app.phantom"===e.info.rdns||o.push({type:e.info.name.toLowerCase().replace(/\s/g,"_"),eip6963InjectedProvider:e});if("solana-only"!==n)for(let e of function(){let e=window,t=e.ethereum;if(!t)return[];let r=[];if(t.providers?.length)for(let e of t.providers)e&&r.push(e);return r.push(e.ethereum),r}()){let t=I(e);if(!i.some(e=>e.info.name===t)){if(O(e,!0)&&!o.find(e=>"metamask"===e.type)){o.push({type:"metamask",legacyInjectedProvider:e});continue}if("Phantom"===t&&!o.find(e=>"phantom"===e.type)){o.push({type:"phantom",legacyInjectedProvider:e});continue}if("Coinbase Wallet"===t&&!o.find(e=>"coinbase_wallet"===e.type&&"smartWalletOnly"!==r.coinbaseWallet?.config?.preference?.options)){o.push({type:"coinbase_wallet",legacyInjectedProvider:e});continue}o.find(e=>"unknown_browser_extension"===e.type)||o.push({type:"unknown_browser_extension",legacyInjectedProvider:e})}}a(o)}o.ethereum?l():(window.addEventListener("ethereum#initialized",l,{once:!0}),setTimeout(()=>{l()},i))})}function $(e){return`eip155:${String(Number(e))}`}let z=(e,t,r,s)=>{let o=Number(e),a=t.find(e=>e.id===o);if(!a)throw new n.P(`Unsupported chainId ${e}`,4901);return(0,i.d)(a,r,s)},F=(e,t)=>{let r=Number(e),i=t.find(e=>e.id===r);if(!i)throw new n.P(`Unsupported chainId ${e}`,4901);return i.blockExplorers?.default.url},q=e=>{let t={name:"string",version:"string",chainId:"uint256",verifyingContract:"address",salt:"bytes32"},r=e.types.EIP712Domain??Object.entries(e.domain).map(([e,r])=>{if(null!=r&&"string"==typeof e&&e in t)return{name:e,type:t[e]}}).filter(e=>void 0!==e);return{...e,types:{...e.types,EIP712Domain:r}}};function W(e,{min:t,max:r}){return Math.min(Math.max(e,t),r)}let V=e=>e?.map(e=>({signer_id:e.signerId,override_policy_ids:e.policyIds})),H="[Privy:Connectors]";function G(e){if(!e||0===Object.keys(e).length)return"";let t=Object.entries(e).filter(([,e])=>null!=e).map(([e,t])=>`${e}=${String(t)}`);return t.length>0?` (${t.join(", ")})`:""}let K=new class{setEnabled(e){this._enabled=e,e&&this.info("Debug logging enabled")}get enabled(){return this._enabled}debug(e,t){this._enabled&&console.debug(`${H} ${e}${G(t)}`)}info(e,t){this._enabled&&console.info(`${H} ${e}${G(t)}`)}warn(e,t){this._enabled&&console.warn(`${H} ${e}${G(t)}`)}error(e,t,r){if(!this._enabled)return;let n=t instanceof Error?t.message:t?String(t):void 0,i=n?{...r,error:n}:r;console.error(`${H} ${e}${G(i)}`)}connectionStart(e,t,r){this.info("Connection attempt started",{wallet:e,method:t,...r})}connectionSuccess(e,t){this.info("Connection successful",{wallet:e,...t})}connectionFailed(e,t,r){this.error("Connection failed",t,{wallet:e,...r})}connectorInit(e,t,r){this.debug("Connector initialized",{connector:e,wallet:t,...r})}connectorCreated(e,t,r){this.debug("Connector created",{connector:e,wallet:t,...r})}providerEvent(e,t,r){this.debug(`Provider event: ${e}`,{wallet:t,...r})}rpcRequest(e,t,r){this.debug(`RPC request: ${e}`,{wallet:t,...r})}rpcResponse(e,t,r){this.debug(`RPC response: ${e}`,{wallet:t,...r})}constructor(){this._enabled=!1}};class Z extends n.P{constructor(){super("Wallet timeout"),this.type="wallet_error",K.warn("Wallet request timed out")}}let J=e=>{if(e instanceof n.P)return K.debug("Connector error (already formatted)",{error:e.message}),e;if(e?.code){let t=new X(e);return K.debug("Provider RPC error",{code:t.code,error:t.message}),t}let t=e instanceof Error?e.message:String(e);return K.debug("Unknown connector error",{error:t}),new n.P("Unknown connector error",e)};class Y extends n.g{constructor(e,t,r){super(e),this.type="provider_error",this.co
57de=t,this.data=r}}class X extends Y{constructor(e){super(e.message,e.code,e.data);let t=Object.values(s.M_).find(t=>t.eipCode===e.code);this.details=t||s.M_.UNKNOWN_ERROR,-32002===e.code&&(e.message?.includes("already pending for origin")?e.message?.includes("wallet_requestPermissions")?this.details=s.M_.E32002_CONNECTION_ALREADY_PENDING:this.details=s.M_.E32002_REQUEST_ALREADY_PENDING:e.message?.includes("Already processing")&&e.message.includes("eth_requestAccounts")&&(this.details=s.M_.E32002_WALLET_LOCKED))}}let Q={ERROR_USER_EXISTS:{message:"User already exists for this address",detail:"Try another address!",retryable:!1},ERROR_TIMED_OUT:{message:"Wallet request timed out",detail:"Please try connecting again.",retryable:!0},ERROR_WALLET_CONNECTION:{message:"Could not log in with wallet",detail:"Please try connecting again.",retryable:!0},ERROR_USER_LIMIT_REACHED:{message:"Unable to link",detail:"You've reached the maximum number of linked wallets.",retryable:!1},...s.M_};class ee{get(e){let t=localStorage.getItem(e);return null===t?void 0:JSON.parse(t)}put(e,t){void 0!==t?localStorage.setItem(e,JSON.stringify(t)):this.del(e)}del(e){localStorage.removeItem(e)}getKeys(){return Object.entries(localStorage).map(([e])=>e)}}function et(){try{let e="privy:__session_storage__test",t=new ee;return t.put(e,"blobby"),t.del(e),!0}catch(e){return!1}}var er="undefined"!=typeof window&&window.localStorage?new ee:new class{get(e){return this._cache[e]}put(e,t){void 0!==t?this._cache[e]=t:this.del(e)}del(e){delete this._cache[e]}getKeys(){return Object.keys(this._cache)}constructor(){this._cache={}}};class en extends v.Z{constructor(e){super(),this.walletClientType=e,this.connected=!1,this.initialized=!1}}let ei=()=>{let e=er.get(E.k);return e&&Array.isArray(e)&&e.map(e=>e&&"string"==typeof e.address&&"string"==typeof e.connectorType&&"string"==typeof e.walletClientType&&"number"==typeof e.connectedAt).every(Boolean)?e:[]},es=["phantom","metamask","glow","solflare","backpack","okx_wallet","walletconnect","mobile_wallet_adapter","jupiter"];function eo(e){return e.toLowerCase().split(" ").join("_")}class ea extends en{get isInstalled(){return!0}get wallet(){return this._wallet}buildConnectedWallet(){return this._wallet.accounts.map(e=>({type:"solana",provider:new o.O({wallet:this._wallet,account:e}),address:e.address,connectedAt:Date.now(),walletClientType:this._wallet.name,connectorType:this.connectorType,imported:!1,meta:{name:this._wallet.name,id:this._wallet.name,icon:this._wallet.icon},isConnected:async()=>this._wallet.accounts.length>0,disconnect:async()=>{await this.disconnect()}}))}async syncAccounts(){this.wallets=this.buildConnectedWallet(),this.emit("walletsUpdated")}get walletBranding(){return{id:el(this.wallet)?"walletconnect_solana":this.wallet.name,name:this.wallet.name,icon:this.wallet.icon}}async initialize(){K.debug("Initializing Solana connector",{wallet:this.walletClientType}),this.subscribeListeners(),await this.syncAccounts(),this.shouldAttemptAutoConnect()&&(K.debug("Attempting Solana auto-connect",{wallet:this.walletClientType}),await this.wallet.features["standard:connect"]?.connect({silent:!0}).catch(()=>{}),await this.isConnected()&&(K.debug("Solana auto-connect successful",{wallet:this.walletClientType}),await this.syncAccounts())),this.initialized=!0,this.emit("initialized")}async connect(e){if(K.connectionStart(this.walletClientType,"solana_adapter",{showPrompt:e.showPrompt}),e.showPrompt)try{await this.promptConnection()}catch(e){if(0===this._wallet.accounts.length)throw K.warn("Solana wallet connected but has no accounts",{wallet:this.walletClientType}),new n.j;throw K.connectionFailed(this.walletClientType,e,{method:"solana_adapter"}),e}if(!await this.isConnected())throw K.warn("Solana wallet not connected after prompt",{wallet:this.walletClientType}),new n.j;await this.syncAccounts();let t=await this.getConnectedWallet();return t&&K.connectionSuccess(this.walletClientType),t}async getConnectedWallet(){return this.wallets.sort((e,t)=>t.connectedAt-e.connectedAt)[0]||null}async isConnected(){return this._wallet.accounts.length>0}subscribeListeners(){this._unsubscribeListeners=this.wallet.features["standard:events"]?.on("change",this.onChange)}unsubscribeListeners(){this._unsubscribeListeners?.()}shouldAttemptAutoConnect(){return!(!this.autoConnectEnabled||!es.includes(this.walletClientType))&&("phantom"!==this.walletClientType&&"metamask"!==this.walletClientType.toLowerCase()||ei().some(({walletClientType:e})=>"phantom"===e||"metamask"===e.toLowerCase()))}constructor(e,t){super(eo(el(e)?"walletconnect_solana":e.name)),this.chainType="solana",this.connectorType="solana_adapter",this.disconnect=async()=>{K.debug("Disconnecting Solana wallet",{wallet:this.walletClientType}),await this.wallet.features["standard:disconnect"]?.disconnect().catch(e=>{K.error("Error disconnecting Solana wallet",e,{wallet:this.walletClientType})}),await this.syncAccounts()},this.promptConnection=async()=>{K.debug("Prompting Solana connection",{wallet:this.walletClientType});try{await this.wallet.features["standard:connect"]?.connect()}catch(e){throw K.connectionFailed(this.walletClientType,e,{method:"solana_adapter"}),J(e)}},this.onChange=()=>{this.syncAccounts()},this._wallet=e,this.autoConnectEnabled=t,this.wallets=[]}}
57function el(e){return"isWalletConnectSolana"in e&&e.isWalletConnectSolana}let ec=({style:e,...t})=>{let r=(0,E.u)();return(0,x.jsxs)("svg",{width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",style:{height:"28px",width:"28px",...e},...t,children:[(0,x.jsx)("rect",{width:"28",height:"28",rx:"3",fill:"dark"===r?.appearance.palette.colorScheme?"#3396ff":"#141414"}),(0,x.jsx)("g",{clipPath:"url(#clip0_1765_9946)",children:(0,x.jsx)("path",{d:"M8.09448 10.3941C11.3558 7.20196 16.6442 7.20196 19.9055 10.3941L20.2982 10.7782C20.3369 10.8157 20.3677 10.8606 20.3887 10.9102C20.4097 10.9599 20.4206 11.0132 20.4206 11.0671C20.4206 11.121 20.4097 11.1744 20.3887 11.224C20.3677 11.2737 20.3369 11.3186 20.2982 11.3561L18.9554 12.6702C18.9158 12.7086 18.8628 12.7301 18.8077 12.7301C18.7526 12.7301 18.6996 12.7086 18.66 12.6702L18.1198 12.1415C15.8448 9.91503 12.1557 9.91503 9.88015 12.1415L9.30167 12.7075C9.26207 12.7459 9.20909 12.7673 9.15395 12.7673C9.0988 12.7673 9.04582 12.7459 9.00622 12.7075L7.66346 11.3934C7.62475 11.3559 7.59397 11.3109 7.57295 11.2613C7.55193 11.2117 7.5411 11.1583 7.5411 11.1044C7.5411 11.0505 7.55193 10.9971 7.57295 10.9475C7.59397 10.8979 7.62475 10.8529 7.66346 10.8154L8.09448 10.3941ZM22.6829 13.1115L23.8776 14.2814C23.9163 14.319 23.9471 14.3639 23.9681 14.4135C23.9892 14.4632 24 14.5165 24 14.5704C24 14.6243 23.9892 14.6777 23.9681 14.7273C23.9471 14.777 23.9163 14.8219 23.8776 14.8594L18.4893 20.1332C18.4102 20.2101 18.3042 20.2531 18.1938 20.2531C18.0835 20.2531 17.9775 20.2101 17.8984 20.1332L14.0743 16.3901C14.0545 16.3708 14.0279 16.36 14.0003 16.36C13.9726 16.36 13.9461 16.3708 13.9263 16.3901L10.1021 20.1332C10.023 20.2101 9.91703 20.2531 9.8067 20.2531C9.69636 20.2531 9.59038 20.2101 9.51124 20.1332L4.12236 14.8594C4.08365 14.8219 4.05287 14.777 4.03185 14.7273C4.01083 14.6777 4 14.6243 4 14.5704C4 14.5165 4.01083 14.4632 4.03185 14.4135C4.05287 14.3639 4.08365 14.319 4.12236 14.2814L5.31767 13.1115C5.39678 13.0348 5.50265 12.9919 5.61285 12.9919C5.72305 12.9919 5.82892 13.0348 5.90803 13.1115L9.73216 16.8546C9.75194 16.874 9.7785 16.8848 9.80616 16.8848C9.83381 16.8848 9.86037 16.874 9.88015 16.8546L13.7043 13.1115C13.7834 13.0346 13.8894 12.9916 13.9997 12.9916C14.1101 12.9916 14.216 13.0346 14.2952 13.1115L18.1198 16.8546C18.1396 16.874 18.1662 16.8848 18.1938 16.8848C18.2215 16.8848 18.2481 16.874 18.2678 16.8546L22.092 13.1115C22.1711 13.0346 22.2771 12.9916 22.3874 12.9916C22.4977 12.9916 22.6037 13.0346 22.6829 13.1115Z",fill:"white"})}),(0,x.jsx)("defs",{children:(0,x.jsx)("clipPath",{id:"clip0_1765_9946",children:(0,x.jsx)("rect",{width:"20",height:"12.2531",fill:"white",transform:"translate(4 8)"})})})]})},eu="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAAIGNIUk0AAHomAACAhAAA+gAAAIDoAAB1MAAA6mAAADqYAAAXcJy6UTwAAAAGYktHRAD/AP8A/6C9p5MAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAHdElNRQfoDAIVODUC+w+GAAAGsUlEQVRYw6WXbYwWVxXHf+fOLAtCXYS2QJdIaClipGCTknXXNqBQMVHbfmhItH4Aral+IAEaG03UxJgYKQJGTUxtDWjaxDSNtcZqIGDwpRuW1oYiVqpdpZSlpC3qysu+PHPP3w/3mXnmeXZbPzjJZO7cefn/z/mfe865xlscq3dGDIguGiHLaMQVLja4s87FShcLo5jtApdddnHexUmHIy475JmdUkPRAQMu7gzT4ljnxJpdk0QPmMFkyAKN2OfOFpc2uuh1J3MZDrjAvXmVEQUuoosRxw642FcEG7IoDxiFxNiu8NYE+vcUYIFYRKKs113bXWx2Z34CoQZsVHOiCZ7mopdzdsFhv8NexEgRDHMxUSNREbh1bwNZwBsFblmfu/a4a6AEENYO5i3AOoEWeEUCF4MOOxBDMQAOk99OJALA2u80sBCwWGBZWG/yRwMaCAbBIAsQTJT3gea1OWfNeaPzvjoHEI85rA8ObtB1v7cIdJkIHgkh9AXpocy0LJjIKvB2wPpZB0v3wkrw5jdNEjeYeMhFX3BAyfn2ke9NUrgB9LrrcZcGJFCld4fWNddXbvbWfWzGR6xJFZsBGh0cBh3bBIxIEGTQ3W0h4NuDaSAzyAxCmGq11Vzf5uaa1aG8p+WFtrEYQGwvjICJkAEqvC+YNmcmMlMNvEaCdrcbyUvQAWDTjVuESHObM6cPGWHmzDwLaEtmzG9Z3qF1zUpXmuuZBb1z4bqeNC6f0WE1NtUTwHzEloiy3BvFisy0sYoLlQtT6XW15md2Qf9SY+2Ngfdca/TMSm/9ewz+/Boc/It45h/i4kSTsKw90SQJsPTvjSZbkWemDW7qTRZ0JEYJWSKxZJ7xmf6M224MzMzbX1s8F1YugjtvMg6eErt/4/z1jUrz1rXUKxnZC2zIg2mdBTK1mFUOKC1fOt/48kdzVixIz86Nij+eEacvpJWyZJ5xy7th8VzjjpuMJfMCW58QL73ekXPVlhsyE+vyzFiplJyauEIyrGIquruMq7qTxk+dcB495rzyTzFepCUWLIFv/kBg081Gd55WUk1IDGFTS89K++TDYxddzKnWcbluHd450xgdh7EGrOo1rr868PMTzqWJRGZ2d8oB/xpL33Xnxl2rjeNn4blXRXduzJ4B5y+28kWscA
57wXl+yeR654FFZPHoUb710YuPeDOUdPO48di1xptKpeEeHqOcYXNwQKGd88EDk3mqxtxPSfGRlsXRtYt8z4ytPOH/7eqpg1Aso7fYKgK4NPrMpYvsC4/poMA34yVJIQC3sCD9yecdsNyaV5yPj6ryJnR1PAvSNP4J+/1cgDfLbfePaMGGtM7Qdyl12WmKOmXgKKAp54vmBRTxfLrjE+tSYjBPjRM5FrrzIeuD2jf2lLzw8vN4JlfPVp581LsO1DgXv7jSzAiXPw/d+JiYLpjsu26Yfjf5O0rF5WoxsNT9G/bX0XKxakmPjlSee6HlizJJXSX7/oRDc+vjKR+f2wODcKd78/gR8/C9uedF44myJxmhh4OY/ipMQyqaWxmjn95TfEroMFOzbkvG+RceeqViPx1Aln1yEnOow1AnffHCpJAJ5/Vex4UvzptZRdY/O/1dJIS/NkcNmR6MTYah6qzseA4TfFtw4UvHBW1bc/O+7sPhwZHYf/jMODh5yfPudVbXj2TAJ/8XxrOZagNamj4Ei2/GNfuyRxh8t6BG2l15up+MIVODEiFr8rcPS0+O6RBF6mrrEGHHtFzOo2Lo7Dl37hvPQ6mNV6R9JYKgnYWcE37K5HlE2OT/5A0udaPUBHH+BQOMzuNsYLuDyZflTW+fTcmJFDHhJhaZqewMuewXDxcDR9IYyPN6Jj+6K4MF2vV8qBtZJScqVRNi6lpGONVJis5mpKi1WbgwsY+zIsBpcR8mzIZfuTRVZrtdu9odrptR/Xx5XONXJqBmCN0P6YMUQq9WJiwt0Je102WHdbpxSqydMObBWYdwDWLVcqcIMYe3NPjg0Ht84od0Ajju1w2XCr9e6QoqM9V23ZtnmI6cfAMMb9AY0YEHdb6oobEh4y3H3Ize6LsmGvN5IdUnhttdQ9UVrfLk/ljWEZ9wXsqAdQk1EA+O22GcgdZTke/bAs3OPY4HSdcB20HhvVtTMu0jmI8ekAhz2IICj2hKpNqI60NcuIRUHEej1quzubXa2tmZhenrfZmv3YYQ9ipDAIgvHptmblccuDjdRcmjFpWbDi/9ycZjZkRbk5jYztai/AUwiUx+qdEQB/m+25i9lxyvbcjrg45Lmd0uT/3p7/Fw6ODf+WO019AAAAJXRFWHRkYXRlOmNyZWF0ZQAyMDI0LTEyLTAyVDIxOjU2OjQ4KzAwOjAwMVpslgAAACV0RVh0ZGF0ZTptb2RpZnkAMjAyNC0xMi0wMlQyMTo1Njo0OCswMDowMEAH1CoAAAAodEVYdGRhdGU6dGltZXN0YW1wADIwMjQtMTItMDJUMjE6NTY6NTMrMDA6MDDZv6GRAAAAAElFTkSuQmCC";function ef(e){return["ethereum","solana"].includes(e.chainType)}function eh(e){let t=e.replace("eip155:","");if(t)return parseInt(t);throw Error("Chain ID not compatible with CAIP-2 format.")}let ed=e=>e.filter(e=>"wallets"===e.method||("exchange"===e.method?"coinbase"===e.provider:"card"===e.method||"payment-request"===e.method?"coinbase"===e.provider||"moonpay"===e.provider:(e.method,!1))),ep={[a.R.id]:"0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48",[l.F.id]:"0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238",[c.v.id]:"0x0b2c639c533813f4aa9d7837caf62653d097ff85",[u.O.id]:"0x5fd84259d66Cd46123540766Be93DFE6D43130D7",[f.y.id]:"0x3c499c542cef5e3811e1192ce70d8cc03d5c3359",[h.v.id]:"0x41e94eb019c0762f9bfcf9fb1e58725bfb0e7582",[d.u.id]:"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",[p.L.id]:"0x036CbD53842c5426634e7929541eC2318f3dCF7e",[g.p.id]:"0xB97EF9Ef8734C71904D8002F8b6Bc66Dd9c48a6E",[y.c.id]:"0x5425890298aed601595a70ab815c96711a31bc65",[m.y.id]:"0xaf88d065e77c8cC2239327C5EDb3A432268e5831",[b.Z.id]:"0x75faf114eafb1BDbe2F0316DF893fd58CE46AA4d",999:"0xb88339CB7199b77E23DB6E890353E22632Ba630f",[w.m.id]:"0x754704Bc059F8C67012fEd69BC8A327a5aafb603"},eg=({address:e,appConfig:t,fundWalletConfig:r,methodScreen:i,chainIdOverride:s,comingFromSendTransactionScreen:o=!1,onComplete:a,onError:l})=>{let c,u;if(!t.fundingConfig)throw Error("Wallet funding is not enabled");let f=ed(t.fundingConfig.options);if(f.length<1)throw Error("Wallet funding is not enabled");c=s||(r?.chain?r.chain.id:eh(t.fundingConfig.defaultRecommendedCurrency.chain));let h=t.chains.find(e=>e.id===c);if(!h)throw new n.b(`Funding chain ${c} is not in PrivyProvider chains list`);let d=r?.amount??t.fundingConfig.defaultRecommendedAmount,p=!1;function g(){if(!c)return;let e=ep[c];f.find(e=>"wallets"===e.method)&&!e&&console.warn("Attempting to fund with USDC on chain where USDC address is not known. Funding via external wallet will be disabled."),u=e,p=!0}r&&"asset"in r?"USDC"===r.asset?g():"string"!=typeof r.asset&&"erc20"in r.asset&&(p=(u=r.asset.erc20)===ep[h.id]):"USDC"===t.fundingConfig.defaultRecommendedCurrency.asset&&g();let y=r?.defaultFundingMethod;return{chainType:"ethereum",address:e,amount:d,chain:h,erc20Address:u,erc20ContractInfo:p?{symbol:"USDC",decimals:6}:void 0,isUSDC:p,methodScreen:i,supportedOptions:f,comingFromSendTransactionScreen:o,defaultFundingMethod:y,usingDefaultFundingMethod:!!y,preferredCardProvider:r?.card?.preferredProvider,crossChainBridgingEnabled:t.fundingConfig.crossChainBridgingEnabled??!1,solanaChain:"solana:mainnet",uiConfig:r&&"uiConfig"in r?r.uiConfig:void 0,externalSolanaFundingScreen:null,onComplete:a??(()=>{}),onError:l??(()=>{})}};function ey({address:e,fundWalletConfig:t,appConfig:r,comingFromSendTransactionScreen:n,externalSolanaFundingScreen:i,methodScreen:s}){if(!r.fundingConfig)throw Error("Wallet funding is not enabled");let o=ed(r.fundingConfig.options);if(o.length<1)throw Error("Wallet funding is not enabled");if("USDC"===t?.asset&&"solana:testnet"===t?.chain)throw Error("USDC funding is not supported on the Solana testnet");let a=t?.amount??r.fundingConfig.defaultRecommendedAmount,l=t?.defaultFundingMethod;return{chainType:"solana",address:e,supportedOptions:o,amount:a,isUSDC:"USDC"===t?.asset,methodScreen:s,comingFromSendTransactionScreen:n,chain:t?.chain||"solana:mainnet",crossChainBridgingEnabled:r.fundingConfig.crossChainBridgingEnabled??!1,defaultFundingMethod:l,preferredCardProvider:t?.card?.preferredProvider,usingDefaultFundingMethod:!!l,uiConfig:t?.uiConfig,externalSolanaFundingScreen:i,onComplete:()=>{},onError:()=>{}}}function em(){let{user:e,getAccessToken:t}=(0,S.u)(),{walletProxy:r,openModal:s,client:o}=(0,n.u)(),{setModalData:a}=(0,S.a)(),l=(0,E.u)();return(0,_.useMemo)(()=>({exportWallet:c=>new Promise(async(u,f)=>{if(!e)return void f(Error("User must be authenticated before exporting their Privy wallet"));c&&"target"in c&&c&&(c=void 0);let h=c?.address?(0,S.j)(e,c.address):(0,S.d)(e);if(!h)return void f(new n.b("User must have an embedded wallet."));let d=h.address,{entropyId:p,entropyIdVerifier:g}=(0,i.b)(e,h),y=(0,S.b)(h);if(!d)return void f(Error("User does not have an HD Ethereum wallet. To export an imported wallet, pass the `address` of the wallet to `exportWallet`."));
57if(!(0,A.U)(d))return void f(Error("Must provide a valid Ethereum address."));let m={recoveryMethod:h.recoveryMethod,connectingWalletAddress:h.address,isUnifiedWallet:y,entropyId:p,entropyIdVerifier:g,onCompleteNavigateTo:"EmbeddedWalletKeyExportScreen",onFailure:f,shouldForceMFA:!0};await t()&&r?ef(h)?(a({keyExport:{appId:l.id,appClientId:l.appClientId,origin:o.apiUrl,address:h.address,entropyId:p,entropyIdVerifier:g,hdWalletIndex:h.walletIndex,chainType:h.chainType,walletId:h.id,isUnifiedWallet:y,imported:h.imported,onSuccess:u,onFailure:f,showBackButton:c?.showBackButton},connectWallet:m}),s("EmbeddedWalletConnectingScreen")):f(Error(`Export is not supported for ${h.chainType} wallets`)):f(Error("Must have valid access token."))})}),[e,t,r,s,o,a,l])}let eb=()=>{let{client:e,setUser:t}=(0,n.u)();return{unlink:(0,_.useCallback)(async({address:r})=>{let n;return t(n=r.startsWith("0x")?await e.unlinkEthereumWallet(r):await e.unlinkSolanaWallet(r)),n},[e,t])}}},81476:function(e,t,r){"use strict";r.d(t,{A:function(){return G},B:function(){return en},C:function(){return K},D:function(){return J},E:function(){return C},F:function(){return Y},G:function(){return z},H:function(){return Z},I:function(){return W},J:function(){return H},K:function(){return F},L:function(){return et},M:function(){return B},N:function(){return X},O:function(){return er},P:function(){return k},Q:function(){return q},R:function(){return eo},S:function(){return N},a:function(){return w},b:function(){return O},c:function(){return j},d:function(){return T},e:function(){return ef},f:function(){return E},g:function(){return v},h:function(){return S},i:function(){return P},j:function(){return I},k:function(){return U},l:function(){return L},m:function(){return D},n:function(){return ew},p:function(){return eh},q:function(){return ed},r:function(){return eu},s:function(){return A},u:function(){return $},w:function(){return em},z:function(){return x}});var n=r(2265),i=r(75709),s=r(26558),o=r(40053),a=r(91476),l=r(62851),c=r(97422),u=r(71787),f=r(57437),h=r(63858),d=r(78404),p=r(24257),g=r(3266),y=r(22931);let m=(0,i.U)(()=>({listings:[],loading:!1})),b=m.setState,w=e=>m.getState().listings.find(({slug:t})=>_(t)===_(e)),v=e=>{let t;try{t=new URL(e).hostname}catch(e){return}return m.getState().listings.find(({homepage:e})=>{let r;try{r=new URL(e).hostname}catch(e){return!1}return t.includes(r)})},E=(e=!0)=>{let t=(0,s.u)(),r=m(e=>e.listings),i=m(e=>e.loading),o=!!r.length;return(0,n.useEffect)(()=>{e&&!o&&(b({listings:[],loading:!0}),(async e=>{let t=new URL("v3/wallets","https://explorer-api.walletconnect.com");t.searchParams.append("projectId",e);let r=await fetch(t);return r.ok?Object.values((await r.json()).listings).sort(({slug:e},{slug:t})=>"rainbow"===e&&"metamask"===t?1:"metamask"===e||"rainbow"===e?-1:1):(console.debug(`Failed to fetch WalletConnect listings: ${await r.text().catch(()=>"No response.")}`),[])})(t.walletConnectCloudProjectId).then(e=>b({listings:e,loading:!1})).catch(e=>{console.error(e),b({listings:[],loading:!1})}))},[e,o,t.walletConnectCloudProjectId]),{listings:r,loading:i}},x=e=>{let{listings:t}=E();return t.find(({slug:t})=>_(t)===_(e))};function _(e){return"cryptocom"===e?"cryptocom-defi":"binance"===e?"binance-defi":e.replace(/[-_]wallet$/,"")}function A(e){return["wallet_connect","backpack","binance","binanceus","bitget_wallet","bybit_wallet","cryptocom","haha_wallet","jupiter","metamask","okx_wallet","phantom","rabby_wallet","rainbow","ronin_wallet","safe","solflare","uniswap","zerion","kraken_wallet"].some(t=>e?.includes(t))}function S(e){return"ethereum"===e.type}function I(e,t){if(e.length!==t.length)return!1;for(let r=0;r<e.length;r++){let n=e[r],i=t[r];if(n?.address!==i?.address||n&&i&&S(n)&&S(i)&&n?.chainId!==i?.chainId||n?.connectorType!==i?.connectorType||n?.connectedAt!==i?.connectedAt||n?.walletClientType!==i?.walletClientType||n?.isConnected!==i?.isConnected||n?.linked!==i?.linked)return!1}return!0}let O=(e,t)=>e.rpcTimeouts&&e.rpcTimeouts[t]||s.o;function P(e){return"ethereum"===e.chainType}class C extends u.r{buildConnectedWallet(e,t,r,n){let i=async()=>!!this.wallets.find(t=>(0,a.K)(t.address)===(0,a.K)(e));return{type:"ethereum",address:(0,a.K)(e),chainId:t,meta:r,imported:n,switchChain:async r=>{let n,s;if(!i)throw new c.P("Wallet is not currently connected.");let o=this.wallets.find(t=>a.K(t.address)===a.K(e))?.chainId;if(!o)throw new c.P("Unable to determine current chainId.");if("number"==typeof r?(n=`0x${r.toString(16)}`,s=r):(n=r,s=Number(r)),o===(0,u.n)(n))return;let l=this.chains.find(e=>e.id===s);if(!l)throw new c.P(`Unsupported chainId: ${r}`);let f=async()=>{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:n}]})};try{return await f()}catch(e){if(((e,t)=>{switch(t){case"coinbase_wallet":case"base_account":return e.message.includes("addEthereumChain");case"rabby_wallet":return e.message.includes("Unrecognized chain ID");default:return 4902===e.code||e.message?.includes("4902")}})(e,this.walletClientType))return"rabby_wallet"===this.walletClientType&&await (0,u.m)(300),await this.proxyProvider.request({method:"wallet_addEthereumChain",params:[{chainId:n,chainName:l.name,nativeCurrency:l.nativeCurrency,rpcUrls:[l.rpcUrls.default?.http[0]??""],blockExplorerUrls:[l.blockExplorers?.default.url??""]}]}),f();if("rainbow"===this.walletClientType&&e.message?.includes("wallet_switchEthereumChain"))throw new c.P(`Rainbow does not support the chainId ${t}`);throw e}},connectedAt:Date.now(),walletClientType:this.walletClientType,connectorType:this.connectorType,isConnected:i,getEthereumProvider:async()=>
57{if(!await i())throw new c.P("Wallet is not currently connected.");return this.proxyProvider},sign:async e=>{if(!await i())throw new c.P("Wallet is not currently connected.");return await this.sign(e)},disconnect:()=>{this.disconnect()}}}async syncAccounts(e){let t;u.c.debug("Syncing accounts",{wallet:this.walletClientType});let r=e;try{if(void 0===r){u.c.rpcRequest("eth_accounts",this.walletClientType);let e=await (0,u.i)(()=>this.proxyProvider.request({method:"eth_accounts"}),{maxAttempts:10,delayMs:500});u.c.rpcResponse("eth_accounts",this.walletClientType),Array.isArray(e)&&(r=e)}}catch(e){u.c.warn("Wallet did not respond to eth_accounts, using prefetched accounts",{wallet:this.walletClientType})}if(!r||!Array.isArray(r)||r.length<=0||!r[0])return void u.c.debug("No accounts found",{wallet:this.walletClientType});let n=r[0];if(!(0,o.U)(n))return;let i=(0,a.K)(n),l=[];if("privy"===this.walletClientType){let e=u.a.get((0,s.p)(i));this.chains.find(t=>t.id===Number(e))||(u.a.del((0,s.p)(i)),e=null),t=e||`0x${this.defaultChain.id.toString(16)}`;try{await this.proxyProvider.request({method:"wallet_switchEthereumChain",params:[{chainId:t}]})}catch(e){u.c.warn("Unable to switch embedded wallet chain on initialization",{wallet:this.walletClientType,chainId:t})}}else try{u.c.rpcRequest("eth_chainId",this.walletClientType);let e=await (0,u.i)(()=>this.proxyProvider.request({method:"eth_chainId"}),{maxAttempts:10,delayMs:500});if(u.c.rpcResponse("eth_chainId",this.walletClientType),"string"==typeof e)t=e;else{if("number"!=typeof e)throw Error("Invalid chainId returned from provider");t=`0x${e.toString(16)}`}}catch(e){u.c.warn("Failed to get chainId from provider, using default",{wallet:this.walletClientType,defaultChainId:s.q}),t=s.q}let c=(0,u.n)(t);if(!l.find(e=>(0,a.K)(e.address)===i)){let e={name:this.walletBranding.name,icon:this.walletBranding.icon,id:this.walletBranding.id};l.push(this.buildConnectedWallet((0,a.K)(n),c,e,"embedded_imported"===this.connectorType))}I(l,this.wallets)||(u.c.debug("Wallets updated",{wallet:this.walletClientType,address:i,chainId:c}),this.wallets=l,this.emit("walletsUpdated"))}async getConnectedWallet(){let e=await this.proxyProvider.request({method:"eth_accounts"});return this.wallets.sort((e,t)=>t.connectedAt-e.connectedAt).find(t=>e.find(e=>(0,a.K)(e)===(0,a.K)(t.address)))||null}async isConnected(){let e=await this.proxyProvider.request({method:"eth_accounts"});return Array.isArray(e)&&e.length>0}async sign(e){return await this.connect({showPrompt:!1}),this.proxyProvider.request({method:"personal_sign",params:[(0,l.NC)(e),this.wallets[0]?.address]})}subscribeListeners(){this.proxyProvider.on("accountsChanged",this.onAccountsChanged),this.proxyProvider.on("chainChanged",this.onChainChanged),this.proxyProvider.on("disconnect",this.onDisconnect),this.proxyProvider.on("connect",this.onConnect)}unsubscribeListeners(){this.proxyProvider.removeListener("accountsChanged",this.onAccountsChanged),this.proxyProvider.removeListener("chainChanged",this.onChainChanged),this.proxyProvider.removeListener("disconnect",this.onDisconnect),this.proxyProvider.removeListener("connect",this.onConnect)}constructor(e,t,r,n){super(e),this.chainType="ethereum",this.onAccountsChanged=e=>{u.c.providerEvent("accountsChanged",this.walletClientType,{accountsCount:e.length}),0===e.length?this.onDisconnect():this.syncAccounts(e)},this.onChainChanged=e=>{u.c.providerEvent("chainChanged",this.walletClientType,{chainId:e}),this.wallets.forEach(t=>{t.chainId=(0,u.n)(e),"privy"===this.walletClientType&&u.a.put((0,s.p)(t.address),e)}),this.emit("walletsUpdated")},this.onDisconnect=()=>{u.c.providerEvent("disconnect",this.walletClientType),this.connected=!1,this.wallets=[],this.emit("walletsUpdated")},this.onConnect=async()=>{u.c.providerEvent("connect",this.walletClientType),"base_account"===this.connectorType&&this.connected||(this.connected=!0,"coinbase_wallet"===this.connectorType&&await (0,u.m)(500),this.syncAccounts())},this.wallets=[],this.walletClientType=e,this.chains=t,this.defaultChain=r,this.rpcConfig=n,this.rpcTimeoutDuration=O(n,e),this.connected=!1,this.initialized=!1}}class k{on(e,t){if(this.walletProvider)return this.walletProvider.on(e,t);this._subscriptions.push({eventName:e,listener:t})}async request(e){if(!this.walletProvider)throw new c.P(`A wallet request of type ${e.method} was made before setting a wallet provider.`);return Promise.race([this.walletProvider.request(e),this.walletTimeout()]).catch(e=>{throw(0,u.f)(e)})}constructor(e,t){this.removeListener=(e,t)=>{if(this.walletProvider)try{return this.walletProvider.removeListener(e,t)}catch(e){console.warn("Unable to remove wallet provider listener")}},this.walletTimeout=(e=new u.x,t=this.rpcTimeoutDuration)=>new Promise((r,n)=>setTimeout(()=>{n(e)},t)),this.setWalletProvider=e=>
57{this.walletProvider&&this._subscriptions.forEach(e=>{this.removeListener(e.eventName,e.listener)}),this.walletProvider=e,this._subscriptions.forEach(e=>{this.walletProvider?.on(e.eventName,e.listener)})},this.walletProvider=e,this.rpcTimeoutDuration=t||s.o,this._subscriptions=[]}}class T extends C{get walletBranding(){return{id:this.id,name:this.name,icon:this.icon}}async initialize(){this.initialized=!0,this.emit("initialized")}async connect(){throw Error("connect called for an uninstalled wallet via the EthereumNullConnector")}disconnect(){throw Error("disconnect called for an uninstalled wallet via the EthereumNullConnector")}promptConnection(e){throw Error(`promptConnection called for an uninstalled wallet via the EthereumNullConnector for ${e}`)}constructor({id:e,name:t,icon:r,walletClientType:n,defaultChain:i}){super(n,[],i,{}),this.connectorType="null",this.proxyProvider=new k(void 0,s.o),this.id=e,this.name=t,this.icon=r}}let B=({...e}={})=>(0,f.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"32",height:"32",viewBox:"0 0 32 32",fill:"none",...e,children:[(0,f.jsx)("rect",{width:"32",height:"32",rx:"6",fill:"#121314"}),(0,f.jsx)("g",{transform:"translate(4, 4)",children:(0,f.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 318.6 318.6",children:[(0,f.jsx)("style",{children:".s1{stroke-linecap:round;stroke-linejoin:round}.s2{fill:#e4761b;stroke:#e4761b}.s3{fill:#f6851b;stroke:#f6851b}"}),(0,f.jsx)("path",{fill:"#e2761b",stroke:"#e2761b",className:"s1",d:"m274.1 35.5-99.5 73.9L193 65.8z"}),(0,f.jsx)("path",{d:"m44.4 35.5 98.7 74.6-17.5-44.3zm193.9 171.3-26.5 40.6 56.7 15.6 16.3-55.3zm-204.4.9L50.1 263l56.7-15.6-26.5-40.6z",className:"s1 s2"}),(0,f.jsx)("path",{d:"m103.6 138.2-15.8 23.9 56.3 2.5-2-60.5zm111.3 0-39-34.8-1.3 61.2 56.2-2.5zM106.8 247.4l33.8-16.5-29.2-22.8zm71.1-16.5 33.9 16.5-4.7-39.3z",className:"s1 s2"}),(0,f.jsx)("path",{fill:"#d7c1b3",stroke:"#d7c1b3",className:"s1",d:"m211.8 247.4-33.9-16.5 2.7 22.1-.3 9.3zm-105 0 31.5 14.9-.2-9.3 2.5-22.1z"}),(0,f.jsx)("path",{fill:"#233447",stroke:"#233447",className:"s1",d:"m138.8 193.5-28.2-8.3 19.9-9.1zm40.9 0 8.3-17.4 20 9.1z"}),(0,f.jsx)("path",{fill:"#cd6116",stroke:"#cd6116",className:"s1",d:"m106.8 247.4 4.8-40.6-31.3.9zM207 206.8l4.8 40.6 26.5-39.7zm23.8-44.7-56.2 2.5 5.2 28.9 8.3-17.4 20 9.1zm-120.2 23.1 20-9.1 8.2 17.4 5.3-28.9-56.3-2.5z"}),(0,f.jsx)("path",{fill:"#e4751f",stroke:"#e4751f",className:"s1",d:"m87.8 162.1 23.6 46-.8-22.9zm120.3 23.1-1 22.9 23.7-46zm-64-20.6-5.3 28.9 6.6 34.1 1.5-44.9zm30.5 0-2.7 18 1.2 45 6.7-34.1z"}),(0,f.jsx)("path",{d:"m179.8 193.5-6.7 34.1 4.8 3.3 29.2-22.8 1-22.9zm-69.2-8.3.8 22.9 29.2 22.8 4.8-3.3-6.6-34.1z",className:"s3"}),(0,f.jsx)("path",{fill:"#c0ad9e",stroke:"#c0ad9e",className:"s1",d:"m180.3 262.3.3-9.3-2.5-2.2h-37.7l-2.3 2.2.2 9.3-31.5-14.9 11 9 22.3 15.5h38.3l22.4-15.5 11-9z"}),(0,f.jsx)("path",{fill:"#161616",stroke:"#161616",className:"s1",d:"m177.9 230.9-4.8-3.3h-27.7l-4.8 3.3-2.5 22.1 2.3-2.2h37.7l2.5 2.2z"}),(0,f.jsx)("path",{fill:"#763d16",stroke:"#763d16",className:"s1",d:"m278.3 114.2 8.5-40.8-12.7-37.9-96.2 71.4 37 31.3 52.3 15.3 11.6-13.5-5-3.6 8-7.3-6.2-4.8 8-6.1zM31.8 73.4l8.5 40.8-5.4 4 8 6.1-6.1 4.8 8 7.3-5 3.6 11.5 13.5 52.3-15.3 37-31.3-96.2-71.4z"}),(0,f.jsx)("path",{d:"m267.2 153.5-52.3-15.3 15.9 23.9-23.7 46 31.2-.4h46.5zm-163.6-15.3-52.3 15.3-17.4 54.2h46.4l31.1.4-23.6-46zm71 26.4 3.3-57.7 15.2-41.1h-67.5l15 41.1 3.5 57.7 1.2 18.2.1 44.8h27.7l.2-44.8z",className:"s3"})]})})]}),R=["metamask","phantom","brave_wallet","rainbow","uniswap_wallet_extension","uniswap_extension","rabby_wallet","bybit_wallet","ronin_wallet","haha_wallet","crypto.com_wallet_extension","crypto.com_onchain","binance","bitget_wallet","coinbase_wallet","coinbase_smart_wallet","base_account","metamask","trust","safe","rainbow","uniswap","zerion","argent","spot","omni","cryptocom","blockchain","safepal","bitget_wallet","zengo","1inch","binance","exodus","mew_wallet","alphawallet","keyring_pro","mathwallet","unstoppable","obvious","ambire","internet_money_wallet","coin98","abc_wallet","arculus_wallet","haha","cling_wallet","broearn","copiosa","burrito_wallet","enjin_wallet","plasma_wallet","avacus","bee","pitaka","pltwallet","minerva","kryptogo","prema","slingshot","kriptonio","timeless","secux","bitizen","blocto","okx_wallet","safemoon","rabby_wallet","bybit_wallet","ronin_wallet","haha_wallet","privy","unknown","phantom","solflare","glow","backpack","jupiter","mobile_wallet_adapter"],D=Object.freeze({phantom:{client:"phantom",name:"Phantom",installLink:h.vU?"https://addons.mozilla.org/en-US/firefox/addon/phantom-app/":"https://chrome.google.com/webstore/detail/phantom/bfnaelmomeimhlpmgjnjophhpkkoljpa?hl=en",chainTypes:["ethereum","solana"],get isInstalled(){if("phantom"in window){let e=window;if(e?.phantom?.ethereum?.isPhantom&&e?.phantom?.ethereum?.chainId||e?.ph
57antom?.solana?.isPhantom)return!0}return!1},getMobileRedirect({useUniversalLink:e,isSolana:t,connectOnly:r}){let n=M({client:this.client,isSolana:t,connectOnly:r});return`${e?"phantom://":"https://phantom.app/ul/"}browse/${n}?ref=${n}`}},solflare:{client:"solflare",name:"Solflare",installLink:h.vU?"https://addons.mozilla.org/es/firefox/addon/solflare-wallet/":"https://chromewebstore.google.com/detail/solflare-wallet/bhhhlbepdkbapadjdnnojkbgioiodbic",chainTypes:["solana"],get isInstalled(){return"solflare"in window&&!!window?.solflare?.isSolflare},getMobileRedirect({useUniversalLink:e,isSolana:t,connectOnly:r}){let n=M({client:this.client,isSolana:t,connectOnly:r});return`${e?"solflare://ul/v1/":"https://solflare.com/ul/v1/"}browse/${n}?ref=${n}`}},jupiter:{client:"jupiter",name:"Jupiter Wallet",installLink:"https://chromewebstore.google.com/detail/jupiter-wallet/iledlaeogohbilgbfhmbgkgmpplbfboh",chainTypes:["solana"],get isInstalled(){return"jupiter"in window&&!!window?.jupiter?.isJupiter},getMobileRedirect({isSolana:e,connectOnly:t}){let r=M({client:this.client,isSolana:e,connectOnly:t});return`jupjupjup://jup.ag/browse/${r}?ref=${r}`}},backpack:{client:"backpack",name:"Backpack",installLink:"https://chromewebstore.google.com/detail/backpack/aflkmfhebedbjioipglgcbcmnbpgliof",chainTypes:["ethereum","solana"],get isInstalled(){return!(!("backpack"in window)||!window?.backpack?.ethereum?.isBackpack&&!window?.backpack?.solana?.isBackpack)},getMobileRedirect({useUniversalLink:e,isSolana:t,connectOnly:r}){let n=M({client:this.client,isSolana:t,connectOnly:r});return`${e?"backpack://ul/v1/":"https://backpack.app/ul/v1/"}browse/${n}?ref=${n}`}},okx_wallet:{client:"okx_wallet",name:"OKX Wallet",installLink:"https://chromewebstore.google.com/detail/okx-wallet/mcohilncbfahbmgdjkbpemcciiolgcge",chainTypes:["ethereum","solana"],get isInstalled(){return"okxwallet"in window&&!!window?.okxwallet?.isOkxWallet},getMobileRedirect({isSolana:e,connectOnly:t}){return`okx://wallet/dapp/url?dappUrl=${M({client:this.client,isSolana:e,connectOnly:t})}`}}});function U({connectorType:e,walletClientType:t}){for(let r of R)if(e===r||t===r)return D[r]}function M({client:e,isSolana:t,connectOnly:r}){let n=new URL(window.location.href);return n.searchParams.set("privy_connector",t?"solana_adapter":"injected"),n.searchParams.set("privy_wallet_client",e),n.searchParams.set("privy_connect_only",String(r)),encodeURIComponent(n.href.replace(/\/$/g,""))}class N extends u.S{get walletBranding(){return{id:this.id,name:this.name,icon:this.icon}}async initialize(){this.initialized=!0,this.emit("initialized")}async connect(){throw Error("connect called for an uninstalled wallet via the SolanaNullConnector")}constructor({id:e,name:t,icon:r}){super({name:t},!1),this.connectorType="null",this.proxyProvider=new k(void 0,s.o),this.disconnect=async()=>{throw Error("disconnect called for an uninstalled wallet via the SolanaNullConnector")},this.promptConnection=async()=>{throw Error("promptConnection called for an uninstalled wallet via the SolanaNullConnector")},this.id=e,this.name=t,this.icon=r}}function j(e){return"solana"===e.chainType}function L(e){return"solana"===e.type}let $=e=>{let[t,r]=(0,n.useState)("auto");return(0,n.useEffect)(()=>{let t=new ResizeObserver(e=>{r(e[0]?.contentRect.height??"auto")});return e.current&&t.observe(e.current),()=>{e.current&&t.unobserve(e.current)}},[e.current]),t},z=d.zo.div` 58 text-align: left; 59 flex-grow: 1; 60`,F=d.zo.div` 61 display: flex; 62 flex-direction: column; 63 justify-content: flex-end; 64 flex-grow: 1; 65`,q=d.zo.div` 66 display: flex; 67 flex-direction: column; 68 gap: 8px; 69 70 /* for Internet Explorer, Edge */ 71 -ms-overflow-style: none; 72 73 /* for Firefox */ 74 scrollbar-width: none; 75 76 /* for Chrome, Safari, and Opera */ 77 &::-webkit-scrollbar {
78 display: none; 79 } 80`,W=(0,d.zo)(q)` 81 ${e=>"light"===e.$colorScheme?"background: linear-gradient(var(--privy-color-background), var(--privy-color-background) 70%) bottom, linear-gradient(rgba(0, 0, 0, 0) 20%, rgba(0, 0, 0, 0.06)) bottom;":"dark"===e.$colorScheme?"background: linear-gradient(var(--privy-color-background), var(--privy-color-background) 70%) bottom, linear-gradient(rgba(255, 255, 255, 0) 20%, rgba(255, 255, 255, 0.06)) bottom;":void 0} 82 83 background-repeat: no-repeat; 84 background-size: 85 100% 32px, 86 100% 16px; 87 background-attachment: local, scroll; 88 max-height: 400px; 89 overflow-y: auto; 90 scrollbar-width: none; 91 padding: 3px; 92`,V=(0,d.iv)` 93 && { 94 width: 100%; 95 font-size: 16px; 96 line-height: 24px; 97 min-height: 56px; 98 99 /* Tablet and Up */ 100 @media (min-width: 440px) { 101 font-size: 14px; 102 } 103 104 display: flex; 105 gap: 12px; 106 align-items: center; 107 color: var(--privy-color-foreground); 108 109 padding: 10px 12px; 110 border: 1px solid var(--privy-color-foreground-4) !important; 111 border-radius: var(--privy-border-radius-md); 112 transition: background-color 200ms ease; 113 114 cursor: pointer; 115 116 &:hover { 117 background-color: var(--privy-color-background-2); 118 } 119 120 &:disabled { 121 cursor: pointer; 122 background-color: var(--privy-color-background-2); 123 } 124 } 125`,H=d.zo.div` 126 text-align: center; 127 font-size: 14px; 128 margin-bottom: 24px; 129`,G=d.zo.button.attrs({className:"login-method-button"})` 130 ${V} 131`;d.zo.a` 132 ${V} 133`;let K=d.zo.div` 134 width: 32px; 135 height: 32px; 136 border-radius: ${e=>e.$fullSize?"0":"4px"}; 137 background: ${e=>e.$fullSize?"transparent":"var(--privy-color-background-2)"}; 138 display: flex; 139 align-items: center; 140 justify-content: center; 141 flex-shrink: 0; 142 143 svg { 144 width: ${e=>e.$fullSize?"32px":"18px"}; 145 height: ${e=>e.$fullSize?"32px":"18px"}; 146 color: ${e=>e.$fullSize?"inherit":"var(--privy-color-icon-muted)"}; 147 } 148`,Z=d.zo.div` 149 width: 100%; 150 height: 100%; 151 min-height: inherit; 152 display: flex; 153 flex-direction: column; 154 ${e=>e.$if?"display: none;":""} 155`,J=d.zo.div` 156 width: 100%; 157 height: 100%; 158 padding: ${e=>e.$withPadding?"64px 0px":"0px"}; 159`,Y=d.zo.div` 160 display: flex; 161 flex-direction: column; 162 align-items: center; 163 justify-content: center; 164 margin-bottom: 32px; 165 gap: 12px; 166 & h3 { 167 font-size: 18px; 168 font-style: normal; 169 font-weight: 600; 170 line-height: 24px; 171 } 172 & p { 173 max-width: 300px; 174 font-size: 14px; 175 font-style: normal; 176 font-weight: 400; 177 line-height: 20px; 178 } 179`,X=({success:e,fail:t})=>(0,f.jsxs)(ee,{children:[(0,f.jsx)(Q,{children:(0,f.jsx)(er,{className:e?"success":t?"fail":""})}),(0,f.jsx)(Q,{children:(0,f.jsx)(et,{className:e?"success":t?"fail":""})})]}),Q=d.zo.span` 180 && { 181 position: absolute; 182 top: 0; 183 left: 0; 184 z-index: 2; 185 } 186`,ee=d.zo.span` 187 position: relative; 188 width: 82px; 189 height: 82px; 190 display: inline-block; 191`,et=d.zo.span` 192 && { 193 width: 82px; 194 height: 82px; 195 border-width: 4px; 196 border-style: solid; 197 border-color: ${e=>e.color??"var(--privy-color-icon-subtle)"}; 198 border-bottom-color: transparent; 199 border-radius: 50%; 200 display: inline-block; 201 box-sizing: border-box; 202 animation: rotation 1.2s linear infinite; 203 transition: border-color 800ms; 204 } 205 206 @keyframes rotation { 207 0% { 208 transform: rotate(0deg); 209 } 210 100% { 211 transform: rotate(360deg); 212 } 213 } 214 215 &&&.success { 216 border-color: var(--privy-color-icon-success); 217 border-bottom-color: var(--privy-color-icon-success); 218 } 219 220 &&&.fail { 221 border-color: var(--privy-color-icon-error); 222 border-bottom-color: var(--privy-color-icon-error); 223 } 224`,er=(0,d.zo)(et)` 225 && { 226 border-bottom-color: ${e=>e.color??"var(--privy-color-border-default)"}; 227 border-color: ${e=>e.color??"var(--privy-color-border-default)"}; 228 animation: none; 229 opacity: 0.5; 230 } 231`,en=e=>(0,f.jsx)(ei,{color:e.color||"var(--privy-color-foreground-3)"}),ei=(0,d.zo)(et)` 232 && { 233 height: 1rem; 234 width: 1rem; 235 margin: 2px 0; 236 border-width: 1.5px; 237 238 /* Override default Loader to match button transitions */ 239 transition: border-color 200ms ease; 240 } 241`,es=(0,n.createContext)({}),eo=({children:e})=>
241{let t=(0,s.u)(),[r,i]=(0,n.useState)({});return(0,p.u)("login",{onComplete:({loginAccount:e})=>{e&&"passkey"!==e.type&&"cross_app"!==e.type&&("wallet"!==e.type||"privy"!==e.walletClientType)&&(u.a.put(ea(t.id),e.type),"wallet"===e.type?(u.a.put(el(t.id),e.walletClientType),u.a.put(ec(t.id),e.chainType),i({accountType:e.type,walletClientType:e.walletClientType,chainType:e.chainType})):(u.a.del(el(t.id)),u.a.del(ec(t.id)),i({accountType:e.type})))}}),(0,n.useEffect)(()=>{if(!t.id)return;let e=u.a.get(ea(t.id)),r=u.a.get(el(t.id)),n=u.a.get(ec(t.id));e&&i("wallet"===e?{accountType:e,walletClientType:r,chainType:n}:{accountType:e})},[t.id]),(0,f.jsx)(es.Provider,{value:r,children:e})},ea=e=>`privy:${e}:recent-login-method`,el=e=>`privy:${e}:recent-login-wallet-client`,ec=e=>`privy:${e}:recent-login-chain-type`,eu=()=>(0,n.useContext)(es),ef=e=>{(0,p.u)("fundWallet",e);let{fundWallet:t}=(0,c.u)();return{fundWallet:({address:e,options:r})=>t(e,r)}};function eh(e){let{login:t}=(0,n.useContext)(g.P);return(0,p.u)("login",e),{login:t}}function ed(e){let{logout:t}=(0,n.useContext)(g.P);return(0,p.u)("logout",e),{logout:t}}let ep=(0,i.U)(()=>({isModalOpen:!1,resolvers:null})),eg=(0,i.U)(()=>({})),ey=async()=>{let e,t,r=new Promise((r,n)=>{e=r,t=n});return eg.setState({}),ep.setState({isModalOpen:!0,resolvers:{resolve:e,reject:t}}),await r},em=({address:e,client:t,appId:r})=>{let n=`${t}:${e}`;r&&u.a.put(eb(r),n),ep.setState({wallet:n})},eb=e=>`privy:${e}:active-wallet-connection`,ew=()=>{let e=(0,s.u)(),{wallets:t}=(0,y.u)(),{connectors:r}=(0,c.u)(),i=(0,n.useMemo)(()=>r.filter(j).flatMap(e=>e.wallets),[r]),o=ep(e=>e.wallet);(0,n.useEffect)(()=>{if(!e.id)return;let t=u.a.get(eb(e.id));ep.setState({wallet:t})},[e.id]);let a=(0,n.useMemo)(()=>{if(!o)return;let[,e]=o.split(":");return t.find(t=>t.address===e)||i.find(t=>t.address===e)},[o,t,i]),l=(0,n.useMemo)(()=>a?"ethereum"===a.type?a.chainId:"solana":void 0,[a]);return{connect:async r=>{r?.reset&&(u.a.del(eb(e.id)),ep.setState({wallet:void 0}));let{wallet:n}=await ey();if(!n)return{};let[,s]=n.split(":"),o=t.find(e=>e.address===s);if(o)return{wallet:o,network:o.chainId};let a=i.find(e=>e.address===s);return a?{wallet:a,network:"solana"}:{}},setActiveWallet:(0,n.useCallback)(t=>{em({address:t.address,client:t.walletClientType,appId:e.id})},[e.id]),wallet:a,network:l}}},20545:function(e,t,r){"use strict";r.d(t,{S:function(){return N},a:function(){return b},b:function(){return m},c:function(){return O},d:function(){return v},e:function(){return P},f:function(){return C},g:function(){return T},h:function(){return k},i:function(){return L},j:function(){return U},k:function(){return M},l:function(){return j},m:function(){return q},n:function(){return ee},o:function(){return I},p:function(){return B},r:function(){return x},s:function(){return E},u:function(){return en},y:function(){return G}});var n=r(63858),i=r(97422),s=r(2265),o=r(71787),a=r(3266),l=r(7756),c=r(26558),u=r(23406),f=r(18482),h=r(62851),d=r(24257),p=r(22931),g=r(8764);function y(e){return{name:e.metadata?.shortName||e.name||"",universalLink:e.mobile.universal,deepLink:e.mobile.native}}function m(e,t){let r=y(t);if(n.tq&&n.Dt&&r.universalLink)return S(r.universalLink,e);if(r.deepLink)return A(r.deepLink,e);if(r.universalLink)return S(r.universalLink,e);throw new i.b(`Unsupported wallet ${t.id}`)}function b(e,t){let r=y(t);if(r.universalLink)return S(r.universalLink,e)}let w="WALLETCONNECT_DEEPLINK_CHOICE";function v(){try{localStorage.removeItem(w)}catch{}}function E({href:e,name:t}){try{localStorage.setItem(w,JSON.stringify({href:e,name:t}))}catch{}}function x(){try{localStorage.removeItem(w)}catch{}}function _(e){return e.startsWith("http://")||e.startsWith("https://")}function A(e,t){if(_(e))return S(e,t);let r=e;return r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`),{redirect:`${r}wc?uri=${encodeURIComponent(t)}`,href:r}}function S(e,t){if(!_(e))return A(e,t);let r=e;return r.endsWith("/")||(r=`${r}/`),{redirect:`${r}wc?uri=${encodeURIComponent(t)}`,href:r}}function I(e,t){window.open(e,t,"noreferrer noopener")}function O(e){return crypto.getRandomValues(new Uint8Array(e))}function P(){return f.c(O(36))}function C(){return P()}async function k(e,t="S256"){if("S256"!=t)return e;{let t=await async function(e){let t=(new TextEncoder).encode(e);return new Uint8Array(await crypto.subtle.digest("SHA-256",t))}(e);return f.c(t)}}function T(){let e=o.a.get(c.C);if(!e)throw new i.b("Authentication error.");return e}let B=({address:e,nonce:t})=>`${window.location.host} wants you to sign in with your Solana account: 242${e} 243 244You are proving you own ${e}. 245 246URI: ${window.location.origin} 247Version: 1 248Chain ID: mainnet 249Nonce: ${t} 250Issued At: ${(new Date).toISOString()} 251Resources: 252- https://privy.io`;
252class R{async authenticate(){if(!this.api)throw new i.b("Auth flow has no API instance");try{return await this.api.post(u.o,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:this.meta.codeVerifier,provider:this.meta.provider,mode:this.meta.disableSignup?"no-signup":"login-or-sign-up"})}catch(e){throw(0,i.f)(e)}}async link(){if(!this.api)throw new i.b("Auth flow has no API instance");try{return await this.api.post(u.h,{authorization_code:this.meta.authorizationCode,state_code:this.meta.stateCode,code_verifier:this.meta.codeVerifier,provider:this.meta.provider})}catch(e){throw(0,i.f)(e)}}constructor(e){this.meta=e}}async function D({api:e,requesterAppId:t,providerAppId:r}){let n=(await e.get(`/api/v1/apps/${t}/cross-app/connections`)).connections.find(e=>e.provider_app_id===r);if(!n)throw new i.b("Invalid connected app");return{name:n.provider_app_name,logoUrl:n.provider_app_icon_url||void 0,apiUrl:n.provider_app_custom_api_url,readOnly:n.read_only,customAuthAuthorizeUrl:n.provider_app_custom_auth_authorize_url,customAuthTransactUrl:n.provider_app_custom_auth_transact_url}}async function U({api:e,appId:t}){let r=P(),n=C(),s=await k(r);try{let{url:i}=await e.post(u.i,{provider:`privy:${t}`,redirect_to:window.location.href,code_challenge:s,state_code:n});return{url:i,stateCode:n,codeVerifier:r}}catch(e){throw(0,i.f)(e)}}async function M({appId:e,stateCode:t,codeVerifier:r,authorizationCode:n,action:s,client:o,disableSignup:a}){if(!n||!t)throw new i.b("[Cross-App AuthFlow] Authorization and state codes code must be set prior to calling authenicate.");if("undefined"===n)throw new i.b("User denied confirmation during cross-app auth flow");try{let i=new R({authorizationCode:n,stateCode:t,codeVerifier:r,provider:`privy:${e}`,disableSignup:!!a});o.startAuthFlow(i);let l="link"===s?await o.link():await o.authenticate(),c=l.oAuthTokens?.accessToken;return console.debug(),c}catch(t){let e=(0,i.f)(t);if(e.privyErrorCode===i.c.ACCOUNT_TRANSFER_REQUIRED)throw e;if(e.privyErrorCode)throw new i.b(e.message||"Invalid code during cross-app auth flow.",void 0,e.privyErrorCode);if("User denied confirmation during cross-app auth flow"===e.message)throw new i.b("Invalid code during cross-app auth flow.",void 0,i.c.OAUTH_USER_DENIED);throw new i.b("Invalid code during cross-app auth flow.",void 0,i.c.UNKNOWN_AUTH_ERROR)}}let N=Symbol("solana-funding-plugin"),j=Symbol("solana-ledger-plugin"),L=async({user:e,accessToken:t,proxy:r,refreshSessionAndUser:n,privy:i,appConfig:s,recoverEmbeddedWallet:l,setUser:c,walletIndex:u,chainType:f,recoveryMethod:h,recoveryPassword:d,recoveryAccessToken:y,idempotencyKey:m,additionalSigners:b})=>{if(0===u){if("user-controlled-server-wallets-only"===s.embeddedWallets.mode)await (0,g.U)(i,{request:{chain_type:f,additional_signers:b?(0,o.q)(b):void 0},headers:m?{"privy-idempotency-key":m}:void 0});else if("ethereum"===f){let n=(0,a.f)(e);n&&await l({address:n.address}),await r.create({accessToken:t,solanaAddress:n?.address,recoveryMethod:h,recoveryPassword:d,recoveryAccessToken:y})}else{if("solana"!==f)throw Error("Invalid input to create wallet");{let n=(0,a.d)(e);n&&await l({address:n.address}),await r.createSolana({accessToken:t,ethereumAddress:n?.address,recoveryMethod:h,recoveryPassword:d,recoveryAccessToken:y})}}}else if("user-controlled-server-wallets-only"===s.embeddedWallets.mode)await (0,g.U)(i,{request:{chain_type:f,additional_signers:b?(0,o.q)(b):void 0}});else{let{entropyId:n,entropyIdVerifier:i}=(0,p.b)(e);await l(),await r.addWallet({accessToken:t,entropyId:n,entropyIdVerifier:i,chainType:f,hdWalletIndex:u})}let w=await n(),v=(0,p.e)(w,{chainType:f,walletIndex:u})[0];return c(w),{user:w,account:v}},$=async({user:e,address:t,client:r,request:n,requesterAppId:s,reconnect:o})=>{r.createAnalyticsEvent({eventName:"cross_app_request_started",payload:{address:t,method:n.method}});let a=e?.linkedAccounts.find(e=>"cross_app"===e.type&&(e.embeddedWallets.some(e=>e.address===t)||e.smartWallets.some(e=>e.address===t)));if(!e||!a)throw r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Cannot request a signature with this wallet address",address:t}}),new i.b("Cannot request a signature with this wallet address");let c=r.getProviderAccessToken(a.providerApp.id),u=await D({api:r.api,requesterAppId:s,providerAppId:a.providerApp.id});if(!c){if(u.readOnly)throw console.error("cannot transact against a read-only provider app"),new i.b("Cannot transact against a read-only provider app");await o({appId:a.providerApp.id,action:"link"})&&(c=r.getProviderAccessToken(a.providerApp.id))}if(!c)throw r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Transactions require a valid token",address:t}}),new i.b("Transactions require a valid token");
252let f=new URL(u.customAuthTransactUrl||`${u.apiUrl}/oauth/transact`);f.searchParams.set("token",c||""),f.searchParams.set("request",z(n));let h=(0,l.X)({location:f.href});if(!h)throw r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Missing token",address:t}}),new i.b("Failed to initialize signature request");return new Promise((e,s)=>{let o=setTimeout(()=>{u(),s(new i.b("Request timeout")),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"Request timeout",address:t}})},12e4),l=setInterval(()=>{h.closed&&(u(),s(new i.b("User rejected request")),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:"User rejected request",address:t}}))},300),c=i=>{i.data&&("set"===i.data.token?.action&&void 0!==i.data.token?.value?r.storeProviderAccessToken(a.providerApp.id,i.data.token.value):"clear"===i.data.token?.action&&r.storeProviderAccessToken(a.providerApp.id,null),"PRIVY_CROSS_APP_ACTION_RESPONSE"===i.data.type&&i.data.result&&(u(),e(i.data.result),r.createAnalyticsEvent({eventName:"cross_app_request_success",payload:{address:t,method:n.method}})),"PRIVY_CROSS_APP_ACTION_ERROR"===i.data.type&&i.data.error&&(u(),s(i.data.error),r.createAnalyticsEvent({eventName:"cross_app_request_error",payload:{error:i.data.error,address:t}})))};window.addEventListener("message",c);let u=()=>{h.close(),clearInterval(l),clearTimeout(o),window.removeEventListener("message",c)}})},z=e=>JSON.stringify({content:{request:{request:F(e,h.NC)}},timestamp:Date.now(),callbackUrl:window.origin}),F=(e,t)=>"bigint"==typeof e?t(e):Array.isArray(e)?e.map(e=>F(e,t)):e&&"object"==typeof e?Object.fromEntries(Object.entries(e).map(([e,r])=>[e,F(r,t)])):e,q=()=>{let{user:e,getAccessToken:t}=(0,a.u)(),{client:r,setUser:n,openModal:u,inProgressAuthFlowRef:f,inProgressLoginOrLinkMethodRef:h}=(0,i.u)(),p=(0,c.u)(),g=(0,d.a)(),{setModalData:y}=(0,a.a)(),m=(0,s.useCallback)(t=>e?.linkedAccounts.some(e=>"cross_app"===e.type&&e.smartWallets.some(e=>e.address===t))??!1,[e]),b=(0,s.useCallback)(async({appId:e,action:n,disableSignup:s})=>{let o=await t();if("link"===n&&!o)throw g("linkAccount","onError",i.c.MUST_BE_AUTHENTICATED,{linkMethod:`privy:${e}`}),new i.b("User must be authenticated before linking an account.");if("login"===n&&o)throw g("login","onError",i.c.UNKNOWN_AUTH_ERROR),new i.b("Attempted to log in, but user is already logged in. Use a `link` helper instead.");h.current=`privy:${e}`,f.current=n;let a=(0,l.X)();return r.createAnalyticsEvent({eventName:"cross_app_auth_started",payload:{providerAppId:e}}),new Promise(async(t,i)=>{let{name:o,logoUrl:l}=await D({api:r.api,providerAppId:e,requesterAppId:p.id});y({crossAppAuth:{appId:e,name:o,logoUrl:l,action:n,popup:a,disableSignup:s,onSuccess:t,onError:i}}),u("CrossAppAuthScreen")})},[t,g,h,f,r,p.id,y,u]),w=(0,s.useCallback)(async({subject:t})=>{let s=e?.linkedAccounts.find(e=>"cross_app"===e.type&&e.subject===t)?.providerApp;if(!s)throw new i.b("Invalid subject");r.storeProviderAccessToken(s.id,null);let o=await r.unlinkOAuth(`privy:${s.id}`,t);return n(o),o},[e,r,n]),v=(0,s.useCallback)((t,{address:n,chainId:i})=>$({user:e,client:r,address:n,requesterAppId:p.id,request:{method:m(n)?"privy_signSmartWalletMessage":"personal_sign",params:[t,n],chainId:i},reconnect:b}),[e,r,p.id,m,b]),E=(0,s.useCallback)((t,{address:n,chainId:i})=>{let s=(0,o.j)(t);return $({user:e,client:r,address:n,requesterAppId:p.id,request:{method:m(n)?"privy_signSmartWalletTypedData":"eth_signTypedData_v4",params:[n,s],chainId:i},reconnect:b})},[e,r,p.id,m,b]),x=(0,s.useCallback)((t,{address:n})=>$({user:e,client:r,address:n,requesterAppId:p.id,request:{method:m(n)?"privy_sendSmartWalletTx":"eth_sendTransaction",params:[t],chainId:t.chainId},reconnect:b}),[e,r,p.id,m,b]),_=(0,s.useCallback)((t,{address:n})=>$({user:e,client:r,address:n,requesterAppId:p.id,request:{method:m(n)?"privy_signSmartWalletTx":"eth_signTransaction",params:[t],chainId:t.chainId},reconnect:b}),[e,r,p.id,m,b]);return(0,s.useMemo)(()=>({startCrossAppAuthFlow:b,unlinkCrossAppAccount:w,signMessageWithCrossAppWallet:v,signTypedDataWithCrossAppWallet:E,sendTransactionWithCrossAppWallet:x,signTransactionWithCrossAppWallet:_}),[b,w,v,E,x,_])},W=()=>{let{client:e,setUser:t}=(0,i.u)();return{unlink:(0,s.useCallback)(async({address:r})=>{let n=await e.unlinkEmail(r);return t(n),n},[e,t])}},V=()=>{let{client:e,setUser:t}=(0,i.u)();return{unlink:(0,s.useCallback)(async({fid:r})=>{let n=await e.unlinkFarcaster(r);return t(n),n},[e,t])}},H=()=>{let{client:e,setUser:t}=(0,i.u)();return{unlink:(0,s.useCallback)(async({provider:r,subject:n})=>{let i=await e.unlinkOAuth(r,n);return t(i),i},[e,t])}},G=()=>{let{client:e,setUser:t,walletProxy:r}=(0,i.u)(),{getAccessToken:n}=(0,a.u)(),o=(0,c.u)(),l=o?.passkeys?.shouldUnenrollMfaOnUnlink??!1;return{unlink:(0,s.useCallback)(async({credentialId:i})=>{let s=await n();
252if(!s)throw Error("Must have valid access token to enroll in MFA");if(!r)throw Error("Wallet proxy not initialized.");await r.unlinkPasskeyAccount({credentialId:i,accessToken:s,removeAsMfa:l});let o=await e.getAuthenticatedUser();return t(o),o},[l,e,n,t,r])}},K=()=>{let{client:e,setUser:t}=(0,i.u)();return{unlink:(0,s.useCallback)(async({phoneNumber:r})=>{let n=await e.unlinkPhone(r);return t(n),n},[e,t])}},Z=()=>{let{client:e,setUser:t}=(0,i.u)();return{unlink:(0,s.useCallback)(async({telegramUserId:r})=>{let n=await e.unlinkTelegram(r);return t(n),n},[e,t])}},J=e=>e.reduce((e,t)=>!e||e.walletIndex<t.walletIndex?t:e,null),Y=async({appConfig:e,getAccessToken:t,initializeWalletProxy:r,user:n,privy:s,emitPrivyEvent:o,recoverEmbeddedWallet:a,setModalData:l,openModal:c,setUser:u,options:f,timeoutDuration:h,refreshSessionAndUser:d,chainType:g,idempotencyKey:y,additionalSigners:m})=>{let[b,w]=await Promise.all([r(h),t()]);if(!w||!n)throw o("createWallet","onError",i.c.MUST_BE_AUTHENTICATED),Error("User must be authenticated before creating a Privy wallet");if(!b&&e.customAuth?.enabled)throw o("createWallet","onError",i.c.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to connect to wallet proxy");if(m&&"user-controlled-server-wallets-only"!==e.embeddedWallets.mode)throw new i.b("Specifying additionalSigners is only supported for TEE execution and this app uses on-device execution. Learn more https://docs.privy.io/recipes/tee-wallet-migration-guide");if(f&&"walletIndex"in f&&"number"==typeof f.walletIndex){if("user-controlled-server-wallets-only"===e.embeddedWallets.mode)throw o("createWallet","onError",i.c.INVALID_DATA),Error("Invalid input, use `createAdditional` instead of `walletIndex` to create additional wallets.");return X({accessToken:w,appConfig:e,privy:s,emitPrivyEvent:o,openModal:c,proxy:b,refreshSessionAndUser:d,recoverEmbeddedWallet:a,setModalData:l,user:n,walletIndex:f.walletIndex,chainType:g,setUser:u,additionalSigners:m})}let v=f&&"createAdditional"in f&&f.createAdditional,E=(0,p.e)(n,{chainType:g});if(E[0]&&!v)throw o("createWallet","onError",i.c.EMBEDDED_WALLET_ALREADY_EXISTS),Error("User already has an embedded wallet.");return X({accessToken:w,appConfig:e,privy:s,emitPrivyEvent:o,openModal:c,proxy:b,recoverEmbeddedWallet:a,setModalData:l,user:n,walletIndex:(J(E)?.walletIndex??-1)+1,chainType:g,refreshSessionAndUser:d,setUser:u,idempotencyKey:y,additionalSigners:m})},X=async({accessToken:e,appConfig:t,privy:r,emitPrivyEvent:n,proxy:s,refreshSessionAndUser:o,recoverEmbeddedWallet:l,user:c,walletIndex:u,setModalData:f,openModal:h,chainType:d,setUser:g,idempotencyKey:y,additionalSigners:m})=>{if(u<0)throw n("createWallet","onError",i.c.EMBEDDED_WALLET_CREATE_ERROR),Error(`A negative walletIndex (${u}
252) is invalid.`);let b=(0,a.g)(c);if(u>0&&!b)throw n("createWallet","onError",i.c.EMBEDDED_WALLET_NOT_FOUND),Error("Must have an existing embedded wallet to create an additional wallet.");if(t.embeddedWallets.requireUserOwnedRecoveryOnCreate&&"user-controlled-server-wallets-only"===t.embeddedWallets.mode)throw n("createWallet","onError",i.c.EMBEDDED_WALLET_CREATE_ERROR),Error("User owned recovery not yet supported for this app.");if(!b&&t.embeddedWallets.requireUserOwnedRecoveryOnCreate)return await Q({emitPrivyEvent:n,setModalData:f,openModal:h,chainType:d});let w=(0,p.e)(c,{chainType:d,walletIndex:u})[0];if(w)return{user:c,account:w};if(0===u&&!s)return Q({emitPrivyEvent:n,setModalData:f,openModal:h,chainType:d});if(!s)throw n("createWallet","onError",i.c.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to connect to wallet proxy");return L({appConfig:t,walletIndex:u,chainType:d,user:c,accessToken:e,proxy:s,refreshSessionAndUser:o,privy:r,recoverEmbeddedWallet:l,setUser:g,idempotencyKey:y,additionalSigners:m})},Q=async({emitPrivyEvent:e,setModalData:t,openModal:r,chainType:n})=>new Promise((s,o)=>{t({createWallet:{onSuccess:({user:t,account:r})=>{e("createWallet","onSuccess",{wallet:r}),s({user:t,account:r})},onFailure:t=>{e("createWallet","onError",i.c.UNKNOWN_EMBEDDED_WALLET_ERROR),o(t)},callAuthOnSuccessOnClose:!1,shouldCreateEth:"ethereum"===n,shouldCreateSol:"solana"===n}}),r("EmbeddedWalletOnAccountCreateScreen")}),ee=()=>{let e=(0,c.u)(),t=(0,d.a)(),{setModalData:r}=(0,a.a)(),{initializeWalletProxy:n,recoverEmbeddedWallet:s,setUser:o,openModal:l,refreshSessionAndUser:u,privy:f,client:h}=(0,i.u)();return{create:async({chainType:a,options:d,latestUser:p,idempotencyKey:g})=>{let y=p;if(y||(y=await u()),!y)throw t("createWallet","onError",i.c.MUST_BE_AUTHENTICATED),Error("User must be authenticated before creating a Privy wallet");return await Y({appConfig:e,privy:f,getAccessToken:()=>h.getAccessToken(),refreshSessionAndUser:u,initializeWalletProxy:n,user:y,emitPrivyEvent:t,recoverEmbeddedWallet:s,setModalData:r,openModal:l,setUser:o,options:d,timeoutDuration:c.W,chainType:a,idempotencyKey:g,additionalSigners:d?.signers})}}},et=async({emitPrivyEvent:e,getAccessToken:t,initializeWalletProxy:r,refreshSessionAndUser:n,user:s,appConfig:o},{privateKey:l,chainType:c,additionalSigners:u})=>{if(!s)throw e("linkAccount","onError",i.c.MUST_BE_AUTHENTICATED,{linkMethod:"siwe"}),new i.b("User must be authenticated before linking an account.");let f="user-controlled-server-wallets-only"===o.embeddedWallets.mode?"tee":"on-device";if(u&&"on-device"===f)throw new i.b("Specifying additionalSigners is only supported for TEE execution and this app uses on-device execution. Learn more https://docs.privy.io/recipes/tee-wallet-migration-guide");let[h,d]=await Promise.all([t(),r(15e3)]);if(!d||!h)throw e("linkAccount","onError",i.c.MUST_BE_AUTHENTICATED,{linkMethod:"siwe"}),new i.b("User must be authenticated before linking an account.");let{address:p}=await d.importWallet({privateKey:l,accessToken:h,chainType:c,mode:f,additionalSigners:u}),g=await n(),y="solana"===c?(0,a.h)(g):(0,a.e)(g),m=y?.find(e=>e.address===p);if(!m)throw e("createWallet","onError",i.c.UNKNOWN_EMBEDDED_WALLET_ERROR),Error("Failed to import wallet");return e("createWallet","onSuccess",{wallet:m}),m},er=()=>{let{user:e}=(0,a.u)(),{client:t,refreshSessionAndUser:r,initializeWalletProxy:n}=(0,i.u)(),o=(0,d.a)(),l=(0,c.u)();return{importWallet:(0,s.useCallback)(({privateKey:i,additionalSigners:s})=>et({getAccessToken:()=>t.getAccessToken(),user:e,initializeWalletProxy:n,refreshSessionAndUser:r,emitPrivyEvent:o,appConfig:l},{privateKey:i,chainType:"ethereum",additionalSigners:s}),[e,t,r,n,o,l])}},en=()=>{let{importWallet:e}=er(),{exportWallet:t}=(0,o.u)(),{createWallet:r}=function(e){let{create:t}=ee();return(0,d.u)("createWallet",void 0),{createWallet:async e=>{e&&"target"in e&&e&&(e=void 0);let{account:r}=await t({chainType:"ethereum",options:e});return r}}}(),{unlinkCrossAppAccount:n}=q(),{unlink:i}=(0,o.v)(),{unlink:l}=W(),{unlink:c}=K(),{unlink:u}=V(),{unlink:f}=Z(),{unlink:h}=G(),{unlink:p}=H(),g=(0,s.useCallback)(e=>i({address:e}),[i]),y=(0,s.useCallback)(e=>l({address:e}),[l]),m=(0,s.useCallback)(e=>c({phoneNumber:e}),[c]),b=(0,s.useCallback)(e=>u({fid:e}),[u]),w=(0,s.useCallback)(e=>f({telegramUserId:e}),[f]),v=(0,s.useCallback)(e=>h({credentialId:e}
252),[h]),E=(0,s.useCallback)(e=>p(e),[p]),x=(0,s.useCallback)(e=>p({provider:"google",subject:e}),[p]),_=(0,s.useCallback)(e=>p({provider:"twitter",subject:e}),[p]),A=(0,s.useCallback)(e=>p({provider:"twitch",subject:e}),[p]),S=(0,s.useCallback)(e=>p({provider:"discord",subject:e}),[p]),I=(0,s.useCallback)(e=>p({provider:"github",subject:e}),[p]),O=(0,s.useCallback)(e=>p({provider:"spotify",subject:e}),[p]),P=(0,s.useCallback)(e=>p({provider:"instagram",subject:e}),[p]),C=(0,s.useCallback)(e=>p({provider:"tiktok",subject:e}),[p]),k=(0,s.useCallback)(e=>p({provider:"line",subject:e}),[p]),T=(0,s.useCallback)(e=>p({provider:"linkedin",subject:e}),[p]),B=(0,s.useCallback)(e=>p({provider:"apple",subject:e}),[p]);return{...(0,s.useContext)(a.P),importWallet:e,createWallet:r,exportWallet:t,unlinkCrossAppAccount:n,unlinkWallet:g,unlinkEmail:y,unlinkPhone:m,unlinkGoogle:x,unlinkTwitter:_,unlinkTwitch:A,unlinkDiscord:S,unlinkGithub:I,unlinkSpotify:O,unlinkInstagram:P,unlinkTiktok:C,unlinkLine:k,unlinkLinkedIn:T,unlinkApple:B,unlinkFarcaster:b,unlinkTelegram:w,unlinkPasskey:v,unlinkOAuth:E}}},50040:function(e,t,r){"use strict";r.d(t,{a:function(){return f},b:function(){return p},f:function(){return h},g:function(){return y},s:function(){return d},u:function(){return m},w:function(){return g}});var n=r(72788),i=r(65891),s=r(2265),o=r(26558),a=r(97629),l=r(97422),c=r(9109).Buffer;let u=Symbol("default-solana-rpcs-plugin");function f(e){return new Uint8Array((0,n.x7)().decode(e).messageBytes)}async function h({solanaClient:e,tx:t}){let r=(0,i.TJ)().decode(f(t)),{value:n}=await e.rpc.getFeeForMessage(r).send();return n??0n}async function d({solanaClient:e,tx:t,replaceRecentBlockhash:r}){let{value:n}=await e.rpc.simulateTransaction((0,i.TJ)().decode(t),{commitment:"confirmed",encoding:"base64",sigVerify:!1,replaceRecentBlockhash:r}).send();if("BlockhashNotFound"===n.err&&r)throw Error("Simulation failed: Blockhash not found");return"BlockhashNotFound"===n.err?await d({solanaClient:e,tx:t,replaceRecentBlockhash:!0}):{logs:n.logs??[],error:n.err,hasError:!!n.err,hasFunds:n.logs?.every(e=>!/insufficient funds/gi.test(e)&&!/insufficient lamports/gi.test(e))??!0}}let p=(...e)=>{if(void 0===c)throw new l.b("Buffer is not defined.",void 0,l.c.BUFFER_NOT_DEFINED);return c.from(...e)};async function g({rpcSubscriptions:e,signature:t,timeout:r}){let n=new AbortController,i=await e.signatureNotifications(t,{commitment:"confirmed"}).subscribe({abortSignal:n.signal}),s=await Promise.race([new Promise(e=>{setTimeout(()=>{n.abort(),e(Error("Transaction confirmation timed out"))},r)}),new Promise(async e=>{for await(let t of i){if(n.abort(),t.value.err)return e(Error("Transaction confirmation failed"));e(void 0)}})]);if(s instanceof Error)throw s}function y({rpc:e,rpcSubscriptions:t,chain:r,blockExplorerUrl:n}){let s=function({rpc:e,rpcSubscriptions:t}){return async r=>new Promise(async(n,s)=>{try{let s=await e.sendTransaction(p(r).toString("base64"),{preflightCommitment:"confirmed",encoding:"base64"}).send();await g({rpcSubscriptions:t,signature:s,timeout:1e4}),n({signature:new Uint8Array((0,i.Un)().encode(s))})}catch(e){s(e)}})}({rpc:e,rpcSubscriptions:t});return{rpc:e,rpcSubscriptions:t,chain:r,blockExplorerUrl:n,sendAndConfirmTransaction:s}}function m(){let e=(0,o.u)(),t=(0,a.u)(),r=(0,s.useMemo)(()=>{let r=t(u),n=r?.getDefaultRpcs({appId:e.id});return Object.fromEntries(["solana:mainnet","solana:devnet","solana:testnet"].map(t=>{let r=e.solanaRpcs[t]??n?.[t]??null;return[t,r?y({chain:t,rpc:r.rpc,rpcSubscriptions:r.rpcSubscriptions,blockExplorerUrl:r.blockExplorerUrl??`https://explorer.solana.com?cluster=${t.replace("solana:","")}`}):null]}))},[e.solanaRpcs,e.id,t]);return(0,s.useCallback)(e=>{if(!r[e])throw Error(`No RPC configuration found for chain ${e}`);return r[e]},[r])}},72669:function(e,t,r){"use strict";r.d(t,{S:function(){return v},a:function(){return eo},g:function(){return E}});var n=r(65891),i=r(72788),s=r(67550),o=r(2265),a=r(1064),l=r(5653),c=r(97422),u=r(3266),f=r(20545),h=r(22931),d=r(18415),p=r(91799),g=r(26558);let y=()=>{let{walletProxy:e,client:t}=(0,c.u)();return(0,o.useMemo)(()=>({signWithUserSigner:async({message:r,targetAppId:n})=>{if(!e)throw Error("Wallet proxy not initialized");let i=await t.getAccessToken();if(!i)throw Error("User must be authenticated");let{signature:s}=await e.signWithUserSigner({accessToken:i,message:r,targetAppId:n});return{signature:s}}}),[e,t])};var m=r(50040),b=r(84736),w=r(71787);let v=["solana:mainnet","solana:devnet","solana:testnet"];function E(e){return(0,n._V)().decode(e)}function x(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}var _=0,A="__private_"+_+++"__implementation";function S(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}var I=0;function O(e){return"__private_"+I+++"_"+e}var P=O("_address"),C=O("_publicKey"),k=O("_chains"),T=O("_features"),B=O("_label"),R=O("_icon");class D{get address(){return S(this,P)[P]}get publicKey(){return S(this,C)[C].slice()}get chains(){return S(this,k)[k].slice()}get features(){return S(this,T)[T].slice()}get label(){return S(this,B)[B]}get icon(){return S(this,R)[R]}constructor({address:e,publicKey:t,label:r,icon:n}){Object.defineProperty(this,P,{writable:!0,value:void 0}),Object.defineProperty(this,C,{writable:!0,value:void 0}),Object.defineProperty(this,k,{writable:!0,value:void 0}),Object.defineProperty(this,T,{writable:!0,value:void 0}),Object.defineProperty(this,B,{writable:!0,value:void 0}),Object.defineProperty(this,R,{writable:!0,value:void 0}),S(this,P)[P]=e,S(this,C)[C]=t,S(this,k)[k]=v,S(this,B)[B]=r,S(this,R)[R]=n,S(this,T)[T]=["solana:signAndSendTransaction","solana:signTransaction","solana:signMessage"],new.target===D&&Object.freeze(this)}}function U(e,t){if(!Object.prototype.hasOwnProperty.call(e,t))throw TypeError("attempted to use private field on non-instance");return e}var M=0;function N(e){return"__private_"+M+++"_"+e}var j=N("_listeners"),L=N("_version"),$=N("_name"),z=N("_icon"),F=N("_injection"),q=N("_isPrivyWallet"),W=N("_accounts"),V=N("_on"),H=N("_emit"),G=N("_off"),K=N("_connected"),Z=N("_connect"),J=N("_disconnect"),Y=N("_signMessage"),X=N("_signAndSendTransaction"),Q=N("_signTransaction");
252function ee(e,...t){U(this,j)[j][e]?.forEach(e=>e.apply(null,t))}function et(e,t){U(this,j)[j][e]=U(this,j)[j][e]?.filter(e=>t!==e)}function er(){let{isHeadlessSigning:e,walletProxy:t,initializeWalletProxy:r,recoverEmbeddedWallet:n,openModal:i,privy:s,client:o}=(0,c.u)(),{user:l}=(0,f.u)(),{setModalData:d}=(0,u.a)(),{signWithUserSigner:p}=y();return{signMessage:({message:f,address:g,options:y})=>new Promise(async(b,w)=>{let v=(0,u.j)(l,g);if("privy"!==v?.walletClientType)return void w(new c.b("Wallet is not a Privy wallet",void 0,c.c.EMBEDDED_WALLET_NOT_FOUND));let{entropyId:E,entropyIdVerifier:x}=(0,h.b)(l,v),_=(0,u.b)(v),A=(0,m.b)(f).toString("base64");if(A.length<1)return void w(new c.b("Message must be a non-empty string",void 0,c.c.INVALID_MESSAGE));let S=async()=>{let e;if(!l)throw Error("User must be authenticated before signing with a Privy wallet");let i=await o.getAccessToken();if(!i)throw Error("User must be authenticated to use their embedded wallet.");let c=t??await r(15e3);if(!c)throw Error("Failed to initialize embedded wallet proxy.");if(!await n({address:v.address}))throw Error("Unable to connect to wallet");if(_){let t=await (0,a.f)(s,p,{chain_type:"solana",method:"signMessage",params:{message:A,encoding:"base64"},wallet_id:v.id});if(!t.data||!("signature"in t.data))throw Error("Failed to sign message");e=t.data.signature}else{let{response:t}=await c.rpc({accessToken:i,entropyId:E,entropyIdVerifier:x,chainType:"solana",hdWalletIndex:v.walletIndex??0,requesterAppId:y?.uiOptions?.requesterAppId,request:{method:"signMessage",params:{message:A}}});e=t.data.signature}return e};if(e({showWalletUIs:y?.uiOptions?.showWalletUIs}))try{let e=await S(),t=new Uint8Array((0,m.b)(e,"base64"));b({signature:t})}catch(e){w(e)}else d({signMessage:{method:"solana_signMessage",data:A,confirmAndSign:S,onSuccess:e=>{b({signature:new Uint8Array((0,m.b)(e,"base64"))})},onFailure:e=>{w(e)},uiOptions:y?.uiOptions??{}},connectWallet:{recoveryMethod:v.recoveryMethod,connectingWalletAddress:v.address,entropyId:E,entropyIdVerifier:x,isUnifiedWallet:_,onCompleteNavigateTo:"SignRequestScreen",onFailure:e=>{w(new c.b("Failed to connect to wallet",e,c.c.UNKNOWN_CONNECT_WALLET_ERROR))}}}),i("EmbeddedWalletConnectingScreen")})}}function en(){let{isHeadlessSigning:e,openModal:t,privy:r}=(0,c.u)(),{setModalData:n}=(0,u.a)(),{signMessage:o}=er(),{signWithUserSigner:l}=y(),{user:d}=(0,f.u)();return{signTransaction:async({transaction:f,options:p,chain:g="solana:mainnet",address:y})=>{let w=(0,u.j)(d,y);if("privy"!==w?.walletClientType)throw new c.b("Wallet is not a Privy wallet",void 0,c.c.EMBEDDED_WALLET_NOT_FOUND);let v=(0,u.b)(w);async function E(e){let t,n;if(v){let t=await (0,a.f)(r,l,{chain_type:"solana",method:"signTransaction",params:{transaction:b.j.base64.fromBytes(e),encoding:"base64"},wallet_id:w.id});if(t.data&&"signed_transaction"in t.data)return{signedTransaction:new Uint8Array(b.j.base64.toBytes(t.data.signed_transaction))};throw Error("Failed to sign transaction")}let{signature:c}=await o({message:(0,m.a)(e),address:y,options:{...p,uiOptions:{...p?.uiOptions,showWalletUIs:!1}}});return{signedTransaction:(t=structuredClone((0,i.x7)().decode(e)),(n=(0,s.Lk)(y))in t.signatures&&(t.signatures[n]=c),new Uint8Array((0,i.Kt)().encode(t)))}}return e({showWalletUIs:p?.uiOptions?.showWalletUIs})?E(f):new Promise(async(e,r)=>{let{entropyId:i,entropyIdVerifier:s}=(0,h.b)(d,w);function o(e){return t=>{r(t instanceof c.b?t:new c.b("Failed to connect to wallet",t,e))}}let a={account:w,transaction:f,chain:g,signOnly:!0,uiOptions:p?.uiOptions||{},onConfirm:E,onSuccess:e,onFailure:o(c.c.TRANSACTION_FAILURE)};n({connectWallet:{recoveryMethod:w.recoveryMethod,connectingWalletAddress:w.address,entropyId:i,entropyIdVerifier:s,isUnifiedWallet:v,onCompleteNavigateTo:"StandardSignAndSendTransactionScreen",onFailure:o(c.c.UNKNOWN_CONNECT_WALLET_ERROR)},standardSignAndSendTransaction:a}),t("EmbeddedWalletConnectingScreen")})}}}let ei=new class extends d.Z{setImplementation(e){x(this,A)[A]=e}async signMessage(e){return x(this,A)[A].signMessage(e)}async signAndSendTransaction(e){return x(this,A)[A].signAndSendTransaction(e)}async signTransaction(e){return x(this,A)[A].signTransaction(e)}constructor(e){super(),Object.defineProperty(this,A,{writable:!0,value:void 0}),x(this,A)[A]=e}}({signTransaction:(0,c.l)("signTransaction was not injected"),signAndSendTransaction:(0,c.l)("signAndSendTransaction was not injected"),signMessage:(0,c.l)("signMessage was not injected")}),es=new class{get version(){return U(this,L)[L]}get name(){return U(this,$)[$]}get icon(){return U(this,z)[z]}get chains(){return v.slice()}get features(){return{"standard:connect":{version:"1.0.0",connect:U(this,Z)[Z]},"standard:disconnect":{version:"1.0.0",disconnect:U(this,J)[J]},"standard:events":{version:"1.0.0",on:U(this,V)[V]},"solana:signAndSendTransaction":{version:"1.0.0",supportedTransactionVersions:["legacy",0],signAndSendTransaction:U(this,X)[X]},"solana:signTransaction":{version:"1.0.0",supportedTransactionVersions:["legacy",0],signTransaction:U(this,Q)[Q]},"solana:signMessage":{version:"1.0.0",signMessage:U(this,Y)[Y]},"privy:":{privy:{signMessage:U(this,F)[F].signMessage,signTransaction:U(this,F)[F].signTransaction,signAndSendTransaction:U(this,F)[F].signAndSendTransaction}}}}get accounts(){return U(this,W)[W].slice()}get isPrivyWallet(){return U(this,q)[q]}constructor({name:e,icon:t,version:r,injection:n,wallets:i}){Object.defineProperty(this,H,{value:ee}),Object.defineProperty(this,G,{value:et}),Object.defineProperty(this,j,{writable:!0,value:void 0}),Object.defineProperty(this,L,{writable:!0,value:void 0}),Object.defineProperty(this,$,{writable:!0,value:void 0}),Object.defineProperty(this,z,{writable:!0,value:void 0}),Object.defineProperty(this,F,{writable:!0,value:void 0}),Object.defineProperty(this,q,{writable:!0,value:void 0}),Object.defineProperty(this,W,{writable:!0,value:void 0}),Object.defineProperty(this,V,{writable:!0,value:void 0}),Object.defineProperty(this,K,{writable:!0,value:void 0}),Object.defineProperty(this,Z,{writable:!0,value:void 0}),Object.defineProperty(this,J,{writable:!0,value:void 0}),Object.defineProperty(this,Y,{writable:!0,value:void 0}),Object.defineProperty(this,X,{writable:!0,value:void 0}),Object.defineProperty(this,Q,{writable:!0,value:void 0}),U(this,j)[j]={},U(this,V)[V]=(e,t)=>(U(this,j)[j][e]?.push(t)||(U(this,j)[j][e]=[t]),()=>U(this,G)[G](e,t)),U(this,K)[K]=e=>{null!=e&&(U(this,W)[W]=e.map(({address:e})=>new D({address:e,publicKey:p.Jq.decode(e)}))),U(this,H)[H]("change",{accounts:this.accounts})},U(this,Z)[Z]=async()=>(U(this,H)[H]("change",{accounts:this.accounts}),{accounts:this.accounts}),U(this,J)[J]=async()=>{U(this,H)[H]("change",{accounts:this.accounts})},U(this,Y)[Y]=async(...e)=>{let t=[];for(let{account:r,...n}of e){let{signature:e}=await U(this,F)[F].signMessage({...n,address:r.address});t.push({signedMessage:n.message,signature:e})}return t},U(this,X)[X]=async(...e)=>{let t=[];for(let r of e){let{signature:e}=await U(this,F)[F].signAndSendTransaction({...r,transaction:r.transaction,address:r.account.address,chain:r.chain||"solana:mainnet",options:r.options});t.push({signature:e})}return t},U(this,Q)[Q]=async(...e)=>{let t=[];for(let{transaction:r,account:n,options:i,chain:s}of e){let{signedTransaction:e}=await U(this,F)[F].signTransaction({transaction:r,address:n.address,chain:s||"solana:mainnet",options:i});t.push({signedTransaction:e})}return t},U(this,$)[$]=e,U(this,z)[z]=t,U(this,L)[L]=r,U(this,F)[F]=n,U(this,W)[W]=[],U(this,q)[q]=!0,n.on("accountChanged",U(this,K)[K],this),U(this,K)[K](i)}}({name:"Privy",version:"1.0.0",icon:"data:image/png;base64,AAABAAEAFBQAAAAAIABlAQAAFgAAAIlQTkcNChoKAAAADUlIRFIAAAAUAAAAFAgGAAAAjYkdDQAAAAlwSFlzAAAOwwAADsMBx2+oZAAAAQVJREFUeJxiYMANZIC4E4ivAPFPIP4FxDeAuB+IlfDowwBMQFwJxF+B+D8O/AOI66Bq8QJGIF6ExyB0vAqImfEZmEeCYTDcgMswPiB+T4aB34FYApuBsWQYBsP52AycToGBK7EZuJECAw9jM3AVBQbuwWZgIwUGTsZmoDkFBnpiMxAEjpJh2FV8iVsbiD+TYBgoDVrgMgwGnID4HRGGgTKBGyHDYEAaiBdCSxh0g/5AU4Q8sYYhAzEgjoGmABBOgFo2eACowFABYn0oVgViAVINkQTiZUD8DIj/ATF6GILEXgLxCiCWIsZAb
252iAuBeKtQHwHiEHJ6C8UfwHie0C8E4jLoWpRAAAAAP//rcbhsQAAAAZJREFUAwBYFs3VKJ0cuQAAAABJRU5ErkJggg==",wallets:[],injection:ei});function eo(){let{ready:e,wallets:t}=function(){let{client:e}=(0,c.u)(),{ready:t,wallet:r}=function(){let{ready:e}=(0,h.u)(),{user:t}=(0,f.u)(),{signMessage:r}=er(),{signTransaction:n}=en(),{signAndSendTransaction:i}=function(){let e=(0,g.u)(),{isHeadlessSigning:t,openModal:r,privy:n}=(0,c.u)(),{setModalData:i}=(0,u.a)(),{signTransaction:s}=en(),o=(0,m.u)(),{user:l}=(0,f.u)(),{signWithUserSigner:d}=y();return{signAndSendTransaction:async({transaction:f,address:g,chain:y="solana:mainnet",options:b})=>{let v=(0,u.j)(l,g);if("privy"!==v?.walletClientType)throw new c.b("Wallet is not a Privy wallet",void 0,c.c.EMBEDDED_WALLET_NOT_FOUND);let E=(0,u.b)(v);async function x(e){if(b?.sponsor)return await (async e=>{if(!E)throw new c.b("Sponsoring transactions is only supported for wallets on the TEE stack",c.c.INVALID_DATA);let t=await (0,a.f)(n,d,{chain_type:"solana",method:"signAndSendTransaction",sponsor:!0,params:{transaction:(0,m.b)(e).toString("base64"),encoding:"base64"},caip2:`solana:${(await o(y).rpc.getGenesisHash().send()).substring(0,32)}`,wallet_id:v.id});if(t.data&&"hash"in t.data)return{signature:p.Jq.decode(t.data.hash)};throw Error("Failed to sign and send transaction")})(e);let{signedTransaction:t}=await s({transaction:e,address:g,chain:y,options:{...b,uiOptions:{...b?.uiOptions,showWalletUIs:!1}}}),{signature:r}=await o(y).sendAndConfirmTransaction(t);return{signature:r}}return t({showWalletUIs:b?.uiOptions?.showWalletUIs})?x(f):new Promise(async(t,n)=>{let s,o,{entropyId:a,entropyIdVerifier:u}=(0,h.b)(l,v);function d(e){return t=>{n(t instanceof c.b?t:new c.b("Failed to connect to wallet",t,e))}}let p={account:v,transaction:f,chain:y,signOnly:!1,uiOptions:b?.uiOptions||{},onConfirm:x,onSuccess:t,onFailure:d(c.c.TRANSACTION_FAILURE),isSponsored:!!b?.sponsor},m={recoveryMethod:v.recoveryMethod,connectingWalletAddress:v.address,entropyId:a,entropyIdVerifier:u,isUnifiedWallet:E,onCompleteNavigateTo:"StandardSignAndSendTransactionScreen",onFailure:d(c.c.UNKNOWN_CONNECT_WALLET_ERROR)};e.fundingConfig&&(s=(0,w.y)({address:g,appConfig:e,methodScreen:"FundingMethodSelectionScreen",fundWalletConfig:{...b,asset:"native-currency",chain:y},externalSolanaFundingScreen:"FundSolWalletWithExternalSolanaWallet"}),o={amount:e.fundingConfig.defaultRecommendedAmount,asset:"SOL",chain:y,destinationAddress:g,afterSuccessScreen:"StandardSignAndSendTransactionScreen",sourceWalletData:void 0}),i({connectWallet:m,standardSignAndSendTransaction:p,funding:s,solanaFundingData:o}),r("EmbeddedWalletConnectingScreen")})}}}(),s=(0,o.useMemo)(()=>{let e=[...(0,u.m)(t).sort((e,t)=>(e.walletIndex??0)-(t.walletIndex??0))],r=(0,u.h)(t);return r.length?[...e,...r]:e},[t]),l=(0,o.useMemo)(()=>({signMessage:async({message:e,address:t,options:n})=>await r({message:e,address:t,options:n}),signTransaction:async({transaction:e,address:t,chain:r,options:i})=>await n({transaction:e,address:t,chain:r,options:i}),async signAndSendTransaction({transaction:e,address:t,chain:r,options:n}){let{signature:s}=await i({transaction:e,address:t,chain:r,options:n});return{signature:s}}}),[r,n,i]);return(0,o.useEffect)(()=>{ei?.setImplementation(l)},[l]),(0,o.useEffect)(()=>{var t;!e||(t=es.accounts).length===s.length&&t.every((e,t)=>e.address===s[t]?.address)||ei?.emit("accountChanged",s)},[e,s]),{ready:e,wallet:es}}(),[n,i]=(0,o.useState)([]),[s,l]=(0,o.useState)([]);return(0,o.useEffect)(()=>{let e=[r,...n.filter(e=>"solana"===e.chainType&&!!e.wallet.features).map(e=>e.wallet)];l(e);let t=n.flatMap(t=>{let r=()=>l([...e]);return t.on("walletsUpdated",r),{connector:t,off:r}}),i=e.map(t=>t.features["standard:events"]?.on("change",()=>{l([...e])}));return()=>{i.forEach(e=>e?.()),t.forEach(({connector:e,off:t})=>e.off("walletsUpdated",t))}},[n]),(0,o.useEffect)(()=>{i(e.connectors?.walletConnectors.filter(e=>"solana"===e.chainType)??[]);let t=()=>{i(e.connectors?.walletConnectors.filter(e=>"solana"===e.chainType)??[])};return e.connectors?.on("connectorInitialized",t),()=>{e.connectors?.off("connectorInitialized",t)}},[t,e.connectors]),{ready:t,wallets:s}}();return{ready:e,wallets:(0,o.useMemo)(()=>t.flatMap(e=>e.accounts.map(t=>new l.O({wallet:e,account:t}))),[t])}}},98868:function(e,t,r){"use strict";r.d(t,{a:function(){return s},b:function(){return o},s:function(){return i},u:function(){return n}});let n=(0,r(75709).U)(()=>({user:null,authenticated:!1,hasResolvedInitialUser:!1})),i=e=>n.setState({user:e}),s=e=>n.setState({authenticated:e}),o=e=>n.setState({hasResolvedInitialUser:e})},90677:function(e,t,r){"use strict";r.d(t,{secp256k1:function(){return e_}});var n=r(65086),i=r(23115),s=r(79047);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */let o=BigInt(0),a=BigInt(1);function l(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function c(e){if(!l(e))throw Error("Uint8Array expected")}function u(e,t){if("boolean"!=typeof t)throw Error(e+" boolean expected, got "+t)}function f(e){let t=e.toString(16);return 1&t.length?"0"+t:t}function h(e){if("string"!=typeof e)throw Error("hex string expected, got "+typeof e);return""===e?o:BigInt("0x"+e)}let d="function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex,p=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function g(e){if(c(e),d)return e.toHex();let t="";for(let r=0;r<e.length;r++)t+=p[e[r]];return t}let y={_0:48,_9:57,A:65,F:70,a:97,f:102};function m(e){return e>=y._0&&e<=y._9?e-y._0:e>=y.A&&e<=y.F?e-(y.A-10):e>=y.a&&e<=y.f?e-(y.a-10):void 0}function b(e){if("string"!=typeof e)throw Error("hex string expected, got "+typeof e);if(d)return Uint8Array.fromHex(e);let t=e.length,r=t/2;if(t%2)throw Error("hex string expected, got unpadded hex of length "+t);let n=new Uint8Array(r);for(let t=0,i=0;t<r;t++,i+=2){let r=m(e.charCodeAt(i)),s=m(e.charCodeAt(i+1));if(void 0===r||void 0===s)throw Error('hex string expected, got non-hex character "'+(e[i]+e[i+1])+'" at index '+i);n[t]=16*r+s}return n}function w(e){return h(g(e))}function v(e){return c(e),h(g(Uint8Array.from(e).reverse()))}function E(e,t){return b(e.toString(16).padStart(2*t,"0"))}function x(e,t){return E(e,t).reverse()}function _(e,t,r){let n;if("string"==typeof t)try{n=b(t)}catch(t){throw Error(e+" must be hex string or Uint8Array, cause: "+t)}else if(l(t))n=Uint8Array.from(t);else throw Error(e+" must be hex string or Uint8Array");let i=n.length;if("number"==typeof r&&i!==r)throw Error(e+" of length "+r+" expected, got "+i);return n}function A(...e){let t=0;for(let r=0;r<e.length;r++){let n=e[r];c(n),t+=n.length}let r=new Uint8Array(t);for(let t=0,n=0;t<e.length;t++){let i=e[t];r.set(i,n),n+=i.length}return r}let S=e=>"bigint"==typeof e&&o<=e;function I(e,t,r){return S(e)&&S(t)&&S(r)&&t<=e&&e<r}function O(e,t,r,n){if(!I(t,r,n))throw Error("expected valid "+e+": "+r+" <= n < "+n+", got "+t)}let P=e=>(a<<BigInt(e))-a,C=e=>
vendor: 5,026 bytes, line 252
252new Uint8Array(e),k=e=>Uint8Array.from(e),T={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||l(e),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 B(e,t,r={}){let n=(t,r,n)=>{let i=T[r];if("function"!=typeof i)throw Error("invalid validator function");let s=e[t];if((!n||void 0!==s)&&!i(s,e))throw Error("param "+String(t)+" is invalid. Expected "+r+", got "+s)};for(let[e,r]of Object.entries(t))n(e,r,!1);for(let[e,t]of Object.entries(r))n(e,t,!0);return e}function R(e){let t=new WeakMap;return(r,...n)=>{let i=t.get(r);if(void 0!==i)return i;let s=e(r,...n);return t.set(r,s),s}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */let D=BigInt(0),U=BigInt(1),M=BigInt(2),N=BigInt(3),j=BigInt(4),L=BigInt(5),$=BigInt(8);function z(e,t){let r=e%t;return r>=D?r:t+r}function F(e,t,r){let n=e;for(;t-- >D;)n*=n,n%=r;return n}function q(e,t){if(e===D)throw Error("invert: expected non-zero number");if(t<=D)throw Error("invert: expected positive modulus, got "+t);let r=z(e,t),n=t,i=D,s=U,o=U,a=D;for(;r!==D;){let e=n/r,t=n%r,l=i-o*e,c=s-a*e;n=r,r=t,i=o,s=a,o=l,a=c}if(n!==U)throw Error("invert: does not exist");return z(i,t)}function W(e,t){let r=(e.ORDER+U)/j,n=e.pow(t,r);if(!e.eql(e.sqr(n),t))throw Error("Cannot find square root");return n}function V(e,t){let r=(e.ORDER-L)/$,n=e.mul(t,M),i=e.pow(n,r),s=e.mul(t,i),o=e.mul(e.mul(s,M),i),a=e.mul(s,e.sub(o,e.ONE));if(!e.eql(e.sqr(a),t))throw Error("Cannot find square root");return a}let H=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function G(e,t,r=!1){let n=Array(t.length).fill(r?e.ZERO:void 0),i=t.reduce((t,r,i)=>e.is0(r)?t:(n[i]=t,e.mul(t,r)),e.ONE),s=e.inv(i);return t.reduceRight((t,r,i)=>e.is0(r)?t:(n[i]=e.mul(t,n[i]),e.mul(t,r)),s),n}function K(e,t){let r=(e.ORDER-U)/M,n=e.pow(t,r),i=e.eql(n,e.ONE),s=e.eql(n,e.ZERO),o=e.eql(n,e.neg(e.ONE));if(!i&&!s&&!o)throw Error("invalid Legendre symbol result");return i?1:s?0:-1}function Z(e,t){void 0!==t&&(0,s.k8)(t);let r=void 0!==t?t:e.toString(2).length;return{nBitLength:r,nByteLength:Math.ceil(r/8)}}function J(e,t,r=!1,n={}){let i;if(e<=D)throw Error("invalid field: expected ORDER > 0, got "+e);let{nBitLength:s,nByteLength:o}=Z(e,t);if(o>2048)throw Error("invalid field: expected ORDER of <= 2048 bytes");let a=Object.freeze({ORDER:e,isLE:r,BITS:s,BYTES:o,MASK:P(s),ZERO:D,ONE:U,create:t=>z(t,e),isValid:t=>{if("bigint"!=typeof t)throw Error("invalid field element: expected bigint, got "+typeof t);return D<=t&&t<e},is0:e=>e===D,isOdd:e=>(e&U)===U,neg:t=>z(-t,e),eql:(e,t)=>e===t,sqr:t=>z(t*t,e),add:(t,r)=>z(t+r,e),sub:(t,r)=>z(t-r,e),mul:(t,r)=>z(t*r,e),pow:(e,t)=>(function(e,t,r){if(r<D)throw Error("invalid exponent, negatives unsupported");if(r===D)return e.ONE;if(r===U)return t;let n=e.ONE,i=t;for(;r>D;)r&U&&(n=e.mul(n,i)),i=e.sqr(i),r>>=U;return n})(a,e,t),div:(t,r)=>z(t*q(r,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>q(t,e),sqrt:n.sqrt||(t=>(!i&&(i=e%j===N?W:e%$===L?V:function(e){if(e<BigInt(3))throw Error("sqrt is not defined for small field");let t=e-U,r=0;for(;t%M===D;)t/=M,r++;let n=M,i=J(e);for(;1===K(i,n);)if(n++>1e3)throw Error("Cannot find square root: probably non-prime P");if(1===r)return W;let s=i.pow(n,t),o=(t+U)/M;return function(e,n){if(e.is0(n))return n;if(1!==K(e,n))throw Error("Cannot find square root");let i=r,a=e.mul(e.ONE,s),l=e.pow(n,t),c=e.pow(n,o);for(;!e.eql(l,e.ONE);){if(e.is0(l))return e.ZERO;let t=1,r=e.sqr(l);for(;!e.eql(r,e.ONE);)if(t++,r=e.sqr(r),t===i)throw Error("Cannot find square root");let n=U<<BigInt(i-t-1),s=e.pow(a,n);i=t,a=e.sqr(s),l=e.mul(l,a),c=e.mul(c,s)}return c}}(e)),i(a,t))),toBytes:e=>r?x(e,o):E(e,o),fromBytes:e=>{if(e.length!==o)throw Error("Field.fromBytes: expected "+o+" bytes, got "+e.length);return r?v(e):w(e)},invertBatch:e=>G(a,e),cmov:(e,t,r)=>r?t:e});return Object.freeze(a)}function Y(e){if("bigint"!=typeof e)throw Error("field order must be bigint");return Math.ceil(e.toString(2).length/8)}function X(e){let t=Y(e);return t+Math.ceil(t/2)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */let Q=BigInt(0),ee=BigInt(1);function et(e,t){let r=t.negate();return e?r:t}function er(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw Error("invalid window size, expected [1.."+t+"], got W="+e)}function en(e,t){er(e,t);let r=Math.ceil(t/e)+1,n=2**(e-1),i=2**e;return{windows:r,windowSize:n,mask:P(e),maxNumber:i,shiftBy:BigInt(e)}}function ei(e,t,r){let{windowSize:n,mask:i,maxNumber:s,shiftBy:o}=r,a=Number(e&i),l=e>>o;a>n&&(a-=s,l+=ee);let c=t*n,u=c+Math.abs(a)-1;return{nextN:l,offset:u,isZero:0===a,isNeg:a<0,isNegF:t%2!=0,offsetF:c}}let es=new WeakMap,eo=new WeakMap;function ea(e){return eo.get(e)||1}function el(e){return B(e.Fp,H.reduce((e,t)=>
vendor: 14,170 bytes, line 252
252(e[t]="function",e),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),B(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Z(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */function ec(e){void 0!==e.lowS&&u("lowS",e.lowS),void 0!==e.prehash&&u("prehash",e.prehash)}class eu extends Error{constructor(e=""){super(e)}}let ef={Err:eu,_tlv:{encode:(e,t)=>{let{Err:r}=ef;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(1&t.length)throw new r("tlv.encode: unpadded data");let n=t.length/2,i=f(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");let s=n>127?f(i.length/2|128):"";return f(e)+s+i+t},decode(e,t){let{Err:r}=ef,n=0;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(t.length<2||t[n++]!==e)throw new r("tlv.decode: wrong tlv");let i=t[n++],s=0;if(128&i){let e=127&i;if(!e)throw new r("tlv.decode(long): indefinite length not supported");if(e>4)throw new r("tlv.decode(long): byte length is too big");let o=t.subarray(n,n+e);if(o.length!==e)throw new r("tlv.decode: length bytes not complete");if(0===o[0])throw new r("tlv.decode(long): zero leftmost byte");for(let e of o)s=s<<8|e;if(n+=e,s<128)throw new r("tlv.decode(long): not minimal encoding")}else s=i;let o=t.subarray(n,n+s);if(o.length!==s)throw new r("tlv.decode: wrong value length");return{v:o,l:t.subarray(n+s)}}},_int:{encode(e){let{Err:t}=ef;if(e<eh)throw new t("integer: negative integers are not allowed");let r=f(e);if(8&Number.parseInt(r[0],16)&&(r="00"+r),1&r.length)throw new t("unexpected DER parsing assertion: unpadded hex");return r},decode(e){let{Err:t}=ef;if(128&e[0])throw new t("invalid signature integer: negative");if(0===e[0]&&!(128&e[1]))throw new t("invalid signature integer: unnecessary leading zero");return w(e)}},toSig(e){let{Err:t,_int:r,_tlv:n}=ef,i=_("signature",e),{v:s,l:o}=n.decode(48,i);if(o.length)throw new t("invalid signature: left bytes after parsing");let{v:a,l:l}=n.decode(2,s),{v:c,l:u}=n.decode(2,l);if(u.length)throw new t("invalid signature: left bytes after parsing");return{r:r.decode(a),s:r.decode(c)}},hexFromSig(e){let{_tlv:t,_int:r}=ef,n=t.encode(2,r.encode(e.r)),i=t.encode(2,r.encode(e.s));return t.encode(48,n+i)}},eh=BigInt(0),ed=BigInt(1),ep=(BigInt(2),BigInt(3)),eg=BigInt(4),ey=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),em=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),eb=BigInt(0),ew=BigInt(1),ev=BigInt(2),eE=(e,t)=>(e+t/ev)/t,ex=J(ey,void 0,void 0,{sqrt:function(e){let t=BigInt(3),r=BigInt(6),n=BigInt(11),i=BigInt(22),s=BigInt(23),o=BigInt(44),a=BigInt(88),l=e*e*e%ey,c=l*l*e%ey,u=F(c,t,ey)*c%ey,f=F(u,t,ey)*c%ey,h=F(f,ev,ey)*l%ey,d=F(h,n,ey)*h%ey,p=F(d,i,ey)*d%ey,g=F(p,o,ey)*p%ey,y=F(g,a,ey)*g%ey,m=F(y,o,ey)*p%ey,b=F(m,t,ey)*c%ey,w=F(b,s,ey)*d%ey,v=F(w,r,ey)*l%ey,E=F(v,ev,ey);if(!ex.eql(ex.sqr(E),e))throw Error("Cannot find square root");return E}}),e_=function(e,t){let r=t=>(function(e){let t=function(e){let t=el(e);return B(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}(e),{Fp:r,n:n,nByteLength:i,nBitLength:s}=t,c=r.BYTES+1,f=2*r.BYTES+1;function h(e){return z(e,n)}let{ProjectivePoint:d,normPrivateKeyToScalar:p,weierstrassEquation:y,isWithinCurveOrder:m}=function(e){var t;let r=function(e){let t=el(e);B(t,{a:"field",b:"field"},{allowInfinityPoint:"boolean",allowedPrivateKeyLengths:"array",clearCofactor:"function",fromBytes:"function",isTorsionFree:"function",toBytes:"function",wrapPrivateKey:"boolean"});let{endo:r,Fp:n,a:i}=t;if(r){if(!n.eql(i,n.ZERO))throw Error("invalid endo: CURVE.a must be 0");if("object"!=typeof r||"bigint"!=typeof r.beta||"function"!=typeof r.splitScalar)throw Error('invalid endo: expected "beta": bigint and "splitScalar": function')}return Object.freeze({...t})}(e),{Fp:n}=r,i=J(r.n,r.nBitLength),s=r.toBytes||((e,t,r)=>{let i=t.toAffine();return A(Uint8Array.from([4]),n.toBytes(i.x),n.toBytes(i.y))}),c=r.fromBytes||(e=>{let t=e.subarray(1);return{x:n.fromBytes(t.subarray(0,n.BYTES)),y:n.fromBytes(t.subarray(n.BYTES,2*n.BYTES))}});function f(e){let{a:t,b:i}=r,s=n.sqr(e),o=n.mul(s,e);return n.add(n.add(o,n.mul(e,t)),i)}function h(e,t){let r=n.sqr(t),i=f(e);return n.eql(r,i)}if(!h(r.Gx,r.Gy))throw Error("bad curve params: generator point");let d=n.mul(n.pow(r.a,ep),eg),p=n.mul(n.sqr(r.b),BigInt(27));if(n.is0(n.add(d,p)))throw Error("bad curve params: a or b");function y(e){let t;let{allowedPrivateKeyLengths:n,nByteLength:i,wrapPrivateKey:s,n:o}=r;if(n&&"bigint"!=typeof e){if(l(e)&&(e=g(e)),"string"!=typeof e||!n.includes(e.length))throw Error("invalid private key");e=e.padStart(2*i,"0")}try{t="bigint"==typeof e?e:w(_("private key",e,i))}catch(t){throw Error("invalid private key, expected hex or "+i+" bytes, got "+typeof e)}return s&&(t=z(t,o)),O("private key",t,ed,o),t}function m(e){if(!(e instanceof E))throw Error("ProjectivePoint expected")}let b=R((e,t)=>{let{px:r,py:i,pz:s}=e;if(n.eql(s,n.ONE))return{x:r,y:i};let o=e.is0();null==t&&(t=o?n.ONE:n.inv(s));let a=n.mul(r,t),l=n.mul(i,t),c=n.mul(s,t);if(o)return{x:n.ZERO,y:n.ZERO};if(!n.eql(c,n.ONE))throw Error("invZ was invalid");return{x:a,y:l}}),v=R(e=>{if(e.is0()){if(r.allowInfinityPoint&&!n.is0(e.py))return;throw Error("bad point: ZERO")}let{x:t,y:i}=e.toAffine();if(!n.isValid(t)||!n.isValid(i))throw Error("bad point: x or y not FE");if(!h(t,i))throw Error("bad point: equation left != right");if(!e.isTorsionFree())throw Error("bad point: not in prime-order subgroup");return!0});class E{constructor(e,t,r){if(null==e||!n.isValid(e))throw Error("x required");if(null==t||!n.isValid(t)||n.is0(t))throw Error("y required");if(null==r||!n.isValid(r))throw Error("z required");this.px=e,this.py=t,this.pz=r,Object.freeze(this)}static fromAffine(e){let{x:t,y:r}=e||{};if(!e||!n.isValid(t)||!n.isValid(r))throw Error("invalid affine point");if(e instanceof E)throw Error("projective point not allowed");let i=e=>n.eql(e,n.ZERO);return i(t)&&i(r)?E.ZERO:new E(t,r,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(e){let t=G(n,e.map(e=>e.pz));return e.map((e,r)=>e.toAffine(t[r])).map(E.fromAffine)}static fromHex(e){let t=E.fromAffine(c(_("pointHex",e)));return t.assertValidity(),t}static fromPrivateKey(e){return E.BASE.multiply(y(e))}static msm(e,t){return function(e,t,r,n){!function(e,t){if(!Array.isArray(e))throw Error("array expected");e.forEach((e,r)=>{if(!(e instanceof t))throw Error("invalid point at index "+r)})}(r,e),function(e,t){if(!Array.isArray(e))throw Error("array of scalars expected");e.forEach((e,r)=>{if(!t.isValid(e))throw Error("invalid scalar at index "+r)})}(n,t);let i=r.length,s=n.length;if(i!==s)throw Error("arrays of points and scalars must have equal length");let l=e.ZERO,c=function(e){let t;for(t=0;e>o;e>>=a,t+=1);return t}(BigInt(i)),u=1;c>12?u=c-3:c>4?u=c-2:c>0&&(u=2);let f=P(u),h=Array(Number(f)+1).fill(l),d=Math.floor((t.BITS-1)/u)*u,p=l;for(let e=d;e>=0;e-=u){h.fill(l);for(let t=0;t<s;t++){let i=Number(n[t]>>BigInt(e)&f);h[i]=h[i].add(r[t])}let t=l;for(let e=h.length-1,r=l;e>0;e--)r=r.add(h[e]),t=t.add(r);if(p=p.add(t),0!==e)for(let e=0;e<u;e++)p=p.double()}return p}(E,i,e,t)}_setWindowSize(e){C.setWindowSize(this,e)}assertValidity(){v(this)}hasEvenY(){let{y:e}=this.toAffine();if(n.isOdd)return!n.isOdd(e);throw Error("Field doesn't support isOdd")}equals(e){m(e);let{px:t,py:r,pz:i}=this,{px:s,py:o,pz:a}=e,l=n.eql(n.mul(t,a),n.mul(s,i)),c=n.eql(n.mul(r,a),n.mul(o,i));return l&&c}negate(){return new E(this.px,n.neg(this.py),this.pz)}double(){let{a:e,b:t}=r,i=n.mul(t,ep),{px:s,py:o,pz:a}=this,l=n.ZERO,c=n.ZERO,u=n.ZERO,f=n.mul(s,s),h=n.mul(o,o),d=n.mul(a,a),p=n.mul(s,o);return p=n.add(p,p),u=n.mul(s,a),u=n.add(u,u),l=n.mul(e,u),c=n.mul(i,d),c=n.add(l,c),l=n.sub(h,c),c=n.add(h,c),c=n.mul(l,c),l=n.mul(p,l),u=n.mul(i,u),d=n.mul(e,d),p=n.sub(f,d),p=n.mul(e,p),p=n.add(p,u),u=n.add(f,f),f=n.add(u,f),f=n.add(f,d),f=n.mul(f,p),c=n.add(c,f),d=n.mul(o,a),d=n.add(d,d),f=n.mul(d,p),l=n.sub(l,f),u=n.mul(d,h),u=n.add(u,u),new E(l,c,u=n.add(u,u))}add(e){m(e);let{px:t,py:i,pz:s}=this,{px:o,py:a,pz:l}=e,c=n.ZERO,u=n.ZERO,f=n.ZERO,h=r.a,d=n.mul(r.b,ep),p=n.mul(t,o),g=n.mul(i,a),y=n.mul(s,l),b=n.add(t,i),w=n.add(o,a);b=n.mul(b,w),w=n.add(p,g),b=n.sub(b,w),w=n.add(t,s);let v=n.add(o,l);return w=n.mul(w,v),v=n.add(p,y),w=n.sub(w,v),v=n.add(i,s),c=n.add(a,l),v=n.mul(v,c),c=n.add(g,y),v=n.sub(v,c),f=n.mul(h,w),c=n.mul(d,y),f=n.add(c,f),c=n.sub(g,f),f=n.add(g,f),u=n.mul(c,f),g=n.add(p,p),g=n.add(g,p),y=n.mul(h,y),w=n.mul(d,w),g=n.add(g,y),y=n.sub(p,y),y=n.mul(h,y),w=n.add(w,y),p=n.mul(g,w),u=n.add(u,p),p=n.mul(v,w),c=n.mul(b,c),c=n.sub(c,p),p=n.mul(b,g),f=n.mul(v,f),new E(c,u,f=n.add(f,p))}subtract(e){return this.add(e.negate())}is0(){return this.equals(E.ZERO)}wNAF(e){return C.wNAFCached(this,e,E.normalizeZ)}multiplyUnsafe(e){let{endo:t,n:i}=r;O("scalar",e,eh,i);let s=E.ZERO;if(e===eh)return s;if(this.is0()||e===ed)return this;if(!t||C.hasPrecomputes(this))return C.wNAFCachedUnsafe(this,e,E.normalizeZ);let{k1neg:o,k1:a,k2neg:l,k2:c}=t.splitScalar(e),u=s,f=s,h=this;for(;a>eh||c>eh;)a&ed&&(u=u.add(h)),c&ed&&(f=f.add(h)),h=h.double(),a>>=ed,c>>=ed;return o&&(u=u.negate()),l&&(f=f.negate()),f=new E(n.mul(f.px,t.beta),f.py,f.pz),u.add(f)}multiply(e){let t,i;let{endo:s,n:o}=r;if(O("scalar",e,ed,o),s){let{k1neg:r,k1:o,k2neg:a,k2:l}=s.splitScalar(e),{p:c,f:u}=this.wNAF(o),{p:f,f:h}=this.wNAF(l);c=C.constTimeNegate(r,c),f=C.constTimeNegate(a,f),f=new E(n.mul(f.px,s.beta),f.py,f.pz),t=c.add(f),i=u.add(h)}else{let{p:r,f:n}=this.wNAF(e);t=r,i=n}return E.normalizeZ([t,i])[0]}multiplyAndAddUnsafe(e,t,r){let n=E.BASE,i=(e,t)=>t!==eh&&t!==ed&&e.equals(n)?e.multiply(t):e.multiplyUnsafe(t),s=i(this,t).add(i(e,r));return s.is0()?void 0:s}toAffine(e){return b(this,e)}isTorsionFree(){let{h:e,isTorsionFree:t}=r;if(e===ed)return!0;if(t)return t(E,this);throw Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:e,clearCofactor:t}=r;return e===ed?this:t?t(E,this):this.multiplyUnsafe(r.h)}toRawBytes(e=!0){return u("isCompressed",e),this.assertValidity(),s(E,this,e)}toHex(e=!0){return u("isCompressed",e),g(this.toRawBytes(e))}}E.BASE=new E(r.Gx,r.Gy,n.ONE),E.ZERO=new E(n.ZERO,n.ONE,n.ZERO);let{endo:x,nBitLength:S}=r,C=(t=x?Math.ceil(S/2):S,{constTimeNegate:et,hasPrecomputes:e=>1!==ea(e),unsafeLadder(e,t,r=E.ZERO){let n=e;for(;t>Q;)t&ee&&(r=r.add(n)),n=n.double(),t>>=ee;return r},precomputeWindow(e,r){let{windows:n,windowSize:i}=en(r,t),s=[],o=e,a=o;for(let e=0;e<n;e++){a=o,s.push(a);for(let e=1;e<i;e++)a=a.add(o),s.push(a);o=a.double()}return s},wNAF(e,r,n){let i=E.ZERO,s=E.BASE,o=en(e,t);for(let e=0;e<o.windows;e++){let{nextN:t,offset:a,isZero:l,isNeg:c,isNegF:u,offsetF:f}=ei(n,e,o);n=t,l?s=s.add(et(u,r[f])):i=i.add(et(c,r[a]))}return{p:i,f:s}},wNAFUnsafe(e,r,n,i=E.ZERO){let s=en(e,t);for(let e=0;e<s.windows&&n!==Q;e++){let{nextN:t,offset:o,isZero:a,isNeg:l}=ei(n,e,s);if(n=t,!a){let e=r[o];i=i.add(l?e.negate():e)}}return i},getPrecomputes(e,t,r){let n=es.get(t);return n||(n=this.precomputeWindow(t,e),1!==e&&es.set(t,r(n))),n},wNAFCached(e,t,r){let n=ea(e);return this.wNAF(n,this.getPrecomputes(n,e,r),t)},wNAFCachedUnsafe(e,t,r,n){let i=ea(e);return 1===i?this.unsafeLadder(e,t,n):this.wNAFUnsafe(i,this.getPrecomputes(i,e,r),t,n)},setWindowSize(e,r){er(r,t),eo.set(e,r),es.delete(e)}});return{CURVE:r,ProjectivePoint:E,normPrivateKeyToScalar:y,weierstrassEquation:f,isWithinCurveOrder:function(e){return I(e,ed,r.n)}}}({...t,toBytes(e,t,n){let i=t.toAffine(),s=r.toBytes(i.x);return(u("isCompressed",n),n)?A(Uint8Array.from([t.hasEvenY()?2:3]),s):A(Uint8Array.from([4]),s,r.toBytes(i.y))},fromBytes(e){let t=e.length,n=e[0],i=e.subarray(1);if(t===c&&(2===n||3===n)){let e;let t=w(i);if(!I(t,ed,r.ORDER))throw Error("Point is not on curve");let s=y(t);try{e=r.sqrt(s)}catch(e){throw Error("Point is not on curve"+(e instanceof Error?": "+e.message:""))}return(1&n)==1!=((e&ed)===ed)&&(e=r.neg(e)),{x:t,y:e}}if(t===f&&4===n)return{x:r.fromBytes(i.subarray(0,r.BYTES)),y:r.fromBytes(i.subarray(r.BYTES,2*r.BYTES))};throw Error("invalid Point, expected length of "+c+", or uncompressed "+f+", got "+t)}}),S=(e,t,r)=>w(e.slice(t,r));class T{constructor(e,t,r){O("r",e,ed,n),O("s",t,ed,n),this.r=e,this.s=t,null!=r&&(this.recovery=r),Object.freeze(this)}static fromCompact(e){return new T(S(e=_("compactSignature",e,2*i),0,i),S(e,i,2*i))}static fromDER(e){let{r:t,s:r}=ef.toSig(_("DER",e));return new T(t,r)}assertValidity(){}addRecoveryBit(e){return new T(this.r,this.s,e)}recoverPublicKey(e){let{r:i,s,recovery:o}=this,a=N(_("msgHash",e));if(null==o||![0,1,2,3].includes(o))throw Error("recovery id invalid");let l=2===o||3===o?i+t.n:i;if(l>=r.ORDER)throw Error("recovery id 2 or 3 invalid");let c=(1&o)==0?"02":"03",u=d.fromHex(c+g(E(l,r.BYTES))),f=q(l,n),p=h(-a*f),y=h(s*f),m=d.BASE.multiplyAndAddUnsafe(u,p,y);if(!m)throw Error("point at infinify");return m.assertValidity(),m}hasHighS(){return this.s>n>>ed}normalizeS(){return this.hasHighS()?new T(this.r,h(-this.s),this.recovery):this}toDERRawBytes(){return b(this.toDERHex())}toDERHex(){return ef.hexFromSig(this)}toCompactRawBytes(){return b(this.toCompactHex())}toCompactHex(){return g(E(this.r,i))+g(E(this.s,i))}}function D(e){if("bigint"==typeof e)return!1;if(e instanceof d)return!0;let n=_("key",e).length,s=r.BYTES,o=s+1;if(!t.allowedPrivateKeyLengths&&i!==o)return n===o||n===2*s+1}let M=t.bits2int||function(e){if(e.length>8192)throw Error("input is too large");let t=w(e),r=8*e.length-s;return r>0?t>>BigInt(r):t},N=t.bits2int_modN||function(e){return h(M(e))},j=P(s);function L(e){return O("num < 2^"+s,e,eh,j),E(e,i)}let $={lowS:t.lowS,prehash:!1},F={lowS:t.lowS,prehash:!1};return d.BASE._setWindowSize(8),{CURVE:t,getPublicKey:function(e,t=!0){return d.fromPrivateKey(e).toRawBytes(t)},getSharedSecret:function(e,t,r=!0){if(!0===D(e))throw Error("first arg must be private key");if(!1===D(t))throw Error("second arg must be public key");
vendor: 6,176 bytes, line 252
252return d.fromHex(t).multiply(p(e)).toRawBytes(r)},sign:function(e,i,s=$){let{seed:o,k2sig:a}=function(e,i,s=$){if(["recovered","canonical"].some(e=>e in s))throw Error("sign() legacy options not supported");let{hash:o,randomBytes:a}=t,{lowS:l,prehash:c,extraEntropy:u}=s;null==l&&(l=!0),e=_("msgHash",e),ec(s),c&&(e=_("prehashed msgHash",o(e)));let f=N(e),g=p(i),y=[L(g),L(f)];if(null!=u&&!1!==u){let e=!0===u?a(r.BYTES):u;y.push(_("extraEntropy",e))}return{seed:A(...y),k2sig:function(e){let t=M(e);if(!m(t))return;let r=q(t,n),i=d.BASE.multiply(t).toAffine(),s=h(i.x);if(s===eh)return;let o=h(r*h(f+s*g));if(o===eh)return;let a=(i.x===s?0:2)|Number(i.y&ed),c=o;if(l&&o>n>>ed)c=o>n>>ed?h(-o):o,a^=1;return new T(s,c,a)}}}(e,i,s);return(function(e,t,r){if("number"!=typeof e||e<2)throw Error("hashLen must be a number");if("number"!=typeof t||t<2)throw Error("qByteLen must be a number");if("function"!=typeof r)throw Error("hmacFn must be a function");let n=C(e),i=C(e),s=0,o=()=>{n.fill(1),i.fill(0),s=0},a=(...e)=>r(i,n,...e),l=(e=C(0))=>{i=a(k([0]),e),n=a(),0!==e.length&&(i=a(k([1]),e),n=a())},c=()=>{if(s++>=1e3)throw Error("drbg: tried 1000 values");let e=0,r=[];for(;e<t;){let t=(n=a()).slice();r.push(t),e+=n.length}return A(...r)};return(e,t)=>{let r;for(o(),l(e);!(r=t(c()));)l();return o(),r}})(t.hash.outputLen,t.nByteLength,t.hmac)(o,a)},verify:function(e,r,i,s=F){let o,a;r=_("msgHash",r),i=_("publicKey",i);let{lowS:c,prehash:u,format:f}=s;if(ec(s),"strict"in s)throw Error("options.strict was renamed to lowS");if(void 0!==f&&"compact"!==f&&"der"!==f)throw Error("format must be compact or der");let p="string"==typeof e||l(e),g=!p&&!f&&"object"==typeof e&&null!==e&&"bigint"==typeof e.r&&"bigint"==typeof e.s;if(!p&&!g)throw Error("invalid signature, expected Uint8Array, hex string or Signature instance");try{if(g&&(a=new T(e.r,e.s)),p){try{"compact"!==f&&(a=T.fromDER(e))}catch(e){if(!(e instanceof ef.Err))throw e}a||"der"===f||(a=T.fromCompact(e))}o=d.fromHex(i)}catch(e){return!1}if(!a||c&&a.hasHighS())return!1;u&&(r=t.hash(r));let{r:y,s:m}=a,b=N(r),w=q(m,n),v=h(b*w),E=h(y*w),x=d.BASE.multiplyAndAddUnsafe(o,v,E)?.toAffine();return!!x&&h(x.x)===y},ProjectivePoint:d,Signature:T,utils:{isValidPrivateKey(e){try{return p(e),!0}catch(e){return!1}},normPrivateKeyToScalar:p,randomPrivateKey:()=>{let e=X(t.n);return function(e,t,r=!1){let n=e.length,i=Y(t),s=X(t);if(n<16||n<s||n>1024)throw Error("expected "+s+"-1024 bytes of input, got "+n);let o=z(r?v(e):w(e),t-U)+U;return r?x(o,i):E(o,i)}(t.randomBytes(e),t.n)},precompute:(e=8,t=d.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)}}})({...e,hash:t,hmac:(e,...r)=>(0,i.b)(t,e,(0,s.eV)(...r)),randomBytes:s.O6});return{...r(t),create:r}}({a:eb,b:BigInt(7),Fp:ex,n:em,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{let t=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-ew*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),n=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=BigInt("0x100000000000000000000000000000000"),s=eE(t*e,em),o=eE(-r*e,em),a=z(e-s*t-o*n,em),l=z(-s*r-o*t,em),c=a>i,u=l>i;if(c&&(a=em-a),u&&(l=em-l),a>i||l>i)throw Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:c,k1:a,k2neg:u,k2:l}}}},n.JQ)},34659:function(e,t,r){"use strict";r.d(t,{$p:function(){return f},EP:function(){return h},FL:function(){return u},Fn:function(){return b},IH:function(){return y},Iq:function(){return a},NI:function(){return o},Ou:function(){return c},SD:function(){return p},Vl:function(){return s},Xb:function(){return w},ac:function(){return m},gm:function(){return d},m_:function(){return l},mk:function(){return g},pp:function(){return x},u8:function(){return v},zP:function(){return E}});let n=BigInt(4294967296-1),i=BigInt(32);function s(e,t=!1){let r=e.length,s=new Uint32Array(r),o=new Uint32Array(r);for(let a=0;a<r;a++){let{h:r,l}=function(e,t=!1){return t?{h:Number(e&n),l:Number(e>>i&n)}:{h:0|Number(e>>i&n),l:0|Number(e&n)}}(e[a],t);[s[a],o[a]]=[r,l]}return[s,o]}let o=(e,t,r)=>e>>>r,a=(e,t,r)=>e<<32-r|t>>>r,l=(e,t,r)=>e>>>r|t<<32-r,c=(e,t,r)=>e<<32-r|t>>>r,u=(e,t,r)=>e<<64-r|t>>>r-32,f=(e,t,r)=>e>>>r-32|t<<64-r,h=(e,t,r)=>e<<r|t>>>32-r,d=(e,t,r)=>t<<r|e>>>32-r,p=(e,t,r)=>t<<r-32|e>>>64-r,g=(e,t,r)=>e<<r-32|t>>>64-r;function y(e,t,r,n){let i=(t>>>0)+(n>>>0);return{h:e+r+(i/4294967296|0)|0,l:0|i}}let m=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),b=(e,t,r,n)=>t+r+n+(e/4294967296|0)|0,w=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),v=(e,t,r,n,i)=>t+r+n+i+(e/4294967296|0)|0,E=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0),x=(e,t,r,n,i,s)=>t+r+n+i+s+(e/4294967296|0)|0},23115:function(e,t,r){"use strict";r.d(t,{b:function(){return s}});var n=r(79047);class i extends n.kb{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,(0,n.z3)(e);let r=(0,n.O0)(t);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let i=this.blockLen,s=new Uint8Array(i);s.set(r.length>i?e.create().update(r).digest():r);for(let e=0;e<s.length;e++)s[e]^=54;this.iHash.update(s),this.oHash=e.create();for(let e=0;e<s.length;e++)s[e]^=106;this.oHash.update(s),(0,n.ru)(s)}update(e){return(0,n.$h)(this),this.iHash.update(e),this}digestInto(e){(0,n.$h)(this),(0,n.gk)(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){let e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));let{oHash:t,iHash:r,finished:n,destroyed:i,blockLen:s,outputLen:o}=this;return e.finished=n,e.destroyed=i,e.blockLen=s,e.outputLen=o,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}let s=(e,t,r)=>new i(e,t).update(r).digest();s.create=(e,t)=>
vendor: 4,153 bytes, line 252
252new i(e,t)},65086:function(e,t,r){"use strict";r.d(t,{JQ:function(){return f}});var n=r(79047);class i extends n.kb{constructor(e,t,r,i){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=i,this.buffer=new Uint8Array(e),this.view=(0,n.GL)(this.buffer)}update(e){(0,n.$h)(this),e=(0,n.O0)(e),(0,n.gk)(e);let{view:t,buffer:r,blockLen:i}=this,s=e.length;for(let o=0;o<s;){let a=Math.min(i-this.pos,s-o);if(a===i){let t=(0,n.GL)(e);for(;i<=s-o;o+=i)this.process(t,o);continue}r.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===i&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){(0,n.$h)(this),(0,n.eB)(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:i,isLE:s}=this,{pos:o}=this;t[o++]=128,(0,n.ru)(this.buffer.subarray(o)),this.padOffset>i-o&&(this.process(r,0),o=0);for(let e=o;e<i;e++)t[e]=0;!function(e,t,r,n){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,n);let i=BigInt(32),s=BigInt(4294967295),o=Number(r>>i&s),a=Number(r&s),l=n?4:0,c=n?0:4;e.setUint32(t+l,o,n),e.setUint32(t+c,a,n)}(r,i-8,BigInt(8*this.length),s),this.process(r,0);let a=(0,n.GL)(e),l=this.outputLen;if(l%4)throw Error("_sha2: outputLen should be aligned to 32bit");let c=l/4,u=this.get();if(c>u.length)throw Error("_sha2: outputLen bigger than state");for(let e=0;e<c;e++)a.setUint32(4*e,u[e],s)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:r,length:n,finished:i,destroyed:s,pos:o}=this;return e.destroyed=s,e.finished=i,e.length=n,e.pos=o,n%t&&e.buffer.set(r),e}clone(){return this._cloneInto()}}let s=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);var o=r(34659);let a=Uint32Array.from([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]),l=new Uint32Array(64);class c extends i{constructor(e=32){super(64,e,8,!1),this.A=0|s[0],this.B=0|s[1],this.C=0|s[2],this.D=0|s[3],this.E=0|s[4],this.F=0|s[5],this.G=0|s[6],this.H=0|s[7]}get(){let{A:e,B:t,C:r,D:n,E:i,F:s,G:o,H:a}=this;return[e,t,r,n,i,s,o,a]}set(e,t,r,n,i,s,o,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|s,this.G=0|o,this.H=0|a}process(e,t){for(let r=0;r<16;r++,t+=4)l[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=l[e-15],r=l[e-2],i=(0,n.np)(t,7)^(0,n.np)(t,18)^t>>>3,s=(0,n.np)(r,17)^(0,n.np)(r,19)^r>>>10;l[e]=s+l[e-7]+i+l[e-16]|0}let{A:r,B:i,C:s,D:o,E:c,F:u,G:f,H:h}=this;for(let e=0;e<64;e++){var d,p,g,y;let t=h+((0,n.np)(c,6)^(0,n.np)(c,11)^(0,n.np)(c,25))+((d=c)&u^~d&f)+a[e]+l[e]|0,m=((0,n.np)(r,2)^(0,n.np)(r,13)^(0,n.np)(r,22))+((p=r)&(g=i)^p&(y=s)^g&y)|0;h=f,f=u,u=c,c=o+t|0,o=s,s=i,i=r,r=t+m|0}r=r+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,c=c+this.E|0,u=u+this.F|0,f=f+this.G|0,h=h+this.H|0,this.set(r,i,s,o,c,u,f,h)}roundClean(){(0,n.ru)(l)}destroy(){this.set(0,0,0,0,0,0,0,0),(0,n.ru)(this.buffer)}}let u=o.Vl(["0x428a2f98d728ae22","0x7137449123ef65cd","0xb5c0fbcfec4d3b2f","0xe9b5dba58189dbbc","0x3956c25bf348b538","0x59f111f1b605d019","0x923f82a4af194f9b","0xab1c5ed5da6d8118","0xd807aa98a3030242","0x12835b0145706fbe","0x243185be4ee4b28c","0x550c7dc3d5ffb4e2","0x72be5d74f27b896f","0x80deb1fe3b1696b1","0x9bdc06a725c71235","0xc19bf174cf692694","0xe49b69c19ef14ad2","0xefbe4786384f25e3","0x0fc19dc68b8cd5b5","0x240ca1cc77ac9c65","0x2de92c6f592b0275","0x4a7484aa6ea6e483","0
252x5cb0a9dcbd41fbd4","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)));u[0],u[1];let f=(0,n.V1)(()=>new c)},61694:function(e,t,r){"use strict";r.d(t,{fr:function(){return v}});var n=r(34659),i=r(79047);let s=BigInt(0),o=BigInt(1),a=BigInt(2),l=BigInt(7),c=BigInt(256),u=BigInt(113),f=[],h=[],d=[];for(let e=0,t=o,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],f.push(2*(5*n+r)),h.push((e+1)*(e+2)/2%64);let i=s;for(let e=0;e<7;e++)(t=(t<<o^(t>>l)*u)%c)&a&&(i^=o<<(o<<BigInt(e))-o);d.push(i)}let p=(0,n.Vl)(d,!0),g=p[0],y=p[1],m=(e,t,r)=>r>32?(0,n.SD)(e,t,r):(0,n.EP)(e,t,r),b=(e,t,r)=>r>32?(0,n.mk)(e,t,r):(0,n.gm)(e,t,r);class w extends i.kb{constructor(e,t,r,n=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=n,this.rounds=s,(0,i.k8)(r),!(0<e&&e<200))throw Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=(0,i.Jq)(this.state)}clone(){return this._cloneInto()}keccak(){(0,i.Ux)(this.state32),function(e,t=24){let 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){let n=(t+8)%10,i=(t+2)%10,s=r[i],o=r[i+1],a=m(s,o,1)^r[n],l=b(s,o,1)^r[n+1];for(let r=0;r<50;r+=10)e[t+r]^=a,e[t+r+1]^=l}let t=e[2],i=e[3];for(let r=0;r<24;r++){let n=h[r],s=m(t,i,n),o=b(t,i,n),a=f[r];t=e[a],i=e[a+1],e[a]=s,e[a+1]=o}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]^=g[n],e[1]^=y[n]}(0,i.ru)(r)}(this.state32,this.rounds),(0,i.Ux)(this.state32),this.posOut=0,this.pos=0}update(e){(0,i.$h)(this),e=(0,i.O0)(e),(0,i.gk)(e);let{blockLen:t,state:r}=this,n=e.length;for(let i=0;i<n;){let s=Math.min(t-this.pos,n-i);for(let t=0;t<s;t++)r[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:e,suffix:t,pos:r,blockLen:n}=this;e[r]^=t,(128&t)!=0&&r===n-1&&this.keccak(),e[n-1]^=128,this.keccak()}writeInto(e){(0,i.$h)(this,!1),(0,i.gk)(e),this.finish();let t=this.state,{blockLen:r}=this;for(let n=0,i=e.length;n<i;){this.posOut>=r&&this.keccak();let s=Math.min(r-this.posOut,i-n);e.set(t.subarray(this.posOut,this.posOut+s),n),this.posOut+=s,n+=s}return e}xofInto(e){if(!this.enableXOF)throw Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return(0,i.k8)(e),this.xofInto(new Uint8Array(e))}digestInto(e){if((0,i.eB)(e,this),this.finished)throw Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,(0,i.ru)(this.state)}_cloneInto(e){let{blockLen:t,suffix:r,outputLen:n,rounds:i,enableXOF:s}=this;return e||(e=new w(t,r,n,s,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=r,e.outputLen=n,e.enableXOF=s,e.destroyed=this.destroyed,e}}let v=(0,i.V1)(()=>new w(136,1,32))},79047:function(e,t,r){"use strict";r.d(t,{kb:function(){return y},gk:function(){return s},$h:function(){return a},z3:function(){return o},k8:function(){return i},eB:function(){return l},ru:function(){return u},eV:function(){return g},V1:function(){return m},GL:function(){return f},O6:function(){return b},np:function(){return h},Ux:function(){return d},O0:function(){return p},Jq:function(){return c}});let n="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;function i(e){if(!Number.isSafeInteger(e)||e<0)throw Error("positive integer expected, got "+e)}function s(e,...t){if(!(e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name))throw Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw Error("Uint8Array expected of length "+t+", got length="+e.length)}function o(e){if("function"!=typeof e||"function"!=typeof e.create)throw Error("Hash should be wrapped by utils.createHasher");i(e.outputLen),i(e.blockLen)}function a(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}function l(e,t){s(e);let r=t.outputLen;if(e.length<r)throw Error("digestInto() expects output buffer of length at least "+r)}function c(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function u(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function f(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function h(e,t){return e<<32-t|e>>>t}let d=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0]?e=>e:function(e){for(let r=0;r<e.length;r++){var t;e[r]=(t=e[r])<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}return e};function p(e){return"string"==typeof e&&(e=function(e){if("string"!=typeof e)throw Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}(e)),s(e),e}function g(...e){let t=0;for(let r=0;r<e.length;r++){let n=e[r];s(n),t+=n.length}let r=new Uint8Array(t);for(let t=0,n=0;t<e.length;t++){let i=e[t];r.set(i,n),n+=i.length}return r}class y{}function m(e){let t=t=>e().update(p(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function b(e=32){if(n&&"function"==typeof n.getRandomValues)return n.getRandomValues(new Uint8Array(e));if(n&&"function"==typeof n.randomBytes)return Uint8Array.from(n.randomBytes(e));throw Error("crypto.getRandomValues must be defined")}},42897:function(e,t,r){"use strict";r.d(t,{G:function(){return n}});
vendor: 5,765 bytes, line 252
252class n extends Error{constructor(e,t={}){let r=t.cause instanceof n?t.cause.details:t.cause?.message?t.cause.message:t.details,i=t.cause instanceof n&&t.cause.docsPath||t.docsPath;super([e||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...i?[`Docs: https://abitype.dev${i}`]:[],...r?[`Details: ${r}`]:[],"Version: [email protected]"].join("\n")),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiTypeError"}),t.cause&&(this.cause=t.cause),this.details=r,this.docsPath=i,this.metaMessages=t.metaMessages,this.shortMessage=e}}},76035:function(e,t,r){"use strict";r.d(t,{F:function(){return s},Hk:function(){return o},a_:function(){return i}});var n=r(42897);class i extends n.G{constructor({signature:e}){super("Failed to parse ABI item.",{details:`parseAbiItem(${JSON.stringify(e,null,2)})`,docsPath:"/api/human#parseabiitem-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiItemError"})}}class s extends n.G{constructor({type:e}){super("Unknown type.",{metaMessages:[`Type "${e}" is not a valid ABI type. Perhaps you forgot to include a struct signature?`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownTypeError"})}}class o extends n.G{constructor({type:e}){super("Unknown type.",{metaMessages:[`Type "${e}" is not a valid ABI type.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSolidityTypeError"})}}},11321:function(e,t,r){"use strict";r.d(t,{$r:function(){return i},TT:function(){return o},_D:function(){return l},aZ:function(){return c},jO:function(){return s},zL:function(){return a}});var n=r(42897);class i extends n.G{constructor({params:e}){super("Failed to parse ABI parameters.",{details:`parseAbiParameters(${JSON.stringify(e,null,2)})`,docsPath:"/api/human#parseabiparameters-1"}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiParametersError"})}}class s extends n.G{constructor({param:e}){super("Invalid ABI parameter.",{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParameterError"})}}class o extends n.G{constructor({param:e,name:t}){super("Invalid ABI parameter.",{details:e,metaMessages:[`"${t}" is a protected Solidity keyword. More info: https://docs.soliditylang.org/en/latest/cheatsheet.html`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SolidityProtectedKeywordError"})}}class a extends n.G{constructor({param:e,type:t,modifier:r}){super("Invalid ABI parameter.",{details:e,metaMessages:[`Modifier "${r}" not allowed${t?` in "${t}" type`:""}.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidModifierError"})}}class l extends n.G{constructor({param:e,type:t,modifier:r}){super("Invalid ABI parameter.",{details:e,metaMessages:[`Modifier "${r}" not allowed${t?` in "${t}" type`:""}.`,`Data location can only be specified for array, struct, or mapping types, but "${r}" was given.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidFunctionModifierError"})}}class c extends n.G{constructor({abiParameter:e}){super("Invalid ABI parameter.",{details:JSON.stringify(e,null,2),metaMessages:["ABI parameter type is invalid."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidAbiTypeParameterError"})}}},36640:function(e,t,r){"use strict";r.d(t,{H6:function(){return o},Vs:function(){return s},wn:function(){return i}});var n=r(42897);class i extends n.G{constructor({signature:e,type:t}){super(`Invalid ${t} signature.`,{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidSignatureError"})}}class s extends n.G{constructor({signature:e}){super("Unknown signature.",{details:e}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"UnknownSignatureError"})}}class o extends n.G{constructor({signature:e}){super("Invalid struct signature.",{details:e,metaMessages:["No properties exist."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidStructSignatureError"})}}},2434:function(e,t,r){"use strict";r.d(t,{t:function(){return i}});var n=r(60550);function i(e){return"function"===e.type?`function ${e.name}(${(0,n.P)(e.inputs)})${e.stateMutability&&"nonpayable"!==e.stateMutability?` ${e.stateMutability}`:""}${e.outputs?.length?` returns (${(0,n.P)(e.outputs)})`:""}`:"event"===e.type?`event ${e.name}(${(0,n.P)(e.inputs)})`:"error"===e.type?`error ${e.name}(${(0,n.P)(e.inputs)})`:"constructor"===e.type?`constructor(${(0,n.P)(e.inputs)})${"payable"===e.stateMutability?" payable":""}`:"fallback"===e.type?`fallback() external${"payable"===e.stateMutability?" payable":""}`:"receive() external payable"}},60550:function(e,t,r){"use strict";r.d(t,{P:function(){return s}});var n=r(91433);let i=/^tuple(?<array>(\[(\d*)\])*)$/;function s(e){let t="",r=e.length;for(let s=0;s<r;s++)t+=function e(t){let r=t.type;if(i.test(t.type)&&"components"in t){r="(";let s=t.components.length;for(let n=0;n<s;n++)r+=e(t.components[n]),n<s-1&&(r+=", ");let o=(0,n.Zw)(i,t.type);return r+=`)${o?.array||""}`,e({...t,type:r})}return("indexed"in t&&t.indexed&&(r=`${r}
252 indexed`),t.name)?`${r} ${t.name}`:r}(e[s]),s!==r-1&&(t+=", ");return t}},94390:function(e,t,r){"use strict";r.d(t,{Dt:function(){return I},EC:function(){return v},LY:function(){return A},N0:function(){return p},PI:function(){return b},QM:function(){return _},SA:function(){return o},Wg:function(){return S},_c:function(){return s},a4:function(){return m},c3:function(){return l},g1:function(){return g},l$:function(){return h},qm:function(){return E},rh:function(){return f},wA:function(){return c}});var n=r(91433);let i=/^error (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function s(e){return i.test(e)}function o(e){return(0,n.Zw)(i,e)}let a=/^event (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)$/;function l(e){return a.test(e)}function c(e){return(0,n.Zw)(a,e)}let u=/^function (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*)\((?<parameters>.*?)\)(?: (?<scope>external|public{1}))?(?: (?<stateMutability>pure|view|nonpayable|payable{1}))?(?: returns\s?\((?<returns>.*?)\))?$/;function f(e){return u.test(e)}function h(e){return(0,n.Zw)(u,e)}let d=/^struct (?<name>[a-zA-Z$_][a-zA-Z0-9$_]*) \{(?<properties>.*?)\}$/;function p(e){return d.test(e)}function g(e){return(0,n.Zw)(d,e)}let y=/^constructor\((?<parameters>.*?)\)(?:\s(?<stateMutability>payable{1}))?$/;function m(e){return y.test(e)}function b(e){return(0,n.Zw)(y,e)}let w=/^fallback\(\) external(?:\s(?<stateMutability>payable{1}))?$/;function v(e){return w.test(e)}function E(e){return(0,n.Zw)(w,e)}let x=/^receive\(\) external payable$/;function _(e){return x.test(e)}let A=new Set(["memory","indexed","storage","calldata"]),S=new Set(["indexed"]),I=new Set(["calldata","memory","storage"])},45744:function(e,t,r){"use strict";r.d(t,{D:function(){return f}});var n=r(91433),i=r(76035),s=r(11321),o=r(36640),a=r(42897);class l extends a.G{constructor({type:e}){super("Circular reference detected.",{metaMessages:[`Struct "${e}" is a circular reference.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"CircularReferenceError"})}}var c=r(94390),u=r(7924);function f(e){let t={},r=e.length;for(let n=0;n<r;n++){let r=e[n];if(!(0,c.N0)(r))continue;let i=(0,c.g1)(r);if(!i)throw new o.wn({signature:r,type:"struct"});let s=i.properties.split(";"),a=[],l=s.length;for(let e=0;e<l;e++){let t=s[e].trim();if(!t)continue;let r=(0,u.C$)(t,{type:"struct"});a.push(r)}if(!a.length)throw new o.H6({signature:r});t[i.name]=a}let a={},f=Object.entries(t),d=f.length;for(let e=0;e<d;e++){let[r,o]=f[e];a[r]=function e(t=[],r={},o=new Set){let a=[],c=t.length;for(let f=0;f<c;f++){let c=t[f];if(n.cN.test(c.type))a.push(c);else{let t=(0,n.Zw)(h,c.type);if(!t?.type)throw new s.aZ({abiParameter:c});let{array:f,type:d}=t;if(d in r){if(o.has(d))throw new l({type:d});a.push({...c,type:`tuple${f??""}`,components:e(r[d],r,new Set([...o,d]))})}else if((0,u.uN)(d))a.push(c);else throw new i.F({type:d})}}return a}(o,t)}return a}let h=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*)(?<array>(?:\[\d*?\])+?)?$/},7924:function(e,t,r){"use strict";r.d(t,{uN:function(){return m},C$:function(){return g},cK:function(){return f},Q4:function(){return y}});var n=r(91433),i=r(76035),s=r(11321),o=r(36640),a=r(42897);class l extends a.G{constructor({current:e,depth:t}){super("Unbalanced parentheses.",{metaMessages:[`"${e.trim()}" has too many ${t>0?"opening":"closing"} parentheses.`],details:`Depth "${t}"`}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"InvalidParenthesisError"})}}let c=new Map([["address",{type:"address"}],["bool",{type:"bool"}],["bytes",{type:"bytes"}],["bytes32",{type:"bytes32"}],["int",{type:"int256"}],["int256",{type:"int256"}],["string",{type:"string"}],["uint",{type:"uint256"}],["uint8",{type:"uint8"}],["uint16",{type:"uint16"}],["uint24",{type:"uint24"}],["uint32",{type:"uint32"}],["uint64",{type:"uint64"}],["uint96",{type:"uint96"}],["uint112",{type:"uint112"}],["uint160",{type:"uint160"}],["uint192",{type:"uint192"}],["uint256",{type:"uint256"}],["address owner",{type:"address",name:"owner"}],["address to",{type:"address",name:"to"}],["bool approved",{type:"bool",name:"approved"}],["bytes _data",{type:"bytes",name:"_data"}],["bytes data",{type:"bytes",name:"data"}],["bytes signature",{type:"bytes",name:"signature"}],["bytes32 hash",{type:"bytes32",name:"hash"}],["bytes32 r",{type:"bytes32",name:"r"}],["bytes32 root",{type:"bytes32",name:"root"}],["bytes32 s",{type:"bytes32",name:"s"}],["string name",{type:"string",name:"name"}],["string symbol",{type:"string",name:"symbol"}],["string tokenURI",{type:"string",name:"tokenURI"}],["uint tokenId",{type:"uint256",name:"tokenId"}],["uint8 v",{type:"uint8",name:"v"}],["uint256 balance",{type:"uint256",name:"balance"}],["uint256 tokenId",{type:"uint256",name:"tokenId"}],["uint256 value",{type:"uint256",name:"value"}],["event:address indexed from",{type:"address",name:"from",indexed:!0}],["event:address indexed to",{type:"address",name:"to",indexed:!0}],["event:uint indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}],["event:uint256 indexed tokenId",{type:"uint256",name:"tokenId",indexed:!0}]]);var u=r(94390);function f(e,t={}){if((0,u.rh)(e))return function(e,t={}){let r=(0,u.l$)(e);if(!r)throw new o.wn({signature:e,type:"function"});let n=y(r.parameters),i=[],s=n.length;for(let e=0;e<s;e++)i.push(g(n[e],{modifiers:u.Dt,structs:t,type:"function"}));let a=[];if(r.returns){let e=y(r.returns),n=e.length;for(let r=0;r<n;r++)a.push(g(e[r],{modifiers:u.Dt,structs:t,type:"function"}))}return{name:r.name,type:"function",stateMutability:r.stateMutability??"nonpayable",inputs:i,outputs:a}}(e,t);if((0,u.c3)(e))return function(e,t={}){let r=(0,u.wA)(e);if(!r)throw new o.wn({signature:e,type:"event"});let n=y(r.parameters),i=[],s=n.length;for(let e=0;e<s;e++)i.push(g(n[e],{modifiers:u.Wg,structs:t,type:"event"}));return{name:r.name,type:"event",inputs:i}}(e,t);if((0,u._c)(e))return function(e,t={}){let r=(0,u.SA)(e);if(!r)throw new o.wn({signature:e,type:"error"});let n=y(r.parameters),i=[],s=n.length;for(let e=0;e<s;e++)i.push(g(n[e],{structs:t,type:"error"}));return{name:r.name,type:"error",inputs:i}}(e,t);if((0,u.a4)(e))return function(e,t={}){let r=(0,u.PI)(e);if(!r)throw new o.wn({signature:e,type:"constructor"});let n=y(r.parameters),i=[],s=n.length;for(let e=0;e<s;e++)i.push(g(n[e],{structs:t,type:"constructor"}));return{type:"constructor",stateMutability:r.stateMutability??"nonpayable",inputs:i}}(e,t);if((0,u.EC)(e))return function(e){let t=(0,u.qm)(e);if(!t)throw new o.wn({signature:e,type:"fallback"});return{type:"fallback",stateMutability:t.stateMutability??"nonpayable"}}(e);if((0,u.QM)(e))return{type:"receive",stateMutability:"payable"};throw new o.Vs({signature:e})}let h=/^(?<type>[a-zA-Z$_][a-zA-Z0-9$_]*(?:\spayable)?)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,d=/^\((?<type>.+?)\)(?<array>(?:\[\d*?\])+?)?(?:\s(?<modifier>calldata|indexed|memory|storage{1}))?(?:\s(?<name>[a-zA-Z$_][a-zA-Z0-9$_]*))?$/,p=/^u?int$/;function g(e,t){var r,o;let a;let l=function(e,t,r){let n="";if(r)for(let e of Object.entries(r)){if(!e)continue;let t="";for(let r of e[1])t+=`[${r.type}${r.name?`:${r.name}`:""}]`;n+=`(${e[0]}{${t}})`}return t?`${t}:${e}${n}`:`${e}${n}`}(e,t?.type,t?.structs);if(c.has(l))return c.get(l);let f=n.cN.test(e),w=(0,n.Zw)(f?d:h,e);if(!w)throw new s.jO({param:e});if(w.name&&("address"===(r=w.name)||"bool"===r||"function"===r||"string"===r||"tuple"===r||n.eL.test(r)||n.lh.test(r)||b.test(r)))throw new s.TT({param:e,name:w.name});let v=w.name?{name:w.name}:{},E="indexed"===w.modifier?{indexed:!0}:{},x=t?.structs??{},_={};if(f){a="tuple";let e=y(w.type),t=[],r=e.length;for(let n=0;n<r;n++)t.push(g(e[n],{structs:x}));_={components:t}}else if(w.type in x)a="tuple",_={components:x[w.type]};else if(p.test(w.type))a=`${w.type}256`;else if("address payable"===w.type)a="address";else if(a=w.type,t?.type!=="struct"&&!m(a))throw new i.Hk({type:a});if(w.modifier){if(!t?.modifiers?.has?.(w.modifier))throw new s.zL({param:e,type:t?.type,modifier:w.modifier});if(u.Dt.has(w.modifier)&&(o=a,!w.array&&"bytes"!==o&&"string"!==o&&"tuple"!==o))throw new s._D({param:e,type:t?.type,modifier:w.modifier})}let A={type:`${a}${w.array??""}`,...v,...E,..._};return c.set(l,A),A}function y(e,t=[],r="",n=0){let i=e.trim().length;for(let s=0;s<i;s++){let i=e[s],o=e.slice(s+1);switch(i){case",":return 0===n?y(o,[...t,r.trim()]):y(o,t,`${r}${i}`,n);case"(":return y(o,t,`${r}${i}`,n+1);case")":return y(o,t,`${r}${i}`,n-1);default:return y(o,t,`${r}${i}`,n)}}if(""===r)return t;if(0!==n)throw new l({current:r,depth:n});return t.push(r.trim()),t}function m(e){return"address"===e||"bool"===e||"function"===e||"string"===e||n.eL.test(e)||n.lh.test(e)}let b=/^(?:after|alias|anonymous|apply|auto|byte|calldata|case|catch|constant|copyof|default|defined|error|event|external|false|final|function|immutable|implements|in|indexed|inline|internal|let|mapping|match|memory|mutable|null|of|override|partial|private|promise|public|pure|reference|relocatable|return|returns|sizeof|static|storage|struct|super|supports|switch|this|true|try|typedef|typeof|var|view|virtual)$/},91433:function(e,t,r){"use strict";function n(e,t){let r=e.exec(t);return r?.groups}r.d(t,{Zw:function(){return n},cN:function(){return o},eL:function(){return i},lh:function(){return s}});let i=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,s=/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,o=/^\(.+?\).*?$/},18415:function(e,t,r){"use strict";var n=r(22130);t.Z=n},78002:function(e,t,r){"use strict";r.d(t,{o:function(){return s}});var n=r(42790);function i(e){return{address:e.address,amount:n.xS(e.amount),index:n.xS(e.index),validatorIndex:n.xS(e.validatorIndex)}}function s(e){return{..."bigint"==typeof e.baseFeePerGas&&{baseFeePerGas:n.xS(e.baseFeePerGas)},..."bigint"==typeof e.blobBaseFee&&{blobBaseFee:n.xS(e.blobBaseFee)},..."string"==typeof e.feeRecipient&&{feeRecipient:e.feeRecipient}
vendor: 4,814 bytes, line 252
252,..."bigint"==typeof e.gasLimit&&{gasLimit:n.xS(e.gasLimit)},..."bigint"==typeof e.number&&{number:n.xS(e.number)},..."bigint"==typeof e.prevRandao&&{prevRandao:n.xS(e.prevRandao)},..."bigint"==typeof e.time&&{time:n.xS(e.time)},...e.withdrawals&&{withdrawals:e.withdrawals.map(i)}}}},82802:function(e,t,r){"use strict";r.d(t,{G:function(){return n}});class n extends Error{static setStaticOptions(e){n.prototype.docsOrigin=e.docsOrigin,n.prototype.showVersion=e.showVersion,n.prototype.version=e.version}constructor(e,t={}){let r=(()=>{if(t.cause instanceof n){if(t.cause.details)return t.cause.details;if(t.cause.shortMessage)return t.cause.shortMessage}return t.cause&&"details"in t.cause&&"string"==typeof t.cause.details?t.cause.details:t.cause?.message?t.cause.message:t.details})(),i=t.cause instanceof n&&t.cause.docsPath||t.docsPath,s=t.docsOrigin??n.prototype.docsOrigin,o=`${s}${i??""}`,a=!!(t.version??n.prototype.showVersion),l=t.version??n.prototype.version;super([e||"An error occurred.",...t.metaMessages?["",...t.metaMessages]:[],...r||i||a?["",r?`Details: ${r}`:void 0,i?`See: ${o}`:void 0,a?`Version: ${l}`:void 0]:[]].filter(e=>"string"==typeof e).join("\n"),t.cause?{cause:t.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsOrigin",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"showVersion",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.cause=t.cause,this.details=r,this.docs=o,this.docsOrigin=s,this.docsPath=i,this.shortMessage=e,this.showVersion=a,this.version=l}walk(e){return function e(t,r){return r?.(t)?t:t&&"object"==typeof t&&"cause"in t&&t.cause?e(t.cause,r):r?null:t}(this,e)}}Object.defineProperty(n,"defaultStaticOptions",{enumerable:!0,configurable:!0,writable:!0,value:{docsOrigin:"https://oxlib.sh",showVersion:!1,version:"[email protected]"}}),n.setStaticOptions(n.defaultStaticOptions)},42790:function(e,t,r){"use strict";r.d(t,{$s:function(){return I},Dp:function(){return c},Gh:function(){return b},Gu:function(){return v},He:function(){return w},J5:function(){return E},M6:function(){return A},O3:function(){return u},Q_:function(){return p},dp:function(){return m},eh:function(){return g},mL:function(){return d},mV:function(){return S},tP:function(){return y},xS:function(){return h},xv:function(){return f},zo:function(){return l}});var n=r(82802),i=r(7322),s=r(26372);let o=new TextEncoder,a=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function l(...e){return`0x${e.reduce((e,t)=>e+t.replace("0x",""),"")}`}function c(e){return e instanceof Uint8Array?f(e):Array.isArray(e)?f(new Uint8Array(e)):e}function u(e,t={}){let r=`0x${Number(e)}`;return"number"==typeof t.size?(i.Yf(r,t.size),p(r,t.size)):r}function f(e,t={}){let r="";for(let t=0;t<e.length;t++)r+=a[e[t]];let n=`0x${r}`;return"number"==typeof t.size?(i.Yf(n,t.size),g(n,t.size)):n}function h(e,t={}){let r;let{signed:n,size:i}=t,s=BigInt(e);i?r=n?(1n<<8n*BigInt(i)-1n)-1n:2n**(8n*BigInt(i))-1n:"number"==typeof e&&(r=BigInt(Number.MAX_SAFE_INTEGER));let o="bigint"==typeof r&&n?-r-1n:0;if(r&&s>r||s<o){let t="bigint"==typeof e?"n":"";throw new E({max:r?`${r}${t}`:void 0,min:`${o}${t}`,signed:n,size:i,value:`${e}${t}`})}let a=(n&&s<0?BigInt.asUintN(8*i,BigInt(s)):s).toString(16),l=`0x${a}`;return i?p(l,i):l}function d(e,t={}){return f(o.encode(e),t)}function p(e,t){return i.vk(e,{dir:"left",size:t})}function g(e,t){return i.vk(e,{dir:"right",size:t})}function y(e,t,r,n={}){let{strict:s}=n;i.EM(e,t);let o=`0x${e.replace("0x","").slice((t??0)*2,(r??e.length)*2)}`;return s&&i.Ro(o,t,r),o}function m(e){return Math.ceil((e.length-2)/2)}function b(e,t={}){let{signed:r}=t;t.size&&i.Yf(e,t.size);let n=BigInt(e);if(!r)return n;let s=(1n<<8n*BigInt((e.length-2)/2))-1n;return n<=s>>1n?n:n-s-1n}function w(e,t={}){let{signed:r,size:n}=t;return r||n?Number(b(e,t)):Number(e)}function v(e,t={}){let{strict:r=!1}=t;try{return!function(e,t={}){let{strict:r=!1}=t;if(!e||"string"!=typeof e)throw new x(e);if(r&&!/^0x[0-9a-fA-F]*$/.test(e)||!e.startsWith("0x"))throw new _(e)}(e,{strict:r}),!0}catch{return!1}}class E extends n.G{constructor({max:e,min:t,signed:r,size:n,value:i}
vendor: 4,485 bytes, line 252
252){super(`Number \`${i}\` is not in safe${n?` ${8*n}-bit`:""}${r?" signed":" unsigned"} integer range ${e?`(\`${t}\` to \`${e}\`)`:`(above \`${t}\`)`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.IntegerOutOfRangeError"})}}class x extends n.G{constructor(e){super(`Value \`${"object"==typeof e?s.Pz(e):e}\` of type \`${typeof e}\` is an invalid hex type.`,{metaMessages:['Hex types must be represented as `"0x${string}"`.']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexTypeError"})}}class _ extends n.G{constructor(e){super(`Value \`${e}\` is an invalid hex value.`,{metaMessages:['Hex values must start with `"0x"` and contain only hexadecimal characters (0-9, a-f, A-F).']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexValueError"})}}class A extends n.G{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed \`${t}\` bytes. Given size: \`${e}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeOverflowError"})}}class S extends n.G{constructor({offset:e,position:t,size:r}){super(`Slice ${"start"===t?"starting":"ending"} at offset \`${e}\` is out-of-bounds (size: \`${r}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SliceOffsetOutOfBoundsError"})}}class I extends n.G{constructor({size:e,targetSize:t,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${e}\`) exceeds padding size (\`${t}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeExceedsPaddingSizeError"})}}},26372:function(e,t,r){"use strict";function n(e,t,r){return JSON.stringify(e,(e,r)=>"function"==typeof t?t(e,r):"bigint"==typeof r?r.toString()+"#__bigint":r,r)}r.d(t,{Pz:function(){return n}})},7322:function(e,t,r){"use strict";r.d(t,{EM:function(){return s},Ro:function(){return o},Yf:function(){return i},vk:function(){return a}});var n=r(42790);function i(e,t){if(n.dp(e)>t)throw new n.M6({givenSize:n.dp(e),maxSize:t})}function s(e,t){if("number"==typeof t&&t>0&&t>n.dp(e)-1)throw new n.mV({offset:t,position:"start",size:n.dp(e)})}function o(e,t,r){if("number"==typeof t&&"number"==typeof r&&n.dp(e)!==r-t)throw new n.mV({offset:r,position:"end",size:n.dp(e)})}function a(e,t={}){let{dir:r,size:i=32}=t;if(0===i)return e;let s=e.replace("0x","");if(s.length>2*i)throw new n.$s({size:Math.ceil(s.length/2),targetSize:i,type:"Hex"});return`0x${s["right"===r?"padEnd":"padStart"](2*i,"0")}`}},67173:function(e,t,r){"use strict";function n(e){return"string"==typeof e?{address:e,type:"json-rpc"}:e}r.d(t,{T:function(){return n}})},96334:function(e,t,r){"use strict";r.d(t,{R:function(){return S}});var n=r(94390),i=r(45744),s=r(7924);function o(e){let t=(0,i.D)(e),r=[],o=e.length;for(let i=0;i<o;i++){let o=e[i];(0,n.N0)(o)||r.push((0,s.cK)(o,t))}return r}var a=r(78002),l=r(67173),c=r(27497),u=r(25974),f=r(64358),h=r(54732),d=r(25597),p=r(44056),g=r(1341),y=r(64257),m=r(24781),b=r(62851),w=r(46482),v=r(84835),E=r(10620),x=r(52387),_=r(28746),A=r(15318);async function S(e,t){let{account:n=e.account,authorizationList:i,batch:s=!!e.batch?.multicall,blockNumber:c,blockTag:p=e.experimental_blockTag??"latest",accessList:y,blobs:m,blockOverrides:x,code:S,data:P,factory:C,factoryData:k,gas:T,gasPrice:B,maxFeePerBlobGas:R,maxFeePerGas:D,maxPriorityFeePerGas:U,nonce:M,to:N,value:j,stateOverride:L,...$}=t,z=n?(0,l.T)(n):void 0;if(S&&(C||k))throw new f.G("Cannot provide both `code` & `factory`/`factoryData` as parameters.");if(S&&N)throw new f.G("Cannot provide both `code` & `to` as parameters.");let F=S&&P,q=C&&k&&N&&P,W=F||q,V=F?O({code:S,data:P}):q?function(e){let{data:t,factory:r,factoryData:n,to:i}=e;return(0,g.w)({abi:o(["constructor(address, bytes, address, bytes)"]),bytecode:u.pG,args:[i,t,r,n]})}({data:P,factory:C,factoryData:k,to:N}):P;try{(0,A.F)(t);let r=("bigint"==typeof c?(0,b.eC)(c):void 0)||p,n=x?a.o(x):void 0,o=(0,_.mF)(L),l=e.chain?.formatters?.transactionRequest?.format,u=(l||E.tG)({...(0,v.K)($,{format:l}),accessList:y,account:z,authorizationList:i,blobs:m,data:V,gas:T,gasPrice:B,maxFeePerBlobGas:R,maxFeePerGas:D,maxPriorityFeePerGas:U,nonce:M,to:W?void 0:N,value:j},"call");if(s&&function({request:e}){let{data:t,to:r,...n}=e;return!(!t||t.startsWith("0x82ad56cb"))&&!!r&&!(Object.values(n).filter(e=>void 0!==e).length>0)}({request:u}
252)&&!o&&!n)try{return await I(e,{...u,blockNumber:c,blockTag:p})}catch(e){if(!(e instanceof h.pZ)&&!(e instanceof h.mm))throw e}let f=(()=>{let e=[u,r];return o&&n?[...e,o,n]:o?[...e,o]:n?[...e,{},n]:e})(),d=await e.request({method:"eth_call",params:f});if("0x"===d)return{data:void 0};return{data:d}}catch(o){let n=function(e){if(!(e instanceof f.G))return;let t=e.walk();return"object"==typeof t?.data?t.data?.data:t.data}(o),{offchainLookup:i,offchainLookupSignature:s}=await r.e(8123).then(r.bind(r,88123));if(!1!==e.ccipRead&&n?.slice(0,10)===s&&N)return{data:await i(e,{data:n,to:N})};if(W&&n?.slice(0,10)==="0x101bb98d")throw new d.Mo({factory:C});throw(0,w.P)(o,{...t,account:z,chain:e.chain})}}async function I(e,t){let{batchSize:r=1024,deployless:n=!1,wait:i=0}="object"==typeof e.batch?.multicall?e.batch.multicall:{},{blockNumber:s,blockTag:o=e.experimental_blockTag??"latest",data:a,to:l}=t,f=(()=>{if(n)return null;if(t.multicallAddress)return t.multicallAddress;if(e.chain)return(0,m.L)({blockNumber:s,chain:e.chain,contract:"multicall3"});throw new h.pZ})(),g=("bigint"==typeof s?(0,b.eC)(s):void 0)||o,{schedule:w}=(0,x.S)({id:`${e.uid}.${g}`,wait:i,shouldSplitBatch:e=>e.reduce((e,{data:t})=>e+(t.length-2),0)>2*r,fn:async t=>{let r=t.map(e=>({allowFailure:!0,callData:e.data,target:e.to})),n=(0,y.R)({abi:c.F8,args:[r],functionName:"aggregate3"}),i=await e.request({method:"eth_call",params:[{...null===f?{data:O({code:u.xd,data:n})}:{to:f,data:n}},g]});return(0,p.k)({abi:c.F8,args:[r],functionName:"aggregate3",data:i||"0x"})}}),[{returnData:v,success:E}]=await w({data:a,to:l});if(!E)throw new d.VQ({data:v});return"0x"===v?{data:void 0}:{data:v}}function O(e){let{code:t,data:r}=e;return(0,g.w)({abi:o(["constructor(bytes, bytes)"]),bytecode:u.NO,args:[t,r]})}},58210:function(e,t,r){"use strict";r.d(t,{C:function(){return c},X:function(){return l}});var n=r(76161),i=r(33649),s=r(18767),o=r(7626),a=r(55093);async function l(e,t){return c(e,t)}async function c(e,t){let{block:r,chain:l=e.chain,request:c,type:u="eip1559"}=t||{},f=await (async()=>"function"==typeof l?.fees?.baseFeeMultiplier?l.fees.baseFeeMultiplier({block:r,client:e,request:c}):l?.fees?.baseFeeMultiplier??1.2)();if(f<1)throw new n.Fz;let h=10**(f.toString().split(".")[1]?.length??0),d=e=>e*BigInt(Math.ceil(f*h))/BigInt(h),p=r||await (0,i.s)(e,o.Q,"getBlock")({});if("function"==typeof l?.fees?.estimateFeesPerGas){let t=await l.fees.estimateFeesPerGas({block:r,client:e,multiply:d,request:c,type:u});if(null!==t)return t}if("eip1559"===u){if("bigint"!=typeof p.baseFeePerGas)throw new n.e5;let t="bigint"==typeof c?.maxPriorityFeePerGas?c.maxPriorityFeePerGas:await (0,s.h)(e,{block:p,chain:l,request:c}),r=d(p.baseFeePerGas);return{maxFeePerGas:c?.maxFeePerGas??r+t,maxPriorityFeePerGas:t}}return{gasPrice:c?.gasPrice??d(await (0,i.s)(e,a.o,"getGasPrice")({}))}}},70402:function(e,t,r){"use strict";r.d(t,{Q:function(){return b}});var n=r(67173),i=r(64358),s=r(87611),o=r(62851),a=r(78658),l=r(86001),c=r(7419);class u extends i.G{constructor(e,{account:t,docsPath:r,chain:n,data:i,gas:s,gasPrice:o,maxFeePerGas:u,maxPriorityFeePerGas:f,nonce:h,to:d,value:p}){super(e.shortMessage,{cause:e,docsPath:r,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Estimate Gas Arguments:",(0,c.xr)({from:t?.address,to:d,value:void 0!==p&&`${(0,a.d)(p)} ${n?.nativeCurrency?.symbol||"ETH"}`,data:i,gas:s,gasPrice:void 0!==o&&`${(0,l.o)(o)} gwei`,maxFeePerGas:void 0!==u&&`${(0,l.o)(u)} gwei`,maxPriorityFeePerGas:void 0!==f&&`${(0,l.o)(f)} gwei`,nonce:h})].filter(Boolean),name:"EstimateGasExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}var f=r(4656),h=r(33033),d=r(84835),p=r(10620),g=r(28746),y=r(15318),m=r(94143);async function b(e,t){let{account:r=e.account,prepare:a=!0}=t,l=r?(0,n.T)(r):void 0,c=Array.isArray(a)?a:l?.type!=="local"?["blobVersionedHashes"]:void 0;try{let r=await (async()=>t.to?t.to:t.authorizationList&&t.authorizationList.length>0?await (0,s.z)({authorization:t.authorizationList[0]}).catch(()=>{throw new i.G("`to` is required. Could not infer from `authorizationList`")}):void 0)(),{accessList:n,authorizationList:u,blobs:f,blobVersionedHashes:h,blockNumber:b,blockTag:w,data:v,gas:E,gasPrice:x,maxFeePerBlobGas:_,maxFeePerGas:A,maxPriorityFeePerGas:S,nonce:I,value:O,stateOverride:P,...C}=a?await (0,m.ZE)(e,{...t,parameters:c,to:r}):t;if(E&&t.gas!==E)return E;let k=("bigint"==typeof b?(0,o.eC)(b):void 0)||w,T=(0,g.mF)(P);(0,y.F)(t);let B=e.chain?.formatters?.transactionRequest?.format,R=(B||p.tG)({...(0,d.K)(C,{format:B}),account:l,accessList:n,authorizationList:u,blobs:f,blobVersionedHashes:h,data:v,gasPrice:x,maxFeePerBlobGas:_,maxFeePerGas:A,maxPriorityFeePerGas:S,nonce:I,to:r,value:O},"estimateGas");return BigInt(await e.request({method:"eth_estimateGas",params:T?[R,k??e.experimental_blockTag??"latest",T]:k?[R,k]:[R]}))}catch(r){throw function(e,{docsPath:t,...r}){return new u((()=>{let t=(0,h.k)(e,r);return t instanceof f.cj?e:t})(),{docsPath:t,...r})}(r,{...t,account:l,chain:e.chain})}}},18767:function(e,t,r){"use strict";r.d(t,{_:function(){return l},h:function(){return c}});var n=r(76161),i=r(60329),s=r(33649),o=r(7626),a=r(55093);async function l(e,t){return c(e,t)}async function c(e,t){let{block:r,chain:l=e.chain,request:c}=t||{};try{let t=l?.fees?.maxPriorityFeePerGas??l?.fees?.defaultPriorityFee;if("function"==typeof t){let n=r||await (0,s.s)(e,o.Q,"getBlock")({}),i=await t({block:n,client:e,request:c});if(null===i)throw Error();return i}if(void 0!==t)return t;let n=await e.request({method:"eth_maxPriorityFeePerGas"});return(0,i.y_)(n)}catch{let[t,i]=await Promise.all([r?Promise.resolve(r):(0,s.s)(e,o.Q,"getBlock")({}),(0,s.s)(e,a.o,"getGasPrice")({})]);if("bigint"!=typeof t.baseFeePerGas)throw new n.e5;let l=i-t.baseFeePerGas;if(l<0n)return 0n;return l}}},19057:function(e,t,r){"use strict";r.d(t,{b:function(){return d}});var n=r(67173),i=r(76161),s=r(94891),o=r(84835),a=r(74598),l=r(10620),c=r(33649),u=r(15318),f=r(7626),h=r(74809);async function d(e,t){let{account:r=e.account,accessList:d,authorizationList:p,chain:g=e.chain,blobVersionedHashes:y,blobs:m,data:b,gas:w,gasPrice:v,maxFeePerBlobGas:E,maxFeePerGas:x,maxPriorityFeePerGas:_,nonce:A,nonceManager:S,to:I,type:O,value:P,...C}=t,k=await (async()=>
252{if(!r||!S||void 0!==A)return A;let t=(0,n.T)(r),i=g?g.id:await (0,c.s)(e,h.L,"getChainId")({});return await S.consume({address:t.address,chainId:i,client:e})})();(0,u.F)(t);let T=g?.formatters?.transactionRequest?.format,B=(T||l.tG)({...(0,o.K)(C,{format:T}),account:r?(0,n.T)(r):void 0,accessList:d,authorizationList:p,blobs:m,blobVersionedHashes:y,data:b,gas:w,gasPrice:v,maxFeePerBlobGas:E,maxFeePerGas:x,maxPriorityFeePerGas:_,nonce:k,to:I,type:O,value:P},"fillTransaction");try{let r=await e.request({method:"eth_fillTransaction",params:[B]}),n=(g?.formatters?.transaction?.format||a.Tr)(r.tx);delete n.blockHash,delete n.blockNumber,delete n.r,delete n.s,delete n.transactionIndex,delete n.v,delete n.yParity,n.data=n.input,n.gas&&(n.gas=t.gas??n.gas),n.gasPrice&&(n.gasPrice=t.gasPrice??n.gasPrice),n.maxFeePerBlobGas&&(n.maxFeePerBlobGas=t.maxFeePerBlobGas??n.maxFeePerBlobGas),n.maxFeePerGas&&(n.maxFeePerGas=t.maxFeePerGas??n.maxFeePerGas),n.maxPriorityFeePerGas&&(n.maxPriorityFeePerGas=t.maxPriorityFeePerGas??n.maxPriorityFeePerGas),n.nonce&&(n.nonce=t.nonce??n.nonce);let s=await (async()=>{if("function"==typeof g?.fees?.baseFeeMultiplier){let r=await (0,c.s)(e,f.Q,"getBlock")({});return g.fees.baseFeeMultiplier({block:r,client:e,request:t})}return g?.fees?.baseFeeMultiplier??1.2})();if(s<1)throw new i.Fz;let o=s.toString().split(".")[1]?.length??0,l=10**o,u=e=>e*BigInt(Math.ceil(s*l))/BigInt(l);return n.maxFeePerGas&&!t.maxFeePerGas&&(n.maxFeePerGas=u(n.maxFeePerGas)),n.gasPrice&&!t.gasPrice&&(n.gasPrice=u(n.gasPrice)),{raw:r.raw,transaction:{from:B.from,...n}}}catch(r){throw(0,s.$)(r,{...t,chain:e.chain})}}},7626:function(e,t,r){"use strict";r.d(t,{Q:function(){return o}});var n=r(42043),i=r(62851),s=r(70181);async function o(e,{blockHash:t,blockNumber:r,blockTag:o=e.experimental_blockTag??"latest",includeTransactions:a}={}){let l=a??!1,c=void 0!==r?(0,i.eC)(r):void 0,u=null;if(!(u=t?await e.request({method:"eth_getBlockByHash",params:[t,l]},{dedupe:!0}):await e.request({method:"eth_getBlockByNumber",params:[c||o,l]},{dedupe:!!c})))throw new n.f({blockHash:t,blockNumber:r});return(e.chain?.formatters?.block?.format||s.Z)(u,"getBlock")}},49565:function(e,t,r){"use strict";r.d(t,{z:function(){return a}});let n=new Map,i=new Map;async function s(e,{cacheKey:t,cacheTime:r=Number.POSITIVE_INFINITY}){let s=function(e){let t=(e,t)=>({clear:()=>t.delete(e),get:()=>t.get(e),set:r=>t.set(e,r)}),r=t(e,n),s=t(e,i);return{clear:()=>{r.clear(),s.clear()},promise:r,response:s}}(t),o=s.response.get();if(o&&r>0&&Date.now()-o.created.getTime()<r)return o.data;let a=s.promise.get();a||(a=e(),s.promise.set(a));try{let e=await a;return s.response.set({created:new Date,data:e}),e}finally{s.promise.clear()}}let o=e=>`blockNumber.${e}`;async function a(e,{cacheTime:t=e.cacheTime}={}){return BigInt(await s(()=>e.request({method:"eth_blockNumber"}),{cacheKey:o(e.uid),cacheTime:t}))}},74809:function(e,t,r){"use strict";r.d(t,{L:function(){return i}});var n=r(60329);async function i(e){let t=await e.request({method:"eth_chainId"},{dedupe:!0});return(0,n.ly)(t)}},55093:function(e,t,r){"use strict";async function n(e){return BigInt(await e.request({method:"eth_gasPrice"}))}r.d(t,{o:function(){return n}})},68100:function(e,t,r){"use strict";r.d(t,{f:function(){return o}});var n=r(7419),i=r(62851),s=r(74598);async function o(e,{blockHash:t,blockNumber:r,blockTag:o,hash:a,index:l,sender:c,nonce:u}){let f=o||"latest",h=void 0!==r?(0,i.eC)(r):void 0,d=null;if(a?d=await e.request({method:"eth_getTransactionByHash",params:[a]},{dedupe:!0}):t?d=await e.request({method:"eth_getTransactionByBlockHashAndIndex",params:[t,(0,i.eC)(l)]},{dedupe:!0}):(h||f)&&"number"==typeof l?d=await e.request({method:"eth_getTransactionByBlockNumberAndIndex",params:[h||f,(0,i.eC)(l)]},{dedupe:!!h}):c&&"number"==typeof u&&(d=await e.request({method:"eth_getTransactionBySenderAndNonce",params:[c,(0,i.eC)(u)]},{dedupe:!0})),!d)throw new n.Bh({blockHash:t,blockNumber:r,blockTag:f,hash:a,index:l});return(e.chain?.formatters?.transaction?.format||s.Tr)(d,"getTransaction")}},93565:function(e,t,r){"use strict";r.d(t,{K:function(){return s}});var n=r(60329),i=r(62851);async function s(e,{address:t,blockTag:r="latest",blockNumber:s}){let o=await e.request({method:"eth_getTransactionCount",params:[t,"bigint"==typeof s?(0,i.eC)(s):r]},{dedupe:!!s});return(0,n.ly)(o)}},87114:function(e,t,r){"use strict";r.d(t,{a:function(){return s}});var n=r(7419),i=r(64603);async function s(e,{hash:t}){let r=await e.request({method:"eth_getTransactionReceipt",params:[t]},{dedupe:!0});if(!r)throw new n.Yb({hash:t});return(e.chain?.formatters?.transactionReceipt?.format||i.fA)(r,"getTransactionReceipt")}},29612:function(e,t,r){"use strict";r.d(t,{e:function(){return p}});var n=r(42043),i=r(7419),s=r(33649),o=r(16550),a=r(49762),l=r(73318),c=r(70153),u=r(7626),f=r(68100),h=r(87114),d=r(73180);async function p(e,t){let r,p,g,y,m;let{checkReplacement:b=!0,confirmations:w=1,hash:v,onReplaced:E,retryCount:x=6,retryDelay:_=({count:e})=>200*~~(1<<e),timeout:A=18e4}=t,S=(0,c.P)(["waitForTransactionReceipt",e.uid,v]),I=t.pollingInterval?t.pollingInterval:e.chain?.experimental_preconfirmationTime?e.chain.experimental_preconfirmationTime:e.pollingInterval,O=!1,{promise:P,resolve:C,reject:k}=(0,a.n)(),T=A?setTimeout(()=>{m?.(),y?.(),k(new i.mc({hash:v}))},A):void 0;return y=(0,o.N7)(S,{onReplaced:E,resolve:C,reject:k},async t=>{if((g=await (0,s.s)(e,h.a,"getTransactionReceipt")({hash:v}).catch(()=>void 0))&&w<=1){clearTimeout(T),t.resolve(g),y?.();return}m=(0,s.s)(e,d.q,"watchBlockNumber")({emitMissed:!0,emitOnBegin:!0,poll:!0,pollingInterval:I,async onBlockNumber(o){let a=e=>{clearTimeout(T),m?.(),e(),y?.()},c=o;if(!O)try{if(g){if(w>1&&(!g.blockNumber||c-g.blockNumber+1n<w))return;a(()=>t.resolve(g));return}if(b&&!r&&(O=!0,await (0,l.J)(async()=>{(r=await (0,s.s)(e,f.f,"getTransaction")({hash:v})).blockNumber&&(c=r.blockNumber)},{delay:_,retryCount:x}),O=!1),g=await (0,s.s)(e,h.a,"getTransactionReceipt")({hash:v}),w>1&&(!g.blockNumber||c-g.blockNumber+1n<w))return;a(()=>t.resolve(g))}catch(o){if(o instanceof i.Bh||o instanceof i.Yb){if(!r){O=!1;return}try{p=r,O=!0;let i=await (0,l.J)(()=>(0,s.s)(e,u.Q,"getBlock")({blockNumber:c,includeTransactions:!0}),{delay:_,retryCount:x,shouldRetry:({error:e})=>e instanceof n.f});O=!1;let o=i.transactions.find(({from:e,nonce:t})=>e===p.from&&t===p.nonce);if(!o||(g=await (0,s.s)(e,h.a,"getTransactionReceipt")({hash:o.hash}),w>1&&(!g.blockNumber||c-g.blockNumber+1n<w)))return;let f="replaced";o.to===p.to&&o.value===p.value&&o.input===p.input?f="repriced":o.from===o.to&&0n===o.value&&(f="cancelled"),a(()=>{t.onReplaced?.({reason:f,replacedTransaction:p,transaction:o,transactionReceipt:g}),t.resolve(g)})}catch(e){a(()=>t.reject(e))}}else a(()=>t.reject(o))}}})}),P}},73180:function(e,t,r){"use strict";r.d(t,{q:function(){return c}});var n=r(60329),i=r(33649),s=r(16550),o=r(88778),a=r(70153),l=r(49565);function c(e,{emitOnBegin:t=!1,emitMissed:r=!1,onBlockNumber:c,onError:u,poll:f,pollingInterval:h=e.pollingInterval}){let d;return(void 0!==f?f:"webSocket"!==e.transport.type&&"ipc"!==e.transport.type&&("fallback"!==e.transport.type||"webSocket"!==e.transport.transports[0].c
252onfig.type&&"ipc"!==e.transport.transports[0].config.type))?(()=>{let n=(0,a.P)(["watchBlockNumber",e.uid,t,r,h]);return(0,s.N7)(n,{onBlockNumber:c,onError:u},n=>(0,o.$)(async()=>{try{let t=await (0,i.s)(e,l.z,"getBlockNumber")({cacheTime:0});if(void 0!==d){if(t===d)return;if(t-d>1&&r)for(let e=d+1n;e<t;e++)n.onBlockNumber(e,d),d=e}(void 0===d||t>d)&&(n.onBlockNumber(t,d),d=t)}catch(e){n.onError?.(e)}},{emitOnBegin:t,interval:h}))})():(()=>{let i=(0,a.P)(["watchBlockNumber",e.uid,t,r]);return(0,s.N7)(i,{onBlockNumber:c,onError:u},t=>{let r=!0,i=()=>r=!1;return(async()=>{try{let s=(()=>{if("fallback"===e.transport.type){let t=e.transport.transports.find(e=>"webSocket"===e.config.type||"ipc"===e.config.type);return t?t.value:e.transport}return e.transport})(),{unsubscribe:o}=await s.subscribe({params:["newHeads"],onData(e){if(!r)return;let i=(0,n.y_)(e.result?.number);t.onBlockNumber(i,d),d=i},onError(e){t.onError?.(e)}});i=o,r||i()}catch(e){u?.(e)}})(),()=>i()})})()}},94143:function(e,t,r){"use strict";r.d(t,{QZ:function(){return I},ZE:function(){return C}});var n=r(67173),i=r(58210),s=r(70402),o=r(7626),a=r(93565),l=r(76161),c=r(87778),u=r(62851);function f(e){let{kzg:t}=e,r=e.to??("string"==typeof e.blobs[0]?"hex":"bytes"),n="string"==typeof e.blobs[0]?e.blobs.map(e=>(0,c.nr)(e)):e.blobs,i=[];for(let e of n)i.push(Uint8Array.from(t.blobToKzgCommitment(e)));return"bytes"===r?i:i.map(e=>(0,u.ci)(e))}function h(e){let{kzg:t}=e,r=e.to??("string"==typeof e.blobs[0]?"hex":"bytes"),n="string"==typeof e.blobs[0]?e.blobs.map(e=>(0,c.nr)(e)):e.blobs,i="string"==typeof e.commitments[0]?e.commitments.map(e=>(0,c.nr)(e)):e.commitments,s=[];for(let e=0;e<n.length;e++){let r=n[e],o=i[e];s.push(Uint8Array.from(t.computeBlobKzgProof(r,o)))}return"bytes"===r?s:s.map(e=>(0,u.ci)(e))}let d=r(65086).JQ;var p=r(15919),g=r(64358);class y extends g.G{constructor({maxSize:e,size:t}){super("Blob size is too large.",{metaMessages:[`Max: ${e} bytes`,`Given: ${t} bytes`],name:"BlobSizeTooLargeError"})}}class m extends g.G{constructor(){super("Blob data must not be empty.",{name:"EmptyBlobError"})}}var b=r(55261),w=r(84644),v=r(33649),E=r(91544),x=r(15318),_=r(7419),A=r(19057),S=r(74809);let I=["blobVersionedHashes","chainId","fees","gas","nonce","type"],O=new Map,P=new E.k(128);async function C(e,t){let r,g,E=t;E.account??=e.account,E.parameters??=I;let{account:C,chain:k=e.chain,nonceManager:T,parameters:B}=E,R="function"==typeof k?.prepareTransactionRequest?{fn:k.prepareTransactionRequest,runAt:["beforeFillTransaction"]}:Array.isArray(k?.prepareTransactionRequest)?{fn:k.prepareTransactionRequest[0],runAt:k.prepareTransactionRequest[1].runAt}:void 0;async function D(){return r||(void 0!==E.chainId?E.chainId:k?k.id:r=await (0,v.s)(e,S.L,"getChainId")({}))}let U=C?(0,n.T)(C):C,M=E.nonce;if(B.includes("nonce")&&void 0===M&&U&&T){let t=await D();M=await T.consume({address:U.address,chainId:t,client:e})}R?.fn&&R.runAt?.includes("beforeFillTransaction")&&(E=await R.fn({...E,chain:k},{phase:"beforeFillTransaction"}),M??=E.nonce);let N=(!(B.includes("blobVersionedHashes")||B.includes("sidecars"))||!E.kzg||!E.blobs)&&!1!==P.get(e.uid)&&["fees","gas"].some(e=>B.includes(e))&&(B.includes("chainId")&&"number"!=typeof E.chainId||B.includes("nonce")&&"number"!=typeof M||B.includes("fees")&&"bigint"!=typeof E.gasPrice&&("bigint"!=typeof E.maxFeePerGas||"bigint"!=typeof E.maxPriorityFeePerGas)||B.includes("gas")&&"bigint"!=typeof E.gas)?await (0,v.s)(e,A.b,"fillTransaction")({...E,nonce:M}).then(t=>{let{chainId:r,from:n,gas:i,gasPrice:s,nonce:o,maxFeePerBlobGas:a,maxFeePerGas:l,maxPriorityFeePerGas:c,type:u,...f}=t.transaction;return P.set(e.uid,!0),{...E,...n?{from:n}:{},...u&&!E.type?{type:u}:{},...void 0!==r?{chainId:r}:{},...void 0!==i?{gas:i}:{},...void 0!==s?{gasPrice:s}:{},...void 0!==o?{nonce:o}:{},...void 0!==a&&"legacy"!==E.type&&"eip2930"!==E.type?{maxFeePerBlobGas:a}:{},...void 0!==l&&"legacy"!==E.type&&"eip2930"!==E.type?{maxFeePerGas:l}:{},...void 0!==c&&"legacy"!==E.type&&"eip2930"!==E.type?{maxPriorityFeePerGas:c}:{},..."nonceKey"in f&&void 0!==f.nonceKey?{nonceKey:f.nonceKey}:{},..."keyAuthorization"in f&&void 0!==f.keyAuthorization&&null!==f.keyAuthorization&&!("keyAuthorization"in E)?{keyAuthorization:f.keyAuthorization}:{},..."feePayerSignature"in f&&void 0!==f.feePayerSignature&&null!==f.feePayerSignature?{feePayerSignature:f.feePayerSignature}:{}}}).catch(t=>{if("TransactionExecutionError"!==t.name)return E;if(t.walk?.(e=>"ExecutionRevertedError"===e.name))throw t;return t.walk?.(e=>"MethodNotFoundRpcError"===e.name||"MethodNotSupportedRpcError"===e.name||e.message?.includes("eth_fillTransaction is not available"))&&P.set(e.uid,!1),E}):E;M??=N.nonce;let{blobs:j,gas:L,kzg:$,type:z}=E={...N,...U?{from:U?.address}:{},...M?{nonce:M}:{}};async function F(){return g||(g=await (0,v.s)(e,o.Q,"getBlock")({blockTag:"latest"}))}if(R?.fn&&R.runAt?.includes("beforeFillParameters")&&(E=await R.fn({...E,chain:k},{phase:"beforeFillParameters"})),B.includes("nonce")&&void 0===M&&U&&!T&&(E.nonce=await (0,v.s)(e,a.K,"getTransactionCount")({address:U.address,blockTag:"pending"})),(B.includes("blobVersionedHashes")||B.includes("sidecars"))&&j&&$){let e=f({blobs:j,kzg:$});
252if(B.includes("blobVersionedHashes")){let t=function(e){let{commitments:t,version:r}=e,n=e.to??("string"==typeof t[0]?"hex":"bytes"),i=[];for(let e of t)i.push(function(e){let{commitment:t,version:r=1}=e,n=e.to??("string"==typeof t?"hex":"bytes"),i=function(e,t){let r=d((0,p.v)(e,{strict:!1})?(0,c.O0)(e):e);return"bytes"===(t||"hex")?r:(0,u.NC)(r)}(t,"bytes");return i.set([r],0),"bytes"===n?i:(0,u.ci)(i)}({commitment:e,to:n,version:r}));return i}({commitments:e,to:"hex"});E.blobVersionedHashes=t}if(B.includes("sidecars")){let t=h({blobs:j,commitments:e,kzg:$}),r=function(e){let{data:t,kzg:r,to:n}=e,i=e.blobs??function(e){let t=e.to??("string"==typeof e.data?"hex":"bytes"),r="string"==typeof e.data?(0,c.nr)(e.data):e.data,n=(0,w.d)(r);if(!n)throw new m;if(n>761855)throw new y({maxSize:761855,size:n});let i=[],s=!0,o=0;for(;s;){let e=(0,b.q)(new Uint8Array(131072)),t=0;for(;t<4096;){let n=r.slice(o,o+31);if(e.pushByte(0),e.pushBytes(n),n.length<31){e.pushByte(128),s=!1;break}t++,o+=31}i.push(e)}return"bytes"===t?i.map(e=>e.bytes):i.map(e=>(0,u.ci)(e.bytes))}({data:t,to:n}),s=e.commitments??f({blobs:i,kzg:r,to:n}),o=e.proofs??h({blobs:i,commitments:s,kzg:r,to:n}),a=[];for(let e=0;e<i.length;e++)a.push({blob:i[e],commitment:s[e],proof:o[e]});return a}({blobs:j,commitments:e,proofs:t,to:"hex"});E.sidecars=r}}if(B.includes("chainId")&&(E.chainId=await D()),(B.includes("fees")||B.includes("type"))&&void 0===z)try{E.type=function(e){if(e.type)return e.type;if(void 0!==e.authorizationList)return"eip7702";if(void 0!==e.blobs||void 0!==e.blobVersionedHashes||void 0!==e.maxFeePerBlobGas||void 0!==e.sidecars)return"eip4844";if(void 0!==e.maxFeePerGas||void 0!==e.maxPriorityFeePerGas)return"eip1559";if(void 0!==e.gasPrice)return void 0!==e.accessList?"eip2930":"legacy";throw new _.j3({transaction:e})}(E)}catch{let t=O.get(e.uid);if(void 0===t){let r=await F();t="bigint"==typeof r?.baseFeePerGas,O.set(e.uid,t)}E.type=t?"eip1559":"legacy"}if(B.includes("fees")){if("legacy"!==E.type&&"eip2930"!==E.type){if(void 0===E.maxFeePerGas||void 0===E.maxPriorityFeePerGas){let t=await F(),{maxFeePerGas:r,maxPriorityFeePerGas:n}=await (0,i.C)(e,{block:t,chain:k,request:E});if(void 0===E.maxPriorityFeePerGas&&E.maxFeePerGas&&E.maxFeePerGas<n)throw new l.ld({maxPriorityFeePerGas:n});E.maxPriorityFeePerGas=n,E.maxFeePerGas=r}}else{if(void 0!==E.maxFeePerGas||void 0!==E.maxPriorityFeePerGas)throw new l.e5;if(void 0===E.gasPrice){let t=await F(),{gasPrice:r}=await (0,i.C)(e,{block:t,chain:k,request:E,type:"legacy"});E.gasPrice=r}}}return B.includes("gas")&&void 0===L&&(E.gas=await (0,v.s)(e,s.Q,"estimateGas")({...E,account:U,prepare:U?.type==="local"?[]:["blobVersionedHashes"]})),R?.fn&&R.runAt?.includes("afterFillParameters")&&(E=await R.fn({...E,chain:k},{phase:"afterFillParameters"})),(0,x.F)(E),delete E.parameters,E}},77527:function(e,t,r){"use strict";async function n(e,{serializedTransaction:t}){return e.request({method:"eth_sendRawTransaction",params:[t]},{retryCount:0})}r.d(t,{p:function(){return n}})},34944:function(e,t,r){"use strict";r.d(t,{s:function(){return s}});var n=r(7419),i=r(64603);async function s(e,{serializedTransaction:t,throwOnReceiptRevert:r,timeout:s}){let o=await e.request({method:"eth_sendRawTransactionSync",params:s?[t,s]:[t]},{retryCount:0}),a=(e.chain?.formatters?.transactionReceipt?.format||i.fA)(o);if("reverted"===a.status&&r)throw new n.A3({receipt:a});return a}},9710:function(e,t,r){"use strict";r.d(t,{e:function(){return s}});var n=r(67173),i=r(69404);function s(e){let{batch:t,chain:r,ccipRead:s,dataSuffix:o,key:a="base",name:l="Base Client",type:c="base"}=e,u=e.experimental_blockTag??("number"==typeof r?.experimental_preconfirmationTime?"pending":void 0),f=r?.blockTime??12e3,h=e.pollingInterval??Math.min(Math.max(Math.floor(f/2),500),4e3),d=e.cacheTime??h,p=e.account?(0,n.T)(e.account):void 0,{config:g,request:y,value:m}=e.transport({account:p,chain:r,pollingInterval:h}),b={account:p,batch:t,cacheTime:d,ccipRead:s,chain:r,dataSuffix:o,key:a,name:l,pollingInterval:h,request:y,transport:{...g,...m},type:c,uid:(0,i.h)(),...u?{experimental_blockTag:u}:{}};return Object.assign(b,{extend:function e(t){return r=>{let n=r(t);for(let e in b)delete n[e];let i={...t,...n};return Object.assign(i,{extend:e(i)})}}(b)})}},72077:function(e,t,r){"use strict";r.d(t,{v:function(){return s}});var n=r(9710),i=r(71574);function s(e){let{key:t="public",name:r="Public Client"}=e;return(0,n.e)({...e,key:t,name:r,type:"publicClient"}).extend(i.I)}},71574:function(e,t,r){"use strict";r.d(t,{I:function(){return rq}});var n=r(27497),i=r(44056),s=r(64257),o=r(24781),a=r(56580),l=r(62851),c=r(64358),u=r(25597);function f(e){if(!(e instanceof c.G))return!1;let t=e.walk(e=>e instanceof u.Lu);return t instanceof u.Lu&&(t.data?.errorName==="HttpError"||t.data?.errorName==="ResolverError"||t.data?.errorName==="ResolverNotContract"||t.data?.errorName==="ResolverNotFound"||t.data?.errorName==="ReverseAddressMismatch"||t.data?.errorName==="UnsupportedResolverProfile")}var h=r(29199),d=r(34174),p=r(87778),g=r(83351),y=r(15919);function m(e){if(66!==e.length||0!==e.indexOf("[")||65!==e.indexOf("]"))return null;let t=`0x${e.slice(1,65)}`;return(0,y.v)(t)?t:null}function b(e){let t=new Uint8Array(32).fill(0);if(!e)return(0,l.ci)(t);let r=e.split(".");for(let e=r.length-1;e>=0;e-=1){let n=m(r[e]),i=n?(0,p.O0)(n):(0,g.w)((0,p.qX)(r[e]),"bytes");t=(0,g.w)((0,d.zo)([t,i]),"bytes")}return(0,l.ci)(t)}function w(e){let t=e.replace(/^\.|\.$/gm,"");if(0===t.length)return new Uint8Array(1);let r=new Uint8Array((0,p.qX)(t).byteLength+2),n=0,i=t.split(".");for(let e=0;e<i.length;e++){let t=(0,p.qX)(i[e]);if(t.byteLength>255){var s;
vendor: 4,547 bytes, line 252
252t=(0,p.qX)((s=function(e){let t=new Uint8Array(32).fill(0);return e?m(e)||(0,g.w)((0,p.qX)(e)):(0,l.ci)(t)}(i[e]),`[${s.slice(2)}]`))}r[n]=t.length,r.set(t,n+1),n+=t.length+1}return r.byteLength!==n+1?r.slice(0,n+1):r}var v=r(33649),E=r(23273),x=r(96334);async function _(e,t){let{abi:r,address:n,args:o,functionName:a,...l}=t,c=(0,s.R)({abi:r,args:o,functionName:a});try{let{data:t}=await (0,v.s)(e,x.R,"call")({...l,data:c,to:n});return(0,i.k)({abi:r,args:o,functionName:a,data:t||"0x"})}catch(e){throw(0,E.S)(e,{abi:r,address:n,args:o,docsPath:"/docs/contract/readContract",functionName:a})}}async function A(e,t){let{blockNumber:r,blockTag:c,coinType:u,name:d,gatewayUrls:p,strict:g}=t,{chain:y}=e,m=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!y)throw Error("client chain not configured. universalResolverAddress is required.");return(0,o.L)({blockNumber:r,chain:y,contract:"ensUniversalResolver"})})(),E=y?.ensTlds;if(E&&!E.some(e=>d.endsWith(e)))return null;let x=null!=u?[b(d),BigInt(u)]:[b(d)];try{let t=(0,s.R)({abi:n.X$,functionName:"addr",args:x}),o={address:m,abi:n.k3,functionName:"resolveWithGateways",args:[(0,l.NC)(w(d)),t,p??[h.M]],blockNumber:r,blockTag:c},u=(0,v.s)(e,_,"readContract"),f=await u(o);if("0x"===f[0])return null;let g=(0,i.k)({abi:n.X$,args:x,functionName:"addr",data:f[0]});if("0x"===g||"0x00"===(0,a.f)(g))return null;return g}catch(e){if(g)throw e;if(f(e))return null;throw e}}class S extends c.G{constructor({data:e}){super("Unable to extract image from metadata. The metadata may be malformed or invalid.",{metaMessages:["- Metadata must be a JSON object with at least an `image`, `image_url` or `image_data` property.","",`Provided data: ${JSON.stringify(e)}`],name:"EnsAvatarInvalidMetadataError"})}}class I extends c.G{constructor({reason:e}){super(`ENS NFT avatar URI is invalid. ${e}`,{name:"EnsAvatarInvalidNftUriError"})}}class O extends c.G{constructor({uri:e}){super(`Unable to resolve ENS avatar URI "${e}". The URI may be malformed, invalid, or does not respond with a valid image.`,{name:"EnsAvatarUriResolutionError"})}}class P extends c.G{constructor({namespace:e}){super(`ENS NFT avatar namespace "${e}" is not supported. Must be "erc721" or "erc1155".`,{name:"EnsAvatarUnsupportedNamespaceError"})}}let C=/(?<protocol>https?:\/\/[^/]*|ipfs:\/|ipns:\/|ar:\/)?(?<root>\/)?(?<subpath>ipfs\/|ipns\/)?(?<target>[\w\-.]+)(?<subtarget>\/.*)?/,k=/^(Qm[1-9A-HJ-NP-Za-km-z]{44,}|b[A-Za-z2-7]{58,}|B[A-Z2-7]{58,}|z[1-9A-HJ-NP-Za-km-z]{48,}|F[0-9A-F]{50,})(\/(?<target>[\w\-.]+))?(?<subtarget>\/.*)?$/,T=/^data:([a-zA-Z\-/+]*);base64,([^"].*)/,B=/^data:([a-zA-Z\-/+]*)?(;[a-zA-Z0-9].*?)?(,)/;async function R(e){try{let t=await fetch(e,{method:"HEAD"});if(200===t.status){let e=t.headers.get("content-type");return e?.startsWith("image/")}return!1}catch(t){if("object"==typeof t&&void 0!==t.response||!Object.hasOwn(globalThis,"Image"))return!1;return new Promise(t=>{let r=new Image;r.onload=()=>{t(!0)},r.onerror=()=>{t(!1)},r.src=e})}}function D(e,t){return e?e.endsWith("/")?e.slice(0,-1):e:t}function U({uri:e,gatewayUrls:t}){let r=T.test(e);if(r)return{uri:e,isOnChain:!0,isEncoded:r};let n=D(t?.ipfs,"https://ipfs.io"),i=D(t?.arweave,"https://arweave.net"),s=e.match(C),{protocol:o,subpath:a,target:l,subtarget:c=""}=s?.groups||{},u="ipns:/"===o||"ipns/"===a,f="ipfs:/"===o||"ipfs/"===a||k.test(e);if(e.startsWith("http")&&!u&&!f){let r=e;return t?.arweave&&(r=e.replace(/https:\/\/arweave.net/g,t?.arweave)),{uri:r,isOnChain:!1,isEncoded:!1}}if((u||f)&&l)return{uri:`${n}/${u?"ipns":"ipfs"}/${l}${c}`,isOnChain:!1,isEncoded:!1};if("ar:/"===o&&l)return{uri:`${i}/${l}${c||""}`,isOnChain:!1,isEncoded:!1};let h=e.replace(B,"");if(h.startsWith("<svg")&&(h=`data:image/svg+xml;base64,${btoa(h)}`),h.startsWith("data:")||h.startsWith("{"))return{uri:h,isOnChain:!0,isEncoded:!1};throw new O({uri:e})}function M(e){if("object"!=typeof e||!("image"in e)&&!("image_url"in e)&&!("image_data"in e))throw new S({data:e});return e.image||e.image_url||e.image_data}async function N({gatewayUrls:e,uri:t}){try{let r=await fetch(t).then(e=>e.json());return await j({gatewayUrls:e,uri:M(r)})}catch{throw new O({uri:t})}}async function j({gatewayUrls:e,uri:t}){let{uri:r,isOnChain:n}=U({uri:t,gatewayUrls:e});if(n||await R(r))return r;throw new O({uri:t})}async function L(e,{nft:t}){if("erc721"===t.namespace)return _(e,{address:t.contractAddress,abi:[{name:"tokenURI",type:"function",stateMutability:"view",inputs:[{name:"tokenId",type:"uint256"}],outputs:[{name:"",type:"string"}]}
vendor: 1,511 bytes, line 252
252],functionName:"tokenURI",args:[BigInt(t.tokenID)]});if("erc1155"===t.namespace)return _(e,{address:t.contractAddress,abi:[{name:"uri",type:"function",stateMutability:"view",inputs:[{name:"_id",type:"uint256"}],outputs:[{name:"",type:"string"}]}],functionName:"uri",args:[BigInt(t.tokenID)]});throw new P({namespace:t.namespace})}async function $(e,{gatewayUrls:t,record:r}){return/eip155:/i.test(r)?z(e,{gatewayUrls:t,record:r}):j({uri:r,gatewayUrls:t})}async function z(e,{gatewayUrls:t,record:r}){let n=function(e){let t=e;t.startsWith("did:nft:")&&(t=t.replace("did:nft:","").replace(/_/g,"/"));let[r,n,i]=t.split("/"),[s,o]=r.split(":"),[a,l]=n.split(":");if(!s||"eip155"!==s.toLowerCase())throw new I({reason:"Only EIP-155 supported"});if(!o)throw new I({reason:"Chain ID not found"});if(!l)throw new I({reason:"Contract address not found"});if(!i)throw new I({reason:"Token ID not found"});if(!a)throw new I({reason:"ERC namespace not found"});return{chainID:Number.parseInt(o,10),namespace:a.toLowerCase(),contractAddress:l,tokenID:i}}(r),{uri:i,isOnChain:s,isEncoded:o}=U({uri:await L(e,{nft:n}),gatewayUrls:t});if(s&&(i.includes("data:application/json;base64,")||i.startsWith("{")))return j({uri:M(JSON.parse(o?atob(i.replace("data:application/json;base64,","")):i)),gatewayUrls:t});let a=n.tokenID;return"erc1155"===n.namespace&&(a=a.replace("0x","").padStart(64,"0")),N({gatewayUrls:t,uri:i.replace(/(?:0x)?{id}/,a)})}async function F(e,t){let{blockNumber:r,blockTag:a,key:c,name:u,gatewayUrls:d,str
vendor: 4,234 bytes, line 252
252ict:p}=t,{chain:g}=e,y=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!g)throw Error("client chain not configured. universalResolverAddress is required.");return(0,o.L)({blockNumber:r,chain:g,contract:"ensUniversalResolver"})})(),m=g?.ensTlds;if(m&&!m.some(e=>u.endsWith(e)))return null;try{let t={address:y,abi:n.k3,args:[(0,l.NC)(w(u)),(0,s.R)({abi:n.nZ,functionName:"text",args:[b(u),c]}),d??[h.M]],functionName:"resolveWithGateways",blockNumber:r,blockTag:a},o=(0,v.s)(e,_,"readContract"),f=await o(t);if("0x"===f[0])return null;let p=(0,i.k)({abi:n.nZ,functionName:"text",data:f[0]});return""===p?null:p}catch(e){if(p)throw e;if(f(e))return null;throw e}}async function q(e,{blockNumber:t,blockTag:r,assetGatewayUrls:n,name:i,gatewayUrls:s,strict:o,universalResolverAddress:a}){let l=await (0,v.s)(e,F,"getEnsText")({blockNumber:t,blockTag:r,key:"avatar",name:i,universalResolverAddress:a,gatewayUrls:s,strict:o});if(!l)return null;try{return await $(e,{record:l,gatewayUrls:n})}catch{return null}}async function W(e,t){let{address:r,blockNumber:i,blockTag:s,coinType:a=60n,gatewayUrls:l,strict:c}=t,{chain:u}=e,d=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!u)throw Error("client chain not configured. universalResolverAddress is required.");return(0,o.L)({blockNumber:i,chain:u,contract:"ensUniversalResolver"})})();try{let t={address:d,abi:n.du,args:[r,a,l??[h.M]],functionName:"reverseWithGateways",blockNumber:i,blockTag:s},o=(0,v.s)(e,_,"readContract"),[c]=await o(t);return c||null}catch(e){if(c)throw e;if(f(e))return null;throw e}}async function V(e,t){let{blockNumber:r,blockTag:n,name:i}=t,{chain:s}=e,a=(()=>{if(t.universalResolverAddress)return t.universalResolverAddress;if(!s)throw Error("client chain not configured. universalResolverAddress is required.");return(0,o.L)({blockNumber:r,chain:s,contract:"ensUniversalResolver"})})(),c=s?.ensTlds;if(c&&!c.some(e=>i.endsWith(e)))throw Error(`${i} is not a valid ENS TLD (${c?.join(", ")}) for chain "${s.name}" (id: ${s.id}).`);let[u]=await (0,v.s)(e,_,"readContract")({address:a,abi:[{inputs:[{type:"bytes"}],name:"findResolver",outputs:[{type:"address"},{type:"bytes32"},{type:"uint256"}],stateMutability:"view",type:"function"}],functionName:"findResolver",args:[(0,l.NC)(w(i))],blockNumber:r,blockTag:n});return u}var H=r(67173),G=r(46482),K=r(84835),Z=r(10620),J=r(15318);async function Y(e,t){let{account:r=e.account,blockNumber:n,blockTag:i="latest",blobs:s,data:o,gas:a,gasPrice:c,maxFeePerBlobGas:u,maxFeePerGas:f,maxPriorityFeePerGas:h,to:d,value:p,...g}=t,y=r?(0,H.T)(r):void 0;try{(0,J.F)(t);let r="bigint"==typeof n?(0,l.eC)(n):void 0,m=e.chain?.formatters?.transactionRequest?.format,b=(m||Z.tG)({...(0,K.K)(g,{format:m}),account:y,blobs:s,data:o,gas:a,gasPrice:c,maxFeePerBlobGas:u,maxFeePerGas:f,maxPriorityFeePerGas:h,to:d,value:p},"createAccessList"),w=await e.request({method:"eth_createAccessList",params:[b,r||i]});return{accessList:w.accessList,gasUsed:BigInt(w.gasUsed)}}catch(r){throw(0,G.P)(r,{...t,account:y,chain:e.chain})}}function X(e,{method:t}){let r={};return"fallback"===e.transport.type&&e.transport.onResponse?.(({method:e,response:n,status:i,transport:s})=>{"success"===i&&t===e&&(r[n]=s.request)}),t=>r[t]||e.request}async function Q(e){let t=X(e,{method:"eth_newBlockFilter"}),r=await e.request({method:"eth_newBlockFilter"});return{id:r,request:t(r),type:"block"}}var ee=r(49154);class et extends c.G{constructor(e){super(`Filter type "${e}" is not supported.`,{name:"FilterTypeNotSupportedError"})}}var er=r(70803),en=r(37096),ei=r(4954),es=r(20006);let eo="/docs/contract/encodeEventTopics";function ea(e){let{abi:t,eventName:r,args:n}=e,i=t[0];if(r){let e=(0,es.mE)({abi:t,name:r});if(!e)throw new ee.mv(r,{docsPath:eo});i=e}if("event"!==i.type)throw new ee.mv(void 0,{docsPath:eo});let s=(0,ei.t)(i),o=(0,er.n)(s),a=[];if(n&&"inputs"in i){let e=i.inputs?.filter(e=>"indexed"in e&&e.indexed),t=Array.isArray(n)?n:Object.values(n).length>0?e?.map(e=>n[e.name])??[]:[];t.length>0&&(a=e?.map((e,r)=>Array.isArray(t[r])?t[r].map((n,i)=>el({param:e,value:t[r][i]})):void 0!==t[r]&&null!==t[r]?el({param:e,value:t[r]}):null)??[])}return[o,...a]}function el({param:e,value:t}
252){if("string"===e.type||"bytes"===e.type)return(0,g.w)((0,p.O0)(t));if("tuple"===e.type||e.type.match(/^(.*)\[(\d+)?\]$/))throw new et(e.type);return(0,en.E)([e],[t])}async function ec(e,t){let{address:r,abi:n,args:i,eventName:s,fromBlock:o,strict:a,toBlock:c}=t,u=X(e,{method:"eth_newFilter"}),f=s?ea({abi:n,args:i,eventName:s}):void 0,h=await e.request({method:"eth_newFilter",params:[{address:r,fromBlock:"bigint"==typeof o?(0,l.eC)(o):o,toBlock:"bigint"==typeof c?(0,l.eC)(c):c,topics:f}]});return{abi:n,args:i,eventName:s,id:h,request:u(h),strict:!!a,type:"event"}}async function eu(e,{address:t,args:r,event:n,events:i,fromBlock:s,strict:o,toBlock:a}={}){let c=i??(n?[n]:void 0),u=X(e,{method:"eth_newFilter"}),f=[];c&&(f=[c.flatMap(e=>ea({abi:[e],eventName:e.name,args:r}))],n&&(f=f[0]));let h=await e.request({method:"eth_newFilter",params:[{address:t,fromBlock:"bigint"==typeof s?(0,l.eC)(s):s,toBlock:"bigint"==typeof a?(0,l.eC)(a):a,...f.length?{topics:f}:{}}]});return{abi:c,args:r,eventName:n?n.name:void 0,fromBlock:s,id:h,request:u(h),strict:!!o,toBlock:a,type:"event"}}async function ef(e){let t=X(e,{method:"eth_newPendingTransactionFilter"}),r=await e.request({method:"eth_newPendingTransactionFilter"});return{id:r,request:t(r),type:"transaction"}}var eh=r(70402);async function ed(e,t){let{abi:r,address:n,args:i,functionName:o,dataSuffix:a="string"==typeof e.dataSuffix?e.dataSuffix:e.dataSuffix?.value,...l}=t,c=(0,s.R)({abi:r,args:i,functionName:o});try{return await (0,v.s)(e,eh.Q,"estimateGas")({data:`${c}${a?a.replace("0x",""):""}`,to:n,...l})}catch(t){let e=l.account?(0,H.T)(l.account):void 0;throw(0,E.S)(t,{abi:r,address:n,args:i,docsPath:"/docs/contract/estimateContractGas",functionName:o,sender:e?.address})}}var ep=r(58210),eg=r(18767),ey=r(19057);async function em(e,{address:t,blockNumber:r,blockTag:o=e.experimental_blockTag??"latest"}){if(e.batch?.multicall&&e.chain?.contracts?.multicall3){let a=e.chain.contracts.multicall3.address,l=(0,s.R)({abi:n.F8,functionName:"getEthBalance",args:[t]}),{data:c}=await (0,v.s)(e,x.R,"call")({to:a,data:l,blockNumber:r,blockTag:o});return(0,i.k)({abi:n.F8,functionName:"getEthBalance",args:[t],data:c||"0x"})}let a="bigint"==typeof r?(0,l.eC)(r):void 0;return BigInt(await e.request({method:"eth_getBalance",params:[t,a||o]}))}async function eb(e){return BigInt(await e.request({method:"eth_blobBaseFee"}))}var ew=r(7626),ev=r(49565),eE=r(60329);async function ex(e,{blockHash:t,blockNumber:r,blockTag:n="latest"}={}){let i;let s=void 0!==r?(0,l.eC)(r):void 0;return i=t?await e.request({method:"eth_getBlockTransactionCountByHash",params:[t]},{dedupe:!0}):await e.request({method:"eth_getBlockTransactionCountByNumber",params:[s||n]},{dedupe:!!s}),(0,eE.ly)(i)}var e_=r(74809);async function eA(e,{address:t,blockNumber:r,blockTag:n="latest"}){let i=void 0!==r?(0,l.eC)(r):void 0,s=await e.request({method:"eth_getCode",params:[t,i||n]},{dedupe:!!i});if("0x"!==s)return s}var eS=r(59050),eI=r(21692),eO=r(634),eP=r(84644),eC=r(59273);let ek="/docs/contract/decodeEventLog";function eT(e){let{abi:t,data:r,strict:n,topics:i}=e,s=n??!0,[o,...a]=i;if(!o)throw new ee.FM({docsPath:ek});let l=t.find(e=>"event"===e.type&&o===(0,er.n)((0,ei.t)(e)));if(!(l&&"name"in l)||"event"!==l.type)throw new ee.lC(o,{docsPath:ek});let{name:c,inputs:u}=l,f=u?.some(e=>!("name"in e&&e.name)),h=f?[]:{},d=u.map((e,t)=>[e,t]).filter(([e])=>"indexed"in e&&e.indexed),p=[];for(let e=0;e<d.length;e++){let[t,r]=d[e],n=a[e];if(!n){if(s)throw new ee.Gy({abiItem:l,param:t});p.push([t,r]);continue}h[f?r:t.name||r]=function({param:e,value:t}){return"string"===e.type||"bytes"===e.type||"tuple"===e.type||e.type.match(/^(.*)\[(\d+)?\]$/)?t:((0,eC.r)([e],t)||[])[0]}({param:t,value:n})}let g=u.filter(e=>!("indexed"in e&&e.indexed)),y=s?g:[...p.map(([e])=>e),...g];if(y.length>0){if(r&&"0x"!==r)try{let e=(0,eC.r)(y,r);if(e){let t=0;if(!s)for(let[r,n]of p)h[f?n:r.name||n]=e[t++];if(f)for(let r=0;r<u.length;r++)void 0===h[r]&&t<e.length&&(h[r]=e[t++]);else for(let r=0;r<g.length;r++)h[g[r].name]=e[t++]}}catch(e){if(s){if(e instanceof ee.xB||e instanceof eO.lQ)throw new ee.SM({abiItem:l,data:r,params:y,size:(0,eP.d)(r)});throw e}}else if(s)throw new ee.SM({abiItem:l,data:"0x",params:y,size:0})}return{eventName:c,args:Object.values(h).length>0?h:void 0}}function eB(e){let{abi:t,args:r,logs:n,strict:i=!0}=e,s=(()=>
252{if(e.eventName)return Array.isArray(e.eventName)?e.eventName:[e.eventName]})(),o=t.filter(e=>"event"===e.type).map(e=>({abi:e,selector:(0,er.n)(e)}));return n.map(e=>{let t,n;let a="string"==typeof e.blockNumber?(0,eI.U)(e):e,l=o.filter(e=>a.topics[0]===e.selector);if(0===l.length)return null;for(let e of l)try{t=eT({...a,abi:[e.abi],strict:!0}),n=e;break}catch{}if(!t&&!i){n=l[0];try{t=eT({data:a.data,topics:a.topics,abi:[n.abi],strict:!1})}catch{let e=n.abi.inputs?.some(e=>!("name"in e&&e.name));return{...a,args:e?[]:{},eventName:n.abi.name}}}return t&&n&&(!s||s.includes(t.eventName))&&function(e){let{args:t,inputs:r,matchArgs:n}=e;if(!n)return!0;if(!t)return!1;function i(e,t,r){try{if("address"===e.type)return(0,eS.E)(t,r);if("string"===e.type||"bytes"===e.type)return(0,g.w)((0,p.O0)(t))===r;return t===r}catch{return!1}}return Array.isArray(t)&&Array.isArray(n)?n.every((e,n)=>{if(null==e)return!0;let s=r[n];return!!s&&(Array.isArray(e)?e:[e]).some(e=>i(s,e,t[n]))}):!("object"!=typeof t||Array.isArray(t)||"object"!=typeof n||Array.isArray(n))&&Object.entries(n).every(([e,n])=>{if(null==n)return!0;let s=r.find(t=>t.name===e);return!!s&&(Array.isArray(n)?n:[n]).some(r=>i(s,r,t[e]))})}({args:t.args,inputs:n.abi.inputs,matchArgs:r})?{...t,...a}:null}).filter(Boolean)}async function eR(e,{address:t,blockHash:r,fromBlock:n,toBlock:i,event:s,events:o,args:a,strict:c}={}){let u=o??(s?[s]:void 0),f=[];u&&(f=[u.flatMap(e=>ea({abi:[e],eventName:e.name,args:o?void 0:a}))],s&&(f=f[0]));let h=(r?await e.request({method:"eth_getLogs",params:[{address:t,topics:f,blockHash:r}]}):await e.request({method:"eth_getLogs",params:[{address:t,topics:f,fromBlock:"bigint"==typeof n?(0,l.eC)(n):n,toBlock:"bigint"==typeof i?(0,l.eC)(i):i}]})).map(e=>(0,eI.U)(e));return u?eB({abi:u,args:a,logs:h,strict:c??!1}):h}async function eD(e,t){let{abi:r,address:n,args:i,blockHash:s,eventName:o,fromBlock:a,toBlock:l,strict:c}=t,u=o?(0,es.mE)({abi:r,name:o}):void 0,f=u?void 0:r.filter(e=>"event"===e.type);return(0,v.s)(e,eR,"getLogs")({address:n,args:i,blockHash:s,event:u,events:f,fromBlock:a,toBlock:l,strict:c})}var eU=r(91476),eM=r(12202);async function eN(e,{address:t,blockNumber:r,blockTag:n="latest"}){let i=await eA(e,{address:t,...void 0!==r?{blockNumber:r}:{blockTag:n}});if(i&&23===(0,eP.d)(i)&&i.startsWith("0xef0100"))return(0,eU.K)((0,eM.tP)(i,3,23))}class ej extends c.G{constructor({address:e}){super(`No EIP-712 domain found on contract "${e}".`,{metaMessages:["Ensure that:",`- The contract is deployed at the address "${e}".`,"- `eip712Domain()` function exists on the contract.","- `eip712Domain()` function matches signature to ERC-5267 specification."],name:"Eip712DomainNotFoundError"})}}async function eL(e,t){let{address:r,factory:n,factoryData:i}=t;try{let[t,s,o,a,l,c,u]=await (0,v.s)(e,_,"readContract")({abi:e$,address:r,functionName:"eip712Domain",factory:n,factoryData:i});return{domain:{name:s,version:o,chainId:Number(a),verifyingContract:l,salt:c},extensions:u,fields:t}}catch(e){if("ContractFunctionExecutionError"===e.name&&"ContractFunctionZeroDataError"===e.cause.name)throw new ej({address:r});throw e}}let e$=[{inputs:[],name:"eip712Domain",outputs:[{name:"fields",type:"bytes1"},{name:"name",type:"string"},{name:"version",type:"string"},{name:"chainId",type:"uint256"},{name:"verifyingContract",type:"address"},{name:"salt",type:"bytes32"},{name:"extensions",type:"uint256[]"}],stateMutability:"view",type:"function"}];async function ez(e,{blockCount:t,blockNumber:r,blockTag:n="latest",rewardPercentiles:i}){var s;let o="bigint"==typeof r?(0,l.eC)(r):void 0;return{baseFeePerGas:(s=await e.request({method:"eth_feeHistory",params:[(0,l.eC)(t),o||n,i]},{dedupe:!!o})).baseFeePerGas.map(e=>BigInt(e)),gasUsedRatio:s.gasUsedRatio,oldestBlock:BigInt(s.oldestBlock),reward:s.reward?.map(e=>e.map(e=>BigInt(e)))}}async function eF(e,{filter:t}){let r="strict"in t&&t.strict,n=await t.request({method:"eth_getFilterChanges",params:[t.id]});if("string"==typeof n[0])return n;let i=n.map(e=>(0,eI.U)(e));return"abi"in t&&t.abi?eB({abi:t.abi,logs:i,strict:r}):i}async function eq(e,{filter:t}){let r=t.strict??!1,n=(await t.request({method:"eth_getFilterLogs",params:[t.id]})).map(e=>(0,eI.U)(e));return t.abi?eB({abi:t.abi,logs:n,strict:r}):n}var eW=r(55093);async function eV(e,{address:t,blockNumber:r,blockTag:n,storageKeys:i}){var s;let o=void 0!==r?(0,l.eC)(r):void 0;return{...s=await e.request({method:"eth_getProof",params:[t,i,o||(n??"latest")]}),balance:s.balance?BigInt(s.balance):void 0,nonce:s.nonce?(0,eE.ly)(s.nonce):void 0,storageProof:s.storageProof?s.storageProof.map(e=>
vendor: 5,274 bytes, line 252
252({...e,value:BigInt(e.value)})):void 0}}async function eH(e,{address:t,blockNumber:r,blockTag:n="latest",slot:i}){let s=void 0!==r?(0,l.eC)(r):void 0;return await e.request({method:"eth_getStorageAt",params:[t,i,s||n]})}var eG=r(68100);async function eK(e,{hash:t,transactionReceipt:r}){let[n,i]=await Promise.all([(0,v.s)(e,ev.z,"getBlockNumber")({}),t?(0,v.s)(e,eG.f,"getTransaction")({hash:t}):void 0]),s=r?.blockNumber||i?.blockNumber;return s?n-s+1n:0n}var eZ=r(93565),eJ=r(87114),eY=r(25974);async function eX(e,t){let{account:r,authorizationList:a,allowFailure:l=!0,blockNumber:f,blockOverrides:h,blockTag:d,stateOverride:p}=t,g=t.contracts,{batchSize:y=t.batchSize??1024,deployless:m=t.deployless??!1}="object"==typeof e.batch?.multicall?e.batch.multicall:{},b=(()=>{if(t.multicallAddress)return t.multicallAddress;if(m)return null;if(e.chain)return(0,o.L)({blockNumber:f,chain:e.chain,contract:"multicall3"});throw Error("client chain not configured. multicallAddress is required.")})(),w=[[]],x=0,A=0;for(let e=0;e<g.length;e++){let{abi:t,address:n,args:i,functionName:o}=g[e];try{let e=(0,s.R)({abi:t,args:i,functionName:o});A+=(e.length-2)/2,y>0&&A>y&&w[x].length>0&&(x++,A=(e.length-2)/2,w[x]=[]),w[x]=[...w[x],{allowFailure:!0,callData:e,target:n}]}catch(s){let e=(0,E.S)(s,{abi:t,address:n,args:i,docsPath:"/docs/contract/multicall",functionName:o,sender:r});if(!l)throw e;w[x]=[...w[x],{allowFailure:!0,callData:"0x",target:n}]}}let S=await Promise.allSettled(w.map(t=>(0,v.s)(e,_,"readContract")({...null===b?{code:eY.xd}:{address:b},abi:n.F8,account:r,args:[t],authorizationList:a,blockNumber:f,blockOverrides:h,blockTag:d,functionName:"aggregate3",stateOverride:p}))),I=[];for(let e=0;e<S.length;e++){let t=S[e];if("rejected"===t.status){if(!l)throw t.reason;for(let r=0;r<w[e].length;r++)I.push({status:"failure",error:t.reason,result:void 0});continue}let r=t.value;for(let t=0;t<r.length;t++){let{returnData:n,success:s}=r[t],{callData:o}=w[e][t],{abi:a,address:c,functionName:f,args:h}=g[I.length];try{if("0x"===o)throw new ee.wb;if(!s)throw new u.VQ({data:n});let e=(0,i.k)({abi:a,args:h,data:n,functionName:f});I.push(l?{result:e,status:"success"}:e)}catch(t){let e=(0,E.S)(t,{abi:a,address:c,args:h,docsPath:"/docs/contract/multicall",functionName:f});if(!l)throw e;I.push({error:e,result:void 0,status:"failure"})}}}if(I.length!==g.length)throw new c.G("multicall results mismatch");return I}var eQ=r(78002),e0=r(4656),e1=r(33033),e2=r(70181),e6=r(28746);async function e5(e,t){let{blockNumber:r,blockTag:n=e.experimental_blockTag??"latest",blocks:o,returnFullTransactions:a,traceTransfers:c,validation:f}=t;try{let t=[];for(let e of o){let r=e.blockOverrides?eQ.o(e.blockOverrides):void 0,n=e.calls.map(e=>{let t=e.account?(0,H.T)(e.account):void 0,r=e.abi?(0,s.R)(e):e.data,n={...e,account:t,data:e.dataSuffix?(0,d.zo)([r||"0x",e.dataSuffix]):r,from:e.from??t?.address};return(0,J.F)(n),(0,Z.tG)(n)}),i=e.stateOverrides?(0,e6.mF)(e.stateOverrides):void 0;t.push({blockOverrides:r,calls:n,stateOverrides:i})}let h="bigint"==typeof r?(0,l.eC)(r):void 0;return(await e.request({method:"eth_simulateV1",params:[{blockStateCalls:t,returnFullTransactions:a,traceTransfers:c,validation:f},h||n]})).map((e,t)=>({...(0,e2.Z)(e),calls:e.calls.map((e,r)=>{let{abi:n,args:s,functionName:a,to:l}=o[t].calls[r],c=e.error?.data??e.returnData,f=BigInt(e.gasUsed),h=e.logs?.map(e=>eI.U(e)),d="0x1"===e.status?"success":"failure",p=n&&"success"===d&&"0x"!==c?(0,i.k)({abi:n,data:c,functionName:a}):null,g=(()=>{let e;if("success"!==d&&("0x"===c?e=new ee.wb:c&&(e=new u.VQ({data:c})),e))return(0,E.S)(e,{abi:n??[],address:l??"0x",args:s,functionName:a??"<unknown>"})})();return{data:c,gasUsed:f,logs:h,status:d,..."success"===d?{result:p}:{error:g}}})}))}catch(t){let e=(0,e1.k)(t,{});if(e instanceof e0.cj)throw t;throw e}}var e8=r(76035),e3=r(94390),e4=r(45744),e9=r(7924),e7=r(2434),te=r(82802),tt=r(61694),tr=r(42790);function tn(e,t){if(th(e)>t)throw new ty({givenSize:th(e),maxSize:t})}let ti={zero:48,nine:57,A:65,F:70,a:97,f:102};function ts(e){return e>=ti.zero&&e<=ti.nine?e-ti.zero:e>=ti.A&&e<=ti.F?e-(ti.A-10):e>=ti.a&&e<=ti.f?e-(ti.a-10):void 0}function to(e,t={}){let{dir:r="left"}=t,n=0;for(let t=0;t<e.length-1&&"0"===e["left"===r?t:e.length-t-1].toString();t++)n++;return"left"===r?e.slice(n):e.slice(0,e.length-n)}var ta=r(7322),tl=r(26372);let tc=new TextDecoder,tu=new TextEncoder;function tf(e,t={}){let{size:r}=t,n=e;r&&(ta.Yf(e,r),n=tr.eh(e,r));let i=n.slice(2);i.length%2&&(i=`0${i}`);let s=i.length/2,o=new Uint8Array(s);for(let e=0,t=0;e<s;e++){let r=ts(i.charCodeAt(t++)),n=ts(i.charCodeAt(t++));if(void 0===r||void 0===n)throw new te.G(`Invalid byte sequence ("${i[t-2]}${i[t-1]}" in "${i}").`);o[e]=r<<4|n}return o}function th(e){return e.length}function td(e,t={}){let{size:r}=t;void 0!==r&&tn(e,r);let n=tr.xv(e,t);return tr.He(n,t)}function tp(e){return to(e,{dir:"left"})}class tg extends te.G{constructor(e){super(`Bytes value \`${e}\` is not a valid boolean.`,{metaMessages:["The bytes array must contain a single byte of either a `0` or `1` value."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.InvalidBytesBooleanError"})}}class ty extends te.G{constructor({givenSize:e,maxSize:t}
vendor: 4,145 bytes, line 252
252){super(`Size cannot exceed \`${t}\` bytes. Given size: \`${e}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeOverflowError"})}}class tm extends te.G{constructor({offset:e,position:t,size:r}){super(`Slice ${"start"===t?"starting":"ending"} at offset \`${e}\` is out-of-bounds (size: \`${r}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SliceOffsetOutOfBoundsError"})}}class tb extends te.G{constructor({size:e,targetSize:t,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${e}\`) exceeds padding size (\`${t}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeExceedsPaddingSizeError"})}}function tw(e,t={}){let{as:r="string"==typeof e?"Hex":"Bytes"}=t,n=(0,tt.fr)(e instanceof Uint8Array?e:"string"==typeof e?tf(e):e instanceof Uint8Array?e:new Uint8Array(e));return"Bytes"===r?n:tr.xv(n)}class tv extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){let t=super.get(e);return super.has(e)&&void 0!==t&&(this.delete(e),super.set(e,t)),t}set(e,t){if(super.set(e,t),this.maxSize&&this.size>this.maxSize){let e=this.keys().next().value;e&&this.delete(e)}return this}}let tE={checksum:new tv(8192)}.checksum,tx=/^0x[a-fA-F0-9]{40}$/;function t_(e,t={}){let{strict:r=!0}=t;if(!tx.test(e))throw new tI({address:e,cause:new tO});if(r){if(e.toLowerCase()===e)return;if(tA(e)!==e)throw new tI({address:e,cause:new tP})}}function tA(e){if(tE.has(e))return tE.get(e);t_(e,{strict:!1});let t=e.substring(2).toLowerCase(),r=tw(function(e,t={}){let{size:r}=t,n=tu.encode(e);return"number"==typeof r?(tn(n,r),function(e,t={}){let{dir:r,size:n=32}=t;if(0===n)return e;if(e.length>n)throw new tb({size:e.length,targetSize:n,type:"Bytes"});let i=new Uint8Array(n);for(let t=0;t<n;t++){let s="right"===r;i[s?t:n-t-1]=e[s?t:e.length-t-1]}return i}(n,{dir:"right",size:r})):n}(t),{as:"Bytes"}),n=t.split("");for(let e=0;e<40;e+=2)r[e>>1]>>4>=8&&n[e]&&(n[e]=n[e].toUpperCase()),(15&r[e>>1])>=8&&n[e+1]&&(n[e+1]=n[e+1].toUpperCase());let i=`0x${n.join("")}`;return tE.set(e,i),i}function tS(e,t={}){let{strict:r=!0}=t??{};try{return t_(e,{strict:r}),!0}catch{return!1}}class tI extends te.G{constructor({address:e,cause:t}){super(`Address "${e}" is invalid.`,{cause:t}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidAddressError"})}}class tO extends te.G{constructor(){super("Address is not a 20 byte (40 hexadecimal character) value."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidInputError"})}}class tP extends te.G{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}}function tC(e){let t=!0,r="",n=0,i="",s=!1;for(let o=0;o<e.length;o++){let a=e[o];if(["(",")",","].includes(a)&&(t=!0),"("===a&&n++,")"===a&&n--,t){if(0===n){if(" "===a&&["event","function","error",""].includes(i))i="";else if(i+=a,")"===a){s=!0;break}continue}if(" "===a){","!==e[o-1]&&","!==r&&",("!==r&&(r="",t=!1);continue}i+=a,r+=a}}if(!s)throw new te.G("Unable to normalize signature.");return i}function tk(e,t={}){let{prepare:r=!0}=t,n=Array.isArray(e)||"string"==typeof e?function(e){let t;if("string"==typeof e)t=(0,e9.cK)(e);else{let r=(0,e4.D)(e),n=e.length;for(let i=0;i<n;i++){let n=e[i];if(!(0,e3.N0)(n)){t=(0,e9.cK)(n,r);break}}}if(!t)throw new e8.a_({signature:e});return t}(e):e;return{...n,...r?{hash:tR(n)}:{}}}function tT(e,t,r){let n;let{args:i=[],prepare:s=!0}=r??{},o=tr.Gu(t,{strict:!1}),a=e.filter(e=>o?"function"===e.type||"error"===e.type?tB(e)===tr.tP(t,0,4):"event"===e.type&&tR(e)===t:"name"in e&&e.name===t);if(0===a.length)throw new tU({name:t});if(1===a.length)return{...a[0],...s?{hash:tR(a[0])}:{}};for(let e of a)if("inputs"in e){if(!i||0===i.length){if(!e.inputs||0===e.inputs.length)return{...e,...s?{hash:tR(e)}:{}};continue}
vendor: 14,546 bytes, lines 252-254
252if(e.inputs&&0!==e.inputs.length&&e.inputs.length===i.length&&i.every((t,r)=>{let n="inputs"in e&&e.inputs[r];return!!n&&function e(t,r){let n=typeof t,i=r.type;switch(i){case"address":return tS(t,{strict:!1});case"bool":return"boolean"===n;case"function":case"string":return"string"===n;default:if("tuple"===i&&"components"in r)return Object.values(r.components).every((r,n)=>e(Object.values(t)[n],r));if(/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(i))return"number"===n||"bigint"===n;if(/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(i))return"string"===n||t instanceof Uint8Array;if(/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(i))return Array.isArray(t)&&t.every(t=>e(t,{...r,type:i.replace(/(\[[0-9]{0,}\])$/,"")}));return!1}}(t,n)})){if(n&&"inputs"in n&&n.inputs){let t=function e(t,r,n){for(let i in t){let s=t[i],o=r[i];if("tuple"===s.type&&"tuple"===o.type&&"components"in s&&"components"in o)return e(s.components,o.components,n[i]);let a=[s.type,o.type];if(a.includes("address")&&a.includes("bytes20")||(a.includes("address")&&a.includes("string")||a.includes("address")&&a.includes("bytes"))&&tS(n[i],{strict:!1}))return a}}(e.inputs,n.inputs,i);if(t)throw new tD({abiItem:e,type:t[0]},{abiItem:n,type:t[1]})}n=e}}let l=(()=>{if(n)return n;let[e,...t]=a;return{...e,overloads:t}})();if(!l)throw new tU({name:t});return{...l,...s?{hash:tR(l)}:{}}}function tB(...e){let t=(()=>{if(Array.isArray(e[0])){let[t,r]=e;return tT(t,r)}return e[0]})();return tr.tP(tR(t),0,4)}function tR(...e){let t=(()=>{if(Array.isArray(e[0])){let[t,r]=e;return tT(t,r)}return e[0]})();return"string"!=typeof t&&"hash"in t&&t.hash?t.hash:tw(tr.mL(function(...e){let t=(()=>{if(Array.isArray(e[0])){let[t,r]=e;return tT(t,r)}return e[0]})();return tC("string"==typeof t?t:e7.t(t))}(t)))}class tD extends te.G{constructor(e,t){super("Found ambiguous types in overloaded ABI Items.",{metaMessages:[`\`${e.type}\` in \`${tC(e7.t(e.abiItem))}\`, and`,`\`${t.type}\` in \`${tC(e7.t(t.abiItem))}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.AmbiguityError"})}}class tU extends te.G{constructor({name:e,data:t,type:r="item"}){super(`ABI ${r}${e?` with name "${e}"`:t?` with data "${t}"`:""} not found.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiItem.NotFoundError"})}}var tM=r(11321),tN=r(60550);let tj=/^(.*)\[([0-9]*)\]$/,tL=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,t$=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/,tz=2n**256n-1n;function tF(e){let t=0;for(let r=0;r<e.length;r++){let{dynamic:n,encoded:i}=e[r];n?t+=32:t+=tr.dp(i)}let r=[],n=[],i=0;for(let s=0;s<e.length;s++){let{dynamic:o,encoded:a}=e[s];o?(r.push(tr.xS(t+i,{size:32})),n.push(a),i+=tr.dp(a)):r.push(a)}return tr.zo(...r,...n)}function tq(e){let t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}function tW(e){let{type:t}=e;if("string"===t||"bytes"===t||t.endsWith("[]"))return!0;if("tuple"===t)return e.components?.some(tW);let r=tq(e.type);return!!(r&&tW({...e,type:r[1]}))}let tV={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new tK({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new tG({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new tH({offset:e});let t=this.position-e;this.assertPosition(t),this.position=t},getReadCount(e){return this.positionReadCount.get(e||this.position)||0},incrementPosition(e){if(e<0)throw new tH({offset:e});let t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){let t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){let r=t??this.position;return this.assertPosition(r+e-1),this.bytes.subarray(r,r+e)},inspectUint8(e){let t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){let t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){let t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){let t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,255&e),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();let e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();let r=this.inspectBytes(e);return this.position+=t??e,r},readUint8(){this.assertReadLimit(),this._touch();let e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();let e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();let e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();let e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){let t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;let e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};class tH extends te.G{constructor({offset:e}){super(`Offset \`${e}\` cannot be negative.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.NegativeOffsetError"})}}class tG extends te.G{constructor({length:e,position:t}){super(`Position \`${t}\` is out of bounds (\`0 < position < ${e}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.PositionOutOfBoundsError"})}}class tK extends te.G{constructor({count:e,limit:t}){super(`Recursive read limit of \`${t}\` exceeded (recursive read count: \`${e}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Cursor.RecursiveReadLimitExceededError"})}}function tZ(e,t,r){let{checksumAddress:n=!1}=r??{};if(e.length!==t.length)throw new t2({expectedLength:e.length,givenLength:t.length});let i=tF(function({checksumAddress:e,parameters:t,values:r}){let n=[];for(let i=0;i<t.length;i++)n.push(function e({checksumAddress:t=!1,parameter:r,value:n}){let i=tq(r.type);if(i){let[s,o]=i;return function(t,r){let{checksumAddress:n,length:i,parameter:s}=r,o=null===i;if(!Array.isArray(t))throw new t6(t);if(!o&&t.length!==i)throw new t0({expectedLength:i,givenLength:t.length,type:`${s.type}[${i}]`});let a=!1,l=[];for(let r=0;r<t.length;r++){let i=e({checksumAddress:n,parameter:s,value:t[r]});i.dynamic&&(a=!0),l.push(i)}if(o||a){let e=tF(l);if(o){let t=tr.xS(l.length,{size:32});return{dynamic:!0,encoded:l.length>0?tr.zo(t,e):t}}if(a)return{dynamic:!0,encoded:e}}return{dynamic:!1,encoded:tr.zo(...l.map(({encoded:e})=>e))}}(n,{checksumAddress:t,length:s,parameter:{...r,type:o}})}if("tuple"===r.type)return function(t,r){let{checksumAddress:n,parameter:i}=r,s=!1,o=[];for(let r=0;r<i.components.length;r++){let a=i.components[r],l=Array.isArray(t)?r:a.name,c=e({checksumAddress:n,parameter:a,value:t[l]});o.push(c),c.dynamic&&(s=!0)}return{dynamic:s,encoded:s?tF(o):tr.zo(...o.map(({encoded:e})=>e))}}(n,{checksumAddress:t,parameter:r});if("address"===r.type)return function(e,t){let{checksum:r=!1}=t;return t_(e,{strict:r}),{dynamic:!1,encoded:tr.Q_(e.toLowerCase())}}(n,{checksum:t});if("bool"===r.type)return function(e){if("boolean"!=typeof e)throw new te.G(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:tr.Q_(tr.O3(e))}}(n);if(r.type.startsWith("uint")||r.type.startsWith("int")){let e=r.type.startsWith("int"),[,,t="256"]=t$.exec(r.type)??[];return function(e,{signed:t,size:r}){if("number"==typeof r){let n=2n**(BigInt(r)-(t?1n:0n))-1n,i=t?-n-1n:0n;if(e>n||e<i)throw new tr.J5({max:n.toString(),min:i.toString(),signed:t,size:r/8,value:e.toString()})}return{dynamic:!1,encoded:tr.xS(e,{size:32,signed:t})}}(n,{signed:e,size:Number(t)})}if(r.type.startsWith("bytes"))return function(e,{type:t}){let[,r]=t.split("bytes"),n=tr.dp(e);if(!r){let t=e;return n%32!=0&&(t=tr.eh(t,32*Math.ceil((e.length-2)/2/32))),{dynamic:!0,encoded:tr.zo(tr.Q_(tr.xS(n,{size:32})),t)}}if(n!==Number.parseInt(r,10))throw new t1({expectedSize:Number.parseInt(r,10),value:e});return{dynamic:!1,encoded:tr.eh(e)}}(n,{type:r.type});if("string"===r.type)return function(e){let t=tr.mL(e),r=Math.ceil(tr.dp(t)/32),n=[];for(let e=0;e<r;e++)n.push(tr.eh(tr.tP(t,32*e,(e+1)*32)));return{dynamic:!0,encoded:tr.zo(tr.eh(tr.xS(tr.dp(t),{size:32})),...n)}}(n);throw new t5(r.type)}({checksumAddress:e,parameter:t[i],value:r[i]}));return n}({checksumAddress:n,parameters:e,values:t}));return 0===i.length?"0x":i}function tJ(e,t){if(e.length!==t.length)throw new t2({expectedLength:e.length,givenLength:t.length});let r=[];for(let n=0;n<e.length;n++){let i=e[n],s=t[n];r.push(tJ.encode(i,s))}return tr.zo(...r)}function tY(e){return Array.isArray(e)&&"string"==typeof e[0]||"string"==typeof e?function(e){let t=[];if("string"==typeof e){let r=(0,e9.Q4)(e),n=r.length;for(let e=0;e<n;e++)t.push((0,e9.C$)(r[e],{modifiers:e3.LY}))}else{let r=(0,e4.D)(e),n=e.length;for(let i=0;i<n;i++){let n=e[i];if((0,e3.N0)(n))continue;let s=(0,e9.Q4)(n),o=s.length;for(let e=0;e<o;e++)t.push((0,e9.C$)(s[e],{modifiers:e3.LY,structs:r}))}}if(0===t.length)throw new tM.$r({params:e});return t}(e):e}(tJ||(tJ={})).encode=function e(t,r,n=!1){if("address"===t)return t_(r),tr.Q_(r.toLowerCase(),n?32:0);if("string"===t)return tr.mL(r);if("bytes"===t)return r;if("bool"===t)return tr.Q_(tr.O3(r),n?32:1);let i=t.match(t$);if(i){let[e,t,s="256"]=i,o=Number.parseInt(s,10)/8;return tr.xS(r,{size:n?32:o,signed:"int"===t})}let s=t.match(tL);if(s){let[e,t]=s;if(Number.parseInt(t,10)!==(r.length-2)/2)throw new t1({expectedSize:Number.parseInt(t,10),value:r});return tr.eh(r,n?32:0)}let o=t.match(tj);if(o&&Array.isArray(r)){let[t,n]=o,i=[];for(let t=0;t<r.length;t++)i.push(e(n,r[t],!0));return 0===i.length?"0x":tr.zo(...i)}throw new t5(t)};class tX extends te.G{constructor({data:e,parameters:t,size:r}){super(`Data size of ${r} bytes is too small for given parameters.`,{metaMessages:[`Params: (${tN.P(t)})`,`Data: ${e} (${r} bytes)`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.DataSizeTooSmallError"})}}class tQ extends te.G{constructor(){super('Cannot decode zero data ("0x") with ABI parameters.'),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.ZeroDataError"})}}class t0 extends te.G{constructor({expectedLength:e,givenLength:t,type:r}){super(`Array length mismatch for type \`${r}\`. Expected: \`${e}\`. Given: \`${t}\`.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.ArrayLengthMismatchError"})}}class t1 extends te.G{constructor({expectedSize:e,value:t}){super(`Size of bytes "${t}" (bytes${tr.dp(t)}) does not match expected size (bytes${e}).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.BytesSizeMismatchError"})}}class t2 extends te.G{constructor({expectedLength:e,givenLength:t}){super(`ABI encoding parameters/values length mismatch. 253Expected length (parameters): ${e} 254Given length (values): ${t}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.LengthMismatchError"})}}class t6 extends te.G{constructor(e){super(`Value \`${e}\` is not a valid array.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidArrayError"})}}class t5 extends te.G{constructor(e){super(`Type \`${e}\` is not a valid ABI Type.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"AbiParameters.InvalidTypeError"})}}function t8(e,t={}){return tk(e,t)}function t3(e,t,r){let n=tT(e,t,r);if("function"!==n.type)throw new tU({name:t,type:"function"});return n}let t4="0x0000000000000000000000000000000000000000";async function t9(e,t){let{blockNumber:r,blockTag:n,calls:i,stateOverrides:o,traceAssetChanges:a,traceTransfers:l,validation:u}=t,f=t.account?(0,H.T)(t.account):void 0;if(a&&!f)throw new c.G("`account` is required when `traceAssetChanges` is true");let h=f?function(...e){let[t,r]=(()=>{if(Array.isArray(e[0])){let[t,r]=e;return[function(e){let t=e.find(e=>"constructor"===e.type);if(!t)throw new tU({name:"constructor"});return t}(t),r]}return e})(),{bytecode:n,args:i}=r;return tr.zo(n,t.inputs?.length&&i?.length?tZ(t.inputs,i):"0x")}(tk("constructor(bytes, bytes)"),{bytecode:eY.NO,args:["0x6080604052348015600e575f80fd5b5061016d8061001c5f395ff3fe608060405234801561000f575f80fd5b5060043610610029575f3560e01c8063f8b2cb4f1461002d575b5f80fd5b610047600480360381019061004291906100db565b61005d565b604051610054919061011e565b60405180910390f35b5f8173ffffffffffffffffffffffffffffffffffffffff16319050919050565b5f80fd5b5f73ffffffffffffffffffffffffffffffffffffffff82169050919050565b5f6100aa82610081565b9050919050565b6100ba816100a0565b81146100c4575f80fd5b50565b5f813590506100d5816100b1565b92915050565b5f602082840312156100f0576100ef61007d565b5b5f6100fd848285016100c7565b91505092915050565b5f819050919050565b61011881610106565b82525050565b5f6020820190506101315f83018461010f565b9291505056fea26469706673582212203b9fe929fe995c7cf9887f0bdba8a36dd78e8b73f149b17d2d9ad7cd09d2dc6264736f6c634300081a0033",function(...e){let[t,r=[]]=(()=>
vendor: 4,305 bytes, line 254
254{if(Array.isArray(e[0])){let[t,r,n]=e;return[t3(t,r,{args:n}),n]}let[t,r]=e;return[t,r]})(),{overloads:n}=t,i=n?t3([t,...n],t.name,{args:r}):t,s=tB(i),o=r.length>0?tZ(i.inputs,r):void 0;return o?tr.zo(s,o):s}(t8("function getBalance(address)"),[f.address])]}):void 0,d=a?await Promise.all(t.calls.map(async t=>{if(!t.data&&!t.abi)return;let{accessList:r}=await Y(e,{account:f.address,...t,data:t.abi?(0,s.R)(t):t.data});return r.map(({address:e,storageKeys:t})=>t.length>0?e:null)})).then(e=>e.flat().filter(Boolean)):[],p=await e5(e,{blockNumber:r,blockTag:n,blocks:[...a?[{calls:[{data:h}],stateOverrides:o},{calls:d.map((e,t)=>({abi:[t8("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[f.address],to:e,from:t4,nonce:t})),stateOverrides:[{address:t4,nonce:0}]}]:[],{calls:[...i,{to:t4}].map(e=>({...e,from:f?.address})),stateOverrides:o},...a?[{calls:[{data:h}]},{calls:d.map((e,t)=>({abi:[t8("function balanceOf(address) returns (uint256)")],functionName:"balanceOf",args:[f.address],to:e,from:t4,nonce:t})),stateOverrides:[{address:t4,nonce:0}]},{calls:d.map((e,t)=>({to:e,abi:[t8("function decimals() returns (uint256)")],functionName:"decimals",from:t4,nonce:t})),stateOverrides:[{address:t4,nonce:0}]},{calls:d.map((e,t)=>({to:e,abi:[t8("function tokenURI(uint256) returns (string)")],functionName:"tokenURI",args:[0n],from:t4,nonce:t})),stateOverrides:[{address:t4,nonce:0}]},{calls:d.map((e,t)=>({to:e,abi:[t8("function symbol() returns (string)")],functionName:"symbol",from:t4,nonce:t})),stateOverrides:[{address:t4,nonce:0}]}]:[]],traceTransfers:l,validation:u}),g=a?p[2]:p[0],[y,m,,b,w,v,E,x]=a?p:[],{calls:_,...A}=g,S=_.slice(0,-1)??[],I=[...y?.calls??[],...m?.calls??[]].map(e=>"success"===e.status?(0,eE.y_)(e.data):null),O=[...b?.calls??[],...w?.calls??[]].map(e=>"success"===e.status?(0,eE.y_)(e.data):null),P=(v?.calls??[]).map(e=>"success"===e.status?e.result:null),C=(x?.calls??[]).map(e=>"success"===e.status?e.result:null),k=(E?.calls??[]).map(e=>"success"===e.status?e.result:null),T=[];for(let[e,t]of O.entries()){let r=I[e];if("bigint"!=typeof t||"bigint"!=typeof r)continue;let n=P[e-1],i=C[e-1],s=k[e-1],o=0===e?{address:"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",decimals:18,symbol:"ETH"}:{address:d[e-1],decimals:s||n?Number(n??1):void 0,symbol:i??void 0};T.some(e=>e.token.address===o.address)||T.push({token:o,value:{pre:r,post:t,diff:t-r}})}return{assetChanges:T,block:A,results:S}}async function t7(e,t){let{abi:r,address:n,args:o,functionName:a,dataSuffix:l="string"==typeof e.dataSuffix?e.dataSuffix:e.dataSuffix?.value,...c}=t,u=c.account?(0,H.T)(c.account):e.account,f=(0,s.R)({abi:r,args:o,functionName:a});try{let{data:s}=await (0,v.s)(e,x.R,"call")({batch:!1,data:`${f}${l?l.replace("0x",""):""}`,to:n,...c,account:u}),h=(0,i.k)({abi:r,args:o,functionName:a,data:s||"0x"}),d=r.filter(e=>"name"in e&&e.name===t.functionName);return{result:h,request:{abi:d,address:n,args:o,dataSuffix:l,functionName:a,...c,account:u}}}catch(e){throw(0,E.S)(e,{abi:r,address:n,args:o,docsPath:"/docs/contract/simulateContract",functionName:a,sender:u?.address})}}async function re(e,{filter:t}){return t.request({method:"eth_uninstallFilter",params:[t.id]})}let rt="0x6492649264926492649264926492649264926492649264926492649264926492";class rr extends te.G{constructor(e){super(`Value \`${e}\` is an invalid ERC-6492 wrapped signature.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SignatureErc6492.InvalidWrappedSignatureError"})}}function rn(e,t={}){let{recovered:r}=t;if(void 0===e.r||void 0===e.s||r&&void 0===e.yParity)throw new ra({signature:e});if(e.r<0n||e.r>tz)throw new rl({value:e.r});if(e.s<0n||e.s>tz)throw new rc({value:e.s});if("number"==typeof e.yParity&&0!==e.yParity&&1!==e.yParity)throw new ru({value:e.yParity})}function ri(e){if(130!==e.length&&132!==e.length)throw new ro({signature:e});let t=BigInt(tr.tP(e,0,32)),r=BigInt(tr.tP(e,32,64)),n=(()=>{let t=Number(`0x${e.slice(130)}`);if(!Number.isNaN(t))try{return rs(t)}catch{throw new ru({value:t})}})();return void 0===n?{r:t,s:r}:{r:t,s:r,yParity:n}}function rs(e){if(0===e||27===e)return 0;if(1===e||28===e)return 1;if(e>=35)return e%2==0?1:0;throw new rf({value:e})}class ro extends te.G{constructor({signature:e}){super(`Value \`${e}
254\` is an invalid signature size.`,{metaMessages:["Expected: 64 bytes or 65 bytes.",`Received ${tr.dp(tr.Dp(e))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSerializedSizeError"})}}class ra extends te.G{constructor({signature:e}){super(`Signature \`${tl.Pz(e)}\` is missing either an \`r\`, \`s\`, or \`yParity\` property.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.MissingPropertiesError"})}}class rl extends te.G{constructor({value:e}){super(`Value \`${e}\` is an invalid r value. r must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidRError"})}}class rc extends te.G{constructor({value:e}){super(`Value \`${e}\` is an invalid s value. s must be a positive integer less than 2^256.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSError"})}}class ru extends te.G{constructor({value:e}){super(`Value \`${e}\` is an invalid y-parity value. Y-parity must be 0 or 1.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidYParityError"})}}class rf extends te.G{constructor({value:e}){super(`Value \`${e}\` is an invalid v value. v must be 27, 28 or >=35.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidVError"})}}let rh=tY("(uint256 chainId, address delegation, uint256 nonce, uint8 yParity, uint256 r, uint256 s), address to, bytes data");function rd(e){if("string"==typeof e){if("0x8010801080108010801080108010801080108010801080108010801080108010"!==tr.tP(e,-32))throw new rp(e)}else rn(e.authorization)}class rp extends te.G{constructor(e){super(`Value \`${e}\` is an invalid ERC-8010 wrapped signature.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"SignatureErc8010.InvalidWrappedSignatureError"})}}var rg=r(1341),ry=r(87611);async function rm({address:e,authorization:t,signature:r}){return(0,eS.E)((0,eU.K)(e),await (0,ry.z)({authorization:t,signature:r}))}var rb=r(65462),rw=r(90677);async function rv(e,t){let{address:r,chain:n=e.chain,hash:i,erc6492VerifierAddress:s=t.universalSignatureVerifierAddress??n?.contracts?.erc6492Verifier?.address,multicallAddress:o=t.multicallAddress??n?.contracts?.multicall3?.address,mode:a="auto"}=t;if(n?.verifyHash)return await n.verifyHash(e,t);let c=(()=>{let e=t.signature;return(0,y.v)(e)?e:"object"==typeof e&&"r"in e&&"s"in e?function({r:e,s:t,to:r="hex",v:n,yParity:i}){let s=(()=>{if(0===i||1===i)return i;if(n&&(27n===n||28n===n||n>=35n))return n%2n===0n?1:0;throw Error("Invalid `v` or `yParity` value")})(),o=`0x${new rw.secp256k1.Signature((0,eE.y_)(e),(0,eE.y_)(t)).toCompactHex()}${0===s?"1b":"1c"}`;return"hex"===r?o:(0,p.nr)(o)}(e):(0,l.ci)(e)})();try{if("eoa"===a)try{if((0,eS.E)((0,eU.K)(r),await (0,rb.R)({hash:i,signature:c})))return!0}catch{}if(function(e){try{return rd(e),!0}catch{return!1}}(c))return await rE(e,{...t,multicallAddress:o,signature:c});return await rx(e,{...t,verifierAddress:s,signature:c})}catch(e){if("eoa"!==a)try{if((0,eS.E)((0,eU.K)(r),await (0,rb.R)({hash:i,signature:c})))return!0}catch{}if(e instanceof rA)return!1;throw e}}async function rE(e,t){let{address:r,blockNumber:i,blockTag:o,hash:a,multicallAddress:c}=t,{authorization:u,data:f,signature:h,to:p}=function(e){rd(e);let t=tr.He(tr.tP(e,-64,-32)),r=tr.tP(e,-t-64,-64),n=tr.tP(e,0,-t-64),[i,s,o]=function(e,t,r={}){let{as:n="Array",checksumAddress:i=!1}=r,s="string"==typeof t?tf(t):t,o=function(e,{recursiveReadLimit:t=8192}={}){let r=Object.create(tV);return r.bytes=e,r.dataView=new DataView(e.buffer,e.byteOffset,e.byteLength),r.positionReadCount=new Map,r.recursiveReadLimit=t,r}(s);if(0===th(s)&&e.length>0)throw new tQ;if(th(s)&&32>th(s))throw new tX({data:"string"==typeof t?t:tr.xv(t),parameters:e,size:th(s)});let a=0,l="Array"===n?[]:{};for(let t=0;t<e.length;++t){let r=e[t];o.setPosition(a);let[s,c]=function e(t,r,n){let{checksumAddress:i,staticPosition:s}=n,o=tq(r.type);
vendor: 4,438 bytes, line 254
254if(o){let[n,a]=o;return function(t,r,n){let{checksumAddress:i,length:s,staticPosition:o}=n;if(!s){let n=o+td(t.readBytes(32)),s=n+32;t.setPosition(n);let a=td(t.readBytes(32)),l=tW(r),c=0,u=[];for(let n=0;n<a;++n){t.setPosition(s+(l?32*n:c));let[o,a]=e(t,r,{checksumAddress:i,staticPosition:s});c+=a,u.push(o)}return t.setPosition(o+32),[u,32]}if(tW(r)){let n=o+td(t.readBytes(32)),a=[];for(let o=0;o<s;++o){t.setPosition(n+32*o);let[s]=e(t,r,{checksumAddress:i,staticPosition:n});a.push(s)}return t.setPosition(o+32),[a,32]}let a=0,l=[];for(let n=0;n<s;++n){let[n,s]=e(t,r,{checksumAddress:i,staticPosition:o+a});a+=s,l.push(n)}return[l,a]}(t,{...r,type:a},{checksumAddress:i,length:n,staticPosition:s})}if("tuple"===r.type)return function(t,r,n){let{checksumAddress:i,staticPosition:s}=n,o=0===r.components.length||r.components.some(({name:e})=>!e),a=o?[]:{},l=0;if(tW(r)){let n=s+td(t.readBytes(32));for(let s=0;s<r.components.length;++s){let c=r.components[s];t.setPosition(n+l);let[u,f]=e(t,c,{checksumAddress:i,staticPosition:n});l+=f,a[o?s:c?.name]=u}return t.setPosition(s+32),[a,32]}for(let n=0;n<r.components.length;++n){let c=r.components[n],[u,f]=e(t,c,{checksumAddress:i,staticPosition:s});a[o?n:c?.name]=u,l+=f}return[a,l]}(t,r,{checksumAddress:i,staticPosition:s});if("address"===r.type)return function(e,t={}){let r;let{checksum:n=!1}=t,i=e.readBytes(32);return[(r=tr.xv(function(e,t,r,n={}){var i,s;let{strict:o}=n;i=0,s=0;let a=e.slice(-20,void 0);return o&&function(e,t,r){if("number"==typeof r&&th(e)!==r-t)throw new tm({offset:r,position:"end",size:th(e)})}(a,-20,void 0),a}(i,0)),n?tA(r):r),32]}(t,{checksum:i});if("bool"===r.type)return[function(e,t={}){let{size:r}=t,n=e;if(void 0!==r&&(tn(n,r),n=tp(n)),n.length>1||n[0]>1)throw new tg(n);return!!n[0]}(t.readBytes(32),{size:32}),32];if(r.type.startsWith("bytes"))return function(e,t,{staticPosition:r}){let[n,i]=t.type.split("bytes");if(!i){let t=td(e.readBytes(32));e.setPosition(r+t);let n=td(e.readBytes(32));if(0===n)return e.setPosition(r+32),["0x",32];let i=e.readBytes(n);return e.setPosition(r+32),[tr.xv(i),32]}return[tr.xv(e.readBytes(Number.parseInt(i,10),32)),32]}(t,r,{staticPosition:s});if(r.type.startsWith("uint")||r.type.startsWith("int"))return function(e,t){let r=t.type.startsWith("int"),n=Number.parseInt(t.type.split("int")[1]||"256",10),i=e.readBytes(32);return[n>48?function(e,t={}){let{size:r}=t;void 0!==r&&tn(e,r);let n=tr.xv(e,t);return tr.Gh(n,t)}(i,{signed:r}):td(i,{signed:r}),32]}(t,r);if("string"===r.type)return function(e,{staticPosition:t}){let r=td(e.readBytes(32));e.setPosition(t+r);let n=td(e.readBytes(32));if(0===n)return e.setPosition(t+32),["",32];let i=function(e,t={}){let{size:r}=t,n=e;return void 0!==r&&(tn(n,r),n=to(n,{dir:"right"})),tc.decode(n)}(tp(e.readBytes(n,32)));return e.setPosition(t+32),[i,32]}(t,{staticPosition:s});throw new t5(r.type)}(o,r,{checksumAddress:i,staticPosition:0});a+=c,"Array"===n?l.push(s):l[r.name??t]=s}return l}(rh,r);return{authorization:function(e,t={}){return"string"==typeof e.chainId?function(e){let{address:t,chainId:r,nonce:n}=e,i=function(e){if(void 0!==e.r&&void 0!==e.s)return function(e){let t=(()=>"string"==typeof e?ri(e):e instanceof Uint8Array?ri(tr.xv(e)):"string"==typeof e.r?function(e){let t=(()=>{let t=e.v?Number(e.v):void 0,r=e.yParity?Number(e.yParity):void 0;if("number"==typeof t&&"number"!=typeof r&&(r=rs(t)),"number"!=typeof r)throw new ru({value:e.yParity});return r})();return{r:BigInt(e.r),s:BigInt(e.s),yParity:t}}(e):e.v?{r:e.r,s:e.s,yParity:rs(e.v)}:{r:e.r,s:e.s,...void 0!==e.yParity?{yParity:e.yParity}:{}})();return rn(t),t}(e)}(e);return{address:t,chainId:Number(r),nonce:BigInt(n),...i}}(e):{...e,...t.signature}}({address:i.delegation,chainId:Number(i.chainId),nonce:i.nonce,yParity:i.yParity,r:i.r,s:i.s}),signature:n,...o&&"0x"!==o?{data:o,to:s}:{}}}(t.signature);if(await eA(e,{address:r,blockNumber:i,blockTag:o})===(0,d.SM)(["0xef0100",u.address]))return await r_(e,{address:r,blockNumber:i,blockTag:o,hash:a,signature:h});let g={address:u.address,chainId:Number(u.chainId),nonce:Number(u.nonce),r:(0,l.eC)(u.r,{size:32}),s:(0,l.eC)(u.s,{size:32}),yParity:u.yParity};if(!await rm({address:r,authorization:g}))throw new rA;let y=await (0,v.s)(e,_,"readContract")({...c?{address:c}:{code:eY.xd},authorizationList:[g],abi:n.F8,blockNumber:i,blockTag:"pending",functionName:"aggregate3",args:[[...f?[{allowFailure:!0,target:p??r,callData:f}
vendor: 4,950 bytes, lines 254-255
254]:[],{allowFailure:!0,target:r,callData:(0,s.R)({abi:n._A,functionName:"isValidSignature",args:[a,h]})}]]}),m=y[y.length-1]?.returnData;if(m?.startsWith("0x1626ba7e"))return!0;throw new rA}async function rx(e,t){let{address:r,factory:i,factoryData:o,hash:a,signature:l,verifierAddress:c,...f}=t,h=await (async()=>!i&&!o||function(e){try{return!function(e){if(tr.tP(e,-32)!==rt)throw new rr(e)}(e),!0}catch{return!1}}(l)?l:function(e){let{data:t,signature:r,to:n}=e;return tr.zo(tZ(tY("address, bytes, bytes"),[n,t,r]),rt)}({data:o,signature:l,to:i}))(),d=c?{to:c,data:(0,s.R)({abi:n.MR,functionName:"isValidSig",args:[r,a,h]}),...f}:{data:(0,rg.w)({abi:n.MR,args:[r,a,h],bytecode:eY.de}),...f},{data:p}=await (0,v.s)(e,x.R,"call")(d).catch(e=>{if(e instanceof u.cg)throw new rA;throw e});if((0,eE.XA)(p??"0x0"))return!0;throw new rA}async function r_(e,t){let{address:r,blockNumber:i,blockTag:s,hash:o,signature:a}=t;if((await (0,v.s)(e,_,"readContract")({address:r,abi:n._A,args:[o,a],blockNumber:i,blockTag:s,functionName:"isValidSignature"}).catch(e=>{if(e instanceof u.uq)throw new rA;throw e})).startsWith("0x1626ba7e"))return!0;throw new rA}class rA extends Error{}function rS(e,t){return(0,g.w)(function(e){let t="string"==typeof e?(0,l.$G)(e):"string"==typeof e.raw?e.raw:(0,l.ci)(e.raw),r=(0,l.$G)(`\x19Ethereum Signed Message: 255${(0,eP.d)(t)}`);return(0,d.zo)([r,t])}(e),t)}async function rI(e,{address:t,message:r,factory:n,factoryData:i,signature:s,...o}){let a=rS(r);return(0,v.s)(e,rv,"verifyHash")({address:t,factory:n,factoryData:i,hash:a,signature:s,...o})}var rO=r(17548);function rP({data:e,primaryType:t,types:r}){let n=function e({data:t,primaryType:r,types:n}){let i=[{type:"bytes32"}],s=[function({primaryType:e,types:t}){let r=(0,l.NC)(function({primaryType:e,types:t}){let r="",n=function e({primaryType:t,types:r},n=new Set){let i=t.match(/^\w*/u),s=i?.[0];if(n.has(s)||void 0===r[s])return n;for(let t of(n.add(s),r[s]))e({primaryType:t.type,types:r},n);return n}({primaryType:e,types:t});for(let i of(n.delete(e),[e,...Array.from(n).sort()]))r+=`${i}(${t[i].map(({name:e,type:t})=>`${t} ${e}`).join(",")})`;return r}({primaryType:e,types:t}));return(0,g.w)(r)}({primaryType:r,types:n})];for(let o of n[r]){let[r,a]=function t({types:r,name:n,type:i,value:s}){if(void 0!==r[i])return[{type:"bytes32"},(0,g.w)(e({data:s,primaryType:i,types:r}))];if("bytes"===i)return[{type:"bytes32"},(0,g.w)(s)];if("string"===i)return[{type:"bytes32"},(0,g.w)((0,l.NC)(s))];if(i.lastIndexOf("]")===i.length-1){let e=i.slice(0,i.lastIndexOf("[")),o=s.map(i=>t({name:n,type:e,types:r,value:i}));return[{type:"bytes32"},(0,g.w)((0,en.E)(o.map(([e])=>e),o.map(([,e])=>e)))]}return[{type:i},s]}({types:n,name:o.name,type:o.type,value:t[o.name]});i.push(r),s.push(a)}return(0,en.E)(i,s)}({data:e,primaryType:t,types:r});return(0,g.w)(n)}async function rC(e,t){let{address:r,factory:n,factoryData:i,signature:s,message:o,primaryType:a,types:l,domain:c,...u}=t,f=function(e){let{domain:t={},message:r,primaryType:n}=e,i={EIP712Domain:(0,rO.cj)({domain:t}),...e.types};(0,rO.iC)({domain:t,message:r,primaryType:n,types:i});let s=["0x1901"];return t&&s.push(function({domain:e,types:t}){return rP({data:e,primaryType:"EIP712Domain",types:t})}({domain:t,types:i})),"EIP712Domain"!==n&&s.push(rP({data:r,primaryType:n,types:i})),(0,g.w)((0,d.zo)(s))}({message:o,primaryType:a,types:l,domain:c});return(0,v.s)(e,rv,"verifyHash")({address:r,factory:n,factoryData:i,hash:f,signature:s,...u})}var rk=r(29612),rT=r(73180),rB=r(16550),rR=r(88778),rD=r(70153),rU=r(42345);let rM=/^(?:(?<scheme>[a-zA-Z][a-zA-Z0-9+-.]*):\/\/)?(?<domain>[a-zA-Z0-9+-.]*(?::[0-9]{1,5})?) (?:wants you to sign in with your Ethereum account:\n)(?<address>0x[a-fA-F0-9]{40})\n\n(?:(?<statement>.*)\n\n)?/,rN=/(?:URI: (?<uri>.+))\n(?:Version: (?<version>.+))\n(?:Chain ID: (?<chainId>\d+))\n(?:Nonce: (?<nonce>[a-zA-Z0-9]+))\n(?:Issued At: (?<issuedAt>.+))(?:\nExpiration Time: (?<expirationTime>.+))?(?:\nNot Before: (?<notBefore>.+))?(?:\nRequest ID: (?<requestId>.+))?/;var rj=r(40053);async function rL(e,t){let{address:r,domain:n,message:i,nonce:s,scheme:o,signature:a,time:l=new Date,...c}=t,u=function(e){let{scheme:t,statement:r,...n}=e.match(rM)?.groups??{},{chainId:i,expirationTime:s,issuedAt:o,notBefore:a,requestId:l,...c}=e.match(rN)?.groups??{},u=e.split("Resources:")[1]?.split("\n- ").slice(1);return{...n,...c,...i?{chainId:Number(i)}:{},...s?{expirationTime:new Date(s)}:{},...o?{issuedAt:new Date(o)}:{},...a?{notBefore:new Date(a)}:{},...l?{requestId:l}:{},...u?{resources:u}:{},...t?{scheme:t}:{},...r?{statement:r}:{}}}(i);if(!u.address||!function(e){let{address:t,domain:r,message:n,nonce:i,scheme:s,time:o=new Date}=e;if(r&&n.domain!==r||i&&n.nonce!==i||s&&n.scheme!==s||n.expirationTime&&o>=n.expirationTime||n.notBefore&&o<n.notBefore)return!1;try{if(!n.address||!(0,rj.U)(n.address,{strict:!1})||t&&!(0,eS.E)(n.address,t))return!1}catch{return!1}return!0}
255({address:r,domain:n,message:u,nonce:s,scheme:o,time:l}))return!1;let f=rS(i);return rv(e,{address:u.address,hash:f,signature:a,...c})}var r$=r(94143),rz=r(77527),rF=r(34944);function rq(e){return{call:t=>(0,x.R)(e,t),createAccessList:t=>Y(e,t),createBlockFilter:()=>Q(e),createContractEventFilter:t=>ec(e,t),createEventFilter:t=>eu(e,t),createPendingTransactionFilter:()=>ef(e),estimateContractGas:t=>ed(e,t),estimateGas:t=>(0,eh.Q)(e,t),getBalance:t=>em(e,t),getBlobBaseFee:()=>eb(e),getBlock:t=>(0,ew.Q)(e,t),getBlockNumber:t=>(0,ev.z)(e,t),getBlockTransactionCount:t=>ex(e,t),getBytecode:t=>eA(e,t),getChainId:()=>(0,e_.L)(e),getCode:t=>eA(e,t),getContractEvents:t=>eD(e,t),getDelegation:t=>eN(e,t),getEip712Domain:t=>eL(e,t),getEnsAddress:t=>A(e,t),getEnsAvatar:t=>q(e,t),getEnsName:t=>W(e,t),getEnsResolver:t=>V(e,t),getEnsText:t=>F(e,t),getFeeHistory:t=>ez(e,t),estimateFeesPerGas:t=>(0,ep.X)(e,t),getFilterChanges:t=>eF(e,t),getFilterLogs:t=>eq(e,t),getGasPrice:()=>(0,eW.o)(e),getLogs:t=>eR(e,t),getProof:t=>eV(e,t),estimateMaxPriorityFeePerGas:t=>(0,eg._)(e,t),fillTransaction:t=>(0,ey.b)(e,t),getStorageAt:t=>eH(e,t),getTransaction:t=>(0,eG.f)(e,t),getTransactionConfirmations:t=>eK(e,t),getTransactionCount:t=>(0,eZ.K)(e,t),getTransactionReceipt:t=>(0,eJ.a)(e,t),multicall:t=>eX(e,t),prepareTransactionRequest:t=>(0,r$.ZE)(e,t),readContract:t=>_(e,t),sendRawTransaction:t=>(0,rz.p)(e,t),sendRawTransactionSync:t=>(0,rF.s)(e,t),simulate:t=>e5(e,t),simulateBlocks:t=>e5(e,t),simulateCalls:t=>t9(e,t),simulateContract:t=>t7(e,t),verifyHash:t=>rv(e,t),verifyMessage:t=>rI(e,t),verifySiweMessage:t=>rL(e,t),verifyTypedData:t=>rC(e,t),uninstallFilter:t=>re(e,t),waitForTransactionReceipt:t=>(0,rk.e)(e,t),watchBlocks:t=>(function(e,{blockTag:t=e.experimental_blockTag??"latest",emitMissed:r=!1,emitOnBegin:n=!1,onBlock:i,onError:s,includeTransactions:o,poll:a,pollingInterval:l=e.pollingInterval}){let c,u,f,h;let d=void 0!==a?a:"webSocket"!==e.transport.type&&"ipc"!==e.transport.type&&("fallback"!==e.transport.type||"webSocket"!==e.transport.transports[0].c
255onfig.type&&"ipc"!==e.transport.transports[0].config.type),p=o??!1;return d?(()=>{let o=(0,rD.P)(["watchBlocks",e.uid,t,r,n,p,l]);return(0,rB.N7)(o,{onBlock:i,onError:s},i=>(0,rR.$)(async()=>{try{let n=await (0,v.s)(e,ew.Q,"getBlock")({blockTag:t,includeTransactions:p});if(null!==n.number&&c?.number!=null){if(n.number===c.number)return;if(n.number-c.number>1&&r)for(let t=c?.number+1n;t<n.number;t++){let r=await (0,v.s)(e,ew.Q,"getBlock")({blockNumber:t,includeTransactions:p});i.onBlock(r,c),c=r}}(c?.number==null||"pending"===t&&n?.number==null||null!==n.number&&n.number>c.number)&&(i.onBlock(n,c),c=n)}catch(e){i.onError?.(e)}},{emitOnBegin:n,interval:l}))})():(u=!0,f=!0,h=()=>u=!1,(async()=>{try{n&&(0,v.s)(e,ew.Q,"getBlock")({blockTag:t,includeTransactions:p}).then(e=>{u&&f&&(i(e,void 0),f=!1)}).catch(s);let r=(()=>{if("fallback"===e.transport.type){let t=e.transport.transports.find(e=>"webSocket"===e.config.type||"ipc"===e.config.type);return t?t.value:e.transport}return e.transport})(),{unsubscribe:o}=await r.subscribe({params:["newHeads"],async onData(t){if(!u)return;let r=await (0,v.s)(e,ew.Q,"getBlock")({blockNumber:t.result?.number,includeTransactions:p}).catch(()=>{});u&&(i(r,c),f=!1,c=r)},onError(e){s?.(e)}});h=o,u||h()}catch(e){s?.(e)}})(),()=>h())})(e,t),watchBlockNumber:t=>(0,rT.q)(e,t),watchContractEvent:t=>(function(e,t){let{abi:r,address:n,args:i,batch:s=!0,eventName:o,fromBlock:a,onError:l,onLogs:c,poll:u,pollingInterval:f=e.pollingInterval,strict:h}=t;return(void 0!==u?u:"bigint"==typeof a||"webSocket"!==e.transport.type&&"ipc"!==e.transport.type&&("fallback"!==e.transport.type||"webSocket"!==e.transport.transports[0].c
255onfig.type&&"ipc"!==e.transport.transports[0].config.type))?(()=>{let t=h??!1,u=(0,rD.P)(["watchContractEvent",n,i,s,e.uid,o,f,t,a]);return(0,rB.N7)(u,{onLogs:c,onError:l},l=>{let c,u;void 0!==a&&(c=a-1n);let h=!1,d=(0,rR.$)(async()=>{if(!h){try{u=await (0,v.s)(e,ec,"createContractEventFilter")({abi:r,address:n,args:i,eventName:o,strict:t,fromBlock:a})}catch{}h=!0;return}try{let a;if(u)a=await (0,v.s)(e,eF,"getFilterChanges")({filter:u});else{let s=await (0,v.s)(e,ev.z,"getBlockNumber")({});a=c&&c<s?await (0,v.s)(e,eD,"getContractEvents")({abi:r,address:n,args:i,eventName:o,fromBlock:c+1n,toBlock:s,strict:t}):[],c=s}if(0===a.length)return;if(s)l.onLogs(a);else for(let e of a)l.onLogs([e])}catch(e){u&&e instanceof rU.yR&&(h=!1),l.onError?.(e)}},{emitOnBegin:!0,interval:f});return async()=>{u&&await (0,v.s)(e,re,"uninstallFilter")({filter:u}),d()}})})():(()=>{let t=(0,rD.P)(["watchContractEvent",n,i,s,e.uid,o,f,h??!1]),a=!0,u=()=>a=!1;return(0,rB.N7)(t,{onLogs:c,onError:l},t=>((async()=>{try{let s=(()=>{if("fallback"===e.transport.type){let t=e.transport.transports.find(e=>"webSocket"===e.config.type||"ipc"===e.config.type);return t?t.value:e.transport}return e.transport})(),l=o?ea({abi:r,eventName:o,args:i}):[],{unsubscribe:c}=await s.subscribe({params:["logs",{address:n,topics:l}],onData(e){if(!a)return;let n=e.result;try{let{eventName:e,args:i}=eT({abi:r,data:n.data,topics:n.topics,strict:h}),s=(0,eI.U)(n,{args:i,eventName:e});t.onLogs([s])}catch(s){let e,r;if(s instanceof ee.SM||s instanceof ee.Gy){if(h)return;e=s.abiItem.name,r=s.abiItem.inputs?.some(e=>!("name"in e&&e.name))}let i=(0,eI.U)(n,{args:r?[]:{},eventName:e});t.onLogs([i])}},onError(e){t.onError?.(e)}});u=c,a||u()}catch(e){l?.(e)}})(),()=>u()))})()})(e,t),watchEvent:t=>(function(e,{address:t,args:r,batch:n=!0,event:i,events:s,fromBlock:o,onError:a,onLogs:l,poll:c,pollingInterval:u=e.pollingInterval,strict:f}){let h,d;let p=void 0!==c?c:"bigint"==typeof o||"webSocket"!==e.transport.type&&"ipc"!==e.transport.type&&("fallback"!==e.transport.type||"webSocket"!==e.transport.transports[0].c
255onfig.type&&"ipc"!==e.transport.transports[0].config.type),g=f??!1;return p?(()=>{let c=(0,rD.P)(["watchEvent",t,r,n,e.uid,i,u,o]);return(0,rB.N7)(c,{onLogs:l,onError:a},a=>{let l,c;void 0!==o&&(l=o-1n);let f=!1,h=(0,rR.$)(async()=>{if(!f){try{c=await (0,v.s)(e,eu,"createEventFilter")({address:t,args:r,event:i,events:s,strict:g,fromBlock:o})}catch{}f=!0;return}try{let o;if(c)o=await (0,v.s)(e,eF,"getFilterChanges")({filter:c});else{let n=await (0,v.s)(e,ev.z,"getBlockNumber")({});o=l&&l!==n?await (0,v.s)(e,eR,"getLogs")({address:t,args:r,event:i,events:s,fromBlock:l+1n,toBlock:n}):[],l=n}if(0===o.length)return;if(n)a.onLogs(o);else for(let e of o)a.onLogs([e])}catch(e){c&&e instanceof rU.yR&&(f=!1),a.onError?.(e)}},{emitOnBegin:!0,interval:u});return async()=>{c&&await (0,v.s)(e,re,"uninstallFilter")({filter:c}),h()}})})():(h=!0,d=()=>h=!1,(async()=>{try{let n=(()=>{if("fallback"===e.transport.type){let t=e.transport.transports.find(e=>"webSocket"===e.config.type||"ipc"===e.config.type);return t?t.value:e.transport}return e.transport})(),o=s??(i?[i]:void 0),c=[];o&&(c=[o.flatMap(e=>ea({abi:[e],eventName:e.name,args:r}))],i&&(c=c[0]));let{unsubscribe:u}=await n.subscribe({params:["logs",{address:t,topics:c}],onData(e){if(!h)return;let t=e.result;try{let{eventName:e,args:r}=eT({abi:o??[],data:t.data,topics:t.topics,strict:g}),n=(0,eI.U)(t,{args:r,eventName:e});l([n])}catch(i){let e,r;if(i instanceof ee.SM||i instanceof ee.Gy){if(f)return;e=i.abiItem.name,r=i.abiItem.inputs?.some(e=>!("name"in e&&e.name))}let n=(0,eI.U)(t,{args:r?[]:{},eventName:e});l([n])}},onError(e){a?.(e)}});d=u,h||d()}catch(e){a?.(e)}})(),()=>d())})(e,t),watchPendingTransactions:t=>(function(e,{batch:t=!0,onError:r,onTransactions:n,poll:i,pollingInterval:s=e.pollingInterval}){let o,a;return(void 0!==i?i:"webSocket"!==e.transport.type&&"ipc"!==e.transport.type)?(()=>{let i=(0,rD.P)(["watchPendingTransactions",e.uid,t,s]);return(0,rB.N7)(i,{onTransactions:n,onError:r},r=>{let n;let i=(0,rR.$)(async()=>{try{if(!n)try{n=await (0,v.s)(e,ef,"createPendingTransactionFilter")({});return}catch(e){throw i(),e}let s=await (0,v.s)(e,eF,"getFilterChanges")({filter:n});if(0===s.length)return;if(t)r.onTransactions(s);else for(let e of s)r.onTransactions([e])}catch(e){r.onError?.(e)}},{emitOnBegin:!0,interval:s});return async()=>{n&&await (0,v.s)(e,re,"uninstallFilter")({filter:n}),i()}})})():(o=!0,a=()=>o=!1,(async()=>{try{let{unsubscribe:t}=await e.transport.subscribe({params:["newPendingTransactions"],onData(e){if(!o)return;let t=e.result;n([t])},onError(e){r?.(e)}});a=t,o||a()}catch(e){r?.(e)}})(),()=>a())})(e,t)}}},79645:function(e,t,r){"use strict";r.d(t,{q:function(){return f}});var n=r(64358),i=r(89247),s=r(42345),o=r(62851);let a=new(r(91544)).k(8192);var l=r(73318),c=r(70153),u=r(69404);function f({key:e,methods:t,name:r,request:f,retryCount:h=3,retryDelay:d=150,timeout:p,type:g},y){return{config:{key:e,methods:t,name:r,request:f,retryCount:h,retryDelay:d,timeout:p,type:g},request:function(e,t={}){return async(r,u={})=>{let{dedupe:f=!1,methods:h,retryDelay:d=150,retryCount:p=3,uid:g}={...t,...u},{method:y}=r;if(h?.exclude?.includes(y)||h?.include&&!h.include.includes(y))throw new s.gS(Error("method not supported"),{method:y});let m=f?(0,o.$G)(`${g}.${(0,c.P)(r)}`):void 0;return function(e,{enabled:t=!0,id:r}){if(!t||!r)return e();if(a.get(r))return a.get(r);let n=e().finally(()=>a.delete(r));return a.set(r,n),n}(()=>(0,l.J)(async()=>{try{return await e(r)}catch(e){switch(e.code){case s.s7.code:throw new s.s7(e);case s.B.code:throw new s.B(e);case s.LX.code:throw new s.LX(e,{method:r.method});case s.nY.code:throw new s.nY(e);case s.XS.code:throw new s.XS(e);case s.yR.code:throw new s.yR(e);case s.Og.code:throw new s.Og(e);case s.pT.code:throw new s.pT(e);case s.KB.code:throw new s.KB(e);case s.gS.code:throw new s.gS(e,{method:r.method});case s.Pv.code:throw new s.Pv(e);case s.GD.code:throw new s.GD(e);case s.ab.code:throw new s.ab(e);case s.PE.code:throw new s.PE(e);case s.Ts.code:throw new s.Ts(e);case s.u5.code:throw new s.u5(e);case s.I0.code:throw new s.I0(e);case s.x3.code:throw new s.x3(e);case s.vl.code:throw new s.vl(e);case s.Uu.code:throw new s.Uu(e);case s.Nt.code:throw new s.Nt(e);case s.EJ.code:throw new s.EJ(e);case s.fl.code:throw new s.fl(e);case s.NO.code:throw new s.NO(e);case s.r0.code:throw new s.r0(e);case 5e3:throw new s.ab(e);case s.UF.code:throw new s.UF(e);default:if(e instanceof n.G)throw e;throw new s.ir(e)}}},{delay:({count:e,error:t})=>{if(t&&t instanceof i.Gg){let e=t?.headers?.get("Retry-After");if(e?.match(/\d/))return 1e3*Number.parseInt(e,10)}return~~(1<<e)*d},retryCount:p,shouldRetry:({error:e})=>"code"in e&&"number"==typeof e.code?-1===e.code||e.code===s.Pv.code||e.code===s.XS.code||429===e.code:!(e instanceof i.Gg)||!e.status||403===e.status||408===e.status||413===e.status||429===e.status||500===e.status||502===e.status||503===e.status||504===e.status}),{enabled:f,id:m})}}(f,{methods:t,retryCount:h,retryDelay:d,uid:(0,u.h)()}),value:y}}},44151:function(e,t,r){"use strict";r.d(t,{d:function(){return u}});var n=r(89247),i=r(64358);class s extends i.G{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}}var o=r(52387),a=r(70153);let l={current:0,take(){return this.current++},reset(){this.current=0}};var c=r(79645);function u(e,t={}){let{batch:r,fetchFn:i,fetchOptions:u,key:f="http",methods:h,name:d="HTTP JSON-RPC",onFetchRequest:p,onFetchResponse:g,retryDelay:y,raw:m}=t;return({chain:b,retryCount:w,timeout:v})=>{let{batchSize:E=1e3,wait:x=0}="object"==typeof r?r:{},_=t.retryCount??w,A=v??t.timeout??1e4,S=e||b?.rpcUrls.default.http[0];if(!S)throw new s;let I=function(e,t={}){let{url:r,headers:i}=function(e){try{let t=new URL(e),r=(()=>
255{if(t.username){let e=`${decodeURIComponent(t.username)}:${decodeURIComponent(t.password)}`;return t.username="",t.password="",{url:t.toString(),headers:{Authorization:`Basic ${btoa(e)}`}}}})();return{url:t.toString(),...r}}catch{return{url:e}}}(e);return{async request(e){let{body:s,fetchFn:o=t.fetchFn??fetch,onRequest:c=t.onRequest,onResponse:u=t.onResponse,timeout:f=t.timeout??1e4}=e,h={...t.fetchOptions??{},...e.fetchOptions??{}},{headers:d,method:p,signal:g}=h;try{let e;let t=await function(e,{errorInstance:t=Error("timed out"),timeout:r,signal:n}){return new Promise((i,s)=>{(async()=>{let o;try{let a=new AbortController;r>0&&(o=setTimeout(()=>{n?a.abort():s(t)},r)),i(await e({signal:a?.signal||null}))}catch(e){e?.name==="AbortError"&&s(t),s(e)}finally{clearTimeout(o)}})()})}(async({signal:e})=>{let t={...h,body:Array.isArray(s)?(0,a.P)(s.map(e=>({jsonrpc:"2.0",id:e.id??l.take(),...e}))):(0,a.P)({jsonrpc:"2.0",id:s.id??l.take(),...s}),headers:{...i,"Content-Type":"application/json",...d},method:p||"POST",signal:g||(f>0?e:null)},n=new Request(r,t),u=await c?.(n,t)??{...t,url:r};return await o(u.url??r,u)},{errorInstance:new n.W5({body:s,url:r}),timeout:f,signal:!0});if(u&&await u(t),t.headers.get("Content-Type")?.startsWith("application/json"))e=await t.json();else{e=await t.text();try{e=JSON.parse(e||"{}")}catch(r){if(t.ok)throw r;e={error:e}}}if(!t.ok){if("number"==typeof e.error?.code&&"string"==typeof e.error?.message)return e;throw new n.Gg({body:s,details:(0,a.P)(e.error)||t.statusText,headers:t.headers,status:t.status,url:r})}return e}catch(e){if(e instanceof n.Gg||e instanceof n.W5)throw e;throw new n.Gg({body:s,cause:e,url:r})}}}}(S,{fetchFn:i,fetchOptions:u,onRequest:p,onResponse:g,timeout:A});return(0,c.q)({key:f,methods:h,name:d,async request({method:e,params:t}){let i={method:e,params:t},{schedule:s}=(0,o.S)({id:S,wait:x,shouldSplitBatch:e=>e.length>E,fn:e=>I.request({body:e}),sort:(e,t)=>e.id-t.id}),a=async e=>r?s(e):[await I.request({body:e})],[{error:l,result:c}]=await a(i);if(m)return{error:l,result:c};if(l)throw new n.bs({body:i,error:l,url:S});return c},retryCount:_,retryDelay:y,timeout:A,type:"http"},{fetchOptions:u,url:S})}}},27497:function(e,t,r){"use strict";r.d(t,{F8:function(){return n},MR:function(){return f},X$:function(){return c},Yi:function(){return i},_A:function(){return u},du:function(){return a},k3:function(){return o},nZ:function(){return l}});let n=[{inputs:[{components:[{name:"target",type:"address"},{name:"allowFailure",type:"bool"},{name:"callData",type:"bytes"}],name:"calls",type:"tuple[]"}],name:"aggregate3",outputs:[{components:[{name:"success",type:"bool"},{name:"returnData",type:"bytes"}],name:"returnData",type:"tuple[]"}],stateMutability:"view",type:"function"},{inputs:[{name:"addr",type:"address"}],name:"getEthBalance",outputs:[{name:"balance",type:"uint256"}],stateMutability:"view",type:"function"},{inputs:[],name:"getCurrentBlockTimestamp",outputs:[{internalType:"uint256",name:"timestamp",type:"uint256"}],stateMutability:"view",type:"function"}],i=[{name:"query",type:"function",stateMutability:"view",inputs:[{type:"tuple[]",name:"queries",components:[{type:"address",name:"sender"},{type:"string[]",name:"urls"},{type:"bytes",name:"data"}]}],outputs:[{type:"bool[]",name:"failures"},{type:"bytes[]",name:"responses"}]},{name:"HttpError",type:"error",inputs:[{type:"uint16",name:"status"},{type:"string",name:"message"}]}],s=[{inputs:[{name:"dns",type:"bytes"}],name:"DNSDecodingFailed",type:"error"},{inputs:[{name:"ens",type:"string"}],name:"DNSEncodingFailed",type:"error"},{inputs:[],name:"EmptyAddress",type:"error"},{inputs:[{name:"status",type:"uint16"},{name:"message",type:"string"}],name:"HttpError",type:"error"},{inputs:[],name:"InvalidBatchGatewayResponse",type:"error"},{inputs:[{name:"errorData",type:"bytes"}],name:"ResolverError",type:"error"},{inputs:[{name:"name",type:"bytes"},{name:"resolver",type:"address"}],name:"ResolverNotContract",type:"error"},{inputs:[{name:"name",type:"bytes"}],name:"ResolverNotFound",type:"error"},{inputs:[{name:"primary",type:"string"},{name:"primaryAddress",type:"bytes"}],name:"ReverseAddressMismatch",type:"error"},{inputs:[{internalType:"bytes4",name:"selector",type:"bytes4"}],name:"UnsupportedResolverProfile",type:"error"}],o=[...s,{name:"resolveWithGateways",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes"},{name:"data",type:"bytes"},{name:"gateways",type:"string[]"}],outputs:[{name:"",type:"bytes"},{name:"address",type:"address"}]}],a=[...s,{name:"reverseWithGateways",type:"function",stateMutability:"view",inputs:[{type:"bytes",name:"reverseName"},{type:"uint256",name:"coinType"},{type:"string[]",name:"gateways"}],outputs:[{type:"string",name:"resolvedName"},{type:"address",name:"resolver"},{type:"address",name:"reverseResolver"}]}],l=[{name:"text",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"key",type:"string"}],outputs:[{name:"",type:"string"}]}],c=[{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"}],outputs:[{name:"",type:"address"}]},{name:"addr",type:"function",stateMutability:"view",inputs:[{name:"name",type:"bytes32"},{name:"coinType",type:"uint256"}],outputs:[{name:"",type:"bytes"}]}],u=[{name:"isValidSignature",type:"function",stateMutability:"view",inputs:[{name:"hash",type:"bytes32"},{name:"signature",type:"bytes"}],outputs:[{name:"",type:"bytes4"}]}],f=[{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],stateMutability:"nonpayable",type:"constructor"},{inputs:[{name:"_signer",type:"address"},{name:"_hash",type:"bytes32"},{name:"_signature",type:"bytes"}],outputs:[{type:"bool"}],stateMutability:"nonpayable",type:"function",name:"isValidSig"}]},25974:function(e,t,r){"use strict";r.d(t,{NO:function(){return n},de:function(){return s},pG:function(){return i},xd:function(){return o}});let n="0x608060405234801561001057600080fd5b5060405161018e38038061018e83398101604081905261002f91610124565b6000808351602085016000f59050803b61004857600080fd5b6000808351602085016000855af16040513d6000823e81610067573d81fd5b3d81f35b634e487b7160e01b600052604160045260246000fd5b600082601f83011261009257600080fd5b81516001600160401b038111156100ab576100ab61006b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156100d9576100d961006b565b6040528181528382016020018510156100f157600080fd5b60005b82811015610110576020818601810151838301820152016100f4565b506000918101602001919091529392505050565b6000806040838503121561013757600080fd5b82516001600160401b0381111561014d57600080fd5b61015985828601610081565b
255602085015190935090506001600160401b0381111561017757600080fd5b61018385828601610081565b915050925092905056fe",i="0x608060405234801561001057600080fd5b506040516102c03803806102c083398101604081905261002f916101e6565b836001600160a01b03163b6000036100e457600080836001600160a01b03168360405161005c9190610270565b6000604051808303816000865af19150503d8060008114610099576040519150601f19603f3d011682016040523d82523d6000602084013e61009e565b606091505b50915091508115806100b857506001600160a01b0386163b155b156100e1578060405163101bb98d60e01b81526004016100d8919061028c565b60405180910390fd5b50505b6000808451602086016000885af16040513d6000823e81610103573d81fd5b3d81f35b80516001600160a01b038116811461011e57600080fd5b919050565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561015457818101518382015260200161013c565b50506000910152565b600082601f83011261016e57600080fd5b81516001600160401b0381111561018757610187610123565b604051601f8201601f19908116603f011681016001600160401b03811182821017156101b5576101b5610123565b6040528181528382016020018510156101cd57600080fd5b6101de826020830160208701610139565b949350505050565b600080600080608085870312156101fc57600080fd5b61020585610107565b60208601519094506001600160401b0381111561022157600080fd5b61022d8782880161015d565b93505061023c60408601610107565b60608601519092506001600160401b0381111561025857600080fd5b6102648782880161015d565b91505092959194509250565b60008251610282818460208701610139565b9190910192915050565b60208152600082518060208401526102ab816040850160208701610139565b601f01601f1916919091016040019291505056fe",s="0x608060405234801561001057600080fd5b5060405161069438038061069483398101604081905261002f9161051e565b600061003c848484610048565b9050806000526001601ff35b60007f64926492649264926492649264926492649264926492649264926492649264926100748361040c565b036101e7576000606080848060200190518101906100929190610577565b60405192955090935091506000906001600160a01b038516906100b69085906105dd565b6000604051808303816000865af19150503d80600081146100f3576040519150601f19603f3d011682016040523d82523d6000602084013e6100f8565b606091505b50509050876001600160a01b03163b60000361016057806101605760405162461bcd60e51b815260206004820152601e60248201527f5369676e617475726556616c696461746f723a206465706c6f796d656e74000060448201526064015b60405180910390fd5b604051630b135d3f60e11b808252906001600160a01b038a1690631626ba7e90610190908b9087906004016105f9565b602060405180830381865afa1580156101ad573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906101d19190610633565b6001600160e01b03191614945050505050610405565b6001600160a01b0384163b1561027a57604051630b135d3f60e11b808252906001600160a01b03861690631626ba7e9061022790879087906004016105f9565b602060405180830381865afa158015610244573d6000803e3d6000fd5b505050506040513d601f19601f820116820180604052508101906102689190610633565b6001600160e01b031916149050610405565b81516041146102df5760405162461bcd60e51b815260206004820152603a602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e6174757265206c656e6774680000000000006064820152608401610157565b6102e7610425565b5060208201516040808401518451859392600091859190811061030c5761030c61065d565b016020015160f81c9050601b811480159061032b57508060ff16601c14155b1561038c5760405162461bcd60e51b815260206004820152603b602482015260008051602061067483398151915260448201527f3a20696e76616c6964207369676e617475726520762076616c756500000000006064820152608401610157565b60408051600081526020810180835289905260ff83169181019190915260608101849052608081018390526001600160a01b0389169060019060a0016020604051602081039080840390855afa1580156103ea573d6000803e3d6000fd5b505050602060405103516001600160a01b0316149450505050505b9392505050565b600060208251101561041d57600080fd5b508051015190565b60405180606001604052806003906020820280368337509192915050565b6001600160a01b038116811461045857600080fd5b50565b634e487b7160e01b600052604160045260246000fd5b60005b8381101561048c578181015183820152602001610474565b50506000910152565b600082601f8301126104a657600080fd5b81516001600160401b038111156104bf576104bf61045b565b604051601f8201601f19908116603f011681016001600160401b03811182821017156104ed576104ed61045b565b60405281815283820160200185101561050557600080fd5b610516826020830160208701610471565b949350505050565b60008060006060848
255603121561053357600080fd5b835161053e81610443565b6020850151604086015191945092506001600160401b0381111561056157600080fd5b61056d86828701610495565b9150509250925092565b60008060006060848603121561058c57600080fd5b835161059781610443565b60208501519093506001600160401b038111156105b357600080fd5b6105bf86828701610495565b604086015190935090506001600160401b0381111561056157600080fd5b600082516105ef818460208701610471565b9190910192915050565b828152604060208201526000825180604084015261061e816060850160208701610471565b601f01601f1916919091016060019392505050565b60006020828403121561064557600080fd5b81516001600160e01b03198116811461040557600080fd5b634e487b7160e01b600052603260045260246000fdfe5369676e617475726556616c696461746f72237265636f7665725369676e6572",o="0x608060405234801561001057600080fd5b506115b9806100206000396000f3fe6080604052600436106100f35760003560e01c80634d2301cc1161008a578063a8b0574e11610059578063a8b0574e14610325578063bce38bd714610350578063c3077fa914610380578063ee82ac5e146103b2576100f3565b80634d2301cc1461026257806372425d9d1461029f57806382ad56cb146102ca57806386d516e8146102fa576100f3565b80633408e470116100c65780633408e470146101af578063399542e9146101da5780633e64a6961461020c57806342cbb15c14610237576100f3565b80630f28c97d146100f8578063174dea7114610123578063252dba421461015357806327e86d6e14610184575b600080fd5b34801561010457600080fd5b5061010d6103ef565b60405161011a9190610c0a565b60405180910390f35b61013d60048036038101906101389190610c94565b6103f7565b60405161014a9190610e94565b60405180910390f35b61016d60048036038101906101689190610f0c565b610615565b60405161017b92919061101b565b60405180910390f35b34801561019057600080fd5b506101996107ab565b6040516101a69190611064565b60405180910390f35b3480156101bb57600080fd5b506101c46107b7565b6040516101d19190610c0a565b60405180910390f35b6101f460048036038101906101ef91906110ab565b6107bf565b6040516102039392919061110b565b60405180910390f35b34801561021857600080fd5b506102216107e1565b60405161022e9190610c0a565b60405180910390f35b34801561024357600080fd5b5061024c6107e9565b6040516102599190610c0a565b60405180910390f35b34801561026e57600080fd5b50610289600480360381019061028491906111a7565b6107f1565b6040516102969190610c0a565b60405180910390f35b3480156102ab57600080fd5b506102b4610812565b6040516102c19190610c0a565b60405180910390f35b6102e460048036038101906102df919061122a565b61081a565b6040516102f19190610e94565b60405180910390f35b34801561030657600080fd5b5061030f6109e4565b60405161031c9190610c0a565b60405180910390f35b34801561033157600080fd5b5061033a6109ec565b6040516103479190611286565b60405180910390f35b61036a600480360381019061036591906110ab565b6109f4565b6040516103779190610e94565b60405180910390f35b61039a60048036038101906103959190610f0c565b610ba6565b6040516103a99392919061110b565b60405180910390f35b3480156103be57600080fd5b506103d960048036038101906103d491906112cd565b610bca565b6040516103e69190611064565b60405180910390f35b600042905090565b60606000808484905090508067ffffffffffffffff81111561041c5761041b6112fa565b5b60405190808252806020026020018201604052801561045557816020015b610442610bd5565b81526020019060019003908161043a5790505b5092503660005b828110156105c957600085828151811061047957610478611329565b5b6020026020010151905087878381811061049657610495611329565b5b90506020028101906104a89190611367565b925060008360400135905080860195508360000160208101906104cb91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16818580606001906104f2919061138f565b604051610500929190611431565b60006040518083038185875af1925050503d806000811461053d576040519150601f19603f3d011682016040523d82523d6000602084013e610542565b606091505b5083600001846020018290528215151515815250505081516020850135176105bc577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260846000fd5b826001019250505061045c565b5082341461060c576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610603906114a7565b60405180910390fd5b50505092915050565b6000606043915060008484905090508067ffffffffffffffff81111561063e5761063d6112fa565b5b60405190808252806020026020018201604052801561067157816020015b606081526020019060019003908161065c5790505b5091503660005b828110156107a157600087878381811061069557610694611329565b5b90506020028101906106a791906114c7565b92508260000160208101906106bc91906111a7565b73ffffffffffffffffffffffffffffffffffffffff168380602001906106e2919061138f565b6040516106f0929190611431565b6000604051808303816000865af19150503d806000811461072d576040519150601f19603f3d011682016040523d82523d6000602084013e610732565b606091505b5086848151811061074657610745611329565b5b60200260200101819052819250505080610795576040517f08c379a000000000000000000000000000000000000000000000000000000000815260040161078c9061153b565b60405180910390fd5b81600101915050610678565b5050509250929050565b60006001430340905090565b600046905090565b6000806060439250434091506107d68686866109f4565b905093509350939050565b600048905090565b600043905090565b60008173ffffffffffffffffffffffffffffffffffffffff16319050919050565b600044905090565b606060008383905090508067ffffffffffffffff81111561083e5761083d6112fa565b5b60405190808252806020026020018201604052801561087757816020015b610864610bd5565b81526020019060019003908161085c5790505b5091503660005b828110156109db57600084828151811061089b5761089a611329565b5b602002602001015190508686838181106108b8576108b7611329565b5b90506020028101906108ca919061155b565b92508260000160208101906108df91906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060400190610905919061138f565b604051610913929190611431565b6000604051808303816000865af19150503d8060008114610950576040519150601f19603f3d011682016040523d82523d6000602084013e610955565b606091505b5082600001836020018290528215151515815250505080516020840135176109cf577f08c379a000000000000000000000000000000000000000000000000000000000600052602060045260176024527f4d756c746963616c6c333a2063616c6c206661696c656400000000000000000060445260646000fd5b8160010191505061087e565b50505092915050565b600045905090565b600041905090565b606060008383905090508067ffffffffffffffff811115610a1857610a176112fa565b5b604051908082528060200260200182016040528015610a5157816020015b610a3e610bd5565b815260200190600190039081610a365790505b5091503660005b82811015610b9c576000848281518110610a7557610a74611329565b5b60200260200101519050868683818110610a9257610a91611329565b5b9050602002810190610aa491906114c7565b9250826000016020810190610ab991906111a7565b73ffffffffffffffffffffffffffffffffffffffff16838060200190610adf919061138f565b604051610aed929190611431565b6000604051808303816000865af19150503d8060008114610b2a576040519150601f19603f3d011682016040523d82523d6000602084013e610b2f565b606091505b508260000183602001829052821515151581525050508715610b90578060000151610b8f576040517f08c379a0000000000000000000000000000000000000000000000000000000008152600401610b869061153b565b60405180910390fd5b5b81600101915050610a58565b5050509392505050565b6000806060610bb7600186866107bf565b8093508194508295505050509250925092565b600081409050919050565b6040518060400160405280600015158152602001606081525090565b6000819050919050565b610c0481610bf1565b82525050565b6000602082019050610c1f6000830184610bfb565b92915050565b600080fd5b600080fd5b600080fd5b600080fd5b600080fd5b60008083601f840112610c5457610c53610c2f565b5b8235905067ffffffffffffffff811115610c7157610c70610c34565b5b602083019150836020820283011115610c8d57610c8c610c39565b5b9250929050565b60008060208385031215610cab57610caa610c25565b5b600083013567ffffffffffffffff811115610cc957610cc8610c2a565b5b610cd585828601610c3e565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b60008115159050919050565b610d2281610d0d565b82525050565b600081519050919050565b600082825260208201905092915050565b60005b83811015610d62578082015181840152602081019050610d47565b83811115610d71576000848401525b50505050565b6000601f19601f8301169050919050565b6000610d9382610d28565b610d9d8185610d33565b9350610dad818560208601610d44565b610db681610d77565b840191505092915050565b6000604083016000830151610dd96000860182610d19565b5060208301518482036020860152610df18282610d88565b9
255150508091505092915050565b6000610e0a8383610dc1565b905092915050565b6000602082019050919050565b6000610e2a82610ce1565b610e348185610cec565b935083602082028501610e4685610cfd565b8060005b85811015610e825784840389528151610e638582610dfe565b9450610e6e83610e12565b925060208a01995050600181019050610e4a565b50829750879550505050505092915050565b60006020820190508181036000830152610eae8184610e1f565b905092915050565b60008083601f840112610ecc57610ecb610c2f565b5b8235905067ffffffffffffffff811115610ee957610ee8610c34565b5b602083019150836020820283011115610f0557610f04610c39565b5b9250929050565b60008060208385031215610f2357610f22610c25565b5b600083013567ffffffffffffffff811115610f4157610f40610c2a565b5b610f4d85828601610eb6565b92509250509250929050565b600081519050919050565b600082825260208201905092915050565b6000819050602082019050919050565b6000610f918383610d88565b905092915050565b6000602082019050919050565b6000610fb182610f59565b610fbb8185610f64565b935083602082028501610fcd85610f75565b8060005b858110156110095784840389528151610fea8582610f85565b9450610ff583610f99565b925060208a01995050600181019050610fd1565b50829750879550505050505092915050565b60006040820190506110306000830185610bfb565b81810360208301526110428184610fa6565b90509392505050565b6000819050919050565b61105e8161104b565b82525050565b60006020820190506110796000830184611055565b92915050565b61108881610d0d565b811461109357600080fd5b50565b6000813590506110a58161107f565b92915050565b6000806000604084860312156110c4576110c3610c25565b5b60006110d286828701611096565b935050602084013567ffffffffffffffff8111156110f3576110f2610c2a565b5b6110ff86828701610eb6565b92509250509250925092565b60006060820190506111206000830186610bfb565b61112d6020830185611055565b818103604083015261113f8184610e1f565b9050949350505050565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061117482611149565b9050919050565b61118481611169565b811461118f57600080fd5b50565b6000813590506111a18161117b565b92915050565b6000602082840312156111bd576111bc610c25565b5b60006111cb84828501611192565b91505092915050565b60008083601f8401126111ea576111e9610c2f565b5b8235905067ffffffffffffffff81111561120757611206610c34565b5b60208301915083602082028301111561122357611222610c39565b5b9250929050565b6000806020838503121561124157611240610c25565b5b600083013567ffffffffffffffff81111561125f5761125e610c2a565b5b61126b858286016111d4565b92509250509250929050565b61128081611169565b82525050565b600060208201905061129b6000830184611277565b92915050565b6112aa81610bf1565b81146112b557600080fd5b50565b6000813590506112c7816112a1565b92915050565b6000602082840312156112e3576112e2610c25565b5b60006112f1848285016112b8565b91505092915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052604160045260246000fd5b7f4e487b7100000000000000000000000000000000000000000000000000000000600052603260045260246000fd5b600080fd5b600080fd5b600080fd5b60008235600160800383360303811261138357611382611358565b5b80830191505092915050565b600080833560016020038436030381126113ac576113ab611358565b5b80840192508235915067ffffffffffffffff8211156113ce576113cd61135d565b5b6020830192506001820236038313156113ea576113e9611362565b5b509250929050565b600081905092915050565b82818337600083830152505050565b600061141883856113f2565b93506114258385846113fd565b82840190509392505050565b600061143e82848661140c565b91508190509392505050565b600082825260208201905092915050565b7f4d756c746963616c6c333a2076616c7565206d69736d61746368000000000000600082015250565b6000611491601a8361144a565b915061149c8261145b565b602082019050919050565b600060208201905081810360008301526114c081611484565b9050919050565b6000823560016040038336030381126114e3576114e2611358565b5b80830191505092915050565b7f4d756c746963616c6c333a2063616c6c206661696c6564000000000000000000600082015250565b600061152560178361144a565b9150611530826114ef565b602082019050919050565b6000602082019050818103600083015261155481611518565b9050919050565b60008235600160600383360303811261157757611576611358565b5b8083019150509291505056fea264697066735822122020c1bc9aacf8e4a6507193432a895a8e77094f45a1395583f07b24e860ef06cd64736f6c634300080c0033"},52355:function(e,t,r){"use strict";r.d(t,{$:function(){return n},Up:function(){return i},hZ:function(){return s}});
255let n={1:"An `assert` condition failed.",17:"Arithmetic operation resulted in underflow or overflow.",18:"Division or modulo by zero (e.g. `5 / 0` or `23 % 0`).",33:"Attempted to convert to an invalid type.",34:"Attempted to access a storage byte array that is incorrectly encoded.",49:"Performed `.pop()` on an empty array",50:"Array index is out of bounds.",65:"Allocated too much memory or created an array which is too large.",81:"Attempted to call a zero-initialized variable of internal function type."},i={inputs:[{name:"message",type:"string"}],name:"Error",type:"error"},s={inputs:[{name:"reason",type:"uint256"}],name:"Panic",type:"error"}},69078:function(e,t,r){"use strict";r.d(t,{Zn:function(){return i},ez:function(){return n}});let n={gwei:9,wei:18},i={ether:-9,wei:9}},49154:function(e,t,r){"use strict";r.d(t,{CI:function(){return O},FM:function(){return y},Gy:function(){return S},KY:function(){return _},M4:function(){return f},MS:function(){return p},MX:function(){return v},S4:function(){return x},SM:function(){return A},Zh:function(){return d},cO:function(){return a},dh:function(){return I},eF:function(){return E},fM:function(){return o},fs:function(){return h},gr:function(){return u},hn:function(){return P},lC:function(){return m},mv:function(){return b},wM:function(){return C},wb:function(){return c},xB:function(){return l},xL:function(){return w},yP:function(){return g}});var n=r(4954),i=r(84644),s=r(64358);class o extends s.G{constructor({docsPath:e}){super("A constructor was not found on the ABI.\nMake sure you are using the correct ABI and that the constructor exists on it.",{docsPath:e,name:"AbiConstructorNotFoundError"})}}class a extends s.G{constructor({docsPath:e}){super("Constructor arguments were provided (`args`), but a constructor parameters (`inputs`) were not found on the ABI.\nMake sure you are using the correct ABI, and that the `inputs` attribute on the constructor exists.",{docsPath:e,name:"AbiConstructorParamsNotFoundError"})}}class l extends s.G{constructor({data:e,params:t,size:r}){super(`Data size of ${r} bytes is too small for given parameters.`,{metaMessages:[`Params: (${(0,n.h)(t,{includeName:!0})})`,`Data: ${e} (${r} bytes)`],name:"AbiDecodingDataSizeTooSmallError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e,this.params=t,this.size=r}}class c extends s.G{constructor({cause:e}={}){super('Cannot decode zero data ("0x") with ABI parameters.',{name:"AbiDecodingZeroDataError",cause:e})}}class u extends s.G{constructor({expectedLength:e,givenLength:t,type:r}){super(`ABI encoding array length mismatch for type ${r}. 256Expected length: ${e} 257Given length: ${t}`,{name:"AbiEncodingArrayLengthMismatchError"})}}class f extends s.G{constructor({expectedSize:e,value:t}){super(`Size of bytes "${t}" (bytes${(0,i.d)(t)}) does not match expected size (bytes${e}).`,{name:"AbiEncodingBytesSizeMismatchError"})}}class h extends s.G{constructor({expectedLength:e,givenLength:t}){super(`ABI encoding params/values length mismatch. 258Expected length (params): ${e} 259Given length (values): ${t}`,{name:"AbiEncodingLengthMismatchError"})}}class d extends s.G{constructor(e,{docsPath:t}){super(`Arguments (\`args\`) were provided to "${e}", but "${e}" on the ABI does not contain any parameters (\`inputs\`). 260Cannot encode error result without knowing what the parameter types are. 261Make sure you are using the correct ABI and that the inputs exist on it.`,{docsPath:t,name:"AbiErrorInputsNotFoundError"})}}class p extends s.G{constructor(e,{docsPath:t}={}){super(`Error ${e?`"${e}" `:""}not found on ABI. 262Make sure you are using the correct ABI and that the error exists on it.`,{docsPath:t,name:"AbiErrorNotFoundError"})}}class g extends s.G{constructor(e,{docsPath:t,cause:r}){super(`Encoded error signature "${e}" not found on ABI. 263Make sure you are using the correct ABI and that the error exists on it. 264You can look up the decoded signature here: https://4byte.sourcify.dev/?q=${e}.`,{docsPath:t,name:"AbiErrorSignatureNotFoundError",cause:r}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.signature=e}}class y extends s.G{constructor({docsPath:e}){super("Cannot extract event signature from empty topics.",{docsPath:e,name:"AbiEventSignatureEmptyTopicsError"})}}class m extends s.G{constructor(e,{docsPath:t}){super(`Encoded event signature "${e}" not found on ABI. 265Make sure you are using the correct ABI and that the event exists on it. 266You can look up the signature here: https://4byte.sourcify.dev/?q=${e}.`,{docsPath:t,name:"AbiEventSignatureNotFoundError"})}}class b extends s.G{constructor(e,{docsPath:t}={}){super(`Event ${e?`"${e}" `:""}not found on ABI. 267Make sure you are using the correct ABI and that the event exists on it.`,{docsPath:t,name:"AbiEventNotFoundError"})}}class w extends s.G{constructor(e,{docsPath:t}={}){super(`Function ${e?`"${e}" `:""}not found on ABI. 268Make sure you are using the correct ABI and that the function exists on it.`,{docsPath:t,name:"AbiFunctionNotFoundError"})}}class v extends s.G{constructor(e,{docsPath:t}){super(`Function "${e}" does not contain any \`outputs\` on ABI. 269Cannot decode function result without knowing what the parameter types are. 270Make sure you are using the correct ABI and that the function exists on it.`,{docsPath:t,name:"AbiFunctionOutputsNotFoundError"})}}class E extends s.G{constructor(e,{docsPath:t}){super(`Encoded function signature "${e}" not found on ABI. 271Make sure you are using the correct ABI and that the function exists on it. 272You can look up the signature here: https://4byte.sourcify.dev/?q=${e}.`,{docsPath:t,name:"AbiFunctionSignatureNotFoundError"})}}class x extends s.G{constructor(e,t){super("Found ambiguous types in overloaded ABI items.",{metaMessages:[`\`${e.type}\` in \`${(0,n.t)(e.abiItem)}\`, and`,`\`${t.type}\` in \`${(0,n.t)(t.abiItem)}\``,"","These types encode differently and cannot be distinguished at runtime.","Remove one of the ambiguous items in the ABI."],name:"AbiItemAmbiguityError"})}}class _ extends s.G{constructor({expectedSize:e,givenSize:t}){super(`Expected bytes${e}, got bytes${t}.`,{name:"BytesSizeMismatchError"})}}class A extends s.G{constructor({abiItem:e,data:t,params:r,size:i}){super(`Data size of ${i} bytes is too small for non-indexed event parameters.`,{metaMessages:[`Params: (${(0,n.h)(r,{includeName:!0})})`,`Data: ${t} (${i} bytes)`],name:"DecodeLogDataMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"params",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"size",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=e,this.data=t,this.params=r,this.size=i}}class S extends s.G{constructor({abiItem:e,param:t}){super(`Expected a topic for indexed event parameter${t.name?` "${t.name}"`:""} on event "${(0,n.t)(e,{includeName:!0})}".`,{name:"DecodeLogTopicsMismatch"}),Object.defineProperty(this,"abiItem",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abiItem=e}}class I extends s.G{constructor(e,{docsPath:t}){super(`Type "${e}" is not a valid encoding type. 273Please provide a valid ABI type.`,{docsPath:t,name:"InvalidAbiEncodingType"})}}class O extends s.G{constructor(e,{docsPath:t}){super(`Type "${e}" is not a valid decoding type. 274Please provide a valid ABI type.`,{docsPath:t,name:"InvalidAbiDecodingType"})}}class P extends s.G{constructor(e){super(`Value "${e}" is not a valid array.`,{name:"InvalidArrayError"})}}class C extends s.G{constructor(e){super(`"${e}" is not a valid definition type. 275Valid types: "function", "event", "error"`,{name:"InvalidDefinitionTypeError"})}}},55134:function(e,t,r){"use strict";r.d(t,{b:function(){return i}});var n=r(64358);class i extends n.G{constructor({address:e}){super(`Address "${e}
275" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}},64358:function(e,t,r){"use strict";r.d(t,{G:function(){return s}});let n="2.47.12",i={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:r})=>t?`${e??"https://viem.sh"}${t}${r?`#${r}`:""}`:void 0,version:`viem@${n}`};class s extends Error{constructor(e,t={}){let r=t.cause instanceof s?t.cause.details:t.cause?.message?t.cause.message:t.details,o=t.cause instanceof s&&t.cause.docsPath||t.docsPath,a=i.getDocsUrl?.({...t,docsPath:o});super([e||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...a?[`Docs: ${a}`]:[],...r?[`Details: ${r}`]:[],...i.version?[`Version: ${i.version}`]:[]].join("\n"),t.cause?{cause:t.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"metaMessages",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),this.details=r,this.docsPath=o,this.metaMessages=t.metaMessages,this.name=t.name??this.name,this.shortMessage=e,this.version=n}walk(e){return function e(t,r){return r?.(t)?t:t&&"object"==typeof t&&"cause"in t&&void 0!==t.cause?e(t.cause,r):r?null:t}(this,e)}}},42043:function(e,t,r){"use strict";r.d(t,{f:function(){return i}});var n=r(64358);class i extends n.G{constructor({blockHash:e,blockNumber:t}){let r="Block";e&&(r=`Block at hash "${e}"`),t&&(r=`Block at number "${t}"`),super(`${r} could not be found.`,{name:"BlockNotFoundError"})}}},54732:function(e,t,r){"use strict";r.d(t,{Bk:function(){return o},Yl:function(){return s},mm:function(){return i},pZ:function(){return a}});var n=r(64358);class i extends n.G{constructor({blockNumber:e,chain:t,contract:r}){super(`Chain "${t.name}" does not support contract "${r.name}".`,{metaMessages:["This could be due to any of the following:",...e&&r.blockCreated&&r.blockCreated>e?[`- The contract "${r.name}" was not deployed until block ${r.blockCreated} (current block ${e}).`]:[`- The chain does not have the contract "${r.name}" configured.`]],name:"ChainDoesNotSupportContract"})}}class s extends n.G{constructor({chain:e,currentChainId:t}){super(`The current chain of the wallet (id: ${t}) does not match the target chain for the transaction (id: ${e.id} â ${e.name}).`,{metaMessages:[`Current Chain ID: ${t}`,`Expected Chain ID: ${e.id} â ${e.name}`],name:"ChainMismatchError"})}}class o extends n.G{constructor(){super("No chain was provided to the request.\nPlease provide a chain with the `chain` argument on the Action, or by supplying a `chain` to WalletClient.",{name:"ChainNotFoundError"})}}class a extends n.G{constructor(){super("No chain was provided to the Client.",{name:"ClientChainNotConfiguredError"})}}},25597:function(e,t,r){"use strict";r.d(t,{cg:function(){return m},uq:function(){return b},Lu:function(){return w},Dk:function(){return v},Mo:function(){return E},VQ:function(){return x}});var n=r(67173),i=r(52355),s=r(78425),o=r(4954),a=r(70153);function l({abiItem:e,args:t,includeFunctionName:r=!0,includeName:n=!1}){if("name"in e&&"inputs"in e&&e.inputs)return`${r?e.name:""}(${e.inputs.map((e,r)=>`${n&&e.name?`${e.name}: `:""}${"object"==typeof t[r]?(0,a.P)(t[r]):t[r]}`).join(", ")})`}var c=r(20006),u=r(78658),f=r(86001),h=r(49154),d=r(64358),p=r(39970),g=r(7419),y=r(29031);class m extends d.G{constructor(e,{account:t,docsPath:r,chain:i,data:s,gas:o,gasPrice:a,maxFeePerGas:l,maxPriorityFeePerGas:c,nonce:h,to:d,value:y,stateOverride:m}){let b=t?(0,n.T)(t):void 0,w=(0,g.xr)({from:b?.address,to:d,value:void 0!==y&&`${(0,u.d)(y)} ${i?.nativeCurrency?.symbol||"ETH"}`,data:s,gas:o,gasPrice:void 0!==a&&`${(0,f.o)(a)} gwei`,maxFeePerGas:void 0!==l&&`${(0,f.o)(l)} gwei`,maxPriorityFeePerGas:void 0!==c&&`${(0,f.o)(c)}
275 gwei`,nonce:h});m&&(w+=` 276${(0,p.Bj)(m)}`),super(e.shortMessage,{cause:e,docsPath:r,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Raw Call Arguments:",w].filter(Boolean),name:"CallExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}class b extends d.G{constructor(e,{abi:t,args:r,contractAddress:n,docsPath:i,functionName:s,sender:a}){let u=(0,c.mE)({abi:t,args:r,name:s}),f=u?l({abiItem:u,args:r,includeFunctionName:!1,includeName:!1}):void 0,h=u?(0,o.t)(u,{includeName:!0}):void 0,d=(0,g.xr)({address:n&&(0,y.C)(n),function:h,args:f&&"()"!==f&&`${[...Array(s?.length??0).keys()].map(()=>" ").join("")}${f}`,sender:a});super(e.shortMessage||`An unknown error occurred while executing the contract function "${s}".`,{cause:e,docsPath:i,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],d&&"Contract Call:",d].filter(Boolean),name:"ContractFunctionExecutionError"}),Object.defineProperty(this,"abi",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"args",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"contractAddress",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"formattedArgs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"functionName",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"sender",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.abi=t,this.args=r,this.cause=e,this.contractAddress=n,this.functionName=s,this.sender=a}}class w extends d.G{constructor({abi:e,data:t,functionName:r,message:n,cause:a}){let c,u,f,d,p;if(t&&"0x"!==t)try{let{abiItem:r,errorName:n,args:c}=u=(0,s.p)({abi:e,data:t,cause:a});if("Error"===n)d=c[0];else if("Panic"===n){let[e]=c;d=i.$[e]}else{let e=r?(0,o.t)(r,{includeName:!0}):void 0,t=r&&c?l({abiItem:r,args:c,includeFunctionName:!1,includeName:!1}):void 0;f=[e?`Error: ${e}`:"",t&&"()"!==t?` ${[...Array(n?.length??0).keys()].map(()=>" ").join("")}${t}`:""]}}catch(e){c=e}else n&&(d=n);c instanceof h.yP&&(p=c.signature,f=[`Unable to decode signature "${p}" as it was not found on the provided ABI.`,"Make sure you are using the correct ABI and that the error exists on it.",`You can look up the decoded signature here: https://4byte.sourcify.dev/?q=${p}.`]),super(d&&"execution reverted"!==d||p?[`The contract function "${r}" reverted with the following ${p?"signature":"reason"}:`,d||p].join("\n"):`The contract function "${r}" reverted.`,{cause:c??a,metaMessages:f,name:"ContractFunctionRevertedError"}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"raw",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"reason",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"signature",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=u,this.raw=t,this.reason=d,this.signature=p}}class v extends d.G{constructor({functionName:e,cause:t}){super(`The contract function "${e}" returned no data ("0x").`,{metaMessages:["This could be due to any of the following:",` - The contract does not have the function "${e}",`," - The parameters passed to the contract function may be invalid, or"," - The address is not a contract."],name:"ContractFunctionZeroDataError",cause:t})}}class E extends d.G{constructor({factory:e}){super(`Deployment for counterfactual contract call failed${e?` for factory "${e}".`:""}`,{metaMessages:["Please ensure:","- The `factory` is a valid contract deployment factory (ie. Create2 Factory, ERC-4337 Factory, etc).","- The `factoryData` is a valid encoded function call for contract deployment function on the factory."],name:"CounterfactualDeploymentFailedError"})}}class x extends d.G{constructor({data:e,message:t}){super(t||"",{name:"RawContractError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e}}},634:function(e,t,r){"use strict";r.d(t,{KD:function(){return o},T_:function(){return i},lQ:function(){return s}});var n=r(64358);class i extends n.G{constructor({offset:e}){super(`Offset \`${e}\` cannot be negative.`,{name:"NegativeOffsetError"})}}class s extends n.G{constructor({length:e,position:t}){super(`Position \`${t}\` is out of bounds (\`0 < position < ${e}\`).`,{name:"PositionOutOfBoundsError"})}}class o extends n.G{constructor({count:e,limit:t}){super(`Recursive read limit of \`${t}\` exceeded (recursive read count: \`${e}\`).`,{name:"RecursiveReadLimitExceededError"})}}},26171:function(e,t,r){"use strict";r.d(t,{$s:function(){return s},W_:function(){return o},mV:function(){return i}});var n=r(64358);class i extends n.G{constructor({offset:e,position:t,size:r}){super(`Slice ${"start"===t?"starting":"ending"} at offset "${e}" is out-of-bounds (size: ${r}).`,{name:"SliceOffsetOutOfBoundsError"})}}class s extends n.G{constructor({size:e,targetSize:t,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (${e}) exceeds padding size (${t}).`,{name:"SizeExceedsPaddingSizeError"})}}class o extends n.G{constructor({size:e,targetSize:t,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} is expected to be ${t} ${r} long, but is ${e} ${r} long.`,{name:"InvalidBytesLengthError"})}}},17817:function(e,t,r){"use strict";r.d(t,{Cd:function(){return o},J5:function(){return i},M6:function(){return a},yr:function(){return s}});var n=r(64358);class i extends n.G{constructor({max:e,min:t,signed:r,size:n,value:i}
vendor: 4,485 bytes, lines 276-277
276){super(`Number "${i}" is not in safe ${n?`${8*n}-bit ${r?"signed":"unsigned"} `:""}integer range ${e?`(${t} to ${e})`:`(above ${t})`}`,{name:"IntegerOutOfRangeError"})}}class s extends n.G{constructor(e){super(`Bytes value "${e}" is not a valid boolean. The bytes array must contain a single byte of either a 0 or 1 value.`,{name:"InvalidBytesBooleanError"})}}class o extends n.G{constructor(e){super(`Hex value "${e}" is not a valid boolean. The hex value must be "0x0" (false) or "0x1" (true).`,{name:"InvalidHexBooleanError"})}}class a extends n.G{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}}},76161:function(e,t,r){"use strict";r.d(t,{Fz:function(){return s},e5:function(){return o},ld:function(){return a}});var n=r(86001),i=r(64358);class s extends i.G{constructor(){super("`baseFeeMultiplier` must be greater than 1.",{name:"BaseFeeScalarError"})}}class o extends i.G{constructor(){super("Chain does not support EIP-1559 fees.",{name:"Eip1559FeesNotSupportedError"})}}class a extends i.G{constructor({maxPriorityFeePerGas:e}){super(`\`maxFeePerGas\` cannot be less than the \`maxPriorityFeePerGas\` (${(0,n.o)(e)} gwei).`,{name:"MaxFeePerGasTooLowError"})}}},4656:function(e,t,r){"use strict";r.d(t,{C_:function(){return f},G$:function(){return a},Hh:function(){return o},M_:function(){return s},WF:function(){return h},ZI:function(){return l},cj:function(){return y},cs:function(){return g},dR:function(){return d},pZ:function(){return p},se:function(){return u},vU:function(){return c}});var n=r(86001),i=r(64358);class s extends i.G{constructor({cause:e,message:t}={}){let r=t?.replace("execution reverted: ","")?.replace("execution reverted","");super(`Execution reverted ${r?`with reason: ${r}`:"for an unknown reason"}.`,{cause:e,name:"ExecutionRevertedError"})}}Object.defineProperty(s,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(s,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted|gas required exceeds allowance/});class o extends i.G{constructor({cause:e,maxFeePerGas:t}={}){super(`The fee cap (\`maxFeePerGas\`${t?` = ${(0,n.o)(t)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:e,name:"FeeCapTooHighError"})}}Object.defineProperty(o,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/});class a extends i.G{constructor({cause:e,maxFeePerGas:t}={}){super(`The fee cap (\`maxFeePerGas\`${t?` = ${(0,n.o)(t)}`:""} gwei) cannot be lower than the block base fee.`,{cause:e,name:"FeeCapTooLowError"})}}Object.defineProperty(a,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max fee per gas less than block base fee|fee cap less than block base fee|transaction is outdated/});class l extends i.G{constructor({cause:e,nonce:t}={}){super(`Nonce provided for the transaction ${t?`(${t}) `:""}is higher than the next one expected.`,{cause:e,name:"NonceTooHighError"})}}Object.defineProperty(l,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class c extends i.G{constructor({cause:e,nonce:t}={}){super(`Nonce provided for the transaction ${t?`(${t}) `:""}is lower than the current nonce of the account. 277Try increasing the nonce or find the latest nonce with \`getTransactionCount\`.`,{cause:e,name:"NonceTooLowError"})}}Object.defineProperty(c,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class u extends i.G{constructor({cause:e,nonce:t}={}){super(`Nonce provided for the transaction ${t?`(${t}) `:""}exceeds the maximum allowed nonce.`,{cause:e,name:"NonceMaxValueError"})}}Object.defineProperty(u,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class f extends i.G{constructor({cause:e}={}){super("The total cost (gas * gas fee + value) of executing this transaction exceeds the balance of the account.",{cause:e,metaMessages:["This error could arise when the account does not have enough funds to:"," - pay for the total gas fee,"," - pay for the value to send."," ","The cost of the transaction is calculated as `gas * gas fee + value`, where:"," - `gas` is the amount of gas needed for transaction to execute,"," - `gas fee` is the gas fee,"," - `value` is the amount of ether to send to the recipient."],name:"InsufficientFundsError"})}}
vendor: 10,626 bytes, line 277
277Object.defineProperty(f,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class h extends i.G{constructor({cause:e,gas:t}={}){super(`The amount of gas ${t?`(${t}) `:""}provided for the transaction exceeds the limit allowed for the block.`,{cause:e,name:"IntrinsicGasTooHighError"})}}Object.defineProperty(h,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class d extends i.G{constructor({cause:e,gas:t}={}){super(`The amount of gas ${t?`(${t}) `:""}provided for the transaction is too low.`,{cause:e,name:"IntrinsicGasTooLowError"})}}Object.defineProperty(d,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class p extends i.G{constructor({cause:e}){super("The transaction type is not supported for this chain.",{cause:e,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(p,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class g extends i.G{constructor({cause:e,maxPriorityFeePerGas:t,maxFeePerGas:r}={}){super(`The provided tip (\`maxPriorityFeePerGas\`${t?` = ${(0,n.o)(t)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${(0,n.o)(r)} gwei`:""}).`,{cause:e,name:"TipAboveFeeCapError"})}}Object.defineProperty(g,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});class y extends i.G{constructor({cause:e}){super(`An error occurred while executing: ${e?.shortMessage}`,{cause:e,name:"UnknownNodeError"})}}},89247:function(e,t,r){"use strict";r.d(t,{Gg:function(){return o},W5:function(){return l},bs:function(){return a}});var n=r(70153),i=r(64358),s=r(29031);class o extends i.G{constructor({body:e,cause:t,details:r,headers:i,status:o,url:a}){super("HTTP request failed.",{cause:t,details:r,metaMessages:[o&&`Status: ${o}`,`URL: ${(0,s.G)(a)}`,e&&`Request body: ${(0,n.P)(e)}`].filter(Boolean),name:"HttpRequestError"}),Object.defineProperty(this,"body",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"headers",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"status",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.body=e,this.headers=i,this.status=o,this.url=a}}class a extends i.G{constructor({body:e,error:t,url:r}){super("RPC Request failed.",{cause:t,details:t.message,metaMessages:[`URL: ${(0,s.G)(r)}`,`Request body: ${(0,n.P)(e)}`],name:"RpcRequestError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.code=t.code,this.data=t.data,this.url=r}}class l extends i.G{constructor({body:e,url:t}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${(0,s.G)(t)}`,`Request body: ${(0,n.P)(e)}`],name:"TimeoutError"}),Object.defineProperty(this,"url",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.url=t}}},42345:function(e,t,r){"use strict";r.d(t,{B:function(){return l},EJ:function(){return P},GD:function(){return b},I0:function(){return _},KB:function(){return g},LX:function(){return c},NO:function(){return k},Nt:function(){return O},Og:function(){return d},PE:function(){return v},Pv:function(){return m},Ts:function(){return E},UF:function(){return B},Uu:function(){return I},XS:function(){return f},ab:function(){return w},fl:function(){return C},gS:function(){return y},ir:function(){return R},nY:function(){return u},pT:function(){return p},r0:function(){return T},s7:function(){return a},u5:function(){return x},vl:function(){return S},x3:function(){return A},yR:function(){return h}});var n=r(64358),i=r(89247);class s extends n.G{constructor(e,{code:t,docsPath:r,metaMessages:n,name:s,shortMessage:o}){super(o,{cause:e,docsPath:r,metaMessages:n||e?.metaMessages,name:s||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=s||e.name,this.code=e instanceof i.bs?e.code:t??-1}}class o extends s{constructor(e,t){super(e,t),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t.data}}class a extends s{constructor(e){super(e,{code:a.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(a,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class l extends s{constructor(e){super(e,{code:l.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(l,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class c extends s{constructor(e,{method:t}={}){super(e,{code:c.code,name:"MethodNotFoundRpcError",shortMessage:`The method${t?` "${t}"`:""} does not exist / is not available.`})}}Object.defineProperty(c,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class u extends s{constructor(e){super(e,{code:u.code,name:"InvalidParamsRpcError",shortMessage:"Invalid parameters were provided to the RPC method.\nDouble check you have provided the correct parameters."})}}Object.defineProperty(u,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class f extends s{constructor(e){super(e,{code:f.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(f,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class h extends s{constructor(e){super(e,{code:h.code,name:"InvalidInputRpcError",shortMessage:"Missing or invalid parameters.\nDouble check you have provided the correct parameters."})}}Object.defineProperty(h,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class d extends s{constructor(e){super(e,{code:d.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(d,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class p extends s{constructor(e){super(e,{code:p.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(p,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class g extends s{constructor(e){super(e,{code:g.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(g,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class y extends s{constructor(e,{method:t}={}){super(e,{code:y.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${t?` "${t}"`:""} is not supported.`})}}Object.defineProperty(y,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class m extends s{constructor(e){super(e,{code:m.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(m,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class b extends s{constructor(e){super(e,{code:b.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(b,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class w extends o{constructor(e){super(e,{code:w.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(w,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class v extends o{constructor(e){super(e,{code:v.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(v,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class E extends o{constructor(e,{method:t}={}){super(e,{code:E.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${t?` " ${t}"`:""}.`})}}Object.defineProperty(E,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class x extends o{constructor(e){super(e,{code:x.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(x,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class _ extends o{constructor(e){super(e,{code:_.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(_,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class A extends o{constructor(e){super(e,{code:A.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(A,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class S extends o{constructor(e){super(e,{code:S.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(S,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class I extends o{constructor(e){super(e,{code:I.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(I,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class O extends o{constructor(e){super(e,{code:O.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(O,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class P extends o{constructor(e){super(e,{code:P.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(P,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class C extends o{constructor(e){super(e,{code:C.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(C,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class k extends o{constructor(e){super(e,{code:k.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(k,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750}
vendor: 5,416 bytes, lines 277-282
277);class T extends o{constructor(e){super(e,{code:T.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(T,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class B extends o{constructor(e){super(e,{code:B.code,name:"WalletConnectSessionSettlementError",shortMessage:"WalletConnect session settlement failed."})}}Object.defineProperty(B,"code",{enumerable:!0,configurable:!0,writable:!0,value:7e3});class R extends s{constructor(e){super(e,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}},39970:function(e,t,r){"use strict";r.d(t,{Bj:function(){return a},Nc:function(){return i},Z8:function(){return s}});var n=r(64358);class i extends n.G{constructor({address:e}){super(`State for account "${e}" is set multiple times.`,{name:"AccountStateConflictError"})}}class s extends n.G{constructor(){super("state and stateDiff are set on the same account.",{name:"StateAssignmentConflictError"})}}function o(e){return e.reduce((e,{slot:t,value:r})=>`${e} ${t}: ${r} 278`,"")}function a(e){return e.reduce((e,{address:t,...r})=>{let n=`${e} ${t}: 279`;return r.nonce&&(n+=` nonce: ${r.nonce} 280`),r.balance&&(n+=` balance: ${r.balance} 281`),r.code&&(n+=` code: ${r.code} 282`),r.state&&(n+=" state:\n"+o(r.state)),r.stateDiff&&(n+=" stateDiff:\n"+o(r.stateDiff)),n}," State Override:\n").slice(0,-1)}},7419:function(e,t,r){"use strict";r.d(t,{A3:function(){return f},Bh:function(){return c},Yb:function(){return u},j3:function(){return a},mc:function(){return h},mk:function(){return l},xr:function(){return o}});var n=r(78658),i=r(86001),s=r(64358);function o(e){let t=Object.entries(e).map(([e,t])=>void 0===t||!1===t?null:[e,t]).filter(Boolean),r=t.reduce((e,[t])=>Math.max(e,t.length),0);return t.map(([e,t])=>` ${`${e}:`.padEnd(r+1)} ${t}`).join("\n")}class a extends s.G{constructor({transaction:e}){super("Cannot infer a transaction type from provided transaction.",{metaMessages:["Provided Transaction:","{",o(e),"}","","To infer the type, either provide:","- a `type` to the Transaction, or","- an EIP-1559 Transaction with `maxFeePerGas`, or","- an EIP-2930 Transaction with `gasPrice` & `accessList`, or","- an EIP-4844 Transaction with `blobs`, `blobVersionedHashes`, `sidecars`, or","- an EIP-7702 Transaction with `authorizationList`, or","- a Legacy Transaction with `gasPrice`"],name:"InvalidSerializableTransactionError"})}}class l extends s.G{constructor(e,{account:t,docsPath:r,chain:s,data:a,gas:l,gasPrice:c,maxFeePerGas:u,maxPriorityFeePerGas:f,nonce:h,to:d,value:p}){super(e.shortMessage,{cause:e,docsPath:r,metaMessages:[...e.metaMessages?[...e.metaMessages," "]:[],"Request Arguments:",o({chain:s&&`${s?.name} (id: ${s?.id})`,from:t?.address,to:d,value:void 0!==p&&`${(0,n.d)(p)} ${s?.nativeCurrency?.symbol||"ETH"}`,data:a,gas:l,gasPrice:void 0!==c&&`${(0,i.o)(c)} gwei`,maxFeePerGas:void 0!==u&&`${(0,i.o)(u)} gwei`,maxPriorityFeePerGas:void 0!==f&&`${(0,i.o)(f)} gwei`,nonce:h})].filter(Boolean),name:"TransactionExecutionError"}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.cause=e}}class c extends s.G{constructor({blockHash:e,blockNumber:t,blockTag:r,hash:n,index:i}){let s="Transaction";r&&void 0!==i&&(s=`Transaction at block time "${r}" at index "${i}"`),e&&void 0!==i&&(s=`Transaction at block hash "${e}" at index "${i}"`),t&&void 0!==i&&(s=`Transaction at block number "${t}" at index "${i}"`),n&&(s=`Transaction with hash "${n}"`),super(`${s} could not be found.`,{name:"TransactionNotFoundError"})}}class u extends s.G{constructor({hash:e}){super(`Transaction receipt with hash "${e}" could not be found. The Transaction may not be processed on a block yet.`,{name:"TransactionReceiptNotFoundError"})}}class f extends s.G{constructor({receipt:e}){super(`Transaction with hash "${e.transactionHash}" reverted.`,{metaMessages:['The receipt marked the transaction as "reverted". This could mean that the function on the contract you are trying to call threw an error.'," ","You can attempt to extract the revert reason by:","- calling the `simulateContract` or `simulateCalls` Action with the `abi` and `functionName` of the contract","- using the `call` Action with raw `data`"],name:"TransactionReceiptRevertedError"}),Object.defineProperty(this,"receipt",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.receipt=e}}class h extends s.G{constructor({hash:e}){super(`Timed out while waiting for transaction with hash "${e}" to be confirmed.`,{name:"WaitForTransactionReceiptTimeoutError"})}}},29031:function(e,t,r){"use strict";r.d(t,{C:function(){return n},G:function(){return i}});let n=e=>e,i=e=>e},59273:function(e,t,r){"use strict";r.d(t,{r:function(){return g}});var n=r(49154),i=r(91476),s=r(55261),o=r(84644),a=r(12202),l=r(56580),c=r(17817),u=r(60329),f=r(62851);function h(e,t={}){void 0!==t.size&&(0,u.Yf)(e,{size:t.size});let r=(0,f.ci)(e,t);return(0,u.ly)(r,t)}var d=r(87778),p=r(37096);function g(e,t){let r="string"==typeof t?(0,d.nr)(t):t,g=(0,s.q)(r);if(0===(0,o.d)(r)&&e.length>0)throw new n.wb;if((0,o.d)(t)&&32>(0,o.d)(t))throw new n.xB({data:"string"==typeof t?t:(0,f.ci)(t),params:e,size:(0,o.d)(t)});let m=0,b=[];for(let t=0;t<e.length;++t){let r=e[t];g.setPosition(m);let[s,o]=function e(t,r,{staticPosition:s}){let o=(0,p.S)(r.type);
vendor: 10,239 bytes, line 282
282if(o){let[n,i]=o;return function(t,r,{length:n,staticPosition:i}){if(!n){let n=i+h(t.readBytes(32)),s=n+32;t.setPosition(n);let o=h(t.readBytes(32)),a=y(r),l=0,c=[];for(let n=0;n<o;++n){t.setPosition(s+(a?32*n:l));let[i,o]=e(t,r,{staticPosition:s});l+=o,c.push(i)}return t.setPosition(i+32),[c,32]}if(y(r)){let s=i+h(t.readBytes(32)),o=[];for(let i=0;i<n;++i){t.setPosition(s+32*i);let[n]=e(t,r,{staticPosition:s});o.push(n)}return t.setPosition(i+32),[o,32]}let s=0,o=[];for(let a=0;a<n;++a){let[n,a]=e(t,r,{staticPosition:i+s});s+=a,o.push(n)}return[o,s]}(t,{...r,type:i},{length:n,staticPosition:s})}if("tuple"===r.type)return function(t,r,{staticPosition:n}){let i=0===r.components.length||r.components.some(({name:e})=>!e),s=i?[]:{},o=0;if(y(r)){let a=n+h(t.readBytes(32));for(let n=0;n<r.components.length;++n){let l=r.components[n];t.setPosition(a+o);let[c,u]=e(t,l,{staticPosition:a});o+=u,s[i?n:l?.name]=c}return t.setPosition(n+32),[s,32]}for(let a=0;a<r.components.length;++a){let l=r.components[a],[c,u]=e(t,l,{staticPosition:n});s[i?a:l?.name]=c,o+=u}return[s,o]}(t,r,{staticPosition:s});if("address"===r.type)return function(e){let t=e.readBytes(32);return[(0,i.x)((0,f.ci)((0,a.T4)(t,-20))),32]}(t);if("bool"===r.type)return[function(e,t={}){let r=e;if(void 0!==t.size&&((0,u.Yf)(r,{size:t.size}),r=(0,l.f)(r)),r.length>1||r[0]>1)throw new c.yr(r);return!!r[0]}(t.readBytes(32),{size:32}),32];if(r.type.startsWith("bytes"))return function(e,t,{staticPosition:r}){let[n,i]=t.type.split("bytes");if(!i){let t=h(e.readBytes(32));e.setPosition(r+t);let n=h(e.readBytes(32));if(0===n)return e.setPosition(r+32),["0x",32];let i=e.readBytes(n);return e.setPosition(r+32),[(0,f.ci)(i),32]}return[(0,f.ci)(e.readBytes(Number.parseInt(i,10),32)),32]}(t,r,{staticPosition:s});if(r.type.startsWith("uint")||r.type.startsWith("int"))return function(e,t){let r=t.type.startsWith("int"),n=Number.parseInt(t.type.split("int")[1]||"256",10),i=e.readBytes(32);return[n>48?function(e,t={}){void 0!==t.size&&(0,u.Yf)(e,{size:t.size});let r=(0,f.ci)(e,t);return(0,u.y_)(r,t)}(i,{signed:r}):h(i,{signed:r}),32]}(t,r);if("string"===r.type)return function(e,{staticPosition:t}){let r=h(e.readBytes(32));e.setPosition(t+r);let n=h(e.readBytes(32));if(0===n)return e.setPosition(t+32),["",32];let i=e.readBytes(n,32),s=function(e,t={}){let r=e;return void 0!==t.size&&((0,u.Yf)(r,{size:t.size}),r=(0,l.f)(r,{dir:"right"})),new TextDecoder().decode(r)}((0,l.f)(i));return e.setPosition(t+32),[s,32]}(t,{staticPosition:s});throw new n.CI(r.type,{docsPath:"/docs/contract/decodeAbiParameters"})}(g,r,{staticPosition:0});m+=o,b.push(s)}return b}function y(e){let{type:t}=e;if("string"===t||"bytes"===t||t.endsWith("[]"))return!0;if("tuple"===t)return e.components?.some(y);let r=(0,p.S)(e.type);return!!(r&&y({...e,type:r[1]}))}},78425:function(e,t,r){"use strict";r.d(t,{p:function(){return c}});var n=r(52355),i=r(49154),s=r(12202),o=r(22607),a=r(59273),l=r(4954);function c(e){let{abi:t,data:r,cause:c}=e,u=(0,s.tP)(r,0,4);if("0x"===u)throw new i.wb({cause:c});let f=[...t||[],n.Up,n.hZ].find(e=>"error"===e.type&&u===(0,o.C)((0,l.t)(e)));if(!f)throw new i.yP(u,{docsPath:"/docs/contract/decodeErrorResult",cause:c});return{abiItem:f,args:"inputs"in f&&f.inputs&&f.inputs.length>0?(0,a.r)(f.inputs,(0,s.tP)(r,4)):void 0,errorName:f.name}}},96520:function(e,t,r){"use strict";r.d(t,{p:function(){return l}});var n=r(49154),i=r(12202),s=r(22607),o=r(59273),a=r(4954);function l(e){let{abi:t,data:r}=e,l=(0,i.tP)(r,0,4),c=t.find(e=>"function"===e.type&&l===(0,s.C)((0,a.t)(e)));if(!c)throw new n.eF(l,{docsPath:"/docs/contract/decodeFunctionData"});return{functionName:c.name,args:"inputs"in c&&c.inputs&&c.inputs.length>0?(0,o.r)(c.inputs,(0,i.tP)(r,4)):void 0}}},44056:function(e,t,r){"use strict";r.d(t,{k:function(){return a}});var n=r(49154),i=r(59273),s=r(20006);let o="/docs/contract/decodeFunctionResult";function a(e){let{abi:t,args:r,functionName:a,data:l}=e,c=t[0];if(a){let e=(0,s.mE)({abi:t,args:r,name:a});if(!e)throw new n.xL(a,{docsPath:o});c=e}if("function"!==c.type)throw new n.xL(void 0,{docsPath:o});if(!c.outputs)throw new n.MX(c.name,{docsPath:o});let u=(0,i.r)(c.outputs,l);return u&&u.length>1?u:u&&1===u.length?u[0]:void 0}},37096:function(e,t,r){"use strict";r.d(t,{E:function(){return p},S:function(){return y}});var n=r(49154),i=r(55134),s=r(64358),o=r(17817),a=r(40053),l=r(34174),c=r(37506),u=r(84644),f=r(12202),h=r(62851),d=r(48545);function p(e,t){if(e.length!==t.length)throw new n.fs({expectedLength:e.length,givenLength:t.length});let r=g(function({params:e,values:t}){let r=[];for(let p=0;p<e.length;p++)r.push(function e({param:t,value:r}){let p=y(t.type);if(p){let[i,s]=p;return function(t,{length:r,param:i}){let s=null===r;if(!Array.isArray(t))throw new n.hn(t);if(!s&&t.length!==r)throw new n.gr({expectedLength:r,givenLength:t.length,type:`${i.type}[${r}]`});let o=!1,a=[];for(let r=0;r<t.length;r++){let n=e({param:i,value:t[r]});n.dynamic&&(o=!0),a.push(n)}if(s||o){let e=g(a);if(s){let t=(0,h.eC)(a.length,{size:32});return{dynamic:!0,encoded:a.length>0?(0,l.zo)([t,e]):t}}if(o)return{dynamic:!0,encoded:e}}return{dynamic:!1,encoded:(0,l.zo)(a.map(({encoded:e})=>e))}}(r,{length:i,param:{...t,type:s}})}if("tuple"===t.type)return function(t,{param:r}){let n=!1,i=[];for(let s=0;s<r.components.length;s++){let o=r.components[s],a=Array.isArray(t)?s:o.name,l=e({param:o,value:t[a]});i.push(l),l.dynamic&&(n=!0)}return{dynamic:n,encoded:n?g(i):(0,l.zo)(i.map(({encoded:e})=>e))}}(r,{param:t});if("address"===t.type)return function(e){if(!(0,a.U)(e))throw new i.b({address:e});return{dynamic:!1,encoded:(0,c.gc)(e.toLowerCase())}}(r);if("bool"===t.type)return function(e){if("boolean"!=typeof e)throw new s.G(`Invalid boolean value: "${e}" (type: ${typeof e}). Expected: \`true\` or \`false\`.`);return{dynamic:!1,encoded:(0,c.gc)((0,h.C4)(e))}}(r);if(t.type.startsWith("uint")||t.type.startsWith("int")){let e=t.type.startsWith("int"),[,,n="256"]=d.lh.exec(t.type)??[];return function(e,{signed:t,size:r=256}){if("number"==typeof r){let n=2n**(BigInt(r)-(t?1n:0n))-1n,i=t?-n-1n:0n;if(e>n||e<i)throw new o.J5({max:n.toString(),min:i.toString(),signed:t,size:r/8,value:e.toString()})}return{dynamic:!1,encoded:(0,h.eC)(e,{size:32,signed:t})}}(r,{signed:e,size:Number(n)})}if(t.type.startsWith("bytes"))return function(e,{param:t}){let[,r]=t.type.split("bytes"),i=(0,u.d)(e);if(!r){let t=e;return i%32!=0&&(t=(0,c.gc)(t,{dir:"right",size:32*Math.ceil((e.length-2)/2/32)})),{dynamic:!0,encoded:(0,l.zo)([(0,c.gc)((0,h.eC)(i,{size:32})),t])}}if(i!==Number.parseInt(r,10))throw new n.M4({expectedSize:Number.parseInt(r,10),value:e});return{dynamic:!1,encoded:(0,c.gc)(e,{dir:"right"})}}(r,{param:t});if("string"===t.type)return function(e){let t=(0,h.$G)(e),r=Math.ceil((0,u.d)(t)/32),n=[];for(let e=0;e<r;e++)n.push((0,c.gc)((0,f.tP)(t,32*e,(e+1)*32),{dir:"right"}));return{dynamic:!0,encoded:(0,l.zo)([(0,c.gc)((0,h.eC)((0,u.d)(t),{size:32})),...n])}}(r);throw new n.dh(t.type,{docsPath:"/docs/contract/encodeAbiParameters"})}({param:e[p],value:t[p]}));return r}({params:e,values:t}));return 0===r.length?"0x":r}function g(e){let t=0;for(let r=0;r<e.length;r++){let{dynamic:n,encoded:i}=e[r];n?t+=32:t+=(0,u.d)(i)}let r=[],n=[],i=0;for(let s=0;s<e.length;s++){let{dynamic:o,encoded:a}=e[s];o?(r.push((0,h.eC)(t+i,{size:32})),n.push(a),i+=(0,u.d)(a)):r.push(a)}return(0,l.zo)([...r,...n])}function y(e){let t=e.match(/^(.*)\[(\d+)?\]$/);return t?[t[2]?Number(t[2]):null,t[1]]:void 0}},1341:function(e,t,r){"use strict";r.d(t,{w:function(){return a}});var n=r(49154),i=r(34174),s=r(37096);let o="/docs/contract/encodeDeployData";function a(e){let{abi:t,args:r,bytecode:a}=e;if(!r||0===r.length)return a;let l=t.find(e=>"type"in e&&"constructor"===e.type);if(!l)throw new n.fM({docsPath:o});if(!("inputs"in l)||!l.inputs||0===l.inputs.length)throw new n.cO({docsPath:o});let c=(0,s.E)(l.inputs,r);return(0,i.SM)([a,c])}},64257:function(e,t,r){"use strict";r.d(t,{R:function(){return u}});var n=r(34174),i=r(37096),s=r(49154),o=r(22607),a=r(4954),l=r(20006);let c="/docs/contract/encodeFunctionData";function u(e){let{args:t}=e,{abi:r,functionName:u}=1===e.abi.length&&e.functionName?.startsWith("0x")?e:function(e){let{abi:t,args:r,functionName:n}=e,i=t[0];if(n){let e=(0,l.mE)({abi:t,args:r,name:n});if(!e)throw new s.xL(n,{docsPath:c});i=e}if("function"!==i.type)throw new s.xL(void 0,{docsPath:c});return{abi:[i],functionName:(0,o.C)((0,a.t)(i))}}(e),f=r[0],h="inputs"in f&&f.inputs?(0,i.E)(f.inputs,t??[]):void 0;return(0,n.SM)([u,h??"0x"])}},4954:function(e,t,r){"use strict";r.d(t,{h:function(){return s},t:function(){return i}});var n=r(49154);function i(e,{includeName:t=!1}={}){if("function"!==e.type&&"event"!==e.type&&"error"!==e.type)throw new n.wM(e.type);return`${e.name}(${s(e.inputs,{includeName:t})})`}function s(e,{includeName:t=!1}={}){return e?e.map(e=>(function(e,{includeName:t}){return e.type.startsWith("tuple")?`(${s(e.components,{includeName:t})})${e.type.slice(5)}`:e.type+(t&&e.name?` ${e.name}`:"")})(e,{includeName:t})).join(t?", ":","):""}},20006:function(e,t,r){"use strict";r.d(t,{mE:function(){return l}});var n=r(49154),i=r(15919),s=r(40053),o=r(70803),a=r(22607);function l(e){let t;let{abi:r,args:l=[],name:c}=e,u=(0,i.v)(c,{strict:!1}),f=r.filter(e=>u?"function"===e.type?(0,a.C)(e)===c:"event"===e.type&&(0,o.n)(e)===c:"name"in e&&e.name===c);if(0!==f.length){if(1===f.length)return f[0];for(let e of f)if("inputs"in e){if(!l||0===l.length){if(!e.inputs||0===e.inputs.length)return e;continue}if(e.inputs&&0!==e.inputs.length&&e.inputs.length===l.length&&l.every((t,r)=>{let n="inputs"in e&&e.inputs[r];return!!n&&function e(t,r){let n=typeof t,i=r.type;switch(i){case"address":return(0,s.U)(t,{strict:!1});case"bool":return"boolean"===n;case"function":case"string":return"string"===n;default:if("tuple"===i&&"components"in r)return Object.values(r.components).every((r,i)=>"object"===n&&e(Object.values(t)[i],r));if(/^u?int(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/.test(i))return"number"===n||"bigint"===n;if(/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/.test(i))return"string"===n||t instanceof Uint8Array;
vendor: 13,925 bytes, line 282
282if(/[a-z]+[1-9]{0,3}(\[[0-9]{0,}\])+$/.test(i))return Array.isArray(t)&&t.every(t=>e(t,{...r,type:i.replace(/(\[[0-9]{0,}\])$/,"")}));return!1}}(t,n)})){if(t&&"inputs"in t&&t.inputs){let r=function e(t,r,n){for(let i in t){let o=t[i],a=r[i];if("tuple"===o.type&&"tuple"===a.type&&"components"in o&&"components"in a)return e(o.components,a.components,n[i]);let l=[o.type,a.type];if(l.includes("address")&&l.includes("bytes20")||(l.includes("address")&&l.includes("string")||l.includes("address")&&l.includes("bytes"))&&(0,s.U)(n[i],{strict:!1}))return l}}(e.inputs,t.inputs,l);if(r)throw new n.S4({abiItem:e,type:r[0]},{abiItem:t,type:r[1]})}t=e}}return t||f[0]}}},91476:function(e,t,r){"use strict";r.d(t,{K:function(){return u},x:function(){return c}});var n=r(55134),i=r(87778),s=r(83351),o=r(91544),a=r(40053);let l=new o.k(8192);function c(e,t){if(l.has(`${e}.${t}`))return l.get(`${e}.${t}`);let r=t?`${t}${e.toLowerCase()}`:e.substring(2).toLowerCase(),n=(0,s.w)((0,i.qX)(r),"bytes"),o=(t?r.substring(`${t}0x`.length):r).split("");for(let e=0;e<40;e+=2)n[e>>1]>>4>=8&&o[e]&&(o[e]=o[e].toUpperCase()),(15&n[e>>1])>=8&&o[e+1]&&(o[e+1]=o[e+1].toUpperCase());let a=`0x${o.join("")}`;return l.set(`${e}.${t}`,a),a}function u(e,t){if(!(0,a.U)(e,{strict:!1}))throw new n.b({address:e});return c(e,t)}},40053:function(e,t,r){"use strict";r.d(t,{U:function(){return a}});var n=r(91544),i=r(91476);let s=/^0x[a-fA-F0-9]{40}$/,o=new n.k(8192);function a(e,t){let{strict:r=!0}=t??{},n=`${e}.${r}`;if(o.has(n))return o.get(n);let a=!!s.test(e)&&(e.toLowerCase()===e||!r||(0,i.x)(e)===e);return o.set(n,a),a}},59050:function(e,t,r){"use strict";r.d(t,{E:function(){return s}});var n=r(55134),i=r(40053);function s(e,t){if(!(0,i.U)(e,{strict:!1}))throw new n.b({address:e});if(!(0,i.U)(t,{strict:!1}))throw new n.b({address:t});return e.toLowerCase()===t.toLowerCase()}},87611:function(e,t,r){"use strict";r.d(t,{z:function(){return f}});var n=r(65462),i=r(34174),s=r(87778),o=r(62851),a=r(64358),l=r(55261);function c(e){if(e<256)return 1;if(e<65536)return 2;if(e<16777216)return 3;if(e<4294967296)return 4;throw new a.G("Length is too large.")}var u=r(83351);async function f(e){let{authorization:t,signature:r}=e;return(0,n.R)({hash:function(e){let{chainId:t,nonce:r,to:n}=e,a=e.contractAddress??e.address,f=(0,u.w)((0,i.SM)(["0x05",function(e,t="hex"){let r=function e(t){return Array.isArray(t)?function(e){let t=e.reduce((e,t)=>e+t.length,0),r=c(t);return{length:t<=55?1+t:1+r+t,encode(n){for(let{encode:i}of(t<=55?n.pushByte(192+t):(n.pushByte(247+r),1===r?n.pushUint8(t):2===r?n.pushUint16(t):3===r?n.pushUint24(t):n.pushUint32(t)),e))i(n)}}}(t.map(t=>e(t))):function(e){let t="string"==typeof e?(0,s.nr)(e):e,r=c(t.length);return{length:1===t.length&&t[0]<128?1:t.length<=55?1+t.length:1+r+t.length,encode(e){1===t.length&&t[0]<128||(t.length<=55?e.pushByte(128+t.length):(e.pushByte(183+r),1===r?e.pushUint8(t.length):2===r?e.pushUint16(t.length):3===r?e.pushUint24(t.length):e.pushUint32(t.length))),e.pushBytes(t)}}}(t)}(e),n=(0,l.q)(new Uint8Array(r.length));return(r.encode(n),"hex"===t)?(0,o.ci)(n.bytes):n.bytes}([t?(0,o.eC)(t):"0x",a,r?(0,o.eC)(r):"0x"])]));return"bytes"===n?(0,s.nr)(f):f}(t),signature:r??t})}},24781:function(e,t,r){"use strict";r.d(t,{L:function(){return i}});var n=r(54732);function i({blockNumber:e,chain:t,contract:r}){let i=t?.contracts?.[r];if(!i)throw new n.mm({chain:t,contract:{name:r}});if(e&&i.blockCreated&&i.blockCreated>e)throw new n.mm({blockNumber:e,chain:t,contract:{name:r,blockCreated:i.blockCreated}});return i.address}},55261:function(e,t,r){"use strict";r.d(t,{q:function(){return s}});var n=r(634);let i={bytes:new Uint8Array,dataView:new DataView(new ArrayBuffer(0)),position:0,positionReadCount:new Map,recursiveReadCount:0,recursiveReadLimit:Number.POSITIVE_INFINITY,assertReadLimit(){if(this.recursiveReadCount>=this.recursiveReadLimit)throw new n.KD({count:this.recursiveReadCount+1,limit:this.recursiveReadLimit})},assertPosition(e){if(e<0||e>this.bytes.length-1)throw new n.lQ({length:this.bytes.length,position:e})},decrementPosition(e){if(e<0)throw new n.T_({offset:e});let t=this.position-e;this.assertPosition(t),this.position=t},getReadCount(e){return this.positionReadCount.get(e||this.position)||0},incrementPosition(e){if(e<0)throw new n.T_({offset:e});let t=this.position+e;this.assertPosition(t),this.position=t},inspectByte(e){let t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectBytes(e,t){let r=t??this.position;return this.assertPosition(r+e-1),this.bytes.subarray(r,r+e)},inspectUint8(e){let t=e??this.position;return this.assertPosition(t),this.bytes[t]},inspectUint16(e){let t=e??this.position;return this.assertPosition(t+1),this.dataView.getUint16(t)},inspectUint24(e){let t=e??this.position;return this.assertPosition(t+2),(this.dataView.getUint16(t)<<8)+this.dataView.getUint8(t+2)},inspectUint32(e){let t=e??this.position;return this.assertPosition(t+3),this.dataView.getUint32(t)},pushByte(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushBytes(e){this.assertPosition(this.position+e.length-1),this.bytes.set(e,this.position),this.position+=e.length},pushUint8(e){this.assertPosition(this.position),this.bytes[this.position]=e,this.position++},pushUint16(e){this.assertPosition(this.position+1),this.dataView.setUint16(this.position,e),this.position+=2},pushUint24(e){this.assertPosition(this.position+2),this.dataView.setUint16(this.position,e>>8),this.dataView.setUint8(this.position+2,255&e),this.position+=3},pushUint32(e){this.assertPosition(this.position+3),this.dataView.setUint32(this.position,e),this.position+=4},readByte(){this.assertReadLimit(),this._touch();let e=this.inspectByte();return this.position++,e},readBytes(e,t){this.assertReadLimit(),this._touch();let r=this.inspectBytes(e);return this.position+=t??e,r},readUint8(){this.assertReadLimit(),this._touch();let e=this.inspectUint8();return this.position+=1,e},readUint16(){this.assertReadLimit(),this._touch();let e=this.inspectUint16();return this.position+=2,e},readUint24(){this.assertReadLimit(),this._touch();let e=this.inspectUint24();return this.position+=3,e},readUint32(){this.assertReadLimit(),this._touch();let e=this.inspectUint32();return this.position+=4,e},get remaining(){return this.bytes.length-this.position},setPosition(e){let t=this.position;return this.assertPosition(e),this.position=e,()=>this.position=t},_touch(){if(this.recursiveReadLimit===Number.POSITIVE_INFINITY)return;let e=this.getReadCount();this.positionReadCount.set(this.position,e+1),e>0&&this.recursiveReadCount++}};function s(e,{recursiveReadLimit:t=8192}={}){let r=Object.create(i);return r.bytes=e,r.dataView=new DataView(e.buffer??e,e.byteOffset,e.byteLength),r.positionReadCount=new Map,r.recursiveReadLimit=t,r}},34174:function(e,t,r){"use strict";function n(e){return"string"==typeof e[0]?i(e):function(e){let t=0;for(let r of e)t+=r.length;let r=new Uint8Array(t),n=0;for(let t of e)r.set(t,n),n+=t.length;return r}(e)}function i(e){return`0x${e.reduce((e,t)=>e+t.replace("0x",""),"")}`}r.d(t,{SM:function(){return i},zo:function(){return n}})},15919:function(e,t,r){"use strict";function n(e,{strict:t=!0}={}){return!!e&&"string"==typeof e&&(t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x"))}r.d(t,{v:function(){return n}})},37506:function(e,t,r){"use strict";r.d(t,{gc:function(){return s},vk:function(){return i}});var n=r(26171);function i(e,{dir:t,size:r=32}={}){return"string"==typeof e?s(e,{dir:t,size:r}):function(e,{dir:t,size:r=32}={}){if(null===r)return e;if(e.length>r)throw new n.$s({size:e.length,targetSize:r,type:"bytes"});let i=new Uint8Array(r);for(let n=0;n<r;n++){let s="right"===t;i[s?n:r-n-1]=e[s?n:e.length-n-1]}return i}(e,{dir:t,size:r})}function s(e,{dir:t,size:r=32}={}){if(null===r)return e;let i=e.replace("0x","");if(i.length>2*r)throw new n.$s({size:Math.ceil(i.length/2),targetSize:r,type:"hex"});return`0x${i["right"===t?"padEnd":"padStart"](2*r,"0")}`}},84644:function(e,t,r){"use strict";r.d(t,{d:function(){return i}});var n=r(15919);function i(e){return(0,n.v)(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}},12202:function(e,t,r){"use strict";r.d(t,{T4:function(){return c},p5:function(){return u},tP:function(){return o}});var n=r(26171),i=r(15919),s=r(84644);function o(e,t,r,{strict:n}={}){return(0,i.v)(e,{strict:!1})?u(e,t,r,{strict:n}):c(e,t,r,{strict:n})}function a(e,t){if("number"==typeof t&&t>0&&t>(0,s.d)(e)-1)throw new n.mV({offset:t,position:"start",size:(0,s.d)(e)})}function l(e,t,r){if("number"==typeof t&&"number"==typeof r&&(0,s.d)(e)!==r-t)throw new n.mV({offset:r,position:"end",size:(0,s.d)(e)})}function c(e,t,r,{strict:n}={}){a(e,t);let i=e.slice(t,r);return n&&l(i,t,r),i}function u(e,t,r,{strict:n}={}){a(e,t);let i=`0x${e.replace("0x","").slice((t??0)*2,(r??e.length)*2)}`;return n&&l(i,t,r),i}},56580:function(e,t,r){"use strict";function n(e,{dir:t="left"}={}){let r="string"==typeof e?e.replace("0x",""):e,n=0;for(let e=0;e<r.length-1&&"0"===r["left"===t?e:r.length-e-1].toString();e++)n++;return(r="left"===t?r.slice(n):r.slice(0,r.length-n),"string"==typeof e)?(1===r.length&&"right"===t&&(r=`${r}0`),`0x${r.length%2==1?`0${r}`:r}`):r}r.d(t,{f:function(){return n}})},60329:function(e,t,r){"use strict";r.d(t,{XA:function(){return c},Yf:function(){return a},ly:function(){return u},rR:function(){return f},y_:function(){return l}});var n=r(17817),i=r(84644),s=r(56580),o=r(87778);function a(e,{size:t}){if((0,i.d)(e)>t)throw new n.M6({givenSize:(0,i.d)(e),maxSize:t})}function l(e,t={}){let{signed:r}=t;t.size&&a(e,{size:t.size});let n=BigInt(e);if(!r)return n;let i=(e.length-2)/2;return n<=(1n<<8n*BigInt(i)-1n)-1n?n:n-BigInt(`0x${"f".padStart(2*i,"f")}`)-1n}function c(e,t={}){let r=e;if(t.size&&(a(r,{size:t.size}),r=(0,s.f)(r)),"0x00"===(0,s.f)(r))return!1;if("0x01"===(0,s.f)(r))return!0;throw new n.Cd(r)}function u(e,t={}){let r=l(e,t),i=Number(r);if(!Number.isSafeInteger(i))throw new n.J5({max:`${Number.MAX_SAFE_INTEGER}`,min:`${Number.MIN_SAFE_INTEGER}`,signed:t.signed,size:t.size,value:`${r}n`});return i}function f(e,t={}){let r=(0,o.nr)(e);return t.size&&(a(r,{size:t.size}),r=(0,s.f)(r,{dir:"right"})),new TextDecoder().decode(r)}},87778:function(e,t,r){"use strict";r.d(t,{O0:function(){return c},nr:function(){return h},qX:function(){return d}});var n=r(64358),i=r(15919),s=r(37506),o=r(60329),a=r(62851);let l=new TextEncoder;function c(e,t={}){return"number"==typeof e||"bigint"==typeof e?h((0,a.eC)(e,t)):"boolean"==typeof e?function(e,t={}){let r=new Uint8Array(1);return(r[0]=Number(e),"number"==typeof t.size)?((0,o.Yf)(r,{size:t.size}),(0,s.vk)(r,{size:t.size})):r}(e,t):(0,i.v)(e)?h(e,t):d(e,t)}let u={zero:48,nine:57,A:65,F:70,a:97,f:102};function f(e){return e>=u.zero&&e<=u.nine?e-u.zero:e>=u.A&&e<=u.F?e-(u.A-10):e>=u.a&&e<=u.f?e-(u.a-10):void 0}function h(e,t={}){let r=e;t.size&&((0,o.Yf)(r,{size:t.size}),r=(0,s.vk)(r,{dir:"right",size:t.size}));let i=r.slice(2);i.length%2&&(i=`0${i}`);let a=i.length/2,l=new Uint8Array(a);for(let e=0,t=0;e<a;e++){let r=f(i.charCodeAt(t++)),s=f(i.charCodeAt(t++));if(void 0===r||void 0===s)throw new n.G(`Invalid byte sequence ("${i[t-2]}${i[t-1]}" in "${i}").`);l[e]=16*r+s}return l}function d(e,t={}){let r=l.encode(e);return"number"==typeof t.size?((0,o.Yf)(r,{size:t.size}),(0,s.vk)(r,{dir:"right",size:t.size})):r}},62851:function(e,t,r){"use strict";r.d(t,{$G:function(){return h},C4:function(){return l},NC:function(){return a},ci:function(){return c},eC:function(){return u}});var n=r(17817),i=r(37506),s=r(60329);let o=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function a(e,t={}){return"number"==typeof e||"bigint"==typeof e?u(e,t):"string"==typeof e?h(e,t):"boolean"==typeof e?l(e,t):c(e,t)}function l(e,t={}){let r=`0x${Number(e)}`;return"number"==typeof t.size?((0,s.Yf)(r,{size:t.size}),(0,i.vk)(r,{size:t.size})):r}function c(e,t={}){let r="";for(let t=0;t<e.length;t++)r+=o[e[t]];let n=`0x${r}`;return"number"==typeof t.size?((0,s.Yf)(n,{size:t.size}),(0,i.vk)(n,{dir:"right",size:t.size})):n}function u(e,t={}){let r;let{signed:s,size:o}=t,a=BigInt(e);o?r=s?(1n<<8n*BigInt(o)-1n)-1n:2n**(8n*BigInt(o))-1n:"number"==typeof e&&(r=BigInt(Number.MAX_SAFE_INTEGER));let l="bigint"==typeof r&&s?-r-1n:0;if(r&&a>r||a<l){let t="bigint"==typeof e?"n":"";throw new n.J5({max:r?`${r}${t}`:void 0,min:`${l}${t}`,signed:s,size:o,value:`${e}${t}`})}let c=`0x${(s&&a<0?(1n<<BigInt(8*o))+BigInt(a):a).toString(16)}`;return o?(0,i.vk)(c,{size:o}):c}let f=new TextEncoder;function h(e,t={}){return c(f.encode(e),t)}},29199:function(e,t,r){"use strict";r.d(t,{w:function(){return y},M:function(){return g}});var n=r(27497),i=r(52355),s=r(96520),o=r(49154),a=r(34174),l=r(22607),c=r(37096),u=r(4954),f=r(20006);let h="/docs/contract/encodeErrorResult";function d(e){let{abi:t,errorName:r,args:n}=e,i=t[0];if(r){let e=(0,f.mE)({abi:t,args:n,name:r});if(!e)throw new o.MS(r,{docsPath:h});i=e}if("error"!==i.type)throw new o.MS(void 0,{docsPath:h});let s=(0,u.t)(i),d=(0,l.C)(s),p="0x";if(n&&n.length>0){if(!i.inputs)throw new o.Zh(i.name,{docsPath:h});p=(0,c.E)(i.inputs,n)}return(0,a.SM)([d,p])}let p="/docs/contract/encodeFunctionResult",g="x-batch-gateway:true";async function y(e){let{data:t,ccipRequest:r}=e,{args:[a]}=(0,s.p)({abi:n.Yi,data:t}),l=[],u=[];return await Promise.all(a.map(async(e,t)=>{try{u[t]=e.urls.includes(g)?await y({data:e.data,ccipRequest:r}):await r(e),l[t]=!1}catch(e){l[t]=!0,u[t]="HttpRequestError"===e.name&&e.status?d({abi:n.Yi,errorName:"HttpError",args:[e.status,e.shortMessage]}):d({abi:[i.Up],errorName:"Error",args:["shortMessage"in e?e.shortMessage:e.message]})}})),function(e){let{abi:t,functionName:r,result:n}=e,i=t[0];if(r){let e=(0,f.mE)({abi:t,name:r});if(!e)throw new o.xL(r,{docsPath:p});i=e}if("function"!==i.type)throw new o.xL(void 0,{docsPath:p});if(!i.outputs)throw new o.MX(i.name,{docsPath:p});let s=(()=>
282{if(0===i.outputs.length)return[];if(1===i.outputs.length)return[n];if(Array.isArray(n))return n;throw new o.hn(n)})();return(0,c.E)(i.outputs,s)}({abi:n.Yi,functionName:"query",result:[l,u]})}},46482:function(e,t,r){"use strict";r.d(t,{P:function(){return o}});var n=r(25597),i=r(4656),s=r(33033);function o(e,{docsPath:t,...r}){let o=(()=>{let t=(0,s.k)(e,r);return t instanceof i.cj?e:t})();return new n.cg(o,{docsPath:t,...r})}},23273:function(e,t,r){"use strict";r.d(t,{S:function(){return l}});var n=r(49154),i=r(64358),s=r(25597),o=r(89247),a=r(42345);function l(e,{abi:t,address:r,args:l,docsPath:c,functionName:u,sender:f}){let h=e instanceof s.VQ?e:e instanceof i.G?e.walk(e=>"data"in e)||e.walk():{},{code:d,data:p,details:g,message:y,shortMessage:m}=h,b=e instanceof n.wb?new s.Dk({functionName:u,cause:e}):[3,a.XS.code].includes(d)&&(p||g||y||m)||d===a.yR.code&&"execution reverted"===g&&p?new s.Lu({abi:t,data:"object"==typeof p?p.data:p,functionName:u,message:h instanceof o.bs?g:m??y,cause:e}):e;return new s.uq(b,{abi:t,args:l,contractAddress:r,docsPath:c,functionName:u,sender:f})}},33033:function(e,t,r){"use strict";r.d(t,{k:function(){return s}});var n=r(64358),i=r(4656);function s(e,t){let r=(e.details||"").toLowerCase(),s=e instanceof n.G?e.walk(e=>e?.code===i.M_.code):e;return s instanceof n.G?new i.M_({cause:e,message:s.details}):i.M_.nodeMessage.test(r)?new i.M_({cause:e,message:e.details}):i.Hh.nodeMessage.test(r)?new i.Hh({cause:e,maxFeePerGas:t?.maxFeePerGas}):i.G$.nodeMessage.test(r)?new i.G$({cause:e,maxFeePerGas:t?.maxFeePerGas}):i.ZI.nodeMessage.test(r)?new i.ZI({cause:e,nonce:t?.nonce}):i.vU.nodeMessage.test(r)?new i.vU({cause:e,nonce:t?.nonce}):i.se.nodeMessage.test(r)?new i.se({cause:e,nonce:t?.nonce}):i.C_.nodeMessage.test(r)?new i.C_({cause:e}):i.WF.nodeMessage.test(r)?new i.WF({cause:e,gas:t?.gas}):i.dR.nodeMessage.test(r)?new i.dR({cause:e,gas:t?.gas}):i.pZ.nodeMessage.test(r)?new i.pZ({cause:e}):i.cs.nodeMessage.test(r)?new i.cs({cause:e,maxFeePerGas:t?.maxFeePerGas,maxPriorityFeePerGas:t?.maxPriorityFeePerGas}):new i.cj({cause:e})}},94891:function(e,t,r){"use strict";r.d(t,{$:function(){return o}});var n=r(4656),i=r(7419),s=r(33033);function o(e,{docsPath:t,...r}){let o=(()=>{let t=(0,s.k)(e,r);return t instanceof n.cj?e:t})();return new i.mk(o,{docsPath:t,...r})}},70181:function(e,t,r){"use strict";r.d(t,{Z:function(){return i}});var n=r(74598);function i(e,t){let r=(e.transactions??[]).map(e=>"string"==typeof e?e:(0,n.Tr)(e));return{...e,baseFeePerGas:e.baseFeePerGas?BigInt(e.baseFeePerGas):null,blobGasUsed:e.blobGasUsed?BigInt(e.blobGasUsed):void 0,difficulty:e.difficulty?BigInt(e.difficulty):void 0,excessBlobGas:e.excessBlobGas?BigInt(e.excessBlobGas):void 0,gasLimit:e.gasLimit?BigInt(e.gasLimit):void 0,gasUsed:e.gasUsed?BigInt(e.gasUsed):void 0,hash:e.hash?e.hash:null,logsBloom:e.logsBloom?e.logsBloom:null,nonce:e.nonce?e.nonce:null,number:e.number?BigInt(e.number):null,size:e.size?BigInt(e.size):void 0,timestamp:e.timestamp?BigInt(e.timestamp):void 0,transactions:r,totalDifficulty:e.totalDifficulty?BigInt(e.totalDifficulty):null}}},84835:function(e,t,r){"use strict";function n(e,{format:t}){if(!t)return{};let r={};return!function t(n){for(let i of Object.keys(n))i in e&&(r[i]=e[i]),n[i]&&"object"==typeof n[i]&&!Array.isArray(n[i])&&t(n[i])}(t(e||{})),r}r.d(t,{K:function(){return n}})},21692:function(e,t,r){"use strict";function n(e,{args:t,eventName:r}={}){return{...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,blockTimestamp:e.blockTimestamp?BigInt(e.blockTimestamp):null===e.blockTimestamp?null:void 0,logIndex:e.logIndex?Number(e.logIndex):null,transactionHash:e.transactionHash?e.transactionHash:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,...r?{args:t,eventName:r}:{}}}r.d(t,{U:function(){return n}})},74598:function(e,t,r){"use strict";r.d(t,{Tr:function(){return s},c8:function(){return i}});var n=r(60329);let i={"0x0":"legacy","0x1":"eip2930","0x2":"eip1559","0x3":"eip4844","0x4":"eip7702"};function s(e,t){let r={...e,blockHash:e.blockHash?e.blockHash:null,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,chainId:e.chainId?(0,n.ly)(e.chainId):void 0,gas:e.gas?BigInt(e.gas):void 0,gasPrice:e.gasPrice?BigInt(e.gasPrice):void 0,maxFeePerBlobGas:e.maxFeePerBlobGas?BigInt(e.maxFeePerBlobGas):void 0,maxFeePerGas:e.maxFeePerGas?BigInt(e.maxFeePerGas):void 0,maxPriorityFeePerGas:e.maxPriorityFeePerGas?BigInt(e.maxPriorityFeePerGas):void 0,nonce:e.nonce?(0,n.ly)(e.nonce):void 0,to:e.to?e.to:null,transactionIndex:e.transactionIndex?Number(e.transactionIndex):null,type:e.type?i[e.type]:void 0,typeHex:e.type?e.type:void 0,value:e.value?BigInt(e.value):void 0,v:e.v?BigInt(e.v):void 0};return e.authorizationList&&(r.authorizationList=e.authorizationList.map(e=>({address:e.address,chainId:Number(e.chainId),nonce:Number(e.nonce),r:e.r,s:e.s,yParity:Number(e.yParity)}))),r.yParity=(()=>
282{if(e.yParity)return Number(e.yParity);if("bigint"==typeof r.v){if(0n===r.v||27n===r.v)return 0;if(1n===r.v||28n===r.v)return 1;if(r.v>=35n)return r.v%2n===0n?1:0}})(),"legacy"===r.type&&(delete r.accessList,delete r.maxFeePerBlobGas,delete r.maxFeePerGas,delete r.maxPriorityFeePerGas,delete r.yParity),"eip2930"===r.type&&(delete r.maxFeePerBlobGas,delete r.maxFeePerGas,delete r.maxPriorityFeePerGas),"eip1559"===r.type&&delete r.maxFeePerBlobGas,r}},64603:function(e,t,r){"use strict";r.d(t,{ew:function(){return o},fA:function(){return a}});var n=r(60329),i=r(21692),s=r(74598);let o={"0x0":"reverted","0x1":"success"};function a(e,t){let r={...e,blockNumber:e.blockNumber?BigInt(e.blockNumber):null,contractAddress:e.contractAddress?e.contractAddress:null,cumulativeGasUsed:e.cumulativeGasUsed?BigInt(e.cumulativeGasUsed):null,effectiveGasPrice:e.effectiveGasPrice?BigInt(e.effectiveGasPrice):null,gasUsed:e.gasUsed?BigInt(e.gasUsed):null,logs:e.logs?e.logs.map(e=>(0,i.U)(e)):null,to:e.to?e.to:null,transactionIndex:e.transactionIndex?(0,n.ly)(e.transactionIndex):null,status:e.status?o[e.status]:null,type:e.type?s.c8[e.type]||e.type:null};return e.blobGasPrice&&(r.blobGasPrice=BigInt(e.blobGasPrice)),e.blobGasUsed&&(r.blobGasUsed=BigInt(e.blobGasUsed)),r}},10620:function(e,t,r){"use strict";r.d(t,{tG:function(){return s}});var n=r(62851);let i={legacy:"0x0",eip2930:"0x1",eip1559:"0x2",eip4844:"0x3",eip7702:"0x4"};function s(e,t){let r={};return void 0!==e.authorizationList&&(r.authorizationList=e.authorizationList.map(e=>({address:e.address,r:e.r?(0,n.eC)(BigInt(e.r)):e.r,s:e.s?(0,n.eC)(BigInt(e.s)):e.s,chainId:(0,n.eC)(e.chainId),nonce:(0,n.eC)(e.nonce),...void 0!==e.yParity?{yParity:(0,n.eC)(e.yParity)}:{},...void 0!==e.v&&void 0===e.yParity?{v:(0,n.eC)(e.v)}:{}}))),void 0!==e.accessList&&(r.accessList=e.accessList),void 0!==e.blobVersionedHashes&&(r.blobVersionedHashes=e.blobVersionedHashes),void 0!==e.blobs&&("string"!=typeof e.blobs[0]?r.blobs=e.blobs.map(e=>(0,n.ci)(e)):r.blobs=e.blobs),void 0!==e.data&&(r.data=e.data),e.account&&(r.from=e.account.address),void 0!==e.from&&(r.from=e.from),void 0!==e.gas&&(r.gas=(0,n.eC)(e.gas)),void 0!==e.gasPrice&&(r.gasPrice=(0,n.eC)(e.gasPrice)),void 0!==e.maxFeePerBlobGas&&(r.maxFeePerBlobGas=(0,n.eC)(e.maxFeePerBlobGas)),void 0!==e.maxFeePerGas&&(r.maxFeePerGas=(0,n.eC)(e.maxFeePerGas)),void 0!==e.maxPriorityFeePerGas&&(r.maxPriorityFeePerGas=(0,n.eC)(e.maxPriorityFeePerGas)),void 0!==e.nonce&&(r.nonce=(0,n.eC)(e.nonce)),void 0!==e.to&&(r.to=e.to),void 0!==e.type&&(r.type=i[e.type]),void 0!==e.value&&(r.value=(0,n.eC)(e.value)),r}},33649:function(e,t,r){"use strict";function n(e,t,r){let n=e[t.name];if("function"==typeof n)return n;let i=e[r];return"function"==typeof i?i:r=>t(e,r)}r.d(t,{s:function(){return n}})},83351:function(e,t,r){"use strict";r.d(t,{w:function(){return a}});var n=r(61694),i=r(15919),s=r(87778),o=r(62851);function a(e,t){let r=(0,n.fr)((0,i.v)(e,{strict:!1})?(0,s.O0)(e):e);return"bytes"===(t||"hex")?r:(0,o.NC)(r)}},70803:function(e,t,r){"use strict";r.d(t,{n:function(){return n}});let n=r(52694).r},22607:function(e,t,r){"use strict";r.d(t,{C:function(){return s}});var n=r(12202),i=r(52694);let s=e=>(0,n.tP)((0,i.r)(e),0,4)},52694:function(e,t,r){"use strict";r.d(t,{r:function(){return c}});var n=r(87778),i=r(83351);let s=e=>(0,i.w)((0,n.O0)(e));var o=r(2434),a=r(64358);let l=e=>(function(e){let t=!0,r="",n=0,i="",s=!1;for(let o=0;o<e.length;o++){let a=e[o];if(["(",")",","].includes(a)&&(t=!0),"("===a&&n++,")"===a&&n--,t){if(0===n){if(" "===a&&["event","function",""].includes(i))i="";else if(i+=a,")"===a){s=!0;break}continue}if(" "===a){","!==e[o-1]&&","!==r&&",("!==r&&(r="",t=!1);continue}i+=a,r+=a}}if(!s)throw new a.G("Unable to normalize signature.");return i})("string"==typeof e?e:(0,o.t)(e));function c(e){return s(l(e))}},91544:function(e,t,r){"use strict";r.d(t,{k:function(){return n}});class n extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){let t=super.get(e);return super.has(e)&&(super.delete(e),super.set(e,t)),t}set(e,t){if(super.has(e)&&super.delete(e),super.set(e,t),this.maxSize&&this.size>this.maxSize){let e=super.keys().next().value;void 0!==e&&super.delete(e)}return this}}},16550:function(e,t,r){"use strict";r.d(t,{N7:function(){return o}});let n=new Map,i=new Map,s=0;function o(e,t,r){let o=++s,a=()=>n.get(e)||[],l=()=>{let t=a();n.set(e,t.filter(e=>e.id!==o))},c=()=>{let t=a();if(!t.some(e=>e.id===o))return;let r=i.get(e);if(1===t.length&&r){let e=r();e instanceof Promise&&e.catch(()=>{})}l()},u=a();if(n.set(e,[...u,{id:o,fns:t}]),u&&u.length>0)return c;let f={};for(let e in t)f[e]=(...t)=>{let r=a();if(0!==r.length)for(let n of r)n.fns[e]?.(...t)};let h=r(f);return"function"==typeof h&&i.set(e,h),c}},88778:function(e,t,r){"use strict";r.d(t,{$:function(){return i}});var n=r(94907);function i(e,{emitOnBegin:t,initialWaitTime:r,interval:i}){let s=!0,o=()=>s=!1;return(async()=>{let a;t&&(a=await e({unpoll:o}));let l=await r?.(a)??i;await (0,n.D)(l);let c=async()=>{s&&(await e({unpoll:o}),await (0,n.D)(i),c())};c()})(),o}},52387:function(e,t,r){"use strict";r.d(t,{S:function(){return s}});var n=r(49762);let i=new Map;function s({fn:e,id:t,shouldSplitBatch:r,wait:s=0,sort:o}){let a=async()=>{let t=u();l();let r=t.map(({args:e})=>e);0!==r.length&&e(r).then(e=>{o&&Array.isArray(e)&&e.sort(o);for(let r=0;r<t.length;r++){let{resolve:n}=t[r];n?.([e[r],e])}}).catch(e=>{for(let r=0;r<t.length;r++){let{reject:n}=t[r];n?.(e)}})},l=()=>i.delete(t),c=()=>u().map(({args:e})=>e),u=()=>i.get(t)||[],f=e=>i.set(t,[...u(),e]);return{flush:l,async schedule(e){let{promise:t,resolve:i,reject:o}=(0,n.n)();return(r?.([...c(),e])&&a(),u().length>0)?f({args:e,resolve:i,reject:o}):(f({args:e,resolve:i,reject:o}),setTimeout(a,s)),t}}
282}},49762:function(e,t,r){"use strict";function n(){let e=()=>void 0,t=()=>void 0;return{promise:new Promise((r,n)=>{e=r,t=n}),resolve:e,reject:t}}r.d(t,{n:function(){return n}})},73318:function(e,t,r){"use strict";r.d(t,{J:function(){return i}});var n=r(94907);function i(e,{delay:t=100,retryCount:r=2,shouldRetry:i=()=>!0}={}){return new Promise((s,o)=>{let a=async({count:l=0}={})=>{let c=async({error:e})=>{let r="function"==typeof t?t({count:l,error:e}):t;r&&await (0,n.D)(r),a({count:l+1})};try{let t=await e();s(t)}catch(e){if(l<r&&await i({count:l,error:e}))return c({error:e});o(e)}};a()})}},48545:function(e,t,r){"use strict";r.d(t,{eL:function(){return n},lh:function(){return i}});let n=/^bytes([1-9]|1[0-9]|2[0-9]|3[0-2])?$/,i=/^(u?int)(8|16|24|32|40|48|56|64|72|80|88|96|104|112|120|128|136|144|152|160|168|176|184|192|200|208|216|224|232|240|248|256)?$/},65462:function(e,t,r){"use strict";r.d(t,{R:function(){return f}});var n=r(91476),i=r(83351),s=r(15919),o=r(84644),a=r(60329),l=r(62851);async function c({hash:e,signature:t}){let n=(0,s.v)(e)?e:(0,l.NC)(e),{secp256k1:i}=await Promise.resolve().then(r.bind(r,90677)),c=(()=>{if("object"==typeof t&&"r"in t&&"s"in t){let{r:e,s:r,v:n,yParity:s}=t,o=u(Number(s??n));return new i.Signature((0,a.y_)(e),(0,a.y_)(r)).addRecoveryBit(o)}let e=(0,s.v)(t)?t:(0,l.NC)(t);if(65!==(0,o.d)(e))throw Error("invalid signature length");let r=u((0,a.ly)(`0x${e.slice(130)}`));return i.Signature.fromCompact(e.substring(2,130)).addRecoveryBit(r)})().recoverPublicKey(n.substring(2)).toHex(!1);return`0x${c}`}function u(e){if(0===e||1===e)return e;if(27===e)return 0;if(28===e)return 1;throw Error("Invalid yParityOrV value")}async function f({hash:e,signature:t}){return function(e){let t=(0,i.w)(`0x${e.substring(4)}`).substring(26);return(0,n.x)(`0x${t}`)}(await c({hash:e,signature:t}))}},28746:function(e,t,r){"use strict";r.d(t,{mF:function(){return c}});var n=r(55134),i=r(26171),s=r(39970),o=r(40053),a=r(62851);function l(e){if(e&&0!==e.length)return e.reduce((e,{slot:t,value:r})=>{if(66!==t.length)throw new i.W_({size:t.length,targetSize:66,type:"hex"});if(66!==r.length)throw new i.W_({size:r.length,targetSize:66,type:"hex"});return e[t]=r,e},{})}function c(e){if(!e)return;let t={};for(let{address:r,...i}of e){if(!(0,o.U)(r,{strict:!1}))throw new n.b({address:r});if(t[r])throw new s.Nc({address:r});t[r]=function(e){let{balance:t,nonce:r,state:n,stateDiff:i,code:o}=e,c={};if(void 0!==o&&(c.code=o),void 0!==t&&(c.balance=(0,a.eC)(t)),void 0!==r&&(c.nonce=(0,a.eC)(r)),void 0!==n&&(c.state=l(n)),void 0!==i){if(c.state)throw new s.Z8;c.stateDiff=l(i)}return c}(i)}return t}},70153:function(e,t,r){"use strict";r.d(t,{P:function(){return n}});let n=(e,t,r)=>JSON.stringify(e,(e,r)=>{let n="bigint"==typeof r?r.toString():r;return"function"==typeof t?t(e,n):n},r)},15318:function(e,t,r){"use strict";r.d(t,{F:function(){return l}});var n=r(67173);let i=2n**256n-1n;var s=r(55134),o=r(4656),a=r(40053);function l(e){let{account:t,maxFeePerGas:r,maxPriorityFeePerGas:l,to:c}=e,u=t?(0,n.T)(t):void 0;if(u&&!(0,a.U)(u.address))throw new s.b({address:u.address});if(c&&!(0,a.U)(c))throw new s.b({address:c});if(r&&r>i)throw new o.Hh({maxFeePerGas:r});if(l&&r&&l>r)throw new o.cs({maxFeePerGas:r,maxPriorityFeePerGas:l})}},17548:function(e,t,r){"use strict";r.d(t,{cj:function(){return y},H6:function(){return p},iC:function(){return g}});var n=r(49154),i=r(55134),s=r(70153),o=r(64358);class a extends o.G{constructor({domain:e}){super(`Invalid domain "${(0,s.P)(e)}".`,{metaMessages:["Must be a valid EIP-712 domain."]})}}class l extends o.G{constructor({primaryType:e,types:t}){super(`Invalid primary type \`${e}\` must be one of \`${JSON.stringify(Object.keys(t))}\`.`,{docsPath:"/api/glossary/Errors#typeddatainvalidprimarytypeerror",metaMessages:["Check that the primary type is a key in `types`."]})}}class c extends o.G{constructor({type:e}){super(`Struct type "${e}" is invalid.`,{metaMessages:["Struct type must not be a Solidity type."],name:"InvalidStructTypeError"})}}var u=r(40053),f=r(84644),h=r(62851),d=r(48545);function p(e){let{domain:t,message:r,primaryType:n,types:i}=e,o=(e,t)=>{let r={...t};for(let t of e){let{name:e,type:n}=t;"address"===n&&(r[e]=r[e].toLowerCase())}return r},a=i.EIP712Domain&&t?o(i.EIP712Domain,t):{},l=(()=>
282{if("EIP712Domain"!==n)return o(i[n],r)})();return(0,s.P)({domain:a,message:l,primaryType:n,types:i})}function g(e){let{domain:t,message:r,primaryType:s,types:o}=e,p=(e,t)=>{for(let r of e){let{name:e,type:s}=r,a=t[e],l=s.match(d.lh);if(l&&("number"==typeof a||"bigint"==typeof a)){let[e,t,r]=l;(0,h.eC)(a,{signed:"int"===t,size:Number.parseInt(r,10)/8})}if("address"===s&&"string"==typeof a&&!(0,u.U)(a))throw new i.b({address:a});let g=s.match(d.eL);if(g){let[e,t]=g;if(t&&(0,f.d)(a)!==Number.parseInt(t,10))throw new n.KY({expectedSize:Number.parseInt(t,10),givenSize:(0,f.d)(a)})}let y=o[s];y&&(function(e){if("address"===e||"bool"===e||"string"===e||e.startsWith("bytes")||e.startsWith("uint")||e.startsWith("int"))throw new c({type:e})}(s),p(y,a))}};if(o.EIP712Domain&&t){if("object"!=typeof t)throw new a({domain:t});p(o.EIP712Domain,t)}if("EIP712Domain"!==s){if(o[s])p(o[s],r);else throw new l({primaryType:s,types:o})}}function y({domain:e}){return["string"==typeof e?.name&&{name:"name",type:"string"},e?.version&&{name:"version",type:"string"},("number"==typeof e?.chainId||"bigint"==typeof e?.chainId)&&{name:"chainId",type:"uint256"},e?.verifyingContract&&{name:"verifyingContract",type:"address"},e?.salt&&{name:"salt",type:"bytes32"}].filter(Boolean)}},69404:function(e,t,r){"use strict";let n;r.d(t,{h:function(){return s}});let i=256;function s(e=11){if(!n||i+e>512){n="",i=0;for(let e=0;e<256;e++)n+=(256+256*Math.random()|0).toString(16).substring(1)}return n.substring(i,i+++e)}},78658:function(e,t,r){"use strict";r.d(t,{d:function(){return s}});var n=r(69078),i=r(77677);function s(e,t="wei"){return(0,i.b)(e,n.ez[t])}},86001:function(e,t,r){"use strict";r.d(t,{o:function(){return s}});var n=r(69078),i=r(77677);function s(e,t="wei"){return(0,i.b)(e,n.Zn[t])}},77677:function(e,t,r){"use strict";function n(e,t){let r=e.toString(),n=r.startsWith("-");n&&(r=r.slice(1));let[i,s]=[(r=r.padStart(t,"0")).slice(0,r.length-t),r.slice(r.length-t)];return s=s.replace(/(0+)$/,""),`${n?"-":""}${i||"0"}${s?`.${s}`:""}`}r.d(t,{b:function(){return n}})},94907:function(e,t,r){"use strict";async function n(e){return new Promise(t=>setTimeout(t,e))}r.d(t,{D:function(){return n}})},75709:function(e,t,r){"use strict";r.d(t,{U:function(){return l}});var n=r(2265);let i=e=>{let t;let r=new Set,n=(e,n)=>{let i="function"==typeof e?e(t):e;if(!Object.is(i,t)){let e=t;t=(null!=n?n:"object"!=typeof i||null===i)?i:Object.assign({},t,i),r.forEach(r=>r(t,e))}},i=()=>t,s={setState:n,getState:i,getInitialState:()=>o,subscribe:e=>(r.add(e),()=>r.delete(e))},o=t=e(n,i,s);return s},s=e=>e?i(e):i,o=e=>e,a=e=>{let t=s(e),r=e=>(function(e,t=o){let r=n.useSyncExternalStore(e.subscribe,n.useCallback(()=>t(e.getState()),[e,t]),n.useCallback(()=>t(e.getInitialState()),[e,t]));return n.useDebugValue(r),r})(t,e);return Object.assign(r,t),r},l=e=>e?a(e):a},2725:function(e,t,r){"use strict";r.d(t,{dQ:function(){return i},t:function(){return s},zd:function(){return n}});let n={path:"/api/v1/wallets",method:"POST"},i={path:"/api/v1/wallets/:wallet_id/rpc",method:"POST"},s={path:"/api/v1/wallets/revoke",method:"POST"}},91799:function(e,t,r){"use strict";var n,i;/*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */function s(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function o(e,...t){if(!s(e))throw Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw Error("Uint8Array expected of length "+t+", got length="+e.length)}function a(e,t){return!!Array.isArray(t)&&(0===t.length||(e?t.every(e=>"string"==typeof e):t.every(e=>Number.isSafeInteger(e))))}function l(e,t){if("string"!=typeof t)throw Error(`${e}: string expected`);return!0}function c(e){if(!Number.isSafeInteger(e))throw Error(`invalid integer: ${e}`)}function u(e){if(!Array.isArray(e))throw Error("array expected")}function f(e,t){if(!a(!0,t))throw Error(`${e}: array of strings expected`)}function h(e,t){if(!a(!1,t))throw Error(`${e}: array of numbers expected`)}function d(...e){let t=e=>e,r=(e,t)=>r=>e(t(r));return{encode:e.map(e=>e.encode).reduceRight(r,t),decode:e.map(e=>e.decode).reduce(r,t)}}function p(e){let t="string"==typeof e?e.split(""):e,r=t.length;f("alphabet",t);let n=new Map(t.map((e,t)=>[e,t]));return{encode:n=>(u(n),n.map(n=>{if(!Number.isSafeInteger(n)||n<0||n>=r)throw Error(`alphabet.encode: digit index outside alphabet "${n}". Allowed: ${e}`);return t[n]})),decode:t=>(u(t),t.map(t=>{l("alphabet.decode",t);let r=n.get(t);if(void 0===r)throw Error(`Unknown letter: "${t}". Allowed: ${e}`);return r}))}}function g(e=""){return l("join",e),{encode:t=>(f("join.decode",t),t.join(e)),decode:t=>(l("join.decode",t),t.split(e))}}function y(e,t="="){return c(e),l("padding",t),{encode(r){for(f("padding.encode",r);r.length*e%8;)r.push(t);return r},decode(r){f("padding.decode",r);let n=r.length;if(n*e%8)throw Error("padding: invalid, string should have whole number of bytes");for(;n>0&&r[n-1]===t;n--)if((n-1)*e%8==0)throw Error("padding: invalid, string has too much padding");return r.slice(0,n)}}}
282function m(e,t,r){if(t<2)throw Error(`convertRadix: invalid from=${t}, base cannot be less than 2`);if(r<2)throw Error(`convertRadix: invalid to=${r}, base cannot be less than 2`);if(u(e),!e.length)return[];let n=0,i=[],s=Array.from(e,e=>{if(c(e),e<0||e>=t)throw Error(`invalid integer: ${e}`);return e}),o=s.length;for(;;){let e=0,a=!0;for(let i=n;i<o;i++){let o=s[i],l=t*e,c=l+o;if(!Number.isSafeInteger(c)||l/t!==e||c-o!==l)throw Error("convertRadix: carry overflow");let u=c/r;e=c%r;let f=Math.floor(u);if(s[i]=f,!Number.isSafeInteger(f)||f*r+e!==c)throw Error("convertRadix: carry overflow");a&&(f?a=!1:n=i)}if(i.push(e),a)break}for(let t=0;t<e.length-1&&0===e[t];t++)i.push(0);return i.reverse()}r.d(t,{$v:function(){return T},Jq:function(){return C},US:function(){return I},Yd:function(){return O},pJ:function(){return _},tH:function(){return P}});let b=(e,t)=>0===t?e:b(t,e%t),w=(e,t)=>e+(t-b(e,t)),v=(()=>{let e=[];for(let t=0;t<40;t++)e.push(2**t);return e})();function E(e,t,r,n){if(u(e),t<=0||t>32)throw Error(`convertRadix2: wrong from=${t}`);if(r<=0||r>32)throw Error(`convertRadix2: wrong to=${r}`);if(w(t,r)>32)throw Error(`convertRadix2: carry overflow from=${t} to=${r} carryBits=${w(t,r)}`);let i=0,s=0,o=v[t],a=v[r]-1,l=[];for(let n of e){if(c(n),n>=o)throw Error(`convertRadix2: invalid data word=${n} from=${t}`);if(i=i<<t|n,s+t>32)throw Error(`convertRadix2: carry overflow pos=${s} from=${t}`);for(s+=t;s>=r;s-=r)l.push((i>>s-r&a)>>>0);let e=v[s];if(void 0===e)throw Error("invalid carry");i&=e-1}if(i=i<<r-s&a,!n&&s>=t)throw Error("Excess padding");if(!n&&i>0)throw Error(`Non-zero padding: ${i}`);return n&&s>0&&l.push(i>>>0),l}function x(e,t=!1){if(c(e),e<=0||e>32)throw Error("radix2: bits should be in (0..32]");if(w(8,e)>32||w(e,8)>32)throw Error("radix2: carry overflow");return{encode:r=>{if(!s(r))throw Error("radix2.encode input should be Uint8Array");return E(Array.from(r),8,e,!t)},decode:r=>(h("radix2.decode",r),Uint8Array.from(E(r,e,8,t)))}}let _=d(x(5),p("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),y(5),g("")),A="function"==typeof Uint8Array.from([]).toBase64&&"function"==typeof Uint8Array.fromBase64,S=(e,t)=>{if(l("base64",e),e.length>0&&!(t?/^[A-Za-z0-9=_-]+$/:/^[A-Za-z0-9=+/]+$/).test(e))throw Error("invalid base64");return Uint8Array.fromBase64(e,{alphabet:t?"base64url":"base64",lastChunkHandling:"strict"})},I=A?{encode:e=>(o(e),e.toBase64()),decode:e=>S(e,!1)}:d(x(6),p("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),y(6),g("")),O=d(x(6),p("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/"),g("")),P=A?{encode:e=>(o(e),e.toBase64({alphabet:"base64url"})),decode:e=>S(e,!0)}:d(x(6),p("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_"),y(6),g("")),C=(n="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",d((c(58),{encode:e=>{if(!s(e))throw Error("radix.encode input should be Uint8Array");return m(Array.from(e),256,58)},decode:e=>(h("radix.decode",e),Uint8Array.from(m(e,58,256)))}),p(n),g(""))),k=[996825010,642813549,513874426,1027748829,705979059],T="function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex?{encode:e=>(o(e),e.toHex()),decode:e=>(l("hex",e),Uint8Array.fromHex(e))}:d(x(4),p("0123456789abcdef"),g(""),(function(e){if("function"!=typeof e)throw Error("function expected")}(i=e=>{if("string"!=typeof e||e.length%2!=0)throw TypeError(`hex.decode: expected string, got ${typeof e} with length ${e.length}`);return e.toLowerCase()}),{encode:e=>e,decode:e=>i(e)}))},67550:function(e,t,r){"use strict";r.d(t,{EJ:function(){return E},I7:function(){return d},Iw:function(){return p},Lk:function(){return h},N8:function(){return g},QN:function(){return v},UJ:function(){return u},cE:function(){return f}});var n,i,s=r(18792),o=r(65891),a=r(45170),l=r(16390);function c(){return n||(n=(0,o.Un)()),n}function u(e){if(e.length<32||e.length>44)return!1;let t=c();try{return 32===t.encode(e).byteLength}catch{return!1}}function f(e){if(e.length<32||e.length>44)throw new a.g1$(a.PE6,{actualLength:e.length});let t=c().encode(e).byteLength;if(32!==t)throw new a.g1$(a.Yd8,{actualLength:t})}function h(e){return f(e),e}function d(){return(0,s.Nz)((0,s.Vo)(c(),32),e=>h(e))}function p(){return(0,s.il)((i||(i=(0,o._V)()),i),32)}function g(){return new Intl.Collator("en",{caseFirst:"lower",ignorePunctuation:!1,localeMatcher:"best fit",numeric:!1,sensitivity:"variant",usage:"sort"}).compare}function y(e){let t=e%0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn;return t>=0n?t:0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn+t}function m(e,t){let r=e;for(;t-- >0n;)r*=r,r%=0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn;return r}var b=[80,114,111,103,114,97,109,68,101,114,105,118,101,100,65,100,
282100,114,101,115,115];async function w({programAddress:e,seeds:t}){let r;if((0,l.X5)(),t.length>16)throw new a.g1$(a.d95,{actual:t.length,maxSeeds:16});let n=t.reduce((e,t,n)=>{let i="string"==typeof t?(r||=new TextEncoder).encode(t):t;if(i.byteLength>32)throw new a.g1$(a.xVG,{actual:i.byteLength,index:n,maxSeedLength:32});return e.push(...i),e},[]),i=(0,s.$t)(d(),p()),o=i.encode(e),c=await crypto.subtle.digest("SHA-256",new Uint8Array([...n,...o,...b])),u=new Uint8Array(c);if(32===u.byteLength&&function(e,t){let r=y(e*e),n=function(e,t){let r=y(t*t*t),n=function(e){let t=e*e%0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn*e%0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,r=m(t,2n)*t%0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,n=m(r,1n)*e%0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,i=m(n,5n)*n%0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,s=m(i,10n)*i%0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,o=m(s,20n)*s%0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,a=m(o,40n)*o%0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,l=m(a,80n)*a%0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,c=m(l,80n)*a%0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn,u=m(c,10n)*i%0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn;return m(u,2n)*e%0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffedn}(e*y(r*r*t)),i=y(e*r*n),s=y(t*i*i),o=i,a=y(0x2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0n*i),l=s===e,c=s===y(-e),u=s===y(-(0x2b8324804fc1df0b2b4d00993dfbd7a72f431806ad2fe478c4ee1b274a0ea0b0n*e));return(l&&(i=o),(c||u)&&(i=a),(1n&y(i))===1n&&(i=y(-i)),l||c)?i:null}(y(r-1n),y(0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3n*r+1n));return null!==n&&(0n!==n||(128&t)==0)}(function(e){let t=e.reduce((e,t,r)=>`${function(e){let t=e.toString(16);return 1===t.length?`0${t}`:t}(31===r?-129&t:t)}${e}`,"");return BigInt(`0x${t}`)}(u),u[31]))throw new a.g1$(a.PeP);return i.decode(u)}async function v({programAddress:e,seeds:t}){let r=255;for(;r>0;)try{return[await w({programAddress:e,seeds:[...t,new Uint8Array([r])]}),r]}catch(e){if((0,a.bvN)(e,a.PeP))r--;else throw e}throw new a.g1$(a.qin)}async function E(e){if((0,l.Rx)(),"public"!==e.type||"Ed25519"!==e.algorithm.name)throw new a.g1$(a.TQe);let t=await crypto.subtle.exportKey("raw",e);return p().decode(new Uint8Array(t))}},16390:function(e,t,r){"use strict";r.d(t,{Bj:function(){return c},Fc:function(){return l},Rx:function(){return a},X5:function(){return o},rz:function(){return i}});var n=r(45170);function i(){if(void 0===globalThis.crypto||"function"!=typeof globalThis.crypto.getRandomValues)throw new n.g1$(n.eoY)}function s(){if(!globalThis.isSecureContext)throw new n.g1$(n.Afi)}function o(){if(s(),void 0===globalThis.crypto||"function"!=typeof globalThis.crypto.subtle?.digest)throw new n.g1$(n.eWp)}function a(){if(s(),void 0===globalThis.crypto||"function"!=typeof globalThis.crypto.subtle?.exportKey)throw new n.g1$(n.sD0)}function l(){if(s(),void 0===globalThis.crypto||"function"!=typeof globalThis.crypto.subtle?.sign)throw new n.g1$(n.Pce)}function c(){if(s(),void 0===globalThis.crypto||"function"!=typeof globalThis.crypto.subtle?.verify)throw new n.g1$(n.Iav)}},18792:function(e,t,r){"use strict";r.d(t,{$t:function(){return u},BV:function(){return c},C6:function(){return o},Mf:function(){return a},Nz:function(){return v},UF:function(){return l},Vo:function(){return m},W8:function(){return E},Y6:function(){return h},YR:function(){return g},f7:function(){return f},il:function(){return b},n4:function(){return p},rJ:function(){return y},yF:function(){return w},yK:function(){return s}});var n=r(45170),i=(e,t)=>(function(e,t){if(e.length>=t)return e;let r=new Uint8Array(t).fill(0);return r.set(e),r})(e.length<=t?e:e.slice(0,t),t);function s(e,t){return e.length===t.length&&e.every((e,r)=>e===t[r])}function o(e,t){return"fixedSize"in t?t.fixedSize:t.getSizeFromValue(e)}function a(e){return Object.freeze({...e,encode:t=>{let r=new Uint8Array(o(t,e));return e.write(t,r,0),r}})}function l(e){return Object.freeze({...e,decode:(t,r=0)=>e.read(t,r)[0]})}function c(e){return"fixedSize"in e&&"number"==typeof e.fixedSize}function u(e,t){if(c(e)!==c(t))throw new n.g1$(n.$aB);if(c(e)&&c(t)&&e.fixedSize!==t.fixedSize)throw new n.g1$(n.zJs,{decoderFixedSize:t.fixedSize,encoderFixedSize:e.fixedSize});if(!c(e)&&!c(t)&&e.maxSize!==t.maxSize)throw new n.g1$(n.p9K,{decoderMaxSize:t.maxSize,encoderMaxSize:e.maxSize});return{...t,...e,decode:t.decode,encode:e.encode,read:t.read,write:e.write}}function f(e,t,r=0){if(t.length-r<=0)throw new n.g1$(n.GS7,{codecDescription:e})}function h(e,t,r,i=0){let s=r.length-i;if(s<t)throw new n.g1$(n.on3,{bytesLength:s,codecDescription:e,expected:t})}function d(e,t,r){if(t<0||t>r)throw new n.g1$(n.oec,{bytesLength:r,codecDescription:e,offset:t})}function p(e,t){let r=(r,n,i)=>{let s=e.encode(r);return i=t.write(s.length,n,i),n.set(s,i),i+s.length};if(c(t)&&c(e))return a({...e,fixedSize:t.fixedSize+e.fixedSize,write:r});let n=c(t)?t.fixedSize:t.maxSize??null,i=c(e)?e.fixedSize:e.maxSize??null,s=null!==n&&null!==i?n+i:null;return a({...e,...null!==s?{maxSize:s}:{}
282,getSizeFromValue:r=>{let n=o(r,e);return o(n,t)+n},write:r})}function g(e,t){let r=(r,n)=>{let[i,s]=t.read(r,n),o=Number(i);return((n=s)>0||r.length>o)&&(r=r.slice(n,n+o)),h("addDecoderSizePrefix",o,r),[e.decode(r),n+o]};if(c(t)&&c(e))return l({...e,fixedSize:t.fixedSize+e.fixedSize,read:r});let n=c(t)?t.fixedSize:t.maxSize??null,i=c(e)?e.fixedSize:e.maxSize??null,s=null!==n&&null!==i?n+i:null;return l({...e,...null!==s?{maxSize:s}:{},read:r})}function y(e,t,r){let n;let i=e.byteOffset+(t??0),s=r??e.byteLength;return"undefined"==typeof SharedArrayBuffer?n=e.buffer:e.buffer instanceof SharedArrayBuffer?new Uint8Array(n=new ArrayBuffer(e.length)).set(new Uint8Array(e)):n=e.buffer,(0===i||i===-e.byteLength)&&s===e.byteLength?n:n.slice(i,i+s)}function m(e,t){return a({fixedSize:t,write:(r,n,i)=>{let s=e.encode(r),o=s.length>t?s.slice(0,t):s;return n.set(o,i),i+t}})}function b(e,t){return l({fixedSize:t,read:(r,n)=>{h("fixCodecSize",t,r,n),(n>0||r.length>t)&&(r=r.slice(n,n+t)),c(e)&&(r=i(r,e.fixedSize));let[s]=e.read(r,0);return[s,n+t]}})}function w(e,t){var r,i;return r=function(e,t){if(c(e)){let r=t(e.fixedSize);if(r<0)throw new n.g1$(n.Bd7,{bytesLength:r,codecDescription:"resizeDecoder"});return l({...e,fixedSize:r})}return e}(e,e=>e+t),i={postOffset:({postOffset:e})=>e+t},l({...r,read:(e,t)=>{let n=t=>{var r;return 0===(r=e.length)?0:(t%r+r)%r},s=i.preOffset?i.preOffset({bytes:e,preOffset:t,wrapBytes:n}):t;d("offsetDecoder",s,e.length);let[o,a]=r.read(e,s),l=i.postOffset?i.postOffset({bytes:e,newPreOffset:s,postOffset:a,preOffset:t,wrapBytes:n}):a;return d("offsetDecoder",l,e.length),[o,l]}})}function v(e,t){return a({...c(e)?e:{...e,getSizeFromValue:r=>e.getSizeFromValue(t(r))},write:(r,n,i)=>e.write(t(r),n,i)})}function E(e,t){return l({...e,read:(r,n)=>{let[i,s]=e.read(r,n);return[t(i,r,n),s]}})}},29319:function(e,t,r){"use strict";r.d(t,{B9:function(){return h},LV:function(){return u},Lj:function(){return y},ON:function(){return d},Pn:function(){return c},Q5:function(){return b},Ud:function(){return p},Xn:function(){return w},g0:function(){return g}});var n=r(18792),i=r(27706),s=r(45170);function o(e){return e.reduce((e,t)=>null===e||null===t?null:e+t,0)}function a(e){return(0,n.BV)(e)?e.fixedSize:null}function l(e){return(0,n.BV)(e)?e.fixedSize:e.maxSize??null}function c(e,t={}){let r=t.size??(0,i.Nf)(),o=f(r,a(e)),c=f(r,l(e))??void 0;return(0,n.Mf)({...null!==o?{fixedSize:o}:{getSizeFromValue:t=>("object"==typeof r?(0,n.C6)(t.length,r):0)+[...t].reduce((t,r)=>t+(0,n.C6)(r,e),0),maxSize:c},write:(t,n,i)=>("number"==typeof r&&function(e,t,r){if(t!==r)throw new s.g1$(s.PgF,{actual:r,codecDescription:e,expected:t})}("array",r,t.length),"object"==typeof r&&(i=r.write(t.length,n,i)),t.forEach(t=>{i=e.write(t,n,i)}),i)})}function u(e,t={}){let r=t.size??(0,i.Pz)(),s=f(r,a(e)),o=f(r,l(e))??void 0;return(0,n.UF)({...null!==s?{fixedSize:s}:{maxSize:o},read:(t,n)=>{let i=[];if("object"==typeof r&&0===t.slice(n).length)return[i,n];if("remainder"===r){for(;n<t.length;){let[r,s]=e.read(t,n);n=s,i.push(r)}return[i,n]}let[s,o]="number"==typeof r?[r,n]:r.read(t,n);n=o;for(let r=0;r<s;r+=1){let[r,s]=e.read(t,n);n=s,i.push(r)}return[i,n]}})}function f(e,t){return"number"!=typeof e?null:0===e?0:null===t?null:t*e}function h(){return(0,n.Mf)({getSizeFromValue:e=>e.length,write:(e,t,r)=>(t.set(e,r),r+e.length)})}function d(){return(0,n.UF)({read:(e,t)=>{let r=e.slice(t);return[r,t+r.length]}})}function p(e){return(0,n.Mf)({fixedSize:e.length,write:(t,r,n)=>(r.set(e,n),n+e.length)})}function g(e){let t=o(e.map(a)),r=o(e.map(l))??void 0;return(0,n.UF)({...null===t?{maxSize:r}:{fixedSize:t},read:(t,r)=>{let n=[];return e.forEach(e=>{let[i,s]=e.read(t,r);n.push(i),r=s}),[n,r]}})}function y(e,t){let r=function(e){if(0===e.length)return 0;if(!(0,n.BV)(e[0]))return null;let t=e[0].fixedSize;return e.every(e=>(0,n.BV)(e)&&e.fixedSize===t)?t:null}(e),i=(r,n,i)=>{let s=t(r);return m(e,s),e[s].write(r,n,i)};if(null!==r)return(0,n.Mf)({fixedSize:r,write:i});let s=e.map(e=>l(e)).reduce((e,t)=>null===e||null===t?null:Math.max(e,t),0);return(0,n.Mf)({...null!==s?{maxSize:s}:{}
282,getSizeFromValue:r=>{let i=t(r);return m(e,i),(0,n.C6)(r,e[i])},write:i})}function m(e,t){if(void 0===e[t])throw new s.g1$(s.D76,{maxRange:e.length-1,minRange:0,variant:t})}function b(e){let t=e.map(([,e])=>e),r=o(t.map(a)),i=o(t.map(l))??void 0;return(0,n.Mf)({...null===r?{getSizeFromValue:t=>e.map(([e,r])=>(0,n.C6)(t[e],r)).reduce((e,t)=>e+t,0),maxSize:i}:{fixedSize:r},write:(t,r,n)=>(e.forEach(([e,i])=>{n=i.write(t[e],r,n)}),n)})}function w(e){let t=e.map(([,e])=>e),r=o(t.map(a)),i=o(t.map(l))??void 0;return(0,n.UF)({...null===r?{maxSize:i}:{fixedSize:r},read:(t,r)=>{let n={};return e.forEach(([e,i])=>{let[s,o]=i.read(t,r);r=o,n[e]=s}),[n,r]}})}},27706:function(e,t,r){"use strict";r.d(t,{$L:function(){return y},Nf:function(){return d},Pz:function(){return p},RS:function(){return m},bP:function(){return g},j0:function(){return f},y3:function(){return h}});var n,i=r(45170),s=r(18792);function o(e,t,r,n){if(n<t||n>r)throw new i.g1$(i.Fc5,{codecDescription:e,max:r,min:t,value:n})}var a=((n=a||{})[n.Little=0]="Little",n[n.Big=1]="Big",n);function l(e){return e?.endian!==1}function c(e){return(0,s.Mf)({fixedSize:e.size,write(t,r,n){e.range&&o(e.name,e.range[0],e.range[1],t);let i=new ArrayBuffer(e.size);return e.set(new DataView(i),t,l(e.config)),r.set(new Uint8Array(i),n),n+e.size}})}function u(e){return(0,s.UF)({fixedSize:e.size,read(t,r=0){(0,s.f7)(e.name,t,r),(0,s.Y6)(e.name,e.size,t,r);let n=new DataView((0,s.rJ)(t,r,e.size));return[e.get(n,l(e.config)),r+e.size]}})}var f=()=>(0,s.Mf)({getSizeFromValue:e=>e<=127?1:e<=16383?2:3,maxSize:3,write:(e,t,r)=>{o("shortU16",0,65535,e);let n=[0];for(let t=0;;t+=1){let r=Number(e)>>7*t;if(0===r)break;let i=127&r;n[t]=i,t>0&&(n[t-1]|=128)}return t.set(n,r),r+n.length}}),h=()=>(0,s.UF)({maxSize:3,read:(e,t)=>{let r=0,n=0;for(;++n;){let i=n-1,s=e[t+i];if(r|=(127&s)<<7*i,(128&s)==0)break}return[r,t+n]}}),d=(e={})=>c({config:e,name:"u32",range:[0,Number("0xffffffff")],set:(e,t,r)=>e.setUint32(0,Number(t),r),size:4}),p=(e={})=>u({config:e,get:(e,t)=>e.getUint32(0,t),name:"u32",size:4}),g=(e={})=>c({config:e,name:"u64",range:[0n,BigInt("0xffffffffffffffff")],set:(e,t,r)=>e.setBigUint64(0,BigInt(t),r),size:8}),y=()=>c({name:"u8",range:[0,Number("0xff")],set:(e,t)=>e.setUint8(0,Number(t)),size:1}),m=()=>u({get:e=>e.getUint8(0),name:"u8",size:1})},65891:function(e,t,r){"use strict";r.d(t,{TJ:function(){return p},Un:function(){return u},_V:function(){return f},io:function(){return y},tA:function(){return d}});var n=r(45170),i=r(18792),s=e=>(0,i.Mf)({getSizeFromValue:t=>{let[r,n]=a(t,e[0]);if(!n)return t.length;let i=l(n,e);return r.length+Math.ceil(i.toString(16).length/2)},write(t,r,i){if(!function(e,t,r=t){if(!t.match(RegExp(`^[${e}]*$`)))throw new n.g1$(n.v2s,{alphabet:e,base:e.length,value:r})}(e,t),""===t)return i;let[s,o]=a(t,e[0]);if(!o)return r.set(new Uint8Array(s.length).fill(0),i),i+s.length;let c=l(o,e),u=[];for(;c>0n;)u.unshift(Number(c%256n)),c/=256n;let f=[...Array(s.length).fill(0),...u];return r.set(f,i),i+f.length}}),o=e=>(0,i.UF)({read(t,r){let n=0===r?t:t.slice(r);if(0===n.length)return["",0];let i=n.findIndex(e=>0!==e);i=-1===i?n.length:i;let s=e[0].repeat(i);return i===n.length?[s,t.length]:[s+function(e,t){let r=BigInt(t.length),n=[];for(;e>0n;)n.unshift(t[Number(e%r)]),e/=r;return n.join("")}(n.slice(i).reduce((e,t)=>256n*e+BigInt(t),0n),e),t.length]}});function a(e,t){let[r,n]=e.split(RegExp(`((?!${t}).*)`));return[r,n]}function l(e,t){let r=BigInt(t.length),n=0n;for(let i of e)n*=r,n+=BigInt(t.indexOf(i));return n}var c="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",u=()=>s(c),f=()=>o(c),h="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",d=()=>(0,i.Mf)({getSizeFromValue:e=>{try{return atob(e).length}catch{throw new n.g1$(n.v2s,{alphabet:h,base:64,value:e})}},write(e,t,r){try{let n=atob(e).split("").map(e=>e.charCodeAt(0));return t.set(n,r),n.length+r}catch{throw new n.g1$(n.v2s,{alphabet:h,base:64,value:e})}}}),p=()=>(0,i.UF)({read:(e,t=0)=>[btoa(String.fromCharCode(...e.slice(t))),e.length]}),g=globalThis.TextEncoder,y=()=>{let e;return(0,i.Mf)({getSizeFromValue:t=>(e||=new g).encode(t).length,write:(t,r,n)=>{let i=(e||=new g).encode(t);return r.set(i,n),n+i.length}})}},45170:function(e,t,r){"use strict";r.d(t,{$aB:function(){return N},Afi:function(){return p},Aij:function(){return K},Asp:function(){return E},Bd7:function(){return q},BjO:function(){return eu},D76:function(){return V},Dze:function(){return H},Fc5:function(){return z},GS7:function(){return U},Gxb:function(){return Q},H5j:function(){return i},HTh:function(){return n},HmQ:function(){return Y},Iav:function(){return b},JY_:function(){return X},L25:function(){return d},MYi:function(){return w},PE6:function(){return o},Pce:function(){return m},PeP:function(){return u},PgF:function(){return $},Pzc:function(){return C},RE:function(){return er},SH6:function(){return h},S_Y:function(){return R},TQe:function(){return a},TvV:function(){return k},VcU:function(){return S},WRp:function(){return T},Wlw:function(){return P},XsN:function(){return ee},Yd8:function(){return s},YvZ:function(){return Z},ZVV:function(){return G},bAv:function(){return x},bvN:function(){return ei},d95:function(){return l},eWp:function(){return g},eoY:function(){return v},g1$:function(){return es},mqq:function(){return I},oEF:function(){return A},oR5:function(){return D},oRT:function(){return O},oec:function(){return W},on3:function(){return M},p9K:function(){return L}
282,qXh:function(){return J},qin:function(){return f},rjo:function(){return eo},sD0:function(){return y},v2s:function(){return F},xTK:function(){return B},xVG:function(){return c},yFC:function(){return _},ybQ:function(){return et},zJs:function(){return j}});var n=4,i=5,s=28e5,o=2800001,a=2800003,l=2800006,c=2800007,u=2800008,f=2800009,h=32300001,d=3230004,p=361e4,g=3610001,y=3610003,m=3610005,b=3610006,w=3610007,v=3611e3,E=3704e3,x=3704001,_=3704004,A=5663e3,S=5663001,I=5663004,O=5663005,P=5663006,C=5663007,k=5663008,T=5663015,B=5663016,R=5663017,D=5663021,U=8078e3,M=8078001,N=8078004,j=8078005,L=8078006,$=8078007,z=8078011,F=8078012,q=8078013,W=8078014,V=8078017,H=81e5,G=8100002,K=8100003,Z=819e4,J=8190001,Y=8190002,X=8190003,Q=8190004,ee=99e5,et=9900001,er=9900004;function en([e,t]){return`${e}=${function e(t){return Array.isArray(t)?"%5B"+t.map(e).join("%2C%20")+"%5D":"bigint"==typeof t?`${t}n`:encodeURIComponent(String(null!=t&&null===Object.getPrototypeOf(t)?{...t}:t))}(t)}`}function ei(e,t){return e instanceof Error&&"SolanaError"===e.name&&(void 0===t||e.context.__code===t)}var es=class extends Error{cause=this.cause;context;constructor(...[e,t]){let r,n;t&&Object.entries(Object.getOwnPropertyDescriptors(t)).forEach(([t,i])=>{"cause"===t?n={cause:i.value}:(void 0===r&&(r={__code:e}),Object.defineProperty(r,t,i))}),super(function(e,t={}){{let r=`Solana error #${e}; Decode this error by running \`npx @solana/errors decode -- ${e}`;return Object.keys(t).length&&(r+=` '${btoa(Object.entries(t).map(en).join("&"))}'`),`${r}\``}}(e,r),n),this.context=Object.freeze(void 0===r?{__code:e}:r),this.name="SolanaError"}};function eo(...e){"captureStackTrace"in Error&&"function"==typeof Error.captureStackTrace&&Error.captureStackTrace(...e)}function ea({errorCodeBaseOffset:e,getErrorContext:t,orderedErrorNames:r,rpcEnumError:n},i){let s,o;"string"==typeof n?s=n:(s=Object.keys(n)[0],o=n[s]);let a=e+r.indexOf(s),l=t(a,s,o),c=new es(a,l);return eo(c,i),c}var el=["GenericError","InvalidArgument","InvalidInstructionData","InvalidAccountData","AccountDataTooSmall","InsufficientFunds","IncorrectProgramId","MissingRequiredSignature","AccountAlreadyInitialized","UninitializedAccount","UnbalancedInstruction","ModifiedProgramId","ExternalAccountLamportSpend","ExternalAccountDataModified","ReadonlyLamportChange","ReadonlyDataModified","DuplicateAccountIndex","ExecutableModified","RentEpochModified","NotEnoughAccountKeys","AccountDataSizeChanged","AccountNotExecutable","AccountBorrowFailed","AccountBorrowOutstanding","DuplicateAccountOutOfSync","Custom","InvalidError","ExecutableDataModified","ExecutableLamportChange","ExecutableAccountNotRentExempt","UnsupportedProgramId","CallDepth","MissingAccount","ReentrancyNotAllowed","MaxSeedLengthExceeded","InvalidSeeds","InvalidRealloc","ComputationalBudgetExceeded","PrivilegeEscalation","ProgramEnvironmentSetupFailure","ProgramFailedToComplete","ProgramFailedToCompile","Immutable","IncorrectAuthority","BorshIoError","AccountNotRentExempt","InvalidAccountOwner","ArithmeticOverflow","UnsupportedSysvar","IllegalOwner","MaxAccountsDataAllocationsExceeded","MaxAccountsExceeded","MaxInstructionTraceLengthExceeded","BuiltinProgramsMustConsumeComputeUnits"],ec=["AccountInUse","AccountLoadedTwice","AccountNotFound","ProgramAccountNotFound","InsufficientFundsForFee","InvalidAccountForFee","AlreadyProcessed","BlockhashNotFound","CallChainTooDeep","MissingSignatureForFee","InvalidAccountIndex","SignatureFailure","InvalidProgramForExecution","SanitizeFailure","ClusterMaintenance","AccountBorrowOutstanding","WouldExceedMaxBlockCostLimit","UnsupportedVersion","InvalidWritableAccount","WouldExceedMaxAccountCostLimit","WouldExceedAccountDataBlockLimit","TooManyAccountLocks","AddressLookupTableNotFound","InvalidAddressLookupTableOwner","InvalidAddressLookupTableData","InvalidAddressLookupTableIndex","InvalidRentPayingAccount","WouldExceedMaxVoteCostLimit","WouldExceedAccountDataTotalLimit","DuplicateInstruction","InsufficientFundsForRent","MaxLoadedAccountsDataSizeExceeded","InvalidLoadedAccountsDataSizeLimit","ResanitizationNeeded","ProgramExecutionTemporarilyRestricted","UnbalancedTransaction"];function eu(e){let t;if("object"==typeof e&&null!==e&&"code"in e&&"message"in e&&("number"==typeof e.code||"bigint"==typeof e.code)&&"string"==typeof e.message){let{code:r,data:n,message:i}=e,s=Number(r);
282if(-32002===s){let{err:e,...r}=n,i=e?{cause:function e(t){return"object"==typeof t&&"InstructionError"in t?function e(t,r){let n=Number(t);return ea({errorCodeBaseOffset:4615001,getErrorContext:(e,t,r)=>4615e3===e?{errorName:t,index:n,...void 0!==r?{instructionErrorContext:r}:null}:4615026===e?{code:Number(r),index:n}:{index:n},orderedErrorNames:el,rpcEnumError:r},e)}(...t.InstructionError):ea({errorCodeBaseOffset:7050001,getErrorContext:(e,t,r)=>705e4===e?{errorName:t,...void 0!==r?{transactionErrorContext:r}:null}:7050030===e?{index:Number(r)}:7050031===e||7050035===e?{accountIndex:Number(r.account_index)}:void 0,orderedErrorNames:ec,rpcEnumError:t},e)}(e)}:null;t=new es(-32002,{...r,...i})}else{let e;switch(s){case -32603:case -32602:case -32600:case -32601:case -32700:case -32012:case -32001:case -32004:case -32014:case -32010:case -32009:case -32007:case -32006:case -32015:e={__serverMessage:i};break;default:"object"!=typeof n||Array.isArray(n)||(e=n)}t=new es(s,e)}}else{let r="object"==typeof e&&null!==e&&"message"in e&&"string"==typeof e.message?e.message:"Malformed JSON-RPC error with no message attribute";t=new es(10,{error:e,message:r})}return eo(t,eu),t}},10541:function(e,t,r){"use strict";function n(e,...t){return t.reduce((e,t)=>t(e),e)}r.d(t,{z:function(){return n}})},64767:function(e,t,r){"use strict";r.d(t,{$k:function(){return l},BH:function(){return o},TC:function(){return s},fy:function(){return a},g4:function(){return i}});var n,i=((n=i||{})[n.WRITABLE_SIGNER=3]="WRITABLE_SIGNER",n[n.READONLY_SIGNER=2]="READONLY_SIGNER",n[n.WRITABLE=1]="WRITABLE",n[n.READONLY=0]="READONLY",n);function s(e){return e>=2}function o(e){return(1&e)!=0}function a(e,t){return e|t}function l(e){return 2|e}},83062:function(e,t,r){"use strict";r.d(t,{Jp:function(){return h},eS:function(){return c},g5:function(){return f}});var n=r(16390),i=r(45170),s=r(18792),o=Object.freeze({name:"Ed25519"});async function a(e,t=!1){let r=e.byteLength;if(32!==r)throw new i.g1$(i.bAv,{actualLength:r});let n=new Uint8Array([48,46,2,1,0,48,5,6,3,43,101,112,4,34,4,32,...e]);return await crypto.subtle.importKey("pkcs8",n,o,t,["sign"])}async function l(e,t=!1){if((0,n.Rx)(),!1===e.extractable)throw new i.g1$(i.MYi,{key:e});let r=await crypto.subtle.exportKey("jwk",e);return await crypto.subtle.importKey("jwk",{crv:"Ed25519",ext:t,key_ops:["verify"],kty:"OKP",x:r.x},"Ed25519",t,["verify"])}async function c(e,t){return(0,n.Fc)(),new Uint8Array(await crypto.subtle.sign(o,e,(0,s.rJ)(t)))}async function u(e,t,r){return(0,n.Bj)(),await crypto.subtle.verify(o,e,(0,s.rJ)(t),(0,s.rJ)(r))}async function f(e,t=!1){if((0,n.rz)(),64!==e.byteLength)throw new i.g1$(i.Asp,{byteLength:e.byteLength});let[r,s]=await Promise.all([crypto.subtle.importKey("raw",e.slice(32),o,!0,["verify"]),a(e.slice(0,32),t)]),l=new Uint8Array(32);crypto.getRandomValues(l);let f=await c(s,l);if(!await u(r,f,l))throw new i.g1$(i.yFC);return{privateKey:s,publicKey:r}}async function h(e,t=!1){let r=a(e,t),[n,i]=await Promise.all([(t?r:a(e,!0)).then(async e=>await l(e,!0)),r]);return{privateKey:i,publicKey:n}}},56408:function(e,t,r){"use strict";r.d(t,{$9:function(){return l},Hb:function(){return s},Jt:function(){return o},RJ:function(){return a}});var n=r(67550),i=r(45170);function s(e){return(0,n.UJ)(e)}function o(e){return!function(e){try{(0,n.cE)(e)}catch(e){if((0,i.bvN)(e,i.PE6))throw new i.g1$(i.HTh,e.context);if((0,i.bvN)(e,i.Yd8))throw new i.g1$(i.H5j,e.context);throw e}}(e),e}function a(e){return e}function l(e){return e}},86772:function(e,t,r){"use strict";r.d(t,{Aq:function(){return a},Db:function(){return o},Lh:function(){return f},Qg:function(){return c},f1:function(){return h},he:function(){return l}});var n=r(67550),i=r(83062),s=r(72788);function o(e){return"modifyAndSignTransactions"in e&&"function"==typeof e.modifyAndSignTransactions}function a(e){return"signTransactions"in e&&"function"==typeof e.signTransactions}function l(e){return a(e)||o(e)||"signAndSendTransactions"in e&&"function"==typeof e.signAndSendTransactions}function c(e,t){Object.freeze(e);let r={...t,feePayer:e};return Object.freeze(r),r}async function u(e){let t=await (0,n.EJ)(e.publicKey);return Object.freeze({address:t,keyPair:e,signMessages:r=>Promise.all(r.map(async r=>Object.freeze({[t]:await (0,i.eS)(e.privateKey,r.content)}))),signTransactions:r=>Promise.all(r.map(async r=>Object.freeze({[t]:(await (0,s.n1)([e],r)).signatures[t]})))})}async function f(e,t){return await u(await (0,i.g5)(e,t))}async function h(e,t){return await u(await (0,i.Jp)(e,t))}},21672:function(e,t,r){"use strict";r.d(t,{CG:function(){return P},DC:function(){return q},MK:function(){return m},RZ:function(){return F},Vu:function(){return B},al:function(){return H},bV:function(){return b},d3:function(){return W},fy:function(){return N},o$:function(){return R},pE:function(){return M},t9:function(){return V}});var n,i,s,o,a,l,c=r(45170),u=r(56408),f=r(67550),h=r(18792),d=r(29319),p=r(27706),g=r(64767),y=r(10541);function m(e){return"lifetimeConstraint"in e&&"string"==typeof e.lifetimeConstraint.blockhash&&"bigint"==typeof e.lifetimeConstraint.lastValidBlockHeight&&(0,u.Hb)(e.lifetimeConstraint.blockhash)}function b(e,t){return"lifetimeConstraint"in t&&t.lifetimeConstraint&&"blockhash"in t.lifetimeConstraint&&t.lifetimeConstraint.blockhash===e.blockhash&&t.lifetimeConstraint.lastValidBlockHeight===e.lastValidBlockHeight?t:Object.freeze({...t,lifetimeConstraint:Object.freeze(e)})}var w=e=>(0,h.Mf)({getSizeFromValue:t=>{let[r,n]=E(t,e[0]);if(!n)return t.length;let i=x(n,e);return r.length+Math.ceil(i.toString(16).length/2)},write(t,r,n){if(!function(e,t,r=t){if(!t.match(RegExp(`^[${e}
282]*$`)))throw new c.g1$(c.v2s,{alphabet:e,base:e.length,value:r})}(e,t),""===t)return n;let[i,s]=E(t,e[0]);if(!s)return r.set(new Uint8Array(i.length).fill(0),n),n+i.length;let o=x(s,e),a=[];for(;o>0n;)a.unshift(Number(o%256n)),o/=256n;let l=[...Array(i.length).fill(0),...a];return r.set(l,n),n+l.length}}),v=e=>(0,h.UF)({read(t,r){let n=0===r?t:t.slice(r);if(0===n.length)return["",0];let i=n.findIndex(e=>0!==e);i=-1===i?n.length:i;let s=e[0].repeat(i);return i===n.length?[s,t.length]:[s+function(e,t){let r=BigInt(t.length),n=[];for(;e>0n;)n.unshift(t[Number(e%r)]),e/=r;return n.join("")}(n.slice(i).reduce((e,t)=>256n*e+BigInt(t),0n),e),t.length]}});function E(e,t){let[r,n]=e.split(RegExp(`((?!${t}).*)`));return[r,n]}function x(e,t){let r=BigInt(t.length),n=0n;for(let i of e)n*=r,n+=BigInt(t.indexOf(i));return n}var _="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",A=()=>w(_),S=()=>v(_);function I(){return s||(s=(0,p.$L)()),s}function O(){return o||(o=(0,p.RS)()),o}function P(){return(0,h.UF)({maxSize:1,read:(e,t)=>{let r=e[t];if((128&r)==0)return["legacy",t];{let e=128^r;if(e>0)throw new c.g1$(c.oR5,{unsupportedVersion:e});return[e,t+1]}}})}function C(){return(0,d.Q5)(T())}function k(){return(0,h.Nz)((0,d.Q5)([...T(),["addressTableLookups",(0,d.Pn)(function(){if(!n){let e=(0,d.Pn)((0,p.$L)(),{size:(0,p.j0)()});n=(0,d.Q5)([["lookupTableAddress",(0,f.I7)()],["writableIndexes",e],["readonlyIndexes",e]])}return n}(),{size:(0,p.j0)()})]]),e=>"legacy"===e.version?e:{...e,addressTableLookups:e.addressTableLookups??[]})}function T(){let e=(0,d.Lj)([(0,d.Ud)(new Uint8Array(32)),(0,h.Vo)(A(),32)],e=>void 0===e?0:1);return[["version",(0,h.Mf)({getSizeFromValue:e=>"legacy"===e?0:1,maxSize:1,write:(e,t,r)=>{if("legacy"===e)return r;if(e<0||e>127)throw new c.g1$(c.mqq,{actualVersion:e});if(e>0)throw new c.g1$(c.oR5,{unsupportedVersion:e});return t.set([128|e],r),r+1}})],["header",(0,d.Q5)([["numSignerAccounts",I()],["numReadonlySignerAccounts",I()],["numReadonlyNonSignerAccounts",I()]])],["staticAccounts",(0,d.Pn)((0,f.I7)(),{size:(0,p.j0)()})],["lifetimeToken",e],["instructions",(0,d.Pn)((a||(a=(0,h.Nz)((0,d.Q5)([["programAddressIndex",(0,p.$L)()],["accountIndices",(0,d.Pn)((0,p.$L)(),{size:(0,p.j0)()})],["data",(0,h.n4)((0,d.B9)(),(0,p.j0)())]]),e=>void 0!==e.accountIndices&&void 0!==e.data?e:{...e,accountIndices:e.accountIndices??[],data:e.data??new Uint8Array(0)})),a),{size:(0,p.j0)()})]]}function B(){return(0,h.Mf)({getSizeFromValue:e=>"legacy"===e.version?C().getSizeFromValue(e):k().getSizeFromValue(e),write:(e,t,r)=>"legacy"===e.version?C().write(e,t,r):k().write(e,t,r)})}function R(){return(0,h.W8)((0,d.Xn)([["version",P()],["header",(0,d.Xn)([["numSignerAccounts",O()],["numReadonlySignerAccounts",O()],["numReadonlyNonSignerAccounts",O()]])],["staticAccounts",(0,d.LV)((0,f.Iw)(),{size:(0,p.y3)()})],["lifetimeToken",(0,h.il)(S(),32)],["instructions",(0,d.LV)((l||(l=(0,h.W8)((0,d.Xn)([["programAddressIndex",(0,p.RS)()],["accountIndices",(0,d.LV)((0,p.RS)(),{size:(0,p.y3)()})],["data",(0,h.YR)((0,d.ON)(),(0,p.y3)())]]),e=>{if(e.accountIndices.length&&e.data.byteLength)return e;let{accountIndices:t,data:r,...n}=e;return{...n,...t.length?{accountIndices:t}:null,...r.byteLength?{data:r}:null}})),l),{size:(0,p.y3)()})],["addressTableLookups",(0,d.LV)(function(){if(!i){let e=(0,d.LV)((0,p.RS)(),{size:(0,p.y3)()});i=(0,d.Xn)([["lookupTableAddress",(0,f.Iw)()],["writableIndexes",e],["readonlyIndexes",e]])}return i}(),{size:(0,p.y3)()})]]),({addressTableLookups:e,...t})=>"legacy"!==t.version&&e?.length?{...t,addressTableLookups:e}:t)}function D(e,t,r){e[t]=r(e[t]??{role:g.g4.READONLY})}var U=Symbol("AddressMapTypeProperty");function M(e){let t;let r=Object.entries(function(e,t){let r={[e]:{[U]:0,role:g.g4.WRITABLE_SIGNER}},n=new Set;for(let e of t){let t;if(D(r,e.programAddress,t=>{if(n.add(e.programAddress),U in t){if((0,g.BH)(t.role)){if(0===t[U])throw new c.g1$(c.oEF,{programAddress:e.programAddress});throw new c.g1$(c.VcU,{programAddress:e.programAddress})}if(2===t[U])return t}return{[U]:2,role:g.g4.READONLY}}),e.accounts)for(let i of e.accounts)D(r,i.address,e=>{let{address:r,...s}=i;if(U in e)switch(e[U]){case 0:return e;case 1:{let r=(0,g.fy)(e.role,s.role);if("lookupTableAddress"in s){if(e.lookupTableAddress!==s.lookupTableAddress&&0>(t||=(0,f.N8)())(s.lookupTableAddress,e.lookupTableAddress))return{[U]:1,...s,role:r}}else if((0,g.TC)(s.role))return{[U]:2,role:r};
282if(e.role!==r)return{...e,role:r};return e}case 2:{let t=(0,g.fy)(e.role,s.role);if(n.has(i.address)){if((0,g.BH)(s.role))throw new c.g1$(c.VcU,{programAddress:i.address});if(e.role!==t)return{...e,role:t};return e}if("lookupTableAddress"in s&&!(0,g.TC)(e.role))return{...s,[U]:1,role:t};if(e.role!==t)return{...e,role:t};return e}}return"lookupTableAddress"in s?{...s,[U]:1}:{...s,[U]:2}})}return r}(e.feePayer.address,e.instructions)).sort(([e,r],[n,i])=>{if(r[U]!==i[U]){if(0===r[U])return -1;if(0===i[U])return 1;if(2===r[U])return -1;if(2===i[U])return 1}let s=(0,g.TC)(r.role);if(s!==(0,g.TC)(i.role))return s?-1:1;let o=(0,g.BH)(r.role);return o!==(0,g.BH)(i.role)?o?-1:1:(t||=(0,f.N8)(),1===r[U]&&1===i[U]&&r.lookupTableAddress!==i.lookupTableAddress)?t(r.lookupTableAddress,i.lookupTableAddress):t(e,n)}).map(([e,t])=>({address:e,...t})),n=e.lifetimeConstraint;return{..."legacy"!==e.version?{addressTableLookups:function(e){let t={};for(let r of e){if(!("lookupTableAddress"in r))continue;let e=t[r.lookupTableAddress]||={readonlyIndexes:[],writableIndexes:[]};r.role===g.g4.WRITABLE?e.writableIndexes.push(r.addressIndex):e.readonlyIndexes.push(r.addressIndex)}return Object.keys(t).sort((0,f.N8)()).map(e=>({lookupTableAddress:e,...t[e]}))}(r)}:null,...n?{lifetimeToken:"nonce"in n?n.nonce:n.blockhash}:null,header:function(e){let t=0,r=0,n=0;for(let i of e){if("lookupTableAddress"in i)break;let e=(0,g.BH)(i.role);(0,g.TC)(i.role)?(n++,!e&&r++):!e&&t++}return{numReadonlyNonSignerAccounts:t,numReadonlySignerAccounts:r,numSignerAccounts:n}}(r),instructions:function(e,t){let r=function(e){let t={};for(let[r,n]of e.entries())t[n.address]=r;return t}(t);return e.map(({accounts:e,data:t,programAddress:n})=>({programAddressIndex:r[n],...e?{accountIndices:e.map(({address:e})=>r[e])}:null,...t?{data:t}:null}))}(e.instructions,r),staticAccounts:function(e){let t=e.findIndex(e=>"lookupTableAddress"in e);return(-1===t?e:e.slice(0,t)).map(({address:e})=>e)}(r),version:e.version}}function N(e){return Object.freeze({instructions:Object.freeze([]),version:e.version})}var j="SysvarRecentB1ockHashes11111111111111111111",L="11111111111111111111111111111111";function $(e,t){return{accounts:[{address:e,role:g.g4.WRITABLE},{address:j,role:g.g4.READONLY},{address:t,role:g.g4.READONLY_SIGNER}],data:new Uint8Array([4,0,0,0]),programAddress:L}}function z(e){var t;return e.programAddress===L&&null!=e.data&&4===(t=e.data).byteLength&&4===t[0]&&0===t[1]&&0===t[2]&&0===t[3]&&e.accounts?.length===3&&null!=e.accounts[0].address&&e.accounts[0].role===g.g4.WRITABLE&&e.accounts[1].address===j&&e.accounts[1].role===g.g4.READONLY&&null!=e.accounts[2].address&&(0,g.TC)(e.accounts[2].role)}function F(e){return"lifetimeConstraint"in e&&"string"==typeof e.lifetimeConstraint.nonce&&null!=e.instructions[0]&&z(e.instructions[0])}function q(e,t){var r;if("feePayer"in t&&e===t.feePayer?.address&&(r=t.feePayer)&&"address"in r&&"string"==typeof r.address&&1===Object.keys(r).length)return t;let n={...t,feePayer:Object.freeze({address:e})};return Object.freeze(n),n}function W(e,t){return V([e],t)}function V(e,t){return Object.freeze({...t,instructions:Object.freeze([...t.instructions,...e])})}function H(e,t){let r=e.staticAccounts[0];if(!r)throw new c.g1$(c.TvV);let n=[...function(e){let{header:t}=e,r=t.numSignerAccounts-t.numReadonlySignerAccounts,n=e.staticAccounts.length-t.numSignerAccounts-t.numReadonlyNonSignerAccounts,i=[],s=0;for(let t=0;t<r;t++)i.push({address:e.staticAccounts[s],role:g.g4.WRITABLE_SIGNER}),s++;for(let r=0;r<t.numReadonlySignerAccounts;r++)i.push({address:e.staticAccounts[s],role:g.g4.READONLY_SIGNER}),s++;for(let t=0;t<n;t++)i.push({address:e.staticAccounts[s],role:g.g4.WRITABLE}),s++;for(let r=0;r<t.numReadonlyNonSignerAccounts;r++)i.push({address:e.staticAccounts[s],role:g.g4.READONLY}),s++;return i}(e),..."addressTableLookups"in e&&void 0!==e.addressTableLookups&&e.addressTableLookups.length>0?function(e,t){let r=e.map(e=>e.lookupTableAddress).filter(e=>void 0===t[e]);if(r.length>0)throw new c.g1$(c.oRT,{lookupTableAddresses:r});let n=[],i=[];for(let r of e){let e=t[r.lookupTableAddress],s=r.readonlyIndexes,o=r.writableIndexes,a=Math.max(...s,...o);if(a>=e.length)throw new c.g1$(c.Wlw,{highestKnownIndex:e.length-1,highestRequestedIndex:a,lookupTableAddress:r.lookupTableAddress});let l=s.map(t=>({address:e[t],addressIndex:t,lookupTableAddress:r.lookupTableAddress,role:g.g4.READONLY}));n.push(...l);let u=o.map(t=>({address:e[t],addressIndex:t,lookupTableAddress:r.lookupTableAddress,role:g.g4.WRITABLE}));i.push(...u)}return[...i,...n]}(e.addressTableLookups,t?.addressesByLookupTableAddress??{}):[]],i=e.instructions.map(e=>(function(e,t){let r=t[e.programAddressIndex]?.address;if(!r)throw new c.g1$(c.Pzc,{index:e.programAddressIndex});let n=e.accountIndices?.map(e=>t[e]),{data:i}=e;return Object.freeze({programAddress:r,...n&&n.length?{accounts:Object.freeze(n)}:{},...i&&i.length?{data:i}:{}})})(e,n)),s=i[0],o=function(e,t,r){if(!t||!z(t))return{blockhash:e,lastValidBlockHeight:r??2n**64n-1n};{let r=t.accounts[0].address;(0,f.cE)(r);let n=t.accounts[2].address;return(0,f.cE)(n),{nonce:e,nonceAccountAddress:r,nonceAuthorityAddress:n}}}(e.lifetimeToken,s,t?.lastValidBlockHeight);return(0,y.z)(N({version:e.version}),e=>q(r,e),e=>i.reduce((e,t)=>
282W(t,e),e),e=>"blockhash"in o?b(o,e):function({nonce:e,nonceAccountAddress:t,nonceAuthorityAddress:r},n){let i;let s=n.instructions[0];if(s&&z(s)){if(s.accounts[0].address===t&&s.accounts[2].address===r){if(F(n)&&n.lifetimeConstraint.nonce===e)return n;i=[s,...n.instructions.slice(1)]}else i=[Object.freeze($(t,r)),...n.instructions.slice(1)]}else i=[Object.freeze($(t,r)),...n.instructions];return Object.freeze({...n,instructions:Object.freeze(i),lifetimeConstraint:Object.freeze({nonce:e})})}(o,e))}},72788:function(e,t,r){"use strict";r.d(t,{Kt:function(){return h},n1:function(){return y},oU:function(){return m},qy:function(){return g},x7:function(){return d}});var n=r(67550),i=r(18792),s=r(29319),o=r(27706),a=r(45170),l=r(21672),c=r(65891),u=r(83062);function f(e){let t=Object.values(e);if(0===t.length)throw new a.g1$(a.xTK);return t.map(e=>e||new Uint8Array(64).fill(0))}function h(){return(0,s.Q5)([["signatures",(0,i.Nz)((0,s.Pn)((0,i.Vo)((0,s.B9)(),64),{size:(0,o.j0)()}),f)],["messageBytes",(0,s.B9)()]])}function d(){return(0,i.W8)((0,s.Xn)([["signatures",(0,s.LV)((0,i.il)((0,s.ON)(),64),{size:(0,o.y3)()})],["messageBytes",(0,s.ON)()]]),p)}function p(e){let{messageBytes:t,signatures:r}=e,[c,u,f]=(0,s.g0)([(0,l.CG)(),(0,i.yF)((0,o.RS)(),2),(0,s.LV)((0,n.Iw)(),{size:(0,o.y3)()})]).decode(t),h=f.slice(0,u);if(h.length!==r.length)throw new a.g1$(a.S_Y,{numRequiredSignatures:u,signaturesLength:r.length,signerAddresses:h});let d={};return h.forEach((e,t)=>{let n=r[t];n.every(e=>0===e)?d[e]=null:d[e]=n}),{messageBytes:t,signatures:Object.freeze(d)}}function g(e){let t;let r=(0,l.pE)(e),n=(0,l.Vu)().encode(r),i=r.staticAccounts.slice(0,r.header.numSignerAccounts),s={};for(let e of i)s[e]=null;return(0,l.MK)(e)?t={blockhash:e.lifetimeConstraint.blockhash,lastValidBlockHeight:e.lifetimeConstraint.lastValidBlockHeight}:(0,l.RZ)(e)&&(t={nonce:e.lifetimeConstraint.nonce,nonceAccountAddress:e.instructions[0].accounts[0].address}),Object.freeze({...t?{lifetimeConstraint:t}:void 0,messageBytes:n,signatures:Object.freeze(s)})}async function y(e,t){let r,s;if(await Promise.all(e.map(async e=>{let o=await (0,n.EJ)(e.publicKey),a=t.signatures[o];if(void 0===a){(s||=new Set).add(o);return}if(s)return;let l=await (0,u.eS)(e.privateKey,t.messageBytes);null!==a&&(0,i.yK)(l,a)||((r||={})[o]=l)})),s&&s.size>0){let e=Object.keys(t.signatures);throw new a.g1$(a.WRp,{expectedAddresses:e,unexpectedAddresses:[...s]})}return r?Object.freeze({...t,signatures:Object.freeze({...t.signatures,...r})}):t}function m(e){let t=h().encode(e);return(0,c.TJ)().decode(t)}},4080:function(e,t,r){"use strict";r.d(t,{$p:function(){return f},EP:function(){return h},FL:function(){return u},Fn:function(){return b},IH:function(){return y},Iq:function(){return a},NI:function(){return o},Ou:function(){return c},SD:function(){return p},Vl:function(){return s},Xb:function(){return w},ac:function(){return m},gm:function(){return d},m_:function(){return l},mk:function(){return g},pp:function(){return x},u8:function(){return v},zP:function(){return E}});let n=BigInt(4294967296-1),i=BigInt(32);function s(e,t=!1){let r=e.length,s=new Uint32Array(r),o=new Uint32Array(r);for(let a=0;a<r;a++){let{h:r,l}=function(e,t=!1){return t?{h:Number(e&n),l:Number(e>>i&n)}:{h:0|Number(e>>i&n),l:0|Number(e&n)}}(e[a],t);[s[a],o[a]]=[r,l]}return[s,o]}let o=(e,t,r)=>e>>>r,a=(e,t,r)=>e<<32-r|t>>>r,l=(e,t,r)=>e>>>r|t<<32-r,c=(e,t,r)=>e<<32-r|t>>>r,u=(e,t,r)=>e<<64-r|t>>>r-32,f=(e,t,r)=>e>>>r-32|t<<64-r,h=(e,t,r)=>e<<r|t>>>32-r,d=(e,t,r)=>t<<r|e>>>32-r,p=(e,t,r)=>t<<r-32|e>>>64-r,g=(e,t,r)=>e<<r-32|t>>>64-r;function y(e,t,r,n){let i=(t>>>0)+(n>>>0);return{h:e+r+(i/4294967296|0)|0,l:0|i}}let m=(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),b=(e,t,r,n)=>t+r+n+(e/4294967296|0)|0,w=(e,t,r,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0),v=(e,t,r,n,i)=>t+r+n+i+(e/4294967296|0)|0,E=(e,t,r,n,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(n>>>0)+(i>>>0),x=(e,t,r,n,i,s)=>t+r+n+i+s+(e/4294967296|0)|0},20443:function(e,t,r){"use strict";r.d(t,{JQ:function(){return f}});var n=r(39896);
vendor: 4,120 bytes, line 282
282class i extends n.kb{constructor(e,t,r,i){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=i,this.buffer=new Uint8Array(e),this.view=(0,n.GL)(this.buffer)}update(e){(0,n.$h)(this),e=(0,n.O0)(e),(0,n.gk)(e);let{view:t,buffer:r,blockLen:i}=this,s=e.length;for(let o=0;o<s;){let a=Math.min(i-this.pos,s-o);if(a===i){let t=(0,n.GL)(e);for(;i<=s-o;o+=i)this.process(t,o);continue}r.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===i&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){(0,n.$h)(this),(0,n.eB)(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:i,isLE:s}=this,{pos:o}=this;t[o++]=128,(0,n.ru)(this.buffer.subarray(o)),this.padOffset>i-o&&(this.process(r,0),o=0);for(let e=o;e<i;e++)t[e]=0;!function(e,t,r,n){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,n);let i=BigInt(32),s=BigInt(4294967295),o=Number(r>>i&s),a=Number(r&s),l=n?4:0,c=n?0:4;e.setUint32(t+l,o,n),e.setUint32(t+c,a,n)}(r,i-8,BigInt(8*this.length),s),this.process(r,0);let a=(0,n.GL)(e),l=this.outputLen;if(l%4)throw Error("_sha2: outputLen should be aligned to 32bit");let c=l/4,u=this.get();if(c>u.length)throw Error("_sha2: outputLen bigger than state");for(let e=0;e<c;e++)a.setUint32(4*e,u[e],s)}digest(){let{buffer:e,outputLen:t}=this;this.digestInto(e);let r=e.slice(0,t);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());let{blockLen:t,buffer:r,length:n,finished:i,destroyed:s,pos:o}=this;return e.destroyed=s,e.finished=i,e.length=n,e.pos=o,n%t&&e.buffer.set(r),e}clone(){return this._cloneInto()}}let s=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]);var o=r(4080);let a=Uint32Array.from([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]),l=new Uint32Array(64);class c extends i{constructor(e=32){super(64,e,8,!1),this.A=0|s[0],this.B=0|s[1],this.C=0|s[2],this.D=0|s[3],this.E=0|s[4],this.F=0|s[5],this.G=0|s[6],this.H=0|s[7]}get(){let{A:e,B:t,C:r,D:n,E:i,F:s,G:o,H:a}=this;return[e,t,r,n,i,s,o,a]}set(e,t,r,n,i,s,o,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|s,this.G=0|o,this.H=0|a}process(e,t){for(let r=0;r<16;r++,t+=4)l[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=l[e-15],r=l[e-2],i=(0,n.np)(t,7)^(0,n.np)(t,18)^t>>>3,s=(0,n.np)(r,17)^(0,n.np)(r,19)^r>>>10;l[e]=s+l[e-7]+i+l[e-16]|0}let{A:r,B:i,C:s,D:o,E:c,F:u,G:f,H:h}=this;for(let e=0;e<64;e++){var d,p,g,y;let t=h+((0,n.np)(c,6)^(0,n.np)(c,11)^(0,n.np)(c,25))+((d=c)&u^~d&f)+a[e]+l[e]|0,m=((0,n.np)(r,2)^(0,n.np)(r,13)^(0,n.np)(r,22))+((p=r)&(g=i)^p&(y=s)^g&y)|0;h=f,f=u,u=c,c=o+t|0,o=s,s=i,i=r,r=t+m|0}r=r+this.A|0,i=i+this.B|0,s=s+this.C|0,o=o+this.D|0,c=c+this.E|0,u=u+this.F|0,f=f+this.G|0,h=h+this.H|0,this.set(r,i,s,o,c,u,f,h)}roundClean(){(0,n.ru)(l)}destroy(){this.set(0,0,0,0,0,0,0,0),(0,n.ru)(this.buffer)}}let u=o.Vl(["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","0
282xa831c66d2db43210","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)));u[0],u[1];let f=(0,n.V1)(()=>new c)},14671:function(e,t,r){"use strict";r.d(t,{fr:function(){return v}});var n=r(4080),i=r(39896);let s=BigInt(0),o=BigInt(1),a=BigInt(2),l=BigInt(7),c=BigInt(256),u=BigInt(113),f=[],h=[],d=[];for(let e=0,t=o,r=1,n=0;e<24;e++){[r,n]=[n,(2*r+3*n)%5],f.push(2*(5*n+r)),h.push((e+1)*(e+2)/2%64);let i=s;for(let e=0;e<7;e++)(t=(t<<o^(t>>l)*u)%c)&a&&(i^=o<<(o<<BigInt(e))-o);d.push(i)}let p=(0,n.Vl)(d,!0),g=p[0],y=p[1],m=(e,t,r)=>r>32?(0,n.SD)(e,t,r):(0,n.EP)(e,t,r),b=(e,t,r)=>r>32?(0,n.mk)(e,t,r):(0,n.gm)(e,t,r);class w extends i.kb{constructor(e,t,r,n=!1,s=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=n,this.rounds=s,(0,i.k8)(r),!(0<e&&e<200))throw Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=(0,i.Jq)(this.state)}clone(){return this._cloneInto()}keccak(){(0,i.Ux)(this.state32),function(e,t=24){let 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){let n=(t+8)%10,i=(t+2)%10,s=r[i],o=r[i+1],a=m(s,o,1)^r[n],l=b(s,o,1)^r[n+1];for(let r=0;r<50;r+=10)e[t+r]^=a,e[t+r+1]^=l}let t=e[2],i=e[3];for(let r=0;r<24;r++){let n=h[r],s=m(t,i,n),o=b(t,i,n),a=f[r];t=e[a],i=e[a+1],e[a]=s,e[a+1]=o}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]^=g[n],e[1]^=y[n]}(0,i.ru)(r)}(this.state32,this.rounds),(0,i.Ux)(this.state32),this.posOut=0,this.pos=0}update(e){(0,i.$h)(this),e=(0,i.O0)(e),(0,i.gk)(e);let{blockLen:t,state:r}=this,n=e.length;for(let i=0;i<n;){let s=Math.min(t-this.pos,n-i);for(let t=0;t<s;t++)r[this.pos++]^=e[i++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:e,suffix:t,pos:r,blockLen:n}=this;e[r]^=t,(128&t)!=0&&r===n-1&&this.keccak(),e[n-1]^=128,this.keccak()}writeInto(e){(0,i.$h)(this,!1),(0,i.gk)(e),this.finish();let t=this.state,{blockLen:r}=this;for(let n=0,i=e.length;n<i;){this.posOut>=r&&this.keccak();let s=Math.min(r-this.posOut,i-n);e.set(t.subarray(this.posOut,this.posOut+s),n),this.posOut+=s,n+=s}return e}xofInto(e){if(!this.enableXOF)throw Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return(0,i.k8)(e),this.xofInto(new Uint8Array(e))}digestInto(e){if((0,i.eB)(e,this),this.finished)throw Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,(0,i.ru)(this.state)}_cloneInto(e){let{blockLen:t,suffix:r,outputLen:n,rounds:i,enableXOF:s}=this;return e||(e=new w(t,r,n,s,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=r,e.outputLen=n,e.enableXOF=s,e.destroyed=this.destroyed,e}}let v=(0,i.V1)(()=>new w(136,1,32))},39896:function(e,t,r){"use strict";function n(e){if(!Number.isSafeInteger(e)||e<0)throw Error("positive integer expected, got "+e)}function i(e,...t){if(!(e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name))throw Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw Error("Uint8Array expected of length "+t+", got length="+e.length)}function s(e,t=!0){if(e.destroyed)throw Error("Hash instance has been destroyed");if(t&&e.finished)throw Error("Hash#digest() has already been called")}function o(e,t){i(e);let r=t.outputLen;if(e.length<r)throw Error("digestInto() expects output buffer of length at least "+r)}function a(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function l(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function c(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function u(e,t){return e<<32-t|e>>>t}r.d(t,{$h:function(){return s},GL:function(){return c},Jq:function(){return a},O0:function(){return h},Ux:function(){return f},V1:function(){return p},eB:function(){return o},gk:function(){return i},k8:function(){return n},kb:function(){return d},np:function(){return u},ru:function(){return l}});let f=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0]?e=>e:function(e){for(let r=0;r<e.length;r++){var t;e[r]=(t=e[r])<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}return e};function h(e){return"string"==typeof e&&(e=function(e){if("string"!=typeof e)throw Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}(e)),i(e),e}class d{}function p(e){let t=t=>e().update(h(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}},59177:function(e,t,r){"use strict";function n([e,t]){return`${e}=${function e(t){return Array.isArray(t)?"%5B"+t.map(e).join("%2C%20")+"%5D":"bigint"==typeof t?`${t}n`:encodeURIComponent(String(null!=t&&null===Object.getPrototypeOf(t)?{...t}:t))}(t)}`}r.d(t,{GH:function(){return f},bP:function(){return c}});
vendor: 4,332 bytes, line 282
282var i,s=class extends Error{cause=this.cause;context;constructor(...[e,t]){let r,i;if(t){let{cause:e,...n}=t;e&&(i={cause:e}),Object.keys(n).length>0&&(r=n)}super(function(e,t={}){{let r=`Solana error #${e}; Decode this error by running \`npx @solana/errors decode -- ${e}`;return Object.keys(t).length&&(r+=` '${btoa(Object.entries(t).map(n).join("&"))}'`),`${r}\``}}(e,r),i),this.context={__code:e,...r},this.name="SolanaError"}};function o(e){return"fixedSize"in e&&"number"==typeof e.fixedSize}var a=((i=a||{})[i.Little=0]="Little",i[i.Big=1]="Big",i);function l(e){return e?.endian!==1}var c=(e={})=>{var t,r;return Object.freeze({...r={fixedSize:(t={config:e,name:"u64",range:[0n,BigInt("0xffffffffffffffff")],set:(e,t,r)=>e.setBigUint64(0,BigInt(t),r),size:8}).size,write(e,r,n){t.range&&function(e,t,r,n){if(n<t||n>r)throw new s(8078011,{codecDescription:e,max:r,min:t,value:n})}(t.name,t.range[0],t.range[1],e);let i=new ArrayBuffer(t.size);return t.set(new DataView(i),e,l(t.config)),r.set(new Uint8Array(i),n),n+t.size}},encode:e=>{let t=new Uint8Array("fixedSize"in r?r.fixedSize:r.getSizeFromValue(e));return r.write(e,t,0),t}})},u=(e={})=>{var t,r;return Object.freeze({...r={fixedSize:(t={config:e,get:(e,t)=>e.getBigUint64(0,t),name:"u64",size:8}).size,read(e,r=0){!function(e,t,r=0){if(t.length-r<=0)throw new s(8078e3,{codecDescription:e})}(t.name,e,r),function(e,t,r,n=0){let i=r.length-n;if(i<t)throw new s(8078001,{bytesLength:i,codecDescription:e,expected:t})}(t.name,t.size,e,r);let n=new DataView(function(e,t,r){let n=e.byteOffset+(t??0),i=r??e.byteLength;return e.buffer.slice(n,n+i)}(e,r,t.size));return[t.get(n,l(t.config)),r+t.size]}},decode:(e,t=0)=>r.read(e,t)[0]})},f=(e={})=>(function(e,t){if(o(e)!==o(t))throw new s(8078004);if(o(e)&&o(t)&&e.fixedSize!==t.fixedSize)throw new s(8078005,{decoderFixedSize:t.fixedSize,encoderFixedSize:e.fixedSize});if(!o(e)&&!o(t)&&e.maxSize!==t.maxSize)throw new s(8078006,{decoderMaxSize:t.maxSize,encoderMaxSize:e.maxSize});return{...t,...e,decode:t.decode,encode:e.encode,read:t.read,write:e.write}})(c(e),u(e))},13025:function(e,t,r){"use strict";r.d(t,{AG:function(){return w},G0:function(){return I},IM:function(){return x},IX:function(){return g},O7:function(){return y},Rx:function(){return v},Ue:function(){return f},Yj:function(){return p},Z_:function(){return _},_4:function(){return O},bc:function(){return A},dt:function(){return S},eE:function(){return m},hu:function(){return u},i0:function(){return b},jt:function(){return E},oQ:function(){return P}});class n extends TypeError{constructor(e,t){let r;let{message:n,explanation:i,...s}=e,{path:o}=e,a=0===o.length?n:`At path: ${o.join(".")} -- ${n}`;super(i??a),null!=i&&(this.cause=a),Object.assign(this,s),this.name=this.constructor.name,this.failures=()=>r??(r=[e,...t()])}}function i(e){return"object"==typeof e&&null!=e}function s(e){return i(e)&&!Array.isArray(e)}function o(e){return"symbol"==typeof e?e.toString():"string"==typeof e?JSON.stringify(e):`${e}`}function*a(e,t,r,n){var s;for(let a of(i(s=e)&&"function"==typeof s[Symbol.iterator]||(e=[e]),e)){let e=function(e,t,r,n){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});let{path:i,branch:s}=t,{type:a}=r,{refinement:l,message:c=`Expected a value of type \`${a}\`${l?` with refinement \`${l}\``:""}, but received: \`${o(n)}\``}=e;return{value:n,type:a,refinement:l,key:i[i.length-1],path:i,branch:s,...e,message:c}}(a,t,r,n);e&&(yield e)}}function*l(e,t,r={}){let{path:n=[],branch:s=[e],coerce:o=!1,mask:a=!1}=r,c={path:n,branch:s,mask:a};o&&(e=t.coercer(e,c));let u="valid";for(let n of t.validator(e,c))n.explanation=r.message,u="not_valid",yield[n,void 0];for(let[f,h,d]of t.entries(e,c))for(let t of l(h,d,{path:void 0===f?n:[...n,f],branch:void 0===f?s:[...s,h],coerce:o,mask:a,message:r.message}))t[0]?(u=null!=t[0].refinement?"not_refined":"not_valid",yield[t[0],void 0]):o&&(h=t[1],void 0===f?e=h:e instanceof Map?e.set(f,h):e instanceof Set?e.add(h):i(e)&&(void 0!==h||f in e)&&(e[f]=h));if("not_valid"!==u)for(let n of t.refiner(e,c))n.explanation=r.message,u="not_refined",yield[n,void 0];"valid"===u&&(yield[void 0,e])}class c{constructor(e){let{type:t,schema:r,validator:n,refiner:i,coercer:s=e=>e,entries:o=function*(){}}=e;this.type=t,this.schema=r,this.entries=o,this.coercer=s,n?this.validator=(e,t)=>
282a(n(e,t),t,this,e):this.validator=()=>[],i?this.refiner=(e,t)=>a(i(e,t),t,this,e):this.refiner=()=>[]}assert(e,t){return u(e,this,t)}create(e,t){return f(e,this,t)}is(e){return!h(e,this)[0]}mask(e,t){return function(e,t,r){let n=h(e,t,{coerce:!0,mask:!0,message:r});if(!n[0])return n[1];throw n[0]}(e,this,t)}validate(e,t={}){return h(e,this,t)}}function u(e,t,r){let n=h(e,t,{message:r});if(n[0])throw n[0]}function f(e,t,r){let n=h(e,t,{coerce:!0,message:r});if(!n[0])return n[1];throw n[0]}function h(e,t,r={}){let i=l(e,t,r),s=function(e){let{done:t,value:r}=e.next();return t?void 0:r}(i);return s[0]?[new n(s[0],function*(){for(let e of i)e[0]&&(yield e[0])}),void 0]:[void 0,s[1]]}function d(e,t){return new c({type:e,schema:null,validator:t})}function p(){return d("any",()=>!0)}function g(e){return new c({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(let[r,n]of t.entries())yield[r,n,e]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||`Expected an array value, but received: ${o(e)}`})}function y(){return d("boolean",e=>"boolean"==typeof e)}function m(e){return d("instance",t=>t instanceof e||`Expected a \`${e.name}\` instance, but received: ${o(t)}`)}function b(e){let t=o(e),r=typeof e;return new c({type:"literal",schema:"string"===r||"number"===r||"boolean"===r?e:null,validator:r=>r===e||`Expected the literal \`${t}\`, but received: ${o(r)}`})}function w(e){return new c({...e,validator:(t,r)=>null===t||e.validator(t,r),refiner:(t,r)=>null===t||e.refiner(t,r)})}function v(){return d("number",e=>"number"==typeof e&&!isNaN(e)||`Expected a number, but received: ${o(e)}`)}function E(e){return new c({...e,validator:(t,r)=>void 0===t||e.validator(t,r),refiner:(t,r)=>void 0===t||e.refiner(t,r)})}function x(e,t){return new c({type:"record",schema:null,*entries(r){if(i(r))for(let n in r){let i=r[n];yield[n,n,e],yield[n,i,t]}},validator:e=>s(e)||`Expected an object, but received: ${o(e)}`,coercer:e=>s(e)?{...e}:e})}function _(){return d("string",e=>"string"==typeof e||`Expected a string, but received: ${o(e)}`)}function A(e){let t=d("never",()=>!1);return new c({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){let n=Math.max(e.length,r.length);for(let i=0;i<n;i++)yield[i,r[i],e[i]||t]}},validator:e=>Array.isArray(e)||`Expected an array, but received: ${o(e)}`,coercer:e=>Array.isArray(e)?e.slice():e})}function S(e){let t=Object.keys(e);return new c({type:"type",schema:e,*entries(r){if(i(r))for(let n of t)yield[n,r[n],e[n]]},validator:e=>s(e)||`Expected an object, but received: ${o(e)}`,coercer:e=>s(e)?{...e}:e})}function I(e){let t=e.map(e=>e.type).join(" | ");return new c({type:"union",schema:null,coercer(t,r){for(let n of e){let[e,i]=n.validate(t,{coerce:!0,mask:r.mask});if(!e)return i}return t},validator(r,n){let i=[];for(let t of e){let[...e]=l(r,t,n),[s]=e;if(!s[0])return[];for(let[t]of e)t&&i.push(t)}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${o(r)}`,...i]}})}function O(){return d("unknown",()=>!0)}function P(e,t,r){return new c({...e,coercer:(n,i)=>h(n,t)[0]?e.coercer(n,i):e.coercer(r(n,i),i)})}},33559:function(e,t,r){"use strict";r.d(t,{Z:function(){return n}});var n=function(e){if(e.length>=255)throw TypeError("Alphabet too long");let t=new Uint8Array(256);for(let e=0;e<t.length;e++)t[e]=255;for(let r=0;r<e.length;r++){let n=e.charAt(r),i=n.charCodeAt(0);if(255!==t[i])throw TypeError(n+" is ambiguous");t[i]=r}let r=e.length,n=e.charAt(0),i=Math.log(r)/Math.log(256),s=Math.log(256)/Math.log(r);function o(e){if("string"!=typeof e)throw TypeError("Expected String");if(0===e.length)return new Uint8Array;let s=0,o=0,a=0;for(;e[s]===n;)o++,s++;let l=(e.length-s)*i+1>>>0,c=new Uint8Array(l);for(;s<e.length;){let n=e.charCodeAt(s);if(n>255)return;let i=t[n];if(255===i)return;let o=0;for(let e=l-1;(0!==i||o<a)&&-1!==e;e--,o++)i+=r*c[e]>>>0,c[e]=i%256>>>0,i=i/256>>>0;if(0!==i)throw Error("Non-zero carry");a=o,s++}let u=l-a;for(;u!==l&&0===c[u];)u++;let f=new Uint8Array(o+(l-u)),h=o;for(;u!==l;)f[h++]=c[u++];return f}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw TypeError("Expected Uint8Array");if(0===t.length)return"";let i=0,o=0,a=0,l=t.length;for(;
282a!==l&&0===t[a];)a++,i++;let c=(l-a)*s+1>>>0,u=new Uint8Array(c);for(;a!==l;){let e=t[a],n=0;for(let t=c-1;(0!==e||n<o)&&-1!==t;t--,n++)e+=256*u[t]>>>0,u[t]=e%r>>>0,e=e/r>>>0;if(0!==e)throw Error("Non-zero carry");o=n,a++}let f=c-o;for(;f!==c&&0===u[f];)f++;let h=n.repeat(i);for(;f<c;++f)h+=e.charAt(u[f]);return h},decodeUnsafe:o,decode:function(e){let t=o(e);if(t)return t;throw Error("Non-base"+r+" character")}}}("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},10259:function(e,t,r){"use strict";r.d(t,{ZP:function(){return a}});let n=/"(?:_|\\u0{2}5[Ff]){2}(?:p|\\u0{2}70)(?:r|\\u0{2}72)(?:o|\\u0{2}6[Ff])(?:t|\\u0{2}74)(?:o|\\u0{2}6[Ff])(?:_|\\u0{2}5[Ff]){2}"\s*:/,i=/"(?:c|\\u0063)(?:o|\\u006[Ff])(?:n|\\u006[Ee])(?:s|\\u0073)(?:t|\\u0074)(?:r|\\u0072)(?:u|\\u0075)(?:c|\\u0063)(?:t|\\u0074)(?:o|\\u006[Ff])(?:r|\\u0072)"\s*:/,s=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function o(e,t){if("__proto__"===e||"constructor"===e&&t&&"object"==typeof t&&"prototype"in t){console.warn(`[destr] Dropping "${e}" key to prevent prototype pollution.`);return}return t}function a(e,t={}){if("string"!=typeof e)return e;if('"'===e[0]&&'"'===e[e.length-1]&&-1===e.indexOf("\\"))return e.slice(1,-1);let r=e.trim();if(r.length<=9)switch(r.toLowerCase()){case"true":return!0;case"false":return!1;case"undefined":return;case"null":return null;case"nan":return Number.NaN;case"infinity":return Number.POSITIVE_INFINITY;case"-infinity":return Number.NEGATIVE_INFINITY}if(!s.test(e)){if(t.strict)throw SyntaxError("[destr] Invalid JSON");return e}try{if(n.test(e)||i.test(e)){if(t.strict)throw Error("[destr] Possible prototype pollution");return JSON.parse(e,o)}return JSON.parse(e)}catch(r){if(t.strict)throw r;return e}}},50069:function(e,t,r){"use strict";r.d(t,{g7:function(){return n},xv:function(){return i}});let n=new TextEncoder,i=new TextDecoder},18482:function(e,t,r){"use strict";r.d(t,{J:function(){return a},c:function(){return o}});var n=r(50069);let i=e=>{let t=e;"string"==typeof t&&(t=n.g7.encode(t));let r=[];for(let e=0;e<t.length;e+=32768)r.push(String.fromCharCode.apply(null,t.subarray(e,e+32768)));return btoa(r.join(""))},s=e=>{let t=atob(e),r=new Uint8Array(t.length);for(let e=0;e<t.length;e++)r[e]=t.charCodeAt(e);return r},o=e=>i(e).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_"),a=e=>{let t=e;t instanceof Uint8Array&&(t=n.xv.decode(t)),t=t.replace(/-/g,"+").replace(/_/g,"/").replace(/\s/g,"");try{return s(t)}catch(e){throw TypeError("The input to be decoded is not correctly encoded.")}}},5693:function(e,t,r){"use strict";r.d(t,{gh:function(){return eF}});var n={};r.r(n),r.d(n,{identity:function(){return B}});var i={};r.r(i),r.d(i,{base2:function(){return R}});var s={};r.r(s),r.d(s,{base8:function(){return D}});var o={};r.r(o),r.d(o,{base10:function(){return U}});var a={};r.r(a),r.d(a,{base16:function(){return M},base16upper:function(){return N}});var l={};r.r(l),r.d(l,{base32:function(){return j},base32hex:function(){return F},base32hexpad:function(){return W},base32hexpadupper:function(){return V},base32hexupper:function(){return q},base32pad:function(){return $},base32padupper:function(){return z},base32upper:function(){return L},base32z:function(){return H}});var c={};r.r(c),r.d(c,{base36:function(){return G},base36upper:function(){return K}});var u={};r.r(u),r.d(u,{base58btc:function(){return Z},base58flickr:function(){return J}});var f={};r.r(f),r.d(f,{base64:function(){return Y},base64pad:function(){return X},base64url:function(){return Q},base64urlpad:function(){return ee}});var h={};r.r(h),r.d(h,{base256emoji:function(){return ei}});var d={};r.r(d),r.d(d,{sha256:function(){return em},sha512:function(){return eb}});var p={};r.r(p),r.d(p,{identity:function(){return ew}});var g={};r.r(g),r.d(g,{code:function(){return eE},decode:function(){return e_},encode:function(){return ex},name:function(){return ev}});var y={};r.r(y),r.d(y,{code:function(){return eO},decode:function(){return eC},encode:function(){return eP},name:function(){return eI}});var m=function(e,t){if(e.length>=255)throw TypeError("Alphabet too long");
282for(var r=new Uint8Array(256),n=0;n<r.length;n++)r[n]=255;for(var i=0;i<e.length;i++){var s=e.charAt(i),o=s.charCodeAt(0);if(255!==r[o])throw TypeError(s+" is ambiguous");r[o]=i}var a=e.length,l=e.charAt(0),c=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function f(e){if("string"!=typeof e)throw TypeError("Expected String");if(0===e.length)return new Uint8Array;var t=0;if(" "!==e[0]){for(var n=0,i=0;e[t]===l;)n++,t++;for(var s=(e.length-t)*c+1>>>0,o=new Uint8Array(s);e[t];){var u=r[e.charCodeAt(t)];if(255===u)return;for(var f=0,h=s-1;(0!==u||f<i)&&-1!==h;h--,f++)u+=a*o[h]>>>0,o[h]=u%256>>>0,u=u/256>>>0;if(0!==u)throw Error("Non-zero carry");i=f,t++}if(" "!==e[t]){for(var d=s-i;d!==s&&0===o[d];)d++;for(var p=new Uint8Array(n+(s-d)),g=n;d!==s;)p[g++]=o[d++];return p}}}return{encode:function(t){if(t instanceof Uint8Array||(ArrayBuffer.isView(t)?t=new Uint8Array(t.buffer,t.byteOffset,t.byteLength):Array.isArray(t)&&(t=Uint8Array.from(t))),!(t instanceof Uint8Array))throw TypeError("Expected Uint8Array");if(0===t.length)return"";for(var r=0,n=0,i=0,s=t.length;i!==s&&0===t[i];)i++,r++;for(var o=(s-i)*u+1>>>0,c=new Uint8Array(o);i!==s;){for(var f=t[i],h=0,d=o-1;(0!==f||h<n)&&-1!==d;d--,h++)f+=256*c[d]>>>0,c[d]=f%a>>>0,f=f/a>>>0;if(0!==f)throw Error("Non-zero carry");n=h,i++}for(var p=o-n;p!==o&&0===c[p];)p++;for(var g=l.repeat(r);p<o;++p)g+=e.charAt(c[p]);return g},decodeUnsafe:f,decode:function(e){var r=f(e);if(r)return r;throw Error(`Non-${t} character`)}}};new Uint8Array(0);let b=(e,t)=>{if(e===t)return!0;if(e.byteLength!==t.byteLength)return!1;for(let r=0;r<e.byteLength;r++)if(e[r]!==t[r])return!1;return!0},w=e=>{if(e instanceof Uint8Array&&"Uint8Array"===e.constructor.name)return e;if(e instanceof ArrayBuffer)return new Uint8Array(e);if(ArrayBuffer.isView(e))return new Uint8Array(e.buffer,e.byteOffset,e.byteLength);throw Error("Unknown type, must be binary type")},v=e=>new TextEncoder().encode(e),E=e=>new TextDecoder().decode(e);class x{constructor(e,t,r){this.name=e,this.prefix=t,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class _{constructor(e,t,r){if(this.name=e,this.prefix=t,void 0===t.codePointAt(0))throw Error("Invalid prefix character");this.prefixCodePoint=t.codePointAt(0),this.baseDecode=r}decode(e){if("string"==typeof e){if(e.codePointAt(0)!==this.prefixCodePoint)throw Error(`Unable to decode multibase string ${JSON.stringify(e)}, ${this.name} decoder only supports inputs prefixed with ${this.prefix}`);return this.baseDecode(e.slice(this.prefix.length))}throw Error("Can only multibase decode strings")}or(e){return S(this,e)}}class A{constructor(e){this.decoders=e}or(e){return S(this,e)}decode(e){let t=e[0],r=this.decoders[t];if(r)return r.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}let S=(e,t)=>new A({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class I{constructor(e,t,r,n){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=n,this.encoder=new x(e,t,r),this.decoder=new _(e,t,n)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}let O=({name:e,prefix:t,encode:r,decode:n})=>new I(e,t,r,n),P=({prefix:e,name:t,alphabet:r})=>{let{encode:n,decode:i}=m(r,t);return O({prefix:e,name:t,encode:n,decode:e=>w(i(e))})},C=(e,t,r,n)=>{let i={};for(let e=0;e<t.length;++e)i[t[e]]=e;let s=e.length;for(;"="===e[s-1];)--s;let o=new Uint8Array(s*r/8|0),a=0,l=0,c=0;for(let t=0;t<s;++t){let s=i[e[t]];if(void 0===s)throw SyntaxError(`Non-${n} character`);l=l<<r|s,(a+=r)>=8&&(a-=8,o[c++]=255&l>>a)}if(a>=r||255&l<<8-a)throw SyntaxError("Unexpected end of data");return o},k=(e,t,r)=>{let n="="===t[t.length-1],i=(1<<r)-1,s="",o=0,a=0;for(let n=0;n<e.length;++n)for(a=a<<8|e[n],o+=8;o>r;)o-=r,s+=t[i&a>>o];if(o&&(s+=t[i&a<<r-o]),n)for(;s.length*r&7;)s+="=";return s},T=({name:e,prefix:t,bitsPerChar:r,alphabet:n})=>O({prefix:t,name:e,encode:e=>k(e,n,r),decode:t=>C(t,n,r,e)}),B=O({prefix:"\0",name:"identity",encode:e=>E(e),decode:e=>v(e)}),R=T({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),D=T({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),U=P({prefix:"9",name:"base10",alphabet:"0123456789"}),M=T({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),N=T({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),j=T({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),L=T({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),$=T({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),z=T({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),F=T({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),q=T({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),W=T({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),V=T({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),H=T({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),G=P({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),K=P({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),Z=P({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),J=P({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),Y=T({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
282+/",bitsPerChar:6}),X=T({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Q=T({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),ee=T({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),et=Array.from("\uD83D\uDE80\uD83E\uDE90â\uD83D\uDEF0\uD83C\uDF0C\uD83C\uDF11\uD83C\uDF12\uD83C\uDF13\uD83C\uDF14\uD83C\uDF15\uD83C\uDF16\uD83C\uDF17\uD83C\uDF18\uD83C\uDF0D\uD83C\uDF0F\uD83C\uDF0E\uD83D\uDC09â\uD83D\uDCBB\uD83D\uDDA5\uD83D\uDCBE\uD83D\uDCBF\uD83D\uDE02â¤\uD83D\uDE0D\uD83E\uDD23\uD83D\uDE0A\uD83D\uDE4F\uD83D\uDC95\uD83D\uDE2D\uD83D\uDE18\uD83D\uDC4D\uD83D\uDE05\uD83D\uDC4F\uD83D\uDE01\uD83D\uDD25\uD83E\uDD70\uD83D\uDC94\uD83D\uDC96\uD83D\uDC99\uD83D\uDE22\uD83E\uDD14\uD83D\uDE06\uD83D\uDE44\uD83D\uDCAA\uD83D\uDE09âº\uD83D\uDC4C\uD83E\uDD17\uD83D\uDC9C\uD83D\uDE14\uD83D\uDE0E\uD83D\uDE07\uD83C\uDF39\uD83E\uDD26\uD83C\uDF89\uD83D\uDC9Eââ¨\uD83E\uDD37\uD83D\uDE31\uD83D\uDE0C\uD83C\uDF38\uD83D\uDE4C\uD83D\uDE0B\uD83D\uDC97\uD83D\uDC9A\uD83D\uDE0F\uD83D\uDC9B\uD83D\uDE42\uD83D\uDC93\uD83E\uDD29\uD83D\uDE04\uD83D\uDE00\uD83D\uDDA4\uD83D\uDE03\uD83D\uDCAF\uD83D\uDE48\uD83D\uDC47\uD83C\uDFB6\uD83D\uDE12\uD83E\uDD2Dâ£\uD83D\uDE1C\uD83D\uDC8B\uD83D\uDC40\uD83D\uDE2A\uD83D\uDE11\uD83D\uDCA5\uD83D\uDE4B\uD83D\uDE1E\uD83D\uDE29\uD83D\uDE21\uD83E\uDD2A\uD83D\uDC4A\uD83E\uDD73\uD83D\uDE25\uD83E\uDD24\uD83D\uDC49\uD83D\uDC83\uD83D\uDE33â\uD83D\uDE1A\uD83D\uDE1D\uD83D\uDE34\uD83C\uDF1F\uD83D\uDE2C\uD83D\uDE43\uD83C\uDF40\uD83C\uDF37\uD83D\uDE3B\uD83D\uDE13ââ
\uD83E\uDD7A\uD83C\uDF08\uD83D\uDE08\uD83E\uDD18\uD83D\uDCA6â\uD83D\uDE23\uD83C\uDFC3\uD83D\uDC90â¹\uD83C\uDF8A\uD83D\uDC98\uD83D\uDE20â\uD83D\uDE15\uD83C\uDF3A\uD83C\uDF82\uD83C\uDF3B\uD83D\uDE10\uD83D\uDD95\uD83D\uDC9D\uD83D\uDE4A\uD83D\uDE39\uD83D\uDDE3\uD83D\uDCAB\uD83D\uDC80\uD83D\uDC51\uD83C\uDFB5\uD83E\uDD1E\uD83D\uDE1B\uD83D\uDD34\uD83D\uDE24\uD83C\uDF3C\uD83D\uDE2Bâ½\uD83E\uDD19â\uD83C\uDFC6\uD83E\uDD2B\uD83D\uDC48\uD83D\uDE2E\uD83D\uDE46\uD83C\uDF7B\uD83C\uDF43\uD83D\uDC36\uD83D\uDC81\uD83D\uDE32\uD83C\uDF3F\uD83E\uDDE1\uD83C\uDF81â¡\uD83C\uDF1E\uD83C\uDF88ââ\uD83D\uDC4B\uD83D\uDE30\uD83E\uDD28\uD83D\uDE36\uD83E\uDD1D\uD83D\uDEB6\uD83D\uDCB0\uD83C\uDF53\uD83D\uDCA2\uD83E\uDD1F\uD83D\uDE41\uD83D\uDEA8\uD83D\uDCA8\uD83E\uDD2Câ\uD83C\uDF80\uD83C\uDF7A\uD83E\uDD13\uD83D\uDE19\uD83D\uDC9F\uD83C\uDF31\uD83D\uDE16\uD83D\uDC76\uD83E\uDD74â¶â¡â\uD83D\uDC8E\uD83D\uDCB8â¬\uD83D\uDE28\uD83C\uDF1A\uD83E\uDD8B\uD83D\uDE37\uD83D\uDD7Aâ \uD83D\uDE45\uD83D\uDE1F\uD83D\uDE35\uD83D\uDC4E\uD83E\uDD32\uD83E\uDD20\uD83E\uDD27\uD83D\uDCCC\uD83D\uDD35\uD83D\uDC85\uD83E\uDDD0\uD83D\uDC3E\uD83C\uDF52\uD83D\uDE17\uD83E\uDD11\uD83C\uDF0A\uD83E\uDD2F\uD83D\uDC37â\uD83D\uDCA7\uD83D\uDE2F\uD83D\uDC86\uD83D\uDC46\uD83C\uDFA4\uD83D\uDE47\uD83C\uDF51â\uD83C\uDF34\uD83D\uDCA3\uD83D\uDC38\uD83D\uDC8C\uD83D\uDCCD\uD83E\uDD40\uD83E\uDD22\uD83D\uDC45\uD83D\uDCA1\uD83D\uDCA9\uD83D\uDC50\uD83D\uDCF8\uD83D\uDC7B\uD83E\uDD10\uD83E\uDD2E\uD83C\uDFBC\uD83E\uDD75\uD83D\uDEA9\uD83C\uDF4E\uD83C\uDF4A\uD83D\uDC7C\uD83D\uDC8D\uD83D\uDCE3\uD83E\uDD42"),er=et.reduce((e,t,r)=>(e[r]=t,e),[]),en=et.reduce((e,t,r)=>(e[t.codePointAt(0)]=r,e),[]),ei=O({prefix:"\uD83D\uDE80",name:"base256emoji",encode:function(e){return e.reduce((e,t)=>e+=er[t],"")},decode:function(e){let t=[];for(let r of e){let e=en[r.codePointAt(0)];if(void 0===e)throw Error(`Non-base256emoji character: ${r}`);t.push(e)}return new Uint8Array(t)}});var es=function e(t,r,n){r=r||[];for(var i=n=n||0;t>=2147483648;)r[n++]=255&t|128,t/=128;for(;-128&t;)r[n++]=255&t|128,t>>>=7;return r[n]=0|t,e.bytes=n-i+1,r},eo=function e(t,r){var n,i=0,r=r||0,s=0,o=r,a=t.length;do{if(o>=a)throw e.bytes=0,RangeError("Could not decode varint");n=t[o++],i+=s<28?(127&n)<<s:(127&n)*Math.pow(2,s),s+=7}while(n>=128);return e.bytes=o-r,i};let ea=(e,t=0)=>[eo(e,t),eo.bytes],el=(e,t,r=0)=>(es(e,t,r),t),ec=e=>e<128?1:e<16384?2:e<2097152?3:e<268435456?4:e<34359738368?5:e<4398046511104?6:e<562949953421312?7:e<72057594037927940?8:e<0x7fffffffffffffff?9:10,eu=(e,t)=>
282{let r=t.byteLength,n=ec(e),i=n+ec(r),s=new Uint8Array(i+r);return el(e,s,0),el(r,s,n),s.set(t,i),new ed(e,r,t,s)},ef=e=>{let t=w(e),[r,n]=ea(t),[i,s]=ea(t.subarray(n)),o=t.subarray(n+s);if(o.byteLength!==i)throw Error("Incorrect length");return new ed(r,i,o,t)},eh=(e,t)=>e===t||e.code===t.code&&e.size===t.size&&b(e.bytes,t.bytes);class ed{constructor(e,t,r,n){this.code=e,this.size=t,this.digest=r,this.bytes=n}}let ep=({name:e,code:t,encode:r})=>new eg(e,t,r);class eg{constructor(e,t,r){this.name=e,this.code=t,this.encode=r}digest(e){if(e instanceof Uint8Array){let t=this.encode(e);return t instanceof Uint8Array?eu(this.code,t):t.then(e=>eu(this.code,e))}throw Error("Unknown type, must be binary type")}}let ey=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),em=ep({name:"sha2-256",code:18,encode:ey("SHA-256")}),eb=ep({name:"sha2-512",code:19,encode:ey("SHA-512")}),ew={code:0,name:"identity",encode:w,digest:e=>eu(0,w(e))},ev="raw",eE=85,ex=e=>w(e),e_=e=>w(e),eA=new TextEncoder,eS=new TextDecoder,eI="json",eO=512,eP=e=>eA.encode(JSON.stringify(e)),eC=e=>JSON.parse(eS.decode(e));class ek{constructor(e,t,r,n){this.code=t,this.version=e,this.multihash=r,this.bytes=n,this.byteOffset=n.byteOffset,this.byteLength=n.byteLength,this.asCID=this,this._baseCache=new Map,Object.defineProperties(this,{byteOffset:eL,byteLength:eL,code:ej,version:ej,multihash:ej,bytes:ej,_baseCache:eL,asCID:eL})}toV0(){if(0===this.version)return this;{let{code:e,multihash:t}=this;if(e!==eD)throw Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==eU)throw Error("Cannot convert non sha2-256 multihash CID to CIDv0");return ek.createV0(t)}}toV1(){switch(this.version){case 0:{let{code:e,digest:t}=this.multihash,r=eu(e,t);return ek.createV1(this.code,r)}case 1:return this;default:throw Error(`Can not convert CID version ${this.version} to version 0. This is a bug please report`)}}equals(e){return e&&this.code===e.code&&this.version===e.version&&eh(this.multihash,e.multihash)}toString(e){let{bytes:t,version:r,_baseCache:n}=this;return 0===r?eB(t,n,e||Z.encoder):eR(t,n,e||j.encoder)}toJSON(){return{code:this.code,version:this.version,hash:this.multihash.bytes}}get[Symbol.toStringTag](){return"CID"}[Symbol.for("nodejs.util.inspect.custom")](){return"CID("+this.toString()+")"}static isCID(e){return e$(/^0\.0/,ez),!!(e&&(e[eN]||e.asCID===e))}get toBaseEncodedString(){throw Error("Deprecated, use .toString()")}get codec(){throw Error('"codec" property is deprecated, use integer "code" property instead')}get buffer(){throw Error("Deprecated .buffer property, use .bytes to get Uint8Array instead")}get multibaseName(){throw Error('"multibaseName" property is deprecated')}get prefix(){throw Error('"prefix" property is deprecated')}static asCID(e){if(e instanceof ek)return e;if(null!=e&&e.asCID===e){let{version:t,code:r,multihash:n,bytes:i}=e;return new ek(t,r,n,i||eM(t,r,n.bytes))}if(null==e||!0!==e[eN])return null;{let{version:t,multihash:r,code:n}=e,i=ef(r);return ek.create(t,n,i)}}static create(e,t,r){if("number"!=typeof t)throw Error("String codecs are no longer supported");switch(e){case 0:if(t===eD)return new ek(e,t,r,r.bytes);throw Error(`Version 0 CID must use dag-pb (code: ${eD}) block encoding`);case 1:{let n=eM(e,t,r.bytes);return new ek(e,t,r,n)}default:throw Error("Invalid version")}}static createV0(e){return ek.create(0,eD,e)}static createV1(e,t){return ek.create(1,e,t)}static decode(e){let[t,r]=ek.decodeFirst(e);if(r.length)throw Error("Incorrect length");return t}static decodeFirst(e){let t=ek.inspectBytes(e),r=t.size-t.multihashSize,n=w(e.subarray(r,r+t.multihashSize));if(n.byteLength!==t.multihashSize)throw Error("Incorrect length");let i=n.subarray(t.multihashSize-t.digestSize),s=new ed(t.multihashCode,t.digestSize,i,n);return[0===t.version?ek.createV0(s):ek.createV1(t.codec,s),e.subarray(t.size)]}static inspectBytes(e){let t=0,r=()=>{let[r,n]=ea(e.subarray(t));return t+=n,r},n=r(),i=eD;if(18===n?(n=0,t=0):1===n&&(i=r()),0!==n&&1!==n)throw RangeError(`Invalid CID version ${n}`);let s=t,o=r(),a=r(),l=t+a;return{version:n,codec:i,multihashCode:o,digestSize:a,multihashSize:l-s,size:l}}static parse(e,t){let[r,n]=eT(e,t),i=ek.decode(n);return i._baseCache.set(r,e),i}}let eT=(e,t)=>
282{switch(e[0]){case"Q":return[Z.prefix,(t||Z).decode(`${Z.prefix}${e}`)];case Z.prefix:return[Z.prefix,(t||Z).decode(e)];case j.prefix:return[j.prefix,(t||j).decode(e)];default:if(null==t)throw Error("To parse non base32 or base58btc encoded CID multibase decoder must be provided");return[e[0],t.decode(e)]}},eB=(e,t,r)=>{let{prefix:n}=r;if(n!==Z.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let i=t.get(n);if(null!=i)return i;{let i=r.encode(e).slice(1);return t.set(n,i),i}},eR=(e,t,r)=>{let{prefix:n}=r,i=t.get(n);if(null!=i)return i;{let i=r.encode(e);return t.set(n,i),i}},eD=112,eU=18,eM=(e,t,r)=>{let n=ec(e),i=n+ec(t),s=new Uint8Array(i+r.byteLength);return el(e,s,0),el(t,s,n),s.set(r,i),s},eN=Symbol.for("@ipld/js-cid/CID"),ej={writable:!1,configurable:!1,enumerable:!0},eL={writable:!1,enumerable:!1,configurable:!1},e$=(e,t)=>{if(e.test("0.0.0-dev"))console.warn(t);else throw Error(t)},ez=`CID.isCID(v) is deprecated and will be removed in the next major release. 283Following code pattern: 284 285if (CID.isCID(value)) { 286 doSomethingWithCID(value) 287} 288 289Is replaced with: 290 291const cid = CID.asCID(value) 292if (cid) { 293 // Make sure to use cid instead of value 294 doSomethingWithCID(cid) 295} 296`,eF={...n,...i,...s,...o,...a,...l,...c,...u,...f,...h};({...d,...p})},94498:function(e,t,r){"use strict";r.d(t,{F:function(){return A},c:function(){return function e(t={}){let{fetch:r=globalThis.fetch,Headers:i=globalThis.Headers,AbortController:s=globalThis.AbortController}=t;async function o(e){let t=e.error&&"AbortError"===e.error.name&&!e.options.timeout||!1;if(!1!==e.options.retry&&!t){let t;t="number"==typeof e.options.retry?e.options.retry:I(e.options.method)?0:1;let r=e.response&&e.response.status||500;if(t>0&&(Array.isArray(e.options.retryStatusCodes)?e.options.retryStatusCodes.includes(r):k.has(r))){let r="function"==typeof e.options.retryDelay?e.options.retryDelay(e):e.options.retryDelay||0;return r>0&&await new Promise(e=>setTimeout(e,r)),a(e.request,{...e.options,retry:t-1})}}let r=function(e){let t=e.error?.message||e.error?.toString()||"",r=e.request?.method||e.options?.method||"GET",n=e.request?.url||String(e.request)||"/",i=`[${r}] ${JSON.stringify(n)}`,s=e.response?`${e.response.status} ${e.response.statusText}`:"<no response>",o=new A(`${i}: ${s}${t?` ${t}`:""}`,e.error?{cause:e.error}:void 0);for(let t of["request","options","response"])Object.defineProperty(o,t,{get:()=>e[t]});for(let[t,r]of[["data","_data"],["status","status"],["statusCode","status"],["statusText","statusText"],["statusMessage","statusText"]])Object.defineProperty(o,t,{get:()=>e.response&&e.response[r]});return o}(e);throw Error.captureStackTrace&&Error.captureStackTrace(r,a),r}let a=async function(e,a={}){let c;let u={request:e,options:function(e,t,r,n){let i;let s=function(e,t,r){if(!t)return new r(e);let n=new r(t);if(e)for(let[t,i]of Symbol.iterator in e||Array.isArray(e)?e:new r(e))n.set(t,i);return n}(t?.headers??e?.headers,r?.headers,n);return(r?.query||r?.params||t?.params||t?.query)&&(i={...r?.params,...r?.query,...t?.params,...t?.query}),{...r,...t,query:i,params:i,headers:s}}(e,a,t.defaults,i),response:void 0,error:void 0};if(u.options.method&&(u.options.method=u.options.method.toUpperCase()),!u.options.onRequest||(await C(u,u.options.onRequest),u.options.headers instanceof i||(u.options.headers=new i(u.options.headers||{}))),"string"==typeof u.request&&(u.options.baseURL&&(u.request=function(e,t){if(!t||"/"===t||E(e))return e;let r=function(e="",t){return(!function(e="",t){return e.endsWith("/")}(e)?e:e.slice(0,-1))||"/"}(t);if(e.startsWith(r)){let t=e[r.length];if(!t||"/"===t||"?"===t)return e}return function(e,...t){let r=e||"";for(let e of t.filter(e=>e&&"/"!==e))if(r){let t=e.replace(v,"");r=function(e="",t){return e.endsWith("/")?e:e+"/"}(r)+t}else r=e;return r}(r,e)}(u.request,u.options.baseURL)),u.options.query&&(u.request=function(e,t){let r=function e(t="",r){let n=t.match(/^[\s\0]*(blob:|data:|javascript:|vbscript:)(.*)/i);if(n){let[,e,t=""]=n;return{protocol:e.toLowerCase(),pathname:t,href:e+t,auth:"",host:"",search:"",hash:""}}if(!E(t,{acceptRelative:!0}))return r?e(r+t):_(t);let[,i="",s,o=""]=t.replace(/\\/g,"/").match(/^[\s\0]*([\w+.-]{2,}:)?\/\/([^/@]+@)?(.*)/)||[],[,a="",l=""]=o.match(/([^#/?]*)(.*)?/)||[];"file:"===i&&(l=l.replace(/\/(?=[A-Za-z]:)/,""));let{pathname:c,search:u,hash:f}=_(l);return{protocol:i.toLowerCase(),auth:s?s.slice(0,Math.max(0,s.length-1)):"",host:a,pathname:c,search:u,hash:f,[x]:!i}}(e),n={...function(e=""){let t=Object.create(null);for(let r of("?"===e[0]&&(e=e.slice(1)),e.split("&"))){let e=r.match(/([^=]+)=?(.*)/)||[];if(e.length<2)continue;let n=g(e[1].replace(l," "));if("__proto__"===n||"constructor"===n)continue;let i=g((e[2]||"").replace(l," "));void 0===t[n]?t[n]=i:Array.isArray(t[n])?t[n].push(i):t[n]=[t[n],i]}return t}(r.search),...t};return r.search=Object.keys(n).filter(e=>void 0!==n[e]).map(e=>{var t;return(("number"==typeof(t=n[e])||"boolean"==typeof t)&&(t=String(t)),t)?Array.isArray(t)?t.map(t=>`${p(e)}=${d(t)}`).join("&"):`${p(e)}=${d(t)}`:p(e)}
296).filter(Boolean).join("&"),function(e){let t=e.pathname||"",r=e.search?(e.search.startsWith("?")?"":"?")+e.search:"",n=e.hash||"",i=e.auth?e.auth+"@":"",s=e.host||"";return(e.protocol||e[x]?(e.protocol||"")+"//":"")+i+s+t+r+n}(r)}(u.request,u.options.query),delete u.options.query),"query"in u.options&&delete u.options.query,"params"in u.options&&delete u.options.params),u.options.body&&I(u.options.method)){if(function(e){if(void 0===e)return!1;let t=typeof e;return"string"===t||"number"===t||"boolean"===t||null===t||"object"===t&&(!!Array.isArray(e)||!(e.buffer||e instanceof FormData||e instanceof URLSearchParams)&&(e.constructor&&"Object"===e.constructor.name||"function"==typeof e.toJSON))}(u.options.body)){let e=u.options.headers.get("content-type");"string"!=typeof u.options.body&&(u.options.body="application/x-www-form-urlencoded"===e?new URLSearchParams(u.options.body).toString():JSON.stringify(u.options.body)),e||u.options.headers.set("content-type","application/json"),u.options.headers.has("accept")||u.options.headers.set("accept","application/json")}else("pipeTo"in u.options.body&&"function"==typeof u.options.body.pipeTo||"function"==typeof u.options.body.pipe)&&!("duplex"in u.options)&&(u.options.duplex="half")}if(!u.options.signal&&u.options.timeout){let e=new s;c=setTimeout(()=>{let t=Error("[TimeoutError]: The operation was aborted due to timeout");t.name="TimeoutError",t.code=23,e.abort(t)},u.options.timeout),u.options.signal=e.signal}try{u.response=await r(u.request,u.options)}catch(e){return u.error=e,u.options.onRequestError&&await C(u,u.options.onRequestError),await o(u)}finally{c&&clearTimeout(c)}if((u.response.body||u.response._bodyInit)&&!T.has(u.response.status)&&"HEAD"!==u.options.method){let e=(u.options.parseResponse?"json":u.options.responseType)||function(e=""){if(!e)return"json";let t=e.split(";").shift()||"";return P.test(t)?"json":"text/event-stream"===t?"stream":O.has(t)||t.startsWith("text/")?"text":"blob"}(u.response.headers.get("content-type")||"");switch(e){case"json":{let e=await u.response.text(),t=u.options.parseResponse||n.ZP;u.response._data=t(e);break}case"stream":u.response._data=u.response.body||u.response._bodyInit;break;default:u.response._data=await u.response[e]()}}return(u.options.onResponse&&await C(u,u.options.onResponse),!u.options.ignoreResponseError&&u.response.status>=400&&u.response.status<600)?(u.options.onResponseError&&await C(u,u.options.onResponseError),await o(u)):u.response},c=async function(e,t){return(await a(e,t))._data};return c.raw=a,c.native=(...e)=>r(...e),c.create=(r={},n={})=>e({...t,...n,defaults:{...t.defaults,...n.defaults,...r}}),c}}});var n=r(10259);let i=/#/g,s=/&/g,o=/\//g,a=/=/g,l=/\+/g,c=/%5e/gi,u=/%60/gi,f=/%7c/gi,h=/%20/gi;function d(e){return encodeURI(""+("string"==typeof e?e:JSON.stringify(e))).replace(f,"|").replace(l,"%2B").replace(h,"+").replace(i,"%23").replace(s,"%26").replace(u,"`").replace(c,"^").replace(o,"%2F")}function p(e){return d(e).replace(a,"%3D")}function g(e=""){try{return decodeURIComponent(""+e)}catch{return""+e}}let y=/^[\s\w\0+.-]{2,}:([/\\]{1,2})/,m=/^[\s\w\0+.-]{2,}:([/\\]{2})?/,b=/^([/\\]\s*){2,}[^/\\]/,w=/\/$|\/\?|\/#/,v=/^\.?\//;function E(e,t={}){return("boolean"==typeof t&&(t={acceptRelative:t}),t.strict)?y.test(e):m.test(e)||!!t.acceptRelative&&b.test(e)}let x=Symbol.for("ufo:protocolRelative");function _(e=""){let[t="",r="",n=""]=(e.match(/([^#?]*)(\?[^#]*)?(#.*)?/)||[]).splice(1);return{pathname:t,search:r,hash:n}}class A extends Error{constructor(e,t){super(e,t),this.name="FetchError",t?.cause&&!this.cause&&(this.cause=t.cause)}}let S=new Set(Object.freeze(["PATCH","POST","PUT","DELETE"]));function I(e="GET"){return S.has(e.toUpperCase())}let O=new Set(["image/svg","application/xml","application/xhtml","application/html"]),P=/^application\/(?:[\w!#$%&*.^`~-]*\+)?json(;.+)?$/i;async function C(e,t){if(t){if(Array.isArray(t))for(let r of t)await r(e);else await t(e)}}let k=new Set([408,409,425,429,500,502,503,504]),T=new Set([101,204,205,304])},73364:function(e,t,r){"use strict";r.d(t,{Ey:function(){return l},XY:function(){return o}});var n=r(9109),i=r(23466),s=class extends i{socket;constructor(e,t){super(),this.socket=new window.WebSocket(e,t.protocols),this.socket.onopen=()=>
vendor: 4,309 bytes, line 296
296this.emit("open"),this.socket.onmessage=e=>this.emit("message",e.data),this.socket.onerror=e=>this.emit("error",e),this.socket.onclose=e=>{this.emit("close",e.code,e.reason)}}send(e,t,r){let n=r||t;try{this.socket.send(e),n()}catch(e){n(e)}}close(e,t){this.socket.close(e,t)}addEventListener(e,t,r){this.socket.addEventListener(e,t,r)}};function o(e,t){return new s(e,t)}var a=class{encode(e){return JSON.stringify(e)}decode(e){return JSON.parse(e)}},l=class extends i{address;rpc_id;queue;options;autoconnect;ready;reconnect;reconnect_timer_id;reconnect_interval;max_reconnects;rest_options;current_reconnects;generate_request_id;socket;webSocketFactory;dataPack;constructor(e,t="ws://localhost:8080",{autoconnect:r=!0,reconnect:n=!0,reconnect_interval:i=1e3,max_reconnects:s=5,...o}={},l,c){super(),this.webSocketFactory=e,this.queue={},this.rpc_id=0,this.address=t,this.autoconnect=r,this.ready=!1,this.reconnect=n,this.reconnect_timer_id=void 0,this.reconnect_interval=i,this.max_reconnects=s,this.rest_options=o,this.current_reconnects=0,this.generate_request_id=l||(()=>"number"==typeof this.rpc_id?++this.rpc_id:Number(this.rpc_id)+1),c?this.dataPack=c:this.dataPack=new a,this.autoconnect&&this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}connect(){this.socket||this._connect(this.address,{autoconnect:this.autoconnect,reconnect:this.reconnect,reconnect_interval:this.reconnect_interval,max_reconnects:this.max_reconnects,...this.rest_options})}call(e,t,r,n){return n||"object"!=typeof r||(n=r,r=null),new Promise((i,s)=>{if(!this.ready)return s(Error("socket not ready"));let o=this.generate_request_id(e,t);this.socket.send(this.dataPack.encode({jsonrpc:"2.0",method:e,params:t||void 0,id:o}),n,e=>{if(e)return s(e);this.queue[o]={promise:[i,s]},r&&(this.queue[o].timeout=setTimeout(()=>{delete this.queue[o],s(Error("reply timeout"))},r))})})}async login(e){let t=await this.call("rpc.login",e);if(!t)throw Error("authentication failed");return t}async listMethods(){return await this.call("__listMethods")}notify(e,t){return new Promise((r,n)=>{if(!this.ready)return n(Error("socket not ready"));this.socket.send(this.dataPack.encode({jsonrpc:"2.0",method:e,params:t}),e=>{if(e)return n(e);r()})})}async subscribe(e){"string"==typeof e&&(e=[e]);let t=await this.call("rpc.on",e);if("string"==typeof e&&"ok"!==t[e])throw Error("Failed subscribing to an event '"+e+"' with: "+t[e]);return t}async unsubscribe(e){"string"==typeof e&&(e=[e]);let t=await this.call("rpc.off",e);if("string"==typeof e&&"ok"!==t[e])throw Error("Failed unsubscribing from an event with: "+t);return t}close(e,t){this.socket&&this.socket.close(e||1e3,t)}setAutoReconnect(e){this.reconnect=e}setReconnectInterval(e){this.reconnect_interval=e}setMaxReconnects(e){this.max_reconnects=e}getCurrentReconnects(){return this.current_reconnects}getMaxReconnects(){return this.max_reconnects}isReconnecting(){return void 0!==this.reconnect_timer_id}willReconnect(){return this.reconnect&&(0===this.max_reconnects||this.current_reconnects<this.max_reconnects)}_connect(e,t){clearTimeout(this.reconnect_timer_id),this.socket=this.webSocketFactory(e,t),this.socket.addEventListener("open",()=>{this.ready=!0,this.emit("open"),this.current_reconnects=0}),this.socket.addEventListener("message",({data:e})=>{e instanceof ArrayBuffer&&(e=n.Buffer.from(e).toString());try{e=this.dataPack.decode(e)}catch(e){return}if(e.notification&&this.listeners(e.notification).length){if(!Object.keys(e.params).length)return this.emit(e.notification);let t=[e.notification];if(e.params.constructor===Object)t.push(e.params);else for(let r=0;r<e.params.length;r++)t.push(e.params[r]);return Promise.resolve().then(()=>{this.emit.apply(this,t)})}if(!this.queue[e.id])return e.method?Promise.resolve().then(()=>{this.emit(e.method,e?.params)}):void 0;"error"in e=="result"in e&&this.queue[e.id].promise[1](Error('Server response malformed. Response must include either "result" or "error", but not both.')),this.queue[e.id].timeout&&clearTimeout(this.queue[e.id].timeout),e.error?this.queue[e.id].promise[1](e.error):this.queue[e.id].promise[0](e.result),delete this.queue[e.id]}),this.socket.addEventListener("error",e=>
296this.emit("error",e)),this.socket.addEventListener("close",({code:r,reason:n})=>{this.ready&&setTimeout(()=>this.emit("close",r,n),0),this.ready=!1,this.socket=void 0,1e3!==r&&(this.current_reconnects++,this.reconnect&&(this.max_reconnects>this.current_reconnects||0===this.max_reconnects)?this.reconnect_timer_id=setTimeout(()=>this._connect(e,t),this.reconnect_interval):this.reconnect&&this.max_reconnects>0&&this.current_reconnects>=this.max_reconnects&&setTimeout(()=>this.emit("max_reconnects_reached",r,n),1))})}}},13130:function(e,t,r){"use strict";function n(e){return(n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}r.d(t,{Z:function(){return c}});var i,s,o,a=/^\s+/,l=/\s+$/;function c(e,t){if(t=t||{},(e=e||"")instanceof c)return e;if(!(this instanceof c))return new c(e,t);var r,i,s,o,u,f,h,d,p,g,y,m,b,w,v,E,x,_,A,S,O=(i={r:0,g:0,b:0},s=1,o=null,u=null,f=null,h=!1,d=!1,"string"==typeof(r=e)&&(r=function(e){e=e.replace(a,"").replace(l,"").toLowerCase();var t,r=!1;if(I[e])e=I[e],r=!0;else if("transparent"==e)return{r:0,g:0,b:0,a:0,format:"name"};return(t=U.rgb.exec(e))?{r:t[1],g:t[2],b:t[3]}:(t=U.rgba.exec(e))?{r:t[1],g:t[2],b:t[3],a:t[4]}:(t=U.hsl.exec(e))?{h:t[1],s:t[2],l:t[3]}:(t=U.hsla.exec(e))?{h:t[1],s:t[2],l:t[3],a:t[4]}:(t=U.hsv.exec(e))?{h:t[1],s:t[2],v:t[3]}:(t=U.hsva.exec(e))?{h:t[1],s:t[2],v:t[3],a:t[4]}:(t=U.hex8.exec(e))?{r:T(t[1]),g:T(t[2]),b:T(t[3]),a:T(t[4])/255,format:r?"name":"hex8"}:(t=U.hex6.exec(e))?{r:T(t[1]),g:T(t[2]),b:T(t[3]),format:r?"name":"hex"}:(t=U.hex4.exec(e))?{r:T(t[1]+""+t[1]),g:T(t[2]+""+t[2]),b:T(t[3]+""+t[3]),a:T(t[4]+""+t[4])/255,format:r?"name":"hex8"}:!!(t=U.hex3.exec(e))&&{r:T(t[1]+""+t[1]),g:T(t[2]+""+t[2]),b:T(t[3]+""+t[3]),format:r?"name":"hex"}}(r)),"object"==n(r)&&(M(r.r)&&M(r.g)&&M(r.b)?(p=r.r,g=r.g,y=r.b,i={r:255*C(p,255),g:255*C(g,255),b:255*C(y,255)},h=!0,d="%"===String(r.r).substr(-1)?"prgb":"rgb"):M(r.h)&&M(r.s)&&M(r.v)?(o=R(r.s),u=R(r.v),m=r.h,b=o,w=u,m=6*C(m,360),b=C(b,100),w=C(w,100),v=Math.floor(m),E=m-v,x=w*(1-b),_=w*(1-E*b),A=w*(1-(1-E)*b),i={r:255*[w,_,x,x,A,w][S=v%6],g:255*[A,w,w,_,x,x][S],b:255*[x,x,A,w,w,_][S]},h=!0,d="hsv"):M(r.h)&&M(r.s)&&M(r.l)&&(o=R(r.s),f=R(r.l),i=function(e,t,r){var n,i,s;function o(e,t,r){return(r<0&&(r+=1),r>1&&(r-=1),r<1/6)?e+(t-e)*6*r:r<.5?t:r<2/3?e+(t-e)*(2/3-r)*6:e}if(e=C(e,360),t=C(t,100),r=C(r,100),0===t)n=i=s=r;else{var a=r<.5?r*(1+t):r+t-r*t,l=2*r-a;n=o(l,a,e+1/3),i=o(l,a,e),s=o(l,a,e-1/3)}return{r:255*n,g:255*i,b:255*s}}(r.h,o,f),h=!0,d="hsl"),r.hasOwnProperty("a")&&(s=r.a)),s=P(s),{ok:h,format:r.format||d,r:Math.min(255,Math.max(i.r,0)),g:Math.min(255,Math.max(i.g,0)),b:Math.min(255,Math.max(i.b,0)),a:s});this._originalInput=e,this._r=O.r,this._g=O.g,this._b=O.b,this._a=O.a,this._roundA=Math.round(100*this._a)/100,this._format=t.format||O.format,this._gradientType=t.gradientType,this._r<1&&(this._r=Math.round(this._r)),this._g<1&&(this._g=Math.round(this._g)),this._b<1&&(this._b=Math.round(this._b)),this._ok=O.ok}function u(e,t,r){var n,i,s=Math.max(e=C(e,255),t=C(t,255),r=C(r,255)),o=Math.min(e,t,r),a=(s+o)/2;if(s==o)n=i=0;else{var l=s-o;switch(i=a>.5?l/(2-s-o):l/(s+o),s){case e:n=(t-r)/l+(t<r?6:0);break;case t:n=(r-e)/l+2;break;case r:n=(e-t)/l+4}n/=6}return{h:n,s:i,l:a}}function f(e,t,r){var n,i,s=Math.max(e=C(e,255),t=C(t,255),r=C(r,255)),o=Math.min(e,t,r),a=s-o;if(i=0===s?0:a/s,s==o)n=0;else{switch(s){case e:n=(t-r)/a+(t<r?6:0);break;case t:n=(r-e)/a+2;break;case r:n=(e-t)/a+4}n/=6}return{h:n,s:i,v:s}}function h(e,t,r,n){var i=[B(Math.round(e).toString(16)),B(Math.round(t).toString(16)),B(Math.round(r).toString(16))];return n&&i[0].charAt(0)==i[0].charAt(1)&&i[1].charAt(0)==i[1].charAt(1)&&i[2].charAt(0)==i[2].charAt(1)?i[0].charAt(0)+i[1].charAt(0)+i[2].charAt(0):i.join("")}function d(e,t,r,n){return[B(D(n)),B(Math.round(e).toString(16)),B(Math.round(t).toString(16)),B(Math.round(r).toString(16))].join("")}function p(e,t){t=0===t?0:t||10;var r=c(e).toHsl();return r.s-=t/100,r.s=k(r.s),c(r)}function g(e,t){t=0===t?0:t||10;var r=c(e).toHsl();return r.s+=t/100,r.s=k(r.s),c(r)}function y(e){return c(e).desaturate(100)}function m(e,t){t=0===t?0:t||10;var r=c(e).toHsl();return r.l+=t/100,r.l=k(r.l),c(r)}function b(e,t){t=0===t?0:t||10;var r=c(e).toRgb();return r.r=Math.max(0,Math.min(255,r.r-Math.round(-(t/100*255)))),r.g=Math.max(0,Math.min(255,r.g-Math.round(-(t/100*255)))),r.b=Math.max(0,Math.min(255,r.b-Math.round(-(t/100*255)))),c(r)}
vendor: 5,820 bytes, line 296
296function w(e,t){t=0===t?0:t||10;var r=c(e).toHsl();return r.l-=t/100,r.l=k(r.l),c(r)}function v(e,t){var r=c(e).toHsl(),n=(r.h+t)%360;return r.h=n<0?360+n:n,c(r)}function E(e){var t=c(e).toHsl();return t.h=(t.h+180)%360,c(t)}function x(e,t){if(isNaN(t)||t<=0)throw Error("Argument to polyad must be a positive number");for(var r=c(e).toHsl(),n=[c(e)],i=360/t,s=1;s<t;s++)n.push(c({h:(r.h+s*i)%360,s:r.s,l:r.l}));return n}function _(e){var t=c(e).toHsl(),r=t.h;return[c(e),c({h:(r+72)%360,s:t.s,l:t.l}),c({h:(r+216)%360,s:t.s,l:t.l})]}function A(e,t,r){t=t||6,r=r||30;var n=c(e).toHsl(),i=360/r,s=[c(e)];for(n.h=(n.h-(i*t>>1)+720)%360;--t;)n.h=(n.h+i)%360,s.push(c(n));return s}function S(e,t){t=t||6;for(var r=c(e).toHsv(),n=r.h,i=r.s,s=r.v,o=[],a=1/t;t--;)o.push(c({h:n,s:i,v:s})),s=(s+a)%1;return o}c.prototype={isDark:function(){return 128>this.getBrightness()},isLight:function(){return!this.isDark()},isValid:function(){return this._ok},getOriginalInput:function(){return this._originalInput},getFormat:function(){return this._format},getAlpha:function(){return this._a},getBrightness:function(){var e=this.toRgb();return(299*e.r+587*e.g+114*e.b)/1e3},getLuminance:function(){var e,t,r,n=this.toRgb();return e=n.r/255,.2126*(e<=.03928?e/12.92:Math.pow((e+.055)/1.055,2.4))+.7152*((t=n.g/255)<=.03928?t/12.92:Math.pow((t+.055)/1.055,2.4))+.0722*((r=n.b/255)<=.03928?r/12.92:Math.pow((r+.055)/1.055,2.4))},setAlpha:function(e){return this._a=P(e),this._roundA=Math.round(100*this._a)/100,this},toHsv:function(){var e=f(this._r,this._g,this._b);return{h:360*e.h,s:e.s,v:e.v,a:this._a}},toHsvString:function(){var e=f(this._r,this._g,this._b),t=Math.round(360*e.h),r=Math.round(100*e.s),n=Math.round(100*e.v);return 1==this._a?"hsv("+t+", "+r+"%, "+n+"%)":"hsva("+t+", "+r+"%, "+n+"%, "+this._roundA+")"},toHsl:function(){var e=u(this._r,this._g,this._b);return{h:360*e.h,s:e.s,l:e.l,a:this._a}},toHslString:function(){var e=u(this._r,this._g,this._b),t=Math.round(360*e.h),r=Math.round(100*e.s),n=Math.round(100*e.l);return 1==this._a?"hsl("+t+", "+r+"%, "+n+"%)":"hsla("+t+", "+r+"%, "+n+"%, "+this._roundA+")"},toHex:function(e){return h(this._r,this._g,this._b,e)},toHexString:function(e){return"#"+this.toHex(e)},toHex8:function(e){var t,r,n,i,s;return t=this._r,r=this._g,n=this._b,i=this._a,s=[B(Math.round(t).toString(16)),B(Math.round(r).toString(16)),B(Math.round(n).toString(16)),B(D(i))],e&&s[0].charAt(0)==s[0].charAt(1)&&s[1].charAt(0)==s[1].charAt(1)&&s[2].charAt(0)==s[2].charAt(1)&&s[3].charAt(0)==s[3].charAt(1)?s[0].charAt(0)+s[1].charAt(0)+s[2].charAt(0)+s[3].charAt(0):s.join("")},toHex8String:function(e){return"#"+this.toHex8(e)},toRgb:function(){return{r:Math.round(this._r),g:Math.round(this._g),b:Math.round(this._b),a:this._a}},toRgbString:function(){return 1==this._a?"rgb("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+")":"rgba("+Math.round(this._r)+", "+Math.round(this._g)+", "+Math.round(this._b)+", "+this._roundA+")"},toPercentageRgb:function(){return{r:Math.round(100*C(this._r,255))+"%",g:Math.round(100*C(this._g,255))+"%",b:Math.round(100*C(this._b,255))+"%",a:this._a}},toPercentageRgbString:function(){return 1==this._a?"rgb("+Math.round(100*C(this._r,255))+"%, "+Math.round(100*C(this._g,255))+"%, "+Math.round(100*C(this._b,255))+"%)":"rgba("+Math.round(100*C(this._r,255))+"%, "+Math.round(100*C(this._g,255))+"%, "+Math.round(100*C(this._b,255))+"%, "+this._roundA+")"},toName:function(){return 0===this._a?"transparent":!(this._a<1)&&(O[h(this._r,this._g,this._b,!0)]||!1)},toFilter:function(e){var t="#"+d(this._r,this._g,this._b,this._a),r=t,n=this._gradientType?"GradientType = 1, ":"";if(e){var i=c(e);r="#"+d(i._r,i._g,i._b,i._a)}return"progid:DXImageTransform.Microsoft.gradient("+n+"startColorstr="+t+",endColorstr="+r+")"},toString:function(e){var t=!!e;e=e||this._format;var r=!1,n=this._a<1&&this._a>=0;return!t&&n&&("hex"===e||"hex6"===e||"hex3"===e||"hex4"===e||"hex8"===e||"name"===e)?"name"===e&&0===this._a?this.toName():this.toRgbString():("rgb"===e&&(r=this.toRgbString()),"prgb"===e&&(r=this.toPercentageRgbString()),("hex"===e||"hex6"===e)&&(r=this.toHexString()),"hex3"===e&&(r=this.toHexString(!0)),"hex4"===e&&(r=this.toHex8String(!0)),"hex8"===e&&(r=this.toHex8String()),"name"===e&&(r=this.toName()),"hsl"===e&&(r=this.toHslString()),"hsv"===e&&(r=this.toHsvString()),r||this.toHexString())},clone:function(){return c(this.toString())},_applyModification:function(e,t){var r=e.apply(null,[this].concat([].slice.call(t)));return this._r=r._r,this._g=r._g,this._b=r._b,this.setAlpha(r._a),this},lighten:function(){return this._applyModification(m,arguments)},brighten:function(){return this._applyModification(b,arguments)},darken:function(){return this._applyModification(w,arguments)},desaturate:function(){return this._applyModification(p,arguments)},saturate:function(){return this._applyModification(g,arguments)},greyscale:function(){return this._applyModification(y,arguments)},spin:function(){return this._applyModification(v,arguments)},_applyCombination:function(e,t){return e.apply(null,[this].concat([].slice.call(t)))},analogous:function(){return this._applyCombination(A,arguments)},complement:function(){return this._applyCombination(E,arguments)},monochromatic:function(){return this._applyCombination(S,arguments)},splitcomplement:function(){return this._applyCombination(_,arguments)},triad:function(){return this._applyCombination(x,[3])},tetrad:function(){return this._applyCombination(x,[4])}},c.fromRatio=function(e,t){if("object"==n(e)){var r={};for(var i in e)e.hasOwnProperty(i)&&("a"===i?r[i]=e[i]:r[i]=R(e[i]));e=r}return c(e,t)},c.equals=function(e,t){return!!e&&!!t&&c(e).toRgbString()==c(t).toRgbString()},c.random=function(){return c.fromRatio({r:Math.random(),g:Math.random(),b:Math.random()})}
vendor: 2,392 bytes, line 296
296,c.mix=function(e,t,r){r=0===r?0:r||50;var n=c(e).toRgb(),i=c(t).toRgb(),s=r/100;return c({r:(i.r-n.r)*s+n.r,g:(i.g-n.g)*s+n.g,b:(i.b-n.b)*s+n.b,a:(i.a-n.a)*s+n.a})},c.readability=function(e,t){var r=c(e),n=c(t);return(Math.max(r.getLuminance(),n.getLuminance())+.05)/(Math.min(r.getLuminance(),n.getLuminance())+.05)},c.isReadable=function(e,t,r){var n,i,s,o,a,l=c.readability(e,t);switch(a=!1,(i=((n=(n=r)||{level:"AA",size:"small"}).level||"AA").toUpperCase(),s=(n.size||"small").toLowerCase(),"AA"!==i&&"AAA"!==i&&(i="AA"),"small"!==s&&"large"!==s&&(s="small"),o={level:i,size:s}).level+o.size){case"AAsmall":case"AAAlarge":a=l>=4.5;break;case"AAlarge":a=l>=3;break;case"AAAsmall":a=l>=7}return a},c.mostReadable=function(e,t,r){var n,i,s,o,a=null,l=0;i=(r=r||{}).includeFallbackColors,s=r.level,o=r.size;for(var u=0;u<t.length;u++)(n=c.readability(e,t[u]))>l&&(l=n,a=c(t[u]));return c.isReadable(e,a,{level:s,size:o})||!i?a:(r.includeFallbackColors=!1,c.mostReadable(e,["#fff","#000"],r))};var I=c.names={aliceblue:"f0f8ff",antiquewhite:"faebd7",aqua:"0ff",aquamarine:"7fffd4",azure:"f0ffff",beige:"f5f5dc",bisque:"ffe4c4",black:"000",blanchedalmond:"ffebcd",blue:"00f",blueviolet:"8a2be2",brown:"a52a2a",burlywood:"deb887",burntsienna:"ea7e5d",cadetblue:"5f9ea0",chartreuse:"7fff00",chocolate:"d2691e",coral:"ff7f50",cornflowerblue:"6495ed",cornsilk:"fff8dc",crimson:"dc143c",cyan:"0ff",darkblue:"00008b",darkcyan:"008b8b",darkgoldenrod:"b8860b",darkgray:"a9a9a9",darkgreen:"006400",darkgrey:"a9a9a9",darkkhaki:"bdb76b",darkmagenta:"8b008b",darkolivegreen:"556b2f",darkorange:"ff8c00",darkorchid:"9932cc",darkred:"8b0000",darksalmon:"e9967a",darkseagreen:"8fbc8f",darkslateblue:"483d8b",darkslategray:"2f4f4f",darkslategrey:"2f4f4f",darkturquoise:"00ced1",darkviolet:"9400d3",deeppink:"ff1493",deepskyblue:"00bfff",dimgray:"696969",dimgrey:"696969",dodgerblue:"1e90ff",firebrick:"b22222",floralwhite:"fffaf0",forestgreen:"228b22",fuchsia:"f0f",gainsboro:"dcdcdc",ghostwhite:"f8f8ff",gold:"ffd700",goldenrod:"daa520",gray:"808080",green:"008000",greenyellow:"adff2f",grey:"808080",honeydew:"f0fff0",hotpink:"ff69b4",indianred:"cd5c5c",indigo:"4b0082",ivory:"fffff0",khaki:"f0e68c",lavender:"e6e6fa",lavenderblush:"fff0f5",lawngreen:"7cfc00",lemonchiffon:"fffacd",lightblue:"add8e6",lightcoral:"f08080",lightcyan:"e0ffff",lightgoldenrodyellow:"fafad2",lightgray:"d3d3d3",lightgreen:"90ee9
2960",lightgrey:"d3d3d3",lightpink:"ffb6c1",lightsalmon:"ffa07a",lightseagreen:"20b2aa",lightskyblue:"87cefa",lightslategray:"789",lightslategrey:"789",lightsteelblue:"b0c4de",lightyellow:"ffffe0",lime:"0f0",limegreen:"32cd32",linen:"faf0e6",magenta:"f0f",maroon:"800000",mediumaquamarine:"66cdaa",mediumblue:"0000cd",mediumorchid:"ba55d3",mediumpurple:"9370db",mediumseagreen:"3cb371",mediumslateblue:"7b68ee",mediumspringgreen:"00fa9a",mediumturquoise:"48d1cc",mediumvioletred:"c71585",midnightblue:"191970",mintcream:"f5fffa",mistyrose:"ffe4e1",moccasin:"ffe4b5",navajowhite:"ffdead",navy:"000080",oldlace:"fdf5e6",olive:"808000",olivedrab:"6b8e23",orange:"ffa500",orangered:"ff4500",orchid:"da70d6",palegoldenrod:"eee8aa",palegreen:"98fb98",paleturquoise:"afeeee",palevioletred:"db7093",papayawhip:"ffefd5",peachpuff:"ffdab9",peru:"cd853f",pink:"ffc0cb",plum:"dda0dd",powderblue:"b0e0e6",purple:"800080",rebeccapurple:"663399",red:"f00",rosybrown:"bc8f8f",royalblue:"4169e1",saddlebrown:"8b4513",salmon:"fa8072",sandybrown:"f4a460",seagreen:"2e8b57",seashell:"fff5ee",sienna:"a0522d",silver:"c0c0c0",skyblue:"87ceeb",slateblue:"6a5acd",slategray:"708090",slategrey:"708090",snow:"fffafa",springgreen:"00ff7f",steelblue:"4682b4",tan:"d2b48c",teal:"008080",thistle:"d8bfd8",tomato:"ff6347",turquoise:"40e0d0",violet:"ee82ee",wheat:"f5deb3",white:"fff",whitesmoke:"f5f5f5",yellow:"ff0",yellowgreen:"9acd32"},O=c.hexNames=function(e){var t={};for(var r in e)e.hasOwnProperty(r)&&(t[e[r]]=r);return t}(I);function P(e){return(isNaN(e=parseFloat(e))||e<0||e>1)&&(e=1),e}function C(e,t){"string"==typeof(r=e)&&-1!=r.indexOf(".")&&1===parseFloat(r)&&(e="100%");var r,n,i="string"==typeof(n=e)&&-1!=n.indexOf("%");return(e=Math.min(t,Math.max(0,parseFloat(e))),i&&(e=parseInt(e*t,10)/100),1e-6>Math.abs(e-t))?1:e%t/parseFloat(t)}function k(e){return Math.min(1,Math.max(0,e))}function T(e){return parseInt(e,16)}function B(e){return 1==e.length?"0"+e:""+e}function R(e){return e<=1&&(e=100*e+"%"),e}function D(e){return Math.round(255*parseFloat(e)).toString(16)}var U=(s="[\\s|\\(]+("+(i="(?:[-\\+]?\\d*\\.\\d+%?)|(?:[-\\+]?\\d+%?)")+")[,|\\s]+("+i+")[,|\\s]+("+i+")\\s*\\)?",o="[\\s|\\(]+("+i+")[,|\\s]+("+i+")[,|\\s]+("+i+")[,|\\s]+("+i+")\\s*\\)?",{CSS_UNIT:new RegExp(i),rgb:RegExp("rgb"+s),rgba:RegExp("rgba"+o),hsl:RegExp("hsl"+s),hsla:RegExp("hsla"+o),hsv:RegExp("hsv"+s),hsva:RegExp("hsva"
296+o),hex3:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex6:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,hex4:/^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,hex8:/^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/});function M(e){return!!U.CSS_UNIT.exec(e)}},39099:function(e,t,r){"use strict";r.d(t,{Ue:function(){return h}});let n=e=>{let t;let r=new Set,n=(e,n)=>{let i="function"==typeof e?e(t):e;if(!Object.is(i,t)){let e=t;t=(null!=n?n:"object"!=typeof i||null===i)?i:Object.assign({},t,i),r.forEach(r=>r(t,e))}},i=()=>t,s={setState:n,getState:i,getInitialState:()=>o,subscribe:e=>(r.add(e),()=>r.delete(e)),destroy:()=>{console.warn("[DEPRECATED] The `destroy` method will be unsupported in a future version. Instead use unsubscribe function returned by subscribe. Everything will be garbage-collected if store is garbage-collected."),r.clear()}},o=t=e(n,i,s);return s},i=e=>e?n(e):n;var s=r(2265),o=r(35006);let{useDebugValue:a}=s,{useSyncExternalStoreWithSelector:l}=o,c=!1,u=e=>e,f=e=>{"function"!=typeof e&&console.warn("[DEPRECATED] Passing a vanilla store will be unsupported in a future version. Instead use `import { useStore } from 'zustand'`.");let t="function"==typeof e?i(e):e,r=(e,r)=>(function(e,t=u,r){r&&!c&&(console.warn("[DEPRECATED] Use `createWithEqualityFn` instead of `create` or use `useStoreWithEqualityFn` instead of `useStore`. They can be imported from 'zustand/traditional'. https://github.com/pmndrs/zustand/discussions/1937"),c=!0);let n=l(e.subscribe,e.getState,e.getServerState||e.getInitialState,t,r);return a(n),n})(t,e,r);return Object.assign(r,t),r},h=e=>e?f(e):f}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.