PageSourceSearch

https://itrix.ai/_next/static/chunks/6847-ab279e405ef1b611.js

js itrix.ai collected 2026-10-05 12:05:03 UTC 1,032,770 bytes, 909 lines download raw bytes

1(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6847],{98578:function(e,t,r){"use strict";var i=r(2265);let n=i.forwardRef(function(e,t){let{title:r,titleId:n,...s}=e;return i.createElement("svg",Object.assign({xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 20 20",fill:"currentColor","aria-hidden":"true","data-slot":"icon",ref:t,"aria-labelledby":n},s),r?i.createElement("title",{id:n},r):null,i.createElement("path",{fillRule:"evenodd",d:"M5.22 8.22a.75.75 0 0 1 1.06 0L10 11.94l3.72-3.72a.75.75 0 1 1 1.06 1.06l-4.25 4.25a.75.75 0 0 1-1.06 0L5.22 9.28a.75.75 0 0 1 0-1.06Z",clipRule:"evenodd"}))});t.Z=n},35549:function(e,t,r){"use strict";r.d(t,{fl:function(){return S},iv:function(){return l},Ts:function(){return C},Qu:function(){return A},$m:function(){return c}});let i=globalThis,n=i.ShadowRoot&&(void 0===i.ShadyCSS||i.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,s=Symbol(),o=new WeakMap;class a{constructor(e,t,r){if(this._$cssResult$=!0,r!==s)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=e,this.t=t}get styleSheet(){let e=this.o,t=this.t;if(n&&void 0===e){let r=void 0!==t&&1===t.length;r&&(e=o.get(t)),void 0===e&&((this.o=e=new CSSStyleSheet).replaceSync(this.cssText),r&&o.set(t,e))}return e}toString(){return this.cssText}}let c=e=>new a("string"==typeof e?e:e+"",void 0,s),l=(e,...t)=>new a(1===e.length?e[0]:t.reduce((t,r,i)=>t+(e=>{if(!0===e._$cssResult$)return e.cssText;if("number"==typeof e)return e;throw Error("Value passed to 'css' function must be a 'css' function result: "+e+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(r)+e[i+1],e[0]),e,s),u=(e,t)=>{if(n)e.adoptedStyleSheets=t.map(e=>e instanceof CSSStyleSheet?e:e.styleSheet);else for(let r of t){let t=document.createElement("style"),n=i.litNonce;void 0!==n&&t.setAttribute("nonce",n),t.textContent=r.cssText,e.appendChild(t)}},h=n?e=>e:e=>e instanceof CSSStyleSheet?(e=>{let t="";for(let r of e.cssRules)t+=r.cssText;return c(t)})(e):e,{is:d,defineProperty:p,getOwnPropertyDescriptor:f,getOwnPropertyNames:g,getOwnPropertySymbols:m,getPrototypeOf:y}=Object,w=globalThis,b=w.trustedTypes,v=b?b.emptyScript:"",E=w.reactiveElementPolyfillSupport,_=(e,t)=>e,C={toAttribute(e,t){switch(t){case Boolean:e=e?v:null;break;case Object:case Array:e=null==e?e:JSON.stringify(e)}return e},fromAttribute(e,t){let r=e;switch(t){case Boolean:r=null!==e;break;case Number:r=null===e?null:Number(e);break;case Object:case Array:try{r=JSON.parse(e)}catch(e){r=null}}return r}},A=(e,t)=>!d(e,t),I={attribute:!0,type:String,converter:C,reflect:!1,useDefault:!1,hasChanged:A};Symbol.metadata??=Symbol("metadata"),w.litPropertyMetadata??=new WeakMap;class S extends HTMLElement{static addInitializer(e){this._$Ei(),(this.l??=[]).push(e)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(e,t=I){if(t.state&&(t.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(e)&&((t=Object.create(t)).wrapped=!0),this.elementProperties.set(e,t),!t.noAccessor){let r=Symbol(),i=this.getPropertyDescriptor(e,r,t);void 0!==i&&p(this.prototype,e,i)}}static getPropertyDescriptor(e,t,r){let{get:i,set:n}=f(this.prototype,e)??{get(){return this[t]},set(e){this[t]=e}};return{get:i,set(t){let s=i?.call(this);n?.call(this,t),this.requestUpdate(e,s,r)},configurable:!0,enumerable:!0}}static getPropertyOptions(e){return this.elementProperties.get(e)??I}static _$Ei(){if(this.hasOwnProperty(_("elementProperties")))return;let e=y(this);e.finalize(),void 0!==e.l&&(this.l=[...e.l]),this.elementProperties=new Map(e.elementProperties)}static finalize(){if(this.hasOwnProperty(_("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(_("properties"))){let e=this.properties;for(let t of[...g(e),...m(e)])this.createProperty(t,e[t])}let e=this[Symbol.metadata];if(null!==e){let t=litPropertyMetadata.get(e);if(void 0!==t)for(let[e,r]of t)this.elementProperties.set(e,r)}for(let[e,t]of(this._$Eh=new Map,this.elementProperties)){let r=this._$Eu(e,t);void 0!==r&&this._$Eh.set(r,e)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(e){let t=[];if(Array.isArray(e))for(let r of new Set(e.flat(1/0).reverse()))t.unshift(h(r));else void 0!==e&&t.push(h(e));return t}static _$Eu(e,t){let r=t.attribute;return!1===r?void 0:"string"==typeof r?r:"string"==typeof e?e.toLowerCase():void 0}constructor(){super(),this._$Ep=void 0,this.isUpdatePending=!1,this.hasUpdated=!1,this._$Em=null,this._$Ev()}_$Ev(){this._$ES=new Promise(e=>this.enableUpdating=e),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(e
1=>e(this))}addController(e){(this._$EO??=new Set).add(e),void 0!==this.renderRoot&&this.isConnected&&e.hostConnected?.()}removeController(e){this._$EO?.delete(e)}_$E_(){let e=new Map;for(let t of this.constructor.elementProperties.keys())this.hasOwnProperty(t)&&(e.set(t,this[t]),delete this[t]);e.size>0&&(this._$Ep=e)}createRenderRoot(){let e=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return u(e,this.constructor.elementStyles),e}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(e=>e.hostConnected?.())}enableUpdating(e){}disconnectedCallback(){this._$EO?.forEach(e=>e.hostDisconnected?.())}attributeChangedCallback(e,t,r){this._$AK(e,r)}_$ET(e,t){let r=this.constructor.elementProperties.get(e),i=this.constructor._$Eu(e,r);if(void 0!==i&&!0===r.reflect){let n=(void 0!==r.converter?.toAttribute?r.converter:C).toAttribute(t,r.type);this._$Em=e,null==n?this.removeAttribute(i):this.setAttribute(i,n),this._$Em=null}}_$AK(e,t){let r=this.constructor,i=r._$Eh.get(e);if(void 0!==i&&this._$Em!==i){let e=r.getPropertyOptions(i),n="function"==typeof e.converter?{fromAttribute:e.converter}:void 0!==e.converter?.fromAttribute?e.converter:C;this._$Em=i,this[i]=n.fromAttribute(t,e.type)??this._$Ej?.get(i)??null,this._$Em=null}}requestUpdate(e,t,r){if(void 0!==e){let i=this.constructor,n=this[e];if(!(((r??=i.getPropertyOptions(e)).hasChanged??A)(n,t)||r.useDefault&&r.reflect&&n===this._$Ej?.get(e)&&!this.hasAttribute(i._$Eu(e,r))))return;this.C(e,t,r)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(e,t,{useDefault:r,reflect:i,wrapped:n},s){r&&!(this._$Ej??=new Map).has(e)&&(this._$Ej.set(e,s??t??this[e]),!0!==n||void 0!==s)||(this._$AL.has(e)||(this.hasUpdated||r||(t=void 0),this._$AL.set(e,t)),!0===i&&this._$Em!==e&&(this._$Eq??=new Set).add(e))}async _$EP(){this.isUpdatePending=!0;try{await this._$ES}catch(e){Promise.reject(e)}let e=this.scheduleUpdate();return null!=e&&await e,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(let[e,t]of this._$Ep)this[e]=t;this._$Ep=void 0}let e=this.constructor.elementProperties;if(e.size>0)for(let[t,r]of e){let{wrapped:e}=r,i=this[t];!0!==e||this._$AL.has(t)||void 0===i||this.C(t,void 0,r,i)}}let e=!1,t=this._$AL;try{(e=this.shouldUpdate(t))?(this.willUpdate(t),this._$EO?.forEach(e=>e.hostUpdate?.()),this.update(t)):this._$EM()}catch(t){throw e=!1,this._$EM(),t}e&&this._$AE(t)}willUpdate(e){}_$AE(e){this._$EO?.forEach(e=>e.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(e)),this.updated(e)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(e){return!0}update(e){this._$Eq&&=this._$Eq.forEach(e=>this._$ET(e,this[e])),this._$EM()}updated(e){}firstUpdated(e){}}S.elementStyles=[],S.shadowRootOptions={mode:"open"},S[_("elementProperties")]=new Map,S[_("finalized")]=new Map,E?.({ReactiveElement:S}),(w.reactiveElementVersions??=[]).push("2.1.0")},45645:function(e,t,r){"use strict";r.d(t,{D1:function(){return f},Kd:function(){return g},Mx:function(){return p}});var i=r(60474),n=r(41423);let s=BigInt(0),o=BigInt(1);function a(e,t){let r=t.negate();return e?r:t}function c(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw Error("invalid window size, expected [1.."+t+"], got W="+e)}function l(e,t){return c(e,t),{windows:Math.ceil(t/e)+1,windowSize:2**(e-1)}}let u=new WeakMap,h=new WeakMap;function d(e){return h.get(e)||1}function p(e,t){return{constTimeNegate:a,hasPrecomputes:e=>1!==d(e),unsafeLadder(t,r,i=e.ZERO){let n=t;for(;r>s;)r&o&&(i=i.add(n)),n=n.double(),r>>=o;return i},precomputeWindow(e,r){let{windows:i,windowSize:n}=l(r,t),s=[],o=e,a=o;for(let e=0;e<i;e++){a=o,s.push(a);for(let e=1;e<n;e++)a=a.add(o),s.push(a);o=a.double()}return s},wNAF(r,i,n){let{windows:s,windowSize:c}=l(r,t),u=e.ZERO,h=e.BASE,d=BigInt(2**r-1),p=2**r,f=BigInt(r);for(let e=0;e<s;e++){let t=e*c,r=Number(n&d);n>>=f,r>c&&(r-=p,n+=o);let s=t+Math.abs(r)-1,l=e%2!=0,g=r<0;0===r?h=h.add(a(l,i[t])):u=u.add(a(g,i[s]))}return{p:u,f:h}},wNAFUnsafe(r,i,n,a=e.ZERO){let{windows:c,windowSize:u}=l(r,t),h=BigInt(2**r-1),d=2**r,p=BigInt(r);for(let e=0;e<c;e++){let t=e*u;if(n===s)break;let r=Number(n&h);if(n>>=p,r>u&&(r-=d,n+=o),0===r)continue;let c=i[t+Math.abs(r)-1];r<0&&(c=c.negate()),a=a.add(c)}return a},getPrecomputes(e,t,r){let i=u.get(t);
1return i||(i=this.precomputeWindow(t,e),1!==e&&u.set(t,r(i))),i},wNAFCached(e,t,r){let i=d(e);return this.wNAF(i,this.getPrecomputes(i,e,r),t)},wNAFCachedUnsafe(e,t,r,i){let n=d(e);return 1===n?this.unsafeLadder(e,t,i):this.wNAFUnsafe(n,this.getPrecomputes(n,e,r),t,i)},setWindowSize(e,r){c(r,t),h.set(e,r),u.delete(e)}}}function f(e,t,r,i){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)})}(i,t),r.length!==i.length)throw Error("arrays of points and scalars must have equal length");let s=e.ZERO,o=(0,n.Dd)(BigInt(r.length)),a=o>12?o-3:o>4?o-2:o?2:1,c=(1<<a)-1,l=Array(c+1).fill(s),u=Math.floor((t.BITS-1)/a)*a,h=s;for(let e=u;e>=0;e-=a){l.fill(s);for(let t=0;t<i.length;t++){let n=Number(i[t]>>BigInt(e)&BigInt(c));l[n]=l[n].add(r[t])}let t=s;for(let e=l.length-1,r=s;e>0;e--)r=r.add(l[e]),t=t.add(r);if(h=h.add(t),0!==e)for(let e=0;e<a;e++)h=h.double()}return h}function g(e){return(0,i.OP)(e.Fp),(0,n.FF)(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...(0,i.kK)(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}},60474:function(e,t,r){"use strict";r.d(t,{OP:function(){return m},PS:function(){return v},Tu:function(){return f},U_:function(){return p},Us:function(){return E},gN:function(){return w},kK:function(){return y},oA:function(){return d},wQ:function(){return h}});var i=r(41423);let n=BigInt(0),s=BigInt(1),o=BigInt(2),a=BigInt(3),c=BigInt(4),l=BigInt(5),u=BigInt(8);function h(e,t){let r=e%t;return r>=n?r:t+r}function d(e,t,r){let i=e;for(;t-- >n;)i*=i,i%=r;return i}function p(e,t){if(e===n)throw Error("invert: expected non-zero number");if(t<=n)throw Error("invert: expected positive modulus, got "+t);let r=h(e,t),i=t,o=n,a=s,c=s,l=n;for(;r!==n;){let e=i/r,t=i%r,n=o-c*e,s=a-l*e;i=r,r=t,o=c,a=l,c=n,l=s}if(i!==s)throw Error("invert: does not exist");return h(o,t)}let f=(e,t)=>(h(e,t)&s)===s,g=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function m(e){let t=g.reduce((e,t)=>(e[t]="function",e),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"});return(0,i.FF)(e,t)}function y(e,t){let r=void 0!==t?t:e.toString(2).length;return{nBitLength:r,nByteLength:Math.ceil(r/8)}}function w(e,t,r=!1,d={}){let f;if(e<=n)throw Error("invalid field: expected ORDER > 0, got "+e);let{nBitLength:g,nByteLength:m}=y(e,t);if(m>2048)throw Error("invalid field: expected ORDER of <= 2048 bytes");let w=Object.freeze({ORDER:e,isLE:r,BITS:g,BYTES:m,MASK:(0,i.dQ)(g),ZERO:n,ONE:s,create:t=>h(t,e),isValid:t=>{if("bigint"!=typeof t)throw Error("invalid field element: expected bigint, got "+typeof t);return n<=t&&t<e},is0:e=>e===n,isOdd:e=>(e&s)===s,neg:t=>h(-t,e),eql:(e,t)=>e===t,sqr:t=>h(t*t,e),add:(t,r)=>h(t+r,e),sub:(t,r)=>h(t-r,e),mul:(t,r)=>h(t*r,e),pow:(e,t)=>(function(e,t,r){if(r<n)throw Error("invalid exponent, negatives unsupported");if(r===n)return e.ONE;if(r===s)return t;let i=e.ONE,o=t;for(;r>n;)r&s&&(i=e.mul(i,o)),o=e.sqr(o),r>>=s;return i})(w,e,t),div:(t,r)=>h(t*p(r,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>p(t,e),sqrt:d.sqrt||(t=>(f||(f=function(e){if(e%c===a){let t=(e+s)/c;return function(e,r){let i=e.pow(r,t);if(!e.eql(e.sqr(i),r))throw Error("Cannot find square root");return i}}if(e%u===l){let t=(e-l)/u;return function(e,r){let i=e.mul(r,o),n=e.pow(i,t),s=e.mul(r,n),a=e.mul(e.mul(s,o),n),c=e.mul(s,e.sub(a,e.ONE));if(!e.eql(e.sqr(c),r))throw Error("Cannot find square root");return c}}return function(e){let t,r,i;let a=(e-s)/o;for(t=e-s,r=0;t%o===n;t/=o,r++);for(i=o;i<e&&function(e,t,r){if(t<n)throw Error("invalid exponent, negatives unsupported");if(r<=n)throw Error("invalid modulus");if(r===s)return n;let i=s;for(;t>n;)t&s&&(i=i*e%r),e=e*e%r,t>>=s;return i}(i,a,e)!==e-s;i++)if(i>1e3)throw Error("Cannot find square root: likely non-prime P");if(1===r){let t=(e+s)/c;return function(e,r){let i=e.pow(r,t);if(!e.eql(e.sqr(i),r))throw Error("Cannot find square root");return i}}let l=(t+s)/o;return function(e,n){if(e.pow(n,a)===e.neg(e.ONE))throw Error("Cannot find square root");let o=r,c=e.pow(e.mul(e.ONE,i),t),u=e.pow(n,l),h=e.pow(n,t);for(;!e.eql(h,e.ONE);){if(e.eql(h,e.ZERO))return e.ZERO;let t=1;for(let r=e.sqr(h);t<o&&!e.eql(r,e.ONE);t++)r=e.sqr(r);let r=e.pow(c,s<<BigInt(o-t-1));c=e.sqr(r),u=e.mul(u,r),h=e.mul(h,c),o=t}return u}}(e)}(e)),f(w,t))),invertBatch:e=>(function(e,t){let r=Array(t.length),i=t.reduce((t,i,n)=>e.is0(i)?t:(r[n]=t,e.mul(t,i)),e.ONE),n=e.inv(i);return t.reduceRight((t,i,n)=>e.is0(i)?t:(r[n]=e.mul(t,r[n]),e.mul(t,i)),n),r})(w,e),cmov:(e,t,r)=>r?t:e,toBytes:e=>r?(0,i.S5)(e,m):(0,i.tL)(e,m),fromBytes:e=>{if(e.length!==m)throw Error("Field.fromBytes: expected "+m+" bytes, got "+e.length);return r?(0,i.ty)(e):(0,i.bytesToNumberBE)(e)}});return Object.freeze(w)}function b(e){if("bigint"!=typeof e)throw Error("field order must be bigint");return Math.ceil(e.toString(2).length/8)}function v(e){let t=b(e);return t+Math.ceil(t/2)}function E(e,t,r=!1){let n=e.length,o=b(t),a=v(t);if(n<16||n<a||n>1024)throw Error("expected "+a+"-1024 bytes of input, got "+n);let c=h(r?(0,i.ty)(e):(0,i.bytesToNumberBE)(e),t-s)+s;return r?(0,i.S5)(c,o):(0,i.tL)(c,o)}},41423:function(e,t,r){"use strict";r.d(t,{Dd:function(){return I},FF:function(){return R},Fy:function(){return A},H9:function(){return P},S5:function(){return b},Z2:function(){return C},_t:function(){return o},bytesToNumberBE:function(){return m},ci:function(){return u},dQ:function(){return S},eV:function(){return E},gk:function(){return a},hexToBytes:function(){return g},n$:function(){return x},ql:function(){return v},tL:function(){return w},ty:function(){return y},uw:function(){return c},uz:function(){return h}});let i=BigInt(0),n=BigInt(1),s=BigInt(2);function o(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function a(e){if(!o(e))throw Error("Uint8Array expected")}function c(e,t){if("boolean"!=typeof t)throw Error(e+" boolean expected, got "+t)}let l=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function u(e){a(e);let t="";for(let r=0;r<e.length;r++)t+=l[e[r]];return t}function h(e){let t=e.toString(16);return 1&t.length?"0"+t:t}function d(e){if("string"!=typeof e)throw Error("hex string expected, got "+typeof e);return""===e?i:BigInt("0x"+e)}let p={_0:48,_9:57,A:65,F:70,a:97,f:102};function f(e){return e>=p._0&&e<=p._9?e-p._0:e>=p.A&&e<=p.F?e-(p.A-10):e>=p.a&&e<=p.f?e-(p.a-10):void 0}function g(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 i=new Uint8Array(r);for(let t=0,n=0;t<r;t++,n+=2){let r=f(e.charCodeAt(n)),s=f(e.charCodeAt(n+1));if(void 0===r||void 0===s)throw Error('hex string expected, got non-hex character "'+(e[n]+e[n+1])+'" at index '+n);i[t]=16*r+s}return i}function m(e){return d(u(e))}function y(e){return a(e),d(u(Uint8Array.from(e).reverse()))}function w(e,t){return g(e.toString(16).padStart(2*t,"0"))}function b(e,t){return w(e,t).reverse()}function v(e,t,r){let i;if("string"==typeof t)try{i=g(t)}catch(t){throw Error(e+" must be hex string or Uint8Array, cause: "+t)}else if(o(t))i=Uint8Array.from(t);else throw Error(e+" must be hex string or Uint8Array");let n=i.length;if("number"==typeof r&&n!==r)throw Error(e+" of length "+r+" expected, got "+n);return i}function E(...e){let t=0;for(let r=0;r<e.length;r++){let i=e[r];a(i),t+=i.length}let r=new Uint8Array(t);for(let t=0,i=0;t<e.length;t++){let n=e[t];r.set(n,i),i+=n.length}return r}let _=e=>"bigint"==typeof e&&i<=e;function C(e,t,r){return _(e)&&_(t)&&_(r)&&t<=e&&e<r}
1function A(e,t,r,i){if(!C(t,r,i))throw Error("expected valid "+e+": "+r+" <= n < "+i+", got "+t)}function I(e){let t;for(t=0;e>i;e>>=n,t+=1);return t}let S=e=>(s<<BigInt(e-1))-n,N=e=>new Uint8Array(e),O=e=>Uint8Array.from(e);function x(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=N(e),n=N(e),s=0,o=()=>{i.fill(1),n.fill(0),s=0},a=(...e)=>r(n,i,...e),c=(e=N())=>{n=a(O([0]),e),i=a(),0!==e.length&&(n=a(O([1]),e),i=a())},l=()=>{if(s++>=1e3)throw Error("drbg: tried 1000 values");let e=0,r=[];for(;e<t;){let t=(i=a()).slice();r.push(t),e+=i.length}return E(...r)};return(e,t)=>{let r;for(o(),c(e);!(r=t(l()));)c();return o(),r}}let 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||o(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 R(e,t,r={}){let i=(t,r,i)=>{let n=T[r];if("function"!=typeof n)throw Error("invalid validator function");let s=e[t];if((!i||void 0!==s)&&!n(s,e))throw Error("param "+String(t)+" is invalid. Expected "+r+", got "+s)};for(let[e,r]of Object.entries(t))i(e,r,!1);for(let[e,t]of Object.entries(r))i(e,t,!0);return e}function P(e){let t=new WeakMap;return(r,...i)=>{let n=t.get(r);if(void 0!==n)return n;let s=e(r,...i);return t.set(r,s),s}}},99347:function(e,t,r){"use strict";r.d(t,{UN:function(){return x}});var i=r(86363),n=r(45860),s=r(88835);let[o,a]=n.ZP.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
15771202a","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))),c=new Uint32Array(80),l=new Uint32Array(80);class u extends i.VR{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:i,Ch:n,Cl:s,Dh:o,Dl:a,Eh:c,El:l,Fh:u,Fl:h,Gh:d,Gl:p,Hh:f,Hl:g}=this;return[e,t,r,i,n,s,o,a,c,l,u,h,d,p,f,g]}set(e,t,r,i,n,s,o,a,c,l,u,h,d,p,f,g){this.Ah=0|e,this.Al=0|t,this.Bh=0|r,this.Bl=0|i,this.Ch=0|n,this.Cl=0|s,this.Dh=0|o,this.Dl=0|a,this.Eh=0|c,this.El=0|l,this.Fh=0|u,this.Fl=0|h,this.Gh=0|d,this.Gl=0|p,this.Hh=0|f,this.Hl=0|g}process(e,t){for(let r=0;r<16;r++,t+=4)c[r]=e.getUint32(t),l[r]=e.getUint32(t+=4);for(let e=16;e<80;e++){let t=0|c[e-15],r=0|l[e-15],i=n.ZP.rotrSH(t,r,1)^n.ZP.rotrSH(t,r,8)^n.ZP.shrSH(t,r,7),s=n.ZP.rotrSL(t,r,1)^n.ZP.rotrSL(t,r,8)^n.ZP.shrSL(t,r,7),o=0|c[e-2],a=0|l[e-2],u=n.ZP.rotrSH(o,a,19)^n.ZP.rotrBH(o,a,61)^n.ZP.shrSH(o,a,6),h=n.ZP.rotrSL(o,a,19)^n.ZP.rotrBL(o,a,61)^n.ZP.shrSL(o,a,6),d=n.ZP.add4L(s,h,l[e-7],l[e-16]),p=n.ZP.add4H(d,i,u,c[e-7],c[e-16]);c[e]=0|p,l[e]=0|d}let{Ah:r,Al:i,Bh:s,Bl:u,Ch:h,Cl:d,Dh:p,Dl:f,Eh:g,El:m,Fh:y,Fl:w,Gh:b,Gl:v,Hh:E,Hl:_}=this;for(let e=0;e<80;e++){let t=n.ZP.rotrSH(g,m,14)^n.ZP.rotrSH(g,m,18)^n.ZP.rotrBH(g,m,41),C=n.ZP.rotrSL(g,m,14)^n.ZP.rotrSL(g,m,18)^n.ZP.rotrBL(g,m,41),A=g&y^~g&b,I=m&w^~m&v,S=n.ZP.add5L(_,C,I,a[e],l[e]),N=n.ZP.add5H(S,E,t,A,o[e],c[e]),O=0|S,x=n.ZP.rotrSH(r,i,28)^n.ZP.rotrBH(r,i,34)^n.ZP.rotrBH(r,i,39),T=n.ZP.rotrSL(r,i,28)^n.ZP.rotrBL(r,i,34)^n.ZP.rotrBL(r,i,39),R=r&s^r&h^s&h,P=i&u^i&d^u&d;E=0|b,_=0|v,b=0|y,v=0|w,y=0|g,w=0|m,({h:g,l:m}=n.ZP.add(0|p,0|f,0|N,0|O)),p=0|h,f=0|d,h=0|s,d=0|u,s=0|r,u=0|i;let k=n.ZP.add3L(O,T,P);r=n.ZP.add3H(k,N,x,R),i=0|k}({h:r,l:i}=n.ZP.add(0|this.Ah,0|this.Al,0|r,0|i)),({h:s,l:u}=n.ZP.add(0|this.Bh,0|this.Bl,0|s,0|u)),({h:h,l:d}=n.ZP.add(0|this.Ch,0|this.Cl,0|h,0|d)),({h:p,l:f}=n.ZP.add(0|this.Dh,0|this.Dl,0|p,0|f)),({h:g,l:m}=n.ZP.add(0|this.Eh,0|this.El,0|g,0|m)),({h:y,l:w}=n.ZP.add(0|this.Fh,0|this.Fl,0|y,0|w)),({h:b,l:v}=n.ZP.add(0|this.Gh,0|this.Gl,0|b,0|v)),({h:E,l:_}=n.ZP.add(0|this.Hh,0|this.Hl,0|E,0|_)),this.set(r,i,s,u,h,d,p,f,g,m,y,w,b,v,E,_)}roundClean(){c.fill(0),l.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 h=(0,s.hE)(()=>new u);var d=r(45645),p=r(60474),f=r(41423);let g=BigInt(0),m=BigInt(1),y=BigInt(2),w=BigInt(8),b={zip215:!0},v=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),E=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752"),_=BigInt(0),C=BigInt(1),A=BigInt(2);BigInt(3);let I=BigInt(5),S=BigInt(8);function N(e,t){let r=(0,p.wQ)(t*t*t,v),i=function(e){let t=BigInt(10),r=BigInt(20),i=BigInt(40),n=BigInt(80),s=e*e%v*e%v,o=(0,p.oA)(s,A,v)*s%v,a=(0,p.oA)(o,C,v)*e%v,c=(0,p.oA)(a,I,v)*a%v,l=(0,p.oA)(c,t,v)*c%v,u=(0,p.oA)(l,r,v)*l%v,h=(0,p.oA)(u,i,v)*u%v,d=(0,p.oA)(h,n,v)*h%v,f=(0,p.oA)(d,n,v)*h%v,g=(0,p.oA)(f,t,v)*c%v;return{pow_p_5_8:(0,p.oA)(g,A,v)*e%v,b2:s}}(e*(0,p.wQ)(r*r*t,v)).pow_p_5_8,n=(0,p.wQ)(e*r*i,v),s=(0,p.wQ)(t*n*n,v),o=n,a=(0,p.wQ)(n*E,v),c=s===e,l=s===(0,p.wQ)(-e,v),u=s===(0,p.wQ)(-e*E,v);return c&&(n=o),(l||u)&&(n=a),(0,p.Tu)(n,v)&&(n=(0,p.wQ)(-n,v)),{isValid:c||l,value:n}}let O=(0,p.gN)(v,void 0,!0),x=function(e){let t=function(e){let t=(0,d.Kd)(e);return f.FF(e,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}(e),{Fp:r,n:i,prehash:n,hash:s,randomBytes:o,nByteLength:a,h:c}=t,l=y<<BigInt(8*a)-m,u=r.create,h=(0,p.gN)(t.n,t.nBitLength),v=t.uvRatio||((e,t)=>{try{return{isValid:!0,value:r.sqrt(e*r.inv(t))}}catch(e){return{isValid:!1,value:g}}}),E=t.adjustScalarBytes||(e=>e),_=t.domain||((e,t,r)=>{if((0,f.uw)("phflag",r),t.length||r)throw Error("Contexts/pre-hash are not supported");return e});function C(e,t){f.Fy("coordinate "+e,t,g,l)}function A(e){if(!(e instanceof N))throw Error("ExtendedPoint expected")}let I=(0,f.H9)((e,t)=>{let{ex:i,ey:n,ez:s}=e,o=e.is0();null==t&&(t=o?w:r.inv(s));let a=u(i*t),c=u(n*t),l=u(s*t);if(o)return{x:g,y:m};
1if(l!==m)throw Error("invZ was invalid");return{x:a,y:c}}),S=(0,f.H9)(e=>{let{a:r,d:i}=t;if(e.is0())throw Error("bad point: ZERO");let{ex:n,ey:s,ez:o,et:a}=e,c=u(n*n),l=u(s*s),h=u(o*o),d=u(h*h),p=u(c*r);if(u(h*u(p+l))!==u(d+u(i*u(c*l))))throw Error("bad point: equation left != right (1)");if(u(n*s)!==u(o*a))throw Error("bad point: equation left != right (2)");return!0});class N{constructor(e,t,r,i){this.ex=e,this.ey=t,this.ez=r,this.et=i,C("x",e),C("y",t),C("z",r),C("t",i),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(e){if(e instanceof N)throw Error("extended point not allowed");let{x:t,y:r}=e||{};return C("x",t),C("y",r),new N(t,r,m,u(t*r))}static normalizeZ(e){let t=r.invertBatch(e.map(e=>e.ez));return e.map((e,r)=>e.toAffine(t[r])).map(N.fromAffine)}static msm(e,t){return(0,d.D1)(N,h,e,t)}_setWindowSize(e){T.setWindowSize(this,e)}assertValidity(){S(this)}equals(e){A(e);let{ex:t,ey:r,ez:i}=this,{ex:n,ey:s,ez:o}=e,a=u(t*o),c=u(n*i),l=u(r*o),h=u(s*i);return a===c&&l===h}is0(){return this.equals(N.ZERO)}negate(){return new N(u(-this.ex),this.ey,this.ez,u(-this.et))}double(){let{a:e}=t,{ex:r,ey:i,ez:n}=this,s=u(r*r),o=u(i*i),a=u(y*u(n*n)),c=u(e*s),l=r+i,h=u(u(l*l)-s-o),d=c+o,p=d-a,f=c-o,g=u(h*p),m=u(d*f),w=u(h*f);return new N(g,m,u(p*d),w)}add(e){A(e);let{a:r,d:i}=t,{ex:n,ey:s,ez:o,et:a}=this,{ex:c,ey:l,ez:h,et:d}=e;if(r===BigInt(-1)){let e=u((s-n)*(l+c)),t=u((s+n)*(l-c)),r=u(t-e);if(r===g)return this.double();let i=u(o*y*d),p=u(a*y*h),f=p+i,m=t+e,w=p-i,b=u(f*r),v=u(m*w),E=u(f*w);return new N(b,v,u(r*m),E)}let p=u(n*c),f=u(s*l),m=u(a*i*d),w=u(o*h),b=u((n+s)*(c+l)-p-f),v=w-m,E=w+m,_=u(f-r*p),C=u(b*v),I=u(E*_),S=u(b*_);return new N(C,I,u(v*E),S)}subtract(e){return this.add(e.negate())}wNAF(e){return T.wNAFCached(this,e,N.normalizeZ)}multiply(e){f.Fy("scalar",e,m,i);let{p:t,f:r}=this.wNAF(e);return N.normalizeZ([t,r])[0]}multiplyUnsafe(e,t=N.ZERO){return(f.Fy("scalar",e,g,i),e===g)?x:this.is0()||e===m?this:T.wNAFCachedUnsafe(this,e,N.normalizeZ,t)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}isTorsionFree(){return T.unsafeLadder(this,i).is0()}toAffine(e){return I(this,e)}clearCofactor(){let{h:e}=t;return e===m?this:this.multiplyUnsafe(e)}static fromHex(e,i=!1){let{d:n,a:s}=t,o=r.BYTES;e=(0,f.ql)("pointHex",e,o),(0,f.uw)("zip215",i);let a=e.slice(),c=e[o-1];a[o-1]=-129&c;let h=f.ty(a),d=i?l:r.ORDER;f.Fy("pointHex.y",h,g,d);let p=u(h*h),{isValid:y,value:w}=v(u(p-m),u(n*p-s));if(!y)throw Error("Point.fromHex: invalid y coordinate");let b=(w&m)===m,E=(128&c)!=0;if(!i&&w===g&&E)throw Error("Point.fromHex: x=0 and x_0=1");return E!==b&&(w=u(-w)),N.fromAffine({x:w,y:h})}static fromPrivateKey(e){return P(e).point}toRawBytes(){let{x:e,y:t}=this.toAffine(),i=f.S5(t,r.BYTES);return i[i.length-1]|=e&m?128:0,i}toHex(){return f.ci(this.toRawBytes())}}N.BASE=new N(t.Gx,t.Gy,m,u(t.Gx*t.Gy)),N.ZERO=new N(g,m,m,g);let{BASE:O,ZERO:x}=N,T=(0,d.Mx)(N,8*a);function R(e){var t;return t=f.ty(e),(0,p.wQ)(t,i)}function P(e){let t=r.BYTES;e=(0,f.ql)("private key",e,t);let i=(0,f.ql)("hashed private key",s(e),2*t),n=E(i.slice(0,t)),o=i.slice(t,2*t),a=R(n),c=O.multiply(a),l=c.toRawBytes();return{head:n,prefix:o,scalar:a,point:c,pointBytes:l}}function k(e=new Uint8Array,...t){return R(s(_(f.eV(...t),(0,f.ql)("context",e),!!n)))}return O._setWindowSize(8),{CURVE:t,getPublicKey:function(e){return P(e).pointBytes},sign:function(e,t,s={}){var o;e=(0,f.ql)("message",e),n&&(e=n(e));let{prefix:a,scalar:c,pointBytes:l}=P(t),u=k(s.context,a,e),h=O.multiply(u).toRawBytes(),d=(o=u+k(s.context,h,l,e)*c,(0,p.wQ)(o,i));f.Fy("signature.s",d,g,i);let m=f.eV(h,f.S5(d,r.BYTES));return(0,f.ql)("result",m,2*r.BYTES)},verify:function(e,t,i,s=b){let o,a,c;let{context:l,zip215:u}=s,h=r.BYTES;e=(0,f.ql)("signature",e,2*h),t=(0,f.ql)("message",t),i=(0,f.ql)("publicKey",i,h),void 0!==u&&(0,f.uw)("zip215",u),n&&(t=n(t));let d=f.ty(e.slice(h,2*h));try{o=N.fromHex(i,u),a=N.fromHex(e.slice(0,h),u),c=O.multiplyUnsafe(d)}catch(e){return!1}if(!u&&o.isSmallOrder())return!1;let p=k(l,a.toRawBytes(),o.toRawBytes(),t);return a.add(o.multiplyUnsafe(p)).subtract(c).clearCofactor().equals(N.ZERO)},ExtendedPoint:N,utils:{getExtendedPublicKey:P,randomPrivateKey:()=>o(r.BYTES),precompute:(e=8,t=N.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)}}}({a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:O,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:S,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:h,randomBytes:s.O6,adjustScalarBytes:function(e){return e[0]&=248,e[31]&=127,e[3
11]|=64,e},uvRatio:N});function T(e){if(!(e instanceof D))throw Error("RistrettoPoint expected")}let R=e=>N(C,e),P=e=>x.CURVE.Fp.create(null&bytesToNumberLE(e));function k(e){let{d:t}=x.CURVE,r=x.CURVE.Fp.ORDER,i=x.CURVE.Fp.create,n=i(null*e*e),s=i((n+C)*null),o=BigInt(-1),a=i((o-t*n)*i(n+t)),{isValid:c,value:l}=N(s,a),u=i(l*e);isNegativeLE(u,r)||(u=i(-u)),c||(l=u),c||(o=n);let h=i(o*(n-C)*null-a),d=l*l,p=i((l+l)*a),f=i(null*h),g=i(C-d),m=i(C+d);return new x.ExtendedPoint(i(p*m),i(g*f),i(f*m),i(p*g))}class D{constructor(e){this.ep=e}static fromAffine(e){return new D(x.ExtendedPoint.fromAffine(e))}static hashToCurve(e){let t=k(P((e=ensureBytes("ristrettoHash",e,64)).slice(0,32))),r=k(P(e.slice(32,64)));return new D(t.add(r))}static fromHex(e){e=ensureBytes("ristrettoHex",e,32);let{a:t,d:r}=x.CURVE,i=x.CURVE.Fp.ORDER,n=x.CURVE.Fp.create,s="RistrettoPoint.fromHex: the hex is not valid encoding of RistrettoPoint",o=P(e);if(!equalBytes(numberToBytesLE(o,32),e)||isNegativeLE(o,i))throw Error(s);let a=n(o*o),c=n(C+t*a),l=n(C-t*a),u=n(c*c),h=n(l*l),d=n(t*r*u-h),{isValid:p,value:f}=R(n(d*h)),g=n(f*l),m=n(f*g*d),y=n((o+o)*g);isNegativeLE(y,i)&&(y=n(-y));let w=n(c*m),b=n(y*w);if(!p||isNegativeLE(b,i)||w===_)throw Error(s);return new D(new x.ExtendedPoint(y,w,C,b))}static msm(e,t){return pippenger(D,Field(x.CURVE.n,x.CURVE.nBitLength),e,t)}toRawBytes(){let e,{ex:t,ey:r,ez:i,et:n}=this.ep,s=x.CURVE.Fp.ORDER,o=x.CURVE.Fp.create,a=o(o(i+r)*o(i-r)),c=o(t*r),l=o(c*c),{value:u}=R(o(a*l)),h=o(u*a),d=o(u*c),p=o(h*d*n);if(isNegativeLE(n*p,s)){let i=o(null*r),n=o(null*t);t=i,r=n,e=o(null*h)}else e=d;isNegativeLE(t*p,s)&&(r=o(-r));let f=o((i-r)*e);return isNegativeLE(f,s)&&(f=o(-f)),numberToBytesLE(f,32)}toHex(){return bytesToHex(this.toRawBytes())}toString(){return this.toHex()}equals(e){T(e);let{ex:t,ey:r}=this.ep,{ex:i,ey:n}=e.ep,s=x.CURVE.Fp.create,o=s(t*n)===s(r*i),a=s(r*n)===s(t*i);return o||a}add(e){return T(e),new D(this.ep.add(e.ep))}subtract(e){return T(e),new D(this.ep.subtract(e.ep))}multiply(e){return new D(this.ep.multiply(e))}multiplyUnsafe(e){return new D(this.ep.multiplyUnsafe(e))}double(){return new D(this.ep.double())}negate(){return new D(this.ep.negate())}}},68318:function(e,t,r){"use strict";r.d(t,{secp256k1:function(){return I}});var i=r(12426),n=r(13940),s=r(88835);class o extends s.kb{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,(0,n.z3)(e);let r=(0,s.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,o=new Uint8Array(i);o.set(r.length>i?e.create().update(r).digest():r);for(let e=0;e<o.length;e++)o[e]^=54;this.iHash.update(o),this.oHash=e.create();for(let e=0;e<o.length;e++)o[e]^=106;this.oHash.update(o),o.fill(0)}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:i,destroyed:n,blockLen:s,outputLen:o}=this;return e.finished=i,e.destroyed=n,e.blockLen=s,e.outputLen=o,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}let a=(e,t,r)=>new o(e,t).update(r).digest();a.create=(e,t)=>new o(e,t);var c=r(45645),l=r(60474),u=r(41423);function h(e){void 0!==e.lowS&&(0,u.uw)("lowS",e.lowS),void 0!==e.prehash&&(0,u.uw)("prehash",e.prehash)}let{bytesToNumberBE:d,hexToBytes:p}=u;class f extends Error{constructor(e=""){super(e)}}let g={Err:f,_tlv:{encode:(e,t)=>{let{Err:r}=g;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(1&t.length)throw new r("tlv.encode: unpadded data");let i=t.length/2,n=u.uz(i);if(n.length/2&128)throw new r("tlv.encode: long form length too big");let s=i>127?u.uz(n.length/2|128):"";return u.uz(e)+s+n+t},decode(e,t){let{Err:r}=g,i=0;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(t.length<2||t[i++]!==e)throw new r("tlv.decode: wrong tlv");let n=t[i++],s=0;if(128&n){let e=127&n;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(i,i+e);
1if(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(i+=e,s<128)throw new r("tlv.decode(long): not minimal encoding")}else s=n;let o=t.subarray(i,i+s);if(o.length!==s)throw new r("tlv.decode: wrong value length");return{v:o,l:t.subarray(i+s)}}},_int:{encode(e){let{Err:t}=g;if(e<m)throw new t("integer: negative integers are not allowed");let r=u.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}=g;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 d(e)}},toSig(e){let{Err:t,_int:r,_tlv:i}=g,n="string"==typeof e?p(e):e;u.gk(n);let{v:s,l:o}=i.decode(48,n);if(o.length)throw new t("invalid signature: left bytes after parsing");let{v:a,l:c}=i.decode(2,s),{v:l,l:h}=i.decode(2,c);if(h.length)throw new t("invalid signature: left bytes after parsing");return{r:r.decode(a),s:r.decode(l)}},hexFromSig(e){let{_tlv:t,_int:r}=g,i=t.encode(2,r.encode(e.r)),n=t.encode(2,r.encode(e.s));return t.encode(48,i+n)}},m=BigInt(0),y=BigInt(1),w=(BigInt(2),BigInt(3));BigInt(4);let b=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),v=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),E=BigInt(1),_=BigInt(2),C=(e,t)=>(e+t/_)/t,A=(0,l.gN)(b,void 0,void 0,{sqrt:function(e){let t=BigInt(3),r=BigInt(6),i=BigInt(11),n=BigInt(22),s=BigInt(23),o=BigInt(44),a=BigInt(88),c=e*e*e%b,u=c*c*e%b,h=(0,l.oA)(u,t,b)*u%b,d=(0,l.oA)(h,t,b)*u%b,p=(0,l.oA)(d,_,b)*c%b,f=(0,l.oA)(p,i,b)*p%b,g=(0,l.oA)(f,n,b)*f%b,m=(0,l.oA)(g,o,b)*g%b,y=(0,l.oA)(m,a,b)*m%b,w=(0,l.oA)(y,o,b)*g%b,v=(0,l.oA)(w,t,b)*u%b,E=(0,l.oA)(v,s,b)*f%b,C=(0,l.oA)(E,r,b)*c%b,I=(0,l.oA)(C,_,b);if(!A.eql(A.sqr(I),e))throw Error("Cannot find square root");return I}}),I=function(e,t){let r=t=>(function(e){let t=function(e){let t=(0,c.Kd)(e);return u.FF(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}(e),{Fp:r,n:i}=t,n=r.BYTES+1,s=2*r.BYTES+1;function o(e){return(0,l.wQ)(e,i)}function a(e){return(0,l.U_)(e,i)}let{ProjectivePoint:d,normPrivateKeyToScalar:p,weierstrassEquation:f,isWithinCurveOrder:b}=function(e){let t=function(e){let t=(0,c.Kd)(e);u.FF(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:r,Fp:i,a:n}=t;if(r){if(!i.eql(n,i.ZERO))throw Error("invalid endomorphism, can only be defined for Koblitz curves that have a=0");if("object"!=typeof r||"bigint"!=typeof r.beta||"function"!=typeof r.splitScalar)throw Error("invalid endomorphism, expected beta: bigint and splitScalar: function")}return Object.freeze({...t})}(e),{Fp:r}=t,i=(0,l.gN)(t.n,t.nBitLength),n=t.toBytes||((e,t,i)=>{let n=t.toAffine();return u.eV(Uint8Array.from([4]),r.toBytes(n.x),r.toBytes(n.y))}),s=t.fromBytes||(e=>{let t=e.subarray(1);return{x:r.fromBytes(t.subarray(0,r.BYTES)),y:r.fromBytes(t.subarray(r.BYTES,2*r.BYTES))}});function o(e){let{a:i,b:n}=t,s=r.sqr(e),o=r.mul(s,e);return r.add(r.add(o,r.mul(e,i)),n)}if(!r.eql(r.sqr(t.Gy),o(t.Gx)))throw Error("bad generator point: equation left != right");function a(e){let r;let{allowedPrivateKeyLengths:i,nByteLength:n,wrapPrivateKey:s,n:o}=t;if(i&&"bigint"!=typeof e){if(u._t(e)&&(e=u.ci(e)),"string"!=typeof e||!i.includes(e.length))throw Error("invalid private key");e=e.padStart(2*n,"0")}try{r="bigint"==typeof e?e:u.bytesToNumberBE((0,u.ql)("private key",e,n))}catch(t){throw Error("invalid private key, expected hex or "+n+" bytes, got "+typeof e)}return s&&(r=(0,l.wQ)(r,o)),u.Fy("private key",r,y,o),r}function h(e){if(!(e instanceof f))throw Error("ProjectivePoint expected")}let d=(0,u.H9)((e,t)=>{let{px:i,py:n,pz:s}=e;if(r.eql(s,r.ONE))return{x:i,y:n};let o=e.is0();null==t&&(t=o?r.ONE:r.inv(s));let a=r.mul(i,t),c=r.mul(n,t),l=r.mul(s,t);if(o)return{x:r.ZERO,y:r.ZERO};
1if(!r.eql(l,r.ONE))throw Error("invZ was invalid");return{x:a,y:c}}),p=(0,u.H9)(e=>{if(e.is0()){if(t.allowInfinityPoint&&!r.is0(e.py))return;throw Error("bad point: ZERO")}let{x:i,y:n}=e.toAffine();if(!r.isValid(i)||!r.isValid(n))throw Error("bad point: x or y not FE");let s=r.sqr(n),a=o(i);if(!r.eql(s,a))throw Error("bad point: equation left != right");if(!e.isTorsionFree())throw Error("bad point: not in prime-order subgroup");return!0});class f{constructor(e,t,i){if(this.px=e,this.py=t,this.pz=i,null==e||!r.isValid(e))throw Error("x required");if(null==t||!r.isValid(t))throw Error("y required");if(null==i||!r.isValid(i))throw Error("z required");Object.freeze(this)}static fromAffine(e){let{x:t,y:i}=e||{};if(!e||!r.isValid(t)||!r.isValid(i))throw Error("invalid affine point");if(e instanceof f)throw Error("projective point not allowed");let n=e=>r.eql(e,r.ZERO);return n(t)&&n(i)?f.ZERO:new f(t,i,r.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(e){let t=r.invertBatch(e.map(e=>e.pz));return e.map((e,r)=>e.toAffine(t[r])).map(f.fromAffine)}static fromHex(e){let t=f.fromAffine(s((0,u.ql)("pointHex",e)));return t.assertValidity(),t}static fromPrivateKey(e){return f.BASE.multiply(a(e))}static msm(e,t){return(0,c.D1)(f,i,e,t)}_setWindowSize(e){b.setWindowSize(this,e)}assertValidity(){p(this)}hasEvenY(){let{y:e}=this.toAffine();if(r.isOdd)return!r.isOdd(e);throw Error("Field doesn't support isOdd")}equals(e){h(e);let{px:t,py:i,pz:n}=this,{px:s,py:o,pz:a}=e,c=r.eql(r.mul(t,a),r.mul(s,n)),l=r.eql(r.mul(i,a),r.mul(o,n));return c&&l}negate(){return new f(this.px,r.neg(this.py),this.pz)}double(){let{a:e,b:i}=t,n=r.mul(i,w),{px:s,py:o,pz:a}=this,c=r.ZERO,l=r.ZERO,u=r.ZERO,h=r.mul(s,s),d=r.mul(o,o),p=r.mul(a,a),g=r.mul(s,o);return g=r.add(g,g),u=r.mul(s,a),u=r.add(u,u),c=r.mul(e,u),l=r.mul(n,p),l=r.add(c,l),c=r.sub(d,l),l=r.add(d,l),l=r.mul(c,l),c=r.mul(g,c),u=r.mul(n,u),p=r.mul(e,p),g=r.sub(h,p),g=r.mul(e,g),g=r.add(g,u),u=r.add(h,h),h=r.add(u,h),h=r.add(h,p),h=r.mul(h,g),l=r.add(l,h),p=r.mul(o,a),p=r.add(p,p),h=r.mul(p,g),c=r.sub(c,h),u=r.mul(p,d),u=r.add(u,u),new f(c,l,u=r.add(u,u))}add(e){h(e);let{px:i,py:n,pz:s}=this,{px:o,py:a,pz:c}=e,l=r.ZERO,u=r.ZERO,d=r.ZERO,p=t.a,g=r.mul(t.b,w),m=r.mul(i,o),y=r.mul(n,a),b=r.mul(s,c),v=r.add(i,n),E=r.add(o,a);v=r.mul(v,E),E=r.add(m,y),v=r.sub(v,E),E=r.add(i,s);let _=r.add(o,c);return E=r.mul(E,_),_=r.add(m,b),E=r.sub(E,_),_=r.add(n,s),l=r.add(a,c),_=r.mul(_,l),l=r.add(y,b),_=r.sub(_,l),d=r.mul(p,E),l=r.mul(g,b),d=r.add(l,d),l=r.sub(y,d),d=r.add(y,d),u=r.mul(l,d),y=r.add(m,m),y=r.add(y,m),b=r.mul(p,b),E=r.mul(g,E),y=r.add(y,b),b=r.sub(m,b),b=r.mul(p,b),E=r.add(E,b),m=r.mul(y,E),u=r.add(u,m),m=r.mul(_,E),l=r.mul(v,l),l=r.sub(l,m),m=r.mul(v,y),d=r.mul(_,d),new f(l,u,d=r.add(d,m))}subtract(e){return this.add(e.negate())}is0(){return this.equals(f.ZERO)}wNAF(e){return b.wNAFCached(this,e,f.normalizeZ)}multiplyUnsafe(e){let{endo:i,n:n}=t;u.Fy("scalar",e,m,n);let s=f.ZERO;if(e===m)return s;if(this.is0()||e===y)return this;if(!i||b.hasPrecomputes(this))return b.wNAFCachedUnsafe(this,e,f.normalizeZ);let{k1neg:o,k1:a,k2neg:c,k2:l}=i.splitScalar(e),h=s,d=s,p=this;for(;a>m||l>m;)a&y&&(h=h.add(p)),l&y&&(d=d.add(p)),p=p.double(),a>>=y,l>>=y;return o&&(h=h.negate()),c&&(d=d.negate()),d=new f(r.mul(d.px,i.beta),d.py,d.pz),h.add(d)}multiply(e){let i,n;let{endo:s,n:o}=t;if(u.Fy("scalar",e,y,o),s){let{k1neg:t,k1:o,k2neg:a,k2:c}=s.splitScalar(e),{p:l,f:u}=this.wNAF(o),{p:h,f:d}=this.wNAF(c);l=b.constTimeNegate(t,l),h=b.constTimeNegate(a,h),h=new f(r.mul(h.px,s.beta),h.py,h.pz),i=l.add(h),n=u.add(d)}else{let{p:t,f:r}=this.wNAF(e);i=t,n=r}return f.normalizeZ([i,n])[0]}multiplyAndAddUnsafe(e,t,r){let i=f.BASE,n=(e,t)=>t!==m&&t!==y&&e.equals(i)?e.multiply(t):e.multiplyUnsafe(t),s=n(this,t).add(n(e,r));return s.is0()?void 0:s}toAffine(e){return d(this,e)}isTorsionFree(){let{h:e,isTorsionFree:r}=t;if(e===y)return!0;if(r)return r(f,this);throw Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:e,clearCofactor:r}=t;return e===y?this:r?r(f,this):this.multiplyUnsafe(t.h)}toRawBytes(e=!0){return(0,u.uw)("isCompressed",e),this.assertValidity(),n(f,this,e)}toHex(e=!0){return(0,u.uw)("isCompressed",e),u.ci(this.toRawBytes(e))}}f.BASE=new f(t.Gx,t.Gy,r.ONE),f.ZERO=new f(r.ZERO,r.ONE,r.ZERO);let g=t.nBitLength,b=(0,c.Mx)(f,t.endo?Math.ceil(g/2):g);return{CURVE:t,ProjectivePoint:f,normPrivateKeyToScalar:a,weierstrassEquation:o,isWithinCurveOrder:function(e){return u.Z2(e,y,t.n)}}}({...t,toBytes(e,t,i){let n=t.toAffine(),s=r.toBytes(n.x),o=u.eV;return((0,u.uw)("isCompressed",i),i)?o(Uint8Array.from([t.hasEvenY()?2:3]),s):o(Uint8Array.from([4]),s,r.toBytes(n.y))},fromBytes(e){let t=e.length,i=e[0],o=e.subarray(1);if(t===n&&(2===i||3===i)){let e;let t=u.bytesToNumberBE(o);if(!u.Z2(t,y,r.ORDER))throw Error("Point is not on curve");let n=f(t);try{e=r.sqrt(n)}catch(e){throw Error("Point is not on curve"+(e instanceof Error?": "+e.message:""))}return(1&i)==1!=((e&y)===y)&&(e=r.neg(e)),{x:t,y:e}}if(t===s&&4===i)return{x:r.fromBytes(o.subarray(0,r.BYTES)),y:r.fromBytes(o.subarray(r.BYTES,2*r.BYTES))};throw Error("invalid Point, expected length of "+n+", or uncompressed "+s+", got "+t)}}),v=e=>u.ci(u.tL(e,t.nByteLength)),E=(e,t,r)=>u.bytesToNumberBE(e.slice(t,r));class _{constructor(e,t,r){this.r=e,this.s=t,this.recovery=r,this.assertValidity()}static fromCompact(e){let r=t.nByteLength;return new _(E(e=(0,u.ql)("compactSignature",e,2*r),0,r),E(e,r,2*r))}static fromDER(e){let{r:t,s:r}=g.toSig((0,u.ql)("DER",e));return new _(t,r)}
1assertValidity(){u.Fy("r",this.r,y,i),u.Fy("s",this.s,y,i)}addRecoveryBit(e){return new _(this.r,this.s,e)}recoverPublicKey(e){let{r:i,s:n,recovery:s}=this,c=I((0,u.ql)("msgHash",e));if(null==s||![0,1,2,3].includes(s))throw Error("recovery id invalid");let l=2===s||3===s?i+t.n:i;if(l>=r.ORDER)throw Error("recovery id 2 or 3 invalid");let h=(1&s)==0?"02":"03",p=d.fromHex(h+v(l)),f=a(l),g=o(-c*f),m=o(n*f),y=d.BASE.multiplyAndAddUnsafe(p,g,m);if(!y)throw Error("point at infinify");return y.assertValidity(),y}hasHighS(){return this.s>i>>y}normalizeS(){return this.hasHighS()?new _(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return u.hexToBytes(this.toDERHex())}toDERHex(){return g.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return u.hexToBytes(this.toCompactHex())}toCompactHex(){return v(this.r)+v(this.s)}}function C(e){let t=u._t(e),r="string"==typeof e,i=(t||r)&&e.length;return t?i===n||i===s:r?i===2*n||i===2*s:e instanceof d}let A=t.bits2int||function(e){if(e.length>8192)throw Error("input is too large");let r=u.bytesToNumberBE(e),i=8*e.length-t.nBitLength;return i>0?r>>BigInt(i):r},I=t.bits2int_modN||function(e){return o(A(e))},S=u.dQ(t.nBitLength);function N(e){return u.Fy("num < 2^"+t.nBitLength,e,m,S),u.tL(e,t.nByteLength)}let O={lowS:t.lowS,prehash:!1},x={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(C(e))throw Error("first arg must be private key");if(!C(t))throw Error("second arg must be public key");return d.fromHex(t).multiply(p(e)).toRawBytes(r)},sign:function(e,n,s=O){let{seed:c,k2sig:l}=function(e,n,s=O){if(["recovered","canonical"].some(e=>e in s))throw Error("sign() legacy options not supported");let{hash:c,randomBytes:l}=t,{lowS:f,prehash:g,extraEntropy:w}=s;null==f&&(f=!0),e=(0,u.ql)("msgHash",e),h(s),g&&(e=(0,u.ql)("prehashed msgHash",c(e)));let v=I(e),E=p(n),C=[N(E),N(v)];if(null!=w&&!1!==w){let e=!0===w?l(r.BYTES):w;C.push((0,u.ql)("extraEntropy",e))}return{seed:u.eV(...C),k2sig:function(e){let t=A(e);if(!b(t))return;let r=a(t),n=d.BASE.multiply(t).toAffine(),s=o(n.x);if(s===m)return;let c=o(r*o(v+s*E));if(c===m)return;let l=(n.x===s?0:2)|Number(n.y&y),u=c;if(f&&c>i>>y)u=c>i>>y?o(-c):c,l^=1;return new _(s,u,l)}}}(e,n,s);return u.n$(t.hash.outputLen,t.nByteLength,t.hmac)(c,l)},verify:function(e,r,i,n=x){let s,c;r=(0,u.ql)("msgHash",r),i=(0,u.ql)("publicKey",i);let{lowS:l,prehash:p,format:f}=n;if(h(n),"strict"in n)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 m="string"==typeof e||u._t(e),y=!m&&!f&&"object"==typeof e&&null!==e&&"bigint"==typeof e.r&&"bigint"==typeof e.s;if(!m&&!y)throw Error("invalid signature, expected Uint8Array, hex string or Signature instance");try{if(y&&(c=new _(e.r,e.s)),m){try{"compact"!==f&&(c=_.fromDER(e))}catch(e){if(!(e instanceof g.Err))throw e}c||"der"===f||(c=_.fromCompact(e))}s=d.fromHex(i)}catch(e){return!1}if(!c||l&&c.hasHighS())return!1;p&&(r=t.hash(r));let{r:w,s:b}=c,v=I(r),E=a(b),C=o(v*E),A=o(w*E),S=d.BASE.multiplyAndAddUnsafe(s,C,A)?.toAffine();return!!S&&o(S.x)===w},ProjectivePoint:d,Signature:_,utils:{isValidPrivateKey(e){try{return p(e),!0}catch(e){return!1}},normPrivateKeyToScalar:p,randomPrivateKey:()=>{let e=(0,l.PS)(t.n);return(0,l.Us)(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)=>a(t,e,(0,s.eV)(...r)),randomBytes:s.O6});return{...r(t),create:r}}({a:BigInt(0),b:BigInt(7),Fp:A,n:v,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:e=>{let t=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-E*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),i=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),n=BigInt("0x100000000000000000000000000000000"),s=C(t*e,v),o=C(-r*e,v),a=(0,l.wQ)(e-s*t-o*i,v),c=(0,l.wQ)(-s*r-o*t,v),u=a>n,h=c>n;
1if(u&&(a=v-a),h&&(c=v-c),a>n||c>n)throw Error("splitScalar: Endomorphism failed, k="+e);return{k1neg:u,k1:a,k2neg:h,k2:c}}}},i.JQ);BigInt(0),I.ProjectivePoint},13940:function(e,t,r){"use strict";function i(e){if(!Number.isSafeInteger(e)||e<0)throw Error("positive integer expected, got "+e)}function n(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){if("function"!=typeof e||"function"!=typeof e.create)throw Error("Hash should be wrapped by utils.wrapConstructor");i(e.outputLen),i(e.blockLen)}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")}function a(e,t){n(e);let r=t.outputLen;if(e.length<r)throw Error("digestInto() expects output buffer of length at least "+r)}r.d(t,{$h:function(){return o},eB:function(){return a},gk:function(){return n},k8:function(){return i},z3:function(){return s}})},86363:function(e,t,r){"use strict";r.d(t,{VR:function(){return a},bc:function(){return s},l3:function(){return o}});var i=r(13940),n=r(88835);function s(e,t,r){return e&t^~e&r}function o(e,t,r){return e&t^e&r^t&r}
1class a extends n.kb{constructor(e,t,r,i){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=(0,n.GL)(this.buffer)}update(e){(0,i.$h)(this);let{view:t,buffer:r,blockLen:s}=this,o=(e=(0,n.O0)(e)).length;for(let i=0;i<o;){let a=Math.min(s-this.pos,o-i);if(a===s){let t=(0,n.GL)(e);for(;s<=o-i;i+=s)this.process(t,i);continue}r.set(e.subarray(i,i+a),this.pos),this.pos+=a,i+=a,this.pos===s&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){(0,i.$h)(this),(0,i.eB)(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:s,isLE:o}=this,{pos:a}=this;t[a++]=128,this.buffer.subarray(a).fill(0),this.padOffset>s-a&&(this.process(r,0),a=0);for(let e=a;e<s;e++)t[e]=0;!function(e,t,r,i){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,i);let n=BigInt(32),s=BigInt(4294967295),o=Number(r>>n&s),a=Number(r&s),c=i?4:0,l=i?0:4;e.setUint32(t+c,o,i),e.setUint32(t+l,a,i)}(r,s-8,BigInt(8*this.length),o),this.process(r,0);let c=(0,n.GL)(e),l=this.outputLen;if(l%4)throw Error("_sha2: outputLen should be aligned to 32bit");let u=l/4,h=this.get();if(u>h.length)throw Error("_sha2: outputLen bigger than state");for(let e=0;e<u;e++)c.setUint32(4*e,h[e],o)}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:i,finished:n,destroyed:s,pos:o}=this;return e.length=i,e.pos=o,e.finished=n,e.destroyed=s,i%t&&e.buffer.set(r),e}}},45860:function(e,t,r){"use strict";r.d(t,{EP:function(){return a},SD:function(){return l},Vl:function(){return o},gm:function(){return c},mk:function(){return u}});let i=BigInt(4294967296-1),n=BigInt(32);function s(e,t=!1){return t?{h:Number(e&i),l:Number(e>>n&i)}:{h:0|Number(e>>n&i),l:0|Number(e&i)}}function o(e,t=!1){let r=new Uint32Array(e.length),i=new Uint32Array(e.length);for(let n=0;n<e.length;n++){let{h:o,l:a}=s(e[n],t);[r[n],i[n]]=[o,a]}return[r,i]}let a=(e,t,r)=>e<<r|t>>>32-r,c=(e,t,r)=>t<<r|e>>>32-r,l=(e,t,r)=>t<<r-32|e>>>64-r,u=(e,t,r)=>e<<r-32|t>>>64-r;t.ZP={fromBig:s,split:o,toBig:(e,t)=>BigInt(e>>>0)<<n|BigInt(t>>>0),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,rotr32H:(e,t)=>t,rotr32L:(e,t)=>e,rotlSH:a,rotlSL:c,rotlBH:l,rotlBL:u,add:function(e,t,r,i){let n=(t>>
1>0)+(i>>>0);return{h:e+r+(n/4294967296|0)|0,l:0|n}},add3L:(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),add3H:(e,t,r,i)=>t+r+i+(e/4294967296|0)|0,add4L:(e,t,r,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(i>>>0),add4H:(e,t,r,i,n)=>t+r+i+n+(e/4294967296|0)|0,add5H:(e,t,r,i,n,s)=>t+r+i+n+s+(e/4294967296|0)|0,add5L:(e,t,r,i,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(i>>>0)+(n>>>0)}},12426:function(e,t,r){"use strict";r.d(t,{JQ:function(){return l}});var i=r(86363),n=r(88835);let s=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),o=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),a=new Uint32Array(64);class c extends i.VR{constructor(){super(64,32,8,!1),this.A=0|o[0],this.B=0|o[1],this.C=0|o[2],this.D=0|o[3],this.E=0|o[4],this.F=0|o[5],this.G=0|o[6],this.H=0|o[7]}get(){let{A:e,B:t,C:r,D:i,E:n,F:s,G:o,H:a}=this;return[e,t,r,i,n,s,o,a]}set(e,t,r,i,n,s,o,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|i,this.E=0|n,this.F=0|s,this.G=0|o,this.H=0|a}process(e,t){for(let r=0;r<16;r++,t+=4)a[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=a[e-15],r=a[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;a[e]=s+a[e-7]+i+a[e-16]|0}let{A:r,B:o,C:c,D:l,E:u,F:h,G:d,H:p}=this;for(let e=0;e<64;e++){let t=p+((0,n.np)(u,6)^(0,n.np)(u,11)^(0,n.np)(u,25))+(0,i.bc)(u,h,d)+s[e]+a[e]|0,f=((0,n.np)(r,2)^(0,n.np)(r,13)^(0,n.np)(r,22))+(0,i.l3)(r,o,c)|0;p=d,d=h,h=u,u=l+t|0,l=c,c=o,o=r,r=t+f|0}r=r+this.A|0,o=o+this.B|0,c=c+this.C|0,l=l+this.D|0,u=u+this.E|0,h=h+this.F|0,d=d+this.G|0,p=p+this.H|0,this.set(r,o,c,l,u,h,d,p)}roundClean(){a.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}let l=(0,n.hE)(()=>new c)},76087:function(e,t,r){"use strict";r.d(t,{fr:function(){return v}});var i=r(13940),n=r(45860),s=r(88835);let o=[],a=[],c=[],l=BigInt(0),u=BigInt(1),h=BigInt(2),d=BigInt(7),p=BigInt(256),f=BigInt(113);for(let e=0,t=u,r=1,i=0;e<24;e++){[r,i]=[i,(2*r+3*i)%5],o.push(2*(5*i+r)),a.push((e+1)*(e+2)/2%64);let n=l;for(let e=0;e<7;e++)(t=(t<<u^(t>>d)*f)%p)&h&&(n^=u<<(u<<BigInt(e))-u);c.push(n)}let[g,m]=(0,n.Vl)(c,!0),y=(e,t,r)=>r>32?(0,n.SD)(e,t,r):(0,n.EP)(e,t,r),w=(e,t,r)=>r>32?(0,n.mk)(e,t,r):(0,n.gm)(e,t,r);class b extends s.kb{constructor(e,t,r,n=!1,o=24){if(super(),this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=n,this.rounds=o,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,(0,i.k8)(r),0>=this.blockLen||this.blockLen>=200)throw Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=(0,s.Jq)(this.state)}keccak(){s.iA||(0,s.l1)(this.state32),function(e,t=24){let r=new Uint32Array(10);for(let i=24-t;i<24;i++){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 i=(t+8)%10,n=(t+2)%10,s=r[n],o=r[n+1],a=y(s,o,1)^r[i],c=w(s,o,1)^r[i+1];for(let r=0;r<50;r+=10)e[t+r]^=a,e[t+r+1]^=c}let t=e[2],n=e[3];for(let r=0;r<24;r++){let i=a[r],s=y(t,n,i),c=w(t,n,i),l=o[r];t=e[l],n=e[l+1],e[l]=s,e[l+1]=c}for(let t=0;t<50;t+=10){for(let i=0;i<10;i++)r[i]=e[t+i];for(let i=0;i<10;i++)e[t+i]^=~r[(i+2)%10]&r[(i+4)%10]}e[0]^=g[i],e[1]^=m[i]}r.fill(0)}(this.state32,this.rounds),s.iA||(0,s.l1)(this.state32),this.posOut=0,this.pos=0}update(e){(0,i.$h)(this);let{blockLen:t,state:r}=this,n=(e=(0,s.O0)(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:i}=this;e[r]^=t,(128&t)!=0&&r===i-1&&this.keccak(),e[i-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 i=0,n=e.length;i<n;){this.posOut>=r&&this.keccak();let s=Math.min(r-this.posOut,n-i);e.set(t.subarray(this.posOut,this.posOut+s),i),this.posOut+=s,i+=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,this.state.fill(0)}_cloneInto(e){let{blockLen:t,suffix:r,outputLen:i,rounds:n,enableXOF:s}=this;return e||(e=new b(t,r,i,s,n)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=n,e.suffix=r,e.outputLen=i,e.enableXOF=s,e.destroyed=this.destroyed,e}}let v=(0,s.hE)(()=>new b(136,1,32))},88835:function(e,t,r){"use strict";r.d(t,{kb:function(){return d},l1:function(){return l},eV:function(){return h},GL:function(){return o},iA:function(){return c},O6:function(){return f},np:function(){return a},O0:function(){return u},Jq:function(){return s},hE:function(){return p}});let i="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;var n=r(13940);function s(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function o(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function a(e,t){return e<<32-t|e>>>t}let c=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0];function l(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}}function u(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)),(0,n.gk)(e),e}function h(...e){let t=0;for(let r=0;r<e.length;r++){let i=e[r];(0,n.gk)(i),t+=i.length}let r=new Uint8Array(t);for(let t=0,i=0;t<e.length;t++){let n=e[t];r.set(n,i),i+=n.length}return r}class d{clone(){return this._cloneInto()}}function p(e){let t=t=>e().update(u(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function f(e=32){if(i&&"function"==typeof i.getRandomValues)return i.getRandomValues(new Uint8Array(e));if(i&&"function"==typeof i.randomBytes)return i.randomBytes(e);throw Error("crypto.getRandomValues must be defined")}},29364:function(e,t,r){"use strict";let i,n;r.d(t,{Q:function(){return eo}});var s,o=r(64024);r(13885);var a=r(85263);r(5253);var c=r(39831),l=r(72647),u=r(84140),h=r(50035),d=r(38431),p=r(25779),f=r(67735);let g={UNIVERSAL_PROVIDER_RELAY_URL:"wss://relay.walletconnect.org",HASH_PREFIX:"SPL Name Service",ROOT_DOMAIN_ACCOUNT:new o.nh("58PwtjSDuFHuUkYjH9BYnnQKHfwo9reZhC2zMJv9JPkx"),NAME_PROGRAM_ID:new o.nh("namesLPneVptA9Z5rqUDD9tMTWEJwofgaYwp8cawRkX"),REVERSE_LOOKUP_CLASS:new o.nh("33m47vH6Eav6jr5Ry86XjhRft2jRBLDnDgPSHoquXi2Z"),DEFAULT_CHAIN:{id:"5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",caipNetworkId:"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",name:"Solana",chainNamespace:l.b.CHAIN.SOLANA,nativeCurrency:{name:"Solana",decimals:9,symbol
1:"SOL"},blockExplorers:{default:{name:"Solscan",url:"https://solscan.io"}},rpcUrls:{default:{http:[`${l.b.BLOCKCHAIN_API_RPC_URL}/v1`]}}},CHAIN_IDS:{Mainnet:"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",Devnet:"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",Testnet:"solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z",Deprecated_Mainnet:"solana:4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ",Deprecated_Devnet:"solana:8E9rvCKLFQia2Y35HXjjpWzj8weVo44K"},LAMPORTS_PER_SOL:1e9};var m=r(51466);function y(e){return"version"in e}var w=r(78008);class b{constructor(){this.listeners={accountsChanged:[],chainChanged:[],connect:[],disconnect:[],pendingTransaction:[],auth_rpcRequest:[],auth_rpcSuccess:[],auth_rpcError:[]}}on(e,t){this.listeners[e].push(t)}removeListener(e,t){this.listeners[e]=this.listeners[e].filter(e=>e!==t)}emit(e,t){this.listeners[e].forEach(e=>e(t))}}class v extends b{constructor(e){super(),this.id=l.b.CONNECTOR_ID.AUTH,this.name=l.b.CONNECTOR_NAMES.AUTH,this.type="AUTH",this.chain=l.b.CHAIN.SOLANA,this.provider=e.w3mFrameProvider,this.requestedChains=e.chains,this.getActiveChain=e.getActiveChain}get publicKey(){let e=this.provider.user?.address;return e?new o.nh(e):void 0}get chains(){let e=this.provider.getAvailableChainIds();return this.requestedChains.filter(t=>e.includes(t.caipNetworkId))}async connect(e={}){let t=e.chainId||this.getActiveChain()?.id,r=w.AccountController.state.preferredAccountTypes?.solana;if(await this.provider.connect({chainId:function(e){if("string"==typeof e)return`solana:${e}`}(t),preferredAccountType:r}),!this.publicKey)throw Error("Failed to connect to the wallet");return this.emit("connect",this.publicKey),this.publicKey.toBase58()}async disconnect(){await this.provider.disconnect(),this.emit("disconnect",void 0)}async signMessage(e){if(!this.publicKey)throw Error("Wallet not connected");let t=await this.provider.request({method:"solana_signMessage",params:{message:a.Z.encode(e),pubkey:this.publicKey.toBase58()}});return a.Z.decode(t.signature)}async signTransaction(e){let t=await this.provider.request({method:"solana_signTransaction",params:{transaction:this.serializeTransaction(e)}}),r=a.Z.decode(t.transaction);return y(e)?o.GS.deserialize(r):o.YW.from(r)}async signAndSendTransaction(e,t){let r=this.serializeTransaction(e);return(await this.provider.request({method:"solana_signAndSendTransaction",params:{transaction:r,options:t}})).signature}async sendTransaction(e,t,r){let i=await this.signTransaction(e);return await t.sendRawTransaction(i.serialize(),r)}async signAllTransactions(e){return(await this.provider.request({method:"solana_signAllTransactions",params:{transactions:e.map(e=>this.serializeTransaction(e))}})).transactions.map((t,r)=>{let i=e[r];if(!i)throw Error("Invalid solana_signAllTransactions response");let n=a.Z.decode(t);return y(i)?o.GS.deserialize(n):o.YW.from(n)})}async request(e){return this.provider.request({method:e.method,params:e.params})}async getAccounts(){return this.publicKey?Promise.resolve([{namespace:this.chain,address:this.publicKey.toBase58(),type:"eoa"}]):Promise.resolve([])}serializeTransaction(e){return a.Z.encode(new Uint8Array(e.serialize({verifySignatures:!1})))}}var E=r(998),_=r(20258);class C extends b{constructor(e){super(),this.name="Coinbase Wallet",this.id=E.C.ConnectorExplorerIds[l.b.CONNECTOR_ID.COINBASE_SDK]||this.name,this.explorerId=E.C.ConnectorExplorerIds[l.b.CONNECTOR_ID.COINBASE_SDK],this.type="ANNOUNCED",this.imageUrl="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTAyNCIgaGVpZ2h0PSIxMDI0IiB2aWV3Qm94PSIwIDAgMTAyNCAxMDI0IiBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8Y2lyY2xlIGN4PSI1MTIiIGN5PSI1MTIiIHI9IjUxMiIgZmlsbD0iIzAwNTJGRiIvPgo8cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTE1MiA1MTJDMTUyIDcxMC44MjMgMzEzLjE3NyA4NzIgNTEyIDg3MkM3MTAuODIzIDg3MiA4NzIgNzEwLjgyMyA4NzIgNTEyQzg3MiAzMTMuMTc3IDcxMC44MjMgMTUyIDUxMiAxNTJDMzEzLjE3NyAxNTIgMTUyIDMxMy4xNzcgMTUyIDUxMlpNNDIwIDM5NkM0MDYuNzQ1IDM5NiAzOTYgNDA2Ljc0NSAzOTYgNDIwVjYwNEMzOTYgNjE3LjI1NSA0MDYuNzQ1IDYyOCA0MjAgNjI4SDYwNEM2MTcuMjU1IDYyOCA2MjggNjE3LjI1NSA2MjggNjA0VjQyMEM2MjggNDA2Ljc0NSA2MTcuMjU1IDM5NiA2MDQgMzk2SDQyMFoiIGZpbGw9IndoaXRlIi8+Cjwvc3ZnPgo=",this.chain=l.b.CHAIN.SOLANA,this.provider=this,this.coinbase=e.provider,this.requestedChains=e.chains}get chains(){return this.requestedChains.filter(e=>e.id===_.Zjg.id)}get publicKey(){return this.coinbase.publicKey}get imageId(){return E.C.ConnectorImageIds[l.b.CONNECTOR_ID.COINBASE]}async connect(){try{await this.coinbase.connect();let e=this.getAccount(!0);return this.coinbase.emit("connect",this.coinbase.publicKey),this.emit
1("connect",e),e.toBase58()}catch(e){throw this.coinbase.emit("error",e),e}}async disconnect(){await this.coinbase.disconnect(),this.coinbase.emit("disconnect",void 0),this.emit("disconnect",void 0)}async signMessage(e){return(await this.coinbase.signMessage(e)).signature}async signTransaction(e){return this.coinbase.signTransaction(e)}async signAndSendTransaction(e,t){return(await this.coinbase.signAndSendTransaction(e,t)).signature}async sendTransaction(e,t,r){let i=await this.signTransaction(e);return await t.sendRawTransaction(i.serialize(),r)}async signAllTransactions(e){return await this.coinbase.signAllTransactions(e)}async request(e){return Promise.reject(Error('The "request" method is not supported on Coinbase Wallet'))}async getAccounts(){let e=this.getAccount();return e?Promise.resolve([{namespace:this.chain,address:e.toBase58(),type:"eoa"}]):Promise.resolve([])}getAccount(e){let t=this.coinbase.publicKey;if(e&&!t)throw Error("Not connected");return t}}var A=r(1125),I=r(18535);class S extends Error{constructor(e){super(`The wallet does not support the "${e}" feature`)}}class N extends Error{constructor(e){super(`The method "${e}" is not supported by the wallet`)}}var O=r(82957).Buffer;class x extends I.z{constructor({provider:e,chains:t,getActiveChain:r}){super({caipNetworks:t,namespace:"solana",provider:e}),this.eventEmitter=new b,this.emit=this.eventEmitter.emit.bind(this.eventEmitter),this.on=this.eventEmitter.on.bind(this.eventEmitter),this.removeListener=this.eventEmitter.removeListener.bind(this.eventEmitter),this.getActiveChain=r}get session(){return this.provider.session}get chains(){return this.sessionChains.map(e=>{let t=e;return t===g.CHAIN_IDS.Deprecated_Mainnet?t=g.CHAIN_IDS.Mainnet:t===g.CHAIN_IDS.Deprecated_Devnet&&(t=g.CHAIN_IDS.Devnet),this.caipNetworks.find(e=>e.caipNetworkId===t)}).filter(Boolean)}get publicKey(){let e=this.getAccount(!1);if(e)return new o.nh(e.publicKey)}async connect(){await super.connectWalletConnect();let e=this.getAccount(!0);return this.emit("connect",new o.nh(e.publicKey)),e.address}async disconnect(){await super.disconnect(),this.emit("disconnect",void 0)}async signMessage(e){this.checkIfMethodIsSupported("solana_signMessage");let t=await this.internalRequest("solana_signMessage",{message:a.Z.encode(e),pubkey:this.getAccount(!0).address});return a.Z.decode(t.signature)}async signTransaction(e){this.checkIfMethodIsSupported("solana_signTransaction");let t=this.serializeTransaction(e),r=await this.internalRequest("solana_signTransaction",{transaction:t,pubkey:this.getAccount(!0).address,...this.getRawRPCParams(e)});if("signature"in r){let t=a.Z.decode(r.signature);return e.addSignature(new o.nh(this.getAccount(!0).publicKey),O.from(t)),e}let i=O.from(r.transaction,"base64");return y(e)?o.GS.deserialize(new Uint8Array(i)):o.YW.from(i)}async signAndSendTransaction(e,t){this.checkIfMethodIsSupported("solana_signAndSendTransaction");let r=this.serializeTransaction(e),i=await this.internalRequest("solana_signAndSendTransaction",{transaction:r,pubkey:this.getAccount(!0).address,sendOptions:t});return this.emit("pendingTransaction",void 0),i.signature}async sendTransaction(e,t,r){let i=await this.signTransaction(e),n=await t.sendRawTransaction(i.serialize(),r);return this.emit("pendingTransaction",void 0),n}async signAllTransactions(e){try{return this.checkIfMethodIsSupported("solana_signAllTransactions"),(await this.internalRequest("solana_signAllTransactions",{transactions:e.map(e=>this.serializeTransaction(e))})).transactions.map((t,r)=>{let i=e[r];if(!i)throw Error("Invalid transactions response");let n=O.from(t,"base64");return y(i)?o.GS.deserialize(new Uint8Array(n)):(this.emit("pendingTransaction",void 0),o.YW.from(n))})}catch(t){if(t instanceof N){let t=[];for(let r of e)t.push(await this.signTransaction(r));return t}throw t}}request(e){return this.internalRequest(e.method,e.params)}async getAccounts(){return Promise.resolve((this.session?.namespaces.solana?.accounts||[]).map(e=>({namespace:this.chain,address:A.u.parseCaipAddress(e).address,type:"eoa"})))}
1internalRequest(e,t){let r=this.chains.find(e=>this.getActiveChain()?.id===e.id),i=r?.caipNetworkId;switch(i){case g.CHAIN_IDS.Mainnet:this.sessionChains.includes(g.CHAIN_IDS.Mainnet)||(i=g.CHAIN_IDS.Deprecated_Mainnet);break;case g.CHAIN_IDS.Devnet:this.sessionChains.includes(g.CHAIN_IDS.Devnet)||(i=g.CHAIN_IDS.Deprecated_Devnet)}return this.provider?.request({method:e,params:t},i)}get sessionChains(){return c.sQ.getChainsFromNamespaces(this.session?.namespaces)}serializeTransaction(e){return O.from(new Uint8Array(e.serialize({verifySignatures:!1}))).toString("base64")}getAccount(e){let t=this.session?.namespaces.solana?.accounts[0];if(!t){if(e)throw Error("Account not found");return}let r=t.split(":")[2];if(!r){if(e)throw Error("Address not found");return}return{address:r,publicKey:a.Z.decode(r)}}getRawRPCParams(e){return y(e)?{}:{feePayer:e.feePayer?.toBase58()??"",instructions:e.instructions.map(e=>({data:a.Z.encode(new Uint8Array(e.data)),keys:e.keys.map(e=>({isWritable:e.isWritable,isSigner:e.isSigner,pubkey:e.pubkey.toBase58()})),programId:e.programId.toBase58()})),recentBlockhash:e.recentBlockhash??""}}checkIfMethodIsSupported(e){if(!this.session?.namespaces.solana?.methods.includes(e))throw new N(e)}}var T=r(31147),R=r(54322);let P=(0,T.sj)({connection:null}),k={state:P,subscribeKey:(e,t)=>(0,R.VW)(P,e,t),subscribe:e=>(0,T.Ld)(P,()=>e(P)),setConnection(e){P.connection=(0,T.iH)(e)}};async function D({provider:e,to:t,value:r,connection:i}){if(!e.publicKey)throw Error("No public key found");let n=new o.nh(t),s=Math.floor(r*o.j5),{blockhash:a,lastValidBlockHeight:c}=await i.getLatestBlockhash(),l=[o.Lb.setComputeUnitPrice({microLamports:2e7}),o.Lb.setComputeUnitLimit({units:500}),o.yc.transfer({fromPubkey:e.publicKey,toPubkey:n,lamports:s})];return new o.YW({feePayer:e.publicKey,blockhash:a,lastValidBlockHeight:c}).add(...l)}let M="solana:signAndSendTransaction",U="solana:signTransaction",L="standard:connect",B="standard:events";function j(e){return L in e.features&&B in e.features&&(M in e.features||U in e.features)}var $=function(e,t,r,i){if("a"===r&&!i)throw TypeError("Private accessor was defined without a getter");if("function"==typeof t?e!==t||!i:!t.has(e))throw TypeError("Cannot read private member from an object whose class did not declare it");return"m"===r?i:"a"===r?i.call(e):i?i.value:t.get(e)},F=function(e,t,r,i,n){if("m"===i)throw TypeError("Private method is not writable");if("a"===i&&!n)throw TypeError("Private accessor was defined without a setter");if("function"==typeof t?e!==t||!n:!t.has(e))throw TypeError("Cannot write private member to an object whose class did not declare it");return"a"===i?n.call(e,r):n?n.value=r:t.set(e,r),r};let q=new Set,z={};function H(...e){return(e=e.filter(e=>!q.has(e))).length?(e.forEach(e=>{i=void 0,q.add(e)}),z.register?.forEach(t=>K(()=>t(...e))),function(){e.forEach(e=>{i=void 0,q.delete(e)}),z.unregister?.forEach(t=>K(()=>t(...e)))}):()=>{}}function W(){return i||(i=[...q]),i}function V(e,t){return z[e]?.push(t)||(z[e]=[t]),function(){z[e]=z[e]?.filter(e=>t!==e)}}function K(e){try{e()}catch(e){console.error(e)}}
1class Z extends Event{get detail(){return $(this,s,"f")}get type(){return"wallet-standard:app-ready"}constructor(e){super("wallet-standard:app-ready",{bubbles:!1,cancelable:!1,composed:!1}),s.set(this,void 0),F(this,s,e,"f")}preventDefault(){throw Error("preventDefault cannot be called")}stopImmediatePropagation(){throw Error("stopImmediatePropagation cannot be called")}stopPropagation(){throw Error("stopPropagation cannot be called")}}s=new WeakMap;class G extends Error{constructor(e,t){super(e),this.error=t}}class Y extends G{constructor(){super(...arguments),this.name="WalletAccountError"}}class J extends G{constructor(){super(...arguments),this.name="WalletSendTransactionError"}}class X extends G{constructor(){super(...arguments),this.name="WalletSignTransactionError"}}class Q extends G{constructor(){super(...arguments),this.name="WalletSignMessageError"}}let ee={"solana:mainnet":_.Zjg,"solana:testnet":_.Q6N,"solana:devnet":_.ol5};class et extends b{constructor({wallet:e,getActiveChain:t,requestedChains:r}){super(),this.chain=l.b.CHAIN.SOLANA,this.provider=this,this.wallet=e,this.getActiveChain=t,this.requestedChains=r,this.bindEvents()}get id(){let e=this.name;return E.C.ConnectorExplorerIds[e]||e}get name(){return"Trust"===this.wallet.name?"Trust Wallet":this.wallet.name}get type(){return"ANNOUNCED"}get explorerId(){return E.C.ConnectorExplorerIds[this.name]}get publicKey(){let e=this.getAccount(!1);if(e)return new o.nh(e.publicKey)}get imageUrl(){return this.wallet.icon}get chains(){return this.wallet.chains.map(e=>this.requestedChains.find(t=>t.id===e||t.id===ee[e]?.id)).filter(Boolean)}async connect(){let e=this.getWalletFeature(L);await e.connect();let t=this.getAccount(!0),r=new o.nh(t.publicKey);return this.emit("connect",r),t.address}async disconnect(){let e=this.getWalletFeature("standard:disconnect");await e.disconnect(),this.emit("disconnect",void 0)}async signMessage(e){let t=this.getWalletFeature("solana:signMessage"),r=this.getAccount(!0),[i]=await t.signMessage({message:e,account:r});if(!i)throw new Q("Empty result");return i.signature}async signTransaction(e){let t=this.getWalletFeature(U),r=this.getAccount(!0),i=this.serializeTransaction(e),[n]=await t.signTransaction({account:r,transaction:new Uint8Array(i),chain:this.getActiveChainName()});if(!n)throw new X("Empty result");return(this.emit("pendingTransaction",void 0),y(e))?o.GS.deserialize(n.signedTransaction):o.YW.from(n.signedTransaction)}async signAndSendTransaction(e,t){let r=this.getWalletFeature(M),i=this.getAccount(!0),[n]=await r.signAndSendTransaction({account:i,transaction:new Uint8Array(this.serializeTransaction(e)),options:{...t,preflightCommitment:function(e){switch(e){case"processed":case"confirmed":case"finalized":case void 0:return e;case"recent":return"processed";case"single":case"singleGossip":return"confirmed";case"max":case"root":return"finalized";default:return}}(t?.preflightCommitment)},chain:this.getActiveChainName()});if(!n)throw new J("Empty result");return this.emit("pendingTransaction",void 0),a.Z.encode(n.signature)}async sendTransaction(e,t,r){let i=await this.signTransaction(e);return await t.sendRawTransaction(i.serialize(),r)}async signAllTransactions(e){let t=this.getWalletFeature(U),r=this.getAccount(!0),i=this.getActiveChainName();return(await t.signTransaction(...e.map(e=>({transaction:new Uint8Array(this.serializeTransaction(e)),account:r,chain:i})))).map(({signedTransaction:t},r)=>{let i=e[r];if(!i)throw new X("Invalid transaction signature response");return(this.emit("pendingTransaction",void 0),y(i))?o.GS.deserialize(t):o.YW.from(t)})}async request(e){return Promise.reject(new S("request"))}async getAccounts(){return Promise.resolve(this.wallet.accounts.map(e=>({namespace:this.chain,address:e.address,type:"eoa"})))}serializeTransaction(e){return e.serialize({verifySignatures:!1})}getAccount(e){let t=this.wallet.accounts[0];if(e&&!t)throw new Y;return t}getWalletFeature(e){if(!(e in this.wallet.features))throw new S(e);return this.wallet.features[e]}getActiveChainName(){let e=Object.entries(ee).find(([,e])=>e.id===this.getActiveChain()?.id);if(!e)throw Error("Invalid chain id");return e[0]}bindEvents(){this.getWalletFeature(B).on("change",e=>
1{if(e.accounts){let t=e.accounts[0];t&&this.emit("accountsChanged",new o.nh(t.publicKey))}})}}let{get:er,on:ei}=function(){if(n||(n=Object.freeze({register:H,get:W,on:V}),"undefined"==typeof window))return n;let e=Object.freeze({register:H});try{window.addEventListener("wallet-standard:register-wallet",({detail:t})=>t(e))}catch(e){console.error("wallet-standard:register-wallet event listener could not be added\n",e)}try{window.dispatchEvent(new Z(e))}catch(e){console.error("wallet-standard:app-ready event could not be dispatched\n",e)}return n}(),en=[];function es(e,t,r){return e.filter(j).map(e=>new et({wallet:e,requestedChains:t,getActiveChain:r}))}class eo extends m.q{constructor(e={}){super({adapterType:l.b.ADAPTER_TYPES.SOLANA,namespace:l.b.CHAIN.SOLANA}),this.balancePromises={},this.providerHandlers=null,this.connectionSettings=e.connectionSettings||"confirmed",this.wallets=e.wallets}construct(e){super.construct(e);let t=u.M.getActiveCaipNetworkId(),r=e.networks?.find(e=>e.caipNetworkId===t)||e.networks?.[0],i=r?.rpcUrls.default.http[0];i&&k.setConnection(new o.ew(i,this.connectionSettings))}setAuthProvider(e){this.addConnector(new v({w3mFrameProvider:e,getActiveChain:()=>h.R.getCaipNetworkByNamespace(this.namespace),chains:this.getCaipNetworks()}))}syncConnectors(e,t){e.projectId||d.AlertController.open(f.j.ALERT_ERRORS.PROJECT_ID_NOT_CONFIGURED,"error");let r=()=>t.getCaipNetwork(this.namespace);p.j.isClient()&&"coinbaseSolana"in window&&this.addConnector(new C({provider:window.coinbaseSolana,chains:this.getCaipNetworks(),getActiveChain:r})),function(e,t,r){let i=[ei("register",(...i)=>{r(...en=[...en,...es(i,e,t)])}),ei("unregister",(...e)=>{r(...en=en.filter(t=>e.some(e=>e.name===t.wallet.name)))})];r(...en=es(er(),e,t)),()=>i.forEach(e=>e())}(this.getCaipNetworks(),r,this.addConnector.bind(this))}async getEnsAddress(e){return{address:e.name}}async writeContract(){return Promise.resolve({hash:""})}async getCapabilities(){return Promise.resolve({})}async grantPermissions(){return Promise.resolve({})}async revokePermissions(){return Promise.resolve("0x")}async walletGetAssets(e){return Promise.resolve({})}async getAccounts(e){let t=this.connectors.find(t=>t.id===e.id);return t?{accounts:await t.getAccounts()}:{accounts:[]}}async signMessage(e){let t=e.provider;if(!t)throw Error("connectionControllerClient:signMessage - provider is undefined");let r=await t.signMessage(new TextEncoder().encode(e.message));return{signature:a.Z.encode(r)}}async estimateGas(e){let t=k.state.connection;if(!t||!e.provider)throw Error("Connection is not set");let r=await D({provider:e.provider,connection:t,to:"11111111111111111111111111111111",value:1});return{gas:BigInt(await r.getEstimatedFee(t)||0)}}async sendTransaction(e){let t=k.state.connection;if(!t||!e.address||!e.provider)throw Error("Connection is not set");let r=e.provider,i=await D({provider:r,connection:t,to:e.to,value:e.value}),n=await r.sendTransaction(i,t);return await new Promise(e=>{let r=setInterval(async()=>{let i=await t.getSignatureStatus(n);i?.value&&(clearInterval(r),e())},1e3)}),{hash:n}}parseUnits(){return 0n}formatUnits(){return""}async connect(e){let t=this.connectors.find(t=>t.id===e.id);if(!t)throw Error("Provider not found");let r=e.rpcUrl||this.getCaipNetworks()?.find(t=>t.id===e.chainId)?.rpcUrls.default.http[0];if(!r)throw Error(`RPC URL not found for chainId: ${e.chainId}`);let i=await t.connect({chainId:e.chainId});return this.listenProviderEvents(t),k.setConnection(new o.ew(r,this.connectionSettings)),this.emit("accountChanged",{address:i,chainId:e.chainId}),{id:t.id,address:i,chainId:e.chainId,provider:t,type:t.type}}async getBalance(e){let t=e.address,r=this.getCaipNetworks()?.find(t=>t.id===e.chainId);if(!t)return Promise.resolve({balance:"0.00",symbol:"SOL"});let i=new o.ew(r?.rpcUrls?.default?.http?.[0],this.connectionSettings),n=`${r?.caipNetworkId}:${e.address}`,s=this.balancePromises[n];if(s)return s;let a=u.M.getNativeBalanceCacheForCaipAddress(n);return a?{balance:a.balance,symbol:a.symbol}:(this.balancePromises[n]=new Promise(async r=>{try{let s=(await i.getBalance(new o.nh(t))/g.LAMPORTS_PER_SOL).toString();if(u.M.updateNativeBalanceCache({caipAddress:n,balance:s,symbol:e.caipNetwork?.nativeCurrency.symbol||"SOL",timestamp:Date.now()}),!e.caipNetwork)throw Error("caipNetwork is required");r({balance:s,symbol:e.caipNetwork?.nativeCurrency.symbol})}catch(e){r({balance:"0.00",symbol:"SOL"})}}).finally(()=>{delete this.balancePromises[n]}),this.balancePromises[n]||{balance:"0.00",symbol:"SOL"})}async switchNetwork(e){await super.switchNetwork(e);let{caipNetwork:t}=e;t?.rpcUrls?.default?.http?.[0]&&k.setConnection(new o.ew(t.rpcUrls.default.http[0],this.connectionSettings))}
1listenProviderEvents(e){let t=()=>{this.removeProviderListeners(e),this.emit("disconnect")},r=e=>{let t=e.toBase58();t&&this.emit("accountChanged",{address:t})};e.on("disconnect",t),e.on("accountsChanged",r),e.on("connect",r),e.on("pendingTransaction",()=>{this.emit("pendingTransactions")}),this.providerHandlers={disconnect:t,accountsChanged:r}}removeProviderListeners(e){this.providerHandlers&&(e.removeListener("disconnect",this.providerHandlers.disconnect),e.removeListener("accountsChanged",this.providerHandlers.accountsChanged),e.removeListener("connect",this.providerHandlers.accountsChanged),this.providerHandlers=null)}setUniversalProvider(e){this.addConnector(new x({provider:e,chains:this.getCaipNetworks(),getActiveChain:()=>h.R.getCaipNetworkByNamespace(this.namespace)}))}async connectWalletConnect(e){let t=await super.connectWalletConnect(e),r=this.getCaipNetworks()?.find(t=>t.id===e)?.rpcUrls.default.http[0],i=new o.ew(r,this.connectionSettings);return k.setConnection(i),t}async disconnect(e){if(!e.provider||!e.providerType)throw Error("Provider or providerType not provided");await e.provider.disconnect()}async getProfile(){return Promise.resolve({profileName:void 0,profileImage:void 0})}async syncConnection(e){return this.connect({...e,type:""})}getWalletConnectProvider(e){return new x({provider:e.provider,chains:e.caipNetworks,getActiveChain:()=>h.R.getCaipNetworkByNamespace(this.namespace)})}}},72647:function(e,t,r){"use strict";r.d(t,{b:function(){return i}});let i={WC_NAME_SUFFIX:".reown.id",WC_NAME_SUFFIX_LEGACY:".wcn.id",BLOCKCHAIN_API_RPC_URL:"https://rpc.walletconnect.org",PULSE_API_URL:"https://pulse.walletconnect.org",W3M_API_URL:"https://api.web3modal.org",CONNECTOR_ID:{WALLET_CONNECT:"walletConnect",INJECTED:"injected",WALLET_STANDARD:"announced",COINBASE:"coinbaseWallet",COINBASE_SDK:"coinbaseWalletSDK",SAFE:"safe",LEDGER:"ledger",OKX:"okx",EIP6963:"eip6963",AUTH:"ID_AUTH"},CONNECTOR_NAMES:{AUTH:"Auth"},AUTH_CONNECTOR_SUPPORTED_CHAINS:["eip155","solana"],LIMITS:{PENDING_TRANSACTIONS:99},CHAIN:{EVM:"eip155",SOLANA:"solana",POLKADOT:"polkadot",BITCOIN:"bip122"}
1,CHAIN_NAME_MAP:{eip155:"EVM Networks",solana:"Solana",polkadot:"Polkadot",bip122:"Bitcoin"},ADAPTER_TYPES:{BITCOIN:"bitcoin",SOLANA:"solana",WAGMI:"wagmi",ETHERS:"ethers",ETHERS5:"ethers5"},USDT_CONTRACT_ADDRESSES:["0xdac17f958d2ee523a2206206994597c13d831ec7","0xc2132d05d31c914a87c6611c10748aeb04b58e8f","0x9702230a8ea53601f5cd2dc00fdbc13d4df4a8c7","0x919C1c267BC06a7039e03fcc2eF738525769109c","0x48065fbBE25f71C9282ddf5e1cD6D6A887483D5e","0x55d398326f99059fF775485246999027B3197955","0xfd086bc7cd5c481dcc9c85ebe478a1c0b69fcbb9"],HTTP_STATUS_CODES:{SERVICE_UNAVAILABLE:503,FORBIDDEN:403},UNSUPPORTED_NETWORK_NAME:"Unknown Network"}},84990:function(e,t,r){"use strict";r.d(t,{E:function(){return p}});var i=r(71096),n=r.n(i),s=r(70939),o=r.n(s),a=r(45721),c=r.n(a),l=r(96961),u=r.n(l);n().extend(c()),n().extend(u());let h={...o(),name:"en-web3-modal",relativeTime:{future:"in %s",past:"%s ago",s:"%d sec",m:"1 min",mm:"%d min",h:"1 hr",hh:"%d hrs",d:"1 d",dd:"%d d",M:"1 mo",MM:"%d mo",y:"1 yr",yy:"%d yr"}},d=["January","February","March","April","May","June","July","August","September","October","November","December"];n().locale("en-web3-modal",h);let p={getMonthNameByIndex:e=>d[e],getYear:(e=new Date().toISOString())=>n()(e).year(),getRelativeDateFromNow:e=>n()(e).locale("en-web3-modal").fromNow(!0),formatDate:(e,t="DD MMM")=>n()(e).format(t)}},2657:function(e,t,r){"use strict";r.d(t,{p:function(){return i}});let i={caipNetworkIdToNumber:e=>e?Number(e.split(":")[1]):void 0,parseEvmChainId(e){return"string"==typeof e?this.caipNetworkIdToNumber(e):e},getNetworksByNamespace:(e,t)=>e?.filter(e=>e.chainNamespace===t)||[],getFirstNetworkByNamespace(e,t){return this.getNetworksByNamespace(e,t)[0]}}},41621:function(e,t,r){"use strict";r.d(t,{C:function(){return f}});var i="[big.js] ",n=i+"Invalid ",s=n+"decimal places",o=n+"rounding mode",a=i+"Division by zero",c={},l=void 0,u=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function h(e,t,r,i){var n=e.c;if(r===l&&(r=e.constructor.RM),0!==r&&1!==r&&2!==r&&3!==r)throw Error(o);if(t<1)i=3===r&&(i||!!n[0])||0===t&&(1===r&&n[0]>=5||2===r&&(n[0]>5||5===n[0]&&(i||n[1]!==l))),n.length=1,i?(e.e=e.e-t+1,n[0]=1):n[0]=e.e=0;else if(t<n.length){if(i=1===r&&n[t]>=5||2===r&&(n[t]>5||5===n[t]&&(i||n[t+1]!==l||1&n[t-1]))||3===r&&(i||!!n[0]),n.length=t,i){for(;++n[--t]>9;)if(n[t]=0,0===t){++e.e,n.unshift(1);break}}for(t=n.length;!n[--t];)n.pop()}return e}function d(e,t,r){var i=e.e,n=e.c.join(""),s=n.length;if(t)n=n.charAt(0)+(s>1?"."+n.slice(1):"")+(i<0?"e":"e+")+i;else if(i<0){for(;++i;)n="0"+n;n="0."+n}else if(i>0){if(++i>s)for(i-=s;i--;)n+="0";else i<s&&(n=n.slice(0,i)+"."+n.slice(i))}else s>1&&(n=n.charAt(0)+"."+n.slice(1));return e.s<0&&r?"-"+n:n}c.abs=function(){var e=new this.constructor(this);return e.s=1,e},c.cmp=function(e){var t,r=this.c,i=(e=new this.constructor(e)).c,n=this.s,s=e.s,o=this.e,a=e.e;if(!r[0]||!i[0])return r[0]?n:i[0]?-s:0;if(n!=s)return n;if(t=n<0,o!=a)return o>a^t?1:-1;for(n=-1,s=(o=r.length)<(a=i.length)?o:a;++n<s;)if(r[n]!=i[n])return r[n]>i[n]^t?1:-1;return o==a?0:o>a^t?1:-1},c.div=function(e){var t=this.constructor,r=this.c,i=(e=new t(e)).c,n=this.s==e.s?1:-1,o=t.DP;if(o!==~~o||o<0||o>1e6)throw Error(s);if(!i[0])throw Error(a);if(!r[0])return e.s=n,e.c=[e.e=0],e;var c,u,d,p,f,g=i.slice(),m=c=i.length,y=r.length,w=r.slice(0,c),b=w.length,v=e,E=v.c=[],_=0,C=o+(v.e=this.e-e.e)+1;for(v.s=n,n=C<0?0:C,g.unshift(0);b++<c;)w.push(0);do{for(d=0;d<10;d++){if(c!=(b=w.length))p=c>b?1:-1;else for(f=-1,p=0;++f<c;)if(i[f]!=w[f]){p=i[f]>w[f]?1:-1;break}if(p<0){for(u=b==c?i:g;b;){if(w[--b]<u[b]){for(f=b;f&&!w[--f];)w[f]=9;--w[f],w[b]+=10}w[b]-=u[b]}for(;!w[0];)w.shift()}else break}E[_++]=p?d:++d,w[0]&&p?w[b]=r[m]||0:w=[r[m]]}while((m++<y||w[0]!==l)&&n--);return!E[0]&&1!=_&&(E.shift(),v.e--,C--),_>C&&h(v,C,t.RM,w[0]!==l),v},c.eq=function(e){return 0===this.cmp(e)},c.gt=function(e){return this.cmp(e)>0},c.gte=function(e){return this.cmp(e)>-1},c.lt=function(e){return 0>this.cmp(e)},c.lte=function(e){return 1>this.cmp(e)},c.minus=c.sub=function(e){var t,r,i,n,s=this.constructor,o=this.s,a=(e=new s(e)).s;if(o!=a)return e.s=-a,this.plus(e);var c=this.c.slice(),l=this.e,u=e.c,h=e.e;if(!c[0]||!u[0])return u[0]?e.s=-a:c[0]?e=new s(this):e.s=1,e;if(o=l-h){for((n=o<0)?(o=-o,i=c):(h=l,i=u),i.reverse(),a=o;a--;)i.push(0);i.reverse()}else for(r=((n=c.length<u.length)?c:u).length,o=a=0;a<r;a++)if(c[a]!=u[a]){n=c[a]<u[a];break}if(n&&(i=c,c=u,u=i,e.s=-e.s),(a=(r=u.length)-(t=c.length))>0)for(;a--;)c[t++]=0;for(a=t;r>o;){if(c[--r]<u[r]){for(t=r;t&&!c[--t];)c[t]=9;--c[t],c[r]+=10}c[r]-=u[r]}for(;0===c[--a];)c.pop();for(;0===c[0];)c.shift(),--h;return c[0]||(e.s=1,c=[h=0]),e.c=c,e.e=h,e},c.mod=function(e){var t,r=this,i=r.constructor,n=r.s,s=(e=new i(e)).s;if(!e.c[0])throw Error(a);return(r.s=e.s=1,t=1==e.cmp(r),r.s=n,e.s=s,t)?new i(r):(n=i.DP,s=i.RM,i.DP=i.RM=0,r=r.div(e),i.DP=n,i.RM=s,this.minus(r.times(e)))},c.neg=function(){var e=new this.constructor(this);return e.s=-e.s,e},c.plus=c.add=function(e){var t,r,i,n=this.constructor;if(e=new n(e),this.s!=e.s)return e.s=-e.s,this.minus(e);var s=this.e,o=this.c,a=e.e,c=e.c;if(!o[0]||!c[0])return c[0]||(o[0]?e=new n(this):e.s=this.s),e;if(o=o.slice(),t=s-a){for(t>0?(a=s,i=c):(t=-t,i=o),i.reverse();t--;)i.push(0);i.reverse()}for(o.length-c.length<0&&(i=c,c=o,o=i),t=c.length,r=0;t;o[t]%=10)r=(o[--t]=o[t]+c[t]+r)/10|0;for(r&&(o.unshift(r),++a),t=o.length;0===o[--t];)o.pop();return e.c=o,e.e=a,e},c.pow=function(e){var t=this,r=new t.constructor("1"),i=r,s=e<0;if(e!==~~e||e<-1e6||e>1e6)throw Error(n+"exponent");for(s&&(e=-e);1&e&&(i=i.times(t)),e>>=1;)t=t.times(t);return s?r.div(i):i},c.prec=function(e,t){if(e!==~~e||e<1||e>1e6)throw Error(n+"precision");return h(new this.constructor(this),e,t)},c.round=function(e,t){if(e===l)e=0;else if(e!==~~e||e<-1e6||e>1e6)throw Error(s);return h(new this.constructor(this),e+this.e+1,t)},c.sqrt=function(){var e,t,r,n=this.constructor,s=this.s,o=this.e,a=new n("0.5");
1if(!this.c[0])return new n(this);if(s<0)throw Error(i+"No square root");0===(s=Math.sqrt(+d(this,!0,!0)))||s===1/0?((t=this.c.join("")).length+o&1||(t+="0"),o=((o+1)/2|0)-(o<0||1&o),e=new n(((s=Math.sqrt(t))==1/0?"5e":(s=s.toExponential()).slice(0,s.indexOf("e")+1))+o)):e=new n(s+""),o=e.e+(n.DP+=4);do r=e,e=a.times(r.plus(this.div(r)));while(r.c.slice(0,o).join("")!==e.c.slice(0,o).join(""));return h(e,(n.DP-=4)+e.e+1,n.RM)},c.times=c.mul=function(e){var t,r=this.constructor,i=this.c,n=(e=new r(e)).c,s=i.length,o=n.length,a=this.e,c=e.e;if(e.s=this.s==e.s?1:-1,!i[0]||!n[0])return e.c=[e.e=0],e;for(e.e=a+c,s<o&&(t=i,i=n,n=t,c=s,s=o,o=c),t=Array(c=s+o);c--;)t[c]=0;for(a=o;a--;){for(o=0,c=s+a;c>a;)o=t[c]+n[a]*i[c-a-1]+o,t[c--]=o%10,o=o/10|0;t[c]=o}for(o?++e.e:t.shift(),a=t.length;!t[--a];)t.pop();return e.c=t,e},c.toExponential=function(e,t){var r=this,i=r.c[0];if(e!==l){if(e!==~~e||e<0||e>1e6)throw Error(s);for(r=h(new r.constructor(r),++e,t);r.c.length<e;)r.c.push(0)}return d(r,!0,!!i)},c.toFixed=function(e,t){var r=this,i=r.c[0];if(e!==l){if(e!==~~e||e<0||e>1e6)throw Error(s);for(r=h(new r.constructor(r),e+r.e+1,t),e=e+r.e+1;r.c.length<e;)r.c.push(0)}return d(r,!1,!!i)},c[Symbol.for("nodejs.util.inspect.custom")]=c.toJSON=c.toString=function(){var e=this.constructor;return d(this,this.e<=e.NE||this.e>=e.PE,!!this.c[0])},c.toNumber=function(){var e=+d(this,!0,!0);if(!0===this.constructor.strict&&!this.eq(e.toString()))throw Error(i+"Imprecise conversion");return e},c.toPrecision=function(e,t){var r=this,i=r.constructor,s=r.c[0];if(e!==l){if(e!==~~e||e<1||e>1e6)throw Error(n+"precision");for(r=h(new i(r),e,t);r.c.length<e;)r.c.push(0)}return d(r,e<=r.e||r.e<=i.NE||r.e>=i.PE,!!s)},c.valueOf=function(){var e=this.constructor;if(!0===e.strict)throw Error(i+"valueOf disallowed");return d(this,this.e<=e.NE||this.e>=e.PE,!0)};var p=function e(){function t(r){if(!(this instanceof t))return r===l?e():new t(r);if(r instanceof t)this.s=r.s,this.e=r.e,this.c=r.c.slice();else{if("string"!=typeof r){if(!0===t.strict&&"bigint"!=typeof r)throw TypeError(n+"value");r=0===r&&1/r<0?"-0":String(r)}!function(e,t){var r,i,s;if(!u.test(t))throw Error(n+"number");for(e.s="-"==t.charAt(0)?(t=t.slice(1),-1):1,(r=t.indexOf("."))>-1&&(t=t.replace(".","")),(i=t.search(/e/i))>0?(r<0&&(r=i),r+=+t.slice(i+1),t=t.substring(0,i)):r<0&&(r=t.length),s=t.length,i=0;i<s&&"0"==t.charAt(i);)++i;if(i==s)e.c=[e.e=0];else{for(;s>0&&"0"==t.charAt(--s););for(e.e=r-i-1,e.c=[],r=0;i<=s;)e.c[r++]=+t.charAt(i++)}}(this,r)}this.constructor=t}return t.prototype=c,t.DP=20,t.RM=1,t.NE=-7,t.PE=21,t.strict=!1,t.roundDown=0,t.roundHalfUp=1,t.roundHalfEven=2,t.roundUp=3,t}();let f={bigNumber:e=>new p(e||0),multiply(e,t){if(void 0===e||void 0===t)return new p(0);let r=new p(e),i=new p(t);return r.times(i)},formatNumberToLocalString:(e,t=2)=>void 0===e?"0.00":"number"==typeof e?e.toLocaleString("en-US",{maximumFractionDigits:t,minimumFractionDigits:t}):parseFloat(e).toLocaleString("en-US",{maximumFractionDigits:t,minimumFractionDigits:t}),parseLocalStringToNumber:e=>void 0===e?0:parseFloat(e.replace(/,/gu,""))}},1125:function(e,t,r){"use strict";r.d(t,{u:function(){return i}});let i={validateCaipAddress(e){if(e.split(":")?.length!==3)throw Error("Invalid CAIP Address");return e},parseCaipAddress(e){let t=e.split(":");if(3!==t.length)throw Error(`Invalid CAIP-10 address: ${e}`);let[r,i,n]=t;if(!r||!i||!n)throw Error(`Invalid CAIP-10 address: ${e}`);return{chainNamespace:r,chainId:i,address:n}},parseCaipNetworkId(e){let t=e.split(":");if(2!==t.length)throw Error(`Invalid CAIP-2 network id: ${e}`);let[r,i]=t;if(!r||!i)throw Error(`Invalid CAIP-2 network id: ${e}`);return{chainNamespace:r,chainId:i}}}},31293:function(e,t,r){"use strict";r.d(t,{$U:function(){return o},Vk:function(){return n},mr:function(){return s},uJ:function(){return i}});let i={WALLET_ID:"@appkit/wallet_id",WALLET_NAME:"@appkit/wallet_name",SOLANA_WALLET:"@appkit/solana_wallet",SOLANA_CAIP_CHAIN:"@appkit/solana_caip_chain",ACTIVE_CAIP_NETWORK_ID:"@appkit/active_caip_network_id",CONNECTED_SOCIAL:"@appkit/connected_social",CONNECTED_SOCIAL_USERNAME:"@appkit-wallet/SOCIAL_USERNAME",RECENT_WALLETS:"@appkit/recent_wallets",DEEPL
1INK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",ACTIVE_NAMESPACE:"@appkit/active_namespace",CONNECTED_NAMESPACES:"@appkit/connected_namespaces",CONNECTION_STATUS:"@appkit/connection_status",SIWX_AUTH_TOKEN:"@appkit/siwx-auth-token",SIWX_NONCE_TOKEN:"@appkit/siwx-nonce-token",TELEGRAM_SOCIAL_PROVIDER:"@appkit/social_provider",NATIVE_BALANCE_CACHE:"@appkit/native_balance_cache",PORTFOLIO_CACHE:"@appkit/portfolio_cache",ENS_CACHE:"@appkit/ens_cache",IDENTITY_CACHE:"@appkit/identity_cache",PREFERRED_ACCOUNT_TYPES:"@appkit/preferred_account_types"};function n(e){if(!e)throw Error("Namespace is required for CONNECTED_CONNECTOR_ID");return`@appkit/${e}:connected_connector_id`}let s={setItem(e,t){o()&&void 0!==t&&localStorage.setItem(e,t)},getItem(e){if(o())return localStorage.getItem(e)||void 0},removeItem(e){o()&&localStorage.removeItem(e)},clear(){o()&&localStorage.clear()}};function o(){return"undefined"!=typeof window&&"undefined"!=typeof localStorage}},40722:function(e,t,r){"use strict";function i(e,t){return"light"===t?{"--w3m-accent":e?.["--w3m-accent"]||"hsla(231, 100%, 70%, 1)","--w3m-background":"#fff"}:{"--w3m-accent":e?.["--w3m-accent"]||"hsla(230, 100%, 67%, 1)","--w3m-background":"#121313"}}r.d(t,{t:function(){return i}})},78008:function(e,t,r){"use strict";r.d(t,{AccountController:function(){return u}});var i=r(31147),n=r(62748),s=r(25779),o=r(29427),a=r(50035),c=r(30649);let l=(0,i.sj)({currentTab:0,tokenBalance:[],smartAccountDeployed:!1,addressLabels:new Map,allAccounts:[]}),u={state:l,replaceState(e){e&&Object.assign(l,(0,i.iH)(e))},subscribe:e=>a.R.subscribeChainProp("accountState",t=>{if(t)return e(t)}),subscribeKey(e,t,r){let i;return a.R.subscribeChainProp("accountState",r=>{if(r){let n=r[e];i!==n&&(i=n,t(n))}},r)},setStatus(e,t){a.R.setAccountProp("status",e,t)},getCaipAddress:e=>a.R.getAccountProp("caipAddress",e),setCaipAddress(e,t){let r=e?s.j.getPlainAddress(e):void 0;t===a.R.state.activeChain&&(a.R.state.activeCaipAddress=e),a.R.setAccountProp("caipAddress",e,t),a.R.setAccountProp("address",r,t)},setBalance(e,t,r){a.R.setAccountProp("balance",e,r),a.R.setAccountProp("balanceSymbol",t,r)},setProfileName(e,t){a.R.setAccountProp("profileName",e,t)},setProfileImage(e,t){a.R.setAccountProp("profileImage",e,t)},setUser(e,t){a.R.setAccountProp("user",e,t)},setAddressExplorerUrl(e,t){a.R.setAccountProp("addressExplorerUrl",e,t)},setSmartAccountDeployed(e,t){a.R.setAccountProp("smartAccountDeployed",e,t)},setCurrentTab(e){a.R.setAccountProp("currentTab",e,a.R.state.activeChain)},setTokenBalance(e,t){e&&a.R.setAccountProp("tokenBalance",e,t)},setShouldUpdateToAddress(e,t){a.R.setAccountProp("shouldUpdateToAddress",e,t)},setAllAccounts(e,t){a.R.setAccountProp("allAccounts",e,t)},addAddressLabel(e,t,r){let i=a.R.getAccountProp("addressLabels",r)||new Map;i.set(e,t),a.R.setAccountProp("addressLabels",i,r)},removeAddressLabel(e,t){let r=a.R.getAccountProp("addressLabels",t)||new Map;r.delete(e),a.R.setAccountProp("addressLabels",r,t)},setConnectedWalletInfo(e,t){a.R.setAccountProp("connectedWalletInfo",e,t,!1)},setPreferredAccountType(e,t){a.R.setAccountProp("preferredAccountTypes",{...l.preferredAccountTypes,[t]:e},t)},setPreferredAccountTypes(e){l.preferredAccountTypes=e},setSocialProvider(e,t){e&&a.R.setAccountProp("socialProvider",e,t)},setSocialWindow(e,t){a.R.setAccountProp("socialWindow",e?(0,i.iH)(e):void 0,t)},setFarcasterUrl(e,t){a.R.setAccountProp("farcasterUrl",e,t)},async fetchTokenBalance(e){l.balanceLoading=!0;let t=a.R.state.activeCaipNetwork?.caipNetworkId,r=a.R.state.activeCaipNetwork?.chainNamespace,i=a.R.state.activeCaipAddress,u=i?s.j.getPlainAddress(i):void 0;if(l.lastRetry&&!s.j.isAllowedRetry(l.lastRetry,30*n.bq.ONE_SEC_MS))return l.balanceLoading=!1,[];try{if(u&&t&&r){let e=(await o.L.getBalance(u,t)).balances.filter(e=>"0"!==e.quantity.decimals);return this.setTokenBalance(e,r),l.lastRetry=void 0,l.balanceLoading=!1,e}}catch(t){l.lastRetry=Date.now(),e?.(t),c.SnackController.showError("Token Balance Unavailable")}finally{l.balanceLoading=!1}return[]},resetAccount(e){a.R.resetAccount(e)}}},38431:function(e,t,r){"use strict";r.d(t,{AlertController:function(){return a}});var i=r(31147),n=r(54322),s=r(68619);let o=(0,i.sj)({message:"",variant:"info",open:!1}),a={state:o,subscribeKey:(e,t)=>(0,n.VW)(o,e,t),open(e,t){let{debug:r}=s.OptionsController.state,{shortMessage:i,longMessage:n}=e;
1r&&(o.message=i,o.variant=t,o.open=!0),n&&console.error("function"==typeof n?n():n)},close(){o.open=!1,o.message="",o.variant="info"}}},44129:function(e,t,r){"use strict";r.d(t,{ApiController:function(){return w}});var i=r(31147),n=r(54322),s=r(79193),o=r(25779),a=r(1607),c=r(84140),l=r(46065),u=r(50035),h=r(1471),d=r(43122),p=r(68619);let f=["1ca0bdd4747578705b1939af023d120677c64fe6ca76add81fda36e350605e79","fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa","a797aa35c0fadbfc1a53e7f675162ed5226968b44a19ee3d24385c64d1d3c393"],g=o.j.getApiUrl(),m=new a.V({baseUrl:g,clientId:null}),y=(0,i.sj)({promises:{},page:1,count:0,featured:[],allFeatured:[],recommended:[],allRecommended:[],wallets:[],search:[],isAnalyticsEnabled:!1,excludedWallets:[],isFetchingRecommendedWallets:!1}),w={state:y,subscribeKey:(e,t)=>(0,n.VW)(y,e,t),_getSdkProperties(){let{projectId:e,sdkType:t,sdkVersion:r}=p.OptionsController.state;return{projectId:e,st:t||"appkit",sv:r||"html-wagmi-4.2.2"}},_filterOutExtensions:e=>p.OptionsController.state.isUniversalProvider?e.filter(e=>!!(e.mobile_link||e.desktop_link||e.webapp_link)):e,async _fetchWalletImage(e){let t=`${m.baseUrl}/getWalletImage/${e}`,r=await m.getBlob({path:t,params:w._getSdkProperties()});l.W.setWalletImage(e,URL.createObjectURL(r))},async _fetchNetworkImage(e){let t=`${m.baseUrl}/public/getAssetImage/${e}`,r=await m.getBlob({path:t,params:w._getSdkProperties()});l.W.setNetworkImage(e,URL.createObjectURL(r))},async _fetchConnectorImage(e){let t=`${m.baseUrl}/public/getAssetImage/${e}`,r=await m.getBlob({path:t,params:w._getSdkProperties()});l.W.setConnectorImage(e,URL.createObjectURL(r))},async _fetchCurrencyImage(e){let t=`${m.baseUrl}/public/getCurrencyImage/${e}`,r=await m.getBlob({path:t,params:w._getSdkProperties()});l.W.setCurrencyImage(e,URL.createObjectURL(r))},async _fetchTokenImage(e){let t=`${m.baseUrl}/public/getTokenImage/${e}`,r=await m.getBlob({path:t,params:w._getSdkProperties()});l.W.setTokenImage(e,URL.createObjectURL(r))},async fetchNetworkImages(){let e=u.R.getAllRequestedCaipNetworks(),t=e?.map(({assets:e})=>e?.imageId).filter(Boolean).filter(e=>!s.f.getNetworkImageById(e));t&&await Promise.allSettled(t.map(e=>w._fetchNetworkImage(e)))},async fetchConnectorImages(){let{connectors:e}=h.ConnectorController.state,t=e.map(({imageId:e})=>
1e).filter(Boolean);await Promise.allSettled(t.map(e=>w._fetchConnectorImage(e)))},async fetchCurrencyImages(e=[]){await Promise.allSettled(e.map(e=>w._fetchCurrencyImage(e)))},async fetchTokenImages(e=[]){await Promise.allSettled(e.map(e=>w._fetchTokenImage(e)))},async fetchWallets(e){let t=e.exclude??[];return w._getSdkProperties().sv.startsWith("html-core-")&&t.push(...f),await m.get({path:"/getWallets",params:{...w._getSdkProperties(),...e,page:String(e.page),entries:String(e.entries),include:e.include?.join(","),exclude:e.exclude?.join(",")}})},async fetchFeaturedWallets(){let{featuredWalletIds:e}=p.OptionsController.state;if(e?.length){let t={...w._getSdkProperties(),page:1,entries:e?.length??4,include:e},{data:r}=await w.fetchWallets(t);r.sort((t,r)=>e.indexOf(t.id)-e.indexOf(r.id));let i=r.map(e=>e.image_id).filter(Boolean);await Promise.allSettled(i.map(e=>w._fetchWalletImage(e))),y.featured=r,y.allFeatured=r}},async fetchRecommendedWallets(){try{y.isFetchingRecommendedWallets=!0;let{includeWalletIds:e,excludeWalletIds:t,featuredWalletIds:r}=p.OptionsController.state,i=[...t??[],...r??[]].filter(Boolean),n=u.R.getRequestedCaipNetworkIds().join(","),{data:s,count:o}=await w.fetchWallets({page:1,entries:4,include:e,exclude:i,chains:n}),a=c.M.getRecentWallets(),l=s.map(e=>e.image_id).filter(Boolean),h=a.map(e=>e.image_id).filter(Boolean);await Promise.allSettled([...l,...h].map(e=>w._fetchWalletImage(e))),y.recommended=s,y.allRecommended=s,y.count=o??0}catch{}finally{y.isFetchingRecommendedWallets=!1}},async fetchWalletsByPage({page:e}){let{includeWalletIds:t,excludeWalletIds:r,featuredWalletIds:i}=p.OptionsController.state,n=u.R.getRequestedCaipNetworkIds().join(","),s=[...y.recommended.map(({id:e})=>e),...r??[],...i??[]].filter(Boolean),{data:a,count:c}=await w.fetchWallets({page:e,entries:40,include:t,exclude:s,chains:n}),l=a.slice(0,20).map(e=>e.image_id).filter(Boolean);await Promise.allSettled(l.map(e=>w._fetchWalletImage(e))),y.wallets=o.j.uniqueBy([...y.wallets,...w._filterOutExtensions(a)],"id"),y.count=c>y.count?c:y.count,y.page=e},async initializeExcludedWallets({ids:e}){let t=u.R.getRequestedCaipNetworkIds().join(","),r={page:1,entries:e.length,include:e,chains:t},{data:i}=await w.fetchWallets(r);i&&i.forEach(e=>{y.excludedWallets.push({rdns:e.rdns,name:e.name})})},async searchWallet({search:e,badge:t}){let{includeWalletIds:r,excludeWalletIds:i}=p.OptionsController.state,n=u.R.getRequestedCaipNetworkIds().join(",");y.search=[];let s={page:1,entries:100,search:e?.trim(),badge_type:t,include:r,exclude:i,chains:n},{data:a}=await w.fetchWallets(s);d.X.sendEvent({type:"track",event:"SEARCH_WALLET",properties:{badge:t??"",search:e??""}});let c=a.map(e=>e.image_id).filter(Boolean);await Promise.allSettled([...c.map(e=>w._fetchWalletImage(e)),o.j.wait(300)]),y.search=w._filterOutExtensions(a)},initPromise:(e,t)=>y.promises[e]||(y.promises[e]=t()),prefetch:({fetchConnectorImages:e=!0,fetchFeaturedWallets:t=!0,fetchRecommendedWallets:r=!0,fetchNetworkImages:i=!0}={})=>Promise.allSettled([e&&w.initPromise("connectorImages",w.fetchConnectorImages),t&&w.initPromise("featuredWallets",w.fetchFeaturedWallets),r&&w.initPromise("recommendedWallets",w.fetchRecommendedWallets),i&&w.initPromise("networkImages",w.fetchNetworkImages)].filter(Boolean)),prefetchAnalyticsConfig(){p.OptionsController.state.features?.anal
1ytics&&w.fetchAnalyticsConfig()},async fetchAnalyticsConfig(){try{let{isAnalyticsEnabled:e}=await m.get({path:"/getAnalyticsConfig",params:w._getSdkProperties()});p.OptionsController.setFeatures({analytics:e})}catch(e){p.OptionsController.setFeatures({analytics:!1})}},setFilterByNamespace(e){if(!e){y.featured=y.allFeatured,y.recommended=y.allRecommended;return}let t=u.R.getRequestedCaipNetworkIds().join(",");y.featured=y.allFeatured.filter(e=>e.chains?.some(e=>t.includes(e))),y.recommended=y.allRecommended.filter(e=>e.chains?.some(e=>t.includes(e)))}}},46065:function(e,t,r){"use strict";r.d(t,{W:function(){return o}});var i=r(31147),n=r(54322);let s=(0,i.sj)({walletImages:{},networkImages:{},chainImages:{},connectorImages:{},tokenImages:{},currencyImages:{}}),o={state:s,subscribeNetworkImages:e=>(0,i.Ld)(s.networkImages,()=>e(s.networkImages)),subscribeKey:(e,t)=>(0,n.VW)(s,e,t),subscribe:e=>(0,i.Ld)(s,()=>e(s)),setWalletImage(e,t){s.walletImages[e]=t},setNetworkImage(e,t){s.networkImages[e]=t},setChainImage(e,t){s.chainImages[e]=t},setConnectorImage(e,t){s.connectorImages={...s.connectorImages,[e]:t}},setTokenImage(e,t){s.tokenImages[e]=t},setCurrencyImage(e,t){s.currencyImages[e]=t}}},29427:function(e,t,r){"use strict";r.d(t,{L:function(){return g}});var i=r(31147),n=r(62748),s=r(25779),o=r(1607),a=r(84140),c=r(78008),l=r(50035),u=r(68619),h=r(30649);let d={purchaseCurrencies:[{id:"2b92315d-eab7-5bef-84fa-089a131333f5",name:"USD Coin",symbol:"USDC",networks:[{name:"ethereum-mainnet",display_name:"Ethereum",chain_id:"1",contract_address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{name:"polygon-mainnet",display_name:"Polygon",chain_id:"137",contract_address:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"}]},{id:"2b92315d-eab7-5bef-84fa-089a131333f5",name:"Ether",symbol:"ETH",networks:[{name:"ethereum-mainnet",display_name:"Ethereum",chain_id:"1",contract_address:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48"},{name:"polygon-mainnet",display_name:"Polygon",chain_id:"137",contract_address:"0x2791Bca1f2de4661ED88A30C99A7a9449Aa84174"}]}],paymentCurrencies:[{id:"USD",payment_method_limits:[{id:"card",min:"10.00",max:"7500.00"},{id:"ach_bank_account",min:"10.00",max:"25000.00"}]},{id:"EUR",payment_method_limits:[{id:"card",min:"10.00",max:"7500.00"},{id:"ach_bank_account",min:"10.00",max:"25000.00"}]}]},p=s.j.getBlockchainApiUrl(),f=(0,i.sj)({clientId:null,api:new o.V({baseUrl:p,clientId:null}),supportedChains:{http:[],ws:[]}}),g={state:f,async get(e){let{st:t,sv:r}=g.getSdkProperties(),i=u.OptionsController.state.projectId,n={...e.params||{},st:t,sv:r,projectId:i};return f.api.get({...e,params:n})},getSdkProperties(){let{sdkType:e,sdkVersion:t}=u.OptionsController.state;return{st:e||"unknown",sv:t||"unknown"}},async isNetworkSupported(e){if(!e)return!1;try{f.supportedChains.http.length||await g.getSupportedNetworks()}catch(e){return!1}return f.supportedChains.http.includes(e)},async getSupportedNetworks(){let e=await g.get({path:"v1/supported-chains"});return f.supportedChains=e,e},async fetchIdentity({address:e,caipNetworkId:t}){if(!await g.isNetworkSupported(t))return{avatar:"",name:""};let r=a.M.getIdentityFromCacheForAddress(e);if(r)return r;let i=await g.get({path:`/v1/identity/${e}`,params:{sender:l.R.state.activeCaipAddress?s.j.getPlainAddress(l.R.state.activeCaipAddress):void 0}});return a.M.updateIdentityCache({address:e,identity:i,timestamp:Date.now()}),i},fetchTransactions:async({account:e,cursor:t,onramp:r,signal:i,cache:n,chainId:s})=>await g.isNetworkSupported(l.R.state.activeCaipNetwork?.caipNetworkId)?g.get({path:`/v1/account/${e}/history`,params:{cursor:t,onramp:r,chainId:s},signal:i,cache:n}):{data:[],next:void 0},fetchSwapQuote:async({amount:e,userAddress:t,from:r,to:i,gasPrice:n})=>await g.isNetworkSupported(l.R.state.activeCaipNetwork?.caipNetworkId)?g.get({path:"/v1/convert/quotes",headers:{"Content-Type":"application/json"},params:{amount:e,userAddress:t,from:r,to:i,gasPrice:n}}):{quotes:[]},fetchSwapTokens:async({chainId:e})=>await g.isNetworkSupported(l.R.state.activeCaipNetwork?.caipNetworkId)?g.get({path:"/v1/convert/tokens",params:{chainId:e}}):{tokens:[]},fetchTokenPrice:async({addresses:e})=>await g.isNetworkSupported(l.R.state.activeCaipNetwork?.caipNetworkId)?f.api.post({path:"/v1/fungible/price",body:{currency:"usd",addresses:e,projectId:u.OptionsController.state.projectId},headers:{"Content-Type":"application/json"}}):{fungibles:[]},fetchSwapAllowance:async({tokenAddress:e,userAddress:t})=>await g.isNetworkSupported(l.R.state.activeCaipNetwork?.caipNetworkId)?g.get({path:"/v1/convert/allowance",params:{tokenAddress:e,userAddress:t},headers:{"Content-Type":"application/json"}}):{allowance:"0"},async fetchGasPrice({chainId:e}){let{st:t,sv:r}=g.getSdkProperties();if(!await g.isNetworkSupported(l.R.state.activeCaipNetwork?.caipNetworkId))throw Error("Network not supported for Gas Price");return g.get({path:"/v1/convert/gas-price",headers:{"Content-Type":"application/json"},params:{chainId:e,st:t,sv:r}})},async generateSwapCalldata({amount:e,from:t,to:r,userAddress:i,disableEstimate:s}){if(!await g.isNetworkSupported(l.R.state.activeCaipNetwork?.caipNetworkId))throw Error("Network not supported for Swaps");return f.api.post({path:"/v1/convert/build-transaction",headers:{"Content-Type":"application/json"},body:{amount:e,eip155:{slippage:n.bq.CONVERT_SLIPPAGE_TOLERANCE},projectId:u.OptionsController.state.projectId,from:t,to:r,userAddress:i,disableEstimate:s}})},async generateApproveCalldata({from:e,to:t,userAddress:r}){let{st:i,sv:n}=g.getSdkProperties();if(!await g.isNetworkSupported(l.R.state.activeCaipNetwork?.caipNetworkId))throw Error("Network not supported for Swaps");return g.get({path:"/v1/convert/build-approve",headers:{"Content-Type":"application/json"}
1,params:{userAddress:r,from:e,to:t,st:i,sv:n}})},async getBalance(e,t,r){let{st:i,sv:n}=g.getSdkProperties();if(!await g.isNetworkSupported(l.R.state.activeCaipNetwork?.caipNetworkId))return h.SnackController.showError("Token Balance Unavailable"),{balances:[]};let s=`${t}:${e}`,o=a.M.getBalanceCacheForCaipAddress(s);if(o)return o;let c=await g.get({path:`/v1/account/${e}/balance`,params:{currency:"usd",chainId:t,forceUpdate:r,st:i,sv:n}});return a.M.updateBalanceCache({caipAddress:s,balance:c,timestamp:Date.now()}),c},lookupEnsName:async e=>await g.isNetworkSupported(l.R.state.activeCaipNetwork?.caipNetworkId)?g.get({path:`/v1/profile/account/${e}`,params:{apiVersion:"2"}}):{addresses:{},attributes:[]},reverseLookupEnsName:async({address:e})=>await g.isNetworkSupported(l.R.state.activeCaipNetwork?.caipNetworkId)?g.get({path:`/v1/profile/reverse/${e}`,params:{sender:c.AccountController.state.address,apiVersion:"2"}}):[],getEnsNameSuggestions:async e=>await g.isNetworkSupported(l.R.state.activeCaipNetwork?.caipNetworkId)?g.get({path:`/v1/profile/suggestions/${e}`,params:{zone:"reown.id"}}):{suggestions:[]},registerEnsName:async({coinType:e,address:t,message:r,signature:i})=>await g.isNetworkSupported(l.R.state.activeCaipNetwork?.caipNetworkId)?f.api.post({path:"/v1/profile/account",body:{coin_type:e,address:t,message:r,signature:i},headers:{"Content-Type":"application/json"}}):{success:!1},generateOnRampURL:async({destinationWallets:e,partnerUserId:t,defaultNetwork:r,purchaseAmount:i,paymentAmount:n})=>await g.isNetworkSupported(l.R.state.activeCaipNetwork?.caipNetworkId)?(await f.api.post({path:"/v1/generators/onrampurl",params:{projectId:u.OptionsController.state.projectId},body:{destinationWallets:e,defaultNetwork:r,partnerUserId:t,defaultExperience:"buy",presetCryptoAmount:i,presetFiatAmount:n}})).url:"",async getOnrampOptions(){if(!await g.isNetworkSupported(l.R.state.activeCaipNetwork?.caipNetworkId))return{paymentCurrencies:[],purchaseCurrencies:[]};try{return await g.get({path:"/v1/onramp/options"})}catch(e){return d}},async getOnrampQuote({purchaseCurrency:e,paymentCurrency:t,amount:r,network:i}){try{if(!await g.isNetworkSupported(l.R.state.activeCaipNetwork?.caipNetworkId))return null;return await f.api.post({path:"/v1/onramp/quote",params:{projectId:u.OptionsController.state.projectId},body:{purchaseCurrency:e,paymentCurrency:t,amount:r,network:i}})}catch(e){return{coinbaseFee:{amount:r,currency:t.id},networkFee:{amount:r,currency:t.id},paymentSubtotal:{amount:r,currency:t.id},paymentTotal:{amount:r,currency:t.id},purchaseAmount:{amount:r,currency:t.id},quoteId:"mocked-quote-id"}}},getSmartSessions:async e=>await g.isNetworkSupported(l.R.state.activeCaipNetwork?.caipNetworkId)?g.get({path:`/v1/sessions/${e}`}):[],revokeSmartSession:async(e,t,r)=>await g.isNetworkSupported(l.R.state.activeCaipNetwork?.caipNetworkId)?f.api.post({path:`/v1/sessions/${e}/revoke`,params:{projectId:u.OptionsController.state.projectId},body:{pci:t,signature:r}}):{success:!1},setClientId(e){f.clientId=e,f.api=new o.V({baseUrl:p,clientId:e})}}},50035:function(e,t,r){"use strict";r.d(t,{R:function(){return C}});var i=r(31147),n=r(54322),s=r(2657),o=r(72647),a=r(1471);function c(e,t){return a.ConnectorController.getConnectorId(e)===t}var l=r(62748),u=r(25779),h=r(84140),d=r(78008),p=r(56941),f=r(43122),g=r(31242),m=r(68619),y=r(4197),w=r(97040),b=r(22364);let v={currentTab:0,tokenBalance:[],smartAccountDeployed:!1,addressLabels:new Map,allAccounts:[],user:void 0},E={caipNetwork:void 0,supportsAllNetworks:!0,smartAccountEnabledNetworks:[]},_=(0,i.sj)({chains:(0,n.Yr)(),activeCaipAddress:void 0,activeChain:void 0,activeCaipNetwork:void 0,noAdapters:!1,universalAdapter:{networkControllerClient:void 0,connectionControllerClient:void 0},isSwitchingNamespace:!1}),C={state:_,subscribe:e=>(0,i.Ld)(_,()=>{e(_)}),subscribeKey:(e,t)=>(0,n.VW)(_,e,t),subscribeChainProp(e,t,r){let n;return(0,i.Ld)(_.chains,()=>{let i=r||_.activeChain;if(i){let r=_.chains.get(i)?.[e];n!==r&&(n=r,t(r))}})},initialize(e,t,r){let{chainId:n,namespace:s}=h.M.getActiveNetworkProps(),o=t?.find(e=>e.id.toString()===n?.toString()),a=e.find(e=>e?.namespace===s)||e?.[0],c=new Set([...t?.map(e=>e.chainNamespace)??[]]);e?.length!==0&&a||(_.noAdapters=!0),!_.noAdapters&&(_.activeChain=a?.namespace,_.activeCaipNetwork=o,this.setChainNetworkData(a?.n
1amespace,{caipNetwork:o}),_.activeChain&&y.I.set({activeChain:a?.namespace})),c.forEach(e=>{let n=t?.filter(t=>t.chainNamespace===e);C.state.chains.set(e,{namespace:e,networkState:(0,i.sj)({...E,caipNetwork:n?.[0]}),accountState:(0,i.sj)(v),caipNetworks:n??[],...r}),this.setRequestedCaipNetworks(n??[],e)})},removeAdapter(e){if(_.activeChain===e){let t=Array.from(_.chains.entries()).find(([t])=>t!==e);if(t){let e=t[1]?.caipNetworks?.[0];e&&this.setActiveCaipNetwork(e)}}_.chains.delete(e)},addAdapter(e,{networkControllerClient:t,connectionControllerClient:r},i){_.chains.set(e.namespace,{namespace:e.namespace,networkState:{...E,caipNetwork:i[0]},accountState:v,caipNetworks:i,connectionControllerClient:r,networkControllerClient:t}),this.setRequestedCaipNetworks(i?.filter(t=>t.chainNamespace===e.namespace)??[],e.namespace)},addNetwork(e){let t=_.chains.get(e.chainNamespace);if(t){let r=[...t.caipNetworks||[]];t.caipNetworks?.find(t=>t.id===e.id)||r.push(e),_.chains.set(e.chainNamespace,{...t,caipNetworks:r}),this.setRequestedCaipNetworks(r,e.chainNamespace)}},removeNetwork(e,t){let r=_.chains.get(e);if(r){let i=_.activeCaipNetwork?.id===t,n=[...r.caipNetworks?.filter(e=>e.id!==t)||[]];i&&r?.caipNetworks?.[0]&&this.setActiveCaipNetwork(r.caipNetworks[0]),_.chains.set(e,{...r,caipNetworks:n}),this.setRequestedCaipNetworks(n||[],e)}},setAdapterNetworkState(e,t){let r=_.chains.get(e);r&&(r.networkState={...r.networkState||E,...t},_.chains.set(e,r))},setChainAccountData(e,t,r=!0){if(!e)throw Error("Chain is required to update chain account data");let i=_.chains.get(e);if(i){let r={...i.accountState||v,...t};_.chains.set(e,{...i,accountState:r}),(1===_.chains.size||_.activeChain===e)&&(t.caipAddress&&(_.activeCaipAddress=t.caipAddress),d.AccountController.replaceState(r))}},setChainNetworkData(e,t){if(!e)return;let r=_.chains.get(e);if(r){let i={...r.networkState||E,...t};_.chains.set(e,{...r,networkState:i})}},setAccountProp(e,t,r,i=!0){this.setChainAccountData(r,{[e]:t},i),"status"===e&&"disconnected"===t&&r&&a.ConnectorController.removeConnectorId(r)},setActiveNamespace(e){_.activeChain=e;let t=e?_.chains.get(e):void 0,r=t?.networkState?.caipNetwork;r?.id&&e&&(_.activeCaipAddress=t?.accountState?.caipAddress,_.activeCaipNetwork=r,this.setChainNetworkData(e,{caipNetwork:r}),h.M.setActiveCaipNetworkId(r?.caipNetworkId),y.I.set({activeChain:e,selectedNetworkId:r?.caipNetworkId}))},setActiveCaipNetwork(e){if(!e)return;_.activeChain!==e.chainNamespace&&this.setIsSwitchingNamespace(!0);let t=_.chains.get(e.chainNamespace);_.activeChain=e.chainNamespace,_.activeCaipNetwork=e,this.setChainNetworkData(e.chainNamespace,{caipNetwork:e}),t?.accountState?.address?_.activeCaipAddress=`${e.chainNamespace}:${e.id}:${t?.accountState?.address}`:_.activeCaipAddress=void 0,this.setAccountProp("caipAddress",_.activeCaipAddress,e.chainNamespace),t&&d.AccountController.replaceState(t.accountState),b.S.resetSend(),y.I.set({activeChain:_.activeChain,selectedNetworkId:_.activeCaipNetwork?.caipNetworkId}),h.M.setActiveCaipNetworkId(e.caipNetworkId),this.checkIfSupportedNetwork(e.chainNamespace)||!m.OptionsController.state.enableNetworkSwitch||m.OptionsController.state.allowUnsupportedChain||p.ConnectionController.state.wcBasic||this.showUnsupportedChainUI()},addCaipNetwork(e){if(!e)return;let t=_.chains.get(e.chainNamespace);t&&t?.caipNetworks?.push(e)},async switchActiveNamespace(e){if(!e)return;let t=e!==C.state.activeChain,r=C.getNetworkData(e)?.caipNetwork,i=C.getCaipNetworkByNamespace(e,r?.id);t&&i&&await C.switchActiveNetwork(i)},async switchActiveNetwork(e){let t=C.state.chains.get(C.state.activeChain);t?.caipNetworks?.some(e=>e.id===_.activeCaipNetwork?.id)||w.RouterController.goBack();let r=this.getNetworkControllerClient(e.chainNamespace);r&&(await r.switchCaipNetwork(e),f.X.sendEvent({type:"track",event:"SWITCH_NETWORK",properties:{network:e.caipNetworkId}}))},getNetworkControllerClient(e){let t=e||_.activeChain,r=_.chains.get(t);if(!r)throw Error("Chain adapter not found");if(!r.networkControllerClient)throw Error("NetworkController client not set");return r.networkControllerClient},getConnectionControllerClient(e){let t=e||_.activeChain;if(!t)throw Error("Chain is required to get connection controller client");let r=_.chains.get(t);if(!r?.connectionControllerClient)throw Error("ConnectionController client not set");return r.connectionControllerClient},getAccountProp(e,t){let r=_.activeChain;if(t&&(r=t),!r)return;let i=_.chains.get(r)?.accountState;if(i)return i[e]},getNetworkProp(e,t){let r=_.chains.get(t)?.networkState;if(r)return r[e]},getRequestedCaipNetworks(e){let t=_.chains.get(e),{approvedCaipNetworkIds:r=[],requestedCaipNetworks:i=[]}=t?.networkState||{};return u.j.sortRequestedNetworks(r,i)},getAllRequestedCaipNetworks(){let e=[];return _.chains.forEach(t=>{let r=this.getRequestedCaipNetworks(t.namespace);e.push(...r)}),e},setRequestedCaipNetworks(e,t){this.setAdapterNetworkState(t,{requestedCaipNetworks:e})},getAllApprovedCaipNetworkIds(){let e=[];return _.chains.forEach(t=>{let r=this.getApprovedCaipNetworkIds(t.namespace);e.push(...r)}),e},getActiveCaipNetwork:()=>_.activeCaipNetwork,getActiveCaipAddress:()=>_.activeCaipAddress,getApprovedCaipNetworkIds(e){let t=_.chains.get(e);return t?.networkState?.approvedCaipNetworkIds||[]},async setApprovedCaipNetworksData(e){let t=this.getNetworkControllerClient(),r=await t?.getApprovedCaipNetworksData();this.setAdapterNetworkState(e,{approvedCaipNetworkIds:r?.approvedCaipNetworkIds,supportsAllNetworks:r?.supportsAllNetworks})},checkIfSupportedNetwork(e,t){let r=t||_.activeCaipNetwork,i=this.getRequestedCaipNetworks(e);return!i.length||i?.some(e=>e.id===r?.id)},checkIfSupportedChainId(e){if(!_.activeChain)return!0;let t=this.getRequestedCaipNetworks(_.activeChain);return t?.some(t=>t.id===e)},setSmartAccountEnabledNetworks(e,t){this.setAdapterNetworkState(t,{smartAccountEnabledNetworks:e})},checkIfSmartAccountEnabled(){let e=s.p.caipNetworkIdToNumber(_.activeCaipNetwork?.caipNetworkId),t=_.activeChain;if(!t||!e)return!1;let r=this.getNetworkProp("smartAccountEnabledNetworks",t);return!!r?.includes(Number(e))},getActiveNetworkTokenAddress(){let e=_.activeCaipNetwork?.chainNamespace||"eip155",t=_.activeCaipNetwork?.id||1,r=l.bq.NATIVE_TOKEN_ADDRESS[e];return`${e}:${t}:${r}`},showUnsupportedChainUI(){g.I.open({view:"UnsupportedChain"})},checkIfNamesSupported(){let e=_.activeCaipNetwork;return!!(e?.chainNamespace&&l.bq.NAMES_SUPPORTED_CHAIN_NAMESPACES.includes(e.chainNamespace))},resetNetwork(e){this.setAdapterNetworkState(e,{approvedCaipNetworkIds:void 0,supportsAllNetworks:!0,smartAccountEnabledNetworks:[]})},resetAccount(e){if(!e)throw Error("Chain is required to set account prop");_.activeCaipAddress=void 0,this.setChainAccountData(e,{smartAccountDeployed:!1,currentTab:0,caipAddress:void 0,address:void 0,balance:void 0,balanceSymbol
1:void 0,profileName:void 0,profileImage:void 0,addressExplorerUrl:void 0,tokenBalance:[],connectedWalletInfo:void 0,preferredAccountTypes:void 0,socialProvider:void 0,socialWindow:void 0,farcasterUrl:void 0,allAccounts:[],user:void 0,status:"disconnected"}),a.ConnectorController.removeConnectorId(e)},async disconnect(e){let t=function(e){let t=Array.from(C.state.chains.keys()),r=[];return e?(r.push([e,C.state.chains.get(e)]),c(e,o.b.CONNECTOR_ID.WALLET_CONNECT)?t.forEach(t=>{t!==e&&c(t,o.b.CONNECTOR_ID.WALLET_CONNECT)&&r.push([t,C.state.chains.get(t)])}):c(e,o.b.CONNECTOR_ID.AUTH)&&t.forEach(t=>{t!==e&&c(t,o.b.CONNECTOR_ID.AUTH)&&r.push([t,C.state.chains.get(t)])})):r=Array.from(C.state.chains.entries()),r}(e);try{b.S.resetSend();let r=await Promise.allSettled(t.map(async([e,t])=>{try{let{caipAddress:r}=this.getAccountData(e)||{};r&&t.connectionControllerClient?.disconnect&&await t.connectionControllerClient.disconnect(e),this.resetAccount(e),this.resetNetwork(e)}catch(t){throw Error(`Failed to disconnect chain ${e}: ${t.message}`)}}));p.ConnectionController.resetWcConnection();let i=r.filter(e=>"rejected"===e.status);if(i.length>0)throw Error(i.map(e=>e.reason.message).join(", "));h.M.deleteConnectedSocialProvider(),e?a.ConnectorController.removeConnectorId(e):a.ConnectorController.resetConnectorIds(),f.X.sendEvent({type:"track",event:"DISCONNECT_SUCCESS",properties:{namespace:e||"all"}})}catch(e){console.error(e.message||"Failed to disconnect chains"),f.X.sendEvent({type:"track",event:"DISCONNECT_ERROR",properties:{message:e.message||"Failed to disconnect chains"}})}},setIsSwitchingNamespace(e){_.isSwitchingNamespace=e},getFirstCaipNetworkSupportsAuthConnector(){let e=[];
1if(_.chains.forEach(t=>{o.b.AUTH_CONNECTOR_SUPPORTED_CHAINS.find(e=>e===t.namespace)&&t.namespace&&e.push(t.namespace)}),e.length>0){let t=e[0];return t?_.chains.get(t)?.caipNetworks?.[0]:void 0}},getAccountData:e=>e?C.state.chains.get(e)?.accountState:d.AccountController.state,getNetworkData(e){let t=e||_.activeChain;if(t)return C.state.chains.get(t)?.networkState},getCaipNetworkByNamespace(e,t){if(!e)return;let r=C.state.chains.get(e);return r?.caipNetworks?.find(e=>e.id===t)||r?.networkState?.caipNetwork||r?.caipNetworks?.[0]},getRequestedCaipNetworkIds(){let e=a.ConnectorController.state.filterByNamespace;return(e?[_.chains.get(e)]:Array.from(_.chains.values())).flatMap(e=>e?.caipNetworks||[]).map(e=>e.caipNetworkId)},getCaipNetworks:e=>e?C.getRequestedCaipNetworks(e):C.getAllRequestedCaipNetworks()}},56941:function(e,t,r){"use strict";let i;r.d(t,{ConnectionController:function(){return y}});var n=r(31147),s=r(54322),o=r(25779),a=r(9331),c=r(84140),l=r(78008),u=r(50035),h=r(1471),d=r(43122),p=r(31242),f=r(97040),g=r(5227);let m=(0,n.sj)({wcError:!1,buffering:!1,status:"disconnected"}),y={state:m,subscribeKey:(e,t)=>(0,s.VW)(m,e,t),_getClient:()=>m._client,setClient(e){m._client=(0,n.iH)(e)},async connectWalletConnect(){if(o.j.isTelegram()||o.j.isSafari()&&o.j.isIos()){if(i){await i,i=void 0;return}if(!o.j.isPairingExpired(m?.wcPairingExpiry)){let e=m.wcUri;m.wcUri=e;return}i=this._getClient()?.connectWalletConnect?.().catch(()=>void 0),this.state.status="connecting",await i,i=void 0,m.wcPairingExpiry=void 0,this.state.status="connected"}else await this._getClient()?.connectWalletConnect?.()},async connectExternal(e,t,r=!0){await this._getClient()?.connectExternal?.(e),r&&u.R.setActiveNamespace(t)},async reconnectExternal(e){await this._getClient()?.reconnectExternal?.(e);let t=e.chain||u.R.state.activeChain;t&&h.ConnectorController.setConnectorId(e.id,t)},async setPreferredAccountType(e,t){p.I.setLoading(!0,u.R.state.activeChain);let r=h.ConnectorController.getAuthConnector();r&&(l.AccountController.setPreferredAccountType(e,t),await r.provider.setPreferredAccount(e),c.M.setPreferredAccountTypes(l.AccountController.state.preferredAccountTypes??{[t]:e}),await this.reconnectExternal(r),p.I.setLoading(!1,u.R.state.activeChain),d.X.sendEvent({type:"track",event:"SET_PREFERRED_ACCOUNT_TYPE",properties:{accountType:e,network:u.R.state.activeCaipNetwork?.caipNetworkId||""}}))},async signMessage(e){return this._getClient()?.signMessage(e)},parseUnits(e,t){return this._getClient()?.parseUnits(e,t)},formatUnits(e,t){return this._getClient()?.formatUnits(e,t)},async sendTransaction(e){return this._getClient()?.sendTransaction(e)},async getCapabilities(e){return this._getClient()?.getCapabilities(e)},async grantPermissions(e){return this._getClient()?.grantPermissions(e)},async walletGetAssets(e){return this._getClient()?.walletGetAssets(e)??{}},async estimateGas(e){return this._getClient()?.estimateGas(e)},async writeContract(e){return this._getClient()?.writeContract(e)},async getEnsAddress(e){return this._getClient()?.getEnsAddress(e)},async getEnsAvatar(e){return this._getClient()?.getEnsAvatar(e)},checkInstalled(e){return this._getClient()?.checkInstalled?.(e)||!1},resetWcConnection(){m.wcUri=void 0,m.wcPairingExpiry=void 0,m.wcLinking=void 0,m.recentWallet=void 0,m.status="disconnected",g.s.resetTransactions(),c.M.deleteWalletConnectDeepLink()},resetUri(){m.wcUri=void 0,m.wcPairingExpiry=void 0},finalizeWcConnection(){let{wcLinking:e,recentWallet:t}=y.state;e&&c.M.setWalletConnectDeepLink(e),t&&c.M.setAppKitRecent(t),d.X.sendEvent({type:"track",event:"CONNECT_SUCCESS",properties:{method:e?"mobile":"qrcode",name:f.RouterController.state.data?.wallet?.name||"Unknown"}})},setWcBasic(e){m.wcBasic=e},setUri(e){m.wcUri=e,m.wcPairingExpiry=o.j.getPairingExpiry()},setWcLinking(e){m.wcLinking=e},setWcError(e){m.wcError=e,m.buffering=!1},setRecentWallet(e){m.recentWallet=e},setBuffering(e){m.buffering=e},setStatus(e){m.status=e},async disconnect(e){try{p.I.setLoading(!0,e),await a.w.clearSessions(),await u.R.disconnect(e),p.I.setLoading(!1,e),h.ConnectorController.setFilterByNamespace(void 0)}catch(e){throw Error("Failed to disconnect")}}}},1471:function(e,t,r){"use strict";r.d(t,{ConnectorController:function(){return m}});var i=r(31147),n=r(54322),s=r(72647),o=r(40722),a=r(50035);let c={handleSolanaDeeplinkRedirect(e){if(a.R.state.activeChain===s.b.CHAIN.SOLANA){let t=window.location.href,r=encodeURIComponent(t);if("Phantom"===e&&!("phantom"in window)){let e=t.startsWith("https")?"https":"http",i=t.split("/")[2],n=encodeURIComponent(`${e}://${i}`);window.location.href=`https://phantom.app/ul/browse/${r}?ref=${n}`}"Coinbase Wallet"!==e||"coinbaseSolana"in window||(window.location.href=`https://go.cb-w.com/dapp?cb_url=${r}`)}}};
1var l=r(84140),u=r(44129),h=r(68619),d=r(97040),p=r(59099);let f={eip155:void 0,solana:void 0,polkadot:void 0,bip122:void 0},g=(0,i.sj)({allConnectors:[],connectors:[],activeConnector:void 0,filterByNamespace:void 0,activeConnectorIds:{...f}}),m={state:g,subscribe:e=>(0,i.Ld)(g,()=>{e(g)}),subscribeKey:(e,t)=>(0,n.VW)(g,e,t),initialize(e){e.forEach(e=>{let t=l.M.getConnectedConnectorId(e);t&&this.setConnectorId(t,e)})},setActiveConnector(e){e&&(g.activeConnector=(0,i.iH)(e))},setConnectors(e){e.filter(e=>!g.allConnectors.some(t=>t.id===e.id&&this.getConnectorName(t.name)===this.getConnectorName(e.name)&&t.chain===e.chain)).forEach(e=>{"MULTI_CHAIN"!==e.type&&g.allConnectors.push((0,i.iH)(e))}),g.connectors=this.mergeMultiChainConnectors(g.allConnectors)},removeAdapter(e){g.allConnectors=g.allConnectors.filter(t=>t.chain!==e),g.connectors=this.mergeMultiChainConnectors(g.allConnectors)},mergeMultiChainConnectors(e){let t=this.generateConnectorMapByName(e),r=[];return t.forEach(e=>{let t=e[0],i=t?.id===s.b.CONNECTOR_ID.AUTH;e.length>1&&t?r.push({name:t.name,imageUrl:t.imageUrl,imageId:t.imageId,connectors:[...e],type:i?"AUTH":"MULTI_CHAIN",chain:"eip155",id:t?.id||""}):t&&r.push(t)}),r},generateConnectorMapByName(e){let t=new Map;return e.forEach(e=>{let{name:r}=e,i=this.getConnectorName(r);if(!i)return;let n=t.get(i)||[];n.find(t=>t.chain===e.chain)||n.push(e),t.set(i,n)}),t},getConnectorName:e=>e&&({"Trust Wallet":"Trust"})[e]||e,getUniqueConnectorsByName(e){let t=[];return e.forEach(e=>{t.find(t=>t.chain===e.chain)||t.push(e)}),t},addConnector(e){if(e.id===s.b.CONNECTOR_ID.AUTH){let t=(0,i.CO)(h.OptionsController.state),r=p.ThemeController.getSnapshot().themeMode,n=p.ThemeController.getSnapshot().themeVariables;e?.provider?.syncDappData?.({metadata:t.metadata,sdkVersion:t.sdkVersion,projectId:t.projectId,sdkType:t.sdkType}),e?.provider?.syncTheme({themeMode:r,themeVariables:n,w3mThemeVariables:o.t(n,r)}),this.setConnectors([e])}else this.setConnectors([e])},getAuthConnector(e){let t=e||a.R.state.activeChain,r=g.connectors.find(e=>e.id===s.b.CONNECTOR_ID.AUTH);return r?r?.connectors?.length?r.connectors.find(e=>e.chain===t):r:void 0},getAnnouncedConnectorRdns:()=>g.connectors.filter(e=>"ANNOUNCED"===e.type).map(e=>e.info?.rdns),getConnectorById:e=>g.allConnectors.find(t=>t.id===e),getConnector:(e,t)=>g.allConnectors.filter(e=>e.chain===a.R.state.activeChain).find(r=>r.explorerId===e||r.info?.rdns===t),syncIfAuthConnector(e){if("ID_AUTH"!==e.id)return;let t=(0,i.CO)(h.OptionsController.state),r=p.ThemeController.getSnapshot().themeMode,n=p.ThemeController.getSnapshot().themeVariables;e?.provider?.syncDappData?.({metadata:t.metadata,sdkVersion:t.sdkVersion,sdkType:t.sdkType,projectId:t.projectId}),e.provider.syncTheme({themeMode:r,themeVariables:n,w3mThemeVariables:(0,o.t)(n,r)})},getConnectorsByNamespace(e){let t=g.allConnectors.filter(t=>t.chain===e);return this.mergeMultiChainConnectors(t)},selectWalletConnector(e){let t=m.getConnector(e.id,e.rdns);a.R.state.activeChain===s.b.CHAIN.SOLANA&&c.handleSolanaDeeplinkRedirect(t?.name||e.name||""),t?d.RouterController.push("ConnectingExternal",{connector:t}):d.RouterController.push("ConnectingWalletConnect",{wallet:e})},getConnectors(e){return e?this.getConnectorsByNamespace(e):this.mergeMultiChainConnectors(g.allConnectors)},setFilterByNamespace(e){g.filterByNamespace=e,g.connectors=this.getConnectors(e),u.ApiController.setFilterByNamespace(e)},setConnectorId(e,t){e&&(g.activeConnectorIds={...g.activeConnectorIds,[t]:e},l.M.setConnectedConnectorId(t,e))},removeConnectorId(e){g.activeConnectorIds={...g.activeConnectorIds,[e]:void 0},l.M.deleteConnectedConnectorId(e)},getConnectorId(e){if(e)return g.activeConnectorIds[e]},isConnected:e=>e?!!g.activeConnectorIds[e]:Object.values(g.activeConnectorIds).some(e=>!!e),resetConnectorIds(){g.activeConnectorIds={...f}}}},85786:function(e,t,r){"use strict";r.d(t,{a:function(){return f}});var i=r(31147),n=r(54322);let s={convertEVMChainIdToCoinType(e){if(e>=2147483648)throw Error("Invalid chainId");return(2147483648|e)>>>0}};var o=r(84140),a=r(78008),c=r(29427),l=r(50035),u=r(56941),h=r(1471),d=r(97040);let p=(0,i.sj)({suggestions:[],loading:!1}),f={state:p,subscribe:e=>(0,i.Ld)(p,()=>e(p)),subscribeKey:(e,t)=>(0,n.VW)(p,e,t),async resolveName(e){try{return await c.L.lookupEnsName(e)}catch(e){throw Error(e?.reasons?.[0]?.description||"Error resolving name")}},async isNameRegistered(e){try{return await c.L.lookupEnsName(e),!0}catch{return!1}},async getSuggestions(e){try{p.loading=!0,p.suggestions=[];let t=await c.L.getEnsNameSuggestions(e);return p.suggestions=t.suggestions.map(e=>({...e,name:e.name}))||[],p.suggestions}catch(e){throw Error(this.parseEnsApiError(e,"Error fetching name suggestions"))}finally{p.loading=!1}},async getNamesForAddress(e){try{if(!l.R.state.activeCaipNetwork)return[];
1let t=o.M.getEnsFromCacheForAddress(e);if(t)return t;let r=await c.L.reverseLookupEnsName({address:e});return o.M.updateEnsCache({address:e,ens:r,timestamp:Date.now()}),r}catch(e){throw Error(this.parseEnsApiError(e,"Error fetching names for address"))}},async registerName(e){let t=l.R.state.activeCaipNetwork;if(!t)throw Error("Network not found");let r=a.AccountController.state.address,i=h.ConnectorController.getAuthConnector();if(!r||!i)throw Error("Address or auth connector not found");p.loading=!0;try{let i=JSON.stringify({name:e,attributes:{},timestamp:Math.floor(Date.now()/1e3)});d.RouterController.pushTransactionStack({view:"RegisterAccountNameSuccess",goBack:!1,replace:!0,onCancel(){p.loading=!1}});let n=await u.ConnectionController.signMessage(i),o=t.id;if(!o)throw Error("Network not found");let l=s.convertEVMChainIdToCoinType(Number(o));await c.L.registerEnsName({coinType:l,address:r,signature:n,message:i}),a.AccountController.setProfileName(e,t.chainNamespace),d.RouterController.replace("RegisterAccountNameSuccess")}catch(r){let t=this.parseEnsApiError(r,`Error registering name ${e}`);throw d.RouterController.replace("RegisterAccountName"),Error(t)}finally{p.loading=!1}},validateName:e=>/^[a-zA-Z0-9-]{4,}$/u.test(e),parseEnsApiError:(e,t)=>e?.reasons?.[0]?.description||t}},43122:function(e,t,r){"use strict";r.d(t,{X:function(){return g}});var i=r(31147),n=r(72647),s=r(31293),o=r(25779),a=r(1607),c=r(78008),l=r(38431),u=r(68619);let h=o.j.getAnalyticsUrl(),d=new a.V({baseUrl:h,clientId:null}),p=["MODAL_CREATED"],f=(0,i.sj)({timestamp:Date.now(),reportedErrors:{},data:{type:"track",event:"MODAL_CREATED"}}),g={state:f,subscribe:e=>(0,i.Ld)(f,()=>e(f)),getSdkProperties(){let{projectId:e,sdkType:t,sdkVersion:r}=u.OptionsController.state;return{projectId:e,st:t,sv:r||"html-wagmi-4.2.2"}},async _sendAnalyticsEvent(e){try{let t=c.AccountController.state.address;if(p.includes(e.data.event)||"undefined"==typeof window)return;await d.post({path:"/e",params:g.getSdkProperties(),body:{eventId:o.j.getUUID(),url:window.location.href,domain:window.location.hostname,timestamp:e.timestamp,props:{...e.data,address:t}}}),f.reportedErrors.FORBIDDEN=!1}catch(e){e instanceof Error&&e.cause instanceof Response&&e.cause.status===n.b.HTTP_STATUS_CODES.FORBIDDEN&&!f.reportedErrors.FORBIDDEN&&(l.AlertController.open({shortMessage:"Invalid App Configuration",longMessage:`Origin ${(0,s.$U)()?window.origin:"uknown"} not found on Allowlist - update configuration on cloud.reown.com`},"error"),f.reportedErrors.FORBIDDEN=!0)}},sendEvent(e){f.timestamp=Date.now(),f.data=e,u.OptionsController.state.features?.anal
1ytics&&g._sendAnalyticsEvent(f)}}},31242:function(e,t,r){"use strict";r.d(t,{I:function(){return m}});var i=r(31147),n=r(54322),s=r(25779),o=r(78008),a=r(44129),c=r(50035),l=r(56941),u=r(1471),h=r(43122),d=r(68619),p=r(4197),f=r(97040);let g=(0,i.sj)({loading:!1,loadingNamespaceMap:new Map,open:!1,shake:!1,namespace:void 0}),m={state:g,subscribe:e=>(0,i.Ld)(g,()=>e(g)),subscribeKey:(e,t)=>(0,n.VW)(g,e,t),async open(e){let t="connected"===o.AccountController.state.status;l.ConnectionController.state.wcBasic?a.ApiController.prefetch({fetchNetworkImages:!1,fetchConnectorImages:!1}):await a.ApiController.prefetch({fetchConnectorImages:!t,fetchFeaturedWallets:!t,fetchRecommendedWallets:!t}),e?.namespace?(await c.R.switchActiveNamespace(e.namespace),m.setLoading(!0,e.namespace)):m.setLoading(!0),u.ConnectorController.setFilterByNamespace(e?.namespace);let r=c.R.getAccountData(e?.namespace)?.caipAddress;c.R.state.noAdapters&&!r?s.j.isMobile()?f.RouterController.reset("AllWallets"):f.RouterController.reset("ConnectingWalletConnectBasic"):e?.view?f.RouterController.reset(e.view,e.data):r?f.RouterController.reset("Account"):f.RouterController.reset("Connect"),g.open=!0,p.I.set({open:!0}),h.X.sendEvent({type:"track",event:"MODAL_OPEN",properties:{connected:!!r}})},close(){let e=d.OptionsController.state.enableEmbedded,t=!!c.R.state.activeCaipAddress;g.open&&h.X.sendEvent({type:"track",event:"MODAL_CLOSE",properties:{connected:t}}),g.open=!1,m.clearLoading(),e?t?f.RouterController.replace("Account"):f.RouterController.push("Connect"):p.I.set({open:!1}),l.ConnectionController.resetUri()},setLoading(e,t){t&&g.loadingNamespaceMap.set(t,e),g.loading=e,p.I.set({loading:e})},clearLoading(){g.loadingNamespaceMap.clear(),g.loading=!1},shake(){g.shake||(g.shake=!0,setTimeout(()=>{g.shake=!1},500))}}},68619:function(e,t,r){"use strict";r.d(t,{OptionsController:function(){return l}});var i=r(31147),n=r(54322),s=r(62748),o=r(25779);let a={getFeatureValue(e,t){let r=t?.[e];return void 0===r?s.bq.DEFAULT_FEATURES[e]:r},filterSocialsByPlatform(e){if(!e||!e.length)return e;if(o.j.isTelegram()){if(o.j.isIos())return e.filter(e=>"google"!==e);if(o.j.isMac())return e.filter(e=>"x"!==e);if(o.j.isAndroid())return e.filter(e=>!["facebook","x"].includes(e))}return e}},c=(0,i.sj)({features:s.bq.DEFAULT_FEATURES,projectId:"",sdkType:"appkit",sdkVersion:"html-wagmi-undefined",defaultAccountTypes:{solana:"eoa",bip122:"payment",polkadot:"eoa",eip155:"smartAccount"},enableNetworkSwitch:!0}),l={state:c,subscribeKey:(e,t)=>(0,n.VW)(c,e,t),setOptions(e){Object.assign(c,e)},setFeatures(e){if(!e)return;c.features||(c.features=s.bq.DEFAULT_FEATURES);let t={...c.features,...e};c.features=t,c.features.socials&&(c.features.socials=a.filterSocialsByPlatform(c.features.socials))},setProjectId(e){c.projectId=e},setCustomRpcUrls(e){c.customRpcUrls=e},setAllWallets(e){c.allWallets=e},setIncludeWalletIds(e){c.includeWalletIds=e},setExcludeWalletIds(e){c.excludeWalletIds=e},setFeaturedWalletIds(e){c.featuredWalletIds=e},setTokens(e){c.tokens=e},setTermsConditionsUrl(e){c.termsConditionsUrl=e},setPrivacyPolicyUrl(e){c.privacyPolicyUrl=e},setCustomWallets(e){c.customWallets=e},setIsSiweEnabled(e){c.isSiweEnabled=e},setIsUniversalProvider(e){c.isUniversalProvider=e},setSdkVersion(e){c.sdkVersion=e},setMetadata(e){c.metadata=e},setDisableAppend(e){c.disableAppend=e},setEIP6963Enabled(e){c.enableEIP6963=e},setDebug(e){c.debug=e},setEnableWalletConnect(e){c.enableWalletConnect=e},setEnableWalletGuide(e){c.enableWalletGuide=e},setEnableAuthLogger(e){c.enableAuthLogger=e},setEnableWallets(e){c.enableWallets=e},setHasMultipleAddresses(e){c.hasMultipleAddresses=e},setSIWX(e){c.siwx=e},setConnectMethodsOrder(e){c.features={...c.features,connectMethodsOrder:e}},setWalletFeaturesOrder(e){c.features={...c.features,walletFeaturesOrder:e}},setSocialsOrder(e){c.features={...c.features,socials:e}},setCollapseWallets(e){c.features={...c.features,collapseWallets:e}},setEnableEmbedded(e){c.enableEmbedded=e},setAllowUnsupportedChain(e){c.allowUnsupportedChain=e},setManualWCControl(e){c.manualWCControl=e},setEnableNetworkSwitch(e){c.enableNetworkSwitch=e},setDefaultAccountTypes(e={}){Object.entries(e).forEach(([e,t])=>{t&&(c.defaultAccountTypes[e]=t)})},setUniversalProviderConfigOverride(e){c.universalProviderConfigOverride=e},getUniversalProviderConfigOverride:()=>c.universalProviderConfigOverride,getSnapshot:()=>(0,i.CO)(c)}},4197:function(e,t,r){"use strict";r.d(t,{I:function(){return o}});var i=r(31147),n=r(54322);let s=(0,i.sj)({loading:!1,open:!1,selectedNetworkId:void 0,activeChain:void 0,initialized:!1}),o={state:s,subscribe:e=>(0,i.Ld)(s,()=>e(s)),subscribeOpen:e=>(0,n.VW)(s,"open",e),set(e){Object.assign(s,{...s,...e})}}},97040:function(e,t,r){"use strict";r.d(t,{RouterController:function(){return h}});var i=r(31147),n=r(54322),s=r(78008),o=r(50035),a=r(1471),c=r(31242),l=r(68619);let u=(0,i.sj)({view:"Connect",history:["Connect"],transactionStack:[]}),h={state:u,subscribeKey:(e,t)=>(0,n.VW)(u,e,t),pushTransactionStack(e){u.transactionStack.push(e)},popTransactionStack(e){let t=u.transactionStack.pop();if(t){if(e)this.goBack(),t?.onCancel?.();else{if(t.goBack)this.goBack();else if(t.replace){let e=u.history.indexOf("ConnectingSiwe");e>0?this.goBackToIndex(e-1):(c.I.close(),u.history=[])}else t.view&&this.reset(t.view);t?.onSuccess?.()}}},push(e,t){e!==u.view&&(u.view=e,u.history.push(e),u.data=t)},reset(e,t){u.view=e,u.history=[e],u.data=t},replace(e,t){u.history.at(-1)!==e&&(u.view=e,u.history[u.history.length-1]=e,u.data=t)},goBack(){let e=!o.R.state.activeCaipAddress&&"ConnectingFarcaster"===this.state.view;if(u.history.length>1&&!u.history.includes("UnsupportedChain")){u.history.pop();let[e]=u.history.slice(-1);e&&(u.view=e)}else c.I.close();u.data?.wallet&&(u.data.wallet=void 0),setTimeout(()=>{if(e){s.AccountController.setFarcasterUrl(void 0,o.R.state.activeChain);let e=a.ConnectorController.getAuthConnector();e?.provider?.reload();let t=(0,i.CO)(l.OptionsController.state);e?.provider?.syncDappData?.({metadata:t.metadata,sdkVersion:t.sdkVersion,projectId:t.projectId,sdkType:t.sdkType})}},100)},goBackToIndex(e){if(u.history.length>1){u.history=u.history.slice(0,e+1);let[t]=u.history.slice(-1);t&&(u.view=t)}}}},22364:function(e,t,r){"use strict";r.d(t,{S:function(){return E}});var i=r(31147),n=r(54322),s=r(41621);let o=[{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"_to",type:"address"},{name:"_value",type:"uint256"}],outputs:[{name:"",type:"bool"}]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"_from",type:"address"},{name:"_to",type:"address"},{name:"_value",type:"uint256"}],outputs:[{name:"",type:"bool"}]}],a=[{type:"function",name:"transfer",stateMutability:"nonpayable",inputs:[{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[]},{type:"function",name:"transferFrom",stateMutability:"nonpayable",inputs:[{name:"sender",type:"address"},{name:"recipient",type:"address"},{name:"amount",type:"uint256"}],outputs:[{name:"",type:"bool"}]}];var c=r(72647);let l={getERC20Abi:e=>c.b.USDT_CONTRACT_ADDRESSES.includes(e)?a:o};
1var u=r(87411),h=r(62748),d=r(25779),p=r(24369),f=r(78008),g=r(50035),m=r(56941),y=r(43122),w=r(97040),b=r(30649);let v=(0,i.sj)({tokenBalances:[],loading:!1}),E={state:v,subscribe:e=>(0,i.Ld)(v,()=>e(v)),subscribeKey:(e,t)=>(0,n.VW)(v,e,t),setToken(e){e&&(v.token=(0,i.iH)(e))},setTokenAmount(e){v.sendTokenAmount=e},setReceiverAddress(e){v.receiverAddress=e},setReceiverProfileImageUrl(e){v.receiverProfileImageUrl=e},setReceiverProfileName(e){v.receiverProfileName=e},setGasPrice(e){v.gasPrice=e},setGasPriceInUsd(e){v.gasPriceInUSD=e},setNetworkBalanceInUsd(e){v.networkBalanceInUSD=e},setLoading(e){v.loading=e},sendToken(){switch(g.R.state.activeCaipNetwork?.chainNamespace){case"eip155":this.sendEvmToken();return;case"solana":this.sendSolanaToken();return;default:throw Error("Unsupported chain")}},sendEvmToken(){let e=g.R.state.activeChain,t=f.AccountController.state.preferredAccountTypes?.[e];this.state.token?.address&&this.state.sendTokenAmount&&this.state.receiverAddress?(y.X.sendEvent({type:"track",event:"SEND_INITIATED",properties:{isSmartAccount:t===u.y_.ACCOUNT_TYPES.SMART_ACCOUNT,token:this.state.token.address,amount:this.state.sendTokenAmount,network:g.R.state.activeCaipNetwork?.caipNetworkId||""}}),this.sendERC20Token({receiverAddress:this.state.receiverAddress,tokenAddress:this.state.token.address,sendTokenAmount:this.state.sendTokenAmount,decimals:this.state.token.quantity.decimals})):this.state.receiverAddress&&this.state.sendTokenAmount&&this.state.gasPrice&&this.state.token?.quantity.decimals&&(y.X.sendEvent({type:"track",event:"SEND_INITIATED",properties:{isSmartAccount:t===u.y_.ACCOUNT_TYPES.SMART_ACCOUNT,token:this.state.token?.symbol,amount:this.state.sendTokenAmount,network:g.R.state.activeCaipNetwork?.caipNetworkId||""}}),this.sendNativeToken({receiverAddress:this.state.receiverAddress,sendTokenAmount:this.state.sendTokenAmount,gasPrice:this.state.gasPrice,decimals:this.state.token.quantity.decimals}))},async fetchTokenBalance(e){v.loading=!0;let t=g.R.state.activeCaipNetwork?.caipNetworkId,r=g.R.state.activeCaipNetwork?.chainNamespace,i=g.R.state.activeCaipAddress,n=i?d.j.getPlainAddress(i):void 0;if(v.lastRetry&&!d.j.isAllowedRetry(v.lastRetry,30*h.bq.ONE_SEC_MS))return v.loading=!1,[];try{if(n&&t&&r){let e=await p.y.getMyTokensWithBalance();return v.tokenBalances=e,v.lastRetry=void 0,e}}catch(t){v.lastRetry=Date.now(),e?.(t),b.SnackController.showError("Token Balance Unavailable")}finally{v.loading=!1}return[]},fetchNetworkBalance(){if(0===v.tokenBalances.length)return;let e=p.y.mapBalancesToSwapTokens(v.tokenBalances);if(!e)return;let t=e.find(e=>e.address===g.R.getActiveNetworkTokenAddress());t&&(v.networkBalanceInUSD=t?s.C.multiply(t.quantity.numeric,t.price).toString():"0")},isInsufficientNetworkTokenForGas:(e,t)=>!!s.C.bigNumber(e).eq(0)||s.C.bigNumber(s.C.bigNumber(t||"0")).gt(e),hasInsufficientGasFunds(){let e=g.R.state.activeChain,t=!0;return f.AccountController.state.preferredAccountTypes?.[e]===u.y_.ACCOUNT_TYPES.SMART_ACCOUNT?t=!1:v.networkBalanceInUSD&&(t=this.isInsufficientNetworkTokenForGas(v.networkBalanceInUSD,v.gasPriceInUSD)),t},async sendNativeToken(e){let t=g.R.state.activeChain;w.RouterController.pushTransactionStack({view:"Account",goBack:!1});let r=e.receiverAddress,i=f.AccountController.state.address,n=m.ConnectionController.parseUnits(e.sendTokenAmount.toString(),Number(e.decimals));try{await m.ConnectionController.sendTransaction({chainNamespace:"eip155",to:r,address:i,data:"0x",value:n??BigInt(0),gasPrice:e.gasPrice}),b.SnackController.showSuccess("Transaction started"),y.X.sendEvent({type:"track",event:"SEND_SUCCESS",properties:{isSmartAccount:f.AccountController.state.preferredAccountTypes?.[t]===u.y_.ACCOUNT_TYPES.SMART_ACCOUNT,token:this.state.token?.symbol||"",amount:e.sendTokenAmount,network:g.R.state.activeCaipNetwork?.caipNetworkId||""}}),this.resetSend()}catch(i){console.error("SendController:sendERC20Token - failed to send native token",i);let r=i instanceof Error?i.message:"Unknown error";y.X.sendEvent({type:"track",event:"SEND_ERROR",properties:{message:r,isSmartAccount:f.AccountController.state.preferredAccountTypes?.[t]===u.y_.ACCOUNT_TYPES.SMART_ACCOUNT,token:this.state.token?.symbol||"",amount:e.sendTokenAmount,network:g.R.state.activeCaipNetwork?.caipNetworkId||""}}),b.SnackController.showError("Something went wrong")}},async sendERC20Token(e){w.RouterController.pushTransactionStack({view:"Account",goBack:!1});let t=m.ConnectionController.parseUnits(e.sendTokenAmount.toString(),Number(e.decimals));try{if(f.AccountController.state.address&&e.sendTokenAmount&&e.receiverAddress&&e.tokenAddress){let r=d.j.getPlainAddress(e.tokenAddress);await m.ConnectionController.writeContract({fromAddress:f.AccountController.state.address,tokenAddress:r,args:[e.receiverAddress,t??BigInt(0)],method:"transfer",abi:l.getERC20Abi(r),chainNamespace:"eip155"}),b.SnackController.showSuccess("Transaction started"),this.resetSend()}}catch(r){console.error("SendController:sendERC20Token - failed to send erc20 token",r);let t=r instanceof Error?r.message:"Unknown error";y.X.sendEvent({type:"track",event:"SEND_ERROR",properties:{message:t,isSmartAccount:f.AccountController.state.preferredAccountTypes?.eip155===u.y_.ACCOUNT_TYPES.SMART_ACCOUNT,token:this.state.token?.symbol||"",amount:e.sendTokenAmount,network:g.R.state.activeCaipNetwork?.caipNetworkId||""}}),b.SnackController.showError("Something went wrong")}},sendSolanaToken(){if(!this.state.sendTokenAmount||!this.state.receiverAddress){b.SnackController.showError("Please enter a valid amount and receiver address");return}w.RouterController.pushTransactionStack({view:"Account",goBack:!1}),m.ConnectionController.sendTransaction({chainNamespace:"solana",to:this.state.receiverAddress,value:this.state.sendTokenAmount}).then(()=>{this.resetSend(),f.AccountController.fetchTokenBalance()}).catch(e=>{b.SnackController.showError("Failed to send transaction. Please try again."),console.error("SendController:sendToken - failed to send solana transaction",e)})},resetSend(){v.token=void 0,v.sendTokenAmount=void 0,v.receiverAddress=void 0,v.receiverProfileImageUrl=void 0,v.receiverProfileName=void 0,v.loading=!1,v.tokenBalances=[]}}},30649:function(e,t,r){"use strict";r.d(t,{SnackController:function(){return c}});var i=r(31147),n=r(54322),s=r(25779);let o=Object.freeze({message:"",variant:"success",svg:void 0,open:!1,autoClose:!0}),a=(0,i.sj)({...o}),c={state:a,subscribeKey:(e,t)=>(0,n.VW)(a,e,t),showLoading(e,t={}){this._showMessage({message:e,variant:"loading",...t})},showSuccess(e){this._showMessage({message:e,variant:"success"})},showSvg(e,t){this._showMessage({message:e,svg:t})},showError(e){let t=s.j.parseError(e);this._showMessage({message:t,variant:"error"})},hide(){a.message=o.message,a.variant=o.variant,a.svg=o.svg,a.open=o.open,a.autoClose=o.autoClose},_showMessage({message:e,svg:t,variant:r="success",autoClose:i=o.autoClose}){a.open?(a.open=!1,setTimeout(()=>{a.message=e,a.variant=r,a.svg=t,a.open=!0,a.autoClose=i},150)):(a.message=e,a.variant=r,a.svg=t,a.open=!0,a.autoClose=i)}}},59099:function(e,t,r){"use strict";r.d(t,{ThemeController:function(){return a}});var i=r(31147),n=r(40722),s=r(1471);let o=(0,i.sj)({themeMode:"dark",themeVariables:{},w3mThemeVariables:void 0}),a={state:o,subscribe:e=>(0,i.Ld)(o,()=>e(o)),setThemeMode(e){o.themeMode=e;try{let t=s.ConnectorController.getAuthConnector();if(t){let r=a.getSnapshot().themeVariables;t.provider.syncTheme({themeMode:e,themeVariables:r,w3mThemeVariables:(0,n.t)(r,e)})}}catch{console.info("Unable to sync theme to auth connector")}},setThemeVariables(e){o.themeVariables={...o.themeVariables,...e};try{let e=s.ConnectorController.getAuthConnector();if(e){let t=a.getSnapshot().themeVariables;e.provider.syncTheme({themeVariables:t,w3mThemeVariables:(0,n.t)(o.themeVariables,o.themeMode)})}}catch{console.info("Unable to sync theme to auth connector")}},getSnapshot:()=>(0,i.CO)(o)}},5227:function(e,t,r){"use strict";r.d(t,{s:function(){return d}});var i=r(31147),n=r(87411),s=r(78008),o=r(29427),a=r(50035),c=r(43122),l=r(68619),u=r(30649);let h=(0,i.sj)({transactions:[],coinbaseTransactions:{},transactionsByYear:{},lastNetworkInView:void 0,loading:!1,empty:!1,next:void 0}),d={state:h,subscribe:e=>(0,i.Ld)(h,()=>e(h)),setLastNetworkInView(e){h.lastNetworkInView=e},async fetchTransactions(e,t){if(!e)throw Error("Transactions can't be fetched without an accountAddress");h.loading=!0;try{let r=await o.L.fetchTransactions({account:e,cursor:h.next,onramp:t,cache:"coinbase"===t?"no-cache":void 0,chainId:a.R.state.activeCaipNetwork?.caipNetworkId}),i=this.filterSpamTransactions(r.data),n=this.filterByConnectedChain(i),s=[...h.transactions,...n];h.loading=!1,"coinbase"===t?h.coinbaseTransactions=this.groupTransactionsByYearAndMonth(h.coinbaseTransactions,r.data):(h.transactions=s,h.transactionsByYear=this.groupTransactionsByYearAndMonth(h.transactionsByYear,n)),h.empty=0===s.length,h.next=r.next?r.next:void 0}catch(r){let t=a.R.state.activeChain;c.X.sendEvent({type:"track",event:"ERROR_FETCH_TRANSACTIONS",properties:{address:e,projectId:l.OptionsController.state.projectId,cursor:h.next,isSmartAccount:s.AccountController.state.preferredAccountTypes?.[t]===n.y_.ACCOUNT_TYPES.SMART_ACCOUNT}}),u.SnackController.showError("Failed to fetch transactions"),h.loading=!1,h.empty=!0,h.next=void 0}},groupTransactionsByYearAndMonth:(e={},t=[])=>(t.forEach(t=>{let r=new Date(t.metadata.minedAt).getFullYear(),i=new Date(t.metadata.minedAt).getMonth(),n=e[r]??{},s=(n[i]??[]).filter(e=>e.id!==t.id);e[r]={...n,[i]:[...s,t].sort((e,t)=>
1new Date(t.metadata.minedAt).getTime()-new Date(e.metadata.minedAt).getTime())}}),e),filterSpamTransactions:e=>e.filter(e=>!e.transfers.every(e=>e.nft_info?.flags.is_spam===!0)),filterByConnectedChain(e){let t=a.R.state.activeCaipNetwork?.caipNetworkId;return e.filter(e=>e.metadata.chain===t)},clearCursor(){h.next=void 0},resetTransactions(){h.transactions=[],h.transactionsByYear={},h.lastNetworkInView=void 0,h.loading=!1,h.empty=!1,h.next=void 0}}},79193:function(e,t,r){"use strict";r.d(t,{f:function(){return c}});var i=r(31147),n=r(44129),s=r(46065);let o={eip155:"ba0ba0cd-17c6-4806-ad93-f9d174f17900",solana:"a1b58899-f671-4276-6a5e-56ca5bd59700",polkadot:"",bip122:"0b4838db-0161-4ffe-022d-532bf03dba00"},a=(0,i.sj)({networkImagePromises:{}}),c={async fetchWalletImage(e){if(e)return await n.ApiController._fetchWalletImage(e),this.getWalletImageById(e)},async fetchNetworkImage(e){if(e)return this.getNetworkImageById(e)||(a.networkImagePromises[e]||(a.networkImagePromises[e]=n.ApiController._fetchNetworkImage(e)),await a.networkImagePromises[e],this.getNetworkImageById(e))},getWalletImageById(e){if(e)return s.W.state.walletImages[e]},getWalletImage:e=>e?.image_url?e?.image_url:e?.image_id?s.W.state.walletImages[e.image_id]:void 0,getNetworkImage:e=>e?.assets?.imageUrl?e?.assets?.imageUrl:e?.assets?.imageId?s.W.state.networkImages[e.assets.imageId]:void 0,getNetworkImageById(e){if(e)return s.W.state.networkImages[e]},getConnectorImage:e=>e?.imageUrl?e.imageUrl:e?.imageId?s.W.state.connectorImages[e.imageId]:void 0,getChainImage:e=>s.W.state.networkImages[o[e]]}},62748:function(e,t,r){"use strict";r.d(t,{a$:function(){return o},bq:function(){return a},gy:function(){return s}});var i=r(25566);let n=(void 0!==i&&void 0!==i.env?i.env.NEXT_PUBLIC_SECURE_SITE_ORIGIN:void 0)||"https://secure.walletconnect.org",s=[{label:"Coinbase",name:"coinbase",feeRange:"1-2%",url:"",supportedChains:["eip155"]},{label:"Meld.io",name:"meld",feeRange:"1-2%",url:"https://meldcrypto.com",supportedChains:["eip155","solana"]}],o="WXETMuFUQmqqybHuRkSgxv:25B8LJHSfpG6LVjR2ytU5Cwh7Z4Sch2ocoU",a={FOUR_MINUTES_MS:24e4,TEN_SEC_MS:1e4,FIVE_SEC_MS:5e3,THREE_SEC_MS:3e3,ONE_SEC_MS:1e3,SECURE_SITE:n,SECURE_SITE_DASHBOARD:`${n}/dashboard`,SECURE_SITE_FAVICON:`${n}/images/favicon.png`,RESTRICTED_TIMEZONES:["ASIA/SHANGHAI","ASIA/URUMQI","ASIA/CHONGQING","ASIA/HARBIN","ASIA/KASHGAR","ASIA/MACAU","ASIA/HONG_KONG","ASIA/MACAO","ASIA/BEIJING","ASIA/HARBIN"],WC_COINBASE_PAY_SDK_CHAINS:["ethereum","arbitrum","polygon","berachain","avalanche-c-chain","optimism","celo","base"],WC_COINBASE_PAY_SDK_FALLBACK_CHAIN:"ethereum",WC_COINBASE_PAY_SDK_CHAIN_NAME_MAP:{Ethereum:"ethereum","Arbitrum One":"arbitrum",Polygon:"polygon",Berachain:"berachain",Avalanche:"avalanche-c-chain","OP Mainnet":"optimism",Celo:"celo",Base:"base"},WC_COINBASE_ONRAMP_APP_ID:"bf18c88d-495a-463b-b249-0b9d3656cf5e",SWAP_SUGGESTED_TOKENS:["ETH","UNI","1INCH","AAVE","SOL","ADA","AVAX","DOT","LINK","NITRO","GAIA","MILK","TRX","NEAR","GNO","WBTC","DAI","WETH","USDC","USDT","ARB","BAL","BICO","CRV","ENS","MATIC","OP"],SWAP_POPULAR_TOKENS:["ETH","UNI","1INCH","AAVE","SOL","ADA","AVAX","DOT","LINK","NITRO","GAIA","MILK","TRX","NEAR","GNO","WBTC","DAI","WETH","USDC","USDT","ARB","BAL","BICO","CRV","ENS","MATIC","OP","METAL","DAI","CHAMP","WOLF","SALE","BAL","BUSD","MUST","BTCpx","ROUTE","HEX","WELT","amDAI","VSQ","VISION","AURUM","pSP","SNX","VC","LINK","CHP","amUSDT","SPHERE","FOX","GIDDY","GFC","OMEN","OX_OLD","DE","WNT"],BALANCE_SUPPORTED_CHAINS:["eip155","solana"],SWAP_SUPPORTED_NETWORKS:["eip155:1","eip155:42161","eip155:10","eip155:324","eip155:8453","eip155:56","eip155:137","eip155:100","eip155:43114","eip155:250","eip155:8217","eip155:1313161554"],NAMES_SUPPORTED_CHAIN_NAMESPACES:["eip155"],ONRAMP_SUPPORTED_CHAIN_NAMESPACES:["eip155","solana"],ACTIVITY_ENABLED_CHAIN_NAMESPACES:["eip155"],NATIVE_TOKEN_ADDRESS:{eip155:"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",solana:"So11111111111111111111111111111111111111111",polkadot:"0x",bip122:"0x"},CONVERT_SLIPPAGE_TOLERANCE:1,CONNECT_LABELS:{MOBILE:"Open and continue in a new browser tab"},DEFAULT_FEATURES:{swaps:!0,onramp:!0,receive:!0,send:!0,email:!0,emailShowWallets:!0,socials:["google","x","discord","farcaster","github","apple","facebook"],connectorTypeOrder:["walletConnect","recent","
1injected","featured","custom","external","recommended"],history:!0,analytics:!0,allWallets:!0,legalCheckbox:!1,smartSessions:!1,collapseWallets:!1,walletFeaturesOrder:["onramp","swaps","receive","send"],connectMethodsOrder:void 0},DEFAULT_ACCOUNT_TYPES:{bip122:"payment",eip155:"smartAccount",polkadot:"eoa",solana:"eoa"},ADAPTER_TYPES:{UNIVERSAL:"universal",SOLANA:"solana",WAGMI:"wagmi",ETHERS:"ethers",ETHERS5:"ethers5",BITCOIN:"bitcoin"}}},25779:function(e,t,r){"use strict";r.d(t,{j:function(){return o}});var i=r(72647),n=r(62748),s=r(84140);let o={isMobile(){return!!this.isClient()&&!!(window?.matchMedia("(pointer:coarse)")?.matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent))},checkCaipNetwork:(e,t="")=>e?.caipNetworkId.toLocaleLowerCase().includes(t.toLowerCase()),isAndroid(){if(!this.isMobile())return!1;let e=window?.navigator.userAgent.toLowerCase();return o.isMobile()&&e.includes("android")},isIos(){if(!this.isMobile())return!1;let e=window?.navigator.userAgent.toLowerCase();return e.includes("iphone")||e.includes("ipad")},isSafari(){return!!this.isClient()&&(window?.navigator.userAgent.toLowerCase()).includes("safari")},isClient:()=>"undefined"!=typeof window,isPairingExpired:e=>!e||e-Date.now()<=n.bq.TEN_SEC_MS,isAllowedRetry:(e,t=n.bq.ONE_SEC_MS)=>Date.now()-e>=t,copyToClopboard(e){navigator.clipboard.writeText(e)},isIframe(){try{return window?.self!==window?.top}catch(e){return!1}},getPairingExpiry:()=>Date.now()+n.bq.FOUR_MINUTES_MS,getNetworkId:e=>e?.split(":")[1],getPlainAddress:e=>e?.split(":")[2],wait:async e=>new Promise(t=>{setTimeout(t,e)}),debounce(e,t=500){let r;return(...i)=>{r&&clearTimeout(r),r=setTimeout(function(){e(...i)},t)}},isHttpUrl:e=>e.startsWith("http://")||e.startsWith("https://"),formatNativeUrl(e,t){if(o.isHttpUrl(e))return this.formatUniversalUrl(e,t);let r=e;r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`),this.isTelegram()&&this.isAndroid()&&(t=encodeURIComponent(t));let i=encodeURIComponent(t);return{redirect:`${r}wc?uri=${i}`,href:r}},formatUniversalUrl(e,t){if(!o.isHttpUrl(e))return this.formatNativeUrl(e,t);let r=e;r.endsWith("/")||(r=`${r}/`);let i=encodeURIComponent(t);return{redirect:`${r}wc?uri=${i}`,href:r}},getOpenTargetForPlatform(e){return"popupWindow"===e?e:this.isTelegram()?s.M.getTelegramSocialProvider()?"_top":"_blank":e},openHref(e,t,r){window?.open(e,this.getOpenTargetForPlatform(t),r||"noreferrer noopener")},returnOpenHref(e,t,r){return window?.open(e,this.getOpenTargetForPlatform(t),r||"noreferrer noopener")},isTelegram:()=>"undefined"!=typeof window&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto),preloadImage:async e=>Promise.race([new Promise((t,r)=>{let i=new Image;i.onload=t,i.onerror=r,i.crossOrigin="anonymous",i.src=e}),o.wait(2e3)]),formatBalance(e,t){let r="0.000";if("string"==typeof e){let t=Number(e);if(t){let e=Math.floor(1e3*t)/1e3;e&&(r=e.toString())}}return`${r}${t?` ${t}`:""}`},formatBalance2(e,t){let r;if("0"===e)r="0";else if("string"==typeof e){let t=Number(e);t&&(r=t.toString().match(/^-?\d+(?:\.\d{0,3})?/u)?.[0])}return{value:r??"0",rest:"0"===r?"000":"",symbol:t}},getApiUrl:()=>i.b.W3M_API_URL,getBlockchainApiUrl:()=>i.b.BLOCKCHAIN_API_RPC_URL,getAnalyticsUrl:()=>i.b.PULSE_API_URL,getUUID:()=>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)}),parseError:e=>"string"==typeof e?e:"string"==typeof e?.issues?.[0]?.message?e.issues[0].message:e instanceof Error?e.message:"Unknown error",sortRequestedNetworks(e,t=[]){let r={};return t&&e&&(e.forEach((e,t)=>{r[e]=t}),t.sort((e,t)=>{let i=r[e.id],n=r[t.id];return void 0!==i&&void 0!==n?i-n:void 0!==i?-1:void 0!==n?1:0})),t},calculateBalance(e){let t=0;for(let r of e)t+=r.value??0;return t},formatTokenBalance(e){let[t,r]=e.toFixed(2).split(".");return{dollars:t,pennies:r}},isAddress(e,t="eip155"){switch(t){case"eip155":if(/^(?:0x)?[0-9a-f]{40}$/iu.test(e)&&(/^(?:0x)?[0-9a-f]{40}$/iu.test(e)||/^(?:0x)?[0-9A-F]{40}$/iu.test(e)))return!0;return!1;case"solana":return/[1-9A-HJ-NP-Za-km-z]{32,44}$/iu.test(e);default:return!1}},uniqueBy(e,t){let r=new Set;return e.filter(e=>{let i=e[t];return!r.has(i)&&(r.add(i),!0)})},generateSdkVersion(e,t,r){let i=0===e.length?n.bq.ADAPTER_TYPES.UNIVERSAL:e.map(e=>e.adapterType).join(",");return`${t}-${i}-${r}`},createAccount:(e,t,r,i,n)=>({namespace:e,address:t,type:r,publicKey:i,path:n}),isCaipAddress(e){if("string"!=typeof e)return!1;let t=e.split(":"),r=t[0];return 3===t.filter(Boolean).length&&r in i.b.CHAIN_NAME_MAP},isMac(){let e=window?.navigator.userAgent.toLowerCase();return e.includes("macintosh")&&!e.includes("safari")},formatTelegramSocialLoginUrl(e){let t=`--${encodeURIComponent(window?.location.href)}`,r="state=";if("auth.magic.link"===new URL(e).host){let i="provider_authorization_url=",n=e.substring(e.indexOf(i)+i.length),s=this.injectIntoUrl(decodeURIComponent(n),r,t);return e.replace(n,encodeURIComponent(s))}return this.injectIntoUrl(e,r,t)},injectIntoUrl(e,t,r){let i=e.indexOf(t);if(-1===i)throw Error(`${t} parameter not found in the URL: ${e}`);let n=e.indexOf("&",i),s=t.length,o=-1!==n?n:e.length,a=e.substring(0,i+s);return a+(e.substring(i+s,o)+r)+e.substring(n)}}},1607:function(e,t,r){"use strict";async function i(...e){let t=await fetch(...e);if(!t.ok)throw Error(`HTTP status code: ${t.status}`,{cause:t});return t}r.d(t,{V:function(){return n}});
1class n{constructor({baseUrl:e,clientId:t}){this.baseUrl=e,this.clientId=t}async get({headers:e,signal:t,cache:r,...n}){let s=this.createUrl(n);return(await i(s,{method:"GET",headers:e,signal:t,cache:r})).json()}async getBlob({headers:e,signal:t,...r}){let n=this.createUrl(r);return(await i(n,{method:"GET",headers:e,signal:t})).blob()}async post({body:e,headers:t,signal:r,...n}){let s=this.createUrl(n);return(await i(s,{method:"POST",headers:t,body:e?JSON.stringify(e):void 0,signal:r})).json()}async put({body:e,headers:t,signal:r,...n}){let s=this.createUrl(n);return(await i(s,{method:"PUT",headers:t,body:e?JSON.stringify(e):void 0,signal:r})).json()}async delete({body:e,headers:t,signal:r,...n}){let s=this.createUrl(n);return(await i(s,{method:"DELETE",headers:t,body:e?JSON.stringify(e):void 0,signal:r})).json()}createUrl({path:e,params:t}){let r=new URL(e,this.baseUrl);return t&&Object.entries(t).forEach(([e,t])=>{t&&r.searchParams.append(e,t)}),this.clientId&&r.searchParams.append("clientId",this.clientId),r}}},9331:function(e,t,r){"use strict";r.d(t,{w:function(){return g}}),r(13885);var i=r(72647),n=r(87411),s=r(78008),o=r(50035),a=r(56941),c=r(1471),l=r(43122),u=r(31242),h=r(68619),d=r(97040),p=r(30649),f=r(25779);let g={getSIWX:()=>h.OptionsController.state.siwx,async initializeIfEnabled(){let e=h.OptionsController.state.siwx,t=o.R.getActiveCaipAddress();if(!(e&&t))return;let[r,i,n]=t.split(":");if(o.R.checkIfSupportedNetwork(r))try{if((await e.getSessions(`${r}:${i}`,n)).length)return;await u.I.open({view:"SIWXSignMessage"})}catch(e){console.error("SIWXUtil:initializeIfEnabled",e),l.X.sendEvent({type:"track",event:"SIWX_AUTH_ERROR",properties:this.getSIWXEventProperties()}),await a.ConnectionController._getClient()?.disconnect().catch(console.error),d.RouterController.reset("Connect"),p.SnackController.showError("A problem occurred while trying initialize authentication")}},async requestSignMessage(){let e=h.OptionsController.state.siwx,t=f.j.getPlainAddress(o.R.getActiveCaipAddress()),r=o.R.getActiveCaipNetwork(),n=a.ConnectionController._getClient();if(!e)throw Error("SIWX is not enabled");if(!t)throw Error("No ActiveCaipAddress found");if(!r)throw Error("No ActiveCaipNetwork or client found");if(!n)throw Error("No ConnectionController client found");try{let s=await e.createMessage({chainId:r.caipNetworkId,accountAddress:t}),o=s.toString();c.ConnectorController.getConnectorId(r.chainNamespace)===i.b.CONNECTOR_ID.AUTH&&d.RouterController.pushTransactionStack({view:null,goBack:!1,replace:!0});let a=await n.signMessage(o);await e.addSession({data:s,message:o,signature:a}),u.I.close(),l.X.sendEvent({type:"track",event:"SIWX_AUTH_SUCCESS",properties:this.getSIWXEventProperties()})}catch(t){let e=this.getSIWXEventProperties();u.I.state.open&&"ApproveTransaction"!==d.RouterController.state.view||await u.I.open({view:"SIWXSignMessage"}),e.isSmartAccount?p.SnackController.showError("This application might not support Smart Accounts"):p.SnackController.showError("Signature declined"),l.X.sendEvent({type:"track",event:"SIWX_AUTH_ERROR",properties:e}),console.error("SWIXUtil:requestSignMessage",t)}},async cancelSignMessage(){try{let e=this.getSIWX();e?.getRequired?.()?await a.ConnectionController.disconnect():u.I.close(),d.RouterController.reset("Connect"),l.X.sendEvent({event:"CLICK_CANCEL_SIWX",type:"track",properties:this.getSIWXEventProperties()})}catch(e){console.error("SIWXUtil:cancelSignMessage",e)}},async getSessions(){let e=h.OptionsController.state.siwx,t=f.j.getPlainAddress(o.R.getActiveCaipAddress()),r=o.R.getActiveCaipNetwork();return e&&t&&r?e.getSessions(r.caipNetworkId,t):[]},async isSIWXCloseDisabled(){let e=this.getSIWX();if(e){let t="ApproveTransaction"===d.RouterController.state.view,r="SIWXSignMessage"===d.RouterController.state.view;
1if(t||r)return e.getRequired?.()&&0===(await this.getSessions()).length}return!1},async universalProviderAuthenticate({universalProvider:e,chains:t,methods:r}){let i=g.getSIWX(),n=new Set(t.map(e=>e.split(":")[0]));if(!i||1!==n.size||!n.has("eip155"))return!1;let a=await i.createMessage({chainId:o.R.getActiveCaipNetwork()?.caipNetworkId||"",accountAddress:""}),c=await e.authenticate({nonce:a.nonce,domain:a.domain,uri:a.uri,exp:a.expirationTime,iat:a.issuedAt,nbf:a.notBefore,requestId:a.requestId,version:a.version,resources:a.resources,statement:a.statement,chainId:a.chainId,methods:r,chains:[a.chainId,...t.filter(e=>e!==a.chainId)]});if(p.SnackController.showLoading("Authenticating...",{autoClose:!1}),s.AccountController.setConnectedWalletInfo({...c.session.peer.metadata,name:c.session.peer.metadata.name,icon:c.session.peer.metadata.icons?.[0],type:"WALLET_CONNECT"},Array.from(n)[0]),c?.auths?.length){let t=c.auths.map(t=>{let r=e.client.formatAuthMessage({request:t.p,iss:t.p.iss});return{data:{...t.p,accountAddress:t.p.iss.split(":").slice(-1).join(""),chainId:t.p.iss.split(":").slice(2,4).join(":"),uri:t.p.aud,version:t.p.version||a.version,expirationTime:t.p.exp,issuedAt:t.p.iat,notBefore:t.p.nbf},message:r,signature:t.s.s,cacao:t}});try{await i.setSessions(t),l.X.sendEvent({type:"track",event:"SIWX_AUTH_SUCCESS",properties:g.getSIWXEventProperties()})}catch(t){throw console.error("SIWX:universalProviderAuth - failed to set sessions",t),l.X.sendEvent({type:"track",event:"SIWX_AUTH_ERROR",properties:g.getSIWXEventProperties()}),await e.disconnect().catch(console.error),t}finally{p.SnackController.hide()}}return!0},getSIWXEventProperties(){let e=o.R.state.activeChain;return{network:o.R.state.activeCaipNetwork?.caipNetworkId||"",isSmartAccount:s.AccountController.state.preferredAccountTypes?.[e]===n.y_.ACCOUNT_TYPES.SMART_ACCOUNT}},async clearSessions(){let e=this.getSIWX();e&&await e.setSessions([])}}},24369:function(e,t,r){"use strict";r.d(t,{y:function(){return c}});var i=r(78008),n=r(29427),s=r(50035),o=r(56941);let a={createBalance(e,t){let r={name:e.metadata.name||"",symbol:e.metadata.symbol||"",decimals:e.metadata.decimals||0,value:e.metadata.value||0,price:e.metadata.price||0,iconUrl:e.metadata.iconUrl||""};return{name:r.name,symbol:r.symbol,chainId:t,address:"native"===e.address?void 0:this.convertAddressToCAIP10Address(e.address,t),value:r.value,price:r.price,quantity:{decimals:r.decimals.toString(),numeric:this.convertHexToBalance({hex:e.balance,decimals:r.decimals})},iconUrl:r.iconUrl}},convertHexToBalance:({hex:e,decimals:t})=>(function(e,t){let r=e.toString(),i=r.startsWith("-");i&&(r=r.slice(1));let[n,s]=[(r=r.padStart(t,"0")).slice(0,r.length-t),r.slice(r.length-t)];return s=s.replace(/(0+)$/,""),`${i?"-":""}${n||"0"}${s?`.${s}`:""}`})(BigInt(e),t),convertAddressToCAIP10Address:(e,t)=>`${t}:${e}`,createCAIP2ChainId:(e,t)=>`${t}:${parseInt(e,16)}`,getChainIdHexFromCAIP2ChainId(e){let t=e.split(":");if(t.length<2||!t[1])return"0x0";let r=parseInt(t[1],10);return isNaN(r)?"0x0":`0x${r.toString(16)}`},isWalletGetAssetsResponse(e){return"object"==typeof e&&null!==e&&Object.values(e).every(e=>Array.isArray(e)&&e.every(e=>this.isValidAsset(e)))},isValidAsset:e=>"object"==typeof e&&null!==e&&"string"==typeof e.address&&"string"==typeof e.balance&&("ERC20"===e.type||"NATIVE"===e.type)&&"object"==typeof e.metadata&&null!==e.metadata&&"string"==typeof e.metadata.name&&"string"==typeof e.metadata.symbol&&"number"==typeof e.metadata.decimals&&"number"==typeof e.metadata.price&&"string"==typeof e.metadata.iconUrl},c={async getMyTokensWithBalance(e){let t=i.AccountController.state.address,r=s.R.state.activeCaipNetwork;if(!t||!r)return[];if("eip155"===r.chainNamespace){let e=await this.getEIP155Balances(t,r);if(e)return this.filterLowQualityTokens(e)}let o=await n.L.getBalance(t,r.caipNetworkId,e);return this.filterLowQualityTokens(o.balances)},async getEIP155Balances(e,t){try{let r=a.getChainIdHexFromCAIP2ChainId(t.caipNetworkId),i=await o.ConnectionController.getCapabilities(e);if(!i?.[r]?.assetDiscovery?.supported)return null;
1let n=await o.ConnectionController.walletGetAssets({account:e,chainFilter:[r]});if(!a.isWalletGetAssetsResponse(n))return null;return(n[r]||[]).map(e=>a.createBalance(e,t.caipNetworkId))}catch(e){return null}},filterLowQualityTokens:e=>e.filter(e=>"0"!==e.quantity.decimals),mapBalancesToSwapTokens:e=>e?.map(e=>({...e,address:e?.address?e.address:s.R.getActiveNetworkTokenAddress(),decimals:parseInt(e.quantity.decimals,10),logoUri:e.iconUrl,eip2612:!1}))||[]}},84140:function(e,t,r){"use strict";r.d(t,{M:function(){return n}});var i=r(31293);let n={cacheExpiry:{portfolio:3e4,nativeBalance:3e4,ens:3e5,identity:3e5},isCacheExpired:(e,t)=>Date.now()-e>t,getActiveNetworkProps(){let e=n.getActiveNamespace(),t=n.getActiveCaipNetworkId(),r=t?t.split(":")[1]:void 0;return{namespace:e,caipNetworkId:t,chainId:r?isNaN(Number(r))?r:Number(r):void 0}},setWalletConnectDeepLink({name:e,href:t}){try{i.mr.setItem(i.uJ.DEEPLINK_CHOICE,JSON.stringify({href:t,name:e}))}catch{console.info("Unable to set WalletConnect deep link")}},getWalletConnectDeepLink(){try{let e=i.mr.getItem(i.uJ.DEEPLINK_CHOICE);if(e)return JSON.parse(e)}catch{console.info("Unable to get WalletConnect deep link")}},deleteWalletConnectDeepLink(){try{i.mr.removeItem(i.uJ.DEEPLINK_CHOICE)}catch{console.info("Unable to delete WalletConnect deep link")}},setActiveNamespace(e){try{i.mr.setItem(i.uJ.ACTIVE_NAMESPACE,e)}catch{console.info("Unable to set active namespace")}},setActiveCaipNetworkId(e){try{i.mr.setItem(i.uJ.ACTIVE_CAIP_NETWORK_ID,e),n.setActiveNamespace(e.split(":")[0])}catch{console.info("Unable to set active caip network id")}},getActiveCaipNetworkId(){try{return i.mr.getItem(i.uJ.ACTIVE_CAIP_NETWORK_ID)}catch{console.info("Unable to get active caip network id");return}},deleteActiveCaipNetworkId(){try{i.mr.removeItem(i.uJ.ACTIVE_CAIP_NETWORK_ID)}catch{console.info("Unable to delete active caip network id")}},deleteConnectedConnectorId(e){try{let t=(0,i.Vk)(e);i.mr.removeItem(t)}catch{console.info("Unable to delete connected connector id")}},setAppKitRecent(e){try{let t=n.getRecentWallets();t.find(t=>t.id===e.id)||(t.unshift(e),t.length>2&&t.pop(),i.mr.setItem(i.uJ.RECENT_WALLETS,JSON.stringify(t)))}catch{console.info("Unable to set AppKit recent")}},getRecentWallets(){try{let e=i.mr.getItem(i.uJ.RECENT_WALLETS);return e?JSON.parse(e):[]}catch{console.info("Unable to get AppKit recent")}return[]},setConnectedConnectorId(e,t){try{let r=(0,i.Vk)(e);i.mr.setItem(r,t)}catch{console.info("Unable to set Connected Connector Id")}},getActiveNamespace(){try{return i.mr.getItem(i.uJ.ACTIVE_NAMESPACE)}catch{console.info("Unable to get active namespace")}},getConnectedConnectorId(e){if(e)try{let t=(0,i.Vk)(e);return i.mr.getItem(t)}catch(t){console.info("Unable to get connected connector id in namespace ",e)}},setConnectedSocialProvider(e){try{i.mr.setItem(i.uJ.CONNECTED_SOCIAL,e)}catch{console.info("Unable to set connected social provider")}},getConnectedSocialProvider(){try{return i.mr.getItem(i.uJ.CONNECTED_SOCIAL)}catch{console.info("Unable to get connected social provider")}},deleteConnectedSocialProvider(){try{i.mr.removeItem(i.uJ.CONNECTED_SOCIAL)}catch{console.info("Unable to delete connected social provider")}},getConnectedSocialUsername(){try{return i.mr.getItem(i.uJ.CONNECTED_SOCIAL_USERNAME)}catch{console.info("Unable to get connected social username")}},getStoredActiveCaipNetworkId(){let e=i.mr.getItem(i.uJ.ACTIVE_CAIP_NETWORK_ID);return e?.split(":")?.[1]},setConnectionStatus(e){try{i.mr.setItem(i.uJ.CONNECTION_STATUS,e)}catch{console.info("Unable to set connection status")}},getConnectionStatus(){try{return i.mr.getItem(i.uJ.CONNECTION_STATUS)}catch{return}},getConnectedNamespaces(){try{let e=i.mr.getItem(i.uJ.CONNECTED_NAMESPACES);if(!e?.length)return[];return e.split(",")}catch{return[]}},setConnectedNamespaces(e){try{let t=Array.from(new Set(e));i.mr.setItem(i.uJ.CONNECTED_NAMESPACES,t.join(","))}catch{console.info("Unable to set namespaces in storage")}},addConnectedNamespace(e){try{let t=n.getConnectedNamespaces();t.includes(e)||(t.push(e),n.setConnectedNamespaces(t))}catch{console.info("Unable to add connected namespace")}},removeConnectedNamespace(e){try{let t=n.getConnectedNamespaces(),r=t.indexOf(e);r>-1&&(t.splice(r,1),n.setConnectedNamespaces(t))}catch{console.info("Unable to remove connected namespace")}},getTelegramSocialProvider(){try{return i.mr.getItem(i.uJ.TELEGRAM_SOCIAL_PROVIDER)}catch{return console.info("Unable to get telegram social provider"),null}},setTelegramSocialProvider(e){try{i.mr.setItem(i.uJ.TELEGRAM_SOCIAL_PROVIDER,e)}catch{console.info("Unable to set telegram social provider")}},removeTelegramSocialProvider(){try{i.mr.removeItem(i.uJ.TELEGRAM_SOCIAL_PROVIDER)}catch{console.info("Unable to remove telegram social provider")}},getBalanceCache(){let e={};try{let t=i.mr.getItem(i.uJ.PORTFOLIO_CACHE);e=t?JSON.parse(t):{}}catch{console.info("Unable to get balance cache")}return e},removeAddressFromBalanceCache(e){try{let t=n.getBalanceCache();i.mr.setItem(i.uJ.PORTFOLIO_CACHE,JSON.stringify({...t,[e]:void 0}))}catch{console.info("Unable to remove address from balance cache",e)}},getBalanceCacheForCaipAddress(e){try{let t=n.getBalanceCache()[e];if(t&&!this.isCacheExpired(t.timestamp,this.cacheExpiry.portfolio))return t.balance;n.removeAddressFromBalanceCache(e)}catch{console.info("Unable to get balance cache for address",e)}},updateBalanceCache(e){try{let t=n.getBalanceCache();t[e.caipAddress]=e,i.mr.setItem(i.uJ.PORTFOLIO_CACHE,JSON.stringify(t))}catch{console.info("Unable to update balance cache",e)}},getNativeBalanceCache(){let e={};try{let t=i.mr.getItem(i.uJ.NATIVE_BALANCE_CACHE);e=t?JSON.parse(t):{}}catch{console.info("Unable to get balance cache")}return e},removeAddressFromNativeBalanceCache(e){try{let t=n.getBalanceCache();i.mr.setItem(i.uJ.NATIVE_BALANCE_CACHE,JSON.stringify({...t,[e]:void 0}))}catch{console.info("Unable to remove address from balance cache",e)}},getNativeBalanceCacheForCaipAddress(e){try{let t=n.getNativeBalanceCache()[e];if(t&&!this.isCacheExpired(t.timestamp,this.cacheExpiry.nativeBalance))return t;console.info("Discarding cache for address",e),n.removeAddressFromBalanceCache(e)}catch{console.info("Unable to get balance cache for address",e)}},updateNativeBalanceCache(e){try{let t=n.getNativeBalanceCache();t[e.caipAddress]=e,i.mr.setItem(i.uJ.NATIVE_BALANCE_CACHE,JSON.stringify(t))}catch{console.info("Unable to update balance cache",e)}},getEnsCache(){let e={};try{let t=i.mr.getItem(i.uJ.ENS_CACHE);e=t?JSON.parse(t):{}}catch{console.info("Unable to get ens name cache")}return e}
1,getEnsFromCacheForAddress(e){try{let t=n.getEnsCache()[e];if(t&&!this.isCacheExpired(t.timestamp,this.cacheExpiry.ens))return t.ens;n.removeEnsFromCache(e)}catch{console.info("Unable to get ens name from cache",e)}},updateEnsCache(e){try{let t=n.getEnsCache();t[e.address]=e,i.mr.setItem(i.uJ.ENS_CACHE,JSON.stringify(t))}catch{console.info("Unable to update ens name cache",e)}},removeEnsFromCache(e){try{let t=n.getEnsCache();i.mr.setItem(i.uJ.ENS_CACHE,JSON.stringify({...t,[e]:void 0}))}catch{console.info("Unable to remove ens name from cache",e)}},getIdentityCache(){let e={};try{let t=i.mr.getItem(i.uJ.IDENTITY_CACHE);e=t?JSON.parse(t):{}}catch{console.info("Unable to get identity cache")}return e},getIdentityFromCacheForAddress(e){try{let t=n.getIdentityCache()[e];if(t&&!this.isCacheExpired(t.timestamp,this.cacheExpiry.identity))return t.identity;n.removeIdentityFromCache(e)}catch{console.info("Unable to get identity from cache",e)}},updateIdentityCache(e){try{let t=n.getIdentityCache();t[e.address]={identity:e.identity,timestamp:e.timestamp},i.mr.setItem(i.uJ.IDENTITY_CACHE,JSON.stringify(t))}catch{console.info("Unable to update identity cache",e)}},removeIdentityFromCache(e){try{let t=n.getIdentityCache();i.mr.setItem(i.uJ.IDENTITY_CACHE,JSON.stringify({...t,[e]:void 0}))}catch{console.info("Unable to remove identity from cache",e)}},clearAddressCache(){try{i.mr.removeItem(i.uJ.PORTFOLIO_CACHE),i.mr.removeItem(i.uJ.NATIVE_BALANCE_CACHE),i.mr.removeItem(i.uJ.ENS_CACHE),i.mr.removeItem(i.uJ.IDENTITY_CACHE)}catch{console.info("Unable to clear address cache")}},setPreferredAccountTypes(e){try{i.mr.setItem(i.uJ.PREFERRED_ACCOUNT_TYPES,JSON.stringify(e))}catch{console.info("Unable to set preferred account types",e)}},getPreferredAccountTypes(){try{let e=i.mr.getItem(i.uJ.PREFERRED_ACCOUNT_TYPES);return JSON.parse(e)}catch{console.info("Unable to get preferred account types")}}}},29608:function(e,t,r){"use strict";r.d(t,{C:function(){return p}});var i=r(72647),n=r(68619),s=r(84140),o=r(44129),a=r(25779),c=r(56941),l=r(50035),u=r(1471),h=r(53304),d=r(74554);let p={getConnectorsByType(e,t,r){let{customWallets:i}=n.OptionsController.state,o=s.M.getRecentWallets(),a=d.J.filterOutDuplicateWallets(t),c=d.J.filterOutDuplicateWallets(r),l=e.filter(e=>"MULTI_CHAIN"===e.type),u=e.filter(e=>"ANNOUNCED"===e.type),h=e.filter(e=>"INJECTED"===e.type);return{custom:i,recent:o,external:e.filter(e=>"EXTERNAL"===e.type),multiChain:l,announced:u,injected:h,recommended:a,featured:c}},showConnector(e){let t=e.info?.rdns,r=!!t&&o.ApiController.state.excludedWallets.some(e=>!!e.rdns&&e.rdns===t),i=!!e.name&&o.ApiController.state.excludedWallets.some(t=>h.g.isLowerCaseMatch(t.name,e.name));return("INJECTED"!==e.type||(!!a.j.isMobile()||"Browser Wallet"!==e.name)&&(!!t||!!c.ConnectionController.checkInstalled())&&!r&&!i)&&("ANNOUNCED"!==e.type&&"EXTERNAL"!==e.type||!r&&!i)},getIsConnectedWithWC:()=>Array.from(l.R.state.chains.values()).some(e=>u.ConnectorController.getConnectorId(e.namespace)===i.b.CONNECTOR_ID.WALLET_CONNECT),getConnectorTypeOrder({recommended:e,featured:t,custom:r,recent:i,announced:s,injected:o,multiChain:a,external:c,overriddenConnectors:l=n.OptionsController.state.features?.connectorTypeOrder??[]}){let u=p.getIsConnectedWithWC(),h=[{type:"walletConnect",isEnabled:n.OptionsController.state.enableWalletConnect&&!u},{type:"recent",isEnabled:i.length>0},{type:"injected",isEnabled:[...o,...s,...a].length>0},{type:"featured",isEnabled:t.length>0},{type:"custom",isEnabled:r&&r.length>0},{type:"external",isEnabled:c.length>0},{type:"recommended",isEnabled:e.length>0}].filter(e=>e.isEnabled),d=new Set(h.map(e=>e.type)),f=l.filter(e=>d.has(e)).map(e=>({type:e,isEnabled:!0})),g=h.filter(({type:e})=>!f.some(({type:t})=>t===e));return Array.from(new Set([...f,...g].map(({type:e})=>e)))}}},44504:function(e,t,r){"use strict";r.d(t,{b:function(){return n}});var i=r(25566);let n={ACCOUNT_TABS:[{label:"Tokens"},{label:"NFTs"},{label:"Activity"}],SECURE_SITE_ORIGIN:(void 0!==i&&void 0!==i.env?i.env.NEXT_PUBLIC_SECURE_SITE_ORIGIN:void 0)||"https://secure.walletconnect.org",VIEW_DIRECTION:{Next:"next",Prev:"prev"},DEFAULT_CONNECT_METHOD_ORDER:["email","social","wallet"],ANIMATION_DURATIONS:{HeaderText:120,ModalHeight:150,ViewTransition:150}}},74554:function(e,t,r){"use strict";r.d(t,{J:function(){return h}});var i=r(68619),n=r(1471),s=r(84140),o=r(25779),a=r(44129),c=r(53304),l=r(29608),u=r(44504);let h={filterOutDuplicatesByRDNS(e){let t=i.OptionsController.state.enableEIP6963?n.ConnectorController.state.connectors:[],r=s.M.getRecentWallets(),a=t.map(e=>
1e.info?.rdns).filter(Boolean),c=r.map(e=>e.rdns).filter(Boolean),l=a.concat(c);if(l.includes("io.metamask.mobile")&&o.j.isMobile()){let e=l.indexOf("io.metamask.mobile");l[e]="io.metamask"}return e.filter(e=>!l.includes(String(e?.rdns)))},filterOutDuplicatesByIds(e){let t=n.ConnectorController.state.connectors.filter(e=>"ANNOUNCED"===e.type||"INJECTED"===e.type),r=s.M.getRecentWallets(),i=t.map(e=>e.explorerId),o=r.map(e=>e.id),a=i.concat(o);return e.filter(e=>!a.includes(e?.id))},filterOutDuplicateWallets(e){let t=this.filterOutDuplicatesByRDNS(e);return this.filterOutDuplicatesByIds(t)},markWalletsAsInstalled(e){let{connectors:t}=n.ConnectorController.state,r=t.filter(e=>"ANNOUNCED"===e.type).reduce((e,t)=>(t.info?.rdns&&(e[t.info.rdns]=!0),e),{});return e.map(e=>({...e,installed:!!e.rdns&&!!r[e.rdns??""]})).sort((e,t)=>Number(t.installed)-Number(e.installed))},getConnectOrderMethod(e,t){let r=e?.connectMethodsOrder||i.OptionsController.state.features?.connectMethodsOrder,s=t||n.ConnectorController.state.connectors;if(r)return r;let{injected:o,announced:c}=l.C.getConnectorsByType(s,a.ApiController.state.recommended,a.ApiController.state.featured),h=o.filter(l.C.showConnector),d=c.filter(l.C.showConnector);return h.length||d.length?["wallet","email","social"]:u.b.DEFAULT_CONNECT_METHOD_ORDER},isExcluded(e){let t=!!e.rdns&&a.ApiController.state.excludedWallets.some(t=>t.rdns===e.rdns),r=!!e.name&&a.ApiController.state.excludedWallets.some(t=>c.g.isLowerCaseMatch(t.name,e.name));return t||r}}},44239:function(e,t,r){"use strict";r.d(t,{kj:function(){return i},AI:function(){return l},Hg:function(){return s.H},Mo:function(){return u.M},n:function(){return n.n},Hs:function(){return n.Hs},R:function(){return n.R}});let i={interpolate(e,t,r){if(2!==e.length||2!==t.length)throw Error("inputRange and outputRange must be an array of length 2");let i=e[0]||0,n=e[1]||0,s=t[0]||0,o=t[1]||0;return r<i?s:r>n?o:(o-s)/(n-i)*(r-i)+s}};var n=r(55308),s=r(66192),o=r(84990);let a=["receive","deposit","borrow","claim"],c=["withdraw","repay","burn"],l={getTransactionGroupTitle(e,t){let r=o.E.getYear(),i=o.E.getMonthNameByIndex(t);return e===r?i:`${i} ${e}`},getTransactionImages(e){let[t,r]=e,i=!!t&&e?.every(e=>!!e.nft_info),n=e?.length>1;return e?.length!==2||i?n?e.map(e=>this.getTransactionImage(e)):[this.getTransactionImage(t)]:[this.getTransactionImage(t),this.getTransactionImage(r)]},getTransactionImage:e=>({type:l.getTransactionTransferTokenType(e),url:l.getTransactionImageURL(e)}),getTransactionImageURL(e){let t;let r=!!e?.nft_info,i=!!e?.fungible_info;return e&&r?t=e?.nft_info?.content?.preview?.url:e&&i&&(t=e?.fungible_info?.icon?.url),t},getTransactionTransferTokenType:e=>e?.fungible_info?"FUNGIBLE":e?.nft_info?"NFT":void 0,getTransactionDescriptions(e){let t=e?.metadata?.operationType,r=e?.transfers,i=e?.transfers?.length>0,n=e?.transfers?.length>1,o=i&&r?.every(e=>!!e?.fungible_info),[l,u]=r,h=this.getTransferDescription(l);if(this.getTransferDescription(u),!i)return("send"===t||"receive"===t)&&o?[h=s.H.getTruncateString({string:e?.metadata.sentFrom,charsStart:4,charsEnd:6,truncate:"middle"}),s.H.getTruncateString({string:e?.metadata.sentTo,charsStart:4,charsEnd:6,truncate:"middle"})]:[e.metadata.status];if(n)return r.map(e=>this.getTransferDescription(e));let d="";return a.includes(t)?d="+":c.includes(t)&&(d="-"),[h=d.concat(h)]},getTransferDescription(e){let t="";return e&&(e?.nft_info?t=e?.nft_info?.name||"-":e?.fungible_info&&(t=this.getFungibleTransferDescription(e)||"-")),t},getFungibleTransferDescription(e){return e?[this.getQuantityFixedValue(e?.quantity.numeric),e?.fungible_info?.symbol].join(" ").trim():null},getQuantityFixedValue:e=>e?parseFloat(e).toFixed(3):null};var u=r(77547)},55308:function(e,t,r){"use strict";let i,n,s;r.d(t,{Bp:function(){return f},ET:function(){return d},Hs:function(){return l},R:function(){return u},ZM:function(){return p},n:function(){return c}});var o=r(11469),a=r(40722);function c(e,t){i=document.createElement("style"),n=document.createElement("style"),s=document.createElement("style"),i.textContent=h(e).core.cssText,n.textContent=h(e).dark.cssText,s.textContent=h(e).light.cssText,document.head.appendChild(i),document.head.appendChild(n),document.head.appendChild(s),l(t)}function l(e){n&&s&&("light"===e?(n.removeAttribute("media"),s.media="enabled"):(s.removeAttribute("media"),n.media="enabled"))}function u(e){i&&n&&s&&(i.textContent=h(e).core.cssText,n.textContent=h(e).dark.cssText,s.textContent=h(e).light.cssText)}function h(e){return{core:(0,o.iv)`
2      @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
3      @keyframes w3m-shake {
4        0% {
5          transform: scale(1) rotate(0deg);
6        }
7        20% {
8          transform: scale(1) rotate(-1deg);
9        }
10        40% {
11          transform: scale(1) rotate(1.5deg);
12        }
13        60% {
14          transform: scale(1) rotate(-1.5deg);
15        }
16        80% {
17          transform: scale(1) rotate(1deg);
18        }
19        100% {
20          transform: scale(1) rotate(0deg);
21        }
22      }
23      @keyframes w3m-iframe-fade-out {
24        0% {
25          opacity: 1;
26        }
27        100% {
28          opacity: 0;
29        }
30      }
31      @keyframes w3m-iframe-zoom-in {
32        0% {
33          transform: translateY(50px);
34          opacity: 0;
35        }
36        100% {
37          transform: translateY(0px);
38          opacity: 1;
39        }
40      }
41      @keyframes w3m-iframe-zoom-in-mobile {
42        0% {
43          transform: scale(0.95);
44          opacity: 0;
45        }
46        100% {
47          transform: scale(1);
48          opacity: 1;
49        }
50      }
51      :root {
52        --w3m-modal-width: 360px;
53        --w3m-color-mix-strength: ${(0,o.$m)(e?.["--w3m-color-mix-strength"]?`${e["--w3m-color-mix-strength"]}%`:"0%")};
54        --w3m-font-family: ${(0,o.$m)(e?.["--w3m-font-family"]||"Inter, Segoe UI, Roboto, Oxygen, Ubuntu, Cantarell, Fira Sans, Droid Sans, Helvetica Neue, sans-serif;")};
55        --w3m-font-size-master: ${(0,o.$m)(e?.["--w3m-font-size-master"]||"10px")};
56        --w3m-border-radius-master: ${(0,o.$m)(e?.["--w3m-border-radius-master"]||"4px")};
57        --w3m-z-index: ${(0,o.$m)(e?.["--w3m-z-index"]||
vendor: 15,824 bytes, lines 57-483
57999)};
58
59        --wui-font-family: var(--w3m-font-family);
60
61        --wui-font-size-mini: calc(var(--w3m-font-size-master) * 0.8);
62        --wui-font-size-micro: var(--w3m-font-size-master);
63        --wui-font-size-tiny: calc(var(--w3m-font-size-master) * 1.2);
64        --wui-font-size-small: calc(var(--w3m-font-size-master) * 1.4);
65        --wui-font-size-paragraph: calc(var(--w3m-font-size-master) * 1.6);
66        --wui-font-size-medium: calc(var(--w3m-font-size-master) * 1.8);
67        --wui-font-size-large: calc(var(--w3m-font-size-master) * 2);
68        --wui-font-size-title-6: calc(var(--w3m-font-size-master) * 2.2);
69        --wui-font-size-medium-title: calc(var(--w3m-font-size-master) * 2.4);
70        --wui-font-size-2xl: calc(var(--w3m-font-size-master) * 4);
71
72        --wui-border-radius-5xs: var(--w3m-border-radius-master);
73        --wui-border-radius-4xs: calc(var(--w3m-border-radius-master) * 1.5);
74        --wui-border-radius-3xs: calc(var(--w3m-border-radius-master) * 2);
75        --wui-border-radius-xxs: calc(var(--w3m-border-radius-master) * 3);
76        --wui-border-radius-xs: calc(var(--w3m-border-radius-master) * 4);
77        --wui-border-radius-s: calc(var(--w3m-border-radius-master) * 5);
78        --wui-border-radius-m: calc(var(--w3m-border-radius-master) * 7);
79        --wui-border-radius-l: calc(var(--w3m-border-radius-master) * 9);
80        --wui-border-radius-3xl: calc(var(--w3m-border-radius-master) * 20);
81
82        --wui-font-weight-light: 400;
83        --wui-font-weight-regular: 500;
84        --wui-font-weight-medium: 600;
85        --wui-font-weight-bold: 700;
86
87        --wui-letter-spacing-2xl: -1.6px;
88        --wui-letter-spacing-medium-title: -0.96px;
89        --wui-letter-spacing-title-6: -0.88px;
90        --wui-letter-spacing-large: -0.8px;
91        --wui-letter-spacing-medium: -0.72px;
92        --wui-letter-spacing-paragraph: -0.64px;
93        --wui-letter-spacing-small: -0.56px;
94        --wui-letter-spacing-tiny: -0.48px;
95        --wui-letter-spacing-micro: -0.2px;
96        --wui-letter-spacing-mini: -0.16px;
97
98        --wui-spacing-0: 0px;
99        --wui-spacing-4xs: 2px;
100        --wui-spacing-3xs: 4px;
101        --wui-spacing-xxs: 6px;
102        --wui-spacing-2xs: 7px;
103        --wui-spacing-xs: 8px;
104        --wui-spacing-1xs: 10px;
105        --wui-spacing-s: 12px;
106        --wui-spacing-m: 14px;
107        --wui-spacing-l: 16px;
108        --wui-spacing-2l: 18px;
109        --wui-spacing-xl: 20px;
110        --wui-spacing-xxl: 24px;
111        --wui-spacing-2xl: 32px;
112        --wui-spacing-3xl: 40px;
113        --wui-spacing-4xl: 90px;
114        --wui-spacing-5xl: 95px;
115
116        --wui-icon-box-size-xxs: 14px;
117        --wui-icon-box-size-xs: 20px;
118        --wui-icon-box-size-sm: 24px;
119        --wui-icon-box-size-md: 32px;
120        --wui-icon-box-size-mdl: 36px;
121        --wui-icon-box-size-lg: 40px;
122        --wui-icon-box-size-2lg: 48px;
123        --wui-icon-box-size-xl: 64px;
124
125        --wui-icon-size-inherit: inherit;
126        --wui-icon-size-xxs: 10px;
127        --wui-icon-size-xs: 12px;
128        --wui-icon-size-sm: 14px;
129        --wui-icon-size-md: 16px;
130        --wui-icon-size-mdl: 18px;
131        --wui-icon-size-lg: 20px;
132        --wui-icon-size-xl: 24px;
133        --wui-icon-size-xxl: 28px;
134
135        --wui-wallet-image-size-inherit: inherit;
136        --wui-wallet-image-size-sm: 40px;
137        --wui-wallet-image-size-md: 56px;
138        --wui-wallet-image-size-lg: 80px;
139
140        --wui-visual-size-size-inherit: inherit;
141        --wui-visual-size-sm: 40px;
142        --wui-visual-size-md: 55px;
143        --wui-visual-size-lg: 80px;
144
145        --wui-box-size-md: 100px;
146        --wui-box-size-lg: 120px;
147
148        --wui-ease-out-power-2: cubic-bezier(0, 0, 0.22, 1);
149        --wui-ease-out-power-1: cubic-bezier(0, 0, 0.55, 1);
150
151        --wui-ease-in-power-3: cubic-bezier(0.66, 0, 1, 1);
152        --wui-ease-in-power-2: cubic-bezier(0.45, 0, 1, 1);
153        --wui-ease-in-power-1: cubic-bezier(0.3, 0, 1, 1);
154
155        --wui-ease-inout-power-1: cubic-bezier(0.45, 0, 0.55, 1);
156
157        --wui-duration-lg: 200ms;
158        --wui-duration-md: 125ms;
159        --wui-duration-sm: 75ms;
160
161        --wui-path-network-sm: path(
162          'M15.4 2.1a5.21 5.21 0 0 1 5.2 0l11.61 6.7a5.21 5.21 0 0 1 2.61 4.52v13.4c0 1.87-1 3.59-2.6 4.52l-11.61 6.7c-1.62.93-3.6.93-5.22 0l-11.6-6.7a5.21 5.21 0 0 1-2.61-4.51v-13.4c0-1.87 1-3.6 2.6-4.52L15.4 2.1Z'
163        );
164
165        --wui-path-network-md: path(
166          'M43.4605 10.7248L28.0485 1.61089C25.5438 0.129705 22.4562 0.129705 19.9515 1.61088L4.53951 10.7248C2.03626 12.2051 0.5 14.9365 0.5 17.886V36.1139C0.5 39.0635 2.03626 41.7949 4.53951 43.2752L19.9515 52.3891C22.4562 53.8703 25.5438 53.8703 28.0485 52.3891L43.4605 43.2752C45.9637 41.7949 47.5 39.0635 47.5 36.114V17.8861C47.5 14.9365 45.9637 12.2051 43.4605 10.7248Z'
167        );
168
169        --wui-path-network-lg: path(
170          'M78.3244 18.926L50.1808 2.45078C45.7376 -0.150261 40.2624 -0.150262 35.8192 2.45078L7.6756 18.926C3.23322 21.5266 0.5 26.3301 0.5 31.5248V64.4752C0.5 69.6699 3.23322 74.4734 7.6756 77.074L35.8192 93.5492C40.2624 96.1503 45.7376 96.1503 50.1808 93.5492L78.3244 77.074C82.7668 74.4734 85.5 69.6699 85.5 64.4752V31.5248C85.5 26.3301 82.7668 21.5266 78.3244 18.926Z'
171        );
172
173        --wui-width-network-sm: 36px;
174        --wui-width-network-md: 48px;
175        --wui-width-network-lg: 86px;
176
177        --wui-height-network-sm: 40px;
178        --wui-height-network-md: 54px;
179        --wui-height-network-lg: 96px;
180
181        --wui-icon-size-network-xs: 12px;
182        --wui-icon-size-network-sm: 16px;
183        --wui-icon-size-network-md: 24px;
184        --wui-icon-size-network-lg: 42px;
185
186        --wui-color-inherit: inherit;
187
188        --wui-color-inverse-100: #fff;
189        --wui-color-inverse-000: #000;
190
191        --wui-cover: rgba(20, 20, 20, 0.8);
192
193        --wui-color-modal-bg: var(--wui-color-modal-bg-base);
194
195        --wui-color-accent-100: var(--wui-color-accent-base-100);
196        --wui-color-accent-090: var(--wui-color-accent-base-090);
197        --wui-color-accent-080: var(--wui-color-accent-base-080);
198
199        --wui-color-success-100: var(--wui-color-success-base-100);
200        --wui-color-success-125: var(--wui-color-success-base-125);
201
202        --wui-color-warning-100: var(--wui-color-warning-base-100);
203
204        --wui-color-error-100: var(--wui-color-error-base-100);
205        --wui-color-error-125: var(--wui-color-error-base-125);
206
207        --wui-color-blue-100: var(--wui-color-blue-base-100);
208        --wui-color-blue-90: var(--wui-color-blue-base-90);
209
210        --wui-icon-box-bg-error-100: var(--wui-icon-box-bg-error-base-100);
211        --wui-icon-box-bg-blue-100: var(--wui-icon-box-bg-blue-base-100);
212        --wui-icon-box-bg-success-100: var(--wui-icon-box-bg-success-base-100);
213        --wui-icon-box-bg-inverse-100: var(--wui-icon-box-bg-inverse-base-100);
214
215        --wui-all-wallets-bg-100: var(--wui-all-wallets-bg-100);
216
217        --wui-avatar-border: var(--wui-avatar-border-base);
218
219        --wui-thumbnail-border: var(--wui-thumbnail-border-base);
220
221        --wui-wallet-button-bg: var(--wui-wallet-button-bg-base);
222
223        --wui-box-shadow-blue: var(--wui-color-accent-glass-020);
224      }
225
226      @supports (background: color-mix(in srgb, white 50%, black)) {
227        :root {
228          --wui-color-modal-bg: color-mix(
229            in srgb,
230            var(--w3m-color-mix) var(--w3m-color-mix-strength),
231            var(--wui-color-modal-bg-base)
232          );
233
234          --wui-box-shadow-blue: color-mix(in srgb, var(--wui-color-accent-100) 20%, transparent);
235
236          --wui-color-accent-100: color-mix(
237            in srgb,
238            var(--wui-color-accent-base-100) 100%,
239            transparent
240          );
241          --wui-color-accent-090: color-mix(
242            in srgb,
243            var(--wui-color-accent-base-100) 90%,
244            transparent
245          );
246          --wui-color-accent-080: color-mix(
247            in srgb,
248            var(--wui-color-accent-base-100) 80%,
249            transparent
250          );
251          --wui-color-accent-glass-090: color-mix(
252            in srgb,
253            var(--wui-color-accent-base-100) 90%,
254            transparent
255          );
256          --wui-color-accent-glass-080: color-mix(
257            in srgb,
258            var(--wui-color-accent-base-100) 80%,
259            transparent
260          );
261          --wui-color-accent-glass-020: color-mix(
262            in srgb,
263            var(--wui-color-accent-base-100) 20%,
264            transparent
265          );
266          --wui-color-accent-glass-015: color-mix(
267            in srgb,
268            var(--wui-color-accent-base-100) 15%,
269            transparent
270          );
271          --wui-color-accent-glass-010: color-mix(
272            in srgb,
273            var(--wui-color-accent-base-100) 10%,
274            transparent
275          );
276          --wui-color-accent-glass-005: color-mix(
277            in srgb,
278            var(--wui-color-accent-base-100) 5%,
279            transparent
280          );
281          --wui-color-accent-002: color-mix(
282            in srgb,
283            var(--wui-color-accent-base-100) 2%,
284            transparent
285          );
286
287          --wui-color-fg-100: color-mix(
288            in srgb,
289            var(--w3m-color-mix) var(--w3m-color-mix-strength),
290            var(--wui-color-fg-100)
291          );
292          --wui-color-fg-125: color-mix(
293            in srgb,
294            var(--w3m-color-mix) var(--w3m-color-mix-strength),
295            var(--wui-color-fg-125)
296          );
297          --wui-color-fg-150: color-mix(
298            in srgb,
299            var(--w3m-color-mix) var(--w3m-color-mix-strength),
300            var(--wui-color-fg-150)
301          );
302          --wui-color-fg-175: color-mix(
303            in srgb,
304            var(--w3m-color-mix) var(--w3m-color-mix-strength),
305            var(--wui-color-fg-175)
306          );
307          --wui-color-fg-200: color-mix(
308            in srgb,
309            var(--w3m-color-mix) var(--w3m-color-mix-strength),
310            var(--wui-color-fg-200)
311          );
312          --wui-color-fg-225: color-mix(
313            in srgb,
314            var(--w3m-color-mix) var(--w3m-color-mix-strength),
315            var(--wui-color-fg-225)
316          );
317          --wui-color-fg-250: color-mix(
318            in srgb,
319            var(--w3m-color-mix) var(--w3m-color-mix-strength),
320            var(--wui-color-fg-250)
321          );
322          --wui-color-fg-275: color-mix(
323            in srgb,
324            var(--w3m-color-mix) var(--w3m-color-mix-strength),
325            var(--wui-color-fg-275)
326          );
327          --wui-color-fg-300: color-mix(
328            in srgb,
329            var(--w3m-color-mix) var(--w3m-color-mix-strength),
330            var(--wui-color-fg-300)
331          );
332          --wui-color-fg-325: color-mix(
333            in srgb,
334            var(--w3m-color-mix) var(--w3m-color-mix-strength),
335            var(--wui-color-fg-325)
336          );
337          --wui-color-fg-350: color-mix(
338            in srgb,
339            var(--w3m-color-mix) var(--w3m-color-mix-strength),
340            var(--wui-color-fg-350)
341          );
342
343          --wui-color-bg-100: color-mix(
344            in srgb,
345            var(--w3m-color-mix) var(--w3m-color-mix-strength),
346            var(--wui-color-bg-100)
347          );
348          --wui-color-bg-125: color-mix(
349            in srgb,
350            var(--w3m-color-mix) var(--w3m-color-mix-strength),
351            var(--wui-color-bg-125)
352          );
353          --wui-color-bg-150: color-mix(
354            in srgb,
355            var(--w3m-color-mix) var(--w3m-color-mix-strength),
356            var(--wui-color-bg-150)
357          );
358          --wui-color-bg-175: color-mix(
359            in srgb,
360            var(--w3m-color-mix) var(--w3m-color-mix-strength),
361            var(--wui-color-bg-175)
362          );
363          --wui-color-bg-200: color-mix(
364            in srgb,
365            var(--w3m-color-mix) var(--w3m-color-mix-strength),
366            var(--wui-color-bg-200)
367          );
368          --wui-color-bg-225: color-mix(
369            in srgb,
370            var(--w3m-color-mix) var(--w3m-color-mix-strength),
371            var(--wui-color-bg-225)
372          );
373          --wui-color-bg-250: color-mix(
374            in srgb,
375            var(--w3m-color-mix) var(--w3m-color-mix-strength),
376            var(--wui-color-bg-250)
377          );
378          --wui-color-bg-275: color-mix(
379            in srgb,
380            var(--w3m-color-mix) var(--w3m-color-mix-strength),
381            var(--wui-color-bg-275)
382          );
383          --wui-color-bg-300: color-mix(
384            in srgb,
385            var(--w3m-color-mix) var(--w3m-color-mix-strength),
386            var(--wui-color-bg-300)
387          );
388          --wui-color-bg-325: color-mix(
389            in srgb,
390            var(--w3m-color-mix) var(--w3m-color-mix-strength),
391            var(--wui-color-bg-325)
392          );
393          --wui-color-bg-350: color-mix(
394            in srgb,
395            var(--w3m-color-mix) var(--w3m-color-mix-strength),
396            var(--wui-color-bg-350)
397          );
398
399          --wui-color-success-100: color-mix(
400            in srgb,
401            var(--w3m-color-mix) var(--w3m-color-mix-strength),
402            var(--wui-color-success-base-100)
403          );
404          --wui-color-success-125: color-mix(
405            in srgb,
406            var(--w3m-color-mix) var(--w3m-color-mix-strength),
407            var(--wui-color-success-base-125)
408          );
409
410          --wui-color-warning-100: color-mix(
411            in srgb,
412            var(--w3m-color-mix) var(--w3m-color-mix-strength),
413            var(--wui-color-warning-base-100)
414          );
415
416          --wui-color-error-100: color-mix(
417            in srgb,
418            var(--w3m-color-mix) var(--w3m-color-mix-strength),
419            var(--wui-color-error-base-100)
420          );
421          --wui-color-blue-100: color-mix(
422            in srgb,
423            var(--w3m-color-mix) var(--w3m-color-mix-strength),
424            var(--wui-color-blue-base-100)
425          );
426          --wui-color-blue-90: color-mix(
427            in srgb,
428            var(--w3m-color-mix) var(--w3m-color-mix-strength),
429            var(--wui-color-blue-base-90)
430          );
431          --wui-color-error-125: color-mix(
432            in srgb,
433            var(--w3m-color-mix) var(--w3m-color-mix-strength),
434            var(--wui-color-error-base-125)
435          );
436
437          --wui-icon-box-bg-error-100: color-mix(
438            in srgb,
439            var(--w3m-color-mix) var(--w3m-color-mix-strength),
440            var(--wui-icon-box-bg-error-base-100)
441          );
442          --wui-icon-box-bg-accent-100: color-mix(
443            in srgb,
444            var(--w3m-color-mix) var(--w3m-color-mix-strength),
445            var(--wui-icon-box-bg-blue-base-100)
446          );
447          --wui-icon-box-bg-success-100: color-mix(
448            in srgb,
449            var(--w3m-color-mix) var(--w3m-color-mix-strength),
450            var(--wui-icon-box-bg-success-base-100)
451          );
452          --wui-icon-box-bg-inverse-100: color-mix(
453            in srgb,
454            var(--w3m-color-mix) var(--w3m-color-mix-strength),
455            var(--wui-icon-box-bg-inverse-base-100)
456          );
457
458          --wui-all-wallets-bg-100: color-mix(
459            in srgb,
460            var(--w3m-color-mix) var(--w3m-color-mix-strength),
461            var(--wui-all-wallets-bg-100)
462          );
463
464          --wui-avatar-border: color-mix(
465            in srgb,
466            var(--w3m-color-mix) var(--w3m-color-mix-strength),
467            var(--wui-avatar-border-base)
468          );
469
470          --wui-thumbnail-border: color-mix(
471            in srgb,
472            var(--w3m-color-mix) var(--w3m-color-mix-strength),
473            var(--wui-thumbnail-border-base)
474          );
475
476          --wui-wallet-button-bg: color-mix(
477            in srgb,
478            var(--w3m-color-mix) var(--w3m-color-mix-strength),
479            var(--wui-wallet-button-bg-base)
480          );
481        }
482      }
483    `,
483light:(0,o.iv)`
484      :root {
485        --w3m-color-mix: ${(0,o.$m)(e?.["--w3m-color-mix"]||"#fff")};
486        --w3m-accent: ${(0,o.$m)((0,a.t)(e,"dark")["--w3m-accent"])};
487        --w3m-default: #fff;
488
489        --wui-color-modal-bg-base: ${(0,o.$m)((0,a.t)(e,"dark")["--w3m-background"])};
490        --wui-color-accent-base-100: var(--w3m-accent);
491
492        --wui-color-blueberry-100: hsla(230, 100%, 67%, 1);
493        --wui-color-blueberry-090: hsla(231, 76%, 61%, 1);
494        --wui-color-blueberry-080: hsla(230, 59%, 55%, 1);
495        --wui-color-blueberry-050: hsla(231, 100%, 70%, 0.1);
496
497        --wui-color-fg-100: #e4e7e7;
498        --wui-color-fg-125: #d0d5d5;
499        --wui-color-fg-150: #a8b1b1;
500        --wui-color-fg-175: #a8b0b0;
501        --wui-color-fg-200: #949e9e;
502        --wui-color-fg-225: #868f8f;
503        --wui-color-fg-250: #788080;
504        --wui-color-fg-275: #788181;
505        --wui-color-fg-300: #6e7777;
506        --wui-color-fg-325: #9a9a9a;
507        --wui-color-fg-350: #363636;
508
509        --wui-color-bg-100: #141414;
510        --wui-color-bg-125: #191a1a;
511        --wui-color-bg-150: #1e1f1f;
512        --wui-color-bg-175: #222525;
513        --wui-color-bg-200: #272a2a;
514        --wui-color-bg-225: #2c3030;
515        --wui-color-bg-250: #313535;
516        --wui-color-bg-275: #363b3b;
517        --wui-color-bg-300: #3b4040;
518        --wui-color-bg-325: #252525;
519        --wui-color-bg-350: #ffffff;
520
521        --wui-color-success-base-100: #26d962;
522        --wui-color-success-base-125: #30a46b;
523
524        --wui-color-warning-base-100: #f3a13f;
525
526        --wui-color-error-base-100: #f25a67;
527        --wui-color-error-base-125: #df4a34;
528
529        --wui-color-blue-base-100: rgba(102, 125, 255, 1);
530        --wui-color-blue-base-90: rgba(102, 125, 255, 0.9);
531
532        --wui-color-success-glass-001: rgba(38, 217, 98, 0.01);
533        --wui-color-success-glass-002: rgba(38, 217, 98, 0.02);
534        --wui-color-success-glass-005: rgba(38, 217, 98, 0.05);
535        --wui-color-success-glass-010: rgba(38, 217, 98, 0.1);
536        --wui-color-success-glass-015: rgba(38, 217, 98, 0.15);
537        --wui-color-success-glass-020: rgba(38, 217, 98, 0.2);
538        --wui-color-success-glass-025: rgba(38, 217, 98, 0.25);
539        --wui-color-success-glass-030: rgba(38, 217, 98, 0.3);
540        --wui-color-success-glass-060: rgba(38, 217, 98, 0.6);
541        --wui-color-success-glass-080: rgba(38, 217, 98, 0.8);
542
543        --wui-color-success-glass-reown-020: rgba(48, 164, 107, 0.2);
544
545        --wui-color-warning-glass-reown-020: rgba(243, 161, 63, 0.2);
546
547        --wui-color-error-glass-001: rgba(242, 90, 103, 0.01);
548        --wui-color-error-glass-002: rgba(242, 90, 103, 0.02);
549        --wui-color-error-glass-005: rgba(242, 90, 103, 0.05);
550        --wui-color-error-glass-010: rgba(242, 90, 103, 0.1);
551        --wui-color-error-glass-015: rgba(242, 90, 103, 0.15);
552        --wui-color-error-glass-020: rgba(242, 90, 103, 0.2);
553        --wui-color-error-glass-025: rgba(242, 90, 103, 0.25);
554        --wui-color-error-glass-030: rgba(242, 90, 103, 0.3);
555        --wui-color-error-glass-060: rgba(242, 90, 103, 0.6);
556        --wui-color-error-glass-080: rgba(242, 90, 103, 0.8);
557
558        --wui-color-error-glass-reown-020: rgba(223, 74, 52, 0.2);
559
560        --wui-color-gray-glass-001: rgba(255, 255, 255, 0.01);
561        --wui-color-gray-glass-002: rgba(255, 255, 255, 0.02);
562        --wui-color-gray-glass-005: rgba(255, 255, 255, 0.05);
563        --wui-color-gray-glass-010: rgba(255, 255, 255, 0.1);
564        --wui-color-gray-glass-015: rgba(255, 255, 255, 0.15);
565        --wui-color-gray-glass-020: rgba(255, 255, 255, 0.2);
566        --wui-color-gray-glass-025: rgba(255, 255, 255, 0.25);
567        --wui-color-gray-glass-030: rgba(255, 255, 255, 0.3);
568        --wui-color-gray-glass-060: rgba(255, 255, 255, 0.6);
569        --wui-color-gray-glass-080: rgba(255, 255, 255, 0.8);
570        --wui-color-gray-glass-090: rgba(255, 255, 255, 0.9);
571
572        --wui-color-dark-glass-100: rgba(42, 42, 42, 1);
573
574        --wui-icon-box-bg-error-base-100: #3c2426;
575        --wui-icon-box-bg-blue-base-100: #20303f;
576        --wui-icon-box-bg-success-base-100: #1f3a28;
577        --wui-icon-box-bg-inverse-base-100: #243240;
578
579        --wui-all-wallets-bg-100: #222b35;
580
581        --wui-avatar-border-base: #252525;
582
583        --wui-thumbnail-border-base: #252525;
584
585        --wui-wallet-button-bg-base: var(--wui-color-bg-125);
586
587        --w3m-card-embedded-shadow-color: rgb(17 17 18 / 25%);
588      }
589    `,dark:(0,o.iv)`
590      :root {
591        --w3m-color-mix: ${(0,o.$m)(e?.["--w3m-color-mix"]||"#000")};
592        --w3m-accent: ${(0,o.$m)((0,a.t)(e,"light")["--w3m-accent"])};
593        --w3m-default: #000;
594
595        --wui-color-modal-bg-base: ${(0,o.$m)((0,a.t)(e,"light")["--w3m-background"])};
596        --wui-color-accent-base-100: var(--w3m-accent);
597
598        --wui-color-blueberry-100: hsla(231, 100%, 70%, 1);
599        --wui-color-blueberry-090: hsla(231, 97%, 72%, 1);
600        --wui-color-blueberry-080: hsla(231, 92%, 74%, 1);
601
602        --wui-color-fg-100: #141414;
603        --wui-color-fg-125: #2d3131;
604        --wui-color-fg-150: #474d4d;
605        --wui-color-fg-175: #636d6d;
606        --wui-color-fg-200: #798686;
607        --wui-color-fg-225: #828f8f;
608        --wui-color-fg-250: #8b9797;
609        --wui-color-fg-275: #95a0a0;
610        --wui-color-fg-300: #9ea9a9;
611        --wui-color-fg-325: #9a9a9a;
612        --wui-color-fg-350: #d0d0d0;
613
614        --wui-color-bg-100: #ffffff;
615        --wui-color-bg-125: #f5fafa;
616        --wui-color-bg-150: #f3f8f8;
617        --wui-color-bg-175: #eef4f4;
618        --wui-color-bg-200: #eaf1f1;
619        --wui-color-bg-225: #e5eded;
620        --wui-color-bg-250: #e1e9e9;
621        --wui-color-bg-275: #dce7e7;
622        --wui-color-bg-300: #d8e3e3;
623        --wui-color-bg-325: #f3f3f3;
624        --wui-color-bg-350: #202020;
625
626        --wui-color-success-base-100: #26b562;
627        --wui-color-success-base-125: #30a46b;
628
629        --wui-color-warning-base-100: #f3a13f;
630
631        --wui-color-error-base-100: #f05142;
632        --wui-color-error-base-125: #df4a34;
633
634        --wui-color-blue-base-100: rgba(102, 125, 255, 1);
635        --wui-color-blue-base-90: rgba(102, 125, 255, 0.9);
636
637        --wui-color-success-glass-001: rgba(38, 181, 98, 0.01);
638        --wui-color-success-glass-002: rgba(38, 181, 98, 0.02);
639        --wui-color-success-glass-005: rgba(38, 181, 98, 0.05);
640        --wui-color-success-glass-010: rgba(38, 181, 98, 0.1);
641        --wui-color-success-glass-015: rgba(38, 181, 98, 0.15);
642        --wui-color-success-glass-020: rgba(38, 181, 98, 0.2);
643        --wui-color-success-glass-025: rgba(38, 181, 98, 0.25);
644        --wui-color-success-glass-030: rgba(38, 181, 98, 0.3);
645        --wui-color-success-glass-060: rgba(38, 181, 98, 0.6);
646        --wui-color-success-glass-080: rgba(38, 181, 98, 0.8);
647
648        --wui-color-success-glass-reown-020: rgba(48, 164, 107, 0.2);
649
650        --wui-color-warning-glass-reown-020: rgba(243, 161, 63, 0.2);
651
652        --wui-color-error-glass-001: rgba(240, 81, 66, 0.01);
653        --wui-color-error-glass-002: rgba(240, 81, 66, 0.02);
654        --wui-color-error-glass-005: rgba(240, 81, 66, 0.05);
655        --wui-color-error-glass-010: rgba(240, 81, 66, 0.1);
656        --wui-color-error-glass-015: rgba(240, 81, 66, 0.15);
657        --wui-color-error-glass-020: rgba(240, 81, 66, 0.2);
658        --wui-color-error-glass-025: rgba(240, 81, 66, 0.25);
659        --wui-color-error-glass-030: rgba(240, 81, 66, 0.3);
660        --wui-color-error-glass-060: rgba(240, 81, 66, 0.6);
661        --wui-color-error-glass-080: rgba(240, 81, 66, 0.8);
662
663        --wui-color-error-glass-reown-020: rgba(223, 74, 52, 0.2);
664
665        --wui-icon-box-bg-error-base-100: #f4dfdd;
666        --wui-icon-box-bg-blue-base-100: #d9ecfb;
667        --wui-icon-box-bg-success-base-100: #daf0e4;
668        --wui-icon-box-bg-inverse-base-100: #dcecfc;
669
670        --wui-all-wallets-bg-100: #e8f1fa;
671
672        --wui-avatar-border-base: #f3f4f4;
673
674        --wui-thumbnail-border-base: #eaefef;
675
676        --wui-wallet-button-bg-base: var(--wui-color-bg-125);
677
678        --wui-color-gray-glass-001: rgba(0, 0, 0, 0.01);
679        --wui-color-gray-glass-002: rgba(0, 0, 0, 0.02);
680        --wui-color-gray-glass-005: rgba(0, 0, 0, 0.05);
681        --wui-color-gray-glass-010: rgba(0, 0, 0, 0.1);
682        --wui-color-gray-glass-015: rgba(0, 0, 0, 0.15);
683        --wui-color-gray-glass-020: rgba(0, 0, 0, 0.2);
684        --wui-color-gray-glass-025: rgba(0, 0, 0, 0.25);
685        --wui-color-gray-glass-030: rgba(0, 0, 0, 0.3);
686        --wui-color-gray-glass-060: rgba(0, 0, 0, 0.6);
687        --wui-color-gray-glass-080: rgba(0, 0, 0, 0.8);
688        --wui-color-gray-glass-090: rgba(0, 0, 0, 0.9);
689
690        --wui-color-dark-glass-100: rgba(233, 233, 233, 1);
691
692        --w3m-card-embedded-shadow-color: rgb(224 225 233 / 25%);
693      }
694    `}}let d=(0,o.iv)`
695  *,
696  *::after,
697  *::before,
698  :host {
699    margin: 0;
700    padding: 0;
701    box-sizing: border-box;
702    font-style: normal;
703    text-rendering: optimizeSpeed;
704    -webkit-font-smoothing: antialiased;
705    -moz-osx-font-smoothing: grayscale;
706    -webkit-tap-highlight-color: transparent;
707    font-family: var(--wui-font-family);
708    backface-visibility: hidden;
709  }
710`,p=(0,o.iv)`
711  button,
712  a {
713    cursor: pointer;
714    display: flex;
715    justify-content: center;
716    align-items: center;
717    position: relative;
718    transition:
719      color var(--wui-duration-lg) var(--wui-ease-out-power-1),
720      background-color var(--wui-duration-lg) var(--wui-ease-out-power-1),
721      border var(--wui-duration-lg) var(--wui-ease-out-power-1),
722      border-radius var(--wui-duration-lg) var(--wui-ease-out-power-1),
723      box-shadow var(--wui-duration-lg) var(--wui-ease-out-power-1);
724    will-change: background-color, color, border, box-shadow, border-radius;
725    outline: none;
726    border: none;
727    column-gap: var(--wui-spacing-3xs);
728    background-color: transparent;
729    text-decoration: none;
730  }
731
732  wui-flex {
733    transition: border-radius var(--wui-duration-lg) var(--wui-ease-out-power-1);
734    will-change: border-radius;
735  }
736
737  button:disabled > wui-wallet-image,
738  button:disabled > wui-all-wallets-image,
739  button:disabled > wui-network-image,
740  button:disabled > wui-image,
741  button:disabled > wui-transaction-visual,
742  button:disabled > wui-logo {
743    filter: grayscale(1);
744  }
745
746  @media (hover: hover) and (pointer: fine) {
747    button:hover:enabled {
748      background-color: var(--wui-color-gray-glass-005);
749    }
750
751    button:active:enabled {
752      background-color: var(--wui-color-gray-glass-010);
753    }
754  }
755
756  button:disabled > wui-icon-box {
757    opacity: 0.5;
758  }
759
760  input {
761    border: none;
762    outline: none;
763    appearance: none;
764  }
765`,f=(0,o.iv)`
766  .wui-color-inherit {
767    color: var(--wui-color-inherit);
768  }
769
770  .wui-color-accent-100 {
771    color: var(--wui-color-accent-100);
772  }
773
774  .wui-color-error-100 {
775    color: var(--wui-color-error-100);
776  }
777
778  .wui-color-blue-100 {
779    color: var(--wui-color-blue-100);
780  }
781
782  .wui-color-blue-90 {
783    color: var(--wui-color-blue-90);
784  }
785
786  .wui-color-error-125 {
787    color: var(--wui-color-error-125);
788  }
789
790  .wui-color-success-100 {
791    color: var(--wui-color-success-100);
792  }
793
794  .wui-color-success-125 {
795    color: var(--wui-color-success-125);
796  }
797
798  .wui-color-inverse-100 {
799    color: var(--wui-color-inverse-100);
800  }
801
802  .wui-color-inverse-000 {
803    color: var(--wui-color-inverse-000);
804  }
805
806  .wui-color-fg-100 {
807    color: var(--wui-color-fg-100);
808  }
809
810  .wui-color-fg-200 {
811    color: var(--wui-color-fg-200);
812  }
813
814  .wui-color-fg-300 {
815    color: var(--wui-color-fg-300);
816  }
817
818  .wui-color-fg-325 {
819    color: var(--wui-color-fg-325);
820  }
821
822  .wui-color-fg-350 {
823    color: var(--wui-color-fg-350);
824  }
825
826  .wui-bg-color-inherit {
827    background-color: var(--wui-color-inherit);
828  }
829
830  .wui-bg-color-blue-100 {
831    background-color: var(--wui-color-accent-100);
832  }
833
834  .wui-bg-color-error-100 {
835    background-color: var(--wui-color-error-100);
836  }
837
838  .wui-bg-color-error-125 {
839    background-color: var(--wui-color-error-125);
840  }
841
842  .wui-bg-color-success-100 {
843    background-color: var(--wui-color-success-100);
844  }
845
846  .wui-bg-color-success-125 {
847    background-color: var(--wui-color-success-100);
848  }
849
850  .wui-bg-color-inverse-100 {
851    background-color: var(--wui-color-inverse-100);
852  }
853
854  .wui-bg-color-inverse-000 {
855    background-color: var(--wui-color-inverse-000);
856  }
857
858  .wui-bg-color-fg-100 {
859    background-color: var(--wui-color-fg-100);
860  }
861
862  .wui-bg-color-fg-200 {
863    background-color: var(--wui-color-fg-200);
864  }
865
866  .wui-bg-color-fg-300 {
867    background-color: var(--wui-color-fg-300);
868  }
869
870  .wui-color-fg-325 {
871    background-color: var(--wui-color-fg-325);
872  }
873
874  .wui-color-fg-350 {
875    background-color: var(--wui-color-fg-350);
876  }
877`},66192:function(e,t,r){"use strict";r.d(t,{H:function(){return i}});let i={getSpacingStyles:(e,t)=>Array.isArray(e)?e[t]?`var(--wui-spacing-${e[t]})`:void 0:"string"==typeof e?`var(--wui-spacing-${e})`:void 0,getFormattedDate:e=>new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric"}).format(e),getHostName(e){try{return new URL(e).hostname}catch(e){return""}},getTruncateString:({string:e,charsStart:t,charsEnd:r,truncate:i})=>e.length<=t+r?e:"end"===i?`${e.substring(0,t)}...`:"start"===i?`...${e.substring(e.length-r)}`:`${e.substring(0,Math.floor(t))}...${e.substring(e.length-Math.floor(r))}`,generateAvatarColors(e){let t=e.toLowerCase().replace(/^0x/iu,"").replace(/[^a-f0-9]/gu,"").substring(0,6).padEnd(6,"0"),r=this.hexToRgb(t),i=getComputedStyle(document.documentElement).getPropertyValue("--w3m-border-radius-master"),n=100-3*Number(i?.replace("px","")),s=`${n}% ${n}% at 65% 40%`,o=[];for(let e=0;e<5;e+=1){let t=this.tintColor(r,.15*e);o.push(`rgb(${t[0]}, ${t[1]}, ${t[2]})`)}return`
878    --local-color-1: ${o[0]};
879    --local-color-2: ${o[1]};
880    --local-color-3: ${o[2]};
881    --local-color-4: ${o[3]};
882    --local-color-5: ${o[4]};
883    --local-radial-circle: ${s}
884   `},hexToRgb(e){let t=parseInt(e,16);return[t>>16&255,t>>8&255,255&t]},tintColor(e,t){let[r,i,n]=e;return[Math.round(r+(255-r)*t),Math.round(i+(255-i)*t),Math.round(n+(255-n)*t)]},isNumber:e=>/^[0-9]+$/u.test(e),getColorTheme:e=>e||("undefined"!=typeof window&&window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)")?.matches?"dar
884k":"light":"dark"),splitBalance(e){let t=e.split(".");return 2===t.length?[t[0],t[1]]:["0","00"]},roundNumber:(e,t,r)=>e.toString().length>=t?Number(e).toFixed(r):e,formatNumberToLocalString:(e,t=2)=>void 0===e?"0.00":"number"==typeof e?e.toLocaleString("en-US",{maximumFractionDigits:t,minimumFractionDigits:t}):parseFloat(e).toLocaleString("en-US",{maximumFractionDigits:t,minimumFractionDigits:t})}},77547:function(e,t,r){"use strict";function i(e){return function(t){return"function"==typeof t?(customElements.get(e)||customElements.define(e,t),t):function(e,t){let{kind:r,elements:i}=t;return{kind:r,elements:i,finisher(t){customElements.get(e)||customElements.define(e,t)}}}(e,t)}}r.d(t,{M:function(){return i}})},43621:function(e,t,r){"use strict";r.d(t,{b:function(){return i}});let i={METMASK_CONNECTOR_NAME:"MetaMask",TRUST_CONNECTOR_NAME:"Trust Wallet",SOLFLARE_CONNECTOR_NAME:"Solflare",PHANTOM_CONNECTOR_NAME:"Phantom",COIN98_CONNECTOR_NAME:"Coin98",MAGIC_EDEN_CONNECTOR_NAME:"Magic Eden",BACKPACK_CONNECTOR_NAME:"Backpack",BITGET_CONNECTOR_NAME:"Bitget Wallet",FRONTIER_CONNECTOR_NAME:"Frontier",XVERSE_CONNECTOR_NAME:"Xverse Wallet",LEATHER_CONNECTOR_NAME:"Leather",EIP155:"eip155",ADD_CHAIN_METHOD:"wallet_addEthereumChain",EIP6963_ANNOUNCE_EVENT:"eip6963:announceProvider",EIP6963_REQUEST_EVENT:"eip6963:requestProvider",CONNECTOR_RDNS_MAP:{coinbaseWallet:"com.coinbase.wallet",coinbaseWalletSDK:"com.coinbase.wallet"},CONNECTOR_TYPE_EXTERNAL:"EXTERNAL",CONNECTOR_TYPE_WALLET_CONNECT:"WALLET_CONNECT",CONNECTOR_TYPE_INJECTED:"INJECTED",CONNECTOR_TYPE_ANNOUNCED:"ANNOUNCED",CONNECTOR_TYPE_AUTH:"AUTH",CONNECTOR_TYPE_MULTI_CHAIN:"MULTI_CHAIN",CONNECTOR_TYPE_W3M_AUTH:"ID_AUTH"}},67735:function(e,t,r){"use strict";r.d(t,{j:function(){return i}});let i={UniversalProviderErrors:{UNAUTHORIZED_DOMAIN_NOT_ALLOWED:{message:"Unauthorized: origin not allowed",alertErrorKey:"INVALID_APP_CONFIGURATION"},JWT_VALIDATION_ERROR:{message:"JWT validation error: JWT Token is not yet valid",alertErrorKey:"JWT_TOKEN_NOT_VALID"},INVALID_KEY:{message:"Unauthorized: invalid key",alertErrorKey:"INVALID_PROJECT_ID"}},ALERT_ERRORS:{SWITCH_NETWORK_NOT_FOUND:{shortMessage:"Network Not Found",longMessage:"Network not found - please make sure it is included in 'networks' array in createAppKit function"},INVALID_APP_CONFIGURATION:{shortMessage:"Invalid App Configuration",longMessage:()=>`Origin ${"undefined"!=typeof window?window.origin:"unknown"} not found on Allowlist - update configuration on cloud.reown.com`},SOCIALS_TIMEOUT:{shortMessage:"Invalid App Configuration",longMessage:()=>"There was an issue loading the embedded wallet. Please verify that your domain is allowed at cloud.reown.com"},JWT_TOKEN_NOT_VALID:{shortMessage:"Session Expired",longMessage:"Invalid session found on UniversalProvider - please check your time settings and connect again"},INVALID_PROJECT_ID:{shortMessage:"Invalid App Configuration",longMessage:"Invalid Project ID - update configuration"},PROJECT_ID_NOT_CONFIGURED:{shortMessage:"Project ID Not Configured",longMessage:"Project ID Not Configured - update configuration on cloud.reown.com"}}}},53304:function(e,t,r){"use strict";r.d(t,{g:function(){return n}});var i=r(43621);let n={getCaipTokens(e){if(!e)return;let t={};return Object.entries(e).forEach(([e,r])=>{t[`${i.b.EIP155}:${e}`]=r}),t},isLowerCaseMatch:(e,t)=>e?.toLowerCase()===t?.toLowerCase()}},998:function(e,t,r){"use strict";r.d(t,{C:function(){return s}});var i=r(72647),n=r(43621);let s={ConnectorExplorerIds:{[i.b.CONNECTOR_ID.COINBASE]:"fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa",[i.b.CONNECTOR_ID.COINBASE_SDK]:"fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa",[i.b.CONNECTOR_ID.SAFE]:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",[i.b.CONNECTOR_ID.LEDGER]:"19177a98252e07ddfc9af2083ba8e07ef627cb6103467ffebb3f8f4205fd7927",[i.b.CONNECTOR_ID.OKX]:"971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709",[n.b.METMASK_CONNECTOR_NAME]:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",[n.b.TRUST_CONNECTOR_NAME]:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",[n.b.SOLFLARE_CONNECTOR_NAME]:"1ca0bdd4747578705b1939af023d120677c64fe6ca76add81fda36e350605e79",[n.b.PHANTOM_CONNECTOR_NAME]:"a797aa35c0fadbfc1a53e7f675162ed5226968b44a19ee3d24385c64d1d3c393",[n.b.COIN98_CONNECTOR_NAME]:"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01",[n.b.MAGIC_EDEN_CONNECTOR_NAME]:"8b830a2b724a9c3fbab63af6f55ed29c9dfa8a55e732dc88c80a196a2ba136c6",[n.b.BACKPACK_CONNECTOR_NAME]:"2bd8c14e035c2d48f184aaa168559e86b0e3433228d3c4075900a221785019b0",[n.b.BITGET_CONNECTOR_NAME]:"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",[n.b.FRONTIER_CONNECTOR_NAME]:"85db431492aa2e8672e93f4ea7acf10c88b97b867b0d373107af63dc4880f041",[n.b.XVERSE_CONNECTOR_NAME]:"2a87d74ae02e10bdd1f51f7ce6c4e1cc53cd5f2c0b6b5ad0d7b300
8847d2b13de7b",[n.b.LEATHER_CONNECTOR_NAME]:"483afe1df1df63daf313109971ff3ef8356ddf1cc4e45877d205eee0b7893a13"},NetworkImageIds:{1:"ba0ba0cd-17c6-4806-ad93-f9d174f17900",42161:"3bff954d-5cb0-47a0-9a23-d20192e74600",43114:"30c46e53-e989-45fb-4549-be3bd4eb3b00",56:"93564157-2e8e-4ce7-81df-b264dbee9b00",250:"06b26297-fe0c-4733-5d6b-ffa5498aac00",10:"ab9c186a-c52f-464b-2906-ca59d760a400",137:"41d04d42-da3b-4453-8506-668cc0727900",5e3:"e86fae9b-b770-4eea-e520-150e12c81100",295:"6a97d510-cac8-4e58-c7ce-e8681b044c00",11155111:"e909ea0a-f92a-4512-c8fc-748044ea6800",84532:"a18a7ecd-e307-4360-4746-283182228e00",1301:"4eeea7ef-0014-4649-5d1d-07271a80f600",130:"2257980a-3463-48c6-cbac-a42d2a956e00",10143:"0a728e83-bacb-46db-7844-948f05434900",100:"02b53f6a-e3d4-479e-1cb4-21178987d100",9001:"f926ff41-260d-4028-635e-91913fc28e00",324:"b310f07f-4ef7-49f3-7073-2a0a39685800",314:"5a73b3dd-af74-424e-cae0-0de859ee9400",4689:"34e68754-e536-40da-c153-6ef2e7188a00",1088:"3897a66d-40b9-4833-162f-a2c90531c900",1284:"161038da-44ae-4ec7-1208-0ea569454b00",1285:"f1d73bb6-5450-4e18-38f7-fb6484264a00",7777777:"845c60df-d429-4991-e687-91ae45791600",42220:"ab781bbc-ccc6-418d-d32d-789b15da1f00",8453:"7289c336-3981-4081-c5f4-efc26ac64a00",1313161554:"3ff73439-a619-4894-9262-4470c773a100",2020:"b8101fc0-9c19-4b6f-ec65-f6dfff106e00",2021:"b8101fc0-9c19-4b6f-ec65-f6dfff106e00",80094:"e329c2c9-59b0-4a02-83e4-212ff3779900",2741:"fc2427d1-5af9-4a9c-8da5-6f94627cd900","5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp":"a1b58899-f671-4276-6a5e-56ca5bd59700","4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z":"a1b58899-f671-4276-6a5e-56ca5bd59700",EtWTRABZaYq6iMfeYKouRu166VU2xqa1:"a1b58899-f671-4276-6a5e-56ca5bd59700","000000000019d6689c085ae165831e93":"0b4838db-0161-4ffe-022d-532bf03dba00","000000000933ea01ad0ee984209779ba":"39354064-d79b-420b-065d-f980c4b78200"},ConnectorImageIds:{[i.b.CONNECTOR_ID.COINBASE]:"0c2840c3-5b04-4c44-9661-fbd4b49e1800",[i.b.CONNECTOR_ID.COINBASE_SDK]:"0c2840c3-5b04-4c44-9661-fbd4b49e1800",[i.b.CONNECTOR_ID.SAFE]:"461db637-8616-43ce-035a-d89b8a1d5800",[i.b.CONNECTOR_ID.LEDGER]:"54a1aa77-d202-4f8d-0fb2-5d2bb6db0300",[i.b.CONNECTOR_ID.WALLET_CONNECT]:"ef1a1fcf-7fe8-4d69-bd6d-fda1345b4400",[i.b.CONNECTOR_ID.INJECTED]:"07ba87ed-43aa-4adf-4540-9e6a2b9cae00"},ConnectorNamesMap:{[i.b.CONNECTOR_ID.INJECTED]:"Browser Wallet",[i.b.CONNECTOR_ID.WALLET_CONNECT]:"WalletConnect",[i.b.CONNECTOR_ID.COINBASE]:"Coinbase",[i.b.CONNECTOR_ID.COINBASE_SDK]:"Coinbase",[i.b.CONNECTOR_ID.LEDGER]:"Ledger",[i.b.CONNECTOR_ID.SAFE]:"Safe"},ConnectorTypesMap:{[i.b.CONNECTOR_ID.INJECTED]:"INJECTED",[i.b.CONNECTOR_ID.WALLET_CONNECT]:"WALLET_CONNECT",[i.b.CONNECTOR_ID.EIP6963]:"ANNOUNCED",[i.b.CONNECTOR_ID.AUTH]:"AUTH"},WalletConnectRpcChainIds:[1,5,11155111,10,420,42161,421613,137,80001,42220,1313161554,1313161555,56,97,43114,43113,100,8453,84531,7777777,999,324,280]}},87411:function(e,t,r){"use strict";r.d(t,{$0:function(){return a},Dr:function(){return n},jd:function(){return s},y_:function(){return c},zN:function(){return o}});var i=r(25566);let n=(void 0!==i&&void 0!==i.env?i.env.NEXT_PUBLIC_SECURE_SITE_SDK_URL:void 0)||"https://secure.walletconnect.org/sdk",s=(void 0!==i&&void 0!==i.env?i.env.NEXT_PUBLIC_DEFAULT_LOG_LEVEL:void 0)||"error",o=(void 0!==i&&void 0!==i.env?i.env.NEXT_PUBLIC_SECURE_SITE_SDK_VERSION:void 0)||"4",a={APP_EVENT_KEY:"@w3m-app/",FRAME_EVENT_KEY:"@w3m-frame/",RPC_METHOD_KEY:"RPC_",STORAGE_KEY:"@appkit-wallet/",SESSION_TOKEN_KEY:"SESSION_TOKEN_KEY",EMAIL_LOGIN_USED_KEY:"EMAIL_LOGIN_USED_KEY",LAST_USED_CHAIN_KEY:"LAST_USED_CHAIN_KEY",LAST_EMAIL_LOGIN_TIME:"LAST_EMAIL_LOGIN_TIME",EMAIL:"EMAIL",PREFERRED_ACCOUNT_TYPE:"PREFERRED_ACCOUNT_TYPE",SMART_ACCOUNT_ENABLED:"SMART_ACCOUNT_ENABLED",SMART_ACCOUNT_ENABLED_NETWORKS:"SMART_ACCOUNT_ENABLED_NETWORKS",SOCIAL_USERNAME:"SOCIAL_USERNAME",APP_SWITCH_NETWORK:"@w3m-app/SWITCH_NETWORK",APP_CONNECT_EMAIL:"@w3m-app/CONNECT_EMAIL",APP_CONNECT_DEVICE:"@w3m-app/CONNECT_DEVICE",APP_CONNECT_OTP:"@w3m-app/CONNECT_OTP",APP_CONNECT_SOCIAL:"@w3m-app/CONNECT_SOCIAL",APP_GET_SOCIAL_REDIRECT_URI:"@w3m-app/GET_SOCIAL_REDIRECT_URI",APP_GET_USER:"@w3m-app/GET_USER",APP_SIGN_OUT:"@w3m-app/SIGN_OUT",APP_IS_CONNECTED:"@w3m-app/IS_CONNECTED",APP_GET_CHAIN_ID:"@w3m-app/GET_CHAIN_ID",APP_RPC_REQUEST:"@w3m-app/RPC_REQUEST",APP_UPDATE_EMAIL:"@w3m-app/UPDATE_EMAIL",APP_UPDATE_EMAIL_PRIMARY_OTP:"@w3m-app/UPDATE_EMAIL_PRIMARY_OTP",APP_UPDATE_EMAIL_SECONDARY_OTP:"@w3m-app/UPDATE_EMAIL_SECONDARY_OTP",APP_AWAIT_UPDATE_EMAIL:"@w3m-app/AWAIT_UPDATE_EMAIL",APP_SYNC_THEME:"@w3m-app/SYNC_THEME",APP_SYNC_DAPP_DATA:"@w3m-app/SYNC_DAPP_DATA",APP_GET_SMART_ACCOUNT_ENABLED_NETWORKS:"@w3m-app/GET_SMART_ACCOUNT_ENABLED_NETWORKS",APP_INIT_SMART_ACCOUNT:"@w3m-app/INIT_SMART_ACCOUNT",APP_SET_PREFERRED_ACCOUNT:"@w3m-app/SET_PREFERRED_ACCOUNT",APP_CONNECT_FARCASTER:"@w3m-app/CONNECT_FARCASTER",APP_GET_FARCASTER_URI:"@w3m-app/GET_FARCASTER_URI",APP_RELOAD:"@w3m-app/RELOAD",FRAME_SWITCH_NETWORK_E
884RROR:"@w3m-frame/SWITCH_NETWORK_ERROR",FRAME_SWITCH_NETWORK_SUCCESS:"@w3m-frame/SWITCH_NETWORK_SUCCESS",FRAME_CONNECT_EMAIL_ERROR:"@w3m-frame/CONNECT_EMAIL_ERROR",FRAME_CONNECT_EMAIL_SUCCESS:"@w3m-frame/CONNECT_EMAIL_SUCCESS",FRAME_CONNECT_DEVICE_ERROR:"@w3m-frame/CONNECT_DEVICE_ERROR",FRAME_CONNECT_DEVICE_SUCCESS:"@w3m-frame/CONNECT_DEVICE_SUCCESS",FRAME_CONNECT_OTP_SUCCESS:"@w3m-frame/CONNECT_OTP_SUCCESS",FRAME_CONNECT_OTP_ERROR:"@w3m-frame/CONNECT_OTP_ERROR",FRAME_CONNECT_SOCIAL_SUCCESS:"@w3m-frame/CONNECT_SOCIAL_SUCCESS",FRAME_CONNECT_SOCIAL_ERROR:"@w3m-frame/CONNECT_SOCIAL_ERROR",FRAME_CONNECT_FARCASTER_SUCCESS:"@w3m-frame/CONNECT_FARCASTER_SUCCESS",FRAME_CONNECT_FARCASTER_ERROR:"@w3m-frame/CONNECT_FARCASTER_ERROR",FRAME_GET_FARCASTER_URI_SUCCESS:"@w3m-frame/GET_FARCASTER_URI_SUCCESS",FRAME_GET_FARCASTER_URI_ERROR:"@w3m-frame/GET_FARCASTER_URI_ERROR",FRAME_GET_SOCIAL_REDIRECT_URI_SUCCESS:"@w3m-frame/GET_SOCIAL_REDIRECT_URI_SUCCESS",FRAME_GET_SOCIAL_REDIRECT_URI_ERROR:"@w3m-frame/GET_SOCIAL_REDIRECT_URI_ERROR",FRAME_GET_USER_SUCCESS:"@w3m-frame/GET_USER_SUCCESS",FRAME_GET_USER_ERROR:"@w3m-frame/GET_USER_ERROR",FRAME_SIGN_OUT_SUCCESS:"@w3m-frame/SIGN_OUT_SUCCESS",FRAME_SIGN_OUT_ERROR:"@w3m-frame/SIGN_OUT_ERROR",FRAME_IS_CONNECTED_SUCCESS:"@w3m-frame/IS_CONNECTED_SUCCESS",FRAME_IS_CONNECTED_ERROR:"@w3m-frame/IS_CONNECTED_ERROR",FRAME_GET_CHAIN_ID_SUCCESS:"@w3m-frame/GET_CHAIN_ID_SUCCESS",FRAME_GET_CHAIN_ID_ERROR:"@w3m-frame/GET_CHAIN_ID_ERROR",FRAME_RPC_REQUEST_SUCCESS:"@w3m-frame/RPC_REQUEST_SUCCESS",FRAME_RPC_REQUEST_ERROR:"@w3m-frame/RPC_REQUEST_ERROR",FRAME_SESSION_UPDATE:"@w3m-frame/SESSION_UPDATE",FRAME_UPDATE_EMAIL_SUCCESS:"@w3m-frame/UPDATE_EMAIL_SUCCESS",FRAME_UPDATE_EMAIL_ERROR:"@w3m-frame/UPDATE_EMAIL_ERROR",FRAME_UPDATE_EMAIL_PRIMARY_OTP_SUCCESS:"@w3m-frame/UPDATE_EMAIL_PRIMARY_OTP_SUCCESS",FRAME_UPDATE_EMAIL_PRIMARY_OTP_ERROR:"@w3m-frame/UPDATE_EMAIL_PRIMARY_OTP_ERROR",FRAME_UPDATE_EMAIL_SECONDARY_OTP_SUCCESS:"@w3m-frame/UPDATE_EMAIL_SECONDARY_OTP_SUCCESS",FRAME_UPDATE_EMAIL_SECONDARY_OTP_ERROR:"@w3m-frame/UPDATE_EMAIL_SECONDARY_OTP_ERROR",FRAME_SYNC_THEME_SUCCESS:"@w3m-frame/SYNC_THEME_SUCCESS",FRAME_SYNC_THEME_ERROR:"@w3m-frame/SYNC_THEME_ERROR",FRAME_SYNC_DAPP_DATA_SUCCESS:"@w3m-frame/SYNC_DAPP_DATA_SUCCESS",FRAME_SYNC_DAPP_DATA_ERROR:"@w3m-frame/SYNC_DAPP_DATA_ERROR",FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_SUCCESS:"@w3m-frame/GET_SMART_ACCOUNT_ENABLED_NETWORKS_SUCCESS",FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_ERROR:"@w3m-frame/GET_SMART_ACCOUNT_ENABLED_NETWORKS_ERROR",FRAME_INIT_SMART_ACCOUNT_SUCCESS:"@w3m-frame/INIT_SMART_ACCOUNT_SUCCESS",FRAME_INIT_SMART_ACCOUNT_ERROR:"@w3m-frame/INIT_SMART_ACCOUNT_ERROR",FRAME_SET_PREFERRED_ACCOUNT_SUCCESS:"@w3m-frame/SET_PREFERRED_ACCOUNT_SUCCESS",FRAME_SET_PREFERRED_ACCOUNT_ERROR:"@w3m-frame/SET_PREFERRED_ACCOUNT_ERROR",FRAME_READY:"@w3m-frame/READY",FRAME_RELOAD_SUCCESS:"@w3m-frame/RELOAD_SUCCESS",FRAME_RELOAD_ERROR:"@w3m-frame/RELOAD_ERROR",RPC_RESPONSE_TYPE_ERROR:"RPC_RESPONSE_ERROR",RPC_RESPONSE_TYPE_TX:"RPC_RESPONSE_TRANSACTION_HASH",RPC_RESPONSE_TYPE_OBJECT:"RPC_RESPONSE_OBJECT"},c={SAFE_RPC_METHODS:["eth_accounts","eth_blockNumber","eth_call","eth_chainId","eth_estimateGas","eth_feeHistory","eth_gasPrice","eth_getAccount","eth_getBalance","eth_getBlockByHash","eth_getBlockByNumber","eth_getBlockReceipts","eth_getBlockTransactionCountByHash","eth_getBlockTransactionCountByNumber","eth_getCode","eth_getFilterChanges","eth_getFilterLogs","eth_getLogs","eth_getProof","eth_getStorageAt","eth_getTransactionByBlockHashAndIndex","eth_getTransactionByBlockNumberAndIndex","eth_getTransactionByHash","eth_getTransactionCount","eth_getTransactionReceipt","eth_getUncleCountByBlockHash","eth_getUncleCountByBlockNumber","eth_maxPriorityFeePerGas","eth_newBlockFilter","eth_newFilter","eth_newPendingTransactionFilter","eth_sendRawTransaction","eth_syncing","eth_uninstallFilter","wallet_getCapabilities","wallet_getCallsStatus","eth_getUserOperationReceipt","eth_estimateUserOperationGas","eth_getUserOperationByHash","eth_supportedEntryPoints","wallet_getAssets"],NOT_SAFE_RPC_METHODS:["personal_sign","eth_signTypedData_v4","eth_sendTransaction","solana_signMessage","solana_signTransaction","solana_signAllTransactions","solana_signAndSendTransaction","wallet_sendCalls","wallet_grantPermissions","wallet_revokePermissions","eth_sendUserOperation"],GET_CHAIN_ID:"eth_chainId",RPC_METHOD_NOT_ALLOWED_MESSAGE:"Requested RPC call is not allowed",RP
884C_METHOD_NOT_ALLOWED_UI_MESSAGE:"Action not allowed",ACCOUNT_TYPES:{EOA:"eoa",SMART_ACCOUNT:"smartAccount"}}},36936:function(e,t,r){"use strict";r.d(t,{$:function(){return o}});let i={transactionHash:/^0x(?:[A-Fa-f0-9]{64})$/u,signedMessage:/^0x(?:[a-fA-F0-9]{62,})$/u};var n=r(87411),s=r(69023);let o={checkIfAllowedToTriggerEmail(){let e=s.e.get(n.$0.LAST_EMAIL_LOGIN_TIME);if(e){let t=Date.now()-Number(e);if(t<3e4)throw Error(`Please try again after ${Math.ceil((3e4-t)/1e3)} seconds`)}},getTimeToNextEmailLogin(){let e=s.e.get(n.$0.LAST_EMAIL_LOGIN_TIME);if(e){let t=Date.now()-Number(e);if(t<3e4)return Math.ceil((3e4-t)/1e3)}return 0},checkIfRequestExists:e=>n.y_.NOT_SAFE_RPC_METHODS.includes(e.method)||n.y_.SAFE_RPC_METHODS.includes(e.method),getResponseType:e=>"string"==typeof e&&(e?.match(i.transactionHash)||e?.match(i.signedMessage))?n.$0.RPC_RESPONSE_TYPE_TX:n.$0.RPC_RESPONSE_TYPE_OBJECT,checkIfRequestIsSafe:e=>n.y_.SAFE_RPC_METHODS.includes(e.method),isClient:"undefined"!=typeof window}},69023:function(e,t,r){"use strict";r.d(t,{e:function(){return s}});var i=r(87411),n=r(36936);let s={set(e,t){n.$.isClient&&localStorage.setItem(`${i.$0.STORAGE_KEY}${e}`,t)},get:e=>n.$.isClient?localStorage.getItem(`${i.$0.STORAGE_KEY}${e}`):null,delete(e,t){n.$.isClient&&(t?localStorage.removeItem(e):localStorage.removeItem(`${i.$0.STORAGE_KEY}${e}`))}}},20258:function(e,t,r){"use strict";r.d(t,{Q6N:function(){return i.Q6N},Zjg:function(){return i.Zjg},ol5:function(){return i.ol5}});var i=r(27854)},55935:function(e,t,r){"use strict";let i,n;r.d(t,{cz:function(){return l},gQ:function(){return c}});var s=r(25779),o=r(5253),a=r(2265);function c(){if(!i)throw Error('Please call "createAppKit" before using "useAppKitTheme" hook');let[e,t]=(0,a.useState)(i.getThemeMode()),[r,n]=(0,a.useState)(i.getThemeVariables());return(0,a.useEffect)(()=>{let e=i?.subscribeTheme(e=>{t(e.themeMode),n(e.themeVariables)});return()=>{e?.()}},[]),{themeMode:e,themeVariables:r,setThemeMode:function(e){e&&i?.setThemeMode(e)},setThemeVariables:function(e){e&&i?.setThemeVariables(e)}}}function l(e){return!n&&(i=n=new o.b({...e,sdkVersion:s.j.generateSdkVersion(e.adapters??[],"react","1.7.3")})),n}r(39831)},51466:function(e,t,r){"use strict";r.d(t,{q:function(){return c}}),r(13885);var i=r(72647),n=r(50035),s=r(78008),o=r(998),a=r(18535);class c{constructor(e){this.availableConnectors=[],this.eventListeners=new Map,this.getCaipNetworks=e=>n.R.getCaipNetworks(e),e&&this.construct(e)}construct(e){this.projectId=e.projectId,this.namespace=e.namespace,this.adapterType=e.adapterType}get connectors(){return this.availableConnectors}get networks(){return this.getCaipNetworks(this.namespace)}setAuthProvider(e){this.addConnector({id:i.b.CONNECTOR_ID.AUTH,type:"AUTH",name:i.b.CONNECTOR_NAMES.AUTH,provider:e,imageId:o.C.ConnectorImageIds[i.b.CONNECTOR_ID.AUTH],chain:this.namespace,chains:[]})}addConnector(...e){let t=new Set;this.availableConnectors=[...e,...this.availableConnectors].filter(e=>!t.has(e.id)&&(t.add(e.id),!0)),this.emit("connectors",this.availableConnectors)}setStatus(e,t){s.AccountController.setStatus(e,t)}on(e,t){this.eventListeners.has(e)||this.eventListeners.set(e,new Set),this.eventListeners.get(e)?.add(t)}off(e,t){let r=this.eventListeners.get(e);r&&r.delete(t)}removeAllEventListeners(){this.eventListeners.forEach(e=>{e.clear()})}emit(e,t){let r=this.eventListeners.get(e);r&&r.forEach(e=>e(t))}async connectWalletConnect(e){let t=this.getWalletConnectConnector();return{clientId:(await t.connectWalletConnect()).clientId}}async switchNetwork(e){let{caipNetwork:t,providerType:r}=e;if(!e.provider)return;let i="provider"in e.provider?e.provider.provider:e.provider;if("WALLET_CONNECT"===r){i.setDefaultChain(t.caipNetworkId);return}if(i&&"AUTH"===r){let e=s.AccountController.state.preferredAccountTypes?.[t.chainNamespace];await i.switchNetwork(t.caipNetworkId);let r=await i.getUser({chainId:t.caipNetworkId,preferredAccountType:e});this.emit("switchNetwork",r)}}getWalletConnectConnector(){let e=this.connectors.find(e=>e instanceof a.z);if(!e)throw Error("WalletConnectConnector not found");return e}}},5253:function(e,t,r){"use strict";let i,n;r.d(t,{b:function(){return n_}});var s,o,a,c,l,u,h,d=r(72647),p=r(40722),f=r(1471),g=r(56941),m=r(43122),y=r(62748),w=r(4197),b=r(44129),v=r(78008),E=r(50035),_=r(68619),C=r(25779),A=r(59099),I=r(84140),S=r(38431),N=r(53304),O=r(4362
8841),x=r(67735),T=r(31147),R=r(54322);let P={eip155:void 0,solana:void 0,polkadot:void 0,bip122:void 0},k=(0,T.sj)({providers:{...P},providerIds:{...P}}),D={state:k,subscribeKey:(e,t)=>(0,R.VW)(k,e,t),subscribe:e=>(0,T.Ld)(k,()=>{e(k)}),subscribeProviders:e=>(0,T.Ld)(k.providers,()=>e(k.providers)),setProvider(e,t){t&&(k.providers[e]=(0,T.iH)(t))},getProvider:e=>k.providers[e],setProviderId(e,t){t&&(k.providerIds[e]=t)},getProviderId(e){if(e)return k.providerIds[e]},reset(){k.providers={...P},k.providerIds={...P}},resetChain(e){k.providers[e]=void 0,k.providerIds[e]=void 0}};var M=r(36936),U=r(87411);(s=c||(c={})).assertEqual=e=>e,s.assertIs=function(e){},s.assertNever=function(e){throw Error()},s.arrayToEnum=e=>{let t={};for(let r of e)t[r]=r;return t},s.getValidEnumValues=e=>{let t=s.objectKeys(e).filter(t=>"number"!=typeof e[e[t]]),r={};for(let i of t)r[i]=e[i];return s.objectValues(r)},s.objectValues=e=>s.objectKeys(e).map(function(t){return e[t]}),s.objectKeys="function"==typeof Object.keys?e=>Object.keys(e):e=>{let t=[];for(let r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.push(r);return t},s.find=(e,t)=>{for(let r of e)if(t(r))return r},s.isInteger="function"==typeof Number.isInteger?e=>Number.isInteger(e):e=>"number"==typeof e&&isFinite(e)&&Math.floor(e)===e,s.joinValues=function(e,t=" | "){return e.map(e=>"string"==typeof e?`'${e}'`:e).join(t)},s.jsonStringifyReplacer=(e,t)=>"bigint"==typeof t?t.toString():t,(l||(l={})).mergeShapes=(e,t)=>({...e,...t});let L=c.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),B=e=>{switch(typeof e){case"undefined":return L.undefined;case"string":return L.string;case"number":return isNaN(e)?L.nan:L.number;case"boolean":return L.boolean;case"function":return L.function;case"bigint":return L.bigint;case"symbol":return L.symbol;case"object":if(Array.isArray(e))return L.array;if(null===e)return L.null;if(e.then&&"function"==typeof e.then&&e.catch&&"function"==typeof e.catch)return L.promise;if("undefined"!=typeof Map&&e instanceof Map)return L.map;if("undefined"!=typeof Set&&e instanceof Set)return L.set;if("undefined"!=typeof Date&&e instanceof Date)return L.date;return L.object;default:return L.unknown}}
884,j=c.arrayToEnum(["invalid_type","invalid_literal","custom","invalid_union","invalid_union_discriminator","invalid_enum_value","unrecognized_keys","invalid_arguments","invalid_return_type","invalid_date","invalid_string","too_small","too_big","invalid_intersection_types","not_multiple_of","not_finite"]);class $ extends Error{constructor(e){super(),this.issues=[],this.addIssue=e=>{this.issues=[...this.issues,e]},this.addIssues=(e=[])=>{this.issues=[...this.issues,...e]};let t=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,t):this.__proto__=t,this.name="ZodError",this.issues=e}get errors(){return this.issues}format(e){let t=e||function(e){return e.message},r={_errors:[]},i=e=>{for(let n of e.issues)if("invalid_union"===n.code)n.unionErrors.map(i);else if("invalid_return_type"===n.code)i(n.returnTypeError);else if("invalid_arguments"===n.code)i(n.argumentsError);else if(0===n.path.length)r._errors.push(t(n));else{let e=r,i=0;for(;i<n.path.length;){let r=n.path[i];i===n.path.length-1?(e[r]=e[r]||{_errors:[]},e[r]._errors.push(t(n))):e[r]=e[r]||{_errors:[]},e=e[r],i++}}};return i(this),r}toString(){return this.message}get message(){return JSON.stringify(this.issues,c.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(e=e=>e.message){let t={},r=[];for(let i of this.issues)i.path.length>0?(t[i.path[0]]=t[i.path[0]]||[],t[i.path[0]].push(e(i))):r.push(e(i));return{formErrors:r,fieldErrors:t}}get formErrors(){return this.flatten()}}$.create=e=>new $(e);let F=(e,t)=>{let r;switch(e.code){case j.invalid_type:r=e.received===L.undefined?"Required":`Expected ${e.expected}, received ${e.received}`;break;case j.invalid_literal:r=`Invalid literal value, expected ${JSON.stringify(e.expected,c.jsonStringifyReplacer)}`;break;case j.unrecognized_keys:r=`Unrecognized key(s) in object: ${c.joinValues(e.keys,", ")}`;break;case j.invalid_union:r="Invalid input";break;case j.invalid_union_discriminator:r=`Invalid discriminator value. Expected ${c.joinValues(e.options)}`;break;case j.invalid_enum_value:r=`Invalid enum value. Expected ${c.joinValues(e.options)}, received '${e.received}'`;break;case j.invalid_arguments:r="Invalid function arguments";break;case j.invalid_return_type:r="Invalid function return type";break;case j.invalid_date:r="Invalid date";break;case j.invalid_string:"object"==typeof e.validation?"includes"in e.validation?(r=`Invalid input: must include "${e.validation.includes}"`,"number"==typeof e.validation.position&&(r=`${r} at one or more positions greater than or equal to ${e.validation.position}`)):"startsWith"in e.validation?r=`Invalid input: must start with "${e.validation.startsWith}"`:"endsWith"in e.validation?r=`Invalid input: must end with "${e.validation.endsWith}"`:c.assertNever(e.validation):r="regex"!==e.validation?`Invalid ${e.validation}`:"Invalid";break;case j.too_small:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at least":"more than"} ${e.minimum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at least":"over"} ${e.minimum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${e.minimum}`:"date"===e.type?`Date must be ${e.exact?"exactly equal to ":e.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(e.minimum))}`:"Invalid input";break;case j.too_big:r="array"===e.type?`Array must contain ${e.exact?"exactly":e.inclusive?"at most":"less than"} ${e.maximum} element(s)`:"string"===e.type?`String must contain ${e.exact?"exactly":e.inclusive?"at most":"under"} ${e.maximum} character(s)`:"number"===e.type?`Number must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"bigint"===e.type?`BigInt must be ${e.exact?"exactly":e.inclusive?"less than or equal to":"less than"} ${e.maximum}`:"date"===e.type?`Date must be ${e.exact?"exactly":e.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(e.maximum))}`:"Invalid input";break;case j.custom:r="Invalid input";break;case j.invalid_intersection_types:r="Intersection results could not be merged";break;case j.not_multiple_of:r=`Number must be a multiple of ${e.multipleOf}`;break;case j.not_finite:r="Number must be finite";break;default:r=t.defaultError,c.assertNever(e)}return{message:r}},q=F;function z(){return q}let H=e=>{let{data:t,path:r,errorMaps:i,issueData:n}=e,s=[...r,...n.path||[]],o={...n,path:s},a="";for(let e of i.filter(e=>!!e).slice().reverse())a=e(o,{data:t,defaultError:a}).message;return{...n,path:s,message:n.message||a}};function W(e,t){let r=H({issueData:t,data:e.data,path:e.path,errorMaps:[e.common.contextualErrorMap,e.schemaErrorMap,z(),F].filter(e=>!!e)});e.common.issues.push(r)}class V{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(e,t){let r=[];for(let i of t){if("aborted"===i.status)return K;"dirty"===i.status&&e.dirty(),r.push(i.value)}return{status:e.value,value:r}}static async mergeObjectAsync(e,t){let r=[];for(let e of t)r.push({key:await e.key,value:await e.value});return V.mergeObjectSync(e,r)}static mergeObjectSync(e,t){let r={};for(let i of t){let{key:t,value:n}=i;if("aborted"===t.status||"aborted"===n.status)return K;"dirty"===t.status&&e.dirty(),"dirty"===n.status&&e.dirty(),"__proto__"!==t.value&&(void 0!==n.value||i.alwaysSet)&&(r[t.value]=n.value)}return{status:e.value,value:r}}}let K=Object.freeze({status:"aborted"}),Z=e=>({status:"dirty",value:e}),G=e=>
884({status:"valid",value:e}),Y=e=>"aborted"===e.status,J=e=>"dirty"===e.status,X=e=>"valid"===e.status,Q=e=>"undefined"!=typeof Promise&&e instanceof Promise;(o=u||(u={})).errToObj=e=>"string"==typeof e?{message:e}:e||{},o.toString=e=>"string"==typeof e?e:null==e?void 0:e.message;class ee{constructor(e,t,r,i){this._cachedPath=[],this.parent=e,this.data=t,this._path=r,this._key=i}get path(){return this._cachedPath.length||(this._key instanceof Array?this._cachedPath.push(...this._path,...this._key):this._cachedPath.push(...this._path,this._key)),this._cachedPath}}let et=(e,t)=>{if(X(t))return{success:!0,data:t.value};if(!e.common.issues.length)throw Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;let t=new $(e.common.issues);return this._error=t,this._error}}};function er(e){if(!e)return{};let{errorMap:t,invalid_type_error:r,required_error:i,description:n}=e;if(t&&(r||i))throw Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return t?{errorMap:t,description:n}:{errorMap:(e,t)=>"invalid_type"!==e.code?{message:t.defaultError}:void 0===t.data?{message:null!=i?i:t.defaultError}:{message:null!=r?r:t.defaultError},description:n}}class ei{constructor(e){this.spa=this.safeParseAsync,this._def=e,this.parse=this.parse.bind(this),this.safeParse=this.safeParse.bind(this),this.parseAsync=this.parseAsync.bind(this),this.safeParseAsync=this.safeParseAsync.bind(this),this.spa=this.spa.bind(this),this.refine=this.refine.bind(this),this.refinement=this.refinement.bind(this),this.superRefine=this.superRefine.bind(this),this.optional=this.optional.bind(this),this.nullable=this.nullable.bind(this),this.nullish=this.nullish.bind(this),this.array=this.array.bind(this),this.promise=this.promise.bind(this),this.or=this.or.bind(this),this.and=this.and.bind(this),this.transform=this.transform.bind(this),this.brand=this.brand.bind(this),this.default=this.default.bind(this),this.catch=this.catch.bind(this),this.describe=this.describe.bind(this),this.pipe=this.pipe.bind(this),this.readonly=this.readonly.bind(this),this.isNullable=this.isNullable.bind(this),this.isOptional=this.isOptional.bind(this)}get description(){return this._def.description}_getType(e){return B(e.data)}_getOrReturnCtx(e,t){return t||{common:e.parent.common,data:e.data,parsedType:B(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}_processInputParams(e){return{status:new V,ctx:{common:e.parent.common,data:e.data,parsedType:B(e.data),schemaErrorMap:this._def.errorMap,path:e.path,parent:e.parent}}}_parseSync(e){let t=this._parse(e);if(Q(t))throw Error("Synchronous parse encountered promise.");return t}_parseAsync(e){return Promise.resolve(this._parse(e))}parse(e,t){let r=this.safeParse(e,t);if(r.success)return r.data;throw r.error}safeParse(e,t){var r;let i={common:{issues:[],async:null!==(r=null==t?void 0:t.async)&&void 0!==r&&r,contextualErrorMap:null==t?void 0:t.errorMap},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:B(e)},n=this._parseSync({data:e,path:i.path,parent:i});return et(i,n)}async parseAsync(e,t){let r=await this.safeParseAsync(e,t);if(r.success)return r.data;throw r.error}async safeParseAsync(e,t){let r={common:{issues:[],contextualErrorMap:null==t?void 0:t.errorMap,async:!0},path:(null==t?void 0:t.path)||[],schemaErrorMap:this._def.errorMap,parent:null,data:e,parsedType:B(e)},i=this._parse({data:e,path:r.path,parent:r});return et(r,await (Q(i)?i:Promise.resolve(i)))}refine(e,t){let r=e=>"string"==typeof t||void 0===t?{message:t}:"function"==typeof t?t(e):t;return this._refinement((t,i)=>{let n=e(t),s=()=>i.addIssue({code:j.custom,...r(t)});return"undefined"!=typeof Promise&&n instanceof Promise?n.then(e=>!!e||(s(),!1)):!!n||(s(),!1)})}refinement(e,t){return this._refinement((r,i)=>!!e(r)||(i.addIssue("function"==typeof t?t(r,i):t),!1))}_refinement(e){return new eF({schema:this,typeName:h.ZodEffects,effect:{type:"refinement",refinement:e}})}superRefine(e){return this._refinement(e)}optional(){return eq.create(this,this._def)}nullable(){return ez.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return eA.create(this,this._def)}promise(){return e$.create(this,this._def)}or(e){return eS.create([this,e],this._def)}and(e){return ex.create(this,e,this._def)}transform(e){return new eF({...er(this._def),schema:this,typeName:h.ZodEffects,effect:{type:"transform",transform:e}})}default(e){return new eH({...er(this._def),innerType:this,defaultValue:"function"==typeof e?e:()=>e,typeName:h.ZodDefault})}brand(){return new eZ({typeName:h.ZodBranded,type:this,...er(this._def)})}catch(e){return new eW({...er(this._def),innerType:this,catchValue:"function"==typeof e?e:()=>e,typeName:h.ZodCatch})}describe(e){return new this.constructor({...this._def,description:e})}pipe(e){return eG.create(this,e)}readonly(){return eY.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}let en=/^c[^\s-]{8,}
884$/i,es=/^[a-z][a-z0-9]*$/,eo=/^[0-9A-HJKMNP-TV-Z]{26}$/,ea=/^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i,ec=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i,el=/^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/,eu=/^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/,eh=e=>e.precision?e.offset?RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${e.precision}}Z$`):0===e.precision?e.offset?RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):e.offset?RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");class ed extends ei{_parse(e){let t;if(this._def.coerce&&(e.data=String(e.data)),this._getType(e)!==L.string){let t=this._getOrReturnCtx(e);return W(t,{code:j.invalid_type,expected:L.string,received:t.parsedType}),K}let r=new V;for(let o of this._def.checks)if("min"===o.kind)e.data.length<o.value&&(W(t=this._getOrReturnCtx(e,t),{code:j.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if("max"===o.kind)e.data.length>o.value&&(W(t=this._getOrReturnCtx(e,t),{code:j.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!1,message:o.message}),r.dirty());else if("length"===o.kind){let i=e.data.length>o.value,n=e.data.length<o.value;(i||n)&&(t=this._getOrReturnCtx(e,t),i?W(t,{code:j.too_big,maximum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}):n&&W(t,{code:j.too_small,minimum:o.value,type:"string",inclusive:!0,exact:!0,message:o.message}),r.dirty())}else if("email"===o.kind)ec.test(e.data)||(W(t=this._getOrReturnCtx(e,t),{validation:"email",code:j.invalid_string,message:o.message}),r.dirty());else if("emoji"===o.kind)i||(i=RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),i.test(e.data)||(W(t=this._getOrReturnCtx(e,t),{validation:"emoji",code:j.invalid_string,message:o.message}),r.dirty());else if("uuid"===o.kind)ea.test(e.data)||(W(t=this._getOrReturnCtx(e,t),{validation:"uuid",code:j.invalid_string,message:o.message}),r.dirty());else if("cuid"===o.kind)en.test(e.data)||(W(t=this._getOrReturnCtx(e,t),{validation:"cuid",code:j.invalid_string,message:o.message}),r.dirty());else if("cuid2"===o.kind)es.test(e.data)||(W(t=this._getOrReturnCtx(e,t),{validation:"cuid2",code:j.invalid_string,message:o.message}),r.dirty());else if("ulid"===o.kind)eo.test(e.data)||(W(t=this._getOrReturnCtx(e,t),{validation:"ulid",code:j.invalid_string,message:o.message}),r.dirty());else if("url"===o.kind)try{new URL(e.data)}catch(i){W(t=this._getOrReturnCtx(e,t),{validation:"url",code:j.invalid_string,message:o.message}),r.dirty()}else if("regex"===o.kind)o.regex.lastIndex=0,o.regex.test(e.data)||(W(t=this._getOrReturnCtx(e,t),{validation:"regex",code:j.invalid_string,message:o.message}),r.dirty());else if("trim"===o.kind)e.data=e.data.trim();else if("includes"===o.kind)e.data.includes(o.value,o.position)||(W(t=this._getOrReturnCtx(e,t),{code:j.invalid_string,validation:{includes:o.value,position:o.position},message:o.message}),r.dirty());else if("toLowerCase"===o.kind)e.data=e.data.toLowerCase();else if("toUpperCase"===o.kind)e.data=e.data.toUpperCase();else if("startsWith"===o.kind)e.data.startsWith(o.value)||(W(t=this._getOrReturnCtx(e,t),{code:j.invalid_string,validation:{startsWith:o.value},message:o.message}),r.dirty());else if("endsWith"===o.kind)e.data.endsWith(o.value)||(W(t=this._getOrReturnCtx(e,t),{code:j.invalid_string,validation:{endsWith:o.value},message:o.message}),r.dirty());else if("datetime"===o.kind)eh(o).test(e.data)||(W(t=this._getOrReturnCtx(e,t),{code:j.invalid_string,validation:"datetime",message:o.message}),r.dirty());else if("ip"===o.kind){var n,s;n=e.data,("v4"===(s=o.version)||!s)&&el.test(n)||("v6"===s||!s)&&eu.test(n)||(W(t=this._getOrReturnCtx(e,t),{validation:"ip",code:j.invalid_string,message:o.message}),r.dirty())}else c.assertNever(o);return{status:r.value,value:e.data}}_regex(e,t,r){return this.refinement(t=>e.test(t),{validation:t,code:j.invalid_string,...u.errToObj(r)})}_addCheck(e){return new ed({...this._def,checks:[...this._def.checks,e]})}email(e){return this._addCheck({kind:"email",...u.errToObj(e)})}url(e){return this._addCheck({kind:"url",...u.errToObj(e)})}emoji(e){return this._addCheck({kind:"emoji",...u.errToObj(e)})}uuid(e){return this._addCheck({kind:"uuid",...u.errToObj(e)})}cuid(e){return this._addCheck({kind:"cuid",...u.errToObj(e)})}cuid2(e){return this._addCheck({kind:"cuid2",...u.errToObj(e)})}ulid(e){return this._addCheck({kind:"ulid",...u.errToObj(e)})}ip(e){return this._addCheck({kind:"ip",...u.errToObj(e)})}datetime(e){var t;return"string"==typeof e?this._addCheck({kind:"datetime",precision:null,offset:!1,message:e}):this._addCheck({kind:"datetime",precision:void 0===(null==e?void 0:e.precision)?null:null==e?void 0:e.precision,offset:null!==(t=null==e?void 0:e.offset)&&void 0!==t&&t,...u.errToObj(null==e?void 0:e.message)})}regex(e,t){return this._addCheck({kind:"regex",regex:e,...u.errToObj(t)})}includes(e,t){return this._addCheck({kind:"includes",value:e,position:null==t?void 0:t.position,...u.errToObj(null==t?void 0:t.message)})}startsWith(e,t){return this._addCheck({kind:"startsWith",value:e,...u.errToObj(t)})}endsWith(e,t){return this._addCheck({kind:"endsWith",value:e,...u.errToObj(t)})}min(e,t){return this._addCheck({kind:"min",value:e,...u.errToObj(t)})}max(e,t){return this._addCheck({kind:"max",value:e,...u.errToObj(t)})}length(e,t){return this._addCheck({kind:"length",value:e,...u.errToObj(t)})}nonempty(e){return this.min(1,u.errToObj(e))}trim(){return new ed({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new ed({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new ed({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(e=>"datetime"===e.kind)}get isEmail(){return!!this._def.checks.find(e=>"email"===e.kind)}get isURL(){return!!this._def.checks.find(e=>"url"===e.kind)}get isEmoji(){return!!this._def.checks.find(e=>"emoji"===e.kind)}
884get isUUID(){return!!this._def.checks.find(e=>"uuid"===e.kind)}get isCUID(){return!!this._def.checks.find(e=>"cuid"===e.kind)}get isCUID2(){return!!this._def.checks.find(e=>"cuid2"===e.kind)}get isULID(){return!!this._def.checks.find(e=>"ulid"===e.kind)}get isIP(){return!!this._def.checks.find(e=>"ip"===e.kind)}get minLength(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxLength(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}ed.create=e=>{var t;return new ed({checks:[],typeName:h.ZodString,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...er(e)})};class ep extends ei{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(e){let t;if(this._def.coerce&&(e.data=Number(e.data)),this._getType(e)!==L.number){let t=this._getOrReturnCtx(e);return W(t,{code:j.invalid_type,expected:L.number,received:t.parsedType}),K}let r=new V;for(let i of this._def.checks)"int"===i.kind?c.isInteger(e.data)||(W(t=this._getOrReturnCtx(e,t),{code:j.invalid_type,expected:"integer",received:"float",message:i.message}),r.dirty()):"min"===i.kind?(i.inclusive?e.data<i.value:e.data<=i.value)&&(W(t=this._getOrReturnCtx(e,t),{code:j.too_small,minimum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),r.dirty()):"max"===i.kind?(i.inclusive?e.data>i.value:e.data>=i.value)&&(W(t=this._getOrReturnCtx(e,t),{code:j.too_big,maximum:i.value,type:"number",inclusive:i.inclusive,exact:!1,message:i.message}),r.dirty()):"multipleOf"===i.kind?0!==function(e,t){let r=(e.toString().split(".")[1]||"").length,i=(t.toString().split(".")[1]||"").length,n=r>i?r:i;return parseInt(e.toFixed(n).replace(".",""))%parseInt(t.toFixed(n).replace(".",""))/Math.pow(10,n)}(e.data,i.value)&&(W(t=this._getOrReturnCtx(e,t),{code:j.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):"finite"===i.kind?Number.isFinite(e.data)||(W(t=this._getOrReturnCtx(e,t),{code:j.not_finite,message:i.message}),r.dirty()):c.assertNever(i);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,u.toString(t))}gt(e,t){return this.setLimit("min",e,!1,u.toString(t))}lte(e,t){return this.setLimit("max",e,!0,u.toString(t))}lt(e,t){return this.setLimit("max",e,!1,u.toString(t))}setLimit(e,t,r,i){return new ep({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:u.toString(i)}]})}_addCheck(e){return new ep({...this._def,checks:[...this._def.checks,e]})}int(e){return this._addCheck({kind:"int",message:u.toString(e)})}positive(e){return this._addCheck({kind:"min",value:0,inclusive:!1,message:u.toString(e)})}negative(e){return this._addCheck({kind:"max",value:0,inclusive:!1,message:u.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:0,inclusive:!0,message:u.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:0,inclusive:!0,message:u.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:u.toString(t)})}finite(e){return this._addCheck({kind:"finite",message:u.toString(e)})}safe(e){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:u.toString(e)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:u.toString(e)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}get isInt(){return!!this._def.checks.find(e=>"int"===e.kind||"multipleOf"===e.kind&&c.isInteger(e.value))}get isFinite(){let e=null,t=null;for(let r of this._def.checks){if("finite"===r.kind||"int"===r.kind||"multipleOf"===r.kind)return!0;"min"===r.kind?(null===t||r.value>t)&&(t=r.value):"max"===r.kind&&(null===e||r.value<e)&&(e=r.value)}return Number.isFinite(t)&&Number.isFinite(e)}}ep.create=e=>new ep({checks:[],typeName:h.ZodNumber,coerce:(null==e?void 0:e.coerce)||!1,...er(e)});class ef extends ei{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(e){let t;if(this._def.coerce&&(e.data=BigInt(e.data)),this._getType(e)!==L.bigint){let t=this._getOrReturnCtx(e);return W(t,{code:j.invalid_type,expected:L.bigint,received:t.parsedType}),K}let r=new V;for(let i of this._def.checks)"min"===i.kind?(i.inclusive?e.data<i.value:e.data<=i.value)&&(W
884(t=this._getOrReturnCtx(e,t),{code:j.too_small,type:"bigint",minimum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):"max"===i.kind?(i.inclusive?e.data>i.value:e.data>=i.value)&&(W(t=this._getOrReturnCtx(e,t),{code:j.too_big,type:"bigint",maximum:i.value,inclusive:i.inclusive,message:i.message}),r.dirty()):"multipleOf"===i.kind?e.data%i.value!==BigInt(0)&&(W(t=this._getOrReturnCtx(e,t),{code:j.not_multiple_of,multipleOf:i.value,message:i.message}),r.dirty()):c.assertNever(i);return{status:r.value,value:e.data}}gte(e,t){return this.setLimit("min",e,!0,u.toString(t))}gt(e,t){return this.setLimit("min",e,!1,u.toString(t))}lte(e,t){return this.setLimit("max",e,!0,u.toString(t))}lt(e,t){return this.setLimit("max",e,!1,u.toString(t))}setLimit(e,t,r,i){return new ef({...this._def,checks:[...this._def.checks,{kind:e,value:t,inclusive:r,message:u.toString(i)}]})}_addCheck(e){return new ef({...this._def,checks:[...this._def.checks,e]})}positive(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:u.toString(e)})}negative(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:u.toString(e)})}nonpositive(e){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:u.toString(e)})}nonnegative(e){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:u.toString(e)})}multipleOf(e,t){return this._addCheck({kind:"multipleOf",value:e,message:u.toString(t)})}get minValue(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return e}get maxValue(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return e}}ef.create=e=>{var t;return new ef({checks:[],typeName:h.ZodBigInt,coerce:null!==(t=null==e?void 0:e.coerce)&&void 0!==t&&t,...er(e)})};class eg extends ei{_parse(e){if(this._def.coerce&&(e.data=!!e.data),this._getType(e)!==L.boolean){let t=this._getOrReturnCtx(e);return W(t,{code:j.invalid_type,expected:L.boolean,received:t.parsedType}),K}return G(e.data)}}eg.create=e=>new eg({typeName:h.ZodBoolean,coerce:(null==e?void 0:e.coerce)||!1,...er(e)});class em extends ei{_parse(e){let t;if(this._def.coerce&&(e.data=new Date(e.data)),this._getType(e)!==L.date){let t=this._getOrReturnCtx(e);return W(t,{code:j.invalid_type,expected:L.date,received:t.parsedType}),K}if(isNaN(e.data.getTime()))return W(this._getOrReturnCtx(e),{code:j.invalid_date}),K;let r=new V;for(let i of this._def.checks)"min"===i.kind?e.data.getTime()<i.value&&(W(t=this._getOrReturnCtx(e,t),{code:j.too_small,message:i.message,inclusive:!0,exact:!1,minimum:i.value,type:"date"}),r.dirty()):"max"===i.kind?e.data.getTime()>i.value&&(W(t=this._getOrReturnCtx(e,t),{code:j.too_big,message:i.message,inclusive:!0,exact:!1,maximum:i.value,type:"date"}),r.dirty()):c.assertNever(i);return{status:r.value,value:new Date(e.data.getTime())}}_addCheck(e){return new em({...this._def,checks:[...this._def.checks,e]})}min(e,t){return this._addCheck({kind:"min",value:e.getTime(),message:u.toString(t)})}max(e,t){return this._addCheck({kind:"max",value:e.getTime(),message:u.toString(t)})}get minDate(){let e=null;for(let t of this._def.checks)"min"===t.kind&&(null===e||t.value>e)&&(e=t.value);return null!=e?new Date(e):null}get maxDate(){let e=null;for(let t of this._def.checks)"max"===t.kind&&(null===e||t.value<e)&&(e=t.value);return null!=e?new Date(e):null}}em.create=e=>new em({checks:[],coerce:(null==e?void 0:e.coerce)||!1,typeName:h.ZodDate,...er(e)});class ey extends ei{_parse(e){if(this._getType(e)!==L.symbol){let t=this._getOrReturnCtx(e);return W(t,{code:j.invalid_type,expected:L.symbol,received:t.parsedType}),K}return G(e.data)}}ey.create=e=>new ey({typeName:h.ZodSymbol,...er(e)});class ew extends ei{_parse(e){if(this._getType(e)!==L.undefined){let t=this._getOrReturnCtx(e);return W(t,{code:j.invalid_type,expected:L.undefined,received:t.parsedType}),K}return G(e.data)}}ew.create=e=>new ew({typeName:h.ZodUndefined,...er(e)});class eb extends ei{_parse(e){if(this._getType(e)!==L.null){let t=this._getOrReturnCtx(e);return W(t,{code:j.invalid_type,expected:L.null,received:t.parsedType}),K}return G(e.data)}}eb.create=e=>new eb({typeName:h.ZodNull,...er(e)});class ev extends ei{constructor(){super(...arguments),this._any=!0}_parse(e){return G(e.data)}}ev.create=e=>new ev({typeName:h.ZodAny,...er(e)});class eE extends ei{constructor(){super(...arguments),this._unknown=!0}_parse(e){return G(e.data)}}eE.create=e=>new eE({typeName:h.ZodUnknown,...er(e)});class e_ extends ei{_parse(e){let t=this._getOrReturnCtx(e);return W(t,{code:j.invalid_type,expected:L.never,received:t.parsedType}),K}}e_.create=e=>new e_({typeName:h.ZodNever,...er(e)});class eC extends ei{_parse(e){if(this._getType(e)!==L.undefined){let t=this._getOrReturnCtx(e);return W(t,{code:j.invalid_type,expected:L.void,received:t.parsedType}),K}return G(e.data)}}eC.create=e=>new eC({typeName:h.ZodVoid,...er(e)});class eA extends ei{_parse(e){let{ctx:t,status:r}=this._processInputParams(e),i=this._def;if(t.parsedType!==L.array)return W(t,{code:j.invalid_type,expected:L.array,received:t.parsedType}),K;if(null!==i.exactLength){let e=t.data.length>
884i.exactLength.value,n=t.data.length<i.exactLength.value;(e||n)&&(W(t,{code:e?j.too_big:j.too_small,minimum:n?i.exactLength.value:void 0,maximum:e?i.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:i.exactLength.message}),r.dirty())}if(null!==i.minLength&&t.data.length<i.minLength.value&&(W(t,{code:j.too_small,minimum:i.minLength.value,type:"array",inclusive:!0,exact:!1,message:i.minLength.message}),r.dirty()),null!==i.maxLength&&t.data.length>i.maxLength.value&&(W(t,{code:j.too_big,maximum:i.maxLength.value,type:"array",inclusive:!0,exact:!1,message:i.maxLength.message}),r.dirty()),t.common.async)return Promise.all([...t.data].map((e,r)=>i.type._parseAsync(new ee(t,e,t.path,r)))).then(e=>V.mergeArray(r,e));let n=[...t.data].map((e,r)=>i.type._parseSync(new ee(t,e,t.path,r)));return V.mergeArray(r,n)}get element(){return this._def.type}min(e,t){return new eA({...this._def,minLength:{value:e,message:u.toString(t)}})}max(e,t){return new eA({...this._def,maxLength:{value:e,message:u.toString(t)}})}length(e,t){return new eA({...this._def,exactLength:{value:e,message:u.toString(t)}})}nonempty(e){return this.min(1,e)}}eA.create=(e,t)=>new eA({type:e,minLength:null,maxLength:null,exactLength:null,typeName:h.ZodArray,...er(t)});class eI extends ei{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;let e=this._def.shape(),t=c.objectKeys(e);return this._cached={shape:e,keys:t}}_parse(e){if(this._getType(e)!==L.object){let t=this._getOrReturnCtx(e);return W(t,{code:j.invalid_type,expected:L.object,received:t.parsedType}),K}let{status:t,ctx:r}=this._processInputParams(e),{shape:i,keys:n}=this._getCached(),s=[];if(!(this._def.catchall instanceof e_&&"strip"===this._def.unknownKeys))for(let e in r.data)n.includes(e)||s.push(e);let o=[];for(let e of n){let t=i[e],n=r.data[e];o.push({key:{status:"valid",value:e},value:t._parse(new ee(r,n,r.path,e)),alwaysSet:e in r.data})}if(this._def.catchall instanceof e_){let e=this._def.unknownKeys;if("passthrough"===e)for(let e of s)o.push({key:{status:"valid",value:e},value:{status:"valid",value:r.data[e]}});else if("strict"===e)s.length>0&&(W(r,{code:j.unrecognized_keys,keys:s}),t.dirty());else if("strip"===e);else throw Error("Internal ZodObject error: invalid unknownKeys value.")}else{let e=this._def.catchall;for(let t of s){let i=r.data[t];o.push({key:{status:"valid",value:t},value:e._parse(new ee(r,i,r.path,t)),alwaysSet:t in r.data})}}return r.common.async?Promise.resolve().then(async()=>{let e=[];for(let t of o){let r=await t.key;e.push({key:r,value:await t.value,alwaysSet:t.alwaysSet})}return e}).then(e=>V.mergeObjectSync(t,e)):V.mergeObjectSync(t,o)}get shape(){return this._def.shape()}strict(e){return u.errToObj,new eI({...this._def,unknownKeys:"strict",...void 0!==e?{errorMap:(t,r)=>{var i,n,s,o;let a=null!==(s=null===(n=(i=this._def).errorMap)||void 0===n?void 0:n.call(i,t,r).message)&&void 0!==s?s:r.defaultError;return"unrecognized_keys"===t.code?{message:null!==(o=u.errToObj(e).message)&&void 0!==o?o:a}:{message:a}}}:{}})}strip(){return new eI({...this._def,unknownKeys:"strip"})}passthrough(){return new eI({...this._def,unknownKeys:"passthrough"})}extend(e){return new eI({...this._def,shape:()=>({...this._def.shape(),...e})})}merge(e){return new eI({unknownKeys:e._def.unknownKeys,catchall:e._def.catchall,shape:()=>({...this._def.shape(),...e._def.shape()}),typeName:h.ZodObject})}setKey(e,t){return this.augment({[e]:t})}catchall(e){return new eI({...this._def,catchall:e})}pick(e){let t={};return c.objectKeys(e).forEach(r=>{e[r]&&this.shape[r]&&(t[r]=this.shape[r])}),new eI({...this._def,shape:()=>t})}omit(e){let t={};return c.objectKeys(this.shape).forEach(r=>{e[r]||(t[r]=this.shape[r])}),new eI({...this._def,shape:()=>t})}deepPartial(){return function e(t){if(t instanceof eI){let r={};for(let i in t.shape){let n=t.shape[i];r[i]=eq.create(e(n))}return new eI({...t._def,shape:()=>r})}return t instanceof eA?new eA({...t._def,type:e(t.element)}):t instanceof eq?eq.create(e(t.unwrap())):t instanceof ez?ez.create(e(t.unwrap())):t instanceof eT?eT.create(t.items.map(t=>e(t))):t}(this)}partial(e){let t={};return c.objectKeys(this.shape).forEach(r=>{let i=this.shape[r];e&&!e[r]?t[r]=i:t[r]=i.optional()}),new eI({...this._def,shape:()=>t})}required(e){let t={};return c.objectKeys(this.shape).forEach(r=>{if(e&&!e[r])t[r]=this.shape[r];else{let e=this.shape[r];for(;e instanceof eq;)e=e._def.innerType;t[r]=e}}),new eI({...this._def,shape:()=>t})}keyof(){return eL(c.objectKeys(this.shape))}}eI.create=(e,t)=>
884new eI({shape:()=>e,unknownKeys:"strip",catchall:e_.create(),typeName:h.ZodObject,...er(t)}),eI.strictCreate=(e,t)=>new eI({shape:()=>e,unknownKeys:"strict",catchall:e_.create(),typeName:h.ZodObject,...er(t)}),eI.lazycreate=(e,t)=>new eI({shape:e,unknownKeys:"strip",catchall:e_.create(),typeName:h.ZodObject,...er(t)});class eS extends ei{_parse(e){let{ctx:t}=this._processInputParams(e),r=this._def.options;if(t.common.async)return Promise.all(r.map(async e=>{let r={...t,common:{...t.common,issues:[]},parent:null};return{result:await e._parseAsync({data:t.data,path:t.path,parent:r}),ctx:r}})).then(function(e){for(let t of e)if("valid"===t.result.status)return t.result;for(let r of e)if("dirty"===r.result.status)return t.common.issues.push(...r.ctx.common.issues),r.result;let r=e.map(e=>new $(e.ctx.common.issues));return W(t,{code:j.invalid_union,unionErrors:r}),K});{let e;let i=[];for(let n of r){let r={...t,common:{...t.common,issues:[]},parent:null},s=n._parseSync({data:t.data,path:t.path,parent:r});if("valid"===s.status)return s;"dirty"!==s.status||e||(e={result:s,ctx:r}),r.common.issues.length&&i.push(r.common.issues)}if(e)return t.common.issues.push(...e.ctx.common.issues),e.result;let n=i.map(e=>new $(e));return W(t,{code:j.invalid_union,unionErrors:n}),K}}get options(){return this._def.options}}eS.create=(e,t)=>new eS({options:e,typeName:h.ZodUnion,...er(t)});let eN=e=>{if(e instanceof eM)return eN(e.schema);if(e instanceof eF)return eN(e.innerType());if(e instanceof eU)return[e.value];if(e instanceof eB)return e.options;if(e instanceof ej)return Object.keys(e.enum);if(e instanceof eH)return eN(e._def.innerType);if(e instanceof ew)return[void 0];else if(e instanceof eb)return[null];else return null};class eO extends ei{_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==L.object)return W(t,{code:j.invalid_type,expected:L.object,received:t.parsedType}),K;let r=this.discriminator,i=t.data[r],n=this.optionsMap.get(i);return n?t.common.async?n._parseAsync({data:t.data,path:t.path,parent:t}):n._parseSync({data:t.data,path:t.path,parent:t}):(W(t,{code:j.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[r]}),K)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(e,t,r){let i=new Map;
884for(let r of t){let t=eN(r.shape[e]);if(!t)throw Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);for(let n of t){if(i.has(n))throw Error(`Discriminator property ${String(e)} has duplicate value ${String(n)}`);i.set(n,r)}}return new eO({typeName:h.ZodDiscriminatedUnion,discriminator:e,options:t,optionsMap:i,...er(r)})}}class ex extends ei{_parse(e){let{status:t,ctx:r}=this._processInputParams(e),i=(e,i)=>{if(Y(e)||Y(i))return K;let n=function e(t,r){let i=B(t),n=B(r);if(t===r)return{valid:!0,data:t};if(i===L.object&&n===L.object){let i=c.objectKeys(r),n=c.objectKeys(t).filter(e=>-1!==i.indexOf(e)),s={...t,...r};for(let i of n){let n=e(t[i],r[i]);if(!n.valid)return{valid:!1};s[i]=n.data}return{valid:!0,data:s}}if(i===L.array&&n===L.array){if(t.length!==r.length)return{valid:!1};let i=[];for(let n=0;n<t.length;n++){let s=e(t[n],r[n]);if(!s.valid)return{valid:!1};i.push(s.data)}return{valid:!0,data:i}}return i===L.date&&n===L.date&&+t==+r?{valid:!0,data:t}:{valid:!1}}(e.value,i.value);return n.valid?((J(e)||J(i))&&t.dirty(),{status:t.value,value:n.data}):(W(r,{code:j.invalid_intersection_types}),K)};return r.common.async?Promise.all([this._def.left._parseAsync({data:r.data,path:r.path,parent:r}),this._def.right._parseAsync({data:r.data,path:r.path,parent:r})]).then(([e,t])=>i(e,t)):i(this._def.left._parseSync({data:r.data,path:r.path,parent:r}),this._def.right._parseSync({data:r.data,path:r.path,parent:r}))}}ex.create=(e,t,r)=>new ex({left:e,right:t,typeName:h.ZodIntersection,...er(r)});class eT extends ei{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==L.array)return W(r,{code:j.invalid_type,expected:L.array,received:r.parsedType}),K;if(r.data.length<this._def.items.length)return W(r,{code:j.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),K;!this._def.rest&&r.data.length>this._def.items.length&&(W(r,{code:j.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),t.dirty());let i=[...r.data].map((e,t)=>{let i=this._def.items[t]||this._def.rest;return i?i._parse(new ee(r,e,r.path,t)):null}).filter(e=>!!e);return r.common.async?Promise.all(i).then(e=>V.mergeArray(t,e)):V.mergeArray(t,i)}get items(){return this._def.items}rest(e){return new eT({...this._def,rest:e})}}eT.create=(e,t)=>{if(!Array.isArray(e))throw Error("You must pass an array of schemas to z.tuple([ ... ])");return new eT({items:e,typeName:h.ZodTuple,rest:null,...er(t)})};class eR extends ei{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==L.object)return W(r,{code:j.invalid_type,expected:L.object,received:r.parsedType}),K;let i=[],n=this._def.keyType,s=this._def.valueType;for(let e in r.data)i.push({key:n._parse(new ee(r,e,r.path,e)),value:s._parse(new ee(r,r.data[e],r.path,e))});return r.common.async?V.mergeObjectAsync(t,i):V.mergeObjectSync(t,i)}get element(){return this._def.valueType}static create(e,t,r){return new eR(t instanceof ei?{keyType:e,valueType:t,typeName:h.ZodRecord,...er(r)}:{keyType:ed.create(),valueType:e,typeName:h.ZodRecord,...er(t)})}}class eP extends ei{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==L.map)return W(r,{code:j.invalid_type,expected:L.map,received:r.parsedType}),K;let i=this._def.keyType,n=this._def.valueType,s=[...r.data.entries()].map(([e,t],s)=>({key:i._parse(new ee(r,e,r.path,[s,"key"])),value:n._parse(new ee(r,t,r.path,[s,"value"]))}));if(r.common.async){let e=new Map;return Promise.resolve().then(async()=>{for(let r of s){let i=await r.key,n=await r.value;if("aborted"===i.status||"aborted"===n.status)return K;("dirty"===i.status||"dirty"===n.status)&&t.dirty(),e.set(i.value,n.value)}return{status:t.value,value:e}})}{let e=new Map;for(let r of s){let i=r.key,n=r.value;if("aborted"===i.status||"aborted"===n.status)return K;("dirty"===i.status||"dirty"===n.status)&&t.dirty(),e.set(i.value,
884n.value)}return{status:t.value,value:e}}}}eP.create=(e,t,r)=>new eP({valueType:t,keyType:e,typeName:h.ZodMap,...er(r)});class ek extends ei{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.parsedType!==L.set)return W(r,{code:j.invalid_type,expected:L.set,received:r.parsedType}),K;let i=this._def;null!==i.minSize&&r.data.size<i.minSize.value&&(W(r,{code:j.too_small,minimum:i.minSize.value,type:"set",inclusive:!0,exact:!1,message:i.minSize.message}),t.dirty()),null!==i.maxSize&&r.data.size>i.maxSize.value&&(W(r,{code:j.too_big,maximum:i.maxSize.value,type:"set",inclusive:!0,exact:!1,message:i.maxSize.message}),t.dirty());let n=this._def.valueType;function s(e){let r=new Set;for(let i of e){if("aborted"===i.status)return K;"dirty"===i.status&&t.dirty(),r.add(i.value)}return{status:t.value,value:r}}let o=[...r.data.values()].map((e,t)=>n._parse(new ee(r,e,r.path,t)));return r.common.async?Promise.all(o).then(e=>s(e)):s(o)}min(e,t){return new ek({...this._def,minSize:{value:e,message:u.toString(t)}})}max(e,t){return new ek({...this._def,maxSize:{value:e,message:u.toString(t)}})}size(e,t){return this.min(e,t).max(e,t)}nonempty(e){return this.min(1,e)}}ek.create=(e,t)=>new ek({valueType:e,minSize:null,maxSize:null,typeName:h.ZodSet,...er(t)});class eD extends ei{constructor(){super(...arguments),this.validate=this.implement}_parse(e){let{ctx:t}=this._processInputParams(e);if(t.parsedType!==L.function)return W(t,{code:j.invalid_type,expected:L.function,received:t.parsedType}),K;function r(e,r){return H({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,z(),F].filter(e=>!!e),issueData:{code:j.invalid_arguments,argumentsError:r}})}function i(e,r){return H({data:e,path:t.path,errorMaps:[t.common.contextualErrorMap,t.schemaErrorMap,z(),F].filter(e=>!!e),issueData:{code:j.invalid_return_type,returnTypeError:r}})}let n={errorMap:t.common.contextualErrorMap},s=t.data;if(this._def.returns instanceof e$){let e=this;return G(async function(...t){let o=new $([]),a=await e._def.args.parseAsync(t,n).catch(e=>{throw o.addIssue(r(t,e)),o}),c=await Reflect.apply(s,this,a);return await e._def.returns._def.type.parseAsync(c,n).catch(e=>{throw o.addIssue(i(c,e)),o})})}{let e=this;return G(function(...t){let o=e._def.args.safeParse(t,n);if(!o.success)throw new $([r(t,o.error)]);let a=Reflect.apply(s,this,o.data),c=e._def.returns.safeParse(a,n);if(!c.success)throw new $([i(a,c.error)]);return c.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...e){return new eD({...this._def,args:eT.create(e).rest(eE.create())})}returns(e){return new eD({...this._def,returns:e})}implement(e){return this.parse(e)}strictImplement(e){return this.parse(e)}static create(e,t,r){return new eD({args:e||eT.create([]).rest(eE.create()),returns:t||eE.create(),typeName:h.ZodFunction,...er(r)})}}class eM extends ei{get schema(){return this._def.getter()}_parse(e){let{ctx:t}=this._processInputParams(e);return this._def.getter()._parse({data:t.data,path:t.path,parent:t})}}eM.create=(e,t)=>new eM({getter:e,typeName:h.ZodLazy,...er(t)});class eU extends ei{_parse(e){if(e.data!==this._def.value){let t=this._getOrReturnCtx(e);return W(t,{received:t.data,code:j.invalid_literal,expected:this._def.value}),K}return{status:"valid",value:e.data}}get value(){return this._def.value}}function eL(e,t){return new eB({values:e,typeName:h.ZodEnum,...er(t)})}eU.create=(e,t)=>new eU({value:e,typeName:h.ZodLiteral,...er(t)});class eB extends ei{_parse(e){if("string"!=typeof e.data){let t=this._getOrReturnCtx(e),r=this._def.values;return W(t,{expected:c.joinValues(r),received:t.parsedType,code:j.invalid_type}),K}if(-1===this._def.values.indexOf(e.data)){let t=this._getOrReturnCtx(e),r=this._def.values;return W(t,{received:t.data,code:j.invalid_enum_value,options:r}),K}return G(e.data)}get options(){return this._def.values}get enum(){let e={};for(let t of this._def.values)e[t]=t;return e}get Values(){let e={};for(let t of this._def.values)e[t]=t;return e}get Enum(){let e={};for(let t of this._def.values)e[t]=t;return e}extract(e){return eB.create(e)}exclude(e){return eB.create(this.options.filter(t=>!e.includes(t)))}}eB.create=eL;class ej extends ei{_parse(e){let t=c.getValidEnumValues(this._def.values),r=this._getOrReturnCtx(e);if(r.parsedType!==L.string&&r.parsedType!==L.number){let e=c.objectValues(t);return W(r,{expected:c.joinValues(e),received:r.parsedType,code:j.invalid_type}),K}if(-1===t.indexOf(e.data)){let e=c.objectValues(t);return W(r,{received:r.data,code:j.invalid_enum_value,options:e}),K}return G(e.data)}get enum(){return this._def.values}}ej.create=(e,t)=>
884new ej({values:e,typeName:h.ZodNativeEnum,...er(t)});class e$ extends ei{unwrap(){return this._def.type}_parse(e){let{ctx:t}=this._processInputParams(e);return t.parsedType!==L.promise&&!1===t.common.async?(W(t,{code:j.invalid_type,expected:L.promise,received:t.parsedType}),K):G((t.parsedType===L.promise?t.data:Promise.resolve(t.data)).then(e=>this._def.type.parseAsync(e,{path:t.path,errorMap:t.common.contextualErrorMap})))}}e$.create=(e,t)=>new e$({type:e,typeName:h.ZodPromise,...er(t)});class eF extends ei{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===h.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(e){let{status:t,ctx:r}=this._processInputParams(e),i=this._def.effect||null,n={addIssue:e=>{W(r,e),e.fatal?t.abort():t.dirty()},get path(){return r.path}};if(n.addIssue=n.addIssue.bind(n),"preprocess"===i.type){let e=i.transform(r.data,n);return r.common.issues.length?{status:"dirty",value:r.data}:r.common.async?Promise.resolve(e).then(e=>this._def.schema._parseAsync({data:e,path:r.path,parent:r})):this._def.schema._parseSync({data:e,path:r.path,parent:r})}if("refinement"===i.type){let e=e=>{let t=i.refinement(e,n);if(r.common.async)return Promise.resolve(t);if(t instanceof Promise)throw Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return e};if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(r=>"aborted"===r.status?K:("dirty"===r.status&&t.dirty(),e(r.value).then(()=>({status:t.value,value:r.value}))));{let i=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===i.status?K:("dirty"===i.status&&t.dirty(),e(i.value),{status:t.value,value:i.value})}}if("transform"===i.type){if(!1!==r.common.async)return this._def.schema._parseAsync({data:r.data,path:r.path,parent:r}).then(e=>X(e)?Promise.resolve(i.transform(e.value,n)).then(e=>({status:t.value,value:e})):e);{let e=this._def.schema._parseSync({data:r.data,path:r.path,parent:r});if(!X(e))return e;let s=i.transform(e.value,n);if(s instanceof Promise)throw Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:t.value,value:s}}}c.assertNever(i)}}eF.create=(e,t,r)=>new eF({schema:e,typeName:h.ZodEffects,effect:t,...er(r)}),eF.createWithPreprocess=(e,t,r)=>new eF({schema:t,effect:{type:"preprocess",transform:e},typeName:h.ZodEffects,...er(r)});class eq extends ei{_parse(e){return this._getType(e)===L.undefined?G(void 0):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}eq.create=(e,t)=>new eq({innerType:e,typeName:h.ZodOptional,...er(t)});class ez extends ei{_parse(e){return this._getType(e)===L.null?G(null):this._def.innerType._parse(e)}unwrap(){return this._def.innerType}}ez.create=(e,t)=>new ez({innerType:e,typeName:h.ZodNullable,...er(t)});class eH extends ei{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return t.parsedType===L.undefined&&(r=this._def.defaultValue()),this._def.innerType._parse({data:r,path:t.path,parent:t})}removeDefault(){return this._def.innerType}}eH.create=(e,t)=>new eH({innerType:e,typeName:h.ZodDefault,defaultValue:"function"==typeof t.default?t.default:()=>t.default,...er(t)});class eW extends ei{_parse(e){let{ctx:t}=this._processInputParams(e),r={...t,common:{...t.common,issues:[]}},i=this._def.innerType._parse({data:r.data,path:r.path,parent:{...r}});return Q(i)?i.then(e=>({status:"valid",value:"valid"===e.status?e.value:this._def.catchValue({get error(){return new $(r.common.issues)},input:r.data})})):{status:"valid",value:"valid"===i.status?i.value:this._def.catchValue({get error(){return new $(r.common.issues)},input:r.data})}}removeCatch(){return this._def.innerType}}eW.create=(e,t)=>new eW({innerType:e,typeName:h.ZodCatch,catchValue:"function"==typeof t.catch?t.catch:()=>t.catch,...er(t)});class eV extends ei{_parse(e){if(this._getType(e)!==L.nan){let t=this._getOrReturnCtx(e);return W(t,{code:j.invalid_type,expected:L.nan,received:t.parsedType}),K}return{status:"valid",value:e.data}}}eV.create=e=>new eV({typeName:h.ZodNaN,...er(e)});let eK=Symbol("zod_brand");class eZ extends ei{_parse(e){let{ctx:t}=this._processInputParams(e),r=t.data;return this._def.type._parse({data:r,path:t.path,parent:t})}unwrap(){return this._def.type}}class eG extends ei{_parse(e){let{status:t,ctx:r}=this._processInputParams(e);if(r.common.async)return(async()=>{let e=await this._def.in._parseAsync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?K:"dirty"===e.status?(t.dirty(),Z(e.value)):this._def.out._parseAsync({data:e.value,path:r.path,parent:r})})();{let e=this._def.in._parseSync({data:r.data,path:r.path,parent:r});return"aborted"===e.status?K:"dirty"===e.status?(t.dirty(),{status:"dirty",value:e.value}):this._def.out._parseSync({data:e.value,path:r.path,parent:r})}}static create(e,t){return new eG({in:e,out:t,typeName:h.ZodPipeline})}}class eY extends ei{_parse(e){let t=this._def.innerType._parse(e);return X(t)&&(t.value=Object.freeze(t.value)),t}}eY.create=(e,t)=>
884new eY({innerType:e,typeName:h.ZodReadonly,...er(t)});let eJ=(e,t={},r)=>e?ev.create().superRefine((i,n)=>{var s,o;if(!e(i)){let e="function"==typeof t?t(i):"string"==typeof t?{message:t}:t,a=null===(o=null!==(s=e.fatal)&&void 0!==s?s:r)||void 0===o||o;n.addIssue({code:"custom",..."string"==typeof e?{message:e}:e,fatal:a})}}):ev.create(),eX={object:eI.lazycreate};(a=h||(h={})).ZodString="ZodString",a.ZodNumber="ZodNumber",a.ZodNaN="ZodNaN",a.ZodBigInt="ZodBigInt",a.ZodBoolean="ZodBoolean",a.ZodDate="ZodDate",a.ZodSymbol="ZodSymbol",a.ZodUndefined="ZodUndefined",a.ZodNull="ZodNull",a.ZodAny="ZodAny",a.ZodUnknown="ZodUnknown",a.ZodNever="ZodNever",a.ZodVoid="ZodVoid",a.ZodArray="ZodArray",a.ZodObject="ZodObject",a.ZodUnion="ZodUnion",a.ZodDiscriminatedUnion="ZodDiscriminatedUnion",a.ZodIntersection="ZodIntersection",a.ZodTuple="ZodTuple",a.ZodRecord="ZodRecord",a.ZodMap="ZodMap",a.ZodSet="ZodSet",a.ZodFunction="ZodFunction",a.ZodLazy="ZodLazy",a.ZodLiteral="ZodLiteral",a.ZodEnum="ZodEnum",a.ZodEffects="ZodEffects",a.ZodNativeEnum="ZodNativeEnum",a.ZodOptional="ZodOptional",a.ZodNullable="ZodNullable",a.ZodDefault="ZodDefault",a.ZodCatch="ZodCatch",a.ZodPromise="ZodPromise",a.ZodBranded="ZodBranded",a.ZodPipeline="ZodPipeline",a.ZodReadonly="ZodReadonly";let eQ=ed.create,e0=ep.create,e1=eV.create,e2=ef.create,e3=eg.create,e5=em.create,e8=ey.create,e6=ew.create,e4=eb.create,e9=ev.create,e7=eE.create,te=e_.create,tt=eC.create,tr=eA.create,ti=eI.create,tn=eI.strictCreate,ts=eS.create,to=eO.create,ta=ex.create,tc=eT.create,tl=eR.create,tu=eP.create,th=ek.create,td=eD.create,tp=eM.create,tf=eU.create,tg=eB.create,tm=ej.create,ty=e$.create,tw=eF.create,tb=eq.create,tv=ez.create,tE=eF.createWithPreprocess,t_=eG.create;var tC=Object.freeze({__proto__:null,defaultErrorMap:F,setErrorMap:function(e){q=e},getErrorMap:z,makeIssue:H,EMPTY_PATH:[],addIssueToContext:W,ParseStatus:V,INVALID:K,DIRTY:Z,OK:G,isAborted:Y,isDirty:J,isValid:X,isAsync:Q,get util(){return c},get objectUtil(){return l},ZodParsedType:L,getParsedType:B,ZodType:ei,ZodString:ed,ZodNumber:ep,ZodBigInt:ef,ZodBoolean:eg,ZodDate:em,ZodSymbol:ey,ZodUndefined:ew,ZodNull:eb,ZodAny:ev,ZodUnknown:eE,ZodNever:e_,ZodVoid:eC,ZodArray:eA,ZodObject:eI,ZodUnion:eS,ZodDiscriminatedUnion:eO,ZodIntersection:ex,ZodTuple:eT,ZodRecord:eR,ZodMap:eP,ZodSet:ek,ZodFunction:eD,ZodLazy:eM,ZodLiteral:eU,ZodEnum:eB,ZodNativeEnum:ej,ZodPromise:e$,ZodEffects:eF,ZodTransformer:eF,ZodOptional:eq,ZodNullable:ez,ZodDefault:eH,ZodCatch:eW,ZodNaN:eV,BRAND:eK,ZodBranded:eZ,ZodPipeline:eG,ZodReadonly:eY,custom:eJ,Schema:ei,ZodSchema:ei,late:eX,get ZodFirstPartyTypeKind(){return h},coerce:{string:e=>ed.create({...e,coerce:!0}),number:e=>ep.create({...e,coerce:!0}),boolean:e=>eg.create({...e,coerce:!0}),bigint:e=>ef.create({...e,coerce:!0}),date:e=>em.create({...e,coerce:!0})},any:e9,array:tr,bigint:e2,boolean:e3,date:e5,discriminatedUnion:to,effect:tw,enum:tg,function:td,instanceof:(e,t={message:`Input not instance of ${e.name}`})=>eJ(t=>t instanceof e,t),intersection:ta,lazy:tp,literal:tf,map:tu,nan:e1,nativeEnum:tm,never:te,null:e4,nullable:tv,number:e0,object:ti,oboolean:()=>e3().optional(),onumber:()=>e0().optional(),optional:tb,ostring:()=>eQ().optional(),pipeline:t_,preprocess:tE,promise:ty,record:tl,set:th,strictObject:tn,string:eQ,symbol:e8,transformer:tw,tuple:tc,undefined:e6,union:ts,unknown:e7,void:tt,NEVER:K,ZodIssueCode:j,quotelessJson:e=>JSON.stringify(e,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:$});let tA=tC.object({message:tC.string()});function tI(e){return tC.literal(U.$0[e])}tC.object({accessList:tC.array(tC.string()),blockHash:tC.string().nullable(),blockNumber:tC.string().nullable(),chainId:tC.string().or(tC.number()),from:tC.string(),gas:tC.string(),hash:tC.string(),input:tC.string().nullable(),maxFeePerGas:tC.string(),maxPriorityFeePerGas:tC.string(),nonce:tC.string(),r:tC.string(),s:tC.string(),to:tC.string(),transactionIndex:tC.string().nullable(),type:tC.string(),v:tC.string(),value:tC.string()});let tS=tC.object({chainId:tC.string().or(tC.number())}),tN=tC.object({email:tC.string().email()}
884),tO=tC.object({otp:tC.string()}),tx=tC.object({uri:tC.string()}),tT=tC.object({chainId:tC.optional(tC.string().or(tC.number())),preferredAccountType:tC.optional(tC.string())}),tR=tC.object({provider:tC.enum(["google","github","apple","facebook","x","discord"])}),tP=tC.object({email:tC.string().email()}),tk=tC.object({otp:tC.string()}),tD=tC.object({otp:tC.string()}),tM=tC.object({themeMode:tC.optional(tC.enum(["light","dark"])),themeVariables:tC.optional(tC.record(tC.string(),tC.string().or(tC.number()))),w3mThemeVariables:tC.optional(tC.record(tC.string(),tC.string()))}),tU=tC.object({metadata:tC.object({name:tC.string(),description:tC.string(),url:tC.string(),icons:tC.array(tC.string())}).optional(),sdkVersion:tC.string().optional(),sdkType:tC.string().optional(),projectId:tC.string()}),tL=tC.object({type:tC.string()}),tB=tC.object({action:tC.enum(["VERIFY_DEVICE","VERIFY_OTP","CONNECT"])}),tj=tC.object({url:tC.string()}),t$=tC.object({userName:tC.string()}),tF=tC.object({email:tC.string().optional().nullable(),address:tC.string(),chainId:tC.string().or(tC.number()),accounts:tC.array(tC.object({address:tC.string(),type:tC.enum([U.y_.ACCOUNT_TYPES.EOA,U.y_.ACCOUNT_TYPES.SMART_ACCOUNT])})).optional(),userName:tC.string().optional().nullable()}),tq=tC.object({action:tC.enum(["VERIFY_PRIMARY_OTP","VERIFY_SECONDARY_OTP"])}),tz=tC.object({email:tC.string().email().optional().nullable(),address:tC.string(),chainId:tC.string().or(tC.number()),smartAccountDeployed:tC.optional(tC.boolean()),accounts:tC.array(tC.object({address:tC.string(),type:tC.enum([U.y_.ACCOUNT_TYPES.EOA,U.y_.ACCOUNT_TYPES.SMART_ACCOUNT])})).optional(),preferredAccountType:tC.optional(tC.string())}),tH=tC.object({uri:tC.string()}),tW=tC.object({isConnected:tC.boolean()}),tV=tC.object({chainId:tC.string().or(tC.number())}),tK=tC.object({chainId:tC.string().or(tC.number())}),tZ=tC.object({newEmail:tC.string().email()}
884),tG=tC.object({smartAccountEnabledNetworks:tC.array(tC.number())});tC.object({address:tC.string(),isDeployed:tC.boolean()});let tY=tC.object({version:tC.string().optional()}),tJ=tC.object({type:tC.string(),address:tC.string()}),tX=tC.any(),tQ=tC.object({method:tC.literal("eth_accounts")}),t0=tC.object({method:tC.literal("eth_blockNumber")}),t1=tC.object({method:tC.literal("eth_call"),params:tC.array(tC.any())}),t2=tC.object({method:tC.literal("eth_chainId")}),t3=tC.object({method:tC.literal("eth_estimateGas"),params:tC.array(tC.any())}),t5=tC.object({method:tC.literal("eth_feeHistory"),params:tC.array(tC.any())}),t8=tC.object({method:tC.literal("eth_gasPrice")}),t6=tC.object({method:tC.literal("eth_getAccount"),params:tC.array(tC.any())}),t4=tC.object({method:tC.literal("eth_getBalance"),params:tC.array(tC.any())}),t9=tC.object({method:tC.literal("eth_getBlockByHash"),params:tC.array(tC.any())}),t7=tC.object({method:tC.literal("eth_getBlockByNumber"),params:tC.array(tC.any())}),re=tC.object({method:tC.literal("eth_getBlockReceipts"),params:tC.array(tC.any())}),rt=tC.object({method:tC.literal("eth_getBlockTransactionCountByHash"),params:tC.array(tC.any())}),rr=tC.object({method:tC.literal("eth_getBlockTransactionCountByNumber"),params:tC.array(tC.any())}),ri=tC.object({method:tC.literal("eth_getCode"),params:tC.array(tC.any())}),rn=tC.object({method:tC.literal("eth_getFilterChanges"),params:tC.array(tC.any())}),rs=tC.object({method:tC.literal("eth_getFilterLogs"),params:tC.array(tC.any())}),ro=tC.object({method:tC.literal("eth_getLogs"),params:tC.array(tC.any())}),ra=tC.object({method:tC.literal("eth_getProof"),params:tC.array(tC.any())}),rc=tC.object({method:tC.literal("eth_getStorageAt"),params:tC.array(tC.any())}),rl=tC.object({method:tC.literal("eth_getTransactionByBlockHashAndIndex"),params:tC.array(tC.any())}),ru=tC.object({method:tC.literal("eth_getTransactionByBlockNumberAndIndex"),params:tC.array(tC.any())}),rh=tC.object({method:tC.literal("eth_getTransactionByHash"),params:tC.array(tC.any())}),rd=tC.object({method:tC.literal("eth_getTransactionCount"),params:tC.array(tC.any())}),rp=tC.object({method:tC.literal("eth_getTransactionReceipt"),params:tC.array(tC.any())}),rf=tC.object({method:tC.literal("eth_getUncleCountByBlockHash"),params:tC.array(tC.any())}),rg=tC.object({method:tC.literal("eth_getUncleCountByBlockNumber"),params:tC.array(tC.any())}),rm=tC.object({method:tC.literal("eth_maxPriorityFeePerGas")}),ry=tC.object({method:tC.literal("eth_newBlockFilter")}),rw=tC.object({method:tC.literal("eth_newFilter"),params:tC.array(tC.any())}),rb=tC.object({method:tC.literal("eth_newPendingTransactionFilter")}),rv=tC.object({method:tC.literal("eth_sendRawTransaction"),params:tC.array(tC.any())}),rE=tC.object({method:tC.literal("eth_syncing"),params:tC.array(tC.any())}),r_=tC.object({method:tC.literal("eth_uninstallFilter"),params:tC.array(tC.any())}),rC=tC.object({method:tC.literal("personal_sign"),params:tC.array(tC.any())}),rA=tC.object({method:tC.literal("eth_signTypedData_v4"),params:tC.array(tC.any())}),rI=tC.object({method:tC.literal("eth_sendTransaction"),params:tC.array(tC.any())}),rS=tC.object({method:tC.literal("solana_signMessage"),params:tC.object({message:tC.string(),pubkey:tC.string()})}),rN=tC.object({method:tC.literal("solana_signTransaction"),params:tC.object({transaction:tC.string()})}),rO=tC.object({method:tC.literal("solana_signAllTransactions"),params:tC.object({transactions:tC.array(tC.string())})}),rx=tC.object({method:tC.literal("solana_signAndSendTransaction"),params:tC.object({transaction:tC.string(),options:tC.object({skipPreflight:tC.boolean().optional(),preflightCommitment:tC.enum(["processed","confirmed","finalized","recent","single","singleGossip","root","max"]).optional(),maxRetries:tC.number().optional(),minContextSlot:tC.number().optional()}).optional()})}),rT=tC.object({method:tC.literal("wallet_sendCalls"),params:tC.array(tC.object({chainId:tC.string().or(tC.number()).optional(),from:tC.string().optional(),version:tC.string().optional(),capabilities:tC.any().optional(),calls:tC.array(tC.object({to:tC.str
884ing().startsWith("0x"),data:tC.string().startsWith("0x").optional(),value:tC.string().optional()}))}))}),rR=tC.object({method:tC.literal("wallet_getCallsStatus"),params:tC.array(tC.string())}),rP=tC.object({method:tC.literal("wallet_getCapabilities")}),rk=tC.object({method:tC.literal("wallet_grantPermissions"),params:tC.array(tC.any())}),rD=tC.object({method:tC.literal("wallet_revokePermissions"),params:tC.any()}),rM=tC.object({method:tC.literal("wallet_getAssets"),params:tC.any()}),rU=tC.object({token:tC.string()}),rL=tC.object({id:tC.string().optional()}),rB={appEvent:rL.extend({type:tI("APP_SWITCH_NETWORK"),payload:tS}).or(rL.extend({type:tI("APP_CONNECT_EMAIL"),payload:tN})).or(rL.extend({type:tI("APP_CONNECT_DEVICE")})).or(rL.extend({type:tI("APP_CONNECT_OTP"),payload:tO})).or(rL.extend({type:tI("APP_CONNECT_SOCIAL"),payload:tx})).or(rL.extend({type:tI("APP_GET_FARCASTER_URI")})).or(rL.extend({type:tI("APP_CONNECT_FARCASTER")})).or(rL.extend({type:tI("APP_GET_USER"),payload:tC.optional(tT)})).or(rL.extend({type:tI("APP_GET_SOCIAL_REDIRECT_URI"),payload:tR})).or(rL.extend({type:tI("APP_SIGN_OUT")})).or(rL.extend({type:tI("APP_IS_CONNECTED"),payload:tC.optional(rU)})).or(rL.extend({type:tI("APP_GET_CHAIN_ID")})).or(rL.extend({type:tI("APP_GET_SMART_ACCOUNT_ENABLED_NETWORKS")})).or(rL.extend({type:tI("APP_INIT_SMART_ACCOUNT")})).or(rL.extend({type:tI("APP_SET_PREFERRED_ACCOUNT"),payload:tL})).or(rL.extend({type:tI("APP_RPC_REQUEST"),payload:rC.or(rM).or(tQ).or(t0).or(t1).or(t2).or(t3).or(t5).or(t8).or(t6).or(t4).or(t9).or(t7).or(re).or(rt).or(rr).or(ri).or(rn).or(rs).or(ro).or(ra).or(rc).or(rl).or(ru).or(rh).or(rd).or(rp).or(rf).or(rg).or(rm).or(ry).or(rw).or(rb).or(rv).or(rE).or(r_).or(rC).or(rA).or(rI).or(rS).or(rN).or(rO).or(rx).or(rR).or(rT).or(rP).or(rk).or(rD)})).or(rL.extend({type:tI("APP_UPDATE_EMAIL"),payload:tP})).or(rL.extend({type:tI("APP_UPDATE_EMAIL_PRIMARY_OTP"),payload:tk})).or(rL.extend({type:tI("APP_UPDATE_EMAIL_SECONDARY_OTP"),payload:tD})).or(rL.extend({type:tI("APP_SYNC_THEME"),payload:tM})).or(rL.extend({type:tI("APP_SYNC_DAPP_DATA"),payload:tU})).or(rL.extend({type:tI("APP_RELOAD")})),frameEvent:rL.extend({type:tI("FRAME_SWITCH_NETWORK_ERROR"),payload:tA}).or(rL.extend({type:tI("FRAME_SWITCH_NETWORK_SUCCESS"),payload:tK})).or(rL.extend({type:tI("FRAME_CONNECT_EMAIL_SUCCESS"),payload:tB})).or(rL.extend({type:tI("FRAME_CONNECT_EMAIL_ERROR"),payload:tA})).or(rL.extend({type:tI("FRAME_GET_FARCASTER_URI_SUCCESS"),payload:tj})).or(rL.extend({type:tI("FRAME_GET_FARCASTER_URI_ERROR"),payload:tA})).or(rL.extend({type:tI("FRAME_CONNECT_FARCASTER_SUCCESS"),payload:t$})).or(rL.extend({type:tI("FRAME_CONNECT_FARCASTER_ERROR"),payload:tA})).or(rL.extend({type:tI("FRAME_CONNECT_OTP_ERROR"),payload:tA})).or(rL.extend({type:tI("FRAME_CONNECT_OTP_SUCCESS")})).or(rL.extend({type:tI("FRAME_CONNECT_DEVICE_ERROR"),payload:tA})).or(rL.extend({type:tI("FRAME_CONNECT_DEVICE_SUCCESS")})).or(rL.extend({type:tI("FRAME_CONNECT_SOCIAL_SUCCESS"),payload:tF})).or(rL.extend({type:tI("FRAME_CONNECT_SOCIAL_ERROR"),payload:tA})).or(rL.extend({type:tI("FRAME_GET_USER_ERROR"),payload:tA})).or(rL.extend({type:tI("FRAME_GET_USER_SUCCESS"),payload:tz})).or(rL.extend({type:tI("FRAME_GET_SOCIAL_REDIRECT_URI_ERROR"),payload:tA})).or(rL.extend({type:tI("FRAME_GET_SOCIAL_REDIRECT_URI_SUCCESS"),payload:tH})).or(rL.extend({type:tI("FRAME_SIGN_OUT_ERROR"),payload:tA})).or(rL.extend({type:tI("FRAME_SIGN_OUT_SUCCESS")})).or(rL.extend({type:tI("FRAME_IS_CONNECTED_ERROR"),payload:tA})).or(rL.extend({type:tI("FRAME_IS_CONNECTED_SUCCESS"),payload:tW})).or(rL.extend({type:tI("FRAME_GET_CHAIN_ID_ERROR"),payload:tA})).or(rL.extend({type:tI("FRAME_GET_CHAIN_ID_SUCCESS"),payload:tV})).or(rL.extend({type:tI("FRAME_RPC_REQUEST_ERROR"),payload:tA})).or(rL.extend({type:tI("FRAME_RPC_REQUEST_SUCCESS"),payload:tX})).or(rL.extend({type:tI("FRAME_SESSION_UPDATE"),payload:rU})).or(rL.extend({type:tI("FRAME_UPDATE_EMAIL_ERROR"),payload:tA})).or(rL.extend({type:tI("FRAME_UPDATE_EMAIL_SUCCESS"),payload:tq})).or(rL.extend({type:tI("FRAME_UPDATE_EMAIL_PRIMARY_OTP_ERROR"),payload:tA})).or(rL.extend({type:tI("FRAME_UPDATE_EMAIL_PRIMARY_OTP_SUCCESS")})).or(rL.extend({type:tI("FRAME_UPDATE_EMAIL_SECONDARY_OTP_ERROR"),payload:tA})).or(rL.extend({type:tI("FRAME_UPDATE_EMAIL_SECONDARY_OTP_SUCCESS"),payload:tZ})).or(rL.extend({type:tI("FRAME_SYNC_THEME_ERROR"),payload:tA})).or(rL.extend({type:tI("FRAME_SYNC_THEME_SUCCESS")})).or(rL.extend({type:tI("FRAME_SYNC_DAPP_DATA_ERROR"),payload:tA})).or(rL.extend({type:tI("FRAME_SYNC_DAPP_DATA_SUCCESS")})).or(rL.extend({type:tI("FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_SUCCESS"),payload:tG})).or(rL.extend({type:tI("FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_ERROR"),payload:tA})).or(rL.extend({type:tI("FRAME_INIT_SMART_ACCOUNT_ERROR"),payload:tA})).or(rL.extend({type:tI("FRAME_SET_PREFERRED_ACCOUNT_SUCCESS"),payload:tJ})).or(rL.extend({type:tI("FRAME_SET_PREFERRED_ACCOUNT_ERROR"),payload:tA})).or(rL.extend({type:tI("FRAME_READY"),payload:tY})).or(rL.extend({type:tI("FRAME_RELOAD_ERROR"),payload:tA})).or(rL.extend({type:tI("FRAME_RELOAD_SUCCESS")}))};function rj(e,t={}){return"string"==typeof t?.type&&t?.type?.includes(e)}class r${constructor({projectId:e,isAppClient:t=!1,chainId:r="eip155:1",enableLogger:i=!0}
884){if(this.iframe=null,this.rpcUrl=d.b.BLOCKCHAIN_API_RPC_URL,this.initFrame=()=>{let e=document.getElementById("w3m-iframe");this.iframe&&!e&&document.body.appendChild(this.iframe)},this.events={registerFrameEventHandler:(e,t,r)=>{function i({data:r}){if(!rj(U.$0.FRAME_EVENT_KEY,r))return;let n=rB.frameEvent.parse(r);n.id===e&&(t(n),window.removeEventListener("message",i))}M.$.isClient&&(window.addEventListener("message",i),r.addEventListener("abort",()=>{window.removeEventListener("message",i)}))},onFrameEvent:e=>{M.$.isClient&&window.addEventListener("message",({data:t})=>{rj(U.$0.FRAME_EVENT_KEY,t)&&e(rB.frameEvent.parse(t))})},onAppEvent:e=>{M.$.isClient&&window.addEventListener("message",({data:t})=>{rj(U.$0.APP_EVENT_KEY,t)&&e(rB.appEvent.parse(t))})},postAppEvent:e=>{if(M.$.isClient){if(!this.iframe?.contentWindow)throw Error("W3mFrame: iframe is not set");rB.appEvent.parse(e),this.iframe.contentWindow.postMessage(e,"*")}},postFrameEvent:e=>{if(M.$.isClient){if(!parent)throw Error("W3mFrame: parent is not set");rB.frameEvent.parse(e),parent.postMessage(e,"*")}}},this.projectId=e,this.frameLoadPromise=new Promise((e,t)=>{this.frameLoadPromiseResolver={resolve:e,reject:t}}),t&&(this.frameLoadPromise=new Promise((e,t)=>{this.frameLoadPromiseResolver={resolve:e,reject:t}}),M.$.isClient)){let t=document.createElement("iframe");t.id="w3m-iframe",t.src=`${U.Dr}?projectId=${e}&chainId=${r}&version=${U.zN}&enableLogger=${i}`,t.name="w3m-secure-iframe",t.style.position="fixed",t.style.zIndex="999999",t.style.display="none",t.style.animationDelay="0s, 50ms",t.style.borderBottomLeftRadius="clamp(0px, var(--wui-border-radius-l), 44px)",t.style.borderBottomRightRadius="clamp(0px, var(--wui-border-radius-l), 44px)",this.iframe=t,this.iframe.onerror=()=>{this.frameLoadPromiseResolver?.reject("Unable to load email login dependency")},this.events.onFrameEvent(e=>{"@w3m-frame/READY"===e.type&&this.frameLoadPromiseResolver?.resolve(void 0)})}}get networks(){return Object.assign({},...["eip155:1","eip155:5","eip155:11155111","eip155:10","eip155:420","eip155:42161","eip155:421613","eip155:137","eip155:80001","eip155:42220","eip155:1313161554","eip155:1313161555","eip155:56","eip155:97","eip155:43114","eip155:43113","eip155:324","eip155:280","eip155:100","eip155:8453","eip155:84531","eip155:84532","eip155:7777777","eip155:999","solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z","solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1"].map(e=>({[e]:{rpcUrl:`${this.rpcUrl}/v1/?chainId=${e}&projectId=${this.projectId}`,chainId:e}})))}}var rF=r(15133);class rq{constructor(e){let t=(0,rF.jI)({level:U.jd}),{logger:r,chunkLoggerController:i}=(0,rF.Rt)({opts:t});this.logger=(0,rF.Ep)(r,this.constructor.name),this.chunkLoggerController=i,"undefined"!=typeof window&&this.chunkLoggerController?.downloadLogsBlobInBrowser&&(window.downloadAppKitLogsBlob||(window.downloadAppKitLogsBlob={}),window.downloadAppKitLogsBlob.sdk=()=>{this.chunkLoggerController?.downloadLogsBlobInBrowser&&this.chunkLoggerController.downloadLogsBlobInBrowser({projectId:e})})}}var rz=r(69023);class rH{constructor({projectId:e,chainId:t,enableLogger:r=!0,onTimeout:i}){this.openRpcRequests=[],r&&(this.w3mLogger=new rq(e)),this.w3mFrame=new r$({projectId:e,isAppClient:!0,chainId:t,enableLogger:r}),this.onTimeout=i,this.getLoginEmailUsed()&&this.w3mFrame.initFrame(),this.initPromise=new Promise(e=>{this.w3mFrame.events.onFrameEvent(async t=>{t.type===U.$0.FRAME_READY&&(this.initPromise=void 0,await new Promise(e=>{setTimeout(e,500)}),e())})})}
884async init(){this.w3mFrame.initFrame(),this.initPromise&&await this.initPromise}getLoginEmailUsed(){return!!rz.e.get(U.$0.EMAIL_LOGIN_USED_KEY)}getEmail(){return rz.e.get(U.$0.EMAIL)}getUsername(){return rz.e.get(U.$0.SOCIAL_USERNAME)}async reload(){try{this.w3mFrame.initFrame(),await this.appEvent({type:U.$0.APP_RELOAD})}catch(e){throw this.w3mLogger?.logger.error({error:e},"Error reloading iframe"),e}}async connectEmail(e){try{M.$.checkIfAllowedToTriggerEmail(),this.w3mFrame.initFrame();let t=await this.appEvent({type:U.$0.APP_CONNECT_EMAIL,payload:e});return this.setNewLastEmailLoginTime(),t}catch(e){throw this.w3mLogger?.logger.error({error:e},"Error connecting email"),e}}async connectDevice(){try{return this.appEvent({type:U.$0.APP_CONNECT_DEVICE})}catch(e){throw this.w3mLogger?.logger.error({error:e},"Error connecting device"),e}}async connectOtp(e){try{return this.appEvent({type:U.$0.APP_CONNECT_OTP,payload:e})}catch(e){throw this.w3mLogger?.logger.error({error:e},"Error connecting otp"),e}}async isConnected(){try{if(!this.getLoginEmailUsed())return{isConnected:!1};let e=await this.appEvent({type:U.$0.APP_IS_CONNECTED});return e?.isConnected||this.deleteAuthLoginCache(),e}catch(e){throw this.deleteAuthLoginCache(),this.w3mLogger?.logger.error({error:e},"Error checking connection"),e}}async getChainId(){try{let e=await this.appEvent({type:U.$0.APP_GET_CHAIN_ID});return this.setLastUsedChainId(e.chainId),e}catch(e){throw this.w3mLogger?.logger.error({error:e},"Error getting chain id"),e}}async getSocialRedirectUri(e){try{return this.w3mFrame.initFrame(),this.appEvent({type:U.$0.APP_GET_SOCIAL_REDIRECT_URI,payload:e})}catch(e){throw this.w3mLogger?.logger.error({error:e},"Error getting social redirect uri"),e}}async updateEmail(e){try{let t=await this.appEvent({type:U.$0.APP_UPDATE_EMAIL,payload:e});return this.setNewLastEmailLoginTime(),t}catch(e){throw this.w3mLogger?.logger.error({error:e},"Error updating email"),e}}async updateEmailPrimaryOtp(e){try{return this.appEvent({type:U.$0.APP_UPDATE_EMAIL_PRIMARY_OTP,payload:e})}catch(e){throw this.w3mLogger?.logger.error({error:e},"Error updating email primary otp"),e}}async updateEmailSecondaryOtp(e){try{let t=await this.appEvent({type:U.$0.APP_UPDATE_EMAIL_SECONDARY_OTP,payload:e});return this.setLoginSuccess(t.newEmail),t}catch(e){throw this.w3mLogger?.logger.error({error:e},"Error updating email secondary otp"),e}}async syncTheme(e){try{return this.appEvent({type:U.$0.APP_SYNC_THEME,payload:e})}catch(e){throw this.w3mLogger?.logger.error({error:e},"Error syncing theme"),e}}async syncDappData(e){try{return this.appEvent({type:U.$0.APP_SYNC_DAPP_DATA,payload:e})}catch(e){throw this.w3mLogger?.logger.error({error:e},"Error syncing dapp data"),e}}async getSmartAccountEnabledNetworks(){try{let e=await this.appEvent({type:U.$0.APP_GET_SMART_ACCOUNT_ENABLED_NETWORKS});return this.persistSmartAccountEnabledNetworks(e.smartAccountEnabledNetworks),e}catch(e){throw this.persistSmartAccountEnabledNetworks([]),this.w3mLogger?.logger.error({error:e},"Error getting smart account enabled networks"),e}}async setPreferredAccount(e){try{return this.appEvent({type:U.$0.APP_SET_PREFERRED_ACCOUNT,payload:{type:e}})}catch(e){throw this.w3mLogger?.logger.error({error:e},"Error setting preferred account"),e}}async connect(e){try{let t=e?.chainId||this.getLastUsedChainId()||1,r=await this.getUser({chainId:t,preferredAccountType:e?.preferredAccountType});return this.setLoginSuccess(r.email),this.setLastUsedChainId(r.chainId),this.user=r,r}catch(e){throw this.w3mLogger?.logger.error({error:e},"Error connecting"),e}}async getUser(e){try{let t=e?.chainId||this.getLastUsedChainId()||1,r=await this.appEvent({type:U.$0.APP_GET_USER,payload:{...e,chainId:t}});return this.user=r,r}catch(e){throw this.w3mLogger?.logger.error({error:e},"Error connecting"),e}}async connectSocial(e){try{this.w3mFrame.initFrame();let t=await this.appEvent({type:U.$0.APP_CONNECT_SOCIAL,payload:{uri:e}});return t.userName&&this.setSocialLoginSuccess(t.userName),t}catch(e){throw this.w3mLogger?.logger.error({error:e}
884,"Error connecting social"),e}}async getFarcasterUri(){try{return this.w3mFrame.initFrame(),await this.appEvent({type:U.$0.APP_GET_FARCASTER_URI})}catch(e){throw this.w3mLogger?.logger.error({error:e},"Error getting farcaster uri"),e}}async connectFarcaster(){try{let e=await this.appEvent({type:U.$0.APP_CONNECT_FARCASTER});return e.userName&&this.setSocialLoginSuccess(e.userName),e}catch(e){throw this.w3mLogger?.logger.error({error:e},"Error connecting farcaster"),e}}async switchNetwork(e){try{let t=await this.appEvent({type:U.$0.APP_SWITCH_NETWORK,payload:{chainId:e}});return this.setLastUsedChainId(t.chainId),t}catch(e){throw this.w3mLogger?.logger.error({error:e},"Error switching network"),e}}async disconnect(){try{let e=await this.appEvent({type:U.$0.APP_SIGN_OUT});return this.deleteAuthLoginCache(),e}catch(e){throw this.w3mLogger?.logger.error({error:e},"Error disconnecting"),e}}async request(e){try{if(U.y_.GET_CHAIN_ID===e.method)return this.getLastUsedChainId();this.rpcRequestHandler?.(e);let t=await this.appEvent({type:U.$0.APP_RPC_REQUEST,payload:e});return this.rpcSuccessHandler?.(t,e),t}catch(t){throw this.rpcErrorHandler?.(t,e),this.w3mLogger?.logger.error({error:t},"Error requesting"),t}}onRpcRequest(e){this.rpcRequestHandler=e}onRpcSuccess(e){this.rpcSuccessHandler=e}onRpcError(e){this.rpcErrorHandler=e}onIsConnected(e){this.w3mFrame.events.onFrameEvent(t=>{t.type===U.$0.FRAME_IS_CONNECTED_SUCCESS&&t.payload.isConnected&&e()})}onNotConnected(e){this.w3mFrame.events.onFrameEvent(t=>{t.type===U.$0.FRAME_IS_CONNECTED_ERROR&&e(),t.type!==U.$0.FRAME_IS_CONNECTED_SUCCESS||t.payload.isConnected||e()})}onConnect(e){this.w3mFrame.events.onFrameEvent(t=>{t.type===U.$0.FRAME_GET_USER_SUCCESS&&e(t.payload)})}onSocialConnected(e){this.w3mFrame.events.onFrameEvent(t=>{t.type===U.$0.FRAME_CONNECT_SOCIAL_SUCCESS&&e(t.payload)})}async getCapabilities(){try{return await this.request({method:"wallet_getCapabilities"})||{}}catch{return{}}}onSetPreferredAccount(e){this.w3mFrame.events.onFrameEvent(t=>{t.type===U.$0.FRAME_SET_PREFERRED_ACCOUNT_SUCCESS?e(t.payload):t.type===U.$0.FRAME_SET_PREFERRED_ACCOUNT_ERROR&&e({type:U.y_.ACCOUNT_TYPES.EOA})})}onGetSmartAccountEnabledNetworks(e){this.w3mFrame.events.onFrameEvent(t=>{t.type===U.$0.FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_SUCCESS?e(t.payload.smartAccountEnabledNetworks):t.type===U.$0.FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_ERROR&&e([])})}getAvailableChainIds(){return Object.keys(this.w3mFrame.networks)}rejectRpcRequests(){try{this.openRpcRequests.forEach(({abortController:e,method:t})=>{U.y_.SAFE_RPC_METHODS.includes(t)||e.abort()}),this.openRpcRequests=[]}catch(e){this.w3mLogger?.logger.error({error:e},"Error aborting RPC request")}}async appEvent(e){let t;function r(e){return e.replace("@w3m-app/","")}await this.w3mFrame.frameLoadPromise;let i=new AbortController,n=r(e.type);return[U.$0.APP_CONNECT_EMAIL,U.$0.APP_CONNECT_DEVICE,U.$0.APP_CONNECT_OTP,U.$0.APP_CONNECT_SOCIAL,U.$0.APP_GET_SOCIAL_REDIRECT_URI].map(r).includes(n)&&(t=setTimeout(()=>{this.onTimeout?.(),i.abort()},3e4)),new Promise((r,s)=>{let o=Math.random().toString(36).substring(7);this.w3mLogger?.logger.info?.({event:e,id:o},"Sending app event"),this.w3mFrame.events.postAppEvent({...e,id:o}),"RPC_REQUEST"===n&&(this.openRpcRequests=[...this.openRpcRequests,{...e.payload,abortController:i}]),i.signal.addEventListener("abort",()=>{"RPC_REQUEST"===n?s(Error("Request was aborted")):"GET_FARCASTER_URI"!==n&&s(Error("Something went wrong"))}),this.w3mFrame.events.registerFrameEventHandler(o,e=>{var i;return i=this.w3mLogger,void(e.id===o&&(i?.logger.info?.({framEvent:e,id:o},"Received frame response"),e.type===`@w3m-frame/${n}_SUCCESS`?(t&&clearTimeout(t),"payload"in e&&r(e.payload),r(void 0)):e.type===`@w3m-frame/${n}_ERROR`&&(t&&clearTimeout(t),"payload"in e&&s(Error(e.payload?.message||"An error occurred")),s(Error("An error occurred")))))},i.signal)})}setNewLastEmailLoginTime(){rz.e.set(U.$0.LAST_EMAIL_LOGIN_TIME,Date.now().toString())}setSocialLoginSuccess(e){rz.e.set(U.$0.SOCIAL_USERNAME,e)}setLoginSuccess(e){e&&rz.e.set(U.$0.EMAIL,e),rz.e.set(U.$0.EMAIL_LOGIN_USED_KEY,"true"),rz.e.delete(U.$0.LAST_EMAIL_LOGIN_TIME)}deleteAuthLoginCache(){rz.e.delete(U.$0.EMAIL_LOGIN_USED_KEY),rz.e.delete(U.$0.EMAIL),rz.e.delete(U.$0.LAST_USED_CHAIN_KEY),rz.e.delete(U.$0.SOCIAL_USERNAME)}
884setLastUsedChainId(e){e&&rz.e.set(U.$0.LAST_USED_CHAIN_KEY,String(e))}getLastUsedChainId(){let e=rz.e.get(U.$0.LAST_USED_CHAIN_KEY)??void 0,t=Number(e);return isNaN(t)?e:t}persistSmartAccountEnabledNetworks(e){rz.e.set(U.$0.SMART_ACCOUNT_ENABLED_NETWORKS,e.join(","))}}class rW{constructor(){}static getInstance({projectId:e,chainId:t,enableLogger:r,onTimeout:i}){return rW.instance||(rW.instance=new rH({projectId:e,chainId:t,enableLogger:r,onTimeout:i})),rW.instance}}var rV=r(13885),rK=r(1125),rZ=r(2657),rG=r(29427),rY=r(31242),rJ=r(85786),rX=r(79193),rQ=r(30649),r0=r(97040);r(29608),r(44504);var r1=r(74554),r2=r(44239);let r3=(e,t,r)=>JSON.stringify(e,(e,r)=>{let i="bigint"==typeof r?r.toString():r;return"function"==typeof t?t(e,i):i},r),r5="2.27.3",r8={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:r})=>t?`${e??"https://viem.sh"}${t}${r?`#${r}`:""}`:void 0,version:`viem@${r5}`};class r6 extends Error{constructor(e,t={}){let r=t.cause instanceof r6?t.cause.details:t.cause?.message?t.cause.message:t.details,i=t.cause instanceof r6&&t.cause.docsPath||t.docsPath,n=r8.getDocsUrl?.({...t,docsPath:i});super([e||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...n?[`Docs: ${n}`]:[],...r?[`Details: ${r}`]:[],...r8.version?[`Version: ${r8.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=i,this.metaMessages=t.metaMessages,this.name=t.name??this.name,this.shortMessage=e,this.version=r5}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)}}let r4=e=>e;class r9 extends r6{constructor({body:e,cause:t,details:r,headers:i,status:n,url:s}){super("HTTP request failed.",{cause:t,details:r,metaMessages:[n&&`Status: ${n}`,`URL: ${r4(s)}`,e&&`Request body: ${r3(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=n,this.url=s}}class r7 extends r6{constructor({body:e,error:t,url:r}){super("RPC Request failed.",{cause:t,details:t.message,metaMessages:[`URL: ${r4(r)}`,`Request body: ${r3(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}),this.code=t.code,this.data=t.data}}class ie extends r6{constructor({body:e,url:t}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${r4(t)}`,`Request body: ${r3(e)}`],name:"TimeoutError"})}}class it extends r6{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}}let ir=new Map,ii={current:0,take(){return this.current++},reset(){this.current=0}};class is extends r6{constructor(e,{code:t,docsPath:r,metaMessages:i,name:n,shortMessage:s}){super(s,{cause:e,docsPath:r,metaMessages:i||e?.metaMessages,name:n||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=n||e.name,this.code=e instanceof r7?e.code:t??-1}}class io extends is{constructor(e,t){super(e,t),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=t.data}}class ia extends is{constructor(e){super(e,{code:ia.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(ia,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class ic extends is{constructor(e){super(e,{code:ic.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(ic,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class il extends is{constructor(e,{method:t}={}){super(e,{code:il.code,name:"MethodNotFoundRpcError",shortMessage:`The method${t?` "${t}"`:""} does not exist / is not available.`})}}Object.defineProperty(il,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class iu extends is{constructor(e){super(e,{code:iu.code,name:"InvalidParamsRpcError",shortMessage:"Invalid parameters were provided to the RPC method.\nDouble check you have provided the correct parameters."})}}Object.defineProperty(iu,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class ih extends is{constructor(e){super(e,{code:ih.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(ih,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class id extends is{constructor(e){super(e,{code:id.code,name:"InvalidInputRpcError",shortMessage:"Missing or invalid parameters.\nDouble check you have provided the correct parameters."})}}Object.defineProperty(id,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class ip extends is{constructor(e){super(e,{code:ip.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(ip,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class ig extends is{constructor(e){super(e,{code:ig.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(ig,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class im extends is{constructor(e){super(e,{code:im.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(im,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class iy extends is{constructor(e,{method:t}={}){super(e,{code:iy.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${t?` "${t}"`:""} is not supported.`})}}Object.defineProperty(iy,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class iw extends is{constructor(e){super(e,{code:iw.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(iw,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class ib extends is{constructor(e){super(e,{code:ib.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(ib,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class iv extends io{constructor(e){super(e,{code:iv.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(iv,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class iE extends io{constructor(e){super(e,{code:iE.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(iE,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class i_ extends io{constructor(e,{method:t}={}){super(e,{code:i_.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${t?` " ${t}"`:""}.`})}}Object.defineProperty(i_,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class iC extends io{constructor(e){super(e,{code:iC.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(iC,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class iA extends io{constructor(e){super(e,{code:iA.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(iA,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class iI extends io{constructor(e){super(e,{code:iI.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(iI,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class iS extends io{constructor(e){super(e,{code:iS.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(iS,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class iN extends io{constructor(e){super(e,{code:iN.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(iN,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class iO extends io{constructor(e){super(e,{code:iO.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(iO,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class ix extends io{constructor(e){super(e,{code:ix.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(ix,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class iT extends io{constructor(e){super(e,{code:iT.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(iT,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class iR extends io{constructor(e){super(e,{code:iR.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(iR,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750}
884);class iP extends io{constructor(e){super(e,{code:iP.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(iP,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class ik extends is{constructor(e){super(e,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}class iD extends r6{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 iM extends r6{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}}function iU(e){return!function(e,{strict:t=!0}={}){return!!e&&"string"==typeof e&&(t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x"))}(e,{strict:!1})?e.length:Math.ceil((e.length-2)/2)}let iL=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0")),iB=new TextEncoder;class ij 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 i$=new ij(8192);async function iF(e){return new Promise(t=>setTimeout(t,e))}let iq=256;function iz({key:e,methods:t,name:r,request:i,retryCount:s=3,retryDelay:o=150,timeout:a,type:c},l){return{config:{key:e,methods:t,name:r,request:i,retryCount:s,retryDelay:o,timeout:a,type:c},request:function(e,t={}){return async(r,i={})=>{let{dedupe:n=!1,methods:s,retryDelay:o=150,retryCount:a=3,uid:c}={...t,...i},{method:l}=r;if(s?.exclude?.includes(l)||s?.include&&!s.include.includes(l))throw new iy(Error("method not supported"),{method:l});let u=n?function(e,t={}){return function(e,t={}){let r="";for(let t=0;t<e.length;t++)r+=iL[e[t]];let i=`0x${r}`;return"number"==typeof t.size?(!function(e,{size:t}){if(iU(e)>t)throw new iM({givenSize:iU(e),maxSize:t})}(i,{size:t.size}),function(e,{dir:t,size:r=32}={}){return"string"==typeof e?function(e,{dir:t,size:r=32}={}){if(null===r)return e;let i=e.replace("0x","");if(i.length>2*r)throw new iD({size:Math.ceil(i.length/2),targetSize:r,type:"hex"});return`0x${i["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 iD({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})}(i,{dir:"right",size:t.size})):i}(iB.encode(e),t)}(`${c}.${r3(r)}`):void 0;return function(e,{enabled:t=!0,id:r}){if(!t||!r)return e();if(i$.get(r))return i$.get(r);let i=e().finally(()=>i$.delete(r));return i$.set(r,i),i}(()=>(function(e,{delay:t=100,retryCount:r=2,shouldRetry:i=()=>!0}={}){return new Promise((n,s)=>{let o=async({count:a=0}={})=>{let c=async({error:e})=>{let r="function"==typeof t?t({count:a,error:e}):t;r&&await iF(r),o({count:a+1})};try{let t=await e();n(t)}catch(e){if(a<r&&await i({count:a,error:e}))return c({error:e});s(e)}};o()})})(async()=>{try{return await e(r)}catch(e){switch(e.code){case ia.code:throw new ia(e);case ic.code:throw new ic(e);case il.code:throw new il(e,{method:r.method});case iu.code:throw new iu(e);case ih.code:throw new ih(e);case id.code:throw new id(e);case ip.code:throw new ip(e);case ig.code:throw new ig(e);case im.code:throw new im(e);case iy.code:throw new iy(e,{method:r.method});case iw.code:throw new iw(e);case ib.code:throw new ib(e);case iv.code:throw new iv(e);case iE.code:throw new iE(e);case i_.code:throw new i_(e);case iC.code:throw new iC(e);case iA.code:throw new iA(e);case iI.code:throw new iI(e);case iS.code:throw new iS(e);case iN.code:throw new iN(e);case iO.code:throw new iO(e);case ix.code:throw new ix(e);case iT.code:throw new iT(e);case iR.code:throw new iR(e);case iP.code:throw new iP(e);case 5e3:throw new iv(e);default:if(e instanceof r6)throw e;throw new ik(e)}}},{delay:({count:e,error:t})=>{if(t&&t instanceof r9){let e=t?.headers?.get("Retry-After");if(e?.match(/\d/))return 1e3*Number.parseInt(e)}return~~(1<<e)*o},retryCount:a,shouldRetry:({error:e})=>"code"in e&&"number"==typeof e.code?-1===e.code||e.code===iw.code||e.code===ih.code:!(e instanceof r9)||!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:n,id:u})}}(i,{methods:t,retryCount:s,retryDelay:o,uid:function(e=11){if(!n||iq+e>512){n="",iq=0;for(let e=0;e<256;e++)n+=(256+256*Math.random()|0).toString(16).substring(1)}return n.substring(iq,iq+++e)}()}),value:l}}function iH(e,t={}){let{batch:r,fetchOptions:i,key:n="http",methods:s,name:o="HTTP JSON-RPC",onFetchRequest:a,onFetchResponse:c,retryDelay:l,raw:u}=t;return({chain:h,retryCount:d,timeout:p})=>{let{batchSize:f=1e3,wait:g=0}="object"==typeof r?r:{},m=t.retryCount??d,y=p??t.timeout??1e4,w=e||h?.rpcUrls.default.http[0];if(!w)throw new it;let b=function(e,t={}){return{async request(r){let{body:i,onRequest:n=t.onRequest,onResponse:s=t.onResponse,timeout:o=t.timeout??1e4}=r,a={...t.fetchOptions??{},...r.fetchOptions??{}},{headers:c,method:l,signal:u}=a;try{let t;let r=await function(e,{errorInstance:t=Error("timed out"),timeout:r,signal:i}){return new Promise((n,s)=>{(async()=>{let o;try{let a=new AbortController;r>0&&(o=setTimeout(()=>{i?a.abort():s(t)},r)),n(await e({signal:a?.signal||null}))}catch(e){e?.name==="AbortError"&&s(t),s(e)}finally{clearTimeout(o)}})()})}(async({signal:t})=>{let r={...a,body:Array.isArray(i)?r3(i.map(e=>({jsonrpc:"2.0",id:e.id??ii.take(),...e}))):r3({jsonrpc:"2.0",id:i.id??ii.take(),...i}),headers:{"Content-Type":"application/json",...c},method:l||"POST",signal:u||(o>0?t:null)}
884,s=new Request(e,r),h=await n?.(s,r)??{...r,url:e};return await fetch(h.url??e,h)},{errorInstance:new ie({body:i,url:e}),timeout:o,signal:!0});if(s&&await s(r),r.headers.get("Content-Type")?.startsWith("application/json"))t=await r.json();else{t=await r.text();try{t=JSON.parse(t||"{}")}catch(e){if(r.ok)throw e;t={error:t}}}if(!r.ok)throw new r9({body:i,details:r3(t.error)||r.statusText,headers:r.headers,status:r.status,url:e});return t}catch(t){if(t instanceof r9||t instanceof ie)throw t;throw new r9({body:i,cause:t,url:e})}}}}(w,{fetchOptions:i,onRequest:a,onResponse:c,timeout:y});return iz({key:n,methods:s,name:o,async request({method:e,params:t}){let i={method:e,params:t},{schedule:n}=function({fn:e,id:t,shouldSplitBatch:r,wait:i=0,sort:n}){let s=async()=>{let t=c();o();let r=t.map(({args:e})=>e);0!==r.length&&e(r).then(e=>{n&&Array.isArray(e)&&e.sort(n);for(let r=0;r<t.length;r++){let{resolve:i}=t[r];i?.([e[r],e])}}).catch(e=>{for(let r=0;r<t.length;r++){let{reject:i}=t[r];i?.(e)}})},o=()=>ir.delete(t),a=()=>c().map(({args:e})=>e),c=()=>ir.get(t)||[],l=e=>ir.set(t,[...c(),e]);return{flush:o,async schedule(e){let t,n;let{promise:o,resolve:u,reject:h}=(t=()=>void 0,n=()=>void 0,{promise:new Promise((e,r)=>{t=e,n=r}),resolve:t,reject:n});return(r?.([...a(),e])&&s(),c().length>0)?l({args:e,resolve:u,reject:h}):(l({args:e,resolve:u,reject:h}),setTimeout(s,i)),o}}}({id:w,wait:g,shouldSplitBatch:e=>e.length>f,fn:e=>b.request({body:e}),sort:(e,t)=>e.id-t.id}),s=async e=>r?n(e):[await b.request({body:e})],[{error:o,result:a}]=await s(i);if(u)return{error:o,result:a};if(o)throw new r7({body:i,error:o,url:w});return a},retryCount:m,retryDelay:l,timeout:y,type:"http"},{fetchOptions:i,url:w})}}let iW={ether:-9,wei:9};function iV(e,t="wei"){return function(e,t){let r=e.toString(),i=r.startsWith("-");i&&(r=r.slice(1));let[n,s]=[(r=r.padStart(t,"0")).slice(0,r.length-t),r.slice(r.length-t)];return s=s.replace(/(0+)$/,""),`${i?"-":""}${n||"0"}${s?`.${s}`:""}`}(e,iW[t])}class iK extends r6{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(iK,"code",{enumerable:!0,configurable:!0,writable:!0,value:3}),Object.defineProperty(iK,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/execution reverted/});class iZ extends r6{constructor({cause:e,maxFeePerGas:t}={}){super(`The fee cap (\`maxFeePerGas\`${t?` = ${iV(t)} gwei`:""}) cannot be higher than the maximum allowed value (2^256-1).`,{cause:e,name:"FeeCapTooHighError"})}}Object.defineProperty(iZ,"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 iG extends r6{constructor({cause:e,maxFeePerGas:t}={}){super(`The fee cap (\`maxFeePerGas\`${t?` = ${iV(t)}`:""} gwei) cannot be lower than the block base fee.`,{cause:e,name:"FeeCapTooLowError"})}}Object.defineProperty(iG,"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 iY extends r6{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(iY,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too high/});class iJ extends r6{constructor({cause:e,nonce:t}={}){super(`Nonce provided for the transaction ${t?`(${t}) `:""}is lower than the current nonce of the account.
885Try increasing the nonce or find the latest nonce with \`getTransactionCount\`.`,{cause:e,name:"NonceTooLowError"})}}Object.defineProperty(iJ,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce too low|transaction already imported|already known/});class iX extends r6{constructor({cause:e,nonce:t}={}){super(`Nonce provided for the transaction ${t?`(${t}) `:""}exceeds the maximum allowed nonce.`,{cause:e,name:"NonceMaxValueError"})}}Object.defineProperty(iX,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/nonce has max value/});class iQ extends r6{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"})}}Object.defineProperty(iQ,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/insufficient funds|exceeds transaction sender account balance/});class i0 extends r6{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(i0,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too high|gas limit reached/});class i1 extends r6{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(i1,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/intrinsic gas too low/});class i2 extends r6{constructor({cause:e}){super("The transaction type is not supported for this chain.",{cause:e,name:"TransactionTypeNotSupportedError"})}}Object.defineProperty(i2,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/transaction type not valid/});class i3 extends r6{constructor({cause:e,maxPriorityFeePerGas:t,maxFeePerGas:r}={}){super(`The provided tip (\`maxPriorityFeePerGas\`${t?` = ${iV(t)} gwei`:""}) cannot be higher than the fee cap (\`maxFeePerGas\`${r?` = ${iV(r)} gwei`:""}).`,{cause:e,name:"TipAboveFeeCapError"})}}function i5(e,t={}){let{key:r="fallback",name:i="Fallback",rank:n=!1,shouldThrow:s=i8,retryCount:o,retryDelay:a}=t;return({chain:t,pollingInterval:c=4e3,timeout:l,...u})=>{let h=e,d=()=>{},p=iz({key:r,name:i,async request({method:e,params:r}){let i;let n=async(o=0)=>{let a=h[o]({...u,chain:t,retryCount:0,timeout:l});try{let t=await a.request({method:e,params:r});return d({method:e,params:r,response:t,transport:a,status:"success"}),t}catch(c){if(d({error:c,method:e,params:r,transport:a,status:"error"}),s(c)||o===h.length-1||!(i??=h.slice(o+1).some(r=>{let{include:i,exclude:n}=r({chain:t}).config.methods||{};return i?i.includes(e):!n||!n.includes(e)})))throw c;return n(o+1)}};return n()},retryCount:o,retryDelay:a,type:"fallback"},{onResponse:e=>d=e,transports:h.map(e=>e({chain:t,retryCount:0}))});if(n){let e="object"==typeof n?n:{};!function({chain:e,interval:t=4e3,onTransports:r,ping:i,sampleCount:n=10,timeout:s=1e3,transports:o,weights:a={}}
885){let{stability:c=.7,latency:l=.3}=a,u=[],h=async()=>{let a=await Promise.all(o.map(async t=>{let r,n;let o=t({chain:e,retryCount:0,timeout:s}),a=Date.now();try{await (i?i({transport:o}):o.request({method:"net_listening"})),n=1}catch{n=0}finally{r=Date.now()}return{latency:r-a,success:n}}));u.push(a),u.length>n&&u.shift();let d=Math.max(...u.map(e=>Math.max(...e.map(({latency:e})=>e))));r(o.map((e,t)=>{let r=u.map(e=>e[t].latency),i=r.reduce((e,t)=>e+t,0)/r.length,n=u.map(e=>e[t].success),s=n.reduce((e,t)=>e+t,0)/n.length;return 0===s?[0,t]:[l*(1-i/d)+c*s,t]}).sort((e,t)=>t[0]-e[0]).map(([,e])=>o[e])),await iF(t),h()};h()}({chain:t,interval:e.interval??c,onTransports:e=>h=e,ping:e.ping,sampleCount:e.sampleCount,timeout:e.timeout,transports:h,weights:e.weights})}return p}}function i8(e){return!!("code"in e&&"number"==typeof e.code&&(e.code===im.code||e.code===iv.code||iK.nodeMessage.test(e.message)||5e3===e.code))}Object.defineProperty(i3,"nodeMessage",{enumerable:!0,configurable:!0,writable:!0,value:/max priority fee per gas higher than max fee per gas|tip higher than fee cap/});var i6=r(998);function i4(e,t){let r=new URL("https://rpc.walletconnect.org/v1/");return r.searchParams.set("chainId",e),r.searchParams.set("projectId",t),r.toString()}let i9=["near:mainnet","solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","eip155:1101","eip155:56","eip155:42161","eip155:7777777","eip155:59144","eip155:324","solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1","eip155:5000","solana:4sgjmw1sunhzsxgspuhpqldx6wiyjntz","eip155:80084","eip155:5003","eip155:100","eip155:8453","eip155:42220","eip155:1313161555","eip155:17000","eip155:1","eip155:300","eip155:1313161554","eip155:1329","eip155:84532","eip155:421614","eip155:11155111","eip155:8217","eip155:43114","solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z","eip155:999999999","eip155:11155420","eip155:80002","eip155:97","eip155:43113","eip155:137","eip155:10","eip155:1301","bip122:000000000019d6689c085ae165831e93","bip122:000000000933ea01ad0ee984209779ba"],i7={extendRpcUrlWithProjectId(e,t){let r=!1;try{r="rpc.walletconnect.org"===new URL(e).host}catch(e){r=!1}if(r){let r=new URL(e);return r.searchParams.has("projectId")||r.searchParams.set("projectId",t),r.toString()}return e},isCaipNetwork:e=>"chainNamespace"in e&&"caipNetworkId"in e,getChainNamespace(e){return this.isCaipNetwork(e)?e.chainNamespace:d.b.CHAIN.EVM},getCaipNetworkId(e){return this.isCaipNetwork(e)?e.caipNetworkId:`${d.b.CHAIN.EVM}:${e.id}`},getDefaultRpcUrl(e,t,r){let i=e.rpcUrls?.default?.http?.[0];return i9.includes(t)?i4(t,r):i||""},extendCaipNetwork(e,{customNetworkImageUrls:t,projectId:r,customRpcUrls:i}){let n=this.getChainNamespace(e),s=this.getCaipNetworkId(e),o=e.rpcUrls.default.http?.[0],a=this.getDefaultRpcUrl(e,s,r),c=e?.rpcUrls?.chainDefault?.http?.[0]||o,l=i?.[s]?.map(e=>e.url)||[],u=[...l,a],h=[...l];return c&&!h.includes(c)&&h.push(c),{...e,chainNamespace:n,caipNetworkId:s,assets:{imageId:i6.C.NetworkImageIds[e.id],imageUrl:t?.[e.id]},rpcUrls:{...e.rpcUrls,default:{http:u},chainDefault:{http:h}}}},extendCaipNetworks:(e,{customNetworkImageUrls:t,projectId:r,customRpcUrls:i})=>e.map(e=>i7.extendCaipNetwork(e,{customNetworkImageUrls:t,customRpcUrls:i,projectId:r})),getViemTransport(e,t,r){let i=[];return r?.forEach(e=>{i.push(iH(e.url,e.config))}),i9.includes(e.caipNetworkId)&&i.push(iH(i4(e.caipNetworkId,t),{fetchOptions:{headers:{"Content-Type":"text/plain"}}})),e?.rpcUrls?.default?.http?.forEach(e=>{i.push(iH(e))}),i5(i)},extendWagmiTransports(e,t,r){return i9.includes(e.caipNetworkId)?i5([r,iH(this.getDefaultRpcUrl(e,e.caipNetworkId,t))]):r},getUnsupportedNetwork:e=>({id:e.split(":")[1],caipNetworkId:e,name:d.b.UNSUPPORTED_NETWORK_NAME,chainNamespace:e.split(":")[0],nativeCurrency:{name:"",decimals:0,symbol:""},rpcUrls:{default:{http:[]}}}),getCaipNetworkFromStorage(e){let t=I.M.getActiveCaipNetworkId(),r=E.R.getAllRequestedCaipNetworks(),i=Array.from(E.R.state.chains?.keys()||[]),n=t?.split(":")[0],s=!!n&&i.includes(n),o=r?.find(e=>e.caipNetworkId===t);return s&&!o&&t?this.getUnsupportedNetwork(t):o||e||r?.[0]}},ne={createLogger(e,t="error"){let r=(0,rF.jI)({level:t}),{logger:i}=(0,rF.Rt)({opts:r});return i.error=(...t)=>{for(let r of t)if(r instanceof Error){e(r,...t);return}e(void 0,...t)},i}};var nt=r(85263);let nr="2.27.3",ni={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:r})=>t?`${e??"https://viem.sh"}${t}${r?`#${r}`:""}`:void 0,version:`viem@${nr}`};
885class nn extends Error{constructor(e,t={}){let r=t.cause instanceof nn?t.cause.details:t.cause?.message?t.cause.message:t.details,i=t.cause instanceof nn&&t.cause.docsPath||t.docsPath,n=ni.getDocsUrl?.({...t,docsPath:i});super([e||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...n?[`Docs: ${n}`]:[],...r?[`Details: ${r}`]:[],...ni.version?[`Version: ${ni.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=i,this.metaMessages=t.metaMessages,this.name=t.name??this.name,this.shortMessage=e,this.version=nr}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 ns extends nn{constructor({max:e,min:t,signed:r,size:i,value:n}){super(`Number "${n}" is not in safe ${i?`${8*i}-bit ${r?"signed":"unsigned"} `:""}integer range ${e?`(${t} to ${e})`:`(above ${t})`}`,{name:"IntegerOutOfRangeError"})}}class no extends nn{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}}class na extends nn{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 nc(e,{dir:t,size:r=32}={}){return"string"==typeof e?function(e,{dir:t,size:r=32}={}){if(null===r)return e;let i=e.replace("0x","");if(i.length>2*r)throw new na({size:Math.ceil(i.length/2),targetSize:r,type:"hex"});return`0x${i["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 na({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 nl(e){return!function(e,{strict:t=!0}={}){return!!e&&"string"==typeof e&&(t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x"))}(e,{strict:!1})?e.length:Math.ceil((e.length-2)/2)}function nu(e,{size:t}){if(nl(e)>t)throw new no({givenSize:nl(e),maxSize:t})}let nh=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function nd(e,t={}){return"number"==typeof e||"bigint"==typeof e?function(e,t={}){let r;let{signed:i,size:n}=t,s=BigInt(e);n?r=i?(1n<<8n*BigInt(n)-1n)-1n:2n**(8n*BigInt(n))-1n:"number"==typeof e&&(r=BigInt(Number.MAX_SAFE_INTEGER));let o="bigint"==typeof r&&i?-r-1n:0;if(r&&s>r||s<o){let t="bigint"==typeof e?"n":"";throw new ns({max:r?`${r}${t}`:void 0,min:`${o}${t}`,signed:i,size:n,value:`${e}${t}`})}let a=`0x${(i&&s<0?(1n<<BigInt(8*n))+BigInt(s):s).toString(16)}`;return n?nc(a,{size:n}):a}(e,t):"string"==typeof e?function(e,t={}){return np(nf.encode(e),t)}(e,t):"boolean"==typeof e?function(e,t={}){let r=`0x${Number(e)}`;return"number"==typeof t.size?(nu(r,{size:t.size}),nc(r,{size:t.size})):r}(e,t):np(e,t)}function np(e,t={}){let r="";for(let t=0;t<e.length;t++)r+=nh[e[t]];let i=`0x${r}`;return"number"==typeof t.size?(nu(i,{size:t.size}),nc(i,{dir:"right",size:t.size})):i}let nf=new TextEncoder;var ng=r(51466),nm=r(18535),ny=r(84135);class nw extends ng.q{setUniversalProvider(e){this.addConnector(new nm.z({provider:e,caipNetworks:this.getCaipNetworks(),namespace:this.namespace}))}async connect(e){return Promise.resolve({id:"WALLET_CONNECT",type:"WALLET_CONNECT",chainId:Number(e.chainId),provider:this.provider,address:""})}async disconnect(){try{let e=this.getWalletConnectConnector();await e.disconnect()}
885catch(e){console.warn("UniversalAdapter:disconnect - error",e)}}async getAccounts({namespace:e}){let t=this.provider;return Promise.resolve({accounts:(t?.session?.namespaces?.[e]?.accounts?.map(e=>{let[,,t]=e.split(":");return t}).filter((e,t,r)=>r.indexOf(e)===t)||[]).map(t=>C.j.createAccount(e,t,"bip122"===e?"payment":"eoa"))})}async syncConnectors(){return Promise.resolve()}async getBalance(e){if(!(e.caipNetwork&&y.bq.BALANCE_SUPPORTED_CHAINS.includes(e.caipNetwork?.chainNamespace))||e.caipNetwork?.testnet)return{balance:"0.00",symbol:e.caipNetwork?.nativeCurrency.symbol||""};if(v.AccountController.state.balanceLoading&&e.chainId===E.R.state.activeCaipNetwork?.id)return{balance:v.AccountController.state.balance||"0.00",symbol:v.AccountController.state.balanceSymbol||""};let t=(await v.AccountController.fetchTokenBalance()).find(t=>t.chainId===`${e.caipNetwork?.chainNamespace}:${e.chainId}`&&t.symbol===e.caipNetwork?.nativeCurrency.symbol);return{balance:t?.quantity.numeric||"0.00",symbol:t?.symbol||e.caipNetwork?.nativeCurrency.symbol||""}}async signMessage(e){let{provider:t,message:r,address:i}=e;if(!t)throw Error("UniversalAdapter:signMessage - provider is undefined");return{signature:E.R.state.activeCaipNetwork?.chainNamespace===d.b.CHAIN.SOLANA?(await t.request({method:"solana_signMessage",params:{message:nt.Z.encode(new TextEncoder().encode(r)),pubkey:i}},E.R.state.activeCaipNetwork?.caipNetworkId)).signature:await t.request({method:"personal_sign",params:[r,i]},E.R.state.activeCaipNetwork?.caipNetworkId)}}async estimateGas(){return Promise.resolve({gas:BigInt(0)})}async getProfile(){return Promise.resolve({profileImage:"",profileName:""})}async sendTransaction(){return Promise.resolve({hash:""})}walletGetAssets(e){return Promise.resolve({})}async writeContract(){return Promise.resolve({hash:""})}async getEnsAddress(){return Promise.resolve({address:!1})}parseUnits(){return 0n}formatUnits(){return"0"}async getCapabilities(){return Promise.resolve({})}async grantPermissions(){return Promise.resolve({})}async revokePermissions(){return Promise.resolve("0x")}async syncConnection(){return Promise.resolve({id:"WALLET_CONNECT",type:"WALLET_CONNECT",chainId:1,provider:this.provider,address:""})}async switchNetwork(e){let{caipNetwork:t}=e,r=this.getWalletConnectConnector();if(t.chainNamespace===d.b.CHAIN.EVM)try{await r.provider?.request({method:"wallet_switchEthereumChain",params:[{chainId:nd(t.id)}]})}catch(e){if(e.code===ny.T.ERROR_CODE_UNRECOGNIZED_CHAIN_ID||e.code===ny.T.ERROR_INVALID_CHAIN_ID||e.code===ny.T.ERROR_CODE_DEFAULT||e?.data?.originalError?.code===ny.T.ERROR_CODE_UNRECOGNIZED_CHAIN_ID)try{await r.provider?.request({method:"wallet_addEthereumChain",params:[{chainId:nd(t.id),rpcUrls:[t?.rpcUrls.chainDefault?.http],chainName:t.name,nativeCurrency:t.nativeCurrency,blockExplorerUrls:[t.blockExplorers?.default.url]}]})}catch(e){throw Error("Chain is not supported")}}r.provider.setDefaultChain(t.caipNetworkId)}getWalletConnectProvider(){let e=this.connectors.find(e=>"WALLET_CONNECT"===e.type);return e?.provider}}var nb=r(39831);class nv{constructor(e){this.chainNamespaces=[],this.reportedAlertErrors={},this.getCaipNetwork=(e,t)=>{if(e){let r=E.R.getNetworkData(e)?.requestedCaipNetworks?.find(e=>e.id===t);return r?r:E.R.getNetworkData(e)?.caipNetwork||E.R.getRequestedCaipNetworks(e).filter(t=>t.chainNamespace===e)?.[0]}return E.R.state.activeCaipNetwork||this.defaultCaipNetwork},this.getCaipNetworkId=()=>{let e=this.getCaipNetwork();if(e)return e.id},this.getCaipNetworks=e=>E.R.getCaipNetworks(e),this.getActiveChainNamespace=()=>E.R.state.activeChain,this.setRequestedCaipNetworks=(e,t)=>{E.R.setRequestedCaipNetworks(e,t)},this.getApprovedCaipNetworkIds=()=>E.R.getAllApprovedCaipNetworkIds(),this.getCaipAddress=e=>E.R.state.activeChain!==e&&e?E.R.getAccountProp("caipAddress",e):E.R.state.activeCaipAddress,this.setClientId=e=>{rG.L.setClientId(e)},this.getProvider=e=>D.getProvider(e),this.getProviderType=e=>D.getProviderId(e),this.getPreferredAccountType=e=>v.AccountController.state.preferredAccountTypes?.[e],this.setCaipAddress=(e,t)=>{v.AccountController.setCaipAddress(e,t)},this.setBalance=(e,t,r)=>{v.AccountController.setBalance(e,t,r)},this.setProfileName=(e,t)=>
885{v.AccountController.setProfileName(e,t)},this.setProfileImage=(e,t)=>{v.AccountController.setProfileImage(e,t)},this.setUser=(e,t)=>{v.AccountController.setUser(e,t),_.OptionsController.state.enableEmbedded&&rY.I.close()},this.resetAccount=e=>{v.AccountController.resetAccount(e)},this.setCaipNetwork=e=>{E.R.setActiveCaipNetwork(e)},this.setCaipNetworkOfNamespace=(e,t)=>{E.R.setChainNetworkData(t,{caipNetwork:e})},this.setAllAccounts=(e,t)=>{v.AccountController.setAllAccounts(e,t),_.OptionsController.setHasMultipleAddresses(e?.length>1)},this.setStatus=(e,t)=>{v.AccountController.setStatus(e,t),f.ConnectorController.isConnected()?I.M.setConnectionStatus("connected"):I.M.setConnectionStatus("disconnected")},this.getAddressByChainNamespace=e=>E.R.getAccountProp("address",e),this.setConnectors=e=>{let t=[...f.ConnectorController.state.allConnectors,...e];f.ConnectorController.setConnectors(t)},this.fetchIdentity=e=>rG.L.fetchIdentity(e),this.getReownName=e=>rJ.a.getNamesForAddress(e),this.getConnectors=()=>f.ConnectorController.getConnectors(),this.getConnectorImage=e=>rX.f.getConnectorImage(e),this.setConnectedWalletInfo=(e,t)=>{let r=D.getProviderId(t),i=e?{...e,type:r}:void 0;v.AccountController.setConnectedWalletInfo(i,t)},this.getIsConnectedState=()=>!!E.R.state.activeCaipAddress,this.addAddressLabel=(e,t,r)=>{v.AccountController.addAddressLabel(e,t,r)},this.removeAddressLabel=(e,t)=>
885{v.AccountController.removeAddressLabel(e,t)},this.getAddress=e=>E.R.state.activeChain!==e&&e?E.R.getAccountProp("address",e):v.AccountController.state.address,this.setApprovedCaipNetworksData=e=>E.R.setApprovedCaipNetworksData(e),this.resetNetwork=e=>{E.R.resetNetwork(e)},this.addConnector=e=>{f.ConnectorController.addConnector(e)},this.resetWcConnection=()=>{g.ConnectionController.resetWcConnection()},this.setAddressExplorerUrl=(e,t)=>{v.AccountController.setAddressExplorerUrl(e,t)},this.setSmartAccountDeployed=(e,t)=>{v.AccountController.setSmartAccountDeployed(e,t)},this.setSmartAccountEnabledNetworks=(e,t)=>{E.R.setSmartAccountEnabledNetworks(e,t)},this.setPreferredAccountType=(e,t)=>{v.AccountController.setPreferredAccountType(e,t)},this.setEIP6963Enabled=e=>{_.OptionsController.setEIP6963Enabled(e)},this.handleUnsafeRPCRequest=()=>{this.isOpen()?this.isTransactionStackEmpty()||this.redirect("ApproveTransaction"):this.open({view:"ApproveTransaction"})},this.options=e,this.version=e.sdkVersion,this.caipNetworks=this.extendCaipNetworks(e),this.chainNamespaces=this.getChainNamespacesSet(e.adapters,this.caipNetworks),this.defaultCaipNetwork=this.extendDefaultCaipNetwork(e),this.chainAdapters=this.createAdapters(e.adapters),this.initialize(e)}getChainNamespacesSet(e,t){let r=e?.map(e=>e.namespace).filter(e=>!!e);return r?.length?[...new Set(r)]:[...new Set(t?.map(e=>e.chainNamespace))]}async initialize(e){this.initControllers(e),await this.initChainAdapters(),await this.injectModalUi(),this.sendInitializeEvent(e),w.I.set({initialized:!0}),await this.syncExistingConnection()}sendInitializeEvent(e){let{...t}=e;delete t.adapters,delete t.universalProvider,m.X.sendEvent({type:"track",event:"INITIALIZE",properties:{...t,networks:e.networks.map(e=>e.id),siweConfig:{options:e.siweConfig?.options||{}}}})}initControllers(e){this.initializeOptionsController(e),this.initializeChainController(e),this.initializeThemeController(e),this.initializeConnectionController(e),this.initializeConnectorController()}initializeThemeController(e){e.themeMode&&A.ThemeController.setThemeMode(e.themeMode),e.themeVariables&&A.ThemeController.setThemeVariables(e.themeVariables)}initializeChainController(e){if(!this.connectionControllerClient||!this.networkControllerClient)throw Error("ConnectionControllerClient and NetworkControllerClient must be set");E.R.initialize(e.adapters??[],this.caipNetworks,{connectionControllerClient:this.connectionControllerClient,networkControllerClient:this.networkControllerClient});let t=this.getDefaultNetwork();t&&E.R.setActiveCaipNetwork(t)}initializeConnectionController(e){g.ConnectionController.setWcBasic(e.basic??!1)}initializeConnectorController(){f.ConnectorController.initialize(this.chainNamespaces)}initializeOptionsController(e){_.OptionsController.setDebug(!1!==e.debug),_.OptionsController.setEnableWalletConnect(!1!==e.enableWalletConnect),_.OptionsController.setEnableWalletGuide(!1!==e.enableWalletGuide),_.OptionsController.setEnableWallets(!1!==e.enableWallets),_.OptionsController.setEIP6963Enabled(!1!==e.enableEIP6963),_.OptionsController.setEnableNetworkSwitch(!1!==e.enableNetworkSwitch),_.OptionsController.setEnableAuthLogger(!1!==e.enableAuthLogger),_.OptionsController.setCustomRpcUrls(e.customRpcUrls),_.OptionsController.setSdkVersion(e.sdkVersion),_.OptionsController.setProjectId(e.projectId),_.OptionsController.setEnableEmbedded(e.enableEmbedded),_.OptionsController.setAllWallets(e.allWallets),_.OptionsController.setIncludeWalletIds(e.includeWalletIds),_.OptionsController.setExcludeWalletIds(e.excludeWalletIds),_.OptionsController.setFeaturedWalletIds(e.featuredWalletIds),_.OptionsController.setTokens(e.tokens),_.OptionsController.setTermsConditionsUrl(e.termsConditionsUrl),_.OptionsController.setPrivacyPolicyUrl(e.privacyPolicyUrl),_.OptionsController.setCustomWallets(e.customWallets),_.OptionsController.setFeatures(e.features),_.OptionsController.setAllowUnsupportedChain(e.allowUnsupportedChain),_.OptionsController.setUniversalProviderConfigOverride(e.universalProviderConfigOverride),_.OptionsController.setDefaultAccountTypes(e.defaultAccountTypes);let t=I.M.getPreferredAccountTypes(),r={..._.OptionsController.state.defaultAccountTypes,...t};v.AccountController.setPreferredAccountTypes(r);let i=this.getDefaultMetaData();if(!e.metadata&&i&&(e.metadata=i),_.OptionsController.setMetadata(e.metadata),_.OptionsController.setDisableAppend(e.disableAppend),_.OptionsController.setEnableEmbedded(e.enableEmbedded),_.OptionsController.setSIWX(e.siwx),!e.projectId){S.AlertController.open(x.j.ALERT_ERRORS.PROJECT_ID_NOT_CONFIGURED,"error");return}if(e.adapters?.find(e=>e.namespace===d.b.CHAIN.EVM)&&e.siweConfig){if(e.siwx)throw Error("Cannot set both `siweConfig` and `siwx` options");_.OptionsController.setSIWX(e.siweConfig.mapToSIWX())}}getDefaultMetaData(){return"undefined"!=typeof window&&"undefined"!=typeof document?{name:document.getElementsByTagName("title")?.[0]?.textContent||"",description:document.querySelector('meta[property="og:description"]')?.content||"",url:window.location.origin,icons:[document.querySelector('link[rel~="icon"]')?.href||""]}:null}setUnsupportedNetwork(e){let t=this.getActiveChainNamespace();if(t){let r=i7.getUnsupportedNetwork(`${t}:${e}`);E.R.setActiveCaipNetwork(r)}}getDefaultNetwork(){return i7.getCaipNetworkFromStorage(this.defaultCaipNetwork)}extendCaipNetwork(e,t){return i7.extendCaipNetwork(e,{customNetworkImageUrls:t.chainImages,projectId:t.projectId})}extendCaipNetworks(e){return i7.extendCaipNetworks(e.networks,{customNetworkImageUrls:e.chainImages,customRpcUrls:e.customRpcUrls,projectId:e.projectId})}extendDefaultCaipNetwork(e){let t=e.networks.find(t=>
885t.id===e.defaultNetwork?.id);return t?i7.extendCaipNetwork(t,{customNetworkImageUrls:e.chainImages,customRpcUrls:e.customRpcUrls,projectId:e.projectId}):void 0}createClients(){this.connectionControllerClient={connectWalletConnect:async()=>{let e=E.R.state.activeChain,t=this.getAdapter(e),r=this.getCaipNetwork(e)?.id;if(!t)throw Error("Adapter not found");let i=await t.connectWalletConnect(r);this.close(),this.setClientId(i?.clientId||null),I.M.setConnectedNamespaces([...E.R.state.chains.keys()]),this.chainNamespaces.forEach(e=>{f.ConnectorController.setConnectorId(O.b.CONNECTOR_TYPE_WALLET_CONNECT,e)}),await this.syncWalletConnectAccount()},connectExternal:async({id:e,info:t,type:r,provider:i,chain:n,caipNetwork:s})=>{let o=E.R.state.activeChain,a=n||o,c=this.getAdapter(a);if(n&&n!==o&&!s){let e=this.getCaipNetworks().find(e=>e.chainNamespace===n);e&&this.setCaipNetwork(e)}if(!c)throw Error("Adapter not found");let l=this.getCaipNetwork(a),u=await c.connect({id:e,info:t,type:r,provider:i,chainId:s?.id||l?.id,rpcUrl:s?.rpcUrls?.default?.http?.[0]||l?.rpcUrls?.default?.http?.[0]});if(!u)return;I.M.addConnectedNamespace(a),this.syncProvider({...u,chainNamespace:a});let{accounts:h}=await c.getAccounts({namespace:a,id:e});this.setAllAccounts(h,a),this.setStatus("connected",a)},reconnectExternal:async({id:e,info:t,type:r,provider:i})=>{let n=E.R.state.activeChain,s=this.getAdapter(n);s?.reconnect&&(await s?.reconnect({id:e,info:t,type:r,provider:i,chainId:this.getCaipNetwork()?.id}),I.M.addConnectedNamespace(n))},disconnect:async e=>{let t=e||E.R.state.activeChain,r=this.getAdapter(t),i=D.getProvider(t),n=D.getProviderId(t);await r?.disconnect({provider:i,providerType:n}),I.M.removeConnectedNamespace(t),D.resetChain(t),this.setUser(void 0,t),this.setStatus("disconnected",t)},checkInstalled:e=>e?e.some(e=>!!window.ethereum?.[String(e)]):!!window.ethereum,signMessage:async e=>{let t=this.getAdapter(E.R.state.activeChain),r=await t?.signMessage({message:e,address:v.AccountController.state.address,provider:D.getProvider(E.R.state.activeChain)});return r?.signature||""},sendTransaction:async e=>{if(e.chainNamespace===d.b.CHAIN.EVM){let t=this.getAdapter(E.R.state.activeChain),r=D.getProvider(E.R.state.activeChain),i=await t?.sendTransaction({...e,caipNetwork:this.getCaipNetwork(),provider:r});return i?.hash||""}return""},estimateGas:async e=>{if(e.chainNamespace===d.b.CHAIN.EVM){let t=this.getAdapter(E.R.state.activeChain),r=D.getProvider(E.R.state.activeChain),i=this.getCaipNetwork();if(!i)throw Error("CaipNetwork is undefined");let n=await t?.estimateGas({...e,provider:r,caipNetwork:i});return n?.gas||0n}return 0n},getEnsAvatar:async()=>{let e=this.getAdapter(E.R.state.activeChain),t=await e?.getProfile({address:v.AccountController.state.address,chainId:Number(this.getCaipNetwork()?.id)});return t?.profileImage||!1},getEnsAddress:async e=>{let t=this.getAdapter(E.R.state.activeChain),r=this.getCaipNetwork();if(!r)return!1;let i=await t?.getEnsAddress({name:e,caipNetwork:r});return i?.address||!1},writeContract:async e=>{let t=this.getAdapter(E.R.state.activeChain),r=this.getCaipNetwork(),i=this.getCaipAddress(),n=D.getProvider(E.R.state.activeChain);if(!r||!i)throw Error("CaipNetwork or CaipAddress is undefined");let s=await t?.writeContract({...e,caipNetwork:r,provider:n,caipAddress:i});return s?.hash},parseUnits:(e,t)=>{let r=this.getAdapter(E.R.state.activeChain);return r?.parseUnits({value:e,decimals:t})??0n},formatUnits:(e,t)=>{let r=this.getAdapter(E.R.state.activeChain);return r?.formatUnits({value:e,decimals:t})??"0"},getCapabilities:async e=>{let t=this.getAdapter(E.R.state.activeChain);return await t?.getCapabilities(e)},grantPermissions:async e=>{let t=this.getAdapter(E.R.state.activeChain);return await t?.grantPermissions(e)},revokePermissions:async e=>{let t=this.getAdapter(E.R.state.activeChain);return t?.revokePermissions?await t.revokePermissions(e):"0x"},walletGetAssets:async e=>{let t=this.getAdapter(E.R.state.activeChain);return await t?.walletGetAssets(e)??{}}},this.networkControllerClient={switchCaipNetwork:async e=>await this.switchCaipNetwork(e),getApprovedCaipNetworksData:async()=>this.getApprovedCaipNetworksData()},g.ConnectionController.setClient(this.connectionControllerClient)}getApprovedCaipNetworksData(){if(D.getProviderId(E.R.state.activeChain)===O.b.CONNECTOR_TYPE_WALLET_CONNECT){let e=this.universalProvider?.session?.namespaces;return{supportsAllNetworks:this.universalProvider?.session?.peer?.metadata.name==="MetaMask Wallet",approvedCaipNetworkIds:this.getChainsFromNamespaces(e)}}return{supportsAllNetworks:!0,approvedCaipNetworkIds:[]}}async switchCaipNetwork(e){if(!e)return;let t=e.chainNamespace;if(this.getAddressByChainNamespace(e.chainNamespace)){let r=D.getProvider(t),i=D.getProviderId(t);if(e.chainNamespace===E.R.state.activeChain){let n=this.getAdapter(t);await n?.switchNetwork({caipNetwork:e,provider:r,providerType:i})}else if(this.setCaipNetwork(e),i===O.b.CONNECTOR_TYPE_WALLET_CONNECT)this.syncWalletConnectAccount();else{let r=this.getAddressByChainNamespace(t);r&&this.syncAccount({address:r,chainId:e.id,chainNamespace:t})}}else this.setCaipNetwork(e)}
885getChainsFromNamespaces(e={}){return Object.values(e).flatMap(e=>Array.from(new Set([...e.chains||[],...e.accounts.map(e=>{let{chainId:t,chainNamespace:r}=rK.u.parseCaipAddress(e);return`${r}:${t}`})])))}createAdapters(e){return this.createClients(),this.chainNamespaces.reduce((t,r)=>{let i=e?.find(e=>e.namespace===r);return i?(i.construct({namespace:r,projectId:this.options?.projectId,networks:this.getCaipNetworks()}),t[r]=i):t[r]=new nw({namespace:r,networks:this.getCaipNetworks()}),t},{})}async initChainAdapter(e){this.onConnectors(e),this.listenAdapter(e),this.chainAdapters?.[e].syncConnectors(this.options,this),await this.createUniversalProviderForAdapter(e)}async initChainAdapters(){await Promise.all(this.chainNamespaces.map(async e=>{await this.initChainAdapter(e)}))}onConnectors(e){let t=this.getAdapter(e);t?.on("connectors",this.setConnectors.bind(this))}listenAdapter(e){let t=this.getAdapter(e);if(!t)return;let r=I.M.getConnectionStatus();"connected"===r?this.setStatus("connecting",e):("disconnected"===r&&I.M.clearAddressCache(),this.setStatus(r,e)),t.on("switchNetwork",({address:t,chainId:r})=>{let i=this.getCaipNetworks().find(e=>e.id===r||e.caipNetworkId===r),n=E.R.state.activeChain===e,s=E.R.getAccountProp("address",e);if(i){let r=n&&t?t:s;r&&this.syncAccount({address:r,chainId:i.id,chainNamespace:e})}else this.setUnsupportedNetwork(r)}),t.on("disconnect",this.disconnect.bind(this,e)),t.on("pendingTransactions",()=>{let e=v.AccountController.state.address,t=E.R.state.activeCaipNetwork;e&&t?.id&&this.updateNativeBalance(e,t.id,t.chainNamespace)}),t.on("accountChanged",({address:t,chainId:r})=>{let i=E.R.state.activeChain===e;i&&r?this.syncAccount({address:t,chainId:r,chainNamespace:e}):i&&E.R.state.activeCaipNetwork?.id?this.syncAccount({address:t,chainId:E.R.state.activeCaipNetwork?.id,chainNamespace:e}):this.syncAccountInfo(t,r,e)})}async createUniversalProviderForAdapter(e){await this.getUniversalProvider(),this.universalProvider&&this.chainAdapters?.[e]?.setUniversalProvider?.(this.universalProvider)}async syncExistingConnection(){await Promise.allSettled(this.chainNamespaces.map(e=>this.syncNamespaceConnection(e)))}async syncNamespaceConnection(e){try{let t=f.ConnectorController.getConnectorId(e);switch(this.setStatus("connecting",e),t){case d.b.CONNECTOR_ID.WALLET_CONNECT:await this.syncWalletConnectAccount();break;case d.b.CONNECTOR_ID.AUTH:break;default:await this.syncAdapterConnection(e)}}catch(t){console.warn("AppKit couldn't sync existing connection",t),this.setStatus("disconnected",e)}}async syncAdapterConnection(e){let t=this.getAdapter(e),r=f.ConnectorController.getConnectorId(e),i=this.getCaipNetwork(e),n=f.ConnectorController.getConnectors(e).find(e=>e.id===r);try{if(!t||!n)throw Error(`Adapter or connector not found for namespace ${e}`);if(!i?.id)throw Error("CaipNetwork not found");let r=await t?.syncConnection({namespace:e,id:n.id,chainId:i.id,rpcUrl:i?.rpcUrls?.default?.http?.[0]});if(r){let i=await t?.getAccounts({namespace:e,id:n.id});i&&i.accounts.length>0?this.setAllAccounts(i.accounts,e):this.setAllAccounts([C.j.createAccount(e,r.address,"eoa")],e),this.syncProvider({...r,chainNamespace:e}),await this.syncAccount({...r,chainNamespace:e}),this.setStatus("connected",e)}else this.setStatus("disconnected",e)}catch(t){this.setStatus("disconnected",e)}}async syncWalletConnectAccount(){let e=this.chainNamespaces.map(async e=>{let t=this.getAdapter(e),r=this.universalProvider?.session?.namespaces?.[e]?.accounts||[],i=E.R.state.activeCaipNetwork?.id,n=r.find(e=>{let{chainId:t}=rK.u.parseCaipAddress(e);return t===i?.toString()})||r[0];if(n){let r=rK.u.validateCaipAddress(n),{chainId:i,address:s}=rK.u.parseCaipAddress(r);if(D.setProviderId(e,O.b.CONNECTOR_TYPE_WALLET_CONNECT),this.caipNetworks&&E.R.state.activeCaipNetwork&&t?.namespace!==d.b.CHAIN.EVM){let r=t?.getWalletConnectProvider({caipNetworks:this.getCaipNetworks(),provider:this.universalProvider,activeCaipNetwork:E.R.state.activeCaipNetwork});D.setProvider(e,r)}else D.setProvider(e,this.universalProvider);f.ConnectorController.setConnectorId(d.b.CONNECTOR_ID.WALLET_CONNECT,e),I.M.addConnectedNamespace(e),this.syncWalletConnectAccounts(e),await this.syncAccount({address:s,chainId:i,chainNamespace:e})}else this.setStatus("disconnected",e);await E.R.setApprovedCaipNetworksData(e)});await Promise.all(e)}syncWalletConnectAccounts(e){let t=this.universalProvider?.session?.namespaces?.[e]?.accounts?.map(e=>{let{address:t}=rK.u.parseCaipAddress(e);return t}).filter((e,t,r)=>r.indexOf(e)===t);t&&this.setAllAccounts(t.map(t=>C.j.createAccount(e,t,"bip122"===e?"payment":"eoa")),e)}syncProvider({type:e,provider:t,id:r,chainNamespace:i}){D.setProviderId(i,e),D.setProvider(i,t),f.ConnectorController.setConnectorId(r,i)}async syncAccount(e){let t=e.chainNamespace===E.R.state.activeChain,r=E.R.getCaipNetworkByNamespace(e.chainNamespace,e.chainId),{address:i,chainId:n,chainNamespace:s}=e,{chainId:o}=I.M.getActiveNetworkProps(),a=n||o,c=E.R.state.activeCaipNetwork?.name===d.b.UNSUPPORTED_NETWORK_NAME,l=E.R.getNetworkProp("supportsAllNetworks",
885s);if(this.setStatus("connected",s),(!c||l)&&a){let e=this.getCaipNetworks().find(e=>e.id.toString()===a.toString()),n=this.getCaipNetworks().find(e=>e.chainNamespace===s);if(!l&&!e&&!n){let t=this.getApprovedCaipNetworkIds()||[],r=t.find(e=>rK.u.parseCaipNetworkId(e)?.chainId===a.toString()),i=t.find(e=>rK.u.parseCaipNetworkId(e)?.chainNamespace===s);e=this.getCaipNetworks().find(e=>e.caipNetworkId===r),n=this.getCaipNetworks().find(e=>e.caipNetworkId===i||"deprecatedCaipNetworkId"in e&&e.deprecatedCaipNetworkId===i)}let o=e||n;o?.chainNamespace===E.R.state.activeChain?_.OptionsController.state.enableNetworkSwitch&&!_.OptionsController.state.allowUnsupportedChain&&E.R.state.activeCaipNetwork?.name===d.b.UNSUPPORTED_NETWORK_NAME?E.R.showUnsupportedChainUI():this.setCaipNetwork(o):!t&&r&&this.setCaipNetworkOfNamespace(r,s),this.syncConnectedWalletInfo(s),N.g.isLowerCaseMatch(i,v.AccountController.state.address)||this.syncAccountInfo(i,o?.id,s),t?await this.syncBalance({address:i,chainId:o?.id,chainNamespace:s}):await this.syncBalance({address:i,chainId:r?.id,chainNamespace:s})}}async syncAccountInfo(e,t,r){let i=this.getCaipAddress(r),n=t||i?.split(":")[1];if(!n)return;let s=`${r}:${n}:${e}`;this.setCaipAddress(s,r),await this.syncIdentity({address:e,chainId:n,chainNamespace:r})}async syncReownName(e,t){try{let r=await this.getReownName(e);if(r[0]){let e=r[0];this.setProfileName(e.name,t)}else this.setProfileName(null,t)}catch{this.setProfileName(null,t)}}syncConnectedWalletInfo(e){let t=f.ConnectorController.getConnectorId(e),r=D.getProviderId(e);if(r===O.b.CONNECTOR_TYPE_ANNOUNCED||r===O.b.CONNECTOR_TYPE_INJECTED){if(t){let r=this.getConnectors().find(e=>e.id===t);if(r){let{info:t,name:i,imageUrl:n}=r,s=n||this.getConnectorImage(r);this.setConnectedWalletInfo({name:i,icon:s,...t},e)}}}else if(r===O.b.CONNECTOR_TYPE_WALLET_CONNECT){let t=D.getProvider(e);t?.session&&this.setConnectedWalletInfo({...t.session.peer.metadata,name:t.session.peer.metadata.name,icon:t.session.peer.metadata.icons?.[0]},e)}else if(t){if(t===d.b.CONNECTOR_ID.COINBASE){let t=this.getConnectors().find(e=>e.id===d.b.CONNECTOR_ID.COINBASE);this.setConnectedWalletInfo({name:"Coinbase Wallet",icon:this.getConnectorImage(t)},e)}else this.setConnectedWalletInfo({name:t},e)}}async syncBalance(e){rZ.p.getNetworksByNamespace(this.getCaipNetworks(),e.chainNamespace).find(t=>t.id.toString()===e.chainId?.toString())&&e.chainId&&await this.updateNativeBalance(e.address,e.chainId,e.chainNamespace)}async updateNativeBalance(e,t,r){let i=this.getAdapter(r),n=E.R.getCaipNetworkByNamespace(r,t);if(i){let s=await i.getBalance({address:e,chainId:t,caipNetwork:n,tokens:this.options.tokens});this.setBalance(s.balance,s.symbol,r)}}async initializeUniversalAdapter(){let e=ne.createLogger((e,...t)=>{e&&this.handleAlertError(e),console.error(...t)}),t={projectId:this.options?.projectId,metadata:{name:this.options?.metadata?this.options?.metadata.name:"",description:this.options?.metadata?this.options?.metadata.description:"",url:this.options?.metadata?this.options?.metadata.url:"",icons:this.options?.metadata?this.options?.metadata.icons:[""]},logger:e};_.OptionsController.setManualWCControl(!!this.options?.manualWCControl),this.universalProvider=this.options.universalProvider??await rV.Z.init(t),this.listenWalletConnect()}listenWalletConnect(){this.universalProvider&&(this.universalProvider.on("display_uri",e=>{g.ConnectionController.setUri(e)}),this.universalProvider.on("connect",g.ConnectionController.finalizeWcConnection),this.universalProvider.on("disconnect",()=>{this.chainNamespaces.forEach(e=>{this.resetAccount(e)}),g.ConnectionController.resetWcConnection()}),this.universalProvider.on("chainChanged",e=>{let t=this.getCaipNetworks().find(t=>t.id==e),r=this.getCaipNetwork();if(!t){this.setUnsupportedNetwork(e);return}r?.id!==t?.id&&this.setCaipNetwork(t)}),this.universalProvider.on("session_event",e=>{if(nb.sQ.isSessionEventData(e)){let{name:t,data:r}=e.params.event;"accountsChanged"===t&&Array.isArray(r)&&C.j.isCaipAddress(r[0])&&this.syncAccount(rK.u.parseCaipAddress(r[0])
885)}}))}createUniversalProvider(){return!this.universalProviderInitPromise&&C.j.isClient()&&this.options?.projectId&&(this.universalProviderInitPromise=this.initializeUniversalAdapter()),this.universalProviderInitPromise}async getUniversalProvider(){if(!this.universalProvider)try{await this.createUniversalProvider()}catch(e){m.X.sendEvent({type:"error",event:"INTERNAL_SDK_ERROR",properties:{errorType:"UniversalProviderInitError",errorMessage:e instanceof Error?e.message:"Unknown",uncaught:!1}}),console.error("AppKit:getUniversalProvider - Cannot create provider",e)}return this.universalProvider}handleAlertError(e){let[t,r]=Object.entries(x.j.UniversalProviderErrors).find(([,{message:t}])=>e.message.includes(t))??[],{message:i,alertErrorKey:n}=r??{};if(t&&i&&!this.reportedAlertErrors[t]){let e=x.j.ALERT_ERRORS[n];e&&(S.AlertController.open(e,"error"),this.reportedAlertErrors[t]=!0)}}getAdapter(e){if(e)return this.chainAdapters?.[e]}createAdapter(e){if(!e)return;let t=e.namespace;t&&(this.createClients(),e.namespace=t,e.construct({namespace:t,projectId:this.options?.projectId,networks:this.getCaipNetworks()}),this.chainNamespaces.includes(t)||this.chainNamespaces.push(t),this.chainAdapters&&(this.chainAdapters[t]=e))}async open(e){return(await this.injectModalUi(),e?.uri&&g.ConnectionController.setUri(e.uri),e?.arguments&&e?.view==="Swap")?rY.I.open({...e,data:{swap:e.arguments}}):rY.I.open(e)}async close(){await this.injectModalUi(),rY.I.close()}setLoading(e,t){rY.I.setLoading(e,t)}async disconnect(e){await g.ConnectionController.disconnect(e)}getError(){return""}getChainId(){return E.R.state.activeCaipNetwork?.id}async switchNetwork(e){let t=this.getCaipNetworks().find(t=>t.id===e.id);if(!t){S.AlertController.open(x.j.ALERT_ERRORS.SWITCH_NETWORK_NOT_FOUND,"error");return}await E.R.switchActiveNetwork(t)}getWalletProvider(){return E.R.state.activeChain?D.state.providers[E.R.state.activeChain]:null}getWalletProviderType(){return D.getProviderId(E.R.state.activeChain)}subscribeProviders(e){return D.subscribeProviders(e)}getThemeMode(){return A.ThemeController.state.themeMode}getThemeVariables(){return A.ThemeController.state.themeVariables}setThemeMode(e){A.ThemeController.setThemeMode(e),(0,r2.Hs)(A.ThemeController.state.themeMode)}setTermsConditionsUrl(e){_.OptionsController.setTermsConditionsUrl(e)}setPrivacyPolicyUrl(e){_.OptionsController.setPrivacyPolicyUrl(e)}setThemeVariables(e){A.ThemeController.setThemeVariables(e),(0,r2.R)(A.ThemeController.state.themeVariables)}subscribeTheme(e){return A.ThemeController.subscribe(e)}getWalletInfo(){return v.AccountController.state.connectedWalletInfo}getAccount(e){let t=f.ConnectorController.getAuthConnector(e),r=E.R.getAccountData(e),i=E.R.state.activeChain;if(r)return{allAccounts:r.allAccounts,caipAddress:r.caipAddress,address:C.j.getPlainAddress(r.caipAddress),isConnected:!!r.caipAddress,status:r.status,embeddedWalletInfo:t?{user:r.user?{...r.user,username:I.M.getConnectedSocialUsername()}:void 0,authProvider:r.socialProvider||"email",accountType:r.preferredAccountTypes?.[e||i],isSmartAccountDeployed:!!r.smartAccountDeployed}:void 0}}subscribeAccount(e,t){let r=()=>{let r=this.getAccount(t);r&&e(r)};t?E.R.subscribeChainProp("accountState",r,t):E.R.subscribe(r),f.ConnectorController.subscribe(r)}subscribeNetwork(e){return E.R.subscribe(({activeCaipNetwork:t})=>{e({caipNetwork:t,chainId:t?.id,caipNetworkId:t?.caipNetworkId})})}subscribeWalletInfo(e){return v.AccountController.subscribeKey("connectedWalletInfo",e)}subscribeShouldUpdateToAddress(e){v.AccountController.subscribeKey("shouldUpdateToAddress",e)}subscribeCaipNetworkChange(e){E.R.subscribeKey("activeCaipNetwork",e)}getState(){return w.I.state}subscribeState(e){return w.I.subscribe(e)}showErrorMessage(e){rQ.SnackController.showError(e)}showSuccessMessage(e){rQ.SnackController.showSuccess(e)}getEvent(){return{...m.X.state}}subscribeEvents(e){return m.X.subscribe(e)}replace(e){r0.RouterController.replace(e)}redirect(e){r0.RouterController.push(e)}popTransactionStack(e){r0.RouterController.popTransactionStack(e)}isOpen(){return rY.I.state.open}isTransactionStackEmpty(){return 0===r0.RouterController.state.transactionStack.length}isTransactionShouldReplaceView(){return r0.RouterController.state.transactionStack[r0.RouterController.state.transactionStack.length-1]?.replace}static getInstance(){return this.instance}updateFeatures(e){_.OptionsController.setFeatures(e)}updateOptions(e){let t={..._.OptionsController.state||{},...e};_.OptionsController.setOptions(t)}setConnectMethodsOrder(e){_.OptionsController.setConnectMethodsOrder(e)}setWalletFeaturesOrder(e){_.OptionsController.setWalletFeaturesOrder(e)}setCollapseWallets(e){_.OptionsController.setCollapseWallets(e)}setSocialsOrder(e){_.OptionsController.setSocialsOrder(e)}getConnectMethodsOrder(){return r1.J.getConnectOrderMethod(_.OptionsController.state.features,f.ConnectorController.getConnectors())}addNetwork(e,t){if(this.chainAdapters&&!this.chainAdapters[e])throw Error(`Adapter for namespace ${e} doesn't exist`);let r=this.extendCaipNetwork(t,this.options);this.getCaipNetworks().find(e=>e.id===r.id)||E.R.addNetwork(r)}removeNetwork(e,t){if(this.chainAdapters&&!this.chainAdapters[e])throw Error(`Adapter for namespace ${e} doesn't exist`);this.getCaipNetworks().find(e=>e.id===t)&&E.R.removeNetwork(e,t)}}let nE=!1;class n_ extends nv{setupAuthConnectorListeners(e){e.onRpcRequest(t=>{M.$.checkIfRequestExists(t)?M.$.checkIfRequestIsSafe(t)||this.handleUnsafeRPCRequest():(this.open(),console.error(U.y_.RPC_METHOD_NOT_ALLOWED_MESSAGE,{method:t.method}),setTimeout(()=>{this.showErrorMessage(U.y_.RPC_METHOD_NOT_ALLOWED_UI_MESSAGE)},300),e.rejectRpcRequests())}),e.onRpcError(()=>{this.isOpen()&&(this.isTransactionStackEmpty()?this.close():this.popTransactionStack(!0))}),e.onRpcSuccess((e,t)=>{let r=M.$.checkIfRequestIsSafe(t),i=v.AccountController.state.address,n=E.R.state.activeCaipNetwork;!r&&(this.isTransactionStackEmpty()?this.close():this.popTransactionStack(),i&&n?.id&&this.updateNativeBalance(i,n.id,n.chainNamespace))}),e.onNotConnected(()=>{let e=E.R.state.activeChain;f.ConnectorController.getConnectorId(e)===d.b.CONNECTOR_ID.AUTH&&(this.setCaipAddress(void 0,e),this.setLoading(!1,e))}),e.onConnect(async t=>{let r=E.R.state.activeChain,i=r===d.b.CHAIN.EVM?`eip155:${t.chainId}:${t.address}`:`${t.chainId}:${t.address}`,n=t.preferredAccountType||v.AccountController.state.preferredAccountTypes?.[r]||_.OptionsController.state.defaultAccountTypes[r];N.g.isLowerCaseMatch(t.address,v.AccountController.state.address)||this.syncIdentity({address:t.address,chainId:t.chainId,chainNamespace:r}),this.setCaipAddress(i,r),this.setUser({...v.AccountController.state.user||{},...t},r),this.setSmartAccountDeployed(!!t.smartAccountDeployed,r),this.setPreferredAccountType(n,r);let s=t.accounts?.map(e=>C.j.createAccount(r,e.address,e.type||v.AccountController.state.preferredAccountTypes?.[r]||_.OptionsController.state.defaultAccountTypes[r]));this.setAllAccounts(s||[C.j.createAccount(r,t.address,t.preferredAccountType||n)],r),await e.getSmartAccountEnabledNetworks(),this.setLoading(!1,r)}),e.onSocialConnected(({userName:e})=>{this.setUser({...v.AccountController.state.user||{},username:e},E.R.state.activeChain)}),e.onGetSmartAccountEnabledNetworks(e=>{this.setSmartAccountEnabledNetworks(e,E.R.state.activeChain)}),e.onSetPreferredAccount(({address:e,type:t})=>{e&&this.setPreferredAccountType(t,E.R.state.activeChain)})}async syncAuthConnector(e,t){let r=d.b.AUTH_CONNECTOR_SUPPORTED_CHAINS.includes(t);if(!r)return;this.setLoading(!0,t);let i=e.getLoginEmailUsed();this.setLoading(i,t),i&&this.setStatus("connecting",t);let n=e.getEmail(),s=e.getUsername();this.setUser({...v.AccountController.state?.user||{},username:s,email:n},E.R.state.activeChain),this.setupAuthConnectorListeners(e);let{isConnected:o}=await e.isConnected(),a=A.ThemeController.getSnapshot(),c=_.OptionsController.getSnapshot();e.syncDappData({metadata:c.metadata,sdkVersion:c.sdkVersion,projectId:c.projectId,sdkType:c.sdkType}),e.syncTheme({themeMode:a.themeMode,themeVariables:a.themeVariables,w3mThemeVariables:(0,p.t)(a.themeVariables,a.themeMode)}),t&&r&&(o&&this.connectionControllerClient?.connectExternal?(await this.connectionControllerClient?.connectExternal({id:d.b.CONNECTOR_ID.AUTH,info:{name:d.b.CONNECTOR_ID.AUTH},type:O.b.CONNECTOR_TYPE_AUTH,provider:e,chainId:E.R.state.activeCaipNetwork?.id,chain:t}),this.setStatus("connected",t)):f.ConnectorController.getConnectorId(t)===d.b.CONNECTOR_ID.AUTH&&(this.setStatus("disconnected",t),I.M.removeConnectedNamespace(t))),this.setLoading(!1,t)}async checkExistingTelegramSocialConnection(e){try{if(!C.j.isTelegram())return;let t=I.M.getTelegramSocialProvider();if(!t||"undefined"==typeof window||"undefined"==typeof document)return;let r=new URL(window.location.href).searchParams.get("result_uri");if(!r)return;v.AccountController.setSocialProvider(t,e),await this.authProvider?.init();let i=f.ConnectorController.getAuthConnector();t&&i&&(this.setLoading(!0,e),await i.provider.connectSocial(r),await g.ConnectionController.connectExternal(i,i.chain),I.M.setConnectedSocialProvider(t),I.M.removeTelegramSocialProvider(),m.X.sendEvent({type:"track",event:"SOCIAL_LOGIN_SUCCESS",properties:{provider:t}}))}catch(t){this.setLoading(!1,e),console.error("checkExistingSTelegramocialConnection error",t)}try{let e=new URL(window.location.href);e.searchParams.delete("result_uri"),window.history.replaceState({},document.title,e.toString())}catch(e){console.error("tma social login failed",e)}}createAuthProvider(e){if(!d.b.AUTH_CONNECTOR_SUPPORTED_CHAINS.includes(e))return;let t=this.options?.features?.email===void 0?y.bq.DEFAULT_FEATURES.email:this.options?.features?.email,r=this.options?.features?.socials?this.options?.features?.socials?.length>0:y.bq.DEFAULT_FEATURES.socials;!this.authProvider&&this.options?.projectId&&(t||r)&&(this.authProvider=rW.getInstance({projectId:this.options.projectId,enableLogger:this.options.enableAuthLogger,chainId:this.getCaipNetwork(e)?.caipNetworkId,onTimeout:()=>{S.AlertController.open(x.j.ALERT_ERRORS.SOCIALS_TIMEOUT,"error")}}),w.I.subscribeOpen(e=>{!e&&this.isTransactionStackEmpty()&&this.authProvider?.rejectRpcRequests()}),e===d.b.CHAIN.EVM&&v.AccountController.state.preferredAccountTypes?.eip155&&this.authProvider.setPreferredAccount(v.AccountController.state.preferredAccountTypes?.eip155),this.syncAuthConnector(this.authProvider,e),this.checkExistingTelegramSocialConnection(e))}createAuthProviderForAdapter(e){this.createAuthProvider(e),this.authProvider&&this.chainAdapters?.[e]?.setAuthProvider?.(this.authProvider)}initControllers(e){super.initControllers(e),this.options.excludeWalletIds&&b.ApiController.initializeExcludedWallets({ids:this.options.excludeWalletIds})}async switchCaipNetwork(e){if(!e)return;let t=E.R.state.activeChain,r=e.chainNamespace,i=this.getAddressByChainNamespace(e.chainNamespace);if(e.chainNamespace===E.R.state.activeChain&&i){let t=this.getAdapter(r),i=D.getProvider(r),n=D.getProviderId(r);await t?.switchNetwork({caipNetwork:e,provider:i,providerType:n}),this.setCaipNetwork(e)}else{let n=D.getProviderId(t)===O.b.CONNECTOR_TYPE_AUTH,s=D.getProviderId(r),o=s===O.b.CONNECTOR_TYPE_AUTH,a=d.b.AUTH_CONNECTOR_SUPPORTED_CHAINS.includes(r);if((n||o)&&a)try{E.R.state.activeChain=e.chainNamespace,await this.connectionControllerClient?.connectExternal?.({id:d.b.CONNECTOR_ID.AUTH,provider:this.authProvider,chain:r,chainId:e.id,type:O.b.CONNECTOR_TYPE_AUTH,caipNetwork:e}),this.setCaipNetwork(e)}catch(i){let t=this.getAdapter(r);await t?.switchNetwork({caipNetwork:e,provider:this.authProvider,providerType:s})}else s===O.b.CONNECTOR_TYPE_WALLET_CONNECT?(this.setCaipNetwork(e),this.syncWalletConnectAccount()):(this.setCaipNetwork(e),i&&this.syncAccount({address:i,chainId:e.id,chainNamespace:r}))}}async initChainAdapter(e){await super.initChainAdapter(e),this.createAuthProviderForAdapter(e)}async syncIdentity({address:e,chainId:t,chainNamespace:r}){let i=`${r}:${t}`,n=this.caipNetworks?.find(e=>e.caipNetworkId===i);if(r!==d.b.CHAIN.EVM||n?.testnet){this.setProfileName(null,r),this.setProfileImage(null,r);return}try{let{name:n,avatar:s}=await this.fetchIdentity({address:e,caipNetworkId:i});if(this.setProfileName(n,r),this.setProfileImage(s,r),!n){let i=this.getAdapter(r),n=await i?.getProfile({address:e,chainId:Number(t)});n?.profileName?(this.setProfileName(n.profileName,r),n.profileImage&&this.setProfileImage(n.profileImage,r)):(await this.syncReownName(e,r),this.setProfileImage(null,r))}}catch{await this.syncReownName(e,r),1!==t&&this.setProfileImage(null,r)}}syncConnectedWalletInfo(e){let t=D.getProviderId(e);if(t===O.b.CONNECTOR_TYPE_AUTH){let r=this.authProvider;if(r){let i=I.M.getConnectedSocialProvider()??"email",n=r.getEmail()??r.getUsername();this.setConnectedWalletInfo({name:t,identifier:n,social:i},e)}}else super.syncConnectedWalletInfo(e)}
885async injectModalUi(){if(!nE&&C.j.isClient()){let e={...y.bq.DEFAULT_FEATURES,...this.options.features},t=[];if(e&&((e.email||e.socials&&e.socials.length)&&t.push(Promise.all([r.e(172),r.e(7648),r.e(541)]).then(r.bind(r,541))),e.email&&t.push(Promise.all([r.e(172),r.e(7648),r.e(9569)]).then(r.bind(r,59569))),e.socials&&t.push(Promise.all([r.e(172),r.e(7769),r.e(790),r.e(8523)]).then(r.bind(r,65087))),e.swaps&&t.push(Promise.all([r.e(172),r.e(7648),r.e(8094),r.e(2073)]).then(r.bind(r,82073))),e.send&&t.push(Promise.all([r.e(172),r.e(7648),r.e(8094),r.e(5983)]).then(r.bind(r,55983))),e.receive&&t.push(Promise.all([r.e(172),r.e(7769),r.e(7222)]).then(r.bind(r,87222))),e.onramp&&t.push(Promise.all([r.e(172),r.e(7648),r.e(790),r.e(7178),r.e(6541)]).then(r.bind(r,86541))),e.history&&t.push(Promise.all([r.e(172),r.e(5742),r.e(524)]).then(r.bind(r,20692)))),await Promise.all([...t,Promise.all([r.e(172),r.e(7648),r.e(7769),r.e(790),r.e(7178),r.e(5742),r.e(8655),r.e(103)]).then(r.bind(r,103)),Promise.all([r.e(172),r.e(8655),r.e(1468)]).then(r.bind(r,53555))]),!document.querySelector("w3m-modal")){let e=document.createElement("w3m-modal");_.OptionsController.state.disableAppend||_.OptionsController.state.enableEmbedded||document.body.insertAdjacentElement("beforeend",e)}nE=!0}}}},18535:function(e,t,r){"use strict";r.d(t,{z:function(){return l}}),r(13885);var i=r(72647),n=r(50035),s=r(68619),o=r(9331),a=r(998),c=r(39831);class l{constructor({provider:e,namespace:t}){this.id=i.b.CONNECTOR_ID.WALLET_CONNECT,this.name=a.C.ConnectorNamesMap[i.b.CONNECTOR_ID.WALLET_CONNECT],this.type="WALLET_CONNECT",this.imageId=a.C.ConnectorImageIds[i.b.CONNECTOR_ID.WALLET_CONNECT],this.getCaipNetworks=n.R.getCaipNetworks.bind(n.R),this.caipNetworks=this.getCaipNetworks(),this.provider=e,this.chain=t}get chains(){return this.getCaipNetworks()}async connectWalletConnect(){if(!await this.authenticate()){let e=this.getCaipNetworks(),t=s.OptionsController.state.universalProviderConfigOverride,r=c.sQ.createNamespaces(e,t);await this.provider.connect({optionalNamespaces:r})}return{clientId:await this.provider.client.core.crypto.getClientId(),session:this.provider.session}}async disconnect(){await this.provider.disconnect()}async authenticate(){let e=this.chains.map(e=>e.caipNetworkId);return o.w.universalProviderAuthenticate({universalProvider:this.provider,chains:e,methods:u})}}let u=["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_getCallsStatus","wallet_sendCalls","wallet_getCapabilities","wallet_grantPermissions","wallet_revokePermissions","wallet_getAssets"]},27854:function(e,t,r){"use strict";function i(e){return{formatters:void 0,fees:void 0,serializers:void 0,...e}}r.d(t,{Zjg:function(){return n},ol5:function(){return s},Q6N:function(){return o}});let n=i({id:"5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",name:"Solana",network:"solana-mainnet",nativeCurrency:{name:"Solana",symbol:"SOL",decimals:9},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}},blockExplorers:{default:{name:"Solscan",url:"https://solscan.io"}},testnet:!1,chainNamespace:"solana",caipNetworkId:"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",deprecatedCaipNetworkId:"solana:4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ"}),s=i({id:"EtWTRABZaYq6iMfeYKouRu166VU2xqa1",name:"Solana Devnet",network:"solana-devnet",nativeCurrency:{name:"Solana",symbol:"SOL",decimals:9},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}},blockExplorers:{default:{name:"Solscan",url:"https://solscan.io"}},testnet:!0,chainNamespace:"solana",caipNetworkId:"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1",deprecatedCaipNetworkId:"solana:8E9rvCKLFQia2Y35HXjjpWzj8weVo44K"}),o=i({id:"4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z",name:"Solana Testnet",network:"solana-testnet",nativeCurrency:{name:"Solana",symbol:"SOL",decimals:9},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}},blockExplorers:{default:{name:"Solscan",url:"https://solscan.io"}},testnet:!0,chainNamespace:"solana",caipNetworkId:"solana:4uhcVJyU9pJkvQyS88uRDiswHXSCkY3z"});i({id:"000000000019d6689c085ae165831e93",caipNetworkId:"bip122:000000000019d6689c085ae165831e93",chainNamespace:"bip122",name:"Bitcoin",nativeCurrency:{name:"Bitcoin",symbol:"BTC",decimals:8},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}}}),i({id:"000000000933ea01ad0ee984209779ba",caipNetworkId:"bip122:000000000933ea01ad0ee984209779ba",chainNamespace:"bip122",name:"Bitcoin Testnet",n
885ativeCurrency:{name:"Bitcoin",symbol:"BTC",decimals:8},rpcUrls:{default:{http:["https://rpc.walletconnect.org/v1"]}},testnet:!0})},84135:function(e,t,r){"use strict";r.d(t,{T:function(){return i}});let i={ERROR_CODE_UNRECOGNIZED_CHAIN_ID:4902,ERROR_CODE_DEFAULT:5e3,ERROR_INVALID_CHAIN_ID:32603}},39831:function(e,t,r){"use strict";r.d(t,{sQ:function(){return o}}),r(84135);var i=r(85786),n=r(27854);let s={solana:["solana_signMessage","solana_signTransaction","solana_requestAccounts","solana_getAccounts","solana_signAllTransactions","solana_signAndSendTransaction"],eip155:["eth_accounts","eth_requestAccounts","eth_sendRawTransaction","eth_sign","eth_signTransaction","eth_signTypedData","eth_signTypedData_v3","eth_signTypedData_v4","eth_sendTransaction","personal_sign","wallet_switchEthereumChain","wallet_addEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode","wallet_getCallsStatus","wallet_showCallsStatus","wallet_sendCalls","wallet_getCapabilities","wallet_grantPermissions","wallet_revokePermissions","wallet_getAssets"],bip122:["sendTransfer","signMessage","signPsbt","getAccountAddresses"]},o={getMethodsByChainNamespace:e=>s[e]||[],createDefaultNamespace(e){return{methods:this.getMethodsByChainNamespace(e),events:["accountsChanged","chainChanged"],chains:[],rpcMap:{}}},applyNamespaceOverrides(e,t){if(!t)return{...e};let r={...e},i=new Set;if(t.methods&&Object.keys(t.methods).forEach(e=>i.add(e)),t.chains&&Object.keys(t.chains).forEach(e=>i.add(e)),t.events&&Object.keys(t.events).forEach(e=>i.add(e)),t.rpcMap&&Object.keys(t.rpcMap).forEach(e=>{let[t]=e.split(":");t&&i.add(t)}),i.forEach(e=>{r[e]||(r[e]=this.createDefaultNamespace(e))}),t.methods&&Object.entries(t.methods).forEach(([e,t])=>{r[e]&&(r[e].methods=t)}),t.chains&&Object.entries(t.chains).forEach(([e,t])=>{r[e]&&(r[e].chains=t)}),t.events&&Object.entries(t.events).forEach(([e,t])=>{r[e]&&(r[e].events=t)}),t.rpcMap){let e=new Set;Object.entries(t.rpcMap).forEach(([t,i])=>{let[n,s]=t.split(":");n&&s&&r[n]&&(r[n].rpcMap||(r[n].rpcMap={}),e.has(n)||(r[n].rpcMap={},e.add(n)),r[n].rpcMap[s]=i)})}return r},createNamespaces(e,t){let r=e.reduce((e,t)=>{let{id:r,chainNamespace:i,rpcUrls:s}=t,o=s.default.http[0];e[i]||(e[i]=this.createDefaultNamespace(i));let a=`${i}:${r}`,c=e[i];switch(c.chains.push(a),a){case n.Zjg.caipNetworkId:c.chains.push(n.Zjg.deprecatedCaipNetworkId);break;case n.ol5.caipNetworkId:c.chains.push(n.ol5.deprecatedCaipNetworkId)}return c?.rpcMap&&o&&(c.rpcMap[r]=o),e},{});return this.applyNamespaceOverrides(r,t)},resolveReownName:async e=>{let t=await i.a.resolveName(e),r=Object.values(t?.addresses)||[];return r[0]?.address||!1},getChainsFromNamespaces:(e={})=>Object.values(e).flatMap(e=>Array.from(new Set([...e.chains||[],...e.accounts.map(e=>{let[t,r]=e.split(":");return`${t}:${r}`})]))),isSessionEventData:e=>"object"==typeof e&&null!==e&&"id"in e&&"topic"in e&&"params"in e&&"object"==typeof e.params&&null!==e.params&&"chainId"in e.params&&"event"in e.params&&"object"==typeof e.params.event&&null!==e.params.event}},69028: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 i=r(82957);function n(e){if(!(e instanceof Uint8Array))throw TypeError("b must be a Uint8Array")}function s(e){return n(e),i.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 c extends o{isCount(){throw Error("ExternalLayout is abstract")}}class l extends c{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 h}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 h 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 d(e){let t=Math.floor(e/4294967296);return{hi32:t,lo32:e-4294967296*t}}function p(e,t){return 4294967296*e+t}class f extends o{constructor(e){super(8,e)}decode(e,t=0){let r=s(e),i=r.readUInt32LE(t);return p(r.readUInt32LE(t+4),i)}encode(e,t,r=0){let i=d(e),n=s(t);return n.writeUInt32LE(i.lo32,r),n.writeUInt32LE(i.hi32,r+4),8}}class g extends o{constructor(e){super(8,e)}decode(e,t=0){let r=s(e),i=r.readUInt32LE(t);return p(r.readInt32LE(t+4),i)}encode(e,t,r=0){let i=d(e),n=s(t);return n.writeUInt32LE(i.lo32,r),n.writeInt32LE(i.hi32,r+4),8}}class m extends o{constructor(e,t,r){if(!(e instanceof o))throw TypeError("elementLayout must be a Layout");if(!(t instanceof c&&t.isCount()||Number.isInteger(t)&&0<=t))throw TypeError("count must be non-negative integer or an unsigned integer ExternalLayout");let i=-1;t instanceof c||!(0<e.span)||(i=t*e.span),super(i,r),this.elementLayout=e,this.count=t}getSpan(e,t=0){if(0<=this.span)return this.span;let r=0,i=this.count;if(i instanceof c&&(i=i.decode(e,t)),0<this.elementLayout.span)r=i*this.elementLayout.span;else{let n=0;for(;n<i;)r+=this.elementLayout.getSpan(e,t+r),++n}return r}decode(e,t=0){let r=[],i=0,n=this.count;for(n instanceof c&&(n=n.decode(e,t));i<n;)r.push(this.elementLayout.decode(e,t)),t+=this.elementLayout.getSpan(e,t),i+=1;return r}encode(e,t,r=0){let i=this.elementLayout,n=e.reduce((e,n)=>e+i.encode(n,t,r+e),0);return this.count instanceof c&&this.count.encode(e.length,t,r),n}}class y extends o{constructor(e,t,r){if(!(Array.isArray(e)&&e.reduce((e,t)=>
885e&&t instanceof o,!0)))throw TypeError("fields must be array of Layout instances");for(let i of("boolean"==typeof t&&void 0===r&&(r=t,t=void 0),e))if(0>i.span&&void 0===i.property)throw Error("fields cannot contain unnamed variable-length layout");let i=-1;try{i=e.reduce((e,t)=>e+t.getSpan(),0)}catch(e){}super(i,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,i)=>{let n=i.getSpan(e,t);return t+=n,r+n},0)}catch(e){throw RangeError("indeterminate span")}return r}decode(e,t=0){n(e);let r=this.makeDestinationObject();for(let i of this.fields)if(void 0!==i.property&&(r[i.property]=i.decode(e,t)),t+=i.getSpan(e,t),this.decodePrefixes&&e.length===t)break;return r}encode(e,t,r=0){let i=r,n=0,s=0;for(let i of this.fields){let o=i.span;if(s=0<o?o:0,void 0!==i.property){let n=e[i.property];void 0!==n&&(s=i.encode(n,t,r),0>o&&(o=i.getSpan(t,r)))}n=r,r+=o}return n+s-i}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 w{constructor(e){this.property=e}decode(e,t){throw Error("UnionDiscriminator is abstract")}encode(e,t,r){throw Error("UnionDiscriminator is abstract")}}class b extends w{constructor(e,t){if(!(e instanceof c&&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 i;if(e instanceof u||e instanceof h)i=new b(new l(e));else if(e instanceof c&&e.isCount())i=new b(e);else if(e instanceof w)i=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 n=-1;t&&0<=(n=t.span)&&(e instanceof u||e instanceof h)&&(n+=i.layout.span),super(n,r),this.discriminator=i,this.usesPrefixDiscriminator=e instanceof u||e instanceof h,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 i=this.discriminator,n=i.decode(e,t),s=this.registry[n];if(void 0===s){let s=this.defaultLayout,o=0;this.usesPrefixDiscriminator&&(o=i.layout.span),(r=this.makeDestinationObject())[i.property]=n,r[s.property]=s.decode(e,t+o)}else r=s.decode(e,t);return r}encode(e,t,r=0){let i=this.getSourceVariant(e);if(void 0===i){let i=this.discriminator,n=this.defaultLayout,s=0;return this.usesPrefixDiscriminator&&(s=i.layout.span),i.encode(e[i.property],t,r),s+n.encode(e[n.property],t,r+s)}return i.encode(e,t,r)}addVariant(e,t,r){let i=new E(this,e,t,r);return this.registry[e]=i,i}getVariant(e,t=0){let r;return e instanceof Uint8Array?r=this.discriminator.decode(e,t):r=e,this.registry[r]}}
885class E extends o{constructor(e,t,r,i){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===i&&(i=r,r=null),r){if(!(r instanceof o))throw TypeError("layout must be a Layout");if(null!==e.defaultLayout&&0<=r.span&&r.span>e.defaultLayout.span)throw Error("variant span exceeds span of containing union");if("string"!=typeof i)throw TypeError("variant must have a String property")}let n=e.span;0>e.span&&0<=(n=r?r.span:0)&&e.usesPrefixDiscriminator&&(n+=e.discriminator.layout.span),super(n,i),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 i=0;return this.layout&&(i=this.layout.getSpan(e,t+r)),r+i}decode(e,t=0){let r=this.makeDestinationObject();if(this!==this.union.getVariant(e,t))throw Error("variant mismatch");let i=0;return this.union.usesPrefixDiscriminator&&(i=this.union.discriminator.layout.span),this.layout?r[this.property]=this.layout.decode(e,t+i):this.property?r[this.property]=!0:this.union.usesPrefixDiscriminator&&(r[this.union.discriminator.property]=this.variant),r}encode(e,t,r=0){let i=0;if(this.union.usesPrefixDiscriminator&&(i=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 n=i;if(this.layout&&(this.layout.encode(e[this.property],t,r+i),n+=this.layout.getSpan(t,r+i),0<=this.union.span&&n>this.union.span))throw Error("encoded variant overruns containing union");return n}fromArray(e){if(this.layout)return this.layout.fromArray(e)}}function _(e){return 0>e&&(e+=4294967296),e}class C extends o{constructor(e,t,r){if(!(e instanceof u||e instanceof h))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 i=0;this._packedSetValue=function(e){return i=_(e),this},this._packedGetValue=function(){return i}}decode(e,t=0){let r=this.makeDestinationObject(),i=this.word.decode(e,t);for(let t of(this._packedSetValue(i),this.fields))void 0!==t.property&&(r[t.property]=t.decode(e));return r}encode(e,t,r=0){let i=this.word.decode(t,r);for(let t of(this._packedSetValue(i),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 I(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 C))throw TypeError("container must be a BitStructure");if(!Number.isInteger(t)||0>=t)throw TypeError("bits must be positive integer");let i=8*e.span,n=e.fields.reduce((e,t)=>e+t.bits,0);if(t+n>i)throw Error("bits too long for span remainder ("+(i-n)+" of "+i+" remain)");this.container=e,this.bits=t,this.valueMask=(1<<t)-1,32===t&&(this.valueMask=4294967295),this.start=n,this.container.msb&&(this.start=i-n-t),this.wordMask=_(this.valueMask<<this.start),this.property=r}decode(e,t){return _(this.container._packedGetValue()&this.wordMask)>>>this.start}encode(e){if("number"!=typeof e||!Number.isInteger(e)||e!==_(e&this.valueMask))throw TypeError(a("BitField.encode",this)+" value must be integer not exceeding "+this.valueMask);let t=this.container._packedGetValue(),r=_(e<<this.start);this.container._packedSetValue(_(t&~this.wordMask)|r)}}class I 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 S extends o{constructor(e,t){if(!(e instanceof c&&e.isCount()||Number.isInteger(e)&&0<=e))throw TypeError("length must be positive integer or an unsigned integer ExternalLayout");let r=-1;e instanceof c||(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 i=this.length;if(this.length instanceof c&&(i=e.length),!(e instanceof Uint8Array&&i===e.length))throw TypeError(a("Blob.encode",this)+" requires (length "+i+") Uint8Array as src");if(r+i>t.length)throw RangeError("encoding overruns Uint8Array");let n=s(e);return s(t).write(n.toString("hex"),r,i,"hex"),this.length instanceof c&&this.length.encode(i,t,r),i}}t.cv=(e,t,r)=>new l(e,t,r),t.u8=e=>new u(1,e),t.KB=e=>
885new u(2,e),t.Jq=e=>new u(4,e),t._O=e=>new f(e),t.gM=e=>new g(e),t.n_=(e,t,r)=>new y(e,t,r),t.A9=(e,t,r)=>new m(e,t,r),t.Ik=(e,t)=>new S(e,t)},80211:function(e,t,r){"use strict";var i=r(73306).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 n=0;n<e.length;n++){var s=e.charAt(n),o=s.charCodeAt(0);if(255!==t[o])throw TypeError(s+" is ambiguous");t[o]=n}var a=e.length,c=e.charAt(0),l=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function h(e){if("string"!=typeof e)throw TypeError("Expected String");if(0===e.length)return i.alloc(0);for(var r=0,n=0,s=0;e[r]===c;)n++,r++;for(var o=(e.length-r)*l+1>>>0,u=new Uint8Array(o);r<e.length;){var h=e.charCodeAt(r);if(h>255)return;var d=t[h];if(255===d)return;for(var p=0,f=o-1;(0!==d||p<s)&&-1!==f;f--,p++)d+=a*u[f]>>>0,u[f]=d%256>>>0,d=d/256>>>0;if(0!==d)throw Error("Non-zero carry");s=p,r++}for(var g=o-s;g!==o&&0===u[g];)g++;var m=i.allocUnsafe(n+(o-g));m.fill(0,0,n);for(var y=n;g!==o;)m[y++]=u[g++];return m}return{encode:function(t){if((Array.isArray(t)||t instanceof Uint8Array)&&(t=i.from(t)),!i.isBuffer(t))throw TypeError("Expected Buffer");if(0===t.length)return"";for(var r=0,n=0,s=0,o=t.length;s!==o&&0===t[s];)s++,r++;for(var l=(o-s)*u+1>>>0,h=new Uint8Array(l);s!==o;){for(var d=t[s],p=0,f=l-1;(0!==d||p<n)&&-1!==f;f--,p++)d+=256*h[f]>>>0,h[f]=d%a>>>0,d=d/a>>>0;if(0!==d)throw Error("Non-zero carry");n=p,s++}for(var g=l-n;g!==l&&0===h[g];)g++;for(var m=c.repeat(r);g<l;++g)m+=e.charAt(h[g]);return m},decodeUnsafe:h,decode:function(e){var t=h(e);if(t)return t;throw Error("Non-base"+a+" character")}}}},7524:function(e,t,r){var i=r(80211);e.exports=i("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},12238:function(e,t,r){"use strict";function i(){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 n(){let e=i();return e.subtle||e.webkitSubtle}Object.defineProperty(t,"__esModule",{value:!0}),t.isBrowserCryptoAvailable=t.getSubtleCrypto=t.getBrowerCrypto=void 0,t.getBrowerCrypto=i,t.getSubtleCrypto=n,t.isBrowserCryptoAvailable=function(){return!!i()&&!!n()}},33531:function(e,t,r){"use strict";var i=r(25566);function n(){return"undefined"==typeof document&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product}function s(){return void 0!==i&&void 0!==i.versions&&void 0!==i.versions.node}Object.defineProperty(t,"__esModule",{value:!0}),t.isBrowser=t.isNode=t.isReactNative=void 0,t.isReactNative=n,t.isNode=s,t.isBrowser=function(){return!n()&&!s()}},13303:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let i=r(33509);i.__exportStar(r(12238),t),i.__exportStar(r(33531),t)},16854:function(e){"use strict";e.exports=function(){throw Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},15133:function(e,t,r){"use strict";r.d(t,{Ep:function(){return A},Fd:function(){return C},Rt:function(){return I},gw:function(){return n.a},jI:function(){return _}});var i=r(94299),n=r.n(i),s=r(80577);let o={level:"info"},a="custom_context";class c{constructor(e){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 l{constructor(e){this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=e,this.sizeInBytes=0}append(e){let t=new c(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}}}}}class u{constructor(e,t=1024e3){this.level=e??"error",this.levelValue=i.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=t,this.logs=new l(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,t){t===i.levels.values.error?console.error(e):t===i.levels.values.warn?console.warn(e):t===i.levels.values.debug?console.debug(e):t===i.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append((0,s.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 l(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){let t=this.getLogArray();return t.push((0,s.u)({extraMetadata:e})),new Blob(t,{type:"application/json"})}}class h{constructor(e,t=1024e3){this.baseChunkLogger=new u(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)}}class d{constructor(e,t=1024e3){this.baseChunkLogger=new u(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 p=Object.defineProperty,f=Object.defineProperties,g=Object.getOwnPropertyDescriptors,m=Object.getOwnPropertySymbols,y=Object.prototype.hasOwnProperty,w=Object.prototype.propertyIsEnumerable,b=(e,t,r)=>t in e?p(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,v=(e,t)=>
885{for(var r in t||(t={}))y.call(t,r)&&b(e,r,t[r]);if(m)for(var r of m(t))w.call(t,r)&&b(e,r,t[r]);return e},E=(e,t)=>f(e,g(t));function _(e){return E(v({},e),{level:e?.level||o.level})}function C(e,t=a){return typeof e.bindings>"u"?function(e,t=a){return e[t]||""}(e,t):e.bindings().context||""}function A(e,t,r=a){let i=function(e,t,r=a){let i=C(e,r);return i.trim()?`${i}/${t}`:t}(e,t,r);return function(e,t,r=a){return e[r]=t,e}(e.child({context:i}),i,r)}function I(e){return"u">typeof e.loggerOverride&&"string"!=typeof e.loggerOverride?{logger:e.loggerOverride,chunkLoggerController:null}:"u">typeof window?function(e){var t,r;let i=new h(null==(t=e.opts)?void 0:t.level,e.maxSizeInBytes);return{logger:n()(E(v({},e.opts),{level:"trace",browser:E(v({},null==(r=e.opts)?void 0:r.browser),{write:e=>i.write(e)})})),chunkLoggerController:i}}(e):function(e){var t;let r=new d(null==(t=e.opts)?void 0:t.level,e.maxSizeInBytes);return{logger:n()(E(v({},e.opts),{level:"trace"}),r),chunkLoggerController:r}}(e)}},80577:function(e,t,r){"use strict";r.d(t,{D:function(){return s},u:function(){return o}});let i=e=>JSON.stringify(e,(e,t)=>"bigint"==typeof t?t.toString()+"n":t),n=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 n(e)}catch(t){return e}}function o(e){return"string"==typeof e?e:i(e)||""}},70213:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let i=r(33509);i.__exportStar(r(12658),t),i.__exportStar(r(75127),t)},12658: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},75127: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_WEEKS=4*t.ONE_WEEK,t.ONE_YEAR=365*t.ONE_DAY},40537:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let i=r(33509);i.__exportStar(r(78627),t),i.__exportStar(r(59854),t),i.__exportStar(r(3205),t),i.__exportStar(r(70213),t)},3205:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),r(33509).__exportStar(r(71146),t)},71146:function(e,t){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.IWatch=void 0;class r{}t.IWatch=r},68353:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0}),t.fromMiliseconds=t.toMiliseconds=void 0;let i=r(70213);t.toMiliseconds=function(e){return e*i.ONE_THOUSAND},t.fromMiliseconds=function(e){return Math.floor(e/i.ONE_THOUSAND)}},86029: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)})}},78627:function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});let i=r(33509);i.__exportStar(r(86029),t),i.__exportStar(r(68353),t)},59854:function(e,t){"use strict";
885Object.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},13885:function(e,t,r){"use strict";let i,n,s;r.d(t,{Z:function(){return bp}});var o,a,c,l,u,h,d={};r.r(d),r.d(d,{identity:function(){return is}});var p={};r.r(p),r.d(p,{base2:function(){return io}});var f={};r.r(f),r.d(f,{base8:function(){return ia}});var g={};r.r(g),r.d(g,{base10:function(){return ic}});var m={};r.r(m),r.d(m,{base16:function(){return il},base16upper:function(){return iu}});var y={};r.r(y),r.d(y,{base32:function(){return ih},base32hex:function(){return im},base32hexpad:function(){return iw},base32hexpadupper:function(){return ib},base32hexupper:function(){return iy},base32pad:function(){return ip},base32padupper:function(){return ig},base32upper:function(){return id},base32z:function(){return iv}});var w={};r.r(w),r.d(w,{base36:function(){return iE},base36upper:function(){return i_}});var b={};r.r(b),r.d(b,{base58btc:function(){return iC},base58flickr:function(){return iA}});var v={};r.r(v),r.d(v,{base64:function(){return iI},base64pad:function(){return iS},base64url:function(){return iN},base64urlpad:function(){return iO}});var E={};r.r(E),r.d(E,{base256emoji:function(){return iP}});var _={};r.r(_),r.d(_,{sha256:function(){return iW},sha512:function(){return iV}});var C={};r.r(C),r.d(C,{identity:function(){return iK}});var A={};r.r(A),r.d(A,{code:function(){return iG},decode:function(){return iJ},encode:function(){return iY},name:function(){return iZ}});var I={};r.r(I),r.d(I,{code:function(){return i1},decode:function(){return i3},encode:function(){return i2},name:function(){return i0}});var S=r(55445),N=r.n(S),O=r(40537);class x{}class T extends x{constructor(e){super()}}let R=O.FIVE_SECONDS,P="heartbeat_pulse";class k extends T{constructor(e){super(e),this.events=new S.EventEmitter,this.interval=R,this.interval=e?.interval||R}static async init(e){let t=new k(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,O.toMiliseconds)(this.interval))}pulse(){this.events.emit(P)}}let D=/"(?:_|\\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*:/,M=/"(?: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*:/,U=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function L(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 B(e,t={}){if("string"!=typeof e)return e;let r=e.trim();if('"'===e[0]&&e.endsWith('"')&&!e.includes("\\"))return r.slice(1,-1);if(r.length<=9){let e=r.toLowerCase();if("true"===e)return!0;if("false"===e)return!1;if("undefined"===e)return;if("null"===e)return null;if("nan"===e)return Number.NaN;if("infinity"===e)return Number.POSITIVE_INFINITY;if("-infinity"===e)return Number.NEGATIVE_INFINITY}if(!U.test(e)){if(t.strict)throw SyntaxError("[destr] Invalid JSON");return e}try{if(D.test(e)||M.test(e)){if(t.strict)throw Error("[destr] Possible prototype pollution");return JSON.parse(e,L)}return JSON.parse(e)}catch(r){if(t.strict)throw r;return e}}var j=r(82957).Buffer;function $(e,...t){try{var r;return(r=e(...t))&&"function"==typeof r.then?r:Promise.resolve(r)}catch(e){return Promise.reject(e)}}function F(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 F(e.toJSON());throw Error("[unstorage] Cannot stringify value!")}let q="base64:";function z(e){return e&&e.split("?")[0]?.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,"")||""}function H(e){return(e=z(e))?e+":":""}let W=()=>{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 V(e,t,r){return e.watch?e.watch((e,i)=>t(e,r+i)):()=>{}}async function K(e){"function"==typeof e.dispose&&await $(e.dispose)}function Z(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=indexedDB.open(e);r.onupgradeneeded=()=>r.result.createObjectStore(t);let i=Z(r);return(e,r)=>i.then(i=>r(i.transaction(t,e).objectStore(t)))}
885function Y(){return i||(i=G("keyval-store","keyval")),i}function J(e,t=Y()){return t("readonly",t=>Z(t.get(e)))}var X=r(80577),Q=(e={})=>{let t;let r=e.base&&e.base.length>0?`${e.base}:`:"",i=e=>r+e;return e.dbName&&e.storeName&&(t=G(e.dbName,e.storeName)),{name:"idb-keyval",options:e,hasItem:async e=>!(typeof await J(i(e),t)>"u"),getItem:async e=>await J(i(e),t)??null,setItem:(e,r)=>(function(e,t,r=Y()){return r("readwrite",r=>(r.put(t,e),Z(r.transaction)))})(i(e),r,t),removeItem:e=>(function(e,t=Y()){return t("readwrite",t=>(t.delete(e),Z(t.transaction)))})(i(e),t),getKeys:()=>(function(e=Y()){return e("readonly",e=>{var t;if(e.getAllKeys)return Z(e.getAllKeys());let r=[];return(t=e=>r.push(e.key),e.openCursor().onsuccess=function(){this.result&&(t(this.result),this.result.continue())},Z(e.transaction)).then(()=>r)})})(t),clear:()=>(function(e=Y()){return e("readwrite",e=>(e.clear(),Z(e.transaction)))})(t)}};class ee{constructor(){this.indexedDb=function(e={}){let t={mounts:{"":e.driver||W()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},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[""]}},i=(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]})),n=(e,r)=>{if(t.watching)for(let i of(r=z(r),t.watchListeners))i(e,r)},s=async()=>{if(!t.watching)for(let e in t.watching=!0,t.mounts)t.unwatch[e]=await V(t.mounts[e],n,e)},o=async()=>{if(t.watching){for(let e in t.unwatch)await t.unwatch[e]();t.unwatch={},t.watching=!1}},a=(e,t,i)=>{let n=new Map,s=e=>{let t=n.get(e.base);return t||(t={driver:e.driver,base:e.base,items:[]},n.set(e.base,t)),t};for(let i of e){let e="string"==typeof i,n=z(e?i:i.key),o=e?void 0:i.value,a=e||!i.options?t:{...t,...i.options},c=r(n);s(c).items.push({key:n,value:o,relativeKey:c.relativeKey,options:a})}return Promise.all([...n.values()].map(e=>i(e))).then(e=>e.flat())},c={hasItem(e,t={}){let{relativeKey:i,driver:n}=r(e=z(e));return $(n.hasItem,i,t)},getItem(e,t={}){let{relativeKey:i,driver:n}=r(e=z(e));return $(n.getItem,i,t).then(e=>B(e))},getItems:(e,t={})=>a(e,t,e=>e.driver.getItems?$(e.driver.getItems,e.items.map(e=>({key:e.relativeKey,options:e.options})),t).then(t=>t.map(t=>({key:function(...e){return z(e.join(":"))}(e.base,t.key),value:B(t.value)}))):Promise.all(e.items.map(t=>$(e.driver.getItem,t.relativeKey,t.options).then(e=>({key:t.key,value:B(e)}))))),getItemRaw(e,t={}){let{relativeKey:i,driver:n}=r(e=z(e));return n.getItemRaw?$(n.getItemRaw,i,t):$(n.getItem,i,t).then(e=>{var t;return"string"==typeof e&&e.startsWith(q)?(t=e.slice(q.length),globalThis.Buffer?j.from(t,"base64"):Uint8Array.from(globalThis.atob(t),e=>e.codePointAt(0))):e})},async setItem(e,t,i={}){if(void 0===t)return c.removeItem(e);let{relativeKey:s,driver:o}=r(e=z(e));o.setItem&&(await $(o.setItem,s,F(t),i),o.watch||n("update",e))},async setItems(e,t){await a(e,t,async e=>{if(e.driver.setItems)return $(e.driver.setItems,e.items.map(e=>({key:e.relativeKey,value:F(e.value),options:e.options})),t);e.driver.setItem&&await Promise.all(e.items.map(t=>$(e.driver.setItem,t.relativeKey,F(t.value),t.options)))})},async setItemRaw(e,t,i={}){if(void 0===t)return c.removeItem(e,i);let{relativeKey:s,driver:o}=r(e=z(e));if(o.setItemRaw)await $(o.setItemRaw,s,t,i);else{if(!o.setItem)return;await $(o.setItem,s,"string"==typeof t?t:q+(globalThis.Buffer?j.from(t).toString("base64"):globalThis.btoa(String.fromCodePoint(...t))),i)}o.watch||n("update",e)},async removeItem(e,t={}){"boolean"==typeof t&&(t={removeMeta:t});let{relativeKey:i,driver:s}=r(e=z(e));s.removeItem&&(await $(s.removeItem,i,t),(t.removeMeta||t.removeMata)&&await $(s.removeItem,i+"$",t),s.watch||n("remove",e))},async getMeta(e,t={}){"boolean"==typeof t&&(t={nativeOnly:t});let{relativeKey:i,driver:n}=r(e=z(e)),s=Object.create(null);if(n.getMeta&&Object.assign(s,await $(n.getMeta,i,t)),!t.nativeOnly){let e=await $(n.getItem,i+"$",t).then(e=>B(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(s,e))}return s},setMeta(e,t,r={}){return this.setItem(e+"$",t,r)},removeMeta(e,t={}){return this.removeItem(e+"$",t)},async getKeys(e,t={}){let r=i(e=H(e),!0),n=[],s=[],o=!0;for(let e of r){for(let r of(e.driver.flags?.maxDepth||(o=!1),await $(e.driver.getKeys,e.relativeBase,t))){let t=e.mountpoint+z
885(r);n.some(e=>t.startsWith(e))||s.push(t)}n=[e.mountpoint,...n.filter(t=>!t.startsWith(e.mountpoint))]}let a=void 0!==t.maxDepth&&!o;return s.filter(r=>{var i;return(!a||function(e,t){if(void 0===t)return!0;let r=0,i=e.indexOf(":");for(;i>-1;)r++,i=e.indexOf(":",i+1);return r<=t}(r,t.maxDepth))&&((i=e)?r.startsWith(i)&&"$"!==r[r.length-1]:"$"!==r[r.length-1])})},async clear(e,t={}){e=H(e),await Promise.all(i(e,!1).map(async e=>e.driver.clear?$(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=>K(e)))},watch:async e=>(await s(),t.watchListeners.push(e),async()=>{t.watchListeners=t.watchListeners.filter(t=>t!==e),0===t.watchListeners.length&&await o()}),async unwatch(){t.watchListeners=[],await o()},mount(e,r){if((e=H(e))&&t.mounts[e])throw Error(`already mounted at ${e}`);return e&&(t.mountpoints.push(e),t.mountpoints.sort((e,t)=>t.length-e.length)),t.mounts[e]=r,t.watching&&Promise.resolve(V(r,n,e)).then(r=>{t.unwatch[e]=r}).catch(console.error),c},async unmount(e,r=!0){(e=H(e))&&t.mounts[e]&&(t.watching&&e in t.unwatch&&(t.unwatch[e]?.(),delete t.unwatch[e]),r&&await K(t.mounts[e]),t.mountpoints=t.mountpoints.filter(t=>t!==e),delete t.mounts[e])},getMount(e=""){let t=r(e=z(e)+":");return{driver:t.driver,base:t.base}},getMounts:(e="",t={})=>i(e=z(e),t.parents).map(e=>({driver:e.driver,base:e.mountpoint})),keys:(e,t={})=>c.getKeys(e,t),get:(e,t={})=>c.getItem(e,t),set:(e,t,r={})=>c.setItem(e,t,r),has:(e,t={})=>c.hasItem(e,t),del:(e,t={})=>c.removeItem(e,t),remove:(e,t={})=>c.removeItem(e,t)};return c}({driver:Q({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,X.u)(t))}async removeItem(e){await this.indexedDb.removeItem(e)}}var et="u">typeof globalThis?globalThis:"u">typeof window?window:"u">typeof r.g?r.g:"u">typeof self?self:{},er={exports:{}};function ei(e){var t;return[e[0],(0,X.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 et&&et.localStorage?er.exports=et.localStorage:"u">typeof window&&window.localStorage?er.exports=window.localStorage:er.exports=new e}();class en{constructor(){this.localStorage=er.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(ei)}async getItem(e){let t=this.localStorage.getItem(e);if(null!==t)return(0,X.D)(t)}async setItem(e,t){this.localStorage.setItem(e,(0,X.u)(t))}async removeItem(e){this.localStorage.removeItem(e)}}let es=async(e,t,r)=>{let i="wc_storage_version",n=await t.getItem(i);if(n&&n>=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 i=r.toLowerCase();if(i.includes("wc@")||i.includes("walletconnect")||i.includes("wc_")||i.includes("wallet_connect")){let i=await e.getItem(r);await t.setItem(r,i),o.push(r)}}await t.setItem(i,1),r(t),eo(e,o)},eo=async(e,t)=>{t.length&&t.forEach(async t=>{await e.removeItem(t)})};class ea{constructor(){this.initialized=!1,this.setInitialized=e=>{this.storage=e,this.initialized=!0};let e=new en;this.storage=e;try{let t=new ee;es(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)})}}var ec=r(15133),el=Object.defineProperty,eu=(e,t,r)=>t in e?el(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,eh=(e,t,r)=>eu(e,"symbol"!=typeof t?t+"":t,r);class ed extends x{constructor(e){super(),this.opts=e,eh(this,"protocol","wc"),eh(this,"version",2)}}var ep=Object.defineProperty,ef=(e,t,r)=>t in e?ep(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,eg=(e,t,r)=>ef(e,"symbol"!=typeof t?t+"":t,r);class em extends x{constructor(e,t){super(),this.core=e,this.logger=t,eg(this,"records",new Map)}}class ey{constructor(e,t){this.logger=e,this.core=t}}class ew extends x{constructor(e,t){super(),this.relayer=e,this.logger=t}}class eb extends x{constructor(e){super()}}
885class ev{constructor(e,t,r,i){this.core=e,this.logger=t,this.name=r}}class eE extends x{constructor(e,t){super(),this.relayer=e,this.logger=t}}class e_ extends x{constructor(e,t){super(),this.core=e,this.logger=t}}class eC{constructor(e,t,r){this.core=e,this.logger=t,this.store=r}}class eA{constructor(e,t){this.projectId=e,this.logger=t}}class eI{constructor(e,t,r){this.core=e,this.logger=t,this.telemetryEnabled=r}}function eS(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 eN(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 eO="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,ex=e=>new DataView(e.buffer,e.byteOffset,e.byteLength);function eT(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)),eS(e),e}class eR{clone(){return this._cloneInto()}}function eP(e=32){if(eO&&"function"==typeof eO.getRandomValues)return eO.getRandomValues(new Uint8Array(e));if(eO&&"function"==typeof eO.randomBytes)return eO.randomBytes(e);throw Error("crypto.getRandomValues must be defined")}
885class ek extends eR{constructor(e,t,r,i){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=ex(this.buffer)}update(e){eN(this);let{view:t,buffer:r,blockLen:i}=this,n=(e=eT(e)).length;for(let s=0;s<n;){let o=Math.min(i-this.pos,n-s);if(o===i){let t=ex(e);for(;i<=n-s;s+=i)this.process(t,s);continue}r.set(e.subarray(s,s+o),this.pos),this.pos+=o,s+=o,this.pos===i&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){eN(this),function(e,t){eS(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:i,isLE:n}=this,{pos:s}=this;t[s++]=128,this.buffer.subarray(s).fill(0),this.padOffset>i-s&&(this.process(r,0),s=0);for(let e=s;e<i;e++)t[e]=0;(function(e,t,r,i){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,i);let n=BigInt(32),s=BigInt(4294967295),o=Number(r>>n&s),a=Number(r&s),c=i?4:0,l=i?0:4;e.setUint32(t+c,o,i),e.setUint32(t+l,a,i)})(r,i-8,BigInt(8*this.length),n),this.process(r,0);let o=ex(e),a=this.outputLen;if(a%4)throw Error("_sha2: outputLen should be aligned to 32bit");let c=a/4,l=this.get();if(c>l.length)throw Error("_sha2: outputLen bigger than state");for(let e=0;e<c;e++)o.setUint32(4*e,l[e],n)}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:i,finished:n,destroyed:s,pos:o}=this;return e.length=i,e.pos=o,e.finished=n,e.destroyed=s,i%t&&e.buffer.set(r),e}}let eD=BigInt(4294967296-1),eM=BigInt(32),eU={split:function(e,t=!1){let r=new Uint32Array(e.length),i=new Uint32Array(e.length);for(let n=0;n<e.length;n++){let{h:s,l:o}=function(e,t=!1){return t?{h:Number(e&eD),l:Number(e>>eM&eD)}:{h:0|Number(e>>eM&eD),l:0|Number(e&eD)}}(e[n],t);[r[n],i[n]]=[s,o]}return[r,i]},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,i){let n=(t>>
885>0)+(i>>>0);return{h:e+r+(n/4294967296|0)|0,l:0|n}},add3L:(e,t,r)=>(e>>>0)+(t>>>0)+(r>>>0),add3H:(e,t,r,i)=>t+r+i+(e/4294967296|0)|0,add4L:(e,t,r,i)=>(e>>>0)+(t>>>0)+(r>>>0)+(i>>>0),add4H:(e,t,r,i,n)=>t+r+i+n+(e/4294967296|0)|0,add5H:(e,t,r,i,n,s)=>t+r+i+n+s+(e/4294967296|0)|0,add5L:(e,t,r,i,n)=>(e>>>0)+(t>>>0)+(r>>>0)+(i>>>0)+(n>>>0)},[eL,eB]=eU.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
8855771202a","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))),ej=new Uint32Array(80),e$=new Uint32Array(80);class eF extends ek{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:i,Ch:n,Cl:s,Dh:o,Dl:a,Eh:c,El:l,Fh:u,Fl:h,Gh:d,Gl:p,Hh:f,Hl:g}=this;return[e,t,r,i,n,s,o,a,c,l,u,h,d,p,f,g]}set(e,t,r,i,n,s,o,a,c,l,u,h,d,p,f,g){this.Ah=0|e,this.Al=0|t,this.Bh=0|r,this.Bl=0|i,this.Ch=0|n,this.Cl=0|s,this.Dh=0|o,this.Dl=0|a,this.Eh=0|c,this.El=0|l,this.Fh=0|u,this.Fl=0|h,this.Gh=0|d,this.Gl=0|p,this.Hh=0|f,this.Hl=0|g}process(e,t){for(let r=0;r<16;r++,t+=4)ej[r]=e.getUint32(t),e$[r]=e.getUint32(t+=4);for(let e=16;e<80;e++){let t=0|ej[e-15],r=0|e$[e-15],i=eU.rotrSH(t,r,1)^eU.rotrSH(t,r,8)^eU.shrSH(t,r,7),n=eU.rotrSL(t,r,1)^eU.rotrSL(t,r,8)^eU.shrSL(t,r,7),s=0|ej[e-2],o=0|e$[e-2],a=eU.rotrSH(s,o,19)^eU.rotrBH(s,o,61)^eU.shrSH(s,o,6),c=eU.rotrSL(s,o,19)^eU.rotrBL(s,o,61)^eU.shrSL(s,o,6),l=eU.add4L(n,c,e$[e-7],e$[e-16]),u=eU.add4H(l,i,a,ej[e-7],ej[e-16]);ej[e]=0|u,e$[e]=0|l}let{Ah:r,Al:i,Bh:n,Bl:s,Ch:o,Cl:a,Dh:c,Dl:l,Eh:u,El:h,Fh:d,Fl:p,Gh:f,Gl:g,Hh:m,Hl:y}=this;for(let e=0;e<80;e++){let t=eU.rotrSH(u,h,14)^eU.rotrSH(u,h,18)^eU.rotrBH(u,h,41),w=eU.rotrSL(u,h,14)^eU.rotrSL(u,h,18)^eU.rotrBL(u,h,41),b=u&d^~u&f,v=h&p^~h&g,E=eU.add5L(y,w,v,eB[e],e$[e]),_=eU.add5H(E,m,t,b,eL[e],ej[e]),C=0|E,A=eU.rotrSH(r,i,28)^eU.rotrBH(r,i,34)^eU.rotrBH(r,i,39),I=eU.rotrSL(r,i,28)^eU.rotrBL(r,i,34)^eU.rotrBL(r,i,39),S=r&n^r&o^n&o,N=i&s^i&a^s&a;m=0|f,y=0|g,f=0|d,g=0|p,d=0|u,p=0|h,({h:u,l:h}=eU.add(0|c,0|l,0|_,0|C)),c=0|o,l=0|a,o=0|n,a=0|s,n=0|r,s=0|i;let O=eU.add3L(C,I,N);r=eU.add3H(O,_,A,S),i=0|O}({h:r,l:i}=eU.add(0|this.Ah,0|this.Al,0|r,0|i)),({h:n,l:s}=eU.add(0|this.Bh,0|this.Bl,0|n,0|s)),({h:o,l:a}=eU.add(0|this.Ch,0|this.Cl,0|o,0|a)),({h:c,l:l}=eU.add(0|this.Dh,0|this.Dl,0|c,0|l)),({h:u,l:h}=eU.add(0|this.Eh,0|this.El,0|u,0|h)),({h:d,l:p}=eU.add(0|this.Fh,0|this.Fl,0|d,0|p)),({h:f,l:g}=eU.add(0|this.Gh,0|this.Gl,0|f,0|g)),({h:m,l:y}=eU.add(0|this.Hh,0|this.Hl,0|m,0|y)),this.set(r,i,n,s,o,a,c,l,u,h,d,p,f,g,m,y)}roundClean(){ej.fill(0),e$.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 eq=function(e){let t=t=>e().update(eT(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}(()=>new eF),ez=BigInt(0),eH=BigInt(1),eW=BigInt(2);function eV(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function eK(e){if(!eV(e))throw Error("Uint8Array expected")}function eZ(e,t){if("boolean"!=typeof t)throw Error(e+" boolean expected, got "+t)}let eG=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function eY(e){eK(e);let t="";for(let r=0;r<e.length;r++)t+=eG[e[r]];return t}function eJ(e){if("string"!=typeof e)throw Error("hex string expected, got "+typeof e);return""===e?ez:BigInt("0x"+e)}let eX={_0:48,_9:57,A:65,F:70,a:97,f:102};function eQ(e){return e>=eX._0&&e<=eX._9?e-eX._0:e>=eX.A&&e<=eX.F?e-(eX.A-10):e>=eX.a&&e<=eX.f?e-(eX.a-10):void 0}function e0(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 i=new Uint8Array(r);for(let t=0,n=0;t<r;t++,n+=2){let r=eQ(e.charCodeAt(n)),s=eQ(e.charCodeAt(n+1));if(void 0===r||void 0===s)throw Error('hex string expected, got non-hex character "'+(e[n]+e[n+1])+'" at index '+n);i[t]=16*r+s}return i}function e1(e){return eK(e),eJ(eY(Uint8Array.from(e).reverse()))}function e2(e,t){return e0(e.toString(16).padStart(2*t,"0"))}function e3(e,t){return e2(e,t).reverse()}function e5(e,t,r){let i;if("string"==typeof t)try{i=e0(t)}catch(t){throw Error(e+" must be hex string or Uint8Array, cause: "+t)}else if(eV(t))i=Uint8Array.from(t);else throw Error(e+" must be hex string or Uint8Array");let n=i.length;if("number"==typeof r&&n!==r)throw Error(e+" of length "+r+" expected, got "+n);return i}function e8(...e){let t=0;for(let r=0;r<e.length;r++){let i=e[r];eK(i),t+=i.length}let r=new Uint8Array(t);for(let t=0,i=0;t<e.length;t++){let n=e[t];r.set(n,i),i+=n.length}return r}let e6=e=>"bigint"==typeof e&&ez<=e;
885function e4(e,t,r,i){if(!(e6(t)&&e6(r)&&e6(i))||!(r<=t)||!(t<i))throw Error("expected valid "+e+": "+r+" <= n < "+i+", got "+t)}let e9=e=>(eW<<BigInt(e-1))-eH,e7={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||eV(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 te(e,t,r={}){let i=(t,r,i)=>{let n=e7[r];if("function"!=typeof n)throw Error("invalid validator function");let s=e[t];if(!(i&&void 0===s)&&!n(s,e))throw Error("param "+String(t)+" is invalid. Expected "+r+", got "+s)};for(let[e,r]of Object.entries(t))i(e,r,!1);for(let[e,t]of Object.entries(r))i(e,t,!0);return e}function tt(e){let t=new WeakMap;return(r,...i)=>{let n=t.get(r);if(void 0!==n)return n;let s=e(r,...i);return t.set(r,s),s}}let tr=BigInt(0),ti=BigInt(1),tn=BigInt(2),ts=BigInt(3),to=BigInt(4),ta=BigInt(5),tc=BigInt(8);function tl(e,t){let r=e%t;return r>=tr?r:t+r}function tu(e,t,r){let i=e;for(;t-- >tr;)i*=i,i%=r;return i}function th(e,t){if(e===tr)throw Error("invert: expected non-zero number");if(t<=tr)throw Error("invert: expected positive modulus, got "+t);let r=tl(e,t),i=t,n=tr,s=ti;for(;r!==tr;){let e=i/r,t=i%r,o=n-s*e;i=r,r=t,n=s,s=o}if(i!==ti)throw Error("invert: does not exist");return tl(n,t)}let td=(e,t)=>(tl(e,t)&ti)===ti,tp=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function tf(e,t){let r=void 0!==t?t:e.toString(2).length;return{nBitLength:r,nByteLength:Math.ceil(r/8)}}function tg(e,t,r=!1,i={}){let n;if(e<=tr)throw Error("invalid field: expected ORDER > 0, got "+e);let{nBitLength:s,nByteLength:o}=tf(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:e9(s),ZERO:tr,ONE:ti,create:t=>tl(t,e),isValid:t=>{if("bigint"!=typeof t)throw Error("invalid field element: expected bigint, got "+typeof t);return tr<=t&&t<e},is0:e=>e===tr,isOdd:e=>(e&ti)===ti,neg:t=>tl(-t,e),eql:(e,t)=>e===t,sqr:t=>tl(t*t,e),add:(t,r)=>tl(t+r,e),sub:(t,r)=>tl(t-r,e),mul:(t,r)=>tl(t*r,e),pow:(e,t)=>(function(e,t,r){if(r<tr)throw Error("invalid exponent, negatives unsupported");if(r===tr)return e.ONE;if(r===ti)return t;let i=e.ONE,n=t;for(;r>tr;)r&ti&&(i=e.mul(i,n)),n=e.sqr(n),r>>=ti;return i})(a,e,t),div:(t,r)=>tl(t*th(r,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>th(t,e),sqrt:i.sqrt||(t=>(n||(n=function(e){if(e%to===ts){let t=(e+ti)/to;return function(e,r){let i=e.pow(r,t);if(!e.eql(e.sqr(i),r))throw Error("Cannot find square root");return i}}if(e%tc===ta){let t=(e-ta)/tc;return function(e,r){let i=e.mul(r,tn),n=e.pow(i,t),s=e.mul(r,n),o=e.mul(e.mul(s,tn),n),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,i;let n=(e-ti)/tn;for(t=e-ti,r=0;t%tn===tr;t/=tn,r++);for(i=tn;i<e&&function(e,t,r){if(t<tr)throw Error("invalid exponent, negatives unsupported");if(r<=tr)throw Error("invalid modulus");if(r===ti)return tr;let i=ti;for(;t>tr;)t&ti&&(i=i*e%r),e=e*e%r,t>>=ti;return i}(i,n,e)!==e-ti;i++)if(i>1e3)throw Error("Cannot find square root: likely non-prime P");if(1===r){let t=(e+ti)/to;return function(e,r){let i=e.pow(r,t);if(!e.eql(e.sqr(i),r))throw Error("Cannot find square root");return i}}let s=(t+ti)/tn;return function(e,o){if(e.pow(o,n)===e.neg(e.ONE))throw Error("Cannot find square root");let a=r,c=e.pow(e.mul(e.ONE,i),t),l=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(c,ti<<BigInt(a-t-1));c=e.sqr(r),l=e.mul(l,r),u=e.mul(u,c),a=t}return l}}(e)}(e)),n(a,t))),invertBatch:e=>(function(e,t){let r=Array(t.length),i=t.reduce((t,i,n)=>e.is0(i)?t:(r[n]=t,e.mul(t,i)),e.ONE),n=e.inv(i);return t.reduceRight((t,i,n)=>e.is0(i)?t:(r[n]=e.mul(t,r[n]),e.mul(t,i)),n),r})(a,e),cmov:(e,t,r)=>r?t:e,toBytes:e=>r?e3(e,o):e2(e,o),fromBytes:e=>{if(e.length!==o)throw Error("Field.fromBytes: expected "+o+" bytes, got "+e.length);return r?e1(e):eJ(eY(e))}});return Object.freeze(a)}let tm=BigInt(0),ty=BigInt(1);function tw(e,t){let r=t.negate();return e?r:t}function tb(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw Error("invalid window size, expected [1.."+t+"], got W="+e)}function tv(e,t){return tb(e,t),{windows:Math.ceil(t/e)+1,windowSize:2**(e-1)}}let tE=new WeakMap,t_=new WeakMap;function tC(e){return t_.get(e)||1}let tA=BigInt(0),tI=BigInt(1),tS=BigInt(2),tN=BigInt(8),tO={zip215:!0};BigInt(0),BigInt(1);let tx=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),tT=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt(0);let tR=BigInt(1),tP=BigInt(2);BigInt(3);let tk=BigInt(5),tD=BigInt(8),tM=tg(tx,void 0,!0),tU=function(e){var t;let r=function(e){let t=(te(e.Fp,tp.reduce((e,t)=>
885(e[t]="function",e),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),te(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...tf(e.n,e.nBitLength),...e,p:e.Fp.ORDER}));return te(e,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...t})}(e),{Fp:i,n:n,prehash:s,hash:o,randomBytes:a,nByteLength:c,h:l}=r,u=tS<<BigInt(8*c)-tI,h=i.create,d=tg(r.n,r.nBitLength),p=r.uvRatio||((e,t)=>{try{return{isValid:!0,value:i.sqrt(e*i.inv(t))}}catch{return{isValid:!1,value:tA}}}),f=r.adjustScalarBytes||(e=>e),g=r.domain||((e,t,r)=>{if(eZ("phflag",r),t.length||r)throw Error("Contexts/pre-hash are not supported");return e});function m(e,t){e4("coordinate "+e,t,tA,u)}function y(e){if(!(e instanceof v))throw Error("ExtendedPoint expected")}let w=tt((e,t)=>{let{ex:r,ey:n,ez:s}=e,o=e.is0();null==t&&(t=o?tN:i.inv(s));let a=h(r*t),c=h(n*t),l=h(s*t);if(o)return{x:tA,y:tI};if(l!==tI)throw Error("invZ was invalid");return{x:a,y:c}}),b=tt(e=>{let{a:t,d:i}=r;if(e.is0())throw Error("bad point: ZERO");let{ex:n,ey:s,ez:o,et:a}=e,c=h(n*n),l=h(s*s),u=h(o*o),d=h(u*u),p=h(c*t);if(h(u*h(p+l))!==h(d+h(i*h(c*l))))throw Error("bad point: equation left != right (1)");if(h(n*s)!==h(o*a))throw Error("bad point: equation left != right (2)");return!0});
885class v{constructor(e,t,r,i){this.ex=e,this.ey=t,this.ez=r,this.et=i,m("x",e),m("y",t),m("z",r),m("t",i),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 m("x",t),m("y",r),new v(t,r,tI,h(t*r))}static normalizeZ(e){let t=i.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,i){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)})}(i,t),r.length!==i.length)throw Error("arrays of points and scalars must have equal length");let n=e.ZERO,s=function(e){let t;for(t=0;e>ez;e>>=eH,t+=1);return t}(BigInt(r.length)),o=s>12?s-3:s>4?s-2:s?2:1,a=(1<<o)-1,c=Array(a+1).fill(n),l=Math.floor((t.BITS-1)/o)*o,u=n;for(let e=l;e>=0;e-=o){c.fill(n);for(let t=0;t<i.length;t++){let n=Number(i[t]>>BigInt(e)&BigInt(a));c[n]=c[n].add(r[t])}let t=n;for(let e=c.length-1,r=n;e>0;e--)r=r.add(c[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,d,e,t)}_setWindowSize(e){C.setWindowSize(this,e)}assertValidity(){b(this)}equals(e){y(e);let{ex:t,ey:r,ez:i}=this,{ex:n,ey:s,ez:o}=e,a=h(t*o),c=h(n*i),l=h(r*o),u=h(s*i);return a===c&&l===u}is0(){return this.equals(v.ZERO)}negate(){return new v(h(-this.ex),this.ey,this.ez,h(-this.et))}double(){let{a:e}=r,{ex:t,ey:i,ez:n}=this,s=h(t*t),o=h(i*i),a=h(tS*h(n*n)),c=h(e*s),l=t+i,u=h(h(l*l)-s-o),d=c+o,p=d-a,f=c-o,g=h(u*p),m=h(d*f),y=h(u*f);return new v(g,m,h(p*d),y)}add(e){y(e);let{a:t,d:i}=r,{ex:n,ey:s,ez:o,et:a}=this,{ex:c,ey:l,ez:u,et:d}=e;if(t===BigInt(-1)){let e=h((s-n)*(l+c)),t=h((s+n)*(l-c)),r=h(t-e);if(r===tA)return this.double();let i=h(o*tS*d),p=h(a*tS*u),f=p+i,g=t+e,m=p-i,y=h(f*r),w=h(g*m),b=h(f*m);return new v(y,w,h(r*g),b)}let p=h(n*c),f=h(s*l),g=h(a*i*d),m=h(o*u),w=h((n+s)*(c+l)-p-f),b=m-g,E=m+g,_=h(f-t*p),C=h(w*b),A=h(E*_),I=h(w*_);return new v(C,A,h(b*E),I)}subtract(e){return this.add(e.negate())}wNAF(e){return C.wNAFCached(this,e,v.normalizeZ)}multiply(e){e4("scalar",e,tI,n);let{p:t,f:r}=this.wNAF(e);return v.normalizeZ([t,r])[0]}multiplyUnsafe(e,t=v.ZERO){return e4("scalar",e,tA,n),e===tA?_:this.is0()||e===tI?this:C.wNAFCachedUnsafe(this,e,v.normalizeZ,t)}isSmallOrder(){return this.multiplyUnsafe(l).is0()}isTorsionFree(){return C.unsafeLadder(this,n).is0()}toAffine(e){return w(this,e)}clearCofactor(){let{h:e}=r;return e===tI?this:this.multiplyUnsafe(e)}static fromHex(e,t=!1){let{d:n,a:s}=r,o=i.BYTES;e=e5("pointHex",e,o),eZ("zip215",t);let a=e.slice(),c=e[o-1];a[o-1]=-129&c;let l=e1(a);e4("pointHex.y",l,tA,t?u:i.ORDER);let d=h(l*l),{isValid:f,value:g}=p(h(d-tI),h(n*d-s));if(!f)throw Error("Point.fromHex: invalid y coordinate");let m=(g&tI)===tI,y=(128&c)!=0;if(!t&&g===tA&&y)throw Error("Point.fromHex: x=0 and x_0=1");return y!==m&&(g=h(-g)),v.fromAffine({x:g,y:l})}static fromPrivateKey(e){return A(e).point}toRawBytes(){let{x:e,y:t}=this.toAffine(),r=e3(t,i.BYTES);return r[r.length-1]|=e&tI?128:0,r}toHex(){return eY(this.toRawBytes())}}v.BASE=new v(r.Gx,r.Gy,tI,h(r.Gx*r.Gy)),v.ZERO=new v(tA,tI,tI,tA);let{BASE:E,ZERO:_}=v,C=(t=8*c,{constTimeNegate:tw,hasPrecomputes:e=>1!==tC(e),unsafeLadder(e,t,r=v.ZERO){let i=e;for(;t>tm;)t&ty&&(r=r.add(i)),i=i.double(),t>>=ty;return r},precomputeWindow(e,r){let{windows:i,windowSize:n}=tv(r,t),s=[],o=e,a=o;for(let e=0;e<i;e++){a=o,s.push(a);for(let e=1;e<n;e++)a=a.add(o),s.push(a);o=a.double()}return s},wNAF(e,r,i){let{windows:n,windowSize:s}=tv(e,t),o=v.ZERO,a=v.BASE,c=BigInt(2**e-1),l=2**e,u=BigInt(e);for(let e=0;e<n;e++){let t=e*s,n=Number(i&c);i>>=u,n>s&&(n-=l,i+=ty);let h=t+Math.abs(n)-1,d=e%2!=0,p=n<0;0===n?a=a.add(tw(d,r[t])):o=o.add(tw(p,r[h]))}return{p:o,f:a}},wNAFUnsafe(e,r,i,n=v.ZERO){let{windows:s,windowSize:o}=tv(e,t),a=BigInt(2**e-1),c=2**e,l=BigInt(e);for(let e=0;e<s;e++){let t=e*o;if(i===tm)break;let s=Number(i&a);if(i>>=l,s>o&&(s-=c,i+=ty),0===s)continue;let u=r[t+Math.abs(s)-1];s<0&&(u=u.negate()),n=n.add(u)}return n},getPrecomputes(e,t,r){let i=tE.get(t);
885return i||(i=this.precomputeWindow(t,e),1!==e&&tE.set(t,r(i))),i},wNAFCached(e,t,r){let i=tC(e);return this.wNAF(i,this.getPrecomputes(i,e,r),t)},wNAFCachedUnsafe(e,t,r,i){let n=tC(e);return 1===n?this.unsafeLadder(e,t,i):this.wNAFUnsafe(n,this.getPrecomputes(n,e,r),t,i)},setWindowSize(e,r){tb(r,t),t_.set(e,r),tE.delete(e)}});function A(e){let t=i.BYTES;e=e5("private key",e,t);let r=e5("hashed private key",o(e),2*t),s=f(r.slice(0,t)),a=r.slice(t,2*t),c=tl(e1(s),n),l=E.multiply(c),u=l.toRawBytes();return{head:s,prefix:a,scalar:c,point:l,pointBytes:u}}function I(e=new Uint8Array,...t){return tl(e1(o(g(e8(...t),e5("context",e),!!s))),n)}return E._setWindowSize(8),{CURVE:r,getPublicKey:function(e){return A(e).pointBytes},sign:function(e,t,r={}){e=e5("message",e),s&&(e=s(e));let{prefix:o,scalar:a,pointBytes:c}=A(t),l=I(r.context,o,e),u=E.multiply(l).toRawBytes(),h=tl(l+I(r.context,u,c,e)*a,n);return e4("signature.s",h,tA,n),e5("result",e8(u,e3(h,i.BYTES)),2*i.BYTES)},verify:function(e,t,r,n=tO){let o,a,c;let{context:l,zip215:u}=n,h=i.BYTES;e=e5("signature",e,2*h),t=e5("message",t),r=e5("publicKey",r,h),void 0!==u&&eZ("zip215",u),s&&(t=s(t));let d=e1(e.slice(h,2*h));try{o=v.fromHex(r,u),a=v.fromHex(e.slice(0,h),u),c=E.multiplyUnsafe(d)}catch{return!1}if(!u&&o.isSmallOrder())return!1;let p=I(l,a.toRawBytes(),o.toRawBytes(),t);return a.add(o.multiplyUnsafe(p)).subtract(c).clearCofactor().equals(v.ZERO)},ExtendedPoint:v,utils:{getExtendedPublicKey:A,randomPrivateKey:()=>a(i.BYTES),precompute:(e=8,t=v.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)}}}({a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:tM,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:tD,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:eq,randomBytes:eP,adjustScalarBytes:function(e){return e[0]&=248,e[31]&=127,e[31]|=64,e},uvRatio:function(e,t){let r=tl(t*t*t,tx),i=function(e){let t=BigInt(10),r=BigInt(20),i=BigInt(40),n=BigInt(80),s=e*e%tx*e%tx,o=tu(s,tP,tx)*s%tx,a=tu(o,tR,tx)*e%tx,c=tu(a,tk,tx)*a%tx,l=tu(c,t,tx)*c%tx,u=tu(l,r,tx)*l%tx,h=tu(u,i,tx)*u%tx,d=tu(h,n,tx)*h%tx,p=tu(d,n,tx)*h%tx,f=tu(p,t,tx)*c%tx;return{pow_p_5_8:tu(f,tP,tx)*e%tx,b2:s}}(e*tl(r*r*t,tx)).pow_p_5_8,n=tl(e*r*i,tx),s=tl(t*n*n,tx),o=n,a=tl(n*tT,tx),c=s===e,l=s===tl(-e,tx),u=s===tl(-e*tT,tx);return c&&(n=o),(l||u)&&(n=a),td(n,tx)&&(n=tl(-n,tx)),{isValid:c||l,value:n}}}),tL="base64url",tB="utf8",tj="utf8",t$="base58btc";function tF(e){return null!=globalThis.Buffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}function tq(e=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?tF(globalThis.Buffer.allocUnsafe(e)):new Uint8Array(e)}function tz(e,t){t||(t=e.reduce((e,t)=>e+t.length,0));let r=tq(t),i=0;for(let t of e)r.set(t,i),i+=t.length;return tF(r)}var tH=function(e,t){if(e.length>=255)throw TypeError("Alphabet too long");for(var r=new Uint8Array(256),i=0;i<r.length;i++)r[i]=255;for(var n=0;n<e.length;n++){var s=e.charAt(n),o=s.charCodeAt(0);if(255!==r[o])throw TypeError(s+" is ambiguous");r[o]=n}var a=e.length,c=e.charAt(0),l=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function h(e){if("string"!=typeof e)throw TypeError("Expected String");if(0===e.length)return new Uint8Array;var t=0;if(" "!==e[0]){for(var i=0,n=0;e[t]===c;)i++,t++;for(var s=(e.length-t)*l+1>>>0,o=new Uint8Array(s);e[t];){var u=r[e.charCodeAt(t)];if(255===u)return;for(var h=0,d=s-1;(0!==u||h<n)&&-1!==d;d--,h++)u+=a*o[d]>>>0,o[d]=u%256>>>0,u=u/256>>>0;if(0!==u)throw Error("Non-zero carry");n=h,t++}if(" "!==e[t]){for(var p=s-n;p!==s&&0===o[p];)p++;for(var f=new Uint8Array(i+(s-p)),g=i;p!==s;)f[g++]=o[p++];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"";for(var r=0,i=0,n=0,s=t.length;n!==s&&0===t[n];)n++,r++;for(var o=(s-n)*u+1>>>0,l=new Uint8Array(o);n!==s;){for(var h=t[n],d=0,p=o-1;(0!==h||d<i)&&-1!==p;p--,d++)h+=256*l[p]>>>0,l[p]=h%a>>>0,h=h/a>>>0;if(0!==h)throw Error("Non-zero carry");i=d,n++}for(var f=o-i;f!==o&&0===l[f];)f++;for(var g=c.repeat(r);f<o;++f)g+=e.charAt(l[f]);return g},decodeUnsafe:h,decode:function(e){var r=h(e);if(r)return r;throw Error(`Non-${t} character`)}}};let tW=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")},tV=e=>new TextEncoder().encode(e),tK=e=>
885new TextDecoder().decode(e);class tZ{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 tG{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 tJ(this,e)}}class tY{constructor(e){this.decoders=e}or(e){return tJ(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 tJ=(e,t)=>new tY({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});
885class tX{constructor(e,t,r,i){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=i,this.encoder=new tZ(e,t,r),this.decoder=new tG(e,t,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}let tQ=({name:e,prefix:t,encode:r,decode:i})=>new tX(e,t,r,i),t0=({prefix:e,name:t,alphabet:r})=>{let{encode:i,decode:n}=tH(r,t);return tQ({prefix:e,name:t,encode:i,decode:e=>tW(n(e))})},t1=(e,t,r,i)=>{let n={};for(let e=0;e<t.length;++e)n[t[e]]=e;let s=e.length;for(;"="===e[s-1];)--s;let o=new Uint8Array(s*r/8|0),a=0,c=0,l=0;for(let t=0;t<s;++t){let s=n[e[t]];if(void 0===s)throw SyntaxError(`Non-${i} character`);c=c<<r|s,(a+=r)>=8&&(a-=8,o[l++]=255&c>>a)}if(a>=r||255&c<<8-a)throw SyntaxError("Unexpected end of data");return o},t2=(e,t,r)=>{let i="="===t[t.length-1],n=(1<<r)-1,s="",o=0,a=0;for(let i=0;i<e.length;++i)for(a=a<<8|e[i],o+=8;o>r;)o-=r,s+=t[n&a>>o];if(o&&(s+=t[n&a<<r-o]),i)for(;s.length*r&7;)s+="=";return s},t3=({name:e,prefix:t,bitsPerChar:r,alphabet:i})=>tQ({prefix:t,name:e,encode:e=>t2(e,i,r),decode:t=>t1(t,i,r,e)});var t5=Object.freeze({__proto__:null,identity:tQ({prefix:"\0",name:"identity",encode:e=>tK(e),decode:e=>tV(e)})}),t8=Object.freeze({__proto__:null,base2:t3({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})}),t6=Object.freeze({__proto__:null,base8:t3({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})}),t4=Object.freeze({__proto__:null,base10:t0({prefix:"9",name:"base10",alphabet:"0123456789"})}),t9=Object.freeze({__proto__:null,base16:t3({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),base16upper:t3({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});let t7=t3({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),re=t3({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),rt=t3({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),rr=t3({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),ri=t3({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),rn=t3({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5});var rs=Object.freeze({__proto__:null,base32:t7,base32upper:re,base32pad:rt,base32padupper:rr,base32hex:ri,base32hexupper:rn,base32hexpad:t3({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),base32hexpadupper:t3({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),base32z:t3({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})}),ro=Object.freeze({__proto__:null,base36:t0({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),base36upper:t0({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})}),ra=Object.freeze({__proto__:null,base58btc:t0({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),base58flickr:t0({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});let rc=t3({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6});var rl=Object.freeze({__proto__:null,base64:rc,base64pad:t3({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),base64url:t3({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),base64urlpad:t3({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});let ru=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"),rh=ru.reduce((e,t,r)=>(e[r]=t,e),[]),rd=ru.reduce((e,t,r)=>(e[t.codePointAt(0)]=r,e),[]);var rp=Object.freeze({__proto__:null,base256emoji:tQ({prefix:"\uD83D\uDE80",name:"base256emoji",encode:function(e){return e.reduce((e,t)=>
885e+=rh[t],"")},decode:function(e){let t=[];for(let r of e){let e=rd[r.codePointAt(0)];if(void 0===e)throw Error(`Non-base256emoji character: ${r}`);t.push(e)}return new Uint8Array(t)}})});function rf(e,t){var r,i=0,t=t||0,n=0,s=t,o=e.length;do{if(s>=o)throw rf.bytes=0,RangeError("Could not decode varint");r=e[s++],i+=n<28?(127&r)<<n:(127&r)*Math.pow(2,n),n+=7}while(r>=128);return rf.bytes=s-t,i}var rg=function e(t,r,i){r=r||[],i=i||0;for(var n=i;t>=2147483648;)r[i++]=255&t|128,t/=128;for(;-128&t;)r[i++]=255&t|128,t>>>=7;return r[i]=0|t,e.bytes=i-n+1,r};let rm=(e,t,r=0)=>(rg(e,t,r),t),ry=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,rw=(e,t)=>{let r=t.byteLength,i=ry(e),n=i+ry(r),s=new Uint8Array(n+r);return rm(e,s,0),rm(r,s,i),s.set(t,n),new rb(e,r,t,s)};class rb{constructor(e,t,r,i){this.code=e,this.size=t,this.digest=r,this.bytes=i}}let rv=({name:e,code:t,encode:r})=>new rE(e,t,r);class rE{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?rw(this.code,t):t.then(e=>rw(this.code,e))}throw Error("Unknown type, must be binary type")}}let r_=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t));var rC=Object.freeze({__proto__:null,sha256:rv({name:"sha2-256",code:18,encode:r_("SHA-256")}),sha512:rv({name:"sha2-512",code:19,encode:r_("SHA-512")})}),rA=Object.freeze({__proto__:null,identity:{code:0,name:"identity",encode:tW,digest:e=>rw(0,tW(e))}});new TextEncoder,new TextDecoder;let rI={...t5,...t8,...t6,...t4,...t9,...rs,...ro,...ra,...rl,...rp};function rS(e,t,r,i){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:i}}}({...rC,...rA});let rN=rS("utf8","u",e=>"u"+new TextDecoder("utf8").decode(e),e=>new TextEncoder().encode(e.substring(1))),rO=rS("ascii","a",e=>{let t="a";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},e=>{let t=tq((e=e.substring(1)).length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}),rx={utf8:rN,"utf-8":rN,hex:rI.base16,latin1:rO,ascii:rO,binary:rO,...rI};function rT(e,t="utf8"){let r=rx[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 rR(e,t="utf8"){let r=rx[t];if(!r)throw Error(`Unsupported encoding "${t}"`);return("utf8"===t||"utf-8"===t)&&null!=globalThis.Buffer&&null!=globalThis.Buffer.from?tF(globalThis.Buffer.from(e,"utf-8")):r.decoder.decode(`${r.prefix}${e}`)}function rP(e){return(0,X.D)(rT(rR(e,tL),tB))}function rk(e){return rT(rR((0,X.u)(e),tB),tL)}function rD(e){return["did","key","z"+rT(tz([rR("K36",t$),e]),t$)].join(":")}function rM(e){let t=e.split("."),r=rP(t[0]);return{header:r,payload:rP(t[1]),signature:rR(t[2],tL),data:rR(t.slice(0,2).join("."),tj)}}function rU(e=eP(32)){let t=tU.getPublicKey(e);return{secretKey:tz([e,t]),publicKey:t}}async function rL(e,t,r,i,n=(0,O.fromMiliseconds)(Date.now())){var s,o;let a={alg:"EdDSA",typ:"JWT"},c={iss:rD(i.publicKey),sub:e,aud:t,iat:n,exp:n+r},l=rR([rk((s={header:a,payload:c}).header),rk(s.payload)].join("."),tj);return[rk((o={header:a,payload:c,signature:tU.sign(l,i.secretKey.slice(0,32))}).header),rk(o.payload),rT(o.signature,tL)].join(".")}var rB=r(25566),rj=function(e,t,r){if(r||2==arguments.length)for(var i,n=0,s=t.length;n<s;n++)!i&&n in t||(i||(i=Array.prototype.slice.call(t,0,n)),i[n]=t[n]);return e.concat(i||Array.prototype.slice.call(t))},r$=function(e,t,r){this.name=e,this.version=t,this.os=r,this.type="browser"},rF=function(e){this.version=e,this.type="node",this.name="node",this.os=rB.platform},rq=function(e,t,r,i){this.name=e,this.version=t,this.os=r,this.bot=i,this.type="bot-device"},rz=function(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null},rH=function(){this.type="react-native",this.name="react-native",this.version=null,this.os=null},rW=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,rV=[["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;
885\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/]],rK=[["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/]],rZ=r(76454),rG=r(3897),rY=r(85263);function rJ(e=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?globalThis.Buffer.allocUnsafe(e):new Uint8Array(e)}function rX(e,t){t||(t=e.reduce((e,t)=>e+t.length,0));let r=rJ(t),i=0;for(let t of e)r.set(t,i),i+=t.length;return r}var rQ=function(e,t){if(e.length>=255)throw TypeError("Alphabet too long");for(var r=new Uint8Array(256),i=0;i<r.length;i++)r[i]=255;for(var n=0;n<e.length;n++){var s=e.charAt(n),o=s.charCodeAt(0);if(255!==r[o])throw TypeError(s+" is ambiguous");r[o]=n}var a=e.length,c=e.charAt(0),l=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function h(e){if("string"!=typeof e)throw TypeError("Expected String");if(0===e.length)return new Uint8Array;var t=0;if(" "!==e[0]){for(var i=0,n=0;e[t]===c;)i++,t++;for(var s=(e.length-t)*l+1>>>0,o=new Uint8Array(s);e[t];){var u=r[e.charCodeAt(t)];if(255===u)return;for(var h=0,d=s-1;(0!==u||h<n)&&-1!==d;d--,h++)u+=a*o[d]>>>0,o[d]=u%256>>>0,u=u/256>>>0;if(0!==u)throw Error("Non-zero carry");n=h,t++}if(" "!==e[t]){for(var p=s-n;p!==s&&0===o[p];)p++;for(var f=new Uint8Array(i+(s-p)),g=i;p!==s;)f[g++]=o[p++];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"";for(var r=0,i=0,n=0,s=t.length;n!==s&&0===t[n];)n++,r++;for(var o=(s-n)*u+1>>>0,l=new Uint8Array(o);n!==s;){for(var h=t[n],d=0,p=o-1;(0!==h||d<i)&&-1!==p;p--,d++)h+=256*l[p]>>>0,l[p]=h%a>>>0,h=h/a>>>0;if(0!==h)throw Error("Non-zero carry");i=d,n++}for(var f=o-i;f!==o&&0===l[f];)f++;for(var g=c.repeat(r);f<o;++f)g+=e.charAt(l[f]);return g},decodeUnsafe:h,decode:function(e){var r=h(e);if(r)return r;throw Error(`Non-${t} character`)}}};new Uint8Array(0);let r0=(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},r1=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")},r2=e=>new TextEncoder().encode(e),r3=e=>new TextDecoder().decode(e);class r5{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 r8{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}
885 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 r4(this,e)}}class r6{constructor(e){this.decoders=e}or(e){return r4(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 r4=(e,t)=>new r6({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});class r9{constructor(e,t,r,i){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=i,this.encoder=new r5(e,t,r),this.decoder=new r8(e,t,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}let r7=({name:e,prefix:t,encode:r,decode:i})=>new r9(e,t,r,i),ie=({prefix:e,name:t,alphabet:r})=>{let{encode:i,decode:n}=rQ(r,t);return r7({prefix:e,name:t,encode:i,decode:e=>r1(n(e))})},it=(e,t,r,i)=>{let n={};for(let e=0;e<t.length;++e)n[t[e]]=e;let s=e.length;for(;"="===e[s-1];)--s;let o=new Uint8Array(s*r/8|0),a=0,c=0,l=0;for(let t=0;t<s;++t){let s=n[e[t]];if(void 0===s)throw SyntaxError(`Non-${i} character`);c=c<<r|s,(a+=r)>=8&&(a-=8,o[l++]=255&c>>a)}if(a>=r||255&c<<8-a)throw SyntaxError("Unexpected end of data");return o},ir=(e,t,r)=>{let i="="===t[t.length-1],n=(1<<r)-1,s="",o=0,a=0;for(let i=0;i<e.length;++i)for(a=a<<8|e[i],o+=8;o>r;)o-=r,s+=t[n&a>>o];if(o&&(s+=t[n&a<<r-o]),i)for(;s.length*r&7;)s+="=";return s},ii=({name:e,prefix:t,bitsPerChar:r,alphabet:i})=>r7({prefix:t,name:e,encode:e=>ir(e,i,r),decode:t=>it(t,i,r,e)}),is=r7({prefix:"\0",name:"identity",encode:e=>r3(e),decode:e=>r2(e)}),io=ii({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),ia=ii({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),ic=ie({prefix:"9",name:"base10",alphabet:"0123456789"}),il=ii({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),iu=ii({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),ih=ii({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),id=ii({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),ip=ii({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),ig=ii({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),im=ii({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),iy=ii({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),iw=ii({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),ib=ii({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),iv=ii({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),iE=ie({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),i_=ie({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),iC=ie({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),iA=ie({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),iI=ii({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),iS=ii({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),iN=ii({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),iO=ii({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),ix=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"),iT=ix.reduce((e,t,r)=>(e[r]=t,e),[]),iR=ix.reduce((e,t,r)=>(e[t.codePointAt(0)]=r,e),[]),iP=r7({prefix:"\uD83D\uDE80",name:"base256emoji",encode:function(e){return e.reduce((e,t)=>
885e+=iT[t],"")},decode:function(e){let t=[];for(let r of e){let e=iR[r.codePointAt(0)];if(void 0===e)throw Error(`Non-base256emoji character: ${r}`);t.push(e)}return new Uint8Array(t)}});var ik=function e(t,r,i){r=r||[];for(var n=i=i||0;t>=2147483648;)r[i++]=255&t|128,t/=128;for(;-128&t;)r[i++]=255&t|128,t>>>=7;return r[i]=0|t,e.bytes=i-n+1,r},iD=function e(t,r){var i,n=0,r=r||0,s=0,o=r,a=t.length;do{if(o>=a)throw e.bytes=0,RangeError("Could not decode varint");i=t[o++],n+=s<28?(127&i)<<s:(127&i)*Math.pow(2,s),s+=7}while(i>=128);return e.bytes=o-r,n};let iM=(e,t=0)=>[iD(e,t),iD.bytes],iU=(e,t,r=0)=>(ik(e,t,r),t),iL=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,iB=(e,t)=>{let r=t.byteLength,i=iL(e),n=i+iL(r),s=new Uint8Array(n+r);return iU(e,s,0),iU(r,s,i),s.set(t,n),new iF(e,r,t,s)},ij=e=>{let t=r1(e),[r,i]=iM(t),[n,s]=iM(t.subarray(i)),o=t.subarray(i+s);if(o.byteLength!==n)throw Error("Incorrect length");return new iF(r,n,o,t)},i$=(e,t)=>e===t||e.code===t.code&&e.size===t.size&&r0(e.bytes,t.bytes);
885class iF{constructor(e,t,r,i){this.code=e,this.size=t,this.digest=r,this.bytes=i}}let iq=({name:e,code:t,encode:r})=>new iz(e,t,r);class iz{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?iB(this.code,t):t.then(e=>iB(this.code,e))}throw Error("Unknown type, must be binary type")}}let iH=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t)),iW=iq({name:"sha2-256",code:18,encode:iH("SHA-256")}),iV=iq({name:"sha2-512",code:19,encode:iH("SHA-512")}),iK={code:0,name:"identity",encode:r1,digest:e=>iB(0,r1(e))},iZ="raw",iG=85,iY=e=>r1(e),iJ=e=>r1(e),iX=new TextEncoder,iQ=new TextDecoder,i0="json",i1=512,i2=e=>iX.encode(JSON.stringify(e)),i3=e=>JSON.parse(iQ.decode(e));class i5{constructor(e,t,r,i){this.code=t,this.version=e,this.multihash=r,this.bytes=i,this.byteOffset=i.byteOffset,this.byteLength=i.byteLength,this.asCID=this,this._baseCache=new Map,Object.defineProperties(this,{byteOffset:ni,byteLength:ni,code:nr,version:nr,multihash:nr,bytes:nr,_baseCache:ni,asCID:ni})}toV0(){if(0===this.version)return this;{let{code:e,multihash:t}=this;if(e!==i9)throw Error("Cannot convert a non dag-pb CID to CIDv0");if(t.code!==i7)throw Error("Cannot convert non sha2-256 multihash CID to CIDv0");return i5.createV0(t)}}toV1(){switch(this.version){case 0:{let{code:e,digest:t}=this.multihash,r=iB(e,t);return i5.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&&i$(this.multihash,e.multihash)}toString(e){let{bytes:t,version:r,_baseCache:i}=this;return 0===r?i6(t,i,e||iC.encoder):i4(t,i,e||ih.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 nn(/^0\.0/,ns),!!(e&&(e[nt]||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 i5)return e;if(null!=e&&e.asCID===e){let{version:t,code:r,multihash:i,bytes:n}=e;return new i5(t,r,i,n||ne(t,r,i.bytes))}if(null==e||!0!==e[nt])return null;{let{version:t,multihash:r,code:i}=e,n=ij(r);return i5.create(t,i,n)}}static create(e,t,r){if("number"!=typeof t)throw Error("String codecs are no longer supported");switch(e){case 0:if(t===i9)return new i5(e,t,r,r.bytes);throw Error(`Version 0 CID must use dag-pb (code: ${i9}) block encoding`);case 1:{let i=ne(e,t,r.bytes);return new i5(e,t,r,i)}default:throw Error("Invalid version")}}static createV0(e){return i5.create(0,i9,e)}static createV1(e,t){return i5.create(1,e,t)}static decode(e){let[t,r]=i5.decodeFirst(e);if(r.length)throw Error("Incorrect length");return t}static decodeFirst(e){let t=i5.inspectBytes(e),r=t.size-t.multihashSize,i=r1(e.subarray(r,r+t.multihashSize));if(i.byteLength!==t.multihashSize)throw Error("Incorrect length");let n=i.subarray(t.multihashSize-t.digestSize),s=new iF(t.multihashCode,t.digestSize,n,i);return[0===t.version?i5.createV0(s):i5.createV1(t.codec,s),e.subarray(t.size)]}static inspectBytes(e){let t=0,r=()=>{let[r,i]=iM(e.subarray(t));return t+=i,r},i=r(),n=i9;if(18===i?(i=0,t=0):1===i&&(n=r()),0!==i&&1!==i)throw RangeError(`Invalid CID version ${i}`);let s=t,o=r(),a=r(),c=t+a;return{version:i,codec:n,multihashCode:o,digestSize:a,multihashSize:c-s,size:c}}static parse(e,t){let[r,i]=i8(e,t),n=i5.decode(i);return n._baseCache.set(r,e),n}}let i8=(e,t)=>{switch(e[0]){case"Q":return[iC.prefix,(t||iC).decode(`${iC.prefix}${e}`)];case iC.prefix:return[iC.prefix,(t||iC).decode(e)];case ih.prefix:return[ih.prefix,(t||ih).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)]}},i6=(e,t,r)=>{let{prefix:i}=r;if(i!==iC.prefix)throw Error(`Cannot string encode V0 in ${r.name} encoding`);let n=t.get(i);if(null!=n)return n;{let n=r.encode(e).slice(1);return t.set(i,n),n}},i4=(e,t,r)=>{let{prefix:i}=r,n=t.get(i);if(null!=n)return n;{let n=r.encode(e);return t.set(i,n),n}},i9=112,i7=18,ne=(e,t,r)=>{let i=iL(e),n=i+iL(t),s=new Uint8Array(n+r.byteLength);return iU(e,s,0),iU(t,s,i),s.set(r,n),s}
885,nt=Symbol.for("@ipld/js-cid/CID"),nr={writable:!1,configurable:!1,enumerable:!0},ni={writable:!1,enumerable:!1,configurable:!1},nn=(e,t)=>{if(e.test("0.0.0-dev"))console.warn(t);else throw Error(t)},ns=`CID.isCID(v) is deprecated and will be removed in the next major release.
886Following code pattern:
887
888if (CID.isCID(value)) {
889  doSomethingWithCID(value)
890}
891
892Is replaced with:
893
894const cid = CID.asCID(value)
895if (cid) {
896  // Make sure to use cid instead of value
897  doSomethingWithCID(cid)
898}
899`,no={...d,...p,...f,...g,...m,...y,...w,...b,...v,...E};function na(e,t,r,i){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:i}}}({..._,...C});let nc=na("utf8","u",e=>"u"+new TextDecoder("utf8").decode(e),e=>new TextEncoder().encode(e.substring(1))),nl=na("ascii","a",e=>{let t="a";for(let r=0;r<e.length;r++)t+=String.fromCharCode(e[r]);return t},e=>{let t=rJ((e=e.substring(1)).length);for(let r=0;r<e.length;r++)t[r]=e.charCodeAt(r);return t}),nu={utf8:nc,"utf-8":nc,hex:no.base16,latin1:nl,ascii:nl,binary:nl,...no};function nh(e,t="utf8"){let r=nu[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,"utf8"):r.decoder.decode(`${r.prefix}${e}`)}function nd(e,t="utf8"){let r=nu[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)}let np={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"}};var nf=r(25566),ng=r(82957).Buffer;Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;let nm={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"};function ny(){return"u">typeof nf&&"u">typeof nf.versions&&"u">typeof nf.versions.node}function nw(){return!(0,rZ.getDocument)()&&!!(0,rZ.getNavigator)()&&"ReactNative"===navigator.product}function nb(){return!ny()&&!!(0,rZ.getNavigator)()&&!!(0,rZ.getDocument)()}function nv(){return nw()?nm.reactNative:ny()?nm.node:nb()?nm.browser:nm.unknown}function nE(){var e;try{return nw()&&"u">typeof r.g&&"u">typeof(null==r.g?void 0:r.g.Application)?null==(e=r.g.Application)?void 0:e.applicationId:void 0}catch{return}}function n_(e,t,i){let n=function(){if(nv()===nm.reactNative&&"u">typeof r.g&&"u">typeof(null==r.g?void 0:r.g.Platform)){let{OS:e,Version:t}=r.g.Platform;return[e,t].join("-")}let e="undefined"==typeof document&&"undefined"!=typeof navigator&&"ReactNative"===navigator.product?new rH:"undefined"!=typeof navigator?function(e){var t=""!==e&&rV.reduce(function(t,r){var i=r[0],n=r[1];if(t)return t;var s=n.exec(e);return!!s&&[i,s]},!1);if(!t)return null;var r=t[0],i=t[1];if("searchbot"===r)return new rz;var n=i[1]&&i[1].split(".").join("_").split("_").slice(0,3);n?n.length<3&&(n=rj(rj([],n,!0),function(e){for(var t=[],r=0;r<e;r++)t.push("0");return t}(3-n.length),!0)):n=[];var s=n.join("."),o=function(e){for(var t=0,r=rK.length;t<r;t++){var i=rK[t],n=i[0];if(i[1].exec(e))return n}return null}(e),a=rW.exec(e);return a&&a[1]?new rq(r,s,o,a[1]):new r$(r,s,o)}(navigator.userAgent):void 0!==rB&&rB.version?new rF(rB.version.slice(1)):null;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("-")}(),s=function(){var e;let t=nv();
899return t===nm.browser?[t,(null==(e=(0,rZ.getLocation)())?void 0:e.host)||"unknown"].join(":"):t}();return[[e,t].join("-"),["js",i].join("-"),n,s].join("/")}function nC(e){return Object.fromEntries(e.entries())}function nA(e){return new Map(Object.entries(e))}function nI(e,t,r){return new Promise(async(i,n)=>{let s=setTimeout(()=>n(Error(r)),t);try{let t=await e;i(t)}catch(e){n(e)}clearTimeout(s)})}function nS(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 nN(e,t){return(0,O.fromMiliseconds)((t||Date.now())+(0,O.toMiliseconds)(e))}function nO(e){return Date.now()>=(0,O.toMiliseconds)(e)}function nx(e,t){return`${e}${t?`:${t}`:""}`}function nT(){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 nR(){return"u">typeof nf&&"true"===nf.env.IS_VITEST}function nP(e){return ng.from(e,"base64").toString("utf-8")}function nk(e){if(!Number.isSafeInteger(e)||e<0)throw Error("positive integer expected, got "+e)}function nD(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 nM(e){if("function"!=typeof e||"function"!=typeof e.create)throw Error("Hash should be wrapped by utils.wrapConstructor");nk(e.outputLen),nk(e.blockLen)}function nU(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 nL(e,t){nD(e);let r=t.outputLen;if(e.length<r)throw Error("digestInto() expects output buffer of length at least "+r)}let nB=BigInt(4294967296-1),nj=BigInt(32),n$=(e,t,r)=>e<<r|t>>>32-r,nF=(e,t,r)=>t<<r|e>>>32-r,nq=(e,t,r)=>t<<r-32|e>>>64-r,nz=(e,t,r)=>e<<r-32|t>>>64-r,nH="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;function nW(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function nV(e,t){return e<<32-t|e>>>t}let nK=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0];function nZ(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}}function nG(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)),nD(e),e}class nY{clone(){return this._cloneInto()}}function nJ(e){let t=t=>e().update(nG(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function nX(e=32){if(nH&&"function"==typeof nH.getRandomValues)return nH.getRandomValues(new Uint8Array(e));if(nH&&"function"==typeof nH.randomBytes)return nH.randomBytes(e);throw Error("crypto.getRandomValues must be defined")}let nQ=[],n0=[],n1=[],n2=BigInt(0),n3=BigInt(1),n5=BigInt(2),n8=BigInt(7),n6=BigInt(256),n4=BigInt(113);for(let e=0,t=n3,r=1,i=0;e<24;e++){[r,i]=[i,(2*r+3*i)%5],nQ.push(2*(5*i+r)),n0.push((e+1)*(e+2)/2%64);let n=n2;for(let e=0;e<7;e++)(t=(t<<n3^(t>>n8)*n4)%n6)&n5&&(n^=n3<<(n3<<BigInt(e))-n3);n1.push(n)}let[n9,n7]=function(e,t=!1){let r=new Uint32Array(e.length),i=new Uint32Array(e.length);for(let n=0;n<e.length;n++){let{h:s,l:o}=function(e,t=!1){return t?{h:Number(e&nB),l:Number(e>>nj&nB)}:{h:0|Number(e>>nj&nB),l:0|Number(e&nB)}}(e[n],t);[r[n],i[n]]=[s,o]}return[r,i]}(n1,!0),se=(e,t,r)=>r>32?nq(e,t,r):n$(e,t,r),st=(e,t,r)=>r>32?nz(e,t,r):nF(e,t,r);class sr extends nY{constructor(e,t,r,i=!1,n=24){var s;if(super(),this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=i,this.rounds=n,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,nk(r),0>=this.blockLen||this.blockLen>=200)throw Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=new Uint32Array((s=this.state).buffer,s.byteOffset,Math.floor(s.byteLength/4))}keccak(){nK||nZ(this.state32),function(e,t=24){let r=new Uint32Array(10);for(let i=24-t;i<24;i++){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 i=(t+8)%10,n=(t+2)%10,s=r[n],o=r[n+1],a=se(s,o,1)^r[i],c=st(s,o,1)^r[i+1];for(let r=0;r<50;r+=10)e[t+r]^=a,e[t+r+1]^=c}let t=e[2],n=e[3];for(let r=0;r<24;r++){let i=n0[r],s=se(t,n,i),o=st(t,n,i),a=nQ[r];t=e[a],n=e[a+1],e[a]=s,e[a+1]=o}for(let t=0;t<50;t+=10){for(let i=0;i<10;i++)r[i]=e[t+i];for(let i=0;i<10;i++)e[t+i]^=~r[(i+2)%10]&r[(i+4)%10]}e[0]^=n9[i],e[1]^=n7[i]}r.fill(0)}(this.state32,this.rounds),nK||nZ(this.state32),this.posOut=0,this.pos=0}update(e){nU(this);let{blockLen:t,state:r}=this,i=(e=nG(e)).length;for(let n=0;n<i;){let s=Math.min(t-this.pos,i-n);for(let t=0;t<s;t++)r[this.pos++]^=e[n++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:e,suffix:t,pos:r,blockLen:i}=this;e[r]^=t,(128&t)!=0&&r===i-1&&this.keccak(),e[i-1]^=128,this.keccak()}writeInto(e){nU(this,!1),nD(e),this.finish();let t=this.state,{blockLen:r}=this;for(let i=0,n=e.length;i<n;){this.posOut>=r&&this.keccak();let s=Math.min(r-this.posOut,n-i);e.set(t.subarray(this.posOut,this.posOut+s),i),this.posOut+=s,i+=s}return e}xofInto(e){if(!this.enableXOF)throw Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return nk(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(nL(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,this.state.fill(0)}_cloneInto(e){let{blockLen:t,suffix:r,outputLen:i,rounds:n,enableXOF:s}=this;return e||(e=new sr(t,r,i,s,n)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=n,e.suffix=r,e.outputLen=i,e.enableXOF=s,e.destroyed=this.destroyed,e}}function si(e){if(!Number.isSafeInteger(e)||e<0)throw Error("positive integer expected, got "+e)}function sn(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function ss(e,...t){if(!sn(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 so(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){if("boolean"!=typeof e)throw Error(`boolean expected, not ${e}`)}nJ(()=>new sr(136,1,32)),Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;let sc=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),sl=e=>new DataView(e.buffer,e.byteOffset,e.byteLength);if(68!==new Uint8Array(new Uint32Array([287454020]).buffer)[0])throw Error("Non little-endian hardware is not supported");function su(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(sn(e))e=sp(e);else throw Error("Uint8Array expected, got "+typeof e);return e}function sh(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 sd(e,t,r,i){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,i);let n=BigInt(32),s=BigInt(4294967295),o=Number(r>>n&s),a=Number(r&s),c=i?4:0,l=i?0:4;e.setUint32(t+c,o,i),e.setUint32(t+l,a,i)}function sp(e){return Uint8Array.from(e)}function sf(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}let sg=e=>Uint8Array.from(e.split("").map(e=>
899e.charCodeAt(0))),sm=sg("expand 16-byte k"),sy=sg("expand 32-byte k"),sw=sc(sm),sb=sc(sy);function sv(e,t){return e<<t|e>>>32-t}function sE(e){return e.byteOffset%4==0}let s_=4294967296-1,sC=new Uint32Array,sA=(e,t)=>255&e[t++]|(255&e[t++])<<8;class sI{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,ss(e=su(e),32);let t=sA(e,0),r=sA(e,2),i=sA(e,4),n=sA(e,6),s=sA(e,8),o=sA(e,10),a=sA(e,12),c=sA(e,14);this.r[0]=8191&t,this.r[1]=(t>>>13|r<<3)&8191,this.r[2]=(r>>>10|i<<6)&7939,this.r[3]=(i>>>7|n<<9)&8191,this.r[4]=(n>>>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|c<<8)&8191,this.r[9]=c>>>5&127;for(let t=0;t<8;t++)this.pad[t]=sA(e,16+2*t)}process(e,t,r=!1){let{h:i,r:n}=this,s=n[0],o=n[1],a=n[2],c=n[3],l=n[4],u=n[5],h=n[6],d=n[7],p=n[8],f=n[9],g=sA(e,t+0),m=sA(e,t+2),y=sA(e,t+4),w=sA(e,t+6),b=sA(e,t+8),v=sA(e,t+10),E=sA(e,t+12),_=sA(e,t+14),C=i[0]+(8191&g),A=i[1]+((g>>>13|m<<3)&8191),I=i[2]+((m>>>10|y<<6)&8191),S=i[3]+((y>>>7|w<<9)&8191),N=i[4]+((w>>>4|b<<12)&8191),O=i[5]+(b>>>1&8191),x=i[6]+((b>>>14|v<<2)&8191),T=i[7]+((v>>>11|E<<5)&8191),R=i[8]+((E>>>8|_<<8)&8191),P=i[9]+(_>>>5|(r?0:2048)),k=0,D=0+C*s+5*f*A+5*p*I+5*d*S+5*h*N;k=D>>>13,D&=8191,D+=5*u*O+5*l*x+5*c*T+5*a*R+5*o*P,k+=D>>>13,D&=8191;let M=k+C*o+A*s+5*f*I+5*p*S+5*d*N;k=M>>>13,M&=8191,M+=5*h*O+5*u*x+5*l*T+5*c*R+5*a*P,k+=M>>>13,M&=8191;let U=k+C*a+A*o+I*s+5*f*S+5*p*N;k=U>>>13,U&=8191,U+=5*d*O+5*h*x+5*u*T+5*l*R+5*c*P,k+=U>>>13,U&=8191;let L=k+C*c+A*a+I*o+S*s+5*f*N;k=L>>>13,L&=8191,L+=5*p*O+5*d*x+5*h*T+5*u*R+5*l*P,k+=L>>>13,L&=8191;let B=k+C*l+A*c+I*a+S*o+N*s;k=B>>>13,B&=8191,B+=5*f*O+5*p*x+5*d*T+5*h*R+5*u*P,k+=B>>>13,B&=8191;let j=k+C*u+A*l+I*c+S*a+N*o;k=j>>>13,j&=8191,j+=O*s+5*f*x+5*p*T+5*d*R+5*h*P,k+=j>>>13,j&=8191;let $=k+C*h+A*u+I*l+S*c+N*a;k=$>>>13,$&=8191,$+=O*o+x*s+5*f*T+5*p*R+5*d*P,k+=$>>>13,$&=8191;let F=k+C*d+A*h+I*u+S*l+N*c;k=F>>>13,F&=8191,F+=O*a+x*o+T*s+5*f*R+5*p*P,k+=F>>>13,F&=8191;let q=k+C*p+A*d+I*h+S*u+N*l;k=q>>>13,q&=8191,q+=O*c+x*a+T*o+R*s+5*f*P,k+=q>>>13,q&=8191;let z=k+C*f+A*p+I*d+S*h+N*u;k=z>>>13,z&=8191,z+=O*l+x*c+T*a+R*o+P*s,k+=z>>>13,z&=8191,D=8191&(k=(k=(k<<2)+k|0)+D|0),k>>>=13,M+=k,i[0]=D,i[1]=M,i[2]=U,i[3]=L,i[4]=B,i[5]=j,i[6]=$,i[7]=F,i[8]=q,i[9]=z}finalize(){let{h:e,pad:t}=this,r=new Uint16Array(10),i=e[1]>>>13;e[1]&=8191;for(let t=2;t<10;t++)e[t]+=i,i=e[t]>>>13,e[t]&=8191;e[0]+=5*i,i=e[0]>>>13,e[0]&=8191,e[1]+=i,i=e[1]>>>13,e[1]&=8191,e[2]+=i,r[0]=e[0]+5,i=r[0]>>>13,r[0]&=8191;for(let t=1;t<10;t++)r[t]=e[t]+i,i=r[t]>>>13,r[t]&=8191;r[9]-=8192;let n=(1^i)-1;for(let e=0;e<10;e++)r[e]&=n;n=~n;for(let t=0;t<10;t++)e[t]=e[t]&n|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;sf(r)}update(e){so(this);let{buffer:t,blockLen:r}=this,i=(e=su(e)).length;for(let n=0;n<i;){let s=Math.min(r-this.pos,i-n);if(s===r){for(;r<=i-n;n+=r)this.process(e,n);continue}t.set(e.subarray(n,n+s),this.pos),this.pos+=s,n+=s,this.pos===r&&(this.process(t,0,!1),this.pos=0)}return this}destroy(){sf(this.h,this.r,this.buffer,this.pad)}digestInto(e){so(this),function(e,t){ss(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:i}=this;if(i){for(t[i++]=1;i<16;i++)t[i]=0;this.process(t,0,!0)}this.finalize();let n=0;for(let t=0;t<8;t++)e[n++]=r[t]>>>0,e[n++]=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 sS=function(e){let t=(t,r)=>e(r).update(su(t)).digest(),r=e(new Uint8Array(32));return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t}(e=>new sI(e)),sN=function(e,t){let{allowShortKeys:r,extendNonceFn:i,counterLength:n,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);
899if("function"!=typeof e)throw Error("core must be a function");return si(n),si(o),sa(s),sa(r),(t,a,c,l,u=0)=>{ss(t),ss(a),ss(c);let h=c.length;if(void 0===l&&(l=new Uint8Array(h)),ss(l),si(u),u<0||u>=s_)throw Error("arx: counter overflow");if(l.length<h)throw Error(`arx: output (${l.length}) is shorter than data (${h})`);let d=[],p=t.length,f,g;if(32===p)d.push(f=sp(t)),g=sb;else if(16===p&&r)(f=new Uint8Array(32)).set(t),f.set(t,16),g=sw,d.push(f);else throw Error(`arx: invalid 32-byte key, got length=${p}`);sE(a)||d.push(a=sp(a));let m=sc(f);if(i){if(24!==a.length)throw Error("arx: extended nonce must be 24 bytes");i(g,m,sc(a.subarray(0,16)),m),a=a.subarray(16)}let y=16-n;if(y!==a.length)throw Error(`arx: nonce must be ${y} or 16 bytes`);if(12!==y){let e=new Uint8Array(12);e.set(a,s?0:12-a.length),a=e,d.push(a)}return function(e,t,r,i,n,s,o,a){let c=n.length,l=new Uint8Array(64),u=sc(l),h=sE(n)&&sE(s),d=h?sc(n):sC,p=h?sc(s):sC;for(let f=0;f<c;o++){if(e(t,r,i,u,o,a),o>=s_)throw Error("arx: counter overflow");let g=Math.min(64,c-f);if(h&&64===g){let e=f/4;if(f%4!=0)throw Error("arx: invalid block position");for(let t=0,r;t<16;t++)p[r=e+t]=d[r]^u[t];f+=64;continue}for(let e=0,t;e<g;e++)s[t=f+e]=n[t]^l[e];f+=g}}(e,g,m,sc(a),c,l,u,o),sf(...d),l}}(function(e,t,r,i,n,s=20){let o=e[0],a=e[1],c=e[2],l=e[3],u=t[0],h=t[1],d=t[2],p=t[3],f=t[4],g=t[5],m=t[6],y=t[7],w=r[0],b=r[1],v=r[2],E=o,_=a,C=c,A=l,I=u,S=h,N=d,O=p,x=f,T=g,R=m,P=y,k=n,D=w,M=b,U=v;for(let e=0;e<s;e+=2)x=x+(k=sv(k^(E=E+I|0),16))|0,E=E+(I=sv(I^x,12))|0,x=x+(k=sv(k^E,8))|0,I=sv(I^x,7),T=T+(D=sv(D^(_=_+S|0),16))|0,_=_+(S=sv(S^T,12))|0,T=T+(D=sv(D^_,8))|0,S=sv(S^T,7),R=R+(M=sv(M^(C=C+N|0),16))|0,C=C+(N=sv(N^R,12))|0,R=R+(M=sv(M^C,8))|0,N=sv(N^R,7),P=P+(U=sv(U^(A=A+O|0),16))|0,A=A+(O=sv(O^P,12))|0,P=P+(U=sv(U^A,8))|0,O=sv(O^P,7),R=R+(U=sv(U^(E=E+S|0),16))|0,E=E+(S=sv(S^R,12))|0,R=R+(U=sv(U^E,8))|0,S=sv(S^R,7),P=P+(k=sv(k^(_=_+N|0),16))|0,_=_+(N=sv(N^P,12))|0,P=P+(k=sv(k^_,8))|0,N=sv(N^P,7),x=x+(D=sv(D^(C=C+O|0),16))|0,C=C+(O=sv(O^x,12))|0,x=x+(D=sv(D^C,8))|0,O=sv(O^x,7),T=T+(M=sv(M^(A=A+I|0),16))|0,A=A+(I=sv(I^T,12))|0,T=T+(M=sv(M^A,8))|0,I=sv(I^T,7);let L=0;i[L++]=o+E|0,i[L++]=a+_|0,i[L++]=c+C|0,i[L++]=l+A|0,i[L++]=u+I|0,i[L++]=h+S|0,i[L++]=d+N|0,i[L++]=p+O|0,i[L++]=f+x|0,i[L++]=g+T|0,i[L++]=m+R|0,i[L++]=y+P|0,i[L++]=n+k|0,i[L++]=w+D|0,i[L++]=b+M|0,i[L++]=v+U|0},{counterRight:!1,counterLength:4,allowShortKeys:!1}),sO=new Uint8Array(16),sx=(e,t)=>{e.update(t);let r=t.length%16;r&&e.update(sO.subarray(r))},sT=new Uint8Array(32);function sR(e,t,r,i,n){let s=e(t,r,sT),o=sS.create(s);n&&sx(o,n),sx(o,i);let a=new Uint8Array(16),c=sl(a);sd(c,0,BigInt(n?n.length:0),!0),sd(c,8,BigInt(i.length),!0),o.update(a);let l=o.digest();return sf(s,a),l}let sP=((e,t)=>{function r(i,...n){if(ss(i),void 0!==e.nonceLength){let t=n[0];if(!t)throw Error("nonce / iv required");e.varSizeNonce?ss(t):ss(t,e.nonceLength)}let s=e.tagLength;s&&void 0!==n[1]&&ss(n[1]);let o=t(i,...n),a=(e,t)=>{if(void 0!==t){if(2!==e)throw Error("cipher output not supported");ss(t)}},c=!1;return{encrypt(e,t){if(c)throw Error("cannot encrypt() twice with same key + nonce");return c=!0,ss(e),a(o.encrypt.length,t),o.encrypt(e,t)},decrypt(e,t){if(ss(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(i,n){let s=i.length;(n=sh(s+16,n,!1)).set(i);let o=n.subarray(0,-16);sN(e,t,o,o,1);let a=sR(sN,e,t,o,r);return n.set(a,s),sf(a),n},decrypt(i,n){n=sh(i.length-16,n,!1);let s=i.subarray(0,-16),o=i.subarray(-16),a=sR(sN,e,t,s,r);if(!function(e,t){if(e.length!==t.length)return!1;let r=0;for(let i=0;i<e.length;i++)r|=e[i]^t[i];return 0===r}(o,a))throw Error("invalid tag");return n.set(i.subarray(0,-16)),sN(e,t,n,n,1),sf(a),n}}));class sk extends nY{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,nM(e);let r=nG(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,n=new Uint8Array(i);n.set(r.length>i?e.create().update(r).digest():r);for(let e=0;e<n.length;e++)n[e]^=54;this.iHash.update(n),this.oHash=e.create();for(let e=0;e<n.length;e++)n[e]^=106;this.oHash.update(n),n.fill(0)}update(e){return nU(this),this.iHash.update(e),this}digestInto(e){nU(this),nD(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:i,destroyed:n,blockLen:s,outputLen:o}=this;return e.finished=i,e.destroyed=n,e.blockLen=s,e.outputLen=o,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}let sD=(e,t,r)=>new sk(e,t).update(r).digest();sD.create=(e,t)=>
899new sk(e,t);let sM=new Uint8Array([0]),sU=new Uint8Array,sL=(e,t,r,i,n)=>{var s;return function(e,t,r,i=32){if(nM(e),nk(i),i>255*e.outputLen)throw Error("Length should be <= 255*HashLen");let n=Math.ceil(i/e.outputLen);void 0===r&&(r=sU);let s=new Uint8Array(n*e.outputLen),o=sD.create(e,t),a=o._cloneInto(),c=new Uint8Array(o.outputLen);for(let t=0;t<n;t++)sM[0]=t+1,a.update(0===t?sU:c).update(r).update(sM).digestInto(c),s.set(c,e.outputLen*t),o._cloneInto(a);return o.destroy(),a.destroy(),c.fill(0),sM.fill(0),s.slice(0,i)}(e,(s=r,nM(e),void 0===s&&(s=new Uint8Array(e.outputLen)),sD(e,nG(s),nG(t))),i,n)};class sB extends nY{constructor(e,t,r,i){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=nW(this.buffer)}update(e){nU(this);let{view:t,buffer:r,blockLen:i}=this,n=(e=nG(e)).length;for(let s=0;s<n;){let o=Math.min(i-this.pos,n-s);if(o===i){let t=nW(e);for(;i<=n-s;s+=i)this.process(t,s);continue}r.set(e.subarray(s,s+o),this.pos),this.pos+=o,s+=o,this.pos===i&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){nU(this),nL(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:i,isLE:n}=this,{pos:s}=this;t[s++]=128,this.buffer.subarray(s).fill(0),this.padOffset>i-s&&(this.process(r,0),s=0);for(let e=s;e<i;e++)t[e]=0;(function(e,t,r,i){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,i);let n=BigInt(32),s=BigInt(4294967295),o=Number(r>>n&s),a=Number(r&s),c=i?4:0,l=i?0:4;e.setUint32(t+c,o,i),e.setUint32(t+l,a,i)})(r,i-8,BigInt(8*this.length),n),this.process(r,0);let o=nW(e),a=this.outputLen;if(a%4)throw Error("_sha2: outputLen should be aligned to 32bit");let c=a/4,l=this.get();if(c>l.length)throw Error("_sha2: outputLen bigger than state");for(let e=0;e<c;e++)o.setUint32(4*e,l[e],n)}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:i,finished:n,destroyed:s,pos:o}=this;return e.length=i,e.pos=o,e.finished=n,e.destroyed=s,i%t&&e.buffer.set(r),e}}let sj=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),s$=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),sF=new Uint32Array(64);class sq extends sB{constructor(){super(64,32,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:i,E:n,F:s,G:o,H:a}=this;return[e,t,r,i,n,s,o,a]}set(e,t,r,i,n,s,o,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|i,this.E=0|n,this.F=0|s,this.G=0|o,this.H=0|a}process(e,t){for(let r=0;r<16;r++,t+=4)sF[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=sF[e-15],r=sF[e-2],i=nV(t,7)^nV(t,18)^t>>>3,n=nV(r,17)^nV(r,19)^r>>>10;sF[e]=n+sF[e-7]+i+sF[e-16]|0}let{A:r,B:i,C:n,D:s,E:o,F:a,G:c,H:l}=this;for(let e=0;e<64;e++){var u,h,d,p;let t=l+(nV(o,6)^nV(o,11)^nV(o,25))+((u=o)&a^~u&c)+sj[e]+sF[e]|0,f=(nV(r,2)^nV(r,13)^nV(r,22))+((h=r)&(d=i)^h&(p=n)^d&p)|0;l=c,c=a,a=o,o=s+t|0,s=n,n=i,i=r,r=t+f|0}r=r+this.A|0,i=i+this.B|0,n=n+this.C|0,s=s+this.D|0,o=o+this.E|0,a=a+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(r,i,n,s,o,a,c,l)}roundClean(){sF.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}let sz=nJ(()=>new sq),sH=BigInt(0),sW=BigInt(1),sV=BigInt(2);function sK(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function sZ(e){if(!sK(e))throw Error("Uint8Array expected")}function sG(e,t){if("boolean"!=typeof t)throw Error(e+" boolean expected, got "+t)}let sY=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function sJ(e){sZ(e);let t="";for(let r=0;r<e.length;r++)t+=sY[e[r]];return t}function sX(e){let t=e.toString(16);return 1&t.length?"0"+t:t}function sQ(e){if("string"!=typeof e)throw Error("hex string expected, got "+typeof e);return""===e?sH:BigInt("0x"+e)}let s0={_0:48,_9:57,A:65,F:70,a:97,f:102};function s1(e){return e>=s0._0&&e<=s0._9?e-s0._0:e>=s0.A&&e<=s0.F?e-(s0.A-10):e>=s0.a&&e<=s0.f?e-(s0.a-10):void 0}function s2(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 i=new Uint8Array(r);for(let t=0,n=0;t<r;t++,n+=2){let r=s1(e.charCodeAt(n)),s=s1(e.charCodeAt(n+1));if(void 0===r||void 0===s)throw Error('hex string expected, got non-hex character "'+(e[n]+e[n+1])+'" at index '+n);i[t]=16*r+s}return i}function s3(e){return sQ(sJ(e))}function s5(e){return sZ(e),sQ(sJ(Uint8Array.from(e).reverse()))}function s8(e,t){return s2(e.toString(16).padStart(2*t,"0"))}function s6(e,t){return s8(e,t).reverse()}function s4(e,t,r){let i;if("string"==typeof t)try{i=s2(t)}catch(t){throw Error(e+" must be hex string or Uint8Array, cause: "+t)}else if(sK(t))i=Uint8Array.from(t);else throw Error(e+" must be hex string or Uint8Array");let n=i.length;if("number"==typeof r&&n!==r)throw Error(e+" of length "+r+" expected, got "+n);return i}function s9(...e){let t=0;for(let r=0;r<e.length;r++){let i=e[r];sZ(i),t+=i.length}let r=new Uint8Array(t);for(let t=0,i=0;t<e.length;t++){let n=e[t];r.set(n,i),i+=n.length}return r}let s7=e=>"bigint"==typeof e&&sH<=e;function oe(e,t,r){return s7(e)&&s7(t)&&s7(r)&&t<=e&&e<r}
899function ot(e,t,r,i){if(!oe(t,r,i))throw Error("expected valid "+e+": "+r+" <= n < "+i+", got "+t)}function or(e){let t;for(t=0;e>sH;e>>=sW,t+=1);return t}let oi=e=>(sV<<BigInt(e-1))-sW,on=e=>new Uint8Array(e),os=e=>Uint8Array.from(e);function oo(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=on(e),n=on(e),s=0,o=()=>{i.fill(1),n.fill(0),s=0},a=(...e)=>r(n,i,...e),c=(e=on())=>{n=a(os([0]),e),i=a(),0!==e.length&&(n=a(os([1]),e),i=a())},l=()=>{if(s++>=1e3)throw Error("drbg: tried 1000 values");let e=0,r=[];for(;e<t;){let t=(i=a()).slice();r.push(t),e+=i.length}return s9(...r)};return(e,t)=>{let r;for(o(),c(e);!(r=t(l()));)c();return o(),r}}let oa={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||sK(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 oc(e,t,r={}){let i=(t,r,i)=>{let n=oa[r];if("function"!=typeof n)throw Error("invalid validator function");let s=e[t];if(!(i&&void 0===s)&&!n(s,e))throw Error("param "+String(t)+" is invalid. Expected "+r+", got "+s)};for(let[e,r]of Object.entries(t))i(e,r,!1);for(let[e,t]of Object.entries(r))i(e,t,!0);return e}function ol(e){let t=new WeakMap;return(r,...i)=>{let n=t.get(r);if(void 0!==n)return n;let s=e(r,...i);return t.set(r,s),s}}var ou=Object.freeze({__proto__:null,isBytes:sK,abytes:sZ,abool:sG,bytesToHex:sJ,numberToHexUnpadded:sX,hexToNumber:sQ,hexToBytes:s2,bytesToNumberBE:s3,bytesToNumberLE:s5,numberToBytesBE:s8,numberToBytesLE:s6,numberToVarBytesBE:function(e){return s2(sX(e))},ensureBytes:s4,concatBytes:s9,equalBytes:function(e,t){if(e.length!==t.length)return!1;let r=0;for(let i=0;i<e.length;i++)r|=e[i]^t[i];return 0===r},utf8ToBytes:function(e){if("string"!=typeof e)throw Error("string expected");return new Uint8Array(new TextEncoder().encode(e))},inRange:oe,aInRange:ot,bitLen:or,bitGet:function(e,t){return e>>BigInt(t)&sW},bitSet:function(e,t,r){return e|(r?sW:sH)<<BigInt(t)},bitMask:oi,createHmacDrbg:oo,validateObject:oc,notImplemented:()=>{throw Error("not implemented")},memoized:ol});let oh=BigInt(0),od=BigInt(1),op=BigInt(2),of=BigInt(3),og=BigInt(4),om=BigInt(5),oy=BigInt(8);function ow(e,t){let r=e%t;return r>=oh?r:t+r}function ob(e,t,r){if(t<oh)throw Error("invalid exponent, negatives unsupported");if(r<=oh)throw Error("invalid modulus");if(r===od)return oh;let i=od;for(;t>oh;)t&od&&(i=i*e%r),e=e*e%r,t>>=od;return i}function ov(e,t,r){let i=e;for(;t-- >oh;)i*=i,i%=r;return i}function oE(e,t){if(e===oh)throw Error("invert: expected non-zero number");if(t<=oh)throw Error("invert: expected positive modulus, got "+t);let r=ow(e,t),i=t,n=oh,s=od;for(;r!==oh;){let e=i/r,t=i%r,o=n-s*e;i=r,r=t,n=s,s=o}if(i!==od)throw Error("invert: does not exist");return ow(n,t)}let o_=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function oC(e,t){let r=void 0!==t?t:e.toString(2).length;return{nBitLength:r,nByteLength:Math.ceil(r/8)}}function oA(e,t,r=!1,i={}){let n;if(e<=oh)throw Error("invalid field: expected ORDER > 0, got "+e);let{nBitLength:s,nByteLength:o}=oC(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:oi(s),ZERO:oh,ONE:od,create:t=>ow(t,e),isValid:t=>{if("bigint"!=typeof t)throw Error("invalid field element: expected bigint, got "+typeof t);return oh<=t&&t<e},is0:e=>e===oh,isOdd:e=>(e&od)===od,neg:t=>ow(-t,e),eql:(e,t)=>e===t,sqr:t=>ow(t*t,e),add:(t,r)=>ow(t+r,e),sub:(t,r)=>ow(t-r,e),mul:(t,r)=>ow(t*r,e),pow:(e,t)=>(function(e,t,r){if(r<oh)throw Error("invalid exponent, negatives unsupported");if(r===oh)return e.ONE;if(r===od)return t;let i=e.ONE,n=t;for(;r>oh;)r&od&&(i=e.mul(i,n)),n=e.sqr(n),r>>=od;return i})(a,e,t),div:(t,r)=>ow(t*oE(r,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>oE(t,e),sqrt:i.sqrt||(t=>(n||(n=function(e){if(e%og===of){let t=(e+od)/og;return function(e,r){let i=e.pow(r,t);if(!e.eql(e.sqr(i),r))throw Error("Cannot find square root");return i}}if(e%oy===om){let t=(e-om)/oy;return function(e,r){let i=e.mul(r,op),n=e.pow(i,t),s=e.mul(r,n),o=e.mul(e.mul(s,op),n),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,i;let n=(e-od)/op;for(t=e-od,r=0;t%op===oh;t/=op,r++);for(i=op;i<e&&ob(i,n,e)!==e-od;i++)if(i>1e3)throw Error("Cannot find square root: likely non-prime P");if(1===r){let t=(e+od)/og;return function(e,r){let i=e.pow(r,t);if(!e.eql(e.sqr(i),r))throw Error("Cannot find square root");return i}}
899let s=(t+od)/op;return function(e,o){if(e.pow(o,n)===e.neg(e.ONE))throw Error("Cannot find square root");let a=r,c=e.pow(e.mul(e.ONE,i),t),l=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(c,od<<BigInt(a-t-1));c=e.sqr(r),l=e.mul(l,r),u=e.mul(u,c),a=t}return l}}(e)}(e)),n(a,t))),invertBatch:e=>(function(e,t){let r=Array(t.length),i=t.reduce((t,i,n)=>e.is0(i)?t:(r[n]=t,e.mul(t,i)),e.ONE),n=e.inv(i);return t.reduceRight((t,i,n)=>e.is0(i)?t:(r[n]=e.mul(t,r[n]),e.mul(t,i)),n),r})(a,e),cmov:(e,t,r)=>r?t:e,toBytes:e=>r?s6(e,o):s8(e,o),fromBytes:e=>{if(e.length!==o)throw Error("Field.fromBytes: expected "+o+" bytes, got "+e.length);return r?s5(e):s3(e)}});return Object.freeze(a)}function oI(e){if("bigint"!=typeof e)throw Error("field order must be bigint");return Math.ceil(e.toString(2).length/8)}function oS(e){let t=oI(e);return t+Math.ceil(t/2)}let oN=BigInt(0),oO=BigInt(1);function ox(e,t){let r=t.negate();return e?r:t}function oT(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw Error("invalid window size, expected [1.."+t+"], got W="+e)}function oR(e,t){return oT(e,t),{windows:Math.ceil(t/e)+1,windowSize:2**(e-1)}}let oP=new WeakMap,ok=new WeakMap;function oD(e){return ok.get(e)||1}function oM(e){return oc(e.Fp,o_.reduce((e,t)=>(e[t]="function",e),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),oc(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...oC(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}BigInt(0),BigInt(1),BigInt(2),BigInt(8);let oU=BigInt(0),oL=BigInt(1),oB=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949");BigInt(0);let oj=BigInt(1),o$=BigInt(2),oF=BigInt(3),oq=BigInt(5);BigInt(8);let oz=function(e){let t=(oc(e,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...e})),{P:r}=t,i=e=>ow(e,r),n=t.montgomeryBits,s=Math.ceil(n/8),o=t.nByteLength,a=t.adjustScalarBytes||(e=>e),c=t.powPminus2||(e=>ob(e,r-BigInt(2),r));function l(e,t,r){let n=i(e*(t-r));return[t=i(t-n),r=i(r+n)]}let u=(t.a-BigInt(2))/BigInt(4);function h(e,t){let h=function(e,t){ot("u",e,oU,r),ot("scalar",t,oU,r);let s=oL,o=oU,a=e,h=oL,d=oU,p;for(let r=BigInt(n-1);r>=oU;r--){let n=t>>r&oL;d^=n,s=(p=l(d,s,a))[0],a=p[1],o=(p=l(d,o,h))[0],h=p[1],d=n;let c=s+o,f=i(c*c),g=s-o,m=i(g*g),y=f-m,w=a+h,b=i((a-h)*c),v=i(w*g),E=b+v,_=b-v;a=i(E*E),h=i(e*i(_*_)),s=i(f*m),o=i(y*(f+i(u*y)))}return s=(p=l(d,s,a))[0],a=p[1],o=(p=l(d,o,h))[0],h=p[1],i(s*c(o))}(function(e){let t=s4("u coordinate",e,s);return 32===o&&(t[31]&=127),s5(t)}(t),function(e){let t=s4("scalar",e),r=t.length;if(r!==s&&r!==o)throw Error("invalid scalar, expected "+s+" or "+o+" bytes, got "+r);return s5(a(t))}(e));if(h===oU)throw Error("invalid private or public key received");return s6(i(h),s)}let d=s6(i(t.Gu),s);function p(e){return h(e,d)}return{scalarMult:h,scalarMultBase:p,getSharedSecret:(e,t)=>h(e,t),getPublicKey:e=>p(e),utils:{randomPrivateKey:()=>t.randomBytes(t.nByteLength)},GuBytes:d}}({P:oB,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:e=>{let{pow_p_5_8:t,b2:r}=function(e){let t=BigInt(10),r=BigInt(20),i=BigInt(40),n=BigInt(80),s=e*e%oB*e%oB,o=ov(s,o$,oB)*s%oB,a=ov(o,oj,oB)*e%oB,c=ov(a,oq,oB)*a%oB,l=ov(c,t,oB)*c%oB,u=ov(l,r,oB)*l%oB,h=ov(u,i,oB)*u%oB,d=ov(h,n,oB)*h%oB,p=ov(d,n,oB)*h%oB,f=ov(p,t,oB)*c%oB;return{pow_p_5_8:ov(f,o$,oB)*e%oB,b2:s}}(e);return ow(ov(t,oF,oB)*r,oB)},adjustScalarBytes:function(e){return e[0]&=248,e[31]&=127,e[31]|=64,e},randomBytes:nX});function oH(e){void 0!==e.lowS&&sG("lowS",e.lowS),void 0!==e.prehash&&sG("prehash",e.prehash)}let{bytesToNumberBE:oW,hexToBytes:oV}=ou;class oK extends Error{constructor(e=""){super(e)}}let oZ={Err:oK,_tlv:{encode:(e,t)=>{let{Err:r}=oZ;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(1&t.length)throw new r("tlv.encode: unpadded data");let i=t.length/2,n=sX(i);if(n.length/2&128)throw new r("tlv.encode: long form length too big");let s=i>127?sX(n.length/2|128):"";return sX(e)+s+n+t},decode(e,t){let{Err:r}=oZ,i=0;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(t.length<2||t[i++]!==e)throw new r("tlv.decode: wrong tlv");let n=t[i++],s=0;if(128&n){let e=127&n;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(i,i+e);
899if(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(i+=e,s<128)throw new r("tlv.decode(long): not minimal encoding")}else s=n;let o=t.subarray(i,i+s);if(o.length!==s)throw new r("tlv.decode: wrong value length");return{v:o,l:t.subarray(i+s)}}},_int:{encode(e){let{Err:t}=oZ;if(e<oG)throw new t("integer: negative integers are not allowed");let r=sX(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}=oZ;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 oW(e)}},toSig(e){let{Err:t,_int:r,_tlv:i}=oZ,n="string"==typeof e?oV(e):e;sZ(n);let{v:s,l:o}=i.decode(48,n);if(o.length)throw new t("invalid signature: left bytes after parsing");let{v:a,l:c}=i.decode(2,s),{v:l,l:u}=i.decode(2,c);if(u.length)throw new t("invalid signature: left bytes after parsing");return{r:r.decode(a),s:r.decode(l)}},hexFromSig(e){let{_tlv:t,_int:r}=oZ,i=t.encode(2,r.encode(e.r)),n=t.encode(2,r.encode(e.s));return t.encode(48,i+n)}},oG=BigInt(0),oY=BigInt(1);BigInt(2);let oJ=BigInt(3);BigInt(4);let oX=oA(BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff")),oQ=function(e,t){let r=t=>(function(e){let t=function(e){let t=oM(e);return oc(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}(e),{Fp:r,n:i}=t,n=r.BYTES+1,s=2*r.BYTES+1;function o(e){return ow(e,i)}let{ProjectivePoint:a,normPrivateKeyToScalar:c,weierstrassEquation:l,isWithinCurveOrder:u}=function(e){var t;let r=function(e){let t=oM(e);oc(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:r,Fp:i,a:n}=t;if(r){if(!i.eql(n,i.ZERO))throw Error("invalid endomorphism, can only be defined for Koblitz curves that have a=0");if("object"!=typeof r||"bigint"!=typeof r.beta||"function"!=typeof r.splitScalar)throw Error("invalid endomorphism, expected beta: bigint and splitScalar: function")}return Object.freeze({...t})}(e),{Fp:i}=r,n=oA(r.n,r.nBitLength),s=r.toBytes||((e,t,r)=>{let n=t.toAffine();return s9(Uint8Array.from([4]),i.toBytes(n.x),i.toBytes(n.y))}),o=r.fromBytes||(e=>{let t=e.subarray(1);return{x:i.fromBytes(t.subarray(0,i.BYTES)),y:i.fromBytes(t.subarray(i.BYTES,2*i.BYTES))}});function a(e){let{a:t,b:n}=r,s=i.sqr(e),o=i.mul(s,e);return i.add(i.add(o,i.mul(e,t)),n)}
899if(!i.eql(i.sqr(r.Gy),a(r.Gx)))throw Error("bad generator point: equation left != right");function c(e){let t;let{allowedPrivateKeyLengths:i,nByteLength:n,wrapPrivateKey:s,n:o}=r;if(i&&"bigint"!=typeof e){if(sK(e)&&(e=sJ(e)),"string"!=typeof e||!i.includes(e.length))throw Error("invalid private key");e=e.padStart(2*n,"0")}try{t="bigint"==typeof e?e:s3(s4("private key",e,n))}catch{throw Error("invalid private key, expected hex or "+n+" bytes, got "+typeof e)}return s&&(t=ow(t,o)),ot("private key",t,oY,o),t}function l(e){if(!(e instanceof d))throw Error("ProjectivePoint expected")}let u=ol((e,t)=>{let{px:r,py:n,pz:s}=e;if(i.eql(s,i.ONE))return{x:r,y:n};let o=e.is0();null==t&&(t=o?i.ONE:i.inv(s));let a=i.mul(r,t),c=i.mul(n,t),l=i.mul(s,t);if(o)return{x:i.ZERO,y:i.ZERO};if(!i.eql(l,i.ONE))throw Error("invZ was invalid");return{x:a,y:c}}),h=ol(e=>{if(e.is0()){if(r.allowInfinityPoint&&!i.is0(e.py))return;throw Error("bad point: ZERO")}let{x:t,y:n}=e.toAffine();if(!i.isValid(t)||!i.isValid(n))throw Error("bad point: x or y not FE");let s=i.sqr(n),o=a(t);if(!i.eql(s,o))throw Error("bad point: equation left != right");if(!e.isTorsionFree())throw Error("bad point: not in prime-order subgroup");return!0});class d{constructor(e,t,r){if(this.px=e,this.py=t,this.pz=r,null==e||!i.isValid(e))throw Error("x required");if(null==t||!i.isValid(t))throw Error("y required");if(null==r||!i.isValid(r))throw Error("z required");Object.freeze(this)}static fromAffine(e){let{x:t,y:r}=e||{};if(!e||!i.isValid(t)||!i.isValid(r))throw Error("invalid affine point");if(e instanceof d)throw Error("projective point not allowed");let n=e=>i.eql(e,i.ZERO);return n(t)&&n(r)?d.ZERO:new d(t,r,i.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(e){let t=i.invertBatch(e.map(e=>e.pz));return e.map((e,r)=>e.toAffine(t[r])).map(d.fromAffine)}static fromHex(e){let t=d.fromAffine(o(s4("pointHex",e)));return t.assertValidity(),t}static fromPrivateKey(e){return d.BASE.multiply(c(e))}static msm(e,t){return function(e,t,r,i){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)})}(i,t),r.length!==i.length)throw Error("arrays of points and scalars must have equal length");let n=e.ZERO,s=or(BigInt(r.length)),o=s>12?s-3:s>4?s-2:s?2:1,a=(1<<o)-1,c=Array(a+1).fill(n),l=Math.floor((t.BITS-1)/o)*o,u=n;for(let e=l;e>=0;e-=o){c.fill(n);for(let t=0;t<i.length;t++){let n=Number(i[t]>>BigInt(e)&BigInt(a));c[n]=c[n].add(r[t])}let t=n;for(let e=c.length-1,r=n;e>0;e--)r=r.add(c[e]),t=t.add(r);if(u=u.add(t),0!==e)for(let e=0;e<o;e++)u=u.double()}return u}(d,n,e,t)}_setWindowSize(e){f.setWindowSize(this,e)}assertValidity(){h(this)}hasEvenY(){let{y:e}=this.toAffine();if(i.isOdd)return!i.isOdd(e);throw Error("Field doesn't support isOdd")}equals(e){l(e);let{px:t,py:r,pz:n}=this,{px:s,py:o,pz:a}=e,c=i.eql(i.mul(t,a),i.mul(s,n)),u=i.eql(i.mul(r,a),i.mul(o,n));return c&&u}negate(){return new d(this.px,i.neg(this.py),this.pz)}double(){let{a:e,b:t}=r,n=i.mul(t,oJ),{px:s,py:o,pz:a}=this,c=i.ZERO,l=i.ZERO,u=i.ZERO,h=i.mul(s,s),p=i.mul(o,o),f=i.mul(a,a),g=i.mul(s,o);return g=i.add(g,g),u=i.mul(s,a),u=i.add(u,u),c=i.mul(e,u),l=i.mul(n,f),l=i.add(c,l),c=i.sub(p,l),l=i.add(p,l),l=i.mul(c,l),c=i.mul(g,c),u=i.mul(n,u),f=i.mul(e,f),g=i.sub(h,f),g=i.mul(e,g),g=i.add(g,u),u=i.add(h,h),h=i.add(u,h),h=i.add(h,f),h=i.mul(h,g),l=i.add(l,h),f=i.mul(o,a),f=i.add(f,f),h=i.mul(f,g),c=i.sub(c,h),u=i.mul(f,p),u=i.add(u,u),new d(c,l,u=i.add(u,u))}add(e){l(e);let{px:t,py:n,pz:s}=this,{px:o,py:a,pz:c}=e,u=i.ZERO,h=i.ZERO,p=i.ZERO,f=r.a,g=i.mul(r.b,oJ),m=i.mul(t,o),y=i.mul(n,a),w=i.mul(s,c),b=i.add(t,n),v=i.add(o,a);b=i.mul(b,v),v=i.add(m,y),b=i.sub(b,v),v=i.add(t,s);let E=i.add(o,c);return v=i.mul(v,E),E=i.add(m,w),v=i.sub(v,E),E=i.add(n,s),u=i.add(a,c),E=i.mul(E,u),u=i.add(y,w),E=i.sub(E,u),p=i.mul(f,v),u=i.mul(g,w),p=i.add(u,p),u=i.sub(y,p),p=i.add(y,p),h=i.mul(u,p),y=i.add(m,m),y=i.add(y,m),w=i.mul(f,w),v=i.mul(g,v),y=i.add(y,w),w=i.sub(m,w),w=i.mul(f,w),v=i.add(v,w),m=i.mul(y,v),h=i.add(h,m),m=i.mul(E,v),u=i.mul(b,u),u=i.sub(u,m),m=i.mul(b,y),p=i.mul(E,p),new d(u,h,p=i.add(p,m))}subtract(e){return this.add(e.negate())}is0(){return this.equals(d.ZERO)}wNAF(e){return f.wNAFCached(this,e,d.normalizeZ)}multiplyUnsafe(e){let{endo:t,n:n}=r;ot("scalar",e,oG,n);let s=d.ZERO;if(e===oG)return s;if(this.is0()||e===oY)return this;if(!t||f.hasPrecomputes(this))return f.wNAFCachedUnsafe(this,e,d.normalizeZ);
899let{k1neg:o,k1:a,k2neg:c,k2:l}=t.splitScalar(e),u=s,h=s,p=this;for(;a>oG||l>oG;)a&oY&&(u=u.add(p)),l&oY&&(h=h.add(p)),p=p.double(),a>>=oY,l>>=oY;return o&&(u=u.negate()),c&&(h=h.negate()),h=new d(i.mul(h.px,t.beta),h.py,h.pz),u.add(h)}multiply(e){let t,n;let{endo:s,n:o}=r;if(ot("scalar",e,oY,o),s){let{k1neg:r,k1:o,k2neg:a,k2:c}=s.splitScalar(e),{p:l,f:u}=this.wNAF(o),{p:h,f:p}=this.wNAF(c);l=f.constTimeNegate(r,l),h=f.constTimeNegate(a,h),h=new d(i.mul(h.px,s.beta),h.py,h.pz),t=l.add(h),n=u.add(p)}else{let{p:r,f:i}=this.wNAF(e);t=r,n=i}return d.normalizeZ([t,n])[0]}multiplyAndAddUnsafe(e,t,r){let i=d.BASE,n=(e,t)=>t!==oG&&t!==oY&&e.equals(i)?e.multiply(t):e.multiplyUnsafe(t),s=n(this,t).add(n(e,r));return s.is0()?void 0:s}toAffine(e){return u(this,e)}isTorsionFree(){let{h:e,isTorsionFree:t}=r;if(e===oY)return!0;if(t)return t(d,this);throw Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:e,clearCofactor:t}=r;return e===oY?this:t?t(d,this):this.multiplyUnsafe(r.h)}toRawBytes(e=!0){return sG("isCompressed",e),this.assertValidity(),s(d,this,e)}toHex(e=!0){return sG("isCompressed",e),sJ(this.toRawBytes(e))}}d.BASE=new d(r.Gx,r.Gy,i.ONE),d.ZERO=new d(i.ZERO,i.ONE,i.ZERO);let p=r.nBitLength,f=(t=r.endo?Math.ceil(p/2):p,{constTimeNegate:ox,hasPrecomputes:e=>1!==oD(e),unsafeLadder(e,t,r=d.ZERO){let i=e;for(;t>oN;)t&oO&&(r=r.add(i)),i=i.double(),t>>=oO;return r},precomputeWindow(e,r){let{windows:i,windowSize:n}=oR(r,t),s=[],o=e,a=o;for(let e=0;e<i;e++){a=o,s.push(a);for(let e=1;e<n;e++)a=a.add(o),s.push(a);o=a.double()}return s},wNAF(e,r,i){let{windows:n,windowSize:s}=oR(e,t),o=d.ZERO,a=d.BASE,c=BigInt(2**e-1),l=2**e,u=BigInt(e);for(let e=0;e<n;e++){let t=e*s,n=Number(i&c);i>>=u,n>s&&(n-=l,i+=oO);let h=t+Math.abs(n)-1,d=e%2!=0,p=n<0;0===n?a=a.add(ox(d,r[t])):o=o.add(ox(p,r[h]))}return{p:o,f:a}},wNAFUnsafe(e,r,i,n=d.ZERO){let{windows:s,windowSize:o}=oR(e,t),a=BigInt(2**e-1),c=2**e,l=BigInt(e);for(let e=0;e<s;e++){let t=e*o;if(i===oN)break;let s=Number(i&a);if(i>>=l,s>o&&(s-=c,i+=oO),0===s)continue;let u=r[t+Math.abs(s)-1];s<0&&(u=u.negate()),n=n.add(u)}return n},getPrecomputes(e,t,r){let i=oP.get(t);return i||(i=this.precomputeWindow(t,e),1!==e&&oP.set(t,r(i))),i},wNAFCached(e,t,r){let i=oD(e);return this.wNAF(i,this.getPrecomputes(i,e,r),t)},wNAFCachedUnsafe(e,t,r,i){let n=oD(e);return 1===n?this.unsafeLadder(e,t,i):this.wNAFUnsafe(n,this.getPrecomputes(n,e,r),t,i)},setWindowSize(e,r){oT(r,t),ok.set(e,r),oP.delete(e)}});return{CURVE:r,ProjectivePoint:d,normPrivateKeyToScalar:c,weierstrassEquation:a,isWithinCurveOrder:function(e){return oe(e,oY,r.n)}}}({...t,toBytes(e,t,i){let n=t.toAffine(),s=r.toBytes(n.x);return sG("isCompressed",i),i?s9(Uint8Array.from([t.hasEvenY()?2:3]),s):s9(Uint8Array.from([4]),s,r.toBytes(n.y))},fromBytes(e){let t=e.length,i=e[0],o=e.subarray(1);if(t===n&&(2===i||3===i)){let e;let t=s3(o);if(!oe(t,oY,r.ORDER))throw Error("Point is not on curve");let n=l(t);try{e=r.sqrt(n)}catch(e){throw Error("Point is not on curve"+(e instanceof Error?": "+e.message:""))}return(1&i)==1!=((e&oY)===oY)&&(e=r.neg(e)),{x:t,y:e}}if(t===s&&4===i)return{x:r.fromBytes(o.subarray(0,r.BYTES)),y:r.fromBytes(o.subarray(r.BYTES,2*r.BYTES))};throw Error("invalid Point, expected length of "+n+", or uncompressed "+s+", got "+t)}}),h=e=>sJ(s8(e,t.nByteLength)),d=(e,t,r)=>s3(e.slice(t,r));class p{constructor(e,t,r){this.r=e,this.s=t,this.recovery=r,this.assertValidity()}static fromCompact(e){let r=t.nByteLength;return new p(d(e=s4("compactSignature",e,2*r),0,r),d(e,r,2*r))}static fromDER(e){let{r:t,s:r}=oZ.toSig(s4("DER",e));return new p(t,r)}assertValidity(){ot("r",this.r,oY,i),ot("s",this.s,oY,i)}addRecoveryBit(e){return new p(this.r,this.s,e)}recoverPublicKey(e){let{r:n,s:s,recovery:c}=this,l=m(s4("msgHash",e));if(null==c||![0,1,2,3].includes(c))throw Error("recovery id invalid");let u=2===c||3===c?n+t.n:n;if(u>=r.ORDER)throw Error("recovery id 2 or 3 invalid");let d=(1&c)==0?"02":"03",p=a.fromHex(d+h(u)),f=oE(u,i),g=o(-l*f),y=o(s*f),w=a.BASE.multiplyAndAddUnsafe(p,g,y);if(!w)throw Error("point at infinify");return w.assertValidity(),w}hasHighS(){return this.s>i>>oY}normalizeS(){return this.hasHighS()?new p(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return s2(this.toDERHex())}toDERHex(){return oZ.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return s2(this.toCompactHex())}toCompactHex(){return h(this.r)+h(this.s)}}function f(e){let t=sK(e),r="string"==typeof e,i=(t||r)&&e.length;return t?i===n||i===s:r?i===2*n||i===2*s:e instanceof a}let g=t.bits2int||function(e){if(e.length>8192)throw Error("input is too large");let r=s3(e),i=8*e.length-t.nBitLength;return i>0?r>>BigInt(i):r},m=t.bits2int_modN||function(e){return o(g(e))},y=oi(t.nBitLength);function w(e){return ot("num < 2^"+t.nBitLength,e,oG,y),s8(e,t.nByteLength)}let b={lowS:t.lowS,prehash:!1},v={lowS:t.lowS,prehash:!1};return a.BASE._setWindowSize(8),{CURVE:t,getPublicKey:function(e,t=!0){return a.fromPrivateKey(e).toRawBytes(t)},getSharedSecret:function(e,t,r=!0){if(f(e))throw Error("first arg must be private key");if(!f(t))throw Error("second arg must be public key");return a.fromHex(t).multiply(c(e)).toRawBytes(r)},sign:function(e,n,s=b){let{seed:l,k2sig:h}=function(e,n,s=b){if(["recovered","canonical"].some(e=>e in s))throw Error("sign() legacy options not supported");let{hash:l,randomBytes:h}=t,{lowS:d,prehash:f,extraEntropy:y}=s;null==d&&(d=!0),e=s4("msgHash",e),oH(s),f&&(e=s4("prehashed msgHash",l(e)));let v=m(e),E=c(n),_=[w(E),w(v)];if(null!=y&&!1!==y){let e=!0===y?h(r.BYTES):y;_.push(s4("extraEntropy",e))}return{seed:s9(..._),k2sig:function(e){let t=g(e);
899if(!u(t))return;let r=oE(t,i),n=a.BASE.multiply(t).toAffine(),s=o(n.x);if(s===oG)return;let c=o(r*o(v+s*E));if(c===oG)return;let l=(n.x===s?0:2)|Number(n.y&oY),h=c;return d&&c>i>>oY&&(h=c>i>>oY?o(-c):c,l^=1),new p(s,h,l)}}}(e,n,s);return oo(t.hash.outputLen,t.nByteLength,t.hmac)(l,h)},verify:function(e,r,n,s=v){let c,l;r=s4("msgHash",r),n=s4("publicKey",n);let{lowS:u,prehash:h,format:d}=s;if(oH(s),"strict"in s)throw Error("options.strict was renamed to lowS");if(void 0!==d&&"compact"!==d&&"der"!==d)throw Error("format must be compact or der");let f="string"==typeof e||sK(e),g=!f&&!d&&"object"==typeof e&&null!==e&&"bigint"==typeof e.r&&"bigint"==typeof e.s;if(!f&&!g)throw Error("invalid signature, expected Uint8Array, hex string or Signature instance");try{if(g&&(c=new p(e.r,e.s)),f){try{"compact"!==d&&(c=p.fromDER(e))}catch(e){if(!(e instanceof oZ.Err))throw e}c||"der"===d||(c=p.fromCompact(e))}l=a.fromHex(n)}catch{return!1}if(!c||u&&c.hasHighS())return!1;h&&(r=t.hash(r));let{r:y,s:w}=c,b=m(r),E=oE(w,i),_=o(b*E),C=o(y*E),A=a.BASE.multiplyAndAddUnsafe(l,_,C)?.toAffine();return!!A&&o(A.x)===y},ProjectivePoint:a,Signature:p,utils:{isValidPrivateKey(e){try{return c(e),!0}catch{return!1}},normPrivateKeyToScalar:c,randomPrivateKey:()=>{let e=oS(t.n);return function(e,t,r=!1){let i=e.length,n=oI(t),s=oS(t);if(i<16||i<s||i>1024)throw Error("expected "+s+"-1024 bytes of input, got "+i);let o=ow(r?s5(e):s3(e),t-od)+od;return r?s6(o,n):s8(o,n)}(t.randomBytes(e),t.n)},precompute:(e=8,t=a.BASE)=>(t._setWindowSize(e),t.multiply(BigInt(3)),t)}}})({...e,hash:t,hmac:(e,...r)=>sD(t,e,function(...e){let t=0;for(let r=0;r<e.length;r++){let i=e[r];nD(i),t+=i.length}let r=new Uint8Array(t);for(let t=0,i=0;t<e.length;t++){let n=e[t];r.set(n,i),i+=n.length}return r}(...r)),randomBytes:nX});return{...r(t),create:r}}({a:oX.create(BigInt("-3")),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Fp:oX,n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5"),h:BigInt(1),lowS:!1},sz),o0="base10",o1="base16",o2="base64pad",o3="base64url",o5="utf8";function o8(){return nd(nX(32),o1)}function o6(e){return nd(sz(nh(e,o5)),o1)}function o4(e){return Number(nd(e,o0))}function o9(e){return e.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function o7(e){let t=e.replace(/-/g,"+").replace(/_/g,"/"),r=(4-t.length%4)%4;return t+"=".repeat(r)}function ae(e){if(2===o4(e.type))return nd(rX([e.type,e.sealed]),o2);if(1===o4(e.type)){if(typeof e.senderPublicKey>"u")throw Error("Missing sender public key for type 1 envelope");return nd(rX([e.type,e.senderPublicKey,e.iv,e.sealed]),o2)}return nd(rX([e.type,e.iv,e.sealed]),o2)}function at(e){let t=nh((e.encoding||o2)===o3?o7(e.encoded):e.encoded,o2),r=t.slice(0,1);if(1===o4(r)){let e=t.slice(1,33),i=t.slice(33,45);return{type:r,sealed:t.slice(45),iv:i,senderPublicKey:e}}if(2===o4(r))return{type:r,sealed:t.slice(1),iv:nX(12)};let i=t.slice(1,13);return{type:r,sealed:t.slice(13),iv:i}}function ar(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 an(e){return e?.relay||{protocol:"irn"}}function as(e){let t=np[e];if(typeof t>"u")throw Error(`Relay Protocol not supported: ${e}`);return t}function ao(e){var t;if(!e.includes("wc:")){let t=nP(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(":"),i=-1!==e.indexOf("?")?e.indexOf("?"):void 0,n=e.substring(0,r),s=e.substring(r+1,i).split("@"),o=new URLSearchParams("u">typeof i?e.substring(i):""),a={};o.forEach((e,t)=>{a[t]=e});let c="string"==typeof a.methods?a.methods.split(","):void 0;return{protocol:n,topic:(t=s[0]).startsWith("//")?t.substring(2):t,version:parseInt(s[1],10),symKey:a.symKey,relay:function(e,t="-"){let r={},i="relay"+t;return Object.keys(e).forEach(t=>{if(t.startsWith(i)){let n=t.replace(i,""),s=e[t];r[n]=s}}),r}(a),methods:c,expiryTimestamp:a.expiryTimestamp?parseInt(a.expiryTimestamp,10):void 0}}function aa(e){let t=new URLSearchParams,r=function(e,t="-"){let r={};return Object.keys(e).forEach(i=>
899{e[i]&&(r["relay"+t+i]=e[i])}),r}(e.relay);Object.keys(r).sort().forEach(e=>{t.set(e,r[e])}),t.set("symKey",e.symKey),e.expiryTimestamp&&t.set("expiryTimestamp",e.expiryTimestamp.toString()),e.methods&&t.set("methods",e.methods.join(","));let i=t.toString();return`${e.protocol}:${e.topic}@${e.version}?${i}`}Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;let ac={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}},al={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 au(e,t){let{message:r,code:i}=al[e];return{message:t?`${r} ${t}`:r,code:i}}function ah(e,t){let{message:r,code:i}=ac[e];return{message:t?`${r} ${t}`:r,code:i}}function ad(e){return typeof e>"u"}function ap(e,t){return!!(t&&ad(e))||"string"==typeof e&&!!e.trim().length}function af(e){return"u">typeof e}function ag(){let e=nv();return new Promise(t=>{switch(e){case nm.browser:t(nb()&&navigator?.onLine);break;case nm.reactNative:t(am());break;case nm.node:default:t(!0)}})}async function am(){if(nw()&&"u">typeof r.g&&null!=r.g&&r.g.NetInfo){let e=await (null==r.g?void 0:r.g.NetInfo.fetch());return e?.isConnected}return!0}let ay="INTERNAL_ERROR",aw="SERVER_ERROR",ab=[-32700,-32600,-32601,-32602,-32603],av={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"},[ay]:{code:-32603,message:"Internal error"},[aw]:{code:-32e3,message:"Server error"}};function aE(e){return Object.keys(av).includes(e)?av[e]:av[aw]}function a_(e,t,r){return e.message.includes("getaddrinfo ENOTFOUND")||e.message.includes("connect ECONNREFUSED")?Error(`Unavailable ${r} RPC url at ${t}`):e}var aC=r(13303);
899function aA(e=3){return Date.now()*Math.pow(10,e)+Math.floor(Math.random()*Math.pow(10,e))}function aI(e=6){return BigInt(aA(e))}function aS(e,t,r){return{id:r||aA(),jsonrpc:"2.0",method:e,params:t}}function aN(e,t){return{id:e,jsonrpc:"2.0",result:t}}function aO(e,t,r){var i,n,s;return{id:e,jsonrpc:"2.0",error:void 0===(i=t)?aE(ay):("string"==typeof i&&(i=Object.assign(Object.assign({},aE(aw)),{message:i})),void 0!==r&&(i.data=r),n=i.code,ab.includes(n)&&(s=i.code,i=Object.values(av).find(e=>e.code===s)||av[aw]),i)}}class ax{}class aT extends ax{constructor(){super()}}class aR extends aT{constructor(e){super()}}function aP(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 ak(e){return aP(e,"^https?:")}function aD(e){return aP(e,"^wss?:")}function aM(e){return"object"==typeof e&&"id"in e&&"jsonrpc"in e&&"2.0"===e.jsonrpc}function aU(e){return aM(e)&&"method"in e}function aL(e){return aM(e)&&(aB(e)||aj(e))}function aB(e){return"result"in e}function aj(e){return"error"in e}class a$ extends aR{constructor(e){super(e),this.events=new S.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(aS(e.method,e.params||[],e.id||aI().toString()),t)}async requestStrict(e,t){return new Promise(async(r,i)=>{if(!this.connection.connected)try{await this.open()}catch(e){i(e)}this.events.on(`${e.id}`,e=>{aj(e)?i(e.error):r(e.result)});try{await this.connection.send(e,t)}catch(e){i(e)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),aL(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)}}let aF=()=>"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,aq=e=>e.split("?")[0],az="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(16854);class aH{constructor(e){if(this.url=e,this.events=new S.EventEmitter,this.registering=!1,!aD(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)=>{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,X.u)(e))}catch(t){this.onError(e.id,t)}}register(e=this.url){if(!aD(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)=>
899{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 i=(0,aC.isReactNative)()?void 0:{rejectUnauthorized:!RegExp("wss?://localhost(:d{2,5})?").test(e)},n=new az(e,[],i);aF()?n.onerror=e=>{r(this.emitError(e.error))}:n.on("error",e=>{r(this.emitError(e))}),n.onopen=()=>{this.onOpen(n),t(n)}})}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,X.D)(e.data):e.data;this.events.emit("payload",t)}onError(e,t){let r=this.parseError(t),i=aO(e,r.message||r.toString());this.events.emit("payload",i)}parseError(e,t=this.url){return a_(e,aq(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: ${aq(this.url)}`));return this.events.emit("register_error",t),t}}var aW=r(82957).Buffer,aV=r(25566);let aK="core",aZ=`wc@2:${aK}:`,aG={logger:"error"},aY={database:":memory:"},aJ="client_ed25519_seed",aX=O.ONE_DAY,aQ=O.SIX_HOURS,a0="wss://relay.walletconnect.org",a1={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"},a2={payload:"payload",connect:"connect",disconnect:"disconnect",error:"error"},a3="2.19.2",a5={link_mode:"link_mode",relay:"relay"},a8={inbound:"inbound",outbound:"outbound"},a6="WALLETCONNECT_LINK_MODE_APPS",a4={created:"subscription_created",deleted:"subscription_deleted",sync:"subscription_sync",resubscribed:"subscription_resubscribed"},a9=(O.FIVE_SECONDS,{wc_pairingDelete:{req:{ttl:O.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:O.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:O.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:O.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:O.ONE_DAY,prompt:!1,tag:0},res:{ttl:O.ONE_DAY,prompt:!1,tag:0}}}),a7={create:"pairing_create",expire:"pairing_expire",delete:"pairing_delete",ping:"pairing_ping"},ce={created:"history_created",updated:"history_updated",deleted:"history_deleted",sync:"history_sync"},ct={created:"expirer_created",deleted:"expirer_deleted",expired:"expirer_expired",sync:"expirer_sync"},cr="https://verify.walletconnect.org",ci=`${cr}/v3`,cn=["https://verify.walletconnect.com",cr],cs={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"},co={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"},ca={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",publishing_session_approve:"publishing_session_approve",session_approve_publish_success:"session_approve_publish_success",store_session:"store_session",publishing_session_settle:"publishing_session_settle",session_settle_publish_success:"session_settle_publish_success"},cc={no_internet_connection:"no_internet_connection",proposal_expired:"proposal_expired",subscribe_session_topic_failure:"subscribe_session_topic_failure",session_approve_publish_failure:"session_approve_publish_failure",session_settle_publish_failure:"session_settle_publish_failure",session_approve_namespace_validation_failure:"session_approve_namespace_validation_failure",proposal_not_found:"proposal_not_found"},cl={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"}
899,cu={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 ch=function(e,t){if(e.length>=255)throw TypeError("Alphabet too long");for(var r=new Uint8Array(256),i=0;i<r.length;i++)r[i]=255;for(var n=0;n<e.length;n++){var s=e.charAt(n),o=s.charCodeAt(0);if(255!==r[o])throw TypeError(s+" is ambiguous");r[o]=n}var a=e.length,c=e.charAt(0),l=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function h(e){if("string"!=typeof e)throw TypeError("Expected String");if(0===e.length)return new Uint8Array;var t=0;if(" "!==e[0]){for(var i=0,n=0;e[t]===c;)i++,t++;for(var s=(e.length-t)*l+1>>>0,o=new Uint8Array(s);e[t];){var u=r[e.charCodeAt(t)];if(255===u)return;for(var h=0,d=s-1;(0!==u||h<n)&&-1!==d;d--,h++)u+=a*o[d]>>>0,o[d]=u%256>>>0,u=u/256>>>0;if(0!==u)throw Error("Non-zero carry");n=h,t++}if(" "!==e[t]){for(var p=s-n;p!==s&&0===o[p];)p++;for(var f=new Uint8Array(i+(s-p)),g=i;p!==s;)f[g++]=o[p++];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"";for(var r=0,i=0,n=0,s=t.length;n!==s&&0===t[n];)n++,r++;for(var o=(s-n)*u+1>>>0,l=new Uint8Array(o);n!==s;){for(var h=t[n],d=0,p=o-1;(0!==h||d<i)&&-1!==p;p--,d++)h+=256*l[p]>>>0,l[p]=h%a>>>0,h=h/a>>>0;if(0!==h)throw Error("Non-zero carry");i=d,n++}for(var f=o-i;f!==o&&0===l[f];)f++;for(var g=c.repeat(r);f<o;++f)g+=e.charAt(l[f]);return g},decodeUnsafe:h,decode:function(e){var r=h(e);if(r)return r;throw Error(`Non-${t} character`)}}};let cd=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")},cp=e=>new TextEncoder().encode(e),cf=e=>new TextDecoder().decode(e);class cg{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 cm{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 cw(this,e)}}class cy{constructor(e){this.decoders=e}or(e){return cw(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 cw=(e,t)=>new cy({...e.decoders||{[e.prefix]:e},...t.decoders||{[t.prefix]:t}});
899class cb{constructor(e,t,r,i){this.name=e,this.prefix=t,this.baseEncode=r,this.baseDecode=i,this.encoder=new cg(e,t,r),this.decoder=new cm(e,t,i)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}let cv=({name:e,prefix:t,encode:r,decode:i})=>new cb(e,t,r,i),cE=({prefix:e,name:t,alphabet:r})=>{let{encode:i,decode:n}=ch(r,t);return cv({prefix:e,name:t,encode:i,decode:e=>cd(n(e))})},c_=(e,t,r,i)=>{let n={};for(let e=0;e<t.length;++e)n[t[e]]=e;let s=e.length;for(;"="===e[s-1];)--s;let o=new Uint8Array(s*r/8|0),a=0,c=0,l=0;for(let t=0;t<s;++t){let s=n[e[t]];if(void 0===s)throw SyntaxError(`Non-${i} character`);c=c<<r|s,(a+=r)>=8&&(a-=8,o[l++]=255&c>>a)}if(a>=r||255&c<<8-a)throw SyntaxError("Unexpected end of data");return o},cC=(e,t,r)=>{let i="="===t[t.length-1],n=(1<<r)-1,s="",o=0,a=0;for(let i=0;i<e.length;++i)for(a=a<<8|e[i],o+=8;o>r;)o-=r,s+=t[n&a>>o];if(o&&(s+=t[n&a<<r-o]),i)for(;s.length*r&7;)s+="=";return s},cA=({name:e,prefix:t,bitsPerChar:r,alphabet:i})=>cv({prefix:t,name:e,encode:e=>cC(e,i,r),decode:t=>c_(t,i,r,e)});var cI=Object.freeze({__proto__:null,identity:cv({prefix:"\0",name:"identity",encode:e=>cf(e),decode:e=>cp(e)})}),cS=Object.freeze({__proto__:null,base2:cA({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1})}),cN=Object.freeze({__proto__:null,base8:cA({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3})}),cO=Object.freeze({__proto__:null,base10:cE({prefix:"9",name:"base10",alphabet:"0123456789"})}),cx=Object.freeze({__proto__:null,base16:cA({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),base16upper:cA({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4})});let cT=cA({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),cR=cA({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),cP=cA({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),ck=cA({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),cD=cA({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),cM=cA({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5});var cU=Object.freeze({__proto__:null,base32:cT,base32upper:cR,base32pad:cP,base32padupper:ck,base32hex:cD,base32hexupper:cM,base32hexpad:cA({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),base32hexpadupper:cA({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),base32z:cA({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5})}),cL=Object.freeze({__proto__:null,base36:cE({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),base36upper:cE({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"})}),cB=Object.freeze({__proto__:null,base58btc:cE({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),base58flickr:cE({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"})});let cj=cA({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6});var c$=Object.freeze({__proto__:null,base64:cj,base64pad:cA({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),base64url:cA({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),base64urlpad:cA({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6})});let cF=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"),cq=cF.reduce((e,t,r)=>(e[r]=t,e),[]),cz=cF.reduce((e,t,r)=>(e[t.codePointAt(0)]=r,e),[]);var cH=Object.freeze({__proto__:null,base256emoji:cv({prefix:"\uD83D\uDE80",name:"base256emoji",encode:function(e){return e.reduce((e,t)=>
899e+=cq[t],"")},decode:function(e){let t=[];for(let r of e){let e=cz[r.codePointAt(0)];if(void 0===e)throw Error(`Non-base256emoji character: ${r}`);t.push(e)}return new Uint8Array(t)}})});function cW(e,t){var r,i=0,t=t||0,n=0,s=t,o=e.length;do{if(s>=o)throw cW.bytes=0,RangeError("Could not decode varint");r=e[s++],i+=n<28?(127&r)<<n:(127&r)*Math.pow(2,n),n+=7}while(r>=128);return cW.bytes=s-t,i}var cV=function e(t,r,i){r=r||[],i=i||0;for(var n=i;t>=2147483648;)r[i++]=255&t|128,t/=128;for(;-128&t;)r[i++]=255&t|128,t>>>=7;return r[i]=0|t,e.bytes=i-n+1,r};let cK=(e,t,r=0)=>(cV(e,t,r),t),cZ=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,cG=(e,t)=>{let r=t.byteLength,i=cZ(e),n=i+cZ(r),s=new Uint8Array(n+r);return cK(e,s,0),cK(r,s,i),s.set(t,n),new cY(e,r,t,s)};class cY{constructor(e,t,r,i){this.code=e,this.size=t,this.digest=r,this.bytes=i}}let cJ=({name:e,code:t,encode:r})=>new cX(e,t,r);class cX{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?cG(this.code,t):t.then(e=>cG(this.code,e))}throw Error("Unknown type, must be binary type")}}let cQ=e=>async t=>new Uint8Array(await crypto.subtle.digest(e,t));var c0=Object.freeze({__proto__:null,sha256:cJ({name:"sha2-256",code:18,encode:cQ("SHA-256")}),sha512:cJ({name:"sha2-512",code:19,encode:cQ("SHA-512")})}),c1=Object.freeze({__proto__:null,identity:{code:0,name:"identity",encode:cd,digest:e=>cG(0,cd(e))}});new TextEncoder,new TextDecoder;let c2={...cI,...cS,...cN,...cO,...cx,...cU,...cL,...cB,...c$,...cH};function c3(e,t,r,i){return{name:e,prefix:t,encoder:{name:e,prefix:t,encode:r},decoder:{decode:i}}}({...c0,...c1});let c5=c3("utf8","u",e=>"u"+new TextDecoder("utf8").decode(e),e=>new TextEncoder().encode(e.substring(1))),c8=c3("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?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}),c6={utf8:c5,"utf-8":c5,hex:c2.base16,latin1:c8,ascii:c8,binary:c8,...c2};var c4=Object.defineProperty,c9=(e,t,r)=>t in e?c4(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,c7=(e,t,r)=>c9(e,"symbol"!=typeof t?t+"":t,r);class le{constructor(e,t){this.core=e,this.logger=t,c7(this,"keychain",new Map),c7(this,"name","keychain"),c7(this,"version","0.3"),c7(this,"initialized",!1),c7(this,"storagePrefix",aZ),c7(this,"init",async()=>{if(!this.initialized){let e=await this.getKeyChain();"u">typeof e&&(this.keychain=e),this.initialized=!0}}),c7(this,"has",e=>(this.isInitialized(),this.keychain.has(e))),c7(this,"set",async(e,t)=>{this.isInitialized(),this.keychain.set(e,t),await this.persist()}),c7(this,"get",e=>{this.isInitialized();let t=this.keychain.get(e);if(typeof t>"u"){let{message:t}=au("NO_MATCHING_KEY",`${this.name}: ${e}`);throw Error(t)}return t}),c7(this,"del",async e=>{this.isInitialized(),this.keychain.delete(e),await this.persist()}),this.core=e,this.logger=(0,ec.Ep)(t,this.name)}get context(){return(0,ec.Fd)(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,nC(e))}async getKeyChain(){let e=await this.core.storage.getItem(this.storageKey);return"u">typeof e?nA(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){let{message:e}=au("NOT_INITIALIZED",this.name);throw Error(e)}}}var lt=Object.defineProperty,lr=(e,t,r)=>t in e?lt(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,li=(e,t,r)=>lr(e,"symbol"!=typeof t?t+"":t,r);class ln{constructor(e,t,r){this.core=e,this.logger=t,li(this,"name","crypto"),li(this,"keychain"),li(this,"randomSessionIdentifier",o8()),li(this,"initialized",!1),li(this,"init",async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)}),li(this,"hasKeys",e=>(this.isInitialized(),this.keychain.has(e))),li(this,"getClientId",async()=>(this.isInitialized(),rD(rU(await this.getClientSeed()).publicKey))),li(this,"generateKeyPair",()=>{this.isInitialized();let e=function(){let e=oz.utils.randomPrivateKey(),t=oz.getPublicKey(e);return{privateKey:nd(e,o1),publicKey:nd(t,o1)}}();return this.setPrivateKey(e.publicKey,e.privateKey)}),li(this,"signJWT",async e=>{this.isInitialized();let t=rU(await this.getClientSeed()),r=this.randomSessionIdentifier;return await rL(r,e,aX,t)}),li(this,"generateSharedKey",(e,t,r)=>{var i;this.isInitialized();let n=(i=this.getPrivateKey(e),nd(sL(sz,oz.getSharedSecret(nh(i,o1),nh(t,o1)),void 0,void 0,32),o1));return this.setSymKey(n,r)}),li(this,"setSymKey",async(e,t)=>{this.isInitialized();let r=t||nd(sz(nh(e,o1)),o1);return await this.keychain.set(r,e),r}),li(this,"deleteKeyPair",async e=>{this.isInitialized(),await this.keychain.del(e)}),li(this,"deleteSymKey",async e=>{this.isInitialized(),await this.keychain.del(e)}),li(this,"encode",async(e,t,r)=>{this.isInitialized();let i=ar(r),n=(0,X.u)(t);if(2===i.type)return function(e,t){let r=nh("2",o0),i=nX(12),n=ae({type:r,sealed:nh(e,o5),iv:i});return t===o3?o9(n):n}(n,r?.encoding);
899if(ai(i)){let t=i.senderPublicKey,r=i.receiverPublicKey;e=await this.generateSharedKey(t,r)}let s=this.getSymKey(e),{type:o,senderPublicKey:a}=i;return function(e){var t;let r=(t="u">typeof e.type?e.type:0,nh(`${t}`,o0));if(1===o4(r)&&typeof e.senderPublicKey>"u")throw Error("Missing sender public key for type 1 envelope");let i="u">typeof e.senderPublicKey?nh(e.senderPublicKey,o1):void 0,n="u">typeof e.iv?nh(e.iv,o1):nX(12),s=ae({type:r,sealed:sP(nh(e.symKey,o1),n).encrypt(nh(e.message,o5)),iv:n,senderPublicKey:i});return e.encoding===o3?o9(s):s}({type:o,symKey:s,message:n,senderPublicKey:a,encoding:r?.encoding})}),li(this,"decode",async(e,t,r)=>{this.isInitialized();let i=function(e,t){let r=at({encoded:e,encoding:t?.encoding});return ar({type:o4(r.type),senderPublicKey:"u">typeof r.senderPublicKey?nd(r.senderPublicKey,o1):void 0,receiverPublicKey:t?.receiverPublicKey})}(t,r);if(2===i.type){let e=function(e,t){let{sealed:r}=at({encoded:e,encoding:t});return nd(r,o5)}(t,r?.encoding);return(0,X.D)(e)}if(ai(i)){let t=i.receiverPublicKey,r=i.senderPublicKey;e=await this.generateSharedKey(t,r)}try{let i=this.getSymKey(e),n=function(e){let t=nh(e.symKey,o1),{sealed:r,iv:i}=at({encoded:e.encoded,encoding:e.encoding}),n=sP(t,i).decrypt(r);if(null===n)throw Error("Failed to decrypt");return nd(n,o5)}({symKey:i,encoded:t,encoding:r?.encoding});return(0,X.D)(n)}catch(t){this.logger.error(`Failed to decode message from topic: '${e}', clientId: '${await this.getClientId()}'`),this.logger.error(t)}}),li(this,"getPayloadType",(e,t=o2)=>o4(at({encoded:e,encoding:t}).type)),li(this,"getPayloadSenderPublicKey",(e,t=o2)=>{let r=at({encoded:e,encoding:t});return r.senderPublicKey?nd(r.senderPublicKey,o1):void 0}),this.core=e,this.logger=(0,ec.Ep)(t,this.name),this.keychain=r||new le(this.core,this.logger)}get context(){return(0,ec.Fd)(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(aJ)}catch{e=o8(),await this.keychain.set(aJ,e)}return function(e,t="utf8"){let r=c6[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,"utf8"):r.decoder.decode(`${r.prefix}${e}`)}(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){let{message:e}=au("NOT_INITIALIZED",this.name);throw Error(e)}}}var ls=Object.defineProperty,lo=Object.defineProperties,la=Object.getOwnPropertyDescriptors,lc=Object.getOwnPropertySymbols,ll=Object.prototype.hasOwnProperty,lu=Object.prototype.propertyIsEnumerable,lh=(e,t,r)=>t in e?ls(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ld=(e,t)=>{for(var r in t||(t={}))ll.call(t,r)&&lh(e,r,t[r]);if(lc)for(var r of lc(t))lu.call(t,r)&&lh(e,r,t[r]);return e},lp=(e,t)=>lo(e,la(t)),lf=(e,t,r)=>lh(e,"symbol"!=typeof t?t+"":t,r);class lg extends ey{constructor(e,t){super(e,t),this.logger=e,this.core=t,lf(this,"messages",new Map),lf(this,"messagesWithoutClientAck",new Map),lf(this,"name","messages"),lf(this,"version","0.3"),lf(this,"initialized",!1),lf(this,"storagePrefix",aZ),lf(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}}}),lf(this,"set",async(e,t,r)=>{this.isInitialized();let i=o6(t),n=this.messages.get(e);if(typeof n>"u"&&(n={}),"u">typeof n[i])return i;if(n[i]=t,this.messages.set(e,n),r===a8.inbound){let r=this.messagesWithoutClientAck.get(e)||{};this.messagesWithoutClientAck.set(e,lp(ld({},r),{[i]:t}))}return await this.persist(),i}),lf(this,"get",e=>{this.isInitialized();let t=this.messages.get(e);return typeof t>"u"&&(t={}),t}),lf(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}),lf(this,"has",(e,t)=>(this.isInitialized(),"u">typeof this.get(e)[o6(t)])),lf(this,"ack",async(e,t)=>{this.isInitialized();let r=this.messagesWithoutClientAck.get(e);if(typeof r>"u")return;let i=o6(t);delete r[i],0===Object.keys(r).length?this.messagesWithoutClientAck.delete(e):this.messagesWithoutClientAck.set(e,r),await this.persist()}),lf(this,"del",async e=>{this.isInitialized(),this.messages.delete(e),this.messagesWithoutClientAck.delete(e),await this.persist()}),this.logger=(0,ec.Ep)(e,this.name),this.core=t}
899get context(){return(0,ec.Fd)(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,nC(e))}async setRelayerMessagesWithoutClientAck(e){await this.core.storage.setItem(this.storageKeyWithoutClientAck,nC(e))}async getRelayerMessages(){let e=await this.core.storage.getItem(this.storageKey);return"u">typeof e?nA(e):void 0}async getRelayerMessagesWithoutClientAck(){let e=await this.core.storage.getItem(this.storageKeyWithoutClientAck);return"u">typeof e?nA(e):void 0}async persist(){await this.setRelayerMessages(this.messages),await this.setRelayerMessagesWithoutClientAck(this.messagesWithoutClientAck)}isInitialized(){if(!this.initialized){let{message:e}=au("NOT_INITIALIZED",this.name);throw Error(e)}}}var lm=Object.defineProperty,ly=Object.defineProperties,lw=Object.getOwnPropertyDescriptors,lb=Object.getOwnPropertySymbols,lv=Object.prototype.hasOwnProperty,lE=Object.prototype.propertyIsEnumerable,l_=(e,t,r)=>t in e?lm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,lC=(e,t)=>{for(var r in t||(t={}))lv.call(t,r)&&l_(e,r,t[r]);if(lb)for(var r of lb(t))lE.call(t,r)&&l_(e,r,t[r]);return e},lA=(e,t)=>ly(e,lw(t)),lI=(e,t,r)=>l_(e,"symbol"!=typeof t?t+"":t,r);class lS extends ew{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,lI(this,"events",new S.EventEmitter),lI(this,"name","publisher"),lI(this,"queue",new Map),lI(this,"publishTimeout",(0,O.toMiliseconds)(O.ONE_MINUTE)),lI(this,"initialPublishTimeout",(0,O.toMiliseconds)(15*O.ONE_SECOND)),lI(this,"needsTransportRestart",!1),lI(this,"publish",async(e,t,r)=>{var i;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:e,message:t,opts:r}});let n=r?.ttl||aQ,s=an(r),o=r?.prompt||!1,a=r?.tag||0,c=r?.id||aI().toString(),l={topic:e,message:t,opts:{ttl:n,relay:s,prompt:o,tag:a,id:c,attestation:r?.attestation,tvf:r?.tvf}},u=`Failed to publish payload, please try again. id:${c} tag:${a}`;try{let i=new Promise(async i=>{let s=({id:e})=>{l.opts.id===e&&(this.removeRequestFromQueue(e),this.relayer.events.removeListener(a1.publish,s),i(l))};this.relayer.events.on(a1.publish,s);let u=nI(new Promise((i,s)=>{this.rpcPublish({topic:e,message:t,ttl:n,prompt:o,tag:a,id:c,attestation:r?.attestation,tvf:r?.tvf}).then(i).catch(e=>{this.logger.warn(e,e?.message),s(e)})}),this.initialPublishTimeout,`Failed initial publish, retrying.... id:${c} tag:${a}`);try{await u,this.events.removeListener(a1.publish,s)}catch(e){this.queue.set(c,lA(lC({},l),{attempt:1})),this.logger.warn(e,e?.message)}});this.logger.trace({type:"method",method:"publish",params:{id:c,topic:e,message:t,opts:r}}),await nI(i,this.publishTimeout,u)}catch(e){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(e),null!=(i=r?.internal)&&i.throwOnFailedPublish)throw e}finally{this.queue.delete(c)}}),lI(this,"on",(e,t)=>{this.events.on(e,t)}),lI(this,"once",(e,t)=>{this.events.once(e,t)}),lI(this,"off",(e,t)=>{this.events.off(e,t)}),lI(this,"removeListener",(e,t)=>{this.events.removeListener(e,t)}),this.relayer=e,this.logger=(0,ec.Ep)(t,this.name),this.registerEventListeners()}get context(){return(0,ec.Fd)(this.logger)}async rpcPublish(e){var t,r,i,n;let{topic:s,message:o,ttl:a=aQ,prompt:c,tag:l,id:u,attestation:h,tvf:d}=e,p={method:as(an().protocol).publish,params:lC({topic:s,message:o,ttl:a,prompt:c,tag:l,attestation:h},d),id:u};ad(null==(t=p.params)?void 0:t.prompt)&&(null==(r=p.params)||delete r.prompt),ad(null==(i=p.params)?void 0:i.tag)&&(null==(n=p.params)||delete n.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:p});let f=await this.relayer.request(p);return this.relayer.events.emit(a1.publish,e),this.logger.debug("Successfully Published Payload"),f}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async(e,t)=>{let r=e.attempt+1;this.queue.set(t,lA(lC({},e),{attempt:r}));let{topic:i,message:n,opts:s,attestation:o}=e;this.logger.warn({},`Publisher: queue->publishing: ${e.opts.id}, tag: ${e.opts.tag}, attempt: ${r}`),await this.rpcPublish(lA(lC({},e),{topic:i,message:n,ttl:s.ttl,prompt:s.prompt,tag:s.tag,id:s.id,attestation:o,tvf:s.tvf})),this.logger.warn({},`Publisher: queue->published: ${e.opts.id}`)})}registerEventListeners(){this.relayer.core.heartbeat.on(P,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(a1.connection_stalled);return}this.checkQueue()}),this.relayer.on(a1.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}var lN=Object.defineProperty,lO=(e,t,r)=>t in e?lN(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,lx=(e,t,r)=>lO(e,"symbol"!=typeof t?t+"":t,r);class lT{constructor(){lx(this,"map",new Map),lx(this,"set",(e,t)=>{let r=this.get(e);this.exists(e,t)||this.map.set(e,[...r,t])}),lx(this,"get",e=>this.map.get(e)||[]),lx(this,"exists",(e,t)=>this.get(e).includes(t)),lx(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 i=r.filter(e=>e!==t);if(!i.length){this.map.delete(e);return}this.map.set(e,i)}),lx(this,"clear",()=>{this.map.clear()})}
899get topics(){return Array.from(this.map.keys())}}var lR=Object.defineProperty,lP=Object.defineProperties,lk=Object.getOwnPropertyDescriptors,lD=Object.getOwnPropertySymbols,lM=Object.prototype.hasOwnProperty,lU=Object.prototype.propertyIsEnumerable,lL=(e,t,r)=>t in e?lR(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,lB=(e,t)=>{for(var r in t||(t={}))lM.call(t,r)&&lL(e,r,t[r]);if(lD)for(var r of lD(t))lU.call(t,r)&&lL(e,r,t[r]);return e},lj=(e,t)=>lP(e,lk(t)),l$=(e,t,r)=>lL(e,"symbol"!=typeof t?t+"":t,r);class lF extends eE{constructor(e,t){super(e,t),this.relayer=e,this.logger=t,l$(this,"subscriptions",new Map),l$(this,"topicMap",new lT),l$(this,"events",new S.EventEmitter),l$(this,"name","subscription"),l$(this,"version","0.3"),l$(this,"pending",new Map),l$(this,"cached",[]),l$(this,"initialized",!1),l$(this,"storagePrefix",aZ),l$(this,"subscribeTimeout",(0,O.toMiliseconds)(O.ONE_MINUTE)),l$(this,"initialSubscribeTimeout",(0,O.toMiliseconds)(15*O.ONE_SECOND)),l$(this,"clientId"),l$(this,"batchSubscribeTopicsLimit",500),l$(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),await this.restore()),this.initialized=!0}),l$(this,"subscribe",async(e,t)=>{this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:e,opts:t}});try{let r=an(t),i={topic:e,relay:r,transportType:t?.transportType};this.pending.set(e,i);let n=await this.rpcSubscribe(e,r,t);return"string"==typeof n&&(this.onSubscribe(n,i),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:e,opts:t}})),n}catch(e){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(e),e}}),l$(this,"unsubscribe",async(e,t)=>{this.isInitialized(),"u">typeof t?.id?await this.unsubscribeById(e,t.id,t):await this.unsubscribeByTopic(e,t)}),l$(this,"isSubscribed",e=>new Promise(t=>{t(this.topicMap.topics.includes(e))})),l$(this,"isKnownTopic",e=>new Promise(t=>{t(this.topicMap.topics.includes(e)||this.pending.has(e)||this.cached.some(t=>t.topic===e))})),l$(this,"on",(e,t)=>{this.events.on(e,t)}),l$(this,"once",(e,t)=>{this.events.once(e,t)}),l$(this,"off",(e,t)=>{this.events.off(e,t)}),l$(this,"removeListener",(e,t)=>{this.events.removeListener(e,t)}),l$(this,"start",async()=>{await this.onConnect()}),l$(this,"stop",async()=>{await this.onDisconnect()}),l$(this,"restart",async()=>{await this.restore(),await this.onRestart()}),l$(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)}),l$(this,"registerEventListeners",()=>{this.relayer.core.heartbeat.on(P,async()=>{await this.checkPending()}),this.events.on(a4.created,async e=>{let t=a4.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()}),this.events.on(a4.deleted,async e=>{let t=a4.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),await this.persist()})}),this.relayer=e,this.logger=(0,ec.Ep)(t,this.name),this.clientId=""}get context(){return(0,ec.Fd)(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.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 i=an(r);await this.restartToComplete({topic:e,id:t,relay:i}),await this.rpcUnsubscribe(e,t,i);let n=ah("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,t,n),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 i;r&&r?.transportType!==a5.relay||await this.restartToComplete({topic:e,id:e,relay:t});let n={method:as(t.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:n});let s=null==(i=r?.internal)?void 0:i.throwOnFailedPublish;
899try{let t=await this.getSubscriptionId(e);if(r?.transportType===a5.link_mode)return setTimeout(()=>{(this.relayer.connected||this.relayer.connecting)&&this.relayer.request(n).catch(e=>this.logger.warn(e))},(0,O.toMiliseconds)(O.ONE_SECOND)),t;let i=new Promise(async t=>{let r=i=>{i.topic===e&&(this.events.removeListener(a4.created,r),t(i.id))};this.events.on(a4.created,r);try{let i=await nI(new Promise((e,t)=>{this.relayer.request(n).catch(e=>{this.logger.warn(e,e?.message),t(e)}).then(e)}),this.initialSubscribeTimeout,`Subscribing to ${e} failed, please try again`);this.events.removeListener(a4.created,r),t(i)}catch{}}),o=await nI(i,this.subscribeTimeout,`Subscribing to ${e} failed, please try again`);if(!o&&s)throw Error(`Subscribing to ${e} failed, please try again`);return o?t:null}catch(e){if(this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(a1.connection_stalled),s)throw e}return null}async rpcBatchSubscribe(e){if(!e.length)return;let t={method:as(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 nI(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(a1.connection_stalled)}}async rpcBatchFetchMessages(e){let t;if(!e.length)return;let r={method:as(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 nI(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(a1.connection_stalled)}return t}rpcUnsubscribe(e,t,r){let i={method:as(r.protocol).unsubscribe,params:{topic:e,id:t}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:i}),this.relayer.request(i)}onSubscribe(e,t){this.setSubscription(e,lj(lB({},t),{id:e})),this.pending.delete(t.topic)}onBatchSubscribe(e){e.length&&e.forEach(e=>{this.setSubscription(e.id,lB({},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,lB({},t)),this.topicMap.set(t.topic,e),this.events.emit(a4.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}=au("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(a4.deleted,lj(lB({},r),{reason:t}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(a4.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(a4.resubscribed)}async restore(){try{let e=await this.getRelayerSubscriptions();if(typeof e>"u"||!e.length)return;if(this.subscriptions.size){let{message:e}=au("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=>lj(lB({}
899,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,O.toMiliseconds)(O.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}=au("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 o6(e+await this.getClientId())}}var lq=Object.defineProperty,lz=Object.getOwnPropertySymbols,lH=Object.prototype.hasOwnProperty,lW=Object.prototype.propertyIsEnumerable,lV=(e,t,r)=>t in e?lq(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,lK=(e,t)=>{for(var r in t||(t={}))lH.call(t,r)&&lV(e,r,t[r]);if(lz)for(var r of lz(t))lW.call(t,r)&&lV(e,r,t[r]);return e},lZ=(e,t,r)=>lV(e,"symbol"!=typeof t?t+"":t,r);class lG extends eb{constructor(e){super(e),lZ(this,"protocol","wc"),lZ(this,"version",2),lZ(this,"core"),lZ(this,"logger"),lZ(this,"events",new S.EventEmitter),lZ(this,"provider"),lZ(this,"messages"),lZ(this,"subscriber"),lZ(this,"publisher"),lZ(this,"name","relayer"),lZ(this,"transportExplicitlyClosed",!1),lZ(this,"initialized",!1),lZ(this,"connectionAttemptInProgress",!1),lZ(this,"relayUrl"),lZ(this,"projectId"),lZ(this,"packageName"),lZ(this,"bundleId"),lZ(this,"hasExperiencedNetworkDisruption",!1),lZ(this,"pingTimeout"),lZ(this,"heartBeatTimeout",(0,O.toMiliseconds)(O.THIRTY_SECONDS+O.FIVE_SECONDS)),lZ(this,"reconnectTimeout"),lZ(this,"connectPromise"),lZ(this,"reconnectInProgress",!1),lZ(this,"requestsInFlight",[]),lZ(this,"connectTimeout",(0,O.toMiliseconds)(15*O.ONE_SECOND)),lZ(this,"request",async e=>{var t,r;this.logger.debug("Publishing Request Payload");let i=e.id||aI().toString();await this.toEstablishConnection();try{this.logger.trace({id:i,method:e.method,topic:null==(t=e.params)?void 0:t.topic},"relayer.request - publishing...");let n=`${i}:${(null==(r=e.params)?void 0:r.tag)||""}`;this.requestsInFlight.push(n);let s=await this.provider.request(e);return this.requestsInFlight=this.requestsInFlight.filter(e=>e!==n),s}catch(e){throw this.logger.debug(`Failed to Publish Request: ${i}`),e}}),lZ(this,"resetPingTimeout",()=>{ny()&&(clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var e,t,r,i;try{this.logger.debug({},"pingTimeout: Connection stalled, terminating..."),null==(i=null==(r=null==(t=null==(e=this.provider)?void 0:e.connection)?void 0:t.socket)?void 0:r.terminate)||i.call(r)}catch(e){this.logger.warn(e,e?.message)}},this.heartBeatTimeout))}),lZ(this,"onPayloadHandler",e=>{this.onProviderPayload(e),this.resetPingTimeout()}),lZ(this,"onConnectHandler",()=>{this.logger.warn({},"Relayer connected \uD83D\uDEDC"),this.startPingTimeout(),this.events.emit(a1.connect)}),lZ(this,"onDisconnectHandler",()=>{this.logger.warn({},"Relayer disconnected \uD83D\uDED1"),this.requestsInFlight=[],this.onProviderDisconnect()}),lZ(this,"onProviderErrorHandler",e=>{this.logger.fatal(`Fatal socket error: ${e.message}`),this.events.emit(a1.error,e),this.logger.fatal("Fatal socket error received, closing transport"),this.transportClose()}),lZ(this,"registerProviderListeners",()=>{this.provider.on(a2.payload,this.onPayloadHandler),this.provider.on(a2.connect,this.onConnectHandler),this.provider.on(a2.disconnect,this.onDisconnectHandler),this.provider.on(a2.error,this.onProviderErrorHandler)}),this.core=e.core,this.logger="u">typeof e.logger&&"string"!=typeof e.logger?(0,ec.Ep)(e.logger,this.name):(0,ec.gw)((0,ec.jI)({level:e.logger||"error"})),this.messages=new lg(this.logger,e.core),this.subscriber=new lF(this,this.logger),this.publisher=new lS(this,this.logger),this.relayUrl=e?.relayUrl||a0,this.projectId=e.projectId,nw()&&"u">typeof r.g&&"u">typeof(null==r.g?void 0:r.g.Platform)&&(null==r.g?void 0:r.g.Platform.OS)==="android"?this.packageName=nE():nw()&&"u">typeof r.g&&"u">typeof(null==r.g?void 0:r.g.Platform)&&(null==r.g?void 0:r.g.Platform.OS)==="ios"&&(this.bundleId=nE()),this.provider={}}
899async init(){if(this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]),this.initialized=!0,this.subscriber.hasAnyTopics)try{await this.transportOpen()}catch(e){this.logger.warn(e,e?.message)}}get context(){return(0,ec.Fd)(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:a5.relay},a8.outbound)}async subscribe(e,t){var r,i,n;this.isInitialized(),null!=t&&t.transportType&&t?.transportType!=="relay"||await this.toEstablishConnection();let s=typeof(null==(r=t?.internal)?void 0:r.throwOnFailedPublish)>"u"||(null==(i=t?.internal)?void 0:i.throwOnFailedPublish),o=(null==(n=this.subscriber.topicMap.get(e))?void 0:n[0])||"",a,c=t=>{t.topic===e&&(this.subscriber.off(a4.created,c),a())};return await Promise.all([new Promise(e=>{a=e,this.subscriber.on(a4.created,c)}),new Promise(async(r,i)=>{o=await this.subscriber.subscribe(e,lK({internal:{throwOnFailedPublish:s}},t)).catch(e=>{s&&i(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 nI(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.warn("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 ag())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=nN(O.FIVE_MINUTES);await this.core.pairing.pairings.set(r,{topic:r,expiry:e,relay:{protocol:"irn"},active:!1})}this.events.emit(a1.message,e),await this.recordMessageEvent(e,a8.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 subscribe"))};this.provider.once(a2.disconnect,r),await nI(new Promise((e,t)=>
899{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(a2.disconnect,r),clearTimeout(this.reconnectTimeout)}),await new Promise(async(e,t)=>{let r=()=>{t(Error("Connection interrupted while trying to subscribe"))};this.provider.once(a2.disconnect,r),await this.subscriber.start().then(e).catch(t).finally(()=>{this.provider.off(a2.disconnect,r)})}),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,O.toMiliseconds)(1*t))),t++}}startPingTimeout(){var e,t,r,i,n;if(ny())try{null!=(t=null==(e=this.provider)?void 0:e.connection)&&t.socket&&(null==(n=null==(i=null==(r=this.provider)?void 0:r.connection)?void 0:i.socket)||n.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 a$(new aH(function({protocol:e,version:t,relayUrl:r,sdkVersion:i,auth:n,projectId:s,useOnCloseEvent:o,bundleId:a,packageName:c}){let l=r.split("?"),u=n_(e,t,i),h=function(e,t){let r=new URLSearchParams(e);for(let e of Object.keys(t).sort())if(t.hasOwnProperty(e)){let i=t[e];void 0!==i&&r.set(e,i)}return r.toString()}(l[1]||"",{auth:n,ua:u,projectId:s,useOnCloseEvent:o||void 0,packageName:c||void 0,bundleId:a||void 0});return l[0]+"?"+h}({sdkVersion:a3,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:i}=e;await this.messages.set(r,i,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 i=this.messages.has(t,r);return i&&this.logger.warn(`Ignoring duplicate message: ${r}`),i}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),aU(e)){if(!e.method.endsWith("_subscription"))return;let t=e.params,{topic:r,message:i,publishedAt:n,attestation:s}=t.data,o={topic:r,message:i,publishedAt:n,transportType:a5.relay,attestation:s};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(lK({type:"event",event:t.id},o)),this.events.emit(t.id,o),await this.acknowledgePayload(e),await this.onMessageEvent(o)}else aL(e)&&this.events.emit(a1.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(await this.recordMessageEvent(e,a8.inbound),this.events.emit(a1.message,e))}async acknowledgePayload(e){let t=aN(e.id,!0);await this.provider.connection.send(t)}unregisterProviderListeners(){this.provider.off(a2.payload,this.onPayloadHandler),this.provider.off(a2.connect,this.onConnectHandler),this.provider.off(a2.disconnect,this.onDisconnectHandler),this.provider.off(a2.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await ag();!function(e){switch(nv()){case nm.browser:!nw()&&nb()&&(window.addEventListener("online",()=>e(!0)),window.addEventListener("offline",()=>e(!1)));break;case nm.reactNative:nw()&&"u">typeof r.g&&null!=r.g&&r.g.NetInfo&&r.g?.NetInfo.addEventListener(t=>e(t?.isConnected));case nm.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))})}async onProviderDisconnect(){clearTimeout(this.pingTimeout),this.events.emit(a1.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,O.toMiliseconds)(.1)))))}isInitialized(){if(!this.initialized){let{message:e}=au("NOT_INITIALIZED",this.name);throw Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),this.connected||await this.connect()}}function lY(){}function lJ(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)}function lX(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}
899function lQ(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}let l0="[object Arguments]",l1="[object Object]";var l2=Object.defineProperty,l3=Object.getOwnPropertySymbols,l5=Object.prototype.hasOwnProperty,l8=Object.prototype.propertyIsEnumerable,l6=(e,t,r)=>t in e?l2(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,l4=(e,t)=>{for(var r in t||(t={}))l5.call(t,r)&&l6(e,r,t[r]);if(l3)for(var r of l3(t))l8.call(t,r)&&l6(e,r,t[r]);return e},l9=(e,t,r)=>l6(e,"symbol"!=typeof t?t+"":t,r);class l7 extends ev{constructor(e,t,r,i=aZ,n){super(e,t,r,i),this.core=e,this.logger=t,this.name=r,l9(this,"map",new Map),l9(this,"version","0.3"),l9(this,"cached",[]),l9(this,"initialized",!1),l9(this,"getKey"),l9(this,"storagePrefix",aZ),l9(this,"recentlyDeleted",[]),l9(this,"recentlyDeletedLimit",200),l9(this,"init",async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(e=>{var t;this.getKey&&null!==e&&!ad(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)}),l9(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())}),l9(this,"get",e=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:e}),this.getData(e))),l9(this,"getAll",e=>(this.isInitialized(),e?this.values.filter(t=>Object.keys(e).every(r=>(function e(t,r,i,n,s,o,a){let c=a(t,r,i,n,s,o);if(void 0!==c)return c;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,i,n,s){if(Object.is(r,i))return!0;let o=lQ(r),a=lQ(i);if(o===l0&&(o=l1),a===l0&&(a=l1),o!==a)return!1;switch(o){case"[object String]":return r.toString()===i.toString();case"[object Number]":{let e=r.valueOf(),t=i.valueOf();return e===t||Number.isNaN(e)&&Number.isNaN(t)}case"[object Boolean]":case"[object Date]":case"[object Symbol]":return Object.is(r.valueOf(),i.valueOf());case"[object RegExp]":return r.source===i.source&&r.flags===i.flags;case"[object Function]":return r===i}let c=(n=n??new Map).get(r),l=n.get(i);if(null!=c&&null!=l)return c===i;n.set(r,i),n.set(i,r);try{switch(o){case"[object Map]":if(r.size!==i.size)return!1;for(let[t,o]of r.entries())if(!i.has(t)||!e(o,i.get(t),t,r,i,n,s))return!1;return!0;case"[object Set]":{if(r.size!==i.size)return!1;let t=Array.from(r.values()),o=Array.from(i.values());for(let a=0;a<t.length;a++){let c=t[a],l=o.findIndex(t=>e(c,t,void 0,r,i,n,s));if(-1===l)return!1;o.splice(l,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 aW&&aW.isBuffer(r)!==aW.isBuffer(i)||r.length!==i.length)return!1;for(let t=0;t<r.length;t++)if(!e(r[t],i[t],t,r,i,n,s))return!1;return!0;case"[object ArrayBuffer]":return r.byteLength===i.byteLength&&t(new Uint8Array(r),new Uint8Array(i),n,s);case"[object DataView]":return r.byteLength===i.byteLength&&r.byteOffset===i.byteOffset&&t(new Uint8Array(r),new Uint8Array(i),n,s);case"[object Error]":return r.name===i.name&&r.message===i.message;case l1:{if(!(t(r.constructor,i.constructor,n,s)||lJ(r)&&lJ(i)))return!1;let o=[...Object.keys(r),...lX(r)],a=[...Object.keys(i),...lX(i)];if(o.length!==a.length)return!1;for(let t=0;t<o.length;t++){let a=o[t],c=r[a];if(!Object.hasOwn(i,a))return!1;let l=i[a];if(!e(c,l,a,r,i,n,s))return!1}return!0}default:return!1}}finally{n.delete(r),n.delete(i)}}(t,r,o,a)})(t[r],e[r],void 0,void 0,void 0,void 0,lY))):this.values)),l9(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=l4(l4({},this.getData(e)),t);this.map.set(e,r),await this.persist()}),l9(this,"delete",async(e,t)=>{this.isInitialized(),this.map.has(e)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",ke
899y:e,reason:t}),this.map.delete(e),this.addToRecentlyDeleted(e),await this.persist())}),this.logger=(0,ec.Ep)(t,this.name),this.storagePrefix=i,this.getKey=n}get context(){return(0,ec.Fd)(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get 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}=au("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(t),Error(t)}let{message:t}=au("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}=au("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}=au("NOT_INITIALIZED",this.name);throw Error(e)}}}var ue=Object.defineProperty,ut=(e,t,r)=>t in e?ue(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ur=(e,t,r)=>ut(e,"symbol"!=typeof t?t+"":t,r);class ui{constructor(e,t){this.core=e,this.logger=t,ur(this,"name","pairing"),ur(this,"version","0.3"),ur(this,"events",new(N())),ur(this,"pairings"),ur(this,"initialized",!1),ur(this,"storagePrefix",aZ),ur(this,"ignoredPayloadTypes",[1]),ur(this,"registeredMethods",[]),ur(this,"init",async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))}),ur(this,"register",({methods:e})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...e])]}),ur(this,"create",async e=>{this.isInitialized();let t=o8(),r=await this.core.crypto.setSymKey(t),i=nN(O.FIVE_MINUTES),n={protocol:"irn"},s={topic:r,expiry:i,relay:n,active:!1,methods:e?.methods},o=aa({protocol:this.core.protocol,version:this.core.version,topic:r,symKey:t,relay:n,expiryTimestamp:i,methods:e?.methods});return this.events.emit(a7.create,s),this.core.expirer.set(r,i),await this.pairings.set(r,s),await this.core.relayer.subscribe(r,{transportType:e?.transportType}),{topic:r,uri:o}}),ur(this,"pair",async e=>{let t;this.isInitialized();let r=this.core.eventClient.createEvent({properties:{topic:e?.uri,trace:[cs.pairing_started]}});this.isValidPair(e,r);let{topic:i,symKey:n,relay:s,expiryTimestamp:o,methods:a}=ao(e.uri);if(r.props.properties.topic=i,r.addTrace(cs.pairing_uri_validation_success),r.addTrace(cs.pairing_uri_not_expired),this.pairings.keys.includes(i)){if(t=this.pairings.get(i),r.addTrace(cs.existing_pairing),t.active)throw r.setError(co.active_pairing_already_exists),Error(`Pairing already exists: ${i}. Please try again with a new connection URI.`);r.addTrace(cs.pairing_not_expired)}let c=o||nN(O.FIVE_MINUTES),l={topic:i,relay:s,expiry:c,active:!1,methods:a};this.core.expirer.set(i,c),await this.pairings.set(i,l),r.addTrace(cs.store_new_pairing),e.activatePairing&&await this.activate({topic:i}),this.events.emit(a7.create,l),r.addTrace(cs.emit_inactive_pairing),this.core.crypto.keychain.has(i)||await this.core.crypto.setSymKey(n,i),r.addTrace(cs.subscribing_pairing_topic);try{await this.core.relayer.confirmOnlineStateOrThrow()}catch{r.setError(co.no_internet_connection)}try{await this.core.relayer.subscribe(i,{relay:s})}catch(e){throw r.setError(co.subscribe_pairing_topic_failure),e}return r.addTrace(cs.subscribe_pairing_topic_success),l}),ur(this,"activate",async({topic:e})=>{this.isInitialized();let t=nN(O.FIVE_MINUTES);this.core.expirer.set(e,t),await this.pairings.update(e,{active:!0,expiry:t})}),ur(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:i,reject:n}=function(e=O.FIVE_MINUTES,t){let r,i,n,s;let o=(0,O.toMiliseconds)(e||O.FIVE_MINUTES);return{resolve:e=>{n&&r&&(clearTimeout(n),r(e),s=Promise.resolve(e))},reject:e=>{n&&i&&(clearTimeout(n),i(e))},done:()=>new Promise((e,t)=>
899{if(s)return e(s);n=setTimeout(()=>{let e=Error(void 0);s=Promise.reject(e),t(e)},o),r=e,i=t})}}();this.events.once(nx("pairing_ping",e),({error:e})=>{e?n(e):i()}),await r()}}),ur(this,"updateExpiry",async({topic:e,expiry:t})=>{this.isInitialized(),await this.pairings.update(e,{expiry:t})}),ur(this,"updateMetadata",async({topic:e,metadata:t})=>{this.isInitialized(),await this.pairings.update(e,{peerMetadata:t})}),ur(this,"getPairings",()=>(this.isInitialized(),this.pairings.values)),ur(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",ah("USER_DISCONNECTED")),await this.deletePairing(t))}),ur(this,"formatUriFromPairing",e=>{this.isInitialized();let{topic:t,relay:r,expiry:i,methods:n}=e,s=this.core.crypto.keychain.get(t);return aa({protocol:this.core.protocol,version:this.core.version,topic:t,symKey:s,relay:r,expiryTimestamp:i,methods:n})}),ur(this,"sendRequest",async(e,t,r)=>{let i=aS(t,r),n=await this.core.crypto.encode(e,i),s=a9[t].req;return this.core.history.set(e,i),this.core.relayer.publish(e,n,s),i.id}),ur(this,"sendResult",async(e,t,r)=>{let i=aN(e,r),n=await this.core.crypto.encode(t,i),s=a9[(await this.core.history.get(t,e)).request.method].res;await this.core.relayer.publish(t,n,s),await this.core.history.resolve(i)}),ur(this,"sendError",async(e,t,r)=>{let i=aO(e,r),n=await this.core.crypto.encode(t,i),s=(await this.core.history.get(t,e)).request.method,o=a9[s]?a9[s].res:a9.unregistered_method.res;await this.core.relayer.publish(t,n,o),await this.core.history.resolve(i)}),ur(this,"deletePairing",async(e,t)=>{await this.core.relayer.unsubscribe(e),await Promise.all([this.pairings.delete(e,ah("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(e),t?Promise.resolve():this.core.expirer.del(e)])}),ur(this,"cleanup",async()=>{let e=this.pairings.getAll().filter(e=>nO(e.expiry));await Promise.all(e.map(e=>this.deletePairing(e.topic)))}),ur(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)}}),ur(this,"onRelayEventResponse",async e=>{let{topic:t,payload:r}=e,i=(await this.core.history.get(t,r.id)).request.method;return"wc_pairingPing"===i?this.onPairingPingResponse(t,r):this.onUnknownRpcMethodResponse(i)}),ur(this,"onPairingPingRequest",async(e,t)=>{let{id:r}=t;try{this.isValidPing({topic:e}),await this.sendResult(r,e,!0),this.events.emit(a7.ping,{id:r,topic:e})}catch(t){await this.sendError(r,e,t),this.logger.error(t)}}),ur(this,"onPairingPingResponse",(e,t)=>{let{id:r}=t;setTimeout(()=>{aB(t)?this.events.emit(nx("pairing_ping",r),{}):aj(t)&&this.events.emit(nx("pairing_ping",r),{error:t.error})},500)}),ur(this,"onPairingDeleteRequest",async(e,t)=>{let{id:r}=t;try{this.isValidDisconnect({topic:e}),await this.deletePairing(e),this.events.emit(a7.delete,{id:r,topic:e})}catch(t){await this.sendError(r,e,t),this.logger.error(t)}}),ur(this,"onUnknownRpcMethodRequest",async(e,t)=>{let{id:r,method:i}=t;try{if(this.registeredMethods.includes(i))return;let t=ah("WC_METHOD_UNSUPPORTED",i);await this.sendError(r,e,t),this.logger.error(t)}catch(t){await this.sendError(r,e,t),this.logger.error(t)}}),ur(this,"onUnknownRpcMethodResponse",e=>{this.registeredMethods.includes(e)||this.logger.error(ah("WC_METHOD_UNSUPPORTED",e))}),ur(this,"isValidPair",(e,t)=>{var r;if(!af(e)){let{message:r}=au("MISSING_OR_INVALID",`pair() params: ${e}`);throw t.setError(co.malformed_pairing_uri),Error(r)}if(!function(e){function t(e){try{return"u">typeof new URL(e)}catch{return!1}}try{if(ap(e,!1)){if(t(e))return!0;let r=nP(e);return t(r)}}catch{}return!1}(e.uri)){let{message:r}=au("MISSING_OR_INVALID",`pair() uri: ${e.uri}`);throw t.setError(co.malformed_pairing_uri),Error(r)}let i=ao(e?.uri);if(!(null!=(r=i?.relay)&&r.protocol)){let{message:e}=au("MISSING_OR_INVALID","pair() uri#relay-protocol");throw t.setError(co.malformed_pairing_uri),Error(e)}if(!(null!=i&&i.symKey)){let{message:e}=au("MISSING_OR_INVALID","pair() uri#symKey");throw t.setError(co.malformed_pairing_uri),Error(e)}if(null!=i&&i.expiryTimestamp&&(0,O.toMiliseconds)(i?.expiryTimestamp)<Date.now()){t.setError(co.pairing_expired);let{message:e}=au("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw Error(e)}}),ur(this,"isValidPing",async e=>{if(!af(e)){let{message:t}=au("MISSING_OR_INVALID",`ping() params: ${e}`);throw Error(t)}let{topic:t}=e;await this.isValidPairingTopic(t)}),ur(this,"isValidDisconnect",async e=>{if(!af(e)){let{message:t}=au("MISSING_OR_INVALID",`disconnect() params: ${e}`);throw Error(t)}let{topic:t}=e;await this.isValidPairingTopic(t)}),ur(this,"isValidPairingTopic",async e=>{if(!ap(e,!1)){let{message:t}=au("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw Error(t)}if(!this.pairings.keys.includes(e)){let{message:t}=au("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw Error(t)}if(nO(this.pairings.get(e).expiry)){await this.deletePairing(e);let{message:t}=au("EXPIRED",`pairing topic: ${e}`);throw Error(t)}}),this.core=e,this.logger=(0,ec.Ep)(t,this.name),this.pairings=new l7(this.core,this.logger,this.name,this.storagePrefix)}get context(){return(0,ec.Fd)(this.logger)}isInitialized(){if(!this.initialized){let{message:e}=au("NOT_INITIALIZED",this.name);throw Error(e)}}registerRelayerEvents(){this.core.relayer.on(a1.message,async e=>{let{topic:t,message:r,transportType:i}=e;if(this.pairings.keys.includes(t)&&i!==a5.link_mode&&!this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(r)))try{let e=await this.core.crypto.decode(t,r);aU(e)?(this.core.history.set(t,e),await this.onRelayEventRequest({topic:t,payload:e})):aL(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(ct.expired,async e=>{let{topic:t}=function(e){let[t,r]=e.split(":"),i={id:void 0,topic:void 0};if("topic"===t&&"string"==typeof r)i.topic=r;else if("id"===t&&Number.isInteger(Number(r)))i.id=Number(r);else throw Error(`Invalid target, expected id:number or topic:string, got ${t}:${r}`);return i}(e.target);t&&this.pairings.keys.includes(t)&&(await this.deletePairing(t,!0),this.events.emit(a7.expire,{topic:t}))})}}var un=Object.defineProperty,us=(e,t,r)=>t in e?un(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,uo=(e,t,r)=>us(e,"symbol"!=typeof t?t+"":t,r);class ua extends em{constructor(e,t){super(e,t),this.core=e,this.logger=t,uo(this,"records",new Map),uo(this,"events",new S.EventEmitter),uo(this,"name","history"),uo(this,"version","0.3"),uo(this,"cac
899hed",[]),uo(this,"initialized",!1),uo(this,"storagePrefix",aZ),uo(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)}),uo(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 i={id:t.id,topic:e,request:{method:t.method,params:t.params||null},chainId:r,expiry:nN(O.THIRTY_DAYS)};this.records.set(i.id,i),this.persist(),this.events.emit(ce.created,i)}),uo(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=aj(e)?{error:e.error}:{result:e.result},this.records.set(t.id,t),this.persist(),this.events.emit(ce.updated,t))}),uo(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))),uo(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(ce.deleted,r))}),this.persist()}),uo(this,"exists",async(e,t)=>(this.isInitialized(),!!this.records.has(t)&&(await this.getRecord(t)).topic===e)),uo(this,"on",(e,t)=>{this.events.on(e,t)}),uo(this,"once",(e,t)=>{this.events.once(e,t)}),uo(this,"off",(e,t)=>{this.events.off(e,t)}),uo(this,"removeListener",(e,t)=>{this.events.removeListener(e,t)}),this.logger=(0,ec.Ep)(t,this.name)}get context(){return(0,ec.Fd)(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:aS(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}=au("NO_MATCHING_KEY",`${this.name}: ${e}`);throw Error(t)}return t}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(ce.sync)}async restore(){try{let e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){let{message:e}=au("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(ce.created,e=>{let t=ce.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.events.on(ce.updated,e=>{let t=ce.updated;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.events.on(ce.deleted,e=>{let t=ce.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,record:e})}),this.core.heartbeat.on(P,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(t=>{(0,O.toMiliseconds)(t.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${t.id}`),this.records.delete(t.id),this.events.emit(ce.deleted,t,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){let{message:e}=au("NOT_INITIALIZED",this.name);throw Error(e)}}}var uc=Object.defineProperty,ul=(e,t,r)=>t in e?uc(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,uu=(e,t,r)=>ul(e,"symbol"!=typeof t?t+"":t,r);class uh extends e_{constructor(e,t){super(e,t),this.core=e,this.logger=t,uu(this,"expirations",new Map),uu(this,"events",new S.EventEmitter),uu(this,"name","expirer"),uu(this,"version","0.3"),uu(this,"cac
899hed",[]),uu(this,"initialized",!1),uu(this,"storagePrefix",aZ),uu(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)}),uu(this,"has",e=>{try{let t=this.formatTarget(e);return"u">typeof this.getExpiration(t)}catch{return!1}}),uu(this,"set",(e,t)=>{this.isInitialized();let r=this.formatTarget(e),i={target:r,expiry:t};this.expirations.set(r,i),this.checkExpiry(r,i),this.events.emit(ct.created,{target:r,expiration:i})}),uu(this,"get",e=>{this.isInitialized();let t=this.formatTarget(e);return this.getExpiration(t)}),uu(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(ct.deleted,{target:t,expiration:r})}}),uu(this,"on",(e,t)=>{this.events.on(e,t)}),uu(this,"once",(e,t)=>{this.events.once(e,t)}),uu(this,"off",(e,t)=>{this.events.off(e,t)}),uu(this,"removeListener",(e,t)=>{this.events.removeListener(e,t)}),this.logger=(0,ec.Ep)(t,this.name)}get context(){return(0,ec.Fd)(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 nS("topic",e);if("number"==typeof e)return nS("id",e);let{message:t}=au("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(ct.sync)}async restore(){try{let e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){let{message:e}=au("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}=au("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(t),Error(t)}return t}checkExpiry(e,t){let{expiry:r}=t;(0,O.toMiliseconds)(r)-Date.now()<=0&&this.expire(e,t)}expire(e,t){this.expirations.delete(e),this.events.emit(ct.expired,{target:e,expiration:t})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,t)=>this.checkExpiry(t,e))}registerEventListeners(){this.core.heartbeat.on(P,()=>this.checkExpirations()),this.events.on(ct.created,e=>{let t=ct.created;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(ct.expired,e=>{let t=ct.expired;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()}),this.events.on(ct.deleted,e=>{let t=ct.deleted;this.logger.info(`Emitting ${t}`),this.logger.debug({type:"event",event:t,data:e}),this.persist()})}isInitialized(){if(!this.initialized){let{message:e}=au("NOT_INITIALIZED",this.name);throw Error(e)}}}var ud=Object.defineProperty,up=(e,t,r)=>t in e?ud(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,uf=(e,t,r)=>up(e,"symbol"!=typeof t?t+"":t,r);class ug extends eC{constructor(e,t,r){super(e,t,r),this.core=e,this.logger=t,this.store=r,uf(this,"name","verify-api"),uf(this,"abortController"),uf(this,"isDevEnv"),uf(this,"verifyUrlV3",ci),uf(this,"storagePrefix",aZ),uf(this,"version",2),uf(this,"publicKey"),uf(this,"fetchPromise"),uf(this,"init",async()=>{var e;this.isDevEnv||(this.publicKey=await this.store.getItem(this.storeKey),this.publicKey&&(0,O.toMiliseconds)(null==(e=this.publicKey)?void 0:e.expiresAt)<Date.now()&&(this.logger.debug("verify v2 public key expired"),await this.removePublicKey()))}),uf(this,"register",async e=>{if(!nb()||this.isDevEnv)return;let t=window.location.origin,{id:r,decryptedId:i}=e,n=`${this.verifyUrlV3}/attestation?projectId=${this.core.projectId}&origin=${t}&id=${r}&decryptedId=${i}`;try{let e=(0,rZ.getDocument)(),t=this.startAbortTimer(5*O.ONE_SECOND),i=await new Promise((i,s)=>{let o=()=>{window.removeEventListener("message",c),e.body.removeChild(a),s("attestation aborted")};this.abortController.signal.addEventListener("abort",o);let a=e.createElement("iframe");a.src=n,a.style.display="none",a.addEventListener("error",o,{signal:this.abortController.signal});let c=n=>{if(n.data&&"string"==typeof n.data)try{let s=JSON.parse(n.data);if("verify_attestation"===s.type){if(rM(s.attestation).payload.id!==r)return;clearInterval(t),e.body.removeChild(a),this.abortController.signal.removeEventListener("abort",o),window.removeEventListener("message",c),i(null===s.attestation?"":s.attestation)}}catch(e){this.logger.warn(e)}};e.body.appendChild(a),window.addEventListener("message",c,{signal:this.abortController.signal})});return this.logger.debug("jwt attestation",i),i}catch(e){this.logger.warn(e)}return""}),uf(this,"resolve",async e=>{if(this.isDevEnv)return"";let{attestationId:t,hash:r,encryptedId:i}=e;if(""===t){this.logger.debug("resolve: attestationId is empty, skipping");return}if(t){if(rM(t).payload.id!==i)return;let e=await this.isValidJwtAttestation(t);
899if(e){if(!e.isVerified){this.logger.warn("resolve: jwt attestation: origin url not verified");return}return e}}if(!r)return;let n=this.getVerifyUrl(e?.verifyUrl);return this.fetchAttestation(r,n)}),uf(this,"fetchAttestation",async(e,t)=>{this.logger.debug(`resolving attestation: ${e} from url: ${t}`);let r=this.startAbortTimer(5*O.ONE_SECOND),i=await fetch(`${t}/attestation/${e}?v2Supported=true`,{signal:this.abortController.signal});return clearTimeout(r),200===i.status?await i.json():void 0}),uf(this,"getVerifyUrl",e=>{let t=e||cr;return cn.includes(t)||(this.logger.info(`verify url: ${t}, not included in trusted list, assigning default: ${cr}`),t=cr),t}),uf(this,"fetchPublicKey",async()=>{try{this.logger.debug(`fetching public key from: ${this.verifyUrlV3}`);let e=this.startAbortTimer(O.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)}}),uf(this,"persistPublicKey",async e=>{this.logger.debug("persisting public key to local storage",e),await this.store.setItem(this.storeKey,e),this.publicKey=e}),uf(this,"removePublicKey",async()=>{this.logger.debug("removing verify v2 public key from storage"),await this.store.removeItem(this.storeKey),this.publicKey=void 0}),uf(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")}}),uf(this,"getPublicKey",async()=>this.publicKey?this.publicKey:await this.fetchAndPersistPublicKey()),uf(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}),uf(this,"validateAttestation",(e,t)=>{let r=function(e,t){let[r,i,n]=e.split("."),s=ng.from(o7(n),"base64");if(64!==s.length)throw Error("Invalid signature length");let o=s.slice(0,32),a=s.slice(32,64),c=sz(`${r}.${i}`),l=function(e){let t=ng.from(e.x,"base64"),r=ng.from(e.y,"base64");return rX([new Uint8Array([4]),t,r])}(t);if(!oQ.verify(rX([o,a]),c,l))throw Error("Invalid signature");return rM(e).payload}(e,t.publicKey),i={hasExpired:(0,O.toMiliseconds)(r.exp)<Date.now(),payload:r};if(i.hasExpired)throw this.logger.warn("resolve: jwt attestation expired"),Error("JWT attestation expired");return{origin:i.payload.origin,isScam:i.payload.isScam,isVerified:i.payload.isVerified}}),this.logger=(0,ec.Ep)(t,this.name),this.abortController=new AbortController,this.isDevEnv=nR(),this.init()}get storeKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//verify:public:key"}get context(){return(0,ec.Fd)(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),(0,O.toMiliseconds)(e))}}var um=Object.defineProperty,uy=(e,t,r)=>t in e?um(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,uw=(e,t,r)=>uy(e,"symbol"!=typeof t?t+"":t,r);class ub extends eA{constructor(e,t){super(e,t),this.projectId=e,this.logger=t,uw(this,"context","echo"),uw(this,"registerDeviceToken",async e=>{let{clientId:t,token:r,notificationType:i,enableEncrypted:n=!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:i,token:r,always_raw:n})})}),this.logger=(0,ec.Ep)(t,this.context)}}var uv=Object.defineProperty,uE=Object.getOwnPropertySymbols,u_=Object.prototype.hasOwnProperty,uC=Object.prototype.propertyIsEnumerable,uA=(e,t,r)=>t in e?uv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,uI=(e,t)=>{for(var r in t||(t={}))u_.call(t,r)&&uA(e,r,t[r]);if(uE)for(var r of uE(t))uC.call(t,r)&&uA(e,r,t[r]);return e},uS=(e,t,r)=>uA(e,"symbol"!=typeof t?t+"":t,r);class uN extends eI{constructor(e,t,r=!0){super(e,t,r),this.core=e,this.logger=t,uS(this,"context","event-client"),uS(this,"storagePrefix",a
899Z),uS(this,"storageVersion",.1),uS(this,"events",new Map),uS(this,"shouldPersist",!1),uS(this,"init",async()=>{if(!nR())try{let e={eventId:nT(),timestamp:Date.now(),domain:this.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:await this.core.crypto.getClientId(),user_agent:n_(this.core.relayer.protocol,this.core.relayer.version,a3)}}};await this.sendEvent([e])}catch(e){this.logger.warn(e)}}),uS(this,"createEvent",e=>{let{event:t="ERROR",type:r="",properties:{topic:i,trace:n}}=e,s=nT(),o=this.core.projectId||"",a=uI({eventId:s,timestamp:Date.now(),props:{event:t,type:r,properties:{topic:i,trace:n}},bundleId:o,domain:this.getAppDomain()},this.setMethods(s));return this.telemetryEnabled&&(this.events.set(s,a),this.shouldPersist=!0),a}),uS(this,"getEvent",e=>{let{eventId:t,topic:r}=e;if(t)return this.events.get(t);let i=Array.from(this.events.values()).find(e=>e.props.properties.topic===r);if(i)return uI(uI({},i),this.setMethods(i.eventId))}),uS(this,"deleteEvent",e=>{let{eventId:t}=e;this.events.delete(t),this.shouldPersist=!0}),uS(this,"setEventListeners",()=>{this.core.heartbeat.on(P,async()=>{this.shouldPersist&&await this.persist(),this.events.forEach(e=>{(0,O.fromMiliseconds)(Date.now())-(0,O.fromMiliseconds)(e.timestamp)>86400&&(this.events.delete(e.eventId),this.shouldPersist=!0)})})}),uS(this,"setMethods",e=>({addTrace:t=>this.addTrace(e,t),setError:t=>this.setError(e,t)})),uS(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)}),uS(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)}),uS(this,"persist",async()=>{await this.core.storage.setItem(this.storageKey,Array.from(this.events.values())),this.shouldPersist=!1}),uS(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,uI(uI({},e),this.setMethods(e.eventId)))})}catch(e){this.logger.warn(e)}}),uS(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)}}),uS(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-${a3}${t}`,{method:"POST",body:JSON.stringify(e)})}),uS(this,"getAppDomain",()=>((0,rG.D)()||{name:"",description:"",url:"",icons:[""]}).url),this.logger=(0,ec.Ep)(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 uO=Object.defineProperty,ux=Object.getOwnPropertySymbols,uT=Object.prototype.hasOwnProperty,uR=Object.prototype.propertyIsEnumerable,uP=(e,t,r)=>t in e?uO(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,uk=(e,t)=>{for(var r in t||(t={}))uT.call(t,r)&&uP(e,r,t[r]);if(ux)for(var r of ux(t))uR.call(t,r)&&uP(e,r,t[r]);return e},uD=(e,t,r)=>uP(e,"symbol"!=typeof t?t+"":t,r);class uM extends ed{constructor(e){var t;super(e),uD(this,"protocol","wc"),uD(this,"version",2),uD(this,"name",aK),uD(this,"relayUrl"),uD(this,"projectId"),uD(this,"customStoragePrefix"),uD(this,"events",new S.EventEmitter),uD(this,"logger"),uD(this,"heartbeat"),uD(this,"relayer"),uD(this,"crypto"),uD(this,"storage"),uD(this,"history"),uD(this,"expirer"),uD(this,"pairing"),uD(this,"verify"),uD(this,"echoClient"),uD(this,"linkModeSupportedApps"),uD(this,"eventClient"),uD(this,"initialized",!1),uD(this,"logChunkController"),uD(this,"on",(e,t)=>this.events.on(e,t)),uD(this,"once",(e,t)=>this.events.once(e,t)),uD(this,"off",(e,t)=>this.events.off(e,t)),uD(this,"removeListener",(e,t)=>this.events.removeListener(e,t)),uD(this,"dispatchEnvelope",({topic:e,message:t,sessionExists:r})=>{if(!e||!t)return;let i={topic:e,message:t,publishedAt:Date.now(),transportType:a5.link_mode};this.relayer.onLinkMessageEvent(i,{sessionExists:r})});let r=this.getGlobalCore(e?.customStoragePrefix);if(r)try{return this.customStoragePrefix=r.customStoragePrefix,this.logger=r.logger,this.heartbeat=r.heartbeat,this.crypto=r.crypto,this.history=r.history,this.expirer=r.expirer,this.storage=r.storage,this.relayer=r.relayer,this.pairing=r.pairing,this.verify=r.verify,this.echoClient=r.echoClient,this.linkModeSupportedApps=r.linkModeSupportedApps,this.eventClient=r.eventClient,this.initialized=r.initialized,this.logChunkController=r.logChunkController,r}catch(e){console.warn("Failed to copy global core",e)}this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||a0,this.customStoragePrefix=null!=e&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";let i=(0,ec.jI)({level:"string"==typeof e?.logger&&e.logger?e.logger:aG.logger,name:aK}),{logger:n,chunkLoggerController:s}=(0,ec.Rt)({opts:i,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=(0,ec.Ep)(n,this.name),this.heartbeat=new k,this.crypto=new ln(this,this.logger,e?.keychain),this.history=new ua(this,this.logger),this.expirer=new uh(this,this.logger),this.storage=null!=e&&e.storage?e.storage:new ea(uk(uk({},aY),e?.storageOptions)),this.relayer=new lG({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new ui(this,this.logger),this.verify=new ug(this,this.logger,this.storage),this.echoClient=new ub(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new uN(this,this.logger,e?.telemetryEnabled),this.setGlobalCore(this)}static async init(e){let t=new uM(e);await t.initialize();let r=await t.crypto.getClientId();return await t.storage.setItem("WALLETCONNECT_CLIENT_ID",r),t}get context(){return(0,ec.Fd)(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(a6,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(
899),await this.pairing.init(),this.linkModeSupportedApps=await this.storage.getItem(a6)||[],this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),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 aV&&"true"===aV.env.DISABLE_GLOBAL_CORE}catch{return!0}}}var uU=Object.defineProperty,uL=(e,t,r)=>t in e?uU(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,uB=(e,t,r)=>uL(e,"symbol"!=typeof t?t+"":t,r);class uj{constructor(e){this.opts=e,uB(this,"protocol","wc"),uB(this,"version",2)}}class u${constructor(e){this.client=e}}let uF="2.23.2",uq={getDocsUrl:({docsBaseUrl:e,docsPath:t="",docsSlug:r})=>t?`${e??"https://viem.sh"}${t}${r?`#${r}`:""}`:void 0,version:`viem@${uF}`};class uz extends Error{constructor(e,t={}){let r=t.cause instanceof uz?t.cause.details:t.cause?.message?t.cause.message:t.details,i=t.cause instanceof uz&&t.cause.docsPath||t.docsPath,n=uq.getDocsUrl?.({...t,docsPath:i});super([e||"An error occurred.","",...t.metaMessages?[...t.metaMessages,""]:[],...n?[`Docs: ${n}`]:[],...r?[`Details: ${r}`]:[],...uq.version?[`Version: ${uq.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=i,this.metaMessages=t.metaMessages,this.name=t.name??this.name,this.shortMessage=e,this.version=uF}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)}}function uH(e,{strict:t=!0}={}){return!!e&&"string"==typeof e&&(t?/^0x[0-9a-fA-F]*$/.test(e):e.startsWith("0x"))}class uW extends uz{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 uV(e,{dir:t,size:r=32}={}){return"string"==typeof e?function(e,{dir:t,size:r=32}={}){if(null===r)return e;let i=e.replace("0x","");if(i.length>2*r)throw new uW({size:Math.ceil(i.length/2),targetSize:r,type:"hex"});return`0x${i["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 uW({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})}class uK extends uz{constructor({max:e,min:t,signed:r,size:i,value:n}){super(`Number "${n}" is not in safe ${i?`${8*i}-bit ${r?"signed":"unsigned"} `:""}integer range ${e?`(${t} to ${e})`:`(above ${t})`}`,{name:"IntegerOutOfRangeError"})}}class uZ extends uz{constructor({givenSize:e,maxSize:t}){super(`Size cannot exceed ${t} bytes. Given size: ${e} bytes.`,{name:"SizeOverflowError"})}}function uG(e){return uH(e,{strict:!1})?Math.ceil((e.length-2)/2):e.length}function uY(e,{size:t}){if(uG(e)>t)throw new uZ({givenSize:uG(e),maxSize:t})}function uJ(e,t={}){let{signed:r}=t;t.size&&uY(e,{size:t.size});let i=BigInt(e);if(!r)return i;let n=(e.length-2)/2;return i<=(1n<<8n*BigInt(n)-1n)-1n?i:i-BigInt(`0x${"f".padStart(2*n,"f")}`)-1n}let uX=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function uQ(e,t={}){return"number"==typeof e||"bigint"==typeof e?u1(e,t):"string"==typeof e?function(e,t={}){return u0(u2.encode(e),t)}(e,t):"boolean"==typeof e?function(e,t={}){let r=`0x${Number(e)}`;return"number"==typeof t.size?(uY(r,{size:t.size}),uV(r,{size:t.size})):r}(e,t):u0(e,t)}function u0(e,t={}){let r="";for(let t=0;t<e.length;t++)r+=uX[e[t]];let i=`0x${r}`;return"number"==typeof t.size?(uY(i,{size:t.size}),uV(i,{dir:"right",size:t.size})):i}function u1(e,t={}){let r;let{signed:i,size:n}=t,s=BigInt(e);n?r=i?(1n<<8n*BigInt(n)-1n)-1n:2n**(8n*BigInt(n))-1n:"number"==typeof e&&(r=BigInt(Number.MAX_SAFE_INTEGER));let o="bigint"==typeof r&&i?-r-1n:0;if(r&&s>r||s<o){let t="bigint"==typeof e?"n":"";throw new uK({max:r?`${r}${t}`:void 0,min:`${o}${t}`,signed:i,size:n,value:`${e}${t}`})}let a=`0x${(i&&s<0?(1n<<BigInt(8*n))+BigInt(s):s).toString(16)}`;return n?uV(a,{size:n}):a}let u2=new TextEncoder,u3=new TextEncoder,u5={zero:48,nine:57,A:65,F:70,a:97,f:102};function u8(e){return e>=u5.zero&&e<=u5.nine?e-u5.zero:e>=u5.A&&e<=u5.F?e-(u5.A-10):e>=u5.a&&e<=u5.f?e-(u5.a-10):void 0}function u6(e,t={}){let r=e;t.size&&(uY(r,{size:t.size}),r=uV(r,{dir:"right",size:t.size}));let i=r.slice(2);i.length%2&&(i=`0${i}`);let n=i.length/2,s=new Uint8Array(n);for(let e=0,t=0;e<n;e++){let r=u8(i.charCodeAt(t++)),n=u8(i.charCodeAt(t++));if(void 0===r||void 0===n)throw new uz(`Invalid byte sequence ("${i[t-2]}${i[t-1]}" in "${i}").`);s[e]=16*r+n}return s}function u4(e,t={}){let r=u3.encode(e);return"number"==typeof t.size?(uY(r,{size:t.size}),uV(r,{dir:"right",size:t.size})):r}var u9=r(76087);function u7(e,t){let r=(0,u9.fr)(uH(e,{strict:!1})?function(e,t={}){return"number"==typeof e||"bigint"==typeof e?u6(u1(e,t)):"boolean"==typeof e?function(e,t={}){let r=new Uint8Array(1);return(r[0]=Number(e),"number"==typeof t.size)?(uY(r,{size:t.size}),uV(r,{size:t.size})):r}(e,t):uH(e)?u6(e,t):u4(e,t)}(e):e);return"bytes"===(t||"hex")?r:uQ(r)}class he 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 ht=new he(8192);async function hr({hash:e,signature:t}){let i=uH(e)?e:uQ(e),{secp256k1:n}=await Promise.resolve().then(r.bind(r,68318)),s=(()=>
899{if("object"==typeof t&&"r"in t&&"s"in t){let{r:e,s:r,v:i,yParity:s}=t,o=hi(Number(s??i));return new n.Signature(uJ(e),uJ(r)).addRecoveryBit(o)}let e=uH(t)?t:uQ(t),r=hi(function(e,t={}){return Number(uJ(e,t))}(`0x${e.slice(130)}`));return n.Signature.fromCompact(e.substring(2,130)).addRecoveryBit(r)})().recoverPublicKey(i.substring(2)).toHex(!1);return`0x${s}`}function hi(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 hn({hash:e,signature:t}){return function(e){let t=u7(`0x${e.substring(4)}`).substring(26);return function(e,t){if(ht.has(`${e}.undefined`))return ht.get(`${e}.undefined`);let r=e.substring(2).toLowerCase(),i=u7(u4(r),"bytes"),n=(t?r.substring(`${t}0x`.length):r).split("");for(let e=0;e<40;e+=2)i[e>>1]>>4>=8&&n[e]&&(n[e]=n[e].toUpperCase()),(15&i[e>>1])>=8&&n[e+1]&&(n[e+1]=n[e+1].toUpperCase());let s=`0x${n.join("")}`;return ht.set(`${e}.${t}`,s),s}(`0x${t}`)}(await hr({hash:e,signature:t}))}var hs=r(25566),ho=r(82957).Buffer;function ha(e){let[t,r]=e.split(":");return{namespace:t,reference:r}}function hc(e,t){return e.includes(":")?[e]:t.chains||[]}var hl=Object.defineProperty,hu=Object.defineProperties,hh=Object.getOwnPropertyDescriptors,hd=Object.getOwnPropertySymbols,hp=Object.prototype.hasOwnProperty,hf=Object.prototype.propertyIsEnumerable,hg=(e,t,r)=>t in e?hl(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,hm=(e,t)=>{for(var r in t||(t={}))hp.call(t,r)&&hg(e,r,t[r]);if(hd)for(var r of hd(t))hf.call(t,r)&&hg(e,r,t[r]);return e},hy=(e,t)=>hu(e,hh(t));let hw={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"};function hb(){return"u">typeof hs&&"u">typeof hs.versions&&"u">typeof hs.versions.node}function hv(){return!(0,rZ.getDocument)()&&!!(0,rZ.getNavigator)()&&"ReactNative"===navigator.product}function hE(){return!hb()&&!!(0,rZ.getNavigator)()&&!!(0,rZ.getDocument)()}function h_(e,t){return e.filter(e=>t.includes(e)).length===e.length}function hC(e=O.FIVE_MINUTES,t){let r,i,n,s;let o=(0,O.toMiliseconds)(e||O.FIVE_MINUTES);return{resolve:e=>{n&&r&&(clearTimeout(n),r(e),s=Promise.resolve(e))},reject:e=>{n&&i&&(clearTimeout(n),i(e))},done:()=>new Promise((e,a)=>{if(s)return e(s);n=setTimeout(()=>{let e=Error(t);s=Promise.reject(e),a(e)},o),r=e,i=a})}}function hA(e,t){return(0,O.fromMiliseconds)((t||Date.now())+(0,O.toMiliseconds)(e))}function hI(e){return Date.now()>=(0,O.toMiliseconds)(e)}function hS(e,t){return`${e}${t?`:${t}`:""}`}async function hN({id:e,topic:t,wcDeepLink:i}){var n;try{if(!i)return;let s="string"==typeof i?JSON.parse(i):i,o=s?.href;if("string"!=typeof o)return;let a=function(e,t,r){let i=`requestId=${t}&sessionTopic=${r}`;e.endsWith("/")&&(e=e.slice(0,-1));let n=`${e}`;if(e.startsWith("https://t.me")){let t=e.includes("?")?"&startapp=":"?startapp=";n=`${n}${t}${function(e,t=!1){let r=ho.from(e).toString("base64");return t?r.replace(/[=]/g,""):r}(i,!0)}`}else n=`${n}/wc?${i}`;return n}(o,e,t),c=hv()?hw.reactNative:hb()?hw.node:hE()?hw.browser:hw.unknown;if(c===hw.browser){let e;if(!(null!=(n=(0,rZ.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)||a.startsWith("https://")||a.startsWith("http://"))&&(e="_blank"),window.open(a,e,"noreferrer noopener")}else c===hw.reactNative&&"u">typeof(null==r.g?void 0:r.g.Linking)&&await r.g.Linking.openURL(a)}catch(e){console.error(e)}}async function hO(e,t){let r="";try{if(hE()&&(r=localStorage.getItem(t)))return r;r=await e.getItem(t)}catch(e){console.error(e)}return r}function hx(e,t){if(!e.includes(t))return null;let r=e.split(/([&,?,=])/),i=r.indexOf(t);return r[i+2]}function hT(e){if(!Number.isSafeInteger(e)||e<0)throw Error("positive integer expected, got "+e)}function hR(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 hP(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 hk(e,t){hR(e);let r=t.outputLen;if(e.length<r)throw Error("digestInto() expects output buffer of length at least "+r)}let hD=BigInt(4294967296-1),hM=BigInt(32),hU=(e,t,r)=>e<<r|t>>>32-r,hL=(e,t,r)=>t<<r|e>>>32-r,hB=(e,t,r)=>t<<r-32|e>>>64-r,hj=(e,t,r)=>e<<r-32|t>>>64-r,h$="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;function hF(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function hq(e,t){return e<<32-t|e>>>t}let hz=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0];function hH(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}}function hW(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)),hR(e),e}class hV{clone(){return this._cloneInto()}}function hK(e){let t=t=>e().update(hW(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function hZ(e=32){if(h$&&"function"==typeof h$.getRandomValues)return h$.getRandomValues(new Uint8Array(e));if(h$&&"function"==typeof h$.randomBytes)return h$.randomBytes(e);throw Error("crypto.getRandomValues must be defined")}let hG=[],hY=[],hJ=[],hX=BigInt(0),hQ=BigInt(1),h0=BigInt(2),h1=BigInt(7),h2=BigInt(256),h3
899=BigInt(113);for(let e=0,t=hQ,r=1,i=0;e<24;e++){[r,i]=[i,(2*r+3*i)%5],hG.push(2*(5*i+r)),hY.push((e+1)*(e+2)/2%64);let n=hX;for(let e=0;e<7;e++)(t=(t<<hQ^(t>>h1)*h3)%h2)&h0&&(n^=hQ<<(hQ<<BigInt(e))-hQ);hJ.push(n)}let[h5,h8]=function(e,t=!1){let r=new Uint32Array(e.length),i=new Uint32Array(e.length);for(let n=0;n<e.length;n++){let{h:s,l:o}=function(e,t=!1){return t?{h:Number(e&hD),l:Number(e>>hM&hD)}:{h:0|Number(e>>hM&hD),l:0|Number(e&hD)}}(e[n],t);[r[n],i[n]]=[s,o]}return[r,i]}(hJ,!0),h6=(e,t,r)=>r>32?hB(e,t,r):hU(e,t,r),h4=(e,t,r)=>r>32?hj(e,t,r):hL(e,t,r);class h9 extends hV{constructor(e,t,r,i=!1,n=24){var s;if(super(),this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=i,this.rounds=n,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,hT(r),0>=this.blockLen||this.blockLen>=200)throw Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=new Uint32Array((s=this.state).buffer,s.byteOffset,Math.floor(s.byteLength/4))}keccak(){hz||hH(this.state32),function(e,t=24){let r=new Uint32Array(10);for(let i=24-t;i<24;i++){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 i=(t+8)%10,n=(t+2)%10,s=r[n],o=r[n+1],a=h6(s,o,1)^r[i],c=h4(s,o,1)^r[i+1];for(let r=0;r<50;r+=10)e[t+r]^=a,e[t+r+1]^=c}let t=e[2],n=e[3];for(let r=0;r<24;r++){let i=hY[r],s=h6(t,n,i),o=h4(t,n,i),a=hG[r];t=e[a],n=e[a+1],e[a]=s,e[a+1]=o}for(let t=0;t<50;t+=10){for(let i=0;i<10;i++)r[i]=e[t+i];for(let i=0;i<10;i++)e[t+i]^=~r[(i+2)%10]&r[(i+4)%10]}e[0]^=h5[i],e[1]^=h8[i]}r.fill(0)}(this.state32,this.rounds),hz||hH(this.state32),this.posOut=0,this.pos=0}update(e){hP(this);let{blockLen:t,state:r}=this,i=(e=hW(e)).length;for(let n=0;n<i;){let s=Math.min(t-this.pos,i-n);for(let t=0;t<s;t++)r[this.pos++]^=e[n++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:e,suffix:t,pos:r,blockLen:i}=this;e[r]^=t,(128&t)!=0&&r===i-1&&this.keccak(),e[i-1]^=128,this.keccak()}writeInto(e){hP(this,!1),hR(e),this.finish();let t=this.state,{blockLen:r}=this;for(let i=0,n=e.length;i<n;){this.posOut>=r&&this.keccak();let s=Math.min(r-this.posOut,n-i);e.set(t.subarray(this.posOut,this.posOut+s),i),this.posOut+=s,i+=s}return e}xofInto(e){if(!this.enableXOF)throw Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return hT(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(hk(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,this.state.fill(0)}_cloneInto(e){let{blockLen:t,suffix:r,outputLen:i,rounds:n,enableXOF:s}=this;return e||(e=new h9(t,r,i,s,n)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=n,e.suffix=r,e.outputLen=i,e.enableXOF=s,e.destroyed=this.destroyed,e}}let h7=hK(()=>new h9(136,1,32));function de(e){let t=`�Ethereum Signed Message:
900${e.length}`,r=new TextEncoder().encode(t+e);return"0x"+ho.from(h7(r)).toString("hex")}async function dt(e,t,r,i,n,s){switch(r.t){case"eip191":return await dr(e,t,r.s);case"eip1271":return await di(e,t,r.s,i,n,s);default:throw Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${r.t}`)}}async function dr(e,t,r){return(await hn({hash:de(t),signature:r})).toLowerCase()===e.toLowerCase()}async function di(e,t,r,i,n,s){let o=ha(i);if(!o.namespace||!o.reference)throw Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${i}`);try{let o="0x1626ba7e",a=r.substring(2),c=de(t).substring(2),l=await fetch(`${s||"https://rpc.walletconnect.org/v1"}/?chainId=${i}&projectId=${n}`,{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+"00000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000000041"+a},"latest"]})}),{result:u}=await l.json();return!!u&&u.slice(0,o.length).toLowerCase()===o.toLowerCase()}catch(e){return console.error("isValidEip1271Signature: ",e),!1}}var dn=Object.defineProperty,ds=Object.defineProperties,da=Object.getOwnPropertyDescriptors,dc=Object.getOwnPropertySymbols,dl=Object.prototype.hasOwnProperty,du
900=Object.prototype.propertyIsEnumerable,dh=(e,t,r)=>t in e?dn(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,dd=(e,t)=>{for(var r in t||(t={}))dl.call(t,r)&&dh(e,r,t[r]);if(dc)for(var r of dc(t))du.call(t,r)&&dh(e,r,t[r]);return e},dp=(e,t)=>ds(e,da(t));let df=e=>e?.split(":"),dg=e=>{let t=e&&df(e);if(t)return e.includes("did:pkh:")?t[3]:t[1]},dm=e=>{let t=e&&df(e);if(t)return t[2]+":"+t[3]},dy=e=>{let t=e&&df(e);if(t)return t.pop()};async function dw(e){let{cacao:t,projectId:r}=e,{s:i,p:n}=t,s=db(n,n.iss),o=dy(n.iss);return await dt(o,s,i,dm(n.iss),r)}let db=(e,t)=>{let r=`${e.domain} wants you to sign in with your Ethereum account:`,i=dy(t);if(!e.aud&&!e.uri)throw Error("Either `aud` or `uri` is required to construct the message");let n=e.statement||void 0,s=`URI: ${e.aud||e.uri}`,o=`Version: ${e.version}`,a=`Chain ID: ${dg(t)}`,c=`Nonce: ${e.nonce}`,l=`Issued At: ${e.iat}`,u=e.exp?`Expiration Time: ${e.exp}`:void 0,h=e.nbf?`Not Before: ${e.nbf}`:void 0,d=e.requestId?`Request ID: ${e.requestId}`:void 0,p=e.resources?`Resources:${e.resources.map(e=>`
901- ${e}`).join("")}`:void 0,f=dI(e.resources);return f&&(n=function(e="",t){dv(t);let r="I further authorize the stated URI to perform the following actions on my behalf: ";if(e.includes(r))return e;let i=[],n=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=>(n++,`(${n}) '${t}': '${s[t].join("', '")}' for '${e}'.`));i.push(o.join(", ").replace(".,","."))});let s=i.join(" "),o=`${r}${s}`;return`${e?e+" ":""}${o}`}(n,d_(f))),[r,i,"",n,"",s,o,a,c,l,u,h,d,p].filter(e=>null!=e).join(`
902`)};function dv(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 dE(e){return dv(e),`urn:recap:${ho.from(JSON.stringify(e)).toString("base64").replace(/=/g,"")}`}function d_(e){var t;let r=(t=e.replace("urn:recap:",""),JSON.parse(ho.from(t,"base64").toString("utf-8")));return dv(r),r}function dC(e){var t;let r=d_(e);dv(r);let i=null==(t=r.att)?void 0:t.eip155;return i?Object.keys(i).map(e=>e.split("/")[1]):[]}function dA(e){let t=d_(e);dv(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 dI(e){if(!e)return;let t=e?.[e.length-1];return t&&t.includes("urn:recap:")?t:void 0}function dS(e){if(!Number.isSafeInteger(e)||e<0)throw Error("positive integer expected, got "+e)}function dN(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function dO(e,...t){if(!dN(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 dx(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 dT(e){if("boolean"!=typeof e)throw Error(`boolean expected, not ${e}`)}let dR=e=>new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),dP=e=>new DataView(e.buffer,e.byteOffset,e.byteLength);if(68!==new Uint8Array(new Uint32Array([287454020]).buffer)[0])throw Error("Non little-endian hardware is not supported");function dk(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(dN(e))e=dU(e);else throw Error("Uint8Array expected, got "+typeof e);return e}function dD(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 dM(e,t,r,i){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,i);let n=BigInt(32),s=BigInt(4294967295),o=Number(r>>n&s),a=Number(r&s),c=i?4:0,l=i?0:4;e.setUint32(t+c,o,i),e.setUint32(t+l,a,i)}function dU(e){return Uint8Array.from(e)}function dL(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}let dB=e=>Uint8Array.from(e.split("").map(e=>e.charCodeAt(0))),dj=dB("expand 16-byte k"),d$=dB("expand 32-byte k"),dF=dR(dj),dq=dR(d$);function dz(e,t){return e<<t|e>>>32-t}function dH(e){return e.byteOffset%4==0}let dW=4294967296-1,dV=new Uint32Array,dK=(e,t)=>255&e[t++]|(255&e[t++])<<8;class dZ{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,dO(e=dk(e),32);
902let t=dK(e,0),r=dK(e,2),i=dK(e,4),n=dK(e,6),s=dK(e,8),o=dK(e,10),a=dK(e,12),c=dK(e,14);this.r[0]=8191&t,this.r[1]=(t>>>13|r<<3)&8191,this.r[2]=(r>>>10|i<<6)&7939,this.r[3]=(i>>>7|n<<9)&8191,this.r[4]=(n>>>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|c<<8)&8191,this.r[9]=c>>>5&127;for(let t=0;t<8;t++)this.pad[t]=dK(e,16+2*t)}process(e,t,r=!1){let{h:i,r:n}=this,s=n[0],o=n[1],a=n[2],c=n[3],l=n[4],u=n[5],h=n[6],d=n[7],p=n[8],f=n[9],g=dK(e,t+0),m=dK(e,t+2),y=dK(e,t+4),w=dK(e,t+6),b=dK(e,t+8),v=dK(e,t+10),E=dK(e,t+12),_=dK(e,t+14),C=i[0]+(8191&g),A=i[1]+((g>>>13|m<<3)&8191),I=i[2]+((m>>>10|y<<6)&8191),S=i[3]+((y>>>7|w<<9)&8191),N=i[4]+((w>>>4|b<<12)&8191),O=i[5]+(b>>>1&8191),x=i[6]+((b>>>14|v<<2)&8191),T=i[7]+((v>>>11|E<<5)&8191),R=i[8]+((E>>>8|_<<8)&8191),P=i[9]+(_>>>5|(r?0:2048)),k=0,D=0+C*s+5*f*A+5*p*I+5*d*S+5*h*N;k=D>>>13,D&=8191,D+=5*u*O+5*l*x+5*c*T+5*a*R+5*o*P,k+=D>>>13,D&=8191;let M=k+C*o+A*s+5*f*I+5*p*S+5*d*N;k=M>>>13,M&=8191,M+=5*h*O+5*u*x+5*l*T+5*c*R+5*a*P,k+=M>>>13,M&=8191;let U=k+C*a+A*o+I*s+5*f*S+5*p*N;k=U>>>13,U&=8191,U+=5*d*O+5*h*x+5*u*T+5*l*R+5*c*P,k+=U>>>13,U&=8191;let L=k+C*c+A*a+I*o+S*s+5*f*N;k=L>>>13,L&=8191,L+=5*p*O+5*d*x+5*h*T+5*u*R+5*l*P,k+=L>>>13,L&=8191;let B=k+C*l+A*c+I*a+S*o+N*s;k=B>>>13,B&=8191,B+=5*f*O+5*p*x+5*d*T+5*h*R+5*u*P,k+=B>>>13,B&=8191;let j=k+C*u+A*l+I*c+S*a+N*o;k=j>>>13,j&=8191,j+=O*s+5*f*x+5*p*T+5*d*R+5*h*P,k+=j>>>13,j&=8191;let $=k+C*h+A*u+I*l+S*c+N*a;k=$>>>13,$&=8191,$+=O*o+x*s+5*f*T+5*p*R+5*d*P,k+=$>>>13,$&=8191;let F=k+C*d+A*h+I*u+S*l+N*c;k=F>>>13,F&=8191,F+=O*a+x*o+T*s+5*f*R+5*p*P,k+=F>>>13,F&=8191;let q=k+C*p+A*d+I*h+S*u+N*l;k=q>>>13,q&=8191,q+=O*c+x*a+T*o+R*s+5*f*P,k+=q>>>13,q&=8191;let z=k+C*f+A*p+I*d+S*h+N*u;k=z>>>13,z&=8191,z+=O*l+x*c+T*a+R*o+P*s,k+=z>>>13,z&=8191,D=8191&(k=(k=(k<<2)+k|0)+D|0),k>>>=13,M+=k,i[0]=D,i[1]=M,i[2]=U,i[3]=L,i[4]=B,i[5]=j,i[6]=$,i[7]=F,i[8]=q,i[9]=z}finalize(){let{h:e,pad:t}=this,r=new Uint16Array(10),i=e[1]>>>13;e[1]&=8191;for(let t=2;t<10;t++)e[t]+=i,i=e[t]>>>13,e[t]&=8191;e[0]+=5*i,i=e[0]>>>13,e[0]&=8191,e[1]+=i,i=e[1]>>>13,e[1]&=8191,e[2]+=i,r[0]=e[0]+5,i=r[0]>>>13,r[0]&=8191;for(let t=1;t<10;t++)r[t]=e[t]+i,i=r[t]>>>13,r[t]&=8191;r[9]-=8192;let n=(1^i)-1;for(let e=0;e<10;e++)r[e]&=n;n=~n;for(let t=0;t<10;t++)e[t]=e[t]&n|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;dL(r)}update(e){dx(this);let{buffer:t,blockLen:r}=this,i=(e=dk(e)).length;for(let n=0;n<i;){let s=Math.min(r-this.pos,i-n);if(s===r){for(;r<=i-n;n+=r)this.process(e,n);continue}t.set(e.subarray(n,n+s),this.pos),this.pos+=s,n+=s,this.pos===r&&(this.process(t,0,!1),this.pos=0)}return this}destroy(){dL(this.h,this.r,this.buffer,this.pad)}digestInto(e){dx(this),function(e,t){dO(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:i}=this;if(i){for(t[i++]=1;i<16;i++)t[i]=0;this.process(t,0,!0)}this.finalize();let n=0;for(let t=0;t<8;t++)e[n++]=r[t]>>>0,e[n++]=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 dG=function(e){let t=(t,r)=>e(r).update(dk(t)).digest(),r=e(new Uint8Array(32));return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t}(e=>new dZ(e)),dY=function(e,t){let{allowShortKeys:r,extendNonceFn:i,counterLength:n,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);if("function"!=typeof e)throw Error("core must be a function");return dS(n),dS(o),dT(s),dT(r),(t,a,c,l,u=0)=>{dO(t),dO(a),dO(c);let h=c.length;if(void 0===l&&(l=new Uint8Array(h)),dO(l),dS(u),u<0||u>=dW)throw Error("arx: counter overflow");if(l.length<h)throw Error(`arx: output (${l.length}) is shorter than data (${h})`);let d=[],p=t.length,f,g;if(32===p)d.push(f=dU(t)),g=dq;else if(16===p&&r)(f=new Uint8Array(32)).set(t),f.set(t,16),g=dF,d.push(f);
902else throw Error(`arx: invalid 32-byte key, got length=${p}`);dH(a)||d.push(a=dU(a));let m=dR(f);if(i){if(24!==a.length)throw Error("arx: extended nonce must be 24 bytes");i(g,m,dR(a.subarray(0,16)),m),a=a.subarray(16)}let y=16-n;if(y!==a.length)throw Error(`arx: nonce must be ${y} or 16 bytes`);if(12!==y){let e=new Uint8Array(12);e.set(a,s?0:12-a.length),a=e,d.push(a)}return function(e,t,r,i,n,s,o,a){let c=n.length,l=new Uint8Array(64),u=dR(l),h=dH(n)&&dH(s),d=h?dR(n):dV,p=h?dR(s):dV;for(let f=0;f<c;o++){if(e(t,r,i,u,o,a),o>=dW)throw Error("arx: counter overflow");let g=Math.min(64,c-f);if(h&&64===g){let e=f/4;if(f%4!=0)throw Error("arx: invalid block position");for(let t=0,r;t<16;t++)p[r=e+t]=d[r]^u[t];f+=64;continue}for(let e=0,t;e<g;e++)s[t=f+e]=n[t]^l[e];f+=g}}(e,g,m,dR(a),c,l,u,o),dL(...d),l}}(function(e,t,r,i,n,s=20){let o=e[0],a=e[1],c=e[2],l=e[3],u=t[0],h=t[1],d=t[2],p=t[3],f=t[4],g=t[5],m=t[6],y=t[7],w=r[0],b=r[1],v=r[2],E=o,_=a,C=c,A=l,I=u,S=h,N=d,O=p,x=f,T=g,R=m,P=y,k=n,D=w,M=b,U=v;for(let e=0;e<s;e+=2)x=x+(k=dz(k^(E=E+I|0),16))|0,E=E+(I=dz(I^x,12))|0,x=x+(k=dz(k^E,8))|0,I=dz(I^x,7),T=T+(D=dz(D^(_=_+S|0),16))|0,_=_+(S=dz(S^T,12))|0,T=T+(D=dz(D^_,8))|0,S=dz(S^T,7),R=R+(M=dz(M^(C=C+N|0),16))|0,C=C+(N=dz(N^R,12))|0,R=R+(M=dz(M^C,8))|0,N=dz(N^R,7),P=P+(U=dz(U^(A=A+O|0),16))|0,A=A+(O=dz(O^P,12))|0,P=P+(U=dz(U^A,8))|0,O=dz(O^P,7),R=R+(U=dz(U^(E=E+S|0),16))|0,E=E+(S=dz(S^R,12))|0,R=R+(U=dz(U^E,8))|0,S=dz(S^R,7),P=P+(k=dz(k^(_=_+N|0),16))|0,_=_+(N=dz(N^P,12))|0,P=P+(k=dz(k^_,8))|0,N=dz(N^P,7),x=x+(D=dz(D^(C=C+O|0),16))|0,C=C+(O=dz(O^x,12))|0,x=x+(D=dz(D^C,8))|0,O=dz(O^x,7),T=T+(M=dz(M^(A=A+I|0),16))|0,A=A+(I=dz(I^T,12))|0,T=T+(M=dz(M^A,8))|0,I=dz(I^T,7);let L=0;i[L++]=o+E|0,i[L++]=a+_|0,i[L++]=c+C|0,i[L++]=l+A|0,i[L++]=u+I|0,i[L++]=h+S|0,i[L++]=d+N|0,i[L++]=p+O|0,i[L++]=f+x|0,i[L++]=g+T|0,i[L++]=m+R|0,i[L++]=y+P|0,i[L++]=n+k|0,i[L++]=w+D|0,i[L++]=b+M|0,i[L++]=v+U|0},{counterRight:!1,counterLength:4,allowShortKeys:!1}
902),dJ=new Uint8Array(16),dX=(e,t)=>{e.update(t);let r=t.length%16;r&&e.update(dJ.subarray(r))},dQ=new Uint8Array(32);function d0(e,t,r,i,n){let s=e(t,r,dQ),o=dG.create(s);n&&dX(o,n),dX(o,i);let a=new Uint8Array(16),c=dP(a);dM(c,0,BigInt(n?n.length:0),!0),dM(c,8,BigInt(i.length),!0),o.update(a);let l=o.digest();return dL(s,a),l}c={blockSize:64,nonceLength:12,tagLength:16},l=(e,t,r)=>({encrypt(i,n){let s=i.length;(n=dD(s+16,n,!1)).set(i);let o=n.subarray(0,-16);dY(e,t,o,o,1);let a=d0(dY,e,t,o,r);return n.set(a,s),dL(a),n},decrypt(i,n){n=dD(i.length-16,n,!1);let s=i.subarray(0,-16),o=i.subarray(-16),a=d0(dY,e,t,s,r);if(!function(e,t){if(e.length!==t.length)return!1;let r=0;for(let i=0;i<e.length;i++)r|=e[i]^t[i];return 0===r}(o,a))throw Error("invalid tag");return n.set(i.subarray(0,-16)),dY(e,t,n,n,1),dL(a),n}}),Object.assign(function(e,...t){if(dO(e),void 0!==c.nonceLength){let e=t[0];if(!e)throw Error("nonce / iv required");c.varSizeNonce?dO(e):dO(e,c.nonceLength)}let r=c.tagLength;r&&void 0!==t[1]&&dO(t[1]);let i=l(e,...t),n=(e,t)=>{if(void 0!==t){if(2!==e)throw Error("cipher output not supported");dO(t)}},s=!1;return{encrypt(e,t){if(s)throw Error("cannot encrypt() twice with same key + nonce");return s=!0,dO(e),n(i.encrypt.length,t),i.encrypt(e,t)},decrypt(e,t){if(dO(e),r&&e.length<r)throw Error("invalid ciphertext length: smaller than tagLength="+r);return n(i.decrypt.length,t),i.decrypt(e,t)}}},c);class d1 extends hV{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,function(e){if("function"!=typeof e||"function"!=typeof e.create)throw Error("Hash should be wrapped by utils.wrapConstructor");hT(e.outputLen),hT(e.blockLen)}(e);let r=hW(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,n=new Uint8Array(i);n.set(r.length>i?e.create().update(r).digest():r);for(let e=0;e<n.length;e++)n[e]^=54;this.iHash.update(n),this.oHash=e.create();for(let e=0;e<n.length;e++)n[e]^=106;this.oHash.update(n),n.fill(0)}update(e){return hP(this),this.iHash.update(e),this}digestInto(e){hP(this),hR(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:i,destroyed:n,blockLen:s,outputLen:o}=this;return e.finished=i,e.destroyed=n,e.blockLen=s,e.outputLen=o,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}let d2=(e,t,r)=>new d1(e,t).update(r).digest();d2.create=(e,t)=>new d1(e,t),new Uint8Array([0]),new Uint8Array;
902class d3 extends hV{constructor(e,t,r,i){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=hF(this.buffer)}update(e){hP(this);let{view:t,buffer:r,blockLen:i}=this,n=(e=hW(e)).length;for(let s=0;s<n;){let o=Math.min(i-this.pos,n-s);if(o===i){let t=hF(e);for(;i<=n-s;s+=i)this.process(t,s);continue}r.set(e.subarray(s,s+o),this.pos),this.pos+=o,s+=o,this.pos===i&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){hP(this),hk(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:i,isLE:n}=this,{pos:s}=this;t[s++]=128,this.buffer.subarray(s).fill(0),this.padOffset>i-s&&(this.process(r,0),s=0);for(let e=s;e<i;e++)t[e]=0;(function(e,t,r,i){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,i);let n=BigInt(32),s=BigInt(4294967295),o=Number(r>>n&s),a=Number(r&s),c=i?4:0,l=i?0:4;e.setUint32(t+c,o,i),e.setUint32(t+l,a,i)})(r,i-8,BigInt(8*this.length),n),this.process(r,0);let o=hF(e),a=this.outputLen;if(a%4)throw Error("_sha2: outputLen should be aligned to 32bit");let c=a/4,l=this.get();if(c>l.length)throw Error("_sha2: outputLen bigger than state");for(let e=0;e<c;e++)o.setUint32(4*e,l[e],n)}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:i,finished:n,destroyed:s,pos:o}=this;return e.length=i,e.pos=o,e.finished=n,e.destroyed=s,i%t&&e.buffer.set(r),e}}let d5=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),d8=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),d6=new Uint32Array(64);class d4 extends d3{constructor(){super(64,32,8,!1),this.A=0|d8[0],this.B=0|d8[1],this.C=0|d8[2],this.D=0|d8[3],this.E=0|d8[4],this.F=0|d8[5],this.G=0|d8[6],this.H=0|d8[7]}get(){let{A:e,B:t,C:r,D:i,E:n,F:s,G:o,H:a}=this;return[e,t,r,i,n,s,o,a]}set(e,t,r,i,n,s,o,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|i,this.E=0|n,this.F=0|s,this.G=0|o,this.H=0|a}process(e,t){for(let r=0;r<16;r++,t+=4)d6[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=d6[e-15],r=d6[e-2],i=hq(t,7)^hq(t,18)^t>>>3,n=hq(r,17)^hq(r,19)^r>>>10;d6[e]=n+d6[e-7]+i+d6[e-16]|0}let{A:r,B:i,C:n,D:s,E:o,F:a,G:c,H:l}=this;for(let e=0;e<64;e++){var u,h,d,p;let t=l+(hq(o,6)^hq(o,11)^hq(o,25))+((u=o)&a^~u&c)+d5[e]+d6[e]|0,f=(hq(r,2)^hq(r,13)^hq(r,22))+((h=r)&(d=i)^h&(p=n)^d&p)|0;l=c,c=a,a=o,o=s+t|0,s=n,n=i,i=r,r=t+f|0}r=r+this.A|0,i=i+this.B|0,n=n+this.C|0,s=s+this.D|0,o=o+this.E|0,a=a+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(r,i,n,s,o,a,c,l)}roundClean(){d6.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}let d9=hK(()=>new d4),d7=BigInt(0),pe=BigInt(1),pt=BigInt(2);function pr(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function pi(e){if(!pr(e))throw Error("Uint8Array expected")}function pn(e,t){if("boolean"!=typeof t)throw Error(e+" boolean expected, got "+t)}let ps=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function po(e){pi(e);let t="";for(let r=0;r<e.length;r++)t+=ps[e[r]];return t}function pa(e){let t=e.toString(16);return 1&t.length?"0"+t:t}function pc(e){if("string"!=typeof e)throw Error("hex string expected, got "+typeof e);return""===e?d7:BigInt("0x"+e)}let pl={_0:48,_9:57,A:65,F:70,a:97,f:102};function pu(e){return e>=pl._0&&e<=pl._9?e-pl._0:e>=pl.A&&e<=pl.F?e-(pl.A-10):e>=pl.a&&e<=pl.f?e-(pl.a-10):void 0}function ph(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 i=new Uint8Array(r);for(let t=0,n=0;t<r;t++,n+=2){let r=pu(e.charCodeAt(n)),s=pu(e.charCodeAt(n+1));if(void 0===r||void 0===s)throw Error('hex string expected, got non-hex character "'+(e[n]+e[n+1])+'" at index '+n);i[t]=16*r+s}return i}function pd(e){return pc(po(e))}function pp(e){return pi(e),pc(po(Uint8Array.from(e).reverse()))}function pf(e,t){return ph(e.toString(16).padStart(2*t,"0"))}function pg(e,t){return pf(e,t).reverse()}function pm(e,t,r){let i;if("string"==typeof t)try{i=ph(t)}catch(t){throw Error(e+" must be hex string or Uint8Array, cause: "+t)}else if(pr(t))i=Uint8Array.from(t);else throw Error(e+" must be hex string or Uint8Array");let n=i.length;if("number"==typeof r&&n!==r)throw Error(e+" of length "+r+" expected, got "+n);return i}function py(...e){let t=0;for(let r=0;r<e.length;r++){let i=e[r];pi(i),t+=i.length}let r=new Uint8Array(t);for(let t=0,i=0;t<e.length;t++){let n=e[t];r.set(n,i),i+=n.length}return r}
902let pw=e=>"bigint"==typeof e&&d7<=e;function pb(e,t,r){return pw(e)&&pw(t)&&pw(r)&&t<=e&&e<r}function pv(e,t,r,i){if(!pb(t,r,i))throw Error("expected valid "+e+": "+r+" <= n < "+i+", got "+t)}function pE(e){let t;for(t=0;e>d7;e>>=pe,t+=1);return t}let p_=e=>(pt<<BigInt(e-1))-pe,pC=e=>new Uint8Array(e),pA=e=>Uint8Array.from(e);function pI(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=pC(e),n=pC(e),s=0,o=()=>{i.fill(1),n.fill(0),s=0},a=(...e)=>r(n,i,...e),c=(e=pC())=>{n=a(pA([0]),e),i=a(),0!==e.length&&(n=a(pA([1]),e),i=a())},l=()=>{if(s++>=1e3)throw Error("drbg: tried 1000 values");let e=0,r=[];for(;e<t;){let t=(i=a()).slice();r.push(t),e+=i.length}return py(...r)};return(e,t)=>{let r;for(o(),c(e);!(r=t(l()));)c();return o(),r}}let pS={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||pr(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 pN(e,t,r={}){let i=(t,r,i)=>{let n=pS[r];if("function"!=typeof n)throw Error("invalid validator function");let s=e[t];if(!(i&&void 0===s)&&!n(s,e))throw Error("param "+String(t)+" is invalid. Expected "+r+", got "+s)};for(let[e,r]of Object.entries(t))i(e,r,!1);for(let[e,t]of Object.entries(r))i(e,t,!0);return e}function pO(e){let t=new WeakMap;return(r,...i)=>{let n=t.get(r);if(void 0!==n)return n;let s=e(r,...i);return t.set(r,s),s}}var px=Object.freeze({__proto__:null,isBytes:pr,abytes:pi,abool:pn,bytesToHex:po,numberToHexUnpadded:pa,hexToNumber:pc,hexToBytes:ph,bytesToNumberBE:pd,bytesToNumberLE:pp,numberToBytesBE:pf,numberToBytesLE:pg,numberToVarBytesBE:function(e){return ph(pa(e))},ensureBytes:pm,concatBytes:py,equalBytes:function(e,t){if(e.length!==t.length)return!1;let r=0;for(let i=0;i<e.length;i++)r|=e[i]^t[i];return 0===r},utf8ToBytes:function(e){if("string"!=typeof e)throw Error("string expected");return new Uint8Array(new TextEncoder().encode(e))},inRange:pb,aInRange:pv,bitLen:pE,bitGet:function(e,t){return e>>BigInt(t)&pe},bitSet:function(e,t,r){return e|(r?pe:d7)<<BigInt(t)},bitMask:p_,createHmacDrbg:pI,validateObject:pN,notImplemented:()=>{throw Error("not implemented")},memoized:pO});let pT=BigInt(0),pR=BigInt(1),pP=BigInt(2),pk=BigInt(3),pD=BigInt(4),pM=BigInt(5),pU=BigInt(8);function pL(e,t){let r=e%t;return r>=pT?r:t+r}function pB(e,t,r){if(t<pT)throw Error("invalid exponent, negatives unsupported");if(r<=pT)throw Error("invalid modulus");if(r===pR)return pT;let i=pR;for(;t>pT;)t&pR&&(i=i*e%r),e=e*e%r,t>>=pR;return i}function pj(e,t,r){let i=e;for(;t-- >pT;)i*=i,i%=r;return i}function p$(e,t){if(e===pT)throw Error("invert: expected non-zero number");if(t<=pT)throw Error("invert: expected positive modulus, got "+t);let r=pL(e,t),i=t,n=pT,s=pR;for(;r!==pT;){let e=i/r,t=i%r,o=n-s*e;i=r,r=t,n=s,s=o}if(i!==pR)throw Error("invert: does not exist");return pL(n,t)}let pF=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function pq(e,t){let r=void 0!==t?t:e.toString(2).length;return{nBitLength:r,nByteLength:Math.ceil(r/8)}}function pz(e,t,r=!1,i={}){let n;if(e<=pT)throw Error("invalid field: expected ORDER > 0, got "+e);let{nBitLength:s,nByteLength:o}=pq(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:pT,ONE:pR,create:t=>pL(t,e),isValid:t=>{if("bigint"!=typeof t)throw Error("invalid field element: expected bigint, got "+typeof t);return pT<=t&&t<e},is0:e=>e===pT,isOdd:e=>(e&pR)===pR,neg:t=>pL(-t,e),eql:(e,t)=>e===t,sqr:t=>pL(t*t,e),add:(t,r)=>pL(t+r,e),sub:(t,r)=>pL(t-r,e),mul:(t,r)=>pL(t*r,e),pow:(e,t)=>(function(e,t,r){if(r<pT)throw Error("invalid exponent, negatives unsupported");if(r===pT)return e.ONE;if(r===pR)return t;let i=e.ONE,n=t;for(;r>pT;)r&pR&&(i=e.mul(i,n)),n=e.sqr(n),r>>=pR;return i})(a,e,t),div:(t,r)=>pL(t*p$(r,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>
902p$(t,e),sqrt:i.sqrt||(t=>(n||(n=function(e){if(e%pD===pk){let t=(e+pR)/pD;return function(e,r){let i=e.pow(r,t);if(!e.eql(e.sqr(i),r))throw Error("Cannot find square root");return i}}if(e%pU===pM){let t=(e-pM)/pU;return function(e,r){let i=e.mul(r,pP),n=e.pow(i,t),s=e.mul(r,n),o=e.mul(e.mul(s,pP),n),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,i;let n=(e-pR)/pP;for(t=e-pR,r=0;t%pP===pT;t/=pP,r++);for(i=pP;i<e&&pB(i,n,e)!==e-pR;i++)if(i>1e3)throw Error("Cannot find square root: likely non-prime P");if(1===r){let t=(e+pR)/pD;return function(e,r){let i=e.pow(r,t);if(!e.eql(e.sqr(i),r))throw Error("Cannot find square root");return i}}let s=(t+pR)/pP;return function(e,o){if(e.pow(o,n)===e.neg(e.ONE))throw Error("Cannot find square root");let a=r,c=e.pow(e.mul(e.ONE,i),t),l=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(c,pR<<BigInt(a-t-1));c=e.sqr(r),l=e.mul(l,r),u=e.mul(u,c),a=t}return l}}(e)}(e)),n(a,t))),invertBatch:e=>(function(e,t){let r=Array(t.length),i=t.reduce((t,i,n)=>e.is0(i)?t:(r[n]=t,e.mul(t,i)),e.ONE),n=e.inv(i);return t.reduceRight((t,i,n)=>e.is0(i)?t:(r[n]=e.mul(t,r[n]),e.mul(t,i)),n),r})(a,e),cmov:(e,t,r)=>r?t:e,toBytes:e=>r?pg(e,o):pf(e,o),fromBytes:e=>{if(e.length!==o)throw Error("Field.fromBytes: expected "+o+" bytes, got "+e.length);return r?pp(e):pd(e)}});return Object.freeze(a)}function pH(e){if("bigint"!=typeof e)throw Error("field order must be bigint");return Math.ceil(e.toString(2).length/8)}function pW(e){let t=pH(e);return t+Math.ceil(t/2)}let pV=BigInt(0),pK=BigInt(1);function pZ(e,t){let r=t.negate();return e?r:t}function pG(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw Error("invalid window size, expected [1.."+t+"], got W="+e)}function pY(e,t){return pG(e,t),{windows:Math.ceil(t/e)+1,windowSize:2**(e-1)}}let pJ=new WeakMap,pX=new WeakMap;function pQ(e){return pX.get(e)||1}function p0(e){return pN(e.Fp,pF.reduce((e,t)=>(e[t]="function",e),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),pN(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...pq(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}BigInt(0),BigInt(1),BigInt(2),BigInt(8),BigInt(0),BigInt(1);let p1=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949");BigInt(0);let p2=BigInt(1),p3=BigInt(2),p5=BigInt(3),p8=BigInt(5);function p6(e){void 0!==e.lowS&&pn("lowS",e.lowS),void 0!==e.prehash&&pn("prehash",e.prehash)}BigInt(8),function(e){let t=(pN(e,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...e})),{P:r}=t,i=e=>pL(e,r),n=t.montgomeryBits;t.nByteLength,t.adjustScalarBytes||(e=>e),t.powPminus2||(e=>pB(e,r-BigInt(2),r));t.a,BigInt(2),BigInt(4),pg(i(t.Gu),Math.ceil(n/8))}({P:p1,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:e=>{let{pow_p_5_8:t,b2:r}=function(e){let t=BigInt(10),r=BigInt(20),i=BigInt(40),n=BigInt(80),s=e*e%p1*e%p1,o=pj(s,p3,p1)*s%p1,a=pj(o,p2,p1)*e%p1,c=pj(a,p8,p1)*a%p1,l=pj(c,t,p1)*c%p1,u=pj(l,r,p1)*l%p1,h=pj(u,i,p1)*u%p1,d=pj(h,n,p1)*h%p1,p=pj(d,n,p1)*h%p1,f=pj(p,t,p1)*c%p1;return{pow_p_5_8:pj(f,p3,p1)*e%p1,b2:s}}(e);return pL(pj(t,p5,p1)*r,p1)},adjustScalarBytes:function(e){return e[0]&=248,e[31]&=127,e[31]|=64,e},randomBytes:hZ});let{bytesToNumberBE:p4,hexToBytes:p9}=px;class p7 extends Error{constructor(e=""){super(e)}}let fe={Err:p7,_tlv:{encode:(e,t)=>{let{Err:r}=fe;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(1&t.length)throw new r("tlv.encode: unpadded data");let i=t.length/2,n=pa(i);if(n.length/2&128)throw new r("tlv.encode: long form length too big");let s=i>127?pa(n.length/2|128):"";return pa(e)+s+n+t},decode(e,t){let{Err:r}=fe,i=0;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(t.length<2||t[i++]!==e)throw new r("tlv.decode: wrong tlv");let n=t[i++],s=0;if(128&n){let e=127&n;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(i,i+e);
902if(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(i+=e,s<128)throw new r("tlv.decode(long): not minimal encoding")}else s=n;let o=t.subarray(i,i+s);if(o.length!==s)throw new r("tlv.decode: wrong value length");return{v:o,l:t.subarray(i+s)}}},_int:{encode(e){let{Err:t}=fe;if(e<ft)throw new t("integer: negative integers are not allowed");let r=pa(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}=fe;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 p4(e)}},toSig(e){let{Err:t,_int:r,_tlv:i}=fe,n="string"==typeof e?p9(e):e;pi(n);let{v:s,l:o}=i.decode(48,n);if(o.length)throw new t("invalid signature: left bytes after parsing");let{v:a,l:c}=i.decode(2,s),{v:l,l:u}=i.decode(2,c);if(u.length)throw new t("invalid signature: left bytes after parsing");return{r:r.decode(a),s:r.decode(l)}},hexFromSig(e){let{_tlv:t,_int:r}=fe,i=t.encode(2,r.encode(e.r)),n=t.encode(2,r.encode(e.s));return t.encode(48,i+n)}},ft=BigInt(0),fr=BigInt(1);BigInt(2);let fi=BigInt(3);BigInt(4);let fn=pz(BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff")),fs=(o={a:fn.create(BigInt("-3")),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Fp:fn,n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5"),h:BigInt(1),lowS:!1},n=d9,function(e){let t=function(e){let t=p0(e);return pN(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}(e),{Fp:r,n:i}=t,n=r.BYTES+1,s=2*r.BYTES+1;function o(e){return pL(e,i)}let{ProjectivePoint:a,normPrivateKeyToScalar:c,weierstrassEquation:l,isWithinCurveOrder:u}=function(e){var t;let r=function(e){let t=p0(e);pN(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:r,Fp:i,a:n}=t;if(r){if(!i.eql(n,i.ZERO))throw Error("invalid endomorphism, can only be defined for Koblitz curves that have a=0");if("object"!=typeof r||"bigint"!=typeof r.beta||"function"!=typeof r.splitScalar)throw Error("invalid endomorphism, expected beta: bigint and splitScalar: function")}return Object.freeze({...t})}(e),{Fp:i}=r,n=pz(r.n,r.nBitLength),s=r.toBytes||((e,t,r)=>{let n=t.toAffine();return py(Uint8Array.from([4]),i.toBytes(n.x),i.toBytes(n.y))}),o=r.fromBytes||(e=>{let t=e.subarray(1);return{x:i.fromBytes(t.subarray(0,i.BYTES)),y:i.fromBytes(t.subarray(i.BYTES,2*i.BYTES))}});function a(e){let{a:t,b:n}=r,s=i.sqr(e),o=i.mul(s,e);return i.add(i.add(o,i.mul(e,t)),n)}
902if(!i.eql(i.sqr(r.Gy),a(r.Gx)))throw Error("bad generator point: equation left != right");function c(e){let t;let{allowedPrivateKeyLengths:i,nByteLength:n,wrapPrivateKey:s,n:o}=r;if(i&&"bigint"!=typeof e){if(pr(e)&&(e=po(e)),"string"!=typeof e||!i.includes(e.length))throw Error("invalid private key");e=e.padStart(2*n,"0")}try{t="bigint"==typeof e?e:pd(pm("private key",e,n))}catch{throw Error("invalid private key, expected hex or "+n+" bytes, got "+typeof e)}return s&&(t=pL(t,o)),pv("private key",t,fr,o),t}function l(e){if(!(e instanceof d))throw Error("ProjectivePoint expected")}let u=pO((e,t)=>{let{px:r,py:n,pz:s}=e;if(i.eql(s,i.ONE))return{x:r,y:n};let o=e.is0();null==t&&(t=o?i.ONE:i.inv(s));let a=i.mul(r,t),c=i.mul(n,t),l=i.mul(s,t);if(o)return{x:i.ZERO,y:i.ZERO};if(!i.eql(l,i.ONE))throw Error("invZ was invalid");return{x:a,y:c}}),h=pO(e=>{if(e.is0()){if(r.allowInfinityPoint&&!i.is0(e.py))return;throw Error("bad point: ZERO")}let{x:t,y:n}=e.toAffine();if(!i.isValid(t)||!i.isValid(n))throw Error("bad point: x or y not FE");let s=i.sqr(n),o=a(t);if(!i.eql(s,o))throw Error("bad point: equation left != right");if(!e.isTorsionFree())throw Error("bad point: not in prime-order subgroup");return!0});class d{constructor(e,t,r){if(this.px=e,this.py=t,this.pz=r,null==e||!i.isValid(e))throw Error("x required");if(null==t||!i.isValid(t))throw Error("y required");if(null==r||!i.isValid(r))throw Error("z required");Object.freeze(this)}static fromAffine(e){let{x:t,y:r}=e||{};if(!e||!i.isValid(t)||!i.isValid(r))throw Error("invalid affine point");if(e instanceof d)throw Error("projective point not allowed");let n=e=>i.eql(e,i.ZERO);return n(t)&&n(r)?d.ZERO:new d(t,r,i.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(e){let t=i.invertBatch(e.map(e=>e.pz));return e.map((e,r)=>e.toAffine(t[r])).map(d.fromAffine)}static fromHex(e){let t=d.fromAffine(o(pm("pointHex",e)));return t.assertValidity(),t}static fromPrivateKey(e){return d.BASE.multiply(c(e))}static msm(e,t){return function(e,t,r,i){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)})}(i,t),r.length!==i.length)throw Error("arrays of points and scalars must have equal length");let n=e.ZERO,s=pE(BigInt(r.length)),o=s>12?s-3:s>4?s-2:s?2:1,a=(1<<o)-1,c=Array(a+1).fill(n),l=Math.floor((t.BITS-1)/o)*o,u=n;for(let e=l;e>=0;e-=o){c.fill(n);for(let t=0;t<i.length;t++){let n=Number(i[t]>>BigInt(e)&BigInt(a));c[n]=c[n].add(r[t])}let t=n;for(let e=c.length-1,r=n;e>0;e--)r=r.add(c[e]),t=t.add(r);if(u=u.add(t),0!==e)for(let e=0;e<o;e++)u=u.double()}return u}(d,n,e,t)}_setWindowSize(e){f.setWindowSize(this,e)}assertValidity(){h(this)}hasEvenY(){let{y:e}=this.toAffine();if(i.isOdd)return!i.isOdd(e);throw Error("Field doesn't support isOdd")}equals(e){l(e);let{px:t,py:r,pz:n}=this,{px:s,py:o,pz:a}=e,c=i.eql(i.mul(t,a),i.mul(s,n)),u=i.eql(i.mul(r,a),i.mul(o,n));return c&&u}negate(){return new d(this.px,i.neg(this.py),this.pz)}double(){let{a:e,b:t}=r,n=i.mul(t,fi),{px:s,py:o,pz:a}=this,c=i.ZERO,l=i.ZERO,u=i.ZERO,h=i.mul(s,s),p=i.mul(o,o),f=i.mul(a,a),g=i.mul(s,o);return g=i.add(g,g),u=i.mul(s,a),u=i.add(u,u),c=i.mul(e,u),l=i.mul(n,f),l=i.add(c,l),c=i.sub(p,l),l=i.add(p,l),l=i.mul(c,l),c=i.mul(g,c),u=i.mul(n,u),f=i.mul(e,f),g=i.sub(h,f),g=i.mul(e,g),g=i.add(g,u),u=i.add(h,h),h=i.add(u,h),h=i.add(h,f),h=i.mul(h,g),l=i.add(l,h),f=i.mul(o,a),f=i.add(f,f),h=i.mul(f,g),c=i.sub(c,h),u=i.mul(f,p),u=i.add(u,u),new d(c,l,u=i.add(u,u))}add(e){l(e);let{px:t,py:n,pz:s}=this,{px:o,py:a,pz:c}=e,u=i.ZERO,h=i.ZERO,p=i.ZERO,f=r.a,g=i.mul(r.b,fi),m=i.mul(t,o),y=i.mul(n,a),w=i.mul(s,c),b=i.add(t,n),v=i.add(o,a);b=i.mul(b,v),v=i.add(m,y),b=i.sub(b,v),v=i.add(t,s);let E=i.add(o,c);return v=i.mul(v,E),E=i.add(m,w),v=i.sub(v,E),E=i.add(n,s),u=i.add(a,c),E=i.mul(E,u),u=i.add(y,w),E=i.sub(E,u),p=i.mul(f,v),u=i.mul(g,w),p=i.add(u,p),u=i.sub(y,p),p=i.add(y,p),h=i.mul(u,p),y=i.add(m,m),y=i.add(y,m),w=i.mul(f,w),v=i.mul(g,v),y=i.add(y,w),w=i.sub(m,w),w=i.mul(f,w),v=i.add(v,w),m=i.mul(y,v),h=i.add(h,m),m=i.mul(E,v),u=i.mul(b,u),u=i.sub(u,m),m=i.mul(b,y),p=i.mul(E,p),new d(u,h,p=i.add(p,m))}subtract(e){return this.add(e.negate())}is0(){return this.equals(d.ZERO)}wNAF(e){return f.wNAFCached(this,e,d.normalizeZ)}multiplyUnsafe(e){let{endo:t,n:n}=r;pv("scalar",e,ft,n);let s=d.ZERO;if(e===ft)return s;if(this.is0()||e===fr)return this;if(!t||f.hasPrecomputes(this))return f.wNAFCachedUnsafe(this,e,d.normalizeZ);
902let{k1neg:o,k1:a,k2neg:c,k2:l}=t.splitScalar(e),u=s,h=s,p=this;for(;a>ft||l>ft;)a&fr&&(u=u.add(p)),l&fr&&(h=h.add(p)),p=p.double(),a>>=fr,l>>=fr;return o&&(u=u.negate()),c&&(h=h.negate()),h=new d(i.mul(h.px,t.beta),h.py,h.pz),u.add(h)}multiply(e){let t,n;let{endo:s,n:o}=r;if(pv("scalar",e,fr,o),s){let{k1neg:r,k1:o,k2neg:a,k2:c}=s.splitScalar(e),{p:l,f:u}=this.wNAF(o),{p:h,f:p}=this.wNAF(c);l=f.constTimeNegate(r,l),h=f.constTimeNegate(a,h),h=new d(i.mul(h.px,s.beta),h.py,h.pz),t=l.add(h),n=u.add(p)}else{let{p:r,f:i}=this.wNAF(e);t=r,n=i}return d.normalizeZ([t,n])[0]}multiplyAndAddUnsafe(e,t,r){let i=d.BASE,n=(e,t)=>t!==ft&&t!==fr&&e.equals(i)?e.multiply(t):e.multiplyUnsafe(t),s=n(this,t).add(n(e,r));return s.is0()?void 0:s}toAffine(e){return u(this,e)}isTorsionFree(){let{h:e,isTorsionFree:t}=r;if(e===fr)return!0;if(t)return t(d,this);throw Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:e,clearCofactor:t}=r;return e===fr?this:t?t(d,this):this.multiplyUnsafe(r.h)}toRawBytes(e=!0){return pn("isCompressed",e),this.assertValidity(),s(d,this,e)}toHex(e=!0){return pn("isCompressed",e),po(this.toRawBytes(e))}}d.BASE=new d(r.Gx,r.Gy,i.ONE),d.ZERO=new d(i.ZERO,i.ONE,i.ZERO);let p=r.nBitLength,f=(t=r.endo?Math.ceil(p/2):p,{constTimeNegate:pZ,hasPrecomputes:e=>1!==pQ(e),unsafeLadder(e,t,r=d.ZERO){let i=e;for(;t>pV;)t&pK&&(r=r.add(i)),i=i.double(),t>>=pK;return r},precomputeWindow(e,r){let{windows:i,windowSize:n}=pY(r,t),s=[],o=e,a=o;for(let e=0;e<i;e++){a=o,s.push(a);for(let e=1;e<n;e++)a=a.add(o),s.push(a);o=a.double()}return s},wNAF(e,r,i){let{windows:n,windowSize:s}=pY(e,t),o=d.ZERO,a=d.BASE,c=BigInt(2**e-1),l=2**e,u=BigInt(e);for(let e=0;e<n;e++){let t=e*s,n=Number(i&c);i>>=u,n>s&&(n-=l,i+=pK);let h=t+Math.abs(n)-1,d=e%2!=0,p=n<0;0===n?a=a.add(pZ(d,r[t])):o=o.add(pZ(p,r[h]))}return{p:o,f:a}},wNAFUnsafe(e,r,i,n=d.ZERO){let{windows:s,windowSize:o}=pY(e,t),a=BigInt(2**e-1),c=2**e,l=BigInt(e);for(let e=0;e<s;e++){let t=e*o;if(i===pV)break;let s=Number(i&a);if(i>>=l,s>o&&(s-=c,i+=pK),0===s)continue;let u=r[t+Math.abs(s)-1];s<0&&(u=u.negate()),n=n.add(u)}return n},getPrecomputes(e,t,r){let i=pJ.get(t);return i||(i=this.precomputeWindow(t,e),1!==e&&pJ.set(t,r(i))),i},wNAFCached(e,t,r){let i=pQ(e);return this.wNAF(i,this.getPrecomputes(i,e,r),t)},wNAFCachedUnsafe(e,t,r,i){let n=pQ(e);return 1===n?this.unsafeLadder(e,t,i):this.wNAFUnsafe(n,this.getPrecomputes(n,e,r),t,i)},setWindowSize(e,r){pG(r,t),pX.set(e,r),pJ.delete(e)}});return{CURVE:r,ProjectivePoint:d,normPrivateKeyToScalar:c,weierstrassEquation:a,isWithinCurveOrder:function(e){return pb(e,fr,r.n)}}}({...t,toBytes(e,t,i){let n=t.toAffine(),s=r.toBytes(n.x);return pn("isCompressed",i),i?py(Uint8Array.from([t.hasEvenY()?2:3]),s):py(Uint8Array.from([4]),s,r.toBytes(n.y))},fromBytes(e){let t=e.length,i=e[0],o=e.subarray(1);if(t===n&&(2===i||3===i)){let e;let t=pd(o);if(!pb(t,fr,r.ORDER))throw Error("Point is not on curve");let n=l(t);try{e=r.sqrt(n)}catch(e){throw Error("Point is not on curve"+(e instanceof Error?": "+e.message:""))}return(1&i)==1!=((e&fr)===fr)&&(e=r.neg(e)),{x:t,y:e}}if(t===s&&4===i)return{x:r.fromBytes(o.subarray(0,r.BYTES)),y:r.fromBytes(o.subarray(r.BYTES,2*r.BYTES))};throw Error("invalid Point, expected length of "+n+", or uncompressed "+s+", got "+t)}}),h=e=>po(pf(e,t.nByteLength)),d=(e,t,r)=>pd(e.slice(t,r));class p{constructor(e,t,r){this.r=e,this.s=t,this.recovery=r,this.assertValidity()}static fromCompact(e){let r=t.nByteLength;return new p(d(e=pm("compactSignature",e,2*r),0,r),d(e,r,2*r))}static fromDER(e){let{r:t,s:r}=fe.toSig(pm("DER",e));return new p(t,r)}assertValidity(){pv("r",this.r,fr,i),pv("s",this.s,fr,i)}addRecoveryBit(e){return new p(this.r,this.s,e)}recoverPublicKey(e){let{r:n,s:s,recovery:c}=this,l=m(pm("msgHash",e));if(null==c||![0,1,2,3].includes(c))throw Error("recovery id invalid");let u=2===c||3===c?n+t.n:n;if(u>=r.ORDER)throw Error("recovery id 2 or 3 invalid");let d=(1&c)==0?"02":"03",p=a.fromHex(d+h(u)),f=p$(u,i),g=o(-l*f),y=o(s*f),w=a.BASE.multiplyAndAddUnsafe(p,g,y);if(!w)throw Error("point at infinify");return w.assertValidity(),w}hasHighS(){return this.s>i>>fr}normalizeS(){return this.hasHighS()?new p(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return ph(this.toDERHex())}toDERHex(){return fe.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return ph(this.toCompactHex())}toCompactHex(){return h(this.r)+h(this.s)}}function f(e){let t=pr(e),r="string"==typeof e,i=(t||r)&&e.length;return t?i===n||i===s:r?i===2*n||i===2*s:e instanceof a}let g=t.bits2int||function(e){if(e.length>8192)throw Error("input is too large");let r=pd(e),i=8*e.length-t.nBitLength;return i>0?r>>BigInt(i):r},m=t.bits2int_modN||function(e){return o(g(e))},y=p_(t.nBitLength);function w(e){return pv("num < 2^"+t.nBitLength,e,ft,y),pf(e,t.nByteLength)}let b={lowS:t.lowS,prehash:!1},v={lowS:t.lowS,prehash:!1};a.BASE._setWindowSize(8)}({...o,hash:n,hmac:(e,...t)=>d2(n,e,function(...e){let t=0;for(let r=0;r<e.length;r++){let i=e[r];hR(i),t+=i.length}let r=new Uint8Array(t);for(let t=0,i=0;t<e.length;t++){let n=e[t];r.set(n,i),i+=n.length}return r}(...t)),randomBytes:hZ}),"base16"),fo="base64pad",fa="base64url";function fc(e){return nd(d9(nh(e,fs)),fs)}function fl(e){return nd(d9(nh(e,"utf8")),fs)}function fu(e,t,r){return`${e}?wc_ev=${r}&topic=${t}`}function fh(e){let t=[];
902return e.forEach(e=>{let[r,i]=e.split(":");t.push(`${r}:${i}`)}),t}function fd(e,t){let r=function(e){let t={};return e?.forEach(e=>{var r;let[i,n]=e.split(":");t[i]||(t[i]={accounts:[],chains:[],events:[],methods:[]}),t[i].accounts.push(e),null==(r=t[i].chains)||r.push(`${i}:${n}`)}),t}(t=t.map(e=>e.replace("did:pkh:","")));for(let[t,i]of Object.entries(r))i.methods?i.methods=function(e=[],t=[]){return[...new Set([...e,...t])]}(i.methods,e):i.methods=e,i.events=["chainChanged","accountsChanged"];return r}Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;let fp={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}},ff={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 fg(e,t){let{message:r,code:i}=ff[e];return{message:t?`${r} ${t}`:r,code:i}}function fm(e,t){let{message:r,code:i}=fp[e];return{message:t?`${r} ${t}`:r,code:i}}function fy(e,t){return!!Array.isArray(e)&&(!("u">typeof t)||!e.length||e.every(t))}function fw(e){return Object.getPrototypeOf(e)===Object.prototype&&Object.keys(e).length}function fb(e){return typeof e>"u"}function fv(e,t){return!!(t&&fb(e))||"string"==typeof e&&!!e.trim().length}function fE(e,t){return!!(t&&fb(e))||"number"==typeof e&&!isNaN(e)}function f_(e){return!!(fv(e,!1)&&e.includes(":"))&&2===e.split(":").length}function fC(e){let t=!0;return fy(e)?e.length&&(t=e.every(e=>fv(e,!1))):t=!1,t}function fA(e,t){let r=null;return Object.values(e).forEach(e=>{var i;let n;if(r)return;let s=(i=`${t}, namespace`,n=null,fC(e?.methods)?fC(e?.events)||(n=fm("UNSUPPORTED_EVENTS",`${i}, events should be an array of strings or empty array for no events`)):n=fm("UNSUPPORTED_METHODS",`${i}, methods should be an array of strings or empty array for no methods`),n);s&&(r=s)}),r}function fI(e,t){let r=null;if(e&&fw(e)){let i;let n=fA(e,t);n&&(r=n);let s=(i=null,Object.values(e).forEach(e=>{var r,n;let s;if(i)return;let o=(r=e?.accounts,n=`${t} namespace`,s=null,fy(r)?r.forEach(e=>{s||function(e){if(fv(e,!1)&&e.includes(":")){let t=e.split(":");if(3===t.length){let e=t[0]+":"+t[1];return!!t[2]&&f_(e)}}return!1}(e)||(s=fm("UNSUPPORTED_ACCOUNTS",`${n}, account ${e} should be a string and conform to "namespace:chainId:address" format`))}):s=fm("UNSUPPORTED_ACCOUNTS",`${n}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),s);o&&(i=o)}),i);s&&(r=s)}else r=fg("MISSING_OR_INVALID",`${t}, namespaces should be an object with data`);return r}function fS(e){return fv(e.protocol,!0)}function fN(e){return"u">typeof e}function fO(e,t){return!(!f_(t)||!(function(e){let t=[];
902return Object.values(e).forEach(e=>{t.push(...fh(e.accounts))}),t})(e).includes(t))}function fx(e,t,r){let i=null,n=function(e){let t={};return Object.keys(e).forEach(r=>{var i;r.includes(":")?t[r]=e[r]:null==(i=e[r].chains)||i.forEach(i=>{t[i]={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 i=fh(e[r].accounts);i?.forEach(i=>{t[i]={accounts:e[r].accounts.filter(e=>e.includes(`${i}:`)),methods:e[r].methods,events:e[r].events}})}}),t}(t),o=Object.keys(n),a=Object.keys(s),c=fT(Object.keys(e)),l=fT(Object.keys(t)),u=c.filter(e=>!l.includes(e));return u.length&&(i=fg("NON_CONFORMING_NAMESPACES",`${r} namespaces keys don't satisfy requiredNamespaces.
903      Required: ${u.toString()}
904      Received: ${Object.keys(t).toString()}`)),h_(o,a)||(i=fg("NON_CONFORMING_NAMESPACES",`${r} namespaces chains don't satisfy required namespaces.
905      Required: ${o.toString()}
906      Approved: ${a.toString()}`)),Object.keys(t).forEach(e=>{if(!e.includes(":")||i)return;let n=fh(t[e].accounts);n.includes(e)||(i=fg("NON_CONFORMING_NAMESPACES",`${r} namespaces accounts don't satisfy namespace accounts for ${e}
907        Required: ${e}
908        Approved: ${n.toString()}`))}),o.forEach(e=>{i||(h_(n[e].methods,s[e].methods)?h_(n[e].events,s[e].events)||(i=fg("NON_CONFORMING_NAMESPACES",`${r} namespaces events don't satisfy namespace events for ${e}`)):i=fg("NON_CONFORMING_NAMESPACES",`${r} namespaces methods don't satisfy namespace methods for ${e}`))}),i}function fT(e){return[...new Set(e.map(e=>e.includes(":")?e.split(":")[0]:e))]}let fR={};class fP{static get(e){return fR[e]}static set(e,t){fR[e]=t}static delete(e){delete fR[e]}}let fk="client",fD=`wc@2:${fk}:`,fM={name:fk,logger:"error"},fU="WALLETCONNECT_DEEPLINK_CHOICE",fL="Proposal expired",fB=O.SEVEN_DAYS,fj={wc_sessionPropose:{req:{ttl:O.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:O.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:O.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:O.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:O.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:O.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:O.ONE_DAY,prompt:!1,tag:1104},res:{ttl:O.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:O.ONE_DAY,prompt:!1,tag:1106},res:{ttl:O.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:O.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:O.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:O.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:O.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:O.ONE_DAY,prompt:!1,tag:1112},res:{ttl:O.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:O.ONE_DAY,prompt:!1,tag:1114},res:{ttl:O.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:O.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:O.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:O.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:O.FIVE_MINUTES,prompt:!1,tag:1119}}},f$={min:O.FIVE_MINUTES,max:O.SEVEN_DAYS},fF={idle:"IDLE",active:"ACTIVE"},fq={eth_sendTransaction:{key:""},eth_sendRawTransaction:{key:""},wallet_sendCalls:{key:""},solana_signTransaction:{key:"signature"},solana_signAllTransactions:{key:"transactions"},solana_signAndSendTransaction:{key:"signature"}},fz=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],fH="[email protected]:auth:",fW=`${fH}:PUB_KEY`;var fV=Object.defineProperty,fK=Object.defineProperties,fZ=Object.getOwnPropertyDescriptors,fG=Object.getOwnPropertySymbols,fY=Object.prototype.hasOwnProperty,fJ=Object.prototype.propertyIsEnumerable,fX=(e,t,r)=>t in e?fV(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,fQ=(e,t)=>{for(var r in t||(t={}))fY.call(t,r)&&fX(e,r,t[r]);if(fG)for(var r of fG(t))fJ.call(t,r)&&fX(e,r,t[r]);return e},f0=(e,t)=>fK(e,fZ(t)),f1=(e,t,r)=>fX(e,"symbol"!=typeof t?t+"":t,r);class f2 extends u${constructor(e){super(e),f1(this,"name","engine"),f1(this,"events",new(N())),f1(this,"initialized",!1),f1(this,"requestQueue",{state:fF.idle,queue:[]}),f1(this,"sessionRequestQueue",{state:fF.idle,queue:[]}),f1(this,"requestQueueDelay",O.ONE_SECOND),f1(this,"expectedPairingMethodMap",new Map),f1(this,"recentlyDeletedMap",new Map),f1(this,"recentlyDeletedLimit",200),f1(this,"relayMessageCache",[]),f1(this,"pendingSessions",new Map),f1(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(fj)}),this.initialized=!0,setTimeout(async()=>{await this.processPendingMessageEvents(),this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},(0,O.toMiliseconds)(this.requestQueueDelay)))}),f1(this,"connect",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow();let t=f0(fQ({},e),{requiredNamespaces:e.requiredNamespaces||{},optionalNamespaces:e.optionalNamespaces||{}});await this.isValidConnect(t);let{pairingTopic:r,requiredNamespaces:i,optionalNamespaces:n,sessionProperties:s,scopedProperties:o,relays:a}=t,c=r,l,u=!1;try{if(c){let e=this.client.core.pairing.pairings.get(c);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(${c}) failed`),e}if(!c||!u){let{topic:e,uri:t}=await this.client.core.pairing.create();c=e,l=t}if(!c){let{message:e}=fg("NO_MATCHING_KEY",`connect() pairing topic: ${c}`);throw Error(e)}let h=await this.client.core.crypto.generateKeyPair(),d=fj.wc_sessionPropose.req.ttl||O.FIVE_MINUTES,p=hA(d),f=f0(fQ(fQ({requiredNamespaces:i,optionalNamespaces:n,relays:a??[{protocol:"irn"}],proposer:{publicKey:h,metadata:this.client.metadata},expiryTimestamp:p,pairingTopic:c},s&&{sessionProperties:s}),o&&{scopedProperties:o}),{id:aA()}),g=hS("session_connect",f.id),{reject:m,resolve:y,done:w}=hC(d,fL),b=({id:e})=>{e===f.id&&(this.client.events.off("proposal_expire",b),this.pendingSessions.delete(f.id),this.events.emit(g,{error:{message:fL,code:0}}))};return this.client.events.on("proposal_expire",b),this.events.once(g,({error:e,session:t})=>{this.client.events.off("proposal_expire",b),e?m(e):t&&y(t)}),await this.sendRequest({topic:c,method:"wc_sessionPropose",params:f,throwOnFailedPublish:!0,clientRpcId:f.id}),await this.setProposal(f.id,f),{uri:l,approval:w}}),f1(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}}),f1(this,"approve",async e=>{var t,r,i;let n=this.client.core.eventClient.createEvent({properties:{topic:null==(t=e?.id)?void 0:t.toString(),trace:[ca.session_approve_started]}});try{this.isInitialized(),await this.confirmOnlineStateOrThrow()}catch(e){throw n.setError(cc.no_internet_connection),e}try{await this.isValidProposalId(e?.id)}catch(t){throw this.client.logger.error(`approve() -> proposal.get(${e?.id}) failed`),n.setError(cc.proposal_not_found),t}try{await this.isValidApprove(e)}catch(e){throw this.client.logger.error("approve() -> isValidApprove() failed"),n.setError(cc.session_approve_namespace_validation_failure),e}let{id:s,relayProtocol:o,namespaces:a,sessionProperties:c,scopedProperties:l,sessionConfig:u}=e,h=this.client.proposal.get(s);this.client.core.eventClient.deleteEvent({eventId:n.eventId});let{pairingTopic:d,proposer:p,requiredNamespaces:f,optionalNamespaces:g}=h,m=null==(r=this.client.core.eventClient)?void 0:r.getEvent({topic:d});m||(m=null==(i=this.client.core.eventClient)?void 0:i.createEvent({type:ca.session_approve_started,properties:{topic:d,trace:[ca.session_approve_started,ca.session_namespaces_validation_success]}}));let y=await this.client.core.crypto.generateKeyPair(),w=p.publicKey,b=await this.client.core.crypto.generateSharedKey(y,w),v=fQ(fQ(fQ({relay:{protocol:o??"irn"},namespaces:a,controller:{publicKey:y,metadata:this.client.metadata},expiry:hA(fB)},c&&{sessionProperties:c}),l&&{scopedProperties:l}),u&&{sessionConfig:u}),E=a5.relay;m.addTrace(ca.subscribing_session_topic);try{await this.client.core.relayer.subscribe(b,{transportType:E})}catch(e){throw m.setError(cc.subscribe_session_topic_failure),e}m.addTrace(ca.subscribe_session_topic_success);let _=f0(fQ({},v),{topic:b,requiredNamespaces:f,optionalNamespaces:g,pairingTopic:d,acknowledged:!1,self:v.controller,peer:{publicKey:p.publicKey,metadata:p.metadata},controller:y,transportType:a5.relay});await this.client.session.set(b,_),m.addTrace(ca.store_session);try{m.addTrace(ca.publishing_session_settle),await this.sendRequest({topic:b,method:"wc_sessionSettle",params:v,throwOnFailedPublish:!0}).catch(e=>{throw m?.setError(cc.session_settle_publish_failure),e}),m.addTrace(ca.session_settle_publish_success),m.addTrace(ca.publishing_session_approve),await this.sendResult({id:s,topic:d,result:{relay:{protocol:o??"irn"},responderPublicKey:y},throwOnFailedPublish:!0}).catch(e=>{throw m?.setError(cc.session_approve_publish_failure),e}),m.addTrace(ca.session_approve_publish_success)}catch(e){throw this.client.logger.error(e),this.client.session.delete(b,fm("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(b),e}return this.client.core.eventClient.deleteEvent({eventId:m.eventId}),await this.client.core.pairing.updateMetadata({topic:d,metadata:p.metadata}
908),await this.client.proposal.delete(s,fm("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:d}),await this.setExpiry(b,hA(fB)),{topic:b,acknowledged:()=>Promise.resolve(this.client.session.get(b))}}),f1(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:i}=e;try{t=this.client.proposal.get(r).pairingTopic}catch(e){throw this.client.logger.error(`reject() -> proposal.get(${r}) failed`),e}t&&(await this.sendError({id:r,topic:t,error:i,rpcOpts:fj.wc_sessionPropose.reject}),await this.client.proposal.delete(r,fm("USER_DISCONNECTED")))}),f1(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:i,resolve:n,reject:s}=hC(),o=aA(),a=aI().toString(),c=this.client.session.get(t).namespaces;return this.events.once(hS("session_update",o),({error:e})=>{e?s(e):n()}),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:c}),s(e)}),{acknowledged:i}}),f1(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=aA(),{done:i,resolve:n,reject:s}=hC();return this.events.once(hS("session_extend",r),({error:e})=>{e?s(e):n()}),await this.setExpiry(t,hA(fB)),this.sendRequest({topic:t,method:"wc_sessionExtend",params:{},clientRpcId:r,throwOnFailedPublish:!0}).catch(e=>{s(e)}),{acknowledged:i}}),f1(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:i,expiry:n=fj.wc_sessionRequest.req.ttl}=e,s=this.client.session.get(i);s?.transportType===a5.relay&&await this.confirmOnlineStateOrThrow();let o=aA(),a=aI().toString(),{done:c,resolve:l,reject:u}=hC(n,"Request expired. Please try again.");this.events.once(hS("session_request",o),({error:e,result:t})=>{e?u(e):l(t)});let h="wc_sessionRequest",d=this.getAppLinkIfEnabled(s.peer.metadata,s.transportType);if(d)return await this.sendRequest({clientRpcId:o,relayRpcId:a,topic:i,method:h,params:{request:f0(fQ({},r),{expiryTimestamp:hA(n)}),chainId:t},expiry:n,throwOnFailedPublish:!0,appLink:d}).catch(e=>u(e)),this.client.events.emit("session_request_sent",{topic:i,request:r,chainId:t,id:o}),await c();let p={request:f0(fQ({},r),{expiryTimestamp:hA(n)}),chainId:t},f=this.shouldSetTVF(h,p);return await Promise.all([new Promise(async e=>{await this.sendRequest(fQ({clientRpcId:o,relayRpcId:a,topic:i,method:h,params:p,expiry:n,throwOnFailedPublish:!0},f&&{tvf:this.getTVFParams(o,p)})).catch(e=>u(e)),this.client.events.emit("session_request_sent",{topic:i,request:r,chainId:t,id:o}),e()}),new Promise(async e=>{var t;if(!(null!=(t=s.sessionConfig)&&t.disableDeepLink)){let e=await hO(this.client.core.storage,fU);await hN({id:o,topic:i,wcDeepLink:e})}e()}),c()]).then(e=>e[2])}),f1(this,"respond",async e=>{this.isInitialized(),await this.isValidRespond(e);let{topic:t,response:r}=e,{id:i}=r,n=this.client.session.get(t);n.transportType===a5.relay&&await this.confirmOnlineStateOrThrow();let s=this.getAppLinkIfEnabled(n.peer.metadata,n.transportType);aB(r)?await this.sendResult({id:i,topic:t,result:r.result,throwOnFailedPublish:!0,appLink:s}):aj(r)&&await this.sendError({id:i,topic:t,error:r.error,appLink:s}),this.cleanupAfterResponse(e)}),f1(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=aA(),r=aI().toString(),{done:i,resolve:n,reject:s}=hC();this.events.once(hS("session_ping",e),({error:e})=>{e?s(e):n()}),await Promise.all([this.sendRequest({topic:t,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:e,relayRpcId:r}),i()])}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}))}),f1(this,"emit",async e=>{this.isInitialized(),await this.confirmOnlineStateOrThrow(),await this.isValidEmit(e);let{topic:t,event:r,chainId:i}=e,n=aI().toString(),s=aA();await this.sendRequest({topic:t,method:"wc_sessionEvent",params:{event:r,chainId:i},throwOnFailedPublish:!0,relayRpcId:n,clientRpcId:s})}),f1(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:fm("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}=fg("MISMATCHED_TOPIC",`Session or pairing topic not found: ${t}`);throw Error(e)}}),f1(this,"find",e=>(this.isInitialized(),this.client.session.getAll().filter(t=>(function(e,t){let{requiredNamespaces:r}=t,i=Object.keys(e.namespaces),n=Object.keys(r),s=!0;return!!h_(n,i)&&(i.forEach(t=>{let{accounts:i,methods:n,events:o}=e.namespaces[t],a=fh(i),c=r[t];h_(hc(t,c),a)&&h_(c.methods,n)&&h_(c.events,o)||(s=!1)}),s)})(t,e)))),f1(this,"getPendingSessionRequests",()=>
908this.client.pendingRequest.getAll()),f1(this,"authenticate",async(e,t)=>{var r,i,n;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?a5.link_mode:a5.relay;a===a5.relay&&await this.confirmOnlineStateOrThrow();let{chains:c,statement:l="",uri:u,domain:h,nonce:d,type:p,exp:f,nbf:g,methods:m=[],expiry:y}=e,w=[...e.resources||[]],{topic:b,uri:v}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:a});this.client.logger.info({message:"Generated new pairing",pairing:{topic:b,uri:v}});let E=await this.client.core.crypto.generateKeyPair(),_=fc(E);if(await Promise.all([this.client.auth.authKeys.set(fW,{responseTopic:_,publicKey:E}),this.client.auth.pairingTopics.set(_,{topic:_,pairingTopic:b})]),await this.client.core.relayer.subscribe(_,{transportType:a}),this.client.logger.info(`sending request to new pairing topic: ${b}`),m.length>0){let{namespace:e}=ha(c[0]),t=dE(function(e,t,r,i={}){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,i)}}}(e,"request",m));dI(w)&&(i=t,n=w.pop(),t=dE(function(e,t){dv(e),dv(t);let r=Object.keys(e.att).concat(Object.keys(t.att)).sort((e,t)=>e.localeCompare(t)),i={att:{}};return r.forEach(r=>{var n,s;Object.keys((null==(n=e.att)?void 0:n[r])||{}).concat(Object.keys((null==(s=t.att)?void 0:s[r])||{})).sort((e,t)=>e.localeCompare(t)).forEach(n=>{var s,o;i.att[r]=dp(dd({},i.att[r]),{[n]:(null==(s=e.att[r])?void 0:s[n])||(null==(o=t.att[r])?void 0:o[n])})})}),i}(d_(i),d_(n)))),w.push(t)}let C=y&&y>fj.wc_sessionAuthenticate.req.ttl?y:fj.wc_sessionAuthenticate.req.ttl,A={authPayload:{type:p??"caip122",chains:c,statement:l,aud:u,domain:h,version:"1",nonce:d,iat:new Date().toISOString(),exp:f,nbf:g,resources:w},requester:{publicKey:E,metadata:this.client.metadata},expiryTimestamp:hA(C)},I={requiredNamespaces:{},optionalNamespaces:{eip155:{chains:c,methods:[...new Set(["personal_sign",...m])],events:["chainChanged","accountsChanged"]}},relays:[{protocol:"irn"}],pairingTopic:b,proposer:{publicKey:E,metadata:this.client.metadata},expiryTimestamp:hA(fj.wc_sessionPropose.req.ttl),id:aA()},{done:S,resolve:N,reject:O}=hC(C,"Request expired"),x=aA(),T=hS("session_connect",I.id),R=hS("session_request",x),P=async({error:e,session:t})=>{this.events.off(R,k),e?O(e):t&&N({session:t})},k=async e=>{var r,i,n;let s;if(await this.deletePendingAuthRequest(x,{message:"fulfilled",code:0}),e.error){let t=fm("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return e.error.code===t.code?void 0:(this.events.off(T,P),O(e.error.message))}await this.deleteProposal(I.id),this.events.off(T,P);let{cacaos:o,responder:c}=e.result,l=[],u=[];for(let e of o){await dw({cacao:e,projectId:this.client.core.projectId})||(this.client.logger.error(e,"Signature verification failed"),O(fm("SESSION_SETTLEMENT_FAILED","Signature verification failed")));let{p:t}=e,r=dI(t.resources),i=[dm(t.iss)],n=dy(t.iss);if(r){let e=dC(r),t=dA(r);l.push(...e),i.push(...t)}for(let e of i)u.push(`${e}:${n}`)}let h=await this.client.core.crypto.generateSharedKey(E,c.publicKey);l.length>0&&(s={topic:h,acknowledged:!0,self:{publicKey:E,metadata:this.client.metadata},peer:c,controller:c.publicKey,expiry:hA(fB),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:b,namespaces:fd([...new Set(l)],[...new Set(u)]),transportType:a},await this.client.core.relayer.subscribe(h,{transportType:a}),await this.client.session.set(h,s),b&&await this.client.core.pairing.updateMetadata({topic:b,metadata:c.metadata}),s=this.client.session.get(h)),null!=(r=this.client.metadata.redirect)&&r.linkMode&&null!=(i=c.metadata.redirect)&&i.linkMode&&null!=(n=c.metadata.redirect)&&n.universal&&t&&(this.client.core.addLinkModeSupportedApp(c.metadata.redirect.universal),this.client.session.update(h,{transportType:a5.link_mode})),N({auths:o,session:s})};this.events.once(T,P),this.events.once(R,k);try{if(o){let e=aS("wc_sessionAuthenticate",A,x);this.client.core.history.set(b,e);let r=await this.client.core.crypto.encode("",e,{type:2,encoding:fa});s=fu(t,b,r)}else await Promise.all([this.sendRequest({topic:b,method:"wc_sessionAuthenticate",params:A,expiry:e.expiry,throwOnFailedPublish:!0,clientRpcId:x}),this.sendRequest({topic:b,method:"wc_sessionPropose",params:I,expiry:fj.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:I.id})])}catch(e){throw this.events.off(T,P),this.events.off(R,k),e}return await this.setProposal(I.id,I),await this.setAuthRequest(x,{request:f0(fQ({},A),{verifyContext:{}}),pairingTopic:b,transportType:a}),{uri:s??v,response:S}}),f1(this,"approveSessionAuthenticate",async e=>{let t;let{id:r,auths:i}=e,n=this.client.core.eventClient.createEvent({properties:{topic:r.toString(),trace:[cl.authenticated_session_approve_started]}});try{this.isInitialized()}catch(e){throw n.setError(cu.no_internet_connection),e}let s=this.getPendingAuthRequest(r);if(!s)throw n.setError(cu.authenticated_session_pending_request_not_found),Error(`Could not find pending auth request with id ${r}`);let o=s.transportType||a5.relay;o===a5.relay&&await this.confirmOnlineStateOrThrow();let a=s.requester.publicKey,c=await this.client.core.crypto.generateKeyPair(),l=fc(a),u={type:1,receiverPublicKey:a,senderPublicKey:c},h=[],d=[];for(let e of i){if(!await dw({cacao:e,projectId:this.client.core.projectId})){n.setError(cu.invalid_cacao);let e=fm("SESSION_SETTLEMENT_FAILED","Signature verification failed");
908throw await this.sendError({id:r,topic:l,error:e,encodeOpts:u}),Error(e.message)}n.addTrace(cl.cacaos_verified);let{p:t}=e,i=dI(t.resources),s=[dm(t.iss)],o=dy(t.iss);if(i){let e=dC(i),t=dA(i);h.push(...e),s.push(...t)}for(let e of s)d.push(`${e}:${o}`)}let p=await this.client.core.crypto.generateSharedKey(c,a);if(n.addTrace(cl.create_authenticated_session_topic),h?.length>0){t={topic:p,acknowledged:!0,self:{publicKey:c,metadata:this.client.metadata},peer:{publicKey:a,metadata:s.requester.metadata},controller:a,expiry:hA(fB),authentication:i,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:s.pairingTopic,namespaces:fd([...new Set(h)],[...new Set(d)]),transportType:o},n.addTrace(cl.subscribing_authenticated_session_topic);try{await this.client.core.relayer.subscribe(p,{transportType:o})}catch(e){throw n.setError(cu.subscribe_authenticated_session_topic_failure),e}n.addTrace(cl.subscribe_authenticated_session_topic_success),await this.client.session.set(p,t),n.addTrace(cl.store_authenticated_session),await this.client.core.pairing.updateMetadata({topic:s.pairingTopic,metadata:s.requester.metadata})}n.addTrace(cl.publishing_authenticated_session_approve);try{await this.sendResult({topic:l,id:r,result:{cacaos:i,responder:{publicKey:c,metadata:this.client.metadata}},encodeOpts:u,throwOnFailedPublish:!0,appLink:this.getAppLinkIfEnabled(s.requester.metadata,o)})}catch(e){throw n.setError(cu.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:n.eventId}),{session:t}}),f1(this,"rejectSessionAuthenticate",async e=>{this.isInitialized();let{id:t,reason:r}=e,i=this.getPendingAuthRequest(t);if(!i)throw Error(`Could not find pending auth request with id ${t}`);i.transportType===a5.relay&&await this.confirmOnlineStateOrThrow();let n=i.requester.publicKey,s=await this.client.core.crypto.generateKeyPair(),o=fc(n);await this.sendError({id:t,topic:o,error:r,encodeOpts:{type:1,receiverPublicKey:n,senderPublicKey:s},rpcOpts:fj.wc_sessionAuthenticate.reject,appLink:this.getAppLinkIfEnabled(i.requester.metadata,i.transportType)}),await this.client.auth.requests.delete(t,{message:"rejected",code:0}),await this.client.proposal.delete(t,fm("USER_DISCONNECTED"))}),f1(this,"formatAuthMessage",e=>{this.isInitialized();let{request:t,iss:r}=e;return db(t,r)}),f1(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)}),f1(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 i,n;return(null==(i=r.peerMetadata)?void 0:i.url)&&(null==(n=r.peerMetadata)?void 0:n.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)}}),f1(this,"deleteSession",async e=>{var t;let{topic:r,expirerHasDeleted:i=!1,emitEvent:n=!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,fm("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),i||this.client.core.expirer.del(r),this.client.core.storage.removeItem(fU).catch(e=>this.client.logger.warn(e)),this.getPendingSessionRequests().forEach(e=>{e.topic===r&&this.deletePendingSessionRequest(e.id,fm("USER_DISCONNECTED"))}),r===(null==(t=this.sessionRequestQueue.queue[0])?void 0:t.topic)&&(this.sessionRequestQueue.state=fF.idle),n&&this.client.events.emit("session_delete",{id:s,topic:r})}),f1(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(cc.proposal_expired)}catch{}await Promise.all([this.client.proposal.delete(e,fm("USER_DISCONNECTED")),t?Promise.resolve():this.client.core.expirer.del(e)]),this.addToRecentlyDeleted(e,"proposal")}),f1(this,"deletePendingSessionRequest",async(e,t,r=!1)=>
908{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=fF.idle,this.client.events.emit("session_request_expire",{id:e}))}),f1(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)])}),f1(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}))}),f1(this,"setProposal",async(e,t)=>{this.client.core.expirer.set(e,hA(fj.wc_sessionPropose.req.ttl)),await this.client.proposal.set(e,t)}),f1(this,"setAuthRequest",async(e,t)=>{let{request:r,pairingTopic:i,transportType:n=a5.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:i,verifyContext:r.verifyContext,transportType:n})}),f1(this,"setPendingSessionRequest",async e=>{let{id:t,topic:r,params:i,verifyContext:n}=e,s=i.request.expiryTimestamp||hA(fj.wc_sessionRequest.req.ttl);this.client.core.expirer.set(t,s),await this.client.pendingRequest.set(t,{id:t,topic:r,params:i,verifyContext:n})}),f1(this,"sendRequest",async e=>{let t,i;let{topic:n,method:s,params:o,expiry:a,relayRpcId:c,clientRpcId:l,throwOnFailedPublish:u,appLink:h,tvf:d}=e,p=aS(s,o,l),f=!!h;try{let e=f?fa:fo;t=await this.client.core.crypto.encode(n,p,{encoding:e})}catch(e){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${n} failed`),e}if(fz.includes(s)){let e=fl(JSON.stringify(p)),r=fl(t);i=await this.client.core.verify.register({id:r,decryptedId:e})}let g=fj[s].req;if(g.attestation=i,a&&(g.ttl=a),c&&(g.id=c),this.client.core.history.set(n,p),f){let e=fu(h,n,t);await r.g.Linking.openURL(e,this.client.name)}else{let e=fj[s].req;a&&(e.ttl=a),c&&(e.id=c),e.tvf=f0(fQ({},d),{correlationId:p.id}),u?(e.internal=f0(fQ({},e.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(n,t,e)):this.client.core.relayer.publish(n,t,e).catch(e=>this.client.logger.error(e))}return p.id}),f1(this,"sendResult",async e=>{let t,i,n;let{id:s,topic:o,result:a,throwOnFailedPublish:c,encodeOpts:l,appLink:u}=e,h=aN(s,a),d=u&&"u">typeof(null==r.g?void 0:r.g.Linking);try{let e=d?fa:fo;t=await this.client.core.crypto.encode(o,h,f0(fQ({},l||{}),{encoding:e}))}catch(e){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${o} failed`),e}try{let e=(i=await this.client.core.history.get(o,s)).request;try{this.shouldSetTVF(e.method,e.params)&&(n=this.getTVFParams(s,e.params,a))}catch(e){this.client.logger.warn("sendResult() -> getTVFParams() failed",e)}}catch(e){throw this.client.logger.error(`sendResult() -> history.get(${o}, ${s}) failed`),e}if(d){let e=fu(u,o,t);await r.g.Linking.openURL(e,this.client.name)}else{let e=fj[i.request.method].res;e.tvf=f0(fQ({},n),{correlationId:s}),c?(e.internal=f0(fQ({},e.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(o,t,e)):this.client.core.relayer.publish(o,t,e).catch(e=>this.client.logger.error(e))}await this.client.core.history.resolve(h)}),f1(this,"sendError",async e=>{let t,i;let{id:n,topic:s,error:o,encodeOpts:a,rpcOpts:c,appLink:l}=e,u=aO(n,o),h=l&&"u">typeof(null==r.g?void 0:r.g.Linking);try{let e=h?fa:fo;t=await this.client.core.crypto.encode(s,u,f0(fQ({},a||{}),{encoding:e}))}catch(e){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${s} failed`),e}try{i=await this.client.core.history.get(s,n)}catch(e){throw this.client.logger.error(`sendError() -> history.get(${s}, ${n}) failed`),e}if(h){let e=fu(l,s,t);await r.g.Linking.openURL(e,this.client.name)}else{let e=i.request.method,r=c||fj[e].res;this.client.core.relayer.publish(s,t,r)}await this.client.core.history.resolve(u)}),f1(this,"cleanup",async()=>{let e=[],t=[];
908this.client.session.getAll().forEach(t=>{let r=!1;hI(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=>{hI(e.expiryTimestamp)&&t.push(e.id)}),await Promise.all([...e.map(e=>this.deleteSession({topic:e})),...t.map(e=>this.deleteProposal(e))])}),f1(this,"onProviderMessageEvent",async e=>{!this.initialized||this.relayMessageCache.length>0?this.relayMessageCache.push(e):await this.onRelayMessage(e)}),f1(this,"onRelayEventRequest",async e=>{this.requestQueue.queue.push(e),await this.processRequestsQueue()}),f1(this,"processRequestsQueue",async()=>{if(this.requestQueue.state===fF.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=fF.active;let e=this.requestQueue.queue.shift();if(e)try{await this.processRequest(e)}catch(e){this.client.logger.warn(e)}}this.requestQueue.state=fF.idle}),f1(this,"processRequest",async e=>{let{topic:t,payload:r,attestation:i,transportType:n,encryptedId:s}=e,o=r.method;if(!this.shouldIgnorePairingRequest({topic:t,requestMethod:o}))switch(o){case"wc_sessionPropose":return await this.onSessionProposeRequest
908({topic:t,payload:r,attestation:i,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:i,encryptedId:s,transportType:n});case"wc_sessionEvent":return await this.onSessionEventRequest(t,r);case"wc_sessionAuthenticate":return await this.onSessionAuthenticateRequest({topic:t,payload:r,attestation:i,encryptedId:s,transportType:n});default:return this.client.logger.info(`Unsupported request method ${o}`)}}),f1(this,"onRelayEventResponse",async e=>{let{topic:t,payload:r,transportType:i}=e,n=(await this.client.core.history.get(t,r.id)).request.method;switch(n){case"wc_sessionPropose":return this.onSessionProposeResponse(t,r,i);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 ${n}`)}}),f1(this,"onRelayEventUnknownPayload",e=>{let{topic:t}=e,{message:r}=fg("MISSING_OR_INVALID",`Decoded payload on topic ${t} is not identifiable as a JSON-RPC request or a response.`);throw Error(r)}),f1(this,"shouldIgnorePairingRequest",e=>{let{topic:t,requestMethod:r}=e,i=this.expectedPairingMethodMap.get(t);return!(!i||i.includes(r))&&!!(i.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)}),f1(this,"onSessionProposeRequest",async e=>{let{topic:t,payload:r,attestation:i,encryptedId:n}=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(co.proposal_listener_not_found)),this.isValidConnect(fQ({},r.params));let a=s.expiryTimestamp||hA(fj.wc_sessionPropose.req.ttl),c=fQ({id:o,pairingTopic:t,expiryTimestamp:a},s);await this.setProposal(o,c);let l=await this.getVerifyContext({attestationId:i,hash:fl(JSON.stringify(r)),encryptedId:n,metadata:c.proposer.metadata});e?.addTrace(cs.emit_session_proposal),this.client.events.emit("session_proposal",{id:o,params:c,verifyContext:l})}catch(e){await this.sendError({id:o,topic:t,error:e,rpcOpts:fj.wc_sessionPropose.autoReject}),this.client.logger.error(e)}}),f1(this,"onSessionProposeResponse",async(e,t,r)=>{let{id:i}=t;if(aB(t)){let{result:n}=t;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:n});let s=this.client.proposal.get(i);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=n.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:a});let c=await this.client.core.crypto.generateSharedKey(o,a);this.pendingSessions.set(i,{sessionTopic:c,pairingTopic:e,proposalId:i,publicKey:o});let l=await this.client.core.relayer.subscribe(c,{transportType:r});this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:l}),await this.client.core.pairing.activate({topic:e})}else if(aj(t)){await this.client.proposal.delete(i,fm("USER_DISCONNECTED"));let e=hS("session_connect",i);if(0===this.events.listenerCount(e))throw Error(`emitting ${e} without any listeners, 954`);this.events.emit(e,{error:t.error})}}),f1(this,"onSessionSettleRequest",async(e,t)=>{let{id:r,params:i}=t;try{this.isValidSessionSettleRequest(i);let{relay:r,controller:n,expiry:s,namespaces:o,sessionProperties:a,scopedProperties:c,sessionConfig:l}=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 h=this.client.proposal.get(u.proposalId),d=f0(fQ(fQ(fQ({topic:e,relay:r,expiry:s,namespaces:o,acknowledged:!0,pairingTopic:u.pairingTopic,requiredNamespaces:h.requiredNamespaces,optionalNamespaces:h.optionalNamespaces,controller:n.publicKey,self:{publicKey:u.publicKey,metadata:this.client.metadata},peer:{publicKey:n.publicKey,metadata:n.metadata}},a&&{sessionProperties:a}),c&&{scopedProperties:c}),l&&{sessionConfig:l}),{transportType:a5.relay});await this.client.session.set(d.topic,d),await this.setExpiry(d.topic,d.expiry),await this.client.core.pairing.updateMetadata({topic:u.pairingTopic,metadata:d.peer.metadata}),this.client.events.emit("session_connect",{session:d}),this.events.emit(hS("session_connect",u.proposalId),{session:d}),this.pendingSessions.delete(u.proposalId),this.deleteProposal(u.proposalId,!1),this.cleanupDupl
908icatePairings(d),await this.sendResult({id:t.id,topic:e,result:!0,throwOnFailedPublish:!0})}catch(t){await this.sendError({id:r,topic:e,error:t}),this.client.logger.error(t)}}),f1(this,"onSessionSettleResponse",async(e,t)=>{let{id:r}=t;aB(t)?(await this.client.session.update(e,{acknowledged:!0}),this.events.emit(hS("session_approve",r),{})):aj(t)&&(await this.client.session.delete(e,fm("USER_DISCONNECTED")),this.events.emit(hS("session_approve",r),{error:t.error}))}),f1(this,"onSessionUpdateRequest",async(e,t)=>{let{params:r,id:i}=t;try{let t=`${e}_session_update`,n=fP.get(t);if(n&&this.isRequestOutOfSync(n,i)){this.client.logger.warn(`Discarding out of sync request - ${i}`),this.sendError({id:i,topic:e,error:fm("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(fQ({topic:e},r));try{fP.set(t,i),await this.client.session.update(e,{namespaces:r.namespaces}),await this.sendResult({id:i,topic:e,result:!0,throwOnFailedPublish:!0})}catch(e){throw fP.delete(t),e}this.client.events.emit("session_update",{id:i,topic:e,params:r})}catch(t){await this.sendError({id:i,topic:e,error:t}),this.client.logger.error(t)}}),f1(this,"isRequestOutOfSync",(e,t)=>t.toString().slice(0,-3)<e.toString().slice(0,-3)),f1(this,"onSessionUpdateResponse",(e,t)=>{let{id:r}=t,i=hS("session_update",r);if(0===this.events.listenerCount(i))throw Error(`emitting ${i} without any listeners`);aB(t)?this.events.emit(hS("session_update",r),{}):aj(t)&&this.events.emit(hS("session_update",r),{error:t.error})}),f1(this,"onSessionExtendRequest",async(e,t)=>{let{id:r}=t;try{this.isValidExtend({topic:e}),await this.setExpiry(e,hA(fB)),await this.sendResult({id:r,topic:e,result:!0,throwOnFailedPublish:!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)}}),f1(this,"onSessionExtendResponse",(e,t)=>{let{id:r}=t,i=hS("session_extend",r);if(0===this.events.listenerCount(i))throw Error(`emitting ${i} without any listeners`);aB(t)?this.events.emit(hS("session_extend",r),{}):aj(t)&&this.events.emit(hS("session_extend",r),{error:t.error})}),f1(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)}}),f1(this,"onSessionPingResponse",(e,t)=>{let{id:r}=t,i=hS("session_ping",r);setTimeout(()=>{if(0===this.events.listenerCount(i))throw Error(`emitting ${i} without any listeners 2176`);aB(t)?this.events.emit(hS("session_ping",r),{}):aj(t)&&this.events.emit(hS("session_ping",r),{error:t.error})},500)}),f1(this,"onSessionDeleteRequest",async(e,t)=>{let{id:r}=t;try{this.isValidDisconnect({topic:e,reason:t.params}),Promise.all([new Promise(t=>{this.client.core.relayer.once(a1.publish,async()=>{t(await this.deleteSession({topic:e,id:r}))})}),this.sendResult({id:r,topic:e,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:e,error:fm("USER_DISCONNECTED")})]).catch(e=>this.client.logger.error(e))}catch(e){this.client.logger.error(e)}}),f1(this,"onSessionRequest",async e=>{var t,r,i;let{topic:n,payload:s,attestation:o,encryptedId:a,transportType:c}=e,{id:l,params:u}=s;try{await this.isValidRequest(fQ({topic:n},u));let e=this.client.session.get(n),s=await this.getVerifyContext({attestationId:o,hash:fl(JSON.stringify(aS("wc_sessionRequest",u,l))),encryptedId:a,metadata:e.peer.metadata,transportType:c}),h={id:l,topic:n,params:u,verifyContext:s};await this.setPendingSessionRequest(h),c===a5.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!=(i=this.client.signConfig)&&i.disableRequestQueue?this.emitSessionRequest(h):(this.addSessionRequestToSessionRequestQueue(h),this.processSessionRequestQueue())}catch(e){await this.sendError({id:l,topic:n,error:e}),this.client.logger.error(e)}}),f1(this,"onSessionRequestResponse",(e,t)=>{let{id:r}=t,i=hS("session_request",r);if(0===this.events.listenerCount(i))throw Error(`emitting ${i} without any listeners`);aB(t)?this.events.emit(hS("session_request",r),{result:t.result}):aj(t)&&this.events.emit(hS("session_request",r),{error:t.error})}),f1(this,"onSessionEventRequest",async(e,t)=>{let{id:r,params:i}=t;try{let t=`${e}_session_event_${i.event.name}`,n=fP.get(t);if(n&&this.isRequestOutOfSync(n,r)){this.client.logger.info(`Discarding out of sync request - ${r}`);return}this.isValidEmit(fQ({topic:e},i)),this.client.events.emit("session_event",{id:r,topic:e,params:i}),fP.set(t,r)}
908catch(t){await this.sendError({id:r,topic:e,error:t}),this.client.logger.error(t)}}),f1(this,"onSessionAuthenticateResponse",(e,t)=>{let{id:r}=t;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:e,payload:t}),aB(t)?this.events.emit(hS("session_request",r),{result:t.result}):aj(t)&&this.events.emit(hS("session_request",r),{error:t.error})}),f1(this,"onSessionAuthenticateRequest",async e=>{var t;let{topic:r,payload:i,attestation:n,encryptedId:s,transportType:o}=e;try{let{requester:e,authPayload:a,expiryTimestamp:c}=i.params,l=await this.getVerifyContext({attestationId:n,hash:fl(JSON.stringify(i)),encryptedId:s,metadata:e.metadata,transportType:o}),u={requester:e,pairingTopic:r,id:i.id,authPayload:a,verifyContext:l,expiryTimestamp:c};await this.setAuthRequest(i.id,{request:u,pairingTopic:r,transportType:o}),o===a5.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:i.params,id:i.id,verifyContext:l})}catch(s){this.client.logger.error(s);let e=i.params.requester.publicKey,t=await this.client.core.crypto.generateKeyPair(),n=this.getAppLinkIfEnabled(i.params.requester.metadata,o);await this.sendError({id:i.id,topic:r,error:s,encodeOpts:{type:1,receiverPublicKey:e,senderPublicKey:t},rpcOpts:fj.wc_sessionAuthenticate.autoReject,appLink:n})}}),f1(this,"addSessionRequestToSessionRequestQueue",e=>{this.sessionRequestQueue.queue.push(e)}),f1(this,"cleanupAfterResponse",e=>{this.deletePendingSessionRequest(e.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=fF.idle,this.processSessionRequestQueue()},(0,O.toMiliseconds)(this.requestQueueDelay))}),f1(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=hS("session_request",e.request.id);if(0===this.events.listenerCount(r))throw Error(`emitting ${r} without any listeners`);this.events.emit(hS("session_request",e.request.id),{error:t})})}),f1(this,"processSessionRequestQueue",()=>{if(this.sessionRequestQueue.state===fF.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.sessionRequestQueue.state=fF.active,this.emitSessionRequest(e)}catch(e){this.client.logger.error(e)}}),f1(this,"emitSessionRequest",e=>{this.client.events.emit("session_request",e)}),f1(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);
908t&&this.onSessionProposeRequest({topic:e.topic,payload:aS("wc_sessionPropose",f0(fQ({},t),{requiredNamespaces:t.requiredNamespaces,optionalNamespaces:t.optionalNamespaces,relays:t.relays,proposer:t.proposer,sessionProperties:t.sessionProperties,scopedProperties:t.scopedProperties}),t.id)})}),f1(this,"isValidConnect",async e=>{let t;if(!fN(e)){let{message:t}=fg("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(e)}`);throw Error(t)}let{pairingTopic:r,requiredNamespaces:i,optionalNamespaces:n,sessionProperties:s,scopedProperties:o,relays:a}=e;if(fb(r)||await this.isValidPairingTopic(r),t=!1,a?a&&fy(a)&&a.length&&a.forEach(e=>{t=fS(e)}):t=!0,!t){let{message:e}=fg("MISSING_OR_INVALID",`connect() relays: ${a}`);throw Error(e)}if(fb(i)||0===fw(i)||this.validateNamespaces(i,"requiredNamespaces"),fb(n)||0===fw(n)||this.validateNamespaces(n,"optionalNamespaces"),fb(s)||this.validateSessionProps(s,"sessionProperties"),!fb(o)){this.validateSessionProps(o,"scopedProperties");let e=Object.keys(i||{}).concat(Object.keys(n||{}));if(!Object.keys(o).every(t=>e.includes(t)))throw Error(`Scoped properties must be a subset of required/optional namespaces, received: ${JSON.stringify(o)}, required/optional namespaces: ${JSON.stringify(e)}`)}}),f1(this,"validateNamespaces",(e,t)=>{let r=function(e,t,r){let i=null;if(e&&fw(e)){let n;let s=fA(e,t);s&&(i=s);let o=(n=null,Object.entries(e).forEach(([e,i])=>{var s,o;let a;if(n)return;let c=(s=hc(e,i),o=`${t} ${r}`,a=null,fy(s)&&s.length?s.forEach(e=>{a||f_(e)||(a=fm("UNSUPPORTED_CHAINS",`${o}, chain ${e} should be a string and conform to "namespace:chainId" format`))}):f_(e)||(a=fm("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);c&&(n=c)}),n);o&&(i=o)}else i=fg("MISSING_OR_INVALID",`${t}, ${r} should be an object with data`);return i}(e,"connect()",t);if(r)throw Error(r.message)}),f1(this,"isValidApprove",async e=>{if(!fN(e))throw Error(fg("MISSING_OR_INVALID",`approve() params: ${e}`).message);let{id:t,namespaces:r,relayProtocol:i,sessionProperties:n,scopedProperties:s}=e;this.checkRecentlyDeleted(t),await this.isValidProposalId(t);let o=this.client.proposal.get(t),a=fI(r,"approve()");if(a)throw Error(a.message);let c=fx(o.requiredNamespaces,r,"approve()");if(c)throw Error(c.message);if(!fv(i,!0)){let{message:e}=fg("MISSING_OR_INVALID",`approve() relayProtocol: ${i}`);throw Error(e)}if(fb(n)||this.validateSessionProps(n,"sessionProperties"),!fb(s)){this.validateSessionProps(s,"scopedProperties");let e=new Set(Object.keys(r));if(!Object.keys(s).every(t=>e.has(t)))throw Error(`Scoped properties must be a subset of approved namespaces, received: ${JSON.stringify(s)}, approved namespaces: ${Array.from(e).join(", ")}`)}}),f1(this,"isValidReject",async e=>{if(!fN(e)){let{message:t}=fg("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||!fE(r.code,!1)||!r.message||!fv(r.message,!1)){let{message:e}=fg("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(r)}`);throw Error(e)}}),f1(this,"isValidSessionSettleRequest",e=>{let t;if(!fN(e)){let{message:t}=fg("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${e}`);throw Error(t)}let{relay:r,controller:i,namespaces:n,expiry:s}=e;if(!fS(r)){let{message:e}=fg("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw Error(e)}let o=(t=null,fv(i?.publicKey,!1)||(t=fg("MISSING_OR_INVALID","onSessionSettleRequest() controller public key should be a string")),t);if(o)throw Error(o.message);let a=fI(n,"onSessionSettleRequest()");if(a)throw Error(a.message);if(hI(s)){let{message:e}=fg("EXPIRED","onSessionSettleRequest()");throw Error(e)}}),f1(this,"isValidUpdate",async e=>{if(!fN(e)){let{message:t}=fg("MISSING_OR_INVALID",`update() params: ${e}`);throw Error(t)}let{topic:t,namespaces:r}=e;this.checkRecentlyDeleted(t),await this.isValidSessionTopic(t);
908let i=this.client.session.get(t),n=fI(r,"update()");if(n)throw Error(n.message);let s=fx(i.requiredNamespaces,r,"update()");if(s)throw Error(s.message)}),f1(this,"isValidExtend",async e=>{if(!fN(e)){let{message:t}=fg("MISSING_OR_INVALID",`extend() params: ${e}`);throw Error(t)}let{topic:t}=e;this.checkRecentlyDeleted(t),await this.isValidSessionTopic(t)}),f1(this,"isValidRequest",async e=>{var t;if(!fN(e)){let{message:t}=fg("MISSING_OR_INVALID",`request() params: ${e}`);throw Error(t)}let{topic:r,request:i,chainId:n,expiry:s}=e;this.checkRecentlyDeleted(r),await this.isValidSessionTopic(r);let{namespaces:o}=this.client.session.get(r);if(!fO(o,n)){let{message:e}=fg("MISSING_OR_INVALID",`request() chainId: ${n}`);throw Error(e)}if(fb(i)||!fv(i.method,!1)){let{message:e}=fg("MISSING_OR_INVALID",`request() ${JSON.stringify(i)}`);throw Error(e)}if(!(fv(t=i.method,!1)&&(function(e,t){let r=[];return Object.values(e).forEach(e=>{fh(e.accounts).includes(t)&&r.push(...e.methods)}),r})(o,n).includes(t))){let{message:e}=fg("MISSING_OR_INVALID",`request() method: ${i.method}`);throw Error(e)}if(s&&(!fE(s,!1)||!(s<=f$.max)||!(s>=f$.min))){let{message:e}=fg("MISSING_OR_INVALID",`request() expiry: ${s}. Expiry must be a number (in seconds) between ${f$.min} and ${f$.max}`);throw Error(e)}}),f1(this,"isValidRespond",async e=>{var t;if(!fN(e)){let{message:t}=fg("MISSING_OR_INVALID",`respond() params: ${e}`);throw Error(t)}let{topic:r,response:i}=e;try{await this.isValidSessionTopic(r)}catch(r){throw null!=(t=e?.response)&&t.id&&this.cleanupAfterResponse(e),r}if(fb(i)||fb(i.result)&&fb(i.error)||!fE(i.id,!1)||!fv(i.jsonrpc,!1)){let{message:e}=fg("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(i)}`);throw Error(e)}}),f1(this,"isValidPing",async e=>{if(!fN(e)){let{message:t}=fg("MISSING_OR_INVALID",`ping() params: ${e}`);throw Error(t)}let{topic:t}=e;await this.isValidSessionOrPairingTopic(t)}),f1(this,"isValidEmit",async e=>{var t;if(!fN(e)){let{message:t}=fg("MISSING_OR_INVALID",`emit() params: ${e}`);throw Error(t)}let{topic:r,event:i,chainId:n}=e;await this.isValidSessionTopic(r);let{namespaces:s}=this.client.session.get(r);if(!fO(s,n)){let{message:e}=fg("MISSING_OR_INVALID",`emit() chainId: ${n}`);throw Error(e)}if(fb(i)||!fv(i.name,!1)){let{message:e}=fg("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw Error(e)}if(!(fv(t=i.name,!1)&&(function(e,t){let r=[];return Object.values(e).forEach(e=>{fh(e.accounts).includes(t)&&r.push(...e.events)}),r})(s,n).includes(t))){let{message:e}=fg("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(i)}`);throw Error(e)}}),f1(this,"isValidDisconnect",async e=>{if(!fN(e)){let{message:t}=fg("MISSING_OR_INVALID",`disconnect() params: ${e}`);throw Error(t)}let{topic:t}=e;await this.isValidSessionOrPairingTopic(t)}),f1(this,"isValidAuthenticate",e=>{let{chains:t,uri:r,domain:i,nonce:n}=e;if(!Array.isArray(t)||0===t.length)throw Error("chains is required and must be a non-empty array");if(!fv(r,!1))throw Error("uri is required parameter");if(!fv(i,!1))throw Error("domain is required parameter");if(!fv(n,!1))throw Error("nonce is required parameter");if([...new Set(t.map(e=>ha(e).namespace))].length>1)throw Error("Multi-namespace requests are not supported. Please request single namespace only.");let{namespace:s}=ha(t[0]);if("eip155"!==s)throw Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")}),f1(this,"getVerifyContext",async e=>{let{attestationId:t,hash:r,encryptedId:i,metadata:n,transportType:s}=e,o={verified:{verifyUrl:n.verifyUrl||cr,validation:"UNKNOWN",origin:n.url||""}};try{if(s===a5.link_mode){let e=this.getAppLinkIfEnabled(n,s);return o.verified.validation=e&&new URL(e).origin===new URL(n.url).origin?"VALID":"INVALID",o}let e=await this.client.core.verify.resolve({attestationId:t,hash:r,encryptedId:i,verifyUrl:n.verifyUrl});e&&(o.verified.origin=e.origin,o.verified.isScam=e.isScam,o.verified.validation=e.origin===new URL(n.url).origin?"VALID":"INVALID")}catch(e){this.client.logger.warn(e)}return this.client.logger.debug(`Verify context: ${JSON.stringify(o)}`),o}),f1(this,"validateSessionProps",(e,t)=>{Object.values(e).forEach((r,i)=>{if(null==r){let{message:n}=fg("MISSING_OR_INVALID",`${t} must contain an existing value for each key. Received: ${r} for key ${Object.keys(e)[i]}`);throw Error(n)}})}),f1(this,"getPendingAuthRequest",e=>{let t=this.client.auth.requests.get(e);return"object"==typeof t?t:void 0}),f1(this,"addToRecentlyDeleted",(e,t)=>{if(this.recentlyDeletedMap.set(e,t),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let e=0,t=this.recentlyDeletedLimit/2;
908for(let r of this.recentlyDeletedMap.keys()){if(e++>=t)break;this.recentlyDeletedMap.delete(r)}}}),f1(this,"checkRecentlyDeleted",e=>{let t=this.recentlyDeletedMap.get(e);if(t){let{message:r}=fg("MISSING_OR_INVALID",`Record was recently deleted - ${t}: ${e}`);throw Error(r)}}),f1(this,"isLinkModeEnabled",(e,t)=>{var i,n,s,o,a,c,l,u,h;return!!e&&t===a5.link_mode&&(null==(n=null==(i=this.client.metadata)?void 0:i.redirect)?void 0:n.linkMode)===!0&&(null==(o=null==(s=this.client.metadata)?void 0:s.redirect)?void 0:o.universal)!==void 0&&(null==(c=null==(a=this.client.metadata)?void 0:a.redirect)?void 0:c.universal)!==""&&(null==(l=e?.redirect)?void 0:l.universal)!==void 0&&(null==(u=e?.redirect)?void 0:u.universal)!==""&&(null==(h=e?.redirect)?void 0:h.linkMode)===!0&&this.client.core.linkModeSupportedApps.includes(e.redirect.universal)&&"u">typeof(null==r.g?void 0:r.g.Linking)}),f1(this,"getAppLinkIfEnabled",(e,t)=>{var r;return this.isLinkModeEnabled(e,t)?null==(r=e?.redirect)?void 0:r.universal:void 0}),f1(this,"handleLinkModeMessage",({url:e})=>{if(!e||!e.includes("wc_ev")||!e.includes("topic"))return;let t=hx(e,"topic")||"",r=decodeURIComponent(hx(e,"wc_ev")||""),i=this.client.session.keys.includes(t);i&&this.client.session.update(t,{transportType:a5.link_mode}),this.client.core.dispatchEnvelope({topic:t,message:r,sessionExists:i})}),f1(this,"registerLinkModeListeners",async()=>{var e;if("u">typeof hs&&"true"===hs.env.IS_VITEST||hv()&&null!=(e=this.client.metadata.redirect)&&e.linkMode){let e=null==r.g?void 0:r.g.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)}}}),f1(this,"shouldSetTVF",(e,t)=>{if(!t||"wc_sessionRequest"!==e)return!1;let{request:r}=t;return Object.keys(fq).includes(r.method)}),f1(this,"getTVFParams",(e,t,r)=>{var i,n;try{let s=t.request.method,o=this.extractTxHashesFromResult(s,r);return f0(fQ({correlationId:e,rpcMethods:[s],chainId:t.chainId},this.isValidContractData(t.request.params)&&{contractAddresses:[null==(n=null==(i=t.request.params)?void 0:i[0])?void 0:n.to]}),{txHashes:o})}catch(e){this.client.logger.warn("Error getting TVF params",e)}return{}}),f1(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 i=r.slice(2);return!!/^[0-9a-fA-F]*$/.test(i)&&i.length%2==0}catch{}return!1}),f1(this,"extractTxHashesFromResult",(e,t)=>{try{let r=fq[e];if("string"==typeof t)return[t];let i=t[r.key];if(fy(i))return"solana_signAllTransactions"===e?i.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 i=r[0];if(0===i)throw Error("No signatures found");if(r.length<1+64*i)throw Error("Transaction data too short for claimed signature count");if(r.length<100)throw Error("Transaction too short");let n=ho.from(e,"base64").slice(1,65);return rY.Z.encode(n)})(e)):i;if("string"==typeof i)return[i]}catch(e){this.client.logger.warn("Error extracting tx hashes from result",e)}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("processPendingMessageEvents failed",e)}}isInitialized(){if(!this.initialized){let{message:e}=fg("NOT_INITIALIZED",this.name);throw Error(e)}}async confirmOnlineStateOrThrow(){await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(a1.message,e=>{this.onProviderMessageEvent(e)})}async onRelayMessage(e){let{topic:t,message:r,attestation:i,transportType:n}=e,{publicKey:s}=this.client.auth.authKeys.keys.includes(fW)?this.client.auth.authKeys.get(fW):{responseTopic:void 0,publicKey:void 0};try{let e=await this.client.core.crypto.decode(t,r,{receiverPublicKey:s,encoding:n===a5.link_mode?fa:fo});aU(e)?(this.client.core.history.set(t,e),await this.onRelayEventRequest({topic:t,payload:e,attestation:i,transportType:n,encryptedId:fl(r)})):aL(e)?(await this.client.core.history.resolve(e),await this.onRelayEventResponse({topic:t,payload:e,transportType:n}),this.client.core.history.delete(t,e.id)):await this.onRelayEventUnknownPayload({topic:t,payload:e,transportType:n}),await this.client.core.relayer.messages.ack(t,r)}catch(e){this.client.logger.error(e)}}registerExpirerEvents(){this.client.core.expirer.on(ct.expired,async e=>
908{let{topic:t,id:r}=function(e){let[t,r]=e.split(":"),i={id:void 0,topic:void 0};if("topic"===t&&"string"==typeof r)i.topic=r;else if("id"===t&&Number.isInteger(Number(r)))i.id=Number(r);else throw Error(`Invalid target, expected id:number or topic:string, got ${t}:${r}`);return i}(e.target);return r&&this.client.pendingRequest.keys.includes(r)?await this.deletePendingSessionRequest(r,fg("EXPIRED"),!0):r&&this.client.auth.requests.keys.includes(r)?await this.deletePendingAuthRequest(r,fg("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(a7.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(a7.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!fv(e,!1)){let{message:t}=fg("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}=fg("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw Error(t)}if(hI(this.client.core.pairing.pairings.get(e).expiry)){let{message:t}=fg("EXPIRED",`pairing topic: ${e}`);throw Error(t)}}async isValidSessionTopic(e){if(!fv(e,!1)){let{message:t}=fg("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}=fg("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw Error(t)}if(hI(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});let{message:t}=fg("EXPIRED",`session topic: ${e}`);throw Error(t)}if(!this.client.core.crypto.keychain.has(e)){let{message:t}=fg("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(fv(e,!1)){let{message:t}=fg("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw Error(t)}else{let{message:t}=fg("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}=fg("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw Error(t)}if(!this.client.proposal.keys.includes(e)){let{message:t}=fg("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw Error(t)}if(hI(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);let{message:t}=fg("EXPIRED",`proposal id: ${e}`);throw Error(t)}}}class f3 extends l7{constructor(e,t){super(e,t,"proposal",fD),this.core=e,this.logger=t}}class f5 extends l7{constructor(e,t){super(e,t,"session",fD),this.core=e,this.logger=t}}class f8 extends l7{constructor(e,t){super(e,t,"request",fD,e=>e.id),this.core=e,this.logger=t}}class f6 extends l7{constructor(e,t){super(e,t,"authKeys",fH,()=>fW),this.core=e,this.logger=t}}class f4 extends l7{constructor(e,t){super(e,t,"pairingTopics",fH),this.core=e,this.logger=t}}class f9 extends l7{constructor(e,t){super(e,t,"requests",fH,e=>e.id),this.core=e,this.logger=t}}var f7=Object.defineProperty,ge=(e,t,r)=>t in e?f7(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,gt=(e,t,r)=>ge(e,"symbol"!=typeof t?t+"":t,r);class gr{constructor(e,t){this.core=e,this.logger=t,gt(this,"authKeys"),gt(this,"pairingTopics"),gt(this,"requests"),this.authKeys=new f6(this.core,this.logger),this.pairingTopics=new f4(this.core,this.logger),this.requests=new f9(this.core,this.logger)}
908async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}var gi=Object.defineProperty,gn=(e,t,r)=>t in e?gi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,gs=(e,t,r)=>gn(e,"symbol"!=typeof t?t+"":t,r);class go extends uj{constructor(e){super(e),gs(this,"protocol","wc"),gs(this,"version",2),gs(this,"name",fM.name),gs(this,"metadata"),gs(this,"core"),gs(this,"logger"),gs(this,"events",new S.EventEmitter),gs(this,"engine"),gs(this,"session"),gs(this,"proposal"),gs(this,"pendingRequest"),gs(this,"auth"),gs(this,"signConfig"),gs(this,"on",(e,t)=>this.events.on(e,t)),gs(this,"once",(e,t)=>this.events.once(e,t)),gs(this,"off",(e,t)=>this.events.off(e,t)),gs(this,"removeListener",(e,t)=>this.events.removeListener(e,t)),gs(this,"removeAllListeners",e=>this.events.removeAllListeners(e)),gs(this,"connect",async e=>{try{return await this.engine.connect(e)}catch(e){throw this.logger.error(e.message),e}}),gs(this,"pair",async e=>{try{return await this.engine.pair(e)}catch(e){throw this.logger.error(e.message),e}}),gs(this,"approve",async e=>{try{return await this.engine.approve(e)}catch(e){throw this.logger.error(e.message),e}}),gs(this,"reject",async e=>{try{return await this.engine.reject(e)}catch(e){throw this.logger.error(e.message),e}}),gs(this,"update",async e=>{try{return await this.engine.update(e)}catch(e){throw this.logger.error(e.message),e}}),gs(this,"extend",async e=>{try{return await this.engine.extend(e)}catch(e){throw this.logger.error(e.message),e}}),gs(this,"request",async e=>{try{return await this.engine.request(e)}catch(e){throw this.logger.error(e.message),e}}),gs(this,"respond",async e=>{try{return await this.engine.respond(e)}catch(e){throw this.logger.error(e.message),e}}),gs(this,"ping",async e=>{try{return await this.engine.ping(e)}catch(e){throw this.logger.error(e.message),e}}),gs(this,"emit",async e=>{try{return await this.engine.emit(e)}catch(e){throw this.logger.error(e.message),e}}),gs(this,"disconnect",async e=>{try{return await this.engine.disconnect(e)}catch(e){throw this.logger.error(e.message),e}}),gs(this,"find",e=>{try{return this.engine.find(e)}catch(e){throw this.logger.error(e.message),e}}),gs(this,"getPendingSessionRequests",()=>{try{return this.engine.getPendingSessionRequests()}catch(e){throw this.logger.error(e.message),e}}),gs(this,"authenticate",async(e,t)=>{try{return await this.engine.authenticate(e,t)}catch(e){throw this.logger.error(e.message),e}}),gs(this,"formatAuthMessage",e=>{try{return this.engine.formatAuthMessage(e)}catch(e){throw this.logger.error(e.message),e}}),gs(this,"approveSessionAuthenticate",async e=>{try{return await this.engine.approveSessionAuthenticate(e)}catch(e){throw this.logger.error(e.message),e}}),gs(this,"rejectSessionAuthenticate",async e=>{try{return await this.engine.rejectSessionAuthenticate(e)}catch(e){throw this.logger.error(e.message),e}}),this.name=e?.name||fM.name,this.metadata=function(e){var t,r;let i=(0,rG.D)()||{name:"",description:"",url:"",icons:[""]};try{return null!=e&&e.url&&i.url&&e.url!==i.url&&(console.warn(`The configured WalletConnect 'metadata.url':${e.url} differs from the actual page url:${i.url}. This is probably unintended and can lead to issues.`),e.url=i.url),null!=(t=e?.icons)&&t.length&&e.icons.length>0&&(e.icons=e.icons.filter(e=>""!==e)),hy(hm(hm({},i),e),{url:e?.url||i.url,name:e?.name||i.name,description:e?.description||i.description,icons:null!=(r=e?.icons)&&r.length&&e.icons.length>0?e.icons:i.icons})}catch(t){return console.warn("Error populating app metadata",t),e||i}}(e?.metadata),this.signConfig=e?.signConfig;let t="u">typeof e?.logger&&"string"!=typeof e?.logger?e.logger:(0,ec.gw)((0,ec.jI)({level:e?.logger||fM.logger}));this.core=e?.core||new uM(e),this.logger=(0,ec.Ep)(t,this.name),this.session=new f5(this.core,this.logger),this.proposal=new f3(this.core,this.logger),this.pendingRequest=new f8(this.core,this.logger),this.engine=new f2(this),this.auth=new gr(this.core,this.logger)}static async init(e){let t=new go(e);return await t.initialize(),t}get context(){return(0,ec.Fd)(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"),setTimeout(()=>{this.engine.processRelayMessageCache()},(0,O.toMiliseconds)(O.ONE_SECOND))}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}function ga(e){let[t,r]=e.split(":");return{namespace:t,reference:r}}function gc(e=[],t=[]){return[...new Set([...e,...t])]}function gl(e){if(!Number.isSafeInteger(e)||e<0)throw Error("positive integer expected, got "+e)}function gu(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 gh(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 gd(e,t){gu(e);let r=t.outputLen;if(e.length<r)throw Error("digestInto() expects output buffer of length at least "+r)}r(25566),r(82957).Buffer,Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;let gp=BigInt(4294967296-1),gf=BigInt(32),gg=(e,t,r)=>e<<r|t>>>32-r,gm=(e,t,r)=>t<<r|e>>>32-r,gy=(e,t,r)=>t<<r-32|e>>>64-r,gw=(e,t,r)=>e<<r-32|t>>>64-r,gb="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;
908function gv(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function gE(e,t){return e<<32-t|e>>>t}let g_=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0];function gC(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}}function gA(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)),gu(e),e}class gI{clone(){return this._cloneInto()}}function gS(e){let t=t=>e().update(gA(t)).digest(),r=e();return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=()=>e(),t}function gN(e=32){if(gb&&"function"==typeof gb.getRandomValues)return gb.getRandomValues(new Uint8Array(e));if(gb&&"function"==typeof gb.randomBytes)return gb.randomBytes(e);throw Error("crypto.getRandomValues must be defined")}let gO=[],gx=[],gT=[],gR=BigInt(0),gP=BigInt(1),gk=BigInt(2),gD=BigInt(7),gM=BigInt(256),gU=BigInt(113);for(let e=0,t=gP,r=1,i=0;e<24;e++){[r,i]=[i,(2*r+3*i)%5],gO.push(2*(5*i+r)),gx.push((e+1)*(e+2)/2%64);let n=gR;for(let e=0;e<7;e++)(t=(t<<gP^(t>>gD)*gU)%gM)&gk&&(n^=gP<<(gP<<BigInt(e))-gP);gT.push(n)}let[gL,gB]=function(e,t=!1){let r=new Uint32Array(e.length),i=new Uint32Array(e.length);for(let n=0;n<e.length;n++){let{h:s,l:o}=function(e,t=!1){return t?{h:Number(e&gp),l:Number(e>>gf&gp)}:{h:0|Number(e>>gf&gp),l:0|Number(e&gp)}}(e[n],t);[r[n],i[n]]=[s,o]}return[r,i]}(gT,!0),gj=(e,t,r)=>r>32?gy(e,t,r):gg(e,t,r),g$=(e,t,r)=>r>32?gw(e,t,r):gm(e,t,r);class gF extends gI{constructor(e,t,r,i=!1,n=24){var s;if(super(),this.blockLen=e,this.suffix=t,this.outputLen=r,this.enableXOF=i,this.rounds=n,this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,gl(r),0>=this.blockLen||this.blockLen>=200)throw Error("Sha3 supports only keccak-f1600 function");this.state=new Uint8Array(200),this.state32=new Uint32Array((s=this.state).buffer,s.byteOffset,Math.floor(s.byteLength/4))}keccak(){g_||gC(this.state32),function(e,t=24){let r=new Uint32Array(10);for(let i=24-t;i<24;i++){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 i=(t+8)%10,n=(t+2)%10,s=r[n],o=r[n+1],a=gj(s,o,1)^r[i],c=g$(s,o,1)^r[i+1];for(let r=0;r<50;r+=10)e[t+r]^=a,e[t+r+1]^=c}let t=e[2],n=e[3];for(let r=0;r<24;r++){let i=gx[r],s=gj(t,n,i),o=g$(t,n,i),a=gO[r];t=e[a],n=e[a+1],e[a]=s,e[a+1]=o}for(let t=0;t<50;t+=10){for(let i=0;i<10;i++)r[i]=e[t+i];for(let i=0;i<10;i++)e[t+i]^=~r[(i+2)%10]&r[(i+4)%10]}e[0]^=gL[i],e[1]^=gB[i]}r.fill(0)}(this.state32,this.rounds),g_||gC(this.state32),this.posOut=0,this.pos=0}update(e){gh(this);let{blockLen:t,state:r}=this,i=(e=gA(e)).length;for(let n=0;n<i;){let s=Math.min(t-this.pos,i-n);for(let t=0;t<s;t++)r[this.pos++]^=e[n++];this.pos===t&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;let{state:e,suffix:t,pos:r,blockLen:i}=this;e[r]^=t,(128&t)!=0&&r===i-1&&this.keccak(),e[i-1]^=128,this.keccak()}writeInto(e){gh(this,!1),gu(e),this.finish();let t=this.state,{blockLen:r}=this;for(let i=0,n=e.length;i<n;){this.posOut>=r&&this.keccak();let s=Math.min(r-this.posOut,n-i);e.set(t.subarray(this.posOut,this.posOut+s),i),this.posOut+=s,i+=s}return e}xofInto(e){if(!this.enableXOF)throw Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return gl(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(gd(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,this.state.fill(0)}_cloneInto(e){let{blockLen:t,suffix:r,outputLen:i,rounds:n,enableXOF:s}=this;return e||(e=new gF(t,r,i,s,n)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=n,e.suffix=r,e.outputLen=i,e.enableXOF=s,e.destroyed=this.destroyed,e}}function gq(e){if(!Number.isSafeInteger(e)||e<0)throw Error("positive integer expected, got "+e)}function gz(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function gH(e,...t){if(!gz(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 gW(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 gV(e){if("boolean"!=typeof e)throw Error(`boolean expected, not ${e}`)}gS(()=>new gF(136,1,32)),Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;let gK=e=>
908new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4)),gZ=e=>new DataView(e.buffer,e.byteOffset,e.byteLength);if(68!==new Uint8Array(new Uint32Array([287454020]).buffer)[0])throw Error("Non little-endian hardware is not supported");function gG(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(gz(e))e=gX(e);else throw Error("Uint8Array expected, got "+typeof e);return e}function gY(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 gJ(e,t,r,i){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,i);let n=BigInt(32),s=BigInt(4294967295),o=Number(r>>n&s),a=Number(r&s),c=i?4:0,l=i?0:4;e.setUint32(t+c,o,i),e.setUint32(t+l,a,i)}function gX(e){return Uint8Array.from(e)}function gQ(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}let g0=e=>Uint8Array.from(e.split("").map(e=>e.charCodeAt(0))),g1=g0("expand 16-byte k"),g2=g0("expand 32-byte k"),g3=gK(g1),g5=gK(g2);function g8(e,t){return e<<t|e>>>32-t}function g6(e){return e.byteOffset%4==0}let g4=4294967296-1,g9=new Uint32Array,g7=(e,t)=>255&e[t++]|(255&e[t++])<<8;class me{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,gH(e=gG(e),32);let t=g7(e,0),r=g7(e,2),i=g7(e,4),n=g7(e,6),s=g7(e,8),o=g7(e,10),a=g7(e,12),c=g7(e,14);this.r[0]=8191&t,this.r[1]=(t>>>13|r<<3)&8191,this.r[2]=(r>>>10|i<<6)&7939,this.r[3]=(i>>>7|n<<9)&8191,this.r[4]=(n>>>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|c<<8)&8191,this.r[9]=c>>>5&127;for(let t=0;t<8;t++)this.pad[t]=g7(e,16+2*t)}process(e,t,r=!1){let{h:i,r:n}=this,s=n[0],o=n[1],a=n[2],c=n[3],l=n[4],u=n[5],h=n[6],d=n[7],p=n[8],f=n[9],g=g7(e,t+0),m=g7(e,t+2),y=g7(e,t+4),w=g7(e,t+6),b=g7(e,t+8),v=g7(e,t+10),E=g7(e,t+12),_=g7(e,t+14),C=i[0]+(8191&g),A=i[1]+((g>>>13|m<<3)&8191),I=i[2]+((m>>>10|y<<6)&8191),S=i[3]+((y>>>7|w<<9)&8191),N=i[4]+((w>>>4|b<<12)&8191),O=i[5]+(b>>>1&8191),x=i[6]+((b>>>14|v<<2)&8191),T=i[7]+((v>>>11|E<<5)&8191),R=i[8]+((E>>>8|_<<8)&8191),P=i[9]+(_>>>5|(r?0:2048)),k=0,D=0+C*s+5*f*A+5*p*I+5*d*S+5*h*N;k=D>>>13,D&=8191,D+=5*u*O+5*l*x+5*c*T+5*a*R+5*o*P,k+=D>>>13,D&=8191;let M=k+C*o+A*s+5*f*I+5*p*S+5*d*N;k=M>>>13,M&=8191,M+=5*h*O+5*u*x+5*l*T+5*c*R+5*a*P,k+=M>>>13,M&=8191;let U=k+C*a+A*o+I*s+5*f*S+5*p*N;k=U>>>13,U&=8191,U+=5*d*O+5*h*x+5*u*T+5*l*R+5*c*P,k+=U>>>13,U&=8191;let L=k+C*c+A*a+I*o+S*s+5*f*N;k=L>>>13,L&=8191,L+=5*p*O+5*d*x+5*h*T+5*u*R+5*l*P,k+=L>>>13,L&=8191;let B=k+C*l+A*c+I*a+S*o+N*s;k=B>>>13,B&=8191,B+=5*f*O+5*p*x+5*d*T+5*h*R+5*u*P,k+=B>>>13,B&=8191;let j=k+C*u+A*l+I*c+S*a+N*o;k=j>>>13,j&=8191,j+=O*s+5*f*x+5*p*T+5*d*R+5*h*P,k+=j>>>13,j&=8191;let $=k+C*h+A*u+I*l+S*c+N*a;k=$>>>13,$&=8191,$+=O*o+x*s+5*f*T+5*p*R+5*d*P,k+=$>>>13,$&=8191;let F=k+C*d+A*h+I*u+S*l+N*c;k=F>>>13,F&=8191,F+=O*a+x*o+T*s+5*f*R+5*p*P,k+=F>>>13,F&=8191;let q=k+C*p+A*d+I*h+S*u+N*l;k=q>>>13,q&=8191,q+=O*c+x*a+T*o+R*s+5*f*P,k+=q>>>13,q&=8191;let z=k+C*f+A*p+I*d+S*h+N*u;k=z>>>13,z&=8191,z+=O*l+x*c+T*a+R*o+P*s,k+=z>>>13,z&=8191,D=8191&(k=(k=(k<<2)+k|0)+D|0),k>>>=13,M+=k,i[0]=D,i[1]=M,i[2]=U,i[3]=L,i[4]=B,i[5]=j,i[6]=$,i[7]=F,i[8]=q,i[9]=z}finalize(){let{h:e,pad:t}=this,r=new Uint16Array(10),i=e[1]>>>13;e[1]&=8191;for(let t=2;t<10;t++)e[t]+=i,i=e[t]>>>13,e[t]&=8191;e[0]+=5*i,i=e[0]>>>13,e[0]&=8191,e[1]+=i,i=e[1]>>>13,e[1]&=8191,e[2]+=i,r[0]=e[0]+5,i=r[0]>>>13,r[0]&=8191;for(let t=1;t<10;t++)r[t]=e[t]+i,i=r[t]>>>13,r[t]&=8191;r[9]-=8192;let n=(1^i)-1;for(let e=0;e<10;e++)r[e]&=n;n=~n;for(let t=0;t<10;t++)e[t]=e[t]&n|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;gQ(r)}update(e){gW(this);let{buffer:t,blockLen:r}=this,i=(e=gG(e)).length;for(let n=0;n<i;){let s=Math.min(r-this.pos,i-n);if(s===r){for(;r<=i-n;n+=r)this.process(e,n);continue}t.set(e.subarray(n,n+s),this.pos),this.pos+=s,n+=s,this.pos===r&&(this.process(t,0,!1),this.pos=0)}return this}destroy(){gQ(this.h,this.r,this.buffer,this.pad)}digestInto(e){gW(this),function(e,t){gH(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:i}=this;if(i){for(t[i++]=1;i<16;i++)t[i]=0;this.process(t,0,!0)}this.finalize();let n=0;for(let t=0;t<8;t++)e[n++]=r[t]>>>0,e[n++]=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 mt=function(e){let t=(t,r)=>e(r).update(gG(t)).digest(),r=e(new Uint8Array(32));return t.outputLen=r.outputLen,t.blockLen=r.blockLen,t.create=t=>e(t),t}(e=>
908new me(e)),mr=function(e,t){let{allowShortKeys:r,extendNonceFn:i,counterLength:n,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);if("function"!=typeof e)throw Error("core must be a function");return gq(n),gq(o),gV(s),gV(r),(t,a,c,l,u=0)=>{gH(t),gH(a),gH(c);let h=c.length;if(void 0===l&&(l=new Uint8Array(h)),gH(l),gq(u),u<0||u>=g4)throw Error("arx: counter overflow");if(l.length<h)throw Error(`arx: output (${l.length}) is shorter than data (${h})`);let d=[],p=t.length,f,g;if(32===p)d.push(f=gX(t)),g=g5;else if(16===p&&r)(f=new Uint8Array(32)).set(t),f.set(t,16),g=g3,d.push(f);else throw Error(`arx: invalid 32-byte key, got length=${p}`);g6(a)||d.push(a=gX(a));let m=gK(f);if(i){if(24!==a.length)throw Error("arx: extended nonce must be 24 bytes");i(g,m,gK(a.subarray(0,16)),m),a=a.subarray(16)}let y=16-n;if(y!==a.length)throw Error(`arx: nonce must be ${y} or 16 bytes`);if(12!==y){let e=new Uint8Array(12);e.set(a,s?0:12-a.length),a=e,d.push(a)}return function(e,t,r,i,n,s,o,a){let c=n.length,l=new Uint8Array(64),u=gK(l),h=g6(n)&&g6(s),d=h?gK(n):g9,p=h?gK(s):g9;for(let f=0;f<c;o++){if(e(t,r,i,u,o,a),o>=g4)throw Error("arx: counter overflow");let g=Math.min(64,c-f);if(h&&64===g){let e=f/4;if(f%4!=0)throw Error("arx: invalid block position");for(let t=0,r;t<16;t++)p[r=e+t]=d[r]^u[t];f+=64;continue}for(let e=0,t;e<g;e++)s[t=f+e]=n[t]^l[e];f+=g}}(e,g,m,gK(a),c,l,u,o),gQ(...d),l}}(function(e,t,r,i,n,s=20){let o=e[0],a=e[1],c=e[2],l=e[3],u=t[0],h=t[1],d=t[2],p=t[3],f=t[4],g=t[5],m=t[6],y=t[7],w=r[0],b=r[1],v=r[2],E=o,_=a,C=c,A=l,I=u,S=h,N=d,O=p,x=f,T=g,R=m,P=y,k=n,D=w,M=b,U=v;for(let e=0;e<s;e+=2)x=x+(k=g8(k^(E=E+I|0),16))|0,E=E+(I=g8(I^x,12))|0,x=x+(k=g8(k^E,8))|0,I=g8(I^x,7),T=T+(D=g8(D^(_=_+S|0),16))|0,_=_+(S=g8(S^T,12))|0,T=T+(D=g8(D^_,8))|0,S=g8(S^T,7),R=R+(M=g8(M^(C=C+N|0),16))|0,C=C+(N=g8(N^R,12))|0,R=R+(M=g8(M^C,8))|0,N=g8(N^R,7),P=P+(U=g8(U^(A=A+O|0),16))|0,A=A+(O=g8(O^P,12))|0,P=P+(U=g8(U^A,8))|0,O=g8(O^P,7),R=R+(U=g8(U^(E=E+S|0),16))|0,E=E+(S=g8(S^R,12))|0,R=R+(U=g8(U^E,8))|0,S=g8(S^R,7),P=P+(k=g8(k^(_=_+N|0),16))|0,_=_+(N=g8(N^P,12))|0,P=P+(k=g8(k^_,8))|0,N=g8(N^P,7),x=x+(D=g8(D^(C=C+O|0),16))|0,C=C+(O=g8(O^x,12))|0,x=x+(D=g8(D^C,8))|0,O=g8(O^x,7),T=T+(M=g8(M^(A=A+I|0),16))|0,A=A+(I=g8(I^T,12))|0,T=T+(M=g8(M^A,8))|0,I=g8(I^T,7);let L=0;i[L++]=o+E|0,i[L++]=a+_|0,i[L++]=c+C|0,i[L++]=l+A|0,i[L++]=u+I|0,i[L++]=h+S|0,i[L++]=d+N|0,i[L++]=p+O|0,i[L++]=f+x|0,i[L++]=g+T|0,i[L++]=m+R|0,i[L++]=y+P|0,i[L++]=n+k|0,i[L++]=w+D|0,i[L++]=b+M|0,i[L++]=v+U|0},{counterRight:!1,counterLength:4,allowShortKeys:!1}),mi=new Uint8Array(16),mn=(e,t)=>{e.update(t);let r=t.length%16;r&&e.update(mi.subarray(r))},ms=new Uint8Array(32);function mo(e,t,r,i,n){let s=e(t,r,ms),o=mt.create(s);n&&mn(o,n),mn(o,i);let a=new Uint8Array(16),c=gZ(a);gJ(c,0,BigInt(n?n.length:0),!0),gJ(c,8,BigInt(i.length),!0),o.update(a);let l=o.digest();return gQ(s,a),l}u={blockSize:64,nonceLength:12,tagLength:16},h=(e,t,r)=>({encrypt(i,n){let s=i.length;(n=gY(s+16,n,!1)).set(i);let o=n.subarray(0,-16);mr(e,t,o,o,1);let a=mo(mr,e,t,o,r);return n.set(a,s),gQ(a),n},decrypt(i,n){n=gY(i.length-16,n,!1);let s=i.subarray(0,-16),o=i.subarray(-16),a=mo(mr,e,t,s,r);if(!function(e,t){if(e.length!==t.length)return!1;let r=0;for(let i=0;i<e.length;i++)r|=e[i]^t[i];return 0===r}(o,a))throw Error("invalid tag");return n.set(i.subarray(0,-16)),mr(e,t,n,n,1),gQ(a),n}}),Object.assign(function(e,...t){if(gH(e),void 0!==u.nonceLength){let e=t[0];if(!e)throw Error("nonce / iv required");u.varSizeNonce?gH(e):gH(e,u.nonceLength)}let r=u.tagLength;r&&void 0!==t[1]&&gH(t[1]);let i=h(e,...t),n=(e,t)=>{if(void 0!==t){if(2!==e)throw Error("cipher output not supported");gH(t)}},s=!1;return{encrypt(e,t){if(s)throw Error("cannot encrypt() twice with same key + nonce");return s=!0,gH(e),n(i.encrypt.length,t),i.encrypt(e,t)},decrypt(e,t){if(gH(e),r&&e.length<r)throw Error("invalid ciphertext length: smaller than tagLength="+r);return n(i.decrypt.length,t),i.decrypt(e,t)}}},u);class ma extends gI{constructor(e,t){super(),this.finished=!1,this.destroyed=!1,function(e){if("function"!=typeof e||"function"!=typeof e.create)throw Error("Hash should be wrapped by utils.wrapConstructor");gl(e.outputLen),gl(e.blockLen)}(e);let r=gA(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,n=new Uint8Array(i);n.set(r.length>i?e.create().update(r).digest():r);for(let e=0;e<n.length;e++)n[e]^=54;this.iHash.update(n),this.oHash=e.create();for(let e=0;e<n.length;e++)n[e]^=106;this.oHash.update(n),n.fill(0)}update(e){return gh(this),this.iHash.update(e),this}digestInto(e){gh(this),gu(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:i,destroyed:n,blockLen:s,outputLen:o}=this;return e.finished=i,e.destroyed=n,e.blockLen=s,e.outputLen=o,e.oHash=t._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}let mc=(e,t,r)=>new ma(e,t).update(r).digest();mc.create=(e,t)=>
908new ma(e,t),new Uint8Array([0]),new Uint8Array;class ml extends gI{constructor(e,t,r,i){super(),this.blockLen=e,this.outputLen=t,this.padOffset=r,this.isLE=i,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=gv(this.buffer)}update(e){gh(this);let{view:t,buffer:r,blockLen:i}=this,n=(e=gA(e)).length;for(let s=0;s<n;){let o=Math.min(i-this.pos,n-s);if(o===i){let t=gv(e);for(;i<=n-s;s+=i)this.process(t,s);continue}r.set(e.subarray(s,s+o),this.pos),this.pos+=o,s+=o,this.pos===i&&(this.process(t,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){gh(this),gd(e,this),this.finished=!0;let{buffer:t,view:r,blockLen:i,isLE:n}=this,{pos:s}=this;t[s++]=128,this.buffer.subarray(s).fill(0),this.padOffset>i-s&&(this.process(r,0),s=0);for(let e=s;e<i;e++)t[e]=0;(function(e,t,r,i){if("function"==typeof e.setBigUint64)return e.setBigUint64(t,r,i);let n=BigInt(32),s=BigInt(4294967295),o=Number(r>>n&s),a=Number(r&s),c=i?4:0,l=i?0:4;e.setUint32(t+c,o,i),e.setUint32(t+l,a,i)})(r,i-8,BigInt(8*this.length),n),this.process(r,0);let o=gv(e),a=this.outputLen;if(a%4)throw Error("_sha2: outputLen should be aligned to 32bit");let c=a/4,l=this.get();if(c>l.length)throw Error("_sha2: outputLen bigger than state");for(let e=0;e<c;e++)o.setUint32(4*e,l[e],n)}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:i,finished:n,destroyed:s,pos:o}=this;return e.length=i,e.pos=o,e.finished=n,e.destroyed=s,i%t&&e.buffer.set(r),e}}let mu=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),mh=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),md=new Uint32Array(64);class mp extends ml{constructor(){super(64,32,8,!1),this.A=0|mh[0],this.B=0|mh[1],this.C=0|mh[2],this.D=0|mh[3],this.E=0|mh[4],this.F=0|mh[5],this.G=0|mh[6],this.H=0|mh[7]}get(){let{A:e,B:t,C:r,D:i,E:n,F:s,G:o,H:a}=this;return[e,t,r,i,n,s,o,a]}set(e,t,r,i,n,s,o,a){this.A=0|e,this.B=0|t,this.C=0|r,this.D=0|i,this.E=0|n,this.F=0|s,this.G=0|o,this.H=0|a}process(e,t){for(let r=0;r<16;r++,t+=4)md[r]=e.getUint32(t,!1);for(let e=16;e<64;e++){let t=md[e-15],r=md[e-2],i=gE(t,7)^gE(t,18)^t>>>3,n=gE(r,17)^gE(r,19)^r>>>10;md[e]=n+md[e-7]+i+md[e-16]|0}let{A:r,B:i,C:n,D:s,E:o,F:a,G:c,H:l}=this;for(let e=0;e<64;e++){var u,h,d,p;let t=l+(gE(o,6)^gE(o,11)^gE(o,25))+((u=o)&a^~u&c)+mu[e]+md[e]|0,f=(gE(r,2)^gE(r,13)^gE(r,22))+((h=r)&(d=i)^h&(p=n)^d&p)|0;l=c,c=a,a=o,o=s+t|0,s=n,n=i,i=r,r=t+f|0}r=r+this.A|0,i=i+this.B|0,n=n+this.C|0,s=s+this.D|0,o=o+this.E|0,a=a+this.F|0,c=c+this.G|0,l=l+this.H|0,this.set(r,i,n,s,o,a,c,l)}roundClean(){md.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}let mf=gS(()=>new mp),mg=BigInt(0),mm=BigInt(1),my=BigInt(2);function mw(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&"Uint8Array"===e.constructor.name}function mb(e){if(!mw(e))throw Error("Uint8Array expected")}function mv(e,t){if("boolean"!=typeof t)throw Error(e+" boolean expected, got "+t)}let mE=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function m_(e){mb(e);let t="";for(let r=0;r<e.length;r++)t+=mE[e[r]];return t}function mC(e){let t=e.toString(16);return 1&t.length?"0"+t:t}function mA(e){if("string"!=typeof e)throw Error("hex string expected, got "+typeof e);return""===e?mg:BigInt("0x"+e)}let mI={_0:48,_9:57,A:65,F:70,a:97,f:102};function mS(e){return e>=mI._0&&e<=mI._9?e-mI._0:e>=mI.A&&e<=mI.F?e-(mI.A-10):e>=mI.a&&e<=mI.f?e-(mI.a-10):void 0}function mN(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 i=new Uint8Array(r);for(let t=0,n=0;t<r;t++,n+=2){let r=mS(e.charCodeAt(n)),s=mS(e.charCodeAt(n+1));if(void 0===r||void 0===s)throw Error('hex string expected, got non-hex character "'+(e[n]+e[n+1])+'" at index '+n);i[t]=16*r+s}return i}function mO(e){return mA(m_(e))}function mx(e){return mb(e),mA(m_(Uint8Array.from(e).reverse()))}function mT(e,t){return mN(e.toString(16).padStart(2*t,"0"))}function mR(e,t){return mT(e,t).reverse()}function mP(e,t,r){let i;if("string"==typeof t)try{i=mN(t)}catch(t){throw Error(e+" must be hex string or Uint8Array, cause: "+t)}else if(mw(t))i=Uint8Array.from(t);else throw Error(e+" must be hex string or Uint8Array");let n=i.length;if("number"==typeof r&&n!==r)throw Error(e+" of length "+r+" expected, got "+n);return i}function mk(...e){let t=0;for(let r=0;r<e.length;r++){let i=e[r];mb(i),t+=i.length}let r=new Uint8Array(t);for(let t=0,i=0;t<e.length;t++){let n=e[t];r.set(n,i),i+=n.length}return r}let mD=e=>"bigint"==typeof e&&mg<=e;function mM(e,t,r){return mD(e)&&mD(t)&&mD(r)&&t<=e&&e<r}function mU(e,t,r,i){if(!mM(t,r,i))throw Error("expected valid "+e+": "+r+" <= n < "+i+", got "+t)}function mL(e){let t;for(t=0;e>mg;e>>=mm,t+=1);return t}let mB=e=>(my<<BigInt(e-1))-mm,mj=e=>new Uint8Array(e),m$=e=>Uint8Array.from(e);function mF(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=mj(e),n=mj(e),s=0,o=()=>{i.fill(1),n.fill(0),s=0},a=(...e)=>r(n,i,...e),c=(e=mj())=>{n=a(m$([0]),e),i=a(),0!==e.length&&(n=a(m$([1]),e),i=a())},l=()=>{if(s++>=1e3)throw Error("drbg: tried 1000 values");let e=0,r=[];for(;e<t;){let t=(i=a()).slice();r.push(t),e+=i.length}return mk(...r)};return(e,t)=>{let r;for(o(),c(e);!(r=t(l()));)c();return o(),r}}let mq={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||mw(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 mz(e,t,r={}){let i=(t,r,i)=>{let n=mq[r];
908if("function"!=typeof n)throw Error("invalid validator function");let s=e[t];if(!(i&&void 0===s)&&!n(s,e))throw Error("param "+String(t)+" is invalid. Expected "+r+", got "+s)};for(let[e,r]of Object.entries(t))i(e,r,!1);for(let[e,t]of Object.entries(r))i(e,t,!0);return e}function mH(e){let t=new WeakMap;return(r,...i)=>{let n=t.get(r);if(void 0!==n)return n;let s=e(r,...i);return t.set(r,s),s}}var mW=Object.freeze({__proto__:null,isBytes:mw,abytes:mb,abool:mv,bytesToHex:m_,numberToHexUnpadded:mC,hexToNumber:mA,hexToBytes:mN,bytesToNumberBE:mO,bytesToNumberLE:mx,numberToBytesBE:mT,numberToBytesLE:mR,numberToVarBytesBE:function(e){return mN(mC(e))},ensureBytes:mP,concatBytes:mk,equalBytes:function(e,t){if(e.length!==t.length)return!1;let r=0;for(let i=0;i<e.length;i++)r|=e[i]^t[i];return 0===r},utf8ToBytes:function(e){if("string"!=typeof e)throw Error("string expected");return new Uint8Array(new TextEncoder().encode(e))},inRange:mM,aInRange:mU,bitLen:mL,bitGet:function(e,t){return e>>BigInt(t)&mm},bitSet:function(e,t,r){return e|(r?mm:mg)<<BigInt(t)},bitMask:mB,createHmacDrbg:mF,validateObject:mz,notImplemented:()=>{throw Error("not implemented")},memoized:mH});let mV=BigInt(0),mK=BigInt(1),mZ=BigInt(2),mG=BigInt(3),mY=BigInt(4),mJ=BigInt(5),mX=BigInt(8);function mQ(e,t){let r=e%t;return r>=mV?r:t+r}function m0(e,t,r){if(t<mV)throw Error("invalid exponent, negatives unsupported");if(r<=mV)throw Error("invalid modulus");if(r===mK)return mV;let i=mK;for(;t>mV;)t&mK&&(i=i*e%r),e=e*e%r,t>>=mK;return i}function m1(e,t,r){let i=e;for(;t-- >mV;)i*=i,i%=r;return i}function m2(e,t){if(e===mV)throw Error("invert: expected non-zero number");if(t<=mV)throw Error("invert: expected positive modulus, got "+t);let r=mQ(e,t),i=t,n=mV,s=mK;for(;r!==mV;){let e=i/r,t=i%r,o=n-s*e;i=r,r=t,n=s,s=o}if(i!==mK)throw Error("invert: does not exist");return mQ(n,t)}let m3=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function m5(e,t){let r=void 0!==t?t:e.toString(2).length;return{nBitLength:r,nByteLength:Math.ceil(r/8)}}function m8(e,t,r=!1,i={}){let n;if(e<=mV)throw Error("invalid field: expected ORDER > 0, got "+e);let{nBitLength:s,nByteLength:o}=m5(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:mB(s),ZERO:mV,ONE:mK,create:t=>mQ(t,e),isValid:t=>{if("bigint"!=typeof t)throw Error("invalid field element: expected bigint, got "+typeof t);return mV<=t&&t<e},is0:e=>e===mV,isOdd:e=>(e&mK)===mK,neg:t=>mQ(-t,e),eql:(e,t)=>e===t,sqr:t=>mQ(t*t,e),add:(t,r)=>mQ(t+r,e),sub:(t,r)=>mQ(t-r,e),mul:(t,r)=>mQ(t*r,e),pow:(e,t)=>(function(e,t,r){if(r<mV)throw Error("invalid exponent, negatives unsupported");if(r===mV)return e.ONE;if(r===mK)return t;let i=e.ONE,n=t;for(;r>mV;)r&mK&&(i=e.mul(i,n)),n=e.sqr(n),r>>=mK;return i})(a,e,t),div:(t,r)=>mQ(t*m2(r,e),e),sqrN:e=>e*e,addN:(e,t)=>e+t,subN:(e,t)=>e-t,mulN:(e,t)=>e*t,inv:t=>m2(t,e),sqrt:i.sqrt||(t=>(n||(n=function(e){if(e%mY===mG){let t=(e+mK)/mY;return function(e,r){let i=e.pow(r,t);if(!e.eql(e.sqr(i),r))throw Error("Cannot find square root");return i}}if(e%mX===mJ){let t=(e-mJ)/mX;return function(e,r){let i=e.mul(r,mZ),n=e.pow(i,t),s=e.mul(r,n),o=e.mul(e.mul(s,mZ),n),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,i;let n=(e-mK)/mZ;for(t=e-mK,r=0;t%mZ===mV;t/=mZ,r++);for(i=mZ;i<e&&m0(i,n,e)!==e-mK;i++)if(i>1e3)throw Error("Cannot find square root: likely non-prime P");if(1===r){let t=(e+mK)/mY;return function(e,r){let i=e.pow(r,t);if(!e.eql(e.sqr(i),r))throw Error("Cannot find square root");return i}}let s=(t+mK)/mZ;return function(e,o){if(e.pow(o,n)===e.neg(e.ONE))throw Error("Cannot find square root");let a=r,c=e.pow(e.mul(e.ONE,i),t),l=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(c,mK<<BigInt(a-t-1));c=e.sqr(r),l=e.mul(l,r),u=e.mul(u,c),a=t}return l}}(e)}(e)),n(a,t))),invertBatch:e=>(function(e,t){let r=Array(t.length),i=t.reduce((t,i,n)=>e.is0(i)?t:(r[n]=t,e.mul(t,i)),e.ONE),n=e.inv(i);return t.reduceRight((t,i,n)=>e.is0(i)?t:(r[n]=e.mul(t,r[n]),e.mul(t,i)),n),r})(a,e),cmov:(e,t,r)=>r?t:e,toBytes:e=>r?mR(e,o):mT(e,o),fromBytes:e=>{if(e.length!==o)throw Error("Field.fromBytes: expected "+o+" bytes, got "+e.length);return r?mx(e):mO(e)}});return Object.freeze(a)}function m6(e){if("bigint"!=typeof e)throw Error("field order must be bigint");return Math.ceil(e.toString(2).length/8)}function m4(e){let t=m6(e);return t+Math.ceil(t/2)}let m9=BigInt(0),m7=BigInt(1);function ye(e,t){let r=t.negate();return e?r:t}function yt(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw Error("invalid window size, expected [1.."+t+"], got W="+e)}function yr(e,t){return yt(e,t),{windows:Math.ceil(t/e)+1,windowSize:2**(e-1)}}let yi=new WeakMap,yn=new WeakMap;function ys(e){return yn.get(e)||1}function yo(e){return mz(e.Fp,m3.reduce((e,t)=>
908(e[t]="function",e),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),mz(e,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...m5(e.n,e.nBitLength),...e,p:e.Fp.ORDER})}BigInt(0),BigInt(1),BigInt(2),BigInt(8),BigInt(0),BigInt(1);let ya=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949");BigInt(0);let yc=BigInt(1),yl=BigInt(2),yu=BigInt(3),yh=BigInt(5);function yd(e){void 0!==e.lowS&&mv("lowS",e.lowS),void 0!==e.prehash&&mv("prehash",e.prehash)}BigInt(8),function(e){let t=(mz(e,{a:"bigint"},{montgomeryBits:"isSafeInteger",nByteLength:"isSafeInteger",adjustScalarBytes:"function",domain:"function",powPminus2:"function",Gu:"bigint"}),Object.freeze({...e})),{P:r}=t,i=e=>mQ(e,r),n=t.montgomeryBits;t.nByteLength,t.adjustScalarBytes||(e=>e),t.powPminus2||(e=>m0(e,r-BigInt(2),r));t.a,BigInt(2),BigInt(4),mR(i(t.Gu),Math.ceil(n/8))}({P:ya,a:BigInt(486662),montgomeryBits:255,nByteLength:32,Gu:BigInt(9),powPminus2:e=>{let{pow_p_5_8:t,b2:r}=function(e){let t=BigInt(10),r=BigInt(20),i=BigInt(40),n=BigInt(80),s=e*e%ya*e%ya,o=m1(s,yl,ya)*s%ya,a=m1(o,yc,ya)*e%ya,c=m1(a,yh,ya)*a%ya,l=m1(c,t,ya)*c%ya,u=m1(l,r,ya)*l%ya,h=m1(u,i,ya)*u%ya,d=m1(h,n,ya)*h%ya,p=m1(d,n,ya)*h%ya,f=m1(p,t,ya)*c%ya;return{pow_p_5_8:m1(f,yl,ya)*e%ya,b2:s}}(e);return mQ(m1(t,yu,ya)*r,ya)},adjustScalarBytes:function(e){return e[0]&=248,e[31]&=127,e[31]|=64,e},randomBytes:gN});let{bytesToNumberBE:yp,hexToBytes:yf}=mW;class yg extends Error{constructor(e=""){super(e)}}let ym={Err:yg,_tlv:{encode:(e,t)=>{let{Err:r}=ym;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(1&t.length)throw new r("tlv.encode: unpadded data");let i=t.length/2,n=mC(i);if(n.length/2&128)throw new r("tlv.encode: long form length too big");let s=i>127?mC(n.length/2|128):"";return mC(e)+s+n+t},decode(e,t){let{Err:r}=ym,i=0;if(e<0||e>256)throw new r("tlv.encode: wrong tag");if(t.length<2||t[i++]!==e)throw new r("tlv.decode: wrong tlv");let n=t[i++],s=0;if(128&n){let e=127&n;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(i,i+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(i+=e,s<128)throw new r("tlv.decode(long): not minimal encoding")}else s=n;let o=t.subarray(i,i+s);if(o.length!==s)throw new r("tlv.decode: wrong value length");return{v:o,l:t.subarray(i+s)}}},_int:{encode(e){let{Err:t}=ym;if(e<yy)throw new t("integer: negative integers are not allowed");let r=mC(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}=ym;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 yp(e)}},toSig(e){let{Err:t,_int:r,_tlv:i}=ym,n="string"==typeof e?yf(e):e;mb(n);let{v:s,l:o}=i.decode(48,n);if(o.length)throw new t("invalid signature: left bytes after parsing");let{v:a,l:c}=i.decode(2,s),{v:l,l:u}=i.decode(2,c);if(u.length)throw new t("invalid signature: left bytes after parsing");return{r:r.decode(a),s:r.decode(l)}},hexFromSig(e){let{_tlv:t,_int:r}=ym,i=t.encode(2,r.encode(e.r)),n=t.encode(2,r.encode(e.s));return t.encode(48,i+n)}},yy=BigInt(0),yw=BigInt(1);BigInt(2);let yb=BigInt(3);BigInt(4);let yv=m8(BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"));function yE(e){return e.includes(":")}function y_(e){return yE(e)?e.split(":")[0]:e}a={a:yv.create(BigInt("-3")),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Fp:yv,n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5"),h:BigInt(1),lowS:!1},s=mf,function(e){let t=function(e){let t=yo(e);return mz(t,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...t})}(e),{Fp:r,n:i}=t,n=r.BYTES+1,s=2*r.BYTES+1;function o(e){return mQ(e,i)}let{ProjectivePoint:a,normPrivateKeyToScalar:c,weierstrassEquation:l,isWithinCurveOrder:u}=function(e){var t;let r=function(e){let t=yo(e);mz(t,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:r,Fp:i,a:n}=t;if(r){if(!i.eql(n,i.ZERO))throw Error("invalid endomorphism, can only be defined for Koblitz curves that have a=0");if("object"!=typeof r||"bigint"!=typeof r.beta||"function"!=typeof r.splitScalar)throw Error("invalid endomorphism, expected beta: bigint and splitScalar: function")}return Object.freeze({...t})}(e),{Fp:i}=r,n=m8(r.n,r.nBitLength),s=r.toBytes||((e,t,r)=>{let n=t.toAffine();return mk(Uint8Array.from([4]),i.toBytes(n.x),i.toBytes(n.y))}),o=r.fromBytes||(e=>{let t=e.subarray(1);return{x:i.fromBytes(t.subarray(0,i.BYTES)),y:i.fromBytes(t.subarray(i.BYTES,2*i.BYTES))}});function a(e){let{a:t,b:n}=r,s=i.sqr(e),o=i.mul(s,e);return i.add(i.add(o,i.mul(e,t)),n)}
908if(!i.eql(i.sqr(r.Gy),a(r.Gx)))throw Error("bad generator point: equation left != right");function c(e){let t;let{allowedPrivateKeyLengths:i,nByteLength:n,wrapPrivateKey:s,n:o}=r;if(i&&"bigint"!=typeof e){if(mw(e)&&(e=m_(e)),"string"!=typeof e||!i.includes(e.length))throw Error("invalid private key");e=e.padStart(2*n,"0")}try{t="bigint"==typeof e?e:mO(mP("private key",e,n))}catch{throw Error("invalid private key, expected hex or "+n+" bytes, got "+typeof e)}return s&&(t=mQ(t,o)),mU("private key",t,yw,o),t}function l(e){if(!(e instanceof d))throw Error("ProjectivePoint expected")}let u=mH((e,t)=>{let{px:r,py:n,pz:s}=e;if(i.eql(s,i.ONE))return{x:r,y:n};let o=e.is0();null==t&&(t=o?i.ONE:i.inv(s));let a=i.mul(r,t),c=i.mul(n,t),l=i.mul(s,t);if(o)return{x:i.ZERO,y:i.ZERO};if(!i.eql(l,i.ONE))throw Error("invZ was invalid");return{x:a,y:c}}),h=mH(e=>{if(e.is0()){if(r.allowInfinityPoint&&!i.is0(e.py))return;throw Error("bad point: ZERO")}let{x:t,y:n}=e.toAffine();if(!i.isValid(t)||!i.isValid(n))throw Error("bad point: x or y not FE");let s=i.sqr(n),o=a(t);if(!i.eql(s,o))throw Error("bad point: equation left != right");if(!e.isTorsionFree())throw Error("bad point: not in prime-order subgroup");return!0});class d{constructor(e,t,r){if(this.px=e,this.py=t,this.pz=r,null==e||!i.isValid(e))throw Error("x required");if(null==t||!i.isValid(t))throw Error("y required");if(null==r||!i.isValid(r))throw Error("z required");Object.freeze(this)}static fromAffine(e){let{x:t,y:r}=e||{};if(!e||!i.isValid(t)||!i.isValid(r))throw Error("invalid affine point");if(e instanceof d)throw Error("projective point not allowed");let n=e=>i.eql(e,i.ZERO);return n(t)&&n(r)?d.ZERO:new d(t,r,i.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(e){let t=i.invertBatch(e.map(e=>e.pz));return e.map((e,r)=>e.toAffine(t[r])).map(d.fromAffine)}static fromHex(e){let t=d.fromAffine(o(mP("pointHex",e)));return t.assertValidity(),t}static fromPrivateKey(e){return d.BASE.multiply(c(e))}static msm(e,t){return function(e,t,r,i){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)})}(i,t),r.length!==i.length)throw Error("arrays of points and scalars must have equal length");let n=e.ZERO,s=mL(BigInt(r.length)),o=s>12?s-3:s>4?s-2:s?2:1,a=(1<<o)-1,c=Array(a+1).fill(n),l=Math.floor((t.BITS-1)/o)*o,u=n;for(let e=l;e>=0;e-=o){c.fill(n);for(let t=0;t<i.length;t++){let n=Number(i[t]>>BigInt(e)&BigInt(a));c[n]=c[n].add(r[t])}let t=n;for(let e=c.length-1,r=n;e>0;e--)r=r.add(c[e]),t=t.add(r);if(u=u.add(t),0!==e)for(let e=0;e<o;e++)u=u.double()}return u}(d,n,e,t)}_setWindowSize(e){f.setWindowSize(this,e)}assertValidity(){h(this)}hasEvenY(){let{y:e}=this.toAffine();if(i.isOdd)return!i.isOdd(e);throw Error("Field doesn't support isOdd")}equals(e){l(e);let{px:t,py:r,pz:n}=this,{px:s,py:o,pz:a}=e,c=i.eql(i.mul(t,a),i.mul(s,n)),u=i.eql(i.mul(r,a),i.mul(o,n));return c&&u}negate(){return new d(this.px,i.neg(this.py),this.pz)}double(){let{a:e,b:t}=r,n=i.mul(t,yb),{px:s,py:o,pz:a}=this,c=i.ZERO,l=i.ZERO,u=i.ZERO,h=i.mul(s,s),p=i.mul(o,o),f=i.mul(a,a),g=i.mul(s,o);return g=i.add(g,g),u=i.mul(s,a),u=i.add(u,u),c=i.mul(e,u),l=i.mul(n,f),l=i.add(c,l),c=i.sub(p,l),l=i.add(p,l),l=i.mul(c,l),c=i.mul(g,c),u=i.mul(n,u),f=i.mul(e,f),g=i.sub(h,f),g=i.mul(e,g),g=i.add(g,u),u=i.add(h,h),h=i.add(u,h),h=i.add(h,f),h=i.mul(h,g),l=i.add(l,h),f=i.mul(o,a),f=i.add(f,f),h=i.mul(f,g),c=i.sub(c,h),u=i.mul(f,p),u=i.add(u,u),new d(c,l,u=i.add(u,u))}add(e){l(e);let{px:t,py:n,pz:s}=this,{px:o,py:a,pz:c}=e,u=i.ZERO,h=i.ZERO,p=i.ZERO,f=r.a,g=i.mul(r.b,yb),m=i.mul(t,o),y=i.mul(n,a),w=i.mul(s,c),b=i.add(t,n),v=i.add(o,a);b=i.mul(b,v),v=i.add(m,y),b=i.sub(b,v),v=i.add(t,s);let E=i.add(o,c);return v=i.mul(v,E),E=i.add(m,w),v=i.sub(v,E),E=i.add(n,s),u=i.add(a,c),E=i.mul(E,u),u=i.add(y,w),E=i.sub(E,u),p=i.mul(f,v),u=i.mul(g,w),p=i.add(u,p),u=i.sub(y,p),p=i.add(y,p),h=i.mul(u,p),y=i.add(m,m),y=i.add(y,m),w=i.mul(f,w),v=i.mul(g,v),y=i.add(y,w),w=i.sub(m,w),w=i.mul(f,w),v=i.add(v,w),m=i.mul(y,v),h=i.add(h,m),m=i.mul(E,v),u=i.mul(b,u),u=i.sub(u,m),m=i.mul(b,y),p=i.mul(E,p),new d(u,h,p=i.add(p,m))}subtract(e){return this.add(e.negate())}is0(){return this.equals(d.ZERO)}wNAF(e){return f.wNAFCached(this,e,d.normalizeZ)}multiplyUnsafe(e){let{endo:t,n:n}=r;mU("scalar",e,yy,n);let s=d.ZERO;if(e===yy)return s;if(this.is0()||e===yw)return this;if(!t||f.hasPrecomputes(this))return f.wNAFCachedUnsafe(this,e,d.normalizeZ);
908let{k1neg:o,k1:a,k2neg:c,k2:l}=t.splitScalar(e),u=s,h=s,p=this;for(;a>yy||l>yy;)a&yw&&(u=u.add(p)),l&yw&&(h=h.add(p)),p=p.double(),a>>=yw,l>>=yw;return o&&(u=u.negate()),c&&(h=h.negate()),h=new d(i.mul(h.px,t.beta),h.py,h.pz),u.add(h)}multiply(e){let t,n;let{endo:s,n:o}=r;if(mU("scalar",e,yw,o),s){let{k1neg:r,k1:o,k2neg:a,k2:c}=s.splitScalar(e),{p:l,f:u}=this.wNAF(o),{p:h,f:p}=this.wNAF(c);l=f.constTimeNegate(r,l),h=f.constTimeNegate(a,h),h=new d(i.mul(h.px,s.beta),h.py,h.pz),t=l.add(h),n=u.add(p)}else{let{p:r,f:i}=this.wNAF(e);t=r,n=i}return d.normalizeZ([t,n])[0]}multiplyAndAddUnsafe(e,t,r){let i=d.BASE,n=(e,t)=>t!==yy&&t!==yw&&e.equals(i)?e.multiply(t):e.multiplyUnsafe(t),s=n(this,t).add(n(e,r));return s.is0()?void 0:s}toAffine(e){return u(this,e)}isTorsionFree(){let{h:e,isTorsionFree:t}=r;if(e===yw)return!0;if(t)return t(d,this);throw Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:e,clearCofactor:t}=r;return e===yw?this:t?t(d,this):this.multiplyUnsafe(r.h)}toRawBytes(e=!0){return mv("isCompressed",e),this.assertValidity(),s(d,this,e)}toHex(e=!0){return mv("isCompressed",e),m_(this.toRawBytes(e))}}d.BASE=new d(r.Gx,r.Gy,i.ONE),d.ZERO=new d(i.ZERO,i.ONE,i.ZERO);let p=r.nBitLength,f=(t=r.endo?Math.ceil(p/2):p,{constTimeNegate:ye,hasPrecomputes:e=>1!==ys(e),unsafeLadder(e,t,r=d.ZERO){let i=e;for(;t>m9;)t&m7&&(r=r.add(i)),i=i.double(),t>>=m7;return r},precomputeWindow(e,r){let{windows:i,windowSize:n}=yr(r,t),s=[],o=e,a=o;for(let e=0;e<i;e++){a=o,s.push(a);for(let e=1;e<n;e++)a=a.add(o),s.push(a);o=a.double()}return s},wNAF(e,r,i){let{windows:n,windowSize:s}=yr(e,t),o=d.ZERO,a=d.BASE,c=BigInt(2**e-1),l=2**e,u=BigInt(e);for(let e=0;e<n;e++){let t=e*s,n=Number(i&c);i>>=u,n>s&&(n-=l,i+=m7);let h=t+Math.abs(n)-1,d=e%2!=0,p=n<0;0===n?a=a.add(ye(d,r[t])):o=o.add(ye(p,r[h]))}return{p:o,f:a}},wNAFUnsafe(e,r,i,n=d.ZERO){let{windows:s,windowSize:o}=yr(e,t),a=BigInt(2**e-1),c=2**e,l=BigInt(e);for(let e=0;e<s;e++){let t=e*o;if(i===m9)break;let s=Number(i&a);if(i>>=l,s>o&&(s-=c,i+=m7),0===s)continue;let u=r[t+Math.abs(s)-1];s<0&&(u=u.negate()),n=n.add(u)}return n},getPrecomputes(e,t,r){let i=yi.get(t);return i||(i=this.precomputeWindow(t,e),1!==e&&yi.set(t,r(i))),i},wNAFCached(e,t,r){let i=ys(e);return this.wNAF(i,this.getPrecomputes(i,e,r),t)},wNAFCachedUnsafe(e,t,r,i){let n=ys(e);return 1===n?this.unsafeLadder(e,t,i):this.wNAFUnsafe(n,this.getPrecomputes(n,e,r),t,i)},setWindowSize(e,r){yt(r,t),yn.set(e,r),yi.delete(e)}});return{CURVE:r,ProjectivePoint:d,normPrivateKeyToScalar:c,weierstrassEquation:a,isWithinCurveOrder:function(e){return mM(e,yw,r.n)}}}({...t,toBytes(e,t,i){let n=t.toAffine(),s=r.toBytes(n.x);return mv("isCompressed",i),i?mk(Uint8Array.from([t.hasEvenY()?2:3]),s):mk(Uint8Array.from([4]),s,r.toBytes(n.y))},fromBytes(e){let t=e.length,i=e[0],o=e.subarray(1);if(t===n&&(2===i||3===i)){let e;let t=mO(o);if(!mM(t,yw,r.ORDER))throw Error("Point is not on curve");let n=l(t);try{e=r.sqrt(n)}catch(e){throw Error("Point is not on curve"+(e instanceof Error?": "+e.message:""))}return(1&i)==1!=((e&yw)===yw)&&(e=r.neg(e)),{x:t,y:e}}if(t===s&&4===i)return{x:r.fromBytes(o.subarray(0,r.BYTES)),y:r.fromBytes(o.subarray(r.BYTES,2*r.BYTES))};throw Error("invalid Point, expected length of "+n+", or uncompressed "+s+", got "+t)}}),h=e=>m_(mT(e,t.nByteLength)),d=(e,t,r)=>mO(e.slice(t,r));class p{constructor(e,t,r){this.r=e,this.s=t,this.recovery=r,this.assertValidity()}static fromCompact(e){let r=t.nByteLength;return new p(d(e=mP("compactSignature",e,2*r),0,r),d(e,r,2*r))}static fromDER(e){let{r:t,s:r}=ym.toSig(mP("DER",e));return new p(t,r)}assertValidity(){mU("r",this.r,yw,i),mU("s",this.s,yw,i)}addRecoveryBit(e){return new p(this.r,this.s,e)}recoverPublicKey(e){let{r:n,s:s,recovery:c}=this,l=m(mP("msgHash",e));if(null==c||![0,1,2,3].includes(c))throw Error("recovery id invalid");let u=2===c||3===c?n+t.n:n;if(u>=r.ORDER)throw Error("recovery id 2 or 3 invalid");let d=(1&c)==0?"02":"03",p=a.fromHex(d+h(u)),f=m2(u,i),g=o(-l*f),y=o(s*f),w=a.BASE.multiplyAndAddUnsafe(p,g,y);if(!w)throw Error("point at infinify");return w.assertValidity(),w}hasHighS(){return this.s>i>>yw}normalizeS(){return this.hasHighS()?new p(this.r,o(-this.s),this.recovery):this}toDERRawBytes(){return mN(this.toDERHex())}toDERHex(){return ym.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return mN(this.toCompactHex())}toCompactHex(){return h(this.r)+h(this.s)}}function f(e){let t=mw(e),r="string"==typeof e,i=(t||r)&&e.length;return t?i===n||i===s:r?i===2*n||i===2*s:e instanceof a}let g=t.bits2int||function(e){if(e.length>8192)throw Error("input is too large");let r=mO(e),i=8*e.length-t.nBitLength;return i>0?r>>BigInt(i):r},m=t.bits2int_modN||function(e){return o(g(e))},y=mB(t.nBitLength);function w(e){return mU("num < 2^"+t.nBitLength,e,yy,y),mT(e,t.nByteLength)}let b={lowS:t.lowS,prehash:!1},v={lowS:t.lowS,prehash:!1};a.BASE._setWindowSize(8)}({...a,hash:s,hmac:(e,...t)=>mc(s,e,function(...e){let t=0;for(let r=0;r<e.length;r++){let i=e[r];gu(i),t+=i.length}let r=new Uint8Array(t);for(let t=0,i=0;t<e.length;t++){let n=e[t];r.set(n,i),i+=n.length}return r}(...t)),randomBytes:gN}),Object.prototype.hasOwnProperty,Object.prototype.propertyIsEnumerable;
908let yC={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}};function yA(e,t){let{message:r,code:i}=yC[e];return{message:t?`${r} ${t}`:r,code:i}}function yI(e,t){return!!Array.isArray(e)&&(!("u">typeof t)||!e.length||e.every(t))}var yS=r(80751),yN=r.n(yS),yO=Object.defineProperty,yx=Object.defineProperties,yT=Object.getOwnPropertyDescriptors,yR=Object.getOwnPropertySymbols,yP=Object.prototype.hasOwnProperty,yk=Object.prototype.propertyIsEnumerable,yD=(e,t,r)=>t in e?yO(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,yM=(e,t)=>{for(var r in t||(t={}))yP.call(t,r)&&yD(e,r,t[r]);if(yR)for(var r of yR(t))yk.call(t,r)&&yD(e,r,t[r]);return e},yU=(e,t)=>yx(e,yT(t));let yL={headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"};class yB{constructor(e,t=!1){if(this.url=e,this.disableProviderPing=t,this.events=new S.EventEmitter,this.isAvailable=!1,this.registering=!1,!ak(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,X.u)(e),r=await (await yN()(this.url,yU(yM({},yL),{body:t}))).json();this.onPayload({data:r})}catch(t){this.onError(e.id,t)}}async register(e=this.url){if(!ak(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,X.u)({id:1,jsonrpc:"2.0",method:"test",params:[]});await yN()(e,yU(yM({},yL),{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,X.D)(e.data):e.data;this.events.emit("payload",t)}onError(e,t){let r=this.parseError(t),i=aO(e,r.message||r.toString());this.events.emit("payload",i)}parseError(e,t=this.url){return a_(e,t,"HTTP")}
908resetMaxListeners(){this.events.getMaxListeners()>10&&this.events.setMaxListeners(10)}}var yj=r(82957).Buffer;let y$="error",yF="wc@2:universal_provider:",yq="https://rpc.walletconnect.org/v1/",yz="generic",yH=`${yq}bundler`,yW="default_chain_changed";function yV(){}function yK(e){return null==e||"object"!=typeof e&&"function"!=typeof e}function yZ(e){return ArrayBuffer.isView(e)&&!(e instanceof DataView)}function yG(e){return"object"==typeof e&&null!==e}function yY(e){return Object.getOwnPropertySymbols(e).filter(t=>Object.prototype.propertyIsEnumerable.call(e,t))}function yJ(e){return null==e?void 0===e?"[object Undefined]":"[object Null]":Object.prototype.toString.call(e)}let yX="[object String]",yQ="[object Number]",y0="[object Boolean]",y1="[object Arguments]";function y2(e,t,r,i=new Map,n){let s=n?.(e,t,r,i);if(null!=s)return s;if(yK(e))return e;if(i.has(e))return i.get(e);if(Array.isArray(e)){let t=Array(e.length);i.set(e,t);for(let s=0;s<e.length;s++)t[s]=y2(e[s],s,r,i,n);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(i.set(e,t),e))t.set(s,y2(o,s,r,i,n));return t}if(e instanceof Set){let t=new Set;for(let s of(i.set(e,t),e))t.add(y2(s,void 0,r,i,n));return t}if("u">typeof yj&&yj.isBuffer(e))return e.subarray();if(yZ(e)){let t=new(Object.getPrototypeOf(e)).constructor(e.length);i.set(e,t);for(let s=0;s<e.length;s++)t[s]=y2(e[s],s,r,i,n);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 i.set(e,t),y3(t,e,r,i,n),t}if("u">typeof File&&e instanceof File){let t=new File([e],e.name,{type:e.type});return i.set(e,t),y3(t,e,r,i,n),t}if(e instanceof Blob){let t=new Blob([e],{type:e.type});return i.set(e,t),y3(t,e,r,i,n),t}if(e instanceof Error){let t=new e.constructor;return i.set(e,t),t.message=e.message,t.name=e.name,t.stack=e.stack,t.cause=e.cause,y3(t,e,r,i,n),t}if("object"==typeof e&&function(e){switch(yJ(e)){case y1:case"[object Array]":case"[object ArrayBuffer]":case"[object DataView]":case y0:case"[object Date]":case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Map]":case yQ:case"[object Object]":case"[object RegExp]":case"[object Set]":case yX: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 i.set(e,t),y3(t,e,r,i,n),t}return e}function y3(e,t,r=e,i,n){let s=[...Object.keys(t),...yY(t)];for(let o=0;o<s.length;o++){let a=s[o],c=Object.getOwnPropertyDescriptor(e,a);(null==c||c.writable)&&(e[a]=y2(t[a],a,r,i,n))}}function y5(e){var t;return t=(t,r,i,n)=>{let s=void 0;if(null!=s)return s;if("object"==typeof e)switch(Object.prototype.toString.call(e)){case yQ:case yX:case y0:{let t=new e.constructor(e?.valueOf());return y3(t,e),t}case y1:{let t={};return y3(t,e),t.length=e.length,t[Symbol.iterator]=e[Symbol.iterator],t}default:return}},y2(e,void 0,e,new Map,t)}function y8(e){return null!==e&&"object"==typeof e&&"[object Arguments]"===yJ(e)}var y6=Object.defineProperty,y4=Object.defineProperties,y9=Object.getOwnPropertyDescriptors,y7=Object.getOwnPropertySymbols,we=Object.prototype.hasOwnProperty,wt=Object.prototype.propertyIsEnumerable,wr=(e,t,r)=>t in e?y6(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,wi=(e,t)=>{for(var r in t||(t={}))we.call(t,r)&&wr(e,r,t[r]);if(y7)for(var r of y7(t))wt.call(t,r)&&wr(e,r,t[r]);return e},wn=(e,t)=>y4(e,y9(t));function ws(e,t,r){var i;let n=ga(e);return(null==(i=t.rpcMap)?void 0:i[n.reference])||`${yq}?chainId=${n.namespace}:${n.reference}&projectId=${r}`}function wo(e){return e.includes(":")?e.split(":")[1]:e}function wa(e){return e.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function wc(e={},t={}){return function(e,...t){return function(e,...t){let r=t.slice(0,-1),i=t[t.length-1],n=e;for(let e=0;e<r.length;e++)n=function e(t,r,i,n){if(yK(t)&&(t=Object(t)),null==r||"object"!=typeof r)return t;if(n.has(r))return function(e){if(yK(e))return e;if(Array.isArray(e)||yZ(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}(n.get(r));if(n.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),...yY(r)];for(let o=0;o<s.length;o++){let a=s[o],c=r[a],l=t[a];if(y8(c)&&(c={...c}),y8(l)&&(l={...l}),"u">
908typeof yj&&yj.isBuffer(c)&&(c=y5(c)),Array.isArray(c)){if("object"==typeof l&&null!=l){let e=[],t=Reflect.ownKeys(l);for(let r=0;r<t.length;r++){let i=t[r];e[i]=l[i]}l=e}else l=[]}let u=i(l,c,a,t,r,n);null!=u?t[a]=u:Array.isArray(c)||yG(l)&&yG(c)?t[a]=e(l,c,i,n):null==l&&function(e){if("object"!=typeof e||null==e)return!1;if(null===Object.getPrototypeOf(e))return!0;if("[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}(c)?t[a]=e({},c,i,n):null==l&&yZ(c)?t[a]=y5(c):(void 0===l||void 0!==c)&&(t[a]=c)}return t}(n,r[e],i,new Map);return n}(e,...t,yV)}(wl(e),wl(t))}function wl(e){var t,r,i,n;let s={};if(!(Object.getPrototypeOf(e)===Object.prototype&&Object.keys(e).length))return s;for(let[o,a]of Object.entries(e)){let e=yE(o)?[o]:a.chains,c=a.methods||[],l=a.events||[],u=a.rpcMap||{},h=y_(o);s[h]=wn(wi(wi({},s[h]),a),{chains:gc(e,null==(t=s[h])?void 0:t.chains),methods:gc(c,null==(r=s[h])?void 0:r.methods),events:gc(l,null==(i=s[h])?void 0:i.events),rpcMap:wi(wi({},u),null==(n=s[h])?void 0:n.rpcMap)})}return s}function wu(e){return e.includes(":")?e.split(":")[2]:e}function wh(e){let t={};for(let[r,i]of Object.entries(e)){let e=i.methods||[],n=i.events||[],s=i.accounts||[],o=yE(r)?[r]:i.chains?i.chains:wa(i.accounts);t[r]={chains:o,methods:e,events:n,accounts:s}}return t}function wd(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 wp={},wf=e=>wp[e],wg=(e,t)=>{wp[e]=t};var wm=Object.defineProperty,wy=(e,t,r)=>t in e?wm(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,ww=(e,t,r)=>wy(e,"symbol"!=typeof t?t+"":t,r);class wb{constructor(e){ww(this,"name","polkadot"),ww(this,"client"),ww(this,"httpProviders"),ww(this,"events"),ww(this,"namespace"),ww(this,"chainId"),this.namespace=e.namespace,this.events=wf("events"),this.client=wf("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}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]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(yW,`${this.name}:${e}`)}getAccounts(){let e=this.namespace.accounts;return e&&e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{var r;let i=wo(t);e[i]=this.createHttpProvider(i,null==(r=this.namespace.rpcMap)?void 0:r[t])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||ws(e,this.namespace,this.client.core.projectId);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new a$(new yB(r,wf("disableProviderPing")))}}var wv=Object.defineProperty,wE=Object.defineProperties,w_=Object.getOwnPropertyDescriptors,wC=Object.getOwnPropertySymbols,wA=Object.prototype.hasOwnProperty,wI=Object.prototype.propertyIsEnumerable,wS=(e,t,r)=>t in e?wv(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,wN=(e,t)=>{for(var r in t||(t={}))wA.call(t,r)&&wS(e,r,t[r]);if(wC)for(var r of wC(t))wI.call(t,r)&&wS(e,r,t[r]);return e},wO=(e,t)=>wE(e,w_(t)),wx=(e,t,r)=>wS(e,"symbol"!=typeof t?t+"":t,r);class wT{constructor(e){wx(this,"name","eip155"),wx(this,"client"),wx(this,"chainId"),wx(this,"namespace"),wx(this,"httpProviders"),wx(this,"events"),this.namespace=e.namespace,this.events=wf("events"),this.client=wf("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}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)}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),this.chainId=parseInt(e),this.events.emit(yW,`${this.name}:${e}`)}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||ws(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new a$(new yB(r,wf("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 i=parseInt(wo(t));e[i]=this.createHttpProvider(i,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(){let e=this.chainId,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}async handleSwitchChain(e){var t,r;let i=e.request.params?null==(t=e.request.params[0])?void 0:t.chainId:"0x0",n=parseInt(i=i.startsWith("0x")?i:`0x${i}`,16);if(this.isChainApproved(n))this.setDefaultChain(`${n}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:i}]},chainId:null==(r=this.namespace.chains)?void 0:r[0]}),this.setDefaultChain(`${n}`);else throw Error(`Failed to switch to chain 'eip155:${n}'. 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,i;let n=null==(r=null==(t=e.request)?void 0:t.params)?void 0:r[0];if(!n)throw Error("Missing address parameter in `wallet_getCapabilities` request");let s=this.client.session.get(e.topic),o=(null==(i=s?.sessionProperties)?void 0:i.capabilities)||{};if(null!=o&&o[n])return o?.[n];let a=await this.client.request(e);try{await this.client.session.update(e.topic,{sessionProperties:wO(wN({},s.sessionProperties||{}),{capabilities:wO(wN({},o||{}),{[n]:a})})})}catch(e){console.warn("Failed to update session with capabilities",e)}return a}
908async getCallStatus(e){var t,r;let i=this.client.session.get(e.topic),n=null==(t=i.sessionProperties)?void 0:t.bundler_name;if(n){let t=this.getBundlerUrl(e.chainId,n);try{return await this.getUserOperationReceipt(t,e)}catch(e){console.warn("Failed to fetch call status from bundler",e,t)}}let s=null==(r=i.sessionProperties)?void 0:r.bundler_url;if(s)try{return await this.getUserOperationReceipt(s,e)}catch(e){console.warn("Failed to fetch call status from custom bundler",e,s)}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 i=new URL(e),n=await fetch(i,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(aS("eth_getUserOperationReceipt",[null==(r=t.request.params)?void 0:r[0]]))});if(!n.ok)throw Error(`Failed to fetch user operation receipt - ${n.status}`);return await n.json()}getBundlerUrl(e,t){return`${yH}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${t}`}}var wR=Object.defineProperty,wP=(e,t,r)=>t in e?wR(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,wk=(e,t,r)=>wP(e,"symbol"!=typeof t?t+"":t,r);class wD{constructor(e){wk(this,"name","solana"),wk(this,"client"),wk(this,"httpProviders"),wk(this,"events"),wk(this,"namespace"),wk(this,"chainId"),this.namespace=e.namespace,this.events=wf("events"),this.client=wf("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(yW,`${this.name}:${e}`)}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]}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(){let e={};return this.namespace.chains.forEach(t=>{var r;let i=wo(t);e[i]=this.createHttpProvider(i,null==(r=this.namespace.rpcMap)?void 0:r[t])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||ws(e,this.namespace,this.client.core.projectId);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new a$(new yB(r,wf("disableProviderPing")))}}var wM=Object.defineProperty,wU=(e,t,r)=>t in e?wM(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,wL=(e,t,r)=>wU(e,"symbol"!=typeof t?t+"":t,r);class wB{constructor(e){wL(this,"name","cosmos"),wL(this,"client"),wL(this,"httpProviders"),wL(this,"events"),wL(this,"namespace"),wL(this,"chainId"),this.namespace=e.namespace,this.events=wf("events"),this.client=wf("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}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]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(yW,`${this.name}:${this.chainId}`)}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(){let e={};return this.namespace.chains.forEach(t=>{var r;let i=wo(t);e[i]=this.createHttpProvider(i,null==(r=this.namespace.rpcMap)?void 0:r[t])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||ws(e,this.namespace,this.client.core.projectId);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new a$(new yB(r,wf("disableProviderPing")))}}var wj=Object.defineProperty,w$=(e,t,r)=>t in e?wj(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,wF=(e,t,r)=>w$(e,"symbol"!=typeof t?t+"":t,r);class wq{constructor(e){wF(this,"name","algorand"),wF(this,"client"),wF(this,"httpProviders"),wF(this,"events"),wF(this,"namespace"),wF(this,"chainId"),this.namespace=e.namespace,this.events=wf("events"),this.client=wf("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(!this.httpProviders[e]){let r=t||ws(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,r)}this.chainId=e,this.events.emit(yW,`${this.name}:${this.chainId}`)}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]}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(){let e={};return this.namespace.chains.forEach(t=>{var r;e[t]=this.createHttpProvider(t,null==(r=this.namespace.rpcMap)?void 0:r[t])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||ws(e,this.namespace,this.client.core.projectId);return typeof r>"u"?void 0:new a$(new yB(r,wf("disableProviderPing")))}}var wz=Object.defineProperty,wH=(e,t,r)=>t in e?wz(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,wW=(e,t,r)=>wH(e,"symbol"!=typeof t?t+"":t,r);class wV{constructor(e){wW(this,"name","cip34"),wW(this,"client"),wW(this,"httpProviders"),wW(this,"events"),wW(this,"namespace"),wW(this,"chainId"),this.namespace=e.namespace,this.events=wf("events"),this.client=wf("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}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]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(yW,`${this.name}:${this.chainId}`)}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(){let e={};return this.namespace.chains.forEach(t=>{let r=this.getCardanoRPCUrl(t),i=wo(t);e[i]=this.createHttpProvider(i,r)}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}getCardanoRPCUrl(e){let t=this.namespace.rpcMap;if(t)return t[e]}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||this.getCardanoRPCUrl(e);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new a$(new yB(r,wf("disableProviderPing")))}}var wK=Object.defineProperty,wZ=(e,t,r)=>t in e?wK(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,wG=(e,t,r)=>wZ(e,"symbol"!=typeof t?t+"":t,r);class wY{constructor(e){wG(this,"name","elrond"),wG(this,"client"),wG(this,"httpProviders"),wG(this,"events"),wG(this,"namespace"),wG(this,"chainId"),this.namespace=e.namespace,this.events=wf("events"),this.client=wf("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(yW,`${this.name}:${e}`)}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]}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(){let e={};return this.namespace.chains.forEach(t=>{var r;let i=wo(t);e[i]=this.createHttpProvider(i,null==(r=this.namespace.rpcMap)?void 0:r[t])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||ws(e,this.namespace,this.client.core.projectId);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new a$(new yB(r,wf("disableProviderPing")))}}var wJ=Object.defineProperty,wX=(e,t,r)=>t in e?wJ(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,wQ=(e,t,r)=>wX(e,"symbol"!=typeof t?t+"":t,r);class w0{constructor(e){wQ(this,"name","multiversx"),wQ(this,"client"),wQ(this,"httpProviders"),wQ(this,"events"),wQ(this,"namespace"),wQ(this,"chainId"),this.namespace=e.namespace,this.events=wf("events"),this.client=wf("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){this.httpProviders[e]||this.setHttpProvider(e,t),this.chainId=e,this.events.emit(yW,`${this.name}:${e}`)}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]}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(){let e={};return this.namespace.chains.forEach(t=>{var r;let i=wo(t);e[i]=this.createHttpProvider(i,null==(r=this.namespace.rpcMap)?void 0:r[t])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||ws(e,this.namespace,this.client.core.projectId);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new a$(new yB(r,wf("disableProviderPing")))}}var w1=Object.defineProperty,w2=(e,t,r)=>t in e?w1(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,w3=(e,t,r)=>w2(e,"symbol"!=typeof t?t+"":t,r);class w5{constructor(e){w3(this,"name","near"),w3(this,"client"),w3(this,"httpProviders"),w3(this,"events"),w3(this,"namespace"),w3(this,"chainId"),this.namespace=e.namespace,this.events=wf("events"),this.client=wf("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}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]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(this.chainId=e,!this.httpProviders[e]){let r=t||ws(`${this.name}:${e}`,this.namespace);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,r)}this.events.emit(yW,`${this.name}:${this.chainId}`)}getAccounts(){let e=this.namespace.accounts;return e&&e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{var r;e[t]=this.createHttpProvider(t,null==(r=this.namespace.rpcMap)?void 0:r[t])}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||ws(e,this.namespace);return typeof r>"u"?void 0:new a$(new yB(r,wf("disableProviderPing")))}}var w8=Object.defineProperty,w6=(e,t,r)=>t in e?w8(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,w4=(e,t,r)=>w6(e,"symbol"!=typeof t?t+"":t,r);class w9{constructor(e){w4(this,"name","tezos"),w4(this,"client"),w4(this,"httpProviders"),w4(this,"events"),w4(this,"namespace"),w4(this,"chainId"),this.namespace=e.namespace,this.events=wf("events"),this.client=wf("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}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]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,t){if(this.chainId=e,!this.httpProviders[e]){let r=t||ws(`${this.name}:${e}`,this.namespace);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,r)}this.events.emit(yW,`${this.name}:${this.chainId}`)}getAccounts(){let e=this.namespace.accounts;return e&&e.filter(e=>e.split(":")[1]===this.chainId.toString()).map(e=>e.split(":")[2])||[]}createHttpProviders(){let e={};return this.namespace.chains.forEach(t=>{e[t]=this.createHttpProvider(t)}),e}getHttpProvider(){let e=`${this.name}:${this.chainId}`,t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||ws(e,this.namespace);return typeof r>"u"?void 0:new a$(new yB(r))}}var w7=Object.defineProperty,be=(e,t,r)=>t in e?w7(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,bt=(e,t,r)=>be(e,"symbol"!=typeof t?t+"":t,r);
908class br{constructor(e){bt(this,"name",yz),bt(this,"client"),bt(this,"httpProviders"),bt(this,"events"),bt(this,"namespace"),bt(this,"chainId"),this.namespace=e.namespace,this.events=wf("events"),this.client=wf("client"),this.chainId=this.getDefaultChain(),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),this.chainId=e,this.events.emit(yW,`${this.name}:${e}`)}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]}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=>{let t=ga(e);r[`${t.namespace}:${t.reference}`]=this.createHttpProvider(e)}),r}getHttpProvider(e){let t=this.httpProviders[e];if(typeof t>"u")throw Error(`JSON-RPC provider for ${e} not found`);return t}setHttpProvider(e,t){let r=this.createHttpProvider(e,t);r&&(this.httpProviders[e]=r)}createHttpProvider(e,t){let r=t||ws(e,this.namespace,this.client.core.projectId);if(!r)throw Error(`No RPC url provided for chainId: ${e}`);return new a$(new yB(r,wf("disableProviderPing")))}}var bi=Object.defineProperty,bn=Object.defineProperties,bs=Object.getOwnPropertyDescriptors,bo=Object.getOwnPropertySymbols,ba=Object.prototype.hasOwnProperty,bc=Object.prototype.propertyIsEnumerable,bl=(e,t,r)=>t in e?bi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,bu=(e,t)=>{for(var r in t||(t={}))ba.call(t,r)&&bl(e,r,t[r]);if(bo)for(var r of bo(t))bc.call(t,r)&&bl(e,r,t[r]);return e},bh=(e,t)=>bn(e,bs(t)),bd=(e,t,r)=>bl(e,"symbol"!=typeof t?t+"":t,r);class bp{constructor(e){bd(this,"client"),bd(this,"namespaces"),bd(this,"optionalNamespaces"),bd(this,"sessionProperties"),bd(this,"scopedProperties"),bd(this,"events",new(N())),bd(this,"rpcProviders",{}),bd(this,"session"),bd(this,"providerOpts"),bd(this,"logger"),bd(this,"uri"),bd(this,"disableProviderPing",!1),this.providerOpts=e,this.logger="u">typeof e?.logger&&"string"!=typeof e?.logger?e.logger:(0,ec.gw)((0,ec.jI)({level:e?.logger||y$})),this.disableProviderPing=e?.disableProviderPing||!1}static async init(e){let t=new bp(e);return await t.initialize(),t}async request(e,t,r){let[i,n]=this.validateChain(t);if(!this.session)throw Error("Please call connect() before request()");return await this.getProvider(i).request({request:bu({},e),chainId:`${i}:${n}`,topic:this.session.topic,expiry:r})}sendAsync(e,t,r,i){let n=new Date().getTime();this.request(e,r,i).then(e=>t(null,aN(n,e))).catch(e=>t(e,void 0))}async enable(){if(!this.client)throw Error("Sign Client not initialized");return 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:yA("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw Error("Sign Client not initialized");if(this.setNamespaces(e),await 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:i}=await this.client.authenticate(e,t);r&&(this.uri=r,this.events.emit("display_uri",r));let n=await i();if(this.session=n.session,this.session){let e=wh(this.session.namespaces);this.namespaces=wc(this.namespaces,e),await this.persist("namespaces",this.namespaces),this.onConnect()}return n}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 i=await r();this.session=i;let n=wh(i.namespaces);return this.namespaces=wc(this.namespaces,n),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,i]=this.validateChain(e),n=this.getProvider(r);n.name===yz?n.setDefaultChain(`${r}:${i}`,t):n.setDefaultChain(i,t)}catch(e){if(!/Please call connect/.test(e.message))throw e}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");let t=this.client.pairing.getAll();if(yI(t)){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}`)}}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 go.init({core:this.providerOpts.core,logger:this.providerOpts.logger||y$,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("Failed to get session",r),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=>y_(e)))];wg("client",this.client),wg("events",this.events),wg("disableProviderPing",this.disableProviderPing),e.forEach(e
908=>{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 i=[];return r.forEach(e=>{let r=t.namespaces[e].accounts;i.push(...r)}),i}(e,this.session),r=wa(t),i=bh(bu({},wc(this.namespaces,this.optionalNamespaces)[e]),{accounts:t,chains:r});switch(e){case"eip155":this.rpcProviders[e]=new wT({namespace:i});break;case"algorand":this.rpcProviders[e]=new wq({namespace:i});break;case"solana":this.rpcProviders[e]=new wD({namespace:i});break;case"cosmos":this.rpcProviders[e]=new wB({namespace:i});break;case"polkadot":this.rpcProviders[e]=new wb({namespace:i});break;case"cip34":this.rpcProviders[e]=new wV({namespace:i});break;case"elrond":this.rpcProviders[e]=new wY({namespace:i});break;case"multiversx":this.rpcProviders[e]=new w0({namespace:i});break;case"near":this.rpcProviders[e]=new w5({namespace:i});break;case"tezos":this.rpcProviders[e]=new w9({namespace:i});break;default:this.rpcProviders[yz]?this.rpcProviders[yz].updateNamespace(i):this.rpcProviders[yz]=new br({namespace:i})}})}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:i}=e;if(i!==(null==(t=this.session)?void 0:t.topic))return;let{event:n}=r;if("accountsChanged"===n.name){let e=n.data;e&&yI(e)&&this.events.emit("accountsChanged",e.map(wu))}else if("chainChanged"===n.name){let e=r.chainId,t=r.event.data,i=y_(e),n=wd(e)!==wd(t)?`${i}:${wd(t)}`:e;this.onChainChanged(n)}else this.events.emit(n.name,n.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:t})=>{var r,i;if(e!==(null==(r=this.session)?void 0:r.topic))return;let{namespaces:n}=t,s=null==(i=this.client)?void 0:i.session.get(e);this.session=bh(bu({},s),{namespaces:n}),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",bh(bu({},yA("USER_DISCONNECTED")),{data:e.topic})))}),this.on(yW,e=>{this.onChainChanged(e,!0)})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[yz]}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:i,scopedProperties:n}=e;t&&Object.keys(t).length&&(this.namespaces=t),r&&Object.keys(r).length&&(this.optionalNamespaces=r),this.sessionProperties=i,this.scopedProperties=n}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=>y_(e)).includes(t))throw Error(`Namespace '${t}' is not configured. Please call connect() first with namespace config.`);if(t&&r)return[t,r];let i=y_(Object.keys(this.namespaces)[0]),n=this.rpcProviders[i].getDefaultChain();return[i,n]}async requestAccounts(){let[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}async onChainChanged(e,t=!1){if(!this.namespaces)return;let[r,i]=this.validateChain(e);if(!i)return;this.updateNamespaceChain(r,i),this.events.emit("chainChanged",i);let n=this.getProvider(r).getDefaultChain();t||this.getProvider(r).setDefaultChain(i),this.emitAccountsChangedOnChainChange({namespace:r,previousChainId:n,newChainId:e}),await this.persist("namespaces",this.namespaces)}emitAccountsChangedOnChainChange({namespace:e,previousChainId:t,newChainId:r}){var i,n;try{if(t===r)return;let s=null==(n=null==(i=this.session)?void 0:i.namespaces[e])?void 0:n.accounts;if(!s)return;let o=s.filter(e=>e.includes(`${r}:`)).map(wu);if(!yI(o))return;this.events.emit("accountsChanged",o)}catch(e){this.logger.warn("Failed to emit accountsChanged on chain change",e)}}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,await this.cleanupPendingPairings({deletePairings:!0}),await this.cleanupStorage()}async persist(e,t){var r;let i=(null==(r=this.session)?void 0:r.topic)||"";await this.client.core.storage.setItem(`${yF}/${e}${i}`,t)}async getFromStore(e){var t;let r=(null==(t=this.session)?void 0:t.topic)||"";return await this.client.core.storage.getItem(`${yF}/${e}${r}`)}async deleteFromStore(e){var t;let r=(null==(t=this.session)?void 0:t.topic)||"";await this.client.core.storage.removeItem(`${yF}/${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(yF)&&await this.client.core.storage.removeItem(e)}catch(e){this.logger.warn("Failed to cleanup storage",e)}}}},76454:function(e,t){"use strict";function r(e){let t;return"undefined"!=typeof window&&void 0!==window[e]&&(t=window[e]),t}function i(e){let t=r(e);if(!t)throw Error(`${e} is not defined in Window`);return t}
908Object.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=i,t.getDocumentOrThrow=function(){return i("document")},t.getDocument=function(){return r("document")},t.getNavigatorOrThrow=function(){return i("navigator")},t.getNavigator=function(){return r("navigator")},t.getLocationOrThrow=function(){return i("location")},t.getLocation=function(){return r("location")},t.getCryptoOrThrow=function(){return i("crypto")},t.getCrypto=function(){return r("crypto")},t.getLocalStorageOrThrow=function(){return i("localStorage")},t.getLocalStorage=function(){return r("localStorage")}},3897:function(e,t,r){"use strict";t.D=void 0;let i=r(76454);t.D=function(){let e,t,r;try{e=i.getDocumentOrThrow(),t=i.getLocationOrThrow()}catch(e){return null}function n(...t){let r=e.getElementsByTagName("meta");for(let e=0;e<r.length;e++){let i=r[e],n=["itemprop","property","name"].map(e=>i.getAttribute(e)).filter(e=>!!e&&t.includes(e));if(n.length&&n){let e=i.getAttribute("content");if(e)return e}}return""}let s=((r=n("name","og:site_name","og:title","twitter:title"))||(r=e.title),r),o=n("description","og:description","twitter:description","keywords");return{description:o,url:t.origin,icons:function(){let r=e.getElementsByTagName("link"),i=[];for(let e=0;e<r.length;e++){let n=r[e],s=n.getAttribute("rel");if(s&&s.toLowerCase().indexOf("icon")>-1){let e=n.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 i=t.pathname.split("/");i.pop(),r+=i.join("/")+"/"+e}i.push(r)}else if(0===e.indexOf("//")){let r=t.protocol+e;i.push(r)}else i.push(e)}}}return i}(),name:s}}},40908:function(e,t,r){var i;i=function(){"use strict";var e="undefined"!=typeof window?window:void 0!==r.g?r.g:"undefined"!=typeof self?self:{},t="Expected a function",i=NaN,n=/^\s+|\s+$/g,s=/^[-+]0x[0-9a-f]+$/i,o=/^0b[01]+$/i,a=/^0o[0-7]+$/i,c=parseInt,l="object"==typeof e&&e&&e.Object===Object&&e,u="object"==typeof self&&self&&self.Object===Object&&self,h=l||u||Function("return this")(),d=Object.prototype.toString,p=Math.max,f=Math.min,g=function(){return h.Date.now()};function m(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function y(e){if("number"==typeof e)return e;if("symbol"==typeof(t=e)||t&&"object"==typeof t&&"[object Symbol]"==d.call(t))return i;if(m(e)){var t,r="function"==typeof e.valueOf?e.valueOf():e;e=m(r)?r+"":r}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(n,"");var l=o.test(e);return l||a.test(e)?c(e.slice(2),l?2:8):s.test(e)?i:+e}var w=function(e,r,i){var n=!0,s=!0;if("function"!=typeof e)throw TypeError(t);return m(i)&&(n="leading"in i?!!i.leading:n,s="trailing"in i?!!i.trailing:s),function(e,r,i){var n,s,o,a,c,l,u=0,h=!1,d=!1,w=!0;if("function"!=typeof e)throw TypeError(t);function b(t){var r=n,i=s;return n=s=void 0,u=t,a=e.apply(i,r)}function v(e){var t=e-l;return void 0===l||t>=r||t<0||d&&e-u>=o}function E(){var e,t=g();if(v(t))return _(t);c=setTimeout(E,(e=r-(t-l),d?f(e,o-(t-u)):e))}function _(e){return c=void 0,w&&n?b(e):(n=s=void 0,a)}function C(){var e,t=g(),i=v(t);if(n=arguments,s=this,l=t,i){if(void 0===c)return u=e=l,c=setTimeout(E,r),h?b(e):a;if(d)return c=setTimeout(E,r),b(l)}return void 0===c&&(c=setTimeout(E,r)),a}return r=y(r)||0,m(i)&&(h=!!i.leading,o=(d="maxWait"in i)?p(y(i.maxWait)||0,r):o,w="trailing"in i?!!i.trailing:w),C.cancel=function(){void 0!==c&&clearTimeout(c),u=0,n=l=s=c=void 0},C.flush=function(){return void 0===c?a:_(g())},C}(e,r,{leading:n,maxWait:r,trailing:s})},b=NaN,v=/^\s+|\s+$/g,E=/^[-+]0x[0-9a-f]+$/i,_=/^0b[01]+$/i,C=/^0o[0-7]+$/i,A=parseInt,I="object"==typeof e&&e&&e.Object===Object&&e,S="object"==typeof self&&self&&self.Object===Object&&self,N=I||S||Function("return this")(),O=Object.prototype.toString,x=Math.max,T=Math.min,R=function(){return N.Date.now()};function P(e){var t=typeof e;return!!e&&("object"==t||"function"==t)}function k(e){if("number"==typeof e)return e;if("symbol"==typeof(t=e)||t&&"object"==typeof t&&"[object Symbol]"==O.call(t))return b;if(P(e)){var t,r="function"==typeof e.valueOf?e.valueOf():e;e=P(r)?r+"":r}if("string"!=typeof e)return 0===e?e:+e;e=e.replace(v,"");var i=_.test(e);return i||C.test(e)?A(e.slice(2),i?2:8):E.test(e)?b:+e}var D=function(e,t,r){var i,n,s,o,a,c,l=0,u=!1,h=!1,d=!0;if("function"!=typeof e)throw TypeError("Expected a function");function p(t){var r=i,s=n;return i=n=void 0,l=t,o=e.apply(s,r)}function f(e){var r=e-c;return void 0===c||r>=t||r<0||h&&e-l>=s}function g(){var e,r=R();if(f(r))return m(r);a=setTimeout(g,(e=t-(r-c),h?T(e,s-(r-l)):e))}function m(e){return a=void 0,d&&i?p(e):(i=n=void 0,o)}function y(){var e,r=R(),s=f(r);if(i=arguments,n=this,c=r,s){if(void 0===a)return l=e=c,a=setTimeout(g,t),u?p(e):o;if(h)return a=setTimeout(g,t),p(c)}return void 0===a&&(a=setTimeout(g,t)),o}return t=k(t)||0,P(r)&&(u=!!r.leading,s=(h="maxWait"in r)?x(k(r.maxWait)||0,t):s,d="trailing"in r?!!r.trailing:d),y.cancel=function(){void 0!==a&&clearTimeout(a),l=0,i=c=n=a=void 0},y.flush=function(){return void 0===a?o:m(R())},y},M=function(){};function U(e){e&&e.forEach(function(e){var t=Array.prototype.slice.call(e.addedNodes),r=Array.prototype.slice.call(e.removedNodes
908);if(function e(t){var r=void 0,i=void 0;for(r=0;r<t.length;r+=1)if((i=t[r]).dataset&&i.dataset.aos||i.children&&e(i.children))return!0;return!1}(t.concat(r)))return M()})}function L(){return window.MutationObserver||window.WebKitMutationObserver||window.MozMutationObserver}var B={isSupported:function(){return!!L()},ready:function(e,t){var r=window.document,i=new(L())(U);M=t,i.observe(r.documentElement,{childList:!0,subtree:!0,removedNodes:!0})}},j=function(e,t){if(!(e instanceof t))throw TypeError("Cannot call a class as a function")},$=function(){function e(e,t){for(var r=0;r<t.length;r++){var i=t[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}return function(t,r,i){return r&&e(t.prototype,r),i&&e(t,i),t}}(),F=Object.assign||function(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)Object.prototype.hasOwnProperty.call(r,i)&&(e[i]=r[i])}return e},q=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino/i,z=/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i,H=/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows ce|xda|xiino|android|ipad|playbook|silk/i,W=/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|
908sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|yas\-|your|zeto|zte\-/i;function V(){return navigator.userAgent||navigator.vendor||window.opera||""}var K=new(function(){function e(){j(this,e)}return $(e,[{key:"phone",value:function(){var e=V();return!(!q.test(e)&&!z.test(e.substr(0,4)))}},{key:"mobile",value:function(){var e=V();return!(!H.test(e)&&!W.test(e.substr(0,4)))}},{key:"tablet",value:function(){return this.mobile()&&!this.phone()}},{key:"ie11",value:function(){return"-ms-scroll-limit"in document.documentElement.style&&"-ms-ime-align"in document.documentElement.style}}]),e}()),Z=function(e,t){var r=void 0;return K.ie11()?(r=document.createEvent("CustomEvent")).initCustomEvent(e,!0,!0,{detail:t}):r=new CustomEvent(e,{detail:t}),document.dispatchEvent(r)},G=function(e){return e.forEach(function(e,t){var r,i,n,s,o,a;return r=window.pageYOffset,i=e.options,n=e.position,s=e.node,e.data,o=function(){var t;e.animated&&((t=i.animatedClassNames)&&t.forEach(function(e){return s.classList.remove(e)}),Z("aos:out",s),e.options.id&&Z("aos:in:"+e.options.id,s),e.animated=!1)},void(i.mirror&&r>=n.out&&!i.once?o():r>=n.in?e.animated||((a=i.animatedClassNames)&&a.forEach(function(e){return s.classList.add(e)}),Z("aos:in",s),e.options.id&&Z("aos:in:"+e.options.id,s),e.animated=!0):e.animated&&!i.once&&o())})},Y=function(e){for(var t=0,r=0;e&&!isNaN(e.offsetLeft)&&!isNaN(e.offsetTop);)t+=e.offsetLeft-("BODY"!=e.tagName?e.scrollLeft:0),r+=e.offsetTop-("BODY"!=e.tagName?e.scrollTop:0),e=e.offsetParent;return{top:r,left:t}},J=function(e,t,r){var i=e.getAttribute("data-aos-"+t);if(void 0!==i){if("true"===i)return!0;if("false"===i)return!1}return i||r},X=function(){var e=document.querySelectorAll("[data-aos]");return Array.prototype.map.call(e,function(e){return{node:e}})},Q=[],ee=!1,et={offset:120,delay:0,easing:"ease",duration:400,disable:!1,once:!1,mirror:!1,anchorPlacement:"top-bottom",startEvent:"DOMContentLoaded",animatedClassName:"aos-animate",initClassName:"aos-init",useClassNames:!1,disableMutationObserver:!1,throttleDelay:99,debounceDelay:50},er=function(){return document.all&&!window.atob},ei=function(){var e,t;arguments.length>0&&void 0!==arguments[0]&&arguments[0]&&(ee=!0),ee&&(e=Q,t=et,e.forEach(function(e,r){var i,n,s,o,a,c=J(e.node,"mirror",t.mirror),l=J(e.node,"once",t.once),u=J(e.node,"id"),h=t.useClassNames&&e.node.getAttribute("data-aos"),d=[t.animatedClassName].concat(h?h.split(" "):[]).filter(function(e){return"string"==typeof e});t.initClassName&&e.node.classList.add(t.initClassName),e.position={in:function(e,t,r){var i=window.innerHeight,n=J(e,"anchor"),s=J(e,"anchor-placement"),o=Number(J(e,"offset",s?0:t)),a=e;n&&document.querySelectorAll(n)&&(a=document.querySelectorAll(n)[0]);var c=Y(a).top-i;switch(s||r){case"top-bottom":break;case"center-bottom":c+=a.offsetHeight/2;break;case"bottom-bottom":c+=a.offsetHeight;break;case"top-center":c+=i/2;break;case"center-center":c+=i/2+a.offsetHeight/2;break;case"bottom-center":c+=i/2+a.offsetHeight;break;case"top-top":c+=i;break;case"bottom-top":c+=i+a.offsetHeight;break;case"center-top":c+=i+a.offsetHeight/2}return c+o}(e.node,t.offset,t.anchorPlacement),out:c&&(i=e.node,n=t.offset,window.innerHeight,s=J(i,"anchor"),o=J(i,"offset",n),a=i,s&&document.querySelectorAll(s)&&(a=document.querySelectorAll(s)[0]),Y(a).top+a.offsetHeight-o)},e.options={once:l,mirror:c,animatedClassNames:d,id:u}}),G(Q=e),window.addEventListener("scroll",w(function(){G(Q,et.once)},et.throttleDelay)))},en=function(){if(Q=X(),eo(et.disable)||er())return es();ei()},es=function(){Q.forEach(function(e,t){e.node.removeAttribute("data-aos"),e.node.removeAttribute("data-aos-easing"),e.node.removeAttribute("data-aos-duration"),e.node.removeAttribute("data-aos-delay"),et.initClassName&&e.node.classList.remove(et.initClassName),et.animatedClassName&&e.node.classList.remove(et.animatedClassName)})},eo=function(e){return!0===e||"mobile"===e&&K.mobile()||"phone"===e&&K.phone()||"tablet"===e&&K.tablet()||"function"==typeof e&&!0===e()};return{init:function(e){return et=F(et,e),Q=X(),et.disableMutationObserver||B.isSupported()||(console.info('\n      aos: MutationObserver is not supported on this browser,\n      code mutations observing has been disabled.\n      You may have to call "refreshHard()" by yourself.\n    '),et.disableMutationObserver=!0),et.disableMutationObserver||B.ready("[data-aos]",en),eo(et.disable)||er()?es():(document.querySelector("body").setAttribute("data-aos-easing",et.easing),document.querySelector("body").setAttribute("data-aos-duration",et.duration),document.querySelector("body").setAttribute("data-aos-delay",et.delay),-1===["DOMContentLoaded","load"].indexOf(et.startEvent)?document.addEventListener(et.startEvent,function(){ei(!0)}):window.addEventListener("load",function(){ei(!0)}
908),"DOMContentLoaded"===et.startEvent&&["complete","interactive"].indexOf(document.readyState)>-1&&ei(!0),window.addEventListener("resize",D(ei,et.debounceDelay,!0)),window.addEventListener("orientationchange",D(ei,et.debounceDelay,!0)),Q)},refresh:ei,refreshHard:en}},e.exports=i()},21089:function(e,t,r){"use strict";var i=r(82957).Buffer;t.oU=function(e){{let t=i.from(e);t.reverse();let r=t.toString("hex");return 0===r.length?BigInt(0):BigInt(`0x${r}`)}},t.k$=function(e,t){{let r=e.toString(16),n=i.from(r.padStart(2*t,"0").slice(0,2*t),"hex");return n.reverse(),n}}},44373:function(e,t,r){!function(e,t){"use strict";function i(e,t){if(!e)throw Error(t||"Assertion failed")}function n(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"))}"object"==typeof e?e.exports=s:t.BN=s,s.BN=s,s.wordSize=26;try{h="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 i(!1,"Invalid character in "+e)}function a(e,t,r){var i=o(e,r);return r-1>=t&&(i|=o(e,r-1)<<4),i}function c(e,t,r,n){for(var s=0,o=0,a=Math.min(e.length,r),c=t;c<a;c++){var l=e.charCodeAt(c)-48;s*=n,o=l>=49?l-49+10:l>=17?l-17+10:l,i(l>=0&&o<n,"Invalid character"),s+=o}return s}function l(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),i(t===(0|t)&&t>=2&&t<=36);var n=0;"-"===(e=e.toString().replace(/\s+/g,""))[0]&&(n++,this.negative=1),n<e.length&&(16===t?this._parseHex(e,n,r):(this._parseBase(e,t,n),"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):(i(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(i("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 n,s,o=0;o<this.length;o++)this.words[o]=0;var a=0;if("be"===r)for(o=e.length-1,n=0;o>=0;o-=3)s=e[o]|e[o-1]<<8|e[o-2]<<16,this.words[n]|=s<<a&67108863,this.words[n+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);else if("le"===r)for(o=0,n=0;o<e.length;o+=3)s=e[o]|e[o+1]<<8|e[o+2]<<16,this.words[n]|=s<<a&67108863,this.words[n+1]=s>>>26-a&67108863,(a+=24)>=26&&(a-=26,n++);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 i,n=0;n<this.length;n++)this.words[n]=0;var s=0,o=0;if("be"===r)for(n=e.length-1;n>=t;n-=2)i=a(e,t,n)<<s,this.words[o]|=67108863&i,s>=18?(s-=18,o+=1,this.words[o]|=i>>>26):s+=8;else for(n=(e.length-t)%2==0?t+1:t;n<e.length;n+=2)i=a(e,t,n)<<s,this.words[o]|=67108863&i,s>=18?(s-=18,o+=1,this.words[o]|=i>>>26):s+=8;this._strip()},s.prototype._parseBase=function(e,t,r){this.words=[0],this.length=1;for(var i=0,n=1;n<=67108863;n*=t)i++;i--,n=n/t|0;for(var s=e.length-r,o=s%i,a=Math.min(s,s-o)+r,l=0,u=r;u<a;u+=i)l=c(e,u,u+i,t),this.imuln(n),this.words[0]+l<67108864?this.words[0]+=l:this._iaddn(l);if(0!==o){var h=1;for(l=c(e,u,e.length,t),u=0;u<o;u++)h*=t;this.imuln(h),this.words[0]+l<67108864?this.words[0]+=l:this._iaddn(l)}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){l(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 h,d=["","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"],p=[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],f=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16
vendor: 6,620 bytes, line 908
908777216,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 i=e.length+t.length|0;r.length=i,i=i-1|0;var n=0|e.words[0],s=0|t.words[0],o=n*s,a=67108863&o,c=o/67108864|0;r.words[0]=a;for(var l=1;l<i;l++){for(var u=c>>>26,h=67108863&c,d=Math.min(l,t.length-1),p=Math.max(0,l-e.length+1);p<=d;p++){var f=l-p|0;u+=(o=(n=0|e.words[f])*(s=0|t.words[p])+h)/67108864|0,h=67108863&o}r.words[l]=0|h,c=0|u}return 0!==c?r.words[l]=0|c: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,n=0,s=0,o=0;o<this.length;o++){var a=this.words[o],c=((a<<n|s)&16777215).toString(16);s=a>>>24-n&16777215,(n+=2)>=26&&(n-=26,o--),r=0!==s||o!==this.length-1?d[6-c.length]+c+r:c+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 l=p[e],u=f[e];r="";var h=this.clone();for(h.negative=0;!h.isZero();){var g=h.modrn(u).toString(e);r=(h=h.idivn(u)).isZero()?g+r:d[l-g.length]+g+r}for(this.isZero()&&(r="0"+r);r.length%t!=0;)r="0"+r;return 0!==this.negative&&(r="-"+r),r}i(!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&&i(!1,"Number can only safely store up to 53 bits"),0!==this.negative?-e:e},s.prototype.toJSON=function(){return this.toString(16,2)},h&&(s.prototype.toBuffer=function(e,t){return this.toArrayLike(h,e,t)}),s.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},s.prototype.toArrayLike=function(e,t,r){this._strip();var n=this.byteLength(),s=r||Math.max(1,n);i(n<=s,"byte array longer than desired length"),i(s>0,"Requested array length <= 0");var o=e.allocUnsafe?e.allocUnsafe(s):new e(s);return this["_toArrayLike"+("le"===t?"LE":"BE")](o,n),o},s.prototype._toArrayLikeLE=function(e,t){for(var r=0,i=0,n=0,s=0;n<this.length;n++){var o=this.words[n]<<s|i;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),i=0,s=0):(i=o>>>24,s+=2)}if(r<e.length)for(e[r++]=i;r<e.length;)e[r++]=0},s.prototype._toArrayLikeBE=function(e,t){for(var r=e.length-1,i=0,n=0,s=0;n<this.length;n++){var o=this.words[n]<<s|i;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),i=0,s=0):(i=o>>>24,s+=2)}if(r>=0)for(e[r--]=i;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 i((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 i((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,i=0;i<r.length;i++)this.words[i]=t.words[i]^r.words[i];if(this!==t)for(;i<t.length;i++)this.words[i]=t.words[i];return this.length=t.length,this._strip()},s.prototype.ixor=function(e){return i((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){i("number"==typeof e&&e>=0);var t=0|Math.ceil(e/26),r=e%26;this._expand(t),r>0&&t--;for(var n=0;n<t;n++)this.words[n]=67108863&~this.words[n];return r>0&&(this.words[n]=~this.words[n]&67108863>>26-r),this._strip()},s.prototype.notn=function(e){return this.clone().inotn(e)},s.prototype.setn=function(e,t){i("number"==typeof e&&e>=0);var r=e/26|0,n=e%26;return this._expand(r+1),t?this.words[r]=this.words[r]|1<<n:this.words[r]=this.words[r]&~(1<<n),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,i=e):(r=e,i=this);for(var t,r,i,n=0,s=0;s<i.length;s++)t=(0|r.words[s])+(0|i.words[s])+n,this.words[s]=67108863&t,n=t>>>26;for(;0!==n&&s<r.length;s++)t=(0|r.words[s])+n,this.words[s]=67108863&t,n=t>>>26;if(this.length=r.length,0!==n)this.words[this.length]=n,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;
vendor: 10,964 bytes, line 908
908var t,r,i=this.iadd(e);return e.negative=1,i._normSign()}if(0!==this.negative)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var n=this.cmp(e);if(0===n)return this.negative=0,this.length=1,this.words[0]=0,this;n>0?(t=this,r=e):(t=e,r=this);for(var s=0,o=0;o<r.length;o++)s=(i=(0|t.words[o])-(0|r.words[o])+s)>>26,this.words[o]=67108863&i;for(;0!==s&&o<t.length;o++)s=(i=(0|t.words[o])+s)>>26,this.words[o]=67108863&i;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 m=function(e,t,r){var i,n,s,o=e.words,a=t.words,c=r.words,l=0,u=0|o[0],h=8191&u,d=u>>>13,p=0|o[1],f=8191&p,g=p>>>13,m=0|o[2],y=8191&m,w=m>>>13,b=0|o[3],v=8191&b,E=b>>>13,_=0|o[4],C=8191&_,A=_>>>13,I=0|o[5],S=8191&I,N=I>>>13,O=0|o[6],x=8191&O,T=O>>>13,R=0|o[7],P=8191&R,k=R>>>13,D=0|o[8],M=8191&D,U=D>>>13,L=0|o[9],B=8191&L,j=L>>>13,$=0|a[0],F=8191&$,q=$>>>13,z=0|a[1],H=8191&z,W=z>>>13,V=0|a[2],K=8191&V,Z=V>>>13,G=0|a[3],Y=8191&G,J=G>>>13,X=0|a[4],Q=8191&X,ee=X>>>13,et=0|a[5],er=8191&et,ei=et>>>13,en=0|a[6],es=8191&en,eo=en>>>13,ea=0|a[7],ec=8191&ea,el=ea>>>13,eu=0|a[8],eh=8191&eu,ed=eu>>>13,ep=0|a[9],ef=8191&ep,eg=ep>>>13;r.negative=e.negative^t.negative,r.length=19;var em=(l+(i=Math.imul(h,F))|0)+((8191&(n=(n=Math.imul(h,q))+Math.imul(d,F)|0))<<13)|0;l=((s=Math.imul(d,q))+(n>>>13)|0)+(em>>>26)|0,em&=67108863,i=Math.imul(f,F),n=(n=Math.imul(f,q))+Math.imul(g,F)|0,s=Math.imul(g,q);var ey=(l+(i=i+Math.imul(h,H)|0)|0)+((8191&(n=(n=n+Math.imul(h,W)|0)+Math.imul(d,H)|0))<<13)|0;l=((s=s+Math.imul(d,W)|0)+(n>>>13)|0)+(ey>>>26)|0,ey&=67108863,i=Math.imul(y,F),n=(n=Math.imul(y,q))+Math.imul(w,F)|0,s=Math.imul(w,q),i=i+Math.imul(f,H)|0,n=(n=n+Math.imul(f,W)|0)+Math.imul(g,H)|0,s=s+Math.imul(g,W)|0;var ew=(l+(i=i+Math.imul(h,K)|0)|0)+((8191&(n=(n=n+Math.imul(h,Z)|0)+Math.imul(d,K)|0))<<13)|0;l=((s=s+Math.imul(d,Z)|0)+(n>>>13)|0)+(ew>>>26)|0,ew&=67108863,i=Math.imul(v,F),n=(n=Math.imul(v,q))+Math.imul(E,F)|0,s=Math.imul(E,q),i=i+Math.imul(y,H)|0,n=(n=n+Math.imul(y,W)|0)+Math.imul(w,H)|0,s=s+Math.imul(w,W)|0,i=i+Math.imul(f,K)|0,n=(n=n+Math.imul(f,Z)|0)+Math.imul(g,K)|0,s=s+Math.imul(g,Z)|0;var eb=(l+(i=i+Math.imul(h,Y)|0)|0)+((8191&(n=(n=n+Math.imul(h,J)|0)+Math.imul(d,Y)|0))<<13)|0;l=((s=s+Math.imul(d,J)|0)+(n>>>13)|0)+(eb>>>26)|0,eb&=67108863,i=Math.imul(C,F),n=(n=Math.imul(C,q))+Math.imul(A,F)|0,s=Math.imul(A,q),i=i+Math.imul(v,H)|0,n=(n=n+Math.imul(v,W)|0)+Math.imul(E,H)|0,s=s+Math.imul(E,W)|0,i=i+Math.imul(y,K)|0,n=(n=n+Math.imul(y,Z)|0)+Math.imul(w,K)|0,s=s+Math.imul(w,Z)|0,i=i+Math.imul(f,Y)|0,n=(n=n+Math.imul(f,J)|0)+Math.imul(g,Y)|0,s=s+Math.imul(g,J)|0;var ev=(l+(i=i+Math.imul(h,Q)|0)|0)+((8191&(n=(n=n+Math.imul(h,ee)|0)+Math.imul(d,Q)|0))<<13)|0;l=((s=s+Math.imul(d,ee)|0)+(n>>>13)|0)+(ev>>>26)|0,ev&=67108863,i=Math.imul(S,F),n=(n=Math.imul(S,q))+Math.imul(N,F)|0,s=Math.imul(N,q),i=i+Math.imul(C,H)|0,n=(n=n+Math.imul(C,W)|0)+Math.imul(A,H)|0,s=s+Math.imul(A,W)|0,i=i+Math.imul(v,K)|0,n=(n=n+Math.imul(v,Z)|0)+Math.imul(E,K)|0,s=s+Math.imul(E,Z)|0,i=i+Math.imul(y,Y)|0,n=(n=n+Math.imul(y,J)|0)+Math.imul(w,Y)|0,s=s+Math.imul(w,J)|0,i=i+Math.imul(f,Q)|0,n=(n=n+Math.imul(f,ee)|0)+Math.imul(g,Q)|0,s=s+Math.imul(g,ee)|0;var eE=(l+(i=i+Math.imul(h,er)|0)|0)+((8191&(n=(n=n+Math.imul(h,ei)|0)+Math.imul(d,er)|0))<<13)|0;l=((s=s+Math.imul(d,ei)|0)+(n>>>13)|0)+(eE>>>26)|0,eE&=67108863,i=Math.imul(x,F),n=(n=Math.imul(x,q))+Math.imul(T,F)|0,s=Math.imul(T,q),i=i+Math.imul(S,H)|0,n=(n=n+Math.imul(S,W)|0)+Math.imul(N,H)|0,s=s+Math.imul(N,W)|0,i=i+Math.imul(C,K)|0,n=(n=n+Math.imul(C,Z)|0)+Math.imul(A,K)|0,s=s+Math.imul(A,Z)|0,i=i+Math.imul(v,Y)|0,n=(n=n+Math.imul(v,J)|0)+Math.imul(E,Y)|0,s=s+Math.imul(E,J)|0,i=i+Math.imul(y,Q)|0,n=(n=n+Math.imul(y,ee)|0)+Math.imul(w,Q)|0,s=s+Math.imul(w,ee)|0,i=i+Math.imul(f,er)|0,n=(n=n+Math.imul(f,ei)|0)+Math.imul(g,er)|0,s=s+Math.imul(g,ei)|0;var e_=(l+(i=i+Math.imul(h,es)|0)|0)+((8191&(n=(n=n+Math.imul(h,eo)|0)+Math.imul(d,es)|0))<<13)|0;l=((s=s+Math.imul(d,eo)|0)+(n>>>13)|0)+(e_>>>26)|0,e_&=67108863,i=Math.imul(P,F),n=(n=Math.imul(P,q))+Math.imul(k,F)|0,s=Math.imul(k,q),i=i+Math.imul(x,H)|0,n=(n=n+Math.imul(x,W)|0)+Math.imul(T,H)|0,s=s+Math.imul(T,W)|0,i=i+Math.imul(S,K)|0,n=(n=n+Math.imul(S,Z)|0)+Math.imul(N,K)|0,s=s+Math.imul(N,Z)|0,i=i+Math.imul(C,Y)|0,n=(n=n+Math.imul(C,J)|0)+Math.imul(A,Y)|0,s=s+Math.imul(A,J)|0,i=i+Math.imul(v,Q)|0,n=(n=n+Math.imul(v,ee)|0)+Math.imul(E,Q)|0,s=s+Math.imul(E,ee)|0,i=i+Math.imul(y,er)|0,n=(n=n+Math.imul(y,ei)|0)+Math.imul(w,er)|0,s=s+Math.imul(w,ei)|0,i=i+Math.imul(f,es)|0,n=(n=n+Math.imul(f,eo)|0)+Math.imul(g,es)|0,s=s+Math.imul(g,eo)|0;var eC=(l+(i=i+Math.imul(h,ec)|0)|0)+((8191&(n=(n=n+Math.imul(h,el)|0)+Math.imul(d,ec)|0))<<13)|0;l=((s=s+Math.imul(d,el)|0)+(n>>>13)|0)+(eC>>>26)|0,eC&=67108863,i=Math.imul(M,F),n=(n=Math.imul(M,q))+Math.imul(U,F)|0,s=Math.imul(U,q),i=i+Math.imul(P,H)|0,n=(n=n+Math.imul(P,W)|0)+Math.imul(k,H)|0,s=s+Math.imul(k,W)|0,i=i+Math.imul(x,K)|0,n=(n=n+Math.imul(x,Z)|0)+Math.imul(T,K)|0,s=s+Math.imul(T,Z)|0,i=i+Math.imul(S,Y)|0,n=(n=n+Math.imul(S,J)|0)+Math.imul(N,Y)|0,s=s+Math.imul(N,J)|0,i=i+Math.imul(C,Q)|0,n=(n=n+Math.imul(C,ee)|0)+Math.imul(A,Q)|0,s=s+Math.imul(A,ee)|0,i=i+Math.imul(v,er)|0,n=(n=n+Math.imul(v,ei)|0)+Math.imul(E,er)|0,s=s+Math.imul(E,ei)|0,i=i+Math.imul(y,es)|0,n=(n=n+Math.imul(y,eo)|0)+Math.imul(w,es)|0,s=s+Math.imul(w,eo)|0,i=i+Math.imul(f,ec)|0,n=(n=n+Math.imul(f,el)|0)+Math.imul(g,ec)|0,s=s+Math.imul(g,el)|0;var eA=(l+(i=i+Math.imul(h,eh)|0)|0)+((8191&(n=(n=n+Math.imul(h,ed)|0)+Math.imul(d,eh)|0))<<13)|0;l=((s=s+Math.imul(d,ed)|0)+(n>>>13)|0)+(eA>>>26)|0,eA&=67108863,i=Math.imul(B,F),n=(n=Math.imul(B,q))+Math.imul(j,F)|0,s=Math.imul(j,q),i=i+Math.imul(M,H)|0,n=(n=n+Math.imul(M,W)|0)+Math.imul(U,H)|0,s=s+Math.imul(U,W)|0,i=i+Math.imul(P,K)|0,n=(n=n+Math.imul(P,Z)|0)+Math.imul(k,K)|0,s=s+Math.imul(k,Z)|0,i=i+Math.imul(x,Y)|0,n=(n=n+Math.imul(x,J)|0)+Math.imul(T,Y)|0,s=s+Math.imul(T,J)|0,i=i+Math.imul(S,Q)|0,n=(n=n+Math.imul(S,ee)|0)+Math.imul(N,Q)|0,s=s+Math.imul(N,ee)|0,i=i+Math.imul(C,er)|0,n=(n=n+Math.imul(C,ei)|0)+Math.imul(A,er)|0,s=s+Math.imul(A,ei)|0,i=i+Math.imul(v,es)|0,n=(n=n+Math.imul(v,eo)|0)+Math.imul(E,es)|0,s=s+Math.imul(E,eo)|0,i=i+Math.imul(y,ec)|0,n=(n=n+Math.imul(y,el)|0)+Math.imul(w,ec)|0,s=s+Math.imul(w,el)|0,i=i+Math.imul(f,eh)|0,n=(n=n+Math.imul(f,ed)|0)+Math.imul(g,eh)|0,s=s+Math.imul(g,ed)|0;var eI=(l+(i=i+Math.imul(h,ef)|0)|0)+((8191&(n=(n=n+Math.imul(h,eg)|0)+Math.imul(d,ef)|0))<<13)|0;l=((s=s+Math.imul(d,eg)|0)+(n>>>13)|0)+(eI>>>26)|0,eI&=67108863,i=Math.imul(B,H),n=(n=Math.imul(B,W))+Math.imul(j,H)|0,s=Math.imul(j,W),i=i+Math.imul(M,K)|0,n=(n=n+Math.imul(M,Z)|0)+Math.imul(U,K)|0,s=s+Math.imul(U,Z)|0,i=i+Math.imul(P,Y)|0,n=(n=n+Math.imul(P,J)|0)+Math.imul(k,Y)|0,s=s+Math.imul(k,J)|0,i=i+Math.imul(x,Q)|0,n=(n=n+Math.imul(x,ee)|0)+Math.imul(T,Q)|0,s=s+Math.imul(T,ee)|0,i=i+Math.imul(S,er)|0,n=(n=n+Math.imul(S,ei)|0)+Math.imul(N,er)|0,s=s+Math.imul(N,ei)|0,i=i+Math.imul(C,es)|0,n=(n=n+Math.imul(C,eo)|0)+Math.imul(A,es)|0,s=s+Math.imul(A,eo)|0,i=i+Math.imul(v,ec)|0,n=(n=n+Math.imul(v,el)|0)+Math.imul(E,ec)|0,s=s+Math.imul(E,el)|0,i=i+Math.imul(y,eh)|0,n=(n=n+Math.imul(y,ed)|0)+Math.imul(w,eh)|0,s=s+Math.imul(w,ed)|0;var eS=(l+(i=i+Math.imul(f,ef)|0)|0)+((8191&(n=(n=n+Math.imul(f,eg)|0)+Math.imul(g,ef)|0))<<13)|0;l=((s=s+Math.imul(g,eg)|0)+(n>>>13)|0)+(eS>>>26)|0,eS&=67108863,i=Math.imul(B,K),n=(n=Math.imul(B,Z))+Math.imul(j,K)|0,s=Math.imul(j,Z),i=i+Math.imul(M,Y)|0,n=(n=n+Math.imul(M,J)|0)+Math.imul(U,Y)|0,s=s+Math.imul(U,J)|0,i=i+Math.imul(P,Q)|0,n=(n=n+Math.imul(P,ee)|0)+Math.imul(k,Q)|0,s=s+Math.imul(k,ee)|0,i=i+Math.imul(x,er)|0,n=(n=n+Math.imul(x,ei)|0)+Math.imul(T,er)|0,s=s+Math.imul(T,ei)|0,i=i+Math.imul(S,es)|0,n=(n=n+Math.imul(S,eo)|0)+Math.imul(N,es)|0,s=s+Math.imul(N,eo)|0,i=i+Math.imul(C,ec)|0,n=(n=n+Math.imul(C,el)|0)+Math.imul(A,ec)|0,s=s+Math.imul(A,el)|0,i=i+Math.imul(v,eh)|0,n=(n=n+Math.imul(v,ed)|0)+Math.imul(E,eh)|0,s=s+Math.imul(E,ed)|0;var eN=(l+(i=i+Math.imul(y,ef)|0)|0)+((8191&(n=(n=n+Math.imul(y,eg)|0)+Math.imul(w,ef)|0))<<13)|0;l=((s=s+Math.imul(w,eg)|0)+(n>>>13)|0)+(eN>>>26)|0,eN&=67108863,i=Math.imul(B,Y),n=(n=Math.imul(B,J))+Math.imul(j,Y)|0,s=Math.imul(j,J),i=i+Math.imul(M,Q)|0,n=(n=n+Math.imul(M,ee)|0)+Math.imul(U,Q)|0,s=s+Math.imul(U,ee)|0,i=i+Math.imul(P,er)|0,n=(n=n+Math.imul(P,ei)|0)+Math.imul(k,er)|0,s=s+Math.imul(k,ei)|0,i=i+Math.imul(x,es)|0,n=(n=n+Math.imul(x,eo)|0)+Math.imul(T,es)|0,s=s+Math.imul(T,eo)|0,i=i+Math.imul(S,ec)|0,n=(n=n+Math.imul(S,el)|0)+Math.imul(N,ec)|0,s=s+Math.imul(N,el)|0,i=i+Math.imul(C,eh)|0,n=(n=n+Math.imul(C,ed)|0)+Math.imul(A,eh)|0,s=s+Math.imul(A,ed)|0;var eO=(l+(i=i+Math.imul(v,ef)|0)|0)+((8191&(n=(n=n+Math.imul(v,eg)|0)+Math.imul(E,ef)|0))<<13)|0;l=((s=s+Math.imul(E,eg)|0)+(n>>>13)|0)+(eO>>>26)|0,eO&=67108863,i=Math.imul(B,Q),n=(n=Math.imul(B,ee))+Math.imul(j,Q)|0,s=Math.imul(j,ee),i=i+Math.imul(M,er)|0,n=(n=n+Math.imul(M,ei)|0)+Math.imul(U,er)|0,s=s+Math.imul(U,ei)|0,i=i+Math.imul(P,es)|0,n=(n=n+Math.imul(P,eo)|0)+Math.imul(k,es)|0,s=s+Math.imul(k,eo)|0,i=i+Math.imul(x,ec)|0,n=(n=n+Math.imul(x,el)|0)+Math.imul(T,ec)|0,s=s+Math.imul(T,el)|0,i=i+Math.imul(S,eh)|0,n=(n=n+Math.imul(S,ed)|0)+Math.imul(N,eh)|0,s=s+Math.imul(N,ed)|0;var ex=(l+(i=i+Math.imul(C,ef)|0)|0)+((8191&(n=(n=n+Math.imul(C,eg)|0)+Math.imul(A,ef)|0))<<13)|0;l=((s=s+Math.imul(A,eg)|0)+(n>>>13)|0)+(ex>>>26)|0,ex&=67108863,i=Math.imul(B,er),n=(n=Math.imul(B,ei))+Math.imul(j,er)|0,s=Math.imul(j,ei),i=i+Math.imul(M,es)|0,n=(n=n+Math.imul(M,eo)|0)+Math.imul(U,es)|0,s=s+Math.imul(U,eo)|0,i=i+Math.imul(P,ec)|0,n=(n=n+Math.imul(P,el)|0)+Math.imul(k,ec)|0,s=s+Math.imul(k,el)|0,i=i+Math.imul(x,eh)|0,n=(n=n+Math.imul(x,ed)|0)+Math.imul(T,eh)|0,s=s+Math.imul(T,ed)|0;var eT=(l+(i=i+Math.imul(S,ef)|0)|0)+((8191&(n=(n=n+Math.imul(S,eg)|0)+Math.imul(N,ef)|0))<<13)|0;l=((s=s+Math.imul(N,eg)|0)+(n>>>13)|0)+(eT>>>26)|0,eT&=67108863,i=Math.imul(B,es),n=(n=Math.imul(B,eo))+Math.imul(j,es)|0,s=Math.imul(j,eo),i=i+Math.imul(M,ec)|0,n=(n=n+Math.imul(M,el)|0)+Math.imul(U,ec)|0,s=s+Math.imul(U,el)|0,i=i+Math.imul(P,eh)|0,n=(n=n+Math.imul(P,ed)|0)+Math.imul(k,eh)|0,s=s+Math.imul(k,ed)|0;var eR=(l+(i=i+Math.imul(x,ef)|0)|0)+((8191&(n=(n=n+Math.imul(x,eg)|0)+Math.imul(T,ef)|0))<<13)|0;l=((s=s+Math.imul(T,eg)|0)+(n>>>13)|0)+(eR>>>26)|0,eR&=67108863,i=Math.imul(B,ec),n=(n=Math.imul(B,el))+Math.imul(j,ec)|0,s=Math.imul(j,el),i=i+Math.imul(M,eh)|0,n=(n=n+Math.imul(M,ed)|0)+Math.imul(U,eh)|0,s=s+Math.imul(U,ed)|0;var eP=(l+(i=i+Math.imul(P,ef)|0)|0)+((8191&(n=(n=n+Math.imul(P,eg)|0)+Math.imul(k,ef)|0))<<13)|0;l=((s=s+Math.imul(k,eg)|0)+(n>>>13)|0)+(eP>>>26)|0,eP&=67108863,i=Math.imul(B,eh),n=(n=Math.imul(B,ed))+Math.imul(j,eh)|0,s=Math.imul(j,ed);var ek=(l+(i=i+Math.imul(M,ef)|0)|0)+((8191&(n=(n=n+Math.imul(M,eg)|0)+Math.imul(U,ef)|0))<<13)|0;l=((s=s+Math.imul(U,eg)|0)+(n>>>13)|0)+(ek>>>
vendor: 27,002 bytes, line 908
90826)|0,ek&=67108863;var eD=(l+(i=Math.imul(B,ef))|0)+((8191&(n=(n=Math.imul(B,eg))+Math.imul(j,ef)|0))<<13)|0;return l=((s=Math.imul(j,eg))+(n>>>13)|0)+(eD>>>26)|0,eD&=67108863,c[0]=em,c[1]=ey,c[2]=ew,c[3]=eb,c[4]=ev,c[5]=eE,c[6]=e_,c[7]=eC,c[8]=eA,c[9]=eI,c[10]=eS,c[11]=eN,c[12]=eO,c[13]=ex,c[14]=eT,c[15]=eR,c[16]=eP,c[17]=ek,c[18]=eD,0!==l&&(c[19]=l,r.length++),r};function y(e,t,r){r.negative=t.negative^e.negative,r.length=e.length+t.length;for(var i=0,n=0,s=0;s<r.length-1;s++){var o=n;n=0;for(var a=67108863&i,c=Math.min(s,t.length-1),l=Math.max(0,s-e.length+1);l<=c;l++){var u=s-l,h=(0|e.words[u])*(0|t.words[l]),d=67108863&h;o=o+(h/67108864|0)|0,a=67108863&(d=d+a|0),n+=(o=o+(d>>>26)|0)>>>26,o&=67108863}r.words[s]=a,i=o,o=n}return 0!==i?r.words[s]=i:r.length--,r._strip()}function w(e,t){this.x=e,this.y=t}Math.imul||(m=g),s.prototype.mulTo=function(e,t){var r,i=this.length+e.length;return 10===this.length&&10===e.length?m(this,e,t):i<63?g(this,e,t):y(this,e,t)},w.prototype.makeRBT=function(e){for(var t=Array(e),r=s.prototype._countBits(e)-1,i=0;i<e;i++)t[i]=this.revBin(i,r,e);return t},w.prototype.revBin=function(e,t,r){if(0===e||e===r-1)return e;for(var i=0,n=0;n<t;n++)i|=(1&e)<<t-n-1,e>>=1;return i},w.prototype.permute=function(e,t,r,i,n,s){for(var o=0;o<s;o++)i[o]=t[e[o]],n[o]=r[e[o]]},w.prototype.transform=function(e,t,r,i,n,s){this.permute(s,e,t,r,i,n);for(var o=1;o<n;o<<=1)for(var a=o<<1,c=Math.cos(2*Math.PI/a),l=Math.sin(2*Math.PI/a),u=0;u<n;u+=a)for(var h=c,d=l,p=0;p<o;p++){var f=r[u+p],g=i[u+p],m=r[u+p+o],y=i[u+p+o],w=h*m-d*y;y=h*y+d*m,m=w,r[u+p]=f+m,i[u+p]=g+y,r[u+p+o]=f-m,i[u+p+o]=g-y,p!==a&&(w=c*h-l*d,d=c*d+l*h,h=w)}},w.prototype.guessLen13b=function(e,t){var r=1|Math.max(t,e),i=1&r,n=0;for(r=r/2|0;r;r>>>=1)n++;return 1<<n+1+i},w.prototype.conjugate=function(e,t,r){if(!(r<=1))for(var i=0;i<r/2;i++){var n=e[i];e[i]=e[r-i-1],e[r-i-1]=n,n=t[i],t[i]=-t[r-i-1],t[r-i-1]=-n}},w.prototype.normalize13b=function(e,t){for(var r=0,i=0;i<t/2;i++){var n=8192*Math.round(e[2*i+1]/t)+Math.round(e[2*i]/t)+r;e[i]=67108863&n,r=n<67108864?0:n/67108864|0}return e},w.prototype.convert13b=function(e,t,r,n){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<n;++o)r[o]=0;i(0===s),i((-8192&s)==0)},w.prototype.stub=function(e){for(var t=Array(e),r=0;r<e;r++)t[r]=0;return t},w.prototype.mulp=function(e,t,r){var i=2*this.guessLen13b(e.length,t.length),n=this.makeRBT(i),s=this.stub(i),o=Array(i),a=Array(i),c=Array(i),l=Array(i),u=Array(i),h=Array(i),d=r.words;d.length=i,this.convert13b(e.words,e.length,o,i),this.convert13b(t.words,t.length,l,i),this.transform(o,s,a,c,i,n),this.transform(l,s,u,h,i,n);for(var p=0;p<i;p++){var f=a[p]*u[p]-c[p]*h[p];c[p]=a[p]*h[p]+c[p]*u[p],a[p]=f}return this.conjugate(a,c,i),this.transform(a,c,d,s,i,n),this.conjugate(d,s,i),this.normalize13b(d,i),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),y(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),i("number"==typeof e),i(e<67108864);for(var r=0,n=0;n<this.length;n++){var s=(0|this.words[n])*e,o=(67108863&s)+(67108863&r);r>>=26,r+=(s/67108864|0)+(o>>>26),this.words[n]=67108863&o}return 0!==r&&(this.words[n]=r,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 i=r/26|0,n=r%26;t[r]=e.words[i]>>>n&1}return t}(e);if(0===t.length)return new s(1);for(var r=this,i=0;i<t.length&&0===t[i];i++,r=r.sqr());if(++i<t.length)for(var n=r.sqr();i<t.length;i++,n=n.sqr())0!==t[i]&&(r=r.mul(n));return r},s.prototype.iushln=function(e){i("number"==typeof e&&e>=0);var t,r=e%26,n=(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,c=(0|this.words[t])-a<<r;this.words[t]=c|o,o=a>>>26-r}o&&(this.words[t]=o,this.length++)}if(0!==n){for(t=this.length-1;t>=0;t--)this.words[t+n]=this.words[t];for(t=0;t<n;t++)this.words[t]=0;this.length+=n}return this._strip()},s.prototype.ishln=function(e){return i(0===this.negative),this.iushln(e)},s.prototype.iushrn=function(e,t,r){i("number"==typeof e&&e>=0),n=t?(t-t%26)/26:0;var n,s=e%26,o=Math.min((e-s)/26,this.length),a=67108863^67108863>>>s<<s;if(n-=o,n=Math.max(0,n),r){for(var c=0;c<o;c++)r.words[c]=this.words[c];r.length=o}if(0===o);else if(this.length>o)for(this.length-=o,c=0;c<this.length;c++)this.words[c]=this.words[c+o];else this.words[0]=0,this.length=1;var l=0;for(c=this.length-1;c>=0&&(0!==l||c>=n);c--){var u=0|this.words[c];this.words[c]=l<<26-s|u>>>s,l=u&a}return r&&0!==l&&(r.words[r.length++]=l),0===this.length&&(this.words[0]=0,this.length=1),this._strip()},s.prototype.ishrn=function(e,t,r){return i(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){i("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){i("number"==typeof e&&e>=0);var t=e%26,r=(e-t)/26;return(i(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),this._strip())},s.prototype.maskn=function(e){return this.clone().imaskn(e)},s.prototype.iaddn=function(e){return(i("number"==typeof e),i(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(i("number"==typeof e),i(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 n,s,o=e.length+r;this._expand(o);var a=0;for(n=0;n<e.length;n++){s=(0|this.words[n+r])+a;var c=(0|e.words[n])*t;s-=67108863&c,a=(s>>26)-(c/67108864|0),this.words[n+r]=67108863&s}for(;n<this.length-r;n++)a=(s=(0|this.words[n+r])+a)>>26,this.words[n+r]=67108863&s;if(0===a)return this._strip();for(i(-1===a),a=0,n=0;n<this.length;n++)a=(s=-(0|this.words[n])+a)>>26,this.words[n]=67108863&s;return this.negative=1,this._strip()},s.prototype._wordDiv=function(e,t){var r,i=this.length-e.length,n=this.clone(),o=e,a=0|o.words[o.length-1];0!=(i=26-this._countBits(a))&&(o=o.ushln(i),n.iushln(i),a=0|o.words[o.length-1]);var c=n.length-o.length;if("mod"!==t){(r=new s(null)).length=c+1,r.words=Array(r.length);for(var l=0;l<r.length;l++)r.words[l]=0}var u=n.clone()._ishlnsubmul(o,1,c);0===u.negative&&(n=u,r&&(r.words[c]=1));for(var h=c-1;h>=0;h--){var d=(0|n.words[o.length+h])*67108864+(0|n.words[o.length+h-1]);for(d=Math.min(d/a|0,67108863),n._ishlnsubmul(o,d,h);0!==n.negative;)d--,n.negative=0,n._ishlnsubmul(o,1,h),n.isZero()||(n.negative^=1);r&&(r.words[h]=d)}return r&&r._strip(),n._strip(),"div"!==t&&0!==i&&n.iushrn(i),{div:r||null,mod:n}},s.prototype.divmod=function(e,t,r){var n,o,a;return(i(!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&&(n=a.div.neg()),"div"!==t&&(o=a.mod.neg(),r&&0!==o.negative&&o.iadd(e)),{div:n,mod:o}):0===this.negative&&0!==e.negative?(a=this.divmod(e.neg(),t),"mod"!==t&&(n=a.div.neg()),{div:n,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,i=e.ushrn(1),n=e.andln(1),s=r.cmp(i);return s<0||1===n&&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),i(e<=67108863);for(var r=67108864%e,n=0,s=this.length-1;s>=0;s--)n=(r*n+(0|this.words[s]))%e;return t?-n:n},s.prototype.modn=function(e){return this.modrn(e)},s.prototype.idivn=function(e){var t=e<0;t&&(e=-e),i(e<=67108863);for(var r=0,n=this.length-1;n>=0;n--){var s=(0|this.words[n])+67108864*r;this.words[n]=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){i(0===e.negative),i(!e.isZero());var t=this,r=e.clone();t=0!==t.negative?t.umod(e):t.clone();for(var n=new s(1),o=new s(0),a=new s(0),c=new s(1),l=0;t.isEven()&&r.isEven();)t.iushrn(1),r.iushrn(1),++l;for(var u=r.clone(),h=t.clone();!t.isZero();){for(var d=0,p=1;(t.words[0]&p)==0&&d<26;++d,p<<=1);if(d>0)for(t.iushrn(d);d-- >0;)(n.isOdd()||o.isOdd())&&(n.iadd(u),o.isub(h)),n.iushrn(1),o.iushrn(1);for(var f=0,g=1;(r.words[0]&g)==0&&f<26;++f,g<<=1);if(f>0)for(r.iushrn(f);f-- >0;)(a.isOdd()||c.isOdd())&&(a.iadd(u),c.isub(h)),a.iushrn(1),c.iushrn(1);t.cmp(r)>=0?(t.isub(r),n.isub(a),o.isub(c)):(r.isub(t),a.isub(n),c.isub(o))}return{a:a,b:c,gcd:r.iushln(l)}},s.prototype._invmp=function(e){i(0===e.negative),i(!e.isZero());var t,r=this,n=e.clone();r=0!==r.negative?r.umod(e):r.clone();for(var o=new s(1),a=new s(0),c=n.clone();r.cmpn(1)>0&&n.cmpn(1)>0;){for(var l=0,u=1;(r.words[0]&u)==0&&l<26;++l,u<<=1);if(l>0)for(r.iushrn(l);l-- >0;)o.isOdd()&&o.iadd(c),o.iushrn(1);for(var h=0,d=1;(n.words[0]&d)==0&&h<26;++h,d<<=1);if(h>0)for(n.iushrn(h);h-- >0;)a.isOdd()&&a.iadd(c),a.iushrn(1);r.cmp(n)>=0?(r.isub(n),o.isub(a)):(n.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 i=0;t.isEven()&&r.isEven();i++)t.iushrn(1),r.iushrn(1);for(;;){for(;t.isEven();)t.iushrn(1);for(;r.isEven();)r.iushrn(1);var n=t.cmp(r);if(n<0){var s=t;t=r,r=s}else if(0===n||0===r.cmpn(1))break;t.isub(r)}return r.iushln(i)},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){i("number"==typeof e);var t=e%26,r=(e-t)/26,n=1<<t;if(this.length<=r)return this._expand(r+1),this.words[r]|=n,this;for(var s=n,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),i(e<=67108863,"Number is too big");var n=0|this.words[0];t=n===e?0:n<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 i=0|this.words[r],n=0|e.words[r];if(i!==n){i<n?t=-1:i>n&&(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 I(e)},s.prototype.toRed=function(e){return i(!this.red,"Already a number in reduction context"),i(0===this.negative,"red works only with positives"),e.convertTo(this)._forceRed(e)},s.prototype.fromRed=function(){return i(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 i(!this.red,"Already a number in reduction context"),this._forceRed(e)},s.prototype.redAdd=function(e){return i(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},s.prototype.redIAdd=function(e){return i(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},s.prototype.redSub=function(e){return i(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},s.prototype.redISub=function(e){return i(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},s.prototype.redShl=function(e){return i(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},s.prototype.redMul=function(e){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},s.prototype.redIMul=function(e){return i(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},s.prototype.redSqr=function(){return i(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},s.prototype.redISqr=function(){return i(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},s.prototype.redSqrt=function(){return i(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},s.prototype.redInvm=function(){return i(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},s.prototype.redNeg=function(){return i(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},s.prototype.redPow=function(e){return i(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var b={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 _(){v.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}function C(){v.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}function A(){v.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}function I(e){if("string"==typeof e){var t=s._prime(e);this.m=t.p,this.prime=t}else i(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}function S(e){I.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 i=t<this.n?-1:r.ucmp(this.p);return 0===i?(r.words[0]=0,r.length=1):i>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)},n(E,v),E.prototype.split=function(e,t){for(var r=Math.min(e.length,9),i=0;i<r;i++)t.words[i]=e.words[i];if(t.length=r,e.length<=9){e.words[0]=0,e.length=1;return}var n=e.words[9];for(i=10,t.words[t.length++]=4194303&n;i<e.length;i++){var s=0|e.words[i];e.words[i-10]=(4194303&s)<<4|n>>>22,n=s}n>>>=22,e.words[i-10]=n,0===n&&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 i=0|e.words[r];t+=977*i,e.words[r]=67108863&t,t=64*i+(t/67108864|0)}return 0===e.words[e.length-1]&&(e.length--,0===e.words[e.length-1]&&e.length--),e},n(_,v),n(C,v),n(A,v),A.prototype.imulK=function(e){for(var t=0,r=0;r<e.length;r++){var i=(0|e.words[r])*19+t,n=67108863&i;i>>>=26,e.words[r]=n,t=i}return 0!==t&&(e.words[e.length++]=t),e},s._prime=function(e){var t;if(b[e])return b[e];if("k256"===e)t=new E;else if("p224"===e)t=new _;else if("p192"===e)t=new C;else if("p25519"===e)t=new A;else throw Error("Unknown prime "+e);return b[e]=t,t},I.prototype._verify1=function(e){i(0===e.negative,"red works only with positives"),i(e.red,"red works only with red numbers")},I.prototype._verify2=function(e,t){i((e.negative|t.negative)==0,"red works only with positives"),i(e.red&&e.red===t.red,"red works only with red numbers")},I.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):(l(e,e.umod(this.m)._forceRed(this)),e)},I.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},I.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)},I.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},I.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)},I.prototype.isub=function(e,t){this._verify2(e,t);var r=e.isub(t);return 0>r.cmpn(0)&&r.iadd(this.m),r},I.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},I.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},I.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},I.prototype.isqr=function(e){return this.imul(e,e.clone())},I.prototype.sqr=function(e){return this.mul(e,e)},I.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(i(t%2==1),3===t){var r=this.m.add(new s(1)).iushrn(2);return this.pow(e,r)}for(var n=this.m.subn(1),o=0;!n.isZero()&&0===n.andln(1);)o++,n.iushrn(1);i(!n.isZero());var a=new s(1).toRed(this),c=a.redNeg(),l=this.m.subn(1).iushrn(1),u=this.m.bitLength();for(u=new s(2*u*u).toRed(this);0!==this.pow(u,l).cmp(c);)u.redIAdd(c);for(var h=this.pow(u,n),d=this.pow(e,n.addn(1).iushrn(1)),p=this.pow(e,n),f=o;0!==p.cmp(a);){for(var g=p,m=0;0!==g.cmp(a);m++)g=g.redSqr();i(m<f);var y=this.pow(h,new s(1).iushln(f-m-1));d=d.redMul(y),h=y.redSqr(),p=p.redMul(h),f=m}return d},I.prototype.invm=function(e){var t=e._invmp(this.m);return 0!==t.negative?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},I.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 i=2;i<r.length;i++)r[i]=this.mul(r[i-1],e);var n=r[0],o=0,a=0,c=t.bitLength()%26;for(0===c&&(c=26),i=t.length-1;i>=0;i--){for(var l=t.words[i],u=c-1;u>=0;u--){var h=l>>u&1;if(n!==r[0]&&(n=this.sqr(n)),0===h&&0===o){a=0;continue}o<<=1,o|=h,(4==++a||0===i&&0===u)&&(n=this.mul(n,r[o]),a=0,o=0)}c=26}return n},I.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},I.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},s.mont=function(e){return new S(e)},n(S,I),S.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},S.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},S.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var r=e.imul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),s=n;return n.cmp(this.m)>=0?s=n.isub(this.m):0>n.cmpn(0)&&(s=n.iadd(this.m)),s._forceRed(this)},S.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new s(0)._forceRed(this);var r=e.mul(t),i=r.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),n=r.isub(i).iushrn(this.shift),o=n;return n.cmp(this.m)>=0?o=n.isub(this.m):0>n.cmpn(0)&&(o=n.iadd(this.m)),o._forceRed(this)},S.prototype.invm=function(e){return this.imod(e._invmp(this.m).mul(this.r2))._forceRed(this)}}(e=r.nmd(e),this)},88806:function(e,t,r){"use strict";var i=r(82957).Buffer,n=this&&this.__createBinding||(Object.create?function(e,t,r,i){void 0===i&&(i=r),Object.defineProperty(e,i,{enumerable:!0,get:function(){return t[r]}})}:function(e,t,r,i){void 0===i&&(i=r),e[i]=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,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(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)&&n(t,e,r);return s(t,e),t},c=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 l=c(r(44373)),u=c(r(22525)),h=a(r(65768)),d=new("function"!=typeof TextDecoder?h.TextDecoder:TextDecoder)("utf-8",{fatal:!0});t.baseEncode=function(e){return"string"==typeof e&&(e=i.from(e,"utf8")),u.default.encode(i.from(e))},t.baseDecode=function(e){return i.from(u.default.decode(e))};class p 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=p;class f{constructor(){this.buf=i.alloc(1024),this.length=0}maybeResize(){this.buf.length<16+this.length&&(this.buf=i.concat([this.buf,i.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(i.from(new l.default(e).toArray("le",8)))}writeU128(e){this.maybeResize(),this.writeBuffer(i.from(new l.default(e).toArray("le",16)))}writeU256(e){this.maybeResize(),this.writeBuffer(i.from(new l.default(e).toArray("le",32)))}writeU512(e){this.maybeResize(),this.writeBuffer(i.from(new l.default(e).toArray("le",64)))}writeBuffer(e){this.buf=i.concat([i.from(this.buf.subarray(0,this.length)),e,i.alloc(1024)]),this.length+=e.length}writeString(e){this.maybeResize();let t=i.from(e,"utf8");this.writeU32(t.length),this.writeBuffer(t)}writeFixedArray(e){this.writeBuffer(i.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 i=r.value;r.value=function(...e){try{return i.apply(this,e)}catch(e){if(e instanceof RangeError&&["ERR_BUFFER_OUT_OF_BOUNDS","ERR_OUT_OF_RANGE"].indexOf(e.code)>=0)throw new p("Reached the end of buffer when deserializing");throw e}}}t.BinaryWriter=f;class m{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 l.default(e,"le")}readU128(){let e=this.readBuffer(16);return new l.default(e,"le")}readU256(){let e=this.readBuffer(32);return new l.default(e,"le")}readU512(){let e=this.readBuffer(64);return new l.default(e,"le")}readBuffer(e){if(this.offset+e>this.buf.length)throw new p(`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 d.decode(t)}catch(e){throw new p(`Error decoding UTF-8 string: ${e}`)}}readFixedArray(e){return new Uint8Array(this.readBuffer(e))}readArray(e){let t=this.readU32(),r=[];for(let i=0;i<t;++i)r.push(e());return r}}function y(e){return e.charAt(0).toUpperCase()+e.slice(1)}function w(e,t,r,i,n){try{if("string"==typeof i)n[`write${y(i)}`](r);else if(i instanceof Array){if("number"==typeof i[0]){if(r.length!==i[0])throw new p(`Expecting byte array of length ${i[0]}, but got ${r.length} bytes`);n.writeFixedArray(r)}else if(2===i.length&&"number"==typeof i[1]){if(r.length!==i[1])throw new p(`Expecting byte array of length ${i[1]}, but got ${r.length} bytes`);for(let t=0;t<i[1];t++)w(e,null,r[t],i[0],n)}else n.writeArray(r,r=>{w(e,t,r,i[0],n)})}else if(void 0!==i.kind)switch(i.kind){case"option":null==r?n.writeU8(0):(n.writeU8(1),w(e,t,r,i.type,n));break;case"map":n.writeU32(r.size),r.forEach((r,s)=>{w(e,t,s,i.key,n),w(e,t,r,i.value,n)});break;default:throw new p(`FieldType ${i} unrecognized`)}else b(e,r,n)}catch(e){throw e instanceof p&&e.addToFieldPath(t),e}}function b(e,t,r){if("function"==typeof t.borshSerialize){t.borshSerialize(r);return}let i=e.get(t.constructor);if(!i)throw new p(`Class ${t.constructor.name} is missing in schema`);if("struct"===i.kind)i.fields.map(([i,n])=>{w(e,i,t[i],n,r)});else if("enum"===i.kind){let n=t[i.field];for(let s=0;s<i.values.length;++s){let[o,a]=i.values[s];if(o===n){r.writeU8(s),w(e,o,t[o],a,r);break}}}else throw new p(`Unexpected schema kind: ${i.kind} for ${t.constructor.name}`)}
908function v(e,t,r,i){try{if("string"==typeof r)return i[`read${y(r)}`]();if(r instanceof Array){if("number"==typeof r[0])return i.readFixedArray(r[0]);if("number"!=typeof r[1])return i.readArray(()=>v(e,t,r[0],i));{let t=[];for(let n=0;n<r[1];n++)t.push(v(e,null,r[0],i));return t}}if("option"===r.kind){if(i.readU8())return v(e,t,r.type,i);return}if("map"===r.kind){let n=new Map,s=i.readU32();for(let o=0;o<s;o++){let s=v(e,t,r.key,i),o=v(e,t,r.value,i);n.set(s,o)}return n}return E(e,r,i)}catch(e){throw e instanceof p&&e.addToFieldPath(t),e}}function E(e,t,r){if("function"==typeof t.borshDeserialize)return t.borshDeserialize(r);let i=e.get(t);if(!i)throw new p(`Class ${t.name} is missing in schema`);if("struct"===i.kind){let i={};for(let[n,s]of e.get(t).fields)i[n]=v(e,n,s,r);return new t(i)}if("enum"===i.kind){let n=r.readU8();if(n>=i.values.length)throw new p(`Enum index: ${n} is out of range`);let[s,o]=i.values[n],a=v(e,s,o,r);return new t({[s]:a})}throw new p(`Unexpected schema kind: ${i.kind} for ${t.constructor.name}`)}o([g],m.prototype,"readU8",null),o([g],m.prototype,"readU16",null),o([g],m.prototype,"readU32",null),o([g],m.prototype,"readU64",null),o([g],m.prototype,"readU128",null),o([g],m.prototype,"readU256",null),o([g],m.prototype,"readU512",null),o([g],m.prototype,"readString",null),o([g],m.prototype,"readFixedArray",null),o([g],m.prototype,"readArray",null),t.BinaryReader=m,t.serialize=function(e,t,r=f){let i=new r;return b(e,t,i),i.toArray()},t.deserialize=function(e,t,r,i=m){let n=new i(r),s=E(e,t,n);if(n.offset<r.length)throw new p(`Unexpected ${r.length-n.offset} bytes after deserialized data`);return s},t.deserializeUnchecked=function(e,t,r,i=m){return E(e,t,new i(r))}},48644:function(e,t,r){"use strict";var i=r(73306).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 n=0;n<e.length;n++){var s=e.charAt(n),o=s.charCodeAt(0);if(255!==t[o])throw TypeError(s+" is ambiguous");t[o]=n}var a=e.length,c=e.charAt(0),l=Math.log(a)/Math.log(256),u=Math.log(256)/Math.log(a);function h(e){if("string"!=typeof e)throw TypeError("Expected String");if(0===e.length)return i.alloc(0);for(var r=0,n=0,s=0;e[r]===c;)n++,r++;for(var o=(e.length-r)*l+1>>>0,u=new Uint8Array(o);r<e.length;){var h=e.charCodeAt(r);if(h>255)return;var d=t[h];if(255===d)return;for(var p=0,f=o-1;(0!==d||p<s)&&-1!==f;f--,p++)d+=a*u[f]>>>0,u[f]=d%256>>>0,d=d/256>>>0;if(0!==d)throw Error("Non-zero carry");s=p,r++}for(var g=o-s;g!==o&&0===u[g];)g++;var m=i.allocUnsafe(n+(o-g));m.fill(0,0,n);for(var y=n;g!==o;)m[y++]=u[g++];return m}return{encode:function(t){if((Array.isArray(t)||t instanceof Uint8Array)&&(t=i.from(t)),!i.isBuffer(t))throw TypeError("Expected Buffer");if(0===t.length)return"";for(var r=0,n=0,s=0,o=t.length;s!==o&&0===t[s];)s++,r++;for(var l=(o-s)*u+1>>>0,h=new Uint8Array(l);s!==o;){for(var d=t[s],p=0,f=l-1;(0!==d||p<n)&&-1!==f;f--,p++)d+=256*h[f]>>>0,h[f]=d%a>>>0,d=d/a>>>0;if(0!==d)throw Error("Non-zero carry");n=p,s++}for(var g=l-n;g!==l&&0===h[g];)g++;for(var m=c.repeat(r);g<l;++g)m+=e.charAt(h[g]);return m},decodeUnsafe:h,decode:function(e){var t=h(e);if(t)return t;throw Error("Non-base"+a+" character")}}}},22525:function(e,t,r){var i=r(48644);e.exports=i("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},85263:function(e,t,r){"use strict";r.d(t,{Z:function(){return i}});var i=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 i=e.charAt(r),n=i.charCodeAt(0);if(255!==t[n])throw TypeError(i+" is ambiguous");t[n]=r}let r=e.length,i=e.charAt(0),n=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]===i;)o++,s++;let c=(e.length-s)*n+1>>>0,l=new Uint8Array(c);for(;s<e.length;){let i=e.charCodeAt(s);if(i>255)return;let n=t[i];if(255===n)return;let o=0;for(let e=c-1;(0!==n||o<a)&&-1!==e;e--,o++)n+=r*l[e]>>>0,l[e]=n%256>>>0,n=n/256>>>0;if(0!==n)throw Error("Non-zero carry");a=o,s++}let u=c-a;for(;u!==c&&0===l[u];)u++;let h=new Uint8Array(o+(c-u)),d=o;for(;u!==c;
908)h[d++]=l[u++];return h}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 n=0,o=0,a=0,c=t.length;for(;a!==c&&0===t[a];)a++,n++;let l=(c-a)*s+1>>>0,u=new Uint8Array(l);for(;a!==c;){let e=t[a],i=0;for(let t=l-1;(0!==e||i<o)&&-1!==t;t--,i++)e+=256*u[t]>>>0,u[t]=e%r>>>0,e=e/r>>>0;if(0!==e)throw Error("Non-zero carry");o=i,a++}let h=l-o;for(;h!==l&&0===u[h];)h++;let d=i.repeat(n);for(;h<l;++h)d+=e.charAt(u[h]);return d},decodeUnsafe:o,decode:function(e){let t=o(e);if(t)return t;throw Error("Non-base"+r+" character")}}}("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},5270:function(e,t,r){"use strict";r.d(t,{j:function(){return s}});let i=e=>"boolean"==typeof e?`${e}`:0===e?"0":e,n=function(){for(var e,t,r=0,i="",n=arguments.length;r<n;r++)(e=arguments[r])&&(t=function e(t){var r,i,n="";if("string"==typeof t||"number"==typeof t)n+=t;else if("object"==typeof t){if(Array.isArray(t)){var s=t.length;for(r=0;r<s;r++)t[r]&&(i=e(t[r]))&&(n&&(n+=" "),n+=i)}else for(i in t)t[i]&&(n&&(n+=" "),n+=i)}return n}(e))&&(i&&(i+=" "),i+=t);return i},s=(e,t)=>r=>{var s;if((null==t?void 0:t.variants)==null)return n(e,null==r?void 0:r.class,null==r?void 0:r.className);let{variants:o,defaultVariants:a}=t,c=Object.keys(o).map(e=>{let t=null==r?void 0:r[e],n=null==a?void 0:a[e];if(null===t)return null;let s=i(t)||i(n);return o[e][s]}),l=r&&Object.entries(r).reduce((e,t)=>{let[r,i]=t;return void 0===i||(e[r]=i),e},{});return n(e,c,null==t?void 0:null===(s=t.compoundVariants)||void 0===s?void 0:s.reduce((e,t)=>{let{class:r,className:i,...n}=t;return Object.entries(n).every(e=>{let[t,r]=e;return Array.isArray(r)?r.includes({...a,...l}[t]):({...a,...l})[t]===r})?[...e,r,i]:e},[]),null==r?void 0:r.class,null==r?void 0:r.className)}},84772:function(e,t){var r;!function(){"use strict";var i={}.hasOwnProperty;function n(){for(var e="",t=0;t<arguments.length;t++){var r=arguments[t];r&&(e=s(e,function(e){if("string"==typeof e||"number"==typeof e)return e;if("object"!=typeof e)return"";if(Array.isArray(e))return n.apply(null,e);if(e.toString!==Object.prototype.toString&&!e.toString.toString().includes("[native code]"))return e.toString();var t="";for(var r in e)i.call(e,r)&&e[r]&&(t=s(t,r));return t}(r)))}return e}function s(e,t){return t?e?e+" "+t:e+t:e}e.exports?(n.default=n,e.exports=n):void 0!==(r=(function(){return n}).apply(t,[]))&&(e.exports=r)}()},59542:function(e,t,r){"use strict";r.r(t),r.d(t,{AC:function(){return i.AC},AD:function(){return i.AD},AE:function(){return i.AE},AF:function(){return i.AF},AG:function(){return i.AG},AI:function(){return i.AI},AL:function(){return i.AL},AM:function(){return i.AM},AO:function(){return i.AO},AQ:function(){return i.AQ},AR:function(){return i.AR},AS:function(){return i.AS},AT:function(){return i.AT},AU:function(){return i.AU},AW:function(){return i.AW},AX:function(){return i.AX},AZ:function(){return i.AZ},BA:function(){return i.BA},BB:function(){return i.BB},BD:function(){return i.BD},BE:function(){return i.BE},BF:function(){return i.BF},BG:function(){return i.BG},BH:function(){return i.BH},BI:function(){return i.BI},BJ:function(){return i.BJ},BL:function(){return i.BL},BM:function(){return i.BM},BN:function(){return i.BN},BO:function(){return i.BO},BQ:function(){return i.BQ},BR:function(){return i.BR},BS:function(){return i.BS},BT:function(){return i.BT},BV:function(){return i.BV},BW:function(){return i.BW},BY:function(){return i.BY},BZ:function(){return i.BZ},CA:function(){return i.CA},CC:function(){return i.CC},CD:function(){return i.CD},CF:function(){return i.CF},CG:function(){return i.CG},CH:function(){return i.CH},CI:function(){return i.CI},CK:function(){return i.CK},CL:function(){return i.CL},CM:function(){return i.CM},CN:function(){return i.CN},CO:function(){return i.CO},CR:function(){return i.CR},CU:function(){return i.CU},CV:function(){return i.CV},CW:function(){return i.CW},CX:function(){return i.CX},CY:function(){return i.CY},CZ:function(){return i.CZ},DE:function(){return i.DE},DJ:function(){return i.DJ},DK:function(){return i.DK},DM:function(){return i.DM},DO:function(){return i.DO},DZ:function(){return i.DZ},EC:function(){return i.EC},EE:function(){return i.EE},EG:function(){return i.EG},EH:function(){return i.EH},ER:function(){return i.ER},ES:function(){return i.ES},ET:function(){return i.ET},EU:function(){return i.EU},FI:function(){return i.FI},FJ:function(){return i.FJ},FK:function(){return i.FK},FM:function(){return i.FM},FO:function(){return i.FO},FR:function(){return i.FR},GA:function(){return i.GA},GB:function(){return i.GB},GD:function(){return i.GD},GE:function(){return i.GE},GF:function(){return i.GF},GG:function(){return i.GG},GH:function(){return i.GH},GI:function(){return i.GI},GL:function(){return i.GL},GM:function(){return i.GM},GN:function(){return i.GN},GP:function(){return i.GP},GQ:function(){return i.GQ},GR:function(){return i.GR},GS:function(){return i.GS},GT:function(){return i.GT},GU:function(){return i.GU},GW:function(){return i.GW},GY:function(){return i.GY},HK:function(){return i.HK},HM:function(){return i.HM},HN:function(){return i.HN},HR:function(){return i.HR},HT:function(){return i.HT},HU:function(){return i.HU},IC:function(){return i.IC},ID:function(){return i.ID},IE:function(){return i.IE},IL:function(){return i.IL},IM:function(){return i.IM},IN:function(){return i.IN},IO:function(){return i.IO},IQ:function(){return i.IQ},IR:function(){return i.IR},IS:function(){return i.IS},IT:function(){return i.IT},JE:function(){return i.JE},JM:function(){return i.JM},JO:function(){return i.JO},JP:function(){return i.JP},KE:function(){return i.KE},KG:function(){return i.KG},KH:function(){return i.KH},KI:function(){return i.KI},KM:function(){return i.KM},KN:function(){return i.KN},KP:function(){return i.KP},KR:function(){return i.KR},KW:function(){return i.KW},KY:function(){return i.KY},KZ:function(){return i.KZ},LA:function(){return i.LA},LB:function(){return i.LB},LC:function(){return i.LC},LI:function(){return i.LI},LK:function(){return i.LK},LR:function(){return i.LR},LS:function(){return i.LS},LT:function(){return i.LT},LU:function(){return i.LU},LV:function(){return i.LV},LY:function(){return i.LY},MA:function(){return i.MA},MC:function(){return i.MC},MD:function(){return i.MD},ME:function(){return i.ME},MF:function(){return i.MF},MG:function(){return i.MG},MH:function(){return i.MH},MK:function(){return i.MK},ML:function(){return i.ML},MM:function(){return i.MM},MN:function(){return i.MN},MO:function(){return i.MO},MP:function(){return i.MP},MQ:function(){return i.MQ},MR:function(){return i.MR},MS:function(){return i.MS},MT:function(){return i.MT},MU:function(){return i.MU},MV:function(){return i.MV},MW:function(){return i.MW},MX:function(){return i.MX},MY:function(){return i.MY},MZ:function(){return i.MZ},NA:function(){return i.NA},NC:function(){return i.NC},NE:function(){return i.NE},NF:function(){return i.NF},NG:function(){return i.NG},NI:function(){return i.NI},NL:function(){return i.NL},NO:function(){return i.NO},NP:function(){return i.NP},NR:function(){return i.NR},NU:function(){return i.NU},NZ:function(){return i.NZ},OM:function(){return i.OM},PA:function(){return i.PA},PE:function(){return i.PE},PF:function(){return i.PF},PG:function(){return i.PG},PH:function(){return i.PH},PK:function(){return i.PK},PL:function(){return i.PL},PM:function(){return i.PM},PN:function(){return i.PN},PR:function(){return i.PR},PS:function(){return i.PS},PT:function(){return i.PT},PW:function(){return i.PW},PY:function(){return i.PY},QA:function(){return i.QA},RE:function(){return i.RE},RO:function(){return i.RO},RS:function(){return i.RS},RU:function(){return i.RU},RW:function(){return i.RW},SA:function(){return i.SA},SB:function(){return i.SB},SC:function(){return i.SC},SD:function(){return i.SD},SE:function(){return i.SE},SG:function(){return i.SG},SH:function(){return i.SH},SI:function(){return i.SI},SJ:function(){return i.SJ},SK:function(){return i.SK},SL:function(){return i.SL},SM:function(){return i.SM},SN:function(){return i.SN},SO:function(){return i.SO},SR:function(){return i.SR},SS:function(){return i.SS},ST:function(){return i.ST},SV:function(){return i.SV},SX:function(){return i.SX},SY:function(){return i.SY},SZ:function(){return i.SZ},TA:function(){return i.TA},TC:function(){return i.TC},TD:function(){return i.TD},TF:function(){return i.TF},TG:function(){return i.TG},TH:function(){return i.TH},TJ:function(){return i.TJ},TK:function(){return i.TK},TL:function(){return i.TL},TM:function(){return i.TM},TN:function(){return i.TN},TO:function(){return i.TO},TR:function(){return i.TR},TT:function(){return i.TT},TV:function(){return i.TV},TW:function(){return i.TW},TZ:function(){return i.TZ},UA:function(){return i.UA},UG:function(){return i.UG},UM:function(){return i.UM},US:function(){return i.US},UY:function(){return i.UY},UZ:function(){return i.UZ},VA:function(){return i.VA},VC:function(){return i.VC},VE:function(){return i.VE}
908,VG:function(){return i.VG},VI:function(){return i.VI},VN:function(){return i.VN},VU:function(){return i.VU},WF:function(){return i.WF},WS:function(){return i.WS},XK:function(){return i.XK},YE:function(){return i.YE},YT:function(){return i.YT},ZA:function(){return i.ZA},ZM:function(){return i.ZM},ZW:function(){return i.ZW},default:function(){return i.ZP}});var i=r(77635)},80751:function(e,t,r){var i="undefined"!=typeof globalThis&&globalThis||"undefined"!=typeof self&&self||void 0!==r.g&&r.g,n=function(){function e(){this.fetch=!1,this.DOMException=i.DOMException}return e.prototype=i,new e}();(function(e){var t=void 0!==n&&n||"undefined"!=typeof self&&self||void 0!==r.g&&r.g||{},i={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(i.arrayBuffer)var s=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],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 c(e){return"string"!=typeof e&&(e=String(e)),e}function l(e){var t={next:function(){var t=e.shift();return{done:void 0===t,value:t}}};return i.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 h(e){if(!e._noBody){if(e.bodyUsed)return Promise.reject(TypeError("Already read"));e.bodyUsed=!0}}function d(e){return new Promise(function(t,r){e.onload=function(){t(e.result)},e.onerror=function(){r(e.error)}})}function p(e){var t=new FileReader,r=d(t);return t.readAsArrayBuffer(e),r}function f(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(i.blob&&Blob.prototype.isPrototypeOf(e))this._bodyBlob=e;else if(i.formData&&FormData.prototype.isPrototypeOf(e))this._bodyFormData=e;else if(i.searchParams&&URLSearchParams.prototype.isPrototypeOf(e))this._bodyText=e.toString();else{var t;i.arrayBuffer&&i.blob&&(t=e)&&DataView.prototype.isPrototypeOf(t)?(this._bodyArrayBuffer=f(e.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):i.arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(e)||o(e))?this._bodyArrayBuffer=f(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):i.searchParams&&URLSearchParams.prototype.isPrototypeOf(e)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},i.blob&&(this.blob=function(){var e=h(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 h(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(i.blob)return this.blob().then(p);throw Error("could not read as ArrayBuffer")},this.text=function(){var e,t,r,i,n,s=h(this);if(s)return s;if(this._bodyBlob)return e=this._bodyBlob,r=d(t=new FileReader),n=(i=/charset=([A-Za-z0-9_-]+)/.exec(e.type))?i[1]:"utf-8",t.readAsText(e,n),r;if(this._bodyArrayBuffer)return Promise.resolve(function(e){for(var t=new Uint8Array(e),r=Array(t.length),i=0;i<t.length;i++)r[i]=String.fromCharCode(t[i]);return r.join("")}(this._bodyArrayBuffer));if(!this._bodyFormData)return Promise.resolve(this._bodyText);throw Error("could not read FormData body as text")},i.formData&&(this.formData=function(){return this.text().then(w)}),this.json=function(){return this.text().then(JSON.parse)},this}u.prototype.append=function(e,t){e=a(e),t=c(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)]=c(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)}),l(e)},u.prototype.values=function(){var e=[];return this.forEach(function(t){e.push(t)}),l(e)},u.prototype.entries=function(){var e=[];return this.forEach(function(t,r){e.push([r,t])}),l(e)},i.iterable&&(u.prototype[Symbol.iterator]=u.prototype.entries);var m=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function y(e,r){if(!(this instanceof y))throw TypeError('Please use the "new" operator, this DOM object c
908onstructor cannot be called as a function.');var i,n,s=(r=r||{}).body;if(e instanceof y){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=(n=(i=r.method||this.method||"GET").toUpperCase(),m.indexOf(n)>-1?n:i),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 w(e){var t=new FormData;return e.trim().split("&").forEach(function(e){if(e){var r=e.split("="),i=r.shift().replace(/\+/g," "),n=r.join("=").replace(/\+/g," ");t.append(decodeURIComponent(i),decodeURIComponent(n))}}),t}function b(e,t){if(!(this instanceof b))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)}y.prototype.clone=function(){return new y(this,{body:this._bodyInit})},g.call(y.prototype),g.call(b.prototype),b.prototype.clone=function(){return new b(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new u(this.headers),url:this.url})},b.error=function(){var e=new b(null,{status:200,statusText:""});return e.ok=!1,e.status=0,e.type="error",e};var v=[301,302,303,307,308];b.redirect=function(e,t){if(-1===v.indexOf(t))throw RangeError("Invalid status code");return new b(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,n){return new Promise(function(s,o){var l=new y(r,n);if(l.signal&&l.signal.aborted)return o(new e.DOMException("Aborted","AbortError"));var h=new XMLHttpRequest;function d(){h.abort()}if(h.onload=function(){var e,t,r={statusText:h.statusText,headers:(e=h.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(":"),i=r.shift().trim();if(i){var n=r.join(":").trim();try{t.append(i,n)}catch(e){console.warn("Response "+e.message)}}}),t)};0===l.url.indexOf("file://")&&(h.status<200||h.status>599)?r.status=200:r.status=h.status,r.url="responseURL"in h?h.responseURL:r.headers.get("X-Request-URL");var i="response"in h?h.response:h.responseText;setTimeout(function(){s(new b(i,r))},0)},h.onerror=function(){setTimeout(function(){o(TypeError("Network request failed"))},0)},h.ontimeout=function(){setTimeout(function(){o(TypeError("Network request timed out"))},0)},h.onabort=function(){setTimeout(function(){o(new e.DOMException("Aborted","AbortError"))},0)},h.open(l.method,function(e){try{return""===e&&t.location.href?t.location.href:e}catch(t){return e}}(l.url),!0),"include"===l.credentials?h.withCredentials=!0:"omit"===l.credentials&&(h.withCredentials=!1),"responseType"in h&&(i.blob?h.responseType="blob":i.arrayBuffer&&(h.responseType="arraybuffer")),n&&"object"==typeof n.headers&&!(n.headers instanceof u||t.Headers&&n.headers instanceof t.Headers)){var p=[];
908Object.getOwnPropertyNames(n.headers).forEach(function(e){p.push(a(e)),h.setRequestHeader(e,c(n.headers[e]))}),l.headers.forEach(function(e,t){-1===p.indexOf(t)&&h.setRequestHeader(t,e)})}else l.headers.forEach(function(e,t){h.setRequestHeader(t,e)});l.signal&&(l.signal.addEventListener("abort",d),h.onreadystatechange=function(){4===h.readyState&&l.signal.removeEventListener("abort",d)}),h.send(void 0===l._bodyInit?null:l._bodyInit)})}E.polyfill=!0,t.fetch||(t.fetch=E,t.Headers=u,t.Request=y,t.Response=b),e.Headers=u,e.Request=y,e.Response=b,e.fetch=E,Object.defineProperty(e,"__esModule",{value:!0})})({}),n.fetch.ponyfill=!0,delete n.fetch.polyfill;var s=i.fetch?i:n;(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},71096:function(e){var t;t=function(){"use strict";var e="millisecond",t="second",r="minute",i="hour",n="week",s="month",o="quarter",a="year",c="date",l="Invalid Date",u=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,h=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,d=function(e,t,r){var i=String(e);return!i||i.length>=t?e:""+Array(t+1-i.length).join(r)+e},p="en",f={};f[p]={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],r=e%100;return"["+e+(t[(r-20)%10]||t[r]||"th")+"]"}};var g="$isDayjsObject",m=function(e){return e instanceof v||!(!e||!e[g])},y=function e(t,r,i){var n;if(!t)return p;if("string"==typeof t){var s=t.toLowerCase();f[s]&&(n=s),r&&(f[s]=r,n=s);var o=t.split("-");if(!n&&o.length>1)return e(o[0])}else{var a=t.name;f[a]=t,n=a}return!i&&n&&(p=n),n||!i&&p},w=function(e,t){if(m(e))return e.clone();var r="object"==typeof t?t:{};return r.date=e,r.args=arguments,new v(r)},b={s:d,z:function(e){var t=-e.utcOffset(),r=Math.abs(t);return(t<=0?"+":"-")+d(Math.floor(r/60),2,"0")+":"+d(r%60,2,"0")},m:function e(t,r){if(t.date()<r.date())return-e(r,t);var i=12*(r.year()-t.year())+(r.month()-t.month()),n=t.clone().add(i,s),o=r-n<0,a=t.clone().add(i+(o?-1:1),s);return+(-(i+(r-n)/(o?n-a:a-n))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(l){return({M:s,y:a,w:n,d:"day",D:c,h:i,m:r,s:t,ms:e,Q:o})[l]||String(l||"").toLowerCase().replace(/s$/,"")},u:function(e){return void 0===e}};b.l=y,b.i=m,b.w=function(e,t){return w(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var v=function(){function d(e){this.$L=y(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[g]=!0}var p=d.prototype;return p.parse=function(e){this.$d=function(e){var t=e.date,r=e.utc;if(null===t)return new Date(NaN);if(b.u(t))return new Date;if(t instanceof Date)return new Date(t);if("string"==typeof t&&!/Z$/i.test(t)){var i=t.match(u);if(i){var n=i[2]-1||0,s=(i[7]||"0").substring(0,3);return r?new Date(Date.UTC(i[1],n,i[3]||1,i[4]||0,i[5]||0,i[6]||0,s)):new Date(i[1],n,i[3]||1,i[4]||0,i[5]||0,i[6]||0,s)}}return new Date(t)}(e),this.init()},p.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},p.$utils=function(){return b},p.isValid=function(){return this.$d.toString()!==l},p.isSame=function(e,t){var r=w(e);return this.startOf(t)<=r&&r<=this.endOf(t)},p.isAfter=function(e,t){return w(e)<this.startOf(t)},p.isBefore=function(e,t){return this.endOf(t)<w(e)},p.$g=function(e,t,r){return b.u(e)?this[t]:this.set(r,e)},p.unix=function(){return Math.floor(this.valueOf()/1e3)},p.valueOf=function(){return this.$d.getTime()},p.startOf=function(e,o){var l=this,u=!!b.u(o)||o,h=b.p(e),d=function(e,t){var r=b.w(l.$u?Date.UTC(l.$y,t,e):new Date(l.$y,t,e),l);return u?r:r.endOf("day")},p=function(e,t){return b.w(l.toDate()[e].apply(l.toDate("s"),(u?[0,0,0,0]:[23,59,59,999]).slice(t)),l)},f=this.$W,g=this.$M,m=this.$D,y="set"+(this.$u?"UTC":"");switch(h){case a:return u?d(1,0):d(31,11);case s:return u?d(1,g):d(0,g+1);case n:var w=this.$locale().weekStart||0,v=(f<w?f+7:f)-w;return d(u?m-v:m+(6-v),g);case"day":case c:return p(y+"Hours",0);case i:return p(y+"Minutes",1);case r:return p(y+"Seconds",2);case t:return p(y+"Milliseconds",3);default:return this.clone()}},p.endOf=function(e){return this.startOf(e,!1)},p.$set=function(n,o){var l,u=b.p(n),h="set"+(this.$u?"UTC":""),d=((l={}).day=h+"Date",l[c]=h+"Date",l[s]=h+"Month",l[a]=h+"FullYear",l[i]=h+"Hours",l[r]=h+"Minutes",l[t]=h+"Seconds",l[e]=h+"Milliseconds",l)[u],p="day"===u?this.$D+(o-this.$W):o;if(u===s||u===a){var f=this.clone().set(c,1);f.$d[d](p),f.init(),this.$d=f.set(c,Math.min(this.$D,f.daysInMonth())).$d}else d&&this.$d[d](p);return this.init(),this},p.set=function(e,t){return this.clone().$set(e,t)},p.get=function(e){return this[b.p(e)]()},p.add=function(e,o){var c,l=this;e=Number(e);var u=b.p(o),h=function(t){var r=w(l);return b.w(r.date(r.date()+Math.round(t*e)),l)};if(u===s)return this.set(s,this.$M+e);if(u===a)return this.set(a,this.$y+e);if("day"===u)return h(1);if(u===n)return h(7);var d=((c={})[r]=6e4,c[i]=36e5,c[t]=1e3,c)[u]||1,p=this.$d.getTime()+e*d;return b.w(p,this)},p.subtract=function(e,t){return this.add(-1*e,t)},p.format=function(e){var t=this,r=this.$locale();if(!this.isValid())return r.invalidDate||l;var i=e||"YYYY-MM-DDTHH:mm:ssZ",n=b.z(this),s=this.$H,o=this.$m,a=this.$M,c=r.weekdays,u=r.months,d=r.meri
908diem,p=function(e,r,n,s){return e&&(e[r]||e(t,i))||n[r].slice(0,s)},f=function(e){return b.s(s%12||12,e,"0")},g=d||function(e,t,r){var i=e<12?"AM":"PM";return r?i.toLowerCase():i};return i.replace(h,function(e,i){return i||function(e){switch(e){case"YY":return String(t.$y).slice(-2);case"YYYY":return b.s(t.$y,4,"0");case"M":return a+1;case"MM":return b.s(a+1,2,"0");case"MMM":return p(r.monthsShort,a,u,3);case"MMMM":return p(u,a);case"D":return t.$D;case"DD":return b.s(t.$D,2,"0");case"d":return String(t.$W);case"dd":return p(r.weekdaysMin,t.$W,c,2);case"ddd":return p(r.weekdaysShort,t.$W,c,3);case"dddd":return c[t.$W];case"H":return String(s);case"HH":return b.s(s,2,"0");case"h":return f(1);case"hh":return f(2);case"a":return g(s,o,!0);case"A":return g(s,o,!1);case"m":return String(o);case"mm":return b.s(o,2,"0");case"s":return String(t.$s);case"ss":return b.s(t.$s,2,"0");case"SSS":return b.s(t.$ms,3,"0");case"Z":return n}return null}(e)||n.replace(":","")})},p.utcOffset=function(){return-(15*Math.round(this.$d.getTimezoneOffset()/15))},p.diff=function(e,c,l){var u,h=this,d=b.p(c),p=w(e),f=(p.utcOffset()-this.utcOffset())*6e4,g=this-p,m=function(){return b.m(h,p)};switch(d){case a:u=m()/12;break;case s:u=m();break;case o:u=m()/3;break;case n:u=(g-f)/6048e5;break;case"day":u=(g-f)/864e5;break;case i:u=g/36e5;break;case r:u=g/6e4;break;case t:u=g/1e3;break;default:u=g}return l?u:b.a(u)},p.daysInMonth=function(){return this.endOf(s).$D},p.$locale=function(){return f[this.$L]},p.locale=function(e,t){if(!e)return this.$L;var r=this.clone(),i=y(e,t,!0);return i&&(r.$L=i),r},p.clone=function(){return b.w(this.$d,this)},p.toDate=function(){return new Date(this.valueOf())},p.toJSON=function(){return this.isValid()?this.toISOString():null},p.toISOString=function(){return this.$d.toISOString()},p.toString=function(){return this.$d.toUTCString()},d}(),E=v.prototype;return w.prototype=E,[["$ms",e],["$s",t],["$m",r],["$H",i],["$W","day"],["$M",s],["$y",a],["$D",c]].forEach(function(e){E[e[1]]=function(t){return this.$g(t,e[0],e[1])}}),w.extend=function(e,t){return e.$i||(e(t,v,w),e.$i=!0),w},w.locale=y,w.isDayjs=m,w.unix=function(e){return w(1e3*e)},w.en=f[p],w.Ls=f,w.p={},w},e.exports=t()},70939:function(e){var t;t=function(){return{name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(e){var t=["th","st","nd","rd"],r=e%100;return"["+e+(t[(r-20)%10]||t[r]||"th")+"]"}}},e.exports=t()},45721:function(e){var t;t=function(){return function(e,t,r){e=e||{};var i=t.prototype,n={future:"in %s",past:"%s ago",s:"a few seconds",m:"a minute",mm:"%d minutes",h:"an hour",hh:"%d hours",d:"a day",dd:"%d days",M:"a month",MM:"%d months",y:"a year",yy:"%d years"};function s(e,t,r,n){return i.fromToBase(e,t,r,n)}r.en.relativeTime=n,i.fromToBase=function(t,i,s,o,a){for(var c,l,u,h=s.$locale().relativeTime||n,d=e.thresholds||[{l:"s",r:44,d:"second"},{l:"m",r:89},{l:"mm",r:44,d:"minute"},{l:"h",r:89},{l:"hh",r:21,d:"hour"},{l:"d",r:35},{l:"dd",r:25,d:"day"},{l:"M",r:45},{l:"MM",r:10,d:"month"},{l:"y",r:17},{l:"yy",d:"year"}],p=d.length,f=0;f<p;f+=1){var g=d[f];g.d&&(c=o?r(t).diff(s,g.d,!0):s.diff(t,g.d,!0));var m=(e.rounding||Math.round)(Math.abs(c));if(u=c>0,m<=g.r||!g.r){m<=1&&f>0&&(g=d[f-1]);var y=h[g.l];a&&(m=a(""+m)),l="string"==typeof y?y.replace("%d",m):y(m,i,g.l,u);break}}if(i)return l;var w=u?h.future:h.past;return"function"==typeof w?w(l):w.replace("%s",l)},i.to=function(e,t){return s(e,t,this,!0)},i.from=function(e,t){return s(e,t,this)};var o=function(e){return e.$u?r.utc():r()};i.toNow=function(e){return this.to(o(this),e)},i.fromNow=function(e){return this.from(o(this),e)}}},e.exports=t()},96961:function(e){var t;t=function(){return function(e,t,r){r.updateLocale=function(e,t){var i=r.Ls[e];if(i)return(t?Object.keys(t):[]).forEach(function(e){i[e]=t[e]}),i}}},e.exports=t()},55445:function(e){"use strict";var t,r="object"==typeof Reflect?Reflect:null,i=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 n=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,i){var n;function s(r){e.removeListener(t,o),i(r)}function o(){"function"==typeof e.removeListener&&e.removeListener("error",s),r([].slice.call(arguments))}g(e,t,o,{once:!0}),"error"!==t&&(n={once:!0},"function"==typeof e.on&&g(e,"error",s,n))})},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 c(e){return void 0===e._maxListeners?s.defaultMaxListeners:e._maxListeners}
908function l(e,t,r,i){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]=i?[r,o]:[o,r]:i?o.unshift(r):o.push(r),(n=c(e))>0&&o.length>n&&!o.warned){o.warned=!0;var n,s,o,l=Error("Possible EventEmitter memory leak detected. "+o.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");l.name="MaxListenersExceededWarning",l.emitter=e,l.type=t,l.count=o.length,console&&console.warn&&console.warn(l)}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 h(e,t,r){var i={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},n=u.bind(i);return n.listener=r,i.wrapFn=n,n}function d(e,t,r){var i=e._events;if(void 0===i)return[];var n=i[t];return void 0===n?[]:"function"==typeof n?r?[n.listener||n]:[n]:r?function(e){for(var t=Array(e.length),r=0;r<t.length;++r)t[r]=e[r].listener||e[r];return t}(n):f(n,n.length)}function p(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 f(e,t){for(var r=Array(t),i=0;i<t;++i)r[i]=e[i];return r}function g(e,t,r,i){if("function"==typeof e.on)i.once?e.once(t,r):e.on(t,r);else if("function"==typeof e.addEventListener)e.addEventListener(t,function n(s){i.once&&e.removeEventListener(t,n),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},set:function(e){if("number"!=typeof e||e<0||n(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||n(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 c(this)},s.prototype.emit=function(e){for(var t=[],r=1;r<arguments.length;r++)t.push(arguments[r]);var n="error"===e,s=this._events;if(void 0!==s)n=n&&void 0===s.error;else if(!n)return!1;if(n){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 c=s[e];if(void 0===c)return!1;if("function"==typeof c)i(c,this,t);else for(var l=c.length,u=f(c,l),r=0;r<l;++r)i(u[r],this,t);return!0},s.prototype.addListener=function(e,t){return l(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return l(this,e,t,!0)},s.prototype.once=function(e,t){return a(t),this.on(e,h(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return a(t),this.prependListener(e,h(this,e,t)),this},s.prototype.removeListener=function(e,t){var r,i,n,s,o;if(a(t),void 0===(i=this._events)||void 0===(r=i[e]))return this;if(r===t||r.listener===t)0==--this._eventsCount?this._events=Object.create(null):(delete i[e],i.removeListener&&this.emit("removeListener",e,r.listener||t));else if("function"!=typeof r){for(n=-1,s=r.length-1;s>=0;s--)if(r[s]===t||r[s].listener===t){o=r[s].listener,n=s;break}if(n<0)return this;0===n?r.shift():function(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}(r,n),1===r.length&&(i[e]=r[0]),void 0!==i.removeListener&&this.emit("removeListener",e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,r,i;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 n,s=Object.keys(r);for(i=0;i<s.length;++i)"removeListener"!==(n=s[i])&&this.removeAllListeners(n);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(i=t.length-1;i>=0;i--)this.removeListener(e,t[i]);return this},s.prototype.listeners=function(e){return d(this,e,!0)},s.prototype.rawListeners=function(e){return d(this,e,!1)},s.listenerCount=function(e,t){return"function"==typeof e.listenerCount?e.listenerCount(t):p.c
908all(e,t)},s.prototype.listenerCount=p,s.prototype.eventNames=function(){return this._eventsCount>0?t(this._events):[]}},69983:function(e,t,r){"use strict";let i=r(37213).v4,n=r(40789),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 i()},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,i){let s;let o=this,a=null,c=Array.isArray(e)&&"function"==typeof t;if(1===this.options.version&&c)throw TypeError("JSON-RPC 1.0 does not support batching");let l=!c&&e&&"object"==typeof e&&"function"==typeof t;if(c||l)i=t,a=e;else{"function"==typeof r&&(i=r,r=void 0);let s="function"==typeof i;try{a=n(e,t,r,{generator:this.options.generator,version:this.options.version,notificationIdNull:this.options.notificationIdNull})}catch(e){if(s)return i(e);throw e}if(!s)return a}try{s=JSON.stringify(a,this.options.replacer)}catch(e){return i(e)}return this.callServer(s,function(e,t){o._parseResponse(e,t,i)}),a},s.prototype._parseResponse=function(e,t,r){let i;if(e){r(e);return}if(!t)return r();try{i=JSON.parse(t,this.options.reviver)}catch(e){return r(e)}if(3===r.length){if(!Array.isArray(i))return r(null,i.error,i.result);{let e=function(e){return void 0!==e.error};return r(null,i.filter(e),i.filter(function(t){return!e(t)}))}}r(null,i)}},40789:function(e,t,r){"use strict";let i=r(37213).v4;e.exports=function(e,t,r,n){if("string"!=typeof e)throw TypeError(e+" must be a string");let s="number"==typeof(n=n||{}).version?n.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 n.generator?n.generator:function(){return i()};o.id=e(o,n)}else 2===s&&null===r?n.notificationIdNull&&(o.id=null):o.id=r;return o}},37213:function(e,t,r){"use strict";r.d(t,{v4:function(){return l}});for(var i,n=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 c=function(e){var t=arguments.length>1&&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},l=function(e,t,r){var s=(e=e||{}).random||(e.rng||function(){if(!i&&!(i="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 i(n)})();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 c(s)}},67700:function(e,t,r){"use strict";function i(e){for(var t=1;t<arguments.length;t++){var r=arguments[t];for(var i in r)e[i]=r[i]}return e}r.d(t,{Z:function(){return n}});var n=function e(t,r){function n(e,n,s){if("undefined"!=typeof document){"number"==typeof(s=i({},r,s)).expires&&(s.expires=new Date(Date.now()+864e5*s.expires)),s.expires&&(s.expires=s.expires.toUTCString()),e=encodeURIComponent(e).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var o="";for(var a in s)s[a]&&(o+="; "+a,!0!==s[a]&&(o+="="+s[a].split(";")[0]));return document.cookie=e+"="+t.write(n,e)+o}}return Object.create({set:n,get:function(e){if("undefined"!=typeof document&&(!arguments.length||e)){for(var r=document.cookie?document.cookie.split("; "):[],i={},n=0;n<r.length;n++){var s=r[n].split("="),o=s.slice(1).join("=");try{var a=decodeURIComponent(s[0]);if(i[a]=t.read(o,a),e===a)break}catch(e){}}return e?i[e]:i}},remove:function(e,t){n(e,"",i({},t,{expires:-1}))},withAttributes:function(t){return e(this.converter,i({},this.attributes,t))},withConverter:function(t){return e(i({},this.converter,t),this.attributes)}},{attributes:{value:Object.freeze(r)},converter:{value:Object.freeze(t)}})}({read:function(e){return'"'===e[0]&&(e=e.slice(1,-1)),e.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent)},write:function(e){return encodeURIComponent(e).replace(/%(2[346BF]|3[AC-F]|40|5[BDE]|60|7[BCD])/g,decode
908URIComponent)}},{path:"/"})},75969:function(e,t,r){"use strict";r.d(t,{Jb:function(){return S},Ld:function(){return N},YP:function(){return I},_$LH:function(){return F},dy:function(){return A},sY:function(){return z}});let i=globalThis,n=i.trustedTypes,s=n?n.createPolicy("lit-html",{createHTML:e=>e}):void 0,o="$lit$",a=`lit$${Math.random().toFixed(9).slice(2)}$`,c="?"+a,l=`<${c}>`,u=document,h=()=>u.createComment(""),d=e=>null===e||"object"!=typeof e&&"function"!=typeof e,p=Array.isArray,f=e=>p(e)||"function"==typeof e?.[Symbol.iterator],g="[ 	\n\f\r]",m=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,y=/-->/g,w=/>/g,b=RegExp(`>|${g}(?:([^\\s"'>=/]+)(${g}*=${g}*(?:[^ 	
909\f\r"'\`<>=]|("|')|))|$)`,"g"),v=/'/g,E=/"/g,_=/^(?:script|style|textarea|title)$/i,C=e=>(t,...r)=>({_$litType$:e,strings:t,values:r}),A=C(1),I=C(2),S=(C(3),Symbol.for("lit-noChange")),N=Symbol.for("lit-nothing"),O=new WeakMap,x=u.createTreeWalker(u,129);function T(e,t){if(!p(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==s?s.createHTML(t):t}let R=(e,t)=>{let r=e.length-1,i=[],n,s=2===t?"<svg>":3===t?"<math>":"",c=m;for(let t=0;t<r;t++){let r=e[t],u,h,d=-1,p=0;for(;p<r.length&&(c.lastIndex=p,null!==(h=c.exec(r)));)p=c.lastIndex,c===m?"!--"===h[1]?c=y:void 0!==h[1]?c=w:void 0!==h[2]?(_.test(h[2])&&(n=RegExp("</"+h[2],"g")),c=b):void 0!==h[3]&&(c=b):c===b?">"===h[0]?(c=n??m,d=-1):void 0===h[1]?d=-2:(d=c.lastIndex-h[2].length,u=h[1],c=void 0===h[3]?b:'"'===h[3]?E:v):c===E||c===v?c=b:c===y||c===w?c=m:(c=b,n=void 0);let f=c===b&&e[t+1].startsWith("/>")?" ":"";s+=c===m?r+l:d>=0?(i.push(u),r.slice(0,d)+o+r.slice(d)+a+f):r+a+(-2===d?t:f)}return[T(e,s+(e[r]||"<?>")+(2===t?"</svg>":3===t?"</math>":"")),i]};class P{constructor({strings:e,_$litType$:t},r){let i;this.parts=[];let s=0,l=0,u=e.length-1,d=this.parts,[p,f]=R(e,t);if(this.el=P.createElement(p,r),x.currentNode=this.el.content,2===t||3===t){let e=this.el.content.firstChild;e.replaceWith(...e.childNodes)}for(;null!==(i=x.nextNode())&&d.length<u;){if(1===i.nodeType){if(i.hasAttributes())for(let e of i.getAttributeNames())if(e.endsWith(o)){let t=f[l++],r=i.getAttribute(e).split(a),n=/([.?@])?(.*)/.exec(t);d.push({type:1,index:s,name:n[2],strings:r,ctor:"."===n[1]?L:"?"===n[1]?B:"@"===n[1]?j:U}),i.removeAttribute(e)}else e.startsWith(a)&&(d.push({type:6,index:s}),i.removeAttribute(e));if(_.test(i.tagName)){let e=i.textContent.split(a),t=e.length-1;if(t>0){i.textContent=n?n.emptyScript:"";for(let r=0;r<t;r++)i.append(e[r],h()),x.nextNode(),d.push({type:2,index:++s});i.append(e[t],h())}}}else if(8===i.nodeType){if(i.data===c)d.push({type:2,index:s});else{let e=-1;for(;-1!==(e=i.data.indexOf(a,e+1));)d.push({type:7,index:s}),e+=a.length-1}}s++}}static createElement(e,t){let r=u.createElement("template");return r.innerHTML=e,r}}function k(e,t,r=e,i){if(t===S)return t;let n=void 0!==i?r._$Co?.[i]:r._$Cl,s=d(t)?void 0:t._$litDirective$;return n?.constructor!==s&&(n?._$AO?.(!1),void 0===s?n=void 0:(n=new s(e))._$AT(e,r,i),void 0!==i?(r._$Co??=[])[i]=n:r._$Cl=n),void 0!==n&&(t=k(e,n._$AS(e,t.values),n,i)),t}class D{constructor(e,t){this._$AV=[],this._$AN=void 0,this._$AD=e,this._$AM=t}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(e){let{el:{content:t},parts:r}=this._$AD,i=(e?.creationScope??u).importNode(t,!0);x.currentNode=i;let n=x.nextNode(),s=0,o=0,a=r[0];for(;void 0!==a;){if(s===a.index){let t;2===a.type?t=new M(n,n.nextSibling,this,e):1===a.type?t=new a.ctor(n,a.name,a.strings,this,e):6===a.type&&(t=new $(n,this,e)),this._$AV.push(t),a=r[++o]}s!==a?.index&&(n=x.nextNode(),s++)}return x.currentNode=u,i}p(e){let t=0;for(let r of this._$AV)void 0!==r&&(void 0!==r.strings?(r._$AI(e,r,t),t+=r.strings.length-2):r._$AI(e[t])),t++}}class M{get _$AU(){return this._$AM?._$AU??this._$Cv}
909constructor(e,t,r,i){this.type=2,this._$AH=N,this._$AN=void 0,this._$AA=e,this._$AB=t,this._$AM=r,this.options=i,this._$Cv=i?.isConnected??!0}get parentNode(){let e=this._$AA.parentNode,t=this._$AM;return void 0!==t&&11===e?.nodeType&&(e=t.parentNode),e}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(e,t=this){d(e=k(this,e,t))?e===N||null==e||""===e?(this._$AH!==N&&this._$AR(),this._$AH=N):e!==this._$AH&&e!==S&&this._(e):void 0!==e._$litType$?this.$(e):void 0!==e.nodeType?this.T(e):f(e)?this.k(e):this._(e)}O(e){return this._$AA.parentNode.insertBefore(e,this._$AB)}T(e){this._$AH!==e&&(this._$AR(),this._$AH=this.O(e))}_(e){this._$AH!==N&&d(this._$AH)?this._$AA.nextSibling.data=e:this.T(u.createTextNode(e)),this._$AH=e}$(e){let{values:t,_$litType$:r}=e,i="number"==typeof r?this._$AC(e):(void 0===r.el&&(r.el=P.createElement(T(r.h,r.h[0]),this.options)),r);if(this._$AH?._$AD===i)this._$AH.p(t);else{let e=new D(i,this),r=e.u(this.options);e.p(t),this.T(r),this._$AH=e}}_$AC(e){let t=O.get(e.strings);return void 0===t&&O.set(e.strings,t=new P(e)),t}k(e){p(this._$AH)||(this._$AH=[],this._$AR());let t=this._$AH,r,i=0;for(let n of e)i===t.length?t.push(r=new M(this.O(h()),this.O(h()),this,this.options)):r=t[i],r._$AI(n),i++;i<t.length&&(this._$AR(r&&r._$AB.nextSibling,i),t.length=i)}_$AR(e=this._$AA.nextSibling,t){for(this._$AP?.(!1,!0,t);e&&e!==this._$AB;){let t=e.nextSibling;e.remove(),e=t}}setConnected(e){void 0===this._$AM&&(this._$Cv=e,this._$AP?.(e))}}class U{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(e,t,r,i,n){this.type=1,this._$AH=N,this._$AN=void 0,this.element=e,this.name=t,this._$AM=i,this.options=n,r.length>2||""!==r[0]||""!==r[1]?(this._$AH=Array(r.length-1).fill(new String),this.strings=r):this._$AH=N}_$AI(e,t=this,r,i){let n=this.strings,s=!1;if(void 0===n)(s=!d(e=k(this,e,t,0))||e!==this._$AH&&e!==S)&&(this._$AH=e);else{let i,o;let a=e;for(e=n[0],i=0;i<n.length-1;i++)(o=k(this,a[r+i],t,i))===S&&(o=this._$AH[i]),s||=!d(o)||o!==this._$AH[i],o===N?e=N:e!==N&&(e+=(o??"")+n[i+1]),this._$AH[i]=o}s&&!i&&this.j(e)}j(e){e===N?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,e??"")}}class L extends U{constructor(){super(...arguments),this.type=3}j(e){this.element[this.name]=e===N?void 0:e}}class B extends U{constructor(){super(...arguments),this.type=4}j(e){this.element.toggleAttribute(this.name,!!e&&e!==N)}}class j extends U{constructor(e,t,r,i,n){super(e,t,r,i,n),this.type=5}
909_$AI(e,t=this){if((e=k(this,e,t,0)??N)===S)return;let r=this._$AH,i=e===N&&r!==N||e.capture!==r.capture||e.once!==r.once||e.passive!==r.passive,n=e!==N&&(r===N||i);i&&this.element.removeEventListener(this.name,this,r),n&&this.element.addEventListener(this.name,this,e),this._$AH=e}handleEvent(e){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,e):this._$AH.handleEvent(e)}}class ${constructor(e,t,r){this.element=e,this.type=6,this._$AN=void 0,this._$AM=t,this.options=r}get _$AU(){return this._$AM._$AU}_$AI(e){k(this,e)}}let F={M:o,P:a,A:c,C:1,L:R,R:D,D:f,V:k,I:M,H:U,N:B,U:j,B:L,F:$},q=i.litHtmlPolyfillSupport;q?.(P,M),(i.litHtmlVersions??=[]).push("3.3.0");let z=(e,t,r)=>{let i=r?.renderBefore??t,n=i._$litPart$;if(void 0===n){let e=r?.renderBefore??null;i._$litPart$=n=new M(t.insertBefore(h(),e),e,void 0,r??{})}return n._$AI(e),n}},11469:function(e,t,r){"use strict";r.d(t,{oi:function(){return o},iv:function(){return i.iv},dy:function(){return n.dy},YP:function(){return n.YP},$m:function(){return i.$m}});var i=r(35549),n=r(75969);let s=globalThis;class o extends i.fl{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){let e=super.createRenderRoot();return this.renderOptions.renderBefore??=e.firstChild,e}update(e){let t=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(e),this._$Do=(0,n.sY)(t,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return n.Jb}}o._$litElement$=!0,o.finalized=!0,s.litElementHydrateSupport?.({LitElement:o});let a=s.litElementPolyfillSupport;a?.({LitElement:o}),(s.litElementVersions??=[]).push("4.2.0")},99376:function(e,t,r){"use strict";var i=r(35475);r.o(i,"usePathname")&&r.d(t,{usePathname:function(){return i.usePathname}}),r.o(i,"useRouter")&&r.d(t,{useRouter:function(){return i.useRouter}}),r.o(i,"useSelectedLayoutSegments")&&r.d(t,{useSelectedLayoutSegments:function(){return i.useSelectedLayoutSegments}})},94299:function(e,t,r){"use strict";let i=r(95172);e.exports=s;let n=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){var t,r;(e=e||{}).browser=e.browser||{};let i=e.browser.transmit;if(i&&"function"!=typeof i.send)throw Error("pino: transmit option must have a send function");let u=e.browser.write||n;e.browser.write&&(e.browser.asObject=!0);let h=e.serializers||{},g=Array.isArray(t=e.browser.serialize)?t.filter(function(e){return"!stdSerializers.err"!==e}):!0===t&&Object.keys(h),m=e.browser.serialize;Array.isArray(e.browser.serialize)&&e.browser.serialize.indexOf("!stdSerializers.err")>-1&&(m=!1),"function"==typeof u&&(u.error=u.fatal=u.warn=u.info=u.debug=u.trace=u),!1===e.enabled&&(e.level="silent");let y=e.level||"info",w=Object.create(u);w.log||(w.log=d),Object.defineProperty(w,"levelVal",{get:function(){return"silent"===this.level?1/0:this.levels.values[this.level]}}),Object.defineProperty(w,"level",{get:function(){return this._level},set:function(e){if("silent"!==e&&!this.levels.values[e])throw Error("unknown level "+e);this._level=e,o(b,w,"error","log"),o(b,w,"fatal","error"),o(b,w,"w
909arn","error"),o(b,w,"info","log"),o(b,w,"debug","log"),o(b,w,"trace","log")}});let b={transmit:i,serialize:g,asObject:e.browser.asObject,levels:["error","fatal","warn","info","debug","trace"],timestamp:"function"==typeof(r=e).timestamp?r.timestamp:!1===r.timestamp?p:f};return w.levels=s.levels,w.level=y,w.setMaxListeners=w.getMaxListeners=w.emit=w.addListener=w.on=w.prependListener=w.once=w.prependOnceListener=w.removeListener=w.removeAllListeners=w.listeners=w.listenerCount=w.eventNames=w.write=w.flush=d,w.serializers=h,w._serialize=g,w._stdErrSerialize=m,w.child=function(t,r){if(!t)throw Error("missing bindings for child Pino");r=r||{},g&&t.serializers&&(r.serializers=t.serializers);let n=r.serializers;if(g&&n){var s=Object.assign({},h,n),o=!0===e.browser.serialize?Object.keys(s):g;delete t.serializers,a([t],o,s,this._stdErrSerialize)}function u(e){this._childLevel=(0|e._childLevel)+1,this.error=c(e,t,"error"),this.fatal=c(e,t,"fatal"),this.warn=c(e,t,"warn"),this.info=c(e,t,"info"),this.debug=c(e,t,"debug"),this.trace=c(e,t,"trace"),s&&(this.serializers=s,this._serialize=o),i&&(this._logEvent=l([].concat(e._logEvent.bindings,t)))}return u.prototype=this,new u(this)},i&&(w._logEvent=l()),w}function o(e,t,r,o){let c=Object.getPrototypeOf(t);t[r]=t.levelVal>t.levels.values[r]?d:c[r]?c[r]:n[r]||n[o]||d,function(e,t,r){if(e.transmit||t[r]!==d){var o;t[r]=(o=t[r],function(){let c=e.timestamp(),u=Array(arguments.length),h=Object.getPrototypeOf&&Object.getPrototypeOf(this)===n?n:this;for(var d=0;d<u.length;d++)u[d]=arguments[d];if(e.serialize&&!e.asObject&&a(u,this._serialize,this.serializers,this._stdErrSerialize),e.asObject?o.call(h,function(e,t,r,n){e._serialize&&a(r,e._serialize,e.serializers,e._stdErrSerialize);let o=r.slice(),c=o[0],l={};n&&(l.time=n),l.level=s.levels.values[t];let u=(0|e._childLevel)+1;if(u<1&&(u=1),null!==c&&"object"==typeof c){for(;u--&&"object"==typeof o[0];)Object.assign(l,o.shift());c=o.length?i(o.shift(),o):void 0}else"string"==typeof c&&(c=i(o.shift(),o));return void 0!==c&&(l.msg=c),l}(this,r,u,c)):o.apply(h,u),e.transmit){let i=e.transmit.level||t.level,n=s.levels.values[i],o=s.levels.values[r];if(o<n)return;(function(e,t,r){let i=t.send,n=t.ts,s=t.methodLevel,o=t.methodValue,c=t.val,u=e._logEvent.bindings;a(r,e._serialize||Object.keys(e.serializers),e.serializers,void 0===e._stdErrSerialize||e._stdErrSerialize),e._logEvent.ts=n,e._logEvent.messages=r.filter(function(e){return -1===u.indexOf(e)}),e._logEvent.level.label=s,e._logEvent.level.value=o,i(s,e._logEvent,c),e._logEvent=l(u)})(this,{ts:c,methodLevel:r,methodValue:o,transmitLevel:i,transmitValue:s.levels.values[e.transmit.level||t.level],send:e.transmit.send,val:t.levelVal},u)}})}}(e,t,r)}function a(e,t,r,i){for(let n in e)if(i&&e[n]instanceof Error)e[n]=s.stdSerializers.err(e[n]);else if("object"==typeof e[n]&&!Array.isArray(e[n]))for(let i in e[n])t&&t.indexOf(i)>-1&&i in r&&(e[n][i]=r[i](e[n][i]))}function c(e,t,r){return function(){let i=Array(1+arguments.length);i[0]=t;for(var n=1;n<i.length;n++)i[n]=arguments[n-1];return e[r].apply(this,i)}}function l(e){return{ts:0,messages:[],bindings:e||[],level:{label:"",value:0}}}function u(){return{}}function h(e){return e}function d(){}function p(){return!1}function f(){return Date.now()}s.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"}},s.stdSerializers={mapHttpRequest:u,mapHttpResponse:u,wrapRequestSerializer:h,wrapResponseSerializer:h,wrapErrorSerializer:h,req:u,res:u,err:function(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}},s.stdTimeFunctions=Object.assign({},{nullTime:p,epochTime:f,unixTime:function(){return Math.round(Date.now()/1e3)},isoTime:function(){return new Date(Date.now()).toISOString()}})},95172:function(e){"use strict";function t(e){try{return JSON.stringify(e)}catch(e){return'"[Circular]"'}}e.exports=function(e,r,i){var n=i&&i.stringify||t;if("object"==typeof e&&null!==e){var s=r.length+1;if(1===s)return e;var o=Array(s);o[0]=n(e);for(var a=1;a<s;a++)o[a]=n(r[a]);return o.join(" ")}if("string"!=typeof e)return e;var c=r.length;if(0===c)return e;for(var l="",u=0,h=-1,d=e&&e.length||0,p=0;p<d;){if(37===e.charCodeAt(p)&&p+1<d){switch(h=h>-1?h:0,e.charCodeAt(p+1)){case 100:case 102:if(u>=c||null==r[u])break;h<p&&(l+=e.slice(h,p)),l+=Number(r[u]),h=p+2,p++;break;case 105:if(u>=c||null==r[u])break;h<p&&(l+=e.slice(h,p)),l+=Math.floor(Number(r[u])),h=p+2,p++;break;case 79:case 111:case 106:if(u>=c||void 0===r[u])break;h<p&&(l+=e.slice(h,p));var f=typeof r[u];if("string"===f){l+="'"+r[u]+"'",h=p+2,p++;break}if("function"===f){l+=r[u].name||"<anonymous>",h=p+2,p++;break}l+=n(r[u]),h=p+2,p++;break;case 115:if(u>=c)break;h<p&&(l+=e.slice(h,p)),l+=String(r[u]),h=p+2,p++;break;case 37:h<p&&(l+=e.slice(h,p)),l+="%",h=p+2,p++,u--}++u}++p}return -1===h?e:(h<d&&(l+=e.slice(h)),l)}},5148:function(e,t,r){"use strict";r.d(t,{Ey:function(){return l},XY:function(){return a}});var i=r(82957),n=r(27658),s=r.n(n),o=class extends s(){socket;constructor(e,t,r){super(),this.socket=new window.WebSocket(e,r),this.socket.onopen=()=>
909this.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 i=r||t;try{this.socket.send(e),i()}catch(e){i(e)}}close(e,t){this.socket.close(e,t)}addEventListener(e,t,r){this.socket.addEventListener(e,t,r)}};function a(e,t){return new o(e,t)}var c=class{encode(e){return JSON.stringify(e)}decode(e){return JSON.parse(e)}},l=class extends s(){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:i=!0,reconnect_interval:n=1e3,max_reconnects:s=5,...o}={},a,l){super(),this.webSocketFactory=e,this.queue={},this.rpc_id=0,this.address=t,this.autoconnect=r,this.ready=!1,this.reconnect=i,this.reconnect_timer_id=void 0,this.reconnect_interval=n,this.max_reconnects=s,this.rest_options=o,this.current_reconnects=0,this.generate_request_id=a||(()=>"number"==typeof this.rpc_id?++this.rpc_id:Number(this.rpc_id)+1),l?this.dataPack=l:this.dataPack=new c,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})}
vendor: 2,550 bytes, line 909
909call(e,t,r,i){return i||"object"!=typeof r||(i=r,r=null),new Promise((n,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}),i,e=>{if(e)return s(e);this.queue[o]={promise:[n,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,i)=>{if(!this.ready)return i(Error("socket not ready"));this.socket.send(this.dataPack.encode({jsonrpc:"2.0",method:e,params:t}),e=>{if(e)return i(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.close(e||1e3,t)}setAutoReconnect(e){this.reconnect=e}setReconnectInterval(e){this.reconnect_interval=e}setMaxReconnects(e){this.max_reconnects=e}_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=i.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=>this.emit("error",e)),this.socket.addEventListener("close",({code:r,reason:i})=>{this.ready&&setTimeout(()=>
909this.emit("close",r,i),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)))})}}},27658:function(e){"use strict";var t=Object.prototype.hasOwnProperty,r="~";function i(){}function n(e,t,r){this.fn=e,this.context=t,this.once=r||!1}function s(e,t,i,s,o){if("function"!=typeof i)throw TypeError("The listener must be a function");var a=new n(i,s||e,o),c=r?r+t:t;return e._events[c]?e._events[c].fn?e._events[c]=[e._events[c],a]:e._events[c].push(a):(e._events[c]=a,e._eventsCount++),e}function o(e,t){0==--e._eventsCount?e._events=new i:delete e._events[t]}function a(){this._events=new i,this._eventsCount=0}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(r=!1)),a.prototype.eventNames=function(){var e,i,n=[];if(0===this._eventsCount)return n;for(i in e=this._events)t.call(e,i)&&n.push(r?i.slice(1):i);return Object.getOwnPropertySymbols?n.concat(Object.getOwnPropertySymbols(e)):n},a.prototype.listeners=function(e){var t=r?r+e:e,i=this._events[t];if(!i)return[];if(i.fn)return[i.fn];for(var n=0,s=i.length,o=Array(s);n<s;n++)o[n]=i[n].fn;return o},a.prototype.listenerCount=function(e){var t=r?r+e:e,i=this._events[t];return i?i.fn?1:i.length:0},a.prototype.emit=function(e,t,i,n,s,o){var a=r?r+e:e;if(!this._events[a])return!1;var c,l,u=this._events[a],h=arguments.length;if(u.fn){switch(u.once&&this.removeListener(e,u.fn,void 0,!0),h){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,i),!0;case 4:return u.fn.call(u.context,t,i,n),!0;case 5:return u.fn.call(u.context,t,i,n,s),!0;case 6:return u.fn.call(u.context,t,i,n,s,o),!0}for(l=1,c=Array(h-1);l<h;l++)c[l-1]=arguments[l];u.fn.apply(u.context,c)}else{var d,p=u.length;for(l=0;l<p;l++)switch(u[l].once&&this.removeListener(e,u[l].fn,void 0,!0),h){case 1:u[l].fn.call(u[l].context);break;case 2:u[l].fn.call(u[l].context,t);break;case 3:u[l].fn.call(u[l].context,t,i);break;case 4:u[l].fn.call(u[l].context,t,i,n);break;default:if(!c)for(d=1,c=Array(h-1);d<h;d++)c[d-1]=arguments[d];u[l].fn.apply(u[l].context,c)}}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,i,n){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||n&&!a.once||i&&a.context!==i||o(this,s);else{for(var c=0,l=[],u=a.length;c<u;c++)(a[c].fn!==t||n&&!a[c].once||i&&a[c].context!==i)&&l.push(a[c]);l.length?this._events[s]=1===l.length?l[0]:l: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 i,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},73306:function(e,t,r){var i=r(82957),n=i.Buffer;function s(e,t){for(var r in e)t[r]=e[r]}function o(e,t,r){return n(e,t,r)}n.from&&n.alloc&&n.allocUnsafe&&n.allocUnsafeSlow?e.exports=i:(s(i,t),t.Buffer=o),o.prototype=Object.create(n.prototype),s(n,o),o.from=function(e,t,r){if("number"==typeof e)throw TypeError("Argument must not be a number");return n(e,t,r)},o.alloc=function(e,t,r){if("number"!=typeof e)throw TypeError("Argument must be a number");var i=n(e);return void 0!==t?"string"==typeof r?i.fill(t,r):i.fill(t):i.fill(0),i},o.allocUnsafe=function(e){if("number"!=typeof e)throw TypeError("Argument must be a number");return n(e)},o.allocUnsafeSlow=function(e){if("number"!=typeof e)throw TypeError("Argument must be a number");return i.SlowBuffer(e)}},78710:function(e,t){"use strict";function r(e,t){var r=e.length;for(e.push(t);0<r;){var i=r-1>>>1,n=e[i];if(0<s(n,t))e[i]=t,e[r]=n,r=i;else break}}function i(e){return 0===e.length?null:e[0]}function n(e){if(0===e.length)return null;var t=e[0],r=e.pop();if(r!==t){e[0]=r;for(var i=0,n=e.length,o=n>>>1;i<o;){var a=2*(i+1)-1,c=e[a],l=a+1,u=e[l];if(0>s(c,r))l<n&&0>s(u,c)?(e[i]=u,e[l]=r,i=l):(e[i]=c,e[a]=r,i=a);else if(l<n&&0>s(u,r))e[i]=u,e[l]=r,i=l;else break}}return t}function s(e,t){var r=e.sortIndex-t.sortIndex;return 0!==r?r:e.id-t.id}if(t.unstable_now=void 0,"object"==typeof performance&&"function"==typeof performance.now){var o,a=performance;t.unstable_now=function(){return a.now()}}else{var c=Date,l=c.now();t.unstable_now=function(){return c.now()-l}}var u=[],h=[],d=1,p=null,f=3,g=!1,m=!1,y=!1,w="function"==typeof setTimeout?setTimeout:null,b="function"==typeof clearTimeout?clearTimeout:null,v="undefined"!=typeof setImmediate?setImmediate:null;function E(e){for(var t=i(h);null!==t;){if(null===t.callback)n(h);else if(t.startTime<=e)n(h),t.sortIndex=t.expirationTime,r(u,t);else break;t=i(h)}}function _(e){if(y=!1,E(e),!m){if(null!==i(u))m=!0,R();else{var t=i(h);null!==t&&P(_,t.startTime-e)}}}var C=!1,A=-1,I=5,S=-1;function N(){return!(t.unstable_now()-S<I)}function O(){if(C){var e=t.unstable_now();S=e;var r=!0;try{e:{m=!1,y&&(y=!1,b(A),A=-1),g=!0;var s=f;try{t:{for(E(e),p=i(u);null!==p&&!(p.expirationTime>e&&N());){var a=p.callback;if("function"==typeof a){p.callback=null,f=p.priorityLevel;var c=a(p.expirationTime<=e);if(e=t.unstable_now(),"function"==typeof c){p.callback=c,E(e),r=!0;break t}p===i(u)&&n(u),E(e)}else n(u);p=i(u)}if(null!==p)r=!0;else{var l=i(h);null!==l&&P(_,l.startTime-e),r=!1}}break e}finally{p=null,f=s,g=!1}r=void 0}}finally{r?o():C=!1}}}if("function"==typeof v)o=function(){v(O)};else if("undefined"!=typeof MessageChannel){var x=new MessageChannel,T=x.port2;x.port1.onmessage=O,o=function(){T.postMessage(null)}}else o=function(){w(O,0)};function R(){C||(C=!0,o())}function P(e,r){A=w(function(){e(t.unstable_now())},r)}t.unstable_IdlePriority=5,t.unstable_ImmediatePriority=1,t.unstable_LowPriority=4,t.unstable_NormalPriority=3,t.unstable_Profiling=null,t.unstable_UserBlockingPriority=2,t.unstable_cancelCallback=function(e){e.callback=null},t.unstable_continueExecution=function(){m||g||(m=!0,R())},t.unstable_forceFrameRate=function(e){0>e||125<e?console.error("forceFrameRate takes a positive int between 0 and 125, forcing frame rates higher than 125 fps is not supported"):I=0<e?Math.floor(1e3/e):5},t.unstable_getCurrentPriorityLevel=function(){return f},t.unstable_getFirstCallbackNode=function(){return i(u)},t.unstable_next=function(e){switch(f){case 1:case 2:case 3:var t=3;break;default:t=f}var r=f;f=t;try{return e()}finally{f=r}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(e,t){switch(e){case 1:case 2:case 3:case 4:case 5:break;default:e=3}var r=f;f=e;try{return t()}finally{f=r}},t.unstable_scheduleCallback=function(e,n,s){var o=t.unstable_now();switch(s="object"==typeof s&&null!==s&&"number"==typeof(s=s.delay)&&0<s?o+s:o,e){case 1:var a=-1;break;case 2:a=250;break;case 5:a=1073741823;break;case 4:a=1e4;break;default:a=5e3}return a=s+a,e={id:d++,callback:n,priorityLevel:e,startTime:s,expirationTime:a,sortIndex:-1},s>o?(e.sortIndex=s,r(h,e),null===i(u)&&e===i(h)&&(y?(b(A),A=-1):y=!0,P(_,s-o))):(e.sortIndex=a,r(u,e),m||g||(m=!0,R())),e},t.unstable_shouldYield=N,t.unstable_wrapCallback=function(e){var t=f;return function(){var r=f;f=t;try{return e.apply(this,arguments)}finally{f=r}}}},16697:function(e,t,r){"use strict";e.exports=r(78710)},94312:function(e,t,r){"use strict";r.d(t,{AG:function(){return w},G0:function(){return I},IM:function(){return E},IX:function(){return f},O7:function(){return g},Rx:function(){return b},Ue:function(){return u},Yj:function(){return p},Z_:function(){return _},_4:function(){return S},bc:function(){return C},dt:function(){return A},eE:function(){return m},i0:function(){return y},jt:function(){return v},oQ:function(){return N}});class i extends TypeError{constructor(e,t){let r;let{message:i,explanation:n,...s}=e,{path:o}=e,a=0===o.length?i:`At path: ${o.join(".")} -- ${i}`;super(n??a),null!=n&&(this.cause=a),Object.assign(this,s),this.name=this.constructor.name,this.failures=()=>r??(r=[e,...t()])}}function n(e){return"object"==typeof e&&null!=e}function s(e){return n(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,i){var s;for(let a of(n(s=e)&&"function"==typeof s[Symbol.iterator]||(e=[e]),e)){let e=function(e,t,r,i){if(!0===e)return;!1===e?e={}:"string"==typeof e&&(e={message:e});let{path:n,branch:s}=t,{type:a}=r,{refinement:c,message:l=`Expected a value of type \`${a}\`${c?` with refinement \`${c}\``:""}, but received: \`${o(i)}\``}=e;return{value:i,type:a,refinement:c,key:n[n.length-1],path:n,branch:s,...e,message:l}}(a,t,r,i);e&&(yield e)}}function*c(e,t,r={}){let{path:i=[],branch:s=[e],coerce:o=!1,mask:a=!1}=r,l={path:i,branch:s,mask:a};o&&(e=t.coercer(e,l));let u="valid";for(let i of t.validator(e,l))i.explanation=r.message,u="not_val
909id",yield[i,void 0];for(let[h,d,p]of t.entries(e,l))for(let t of c(d,p,{path:void 0===h?i:[...i,h],branch:void 0===h?s:[...s,d],coerce:o,mask:a,message:r.message}))t[0]?(u=null!=t[0].refinement?"not_refined":"not_valid",yield[t[0],void 0]):o&&(d=t[1],void 0===h?e=d:e instanceof Map?e.set(h,d):e instanceof Set?e.add(d):n(e)&&(void 0!==d||h in e)&&(e[h]=d));if("not_valid"!==u)for(let i of t.refiner(e,l))i.explanation=r.message,u="not_refined",yield[i,void 0];"valid"===u&&(yield[void 0,e])}class l{constructor(e){let{type:t,schema:r,validator:i,refiner:n,coercer:s=e=>e,entries:o=function*(){}}=e;this.type=t,this.schema=r,this.entries=o,this.coercer=s,i?this.validator=(e,t)=>a(i(e,t),t,this,e):this.validator=()=>[],n?this.refiner=(e,t)=>a(n(e,t),t,this,e):this.refiner=()=>[]}assert(e,t){return function(e,t,r){let i=h(e,t,{message:r});if(i[0])throw i[0]}(e,this,t)}create(e,t){return u(e,this,t)}is(e){return!h(e,this)[0]}mask(e,t){return function(e,t,r){let i=h(e,t,{coerce:!0,mask:!0,message:r});if(!i[0])return i[1];throw i[0]}(e,this,t)}validate(e,t={}){return h(e,this,t)}}function u(e,t,r){let i=h(e,t,{coerce:!0,message:r});if(!i[0])return i[1];throw i[0]}function h(e,t,r={}){let n=c(e,t,r),s=function(e){let{done:t,value:r}=e.next();return t?void 0:r}(n);return s[0]?[new i(s[0],function*(){for(let e of n)e[0]&&(yield e[0])}),void 0]:[void 0,s[1]]}function d(e,t){return new l({type:e,schema:null,validator:t})}function p(){return d("any",()=>!0)}function f(e){return new l({type:"array",schema:e,*entries(t){if(e&&Array.isArray(t))for(let[r,i]of t.entries())yield[r,i,e]},coercer:e=>Array.isArray(e)?e.slice():e,validator:e=>Array.isArray(e)||`Expected an array value, but received: ${o(e)}`})}function g(){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 y(e){let t=o(e),r=typeof e;return new l({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 l({...e,validator:(t,r)=>null===t||e.validator(t,r),refiner:(t,r)=>null===t||e.refiner(t,r)})}function b(){return d("number",e=>"number"==typeof e&&!isNaN(e)||`Expected a number, but received: ${o(e)}`)}function v(e){return new l({...e,validator:(t,r)=>void 0===t||e.validator(t,r),refiner:(t,r)=>void 0===t||e.refiner(t,r)})}function E(e,t){return new l({type:"record",schema:null,*entries(r){if(n(r))for(let i in r){let n=r[i];yield[i,i,e],yield[i,n,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 C(e){let t=d("never",()=>!1);return new l({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){let i=Math.max(e.length,r.length);for(let n=0;n<i;n++)yield[n,r[n],e[n]||t]}},validator:e=>Array.isArray(e)||`Expected an array, but received: ${o(e)}`,coercer:e=>Array.isArray(e)?e.slice():e})}function A(e){let t=Object.keys(e);return new l({type:"type",schema:e,*entries(r){if(n(r))for(let i of t)yield[i,r[i],e[i]]},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 l({type:"union",schema:null,coercer(t,r){for(let i of e){let[e,n]=i.validate(t,{coerce:!0,mask:r.mask});if(!e)return n}return t},validator(r,i){let n=[];for(let t of e){let[...e]=c(r,t,i),[s]=e;if(!s[0])return[];for(let[t]of e)t&&n.push(t)}return[`Expected the value to satisfy a union of \`${t}\`, but received: ${o(r)}`,...n]}})}function S(){return d("unknown",()=>!0)}function N(e,t,r){return new l({...e,coercer:(i,n)=>h(i,t)[0]?e.coercer(i,n):e.coercer(r(i,n),n)})}},2997:function(e,t,r){"use strict";r.d(t,{m6:function(){return G}});let i=e=>{let t=a(e),{conflictingClassGroups:r,conflictingClassGroupModifiers:i}=e;return{getClassGroupId:e=>{let r=e.split("-");return""===r[0]&&1!==r.length&&r.shift(),n(r,t)||o(e)},getConflictingClassGroupIds:(e,t)=>{let n=r[e]||[];return t&&i[e]?[...n,...i[e]]:n}}},n=(e,t)=>{if(0===e.length)return t.classGroupId;let r=e[0],i=t.nextPart.get(r),s=i?n(e.slice(1),i):void 0;if(s)return s;if(0===t.validators.length)return;let o=e.join("-");return t.validators.find(({validator:e})=>e(o))?.classGroupId},s=/^\[(.+)\]$/,o=e=>{if(s.test(e)){let t=s.exec(e)[1],r=t?.substring(0,t.indexOf(":"));if(r)return"arbitrary.."+r}},a=e=>{let{theme:t,prefix:r}=e,i={nextPart:new Map,validators:[]};return h(Object.entries(e.classGroups),r).forEach(([e,r])=>{c(r,i,e,t)}),i},c=(e,t,r,i)=>
909{e.forEach(e=>{if("string"==typeof e){(""===e?t:l(t,e)).classGroupId=r;return}if("function"==typeof e){if(u(e)){c(e(i),t,r,i);return}t.validators.push({validator:e,classGroupId:r});return}Object.entries(e).forEach(([e,n])=>{c(n,l(t,e),r,i)})})},l=(e,t)=>{let r=e;return t.split("-").forEach(e=>{r.nextPart.has(e)||r.nextPart.set(e,{nextPart:new Map,validators:[]}),r=r.nextPart.get(e)}),r},u=e=>e.isThemeGetter,h=(e,t)=>t?e.map(([e,r])=>[e,r.map(e=>"string"==typeof e?t+e:"object"==typeof e?Object.fromEntries(Object.entries(e).map(([e,r])=>[t+e,r])):e)]):e,d=e=>{if(e<1)return{get:()=>void 0,set:()=>{}};let t=0,r=new Map,i=new Map,n=(n,s)=>{r.set(n,s),++t>e&&(t=0,i=r,r=new Map)};return{get(e){let t=r.get(e);return void 0!==t?t:void 0!==(t=i.get(e))?(n(e,t),t):void 0},set(e,t){r.has(e)?r.set(e,t):n(e,t)}}},p=e=>{let{separator:t,experimentalParseClassName:r}=e,i=1===t.length,n=t[0],s=t.length,o=e=>{let r;let o=[],a=0,c=0;for(let l=0;l<e.length;l++){let u=e[l];if(0===a){if(u===n&&(i||e.slice(l,l+s)===t)){o.push(e.slice(c,l)),c=l+s;continue}if("/"===u){r=l;continue}}"["===u?a++:"]"===u&&a--}let l=0===o.length?e:e.substring(c),u=l.startsWith("!"),h=u?l.substring(1):l;return{modifiers:o,hasImportantModifier:u,baseClassName:h,maybePostfixModifierPosition:r&&r>c?r-c:void 0}};return r?e=>r({className:e,parseClassName:o}):o},f=e=>{if(e.length<=1)return e;let t=[],r=[];return e.forEach(e=>{"["===e[0]?(t.push(...r.sort(),e),r=[]):r.push(e)}),t.push(...r.sort()),t},g=e=>({cache:d(e.cacheSize),parseClassName:p(e),...i(e)}),m=/\s+/,y=(e,t)=>{let{parseClassName:r,getClassGroupId:i,getConflictingClassGroupIds:n}=t,s=[],o=e.trim().split(m),a="";for(let e=o.length-1;e>=0;e-=1){let t=o[e],{modifiers:c,hasImportantModifier:l,baseClassName:u,maybePostfixModifierPosition:h}=r(t),d=!!h,p=i(d?u.substring(0,h):u);if(!p){if(!d||!(p=i(u))){a=t+(a.length>0?" "+a:a);continue}d=!1}let g=f(c).join(":"),m=l?g+"!":g,y=m+p;if(s.includes(y))continue;s.push(y);let w=n(p,d);for(let e=0;e<w.length;++e){let t=w[e];s.push(m+t)}a=t+(a.length>0?" "+a:a)}return a};function w(){let e,t,r=0,i="";for(;r<arguments.length;)(e=arguments[r++])&&(t=b(e))&&(i&&(i+=" "),i+=t);return i}let b=e=>{let t;if("string"==typeof e)return e;let r="";for(let i=0;i<e.length;i++)e[i]&&(t=b(e[i]))&&(r&&(r+=" "),r+=t);return r},v=e=>{let t=t=>t[e]||[];return t.isThemeGetter=!0,t},E=/^\[(?:([a-z-]+):)?(.+)\]$/i,_=/^\d+\/\d+$/,C=new Set(["px","full","screen"]),A=/^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/,I=/\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/,S=/^(rgba?|hsla?|hwb|(ok)?(lab|lch))\(.+\)$/,N=/^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/,O=/^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/,x=e=>R(e)||C.has(e)||_.test(e),T=e=>H(e,"length",W),R=e=>!!e&&!Number.isNaN(Number(e)),P=e=>H(e,"number",R),k=e=>!!e&&Number.isInteger(Number(e)),D=e=>e.endsWith("%")&&R(e.slice(0,-1)),M=e=>E.test(e),U=e=>A.test(e),L=new Set(["length","size","percentage"]),B=e=>H(e,L,V),j=e=>H(e,"position",V),$=new Set(["image","url"]),F=e=>H(e,$,Z),q=e=>H(e,"",K),z=()=>!0,H=(e,t,r)=>{let i=E.exec(e);return!!i&&(i[1]?"string"==typeof t?i[1]===t:t.has(i[1]):r(i[2]))},W=e=>I.test(e)&&!S.test(e),V=()=>!1,K=e=>N.test(e),Z=e=>O.test(e),G=function(e,...t){let r,i,n;let s=function(a){return i=(r=g(t.reduce((e,t)=>t(e),e()))).cache.get,n=r.cache.set,s=o,o(a)};function o(e){let t=i(e);if(t)return t;let s=y(e,r);return n(e,s),s}return function(){return s(w.apply(null,arguments))}}(()=>{let e=v("colors"),t=v("spacing"),r=v("blur"),i=v("brightness"),n=v("borderColor"),s=v("borderRadius"),o=v("borderSpacing"),a=v("borderWidth"),c=v("contrast"),l=v("grayscale"),u=v("hueRotate"),h=v("invert"),d=v("gap"),p=v("gradientColorStops"),f=v("gradientColorStopPositions"),g=v("inset"),m=v("margin"),y=v("opacity"),w=v("padding"),b=v("saturate"),E=v("scale"),_=v("sepia"),C=v("skew"),A=v("space"),I=v("translate"),S=()=>["auto","contain","none"],N=()=>["auto","hidden","clip","visible","scroll"],O=()=>["auto",M,t],L=()=>[M,t],$=()=>["",x,T],H=()=>["auto",R,M],W=()=>["bottom","center","left","left-bottom","left-top","right","right-bottom","right-top","top"],
vendor: 6,832 bytes, line 909
909V=()=>["solid","dashed","dotted","double","none"],K=()=>["normal","multiply","screen","overlay","darken","lighten","color-dodge","color-burn","hard-light","soft-light","difference","exclusion","hue","saturation","color","luminosity"],Z=()=>["start","end","center","between","around","evenly","stretch"],G=()=>["","0",M],Y=()=>["auto","avoid","all","avoid-page","page","left","right","column"],J=()=>[R,M];return{cacheSize:500,separator:":",theme:{colors:[z],spacing:[x,T],blur:["none","",U,M],brightness:J(),borderColor:[e],borderRadius:["none","","full",U,M],borderSpacing:L(),borderWidth:$(),contrast:J(),grayscale:G(),hueRotate:J(),invert:G(),gap:L(),gradientColorStops:[e],gradientColorStopPositions:[D,T],inset:O(),margin:O(),opacity:J(),padding:L(),saturate:J(),scale:J(),sepia:G(),skew:J(),space:L(),translate:L()},classGroups:{aspect:[{aspect:["auto","square","video",M]}],container:["container"],columns:[{columns:[U]}],"break-after":[{"break-after":Y()}],"break-before":[{"break-before":Y()}],"break-inside":[{"break-inside":["auto","avoid","avoid-page","avoid-column"]}],"box-decoration":[{"box-decoration":["slice","clone"]}],box:[{box:["border","content"]}],display:["block","inline-block","inline","flex","inline-flex","table","inline-table","table-caption","table-cell","table-column","table-column-group","table-footer-group","table-header-group","table-row-group","table-row","flow-root","grid","inline-grid","contents","list-item","hidden"],float:[{float:["right","left","none","start","end"]}],clear:[{clear:["left","right","both","none","start","end"]}],isolation:["isolate","isolation-auto"],"object-fit":[{object:["contain","cover","fill","none","scale-down"]}],"object-position":[{object:[...W(),M]}],overflow:[{overflow:N()}],"overflow-x":[{"overflow-x":N()}],"overflow-y":[{"overflow-y":N()}],overscroll:[{overscroll:S()}],"overscroll-x":[{"overscroll-x":S()}],"overscroll-y":[{"overscroll-y":S()}],position:["static","fixed","absolute","relative","sticky"],inset:[{inset:[g]}],"inset-x":[{"inset-x":[g]}],"inset-y":[{"inset-y":[g]}],start:[{start:[g]}],end:[{end:[g]}],top:[{top:[g]}],right:[{right:[g]}],bottom:[{bottom:[g]}],left:[{left:[g]}],visibility:["visible","invisible","collapse"],z:[{z:["auto",k,M]}],basis:[{basis:O()}],"flex-direction":[{flex:["row","row-reverse","col","col-reverse"]}],"flex-wrap":[{flex:["wrap","wrap-reverse","nowrap"]}],flex:[{flex:["1","auto","initial","none",M]}],grow:[{grow:G()}],shrink:[{shrink:G()}],order:[{order:["first","last","none",k,M]}],"grid-cols":[{"grid-cols":[z]}],"col-start-end":[{col:["auto",{span:["full",k,M]},M]}],"col-start":[{"col-start":H()}],"col-end":[{"col-end":H()}],"grid-rows":[{"grid-rows":[z]}],"row-start-end":[{row:["auto",{span:[k,M]},M]}],"row-start":[{"row-start":H()}],"row-end":[{"row-end":H()}],"grid-flow":[{"grid-flow":["row","col","dense","row-dense","col-dense"]}],"auto-cols":[{"auto-cols":["auto","min","max","fr",M]}],"auto-rows":[{"auto-rows":["auto","min","max","fr",M]}],gap:[{gap:[d]}],"gap-x":[{"gap-x":[d]}],"gap-y":[{"gap-y":[d]}],"justify-content":[{justify:["normal",...Z()]}],"justify-items":[{"justify-items":["start","end","center","stretch"]}],"justify-self":[{"justify-self":["auto","start","end","center","stretch"]}],"align-content":[{content:["normal",...Z(),"baseline"]}],"align-items":[{items:["start","end","center","baseline","stretch"]}],"align-self":[{self:["auto","start","end","center","stretch","baseline"]}],"place-content":[{"place-content":[...Z(),"baseline"]}],"place-items":[{"place-items":["start","end","center","baseline","stretch"]}],"place-self":[{"place-self":["auto","start","end","center","stretch"]}],p:[{p:[w]}],px:[{px:[w]}],py:[{py:[w]}],ps:[{ps:[w]}],pe:[{pe:[w]}],pt:[{pt:[w]}],pr:[{pr:[w]}],pb:[{pb:[w]}],pl:[{pl:[w]}],m:[{m:[m]}],mx:[{mx:[m]}],my:[{my:[m]}],ms:[{ms:[m]}],me:[{me:[m]}],mt:[{mt:[m]}],mr:[{mr:[m]}],mb:[{mb:[m]}],ml:[{ml:[m]}],"space-x":[{"space-x":[A]}],"space-x-reverse":["space-x-reverse"],"space-y":[{"space-y":[A]}],"space-y-reverse":["space-y-reverse"],w:[{w:["auto","min","max","fit","svw","lvw","dvw",M,t]}],"min-w":[{"min-w":[M,t,"min","max","fit"]}],"max-w":[{"max-w":[M,t,"none","full","min","max","fit","prose",{screen:[U]},U]}],h:[{h:[M,t,"auto","min","max","fit","svh","lvh","dvh"]}],"min-h":[{"min-h":[M,t,"min","max","fit","svh","lvh","dvh"]}],"max-h":[{"max-h":[M,t,"min","max","fit","svh","lvh","dvh"]}],size:[{size:[M,t,"auto","min","max","fit"]}],"font-size":[{text:["base",U,T]}],"font-smoothing":["antialiased","subpixel-antialiased"],"font-style":["italic","not-italic"],"font-weight":[{font:["thin","extralight","light","normal","medium","semibold","bold","extrabold","black",P]}],"font-family":[{font:[z]}],"fvn-normal":["normal-nums"],"fvn-ordinal":["ordinal"],"fvn-slashed-zero":["slashed-zero"],"fvn-figure":["lining-nums","oldstyle-nums"],"fvn-spacing":["proportional-nums","tabular-nums"],"fvn-fraction":["diagonal-fractions","stacked-fractions"],tracking:[{tracking:["tighter","tight","normal","wide","wider","widest",M]}],"line-clamp":[{"line-clamp":["none",R,P]}],leading:[{leading:["none","tight","snug","normal","relaxed","loose",x,M]}],"list-image":[{"list-image":["none",M]}],"list-style-type":[{list:["none","disc","decimal",M]}],"list-style-position":[{list:["inside","outside"]}],"placeholder-color":[{placeholder:[e]}],"placeholder-opacity":[{"placeholder-opacity":[y]}],"text-alignment":[{text:["left","center","right","justify","start","end"]}],"text-color":[{text:[e]}],"text-opacity":[{"text-opacity":[y]}],"text-decoration":["underline","overline","line-through","no-underline"],"text-decoration-style":[{decoration:[...V(),"wavy"]}],"text-decoration-thickness":[{decoration:["auto","from-font",x,T]}],"underline-offset":[{"underline-offset":["auto",x,M]}],"text-decoration-color":[{decoration:[e]}],"text-transform":["uppercase","lowercase","capitalize","normal-case"],"text-overflow":["truncate","text-ellipsis","text-clip"],"text-wrap":[{text:["wrap","nowrap","balance","pretty"]}],indent:[{indent:L()}],"vertical-align":[{align:["baseline","top","middle","bottom","text-top","text-bottom","sub","super",M]}],whitespace:[{whitespace:["normal","nowrap","pre","pre-line","pre-wrap","break-spaces"]}],break:[{break:["normal","words","all","keep"]}],hyphens:[{hyphens:["none","manual","auto"]}],content:[{content:["none",M]}],"bg-attachment":[{bg:["fixed","local","scroll"]}],"bg-clip":[{"bg-clip":["border","padding","content","text"]}],"bg-opacity":[{"bg-opacity":[y]}],"bg-origin":[{"bg-origin":["border","padding","content"]}],"bg-position":[{bg:[...W(),j]}],"bg-repeat":[{bg:["no-repeat",{repeat:["","x","y","round","space"]}]}],"bg-size":[{bg:["auto","cover","contain",B]}],"bg-image":[{bg:["none",{"gradient-to":["t","tr","r","br","b","bl","l","tl"]},F]}],"bg-color":[{bg:[e]}],"gradient-from-pos":[{from:[f]}
909],"gradient-via-pos":[{via:[f]}],"gradient-to-pos":[{to:[f]}],"gradient-from":[{from:[p]}],"gradient-via":[{via:[p]}],"gradient-to":[{to:[p]}],rounded:[{rounded:[s]}],"rounded-s":[{"rounded-s":[s]}],"rounded-e":[{"rounded-e":[s]}],"rounded-t":[{"rounded-t":[s]}],"rounded-r":[{"rounded-r":[s]}],"rounded-b":[{"rounded-b":[s]}],"rounded-l":[{"rounded-l":[s]}],"rounded-ss":[{"rounded-ss":[s]}],"rounded-se":[{"rounded-se":[s]}],"rounded-ee":[{"rounded-ee":[s]}],"rounded-es":[{"rounded-es":[s]}],"rounded-tl":[{"rounded-tl":[s]}],"rounded-tr":[{"rounded-tr":[s]}],"rounded-br":[{"rounded-br":[s]}],"rounded-bl":[{"rounded-bl":[s]}],"border-w":[{border:[a]}],"border-w-x":[{"border-x":[a]}],"border-w-y":[{"border-y":[a]}],"border-w-s":[{"border-s":[a]}],"border-w-e":[{"border-e":[a]}],"border-w-t":[{"border-t":[a]}],"border-w-r":[{"border-r":[a]}],"border-w-b":[{"border-b":[a]}],"border-w-l":[{"border-l":[a]}],"border-opacity":[{"border-opacity":[y]}],"border-style":[{border:[...V(),"hidden"]}],"divide-x":[{"divide-x":[a]}],"divide-x-reverse":["divide-x-reverse"],"divide-y":[{"divide-y":[a]}],"divide-y-reverse":["divide-y-reverse"],"divide-opacity":[{"divide-opacity":[y]}
vendor: 4,445 bytes, line 909
909],"divide-style":[{divide:V()}],"border-color":[{border:[n]}],"border-color-x":[{"border-x":[n]}],"border-color-y":[{"border-y":[n]}],"border-color-s":[{"border-s":[n]}],"border-color-e":[{"border-e":[n]}],"border-color-t":[{"border-t":[n]}],"border-color-r":[{"border-r":[n]}],"border-color-b":[{"border-b":[n]}],"border-color-l":[{"border-l":[n]}],"divide-color":[{divide:[n]}],"outline-style":[{outline:["",...V()]}],"outline-offset":[{"outline-offset":[x,M]}],"outline-w":[{outline:[x,T]}],"outline-color":[{outline:[e]}],"ring-w":[{ring:$()}],"ring-w-inset":["ring-inset"],"ring-color":[{ring:[e]}],"ring-opacity":[{"ring-opacity":[y]}],"ring-offset-w":[{"ring-offset":[x,T]}],"ring-offset-color":[{"ring-offset":[e]}],shadow:[{shadow:["","inner","none",U,q]}],"shadow-color":[{shadow:[z]}],opacity:[{opacity:[y]}],"mix-blend":[{"mix-blend":[...K(),"plus-lighter","plus-darker"]}],"bg-blend":[{"bg-blend":K()}],filter:[{filter:["","none"]}],blur:[{blur:[r]}],brightness:[{brightness:[i]}],contrast:[{contrast:[c]}],"drop-shadow":[{"drop-shadow":["","none",U,M]}],grayscale:[{grayscale:[l]}],"hue-rotate":[{"hue-rotate":[u]}],invert:[{invert:[h]}],saturate:[{saturate:[b]}],sepia:[{sepia:[_]}],"backdrop-filter":[{"backdrop-filter":["","none"]}],"backdrop-blur":[{"backdrop-blur":[r]}],"backdrop-brightness":[{"backdrop-brightness":[i]}],"backdrop-contrast":[{"backdrop-contrast":[c]}],"backdrop-grayscale":[{"backdrop-grayscale":[l]}],"backdrop-hue-rotate":[{"backdrop-hue-rotate":[u]}],"backdrop-invert":[{"backdrop-invert":[h]}],"backdrop-opacity":[{"backdrop-opacity":[y]}],"backdrop-saturate":[{"backdrop-saturate":[b]}],"backdrop-sepia":[{"backdrop-sepia":[_]}],"border-collapse":[{border:["collapse","separate"]}],"border-spacing":[{"border-spacing":[o]}],"border-spacing-x":[{"border-spacing-x":[o]}],"border-spacing-y":[{"border-spacing-y":[o]}],"table-layout":[{table:["auto","fixed"]}],caption:[{caption:["top","bottom"]}],transition:[{transition:["none","all","","colors","opacity","shadow","transform",M]}],duration:[{duration:J()}],ease:[{ease:["linear","in","out","in-out",M]}],delay:[{delay:J()}],animate:[{animate:["none","spin","ping","pulse","bounce",M]}],transform:[{transform:["","gpu","none"]}],scale:[{scale:[E]}],"scale-x":[{"scale-x":[E]}],"scale-y":[{"scale-y":[E]}],rotate:[{rotate:[k,M]}],"translate-x":[{"translate-x":[I]}],"translate-y":[{"translate-y":[I]}],"skew-x":[{"skew-x":[C]}],"skew-y":[{"skew-y":[C]}],"transform-origin":[{origin:["center","top","top-right","right","bottom-right","bottom","bottom-left","left","top-left",M]}],accent:[{accent:["auto",e]}],appearance:[{appearance:["none","auto"]}],cursor:[{cursor:["auto","default","pointer","wait","text","move","help","not-allowed","none","context-menu","progress","cell","crosshair","vertical-text","alias","copy","no-drop","grab","grabbing","all-scroll","col-resize","row-resize","n-resize","e-resize","s-resize","w-resize","ne-resize","nw-resize","se-resize","sw-resize","ew-resize","ns-resize","nesw-resize","nwse-resize","zoom-in","zoom-out",M]}],"caret-color":[{caret:[e]}],"pointer-events":[{"pointer-events":["none","auto"]}],resize:[{resize:["none","y","x",""]}],"scroll-behavior":[{scroll:["auto","smooth"]}],"scroll-m":[{"scroll-m":L()}],"scroll-mx":[{"scroll-mx":L()}],"scroll-my":[{"scroll-my":L()}],"scroll-ms":[{"scroll-ms":L()}],"scroll-me":[{"scroll-me":L()}],"scroll-mt":[{"scroll-mt":L()}],"scroll-mr":[{"scroll-mr":L()}],"scroll-mb":[{"scroll-mb":L()}],"scroll-ml":[{"scroll-ml":L()}],"scroll-p":[{"scroll-p":L()}],"scroll-px":[{"scroll-px":L()}],"scroll-py":[{"scroll-py":L()}],"scroll-ps":[{"scroll-ps":L()}],"scroll-pe":[{"scroll-pe":L()}],"scroll-pt":[{"scroll-pt":L()}],"scroll-pr":[{"scroll-pr":L()}],"scroll-pb":[{"scroll-pb":L()}],"scroll-pl":[{"scroll-pl":L()}],"snap-align":[{snap:["start","end","center","align-none"]}],"snap-stop":[{snap:["normal","always"]}],"snap-type":[{snap:["none","x","y","both"]}],"snap-strictness":[{snap:["mandatory","proximity"]}],touch:[{touch:["auto","none","manipulation"]}],"touch-x":[{"touch-pan":["x","left","right"]}],"touch-y":[{"touch-pan":["y","up","down"]}],"touch-pz":["touch-pinch-zoom"],select:[{select:["none","text","all","auto"]}],"will-change":[{"will-change":["auto","scroll","contents","transform",M]}],fill:[{fill:[e,"none"]}],"stroke-w":[{stroke:[x,T,P]}],stroke:[{stroke:[e,"none"]}],sr:["sr-only","not-sr-only"],"forced-color-adjust":[{"forced-color-adjust":["auto","
909none"]}]},conflictingClassGroups:{overflow:["overflow-x","overflow-y"],overscroll:["overscroll-x","overscroll-y"],inset:["inset-x","inset-y","start","end","top","right","bottom","left"],"inset-x":["right","left"],"inset-y":["top","bottom"],flex:["basis","grow","shrink"],gap:["gap-x","gap-y"],p:["px","py","ps","pe","pt","pr","pb","pl"],px:["pr","pl"],py:["pt","pb"],m:["mx","my","ms","me","mt","mr","mb","ml"],mx:["mr","ml"],my:["mt","mb"],size:["w","h"],"font-size":["leading"],"fvn-normal":["fvn-ordinal","fvn-slashed-zero","fvn-figure","fvn-spacing","fvn-fraction"],"fvn-ordinal":["fvn-normal"],"fvn-slashed-zero":["fvn-normal"],"fvn-figure":["fvn-normal"],"fvn-spacing":["fvn-normal"],"fvn-fraction":["fvn-normal"],"line-clamp":["display","overflow"],rounded:["rounded-s","rounded-e","rounded-t","rounded-r","rounded-b","rounded-l","rounded-ss","rounded-se","rounded-ee","rounded-es","rounded-tl","rounded-tr","rounded-br","rounded-bl"],"rounded-s":["rounded-ss","rounded-es"],"rounded-e":["rounded-se","rounded-ee"],"rounded-t":["rounded-tl","rounded-tr"],"rounded-r":["rounded-tr","rounded-br"],"rounded-b":["rounded-br","rounded-bl"],"rounded-l":["rounded-tl","rounded-bl"],"border-spacing":["border-spacing-x","border-spacing-y"],"border-w":["border-w-s","border-w-e","border-w-t","border-w-r","border-w-b","border-w-l"],"border-w-x":["border-w-r","border-w-l"],"border-w-y":["border-w-t","border-w-b"],"border-color":["border-color-s","border-color-e","border-color-t","border-color-r","border-color-b","border-color-l"],"border-color-x":["border-color-r","border-color-l"],"border-color-y":["border-color-t","border-color-b"],"scroll-m":["scroll-mx","scroll-my","scroll-ms","scroll-me","scroll-mt","scroll-mr","scroll-mb","scroll-ml"],"scroll-mx":["scroll-mr","scroll-ml"],"scroll-my":["scroll-mt","scroll-mb"],"scroll-p":["scroll-px","scroll-py","scroll-ps","scroll-pe","scroll-pt","scroll-pr","scroll-pb","scroll-pl"],"scroll-px":["scroll-pr","scroll-pl"],"scroll-py":["scroll-pt","scroll-pb"],touch:["touch-x","touch-y","touch-pz"],"touch-x":["touch"],"touch-y":["touch"],"touch-pz":["touch"]},conflictingClassGroupModifiers:{"font-size":["leading"]}}})},65768:function(e,t){"use strict";function r(e,t,r){return t<=e&&e<=r}function i(e){if(void 0===e)return{};if(e===Object(e))return e;throw TypeError("Could not convert argument to dictionary")}function n(e){this.tokens=[].slice.call(e)}function s(e,t){if(e)throw TypeError("Decoder error");return t||65533}n.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);
vendor: 3,841 bytes, line 909
909if((e=void 0!==e?String(e).toLowerCase():o)!==o)throw Error("Encoding not supported. Only utf-8 is supported");t=i(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 c(e,t){if(!(this instanceof c))return new c(e,t);if((e=void 0!==e?String(e).toLowerCase():o)!==o)throw Error("Encoding not supported. Only utf-8 is supported");t=i(t),this._streaming=!1,this._encoder=null,this._options={fatal:!!t.fatal},Object.defineProperty(this,"encoding",{value:"utf-8"})}function l(e){var t=e.fatal,i=0,n=0,o=0,a=128,c=191;this.handler=function(e,l){if(-1===l&&0!==o)return o=0,s(t);if(-1===l)return -1;if(0===o){if(r(l,0,127))return l;if(r(l,194,223))o=1,i=l-192;else if(r(l,224,239))224===l&&(a=160),237===l&&(c=159),o=2,i=l-224;else{if(!r(l,240,244))return s(t);240===l&&(a=144),244===l&&(c=143),o=3,i=l-240}return i<<=6*o,null}if(!r(l,a,c))return i=o=n=0,a=128,c=191,e.prepend(l),s(t);if(a=128,c=191,n+=1,i+=l-128<<6*(o-n),n!==o)return null;var u=i;return i=o=n=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)?(i=1,n=192):r(t,2048,65535)?(i=2,n=224):r(t,65536,1114111)&&(i=3,n=240);for(var i,n,s=[(t>>6*i)+n];i>0;){var o=t>>6*(i-1);s.push(128|63&o),i-=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=i(t),this._streaming||(this._decoder=new l({fatal:this._fatal}),this._BOMseen=!1),this._streaming=!!t.stream;for(var r,s,o=new n(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 i=e[r];i<=65535?t+=String.fromCharCode(i):(i-=65536,t+=String.fromCharCode((i>>10)+55296,(1023&i)+56320))}return t}(a)}},c.prototype={encode:function(e,t){e=e?String(e):"",t=i(t),this._streaming||(this._encoder=new u(this._options)),this._streaming=!!t.stream;for(var r,s=[],o=new n(function(e){for(var t=String(e),r=t.length,i=0,n=[];i<r;){var s=t.charCodeAt(i);if(s<55296||s>57343)n.push(s);else if(56320<=s&&s<=57343)n.push(65533);else if(55296<=s&&s<=56319){if(i===r-1)n.push(65533);else{var o=e.charCodeAt(i+1);if(56320<=o&&o<=57343){var a=1023&s,c=1023&o;n.push(65536+(a<<10)+c),i+=1}else n.push(65533)}}i+=1}return n}(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=c,t.TextDecoder=a},33509:function(e,t,r){"use strict";r.r(t),r.d(t,{__assign:function(){return s},__asyncDelegator:function(){return v},__asyncGenerator:function(){return b},__asyncValues:function(){return E},__await:function(){return w},__awaiter:function(){return u},__classPrivateFieldGet:function(){return I},__classPrivateFieldSet:function(){return S},__createBinding:function(){return d},__decorate:function(){return a},__exportStar:function(){return p},__extends:function(){return n},__generator:function(){return h},__importDefault:function(){return A},__importStar:function(){return C}
909,__makeTemplateObject:function(){return _},__metadata:function(){return l},__param:function(){return c},__read:function(){return g},__rest:function(){return o},__spread:function(){return m},__spreadArrays:function(){return y},__values:function(){return f}});var i=function(e,t){return(i=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 n(e,t){function r(){this.constructor=e}i(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,i=arguments.length;r<i;r++)for(var n in t=arguments[r])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)};function o(e,t){var r={};for(var i in e)Object.prototype.hasOwnProperty.call(e,i)&&0>t.indexOf(i)&&(r[i]=e[i]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols)for(var n=0,i=Object.getOwnPropertySymbols(e);n<i.length;n++)0>t.indexOf(i[n])&&Object.prototype.propertyIsEnumerable.call(e,i[n])&&(r[i[n]]=e[i[n]]);return r}function a(e,t,r,i){var n,s=arguments.length,o=s<3?t:null===i?i=Object.getOwnPropertyDescriptor(t,r):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,i);else for(var a=e.length-1;a>=0;a--)(n=e[a])&&(o=(s<3?n(o):s>3?n(t,r,o):n(t,r))||o);return s>3&&o&&Object.defineProperty(t,r,o),o}function c(e,t){return function(r,i){t(r,i,e)}}function l(e,t){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(e,t)}
909function u(e,t,r,i){return new(r||(r=Promise))(function(n,s){function o(e){try{c(i.next(e))}catch(e){s(e)}}function a(e){try{c(i.throw(e))}catch(e){s(e)}}function c(e){var t;e.done?n(e.value):((t=e.value)instanceof r?t:new r(function(e){e(t)})).then(o,a)}c((i=i.apply(e,t||[])).next())})}function h(e,t){var r,i,n,s,o={label:0,sent:function(){if(1&n[0])throw n[1];return n[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,i&&(n=2&s[0]?i.return:s[0]?i.throw||((n=i.return)&&n.call(i),0):i.next)&&!(n=n.call(i,s[1])).done)return n;switch(i=0,n&&(s=[2&s[0],n.value]),s[0]){case 0:case 1:n=s;break;case 4:return o.label++,{value:s[1],done:!1};case 5:o.label++,i=s[1],s=[0];continue;case 7:s=o.ops.pop(),o.trys.pop();continue;default:if(!(n=(n=o.trys).length>0&&n[n.length-1])&&(6===s[0]||2===s[0])){o=0;continue}if(3===s[0]&&(!n||s[1]>n[0]&&s[1]<n[3])){o.label=s[1];break}if(6===s[0]&&o.label<n[1]){o.label=n[1],n=s;break}if(n&&o.label<n[2]){o.label=n[2],o.ops.push(s);break}n[2]&&o.ops.pop(),o.trys.pop();continue}s=t.call(e,o)}catch(e){s=[6,e],i=0}finally{r=n=0}if(5&s[0])throw s[1];return{value:s[0]?s[1]:void 0,done:!0}}([s,a])}}}function d(e,t,r,i){void 0===i&&(i=r),e[i]=t[r]}function p(e,t){for(var r in e)"default"===r||t.hasOwnProperty(r)||(t[r]=e[r])}function f(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],i=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&i>=e.length&&(e=void 0),{value:e&&e[i++],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 i,n,s=r.call(e),o=[];try{for(;(void 0===t||t-- >0)&&!(i=s.next()).done;)o.push(i.value)}catch(e){n={error:e}}finally{try{i&&!i.done&&(r=s.return)&&r.call(s)}finally{if(n)throw n.error}}return o}function m(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(g(arguments[t]));return e}function y(){for(var e=0,t=0,r=arguments.length;t<r;t++)e+=arguments[t].length;for(var i=Array(e),n=0,t=0;t<r;t++)for(var s=arguments[t],o=0,a=s.length;o<a;o++,n++)i[n]=s[o];return i}function w(e){return this instanceof w?(this.v=e,this):new w(e)}function b(e,t,r){if(!Symbol.asyncIterator)throw TypeError("Symbol.asyncIterator is not defined.");var i,n=r.apply(e,t||[]),s=[];return i={},o("next"),o("throw"),o("return"),i[Symbol.asyncIterator]=function(){return this},i;function o(e){n[e]&&(i[e]=function(t){return new Promise(function(r,i){s.push([e,t,r,i])>1||a(e,t)})})}function a(e,t){try{var r;(r=n[e](t)).value instanceof w?Promise.resolve(r.value.v).then(c,l):u(s[0][2],r)}catch(e){u(s[0][3],e)}}function c(e){a("next",e)}function l(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={},i("next"),i("throw",function(e){throw e}),i("return"),t[Symbol.iterator]=function(){return this},t;function i(i,n){t[i]=e[i]?function(t){return(r=!r)?{value:w(e[i](t)),done:"return"===i}:n?n(t):t}:n}}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=f(e),t={},i("next"),i("throw"),i("return"),t[Symbol.asyncIterator]=function(){return this},t);function i(r){t[r]=e[r]&&function(t){return new Promise(function(i,n){!function(e,t,r,i){Promise.resolve(i).then(function(t){e({value:t,done:r})},t)}(i,n,(t=e[r](t)).done,t.value)})}}}function _(e,t){return Object.defineProperty?Object.defineProperty(e,"raw",{value:t}):e.raw=t,e}function C(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 I(e,t){if(!t.has(e))throw TypeError("attempted to get private field on non-instance");return t.get(e)}function S(e,t,r){if(!t.has(e))throw TypeError("attempted to set private field on non-instance");return t.set(e,r),r}},71381:function(e,t,r){"use strict";r.d(t,{kr:function(){return d},qp:function(){return p}});var i=r(2265),n=r(16697),s=r(54887);r(25566);let o=Symbol(),a=Symbol(),c="undefined"==typeof window||/ServerSideRendering/.test(window.navigator&&window.navigator.userAgent)?i.useEffect:i.useLayoutEffect,l=n.unstable_runWithPriority?e=>{try{(0,n.unstable_runWithPriority)(n.unstable_NormalPriority,e)}catch(t){if("Not implemented."===t.message)e();else throw t}}:e=>e(),u=e=>({value:t,children:r})=>{let n=(0,i.useRef)(t),a=(0,i.useRef)(0),[u,h]=(0,i.useState)(null);u&&(u(t),h(null));let d=(0,i.useRef)();if(!d.current){let e=new Set;d.current={[o]:{v:n,n:a,l:e,u:(t,r)=>{(0,s.unstable_batchedUpdates)(()=>{a.current+=1;let i={n:a.current};null!=r&&r.suspense&&(i.n*=-1,i.p=new Promise(e=>{h(()=>t=>{i.v=t,delete i.p,e(t)})}
909)),e.forEach(e=>e(i)),t()})}}}}return c(()=>{n.current=t,a.current+=1,l(()=>{d.current[o].l.forEach(e=>{e({n:a.current,v:t})})})},[t]),(0,i.createElement)(e,{value:d.current},r)},h=e=>e;function d(e){let t=(0,i.createContext)({[o]:{v:{current:e},n:{current:-1},l:new Set,u:e=>e()}});return t[a]=t.Provider,t.Provider=u(t.Provider),delete t.Consumer,t}function p(e){return function(e,t){let{v:{current:r},n:{current:n},l:s}=(0,i.useContext)(e)[o],a=t(r),[l,u]=(0,i.useReducer)((e,i)=>{if(!i)return[r,a];if("p"in i)throw i.p;if(i.n===n)return Object.is(e[1],a)?e:[r,a];try{if("v"in i){if(Object.is(e[0],i.v))return e;let r=t(i.v);if(Object.is(e[1],r))return e;return[i.v,r]}}catch(e){}return[...e]},[r,a]);return Object.is(l[1],a)||u(),c(()=>(s.add(u),()=>{s.delete(u)}),[s]),l[1]}(e,h)}},31147:function(e,t,r){"use strict";r.d(t,{sj:function(){return p},iH:function(){return m},CO:function(){return g},Ld:function(){return f}}),Symbol();let i=Symbol(),n=Object.getPrototypeOf,s=new WeakMap,o=e=>e&&(s.has(e)?s.get(e):n(e)===Object.prototype||n(e)===Array.prototype),a=e=>o(e)&&e[i]||null,c=(e,t=!0)=>{s.set(e,t)},l=e=>"object"==typeof e&&null!==e,u=new WeakMap,h=new WeakSet,[d]=((e=Object.is,t=(e,t)=>new Proxy(e,t),r=e=>l(e)&&!h.has(e)&&(Array.isArray(e)||!(Symbol.iterator in e))&&!(e instanceof WeakMap)&&!(e instanceof WeakSet)&&!(e instanceof Error)&&!(e instanceof Number)&&!(e instanceof Date)&&!(e instanceof String)&&!(e instanceof RegExp)&&!(e instanceof ArrayBuffer),i=e=>{switch(e.status){case"fulfilled":return e.value;case"rejected":throw e.reason;default:throw e}},n=new WeakMap,s=(e,t,r=i)=>{let o=n.get(e);if((null==o?void 0:o[0])===t)return o[1];let a=Array.isArray(e)?[]:Object.create(Object.getPrototypeOf(e));return c(a,!0),n.set(e,[t,a]),Reflect.ownKeys(e).forEach(t=>{if(Object.getOwnPropertyDescriptor(a,t))return;let i=Reflect.get(e,t),{enumerable:n}=Reflect.getOwnPropertyDescriptor(e,t),o={value:i,enumerable:n,configurable:!0};if(h.has(i))c(i,!1);else if(i instanceof Promise)delete o.value,o.get=()=>r(i);else if(u.has(i)){let[e,t]=u.get(i);o.value=s(e,t(),r)}Object.defineProperty(a,t,o)}),Object.preventExtensions(a)},o=new WeakMap,d=[1,1],p=i=>{if(!l(i))throw Error("object required");let n=o.get(i);if(n)return n;let c=d[0],f=new Set,g=(e,t=++d[0])=>{c!==t&&(c=t,f.forEach(r=>r(e,t)))},m=d[1],y=(e=++d[1])=>(m===e||f.size||(m=e,b.forEach(([t])=>{let r=t[1](e);r>c&&(c=r)})),c),w=e=>(t,r)=>{let i=[...t];i[1]=[e,...i[1]],g(i,r)},b=new Map,v=(e,t)=>{if(b.has(e))throw Error("prop listener already exists");if(f.size){let r=t[3](w(e));b.set(e,[t,r])}else b.set(e,[t])},E=e=>{var t;let r=b.get(e);r&&(b.delete(e),null==(t=r[1])||t.call(r))},_=e=>{f.add(e),1===f.size&&b.forEach(([e,t],r)=>{if(t)throw Error("remove already exists");let i=e[3](w(r));b.set(r,[e,i])});let t=()=>{f.delete(e),0===f.size&&b.forEach(([e,t],r)=>{t&&(t(),b.set(r,[e]))})};return t},C=Array.isArray(i)?[]:Object.create(Object.getPrototypeOf(i)),A={deleteProperty(e,t){let r=Reflect.get(e,t);E(t);let i=Reflect.deleteProperty(e,t);return i&&g(["delete",[t],r]),i},set(t,i,n,s){let c=Reflect.has(t,i),d=Reflect.get(t,i,s);if(c&&(e(d,n)||o.has(n)&&e(d,o.get(n))))return!0;E(i),l(n)&&(n=a(n)||n);let f=n;if(n instanceof Promise)n.then(e=>{n.status="fulfilled",n.value=e,g(["resolve",[i],e])}).catch(e=>{n.status="rejected",n.reason=e,g(["reject",[i],e])});else{!u.has(n)&&r(n)&&(f=p(n));let e=!h.has(f)&&u.get(f);e&&v(i,e)}return Reflect.set(t,i,f,s),g(["set",[i],n,d]),!0}},I=t(C,A);o.set(i,I);let S=[C,y,s,_];
909return u.set(I,S),Reflect.ownKeys(i).forEach(e=>{let t=Object.getOwnPropertyDescriptor(i,e);"value"in t&&(I[e]=i[e],delete t.value,delete t.writable),Object.defineProperty(C,e,t)}),I})=>[p,u,h,e,t,r,i,n,s,o,d])();function p(e={}){return d(e)}function f(e,t,r){let i;let n=u.get(e);n||console.warn("Please use proxy object");let s=[],o=n[3],a=!1,c=o(e=>{if(s.push(e),r){t(s.splice(0));return}i||(i=Promise.resolve().then(()=>{i=void 0,a&&t(s.splice(0))}))});return a=!0,()=>{a=!1,c()}}function g(e,t){let r=u.get(e);r||console.warn("Please use proxy object");let[i,n,s]=r;return s(i,n(),t)}function m(e){return h.add(e),e}},54322:function(e,t,r){"use strict";r.d(t,{VW:function(){return n},Yr:function(){return s}});var i=r(31147);function n(e,t,r,n){let s=e[t];return(0,i.Ld)(e,()=>{let i=e[t];Object.is(s,i)||r(s=i)},n)}function s(e){let t=(0,i.sj)({data:Array.from(e||[]),has(e){return this.data.some(t=>t[0]===e)},set(e,t){let r=this.data.find(t=>t[0]===e);return r?r[1]=t:this.data.push([e,t]),this},get(e){var t;return null==(t=this.data.find(t=>t[0]===e))?void 0:t[1]},delete(e){let t=this.data.findIndex(t=>t[0]===e);return -1!==t&&(this.data.splice(t,1),!0)},clear(){this.data.splice(0)},get size(){return this.data.length},toJSON(){return new Map(this.data)},forEach(e){this.data.forEach(t=>{e(t[1],t[0],this)})},keys(){return this.data.map(e=>e[0]).values()},values(){return this.data.map(e=>e[1]).values()},entries(){return new Map(this.data).entries()},get[Symbol.toStringTag](){return"Map"},[Symbol.iterator](){return this.entries()}});return Object.defineProperties(t,{data:{enumerable:!1},size:{enumerable:!1},toJSON:{enumerable:!1}}),Object.seal(t),t}Symbol()},57074:function(){},43642:function(e){e.exports={style:{fontFamily:"'__cabinet_921754', '__cabinet_Fallback_921754'"},className:"__className_921754",variable:"__variable_921754"}},40058:function(e){e.exports={style:{fontFamily:"'__poppins_d68f1f', '__poppins_Fallback_d68f1f'"},className:"__className_d68f1f",variable:"__variable_d68f1f"}}}]);

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.