PageSourceSearch

https://blocksurvey.aiin-action.ai/2030.d4f89cf3bcc39a4b.js

js aiin-action.ai collected 2026-10-05 11:51:30 UTC 929,393 bytes, 193 lines download raw bytes

1(self.webpackChunkblocksurvey=self.webpackChunkblocksurvey||[]).push([[832,2030],{72684(Ve,ne){"use strict";function u(){return(null==global?void 0:global.crypto)||(null==global?void 0:global.msCrypto)||{}}function S(){const K=u();return K.subtle||K.webkitSubtle}Object.defineProperty(ne,"__esModule",{value:!0}),ne.isBrowserCryptoAvailable=ne.getSubtleCrypto=ne.getBrowerCrypto=void 0,ne.getBrowerCrypto=u,ne.getSubtleCrypto=S,ne.isBrowserCryptoAvailable=function P(){return!!u()&&!!S()}},50998(Ve,ne){"use strict";function u(){return typeof document>"u"&&typeof navigator<"u"&&"ReactNative"===navigator.product}function S(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}Object.defineProperty(ne,"__esModule",{value:!0}),ne.isBrowser=ne.isNode=ne.isReactNative=void 0,ne.isReactNative=u,ne.isNode=S,ne.isBrowser=function P(){return!u()&&!S()}},23601(Ve,ne,u){"use strict";Object.defineProperty(ne,"__esModule",{value:!0});const S=u(98186);S.__exportStar(u(72684),ne),S.__exportStar(u(50998),ne)},22173(Ve){"use strict";Ve.exports=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}},23429(Ve,ne,u){"use strict";u.d(ne,{D5:()=>dn,U5:()=>Ut,iP:()=>Oe,oI:()=>it});var S={exports:{}};function P(me){try{return JSON.stringify(me)}catch{return'"[Circular]"'}}const j=function m(me,_e,Ue){var vt=Ue&&Ue.stringify||P;if("object"==typeof me&&null!==me){var Bt=_e.length+1;if(1===Bt)return me;var Qt=new Array(Bt);Qt[0]=vt(me);for(var Gt=1;Gt<Bt;Gt++)Qt[Gt]=vt(_e[Gt]);return Qt.join(" ")}if("string"!=typeof me)return me;var Ct=_e.length;if(0===Ct)return me;for(var ht="",Mt=0,Ht=-1,At=me&&me.length||0,Vt=0;Vt<At;){if(37===me.charCodeAt(Vt)&&Vt+1<At){switch(Ht=Ht>-1?Ht:0,me.charCodeAt(Vt+1)){case 100:case 102:if(Mt>=Ct||null==_e[Mt])break;Ht<Vt&&(ht+=me.slice(Ht,Vt)),ht+=Number(_e[Mt]),Ht=Vt+2,Vt++;break;case 105:if(Mt>=Ct||null==_e[Mt])break;Ht<Vt&&(ht+=me.slice(Ht,Vt)),ht+=Math.floor(Number(_e[Mt])),Ht=Vt+2,Vt++;break;case 79:case 111:case 106:if(Mt>=Ct||void 0===_e[Mt])break;Ht<Vt&&(ht+=me.slice(Ht,Vt));var Fr=typeof _e[Mt];if("string"===Fr){ht+="'"+_e[Mt]+"'",Ht=Vt+2,Vt++;break}if("function"===Fr){ht+=_e[Mt].name||"<anonymous>",Ht=Vt+2,Vt++;break}ht+=vt(_e[Mt]),Ht=Vt+2,Vt++;break;case 115:if(Mt>=Ct)break;Ht<Vt&&(ht+=me.slice(Ht,Vt)),ht+=String(_e[Mt]),Ht=Vt+2,Vt++;break;case 37:Ht<Vt&&(ht+=me.slice(Ht,Vt)),ht+="%",Ht=Vt+2,Vt++,Mt--}++Mt}++Vt}return-1===Ht?me:(Ht<At&&(ht+=me.slice(Ht)),ht)};S.exports=l;const R=function Ae(){function me(_e){return typeof _e<"u"&&_e}try{return typeof globalThis<"u"||Object.defineProperty(Object.prototype,"globalThis",{get:function(){return delete Object.prototype.globalThis,this.globalThis=this},configurable:!0}),globalThis}catch{return me(self)||me(window)||me(this)||{}}}().console||{},k={mapHttpRequest:w,mapHttpResponse:w,wrapRequestSerializer:C,wrapResponseSerializer:C,wrapErrorSerializer:C,req:w,res:w,err:E,errWithCause:E};function v(me,_e){return"silent"===me?1/0:_e.levels.values[me]}const $=Symbol("pino.logFuncs"),x=Symbol("pino.hierarchy"),U={error:"log",fatal:"error",warn:"error",info:"log",debug:"log",trace:"log"};function X(me,_e){_e[x]={logger:_e,parent:me[x]}}function l(me){(me=me||{}).browser=me.browser||{};const _e=me.browser.transmit;if(_e&&"function"!=typeof _e.send)throw Error("pino: transmit option must have a send function");const Ue=me.browser.write||R;me.browser.write&&(me.browser.asObject=!0);const vt=me.serializers||{},xt=function p(me,_e){return Array.isArray(me)?me.filter(function(Ue){return"!stdSerializers.err"!==Ue}):!0===me&&Object.keys(_e)}(me.browser.serialize,vt);let Bt=me.browser.serialize;Array.isArray(me.browser.serialize)&&me.browser.serialize.indexOf("!stdSerializers.err")>-1&&(Bt=!1);const Qt=Object.keys(me.customLevels||{}),Gt=["error","fatal","warn","info","debug","trace"].concat(Qt);"function"==typeof Ue&&Gt.forEach(function(wn){Ue[wn]=Ue}),(!1===me.enabled||me.browser.disabled)&&(me.level="silent");const Ct=me.level||"info",ht=Object.create(Ue);ht.log||(ht.log=y),function B(me,_e,Ue){const vt={};_e.forEach(xt=>{vt[xt]=Ue[xt]?Ue[xt]:R[xt]||R[U[xt]||"log"]||y}),me[$]=vt}(ht,Gt,Ue),X({},ht),Object.defineProperty(ht,"levelVal",{get:function Ht(){return v(this.level,this)}}),Object.defineProperty(ht,"level",{get:function At(){return this._level},set:function Vt(wn){if("silent"!==wn&&!this.levels.values[wn])throw Error("unknown level "+wn);this._level=wn,I(this,Mt,ht,"error"),I(this,Mt,ht,"fatal"),I(this,Mt,ht,"warn"),I(this,Mt,ht,"info"),I(this,Mt,ht,"debug"),I(this,Mt,ht,"trace"),Qt.forEach(lr=>{I(this,Mt,ht,lr)})}});const Mt={transmit:_e,serialize:xt,asObject:me.browser.asObject,asObjectBindingsOnly:me.browser.asObjectBindingsOnly,formatters:me.browser.formatters,levels:Gt,timestamp:g(me),messageKey:me.messageKey||"msg",onChild:me.onChild||y};function Fr(wn,lr,ts){if(!lr)throw new Error("missing bindings for child Pino");ts=ts||{},xt&&lr.serializers&&(ts.serializers=lr.serializers);const Js=ts.serializers;if(xt&&Js){var Cs=Object.assign({},vt,Js),Ci=!0===me.browser.serialize?Object.keys(Cs):xt;delete lr.serializers,T([lr],Ci,Cs,this._stdErrSerialize)}function Ai(As){this._childLevel=1+(0|As._childLevel),this.bindings=lr,Cs&&(this.serializers=Cs,this._serialize=Ci),_e&&(this._logEvent=A([].concat(As._logEvent.bindings,lr)))}Ai.prototype=this;const ns=new Ai(this);return X(this,ns),ns.child=function(...As){return Fr.call(this,wn,...As)},ns.level=ts.level||this.level,wn.onChild(ns),ns}return ht.levels=function O(me){const _e=me.customLevels||{},Ue=Object.assign({},l.levels.values,_e),vt=Object.assign({},l.levels.labels,function L(me){const _e={};return Object.keys(me).forEach(function(Ue){_e[me[Ue]]=Ue}),_e}(_e));return{values:Ue,labels:vt}}
1(me),ht.level=Ct,ht.isLevelEnabled=function(wn){return!!this.levels.values[wn]&&this.levels.values[wn]>=this.levels.values[this.level]},ht.setMaxListeners=ht.getMaxListeners=ht.emit=ht.addListener=ht.on=ht.prependListener=ht.once=ht.prependOnceListener=ht.removeListener=ht.removeAllListeners=ht.listeners=ht.listenerCount=ht.eventNames=ht.write=ht.flush=y,ht.serializers=vt,ht._serialize=xt,ht._stdErrSerialize=Bt,ht.child=function(...wn){return Fr.call(this,Mt,...wn)},_e&&(ht._logEvent=A()),ht}function I(me,_e,Ue,vt){if(Object.defineProperty(me,vt,{value:v(me.level,Ue)>v(vt,Ue)?y:Ue[$][vt],writable:!0,enumerable:!0,configurable:!0}),me[vt]===y){if(!_e.transmit)return;const Qt=v(_e.transmit.level||me.level,Ue);if(v(vt,Ue)<Qt)return}me[vt]=function H(me,_e,Ue,vt){return function(xt){return function(){const Bt=_e.timestamp(),Qt=new Array(arguments.length),Gt=Object.getPrototypeOf&&Object.getPrototypeOf(this)===R?R:this;for(var Ct=0;Ct<Qt.length;Ct++)Qt[Ct]=arguments[Ct];var ht=!1;if(_e.serialize&&(T(Qt,this._serialize,this.serializers,this._stdErrSerialize),ht=!0),_e.asObject||_e.formatters?xt.call(Gt,...function z(me,_e,Ue,vt,xt){const{level:Bt,log:Qt=Ht=>Ht}=xt.formatters||{},Gt=Ue.slice();let Ct=Gt[0];const ht={};let Mt=1+(0|me._childLevel);if(Mt<1&&(Mt=1),vt&&(ht.time=vt),Bt){const Ht=Bt(_e,me.levels.values[_e]);Object.assign(ht,Ht)}else ht.level=me.levels.values[_e];if(xt.asObjectBindingsOnly){if(null!==Ct&&"object"==typeof Ct)for(;Mt--&&"object"==typeof Gt[0];)Object.assign(ht,Gt.shift());return[Qt(ht),...Gt]}if(null!==Ct&&"object"==typeof Ct){for(;Mt--&&"object"==typeof Gt[0];)Object.assign(ht,Gt.shift());Ct=Gt.length?j(Gt.shift(),Gt):void 0}else"string"==typeof Ct&&(Ct=j(Gt.shift(),Gt));return void 0!==Ct&&(ht[xt.messageKey]=Ct),[Qt(ht)]}(this,vt,Qt,Bt,_e)):xt.apply(Gt,Qt),_e.transmit){const Mt=_e.transmit.level||me._level,Ht=v(Mt,Ue),At=v(vt,Ue);if(At<Ht)return;!function W(me,_e,Ue,vt=!1){const xt=_e.send,Bt=_e.ts,Qt=_e.methodLevel,Gt=_e.methodValue,Ct=_e.val,ht=me._logEvent.bindings;vt||T(Ue,me._serialize||Object.keys(me.serializers),me.serializers,void 0===me._stdErrSerialize||me._stdErrSerialize),me._logEvent.ts=Bt,me._logEvent.messages=Ue.filter(function(Mt){return-1===ht.indexOf(Mt)}),me._logEvent.level.label=Qt,me._logEvent.level.value=Gt,xt(Qt,me._logEvent,Ct),me._logEvent=A(ht)}(this,{ts:Bt,methodLevel:vt,methodValue:At,transmitLevel:Mt,transmitValue:Ue.levels.values[_e.transmit.level||me._level],send:_e.transmit.send,val:v(me._level,Ue)},Qt,ht)}}}(me[$][vt])}(me,_e,Ue,vt);const xt=function _(me){const _e=[];me.bindings&&_e.push(me.bindings);let Ue=me[x];for(;Ue.parent;)Ue=Ue.parent,Ue.logger.bindings&&_e.push(Ue.logger.bindings);return _e.reverse()}(me);0!==xt.length&&(me[vt]=function D(me,_e){return function(){return _e.apply(this,[...me,...arguments])}}(xt,me[vt]))}function T(me,_e,Ue,vt){for(const xt in me)if(vt&&me[xt]instanceof Error)me[xt]=l.stdSerializers.err(me[xt]);else if("object"==typeof me[xt]&&!Array.isArray(me[xt])&&_e)for(const Bt in me[xt])_e.indexOf(Bt)>-1&&Bt in Ue&&(me[xt][Bt]=Ue[Bt](me[xt][Bt]))}function A(me){return{ts:0,messages:[],bindings:me||[],level:{label:"",value:0}}}function E(me){const _e={type:me.constructor.name,msg:me.message,stack:me.stack};for(const Ue in me)void 0===_e[Ue]&&(_e[Ue]=me[Ue]);return _e}function g(me){return"function"==typeof me.timestamp?me.timestamp:!1===me.timestamp?F:Q}function w(){return{}}function C(me){return me}function y(){}function F(){return!1}function Q(){return Date.now()}l.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"}},l.stdSerializers=k,l.stdTimeFunctions=Object.assign({},{nullTime:F,epochTime:Q,unixTime:function ge(){return Math.round(Date.now()/1e3)},isoTime:function ce(){return new Date(Date.now()).toISOString()}}),S.exports.default=l,S.exports.pino=l;const We="custom_context",Ke=1024e3;var Et=Object.defineProperty,Pt=(me,_e,Ue)=>((me,_e,Ue)=>_e in me?Et(me,_e,{enumerable:!0,configurable:!0,writable:!0,value:Ue}):me[_e]=Ue)(me,"symbol"!=typeof _e?_e+"":_e,Ue);class wt{constructor(_e){Pt(this,"nodeValue"),Pt(this,"sizeInBytes"),Pt(this,"next"),this.nodeValue=_e,this.sizeInBytes=(new TextEncoder).encode(this.nodeValue).length,this.next=null}get value(){return this.nodeValue}get size(){return this.sizeInBytes}}class at{constructor(_e){Pt(this,"lengthInNodes"),Pt(this,"sizeInBytes"),Pt(this,"head"),Pt(this,"tail"),Pt(this,"maxSizeInBytes"),this.head=null,this.tail=null,this.lengthInNodes=0,this.maxSizeInBytes=_e,this.sizeInBytes=0}append(_e){const Ue=new wt(_e);if(Ue.size>this.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${_e} with size ${Ue.size}`);for(;this.size+Ue.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=Ue),this.tail=Ue):(this.head=Ue,this.tail=Ue),this.lengthInNodes++,this.sizeInBytes+=Ue.size}shift(){if(!this.head)return;const _e=this.head;this.head=this.head.next,this.head||(this.tail=null),this.lengthInNodes--,this.sizeInBytes-=_e.size}toArray(){const _e=[];let Ue=this.head;for(;null!==Ue;)_e.push(Ue.value),Ue=Ue.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};const Ue=_e.value;return _e=_e.next,{done:!1,value:Ue}}}}}function tt(me){return"string"==typeof me?me:(me=>JSON.stringify(me,(_e,Ue)=>"bigint"==typeof Ue?Ue.toString()+"n":Ue))(me)||""}var nt=Object.defineProperty,Nt=(me,_e,Ue)=>((me,_e,Ue)=>_e in me?nt(me,_e,{enumerable:!0,configurable:!0,writable:!0,value:Ue}):me[_e]=Ue)(me,"symbol"!=typeof _e?_e+"":_e,Ue);class Le{constructor(_e,Ue=Ke){Nt(this,"logs"),Nt(this,"level"),Nt(this,"levelValue"),Nt(this,"MAX_LOG_SIZE_IN_BYTES"),this.level=_e??"error",this.levelValue=S.exports.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=Ue,this.logs=new at(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(_e,Ue){Ue===S.exports.levels.values.error?console.error(_e):Ue===S.exports.levels.values.warn?console.warn(_e):Ue===S.exports.levels.values.debug?console.debug(_e):Ue===S.exports.levels.values.trace?console.trace(_e):console.log(_e)}appendToLogs(_e){this.logs.append(tt({timestamp:(new Date).toISOString(),log:_e}));const Ue="string"==typeof _e?JSON.parse(_e).level:_e.level;Ue>=this.levelValue&&this.forwardToConsole(_e,Ue)}getLogs(){return this.logs}clearLogs(){this.logs=new at(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(_e){const Ue=this.getLogArray();return Ue.push(tt({extraMetadata:_e})),new Blob(Ue,{type:"application/json"})}}var ct=Object.defineProperty;class bt{constructor(_e,Ue=Ke){((me,_e,Ue)=>{((me,_e,Ue)=>{_e in me?ct(me,_e,{enumerable:!0,configurable:!0,writable:!0,value:Ue}):me[_e]=Ue})(me,"symbol"!=typeof _e?_e+"":_e,Ue)})(this,"baseChunkLogger"),this.baseChunkLogger=new Le(_e,Ue)}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){const Ue=URL.createObjectURL(this.logsToBlob(_e)),vt=document.createElement("a");vt.href=Ue,vt.download=`walletconnect-logs-${(new Date).toISOString()}.txt`,document.body.appendChild(vt),vt.click(),document.body.removeChild(vt),URL.revokeObjectURL(Ue)}}var Xe=Object.defineProperty;class Tt{constructor(_e,Ue=Ke){((me,_e,Ue)=>{((me,_e,Ue)=>{_e in me?Xe(me,_e,{enumerable:!0,configurable:!0,writable:!0,value:Ue}):me[_e]=Ue})(me,"symbol"!=typeof _e?_e+"":_e,Ue)})(this,"baseChunkLogger"),this.baseChunkLogger=new Le(_e,Ue)}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 Ft=Object.defineProperty,rn=Object.defineProperties,bn=Object.getOwnPropertyDescriptors,qe=Object.getOwnPropertySymbols,N=Object.prototype.hasOwnProperty,Y=Object.prototype.propertyIsEnumerable,Z=(me,_e,Ue)=>_e in me?Ft(me,_e,{enumerable:!0,configurable:!0,writable:!0,value:Ue}):me[_e]=Ue,ie=(me,_e)=>{for(var Ue in _e||(_e={}))N.call(_e,Ue)&&Z(me,Ue,_e[Ue]);if(qe)for(var Ue of qe(_e))Y.call(_e,Ue)&&Z(me,Ue,_e[Ue]);return me},he=(me,_e)=>rn(me,bn(_e));function Oe(me){return he(ie({},me),{level:me?.level||"info"})}function it(me,_e=We){return me[_e]||""}function Ut(me,_e,Ue=We){const vt=function Qe(me,_e,Ue=We){const vt=it(me,Ue);return vt.trim()?`${vt}/${_e}`:_e}(me,_e,Ue);return function $e(me,_e,Ue=We){return me[Ue]=_e,me}(me.child({context:vt}),vt,Ue)}function dn(me){var _e;if(typeof me.loggerOverride<"u"&&"string"!=typeof me.loggerOverride)return{logger:me.loggerOverride,chunkLoggerController:null};const Ue=he(ie({},me.opts),{level:"string"==typeof me.loggerOverride?me.loggerOverride:null==(_e=me.opts)?void 0:_e.level});return typeof window<"u"?function kt(me){var _e,Ue;const vt=new bt(null==(_e=me.opts)?void 0:_e.level,me.maxSizeInBytes);return{logger:S.exports(he(ie({},me.opts),{level:"trace",browser:he(ie({},null==(Ue=me.opts)?void 0:Ue.browser),{write:xt=>vt.write(xt)}
1)})),chunkLoggerController:vt}}(he(ie({},me),{opts:Ue})):function Xt(me){var _e,Ue;const vt=new Tt(null==(_e=me.opts)?void 0:_e.level,me.maxSizeInBytes);return{logger:S.exports(he(ie({},me.opts),{level:"trace",browser:he(ie({},null==(Ue=me.opts)?void 0:Ue.browser),{write:xt=>vt.write(xt)})}),vt),chunkLoggerController:vt}}(he(ie({},me),{opts:Ue}))}},99083(Ve,ne,u){"use strict";Object.defineProperty(ne,"__esModule",{value:!0});const S=u(80584);S.__exportStar(u(45543),ne),S.__exportStar(u(19746),ne)},45543(Ve,ne){"use strict";Object.defineProperty(ne,"__esModule",{value:!0}),ne.ONE_THOUSAND=ne.ONE_HUNDRED=void 0,ne.ONE_HUNDRED=100,ne.ONE_THOUSAND=1e3},19746(Ve,ne){"use strict";Object.defineProperty(ne,"__esModule",{value:!0}),ne.ONE_YEAR=ne.FOUR_WEEKS=ne.THREE_WEEKS=ne.TWO_WEEKS=ne.ONE_WEEK=ne.THIRTY_DAYS=ne.SEVEN_DAYS=ne.FIVE_DAYS=ne.THREE_DAYS=ne.ONE_DAY=ne.TWENTY_FOUR_HOURS=ne.TWELVE_HOURS=ne.SIX_HOURS=ne.THREE_HOURS=ne.ONE_HOUR=ne.SIXTY_MINUTES=ne.THIRTY_MINUTES=ne.TEN_MINUTES=ne.FIVE_MINUTES=ne.ONE_MINUTE=ne.SIXTY_SECONDS=ne.THIRTY_SECONDS=ne.TEN_SECONDS=ne.FIVE_SECONDS=ne.ONE_SECOND=void 0,ne.ONE_SECOND=1,ne.FIVE_SECONDS=5,ne.TEN_SECONDS=10,ne.THIRTY_SECONDS=30,ne.SIXTY_SECONDS=60,ne.ONE_MINUTE=ne.SIXTY_SECONDS,ne.FIVE_MINUTES=5*ne.ONE_MINUTE,ne.TEN_MINUTES=10*ne.ONE_MINUTE,ne.THIRTY_MINUTES=30*ne.ONE_MINUTE,ne.SIXTY_MINUTES=60*ne.ONE_MINUTE,ne.ONE_HOUR=ne.SIXTY_MINUTES,ne.THREE_HOURS=3*ne.ONE_HOUR,ne.SIX_HOURS=6*ne.ONE_HOUR,ne.TWELVE_HOURS=12*ne.ONE_HOUR,ne.TWENTY_FOUR_HOURS=24*ne.ONE_HOUR,ne.ONE_DAY=ne.TWENTY_FOUR_HOURS,ne.THREE_DAYS=3*ne.ONE_DAY,ne.FIVE_DAYS=5*ne.ONE_DAY,ne.SEVEN_DAYS=7*ne.ONE_DAY,ne.THIRTY_DAYS=30*ne.ONE_DAY,ne.ONE_WEEK=ne.SEVEN_DAYS,ne.TWO_WEEKS=2*ne.ONE_WEEK,ne.THREE_WEEKS=3*ne.ONE_WEEK,ne.FOUR_WEEKS=4*ne.ONE_WEEK,ne.ONE_YEAR=365*ne.ONE_DAY},76669(Ve,ne,u){"use strict";Object.defineProperty(ne,"__esModule",{value:!0});const S=u(80584);S.__exportStar(u(75295),ne),S.__exportStar(u(47486),ne),S.__exportStar(u(91387),ne),S.__exportStar(u(99083),ne)},91387(Ve,ne,u){"use strict";Object.defineProperty(ne,"__esModule",{value:!0}),u(80584).__exportStar(u(75424),ne)},75424(Ve,ne){"use strict";Object.defineProperty(ne,"__esModule",{value:!0}),ne.IWatch=void 0,ne.IWatch=class u{}},52552(Ve,ne,u){"use strict";Object.defineProperty(ne,"__esModule",{value:!0}),ne.fromMiliseconds=ne.toMiliseconds=void 0;const S=u(99083);ne.toMiliseconds=function P(m){return m*S.ONE_THOUSAND},ne.fromMiliseconds=function K(m){return Math.floor(m/S.ONE_THOUSAND)}},55784(Ve,ne){"use strict";Object.defineProperty(ne,"__esModule",{value:!0}),ne.delay=void 0,ne.delay=function u(S){return new Promise(P=>{setTimeout(()=>{P(!0)},S)})}},75295(Ve,ne,u){"use strict";Object.defineProperty(ne,"__esModule",{value:!0});const S=u(80584);S.__exportStar(u(55784),ne),S.__exportStar(u(52552),ne)},47486(Ve,ne){"use strict";Object.defineProperty(ne,"__esModule",{value:!0}),ne.Watch=void 0;class u{constructor(){this.timestamps=new Map}start(P){if(this.timestamps.has(P))throw new Error(`Watch already started for label: ${P}`);this.timestamps.set(P,{started:Date.now()})}stop(P){const K=this.get(P);if(typeof K.elapsed<"u")throw new Error(`Watch already stopped for label: ${P}`);const m=Date.now()-K.started;this.timestamps.set(P,{started:K.started,elapsed:m})}get(P){const K=this.timestamps.get(P);if(typeof K>"u")throw new Error(`No timestamp found for label: ${P}`);return K}elapsed(P){const K=this.get(P);return K.elapsed||Date.now()-K.started}}ne.Watch=u,ne.default=u},7793(Ve,ne){"use strict";function u(X){let B;return typeof window<"u"&&typeof window[X]<"u"&&(B=window[X]),B}function S(X){const B=u(X);if(!B)throw new Error(`${X} is not defined in Window`);return B}Object.defineProperty(ne,"__esModule",{value:!0}),ne.getLocalStorage=ne.getLocalStorageOrThrow=ne.getCrypto=ne.getCryptoOrThrow=ne.getLocation=ne.getLocationOrThrow=ne.getNavigator=ne.getNavigatorOrThrow=ne.getDocument=ne.getDocumentOrThrow=ne.getFromWindowOrThrow=ne.getFromWindow=void 0,ne.getFromWindow=u,ne.getFromWindowOrThrow=S,ne.getDocumentOrThrow=function P(){return S("document")},ne.getDocument=function K(){return u("document")},ne.getNavigatorOrThrow=function m(){return S("navigator")},ne.getNavigator=function j(){return u("navigator")},ne.getLocationOrThrow=function R(){return S("location")},ne.getLocation=function k(){return u("location")},ne.getCryptoOrThrow=function v(){return S("crypto")},ne.getCrypto=function $(){return u("crypto")},ne.getLocalStorageOrThrow=function x(){return S("localStorage")},ne.getLocalStorage=function U(){return u("localStorage")}},52596(Ve,ne,u){"use strict";ne.g=void 0;const P=u(7793);ne.g=function K(){let m,j;try{m=P.getDocumentOrThrow(),j=P.getLocationOrThrow()}catch{return null}function k(...l){const O=m.getElementsByTagName("meta");for(let L=0;L<O.length;L++){const _=O[L],I=["itemprop","property","name"].map(D=>_.getAttribute(D)).filter(D=>!!D&&l.includes(D));if(I.length&&I){const D=_.getAttribute("content");
1if(D)return D}}return""}const x=function v(){let l=k("name","og:site_name","og:title","twitter:title");return l||(l=m.title),l}();return{description:function $(){return k("description","og:description","twitter:description","keywords")}(),url:j.origin,icons:function R(){const l=m.getElementsByTagName("link"),O=[];for(let L=0;L<l.length;L++){const _=l[L],I=_.getAttribute("rel");if(I&&I.toLowerCase().indexOf("icon")>-1){const D=_.getAttribute("href");if(D)if(-1===D.toLowerCase().indexOf("https:")&&-1===D.toLowerCase().indexOf("http:")&&0!==D.indexOf("//")){let H=j.protocol+"//"+j.host;if(0===D.indexOf("/"))H+=D;else{const z=j.pathname.split("/");z.pop(),H+=z.join("/")+"/"+D}O.push(H)}else 0===D.indexOf("//")?O.push(j.protocol+D):O.push(D)}}return O}(),name:x}}},59823(Ve,ne,u){const S=u(40504);function P(_,I,D){const H=_[I]+_[D];let z=_[I+1]+_[D+1];H>=4294967296&&z++,_[I]=H,_[I+1]=z}function K(_,I,D,H){let z=_[I]+D;D<0&&(z+=4294967296);let T=_[I+1]+H;z>=4294967296&&T++,_[I]=z,_[I+1]=T}function m(_,I){return _[I]^_[I+1]<<8^_[I+2]<<16^_[I+3]<<24}function j(_,I,D,H,z,T){const W=x[z],A=x[z+1],E=x[T],g=x[T+1];P($,_,I),K($,_,W,A);let w=$[H]^$[_],C=$[H+1]^$[_+1];$[H]=C,$[H+1]=w,P($,D,H),w=$[I]^$[D],C=$[I+1]^$[D+1],$[I]=w>>>24^C<<8,$[I+1]=C>>>24^w<<8,P($,_,I),K($,_,E,g),w=$[H]^$[_],C=$[H+1]^$[_+1],$[H]=w>>>16^C<<16,$[H+1]=C>>>16^w<<16,P($,D,H),w=$[I]^$[D],C=$[I+1]^$[D+1],$[I]=C>>>31^w<<1,$[I+1]=w>>>31^C<<1}const R=new Uint32Array([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),v=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,6,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3].map(function(_){return 2*_})),$=new Uint32Array(32),x=new Uint32Array(32);function U(_,I){let D=0;for(D=0;D<16;D++)$[D]=_.h[D],$[D+16]=R[D];for($[24]=$[24]^_.t,$[25]=$[25]^_.t/4294967296,I&&($[28]=~$[28],$[29]=~$[29]),D=0;D<32;D++)x[D]=m(_.b,4*D);for(D=0;D<12;D++)j(0,8,16,24,v[16*D+0],v[16*D+1]),j(2,10,18,26,v[16*D+2],v[16*D+3]),j(4,12,20,28,v[16*D+4],v[16*D+5]),j(6,14,22,30,v[16*D+6],v[16*D+7]),j(0,10,20,30,v[16*D+8],v[16*D+9]),j(2,12,22,24,v[16*D+10],v[16*D+11]),j(4,14,16,26,v[16*D+12],v[16*D+13]),j(6,8,18,28,v[16*D+14],v[16*D+15]);for(D=0;D<16;D++)_.h[D]=_.h[D]^$[D]^$[D+16]}const X=new Uint8Array([0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);function B(_,I,D,H){if(0===_||_>64)throw new Error("Illegal output length, expected 0 < length <= 64");if(I&&I.length>64)throw new Error("Illegal key, expected Uint8Array with 0 < length <= 64");if(D&&16!==D.length)throw new Error("Illegal salt, expected Uint8Array with length is 16");if(H&&16!==H.length)throw new Error("Illegal personal, expected Uint8Array with length is 16");const z={b:new Uint8Array(128),h:new Uint32Array(16),t:0,c:0,outlen:_};X.fill(0),X[0]=_,I&&(X[1]=I.length),X[2]=1,X[3]=1,D&&X.set(D,32),H&&X.set(H,48);for(let T=0;T<16;T++)z.h[T]=R[T]^m(X,4*T);return I&&(p(z,I),z.c=128),z}function p(_,I){for(let D=0;D<I.length;D++)128===_.c&&(_.t+=_.c,U(_,!1),_.c=0),_.b[_.c++]=I[D]}function l(_){for(_.t+=_.c;_.c<128;)_.b[_.c++]=0;U(_,!0);const I=new Uint8Array(_.outlen);for(let D=0;D<_.outlen;D++)I[D]=_.h[D>>2]>>8*(3&D);return I}function O(_,I,D,H,z){D=D||64,_=S.normalizeInput(_),H&&(H=S.normalizeInput(H)),z&&(z=S.normalizeInput(z));const T=B(D,I,H,z);return p(T,_),l(T)}Ve.exports={blake2b:O,blake2bHex:function L(_,I,D,H,z){const T=O(_,I,D,H,z);return S.toHex(T)},blake2bInit:B,blake2bUpdate:p,blake2bFinal:l}},55880(Ve,ne,u){const S=u(40504);function P(l,O){return l[O]^l[O+1]<<8^l[O+2]<<16^l[O+3]<<24}function K(l,O,L,_,I,D){k[l]=k[l]+k[O]+I,k[_]=m(k[_]^k[l],16),k[L]=k[L]+k[_],k[O]=m(k[O]^k[L],12),k[l]=k[l]+k[O]+D,k[_]=m(k[_]^k[l],8),k[L]=k[L]+k[_],k[O]=m(k[O]^k[L],7)}function m(l,O){return l>>>O^l<<32-O}const j=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),R=new Uint8Array([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,
16,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0]),k=new Uint32Array(16),v=new Uint32Array(16);function $(l,O){let L=0;for(L=0;L<8;L++)k[L]=l.h[L],k[L+8]=j[L];for(k[12]^=l.t,k[13]^=l.t/4294967296,O&&(k[14]=~k[14]),L=0;L<16;L++)v[L]=P(l.b,4*L);for(L=0;L<10;L++)K(0,4,8,12,v[R[16*L+0]],v[R[16*L+1]]),K(1,5,9,13,v[R[16*L+2]],v[R[16*L+3]]),K(2,6,10,14,v[R[16*L+4]],v[R[16*L+5]]),K(3,7,11,15,v[R[16*L+6]],v[R[16*L+7]]),K(0,5,10,15,v[R[16*L+8]],v[R[16*L+9]]),K(1,6,11,12,v[R[16*L+10]],v[R[16*L+11]]),K(2,7,8,13,v[R[16*L+12]],v[R[16*L+13]]),K(3,4,9,14,v[R[16*L+14]],v[R[16*L+15]]);for(L=0;L<8;L++)l.h[L]^=k[L]^k[L+8]}function x(l,O){if(!(l>0&&l<=32))throw new Error("Incorrect output length, should be in [1, 32]");const L=O?O.length:0;if(O&&!(L>0&&L<=32))throw new Error("Incorrect key length, should be in [1, 32]");const _={h:new Uint32Array(j),b:new Uint8Array(64),c:0,t:0,outlen:l};return _.h[0]^=16842752^L<<8^l,L>0&&(U(_,O),_.c=64),_}function U(l,O){for(let L=0;L<O.length;L++)64===l.c&&(l.t+=l.c,$(l,!1),l.c=0),l.b[l.c++]=O[L]}function X(l){for(l.t+=l.c;l.c<64;)l.b[l.c++]=0;$(l,!0);const O=new Uint8Array(l.outlen);for(let L=0;L<l.outlen;L++)O[L]=l.h[L>>2]>>8*(3&L)&255;return O}function B(l,O,L){L=L||32,l=S.normalizeInput(l);const _=x(L,O);return U(_,l),X(_)}Ve.exports={blake2s:B,blake2sHex:function p(l,O,L){const _=B(l,O,L);return S.toHex(_)},blake2sInit:x,blake2sUpdate:U,blake2sFinal:X}},22950(Ve,ne,u){const S=u(59823),P=u(55880);Ve.exports={blake2b:S.blake2b,blake2bHex:S.blake2bHex,blake2bInit:S.blake2bInit,blake2bUpdate:S.blake2bUpdate,blake2bFinal:S.blake2bFinal,blake2s:P.blake2s,blake2sHex:P.blake2sHex,blake2sInit:P.blake2sInit,blake2sUpdate:P.blake2sUpdate,blake2sFinal:P.blake2sFinal}},40504(Ve){function P(j){return(4294967296+j).toString(16).substring(1)}Ve.exports={normalizeInput:function u(j){let R;if(j instanceof Uint8Array)R=j;else{if("string"!=typeof j)throw new Error("Input must be an string, Buffer or Uint8Array");R=(new TextEncoder).encode(j)}return R},toHex:function S(j){return Array.prototype.map.call(j,function(R){return(R<16?"0":"")+R.toString(16)}).join("")},debugPrint:function K(j,R,k){let v="\n"+j+" = ";for(let $=0;$<R.length;$+=2){if(32===k)v+=P(R[$]).toUpperCase(),v+=" ",v+=P(R[$+1]).toUpperCase();else{if(64!==k)throw new Error("Invalid size "+k);v+=P(R[$+1]).toUpperCase(),v+=P(R[$]).toUpperCase()}$%6==4?v+="\n"+new Array(j.length+4).join(" "):$<R.length-2&&(v+=" ")}console.log(v)},testSpeed:function m(j,R,k){let v=(new Date).getTime();const $=new Uint8Array(R);for(let U=0;U<R;U++)$[U]=U%256;const x=(new Date).getTime();console.log("Generated random input in "+(x-v)+"ms"),v=x;for(let U=0;U<k;U++){const X=j($),B=(new Date).getTime(),p=B-v;v=B,console.log("Hashed in "+p+"ms: "+X.substring(0,20)+"..."),console.log(Math.round(R/(1<<20)/(p/1e3)*100)/100+" MB PER SECOND")}}}},27886(Ve,ne){var K,u=typeof globalThis<"u"&&globalThis||typeof self<"u"&&self||typeof global<"u"&&global,S=function(){function K(){this.fetch=!1,this.DOMException=u.DOMException}return K.prototype=u,new K}();K=S,function(j){var R=typeof K<"u"&&K||typeof self<"u"&&self||typeof global<"u"&&global||{},k_searchParams="URLSearchParams"in R,k_iterable="Symbol"in R&&"iterator"in Symbol,k_blob="FileReader"in R&&"Blob"in R&&function(){try{return new Blob,!0}catch{return!1}}(),k_formData="FormData"in R,k_arrayBuffer="ArrayBuffer"in R;if(k_arrayBuffer)var $=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],x=ArrayBuffer.isView||function(y){return y&&$.indexOf(Object.prototype.toString.call(y))>-1};function U(y){if("string"!=typeof y&&(y=String(y)),/[^a-z0-9\-#$%&'*+.^_`|~!]/i.test(y)||""===y)throw new TypeError('Invalid character in header field name: "'+y+'"');return y.toLowerCase()}function X(y){return"string"!=typeof y&&(y=String(y)),y}function B(y){var F={next:function(){var Q=y.shift();return{done:void 0===Q,value:Q}}};return k_iterable&&(F[Symbol.iterator]=function(){return F}),F}function p(y){this.map={}
1,y instanceof p?y.forEach(function(F,Q){this.append(Q,F)},this):Array.isArray(y)?y.forEach(function(F){if(2!=F.length)throw new TypeError("Headers constructor: expected name/value pair to be length 2, found"+F.length);this.append(F[0],F[1])},this):y&&Object.getOwnPropertyNames(y).forEach(function(F){this.append(F,y[F])},this)}function l(y){if(!y._noBody){if(y.bodyUsed)return Promise.reject(new TypeError("Already read"));y.bodyUsed=!0}}function O(y){return new Promise(function(F,Q){y.onload=function(){F(y.result)},y.onerror=function(){Q(y.error)}})}function L(y){var F=new FileReader,Q=O(F);return F.readAsArrayBuffer(y),Q}function D(y){if(y.slice)return y.slice(0);var F=new Uint8Array(y.byteLength);return F.set(new Uint8Array(y)),F.buffer}function H(){return this.bodyUsed=!1,this._initBody=function(y){this.bodyUsed=this.bodyUsed,this._bodyInit=y,y?"string"==typeof y?this._bodyText=y:k_blob&&Blob.prototype.isPrototypeOf(y)?this._bodyBlob=y:k_formData&&FormData.prototype.isPrototypeOf(y)?this._bodyFormData=y:k_searchParams&&URLSearchParams.prototype.isPrototypeOf(y)?this._bodyText=y.toString():k_arrayBuffer&&k_blob&&function v(y){return y&&DataView.prototype.isPrototypeOf(y)}(y)?(this._bodyArrayBuffer=D(y.buffer),this._bodyInit=new Blob([this._bodyArrayBuffer])):k_arrayBuffer&&(ArrayBuffer.prototype.isPrototypeOf(y)||x(y))?this._bodyArrayBuffer=D(y):this._bodyText=y=Object.prototype.toString.call(y):(this._noBody=!0,this._bodyText=""),this.headers.get("content-type")||("string"==typeof y?this.headers.set("content-type","text/plain;charset=UTF-8"):this._bodyBlob&&this._bodyBlob.type?this.headers.set("content-type",this._bodyBlob.type):k_searchParams&&URLSearchParams.prototype.isPrototypeOf(y)&&this.headers.set("content-type","application/x-www-form-urlencoded;charset=UTF-8"))},k_blob&&(this.blob=function(){var y=l(this);if(y)return y;if(this._bodyBlob)return Promise.resolve(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(new Blob([this._bodyArrayBuffer]));if(this._bodyFormData)throw new Error("could not read FormData body as blob");return Promise.resolve(new Blob([this._bodyText]))}),this.arrayBuffer=function(){if(this._bodyArrayBuffer)return l(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(k_blob)return this.blob().then(L);throw new Error("could not read as ArrayBuffer")},this.text=function(){var y=l(this);if(y)return y;if(this._bodyBlob)return function _(y){var F=new FileReader,Q=O(F),ge=/charset=([A-Za-z0-9_-]+)/.exec(y.type);return F.readAsText(y,ge?ge[1]:"utf-8"),Q}(this._bodyBlob);if(this._bodyArrayBuffer)return Promise.resolve(function I(y){for(var F=new Uint8Array(y),Q=new Array(F.length),ge=0;ge<F.length;ge++)Q[ge]=String.fromCharCode(F[ge]);return Q.join("")}(this._bodyArrayBuffer));if(this._bodyFormData)throw new Error("could not read FormData body as text");return Promise.resolve(this._bodyText)},k_formData&&(this.formData=function(){return this.text().then(A)}),this.json=function(){return this.text().then(JSON.parse)},this}p.prototype.append=function(y,F){y=U(y),F=X(F);var Q=this.map[y];this.map[y]=Q?Q+", "+F:F},p.prototype.delete=function(y){delete this.map[U(y)]},p.prototype.get=function(y){return y=U(y),this.has(y)?this.map[y]:null},p.prototype.has=function(y){return this.map.hasOwnProperty(U(y))},p.prototype.set=function(y,F){this.map[U(y)]=X(F)},p.prototype.forEach=function(y,F){for(var Q in this.map)this.map.hasOwnProperty(Q)&&y.call(F,this.map[Q],Q,this)},p.prototype.keys=function(){var y=[];return this.forEach(function(F,Q){y.push(Q)}),B(y)},p.prototype.values=function(){var y=[];return this.forEach(function(F){y.push(F)}),B(y)},p.prototype.entries=function(){var y=[];return this.forEach(function(F,Q){y.push([Q,F])}),B(y)},k_iterable&&(p.prototype[Symbol.iterator]=p.prototype.entries);var z=["CONNECT","DELETE","GET","HEAD","OPTIONS","PATCH","POST","PUT","TRACE"];function W(y,F){if(!(this instanceof W))throw new TypeError('Please use the "new" operator, this DOM object c
1onstructor cannot be called as a function.');var Q=(F=F||{}).body;if(y instanceof W){if(y.bodyUsed)throw new TypeError("Already read");this.url=y.url,this.credentials=y.credentials,F.headers||(this.headers=new p(y.headers)),this.method=y.method,this.mode=y.mode,this.signal=y.signal,!Q&&null!=y._bodyInit&&(Q=y._bodyInit,y.bodyUsed=!0)}else this.url=String(y);if(this.credentials=F.credentials||this.credentials||"same-origin",(F.headers||!this.headers)&&(this.headers=new p(F.headers)),this.method=function T(y){var F=y.toUpperCase();return z.indexOf(F)>-1?F:y}(F.method||this.method||"GET"),this.mode=F.mode||this.mode||null,this.signal=F.signal||this.signal||function(){if("AbortController"in R)return(new AbortController).signal}(),this.referrer=null,("GET"===this.method||"HEAD"===this.method)&&Q)throw new TypeError("Body not allowed for GET or HEAD requests");if(this._initBody(Q),!("GET"!==this.method&&"HEAD"!==this.method||"no-store"!==F.cache&&"no-cache"!==F.cache)){var ge=/([?&])_=[^&]*/;ge.test(this.url)?this.url=this.url.replace(ge,"$1_="+(new Date).getTime()):this.url+=(/\?/.test(this.url)?"&":"?")+"_="+(new Date).getTime()}}function A(y){var F=new FormData;return y.trim().split("&").forEach(function(Q){if(Q){var ge=Q.split("="),ce=ge.shift().replace(/\+/g," "),Ae=ge.join("=").replace(/\+/g," ");F.append(decodeURIComponent(ce),decodeURIComponent(Ae))}}),F}function E(y){var F=new p;return y.replace(/\r?\n[\t ]+/g," ").split("\r").map(function(ge){return 0===ge.indexOf("\n")?ge.substr(1,ge.length):ge}
1).forEach(function(ge){var ce=ge.split(":"),Ae=ce.shift().trim();if(Ae){var Te=ce.join(":").trim();try{F.append(Ae,Te)}catch(ve){console.warn("Response "+ve.message)}}}),F}function g(y,F){if(!(this instanceof g))throw new TypeError('Please use the "new" operator, this DOM object constructor cannot be called as a function.');if(F||(F={}),this.type="default",this.status=void 0===F.status?200:F.status,this.status<200||this.status>599)throw new 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===F.statusText?"":""+F.statusText,this.headers=new p(F.headers),this.url=F.url||"",this._initBody(y)}W.prototype.clone=function(){return new W(this,{body:this._bodyInit})},H.call(W.prototype),H.call(g.prototype),g.prototype.clone=function(){return new g(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new p(this.headers),url:this.url})},g.error=function(){var y=new g(null,{status:200,statusText:""});return y.ok=!1,y.status=0,y.type="error",y};var w=[301,302,303,307,308];g.redirect=function(y,F){if(-1===w.indexOf(F))throw new RangeError("Invalid status code");return new g(null,{status:F,headers:{location:y}})},j.DOMException=R.DOMException;try{new j.DOMException}catch{j.DOMException=function(F,Q){this.message=F,this.name=Q;var ge=Error(F);this.stack=ge.stack},j.DOMException.prototype=Object.create(Error.prototype),j.DOMException.prototype.constructor=j.DOMException}function C(y,F){return new Promise(function(Q,ge){var ce=new W(y,F);if(ce.signal&&ce.signal.aborted)return ge(new j.DOMException("Aborted","AbortError"));var Ae=new XMLHttpRequest;function Te(){Ae.abort()}if(Ae.onload=function(){var Ke={statusText:Ae.statusText,headers:E(Ae.getAllResponseHeaders()||"")};Ke.status=0===ce.url.indexOf("file://")&&(Ae.status<200||Ae.status>599)?200:Ae.status,Ke.url="responseURL"in Ae?Ae.responseURL:Ke.headers.get("X-Request-URL");var Et="response"in Ae?Ae.response:Ae.responseText;setTimeout(function(){Q(new g(Et,Ke))},0)},Ae.onerror=function(){setTimeout(function(){ge(new TypeError("Network request failed"))},0)},Ae.ontimeout=function(){setTimeout(function(){ge(new TypeError("Network request timed out"))},0)},Ae.onabort=function(){setTimeout(function(){ge(new j.DOMException("Aborted","AbortError"))},0)},Ae.open(ce.method,function ve(Ke){try{return""===Ke&&R.location.href?R.location.href:Ke}catch{return Ke}}(ce.url),!0),"include"===ce.credentials?Ae.withCredentials=!0:"omit"===ce.credentials&&(Ae.withCredentials=!1),"responseType"in Ae&&(k_blob?Ae.responseType="blob":k_arrayBuffer&&(Ae.responseType="arraybuffer")),F&&"object"==typeof F.headers&&!(F.headers instanceof p||R.Headers&&F.headers instanceof R.Headers)){var We=[];Object.getOwnPropertyNames(F.headers).forEach(function(Ke){We.push(U(Ke)),Ae.setRequestHeader(Ke,X(F.headers[Ke]))}),ce.headers.forEach(function(Ke,Et){-1===We.indexOf(Et)&&Ae.setRequestHeader(Et,Ke)})}else ce.headers.forEach(function(Ke,Et){Ae.setRequestHeader(Et,Ke)});ce.signal&&(ce.signal.addEventListener("abort",Te),Ae.onreadystatechange=function(){4===Ae.readyState&&ce.signal.removeEventListener("abort",Te)}),Ae.send(typeof ce._bodyInit>"u"?null:ce._bodyInit)})}C.polyfill=!0,R.fetch||(R.fetch=C,R.Headers=p,R.Request=W,R.Response=g),j.Headers=p,j.Request=W,j.Response=g,j.fetch=C,Object.defineProperty(j,"__esModule",{value:!0})}({}),S.fetch.ponyfill=!0,delete S.fetch.polyfill;var P=u.fetch?u:S;(ne=P.fetch).default=P.fetch,ne.fetch=P.fetch,ne.Headers=P.Headers,ne.Request=P.Request,ne.Response=P.Response,Ve.exports=ne},67374(Ve){Ve.exports=function(){"use strict";var u=6e4,S=36e5,P="millisecond",K="second",m="minute",j="hour",R="day",k="week",v="month",$="quarter",x="year",U="date",X="Invalid Date",B=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,p=/\[([^\]]+)]|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,l={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(g){var w=["th","st","nd","rd"],C=g%100;return"["+g+(w[(C-20)%10]||w[C]||w[0])+"]"}},O=function(g,w,C){var y=String(g);return!y||y.length>=w?g:""+Array(w+1-y.length).join(C)+g},L={s:O,z:function(g){var w=-g.utcOffset(),C=Math.abs(w),y=Math.floor(C/60),F=C%60;return(w<=0?"+":"-")+O(y,2,"0")+":"+O(F,2,"0")}
vendor: 5,040 bytes, line 1
1,m:function g(w,C){if(w.date()<C.date())return-g(C,w);var y=12*(C.year()-w.year())+(C.month()-w.month()),F=w.clone().add(y,v),Q=C-F<0,ge=w.clone().add(y+(Q?-1:1),v);return+(-(y+(C-F)/(Q?F-ge:ge-F))||0)},a:function(g){return g<0?Math.ceil(g)||0:Math.floor(g)},p:function(g){return{M:v,y:x,w:k,d:R,D:U,h:j,m,s:K,ms:P,Q:$}[g]||String(g||"").toLowerCase().replace(/s$/,"")},u:function(g){return void 0===g}},_="en",I={};I[_]=l;var D="$isDayjsObject",H=function(g){return g instanceof A||!(!g||!g[D])},z=function g(w,C,y){var F;if(!w)return _;if("string"==typeof w){var Q=w.toLowerCase();I[Q]&&(F=Q),C&&(I[Q]=C,F=Q);var ge=w.split("-");if(!F&&ge.length>1)return g(ge[0])}else{var ce=w.name;I[ce]=w,F=ce}return!y&&F&&(_=F),F||!y&&_},T=function(g,w){if(H(g))return g.clone();var C="object"==typeof w?w:{};return C.date=g,C.args=arguments,new A(C)},W=L;W.l=z,W.i=H,W.w=function(g,w){return T(g,{locale:w.$L,utc:w.$u,x:w.$x,$offset:w.$offset})};var A=function(){function g(C){this.$L=z(C.locale,null,!0),this.parse(C),this.$x=this.$x||C.x||{},this[D]=!0}var w=g.prototype;return w.parse=function(C){this.$d=function(y){var F=y.date,Q=y.utc;if(null===F)return new Date(NaN);if(W.u(F))return new Date;if(F instanceof Date)return new Date(F);if("string"==typeof F&&!/Z$/i.test(F)){var ge=F.match(B);if(ge){var ce=ge[2]-1||0,Ae=(ge[7]||"0").substring(0,3);return Q?new Date(Date.UTC(ge[1],ce,ge[3]||1,ge[4]||0,ge[5]||0,ge[6]||0,Ae)):new Date(ge[1],ce,ge[3]||1,ge[4]||0,ge[5]||0,ge[6]||0,Ae)}}return new Date(F)}(C),this.init()},w.init=function(){var C=this.$d;this.$y=C.getFullYear(),this.$M=C.getMonth(),this.$D=C.getDate(),this.$W=C.getDay(),this.$H=C.getHours(),this.$m=C.getMinutes(),this.$s=C.getSeconds(),this.$ms=C.getMilliseconds()},w.$utils=function(){return W},w.isValid=function(){return this.$d.toString()!==X},w.isSame=function(C,y){var F=T(C);return this.startOf(y)<=F&&F<=this.endOf(y)},w.isAfter=function(C,y){return T(C)<this.startOf(y)},w.isBefore=function(C,y){return this.endOf(y)<T(C)},w.$g=function(C,y,F){return W.u(C)?this[y]:this.set(F,C)},w.unix=function(){return Math.floor(this.valueOf()/1e3)},w.valueOf=function(){return this.$d.getTime()},w.startOf=function(C,y){var F=this,Q=!!W.u(y)||y,ge=W.p(C),ce=function(Pt,wt){var at=W.w(F.$u?Date.UTC(F.$y,wt,Pt):new Date(F.$y,wt,Pt),F);return Q?at:at.endOf(R)},Ae=function(Pt,wt){return W.w(F.toDate()[Pt].apply(F.toDate("s"),(Q?[0,0,0,0]:[23,59,59,999]).slice(wt)),F)},Te=this.$W,ve=this.$M,We=this.$D,Ke="set"+(this.$u?"UTC":"");switch(ge){case x:return Q?ce(1,0):ce(31,11);case v:return Q?ce(1,ve):ce(0,ve+1);case k:var Et=this.$locale().weekStart||0,jt=(Te<Et?Te+7:Te)-Et;return ce(Q?We-jt:We+(6-jt),ve);case R:case U:return Ae(Ke+"Hours",0);case j:return Ae(Ke+"Minutes",1);case m:return Ae(Ke+"Seconds",2);case K:return Ae(Ke+"Milliseconds",3);default:return this.clone()}},w.endOf=function(C){return this.startOf(C,!1)},w.$set=function(C,y){var F,Q=W.p(C),ge="set"+(this.$u?"UTC":""),ce=(F={},F[R]=ge+"Date",F[U]=ge+"Date",F[v]=ge+"Month",F[x]=ge+"FullYear",F[j]=ge+"Hours",F[m]=ge+"Minutes",F[K]=ge+"Seconds",F[P]=ge+"Milliseconds",F)[Q],Ae=Q===R?this.$D+(y-this.$W):y;if(Q===v||Q===x){var Te=this.clone().set(U,1);Te.$d[ce](Ae),Te.init(),this.$d=Te.set(U,Math.min(this.$D,Te.daysInMonth())).$d}else ce&&this.$d[ce](Ae);return this.init(),this},w.set=function(C,y){return this.clone().$set(C,y)},w.get=function(C){return this[W.p(C)]()},w.add=function(C,y){var F,Q=this;C=Number(C);var ge=W.p(y),ce=function(ve){var We=T(Q);return W.w(We.date(We.date()+Math.round(ve*C)),Q)};if(ge===v)return this.set(v,this.$M+C);if(ge===x)return this.set(x,this.$y+C);if(ge===R)return ce(1);if(ge===k)return ce(7);var Ae=(F={},F[m]=u,F[j]=S,F[K]=1e3,F)[ge]||1,Te=this.$d.getTime()+C*Ae;return W.w(Te,this)},w.subtract=function(C,y){return this.add(-1*C,y)},w.format=function(C){var y=this,F=this.$locale();if(!this.isValid())return F.invalidDate||X;var Q=C||"YYYY-MM-DDTHH:mm:ssZ",ge=W.z(this),ce=this.$H,Ae=this.$m,Te=this.$M,ve=F.weekdays,We=F.months,Et=function(wt,at,xe,tt){return wt&&(wt[at]||wt(y,Q))||xe[at].slice(0,tt)},jt=function(wt){return W.s(ce%12||12,wt,"0")},Pt=F.meridiem||function(wt,at,xe){var tt=wt<12?"AM":"PM";return xe?tt.toLowerCase():tt};return Q.replace(p,function(wt,at){return at||function(xe){switch(xe){case"YY":return String(y.$y).slice(-2);case"YYYY":return W.s(y.$y,4,"0");case"M":return Te+1;case"MM":return W.s(Te+1,2,"0");case"MMM":return Et(F.monthsShort,Te,We,3);case"MMMM":return Et(We,Te);case"D":return y.$D;case"DD":return W.s(y.$D,2,"0");case"d":return String(y.$W);case"dd":return Et(F.weekdaysMin,y.$W,ve,2);case"ddd":return Et(F.weekdaysShort,y.$W,ve,3);case"dddd":return ve[y.$W];case"H":return String(ce);case"HH":return W.s(ce,2,"0");case"h":return jt(1);case"hh":return jt(2);case"a":return Pt(ce,Ae,!0);case"A":return Pt(ce,Ae,!1);case"m":return String(Ae);case"mm":return W.s(Ae,2,"0");case"s":return String(y.$s);case"ss":return W.s(y.$s,2,"0");case"SSS":return W.s(y.$ms,3,"0");case"Z":return ge}return null}(wt)||ge.replace(":","")})}
1,w.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},w.diff=function(C,y,F){var Q,ge=this,ce=W.p(y),Ae=T(C),Te=(Ae.utcOffset()-this.utcOffset())*u,ve=this-Ae,We=function(){return W.m(ge,Ae)};switch(ce){case x:Q=We()/12;break;case v:Q=We();break;case $:Q=We()/3;break;case k:Q=(ve-Te)/6048e5;break;case R:Q=(ve-Te)/864e5;break;case j:Q=ve/S;break;case m:Q=ve/u;break;case K:Q=ve/1e3;break;default:Q=ve}return F?Q:W.a(Q)},w.daysInMonth=function(){return this.endOf(v).$D},w.$locale=function(){return I[this.$L]},w.locale=function(C,y){if(!C)return this.$L;var F=this.clone(),Q=z(C,y,!0);return Q&&(F.$L=Q),F},w.clone=function(){return W.w(this.$d,this)},w.toDate=function(){return new Date(this.valueOf())},w.toJSON=function(){return this.isValid()?this.toISOString():null},w.toISOString=function(){return this.$d.toISOString()},w.toString=function(){return this.$d.toUTCString()},g}(),E=A.prototype;return T.prototype=E,[["$ms",P],["$s",K],["$m",m],["$H",j],["$W",R],["$M",v],["$y",x],["$D",U]].forEach(function(g){E[g[1]]=function(w){return this.$g(w,g[0],g[1])}}),T.extend=function(g,w){return g.$i||(g(w,A,T),g.$i=!0),T},T.locale=z,T.isDayjs=H,T.unix=function(g){return T(1e3*g)},T.en=I[_],T.Ls=I,T.p={},T}()},69785(Ve){Ve.exports=function(){"use strict";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(ne){var u=["th","st","nd","rd"],S=ne%100;return"["+ne+(u[(S-20)%10]||u[S]||u[0])+"]"}}}()},85164(Ve){Ve.exports=function(){"use strict";return function(ne,u,S){ne=ne||{};var P=u.prototype,K={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 m(R,k,v,$){return P.fromToBase(R,k,v,$)}S.en.relativeTime=K,P.fromToBase=function(R,k,v,$,x){for(var U,X,B,p=v.$locale().relativeTime||K,l=ne.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"}],O=l.length,L=0;L<O;L+=1){var _=l[L];_.d&&(U=$?S(R).diff(v,_.d,!0):v.diff(R,_.d,!0));var I=(ne.rounding||Math.round)(Math.abs(U));if(B=U>0,I<=_.r||!_.r){I<=1&&L>0&&(_=l[L-1]);var D=p[_.l];x&&(I=x(""+I)),X="string"==typeof D?D.replace("%d",I):D(I,k,_.l,B);break}}if(k)return X;var H=B?p.future:p.past;return"function"==typeof H?H(X):H.replace("%s",X)},P.to=function(R,k){return m(R,k,this,!0)},P.from=function(R,k){return m(R,k,this)};var j=function(R){return R.$u?S.utc():S()};P.toNow=function(R){return this.to(j(this),R)},P.fromNow=function(R){return this.from(j(this),R)}}}()},47538(Ve){Ve.exports=function(){"use strict";return function(ne,u,S){S.updateLocale=function(P,K){var m=S.Ls[P];if(m)return(K?Object.keys(K):[]).forEach(function(j){m[j]=K[j]}),m}}}()},44356(Ve){"use strict";var S,ne="object"==typeof Reflect?Reflect:null,u=ne&&"function"==typeof ne.apply?ne.apply:function(D,H,z){return Function.prototype.apply.call(D,H,z)};S=ne&&"function"==typeof ne.ownKeys?ne.ownKeys:Object.getOwnPropertySymbols?function(D){return Object.getOwnPropertyNames(D).concat(Object.getOwnPropertySymbols(D))}:function(D){return Object.getOwnPropertyNames(D)};var K=Number.isNaN||function(D){return D!=D};function m(){m.init.call(this)}Ve.exports=m,Ve.exports.once=function O(I,D){return new Promise(function(H,z){function T(A){I.removeListener(D,W),z(A)}function W(){"function"==typeof I.removeListener&&I.removeListener("error",T),H([].slice.call(arguments))}_(I,D,W,{once:!0}),"error"!==D&&function L(I,D,H){"function"==typeof I.on&&_(I,"error",D,H)}(I,T,{once:!0})})},m.EventEmitter=m,m.prototype._events=void 0,m.prototype._eventsCount=0,m.prototype._maxListeners=void 0;var j=10;function R(I){if("function"!=typeof I)throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof I)}function k(I){return void 0===I._maxListeners?m.defaultMaxListeners:I._maxListeners}function v(I,D,H,z){var T,W,A;if(R(H),void 0===(W=I._events)?(W=I._events=Object.create(null),I._eventsCount=0):(void 0!==W.newListener&&(I.emit("newListener",D,H.listener?H.listener:H),W=I._events),A=W[D]),void 0===A)A=W[D]=H,++I._eventsCount;else if("function"==typeof A?A=W[D]=z?[H,A]:[A,H]:z?A.unshift(H):A.push(H),(T=k(I))>0&&A.length>T&&!A.warned){A.warned=!0;var E=new Error("Possible EventEmitter memory leak detected. "+A.length+" "+String(D)+" listeners added. Use emitter.setMaxListeners() to increase limit");E.name="MaxListenersExceededWarning",E.emitter=I,E.type=D,E.count=A.length,function P(I){console&&console.warn&&console.warn(I)}(E)}return I}function $(){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 x(I,D,H){var z={fired:!1,wrapFn:void 0,target:I,type:D,listener:H},T=$.bind(z);return T.listener=H,z.wrapFn=T,T}function U(I,D,H){var z=I._events;if(void 0===z)return[];var T=z[D];return void 0===T?[]:"function"==typeof T?H?[T.listener||T]:[T]:H?function l(I
vendor: 4,085 bytes, line 1
1){for(var D=new Array(I.length),H=0;H<D.length;++H)D[H]=I[H].listener||I[H];return D}(T):B(T,T.length)}function X(I){var D=this._events;if(void 0!==D){var H=D[I];if("function"==typeof H)return 1;if(void 0!==H)return H.length}return 0}function B(I,D){for(var H=new Array(D),z=0;z<D;++z)H[z]=I[z];return H}function _(I,D,H,z){if("function"==typeof I.on)z.once?I.once(D,H):I.on(D,H);else{if("function"!=typeof I.addEventListener)throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof I);I.addEventListener(D,function T(W){z.once&&I.removeEventListener(D,T),H(W)})}}Object.defineProperty(m,"defaultMaxListeners",{enumerable:!0,get:function(){return j},set:function(I){if("number"!=typeof I||I<0||K(I))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+I+".");j=I}}),m.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},m.prototype.setMaxListeners=function(D){if("number"!=typeof D||D<0||K(D))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+D+".");return this._maxListeners=D,this},m.prototype.getMaxListeners=function(){return k(this)},m.prototype.emit=function(D){for(var H=[],z=1;z<arguments.length;z++)H.push(arguments[z]);var T="error"===D,W=this._events;if(void 0!==W)T=T&&void 0===W.error;else if(!T)return!1;if(T){var A;if(H.length>0&&(A=H[0]),A instanceof Error)throw A;var E=new Error("Unhandled error."+(A?" ("+A.message+")":""));throw E.context=A,E}var g=W[D];if(void 0===g)return!1;if("function"==typeof g)u(g,this,H);else{var w=g.length,C=B(g,w);for(z=0;z<w;++z)u(C[z],this,H)}return!0},m.prototype.on=m.prototype.addListener=function(D,H){return v(this,D,H,!1)},m.prototype.prependListener=function(D,H){return v(this,D,H,!0)},m.prototype.once=function(D,H){return R(H),this.on(D,x(this,D,H)),this},m.prototype.prependOnceListener=function(D,H){return R(H),this.prependListener(D,x(this,D,H)),this},m.prototype.off=m.prototype.removeListener=function(D,H){var z,T,W,A,E;if(R(H),void 0===(T=this._events))return this;if(void 0===(z=T[D]))return this;if(z===H||z.listener===H)0===--this._eventsCount?this._events=Object.create(null):(delete T[D],T.removeListener&&this.emit("removeListener",D,z.listener||H));else if("function"!=typeof z){for(W=-1,A=z.length-1;A>=0;A--)if(z[A]===H||z[A].listener===H){E=z[A].listener,W=A;break}if(W<0)return this;0===W?z.shift():function p(I,D){for(;D+1<I.length;D++)I[D]=I[D+1];I.pop()}(z,W),1===z.length&&(T[D]=z[0]),void 0!==T.removeListener&&this.emit("removeListener",D,E||H)}return this},m.prototype.removeAllListeners=function(D){var H,z,T;if(void 0===(z=this._events))return this;if(void 0===z.removeListener)return 0===arguments.length?(this._events=Object.create(null),this._eventsCount=0):void 0!==z[D]&&(0===--this._eventsCount?this._events=Object.create(null):delete z[D]),this;if(0===arguments.length){var A,W=Object.keys(z);for(T=0;T<W.length;++T)"removeListener"!==(A=W[T])&&this.removeAllListeners(A);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if("function"==typeof(H=z[D]))this.removeListener(D,H);else if(void 0!==H)for(T=H.length-1;T>=0;T--)this.removeListener(D,H[T]);return this},m.prototype.listeners=function(D){return U(this,D,!0)},m.prototype.rawListeners=function(D){return U(this,D,!1)},m.listenerCount=function(I,D){return"function"==typeof I.listenerCount?I.listenerCount(D):X.call(I,D)},m.prototype.listenerCount=X,m.prototype.eventNames=function(){return this._eventsCount>0?S(this._events):[]}},98186(Ve,ne,u){"use strict";u.r(ne),u.d(ne,{__assign:()=>K,__asyncDelegator:()=>_,__asyncGenerator:()=>L,__asyncValues:()=>I,__await:()=>O,__awaiter:()=>v,__classPrivateFieldGet:()=>T,__classPrivateFieldSet:()=>W,__createBinding:()=>x,__decorate:()=>j,__exportStar:()=>U,__extends:()=>P,__generator:()=>$,__importDefault:()=>z,__importStar:()=>
1H,__makeTemplateObject:()=>D,__metadata:()=>k,__param:()=>R,__read:()=>B,__rest:()=>m,__spread:()=>p,__spreadArrays:()=>l,__values:()=>X});var S=function(A,E){return(S=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(g,w){g.__proto__=w}||function(g,w){for(var C in w)w.hasOwnProperty(C)&&(g[C]=w[C])})(A,E)};function P(A,E){function g(){this.constructor=A}S(A,E),A.prototype=null===E?Object.create(E):(g.prototype=E.prototype,new g)}var K=function(){return K=Object.assign||function(E){for(var g,w=1,C=arguments.length;w<C;w++)for(var y in g=arguments[w])Object.prototype.hasOwnProperty.call(g,y)&&(E[y]=g[y]);return E},K.apply(this,arguments)};function m(A,E){var g={};for(var w in A)Object.prototype.hasOwnProperty.call(A,w)&&E.indexOf(w)<0&&(g[w]=A[w]);if(null!=A&&"function"==typeof Object.getOwnPropertySymbols){var C=0;for(w=Object.getOwnPropertySymbols(A);C<w.length;C++)E.indexOf(w[C])<0&&Object.prototype.propertyIsEnumerable.call(A,w[C])&&(g[w[C]]=A[w[C]])}return g}function j(A,E,g,w){var F,C=arguments.length,y=C<3?E:null===w?w=Object.getOwnPropertyDescriptor(E,g):w;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)y=Reflect.decorate(A,E,g,w);else for(var Q=A.length-1;Q>=0;Q--)(F=A[Q])&&(y=(C<3?F(y):C>3?F(E,g,y):F(E,g))||y);return C>3&&y&&Object.defineProperty(E,g,y),y}function R(A,E){return function(g,w){E(g,w,A)}}function k(A,E){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(A,E)}function v(A,E,g,w){return new(g||(g=Promise))(function(y,F){function Q(Ae){try{ce(w.next(Ae))}catch(Te){F(Te)}}function ge(Ae){try{ce(w.throw(Ae))}catch(Te){F(Te)}}function ce(Ae){Ae.done?y(Ae.value):function C(y){return y instanceof g?y:new g(function(F){F(y)})}(Ae.value).then(Q,ge)}ce((w=w.apply(A,E||[])).next())})}function $(A,E){var w,C,y,F,g={label:0,sent:function(){if(1&y[0])throw y[1];return y[1]},trys:[],ops:[]};return F={next:Q(0),throw:Q(1),return:Q(2)},"function"==typeof Symbol&&(F[Symbol.iterator]=function(){return this}),F;function Q(ce){return function(Ae){return function ge(ce){if(w)throw new TypeError("Generator is already executing.");for(;g;)try{if(w=1,C&&(y=2&ce[0]?C.return:ce[0]?C.throw||((y=C.return)&&y.call(C),0):C.next)&&!(y=y.call(C,ce[1])).done)return y;switch(C=0,y&&(ce=[2&ce[0],y.value]),ce[0]){case 0:case 1:y=ce;break;case 4:return g.label++,{value:ce[1],done:!1};case 5:g.label++,C=ce[1],ce=[0];continue;case 7:ce=g.ops.pop(),g.trys.pop();continue;default:if(!(y=(y=g.trys).length>0&&y[y.length-1])&&(6===ce[0]||2===ce[0])){g=0;continue}if(3===ce[0]&&(!y||ce[1]>y[0]&&ce[1]<y[3])){g.label=ce[1];break}if(6===ce[0]&&g.label<y[1]){g.label=y[1],y=ce;break}if(y&&g.label<y[2]){g.label=y[2],g.ops.push(ce);break}y[2]&&g.ops.pop(),g.trys.pop();continue}ce=E.call(A,g)}catch(Ae){ce=[6,Ae],C=0}finally{w=y=0}if(5&ce[0])throw ce[1];return{value:ce[0]?ce[1]:void 0,done:!0}}([ce,Ae])}}}function x(A,E,g,w){void 0===w&&(w=g),A[w]=E[g]}function U(A,E){for(var g in A)"default"!==g&&!E.hasOwnProperty(g)&&(E[g]=A[g])}function X(A){var E="function"==typeof Symbol&&Symbol.iterator,g=E&&A[E],w=0;if(g)return g.call(A);if(A&&"number"==typeof A.length)return{next:function(){return A&&w>=A.length&&(A=void 0),{value:A&&A[w++],done:!A}}};throw new TypeError(E?"Object is not iterable.":"Symbol.iterator is not defined.")}function B(A,E){var g="function"==typeof Symbol&&A[Symbol.iterator];if(!g)return A;var C,F,w=g.call(A),y=[];try{for(;(void 0===E||E-- >0)&&!(C=w.next()).done;)y.push(C.value)}catch(Q){F={error:Q}}finally{try{C&&!C.done&&(g=w.return)&&g.call(w)}finally{if(F)throw F.error}}return y}function p(){for(var A=[],E=0;E<arguments.length;E++)A=A.concat(B(arguments[E]));return A}function l(){for(var A=0,E=0,g=arguments.length;E<g;E++)A+=arguments[E].length;var w=Array(A),C=0;for(E=0;E<g;E++)for(var y=arguments[E],F=0,Q=y.length;F<Q;F++,C++)w[C]=y[F];return w}
1function O(A){return this instanceof O?(this.v=A,this):new O(A)}function L(A,E,g){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var C,w=g.apply(A,E||[]),y=[];return C={},F("next"),F("throw"),F("return"),C[Symbol.asyncIterator]=function(){return this},C;function F(ve){w[ve]&&(C[ve]=function(We){return new Promise(function(Ke,Et){y.push([ve,We,Ke,Et])>1||Q(ve,We)})})}function Q(ve,We){try{!function ge(ve){ve.value instanceof O?Promise.resolve(ve.value.v).then(ce,Ae):Te(y[0][2],ve)}(w[ve](We))}catch(Ke){Te(y[0][3],Ke)}}function ce(ve){Q("next",ve)}function Ae(ve){Q("throw",ve)}function Te(ve,We){ve(We),y.shift(),y.length&&Q(y[0][0],y[0][1])}}function _(A){var E,g;return E={},w("next"),w("throw",function(C){throw C}),w("return"),E[Symbol.iterator]=function(){return this},E;function w(C,y){E[C]=A[C]?function(F){return(g=!g)?{value:O(A[C](F)),done:"return"===C}:y?y(F):F}:y}}function I(A){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var g,E=A[Symbol.asyncIterator];return E?E.call(A):(A=X(A),g={},w("next"),w("throw"),w("return"),g[Symbol.asyncIterator]=function(){return this},g);function w(y){g[y]=A[y]&&function(F){return new Promise(function(Q,ge){!function C(y,F,Q,ge){Promise.resolve(ge).then(function(ce){y({value:ce,done:Q})},F)}(Q,ge,(F=A[y](F)).done,F.value)})}}}function D(A,E){return Object.defineProperty?Object.defineProperty(A,"raw",{value:E}):A.raw=E,A}function H(A){if(A&&A.__esModule)return A;var E={};if(null!=A)for(var g in A)Object.hasOwnProperty.call(A,g)&&(E[g]=A[g]);return E.default=A,E}function z(A){return A&&A.__esModule?A:{default:A}}function T(A,E){if(!E.has(A))throw new TypeError("attempted to get private field on non-instance");return E.get(A)}function W(A,E,g){if(!E.has(A))throw new TypeError("attempted to set private field on non-instance");return E.set(A,g),g}},80584(Ve,ne,u){"use strict";u.r(ne),u.d(ne,{__assign:()=>K,__asyncDelegator:()=>_,__asyncGenerator:()=>L,__asyncValues:()=>I,__await:()=>O,__awaiter:()=>v,__classPrivateFieldGet:()=>T,__classPrivateFieldSet:()=>W,__createBinding:()=>x,__decorate:()=>j,__exportStar:()=>U,__extends:()=>P,__generator:()=>$,__importDefault:()=>z,__importStar:()=>
1H,__makeTemplateObject:()=>D,__metadata:()=>k,__param:()=>R,__read:()=>B,__rest:()=>m,__spread:()=>p,__spreadArrays:()=>l,__values:()=>X});var S=function(A,E){return(S=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(g,w){g.__proto__=w}||function(g,w){for(var C in w)w.hasOwnProperty(C)&&(g[C]=w[C])})(A,E)};function P(A,E){function g(){this.constructor=A}S(A,E),A.prototype=null===E?Object.create(E):(g.prototype=E.prototype,new g)}var K=function(){return K=Object.assign||function(E){for(var g,w=1,C=arguments.length;w<C;w++)for(var y in g=arguments[w])Object.prototype.hasOwnProperty.call(g,y)&&(E[y]=g[y]);return E},K.apply(this,arguments)};function m(A,E){var g={};for(var w in A)Object.prototype.hasOwnProperty.call(A,w)&&E.indexOf(w)<0&&(g[w]=A[w]);if(null!=A&&"function"==typeof Object.getOwnPropertySymbols){var C=0;for(w=Object.getOwnPropertySymbols(A);C<w.length;C++)E.indexOf(w[C])<0&&Object.prototype.propertyIsEnumerable.call(A,w[C])&&(g[w[C]]=A[w[C]])}return g}function j(A,E,g,w){var F,C=arguments.length,y=C<3?E:null===w?w=Object.getOwnPropertyDescriptor(E,g):w;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)y=Reflect.decorate(A,E,g,w);else for(var Q=A.length-1;Q>=0;Q--)(F=A[Q])&&(y=(C<3?F(y):C>3?F(E,g,y):F(E,g))||y);return C>3&&y&&Object.defineProperty(E,g,y),y}function R(A,E){return function(g,w){E(g,w,A)}}function k(A,E){if("object"==typeof Reflect&&"function"==typeof Reflect.metadata)return Reflect.metadata(A,E)}function v(A,E,g,w){return new(g||(g=Promise))(function(y,F){function Q(Ae){try{ce(w.next(Ae))}catch(Te){F(Te)}}function ge(Ae){try{ce(w.throw(Ae))}catch(Te){F(Te)}}function ce(Ae){Ae.done?y(Ae.value):function C(y){return y instanceof g?y:new g(function(F){F(y)})}(Ae.value).then(Q,ge)}ce((w=w.apply(A,E||[])).next())})}function $(A,E){var w,C,y,F,g={label:0,sent:function(){if(1&y[0])throw y[1];return y[1]},trys:[],ops:[]};return F={next:Q(0),throw:Q(1),return:Q(2)},"function"==typeof Symbol&&(F[Symbol.iterator]=function(){return this}),F;function Q(ce){return function(Ae){return function ge(ce){if(w)throw new TypeError("Generator is already executing.");for(;g;)try{if(w=1,C&&(y=2&ce[0]?C.return:ce[0]?C.throw||((y=C.return)&&y.call(C),0):C.next)&&!(y=y.call(C,ce[1])).done)return y;switch(C=0,y&&(ce=[2&ce[0],y.value]),ce[0]){case 0:case 1:y=ce;break;case 4:return g.label++,{value:ce[1],done:!1};case 5:g.label++,C=ce[1],ce=[0];continue;case 7:ce=g.ops.pop(),g.trys.pop();continue;default:if(!(y=(y=g.trys).length>0&&y[y.length-1])&&(6===ce[0]||2===ce[0])){g=0;continue}if(3===ce[0]&&(!y||ce[1]>y[0]&&ce[1]<y[3])){g.label=ce[1];break}if(6===ce[0]&&g.label<y[1]){g.label=y[1],y=ce;break}if(y&&g.label<y[2]){g.label=y[2],g.ops.push(ce);break}y[2]&&g.ops.pop(),g.trys.pop();continue}ce=E.call(A,g)}catch(Ae){ce=[6,Ae],C=0}finally{w=y=0}if(5&ce[0])throw ce[1];return{value:ce[0]?ce[1]:void 0,done:!0}}([ce,Ae])}}}function x(A,E,g,w){void 0===w&&(w=g),A[w]=E[g]}function U(A,E){for(var g in A)"default"!==g&&!E.hasOwnProperty(g)&&(E[g]=A[g])}function X(A){var E="function"==typeof Symbol&&Symbol.iterator,g=E&&A[E],w=0;if(g)return g.call(A);if(A&&"number"==typeof A.length)return{next:function(){return A&&w>=A.length&&(A=void 0),{value:A&&A[w++],done:!A}}};throw new TypeError(E?"Object is not iterable.":"Symbol.iterator is not defined.")}function B(A,E){var g="function"==typeof Symbol&&A[Symbol.iterator];if(!g)return A;var C,F,w=g.call(A),y=[];try{for(;(void 0===E||E-- >0)&&!(C=w.next()).done;)y.push(C.value)}catch(Q){F={error:Q}}finally{try{C&&!C.done&&(g=w.return)&&g.call(w)}finally{if(F)throw F.error}}return y}function p(){for(var A=[],E=0;E<arguments.length;E++)A=A.concat(B(arguments[E]));return A}function l(){for(var A=0,E=0,g=arguments.length;E<g;E++)A+=arguments[E].length;var w=Array(A),C=0;for(E=0;E<g;E++)for(var y=arguments[E],F=0,Q=y.length;F<Q;F++,C++)w[C]=y[F];return w}
1function O(A){return this instanceof O?(this.v=A,this):new O(A)}function L(A,E,g){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var C,w=g.apply(A,E||[]),y=[];return C={},F("next"),F("throw"),F("return"),C[Symbol.asyncIterator]=function(){return this},C;function F(ve){w[ve]&&(C[ve]=function(We){return new Promise(function(Ke,Et){y.push([ve,We,Ke,Et])>1||Q(ve,We)})})}function Q(ve,We){try{!function ge(ve){ve.value instanceof O?Promise.resolve(ve.value.v).then(ce,Ae):Te(y[0][2],ve)}(w[ve](We))}catch(Ke){Te(y[0][3],Ke)}}function ce(ve){Q("next",ve)}function Ae(ve){Q("throw",ve)}function Te(ve,We){ve(We),y.shift(),y.length&&Q(y[0][0],y[0][1])}}function _(A){var E,g;return E={},w("next"),w("throw",function(C){throw C}),w("return"),E[Symbol.iterator]=function(){return this},E;function w(C,y){E[C]=A[C]?function(F){return(g=!g)?{value:O(A[C](F)),done:"return"===C}:y?y(F):F}:y}}function I(A){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var g,E=A[Symbol.asyncIterator];return E?E.call(A):(A=X(A),g={},w("next"),w("throw"),w("return"),g[Symbol.asyncIterator]=function(){return this},g);function w(y){g[y]=A[y]&&function(F){return new Promise(function(Q,ge){!function C(y,F,Q,ge){Promise.resolve(ge).then(function(ce){y({value:ce,done:Q})},F)}(Q,ge,(F=A[y](F)).done,F.value)})}}}function D(A,E){return Object.defineProperty?Object.defineProperty(A,"raw",{value:E}):A.raw=E,A}function H(A){if(A&&A.__esModule)return A;var E={};if(null!=A)for(var g in A)Object.hasOwnProperty.call(A,g)&&(E[g]=A[g]);return E.default=A,E}function z(A){return A&&A.__esModule?A:{default:A}}function T(A,E){if(!E.has(A))throw new TypeError("attempted to get private field on non-instance");return E.get(A)}function W(A,E,g){if(!E.has(A))throw new TypeError("attempted to set private field on non-instance");return E.set(A,g),g}},16693(Ve,ne,u){"use strict";u.d(ne,{mN:()=>A,AH:()=>v,W3:()=>z,Ec:()=>T,iz:()=>k});var S=u(10467);const P=globalThis,K=P.ShadowRoot&&(void 0===P.ShadyCSS||P.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,m=Symbol(),j=new WeakMap;class R{constructor(g,w,C){if(this._$cssResult$=!0,C!==m)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=g,this.t=w}get styleSheet(){let g=this.o;const w=this.t;if(K&&void 0===g){const C=void 0!==w&&1===w.length;C&&(g=j.get(w)),void 0===g&&((this.o=g=new CSSStyleSheet).replaceSync(this.cssText),C&&j.set(w,g))}return g}toString(){return this.cssText}}const k=E=>new R("string"==typeof E?E:E+"",void 0,m),v=(E,...g)=>{const w=1===E.length?E[0]:g.reduce((C,y,F)=>C+(Q=>{if(!0===Q._$cssResult$)return Q.cssText;if("number"==typeof Q)return Q;throw Error("Value passed to 'css' function must be a 'css' function result: "+Q+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(y)+E[F+1],E[0]);return new R(w,E,m)},x=K?E=>E:E=>E instanceof CSSStyleSheet?(g=>{let w="";for(const C of g.cssRules)w+=C.cssText;return k(w)})(E):E,{is:U,defineProperty:X,getOwnPropertyDescriptor:B,getOwnPropertyNames:p,getOwnPropertySymbols:l,getPrototypeOf:O}=Object,L=globalThis,_=L.trustedTypes,I=_?_.emptyScript:"",D=L.reactiveElementPolyfillSupport,H=(E,g)=>E,z={toAttribute(E,g){switch(g){case Boolean:E=E?I:null;break;case Object:case Array:E=null==E?E:JSON.stringify(E)}return E},fromAttribute(E,g){let w=E;switch(g){case Boolean:w=null!==E;break;case Number:w=null===E?null:Number(E);break;case Object:case Array:try{w=JSON.parse(E)}catch{w=null}}return w}},T=(E,g)=>!U(E,g),W={attribute:!0,type:String,converter:z,reflect:!1,useDefault:!1,hasChanged:T};Symbol.metadata??=Symbol("metadata"),L.litPropertyMetadata??=new WeakMap;class A extends HTMLElement{static addInitializer(g){this._$Ei(),(this.l??=[]).push(g)}static get observedAttributes(){return this.finalize(),this._$Eh&&[...this._$Eh.keys()]}static createProperty(g,w=W){if(w.state&&(w.attribute=!1),this._$Ei(),this.prototype.hasOwnProperty(g)&&((w=Object.create(w)).wrapped=!0),this.elementProperties.set(g,w),!w.noAccessor){const y=this.getPropertyDescriptor(g,Symbol(),w);void 0!==y&&X(this.prototype,g,y)}}static getPropertyDescriptor(g,w,C){const{get:y,set:F}=B(this.prototype,g)??{get(){return this[w]},set(Q){this[w]=Q}};return{get:y,set(Q){const ge=y?.call(this);F?.call(this,Q),this.requestUpdate(g,ge,C)},configurable:!0,enumerable:!0}}static getPropertyOptions(g){return this.elementProperties.get(g)??W}static _$Ei(){if(this.hasOwnProperty(H("elementProperties")))return;const g=O(this);g.finalize(),void 0!==g.l&&(this.l=[...g.l]),this.elementProperties=new Map(g.elementProperties)}static finalize(){if(this.hasOwnProperty(H("finalized")))return;if(this.finalized=!0,this._$Ei(),this.hasOwnProperty(H("properties"))){const w=this.properties,C=[...p(w),...l(w)];for(const y of C)this.createProperty(y,w[y])}const g=this[Symbol.metadata];if(null!==g){const w=litPropertyMetadata.get(g);if(void 0!==w)for(const[C,y]of w)this.elementProperties.set(C,y)}this._$Eh=new Map;for(const[w,C]of this.elementProperties){const y=this._$Eu(w,C);void 0!==y&&this._$Eh.set(y,w)}this.elementStyles=this.finalizeStyles(this.styles)}static finalizeStyles(g){const w=[];if(Array.isArray(g)){const C=new Set(g.flat(1/0).reverse());for(const y of C)w.unshift(x(y))}else void 0!==g&&w.push(x(g));return w}static _$Eu(g,w){const C=w.attribute;return!1===C?void 0:"string"==typeof C?C:"string"==typeof g?g.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(g=>this.enableUpdating=g),this._$AL=new Map,this._$E_(),this.requestUpdate(),this.constructor.l?.forEach(g=>g(this))}addController(g){(this._$EO??=new Set).add(g),void 0!==this.renderRoot&&this.isConnected&&g.hostConnected?.()}
1removeController(g){this._$EO?.delete(g)}_$E_(){const g=new Map,w=this.constructor.elementProperties;for(const C of w.keys())this.hasOwnProperty(C)&&(g.set(C,this[C]),delete this[C]);g.size>0&&(this._$Ep=g)}createRenderRoot(){const g=this.shadowRoot??this.attachShadow(this.constructor.shadowRootOptions);return((E,g)=>{if(K)E.adoptedStyleSheets=g.map(w=>w instanceof CSSStyleSheet?w:w.styleSheet);else for(const w of g){const C=document.createElement("style"),y=P.litNonce;void 0!==y&&C.setAttribute("nonce",y),C.textContent=w.cssText,E.appendChild(C)}})(g,this.constructor.elementStyles),g}connectedCallback(){this.renderRoot??=this.createRenderRoot(),this.enableUpdating(!0),this._$EO?.forEach(g=>g.hostConnected?.())}enableUpdating(g){}disconnectedCallback(){this._$EO?.forEach(g=>g.hostDisconnected?.())}attributeChangedCallback(g,w,C){this._$AK(g,C)}_$ET(g,w){const C=this.constructor.elementProperties.get(g),y=this.constructor._$Eu(g,C);if(void 0!==y&&!0===C.reflect){const F=(void 0!==C.converter?.toAttribute?C.converter:z).toAttribute(w,C.type);this._$Em=g,null==F?this.removeAttribute(y):this.setAttribute(y,F),this._$Em=null}}_$AK(g,w){const C=this.constructor,y=C._$Eh.get(g);if(void 0!==y&&this._$Em!==y){const F=C.getPropertyOptions(y),Q="function"==typeof F.converter?{fromAttribute:F.converter}:void 0!==F.converter?.fromAttribute?F.converter:z;this._$Em=y;const ge=Q.fromAttribute(w,F.type);this[y]=ge??this._$Ej?.get(y)??ge,this._$Em=null}}requestUpdate(g,w,C,y=!1,F){if(void 0!==g){const Q=this.constructor;if(!1===y&&(F=this[g]),C??=Q.getPropertyOptions(g),!((C.hasChanged??T)(F,w)||C.useDefault&&C.reflect&&F===this._$Ej?.get(g)&&!this.hasAttribute(Q._$Eu(g,C))))return;this.C(g,w,C)}!1===this.isUpdatePending&&(this._$ES=this._$EP())}C(g,w,{useDefault:C,reflect:y,wrapped:F},Q){C&&!(this._$Ej??=new Map).has(g)&&(this._$Ej.set(g,Q??w??this[g]),!0!==F||void 0!==Q)||(this._$AL.has(g)||(this.hasUpdated||C||(w=void 0),this._$AL.set(g,w)),!0===y&&this._$Em!==g&&(this._$Eq??=new Set).add(g))}_$EP(){var g=this;return(0,S.A)(function*(){g.isUpdatePending=!0;try{yield g._$ES}catch(C){Promise.reject(C)}const w=g.scheduleUpdate();return null!=w&&(yield w),!g.isUpdatePending})()}scheduleUpdate(){return this.performUpdate()}performUpdate(){if(!this.isUpdatePending)return;if(!this.hasUpdated){if(this.renderRoot??=this.createRenderRoot(),this._$Ep){for(const[y,F]of this._$Ep)this[y]=F;this._$Ep=void 0}const C=this.constructor.elementProperties;if(C.size>0)for(const[y,F]of C){const{wrapped:Q}=F,ge=this[y];!0!==Q||this._$AL.has(y)||void 0===ge||this.C(y,void 0,F,ge)}}let g=!1;const w=this._$AL;try{g=this.shouldUpdate(w),g?(this.willUpdate(w),this._$EO?.forEach(C=>C.hostUpdate?.()),this.update(w)):this._$EM()}catch(C){throw g=!1,this._$EM(),C}g&&this._$AE(w)}willUpdate(g){}_$AE(g){this._$EO?.forEach(w=>w.hostUpdated?.()),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(g)),this.updated(g)}_$EM(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$ES}shouldUpdate(g){return!0}update(g){this._$Eq&&=this._$Eq.forEach(w=>this._$ET(w,this[w])),this._$EM()}updated(g){}firstUpdated(g){}}A.elementStyles=[],A.shadowRootOptions={mode:"open"},A[H("elementProperties")]=new Map,A[H("finalized")]=new Map,D?.({ReactiveElement:A}),(L.reactiveElementVersions??=[]).push("2.1.2")},8722(Ve,ne,u){"use strict";u.d(ne,{v:()=>j});const S=[{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"}]}],P=[{type:"function",name:"approve",stateMutability:"nonpayable",inputs:[{name:"spender",type:"address"},{name:"amount",type:"uint256"}],outputs:[{type:"bool"}]}],K=[{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 m=u(30193);const j={getERC20Abi:R=>m.o.USDT_CONTRACT_ADDRESSES.includes(R)?K:S,getSwapAbi:()=>P}},99262(Ve,ne,u){"use strict";u.d(ne,{r:()=>k});var S=u(67374),P=u(69785),K=u(85164),m=u(47538);S.extend(K),S.extend(m);const j={...P,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"}},R=["January","February","March","April","May","June","July","August","September","October","November","December"];S.locale("en-web3-modal",j);const k={getMonthNameByIndex:v=>R[v],getYear:(v=(new Date).toISOString())=>S(v).year(),getRelativeDateFromNow:v=>S(v).locale("en-web3-modal").fromNow(!0),formatDate:(v,$="DD MMM")=>S(v).format($)}},80134(Ve,ne,u){"use strict";u.d(ne,{RQ:()=>S,vx:()=>K});const S={RPC_ERROR_CODE:{USER_REJECTED_REQUEST:4001,USER_REJECTED_METHODS:5002,USER_REJECTED:5e3,SEND_TRANSACTION_ERROR:5001},PROVIDER_RPC_ERROR_NAME:{PROVIDER_RPC:"ProviderRpcError",USER_REJECTED_REQUEST:"UserRejectedRequestError",SEND_TRANSACTION_ERROR:"SendTransactionError"},isRpcProviderError(j){try{return"object"==typeof j&&null!==j&&("string"==typeof j.message&&"number"==typeof j.code)}catch{return!1}},isUserRejectedMessage:j=>j.toLowerCase().includes("user rejected")||j.toLowerCase().includes("user cancelled")||j.toLowerCase().includes("user canceled"),isUserRejectedRequestError:j=>S.isRpcProviderError(j)?j.code===S.RPC_ERROR_CODE.USER_REJECTED_REQUEST||j.code===S.RPC_ERROR_CODE.USER_REJECTED_METHODS||S.isUserRejectedMessage(j.message):j instanceof Error&&S.isUserRejectedMessage(j.message)};
vendor: 5,622 bytes, line 1
1class P extends Error{constructor(R,k){super(k.message,{cause:R}),this.name=S.PROVIDER_RPC_ERROR_NAME.PROVIDER_RPC,this.code=k.code}}class K extends P{constructor(R){super(R,{code:S.RPC_ERROR_CODE.USER_REJECTED_REQUEST,message:"User rejected the request"}),this.name=S.PROVIDER_RPC_ERROR_NAME.USER_REJECTED_REQUEST}}},31849(Ve,ne,u){"use strict";u.d(ne,{y:()=>S});const S={isLowerCaseMatch:(P,K)=>P?.toLowerCase()===K?.toLowerCase()}},12699(Ve,ne,u){"use strict";u.d(ne,{S:()=>z});var K=1e6,m=1e6,v="[big.js] ",$=v+"Invalid ",x=$+"decimal places",U=$+"rounding mode",X=v+"Division by zero",B={},p=void 0,l=/^-?(\d+(\.\d*)?|\.\d+)(e[+-]?\d+)?$/i;function _(T,W,A,E){var g=T.c;if(A===p&&(A=T.constructor.RM),0!==A&&1!==A&&2!==A&&3!==A)throw Error(U);if(W<1)E=3===A&&(E||!!g[0])||0===W&&(1===A&&g[0]>=5||2===A&&(g[0]>5||5===g[0]&&(E||g[1]!==p))),g.length=1,E?(T.e=T.e-W+1,g[0]=1):g[0]=T.e=0;else if(W<g.length){if(E=1===A&&g[W]>=5||2===A&&(g[W]>5||5===g[W]&&(E||g[W+1]!==p||1&g[W-1]))||3===A&&(E||!!g[0]),g.length=W,E)for(;++g[--W]>9;)if(g[W]=0,0===W){++T.e,g.unshift(1);break}for(W=g.length;!g[--W];)g.pop()}return T}function I(T,W,A){var E=T.e,g=T.c.join(""),w=g.length;if(W)g=g.charAt(0)+(w>1?"."+g.slice(1):"")+(E<0?"e":"e+")+E;else if(E<0){for(;++E;)g="0"+g;g="0."+g}else if(E>0)if(++E>w)for(E-=w;E--;)g+="0";else E<w&&(g=g.slice(0,E)+"."+g.slice(E));else w>1&&(g=g.charAt(0)+"."+g.slice(1));return T.s<0&&A?"-"+g:g}B.abs=function(){var T=new this.constructor(this);return T.s=1,T},B.cmp=function(T){var W,A=this,E=A.c,g=(T=new A.constructor(T)).c,w=A.s,C=T.s,y=A.e,F=T.e;if(!E[0]||!g[0])return E[0]?w:g[0]?-C:0;if(w!=C)return w;if(W=w<0,y!=F)return y>F^W?1:-1;for(C=(y=E.length)<(F=g.length)?y:F,w=-1;++w<C;)if(E[w]!=g[w])return E[w]>g[w]^W?1:-1;return y==F?0:y>F^W?1:-1},B.div=function(T){var W=this,A=W.constructor,E=W.c,g=(T=new A(T)).c,w=W.s==T.s?1:-1,C=A.DP;if(C!==~~C||C<0||C>K)throw Error(x);if(!g[0])throw Error(X);if(!E[0])return T.s=w,T.c=[T.e=0],T;var y,F,Q,ge,ce,Ae=g.slice(),Te=y=g.length,ve=E.length,We=E.slice(0,y),Ke=We.length,Et=T,jt=Et.c=[],Pt=0,wt=C+(Et.e=W.e-T.e)+1;for(Et.s=w,w=wt<0?0:wt,Ae.unshift(0);Ke++<y;)We.push(0);do{for(Q=0;Q<10;Q++){if(y!=(Ke=We.length))ge=y>Ke?1:-1;else for(ce=-1,ge=0;++ce<y;)if(g[ce]!=We[ce]){ge=g[ce]>We[ce]?1:-1;break}if(!(ge<0))break;for(F=Ke==y?g:Ae;Ke;){if(We[--Ke]<F[Ke]){for(ce=Ke;ce&&!We[--ce];)We[ce]=9;--We[ce],We[Ke]+=10}We[Ke]-=F[Ke]}for(;!We[0];)We.shift()}jt[Pt++]=ge?Q:++Q,We[0]&&ge?We[Ke]=E[Te]||0:We=[E[Te]]}while((Te++<ve||We[0]!==p)&&w--);return!jt[0]&&1!=Pt&&(jt.shift(),Et.e--,wt--),Pt>wt&&_(Et,wt,A.RM,We[0]!==p),Et},B.eq=function(T){return 0===this.cmp(T)},B.gt=function(T){return this.cmp(T)>0},B.gte=function(T){return this.cmp(T)>-1},B.lt=function(T){return this.cmp(T)<0},B.lte=function(T){return this.cmp(T)<1},B.minus=B.sub=function(T){var W,A,E,g,w=this,C=w.constructor,y=w.s,F=(T=new C(T)).s;if(y!=F)return T.s=-F,w.plus(T);var Q=w.c.slice(),ge=w.e,ce=T.c,Ae=T.e;if(!Q[0]||!ce[0])return ce[0]?T.s=-F:Q[0]?T=new C(w):T.s=1,T;if(y=ge-Ae){for((g=y<0)?(y=-y,E=Q):(Ae=ge,E=ce),E.reverse(),F=y;F--;)E.push(0);E.reverse()}else for(A=((g=Q.length<ce.length)?Q:ce).length,y=F=0;F<A;F++)if(Q[F]!=ce[F]){g=Q[F]<ce[F];break}if(g&&(E=Q,Q=ce,ce=E,T.s=-T.s),(F=(A=ce.length)-(W=Q.length))>0)for(;F--;)Q[W++]=0;for(F=W;A>y;){if(Q[--A]<ce[A]){for(W=A;W&&!Q[--W];)Q[W]=9;--Q[W],Q[A]+=10}Q[A]-=ce[A]}for(;0===Q[--F];)Q.pop();for(;0===Q[0];)Q.shift(),--Ae;return Q[0]||(T.s=1,Q=[Ae=0]),T.c=Q,T.e=Ae,T},B.mod=function(T){var W,A=this,E=A.constructor,g=A.s,w=(T=new E(T)).s;if(!T.c[0])throw Error(X);return A.s=T.s=1,W=1==T.cmp(A),A.s=g,T.s=w,W?new E(A):(g=E.DP,w=E.RM,E.DP=E.RM=0,A=A.div(T),E.DP=g,E.RM=w,this.minus(A.times(T)))},B.neg=function(){var T=new this.constructor(this);return T.s=-T.s,T},B.plus=B.add=function(T){var W,A,E,g=this,w=g.constructor;if(T=new w(T),g.s!=T.s)return T.s=-T.s,g.minus(T);var C=g.e,y=g.c,F=T.e,Q=T.c;if(!y[0]||!Q[0])return Q[0]||(y[0]?T=new w(g):T.s=g.s),T;if(y=y.slice(),W=C-F){for(W>0?(F=C,E=Q):(W=-W,E=y),E.reverse();W--;)E.push(0);E.reverse()}for(y.length-Q.length<0&&(E=Q,Q=y,y=E),W=Q.length,A=0;W;y[W]%=10)A=(y[--W]=y[W]+Q[W]+A)/10|0;for(A&&(y.unshift(A),++F),W=y.length;0===y[--W];)y.pop();return T.c=y,T.e=F,T},B.pow=function(T){var W=this,A=new W.constructor("1"),E=A,g=T<0;if(T!==~~T||T<-m||T>m)throw Error($+"exponent");for(g&&(T=-T);1&T&&(E=E.times(W)),T>>=1;)W=W.times(W);return g?A.div(E):E},B.prec=function(T,W){if(T!==~~T||T<1||T>K)throw Error($+"precision");return _(new this.constructor(this),T,W)},B.round=function(T,W){if(T===p)T=0;else if(T!==~~T||T<-K||T>K)throw Error(x);return _(new this.constructor(this),T+this.e+1,W)},B.sqrt=function(){var T,W,A,E=this,g=E.constructor,w=E.s,C=E.e,y=new g("0.5");if(!E.c[0])return new g(E);if(w<0)throw Error(v+"No square root");0===(w=Math.sqrt(+I(E,!0,!0)))||w===1/0?((W=E.c.join("")).length+C&1||(W+="0"),C=((C+1)/2|0)-(C<0||1&C),T=new g(((w=Math.sqrt(W))==1/0?"5e":(w=w.toExponential()).slice(0,w.indexOf("e")+1))+C)):T=new g(w+""),C=T.e+(g.DP+=4);do{T=y.times((A=T).plus(E.div(A)))}while(A.c.slice(0,C).join("")!==T.c.slice(0,C).join(""));return _(T,(g.DP-=4)+T.e+1,g.RM)},B.times=B.mul=function(T){var W,A=this,g=A.c,w=(T=new(0,A.constructor)(T)).c,C=g.length,y=w.length,F=A.e,Q=T.e;if(T.s=A.s==T.s?1:-1,!g[0]||!w[0])return T.c=[T.e=0],T;for(T.e=F+Q,C<y&&(W=g,g=w,w=W,Q=C,C=y,y=Q),W=new Array(Q=C+y);Q--;)W[Q]=0;for(F=y;F--;){for(y=0,Q=C+F;Q>F;)y=W[Q]+w[F]*g[Q-F-1]+y,W[Q--]=y%10,y=y/10|0;W[Q]=y}for(y?++T.e:W.shift(),F=W.length;!W[--F];)W.pop();return T.c=W,T},B.toExponential=function(T,W){var A=this,E=A.c[0];if(T!==p){if(T!==~~T||T<0||T>K)throw Error(x);
1for(A=_(new A.constructor(A),++T,W);A.c.length<T;)A.c.push(0)}return I(A,!0,!!E)},B.toFixed=function(T,W){var A=this,E=A.c[0];if(T!==p){if(T!==~~T||T<0||T>K)throw Error(x);for(T=T+(A=_(new A.constructor(A),T+A.e+1,W)).e+1;A.c.length<T;)A.c.push(0)}return I(A,!1,!!E)},B[Symbol.for("nodejs.util.inspect.custom")]=B.toJSON=B.toString=function(){var T=this,W=T.constructor;return I(T,T.e<=W.NE||T.e>=W.PE,!!T.c[0])},B.toNumber=function(){var T=+I(this,!0,!0);if(!0===this.constructor.strict&&!this.eq(T.toString()))throw Error(v+"Imprecise conversion");return T},B.toPrecision=function(T,W){var A=this,E=A.constructor,g=A.c[0];if(T!==p){if(T!==~~T||T<1||T>K)throw Error($+"precision");for(A=_(new E(A),T,W);A.c.length<T;)A.c.push(0)}return I(A,T<=A.e||A.e<=E.NE||A.e>=E.PE,!!g)},B.valueOf=function(){var T=this,W=T.constructor;if(!0===W.strict)throw Error(v+"valueOf disallowed");return I(T,T.e<=W.NE||T.e>=W.PE,!0)};const H=function O(){function T(W){var A=this;if(!(A instanceof T))return W===p?O():new T(W);if(W instanceof T)A.s=W.s,A.e=W.e,A.c=W.c.slice();else{if("string"!=typeof W){if(!0===T.strict&&"bigint"!=typeof W)throw TypeError($+"value");W=0===W&&1/W<0?"-0":String(W)}!function L(T,W){var A,E,g;if(!l.test(W))throw Error($+"number");for(T.s="-"==W.charAt(0)?(W=W.slice(1),-1):1,(A=W.indexOf("."))>-1&&(W=W.replace(".","")),(E=W.search(/e/i))>0?(A<0&&(A=E),A+=+W.slice(E+1),W=W.substring(0,E)):A<0&&(A=W.length),g=W.length,E=0;E<g&&"0"==W.charAt(E);)++E;if(E==g)T.c=[T.e=0];else{for(;g>0&&"0"==W.charAt(--g););for(T.e=A-E-1,T.c=[],A=0;E<=g;)T.c[A++]=+W.charAt(E++)}}(A,W)}A.constructor=T}return T.prototype=B,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}(),z={bigNumber(T,W={safe:!1}){try{return new H(T||0)}catch(A){if(W.safe)return new H(0);throw A}},formatNumber(T,W){const{decimals:A,round:E=8,safe:g=!0}=W;return z.bigNumber(T,{safe:g}).div(new H(10).pow(A)).round(E)},multiply(T,W){if(void 0===T||void 0===W)return new H(0);const A=new H(T),E=new H(W);return A.times(E)},toFixed:(T,W=2)=>void 0===T||""===T?new H(0).toFixed(W):new H(T).toFixed(W),formatNumberToLocalString:(T,W=2)=>void 0===T||""===T?"0.00":"number"==typeof T?T.toLocaleString("en-US",{maximumFractionDigits:W,minimumFractionDigits:W,roundingMode:"floor"}):parseFloat(T).toLocaleString("en-US",{maximumFractionDigits:W,minimumFractionDigits:W,roundingMode:"floor"}),parseLocalStringToNumber(T){if(void 0===T||""===T)return 0;const W=T.replace(/,/gu,"");return new H(W).toNumber()}}},68095(Ve,ne,u){"use strict";u.d(ne,{C:()=>S});const S={validateCaipAddress(P){if(3!==P.split(":")?.length)throw new Error("Invalid CAIP Address");return P},parseCaipAddress(P){const K=P.split(":");if(3!==K.length)throw new Error(`Invalid CAIP-10 address: ${P}`);const[m,j,R]=K;if(!m||!j||!R)throw new Error(`Invalid CAIP-10 address: ${P}`);return{chainNamespace:m,chainId:j,address:R}},parseCaipNetworkId(P){const K=P.split(":");if(2!==K.length)throw new Error(`Invalid CAIP-2 network id: ${P}`);const[m,j]=K;if(!m||!j)throw new Error(`Invalid CAIP-2 network id: ${P}`);return{chainNamespace:m,chainId:j}}}},27448(Ve,ne,u){"use strict";u.d(ne,{L:()=>P});var S=u(30193);const P={ConnectorExplorerIds:{[S.o.CONNECTOR_ID.COINBASE]:"d0ca99ff52b99abc48743dad0f7fc891e041be73574f7fac4afe5d4bb83845c8",[S.o.CONNECTOR_ID.COINBASE_SDK]:"d0ca99ff52b99abc48743dad0f7fc891e041be73574f7fac4afe5d4bb83845c8",[S.o.CONNECTOR_ID.BASE_ACCOUNT]:"fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa",[S.o.CONNECTOR_ID.SAFE]:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",[S.o.CONNECTOR_ID.LEDGER]:"19177a98252e07ddfc9af2083ba8e07ef627cb6103467ffebb3f8f4205fd7927",[S.o.CONNECTOR_ID.OKX]:"971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709",[S.o.METMASK_CONNECTOR_NAME]:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",[S.o.TRUST_CONNECTOR_NAME]:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",[S.o.SOLFLARE_CONNECTOR_NAME]:"1ca0bdd4747578705b1939af023d120677c64fe6ca76add81fda36e350605e79",[S.o.PHANTOM_CONNECTOR_NAME]:"a797aa35c0fadbfc1a53e7f675162ed5226968b44a19ee3d24385c64d1d3c393",[S.o.COIN98_CONNECTOR_NAME]:"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01",[S.o.MAGIC_EDEN_CONNECTOR_NAME]:"8b830a2b724a9c3fbab63af6f55ed29c9dfa8a55e732dc88c80a196a2ba136c6",[S.o.BACKPACK_CONNECTOR_NAME]:"2bd8c14e035c2d48f184aaa168559e86b0e3433228d3c4075900a221785019b0",[S.o.BITGET_CONNECTOR_NAME]:"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",[S.o.FRONTIER_CONNECTOR_NAME]:"85db431492aa2e8672e93f4ea7acf10c88b97b867b0d373107af63dc4880f041",[S.o.XVERSE_CONNECTOR_NAME]:"2a87d74ae02e10bdd1f51f7ce6c4e1cc53cd5f2c0b6b5ad0d7b300
17d2b13de7b",[S.o.LEATHER_CONNECTOR_NAME]:"483afe1df1df63daf313109971ff3ef8356ddf1cc4e45877d205eee0b7893a13",[S.o.OKX_CONNECTOR_NAME]:"971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709",[S.o.BINANCE_CONNECTOR_NAME]:"2fafea35bb471d22889ccb49c08d99dd0a18a37982602c33f696a5723934ba25"},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",143:"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","00000008819873e925422c1ff0f99f7c":"b3406e4a-bbfc-44fb-e3a6-89673c78b700","-239":"20f673c0-095e-49b2-07cf-eb5049dcf600","-3":"20f673c0-095e-49b2-07cf-eb5049dcf600","0x2b6653dc":"3502bb86-cc4e-420f-a387-59ea63a28b00","0x94a9059e":"3502bb86-cc4e-420f-a387-59ea63a28b00","0xcd8690dc":"3502bb86-cc4e-420f-a387-59ea63a28b00"},ConnectorImageIds:{[S.o.CONNECTOR_ID.COINBASE]:"0c2840c3-5b04-4c44-9661-fbd4b49e1800",[S.o.CONNECTOR_ID.COINBASE_SDK]:"0c2840c3-5b04-4c44-9661-fbd4b49e1800",[S.o.CONNECTOR_ID.BASE_ACCOUNT]:"bba2c8be-7fd1-463e-42b1-796ecb0ad200",[S.o.CONNECTOR_ID.SAFE]:"461db637-8616-43ce-035a-d89b8a1d5800",[S.o.CONNECTOR_ID.LEDGER]:"54a1aa77-d202-4f8d-0fb2-5d2bb6db0300",[S.o.CONNECTOR_ID.WALLET_CONNECT]:"ef1a1fcf-7fe8-4d69-bd6d-fda1345b4400",[S.o.CONNECTOR_ID.INJECTED]:"07ba87ed-43aa-4adf-4540-9e6a2b9cae00"},ConnectorNamesMap:{[S.o.CONNECTOR_ID.INJECTED]:"Browser Wallet",[S.o.CONNECTOR_ID.WALLET_CONNECT]:"WalletConnect",[S.o.CONNECTOR_ID.COINBASE]:"Coinbase",[S.o.CONNECTOR_ID.COINBASE_SDK]:"Coinbase",[S.o.CONNECTOR_ID.BASE_ACCOUNT]:"Base Account",[S.o.CONNECTOR_ID.LEDGER]:"Ledger",[S.o.CONNECTOR_ID.SAFE]:"Safe"},ConnectorTypesMap:{[S.o.CONNECTOR_ID.INJECTED]:"INJECTED",[S.o.CONNECTOR_ID.WALLET_CONNECT]:"WALLET_CONNECT",[S.o.CONNECTOR_ID.EIP6963]:"ANNOUNCED",[S.o.CONNECTOR_ID.AUTH]:"AUTH",[S.o.CONNECTOR_ID.COINBASE]:"EXTERNAL",[S.o.CONNECTOR_ID.COINBASE_SDK]:"EXTERNAL",[S.o.CONNECTOR_ID.BASE_ACCOUNT]:"EXTERNAL"},WalletConnectRpcChainIds:[1,5,11155111,10,420,42161,421613,137,80001,42220,1313161554,1313161555,56,97,43114,43113,100,8453,84531,7777777,999,324,280]}},99983(Ve,ne,u){"use strict";u.d(ne,{IP:()=>m,T8:()=>P,Ud:()=>K,Ws:()=>S});const S={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",RECENT_WALLET:"@appkit/recent_wallet",DEEPLINK_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_cac
1he",ENS_CACHE:"@appkit/ens_cache",IDENTITY_CACHE:"@appkit/identity_cache",PREFERRED_ACCOUNT_TYPES:"@appkit/preferred_account_types",CONNECTIONS:"@appkit/connections",DISCONNECTED_CONNECTOR_IDS:"@appkit/disconnected_connector_ids",HISTORY_TRANSACTIONS_CACHE:"@appkit/history_transactions_cache",TOKEN_PRICE_CACHE:"@appkit/token_price_cache",RECENT_EMAILS:"@appkit/recent_emails",LATEST_APPKIT_VERSION:"@appkit/latest_version",TON_WALLETS_CACHE:"@appkit/ton_wallets_cache"};function P(j){if(!j)throw new Error("Namespace is required for CONNECTED_CONNECTOR_ID");return`@appkit/${j}:connected_connector_id`}const K={setItem(j,R){m()&&void 0!==R&&localStorage.setItem(j,R)},getItem(j){if(m())return localStorage.getItem(j)||void 0},removeItem(j){m()&&localStorage.removeItem(j)},clear(){m()&&localStorage.clear()}};function m(){return typeof window<"u"&&typeof localStorage<"u"}},61113(Ve,ne,u){"use strict";function S(P,K){const m=P?.["--apkt-accent"]??P?.["--w3m-accent"];return"light"===K?{"--w3m-accent":m||"hsla(231, 100%, 70%, 1)","--w3m-background":"#fff"}:{"--w3m-accent":m||"hsla(230, 100%, 67%, 1)","--w3m-background":"#202020"}}u.d(ne,{o:()=>S})},53681(Ve,ne,u){"use strict";u.d(ne,{X:()=>X});var S=u(10467),K=(u(79231),u(30193)),m=u(80134),j=u(96667),R=u(66915),k=u(19069),v=u(17895),$=u(27881),x=u(25637);const U=[K.o.CONNECTOR_ID.AUTH,K.o.CONNECTOR_ID.WALLET_CONNECT];class X{constructor(p){this.availableConnectors=[],this.availableConnections=[],this.providerHandlers={},this.eventListeners=new Map,this.getCaipNetworks=l=>v.W.getCaipNetworks(l),this.getConnectorId=l=>$.a.getConnectorId(l),p&&this.construct(p)}construct(p){this.projectId=p.projectId,this.namespace=p.namespace,this.adapterType=p.adapterType}get connectors(){return this.availableConnectors}get connections(){return this.availableConnections}get networks(){return this.getCaipNetworks(this.namespace)}onAuthConnected({accounts:p,chainId:l}){const O=this.getCaipNetworks().filter(L=>L.chainNamespace===this.namespace).find(L=>L.id.toString()===l?.toString());p&&O&&this.addConnection({connectorId:K.o.CONNECTOR_ID.AUTH,accounts:p,caipNetwork:O})}setAuthProvider(p){p.onConnect(this.onAuthConnected.bind(this)),p.onSocialConnected(this.onAuthConnected.bind(this)),this.addConnector({id:K.o.CONNECTOR_ID.AUTH,type:"AUTH",name:K.o.CONNECTOR_NAMES.AUTH,provider:p,imageId:void 0,chain:this.namespace,chains:[]})}addConnector(...p){const l=new Set;this.availableConnectors=[...p,...this.availableConnectors].filter(O=>!l.has(O.id)&&(l.add(O.id),!0)),this.emit("connectors",this.availableConnectors)}addConnection(...p){const l=new Set;this.availableConnections=[...p,...this.availableConnections].filter(O=>!l.has(O.connectorId.toLowerCase())&&(l.add(O.connectorId.toLowerCase()),!0)),this.emit("connections",this.availableConnections)}deleteConnection(p){this.availableConnections=this.availableConnections.filter(l=>l.connectorId.toLowerCase()!==p.toLowerCase()),this.emit("connections",this.availableConnections)}clearConnections(p=!1){this.availableConnections=[],p&&this.emit("connections",this.availableConnections)}setStatus(p,l){v.W.setAccountProp("status",p,l)}on(p,l){this.eventListeners.has(p)||this.eventListeners.set(p,new Set),this.eventListeners.get(p)?.add(l)}off(p,l){const O=this.eventListeners.get(p);O&&O.delete(l)}removeAllEventListeners(){this.eventListeners.forEach(p=>{p.clear()})}emit(p,l){const O=this.eventListeners.get(p);O&&O.forEach(L=>L(l))}connectWalletConnect(p){var l=this;return(0,S.A)(function*(){try{return{clientId:(yield l.getWalletConnectConnector().connectWalletConnect()).clientId}}catch(O){throw k.k.isUserRejectedRequestError(O)?new m.vx(O):O}})()}switchNetwork(p){var l=this;return(0,S.A)(function*(){const{caipNetwork:O}=p,L=x.G.getProviderId(O.chainNamespace),_=x.G.getProvider(O.chainNamespace);if(!_)throw new Error("Provider not found");if("WALLET_CONNECT"!==L){if("AUTH"===L){const I=$.a.getAuthConnector()?.provider;if(!I)throw new Error("Auth provider not found");const D=(0,j.lj)(O.chainNamespace);yield I.switchNetwork({chainId:O.caipNetworkId});const H=yield I.getUser({chainId:O.caipNetworkId,preferredAccountType:D});l.emit("switchNetwork",H)}}else _.setDefaultChain(O.caipNetworkId)})()}getWalletConnectConnector(){const p=this.connectors.find(l=>"walletConnect"===l.id);if(!p)throw new Error("WalletConnectConnector not found");return p}onConnect(p,l){if(p.length>0){const{address:O,chainId:L}=R.w.getAccount(p[0]),_=this.getCaipNetworks().filter(D=>D.chainNamespace===this.namespace).find(D=>D.id.toString()===L?.toString()),I=this.connectors.find(D=>D.id===l);
1O&&(this.emit("accountChanged",{address:O,chainId:L,connector:I}),this.addConnection({connectorId:l,accounts:p.map(D=>{const{address:H}=R.w.getAccount(D);return{address:H}}),caipNetwork:_}))}}onAccountsChanged(p,l,O=!0){if(p.length>0){const{address:L}=R.w.getAccount(p[0]),_=this.getConnection({connectorId:l,connections:this.connections,connectors:this.connectors});L&&this.getConnectorId(K.o.CHAIN.EVM)?.toLowerCase()===l.toLowerCase()&&this.emit("accountChanged",{address:L,chainId:_?.caipNetwork?.id,connector:_?.connector}),this.addConnection({connectorId:l,accounts:p.map(I=>{const{address:D}=R.w.getAccount(I);return{address:D}}),caipNetwork:_?.caipNetwork})}else O&&this.onDisconnect(l)}onDisconnect(p){this.removeProviderListeners(p),this.deleteConnection(p),this.getConnectorId(K.o.CHAIN.EVM)?.toLowerCase()===p.toLowerCase()&&this.emitFirstAvailableConnection(),0===this.connections.length&&this.emit("disconnect")}onChainChanged(p,l){const O="string"==typeof p&&p.startsWith("0x")?parseInt(p,16).toString():p.toString(),L=this.getConnection({connectorId:l,connections:this.connections,connectors:this.connectors}),_=this.getCaipNetworks().filter(I=>I.chainNamespace===this.namespace).find(I=>I.id.toString()===O);L&&this.addConnection({connectorId:l,accounts:L.accounts,caipNetwork:_}),this.getConnectorId(K.o.CHAIN.EVM)?.toLowerCase()===l.toLowerCase()&&this.emit("switchNetwork",{chainId:O})}listenProviderEvents(p,l){if(U.includes(p))return;const O=I=>this.onAccountsChanged(I,p),L=I=>this.onChainChanged(I,p),_=()=>this.onDisconnect(p);this.providerHandlers[p]||(l.on("disconnect",_),l.on("accountsChanged",O),l.on("chainChanged",L),this.providerHandlers[p]={provider:l,disconnect:_,accountsChanged:O,chainChanged:L})}removeProviderListeners(p){if(this.providerHandlers[p]){const{provider:l,disconnect:O,accountsChanged:L,chainChanged:_}=this.providerHandlers[p];l.removeListener("disconnect",O),l.removeListener("accountsChanged",L),l.removeListener("chainChanged",_),this.providerHandlers[p]=null}}emitFirstAvailableConnection(){const p=this.getConnection({connections:this.connections,connectors:this.connectors});if(p){const[l]=p.accounts;this.emit("accountChanged",{address:l?.address,chainId:p.caipNetwork?.id,connector:p.connector})}}getConnection({address:p,connectorId:l,connections:O,connectors:L}){if(l){const I=O.find(z=>z.connectorId.toLowerCase()===l.toLowerCase());if(!I)return null;const D=L.find(z=>z.id.toLowerCase()===I.connectorId.toLowerCase()),H=p?I.accounts.find(z=>z.address.toLowerCase()===p.toLowerCase()):I.accounts[0];return{...I,account:H,connector:D}}const _=O.find(I=>I.accounts.length>0&&L.some(D=>D.id.toLowerCase()===I.connectorId.toLowerCase()));if(_){const[I]=_.accounts,D=L.find(H=>H.id.toLowerCase()===_.connectorId.toLowerCase());return{..._,account:I,connector:D}}return null}}},63896(Ve,ne,u){"use strict";u.d(ne,{F:()=>v});var S=u(10467),K=(u(79231),u(30193)),m=u(33775),j=u(19069),R=u(17895),k=u(47040);class v{constructor({provider:U,namespace:X}){this.id=K.o.CONNECTOR_ID.WALLET_CONNECT,this.name="WalletConnect",this.type="WALLET_CONNECT",this.imageId="ef1a1fcf-7fe8-4d69-bd6d-fda1345b4400",this.getCaipNetworks=R.W.getCaipNetworks.bind(R.W),this.caipNetworks=this.getCaipNetworks(),this.provider=U,this.chain=X}get chains(){return this.getCaipNetworks()}connectWalletConnect(){var U=this;return(0,S.A)(function*(){if(!(yield U.authenticate())){const B=U.getCaipNetworks(),l=j.k.createNamespaces(B,k.H.state.universalProviderConfigOverride);yield U.provider.connect({optionalNamespaces:l})}return{clientId:yield U.provider.client.core.crypto.getClientId(),session:U.provider.session}})()}disconnect(){var U=this;return(0,S.A)(function*(){yield U.provider.disconnect()})()}authenticate(){var U=this;return(0,S.A)(function*(){const X=U.chains.map(B=>B.caipNetworkId);return m.U.universalProviderAuthenticate({universalProvider:U.provider,chains:X,methods:$})})()}}const $=["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"]},53654(Ve,ne,u){"use strict";u.d(ne,{q:()=>P});const S={adapters:{}},P={state:S,initialize(K){S.adapters={...K}},get:K=>S.adapters[K]}},30600(Ve,ne,u){"use strict";u.d(ne,{h:()=>v});var S=u(3631),P=u(98698),K=u(30193),m=u(90995),j=u(47040);const R=(0,S.BX)({message:"",variant:"info",open:!1}),v=(0,m.X)({state:R,subscribeKey:($,x)=>(0,P.u$)(R,$,x),open($,x){const{debug:U}=j.H.state,{code:X,displayMessage:B,debugMessage:p}=$;if(B&&U&&(R.message=B,R.variant=x,R.open=!0),p){if(!K.o.IS_DEVELOPMENT)return;const l="function"==typeof p?p():p,O=X?{code:X}:void 0;"error"===x?console.error(l,O):"warning"===x?console.warn(l,O):console.info(l,O)}},warn($,x,U){R.open=!0,R.message=$,R.variant="warning",x&&console.warn(x,U)},close(){R.open=!1,R.message="",R.variant="info"}})},17398(Ve,ne,u){"use strict";u.d(ne,{N:()=>H});var S=u(10467),P=u(3631),K=u(98698),m=u(30193),j=u(37642),R=u(66915),k=u(51514),v=u(42915),$=u(73387),x=u(90490),U=u(17895),X=u(2788
11),B=u(78977),p=u(47040);const l=R.w.getApiUrl(),O=new k.Z({baseUrl:l,clientId:null}),D=(0,P.BX)({promises:{},page:1,count:0,featured:[],allFeatured:[],recommended:[],allRecommended:[],wallets:[],filteredWallets:[],search:[],isAnalyticsEnabled:!1,excludedWallets:[],isFetchingRecommendedWallets:!1,explorerWallets:[],explorerFilteredWallets:[],plan:{tier:"none",hasExceededUsageLimit:!1,limits:{isAboveRpcLimit:!1,isAboveMauLimit:!1}}}),H={state:D,subscribeKey:(z,T)=>(0,K.u$)(D,z,T),_getSdkProperties(){const{projectId:z,sdkType:T,sdkVersion:W}=p.H.state;return{projectId:z,st:T||"appkit",sv:W||"html-wagmi-4.2.2"}},_filterOutExtensions:z=>p.H.state.isUniversalProvider?z.filter(T=>!!(T.mobile_link||T.desktop_link||T.webapp_link)):z,_fetchWalletImage:z=>(0,S.A)(function*(){const T=`${O.baseUrl}/getWalletImage/${z}`,W=yield O.getBlob({path:T,params:H._getSdkProperties()});x.j.setWalletImage(z,URL.createObjectURL(W))})(),_fetchNetworkImage:z=>(0,S.A)(function*(){const T=`${O.baseUrl}/public/getAssetImage/${z}`,W=yield O.getBlob({path:T,params:H._getSdkProperties()});x.j.setNetworkImage(z,URL.createObjectURL(W))})(),_fetchConnectorImage:z=>(0,S.A)(function*(){const T=`${O.baseUrl}/public/getAssetImage/${z}`,W=yield O.getBlob({path:T,params:H._getSdkProperties()});x.j.setConnectorImage(z,URL.createObjectURL(W))})(),_fetchCurrencyImage:z=>(0,S.A)(function*(){const T=`${O.baseUrl}/public/getCurrencyImage/${z}`,W=yield O.getBlob({path:T,params:H._getSdkProperties()});x.j.setCurrencyImage(z,URL.createObjectURL(W))})(),_fetchTokenImage:z=>(0,S.A)(function*(){const T=`${O.baseUrl}/public/getTokenImage/${z}`,W=yield O.getBlob({path:T,params:H._getSdkProperties()});x.j.setTokenImage(z,URL.createObjectURL(W))})(),_filterWalletsByPlatform(z){const T=z.length,W=R.w.isMobile()?z?.filter(E=>!(!E.mobile_link&&!E.webapp_link)||Object.values(v.O).map(w=>w.id).includes(E.id)):z;return{filteredWallets:W,mobileFilteredOutWalletsLength:T-W.length}},fetchProjectConfig:()=>(0,S.A)(function*(){return(yield O.get({path:"/appkit/v1/config",params:H._getSdkProperties()})).features})(),fetchUsage:()=>(0,S.A)(function*(){try{const z=yield O.get({path:"/appkit/v1/project-limits",params:H._getSdkProperties()}),{tier:T,isAboveMauLimit:W,isAboveRpcLimit:A}=z.planLimits;H.state.plan={tier:T,hasExceededUsageLimit:"starter"===T&&(W||A),limits:{isAboveRpcLimit:A,isAboveMauLimit:W}}}catch(z){console.warn("Failed to fetch usage",z)}})(),fetchAllowedOrigins:()=>(0,S.A)(function*(){try{const{allowedOrigins:z}=yield O.get({path:"/projects/v1/origins",params:H._getSdkProperties()});return z}catch(z){if(z instanceof Error&&z.cause instanceof Response){const T=z.cause.status;if(T===m.o.HTTP_STATUS_CODES.TOO_MANY_REQUESTS)throw new Error("RATE_LIMITED",{cause:z});if(T>=m.o.HTTP_STATUS_CODES.SERVER_ERROR&&T<600)throw new Error("SERVER_ERROR",{cause:z});return[]}return[]}})(),fetchNetworkImages:()=>(0,S.A)(function*(){const T=U.W.getAllRequestedCaipNetworks()?.map(({assets:W})=>W?.imageId).filter(Boolean).filter(W=>!j.$.getNetworkImageById(W));T&&(yield Promise.allSettled(T.map(W=>H._fetchNetworkImage(W))))})(),fetchConnectorImages:()=>(0,S.A)(function*(){const{connectors:z}=X.a.state,T=z.map(({imageId:W})=>W).filter(Boolean);yield Promise.allSettled(T.map(W=>H._fetchConnectorImage(W)))})(),fetchCurrencyImages(){return(0,S.A)(function*(z=[]){yield Promise.allSettled(z.map(T=>H._fetchCurrencyImage(T)))}).apply(this,arguments)},fetchTokenImages(){return(0,S.A)(function*(z=[]){yield Promise.allSettled(z.map(T=>H._fetchTokenImage(T)))}).apply(this,arguments)},fetchWallets:z=>(0,S.A)(function*(){const T=z.exclude??[];H._getSdkProperties().sv.startsWith("html-core-")&&T.push(...Object.values(v.O).map(w=>w.id));const A=yield O.get({path:"/getWallets",params:{...H._getSdkProperties(),...z,page:String(z.page),entries:String(z.entries),include:z.include?.join(",")||void 0,exclude:T.join(",")||void 0}}),{filteredWallets:E,mobileFilteredOutWalletsLength:g}=H._filterWalletsByPlatform(A?.data);return{data:E||[],count:A?.count,mobileFilteredOutWalletsLength:g}})(),prefetchWalletRanks:()=>(0,S.A)(function*(){const z=X.a.state.connectors;if(!z?.length)return;const T={page:1,entries:20,badge:"certified"};
1if(T.names=z.map(E=>E.name).join(","),U.W.state.activeChain===m.o.CHAIN.EVM){const E=[...z.flatMap(g=>g.connectors?.map(w=>w.info?.rdns)||[]),...z.map(g=>g.info?.rdns)].filter(g=>"string"==typeof g&&g.length>0);E.length&&(T.rdns=E.join(","))}const{data:W}=yield H.fetchWallets(T);D.explorerWallets=W,X.a.extendConnectorsWithExplorerWallets(W);const A=U.W.getRequestedCaipNetworkIds().join(",");D.explorerFilteredWallets=W.filter(E=>E.chains?.some(g=>A.includes(g)))})(),fetchFeaturedWallets:()=>(0,S.A)(function*(){const{featuredWalletIds:z}=p.H.state;if(z?.length){const T={...H._getSdkProperties(),page:1,entries:z?.length??4,include:z},{data:W}=yield H.fetchWallets(T),A=[...W].sort((g,w)=>z.indexOf(g.id)-z.indexOf(w.id)),E=A.map(g=>g.image_id).filter(Boolean);yield Promise.allSettled(E.map(g=>H._fetchWalletImage(g))),D.featured=A,D.allFeatured=A}})(),fetchRecommendedWallets:()=>(0,S.A)(function*(){try{D.isFetchingRecommendedWallets=!0;const{includeWalletIds:z,excludeWalletIds:T,featuredWalletIds:W}=p.H.state,g={page:1,entries:4,include:z,exclude:[...T??[],...W??[]].filter(Boolean),chains:U.W.getRequestedCaipNetworkIds().join(",")},{data:w,count:C}=yield H.fetchWallets(g),y=$.i.getRecentWallets(),F=w.map(ge=>ge.image_id).filter(Boolean),Q=y.map(ge=>ge.image_id).filter(Boolean);yield Promise.allSettled([...F,...Q].map(ge=>H._fetchWalletImage(ge))),D.recommended=w,D.allRecommended=w,D.count=C??0}catch{}finally{D.isFetchingRecommendedWallets=!1}})(),fetchWalletsByPage(z){return(0,S.A)(function*({page:T,entries:W,badge:A,include:E,exclude:g}){const{includeWalletIds:w,excludeWalletIds:C,featuredWalletIds:y}=p.H.state,F=U.W.getRequestedCaipNetworkIds().join(","),Q=[...D.recommended.map(({id:We})=>We),...C??[],...y??[]].filter(Boolean),ge={page:T,entries:W??40,include:E??w,exclude:g??Q,badge_type:A,chains:F},{data:ce,count:Ae,mobileFilteredOutWalletsLength:Te}=yield H.fetchWallets(ge);D.mobileFilteredOutWalletsLength=Te+(D.mobileFilteredOutWalletsLength??0);const ve=ce.slice(0,20).map(We=>We.image_id).filter(Boolean);yield Promise.allSettled(ve.map(We=>H._fetchWalletImage(We))),D.wallets=R.w.uniqueBy([...D.wallets,...H._filterOutExtensions(ce)],"id").filter(We=>We.chains?.some(Ke=>F.includes(Ke))),D.count=Ae>D.count?Ae:D.count,D.page=T}).apply(this,arguments)},initializeExcludedWallets(z){return(0,S.A)(function*({ids:T}){const W={page:1,entries:T.length,include:T},{data:A}=yield H.fetchWallets(W);A&&A.forEach(E=>{D.excludedWallets.push({rdns:E.rdns,name:E.name})})}).apply(this,arguments)},searchWallet(z){return(0,S.A)(function*({search:T,badge:W,entries:A,page:E,include:g,exclude:w}){const{includeWalletIds:C,excludeWalletIds:y}=p.H.state,F=U.W.getRequestedCaipNetworkIds().join(",");D.search=[];const Q={page:E??1,entries:A??100,search:T?.trim()||void 0,badge_type:W,include:g??C,exclude:w??y,chains:F},{data:ge}=yield H.fetchWallets(Q);B.E.sendEvent({type:"track",event:"SEARCH_WALLET",properties:{badge:W??"",search:T??""}});const ce=ge.map(Ae=>Ae.image_id).filter(Boolean);yield Promise.allSettled([...ce.map(Ae=>H._fetchWalletImage(Ae)),R.w.wait(300)]),D.search=H._filterOutExtensions(ge)}).apply(this,arguments)},initPromise:(z,T)=>D.promises[z]||(D.promises[z]=T()),prefetch({fetchConnectorImages:z=!0,fetchFeaturedWallets:T=!0,fetchRecommendedWallets:W=!0,fetchNetworkImages:A=!0,fetchWalletRanks:E=!0}={}){const g=[z&&H.initPromise("connectorImages",H.fetchConnectorImages),T&&H.initPromise("featuredWallets",H.fetchFeaturedWallets),W&&H.initPromise("recommendedWallets",H.fetchRecommendedWallets),A&&H.initPromise("networkImages",H.fetchNetworkImages),E&&H.initPromise("walletRanks",H.prefetchWalletRanks)].filter(Boolean);return Promise.allSettled(g)}
1,prefetchAnalyticsConfig(){p.H.state.features?.analytics&&H.fetchAnalyticsConfig()},fetchAnalyticsConfig:()=>(0,S.A)(function*(){try{const{isAnalyticsEnabled:z}=yield O.get({path:"/getAnalyticsConfig",params:H._getSdkProperties()});p.H.setFeatures({analytics:z})}catch{p.H.setFeatures({analytics:!1})}})(),filterByNamespaces(z){if(!z?.length)return D.featured=D.allFeatured,void(D.recommended=D.allRecommended);const T=U.W.getRequestedCaipNetworkIds().join(",");D.featured=D.allFeatured.filter(W=>W.chains?.some(A=>T.includes(A))),D.recommended=D.allRecommended.filter(W=>W.chains?.some(A=>T.includes(A))),D.filteredWallets=D.wallets.filter(W=>W.chains?.some(A=>T.includes(A)))},clearFilterByNamespaces(){D.filteredWallets=[]},setFilterByNamespace(z){if(!z)return D.featured=D.allFeatured,void(D.recommended=D.allRecommended);const T=U.W.getRequestedCaipNetworkIds().join(",");D.featured=D.allFeatured.filter(W=>W.chains?.some(A=>T.includes(A))),D.recommended=D.allRecommended.filter(W=>W.chains?.some(A=>T.includes(A))),D.filteredWallets=D.wallets.filter(W=>W.chains?.some(A=>T.includes(A)))}}},90490(Ve,ne,u){"use strict";u.d(ne,{j:()=>R});var S=u(3631),P=u(98698),K=u(90995);const m=(0,S.BX)({walletImages:{},networkImages:{},chainImages:{},connectorImages:{},tokenImages:{},currencyImages:{}}),R=(0,K.X)({state:m,subscribeNetworkImages:k=>(0,S.B1)(m.networkImages,()=>k(m.networkImages)),subscribeKey:(k,v)=>(0,P.u$)(m,k,v),subscribe:k=>(0,S.B1)(m,()=>k(m)),setWalletImage(k,v){m.walletImages[k]=v},setNetworkImage(k,v){m.networkImages[k]=v},setChainImage(k,v){m.chainImages[k]=v},setConnectorImage(k,v){m.connectorImages={...m.connectorImages,[k]:v}},setTokenImage(k,v){m.tokenImages[k]=v},setCurrencyImage(k,v){m.currencyImages[k]=v}})},86107(Ve,ne,u){"use strict";u.d(ne,{T:()=>B});var S=u(10467),P=u(3631),K=u(49519),m=u(66915),j=u(51514),R=u(73387),k=u(17895),v=u(47040),$=u(42408);const x={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"}]}]},U=m.w.getBlockchainApiUrl(),X=(0,P.BX)({clientId:null,api:new j.Z({baseUrl:U,clientId:null}),supportedChains:{http:[],ws:[]}}),B={state:X,get:p=>(0,S.A)(function*(){const{st:l,sv:O}=B.getSdkProperties(),_={...p.params||{},st:l,sv:O,projectId:v.H.state.projectId};return X.api.get({...p,params:_})})(),getSdkProperties(){const{sdkType:p,sdkVersion:l}=v.H.state;return{st:p||"unknown",sv:l||"unknown"}},isNetworkSupported:p=>(0,S.A)(function*(){if(!p)return!1;try{X.supportedChains.http.length||(yield B.getSupportedNetworks())}catch{return!1}return X.supportedChains.http.includes(p)})(),getSupportedNetworks:()=>(0,S.A)(function*(){try{const p=yield B.get({path:"v1/supported-chains"});return X.supportedChains=p,p}catch{return X.supportedChains}})(),fetchIdentity(p){return(0,S.A)(function*({address:l}){const O=R.i.getIdentityFromCacheForAddress(l);if(O)return O;const L=yield B.get({path:`/v1/identity/${l}`,params:{sender:k.W.state.activeCaipAddress?m.w.getPlainAddress(k.W.state.activeCaipAddress):void 0}});return R.i.updateIdentityCache({address:l,identity:L,timestamp:Date.now()}),L}).apply(this,arguments)},fetchTransactions(p){return(0,S.A)(function*({account:l,cursor:O,signal:L,cache:_,chainId:I}){if(!(yield B.isNetworkSupported(k.W.state.activeCaipNetwork?.caipNetworkId)))return{data:[],next:void 0};const H=R.i.getTransactionsCacheForAddress({address:l,chainId:I});if(H)return H;const z=yield B.get({path:`/v1/account/${l}/history`,params:{cursor:O,chainId:I},signal:L,cache:_});return R.i.updateTransactionsCache({address:l,chainId:I,timestamp:Date.now(),transactions:z}),z}).apply(this,arguments)},fetchSwapQuote(p){return(0,S.A)(function*({amount:l,userAddress:O,from:L,to:_,gasPrice:I}){return(yield B.isNetworkSupported(k.W.state.activeCaipNetwork?.caipNetworkId))?B.get({path:"/v1/convert/quotes",headers:{"Content-Type":"application/json"},params:{amount:l,userAddress:O,from:L,to:_,gasPrice:I}}):{quotes:[]}}).apply(this,arguments)},fetchSwapTokens(p){return(0,S.A)(function*({chainId:l}){return(yield B.isNetworkSupported(k.W.state.activeCaipNetwork?.caipNetworkId))?B.get({path:"/v1/convert/tokens",params:{chainId:l}}):{tokens:[]}}).apply(this,arguments)},getAddressBalance(p){return(0,S.A)(function*({caipNetworkId:l,address:O,method:L="getAddressBalance",params:_}){return X.api.post({path:`/v1?chainId=${l}&projectId=${v.H.state.projectId}`,body:{id:"1",jsonrpc:"2.0",method:L,params:_??{address:O}}}).then(I=>I.result)}).apply(this,arguments)},fetchTokenPrice(p){return(0,S.A)(function*({addresses:l,caipNetworkId:O=k.W.state.activeCaipNetwork?.caipNetworkId}){if(!(yield B.isNetworkSupported(O)))return{fungibles:[]};const _=R.i.getTokenPriceCacheForAddresses(l);if(_)return _;const I=yield X.api.post({path:"/v1/fungible/price",body:{currency:"usd",addresses:l,projectId:v.H.state.projectId},headers:{"Content-Type":"application/json"}});return R.i.updateTokenPriceCache({addresses:l,timestamp:Date.now(),tokenPrice:I}),I}).apply(this,arguments)},fetchSwapAllowance(p){return(0,S.A)(function*({tokenAddress:l,userAddress:O}){return(yield B.isNetworkSupported(k.W.state.activeCaipNetwork?.caipNetworkId))?B.get({path:"/v1/convert/allowance",params:{tokenAddress:l,userAddress:O},headers:{"Content-Type":"application/json"}}):{allowance:"0"}}).apply(this,arguments)},fetchGasPrice(p){return(0,S.A)(function*({chainId:l}){const{st:O,sv:L}=B.getSdkProperties();if(!(yield B.isNetworkSupported(k.W.state.activeCaipNetwork?.caipNetworkId)))throw new Error("Network not supported for Gas Price");return B.get({path:"/v1/convert/gas-price",headers:{"Content-Type":"application/json"},params:{chainId:l,st:O,sv:L}})}).apply(this,arguments)},generateSwapCalldata(p){return(0,S.A)(function*({amount:l,from:O,to:L,userAddress:_,disableEstimate:I}){if(!(yield B.isNetworkSupported(k.W.state.activeCaipNetwork?.caipNetworkId)))throw new Error("Network not supported for Swaps");return X.api.post({path:"/v1/convert/build-transaction",headers:{"Content-Type":"application/json"},body:{amount:l,eip155:{slippage:K.oU.CONVERT_SLIPPAGE_TOLERANCE},projectId:v.H.state.projectId,from:O,to:L,userAddress:_,disableEstimate:I}})}).apply(this,arguments)},generateApproveCalldata(p){return(0,S.A)(function*({from:l,to:O,userAddress:L}){const{st:_,sv:I}=B.getSdkProperties();if(!(yield B.isNetworkSupported(k.W.state.activeCaipNetwork?.caipNetworkId)))throw new Error("Network not supported for Swaps");return B.get({path:"/v1/convert/build-approve",headers:{"Content-Type":"application/json"},params:{userAddress:L,from:l,to:O,st:_,sv:I}})}).apply(this,arguments)},getBalance:(p,l,O)=>(0,S.A)(function*(){const{st:L,sv:_}=B.getSdkProperties();if(!(yield B.isNetworkSupported(k.W.state.activeCaipNetwork?.caipNetworkId)))return $.P.showError("Token Balance Unavailable"),{balances:[]};const D=`${l}:${p}`,H=R.i.getBalanceCacheForCaipAddress(D);if(H)return H;const z=yield B.get({path:`/v1/account/${p}/balance`,params:{currency:"usd",chainId:l,forceUpdate:O,st:L,sv:_}}
1);return R.i.updateBalanceCache({caipAddress:D,balance:z,timestamp:Date.now()}),z})(),lookupEnsName:p=>(0,S.A)(function*(){return(yield B.isNetworkSupported(k.W.state.activeCaipNetwork?.caipNetworkId))?B.get({path:`/v1/profile/account/${p}`,params:{apiVersion:"2"}}):{addresses:{},attributes:[]}})(),reverseLookupEnsName(p){return(0,S.A)(function*({address:l}){if(!(yield B.isNetworkSupported(k.W.state.activeCaipNetwork?.caipNetworkId)))return[];const L=k.W.getAccountData()?.address;return B.get({path:`/v1/profile/reverse/${l}`,params:{sender:L,apiVersion:"2"}})}).apply(this,arguments)},getEnsNameSuggestions:p=>(0,S.A)(function*(){return(yield B.isNetworkSupported(k.W.state.activeCaipNetwork?.caipNetworkId))?B.get({path:`/v1/profile/suggestions/${p}`,params:{zone:"reown.id"}}):{suggestions:[]}})(),registerEnsName(p){return(0,S.A)(function*({coinType:l,address:O,message:L,signature:_}){return(yield B.isNetworkSupported(k.W.state.activeCaipNetwork?.caipNetworkId))?X.api.post({path:"/v1/profile/account",body:{coin_type:l,address:O,message:L,signature:_},headers:{"Content-Type":"application/json"}}):{success:!1}}).apply(this,arguments)},generateOnRampURL(p){return(0,S.A)(function*({destinationWallets:l,partnerUserId:O,defaultNetwork:L,purchaseAmount:_,paymentAmount:I}){return(yield B.isNetworkSupported(k.W.state.activeCaipNetwork?.caipNetworkId))?(yield X.api.post({path:"/v1/generators/onrampurl",params:{projectId:v.H.state.projectId},body:{destinationWallets:l,defaultNetwork:L,partnerUserId:O,defaultExperience:"buy",presetCryptoAmount:_,presetFiatAmount:I}})).url:""}).apply(this,arguments)},getOnrampOptions:()=>(0,S.A)(function*(){if(!(yield B.isNetworkSupported(k.W.state.activeCaipNetwork?.caipNetworkId)))return{paymentCurrencies:[],purchaseCurrencies:[]};try{return yield B.get({path:"/v1/onramp/options"})}catch{return x}})(),getOnrampQuote(p){return(0,S.A)(function*({purchaseCurrency:l,paymentCurrency:O,amount:L,network:_}){try{return(yield B.isNetworkSupported(k.W.state.activeCaipNetwork?.caipNetworkId))?yield X.api.post({path:"/v1/onramp/quote",params:{projectId:v.H.state.projectId},body:{purchaseCurrency:l,paymentCurrency:O,amount:L,network:_}}):null}catch{return{networkFee:{amount:L,currency:O.id},paymentSubtotal:{amount:L,currency:O.id},paymentTotal:{amount:L,currency:O.id},purchaseAmount:{amount:L,currency:O.id},quoteId:"mocked-quote-id"}}}).apply(this,arguments)},getSmartSessions:p=>(0,S.A)(function*(){return(yield B.isNetworkSupported(k.W.state.activeCaipNetwork?.caipNetworkId))?B.get({path:`/v1/sessions/${p}`}):[]})(),revokeSmartSession:(p,l,O)=>(0,S.A)(function*(){return(yield B.isNetworkSupported(k.W.state.activeCaipNetwork?.caipNetworkId))?X.api.post({path:`/v1/sessions/${p}/revoke`,params:{projectId:v.H.state.projectId},body:{pci:l,signature:O}}):{success:!1}})(),setClientId(p){X.clientId=p,X.api=new j.Z({baseUrl:U,clientId:p})}}},17895(Ve,ne,u){"use strict";u.d(ne,{W:()=>w});var S=u(10467),P=u(3631),K=u(98698),m=u(61314),j=u(30193),R=u(68095),k=u(69245),v=u(66689),$=u(75964),x=u(49519),U=u(66915),X=u(73387),B=u(90995),p=u(53654),l=u(22805),O=u(27881),L=u(78977),_=u(95051),I=u(47040),D=u(25637),H=u(62132),z=u(97114),T=u(42408);const W={currentTab:0,tokenBalance:[],smartAccountDeployed:!1,addressLabels:new Map,user:void 0,preferredAccountType:void 0},A={caipNetwork:void 0,supportsAllNetworks:!0,smartAccountEnabledNetworks:[]},E=(0,P.BX)({chains:(0,K.zC)(),activeCaipAddress:void 0,activeChain:void 0,activeCaipNetwork:void 0,noAdapters:!1,universalAdapter:{connectionControllerClient:void 0},isSwitchingNamespace:!1}),g={state:E,subscribe:C=>(0,P.B1)(E,()=>{C(E)}),subscribeKey:(C,y)=>(0,K.u$)(E,C,y),subscribeAccountStateProp(C,y,F){const Q=F||E.activeChain;return Q?(0,K.u$)(E.chains.get(Q)?.accountState||{},C,y):()=>{}},subscribeChainProp(C,y,F){let Q;return(0,P.B1)(E.chains,()=>{const ge=F||E.activeChain;if(ge){const ce=E.chains.get(ge)?.[C];Q!==ce&&(Q=ce,y(ce))}})},initialize(C,y,F){const{chainId:Q,namespace:ge}=X.i.getActiveNetworkProps(),ce=y?.find(Ke=>Ke.id.toString()===Q?.toString()),Te=C.find(Ke=>Ke?.namespace===ge)||C?.[0],ve=C.map(Ke=>Ke.namespace).filter(Ke=>void 0!==Ke),We=I.H.state.enableEmbedded?new Set([...ve]):new Set([...y?.map(Ke=>Ke.chainNamespace)??[]]);(0===C?.length||!Te)&&(E.noAdapters=!0),E.noAdapters||(E.activeChain=Te?.namespace,E.activeCaipNetwork=ce,w.setChainNetworkData(Te?.namespace,{caipNetwork:ce}),E.activeChain&&H.z.set({activeChain:Te?.namespace})),We.forEach(Ke=>{const Et=y?.filter(wt=>wt.chainNamespace===Ke),jt=X.i.getPreferredAccountTypes()||{},Pt={...I.H.state.defaultAccountTypes,...jt};w.state.chains.set(Ke,{namespace:Ke,networkState:(0,P.BX)({...A,caipNetwork:Et?.[0]}),accountState:(0,P.BX)({...W,preferredAccountType:Pt[Ke]}),caipNetworks:Et??[],...F}),w.setRequestedCaipNetworks(Et??[],Ke)})},removeAdapter(C){if(E.activeChain===C){const y=Array.from(E.chains.entries()).find(([F])=>F!==C);if(y){const F=y[1]?.caipNetworks?.[0];F&&w.setActiveCaipNetwork(F)}}E.chains.delete(C)},addAdapter(C,{connectionControllerClient:y},F){if(!C.namespace)throw new Error("ChainController:addAdapter - adapter must have a namespace");E.chains.set(C.namespace,{namespace:C.namespace,networkState:{...A,caipNetwork:
1F[0]},accountState:{...W},caipNetworks:F,connectionControllerClient:y}),w.setRequestedCaipNetworks(F?.filter(Q=>Q.chainNamespace===C.namespace)??[],C.namespace)},addNetwork(C){const y=E.chains.get(C.chainNamespace);if(y){const F=[...y.caipNetworks||[]];y.caipNetworks?.find(Q=>Q.id===C.id)||F.push(C),E.chains.set(C.chainNamespace,{...y,caipNetworks:F}),w.setRequestedCaipNetworks(F,C.chainNamespace),O.a.filterByNamespace(C.chainNamespace,!0)}},removeNetwork(C,y){const F=E.chains.get(C);if(F){const Q=E.activeCaipNetwork?.id===y,ge=[...F.caipNetworks?.filter(ce=>ce.id!==y)||[]];Q&&F?.caipNetworks?.[0]&&w.setActiveCaipNetwork(F.caipNetworks[0]),E.chains.set(C,{...F,caipNetworks:ge}),w.setRequestedCaipNetworks(ge||[],C),0===ge.length&&O.a.filterByNamespace(C,!1)}},setAdapterNetworkState(C,y){const F=E.chains.get(C);F&&(F.networkState={...F.networkState||A,...y},E.chains.set(C,F))},setChainAccountData(C,y,F=!0){if(!C)throw new Error("Chain is required to update chain account data");const Q=E.chains.get(C);if(Q){const ge={...Q.accountState||W,...y};E.chains.set(C,{...Q,accountState:ge}),(1===E.chains.size||E.activeChain===C)&&y.caipAddress&&(E.activeCaipAddress=y.caipAddress)}},setChainNetworkData(C,y){if(!C)return;const F=E.chains.get(C);if(F){const Q={...F.networkState||A,...y};E.chains.set(C,{...F,networkState:Q})}},setAccountProp(C,y,F,Q=!0){w.setChainAccountData(F,{[C]:y},Q)},setActiveNamespace(C){E.activeChain=C;const y=C?E.chains.get(C):void 0,F=y?.networkState?.caipNetwork;F?.id&&C&&(E.activeCaipAddress=y?.accountState?.caipAddress,E.activeCaipNetwork=F,w.setChainNetworkData(C,{caipNetwork:F}),X.i.setActiveCaipNetworkId(F?.caipNetworkId),H.z.set({activeChain:C,selectedNetworkId:F?.caipNetworkId}))},setActiveCaipNetwork(C){if(!C)return;const y=E.activeChain===C.chainNamespace;y||w.setIsSwitchingNamespace(!0);const F=E.chains.get(C.chainNamespace);E.activeChain=C.chainNamespace,E.activeCaipNetwork=C,w.setChainNetworkData(C.chainNamespace,{caipNetwork:C});let Q=F?.accountState?.address;if(Q)E.activeCaipAddress=`${C.chainNamespace}:${C.id}:${Q}`;else if(y&&E.activeCaipAddress){const{address:ce}=R.C.parseCaipAddress(E.activeCaipAddress);Q=ce,E.activeCaipAddress=`${C.caipNetworkId}:${Q}`}else E.activeCaipAddress=void 0;w.setChainAccountData(C.chainNamespace,{address:Q,caipAddress:E.activeCaipAddress}),z.R.resetSend(),H.z.set({activeChain:E.activeChain,selectedNetworkId:E.activeCaipNetwork?.caipNetworkId}),X.i.setActiveCaipNetworkId(C.caipNetworkId),!w.checkIfSupportedNetwork(C.chainNamespace)&&I.H.state.enableNetworkSwitch&&!I.H.state.allowUnsupportedChain&&!l.x.state.wcBasic&&w.showUnsupportedChainUI()},addCaipNetwork(C){if(!C)return;const y=E.chains.get(C.chainNamespace);y&&y?.caipNetworks?.push(C)},switchActiveNamespace:C=>(0,S.A)(function*(){if(!C)return;const y=C!==w.state.activeChain,F=w.getNetworkData(C)?.caipNetwork,Q=w.getCaipNetworkByNamespace(C,F?.id);y&&Q&&(yield w.switchActiveNetwork(Q))})(),switchActiveNetwork(C){return(0,S.A)(function*(y,{throwOnFailure:F=!1}={}){const Q=w.state.activeChain;if(!Q)throw new Error("ChainController:switchActiveNetwork - namespace is required");const ge="AUTH"===D.G.getProviderId(E.activeChain),ce=w.getAccountData(Q)?.address,Ae=j.o.AUTH_CONNECTOR_SUPPORTED_CHAINS.includes(y.chainNamespace);try{if(ce&&y.chainNamespace===Q||ge&&Ae){const Te=p.q.get(y.chainNamespace);if(!Te)throw new Error("Adapter not found");yield Te.switchNetwork({caipNetwork:y})}w.setActiveCaipNetwork(y)}catch(Te){if(F)throw Te}L.E.sendEvent({type:"track",event:"SWITCH_NETWORK",properties:{network:y.caipNetworkId}})}).apply(this,arguments)},getConnectionControllerClient(C){const y=C||E.activeChain;if(!y)throw new Error("Chain is required to get connection controller client");const F=E.chains.get(y);if(!F?.connectionControllerClient)throw new Error("ConnectionController client not set");return F.connectionControllerClient},getNetworkProp(C,y){const F=E.chains.get(y)?.networkState;if(F)return F[C]},getRequestedCaipNetworks(C){const y=E.chains.get(C),{approvedCaipNetworkIds:F=[],requestedCaipNetworks:Q=[]}=y?.networkState||{};return U.w.sortRequestedNetworks(F,Q).filter(Ae=>Ae?.id)},getAllRequestedCaipNetworks(){const C=[];return E.chains.forEach(y=>{if(!y.namespace)throw new Error("ChainController:getAllRequestedCaipNetworks - chainAdapter must have a namespace");const F=w.getRequestedCaipNetworks(y.namespace);C.push(...F)}),C},setRequestedCaipNetworks(C,y){w.setAdapterNetworkState(y,{requestedCaipNetworks:C});const Q=w.getAllRequestedCaipNetworks().map(ce=>ce.chainNamespace),ge=Array.from(new Set(Q));O.a.filterByNamespaces(ge)},getAllApprovedCaipNetworkIds(){const C=[];return E.chains.forEach(y=>{if(!y.namespace)throw new Error("ChainController:getAllApprovedCaipNetworkIds - chainAdapter must have a namespace");const F=w.getApprovedCaipNetworkIds(y.namespace);C.push(...F)}),C},getActiveCaipNetwork:C=>C?E.chains.get(C)?.networkState?.caipNetwork:E.activeCaipNetwork,getActiveCaipAddress:()=>E.activeCaipAddress,getApprovedCaipNetworkIds:C=>E.chains.get(C)?.networkState?.approvedCaipNetworkIds||[],setApprovedCaipNetworksData(C,y){w.setAdapterNetworkState(C,y)},checkIfSupportedNetwork(C,y){const F=y||E.activeCaipNetwork?.caipNetworkId,Q=w.getRequestedCaipNetworks(C);return!Q.length||Q?.some(ge=>ge.caipNetworkId===F)},checkIfSupportedChainId:C=>!E.activeChain||w.getRequestedCaipNetworks(E.activeChain)?.some(F=>F.id===C),checkIfSmartAccountEnabled(){const C=m.L.caipNetworkIdToNumber(E.activeCaipNetwork?.caipNetworkId);return!(!E.activeChain||!C||!(v.o.get(k.s1.SMART_ACCOUNT_ENABLED_NETWORKS)?.split(",")||[])?.includes(C.toString()))},showUnsupportedChainUI(){_.W.open({view:"UnsupportedChain"})},checkIfNamesSupported(){const C=E.activeCaipNetwork;return!(!C?.chainNamespace||!x.oU.NAMES_SUPPORTED_CHAIN_NAMESPACES.includes(C.chainNamespace))},resetNetwork(C){w.setAdapterNetworkState(C,{approvedCaipNetworkIds:void 0,supportsAllNetworks:!0})},resetAccount(C){const y=C;if(!y)throw new Error("Chain is required to set account prop");const F=w.state.chains.get(y)?.accountState?.preferredAccountType,Q=I.H.state.defaultAccountTypes[y];E.activeCaipAddress=void 0,w.setChainAccountData(y,{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,preferredAccountType:Q||F,socialProvider:void 0,socialWindow:void 0,farcasterUrl:void 0,user:void 0,status:"disconnected"}),O.a.removeConnectorId(y)},setIsSwitchingNamespace(C){E.isSwitchingNamespace=C},getFirstCaipNetworkSupportsAuthConnector(){const C=[];let y;if(E.chains.forEach(F=>{j.o.AUTH_CONNECTOR_SUPPORTED_CHAINS.find(Q=>Q===F.namespace)&&F.namespace&&C.push(F.namespace)}),C.length>0){const F=C[0];return y=F?E.chains.get(F)?.caipNetworks?.[0]:void 0,y}},getAccountData(C){const y=C||E.activeChain;if(y)return w.state.chains.get(y)?.accountState},getNetworkData(C){const y=C||E.activeChain;if(y)return w.state.chains.get(y)?.networkState},getCaipNetworkByNamespace(C,y){if(!C)return;const F=w.state.chains.get(C),Q=F?.caipNetworks?.find(ge=>ge.id.toString()===y?.toString());return Q||F?.networkState?.caipNetwork||F?.caipNetworks?.[0]},getRequestedCaipNetworkIds(){const C=O.a.state.filterByNamespace;return(C?[E.chains.get(C)]:Array.from(E.chains.values())).flatMap(F=>F?.caipNetworks||[]).map(F=>F.caipNetworkId)},getCaipNetworks:C=>C?w.getRequestedCaipNetworks(C):w.getAllRequestedCaipNetworks(),getCaipNetworkById:(C,y)=>g.getCaipNetworks(y).find(F=>F.id.toString()===C.toString()||F.caipNetworkId.toString()===C.toString()),setLastConnectedSIWECaipNetwork(C){E.lastConnectedSIWECaipNetwork=C},getLastConnectedSIWECaipNetwork:()=>E.lastConnectedSIWECaipNetwork,fetchTokenBalance:C=>(0,S.A)(function*(){const y=w.getAccountData();if(!y)return[];const F=w.state.activeCaipNetwork?.caipNetworkId,Q=w.state.activeCaipNetwork?.chainNamespace,ge=w.state.activeCaipAddress,ce=ge?U.w.getPlainAddress(ge):void 0;if(w.setAccountProp("balanceLoading",!0,Q),y.lastRetry&&!U.w.isAllowedRetry(y.lastRetry,30*x.oU.ONE_SEC_MS))return w.setAccountProp("balanceLoading",!1,Q),[];try{if(ce&&F&&Q){const Ae=yield $.Z.getMyTokensWithBalance();return w.setAccountProp("tokenBalance",Ae,Q),w.setAccountProp("lastRetry",void 0,Q),w.setAccountProp("balanceLoading",!1,Q),Ae}}catch(Ae){w.setAccountProp("lastRetry",Date.now(),Q),C?.(Ae),T.P.showError("Token Balance Unavailable")}finally{w.setAccountProp("balanceLoading",!1,Q)}return[]})(),isCaipNetworkDisabled(C){const y=C.chainNamespace,F=!!w.getAccountData(y)?.caipAddress,Q=w.getAllApprovedCaipNetworkIds(),ge=!1!==w.getNetworkProp("supportsAllNetworks",y),ce=O.a.getConnectorId(y),Ae=O.a.getAuthConnector();return!(!F||ge||ce===j.o.CONNECTOR_ID.AUTH&&Ae||Q?.includes(C.caipNetworkId))}},w=(0,B.X)(g)},22805(Ve,ne,u){"use strict";u.d(ne,{x:()=>A});var S=u(10467),P=u(3631),K=u(98698),m=u(30193),j=u(68095),R=u(96667),k=u(64096),v=u(69245),$=u(17895),x=u(27881),U=u(78977),X=u(95051),B=u(34153),p=u(49519),l=u(66915),O=u(73387);const _={checkNamespaceConnectorId:(E,g)=>x.a.getConnectorId(E)===g,isSocialProvider:E=>p.oU.DEFAULT_REMOTE_FEATURES.socials.includes(E),connectWalletConnect:({walletConnect:E,connector:g,closeModalOnConnect:w=!0,redirectViewOnModalClose:C="Connect",onOpen:y,onConnect:F})=>new Promise((Q,ge)=>{if(E&&x.a.setActiveConnector(g),y?.(l.w.isMobile()&&E),C){const Ae=X.W.subscribeKey("open",Te=>{Te||(B.I.state.view!==C&&B.I.replace(C),Ae(),ge(new Error("Modal closed")))})}const ce=$.W.subscribeKey("activeCaipAddress",Ae=>{Ae&&(F?.(),w&&X.W.close(),ce(),Q(j.C.parseCaipAddress(Ae)))})}),connectExternal:E=>new Promise((g,w)=>{const C=$.W.subscribeKey("activeCaipAddress",y=>{y&&(X.W.close(),C(),g(j.C.parseCaipAddress(y)))});A.connectExternal(E,E.chain).catch(()=>{C(),w(new Error("Connection rejected"))})}),connectSocial({social:E,namespace:g,closeModalOnConnect:w=!0,onOpenFarcaster:C,onConnect:y}){let F,Q=!1,ge=null;const ce=g||$.W.state.activeChain,Ae=$.W.subscribeKey("activeCaipAddress",Te=>{Te&&(w&&X.W.close(),Ae())});return new Promise((Te,ve)=>{function We(Pt){return Ke.apply(this,arguments)}function Ke(){return(Ke=(0,S.A)(function*(Pt){if(Pt.data?.resultUri)if(Pt.origin===m.o.SECURE_SITE_SDK_ORIGIN){window.removeEventListener("message",We,!1);try{const wt=x.a.getAuthConnector(ce);if(wt&&!Q){F&&F.close(),Q=!0;const at=Pt.data.resultUri;U.E.sendEvent({type:"track",event:"SOCIAL_LOGIN_REQUEST_USER_DATA",properties:{provider:E}}),O.i.setConnectedSocialProvider(E),yield A.connectExternal({id:wt.id,type:wt.type,socialUri:at},wt.chain);const xe=$.W.state.activeCaipAddress;if(!xe)return void ve(new Error("Failed to connect"));Te(j.C.parseCaipAddress(xe)),U.E.sendEvent({type:"track",event:"SOCIAL_LOGIN_SUCCESS",properties:{provider:E}})}}catch(wt){U.E.sendEvent({type:"track",event:"SOCIAL_LOGIN_ERROR",properties:{provider:E,message:l.w.parseError(wt)}}),ve(new Error("Failed to connect"))}}else U.E.sendEvent({type:"track",event:"SOCIAL_LOGIN_ERROR",properties:{provider:E,message:"Untrusted Origin"}})})).apply(this,arguments)}function jt(){return(jt=(0,S.A)(function*(){if(U.E.sendEvent({type:"track",event:"SOCIAL_LOGIN_STARTED",properties:{provider:E}}),"farcaster"===E){C?.();const Pt=X.W.subscribeKey("open",at=>{!at&&"farcaster"===E&&(ve(new Error("Popup closed")),y?.(),Pt())}),wt=x.a.getAuthConnector();if(wt&&!$.W.getAccountData(ce)?.farcasterUrl)try{const{url:xe}=yield wt.provider.getFarcasterUri();$.W.setAccountProp("farcasterUrl",xe,ce)}catch{ve(new Error("Failed to connect to farcaster"))}}else{const Pt=x.a.getAuthConnector();ge=l.w.returnOpenHref(`${m.o.SECURE_SITE_SDK_ORIGIN}/loading`,"popupWindow","width=600,height=800,scrollbars=yes");try{if(Pt){const{uri:wt}=yield Pt.provider.getSocialRedirectUri({provider:E});if(ge&&wt){ge.location.href=wt,F=ge;const at=setInterval(()=>{F?.closed&&!Q&&(ve(new Error("Popup closed")),clearInterval(at))},1e3);window.addEventListener("message",We,!1)}else ge?.close(),ve(new Error("Failed to initiate social connection"))}}catch{ve(new Error("Failed to initiate social connection")),ge?.close()}}})).apply(this,arguments)}!function Et(){jt.apply(this,arguments)}()})},connectEmail:({closeModalOnConnect:E=!0,redirectViewOnModalClose:g="Connect",onOpen:w,onConnect:C})=>new Promise((y,F)=>{if(w?.(),g){const ge=X.W.subscribeKey("open",ce=>{ce||(B.I.state.view!==g&&B.I.replace(g),ge(),F(new Error("Modal closed")))})}const Q=$.W.subscribeKey("activeCaipAddress",ge=>{ge&&(C?.(),E&&X.W.close(),Q(),y(j.C.parseCaipAddress(ge)))})}),updateEmail:()=>(0,S.A)(function*(){const E=O.i.getConnectedConnectorId($.W.state.activeChain),g=x.a.getAuthConnector();if(!g)throw new Error("No auth connector found");if(E!==m.o.CONNECTOR_ID.AUTH)throw new Error("Not connected to email or social");const w=g.provider.getEmail()??"";return yield X.W.open({view:"UpdateEmailWallet",data:{email:w,redirectView:void 0}}),new Promise((C,y)=>{const F=setInterval(()=>{const ge=g.provider.getEmail()??"";ge!==w&&(X.W.close(),clearInterval(F),Q(),C({email:ge}))},1e3),Q=X.W.subscribeKey("open",ge=>{ge||("Connect"!==B.I.state.view&&B.I.push("Connect"),clearInterval(F),Q(),y(new Error("Modal closed")))})})})(),canSwitchToSmartAccount:E=>$.W.checkIfSmartAccountEnabled()&&(0,R.lj)(E)===v.Vl.ACCOUNT_TYPES.EOA};var I=u(90995),D=u(62132),H=u(47741);const z=(0,P.BX)({connections:new Map,recentConnections:new Map,isSwitchingConnection:!1,wcError:!1,wcFetchingUri:!1,buffering:!1,status:"disconnected"});let T;const W={state:z,subscribe:E=>(0,P.B1)(z,()=>E(z)),subscribeKey:(E,g)=>(0,K.u$)(z,E,g),_getClient:()=>z._client,setClient(E){z._client=(0,P.KR)(E)},initialize(E){const g=E.filter(w=>!!w.namespace).map(w=>w.namespace);A.syncStorageConnections(g)},syncStorageConnections(E){const g=O.i.getConnections(),w=E??Array.from($.W.state.chains.keys());for(const C of w){const y=g[C]??[],F=new Map(z.recentConnections);F.set(C,y),z.recentConnections=F}},getConnections:E=>
1E?z.connections.get(E)??[]:[],hasAnyConnection:E=>Array.from(A.state.connections.values()).flatMap(w=>w).some(({connectorId:w})=>w===E),connectWalletConnect(){return(0,S.A)(function*({cache:E="auto"}={}){z.wcFetchingUri=!0;const g=l.w.isTelegram()||l.w.isSafari()&&l.w.isIos();try{if("always"===E||"auto"===E&&g){if(T)return yield T,void(T=void 0);if(!l.w.isPairingExpired(z?.wcPairingExpiry))return void(z.wcUri=z.wcUri);T=A._getClient()?.connectWalletConnect?.(),A.state.status="connecting",yield T,T=void 0,z.wcPairingExpiry=void 0,A.state.status="connected"}else yield A._getClient()?.connectWalletConnect?.()}catch(w){throw z.wcError=!0,z.wcFetchingUri=!1,z.status="disconnected",T=void 0,w}}).apply(this,arguments)},connectExternal(E,g){return(0,S.A)(function*(w,C,y=!0){const F=yield A._getClient()?.connectExternal?.(w);y&&$.W.setActiveNamespace(C);const Q=x.a.state.allConnectors.find(ce=>ce.id===w?.id);return U.E.sendEvent({type:"track",event:"CONNECT_SUCCESS",properties:{method:"AUTH"===w.type?"email":"browser",name:Q?.name||"Unknown",view:B.I.state.view,walletRank:Q?.explorerWallet?.order}}),F}).apply(this,arguments)},reconnectExternal:E=>(0,S.A)(function*(){yield A._getClient()?.reconnectExternal?.(E);const g=E.chain||$.W.state.activeChain;g&&x.a.setConnectorId(E.id,g)})(),setPreferredAccountType:(E,g)=>(0,S.A)(function*(){if(!g)return;X.W.setLoading(!0,$.W.state.activeChain);const w=x.a.getAuthConnector();w&&($.W.setAccountProp("preferredAccountType",E,g),yield w.provider.setPreferredAccount(E),O.i.setPreferredAccountTypes(Object.entries($.W.state.chains).reduce((C,[y,F])=>{const Q=y,ge=(0,R.lj)(Q);return void 0!==ge&&(C[Q]=ge),C},{})),yield A.reconnectExternal(w),X.W.setLoading(!1,$.W.state.activeChain),U.E.sendEvent({type:"track",event:"SET_PREFERRED_ACCOUNT_TYPE",properties:{accountType:E,network:$.W.state.activeCaipNetwork?.caipNetworkId||""}}))})(),signMessage:E=>(0,S.A)(function*(){return A._getClient()?.signMessage(E)})(),parseUnits:(E,g)=>A._getClient()?.parseUnits(E,g),formatUnits:(E,g)=>A._getClient()?.formatUnits(E,g),updateBalance:E=>A._getClient()?.updateBalance(E),sendTransaction:E=>(0,S.A)(function*(){return A._getClient()?.sendTransaction(E)})(),getCapabilities:E=>(0,S.A)(function*(){return A._getClient()?.getCapabilities(E)})(),grantPermissions:E=>(0,S.A)(function*(){return A._getClient()?.grantPermissions(E)})(),walletGetAssets:E=>(0,S.A)(function*(){return A._getClient()?.walletGetAssets(E)??{}})(),estimateGas:E=>(0,S.A)(function*(){return A._getClient()?.estimateGas(E)})(),writeContract:E=>(0,S.A)(function*(){return A._getClient()?.writeContract(E)})(),writeSolanaTransaction:E=>(0,S.A)(function*(){return A._getClient()?.writeSolanaTransaction(E)})(),getEnsAddress:E=>(0,S.A)(function*(){return A._getClient()?.getEnsAddress(E)})(),getEnsAvatar:E=>(0,S.A)(function*(){return A._getClient()?.getEnsAvatar(E)})(),checkInstalled:E=>A._getClient()?.checkInstalled?.(E)||!1,resetWcConnection(){z.wcUri=void 0,z.wcPairingExpiry=void 0,z.wcLinking=void 0,z.recentWallet=void 0,z.wcFetchingUri=!1,z.status="disconnected",H.W.resetTransactions(),O.i.deleteWalletConnectDeepLink(),O.i.deleteRecentWallet(),D.z.set({connectingWallet:void 0})},resetUri(){z.wcUri=void 0,z.wcPairingExpiry=void 0,T=void 0,z.wcFetchingUri=!1,D.z.set({connectingWallet:void 0})},finalizeWcConnection(E){const{wcLinking:g,recentWallet:w}=A.state;g&&O.i.setWalletConnectDeepLink(g),w&&O.i.setAppKitRecent(w),E&&U.E.sendEvent({type:"track",event:"CONNECT_SUCCESS",address:E,properties:{method:g?"mobile":"qrcode",name:B.I.state.data?.wallet?.name||"Unknown",view:B.I.state.view,walletRank:w?.order}})},setWcBasic(E){z.wcBasic=E},setUri(E){z.wcUri=E,z.wcFetchingUri=!1,z.wcPairingExpiry=l.w.getPairingExpiry()},setWcLinking(E){z.wcLinking=E},setWcError(E){z.wcError=E,z.wcFetchingUri=!1,z.buffering=!1},setRecentWallet(E){z.recentWallet=E},setBuffering(E){z.buffering=E},setStatus(E){z.status=E},setIsSwitchingConnection(E){z.isSwitchingConnection=E},disconnect(){return(0,S.A)(function*({id:E,namespace:g,initialDisconnect:w}={}){try{yield A._getClient()?.disconnect({id:E,chainNamespace:g,initialDisconnect:w})}catch(C){throw new I.A("Failed to disconnect","INTERNAL_SDK_ERROR",C)}}).apply(this,arguments)},disconnectConnector(E){return(0,S.A)(function*({id:g,namespace:w}){try{yield A._getClient()?.disconnectConnector({id:g,namespace:w})}catch(C){throw new I.A("Failed to disconnect connector","INTERNAL_SDK_ERROR",C)}}).apply(this,arguments)},setConnections(E,g){const w=new Map(z.connections);w.set(g,E),z.connections=w},handleAuthAccountSwitch(E){return(0,S.A)(function*({address:g,namespace:w}){const y=$.W.getAccountData(w)?.user?.accounts?.find(Q=>"smartAccount"===Q.type),F=y&&y.address.toLowerCase()===g.toLowerCase()&&_.canSwitchToSmartAccount(w)?"smartAccount":"eoa";yield A.setPreferredAccountType(F,w)}).apply(this,arguments)},handleActiveConnection(E){return(0,S.A)(function*({connection:g,namespace:w,address:C}){const y=x.a.getConnectorById(g.connectorId),F=g.connectorId===m.o.CONNECTOR_ID.AUTH;if(!y)throw new Error(`No connector found for connection: ${g.connectorId}`);return F?(C&&(yield A.handleAuthAccountSwitch({address:C,namespace:w}
1)),C):(yield A.connectExternal({id:y.id,type:y.type,provider:y.provider,address:C,chain:w},w))?.address}).apply(this,arguments)},handleDisconnectedConnection(E){return(0,S.A)(function*({connection:g,namespace:w,address:C,closeModalOnConnect:y}){const F=x.a.getConnectorById(g.connectorId),Q=g.auth?.name?.toLowerCase(),ge=g.connectorId===m.o.CONNECTOR_ID.AUTH,ce=g.connectorId===m.o.CONNECTOR_ID.WALLET_CONNECT;if(!F)throw new Error(`No connector found for connection: ${g.connectorId}`);let Ae;if(ge)if(Q&&_.isSocialProvider(Q)){const{address:Te}=yield _.connectSocial({social:Q,closeModalOnConnect:y,onOpenFarcaster(){X.W.open({view:"ConnectingFarcaster"})},onConnect(){B.I.replace("ProfileWallets")}});Ae=Te}else{const{address:Te}=yield _.connectEmail({closeModalOnConnect:y,onOpen(){X.W.open({view:"EmailLogin"})},onConnect(){B.I.replace("ProfileWallets")}});Ae=Te}else if(ce){const{address:Te}=yield _.connectWalletConnect({walletConnect:!0,connector:F,closeModalOnConnect:y,onOpen(ve){const We=ve?"AllWallets":"ConnectingWalletConnect";X.W.state.open?B.I.push(We):X.W.open({view:We})},onConnect(){B.I.replace("ProfileWallets")}});Ae=Te}else{const Te=yield A.connectExternal({id:F.id,type:F.type,provider:F.provider,chain:w},w);Te&&(Ae=Te.address)}return ge&&C&&(yield A.handleAuthAccountSwitch({address:C,namespace:w})),Ae}).apply(this,arguments)},switchConnection(E){return(0,S.A)(function*({connection:g,address:w,namespace:C,closeModalOnConnect:y,onChange:F}){let Q;const ge=$.W.getAccountData(C)?.caipAddress;if(ge){const{address:Ae}=j.C.parseCaipAddress(ge);Q=Ae}const ce=k.b.getConnectionStatus(g,C);switch(ce){case"connected":case"active":{const Ae=yield A.handleActiveConnection({connection:g,namespace:C,address:w});if(Q&&Ae){const Te=Ae.toLowerCase()!==Q.toLowerCase();F?.({address:Ae,namespace:C,hasSwitchedAccount:Te,hasSwitchedWallet:"active"===ce})}break}case"disconnected":{const Ae=yield A.handleDisconnectedConnection({connection:g,namespace:C,address:w,closeModalOnConnect:y});Ae&&F?.({address:Ae,namespace:C,hasSwitchedAccount:!0,hasSwitchedWallet:!0});break}default:throw new Error(`Invalid connection status: ${ce}`)}}).apply(this,arguments)}},A=(0,I.X)(W)},27881(Ve,ne,u){"use strict";u.d(ne,{a:()=>T});var S=u(10467),P=u(3631),K=u(98698),m=u(61314),j=u(30193),R=u(61113),k=u(69245),v=u(96667),$=u(13138),x=u(42915),U=u(73387),X=u(90995),B=u(17398),p=u(17895),l=u(95051),O=u(47040),L=u(34153),_=u(83379);const I=Object.fromEntries(m.P.map(W=>[W,void 0])),D=Object.fromEntries(m.P.map(W=>[W,!0])),H=(0,P.BX)({allConnectors:[],connectors:[],activeConnector:void 0,filterByNamespace:void 0,activeConnectorIds:I,filterByNamespaceMap:D}),z={state:H,subscribe:W=>(0,P.B1)(H,()=>{W(H)}),subscribeKey:(W,A)=>(0,K.u$)(H,W,A),initialize(W){W.forEach(A=>{const E=U.i.getConnectedConnectorId(A);E&&T.setConnectorId(E,A)})},setActiveConnector(W){W&&(H.activeConnector=(0,P.KR)(W))},setConnectors(W){W.filter(w=>!H.allConnectors.some(C=>C.id===w.id&&T.getConnectorName(C.name)===T.getConnectorName(w.name)&&C.chain===w.chain)).forEach(w=>{"MULTI_CHAIN"!==w.type&&H.allConnectors.push((0,P.KR)(w))});const E=T.getEnabledNamespaces(),g=T.getEnabledConnectors(E);H.connectors=T.mergeMultiChainConnectors(g)},filterByNamespaces(W){Object.keys(H.filterByNamespaceMap).forEach(A=>{H.filterByNamespaceMap[A]=!1}),W.forEach(A=>{H.filterByNamespaceMap[A]=!0}),T.updateConnectorsForEnabledNamespaces()},filterByNamespace(W,A){H.filterByNamespaceMap[W]=A,T.updateConnectorsForEnabledNamespaces()},updateConnectorsForEnabledNamespaces(){const W=T.getEnabledNamespaces(),A=T.getEnabledConnectors(W),E=T.areAllNamespacesEnabled();H.connectors=T.mergeMultiChainConnectors(A),E?B.N.clearFilterByNamespaces():B.N.filterByNamespaces(W)},getEnabledNamespaces:()=>Object.entries(H.filterByNamespaceMap).filter(([W,A])=>A).map(([W])=>W),getEnabledConnectors:W=>H.allConnectors.filter(A=>W.includes(A.chain)),areAllNamespacesEnabled:()=>Object.values(H.filterByNamespaceMap).every(W=>W),mergeMultiChainConnectors(W){const A=T.generateConnectorMapByName(W),E=[];return A.forEach(g=>{const w=g[0],C=w?.id===j.o.CONNECTOR_ID.AUTH;g.length>1&&w?E.push({name:w.name,imageUrl:w.imageUrl,imageId:w.imageId,connectors:[...g],type:C?"AUTH":"MULTI_CHAIN",chain:"eip155",id:w?.id||""}):w&&E.push(w)}),E},generateConnectorMapByName(W){const A=new Map;return W.forEach(E=>{const{name:g}=E,w=T.getConnectorName(g);if(!w)return;const C=A.get(w)||[];C.find(F=>
1F.chain===E.chain)||C.push(E),A.set(w,C)}),A},getConnectorName:W=>W&&({"Trust Wallet":"Trust"}[W]||W),getUniqueConnectorsByName(W){const A=[];return W.forEach(E=>{A.find(g=>g.chain===E.chain)||A.push(E)}),A},addConnector(W){if(W.id===j.o.CONNECTOR_ID.AUTH){const A=W,E=(0,P.P9)(O.H.state),g=_.W.getSnapshot().themeMode,w=_.W.getSnapshot().themeVariables;A?.provider?.syncDappData?.({metadata:E.metadata,sdkVersion:E.sdkVersion,projectId:E.projectId,sdkType:E.sdkType}),A?.provider?.syncTheme({themeMode:g,themeVariables:w,w3mThemeVariables:(0,R.o)(w,g)}),T.setConnectors([W])}else T.setConnectors([W])},getAuthConnector(W){const A=W||p.W.state.activeChain,E=H.connectors.find(g=>g.id===j.o.CONNECTOR_ID.AUTH);if(E)return E?.connectors?.length?E.connectors.find(w=>w.chain===A):E},getAnnouncedConnectorRdns:()=>H.connectors.filter(W=>"ANNOUNCED"===W.type).map(W=>W.info?.rdns),getConnectorById:W=>$.g.sortConnectorsByPriority(H.allConnectors).find(E=>E.id===W),getConnector({id:W,namespace:A}){const E=A||p.W.state.activeChain,g=H.allConnectors.filter(y=>y.chain===E);return $.g.sortConnectorsByPriority(g).find(y=>y.id===W||y.explorerId===W)},syncIfAuthConnector(W){if("AUTH"!==W.id)return;const A=W,E=(0,P.P9)(O.H.state),g=_.W.getSnapshot().themeMode,w=_.W.getSnapshot().themeVariables;A?.provider?.syncDappData?.({metadata:E.metadata,sdkVersion:E.sdkVersion,sdkType:E.sdkType,projectId:E.projectId}),A.provider.syncTheme({themeMode:g,themeVariables:w,w3mThemeVariables:(0,R.o)(w,g)})},getConnectorsByNamespace(W){const A=H.allConnectors.filter(E=>E.chain===W);return T.mergeMultiChainConnectors(A)},canSwitchToSmartAccount:W=>p.W.checkIfSmartAccountEnabled()&&(0,v.lj)(W)===k.Vl.ACCOUNT_TYPES.EOA,selectWalletConnector(W){const A=L.I.state.data?.redirectView,E=p.W.state.activeChain,g=E?T.getConnector({id:W.id,namespace:E}):void 0;x.W.handleMobileDeeplinkRedirect(g?.explorerId||W.id,p.W.state.activeChain,{isCoinbaseDisabled:!1===O.H.state.enableCoinbase}),g?L.I.push("ConnectingExternal",{connector:g,wallet:W,redirectView:A}):L.I.push("ConnectingWalletConnect",{wallet:W,redirectView:A})},getConnectors:W=>W?T.getConnectorsByNamespace(W):T.mergeMultiChainConnectors(H.allConnectors),setFilterByNamespace(W){H.filterByNamespace=W,H.connectors=T.getConnectors(W),B.N.setFilterByNamespace(W)},setConnectorId(W,A){W&&(H.activeConnectorIds={...H.activeConnectorIds,[A]:W},U.i.setConnectedConnectorId(A,W))},removeConnectorId(W){H.activeConnectorIds={...H.activeConnectorIds,[W]:void 0},U.i.deleteConnectedConnectorId(W)},getConnectorId(W){if(W)return H.activeConnectorIds[W]},isConnected:W=>W?!!H.activeConnectorIds[W]:Object.values(H.activeConnectorIds).some(A=>!!A),resetConnectorIds(){H.activeConnectorIds={...I}},extendConnectorsWithExplorerWallets(W){H.allConnectors.forEach(g=>{const w=W.find(C=>C.id===g.id||C.rdns&&C.rdns===g.info?.rdns);w&&(g.explorerWallet=w)});const A=T.getEnabledNamespaces(),E=T.getEnabledConnectors(A);H.connectors=T.mergeMultiChainConnectors(E)},connect(){return(0,S.A)(function*(W={}){const{namespace:A}=W;return T.setFilterByNamespace(A),L.I.push("Connect",{addWalletForNamespace:A}),new Promise((E,g)=>{if(A){const w=p.W.subscribeChainProp("accountState",y=>{y?.caipAddress&&(E({caipAddress:y?.caipAddress}),w())},A),C=l.W.subscribeKey("open",y=>{y||(g(new Error("Modal closed")),C())})}else{const w=p.W.subscribeKey("activeCaipAddress",y=>{y&&(E({caipAddress:y}),w())}),C=l.W.subscribeKey("open",y=>{y||(g(new Error("Modal closed")),C())})}})}).apply(this,arguments)}},T=(0,X.X)(z)},32428(Ve,ne,u){"use strict";u.d(ne,{f:()=>l});var S=u(10467),P=u(3631),K=u(98698);const m=2147483648,j={convertEVMChainIdToCoinType(O){if(O>=m)throw new Error("Invalid chainId");return(m|O)>>>0}};var R=u(73387),k=u(90995),v=u(86107),$=u(17895),x=u(22805),U=u(27881),X=u(34153);const B=(0,P.BX)({suggestions:[],loading:!1}
1),l=(0,k.X)({state:B,subscribe:O=>(0,P.B1)(B,()=>O(B)),subscribeKey:(O,L)=>(0,K.u$)(B,O,L),resolveName:O=>(0,S.A)(function*(){try{return yield v.T.lookupEnsName(O)}catch(L){const _=L;throw new Error(_?.reasons?.[0]?.description||"Error resolving name")}})(),isNameRegistered:O=>(0,S.A)(function*(){try{return yield v.T.lookupEnsName(O),!0}catch{return!1}})(),getSuggestions:O=>(0,S.A)(function*(){try{B.loading=!0,B.suggestions=[];const L=yield v.T.getEnsNameSuggestions(O);return B.suggestions=L.suggestions||[],B.suggestions}catch(L){const _=l.parseEnsApiError(L,"Error fetching name suggestions");throw new Error(_)}finally{B.loading=!1}})(),getNamesForAddress:O=>(0,S.A)(function*(){try{if(!$.W.state.activeCaipNetwork)return[];const _=R.i.getEnsFromCacheForAddress(O);if(_)return _;const I=yield v.T.reverseLookupEnsName({address:O});return R.i.updateEnsCache({address:O,ens:I,timestamp:Date.now()}),I}catch(L){const _=l.parseEnsApiError(L,"Error fetching names for address");throw new Error(_)}})(),registerName:O=>(0,S.A)(function*(){const L=$.W.state.activeCaipNetwork,_=$.W.getAccountData(L?.chainNamespace)?.address,I=U.a.getAuthConnector();if(!L)throw new Error("Network not found");if(!_||!I)throw new Error("Address or auth connector not found");B.loading=!0;try{const D=JSON.stringify({name:O,attributes:{},timestamp:Math.floor(Date.now()/1e3)});X.I.pushTransactionStack({onCancel(){X.I.replace("RegisterAccountName")}});const H=yield x.x.signMessage(D);B.loading=!1;const z=L.id;if(!z)throw new Error("Network not found");const T=j.convertEVMChainIdToCoinType(Number(z));yield v.T.registerEnsName({coinType:T,address:_,signature:H,message:D}),$.W.setAccountProp("profileName",O,L.chainNamespace),R.i.updateEnsCache({address:_,ens:[{name:O,registered_at:(new Date).toISOString(),updated_at:void 0,addresses:{},attributes:[]}],timestamp:Date.now()}),X.I.replace("RegisterAccountNameSuccess")}catch(D){const H=l.parseEnsApiError(D,`Error registering name ${O}`);throw X.I.replace("RegisterAccountName"),new Error(H)}finally{B.loading=!1}})(),validateName:O=>/^[a-zA-Z0-9-]{4,}$/u.test(O),parseEnsApiError:(O,L)=>O?.reasons?.[0]?.description||L})},78977(Ve,ne,u){"use strict";u.d(ne,{E:()=>X});var S=u(3631),P=u(66915),K=u(51514),m=u(17895),j=u(47040);const R=P.w.getAnalyticsUrl(),k=new K.Z({baseUrl:R,clientId:null}),v=["MODAL_CREATED"],U=(0,S.BX)({timestamp:Date.now(),lastFlush:Date.now(),reportedErrors:{},data:{type:"track",event:"MODAL_CREATED"},pendingEvents:[],subscribedToVisibilityChange:!1,walletImpressions:[]}),X={state:U,subscribe:B=>(0,S.B1)(U,()=>B(U)),getSdkProperties(){const{projectId:B,sdkType:p,sdkVersion:l}=j.H.state;return{projectId:B,st:p,sv:l||"html-wagmi-4.2.2"}},shouldFlushEvents(){const B=JSON.stringify(U.pendingEvents).length/1024>45,p=U.lastFlush+1e4<Date.now();return B||p},_setPendingEvent(B){try{let p=m.W.getAccountData()?.address;if("address"in B.data&&B.data.address&&(p=B.data.address),v.includes(B.data.event)||typeof window>"u")return;const l=m.W.getActiveCaipNetwork()?.caipNetworkId;this.state.pendingEvents.push({eventId:P.w.getUUID(),url:window.location.href,domain:window.location.hostname,timestamp:B.timestamp,props:{...B.data,address:p,properties:{..."properties"in B.data?B.data.properties:{},caipNetworkId:l}}}),U.reportedErrors.FORBIDDEN=!1,X.shouldFlushEvents()&&X._submitPendingEvents()}catch(p){console.warn("_setPendingEvent",p)}},sendEvent(B){U.timestamp=Date.now(),U.data=B,(j.H.state.features?.anal
1ytics||["INITIALIZE","CONNECT_SUCCESS","SOCIAL_LOGIN_SUCCESS"].includes(B.event))&&X._setPendingEvent(U),this.subscribeToFlushTriggers()},sendWalletImpressionEvent(B){U.walletImpressions.push(B)},_transformPendingEventsForBatch(B){try{return B.filter(p=>"WALLET_IMPRESSION_V2"!==p.props.event)}catch{return B}},_submitPendingEvents(){if(U.lastFlush=Date.now(),0!==U.pendingEvents.length||0!==U.walletImpressions.length)try{const B=X._transformPendingEventsForBatch(U.pendingEvents);U.walletImpressions.length&&B.push({eventId:P.w.getUUID(),url:window.location.href,domain:window.location.hostname,timestamp:Date.now(),props:{type:"track",event:"WALLET_IMPRESSION_V2",items:[...U.walletImpressions]}}),k.sendBeacon({path:"/batch",params:X.getSdkProperties(),body:B}),U.reportedErrors.FORBIDDEN=!1,U.pendingEvents=[],U.walletImpressions=[]}catch{U.reportedErrors.FORBIDDEN=!0}},subscribeToFlushTriggers(){U.subscribedToVisibilityChange||typeof document>"u"||(U.subscribedToVisibilityChange=!0,document?.addEventListener?.("visibilitychange",()=>{"hidden"===document.visibilityState&&X._submitPendingEvents()}),document?.addEventListener?.("freeze",()=>{X._submitPendingEvents()}),window?.addEventListener?.("pagehide",()=>{X._submitPendingEvents()}),setInterval(()=>{X._submitPendingEvents()},1e4))}}},95051(Ve,ne,u){"use strict";u.d(ne,{W:()=>L});var S=u(10467),P=u(3631),K=u(98698),m=u(66915),j=u(90764),R=u(90995),k=u(17398),v=u(17895),$=u(22805),x=u(27881),U=u(78977),X=u(47040),B=u(62132),p=u(34153);const l=(0,P.BX)({loading:!1,loadingNamespaceMap:new Map,open:!1,shake:!1,namespace:void 0}),L=(0,R.X)({state:l,subscribe:_=>(0,P.B1)(l,()=>_(l)),subscribeKey:(_,I)=>(0,K.u$)(l,_,I),open:_=>(0,S.A)(function*(){const I=_?.namespace,H=I&&I!==v.W.state.activeChain,z=v.W.getAccountData(_?.namespace)?.caipAddress,T=v.W.state.noAdapters;if($.x.state.wcBasic?k.N.prefetch({fetchNetworkImages:!1,fetchConnectorImages:!1,fetchWalletRanks:!1}):yield k.N.prefetch(),x.a.setFilterByNamespace(_?.namespace),L.setLoading(!0,I),I&&H){const W=v.W.getNetworkData(I)?.caipNetwork||v.W.getRequestedCaipNetworks(I)[0];W&&(T?(yield v.W.switchActiveNetwork(W),p.I.push("ConnectingWalletConnectBasic")):j.L.onSwitchNetwork({network:W,ignoreSwitchConfirmation:!0}))}else X.H.state.manualWCControl||T&&!z?m.w.isMobile()?p.I.reset("AllWallets"):p.I.reset("ConnectingWalletConnectBasic"):_?.view?p.I.reset(_.view,_.data):p.I.reset(z?"Account":"Connect");l.open=!0,B.z.set({open:!0}),U.E.sendEvent({type:"track",event:"MODAL_OPEN",properties:{connected:!!z}})})(),close(){const _=X.H.state.enableEmbedded,I=!!v.W.state.activeCaipAddress;l.open&&U.E.sendEvent({type:"track",event:"MODAL_CLOSE",properties:{connected:I}}),l.open=!1,p.I.reset("Connect"),L.clearLoading(),_?I?p.I.replace("Account"):p.I.push("Connect"):B.z.set({open:!1}),$.x.resetUri()},setLoading(_,I){I&&l.loadingNamespaceMap.set(I,_),l.loading=_,B.z.set({loading:_})},clearLoading(){l.loadingNamespaceMap.clear(),l.loading=!1,B.z.set({loading:!1})},shake(){l.shake||(l.shake=!0,setTimeout(()=>{l.shake=!1},500))}})},43805(Ve,ne,u){"use strict";u.d(ne,{aG:()=>O});var S=u(10467),P=u(3631),K=u(98698),m=u(30193),j=u(49519),R=u(90995),k=u(17398),v=u(86107),$=u(17895),x=u(47040);const U={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"}]},X={id:"USD",payment_method_limits:[{id:"card",min:"10.00",max:"7500.00"},{id:"ach_bank_account",min:"10.00",max:"25000.00"}]},p=(0,P.BX)({providers:j.tM,selectedProvider:null,error:null,purchaseCurrency:U,paymentCurrency:X,purchaseCurrencies:[U],paymentCurrencies:[],quotesLoading:!1}),O=(0,R.X)({state:p,subscribe:L=>(0,P.B1)(p,()=>L(p)),subscribeKey:(L,_)=>(0,K.u$)(p,L,_),setSelectedProvider(L){if(L&&"meld"===L.name){const _=$.W.state.activeChain,I=_===m.o.CHAIN.SOLANA?"SOL":"USDC",D=_?$.W.state.chains.get(_)?.accountState?.address??"":"",H=new URL(L.url);H.searchParams.append("publicKey",j.Db),H.searchParams.append("destinationCurrencyCode",I),H.searchParams.append("walletAddress",D),H.searchParams.append("externalCustomerId",x.H.state.projectId),p.selectedProvider={...L,url:H.toString()}}else p.selectedProvider=L},setOnrampProviders(L){if(Array.isArray(L)&&L.every(_=>"string"==typeof _)){const _=L,I=j.tM.filter(D=>_.includes(D.name));p.providers=I}else p.providers=[]},setPurchaseCurrency(L){p.purchaseCurrency=L},setPaymentCurrency(L){p.paymentCurrency=L},setPurchaseAmount(L){O.state.purchaseAmount=L},setPaymentAmount(L){O.state.paymentAmount=L},getAvailableCurrencies:()=>(0,S.A)(function*(){const L=yield v.T.getOnrampOptions();p.purchaseCurrencies=L.purchaseCurrencies,p.paymentCurrencies=L.paymentCurrencies,p.paymentCurrency=L.paymentCurrencies[0]||X,p.purchaseCurrency=L.purchaseCurrencies[0]||U,yield k.N.fetchCurrencyImages(L.paymentCurrencies.map(_=>_.id)),yield k.N.fetchTokenImages(L.purchaseCurrencies.map(_=>_.symbol))})(),getQuote:()=>(0,S.A)(function*(){p.quotesLoading=!0;try{const L=yield v.T.getOnrampQuote({purchaseCurrency:p.purchaseCurrency,paymentCurrency:p.paymentCurrency,amount:p.paymentAmount?.toString()||"0",network:p.purchaseCurrency?.symbol});return p.quotesLoading=!1,p.purchaseAmount=Number(L?.purchaseAmount.amount),L}catch(L){return p.error=L.message,p.quotesLoading=!1,null}finally{p.quotesLoading=!1}})(),resetState(){p.selectedProvider=null,p.error=null,p.purchaseCurrency=U,p.paymentCurrency=X,p.purchaseCurrencies=[U],p.paymentCurrencies=[],p.paymentAmount=void 0,p.purchaseAmount=void 0,p.quotesLoading=!1}})},47040(Ve,ne,u){"use strict";u.d(ne,{H:()=>k});var S=u(3631),P=u(98698),K=u(49519),m=u(66915),j=u(23728);const R=(0,S.BX)({features:K.oU.DEFAULT_FEATURES,projectId:"",sdkType:"appkit",sdkVersion:"html-wagmi-undefined",defaultAccountTypes:K.oU.DEFAULT_ACCOUNT_TYPES,enableNetworkSwitch:!0,experimental_preferUniversalLinks:!1,remoteFeatures:{},enableMobileFullScreen:!1,coinbasePreference:"all"}),k={state:R,subscribeKey:(v,$)=>(0,P.u$)(R,v,$),setOptions(v){Object.assign(R,v)},setRemoteFeatures(v){if(!v)return;const $={...R.remoteFeatures,...v};R.remoteFeatures=$,R.remoteFeatures?.socials&&(R.remoteFeatures.socials=j.D.filterS
1ocialsByPlatform(R.remoteFeatures.socials)),R.features?.pay&&(R.remoteFeatures.email=!1,R.remoteFeatures.socials=!1)},setFeatures(v){if(!v)return;R.features||(R.features=K.oU.DEFAULT_FEATURES);const $={...R.features,...v};R.features=$,R.features?.pay&&R.remoteFeatures&&(R.remoteFeatures.email=!1,R.remoteFeatures.socials=!1)},setProjectId(v){R.projectId=v},setCustomRpcUrls(v){R.customRpcUrls=v},setAllWallets(v){R.allWallets=v},setIncludeWalletIds(v){R.includeWalletIds=v},setExcludeWalletIds(v){R.excludeWalletIds=v},setFeaturedWalletIds(v){R.featuredWalletIds=v},setTokens(v){R.tokens=v},setTermsConditionsUrl(v){R.termsConditionsUrl=v},setPrivacyPolicyUrl(v){R.privacyPolicyUrl=v},setCustomWallets(v){R.customWallets=v},setIsSiweEnabled(v){R.isSiweEnabled=v},setIsUniversalProvider(v){R.isUniversalProvider=v},setSdkVersion(v){R.sdkVersion=v},setMetadata(v){R.metadata=v},setDisableAppend(v){R.disableAppend=v},setEIP6963Enabled(v){R.enableEIP6963=v},setEnableInjected(v){R.enableInjected=v},setEnableCoinbase(v){R.enableCoinbase=v},setEnableBaseAccount(v){R.enableBaseAccount=v},setDebug(v){R.debug=v},setEnableWalletGuide(v){R.enableWalletGuide=v},setEnableAuthLogger(v){R.enableAuthLogger=v},setEnableWallets(v){R.enableWallets=v},setPreferUniversalLinks(v){R.experimental_preferUniversalLinks=v},setSIWX(v){if(v)for(const[$,x]of Object.entries(K.oU.SIWX_DEFAULTS))v[$]??=x;R.siwx=v},setConnectMethodsOrder(v){R.features={...R.features,connectMethodsOrder:v}},setWalletFeaturesOrder(v){R.features={...R.features,walletFeaturesOrder:v}},setSocialsOrder(v){R.remoteFeatures={...R.remoteFeatures,socials:v}},setCollapseWallets(v){R.features={...R.features,collapseWallets:v}},setEnableEmbedded(v){R.enableEmbedded=v},setAllowUnsupportedChain(v){R.allowUnsupportedChain=v},setManualWCControl(v){R.manualWCControl=v},setEnableNetworkSwitch(v){R.enableNetworkSwitch=v},setEnableMobileFullScreen(v){R.enableMobileFullScreen=m.w.isMobile()&&v},setEnableReconnect(v){R.enableReconnect=v},setCoinbasePreference(v){R.coinbasePreference=v},setDefaultAccountTypes(v={}){Object.entries(v).forEach(([$,x])=>{x&&(R.defaultAccountTypes[$]=x)})},setUniversalProviderConfigOverride(v){R.universalProviderConfigOverride=v},getUniversalProviderConfigOverride:()=>R.universalProviderConfigOverride,getSnapshot:()=>(0,S.P9)(R)}},25637(Ve,ne,u){"use strict";u.d(ne,{G:()=>j});var S=u(3631),P=u(98698);const K={eip155:void 0,solana:void 0,polkadot:void 0,bip122:void 0,cosmos:void 0,sui:void 0,stacks:void 0,ton:void 0,tron:void 0},m=(0,S.BX)({providers:{...K},providerIds:{...K}}),j={state:m,subscribeKey:(R,k)=>(0,P.u$)(m,R,k),subscribe:R=>(0,S.B1)(m,()=>{R(m)}),subscribeProviders:R=>(0,S.B1)(m.providers,()=>R(m.providers)),setProvider(R,k){R&&k&&(m.providers[R]=(0,S.KR)(k))},getProvider(R){if(R)return m.providers[R]},setProviderId(R,k){k&&(m.providerIds[R]=k)},getProviderId(R){if(R)return m.providerIds[R]},reset(){m.providers={...K},m.providerIds={...K}},resetChain(R){m.providers[R]=void 0,m.providerIds[R]=void 0}}},62132(Ve,ne,u){"use strict";u.d(ne,{z:()=>m});var S=u(3631),P=u(98698);const K=(0,S.BX)({loading:!1,open:!1,selectedNetworkId:void 0,activeChain:void 0,initialized:!1,connectingWallet:void 0}),m={state:K,subscribe:j=>(0,S.B1)(K,()=>j(K)),subscribeOpen:j=>(0,P.u$)(K,"open",j),set(j){Object.assign(K,{...K,...j})}}},34153(Ve,ne,u){"use strict";u.d(ne,{I:()=>X});var S=u(3631),P=u(98698),K=u(90995),m=u(17398),j=u(17895),R=u(27881),k=u(95051),v=u(47040);const $=["ConnectingExternal","ConnectingMultiChain","ConnectingSocial","ConnectingFarcaster"],x=(0,S.BX)({view:"Connect",history:["Connect"],transactionStack:[]}),X=(0,K.X)({state:x,subscribeKey:(B,p)=>(0,P.u$)(x,B,p),pushTransactionStack(B){x.transactionStack.push(B)},popTransactionStack(B){const p=x.transactionStack.pop();if(!p)return;const{onSuccess:l,onError:O,onCancel:L}=p;switch(B){case"success":l?.();break;case"error":O?.(),X.goBack();break;case"cancel":L?.(),X.goBack()}},push(B,p){let l=B,O=p;m.N.state.plan.hasExceededUsageLimit&&$.includes(B)&&(l="UsageExceeded",O=void 0),l!==x.view&&(x.view=l,x.history.push(l),x.data=O)},reset(B,p){x.view=B,x.history=[B],x.data=p},replace(B,p){x.history.at(-1)===B||(x.view=B,x.history[x.history.length-1]=B,x.data=p)},goBack(){const B=j.W.state.activeCaipAddress,l=!B&&"ConnectingFarcaster"===X.state.view;if(x.history.length>1){x.history.pop();const[O]=x.history.slice(-1);O&&(x.view=B&&"Connect"===O?"Account":O)}else k.W.close();x.data?.wallet&&(x.data.wallet=void 0),x.data?.redirectView&&(x.data.redirectView=void 0),setTimeout(()=>{if(l){j.W.setAccountProp("farcasterUrl",void 0,j.W.state.activeChain);const O=R.a.getAuthConnector();O?.provider?.reload();const L=(0,S.P9)(v.H.state);O?.provider?.syncDappData?.({metadata:L.metadata,sdkVersion:L.sdkVersion,projectId:L.projectId,sdkType:L.sdkType})}},100)},goBackToIndex(B){if(x.history.length>1){x.history=x.history.slice(0,B+1);const[p]=x.history.slice(-1);p&&(x.view=p)}},goBackOrCloseModal(){X.state.history.length>1?X.goBack():k.W.close()}})},97114(Ve,ne,u){"use strict";u.d(ne,{R:()=>z});var S=u(10467),P=u(3631),K=u(98698),m=u(12699),j=u(30193),R=u(80134),k=u(8722),v=u(69245),$=u(75964),x=u(96667),U=u(49519),X=u(66915),B=u(6031),p=u(90995),l=u(17895),O=u(22805),L=u(78977),_=u(34153),I=u(42408);const D=(0,P.BX)({tokenBalances:[],loading:!1}),z=(0,p.X)({state:D,subscribe:T=>(0,P.B1)(D,()=>T(D)),subscribeKey:(T,W)=>(0,K.u$)(D,T,W),setToken(T){T&&(D.token=(0,P.KR)(T))},setTokenAmount(T){D.sendTokenAmount=T},setReceiverAddress(T){D.receiverAddress=T},setReceiverProfileImageUrl(T){D.receiverProfileImageUrl=T},setReceiverProfileName(T){D.receiverProfileName=T},setNetworkBalanceInUsd(T){D.networkBalanceInUSD=T},setLoading(T){D.loading=T}
1,getSdkEventProperties:T=>({message:X.w.parseError(T),isSmartAccount:(0,x.lj)(l.W.state.activeChain)===v.Vl.ACCOUNT_TYPES.SMART_ACCOUNT,token:D.token?.symbol||"",amount:Number(D.sendTokenAmount??"0"),network:l.W.state.activeCaipNetwork?.caipNetworkId||""}),sendToken:()=>(0,S.A)(function*(){try{switch(z.setLoading(!0),l.W.state.activeCaipNetwork?.chainNamespace){case"eip155":return void(yield z.sendEvmToken());case"solana":return void(yield z.sendSolanaToken());default:throw new Error("Unsupported chain")}}catch(T){throw R.RQ.isUserRejectedRequestError(T)?new R.vx(T):T}finally{z.setLoading(!1)}})(),sendEvmToken:()=>(0,S.A)(function*(){const T=l.W.state.activeChain;if(!T)throw new Error("SendController:sendEvmToken - activeChainNamespace is required");const W=(0,x.lj)(T);if(!z.state.sendTokenAmount||!z.state.receiverAddress)throw new Error("An amount and receiver address are required");if(!z.state.token)throw new Error("A token is required");if(z.state.token?.address){L.E.sendEvent({type:"track",event:"SEND_INITIATED",properties:{isSmartAccount:W===v.Vl.ACCOUNT_TYPES.SMART_ACCOUNT,token:z.state.token.address,amount:Number(z.state.sendTokenAmount),network:l.W.state.activeCaipNetwork?.caipNetworkId||""}});const{hash:A}=yield z.sendERC20Token({receiverAddress:z.state.receiverAddress,tokenAddress:z.state.token.address,sendTokenAmount:z.state.sendTokenAmount,decimals:z.state.token.quantity.decimals});A&&(D.hash=A)}else{L.E.sendEvent({type:"track",event:"SEND_INITIATED",properties:{isSmartAccount:W===v.Vl.ACCOUNT_TYPES.SMART_ACCOUNT,token:z.state.token.symbol||"",amount:Number(z.state.sendTokenAmount),network:l.W.state.activeCaipNetwork?.caipNetworkId||""}});const{hash:A}=yield z.sendNativeToken({receiverAddress:z.state.receiverAddress,sendTokenAmount:z.state.sendTokenAmount,decimals:z.state.token.quantity.decimals});A&&(D.hash=A)}})(),fetchTokenBalance:T=>(0,S.A)(function*(){D.loading=!0;const W=l.W.state.activeChain,A=l.W.state.activeCaipNetwork?.caipNetworkId,E=l.W.state.activeCaipNetwork?.chainNamespace,g=l.W.getAccountData(W)?.caipAddress??l.W.state.activeCaipAddress,w=g?X.w.getPlainAddress(g):void 0;if(D.lastRetry&&!X.w.isAllowedRetry(D.lastRetry,30*U.oU.ONE_SEC_MS))return D.loading=!1,[];try{if(w&&A&&E){const C=yield $.Z.getMyTokensWithBalance();return D.tokenBalances=C,D.lastRetry=void 0,C}}catch(C){D.lastRetry=Date.now(),T?.(C),I.P.showError("Token Balance Unavailable")}finally{D.loading=!1}return[]})(),fetchNetworkBalance(){if(0===D.tokenBalances.length)return;const T=B.s.mapBalancesToSwapTokens(D.tokenBalances);if(!T)return;const W=T.find(A=>A.address===(0,x.K1)());W&&(D.networkBalanceInUSD=W?m.S.multiply(W.quantity.numeric,W.price).toString():"0")},sendNativeToken:T=>(0,S.A)(function*(){_.I.pushTransactionStack({});const W=T.receiverAddress,A=l.W.getAccountData()?.address,E=O.x.parseUnits(T.sendTokenAmount.toString(),Number(T.decimals)),w=yield O.x.sendTransaction({chainNamespace:j.o.CHAIN.EVM,to:W,address:A,data:"0x",value:E??BigInt(0)});return L.E.sendEvent({type:"track",event:"SEND_SUCCESS",properties:{isSmartAccount:(0,x.lj)("eip155")===v.Vl.ACCOUNT_TYPES.SMART_ACCOUNT,token:z.state.token?.symbol||"",amount:Number(T.sendTokenAmount),network:l.W.state.activeCaipNetwork?.caipNetworkId||"",hash:w||""}}),O.x._getClient()?.updateBalance("eip155"),z.resetSend(),{hash:w}})(),sendERC20Token:T=>(0,S.A)(function*(){_.I.pushTransactionStack({onSuccess(){_.I.replace("Account")}});const W=O.x.parseUnits(T.sendTokenAmount.toString(),Number(T.decimals)),A=l.W.getAccountData()?.address;if(A&&T.sendTokenAmount&&T.receiverAddress&&T.tokenAddress){const E=X.w.getPlainAddress(T.tokenAddress);if(!E)throw new Error("SendController:sendERC20Token - tokenAddress is required");const g=yield O.x.writeContract({fromAddress:A,tokenAddress:E,args:[T.receiverAddress,W??BigInt(0)],method:"transfer",abi:k.v.getERC20Abi(E),chainNamespace:j.o.CHAIN.EVM});return L.E.sendEvent({type:"track",event:"SEND_SUCCESS",properties:{isSmartAccount:(0,x.lj)("eip155")===v.Vl.ACCOUNT_TYPES.SMART_ACCOUNT,token:z.state.token?.symbol||"",amount:Number(T.sendTokenAmount),network:l.W.state.activeCaipNetwork?.caipNetworkId||"",hash:g||""}}),z.resetSend(),{hash:g}}return{hash:void 0}})(),sendSolanaToken:()=>
1(0,S.A)(function*(){if(!z.state.sendTokenAmount||!z.state.receiverAddress)throw new Error("An amount and receiver address are required");let T;_.I.pushTransactionStack({onSuccess(){_.I.replace("Account")}}),z.state.token&&z.state.token.address!==U.oU.SOLANA_NATIVE_TOKEN_ADDRESS&&(T=X.w.isCaipAddress(z.state.token.address)?X.w.getPlainAddress(z.state.token.address):z.state.token.address);const W=yield O.x.sendTransaction({chainNamespace:"solana",tokenMint:T,to:z.state.receiverAddress,value:Number(z.state.sendTokenAmount)});W&&(D.hash=W),O.x._getClient()?.updateBalance("solana"),L.E.sendEvent({type:"track",event:"SEND_SUCCESS",properties:{isSmartAccount:!1,token:z.state.token?.symbol||"",amount:Number(z.state.sendTokenAmount),network:l.W.state.activeCaipNetwork?.caipNetworkId||"",hash:W||""}}),z.resetSend()})(),resetSend(){D.token=void 0,D.sendTokenAmount=void 0,D.receiverAddress=void 0,D.receiverProfileImageUrl=void 0,D.receiverProfileName=void 0,D.loading=!1,D.tokenBalances=[]}})},42408(Ve,ne,u){"use strict";u.d(ne,{P:()=>k});var S=u(3631),P=u(98698),K=u(66915);const m=Object.freeze({message:"",variant:"success",svg:void 0,open:!1,autoClose:!0}),j=(0,S.BX)({...m}),k={state:j,subscribeKey:(v,$)=>(0,P.u$)(j,v,$),showLoading(v,$={}){this._showMessage({message:v,variant:"loading",...$})},showSuccess(v){this._showMessage({message:v,variant:"success"})},showSvg(v,$){this._showMessage({message:v,svg:$})},showError(v){const $=K.w.parseError(v);this._showMessage({message:$,variant:"error"})},hide(){j.message=m.message,j.variant=m.variant,j.svg=m.svg,j.open=m.open,j.autoClose=m.autoClose},_showMessage({message:v,svg:$,variant:x="success",autoClose:U=m.autoClose}){j.open?(j.open=!1,setTimeout(()=>{j.message=v,j.variant=x,j.svg=$,j.open=!0,j.autoClose=U},150)):(j.message=v,j.variant=x,j.svg=$,j.open=!0,j.autoClose=U)}}},83379(Ve,ne,u){"use strict";u.d(ne,{W:()=>k});var S=u(3631),P=u(61113),K=u(90995),m=u(27881);const j=(0,S.BX)({themeMode:"dark",themeVariables:{},w3mThemeVariables:void 0}),R={state:j,subscribe:v=>(0,S.B1)(j,()=>v(j)),setThemeMode(v){j.themeMode=v;try{const $=m.a.getAuthConnector();if($){const x=R.getSnapshot().themeVariables;$.provider.syncTheme({themeMode:v,themeVariables:x,w3mThemeVariables:(0,P.o)(x,v)})}}catch{console.info("Unable to sync theme to auth connector")}},setThemeVariables(v){j.themeVariables={...j.themeVariables,...v};try{const $=m.a.getAuthConnector();if($){const x=R.getSnapshot().themeVariables;$.provider.syncTheme({themeVariables:x,w3mThemeVariables:(0,P.o)(j.themeVariables,j.themeMode)})}}catch{console.info("Unable to sync theme to auth connector")}},getSnapshot:()=>(0,S.P9)(j)},k=(0,K.X)(R)},47741(Ve,ne,u){"use strict";u.d(ne,{W:()=>B});var S=u(10467),P=u(3631),K=u(69245),m=u(96667),j=u(90995),R=u(86107),k=u(17895),v=u(78977),$=u(47040),x=u(42408);const U=(0,P.BX)({transactions:[],transactionsByYear:{},lastNetworkInView:void 0,loading:!1,empty:!1,next:void 0}),B=(0,j.X)({state:U,subscribe:p=>(0,P.B1)(U,()=>p(U)),setLastNetworkInView(p){U.lastNetworkInView=p},fetchTransactions:p=>(0,S.A)(function*(){if(!p)throw new Error("Transactions can't be fetched without an accountAddress");U.loading=!0;try{const l=yield R.T.fetchTransactions({account:p,cursor:U.next,chainId:k.W.state.activeCaipNetwork?.caipNetworkId}),O=B.filterSpamTransactions(l.data),L=B.filterByConnectedChain(O),_=[...U.transactions,...L];U.loading=!1,U.transactions=_,U.transactionsByYear=B.groupTransactionsByYearAndMonth(U.transactionsByYear,L),U.empty=0===_.length,U.next=l.next?l.next:void 0}catch{v.E.sendEvent({type:"track",event:"ERROR_FETCH_TRANSACTIONS",properties:{address:p,projectId:$.H.state.projectId,cursor:U.next,isSmartAccount:(0,m.lj)(k.W.state.activeChain)===K.Vl.ACCOUNT_TYPES.SMART_ACCOUNT}}),x.P.showError("Failed to fetch transactions"),U.loading=!1,U.empty=!0,U.next=void 0}})(),groupTransactionsByYearAndMonth(p={},l=[]){const O=p;return l.forEach(L=>{const _=new Date(L.metadata.minedAt).getFullYear(),I=new Date(L.metadata.minedAt).getMonth(),D=O[_]??{},z=(D[I]??[]).filter(T=>T.id!==L.id);O[_]={...D,[I]:[...z,L].sort((T,W)=>new Date(W.metadata.minedAt).getTime()-new Date(T.metadata.minedAt).getTime())}}),O},filterSpamTransactions:p=>p.filter(l=>!l.transfers?.every(L=>!0===L.nft_info?.flags.is_spam)),filterByConnectedChain(p){const l=k.W.state.activeCaipNetwork?.caipNetworkId;return p.filter(L=>L.metadata.chain===l)}
1,clearCursor(){U.next=void 0},resetTransactions(){U.transactions=[],U.transactionsByYear={},U.lastNetworkInView=void 0,U.loading=!1,U.empty=!1,U.next=void 0}},"API_ERROR")},37642(Ve,ne,u){"use strict";u.d(ne,{$:()=>$});var S=u(10467),P=u(3631),K=u(30193),m=u(17398),j=u(90490),R=u(47040);const k={eip155:"ba0ba0cd-17c6-4806-ad93-f9d174f17900",solana:"a1b58899-f671-4276-6a5e-56ca5bd59700",polkadot:"",bip122:"0b4838db-0161-4ffe-022d-532bf03dba00",cosmos:"",sui:"",stacks:"",ton:"20f673c0-095e-49b2-07cf-eb5049dcf600",tron:"3502bb86-cc4e-420f-a387-59ea63a28b00"},v=(0,P.BX)({networkImagePromises:{},tokenImagePromises:{}}),$={fetchWalletImage(x){var U=this;return(0,S.A)(function*(){if(x)return yield m.N._fetchWalletImage(x),U.getWalletImageById(x)})()},fetchNetworkImage(x){var U=this;return(0,S.A)(function*(){if(x)return U.getNetworkImageById(x)||(v.networkImagePromises[x]||(v.networkImagePromises[x]=m.N._fetchNetworkImage(x)),yield v.networkImagePromises[x],U.getNetworkImageById(x))})()},fetchTokenImage(x){var U=this;return(0,S.A)(function*(){if(x)return v.tokenImagePromises[x]||(v.tokenImagePromises[x]=m.N._fetchTokenImage(x)),yield v.tokenImagePromises[x],U.getTokenImage(x)})()},getWalletImageById(x){if(x)return j.j.state.walletImages[x]},getWalletImage:x=>x?.image_url?x?.image_url:x?.image_id?j.j.state.walletImages[x.image_id]:void 0,getNetworkImage:x=>x?.assets?.imageUrl?x?.assets?.imageUrl:x?.assets?.imageId?j.j.state.networkImages[x.assets.imageId]:void 0,getNetworkImageById(x){if(x)return j.j.state.networkImages[x]},getConnectorImage:x=>x?.imageUrl?x.imageUrl:x?.info?.icon?x.info.icon:x?.imageId?j.j.state.connectorImages[x.imageId]:void 0,getChainImage:x=>j.j.state.networkImages[k[x]],getTokenImage(x){if(x)return j.j.state.tokenImages[x]},getWalletImageUrl(x){if(!x)return"";const{projectId:U,sdkType:X,sdkVersion:B}=R.H.state,p=new URL(`${K.o.W3M_API_URL}/getWalletImage/${x}`);return p.searchParams.set("projectId",U),p.searchParams.set("st",X),p.searchParams.set("sv",B),p.toString()},getAssetImageUrl(x){if(!x)return"";const{projectId:U,sdkType:X,sdkVersion:B}=R.H.state,p=new URL(`${K.o.W3M_API_URL}/public/getAssetImage/${x}`);return p.searchParams.set("projectId",U),p.searchParams.set("st",X),p.searchParams.set("sv",B),p.toString()},getChainNamespaceImageUrl(x){return this.getAssetImageUrl(k[x])},getImageByToken:(x,U)=>(0,S.A)(function*(){if("native"===x){const B=K.o.NATIVE_IMAGE_IDS_BY_NAMESPACE[U]??null;return B?$.fetchNetworkImage(B):void 0}const[,X]=Object.entries(K.o.TOKEN_SYMBOLS_BY_ADDRESS).find(([B])=>B.toLowerCase()===x.toLowerCase())??[];if(X)return $.fetchTokenImage(X)})()}},75964(Ve,ne,u){"use strict";u.d(ne,{Z:()=>L});var S=u(10467),P=u(46616),K=u(77176),m=u(30193),j=u(68095),R=u(86107),k=u(17895),v=u(22805),$=u(27881);const x={createBalance(_,I){const D={name:_.metadata.name||"",symbol:_.metadata.symbol||"",decimals:_.metadata.decimals||0,value:_.metadata.value||0,price:_.metadata.price||0,iconUrl:_.metadata.iconUrl||""};return{name:D.name,symbol:D.symbol,chainId:I,address:"native"===_.address?void 0:this.convertAddressToCAIP10Address(_.address,I),value:D.value,price:D.price,quantity:{decimals:D.decimals.toString(),numeric:this.convertHexToBalance({hex:_.balance,decimals:D.decimals})},iconUrl:D.iconUrl}},convertHexToBalance:({hex:_,decimals:I})=>(0,K.J)(BigInt(_),I),convertAddressToCAIP10Address:(_,I)=>`${I}:${_}`,createCAIP2ChainId:(_,I)=>`${I}:${parseInt(_,16)}`,getChainIdHexFromCAIP2ChainId(_){const I=_.split(":");if(I.length<2||!I[1])return"0x0";const H=parseInt(I[1],10);return isNaN(H)?"0x0":`0x${H.toString(16)}`},isWalletGetAssetsResponse(_){return"object"==typeof _&&null!==_&&Object.values(_).every(I=>Array.isArray(I)&&I.every(D=>this.isValidAsset(D)))},isValidAsset:_=>"object"==typeof _&&null!==_&&"string"==typeof _.address&&"string"==typeof _.balance&&("ERC20"===_.type||"NATIVE"===_.type)&&"object"==typeof _.metadata&&null!==_.metadata&&"string"==typeof _.metadata.name&&"string"==typeof _.metadata.symbol&&"number"==typeof _.metadata.decimals&&"number"==typeof _.metadata.price&&"string"==typeof _.metadata.iconUrl};var U=u(73387),X=u(47040);let B;function p(){return l.apply(this,arguments)}function l(){return(l=(0,S.A)(function*(){if(!B){const{createPublicClient:_,http:I,defineChain:D}=yield Promise.all([u.e(7950),u.e(1771),u.e(6658),u.e(2076),u.e(5804)]).then(u.bind(u,15804));B={createPublicClient:_,http:I,defineChain:D}}return B})).apply(this,arguments)}const O={getBlockchainApiRpcUrl(_,I){const D=new URL("https://rpc.walletconnect.org/v1/");return D.searchParams.set("chainId",_),D.searchParams.set("projectId",I),D.toString()},getViemChain:_=>(0,S.A)(function*(){const{defineChain:I}=yield p(),{chainId:D}=j.C.parseCaipNetworkId(_.caipNetworkId);return I({..._,id:Number(D)})})(),createViemPublicClient:_=>(0,S.A)(function*(){const{createPublicClient:I,http:D}=yield p(),H=X.H.state.projectId,z=yield O.getViemChain(_);if(!z)throw new Error(`Chain ${_.caipNetworkId} not found in viem/chains`);return I({chain:z,transport:D(O.getBlockchainApiRpcUrl(_.caipNetworkId,H))})})()},L={getMyTokensWithBalance(){var _=this;return(0,S.A)(function*(I={forceUpdate:void 0,caipNetwork:k.W.state.activeCaipNetwork,address:k.W.getAccountData()?.address}){const{forceUpdate:D,caipNetwork:H,address:z}=I,T=$.a.getConnectorId("eip155")===m.o.CONNECTOR_ID.AUTH;if(!z)return[];const A=U.i.getBalanceCacheForCaipAddress(H?`${H.caipNetworkId}:${z}`:z);if(A)return A.balances;if(H&&H.chainNamespace===m.o.CHAIN.EVM&&T){const g=yield _.getEIP155Balances(z,H);if(g)return _.filterLowQualityTokens(g)}const E=yield R.T.getBalance(z,H?.caipNetworkId,D);return _.filterLowQualityTokens(E.balances)}).apply(this,arguments)},getEIP155Balances:(_,I)=>(0,S.A)(function*(){try{const D=x.getChainIdHexFromCAIP2ChainId(I.caipNetworkId);if(!(yield v.x.getCapabilities(_))?.[D]?.assetDiscovery?.supported)return null;const z=yield v.x.walletGetAssets({account:_,chainFilter:[D]});if(!x.isWalletGetAssetsResponse(z))return null;const W=(z[D]||[]).map(A=>x.createBalance(A,I.caipNetworkId));return U.i.updateBalanceCache({caipAddress:`${I.caipNetworkId}:${_}`,balance:{balances:W},timestamp:Date.now()}),W}catch{return null}})(),filterLowQualityTokens:_=>_.filter(I=>"0"!==I.quantity.decimals),fetchERC20Balance(_){return(0,S.A)(function*({caipAddress:I,assetAddress:D,caipNetwork:H}){const z=yield O.createViemPublicClient(H),{address:T}=j.C.parseCaipAddress(I),[{result:W},{result:A},{result:E},{result:g}]=yield z.multicall({contracts:[{address:D,functionName:"name",args:[],abi:P.xw},{address:D,functionName:"symbol",args:[],abi:P.xw},{address:D,functionName:"balanceOf",args:[T],abi:P.xw},{address:D,functionName:"decimals",args:[],abi:P.xw}]});return{name:W,symbol:A,decimals:g,balance:E&&g?(0,K.J)(E,g):"0"}}).apply(this,arguments)}}},96667(Ve,ne,u){"use strict";u.d(ne,{K1:()=>k,NH:()=>v,kg:()=>x,lj:()=>$});var m=u(17895),j=u(49519);function k(){const U=m.W.state.activeCaipNetwork?.chainNamespace||"eip155";return`${U}:${m.W.state.activeCaipNetwork?.id||1}:${j.oU.NATIVE_TOKEN_ADDRESS[U]}`}function v(U){return j.oU.NATIVE_TOKEN_ADDRESS[U]}function $(U){return m.W.getAccountData(U)?.preferredAccountType}function x(U){return U?m.W.state.chains.get(U)?.networkState?.caipNetwork:m.W.state.activeCaipNetwork}},64096(Ve,ne,u){"use strict";u.d(ne,{b:()=>R});var S=u(22805),P=u(27881),K=u(78977),m=u(47040),j=u(66915);const R={getConnectionStatus(k,v){const $=P.a.state.activeConnectorIds[v],x=S.x.getConnections(v);return $&&k.connectorId===$?"connected":x.some(B=>B.connectorId.toLowerCase()===k.connectorId.toLowerCase())?"active":"disconnected"},excludeConnectorAddressFromConnections:({connections:k,connectorId:v,addresses:$})=>k.map(x=>
1{if(v&&x.connectorId.toLowerCase()===v.toLowerCase()&&$){const X=x.accounts.filter(B=>!$.some(l=>l.toLowerCase()===B.address.toLowerCase()));return{...x,accounts:X}}return x}),excludeExistingConnections(k,v){const $=new Set(k);return v.filter(x=>!$.has(x.connectorId))},getConnectionsByConnectorId:(k,v)=>k.filter($=>$.connectorId.toLowerCase()===v.toLowerCase()),getConnectionsData(k){const v=!!m.H.state.remoteFeatures?.multiWallet,$=P.a.state.activeConnectorIds[k],x=S.x.getConnections(k),X=(S.x.state.recentConnections.get(k)??[]).filter(p=>P.a.getConnectorById(p.connectorId)),B=R.excludeExistingConnections([...x.map(p=>p.connectorId),...$?[$]:[]],X);return v?{connections:x,recentConnections:B}:{connections:x.filter(p=>p.connectorId.toLowerCase()===$?.toLowerCase()),recentConnections:[]}},onConnectMobile(k,v){const $=S.x.state.wcUri;if(k?.mobile_link&&$)try{S.x.setWcError(!1);const{mobile_link:x,link_mode:U,name:X}=k,B=j.w.appendPayToUri($,v),{redirect:p,redirectUniversalLink:l,href:O}=j.w.formatNativeUrl(x,B,U),L=p,_=l,I=j.w.isIframe()?"_top":"_self";S.x.setWcLinking({name:X,href:O}),S.x.setRecentWallet(k),j.w.openHref(m.H.state.experimental_preferUniversalLinks&&_?_:L,I)}catch(x){K.E.sendEvent({type:"track",event:"CONNECT_PROXY_ERROR",properties:{message:x instanceof Error?x.message:"Error parsing the deep link",uri:$,mobile_link:k.mobile_link,name:k.name}}),S.x.setWcError(!0)}}}},13138(Ve,ne,u){"use strict";u.d(ne,{g:()=>B});var S=u(10467),P=u(31849),K=u(30193),m=u(17398),j=u(17895),R=u(22805),k=u(27881),v=u(47040),$=u(66915),x=u(23728),U=u(73387),X=u(42877);const B={getConnectorsByType(p,l,O){const{customWallets:L}=v.H.state,_=U.i.getRecentWallets(),I=X.A.filterOutDuplicateWallets(l),D=X.A.filterOutDuplicateWallets(O),H=p.filter(A=>"MULTI_CHAIN"===A.type),z=p.filter(A=>"ANNOUNCED"===A.type),T=p.filter(A=>"INJECTED"===A.type);return{custom:L,recent:_,external:p.filter(A=>"EXTERNAL"===A.type),multiChain:H,announced:z,injected:T,recommended:I,featured:D}},showConnector(p){const l=p.info?.rdns,O=!!l&&m.N.state.excludedWallets.some(H=>!!H.rdns&&H.rdns===l),L=!!p.name&&m.N.state.excludedWallets.some(H=>P.y.isLowerCaseMatch(H.name,p.name));if("INJECTED"===p.type&&("Browser Wallet"===p.name&&(!$.w.isMobile()||$.w.isMobile()&&!l&&!R.x.checkInstalled())||O||L)||("ANNOUNCED"===p.type||"EXTERNAL"===p.type)&&(O||L))return!1;const{includeWalletIds:_,excludeWalletIds:I}=v.H.state;if("INJECTED"===p.type||"ANNOUNCED"===p.type||"MULTI_CHAIN"===p.type){const H=p.explorerId||p.explorerWallet?.id;if(I?.length&&H&&I.includes(H)||_?.length&&(!H||!_.includes(H)))return!1}return!0},getIsConnectedWithWC:()=>Array.from(j.W.state.chains.values()).some(O=>k.a.getConnectorId(O.namespace)===K.o.CONNECTOR_ID.WALLET_CONNECT),getConnectorTypeOrder({recommended:p,featured:l,custom:O,recent:L,announced:_,injected:I,multiChain:D,external:H,overriddenConnectors:z=v.H.state.features?.connectorTypeOrder??[]}){const W=[{type:"walletConnect",isEnabled:!0},{type:"recent",isEnabled:L.length>0},{type:"injected",isEnabled:[...I,..._,...D].length>0},{type:"featured",isEnabled:l.length>0},{type:"custom",isEnabled:O&&O.length>0},{type:"external",isEnabled:H.length>0},{type:"recommended",isEnabled:p.length>0}].filter(w=>w.isEnabled),A=new Set(W.map(w=>w.type)),E=z.filter(w=>A.has(w)).map(w=>({type:w,isEnabled:!0})),g=W.filter(({type:w})=>!E.some(({type:y})=>y===w));return Array.from(new Set([...E,...g].map(({type:w})=>w)))},sortConnectorsByExplorerWallet:p=>[...p].sort((l,O)=>l.explorerWallet&&O.explorerWallet?(l.explorerWallet.order??0)-(O.explorerWallet.order??0):l.explorerWallet?-1:O.explorerWallet?1:0),getPriority:p=>p.id===K.o.CONNECTOR_ID.BASE_ACCOUNT?0:p.id===K.o.CONNECTOR_ID.COINBASE||p.id===K.o.CONNECTOR_ID.COINBASE_SDK?1:2,sortConnectorsByPriority:p=>[...p].sort((l,O)=>B.getPriority(l)-B.getPriority(O)),getAuthName:({email:p,socialUsername:l,socialProvider:O})=>l?O&&"discord"===O&&l.endsWith("0")?l.slice(0,-1):l:p.length>30?`${p.slice(0,-3)}...`:p,fetchProviderData:p=>(0,S.A)(function*(){try{if("Browser Wallet"===p.name&&!$.w.isMobile())return{accounts:[],chainId:void 0};if(p.id===K.o.CONNECTOR_ID.AUTH)return{accounts:[],chainId:void 0};const[l,O]=yield Promise.all([p.provider?.request({method:"eth_accounts"}),p.provider?.request({method:"eth_chainId"}).then(L=>Number(L))]);return{accounts:l,chainId:O}}catch(l){return console.warn(`Failed to fetch provider data for ${p.name}`,l),{accounts:[],chainId:void 0}}})(),getFilteredCustomWallets(p){const l=U.i.getRecentWallets(),O=k.a.state.connectors.map(D=>
1D.info?.rdns).filter(Boolean),L=l.map(D=>D.rdns).filter(Boolean),_=O.concat(L);if(_.includes("io.metamask.mobile")&&$.w.isMobile()){const D=_.indexOf("io.metamask.mobile");_[D]="io.metamask"}return p.filter(D=>!_.includes(String(D?.rdns)))},hasWalletConnector:p=>k.a.state.connectors.some(l=>l.id===p.id||l.name===p.name),isWalletCompatibleWithCurrentChain(p){const l=j.W.state.activeChain;return!l||!p.chains||p.chains.some(O=>{const L=O.split(":")[0];return l===L})},getFilteredRecentWallets(){return U.i.getRecentWallets().filter(O=>!X.A.isExcluded(O)).filter(O=>!this.hasWalletConnector(O)).filter(O=>this.isWalletCompatibleWithCurrentChain(O))},getCappedRecommendedWallets(p){const{connectors:l}=k.a.state,{customWallets:O,featuredWalletIds:L}=v.H.state,_=l.find(Q=>"walletConnect"===Q.id),I=l.filter(Q=>"INJECTED"===Q.type||"ANNOUNCED"===Q.type||"MULTI_CHAIN"===Q.type);if(!_&&!I.length&&!O?.length)return[];const D=x.D.isEmailEnabled(),H=x.D.isSocialsEnabled(),z=I.filter(Q=>"Browser Wallet"!==Q.name&&"WalletConnect"!==Q.name),y=Math.max(0,4-((L?.length||0)+(O?.length||0)+(z.length||0)+(D?1:0)+(H?1:0)));return y<=0?[]:X.A.filterOutDuplicateWallets(p).slice(0,y)},processConnectorsByType(p,l=!0){const O=B.sortConnectorsByExplorerWallet([...p]);return l?O.filter(B.showConnector):O},connectorList(){const p=B.getConnectorsByType(k.a.state.connectors,m.N.state.recommended,m.N.state.featured),l=this.processConnectorsByType(p.announced.filter(g=>"walletConnect"!==g.id)),O=this.processConnectorsByType(p.injected),L=this.processConnectorsByType(p.multiChain.filter(g=>"WalletConnect"!==g.name),!1),_=p.custom,I=p.recent,D=this.processConnectorsByType(p.external.filter(g=>g.id!==K.o.CONNECTOR_ID.COINBASE_SDK&&g.id!==K.o.CONNECTOR_ID.BASE_ACCOUNT)),H=p.recommended,z=p.featured,T=B.getConnectorTypeOrder({custom:_,recent:I,announced:l,injected:O,multiChain:L,recommended:H,featured:z,external:D}),W=k.a.state.connectors.find(g=>"walletConnect"===g.id),A=$.w.isMobile(),E=[];for(const g of T)switch(g){case"walletConnect":!A&&W&&E.push({kind:"connector",subtype:"walletConnect",connector:W});break;case"recent":B.getFilteredRecentWallets().forEach(C=>E.push({kind:"wallet",subtype:"recent",wallet:C}));break;case"injected":L.forEach(w=>E.push({kind:"connector",subtype:"multiChain",connector:w})),l.forEach(w=>E.push({kind:"connector",subtype:"announced",connector:w})),O.forEach(w=>E.push({kind:"connector",subtype:"injected",connector:w}));break;case"featured":z.forEach(w=>E.push({kind:"wallet",subtype:"featured",wallet:w}));break;case"custom":B.getFilteredCustomWallets(_??[]).forEach(C=>E.push({kind:"wallet",subtype:"custom",wallet:C}));break;case"external":D.forEach(w=>E.push({kind:"connector",subtype:"external",connector:w}));break;case"recommended":B.getCappedRecommendedWallets(H).forEach(C=>E.push({kind:"wallet",subtype:"recommended",wallet:C}));break;default:console.warn(`Unknown connector type: ${g}`)}return E},hasInjectedConnectors:()=>k.a.state.connectors.filter(p=>("INJECTED"===p.type||"ANNOUNCED"===p.type||"MULTI_CHAIN"===p.type)&&"Browser Wallet"!==p.name&&"WalletConnect"!==p.name).length}},49519(Ve,ne,u){"use strict";u.d(ne,{Db:()=>j,oU:()=>R,tM:()=>m});var S=u(30193),P=u(27448);const K=(typeof process<"u"&&typeof process.env<"u"?process.env.NEXT_PUBLIC_SECURE_SITE_ORIGIN:void 0)||"https://secure.walletconnect.org",m=[{label:"Meld.io",name:"meld",feeRange:"1-2%",url:"https://meldcrypto.com",supportedChains:["eip155","solana"]}],j="WXETMuFUQmqqybHuRkSgxv:25B8LJHSfpG6LVjR2ytU5Cwh7Z4Sch2ocoU",R={FOUR_MINUTES_MS:24e4,TEN_SEC_MS:1e4,FIVE_SEC_MS:5e3,THREE_SEC_MS:3e3,ONE_SEC_MS:1e3,SECURE_SITE:K,SECURE_SITE_DASHBOARD:`${K}/dashboard`,SECURE_SITE_FAVICON:`${K}/images/favicon.png`,SOLANA_NATIVE_TOKEN_ADDRESS:"So11111111111111111111111111111111111111111",RESTRICTED_TIMEZONES:["ASIA/SHANGHAI","ASIA/URUMQI","ASIA/CHONGQING","ASIA/HARBIN","ASIA/KASHGAR","ASIA/MACAU","ASIA/HONG_KONG","ASIA/MACAO","ASIA/BEIJING","ASIA/HARBIN"],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"],SUGGESTED_TOKENS_BY_CHAIN:{"eip155:42161":["USD\u20ae0"]},BALANCE_SUPPORTED_CHAINS:[S.o.CHAIN.EVM,S.o.CHAIN.SOLANA],SEND_PARAMS_SUPPORTED_CHAINS:[S.o.CHAIN.EVM],SWAP_SUPPORTED_NETWORKS:["eip155:1","eip155:42161","eip155:10","eip155:324","eip155:8453","eip155:
156","eip155:137","eip155:100","eip155:43114","eip155:250","eip155:8217","eip155:1313161554"],NAMES_SUPPORTED_CHAIN_NAMESPACES:[S.o.CHAIN.EVM],ONRAMP_SUPPORTED_CHAIN_NAMESPACES:[S.o.CHAIN.EVM,S.o.CHAIN.SOLANA],PAY_WITH_EXCHANGE_SUPPORTED_CHAIN_NAMESPACES:[S.o.CHAIN.EVM,S.o.CHAIN.SOLANA],ACTIVITY_ENABLED_CHAIN_NAMESPACES:[S.o.CHAIN.EVM,S.o.CHAIN.TON],NATIVE_TOKEN_ADDRESS:{eip155:"0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee",solana:"So11111111111111111111111111111111111111111",polkadot:"0x",bip122:"0x",cosmos:"0x",sui:"0x",stacks:"0x",ton:"0x",tron:"0x"},CONVERT_SLIPPAGE_TOLERANCE:1,CONNECT_LABELS:{MOBILE:"Open and continue in the wallet app",WEB:"Open and continue in the wallet app"},SEND_SUPPORTED_NAMESPACES:[S.o.CHAIN.EVM,S.o.CHAIN.SOLANA],DEFAULT_REMOTE_FEATURES:{swaps:["1inch"],onramp:["meld"],email:!0,socials:["google","x","discord","farcaster","github","apple","facebook"],activity:!0,reownBranding:!0,multiWallet:!1,emailCapture:!1,payWithExchange:!1,payments:!1,reownAuthentication:!1,headless:!1},DEFAULT_REMOTE_FEATURES_DISABLED:{email:!1,socials:!1,swaps:!1,onramp:!1,activity:!1,reownBranding:!1,emailCapture:!1,reownAuthentication:!1,headless:!1},DEFAULT_FEATURES:{receive:!0,send:!0,emailShowWallets:!0,connectorTypeOrder:["walletConnect","recent","injected","featured","custom","external","recommended"],analytics:!0,allWallets:!0,legalCheckbox:!1,smartSessions:!1,collapseWallets:!1,walletFeaturesOrder:["onramp","swaps","receive","send"],connectMethodsOrder:void 0,pay:!1,reownAuthentication:!1,headless:!1},DEFAULT_SOCIALS:["google","x","farcaster","discord","apple","github","facebook"],DEFAULT_ACCOUNT_TYPES:{bip122:"payment",eip155:"smartAccount",polkadot:"eoa",solana:"eoa",ton:"eoa",tron:"eoa"},ADAPTER_TYPES:{UNIVERSAL:"universal",SOLANA:"solana",WAGMI:"wagmi",ETHERS:"ethers",ETHERS5:"ethers5",BITCOIN:"bitcoin"},SIWX_DEFAULTS:{signOutOnDisconnect:!0},MANDATORY_WALLET_IDS_ON_MOBILE:[P.L.ConnectorExplorerIds[S.o.CONNECTOR_ID.COINBASE],P.L.ConnectorExplorerIds[S.o.CONNECTOR_ID.COINBASE_SDK],P.L.ConnectorExplorerIds[S.o.CONNECTOR_ID.BASE_ACCOUNT],P.L.ConnectorExplorerIds[S.o.SOLFLARE_CONNECTOR_NAME],P.L.ConnectorExplorerIds[S.o.PHANTOM_CONNECTOR_NAME],P.L.ConnectorExplorerIds[S.o.BINANCE_CONNECTOR_NAME]],DEFAULT_CONNECT_METHOD_ORDER:["email","social","wallet"]}},66915(Ve,ne,u){"use strict";u.d(ne,{w:()=>R});var S=u(10467),P=u(30193),K=u(68095),m=u(49519),j=u(73387);const R={getWindow(){if(!(typeof window>"u"))return window},isMobile(){return!!this.isClient()&&!!(window?.matchMedia&&"function"==typeof window.matchMedia&&window.matchMedia("(pointer:coarse)")?.matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent))},checkCaipNetwork:(k,v="")=>k?.caipNetworkId.toLocaleLowerCase().includes(v.toLowerCase()),isAndroid(){if(!this.isMobile())return!1;const k=window?.navigator.userAgent.toLowerCase();return R.isMobile()&&k.includes("android")},isIos(){if(!this.isMobile())return!1;const k=window?.navigator.userAgent.toLowerCase();return k.includes("iphone")||k.includes("ipad")},isSafari(){return!!this.isClient()&&(window?.navigator.userAgent.toLowerCase()).includes("safari")},isClient:()=>typeof window<"u",isPairingExpired:k=>!k||k-Date.now()<=m.oU.TEN_SEC_MS,isAllowedRetry:(k,v=m.oU.ONE_SEC_MS)=>Date.now()-k>=v,copyToClopboard(k){navigator.clipboard.writeText(k)},isIframe(){try{return window?.self!==window?.top}catch{return!1}},isSafeApp(){if(R.isClient()&&window.self!==window.top)try{const k=window?.location?.ancestorOrigins?.[0],v="https://app.safe.global";if(k){const $=new URL(k),x=new URL(v);return $.hostname===x.hostname}}catch{return!1}return!1},getPairingExpiry:()=>Date.now()+m.oU.FOUR_MINUTES_MS,getNetworkId:k=>k?.split(":")[1],getPlainAddress:k=>k?.split(":")[2],wait:k=>(0,S.A)(function*(){return new Promise(v=>{setTimeout(v,k)})})(),debounce(k,v=500){let $;return(...x)=>{$&&clearTimeout($),$=setTimeout(function U(){k(...x)},v)}},isHttpUrl:k=>k.startsWith("http://")||k.startsWith("https://"),formatNativeUrl(k,v,$=null){if(R.isHttpUrl(k))return this.formatUniversalUrl(k,v);let x=k,U=$;x.includes("://")||(x=k.replaceAll("/","").replaceAll(":",""),x=`${x}://`),x.endsWith("/")||(x=`${x}
1/`),U&&!U?.endsWith("/")&&(U=`${U}/`),this.isTelegram()&&this.isAndroid()&&(v=encodeURIComponent(v));const X=encodeURIComponent(v);return{redirect:`${x}wc?uri=${X}`,redirectUniversalLink:U?`${U}wc?uri=${X}`:void 0,href:x}},formatUniversalUrl(k,v){if(!R.isHttpUrl(k))return this.formatNativeUrl(k,v);let $=k;return $.endsWith("/")||($=`${$}/`),{redirect:`${$}wc?uri=${encodeURIComponent(v)}`,href:$}},getOpenTargetForPlatform(k){return"popupWindow"===k?k:this.isTelegram()?j.i.getTelegramSocialProvider()?"_top":"_blank":k},openHref(k,v,$){window?.open(k,this.getOpenTargetForPlatform(v),$||"noreferrer noopener")},returnOpenHref(k,v,$){return window?.open(k,this.getOpenTargetForPlatform(v),$||"noreferrer noopener")},isTelegram:()=>typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto),isPWA(){if(typeof window>"u")return!1;const k=!(!window?.matchMedia||"function"!=typeof window.matchMedia)&&window.matchMedia("(display-mode: standalone)")?.matches,v=window?.navigator?.standalone;return!(!k&&!v)},preloadImage:k=>(0,S.A)(function*(){const v=new Promise(($,x)=>{const U=new Image;U.onload=$,U.onerror=x,U.crossOrigin="anonymous",U.src=k});return Promise.race([v,R.wait(2e3)])})(),parseBalance(k,v){let $="0.000";if("string"==typeof k){const l=Number(k);if(!isNaN(l)){const O=(Math.floor(1e3*l)/1e3).toFixed(3);O&&($=O)}}const[x,U]=$.split("."),X=x||"0",B=U||"000";return{formattedText:`${X}.${B}${v?` ${v}`:""}`,value:X,decimals:B,symbol:v}},getApiUrl:()=>P.o.W3M_API_URL,getBlockchainApiUrl:()=>P.o.BLOCKCHAIN_API_RPC_URL,getAnalyticsUrl:()=>P.o.PULSE_API_URL,getUUID:()=>crypto?.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,k=>{const v=16*Math.random()|0;return("x"===k?v:3&v|8).toString(16)}),parseError:k=>"string"==typeof k?k:"string"==typeof k?.issues?.[0]?.message?k.issues[0].message:k instanceof Error?k.message:"Unknown error",sortRequestedNetworks(k,v=[]){const $={};return v&&k&&(k.forEach((x,U)=>{$[x]=U}),v.sort((x,U)=>{const X=$[x.id],B=$[U.id];return void 0!==X&&void 0!==B?X-B:void 0!==X?-1:void 0!==B?1:0})),v},calculateBalance(k){let v=0;for(const $ of k)v+=$.value??0;return v},formatTokenBalance(k){const v=k.toFixed(2),[$,x]=v.split(".");return{dollars:$,pennies:x}},isAddress(k,v="eip155"){switch(v){case"eip155":return!(!/^(?:0x)?[0-9a-f]{40}$/iu.test(k)||!/^(?:0x)?[0-9a-f]{40}$/iu.test(k)&&!/^(?:0x)?[0-9A-F]{40}$/iu.test(k));case"solana":return/[1-9A-HJ-NP-Za-km-z]{32,44}$/iu.test(k);case"bip122":{const $=/^[1][a-km-zA-HJ-NP-Z1-9]{25,34}$/u.test(k),x=/^[3][a-km-zA-HJ-NP-Z1-9]{25,34}$/u.test(k),U=/^bc1[a-z0-9]{39,87}$/u.test(k),X=/^bc1p[a-z0-9]{58}$/u.test(k);return $||x||U||X}default:return!1}},uniqueBy(k,v){const $=new Set;return k.filter(x=>{const U=x[v];return!$.has(U)&&($.add(U),!0)})},generateSdkVersion:(k,v,$)=>`${v}-${0===k.length?m.oU.ADAPTER_TYPES.UNIVERSAL:k.map(X=>X.adapterType).join(",")}-${$}`,createAccount(k){const{chainNamespace:v,chainId:$,address:x}=K.C.parseCaipAddress(k.caipAddress);return{namespace:v,address:x,chainId:$,caipAddress:k.caipAddress,type:k.type,publicKey:k.publicKey,path:k.path}},isCaipAddress(k){if("string"!=typeof k)return!1;const v=k.split(":"),$=v[0];return 3===v.filter(Boolean).length&&$ in P.o.CHAIN_NAME_MAP},getAccount:k=>k?"string"==typeof k?{address:k,chainId:void 0}:{address:k.address,chainId:k.chainId}:{address:void 0,chainId:void 0},isMac(){const k=window?.navigator.userAgent.toLowerCase();return k.includes("macintosh")&&!k.includes("safari")},formatTelegramSocialLoginUrl(k){const v=`--${encodeURIComponent(window?.location.href)}`,$="state=";if("auth.magic.link"===new URL(k).host){const U="provider_authorization_url=",X=k.substring(k.indexOf(U)+U.length),B=this.injectIntoUrl(decodeURIComponent(X),$,v);return k.replace(X,encodeURIComponent(B))}return this.injectIntoUrl(k,$,v)},injectIntoUrl(k,v,$){const x=k.indexOf(v);if(-1===x)throw new Error(`${v} parameter not found in the URL: ${k}`);const U=k.indexOf("&",x),X=v.length,B=-1!==U?U:k.length;return k.substring(0,x+X)+(k.substring(x+X,B)+$)+k.substring(U)},isNumber:k=>("number"==typeof k||"string"==typeof k)&&!isNaN(Number(k)),appendPayToUri:(k,v)=>v?`${k}&pay=${encodeURIComponent(v)}`:k}},9433(Ve,ne,u){"use strict";u.d(ne,{$f:()=>I,V1:()=>p,cz:()=>X,lZ:()=>O,nj:()=>ge,ro:()=>x,sP:()=>D});var S=u(10467),P=u(68095),K=u(47040);const m={eip155:{native:{assetNamespace:"slip44",assetReference:"60"},defaultTokenNamespace:"erc20"},solana:{native:{assetNamespace:"slip44",assetReference:"501"},defaultTokenNamespace:"token"}},j={56:"714",204:"714"};
1class R extends Error{}function v(ce,Ae){return $.apply(this,arguments)}function $(){return($=(0,S.A)(function*(ce,Ae){const Te=function k(){const{sdkType:ce,sdkVersion:Ae,projectId:Te}=K.H.getSnapshot(),ve=new URL("https://rpc.walletconnect.org/v1/json-rpc");return ve.searchParams.set("projectId",Te),ve.searchParams.set("st",ce),ve.searchParams.set("sv",Ae),ve.searchParams.set("source","fund-wallet"),ve.toString()}(),{projectId:ve}=K.H.getSnapshot(),We={jsonrpc:"2.0",id:1,method:ce,params:{...Ae||{},projectId:ve}},Et=yield(yield fetch(Te,{method:"POST",body:JSON.stringify(We),headers:{"Content-Type":"application/json"}})).json();if(Et.error)throw new R(Et.error.message);return Et})).apply(this,arguments)}function x(ce){return U.apply(this,arguments)}function U(){return(U=(0,S.A)(function*(ce){return(yield v("reown_getExchanges",ce)).result})).apply(this,arguments)}function X(ce){return B.apply(this,arguments)}function B(){return(B=(0,S.A)(function*(ce){return(yield v("reown_getExchangePayUrl",ce)).result})).apply(this,arguments)}function p(ce){return l.apply(this,arguments)}function l(){return(l=(0,S.A)(function*(ce){return(yield v("reown_getExchangeBuyStatus",ce)).result})).apply(this,arguments)}function O(ce,Ae){const{chainNamespace:Te,chainId:ve}=P.C.parseCaipNetworkId(ce),We=m[Te];if(!We)throw new Error(`Unsupported chain namespace for CAIP-19 formatting: ${Te}`);let Ke=We.native.assetNamespace,Et=We.native.assetReference;return"native"!==Ae?(Ke=We.defaultTokenNamespace,Et=Ae):"eip155"===Te&&j[ve]&&(Et=j[ve]),`${Te}:${ve}/${Ke}:${Et}`}const I={network:"eip155:8453",asset:"0x833589fcd6edb6e08f4c7c32d4f71b54bda02913",metadata:{name:"USD Coin",symbol:"USDC",decimals:6}},D={network:"eip155:84532",asset:"0x036CbD53842c5426634e7929541eC2318f3dCF7e",metadata:{name:"USD Coin",symbol:"USDC",decimals:6}},Q={ethereumETH:{network:"eip155:1",asset:"native",metadata:{name:"Ethereum",symbol:"ETH",decimals:18}},baseETH:{network:"eip155:8453",asset:"native",metadata:{name:"Ethereum",symbol:"ETH",decimals:18}},baseUSDC:I,baseSepoliaETH:{network:"eip155:84532",asset:"native",metadata:{name:"Ethereum",symbol:"ETH",decimals:18}},ethereumUSDC:{network:"eip155:1",asset:"0xA0b86991c6218b36c1d19D4a2e9Eb0cE3606eB48",metadata:{name:"USD Coin",symbol:"USDC",decimals:6}},arbitrumUSDC:{network:"eip155:42161",asset:"0xaf88d065e77c8cC2239327C5EDb3A432268e5831",metadata:{name:"USD Coin",symbol:"USDC",decimals:6}},polygonUSDC:{network:"eip155:137",asset:"0x2791bca1f2de4661ed88a30c99a7a9449aa84174",metadata:{name:"USD Coin",symbol:"USDC",decimals:6}},solanaUSDC:{network:"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",asset:"EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v",metadata:{name:"USD Coin",symbol:"USDC",decimals:6}},ethereumUSDT:{network:"eip155:1",asset:"0xdAC17F958D2ee523a2206206994597C13D831ec7",metadata:{name:"Tether USD",symbol:"USDT",decimals:6}},optimismUSDT:{network:"eip155:10",asset:"0x94b008aA00579c1307B0EF2c499aD98a8ce58e58",metadata:{name:"Tether USD",symbol:"USDT",decimals:6}},arbitrumUSDT:{network:"eip155:42161",asset:"0xFd086bC7CD5C481DCC9C85ebE478A1C0b69FCbb9",metadata:{name:"Tether USD",symbol:"USDT",decimals:6}},polygonUSDT:{network:"eip155:137",asset:"0xc2132d05d31c914a87c6611c10748aeb04b58e8f",metadata:{name:"Tether USD",symbol:"USDT",decimals:6}},solanaUSDT:{network:"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",asset:"Es9vMFrzaCERmJfrF4H2FYD4KCoNkY11McCe8BenwNYB",metadata:{name:"Tether USD",symbol:"USDT",decimals:6}},solanaSOL:{network:"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp",asset:"native",metadata:{name:"Solana",symbol:"SOL",decimals:9}}};function ge(ce){return Object.values(Q).filter(Ae=>Ae.network===ce)}},51514(Ve,ne,u){"use strict";u.d(ne,{Z:()=>m});var S=u(10467);function P(){return K.apply(this,arguments)}function K(){return(K=(0,S.A)(function*(...j){const R=yield fetch(...j);if(!R.ok)throw new Error(`HTTP status code: ${R.status}`,{cause:R});return R})).apply(this,arguments)}class m{constructor({baseUrl:R,clientId:k}){this.baseUrl=R,this.clientId=k}get(R){var k=this;return(0,S.A)(function*({headers:v,signal:$,cache:x,...U}){const X=k.createUrl(U);return(yield P(X,{method:"GET",headers:v,signal:$,cache:x})).json()}).apply(this,arguments)}getBlob(R){var k=this;return(0,S.A)(function*({headers:v,signal:$,...x}){const U=k.createUrl(x);return(yield P(U,{method:"GET",headers:v,signal:$})).blob()}).apply(this,arguments)}post(R){var k=this;return(0,S.A)(function*({body:v,headers:$,signal:x,...U}){const X=k.createUrl(U);return(yield P(X,{method:"POST",headers:$,body:v?JSON.stringify(v):void 0,signal:x})).json()}).apply(this,arguments)}put(R){var k=this;return(0,S.A)(function*({body:v,headers:$,signal:x,...U}){const X=k.createUrl(U);return(yield P(X,{method:"PUT",headers:$,body:v?JSON.stringify(v):void 0,signal:x})).json()}).apply(this,arguments)}delete(R){var k=this;return(0,S.A)(function*({body:v,headers:$,signal:x,...U}){const X=k.createUrl(U);return(yield P(X,{method:"DELETE",headers:$,body:v?JSON.stringify(v):void 0,signal:x})).json()}).apply(this,arguments)}createUrl({path:R,params:k}){const v=new URL(R,this.baseUrl);
1return k&&Object.entries(k).forEach(([$,x])=>{null!=x&&v.searchParams.append($,x)}),this.clientId&&v.searchParams.append("clientId",this.clientId),v}sendBeacon({body:R,...k}){const v=this.createUrl(k);return navigator.sendBeacon(v.toString(),R?JSON.stringify(R):void 0)}}},42915(Ve,ne,u){"use strict";u.d(ne,{O:()=>m,W:()=>j});var S=u(30193),P=u(17895),K=u(66915);const m={PHANTOM:{id:"a797aa35c0fadbfc1a53e7f675162ed5226968b44a19ee3d24385c64d1d3c393",url:"https://phantom.app",androidPackage:"app.phantom"},SOLFLARE:{id:"1ca0bdd4747578705b1939af023d120677c64fe6ca76add81fda36e350605e79",url:"https://solflare.com"},COINBASE:{id:"d0ca99ff52b99abc48743dad0f7fc891e041be73574f7fac4afe5d4bb83845c8",url:"https://go.cb-w.com",evmDeeplink:"cbwallet://miniapp"},BINANCE:{id:"2fafea35bb471d22889ccb49c08d99dd0a18a37982602c33f696a5723934ba25",appId:"yFK5FCqYprrXDiVFbhyRx7",deeplink:"bnc://app.binance.com/mp/app",url:"https://app.binance.com/en/download"}},j={isCustomDeeplinkWallet:(R,k)=>R===m.PHANTOM.id?k===S.o.CHAIN.SOLANA||k===S.o.CHAIN.EVM||k===S.o.CHAIN.BITCOIN:R===m.SOLFLARE.id?k===S.o.CHAIN.SOLANA:R===m.COINBASE.id?k===S.o.CHAIN.SOLANA||k===S.o.CHAIN.EVM:R===m.BINANCE.id&&k===S.o.CHAIN.BITCOIN,handleMobileDeeplinkRedirect(R,k,v){const $=window.location.href,x=encodeURIComponent($),U=v?.isCoinbaseDisabled??!1;if(R===m.PHANTOM.id&&!("phantom"in window)){const X=$.startsWith("https")?"https":"http",B=$.split("/")[2],p=encodeURIComponent(`${X}://${B}`),l=`${m.PHANTOM.url}/ul/browse/${x}?ref=${p}`;K.w.isAndroid()?window.location.href=`intent://browse/${x}?ref=${p}#Intent;scheme=phantom;package=${m.PHANTOM.androidPackage};end`:window.location.href=l}if(R===m.SOLFLARE.id&&k===S.o.CHAIN.SOLANA&&!("solflare"in window)&&(window.location.href=`${m.SOLFLARE.url}/ul/v1/browse/${x}?ref=${x}`),k===S.o.CHAIN.SOLANA&&R===m.COINBASE.id&&(U||!("coinbaseSolana"in window))&&(window.location.href=`${m.COINBASE.url}/dapp?cb_url=${x}`),k===S.o.CHAIN.EVM&&R===m.COINBASE.id&&(U||!("coinbaseWalletExtension"in window))&&(window.location.href=`${m.COINBASE.evmDeeplink}?url=${x}`),k===S.o.CHAIN.BITCOIN&&R===m.BINANCE.id&&!("binancew3w"in window)){const X=P.W.state.activeCaipNetwork,B=window.btoa("/pages/browser/index"),p=window.btoa(`url=${x}&defaultChainId=${X?.id??1}`),l=new URL(m.BINANCE.deeplink);l.searchParams.set("appId",m.BINANCE.appId),l.searchParams.set("startPagePath",B),l.searchParams.set("startPageQuery",p);const O=new URL(m.BINANCE.url);O.searchParams.set("_dp",window.btoa(l.toString())),window.location.href=O.toString()}}}},90764(Ve,ne,u){"use strict";u.d(ne,{L:()=>j});var S=u(30193),P=u(17895),K=u(27881),m=u(34153);const j={onSwitchNetwork({network:R,ignoreSwitchConfirmation:k=!1}){const v=P.W.state.activeCaipNetwork,$=P.W.state.activeChain,x=m.I.state.data;if(R.id===v?.id)return;const X=!!P.W.getAccountData($)?.address,B=!!P.W.getAccountData(R.chainNamespace)?.address,p=R.chainNamespace!==$,O=K.a.getConnectorId($)===S.o.CONNECTOR_ID.AUTH,L=S.o.AUTH_CONNECTOR_SUPPORTED_CHAINS.find(_=>_===R.chainNamespace);k||O&&L?m.I.push("SwitchNetwork",{...x,network:R}):X&&p&&!B?m.I.push("SwitchActiveChain",{switchToChain:R.chainNamespace,navigateTo:"Connect",navigateWithReplace:!0,network:R}):m.I.push("SwitchNetwork",{...x,network:R})}}},23728(Ve,ne,u){"use strict";u.d(ne,{D:()=>m});var S=u(47040),P=u(49519),K=u(66915);const m={getFeatureValue(j,R){const k=R?.[j];return void 0===k?P.oU.DEFAULT_FEATURES[j]:k},filterSocialsByPlatform(j){if(!j||!j.length)return j;let R=j;return K.w.isTelegram()&&(K.w.isIos()&&(R=R.filter(k=>"google"!==k)),K.w.isMac()&&(R=R.filter(k=>"x"!==k)),K.w.isAndroid()&&(R=R.filter(k=>!["facebook","x"].includes(k)))),K.w.isMobile()&&(R=R.filter(k=>"facebook"!==k)),R},isSocialsEnabled:()=>Array.isArray(S.H.state.features?.socials)&&S.H.state.features?.socials.length>0||Array.isArray(S.H.state.remoteFeatures?.socials)&&S.H.state.remoteFeatures?.socials.length>0,isEmailEnabled:()=>!(!S.H.state.features?.email&&!S.H.state.remoteFeatures?.email)}},33775(Ve,ne,u){"use strict";u.d(ne,{U:()=>L});var S=u(10467),K=(u(79231),u(30193)),m=u(68095),j=u(69245),R=u(17895),k=u(22805),v=u(27881),$=u(78977),x=u(95051),U=u(47040),X=u(34153),B=u(42408),p=u(96667),l=u(66915);let O=null;const L={getSIWX:()=>U.H.state.siwx,initializeIfEnabled(){var _=this;return(0,S.A)(function*(I=R.W.getActiveCaipAddress()){const D=U.H.state.siwx;if(!D||!I)return;const[H,z,T]=I.split(":");if(R.W.checkIfSupportedNetwork(H,`${H}:${z}`))try{if(U.H.state.remoteFeatures?.emailCapture){const A=R.W.getAccountData(H)?.user;return void(yield x.W.open({view:"DataCapture",data:{email:A?.email??void 0}}))}if(O&&(yield O),(yield D.getSessions(`${H}:${z}`,T)).length)return;yield x.W.open({view:"SIWXSignMessage"})}catch(W){console.error("SIWXUtil:initializeIfEnabled",W),$.E.sendEvent({type:"track",event:"SIWX_AUTH_ERROR",properties:_.getSIWXEventProperties(W)}),yield k.x._getClient()?.disconnect().catch(console.error),X.I.reset("Connect"),B.P.showError("A problem occurred while trying initialize authentication")}}).apply(this,arguments)},isAuthenticated(){return(0,S.A)(function*(_=R.W.getActiveCaipAddress()){if
1(!U.H.state.siwx||!_)return!0;const{chainNamespace:D,chainId:H,address:z}=m.C.parseCaipAddress(_),T=`${D}:${H}`;return(yield L.getSessions({address:z,caipNetworkId:T})).length>0}).apply(this,arguments)},requestSignMessage(){var _=this;return(0,S.A)(function*(){const I=U.H.state.siwx,D=l.w.getPlainAddress(R.W.getActiveCaipAddress()),H=(0,p.kg)();if(!I)throw new Error("SIWX is not enabled");if(!D)throw new Error("No ActiveCaipAddress found");if(!H)throw new Error("No ActiveCaipNetwork or client found");try{const z=yield I.createMessage({chainId:H.caipNetworkId,accountAddress:D}),T=z.toString();let W="";I.signMessage?W=yield I.signMessage({message:T,chainId:H.caipNetworkId,accountAddress:D}):(v.a.getConnectorId(H.chainNamespace)===K.o.CONNECTOR_ID.AUTH&&X.I.pushTransactionStack({}),W=(yield k.x.signMessage(T))||""),yield I.addSession({data:z,message:T,signature:W}),R.W.setLastConnectedSIWECaipNetwork(H),x.W.close(),$.E.sendEvent({type:"track",event:"SIWX_AUTH_SUCCESS",properties:_.getSIWXEventProperties()})}catch(z){(!x.W.state.open||"ApproveTransaction"===X.I.state.view)&&(yield x.W.open({view:"SIWXSignMessage"})),B.P.showError("Error signing message"),$.E.sendEvent({type:"track",event:"SIWX_AUTH_ERROR",properties:_.getSIWXEventProperties(z)}),console.error("SWIXUtil:requestSignMessage",z)}})()},cancelSignMessage(){var _=this;return(0,S.A)(function*(){try{const I=_.getSIWX();if(I?.getRequired?.()){const H=R.W.getLastConnectedSIWECaipNetwork();if(H){const z=yield I?.getSessions(H?.caipNetworkId,l.w.getPlainAddress(R.W.getActiveCaipAddress())||"");z&&z.length>0?yield R.W.switchActiveNetwork(H):yield k.x.disconnect()}else yield k.x.disconnect()}else x.W.close();x.W.close(),$.E.sendEvent({event:"CLICK_CANCEL_SIWX",type:"track",properties:_.getSIWXEventProperties()})}catch(I){console.error("SIWXUtil:cancelSignMessage",I)}})()},getAllSessions(){var _=this;return(0,S.A)(function*(){const I=_.getSIWX(),D=R.W.getAllRequestedCaipNetworks(),H=[];return yield Promise.all(D.map(function(){var z=(0,S.A)(function*(T){const W=yield I?.getSessions(T.caipNetworkId,l.w.getPlainAddress(R.W.getActiveCaipAddress())||"");W&&H.push(...W)});return function(T){return z.apply(this,arguments)}}())),H})()},getSessions:_=>(0,S.A)(function*(){const I=U.H.state.siwx;let D=_?.address;if(!D){const z=R.W.getActiveCaipAddress();D=l.w.getPlainAddress(z)}let H=_?.caipNetworkId;return H||(H=R.W.getActiveCaipNetwork()?.caipNetworkId),I&&D&&H?I.getSessions(H,D):[]})(),isSIWXCloseDisabled(){var _=this;return(0,S.A)(function*(){const I=_.getSIWX();return!(!I||"ApproveTransaction"!==X.I.state.view&&"SIWXSignMessage"!==X.I.state.view)&&(I.getRequired?.()&&0===(yield _.getSessions()).length)})()},authConnectorAuthenticate(_){return(0,S.A)(function*({authConnector:I,chainId:D,socialUri:H,preferredAccountType:z,chainNamespace:T}){const W=L.getSIWX(),A=(0,p.kg)();if(!W||!T.includes(K.o.CHAIN.EVM)||U.H.state.remoteFeatures?.emailCapture){const y=yield I.connect({chainId:D,socialUri:H,preferredAccountType:z});return{address:y.address,chainId:y.chainId,accounts:y.accounts}}const E=`${T}:${D}`,g=yield W.createMessage({chainId:E,accountAddress:"<<AccountAddress>>"}),w={accountAddress:g.accountAddress,chainId:g.chainId,domain:g.domain,uri:g.uri,version:g.version,nonce:g.nonce,notBefore:g.notBefore,statement:g.statement,resources:g.resources,requestId:g.requestId,issuedAt:g.issuedAt,expirationTime:g.expirationTime,serializedMessage:g.toString()},C=yield I.connect({chainId:D,socialUri:H,siwxMessage:w,preferredAccountType:z});return w.accountAddress=C.address,w.serializedMessage=C.message||"",C.signature&&C.message&&(yield L.addEmbeddedWalletSession(w,C.message,C.signature)),R.W.setLastConnectedSIWECaipNetwork(A),{address:C.address,chainId:C.chainId,accounts:C.accounts}}).apply(this,arguments)},addEmbeddedWalletSession:(_,I,D)=>(0,S.A)(function*(){if(O)return O;const H=L.getSIWX();return H?(O=H.addSession({data:_,message:I,signature:D}).finally(()=>{O=null}),O):Promise.resolve()})(),universalProviderAuthenticate(_){return(0,S.A)(function*({universalProvider:I,chains:D,methods:H}){const z=L.getSIWX(),T=(0,p.kg)(),W=new Set(D.map(w=>w.split(":")[0]));if(!z||1!==W.size||!W.has("eip155"))return!1;const A=yield z.createMessage({chainId:(0,p.kg)()?.caipNetworkId||"",accountAddress:""}),E=yield I.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:H,chains:[A.chainId,...D.filter(w=>w!==A.chainId)]});B.P.showLoading("Authenticating...",{autoClose:!1});const g={...E.session.peer.metadata,name:E.session.peer.metadata.name,icon:E.session.peer.metadata.icons?.[0],type:"WALLET_CONNECT"};if(R.W.setAccountProp("connectedWalletInfo",g,Array.from(W)[0]),E?.auths?.length){const w=E.auths.map(C=>{const y=I.client.formatAuthMessage({request:C.p,iss:C.p.iss}
1);return{data:{...C.p,accountAddress:C.p.iss.split(":").slice(-1).join(""),chainId:C.p.iss.split(":").slice(2,4).join(":"),uri:C.p.aud??"",version:C.p.version||A.version,expirationTime:C.p.exp,issuedAt:C.p.iat,notBefore:C.p.nbf},message:y,signature:C.s.s,cacao:C}});try{yield z.setSessions(w),T&&R.W.setLastConnectedSIWECaipNetwork(T),$.E.sendEvent({type:"track",event:"SIWX_AUTH_SUCCESS",properties:L.getSIWXEventProperties()})}catch(C){throw console.error("SIWX:universalProviderAuth - failed to set sessions",C),$.E.sendEvent({type:"track",event:"SIWX_AUTH_ERROR",properties:L.getSIWXEventProperties(C)}),yield I.disconnect().catch(console.error),C}finally{B.P.hide()}}return!0}).apply(this,arguments)},getSIWXEventProperties(_){const I=R.W.state.activeChain;if(!I)throw new Error("SIWXUtil:getSIWXEventProperties - namespace is required");return{network:R.W.state.activeCaipNetwork?.caipNetworkId||"",isSmartAccount:(0,p.lj)(I)===j.Vl.ACCOUNT_TYPES.SMART_ACCOUNT,message:_?l.w.parseError(_):void 0}},clearSessions(){var _=this;return(0,S.A)(function*(){const I=_.getSIWX();I&&(yield I.setSessions([]))})()}}},73387(Ve,ne,u){"use strict";u.d(ne,{i:()=>K});var S=u(30193),P=u(99983);const K={cacheExpiry:{portfolio:3e4,nativeBalance:3e4,ens:3e5,identity:3e5,transactionsHistory:15e3,tokenPrice:15e3,latestAppKitVersion:6048e5,tonWallets:864e5},isCacheExpired:(m,j)=>Date.now()-m>j,getActiveNetworkProps(){const m=K.getActiveNamespace(),j=K.getActiveCaipNetworkId(),R=j?j.split(":")[1]:void 0;return{namespace:m,caipNetworkId:j,chainId:R?isNaN(Number(R))?R:Number(R):void 0}},setWalletConnectDeepLink({name:m,href:j}){try{P.Ud.setItem(P.Ws.DEEPLINK_CHOICE,JSON.stringify({href:j,name:m}))}catch{console.info("Unable to set WalletConnect deep link")}},getWalletConnectDeepLink(){try{const m=P.Ud.getItem(P.Ws.DEEPLINK_CHOICE);if(m)return JSON.parse(m)}catch{console.info("Unable to get WalletConnect deep link")}},deleteWalletConnectDeepLink(){try{P.Ud.removeItem(P.Ws.DEEPLINK_CHOICE)}catch{console.info("Unable to delete WalletConnect deep link")}},setActiveNamespace(m){try{P.Ud.setItem(P.Ws.ACTIVE_NAMESPACE,m)}catch{console.info("Unable to set active namespace")}},setActiveCaipNetworkId(m){try{P.Ud.setItem(P.Ws.ACTIVE_CAIP_NETWORK_ID,m),K.setActiveNamespace(m.split(":")[0])}catch{console.info("Unable to set active caip network id")}},getActiveCaipNetworkId(){try{return P.Ud.getItem(P.Ws.ACTIVE_CAIP_NETWORK_ID)}catch{return void console.info("Unable to get active caip network id")}}
1,deleteActiveCaipNetworkId(){try{P.Ud.removeItem(P.Ws.ACTIVE_CAIP_NETWORK_ID)}catch{console.info("Unable to delete active caip network id")}},deleteConnectedConnectorId(m){try{const j=(0,P.T8)(m);P.Ud.removeItem(j)}catch{console.info("Unable to delete connected connector id")}},setAppKitRecent(m){try{const j=K.getRecentWallets();j.find(k=>k.id===m.id)||(j.unshift(m),j.length>2&&j.pop(),P.Ud.setItem(P.Ws.RECENT_WALLETS,JSON.stringify(j)),P.Ud.setItem(P.Ws.RECENT_WALLET,JSON.stringify(m)))}catch{console.info("Unable to set AppKit recent")}},getRecentWallets(){try{const m=P.Ud.getItem(P.Ws.RECENT_WALLETS);return m?JSON.parse(m):[]}catch{console.info("Unable to get AppKit recent")}return[]},getRecentWallet(){try{const m=P.Ud.getItem(P.Ws.RECENT_WALLET);return m?JSON.parse(m):null}catch{console.info("Unable to get AppKit recent")}return null},deleteRecentWallet(){try{P.Ud.removeItem(P.Ws.RECENT_WALLET)}catch{console.info("Unable to delete AppKit recent")}},setConnectedConnectorId(m,j){try{const R=(0,P.T8)(m);P.Ud.setItem(R,j)}catch{console.info("Unable to set Connected Connector Id")}},getActiveNamespace(){try{return P.Ud.getItem(P.Ws.ACTIVE_NAMESPACE)}catch{console.info("Unable to get active namespace")}},getConnectedConnectorId(m){if(m)try{const j=(0,P.T8)(m);return P.Ud.getItem(j)}catch{console.info("Unable to get connected connector id in namespace",m)}},setConnectedSocialProvider(m){try{P.Ud.setItem(P.Ws.CONNECTED_SOCIAL,m)}catch{console.info("Unable to set connected social provider")}},getConnectedSocialProvider(){try{return P.Ud.getItem(P.Ws.CONNECTED_SOCIAL)}catch{console.info("Unable to get connected social provider")}},deleteConnectedSocialProvider(){try{P.Ud.removeItem(P.Ws.CONNECTED_SOCIAL)}catch{console.info("Unable to delete connected social provider")}},getConnectedSocialUsername(){try{return P.Ud.getItem(P.Ws.CONNECTED_SOCIAL_USERNAME)}catch{console.info("Unable to get connected social username")}},getStoredActiveCaipNetworkId:()=>P.Ud.getItem(P.Ws.ACTIVE_CAIP_NETWORK_ID)?.split(":")?.[1],setConnectionStatus(m){try{P.Ud.setItem(P.Ws.CONNECTION_STATUS,m)}catch{console.info("Unable to set connection status")}},getConnectionStatus(){try{return P.Ud.getItem(P.Ws.CONNECTION_STATUS)}catch{return}},getConnectedNamespaces(){try{const m=P.Ud.getItem(P.Ws.CONNECTED_NAMESPACES);return m?.length?m.split(","):[]}catch{return[]}},setConnectedNamespaces(m){try{const j=Array.from(new Set(m));P.Ud.setItem(P.Ws.CONNECTED_NAMESPACES,j.join(","))}catch{console.info("Unable to set namespaces in storage")}},addConnectedNamespace(m){try{const j=K.getConnectedNamespaces();j.includes(m)||(j.push(m),K.setConnectedNamespaces(j))}catch{console.info("Unable to add connected namespace")}},removeConnectedNamespace(m){try{const j=K.getConnectedNamespaces(),R=j.indexOf(m);R>-1&&(j.splice(R,1),K.setConnectedNamespaces(j))}catch{console.info("Unable to remove connected namespace")}},getTelegramSocialProvider(){try{return P.Ud.getItem(P.Ws.TELEGRAM_SOCIAL_PROVIDER)}catch{return console.info("Unable to get telegram social provider"),null}},setTelegramSocialProvider(m){try{P.Ud.setItem(P.Ws.TELEGRAM_SOCIAL_PROVIDER,m)}catch{console.info("Unable to set telegram social provider")}},removeTelegramSocialProvider(){try{P.Ud.removeItem(P.Ws.TELEGRAM_SOCIAL_PROVIDER)}catch{console.info("Unable to remove telegram social provider")}},getBalanceCache(){let m={};try{const j=P.Ud.getItem(P.Ws.PORTFOLIO_CACHE);m=j?JSON.parse(j):{}}catch{console.info("Unable to get balance cache")}return m},removeAddressFromBalanceCache(m){try{const j=K.getBalanceCache();P.Ud.setItem(P.Ws.PORTFOLIO_CACHE,JSON.stringify({...j,[m]:void 0}))}catch{console.info("Unable to remove address from balance cache",m)}},getBalanceCacheForCaipAddress(m){try{const R=K.getBalanceCache()[m];if(R&&!this.isCacheExpired(R.timestamp,this.cacheExpiry.portfolio))return R.balance;K.removeAddressFromBalanceCache(m)}catch{console.info("Unable to get balance cache for address",m)}},updateBalanceCache(m){try{const j=K.getBalanceCache();j[m.caipAddress]=m,P.Ud.setItem(P.Ws.PORTFOLIO_CACHE,JSON.stringify(j))}catch{console.info("Unable to update balance cache",m)}},getNativeBalanceCache(){let m={};try{const j=P.Ud.getItem(P.Ws.NATIVE_BALANCE_CACHE);m=j?JSON.parse(j):{}}catch{console.info("Unable to get balance cache")}return m},removeAddressFromNativeBalanceCache(m){try{const j=K.getBalanceCache();P.Ud.setItem(P.Ws.NATIVE_BALANCE_CACHE,JSON.stringify({...j,[m]:void 0}))}catch{console.info("Unable to remove address from balance cache",m)}},getNativeBalanceCacheForCaipAddress(m){try{const R=K.getNativeBalanceCache()[m];if(R&&!this.isCacheExpired(R.timestamp,this.cacheExpiry.nativeBalance))return R;console.info("Discarding cache for address",m),K.removeAddressFromBalanceCache(m)}catch{console.info("Unable to get balance cache for address",m)}},updateNativeBalanceCache(m){try{const j=K.getNativeBalanceCache();j[m.caipAddress]=m,P.Ud.setItem(P.Ws.NATIVE_BALANCE_CACHE,JSON.stringify(j))}catch{console.info("Unable to update balance cache",m)}},getEnsCache(){let m={};try{const j=P.Ud.getItem(P.Ws.ENS_CACHE);m=j?JSON.parse(j):{}}catch{console.info("Unable to get ens name cache")}return m}
1,getEnsFromCacheForAddress(m){try{const R=K.getEnsCache()[m];if(R&&!this.isCacheExpired(R.timestamp,this.cacheExpiry.ens))return R.ens;K.removeEnsFromCache(m)}catch{console.info("Unable to get ens name from cache",m)}},updateEnsCache(m){try{const j=K.getEnsCache();j[m.address]=m,P.Ud.setItem(P.Ws.ENS_CACHE,JSON.stringify(j))}catch{console.info("Unable to update ens name cache",m)}},removeEnsFromCache(m){try{const j=K.getEnsCache();P.Ud.setItem(P.Ws.ENS_CACHE,JSON.stringify({...j,[m]:void 0}))}catch{console.info("Unable to remove ens name from cache",m)}},getIdentityCache(){let m={};try{const j=P.Ud.getItem(P.Ws.IDENTITY_CACHE);m=j?JSON.parse(j):{}}catch{console.info("Unable to get identity cache")}return m},getIdentityFromCacheForAddress(m){try{const R=K.getIdentityCache()[m];if(R&&!this.isCacheExpired(R.timestamp,this.cacheExpiry.identity))return R.identity;K.removeIdentityFromCache(m)}catch{console.info("Unable to get identity from cache",m)}},updateIdentityCache(m){try{const j=K.getIdentityCache();j[m.address]={identity:m.identity,timestamp:m.timestamp},P.Ud.setItem(P.Ws.IDENTITY_CACHE,JSON.stringify(j))}catch{console.info("Unable to update identity cache",m)}},removeIdentityFromCache(m){try{const j=K.getIdentityCache();P.Ud.setItem(P.Ws.IDENTITY_CACHE,JSON.stringify({...j,[m]:void 0}))}catch{console.info("Unable to remove identity from cache",m)}},getTonWalletsCache(){try{const m=P.Ud.getItem(P.Ws.TON_WALLETS_CACHE),j=m?JSON.parse(m):void 0;if(j&&!this.isCacheExpired(j.timestamp,this.cacheExpiry.tonWallets))return j;K.removeTonWalletsCache()}catch{console.info("Unable to get ton wallets cache")}},updateTonWalletsCache(m){try{const j=K.getTonWalletsCache()||{timestamp:0,wallets:[]};j.timestamp=(new Date).getTime(),j.wallets=m,P.Ud.setItem(P.Ws.TON_WALLETS_CACHE,JSON.stringify(j))}catch{console.info("Unable to update ton wallets cache",m)}},removeTonWalletsCache(){try{P.Ud.removeItem(P.Ws.TON_WALLETS_CACHE)}catch{console.info("Unable to remove ton wallets cache")}},clearAddressCache(){try{P.Ud.removeItem(P.Ws.PORTFOLIO_CACHE),P.Ud.removeItem(P.Ws.NATIVE_BALANCE_CACHE),P.Ud.removeItem(P.Ws.ENS_CACHE),P.Ud.removeItem(P.Ws.IDENTITY_CACHE),P.Ud.removeItem(P.Ws.HISTORY_TRANSACTIONS_CACHE)}catch{console.info("Unable to clear address cache")}},setPreferredAccountTypes(m){try{P.Ud.setItem(P.Ws.PREFERRED_ACCOUNT_TYPES,JSON.stringify(m))}catch{console.info("Unable to set preferred account types",m)}},getPreferredAccountTypes(){try{const m=P.Ud.getItem(P.Ws.PREFERRED_ACCOUNT_TYPES);return m?JSON.parse(m):{}}catch{console.info("Unable to get preferred account types")}return{}},setConnections(m,j){try{const R=K.getConnections(),k=R[j]??[],v=new Map;for(const x of k)v.set(x.connectorId,{...x});for(const x of m){const U=v.get(x.connectorId);if(U&&x.connectorId!==S.o.CONNECTOR_ID.AUTH){const B=new Set(U.accounts.map(l=>l.address.toLowerCase())),p=x.accounts.filter(l=>!B.has(l.address.toLowerCase()));U.accounts.push(...p)}else v.set(x.connectorId,{...x})}const $={...R,[j]:Array.from(v.values())};P.Ud.setItem(P.Ws.CONNECTIONS,JSON.stringify($))}catch(R){console.error("Unable to sync connections to storage",R)}},getConnections(){try{const m=P.Ud.getItem(P.Ws.CONNECTIONS);return m?JSON.parse(m):{}}catch(m){return console.error("Unable to get connections from storage",m),{}}},deleteAddressFromConnection({connectorId:m,address:j,namespace:R}){try{const k=K.getConnections(),$=new Map((k[R]??[]).map(U=>[U.connectorId,U])),x=$.get(m);x&&(0===x.accounts.filter(X=>X.address.toLowerCase()!==j.toLowerCase()).length?$.delete(m):$.set(m,{...x,accounts:x.accounts.filter(X=>X.address.toLowerCase()!==j.toLowerCase())})),P.Ud.setItem(P.Ws.CONNECTIONS,JSON.stringify({...k,[R]:Array.from($.values())}))}catch{console.error(`Unable to remove address "${j}" from connector "${m}" in namespace "${R}"`)}},getDisconnectedConnectorIds(){try{const m=P.Ud.getItem(P.Ws.DISCONNECTED_CONNECTOR_IDS);return m?JSON.parse(m):{}}catch{console.info("Unable to get disconnected connector ids")}return{}},addDisconnectedConnectorId(m,j){try{const R=K.getDisconnectedConnectorIds(),k=R[j]??[];k.push(m),P.Ud.setItem(P.Ws.DISCONNECTED_CONNECTOR_IDS,JSON.stringify({...R,[j]:Array.from(new Set(k))}))}catch{console.error(`Unable to set disconnected connector id "${m}" for namespace "${j}"`)}},removeDisconnectedConnectorId(m,j){try{const R=K.getDisconnectedConnectorIds();let k=R[j]??[];k=k.filter(v=>v.toLowerCase()!==m.toLowerCase()),P.Ud.setItem(P.Ws.DISCONNECTED_CONNECTOR_IDS,JSON.stringify({...R,[j]:Array.from(new Set(k))}))}catch{console.error(`Unable to remove disconnected connector id "${m}" for namespace "${j}"`)}},isConnectorDisconnected(m,j){try{return(K.getDisconnectedConnectorIds()[j]??[]).some(v=>v.toLowerCase()===m.toLowerCase())}catch{console.info(`Unable to get disconnected connector id "${m}" for namespace "${j}"`)}return!1},getTransactionsCache(){try{const m=P.Ud.getItem(P.Ws.HISTORY_TRANSACTIONS_CACHE);return m?JSON.parse(m):{}}catch{console.info("Unable to get transactions cache")}return{}},getTransactionsCacheForAddress({address:m,chainId:j=""}){try{const k=K.getTransactionsCache()[m]?.[j];if(k&&!this.isCacheExpired(k.timestamp,this.cacheExpiry.transactionsHistory)
1)return k.transactions;K.removeTransactionsCache({address:m,chainId:j})}catch{console.info("Unable to get transactions cache")}},updateTransactionsCache({address:m,chainId:j="",timestamp:R,transactions:k}){try{const v=K.getTransactionsCache();v[m]={...v[m],[j]:{timestamp:R,transactions:k}},P.Ud.setItem(P.Ws.HISTORY_TRANSACTIONS_CACHE,JSON.stringify(v))}catch{console.info("Unable to update transactions cache",{address:m,chainId:j,timestamp:R,transactions:k})}},removeTransactionsCache({address:m,chainId:j}){try{const R=K.getTransactionsCache(),k=R?.[m]||{},{[j]:v,...$}=k;P.Ud.setItem(P.Ws.HISTORY_TRANSACTIONS_CACHE,JSON.stringify({...R,[m]:$}))}catch{console.info("Unable to remove transactions cache",{address:m,chainId:j})}},getTokenPriceCache(){try{const m=P.Ud.getItem(P.Ws.TOKEN_PRICE_CACHE);return m?JSON.parse(m):{}}catch{console.info("Unable to get token price cache")}return{}},getTokenPriceCacheForAddresses(m){try{const R=K.getTokenPriceCache()[m.join(",")];if(R&&!this.isCacheExpired(R.timestamp,this.cacheExpiry.tokenPrice))return R.tokenPrice;K.removeTokenPriceCache(m)}catch{console.info("Unable to get token price cache for addresses",m)}},updateTokenPriceCache(m){try{const j=K.getTokenPriceCache();j[m.addresses.join(",")]={timestamp:m.timestamp,tokenPrice:m.tokenPrice},P.Ud.setItem(P.Ws.TOKEN_PRICE_CACHE,JSON.stringify(j))}catch{console.info("Unable to update token price cache",m)}},removeTokenPriceCache(m){try{const j=K.getTokenPriceCache();P.Ud.setItem(P.Ws.TOKEN_PRICE_CACHE,JSON.stringify({...j,[m.join(",")]:void 0}))}catch{console.info("Unable to remove token price cache",m)}},getLatestAppKitVersion(){try{const m=this.getLatestAppKitVersionCache(),j=m?.version;return j&&!this.isCacheExpired(m.timestamp,this.cacheExpiry.latestAppKitVersion)?j:void 0}catch{console.info("Unable to get latest AppKit version")}},getLatestAppKitVersionCache(){try{const m=P.Ud.getItem(P.Ws.LATEST_APPKIT_VERSION);return m?JSON.parse(m):{}}catch{console.info("Unable to get latest AppKit version cache")}return{}},updateLatestAppKitVersion(m){try{const j=K.getLatestAppKitVersionCache();j.timestamp=m.timestamp,j.version=m.version,P.Ud.setItem(P.Ws.LATEST_APPKIT_VERSION,JSON.stringify(j))}catch{console.info("Unable to update latest AppKit version on local storage",m)}}}},6031(Ve,ne,u){"use strict";u.d(ne,{s:()=>k});var S=u(10467),P=u(86107),K=u(17895),m=u(22805),j=u(75964),R=u(96667);const k={getTokenList:v=>(0,S.A)(function*(){return(yield P.T.fetchSwapTokens({chainId:v}))?.tokens?.map(U=>({...U,eip2612:!1,quantity:{decimals:"0",numeric:"0"},price:0,value:0}))||[]})(),fetchGasPrice:()=>(0,S.A)(function*(){const v=K.W.state.activeCaipNetwork;if(!v)return null;try{if("solana"===v.chainNamespace){const $=(yield m.x?.estimateGas({chainNamespace:"solana"}))?.toString();return{standard:$,fast:$,instant:$}}return yield P.T.fetchGasPrice({chainId:v.caipNetworkId})}catch{return null}})(),fetchSwapAllowance(v){return(0,S.A)(function*({tokenAddress:$,userAddress:x,sourceTokenAmount:U,sourceTokenDecimals:X}){const B=yield P.T.fetchSwapAllowance({tokenAddress:$,userAddress:x});if(B?.allowance&&U&&X){const p=m.x.parseUnits(U,X)||0;return BigInt(B.allowance)>=p}return!1}).apply(this,arguments)},getMyTokensWithBalance(v){var $=this;return(0,S.A)(function*(){const x=yield j.Z.getMyTokensWithBalance({forceUpdate:v,caipNetwork:K.W.state.activeCaipNetwork,address:K.W.getAccountData()?.address});return K.W.setAccountProp("tokenBalance",x,K.W.state.activeChain),$.mapBalancesToSwapTokens(x)})()},mapBalancesToSwapTokens:v=>v?.map($=>({...$,address:$?.address?$.address:(0,R.K1)(),decimals:parseInt($.quantity.decimals,10),logoUri:$.iconUrl,eip2612:!1}))||[],handleSwapError:v=>(0,S.A)(function*(){try{const $=v?.cause;return $?.json&&(yield $.json())?.reasons?.[0]?.description?.includes("insufficient liquidity")?"Insufficient liquidity":void 0}catch{return}})()}},19069(Ve,ne,u){"use strict";u.d(ne,{k:()=>x});var S=u(10467),P=u(68095),K=u(32428);function m(U){try{return new URL(U)}catch{return null}}function k(U,X){if(X.includes("://")){const L=m(X);return!!L&&L.origin===U}const{host:B,port:p}=function j(U){const X=U.split("/"),B=X.length>0&&void 0!==X[0]?X[0]:"",p=B.lastIndexOf(":");return-1===p?{host:B}:{host:B.slice(0,p),port:B.slice(p+1)}}(X),l=U.indexOf("://");if(-1!==l){const L=l+3;let _=U.indexOf("/",L);-1===_&&(_=U.length);const I=U.slice(L,_);return void 0!==p?`${B}:${p}`===I:B===I.split(":")[0]}const O=m(U);return!!O&&(void 0!==p?B===O.hostname&&p===(O.port||void 0):B===O.hostname)}function v(U,X,B){let l,p=B;const O=p.indexOf("://");-1!==O&&(l=p.slice(0,O),p=p.slice(O+3));const L=p.indexOf("/");-1!==L&&(p=p.slice(0,L));let I,_=p;const D=_.lastIndexOf(":");-1!==D&&(I=_.slice(D+1),_=_.slice(0,D));const H=_.split(".");for(const E of H)if(E.includes("*")&&"*"!==E)return!1;const z=U.protocol.replace(/:$/u,"");if(l&&l!==z||void 0!==I&&"*"!==I&&I!==U.port)return!1;const T=function R(U){const X=U.indexOf("://");if(-1===X)return null;const B=U.slice(0,X),p=X+3;let l=U.indexOf("/",p);-1===l&&(l=U.length);const O=U.slice(p,l),L=O.lastIndexOf(":");return-1===L?{scheme:B,host:O}:{scheme:B,host:O.slice(0,L),port:O.slice(L+1)}}(X),A=(T?T.host:U.hostname).split(".");if(H.length!==A.length)return!1;for(let E=H.length-1;E>=0;E-=1){const g=H[E];if("*"!==g&&g!==A[E])return!1}return!0}const $={ton:["ton_sendMessage","ton_signData"],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"],tron:["tron_signMessage","tron_signTransaction"]},x={RPC_ERROR_CODE:{USER_REJECTED:5e3,USER_REJECTED_METHODS:5002},getMethodsByChainNamespace:U=>$[U]||[],createDefaultNamespace(U){return{methods:this.getMethodsByChainNamespace(U),events:["accountsChanged","chainChanged"],chains:[],rpcMap:{}}},applyNamespaceOverrides(U,X){if(!X)return{...U};const B={...U},p=new Set;
1if(X.methods&&Object.keys(X.methods).forEach(l=>p.add(l)),X.chains&&Object.keys(X.chains).forEach(l=>p.add(l)),X.events&&Object.keys(X.events).forEach(l=>p.add(l)),X.rpcMap&&Object.keys(X.rpcMap).forEach(l=>{const[O]=l.split(":");O&&p.add(O)}),p.forEach(l=>{B[l]||(B[l]=this.createDefaultNamespace(l))}),X.methods&&Object.entries(X.methods).forEach(([l,O])=>{B[l]&&(B[l].methods=O)}),X.chains&&Object.entries(X.chains).forEach(([l,O])=>{B[l]&&(B[l].chains=O)}),X.events&&Object.entries(X.events).forEach(([l,O])=>{B[l]&&(B[l].events=O)}),X.rpcMap){const l=new Set;Object.entries(X.rpcMap).forEach(([O,L])=>{const[_,I]=O.split(":");!_||!I||!B[_]||(B[_].rpcMap||(B[_].rpcMap={}),l.has(_)||(B[_].rpcMap={},l.add(_)),B[_].rpcMap[I]=L)})}return B},createNamespaces(U,X){const B=U.reduce((p,l)=>{const{id:O,chainNamespace:L,rpcUrls:_}=l,I=_.default.http[0];p[L]||(p[L]=this.createDefaultNamespace(L));const D=`${L}:${O}`,H=p[L];switch(H.chains.push(D),D){case"solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp":H.chains.push("solana:4sGjMW1sUnHzSxGspuhpqLDx6wiyjNtZ");break;case"solana:EtWTRABZaYq6iMfeYKouRu166VU2xqa1":H.chains.push("solana:8E9rvCKLFQia2Y35HXjjpWzj8weVo44K")}return H?.rpcMap&&I&&(H.rpcMap[O]=I),p},{});return this.applyNamespaceOverrides(B,X)},resolveReownName:(U=(0,S.A)(function*(X){const B=yield K.f.resolveName(X);return(B?.addresses?Object.values(B.addresses):[])[0]?.address||!1}),function(B){return U.apply(this,arguments)}),getChainsFromNamespaces:(U={})=>Object.values(U).flatMap(X=>{const B=X.chains||[],p=X.accounts.map(l=>{const[O,L]=l.split(":");return`${O}:${L}`});return Array.from(new Set([...B,...p]))}),isSessionEventData:U=>"object"==typeof U&&null!==U&&"id"in U&&"topic"in U&&"params"in U&&"object"==typeof U.params&&null!==U.params&&"chainId"in U.params&&"event"in U.params&&"object"==typeof U.params.event&&null!==U.params.event,isUserRejectedRequestError(U){try{if("object"==typeof U&&null!==U){const B="number"==typeof U.code;return B&&U.code===x.RPC_ERROR_CODE.USER_REJECTED_METHODS||B&&U.code===x.RPC_ERROR_CODE.USER_REJECTED}return!1}catch{return!1}},isOriginAllowed(U,X,B){const p=[...X,...B];if(0===X.length)return!0;const l=m(U);if(!l)return p.some(O=>!O.includes("*")&&O===U);if("localhost"===l.hostname||"127.0.0.1"===l.hostname)return!0;for(const O of p)if(O.includes("*")){if(v(l,U,O))return!0}else if(k(U,O))return!0;return!1},listenWcProvider({universalProvider:U,namespace:X,onConnect:B,onDisconnect:p,onAccountsChanged:l,onChainChanged:O,onDisplayUri:L}){B&&U.on("connect",()=>{const _=x.getWalletConnectAccounts(U,X);B(_)}),p&&U.on("disconnect",()=>{p()}),l&&U.on("accountsChanged",_=>{try{const I=U.session?.namespaces?.[X]?.accounts||[],D=U.rpcProviders?.[X]?.getDefaultChain(),H=_.map(z=>{const T=I.find(E=>E.includes(`${X}:${D}:${z}`));if(!T)return;const{chainId:W,chainNamespace:A}=P.C.parseCaipAddress(T);return{address:z,chainId:W,chainNamespace:A}}).filter(z=>void 0!==z);H.length>0&&l(H)}catch(I){console.warn("Failed to parse accounts for namespace on accountsChanged event",X,_,I)}}),O&&U.on("chainChanged",_=>{O(_)}),L&&U.on("display_uri",_=>{L(_)})},getWalletConnectAccounts(U,X){const B=new Set,p=U?.session?.namespaces?.[X]?.accounts?.map(l=>P.C.parseCaipAddress(l)).filter(({address:l})=>!B.has(l.toLowerCase())&&(B.add(l.toLowerCase()),!0));return p&&p.length>0?p:[]}};var U},42877(Ve,ne,u){"use strict";u.d(ne,{A:()=>x});var S=u(31849),P=u(17398),K=u(22805),m=u(27881),j=u(47040),R=u(13138),k=u(49519),v=u(66915),$=u(73387);const x={filterOutDuplicatesByRDNS(U){const X=m.a.state.connectors,B=$.i.getRecentWallets(),p=X.map(_=>_.info?.rdns).filter(Boolean),l=B.map(_=>_.rdns).filter(Boolean),O=p.concat(l);if(O.includes("io.metamask.mobile")&&v.w.isMobile()){const _=O.indexOf("io.metamask.mobile");O[_]="io.metamask"}return U.filter(_=>!(_?.rdns&&O.includes(String(_.rdns))||!_?.rdns&&X.some(D=>D.name===_.name)))},filterOutDuplicatesByIds(U){const X=m.a.state.connectors.filter(_=>"ANNOUNCED"===_.type||"INJECTED"===_.type||"MULTI_CHAIN"===_.type),B=$.i.getRecentWallets(),p=X.map(_=>_.explorerId||_.explorerWallet?.id||_.id),l=B.map(_=>_.id),O=p.concat(l);return U.filter(_=>
1!O.includes(_?.id))},filterOutDuplicateWallets(U){const X=this.filterOutDuplicatesByRDNS(U);return this.filterOutDuplicatesByIds(X)},markWalletsAsInstalled(U){const{connectors:X}=m.a.state,{featuredWalletIds:B}=j.H.state,p=X.filter(L=>"ANNOUNCED"===L.type).reduce((L,_)=>(_.info?.rdns&&(L[_.info.rdns]=!0),L),{});return U.map(L=>({...L,installed:!!L.rdns&&!!p[L.rdns??""]})).sort((L,_)=>{const I=Number(_.installed)-Number(L.installed);if(0!==I)return I;if(B?.length){const D=B.indexOf(L.id),H=B.indexOf(_.id);if(-1!==D&&-1!==H)return D-H;if(-1!==D)return-1;if(-1!==H)return 1}return 0})},getConnectOrderMethod(U,X){const B=U?.connectMethodsOrder||j.H.state.features?.connectMethodsOrder,p=X||m.a.state.connectors;if(B)return B;const{injected:l,announced:O}=R.g.getConnectorsByType(p,P.N.state.recommended,P.N.state.featured),L=l.filter(R.g.showConnector),_=O.filter(R.g.showConnector);return L.length||_.length?["wallet","email","social"]:k.oU.DEFAULT_CONNECT_METHOD_ORDER},isExcluded(U){const X=!!U.rdns&&P.N.state.excludedWallets.some(p=>p.rdns===U.rdns),B=!!U.name&&P.N.state.excludedWallets.some(p=>S.y.isLowerCaseMatch(p.name,U.name));return X||B},markWalletsWithDisplayIndex:U=>U.map((X,B)=>({...X,display_index:B})),filterWalletsByWcSupport:U=>K.x.state.wcBasic?U.filter(X=>X.supports_wc):v.w.isMobile()?U.filter(X=>X.supports_wc||k.oU.MANDATORY_WALLET_IDS_ON_MOBILE.includes(X.id)):U,getWalletConnectWallets(U){const X=[...P.N.state.featured,...P.N.state.recommended];P.N.state.filteredWallets?.length>0?X.push(...P.N.state.filteredWallets):X.push(...U);const B=v.w.uniqueBy(X,"id"),p=x.markWalletsAsInstalled(B),l=x.filterWalletsByWcSupport(p);return x.markWalletsWithDisplayIndex(l)}}},90995(Ve,ne,u){"use strict";u.d(ne,{A:()=>B,X:()=>l});var S=u(10467),P=u(3631),K=u(98698),m=u(66915),j=u(51514),R=u(47040);const k=Object.freeze({enabled:!0,events:[]}),v=new j.Z({baseUrl:m.w.getAnalyticsUrl(),clientId:null}),U=(0,P.BX)({...k}),X={state:U,subscribeKey:(O,L)=>(0,K.u$)(U,O,L),sendError:(O,L)=>(0,S.A)(function*(){if(!U.enabled)return;const _=Date.now();if(U.events.filter(H=>{const z=new Date(H.properties.timestamp||"").getTime();return _-z<6e4}).length>=5)return;const D={type:"error",event:L,properties:{errorType:O.name,errorMessage:O.message,stackTrace:O.stack,timestamp:(new Date).toISOString()}};U.events.push(D);try{if(typeof window>"u")return;const{projectId:H,sdkType:z,sdkVersion:T}=R.H.state;yield v.post({path:"/e",params:{projectId:H,st:z,sv:T||"html-wagmi-4.2.2"},body:{eventId:m.w.getUUID(),url:window.location.href,domain:window.location.hostname,timestamp:(new Date).toISOString(),props:{type:"error",event:L,errorType:O.name,errorMessage:O.message,stackTrace:O.stack}}})}catch{}})(),enable(){U.enabled=!0},disable(){U.enabled=!1},clearEvents(){U.events=[]}};class B extends Error{constructor(L,_,I){super(L),this.originalName="AppKitError",this.name="AppKitError",this.category=_,this.originalError=I,I&&I instanceof Error&&(this.originalName=I.name),Object.setPrototypeOf(this,B.prototype);let D=!1;if(I instanceof Error&&"string"==typeof I.stack&&I.stack){const H=I.stack,z=H.indexOf("\n");if(z>-1){const T=H.substring(z+1);this.stack=`${this.name}: ${this.message}\n${T}`,D=!0}}D||(Error.captureStackTrace?Error.captureStackTrace(this,B):this.stack||(this.stack=`${this.name}: ${this.message}`))}}function p(O,L){let _="";try{_=O instanceof Error?O.message:"string"==typeof O?O:"object"==typeof O&&null!==O?0===Object.keys(O).length?"Unknown error":O?.message||JSON.stringify(O):String(O)}catch(D){_="Unknown error",console.error("Error parsing error message",D)}const I=O instanceof B?O:new B(_,L,O);throw X.sendError(I,I.category),I}function l(O,L="INTERNAL_SDK_ERROR"){const _={};return Object.keys(O).forEach(I=>{const D=O[I];if("function"==typeof D){let H=D;H="AsyncFunction"===D.constructor.name?function(){var z=(0,S.A)(function*(...T){try{return yield D(...T)}catch(W){return p(W,L)}});return function(){return z.apply(this,arguments)}}():(...z)=>{try{return D(...z)}catch(T){return p(T,L)}},_[I]=H}else _[I]=D}),_}},54665(Ve,ne,u){"use strict";u.d(ne,{z8:()=>S,tt:()=>$,Zv:()=>K.Z,AH:()=>X.AH,EM:()=>x.E,RF:()=>P.RF,JX:()=>P.JX,ds:()=>P.ds,f:()=>X.f});const S={interpolate(B,p,l){if(2!==B.length||2!==p.length)throw new Error("inputRange and outputRange must be an array of length 2");const O=B[0]||0,L=B[1]||0,_=p[0]||0,I=p[1]||0;return l<O?_:l>L?I:(I-_)/(L-O)*(l-O)+_}};var P=u(76428),K=u(94159),m=u(99262);const R=.1,k=["receive","deposit","borrow","claim"],v=["withdraw","repay","burn"],$={getTransactionGroupTitle(B,p){const l=m.r.getYear(),O=m.r.getMonthNameByIndex(p);return B===l?O:`${O} ${B}`},getTransactionImages(B){const[p]=B;return B?.length>1?B.map(O=>this.getTransactionImage(O)):[this.getTransactionImage(p)]},getTransactionImage:B=>({type:$.getTransactionTransferTokenType(B),url:$.getTransactionImageURL(B)}),getTransactionImageURL(B){let p;const l=!!B?.nft_info,O=!!B?.fungible_info;return B&&l?p=B?.nft_info?.content?.preview?.url:B&&O&&(p=B?.fungible_info?.icon?.url),p},getTransactionTransferTokenType:B=>B?.fungible_info?"FUNGIBLE":B?.nft_info?"NFT":void 0,getTransactionDescriptions(B,p){const l=B?.metadata?.operationType,O=p||B?.transfers,L=O&&O.length>0,_=O&&O.length>1,I=L&&O.every(A=>!!A?.fungible_info),[D,H]=O||[];let z=this.getTransferDescription(D),T=this.getTransferDescription(H);if(!L)return"send"!==l&&"receive"!==l||!I?[B.metadata.status]:(z=K.Z.getTruncateString({string:B?.metadata.sentFrom,charsStart:4,charsEnd:6,truncate:"middle"}),T=K.Z.getTruncateString({string:B?.metadata.sentTo,charsStart:4,charsEnd:6,truncate:"middle"}),[z,T]);if(_)return O?.map(A=>this.getTransferDescription(A));let W="";return k.includes(l)?W="+":v.includes(l)&&(W="-"),z=W.concat(z),[z]},getTransferDescription(B){let p="";return B&&(B?.nft_info?p=B?.nft_info?.name||"-":B?.fungible_info&&(p=this.getFungibleTransferDescription(B)||"-")),p},getFungibleTransferDescription(B){return B?[this.getQuantityFixedValue(B?.quantity.numeric),B?.fungible_info?.symbol].join(" ").trim():null},mergeTransfers(B){if(B?.length<=1)return B;const l=this.filterGasFeeTransfers(B).reduce((L,_)=>{const I=_?.fungible_info?.name,D=L.find(({fungible_info:H,direction:z})=>I&&I===H?.name&&z===_.direction);if(D){const H=Number(D.quantity.numeric)+Number(_.quantity.numeric);D.quantity.numeric=H.toString(),D.value=(D.value||0)+(_.value||0)}else L.push(_);return L},[]);let O=l;return l.length>2&&(O=l.sort((L,_)=>(_.value||0)-(L.value||0)).slice(0,2)),O=O.sort((L,_)=>"out"===L.direction&&"in"===_.direction?-1:"in"===L.direction&&"out"===_.direction?1:0),O},filterGasFeeTransfers(B){const p=B?.reduce((O,L)=>{const _=L?.fungible_info?.name;return _&&(O[_]||(O[_]=[]),O[_].push(L)),O},{}),l=[];return Object.values(p??{}
1).forEach(O=>{if(1===O.length){const L=O[0];L&&l.push(L)}else{const L=O.filter(I=>"in"===I.direction),_=O.filter(I=>"out"===I.direction);if(1===L.length&&1===_.length){const I=L[0],D=_[0];let H=!1;if(I&&D){const z=Number(I.quantity.numeric),T=Number(D.quantity.numeric);T<z*R?(l.push(I),H=!0):z<T*R&&(l.push(D),H=!0)}H||l.push(...O)}else{const I=this.filterGasFeesFromTokenGroup(O);l.push(...I)}}}),B?.forEach(O=>{O?.fungible_info?.name||l.push(O)}),l},filterGasFeesFromTokenGroup(B){if(B.length<=1)return B;const p=B?.map(D=>Number(D.quantity.numeric)),l=Math.max(...p);if(Math.min(...p)<.01*l)return B?.filter(H=>Number(H.quantity.numeric)>=.01*l);const _=B?.filter(D=>"in"===D.direction),I=B?.filter(D=>"out"===D.direction);if(1===_.length&&1===I.length){const D=_[0],H=I[0];if(D&&H){const z=Number(D.quantity.numeric),T=Number(H.quantity.numeric);if(T<z*R)return[D];if(z<T*R)return[H]}}return B},getQuantityFixedValue:B=>B?parseFloat(B).toFixed(3):null};var x=u(61235),X=(u(65607),u(94296))},65607(Ve,ne,u){"use strict";u.d(ne,{LU:()=>P,R7:()=>U});const P={core:{backgroundAccentPrimary:"#0988F0",backgroundAccentCertified:"#C7B994",backgroundWalletKit:"#FFB800",backgroundAppKit:"#FF573B",backgroundCloud:"#0988F0",backgroundDocumentation:"#008847",backgroundSuccess:"rgba(48, 164, 107, 0.20)",backgroundError:"rgba(223, 74, 52, 0.20)",backgroundWarning:"rgba(243, 161, 63, 0.20)",textAccentPrimary:"#0988F0",textAccentCertified:"#C7B994",textWalletKit:"#FFB800",textAppKit:"#FF573B",textCloud:"#0988F0",textDocumentation:"#008847",textSuccess:"#30A46B",textError:"#DF4A34",textWarning:"#F3A13F",borderAccentPrimary:"#0988F0",borderSecondary:"#C7B994",borderSuccess:"#30A46B",borderError:"#DF4A34",borderWarning:"#F3A13F",foregroundAccent010:"rgba(9, 136, 240, 0.1)",foregroundAccent020:"rgba(9, 136, 240, 0.2)",foregroundAccent040:"rgba(9, 136, 240, 0.4)",foregroundAccent060:"rgba(9, 136, 240, 0.6)",foregroundSecondary020:"rgba(199, 185, 148, 0.2)",foregroundSecondary040:"rgba(199, 185, 148, 0.4)",foregroundSecondary060:"rgba(199, 185, 148, 0.6)",iconAccentPrimary:"#0988F0",iconAccentCertified:"#C7B994",iconSuccess:"#30A46B",iconError:"#DF4A34",iconWarning:"#F3A13F",glass010:"rgba(255, 255, 255, 0.1)",zIndex:"9999"},dark:{overlay:"rgba(0, 0, 0, 0.50)",backgroundPrimary:"#202020",backgroundInvert:"#FFFFFF",textPrimary:"#FFFFFF",textSecondary:"#9A9A9A",textTertiary:"#BBBBBB",textInvert:"#202020",borderPrimary:"#2A2A2A",borderPrimaryDark:"#363636",borderSecondary:"#4F4F4F",foregroundPrimary:"#252525",foregroundSecondary:"#2A2A2A",foregroundTertiary:"#363636",iconDefault:"#9A9A9A",iconInverse:"#FFFFFF"},light:{overlay:"rgba(230 , 230, 230, 0.5)",backgroundPrimary:"#FFFFFF",borderPrimaryDark:"#E9E9E9",backgroundInvert:"#202020",textPrimary:"#202020",textSecondary:"#9A9A9A",textTertiary:"#6C6C6C",textInvert:"#FFFFFF",borderPrimary:"#E9E9E9",borderSecondary:"#D0D0D0",foregroundPrimary:"#F3F3F3",foregroundSecondary:"#E9E9E9",foregroundTertiary:"#D0D0D0",iconDefault:"#9A9A9A",iconInverse:"#202020"}},U={colors:{black:"#202020",white:"#FFFFFF",white010:"rgba(255, 255, 255, 0.1)",accent010:"rgba(9, 136, 240, 0.1)",accent020:"rgba(9, 136, 240, 0.2)",accent030:"rgba(9, 136, 240, 0.3)",accent040:"rgba(9, 136, 240, 0.4)",accent050:"rgba(9, 136, 240, 0.5)",accent060:"rgba(9, 136, 240, 0.6)",accent070:"rgba(9, 136, 240, 0.7)",accent080:"rgba(9, 136, 240, 0.8)",accent090:"rgba(9, 136, 240, 0.9)",accent100:"rgba(9, 136, 240, 1.0)",accentSecondary010:"rgba(199, 185, 148, 0.1)",accentSecondary020:"rgba(199, 185, 148, 0.2)",accentSecondary030:"rgba(199, 185, 148, 0.3)",accentSecondary040:"rgba(199, 185, 148, 0.4)",accentSecondary050:"rgba(199, 185, 148, 0.5)",accentSecondary060:"rgba(199, 185, 148, 0.6)",accentSecondary070:"rgba(199, 185, 148, 0.7)",accentSecondary080:"rgba(199, 185, 148, 0.8)",accentSecondary090:"rgba(199, 185, 148, 0.9)",accentSecondary100:"rgba(199, 185, 148, 1.0)",productWalletKit:"#FFB800",productAppKit:"#FF573B",productCloud:"#0988F0",productDocumentation:"#008847",neutrals050:"#F6F6F6",neutrals100:"#F3F3F3",neutrals200:"#E9E9E9",neutrals300:"#D0D0D0",neutrals400:"#BBB",neutrals500:"#9A9A9A",neutrals600:"#6C6C6C",neutrals700:"#4F4F4F",neutrals800:"#363636",neutrals900:"#2A2A2A",neutrals1000:"#252525",semanticSuccess010:"rgba(48, 164, 107, 0.1)",semanticSuccess020:"rgba(48, 164, 107, 0.2)",semanticSuccess030:"rgba(48, 164, 107, 0.3)",semanticSuccess040:"rgba(48, 164, 107, 0.4)",semanticSuccess050:"rgba(48, 164, 107, 0.5)",semanticSuccess060:"rgba(48, 164, 107, 0.6)",semanticSuccess070:"rgba(48, 164, 107, 0.7)",semanticSuccess080:"rgba(48, 164, 107, 0.8)",semanticSuccess090:"rgba(48, 164, 107, 0.9)",semanticSuccess100:"rgba(48, 164, 107, 1.0)",semanticError010:"rgba(223, 74, 52, 0.1)",semanticError020:"rgba(223, 74, 52, 0.2)",semanticError030:"rgba(223, 74, 52, 0.3)",semanticError040:"rgba(223, 74, 52, 0.4)",semanticError050:"rgba(223, 74, 52, 0.5)",semanticError060:"rgba(223, 74, 52, 0.6)",semanticError070:"rgba(223, 74, 52, 0.7)",semanticError080:"rgba(223, 74, 52, 0.8)",semanticError090:"rgba(223, 74, 52, 0.9)",semanticError100:"rgba(223, 74, 52, 1.0)",semanticWarning010:"rgba(243, 161, 63, 0.1)",semanticWarning020:"rgba(243, 161, 63, 0.2)",semanticWarning030:"rgba(243, 161, 63, 0.3)",semanticWarning040:"rgba(243, 161, 63, 0.4)",semanticWarning050:"rgba(243, 161, 63, 0.5)",semanticWarning060:"rgba(243, 161, 63, 0.6)",semanticWarning070:"rgba(243, 161, 63, 0.7)",semanticWarning080:"rgba(243, 161, 63, 0.8)",semanticWarning090:"rgba(243, 161, 63, 0.9)",semanticWarning100:"rgba(243, 161, 63, 1.0)"},fontFamily:{regular:"KHTeka",mono:"KHTekaMono"},fontWeight:{regular:"400",medium:"500"},textSize:{h1:"50px",h2:"44px",h3:"38px",h4:"32px",h5:"26px",h6:"20px",large:"16px",medium:"14px",small:"12px"},typography:{"h1-regular-mono":{lineHeight:"50px",letterSpacing:"-3px"},"h1-regular":{lineHeight:"50px",letterSpacing:"-1px"},"h1-medium":{lineHeight:"50px",letterSpacing:"-0.84px"},"h2-regular-mono":{lineHeight:"44px",letterSpacing:"-2.64px"},"h2-regular":{lineHeight:"44px",letterSpacing:"-0.88px"},"h2-medium":{lineHeight:"44px",letterSpacing:"-0.88px"},"h3-regular-mono":{lineHeight:"38px",letterSpacing:"-2.28px"},"h3-regular":{lineHeight:"38px",letterSpacing:"-0.76px"},"h3-medium":{lineHeight:"38px",letterSpacing:"-0.76px"},"h4-regular-mono":{lineHeight:"32px",letterSpacing:"-1.92px"},"h4-regular":{lineHeight:"32px",letterSpacing:"-0.32px"},"h4-medium":{lineHeight:"32px",letterSpacing:"-0.32px"},"h5-regular-mono":{lineHeight:"26px",letterSpacing:"-1.56px"},"h5-regular":{lineHeight:"26px",letterSpacing:"-0.26px"},"h5-medium":{lineHeight:"26px",letterSpacing:"-0.26px"},"h6-regular-mono":{lineHeight:"20px",letterSpacing:"-1.2px"},"h6-regular":{lineHeight:"20px",letterSpacing:"-0.6px"},"h6-medium":{lineHeight:"20px",letterSpacing:"-0.6px"},"lg-regular-mono":{lineHeight:"16px",letterSpacing:"-0.96px"},"lg-regular":{lineHeight:"18px",letterSpacing:"-0.16px"},"lg-medium":{lineHeight:"18px",letterSpacing:"-0.16px"},"md-regular-mono":{lineHeight:"14px",letterSpacing:"-0.84px"},"md-regular":{lineHeight:"16px",letterSpacing:"-0.14px"},"md-medium":{lineHeight:"16px",letterSpacing:"-0.14px"},"sm-regular-mono":{lineHeight:"12px",letterSpacing:"-0.72px"},"sm-regular":{lineHeight:"14px",letterSpacing:"-0.12px"},"sm-medium":{lineHeight:"14px",letterSpacing:"-0.12px"}},tokens:{core:P.core,theme:P.dark},borderRadius:{1:"4px",2:"8px",10:"10px",3:"12px",4:"16px",6:"24px",5:"20px",8:"32px",16:"64px",20:"80px",32:"128px",64:"256px",128:"512px",round:"9999px"},spacing:{0:"0px","01":"2px",1:"4px",2:"8px",3:"12px",4:"16px",5:"20px",6:"24px",7:"28px",8:"32px",9:"36px",10:"40px",12:"48px",14:"56px",16:"64px",20:"80px",32:"128px",64:"256px"},durations:{xl:"400ms",lg:"200ms",md:"125ms",sm:"75ms"}
1,easings:{"ease-out-power-2":"cubic-bezier(0.23, 0.09, 0.08, 1.13)","ease-out-power-1":"cubic-bezier(0.12, 0.04, 0.2, 1.06)","ease-in-power-2":"cubic-bezier(0.92, -0.13, 0.77, 0.91)","ease-in-power-1":"cubic-bezier(0.88, -0.06, 0.8, 0.96)","ease-inout-power-2":"cubic-bezier(0.77, 0.09, 0.23, 1.13)","ease-inout-power-1":"cubic-bezier(0.88, 0.04, 0.12, 1.06)"}}},94296(Ve,ne,u){"use strict";u.d(ne,{AH:()=>k,CV:()=>j,f:()=>R});var S=u(38324),P=u(65607);const K="--apkt";function m(v){if(!v)return{};const $={};return $["font-family"]=v["--apkt-font-family"]??v["--w3m-font-family"]??"KHTeka",$.accent=v["--apkt-accent"]??v["--w3m-accent"]??"#0988F0",$["color-mix"]=v["--apkt-color-mix"]??v["--w3m-color-mix"]??"#000",$["color-mix-strength"]=v["--apkt-color-mix-strength"]??v["--w3m-color-mix-strength"]??0,$["font-size-master"]=v["--apkt-font-size-master"]??v["--w3m-font-size-master"]??"10px",$["border-radius-master"]=v["--apkt-border-radius-master"]??v["--w3m-border-radius-master"]??"4px",void 0!==v["--apkt-z-index"]?$["z-index"]=v["--apkt-z-index"]:void 0!==v["--w3m-z-index"]&&($["z-index"]=v["--w3m-z-index"]),$}const j={createCSSVariables(v){const $={},x={};return function U(B,p,l=""){for(const[O,L]of Object.entries(B)){const _=l?`${l}-${O}`:O;L&&"object"==typeof L&&Object.keys(L).length?(p[O]={},U(L,p[O],_)):"string"==typeof L&&(p[O]=`${K}-${_}`)}}(v,$),function X(B,p){for(const[l,O]of Object.entries(B))O&&"object"==typeof O?(p[l]={},X(O,p[l])):"string"==typeof O&&(p[l]=`var(${O})`)}($,x),{cssVariables:$,cssVariablesVarPrefix:x}},assignCSSVariables(v,$){const x={};return function U(X,B,p){for(const[l,O]of Object.entries(X)){const L=p?`${p}-${l}`:l,_=B[l];O&&"object"==typeof O?U(O,_,L):"string"==typeof _&&(x[`${K}-${L}`]=_)}}(v,$),x},createRootStyles(v,$){const x={...P.R7,tokens:{...P.R7.tokens,theme:"light"===v?P.LU.light:P.LU.dark}},{cssVariables:U}=j.createCSSVariables(x),X=j.assignCSSVariables(U,x),B=j.generateW3MVariables($),p=j.generateW3MOverrides($),l=j.generateScaledVariables($),O=j.generateBaseVariables(X),L={...X,...O,...B,...p,...l},_=j.applyColorMixToVariables($,L),I={...L,..._};return`:root {${Object.entries(I).map(([H,z])=>`${H}:${z.replace("/[:;{}</>]/g","")};`).join("")}}`},generateW3MVariables(v){if(!v)return{};const $=m(v),x={};return x["--w3m-font-family"]=$["font-family"],x["--w3m-accent"]=$.accent,x["--w3m-color-mix"]=$["color-mix"],x["--w3m-color-mix-strength"]=`${$["color-mix-strength"]}%`,x["--w3m-font-size-master"]=$["font-size-master"],x["--w3m-border-radius-master"]=$["border-radius-master"],x},generateW3MOverrides(v){if(!v)return{};const $=m(v),x={};if(v["--apkt-accent"]||v["--w3m-accent"]){const U=$.accent;x["--apkt-tokens-core-iconAccentPrimary"]=U,x["--apkt-tokens-core-borderAccentPrimary"]=U,x["--apkt-tokens-core-textAccentPrimary"]=U,x["--apkt-tokens-core-backgroundAccentPrimary"]=U}return(v["--apkt-font-family"]||v["--w3m-font-family"])&&(x["--apkt-fontFamily-regular"]=$["font-family"]),void 0!==$["z-index"]&&(x["--apkt-tokens-core-zIndex"]=`${$["z-index"]}`),x},generateScaledVariables(v){if(!v)return{};const $=m(v),x={};if(v["--apkt-font-size-master"]||v["--w3m-font-size-master"]){const U=parseFloat($["font-size-master"].replace("px",""));x["--apkt-textSize-h1"]=5*Number(U)+"px",x["--apkt-textSize-h2"]=4.4*Number(U)+"px",x["--apkt-textSize-h3"]=3.8*Number(U)+"px",x["--apkt-textSize-h4"]=3.2*Number(U)+"px",x["--apkt-textSize-h5"]=2.6*Number(U)+"px",x["--apkt-textSize-h6"]=2*Number(U)+"px",x["--apkt-textSize-large"]=1.6*Number(U)+"px",x["--apkt-textSize-medium"]=1.4*Number(U)+"px",x["--apkt-textSize-small"]=1.2*Number(U)+"px"}if(v["--apkt-border-radius-master"]||v["--w3m-border-radius-master"]){const U=parseFloat($["border-radius-master"].replace("px",""));x["--apkt-borderRadius-1"]=`${Number(U)}px`,x["--apkt-borderRadius-2"]=2*Number(U)+"px",x["--apkt-borderRadius-3"]=3*Number(U)+"px",x["--apkt-borderRadius-4"]=4*Number(U)+"px",x["--apkt-borderRadius-5"]=5*Number(U)+"px",x["--apkt-borderRadius-6"]=6*Number(U)+"px",x["--apkt-borderRadius-8"]=8*Number(U)+"px",x["--apkt-borderRadius-16"]=16*Number(U)+"px",x["--apkt-borderRadius-20"]=20*Number(U)+"px",x["--apkt-borderRadius-32"]=32*Number(U)+"px",x["--apkt-borderRadius-64"]=64*Number(U)+"px",x["--apkt-borderRadius-128"]=128*Number(U)+"px"}return x},generateColorMixCSS(v,$){if(!v?.["--w3m-color-mix"]||!v["--w3m-color-mix-strength"])return"";const x=v["--w3m-color-mix"],U=v["--w3m-color-mix-strength"];if(!U||0===U)return"";const X=Object.keys($||{}).filter(p=>{const l=p.includes("-tokens-core-background")||p.includes("-tokens-core-text")||p.includes("-tokens-core-border")||p.includes("-tokens-core-foreground")||p.includes("-tokens-core-icon")||p.includes("-tokens-theme-background")||p.includes("-tokens-theme-text")||p.includes("-tokens-theme-border")||p.includes("-tokens-theme-foreground")||p.includes("-tokens-theme-icon"),O=p.includes("-borderRadius-")||p.includes("-spacing-")||p.includes("-textSize-")||p.includes("-fontFamily-")||p.includes("-fontWeight-")||p.includes("-typography-")||p.includes("-duration-")||p.includes("-ease-")||p.includes("-path-")||p.includes("-width-")||p.includes("-height-")||p.includes("-visual-size-")||p.includes("-modal-width")||p.includes("-cover");return l&&!O});return 0===X.length?"":` @supports (background: color-mix(in srgb, white 50%, black)) {\n      :root {\n        ${X.map(p=>{const l=$?.[p]||"";return l.includes("color-mix")||l.startsWith("#")||l.startsWith("rgb")?`${p}: color-mix(in srgb, ${x} ${U}%, ${l});`:`${p}: color-mix(in srgb, ${x} ${U}%, var(${p}-base, ${l}));`}).join("")}\n      }\n    }`},generateBaseVariables(v){const $={},x=v["--apkt-tokens-theme-backgroundPrimary"];x&&($["--apkt-tokens-theme-backgroundPrimary-base"]=x);const U=v["--apkt-tokens-core-backgroundAccentPrimary"];return U&&($["--apkt-tokens-core-backgroundAccentPrimary-base"]=U),$},applyColorMixToVariables(v,$){const x={};$?.["--apkt-tokens-theme-backgroundPrimary"]&&(x["--apkt-tokens-theme-backgroundPrimary"]="var(--apkt-tokens-theme-backgroundPrimary-base)"),$?.["--apkt-tokens-core-backgroundAccentPrimary"]&&(x["--apkt-tokens-core-backgroundAccentPrimary"]="var(--apkt-tokens-core-backgroundAccentPrimary-base)");const U=m(v),X=U["color-mix"],B=U["color-mix-strength"];if(!B||0===B)return x;const p=Object.keys($||{}).filter(l=>{const O=l.includes("-tokens-core-background")||l.includes("-tokens-core-text")||l.includes("-tokens-core-border")||l.includes("-tokens-core-foreground")||l.includes("-tokens-core-icon")||l.includes("-tokens-theme-background")||l.includes("-tokens-theme-text")||l.includes("-tokens-theme-border")||l.includes("-tokens-theme-foreground")||l.includes("-tokens-theme-icon")||l.includes("-tokens-theme-overlay"),L=l.includes("-borderRadius-")||l.includes("-spacing-")||l.includes("-textSize-")||l.includes("-fontFamily-")||l.includes("-fontWeight-")||l.includes("-typography-")||l.includes("-duration-")||l.includes("-ease-")||l.includes("-path-")||l.includes("-width-")||l.includes("-height-")||l.includes("-visual-size-")||l.includes("-modal-width")||l.includes("-cover");return O&&!L});return 0===p.length||p.forEach(l=>{const O=$?.[l]||"";l.endsWith("-base")||(x[l]="--apkt-tokens-theme-backgroundPrimary"===l||"--apkt-tokens-core-backgroundAccentPrimary"===l?`color-mix(in srgb, ${X} ${B}%, var(${l}-base))`:O.includes("color-mix")||O.startsWith("#")||O.startsWith("rgb")?`color-mix(in srgb, ${X} ${B}%, ${O})`:`color-mix(in srgb, ${X} ${B}%, var(${l}-base, ${O}))`)}),x}},{cssVariablesVarPrefix:R}=j.createCSSVariables(P.R7);function k(v,...$){return(0,S.AH)(v,...$.map(x=>(0,S.iz)("function"==typeof x?x(R):x)))}},76428(Ve,ne,u){"use strict";u.d(ne,{JX:()=>U,RF:()=>x,W5:()=>p,ds:()=>X,fD:()=>l});var S=u(38324),P=u(94296);let K,m,j,R,k;const v={"KHTeka-500-woff2":"https://fonts.reown.com/KHTeka-Medium.woff2","KHTeka-400-woff2":"https://fonts.reown.com/KHTeka-Regular.woff2","KHTeka-300-woff2":"https://fonts.reown.com/KHTeka-Light.woff2","KHTekaMono-400-woff2":"https://fonts.reown.com/KHTekaMono-Regular.woff2","KHTeka-500-woff":"https://fonts.reown.com/KHTeka-Light.woff","KHTeka-400-woff":"https://fonts.reown.com/KHTeka-Regular.woff","KHTeka-300-woff":"https://fonts.reown.com/KHTeka-Light.woff","KHTekaMono-400-woff":"https://fonts.reown.com/KHTekaMono-Regular.woff"};function $(O,L="dark"){K&&document.head.removeChild(K),K=document.createElement("style"),K.textContent=P.CV.createRootStyles(L,O),document.head.appendChild(K)}function x(O,L="dark"){if(k=O,m=document.createElement("style"),j=document.createElement("style"),R=document.createElement("style"),m.textContent=B(O).core.cssText,j.textContent=B(O).dark.cssText,R.textContent=B(O).light.cssText,document.head.appendChild(m),document.head.appendChild(j),document.head.appendChild(R),$(O,L),U(L),!O?.["--apkt-font-family"]&&!O?.["--w3m-font-family"])for(const[I,D]of Object.entries(v)){const H=document.createElement("link");H.rel="preload",H.href=D,H.as="font",H.type=I.includes("woff2")?"font/woff2":"font/woff",H.crossOrigin="anonymous",document.head.appendChild(H
1)}U(L)}function U(O="dark"){j&&R&&K&&("light"===O?($(k,O),j.removeAttribute("media"),R.media="enabled"):($(k,O),R.removeAttribute("media"),j.media="enabled"))}function X(O){if(k=O,m&&j&&R){m.textContent=B(O).core.cssText,j.textContent=B(O).dark.cssText,R.textContent=B(O).light.cssText;const L=O?.["--apkt-font-family"]||O?.["--w3m-font-family"];L&&(m.textContent=m.textContent?.replace("font-family: KHTeka",`font-family: ${L}`),j.textContent=j.textContent?.replace("font-family: KHTeka",`font-family: ${L}`),R.textContent=R.textContent?.replace("font-family: KHTeka",`font-family: ${L}`))}K&&$(O,"enabled"===R?.media?"light":"dark")}function B(O){return{core:S.AH`
2      ${O?.["--apkt-font-family"]||O?.["--w3m-font-family"]?S.AH``:S.AH`
3            @font-face {
4              font-family: 'KHTeka';
5              src:
6                url(${(0,S.iz)(v["KHTeka-400-woff2"])}) format('woff2'),
7                url(${(0,S.iz)(v["KHTeka-400-woff"])}) format('woff');
8              font-weight: 400;
9              font-style: normal;
10              font-display: swap;
11            }
12
13            @font-face {
14              font-family: 'KHTeka';
15              src:
16                url(${(0,S.iz)(v["KHTeka-300-woff2"])}) format('woff2'),
17                url(${(0,S.iz)(v["KHTeka-300-woff"])}) format('woff');
18              font-weight: 300;
19              font-style: normal;
20            }
21
22            @font-face {
23              font-family: 'KHTekaMono';
24              src:
25                url(${(0,S.iz)(v["KHTekaMono-400-woff2"])}) format('woff2'),
26                url(${(0,S.iz)(v["KHTekaMono-400-woff"])}) format('woff');
27              font-weight: 400;
28              font-style: normal;
29            }
30
31            @font-face {
32              font-family: 'KHTeka';
33              src:
34                url(${(0,S.iz)(v["KHTeka-400-woff2"])}) format('woff2'),
35                url(${(0,S.iz)(v["KHTeka-400-woff"])}) format('woff');
36              font-weight: 400;
37              font-style: normal;
38            }
39          `}
40
41      @keyframes w3m-shake {
42        0% {
43          transform: scale(1) rotate(0deg);
44        }
45        20% {
46          transform: scale(1) rotate(-1deg);
47        }
48        40% {
49          transform: scale(1) rotate(1.5deg);
50        }
51        60% {
52          transform: scale(1) rotate(-1.5deg);
53        }
54        80% {
55          transform: scale(1) rotate(1deg);
56        }
57        100% {
58          transform: scale(1) rotate(0deg);
59        }
60      }
61      @keyframes w3m-iframe-fade-out {
62        0% {
63          opacity: 1;
64        }
65        100% {
66          opacity: 0;
67        }
68      }
69      @keyframes w3m-iframe-zoom-in {
70        0% {
71          transform: translateY(50px);
72          opacity: 0;
73        }
74        100% {
75          transform: translateY(0px);
76          opacity: 1;
77        }
78      }
79      @keyframes w3m-iframe-zoom-in-mobile {
80        0% {
81          transform: scale(0.95);
82          opacity: 0;
83        }
84        100% {
85          transform: scale(1);
86          opacity: 1;
87        }
88      }
89      :root {
90        --apkt-modal-width: 370px;
91
92        --apkt-visual-size-inherit: inherit;
93        --apkt-visual-size-sm: 40px;
94        --apkt-visual-size-md: 55px;
95        --apkt-visual-size-lg: 80px;
96
97        --apkt-path-network-sm: path(
98          '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'
99        );
100
101        --apkt-path-network-md: path(
102          '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'
103        );
104
105        --apkt-path-network-lg: path(
106          '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'
107        );
108
109        --apkt-width-network-sm: 36px;
110        --apkt-width-network-md: 48px;
111        --apkt-width-network-lg: 86px;
112
113        --apkt-duration-dynamic: 0ms;
114        --apkt-height-network-sm: 40px;
115        --apkt-height-network-md: 54px;
116        --apkt-height-network-lg: 96px;
117      }
118    `,dark:S.AH`
119      :root {
120      }
121    `,light:S.AH`
122      :root {
123      }
124    `}}const p=S.AH`
125  div,
126  span,
127  iframe,
128  a,
129  img,
130  form,
131  button,
132  label,
133  *::after,
134  *::before {
135    margin: 0;
136    padding: 0;
137    box-sizing: border-box;
138    font-style: normal;
139    text-rendering: optimizeSpeed;
140    -webkit-font-smoothing: antialiased;
141    -moz-osx-font-smoothing: grayscale;
142    -webkit-tap-highlight-color: transparent;
143    backface-visibility: hidden;
144  }
145
146  :host {
147    font-family: var(--apkt-fontFamily-regular);
148  }
149`,l=S.AH`
150  button,
151  a {
152    cursor: pointer;
153    display: flex;
154    justify-content: center;
155    align-items: center;
156    position: relative;
157
158    will-change: background-color, color, border, box-shadow, width, height, transform, opacity;
159    outline: none;
160    border: none;
161    text-decoration: none;
162    transition:
163      background-color var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2),
164      color var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2),
165      border var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2),
166      box-shadow var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2),
167      width var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2),
168      height var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2),
169      transform var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2),
170      opacity var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2),
171      scale var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2),
172      border-radius var(--apkt-durations-lg) var(--apkt-easings-ease-out-power-2);
173    will-change:
174      background-color, color, border, box-shadow, width, height, transform, opacity, scale,
175      border-radius;
176  }
177
178  a:active:not([disabled]),
179  button:active:not([disabled]) {
180    scale: 0.975;
181    transform-origin: center;
182  }
183
184  button:disabled {
185    cursor: default;
186  }
187
188  input {
189    border: none;
190    outline: none;
191    appearance: none;
192  }
193`},94159(Ve,ne,u){"use strict";u.d(ne,{Z:()=>P});const S=".",P={getSpacingStyles:(K,m)=>Array.isArray(K)?K[m]?`var(--apkt-spacing-${K[m]})`:void 0:"string"==typeof K?`var(--apkt-spacing-${K})`:void 0,getFormattedDate:K=>new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric"}).format(K),formatCurrency(K=0,m={}){const j=Number(K);return isNaN(j)?"$0.00":new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:2,maximumFractionDigits:2,...m}).format(j)},getHostName(K){try{return new URL(K).hostname}catch{return""}},getTruncateString:({string:K,charsStart:m,charsEnd:j,truncate:R})=>K.length<=m+j?K:"end"===R?`${K.substring(0,m)}...`:"start"===R?`...${K.substring(K.length-j)}`:`${K.substring(0,Math.floor(m))}...${K.substring(K.length-Math.floor(j))}`,generateAvatarColors(K){const j=K.toLowerCase().replace(/^0x/iu,"").replace(/[^a-f0-9]/gu,"").substring(0,6).padEnd(6,"0"),R=this.hexToRgb(j),k=getComputedStyle(document.documentElement).getPropertyValue("--w3m-border-radius-master"),$=100-3*Number(k?.replace("px","")),x=`${$}% ${$}% at 65% 40%`,U=[];for(let X=0;X<5;X+=1){const B=this.tintColor(R,.15*X);U.push(`rgb(${B[0]}, ${B[1]}, ${B[2]})`)}return`\n    --local-color-1: ${U[0]};\n    --local-color-2: ${U[1]};\n    --local-color-3: ${U[2]};\n    --local-color-4: ${U[3]};\n    --local-color-5: ${U[4]};\n    --local-radial-circle: ${x}\n   `},hexToRgb(K){const m=parseInt(K,16);return[m>>16&255,m>>8&255,255&m]},tintColor(K,m){const[j,R,k]=K;return[Math.round(j+(255-j)*m),Math.round(R+(255-R)*m),Math.round(k+(255-k)*m)]},isNumber:K=>/^[0-9]+$/u.test(K),getColorTheme:K=>K||(typeof window<"u"&&window.matchMedia&&"function"==typeof window.matchMedia?window.matchMedia("(prefers-color-scheme: dark)")?.matches?"dark":"light":"dark"),splitBalance(K){const m=K.split(".");return 2===m.length?[m[0],m[1]]:["0","00"]},roundNumber:(K,m,j)=>K.toString().length>=m?Number(K).toFixed(j):K,cssDurationToNumber:K=>K.endsWith("s")?1e3*Number(K.replace("s","")):K.endsWith("ms")?Number(K.replace("ms","")):0,maskInput({value:K,decimals:m,integers:j}){if((K=K.replace(",","."))===S)return`0${S}`;const[R="",k]=K.split(S).map(B=>B.replace(/[^0-9]/gu,"")),v=j?R.substring(0,j):R,$=2===v.length?String(Number(v)):v,x="number"==typeof m?k?.substring(0,m):k;return("string"==typeof x&&("number"!=typeof m||m>0)?[$,x].join(S):$)??""},capitalize:K=>K?K.charAt(0).toUpperCase()+K.slice(1):""}},61235(Ve,ne,u){"use strict";function K(m){return function(R){return"function"==typeof R?function P(m,j){return customElements.get(m)||customElements.define(m,j),j}(m,R):function S(m,j){const{kind:R,elements:k}=j;return{kind:R,elements:k,finisher(v){customElements.get(m)||customElements.define(m,v)}}}(m,R)}}u.d(ne,{E:()=>K})},65869(Ve,ne,u){"use strict";u.d(ne,{R:()=>x});var S=u(6439),P=u(48253),K=u(30193),m=u(17895),j=u(73387),R=u(60592);function v(U,X){const B=new URL("https://rpc.walletconnect.org/v1/");return B.searchParams.set("chainId",U),B.searchParams.set("projectId",X),B.toString()}const $=["near:mainnet","solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp","eip155:1101","eip155:
19356","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","eip155:80094","eip155:80069","eip155:560048","eip155:31","eip155:2818","eip155:57054","eip155:911867","eip155:534351","eip155:1112","eip155:534352","eip155:1111","eip155:146","eip155:130","eip155:1284","eip155:30","eip155:2810","eip155:55931","bip122:000000000019d6689c085ae165831e93","bip122:000000000933ea01ad0ee984209779ba","tron:0x2b6653dc","tron:0xcd8690dc"],x={extendRpcUrlWithProjectId(U,X){let B=!1;try{B="rpc.walletconnect.org"===new URL(U).host}catch{B=!1}if(B){const p=new URL(U);return p.searchParams.has("projectId")||p.searchParams.set("projectId",X),p.toString()}return U},isCaipNetwork:U=>"chainNamespace"in U&&"caipNetworkId"in U,getChainNamespace(U){return this.isCaipNetwork(U)?U.chainNamespace:K.o.CHAIN.EVM},getCaipNetworkId(U){return this.isCaipNetwork(U)?U.caipNetworkId:`${K.o.CHAIN.EVM}:${U.id}`},getDefaultRpcUrl(U,X,B){const p=U.rpcUrls?.default?.http?.[0];return $.includes(X)?v(X,B):p||""},extendCaipNetwork(U,{customNetworkImageUrls:X,projectId:B,customRpcUrls:p}){const l=this.getChainNamespace(U),O=this.getCaipNetworkId(U),L=U.rpcUrls?.default?.http?.[0],_=this.getDefaultRpcUrl(U,O,B),I=U?.rpcUrls?.chainDefault?.http?.[0]||L,D=p?.[O]?.map(T=>T.url)||[],H=[...D,..._?[_]:[]],z=[...D];return I&&!z.includes(I)&&z.push(I),{...U,chainNamespace:l,caipNetworkId:O,assets:{imageId:R.L.NetworkImageIds[U.id],imageUrl:X?.[U.id]},rpcUrls:{...U.rpcUrls,default:{http:H},chainDefault:{http:z}}}},extendCaipNetworks:(U,{customNetworkImageUrls:X,projectId:B,customRpcUrls:p})=>U.map(l=>x.extendCaipNetwork(l,{customNetworkImageUrls:X,customRpcUrls:p,projectId:B})),getViemTransport(U,X,B){const p=[];return B?.forEach(l=>{p.push((0,P.L)(l.url,l.config))}),$.includes(U.caipNetworkId)&&p.push((0,P.L)(v(U.caipNetworkId,X),{fetchOptions:{headers:{"Content-Type":"text/plain"}}})),U?.rpcUrls?.default?.http?.forEach(l=>{p.push((0,P.L)(l))}),(0,S.Np)(p)},extendWagmiTransports(U,X,B){if($.includes(U.caipNetworkId)){const p=this.getDefaultRpcUrl(U,U.caipNetworkId,X);return(0,S.Np)([B,(0,P.L)(p)])}return B},getUnsupportedNetwork:U=>({id:U.split(":")[1],caipNetworkId:U,name:K.o.UNSUPPORTED_NETWORK_NAME,chainNamespace:U.split(":")[0],nativeCurrency:{name:"",decimals:0,symbol:""},rpcUrls:{default:{http:[]}}}),getCaipNetworkFromStorage(U){const X=j.i.getActiveCaipNetworkId(),B=m.W.getAllRequestedCaipNetworks(),p=Array.from(m.W.state.chains?.keys()||[]),l=X?.split(":")[0],O=!!l&&p.includes(l),L=B?.find(I=>I.caipNetworkId===X);return O&&!L&&X?this.getUnsupportedNetwork(X):L||U||B?.[0]}}},82905(Ve,ne,u){"use strict";u.d(ne,{o:()=>P});const P={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",OKX_CONNECTOR_NAME:"OKX Wallet",BINANCE_CONNECTOR_NAME:"Binance Wallet",EIP155:u(30193).o.CHAIN.EVM,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:"AUTH",getSDKVersionWarningMessage:(K,m)=>`\n     @@@@@@@           @@@@@@@@@@@@@@@@@@      \n   @@@@@@@@@@@      @@@@@@@@@@@@@@@@@@@@@@@@   \n  @@@@@@@@@@@@@    @@@@@@@@@@@@@@@@@@@@@@@@@@  \n @@@@@@@@@@@@@@@  @@@@@@@@@@@@@@@@@@@@@@@@@@@  \n @@@@@@@@@@@@@@@  @@@@@@@@@@@@@@   @@@@@@@@@@@ \n @@@@@@@@@@@@@@@  @@@@@@@@@@@@@   @@@@@@@@@@@@ \n @@@@@@@@@@@@@@@  @@@@@@@@@@@@@  @@@@@@@@@@@@@\n @@@@@@@@@@@@@@@  @@@@@@@@@@@@   @@@@@@@@@@@@@    \n @@@@@@   @@@@@@  @@@@@@@@@@@   @@@@@@@@@@@@@@    \n @@@@@@   @@@@@@  @@@@@@@@@@@  @@@@@@@@@@@@@@@ \n @@@@@@@@@@@@@@@  @@@@@@@@@@   @@@@@@@@@@@@@@@ \n @@@@@@@@@@@@@@@  @@@@@@@@@@@@@@@@@@@@@@@@@@@  \n  @@@@@@@@@@@@@    @@@@@@@@@@@@@@@@@@@@@@@@@@  \n   @@@@@@@@@@@      @@@@@@@@@@@@@@@@@@@@@@@@   \n      @@@@@            @@@@@@@@@@@@@@@@@@  \n      \nAppKit SDK ver
193sion ${K} is outdated. Latest version is ${m}. Please update to the latest version for bug fixes and new features.\n            \nChangelog: https://github.com/reown-com/appkit/releases\nNPM Registry: https://www.npmjs.com/package/@reown/appkit`}},6542(Ve,ne,u){"use strict";u.d(ne,{R:()=>m});var S=u(99983),P=u(47040);const m={EmbeddedWalletAbortController:new AbortController,UniversalProviderErrors:{UNAUTHORIZED_DOMAIN_NOT_ALLOWED:{message:"Unauthorized: origin not allowed",alertErrorKey:"ORIGIN_NOT_ALLOWED"},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:{code:"APKT001",displayMessage:"Network Not Found",debugMessage:"The specified network is not recognized. Please ensure it is included in the `networks` array of your `createAppKit` configuration."},ORIGIN_NOT_ALLOWED:{code:"APKT002",displayMessage:"Invalid App Configuration",debugMessage:()=>`The origin ${(0,S.IP)()?window.origin:"unknown"} is not in your allow list. Please update your allowed domains at https://dashboard.reown.com. [PID: ${P.H.state.projectId}]`},IFRAME_LOAD_FAILED:{code:"APKT003",displayMessage:"Network Error: Wallet Load Failed",debugMessage:()=>"Failed to load the embedded wallet. This may be due to network issues or server downtime. Please check your network connection and try again shortly. Contact support if the issue persists."},IFRAME_REQUEST_TIMEOUT:{code:"APKT004",displayMessage:"Wallet Request Timeout",debugMessage:()=>"The request to the embedded wallet timed out. Please check your network connection and try again shortly. Contact support if the issue persists."},UNVERIFIED_DOMAIN:{code:"APKT005",displayMessage:"Unverified Domain",debugMessage:()=>"Embedded wallet load failed. Ensure your domain is verified in https://dashboard.reown.com."},JWT_TOKEN_NOT_VALID:{code:"APKT006",displayMessage:"Session Expired",debugMessage:"Your session is invalid or expired. Please check your system\u2019s date and time settings, then reconnect."},INVALID_PROJECT_ID:{code:"APKT007",displayMessage:"Invalid Project ID",debugMessage:"The specified project ID is invali
193d. Please visit https://dashboard.reown.com to obtain a valid project ID."},PROJECT_ID_NOT_CONFIGURED:{code:"APKT008",displayMessage:"Project ID Missing",debugMessage:"No project ID is configured. You can create and configure a project ID at https://dashboard.reown.com."},SERVER_ERROR_APP_CONFIGURATION:{code:"APKT009",displayMessage:"Server Error",debugMessage:j=>`Unable to fetch App Configuration. ${j}. Please check your network connection and try again shortly. Contact support if the issue persists.`},RATE_LIMITED_APP_CONFIGURATION:{code:"APKT010",displayMessage:"Rate Limited",debugMessage:"You have been rate limited while retrieving App Configuration. Please wait a few minutes and try again. Contact support if the issue persists."}},ALERT_WARNINGS:{LOCAL_CONFIGURATION_IGNORED:{debugMessage:j=>`[Reown Config Notice] ${j}`},INACTIVE_NAMESPACE_NOT_CONNECTED:{code:"APKTW001",displayMessage:"Inactive Namespace Not Connected",debugMessage:(j,R)=>`An error occurred while connecting an inactive namespace ${j}: "${R}"`},INVALID_EMAIL:{code:"APKTW002",displayMessage:"Invalid Email Address",debugMessage:"Please enter a valid email address"}}}},32129(Ve,ne,u){"use strict";u.d(ne,{y:()=>k});var S=u(10467),P=u(30193),K=u(17895),m=u(27881),j=u(73387),R=u(82905);const k={getCaipTokens(v){if(!v)return;const $={};return Object.entries(v).forEach(([x,U])=>{$[`${R.o.EIP155}:${x}`]=U}),$},isLowerCaseMatch:(v,$)=>v?.toLowerCase()===$?.toLowerCase(),getActiveNamespaceConnectedToAuth(){const v=K.W.state.activeChain;return P.o.AUTH_CONNECTOR_SUPPORTED_CHAINS.find($=>m.a.getConnectorId($)===P.o.CONNECTOR_ID.AUTH&&$===v)},withRetry({conditionFn:v,intervalMs:$,maxRetries:x}){let U=0;return new Promise(X=>{function B(){return p.apply(this,arguments)}function p(){return(p=(0,S.A)(function*(){return U+=1,(yield v())?X(!0):U>=x?X(!1):(setTimeout(B,$),null)})).apply(this,arguments)}B()})},userChainIdToChainNamespace(v){if("number"==typeof v)return P.o.CHAIN.EVM;const[$]=v.split(":");return $},getOtherAuthNamespaces:v=>v?P.o.AUTH_CONNECTOR_SUPPORTED_CHAINS.filter(U=>U!==v):[],getConnectorStorageInfo(v,$){const U=j.i.getConnections()[$]??[];return{hasDisconnected:j.i.isConnectorDisconnected(v,$),hasConnected:U.some(X=>k.isLowerCaseMatch(X.connectorId,v))}}}},60592(Ve,ne,u){"use strict";u.d(ne,{L:()=>K});var S=u(30193),P=u(82905);const K={ConnectorExplorerIds:{[S.o.CONNECTOR_ID.COINBASE]:"d0ca99ff52b99abc48743dad0f7fc891e041be73574f7fac4afe5d4bb83845c8",[S.o.CONNECTOR_ID.COINBASE_SDK]:"d0ca99ff52b99abc48743dad0f7fc891e041be73574f7fac4afe5d4bb83845c8",[S.o.CONNECTOR_ID.BASE_ACCOUNT]:"fd20dc426fb37566d803205b19bbc1d4096b248ac04548e3cfb6b3a38bd033aa",[S.o.CONNECTOR_ID.SAFE]:"225affb176778569276e484e1b92637ad061b01e13a048b35a9d280c3b58970f",[S.o.CONNECTOR_ID.LEDGER]:"19177a98252e07ddfc9af2083ba8e07ef627cb6103467ffebb3f8f4205fd7927",[S.o.CONNECTOR_ID.OKX]:"971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709",[P.o.METMASK_CONNECTOR_NAME]:"c57ca95b47569778a828d19178114f4db188b89b763c899ba0be274e97267d96",[P.o.TRUST_CONNECTOR_NAME]:"4622a2b2d6af1c9844944291e5e7351a6aa24cd7b23099efac1b2fd875da31a0",[P.o.SOLFLARE_CONNECTOR_NAME]:"1ca0bdd4747578705b1939af023d120677c64fe6ca76add81fda36e350605e79",[P.o.PHANTOM_CONNECTOR_NAME]:"a797aa35c0fadbfc1a53e7f675162ed5226968b44a19ee3d24385c64d1d3c393",[P.o.COIN98_CONNECTOR_NAME]:"2a3c89040ac3b723a1972a33a125b1db11e258a6975d3a61252cd64e6ea5ea01",[P.o.MAGIC_EDEN_CONNECTOR_NAME]:"8b830a2b724a9c3fbab63af6f55ed29c9dfa8a55e732dc88c80a196a2ba136c6",[P.o.BACKPACK_CONNECTOR_NAME]:"2bd8c14e035c2d48f184aaa168559e86b0e3433228d3c4075900a221785019b0",[P.o.BITGET_CONNECTOR_NAME]:"38f5d18bd8522c244bdd70cb4a68e0e718865155811c043f052fb9f1c51de662",[P.o.FRONTIER_CONNECTOR_NAME]:"85db431492aa2e8672e93f4ea7acf10c88b97b867b0d373107af63dc4880f041",[P.o.XVERSE_CONNECTOR_NAME]:"2a87d74ae02e10bdd1f51f7ce6c4e1cc53cd5f2c0b6b5ad0d7b3007d2b13de7b",[P.o.LEATHER_CONNECTOR_NAME]:"483afe1df1df63daf313109971ff3ef8356ddf1cc4e45877d205eee0b7893a13",[P.o.OKX_CONNECTOR_NAME]:"971e689d0a5be527bac79629b4ee9b925e82208e5168b733496a09c0faed0709",[P.o.BINANCE_CONNECTOR_NAME]:"2fafea35bb471d22889ccb49c08d99dd0a18a37982602c33f696a5723934ba25"},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",143:"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","00000008819873e925422c1ff0f99f7c":"b3406e4a-bbfc-44fb-e3a6-89673c78b700","-239":"20f673c0-095e-49b2-07cf-eb5049dcf600","-3":"20f673c0-095e-49b2-07cf-eb5049dcf600","0x2b6653dc":"3502bb86-cc4e-420f-a387-59ea63a28b00","0x94a9059e":"3502bb86-cc4e-420f-a387-59ea63a28b00","0xcd8690dc":"3502bb86-cc4e-420f-a387-59ea63a28b00"},ConnectorImageIds:{[S.o.CONNECTOR_ID.COINBASE]:"0c2840c3-5b04-4c44-9661-fbd4b49e1800",[S.o.CONNECTOR_ID.COINBASE_SDK]:"0c2840c3-5b04-4c44-9661-fbd4b49e1800",[S.o.CONNECTOR_ID.BASE_ACCOUNT]:"bba2c8be-7fd1-463e-42b1-796ecb0ad200",[S.o.CONNECTOR_ID.SAFE]:"461db637-8616-43ce-035a-d89b8a1d5800",[S.o.CONNECTOR_ID.LEDGER]:"54a1aa77-d202-4f8d-0fb2-5d2bb6db0300",[S.o.CONNECTOR_ID.WALLET_CONNECT]:"ef1a1fcf-7fe8-4d69-bd6d-fda1345b4400",[S.o.CONNECTOR_ID.INJECTED]:"07ba87ed-43aa-4adf-454
1930-9e6a2b9cae00"},ConnectorNamesMap:{[S.o.CONNECTOR_ID.INJECTED]:"Browser Wallet",[S.o.CONNECTOR_ID.WALLET_CONNECT]:"WalletConnect",[S.o.CONNECTOR_ID.COINBASE]:"Coinbase",[S.o.CONNECTOR_ID.COINBASE_SDK]:"Coinbase",[S.o.CONNECTOR_ID.BASE_ACCOUNT]:"Base Account",[S.o.CONNECTOR_ID.LEDGER]:"Ledger",[S.o.CONNECTOR_ID.SAFE]:"Safe"},ConnectorTypesMap:{[S.o.CONNECTOR_ID.INJECTED]:"INJECTED",[S.o.CONNECTOR_ID.WALLET_CONNECT]:"WALLET_CONNECT",[S.o.CONNECTOR_ID.EIP6963]:"ANNOUNCED",[S.o.CONNECTOR_ID.AUTH]:"AUTH",[S.o.CONNECTOR_ID.COINBASE]:"EXTERNAL",[S.o.CONNECTOR_ID.COINBASE_SDK]:"EXTERNAL",[S.o.CONNECTOR_ID.BASE_ACCOUNT]:"EXTERNAL",[P.o.CONNECTOR_TYPE_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]}},69245(Ve,ne,u){"use strict";u.d(ne,{OH:()=>K,Vl:()=>R,gS:()=>m,hy:()=>P,s1:()=>j});const P=(typeof process<"u"&&typeof process.env<"u"?process.env.NEXT_PUBLIC_SECURE_SITE_SDK_URL:void 0)||"https://secure.walletconnect.org/sdk",K=(typeof process<"u"&&typeof process.env<"u"?process.env.NEXT_PUBLIC_DEFAULT_LOG_LEVEL:void 0)||"error",m=(typeof process<"u"&&typeof process.env<"u"?process.env.NEXT_PUBLIC_SECURE_SITE_SDK_VERSION:void 0)||"4",j={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",APP_RPC_ABORT:"@w3m-app/RPC_ABORT",FRAME_SWITCH_NETWORK_ERROR:"@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",FRAME_RPC_ABORT_SUCCESS:"@w3m-frame/RPC_ABORT_SUCCESS",FRAME_RPC_ABORT_ERROR:"@w3m-frame/RPC_ABORT_ERROR",RPC_RESPONSE_TYPE_ER
193ROR:"RPC_RESPONSE_ERROR",RPC_RESPONSE_TYPE_TX:"RPC_RESPONSE_TRANSACTION_HASH",RPC_RESPONSE_TYPE_OBJECT:"RPC_RESPONSE_OBJECT"},R={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",RPC_METHOD_NOT_ALLOWED_UI_MESSAGE:"Action not allowed",ACCOUNT_TYPES:{EOA:"eoa",SMART_ACCOUNT:"smartAccount"}}},79769(Ve,ne,u){"use strict";u.d(ne,{Q:()=>j});const S_transactionHash=/^0x(?:[A-Fa-f0-9]{64})$/u,S_signedMessage=/^0x(?:[a-fA-F0-9]{62,})$/u;var P=u(69245),K=u(66689);const m=3e4,j={checkIfAllowedToTriggerEmail(){const R=K.o.get(P.s1.LAST_EMAIL_LOGIN_TIME);if(R){const k=Date.now()-Number(R);if(k<m){const v=Math.ceil((m-k)/1e3);throw new Error(`Please try again after ${v} seconds`)}}},getTimeToNextEmailLogin(){const R=K.o.get(P.s1.LAST_EMAIL_LOGIN_TIME);if(R){const k=Date.now()-Number(R);if(k<m)return Math.ceil((m-k)/1e3)}return 0},checkIfRequestExists:R=>P.Vl.NOT_SAFE_RPC_METHODS.includes(R.method)||P.Vl.SAFE_RPC_METHODS.includes(R.method),getResponseType:R=>"string"==typeof R&&(R?.match(S_transactionHash)||R?.match(S_signedMessage))?P.s1.RPC_RESPONSE_TYPE_TX:P.s1.RPC_RESPONSE_TYPE_OBJECT,checkIfRequestIsSafe:R=>P.Vl.SAFE_RPC_METHODS.includes(R.method),isClient:typeof window<"u"}},40641(Ve,ne,u){"use strict";u.d(ne,{Y:()=>hu});var R,q,S=u(10467),P=u(68095),K=u(30193),m=u(69245),j=u(79769);(q=R||(R={})).assertEqual=ee=>ee,q.assertIs=function V(ee){},q.assertNever=function f(ee){throw new Error},q.arrayToEnum=ee=>{const de={};for(const fe of ee)de[fe]=fe;return de},q.getValidEnumValues=ee=>{const de=q.objectKeys(ee).filter(Ie=>"number"!=typeof ee[ee[Ie]]),fe={};for(const Ie of de)fe[Ie]=ee[Ie];return q.objectValues(fe)},q.objectValues=ee=>q.objectKeys(ee).map(function(de){return ee[de]}),q.objectKeys="function"==typeof Object.keys?ee=>Object.keys(ee):ee=>{const de=[];for(const fe in ee)Object.prototype.hasOwnProperty.call(ee,fe)&&de.push(fe);return de},q.find=(ee,de)=>{for(const fe of ee)if(de(fe))return fe},q.isInteger="function"==typeof Number.isInteger?ee=>Number.isInteger(ee):ee=>"number"==typeof ee&&isFinite(ee)&&Math.floor(ee)===ee,q.joinValues=function G(ee,de=" | "){return ee.map(fe=>"string"==typeof fe?`'${fe}'`:fe).join(de)},q.jsonStringifyReplacer=(ee,de)=>"bigint"==typeof de?de.toString():de;var k=function(q){return q.mergeShapes=(V,f)=>({...V,...f}),q}(k||{});const v=R.arrayToEnum(["string","nan","number","integer","float","boolean","date","bigint","symbol","function","undefined","null","array","object","unknown","promise","void","never","map","set"]),$=q=>{switch(typeof q){case"undefined":return v.undefined;case"string":return v.string;case"number":return isNaN(q)?v.nan:v.number;case"boolean":return v.boolean;case"function":return v.function;case"bigint":return v.bigint;case"symbol":return v.symbol;case"object":return Array.isArray(q)?v.array:null===q?v.null:q.then&&"function"==typeof q.then&&q.catch&&"function"==typeof q.catch?v.promise:typeof Map<"u"&&q instanceof Map?v.map:typeof Set<"u"&&q instanceof Set?v.set:typeof Date<"u"&&q instanceof Date?v.date:v.object;default:return v.unknown}}
193,x=R.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"]);let X=(()=>{class q extends Error{constructor(f){super(),this.issues=[],this.addIssue=ee=>{this.issues=[...this.issues,ee]},this.addIssues=(ee=[])=>{this.issues=[...this.issues,...ee]};const G=new.target.prototype;Object.setPrototypeOf?Object.setPrototypeOf(this,G):this.__proto__=G,this.name="ZodError",this.issues=f}get errors(){return this.issues}format(f){const G=f||function(fe){return fe.message},ee={_errors:[]},de=fe=>{for(const Ie of fe.issues)if("invalid_union"===Ie.code)Ie.unionErrors.map(de);else if("invalid_return_type"===Ie.code)de(Ie.returnTypeError);else if("invalid_arguments"===Ie.code)de(Ie.argumentsError);else if(0===Ie.path.length)ee._errors.push(G(Ie));else{let Ge=ee,dt=0;for(;dt<Ie.path.length;){const _t=Ie.path[dt];dt===Ie.path.length-1?(Ge[_t]=Ge[_t]||{_errors:[]},Ge[_t]._errors.push(G(Ie))):Ge[_t]=Ge[_t]||{_errors:[]},Ge=Ge[_t],dt++}}};return de(this),ee}toString(){return this.message}get message(){return JSON.stringify(this.issues,R.jsonStringifyReplacer,2)}get isEmpty(){return 0===this.issues.length}flatten(f=G=>G.message){const G={},ee=[];for(const de of this.issues)de.path.length>0?(G[de.path[0]]=G[de.path[0]]||[],G[de.path[0]].push(f(de))):ee.push(f(de));return{formErrors:ee,fieldErrors:G}}get formErrors(){return this.flatten()}}return q.create=V=>new q(V),q})();const B=(q,V)=>{let f;switch(q.code){case x.invalid_type:f=q.received===v.undefined?"Required":`Expected ${q.expected}, received ${q.received}`;break;case x.invalid_literal:f=`Invalid literal value, expected ${JSON.stringify(q.expected,R.jsonStringifyReplacer)}`;break;case x.unrecognized_keys:f=`Unrecognized key(s) in object: ${R.joinValues(q.keys,", ")}`;break;case x.invalid_union:f="Invalid input";break;case x.invalid_union_discriminator:f=`Invalid discriminator value. Expected ${R.joinValues(q.options)}`;break;case x.invalid_enum_value:f=`Invalid enum value. Expected ${R.joinValues(q.options)}, received '${q.received}'`;break;case x.invalid_arguments:f="Invalid function arguments";break;case x.invalid_return_type:f="Invalid function return type";break;case x.invalid_date:f="Invalid date";break;case x.invalid_string:"object"==typeof q.validation?"includes"in q.validation?(f=`Invalid input: must include "${q.validation.includes}"`,"number"==typeof q.validation.position&&(f=`${f} at one or more positions greater than or equal to ${q.validation.position}`)):"startsWith"in q.validation?f=`Invalid input: must start with "${q.validation.startsWith}"`:"endsWith"in q.validation?f=`Invalid input: must end with "${q.validation.endsWith}"`:R.assertNever(q.validation):f="regex"!==q.validation?`Invalid ${q.validation}`:"Invalid";break;case x.too_small:f="array"===q.type?`Array must contain ${q.exact?"exactly":q.inclusive?"at least":"more than"} ${q.minimum} element(s)`:"string"===q.type?`String must contain ${q.exact?"exactly":q.inclusive?"at least":"over"} ${q.minimum} character(s)`:"number"===q.type?`Number must be ${q.exact?"exactly equal to ":q.inclusive?"greater than or equal to ":"greater than "}${q.minimum}`:"date"===q.type?`Date must be ${q.exact?"exactly equal to ":q.inclusive?"greater than or equal to ":"greater than "}${new Date(Number(q.minimum))}`:"Invalid input";break;case x.too_big:f="array"===q.type?`Array must contain ${q.exact?"exactly":q.inclusive?"at most":"less than"} ${q.maximum} element(s)`:"string"===q.type?`String must contain ${q.exact?"exactly":q.inclusive?"at most":"under"} ${q.maximum} character(s)`:"number"===q.type?`Number must be ${q.exact?"exactly":q.inclusive?"less than or equal to":"less than"} ${q.maximum}`:"bigint"===q.type?`BigInt must be ${q.exact?"exactly":q.inclusive?"less than or equal to":"less than"} ${q.maximum}`:"date"===q.type?`Date must be ${q.exact?"exactly":q.inclusive?"smaller than or equal to":"smaller than"} ${new Date(Number(q.maximum))}`:"Invalid input";break;case x.custom:f="Invalid input";break;case x.invalid_intersection_types:f="Intersection results could not be merged";break;case x.not_multiple_of:f=`Number must be a multiple of ${q.multipleOf}`;break;case x.not_finite:f="Number must be finite";break;default:f=V.defaultError,R.assertNever(q)}return{message:f}};let p=B;function O(){return p}const L=q=>{const{data:V,path:f,errorMaps:G,issueData:ee}=q,de=[...f,...ee.path||[]],fe={...ee,path:de};let Ie="";const Ge=G.filter(dt=>!!dt).slice().reverse();for(const dt of Ge)Ie=dt(fe,{data:V,defaultError:Ie}).message;return{...ee,path:de,message:ee.message||Ie}};function I(q,V){const f=L({issueData:V,data:q.data,path:q.path,errorMaps:[q.common.contextualErrorMap,q.schemaErrorMap,O(),B].filter(G=>!!G)});q.common.issues.push(f)}class D{constructor(){this.value="valid"}dirty(){"valid"===this.value&&(this.value="dirty")}abort(){"aborted"!==this.value&&(this.value="aborted")}static mergeArray(V,f){const G=[];for(const ee of f){if("aborted"===ee.status)return H;"dirty"===ee.status&&V.dirty(),G.push(ee.value)}return{status:V.value,value:G}}static mergeObjectAsync(V,f){return(0,S.A)(function*(){const G=[];for(const ee of f)G.push({key:yield ee.key,value:yield ee.value});return D.mergeObjectSync(V,G)})()}static mergeObjectSync(V,f){const G={};for(const ee of f){const{key:de,value:fe}=ee;if("aborted"===de.status||"aborted"===fe.status)return H;"dirty"===de.status&&V.dirty(),"dirty"===fe.status&&V.dirty(),"__proto__"!==de.value&&(typeof fe.value<"u"||ee.alwaysSet)&&(G[de.value]=fe.value)}return{status:V.value,value:G}}}const H=Object.freeze({status:"aborted"}),z=q=>({status:"dirty",value:q}),T=q=>
193({status:"valid",value:q}),W=q=>"aborted"===q.status,A=q=>"dirty"===q.status,E=q=>"valid"===q.status,g=q=>typeof Promise<"u"&&q instanceof Promise;var w=function(q){return q.errToObj=V=>"string"==typeof V?{message:V}:V||{},q.toString=V=>"string"==typeof V?V:V?.message,q}(w||{});class C{constructor(V,f,G,ee){this._cachedPath=[],this.parent=V,this.data=f,this._path=G,this._key=ee}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}}const y=(q,V)=>{if(E(V))return{success:!0,data:V.value};if(!q.common.issues.length)throw new Error("Validation failed but no issues detected.");return{success:!1,get error(){if(this._error)return this._error;const f=new X(q.common.issues);return this._error=f,this._error}}};function F(q){if(!q)return{};const{errorMap:V,invalid_type_error:f,required_error:G,description:ee}=q;if(V&&(f||G))throw new Error('Can\'t use "invalid_type_error" or "required_error" in conjunction with custom error map.');return V?{errorMap:V,description:ee}:{errorMap:(fe,Ie)=>"invalid_type"!==fe.code?{message:Ie.defaultError}:typeof Ie.data>"u"?{message:G??Ie.defaultError}:{message:f??Ie.defaultError},description:ee}}class Q{constructor(V){this.spa=this.safeParseAsync,this._def=V,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(V){return $(V.data)}_getOrReturnCtx(V,f){return f||{common:V.parent.common,data:V.data,parsedType:$(V.data),schemaErrorMap:this._def.errorMap,path:V.path,parent:V.parent}}_processInputParams(V){return{status:new D,ctx:{common:V.parent.common,data:V.data,parsedType:$(V.data),schemaErrorMap:this._def.errorMap,path:V.path,parent:V.parent}}}_parseSync(V){const f=this._parse(V);if(g(f))throw new Error("Synchronous parse encountered promise.");return f}_parseAsync(V){const f=this._parse(V);return Promise.resolve(f)}parse(V,f){const G=this.safeParse(V,f);if(G.success)return G.data;throw G.error}safeParse(V,f){var G;const ee={common:{issues:[],async:null!==(G=f?.async)&&void 0!==G&&G,contextualErrorMap:f?.errorMap},path:f?.path||[],schemaErrorMap:this._def.errorMap,parent:null,data:V,parsedType:$(V)},de=this._parseSync({data:V,path:ee.path,parent:ee});return y(ee,de)}parseAsync(V,f){var G=this;return(0,S.A)(function*(){const ee=yield G.safeParseAsync(V,f);if(ee.success)return ee.data;throw ee.error})()}safeParseAsync(V,f){var G=this;return(0,S.A)(function*(){const ee={common:{issues:[],contextualErrorMap:f?.errorMap,async:!0},path:f?.path||[],schemaErrorMap:G._def.errorMap,parent:null,data:V,parsedType:$(V)},de=G._parse({data:V,path:ee.path,parent:ee}),fe=yield g(de)?de:Promise.resolve(de);return y(ee,fe)})()}refine(V,f){const G=ee=>"string"==typeof f||typeof f>"u"?{message:f}:"function"==typeof f?f(ee):f;return this._refinement((ee,de)=>{const fe=V(ee),Ie=()=>de.addIssue({code:x.custom,...G(ee)});return typeof Promise<"u"&&fe instanceof Promise?fe.then(Ge=>!!Ge||(Ie(),!1)):!!fe||(Ie(),!1)})}refinement(V,f){return this._refinement((G,ee)=>!!V(G)||(ee.addIssue("function"==typeof f?f(G,ee):f),!1))}_refinement(V){return new me({schema:this,typeName:At.ZodEffects,effect:{type:"refinement",refinement:V}})}superRefine(V){return this._refinement(V)}optional(){return _e.create(this,this._def)}nullable(){return Ue.create(this,this._def)}nullish(){return this.nullable().optional()}array(){return rt.create(this,this._def)}promise(){return dn.create(this,this._def)}or(V){return rn.create([this,V],this._def)}and(V){return Y.create(this,V,this._def)}transform(V){return new me({...F(this._def),schema:this,typeName:At.ZodEffects,effect:{type:"transform",transform:V}})}default(V){const f="function"==typeof V?V:()=>V;return new vt({...F(this._def),innerType:this,defaultValue:f,typeName:At.ZodDefault})}brand(){return new Gt({typeName:At.ZodBranded,type:this,...F(this._def)})}catch(V){const f="function"==typeof V?V:()=>V;return new xt({...F(this._def),innerType:this,catchValue:f,typeName:At.ZodCatch})}describe(V){return new(0,this.constructor)({...this._def,description:V})}pipe(V){return Ct.create(this,V)}readonly(){return ht.create(this)}isOptional(){return this.safeParse(void 0).success}isNullable(){return this.safeParse(null).success}}const ge=/^c[^\s-]{8,}
193$/i,ce=/^[a-z][a-z0-9]*$/,Ae=/^[0-9A-HJKMNP-TV-Z]{26}$/,Te=/^[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,ve=/^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;let Ke;const Et=/^(((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}))$/,jt=/^(([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})))$/,Pt=q=>q.precision?q.offset?new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${q.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`):new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${q.precision}}Z$`):0===q.precision?q.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$"):q.offset?new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$"):new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");function wt(q,V){return!(("v4"!==V&&V||!Et.test(q))&&("v6"!==V&&V||!jt.test(q)))}let at=(()=>{class q extends Q{_parse(f){if(this._def.coerce&&(f.data=String(f.data)),this._getType(f)!==v.string){const fe=this._getOrReturnCtx(f);return I(fe,{code:x.invalid_type,expected:v.string,received:fe.parsedType}),H}const ee=new D;let de;for(const fe of this._def.checks)if("min"===fe.kind)f.data.length<fe.value&&(de=this._getOrReturnCtx(f,de),I(de,{code:x.too_small,minimum:fe.value,type:"string",inclusive:!0,exact:!1,message:fe.message}),ee.dirty());else if("max"===fe.kind)f.data.length>fe.value&&(de=this._getOrReturnCtx(f,de),I(de,{code:x.too_big,maximum:fe.value,type:"string",inclusive:!0,exact:!1,message:fe.message}),ee.dirty());else if("length"===fe.kind){const Ie=f.data.length>fe.value,Ge=f.data.length<fe.value;(Ie||Ge)&&(de=this._getOrReturnCtx(f,de),Ie?I(de,{code:x.too_big,maximum:fe.value,type:"string",inclusive:!0,exact:!0,message:fe.message}):Ge&&I(de,{code:x.too_small,minimum:fe.value,type:"string",inclusive:!0,exact:!0,message:fe.message}),ee.dirty())}else if("email"===fe.kind)ve.test(f.data)||(de=this._getOrReturnCtx(f,de),I(de,{validation:"email",code:x.invalid_string,message:fe.message}),ee.dirty());else if("emoji"===fe.kind)Ke||(Ke=new RegExp("^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$","u")),Ke.test(f.data)||(de=this._getOrReturnCtx(f,de),I(de,{validation:"emoji",code:x.invalid_string,message:fe.message}),ee.dirty());else if("uuid"===fe.kind)Te.test(f.data)||(de=this._getOrReturnCtx(f,de),I(de,{validation:"uuid",code:x.invalid_string,message:fe.message}),ee.dirty());else if("cuid"===fe.kind)ge.test(f.data)||(de=this._getOrReturnCtx(f,de),I(de,{validation:"cuid",code:x.invalid_string,message:fe.message}),ee.dirty());else if("cuid2"===fe.kind)ce.test(f.data)||(de=this._getOrReturnCtx(f,de),I(de,{validation:"cuid2",code:x.invalid_string,message:fe.message}),ee.dirty());else if("ulid"===fe.kind)Ae.test(f.data)||(de=this._getOrReturnCtx(f,de),I(de,{validation:"ulid",code:x.invalid_string,message:fe.message}),ee.dirty());else if("url"===fe.kind)try{new URL(f.data)}catch{de=this._getOrReturnCtx(f,de),I(de,{validation:"url",code:x.invalid_string,message:fe.message}),ee.dirty()}else"regex"===fe.kind?(fe.regex.lastIndex=0,fe.regex.test(f.data)||(de=this._getOrReturnCtx(f,de),I(de,{validation:"regex",code:x.invalid_string,message:fe.message}),ee.dirty())):"trim"===fe.kind?f.data=f.data.trim():"includes"===fe.kind?f.data.includes(fe.value,fe.position)||(de=this._getOrReturnCtx(f,de),I(de,{code:x.invalid_string,validation:{includes:fe.value,position:fe.position},message:fe.message}),ee.dirty()):"toLowerCase"===fe.kind?f.data=f.data.toLowerCase():"toUpperCase"===fe.kind?f.data=f.data.toUpperCase():"startsWith"===fe.kind?f.data.startsWith(fe.value)||(de=this._getOrReturnCtx(f,de),I(de,{code:x.invalid_string,validation:{startsWith:fe.value},message:fe.message}),ee.dirty()):"endsWith"===fe.kind?f.data.endsWith(fe.value)||(de=this._getOrReturnCtx(f,de),I(de,{code:x.invalid_string,validation:{endsWith:fe.value},message:fe.message}),ee.dirty()):"datetime"===fe.kind?Pt(fe).test(f.data)||(de=this._getOrReturnCtx(f,de),I(de,{code:x.invalid_string,validation:"datetime",message:fe.message}),ee.dirty()):"ip"===fe.kind?wt(f.data,fe.version)||(de=this._getOrReturnCtx(f,de),I(de,{val
193idation:"ip",code:x.invalid_string,message:fe.message}),ee.dirty()):R.assertNever(fe);return{status:ee.value,value:f.data}}_regex(f,G,ee){return this.refinement(de=>f.test(de),{validation:G,code:x.invalid_string,...w.errToObj(ee)})}_addCheck(f){return new q({...this._def,checks:[...this._def.checks,f]})}email(f){return this._addCheck({kind:"email",...w.errToObj(f)})}url(f){return this._addCheck({kind:"url",...w.errToObj(f)})}emoji(f){return this._addCheck({kind:"emoji",...w.errToObj(f)})}uuid(f){return this._addCheck({kind:"uuid",...w.errToObj(f)})}cuid(f){return this._addCheck({kind:"cuid",...w.errToObj(f)})}cuid2(f){return this._addCheck({kind:"cuid2",...w.errToObj(f)})}ulid(f){return this._addCheck({kind:"ulid",...w.errToObj(f)})}ip(f){return this._addCheck({kind:"ip",...w.errToObj(f)})}datetime(f){var G;return this._addCheck("string"==typeof f?{kind:"datetime",precision:null,offset:!1,message:f}:{kind:"datetime",precision:typeof f?.precision>"u"?null:f?.precision,offset:null!==(G=f?.offset)&&void 0!==G&&G,...w.errToObj(f?.message)})}regex(f,G){return this._addCheck({kind:"regex",regex:f,...w.errToObj(G)})}includes(f,G){return this._addCheck({kind:"includes",value:f,position:G?.position,...w.errToObj(G?.message)})}startsWith(f,G){return this._addCheck({kind:"startsWith",value:f,...w.errToObj(G)})}endsWith(f,G){return this._addCheck({kind:"endsWith",value:f,...w.errToObj(G)})}min(f,G){return this._addCheck({kind:"min",value:f,...w.errToObj(G)})}max(f,G){return this._addCheck({kind:"max",value:f,...w.errToObj(G)})}length(f,G){return this._addCheck({kind:"length",value:f,...w.errToObj(G)})}nonempty(f){return this.min(1,w.errToObj(f))}trim(){return new q({...this._def,checks:[...this._def.checks,{kind:"trim"}]})}toLowerCase(){return new q({...this._def,checks:[...this._def.checks,{kind:"toLowerCase"}]})}toUpperCase(){return new q({...this._def,checks:[...this._def.checks,{kind:"toUpperCase"}]})}get isDatetime(){return!!this._def.checks.find(f=>"datetime"===f.kind)}get isEmail(){return!!this._def.checks.find(f=>"email"===f.kind)}get isURL(){return!!this._def.checks.find(f=>"url"===f.kind)}get isEmoji(){return!!this._def.checks.find(f=>"emoji"===f.kind)}get isUUID(){return!!this._def.checks.find(f=>"uuid"===f.kind)}get isCUID(){return!!this._def.checks.find(f=>"cuid"===f.kind)}get isCUID2(){return!!this._def.checks.find(f=>"cuid2"===f.kind)}get isULID(){return!!this._def.checks.find(f=>"ulid"===f.kind)}get isIP(){return!!this._def.checks.find(f=>"ip"===f.kind)}get minLength(){let f=null;for(const G of this._def.checks)"min"===G.kind&&(null===f||G.value>f)&&(f=G.value);return f}get maxLength(){let f=null;for(const G of this._def.checks)"max"===G.kind&&(null===f||G.value<f)&&(f=G.value);return f}}return q.create=V=>{var f;return new q({checks:[],typeName:At.ZodString,coerce:null!==(f=V?.coerce)&&void 0!==f&&f,...F(V)})},q})();function xe(q,V){const f=(q.toString().split(".")[1]||"").length,G=(V.toString().split(".")[1]||"").length,ee=f>G?f:G;return parseInt(q.toFixed(ee).replace(".",""))%parseInt(V.toFixed(ee).replace(".",""))/Math.pow(10,ee)}let tt=(()=>{class q extends Q{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte,this.step=this.multipleOf}_parse(f){if(this._def.coerce&&(f.data=Number(f.data)),this._getType(f)!==v.number){const fe=this._getOrReturnCtx(f);return I(fe,{code:x.invalid_type,expected:v.number,received:fe.parsedType}),H}let ee;const de=new D;for(const fe of this._def.checks)"int"===fe.kind?R.isInteger(f.data)||(ee=this._getOrReturnCtx(f,ee),I(ee,{code:x.invalid_type,expected:"integer",received:"float",message:fe.message}),de.dirty()):"min"===fe.kind?(fe.inclusive?f.data<fe.value:f.data<=fe.value)&&(ee=this._getOrReturnCtx(f,ee),I(ee,{code:x.too_small,minimum:fe.value,type:"number",inclusive:fe.inclusive,exact:!1,message:fe.message}),de.dirty()):"max"===fe.kind?(fe.inclusive?f.data>fe.value:f.data>=fe.value)&&(ee=this._getOrReturnCtx(f,ee),I(ee,{code:x.too_big,maximum:fe.value,type:"number",inclusive:fe.inclusive,exact:!1,message:fe.message}),de.dirty()):"multipleOf"===fe.kind?0!==xe(f.data,fe.value)&&(ee=this._getOrReturnCtx(f,ee),I(ee,{code:x.not_multiple_of,multipleOf:fe.value,message:fe.message}),de.dirty()):"finite"===fe.kind?Number.isFinite(f.data)||(ee=this._getOrReturnCtx(f,ee),I(ee,{code:x.not_finite,message:fe.message}),de.dirty()):R.assertNever(fe);return{status:de.value,value:f.data}}gte(f,G){return this.setLimit("min",f,!0,w.toString(G))}gt(f,G){return this.setLimit("min",f,!1,w.toString(G))}lte(f,G){return this.setLimit("max",f,!0,w.toString(G))}lt(f,G){return this.setLimit("max",f,!1,w.toString(G))}setLimit(f,G,ee,de){return new q({...this._def,checks:[...this._def.checks,{kind:f,value:G,inclusive:ee,message:w.toString(de)}]})}_addCheck(f){return new q({...this._def,checks:[...this._def.checks,f]})}int(f){return this._addCheck({kind:"int",message:w.toString(f)})}positive(f){return this._addCheck({kind:"min",value:0,inclusive:!1,message:w.toString(f)})}negative(f){return this._addCheck({kind:"max",value:0,inclusive:!1,message:w.toString(f)})}nonpositive(f){return this._addCheck({kind:"max",value:0,inclusive:!0,message:w.toString(f)})}nonnegative(f){return this._addCheck({kind:"min",value:0,inclusive:!0,message:w.toString(f)})}multipleOf(f,G){return this._addCheck({kind:"multipleOf",value:f,message:w.toString(G)})}finite(f){return this._addCheck({kind:"finite",message:w.toString(f)})}safe(f){return this._addCheck({kind:"min",inclusive:!0,value:Number.MIN_SAFE_INTEGER,message:w.toString(f)})._addCheck({kind:"max",inclusive:!0,value:Number.MAX_SAFE_INTEGER,message:w.toString(f)})}get minValue(){let f=null;for(const G of this._def.checks)"min"===G.kind&&(null===f||G.value>f)&&(f=G.value);return f}get maxValue(){let f=null;for(const G of this._def.checks)"max"===G.kind&&(null===f||G.value<f)&&(f=G.value);return f}get isInt(){return!!this._def.checks.find(f=>"int"===f.kind||"multipleOf"===f.kind&&R.isInteger(f.value))}get isFinite(){let f=null,G=null;for(const ee of this._def.checks){if("finite"===ee.kind||"int"===ee.kind||"multipleOf"===ee.kind)return!0;"min"===ee.kind?(null===G||ee.value>G)&&(G=ee.value):"max"===ee.kind&&(null===f||ee.value<f)&&(f=ee.value)}return Number.isFinite(G)&&Number.isFinite(f)}}return q.create=V=>new q({checks:[],typeName:At.ZodNumber,coerce:V?.coerce||!1,...F(V)}),q})(),nt=(()=>{class q extends Q{constructor(){super(...arguments),this.min=this.gte,this.max=this.lte}_parse(f){if(this._def.coerce&&(f.data=BigInt(f.data)),this._getType(f)!==v.bigint){const fe=this._getOrReturnCtx(f);return I(fe,{code:x.invalid_type,expected:v.bigint,received:fe.parsedType}),H}let ee;const de=new D;for(const fe of this._def.checks)"min"===fe.kind?(fe.inclusive?f.data<fe.value:f.data<=fe.value)&&(ee=this._getOrReturnCtx(f,ee),I(ee,{code:x.too_small,type:"bigint",minimum:fe.value,inclusive:fe.inclusive,message:fe.message}),de.dirty()):"max"===fe.kind?(fe.inclusive?f.data>fe.value:f.data>=fe.value)&&(ee=this._getOrReturnCtx(f,ee),I(ee,{code:x.too_big,type:"bigint",maximum:fe.value,inclusive:fe.inclusive,message:fe.message}),de.dirty()):"multipleOf"===fe.kind?f.data%fe.value!==BigInt(0)&&(ee=this._getOrReturnCtx(f,ee),I(ee,{code:x.not_multiple_of,multipleOf:fe.value,message:fe.message}),de.dirty()):R.assertNever(fe);return{status:de.value,value:f.data}}gte(f,G){return this.setLimit("min",f,!0,w.toString(G))}gt(f,G){return this.setLimit("min",f,!1,w.toString(G))}lte(f,G){return this.setLimit("max",f,!0,w.toString(G))}lt(f,G){return this.setLimit("max",f,!1,w.toString(G))}setLimit(f,G,ee,de){return new q({...this._def,checks:[...this._def.checks,{kind:f,value:G,inclusive:ee,message:w.toString(de)}]})}_addCheck(f){return new q({...this._def,checks:[...this._def.checks,f]})}
193positive(f){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!1,message:w.toString(f)})}negative(f){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!1,message:w.toString(f)})}nonpositive(f){return this._addCheck({kind:"max",value:BigInt(0),inclusive:!0,message:w.toString(f)})}nonnegative(f){return this._addCheck({kind:"min",value:BigInt(0),inclusive:!0,message:w.toString(f)})}multipleOf(f,G){return this._addCheck({kind:"multipleOf",value:f,message:w.toString(G)})}get minValue(){let f=null;for(const G of this._def.checks)"min"===G.kind&&(null===f||G.value>f)&&(f=G.value);return f}get maxValue(){let f=null;for(const G of this._def.checks)"max"===G.kind&&(null===f||G.value<f)&&(f=G.value);return f}}return q.create=V=>{var f;return new q({checks:[],typeName:At.ZodBigInt,coerce:null!==(f=V?.coerce)&&void 0!==f&&f,...F(V)})},q})(),lt=(()=>{class q extends Q{_parse(f){if(this._def.coerce&&(f.data=!!f.data),this._getType(f)!==v.boolean){const ee=this._getOrReturnCtx(f);return I(ee,{code:x.invalid_type,expected:v.boolean,received:ee.parsedType}),H}return T(f.data)}}return q.create=V=>new q({typeName:At.ZodBoolean,coerce:V?.coerce||!1,...F(V)}),q})(),Nt=(()=>{class q extends Q{_parse(f){if(this._def.coerce&&(f.data=new Date(f.data)),this._getType(f)!==v.date){const fe=this._getOrReturnCtx(f);return I(fe,{code:x.invalid_type,expected:v.date,received:fe.parsedType}),H}if(isNaN(f.data.getTime()))return I(this._getOrReturnCtx(f),{code:x.invalid_date}),H;const ee=new D;let de;for(const fe of this._def.checks)"min"===fe.kind?f.data.getTime()<fe.value&&(de=this._getOrReturnCtx(f,de),I(de,{code:x.too_small,message:fe.message,inclusive:!0,exact:!1,minimum:fe.value,type:"date"}),ee.dirty()):"max"===fe.kind?f.data.getTime()>fe.value&&(de=this._getOrReturnCtx(f,de),I(de,{code:x.too_big,message:fe.message,inclusive:!0,exact:!1,maximum:fe.value,type:"date"}),ee.dirty()):R.assertNever(fe);return{status:ee.value,value:new Date(f.data.getTime())}}_addCheck(f){return new q({...this._def,checks:[...this._def.checks,f]})}min(f,G){return this._addCheck({kind:"min",value:f.getTime(),message:w.toString(G)})}max(f,G){return this._addCheck({kind:"max",value:f.getTime(),message:w.toString(G)})}get minDate(){let f=null;for(const G of this._def.checks)"min"===G.kind&&(null===f||G.value>f)&&(f=G.value);return null!=f?new Date(f):null}get maxDate(){let f=null;for(const G of this._def.checks)"max"===G.kind&&(null===f||G.value<f)&&(f=G.value);return null!=f?new Date(f):null}}return q.create=V=>new q({checks:[],coerce:V?.coerce||!1,typeName:At.ZodDate,...F(V)}),q})(),Le=(()=>{class q extends Q{_parse(f){if(this._getType(f)!==v.symbol){const ee=this._getOrReturnCtx(f);return I(ee,{code:x.invalid_type,expected:v.symbol,received:ee.parsedType}),H}return T(f.data)}}return q.create=V=>new q({typeName:At.ZodSymbol,...F(V)}),q})(),ct=(()=>{class q extends Q{_parse(f){if(this._getType(f)!==v.undefined){const ee=this._getOrReturnCtx(f);return I(ee,{code:x.invalid_type,expected:v.undefined,received:ee.parsedType}),H}return T(f.data)}}return q.create=V=>new q({typeName:At.ZodUndefined,...F(V)}),q})(),Je=(()=>{class q extends Q{_parse(f){if(this._getType(f)!==v.null){const ee=this._getOrReturnCtx(f);return I(ee,{code:x.invalid_type,expected:v.null,received:ee.parsedType}),H}return T(f.data)}}return q.create=V=>new q({typeName:At.ZodNull,...F(V)}),q})(),ut=(()=>{class q extends Q{constructor(){super(...arguments),this._any=!0}_parse(f){return T(f.data)}}return q.create=V=>new q({typeName:At.ZodAny,...F(V)}),q})(),bt=(()=>{class q extends Q{constructor(){super(...arguments),this._unknown=!0}_parse(f){return T(f.data)}}return q.create=V=>new q({typeName:At.ZodUnknown,...F(V)}),q})(),Xe=(()=>{class q extends Q{_parse(f){const G=this._getOrReturnCtx(f);return I(G,{code:x.invalid_type,expected:v.never,received:G.parsedType}),H}}return q.create=V=>new q({typeName:At.ZodNever,...F(V)}),q})(),yt=(()=>{class q extends Q{_parse(f){if(this._getType(f)!==v.undefined){const ee=this._getOrReturnCtx(f);return I(ee,{code:x.invalid_type,expected:v.void,received:ee.parsedType}),H}return T(f.data)}}return q.create=V=>new q({typeName:At.ZodVoid,...F(V)}),q})(),rt=(()=>{class q extends Q{_parse(f){const{ctx:G,status:ee}=this._processInputParams(f),de=this._def;if(G.parsedType!==v.array)return I(G,{code:x.invalid_type,expected:v.array,received:G.parsedType}),H;if(null!==de.exactLength){const Ie=G.data.length>de.exactLength.value,Ge=G.data.length<de.exactLength.value;(Ie||Ge)&&(I(G,{code:Ie?x.too_big:x.too_small,minimum:Ge?de.exactLength.value:void 0,maximum:Ie?de.exactLength.value:void 0,type:"array",inclusive:!0,exact:!0,message:de.exactLength.message}),ee.dirty())}if(null!==de.minLength&&G.data.length<de.minLength.value&&(I(G,{code:x.too_small,minimum:de.minLength.value,type:"array",inclusive:!0,exact:!1,message:de.minLength.message}),ee.dirty()),null!==de.maxLength&&G.data.length>de.maxLength.value&&(I(G,{code:x.too_big,maximum:de.maxLength.value,type:"array",inclusive:!0,exact:!1,message:de.maxLength.message}),ee.dirty()),G.common.async)return Promise.all([...G.data].map((Ie,Ge)=>de.type._parseAsync(new C(G,Ie,G.path,Ge)))).then(Ie=>D.mergeArray(ee,Ie));const fe=[...G.data].map((Ie,Ge)=>de.type._parseSync(new C(G,Ie,G.path,Ge)));return D.mergeArray(ee,fe)}
193get element(){return this._def.type}min(f,G){return new q({...this._def,minLength:{value:f,message:w.toString(G)}})}max(f,G){return new q({...this._def,maxLength:{value:f,message:w.toString(G)}})}length(f,G){return new q({...this._def,exactLength:{value:f,message:w.toString(G)}})}nonempty(f){return this.min(1,f)}}return q.create=(V,f)=>new q({type:V,minLength:null,maxLength:null,exactLength:null,typeName:At.ZodArray,...F(f)}),q})();function Tt(q){if(q instanceof Ft){const V={};for(const f in q.shape)V[f]=_e.create(Tt(q.shape[f]));return new Ft({...q._def,shape:()=>V})}return q instanceof rt?new rt({...q._def,type:Tt(q.element)}):q instanceof _e?_e.create(Tt(q.unwrap())):q instanceof Ue?Ue.create(Tt(q.unwrap())):q instanceof Z?Z.create(q.items.map(V=>Tt(V))):q}let Ft=(()=>{class q extends Q{constructor(){super(...arguments),this._cached=null,this.nonstrict=this.passthrough,this.augment=this.extend}_getCached(){if(null!==this._cached)return this._cached;const f=this._def.shape(),G=R.objectKeys(f);return this._cached={shape:f,keys:G}}_parse(f){if(this._getType(f)!==v.object){const _t=this._getOrReturnCtx(f);return I(_t,{code:x.invalid_type,expected:v.object,received:_t.parsedType}),H}const{status:ee,ctx:de}=this._processInputParams(f),{shape:fe,keys:Ie}=this._getCached(),Ge=[];if(!(this._def.catchall instanceof Xe&&"strip"===this._def.unknownKeys))for(const _t in de.data)Ie.includes(_t)||Ge.push(_t);const dt=[];for(const _t of Ie)dt.push({key:{status:"valid",value:_t},value:fe[_t]._parse(new C(de,de.data[_t],de.path,_t)),alwaysSet:_t in de.data});if(this._def.catchall instanceof Xe){const _t=this._def.unknownKeys;if("passthrough"===_t)for(const Rt of Ge)dt.push({key:{status:"valid",value:Rt},value:{status:"valid",value:de.data[Rt]}});else if("strict"===_t)Ge.length>0&&(I(de,{code:x.unrecognized_keys,keys:Ge}),ee.dirty());else if("strip"!==_t)throw new Error("Internal ZodObject error: invalid unknownKeys value.")}else{const _t=this._def.catchall;for(const Rt of Ge)dt.push({key:{status:"valid",value:Rt},value:_t._parse(new C(de,de.data[Rt],de.path,Rt)),alwaysSet:Rt in de.data})}return de.common.async?Promise.resolve().then((0,S.A)(function*(){const _t=[];for(const Rt of dt){const Sn=yield Rt.key;_t.push({key:Sn,value:yield Rt.value,alwaysSet:Rt.alwaysSet})}return _t})).then(_t=>D.mergeObjectSync(ee,_t)):D.mergeObjectSync(ee,dt)}get shape(){return this._def.shape()}strict(f){return new q({...this._def,unknownKeys:"strict",...void 0!==f?{errorMap:(G,ee)=>{var de,fe,Ie,Ge;const dt=null!==(Ie=null===(fe=(de=this._def).errorMap)||void 0===fe?void 0:fe.call(de,G,ee).message)&&void 0!==Ie?Ie:ee.defaultError;return"unrecognized_keys"===G.code?{message:null!==(Ge=w.errToObj(f).message)&&void 0!==Ge?Ge:dt}:{message:dt}}}:{}})}strip(){return new q({...this._def,unknownKeys:"strip"})}passthrough(){return new q({...this._def,unknownKeys:"passthrough"})}extend(f){return new q({...this._def,shape:()=>({...this._def.shape(),...f})})}merge(f){return new q({unknownKeys:f._def.unknownKeys,catchall:f._def.catchall,shape:()=>({...this._def.shape(),...f._def.shape()}),typeName:At.ZodObject})}setKey(f,G){return this.augment({[f]:G})}catchall(f){return new q({...this._def,catchall:f})}pick(f){const G={};return R.objectKeys(f).forEach(ee=>{f[ee]&&this.shape[ee]&&(G[ee]=this.shape[ee])}),new q({...this._def,shape:()=>G})}omit(f){const G={};return R.objectKeys(this.shape).forEach(ee=>{f[ee]||(G[ee]=this.shape[ee])}),new q({...this._def,shape:()=>G})}deepPartial(){return Tt(this)}partial(f){const G={};return R.objectKeys(this.shape).forEach(ee=>{const de=this.shape[ee];G[ee]=f&&!f[ee]?de:de.optional()}),new q({...this._def,shape:()=>G})}required(f){const G={};return R.objectKeys(this.shape).forEach(ee=>{if(f&&!f[ee])G[ee]=this.shape[ee];else{let fe=this.shape[ee];for(;fe instanceof _e;)fe=fe._def.innerType;G[ee]=fe}}),new q({...this._def,shape:()=>G})}keyof(){return Ut(R.objectKeys(this.shape))}}return q.create=(V,f)=>new q({shape:()=>V,unknownKeys:"strip",catchall:Xe.create(),typeName:At.ZodObject,...F(f)}),q.strictCreate=(V,f)=>new q({shape:()=>V,unknownKeys:"strict",catchall:Xe.create(),typeName:At.ZodObject,...F(f)}),q.lazycreate=(V,f)=>new q({shape:V,unknownKeys:"strip",catchall:Xe.create(),typeName:At.ZodObject,...F(f)}),q})(),rn=(()=>{class q extends Q{_parse(f){const{ctx:G}=this._processInputParams(f),ee=this._def.options;if(G.common.async)return Promise.all(ee.map(function(){var fe=(0,S.A)(function*(Ie){const Ge={...G,common:{...G.common,issues:[]},parent:null};return{result:yield Ie._parseAsync({data:G.data,path:G.path,parent:Ge}),ctx:Ge}}
193);return function(Ie){return fe.apply(this,arguments)}}())).then(function de(fe){for(const Ge of fe)if("valid"===Ge.result.status)return Ge.result;for(const Ge of fe)if("dirty"===Ge.result.status)return G.common.issues.push(...Ge.ctx.common.issues),Ge.result;const Ie=fe.map(Ge=>new X(Ge.ctx.common.issues));return I(G,{code:x.invalid_union,unionErrors:Ie}),H});{let fe;const Ie=[];for(const dt of ee){const _t={...G,common:{...G.common,issues:[]},parent:null},Rt=dt._parseSync({data:G.data,path:G.path,parent:_t});if("valid"===Rt.status)return Rt;"dirty"===Rt.status&&!fe&&(fe={result:Rt,ctx:_t}),_t.common.issues.length&&Ie.push(_t.common.issues)}if(fe)return G.common.issues.push(...fe.ctx.common.issues),fe.result;const Ge=Ie.map(dt=>new X(dt));return I(G,{code:x.invalid_union,unionErrors:Ge}),H}}get options(){return this._def.options}}return q.create=(V,f)=>new q({options:V,typeName:At.ZodUnion,...F(f)}),q})();const bn=q=>q instanceof it?bn(q.schema):q instanceof me?bn(q.innerType()):q instanceof Qe?[q.value]:q instanceof kt?q.options:q instanceof Xt?Object.keys(q.enum):q instanceof vt?bn(q._def.innerType):q instanceof ct?[void 0]:q instanceof Je?[null]:null;class qe extends Q{_parse(V){const{ctx:f}=this._processInputParams(V);if(f.parsedType!==v.object)return I(f,{code:x.invalid_type,expected:v.object,received:f.parsedType}),H;const G=this.discriminator,de=this.optionsMap.get(f.data[G]);return de?f.common.async?de._parseAsync({data:f.data,path:f.path,parent:f}):de._parseSync({data:f.data,path:f.path,parent:f}):(I(f,{code:x.invalid_union_discriminator,options:Array.from(this.optionsMap.keys()),path:[G]}),H)}get discriminator(){return this._def.discriminator}get options(){return this._def.options}get optionsMap(){return this._def.optionsMap}static create(V,f,G){const ee=new Map;for(const de of f){const fe=bn(de.shape[V]);if(!fe)throw new Error(`A discriminator value for key \`${V}\` could not be extracted from all schema options`);for(const Ie of fe){if(ee.has(Ie))throw new Error(`Discriminator property ${String(V)} has duplicate value ${String(Ie)}`);ee.set(Ie,de)}}return new qe({typeName:At.ZodDiscriminatedUnion,discriminator:V,options:f,optionsMap:ee,...F(G)})}}function N(q,V){const f=$(q),G=$(V);if(q===V)return{valid:!0,data:q};if(f===v.object&&G===v.object){const ee=R.objectKeys(V),de=R.objectKeys(q).filter(Ie=>-1!==ee.indexOf(Ie)),fe={...q,...V};for(const Ie of de){const Ge=N(q[Ie],V[Ie]);if(!Ge.valid)return{valid:!1};fe[Ie]=Ge.data}return{valid:!0,data:fe}}if(f===v.array&&G===v.array){if(q.length!==V.length)return{valid:!1};const ee=[];for(let de=0;de<q.length;de++){const Ge=N(q[de],V[de]);if(!Ge.valid)return{valid:!1};ee.push(Ge.data)}return{valid:!0,data:ee}}return f===v.date&&G===v.date&&+q==+V?{valid:!0,data:q}:{valid:!1}}let Y=(()=>{class q extends Q{_parse(f){const{status:G,ctx:ee}=this._processInputParams(f),de=(fe,Ie)=>{if(W(fe)||W(Ie))return H;const Ge=N(fe.value,Ie.value);return Ge.valid?((A(fe)||A(Ie))&&G.dirty(),{status:G.value,value:Ge.data}):(I(ee,{code:x.invalid_intersection_types}),H)};return ee.common.async?Promise.all([this._def.left._parseAsync({data:ee.data,path:ee.path,parent:ee}),this._def.right._parseAsync({data:ee.data,path:ee.path,parent:ee})]).then(([fe,Ie])=>de(fe,Ie)):de(this._def.left._parseSync({data:ee.data,path:ee.path,parent:ee}),this._def.right._parseSync({data:ee.data,path:ee.path,parent:ee}))}}return q.create=(V,f,G)=>new q({left:V,right:f,typeName:At.ZodIntersection,...F(G)}),q})(),Z=(()=>{class q extends Q{_parse(f){const{status:G,ctx:ee}=this._processInputParams(f);if(ee.parsedType!==v.array)return I(ee,{code:x.invalid_type,expected:v.array,received:ee.parsedType}),H;if(ee.data.length<this._def.items.length)return I(ee,{code:x.too_small,minimum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),H;!this._def.rest&&ee.data.length>this._def.items.length&&(I(ee,{code:x.too_big,maximum:this._def.items.length,inclusive:!0,exact:!1,type:"array"}),G.dirty());const fe=[...ee.data].map((Ie,Ge)=>{const dt=this._def.items[Ge]||this._def.rest;return dt?dt._parse(new C(ee,Ie,ee.path,Ge)):null}).filter(Ie=>!!Ie);return ee.common.async?Promise.all(fe).then(Ie=>D.mergeArray(G,Ie)):D.mergeArray(G,fe)}get items(){return this._def.items}rest(f){return new q({...this._def,rest:f})}}return q.create=(V,f)=>{if(!Array.isArray(V))throw new Error("You must pass an array of schemas to z.tuple([ ... ])");return new q({items:V,typeName:At.ZodTuple,rest:null,...F(f)})},q})();class ie extends Q{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(V){const{status:f,ctx:G}=this._processInputParams(V);if(G.parsedType!==v.object)return I(G,{code:x.invalid_type,expected:v.object,received:G.parsedType}),H;const ee=[],de=this._def.keyType,fe=this._def.valueType;for(const Ie in G.data)ee.push({key:de._parse(new C(G,Ie,G.path,Ie)),value:fe._parse(new C(G,G.data[Ie],G.path,Ie))});return G.common.async?D.mergeObjectAsync(f,ee):D.mergeObjectSync(f,ee)}
193get element(){return this._def.valueType}static create(V,f,G){return new ie(f instanceof Q?{keyType:V,valueType:f,typeName:At.ZodRecord,...F(G)}:{keyType:at.create(),valueType:V,typeName:At.ZodRecord,...F(f)})}}let he=(()=>{class q extends Q{get keySchema(){return this._def.keyType}get valueSchema(){return this._def.valueType}_parse(f){const{status:G,ctx:ee}=this._processInputParams(f);if(ee.parsedType!==v.map)return I(ee,{code:x.invalid_type,expected:v.map,received:ee.parsedType}),H;const de=this._def.keyType,fe=this._def.valueType,Ie=[...ee.data.entries()].map(([Ge,dt],_t)=>({key:de._parse(new C(ee,Ge,ee.path,[_t,"key"])),value:fe._parse(new C(ee,dt,ee.path,[_t,"value"]))}));if(ee.common.async){const Ge=new Map;return Promise.resolve().then((0,S.A)(function*(){for(const dt of Ie){const _t=yield dt.key,Rt=yield dt.value;if("aborted"===_t.status||"aborted"===Rt.status)return H;("dirty"===_t.status||"dirty"===Rt.status)&&G.dirty(),Ge.set(_t.value,Rt.value)}return{status:G.value,value:Ge}}))}{const Ge=new Map;for(const dt of Ie){const _t=dt.key,Rt=dt.value;if("aborted"===_t.status||"aborted"===Rt.status)return H;("dirty"===_t.status||"dirty"===Rt.status)&&G.dirty(),Ge.set(_t.value,Rt.value)}return{status:G.value,value:Ge}}}}return q.create=(V,f,G)=>new q({valueType:f,keyType:V,typeName:At.ZodMap,...F(G)}),q})(),Oe=(()=>{class q extends Q{_parse(f){const{status:G,ctx:ee}=this._processInputParams(f);if(ee.parsedType!==v.set)return I(ee,{code:x.invalid_type,expected:v.set,received:ee.parsedType}),H;const de=this._def;null!==de.minSize&&ee.data.size<de.minSize.value&&(I(ee,{code:x.too_small,minimum:de.minSize.value,type:"set",inclusive:!0,exact:!1,message:de.minSize.message}),G.dirty()),null!==de.maxSize&&ee.data.size>de.maxSize.value&&(I(ee,{code:x.too_big,maximum:de.maxSize.value,type:"set",inclusive:!0,exact:!1,message:de.maxSize.message}),G.dirty());const fe=this._def.valueType;function Ie(dt){const _t=new Set;for(const Rt of dt){if("aborted"===Rt.status)return H;"dirty"===Rt.status&&G.dirty(),_t.add(Rt.value)}return{status:G.value,value:_t}}const Ge=[...ee.data.values()].map((dt,_t)=>fe._parse(new C(ee,dt,ee.path,_t)));return ee.common.async?Promise.all(Ge).then(dt=>Ie(dt)):Ie(Ge)}min(f,G){return new q({...this._def,minSize:{value:f,message:w.toString(G)}})}max(f,G){return new q({...this._def,maxSize:{value:f,message:w.toString(G)}})}size(f,G){return this.min(f,G).max(f,G)}nonempty(f){return this.min(1,f)}}return q.create=(V,f)=>new q({valueType:V,minSize:null,maxSize:null,typeName:At.ZodSet,...F(f)}),q})();class $e extends Q{constructor(){super(...arguments),this.validate=this.implement}_parse(V){const{ctx:f}=this._processInputParams(V);if(f.parsedType!==v.function)return I(f,{code:x.invalid_type,expected:v.function,received:f.parsedType}),H;function G(Ie,Ge){return L({data:Ie,path:f.path,errorMaps:[f.common.contextualErrorMap,f.schemaErrorMap,O(),B].filter(dt=>!!dt),issueData:{code:x.invalid_arguments,argumentsError:Ge}})}function ee(Ie,Ge){return L({data:Ie,path:f.path,errorMaps:[f.common.contextualErrorMap,f.schemaErrorMap,O(),B].filter(dt=>!!dt),issueData:{code:x.invalid_return_type,returnTypeError:Ge}})}const de={errorMap:f.common.contextualErrorMap},fe=f.data;if(this._def.returns instanceof dn){const Ie=this;return T((0,S.A)(function*(...Ge){const dt=new X([]),_t=yield Ie._def.args.parseAsync(Ge,de).catch(ni=>{throw dt.addIssue(G(Ge,ni)),dt}),Rt=yield Reflect.apply(fe,this,_t);return yield Ie._def.returns._def.type.parseAsync(Rt,de).catch(ni=>{throw dt.addIssue(ee(Rt,ni)),dt})}))}{const Ie=this;return T(function(...Ge){const dt=Ie._def.args.safeParse(Ge,de);if(!dt.success)throw new X([G(Ge,dt.error)]);const _t=Reflect.apply(fe,this,dt.data),Rt=Ie._def.returns.safeParse(_t,de);if(!Rt.success)throw new X([ee(_t,Rt.error)]);return Rt.data})}}parameters(){return this._def.args}returnType(){return this._def.returns}args(...V){return new $e({...this._def,args:Z.create(V).rest(bt.create())})}returns(V){return new $e({...this._def,returns:V})}implement(V){return this.parse(V)}strictImplement(V){return this.parse(V)}static create(V,f,G){return new $e({args:V||Z.create([]).rest(bt.create()),returns:f||bt.create(),typeName:At.ZodFunction,...F(G)})}}let it=(()=>{class q extends Q{get schema(){return this._def.getter()}_parse(f){const{ctx:G}=this._processInputParams(f);return this._def.getter()._parse({data:G.data,path:G.path,parent:G})}}return q.create=(V,f)=>new q({getter:V,typeName:At.ZodLazy,...F(f)}),q})(),Qe=(()=>{class q extends Q{_parse(f){if(f.data!==this._def.value){const G=this._getOrReturnCtx(f);return I(G,{received:G.data,code:x.invalid_literal,expected:this._def.value}),H}
193return{status:"valid",value:f.data}}get value(){return this._def.value}}return q.create=(V,f)=>new q({value:V,typeName:At.ZodLiteral,...F(f)}),q})();function Ut(q,V){return new kt({values:q,typeName:At.ZodEnum,...F(V)})}let kt=(()=>{class q extends Q{_parse(f){if("string"!=typeof f.data){const G=this._getOrReturnCtx(f);return I(G,{expected:R.joinValues(this._def.values),received:G.parsedType,code:x.invalid_type}),H}if(-1===this._def.values.indexOf(f.data)){const G=this._getOrReturnCtx(f);return I(G,{received:G.data,code:x.invalid_enum_value,options:this._def.values}),H}return T(f.data)}get options(){return this._def.values}get enum(){const f={};for(const G of this._def.values)f[G]=G;return f}get Values(){const f={};for(const G of this._def.values)f[G]=G;return f}get Enum(){const f={};for(const G of this._def.values)f[G]=G;return f}extract(f){return q.create(f)}exclude(f){return q.create(this.options.filter(G=>!f.includes(G)))}}return q.create=Ut,q})(),Xt=(()=>{class q extends Q{_parse(f){const G=R.getValidEnumValues(this._def.values),ee=this._getOrReturnCtx(f);if(ee.parsedType!==v.string&&ee.parsedType!==v.number){const de=R.objectValues(G);return I(ee,{expected:R.joinValues(de),received:ee.parsedType,code:x.invalid_type}),H}if(-1===G.indexOf(f.data)){const de=R.objectValues(G);return I(ee,{received:ee.data,code:x.invalid_enum_value,options:de}),H}return T(f.data)}get enum(){return this._def.values}}return q.create=(V,f)=>new q({values:V,typeName:At.ZodNativeEnum,...F(f)}),q})(),dn=(()=>{class q extends Q{unwrap(){return this._def.type}_parse(f){const{ctx:G}=this._processInputParams(f);if(G.parsedType!==v.promise&&!1===G.common.async)return I(G,{code:x.invalid_type,expected:v.promise,received:G.parsedType}),H;const ee=G.parsedType===v.promise?G.data:Promise.resolve(G.data);return T(ee.then(de=>this._def.type.parseAsync(de,{path:G.path,errorMap:G.common.contextualErrorMap})))}}return q.create=(V,f)=>new q({type:V,typeName:At.ZodPromise,...F(f)}),q})(),me=(()=>{class q extends Q{innerType(){return this._def.schema}sourceType(){return this._def.schema._def.typeName===At.ZodEffects?this._def.schema.sourceType():this._def.schema}_parse(f){const{status:G,ctx:ee}=this._processInputParams(f),de=this._def.effect||null,fe={addIssue:Ie=>{I(ee,Ie),Ie.fatal?G.abort():G.dirty()},get path(){return ee.path}};if(fe.addIssue=fe.addIssue.bind(fe),"preprocess"===de.type){const Ie=de.transform(ee.data,fe);return ee.common.issues.length?{status:"dirty",value:ee.data}:ee.common.async?Promise.resolve(Ie).then(Ge=>this._def.schema._parseAsync({data:Ge,path:ee.path,parent:ee})):this._def.schema._parseSync({data:Ie,path:ee.path,parent:ee})}if("refinement"===de.type){const Ie=Ge=>{const dt=de.refinement(Ge,fe);if(ee.common.async)return Promise.resolve(dt);if(dt instanceof Promise)throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");return Ge};if(!1===ee.common.async){const Ge=this._def.schema._parseSync({data:ee.data,path:ee.path,parent:ee});return"aborted"===Ge.status?H:("dirty"===Ge.status&&G.dirty(),Ie(Ge.value),{status:G.value,value:Ge.value})}return this._def.schema._parseAsync({data:ee.data,path:ee.path,parent:ee}).then(Ge=>"aborted"===Ge.status?H:("dirty"===Ge.status&&G.dirty(),Ie(Ge.value).then(()=>({status:G.value,value:Ge.value}))))}if("transform"===de.type){if(!1===ee.common.async){const Ie=this._def.schema._parseSync({data:ee.data,path:ee.path,parent:ee});if(!E(Ie))return Ie;const Ge=de.transform(Ie.value,fe);if(Ge instanceof Promise)throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");return{status:G.value,value:Ge}}return this._def.schema._parseAsync({data:ee.data,path:ee.path,parent:ee}).then(Ie=>E(Ie)?Promise.resolve(de.transform(Ie.value,fe)).then(Ge=>({status:G.value,value:Ge})):Ie)}R.assertNever(de)}}return q.create=(V,f,G)=>new q({schema:V,typeName:At.ZodEffects,effect:f,...F(G)}),q.createWithPreprocess=(V,f,G)=>new q({schema:f,effect:{type:"preprocess",transform:V},typeName:At.ZodEffects,...F(G)}),q})(),_e=(()=>{class q extends Q{_parse(f){return this._getType(f)===v.undefined?T(void 0):this._def.innerType._parse(f)}unwrap(){return this._def.innerType}}return q.create=(V,f)=>new q({innerType:V,typeName:At.ZodOptional,...F(f)}),q})(),Ue=(()=>{class q extends Q{_parse(f){return this._getType(f)===v.null?T(null):this._def.innerType._parse(f)}unwrap(){return this._def.innerType}}return q.create=(V,f)=>new q({innerType:V,typeName:At.ZodNullable,...F(f)}),q})(),vt=(()=>{class q extends Q{_parse(f){const{ctx:G}=this._processInputParams(f);let ee=G.data;return G.parsedType===v.undefined&&(ee=this._def.defaultValue()),this._def.innerType._parse({data:ee,path:G.path,parent:G})}removeDefault(){return this._def.innerType}}return q.create=(V,f)=>new q({innerType:V,typeName:At.ZodDefault,defaultValue:"function"==typeof f.default?f.default:()=>f.default,...F(f)}),q})(),xt=(()=>{class q extends Q{_parse(f){const{ctx:G}=this._processInputParams(f),ee={...G,common:{...G.common,issues:[]}},de=this._def.innerType._parse({data:ee.data,path:ee.path,parent:{...ee}});return g(de)?de.then(fe=>
193({status:"valid",value:"valid"===fe.status?fe.value:this._def.catchValue({get error(){return new X(ee.common.issues)},input:ee.data})})):{status:"valid",value:"valid"===de.status?de.value:this._def.catchValue({get error(){return new X(ee.common.issues)},input:ee.data})}}removeCatch(){return this._def.innerType}}return q.create=(V,f)=>new q({innerType:V,typeName:At.ZodCatch,catchValue:"function"==typeof f.catch?f.catch:()=>f.catch,...F(f)}),q})(),Bt=(()=>{class q extends Q{_parse(f){if(this._getType(f)!==v.nan){const ee=this._getOrReturnCtx(f);return I(ee,{code:x.invalid_type,expected:v.nan,received:ee.parsedType}),H}return{status:"valid",value:f.data}}}return q.create=V=>new q({typeName:At.ZodNaN,...F(V)}),q})();const Qt=Symbol("zod_brand");class Gt extends Q{_parse(V){const{ctx:f}=this._processInputParams(V);return this._def.type._parse({data:f.data,path:f.path,parent:f})}unwrap(){return this._def.type}}class Ct extends Q{_parse(V){var f=this;const{status:G,ctx:ee}=this._processInputParams(V);if(ee.common.async)return function(){var fe=(0,S.A)(function*(){const Ie=yield f._def.in._parseAsync({data:ee.data,path:ee.path,parent:ee});return"aborted"===Ie.status?H:"dirty"===Ie.status?(G.dirty(),z(Ie.value)):f._def.out._parseAsync({data:Ie.value,path:ee.path,parent:ee})});return function(){return fe.apply(this,arguments)}}()();{const de=this._def.in._parseSync({data:ee.data,path:ee.path,parent:ee});return"aborted"===de.status?H:"dirty"===de.status?(G.dirty(),{status:"dirty",value:de.value}):this._def.out._parseSync({data:de.value,path:ee.path,parent:ee})}}static create(V,f){return new Ct({in:V,out:f,typeName:At.ZodPipeline})}}let ht=(()=>{class q extends Q{_parse(f){const G=this._def.innerType._parse(f);return E(G)&&(G.value=Object.freeze(G.value)),G}}return q.create=(V,f)=>new q({innerType:V,typeName:At.ZodReadonly,...F(f)}),q})();const Mt=(q,V={},f)=>q?ut.create().superRefine((G,ee)=>{var de,fe;if(!q(G)){const Ie="function"==typeof V?V(G):"string"==typeof V?{message:V}:V,Ge=null===(fe=null!==(de=Ie.fatal)&&void 0!==de?de:f)||void 0===fe||fe;ee.addIssue({code:"custom",..."string"==typeof Ie?{message:Ie}:Ie,fatal:Ge})}}):ut.create(),Ht={object:Ft.lazycreate};var At=function(q){return q.ZodString="ZodString",q.ZodNumber="ZodNumber",q.ZodNaN="ZodNaN",q.ZodBigInt="ZodBigInt",q.ZodBoolean="ZodBoolean",q.ZodDate="ZodDate",q.ZodSymbol="ZodSymbol",q.ZodUndefined="ZodUndefined",q.ZodNull="ZodNull",q.ZodAny="ZodAny",q.ZodUnknown="ZodUnknown",q.ZodNever="ZodNever",q.ZodVoid="ZodVoid",q.ZodArray="ZodArray",q.ZodObject="ZodObject",q.ZodUnion="ZodUnion",q.ZodDiscriminatedUnion="ZodDiscriminatedUnion",q.ZodIntersection="ZodIntersection",q.ZodTuple="ZodTuple",q.ZodRecord="ZodRecord",q.ZodMap="ZodMap",q.ZodSet="ZodSet",q.ZodFunction="ZodFunction",q.ZodLazy="ZodLazy",q.ZodLiteral="ZodLiteral",q.ZodEnum="ZodEnum",q.ZodEffects="ZodEffects",q.ZodNativeEnum="ZodNativeEnum",q.ZodOptional="ZodOptional",q.ZodNullable="ZodNullable",q.ZodDefault="ZodDefault",q.ZodCatch="ZodCatch",q.ZodPromise="ZodPromise",q.ZodBranded="ZodBranded",q.ZodPipeline="ZodPipeline",q.ZodReadonly="ZodReadonly",q}(At||{});const Fr=at.create,wn=tt.create,lr=Bt.create,ts=nt.create,Js=lt.create,Cs=Nt.create,Ci=Le.create,Ai=ct.create,ns=Je.create,As=ut.create,ul=bt.create,Ch=Xe.create,dl=yt.create,Ah=rt.create,fl=Ft.create,Ih=Ft.strictCreate,hl=rn.create,pl=qe.create,gl=Y.create,ml=Z.create,yl=ie.create,Aa=he.create,Sh=Oe.create,_l=$e.create,Th=it.create,El=Qe.create,vl=kt.create,bl=Xt.create,Ia=dn.create,co=me.create,wl=_e.create,Is=Ue.create,lo=me.createWithPreprocess,Cl=Ct.create;var se=Object.freeze({__proto__:null,defaultErrorMap:B,setErrorMap:function l(q){p=q},getErrorMap:O,makeIssue:L,EMPTY_PATH:[],addIssueToContext:I,ParseStatus:D,INVALID:H,DIRTY:z,OK:T,isAborted:W,isDirty:A,isValid:E,isAsync:g,get util(){return R},get objectUtil(){return k},ZodParsedType:v,getParsedType:$,ZodType:Q,ZodString:at,ZodNumber:tt,ZodBigInt:nt,ZodBoolean:lt,ZodDate:Nt,ZodSymbol:Le,ZodUndefined:ct,ZodNull:Je,ZodAny:ut,ZodUnknown:bt,ZodNever:Xe,ZodVoid:yt,ZodArray:rt,ZodObject:Ft,ZodUnion:rn,ZodDiscriminatedUnion:qe,ZodIntersection:Y,ZodTuple:Z,ZodRecord:ie,ZodMap:he,ZodSet:Oe,ZodFunction:$e,ZodLazy:it,ZodLiteral:Qe,ZodEnum:kt,ZodNativeEnum:Xt,ZodPromise:dn,ZodEffects:me,ZodTransformer:me,ZodOptional:_e,ZodNullable:Ue,ZodDefault:vt,ZodCatch:xt,ZodNaN:Bt,BRAND:Qt,ZodBranded:Gt,ZodPipeline:Ct,ZodReadonly:ht,custom:Mt,Sc
193hema:Q,ZodSchema:Q,late:Ht,get ZodFirstPartyTypeKind(){return At},coerce:{string:q=>at.create({...q,coerce:!0}),number:q=>tt.create({...q,coerce:!0}),boolean:q=>lt.create({...q,coerce:!0}),bigint:q=>nt.create({...q,coerce:!0}),date:q=>Nt.create({...q,coerce:!0})},any:As,array:Ah,bigint:ts,boolean:Js,date:Cs,discriminatedUnion:pl,effect:co,enum:vl,function:_l,instanceof:(q,V={message:`Input not instance of ${q.name}`})=>Mt(f=>f instanceof q,V),intersection:gl,lazy:Th,literal:El,map:Aa,nan:lr,nativeEnum:bl,never:Ch,null:ns,nullable:Is,number:wn,object:fl,oboolean:()=>Js().optional(),onumber:()=>wn().optional(),optional:wl,ostring:()=>Fr().optional(),pipeline:Cl,preprocess:lo,promise:Ia,record:yl,set:Sh,strictObject:Ih,string:Fr,symbol:Ci,transformer:co,tuple:ml,undefined:Ai,union:hl,unknown:ul,void:dl,NEVER:H,ZodIssueCode:x,quotelessJson:q=>JSON.stringify(q,null,2).replace(/"([^"]+)":/g,"$1:"),ZodError:X});const tn=se.object({message:se.string()});function pt(q){return se.literal(m.s1[q])}const Xs=se.object({serializedMessage:se.string().optional(),accountAddress:se.string(),chainId:se.string(),notBefore:se.string().optional(),domain:se.string(),uri:se.string(),version:se.string(),nonce:se.string(),statement:se.string().optional(),resources:se.array(se.string()).optional(),requestId:se.string().optional(),issuedAt:se.string().optional(),expirationTime:se.string().optional()}),Sl=(se.object({accessList:se.array(se.string()),blockHash:se.string().nullable(),blockNumber:se.string().nullable(),chainId:se.string().or(se.number()),from:se.string(),gas:se.string(),hash:se.string(),input:se.string().nullable(),maxFeePerGas:se.string(),maxPriorityFeePerGas:se.string(),nonce:se.string(),r:se.string(),s:se.string(),to:se.string(),transactionIndex:se.string().nullable(),type:se.string(),v:se.string(),value:se.string()}),se.object({chainId:se.string().or(se.number()),rpcUrl:se.optional(se.string())})),Tl=se.object({email:se.string().email()}),Ol=se.object({otp:se.string()}),Nl=se.object({uri:se.string(),preferredAccountType:se.optional(se.string()),chainId:se.optional(se.string().or(se.number())),siwxMessage:se.optional(Xs),rpcUrl:se.optional(se.string())}),xl=se.object({chainId:se.optional(se.string().or(se.number())),preferredAccountType:se.optional(se.string()),socialUri:se.optional(se.string()),siwxMessage:se.optional(Xs),rpcUrl:se.optional(se.string())}),Rl=se.object({provider:se.enum(["google","github","apple","facebook","x","discord"])}),Pl=se.object({email:se.string().email()}),Dl=se.object({otp:se.string()}),Ul=se.object({otp:se.string()}),kl=se.object({themeMode:se.optional(se.enum(["light","dark"])),themeVariables:se.optional(se.record(se.string(),se.string().or(se.number()))),w3mThemeVariables:se.optional(se.record(se.string(),se.string()))}),Ml=se.object({metadata:se.object({name:se.string(),description:se.string(),url:se.string(),icons:se.array(se.string())}).optional(),sdkVersion:se.string().optional(),sdkType:se.string().optional(),projectId:se.string()}),Bl=se.object({type:se.string()}),Ll=se.object({action:se.enum(["VERIFY_DEVICE","VERIFY_OTP","CONNECT"])}),Fl=se.object({url:se.string()}),Wl=se.object({userName:se.string()}),jl=se.object({email:se.string().optional().nullable(),address:se.string(),chainId:se.string().or(se.number()),accounts:se.array(se.object({address:se.string(),type:se.enum([m.Vl.ACCOUNT_TYPES.EOA,m.Vl.ACCOUNT_TYPES.SMART_ACCOUNT])})).optional(),userName:se.string().optional().nullable(),preferredAccountType:se.optional(se.string()),signature:se.string().optional(),message:se.string().optional(),siwxMessage:se.optional(Xs)}),$l=se.object({action:se.enum(["VERIFY_PRIMARY_OTP","VERIFY_SECONDARY_OTP"])}),Hl=se.object({email:se.string().email().optional().nullable(),address:se.string(),chainId:se.string().or(se.number()),smartAccountDeployed:se.optional(se.boolean()),accounts:se.array(se.object({address:se.string(),type:se.enum([m.Vl.ACCOUNT_TYPES.EOA,m.Vl.ACCOUNT_TYPES.SMART_ACCOUNT])})).optional(),preferredAccountType:se.optional(se.string()),signature:se.string().optional(),message:se.string().optional(),siwxMessage:se.optional(Xs)}),Kl=se.object({uri:se.string()}),zl=se.object({isConnected:se.boolean()}),Dt=se.object({chainId:se.string().or(se.number())}),Vl=se.object({chainId:se.string().or(se.number())}),Gl=se.object({newEmail:se.string().email()}),Wr=se.object({smartAccountEnabledNetworks:se.array(se.number())}),ql=(se.object({address:se.string(),isDeployed:se.boolean()}),se.object({version:se.string().optional()})),Yl=se.object({type:se.string(),address:se.string()}),uo=se.any(),Sa=se.object({method:se.literal("eth_accounts")}),Zl=se.object({method:se.literal("eth_blockNumber")}),fo=se.object({method:se.literal("eth_call"),params:se.array(se.any())}),ho=se.object({method:se.literal("eth_chainId")}),po=se.object({method:se.literal("eth_estimateGas"),params:se.array(se.any())}),Jl=se.object({method:se.literal("eth_feeHistory"),params:se.array(se.any())}),go=se.object({method:se.literal("eth_gasPrice")}),Ta=se.object({method:se.literal("eth_getAccount"),params:se.array(se.any())}),Tr=se.object({method:se.literal("eth_getBalance"),params:se.array(se.any())}),Oa=se.object({method:se.literal("eth_getBlockByHash"),params:se.array(se.any())}),Na=se.object({method:se.literal("eth_getBlockByNumber"),params:se.array(se.any())}),Xl=se.object({method:se.literal("eth_getBlockReceipts"),params:se.array(se.any())}),Ii=se.object({method:se.literal("eth_getBlockTransactionCountByHash"),params:se.array(se.any())}),xa=se.object({method:se.literal("eth_getBlockTransactionCountByNumber"),params:se.array(se.any())}),mo=se.object({method:se.literal("eth_getCode"),params:se.array(se.any())}),Or=se.object({method:se.literal("eth_getFilterChanges"),params:se.array(se.any())}),Ra=se.object({method:se.literal("eth_getFilterLogs"),params:se.array(se.any())}),yo=se.object({method:se.literal("eth_getLogs"),params:se.array(se.any())}),Ql=se.object({method:se.literal("eth_getProof"),params:se.array(se.any())}),Qs=se.object({method:se.literal("eth_getStorageAt"),params:se.array(se.any())}),eu=se.object({method:se.literal("eth_getTransactionByBlockHashAndIndex"),params:se.array(se.any())}),tu=se.object({method:se.literal("eth_getTransactionByBlockNumberAndIndex"),params:se.array(se.any())}),nu=se.object({method:se.literal("eth_getTransactionByHash"),params:se.array(se.any())}),_o=se.object({method:se.literal("eth_getTransactionCount"),params:se.array(se.any())}),Pa=se.object({method:se.literal("eth_getTransactionReceipt"),params:se.array(se.any())}),gn=se.object({method:se.literal("eth_getUncleCountByBlockHash"),params:se.array(se.any())}),un=se.object({method:se.literal("eth_getUncleCountByBlockNumber"),params:se.array(se.any())}),ss=se.object({method:se.literal("eth_maxPriorityFeePerGas")}),ru=se.object({method:se.literal("eth_newBlockFilter")}),Eo=se.object({method:se.literal("eth_newFilter"),params:se.array(se.any())}),Da=se.object({method:se.literal("eth_newPendingTransactionFilter")}),Ua=se.object({method:se.literal("eth_sendRawTransaction"),params:se.array(se.any())}),hn=se.object({method:se.literal("eth_syncing"),params:se.array(se.any())}),su=se.object({method:se.literal("eth_uninstallFilter"),params:se.array(se.any())}),ur=se.object({method:se.literal("personal_sign"),params:se.array(se.any())}),ka=se.object({method:se.literal("eth_signTypedData_v4"),params:se.array(se.any())}),iu=se.object({method:se.literal("eth_sendTransaction"),params:se.array(se.any())}),ou=se.object({method:se.literal("solana_signMessage"),params:se.object({message:se.string(),pubkey:se.string()})}),au=se.object({method:se.literal("solana_signTransaction"),params:se.object({transaction:se.string()})}),cu=se.object({method:se.literal("solana_signAllTransactions"),params:se.object({transactions:se.array(se.string())})}),lu=se.object({method:se.literal("solana_signAndSendTransaction"),params:se.object({transaction:se.string(),options:se.object({skipPreflight:se.boolean().optional(),preflightCommitment:se.enum(["processed","confirmed","finalized","recent","single","singleGossip","root","max"]).optional(),maxRetries:se.number().optional(),minContextSlot:se.number().optional()}).optional()})}),uu=se.object({method:se.literal("wallet_sendCalls"),params:se.array(se.object({chainId:se.string().or(se.number()).optional(),from:se.string().optional(),version:se.string().optional(),capabilities:se.any().optional(),calls:se.array(se.object({to:se.string().startsWith("0x"),data:se.string().startsWith("0x").optional(),value:se.string().optional()}))}))}),du=se.object({method:se.literal("wallet_getCallsStatus"),params:se.array(se.string())}),Ma=se.object({method:se.literal("wallet_getCapabilities"),params:se.array(se.string().or(se.number()).optional()).optional()}),Ba=se.object({method:se.literal("wallet_grantPermissions"),params:se.array(se.any())}),La=se.object({method:se.literal("wallet_revokePermissions"),params:se.any()}),Si=se.object({method:se.literal("wallet_getAssets"),params:se.any()}),Ti=se.object({token:se.string()}),gt=se.object({id:se.string().optional()}),ei={appEvent:gt.extend({type:pt("APP_SWITCH_NETWORK"),payload:Sl}).or(gt.extend({type:pt("APP_CONNECT_EMAIL"),payload:Tl})).or(gt.extend({type:pt("APP_CONNECT_DEVICE")})).or(gt.extend({type:pt("APP_CONNECT_OTP"),payload:Ol})).or(gt.extend({type:pt("APP_CONNECT_SOCIAL"),payload:Nl})).or(gt.extend({type:pt("APP_GET_FARCASTER_URI")})).or(gt.extend({type:pt("APP_CONNECT_FARCASTER")})).or(gt.extend({type:pt("APP_GET_USER"),payload:se.optional(xl)})).or(gt.extend({type:pt("APP_GET_SOCIAL_REDIRECT_URI"),payload:Rl})).or(gt.extend({type:pt("APP_SIGN_OUT")})).or(gt.extend({type:pt("APP_IS_CONNECTED"),payload:se.optional(Ti)})).or(gt.extend({type:pt("APP_GET_CHAIN_ID")})).or(gt.extend({type:pt("APP_GET_SMART_ACCOUNT_ENABLED_NETWORKS")})).or(gt.extend({type:pt("APP_INIT_SMART_ACCOUNT")})).or(gt.extend({type:pt("APP_SET_PREFERRED_ACCOUNT"),payload:Bl})).or(gt.extend({type:pt("APP_RPC_REQUEST"),payload:ur.or(Si).or(Sa).or(Zl).or(fo).or(ho).or(po).or(Jl).or(go).or(Ta).or(Tr).or(Oa).or(Na).or(Xl).or(Ii).or(xa).or(mo).or(Or).or(Ra).or(yo).or(Ql).or(Qs).or(eu).or(tu).or(nu).or(_o).or(Pa).or(gn).or(un).or(ss).or(ru).or(Eo).or(Da).or(Ua).or(hn).or(su).or(ur).or(ka).or(iu).or(ou).or(au).or(cu).or(lu).or(du).or(uu).or(Ma).or(Ba).or(La).and(se.object({chainId:se.string().or(se.number()).optional(),chainNamespace:se.enum(["eip155","solana","polkadot","bip122","cosmos"]).optional(),rpcUrl:se.string().optional()}))})).or(gt.extend({type:pt("APP_UPDATE_EMAIL"),payload:Pl})).or(gt.extend({type:pt("APP_UPDATE_EMAIL_PRIMARY_OTP"),payload:Dl})).or(gt.extend({type:pt("APP_UPDATE_EMAIL_SECONDARY_OTP"),payload:Ul})).or(gt.extend({type:pt("APP_SYNC_THEME"),payload:kl})).or(gt.extend({type:pt("APP_SYNC_DAPP_DATA"),payload:Ml})).or(gt.extend({type:pt("APP_RELOAD")})).or(gt.extend({type:pt("APP_RPC_ABORT")}
193)),frameEvent:gt.extend({type:pt("FRAME_SWITCH_NETWORK_ERROR"),payload:tn}).or(gt.extend({type:pt("FRAME_SWITCH_NETWORK_SUCCESS"),payload:Vl})).or(gt.extend({type:pt("FRAME_CONNECT_EMAIL_SUCCESS"),payload:Ll})).or(gt.extend({type:pt("FRAME_CONNECT_EMAIL_ERROR"),payload:tn})).or(gt.extend({type:pt("FRAME_GET_FARCASTER_URI_SUCCESS"),payload:Fl})).or(gt.extend({type:pt("FRAME_GET_FARCASTER_URI_ERROR"),payload:tn})).or(gt.extend({type:pt("FRAME_CONNECT_FARCASTER_SUCCESS"),payload:Wl})).or(gt.extend({type:pt("FRAME_CONNECT_FARCASTER_ERROR"),payload:tn})).or(gt.extend({type:pt("FRAME_CONNECT_OTP_ERROR"),payload:tn})).or(gt.extend({type:pt("FRAME_CONNECT_OTP_SUCCESS")})).or(gt.extend({type:pt("FRAME_CONNECT_DEVICE_ERROR"),payload:tn})).or(gt.extend({type:pt("FRAME_CONNECT_DEVICE_SUCCESS")})).or(gt.extend({type:pt("FRAME_CONNECT_SOCIAL_SUCCESS"),payload:jl})).or(gt.extend({type:pt("FRAME_CONNECT_SOCIAL_ERROR"),payload:tn})).or(gt.extend({type:pt("FRAME_GET_USER_ERROR"),payload:tn})).or(gt.extend({type:pt("FRAME_GET_USER_SUCCESS"),payload:Hl})).or(gt.extend({type:pt("FRAME_GET_SOCIAL_REDIRECT_URI_ERROR"),payload:tn})).or(gt.extend({type:pt("FRAME_GET_SOCIAL_REDIRECT_URI_SUCCESS"),payload:Kl})).or(gt.extend({type:pt("FRAME_SIGN_OUT_ERROR"),payload:tn})).or(gt.extend({type:pt("FRAME_SIGN_OUT_SUCCESS")})).or(gt.extend({type:pt("FRAME_IS_CONNECTED_ERROR"),payload:tn})).or(gt.extend({type:pt("FRAME_IS_CONNECTED_SUCCESS"),payload:zl})).or(gt.extend({type:pt("FRAME_GET_CHAIN_ID_ERROR"),payload:tn})).or(gt.extend({type:pt("FRAME_GET_CHAIN_ID_SUCCESS"),payload:Dt})).or(gt.extend({type:pt("FRAME_RPC_REQUEST_ERROR"),payload:tn})).or(gt.extend({type:pt("FRAME_RPC_REQUEST_SUCCESS"),payload:uo})).or(gt.extend({type:pt("FRAME_SESSION_UPDATE"),payload:Ti})).or(gt.extend({type:pt("FRAME_UPDATE_EMAIL_ERROR"),payload:tn})).or(gt.extend({type:pt("FRAME_UPDATE_EMAIL_SUCCESS"),payload:$l})).or(gt.extend({type:pt("FRAME_UPDATE_EMAIL_PRIMARY_OTP_ERROR"),payload:tn})).or(gt.extend({type:pt("FRAME_UPDATE_EMAIL_PRIMARY_OTP_SUCCESS")})).or(gt.extend({type:pt("FRAME_UPDATE_EMAIL_SECONDARY_OTP_ERROR"),payload:tn})).or(gt.extend({type:pt("FRAME_UPDATE_EMAIL_SECONDARY_OTP_SUCCESS"),payload:Gl})).or(gt.extend({type:pt("FRAME_SYNC_THEME_ERROR"),payload:tn})).or(gt.extend({type:pt("FRAME_SYNC_THEME_SUCCESS")})).or(gt.extend({type:pt("FRAME_SYNC_DAPP_DATA_ERROR"),payload:tn})).or(gt.extend({type:pt("FRAME_SYNC_DAPP_DATA_SUCCESS")})).or(gt.extend({type:pt("FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_SUCCESS"),payload:Wr})).or(gt.extend({type:pt("FRAME_GET_SMART_ACCOUNT_ENABLED_NETWORKS_ERROR"),payload:tn})).or(gt.extend({type:pt("FRAME_INIT_SMART_ACCOUNT_ERROR"),payload:tn})).or(gt.extend({type:pt("FRAME_SET_PREFERRED_ACCOUNT_SUCCESS"),payload:Yl})).or(gt.extend({type:pt("FRAME_SET_PREFERRED_ACCOUNT_ERROR"),payload:tn})).or(gt.extend({type:pt("FRAME_READY"),payload:ql})).or(gt.extend({type:pt("FRAME_RELOAD_ERROR"),payload:tn})).or(gt.extend({type:pt("FRAME_RELOAD_SUCCESS")}))};var In=u(66689);function vo(q,V={}){return"string"==typeof V?.type&&V?.type?.includes(q)}class Fa{constructor({projectId:V,isAppClient:f=!1,chainId:G="eip155:1",enableLogger:ee=!0,enableCloudAuthAccount:de=!1,rpcUrl:fe=K.o.BLOCKCHAIN_API_RPC_URL}){if(this.iframe=null,this.iframeIsReady=!1,this.initFrame=()=>{const Ie=document.getElementById("w3m-iframe");this.iframe&&!Ie&&document.body.appendChild(this.iframe)},this.events={registerFrameEventHandler:(Ie,Ge,dt)=>{function _t({data:Rt}){if(!vo(m.s1.FRAME_EVENT_KEY,Rt))return;const Sn=ei.frameEvent.safeParse(Rt);Sn.success?Sn.data?.id===Ie&&(Ge(Sn.data),window.removeEventListener("message",_t)):console.warn("W3mFrame: invalid frame event",Sn.error.message)}j.Q.isClient&&(window.addEventListener("message",_t),dt.addEventListener("abort",()=>{window.removeEventListener("message",_t)}))},onFrameEvent:Ie=>{j.Q.isClient&&window.addEventListener("message",({data:Ge})=>{if(!vo(m.s1.FRAME_EVENT_KEY,Ge))return;const dt=ei.frameEvent.safeParse(Ge);dt.success?Ie(dt.data):console.warn("W3mFrame: invalid frame event",dt.error.message)})},onAppEvent:Ie=>{j.Q.isClient&&window.addEventListener("message",({data:Ge})=>{if(!vo(m.s1.APP_EVENT_KEY,Ge))return;const dt=ei.appEvent.safeParse(Ge);dt.success||console.warn("W3mFrame: invalid app event",dt.error.message),Ie(Ge)})},postAppEvent:Ie=>{if(j.Q.isClient){if(!this.iframe?.contentWindow)throw new Error("W3mFrame: iframe is not set");this.iframe.contentWindow.postMessage(Ie,"*")}},postFrameEvent:Ie=>{if(j.Q.isClient){if(!parent)throw new Error("W3mFrame: parent is not set");parent.postMessage(Ie,"*")}}},this.projectId=V,this.frameLoadPromise=new Promise((Ie,Ge)=>{this.frameLoadPromiseResolver={resolve:Ie,reject:Ge}}),this.rpcUrl=fe,f&&(this.frameLoadPromise=new Promise((Ie,Ge)=>{this.frameLoadPromiseResolver={resolve:Ie,reject:Ge}}),j.Q.isClient)){const Ie=document.createElement("iframe");Ie.id="w3m-iframe",Ie.src=function bo({projectId:q,chainId:V,enableLogger:f,rpcUrl:G=K.o.BLOCKCHAIN_API_RPC_URL,enableCloudAuthAccount:ee=!1}){const de=new URL(m.hy);de.searchParams.set("projectId",q),de.searchParams.set("chainId",String(V)),de.searchParams.set("version",m.gS),de.searchParams.set("enableLogger",String(f)),de.searchParams.set("rpcUrl",G);const fe=In.o.get("dapp_smart_account_version");return fe&&("v6"===fe||"v7"===fe)&&(console.warn(">>
193 AppKit - Forcing smart account version",fe),de.searchParams.set("smartAccountVersion",fe)),ee&&de.searchParams.set("enableCloudAuthAccount","true"),de.toString()}({projectId:V,chainId:G,enableLogger:ee,rpcUrl:this.rpcUrl,enableCloudAuthAccount:de}),Ie.name="w3m-secure-iframe",Ie.style.position="fixed",Ie.style.zIndex="999999",Ie.style.display="none",Ie.style.border="none",Ie.style.animationDelay="0s, 50ms",Ie.style.borderBottomLeftRadius="clamp(0px, var(--apkt-borderRadius-8), 44px)",Ie.style.borderBottomRightRadius="clamp(0px, var(--apkt-borderRadius-8), 44px)",this.iframe=Ie,this.iframe.onerror=()=>{this.frameLoadPromiseResolver?.reject("Unable to load email login dependency")},this.events.onFrameEvent(Ge=>{"@w3m-frame/READY"===Ge.type&&(this.iframeIsReady=!0,this.frameLoadPromiseResolver?.resolve(void 0))})}}get networks(){const V=["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(f=>({[f]:{rpcUrl:`${this.rpcUrl}/v1/?chainId=${f}&projectId=${this.projectId}`,chainId:f}}));return Object.assign({},...V)}}var ti=u(23429);class fu{constructor(V){const f=(0,ti.iP)({level:m.OH}),{logger:G,chunkLoggerController:ee}=(0,ti.D5)({opts:f});this.logger=(0,ti.U5)(G,this.constructor.name),this.chunkLoggerController=ee,typeof window<"u"&&this.chunkLoggerController?.downloadLogsBlobInBrowser&&(window.downloadAppKitLogsBlob||(window.downloadAppKitLogsBlob={}),window.downloadAppKitLogsBlob.sdk=()=>{this.chunkLoggerController?.downloadLogsBlobInBrowser&&this.chunkLoggerController.downloadLogsBlobInBrowser({projectId:V})})}}function wo(q){if("bigint"==typeof q)return`0x${q.toString(16)}`;if(Array.isArray(q))return q.map(wo);if(null!==q&&"object"==typeof q){const V={};for(const[f,G]of Object.entries(q))V[f]=wo(G);return V}return q}class hu{constructor({projectId:V,chainId:f,enableLogger:G=!0,onTimeout:ee,abortController:de,getActiveCaipNetwork:fe,getCaipNetworks:Ie,enableCloudAuthAccount:Ge,metadata:dt,sdkVersion:_t,sdkType:Rt}){this.openRpcRequests=new Map,this.isInitialized=!1,G&&(this.w3mLogger=new fu(V)),this.abortController=de,this.getActiveCaipNetwork=fe,this.getCaipNetworks=Ie;const Sn=this.getRpcUrl(f);this.projectId=V,this.sdkVersion=_t,this.sdkType=Rt,this.metadata=dt,this.w3mFrame=new Fa({projectId:V,isAppClient:!0,chainId:f,enableLogger:G,rpcUrl:Sn,enableCloudAuthAccount:Ge}),this.onTimeout=ee,this.getLoginEmailUsed()&&this.createFrame()}createFrame(){var V=this;return(0,S.A)(function*(){V.w3mFrame.initFrame(),V.initPromise=new Promise(f=>{V.w3mFrame.events.onFrameEvent(G=>{G.type===m.s1.FRAME_READY&&setTimeout(()=>{f()},500)})}),yield V.initPromise,yield V.syncDappData({metadata:V.metadata,projectId:V.projectId,sdkVersion:V.sdkVersion,sdkType:V.sdkType}),yield V.getSmartAccountEnabledNetworks(),V.isInitialized=!0,V.initPromise=void 0})()}init(){var V=this;return(0,S.A)(function*(){if(!V.isInitialized){if(V.initPromise)return void(yield V.initPromise);yield V.createFrame()}})()}getLoginEmailUsed(){return!!In.o.get(m.s1.EMAIL_LOGIN_USED_KEY)}getEmail(){return In.o.get(m.s1.EMAIL)}getUsername(){return In.o.get(m.s1.SOCIAL_USERNAME)}reload(){var V=this;return(0,S.A)(function*(){try{yield V.appEvent({type:m.s1.APP_RELOAD})}catch(f){throw V.w3mLogger?.logger.error({error:f},"Error reloading iframe"),f}})()}connectEmail(V){var f=this;return(0,S.A)(function*(){try{j.Q.checkIfAllowedToTriggerEmail(),yield f.init();const G=yield f.appEvent({type:m.s1.APP_CONNECT_EMAIL,payload:V});return f.setNewLastEmailLoginTime(),G}catch(G){throw f.w3mLogger?.logger.error({error:G},"Error connecting email"),G}})()}connectDevice(){var V=this;return(0,S.A)(function*(){try{return V.appEvent({type:m.s1.APP_CONNECT_DEVICE})}catch(f){throw V.w3mLogger?.logger.error({error:f}
193,"Error connecting device"),f}})()}connectOtp(V){var f=this;return(0,S.A)(function*(){try{return f.appEvent({type:m.s1.APP_CONNECT_OTP,payload:V})}catch(G){throw f.w3mLogger?.logger.error({error:G},"Error connecting otp"),G}})()}isConnected(){var V=this;return(0,S.A)(function*(){try{if(!V.getLoginEmailUsed())return{isConnected:!1};const f=yield V.appEvent({type:m.s1.APP_IS_CONNECTED});return f?.isConnected||V.deleteAuthLoginCache(),f}catch(f){throw V.deleteAuthLoginCache(),V.w3mLogger?.logger.error({error:f},"Error checking connection"),f}})()}getChainId(){var V=this;return(0,S.A)(function*(){try{const f=yield V.appEvent({type:m.s1.APP_GET_CHAIN_ID});return V.setLastUsedChainId(f.chainId),f}catch(f){throw V.w3mLogger?.logger.error({error:f},"Error getting chain id"),f}})()}getSocialRedirectUri(V){var f=this;return(0,S.A)(function*(){try{return yield f.init(),f.appEvent({type:m.s1.APP_GET_SOCIAL_REDIRECT_URI,payload:V})}catch(G){throw f.w3mLogger?.logger.error({error:G},"Error getting social redirect uri"),G}})()}updateEmail(V){var f=this;return(0,S.A)(function*(){try{const G=yield f.appEvent({type:m.s1.APP_UPDATE_EMAIL,payload:V});return f.setNewLastEmailLoginTime(),G}catch(G){throw f.w3mLogger?.logger.error({error:G},"Error updating email"),G}})()}updateEmailPrimaryOtp(V){var f=this;return(0,S.A)(function*(){try{return f.appEvent({type:m.s1.APP_UPDATE_EMAIL_PRIMARY_OTP,payload:V}
193)}catch(G){throw f.w3mLogger?.logger.error({error:G},"Error updating email primary otp"),G}})()}updateEmailSecondaryOtp(V){var f=this;return(0,S.A)(function*(){try{const G=yield f.appEvent({type:m.s1.APP_UPDATE_EMAIL_SECONDARY_OTP,payload:V});return f.setLoginSuccess(G.newEmail),G}catch(G){throw f.w3mLogger?.logger.error({error:G},"Error updating email secondary otp"),G}})()}syncTheme(V){var f=this;return(0,S.A)(function*(){try{return f.appEvent({type:m.s1.APP_SYNC_THEME,payload:V})}catch(G){throw f.w3mLogger?.logger.error({error:G},"Error syncing theme"),G}})()}syncDappData(V){var f=this;return(0,S.A)(function*(){try{return f.appEvent({type:m.s1.APP_SYNC_DAPP_DATA,payload:V})}catch(G){throw f.w3mLogger?.logger.error({error:G},"Error syncing dapp data"),G}})()}getSmartAccountEnabledNetworks(){var V=this;return(0,S.A)(function*(){try{const f=yield V.appEvent({type:m.s1.APP_GET_SMART_ACCOUNT_ENABLED_NETWORKS});return V.persistSmartAccountEnabledNetworks(f.smartAccountEnabledNetworks),f}catch(f){throw V.persistSmartAccountEnabledNetworks([]),V.w3mLogger?.logger.error({error:f},"Error getting smart account enabled networks"),f}})()}setPreferredAccount(V){var f=this;return(0,S.A)(function*(){try{return f.appEvent({type:m.s1.APP_SET_PREFERRED_ACCOUNT,payload:{type:V}})}catch(G){throw f.w3mLogger?.logger.error({error:G},"Error setting preferred account"),G}})()}connect(V){var f=this;return(0,S.A)(function*(){if(V?.socialUri)try{yield f.init();const G=f.getRpcUrl(V.chainId),ee=yield f.appEvent({type:m.s1.APP_CONNECT_SOCIAL,payload:{uri:V.socialUri,preferredAccountType:V.preferredAccountType,chainId:V.chainId,siwxMessage:V.siwxMessage,rpcUrl:G}});return ee.userName&&f.setSocialLoginSuccess(ee.userName),f.setLoginSuccess(ee.email),f.setLastUsedChainId(ee.chainId),f.user=ee,ee}catch(G){throw f.w3mLogger?.logger.error({error:G},"Error connecting social"),G}else try{const G=V?.chainId||f.getLastUsedChainId()||1,ee=yield f.getUser({chainId:G,preferredAccountType:V?.preferredAccountType,siwxMessage:V?.siwxMessage,rpcUrl:f.getRpcUrl(G)});return f.setLoginSuccess(ee.email),f.setLastUsedChainId(ee.chainId),f.user=ee,ee}catch(G){throw f.w3mLogger?.logger.error({error:G},"Error connecting"),G}})()}getUser(V){var f=this;return(0,S.A)(function*(){try{yield f.init();const G=V?.chainId||f.getLastUsedChainId()||1,ee=yield f.appEvent({type:m.s1.APP_GET_USER,payload:{...V,chainId:G,rpcUrl:f.getRpcUrl(G)}});return f.user=ee,ee}catch(G){throw f.w3mLogger?.logger.error({error:G},"Error connecting"),G}})()}connectSocial(V){var f=this;return(0,S.A)(function*({uri:G,chainId:ee,preferredAccountType:de}){try{yield f.init();const fe=f.getRpcUrl(ee),Ie=yield f.appEvent({type:m.s1.APP_CONNECT_SOCIAL,payload:{uri:G,chainId:ee,rpcUrl:fe,preferredAccountType:de}});return Ie.userName&&f.setSocialLoginSuccess(Ie.userName),Ie}catch(fe){throw f.w3mLogger?.logger.error({error:fe},"Error connecting social"),fe}}).apply(this,arguments)}getFarcasterUri(){var V=this;return(0,S.A)(function*(){try{return yield V.init(),yield V.appEvent({type:m.s1.APP_GET_FARCASTER_URI})}catch(f){throw V.w3mLogger?.logger.error({error:f},"Error getting farcaster uri"),f}})()}connectFarcaster(){var V=this;return(0,S.A)(function*(){try{const f=yield V.appEvent({type:m.s1.APP_CONNECT_FARCASTER});return f.userName&&V.setSocialLoginSuccess(f.userName),f}catch(f){throw V.w3mLogger?.logger.error({error:f},"Error connecting farcaster"),f}})()}switchNetwork(V){var f=this;return(0,S.A)(function*({chainId:G}){try{const ee=f.getRpcUrl(G),de=yield f.appEvent({type:m.s1.APP_SWITCH_NETWORK,payload:{chainId:G,rpcUrl:ee}});return f.setLastUsedChainId(de.chainId),de}catch(ee){throw f.w3mLogger?.logger.error({error:ee},"Error switching network"),ee}}).apply(this,arguments)}disconnect(){var V=this;return(0,S.A)(function*(){try{return V.deleteAuthLoginCache(),yield new Promise(function(){var G=(0,S.A)(function*(ee){const de=setTimeout(()=>{ee()},3e3);yield V.appEvent({type:m.s1.APP_SIGN_OUT}),clearTimeout(de),ee()});return function(ee){return G.apply(this,arguments)}}())}catch(f){throw V.w3mLogger?.logger.error({error:f},"Error disconnecting"),f}})()}request(V){var f=this;return(0,S.A)(function*(){const G=V;
193try{if(m.Vl.GET_CHAIN_ID===V.method)return f.getLastUsedChainId();const ee=V.chainNamespace||"eip155",de=f.getActiveCaipNetwork(ee)?.id;G.chainNamespace=ee,G.chainId=de,G.rpcUrl=f.getRpcUrl(de),f.rpcRequestHandler?.(V);const fe=yield f.appEvent({type:m.s1.APP_RPC_REQUEST,payload:wo(G)});return f.rpcSuccessHandler?.(fe,G),fe}catch(ee){throw f.rpcErrorHandler?.(ee,G),f.w3mLogger?.logger.error({error:ee},"Error requesting"),ee}})()}onRpcRequest(V){this.rpcRequestHandler=V}onRpcSuccess(V){this.rpcSuccessHandler=V}onRpcError(V){this.rpcErrorHandler=V}onIsConnected(V){this.w3mFrame.events.onFrameEvent(f=>{f.type===m.s1.FRAME_IS_CONNECTED_SUCCESS&&f.payload.isConnected&&V()})}onNotConnected(V){this.w3mFrame.events.onFrameEvent(f=>{f.type===m.s1.FRAME_IS_CONNECTED_ERROR&&V(),f.type===m.s1.FRAME_IS_CONNECTED_SUCCESS&&!f.payload.isConnected&&V()})}onConnect(V){this.w3mFrame.events.onFrameEvent(f=>{f.type===m.s1.FRAME_GET_USER_SUCCESS&&V(f.payload)})}onSocialConnected(V){this.w3mFrame.events.onFrameEvent(f=>{f.type===m.s1.FRAME_CONNECT_SOCIAL_SUCCESS&&V(f.payload)})}getCapabilities(){var V=this;return(0,S.A)(function*(){try{return(yield V.request({method:"wallet_getCapabilities"}))||{}}catch{return{}}})()}onSetPreferredAccount(V){this.w3mFrame.events.onFrameEvent(f=>{f.type===m.s1.FRAME_SET_PREFERRED_ACCOUNT_SUCCESS?V(f.payload):f.type===m.s1.FRAME_SET_PREFERRED_ACCOUNT_ERROR&&V({type:m.Vl.ACCOUNT_TYPES.EOA})})}getAvailableChainIds(){return Object.keys(this.w3mFrame.networks)}rejectRpcRequests(){var V=this;return(0,S.A)(function*(){try{yield Promise.all(Array.from(V.openRpcRequests.values()).map(function(){var f=(0,S.A)(function*({abortController:G,method:ee}){m.Vl.SAFE_RPC_METHODS.includes(ee)||G.abort(),yield V.appEvent({type:m.s1.APP_RPC_ABORT})});return function(G){return f.apply(this,arguments)}}())),V.openRpcRequests.clear()}catch(f){V.w3mLogger?.logger.error({error:f},"Error aborting RPC request")}})()}appEvent(V){var f=this;return(0,S.A)(function*(){let G,ee;function de(dt){return dt.replace("@w3m-app/","")}const fe=[m.s1.APP_SYNC_DAPP_DATA,m.s1.APP_SYNC_THEME,m.s1.APP_SET_PREFERRED_ACCOUNT],Ie=de(V.type);return!f.w3mFrame.iframeIsReady&&!fe.includes(V.type)&&(ee=setTimeout(()=>{f.onTimeout?.("iframe_load_failed"),f.abortController.abort()},2e4)),yield f.w3mFrame.frameLoadPromise,clearTimeout(ee),[m.s1.APP_CONNECT_EMAIL,m.s1.APP_CONNECT_DEVICE,m.s1.APP_CONNECT_OTP,m.s1.APP_CONNECT_SOCIAL,m.s1.APP_GET_SOCIAL_REDIRECT_URI].map(de).includes(Ie)&&(G=setTimeout(()=>{f.onTimeout?.("iframe_request_timeout"),f.abortController.abort()},12e4)),new Promise((dt,_t)=>{const Rt=Math.random().toString(36).substring(7);f.w3mLogger?.logger.info?.({event:V,id:Rt},"Sending app event"),f.w3mFrame.events.postAppEvent({...V,id:Rt});const Sn=new AbortController;"RPC_REQUEST"===Ie&&f.openRpcRequests.set(Rt,{...V.payload,abortController:Sn}),Sn.signal.addEventListener("abort",()=>{"RPC_REQUEST"===Ie?_t(new Error("Request was aborted")):"GET_FARCASTER_URI"!==Ie&&_t(new Error("Something went wrong"))}),f.w3mFrame.events.registerFrameEventHandler(Rt,Vn=>((Vn,pu)=>{Vn.id===Rt&&(pu?.logger.info?.({framEvent:Vn,id:Rt},"Received frame response"),f.openRpcRequests.delete(Vn.id),Vn.type===`@w3m-frame/${Ie}_SUCCESS`?(G&&clearTimeout(G),ee&&clearTimeout(ee),"payload"in Vn&&dt(Vn.payload),dt(void 0)):Vn.type===`@w3m-frame/${Ie}_ERROR`&&(G&&clearTimeout(G),ee&&clearTimeout(ee),"payload"in Vn&&_t(new Error(Vn.payload?.message||"An error occurred")),_t(new Error("An error occurred"))))})(Vn,f.w3mLogger),f.abortController.signal)})})()}setNewLastEmailLoginTime(){In.o.set(m.s1.LAST_EMAIL_LOGIN_TIME,Date.now().toString())}setSocialLoginSuccess(V){In.o.set(m.s1.SOCIAL_USERNAME,V)}setLoginSuccess(V){V&&In.o.set(m.s1.EMAIL,V),In.o.set(m.s1.EMAIL_LOGIN_USED_KEY,"true"),In.o.delete(m.s1.LAST_EMAIL_LOGIN_TIME)}deleteAuthLoginCache(){In.o.delete(m.s1.EMAIL_LOGIN_USED_KEY),In.o.delete(m.s1.EMAIL),In.o.delete(m.s1.LAST_USED_CHAIN_KEY),In.o.delete(m.s1.SOCIAL_USERNAME)}setLastUsedChainId(V){V&&In.o.set(m.s1.LAST_USED_CHAIN_KEY,String(V))}getLastUsedChainId(){const V=In.o.get(m.s1.LAST_USED_CHAIN_KEY)??void 0,f=Number(V);return isNaN(f)?V:f}persistSmartAccountEnabledNetworks(V){In.o.set(m.s1.SMART_ACCOUNT_ENABLED_NETWORKS,V.join(","))}getRpcUrl(V){let f=void 0===V?void 0:"eip155";"string"==typeof V&&(f=V.includes(":")?P.C.parseCaipNetworkId(V)?.chainNamespace:Number.isInteger(Number(V))?"eip155":"solana");const G=this.getCaipNetworks(f);return(V?G.find(de=>String(de.id)===String(V)||de.caipNetworkId===V):G[0])?.rpcUrls.default.http?.[0]}}},66689(Ve,ne,u){"use strict";u.d(ne,{o:()=>K});var S=u(69245),P=u(79769);const K={set(m,j){P.Q.isClient&&localStorage.setItem(`${S.s1.STORAGE_KEY}${m}`,j)},get:m=>P.Q.isClient?localStorage.getItem(`${S.s1.STORAGE_KEY}${m}`):null,delete(m,j){P.Q.isClient&&(j?localStorage.removeItem(m):localStorage.removeItem(`${S.s1.STORAGE_KEY}${m}`))}}},72030(Ve,ne,u){"use strict";u.r(ne),u.d(ne,{AppKit:()=>Ft,CoreHelperUtil:()=>S.w,WcConstantsUtil:()=>Je,createAppKit:()=>bn});var S=u(66915),P=u(10467),K=u(30193),m=u(61113),j=u(33775),R=u(96667),k=u(2788
1931),v=u(78977),$=u(34153),x=u(22805),U=u(62132),X=u(17398),B=u(49519),p=u(47040),l=u(17895),O=u(83379),L=u(73387),_=u(30600),I=u(25637),D=u(32129),H=u(82905),z=u(6542),T=u(79769),W=u(69245),A=u(40641);class E{constructor(){}static getInstance({projectId:N,chainId:Y,enableLogger:Z,onTimeout:ie,abortController:he,getActiveCaipNetwork:Oe,getCaipNetworks:$e}){const{metadata:it,sdkVersion:Qe,sdkType:Ut}=p.H.getSnapshot();return E.instance||(E.instance=new A.Y({projectId:N,chainId:Y,enableLogger:Z,onTimeout:ie,abortController:he,getActiveCaipNetwork:Oe,getCaipNetworks:$e,enableCloudAuthAccount:!!p.H.state.remoteFeatures?.emailCapture,metadata:it,sdkVersion:Qe,sdkType:Ut})),E.instance}}var g=u(79231),w=u(68095),C=u(61314),y=u(86107),F=u(32428),Q=u(37642),ge=u(64096),ce=u(13138),Ae=u(43805),Te=u(95051),ve=u(97114),We=u(19069),Ke=u(53654),Et=u(42408),jt=u(42877),Pt=u(54665),wt=u(9433);const at={TOKEN_ADDRESSES_BY_SYMBOL:{USDC:{8453:wt.$f.asset,84532:wt.sP.asset}},getTokenSymbolByAddress(qe){if(!qe)return;const[N]=Object.entries(at.TOKEN_ADDRESSES_BY_SYMBOL).find(([Y,Z])=>Object.values(Z).includes(qe))??[];return N}};var xe=u(65869),tt=u(23429);const nt={createLogger(qe,N="error"){const Y=(0,tt.iP)({level:N}),{logger:Z}=(0,tt.D5)({opts:Y});return Z.error=(...ie)=>{for(const he of ie)if(he instanceof Error)return void qe(he,...ie);qe(void 0,...ie)},Z}};var lt=u(10832),Nt=u(34755),Le=u(53681),ct=u(63896);const Je={ERROR_CODE_UNRECOGNIZED_CHAIN_ID:4902,ERROR_CODE_DEFAULT:5e3,ERROR_INVALID_CHAIN_ID:32603};class ut extends Le.X{setUniversalProvider(N){var Y=this;return(0,P.A)(function*(){if(!Y.namespace)throw new Error("UniversalAdapter:setUniversalProvider - namespace is required");return Y.addConnector(new ct.F({provider:N,caipNetworks:Y.getCaipNetworks(),namespace:Y.namespace})),Promise.resolve()})()}connect(N){var Y=this;return(0,P.A)(function*(){return Promise.resolve({id:"WALLET_CONNECT",type:"WALLET_CONNECT",chainId:Number(N.chainId),provider:Y.provider,address:""})})()}disconnect(){var N=this;return(0,P.A)(function*(){try{yield N.getWalletConnectConnector().disconnect(),N.emit("disconnect")}catch(Y){console.warn("UniversalAdapter:disconnect - error",Y)}return{connections:[]}})()}syncConnections(){return Promise.resolve()}writeSolanaTransaction(){return(0,P.A)(function*(){return Promise.resolve({hash:""})})()}getAccounts(N){var Y=this;return(0,P.A)(function*({namespace:Z}){const he=(Y.provider?.session?.namespaces?.[Z]?.accounts||[]).filter((Oe,$e,it)=>it.indexOf(Oe)===$e);return Promise.resolve({accounts:he.map(Oe=>S.w.createAccount({caipAddress:Oe,type:"bip122"===Z?"payment":"eoa"}))})}).apply(this,arguments)}syncConnectors(){return(0,P.A)(function*(){return Promise.resolve()})()}getBalance(N){return(0,P.A)(function*(){if(!N.caipNetwork||!B.oU.BALANCE_SUPPORTED_CHAINS.includes(N.caipNetwork?.chainNamespace)||N.caipNetwork?.testnet)return{balance:"0.00",symbol:N.caipNetwork?.nativeCurrency.symbol||""};const Z=l.W.getAccountData();if(Z?.balanceLoading&&N.chainId===l.W.state.activeCaipNetwork?.id)return{balance:Z?.balance||"0.00",symbol:Z?.balanceSymbol||""};const he=(yield l.W.fetchTokenBalance()).find(Oe=>Oe.chainId===`${N.caipNetwork?.chainNamespace}:${N.chainId}`&&Oe.symbol===N.caipNetwork?.nativeCurrency.symbol);return{balance:he?.quantity.numeric||"0.00",symbol:he?.symbol||N.caipNetwork?.nativeCurrency.symbol||""}})()}signMessage(N){return(0,P.A)(function*(){const{provider:Y,message:Z,address:ie}=N;if(!Y)throw new Error("UniversalAdapter:signMessage - provider is undefined");let he="";return he=l.W.state.activeCaipNetwork?.chainNamespace===K.o.CHAIN.SOLANA?(yield Y.request({method:"solana_signMessage",params:{message:lt.default.encode((new TextEncoder).encode(Z)),pubkey:ie}},l.W.state.activeCaipNetwork?.caipNetworkId)).signature:yield Y.request({method:"personal_sign",params:[Z,ie]},l.W.state.activeCaipNetwork?.caipNetworkId),{signature:he}})()}estimateGas(){return(0,P.A)(function*(){return Promise.resolve({gas:BigInt(0)})})()}sendTransaction(){return(0,P.A)(function*(){return Promise.resolve({hash:""})})()}walletGetAssets(N){return Promise.resolve({})}writeContract(){return(0,P.A)(function*(){return Promise.resolve({hash:""})})()}emitFirstAvailableConnection(){}parseUnits(){return 0n}formatUnits(){return"0"}getCapabilities(){return(0,P.A)(function*(){return Promise.resolve({})})()}grantPermissions(){return(0,P.A)(function*(){return Promise.resolve({})})()}revokePermissions(){return(0,P.A)(function*(){return Promise.resolve("0x")})()}syncConnection(){var N=this;return(0,P.A)(function*(){return Promise.resolve({id:"WALLET_CONNECT",type:"WALLET_CONNECT",chainId:1,provider:N.provider,address:""})})()}switchNetwork(N){var Y=this;return(0,P.A)(function*(){const{caipNetwork:Z}=N,ie=Y.getWalletConnectConnector();if(Z.chainNamespace===K.o.CHAIN.EVM)try{yield ie.provider?.request({method:"wallet_switchEthereumChain",params:[{chainId:(0,Nt.
193nj)(Z.id)}]})}catch(he){if(he.code===Je.ERROR_CODE_UNRECOGNIZED_CHAIN_ID||he.code===Je.ERROR_INVALID_CHAIN_ID||he.code===Je.ERROR_CODE_DEFAULT||he?.data?.originalError?.code===Je.ERROR_CODE_UNRECOGNIZED_CHAIN_ID)try{yield ie.provider?.request({method:"wallet_addEthereumChain",params:[{chainId:(0,Nt.nj)(Z.id),rpcUrls:[Z?.rpcUrls.chainDefault?.http],chainName:Z.name,nativeCurrency:Z.nativeCurrency,blockExplorerUrls:[Z.blockExplorers?.default.url]}]})}catch{throw new Error("Chain is not supported")}}ie.provider?.setDefaultChain(Z.caipNetworkId)})()}getWalletConnectProvider(){return this.connectors.find(Z=>"WALLET_CONNECT"===Z.type)?.provider}}const bt=["email","socials","swaps","onramp","activity","reownBranding","multiWallet","emailCapture","payWithExchange","payments","reownAuthentication","headless"],Xe={email:{apiFeatureName:"social_login",localFeatureName:"email",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:qe=>!!qe?.config&&(!!qe.isEnabled&&qe.config.includes("email")),processFallback:qe=>void 0===qe?B.oU.DEFAULT_REMOTE_FEATURES.email:!!qe},socials:{apiFeatureName:"social_login",localFeatureName:"socials",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:qe=>{if(!qe?.config)return!1;const N=qe.config;return!!(qe.isEnabled&&N.length>0)&&N.filter(Y=>"email"!==Y)},processFallback:qe=>void 0===qe?B.oU.DEFAULT_REMOTE_FEATURES.socials:"boolean"==typeof qe?!!qe&&B.oU.DEFAULT_REMOTE_FEATURES.socials:qe},swaps:{apiFeatureName:"swap",localFeatureName:"swaps",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:qe=>{if(!qe?.config)return!1;const N=qe.config;return!!(qe.isEnabled&&N.length>0)&&N},processFallback:qe=>void 0===qe?B.oU.DEFAULT_REMOTE_FEATURES.swaps:"boolean"==typeof qe?!!qe&&B.oU.DEFAULT_REMOTE_FEATURES.swaps:qe},onramp:{apiFeatureName:"onramp",localFeatureName:"onramp",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:qe=>{if(!qe?.config)return!1;const N=qe.config;return!!(qe.isEnabled&&N.length>0)&&N},processFallback:qe=>void 0===qe?B.oU.DEFAULT_REMOTE_FEATURES.onramp:"boolean"==typeof qe?!!qe&&B.oU.DEFAULT_REMOTE_FEATURES.onramp:qe},activity:{apiFeatureName:"activity",localFeatureName:"history",returnType:!1,isLegacy:!0,isAvailableOnBasic:!1,processApi:qe=>!!qe.isEnabled,processFallback:qe=>void 0===qe?B.oU.DEFAULT_REMOTE_FEATURES.activity:!!qe},reownBranding:{apiFeatureName:"reown_branding",localFeatureName:"reownBranding",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:qe=>!!qe.isEnabled,processFallback:qe=>void 0===qe?B.oU.DEFAULT_REMOTE_FEATURES.reownBranding:!!qe},emailCapture:{apiFeatureName:"email_capture",localFeatureName:"emailCapture",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:qe=>qe.isEnabled&&(qe.config??[]),processFallback:qe=>!1},multiWallet:{apiFeatureName:"multi_wallet",localFeatureName:"multiWallet",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:qe=>!!qe.isEnabled,processFallback:()=>B.oU.DEFAULT_REMOTE_FEATURES.multiWallet},payWithExchange:{apiFeatureName:"fund_from_exchange",localFeatureName:"payWithExchange",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:qe=>!!qe.isEnabled,processFallback:()=>B.oU.DEFAULT_REMOTE_FEATURES.payWithExchange},payments:{apiFeatureName:"payments",localFeatureName:"payments",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:qe=>!!qe.isEnabled,processFallback:()=>B.oU.DEFAULT_REMOTE_FEATURES.payments},reownAuthentication:{apiFeatureName:"reown_authentication",localFeatureName:"reownAuthentication",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:qe=>!!qe.isEnabled,processFallback:qe=>typeof qe>"u"?B.oU.DEFAULT_REMOTE_FEATURES.reownAuthentication:!!qe},headless:{apiFeatureName:"headless",localFeatureName:"headless",returnType:!1,isLegacy:!1,isAvailableOnBasic:!1,processApi:qe=>!!qe.isEnabled,processFallback:()=>B.oU.DEFAULT_REMOTE_FEATURES.headless}},yt={localSettingsOverridden:new Set,getApiConfig:(qe,N)=>N?.find(Y=>Y.id===qe),addWarning(qe,N){if(void 0!==qe){const Y=Xe[N];this.localSettingsOverridden.add(Y.isLegacy?`"features.${Y.localFeatureName}" (now "${N}")`:`"features.${N}"`)}},processFeature(qe,N,Y,Z,ie){const he=Xe[qe],Oe=N[he.localFeatureName];if(ie&&!he.isAvailableOnBasic)return!1;if(Z){const $e=this.getApiConfig(he.apiFeatureName,Y);return null===$e?.config?this.processFallbackFeature(qe,Oe):!!$e?.config&&(void 0!==Oe&&this.addWarning(Oe,qe),this.processApiFeature(qe,$e))}return this.processFallbackFeature(qe,Oe)},processApiFeature:(qe,N)=>Xe[qe].processApi(N),processFallbackFeature:(qe,N)=>Xe[qe].processFallback(N),fetchRemoteFeatures(qe){var N=this;return(0,P.A)(function*(){const Y=qe.basic??!1,Z=qe.features||{};N.localSettingsOverridden.clear();let ie=null,he=!1;try{ie=yield X.N.fetchProjectConfig(),he=null!=ie}catch($e){console.warn("[Reown Config] Failed to fetch remote project configuration. Using local/default values.",$e)}const Oe=he&&!Y?B.oU.DEFAULT_REMOTE_FEATURES:B.oU.DEFAULT_REMOTE_FEATURES_DISABLED;try{for(const $e of bt){const it=N.processFeature($e,Z,ie,he,Y);Object.assign(Oe,{[$e]:it})}}catch($e){return console.warn("[Reown Config] Failed to process the configuration from Cloud. Using default values.",$e),B.oU.DEFAULT_REMOTE_FEATURES}if(he&&N.localSettingsOverridden.size>0){const $e=`Your local configuration for ${Array.from(N.localSettingsOverridden).join(", ")} was ignored because a remote configuration was successfully fetched. Please manage these features via your project dashboard on dashboard.reown.com.`;_.h.open({debugMessage:z.R.ALERT_WARNINGS.LOCAL_CONFIGURATION_IGNORED.debugMessage($e)},"warning")}return Oe})()}};class rt{constructor(N){var Y=this;this.chainNamespaces=[],this.features={},this.remoteFeatures={},this.reportedAlertErrors={},this.getCaipNetwork=(Z,ie)=>{if(Z){const he=l.W.getCaipNetworks(Z)?.find(it=>it.id===ie);if(he)return he;const Oe=l.W.getNetworkData(Z)?.caipNetwork;return Oe||l.W.getRequestedCaipNetworks(Z).filter(it=>it.chainNamespace===Z)?.[0]}return l.W.state.activeCaipNetwork||this.defaultCaipNetwork},this.getCaipNetworkId=()=>{const Z=this.getCaipNetwork();if(Z)return Z.id},this.getCaipNetworks=Z=>l.W.getCaipNetworks(Z),this.getActiveChainNamespace=()=>l.W.state.activeChain,this.setRequestedCaipNetworks=(Z,ie)=>{l.W.setRequestedCaipNetworks(Z,ie)},this.getApprovedCaipNetworkIds=()=>l.W.getAllApprovedCaipNetworkIds(),this.getCaipAddress=Z=>l.W.state.activeChain!==Z&&Z?l.W.state.chains.get(Z)?.accountState?.caipAddress:l.W.state.activeCaipAddress,this.setClientId=Z=>{y.T.setClientId(Z)},this.getProvider=Z=>I.G.getProvider(Z),this.getProviderType=Z=>I.G.getProviderId(Z),this.getPreferredAccountType=Z=>(0,R.lj)(Z),this.setCaipAddress=(Z,ie,he=!1)=>
193{if(null!==Z){const Oe=Z.split(":");if(3!==Oe.length||Oe.some($e=>!$e))return void console.warn(`[AppKit] setCaipAddress: invalid CAIP-10 address rejected: "${Z}"`)}l.W.setAccountProp("caipAddress",Z,ie,he),l.W.setAccountProp("address",S.w.getPlainAddress(Z),ie,he)},this.setBalance=(Z,ie,he)=>{l.W.setAccountProp("balance",Z,he),l.W.setAccountProp("balanceSymbol",ie,he)},this.setProfileName=(Z,ie)=>{l.W.setAccountProp("profileName",Z,ie)},this.setProfileImage=(Z,ie)=>{l.W.setAccountProp("profileImage",Z,ie)},this.setUser=(Z,ie)=>{l.W.setAccountProp("user",Z,ie)},this.resetAccount=Z=>{l.W.resetAccount(Z)},this.setCaipNetwork=Z=>{l.W.setActiveCaipNetwork(Z)},this.setCaipNetworkOfNamespace=(Z,ie)=>{l.W.setChainNetworkData(ie,{caipNetwork:Z})},this.setStatus=(Z,ie)=>{l.W.setAccountProp("status",Z,ie),k.a.isConnected()?L.i.setConnectionStatus("connected"):L.i.setConnectionStatus("disconnected")},this.getAddressByChainNamespace=Z=>l.W.getAccountData(Z)?.address,this.setConnectors=Z=>{const ie=[...k.a.state.allConnectors,...Z];k.a.setConnectors(ie)},this.setConnections=(Z,ie)=>{L.i.setConnections(Z,ie),x.x.setConnections(Z,ie)},this.fetchIdentity=Z=>y.T.fetchIdentity(Z),this.getReownName=Z=>F.f.getNamesForAddress(Z),this.getConnectors=()=>k.a.getConnectors(),this.getConnectorImage=Z=>Q.$.getConnectorImage(Z),this.getConnections=Z=>this.remoteFeatures.multiWallet?ge.b.getConnectionsData(Z).connections:(_.h.open(K.o.REMOTE_FEATURES_ALERTS.MULTI_WALLET_NOT_ENABLED.DEFAULT,"info"),[]),this.getRecentConnections=Z=>this.remoteFeatures.multiWallet?ge.b.getConnectionsData(Z).recentConnections:(_.h.open(K.o.REMOTE_FEATURES_ALERTS.MULTI_WALLET_NOT_ENABLED.DEFAULT,"info"),[]),this.switchConnection=function(){var Z=(0,P.A)(function*(ie){Y.remoteFeatures.multiWallet?yield x.x.switchConnection(ie):_.h.open(K.o.REMOTE_FEATURES_ALERTS.MULTI_WALLET_NOT_ENABLED.DEFAULT,"info")});return function(ie){return Z.apply(this,arguments)}}(),this.deleteConnection=Z=>{this.remoteFeatures.multiWallet?(L.i.deleteAddressFromConnection(Z),x.x.syncStorageConnections()):_.h.open(K.o.REMOTE_FEATURES_ALERTS.MULTI_WALLET_NOT_ENABLED.DEFAULT,"info")},this.setConnectedWalletInfo=(Z,ie)=>{const he=I.G.getProviderId(ie),Oe=Z?{...Z,type:he}:void 0;l.W.setAccountProp("connectedWalletInfo",Oe,ie)},this.getIsConnectedState=()=>!!l.W.state.activeCaipAddress,this.addAddressLabel=(Z,ie,he)=>{const Oe=l.W.getAccountData(he)?.addressLabels||{};l.W.setAccountProp("addressLabels",{...Oe,[Z]:ie},he)},this.removeAddressLabel=(Z,ie)=>{const he=l.W.getAccountData(ie)?.addressLabels||{};l.W.setAccountProp("addressLabels",{...he,[Z]:void 0},ie)},this.getAddress=Z=>{const ie=Z||l.W.state.activeChain;return l.W.getAccountData(ie)?.address},this.resetNetwork=Z=>{l.W.resetNetwork(Z)},this.addConnector=Z=>{k.a.addConnector(Z)},this.resetWcConnection=()=>{x.x.resetWcConnection()},this.setAddressExplorerUrl=(Z,ie)=>{l.W.setAccountProp("addressExplorerUrl",Z,ie)},this.setSmartAccountDeployed=(Z,ie)=>{l.W.setAccountProp("smartAccountDeployed",Z,ie)},this.setPreferredAccountType=(Z,ie)=>{l.W.setAccountProp("preferredAccountType",Z,ie)},this.setEIP6963Enabled=Z=>{p.H.setEIP6963Enabled(Z)},this.handleUnsafeRPCRequest=()=>{if(this.isOpen()){if(this.isTransactionStackEmpty())return;this.redirect("ApproveTransaction")}else this.open({view:"ApproveTransaction"})},this.options=N,this.version=N.sdkVersion,this.caipNetworks=this.extendCaipNetworks(N),this.chainNamespaces=this.getChainNamespacesSet(N.adapters,this.caipNetworks),this.defaultCaipNetwork=this.extendDefaultCaipNetwork(N),this.chainAdapters=this.createAdapters(N.adapters),this.readyPromise=this.initialize(N)}getChainNamespacesSet(N,Y){const Z=N?.map(he=>he.namespace).filter(he=>!!he);if(Z?.length)return[...new Set(Z)];const ie=Y?.map(he=>he.chainNamespace);return[...new Set(ie)]}initialize(N){var Y=this;return(0,P.A)(function*(){if(Y.initializeProjectSettings(N),Y.initControllers(N),yield Y.initChainAdapters(),Y.sendInitializeEvent(N),N.features?.headless&&!ce.g.hasInjectedConnectors()&&X.N.prefetch({fetchNetworkImages:!1,fetchConnectorImages:!1,fetchWalletRanks:!1,fetchRecommendedWallets:!0}),p.H.state.enableReconnect?(yield Y.syncExistingConnection(),yield Y.syncAdapterConnections()):yield Y.unSyncExistingConnection(),!N.basic&&!N.manualWCControl&&(Y.remoteFeatures=yield yt.fetchRemoteFeatures(N)),yield X.N.fetchUsage(),p.H.setRemoteFeatures(Y.remoteFeatures),Y.remoteFeatures.onramp&&Ae.aG.setOnrampProviders(Y.remoteFeatures.onramp),(p.H.state.remoteFeatures?.email||Array.isArray(p.H.state.remoteFeatures?.socials)&&p.H.state.remoteFeatures?.socials.length>0)&&(yield Y.checkAllowedOrigins()),p.H.state.features?.reownAuthentication||p.H.state.remoteFeatures?.reownAuthentication){const{ReownAuthentication:Z}=yield Promise.all([u.e(2076),u.e(7258)]).then(u.bind(u,97258)),ie=p.H.state.siwx;ie instanceof Z||(ie&&console.warn("ReownAuthentication option is enabled, SIWX configuration will be overridden."),p.H.setSIWX(new Z))}})()}openSend(N){var Y=this;return(0,P.A)(function*(){const Z=N.namespace||l.W.state.activeChain,ie=Y.getCaipAddress(Z),he=Y.getCaipNetwork(Z)?.id;if(!ie)throw new Error("openSend: caipAddress not found");if(he?.toString()!==N.chainId.toString()){const Oe=l.W.getCaipNetworkById(N.chainId,Z);if(!Oe)throw new Error(`openSend: caipNetwork with chainId ${N.chainId} not found`);yield Y.switchNetwork(Oe,{throwOnFailure:!0})}try{const Oe=at.getTokenSymbolByAddress(N.assetAddress);Oe&&(yield X.N.fetchTokenImages([Oe]))}catch{}return yield Te.W.open({view:"WalletSend",data:{send:N}}),new Promise((Oe,$e)=>{const it=ve.R.subscribeKey("hash",kt=>{kt&&(Ut(),Oe({hash:kt}))}),Qe=Te.W.subscribe(kt=>{kt.open||(Ut(),$e(new Error("Modal closed")))}),Ut=Y.createCleanupHandler([it,Qe])})})()}toModalOptions(){return{isSwap:function N(Z){return"Swap"===Z?.view},isSend:function Y(Z){return"WalletSend"===Z?.view}}}checkAllowedOrigins(){return(0,P.A)(function*(){try{const N=yield X.N.fetchAllowedOrigins();if(!S.w.isClient())return;const Y=window.location.origin;We.k.isOriginAllowed(Y,N,K.o.DEFAULT_ALLOWED_ANCESTORS)||_.h.open(z.R.ALERT_ERRORS.ORIGIN_NOT_ALLOWED,"error")}catch(N){if(!(N instanceof Error))return;switch(N.message){case"RATE_LIMITED":_.h.open(z.R.ALERT_ERRORS.RATE_LIMITED_APP_CONFIGURATION,"error");break;case"SERVER_ERROR":{const Y=N.cause instanceof Error?N.cause:N;_.h.open({displayMessage:z.R.ALERT_ERRORS.SERVER_ERROR_APP_CONFIGURATION.displayMessage,debugMessage:z.R.ALERT_ERRORS.SERVER_ERROR_APP_CONFIGURATION.debugMessage(Y.message)},"error");break}}}})()}createCleanupHandler(N){return()=>
193{N.forEach(Y=>{try{Y()}catch{}})}}sendInitializeEvent(N){const{...Y}=N;delete Y.adapters,delete Y.universalProvider,v.E.sendEvent({type:"track",event:"INITIALIZE",properties:{...Y,networks:N.networks.map(Z=>Z.id),siweConfig:{options:N.siweConfig?.options||{}}}})}initControllers(N){this.initializeOptionsController(N),this.initializeChainController(N),this.initializeThemeController(N),this.initializeConnectionController(N),this.initializeConnectorController()}initAdapterController(){Ke.q.initialize(this.chainAdapters)}initializeThemeController(N){N.themeMode&&O.W.setThemeMode(N.themeMode),N.themeVariables&&O.W.setThemeVariables(N.themeVariables)}initializeChainController(N){if(!this.connectionControllerClient)throw new Error("ConnectionControllerClient must be set");l.W.initialize(N.adapters??[],this.caipNetworks,{connectionControllerClient:this.connectionControllerClient});const Y=this.getDefaultNetwork();Y&&l.W.setActiveCaipNetwork(Y)}initializeConnectionController(N){x.x.initialize(N.adapters??[]),x.x.setWcBasic(N.basic??!1)}initializeConnectorController(){k.a.initialize(this.chainNamespaces)}initializeProjectSettings(N){p.H.setProjectId(N.projectId),p.H.setSdkVersion(N.sdkVersion)}initializeOptionsController(N){p.H.setDebug(!1!==N.debug),p.H.setEnableWalletGuide(!1!==N.enableWalletGuide),p.H.setEnableWallets(!1!==N.enableWallets),p.H.setEIP6963Enabled(!1!==N.enableEIP6963),p.H.setEnableInjected(!1!==N.enableInjected),p.H.setEnableCoinbase(!1!==N.enableCoinbase),p.H.setEnableNetworkSwitch(!1!==N.enableNetworkSwitch),p.H.setEnableReconnect(!1!==N.enableReconnect),p.H.setEnableMobileFullScreen(!0===N.enableMobileFullScreen),p.H.setCoinbasePreference(N.coinbasePreference),p.H.setEnableAuthLogger(!1!==N.enableAuthLogger),p.H.setCustomRpcUrls(N.customRpcUrls),p.H.setEnableEmbedded(N.enableEmbedded),p.H.setAllWallets(N.allWallets),p.H.setIncludeWalletIds(N.includeWalletIds),p.H.setExcludeWalletIds(N.excludeWalletIds),p.H.setFeaturedWalletIds(N.featuredWalletIds),p.H.setTokens(N.tokens),p.H.setTermsConditionsUrl(N.termsConditionsUrl),p.H.setPrivacyPolicyUrl(N.privacyPolicyUrl),p.H.setCustomWallets(N.customWallets),p.H.setFeatures(N.features),p.H.setAllowUnsupportedChain(N.allowUnsupportedChain),p.H.setUniversalProviderConfigOverride(N.universalProviderConfigOverride),p.H.setPreferUniversalLinks(N.experimental_preferUniversalLinks),p.H.setDefaultAccountTypes(N.defaultAccountTypes);const Y=this.getDefaultMetaData();if(!N.metadata&&Y&&(N.metadata=Y),p.H.setMetadata(N.metadata),p.H.setDisableAppend(N.disableAppend),p.H.setEnableEmbedded(N.enableEmbedded),p.H.setSIWX(N.siwx),this.features=p.H.state.features??{},N.projectId){if(N.adapters?.find(ie=>ie.namespace===K.o.CHAIN.EVM)&&N.siweConfig){if(N.siwx)throw new Error("Cannot set both `siweConfig` and `siwx` options");p.H.setSIWX(N.siweConfig.mapToSIWX())}}else _.h.open(z.R.ALERT_ERRORS.PROJECT_ID_NOT_CONFIGURED,"error")}getDefaultMetaData(){return S.w.isClient()?{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(N){const Y=this.getActiveChainNamespace();if(Y){const Z=xe.R.getUnsupportedNetwork(`${Y}:${N}`);l.W.setActiveCaipNetwork(Z)}}getDefaultNetwork(){return xe.R.getCaipNetworkFromStorage(this.defaultCaipNetwork)}extendCaipNetwork(N,Y){return xe.R.extendCaipNetwork(N,{customNetworkImageUrls:Y.chainImages,projectId:Y.projectId})}extendCaipNetworks(N){return xe.R.extendCaipNetworks(N.networks,{customNetworkImageUrls:N.chainImages,customRpcUrls:N.customRpcUrls,projectId:N.projectId})}extendDefaultCaipNetwork(N){const Y=N.networks.find(ie=>ie.id===N.defaultNetwork?.id);return Y?xe.R.extendCaipNetwork(Y,{customNetworkImageUrls:N.chainImages,customRpcUrls:N.customRpcUrls,projectId:N.projectId}):void 0}disconnectConnector(N,Y){var Z=this;return(0,P.A)(function*(){try{Z.setLoading(!0,N);let ie={connections:[]};const he=Z.getAdapter(N);return(l.W.state.chains.get(N)?.accountState?.caipAddress||!p.H.state.enableReconnect)&&he?.disconnect&&(ie=yield he.disconnect({id:Y})),Z.setLoading(!1,N),ie}catch(ie){throw Z.setLoading(!1,N),new Error(`Failed to disconnect chains: ${ie.message}`)}})()}createClients(){var Y,N=this;this.connectionControllerClient={connectWalletConnect:(Y=(0,P.A)(function*(){const Z=l.W.state.activeChain,ie=N.getAdapter(Z),he=N.getCaipNetwork(Z)?.id,Oe=x.x.getConnections(Z),$e=N.remoteFeatures.multiWallet,it=Oe.length>0;if(!ie)throw new Error("Adapter not found");const Qe=yield ie.connectWalletConnect(he);(!it||!$e)&&N.close(),N.setClientId(Qe?.clientId||null),L.i.setConnectedNamespaces([...l.W.state.chains.keys()]),yield N.syncWalletConnectAccount(),yield j.U.initializeIfEnabled()}),function(){return Y.apply(this,arguments)}),connectExternal:function(){var Y=(0,P.A)(function*(Z){const ie=yield N.onConnectExternal(Z);return yield N.connectInactiveNamespaces(Z,ie),ie?{address:ie.address}:void 0});return function(ie){return Y.apply(this,arguments)}}(),reconnectExternal:function(){var Y=(0,P.A)(function*({id:Z,info:ie,type:he,provider:Oe}){const $e=l.W.state.activeChain,it=N.getAdapter($e);if(!$e)throw new Error("reconnectExternal: namespace not found");if(!it)throw new Error("reconnectExternal: adapter not found");it?.reconnect&&(yield it?.reconnect({id:Z,info:ie,type:he,provider:Oe,chainId:N.getCaipNetwork()?.id}),L.i.addConnectedNamespace($e),N.syncConnectedWalletInfo($e))});return function(ie){return Y.apply(this,arguments)}}(),disconnectConnector:function(){var Y=(0,P.A)(function*(Z){yield N.disconnectConnector(Z.namespace,Z.id)});return function(ie){return Y.apply(this,arguments)}}(),disconnect:function(){var Y=(0,P.A)(function*(Z){const{id:ie,chainNamespace:he,initialDisconnect:Oe}=Z||{},it=k.a.getConnectorId(he||l.W.state.activeChain),Qe=ie===K.o.CONNECTOR_ID.AUTH||it===K.o.CONNECTOR_ID.AUTH,Ut=ie===K.o.CONNECTOR_ID.WALLET_CONNECT||it===K.o.CONNECTOR_ID.WALLET_CONNECT;try{const kt=Array.from(l.W.state.chains.keys());let Xt=he?[he]:kt;(Ut||Qe)&&(Xt=kt);const dn=Xt.map(function(){var Ue=(0,P.A)(function*(vt){const xt=k.a.getConnectorId(vt),Bt=ie||xt,Qt=yield N.disconnectConnector(vt,Bt);Qt&&(Qe&&L.i.deleteConnectedSocialProvider(),Qt.connections.forEach(Gt=>{L.i.addDisconnectedConnectorId(Gt.connectorId,vt)})),Oe&&N.onDisconnectNamespace({chainNamespace:vt,closeModal:!1})});return function(vt){return Ue.apply(this,arguments)}}()),me=yield Promise.allSettled(dn);ve.R.resetSend(),x.x.resetWcConnection(),j.U.getSIWX()?.signOutOnDisconnect&&(yield j.U.clearSessions()),k.a.setFilterByNamespace(void 0),x.x.syncStorageConnections();const _e=me.filter(Ue=>"rejected"===Ue.status);if(_e.length>0)throw new Error(_e.map(Ue=>Ue.reason.message).join(", "));v.E.sendEvent({type:"track",event:"DISCONNECT_SUCCESS",properties:{namespace:he||"all"}})}catch(kt){throw new Error(`Failed to disconnect chains: ${kt.message}`)}});return function(ie){return Y.apply(this,arguments)}}(),checkInstalled:Y=>Y?Y.some(Z=>!!window.ethereum?.[String(Z)]):!!window.ethereum,signMessage:function(){var Y=(0,P.A)(function*(Z){const ie=l.W.state.activeChain,he=N.getAdapter(l.W.state.activeChain);if(!ie)throw new Error("signMessage: namespace not found");if(!he)throw new Error("signMessage: adapter not found");const Oe=N.getAddress(ie);if(!Oe)throw new Error("signMessage: address not found");return(yield he?.signMessage({message:Z,address:Oe,provider:I.G.getProvider(ie)}))?.signature||""});return function(ie){return Y.apply(this,arguments)}}(),sendTransaction:function(){var Y=(0,P.A)(function*(Z){const ie=Z.chainNamespace;if(!ie)throw new Error("sendTransaction: namespace not found");if(B.oU.SEND_SUPPORTED_NAMESPACES.includes(ie)){const he=N.getAdapter(ie);if(!he)throw new Error("sendTransaction: adapter not found");const Oe=I.G.getProvider(ie);return(yield he?.sendTransaction({...Z,caipNetwork:N.getCaipNetwork(),provider:Oe}))?.hash||""}return""});return function(ie){return Y.apply(this,arguments)}}(),estimateGas:function(){var Y=(0,P.A)(function*(Z){const ie=Z.chainNamespace;if(ie===K.o.CHAIN.EVM){const he=N.getAdapter(ie);if(!he)throw new Error("estimateGas: adapter is required but got undefined");const Oe=I.G.getProvider(ie),$e=N.getCaipNetwork();if(!$e)throw new Error("estimateGas: caipNetwork is required but got undefined");return(yield he?.estimateGas({...Z,provider:Oe,caipNetwork:$e}
193))?.gas||0n}return 0n});return function(ie){return Y.apply(this,arguments)}}(),getEnsAvatar:function(){var Y=(0,P.A)(function*(){const Z=l.W.state.activeChain;if(!Z)throw new Error("getEnsAvatar: namespace is required but got undefined");const ie=N.getAddress(Z);if(!ie)throw new Error("getEnsAvatar: address not found");return yield N.syncIdentity({address:ie,chainId:Number(N.getCaipNetwork()?.id),chainNamespace:Z}),l.W.getAccountData()?.profileImage||!1});return function(){return Y.apply(this,arguments)}}(),getEnsAddress:function(){var Y=(0,P.A)(function*(Z){return yield We.k.resolveReownName(Z)});return function(ie){return Y.apply(this,arguments)}}(),writeContract:function(){var Y=(0,P.A)(function*(Z){const ie=l.W.state.activeChain,he=N.getAdapter(ie);if(!ie)throw new Error("writeContract: namespace is required but got undefined");if(!he)throw new Error("writeContract: adapter is required but got undefined");const Oe=N.getCaipNetwork(),$e=N.getCaipAddress(),it=I.G.getProvider(ie);if(!Oe||!$e)throw new Error("writeContract: caipNetwork or caipAddress is required but got undefined");return(yield he?.writeContract({...Z,caipNetwork:Oe,provider:it,caipAddress:$e}))?.hash});return function(ie){return Y.apply(this,arguments)}}(),writeSolanaTransaction:function(){var Y=(0,P.A)(function*(Z){const ie=l.W.state.activeChain,he=N.getAdapter(ie);if(!ie)throw new Error("writeContract: namespace is required but got undefined");
193if(!he)throw new Error("writeContract: adapter is required but got undefined");const Oe=N.getCaipNetwork(),$e=N.getCaipAddress(),it=I.G.getProvider(ie);if(!Oe||!$e)throw new Error("writeContract: caipNetwork or caipAddress is required but got undefined");return(yield he?.writeSolanaTransaction({...Z,caipNetwork:Oe,provider:it,caipAddress:$e}))?.hash});return function(ie){return Y.apply(this,arguments)}}(),parseUnits:(Y,Z)=>{const ie=this.getAdapter(l.W.state.activeChain);if(!ie)throw new Error("parseUnits: adapter is required but got undefined");return ie?.parseUnits({value:Y,decimals:Z})??0n},formatUnits:(Y,Z)=>{const ie=this.getAdapter(l.W.state.activeChain);if(!ie)throw new Error("formatUnits: adapter is required but got undefined");return ie?.formatUnits({value:Y,decimals:Z})??"0"},getCapabilities:function(){var Y=(0,P.A)(function*(Z){const ie=N.getAdapter(l.W.state.activeChain);if(!ie)throw new Error("getCapabilities: adapter is required but got undefined");return yield ie?.getCapabilities(Z)});return function(ie){return Y.apply(this,arguments)}}(),grantPermissions:function(){var Y=(0,P.A)(function*(Z){const ie=N.getAdapter(l.W.state.activeChain);if(!ie)throw new Error("grantPermissions: adapter is required but got undefined");return yield ie?.grantPermissions(Z)});return function(ie){return Y.apply(this,arguments)}}(),revokePermissions:function(){var Y=(0,P.A)(function*(Z){const ie=N.getAdapter(l.W.state.activeChain);if(!ie)throw new Error("revokePermissions: adapter is required but got undefined");return ie?.revokePermissions?yield ie.revokePermissions(Z):"0x"});return function(ie){return Y.apply(this,arguments)}}(),walletGetAssets:function(){var Y=(0,P.A)(function*(Z){const ie=N.getAdapter(l.W.state.activeChain);if(!ie)throw new Error("walletGetAssets: adapter is required but got undefined");return(yield ie?.walletGetAssets(Z))??{}});return function(ie){return Y.apply(this,arguments)}}(),updateBalance:Y=>{const Z=this.getAddress(Y),ie=this.getCaipNetwork(Y);!ie||!Z||this.updateNativeBalance(Z,ie?.id,Y)}},x.x.setClient(this.connectionControllerClient)}onConnectExternal(N){var Y=this;return(0,P.A)(function*(){const Z=l.W.state.activeChain,ie=N.chain||Z,he=Y.getAdapter(ie);let Oe=!0;if(N.type===H.o.CONNECTOR_TYPE_AUTH&&K.o.AUTH_CONNECTOR_SUPPORTED_CHAINS.some(Xt=>k.a.getConnectorId(Xt)===K.o.CONNECTOR_ID.AUTH)&&N.chain!==Z&&(Oe=!1),N.chain&&N.chain!==Z&&!N.caipNetwork){const Ut=Y.getCaipNetworks().find(kt=>kt.chainNamespace===N.chain);Ut&&Oe&&Y.setCaipNetwork(Ut)}if(!ie)throw new Error("connectExternal: namespace not found");if(!he)throw new Error("connectExternal: adapter not found");const $e=Y.getCaipNetwork(ie),it=N.caipNetwork||$e,Qe=yield he.connect({id:N.id,address:N.address,info:N.info,type:N.type,provider:N.provider,socialUri:N.socialUri,chainId:N.caipNetwork?.id||$e?.id,rpcUrl:N.caipNetwork?.rpcUrls?.default?.http?.[0]||$e?.rpcUrls?.default?.http?.[0]});if(Qe)return L.i.addConnectedNamespace(ie),Y.syncProvider({...Qe,chainNamespace:ie}),Y.setStatus("connected",ie),Y.syncConnectedWalletInfo(ie),L.i.removeDisconnectedConnectorId(N.id,ie),{address:Qe.address,connectedCaipNetwork:it}})()}connectInactiveNamespaces(N,Y){var Z=this;return(0,P.A)(function*(){const ie=N.type===H.o.CONNECTOR_TYPE_AUTH,he=D.y.getOtherAuthNamespaces(Y?.connectedCaipNetwork?.chainNamespace),Oe=l.W.state.activeCaipNetwork,$e=Z.getAdapter(Oe?.chainNamespace);ie&&(yield Promise.all(he.map(function(){var it=(0,P.A)(function*(Qe){try{const Ut=I.G.getProvider(Qe),kt=Z.getCaipNetwork(Qe);(yield Z.getAdapter(Qe)?.connect({...N,provider:Ut,socialUri:void 0,chainId:kt?.id,rpcUrl:kt?.rpcUrls?.default?.http?.[0]}))&&(L.i.addConnectedNamespace(Qe),L.i.removeDisconnectedConnectorId(N.id,Qe),Z.setStatus("connected",Qe),Z.syncConnectedWalletInfo(Qe))}catch(Ut){_.h.warn(z.R.ALERT_WARNINGS.INACTIVE_NAMESPACE_NOT_CONNECTED.displayMessage,z.R.ALERT_WARNINGS.INACTIVE_NAMESPACE_NOT_CONNECTED.debugMessage(Qe,Ut instanceof Error?Ut.message:void 0),z.R.ALERT_WARNINGS.INACTIVE_NAMESPACE_NOT_CONNECTED.code)}});return function(Qe){return it.apply(this,arguments)}}())),Oe&&(yield $e?.switchNetwork({caipNetwork:Oe})))})()}getApprovedCaipNetworksData(){if(I.G.getProviderId(l.W.state.activeChain)===H.o.CONNECTOR_TYPE_WALLET_CONNECT){const Y=this.universalProvider?.session?.namespaces;return{supportsAllNetworks:"MetaMask Wallet"===this.universalProvider?.session?.peer?.metadata.name,approvedCaipNetworkIds:this.getChainsFromNamespaces(Y)}}return{supportsAllNetworks:!0,approvedCaipNetworkIds:[]}}switchCaipNetwork(N){var Y=this;return(0,P.A)(function*(){const Z=N.chainNamespace;if(Y.getAddressByChainNamespace(N.chainNamespace)){const he=I.G.getProviderId(Z);if(N.chainNamespace===l.W.state.activeChain)yield Y.getAdapter(Z)?.switchNetwork({caipNetwork:N});else if(Y.setCaipNetwork(N),he===H.o.CONNECTOR_TYPE_WALLET_CONNECT)Y.syncWalletConnectAccount();else{const Oe=Y.getAddressByChainNamespace(Z);Oe&&Y.syncAccount({address:Oe,chainId:N.id,chainNamespace:Z})}}else Y.setCaipNetwork(N)})()}getChainsFromNamespaces(N={}){return Object.values(N).flatMap(Y=>{const Z=Y.chains||[],ie=Y.accounts.map(he=>{const{chainId:Oe,chainNamespace:$e}=w.C.parseCaipAddress(he);return`${$e}:${Oe}`});return Array.from(new Set([...Z,...ie]))})}createAdapters(N){return this.createClients(),this.chainNamespaces.reduce((Y,Z)=>{const ie=N?.find(he=>he.namespace===Z);return ie?(ie.construct({namespace:Z,projectId:this.options?.projectId,networks:this.caipNetworks?.filter(({chainNamespace:he})=>he===Z)}),Y[Z]=ie):Y[Z]=new ut({namespace:Z,networks:this.getCaipNetworks()}),Y},{})}initChainAdapter(N){var Y=this;return(0,P.A)(function*(){Y.onConnectors(N),Y.listenAdapter(N);const Z=Y.getAdapter(N);if(!Z)throw new Error("adapter not found");yield Z.syncConnectors(),yield Y.createUniversalProviderForAdapter(N)})()}initChainAdapters(){var N=this;return(0,P.A)(function*(){yield Promise.all(N.chainNamespaces.map(function(){var Y=(0,P.A)(function*(Z){yield N.init
193ChainAdapter(Z)});return function(Z){return Y.apply(this,arguments)}}())),N.initAdapterController()})()}onConnectors(N){this.getAdapter(N)?.on("connectors",this.setConnectors.bind(this))}listenAdapter(N){const Y=this.getAdapter(N);if(!Y)return;const Z=L.i.getConnectionStatus();!1===p.H.state.enableReconnect?this.setStatus("disconnected",N):"connected"===Z?this.setStatus("connecting",N):"disconnected"===Z?(L.i.clearAddressCache(),this.setStatus(Z,N)):this.setStatus(Z,N),Y.on("switchNetwork",({address:ie,chainId:he})=>{const Oe=this.getCaipNetworks().find(Qe=>Qe.id.toString()===he.toString()||Qe.caipNetworkId.toString()===he.toString()),$e=l.W.state.activeChain===N,it=l.W.state.chains.get(N)?.accountState?.address;if(Oe){const Qe=$e&&ie?ie:it;Qe&&this.syncAccount({address:Qe,chainId:Oe.id,chainNamespace:N})}else this.setUnsupportedNetwork(he)}),Y.on("disconnect",()=>{const ie=this.remoteFeatures.multiWallet,he=Array.from(x.x.state.connections.values()).flat();this.onDisconnectNamespace({chainNamespace:N,closeModal:!ie||0===he.length})}),Y.on("connections",ie=>{this.setConnections(ie,N)}),Y.on("pendingTransactions",()=>{const ie=this.getAddress(N),he=l.W.state.activeCaipNetwork;!ie||!he?.id||this.updateNativeBalance(ie,he.id,he.chainNamespace)}),Y.on("accountChanged",({address:ie,chainId:he,connector:Oe})=>{this.handlePreviousConnectorConnection(Oe);const $e=l.W.state.activeChain===N;Oe?.provider&&(this.syncProvider({id:Oe.id,type:Oe.type,provider:Oe?.provider,chainNamespace:N}),this.syncConnectedWalletInfo(N));const it=l.W.getNetworkData(N)?.caipNetwork?.id,Qe=he||it;$e&&Qe?this.syncAccount({address:ie,chainId:Qe,chainNamespace:N}
193).catch(()=>null):!$e&&Qe?(this.syncAccountInfo(ie,Qe,N),this.syncBalance({address:ie,chainId:Qe,chainNamespace:N}).catch(()=>null)):this.syncAccountInfo(ie,he,N),L.i.addConnectedNamespace(N)})}handlePreviousConnectorConnection(N){return(0,P.A)(function*(){const Y=N?.chain,Z=N?.id,ie=k.a.getConnectorId(Y),he=p.H.state.remoteFeatures?.multiWallet,$e=Y&&Z&&ie&&ie!==Z&&!he;try{$e&&(yield x.x.disconnect({id:ie,namespace:Y}))}catch(it){console.warn("Error disconnecting previous connector",it)}})()}createUniversalProviderForAdapter(N){var Y=this;return(0,P.A)(function*(){yield Y.getUniversalProvider(),Y.universalProvider&&(yield Y.chainAdapters?.[N]?.setUniversalProvider?.(Y.universalProvider))})()}syncExistingConnection(){var N=this;return(0,P.A)(function*(){yield Promise.allSettled(N.chainNamespaces.map(Y=>N.syncNamespaceConnection(Y)))})()}unSyncExistingConnection(){var N=this;return(0,P.A)(function*(){try{yield Promise.allSettled(N.chainNamespaces.map(Y=>x.x.disconnect({namespace:Y,initialDisconnect:!0})))}catch(Y){console.error("Error disconnecting existing connections:",Y)}})()}reconnectWalletConnect(){var N=this;return(0,P.A)(function*(){yield N.syncWalletConnectAccount();const Y=N.getAddress();N.getCaipAddress()||L.i.deleteRecentWallet();const Z=L.i.getRecentWallet();v.E.sendEvent({type:"track",event:"CONNECT_SUCCESS",address:Y,properties:{method:S.w.isMobile()?"mobile":"qrcode",name:Z?.name||"Unknown",reconnect:!0,view:$.I.state.view,walletRank:Z?.order}})})()}syncNamespaceConnection(N){var Y=this;return(0,P.A)(function*(){try{N===K.o.CHAIN.EVM&&S.w.isSafeApp()&&k.a.setConnectorId(K.o.CONNECTOR_ID.SAFE,N);const Z=k.a.getConnectorId(N);switch(Y.setStatus("connecting",N),Z){case K.o.CONNECTOR_ID.WALLET_CONNECT:yield Y.reconnectWalletConnect();break;case K.o.CONNECTOR_ID.AUTH:break;default:yield Y.syncAdapterConnection(N)}}catch(Z){console.warn("AppKit couldn't sync existing connection",Z),Y.setStatus("disconnected",N)}})()}onDisconnectNamespace(N){const{chainNamespace:Y,closeModal:Z}=N||{};l.W.resetAccount(Y),l.W.resetNetwork(Y),L.i.removeConnectedNamespace(Y);const ie=Array.from(l.W.state.chains.keys());(Y?[Y]:ie).forEach(Oe=>L.i.addDisconnectedConnectorId(k.a.getConnectorId(Oe)||"",Oe)),k.a.removeConnectorId(Y),I.G.resetChain(Y),this.setUser(null,Y),this.setStatus("disconnected",Y),this.setConnectedWalletInfo(null,Y),!1!==Z&&Te.W.close()}syncAdapterConnections(){var N=this;return(0,P.A)(function*(){yield Promise.allSettled(N.chainNamespaces.map(Y=>{const Z=N.getAdapter(Y),ie=N.getCaipAddress(Y),he=N.getCaipNetwork(Y);return Z?.syncConnections({connectToFirstConnector:!ie,caipNetwork:he})}))})()}syncAdapterConnection(N){var Y=this;return(0,P.A)(function*(){const Z=Y.getAdapter(N),ie=Y.getCaipNetwork(N),he=k.a.getConnectorId(N),$e=k.a.getConnectors(N).find(it=>it.id===he);try{if(!Z||!$e)throw new Error(`Adapter or connector not found for namespace ${N}`);if(!ie?.id)throw new Error("CaipNetwork not found");const it=yield Z?.syncConnection({namespace:N,id:$e.id,chainId:ie.id,rpcUrl:ie?.rpcUrls?.default?.http?.[0]});it?(Y.syncProvider({...it,chainNamespace:N}),yield Y.syncAccount({...it,chainNamespace:N}),Y.setStatus("connected",N),v.E.sendEvent({type:"track",event:"CONNECT_SUCCESS",address:it.address,properties:{method:"browser",name:$e.info?.name||$e.name||"Unknown",reconnect:!0,view:$.I.state.view,walletRank:$e?.explorerWallet?.order}})):Y.setStatus("disconnected",N)}catch{Y.onDisconnectNamespace({chainNamespace:N,closeModal:!1})}})()}syncWalletConnectAccount(){var N=this;return(0,P.A)(function*(){const Y=Object.keys(N.universalProvider?.session?.namespaces||{}),Z=N.chainNamespaces.map(function(){var ie=(0,P.A)(function*(he){const Oe=N.getAdapter(he);if(!Oe)return;const $e=N.universalProvider?.session?.namespaces?.[he]?.accounts||[],it=l.W.state.activeCaipNetwork?.id,Qe=$e.find(kt=>{const{chainId:Xt}=w.C.parseCaipAddress(kt);return Xt===it?.toString()})||$e[0];if(Qe){const kt=w.C.validateCaipAddress(Qe),{chainId:Xt,address:dn}=w.C.parseCaipAddress(kt);if(I.G.setProviderId(he,H.o.CONNECTOR_TYPE_WALLET_CONNECT),N.caipNetworks&&l.W.state.activeCaipNetwork&&Oe.namespace!==K.o.CHAIN.EVM){const me=Oe.getWalletConnectProvider({caipNetworks:N.getCaipNetworks(),provider:N.universalProvider,activeCaipNetwork:l.W.state.activeCaipNetwork});I.G.setProvider(he,me)}else I.G.setProvider(he,N.universalProvider);k.a.setConnectorId(K.o.CONNECTOR_ID.WALLET_CONNECT,he),L.i.addConnectedNamespace(he),yield N.syncAccount({address:dn,chainId:Xt,chainNamespace:he})}else Y.includes(he)&&N.setStatus("disconnected",he);const Ut=N.getApprovedCaipNetworksData();N.syncConnectedWalletInfo(he),l.W.setApprovedCaipNetworksData(he,{approvedCaipNetworkIds:Ut.approvedCaipNetworkIds,supportsAllNetworks:Ut.supportsAllNetworks})});return function(he){return ie.apply(this,arguments)}}());yield Promise.all(Z)})()}syncProvider({type:N,provider:Y,id:Z,chainNamespace:ie}){I.G.setProviderId(ie,N),I.G.setProvider(ie,Y),k.a.setConnectorId(Z,ie)}syncAccount(N){var Y=this;return(0,P.A)(function*(){const Z=N.chainNamespace===l.W.state.activeChain,ie=l.W.getCaipNetworkByNamespace(N.chainNamespace,N.chainId),{address:he,chainId:Oe,chainNamespace:$e}=N,{chainId:it}=L.i.getActiveNetworkProps(),Qe=ie?.id||it,Ut=l.W.state.activeCaipNetwork?.name===K.o.UNSUPPORTED_NETWORK_NAME,kt=l.W.getNetworkProp("supportsAllNetworks",$e);if(Y.setStatus("connected",$e),(!Ut||kt)&&Qe){let Xt=Y.getCaipNetworks().find(Ue=>Ue.id.toString()===Qe.toString()),dn=Y.getCaipNetworks().find(Ue=>Ue.chainNamespace===$e);if(!kt&&!Xt&&!dn){const Ue=Y.getApprovedCaipNetworkIds()||[],vt=Ue.find(Bt=>w.C.parseCaipNetworkId(Bt)?.chainId===Qe.toString()),xt=Ue.find(Bt=>w.C.parseCaipNetworkId(Bt)?.chainNamespace===$e);Xt=Y.getCaipNetworks().find(Bt=>Bt.caipNetworkId===vt),dn=Y.getCaipNetworks().find(Bt=>Bt.caipNetworkId===xt||"deprecatedCaipNetworkId"in Bt&&Bt.deprecatedCaipNetworkId===xt)}const me=Xt||dn;me?.chainNamespace===l.W.state.activeChain?p.H.state.enableNetworkSwitch&&!p.H.state.allowUnsupportedChain&&l.W.state.activeCaipNetwork?.name===K.o.UNSUPPORTED_NETWORK_NAME?l.W.showUnsupportedChainUI():Y.setCaipNetwork(me):Z||ie&&Y.setCaipNetworkOfNamespace(ie,$e),Y.syncConnectedWalletInfo($e);const _e=Y.getAddress($e);
193D.y.isLowerCaseMatch(he,_e)||Y.syncAccountInfo(he,me?.id,$e),Z?yield Y.syncBalance({address:he,chainId:me?.id,chainNamespace:$e}):yield Y.syncBalance({address:he,chainId:ie?.id,chainNamespace:$e}),Y.syncIdentity({address:he,chainId:Oe,chainNamespace:$e}).catch(()=>null)}})()}syncAccountInfo(N,Y,Z){var ie=this;return(0,P.A)(function*(){const he=ie.getCaipAddress(Z),Oe=Y||he?.split(":")[1];Oe&&(ie.setCaipAddress(`${Z}:${Oe}:${N}`,Z,!0),yield ie.syncIdentity({address:N,chainId:Oe,chainNamespace:Z}))})()}syncReownName(N,Y){var Z=this;return(0,P.A)(function*(){try{const ie=yield Z.getReownName(N);Z.setProfileName(ie[0]?ie[0].name:null,Y)}catch{Z.setProfileName(null,Y)}})()}syncConnectedWalletInfo(N){const Y=k.a.getConnectorId(N),Z=I.G.getProviderId(N);if(Z===H.o.CONNECTOR_TYPE_ANNOUNCED||Z===H.o.CONNECTOR_TYPE_INJECTED){if(Y){const he=this.getConnectors().find(Oe=>{const $e=Oe.id===Y,it=Oe.info?.rdns===Y,Qe=Oe.connectors?.some(Ut=>Ut.id===Y||Ut.info?.rdns===Y);return $e||it||!!Qe});if(he){const{info:Oe,name:$e,imageUrl:it}=he,Qe=it||this.getConnectorImage(he);this.setConnectedWalletInfo({name:$e,icon:Qe,...Oe},N)}}}else if(Z===H.o.CONNECTOR_TYPE_WALLET_CONNECT){const ie=I.G.getProvider(N);ie?.session&&this.setConnectedWalletInfo({...ie.session.peer.metadata,name:ie.session.peer.metadata.name,icon:ie.session.peer.metadata.icons?.[0]},N)}else if(Y&&(Y===K.o.CONNECTOR_ID.COINBASE_SDK||Y===K.o.CONNECTOR_ID.COINBASE||Y===K.o.CONNECTOR_ID.BASE_ACCOUNT)){const ie=this.getConnectors().find(Qe=>Qe.id===Y),he=Y===K.o.CONNECTOR_ID.BASE_ACCOUNT?"Base Account":"Coinbase Wallet",Oe=ie?.name||he,$e=ie?.imageUrl||this.getConnectorImage(ie),it=ie?.info;this.setConnectedWalletInfo({...it,name:Oe,icon:$e},N)}}syncBalance(N){var Y=this;return(0,P.A)(function*(){!C.L.getNetworksByNamespace(Y.getCaipNetworks(),N.chainNamespace).find(ie=>ie.id.toString()===N.chainId?.toString())||!N.chainId||(yield Y.updateNativeBalance(N.address,N.chainId,N.chainNamespace))})()}ready(){var N=this;return(0,P.A)(function*(){yield N.readyPromise})()}updateNativeBalance(N,Y,Z){var ie=this;return(0,P.A)(function*(){const he=ie.getAdapter(Z),Oe=l.W.getCaipNetworkByNamespace(Z,Y);if(he){const $e=yield he.getBalance({address:N,chainId:Y,caipNetwork:Oe,tokens:ie.options.tokens});return ie.setBalance($e.balance,$e.symbol,Z),$e}})()}initializeUniversalAdapter(){var N=this;return(0,P.A)(function*(){const Y=nt.createLogger((he,...Oe)=>{he&&N.handleAlertError(he),console.error(...Oe)}),Z={projectId:N.options?.projectId,metadata:{name:N.options?.metadata?N.options?.metadata.name:"",description:N.options?.metadata?N.options?.metadata.description:"",url:N.options?.metadata?N.options?.metadata.url:"",icons:N.options?.metadata?N.options?.metadata.icons:[""]},logger:Y};p.H.setManualWCControl(!!N.options?.manualWCControl),N.universalProvider=N.options.universalProvider??(yield g.A.init(Z));const ie=N.universalProvider.disconnect.bind(N.universalProvider);N.universalProvider.disconnect=(0,P.A)(function*(){try{return yield ie()}catch(he){if(he instanceof Error&&he.message.includes("Missing or invalid. Record was recently deleted"))return;throw he}}),!1===p.H.state.enableReconnect&&N.universalProvider.session&&(yield N.universalProvider.disconnect()),N.listenWalletConnect()})()}listenWalletConnect(){this.universalProvider&&this.chainNamespaces.forEach(N=>{We.k.listenWcProvider({universalProvider:this.universalProvider,namespace:N,onDisplayUri:Y=>{x.x.setUri(Y)},onConnect:Y=>{const{address:Z}=S.w.getAccount(Y[0]);for(const ie of this.chainNamespaces)L.i.removeDisconnectedConnectorId(K.o.CONNECTOR_ID.WALLET_CONNECT,ie);x.x.finalizeWcConnection(Z)},onDisconnect:()=>{l.W.state.noAdapters&&this.resetAccount(N),x.x.resetWcConnection()},onChainChanged:Y=>{const Z=l.W.state.activeChain;if(Z===N&&(l.W.state.noAdapters||Z&&k.a.state.activeConnectorIds[Z]===K.o.CONNECTOR_ID.WALLET_CONNECT)){const he=this.getCaipNetworks().find($e=>$e.id.toString()===Y.toString()||$e.caipNetworkId.toString()===Y.toString()),Oe=this.getCaipNetwork();if(!he)return void this.setUnsupportedNetwork(Y);Oe?.id.toString()!==he?.id.toString()&&Oe?.chainNamespace===he?.chainNamespace&&this.setCaipNetwork(he)}},onAccountsChanged:Y=>{const Z=l.W.state.activeChain;if(Z===N&&(l.W.state.noAdapters||Z&&k.a.state.activeConnectorIds[Z]===K.o.CONNECTOR_ID.WALLET_CONNECT)){const he=Y?.[0];he&&this.syncAccount({address:he.address,chainId:he.chainId,chainNamespace:he.chainNamespace})}}})})}createUniversalProvider(){return!this.universalProviderInitPromise&&S.w.isCl
193ient()&&this.options?.projectId&&(this.universalProviderInitPromise=this.initializeUniversalAdapter()),this.universalProviderInitPromise}getUniversalProvider(){var N=this;return(0,P.A)(function*(){if(!N.universalProvider)try{yield N.createUniversalProvider()}catch(Y){v.E.sendEvent({type:"error",event:"INTERNAL_SDK_ERROR",properties:{errorType:"UniversalProviderInitError",errorMessage:Y instanceof Error?Y.message:"Unknown",uncaught:!1}}),console.error("AppKit:getUniversalProvider - Cannot create provider",Y)}return N.universalProvider})()}getDisabledCaipNetworks(){const N=l.W.getAllApprovedCaipNetworkIds(),Y=l.W.getAllRequestedCaipNetworks();return S.w.sortRequestedNetworks(N,Y).filter(ie=>l.W.isCaipNetworkDisabled(ie))}handleAlertError(N){const Y=Object.entries(z.R.UniversalProviderErrors).find(([,{message:$e}])=>N.message.includes($e)),[Z,ie]=Y??[],{message:he,alertErrorKey:Oe}=ie??{};if(Z&&he&&!this.reportedAlertErrors[Z]){const $e=z.R.ALERT_ERRORS[Oe];$e&&(_.h.open($e,"error"),this.reportedAlertErrors[Z]=!0)}}getAdapter(N){if(N)return this.chainAdapters?.[N]}createAdapter(N){if(!N)return;const Y=N.namespace;if(!Y)return;this.createClients();const Z=N;Z.namespace=Y,Z.construct({namespace:Y,projectId:this.options?.projectId,networks:this.caipNetworks?.filter(({chainNamespace:ie})=>ie===Y)}),this.chainNamespaces.includes(Y)||this.chainNamespaces.push(Y),this.chainAdapters&&(this.chainAdapters[Y]=Z)}open(N){var Y=this;return(0,P.A)(function*(){yield Y.injectModalUi(),N?.uri&&x.x.setUri(N.uri);const{isSwap:Z,isSend:ie}=Y.toModalOptions();return Z(N)?Te.W.open({...N,data:{swap:N.arguments}}):ie(N)&&N.arguments?Y.openSend(N.arguments):Te.W.open(N)})()}close(){var N=this;return(0,P.A)(function*(){yield N.injectModalUi(),Te.W.close()})()}setLoading(N,Y){Te.W.setLoading(N,Y)}disconnect(N){return(0,P.A)(function*(){yield x.x.disconnect({namespace:N})})()}getSIWX(){return p.H.state.siwx}getError(){return""}getChainId(){return l.W.state.activeCaipNetwork?.id}switchNetwork(N){var Y=this;return(0,P.A)(function*(Z,{throwOnFailure:ie=!1}={}){const he=Y.getCaipNetworks().find(Oe=>Oe.id===Z.id);he?yield l.W.switchActiveNetwork(he,{throwOnFailure:ie}):_.h.open(z.R.ALERT_ERRORS.SWITCH_NETWORK_NOT_FOUND,"error")}).apply(this,arguments)}getWalletProvider(){return l.W.state.activeChain?I.G.state.providers[l.W.state.activeChain]:null}getWalletProviderType(){return I.G.getProviderId(l.W.state.activeChain)}subscribeProviders(N){return I.G.subscribeProviders(N)}getThemeMode(){return O.W.state.themeMode}getThemeVariables(){return O.W.state.themeVariables}setThemeMode(N){O.W.setThemeMode(N),(0,Pt.JX)(O.W.state.themeMode)}setTermsConditionsUrl(N){p.H.setTermsConditionsUrl(N)}setPrivacyPolicyUrl(N){p.H.setPrivacyPolicyUrl(N)}setThemeVariables(N){O.W.setThemeVariables(N),(0,Pt.ds)(O.W.state.themeVariables)}subscribeTheme(N){return O.W.subscribe(N)}subscribeConnections(N){return this.remoteFeatures.multiWallet?x.x.subscribe(N):(_.h.open(K.o.REMOTE_FEATURES_ALERTS.MULTI_WALLET_NOT_ENABLED.DEFAULT,"info"),()=>{})}getWalletInfo(N){return N?l.W.state.chains.get(N)?.accountState?.connectedWalletInfo:l.W.getAccountData()?.connectedWalletInfo}getAccount(N){const Y=N||l.W.state.activeChain,Z=k.a.getAuthConnector(Y),ie=l.W.getAccountData(Y),he=L.i.getConnectedConnectorId(l.W.state.activeChain),Oe=x.x.getConnections(Y);if(!Y)throw new Error("AppKit:getAccount - namespace is required");const $e=l.W.getActiveCaipNetwork(Y),it=Oe.flatMap(Qe=>{const Ut=Qe.caipNetwork??$e;return Ut?Qe.accounts.map(({address:kt,type:Xt,publicKey:dn})=>S.w.createAccount({caipAddress:`${Ut.caipNetworkId}:${kt}`,type:Xt||"eoa",publicKey:dn})):[]});if(ie)return{allAccounts:it,caipAddress:ie.caipAddress,address:S.w.getPlainAddress(ie.caipAddress),isConnected:!!ie.caipAddress,status:ie.status,embeddedWalletInfo:Z&&he===K.o.CONNECTOR_ID.AUTH?{user:ie.user?{...ie.user,username:L.i.getConnectedSocialUsername()}:void 0,authProvider:ie.socialProvider||"email",accountType:(0,R.lj)(Y),isSmartAccountDeployed:!!ie.smartAccountDeployed}:void 0}}subscribeAccount(N,Y){const Z=[],ie=()=>{const Oe=this.getAccount(Y);Oe&&N(Oe)};if(Y){const Oe=l.W.subscribeChainProp("accountState",ie,Y);Z.push(Oe)}else{const Oe=l.W.subscribe(ie);Z.push(Oe)}const he=k.a.subscribe(ie);return Z.push(he),()=>{Z.forEach(Oe=>Oe())}}subscribeNetwork(N){return l.W.subscribe(({activeCaipNetwork:Y,activeChain:Z,chains:ie})=>{const he=Z?ie.get(Z)?.networkState:void 0;N({caipNetwork:Y,chainId:Y?.id,caipNetworkId:Y?.caipNetworkId,approvedCaipNetworkIds:he?.approvedCaipNetworkIds,supportsAllNetworks:he?.supp
193ortsAllNetworks??!0})})}subscribeWalletInfo(N,Y){return Y?l.W.subscribeChainProp("accountState",Z=>N(Z?.connectedWalletInfo),Y):l.W.subscribeChainProp("accountState",Z=>N(Z?.connectedWalletInfo))}subscribeShouldUpdateToAddress(N){return l.W.subscribeChainProp("accountState",Y=>N(Y?.shouldUpdateToAddress))}subscribeCaipNetworkChange(N){return l.W.subscribeKey("activeCaipNetwork",N)}getState(){return U.z.state}getRemoteFeatures(){return p.H.state.remoteFeatures}subscribeState(N){return U.z.subscribe(N)}subscribeRemoteFeatures(N){return p.H.subscribeKey("remoteFeatures",N)}showErrorMessage(N){Et.P.showError(N)}showSuccessMessage(N){Et.P.showSuccess(N)}getEvent(){return{...v.E.state}}subscribeEvents(N){return v.E.subscribe(N)}replace(N){$.I.replace(N)}redirect(N){$.I.push(N)}popTransactionStack(N){$.I.popTransactionStack(N)}isOpen(){return Te.W.state.open}isTransactionStackEmpty(){return 0===$.I.state.transactionStack.length}static getInstance(){return this.instance}updateFeatures(N){p.H.setFeatures(N)}updateRemoteFeatures(N){p.H.setRemoteFeatures(N)}updateOptions(N){const Z={...p.H.state||{},...N};p.H.setOptions(Z)}setConnectMethodsOrder(N){p.H.setConnectMethodsOrder(N)}setWalletFeaturesOrder(N){p.H.setWalletFeaturesOrder(N)}setCollapseWallets(N){p.H.setCollapseWallets(N)}setSocialsOrder(N){p.H.setSocialsOrder(N)}getConnectMethodsOrder(){return jt.A.getConnectOrderMethod(p.H.state.features,k.a.getConnectors())}addNetwork(N,Y){if(this.chainAdapters&&!this.chainAdapters[N])throw new Error(`Adapter for namespace ${N} doesn't exist`);const Z=this.extendCaipNetwork(Y,this.options);this.getCaipNetworks().find(ie=>ie.id===Z.id)||l.W.addNetwork(Z)}removeNetwork(N,Y){if(this.chainAdapters&&!this.chainAdapters[N])throw new Error(`Adapter for namespace ${N} doesn't exist`);this.getCaipNetworks().find(ie=>ie.id===Y)&&l.W.removeNetwork(N,Y)}}let Tt=!1;class Ft extends rt{onAuthProviderConnected(N){var Y=this;return(0,P.A)(function*(){const Z=D.y.userChainIdToChainNamespace(N?.chainId);if(N.message&&N.signature&&N.siwxMessage&&(yield j.U.addEmbeddedWalletSession({chainId:N.siwxMessage.chainId,accountAddress:N.address,notBefore:N.siwxMessage.notBefore,statement:N.siwxMessage.statement,resources:N.siwxMessage.resources,requestId:N.siwxMessage.requestId,issuedAt:N.siwxMessage.issuedAt,domain:N.siwxMessage.domain,uri:N.siwxMessage.uri,version:N.siwxMessage.version,nonce:N.siwxMessage.nonce},N.message,N.signature)),!Z)throw new Error("AppKit:onAuthProviderConnected - namespace is required");const ie=Z===K.o.CHAIN.EVM?`eip155:${N.chainId}:${N.address}`:`${N.chainId}:${N.address}`,he=p.H.state.defaultAccountTypes[Z],Oe=(0,R.lj)(Z),$e=N.preferredAccountType||Oe||he;Y.setCaipAddress(ie,Z);const{signature:it,siwxMessage:Qe,message:Ut,...kt}=N,Xt=l.W.getAccountData(Z);Y.setUser({...Xt?.user||{},...kt},Z),Y.setSmartAccountDeployed(!!N.smartAccountDeployed,Z),Y.setPreferredAccountType($e,Z),yield Promise.all([Y.syncAuthConnectorTheme(Y.authProvider),Y.syncAccount({address:N.address,chainId:N.chainId,chainNamespace:Z})]),Y.setLoading(!1,Z)})()}setupAuthConnectorListeners(N){N.onRpcRequest(Y=>{T.Q.checkIfRequestExists(Y)?T.Q.checkIfRequestIsSafe(Y)||this.handleUnsafeRPCRequest():(this.open(),console.error(W.Vl.RPC_METHOD_NOT_ALLOWED_MESSAGE,{method:Y.method}),setTimeout(()=>{this.showErrorMessage(W.Vl.RPC_METHOD_NOT_ALLOWED_UI_MESSAGE)},300),N.rejectRpcRequests())}),N.onRpcError(()=>{this.isOpen()&&(this.isTransactionStackEmpty()?this.close():this.popTransactionStack("error"))}),N.onRpcSuccess((Y,Z)=>{const ie=T.Q.checkIfRequestIsSafe(Z),he=this.getAddress(),Oe=l.W.state.activeCaipNetwork;ie||(he&&Oe?.id&&this.updateNativeBalance(he,Oe.id,Oe.chainNamespace),this.isTransactionStackEmpty()?this.close():this.popTransactionStack("success"))}),N.onNotConnected(()=>{const Y=l.W.state.activeChain;if(!Y)throw new Error("AppKit:onNotConnected - namespace is required");k.a.getConnectorId(Y)===K.o.CONNECTOR_ID.AUTH&&(this.setCaipAddress(null,Y),this.setLoading(!1,Y))}),N.onConnect(this.onAuthProviderConnected.bind(this)),N.onSocialConnected(this.onAuthProviderConnected.bind(this)),N.onSetPreferredAccount(({address:Y,type:Z})=>{const ie=l.W.state.activeChain;if(!ie)throw new Error("AppKit:onSetPreferredAccount - namespace is required");Y&&this.setPreferredAccountType(Z,ie)})}syncAuthConnectorTheme(N){return(0,P.A)(function*(){if(!N)return;const Y=O.W.getSnapshot();yield N.syncTheme({themeMode:Y.themeMode,themeVariables:Y.themeVariables,w3mThemeVariables:(0,m.o)(Y.themeVariables,Y.themeMode)})})()}syncAuthConnector(N,Y){var Z=this;return(0,P.A)(function*(){const ie=K.o.AUTH_CONNECTOR_SUPPORTED_CHAINS.includes(Y),he=Y===l.W.state.activeChain;if(!ie)return;Z.setLoading(!0,Y);
193const Oe=N.getLoginEmailUsed();Z.setLoading(Oe,Y),Oe&&Z.setStatus("connecting",Y);const $e=N.getEmail(),it=N.getUsername(),Qe=l.W.getAccountData(Y)?.user||{};Z.setUser({...Qe,username:it,email:$e},Y),Z.setupAuthConnectorListeners(N);const{isConnected:Ut}=yield N.isConnected();if(Y&&ie&&he)if(Ut&&Z.connectionControllerClient?.connectExternal){yield N.init(),yield Z.syncAuthConnectorTheme(N),yield Z.connectionControllerClient?.connectExternal({id:K.o.CONNECTOR_ID.AUTH,info:{name:K.o.CONNECTOR_ID.AUTH},type:H.o.CONNECTOR_TYPE_AUTH,provider:N,chainId:l.W.getNetworkData(Y)?.caipNetwork?.id,chain:Y}),Z.setStatus("connected",Y);const kt=L.i.getConnectedSocialProvider();v.E.sendEvent(kt?{type:"track",event:"SOCIAL_LOGIN_SUCCESS",address:Z.getAddress(),properties:{provider:kt,reconnect:!0}}:{type:"track",event:"CONNECT_SUCCESS",address:Z.getAddress(),properties:{method:"email",name:Z.universalProvider?.session?.peer?.metadata?.name||"Unknown",reconnect:!0,view:$.I.state.view,walletRank:void 0}})}else k.a.getConnectorId(Y)===K.o.CONNECTOR_ID.AUTH&&(Z.setStatus("disconnected",Y),L.i.removeConnectedNamespace(Y));Z.setLoading(!1,Y)})()}checkExistingTelegramSocialConnection(N){var Y=this;return(0,P.A)(function*(){try{if(!S.w.isTelegram())return;const Z=L.i.getTelegramSocialProvider();if(!Z||!S.w.isClient())return;const he=new URL(window.location.href).searchParams.get("result_uri");if(!he)return;Z&&l.W.setAccountProp("socialProvider",Z,N),yield Y.authProvider?.init();const Oe=k.a.getAuthConnector();Z&&Oe&&(Y.setLoading(!0,N),yield x.x.connectExternal({id:Oe.id,type:Oe.type,socialUri:he},Oe.chain),L.i.setConnectedSocialProvider(Z),L.i.removeTelegramSocialProvider(),v.E.sendEvent({type:"track",event:"SOCIAL_LOGIN_SUCCESS",properties:{provider:Z}}))}catch(Z){Y.setLoading(!1,N),console.error("checkExistingSTelegramocialConnection error",Z)}try{const Z=new URL(window.location.href);Z.searchParams.delete("result_uri"),window.history.replaceState({},document.title,Z.toString())}catch(Z){console.error("tma social login failed",Z)}})()}createAuthProvider(N){if(!K.o.AUTH_CONNECTOR_SUPPORTED_CHAINS.includes(N))return;const Z=this.remoteFeatures?.email,ie=Array.isArray(this.remoteFeatures?.socials)&&this.remoteFeatures.socials.length>0,he=Z||ie,$e=D.y.getActiveNamespaceConnectedToAuth()||N;!this.authProvider&&this.options?.projectId&&he&&(this.authProvider=E.getInstance({projectId:this.options.projectId,enableLogger:this.options.enableAuthLogger,chainId:this.getCaipNetwork($e)?.caipNetworkId,abortController:z.R.EmbeddedWalletAbortController,onTimeout:Qe=>{"iframe_load_failed"===Qe?_.h.open(z.R.ALERT_ERRORS.IFRAME_LOAD_FAILED,"error"):"iframe_request_timeout"===Qe?_.h.open(z.R.ALERT_ERRORS.IFRAME_REQUEST_TIMEOUT,"error"):"unverified_domain"===Qe&&_.h.open(z.R.ALERT_ERRORS.UNVERIFIED_DOMAIN,"error")},getActiveCaipNetwork:Qe=>(0,R.kg)(Qe),getCaipNetworks:Qe=>l.W.getCaipNetworks(Qe)}),U.z.subscribeOpen(Qe=>{!Qe&&this.isTransactionStackEmpty()&&this.authProvider?.rejectRpcRequests()}));const it=N===l.W.state.activeChain&&p.H.state.enableReconnect;!1===p.H.state.enableReconnect?this.syncAuthConnectorTheme(this.authProvider):this.authProvider&&it&&(this.syncAuthConnector(this.authProvider,N),this.checkExistingTelegramSocialConnection(N))}createAuthProviderForAdapter(N){this.createAuthProvider(N),this.authProvider&&this.chainAdapters?.[N]?.setAuthProvider?.(this.authProvider)}initControllers(N){super.initControllers(N),this.options.excludeWalletIds&&X.N.initializeExcludedWallets({ids:this.options.excludeWalletIds})}switchCaipNetwork(N){var Y=this;return(0,P.A)(function*(){if(!N)return;const Z=l.W.state.activeChain,ie=N.chainNamespace,he=Y.getAddressByChainNamespace(ie);if(ie===Z&&l.W.getAccountData(ie)?.caipAddress)yield Y.getAdapter(ie)?.switchNetwork({caipNetwork:N}),Y.setCaipNetwork(N);else{const it=I.G.getProviderId(Z)===H.o.CONNECTOR_TYPE_AUTH,Qe=I.G.getProviderId(ie),Ut=Qe===H.o.CONNECTOR_TYPE_AUTH,kt=K.o.AUTH_CONNECTOR_SUPPORTED_CHAINS.includes(ie);if(!ie)throw new Error("AppKit:switchCaipNetwork - networkNamespace is required");if((it&&void 0===Qe||Ut)&&kt)try{l.W.state.activeChain=N.chainNamespace,he?yield Y.getAdapter(ie)?.switchNetwork({caipNetwork:N}):yield Y.connectionControllerClient?.connectExternal?.({id:K.o.CONNECTOR_ID.AUTH,provider:Y.authProvider,chain:ie,chainId:N.id,type:H.o.CONNECTOR_TYPE_AUTH,caipNetwork:N}),Y.setCaipNetwork(N)}catch{yield Y.getAdapter(ie)?.switchNetwork({caipNetwork:N})}else Qe===H.o.CONNECTOR_TYPE_WALLET_CONNECT?(l.W.state.noAdapters||(yield Y.getAdapter(ie)?.switchNetwork({caipNetwork:N})),Y.setCaipNetwork(N),Y.syncWalletConnectAccount()):(Y.setCaipNetwork(N),he&&Y.
193syncAccount({address:he,chainId:N.id,chainNamespace:ie}))}})()}initialize(N){var Y=()=>super.initialize,Z=this;return(0,P.A)(function*(){yield Y().call(Z,N),Z.chainNamespaces?.forEach(ie=>{Z.createAuthProviderForAdapter(ie)}),yield Z.injectModalUi(),U.z.set({initialized:!0})})()}syncIdentity(N){var Y=this;return(0,P.A)(function*({address:Z,chainId:ie,chainNamespace:he}){if(he!==K.o.CHAIN.EVM)return;const Oe=`${he}:${ie}`;if(Y.caipNetworks?.find(Qe=>Qe.caipNetworkId===Oe)?.testnet)return Y.setProfileName(null,he),void Y.setProfileImage(null,he);const it=k.a.getConnectorId(he)===K.o.CONNECTOR_ID.AUTH;try{const{name:Qe,avatar:Ut}=yield Y.fetchIdentity({address:Z});!Qe&&it?yield Y.syncReownName(Z,he):(Y.setProfileName(Qe,he),Y.setProfileImage(Ut,he))}catch{1!==ie&&Y.setProfileImage(null,he)}}).apply(this,arguments)}syncConnectedWalletInfo(N){const Y=I.G.getProviderId(N);if(Y===H.o.CONNECTOR_TYPE_AUTH){const Z=this.authProvider;if(Z){const ie=L.i.getConnectedSocialProvider()??"email",he=Z.getEmail()??Z.getUsername();this.setConnectedWalletInfo({name:Y,identifier:he,social:ie},N)}}else super.syncConnectedWalletInfo(N)}injectModalUi(){var N=this;return(0,P.A)(function*(){if(!S.w.isClient())return;const Y={...B.oU.DEFAULT_FEATURES,...N.options.features};if(!Y.headless&&!Tt)try{const Z=N.remoteFeatures;if(yield N.loadModalComponents(Y,Z),S.w.isClient()&&!document.querySelector("w3m-modal")){const he=document.createElement("w3m-modal");!p.H.state.disableAppend&&!p.H.state.enableEmbedded&&document.body.insertAdjacentElement("beforeend",he)}Tt=!0}catch(Z){console.error("Error injecting modal UI:",Z)}})()}loadModalComponents(N,Y){return(0,P.A)(function*(){if(!S.w.isClient())return;const Z=[];(Y.email||Y.socials&&Y.socials.length>0)&&Z.push(Promise.all([u.e(6424),u.e(7164),u.e(2076),u.e(6479)]).then(u.bind(u,26479))),Y.email&&Z.push(Promise.all([u.e(6424),u.e(7e3),u.e(2076),u.e(4179)]).then(u.bind(u,86667))),Y.socials&&Z.push(Promise.all([u.e(6424),u.e(7164),u.e(3474),u.e(2076),u.e(3919)]).then(u.bind(u,33919))),Y.swaps&&Y.swaps.length>0&&Z.push(Promise.all([u.e(6424),u.e(7164),u.e(2560),u.e(2076),u.e(633)]).then(u.bind(u,10633))),N.send&&Z.push(Promise.all([u.e(6424),u.e(7164),u.e(2560),u.e(5200),u.e(2076),u.e(4345)]).then(u.bind(u,74345))),N.receive&&Z.push(Promise.all([u.e(6424),u.e(3474),u.e(6460)]).then(u.bind(u,46460))),Y.onramp&&Y.onramp.length>0&&Z.push(Promise.all([u.e(6424),u.e(7164),u.e(3898),u.e(4663)]).then(u.bind(u,27044))),Y.payWithExchange&&Z.push(Promise.all([u.e(6424),u.e(7164),u.e(5200),u.e(2076),u.e(1762)]).then(u.bind(u,71762))),Y.activity&&Z.push(Promise.all([u.e(6424),u.e(5971),u.e(869)]).then(u.bind(u,86923))),(N.pay||Y.payments)&&Z.push(Promise.all([u.e(6424),u.e(7164),u.e(3616),u.e(9030),u.e(8970)]).then(u.bind(u,9030))),Y.emailCapture&&Z.push(Promise.all([u.e(6424),u.e(7e3),u.e(2076),u.e(7843)]).then(u.bind(u,17843))),yield Promise.all([...Z,Promise.all([u.e(6424),u.e(7164),u.e(3474),u.e(3616),u.e(5200),u.e(3898),u.e(2353),u.e(5971),u.e(2076),u.e(5854)]).then(u.bind(u,55854)),Promise.all([u.e(6424),u.e(7164),u.e(2560),u.e(3616),u.e(9030),u.e(2353),u.e(4245)]).then(u.bind(u,91244))])})()}}function bn(qe){return new Ft({...qe,sdkVersion:S.w.generateSdkVersion(qe.adapters??[],"html","1.8.20")})}},79231(Ve,ne,u){"use strict";u.d(ne,{A:()=>vh});var S={};u.r(S),u.d(S,{identity:()=>HC});var P={};u.r(P),u.d(P,{base2:()=>KC});var K={};u.r(K),u.d(K,{base8:()=>zC});var m={};u.r(m),u.d(m,{base10:()=>VC});var j={};u.r(j),u.d(j,{base16:()=>GC,base16upper:()=>qC});var R={};u.r(R),u.d(R,{base32:()=>Xo,base32hex:()=>XC,base32hexpad:()=>eA,base32hexpadupper:()=>tA,base32hexupper:()=>QC,base32pad:()=>ZC,base32padupper:()=>JC,base32upper:()=>YC,base32z:()=>nA});var k={};u.r(k),u.d(k,{base36:()=>rA,base36upper:()=>sA});var v={};u.r(v),u.d(v,{base58btc:()=>hs,base58flickr:()=>iA});var $={};u.r($),u.d($,{base64:()=>oA,base64pad:()=>aA,base64url:()=>cA,base64urlpad:()=>lA});var x={};u.r(x),u.d(x,{base256emoji:()=>pA});var U={};u.r(U),u.d(U,{sha256:()=>MA,sha512:()=>BA});var X={};u.r(X),u.d(X,{identity:()=>FA});var B={};u.r(B),u.d(B,{code:()=>jA,decode:()=>HA,encode:()=>$A,name:()=>WA});var p={};u.r(p),u.d(p,{code:()=>GA,decode:()=>YA,encode:()=>qA,name:()=>VA});var l=u(10467),O=u(44356),L=u.n(O),_=u(76669);class I{}class D extends I{constructor(e){super()}}const H=_.FIVE_SECONDS,z_pulse="heartbeat_pulse";class T extends D{constructor(e){super(e),this.events=new O.EventEmitter,this.interval=H,this.interval=e?.interval||H}static init(e){return(0,l.A)(function*(){const n=new T(e);return yield n.init(),n})()}init(){var e=this;return(0,l.A)(function*(){yield e.initialize()})()}stop(){clearInterval(this.intervalRef)}on(e,n){this.events.on(e,n)}once(e,n){this.events.once(e,n)}off(e,n){this.events.off(e,n)}removeListener(e,n){this.events.removeListener(e,n)}initialize(){var e=this;return(0,l.A)(function*(){e.intervalRef=setInterval(()=>e.pulse(),(0,_.toMiliseconds)(e.interval))})()}pulse(){this.events.emit(z_pulse)}}const W=/"(?:_|\\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*:/,A=/"(?: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*:/,E=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function g(t,e){if(!("__proto__"===t||"constructor"===t&&e&&"object"==typeof e&&"prototype"in e))return e;!function w(t){console.warn(`[destr] Dropping "${t}" key to prevent prototype pollution.`)}(t)}function C(t,e={}){if("string"!=typeof t)return t;if('"'===t[0]&&'"'===t[t.length-1]&&-1===t.indexOf("\\"))return t.slice(1,-1);const n=t.trim();if(n.length<=9)switch(n.toLowerCase()){case"true":return!0;case"false":return!1;case"undefined":return;case"null":return null;case"nan":return Number.NaN;case"infinity":return Number.POSITIVE_INFINITY;case"-infinity":return Number.NEGATIVE_INFINITY}if(!E.test(t)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return t}try{if(W.test(t)||A.test(t)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(t,g)}return JSON.parse(t)}catch(r){if(e.strict)throw r;return t}}var Q=u(37044).hp;function ce(t,...e){try{return function ge(t){return t&&"function"==typeof t.then?t:Promise.resolve(t)}(t(...e))}catch(n){return Promise.reject(n)}}function ve(t){if(function Ae(t){const e=typeof t;return null===t||"object"!==e&&"function"!==e}(t))return String(t);if(function Te(t){const e=Object.getPrototypeOf(t);return!e||e.isPrototypeOf(Object)}(t)||Array.isArray(t))return JSON.stringify(t);if("function"==typeof t.toJSON)return ve(t.toJSON());throw new Error("[unstorage] Cannot stringify value!")}const We="base64:";function xe(t){return t&&t.split("?")[0]?.replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,"")||""}function tt(...t){return xe(t.join(":"))}function nt(t){return(t=xe(t))?t+":":""}const bt=()=>{const t=new Map;return{name:"memory",getInstance:()=>t,hasItem:e=>t.has(e),getItem:e=>t.get(e)??null,getItemRaw:e=>t.get(e)??null,setItem(e,n){t.set(e,n)},setItemRaw(e,n){t.set(e,n)},removeItem(e){t.delete(e)},getKeys:()=>[...t.keys()],clear(){t.clear()},dispose(){t.clear()}}};function rn(t,e,n){return t.watch?t.watch((r,s)=>e(r,n+s)):()=>{}}function bn(t){return qe.apply(this,arguments)}function qe(){return(qe=(0,l.A)(function*(t){"function"==typeof t.dispose&&(yield ce(t.dispose))})).apply(this,arguments)}var Y=u(39178);function he(t){if("string"!=typeof t)throw new Error("Cannot safe json parse value of type "+typeof t);try{return(t=>{const n=t.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');return JSON.parse(n,(r,s)=>"string"==typeof s&&s.match(/^\d+n$/)?BigInt(s.substring(0,s.length-1)):s)})(t)}catch{return t}}function Oe(t){return"string"==typeof t?t:(t=>JSON.stringify(t,(e,n)=>"bigint"==typeof n?n.toString()+"n":n))(t)||""}var Qe=(t={})=>{const e=t.base&&t.base.length>0?`${t.base}:`:"",n=s=>e+s;let r;return t.dbName&&t.storeName&&(r=(0,Y.y$)(t.dbName,t.storeName)),{name:"idb-keyval",options:t,hasItem:s=>(0,l.A)(function*(){return!(typeof(yield(0,Y.Jt)(n(s),r))>"u")})(),getItem:s=>(0,l.A)(function*(){return(yield(0,Y.Jt)(n(s),r))??null})(),setItem:(s,i)=>(0,Y.hZ)(n(s),i,r),removeItem:s=>(0,Y.yH)(n(s),r),getKeys:()=>(0,Y.HP)(r),clear:()=>(0,Y.IU)(r)}};class Xt{constructor(){this.indexedDb=function Xe(t={}){const e={mounts:{"":t.driver||bt()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}}
193,n=d=>{for(const h of e.mountpoints)if(d.startsWith(h))return{base:h,relativeKey:d.slice(h.length),driver:e.mounts[h]};return{base:"",relativeKey:d,driver:e.mounts[""]}},r=(d,h)=>e.mountpoints.filter(b=>b.startsWith(d)||h&&d.startsWith(b)).map(b=>({relativeBase:d.length>b.length?d.slice(b.length):void 0,mountpoint:b,driver:e.mounts[b]})),s=(d,h)=>{if(e.watching){h=xe(h);for(const b of e.watchListeners)b(d,h)}},i=function(){var d=(0,l.A)(function*(){if(!e.watching){e.watching=!0;for(const h in e.mounts)e.unwatch[h]=yield rn(e.mounts[h],s,h)}});return function(){return d.apply(this,arguments)}}(),o=function(){var d=(0,l.A)(function*(){if(e.watching){for(const h in e.unwatch)yield e.unwatch[h]();e.unwatch={},e.watching=!1}});return function(){return d.apply(this,arguments)}}(),a=(d,h,b)=>{const M=new Map,J=te=>{let re=M.get(te.base);return re||(re={driver:te.driver,base:te.base,items:[]},M.set(te.base,re)),re};for(const te of d){const re="string"==typeof te,ae=xe(re?te:te.key),ye=re?void 0:te.value,Se=re||!te.options?h:{...h,...te.options},oe=n(ae);J(oe).items.push({key:ae,value:ye,relativeKey:oe.relativeKey,options:Se})}return Promise.all([...M.values()].map(te=>b(te))).then(te=>te.flat())},c={hasItem(d,h={}){d=xe(d);const{relativeKey:b,driver:M}=n(d);return ce(M.hasItem,b,h)},getItem(d,h={}){d=xe(d);const{relativeKey:b,driver:M}=n(d);return ce(M.getItem,b,h).then(J=>C(J))},getItems:(d,h={})=>a(d,h,b=>b.driver.getItems?ce(b.driver.getItems,b.items.map(M=>({key:M.relativeKey,options:M.options})),h).then(M=>M.map(J=>({key:tt(b.base,J.key),value:C(J.value)}))):Promise.all(b.items.map(M=>ce(b.driver.getItem,M.relativeKey,M.options).then(J=>({key:M.key,value:C(J)}))))),getItemRaw(d,h={}){d=xe(d);const{relativeKey:b,driver:M}=n(d);return M.getItemRaw?ce(M.getItemRaw,b,h):ce(M.getItem,b,h).then(J=>function Et(t){return"string"==typeof t&&t.startsWith(We)?function jt(t){return globalThis.Buffer?Q.from(t,"base64"):Uint8Array.from(globalThis.atob(t),e=>e.codePointAt(0))}(t.slice(7)):t}(J))},setItem(d,h){return(0,l.A)(function*(b,M,J={}){if(void 0===M)return c.removeItem(b);b=xe(b);const{relativeKey:te,driver:re}=n(b);re.setItem&&(yield ce(re.setItem,te,ve(M),J),re.watch||s("update",b))}).apply(this,arguments)},setItems:(d,h)=>(0,l.A)(function*(){yield a(d,h,function(){var b=(0,l.A)(function*(M){if(M.driver.setItems)return ce(M.driver.setItems,M.items.map(J=>({key:J.relativeKey,value:ve(J.value),options:J.options})),h);M.driver.setItem&&(yield Promise.all(M.items.map(J=>ce(M.driver.setItem,J.relativeKey,ve(J.value),J.options))))});return function(M){return b.apply(this,arguments)}}())})(),setItemRaw(d,h){return(0,l.A)(function*(b,M,J={}){if(void 0===M)return c.removeItem(b,J);b=xe(b);const{relativeKey:te,driver:re}=n(b);if(re.setItemRaw)yield ce(re.setItemRaw,te,M,J);else{if(!re.setItem)return;yield ce(re.setItem,te,function Ke(t){return"string"==typeof t?t:We+function Pt(t){return globalThis.Buffer?Q.from(t).toString("base64"):globalThis.btoa(String.fromCodePoint(...t))}(t)}(M),J)}re.watch||s("update",b)}).apply(this,arguments)},removeItem(d){return(0,l.A)(function*(h,b={}){"boolean"==typeof b&&(b={removeMeta:b}),h=xe(h);const{relativeKey:M,driver:J}=n(h);J.removeItem&&(yield ce(J.removeItem,M,b),(b.removeMeta||b.removeMata)&&(yield ce(J.removeItem,M+"$",b)),J.watch||s("remove",h))}).apply(this,arguments)},getMeta(d){return(0,l.A)(function*(h,b={}){"boolean"==typeof b&&(b={nativeOnly:b}),h=xe(h);const{relativeKey:M,driver:J}=n(h),te=Object.create(null);if(J.getMeta&&Object.assign(te,yield ce(J.getMeta,M,b)),!b.nativeOnly){const re=yield ce(J.getItem,M+"$",b).then(ae=>C(ae));re&&"object"==typeof re&&("string"==typeof re.atime&&(re.atime=new Date(re.atime)),"string"==typeof re.mtime&&(re.mtime=new Date(re.mtime)),Object.assign(te,re))}return te}).apply(this,arguments)},setMeta(d,h,b={}){return this.setItem(d+"$",h,b)},removeMeta(d,h={}){return this.removeItem(d+"$",h)},getKeys(d){return(0,l.A)(function*(h,b={}){h=nt(h);const M=r(h,!0);let J=[];const te=[];let re=!0;for(const ye of M){ye.driver.flags?.maxDepth||(re=!1);const Se=yield ce(ye.driver.getKeys,ye.relativeBase,b);for(const oe of Se){const pe=ye.mountpoint+xe(oe);J.some(Ce=>pe.startsWith(Ce))||te.push(pe)}J=[ye.mountpoint,...J.filter(oe=>!oe.startsWith(ye.mountpoint))]}const ae=void 0!==b.maxDepth&&!re;return te.filter(ye=>(!ae||function lt(t,e){if(void 0===e)return!0;let n=0,r=t.indexOf(":");for(;r>-1;)n++,r=t.indexOf(":",r+1);return n<=e}(ye,b.maxDepth))&&function Nt(t,e){return e?t.startsWith(e)&&"$"!==t[t.length-1]:"$"!==t[t.length-1]}(ye,h))}).apply(this,arguments)},clear(d){return(0,l.A)(function*(h,b={}){h=nt(h),yield Promise.all(r(h,!1).map(function(){var M=(0,l.A)(function*(J){if(J.driver.clear)return ce(J.driver.clear,J.relativeBase,b);if(J.driver.removeItem){const te=yield J.driver.getKeys(J.relativeBase||"",b);return Promise.all(te.map(re=>J.driver.removeItem(re,b)))}});return function(J){return M.apply(this,arguments)}}()))}).apply(this,arguments)},dispose:()=>(0,l.A)(function*(){yield Promise.all(Object.values(e.mounts).map(d=>bn(d)))})(),watch:d=>(0,l.A)(function*(){return yield i(),e.watchListeners.push(d),(0,l.A)(function*(){e.wat
193chListeners=e.watchListeners.filter(h=>h!==d),0===e.watchListeners.length&&(yield o())})})(),unwatch:()=>(0,l.A)(function*(){e.watchListeners=[],yield o()})(),mount(d,h){if((d=nt(d))&&e.mounts[d])throw new Error(`already mounted at ${d}`);return d&&(e.mountpoints.push(d),e.mountpoints.sort((b,M)=>M.length-b.length)),e.mounts[d]=h,e.watching&&Promise.resolve(rn(h,s,d)).then(b=>{e.unwatch[d]=b}).catch(console.error),c},unmount(d){return(0,l.A)(function*(h,b=!0){(h=nt(h))&&e.mounts[h]&&(e.watching&&h in e.unwatch&&(e.unwatch[h]?.(),delete e.unwatch[h]),b&&(yield bn(e.mounts[h])),e.mountpoints=e.mountpoints.filter(M=>M!==h),delete e.mounts[h])}).apply(this,arguments)},getMount(d=""){d=xe(d)+":";const h=n(d);return{driver:h.driver,base:h.base}},getMounts:(d="",h={})=>(d=xe(d),r(d,h.parents).map(M=>({driver:M.driver,base:M.mountpoint}))),keys:(d,h={})=>c.getKeys(d,h),get:(d,h={})=>c.getItem(d,h),set:(d,h,b={})=>c.setItem(d,h,b),has:(d,h={})=>c.hasItem(d,h),del:(d,h={})=>c.removeItem(d,h),remove:(d,h={})=>c.removeItem(d,h)};return c}({driver:Qe({dbName:"WALLET_CONNECT_V2_INDEXED_DB",storeName:"keyvaluestorage"})})}getKeys(){var e=this;return(0,l.A)(function*(){return e.indexedDb.getKeys()})()}getEntries(){var e=this;return(0,l.A)(function*(){return(yield e.indexedDb.getItems(yield e.indexedDb.getKeys())).map(n=>[n.key,n.value])})()}getItem(e){var n=this;return(0,l.A)(function*(){const r=yield n.indexedDb.getItem(e);if(null!==r)return r})()}setItem(e,n){var r=this;return(0,l.A)(function*(){yield r.indexedDb.setItem(e,Oe(n))})()}removeItem(e){var n=this;return(0,l.A)(function*(){yield n.indexedDb.removeItem(e)})()}}var dn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},me={exports:{}};function _e(t){var e;return[t[0],he(null!=(e=t[1])?e:"")]}!function(){let t;function e(){}t=e,t.prototype.getItem=function(n){return this.hasOwnProperty(n)?String(this[n]):null},t.prototype.setItem=function(n,r){this[n]=String(r)},t.prototype.removeItem=function(n){delete this[n]},t.prototype.clear=function(){const n=this;Object.keys(n).forEach(function(r){n[r]=void 0,delete n[r]})},t.prototype.key=function(n){return n=n||0,Object.keys(this)[n]},t.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),me.exports=typeof dn<"u"&&dn.localStorage?dn.localStorage:typeof window<"u"&&window.localStorage?window.localStorage:new e}();class Ue{constructor(){this.localStorage=me.exports}getKeys(){var e=this;return(0,l.A)(function*(){return Object.keys(e.localStorage)})()}getEntries(){var e=this;return(0,l.A)(function*(){return Object.entries(e.localStorage).map(_e)})()}getItem(e){var n=this;return(0,l.A)(function*(){const r=n.localStorage.getItem(e);if(null!==r)return he(r)})()}setItem(e,n){var r=this;return(0,l.A)(function*(){r.localStorage.setItem(e,Oe(n))})()}removeItem(e){var n=this;return(0,l.A)(function*(){n.localStorage.removeItem(e)})()}}const Bt=function(){var t=(0,l.A)(function*(e,n,r){const s="wc_storage_version",i=yield n.getItem(s);if(i&&i>=1)return void r(n);const o=yield e.getKeys();if(!o.length)return void r(n);const a=[];for(;o.length;){const c=o.shift();if(!c)continue;const d=c.toLowerCase();if(d.includes("wc@")||d.includes("walletconnect")||d.includes("wc_")||d.includes("wallet_connect")){const h=yield e.getItem(c);yield n.setItem(c,h),a.push(c)}}yield n.setItem(s,1),r(n),Qt(e,a)});return function(n,r,s){return t.apply(this,arguments)}}(),Qt=function(){var t=(0,l.A)(function*(e,n){n.length&&n.forEach(function(){var r=(0,l.A)(function*(s){yield e.removeItem(s)});return function(s){return r.apply(this,arguments)}}())});return function(n,r){return t.apply(this,arguments)}}();class Gt{constructor(){this.initialized=!1,this.setInitialized=n=>{this.storage=n,this.initialized=!0};const e=new Ue;this.storage=e;try{const n=new Xt;Bt(e,n,this.setInitialized)}catch{this.initialized=!0}}getKeys(){var e=this;return(0,l.A)(function*(){return yield e.initialize(),e.storage.getKeys()})()}getEntries(){var e=this;return(0,l.A)(function*(){return yield e.initialize(),e.storage.getEntries()})()}getItem(e){var n=this;return(0,l.A)(function*(){return yield n.initialize(),n.storage.getItem(e)})()}setItem(e,n){var r=this;return(0,l.A)(function*(){return yield r.initialize(),r.storage.setItem(e,n)})()}removeItem(e){var n=this;return(0,l.A)(function*(){return yield n.initialize(),n.storage.removeItem(e)})()}initialize(){var e=this;return(0,l.A)(function*(){e.initialized||(yield new Promise(n=>{const r=setInterval(()=>{e.initialized&&(clearInterval(r),n())},20)}))})()}}var Ct=u(23429),ht=Object.defineProperty,Ht=(t,e,n)=>((t,e,n)=>e in t?ht(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,"symbol"!=typeof e?e+"":e,n);class At extends I{constructor(e){super(),this.opts=e,Ht(this,"protocol","wc"),Ht(this,"version",2)}}var Fr=Object.defineProperty;class ts extends I{constructor(e,n){super(),this.core=e,this.logger=n,((t,e,n)=>{((t,e,n)=>{e in t?Fr(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n})(t,"symbol"!=typeof e?e+"":e,n)})(this,"records",new Map)}}class Js{constructor(e,n){this.logger=e,this.core=n}}class Cs extends I{constructor(e,n){super(),this.relayer=e,this.logger=n}}class Ci extends I{constructor(e){super()}}class Ai{constructor(e,n,r,s){this.core=e,this.logger=n,this.name=r}}class dl extends I{constructor(e,n){super(),this.relayer=e,this.logger=n}}class fl extends I{constructor(e,n){super(),this.core=e,this.logger=n}}class hl{constructor(e,n,r){this.core=e,this.logger=n,this.store=r}}class pl{constructor(e,n){this.projectId=e,this.logger=n}}class gl{constructor(e,n,r){this.core=e,this.logger=n,this.telemetryEnabled=r}}var ml=Object.defineProperty,Aa=(t,e,n)=>((t,e,n)=>e in t?ml(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,"symbol"!=typeof e?e+"":e,n);L();class _l{constructor(e){this.opts=e,Aa(this,"protocol","wc"),Aa(this,"version",2)}}class El{constructor(e){this.client=e}}function Ia(t,...e){if(!function bl(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&"Uint8Array"===t.constructor.name}(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function co(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}const Is="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0,lo=t=>new DataView(t.buffer,t.byteOffset,t.byteLength);function Al(t){return"string"==typeof t&&(t=function Cl(t){if("string"!=typeof t)throw new Error("utf8ToBytes expected string, got "+typeof t);return new Uint8Array((new TextEncoder).encode(t))}(t)),Ia(t),t}class Oh{clone(){return this._cloneInto()}}function Il(t=32){if(Is&&"function"==typeof Is.getRandomValues)return Is.getRandomValues(new Uint8Array(t));if(Is&&"function"==typeof Is.randomBytes)return Is.randomBytes(t);throw new Error("crypto.getRandomValues must be defined")}class se extends Oh{constructor(e,n,r,s){super(),this.blockLen=e,this.outputLen=n,this.padOffset=r,this.isLE=s,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(e),this.view=lo(this.buffer)}update(e){co(this);const{view:n,buffer:r,blockLen:s}=this,i=(e=Al(e)).length;for(let o=0;o<i;){const a=Math.min(s-this.pos,i-o);if(a===s){const c=lo(e);for(;s<=i-o;o+=s)this.process(c,o);continue}r.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===s&&(this.process(n,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){co(this),function wl(t,e){Ia(t);const n=e.outputLen;if(t.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}(e,this),this.finished=!0;const{buffer:n,view:r,blockLen:s,isLE:i}=this;let{pos:o}=this;n[o++]=128,this.buffer.subarray(o).fill(0),this.padOffset>s-o&&(this.process(r,0),o=0);for(let b=o;b<s;b++)n[b]=0;(function xh(t,e,n,r){if("function"==typeof t.setBigUint64)return t.setBigUint64(e,n,r);const s=BigInt(32),i=BigInt(4294967295),o=Number(n>>s&i),a=Number(n&i),d=r?0:4;t.setUint32(e+(r?4:0),o,r),t.setUint32(e+d,a,r)})(r,s-8,BigInt(8*this.length),i),this.process(r,0);const a=lo(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const d=c/4,h=this.get();if(d>h.length)throw new Error("_sha2: outputLen bigger than state");for(let b=0;b<d;b++)a.setUint32(4*b,h[b],i)}digest(){const{buffer:e,outputLen:n}=this;this.digestInto(e);const r=e.slice(0,n);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:n,buffer:r,length:s,finished:i,destroyed:o,pos:a}=this;return e.length=s,e.pos=a,e.finished=i,e.destroyed=o,s%n&&e.buffer.set(r),e}}const tn=BigInt(2**32-1),pt=BigInt(32);function Xs(t,e=!1){return e?{h:Number(t&tn),l:Number(t>>pt&tn)}:{h:0|Number(t>>pt&tn),l:0|Number(t&tn)}}const Dt_split=function Rh(t,e=!1){let n=new Uint32Array(t.length),r=new 
193Uint32Array(t.length);for(let s=0;s<t.length;s++){const{h:i,l:o}=Xs(t[s],e);[n[s],r[s]]=[i,o]}return[n,r]},Dt_shrSH=(t,e,n)=>t>>>n,Dt_shrSL=(t,e,n)=>t<<32-n|e>>>n,Dt_rotrSH=(t,e,n)=>t>>>n|e<<32-n,Dt_rotrSL=(t,e,n)=>t<<32-n|e>>>n,Dt_rotrBH=(t,e,n)=>t<<64-n|e>>>n-32,Dt_rotrBL=(t,e,n)=>t>>>n-32|e<<64-n,Dt_add=function Fl(t,e,n,r){const s=(e>>>0)+(r>>>0);return{h:t+n+(s/2**32|0)|0,l:0|s}},Dt_add3L=(t,e,n)=>(t>>>0)+(e>>>0)+(n>>>0),Dt_add3H=(t,e,n,r)=>e+n+r+(t/2**32|0)|0,Dt_add4L=(t,e,n,r)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0),Dt_add4H=(t,e,n,r,s)=>e+n+r+s+(t/2**32|0)|0,Dt_add5H=(t,e,n,r,s,i)=>e+n+r+s+i+(t/2**32|0)|0,Dt_add5L=(t,e,n,r,s)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0)+(s>>>0),[Vl,Gl]=Dt_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
1935771202a","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(t=>BigInt(t))),Wr=new Uint32Array(80),rs=new Uint32Array(80);class ql extends se{constructor(){super(128,64,16,!1),this.Ah=1779033703,this.Al=-205731576,this.Bh=-1150833019,this.Bl=-2067093701,this.Ch=1013904242,this.Cl=-23791573,this.Dh=-1521486534,this.Dl=1595750129,this.Eh=1359893119,this.El=-1377402159,this.Fh=-1694144372,this.Fl=725511199,this.Gh=528734635,this.Gl=-79577749,this.Hh=1541459225,this.Hl=327033209}get(){const{Ah:e,Al:n,Bh:r,Bl:s,Ch:i,Cl:o,Dh:a,Dl:c,Eh:d,El:h,Fh:b,Fl:M,Gh:J,Gl:te,Hh:re,Hl:ae}=this;return[e,n,r,s,i,o,a,c,d,h,b,M,J,te,re,ae]}set(e,n,r,s,i,o,a,c,d,h,b,M,J,te,re,ae){this.Ah=0|e,this.Al=0|n,this.Bh=0|r,this.Bl=0|s,this.Ch=0|i,this.Cl=0|o,this.Dh=0|a,this.Dl=0|c,this.Eh=0|d,this.El=0|h,this.Fh=0|b,this.Fl=0|M,this.Gh=0|J,this.Gl=0|te,this.Hh=0|re,this.Hl=0|ae}process(e,n){for(let oe=0;oe<16;oe++,n+=4)Wr[oe]=e.getUint32(n),rs[oe]=e.getUint32(n+=4);for(let oe=16;oe<80;oe++){const pe=0|Wr[oe-15],Ce=0|rs[oe-15],ke=Dt_rotrSH(pe,Ce,1)^Dt_rotrSH(pe,Ce,8)^Dt_shrSH(pe,Ce,7),Be=Dt_rotrSL(pe,Ce,1)^Dt_rotrSL(pe,Ce,8)^Dt_shrSL(pe,Ce,7),Fe=0|Wr[oe-2],Pe=0|rs[oe-2],Ze=Dt_rotrSH(Fe,Pe,19)^Dt_rotrBH(Fe,Pe,61)^Dt_shrSH(Fe,Pe,6),He=Dt_rotrSL(Fe,Pe,19)^Dt_rotrBL(Fe,Pe,61)^Dt_shrSL(Fe,Pe,6),Me=Dt_add4L(Be,He,rs[oe-7],rs[oe-16]),Ee=Dt_add4H(Me,ke,Ze,Wr[oe-7],Wr[oe-16]);Wr[oe]=0|Ee,rs[oe]=0|Me}let{Ah:r,Al:s,Bh:i,Bl:o,Ch:a,Cl:c,Dh:d,Dl:h,Eh:b,El:M,Fh:J,Fl:te,Gh:re,Gl:ae,Hh:ye,Hl:Se}=this;for(let oe=0;oe<80;oe++){const pe=Dt_rotrSH(b,M,14)^Dt_rotrSH(b,M,18)^Dt_rotrBH(b,M,41),Ce=Dt_rotrSL(b,M,14)^Dt_rotrSL(b,M,18)^Dt_rotrBL(b,M,41),ke=b&J^~b&re,Fe=Dt_add5L(Se,Ce,M&te^~M&ae,Gl[oe],rs[oe]),Pe=Dt_add5H(Fe,ye,pe,ke,Vl[oe],Wr[oe]),Ze=0|Fe,He=Dt_rotrSH(r,s,28)^Dt_rotrBH(r,s,34)^Dt_rotrBH(r,s,39),Me=Dt_rotrSL(r,s,28)^Dt_rotrBL(r,s,34)^Dt_rotrBL(r,s,39),Ee=r&i^r&a^i&a,Ne=s&o^s&c^o&c;ye=0|re,Se=0|ae,re=0|J,ae=0|te,J=0|b,te=0|M,({h:b,l:M}=Dt_add(0|d,0|h,0|Pe,0|Ze)),d=0|a,h=0|c,a=0|i,c=0|o,i=0|r,o=0|s;const le=Dt_add3L(Ze,Me,Ne);r=Dt_add3H(le,Pe,He,Ee),s=0|le}({h:r,l:s}=Dt_add(0|this.Ah,0|this.Al,0|r,0|s)),({h:i,l:o}=Dt_add(0|this.Bh,0|this.Bl,0|i,0|o)),({h:a,l:c}=Dt_add(0|this.Ch,0|this.Cl,0|a,0|c)),({h:d,l:h}=Dt_add(0|this.Dh,0|this.Dl,0|d,0|h)),({h:b,l:M}=Dt_add(0|this.Eh,0|this.El,0|b,0|M)),({h:J,l:te}=Dt_add(0|this.Fh,0|this.Fl,0|J,0|te)),({h:re,l:ae}=Dt_add(0|this.Gh,0|this.Gl,0|re,0|ae)),({h:ye,l:Se}=Dt_add(0|this.Hh,0|this.Hl,0|ye,0|Se)),this.set(r,s,i,o,a,c,d,h,b,M,J,te,re,ae,ye,Se)}roundClean(){Wr.fill(0),rs.fill(0)}destroy(){this.buffer.fill(0),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const Yl=function Nh(t){const e=r=>t().update(Al(r)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}(()=>new ql),uo=BigInt(0),Sa=BigInt(1),Zl=BigInt(2);function fo(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&"Uint8Array"===t.constructor.name}function ho(t){if(!fo(t))throw new Error("Uint8Array expected")}function po(t,e){if("boolean"!=typeof e)throw new Error(t+" boolean expected, got "+e)}const Jl=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function go(t){ho(t);let e="";for(let n=0;n<t.length;n++)e+=Jl[t[n]];return e}function Ta(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);return""===t?uo:BigInt("0x"+t)}function Oa(t){return t>=48&&t<=57?t-48:t>=65&&t<=70?t-55:t>=97&&t<=102?t-87:void 0}function Na(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);const e=t.length,n=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);
vendor: 4,505 bytes, line 193
193const r=new Uint8Array(n);for(let s=0,i=0;s<n;s++,i+=2){const o=Oa(t.charCodeAt(i)),a=Oa(t.charCodeAt(i+1));if(void 0===o||void 0===a)throw new Error('hex string expected, got non-hex character "'+(t[i]+t[i+1])+'" at index '+i);r[s]=16*o+a}return r}function Ii(t){return ho(t),Ta(go(Uint8Array.from(t).reverse()))}function xa(t,e){return Na(t.toString(16).padStart(2*e,"0"))}function mo(t,e){return xa(t,e).reverse()}function Or(t,e,n){let r;if("string"==typeof e)try{r=Na(e)}catch(i){throw new Error(t+" must be hex string or Uint8Array, cause: "+i)}else{if(!fo(e))throw new Error(t+" must be hex string or Uint8Array");r=Uint8Array.from(e)}const s=r.length;if("number"==typeof n&&s!==n)throw new Error(t+" of length "+n+" expected, got "+s);return r}function Ra(...t){let e=0;for(let r=0;r<t.length;r++){const s=t[r];ho(s),e+=s.length}const n=new Uint8Array(e);for(let r=0,s=0;r<t.length;r++){const i=t[r];n.set(i,s),s+=i.length}return n}const yo=t=>"bigint"==typeof t&&uo<=t;function Qs(t,e,n,r){if(!function Ql(t,e,n){return yo(t)&&yo(e)&&yo(n)&&e<=t&&t<n}(e,n,r))throw new Error("expected valid "+t+": "+n+" <= n < "+r+", got "+e)}const tu=t=>(Zl<<BigInt(t-1))-Sa,nu={bigint:t=>"bigint"==typeof t,function:t=>"function"==typeof t,boolean:t=>"boolean"==typeof t,string:t=>"string"==typeof t,stringOrUint8Array:t=>"string"==typeof t||fo(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>"function"==typeof t&&Number.isSafeInteger(t.outputLen)};function _o(t,e,n={}){const r=(s,i,o)=>{const a=nu[i];if("function"!=typeof a)throw new Error("invalid validator function");const c=t[s];if(!(o&&void 0===c||a(c,t)))throw new Error("param "+String(s)+" is invalid. Expected "+i+", got "+c)};for(const[s,i]of Object.entries(e))r(s,i,!1);for(const[s,i]of Object.entries(n))r(s,i,!0);return t}function Pa(t){const e=new WeakMap;return(n,...r)=>{const s=e.get(n);if(void 0!==s)return s;const i=t(n,...r);return e.set(n,i),i}}const gn=BigInt(0),un=BigInt(1),ss=BigInt(2),ru=BigInt(3),Eo=BigInt(4),Da=BigInt(5),Ua=BigInt(8);function hn(t,e){const n=t%e;return n>=gn?n:e+n}function su(t,e,n){if(e<gn)throw new Error("invalid exponent, negatives unsupported");if(n<=gn)throw new Error("invalid modulus");if(n===un)return gn;let r=un;for(;e>gn;)e&un&&(r=r*t%n),t=t*t%n,e>>=un;return r}function ur(t,e,n){let r=t;for(;e-- >gn;)r*=r,r%=n;return r}function ka(t,e){if(t===gn)throw new Error("invert: expected non-zero number");if(e<=gn)throw new Error("invert: expected positive modulus, got "+e);let n=hn(t,e),r=e,s=gn,i=un;for(;n!==gn;){const a=r%n,c=s-i*(r/n);r=n,n=a,s=i,i=c}if(r!==un)throw new Error("invert: does not exist");return hn(s,e)}const cu=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Ma(t,e){const n=void 0!==e?e:t.toString(2).length;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function Ba(t,e,n=!1,r={}){if(t<=gn)throw new Error("invalid field: expected ORDER > 0, got "+t);const{nBitLength:s,nByteLength:i}=Ma(t,e);if(i>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let o;const a=Object.freeze({ORDER:t,isLE:n,BITS:s,BYTES:i,MASK:tu(s),ZERO:gn,ONE:un,create:c=>hn(c,t),isValid:c=>{if("bigint"!=typeof c)throw new Error("invalid field element: expected bigint, got "+typeof c);return gn<=c&&c<t},is0:c=>c===gn,isOdd:c=>(c&un)===un,neg:c=>hn(-c,t),eql:(c,d)=>c===d,sqr:c=>hn(c*c,t),add:(c,d)=>hn(c+d,t),sub:(c,d)=>hn(c-d,t),mul:(c,d)=>hn(c*d,t),pow:(c,d)=>function uu(t,e,n){if(n<gn)throw new Error("invalid exponent, negatives unsupported");if(n===gn)return t.ONE;if(n===un)return e;let r=t.ONE,s=e;for(;n>gn;)n&un&&(r=t.mul(r,s)),s=t.sqr(s),n>>=un;return r}(a,c,d),div:(c,d)=>hn(c*ka(d,t),t),sqrN:c=>c*c,addN:(c,d)=>c+d,subN:(c,d)=>c-d,mulN:(c,d)=>c*d,inv:c=>ka(c,t),sqrt:r.sqrt||(c=>(o||(o=function ou(t){if(t%Eo===ru){const e=(t+un)/Eo;return function(n,r){const s=n.pow(r,e);if(!n.eql(n.sqr(s),r))throw new Error("Cannot find square root");return s}}if(t%Ua===Da){const e=(t-Da)/Ua;return function(n,r){const s=n.mul(r,ss),i=n.pow(s,e),o=n.mul(r,i),a=n.mul(n.mul(o,ss),i),c=n.mul(o,n.sub(a,n.ONE));if(!n.eql(n.sqr(c),r))throw new Error("Cannot find square root");return c}}return function iu(t){const e=(t-un)/ss;let n,r,s;for(n=t-un,r=0;n%ss===gn;n/=ss,r++);for(s=ss;s<t&&su(s,e,t)!==t-un;s++)if(s>1e3)throw new Error("Cannot find square root: likely non-prime P");if(1===r){const o=(t+un)/Eo;return function(a,c){const d=a.pow(c,o);
193if(!a.eql(a.sqr(d),c))throw new Error("Cannot find square root");return d}}const i=(n+un)/ss;return function(o,a){if(o.pow(a,e)===o.neg(o.ONE))throw new Error("Cannot find square root");let c=r,d=o.pow(o.mul(o.ONE,s),n),h=o.pow(a,i),b=o.pow(a,n);for(;!o.eql(b,o.ONE);){if(o.eql(b,o.ZERO))return o.ZERO;let M=1;for(let te=o.sqr(b);M<c&&!o.eql(te,o.ONE);M++)te=o.sqr(te);const J=o.pow(d,un<<BigInt(c-M-1));d=o.sqr(J),h=o.mul(h,J),b=o.mul(b,d),c=M}return h}}(t)}(t)),o(a,c))),invertBatch:c=>function du(t,e){const n=new Array(e.length),r=e.reduce((i,o,a)=>t.is0(o)?i:(n[a]=i,t.mul(i,o)),t.ONE),s=t.inv(r);return e.reduceRight((i,o,a)=>t.is0(o)?i:(n[a]=t.mul(i,n[a]),t.mul(i,o)),s),n}(a,c),cmov:(c,d,h)=>h?d:c,toBytes:c=>n?mo(c,i):xa(c,i),fromBytes:c=>{if(c.length!==i)throw new Error("Field.fromBytes: expected "+i+" bytes, got "+c.length);return n?Ii(c):function Xl(t){return Ta(go(t))}(c)}});return Object.freeze(a)}const La=BigInt(0),Si=BigInt(1);function Ti(t,e){const n=e.negate();return t?n:e}function gt(t,e){if(!Number.isSafeInteger(t)||t<=0||t>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+t)}function ei(t,e){return gt(t,e),{windows:Math.ceil(e/t)+1,windowSize:2**(t-1)}}const bo=new WeakMap,Fa=new WeakMap;function ti(t){return Fa.get(t)||1}const q=BigInt(0),V=BigInt(1),f=BigInt(2),G=BigInt(8),ee={zip215:!0};BigInt(0),BigInt(1);const Ie=BigInt("57896044618658097711785492504343953926634992332820282019728792003956564819949"),Ge=BigInt("19681161376707505956807079304988542015446066515923890162744021073123829784752");BigInt(0);const dt=BigInt(1),_t=BigInt(2);BigInt(3);const Rt=BigInt(5),Sn=BigInt(8),PE=Ba(Ie,void 0,!0),DE={a:BigInt(-1),d:BigInt("37095705934669439343138083508754565189542113879843219016388785533085940283555"),Fp:PE,n:BigInt("7237005577332262213973186563042994240857116359379907606001950938285454250989"),h:Sn,Gx:BigInt("15112221349535400772501151409588531511454012693041857206046113283949847762202"),Gy:BigInt("46316835694926478169428394003475163141307993866256225615783033603165251855960"),hash:Yl,randomBytes:Il,adjustScalarBytes:function Vn(t){return t[0]&=248,t[31]&=127,t[31]|=64,t},uvRatio:function pu(t,e){const n=Ie,r=hn(e*e*e,n),i=function ni(t){const e=BigInt(10),n=BigInt(20),r=BigInt(40),s=BigInt(80),i=Ie,o=t*t%i*t%i,a=ur(o,_t,i)*o%i,c=ur(a,dt,i)*t%i,d=ur(c,Rt,i)*c%i,h=ur(d,e,i)*d%i,b=ur(h,n,i)*h%i,M=ur(b,r,i)*b%i,J=ur(M,s,i)*M%i,te=ur(J,s,i)*M%i,re=ur(te,e,i)*d%i;return{pow_p_5_8:ur(re,_t,i)*t%i,b2:o}}(t*hn(r*r*e,n)).pow_p_5_8;let o=hn(t*r*i,n);const a=hn(e*o*o,n),c=o,d=hn(o*Ge,n),h=a===t,b=a===hn(-t,n),M=a===hn(-t*Ge,n);return h&&(o=c),(b||M)&&(o=d),((t,e)=>(hn(t,e)&un)===un)(o,n)&&(o=hn(-o,n)),{isValid:h||b,value:o}}},gu=function fe(t){const e=function de(t){const e=function hu(t){return function lu(t){_o(t,cu.reduce((r,s)=>(r[s]="function",r),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"}))}(t.Fp),_o(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Ma(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}(t);return _o(t,{hash:"function",a:"bigint",d:"bigint",randomBytes:"function"},{adjustScalarBytes:"function",domain:"function",uvRatio:"function",mapToCurve:"function"}),Object.freeze({...e})}(t),{Fp:n,n:r,prehash:s,hash:i,randomBytes:o,nByteLength:a,h:c}=e,d=f<<BigInt(8*a)-V,h=n.create,b=Ba(e.n,e.nBitLength),M=e.uvRatio||((le,ue)=>{try{return{isValid:!0,value:n.sqrt(le*n.inv(ue))}}catch{return{isValid:!1,value:q}}}),J=e.adjustScalarBytes||(le=>le),te=e.domain||((le,ue,be)=>{if(po("phflag",be),ue.length||be)throw new Error("Contexts/pre-hash are not supported");return le});function re(le,ue){Qs("coordinate "+le,ue,q,d)}function ae(le){if(!(le instanceof oe))throw new Error("ExtendedPoint expected")}const ye=Pa((le,ue)=>{const{ex:be,ey:Re,ez:we}=le,De=le.is0();null==ue&&(ue=De?G:n.inv(we));const je=h(be*ue),ze=h(Re*ue),ot=h(we*ue);if(De)return{x:q,y:V};if(ot!==V)throw new Error("invZ was invalid");return{x:je,y:ze}}),Se=Pa(le=>{const{a:ue,d:be}=e;if(le.is0())throw new Error("bad point: ZERO");const{ex:Re,ey:we,ez:De,et:je}=le,ze=h(Re*Re),ot=h(we*we),mt=h(De*De),st=h(mt*mt),It=h(ze*ue);if(h(mt*h(It+ot))!==h(st+h(be*h(ze*ot))))throw new Error("bad point: equation left != right (1)");if(h(Re*we)!==h(De*je))throw new Error("bad point: equation left != right (2)");return!0});class oe{constructor(ue,be,Re,we){this.ex=ue,this.ey=be,this.ez=Re,this.et=we,re("x",ue),re("y",be),re("z",Re),re("t",we),Object.freeze(this)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static fromAffine(ue){if(ue instanceof oe)throw new Error("extended point not allowed");const{x:be,y:Re}=ue||{};return re("x",be),re("y",Re),new oe(be,Re,V,h(be*Re))}static normalizeZ(ue){const be=n.invertBatch(ue.map(Re=>Re.ez));return ue.map((Re,we)=>Re.toAffine(be[we])).map(oe.fromAffine)}static msm(ue,be){return function wo(t,e,n,r){if(function In(t,e){if(!Array.isArray(t))throw new Error("array expected");t.forEach((n,r)=>{if(!(n instanceof e))throw new Error("invalid point at index "+r)})}(n,t),function vo(t,e){if(!Array.isArray(t))throw new Error("array of scalars expected");t.forEach((n,r)=>{if(!e.isValid(n))throw new Error("invalid scalar at index "+r)})}(r,e),n.length!==r.length)throw new Error("arrays of points and scalars must have equal length");const s=t.ZERO,i=function eu(t){let e;for(e=0;t>uo;t>>=Sa,e+=1);return e}(BigInt(n.length)),o=i>12?i-3:i>4?i-2:i?2:1,a=(1<<o)-1,c=new Array(a+1).fill(s);let h=s;for(let b=Math.floor((e.BITS-1)/o)*o;b>=0;b-=o){c.fill(s);for(let J=0;J<r.length;J++){const re=Number(r[J]>>BigInt(b)&BigInt(a));c[re]=c[re].add(n[J])}let M=s;for(let J=c.length-1,te=s;J>0;J--)te=te.add(c[J]),M=M.add(te);
193if(h=h.add(M),0!==b)for(let J=0;J<o;J++)h=h.double()}return h}(oe,b,ue,be)}_setWindowSize(ue){ke.setWindowSize(this,ue)}assertValidity(){Se(this)}equals(ue){ae(ue);const{ex:be,ey:Re,ez:we}=this,{ex:De,ey:je,ez:ze}=ue,ot=h(be*ze),mt=h(De*we),st=h(Re*ze),It=h(je*we);return ot===mt&&st===It}is0(){return this.equals(oe.ZERO)}negate(){return new oe(h(-this.ex),this.ey,this.ez,h(-this.et))}double(){const{a:ue}=e,{ex:be,ey:Re,ez:we}=this,De=h(be*be),je=h(Re*Re),ze=h(f*h(we*we)),ot=h(ue*De),mt=be+Re,st=h(h(mt*mt)-De-je),It=ot+je,St=It-ze,Wt=ot-je,Ot=h(st*St),Lt=h(It*Wt),ln=h(st*Wt),fn=h(St*It);return new oe(Ot,Lt,fn,ln)}add(ue){ae(ue);const{a:be,d:Re}=e,{ex:we,ey:De,ez:je,et:ze}=this,{ex:ot,ey:mt,ez:st,et:It}=ue;if(be===BigInt(-1)){const IE=h((De-we)*(mt+ot)),SE=h((De+we)*(mt-ot)),wh=h(SE-IE);if(wh===q)return this.double();const TE=h(je*f*It),OE=h(ze*f*st),NE=OE+TE,xE=SE+IE,RE=OE-TE,GD=h(NE*wh),qD=h(xE*RE),YD=h(NE*RE),ZD=h(wh*xE);return new oe(GD,qD,ZD,YD)}const St=h(we*ot),Wt=h(De*mt),Ot=h(ze*Re*It),Lt=h(je*st),ln=h((we+De)*(ot+mt)-St-Wt),fn=Lt-Ot,vn=Lt+Ot,Xn=h(Wt-be*St),Lr=h(ln*fn),ao=h(vn*Xn),Ca=h(ln*Xn),bh=h(fn*vn);return new oe(Lr,ao,bh,Ca)}subtract(ue){return this.add(ue.negate())}wNAF(ue){return ke.wNAFCached(this,ue,oe.normalizeZ)}multiply(ue){const be=ue;Qs("scalar",be,V,r);const{p:Re,f:we}=this.wNAF(be);return oe.normalizeZ([Re,we])[0]}multiplyUnsafe(ue,be=oe.ZERO){const Re=ue;return Qs("scalar",Re,q,r),Re===q?Ce:this.is0()||Re===V?this:ke.wNAFCachedUnsafe(this,Re,oe.normalizeZ,be)}isSmallOrder(){return this.multiplyUnsafe(c).is0()}isTorsionFree(){return ke.unsafeLadder(this,r).is0()}toAffine(ue){return ye(this,ue)}clearCofactor(){const{h:ue}=e;return ue===V?this:this.multiplyUnsafe(ue)}static fromHex(ue,be=!1){const{d:Re,a:we}=e,De=n.BYTES;ue=Or("pointHex",ue,De),po("zip215",be);const je=ue.slice(),ze=ue[De-1];je[De-1]=-129&ze;const ot=Ii(je);Qs("pointHex.y",ot,q,be?d:n.ORDER);const st=h(ot*ot),It=h(st-V),St=h(Re*st-we);let{isValid:Wt,value:Ot}=M(It,St);if(!Wt)throw new Error("Point.fromHex: invalid y coordinate");const Lt=(Ot&V)===V,ln=!!(128&ze);if(!be&&Ot===q&&ln)throw new Error("Point.fromHex: x=0 and x_0=1");return ln!==Lt&&(Ot=h(-Ot)),oe.fromAffine({x:Ot,y:ot})}static fromPrivateKey(ue){return Pe(ue).point}toRawBytes(){const{x:ue,y:be}=this.toAffine(),Re=mo(be,n.BYTES);return Re[Re.length-1]|=ue&V?128:0,Re}toHex(){return go(this.toRawBytes())}}oe.BASE=new oe(e.Gx,e.Gy,V,h(e.Gx*e.Gy)),oe.ZERO=new oe(q,V,V,q);const{BASE:pe,ZERO:Ce}=oe,ke=function fu(t,e){return{constTimeNegate:Ti,hasPrecomputes:n=>1!==ti(n),unsafeLadder(n,r,s=t.ZERO){let i=n;for(;r>La;)r&Si&&(s=s.add(i)),i=i.double(),r>>=Si;return s},precomputeWindow(n,r){const{windows:s,windowSize:i}=ei(r,e),o=[];let a=n,c=a;for(let d=0;d<s;d++){c=a,o.push(c);for(let h=1;h<i;h++)c=c.add(a),o.push(c);a=c.double()}return o},wNAF(n,r,s){const{windows:i,windowSize:o}=ei(n,e);let a=t.ZERO,c=t.BASE;const d=BigInt(2**n-1),h=2**n,b=BigInt(n);for(let M=0;M<i;M++){const J=M*o;let te=Number(s&d);s>>=b,te>o&&(te-=h,s+=Si);const re=J,ae=J+Math.abs(te)-1,Se=te<0;0===te?c=c.add(Ti(M%2!=0,r[re])):a=a.add(Ti(Se,r[ae]))}return{p:a,f:c}},wNAFUnsafe(n,r,s,i=t.ZERO){const{windows:o,windowSize:a}=ei(n,e),c=BigInt(2**n-1),d=2**n,h=BigInt(n);for(let b=0;b<o;b++){const M=b*a;if(s===La)break;let J=Number(s&c);if(s>>=h,J>a&&(J-=d,s+=Si),0===J)continue;let te=r[M+Math.abs(J)-1];J<0&&(te=te.negate()),i=i.add(te)}return i},getPrecomputes(n,r,s){let i=bo.get(r);return i||(i=this.precomputeWindow(r,n),1!==n&&bo.set(r,s(i))),i},wNAFCached(n,r,s){const i=ti(n);return this.wNAF(i,this.getPrecomputes(i,n,s),r)},wNAFCachedUnsafe(n,r,s,i){const o=ti(n);return 1===o?this.unsafeLadder(n,r,i):this.wNAFUnsafe(o,this.getPrecomputes(o,n,s),r,i)},setWindowSize(n,r){gt(r,e),Fa.set(n,r),bo.delete(n)}}}(oe,8*a);function Be(le){return hn(le,r)}function Fe(le){return Be(Ii(le))}function Pe(le){const ue=n.BYTES;le=Or("private key",le,ue);const be=Or("hashed private key",i(le),2*ue),Re=J(be.slice(0,ue)),we=be.slice(ue,2*ue),De=Fe(Re),je=pe.multiply(De),ze=je.toRawBytes();return{head:Re,prefix:we,scalar:De,point:je,pointBytes:ze}}function He(le=new Uint8Array,...ue){const be=Ra(...ue);return Fe(i(te(be,Or("context",le),!!s)))}const Ee=ee;return pe._setWindowSize(8),{CURVE:e,getPublicKey:function Ze(le){return Pe(le).pointBytes},sign:function Me(le,ue,be={}){le=Or("message",le),s&&(le=s(le));const{prefix:Re,scalar:we,pointBytes:De}=Pe(ue),je=He(be.context,Re,le),ze=pe.multiply(je).toRawBytes(),mt=Be(je+He(be.context,ze,De,le)*we);return Qs("signature.s",mt,q,r),Or("result",Ra(ze,mo(mt,n.BYTES)),2*n.BYTES)},verify:function Ne(le,ue,be,Re=Ee){const{context:we,zip215:De}=Re,je=n.BYTES;le=Or("signature",le,2*je),ue=Or("message",ue),be=Or("publicKey",be,je),void 0!==De&&po("zip215",De),s&&(ue=s(ue));const ze=Ii(le.slice(je,2*je));let ot,mt,st;try{ot=oe.fromHex(be,De),mt=oe.fromHex(le.slice(0,je),De),st=pe.multiplyUnsafe(ze)}catch{return!1}if(!De&&ot.isSmallOrder())return!1;const It=He(we,mt.toRawBytes(),ot.toRawBytes(),ue);return mt.add(ot.multiplyUnsafe(It)).subtract(st).clearCofactor().equals(oe.ZERO)},ExtendedPoint:oe,utils:{getExtendedPublicKey:Pe,randomPrivateKey:()=>o(n.BYTES),precompute:(le=8,ue=oe.BASE)=>(ue._setWindowSize(le),ue.multiply(BigInt(3)),ue)}}}(DE),Wa="base64url",Mh="did",Bh="key",ja="base58btc";function yu(t){return null!=globalThis.Buffer?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function Wh(t=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?yu(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function jh(t,e){e||(e=t.reduce((s,i)=>s+i.length,0));const n=Wh(e);let r=0;for(const s of t)n.set(s,r),r+=s.length;return yu(n)}var LE=function ME(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),r=0;r<n.length;r++)n[r]=255;for(var s=0;s<t.length;s++){var i=t.charAt(s),o=i.charCodeAt(0);if(255!==n[o])throw new TypeError(i+" is ambiguous");n[o]=s}var a=t.length,c=t.charAt(0),d=Math.log(a)/Math.log(256),h=Math.log(256)/Math.log(a);function M(te){if("string"!=typeof te)throw new TypeError("Expected String");if(0===te.length)return new Uint8Array;var re=0;if(" "!==te[re]){for(var ae=0,ye=0;te[re]===c;)ae++,re++;for(var Se=(te.length-re)*d+1>>>0,oe=new Uint8Array(Se);te[re];){var pe=n[te.charCodeAt(re)];if(255===pe)return;for(var Ce=0,ke=Se-1;(0!==pe||Ce<ye)&&-1!==ke;ke--,Ce++)oe[ke]=(pe+=a*oe[ke]>>>0)%256>>>0,pe=pe/256>>>0;if(0!==pe)throw new Error("Non-zero carry");ye=Ce,re++}if(" "!==te[re]){for(var Be=Se-ye;Be!==Se&&0===oe[Be];)Be++;
193for(var Fe=new Uint8Array(ae+(Se-Be)),Pe=ae;Be!==Se;)Fe[Pe++]=oe[Be++];return Fe}}}return{encode:function b(te){if(te instanceof Uint8Array||(ArrayBuffer.isView(te)?te=new Uint8Array(te.buffer,te.byteOffset,te.byteLength):Array.isArray(te)&&(te=Uint8Array.from(te))),!(te instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===te.length)return"";for(var re=0,ae=0,ye=0,Se=te.length;ye!==Se&&0===te[ye];)ye++,re++;for(var oe=(Se-ye)*h+1>>>0,pe=new Uint8Array(oe);ye!==Se;){for(var Ce=te[ye],ke=0,Be=oe-1;(0!==Ce||ke<ae)&&-1!==Be;Be--,ke++)pe[Be]=(Ce+=256*pe[Be]>>>0)%a>>>0,Ce=Ce/a>>>0;if(0!==Ce)throw new Error("Non-zero carry");ae=ke,ye++}for(var Fe=oe-ae;Fe!==oe&&0===pe[Fe];)Fe++;for(var Pe=c.repeat(re);Fe<oe;++Fe)Pe+=t.charAt(pe[Fe]);return Pe},decodeUnsafe:M,decode:function J(te){var re=M(te);if(re)return re;throw new Error(`Non-${e} character`)}}};const $h=t=>{if(t instanceof Uint8Array&&"Uint8Array"===t.constructor.name)return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")};class jE{constructor(e,n,r){this.name=e,this.prefix=n,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class $E{constructor(e,n,r){if(this.name=e,this.prefix=n,void 0===n.codePointAt(0))throw new Error("Invalid prefix character");this.prefixCodePoint=n.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 Hh(this,e)}}class HE{constructor(e){this.decoders=e}or(e){return Hh(this,e)}decode(e){const r=this.decoders[e[0]];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`)}}const Hh=(t,e)=>new HE({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class KE{constructor(e,n,r,s){this.name=e,this.prefix=n,this.baseEncode=r,this.baseDecode=s,this.encoder=new jE(e,n,r),this.decoder=new $E(e,n,s)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const $a=({name:t,prefix:e,encode:n,decode:r})=>new KE(t,e,n,r),Ao=({prefix:t,name:e,alphabet:n})=>{const{encode:r,decode:s}=LE(n,e);return $a({prefix:t,name:e,encode:r,decode:i=>$h(s(i))})},Nn=({name:t,prefix:e,bitsPerChar:n,alphabet:r})=>$a({prefix:e,name:t,encode:s=>((t,e,n)=>{const r="="===e[e.length-1],s=(1<<n)-1;let i="",o=0,a=0;for(let c=0;c<t.length;++c)for(a=a<<8|t[c],o+=8;o>n;)o-=n,i+=e[s&a>>o];if(o&&(i+=e[s&a<<n-o]),r)for(;i.length*n&7;)i+="=";return i})(s,r,n),decode:s=>((t,e,n,r)=>{const s={};for(let h=0;h<e.length;++h)s[e[h]]=h;let i=t.length;for(;"="===t[i-1];)--i;const o=new Uint8Array(i*n/8|0);let a=0,c=0,d=0;for(let h=0;h<i;++h){const b=s[t[h]];if(void 0===b)throw new SyntaxError(`Non-${r} character`);c=c<<n|b,a+=n,a>=8&&(a-=8,o[d++]=255&c>>a)}if(a>=n||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o})(s,r,n,t)}),GE=$a({prefix:"\0",name:"identity",encode:t=>(t=>(new TextDecoder).decode(t))(t),decode:t=>(t=>(new TextEncoder).encode(t))(t)});var qE=Object.freeze({__proto__:null,identity:GE});const YE=Nn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var ZE=Object.freeze({__proto__:null,base2:YE});const JE=Nn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var XE=Object.freeze({__proto__:null,base8:JE});const QE=Ao({prefix:"9",name:"base10",alphabet:"0123456789"});var ev=Object.freeze({__proto__:null,base10:QE});const tv=Nn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),nv=Nn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var rv=Object.freeze({__proto__:null,base16:tv,base16upper:nv});const sv=Nn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),iv=Nn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),ov=Nn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),av=Nn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),cv=Nn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),lv=Nn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),uv=Nn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),dv=Nn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),fv=Nn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var hv=Object.freeze({__proto__:null,base32:sv,base32upper:iv,base32pad:ov,base32padupper:av,base32hex:cv,base32hexupper:lv,base32hexpad:uv,base32hexpadupper:dv,base32z:fv});const pv=Ao({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),gv=Ao({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var mv=Object.freeze({__proto__:null,base36:pv,base36upper:gv});const yv=Ao({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),_v=Ao({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Ev=Object.freeze({__proto__:null,base58btc:yv,base58flickr:_v});const vv=Nn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789
193+/",bitsPerChar:6}),bv=Nn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),wv=Nn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Cv=Nn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Av=Object.freeze({__proto__:null,base64:vv,base64pad:bv,base64url:wv,base64urlpad:Cv});const Kh=Array.from("\u{1f680}\u{1fa90}\u2604\u{1f6f0}\u{1f30c}\u{1f311}\u{1f312}\u{1f313}\u{1f314}\u{1f315}\u{1f316}\u{1f317}\u{1f318}\u{1f30d}\u{1f30f}\u{1f30e}\u{1f409}\u2600\u{1f4bb}\u{1f5a5}\u{1f4be}\u{1f4bf}\u{1f602}\u2764\u{1f60d}\u{1f923}\u{1f60a}\u{1f64f}\u{1f495}\u{1f62d}\u{1f618}\u{1f44d}\u{1f605}\u{1f44f}\u{1f601}\u{1f525}\u{1f970}\u{1f494}\u{1f496}\u{1f499}\u{1f622}\u{1f914}\u{1f606}\u{1f644}\u{1f4aa}\u{1f609}\u263a\u{1f44c}\u{1f917}\u{1f49c}\u{1f614}\u{1f60e}\u{1f607}\u{1f339}\u{1f926}\u{1f389}\u{1f49e}\u270c\u2728\u{1f937}\u{1f631}\u{1f60c}\u{1f338}\u{1f64c}\u{1f60b}\u{1f497}\u{1f49a}\u{1f60f}\u{1f49b}\u{1f642}\u{1f493}\u{1f929}\u{1f604}\u{1f600}\u{1f5a4}\u{1f603}\u{1f4af}\u{1f648}\u{1f447}\u{1f3b6}\u{1f612}\u{1f92d}\u2763\u{1f61c}\u{1f48b}\u{1f440}\u{1f62a}\u{1f611}\u{1f4a5}\u{1f64b}\u{1f61e}\u{1f629}\u{1f621}\u{1f92a}\u{1f44a}\u{1f973}\u{1f625}\u{1f924}\u{1f449}\u{1f483}\u{1f633}\u270b\u{1f61a}\u{1f61d}\u{1f634}\u{1f31f}\u{1f62c}\u{1f643}\u{1f340}\u{1f337}\u{1f63b}\u{1f613}\u2b50\u2705\u{1f97a}\u{1f308}\u{1f608}
193\u{1f918}\u{1f4a6}\u2714\u{1f623}\u{1f3c3}\u{1f490}\u2639\u{1f38a}\u{1f498}\u{1f620}\u261d\u{1f615}\u{1f33a}\u{1f382}\u{1f33b}\u{1f610}\u{1f595}\u{1f49d}\u{1f64a}\u{1f639}\u{1f5e3}\u{1f4ab}\u{1f480}\u{1f451}\u{1f3b5}\u{1f91e}\u{1f61b}\u{1f534}\u{1f624}\u{1f33c}\u{1f62b}\u26bd\u{1f919}\u2615\u{1f3c6}\u{1f92b}\u{1f448}\u{1f62e}\u{1f646}\u{1f37b}\u{1f343}\u{1f436}\u{1f481}\u{1f632}\u{1f33f}\u{1f9e1}\u{1f381}\u26a1\u{1f31e}\u{1f388}\u274c\u270a\u{1f44b}\u{1f630}\u{1f928}\u{1f636}\u{1f91d}\u{1f6b6}\u{1f4b0}\u{1f353}\u{1f4a2}\u{1f91f}\u{1f641}\u{1f6a8}\u{1f4a8}\u{1f92c}\u2708\u{1f380}\u{1f37a}\u{1f913}\u{1f619}\u{1f49f}\u{1f331}\u{1f616}\u{1f476}\u{1f974}\u25b6\u27a1\u2753\u{1f48e}\u{1f4b8}\u2b07\u{1f628}\u{1f31a}\u{1f98b}\u{1f637}\u{1f57a}\u26a0\u{1f645}\u{1f61f}\u{1f635}\u{1f44e}\u{1f932}\u{1f920}\u{1f927}\u{1f4cc}\u{1f535}\u{1f485}\u{1f9d0}\u{1f43e}\u{1f352}\u{1f617}\u{1f911}\u{1f30a}\u{1f92f}\u{1f437}\u260e\u{1f4a7}\u{1f62f}\u{1f486}\u{1f446}\u{1f3a4}\u{1f647}\u{1f351}\u2744\u{1f334}\u{1f4a3}\u{1f438}\u{1f48c}\u{1f4cd}\u{1f940}\u{1f922}\u{1f445}\u{1f4a1}\u{1f4a9}\u{1f450}\u{1f4f8}\u{1f47b}\u{1f910}\u{1f92e}\u{1f3bc}\u{1f975}\u{1f6a9}\u{1f34e}\u{1f34a}\u{1f47c}\u{1f48d}\u{1f4e3}\u{1f942}"),Iv=Kh.reduce((t,e,n)=>(t[n]=e,t),[]),Sv=Kh.reduce((t,e,n)=>(t[e.codePointAt(0)]=n,t),[]),Nv=$a({prefix:"\u{1f680}",name:"base256emoji",encode:function Tv(t){return t.reduce((e,n)=>e+Iv[n],"")},decode:function Ov(t){const e=[];for(const n of t){const r=Sv[n.codePointAt(0)];if(void 0===r)throw new Error(`Non-base256emoji character: ${n}`);e.push(r)}return new Uint8Array(e)}});var xv=Object.freeze({__proto__:null,base256emoji:Nv}),Uv=Math.pow(2,31),Bv=Math.pow(2,7),Lv=Math.pow(2,14),Fv=Math.pow(2,21),Wv=Math.pow(2,28),jv=Math.pow(2,35),$v=Math.pow(2,42),Hv=Math.pow(2,49),Kv=Math.pow(2,56),zv=Math.pow(2,63),Gv={encode:function Vh(t,e,n){e=e||[];for(var r=n=n||0;t>=Uv;)e[n++]=255&t|128,t/=128;for(;-128&t;)e[n++]=255&t|128,t>>>=7;return e[n]=0|t,Vh.bytes=n-r+1,e},decode:function _u(t,r){var o,n=0,s=0,i=r=r||0,a=t.length;do{if(i>=a)throw _u.bytes=0,new RangeError("Could not decode varint");o=t[i++],n+=s<28?(127&o)<<s:(127&o)*Math.pow(2,s),s+=7}while(o>=128);return _u.bytes=i-r,n},encodingLength:function(t){return t<Bv?1:t<Lv?2:t<Fv?3:t<Wv?4:t<jv?5:t<$v?6:t<Hv?7:t<Kv?8:t<zv?9:10}},qh=Gv;const Yh=(t,e,n=0)=>(qh.encode(t,e,n),e),Zh=t=>qh.encodingLength(t),Eu=(t,e)=>{const n=e.byteLength,r=Zh(t),s=r+Zh(n),i=new Uint8Array(s+n);return Yh(t,i,0),Yh(n,i,r),i.set(e,s),new qv(t,n,e,i)};class qv{constructor(e,n,r,s){this.code=e,this.size=n,this.digest=r,this.bytes=s}}const Jh=({name:t,code:e,encode:n})=>new Yv(t,e,n);class Yv{constructor(e,n,r){this.name=e,this.code=n,this.encode=r}digest(e){if(e instanceof Uint8Array){const n=this.encode(e);return n instanceof Uint8Array?Eu(this.code,n):n.then(r=>Eu(this.code,r))}throw Error("Unknown type, must be binary type")}}const Xh=t=>function(){var e=(0,l.A)(function*(n){return new Uint8Array(yield crypto.subtle.digest(t,n))});return function(n){return e.apply(this,arguments)}}(),Zv=Jh({name:"sha2-256",code:18,encode:Xh("SHA-256")}),Jv=Jh({name:"sha2-512",code:19,encode:Xh("SHA-512")});Object.freeze({__proto__:null,sha256:Zv,sha512:Jv});const ep=$h;Object.freeze({__proto__:null,identity:{code:0,name:"identity",encode:ep,digest:t=>Eu(0,ep(t))}}),new TextEncoder,new TextDecoder;const tp={...qE,...ZE,...XE,...ev,...rv,...hv,...mv,...Ev,...Av,...xv};function np(t,e,n,r){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:n},decoder:{decode:r}}}const rp=np("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>(new TextEncoder).encode(t.substring(1))),vu=np("ascii","a",t=>{let e="a";for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return e},t=>{const e=Wh((t=t.substring(1)).length);for(let n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e}),sp={utf8:rp,"utf-8":rp,hex:tp.base16,latin1:vu,ascii:vu,binary:vu,...tp};function Oi(t,e="utf8"){const n=sp[e];if(!n)throw new Error(`Unsupported encoding "${e}"`);return"utf8"!==e&&"utf-8"!==e||null==globalThis.Buffer||null==globalThis.Buffer.from?n.encoder.encode(t).substring(1):globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("utf8")}function ri(t,e="utf8"){const n=sp[e];if(!n)throw new Error(`Unsupported encoding "${e}"`);return"utf8"!==e&&"utf-8"!==e||null==globalThis.Buffer||null==globalThis.Buffer.from?n.decoder.decode(`${n.prefix}${t}`):yu(globalThis.Buffer.from(t,"utf-8"))}function Ha(t){return he(Oi(ri(t,Wa),"utf8"))}function Ka(t){return Oi(ri(Oe(t),"utf8"),Wa)}function ip(t){const n="z"+Oi(jh([ri("K36",ja),t]),ja);return[Mh,Bh,n].join(":")}function nb(t){return Oi(t,Wa)}function za(t){const e=t.split("."),n=Ha(e[0]),r=Ha(e[1]),s=function rb(t){return ri(t,Wa)}(e[2]);return{header:n,payload:r,signature:s,data:ri(e.slice(0,2).join("."),"utf8")}}function op(t=Il(32)){const e=gu.getPublicKey(t);return{secretKey:jh([t,e]),publicKey:e}}function bu(){return(bu=(0,l.A)(function*(t,e,n,r,s=(0,_.fromMiliseconds)(Date.now())){const i={alg:"EdDSA",typ:"JWT"},c={iss:ip(r.publicKey),sub:t,aud:e,iat:s,exp:s+n}
193,d=function sb(t){return ri([Ka(t.header),Ka(t.payload)].join("."),"utf8")}({header:i,payload:c});return function ib(t){return[Ka(t.header),Ka(t.payload),nb(t.signature)].join(".")}({header:i,payload:c,signature:gu.sign(d,r.secretKey.slice(0,32))})})).apply(this,arguments)}var ap=function(t,e,n){if(n||2===arguments.length)for(var i,r=0,s=e.length;r<s;r++)(i||!(r in e))&&(i||(i=Array.prototype.slice.call(e,0,r)),i[r]=e[r]);return t.concat(i||Array.prototype.slice.call(e))},ab=function(){return function t(e,n,r){this.name=e,this.version=n,this.os=r,this.type="browser"}}(),cb=function(){return function t(e){this.version=e,this.type="node",this.name="node",this.os=process.platform}}(),lb=function(){return function t(e,n,r,s){this.name=e,this.version=n,this.os=r,this.bot=s,this.type="bot-device"}}(),ub=function(){return function t(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}}(),db=function(){return function t(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}}(),hb=/(nuhk|curl|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,pb=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["pie",/^Microsoft Pocket Internet Explorer\/(\d+\.\d+)$/],["pie",/^Mozilla\/\d\.\d+\s\(compatible;\s(?:MSP?IE|MSInternet Explorer) (\d+\.\d+);.*Windows CE.*\)$/],["netfront",/^Mozilla\/\d\.\d+.*NetFront\/(\d.\d)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FB[AS]V\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["curl",/^curl\/([0-9\.]+)$/],["searchbot",/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/]],lp=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Windows CE",/Windows CE|WinCE|Microsoft Pocket Internet Explorer/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function dp(t){var e=function up(t){return""!==t&&pb.reduce(function(e,n){var r=n[0];if(e)return e;var i=n[1].exec(t);return!!i&&[r,i]},!1)}(t);if(!e)return null;var n=e[0],r=e[1];if("searchbot"===n)return new ub;var s=r[1]&&r[1].split(".").join("_").split("_").slice(0,3);s?s.length<3&&(s=ap(ap([],s,!0),function _b(t){for(var e=[],n=0;n<t;n++)e.push("0");return e}(3-s.length),!0)):s=[];var i=s.join("."),o=function mb(t){for(var e=0,n=lp.length;e<n;e++){var r=lp[e],s=r[0];if(r[1].exec(t))return s}return null}(t),a=hb.exec(t);return a&&a[1]?new lb(n,i,o,a[1]):new ab(n,i,o)}var is=u(7793),Eb=u(52596);
193class Yt extends Error{constructor(e,n={}){const r=(()=>{if(n.cause instanceof Yt){if(n.cause.details)return n.cause.details;if(n.cause.shortMessage)return n.cause.shortMessage}return n.cause&&"details"in n.cause&&"string"==typeof n.cause.details?n.cause.details:n.cause?.message?n.cause.message:n.details})(),s=n.cause instanceof Yt&&n.cause.docsPath||n.docsPath,o=`https://oxlib.sh${s??""}`;super([e||"An error occurred.",...n.metaMessages?["",...n.metaMessages]:[],...r||s?["",r?`Details: ${r}`:void 0,s?`See: ${o}`:void 0]:[]].filter(c=>"string"==typeof c).join("\n"),n.cause?{cause:n.cause}:void 0),Object.defineProperty(this,"details",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docs",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"docsPath",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"shortMessage",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"cause",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"BaseError"}),Object.defineProperty(this,"version",{enumerable:!0,configurable:!0,writable:!0,value:"[email protected]"}),this.cause=n.cause,this.details=r,this.docs=o,this.docsPath=s,this.shortMessage=e}walk(e){return fp(this,e)}}function fp(t,e){return e?.(t)?t:t&&"object"==typeof t&&"cause"in t&&t.cause?fp(t.cause,e):e?null:t}function hp(t,e){if(Ss(t)>e)throw new kb({givenSize:Ss(t),maxSize:e})}function pp(t,e={}){const{dir:n,size:r=32}=e;if(0===r)return t;const s=t.replace("0x","");if(s.length>2*r)throw new Mb({size:Math.ceil(s.length/2),targetSize:r,type:"Hex"});return`0x${s["right"===n?"padEnd":"padStart"](2*r,"0")}`}function Va(t,e,n){return JSON.stringify(t,(r,s)=>"function"==typeof e?e(r,s):"bigint"==typeof s?s.toString()+"#__bigint":s,n)}const Tb=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Au(t){return t instanceof Uint8Array?xi(t):Array.isArray(t)?xi(new Uint8Array(t)):t}function xi(t,e={}){let n="";for(let s=0;s<t.length;s++)n+=Tb[t[s]];const r=`0x${n}`;return"number"==typeof e.size?(hp(r,e.size),mp(r,e.size)):r}function Iu(t,e={}){const{signed:n,size:r}=e,s=BigInt(t);let i;r?i=n?(1n<<8n*BigInt(r)-1n)-1n:2n**(8n*BigInt(r))-1n:"number"==typeof t&&(i=BigInt(Number.MAX_SAFE_INTEGER));const o="bigint"==typeof i&&n?-i-1n:0;if(i&&s>i||s<o){const d="bigint"==typeof t?"n":"";throw new Db({max:i?`${i}${d}`:void 0,min:`${o}${d}`,signed:n,size:r,value:`${t}${d}`})}const c=`0x${(n&&s<0?(1n<<BigInt(8*r))+BigInt(s):s).toString(16)}`;return r?function gp(t,e){return pp(t,{dir:"left",size:e})}(c,r):c}function mp(t,e){return pp(t,{dir:"right",size:e})}function os(t,e,n,r={}){const{strict:s}=r;!function wb(t,e){if("number"==typeof e&&e>0&&e>Ss(t)-1)throw new Ep({offset:e,position:"start",size:Ss(t)})}(t,e);const i=`0x${t.replace("0x","").slice(2*(e??0),2*(n??t.length))}`;return s&&function Cb(t,e,n){if("number"==typeof e&&"number"==typeof n&&Ss(t)!==n-e)throw new Ep({offset:n,position:"end",size:Ss(t)})}(i,e,n),i}function Ss(t){return Math.ceil((t.length-2)/2)}class Db extends Yt{constructor({max:e,min:n,signed:r,size:s,value:i}){super(`Number \`${i}\` is not in safe${s?` ${8*s}-bit`:""}${r?" signed":" unsigned"} integer range ${e?`(\`${n}\` to \`${e}\`)`:`(above \`${n}\`)`}`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.IntegerOutOfRangeError"})}}class yp extends Yt{constructor(e){super(`Value \`${"object"==typeof e?Va(e):e}\` of type \`${typeof e}\` is an invalid hex type.`,{metaMessages:['Hex types must be represented as `"0x${string}"`.']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexTypeError"})}}class _p extends Yt{constructor(e){super(`Value \`${e}\` is an invalid hex value.`,{metaMessages:['Hex values must start with `"0x"` and contain only hexadecimal characters (0-9, a-f, A-F).']}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.InvalidHexValueError"})}}class kb extends Yt{constructor({givenSize:e,maxSize:n}
193){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${e}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeOverflowError"})}}class Ep extends Yt{constructor({offset:e,position:n,size:r}){super(`Slice ${"start"===n?"starting":"ending"} at offset \`${e}\` is out-of-bounds (size: \`${r}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SliceOffsetOutOfBoundsError"})}}class Mb extends Yt{constructor({size:e,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${e}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Hex.SizeExceedsPaddingSizeError"})}}function Ou(t){if(130!==t.length&&132!==t.length)throw new Hb({signature:t});const e=BigInt(os(t,0,32)),n=BigInt(os(t,32,64)),r=(()=>{const s=+`0x${t.slice(130)}`;if(!Number.isNaN(s))try{return function Nu(t){if(0===t||27===t)return 0;if(1===t||28===t)return 1;if(t>=35)return t%2==0?1:0;throw new Vb({value:t})}(s)}catch{throw new Ga({value:s})}})();return typeof r>"u"?{r:e,s:n}:{r:e,s:n,yParity:r}}class Hb extends Yt{constructor({signature:e}){super(`Value \`${e}\` is an invalid signature size.`,{metaMessages:["Expected: 64 bytes or 65 bytes.",`Received ${Ss(Au(e))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidSerializedSizeError"})}}class Ga extends Yt{constructor({value:e}){super(`Value \`${e}\` is an invalid y-parity value. Y-parity must be 0 or 1.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidYParityError"})}}class Vb extends Yt{constructor({value:e}){super(`Value \`${e}\` is an invalid v value. v must be 27, 28 or >=35.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Signature.InvalidVError"})}}const Ri="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;function So(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function as(t,...e){if(!function qb(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&"Uint8Array"===t.constructor.name}(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function Pi(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function Cp(t,e){as(t);const n=e.outputLen;if(t.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function Ts(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function Ru(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function jr(t,e){return t<<32-e|t>>>e}function Xb(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}const Ap=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0]?t=>t:function Qb(t){for(let e=0;e<t.length;e++)t[e]=Xb(t[e]);return t};function Di(t){return"string"==typeof t&&(t=function Tp(t){if("string"!=typeof t)throw new Error("string expected");return new Uint8Array((new TextEncoder).encode(t))}(t)),as(t),t}class Du{}function Op(t){const e=r=>t().update(Di(r)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function rw(t=32){if(Ri&&"function"==typeof Ri.getRandomValues)return Ri.getRandomValues(new Uint8Array(t));if(Ri&&"function"==typeof Ri.randomBytes)return Uint8Array.from(Ri.randomBytes(t));throw new Error("crypto.getRandomValues must be defined")}function iw(t,e,n){return t&e^~t&n}function ow(t,e,n){return t&e^t&n^e&n}class Np extends Du{constructor(e,n,r,s){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=n,this.padOffset=r,this.isLE=s,this.buffer=new Uint8Array(e),this.view=Ru(this.buffer)}update(e){Pi(this),as(e=Di(e));const{view:n,buffer:r,blockLen:s}=this,i=e.length;for(let o=0;o<i;){const a=Math.min(s-this.pos,i-o);if(a===s){const c=Ru(e);for(;s<=i-o;o+=s)this.process(c,o);continue}r.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===s&&(this.process(n,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Pi(this),Cp(e,this),this.finished=!0;const{buffer:n,view:r,blockLen:s,isLE:i}=this;let{pos:o}=this;n[o++]=128,Ts(this.buffer.subarray(o)),this.padOffset>s-o&&(this.process(r,0),o=0);for(let b=o;b<s;b++)n[b]=0;(function sw(t,e,n,r){if("function"==typeof t.setBigUint64)return t.setBigUint64(e,n,r);const s=BigInt(32),i=BigInt(4294967295),o=Number(n>>s&i),a=Number(n&i),d=r?0:4;t.setUint32(e+(r?4:0),o,r),t.setUint32(e+d,a,r)})(r,s-8,BigInt(8*this.length),i),this.process(r,0);const a=Ru(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const d=c/4,h=this.get();if(d>h.length)throw new Error("_sha2: outputLen bigger than state");for(let b=0;b<d;b++)a.setUint32(4*b,h[b],i)}digest(){const{buffer:e,outputLen:n}=this;this.digestInto(e);const r=e.slice(0,n);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:n,buffer:r,length:s,finished:i,destroyed:o,pos:a}=this;return e.destroyed=o,e.finished=i,e.length=s,e.pos=a,s%n&&e.buffer.set(r),e}clone(){return this._cloneInto()}}const Os=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),qa=BigInt(2**32-1),Uu=BigInt(32);function xp(t,e=!1){return e?{h:Number(t&qa),l:Number(t>>Uu&qa)}:{h:0|Number(t>>Uu&qa),l:0|Number(t&qa)}}function ku(t,e=!1){const n=t.length;let r=new Uint32Array(n),s=new Uint32Array(n);for(let i=0;i<n;i++){const{h:o,l:a}=xp(t[i],e);[r[i],s[i]]=[o,a]}return[r,s]}const uw=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756
vendor: 2,004 bytes, line 193
193734187,3204031479,3329325298]),xs=new Uint32Array(64);class jp extends Np{constructor(e=32){super(64,e,8,!1),this.A=0|Os[0],this.B=0|Os[1],this.C=0|Os[2],this.D=0|Os[3],this.E=0|Os[4],this.F=0|Os[5],this.G=0|Os[6],this.H=0|Os[7]}get(){const{A:e,B:n,C:r,D:s,E:i,F:o,G:a,H:c}=this;return[e,n,r,s,i,o,a,c]}set(e,n,r,s,i,o,a,c){this.A=0|e,this.B=0|n,this.C=0|r,this.D=0|s,this.E=0|i,this.F=0|o,this.G=0|a,this.H=0|c}process(e,n){for(let b=0;b<16;b++,n+=4)xs[b]=e.getUint32(n,!1);for(let b=16;b<64;b++){const M=xs[b-15],J=xs[b-2],te=jr(M,7)^jr(M,18)^M>>>3,re=jr(J,17)^jr(J,19)^J>>>10;xs[b]=re+xs[b-7]+te+xs[b-16]|0}let{A:r,B:s,C:i,D:o,E:a,F:c,G:d,H:h}=this;for(let b=0;b<64;b++){const J=h+(jr(a,6)^jr(a,11)^jr(a,25))+iw(a,c,d)+uw[b]+xs[b]|0,re=(jr(r,2)^jr(r,13)^jr(r,22))+ow(r,s,i)|0;h=d,d=c,c=a,a=o+J|0,o=i,i=s,s=r,r=J+re|0}r=r+this.A|0,s=s+this.B|0,i=i+this.C|0,o=o+this.D|0,a=a+this.E|0,c=c+this.F|0,d=d+this.G|0,h=h+this.H|0,this.set(r,s,i,o,a,c,d,h)}roundClean(){Ts(xs)}destroy(){this.set(0,0,0,0,0,0,0,0),Ts(this.buffer)}}ku(["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
1935771202a","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(t=>BigInt(t)));const hw=Op(()=>new jp);class Hp extends Du{constructor(e,n){super(),this.finished=!1,this.destroyed=!1,function Yb(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.createHasher");So(t.outputLen),So(t.blockLen)}(e);const r=Di(n);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const s=this.blockLen,i=new Uint8Array(s);i.set(r.length>s?e.create().update(r).digest():r);for(let o=0;o<i.length;o++)i[o]^=54;this.iHash.update(i),this.oHash=e.create();for(let o=0;o<i.length;o++)i[o]^=106;this.oHash.update(i),Ts(i)}update(e){return Pi(this),this.iHash.update(e),this}digestInto(e){Pi(this),as(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:r,finished:s,destroyed:i,blockLen:o,outputLen:a}=this;return e.finished=s,e.destroyed=i,e.blockLen=o,e.outputLen=a,e.oHash=n._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const Kp=(t,e,n)=>new Hp(t,e).update(n).digest();Kp.create=(t,e)=>new Hp(t,e);const Ya=BigInt(0),No=BigInt(1);function xo(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&"Uint8Array"===t.constructor.name}function Fu(t){if(!xo(t))throw new Error("Uint8Array expected")}function Ro(t,e){if("boolean"!=typeof e)throw new Error(t+" boolean expected, got "+e)}function Po(t){const e=t.toString(16);return 1&e.length?"0"+e:e}function zp(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);return""===t?Ya:BigInt("0x"+t)}const Vp="function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex,pw=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Do(t){if(Fu(t),Vp)return t.toHex();let e="";for(let n=0;n<t.length;n++)e+=pw[t[n]];return e}function Gp(t){return t>=48&&t<=57?t-48:t>=65&&t<=70?t-55:t>=97&&t<=102?t-87:void 0}function Uo(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);if(Vp)return Uint8Array.fromHex(t);const e=t.length,n=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const r=new Uint8Array(n);for(let s=0,i=0;s<n;s++,i+=2){const o=Gp(t.charCodeAt(i)),a=Gp(t.charCodeAt(i+1));if(void 0===o||void 0===a)throw new Error('hex string expected, got non-hex character "'+(t[i]+t[i+1])+'" at index '+i);r[s]=16*o+a}return r}function oi(t){return zp(Do(t))}function qp(t){return Fu(t),zp(Do(Uint8Array.from(t).reverse()))}function ko(t,e){return Uo(t.toString(16).padStart(2*e,"0"))}function Yp(t,e){return ko(t,e).reverse()}function _r(t,e,n){let r;if("string"==typeof e)try{r=Uo(e)}catch(i){throw new Error(t+" must be hex string or Uint8Array, cause: "+i)}else{if(!xo(e))throw new Error(t+" must be hex string or Uint8Array");r=Uint8Array.from(e)}const s=r.length;if("number"==typeof n&&s!==n)throw new Error(t+" of length "+n+" expected, got "+s);return r}function Za(...t){let e=0;for(let r=0;r<t.length;r++){const s=t[r];Fu(s),e+=s.length}const n=new Uint8Array(e);for(let r=0,s=0;r<t.length;r++){const i=t[r];n.set(i,s),s+=i.length}return n}const Wu=t=>"bigint"==typeof t&&Ya<=t;function ju(t,e,n){return Wu(t)&&Wu(e)&&Wu(n)&&e<=t&&t<n}function Ui(t,e,n,r){if(!ju(e,n,r))throw new Error("expected valid "+t+": "+n+" <= n < "+r+", got "+e)}const Ja=t=>(No<<BigInt(t))-No,$u=t=>new Uint8Array(t),Zp=t=>Uint8Array.from(t),yw={bigint:t=>"bigint"==typeof t,function:t=>"function"==typeof t,boolean:t=>"boolean"==typeof t,string:t=>"string"==typeof t,stringOrUint8Array:t=>"string"==typeof t||xo(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>"function"==typeof t&&Number.isSafeInteger(t.outputLen)};function Xa(t,e,n={}){const r=(s,i,o)=>{const a=yw[i];if("function"!=typeof a)throw new Error("invalid validator function");const c=t[s];if(!(o&&void 0===c||a(c,t)))throw new Error("param "+String(s)+" is invali
193d. Expected "+i+", got "+c)};for(const[s,i]of Object.entries(e))r(s,i,!1);for(const[s,i]of Object.entries(n))r(s,i,!0);return t}function Jp(t){const e=new WeakMap;return(n,...r)=>{const s=e.get(n);if(void 0!==s)return s;const i=t(n,...r);return e.set(n,i),i}}const Gn=BigInt(0),mn=BigInt(1),ai=BigInt(2),bw=BigInt(3),Xp=BigInt(4),Qp=BigInt(5),eg=BigInt(8);function Wn(t,e){const n=t%e;return n>=Gn?n:e+n}function Er(t,e,n){let r=t;for(;e-- >Gn;)r*=r,r%=n;return r}function Qa(t,e){if(t===Gn)throw new Error("invert: expected non-zero number");if(e<=Gn)throw new Error("invert: expected positive modulus, got "+e);let n=Wn(t,e),r=e,s=Gn,i=mn,o=mn,a=Gn;for(;n!==Gn;){const d=r/n,h=r%n,b=s-o*d,M=i-a*d;r=n,n=h,s=o,i=a,o=b,a=M}if(r!==mn)throw new Error("invert: does not exist");return Wn(s,e)}function tg(t,e){const r=t.pow(e,(t.ORDER+mn)/Xp);if(!t.eql(t.sqr(r),e))throw new Error("Cannot find square root");return r}function ww(t,e){const n=(t.ORDER-Qp)/eg,r=t.mul(e,ai),s=t.pow(r,n),i=t.mul(e,s),o=t.mul(t.mul(i,ai),s),a=t.mul(i,t.sub(o,t.ONE));if(!t.eql(t.sqr(a),e))throw new Error("Cannot find square root");return a}const Iw=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function rg(t,e,n=!1){const r=new Array(e.length).fill(n?t.ZERO:void 0),s=e.reduce((o,a,c)=>t.is0(a)?o:(r[c]=o,t.mul(o,a)),t.ONE),i=t.inv(s);return e.reduceRight((o,a,c)=>t.is0(a)?o:(r[c]=t.mul(o,r[c]),t.mul(o,a)),i),r}function Hu(t,e){const r=t.pow(e,(t.ORDER-mn)/ai),s=t.eql(r,t.ONE),i=t.eql(r,t.ZERO),o=t.eql(r,t.neg(t.ONE));if(!s&&!i&&!o)throw new Error("invalid Legendre symbol result");return s?1:i?0:-1}function Ku(t,e){void 0!==e&&So(e);const n=void 0!==e?e:t.toString(2).length;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function ec(t,e,n=!1,r={}){if(t<=Gn)throw new Error("invalid field: expected ORDER > 0, got "+t);const{nBitLength:s,nByteLength:i}=Ku(t,e);if(i>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let o;const a=Object.freeze({ORDER:t,isLE:n,BITS:s,BYTES:i,MASK:Ja(s),ZERO:Gn,ONE:mn,create:c=>Wn(c,t),isValid:c=>{if("bigint"!=typeof c)throw new Error("invalid field element: expected bigint, got "+typeof c);return Gn<=c&&c<t},is0:c=>c===Gn,isOdd:c=>(c&mn)===mn,neg:c=>Wn(-c,t),eql:(c,d)=>c===d,sqr:c=>Wn(c*c,t),add:(c,d)=>Wn(c+d,t),sub:(c,d)=>Wn(c-d,t),mul:(c,d)=>Wn(c*d,t),pow:(c,d)=>function ng(t,e,n){if(n<Gn)throw new Error("invalid exponent, negatives unsupported");if(n===Gn)return t.ONE;if(n===mn)return e;let r=t.ONE,s=e;for(;n>Gn;)n&mn&&(r=t.mul(r,s)),s=t.sqr(s),n>>=mn;return r}(a,c,d),div:(c,d)=>Wn(c*Qa(d,t),t),sqrN:c=>c*c,addN:(c,d)=>c+d,subN:(c,d)=>c-d,mulN:(c,d)=>c*d,inv:c=>Qa(c,t),sqrt:r.sqrt||(c=>
193(o||(o=function Aw(t){return t%Xp===bw?tg:t%eg===Qp?ww:function Cw(t){if(t<BigInt(3))throw new Error("sqrt is not defined for small field");let e=t-mn,n=0;for(;e%ai===Gn;)e/=ai,n++;let r=ai;const s=ec(t);for(;1===Hu(s,r);)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(1===n)return tg;let i=s.pow(r,e);const o=(e+mn)/ai;return function(c,d){if(c.is0(d))return d;if(1!==Hu(c,d))throw new Error("Cannot find square root");let h=n,b=c.mul(c.ONE,i),M=c.pow(d,e),J=c.pow(d,o);for(;!c.eql(M,c.ONE);){if(c.is0(M))return c.ZERO;let te=1,re=c.sqr(M);for(;!c.eql(re,c.ONE);)if(te++,re=c.sqr(re),te===h)throw new Error("Cannot find square root");const ae=mn<<BigInt(h-te-1),ye=c.pow(b,ae);h=te,b=c.sqr(ye),M=c.mul(M,b),J=c.mul(J,ye)}return J}}(t)}(t)),o(a,c))),toBytes:c=>n?Yp(c,i):ko(c,i),fromBytes:c=>{if(c.length!==i)throw new Error("Field.fromBytes: expected "+i+" bytes, got "+c.length);return n?qp(c):oi(c)},invertBatch:c=>rg(a,c),cmov:(c,d,h)=>h?d:c});return Object.freeze(a)}function sg(t){if("bigint"!=typeof t)throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function ig(t){const e=sg(t);return e+Math.ceil(e/2)}const og=BigInt(0),zu=BigInt(1);function Vu(t,e){const n=e.negate();return t?n:e}function Gu(t,e){if(!Number.isSafeInteger(t)||t<=0||t>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+t)}function qu(t,e){Gu(t,e);const s=2**t;return{windows:Math.ceil(e/t)+1,windowSize:2**(t-1),mask:Ja(t),maxNumber:s,shiftBy:BigInt(t)}}function ag(t,e,n){const{windowSize:r,mask:s,maxNumber:i,shiftBy:o}=n;let a=Number(t&s),c=t>>o;a>r&&(a-=i,c+=zu);const d=e*r;return{nextN:c,offset:d+Math.abs(a)-1,isZero:0===a,isNeg:a<0,isNegF:e%2!=0,offsetF:d}}const Yu=new WeakMap,ug=new WeakMap;function Zu(t){return ug.get(t)||1}function xw(t,e,n,r){(function cg(t,e){if(!Array.isArray(t))throw new Error("array expected");t.forEach((n,r)=>{if(!(n instanceof e))throw new Error("invalid point at index "+r)})})(n,t),function lg(t,e){if(!Array.isArray(t))throw new Error("array of scalars expected");t.forEach((n,r)=>{if(!e.isValid(n))throw new Error("invalid scalar at index "+r)})}(r,e);const s=n.length,i=r.length;if(s!==i)throw new Error("arrays of points and scalars must have equal length");const o=t.ZERO,a=function gw(t){let e;for(e=0;t>Ya;t>>=No,e+=1);return e}(BigInt(s));let c=1;a>12?c=a-3:a>4?c=a-2:a>0&&(c=2);const d=Ja(c),h=new Array(Number(d)+1).fill(o);let M=o;for(let J=Math.floor((e.BITS-1)/c)*c;J>=0;J-=c){h.fill(o);for(let re=0;re<i;re++){const ye=Number(r[re]>>BigInt(J)&d);h[ye]=h[ye].add(n[re])}let te=o;for(let re=h.length-1,ae=o;re>0;re--)ae=ae.add(h[re]),te=te.add(ae);if(M=M.add(te),0!==J)for(let re=0;re<c;re++)M=M.double()}return M}function dg(t){return function Sw(t){Xa(t,Iw.reduce((r,s)=>(r[s]="function",r),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"}))}(t.Fp),Xa(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...Ku(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}function fg(t){void 0!==t.lowS&&Ro("lowS",t.lowS),void 0!==t.prehash&&Ro("prehash",t.prehash)}
vendor: 4,467 bytes, line 193
193class Uw extends Error{constructor(e=""){super(e)}}const us={Err:Uw,_tlv:{encode:(t,e)=>{const{Err:n}=us;if(t<0||t>256)throw new n("tlv.encode: wrong tag");if(1&e.length)throw new n("tlv.encode: unpadded data");const r=e.length/2,s=Po(r);if(s.length/2&128)throw new n("tlv.encode: long form length too big");const i=r>127?Po(s.length/2|128):"";return Po(t)+i+s+e},decode(t,e){const{Err:n}=us;let r=0;if(t<0||t>256)throw new n("tlv.encode: wrong tag");if(e.length<2||e[r++]!==t)throw new n("tlv.decode: wrong tlv");const s=e[r++];let o=0;if(128&s){const c=127&s;if(!c)throw new n("tlv.decode(long): indefinite length not supported");if(c>4)throw new n("tlv.decode(long): byte length is too big");const d=e.subarray(r,r+c);if(d.length!==c)throw new n("tlv.decode: length bytes not complete");if(0===d[0])throw new n("tlv.decode(long): zero leftmost byte");for(const h of d)o=o<<8|h;if(r+=c,o<128)throw new n("tlv.decode(long): not minimal encoding")}else o=s;const a=e.subarray(r,r+o);if(a.length!==o)throw new n("tlv.decode: wrong value length");return{v:a,l:e.subarray(r+o)}}},_int:{encode(t){const{Err:e}=us;if(t<Nr)throw new e("integer: negative integers are not allowed");let n=Po(t);if(8&Number.parseInt(n[0],16)&&(n="00"+n),1&n.length)throw new e("unexpected DER parsing assertion: unpadded hex");return n},decode(t){const{Err:e}=us;if(128&t[0])throw new e("invalid signature integer: negative");if(0===t[0]&&!(128&t[1]))throw new e("invalid signature integer: unnecessary leading zero");return oi(t)}},toSig(t){const{Err:e,_int:n,_tlv:r}=us,s=_r("signature",t),{v:i,l:o}=r.decode(48,s);if(o.length)throw new e("invalid signature: left bytes after parsing");const{v:a,l:c}=r.decode(2,i),{v:d,l:h}=r.decode(2,c);if(h.length)throw new e("invalid signature: left bytes after parsing");return{r:n.decode(a),s:n.decode(d)}},hexFromSig(t){const{_tlv:e,_int:n}=us,r=e.encode(2,n.encode(t.r)),s=e.encode(2,n.encode(t.s));return e.encode(48,r+s)}};function Ju(t,e){return Do(ko(t,e))}const Nr=BigInt(0),en=BigInt(1),Mo=(BigInt(2),BigInt(3)),Xu=BigInt(4);function Bw(t){const e=function Mw(t){const e=dg(t);return Xa(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}(t),{Fp:n,n:r,nByteLength:s,nBitLength:i}=e,o=n.BYTES+1,a=2*n.BYTES+1;function c(le){return Wn(le,r)}function d(le){return Qa(le,r)}const{ProjectivePoint:h,normPrivateKeyToScalar:b,weierstrassEquation:M,isWithinCurveOrder:J}=function kw(t){const e=function Dw(t){const e=dg(t);Xa(e,{a:"field",b:"field"},{allowInfinityPoint:"boolean",allowedPrivateKeyLengths:"array",clearCofactor:"function",fromBytes:"function",isTorsionFree:"function",toBytes:"function",wrapPrivateKey:"boolean"});const{endo:n,Fp:r,a:s}=e;if(n){if(!r.eql(s,r.ZERO))throw new Error("invalid endo: CURVE.a must be 0");if("object"!=typeof n||"bigint"!=typeof n.beta||"function"!=typeof n.splitScalar)throw new Error('invalid endo: expected "beta": bigint and "splitScalar": function')}return Object.freeze({...e})}(t),{Fp:n}=e,r=ec(e.n,e.nBitLength),s=e.toBytes||((oe,pe,Ce)=>{const ke=pe.toAffine();return Za(Uint8Array.from([4]),n.toBytes(ke.x),n.toBytes(ke.y))}),i=e.fromBytes||(oe=>{const pe=oe.subarray(1);return{x:n.fromBytes(pe.subarray(0,n.BYTES)),y:n.fromBytes(pe.subarray(n.BYTES,2*n.BYTES))}});function o(oe){const{a:pe,b:Ce}=e,ke=n.sqr(oe),Be=n.mul(ke,oe);return n.add(n.add(Be,n.mul(oe,pe)),Ce)}function a(oe,pe){const Ce=n.sqr(pe),ke=o(oe);return n.eql(Ce,ke)}if(!a(e.Gx,e.Gy))throw new Error("bad curve params: generator point");const c=n.mul(n.pow(e.a,Mo),Xu),d=n.mul(n.sqr(e.b),BigInt(27));if(n.is0(n.add(c,d)))throw new Error("bad curve params: a or b");function b(oe){const{allowedPrivateKeyLengths:pe,nByteLength:Ce,wrapPrivateKey:ke,n:Be}=e;if(pe&&"bigint"!=typeof oe){if(xo(oe)&&(oe=Do(oe)),"string"!=typeof oe||!pe.includes(oe.length))throw new Error("invalid private key");oe=oe.padStart(2*Ce,"0")}let Fe;try{Fe="bigint"==typeof oe?oe:oi(_r("private key",oe,Ce))}catch{throw new Error("invalid private key, expected hex or "+Ce+" bytes, got "+typeof oe)}return ke&&(Fe=Wn(Fe,Be)),Ui("private key",Fe,en,Be),Fe}function M(oe){if(!(oe instanceof re))throw new Error("ProjectivePoint expected")}const J=Jp((oe,pe)=>{const{px:Ce,py:ke,pz:Be}=oe;if(n.eql(Be,n.ONE))return{x:Ce,y:ke};const Fe=oe.is0();null==pe&&(pe=Fe?n.ONE:n.inv(Be));const Pe=n.mul(Ce,pe),Ze=n.mul(ke,pe),He=n.mul(Be,pe);if(Fe)return{x:n.ZERO,y:n.ZERO};
vendor: 2,386 bytes, line 193
193if(!n.eql(He,n.ONE))throw new Error("invZ was invalid");return{x:Pe,y:Ze}}),te=Jp(oe=>{if(oe.is0()){if(e.allowInfinityPoint&&!n.is0(oe.py))return;throw new Error("bad point: ZERO")}const{x:pe,y:Ce}=oe.toAffine();if(!n.isValid(pe)||!n.isValid(Ce))throw new Error("bad point: x or y not FE");if(!a(pe,Ce))throw new Error("bad point: equation left != right");if(!oe.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});class re{constructor(pe,Ce,ke){if(null==pe||!n.isValid(pe))throw new Error("x required");if(null==Ce||!n.isValid(Ce)||n.is0(Ce))throw new Error("y required");if(null==ke||!n.isValid(ke))throw new Error("z required");this.px=pe,this.py=Ce,this.pz=ke,Object.freeze(this)}static fromAffine(pe){const{x:Ce,y:ke}=pe||{};if(!pe||!n.isValid(Ce)||!n.isValid(ke))throw new Error("invalid affine point");if(pe instanceof re)throw new Error("projective point not allowed");const Be=Fe=>n.eql(Fe,n.ZERO);return Be(Ce)&&Be(ke)?re.ZERO:new re(Ce,ke,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(pe){const Ce=rg(n,pe.map(ke=>ke.pz));return pe.map((ke,Be)=>ke.toAffine(Ce[Be])).map(re.fromAffine)}static fromHex(pe){const Ce=re.fromAffine(i(_r("pointHex",pe)));return Ce.assertValidity(),Ce}static fromPrivateKey(pe){return re.BASE.multiply(b(pe))}static msm(pe,Ce){return xw(re,r,pe,Ce)}_setWindowSize(pe){Se.setWindowSize(this,pe)}assertValidity(){te(this)}hasEvenY(){const{y:pe}=this.toAffine();if(n.isOdd)return!n.isOdd(pe);throw new Error("Field doesn't support isOdd")}equals(pe){M(pe);const{px:Ce,py:ke,pz:Be}=this,{px:Fe,py:Pe,pz:Ze}=pe,He=n.eql(n.mul(Ce,Ze),n.mul(Fe,Be)),Me=n.eql(n.mul(ke,Ze),n.mul(Pe,Be));return He&&Me}negate(){return new re(this.px,n.neg(this.py),this.pz)}double(){const{a:pe,b:Ce}=e,ke=n.mul(Ce,Mo),{px:Be,py:Fe,pz:Pe}=this;let Ze=n.ZERO,He=n.ZERO,Me=n.ZERO,Ee=n.mul(Be,Be),Ne=n.mul(Fe,Fe),le=n.mul(Pe,Pe),ue=n.mul(Be,Fe);return ue=n.add(ue,ue),Me=n.mul(Be,Pe),Me=n.add(Me,Me),Ze=n.mul(pe,Me),He=n.mul(ke,le),He=n.add(Ze,He),Ze=n.sub(Ne,He),He=n.add(Ne,He),He=n.mul(Ze,He),Ze=n.mul(ue,Ze),Me=n.mul(ke,Me),le=n.mul(pe,le),ue=n.sub(Ee,le),ue=n.mul(pe,ue),ue=n.add(ue,Me),Me=n.add(Ee,Ee),Ee=n.add(Me,Ee),Ee=n.add(Ee,le),Ee=n.mul(Ee,ue),He=n.add(He,Ee),le=n.mul(Fe,Pe),le=n.add(le,le),Ee=n.mul(le,ue),Ze=n.sub(Ze,Ee),Me=n.mul(le,Ne),Me=n.add(Me,Me),Me=n.add(Me,Me),new re(Ze,He,Me)}
vendor: 4,552 bytes, line 193
193add(pe){M(pe);const{px:Ce,py:ke,pz:Be}=this,{px:Fe,py:Pe,pz:Ze}=pe;let He=n.ZERO,Me=n.ZERO,Ee=n.ZERO;const Ne=e.a,le=n.mul(e.b,Mo);let ue=n.mul(Ce,Fe),be=n.mul(ke,Pe),Re=n.mul(Be,Ze),we=n.add(Ce,ke),De=n.add(Fe,Pe);we=n.mul(we,De),De=n.add(ue,be),we=n.sub(we,De),De=n.add(Ce,Be);let je=n.add(Fe,Ze);return De=n.mul(De,je),je=n.add(ue,Re),De=n.sub(De,je),je=n.add(ke,Be),He=n.add(Pe,Ze),je=n.mul(je,He),He=n.add(be,Re),je=n.sub(je,He),Ee=n.mul(Ne,De),He=n.mul(le,Re),Ee=n.add(He,Ee),He=n.sub(be,Ee),Ee=n.add(be,Ee),Me=n.mul(He,Ee),be=n.add(ue,ue),be=n.add(be,ue),Re=n.mul(Ne,Re),De=n.mul(le,De),be=n.add(be,Re),Re=n.sub(ue,Re),Re=n.mul(Ne,Re),De=n.add(De,Re),ue=n.mul(be,De),Me=n.add(Me,ue),ue=n.mul(je,De),He=n.mul(we,He),He=n.sub(He,ue),ue=n.mul(we,be),Ee=n.mul(je,Ee),Ee=n.add(Ee,ue),new re(He,Me,Ee)}subtract(pe){return this.add(pe.negate())}is0(){return this.equals(re.ZERO)}wNAF(pe){return Se.wNAFCached(this,pe,re.normalizeZ)}multiplyUnsafe(pe){const{endo:Ce,n:ke}=e;Ui("scalar",pe,Nr,ke);const Be=re.ZERO;if(pe===Nr)return Be;if(this.is0()||pe===en)return this;if(!Ce||Se.hasPrecomputes(this))return Se.wNAFCachedUnsafe(this,pe,re.normalizeZ);let{k1neg:Fe,k1:Pe,k2neg:Ze,k2:He}=Ce.splitScalar(pe),Me=Be,Ee=Be,Ne=this;for(;Pe>Nr||He>Nr;)Pe&en&&(Me=Me.add(Ne)),He&en&&(Ee=Ee.add(Ne)),Ne=Ne.double(),Pe>>=en,He>>=en;return Fe&&(Me=Me.negate()),Ze&&(Ee=Ee.negate()),Ee=new re(n.mul(Ee.px,Ce.beta),Ee.py,Ee.pz),Me.add(Ee)}multiply(pe){const{endo:Ce,n:ke}=e;let Be,Fe;if(Ui("scalar",pe,en,ke),Ce){const{k1neg:Pe,k1:Ze,k2neg:He,k2:Me}=Ce.splitScalar(pe);let{p:Ee,f:Ne}=this.wNAF(Ze),{p:le,f:ue}=this.wNAF(Me);Ee=Se.constTimeNegate(Pe,Ee),le=Se.constTimeNegate(He,le),le=new re(n.mul(le.px,Ce.beta),le.py,le.pz),Be=Ee.add(le),Fe=Ne.add(ue)}else{const{p:Pe,f:Ze}=this.wNAF(pe);Be=Pe,Fe=Ze}return re.normalizeZ([Be,Fe])[0]}multiplyAndAddUnsafe(pe,Ce,ke){const Be=re.BASE,Fe=(Ze,He)=>He!==Nr&&He!==en&&Ze.equals(Be)?Ze.multiply(He):Ze.multiplyUnsafe(He),Pe=Fe(this,Ce).add(Fe(pe,ke));return Pe.is0()?void 0:Pe}toAffine(pe){return J(this,pe)}isTorsionFree(){const{h:pe,isTorsionFree:Ce}=e;if(pe===en)return!0;if(Ce)return Ce(re,this);throw new Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){const{h:pe,clearCofactor:Ce}=e;return pe===en?this:Ce?Ce(re,this):this.multiplyUnsafe(e.h)}toRawBytes(pe=!0){return Ro("isCompressed",pe),this.assertValidity(),s(re,this,pe)}toHex(pe=!0){return Ro("isCompressed",pe),Do(this.toRawBytes(pe))}}re.BASE=new re(e.Gx,e.Gy,n.ONE),re.ZERO=new re(n.ZERO,n.ONE,n.ZERO);const{endo:ae,nBitLength:ye}=e,Se=function Nw(t,e){return{constTimeNegate:Vu,hasPrecomputes:n=>1!==Zu(n),unsafeLadder(n,r,s=t.ZERO){let i=n;for(;r>og;)r&zu&&(s=s.add(i)),i=i.double(),r>>=zu;return s},precomputeWindow(n,r){const{windows:s,windowSize:i}=qu(r,e),o=[];let a=n,c=a;for(let d=0;d<s;d++){c=a,o.push(c);for(let h=1;h<i;h++)c=c.add(a),o.push(c);a=c.double()}return o},wNAF(n,r,s){let i=t.ZERO,o=t.BASE;const a=qu(n,e);for(let c=0;c<a.windows;c++){const{nextN:d,offset:h,isZero:b,isNeg:M,isNegF:J,offsetF:te}=ag(s,c,a);s=d,b?o=o.add(Vu(J,r[te])):i=i.add(Vu(M,r[h]))}return{p:i,f:o}},wNAFUnsafe(n,r,s,i=t.ZERO){const o=qu(n,e);for(let a=0;a<o.windows&&s!==og;a++){const{nextN:c,offset:d,isZero:h,isNeg:b}=ag(s,a,o);if(s=c,!h){const M=r[d];i=i.add(b?M.negate():M)}}return i},getPrecomputes(n,r,s){let i=Yu.get(r);return i||(i=this.precomputeWindow(r,n),1!==n&&Yu.set(r,s(i))),i},wNAFCached(n,r,s){const i=Zu(n);return this.wNAF(i,this.getPrecomputes(i,n,s),r)},wNAFCachedUnsafe(n,r,s,i){const o=Zu(n);return 1===o?this.unsafeLadder(n,r,i):this.wNAFUnsafe(o,this.getPrecomputes(o,n,s),r,i)},setWindowSize(n,r){Gu(r,e),ug.set(n,r),Yu.delete(n)}}}(re,ae?Math.ceil(ye/2):ye);return{CURVE:e,ProjectivePoint:re,normPrivateKeyToScalar:b,weierstrassEquation:o,isWithinCurveOrder:function h(oe){return ju(oe,en,e.n)}}}({...e,toBytes(le,ue,be){const Re=ue.toAffine(),we=n.toBytes(Re.x),De=Za;return Ro("isCompressed",be),be?De(Uint8Array.from([ue.hasEvenY()?2:3]),we):De(Uint8Array.from([4]),we,n.toBytes(Re.y))},fromBytes(le){const ue=le.length,be=le[0],Re=le.subarray(1);if(ue!==o||2!==be&&3!==be){if(ue===a&&4===be)return{x:n.fromBytes(Re.subarray(0,n.BYTES)),y:n.fromBytes(Re.subarray(n.BYTES,2*n.BYTES))};throw new Error("invalid Point, expected length of "+o+", or uncompressed "+a+", got "+ue)}{const we=oi(Re);if(!ju(we,en,n.ORDER))throw new Error("Point is not on curve");const De=M(we);let je;try{je=n.sqrt(De)}catch(mt){const st=mt instanceof Error?": "+mt.message:"";throw new Error("Point is not on curve"+st)}
193return!(1&~be)!=((je&en)===en)&&(je=n.neg(je)),{x:we,y:je}}}});function te(le){return le>r>>en}const ae=(le,ue,be)=>oi(le.slice(ue,be));class ye{constructor(ue,be,Re){Ui("r",ue,en,r),Ui("s",be,en,r),this.r=ue,this.s=be,null!=Re&&(this.recovery=Re),Object.freeze(this)}static fromCompact(ue){const be=s;return ue=_r("compactSignature",ue,2*be),new ye(ae(ue,0,be),ae(ue,be,2*be))}static fromDER(ue){const{r:be,s:Re}=us.toSig(_r("DER",ue));return new ye(be,Re)}assertValidity(){}addRecoveryBit(ue){return new ye(this.r,this.s,ue)}recoverPublicKey(ue){const{r:be,s:Re,recovery:we}=this,De=Be(_r("msgHash",ue));if(null==we||![0,1,2,3].includes(we))throw new Error("recovery id invalid");const je=2===we||3===we?be+e.n:be;if(je>=n.ORDER)throw new Error("recovery id 2 or 3 invalid");const ot=h.fromHex((1&we?"03":"02")+Ju(je,n.BYTES)),mt=d(je),st=c(-De*mt),It=c(Re*mt),St=h.BASE.multiplyAndAddUnsafe(ot,st,It);if(!St)throw new Error("point at infinify");return St.assertValidity(),St}hasHighS(){return te(this.s)}normalizeS(){return this.hasHighS()?new ye(this.r,c(-this.s),this.recovery):this}toDERRawBytes(){return Uo(this.toDERHex())}toDERHex(){return us.hexFromSig(this)}toCompactRawBytes(){return Uo(this.toCompactHex())}toCompactHex(){const ue=s;return Ju(this.r,ue)+Ju(this.s,ue)}}const Se={isValidPrivateKey(le){try{return b(le),!0}catch{return!1}},normPrivateKeyToScalar:b,randomPrivateKey:()=>{const le=ig(e.n);return function Tw(t,e,n=!1){const r=t.length,s=sg(e),i=ig(e);if(r<16||r<i||r>1024)throw new Error("expected "+i+"-1024 bytes of input, got "+r);const a=Wn(n?qp(t):oi(t),e-mn)+mn;return n?Yp(a,s):ko(a,s)}(e.randomBytes(le),e.n)},precompute:(le=8,ue=h.BASE)=>(ue._setWindowSize(le),ue.multiply(BigInt(3)),ue)};function pe(le){if("bigint"==typeof le)return!1;if(le instanceof h)return!0;const be=_r("key",le).length,Re=n.BYTES,we=Re+1;return e.allowedPrivateKeyLengths||s===we?void 0:be===we||be===2*Re+1}const ke=e.bits2int||function(le){if(le.length>8192)throw new Error("input is too large");const ue=oi(le),be=8*le.length-i;return be>0?ue>>BigInt(be):ue},Be=e.bits2int_modN||function(le){return c(ke(le))},Fe=Ja(i);function Pe(le){return Ui("num < 2^"+i,le,Nr,Fe),ko(le,s)}const He={lowS:e.lowS,prehash:!1},Me={lowS:e.lowS,prehash:!1};return h.BASE._setWindowSize(8),{CURVE:e,getPublicKey:function oe(le,ue=!0){return h.fromPrivateKey(le).toRawBytes(ue)},getSharedSecret:function Ce(le,ue,be=!0){if(!0===pe(le))throw new Error("first arg must be private key");if(!1===pe(ue))throw new Error("second arg must be public key");return h.fromHex(ue).multiply(b(le)).toRawBytes(be)},sign:function Ee(le,ue,be=He){const{seed:Re,k2sig:we}=function Ze(le,ue,be=He){if(["recovered","canonical"].some(Ot=>Ot in be))throw new Error("sign() legacy options not supported");const{hash:Re,randomBytes:we}=e;let{lowS:De,prehash:je,extraEntropy:ze}=be;null==De&&(De=!0),le=_r("msgHash",le),fg(be),je&&(le=_r("prehashed msgHash",Re(le)));const ot=Be(le),mt=b(ue),st=[Pe(mt),Pe(ot)];if(null!=ze&&!1!==ze){const Ot=!0===ze?we(n.BYTES):ze;st.push(_r("extraEntropy",Ot))}const It=Za(...st),St=ot;return{seed:It,k2sig:function Wt(Ot){const Lt=ke(Ot);if(!J(Lt))return;const ln=d(Lt),fn=h.BASE.multiply(Lt).toAffine(),vn=c(fn.x);if(vn===Nr)return;const Xn=c(ln*c(St+vn*mt));if(Xn===Nr)return;let Lr=(fn.x===vn?0:2)|Number(fn.y&en),ao=Xn;return De&&te(Xn)&&(ao=function re(le){return te(le)?c(-le):le}(Xn),Lr^=1),new ye(vn,ao,Lr)}}}(le,ue,be);return function mw(t,e,n){if("number"!=typeof t||t<2)throw new Error("hashLen must be a number");if("number"!=typeof e||e<2)throw new Error("qByteLen must be a number");if("function"!=typeof n)throw new Error("hmacFn must be a function");let r=$u(t),s=$u(t),i=0;const o=()=>{r.fill(1),s.fill(0),i=0},a=(...b)=>n(s,r,...b),c=(b=$u(0))=>{s=a(Zp([0]),b),r=a(),0!==b.length&&(s=a(Zp([1]),b),r=a())},d=()=>{if(i++>=1e3)throw new Error("drbg: tried 1000 values");let b=0;const M=[];for(;b<e;){r=a();const J=r.slice();M.push(J),b+=r.length}return Za(...M)};return(b,M)=>{let J;for(o(),c(b);!(J=M(d()));)c();return o(),J}}(e.hash.outputLen,e.nByteLength,e.hmac)(Re,we)},verify:function Ne(le,ue,be,Re=Me){const we=le;ue=_r("msgHash",ue),be=_r("publicKey",be);const{lowS:De,prehash:je,format:ze}=Re;if(fg(Re),"strict"in Re)throw new Error("options.strict was renamed to lowS");if(void 0!==ze&&"compact"!==ze&&"der"!==ze)throw new Error("format must be compact or der");const ot="string"==typeof we||xo(we),mt=!ot&&!ze&&"object"==typeof we&&null!==we&&"bigint"==typeof we.r&&"bigint"==typeof we.s;if(!ot&&!mt)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");let st,It;try{if(mt&&(st=new ye(we.r,we.s)),ot){try{"compact"!==ze&&(st=ye.fromDER(we))}catch(Lr){if(!(Lr instanceof us.Err))throw Lr}!st&&"der"!==ze&&(st=ye.fromCompact(we))}It=h.fromHex(be)}catch{return!1}if(!st||De&&st.hasHighS())return!1;je&&(ue=e.hash(ue));const{r:St,s:Wt}=st,Ot=Be(ue),Lt=d(Wt),ln=c(Ot*Lt),fn=c(St*Lt),vn=h.BASE.multiplyAndAddUnsafe(It,ln,fn)?.toAffine();return!!vn&&c(vn.x)===St},ProjectivePoint:h,Signature:ye,utils:Se}}function Fw(t){return{hash:t,hmac:(e,...n)=>Kp(t,e,function nw(...t){let e=0;for(let r=0;r<t.length;r++){const s=t[r];as(s),e+=s.length}const n=new Uint8Array(e);for(let r=0,s=0;r<t.length;r++){const i=t[r];n.set(i,s),s+=i.length}return n}(...n)),randomBytes:rw}}const Lo=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),tc=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),Qu=BigInt(0),Fo=BigInt(1),nc=BigInt(2),yg=(t,e)=>(t+e/nc)/e;const ed=ec(Lo,void 0,void 0,{sqrt:function _g(t){const e=Lo,n=BigInt(3),r=BigInt(6),s=BigInt(11),i=BigInt(22),o=BigInt(23),a=BigInt(44),c=BigInt(88),d=t*t*t%e,h=d*d*t%e,b=Er(h,n,e)*h%e,M=Er(b,n,e)*h%e,J=Er(M,nc,e)*d%e,te=Er(J,s,e)*J%e,re=Er(te,i,e)*te%e,ae=Er(re,a,e)*re%e,ye=Er(ae,c,e)*ae%e,Se=Er(ye,a,e)*re%e,oe=Er(Se,n,e)*h%e,pe=Er(oe,o,e)*te%e,Ce=Er(pe,r,e)*d%e,ke=Er(Ce,nc,e);if(!ed.eql(ed.sqr(ke),t))throw new Error("Cannot find square root");return ke}}),Eg=function Ww(t,e){const n=r=>
vendor: 5,731 bytes, line 193
193Bw({...t,...Fw(r)});return{...n(e),create:n}}({a:Qu,b:BigInt(7),Fp:ed,n:tc,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{const e=tc,n=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-Fo*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),s=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=n,o=BigInt("0x100000000000000000000000000000000"),a=yg(i*t,e),c=yg(-r*t,e);let d=Wn(t-a*n-c*s,e),h=Wn(-a*r-c*i,e);const b=d>o,M=h>o;if(b&&(d=e-d),M&&(h=e-h),d>o||h>o)throw new Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:b,k1:d,k2neg:M,k2:h}}}},hw);function Cg(t){return t>=48&&t<=57?t-48:t>=65&&t<=70?t-55:t>=97&&t<=102?t-87:void 0}const Jw=new TextEncoder;function Qw(t){return t instanceof Uint8Array?t:"string"==typeof t?function Ag(t,e={}){const{size:n}=e;let r=t;n&&(hp(t,n),r=mp(t,n));let s=r.slice(2);s.length%2&&(s=`0${s}`);const i=s.length/2,o=new Uint8Array(i);for(let a=0,c=0;a<i;a++){const d=Cg(s.charCodeAt(c++)),h=Cg(s.charCodeAt(c++));if(void 0===d||void 0===h)throw new Yt(`Invalid byte sequence ("${s[c-2]}${s[c-1]}" in "${s}").`);o[a]=16*d+h}return o}(t):function e1(t){return t instanceof Uint8Array?t:new Uint8Array(t)}(t)}function Ig(t){return t.length}class rc extends Yt{constructor(e){super(`Value \`${"object"==typeof e?Va(e):e}\` of type \`${typeof e}\` is an invalid Bytes value.`,{metaMessages:["Bytes values must be of type `Bytes`."]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.InvalidBytesTypeError"})}}class c1 extends Yt{constructor({givenSize:e,maxSize:n}){super(`Size cannot exceed \`${n}\` bytes. Given size: \`${e}\` bytes.`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeOverflowError"})}}class l1 extends Yt{constructor({size:e,targetSize:n,type:r}){super(`${r.charAt(0).toUpperCase()}${r.slice(1).toLowerCase()} size (\`${e}\`) exceeds padding size (\`${n}\`).`),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Bytes.SizeExceedsPaddingSizeError"})}}class u1 extends Map{constructor(e){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=e}get(e){const n=super.get(e);return super.has(e)&&void 0!==n&&(this.delete(e),super.set(e,n)),n}set(e,n){if(super.set(e,n),this.maxSize&&this.size>this.maxSize){const r=this.keys().next().value;r&&this.delete(r)}return this}}const od={checksum:new u1(8192)}.checksum,f1=BigInt(0),jo=BigInt(1),h1=BigInt(2),p1=BigInt(7),g1=BigInt(256),m1=BigInt(113),Tg=[],Og=[],Ng=[];for(let t=0,e=jo,n=1,r=0;t<24;t++){[n,r]=[r,(2*n+3*r)%5],Tg.push(2*(5*r+n)),Og.push((t+1)*(t+2)/2%64);let s=f1;for(let i=0;i<7;i++)e=(e<<jo^(e>>p1)*m1)%g1,e&h1&&(s^=jo<<(jo<<BigInt(i))-jo);Ng.push(s)}const xg=ku(Ng,!0),y1=xg[0],_1=xg[1],Rg=(t,e,n)=>n>32?((t,e,n)=>e<<n-32|t>>>64-n)(t,e,n):((t,e,n)=>t<<n|e>>>32-n)(t,e,n),Pg=(t,e,n)=>n>32?((t,e,n)=>t<<n-32|e>>>64-n)(t,e,n):((t,e,n)=>e<<n|t>>>32-n)(t,e,n);class sc extends Du{constructor(e,n,r,s=!1,i=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=n,this.outputLen=r,this.enableXOF=s,this.rounds=i,So(r),!(0<e&&e<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=function Zb(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}(this.state)}clone(){return this._cloneInto()}keccak(){Ap(this.state32),function E1(t,e=24){const n=new Uint32Array(10);for(let r=24-e;r<24;r++){for(let o=0;o<10;o++)n[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,c=(o+2)%10,d=n[c],h=n[c+1],b=Rg(d,h,1)^n[a],M=Pg(d,h,1)^n[a+1];for(let J=0;J<50;J+=10)t[o+J]^=b,t[o+J+1]^=M}let s=t[2],i=t[3];for(let o=0;o<24;o++){const a=Og[o],c=Rg(s,i,a),d=Pg(s,i,a),h=Tg[o];s=t[h],i=t[h+1],t[h]=c,t[h+1]=d}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)n[a]=t[o+a];for(let a=0;a<10;a++)t[o+a]^=~n[(a+2)%10]&n[(a+4)%10]}t[0]^=y1[r],t[1]^=_1[r]}Ts(n)}(this.state32,this.rounds),Ap(this.state32),this.posOut=0,this.pos=0}update(e){Pi(this),as(e=Di(e));const{blockLen:n,state:r}=this,s=e.length;for(let i=0;i<s;){const o=Math.min(n-this.pos,s-i);for(let a=0;a<o;a++)r[this.pos++]^=e[i++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:n,pos:r,blockLen:s}=this;e[r]^=n,!!(128&n)&&r===s-1&&this.keccak(),e[s-1]^=128,this.keccak()}writeInto(e){Pi(this,!1),as(e),this.finish();const n=this.state,{blockLen:r}=this;for(let s=0,i=e.length;s<i;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,i-s);e.set(n.subarray(this.posOut,this.posOut+o),s),this.posOut+=o,s+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return So(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(Cp(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,Ts(this.state)}_cloneInto(e){const{blockLen:n,suffix:r,outputLen:s,rounds:i,enableXOF:o}=this;return e||(e=new sc(n,r,s,o,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=r,e.outputLen=s,e.enableXOF=o,e.destroyed=this.destroyed,e}}const b1=(t=1,Op(()=>new sc(136,1,32)));var t;function Ug(t,e={}){const{as:n=("string"==typeof t?"Hex":"Bytes")}
193=e,r=b1(Qw(t));return"Bytes"===n?r:xi(r)}function ad(t,e={}){const{compressed:n}=e,{prefix:r,x:s,y:i}=t;if(!1===n||"bigint"==typeof s&&"bigint"==typeof i){if(4!==r)throw new Bg({prefix:r,cause:new N1})}else{if(!(!0===n||"bigint"==typeof s&&typeof i>"u"))throw new T1({publicKey:t});if(3!==r&&2!==r)throw new Bg({prefix:r,cause:new O1})}}function I1(t){const e=(()=>{if(function Pb(t,e={}){const{strict:n=!1}=e;try{return function Ob(t,e={}){const{strict:n=!1}=e;if(!t)throw new yp(t);if("string"!=typeof t)throw new yp(t);if(n&&!/^0x[0-9a-fA-F]*$/.test(t))throw new _p(t);if(!t.startsWith("0x"))throw new _p(t)}(t,{strict:n}),!0}catch{return!1}}(t))return kg(t);if(function o1(t){try{return function Xw(t){if(!(t instanceof Uint8Array)){if(!t)throw new rc(t);if("object"!=typeof t)throw new rc(t);if(!("BYTES_PER_ELEMENT"in t))throw new rc(t);if(1!==t.BYTES_PER_ELEMENT||"Uint8Array"!==t.constructor.name)throw new rc(t)}}(t),!0}catch{return!1}}(t))return function S1(t){return kg(xi(t))}(t);const{prefix:n,x:r,y:s}=t;return"bigint"==typeof r&&"bigint"==typeof s?{prefix:n??4,x:r,y:s}:{prefix:n,x:r}})();return ad(e),e}function kg(t){if(132!==t.length&&130!==t.length&&68!==t.length)throw new x1({publicKey:t});return 130===t.length?{prefix:4,x:BigInt(os(t,0,32)),y:BigInt(os(t,32,64))}:132===t.length?{prefix:Number(os(t,0,1)),x:BigInt(os(t,1,33)),y:BigInt(os(t,33,65))}:{prefix:Number(os(t,0,1)),x:BigInt(os(t,1,33))}}class T1 extends Yt{constructor({publicKey:e}
193){super(`Value \`${Va(e)}\` is not a valid public key.`,{metaMessages:["Public key must contain:","- an `x` and `prefix` value (compressed)","- an `x`, `y`, and `prefix` value (uncompressed)"]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidError"})}}class Bg extends Yt{constructor({prefix:e,cause:n}){super(`Prefix "${e}" is invalid.`,{cause:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidPrefixError"})}}class O1 extends Yt{constructor(){super("Prefix must be 2 or 3 for compressed public keys."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidCompressedPrefixError"})}}class N1 extends Yt{constructor(){super("Prefix must be 4 for uncompressed public keys."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidUncompressedPrefixError"})}}class x1 extends Yt{constructor({publicKey:e}){super(`Value \`${e}\` is an invalid public key size.`,{metaMessages:["Expected: 33 bytes (compressed + prefix), 64 bytes (uncompressed) or 65 bytes (uncompressed + prefix).",`Received ${Ss(Au(e))} bytes.`]}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"PublicKey.InvalidSerializedSizeError"})}}const R1=/^0x[a-fA-F0-9]{40}$/;function $o(t,e={}){const{strict:n=!0}=e;if(!R1.test(t))throw new Fg({address:t,cause:new U1});if(n){if(t.toLowerCase()===t)return;if(Lg(t)!==t)throw new Fg({address:t,cause:new k1})}}function Lg(t){if(od.has(t))return od.get(t);$o(t,{strict:!1});const e=t.substring(2).toLowerCase(),n=Ug(function t1(t,e={}){const{size:n}=e,r=Jw.encode(t);return"number"==typeof n?(function Gw(t,e){if(Ig(t)>e)throw new c1({givenSize:Ig(t),maxSize:e})}(r,n),function r1(t,e){return function qw(t,e={}){const{dir:n,size:r=32}=e;if(0===r)return t;if(t.length>r)throw new l1({size:t.length,targetSize:r,type:"Bytes"});const s=new Uint8Array(r);for(let i=0;i<r;i++){const o="right"===n;s[o?i:r-i-1]=t[o?i:t.length-i-1]}return s}(t,{dir:"right",size:e})}(r,n)):r}(e),{as:"Bytes"}),r=e.split("");for(let i=0;i<40;i+=2)n[i>>1]>>4>=8&&r[i]&&(r[i]=r[i].toUpperCase()),(15&n[i>>1])>=8&&r[i+1]&&(r[i+1]=r[i+1].toUpperCase());const s=`0x${r.join("")}`;return od.set(t,s),s}function D1(t,e={}){return function P1(t,e={}){const{checksum:n=!1}=e;return $o(t),n?Lg(t):t}(`0x${Ug(`0x${function Mg(t,e={}){ad(t);const{prefix:n,x:r,y:s}=t,{includePrefix:i=!0}=e;return function Nb(...t){return`0x${t.reduce((e,n)=>e+n.replace("0x",""),"")}`}(i?Iu(n,{size:1}):"0x",Iu(r,{size:32}),"bigint"==typeof s?Iu(s,{size:32}):"0x")}(t).slice(4)}`).substring(26)}`,e)}class Fg extends Yt{constructor({address:e,cause:n}){super(`Address "${e}" is invalid.`,{cause:n}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidAddressError"})}}class U1 extends Yt{constructor(){super("Address is not a 20 byte (40 hexadecimal character) value."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidInputError"})}}class k1 extends Yt{constructor(){super("Address does not match its checksum counterpart."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"Address.InvalidChecksumError"})}}function ud(t,e){this.v=t,this.k=e}function Ko(t){var e,n;function r(i,o){try{var a=t[i](o),c=a.value,d=c instanceof ud;Promise.resolve(d?c.v:c).then(function(h){if(d){var b="return"===i&&c.k?i:"next";if(!c.k||h.done)return r(b,h);h=t[b](h).value}s(!!a.done,h)},function(h){r("throw",h)})}catch(h){s(2,h)}}function s(i,o){2===i?e.reject(o):e.resolve({value:o,done:i}),(e=e.next)?r(e.key,e.arg):n=null}this._invoke=function(i,o){return new Promise(function(a,c){var d={key:i,arg:o,resolve:a,reject:c,next:null};n?n=n.next=d:(e=n=d,r(i,o))})},"function"!=typeof t.return&&(this.return=void 0)}function dd(t){return new ud(t,0)}function fd(t){var e,n,r,s=2;for(typeof Symbol<"u"&&(n=Symbol.asyncIterator,r=Symbol.iterator);s--;){if(n&&null!=(e=t[n]))return e.call(t);if(r&&null!=(e=t[r]))return new oc(e.call(t));n="@@asyncIterator",r="@@iterator"}throw new TypeError("Object is not async iterable")}function oc(t){function e(n){if(Object(n)!==n)return Promise.reject(new TypeError(n+" is not an object."));var r=n.done;return Promise.resolve(n.value).then(function(s){return{value:s,done:r}})}return(oc=function(r){this.s=r,this.n=r.next}).prototype={s:null,n:null,next:function(){return e(this.n.apply(this.s,arguments))},return:function(r){var s=this.s.return;return void 0===s?Promise.resolve({value:r,done:!0}):e(s.apply(this.s,arguments))},throw:function(r){var s=this.s.return;return void 0===s?Promise.reject(r):e(s.apply(this.s,arguments))}},new oc(t)}function hd(t){return`${t<0?"-":""}0x${Math.abs(t).toString(16).padStart(2,"0")}`}Ko.prototype["function"==typeof Symbol&&Symbol.asyncIterator||"@@asyncIterator"]=function(){return this},Ko.prototype.next=function(t){return this._invoke("next",t)},Ko.prototype.throw=function(t){return this._invoke("throw",t)},Ko.prototype.return=function(t){return this._invoke("return",t)};class ac{type;data;constructor(e,n){this.type=e,this.data=n}}
193class fr extends Error{constructor(e){super(e);const n=Object.create(fr.prototype);Object.setPrototypeOf(this,n),Object.defineProperty(this,"name",{configurable:!0,enumerable:!1,value:fr.name})}}const zo=4294967295;function jg(t,e,n){const r=Math.floor(n/4294967296),s=n;t.setUint32(e,r),t.setUint32(e+4,s)}function $g(t,e){return 4294967296*t.getInt32(e)+t.getUint32(e+4)}const Q1={type:-1,encode:function Z1(t){if(t instanceof Date){const e=function Y1(t){const e=t.getTime(),n=Math.floor(e/1e3),r=1e6*(e-1e3*n),s=Math.floor(r/1e9);return{sec:n+s,nsec:r-1e9*s}}(t);return function q1({sec:t,nsec:e}){if(t>=0&&e>=0&&t<=17179869183){if(0===e&&t<=4294967295){const n=new Uint8Array(4);return new DataView(n.buffer).setUint32(0,t),n}{const n=t/4294967296,r=4294967295&t,s=new Uint8Array(8),i=new DataView(s.buffer);return i.setUint32(0,e<<2|3&n),i.setUint32(4,r),s}}{const n=new Uint8Array(12),r=new DataView(n.buffer);return r.setUint32(0,e),jg(r,4,t),n}}(e)}return null},decode:function X1(t){const e=function J1(t){const e=new DataView(t.buffer,t.byteOffset,t.byteLength);switch(t.byteLength){case 4:return{sec:e.getUint32(0),nsec:0};case 8:{const n=e.getUint32(0);return{sec:4294967296*(3&n)+e.getUint32(4),nsec:n>>>2}}case 12:return{sec:$g(e,4),nsec:e.getUint32(0)};default:throw new fr(`Unrecognized data size for timestamp (expected 4, 8, or 12): ${t.length}`)}}(t);return new Date(1e3*e.sec+e.nsec/1e6)}};class cc{static defaultCodec=new cc;__brand;builtInEncoders=[];builtInDecoders=[];encoders=[];decoders=[];constructor(){this.register(Q1)}register({type:e,encode:n,decode:r}){if(e>=0)this.encoders[e]=n,this.decoders[e]=r;else{const s=-1-e;this.builtInEncoders[s]=n,this.builtInDecoders[s]=r}}tryToEncode(e,n){for(let r=0;r<this.builtInEncoders.length;r++){const s=this.builtInEncoders[r];if(null!=s){const i=s(e,n);if(null!=i)return new ac(-1-r,i)}}for(let r=0;r<this.encoders.length;r++){const s=this.encoders[r];if(null!=s){const i=s(e,n);if(null!=i)return new ac(r,i)}}return e instanceof ac?e:null}decode(e,n,r){const s=n<0?this.builtInDecoders[-1-n]:this.decoders[n];return s?s(e,n,r):new ac(n,e)}}const nC=new TextEncoder;function Hg(t,e,n){let r=e;const s=r+n,i=[];let o="";for(;r<s;){const a=t[r++];if(128&a)if(192==(224&a)){const c=63&t[r++];i.push((31&a)<<6|c)}else if(224==(240&a)){const c=63&t[r++],d=63&t[r++];i.push((31&a)<<12|c<<6|d)}else if(240==(248&a)){let b=(7&a)<<18|(63&t[r++])<<12|(63&t[r++])<<6|63&t[r++];b>65535&&(b-=65536,i.push(b>>>10&1023|55296),b=56320|1023&b),i.push(b)}else i.push(a);else i.push(a);i.length>=4096&&(o+=String.fromCharCode(...i),i.length=0)}return i.length>0&&(o+=String.fromCharCode(...i)),o}const aC=new TextDecoder;function pd(t){return t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):function dC(t){return t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer}(t)?new Uint8Array(t):Uint8Array.from(t)}const gd="array",Vo="map_key",Kg="map_value",gC=t=>{if("string"==typeof t||"number"==typeof t)return t;throw new fr("The type of key must be string or number but "+typeof t)};class mC{stack=[];stackHeadPosition=-1;get length(){return this.stackHeadPosition+1}top(){return this.stack[this.stackHeadPosition]}pushArrayState(e){const n=this.getUninitializedStateFromPool();n.type=gd,n.position=0,n.size=e,n.array=new Array(e)}pushMapState(e){const n=this.getUninitializedStateFromPool();n.type=Vo,n.readCount=0,n.size=e,n.map={}}getUninitializedStateFromPool(){return this.stackHeadPosition++,this.stackHeadPosition===this.stack.length&&this.stack.push({type:void 0,size:0,array:void 0,position:0,readCount:0,map:void 0,key:null}),this.stack[this.stackHeadPosition]}release(e){if(this.stack[this.stackHeadPosition]!==e)throw new Error("Invalid stack state. Released state is not on top of the stack.");if(e.type===gd){const r=e;r.size=0,r.array=void 0,r.position=0,r.type=void 0}if(e.type===Vo||e.type===Kg){const r=e;r.size=0,r.map=void 0,r.readCount=0,r.type=void 0}this.stackHeadPosition--}reset(){this.stack.length=0,this.stackHeadPosition=-1}}const md=new DataView(new ArrayBuffer(0)),yC=new Uint8Array(md.buffer);try{md.getInt8(0)}catch(t){if(!(t instanceof RangeError))throw new Error("This module is not supported in the current JavaScript engine because DataView does not throw RangeError on out-of-bounds access")}
193const zg=new RangeError("Insufficient data"),_C=new class pC{hit=0;miss=0;caches;maxKeyLength;maxLengthPerKey;constructor(e=16,n=16){this.maxKeyLength=e,this.maxLengthPerKey=n,this.caches=[];for(let r=0;r<this.maxKeyLength;r++)this.caches.push([])}canBeCached(e){return e>0&&e<=this.maxKeyLength}find(e,n,r){const s=this.caches[r-1];e:for(const i of s){const o=i.bytes;for(let a=0;a<r;a++)if(o[a]!==e[n+a])continue e;return i.str}return null}store(e,n){const r=this.caches[e.length-1],s={bytes:e,str:n};r.length>=this.maxLengthPerKey?r[Math.random()*r.length|0]=s:r.push(s)}decode(e,n,r){const s=this.find(e,n,r);if(null!=s)return this.hit++,s;this.miss++;const i=Hg(e,n,r),o=Uint8Array.prototype.slice.call(e,n,n+r);return this.store(o,i),i}};class yd{extensionCodec;context;useBigInt64;rawStrings;maxStrLength;maxBinLength;maxArrayLength;maxMapLength;maxExtLength;keyDecoder;mapKeyConverter;totalPos=0;pos=0;view=md;bytes=yC;headByte=-1;stack=new mC;entered=!1;constructor(e){this.extensionCodec=e?.extensionCodec??cc.defaultCodec,this.context=e?.context,this.useBigInt64=e?.useBigInt64??!1,this.rawStrings=e?.rawStrings??!1,this.maxStrLength=e?.maxStrLength??zo,this.maxBinLength=e?.maxBinLength??zo,this.maxArrayLength=e?.maxArrayLength??zo,this.maxMapLength=e?.maxMapLength??zo,this.maxExtLength=e?.maxExtLength??zo,this.keyDecoder=void 0!==e?.keyDecoder?e.keyDecoder:_C,this.mapKeyConverter=e?.mapKeyConverter??gC}clone(){return new yd({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,rawStrings:this.rawStrings,maxStrLength:this.maxStrLength,maxBinLength:this.maxBinLength,maxArrayLength:this.maxArrayLength,maxMapLength:this.maxMapLength,maxExtLength:this.maxExtLength,keyDecoder:this.keyDecoder})}reinitializeState(){this.totalPos=0,this.headByte=-1,this.stack.reset()}setBuffer(e){const n=pd(e);this.bytes=n,this.view=new DataView(n.buffer,n.byteOffset,n.byteLength),this.pos=0}appendBuffer(e){if(-1!==this.headByte||this.hasRemaining(1)){const n=this.bytes.subarray(this.pos),r=pd(e),s=new Uint8Array(n.length+r.length);s.set(n),s.set(r,n.length),this.setBuffer(s)}else this.setBuffer(e)}hasRemaining(e){return this.view.byteLength-this.pos>=e}createExtraByteError(e){const{view:n,pos:r}=this;return new RangeError(`Extra ${n.byteLength-r} of ${n.byteLength} byte(s) found at buffer[${e}]`)}decode(e){if(this.entered)return this.clone().decode(e);try{this.entered=!0,this.reinitializeState(),this.setBuffer(e);const n=this.doDecodeSync();if(this.hasRemaining(1))throw this.createExtraByteError(this.pos);return n}finally{this.entered=!1}}*decodeMulti(e){if(this.entered)yield*this.clone().decodeMulti(e);else try{for(this.entered=!0,this.reinitializeState(),this.setBuffer(e);this.hasRemaining(1);)yield this.doDecodeSync()}finally{this.entered=!1}}decodeAsync(e){var n=this;return(0,l.A)(function*(){if(n.entered)return n.clone().decodeAsync(e);try{n.entered=!0;let d,c=!1;var i,r=!1,s=!1;try{for(var a,o=fd(e);r=!(a=yield o.next()).done;r=!1){const J=a.value;if(c)throw n.entered=!1,n.createExtraByteError(n.totalPos);n.appendBuffer(J);try{d=n.doDecodeSync(),c=!0}catch(te){if(!(te instanceof RangeError))throw te}n.totalPos+=n.pos}}catch(J){s=!0,i=J}finally{try{r&&null!=o.return&&(yield o.return())}finally{if(s)throw i}}if(c){if(n.hasRemaining(1))throw n.createExtraByteError(n.totalPos);return d}const{headByte:h,pos:b,totalPos:M}=n;throw new RangeError(`Insufficient data in parsing ${hd(h)} at ${M} (${b} in the current buffer)`)}finally{n.entered=!1}})()}decodeArrayStream(e){return this.decodeMultiAsync(e,!0)}decodeStream(e){return this.decodeMultiAsync(e,!1)}decodeMultiAsync(e,n){var r=this;return function j1(t){return function(){return new Ko(t.apply(this,arguments))}}(function*(){if(r.entered){const d=r.clone();return void(yield*function $1(t){var e={},n=!1;function r(s,i){return n=!0,{done:!1,value:new ud(i=new Promise(function(o){o(t[s](i))}),1)}}return e[typeof Symbol<"u"&&Symbol.iterator||"@@iterator"]=function(){return this},e.next=function(s){return n?(n=!1,s):r("next",s)},"function"==typeof t.throw&&(e.throw=function(s){if(n)throw n=!1,s;return r("throw",s)}
193),"function"==typeof t.return&&(e.return=function(s){return n?(n=!1,s):r("return",s)}),e}(fd(d.decodeMultiAsync(e,n))))}try{r.entered=!0;let d=n,h=-1;var o,s=!1,i=!1;try{for(var c,a=fd(e);s=!(c=yield dd(a.next())).done;s=!1){const b=c.value;if(n&&0===h)throw r.createExtraByteError(r.totalPos);r.appendBuffer(b),d&&(h=r.readArraySize(),d=!1,r.complete());try{for(;yield r.doDecodeSync(),0!==--h;);}catch(M){if(!(M instanceof RangeError))throw M}r.totalPos+=r.pos}}catch(b){i=!0,o=b}finally{try{s&&null!=a.return&&(yield dd(a.return()))}finally{if(i)throw o}}}finally{r.entered=!1}})()}doDecodeSync(){e:for(;;){const e=this.readHeadByte();let n;if(e>=224)n=e-256;else if(e<192)if(e<128)n=e;else if(e<144){const s=e-128;if(0!==s){this.pushMapState(s),this.complete();continue e}n={}}else if(e<160){const s=e-144;if(0!==s){this.pushArrayState(s),this.complete();continue e}n=[]}else n=this.decodeString(e-160,0);else if(192===e)n=null;else if(194===e)n=!1;else if(195===e)n=!0;else if(202===e)n=this.readF32();else if(203===e)n=this.readF64();else if(204===e)n=this.readU8();else if(205===e)n=this.readU16();else if(206===e)n=this.readU32();else if(207===e)n=this.useBigInt64?this.readU64AsBigInt():this.readU64();else if(208===e)n=this.readI8();else if(209===e)n=this.readI16();else if(210===e)n=this.readI32();else if(211===e)n=this.useBigInt64?this.readI64AsBigInt():this.readI64();else if(217===e){const s=this.lookU8();n=this.decodeString(s,1)}else if(218===e){const s=this.lookU16();n=this.decodeString(s,2)}else if(219===e){const s=this.lookU32();n=this.decodeString(s,4)}else if(220===e){const s=this.readU16();if(0!==s){this.pushArrayState(s),this.complete();continue e}n=[]}else if(221===e){const s=this.readU32();if(0!==s){this.pushArrayState(s),this.complete();continue e}n=[]}else if(222===e){const s=this.readU16();if(0!==s){this.pushMapState(s),this.complete();continue e}n={}}else if(223===e){const s=this.readU32();if(0!==s){this.pushMapState(s),this.complete();continue e}n={}}else if(196===e){const s=this.lookU8();n=this.decodeBinary(s,1)}else if(197===e){const s=this.lookU16();n=this.decodeBinary(s,2)}else if(198===e){const s=this.lookU32();n=this.decodeBinary(s,4)}else if(212===e)n=this.decodeExtension(1,0);else if(213===e)n=this.decodeExtension(2,0);else if(214===e)n=this.decodeExtension(4,0);else if(215===e)n=this.decodeExtension(8,0);else if(216===e)n=this.decodeExtension(16,0);else if(199===e){const s=this.lookU8();n=this.decodeExtension(s,1)}else if(200===e){const s=this.lookU16();n=this.decodeExtension(s,2)}else{if(201!==e)throw new fr(`Unrecognized type byte: ${hd(e)}`);{const s=this.lookU32();n=this.decodeExtension(s,4)}}this.complete();const r=this.stack;for(;r.length>0;){const s=r.top();if(s.type===gd){if(s.array[s.position]=n,s.position++,s.position!==s.size)continue e;n=s.array,r.release(s)}else{if(s.type===Vo){if("__proto__"===n)throw new fr("The key __proto__ is not allowed");s.key=this.mapKeyConverter(n),s.type=Kg;continue e}if(s.map[s.key]=n,s.readCount++,s.readCount!==s.size){s.key=null,s.type=Vo;continue e}n=s.map,r.release(s)}}return n}}readHeadByte(){return-1===this.headByte&&(this.headByte=this.readU8()),this.headByte}complete(){this.headByte=-1}readArraySize(){const e=this.readHeadByte();switch(e){case 220:return this.readU16();case 221:return this.readU32();default:if(e<160)return e-144;throw new fr(`Unrecognized array type byte: ${hd(e)}`)}}pushMapState(e){if(e>this.maxMapLength)throw new fr(`Max length exceeded: map length (${e}) > maxMapLengthLength (${this.maxMapLength})`);this.stack.pushMapState(e)}pushArrayState(e){if(e>this.maxArrayLength)throw new fr(`Max length exceeded: array length (${e}) > maxArrayLength (${this.maxArrayLength})`);this.stack.pushArrayState(e)}decodeString(e,n){return!this.rawStrings||this.stateIsMapKey()?this.decodeUtf8String(e,n):this.decodeBinary(e,n)}decodeUtf8String(e,n){if(e>this.maxStrLength)throw new fr(`Max length exceeded: UTF-8 byte length (${e}) > maxStrLength (${this.maxStrLength})`);if(this.bytes.byteLength<this.pos+n+e)throw zg;const r=this.pos+n;let s;return s=this.stateIsMapKey()&&this.keyDecoder?.canBeCached(e)?this.keyDecoder.decode(this.bytes,r,e):function uC(t,e,n){return n>200?function lC(t,e,n){const r=t.subarray(e,e+n);return aC.decode(r)}(t,e,n):Hg(t,e,n)}(this.bytes,r,e),this.pos+=n+e,s}stateIsMapKey(){return this.stack.length>0&&this.stack.top().type===Vo}decodeBinary(e,n){if(e>this.maxBinLength)throw new fr(`Max length exceeded: bin length (${e}) > maxBinLength (${this.maxBinLength})`);if(!this.hasRemaining(e+n))throw zg;const r=this.pos+n,s=this.bytes.subarray(r,r+e);return this.pos+=n+e,s}decodeExtension(e,n){if(e>this.maxExtLength)throw new fr(`Max length exceeded: ext length (${e}) > maxExtLength (${this.maxExtLength})`);const r=this.view.getInt8(this.pos+n),s=this.decodeBinary(e,n+1);return this.extensionCodec.decode(s,r,this.context)}lookU8(){return this.view.getUint8(this.pos)}lookU16(){return this.view.getUint16(this.pos)}lookU32(){return this.view.getUint32(this.pos)}readU8(){const e=this.view.getUint8(this.pos);return this.pos++,e}readI8(){const e=this.view.getInt8(this.pos);return this.pos++,e}readU16(){const e=this.view.getUint16(this.pos);return this.pos+=2,e}readI16(){const e=this.view.getInt16(this.pos);return this.pos+=2,e}readU32(){const e=this.view.getUint32(this.pos);return this.pos+=4,e}readI32(){const e=this.view.getInt32(this.pos);return this.pos+=4,e}readU64(){const e=function K1(t,e){return 4294967296*t.getUint32(e)+t.getUint32(e+4)}(this.view,this.pos);return this.pos+=8,e}readI64(){const e=$g(this.view,this.pos);return this.pos+=8,e}readU64AsBigInt(){const e=this.view.getBigUint64(this.pos);return this.pos+=8,e}readI64AsBigInt(){const e=this.view.getBigInt64(this.pos);return this.pos+=8,e}readF32(){const e=this.view.getFloat32(this.pos);return this.pos+=4,e}readF64(){const e=this.view.getFloat64(this.pos);return this.pos+=8,e}}class _d{extensionCodec;context;useBigInt64;maxDepth;initialBufferSize;sortKeys;forceFloat32;ignoreUndefined;forceIntegerToFloat;pos;view;bytes;entered=!1;constructor(e){this.extensionCodec=e?.extensionCodec??cc.defaultCodec,this.context=e?.context,this.useBigInt64=e?.useBigInt64??!1,this.maxDepth=e?.maxDepth??100,this.initialBufferSize=e?.initialBufferSize??2048,this.sortKeys=e?.sortKeys??!1,this.forceFloat32=e?.forceFloat32??!1,this.ignoreUndefined=e?.ignoreUndefined??!1,this.forceIntegerToFloat=e?.forceIntegerToFloat??!1,this.pos=0,this.view=new DataView(new ArrayBuffer(this.initialBufferSize)),this.bytes=new Uint8Array(this.view.buffer)}clone(){return new _d({extensionCodec:this.extensionCodec,context:this.context,useBigInt64:this.useBigInt64,maxDepth:this.maxDepth,initialBufferSize:this.initialBufferSize,sortKeys:this.sortKeys,forceFloat32:this.forceFloat32,ignoreUndefined:this.ignoreUndefined,forceIntegerToFloat:this.forceIntegerToFloat})}reinitializeState(){this.pos=0}encodeSharedRef(e){if(this.entered)return this.clone().encodeSharedRef(e);try{return this.entered=!0,this.reinitializeState(),this.doEncode(e,1),this.bytes.subarray(0,this.pos)}finally{this.entered=!1}}encode(e){if(this.entered)return this.clone().encode(e);try{return this.entered=!0,this.reinitializeState(),this.doEncode(e,1),this.bytes.slice(0,this.pos)}finally{this.entered=!1}}doEncode(e,n){if(n>this.maxDepth)throw new Error(`Too deep objects in depth ${n}`);null==e?this.encodeNil():"boolean"==typeof e?this.encodeBoolean(e):"number"==typeof e?this.forceIntegerToFloat?this.encodeNumberAsFloat(e):this.encodeNumber(e):"str
193ing"==typeof e?this.encodeString(e):this.useBigInt64&&"bigint"==typeof e?this.encodeBigInt64(e):this.encodeObject(e,n)}ensureBufferSizeToWrite(e){const n=this.pos+e;this.view.byteLength<n&&this.resizeBuffer(2*n)}resizeBuffer(e){const n=new ArrayBuffer(e),r=new Uint8Array(n),s=new DataView(n);r.set(this.bytes),this.view=s,this.bytes=r}encodeNil(){this.writeU8(192)}encodeBoolean(e){this.writeU8(!1===e?194:195)}encodeNumber(e){!this.forceIntegerToFloat&&Number.isSafeInteger(e)?e>=0?e<128?this.writeU8(e):e<256?(this.writeU8(204),this.writeU8(e)):e<65536?(this.writeU8(205),this.writeU16(e)):e<4294967296?(this.writeU8(206),this.writeU32(e)):this.useBigInt64?this.encodeNumberAsFloat(e):(this.writeU8(207),this.writeU64(e)):e>=-32?this.writeU8(224|e+32):e>=-128?(this.writeU8(208),this.writeI8(e)):e>=-32768?(this.writeU8(209),this.writeI16(e)):e>=-2147483648?(this.writeU8(210),this.writeI32(e)):this.useBigInt64?this.encodeNumberAsFloat(e):(this.writeU8(211),this.writeI64(e)):this.encodeNumberAsFloat(e)}encodeNumberAsFloat(e){this.forceFloat32?(this.writeU8(202),this.writeF32(e)):(this.writeU8(203),this.writeF64(e))}encodeBigInt64(e){e>=BigInt(0)?(this.writeU8(207),this.writeBigUint64(e)):(this.writeU8(211),this.writeBigInt64(e))}writeStringHeader(e){if(e<32)this.writeU8(160+e);else if(e<256)this.writeU8(217),this.writeU8(e);else if(e<65536)this.writeU8(218),this.writeU16(e);else{if(!(e<4294967296))throw new Error(`Too long string: ${e} bytes in UTF-8`);this.writeU8(219),this.writeU32(e)}}encodeString(e){const r=function eC(t){const e=t.length;let n=0,r=0;for(;r<e;){let s=t.charCodeAt(r++);if(4294967168&s)if(4294965248&s){if(s>=55296&&s<=56319&&r<e){const i=t.charCodeAt(r);56320==(64512&i)&&(++r,s=((1023&s)<<10)+(1023&i)+65536)}n+=4294901760&s?4:3}else n+=2;else n++}return n}(e);this.ensureBufferSizeToWrite(5+r),this.writeStringHeader(r),function iC(t,e,n){t.length>50?function sC(t,e,n){nC.encodeInto(t,e.subarray(n))}(t,e,n):function tC(t,e,n){const r=t.length;let s=n,i=0;for(;i<r;){let o=t.charCodeAt(i++);if(4294967168&o){if(4294965248&o){if(o>=55296&&o<=56319&&i<r){const a=t.charCodeAt(i);56320==(64512&a)&&(++i,o=((1023&o)<<10)+(1023&a)+65536)}4294901760&o?(e[s++]=o>>18&7|240,e[s++]=o>>12&63|128,e[s++]=o>>6&63|128):(e[s++]=o>>12&15|224,e[s++]=o>>6&63|128)}else e[s++]=o>>6&31|192;e[s++]=63&o|128}else e[s++]=o}}(t,e,n)}(e,this.bytes,this.pos),this.pos+=r}encodeObject(e,n){const r=this.extensionCodec.tryToEncode(e,this.context);if(null!=r)this.encodeExtension(r);else if(Array.isArray(e))this.encodeArray(e,n);else if(ArrayBuffer.isView(e))this.encodeBinary(e);else{if("object"!=typeof e)throw new Error(`Unrecognized object: ${Object.prototype.toString.apply(e)}`);this.encodeMap(e,n)}}encodeBinary(e){const n=e.byteLength;if(n<256)this.writeU8(196),this.writeU8(n);else if(n<65536)this.writeU8(197),this.writeU16(n);else{if(!(n<4294967296))throw new Error(`Too large binary: ${n}`);this.writeU8(198),this.writeU32(n)}const r=pd(e);this.writeU8a(r)}encodeArray(e,n){const r=e.length;if(r<16)this.writeU8(144+r);else if(r<65536)this.writeU8(220),this.writeU16(r);else{if(!(r<4294967296))throw new Error(`Too large array: ${r}`);this.writeU8(221),this.writeU32(r)}for(const s of e)this.doEncode(s,n+1)}countWithoutUndefined(e,n){let r=0;for(const s of n)void 0!==e[s]&&r++;return r}encodeMap(e,n){const r=Object.keys(e);this.sortKeys&&r.sort();const s=this.ignoreUndefined?this.countWithoutUndefined(e,r):r.length;if(s<16)this.writeU8(128+s);else if(s<65536)this.writeU8(222),this.writeU16(s);else{if(!(s<4294967296))throw new Error(`Too large map object: ${s}`);this.writeU8(223),this.writeU32(s)}for(const i of r){const o=e[i];this.ignoreUndefined&&void 0===o||(this.encodeString(i),this.doEncode(o,n+1))}}encodeExtension(e){if("function"==typeof e.data){const r=e.data(this.pos+6),s=r.length;if(s>=4294967296)throw new Error(`Too large extension object: ${s}`);return this.writeU8(201),this.writeU32(s),this.writeI8(e.type),void this.writeU8a(r)}const n=e.data.length;if(1===n)this.writeU8(212);else if(2===n)this.writeU8(213);else if(4===n)this.writeU8(214);else if(8===n)this.writeU8(215);else if(16===n)this.writeU8(216);else if(n<256)this.writeU8(199),this.writeU8(n);else if(n<65536)this.writeU8(200),this.writeU16(n);else{if(!(n<4294967296))throw new Error(`Too large extension object: ${n}`);this.writeU8(201),this.writeU32(n)}this.writeI8(e.type),this.writeU8a(e.data)}writeU8(e){this.ensureBufferSizeToWrite(1),this.view.setUint8(this.pos,e),this.pos++}writeU8a(e){const n=e.length;this.ensureBufferSizeToWrite(n),this.bytes.set(e,this.pos),this.pos+=n}writeI8(e){this.ensureBufferSizeToWrite(1),this.view.setInt8(this.pos,e),this.pos++}writeU16(e){this.ensureBufferSizeToWrite(2),this.view.setUint16(this.pos,e),this.pos+=2}writeI16(e){this.ensureBufferSizeToWrite(2),this.view.setInt16(this.pos,e),this.pos+=2}writeU32(e){this.ensureBufferSizeToWrite(4),this.view.setUint32(this.pos,e),this.pos+=4}writeI32(e){this.ensureBufferSizeToWrite(4),this.view.setInt32(this.pos,e),this.pos+=4}writeF32(e){this.ensureBufferSizeToWrite(4),this.view.setFloat32(this.pos,e),this.pos+=4}writeF64(e){this.ensureBufferSizeToWrite(8),this.view.setFloat64(this.pos,e),this.pos+=8}writeU64(e){this.ensureBufferSizeToWrite(8),function H1(t,e,n){const s=n;t.setUint32(e,n/4294967296),t.setUint32(e+4,s)}(this.view,this.pos,e),this.pos+=8}writeI64(e){this.ensureBufferSizeToWrite(8),jg(this.view,this.pos,e),this.pos+=8}writeBigUint64(e){this.ensureBufferSizeToWrite(8),this.view.setBigUint64(this.pos,e),this.pos+=8}writeBigInt64(e){this.ensureBufferSizeToWrite(8),this.view.setBigInt64(this.pos,e),this.pos+=8}}function ci(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&"Uint8Array"===t.constructor.name}function Vg(t,e){return!!Array.isArray(e)&&(0===e.length||e.every(t?n=>"string"==typeof n:n=>Number.isSafeInteger(n)))}function Us(t,e){if("string"!=typeof e)throw new Error(`${t}: string expected`);return!0}function Fi(t){if(!Number.isSafeInteger(t))throw new Error(`invalid integer: ${t}`)}function lc(t){if(!Array.isArray(t))throw new Error("array expected")}function uc(t,e){if(!Vg(!0,e))throw new Error(`${t}
193: array of strings expected`)}function bd(t,e){if(!Vg(!1,e))throw new Error(`${t}: array of numbers expected`)}function qn(...t){const e=i=>i,n=(i,o)=>a=>i(o(a));return{encode:t.map(i=>i.encode).reduceRight(n,e),decode:t.map(i=>i.decode).reduce(n,e)}}function Qn(t){const e="string"==typeof t?t.split(""):t,n=e.length;uc("alphabet",e);const r=new Map(e.map((s,i)=>[s,i]));return{encode:s=>(lc(s),s.map(i=>{if(!Number.isSafeInteger(i)||i<0||i>=n)throw new Error(`alphabet.encode: digit index outside alphabet "${i}". Allowed: ${t}`);return e[i]})),decode:s=>(lc(s),s.map(i=>{Us("alphabet.decode",i);const o=r.get(i);if(void 0===o)throw new Error(`Unknown letter: "${i}". Allowed: ${t}`);return o}))}}function er(t=""){return Us("join",t),{encode:e=>(uc("join.decode",e),e.join(t)),decode:e=>(Us("join.decode",e),e.split(t))}}function qo(t,e="="){return Fi(t),Us("padding",e),{encode(n){for(uc("padding.encode",n);n.length*t%8;)n.push(e);return n},decode(n){uc("padding.decode",n);let r=n.length;if(r*t%8)throw new Error("padding: invalid, string should have whole number of bytes");for(;r>0&&n[r-1]===e;r--)if((r-1)*t%8==0)throw new Error("padding: invalid, string has too much padding");return n.slice(0,r)}}}function wd(t,e,n){if(e<2)throw new Error(`convertRadix: invalid from=${e}, base cannot be less than 2`);if(n<2)throw new Error(`convertRadix: invalid to=${n}, base cannot be less than 2`);if(lc(t),!t.length)return[];let r=0;const s=[],i=Array.from(t,a=>{if(Fi(a),a<0||a>=e)throw new Error(`invalid integer: ${a}`);return a}),o=i.length;for(;;){let a=0,c=!0;for(let d=r;d<o;d++){const h=i[d],b=e*a,M=b+h;if(!Number.isSafeInteger(M)||b/e!==a||M-h!==b)throw new Error("convertRadix: carry overflow");a=M%n;const te=Math.floor(M/n);if(i[d]=te,!Number.isSafeInteger(te)||te*n+a!==M)throw new Error("convertRadix: carry overflow");c&&(te?c=!1:r=d)}if(s.push(a),c)break}for(let a=0;a<t.length-1&&0===t[a];a++)s.push(0);return s.reverse()}const qg=(t,e)=>0===e?t:qg(e,t%e),dc=(t,e)=>t+(e-qg(t,e)),fc=(()=>{let t=[];for(let e=0;e<40;e++)t.push(2**e);return t})();function hc(t,e,n,r){if(lc(t),e<=0||e>32)throw new Error(`convertRadix2: wrong from=${e}`);if(n<=0||n>32)throw new Error(`convertRadix2: wrong to=${n}`);if(dc(e,n)>32)throw new Error(`convertRadix2: carry overflow from=${e} to=${n} carryBits=${dc(e,n)}`);let s=0,i=0;const o=fc[e],a=fc[n]-1,c=[];for(const d of t){if(Fi(d),d>=o)throw new Error(`convertRadix2: invalid data word=${d} from=${e}`);if(s=s<<e|d,i+e>32)throw new Error(`convertRadix2: carry overflow pos=${i} from=${e}`);for(i+=e;i>=n;i-=n)c.push((s>>i-n&a)>>>0);const h=fc[i];if(void 0===h)throw new Error("invalid carry");s&=h-1}if(s=s<<n-i&a,!r&&i>=e)throw new Error("Excess padding");if(!r&&s>0)throw new Error(`Non-zero padding: ${s}`);return r&&i>0&&c.push(s>>>0),c}function Yg(t){return Fi(t),{encode:n=>{if(!ci(n))throw new Error("radix.encode input should be Uint8Array");return wd(Array.from(n),256,t)},decode:n=>(bd("radix.decode",n),Uint8Array.from(wd(n,t,256)))}}function hr(t,e=!1){if(Fi(t),t<=0||t>32)throw new Error("radix2: bits should be in (0..32]");if(dc(8,t)>32||dc(t,8)>32)throw new Error("radix2: carry overflow");return{encode:n=>{if(!ci(n))throw new Error("radix2.encode input should be Uint8Array");return hc(Array.from(n),8,t,!e)},decode:n=>(bd("radix2.decode",n),Uint8Array.from(hc(n,t,8,e)))}}const Xg=qn(hr(5),Qn("ABCDEFGHIJKLMNOPQRSTUVWXYZ234567"),qo(5),er("")),Cd=("function"==typeof Uint8Array.from([]).toBase64&&Uint8Array,t=>qn(Yg(58),Qn(t),er(""))),fs=Cd("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz");function Id(t){return null!=globalThis.Buffer?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function om(t=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?Id(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}function Zo(t,e){e||(e=t.reduce((s,i)=>s+i.length,0));const n=om(e);let r=0;for(const s of t)n.set(s,r),r+=s.length;return Id(n)}"function"==typeof Uint8Array.from([]).toHex&&Uint8Array;const PC=function NC(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),r=0;r<n.length;r++)n[r]=255;for(var s=0;s<t.length;s++){var i=t.charAt(s),o=i.charCodeAt(0);if(255!==n[o])throw new TypeError(i+" is ambiguous");n[o]=s}var a=t.length,c=t.charAt(0),d=Math.log(a)/Math.log(256),h=Math.log(256)/Math.log(a);function M(te){if("string"!=typeof te)throw new TypeError("Expected String");if(0===te.length)return new Uint8Array;var re=0;if(" "!==te[re]){for(var ae=0,ye=0;te[re]===c;)ae++,re++;for(var Se=(te.length-re)*d+1>>>0,oe=new Uint8Array(Se);te[re];){var pe=n[te.charCodeAt(re)];if(255===pe)return;for(var Ce=0,ke=Se-1;(0!==pe||Ce<ye)&&-1!==ke;ke--,Ce++)oe[ke]=(pe+=a*oe[ke]>>>0)%256>>>0,pe=pe/256>>>0;if(0!==pe)throw new Error("Non-zero carry");ye=Ce,re++}if(" "!==te[re]){for(var Be=Se-ye;Be!==Se&&0===oe[Be];)Be++;
193for(var Fe=new Uint8Array(ae+(Se-Be)),Pe=ae;Be!==Se;)Fe[Pe++]=oe[Be++];return Fe}}}return{encode:function b(te){if(te instanceof Uint8Array||(ArrayBuffer.isView(te)?te=new Uint8Array(te.buffer,te.byteOffset,te.byteLength):Array.isArray(te)&&(te=Uint8Array.from(te))),!(te instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===te.length)return"";for(var re=0,ae=0,ye=0,Se=te.length;ye!==Se&&0===te[ye];)ye++,re++;for(var oe=(Se-ye)*h+1>>>0,pe=new Uint8Array(oe);ye!==Se;){for(var Ce=te[ye],ke=0,Be=oe-1;(0!==Ce||ke<ae)&&-1!==Be;Be--,ke++)pe[Be]=(Ce+=256*pe[Be]>>>0)%a>>>0,Ce=Ce/a>>>0;if(0!==Ce)throw new Error("Non-zero carry");ae=ke,ye++}for(var Fe=oe-ae;Fe!==oe&&0===pe[Fe];)Fe++;for(var Pe=c.repeat(re);Fe<oe;++Fe)Pe+=t.charAt(pe[Fe]);return Pe},decodeUnsafe:M,decode:function J(te){var re=M(te);if(re)return re;throw new Error(`Non-${e} character`)}}},Wi=(new Uint8Array(0),t=>{if(t instanceof Uint8Array&&"Uint8Array"===t.constructor.name)return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")});class BC{constructor(e,n,r){this.name=e,this.prefix=n,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class LC{constructor(e,n,r){if(this.name=e,this.prefix=n,void 0===n.codePointAt(0))throw new Error("Invalid prefix character");this.prefixCodePoint=n.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 am(this,e)}}class FC{constructor(e){this.decoders=e}or(e){return am(this,e)}decode(e){const r=this.decoders[e[0]];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`)}}const am=(t,e)=>new FC({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class WC{constructor(e,n,r,s){this.name=e,this.prefix=n,this.baseEncode=r,this.baseDecode=s,this.encoder=new BC(e,n,r),this.decoder=new LC(e,n,s)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const gc=({name:t,prefix:e,encode:n,decode:r})=>new WC(t,e,n,r),Jo=({prefix:t,name:e,alphabet:n})=>{const{encode:r,decode:s}=PC(n,e);return gc({prefix:t,name:e,encode:r,decode:i=>Wi(s(i))})},xn=({name:t,prefix:e,bitsPerChar:n,alphabet:r})=>gc({prefix:e,name:t,encode:s=>((t,e,n)=>{const r="="===e[e.length-1],s=(1<<n)-1;let i="",o=0,a=0;for(let c=0;c<t.length;++c)for(a=a<<8|t[c],o+=8;o>n;)o-=n,i+=e[s&a>>o];if(o&&(i+=e[s&a<<n-o]),r)for(;i.length*n&7;)i+="=";return i})(s,r,n),decode:s=>((t,e,n,r)=>{const s={};for(let h=0;h<e.length;++h)s[e[h]]=h;let i=t.length;for(;"="===t[i-1];)--i;const o=new Uint8Array(i*n/8|0);let a=0,c=0,d=0;for(let h=0;h<i;++h){const b=s[t[h]];if(void 0===b)throw new SyntaxError(`Non-${r} character`);c=c<<n|b,a+=n,a>=8&&(a-=8,o[d++]=255&c>>a)}if(a>=n||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o})(s,r,n,t)}),HC=gc({prefix:"\0",name:"identity",encode:t=>(t=>(new TextDecoder).decode(t))(t),decode:t=>(t=>(new TextEncoder).encode(t))(t)}),KC=xn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),zC=xn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),VC=Jo({prefix:"9",name:"base10",alphabet:"0123456789"}),GC=xn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),qC=xn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),Xo=xn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),YC=xn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),ZC=xn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),JC=xn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),XC=xn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),QC=xn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),eA=xn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),tA=xn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),nA=xn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),rA=Jo({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),sA=Jo({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),hs=Jo({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}
193),iA=Jo({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),oA=xn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),aA=xn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),cA=xn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),lA=xn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),cm=Array.from("\u{1f680}\u{1fa90}\u2604\u{1f6f0}\u{1f30c}\u{1f311}\u{1f312}\u{1f313}\u{1f314}\u{1f315}\u{1f316}\u{1f317}\u{1f318}\u{1f30d}\u{1f30f}\u{1f30e}\u{1f409}\u2600\u{1f4bb}\u{1f5a5}\u{1f4be}\u{1f4bf}\u{1f602}\u2764\u{1f60d}\u{1f923}\u{1f60a}\u{1f64f}\u{1f495}\u{1f62d}\u{1f618}\u{1f44d}\u{1f605}\u{1f44f}\u{1f601}\u{1f525}\u{1f970}\u{1f494}\u{1f496}\u{1f499}\u{1f622}\u{1f914}\u{1f606}\u{1f644}\u{1f4aa}\u{1f609}\u263a\u{1f44c}\u{1f917}\u{1f49c}\u{1f614}\u{1f60e}\u{1f607}\u{1f339}\u{1f926}\u{1f389}\u{1f49e}\u270c\u2728\u{1f937}\u{1f631}\u{1f60c}\u{1f338}\u{1f64c}\u{1f60b}\u{1f497}\u{1f49a}\u{1f60f}\u{1f49b}\u{1f642}\u{1f493}\u{1f929}\u{1f604}\u{1f600}\u{1f5a4}\u{1f603}\u{1f4af}\u{1f648}\u{1f447}\u{1f3b6}\u{1f612}\u{1f92d}\u2763\u{1f61c}\u{1f48b}\u{1f440}\u{1f62a}\u{1f611}\u{1f4a5}\u{1f64b}\u{1f61e}\u{1f629}\u{1f621}\u{1f92a}\u{1f44a}\u{1f973}\u{1f625}\u{1f924}\u{1f449}\u{1f483}\u{1f633}\u270b\u{1f61a}\u{1f61d}\u{1f634}\u{1f31f}\u{1f62c}\u{1f643}\u{1f340}\u{1f337}\u{1f63b}\u{1f613}\u2b50\u2705\u{1f97a}\u{1f308}\u{1f608}
193\u{1f918}\u{1f4a6}\u2714\u{1f623}\u{1f3c3}\u{1f490}\u2639\u{1f38a}\u{1f498}\u{1f620}\u261d\u{1f615}\u{1f33a}\u{1f382}\u{1f33b}\u{1f610}\u{1f595}\u{1f49d}\u{1f64a}\u{1f639}\u{1f5e3}\u{1f4ab}\u{1f480}\u{1f451}\u{1f3b5}\u{1f91e}\u{1f61b}\u{1f534}\u{1f624}\u{1f33c}\u{1f62b}\u26bd\u{1f919}\u2615\u{1f3c6}\u{1f92b}\u{1f448}\u{1f62e}\u{1f646}\u{1f37b}\u{1f343}\u{1f436}\u{1f481}\u{1f632}\u{1f33f}\u{1f9e1}\u{1f381}\u26a1\u{1f31e}\u{1f388}\u274c\u270a\u{1f44b}\u{1f630}\u{1f928}\u{1f636}\u{1f91d}\u{1f6b6}\u{1f4b0}\u{1f353}\u{1f4a2}\u{1f91f}\u{1f641}\u{1f6a8}\u{1f4a8}\u{1f92c}\u2708\u{1f380}\u{1f37a}\u{1f913}\u{1f619}\u{1f49f}\u{1f331}\u{1f616}\u{1f476}\u{1f974}\u25b6\u27a1\u2753\u{1f48e}\u{1f4b8}\u2b07\u{1f628}\u{1f31a}\u{1f98b}\u{1f637}\u{1f57a}\u26a0\u{1f645}\u{1f61f}\u{1f635}\u{1f44e}\u{1f932}\u{1f920}\u{1f927}\u{1f4cc}\u{1f535}\u{1f485}\u{1f9d0}\u{1f43e}\u{1f352}\u{1f617}\u{1f911}\u{1f30a}\u{1f92f}\u{1f437}\u260e\u{1f4a7}\u{1f62f}\u{1f486}\u{1f446}\u{1f3a4}\u{1f647}\u{1f351}\u2744\u{1f334}\u{1f4a3}\u{1f438}\u{1f48c}\u{1f4cd}\u{1f940}\u{1f922}\u{1f445}\u{1f4a1}\u{1f4a9}\u{1f450}\u{1f4f8}\u{1f47b}\u{1f910}\u{1f92e}\u{1f3bc}\u{1f975}\u{1f6a9}\u{1f34e}\u{1f34a}\u{1f47c}\u{1f48d}\u{1f4e3}\u{1f942}"),uA=cm.reduce((t,e,n)=>(t[n]=e,t),[]),dA=cm.reduce((t,e,n)=>(t[e.codePointAt(0)]=n,t),[]),pA=gc({prefix:"\u{1f680}",name:"base256emoji",encode:function fA(t){return t.reduce((e,n)=>e+uA[n],"")},decode:function hA(t){const e=[];for(const n of t){const r=dA[n.codePointAt(0)];if(void 0===r)throw new Error(`Non-base256emoji character: ${n}`);e.push(r)}return new Uint8Array(e)}});var _A=Math.pow(2,31),bA=Math.pow(2,7),wA=Math.pow(2,14),CA=Math.pow(2,21),AA=Math.pow(2,28),IA=Math.pow(2,35),SA=Math.pow(2,42),TA=Math.pow(2,49),OA=Math.pow(2,56),NA=Math.pow(2,63),RA={encode:function um(t,e,n){e=e||[];for(var r=n=n||0;t>=_A;)e[n++]=255&t|128,t/=128;for(;-128&t;)e[n++]=255&t|128,t>>>=7;return e[n]=0|t,um.bytes=n-r+1,e},decode:function Sd(t,r){var o,n=0,s=0,i=r=r||0,a=t.length;do{if(i>=a)throw Sd.bytes=0,new RangeError("Could not decode varint");o=t[i++],n+=s<28?(127&o)<<s:(127&o)*Math.pow(2,s),s+=7}while(o>=128);return Sd.bytes=i-r,n},encodingLength:function(t){return t<bA?1:t<wA?2:t<CA?3:t<AA?4:t<IA?5:t<SA?6:t<TA?7:t<OA?8:t<NA?9:10}};const mc=RA,yc=(t,e,n=0)=>(mc.encode(t,e,n),e),_c=t=>mc.encodingLength(t),Ec=(t,e)=>{const n=e.byteLength,r=_c(t),s=r+_c(n),i=new Uint8Array(s+n);return yc(t,i,0),yc(n,i,r),i.set(e,s),new Od(t,n,e,i)};class Od{constructor(e,n,r,s){this.code=e,this.size=n,this.digest=r,this.bytes=s}}const fm=({name:t,code:e,encode:n})=>new kA(t,e,n);class kA{constructor(e,n,r){this.name=e,this.code=n,this.encode=r}digest(e){if(e instanceof Uint8Array){const n=this.encode(e);return n instanceof Uint8Array?Ec(this.code,n):n.then(r=>Ec(this.code,r))}throw Error("Unknown type, must be binary type")}}const hm=t=>function(){var e=(0,l.A)(function*(n){return new Uint8Array(yield crypto.subtle.digest(t,n))});return function(n){return e.apply(this,arguments)}}(),MA=fm({name:"sha2-256",code:18,encode:hm("SHA-256")}),BA=fm({name:"sha2-512",code:19,encode:hm("SHA-512")}),gm=Wi,FA={code:0,name:"identity",encode:gm,digest:t=>Ec(0,gm(t))},WA="raw",jA=85,$A=t=>Wi(t),HA=t=>Wi(t),KA=new TextEncoder,zA=new TextDecoder,VA="json",GA=512,qA=t=>KA.encode(JSON.stringify(t)),YA=t=>JSON.parse(zA.decode(t));Symbol;const _m={...S,...P,...K,...m,...j,...R,...k,...v,...$,...x};function Em(t,e,n,r){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:n},decoder:{decode:r}}}const vm=Em("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>(new TextEncoder).encode(t.substring(1))),Nd=Em("ascii","a",t=>{let e="a";for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return e},t=>{const e=om((t=t.substring(1)).length);for(let n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e}),bm={utf8:vm,"utf-8":vm,hex:_m.base16,latin1:Nd,ascii:Nd,binary:Nd,..._m};function vr(t,e="utf8"){const n=bm[e];if(!n)throw new Error(`Unsupported encoding "${e}"`);return"utf8"!==e&&"utf-8"!==e||null==globalThis.Buffer||null==globalThis.Buffer.from?n.decoder.decode(`${n.prefix}${t}`):Id(globalThis.Buffer.from(t,"utf-8"))}function tr(t,e="utf8"){const n=bm[e];if(!n)throw new Error(`Unsupported encoding "${e}"`);return"utf8"!==e&&"utf-8"!==e||null==globalThis.Buffer||null==globalThis.Buffer.from?n.encoder.encode(t).substring(1):globalThis.Buffer.from(t.buffer,t.byteOffset,t.byteLength).toString("utf8")}const oI={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 aI=u(22950),sn=u(37044).hp;function Kr(t){const[e,n]=t.split(":");return{namespace:e,reference:n}}function xd(t,e){return t.includes(":")?[t]:e.chains||[]}const pI={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}},gI={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}};
193function et(t,e){const{message:n,code:r}=gI[t];return{message:e?`${n} ${e}`:n,code:r}}function cn(t,e){const{message:n,code:r}=pI[t];return{message:e?`${n} ${e}`:n,code:r}}var mI=Object.defineProperty,yI=Object.defineProperties,_I=Object.getOwnPropertyDescriptors,Pm=Object.getOwnPropertySymbols,EI=Object.prototype.hasOwnProperty,vI=Object.prototype.propertyIsEnumerable,Rd=(t,e,n)=>e in t?mI(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Dm=(t,e)=>{for(var n in e||(e={}))EI.call(e,n)&&Rd(t,n,e[n]);if(Pm)for(var n of Pm(e))vI.call(e,n)&&Rd(t,n,e[n]);return t},Um=(t,e,n)=>Rd(t,"symbol"!=typeof e?e+"":e,n);const AI="js";function Ic(){return typeof process<"u"&&typeof process.versions<"u"&&typeof process.versions.node<"u"}function ks(){return!(0,is.getDocument)()&&!!(0,is.getNavigator)()&&"ReactNative"===navigator.product}function ji(){return!Ic()&&!!(0,is.getNavigator)()&&!!(0,is.getDocument)()}function $i(){return ks()?"react-native":Ic()?"node":ji()?"browser":"unknown"}function Mm(){var t;try{return ks()&&typeof global<"u"&&typeof(null==global?void 0:global.Application)<"u"?null==(t=global.Application)?void 0:t.applicationId:void 0}catch{return}}function Bm(){return(0,Eb.g)()||{name:"",description:"",url:"",icons:[""]}}function Lm(t,e,n){const r=function NI(){if("react-native"===$i()&&typeof global<"u"&&typeof(null==global?void 0:global.Platform)<"u"){const{OS:n,Version:r}=global.Platform;return[n,r].join("-")}const t=function gb(t){return t?dp(t):typeof document>"u"&&typeof navigator<"u"&&"ReactNative"===navigator.product?new db:typeof navigator<"u"?dp(navigator.userAgent):function yb(){return typeof process<"u"&&process.version?new cb(process.version.slice(1)):null}()}();if(null===t)return"unknown";const e=t.os?t.os.replace(" ","").toLowerCase():"unknown";return"browser"===t.type?[e,t.name,t.version].join("-"):[e,t.version].join("-")}(),s=function xI(){var t;const e=$i();return"browser"===e?[e,(null==(t=(0,is.getLocation)())?void 0:t.host)||"unknown"].join(":"):e}();return[[t,e].join("-"),[AI,n].join("-"),r,s].join("/")}function ui(t,e){return t.filter(n=>e.includes(n)).length===t.length}function Dd(t){return Object.fromEntries(t.entries())}function Ud(t){return new Map(Object.entries(t))}function di(t=_.FIVE_MINUTES,e){const n=(0,_.toMiliseconds)(t||_.FIVE_MINUTES);let r,s,i,o;return{resolve:a=>{i&&r&&(clearTimeout(i),r(a),o=Promise.resolve(a))},reject:a=>{i&&s&&(clearTimeout(i),s(a))},done:()=>new Promise((a,c)=>{if(o)return a(o);i=setTimeout(()=>{const d=et("EXPIRED"),h=new Error(e||d.message);h.code=d.code,c(h)},n),r=a,s=c})}}function zr(t,e,n){return new Promise(function(){var r=(0,l.A)(function*(s,i){const o=setTimeout(()=>i(new Error(n)),e);try{s(yield t)}catch(a){i(a)}clearTimeout(o)});return function(s,i){return r.apply(this,arguments)}}())}function Fm(t,e){if("string"==typeof e&&e.startsWith(`${t}:`))return e;if("topic"===t.toLowerCase()){if("string"!=typeof e)throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}if("id"===t.toLowerCase()){if("number"!=typeof e)throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${t}`)}function Wm(t){const[e,n]=t.split(":"),r={id:void 0,topic:void 0};if("topic"===e&&"string"==typeof n)r.topic=n;else{if("id"!==e||!Number.isInteger(Number(n)))throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${n}`);r.id=Number(n)}return r}function yn(t,e){return(0,_.fromMiliseconds)((e||Date.now())+(0,_.toMiliseconds)(t))}function Vr(t){return Date.now()>=(0,_.toMiliseconds)(t)}function Jt(t,e){return`${t}${e?`:${e}`:""}`}function rr(t=[],e=[]){return[...new Set([...t,...e])]}function kd(){return kd=(0,l.A)(function*({id:t,topic:e,wcDeepLink:n}){var r;try{if(!n)return;const s="string"==typeof n?JSON.parse(n):n,i=s?.href;if("string"!=typeof i)return;const o=function LI(t,e,n){const r=`requestId=${e}&sessionTopic=${n}`;t.endsWith("/")&&(t=t.slice(0,-1));let s=`${t}`;return s=t.startsWith("https://t.me")?`${s}${t.includes("?")?"&startapp=":"?startapp="}${function HI(t,e=!1){const n=sn.from(t).toString("base64");return e?n.replace(/[=]/g,""):n}(r,!0)}`:`${s}/wc?${r}`,s}(i,t,e),a=$i();if("browser"===a){if(null==(r=(0,is.getDocument)())||!r.hasFocus())return void console.warn("Document does not have focus, skipping deeplink.");!function FI(t){let e="_self";!function $I(){try{return window.self!==window.top}catch{return!1}}()?(function jI(){return typeof window<"u"&&(!!window.TelegramWebviewProxy||!!window.Telegram||!!window.TelegramWebviewProxyProto)}()||t.startsWith("https://")||t.startsWith("http://"))&&(e="_blank"):e="_top",window.open(t,e,"noreferrer noopener")}(o)}else"react-native"===a&&typeof(null==global?void 0:global.Linking)<"u"&&(yield global.Linking.openURL(o))}catch(s){console.error(s)}}),kd.apply(this,arguments)}function Md(){return Md=(0,l.A)(function*(t,e){let n="";try{if(ji()&&(n=localStorage.getItem(e),n))return n;n=yield t.getItem(e)}catch(r){console.error(r)}return n}),Md.apply(this,arguments)}function $m(t,e){if(!t.includes(e))return null;const n=t.split(/([&,?,=])/),r=n.indexOf(e);return n[r+2]}function Hm(){return typeof crypto<"u"&&null!=crypto&&crypto.randomUUID?crypto.randomUUID():"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/gu,t=>{const e=16*Math.random()|0;return("x"===t?e:3&e|8).toString(16)})}function Bd(){return typeof process<"u"&&"true"===process.env.IS_VITEST}function Km(t){return sn.from(t,"base64").toString("utf-8")}class zI{constructor({limit:e}){Um(this,"limit"),Um(this,"set"),this.limit=e,this.set=new Set}
193add(e){if(!this.set.has(e)){if(this.set.size>=this.limit){const n=this.set.values().next().value;n&&this.set.delete(n)}this.set.add(e)}}has(e){return this.set.has(e)}}const Sc=BigInt(2**32-1),zm=BigInt(32);function Vm(t,e=!1){return e?{h:Number(t&Sc),l:Number(t>>zm&Sc)}:{h:0|Number(t>>zm&Sc),l:0|Number(t&Sc)}}function Gm(t,e=!1){const n=t.length;let r=new Uint32Array(n),s=new Uint32Array(n);for(let i=0;i<n;i++){const{h:o,l:a}=Vm(t[i],e);[r[i],s[i]]=[o,a]}return[r,s]}const qm=(t,e,n)=>t>>>n,Ym=(t,e,n)=>t<<32-n|e>>>n,Ms=(t,e,n)=>t>>>n|e<<32-n,Bs=(t,e,n)=>t<<32-n|e>>>n,ea=(t,e,n)=>t<<64-n|e>>>n-32,ta=(t,e,n)=>t>>>n-32|e<<64-n,VI=(t,e)=>e,GI=(t,e)=>t;function xr(t,e,n,r){const s=(e>>>0)+(r>>>0);return{h:t+n+(s/2**32|0)|0,l:0|s}}const Ld=(t,e,n)=>(t>>>0)+(e>>>0)+(n>>>0),Fd=(t,e,n,r)=>e+n+r+(t/2**32|0)|0,XI=(t,e,n,r)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0),QI=(t,e,n,r,s)=>e+n+r+s+(t/2**32|0)|0,eS=(t,e,n,r,s)=>(t>>>0)+(e>>>0)+(n>>>0)+(r>>>0)+(s>>>0),tS=(t,e,n,r,s,i)=>e+n+r+s+i+(t/2**32|0)|0,Hi="object"==typeof globalThis&&"crypto"in globalThis?globalThis.crypto:void 0;function Tc(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&"Uint8Array"===t.constructor.name}function ps(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function Rr(t,...e){if(!Tc(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function Oc(t){if("function"!=typeof t||"function"!=typeof t.create)throw new Error("Hash should be wrapped by utils.createHasher");ps(t.outputLen),ps(t.blockLen)}function Ls(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function Wd(t,e){Rr(t);const n=e.outputLen;if(t.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function na(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function br(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}function jd(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}function Gr(t,e){return t<<32-e|t>>>e}const Zm=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0];function Jm(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}const gs=Zm?t=>t:t=>Jm(t),Fs=Zm?t=>t:function nS(t){for(let e=0;e<t.length;e++)t[e]=Jm(t[e]);return t},Xm="function"==typeof Uint8Array.from([]).toHex&&"function"==typeof Uint8Array.fromHex,rS=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function Ki(t){if(Rr(t),Xm)return t.toHex();let e="";for(let n=0;n<t.length;n++)e+=rS[t[n]];return e}function Qm(t){return t>=48&&t<=57?t-48:t>=65&&t<=70?t-55:t>=97&&t<=102?t-87:void 0}function Nc(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);if(Xm)return Uint8Array.fromHex(t);const e=t.length,n=e/2;if(e%2)throw new Error("hex string expected, got unpadded hex of length "+e);const r=new Uint8Array(n);for(let s=0,i=0;s<n;s++,i+=2){const o=Qm(t.charCodeAt(i)),a=Qm(t.charCodeAt(i+1));if(void 0===o||void 0===a)throw new Error('hex string expected, got non-hex character "'+(t[i]+t[i+1])+'" at index '+i);r[s]=16*o+a}return r}function e0(t){if("string"!=typeof t)throw new Error("string expected");return new Uint8Array((new TextEncoder).encode(t))}function Pr(t){return"string"==typeof t&&(t=e0(t)),Rr(t),t}function Ws(...t){let e=0;for(let r=0;r<t.length;r++){const s=t[r];Rr(s),e+=s.length}const n=new Uint8Array(e);for(let r=0,s=0;r<t.length;r++){const i=t[r];n.set(i,s),s+=i.length}return n}class xc{}function ra(t){const e=r=>t().update(Pr(r)).digest(),n=t();return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=()=>t(),e}function fi(t=32){if(Hi&&"function"==typeof Hi.getRandomValues)return Hi.getRandomValues(new Uint8Array(t));if(Hi&&"function"==typeof Hi.randomBytes)return Uint8Array.from(Hi.randomBytes(t));throw new Error("crypto.getRandomValues must be defined")}const iS=BigInt(0),sa=BigInt(1),oS=BigInt(2),aS=BigInt(7),cS=BigInt(256),lS=BigInt(113),t0=[],n0=[],r0=[];for(let t=0,e=sa,n=1,r=0;t<24;t++){[n,r]=[r,(2*n+3*r)%5],t0.push(2*(5*r+n)),n0.push((t+1)*(t+2)/2%64);let s=iS;for(let i=0;i<7;i++)e=(e<<sa^(e>>aS)*lS)%cS,e&oS&&(s^=sa<<(sa<<BigInt(i))-sa);r0.push(s)}const s0=Gm(r0,!0),uS=s0[0],dS=s0[1],i0=(t,e,n)=>n>
vendor: 5,430 bytes, line 193
19332?((t,e,n)=>e<<n-32|t>>>64-n)(t,e,n):((t,e,n)=>t<<n|e>>>32-n)(t,e,n),o0=(t,e,n)=>n>32?((t,e,n)=>t<<n-32|e>>>64-n)(t,e,n):((t,e,n)=>e<<n|t>>>32-n)(t,e,n);class $d extends xc{constructor(e,n,r,s=!1,i=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=e,this.suffix=n,this.outputLen=r,this.enableXOF=s,this.rounds=i,ps(r),!(0<e&&e<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=na(this.state)}clone(){return this._cloneInto()}keccak(){Fs(this.state32),function fS(t,e=24){const n=new Uint32Array(10);for(let r=24-e;r<24;r++){for(let o=0;o<10;o++)n[o]=t[o]^t[o+10]^t[o+20]^t[o+30]^t[o+40];for(let o=0;o<10;o+=2){const a=(o+8)%10,c=(o+2)%10,d=n[c],h=n[c+1],b=i0(d,h,1)^n[a],M=o0(d,h,1)^n[a+1];for(let J=0;J<50;J+=10)t[o+J]^=b,t[o+J+1]^=M}let s=t[2],i=t[3];for(let o=0;o<24;o++){const a=n0[o],c=i0(s,i,a),d=o0(s,i,a),h=t0[o];s=t[h],i=t[h+1],t[h]=c,t[h+1]=d}for(let o=0;o<50;o+=10){for(let a=0;a<10;a++)n[a]=t[o+a];for(let a=0;a<10;a++)t[o+a]^=~n[(a+2)%10]&n[(a+4)%10]}t[0]^=uS[r],t[1]^=dS[r]}br(n)}(this.state32,this.rounds),Fs(this.state32),this.posOut=0,this.pos=0}update(e){Ls(this),Rr(e=Pr(e));const{blockLen:n,state:r}=this,s=e.length;for(let i=0;i<s;){const o=Math.min(n-this.pos,s-i);for(let a=0;a<o;a++)r[this.pos++]^=e[i++];this.pos===n&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:e,suffix:n,pos:r,blockLen:s}=this;e[r]^=n,!!(128&n)&&r===s-1&&this.keccak(),e[s-1]^=128,this.keccak()}writeInto(e){Ls(this,!1),Rr(e),this.finish();const n=this.state,{blockLen:r}=this;for(let s=0,i=e.length;s<i;){this.posOut>=r&&this.keccak();const o=Math.min(r-this.posOut,i-s);e.set(n.subarray(this.posOut,this.posOut+o),s),this.posOut+=o,s+=o}return e}xofInto(e){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(e)}xof(e){return ps(e),this.xofInto(new Uint8Array(e))}digestInto(e){if(Wd(e,this),this.finished)throw new Error("digest() was already called");return this.writeInto(e),this.destroy(),e}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,br(this.state)}_cloneInto(e){const{blockLen:n,suffix:r,outputLen:s,rounds:i,enableXOF:o}=this;return e||(e=new $d(n,r,s,o,i)),e.state32.set(this.state32),e.pos=this.pos,e.posOut=this.posOut,e.finished=this.finished,e.rounds=i,e.suffix=r,e.outputLen=s,e.enableXOF=o,e.destroyed=this.destroyed,e}}const pS=ra(()=>new $d(136,1,32));function mS(t,e,n){return t&e^~t&n}function yS(t,e,n){return t&e^t&n^e&n}class a0 extends xc{constructor(e,n,r,s){super(),this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.blockLen=e,this.outputLen=n,this.padOffset=r,this.isLE=s,this.buffer=new Uint8Array(e),this.view=jd(this.buffer)}update(e){Ls(this),Rr(e=Pr(e));const{view:n,buffer:r,blockLen:s}=this,i=e.length;for(let o=0;o<i;){const a=Math.min(s-this.pos,i-o);if(a===s){const c=jd(e);for(;s<=i-o;o+=s)this.process(c,o);continue}r.set(e.subarray(o,o+a),this.pos),this.pos+=a,o+=a,this.pos===s&&(this.process(n,0),this.pos=0)}return this.length+=e.length,this.roundClean(),this}digestInto(e){Ls(this),Wd(e,this),this.finished=!0;const{buffer:n,view:r,blockLen:s,isLE:i}=this;let{pos:o}=this;n[o++]=128,br(this.buffer.subarray(o)),this.padOffset>s-o&&(this.process(r,0),o=0);for(let b=o;b<s;b++)n[b]=0;(function gS(t,e,n,r){if("function"==typeof t.setBigUint64)return t.setBigUint64(e,n,r);const s=BigInt(32),i=BigInt(4294967295),o=Number(n>>s&i),a=Number(n&i),d=r?0:4;t.setUint32(e+(r?4:0),o,r),t.setUint32(e+d,a,r)})(r,s-8,BigInt(8*this.length),i),this.process(r,0);const a=jd(e),c=this.outputLen;if(c%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const d=c/4,h=this.get();if(d>h.length)throw new Error("_sha2: outputLen bigger than state");for(let b=0;b<d;b++)a.setUint32(4*b,h[b],i)}digest(){const{buffer:e,outputLen:n}=this;this.digestInto(e);const r=e.slice(0,n);return this.destroy(),r}_cloneInto(e){e||(e=new this.constructor),e.set(...this.get());const{blockLen:n,buffer:r,length:s,finished:i,destroyed:o,pos:a}=this;return e.destroyed=o,e.finished=i,e.length=s,e.pos=a,s%n&&e.buffer.set(r),e}clone(){return this._cloneInto()}}const js=Uint32Array.from([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),jn=Uint32Array.from([3418070365,3238371032,1654270250,914150663,2438529370,812702999,355462360,4144912697,1731405415,4290775857,2394180231,1750603025,3675008525,1694076839,1203062813,3204075428]),$n=Uint32Array.from([1779033703,4089235720,3144134277,2227873595,1013904242,4271175723,2773480762,1595750129,1359893119,2917565137,2600822924,725511199,528734635,4215389547,1541459225,327033209]),_S=Uint32Array.from([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756
vendor: 2,013 bytes, line 193
193734187,3204031479,3329325298]),$s=new Uint32Array(64);class ES extends a0{constructor(e=32){super(64,e,8,!1),this.A=0|js[0],this.B=0|js[1],this.C=0|js[2],this.D=0|js[3],this.E=0|js[4],this.F=0|js[5],this.G=0|js[6],this.H=0|js[7]}get(){const{A:e,B:n,C:r,D:s,E:i,F:o,G:a,H:c}=this;return[e,n,r,s,i,o,a,c]}set(e,n,r,s,i,o,a,c){this.A=0|e,this.B=0|n,this.C=0|r,this.D=0|s,this.E=0|i,this.F=0|o,this.G=0|a,this.H=0|c}process(e,n){for(let b=0;b<16;b++,n+=4)$s[b]=e.getUint32(n,!1);for(let b=16;b<64;b++){const M=$s[b-15],J=$s[b-2],te=Gr(M,7)^Gr(M,18)^M>>>3,re=Gr(J,17)^Gr(J,19)^J>>>10;$s[b]=re+$s[b-7]+te+$s[b-16]|0}let{A:r,B:s,C:i,D:o,E:a,F:c,G:d,H:h}=this;for(let b=0;b<64;b++){const J=h+(Gr(a,6)^Gr(a,11)^Gr(a,25))+mS(a,c,d)+_S[b]+$s[b]|0,te=(Gr(r,2)^Gr(r,13)^Gr(r,22))+yS(r,s,i)|0;h=d,d=c,c=a,a=o+J|0,o=i,i=s,s=r,r=J+te|0}r=r+this.A|0,s=s+this.B|0,i=i+this.C|0,o=o+this.D|0,a=a+this.E|0,c=c+this.F|0,d=d+this.G|0,h=h+this.H|0,this.set(r,s,i,o,a,c,d,h)}roundClean(){br($s)}destroy(){this.set(0,0,0,0,0,0,0,0),br(this.buffer)}}const c0=Gm(["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
1935771202a","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(t=>BigInt(t))),vS=c0[0],bS=c0[1],Hs=new Uint32Array(80),Ks=new Uint32Array(80);class Hd extends a0{constructor(e=64){super(128,e,16,!1),this.Ah=0|$n[0],this.Al=0|$n[1],this.Bh=0|$n[2],this.Bl=0|$n[3],this.Ch=0|$n[4],this.Cl=0|$n[5],this.Dh=0|$n[6],this.Dl=0|$n[7],this.Eh=0|$n[8],this.El=0|$n[9],this.Fh=0|$n[10],this.Fl=0|$n[11],this.Gh=0|$n[12],this.Gl=0|$n[13],this.Hh=0|$n[14],this.Hl=0|$n[15]}get(){const{Ah:e,Al:n,Bh:r,Bl:s,Ch:i,Cl:o,Dh:a,Dl:c,Eh:d,El:h,Fh:b,Fl:M,Gh:J,Gl:te,Hh:re,Hl:ae}=this;return[e,n,r,s,i,o,a,c,d,h,b,M,J,te,re,ae]}set(e,n,r,s,i,o,a,c,d,h,b,M,J,te,re,ae){this.Ah=0|e,this.Al=0|n,this.Bh=0|r,this.Bl=0|s,this.Ch=0|i,this.Cl=0|o,this.Dh=0|a,this.Dl=0|c,this.Eh=0|d,this.El=0|h,this.Fh=0|b,this.Fl=0|M,this.Gh=0|J,this.Gl=0|te,this.Hh=0|re,this.Hl=0|ae}process(e,n){for(let oe=0;oe<16;oe++,n+=4)Hs[oe]=e.getUint32(n),Ks[oe]=e.getUint32(n+=4);for(let oe=16;oe<80;oe++){const pe=0|Hs[oe-15],Ce=0|Ks[oe-15],ke=Ms(pe,Ce,1)^Ms(pe,Ce,8)^qm(pe,0,7),Be=Bs(pe,Ce,1)^Bs(pe,Ce,8)^Ym(pe,Ce,7),Fe=0|Hs[oe-2],Pe=0|Ks[oe-2],Ze=Ms(Fe,Pe,19)^ea(Fe,Pe,61)^qm(Fe,0,6),He=Bs(Fe,Pe,19)^ta(Fe,Pe,61)^Ym(Fe,Pe,6),Me=XI(Be,He,Ks[oe-7],Ks[oe-16]),Ee=QI(Me,ke,Ze,Hs[oe-7],Hs[oe-16]);Hs[oe]=0|Ee,Ks[oe]=0|Me}let{Ah:r,Al:s,Bh:i,Bl:o,Ch:a,Cl:c,Dh:d,Dl:h,Eh:b,El:M,Fh:J,Fl:te,Gh:re,Gl:ae,Hh:ye,Hl:Se}=this;for(let oe=0;oe<80;oe++){const pe=Ms(b,M,14)^Ms(b,M,18)^ea(b,M,41),Ce=Bs(b,M,14)^Bs(b,M,18)^ta(b,M,41),ke=b&J^~b&re,Fe=eS(Se,Ce,M&te^~M&ae,bS[oe],Ks[oe]),Pe=tS(Fe,ye,pe,ke,vS[oe],Hs[oe]),Ze=0|Fe,He=Ms(r,s,28)^ea(r,s,34)^ea(r,s,39),Me=Bs(r,s,28)^ta(r,s,34)^ta(r,s,39),Ee=r&i^r&a^i&a,Ne=s&o^s&c^o&c;ye=0|re,Se=0|ae,re=0|J,ae=0|te,J=0|b,te=0|M,({h:b,l:M}=xr(0|d,0|h,0|Pe,0|Ze)),d=0|a,h=0|c,a=0|i,c=0|o,i=0|r,o=0|s;const le=Ld(Ze,Me,Ne);r=Fd(le,Pe,He,Ee),s=0|le}({h:r,l:s}=xr(0|this.Ah,0|this.Al,0|r,0|s)),({h:i,l:o}=xr(0|this.Bh,0|this.Bl,0|i,0|o)),({h:a,l:c}=xr(0|this.Ch,0|this.Cl,0|a,0|c)),({h:d,l:h}=xr(0|this.Dh,0|this.Dl,0|d,0|h)),({h:b,l:M}=xr(0|this.Eh,0|this.El,0|b,0|M)),({h:J,l:te}=xr(0|this.Fh,0|this.Fl,0|J,0|te)),({h:re,l:ae}=xr(0|this.Gh,0|this.Gl,0|re,0|ae)),({h:ye,l:Se}=xr(0|this.Hh,0|this.Hl,0|ye,0|Se)),this.set(r,s,i,o,a,c,d,h,b,M,J,te,re,ae,ye,Se)}roundClean(){br(Hs,Ks)}destroy(){br(this.buffer),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}class wS extends Hd{constructor(){super(48),this.Ah=0|jn[0],this.Al=0|jn[1],this.Bh=0|jn[2],this.Bl=0|jn[3],this.Ch=0|jn[4],this.Cl=0|jn[5],this.Dh=0|jn[6],this.Dl=0|jn[7],this.Eh=0|jn[8],this.El=0|jn[9],this.Fh=0|jn[10],this.Fl=0|jn[11],this.Gh=0|jn[12],this.Gl=0|jn[13],this.Hh=0|jn[14],this.Hl=0|jn[15]}}const Hn=Uint32Array.from([573645204,4230739756,2673172387,3360449730,596883563,1867755857,2520282905,1497426621,2519219938,2827943907,3193839141,1401305490,721525244,746961066,246885852,2177182882]);class CS extends Hd{constructor(){super(32),this.Ah=0|Hn[0],this.Al=0|Hn[1],this.Bh=0|Hn[2],this.Bl=0|Hn[3],this.Ch=0|Hn[4],this.Cl=0|Hn[5],this.Dh=0|Hn[6],this.Dl=0|Hn[7],this.Eh=0|Hn[8],this.El=0|Hn[9],this.Fh=0|Hn[10],this.Fl=0|Hn[11],this.Gh=0|Hn[12],this.Gl=0|Hn[13],this.Hh=0|Hn[14],this.Hl=0|Hn[15]}}const Rc=ra(()=>new ES),AS=ra(()=>new Hd),IS=ra(()=>new wS),SS=ra(()=>new CS),TS=Uint8Array.from([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9,12,5,1,15,14,13,4,10,0,7,
1936,3,9,2,8,11,13,11,7,14,12,1,3,9,5,0,15,4,8,6,2,10,6,15,14,9,11,3,0,8,12,2,13,7,1,4,10,5,10,2,8,4,7,6,1,5,15,11,9,14,3,12,13,0,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,14,10,4,8,9,15,13,6,1,12,0,2,11,7,5,3,11,8,12,0,5,2,15,13,10,14,3,6,7,1,9,4,7,9,3,1,13,12,11,14,2,6,5,10,4,0,15,8,9,0,5,7,2,4,10,15,14,1,11,12,6,8,3,13,2,12,6,10,0,11,8,3,4,13,7,5,15,14,1,9]),Cn=Uint32Array.from([4089235720,1779033703,2227873595,3144134277,4271175723,1013904242,1595750129,2773480762,2917565137,1359893119,725511199,2600822924,4215389547,528734635,327033209,1541459225]),ft=new Uint32Array(32);function zs(t,e,n,r,s,i){const a=s[i+1];let c=ft[2*t],d=ft[2*t+1],h=ft[2*e],b=ft[2*e+1],M=ft[2*n],J=ft[2*n+1],te=ft[2*r],re=ft[2*r+1],ae=Ld(c,h,s[i]);d=Fd(ae,d,b,a),c=0|ae,({Dh:re,Dl:te}={Dh:re^d,Dl:te^c}),({Dh:re,Dl:te}={Dh:VI(0,te),Dl:GI(re)}),({h:J,l:M}=xr(J,M,re,te)),({Bh:b,Bl:h}={Bh:b^J,Bl:h^M}),({Bh:b,Bl:h}={Bh:Ms(b,h,24),Bl:Bs(b,h,24)}),ft[2*t]=c,ft[2*t+1]=d,ft[2*e]=h,ft[2*e+1]=b,ft[2*n]=M,ft[2*n+1]=J,ft[2*r]=te,ft[2*r+1]=re}function Vs(t,e,n,r,s,i){const a=s[i+1];
193let c=ft[2*t],d=ft[2*t+1],h=ft[2*e],b=ft[2*e+1],M=ft[2*n],J=ft[2*n+1],te=ft[2*r],re=ft[2*r+1],ae=Ld(c,h,s[i]);d=Fd(ae,d,b,a),c=0|ae,({Dh:re,Dl:te}={Dh:re^d,Dl:te^c}),({Dh:re,Dl:te}={Dh:Ms(re,te,16),Dl:Bs(re,te,16)}),({h:J,l:M}=xr(J,M,re,te)),({Bh:b,Bl:h}={Bh:b^J,Bl:h^M}),({Bh:b,Bl:h}={Bh:ea(b,h,63),Bl:ta(b,h,63)}),ft[2*t]=c,ft[2*t+1]=d,ft[2*e]=h,ft[2*e+1]=b,ft[2*n]=M,ft[2*n+1]=J,ft[2*r]=te,ft[2*r+1]=re}class NS extends xc{constructor(e,n){super(),this.finished=!1,this.destroyed=!1,this.length=0,this.pos=0,ps(e),ps(n),this.blockLen=e,this.outputLen=n,this.buffer=new Uint8Array(e),this.buffer32=na(this.buffer)}update(e){Ls(this),Rr(e=Pr(e));const{blockLen:n,buffer:r,buffer32:s}=this,i=e.length,o=e.byteOffset,a=e.buffer;for(let c=0;c<i;){this.pos===n&&(Fs(s),this.compress(s,0,!1),Fs(s),this.pos=0);const d=Math.min(n-this.pos,i-c),h=o+c;if(d===n&&!(h%4)&&c+d<i){const b=new Uint32Array(a,h,Math.floor((i-c)/4));Fs(b);for(let M=0;c+n<i;M+=s.length,c+=n)this.length+=n,this.compress(b,M,!1);Fs(b);continue}r.set(e.subarray(c,c+d),this.pos),this.pos+=d,this.length+=d,c+=d}return this}digestInto(e){Ls(this),Wd(e,this);const{pos:n,buffer32:r}=this;this.finished=!0,br(this.buffer.subarray(n)),Fs(r),this.compress(r,0,!0),Fs(r);const s=na(e);this.get().forEach((i,o)=>s[o]=gs(i))}digest(){const{buffer:e,outputLen:n}=this;this.digestInto(e);const r=e.slice(0,n);return this.destroy(),r}_cloneInto(e){const{buffer:n,length:r,finished:s,destroyed:i,outputLen:o,pos:a}=this;return e||(e=new this.constructor({dkLen:o})),e.set(...this.get()),e.buffer.set(n),e.destroyed=i,e.finished=s,e.length=r,e.pos=a,e.outputLen=o,e}clone(){return this._cloneInto()}}class xS extends NS{constructor(e={}){const n=void 0===e.dkLen?64:e.dkLen;super(128,n),this.v0l=0|Cn[0],this.v0h=0|Cn[1],this.v1l=0|Cn[2],this.v1h=0|Cn[3],this.v2l=0|Cn[4],this.v2h=0|Cn[5],this.v3l=0|Cn[6],this.v3h=0|Cn[7],this.v4l=0|Cn[8],this.v4h=0|Cn[9],this.v5l=0|Cn[10],this.v5h=0|Cn[11],this.v6l=0|Cn[12],this.v6h=0|Cn[13],this.v7l=0|Cn[14],this.v7h=0|Cn[15],function OS(t,e={},n,r,s){if(ps(n),t<0||t>n)throw new Error("outputLen bigger than keyLen");const{key:i,salt:o,personalization:a}=e;if(void 0!==i&&(i.length<1||i.length>n))throw new Error("key length must be undefined or 1.."+n);if(void 0!==o&&o.length!==r)throw new Error("salt must be undefined or "+r);if(void 0!==a&&a.length!==s)throw new Error("personalization must be undefined or "+s)}(n,e,64,16,16);let{key:r,personalization:s,salt:i}=e,o=0;if(void 0!==r&&(r=Pr(r),o=r.length),this.v0l^=this.outputLen|o<<8|65536|1<<24,void 0!==i){i=Pr(i);const a=na(i);this.v4l^=gs(a[0]),this.v4h^=gs(a[1]),this.v5l^=gs(a[2]),this.v5h^=gs(a[3])}if(void 0!==s){s=Pr(s);const a=na(s);this.v6l^=gs(a[0]),this.v6h^=gs(a[1]),this.v7l^=gs(a[2]),this.v7h^=gs(a[3])}if(void 0!==r){const a=new Uint8Array(this.blockLen);a.set(r),this.update(a)}}get(){let{v0l:e,v0h:n,v1l:r,v1h:s,v2l:i,v2h:o,v3l:a,v3h:c,v4l:d,v4h:h,v5l:b,v5h:M,v6l:J,v6h:te,v7l:re,v7h:ae}=this;return[e,n,r,s,i,o,a,c,d,h,b,M,J,te,re,ae]}set(e,n,r,s,i,o,a,c,d,h,b,M,J,te,re,ae){this.v0l=0|e,this.v0h=0|n,this.v1l=0|r,this.v1h=0|s,this.v2l=0|i,this.v2h=0|o,this.v3l=0|a,this.v3h=0|c,this.v4l=0|d,this.v4h=0|h,this.v5l=0|b,this.v5h=0|M,this.v6l=0|J,this.v6h=0|te,this.v7l=0|re,this.v7h=0|ae}compress(e,n,r){this.get().forEach((c,d)=>ft[d]=c),ft.set(Cn,16);let{h:s,l:i}=Vm(BigInt(this.length));ft[24]=Cn[8]^i,ft[25]=Cn[9]^s,r&&(ft[28]=~ft[28],ft[29]=~ft[29]);let o=0;const a=TS;for(let c=0;c<12;c++)zs(0,4,8,12,e,n+2*a[o++]),Vs(0,4,8,12,e,n+2*a[o++]),zs(1,5,9,13,e,n+2*a[o++]),Vs(1,5,9,13,e,n+2*a[o++]),zs(2,6,10,14,e,n+2*a[o++]),Vs(2,6,10,14,e,n+2*a[o++]),zs(3,7,11,15,e,n+2*a[o++]),Vs(3,7,11,15,e,n+2*a[o++]),zs(0,5,10,15,e,n+2*a[o++]),Vs(0,5,10,15,e,n+2*a[o++]),zs(1,6,11,12,e,n+2*a[o++]),Vs(1,6,11,12,e,n+2*a[o++]),zs(2,7,8,13,e,n+2*a[o++]),Vs(2,7,8,13,e,n+2*a[o++]),zs(3,4,9,14,e,n+2*a[o++]),Vs(3,4,9,14,e,n+2*a[o++]);this.v0l^=ft[0]^ft[16],this.v0h^=ft[1]^ft[17],this.v1l^=ft[2]^ft[18],this.v1h^=ft[3]^ft[19],this.v2l^=ft[4]^ft[20],this.v2h^=ft[5]^ft[21],this.v3l^=ft[6]^ft[22],this.v3h^=ft[7]^ft[23],this.v4l^=ft[8]^ft[24],this.v4h^=ft[9]^ft[25],this.v5l^=ft[10]^ft[26],this.v5h^=ft[11]^ft[27],this.v6l^=ft[12]^ft[28],this.v6h^=ft[13]^ft[29],this.v7l^=ft[14]^ft[30],this.v7h^=ft[15]^ft[31],br(ft)}destroy(){this.destroyed=!0,br(this.buffer32),this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)}}const RS=function sS(t){const e=(r,s)=>t(s).update(Pr(r)).digest(),n=t({});return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=r=>t(r),e}(t=>new xS(t));function l0(t){const e=`\x19Ethereum Signed Message:\n${t.length}`,n=(new TextEncoder).encode(e+t);return"0x"+sn.from(pS(n)).toString("hex")}function Kd(){return Kd=(0,l.A)(function*(t,e,n,r,s,i){switch(n.t){case"eip191":return yield function US(t,e,n){const r=Ou(n);return function Wg(t){return D1(function W1(t){const{payload:e,signature:n}=t,{r,s,yParity:i}=n;return I1(new Eg.Signature(BigInt(r),BigInt(s)).addRecoveryBit(i).recoverPublicKey(Au(e).substring(2)))}(t))}({payload:l0(e),signature:r}).toLowerCase()===t.toLowerCase()}(t,e,n.s);case"eip1271":return yield function kS(t,e,n,r,s,i){return zd.apply(this,arguments)}(t,e,n.s,r,s,i);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${n.t}`)}}),Kd.apply(this,arguments)}function zd(){return zd=(0,l.A)(function*(t,e,n,r,s,i){const o=Kr(r);if(!o.namespace||!o.reference)throw new Error(`isValidEip1271Signature failed: chainId must be in CAIP-2 format, received: ${r}`);try{const a="0x1626ba7e",c="0000000000000000000000000000000000000000000000000000000000000040",d=n.substring(2),h=(d.length/2).toString(16).padStart(64,"0"),M=a+(e.startsWith("0x")?e:l0(e)).substring(2)+c+h+d,J=yield fetch(`${i||"https://rpc.walletconnect.org/v1"}/?chainId=${r}&projectId=${s}`,{headers:{"Content-Type":"application/json"},method:"POST",body:JSON.stringify({id:Date.now()+Math.floor(1e3*Math.random()),jsonrpc:"2.0",method:"eth_call",params:[{to:t,data:M},"latest"]})}),{result:te}=yield J.json();return!!te&&te.slice(0,a.length).toLowerCase()===a.toLowerCase()}catch(a){return console.error("isValidEip1271Signature: ",a),!1}}),zd.apply(this,arguments)}function LS(t){const e=new Uint8Array(sn.from(t,"base64")),n=Array.from("TransactionData::").map(i=>
193i.charCodeAt(0)),r=new Uint8Array(n.length+e.length);r.set(n),r.set(e,n.length);const s=RS(r,{dkLen:32});return fs.encode(s)}function u0(t){const e=new Uint8Array(Rc(function FS(t){if(t instanceof Uint8Array)return t;if(Array.isArray(t))return new Uint8Array(t);if("object"==typeof t&&null!=t&&t.data)return new Uint8Array(Object.values(t.data));if("object"==typeof t&&t)return new Uint8Array(Object.values(t));throw new Error("getNearUint8ArrayFromBytes: Unexpected result type from bytes array")}(t)));return fs.encode(e)}function d0(t){const n=function vC(t,e){return new yd(e).decode(t)}(sn.from(t,"base64")).txn;if(!n)throw new Error("Invalid signed transaction: missing 'txn' field");const r=function CC(t,e){return new _d(e).encodeSharedRef(t)}(n),s=sn.from("TX"),i=sn.concat([s,sn.from(r)]),o=SS(i);return Xg.encode(o).replace(/=+$/,"")}function Vd(t){const e=[];let n=BigInt(t);for(;n>=BigInt(128);)e.push(Number(n&BigInt(127)|BigInt(128))),n>>=BigInt(7);return e.push(Number(n)),sn.from(e)}function WS(t){const e=sn.from(t.signed.bodyBytes,"base64"),n=sn.from(t.signed.authInfoBytes,"base64"),r=sn.from(t.signature.signature,"base64"),s=[];s.push(sn.from([10])),s.push(Vd(e.length)),s.push(e),s.push(sn.from([18])),s.push(Vd(n.length)),s.push(n),s.push(sn.from([26])),s.push(Vd(r.length)),s.push(r);const i=sn.concat(s),o=Rc(i);return sn.from(o).toString("hex").toUpperCase()}var $S=Object.defineProperty,HS=Object.defineProperties,KS=Object.getOwnPropertyDescriptors,f0=Object.getOwnPropertySymbols,zS=Object.prototype.hasOwnProperty,VS=Object.prototype.propertyIsEnumerable,h0=(t,e,n)=>e in t?$S(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;const g0="did:pkh:",GS={eip155:"Ethereum",solana:"Solana",bip122:"Bitcoin"},Pc=t=>t?.split(":"),qd=t=>{const e=t&&Pc(t);if(e)return e[2]+":"+e[3]},Dc=t=>{const e=t&&Pc(t);if(e)return e.pop()};function m0(t){return Yd.apply(this,arguments)}function Yd(){return Yd=(0,l.A)(function*(t){const{cacao:e,projectId:n}=t,{s:r,p:s}=e,i=y0(s,s.iss),o=Dc(s.iss);return yield function DS(t,e,n,r,s,i){return Kd.apply(this,arguments)}(o,i,r,qd(s.iss),n)}),Yd.apply(this,arguments)}const y0=(t,e)=>{const n=(t=>{const e=t&&Pc(t);if(e)return t.includes(g0)?e[2]:e[0]})(e);if(!n)throw new Error("Invalid issuer: "+e);const r=`${t.domain} wants you to sign in with your ${(t=>t?GS[t]||t:"")(n)} account:`,s=Dc(e);if(!t.aud&&!t.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let i=t.statement||void 0;const o=`URI: ${t.aud||t.uri}`,a=`Version: ${t.version}`,c=`Chain ID: ${(t=>{const e=t&&Pc(t);if(e)return t.includes(g0)?e[3]:e[1]})(e)}`,d=`Nonce: ${t.nonce}`,h=`Issued At: ${t.iat}`,b=t.exp?`Expiration Time: ${t.exp}`:void 0,M=t.nbf?`Not Before: ${t.nbf}`:void 0,J=t.requestId?`Request ID: ${t.requestId}`:void 0,te=t.resources?`Resources:${t.resources.map(ae=>`\n- ${ae}`).join("")}`:void 0,re=zi(t.resources);return re&&(i=function v0(t="",e){ys(e);const n="I further authorize the stated URI to perform the following actions on my behalf: ";if(t.includes(n))return t;const r=[];let s=0;return Object.keys(e.att).forEach(a=>{const c=Object.keys(e.att[a]).map(b=>({ability:b.split("/")[0],action:b.split("/")[1]}));c.sort((b,M)=>b.action.localeCompare(M.action));const d={};c.forEach(b=>{d[b.ability]||(d[b.ability]=[]),d[b.ability].push(b.action)});const h=Object.keys(d).map(b=>(s++,`(${s}) '${b}': '${d[b].join("', '")}' for '${a}'.`));r.push(h.join(", ").replace(".,","."))}),`${t?t+" ":""}${n}${r.join(" ")}`}(i,hi(re))),[r,s,"",i,"",o,a,c,d,h,b,M,J,te].filter(ae=>null!=ae).join("\n")};function ys(t){if(!t)throw new Error("No recap provided, value is undefined");if(!t.att)throw new Error("No `att` property found");const e=Object.keys(t.att);if(null==e||!e.length)throw new Error("No resources found in `att` property");e.forEach(n=>{const r=t.att[n];if(Array.isArray(r))throw new Error(`Resource must be an object: ${n}`);if("object"!=typeof r)throw new Error(`Resource must be an object: ${n}`);if(!Object.keys(r).length)throw new Error(`Resource object is empty: ${n}`);Object.keys(r).forEach(s=>{const i=r[s];if(!Array.isArray(i))throw new Error(`Ability limits ${s} must be an array of objects, found: ${i}`);if(!i.length)throw new Error(`Value of ${s} is empty array, must be an array with objects`);
193i.forEach(o=>{if("object"!=typeof o)throw new Error(`Ability limits (${s}) must be an array of objects, found: ${o}`)})})})}function _0(t,e,n={}){e=e?.sort((s,i)=>s.localeCompare(i));const r=e.map(s=>({[`${t}/${s}`]:[n]}));return Object.assign({},...r)}function Zd(t){return ys(t),`urn:recap:${function e2(t){return sn.from(JSON.stringify(t)).toString("base64")}(t).replace(/=/g,"")}`}function hi(t){const e=function t2(t){return JSON.parse(sn.from(t,"base64").toString("utf-8"))}(t.replace("urn:recap:",""));return ys(e),e}function i2(t,e){const s=function o2(t,e){ys(t),ys(e);const n=Object.keys(t.att).concat(Object.keys(e.att)).sort((s,i)=>s.localeCompare(i)),r={att:{}};return n.forEach(s=>{var i,o;Object.keys((null==(i=t.att)?void 0:i[s])||{}).concat(Object.keys((null==(o=e.att)?void 0:o[s])||{})).sort((a,c)=>a.localeCompare(c)).forEach(a=>{var c,d;r.att[s]=((t,e)=>HS(t,KS(e)))(((t,e)=>{for(var n in e||(e={}))zS.call(e,n)&&h0(t,n,e[n]);if(f0)for(var n of f0(e))VS.call(e,n)&&h0(t,n,e[n]);return t})({},r.att[s]),{[a]:(null==(c=t.att[s])?void 0:c[a])||(null==(d=e.att[s])?void 0:d[a])})})}),r}(hi(t),hi(e));return Zd(s)}function b0(t){var e;const n=hi(t);ys(n);const r=null==(e=n.att)?void 0:e.eip155;return r?Object.keys(r).map(s=>s.split("/")[1]):[]}function w0(t){const e=hi(t);ys(e);const n=[];return Object.values(e.att).forEach(r=>{Object.values(r).forEach(s=>{var i;null!=(i=s?.[0])&&i.chains&&n.push(s[0].chains)})}),[...new Set(n.flat())]}function zi(t){if(!t)return;const e=t?.[t.length-1];return function E0(t){return t&&t.includes("urn:recap:")}(e)?e:void 0}function C0(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&"Uint8Array"===t.constructor.name}function Jd(t){if("boolean"!=typeof t)throw new Error(`boolean expected, not ${t}`)}function Xd(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function sr(t,...e){if(!C0(t))throw new Error("Uint8Array expected");if(e.length>0&&!e.includes(t.length))throw new Error("Uint8Array expected of length "+e+", got length="+t.length)}function A0(t,e=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(e&&t.finished)throw new Error("Hash#digest() has already been called")}function Gs(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function Vi(...t){for(let e=0;e<t.length;e++)t[e].fill(0)}const u2=68===new Uint8Array(new Uint32Array([287454020]).buffer)[0];function Qd(t){if("string"==typeof t)t=function d2(t){if("string"!=typeof t)throw new Error("string expected");return new Uint8Array((new TextEncoder).encode(t))}(t);else{if(!C0(t))throw new Error("Uint8Array expected, got "+typeof t);t=ef(t)}return t}function I0(t,e,n=!0){if(void 0===e)return new Uint8Array(t);if(e.length!==t)throw new Error("invalid output length, expected "+t+", got: "+e.length);if(n&&!function m2(t){return t.byteOffset%4==0}(e))throw new Error("invalid output, must be aligned");return e}function S0(t,e,n,r){if("function"==typeof t.setBigUint64)return t.setBigUint64(e,n,r);const s=BigInt(32),i=BigInt(4294967295),o=Number(n>>s&i),a=Number(n&i),d=r?0:4;t.setUint32(e+(r?4:0),o,r),t.setUint32(e+d,a,r)}function ef(t){return Uint8Array.from(t)}const T0=t=>Uint8Array.from(t.split("").map(e=>e.charCodeAt(0))),y2=T0("expand 16-byte k"),_2=T0("expand 32-byte k"),E2=Gs(y2),v2=Gs(_2);function qt(t,e){return t<<e|t>>>32-e}function tf(t){return t.byteOffset%4==0}const O0=2**32-1,N0=new Uint32Array,Rn=(t,e)=>255&t[e++]|(255&t[e++])<<8;class A2{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,sr(e=Qd(e),32);const n=Rn(e,0),r=Rn(e,2),s=Rn(e,4),i=Rn(e,6),o=Rn(e,8),a=Rn(e,10),c=Rn(e,12),d=Rn(e,14);this.r[0]=8191&n,this.r[1]=8191&(n>>>13|r<<3),this.r[2]=7939&(r>>>10|s<<6),this.r[3]=8191&(s>>>7|i<<9),this.r[4]=255&(i>>>4|o<<12),this.r[5]=o>>>1&8190,this.r[6]=8191&(o>>>14|a<<2),this.r[7]=8065&(a>>>11|c<<5),this.r[8]=8191&(c>>>8|d<<8),this.r[9]=d>>>5&127;for(let h=0;h<8;h++)this.pad[h]=Rn(e,16+2*h)}process(e,n,r=!1){const s=r?0:2048,{h:i,r:o}=this,a=o[0],c=o[1],d=o[2],h=o[3],b=o[4],M=o[5],J=o[6],te=o[7],re=o[8],ae=o[9],ye=Rn(e,n+0),Se=Rn(e,n+2),oe=Rn(e,n+4),pe=Rn(e,n+6),Ce=Rn(e,n+8),ke=Rn(e,n+10),Be=Rn(e,n+12),Fe=Rn(e,n+14);let Pe=i[0]+(8191&ye),Ze=i[1]+(8191&(ye>>>13|Se<<3)),He=i[2]+(8191&(Se>>>10|oe<<6)),Me=i[3]+(8191&(oe>>>7|pe<<9)),Ee=i[4]+(8191&(pe>>>4|Ce<<12)),Ne=i[5]+(Ce>>>1&8191),le=i[6]+(8191&(Ce>>>14|ke<<2)),ue=i[7]+(8191&(ke>>>11|Be<<5)),be=i[8]+(8191&(Be>>>8|Fe<<8)),Re=i[9]+(Fe>>>5|s),we=0,De=we+Pe*a+Ze*(5*ae)+He*(5*re)+Me*(5*te)+Ee*(5*J);we=De>>>13,De&=8191,De+=Ne*(5*M)+le*(5*b)+ue*(5*h)+be*(5*d)+Re*(5*c),we+=De>>>13,De&=8191;let je=we+Pe*c+Ze*a+He*(5*ae)+Me*(5*re)+Ee*(5*te);we=je>>>13,je&=8191,je+=Ne*(5*J)+le*(5*M)+ue*(5*b)+be*(5*h)+Re*(5*d),we+=je>>>13,je&=8191;let ze=we+Pe*d+Ze*c+He*a+Me*(5*ae)+Ee*(5*re);we=ze>>>13,ze&=8191,ze+=Ne*(5*te)+le*(5*J)+ue*(5*M)+be*(5*b)+Re*(5*h),we+=ze>>
193>13,ze&=8191;let ot=we+Pe*h+Ze*d+He*c+Me*a+Ee*(5*ae);we=ot>>>13,ot&=8191,ot+=Ne*(5*re)+le*(5*te)+ue*(5*J)+be*(5*M)+Re*(5*b),we+=ot>>>13,ot&=8191;let mt=we+Pe*b+Ze*h+He*d+Me*c+Ee*a;we=mt>>>13,mt&=8191,mt+=Ne*(5*ae)+le*(5*re)+ue*(5*te)+be*(5*J)+Re*(5*M),we+=mt>>>13,mt&=8191;let st=we+Pe*M+Ze*b+He*h+Me*d+Ee*c;we=st>>>13,st&=8191,st+=Ne*a+le*(5*ae)+ue*(5*re)+be*(5*te)+Re*(5*J),we+=st>>>13,st&=8191;let It=we+Pe*J+Ze*M+He*b+Me*h+Ee*d;we=It>>>13,It&=8191,It+=Ne*c+le*a+ue*(5*ae)+be*(5*re)+Re*(5*te),we+=It>>>13,It&=8191;let St=we+Pe*te+Ze*J+He*M+Me*b+Ee*h;we=St>>>13,St&=8191,St+=Ne*d+le*c+ue*a+be*(5*ae)+Re*(5*re),we+=St>>>13,St&=8191;let Wt=we+Pe*re+Ze*te+He*J+Me*M+Ee*b;we=Wt>>>13,Wt&=8191,Wt+=Ne*h+le*d+ue*c+be*a+Re*(5*ae),we+=Wt>>>13,Wt&=8191;let Ot=we+Pe*ae+Ze*re+He*te+Me*J+Ee*M;we=Ot>>>13,Ot&=8191,Ot+=Ne*b+le*h+ue*d+be*c+Re*a,we+=Ot>>>13,Ot&=8191,we=(we<<2)+we|0,we=we+De|0,De=8191&we,we>>>=13,je+=we,i[0]=De,i[1]=je,i[2]=ze,i[3]=ot,i[4]=mt,i[5]=st,i[6]=It,i[7]=St,i[8]=Wt,i[9]=Ot}finalize(){const{h:e,pad:n}=this,r=new Uint16Array(10);let s=e[1]>>>13;e[1]&=8191;for(let a=2;a<10;a++)e[a]+=s,s=e[a]>>>13,e[a]&=8191;e[0]+=5*s,s=e[0]>>>13,e[0]&=8191,e[1]+=s,s=e[1]>>>13,e[1]&=8191,e[2]+=s,r[0]=e[0]+5,s=r[0]>>>13,r[0]&=8191;for(let a=1;a<10;a++)r[a]=e[a]+s,s=r[a]>>>13,r[a]&=8191;r[9]-=8192;let i=(1^s)-1;for(let a=0;a<10;a++)r[a]&=i;i=~i;for(let a=0;a<10;a++)e[a]=e[a]&i|r[a];e[0]=65535&(e[0]|e[1]<<13),e[1]=65535&(e[1]>>>3|e[2]<<10),e[2]=65535&(e[2]>>>6|e[3]<<7),e[3]=65535&(e[3]>>>9|e[4]<<4),e[4]=65535&(e[4]>>>12|e[5]<<1|e[6]<<14),e[5]=65535&(e[6]>>>2|e[7]<<11),e[6]=65535&(e[7]>>>5|e[8]<<8),e[7]=65535&(e[8]>>>8|e[9]<<5);let o=e[0]+n[0];e[0]=65535&o;for(let a=1;a<8;a++)o=(e[a]+n[a]|0)+(o>>>16)|0,e[a]=65535&o;Vi(r)}update(e){A0(this),sr(e=Qd(e));const{buffer:n,blockLen:r}=this,s=e.length;for(let i=0;i<s;){const o=Math.min(r-this.pos,s-i);if(o!==r)n.set(e.subarray(i,i+o),this.pos),this.pos+=o,i+=o,this.pos===r&&(this.process(n,0,!1),this.pos=0);else for(;r<=s-i;i+=r)this.process(e,i)}return this}destroy(){Vi(this.h,this.r,this.buffer,this.pad)}digestInto(e){A0(this),function c2(t,e){sr(t);const n=e.outputLen;if(t.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}(e,this),this.finished=!0;const{buffer:n,h:r}=this;let{pos:s}=this;if(s){for(n[s++]=1;s<16;s++)n[s]=0;this.process(n,0,!0)}this.finalize();let i=0;for(let o=0;o<8;o++)e[i++]=r[o]>>>0,e[i++]=r[o]>>>8;return e}digest(){const{buffer:e,outputLen:n}=this;this.digestInto(e);const r=e.slice(0,n);return this.destroy(),r}}const S2=function I2(t){const e=(r,s)=>t(s).update(Qd(r)).digest(),n=t(new Uint8Array(32));return e.outputLen=n.outputLen,e.blockLen=n.blockLen,e.create=r=>t(r),e}(t=>new A2(t)),O2=function C2(t,e){const{allowShortKeys:n,extendNonceFn:r,counterLength:s,counterRight:i,rounds:o}=function f2(t,e){if(null==e||"object"!=typeof e)throw new Error("options must be defined");return Object.assign(t,e)}({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},e);if("function"!=typeof t)throw new Error("core must be a function");return Xd(s),Xd(o),Jd(i),Jd(n),(a,c,d,h,b=0)=>{sr(a),sr(c),sr(d);const M=d.length;if(void 0===h&&(h=new Uint8Array(M)),sr(h),Xd(b),b<0||b>=O0)throw new Error("arx: counter overflow");if(h.length<M)throw new Error(`arx: output (${h.length}) is shorter than data (${M})`);const J=[];let re,ae,te=a.length;if(32===te)J.push(re=ef(a)),ae=v2;else{if(16!==te||!n)throw new Error(`arx: invalid 32-byte key, got length=${te}`);re=new Uint8Array(32),re.set(a),re.set(a,16),ae=E2,J.push(re)}tf(c)||J.push(c=ef(c));const ye=Gs(re);if(r){if(24!==c.length)throw new Error("arx: extended nonce must be 24 bytes");r(ae,ye,Gs(c.subarray(0,16)),ye),c=c.subarray(16)}const Se=16-s;if(Se!==c.length)throw new Error(`arx: nonce must be ${Se} or 16 bytes`);if(12!==Se){const pe=new Uint8Array(12);pe.set(c,i?0:12-c.length),J.push(c=pe)}const oe=Gs(c);return function w2(t,e,n,r,s,i,o,a){const c=s.length,d=new Uint8Array(64),h=Gs(d),b=tf(s)&&tf(i),M=b?Gs(s):N0,J=b?Gs(i):N0;for(let te=0;te<c;o++){if(t(e,n,r,h,o,a),o>=O0)throw new Error("arx: counter overflow");const re=Math.min(64,c-te);if(b&&64===re){const ae=te/4;
193if(te%4!=0)throw new Error("arx: invalid block position");for(let Se,ye=0;ye<16;ye++)Se=ae+ye,J[Se]=M[Se]^h[ye];te+=64;continue}for(let ye,ae=0;ae<re;ae++)ye=te+ae,i[ye]=s[ye]^d[ae];te+=re}}(t,ae,ye,oe,d,h,b,o),Vi(...J),h}}(function T2(t,e,n,r,s,i=20){let o=t[0],a=t[1],c=t[2],d=t[3],h=e[0],b=e[1],M=e[2],J=e[3],te=e[4],re=e[5],ae=e[6],ye=e[7],Se=s,oe=n[0],pe=n[1],Ce=n[2],ke=o,Be=a,Fe=c,Pe=d,Ze=h,He=b,Me=M,Ee=J,Ne=te,le=re,ue=ae,be=ye,Re=Se,we=oe,De=pe,je=Ce;for(let ot=0;ot<i;ot+=2)ke=ke+Ze|0,Re=qt(Re^ke,16),Ne=Ne+Re|0,Ze=qt(Ze^Ne,12),ke=ke+Ze|0,Re=qt(Re^ke,8),Ne=Ne+Re|0,Ze=qt(Ze^Ne,7),Be=Be+He|0,we=qt(we^Be,16),le=le+we|0,He=qt(He^le,12),Be=Be+He|0,we=qt(we^Be,8),le=le+we|0,He=qt(He^le,7),Fe=Fe+Me|0,De=qt(De^Fe,16),ue=ue+De|0,Me=qt(Me^ue,12),Fe=Fe+Me|0,De=qt(De^Fe,8),ue=ue+De|0,Me=qt(Me^ue,7),Pe=Pe+Ee|0,je=qt(je^Pe,16),be=be+je|0,Ee=qt(Ee^be,12),Pe=Pe+Ee|0,je=qt(je^Pe,8),be=be+je|0,Ee=qt(Ee^be,7),ke=ke+He|0,je=qt(je^ke,16),ue=ue+je|0,He=qt(He^ue,12),ke=ke+He|0,je=qt(je^ke,8),ue=ue+je|0,He=qt(He^ue,7),Be=Be+Me|0,Re=qt(Re^Be,16),be=be+Re|0,Me=qt(Me^be,12),Be=Be+Me|0,Re=qt(Re^Be,8),be=be+Re|0,Me=qt(Me^be,7),Fe=Fe+Ee|0,we=qt(we^Fe,16),Ne=Ne+we|0,Ee=qt(Ee^Ne,12),Fe=Fe+Ee|0,we=qt(we^Fe,8),Ne=Ne+we|0,Ee=qt(Ee^Ne,7),Pe=Pe+Ze|0,De=qt(De^Pe,16),le=le+De|0,Ze=qt(Ze^le,12),Pe=Pe+Ze|0,De=qt(De^Pe,8),le=le+De|0,Ze=qt(Ze^le,7);let ze=0;r[ze++]=o+ke|0,r[ze++]=a+Be|0,r[ze++]=c+Fe|0,r[ze++]=d+Pe|0,r[ze++]=h+Ze|0,r[ze++]=b+He|0,r[ze++]=M+Me|0,r[ze++]=J+Ee|0,r[ze++]=te+Ne|0,r[ze++]=re+le|0,r[ze++]=ae+ue|0,r[ze++]=ye+be|0,r[ze++]=Se+Re|0,r[ze++]=oe+we|0,r[ze++]=pe+De|0,r[ze++]=Ce+je|0},{counterRight:!1,counterLength:4,allowShortKeys:!1}),N2=new Uint8Array(16),x0=(t,e)=>{t.update(e);const n=e.length%16;n&&t.update(N2.subarray(n))},x2=new Uint8Array(32);function R0(t,e,n,r,s){const i=t(e,n,x2),o=S2.create(i);s&&x0(o,s),x0(o,r);const a=function g2(t,e,n){Jd(n);const r=new Uint8Array(16),s=function l2(t){return new DataView(t.buffer,t.byteOffset,t.byteLength)}(r);return S0(s,0,BigInt(e),n),S0(s,8,BigInt(t),n),r}(r.length,s?s.length:0,!0);o.update(a);const c=o.digest();return Vi(i,a),c}const P0=((t,e)=>{function n(r,...s){if(sr(r),!u2)throw new Error("Non little-endian hardware is not yet supported");if(void 0!==t.nonceLength){const d=s[0];if(!d)throw new Error("nonce / iv required");t.varSizeNonce?sr(d):sr(d,t.nonceLength)}const i=t.tagLength;i&&void 0!==s[1]&&sr(s[1]);const o=e(r,...s),a=(d,h)=>{if(void 0!==h){if(2!==d)throw new Error("cipher output not supported");sr(h)}};let c=!1;return{encrypt(d,h){if(c)throw new Error("cannot encrypt() twice with same key + nonce");return c=!0,sr(d),a(o.encrypt.length,h),o.encrypt(d,h)},decrypt(d,h){if(sr(d),i&&d.length<i)throw new Error("invalid ciphertext length: smaller than tagLength="+i);return a(o.decrypt.length,h),o.decrypt(d,h)}}}return Object.assign(n,t),n})({blockSize:64,nonceLength:12,tagLength:16},(t=>(e,n,r)=>({encrypt(s,i){const o=s.length;(i=I0(o+16,i,!1)).set(s);const a=i.subarray(0,-16);t(e,n,a,a,1);const c=R0(t,e,n,a,r);return i.set(c,o),Vi(c),i},decrypt(s,i){i=I0(s.length-16,i,!1);const o=s.subarray(0,-16),a=s.subarray(-16),c=R0(t,e,n,o,r);if(!function h2(t,e){if(t.length!==e.length)return!1;let n=0;for(let r=0;r<t.length;r++)n|=t[r]^e[r];return 0===n}(a,c))throw new Error("invalid tag");return i.set(s.subarray(0,-16)),t(e,n,i,i,1),Vi(c),i}}))(O2));class D0 extends xc{constructor(e,n){super(),this.finished=!1,this.destroyed=!1,Oc(e);const r=Pr(n);if(this.iHash=e.create(),"function"!=typeof this.iHash.update)throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const s=this.blockLen,i=new Uint8Array(s);i.set(r.length>s?e.create().update(r).digest():r);for(let o=0;o<i.length;o++)i[o]^=54;this.iHash.update(i),this.oHash=e.create();for(let o=0;o<i.length;o++)i[o]^=106;this.oHash.update(i),br(i)}update(e){return Ls(this),this.iHash.update(e),this}digestInto(e){Ls(this),Rr(e,this.outputLen),this.finished=!0,this.iHash.digestInto(e),this.oHash.update(e),this.oHash.digestInto(e),this.destroy()}digest(){const e=new Uint8Array(this.oHash.outputLen);return this.digestInto(e),e}_cloneInto(e){e||(e=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:r,finished:s,destroyed:i,blockLen:o,outputLen:a}=this;return e.finished=s,e.destroyed=i,e.blockLen=o,e.outputLen=a,e.oHash=n._cloneInto(e.oHash),e.iHash=r._cloneInto(e.iHash),e}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}const kc=(t,e,n)=>new D0(t,e).update(n).digest();kc.create=(t,e)=>new D0(t,e);const nf=Uint8Array.from([0]),U0=Uint8Array.of(),Mc=Rc,rf=BigInt(0),sf=BigInt(1);function Bc(t,e=""){if("boolean"!=typeof t)throw new Error((e&&`"${e}"`)+"expected boolean, got type="+typeof t);return t}function pi(t,e,n=""){const r=Tc(t),s=t?.length,i=void 0!==e;if(!r||i&&s!==e)throw new Error((n&&`"${n}" `)+"expected Uint8Array"+(i?` of length ${e}`:"")+", got "+(r?`length=${s}`:"type="+typeof t));return t}function Lc(t){const e=t.toString(16);return 1&e.length?"0"+e:e}function k0(t){if("string"!=typeof t)throw new Error("hex string expected, got "+typeof t);return""===t?rf:BigInt("0x"+t)}function Fc(t){return k0(Ki(t))}function Wc(t){return Rr(t),k0(Ki(Uint8Array.from(t).reverse()))}function of(t,e){return Nc(t.toString(16).padStart(2*e,"0"))}function af(t,e){return of(t,e).reverse()}function Kn(t,e,n){let r;if("string"==typeof e)try{r=Nc(e)}catch(i){throw new Error(t+" must be hex string or Uint8Array, cause: "+i)}else{if(!Tc(e))throw new Error(t+" must be hex string or Uint8Array");r=Uint8Array.from(e)}const s=r.length;if("number"==typeof n&&s!==n)throw new Error(t+" of length "+n+" expected, got "+s);return r}const cf=t=>"bigint"==typeof t&&rf<=t;function lf(t,e,n,r){if(!function k2(t,e,n){return cf(t)&&cf(e)&&cf(n)&&e<=t&&t<n}(e,n,r))throw new Error("expected valid "+t+": "+n+" <= n < "+r+", got "+e)}function M0(t){let e;for(e=0;t>rf;t>>=sf,e+=1);return e}const ia=t=>(sf<<BigInt(t))-sf;function jc(t,e,n={}){if(!t||"object"!=typeof t)throw new Error("expected valid options object");function r(s,i,o){const a=t[s];if(o&&void 0===a)return;const c=typeof a;if(c!==i||null===a)throw new Error(`param "${s}
193" is invalid: expected ${i}, got ${c}`)}Object.entries(e).forEach(([s,i])=>r(s,i,!1)),Object.entries(n).forEach(([s,i])=>r(s,i,!0))}function B0(t){const e=new WeakMap;return(n,...r)=>{const s=e.get(n);if(void 0!==s)return s;const i=t(n,...r);return e.set(n,i),i}}const ir=BigInt(0),Zn=BigInt(1),gi=BigInt(2),L0=BigInt(3),F0=BigInt(4),W0=BigInt(5),B2=BigInt(7),j0=BigInt(8),L2=BigInt(9),$0=BigInt(16);function pr(t,e){const n=t%e;return n>=ir?n:e+n}function Dr(t,e,n){let r=t;for(;e-- >ir;)r*=r,r%=n;return r}function H0(t,e){if(t===ir)throw new Error("invert: expected non-zero number");if(e<=ir)throw new Error("invert: expected positive modulus, got "+e);let n=pr(t,e),r=e,s=ir,i=Zn;for(;n!==ir;){const a=r%n,c=s-i*(r/n);r=n,n=a,s=i,i=c}if(r!==Zn)throw new Error("invert: does not exist");return pr(s,e)}function uf(t,e,n){if(!t.eql(t.sqr(e),n))throw new Error("Cannot find square root")}function K0(t,e){const r=t.pow(e,(t.ORDER+Zn)/F0);return uf(t,r,e),r}function F2(t,e){const n=(t.ORDER-W0)/j0,r=t.mul(e,gi),s=t.pow(r,n),i=t.mul(e,s),o=t.mul(t.mul(i,gi),s),a=t.mul(i,t.sub(o,t.ONE));return uf(t,a,e),a}function z0(t){if(t<L0)throw new Error("sqrt is not defined for small field");let e=t-Zn,n=0;for(;e%gi===ir;)e/=gi,n++;let r=gi;const s=qs(t);for(;1===G0(s,r);)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(1===n)return K0;let i=s.pow(r,e);const o=(e+Zn)/gi;return function(a,c){if(a.is0(c))return c;if(1!==G0(a,c))throw new Error("Cannot find square root");let d=n,h=a.mul(a.ONE,i),b=a.pow(c,e),M=a.pow(c,o);for(;!a.eql(b,a.ONE);){if(a.is0(b))return a.ZERO;let J=1,te=a.sqr(b);for(;!a.eql(te,a.ONE);)if(J++,te=a.sqr(te),J===d)throw new Error("Cannot find square root");const re=Zn<<BigInt(d-J-1),ae=a.pow(h,re);d=J,h=a.sqr(ae),b=a.mul(b,h),M=a.mul(M,ae)}return M}}const $2=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function V0(t,e,n=!1){const r=new Array(e.length).fill(n?t.ZERO:void 0),s=e.reduce((o,a,c)=>t.is0(a)?o:(r[c]=o,t.mul(o,a)),t.ONE),i=t.inv(s);return e.reduceRight((o,a,c)=>t.is0(a)?o:(r[c]=t.mul(o,r[c]),t.mul(o,a)),i),r}function G0(t,e){const r=t.pow(e,(t.ORDER-Zn)/gi),s=t.eql(r,t.ONE),i=t.eql(r,t.ZERO),o=t.eql(r,t.neg(t.ONE));if(!s&&!i&&!o)throw new Error("invalid Legendre symbol result");return s?1:i?0:-1}function q0(t,e){void 0!==e&&ps(e);const n=void 0!==e?e:t.toString(2).length;return{nBitLength:n,nByteLength:Math.ceil(n/8)}}function qs(t,e,n=!1,r={}){if(t<=ir)throw new Error("invalid field: expected ORDER > 0, got "+t);let s,i,a,o=!1;if("object"==typeof e&&null!=e){if(r.sqrt||n)throw new Error("cannot specify opts in two arguments");e.BITS&&(s=e.BITS),e.sqrt&&(i=e.sqrt),"boolean"==typeof e.isLE&&(n=e.isLE),"boolean"==typeof e.modFromBytes&&(o=e.modFromBytes),a=e.allowedLengths}else"number"==typeof e&&(s=e),r.sqrt&&(i=r.sqrt);const{nBitLength:c,nByteLength:d}=q0(t,s);if(d>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let h;const b=Object.freeze({ORDER:t,isLE:n,BITS:c,BYTES:d,MASK:ia(c),ZERO:ir,ONE:Zn,allowedLengths:a,create:M=>pr(M,t),isValid:M=>{if("bigint"!=typeof M)throw new Error("invalid field element: expected bigint, got "+typeof M);return ir<=M&&M<t},is0:M=>M===ir,isValidNot0:M=>!b.is0(M)&&b.isValid(M),isOdd:M=>(M&Zn)===Zn,neg:M=>pr(-M,t),eql:(M,J)=>M===J,sqr:M=>pr(M*M,t),add:(M,J)=>pr(M+J,t),sub:(M,J)=>pr(M-J,t),mul:(M,J)=>pr(M*J,t),pow:(M,J)=>function K2(t,e,n){if(n<ir)throw new Error("invalid exponent, negatives unsupported");if(n===ir)return t.ONE;if(n===Zn)return e;let r=t.ONE,s=e;for(;n>ir;)n&Zn&&(r=t.mul(r,s)),s=t.sqr(s),n>>=Zn;return r}(b,M,J),div:(M,J)=>pr(M*H0(J,t),t),sqrN:M=>M*M,addN:(M,J)=>M+J,subN:(M,J)=>M-J,mulN:(M,J)=>M*J,inv:M=>H0(M,t),sqrt:i||(M=>(h||(h=function j2(t){return t%F0===L0?K0:t%j0===W0?F2:t%$0===L2?function W2(t){const e=qs(t),n=z0(t),r=n(e,e.neg(e.ONE)),s=n(e,r),i=n(e,e.neg(r)),o=(t+B2)/$0;return(a,c)=>{let d=a.pow(c,o),h=a.mul(d,r);const b=a.mul(d,s),M=a.mul(d,i),J=a.eql(a.sqr(h),c),te=a.eql(a.sqr(b),c);d=a.cmov(d,h,J),h=a.cmov(M,b,te);const re=a.eql(a.sqr(h),c),ae=a.cmov(d,h,re);return uf(a,ae,c),ae}}(t):z0(t)}(t)),h(b,M))),toBytes:M=>n?af(M,d):of(M,d),fromBytes:(M,J=!0)=>
193{if(a){if(!a.includes(M.length)||M.length>d)throw new Error("Field.fromBytes: expected "+a+" bytes, got "+M.length);const re=new Uint8Array(d);re.set(M,n?0:re.length-M.length),M=re}if(M.length!==d)throw new Error("Field.fromBytes: expected "+d+" bytes, got "+M.length);let te=n?Wc(M):Fc(M);if(o&&(te=pr(te,t)),!J&&!b.isValid(te))throw new Error("invalid field element: outside of range 0..ORDER");return te},invertBatch:M=>V0(b,M),cmov:(M,J,te)=>te?J:M});return Object.freeze(b)}function Y0(t){if("bigint"!=typeof t)throw new Error("field order must be bigint");const e=t.toString(2).length;return Math.ceil(e/8)}function Z0(t){const e=Y0(t);return e+Math.ceil(e/2)}const Gi=BigInt(0),mi=BigInt(1);function $c(t,e){const n=e.negate();return t?n:e}function df(t,e){const n=V0(t.Fp,e.map(r=>r.Z));return e.map((r,s)=>t.fromAffine(r.toAffine(n[s])))}function J0(t,e){if(!Number.isSafeInteger(t)||t<=0||t>e)throw new Error("invalid window size, expected [1.."+e+"], got W="+t)}function ff(t,e){J0(t,e);const s=2**t;return{windows:Math.ceil(e/t)+1,windowSize:2**(t-1),mask:ia(t),maxNumber:s,shiftBy:BigInt(t)}}function X0(t,e,n){const{windowSize:r,mask:s,maxNumber:i,shiftBy:o}=n;let a=Number(t&s),c=t>>o;a>r&&(a-=i,c+=mi);const d=e*r;return{nextN:c,offset:d+Math.abs(a)-1,isZero:0===a,isNeg:a<0,isNegF:e%2!=0,offsetF:d}}const hf=new WeakMap,Q0=new WeakMap;function pf(t){return Q0.get(t)||1}function ey(t){if(t!==Gi)throw new Error("invalid wNAF")}class q2{constructor(e,n){this.BASE=e.BASE,this.ZERO=e.ZERO,this.Fn=e.Fn,this.bits=n}_unsafeLadder(e,n,r=this.ZERO){let s=e;for(;n>Gi;)n&mi&&(r=r.add(s)),s=s.double(),n>>=mi;return r}precomputeWindow(e,n){const{windows:r,windowSize:s}=ff(n,this.bits),i=[];let o=e,a=o;for(let c=0;c<r;c++){a=o,i.push(a);for(let d=1;d<s;d++)a=a.add(o),i.push(a);o=a.double()}return i}wNAF(e,n,r){if(!this.Fn.isValid(r))throw new Error("invalid scalar");let s=this.ZERO,i=this.BASE;const o=ff(e,this.bits);for(let a=0;a<o.windows;a++){const{nextN:c,offset:d,isZero:h,isNeg:b,isNegF:M,offsetF:J}=X0(r,a,o);r=c,h?i=i.add($c(M,n[J])):s=s.add($c(b,n[d]))}return ey(r),{p:s,f:i}}wNAFUnsafe(e,n,r,s=this.ZERO){const i=ff(e,this.bits);for(let o=0;o<i.windows&&r!==Gi;o++){const{nextN:a,offset:c,isZero:d,isNeg:h}=X0(r,o,i);if(r=a,!d){const b=n[c];s=s.add(h?b.negate():b)}}return ey(r),s}getPrecomputes(e,n,r){let s=hf.get(n);return s||(s=this.precomputeWindow(n,e),1!==e&&("function"==typeof r&&(s=r(s)),hf.set(n,s))),s}cached(e,n,r){const s=pf(e);return this.wNAF(s,this.getPrecomputes(s,e,r),n)}unsafe(e,n,r,s){const i=pf(e);return 1===i?this._unsafeLadder(e,n,s):this.wNAFUnsafe(i,this.getPrecomputes(i,e,r),n,s)}createCache(e,n){J0(n,this.bits),Q0.set(e,n),hf.delete(e)}hasCache(e){return 1!==pf(e)}}function ty(t,e,n){if(e){if(e.ORDER!==t)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return function H2(t){jc(t,$2.reduce((r,s)=>(r[s]="function",r),{ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"}))}(e),e}return qs(t,{isLE:n})}BigInt(0),BigInt(1),BigInt(2),BigInt(8),e0("HashToScalar-");const oa=BigInt(0),qi=BigInt(1),Hc=BigInt(2);const eT=BigInt(1),ny=BigInt(2),tT=BigInt(3),nT=BigInt(5),ry=(BigInt(8),BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffed"));function oT(t){return t[0]&=248,t[31]&=127,t[31]|=64,t}const aT=qs([ry,BigInt("0x1000000000000000000000000000000014def9dea2f79cd65812631a5cf5d3ed"),BigInt("0x7fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffec"),BigInt("0x52036cee2b6ffe738cc740797779e89800700a4d4141d8ab75eb4dca135978a3"),BigInt("0x216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a"),BigInt("0x6666666666666666666666666666666666666666666666666666666666666658")][0],{isLE:!0}),gf=(()=>{const t=aT.ORDER;return function Q2(t){const e=function X2(t){return jc(t,{adjustScalarBytes:"function",powPminus2:"function"}),Object.freeze({...t})}(t),{P:n,type:r,adjustScalarBytes:s,powPminus2:i,randomBytes:o}=e,a="x25519"===r;if(!a&&"x448"!==r)throw new Error("invalid type");const c=o||fi,d=a?255:448,h=a?32:56,b=BigInt(a?9:5),M=BigInt(a?121665:39081),J=a?Hc**BigInt(254):Hc**BigInt(447),te=a?BigInt(8)*Hc**BigInt(251)-qi:BigInt(4)*Hc**BigInt(445)-qi,re=J+te+qi,ae=Me=>pr(Me,n),ye=Se(b);function Se(Me){return af(ae(Me),h)}function Ce(Me,Ee){const Ne=function Fe(Me,Ee){lf("u",Me,oa,n),lf("scalar",Ee,J,re);const Ne=Ee,le=Me;let ue=qi,be=oa,Re=Me,we=qi,De=oa;for(let ze=BigInt(d-1);ze>=oa;ze--){const ot=Ne>>ze&qi;De^=ot,({x_2:ue,x_3:Re}=Be(De,ue,Re)),({x_2:be,x_3:we}=Be(De,be,we)),De=ot;const mt=ue+be,st=ae(mt*mt),It=ue-be,St=ae(It*It),Wt=st-St,Ot=Re+we,ln=ae((Re-we)*mt),fn=ae(Ot*It),vn=ln+fn,Xn=ln-fn;Re=ae(vn*vn),we=ae(le*ae(Xn*Xn)),ue=ae(st*St),be=ae(Wt*(st+ae(M*Wt)))}({x_2:ue,x_3:Re}=Be(De,ue,Re)),({x_2:be,x_3:we}=Be(De,be,we));const je=i(be);return ae(ue*je)}(function oe(Me){const Ee=Kn("u coordinate",Me,h);return a&&(Ee[31]&=127),ae(Wc(Ee))}(Ee),function pe(Me){return Wc(s(Kn("scalar",Me,h)))}(Me));
193if(Ne===oa)throw new Error("invalid private or public key received");return Se(Ne)}function ke(Me){return Ce(Me,ye)}function Be(Me,Ee,Ne){const le=ae(Me*(Ee-Ne));return{x_2:Ee=ae(Ee-le),x_3:Ne=ae(Ne+le)}}const Pe={secretKey:h,publicKey:h,seed:h},Ze=(Me=c(h))=>(Rr(Me,Pe.seed),Me);return{keygen:function He(Me){const Ee=Ze(Me);return{secretKey:Ee,publicKey:ke(Ee)}},getSharedSecret:(Me,Ee)=>Ce(Me,Ee),getPublicKey:Me=>ke(Me),scalarMult:Ce,scalarMultBase:ke,utils:{randomSecretKey:Ze,randomPrivateKey:Ze},GuBytes:ye.slice(),lengths:Pe}}({P:t,type:"x25519",powPminus2:e=>{const{pow_p_5_8:n,b2:r}=function iT(t){const e=BigInt(10),n=BigInt(20),r=BigInt(40),s=BigInt(80),i=ry,o=t*t%i*t%i,a=Dr(o,ny,i)*o%i,c=Dr(a,eT,i)*t%i,d=Dr(c,nT,i)*c%i,h=Dr(d,e,i)*d%i,b=Dr(h,n,i)*h%i,M=Dr(b,r,i)*b%i,J=Dr(M,s,i)*M%i,te=Dr(J,s,i)*M%i,re=Dr(te,e,i)*d%i;return{pow_p_5_8:Dr(re,ny,i)*t%i,b2:o}}(e);return pr(Dr(n,tT,t)*r,t)},adjustScalarBytes:oT})})(),sy=(t,e)=>(t+(t>=0?e:-e)/iy)/e;function mf(t){if(!["compact","recovered","der"].includes(t))throw new Error('Signature format must be "compact", "recovered", or "der"');return t}function yf(t,e){const n={};for(let r of Object.keys(e))n[r]=void 0===t[r]?e[r]:t[r];return Bc(n.lowS,"lowS"),Bc(n.prehash,"prehash"),void 0!==n.format&&mf(n.format),n}class lT extends Error{constructor(e=""){super(e)}}const _s={Err:lT,_tlv:{encode:(t,e)=>{const{Err:n}=_s;if(t<0||t>256)throw new n("tlv.encode: wrong tag");if(1&e.length)throw new n("tlv.encode: unpadded data");const r=e.length/2,s=Lc(r);if(s.length/2&128)throw new n("tlv.encode: long form length too big");const i=r>127?Lc(s.length/2|128):"";return Lc(t)+i+s+e},decode(t,e){const{Err:n}=_s;let r=0;if(t<0||t>256)throw new n("tlv.encode: wrong tag");if(e.length<2||e[r++]!==t)throw new n("tlv.decode: wrong tlv");const s=e[r++];let o=0;if(128&s){const c=127&s;if(!c)throw new n("tlv.decode(long): indefinite length not supported");if(c>4)throw new n("tlv.decode(long): byte length is too big");const d=e.subarray(r,r+c);if(d.length!==c)throw new n("tlv.decode: length bytes not complete");if(0===d[0])throw new n("tlv.decode(long): zero leftmost byte");for(const h of d)o=o<<8|h;if(r+=c,o<128)throw new n("tlv.decode(long): not minimal encoding")}else o=s;const a=e.subarray(r,r+o);if(a.length!==o)throw new n("tlv.decode: wrong value length");return{v:a,l:e.subarray(r+o)}}},_int:{encode(t){const{Err:e}=_s;if(t<Es)throw new e("integer: negative integers are not allowed");let n=Lc(t);if(8&Number.parseInt(n[0],16)&&(n="00"+n),1&n.length)throw new e("unexpected DER parsing assertion: unpadded hex");return n},decode(t){const{Err:e}=_s;if(128&t[0])throw new e("invalid signature integer: negative");if(0===t[0]&&!(128&t[1]))throw new e("invalid signature integer: unnecessary leading zero");return Fc(t)}},toSig(t){const{Err:e,_int:n,_tlv:r}=_s,s=Kn("signature",t),{v:i,l:o}=r.decode(48,s);if(o.length)throw new e("invalid signature: left bytes after parsing");const{v:a,l:c}=r.decode(2,i),{v:d,l:h}=r.decode(2,c);if(h.length)throw new e("invalid signature: left bytes after parsing");return{r:n.decode(a),s:n.decode(d)}},hexFromSig(t){const{_tlv:e,_int:n}=_s,r=e.encode(2,n.encode(t.r)),s=e.encode(2,n.encode(t.s));return e.encode(48,r+s)}},Es=BigInt(0),Yi=BigInt(1),iy=BigInt(2),Kc=BigInt(3),uT=BigInt(4);function Zi(t,e){const{BYTES:n}=t;let r;if("bigint"==typeof e)r=e;else{let s=Kn("private key",e);try{r=t.fromBytes(s)}catch{throw new Error(`invalid private key: expected ui8a of size ${n}, got ${typeof e}`)}}if(!t.isValidNot0(r))throw new Error("invalid private key: out of range [1..N-1]");return r}function dT(t,e={}){const n=function J2(t,e,n={},r){if(void 0===r&&(r="edwards"===t),!e||"object"!=typeof e)throw new Error(`expected valid ${t} CURVE object`);for(const a of["p","n","h"]){const c=e[a];if(!("bigint"==typeof c&&c>Gi))throw new Error(`CURVE.${a} must be positive bigint`)}const s=ty(e.p,n.Fp,r),i=ty(e.n,n.Fn,r),o=["Gx","Gy","a","weierstrass"===t?"b":"d"];for(const a of o)if(!s.isValid(e[a]))throw new Error(`CURVE.${a} must be valid field element of CURVE.Fp`);return{CURVE:e=Object.freeze(Object.assign({},e)),Fp:s,Fn:i}}("weierstrass",t,e),{Fp:r,Fn:s}=n;let i=n.CURVE;const{h:o,n:a}=i;jc(e,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});
193const{endo:c}=e;if(c&&(!r.is0(i.a)||"bigint"!=typeof c.beta||!Array.isArray(c.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const d=ay(r,s);function h(){if(!r.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}const J=e.toBytes||function b(Me,Ee,Ne){const{x:le,y:ue}=Ee.toAffine(),be=r.toBytes(le);return Bc(Ne,"isCompressed"),Ne?(h(),Ws(oy(!r.isOdd(ue)),be)):Ws(Uint8Array.of(4),be,r.toBytes(ue))},te=e.fromBytes||function M(Me){pi(Me,void 0,"Point");const{publicKey:Ee,publicKeyUncompressed:Ne}=d,le=Me.length,ue=Me[0],be=Me.subarray(1);if(le!==Ee||2!==ue&&3!==ue){if(le===Ne&&4===ue){const Re=r.BYTES,we=r.fromBytes(be.subarray(0,Re)),De=r.fromBytes(be.subarray(Re,2*Re));if(!ae(we,De))throw new Error("bad point: is not on curve");return{x:we,y:De}}throw new Error(`bad point: got length ${le}, expected compressed=${Ee} or uncompressed=${Ne}`)}{const Re=r.fromBytes(be);if(!r.isValid(Re))throw new Error("bad point: is not on curve, wrong x");const we=re(Re);let De;try{De=r.sqrt(we)}catch(ze){const ot=ze instanceof Error?": "+ze.message:"";throw new Error("bad point: is not on curve, sqrt error"+ot)}return h(),!(1&~ue)!==r.isOdd(De)&&(De=r.neg(De)),{x:Re,y:De}}};function re(Me){const Ee=r.sqr(Me),Ne=r.mul(Ee,Me);return r.add(r.add(Ne,r.mul(Me,i.a)),i.b)}function ae(Me,Ee){const Ne=r.sqr(Ee),le=re(Me);return r.eql(Ne,le)}if(!ae(i.Gx,i.Gy))throw new Error("bad curve params: generator point");const ye=r.mul(r.pow(i.a,Kc),uT),Se=r.mul(r.sqr(i.b),BigInt(27));if(r.is0(r.add(ye,Se)))throw new Error("bad curve params: a or b");function oe(Me,Ee,Ne=!1){if(!r.isValid(Ee)||Ne&&r.is0(Ee))throw new Error(`bad point coordinate ${Me}`);return Ee}function pe(Me){if(!(Me instanceof Pe))throw new Error("ProjectivePoint expected")}function Ce(Me){if(!c||!c.basises)throw new Error("no endo");return function cT(t,e,n){const[[r,s],[i,o]]=e,a=sy(o*t,n),c=sy(-s*t,n);let d=t-a*r-c*i,h=-a*s-c*o;const b=d<Es,M=h<Es;b&&(d=-d),M&&(h=-h);const J=ia(Math.ceil(M0(n)/2))+Yi;if(d<Es||d>=J||h<Es||h>=J)throw new Error("splitScalar (endomorphism): failed, k="+t);return{k1neg:b,k1:d,k2neg:M,k2:h}}(Me,c.basises,s.ORDER)}const ke=B0((Me,Ee)=>{const{X:Ne,Y:le,Z:ue}=Me;if(r.eql(ue,r.ONE))return{x:Ne,y:le};const be=Me.is0();null==Ee&&(Ee=be?r.ONE:r.inv(ue));const Re=r.mul(Ne,Ee),we=r.mul(le,Ee),De=r.mul(ue,Ee);if(be)return{x:r.ZERO,y:r.ZERO};if(!r.eql(De,r.ONE))throw new Error("invZ was invalid");return{x:Re,y:we}}),Be=B0(Me=>{if(Me.is0()){if(e.allowInfinityPoint&&!r.is0(Me.Y))return;throw new Error("bad point: ZERO")}const{x:Ee,y:Ne}=Me.toAffine();if(!r.isValid(Ee)||!r.isValid(Ne))throw new Error("bad point: x or y not field elements");if(!ae(Ee,Ne))throw new Error("bad point: equation left != right");if(!Me.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function Fe(Me,Ee,Ne,le,ue){return Ne=new Pe(r.mul(Ne.X,Me),Ne.Y,Ne.Z),Ee=$c(le,Ee),Ne=$c(ue,Ne),Ee.add(Ne)}class Pe{constructor(Ee,Ne,le){this.X=oe("x",Ee),this.Y=oe("y",Ne,!0),this.Z=oe("z",le),Object.freeze(this)}static CURVE(){return i}static fromAffine(Ee){const{x:Ne,y:le}=Ee||{};if(!Ee||!r.isValid(Ne)||!r.isValid(le))throw new Error("invalid affine point");if(Ee instanceof Pe)throw new Error("projective point not allowed");return r.is0(Ne)&&r.is0(le)?Pe.ZERO:new Pe(Ne,le,r.ONE)}static fromBytes(Ee){const Ne=Pe.fromAffine(te(pi(Ee,void 0,"point")));return Ne.assertValidity(),Ne}static fromHex(Ee){return Pe.fromBytes(Kn("pointHex",Ee))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(Ee=8,Ne=!0){return He.createCache(this,Ee),Ne||this.multiply(Kc),this}assertValidity(){Be(this)}hasEvenY(){const{y:Ee}=this.toAffine();if(!r.isOdd)throw new Error("Field doesn't support isOdd");return!r.isOdd(Ee)}equals(Ee){pe(Ee);const{X:Ne,Y:le,Z:ue}=this,{X:be,Y:Re,Z:we}=Ee,De=r.eql(r.mul(Ne,we),r.mul(be,ue)),je=r.eql(r.mul(le,we),r.mul(Re,ue));return De&&je}negate(){return new Pe(this.X,r.neg(this.Y),this.Z)}double(){const{a:Ee,b:Ne}=i,le=r.mul(Ne,Kc),{X:ue,Y:be,Z:Re}=this;let we=r.ZERO,De=r.ZERO,je=r.ZERO,ze=r.mul(ue,ue),ot=r.mul(be,be),mt=r.mul(Re,Re),st=r.mul(ue,be);return st=r.add(st,st),je=r.mul(ue,Re),je=r.add(je,je),we=r.mul(Ee,je),De=r.mul(le,mt),De=r.add(we,De),we=r.sub(ot,De),De=r.add(ot,De),De=r.mul(we,De),we=r.mul(st,we),je=r.mul(le,je),mt=r.mul(Ee,mt),st=r.sub(ze,mt),st=r.mul(Ee,st),st=r.add(st,je),je=r.add(ze,ze),ze=r.add(je,ze),ze=r.add(ze,mt),ze=r.mul(ze,st),De=r.add(De,ze),mt=r.mul(be,Re),mt=r.add(mt,mt),ze=r.mul(mt,st),we=r.sub(we,ze),je=r.mul(mt,ot),je=r.add(je,je),je=r.add(je,je),new Pe(we,De,je)}add(Ee){pe(Ee);const{X:Ne,Y:le,Z:ue}=this,{X:be,Y:Re,Z:we}=Ee;let De=r.ZERO,je=r.ZERO,ze=r.ZERO;const ot=i.a,mt=r.mul(i.b,Kc);let st=r.mul(Ne,be),It=r.mul(le,Re),St=r.mul(ue,we),Wt=r.add(Ne,le),Ot=r.add(be,Re);Wt=r.mul(Wt,Ot),Ot=r.add(st,It),Wt=r.sub(Wt,Ot),Ot=r.add(Ne,ue);let Lt=r.add(be,we);return Ot=r.mul(Ot,Lt),Lt=r.add(st,St),Ot=r.sub(Ot,Lt),Lt=r.add(le,ue),De=r.add(Re,we),Lt=r.mul(Lt,De),De=r.add(It,St),Lt=r.sub(Lt,De),ze=r.mul(ot,Ot),De=r.mul(mt,St),ze=r.add(De,ze),De=r.sub(
193It,ze),ze=r.add(It,ze),je=r.mul(De,ze),It=r.add(st,st),It=r.add(It,st),St=r.mul(ot,St),Ot=r.mul(mt,Ot),It=r.add(It,St),St=r.sub(st,St),St=r.mul(ot,St),Ot=r.add(Ot,St),st=r.mul(It,Ot),je=r.add(je,st),st=r.mul(Lt,Ot),De=r.mul(Wt,De),De=r.sub(De,st),st=r.mul(Wt,It),ze=r.mul(Lt,ze),ze=r.add(ze,st),new Pe(De,je,ze)}subtract(Ee){return this.add(Ee.negate())}is0(){return this.equals(Pe.ZERO)}multiply(Ee){const{endo:Ne}=e;if(!s.isValidNot0(Ee))throw new Error("invalid scalar: out of range");let le,ue;const be=Re=>He.cached(this,Re,we=>df(Pe,we));if(Ne){const{k1neg:Re,k1:we,k2neg:De,k2:je}=Ce(Ee),{p:ze,f:ot}=be(we),{p:mt,f:st}=be(je);ue=ot.add(st),le=Fe(Ne.beta,ze,mt,Re,De)}else{const{p:Re,f:we}=be(Ee);le=Re,ue=we}return df(Pe,[le,ue])[0]}multiplyUnsafe(Ee){const{endo:Ne}=e,le=this;if(!s.isValid(Ee))throw new Error("invalid scalar: out of range");if(Ee===Es||le.is0())return Pe.ZERO;if(Ee===Yi)return le;if(He.hasCache(this))return this.multiply(Ee);if(Ne){const{k1neg:ue,k1:be,k2neg:Re,k2:we}=Ce(Ee),{p1:De,p2:je}=function Y2(t,e,n,r){let s=e,i=t.ZERO,o=t.ZERO;for(;n>Gi||r>Gi;)n&mi&&(i=i.add(s)),r&mi&&(o=o.add(s)),s=s.double(),n>>=mi,r>>=mi;return{p1:i,p2:o}}(Pe,le,be,we);return Fe(Ne.beta,De,je,ue,Re)}return He.unsafe(le,Ee)}multiplyAndAddUnsafe(Ee,Ne,le){const ue=this.multiplyUnsafe(Ne).add(Ee.multiplyUnsafe(le));return ue.is0()?void 0:ue}toAffine(Ee){return ke(this,Ee)}isTorsionFree(){const{isTorsionFree:Ee}=e;return o===Yi||(Ee?Ee(Pe,this):He.unsafe(this,a).is0())}clearCofactor(){const{clearCofactor:Ee}=e;return o===Yi?this:Ee?Ee(Pe,this):this.multiplyUnsafe(o)}isSmallOrder(){return this.multiplyUnsafe(o).is0()}toBytes(Ee=!0){return Bc(Ee,"isCompressed"),this.assertValidity(),J(Pe,this,Ee)}toHex(Ee=!0){return Ki(this.toBytes(Ee))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(Ee=!0){return this.toBytes(Ee)}_setWindowSize(Ee){this.precompute(Ee)}static normalizeZ(Ee){return df(Pe,Ee)}static msm(Ee,Ne){return function Z2(t,e,n,r){(function V2(t,e){if(!Array.isArray(t))throw new Error("array expected");t.forEach((n,r)=>{if(!(n instanceof e))throw new Error("invalid point at index "+r)})})(n,t),function G2(t,e){if(!Array.isArray(t))throw new Error("array of scalars expected");t.forEach((n,r)=>{if(!e.isValid(n))throw new Error("invalid scalar at index "+r)})}(r,e);const s=n.length,i=r.length;if(s!==i)throw new Error("arrays of points and scalars must have equal length");const o=t.ZERO,a=M0(BigInt(s));let c=1;a>12?c=a-3:a>4?c=a-2:a>0&&(c=2);const d=ia(c),h=new Array(Number(d)+1).fill(o);let M=o;for(let J=Math.floor((e.BITS-1)/c)*c;J>=0;J-=c){h.fill(o);for(let re=0;re<i;re++){const ye=Number(r[re]>>BigInt(J)&d);h[ye]=h[ye].add(n[re])}let te=o;for(let re=h.length-1,ae=o;re>0;re--)ae=ae.add(h[re]),te=te.add(ae);if(M=M.add(te),0!==J)for(let re=0;re<c;re++)M=M.double()}return M}(Pe,s,Ee,Ne)}static fromPrivateKey(Ee){return Pe.BASE.multiply(Zi(s,Ee))}}Pe.BASE=new Pe(i.Gx,i.Gy,r.ONE),Pe.ZERO=new Pe(r.ZERO,r.ONE,r.ZERO),Pe.Fp=r,Pe.Fn=s;const Ze=s.BITS,He=new q2(Pe,e.endo?Math.ceil(Ze/2):Ze);return Pe.BASE.precompute(8),Pe}function oy(t){return Uint8Array.of(t?2:3)}function ay(t,e){return{secretKey:e.BYTES,publicKey:1+t.BYTES,publicKeyUncompressed:1+2*t.BYTES,publicKeyHasPrefix:!0,signature:2*e.BYTES}}function hT(t,e,n={}){Oc(e),jc(n,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const r=n.randomBytes||fi,s=n.hmac||((Ne,...le)=>kc(e,Ne,Ws(...le))),{Fp:i,Fn:o}=t,{ORDER:a,BITS:c}=o,{keygen:d,getPublicKey:h,getSharedSecret:b,utils:M,lengths:J}=function fT(t,e={}){const{Fn:n}=t,r=e.randomBytes||fi,s=Object.assign(ay(t.Fp,n),{seed:Z0(n.ORDER)});function i(M){try{return!!Zi(n,M)}catch{return!1}}function a(M=r(s.seed)){return function z2(t,e,n=!1){const r=t.length,s=Y0(e),i=Z0(e);if(r<16||r<i||r>1024)throw new Error("expected "+i+"-1024 bytes of input, got "+r);const a=pr(n?Wc(t):Fc(t),e-Zn)+Zn;return n?af(a,s):of(a,s)}(pi(M,s.seed,"seed"),n.ORDER)}function c(M,J=!0){return t.BASE.multiply(Zi(n,M)).toBytes(J)}function h(M){if("bigint"==typeof M)return!1;if(M instanceof t)return!0;const{secretKey:J,publicKey:te,publicKeyUncompressed:re}=s;if(n.allowedLengths||J===te)return;const ae=Kn("key",M).length;return ae===te||ae===re}return Object.freeze({getPublicKey:c,getSharedSecret:function b(M,J,te=!0){if(!0===h(M))throw new Error("first arg must be private key");if(!1===h(J))throw new Error("second arg must be public key");const re=Zi(n,M);return t.fromHex(J).multiply(re).toBytes(te)},keygen:function d(M){const J=a(M);return{secretKey:J,publicKey:c(J)}},Point:t,utils:{isValidSecretKey:i,isValidPublicKey:function o(M,J){const{publicKey:te,publicKeyUncompressed:re}=s;try{const ae=M.length;return!(!0===J&&ae!==te||!1===J&&ae!==re||!t.fromBytes(M))}catch{return!1}},randomSecretKey:a,isValidPrivateKey:i,randomPrivateKey:a,normPrivateKeyToScalar:M=>Zi(n,M),precompute:(M=8,J=t.BASE)=>J.precompute(M,!1)},lengths:s})}(t,n),te={prehash:!1,lowS:"boolean"==typeof n.lowS&&n.lowS,format:void 0,extraEntropy:!1},re="compact";function ae(Ne){return Ne>a>>Yi}function ye(Ne,le){if(!o.isValidNot0(le))throw new Error(`invalid signature ${Ne}: out of range 1..Point.Fn.ORDER`);return le}class oe{constructor(le,ue,be){this.r=ye("r",le),this.s=ye("s",ue),null!=be&&(this.recovery=be),Object.freeze(this)}static fromBytes(le,ue=re){let be;if(function Se(Ne,le){mf(le);const ue=J.signature;pi(Ne,"compact"===le?ue:"recovered"===le?ue+1:void 0,`${le} signature`)}(le,ue),"der"===ue){const{r:je,s:ze}=_s.toSig(pi(le));return new oe(je,ze)}"recovered"===ue&&(be=le[0],ue="compact",le=le.subarray(1));const Re=o.BYTES,we=le.subarray(0,Re),De=le.subarray(Re,2*Re);return new oe(o.fromBytes(we),o.fromBytes(De),be)}static fromHex(le,ue){return this.fromBytes(Nc(le),ue)}addRecoveryBit(le){return new oe(this.r,this.s,le)}recoverPublicKey(le){const ue=i.ORDER,{r:be,s:Re,recovery:we}=this;if(null==we||![0,1,2,3].includes(we))throw new Error("recovery id invalid");if(a*iy<ue&&we>1)throw new Error("recovery id is ambiguous for h>1 curve");const De=2===we||3===we?be+a:be;if(!i.isValid(De))throw new Error("recovery id 2 or 3 invalid");const je=i.toBytes(De),ze=t.fromBytes(Ws(oy(!(1&we)),je)),ot=o.inv(De),mt=Ce(Kn("msgHash",le)),st=o.create(-mt*ot),It=o.create(Re*ot),St=t.BASE.multiplyUnsafe(st).add(ze.multiplyUnsafe(It));if(St.is0())throw new Error("point at infinify");return St.assertValidity(),St}hasHighS(){return ae(this.s)}toBytes(le=re){if(mf(le),"der"===le)return Nc(_s.hexFromSig(this));const ue=o.toBytes(this.r),be=o.toBytes(this.s);if("recovered"===le){if(null==this.recovery)throw new Error("recovery bit must be present");return Ws(Uint8Array.of(this.recovery),ue,be)}return Ws(ue,be)}toHex(le){return Ki(this.toBytes(le))}assertValidity(){}static fromCompact(le){return oe.fromBytes(Kn("sig",le),"compact")}static fromDER(le){return oe.fromBytes(Kn("sig",le),"der")}normalizeS(){return this.hasHighS()?new oe(this.r,o.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return Ki(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return Ki(this.toBytes("compact"))}}const pe=n.bits2int||function(Ne){if(Ne.length>8192)throw new Error("input is too large");const le=Fc(Ne),ue=8*Ne.length-c;return ue>0?le>>BigInt(ue):le},Ce=n.bits2int_modN||function(Ne){return o.create(pe(Ne))},ke=ia(c);function Be(Ne){return lf("num < 2^"+c,Ne,Es,ke),o.toBytes(Ne)}function Fe(Ne,le){return pi(Ne,void 0,"message"),le?pi(e(Ne),void 0,"prehashed message"):Ne}return Object.freeze({keygen:d,getPublicKey:h,getSharedSecret:b,utils:M,lengths:J,Point:t,sign:function Ze(Ne,le,ue={}){Ne=Kn("message",Ne);const{seed:be,k2sig:Re}=function Pe(Ne,le,ue){if(["recovered","canonical"].some(It=>It in ue))throw new Error("sign() legacy options not supported");const{lowS:be,prehash:Re,extraEntropy:we}=yf(ue,te);Ne=Fe(Ne,Re);const De=Ce(Ne),je=Zi(o,le),ze=[Be(je),Be(De)];if(null!=we&&!1!==we){const It=!0===we?r(J.secretKey):we;ze.push(Kn("extraEntropy",It))}const ot=Ws(...ze),mt=De;return{seed:ot,k2sig:function st(It){const St=pe(It);if(!o.isValidNot0(St))return;const Wt=o.inv(St),Ot=t.BASE.multiply(St).toAffine(),Lt=o.create(Ot.x);if(Lt===Es)return;const ln=o.create(Wt*o.create(mt+Lt*je));if(ln===Es)return;let fn=(Ot.x===Lt?0:2)|Number(Ot.y&Yi),vn=ln;return be&&ae(ln)&&(vn=o.neg(ln),fn^=1),new oe(Lt,vn,fn)}}}(Ne,le,ue);return function M2(t,e,n){if("number"!=typeof t||t<2)throw new Error("hashLen must be a number");if("number"!=typeof e||e<2)throw new Error("qByteLen must be a number");if("function"!=typeof n)throw new Error("hmacFn must be a function");const r=M=>new Uint8Array(M),s=M=>Uint8Array.of(M);let i=r(t),o=r(t),a=0;const c=()=>{i.fill(1),o.fill(0),a=0},d=(...M)=>n(o,i,...M),h=(M=r(0))=>{o=d(s(0),M),i=d(),0!==M.length&&(o=d(s(1),M),i=d())},b=()=>{if(a++>=1e3)throw new Error("drbg: tried 1000 values");let M=0;const J=[];for(;M<e;){i=d();const te=i.slice();J.push(te),M+=i.length}return Ws(...J)};return(M,J)=>{let te;for(c(),h(M);!(te=J(b()));)h();return c(),te}}(e.outputLen,o.BYTES,s)(be,Re)},verify:function Me(Ne,le,ue,be={}){const{lowS:Re,prehash:we,format:De}=yf(be,te);if(ue=Kn("publicKey",ue),le=Fe(Kn("message",le),we),"strict"in be)throw new Error("options.strict was renamed to lowS");const je=void 0===De?function He(Ne){let le;const ue="string"==typeof Ne||Tc(Ne),be=!ue&&null!==Ne&&"object"==typeof Ne&&"bigint"==typeof Ne.r&&"bigint"==typeof Ne.s;if(!ue&&!be)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");
193if(be)le=new oe(Ne.r,Ne.s);else if(ue){try{le=oe.fromBytes(Kn("sig",Ne),"der")}catch(Re){if(!(Re instanceof _s.Err))throw Re}if(!le)try{le=oe.fromBytes(Kn("sig",Ne),"compact")}catch{return!1}}return le||!1}(Ne):oe.fromBytes(Kn("sig",Ne),De);if(!1===je)return!1;try{const ze=t.fromBytes(ue);if(Re&&je.hasHighS())return!1;const{r:ot,s:mt}=je,st=Ce(le),It=o.inv(mt),St=o.create(st*It),Wt=o.create(ot*It),Ot=t.BASE.multiplyUnsafe(St).add(ze.multiplyUnsafe(Wt));return!Ot.is0()&&o.create(Ot.x)===ot}catch{return!1}},recoverPublicKey:function Ee(Ne,le,ue={}){const{prehash:be}=yf(ue,te);return le=Fe(le,be),oe.fromBytes(Ne,"recovered").recoverPublicKey(le).toBytes()},Signature:oe,hash:e})}function yT(t){const{CURVE:e,curveOpts:n,hash:r,ecdsaOpts:s}=function gT(t){const{CURVE:e,curveOpts:n}=function pT(t){const e={a:t.a,b:t.b,p:t.Fp.ORDER,n:t.n,h:t.h,Gx:t.Gx,Gy:t.Gy},n=t.Fp;let r=t.allowedPrivateKeyLengths?Array.from(new Set(t.allowedPrivateKeyLengths.map(o=>Math.ceil(o/2)))):void 0;return{CURVE:e,curveOpts:{Fp:n,Fn:qs(e.n,{BITS:t.nBitLength,allowedLengths:r,modFromBytes:t.wrapPrivateKey}),allowInfinityPoint:t.allowInfinityPoint,endo:t.endo,isTorsionFree:t.isTorsionFree,clearCofactor:t.clearCofactor,fromBytes:t.fromBytes,toBytes:t.toBytes}}}(t);return{CURVE:e,curveOpts:n,hash:t.hash,ecdsaOpts:{hmac:t.hmac,randomBytes:t.randomBytes,lowS:t.lowS,bits2int:t.bits2int,bits2int_modN:t.bits2int_modN}}}(t);return function mT(t,e){const n=e.Point;return Object.assign({},e,{ProjectivePoint:n,CURVE:Object.assign({},t,q0(n.Fn.ORDER,n.Fn.BITS))})}(t,hT(dT(e,n),r,s))}function _f(t,e){const n=r=>yT({...t,hash:r});return{...n(e),create:n}}const cy={p:BigInt("0xffffffff00000001000000000000000000000000ffffffffffffffffffffffff"),n:BigInt("0xffffffff00000000ffffffffffffffffbce6faada7179e84f3b9cac2fc632551"),h:BigInt(1),a:BigInt("0xffffffff00000001000000000000000000000000fffffffffffffffffffffffc"),b:BigInt("0x5ac635d8aa3a93e7b3ebbd55769886bc651d06b0cc53b0f63bce3c3e27d2604b"),Gx:BigInt("0x6b17d1f2e12c4247f8bce6e563a440f277037d812deb33a0f4a13945d898c296"),Gy:BigInt("0x4fe342e2fe1a7f9b8ee7eb4a7c0f9e162bce33576b315ececbb6406837bf51f5")},ly={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000ffffffff"),n:BigInt("0xffffffffffffffffffffffffffffffffffffffffffffffffc7634d81f4372ddf581a0db248b0a77aecec196accc52973"),h:BigInt(1),a:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffeffffffff0000000000000000fffffffc"),b:BigInt("0xb3312fa7e23ee7e4988e056be3f82d19181d9c6efe8141120314088f5013875ac656398d8a2ed19d2a85c8edd3ec2aef"),Gx:BigInt("0xaa87ca22be8b05378eb1c71ef320ad746e1d3b628ba79b9859f741e082542a385502f25dbf55296c3a545e3872760ab7"),Gy:BigInt("0x3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f")},uy={p:BigInt("0x1ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),n:BigInt("0x01fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffa51868783bf2f966b7fcc0148f709a5d03bb5c9b8899c47aebb6fb71e91386409"),h:BigInt(1),a:BigInt("0x1fffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffc"),b:BigInt("0x0051953eb9618e1c9a1f929a21a0b68540eea2da725b99b315f3b8b489918ef109e156193951ec7e937b1652c0bd3bb1bf073573df883d2c34f1ef451fd46b503f00"),Gx:BigInt("0x00c6858e06b70404e9cd9e3ecb662395b4429c648139053fb521f828af606b4d3dbaa14b5e77efe75928fe1dc127a2ffa8de3348b3c1856a429bf97e7e31c2e5bd66"),Gy:BigInt("0x011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650")},_T=qs(cy.p),ET=qs(ly.p),vT=qs(uy.p),bT=_f({...cy,Fp:_T,lowS:!1},Rc);_f({...ly,Fp:ET,lowS:!1},IS),_f({...uy,Fp:vT,lowS:!1,allowedPrivateKeyLengths:[130,131,132]},AS);const wT=bT,Jn="base16",or="base64pad",Ys="base64url",aa="utf8";function vf(){return tr(fi(32),Jn)}function zc(t){return tr(Mc(vr(t,Jn)),Jn)}function wr(t){return tr(Mc(vr(t,aa)),Jn)}function py(t){return vr(`${t}`,"base10")}function yi(t){return Number(tr(t,"base10"))}function gy(t){return t.replace(/\+/g,"-").replace(/\//g,"_").replace(/=/g,"")}function my(t){const e=t.replace(/-/g,"+").replace(/_/g,"/");return e+"=".repeat((4-e.length%4)%4)}function yy(t){if(2===yi(t.type))return tr(Zo([t.type,t.sealed]),or);if(1===yi(t.type)){if(typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return tr(Zo([t.type,t.senderPublicKey,t.iv,t.sealed]),or)}return tr(Zo([t.type,t.iv,t.sealed]),or)}function ua(t){const n=vr((t.encoding||or)===Ys?my(t.encoded):t.encoded,or),r=n.slice(0,1);if(1===yi(r)){const c=33,d=c+12,h=n.slice(1,c),b=n.slice(c,d);return{type:r,sealed:n.slice(d),iv:b,senderPublicKey:h}}if(2===yi(r))return{type:r,sealed:n.slice(1),iv:fi(12)};const o=n.slice(1,13);return{type:r,sealed:n.slice(13),iv:o}}function _y(t){const e=t?.type||0;if(1===e){if(typeof t?.senderPublicKey>"u")throw new Error("missing sender public key");if(typeof t?.receiverPublicKey>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:t?.senderPublicKey,receiverPublicKey:t?.receiverPublicKey}}function Ey(t){return 1===t.type&&"string"==typeof t.senderPublicKey&&"string"==typeof t.receiverPublicKey}function vy(t){return 2===t.type}function Vc(t){return t?.relay||{protocol:"irn"}}function Ji(t){const e=oI[t];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${t}`);return e}var UT=Object.defineProperty,kT=Object.defineProperties,MT=Object.getOwnPropertyDescriptors,by=Object.getOwnPropertySymbols,BT=Object.prototype.hasOwnProperty,LT=Object.prototype.propertyIsEnumerable,wy=(t,e,n)=>e in t?UT(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,bf=(t,e)=>{for(var n in e||(e={}))BT.call(e,n)&&wy(t,n,e[n]);if(by)for(var n of by(e))LT.call(e,n)&&wy(t,n,e[n]);return t};function WT(t,e="-"){const n={},r="relay"+e;return Object.keys(t).forEach(s=>{if(s.startsWith(r)){const i=s.replace(r,"");n[i]=t[s]}}),n}function Cy(t){if(!t.includes("wc:")){const d=Km(t);null!=d&&d.includes("wc:")&&(t=d)}const e=(t=(t=t.includes("wc://")?t.replace("wc://",""):t).includes("wc:")?t.replace("wc:",""):t).indexOf(":"),n=-1!==t.indexOf("?")?t.indexOf("?"):void 0,r=t.substring(0,e),s=t.substring(e+1,n).split("@"),i=typeof n<"u"?t.substring(n):"",o=new URLSearchParams(i),a=Object.fromEntries(o.entries()),c="string"==typeof a.methods?a.methods.split(","):void 0;return{protocol:r,topic:jT(s[0]),version:parseInt(s[1],10),symKey:a.symKey,relay:WT(a),methods:c,expiryTimestamp:a.expiryTimestamp?parseInt(a.expiryTimestamp,10):void 0}}function jT(t){return t.startsWith("//")?t.substring(2):t}function Ay(t){const e=new URLSearchParams,n=bf(bf(((t,e)=>kT(t,MT(e)))(bf({},function $T(t,e="-"){const r={};return Object.keys(t).forEach(s=>{t[s]&&(r["relay"+e+s]=t[s])}),r}(t.relay)),{symKey:t.symKey}),t.expiryTimestamp&&{expiryTimestamp:t.expiryTimestamp.toString()}),t.methods&&{methods:t.methods.join(",")});return Object.entries(n).sort(([r],[s])=>
193r.localeCompare(s)).forEach(([r,s])=>{void 0!==s&&e.append(r,String(s))}),`${t.protocol}:${t.topic}@${t.version}?${e}`}function Gc(t,e,n){return`${t}?wc_ev=${n}&topic=${e}`}var HT=Object.defineProperty,KT=Object.defineProperties,zT=Object.getOwnPropertyDescriptors,Iy=Object.getOwnPropertySymbols,VT=Object.prototype.hasOwnProperty,GT=Object.prototype.propertyIsEnumerable,Sy=(t,e,n)=>e in t?HT(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,qT=(t,e)=>{for(var n in e||(e={}))VT.call(e,n)&&Sy(t,n,e[n]);if(Iy)for(var n of Iy(e))GT.call(e,n)&&Sy(t,n,e[n]);return t},YT=(t,e)=>KT(t,zT(e));function Xi(t){const e=[];return t.forEach(n=>{const[r,s]=n.split(":");e.push(`${r}:${s}`)}),e}function Ty(t){const e=[];return Object.values(t).forEach(n=>{e.push(...Xi(n.accounts))}),[...new Set(e)]}function qc(t){return t.includes(":")}function Qi(t){return qc(t)?t.split(":")[0]:t}function Yc(t){var e,n,r;const s={};if(!qr(t))return s;for(const[i,o]of Object.entries(t)){const a=qc(i)?[i]:o.chains,c=o.methods||[],d=o.events||[],h=Qi(i);s[h]=YT(qT({},s[h]),{chains:rr(a,null==(e=s[h])?void 0:e.chains),methods:rr(c,null==(n=s[h])?void 0:n.methods),events:rr(d,null==(r=s[h])?void 0:r.events)})}return s}function Oy(t,e){const n=function eO(t){const e={};return t?.forEach(n=>{var r;const[s,i]=n.split(":");e[s]||(e[s]={accounts:[],chains:[],events:[],methods:[]}),e[s].accounts.push(n),null==(r=e[s].chains)||r.push(`${s}:${i}`)}),e}(e=e.map(r=>r.replace("did:pkh:","")));for(const[r,s]of Object.entries(n))s.methods=s.methods?rr(s.methods,t):t,s.events=["chainChanged","accountsChanged"];return n}function bs(t,e){return!!Array.isArray(t)&&(!(typeof e<"u"&&t.length)||t.every(e))}function qr(t){return Object.getPrototypeOf(t)===Object.prototype&&Object.keys(t).length}function An(t){return typeof t>"u"}function _n(t,e){return!(!e||!An(t))||"string"==typeof t&&!!t.trim().length}function wf(t,e){return!(!e||!An(t))||"number"==typeof t&&!isNaN(t)}function Zc(t){return!(!_n(t,!1)||!t.includes(":"))&&2===t.split(":").length}function Ny(t){let e=!0;return bs(t)?t.length&&(e=t.every(n=>_n(n,!1))):e=!1,e}function xy(t,e){let n=null;return Object.values(t).forEach(r=>{if(n)return;const s=function fO(t,e){let n=null;return Ny(t?.methods)?Ny(t?.events)||(n=cn("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):n=cn("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),n}(r,`${e}, namespace`);s&&(n=s)}),n}function Jc(t,e){let n=null;if(t&&qr(t)){const r=xy(t,e);r&&(n=r);const s=function dO(t,e){let n=null;return Object.values(t).forEach(r=>{if(n)return;const s=function uO(t,e){let n=null;return bs(t)?t.forEach(r=>{n||function rO(t){if(_n(t,!1)&&t.includes(":")){const e=t.split(":");if(3===e.length)return!!e[2]&&Zc(e[0]+":"+e[1])}return!1}(r)||(n=cn("UNSUPPORTED_ACCOUNTS",`${e}, account ${r} should be a string and conform to "namespace:chainId:address" format`))}):n=cn("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),n}(r?.accounts,`${e} namespace`);s&&(n=s)}),n}(t,e);s&&(n=s)}else n=et("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return n}function Ry(t){return _n(t.protocol,!0)}function ar(t){return typeof t<"u"&&null!==typeof t}function Py(t,e){return!(!Zc(e)||!Ty(t).includes(e))}function Cf(t,e,n){let r=null;const s=function wO(t){const e={};return Object.keys(t).forEach(n=>{var r;n.includes(":")?e[n]=t[n]:null==(r=t[n].chains)||r.forEach(s=>{e[s]={methods:t[n].methods,events:t[n].events}})}),e}(t),i=function CO(t){const e={};return Object.keys(t).forEach(n=>{n.includes(":")?e[n]=t[n]:Xi(t[n].accounts)?.forEach(s=>{e[s]={accounts:t[n].accounts.filter(i=>i.includes(`${s}:`)),methods:t[n].methods,events:t[n].events}})}),e}(e),o=Object.keys(s),a=Object.keys(i),c=Dy(Object.keys(t)),d=Dy(Object.keys(e)),h=c.filter(b=>!d.includes(b));return h.length&&(r=et("NON_CONFORMING_NAMESPACES",`${n} namespaces keys don't satisfy requiredNamespaces.\n      Required: ${h.toString()}\n      Received: ${Object.keys(e).toString()}`)),ui(o,a)||(r=et("NON_CONFORMING_NAMESPACES",`${n} namespaces chains don't satisfy required namespaces.\n      Required: ${o.toString()}\n      Approved: ${a.toString()}`)),Object.keys(e).forEach(b=>{if(!b.includes(":")||r)return;const M=Xi(e[b].accounts);M.includes(b)||(r=et("NON_CONFORMING_NAMESPACES",`${n} namespaces accounts don't satisfy namespace accounts for ${b}\n        Required: ${b}\n        Approved: ${M.toString()}`))}),o.forEach(b=>{r||(ui(s[b].methods,i[b].methods)?ui(s[b].events,i[b].events)||(r=et("NON_CONFORMING_NAMESPACES",`${n} namespaces events don't satisfy namespace events for ${b}`)):r=et("NON_CONFORMING_NAMESPACES",`${n} namespaces methods don't satisfy namespace methods for ${b}`))}),r}function Dy(t){return[...new Set(t.map(e=>e.includes(":")?e.split(":")[0]:e))]}function Uy(){const t=$i();return new Promise(e=>{switch(t){case"browser":e(function IO(){return ji()&&navigator?.onLine}());break;case"react-native":e(function SO(){return Af.apply(this,arguments)}());break;default:e(!0)}})}function Af(){return(Af=(0,l.A)(function*(){return!(ks()&&typeof global<"u"&&null!=global&&global.NetInfo)||(yield null==global?void 0:global.NetInfo.fetch())?.isConnected})).apply(this,arguments)}const If={};class da{static get(e){return If[e]}static set(e,n){If[e]=n}static delete(e){delete If[e]}}function Sf(t){return new Uint8Array(t.replace(/^0x/,"").match(/.{1,2}/g).map(e=>parseInt(e,16)))}function FO(t){const e=Uint8Array.from(sn.from(t.signature,"hex")),n=function PO(t){const e=fs.decode(t);if(e.length<33)throw new Error("Too short to contain a public key");return e.slice(1,33)}(t.transaction.address),r=function DO({publicKey:t,signature:e,payload:n}){var r;const s=Sf(n.method),i=128|parseInt((null==(r=n.version)?void 0:r.toString())||"4"),o=function MO(t){const e=fs.decode(t)[0];return 42===e?0:60===e?2:1}(n.address),a="00"===n.era?new Uint8Array([0]):Sf(n.era);if(1!==a.length&&2!==a.length)throw new Error("Invalid era length");const c=parseInt(n.nonce,16),d=new Uint8Array([255&c,c>>8&255]),h=BigInt(`0x${function kO(t){return t.startsWith("0x")?t.slice(2):t}(n.tip)}`),b=function LO(t){if(t<BigInt(1)<<BigInt(6))return new Uint8Array([Number(t<<BigInt(2))]);if(t<BigInt(1)<<BigInt(14)){const e=t<<BigInt(2)|BigInt(1);return new Uint8Array([Number(e&BigInt(255)),Number(e>>BigInt(8)&BigInt(255))])}if(t<BigInt(1)<<BigInt(30)){const e=t<<BigInt(2)|BigInt(2);return new Uint8Array([Number(e&BigInt(255)),Number(e>>BigInt(8)&BigInt(255)),Number(e>>BigInt(16)&BigInt(255)),Number(e>>BigInt(24)&BigInt(255))])}throw new Error("BigInt compact encoding not supported > 2^30")}(h),M=new Uint8Array([0,...t,o,...e,...a,...d,...b,...s]),J=function BO(t){if(t<64)return new Uint8Array([t<<2]);if(t<16384){const e=t<<2|1;return new Uint8Array([255&e,e>>8&255])}if(t<1<<30){const e=t<<2|2;return new Uint8Array([255&e,e>>8&255,e>>16&255,e>>24&255])}throw new Error("Compact encoding > 2^30 not supported")}(M.length+1);return new Uint8Array([...J,i,...M])}({publicKey:n,signature:e,payload:t.transaction});return function UO(t){const e=Sf(t),n=(0,aI.blake2b)(e,void 0,32);return"0x"+sn.from(n).toString("hex")}(sn.from(r).toString("hex"))}function Tf({logger:t,name:e}){const n="string"==typeof t?(0,Ct.D5)({opts:{level:t,name:e}}).logger:t;return n.level="string"==typeof t?t:t.level,n}const WO="PARSE_ERROR",jO="INVALID_REQUEST",$O="METHOD_NOT_FOUND",HO="INVALID_PARAMS",ky="INTERNAL_ERROR",Of="SERVER_ERROR",KO=[-32700,-32600,-32601,-32602,-32603],fa={[WO]:{code:-32700,message:"Parse error"},[jO]:{code:-32600,message:"Invalid Request"},[$O]:{code:-32601,message:"Method not found"},[HO]:{code:-32602,message:"Invalid params"},[ky]:{code:-32603,message:"Internal error"},[Of]:{code:-32e3,message:"Server error"}},My=Of;function Fy(t){return Object.keys(fa).includes(t)?fa[t]:fa[My]}function jy(t,e,n){return t.message.includes("getaddrinfo ENOTFOUND")||t.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${n} RPC url at ${e}`):t}var qO=u(23601);
193function Yr(t=3){return Date.now()*Math.pow(10,t)+Math.floor(Math.random()*Math.pow(10,t))}function Zs(t=6){return BigInt(Yr(t))}function Ur(t,e,n){return{id:n||Yr(),jsonrpc:"2.0",method:t,params:e}}function ha(t,e){return{id:t,jsonrpc:"2.0",result:e}}function Xc(t,e,n){return{id:t,jsonrpc:"2.0",error:YO(e,n)}}function YO(t,e){return typeof t>"u"?Fy(ky):("string"==typeof t&&(t=Object.assign(Object.assign({},Fy(Of)),{message:t})),typeof e<"u"&&(t.data=e),function Ly(t){return KO.includes(t)}(t.code)&&(t=function Wy(t){const e=Object.values(fa).find(n=>n.code===t);return e||fa[My]}(t.code)),t)}class $y{}class ZO extends $y{constructor(){super()}}class JO extends ZO{constructor(e){super()}}function Hy(t,e){const n=function eN(t){const e=t.match(new RegExp(/^\w+:/,"gi"));if(e&&e.length)return e[0]}(t);return!(typeof n>"u")&&new RegExp(e).test(n)}function Ky(t){return Hy(t,"^https?:")}function zy(t){return Hy(t,"^wss?:")}function tN(t){return new RegExp("wss?://localhost(:d{2,5})?").test(t)}function Vy(t){return"object"==typeof t&&"id"in t&&"jsonrpc"in t&&"2.0"===t.jsonrpc}function Nf(t){return Vy(t)&&"method"in t}function Qc(t){return Vy(t)&&(Zr(t)||Cr(t))}function Zr(t){return"result"in t}function Cr(t){return"error"in t}class xf extends JO{constructor(e){super(e),this.events=new O.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}connect(){var e=this;return(0,l.A)(function*(n=e.connection){yield e.open(n)}).apply(this,arguments)}disconnect(){var e=this;return(0,l.A)(function*(){yield e.close()})()}on(e,n){this.events.on(e,n)}once(e,n){this.events.once(e,n)}off(e,n){this.events.off(e,n)}removeListener(e,n){this.events.removeListener(e,n)}request(e,n){var r=this;return(0,l.A)(function*(){return r.requestStrict(Ur(e.method,e.params||[],e.id||Zs().toString()),n)})()}requestStrict(e,n){var r=this;return(0,l.A)(function*(){return new Promise(function(){var s=(0,l.A)(function*(i,o){if(!r.connection.connected)try{yield r.open()}catch(a){o(a)}r.events.on(`${e.id}`,a=>{Cr(a)?o(a.error):i(a.result)});try{yield r.connection.send(e,n)}catch(a){o(a)}});return function(i,o){return s.apply(this,arguments)}}())})()}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),Qc(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",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}open(){var e=this;return(0,l.A)(function*(n=e.connection){e.connection===n&&e.connection.connected||(e.connection.connected&&e.close(),"string"==typeof n&&(yield e.connection.open(n),n=e.connection),e.connection=e.setConnection(n),yield e.connection.open(),e.registerEventListeners(),e.events.emit("connect"))}).apply(this,arguments)}close(){var e=this;return(0,l.A)(function*(){yield e.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)}}const Gy=t=>t.split("?")[0],sN=typeof WebSocket<"u"?WebSocket:typeof global<"u"&&typeof global.WebSocket<"u"?global.WebSocket:typeof window<"u"&&typeof window.WebSocket<"u"?window.WebSocket:typeof self<"u"&&typeof self.WebSocket<"u"?self.WebSocket:u(22173);class iN{constructor(e){if(this.url=e,this.events=new O.EventEmitter,this.registering=!1,!zy(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);this.url=e}get connected(){return typeof this.socket<"u"}get connecting(){return this.registering}on(e,n){this.events.on(e,n)}once(e,n){this.events.once(e,n)}off(e,n){this.events.off(e,n)}removeListener(e,n){this.events.removeListener(e,n)}open(){var e=this;return(0,l.A)(function*(n=e.url){yield e.register(n)}).apply(this,arguments)}close(){var e=this;return(0,l.A)(function*(){return new Promise((n,r)=>{typeof e.socket>"u"?r(new Error("Connection already closed")):(e.socket.onclose=s=>{e.onClose(s),n()},e.socket.close())})})()}send(e){var n=this;return(0,l.A)(function*(){typeof n.socket>"u"&&(n.socket=yield n.register());try{n.socket.send(Oe(e))}catch(r){n.onError(e.id,r)}})()}register(e=this.url){if(!zy(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const n=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=n||this.events.listenerCount("open")>=n)&&this.events.setMaxListeners(n+1),new Promise((r,s)=>{this.events.once("register_error",i=>{this.resetMaxListeners(),s(i)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return s(new Error("WebSocket connection is missing or invalid"));r(this.socket)})})}return this.url=e,this.registering=!0,new Promise((n,r)=>{const s=(0,qO.isReactNative)()?void 0:{rejectUnauthorized:!tN(e)},i=new sN(e,[],s);typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u"?i.onerror=o=>{r(this.emitError(o.error))}:i.on("error",o=>{r(this.emitError(o))}),i.onopen=()=>{this.onOpen(i),n(i)}})}onOpen(e){e.onmessage=n=>this.onPayload(n),e.onclose=n=>this.onClose(n),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;const n="string"==typeof e.data?he(e.data):e.data;this.events.emit("payload",n)}onError(e,n){const r=this.parseError(n),i=Xc(e,r.message||r.toString());this.events.emit("payload",i)}parseError(e,n=this.url){return jy(e,Gy(n),"WS")}
193resetMaxListeners(){this.events.getMaxListeners()>10&&this.events.setMaxListeners(10)}emitError(e){const n=this.parseError(new Error(e?.message||`WebSocket connection failed for host: ${Gy(this.url)}`));return this.events.emit("register_error",n),n}}var Rf=u(37044).hp;const el="core",Jr=`wc@2:${el}:`,aN={database:":memory:"},Jy="client_ed25519_seed",lN=_.ONE_DAY,pN=_.SIX_HOURS,Qy="wss://relay.walletconnect.org",pn_publish="relayer_publish",Pf="2.23.7",an={link_mode:"link_mode",relay:"relay"},e_="WALLETCONNECT_LINK_MODE_APPS",gr_created="subscription_created",gr_deleted="subscription_deleted",pa={wc_pairingDelete:{req:{ttl:_.ONE_DAY,prompt:!1,tag:1e3},res:{ttl:_.ONE_DAY,prompt:!1,tag:1001}},wc_pairingPing:{req:{ttl:_.THIRTY_SECONDS,prompt:!1,tag:1002},res:{ttl:_.THIRTY_SECONDS,prompt:!1,tag:1003}},unregistered_method:{req:{ttl:_.ONE_DAY,prompt:!1,tag:0},res:{ttl:_.ONE_DAY,prompt:!1,tag:0}}},Ir_expired="expirer_expired",t_="https://verify.walletconnect.org",ga=t_,PN=`${ga}/v3`,DN=["https://verify.walletconnect.com",t_];var $N=function WN(t,e){if(t.length>=255)throw new TypeError("Alphabet too long");for(var n=new Uint8Array(256),r=0;r<n.length;r++)n[r]=255;for(var s=0;s<t.length;s++){var i=t.charAt(s),o=i.charCodeAt(0);if(255!==n[o])throw new TypeError(i+" is ambiguous");n[o]=s}var a=t.length,c=t.charAt(0),d=Math.log(a)/Math.log(256),h=Math.log(256)/Math.log(a);function M(te){if("string"!=typeof te)throw new TypeError("Expected String");if(0===te.length)return new Uint8Array;var re=0;if(" "!==te[re]){for(var ae=0,ye=0;te[re]===c;)ae++,re++;for(var Se=(te.length-re)*d+1>>>0,oe=new Uint8Array(Se);te[re];){var pe=n[te.charCodeAt(re)];if(255===pe)return;for(var Ce=0,ke=Se-1;(0!==pe||Ce<ye)&&-1!==ke;ke--,Ce++)oe[ke]=(pe+=a*oe[ke]>>>0)%256>>>0,pe=pe/256>>>0;if(0!==pe)throw new Error("Non-zero carry");ye=Ce,re++}if(" "!==te[re]){for(var Be=Se-ye;Be!==Se&&0===oe[Be];)Be++;for(var Fe=new Uint8Array(ae+(Se-Be)),Pe=ae;Be!==Se;)Fe[Pe++]=oe[Be++];return Fe}}}return{encode:function b(te){if(te instanceof Uint8Array||(ArrayBuffer.isView(te)?te=new Uint8Array(te.buffer,te.byteOffset,te.byteLength):Array.isArray(te)&&(te=Uint8Array.from(te))),!(te instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===te.length)return"";for(var re=0,ae=0,ye=0,Se=te.length;ye!==Se&&0===te[ye];)ye++,re++;for(var oe=(Se-ye)*h+1>>>0,pe=new Uint8Array(oe);ye!==Se;){for(var Ce=te[ye],ke=0,Be=oe-1;(0!==Ce||ke<ae)&&-1!==Be;Be--,ke++)pe[Be]=(Ce+=256*pe[Be]>>>0)%a>>>0,Ce=Ce/a>>>0;if(0!==Ce)throw new Error("Non-zero carry");ae=ke,ye++}for(var Fe=oe-ae;Fe!==oe&&0===pe[Fe];)Fe++;for(var Pe=c.repeat(re);Fe<oe;++Fe)Pe+=t.charAt(pe[Fe]);return Pe},decodeUnsafe:M,decode:function J(te){var re=M(te);if(re)return re;throw new Error(`Non-${e} character`)}}};const n_=t=>{if(t instanceof Uint8Array&&"Uint8Array"===t.constructor.name)return t;if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t))return new Uint8Array(t.buffer,t.byteOffset,t.byteLength);throw new Error("Unknown type, must be binary type")};class zN{constructor(e,n,r){this.name=e,this.prefix=n,this.baseEncode=r}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class VN{constructor(e,n,r){if(this.name=e,this.prefix=n,void 0===n.codePointAt(0))throw new Error("Invalid prefix character");this.prefixCodePoint=n.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 r_(this,e)}}class GN{constructor(e){this.decoders=e}or(e){return r_(this,e)}decode(e){const r=this.decoders[e[0]];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`)}}const r_=(t,e)=>new GN({...t.decoders||{[t.prefix]:t},...e.decoders||{[e.prefix]:e}});class qN{constructor(e,n,r,s){this.name=e,this.prefix=n,this.baseEncode=r,this.baseDecode=s,this.encoder=new zN(e,n,r),this.decoder=new VN(e,n,s)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const nl=({name:t,prefix:e,encode:n,decode:r})=>new qN(t,e,n,r),ya=({prefix:t,name:e,alphabet:n})=>{const{encode:r,decode:s}=$N(n,e);return nl({prefix:t,name:e,encode:r,decode:i=>n_(s(i))})},Pn=({name:t,prefix:e,bitsPerChar:n,alphabet:r})=>nl({prefix:e,name:t,encode:s=>((t,e,n)=>{const r="="===e[e.length-1],s=(1<<n)-1;let i="",o=0,a=0;for(let c=0;c<t.length;++c)for(a=a<<8|t[c],o+=8;o>n;)o-=n,i+=e[s&a>>o];if(o&&(i+=e[s&a<<n-o]),r)for(;i.length*n&7;)i+="=";return i})(s,r,n),decode:s=>((t,e,n,r)=>{const s={};for(let h=0;h<e.length;++h)s[e[h]]=h;let i=t.length;for(;"="===t[i-1];)--i;const o=new Uint8Array(i*n/8|0);let a=0,c=0,d=0;for(let h=0;h<i;++h){const b=s[t[h]];if(void 0===b)throw new SyntaxError(`Non-${r} character`);c=c<<n|b,a+=n,a>=8&&(a-=8,o[d++]=255&c>>a)}if(a>=n||255&c<<8-a)throw new SyntaxError("Unexpected end of data");return o}
193)(s,r,n,t)}),JN=nl({prefix:"\0",name:"identity",encode:t=>(t=>(new TextDecoder).decode(t))(t),decode:t=>(t=>(new TextEncoder).encode(t))(t)});var XN=Object.freeze({__proto__:null,identity:JN});const QN=Pn({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var ex=Object.freeze({__proto__:null,base2:QN});const tx=Pn({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var nx=Object.freeze({__proto__:null,base8:tx});const rx=ya({prefix:"9",name:"base10",alphabet:"0123456789"});var sx=Object.freeze({__proto__:null,base10:rx});const ix=Pn({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),ox=Pn({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var ax=Object.freeze({__proto__:null,base16:ix,base16upper:ox});const cx=Pn({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),lx=Pn({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),ux=Pn({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),dx=Pn({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),fx=Pn({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),hx=Pn({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),px=Pn({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),gx=Pn({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),mx=Pn({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var yx=Object.freeze({__proto__:null,base32:cx,base32upper:lx,base32pad:ux,base32padupper:dx,base32hex:fx,base32hexupper:hx,base32hexpad:px,base32hexpadupper:gx,base32z:mx});const _x=ya({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Ex=ya({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var vx=Object.freeze({__proto__:null,base36:_x,base36upper:Ex});const bx=ya({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),wx=ya({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Cx=Object.freeze({__proto__:null,base58btc:bx,base58flickr:wx});const Ax=Pn({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),Ix=Pn({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Sx=Pn({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Tx=Pn({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Ox=Object.freeze({__proto__:null,base64:Ax,base64pad:Ix,base64url:Sx,base64urlpad:Tx});const s_=Array.from("\u{1f680}\u{1fa90}\u2604\u{1f6f0}\u{1f30c}\u{1f311}\u{1f312}\u{1f313}\u{1f314}\u{1f315}\u{1f316}\u{1f317}\u{1f318}\u{1f30d}\u{1f30f}\u{1f30e}\u{1f409}\u2600\u{1f4bb}\u{1f5a5}\u{1f4be}\u{1f4bf}\u{1f602}\u2764\u{1f60d}\u{1f923}\u{1f60a}\u{1f64f}\u{1f495}\u{1f62d}\u{1f618}\u{1f44d}\u{1f605}\u{1f44f}\u{1f601}\u{1f525}\u{1f970}\u{1f494}\u{1f496}\u{1f499}\u{1f622}\u{1f914}\u{1f606}\u{1f644}\u{1f4aa}\u{1f609}\u263a\u{1f44c}\u{1f917}\u{1f49c}\u{1f614}\u{1f60e}\u{1f607}\u{1f339}\u{1f926}\u{1f389}\u{1f49e}\u270c\u2728\u{1f937}\u{1f631}\u{1f60c}\u{1f338}\u{1f64c}\u{1f60b}\u{1f497}\u{1f49a}\u{1f60f}\u{1f49b}\u{1f642}\u{1f493}\u{1f929}\u{1f604}\u{1f600}\u{1f5a4}\u{1f603}\u{1f4af}\u{1f648}\u{1f447}\u{1f3b6}\u{1f612}\u{1f92d}\u2763\u{1f61c}\u{1f48b}\u{1f440}\u{1f62a}\u{1f611}\u{1f4a5}\u{1f64b}\u{1f61e}\u{1f629}\u{1f621}\u{1f92a}\u{1f44a}\u{1f973}\u{1f625}\u{1f924}\u{1f449}\u{1f483}\u{1f633}\u270b\u{1f61a}\u{1f61d}\u{1f634}\u{1f31f}\u{1f62c}\u{1f643}\u{1f340}\u{1f337}\u{1f63b}\u{1f613}\u2b50\u2705\u{1f97a}\u{1f308}\u{1f608}
193\u{1f918}\u{1f4a6}\u2714\u{1f623}\u{1f3c3}\u{1f490}\u2639\u{1f38a}\u{1f498}\u{1f620}\u261d\u{1f615}\u{1f33a}\u{1f382}\u{1f33b}\u{1f610}\u{1f595}\u{1f49d}\u{1f64a}\u{1f639}\u{1f5e3}\u{1f4ab}\u{1f480}\u{1f451}\u{1f3b5}\u{1f91e}\u{1f61b}\u{1f534}\u{1f624}\u{1f33c}\u{1f62b}\u26bd\u{1f919}\u2615\u{1f3c6}\u{1f92b}\u{1f448}\u{1f62e}\u{1f646}\u{1f37b}\u{1f343}\u{1f436}\u{1f481}\u{1f632}\u{1f33f}\u{1f9e1}\u{1f381}\u26a1\u{1f31e}\u{1f388}\u274c\u270a\u{1f44b}\u{1f630}\u{1f928}\u{1f636}\u{1f91d}\u{1f6b6}\u{1f4b0}\u{1f353}\u{1f4a2}\u{1f91f}\u{1f641}\u{1f6a8}\u{1f4a8}\u{1f92c}\u2708\u{1f380}\u{1f37a}\u{1f913}\u{1f619}\u{1f49f}\u{1f331}\u{1f616}\u{1f476}\u{1f974}\u25b6\u27a1\u2753\u{1f48e}\u{1f4b8}\u2b07\u{1f628}\u{1f31a}\u{1f98b}\u{1f637}\u{1f57a}\u26a0\u{1f645}\u{1f61f}\u{1f635}\u{1f44e}\u{1f932}\u{1f920}\u{1f927}\u{1f4cc}\u{1f535}\u{1f485}\u{1f9d0}\u{1f43e}\u{1f352}\u{1f617}\u{1f911}\u{1f30a}\u{1f92f}\u{1f437}\u260e\u{1f4a7}\u{1f62f}\u{1f486}\u{1f446}\u{1f3a4}\u{1f647}\u{1f351}\u2744\u{1f334}\u{1f4a3}\u{1f438}\u{1f48c}\u{1f4cd}\u{1f940}\u{1f922}\u{1f445}\u{1f4a1}\u{1f4a9}\u{1f450}\u{1f4f8}\u{1f47b}\u{1f910}\u{1f92e}\u{1f3bc}\u{1f975}\u{1f6a9}\u{1f34e}\u{1f34a}\u{1f47c}\u{1f48d}\u{1f4e3}\u{1f942}"),Nx=s_.reduce((t,e,n)=>(t[n]=e,t),[]),xx=s_.reduce((t,e,n)=>(t[e.codePointAt(0)]=n,t),[]),Dx=nl({prefix:"\u{1f680}",name:"base256emoji",encode:function Rx(t){return t.reduce((e,n)=>e+Nx[n],"")},decode:function Px(t){const e=[];for(const n of t){const r=xx[n.codePointAt(0)];if(void 0===r)throw new Error(`Non-base256emoji character: ${n}`);e.push(r)}return new Uint8Array(e)}});var Ux=Object.freeze({__proto__:null,base256emoji:Dx}),Lx=Math.pow(2,31),jx=Math.pow(2,7),$x=Math.pow(2,14),Hx=Math.pow(2,21),Kx=Math.pow(2,28),zx=Math.pow(2,35),Vx=Math.pow(2,42),Gx=Math.pow(2,49),qx=Math.pow(2,56),Yx=Math.pow(2,63),Jx={encode:function o_(t,e,n){e=e||[];for(var r=n=n||0;t>=Lx;)e[n++]=255&t|128,t/=128;for(;-128&t;)e[n++]=255&t|128,t>>>=7;return e[n]=0|t,o_.bytes=n-r+1,e},decode:function Df(t,r){var o,n=0,s=0,i=r=r||0,a=t.length;do{if(i>=a)throw Df.bytes=0,new RangeError("Could not decode varint");o=t[i++],n+=s<28?(127&o)<<s:(127&o)*Math.pow(2,s),s+=7}while(o>=128);return Df.bytes=i-r,n},encodingLength:function(t){return t<jx?1:t<$x?2:t<Hx?3:t<Kx?4:t<zx?5:t<Vx?6:t<Gx?7:t<qx?8:t<Yx?9:10}},c_=Jx;const l_=(t,e,n=0)=>(c_.encode(t,e,n),e),u_=t=>c_.encodingLength(t),Uf=(t,e)=>{const n=e.byteLength,r=u_(t),s=r+u_(n),i=new Uint8Array(s+n);return l_(t,i,0),l_(n,i,r),i.set(e,s),new Xx(t,n,e,i)};class Xx{constructor(e,n,r,s){this.code=e,this.size=n,this.digest=r,this.bytes=s}}const d_=({name:t,code:e,encode:n})=>new Qx(t,e,n);class Qx{constructor(e,n,r){this.name=e,this.code=n,this.encode=r}digest(e){if(e instanceof Uint8Array){const n=this.encode(e);return n instanceof Uint8Array?Uf(this.code,n):n.then(r=>Uf(this.code,r))}throw Error("Unknown type, must be binary type")}}const f_=t=>function(){var e=(0,l.A)(function*(n){return new Uint8Array(yield crypto.subtle.digest(t,n))});return function(n){return e.apply(this,arguments)}}(),eR=d_({name:"sha2-256",code:18,encode:f_("SHA-256")}),tR=d_({name:"sha2-512",code:19,encode:f_("SHA-512")});Object.freeze({__proto__:null,sha256:eR,sha512:tR});const p_=n_;Object.freeze({__proto__:null,identity:{code:0,name:"identity",encode:p_,digest:t=>Uf(0,p_(t))}}),new TextEncoder,new TextDecoder;const g_={...XN,...ex,...nx,...sx,...ax,...yx,...vx,...Cx,...Ox,...Ux};function m_(t){return null!=globalThis.Buffer?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t}function y_(t,e,n,r){return{name:t,prefix:e,encoder:{name:t,prefix:e,encode:n},decoder:{decode:r}}}const __=y_("utf8","u",t=>"u"+new TextDecoder("utf8").decode(t),t=>(new TextEncoder).encode(t.substring(1))),kf=y_("ascii","a",t=>{let e="a";for(let n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return e},t=>{const e=function iR(t=0){return null!=globalThis.Buffer&&null!=globalThis.Buffer.allocUnsafe?m_(globalThis.Buffer.allocUnsafe(t)):new Uint8Array(t)}((t=t.substring(1)).length);for(let n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e}),oR={utf8:__,"utf-8":__,hex:g_.base16,latin1:kf,ascii:kf,binary:kf,...g_};var cR=Object.defineProperty,Qr=(t,e,n)=>((t,e,n)=>
193e in t?cR(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,"symbol"!=typeof e?e+"":e,n);class uR{constructor(e,n){var r=this;this.core=e,this.logger=n,Qr(this,"keychain",new Map),Qr(this,"name","keychain"),Qr(this,"version","0.3"),Qr(this,"initialized",!1),Qr(this,"storagePrefix",Jr),Qr(this,"init",(0,l.A)(function*(){if(!r.initialized){const s=yield r.getKeyChain();typeof s<"u"&&(r.keychain=s),r.initialized=!0}})),Qr(this,"has",s=>(this.isInitialized(),this.keychain.has(s))),Qr(this,"set",function(){var s=(0,l.A)(function*(i,o){r.isInitialized(),r.keychain.set(i,o),yield r.persist()});return function(i,o){return s.apply(this,arguments)}}()),Qr(this,"get",s=>{this.isInitialized();const i=this.keychain.get(s);if(typeof i>"u"){const{message:o}=et("NO_MATCHING_KEY",`${this.name}: ${s}`);throw new Error(o)}return i}),Qr(this,"del",function(){var s=(0,l.A)(function*(i){r.isInitialized(),r.keychain.delete(i),yield r.persist()});return function(i){return s.apply(this,arguments)}}()),this.core=e,this.logger=(0,Ct.U5)(n,this.name)}get context(){return(0,Ct.oI)(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}setKeyChain(e){var n=this;return(0,l.A)(function*(){yield n.core.storage.setItem(n.storageKey,Dd(e))})()}getKeyChain(){var e=this;return(0,l.A)(function*(){const n=yield e.core.storage.getItem(e.storageKey);return typeof n<"u"?Ud(n):void 0})()}persist(){var e=this;return(0,l.A)(function*(){yield e.setKeyChain(e.keychain)})()}isInitialized(){if(!this.initialized){const{message:e}=et("NOT_INITIALIZED",this.name);throw new Error(e)}}}var dR=Object.defineProperty,Tn=(t,e,n)=>((t,e,n)=>e in t?dR(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,"symbol"!=typeof e?e+"":e,n);class hR{constructor(e,n,r){var s=this;this.core=e,this.logger=n,Tn(this,"name","crypto"),Tn(this,"keychain"),Tn(this,"randomSessionIdentifier",vf()),Tn(this,"initialized",!1),Tn(this,"clientId"),Tn(this,"init",(0,l.A)(function*(){s.initialized||(yield s.keychain.init(),s.initialized=!0)})),Tn(this,"hasKeys",i=>(this.isInitialized(),this.keychain.has(i))),Tn(this,"getClientId",(0,l.A)(function*(){if(s.isInitialized(),s.clientId)return s.clientId;const a=ip(op(yield s.getClientSeed()).publicKey);return s.clientId=a,a})),Tn(this,"generateKeyPair",()=>{this.isInitialized();const i=function AT(){const t=gf.utils.randomPrivateKey(),e=gf.getPublicKey(t);return{privateKey:tr(t,Jn),publicKey:tr(e,Jn)}}();return this.setPrivateKey(i.publicKey,i.privateKey)}),Tn(this,"signJWT",function(){var i=(0,l.A)(function*(o){s.isInitialized();const c=op(yield s.getClientSeed()),d=s.randomSessionIdentifier;return yield function ob(t,e,n,r){return bu.apply(this,arguments)}(d,o,lN,c)});return function(o){return i.apply(this,arguments)}}()),Tn(this,"generateSharedKey",(i,o,a)=>{this.isInitialized();const d=function IT(t,e){const n=gf.getSharedSecret(vr(t,Jn),vr(e,Jn));return tr(((t,e,n,r,s)=>function D2(t,e,n,r=32){Oc(t),ps(r);const s=t.outputLen;if(r>255*s)throw new Error("Length should be <= 255*HashLen");const i=Math.ceil(r/s);void 0===n&&(n=U0);const o=new Uint8Array(i*s),a=kc.create(t,e),c=a._cloneInto(),d=new Uint8Array(a.outputLen);for(let h=0;h<i;h++)nf[0]=h+1,c.update(0===h?U0:d).update(n).update(nf).digestInto(d),o.set(d,s*h),a._cloneInto(c);return a.destroy(),c.destroy(),br(d,nf),o.slice(0,r)}(t,function P2(t,e,n){return Oc(t),void 0===n&&(n=new Uint8Array(t.outputLen)),kc(t,Pr(n),Pr(e))}(t,e,n),r,s))(Mc,n,void 0,void 0,32),Jn)}(this.getPrivateKey(i),o);return this.setSymKey(d,a)}),Tn(this,"setSymKey",function(){var i=(0,l.A)(function*(o,a){s.isInitialized();const c=a||zc(o);return yield s.keychain.set(c,o),c});return function(o,a){return i.apply(this,arguments)}}()),Tn(this,"deleteKeyPair",function(){var i=(0,l.A)(function*(o){s.isInitialized(),yield s.keychain.del(o)});return function(o){return i.apply(this,arguments)}}()),Tn(this,"deleteSymKey",function(){var i=(0,l.A)(function*(o){s.isInitialized(),yield s.keychain.del(o)});return function(o){return i.apply(this,arguments)}}()),Tn(this,"encode",function(){var i=(0,l.A)(function*(o,a,c){s.isInitialized();const d=_y(c),h=Oe(a);if(vy(d))return function OT(t,e){const n=py(2),r=fi(12),i=yy({type:n,sealed:vr(t,aa),iv:r});return e===Ys?gy(i):i}(h,c?.encoding);
193if(Ey(d)){const te=d.senderPublicKey,re=d.receiverPublicKey;o=yield s.generateSharedKey(te,re)}const b=s.getSymKey(o),{type:M,senderPublicKey:J}=d;return function ST(t){const e=py(typeof t.type<"u"?t.type:0);if(1===yi(e)&&typeof t.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const n=typeof t.senderPublicKey<"u"?vr(t.senderPublicKey,Jn):void 0,r=typeof t.iv<"u"?vr(t.iv,Jn):fi(12),s=vr(t.symKey,Jn),o=yy({type:e,sealed:P0(s,r).encrypt(vr(t.message,aa)),iv:r,senderPublicKey:n});return t.encoding===Ys?gy(o):o}({type:M,symKey:b,message:h,senderPublicKey:J,encoding:c?.encoding})});return function(o,a,c){return i.apply(this,arguments)}}()),Tn(this,"decode",function(){var i=(0,l.A)(function*(o,a,c){s.isInitialized();const d=function xT(t,e){const n=ua({encoded:t,encoding:e?.encoding});return _y({type:yi(n.type),senderPublicKey:typeof n.senderPublicKey<"u"?tr(n.senderPublicKey,Jn):void 0,receiverPublicKey:e?.receiverPublicKey})}(a,c);if(vy(d)){const h=function NT(t,e){const{sealed:n}=ua({encoded:t,encoding:e});return tr(n,aa)}(a,c?.encoding);return he(h)}if(Ey(d)){const h=d.receiverPublicKey,b=d.senderPublicKey;o=yield s.generateSharedKey(h,b)}try{const b=function TT(t){const e=vr(t.symKey,Jn),{sealed:n,iv:r}=ua({encoded:t.encoded,encoding:t.encoding}),s=P0(e,r).decrypt(n);if(null===s)throw new Error("Failed to decrypt");return tr(s,aa)}({symKey:s.getSymKey(o),encoded:a,encoding:c?.encoding});return he(b)}catch(h){s.logger.error(`Failed to decode message from topic: '${o}', clientId: '${yield s.getClientId()}'`),s.logger.error(h)}});return function(o,a,c){return i.apply(this,arguments)}}()),Tn(this,"getPayloadType",(i,o=or)=>yi(ua({encoded:i,encoding:o}).type)),Tn(this,"getPayloadSenderPublicKey",(i,o=or)=>{const a=ua({encoded:i,encoding:o});return a.senderPublicKey?tr(a.senderPublicKey,Jn):void 0}),this.core=e,this.logger=(0,Ct.U5)(n,this.name),this.keychain=r||new uR(this.core,this.logger)}get context(){return(0,Ct.oI)(this.logger)}setPrivateKey(e,n){var r=this;return(0,l.A)(function*(){return yield r.keychain.set(e,n),e})()}getPrivateKey(e){return this.keychain.get(e)}getClientSeed(){var e=this;return(0,l.A)(function*(){let n="";try{n=e.keychain.get(Jy)}catch{n=vf(),yield e.keychain.set(Jy,n)}return function aR(t,e="utf8"){const n=oR[e];if(!n)throw new Error(`Unsupported encoding "${e}"`);return"utf8"!==e&&"utf-8"!==e||null==globalThis.Buffer||null==globalThis.Buffer.from?n.decoder.decode(`${n.prefix}${t}`):m_(globalThis.Buffer.from(t,"utf-8"))}(n,"base16")})()}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=et("NOT_INITIALIZED",this.name);throw new Error(e)}}}var pR=Object.defineProperty,gR=Object.defineProperties,mR=Object.getOwnPropertyDescriptors,E_=Object.getOwnPropertySymbols,yR=Object.prototype.hasOwnProperty,_R=Object.prototype.propertyIsEnumerable,Mf=(t,e,n)=>e in t?pR(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,mr=(t,e,n)=>Mf(t,"symbol"!=typeof e?e+"":e,n);class bR extends Js{constructor(e,n){var r;super(e,n),r=this,this.logger=e,this.core=n,mr(this,"messages",new Map),mr(this,"messagesWithoutClientAck",new Map),mr(this,"name","messages"),mr(this,"version","0.3"),mr(this,"initialized",!1),mr(this,"storagePrefix",Jr),mr(this,"init",(0,l.A)(function*(){if(!r.initialized){r.logger.trace("Initialized");try{const s=yield r.getRelayerMessages();typeof s<"u"&&(r.messages=s);const i=yield r.getRelayerMessagesWithoutClientAck();typeof i<"u"&&(r.messagesWithoutClientAck=i),r.logger.debug(`Successfully Restored records for ${r.name}`),r.logger.trace({type:"method",method:"restore",size:r.messages.size})}catch(s){r.logger.debug(`Failed to Restore records for ${r.name}`),r.logger.error(s)}finally{r.initialized=!0}}})),mr(this,"set",function(){var s=(0,l.A)(function*(i,o,a){r.isInitialized();const c=wr(o);let d=r.messages.get(i);if(typeof d>"u"&&(d={}),typeof d[c]<"u")return c;if(d[c]=o,r.messages.set(i,d),"inbound"===a){const h=r.messagesWithoutClientAck.get(i)||{};r.messagesWithoutClientAck.set(i,((t,e)=>gR(t,mR(e)))(((t,e)=>{for(var n in e||(e={}))yR.call(e,n)&&Mf(t,n,e[n]);if(E_)for(var n of E_(e))_R.call(e,n)&&Mf(t,n,e[n]);return t})({},h),{[c]:o}))}return yield r.persist(),c});return function(i,o,a){return s.apply(this,arguments)}}()),mr(this,"get",s=>{this.isInitialized();let i=this.messages.get(s);return typeof i>"u"&&(i={}),i}),mr(this,"getWithoutAck",s=>{this.isInitialized();const i={};for(const o of s){const a=this.messagesWithoutClientAck.get(o)||{};i[o]=Object.values(a)}return i}),mr(this,"has",(s,i)=>(this.isInitialized(),typeof this.get(s)[wr(i)]<"u")),mr(this,"ack",function(){var s=(0,l.A)(function*(i,o){r.isInitialized();const a=r.messagesWithoutClientAck.get(i);typeof a>"u"||(delete a[wr(o)],0===Object.keys(a).length?r.messagesWithoutClientAck.delete(i):r.messagesWithoutClientAck.set(i,a),yield r.persist())});return function(i,o){return s.apply(this,arguments)}}()),mr(this,"del",function(){var s=(0,l.A)(function*(i){r.isInitialized(),r.messages.delete(i),r.messagesWithoutClientAck.delete(i),yield r.persist()});return function(i){return s.apply(this,arguments)}}()),this.logger=(0,Ct.U5)(e,this.name),this.core=n}get context(){return(0,Ct.oI)(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"}setRelayerMessages(e){var n=this;return(0,l.A)(function*(){yield n.core.storage.setItem(n.storageKey,Dd(e))})()}setRelayerMessagesWithoutClientAck(e){var n=this;return(0,l.A)(function*(){yield n.core.storage.setItem(n.storageKeyWithoutClientAck,Dd(e))})()}getRelayerMessages(){var e=this;return(0,l.A)(function*(){const n=yield e.core.storage.getItem(e.storageKey);return typeof n<"u"?Ud(n):void 0})()}getRelayerMessagesWithoutClientAck(){var e=this;return(0,l.A)(function*(){const n=yield e.core.storage.getItem(e.storageKeyWithoutClientAck);return typeof n<"u"?Ud(n):void 0})()}persist(){var e=this;return(0,l.A)(function*(){yield e.setRelayerMessages(e.messages),yield e.setRelayerMessagesWithoutClientAck(e.messagesWithoutClientAck)})()}isInitialized(){if(!this.initialized){const{message:e}=et("NOT_INITIALIZED",this.name);throw new Error(e)}}}var wR=Object.defineProperty,CR=Object.defineProperties,AR=Object.getOwnPropertyDescriptors,v_=Object.getOwnPropertySymbols,IR=Object.prototype.hasOwnProperty,SR=Object.prototype.propertyIsEnumerable,Bf=(t,e,n)=>e in t?wR(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,eo=(t,e)=>{for(var n in e||(e={}
193))IR.call(e,n)&&Bf(t,n,e[n]);if(v_)for(var n of v_(e))SR.call(e,n)&&Bf(t,n,e[n]);return t},b_=(t,e)=>CR(t,AR(e)),Sr=(t,e,n)=>Bf(t,"symbol"!=typeof e?e+"":e,n);class TR extends Cs{constructor(e,n){var r;super(e,n),r=this,this.relayer=e,this.logger=n,Sr(this,"events",new O.EventEmitter),Sr(this,"name","publisher"),Sr(this,"queue",new Map),Sr(this,"publishTimeout",(0,_.toMiliseconds)(_.ONE_MINUTE)),Sr(this,"initialPublishTimeout",(0,_.toMiliseconds)(15*_.ONE_SECOND)),Sr(this,"needsTransportRestart",!1),Sr(this,"publish",function(){var s=(0,l.A)(function*(i,o,a){var c,d,h,b,M;r.logger.debug("Publishing Payload"),r.logger.trace({type:"method",method:"publish",params:{topic:i,message:o,opts:a}});const J=a?.ttl||pN,te=a?.prompt||!1,re=a?.tag||0,ae=a?.id||Zs().toString(),ye=Ji(Vc().protocol),Se={id:ae,method:a?.publishMethod||ye.publish,params:eo({topic:i,message:o,ttl:J,prompt:te,tag:re,attestation:a?.attestation},a?.tvf)},oe=`Failed to publish payload, please try again. id:${ae} tag:${re}`;try{An(null==(c=Se.params)?void 0:c.prompt)&&(null==(d=Se.params)||delete d.prompt),An(null==(h=Se.params)?void 0:h.tag)&&(null==(b=Se.params)||delete b.tag);const pe=new Promise(function(){var Ce=(0,l.A)(function*(ke){const Be=({id:Pe})=>{var Ze;(null==(Ze=Se.id)?void 0:Ze.toString())===Pe.toString()&&(r.removeRequestFromQueue(Pe),r.relayer.events.removeListener(pn_publish,Be),ke())};r.relayer.events.on(pn_publish,Be);const Fe=zr(new Promise((Pe,Ze)=>{r.rpcPublish(Se,a).then(Pe).catch(He=>{r.logger.warn(He,He?.message),Ze(He)})}),r.initialPublishTimeout,`Failed initial publish, retrying.... id:${ae} tag:${re}`);try{yield Fe,r.events.removeListener(pn_publish,Be)}catch(Pe){r.queue.set(ae,{request:Se,opts:a,attempt:1}),r.logger.warn(Pe,Pe?.message)}});return function(ke){return Ce.apply(this,arguments)}}());r.logger.trace({type:"method",method:"publish",params:{id:ae,topic:i,message:o,opts:a}}),yield zr(pe,r.publishTimeout,oe)}catch(pe){if(r.logger.debug("Failed to Publish Payload"),r.logger.error(pe),null!=(M=a?.internal)&&M.throwOnFailedPublish)throw pe}finally{r.queue.delete(ae)}});return function(i,o,a){return s.apply(this,arguments)}}()),Sr(this,"publishCustom",function(){var s=(0,l.A)(function*(i){var o,a,c,d,h;r.logger.debug("Publishing custom payload"),r.logger.trace({type:"method",method:"publishCustom",params:i});const{payload:b,opts:M={}}=i,{attestation:J,tvf:te,publishMethod:re,prompt:ae,tag:ye,ttl:Se=_.FIVE_MINUTES}=M,oe=M.id||Zs().toString(),pe=Ji(Vc().protocol),Ce=re||pe.publish,ke={id:oe,method:Ce,params:eo(b_(eo({},b),{ttl:Se,prompt:ae,tag:ye,attestation:J}),te)},Be=`Failed to publish custom payload, please try again. id:${oe} tag:${ye}`;try{An(null==(o=ke.params)?void 0:o.prompt)&&(null==(a=ke.params)||delete a.prompt),An(null==(c=ke.params)?void 0:c.tag)&&(null==(d=ke.params)||delete d.tag);const Fe=new Promise(function(){var Pe=(0,l.A)(function*(Ze){const He=({id:Ee})=>{var Ne;(null==(Ne=ke.id)?void 0:Ne.toString())===Ee.toString()&&(r.removeRequestFromQueue(Ee),r.relayer.events.removeListener(pn_publish,He),Ze())};r.relayer.events.on(pn_publish,He);const Me=zr(new Promise((Ee,Ne)=>{r.rpcPublish(ke,M).then(Ee).catch(le=>{r.logger.warn(le,le?.message),Ne(le)})}),r.initialPublishTimeout,`Failed initial custom payload publish, retrying.... method:${Ce} id:${oe} tag:${ye}`);try{yield Me,r.events.removeListener(pn_publish,He)}catch(Ee){r.queue.set(oe,{request:ke,opts:M,attempt:1}),r.logger.warn(Ee,Ee?.message)}});return function(Ze){return Pe.apply(this,arguments)}}());r.logger.trace({type:"method",method:"publish",params:{id:oe,payload:b,opts:M}}),yield zr(Fe,r.publishTimeout,Be)}catch(Fe){if(r.logger.debug("Failed to Publish Payload"),r.logger.error(Fe),null!=(h=M?.internal)&&h.throwOnFailedPublish)throw Fe}finally{r.queue.delete(oe)}});return function(i){return s.apply(this,arguments)}}()),Sr(this,"on",(s,i)=>{this.events.on(s,i)}),Sr(this,"once",(s,i)=>{this.events.once(s,i)}),Sr(this,"off",(s,i)=>{this.events.off(s,i)}),Sr(this,"removeListener",(s,i)=>{this.events.removeListener(s,i)}),this.relayer=e,this.logger=(0,Ct.U5)(n,this.name),this.registerEventListeners()}get context(){return(0,Ct.oI)(this.logger)}rpcPublish(e,n){var r=this;return(0,l.A)(function*(){r.logger.debug("Outgoing Relay Payload"),r.logger.trace({type:"message",direction:"outgoing",request:e});const s=yield r.relayer.request(e);return r.relayer.events.emit(pn_publish,eo(eo({},e),n)),r.logger.debug("Successfully Published Payload"),s})()}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){var e=this;this.queue.forEach(function(){var n=(0,l.A)(function*(r,s){var i;const o=r.attempt+1;e.queue.set(s,b_(eo({},r),{attempt:o})),e.logger.warn({},`Publisher: queue->publishing: ${r.request.id}, tag: ${null==(i=r.request.params)?void 0:i.tag}, attempt: ${o}`),yield e.rpcPublish(r.request,r.opts),e.logger.warn({},`Publisher: queue->published: ${r.request.id}`)});return function(r,s){return n.apply(this,arguments)}}())}registerEventListeners(){this.relayer.core.heartbeat.on(z_pulse,()=>{if(this.needsTransportRestart)return this.needsTransportRestart=!1,void this.relayer.events.emit("relayer_connection_stalled");this.checkQueue()}),this.relayer.on("relayer_message_ack",e=>{this.removeRequestFromQueue(e.id.toString())})}}var OR=Object.defineProperty,to=(t,e,n)=>((t,e,n)=>e in t?OR(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,"symbol"!=typeof e?e+"":e,n);class xR{constructor(){to(this,"map",new Map),to(this,"set",(e,n)=>{const r=this.get(e);
193this.exists(e,n)||this.map.set(e,[...r,n])}),to(this,"get",e=>this.map.get(e)||[]),to(this,"exists",(e,n)=>this.get(e).includes(n)),to(this,"delete",(e,n)=>{if(typeof n>"u")return void this.map.delete(e);if(!this.map.has(e))return;const r=this.get(e);if(!this.exists(e,n))return;const s=r.filter(i=>i!==n);s.length?this.map.set(e,s):this.map.delete(e)}),to(this,"clear",()=>{this.map.clear()})}get topics(){return Array.from(this.map.keys())}}var RR=Object.defineProperty,PR=Object.defineProperties,DR=Object.getOwnPropertyDescriptors,w_=Object.getOwnPropertySymbols,UR=Object.prototype.hasOwnProperty,kR=Object.prototype.propertyIsEnumerable,Lf=(t,e,n)=>e in t?RR(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,_a=(t,e)=>{for(var n in e||(e={}))UR.call(e,n)&&Lf(t,n,e[n]);if(w_)for(var n of w_(e))kR.call(e,n)&&Lf(t,n,e[n]);return t},Ff=(t,e)=>PR(t,DR(e)),nn=(t,e,n)=>Lf(t,"symbol"!=typeof e?e+"":e,n);class MR extends dl{constructor(e,n){var r;super(e,n),r=this,this.relayer=e,this.logger=n,nn(this,"subscriptions",new Map),nn(this,"topicMap",new xR),nn(this,"events",new O.EventEmitter),nn(this,"name","subscription"),nn(this,"version","0.3"),nn(this,"pending",new Map),nn(this,"cached",[]),nn(this,"initialized",!1),nn(this,"storagePrefix",Jr),nn(this,"subscribeTimeout",(0,_.toMiliseconds)(_.ONE_MINUTE)),nn(this,"initialSubscribeTimeout",(0,_.toMiliseconds)(15*_.ONE_SECOND)),nn(this,"clientId"),nn(this,"batchSubscribeTopicsLimit",500),nn(this,"init",(0,l.A)(function*(){r.initialized||(r.logger.trace("Initialized"),r.registerEventListeners(),yield r.restore()),r.initialized=!0})),nn(this,"subscribe",function(){var s=(0,l.A)(function*(i,o){var a;r.isInitialized(),r.logger.debug("Subscribing Topic"),r.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:o}});try{const c=Vc(o),d={topic:i,relay:c,transportType:o?.transportType};null!=(a=o?.internal)&&a.skipSubscribe||r.pending.set(i,d);const h=yield r.rpcSubscribe(i,c,o);return"string"==typeof h&&(r.onSubscribe(h,d),r.logger.debug("Successfully Subscribed Topic"),r.logger.trace({type:"method",method:"subscribe",params:{topic:i,opts:o}})),h}catch(c){throw r.logger.debug("Failed to Subscribe Topic"),r.logger.error(c),c}});return function(i,o){return s.apply(this,arguments)}}()),nn(this,"unsubscribe",function(){var s=(0,l.A)(function*(i,o){r.isInitialized(),typeof o?.id<"u"?yield r.unsubscribeById(i,o.id,o):yield r.unsubscribeByTopic(i,o)});return function(i,o){return s.apply(this,arguments)}}()),nn(this,"isSubscribed",s=>new Promise(i=>{i(this.topicMap.topics.includes(s))})),nn(this,"isKnownTopic",s=>new Promise(i=>{i(this.topicMap.topics.includes(s)||this.pending.has(s)||this.cached.some(o=>o.topic===s))})),nn(this,"on",(s,i)=>{this.events.on(s,i)}),nn(this,"once",(s,i)=>{this.events.once(s,i)}),nn(this,"off",(s,i)=>{this.events.off(s,i)}),nn(this,"removeListener",(s,i)=>{this.events.removeListener(s,i)}),nn(this,"start",(0,l.A)(function*(){yield r.onConnect()})),nn(this,"stop",(0,l.A)(function*(){yield r.onDisconnect()})),nn(this,"restart",(0,l.A)(function*(){yield r.restore(),yield r.onRestart()})),nn(this,"checkPending",(0,l.A)(function*(){if(!(0!==r.pending.size||r.initialized&&r.relayer.connected))return;const s=[];r.pending.forEach(i=>{s.push(i)}),yield r.batchSubscribe(s)})),nn(this,"registerEventListeners",()=>{this.relayer.core.heartbeat.on(z_pulse,(0,l.A)(function*(){yield r.checkPending()})),this.events.on(gr_created,function(){var s=(0,l.A)(function*(i){const o=gr_created;r.logger.info(`Emitting ${o}`),r.logger.debug({type:"event",event:o,data:i}),yield r.persist()});return function(i){return s.apply(this,arguments)}}()),this.events.on(gr_deleted,function(){var s=(0,l.A)(function*(i){const o=gr_deleted;r.logger.info(`Emitting ${o}`),r.logger.debug({type:"event",event:o,data:i}),yield r.persist()});return function(i){return s.apply(this,arguments)}}())}),this.relayer=e,this.logger=(0,Ct.U5)(n,this.name),this.clientId=""}get context(){return(0,Ct.oI)(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,n){let r=!1;try{r=this.getSubscription(e).topic===n}catch{}return r}reset(){this.cached=[],this.initialized=!0}onDisable(){this.values.length>0&&(this.cached=this.values),this.subscriptions.clear(),this.topicMap.clear()}unsubscribeByTopic(e,n){var r=this;return(0,l.A)(function*(){const s=r.topicMap.get(e);yield Promise.all(s.map(function(){var i=(0,l.A)(function*(o){return yield r.unsubscribeById(e,o,n)});return function(o){return i.apply(this,arguments)}}()))})()}unsubscribeById(e,n,r){var s=this;return(0,l.A)(function*(){s.logger.debug("Unsubscribing Topic"),s.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:n,opts:r}});try{const i=Vc(r);yield s.restartToComplete({topic:e,id:n,relay:i}),yield s.rpcUnsubscribe(e,n,i);const o=cn("USER_DISCONNECTED",`${s.name}, ${e}`);yield s.onUnsubscribe(e,n,o),s.logger.debug("Successfully Unsubscribed Topic"),s.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:n,opts:r}})}catch(i){throw s.logger.debug("Failed to Unsubscribe Topic"),s.logger.error(i),i}})()}rpcSubscribe(e,n,r){var s=this;return(0,l.A)(function*(){var i,o;const a=yield s.getSubscriptionId(e);if(null!=(i=r?.internal)&&i.skipSubscribe)return a;(!r||r?.transportType===an.relay)&&(yield s.restartToComplete({topic:e,id:e,relay:n}));const c={method:Ji(n.protocol).subscribe,params:{topic:e}};s.logger.debug("Outgoing Relay Payload"),s.logger.trace({type:"payload",direction:"outgoing",request:c});const d=null==(o=r?.internal)?void 0:o.throwOnFailedPublish;try{if(r?.transportType===an.link_mode)return setTimeout(()=>{(s.relayer.connected||s.relayer.connecting)&&s.relayer.request(c).catch(M=>s.logger.warn(M))},(0,_.toMiliseconds)(_.ONE_SECOND)),a;const h=new Promise(function(){var M=(0,l.A)(function*(J){const te=re=>{re.topic===e&&(s.events.removeListener(gr_created,te),J(re.id))};s.events.on(gr_created,te);try{const re=yield zr(new Promise((ae,ye)=>{s.relayer.request(c).catch(Se=>{s.logger.warn(Se,Se?.message),ye(Se)}).then(ae)}),s.initialSubscribeTimeout,`Subscribing to ${e} failed, please try again`);s.events.removeListener(gr_created,te),J(re)}catch{}});return function(J){return M.apply(this,arguments)}}()),b=yield zr(h,s.subscribeTimeout,`Subscribing to ${e} failed, please try again`);if(!b&&d)throw new Error(`Subscribing to ${e} failed, please try again`);return b?a:null}catch(h){if(s.logger.debug("Outgoing Relay Subscribe Payload stalled"),s.relayer.events.emit("relayer_connection_stalled"),d)throw h}return null})()}rpcBatchSubscribe(e){var n=this;return(0,l.A)(function*(){if(!e.length)return!0;const s={method:Ji(e[0].relay.protocol).batchSubscribe,params:{topics:e.map(i=>i.topic)}};n.logger.debug("Outgoing Relay Payload"),n.logger.trace({type:"payload",direction:"outgoing",request:s});try{return yield zr(new Promise((i,o)=>{n.relayer.request(s).then(i).catch(a=>{n.logger.warn(a),o(a)})}),n.subscribeTimeout,"rpcBatchSubscribe failed, please try again"),!0}catch{return n.relayer.events.emit("relayer_connection_stalled"),!1}})()}rpcBatchFetchMessages(e){var n=this;return(0,l.A)(function*(){if(!e.length)return;const s={method:Ji(e[0].relay.protocol).batchFetchMessages,params:{topics:e.map(o=>o.topic)}};let i;n.logger.debug("Outgoing Relay Payload"),n.logger.trace({type:"payload",direction:"outgoing",request:s});try{i=yield yield zr(new Promise((o,a)=>{n.relayer.request(s).catch(c=>{n.logger.warn(c),a(c)}).then(o)}),n.subscribeTimeout,"rpcBatchFetchMessages failed, please try again")}catch{n.relayer.events.emit("relayer_connection_stalled")}return i})()}rpcUnsubscribe(e,n,r){const s={method:Ji(r.protocol).unsubscribe,params:{topic:e,id:n}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:s}),this.relayer.request(s)}onSubscribe(e,n){this.setSubscription(e,Ff(_a({},n),{id:e})),this.pending.delete(n.topic)}onBatchSubscribe(e){e.length&&e.forEach(n=>{this.setSubscription(n.id,_a({},n)),this.pending.delete(n.topic)})}onUnsubscribe(e,n,r){var s=this;return(0,l.A)(function*(){s.events.removeAllListeners(n),s.hasSubscription(n,e)&&s.deleteSubscription(n,r),yield s.relayer.messages.del(e)})()}setRelayerSubscriptions(e){var n=this;return(0,l.A)(function*(){yield n.relayer.core.storage.setItem(n.storageKey,e)})()}getRelayerSubscriptions(){var e=this;return(0,l.A)(function*(){return yield e.relayer.core.storage.getItem(e.storageKey)})()}setSubscription(e,n){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:n}),this.addSubscription(e,n)}addSubscription(e,n){this.subscriptions.set(e,_a({},n)),this.topicMap.set(n.topic,e),this.events.emit(gr_created,n)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const n=this.subscriptions.get(e);if(!n){const{message:r}=et("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(r)}return n}deleteSubscription(e,n){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:n});const r=this.getSubscription(e);
193this.subscriptions.delete(e),this.topicMap.delete(r.topic,e),this.events.emit(gr_deleted,Ff(_a({},r),{reason:n}))}persist(){var e=this;return(0,l.A)(function*(){yield e.setRelayerSubscriptions(e.values),e.events.emit("subscription_sync")})()}onRestart(){var e=this;return(0,l.A)(function*(){if(e.cached.length){const n=[...e.cached],r=Math.ceil(e.cached.length/e.batchSubscribeTopicsLimit);for(let s=0;s<r;s++){const i=n.splice(0,e.batchSubscribeTopicsLimit);yield e.batchSubscribe(i)}}e.events.emit("subscription_resubscribed")})()}restore(){var e=this;return(0,l.A)(function*(){try{const n=yield e.getRelayerSubscriptions();if(typeof n>"u"||!n.length)return;if(e.subscriptions.size&&!n.every(r=>{var s;return r.topic===(null==(s=e.subscriptions.get(r.id))?void 0:s.topic)})){const{message:r}=et("RESTORE_WILL_OVERRIDE",e.name);throw e.logger.error(r),e.logger.error(`${e.name}: ${JSON.stringify(e.values)}`),new Error(r)}e.cached=n,e.logger.debug(`Successfully Restored subscriptions for ${e.name}`),e.logger.trace({type:"method",method:"restore",subscriptions:e.values})}catch(n){e.logger.debug(`Failed to Restore subscriptions for ${e.name}`),e.logger.error(n)}})()}batchSubscribe(e){var n=this;return(0,l.A)(function*(){if(e.length){if(!(yield n.rpcBatchSubscribe(e)))return n.logger.warn(`Batch subscribe failed for ${e.length} topics, adding to pending for retry`),void e.forEach(r=>{n.pending.set(r.topic,r)});n.onBatchSubscribe(yield Promise.all(e.map(function(){var r=(0,l.A)(function*(s){return Ff(_a({},s),{id:yield n.getSubscriptionId(s.topic)})});return function(s){return r.apply(this,arguments)}}())))}})()}batchFetchMessages(e){var n=this;return(0,l.A)(function*(){if(!e.length)return;n.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const r=yield n.rpcBatchFetchMessages(e);r&&r.messages&&(yield function KI(t){return new Promise(e=>setTimeout(e,t))}((0,_.toMiliseconds)(_.ONE_SECOND)),yield n.relayer.handleBatchMessageEvents(r.messages))})()}onConnect(){var e=this;return(0,l.A)(function*(){yield e.restart(),e.reset()})()}onDisconnect(){this.onDisable()}isInitialized(){if(!this.initialized){const{message:e}=et("NOT_INITIALIZED",this.name);throw new Error(e)}}restartToComplete(e){var n=this;return(0,l.A)(function*(){!n.relayer.connected&&!n.relayer.connecting&&(n.cached.push(e),yield n.relayer.transportOpen())})()}getClientId(){var e=this;return(0,l.A)(function*(){return e.clientId||(e.clientId=yield e.relayer.core.crypto.getClientId()),e.clientId})()}getSubscriptionId(e){var n=this;return(0,l.A)(function*(){return wr(e+(yield n.getClientId()))})()}}var BR=Object.defineProperty,C_=Object.getOwnPropertySymbols,LR=Object.prototype.hasOwnProperty,FR=Object.prototype.propertyIsEnumerable,Wf=(t,e,n)=>e in t?BR(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,A_=(t,e)=>{for(var n in e||(e={}))LR.call(e,n)&&Wf(t,n,e[n]);if(C_)for(var n of C_(e))FR.call(e,n)&&Wf(t,n,e[n]);return t},$t=(t,e,n)=>Wf(t,"symbol"!=typeof e?e+"":e,n);class WR extends Ci{constructor(e){var n,r;super(e),n=this,$t(this,"protocol","wc"),$t(this,"version",2),$t(this,"core"),$t(this,"logger"),$t(this,"events",new O.EventEmitter),$t(this,"provider"),$t(this,"messages"),$t(this,"subscriber"),$t(this,"publisher"),$t(this,"name","relayer"),$t(this,"transportExplicitlyClosed",!1),$t(this,"initialized",!1),$t(this,"connectionAttemptInProgress",!1),$t(this,"relayUrl"),$t(this,"projectId"),$t(this,"packageName"),$t(this,"bundleId"),$t(this,"hasExperiencedNetworkDisruption",!1),$t(this,"pingTimeout"),$t(this,"heartBeatTimeout",(0,_.toMiliseconds)(_.THIRTY_SECONDS+_.FIVE_SECONDS)),$t(this,"reconnectTimeout"),$t(this,"connectPromise"),$t(this,"reconnectInProgress",!1),$t(this,"requestsInFlight",[]),$t(this,"connectTimeout",(0,_.toMiliseconds)(15*_.ONE_SECOND)),$t(this,"stalledRestartInProgress",!1),$t(this,"stalledRestartTimeout"),$t(this,"stalledRestartBackoff",0),$t(this,"stalledRestartBaseInterval",(0,_.toMiliseconds)(2*_.ONE_SECOND)),$t(this,"stalledRestartMaxInterval",(0,_.toMiliseconds)(_.THIRTY_SECONDS)),$t(this,"request",function(){var s=(0,l.A)(function*(i){var o,a;n.logger.debug("Publishing Request Payload");const c=i.id||Zs().toString();yield n.toEstablishConnection();try{n.logger.trace({id:c,method:i.method,topic:null==(o=i.params)?void 0:o.topic},"relayer.request - publishing...");const d=`${c}:${(null==(a=i.params)?void 0:a.tag)||""}`;n.requestsInFlight.push(d);const h=yield n.provider.request(i);return n.requestsInFlight=n.requestsInFlight.filter(b=>b!==d),h}catch(d){throw n.logger.debug(`Failed to Publish Request: ${c}`),d}});return function(i){return s.apply(this,arguments)}}()),$t(this,"resetPingTimeout",()=>{Ic()&&(clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var s,i,o,a;try{this.logger.debug({},"pingTimeout: Connection stalled, terminating..."),null==(a=null==(o=null==(i=null==(s=this.provider)?void 0:s.connection)?void 0:i.socket)?void 0:o.terminate)||a.call(o)}catch(c){this.logger.warn(c,c?.message)}},this.heartBeatTimeout))}),$t(this,"onPayloadHandler",s=>{this.onProviderPayload(s),this.resetPingTimeout()}),$t(this,"onConnectHandler",()=>{this.logger.warn({},"Relayer connected \u{1f6dc}"),this.startPingTimeout(),this.events.emit("relayer_connect")}),$t(this,"onDisconnectHandler",()=>{this.logger.warn({},"Relayer disconnected \u{1f6d1}"),this.requestsInFlight=[],this.onProviderDisconnect()}),$t(this,"onProviderErrorHandler",s=>{this.logger.fatal(`Fatal socket error: ${s.message}`),this.events.emit("relayer_error",s),this.logger.fatal("Fatal socket error received, closing transport"),this.transportExplicitlyClosed=!0,clearTimeout(this.reconnectTimeout),this.reconnectTimeout=void 0,this.reconnectInProgress=!1,this.transportClose().catch(i=>this.logger.warn(i))}),$t(this,"registerProviderListeners",()=>{this.provider.on("payload",this.onPayloadHandler),this.provider.on("connect",this.onConnectHandler),this.provider.on("disconnect",this.onDisconnectHandler),this.provider.on("error",this.onProviderErrorHandler)}),this.core=e.core,this.logger=Tf({logger:null!=(r=e.logger)?r:"error",name:this.name}),this.messages=new bR(this.logger,e.core),this.subscriber=new MR(this,this.logger),this.publisher=new TR(this,this.logger),this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||Qy,function II(){return ks()&&typeof global<"u"&&typeof(null==global?void 0:global.Platform)<"u"&&"android"===(null==global?void 0:global.Platform.OS)}()?this.packageName=Mm():function SI(){return ks()&&typeof global<"u"&&typeof(null==global?void 0:global.Platform)<"u"&&"ios"===(null==global?void 0:global.Platform.OS)}()&&(this.bundleId=Mm()),this.provider={}}init(){var e=this;return(0,l.A)(function*(){e.logger.trace("Initialized"),e.registerEventListeners(),yield Promise.all([e.messages.init(),e.subscriber.init()]),e.initialized=!0,e.transportOpen().catch(n=>e.logger.warn(n,n?.message))})()}get context(){return(0,Ct.oI)(this.logger)}get connected(){var e,n,r;return 1===(null==(r=null==(n=null==(e=this.provider)?void 0:e.connection)?void 0:n.socket)?void 0:r.readyState)||!1}get connecting(){var e,n,r;return 0===(null==(r=null==(n=null==(e=this.provider)?void 0:e.connection)?void 0:n.socket)?void 0:r.readyState)||void 0!==this.connectPromise||!1}publish(e,n,r){var s=this;return(0,l.A)(function*(){s.isInitialized(),yield s.publisher.publish(e,n,r),yield s.recordMessageEvent({topic:e,message:n,publishedAt:Date.now(),transportType:an.relay},"outbound")})()}publishCustom(e){var n=this;return(0,l.A)(function*(){n.isInitialized(),yield n.publisher.publishCustom(e)})()}subscribe(e,n){var r=this;return(0,l.A)(function*(){var s,i,o;r.isInitialized(),(null==n||!n.transportType||"relay"===n?.transportType)&&(yield r.toEstablishConnection());const a=typeof(null==(s=n?.internal)?void 0:s.throwOnFailedPublish)>"u"||(null==(i=n?.internal)?void 0:i.throwOnFailedPublish);let d,c=(null==(o=r.subscriber.topicMap.get(e))?void 0:o[0])||"";const h=b=>{b.topic===e&&(r.subscriber.off(gr_created,h),d())};return yield Promise.all([new Promise(b=>{d=b,r.subscriber.on(gr_created,h)}),new Promise(function(){var b=(0,l.A)(function*(M,J){c=(yield r.subscriber.subscribe(e,A_({internal:{throwOnFailedPublish:a}},n)).catch(te=>{a&&J(te)}))||c,M()});return function(M,J){return b.apply(this,arguments)}}())]),c})()}unsubscribe(e,n){var r=this;return(0,l.A)(function*(){r.isInitialized(),yield r.subscriber.unsubscribe(e,n)})()}on(e,n){this.events.on(e,n)}once(e,n){this.events.once(e,n)}off(e,n){this.events.off(e,n)}removeListener(e,n){this.events.removeListener(e,n)}transportDisconnect(){var e=this;return(0,l.A)(function*(){e.provider.disconnect&&(e.hasExperiencedNetworkDisruption||e.connected)?yield zr(e.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>e.onProviderDisconnect()):e.onProviderDisconnect()})()}transportClose(){var e=this;return(0,l.A)(function*(){e.transportExplicitlyClosed=!0,clearTimeout(e.stalledRestartTimeout),e.stalledRestartInProgress=!1,e.stalledRestartBackoff=0,yield e.resetTransport()})()}transportOpen(e){var n=this;return(0,l.A)(function*(){if(n.subscriber.hasAnyTopics){if(n.connectPromise?(n.logger.debug({},"Waiting for existing connection attempt to resolve..."),yield n.connectPromise,n.logger.debug({},"Existing connection attempt resolved")):(n.connectPromise=new Promise(function(){var r=(0,l.A)(function*(s,i){yield n.connect(e).then(s).catch(i).finally(()=>{n.connectPromise=void 0})});return function(s,i){return r.apply(this,arguments)}}()),yield n.connectPromise),!n.connected)throw new Error(`Couldn't establish socket connection to the relay server: ${n.relayUrl}`)}else n.logger.info("Starting WS connection skipped because the client has no topics to work with.")}
193)()}restartTransport(e){var n=this;return(0,l.A)(function*(){n.logger.debug({},"Restarting transport..."),!n.connectionAttemptInProgress&&(n.relayUrl=e||n.relayUrl,yield n.confirmOnlineStateOrThrow(),yield n.resetTransport(),yield n.transportOpen())})()}resetTransport(){var e=this;return(0,l.A)(function*(){e.reconnectInProgress=!0,clearTimeout(e.reconnectTimeout),e.reconnectTimeout=void 0,yield e.transportDisconnect(),yield e.subscriber.stop(),e.reconnectInProgress=!1})()}confirmOnlineStateOrThrow(){return(0,l.A)(function*(){if(!(yield Uy()))throw new Error("No internet connection detected. Please restart your network and try again.")})()}handleBatchMessageEvents(e){var n=this;return(0,l.A)(function*(){if(0===e?.length)return void n.logger.trace("Batch message events is empty. Ignoring...");const r=e.sort((s,i)=>s.publishedAt-i.publishedAt);n.logger.debug(`Batch of ${r.length} message events sorted`);for(const s of r)try{yield n.onMessageEvent(s)}catch(i){n.logger.warn(i,"Error while processing batch message event: "+i?.message)}n.logger.trace(`Batch of ${r.length} message events processed`)})()}onLinkMessageEvent(e,n){var r=this;return(0,l.A)(function*(){const{topic:s}=e;if(!n.sessionExists){const o={topic:s,expiry:yn(_.FIVE_MINUTES),relay:{protocol:"irn"},active:!1};yield r.core.pairing.pairings.set(s,o)}r.events.emit("relayer_message",e),yield r.recordMessageEvent(e,"inbound")})()}connect(e){var n=this;return(0,l.A)(function*(){yield n.confirmOnlineStateOrThrow(),e&&e!==n.relayUrl&&(n.relayUrl=e,yield n.transportDisconnect()),n.connectionAttemptInProgress=!0,n.transportExplicitlyClosed=!1;let r=1;for(;r<6;){try{if(n.transportExplicitlyClosed)break;n.logger.debug({},`Connecting to ${n.relayUrl}, attempt: ${r}...`),yield n.createProvider(),yield new Promise(function(){var s=(0,l.A)(function*(i,o){const a=()=>{o(new Error("Connection interrupted while trying to connect"))};n.provider.once("disconnect",a),yield zr(new Promise((c,d)=>{n.provider.connect().then(c).catch(d)}),n.connectTimeout,`Socket stalled when trying to connect to ${n.relayUrl}`).catch(c=>{o(c)}).finally(()=>{n.provider.off("disconnect",a),clearTimeout(n.reconnectTimeout)}),yield new Promise(function(){var c=(0,l.A)(function*(d,h){const b=()=>{o(new Error("Connection interrupted while trying to subscribe"))};n.provider.once("disconnect",b),yield n.subscriber.start().then(d).catch(h).finally(()=>{n.provider.off("disconnect",b)})});return function(d,h){return c.apply(this,arguments)}}()),n.hasExperiencedNetworkDisruption=!1,i()});return function(i,o){return s.apply(this,arguments)}}())}catch(s){yield n.subscriber.stop(),n.logger.warn({},s.message),n.hasExperiencedNetworkDisruption=!0}finally{n.connectionAttemptInProgress=!1}if(n.connected){n.logger.debug({},`Connected to ${n.relayUrl} successfully on attempt: ${r}`);break}yield new Promise(s=>setTimeout(s,(0,_.toMiliseconds)(1*r))),r++}})()}startPingTimeout(){var e,n,r,s,i;if(Ic())try{null!=(n=null==(e=this.provider)?void 0:e.connection)&&n.socket&&(null==(i=null==(s=null==(r=this.provider)?void 0:r.connection)?void 0:s.socket)||i.on("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(o){this.logger.warn(o,o?.message)}}createProvider(){var e=this;return(0,l.A)(function*(){e.provider.connection&&e.unregisterProviderListeners();const n=yield e.core.crypto.signJWT(e.relayUrl);e.provider=new xf(new iN(function RI({protocol:t,version:e,relayUrl:n,sdkVersion:r,auth:s,projectId:i,useOnCloseEvent:o,bundleId:a,packageName:c}){const d=n.split("?"),h=Lm(t,e,r),M=function TI(t,e){const n=new URLSearchParams(t);return Object.entries(e).sort(([r],[s])=>r.localeCompare(s)).forEach(([r,s])=>{null!=s&&n.set(r,String(s))}),n.toString()}(d[1]||"",{auth:s,ua:h,projectId:i,useOnCloseEvent:o||void 0,packageName:c||void 0,bundleId:a||void 0});return d[0]+"?"+M}({sdkVersion:Pf,protocol:e.protocol,version:e.version,relayUrl:e.relayUrl,projectId:e.projectId,auth:n,useOnCloseEvent:!0,bundleId:e.bundleId,packageName:e.packageName}))),e.registerProviderListeners()})()}recordMessageEvent(e,n){var r=this;return(0,l.A)(function*(){const{topic:s,message:i}=e;yield r.messages.set(s,i,n)})()}shouldIgnoreMessageEvent(e){var n=this;return(0,l.A)(function*(){const{topic:r,message:s}=e;
193if(!s||0===s.length)return n.logger.warn(`Ignoring invalid/empty message: ${s}`),!0;if(!(yield n.subscriber.isKnownTopic(r)))return n.logger.warn(`Ignoring message for unknown topic ${r}`),!0;const i=n.messages.has(r,s);return i&&n.logger.warn(`Ignoring duplicate message: ${s}`),i})()}onProviderPayload(e){var n=this;return(0,l.A)(function*(){if(n.logger.debug("Incoming Relay Payload"),n.logger.trace({type:"payload",direction:"incoming",payload:e}),Nf(e)){if(!e.method.endsWith("_subscription"))return;const r=e.params,{topic:s,message:i,publishedAt:o,attestation:a}=r.data,c={topic:s,message:i,publishedAt:o,transportType:an.relay,attestation:a};n.logger.debug("Emitting Relayer Payload"),n.logger.trace(A_({type:"event",event:r.id},c)),n.events.emit(r.id,c),yield n.acknowledgePayload(e),yield n.onMessageEvent(c)}else Qc(e)&&n.events.emit("relayer_message_ack",e)})()}onMessageEvent(e){var n=this;return(0,l.A)(function*(){(yield n.shouldIgnoreMessageEvent(e))||(yield n.recordMessageEvent(e,"inbound"),n.events.emit("relayer_message",e))})()}acknowledgePayload(e){var n=this;return(0,l.A)(function*(){const r=ha(e.id,!0);yield n.provider.connection.send(r)})()}unregisterProviderListeners(){this.provider.off("payload",this.onPayloadHandler),this.provider.off("connect",this.onConnectHandler),this.provider.off("disconnect",this.onDisconnectHandler),this.provider.off("error",this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}registerEventListeners(){var e=this;return(0,l.A)(function*(){let n=yield Uy();(function OO(t){switch($i()){case"browser":!function NO(t){!ks()&&ji()&&(window.addEventListener("online",()=>t(!0)),window.addEventListener("offline",()=>t(!1)))}(t);break;case"react-native":!function xO(t){ks()&&typeof global<"u"&&null!=global&&global.NetInfo&&global?.NetInfo.addEventListener(e=>t(e?.isConnected))}(t)}})(function(){var r=(0,l.A)(function*(s){n!==s&&(n=s,s?yield e.transportOpen().catch(i=>e.logger.error(i,i?.message)):(e.hasExperiencedNetworkDisruption=!0,yield e.transportDisconnect(),e.transportExplicitlyClosed=!1))});return function(s){return r.apply(this,arguments)}}()),e.core.heartbeat.on(z_pulse,(0,l.A)(function*(){if(!e.transportExplicitlyClosed&&!e.connected&&function RO(){var t;return!ji()||!(0,is.getDocument)()||"visible"===(null==(t=(0,is.getDocument)())?void 0:t.visibilityState)}())try{yield e.confirmOnlineStateOrThrow(),yield e.transportOpen()}catch(r){e.logger.warn(r,r?.message)}})),e.events.on("relayer_connection_stalled",()=>{if(e.transportExplicitlyClosed||e.stalledRestartInProgress)return;e.stalledRestartInProgress=!0;const r=0===e.stalledRestartBackoff?0:Math.min(Math.pow(2,e.stalledRestartBackoff-1)*e.stalledRestartBaseInterval,e.stalledRestartMaxInterval);e.stalledRestartBackoff++,e.logger.warn(`Connection stalled, restarting transport${r?` in ${r}ms`:""}...`),e.stalledRestartTimeout=setTimeout((0,l.A)(function*(){try{if(e.transportExplicitlyClosed)return;yield e.restartTransport()}catch(s){e.logger.error(s,s?.message)}finally{e.stalledRestartInProgress=!1}}),r)})})()}onProviderDisconnect(){var e=this;return(0,l.A)(function*(){clearTimeout(e.pingTimeout),e.events.emit("relayer_disconnect"),e.connectionAttemptInProgress=!1,!e.reconnectInProgress&&(e.reconnectInProgress=!0,yield e.subscriber.stop(),e.subscriber.hasAnyTopics&&(e.transportExplicitlyClosed||(e.reconnectTimeout=setTimeout((0,l.A)(function*(){yield e.transportOpen().catch(n=>e.logger.error(n,n?.message)),e.reconnectTimeout=void 0,e.reconnectInProgress=!1}),(0,_.toMiliseconds)(.1)))))})()}isInitialized(){if(!this.initialized){const{message:e}=et("NOT_INITIALIZED",this.name);throw new Error(e)}}toEstablishConnection(){var e=this;return(0,l.A)(function*(){if(yield e.confirmOnlineStateOrThrow(),!e.connected){if(e.connectPromise)return void(yield e.connectPromise);yield e.connect()}})()}}function I_(t){return Object.getOwnPropertySymbols(t).filter(e=>Object.prototype.propertyIsEnumerable.call(t,e))}function S_(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const T_="[object Arguments]",jf="[object Object]";function O_(t){if(!t||"object"!=typeof t)return!1;const e=Object.getPrototypeOf(t);return(null===e||e===Object.prototype||null===Object.getPrototypeOf(e))&&"[object Object]"===Object.prototype.toString.call(t)}function Ea(t,e,n,r,s,i,o){const a=o(t,e,n,r,s,i);if(void 0!==a)return a;
193if(typeof t==typeof e)switch(typeof t){case"bigint":case"string":case"boolean":case"symbol":case"undefined":case"function":return t===e;case"number":return t===e||Object.is(t,e);case"object":return va(t,e,i,o)}return va(t,e,i,o)}function va(t,e,n,r){if(Object.is(t,e))return!0;let s=S_(t),i=S_(e);if(s===T_&&(s=jf),i===T_&&(i=jf),s!==i)return!1;switch(s){case"[object String]":return t.toString()===e.toString();case"[object Number]":return function jR(t,e){return t===e||Number.isNaN(t)&&Number.isNaN(e)}(t.valueOf(),e.valueOf());case"[object Boolean]":case"[object Date]":case"[object Symbol]":return Object.is(t.valueOf(),e.valueOf());case"[object RegExp]":return t.source===e.source&&t.flags===e.flags;case"[object Function]":return t===e}const o=(n=n??new Map).get(t),a=n.get(e);if(null!=o&&null!=a)return o===e;n.set(t,e),n.set(e,t);try{switch(s){case"[object Map]":if(t.size!==e.size)return!1;for(const[c,d]of t.entries())if(!e.has(c)||!Ea(d,e.get(c),c,t,e,n,r))return!1;return!0;case"[object Set]":{if(t.size!==e.size)return!1;const c=Array.from(t.values()),d=Array.from(e.values());for(let h=0;h<c.length;h++){const b=c[h],M=d.findIndex(J=>Ea(b,J,void 0,t,e,n,r));if(-1===M)return!1;d.splice(M,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(typeof Rf<"u"&&Rf.isBuffer(t)!==Rf.isBuffer(e)||t.length!==e.length)return!1;for(let c=0;c<t.length;c++)if(!Ea(t[c],e[c],c,t,e,n,r))return!1;return!0;case"[object ArrayBuffer]":return t.byteLength===e.byteLength&&va(new Uint8Array(t),new Uint8Array(e),n,r);case"[object DataView]":return t.byteLength===e.byteLength&&t.byteOffset===e.byteOffset&&va(new Uint8Array(t),new Uint8Array(e),n,r);case"[object Error]":return t.name===e.name&&t.message===e.message;case jf:{if(!(va(t.constructor,e.constructor,n,r)||O_(t)&&O_(e)))return!1;const c=[...Object.keys(t),...I_(t)],d=[...Object.keys(e),...I_(e)];if(c.length!==d.length)return!1;for(let h=0;h<c.length;h++){const b=c[h],M=t[b];if(!Object.hasOwn(e,b))return!1;if(!Ea(M,e[b],b,t,e,n,r))return!1}return!0}default:return!1}}finally{n.delete(t),n.delete(e)}}function h3(){}var g3=Object.defineProperty,N_=Object.getOwnPropertySymbols,m3=Object.prototype.hasOwnProperty,y3=Object.prototype.propertyIsEnumerable,$f=(t,e,n)=>e in t?g3(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,x_=(t,e)=>{for(var n in e||(e={}))m3.call(e,n)&&$f(t,n,e[n]);if(N_)for(var n of N_(e))y3.call(e,n)&&$f(t,n,e[n]);return t},cr=(t,e,n)=>$f(t,"symbol"!=typeof e?e+"":e,n);class bi extends Ai{constructor(e,n,r,s=Jr,i=void 0){var o;super(e,n,r,s),o=this,this.core=e,this.logger=n,this.name=r,cr(this,"map",new Map),cr(this,"version","0.3"),cr(this,"cached",[]),cr(this,"initialized",!1),cr(this,"getKey"),cr(this,"storagePrefix",Jr),cr(this,"recentlyDeleted",[]),cr(this,"recentlyDeletedLimit",200),cr(this,"init",(0,l.A)(function*(){o.initialized||(o.logger.trace("Initialized"),yield o.restore(),o.cached.forEach(a=>{o.getKey&&null!==a&&!An(a)?o.map.set(o.getKey(a),a):function iO(t){var e;return null==(e=t?.proposer)?void 0:e.publicKey}(a)?o.map.set(a.id,a):function oO(t){return t?.topic}(a)&&o.map.set(a.topic,a)}),o.cached=[],o.initialized=!0)})),cr(this,"set",function(){var a=(0,l.A)(function*(c,d){o.isInitialized(),o.map.has(c)?yield o.update(c,d):(o.logger.debug("Setting value"),o.logger.trace({type:"method",method:"set",key:c,value:d}),o.map.set(c,d),yield o.persist())});return function(c,d){return a.apply(this,arguments)}}()),cr(this,"get",a=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:a}),this.getData(a))),cr(this,"getAll",a=>(this.isInitialized(),a?this.values.filter(c=>Object.keys(a).every(d=>function p3(t,e){return function f3(t,e,n){return Ea(t,e,void 0,void 0,void 0,void 0,n)}(t,e,h3)}(c[d],a[d]))):this.values)),cr(this,"update",function(){var a=(0,l.A)(function*(c,d){o.isInitialized(),o.logger.debug("Updating value"),o.logger.trace({type:"method",method:"update",key:c,update:d});const h=x_(x_({},o.getData(c)),d);o.map.set(c,h),yield o.persist()});return function(c,d){return a.apply(this,arguments)}}()),cr(this,"delete",function(){var a=(0,l.A)(function*(c,d){o.isInitialized(),o.map.has(c)&&(o.logger.debug("Deleting value"),o.logger.trace({type:"method",method:"delete",ke
193y:c,reason:d}),o.map.delete(c),o.addToRecentlyDeleted(c),yield o.persist())});return function(c,d){return a.apply(this,arguments)}}()),this.logger=(0,Ct.U5)(n,this.name),this.storagePrefix=s,this.getKey=i}get context(){return(0,Ct.oI)(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)}setDataStore(e){var n=this;return(0,l.A)(function*(){yield n.core.storage.setItem(n.storageKey,e)})()}getDataStore(){var e=this;return(0,l.A)(function*(){return yield e.core.storage.getItem(e.storageKey)})()}getData(e){const n=this.map.get(e);if(!n){if(this.recentlyDeleted.includes(e)){const{message:s}=et("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(s),new Error(s)}const{message:r}=et("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(r),new Error(r)}return n}persist(){var e=this;return(0,l.A)(function*(){yield e.setDataStore(e.values)})()}restore(){var e=this;return(0,l.A)(function*(){try{const n=yield e.getDataStore();if(typeof n>"u"||!n.length)return;if(e.map.size){const{message:r}=et("RESTORE_WILL_OVERRIDE",e.name);throw e.logger.error(r),new Error(r)}e.cached=n,e.logger.debug(`Successfully Restored value for ${e.name}`),e.logger.trace({type:"method",method:"restore",value:e.values})}catch(n){e.logger.debug(`Failed to Restore value for ${e.name}`),e.logger.error(n)}})()}isInitialized(){if(!this.initialized){const{message:e}=et("NOT_INITIALIZED",this.name);throw new Error(e)}}}var _3=Object.defineProperty,Kt=(t,e,n)=>((t,e,n)=>e in t?_3(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,"symbol"!=typeof e?e+"":e,n);class v3{constructor(e,n){var r=this;this.core=e,this.logger=n,Kt(this,"name","pairing"),Kt(this,"version","0.3"),Kt(this,"events",new O),Kt(this,"pairings"),Kt(this,"initialized",!1),Kt(this,"storagePrefix",Jr),Kt(this,"ignoredPayloadTypes",[1]),Kt(this,"registeredMethods",[]),Kt(this,"init",(0,l.A)(function*(){r.initialized||(yield r.pairings.init(),yield r.cleanup(),r.registerRelayerEvents(),r.registerExpirerEvents(),r.initialized=!0,r.logger.trace("Initialized"))})),Kt(this,"register",({methods:s})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...s])]}),Kt(this,"create",function(){var s=(0,l.A)(function*(i){r.isInitialized();const o=vf(),a=yield r.core.crypto.setSymKey(o),c=yn(_.FIVE_MINUTES),d={protocol:"irn"},h={topic:a,expiry:c,relay:d,active:!1,methods:i?.methods},b=Ay({protocol:r.core.protocol,version:r.core.version,topic:a,symKey:o,relay:d,expiryTimestamp:c,methods:i?.methods});return r.events.emit("pairing_create",h),r.core.expirer.set(a,c),yield r.pairings.set(a,h),yield r.core.relayer.subscribe(a,{transportType:i?.transportType,internal:i?.internal}),{topic:a,uri:b}});return function(i){return s.apply(this,arguments)}}()),Kt(this,"pair",function(){var s=(0,l.A)(function*(i){r.isInitialized();const o=r.core.eventClient.createEvent({properties:{topic:i?.uri,trace:["pairing_started"]}});r.isValidPair(i,o);const{topic:a,symKey:c,relay:d,expiryTimestamp:h,methods:b}=Cy(i.uri);let M;if(o.props.properties.topic=a,o.addTrace("pairing_uri_validation_success"),o.addTrace("pairing_uri_not_expired"),r.pairings.keys.includes(a)){if(M=r.pairings.get(a),o.addTrace("existing_pairing"),M.active)throw o.setError("active_pairing_already_exists"),new Error(`Pairing already exists: ${a}. Please try again with a new connection URI.`);o.addTrace("pairing_not_expired")}const J=h||yn(_.FIVE_MINUTES),te={topic:a,relay:d,expiry:J,active:!1,methods:b};r.core.expirer.set(a,J),yield r.pairings.set(a,te),o.addTrace("store_new_pairing"),i.activatePairing&&(yield r.activate({topic:a})),r.events.emit("pairing_create",te),o.addTrace("emit_inactive_pairing"),r.core.crypto.keychain.has(a)||(yield r.core.crypto.setSymKey(c,a)),o.addTrace("subscribing_pairing_topic");try{yield r.core.relayer.confirmOnlineStateOrThrow()}catch{o.setError("no_internet_connection")}try{yield r.core.relayer.subscribe(a,{relay:d})}catch(re){throw o.setError("subscribe_pairing_topic_failure"),re}return o.addTrace("subscribe_pairing_topic_success"),te});return function(i){return s.apply(this,arguments)}}()),Kt(this,"activate",function(){var s=(0,l.A)(function*({topic:i}){r.isInitialized();const o=yn(_.FIVE_MINUTES);r.core.expirer.set(i,o),yield r.pairings.update(i,{active:!0,expiry:o})});return function(i){return s.apply(this,arguments)}}()),Kt(this,"ping",function(){var s=(0,l.A)(function*(i){r.isInitialized(),yield r.isValidPing(i),r.logger.warn("ping() is deprecated and will be removed in the next major release.");const{topic:o}=i;if(r.pairings.keys.includes(o)){const a=yield r.sendRequest(o,"wc_pairingPing",{}),{done:c,resolve:d,reject:h}=di();r.events.once(Jt("pairing_ping",a),({error:b})=>{b?h(b):d()}),yield c()}});return function(i){return s.apply(this,arguments)}}()),Kt(this,"updateExpiry",function(){var s=(0,l.A)(function*({topic:i,expiry:o}){r.isInitialized(),yield r.pairings.update(i,{expiry:o})});return function(i){return s.apply(this,arguments)}}()),Kt(this,"updateMetadata",function(){var s=(0,l.A)(function*({topic:i,metadata:o}){r.isInitialized(),yield r.pairings.update(i,{peerMetadata:o})});return function(i){return s.apply(this,arguments)}}()),Kt(this,"getPairings",()=>(this.isInitialized(),this.pairings.values)),Kt(this,"disconnect",function(){var s=(0,l.A)(function*(i){r.isInitialized(),yield r.isValidDisconnect(i);const{topic:o}=i;r.pairings.keys.includes(o)&&(yield r.sendRequest(o,"wc_pairingDelete",cn("USER_DISCONNECTED")),yield r.deletePairing(o))});return function(i){return s.apply(this,arguments)}}()),Kt(this,"formatUriFromPairing",s=>{this.isInitialized();const{topic:i,relay:o,expiry:a,methods:c}=s,d=this.core.crypto.keychain.get(i);return Ay({protocol:this.core.protocol,version:this.core.version,topic:i,symKey:d,relay:o,expiryTimestamp:a,methods:c})}),Kt(this,"sendRequest",function(){var s=(0,l.A)(function*(i,o,a){const c=Ur(o,a),d=yield r.core.crypto.encode(i,c),h=pa[o].req;return r.core.history.set(i,c),r.core.relayer.publish(i,d,h),c.id});return function(i,o,a){return s.apply(this,arguments)}}()),Kt(this,"sendResult",function(){var s=(0,l.A)(function*(i,o,a){const c=ha(i,a),d=yield r.core.crypto.encode(o,c),h=(yield r.core.history.get(o,i)).request.method,b=pa[h].res;yield r.core.relayer.publish(o,d,b),yield r.core.history.resolve(c)});return function(i,o,a){return s.apply(this,arguments)}}()),Kt(this,"sendError",function(){var s=(0,l.A)(function*(i,o,a){const c=Xc(i,a),d=yield r.core.crypto.encode(o,c),h=(yield r.core.history.get(o,i)).request.method,b=pa[h]?pa[h].res:pa.unregistered_method.res;yield r.core.relayer.publish(o,d,b),yield r.core.history.resolve(c)});return function(i,o,a){return s.apply(this,arguments)}}()),Kt(this,"deletePairing",function(){var s=(0,l.A)(function*(i,o){yield r.core.relayer.unsubscribe(i),yield Promise.all([r.pairings.delete(i,cn("USER_DISCONNECTED")),r.core.crypto.deleteSymKey(i),o?Promise.resolve():r.core.expirer.del(i)])});return function(i,o){return s.apply(this,arguments)}}()),Kt(this,"cleanup",(0,l.A)(function*(){const s=r.pairings.getAll().filter(i=>Vr(i.expiry));yield Promise.all(s.map(i=>r.deletePairing(i.topic)))})),Kt(this,"onRelayEventRequest",function(){var s=(0,l.A)(function*(i){const{topic:o,payload:a}=i;switch(a.method){case"wc_pairingPing":return yield r.onPairingPingRequest(o,a);case"wc_pairingDelete":return yield r.onPairingDeleteRequest(o,a);default:return yield r.onUnknownRpcMethodRequest(o,a)}});return function(i){return s.apply(this,arguments)}}()),Kt(this,"onRelayEventResponse",function(){var s=(0,l.A)(function*(i){const{topic:o,payload:a}=i,c=(yield r.core.history.get(o,a.id)).request.method;return"wc_pairingPing"===c?r.onPairingPingResponse(o,a):r.onUnknownRpcMethodResponse(c)});return function(i){return s.apply(this,arguments)}}()),Kt(this,"onPairingPingRequest",function(){var s=(0,l.A)(function*(i,o){const{id:a}=o;try{r.isValidPing({topic:i}),yield r.sendResult(a,i,!0),r.events.emit("pairing_ping",{id:a,topic:i})}catch(c){yield r.sendError(a,i,c),r.logger.error(c)}});return function(i,o){return s.apply(this,arguments)}}()),Kt(this,"onPairingPingResponse",(s,i)=>{const{id:o}=i;setTimeout(()=>{Zr(i)?this.events.emit(Jt("pairing_ping",o),{}):Cr(i)&&this.events.emit(Jt("pairing_ping",o),{error:i.error})},500)}),Kt(this,"onPairingDeleteRequest",function(){var s=(0,l.A)(function*(i,o){const{id:a}=o;try{r.isValidDisconnect({topic:i}),yield r.deletePairing(i),r.events.emit("pairing_delete",{id:a,topic:i})}catch(c){yield r.sendError(a,i,c),r.logger.error(c)}});return function(i,o){return s.apply(this,arguments)}}()),Kt(this,"onUnknownRpcMethodRequest",function(){var s=(0,l.A)(function*(i,o){const{id:a,method:c}=o;try{if(r.registeredMethods.includes(c))return;const d=cn("WC_METHOD_UNSUPPORTED",c);yield r.sendError(a,i,d),r.logger.error(d)}catch(d){yield r.sendError(a,i,d),r.logger.error(d)}});return function(i,o){return s.apply(this,arguments)}}()),Kt(this,"onUnknownRpcMethodResponse",s=>{this.registeredMethods.includes(s)||this.logger.error(cn("WC_METHOD_UNSUPPORTED",s))}),Kt(this,"isValidPair",(s,i)=>{var o;if(!ar(s)){const{message:c}=et("MISSING_OR_INVALID",`pair() params: ${s}`);throw i.setError("malformed_pairing_uri"),new Error(c)}if(!function sO(t){function e(n){try{return typeof new URL(n)<"u"}catch{return!1}}try{if(_n(t,!1))return!!e(t)||e(Km(t))}catch{}return!1}(s.uri)){const{message:c}=et("MISSING_OR_INVALID",`pair() uri: ${s.uri}`);throw i.setError("malformed_pairing_uri"),new Error(c)}const a=Cy(s?.uri);if(null==(o=a?.relay)||!o.protocol){const{message:c}=et("MISSING_OR_INVALID","pair() uri#relay-protocol");throw i.setError("malformed_pairing_uri"),new Error(c)}if(null==a||!a.symKey){const{message:c}=et("MISSING_OR_INVALID","pair() uri#symKey");throw i.setError("malformed_pairing_uri"),new Error(c)}if(null!=a&&a.expiryTimestamp&&(0,_.toMiliseconds)(a?.expiryTimestamp)<Date.now()){i.setError("pairing_expired");const{message:c}=et("EXPIRED","pair() URI has expired. Please try again with a new connection URI.");throw new Error(c)}}
193),Kt(this,"isValidPing",function(){var s=(0,l.A)(function*(i){if(!ar(i)){const{message:a}=et("MISSING_OR_INVALID",`ping() params: ${i}`);throw new Error(a)}const{topic:o}=i;yield r.isValidPairingTopic(o)});return function(i){return s.apply(this,arguments)}}()),Kt(this,"isValidDisconnect",function(){var s=(0,l.A)(function*(i){if(!ar(i)){const{message:a}=et("MISSING_OR_INVALID",`disconnect() params: ${i}`);throw new Error(a)}const{topic:o}=i;yield r.isValidPairingTopic(o)});return function(i){return s.apply(this,arguments)}}()),Kt(this,"isValidPairingTopic",function(){var s=(0,l.A)(function*(i){if(!_n(i,!1)){const{message:o}=et("MISSING_OR_INVALID",`pairing topic should be a string: ${i}`);throw new Error(o)}if(!r.pairings.keys.includes(i)){const{message:o}=et("NO_MATCHING_KEY",`pairing topic doesn't exist: ${i}`);throw new Error(o)}if(Vr(r.pairings.get(i).expiry)){yield r.deletePairing(i);const{message:o}=et("EXPIRED",`pairing topic: ${i}`);throw new Error(o)}});return function(i){return s.apply(this,arguments)}}()),this.core=e,this.logger=(0,Ct.U5)(n,this.name),this.pairings=new bi(this.core,this.logger,this.name,this.storagePrefix)}get context(){return(0,Ct.oI)(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=et("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){var e=this;this.core.relayer.on("relayer_message",function(){var n=(0,l.A)(function*(r){const{topic:s,message:i,transportType:o}=r;if(e.pairings.keys.includes(s)&&o!==an.link_mode&&!e.ignoredPayloadTypes.includes(e.core.crypto.getPayloadType(i)))try{const a=yield e.core.crypto.decode(s,i);Nf(a)?(e.core.history.set(s,a),yield e.onRelayEventRequest({topic:s,payload:a})):Qc(a)&&(yield e.core.history.resolve(a),yield e.onRelayEventResponse({topic:s,payload:a}),e.core.history.delete(s,a.id)),yield e.core.relayer.messages.ack(s,i)}catch(a){e.logger.error(a)}});return function(r){return n.apply(this,arguments)}}())}registerExpirerEvents(){var e=this;this.core.expirer.on(Ir_expired,function(){var n=(0,l.A)(function*(r){const{topic:s}=Wm(r.target);s&&e.pairings.keys.includes(s)&&(yield e.deletePairing(s,!0),e.events.emit("pairing_expire",{topic:s}))});return function(r){return n.apply(this,arguments)}}())}}var b3=Object.defineProperty,Dn=(t,e,n)=>((t,e,n)=>e in t?b3(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,"symbol"!=typeof e?e+"":e,n);class C3 extends ts{constructor(e,n){var r;super(e,n),r=this,this.core=e,this.logger=n,Dn(this,"records",new Map),Dn(this,"events",new O.EventEmitter),Dn(this,"name","history"),Dn(this,"version","0.3"),Dn(this,"cached",[]),Dn(this,"initialized",!1),Dn(this,"storagePrefix",Jr),Dn(this,"init",(0,l.A)(function*(){r.initialized||(r.logger.trace("Initialized"),yield r.restore(),r.cached.forEach(s=>r.records.set(s.id,s)),r.cached=[],r.registerEventListeners(),r.initialized=!0)})),Dn(this,"set",(s,i,o)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:s,request:i,chainId:o}),this.records.has(i.id))return;const a={id:i.id,topic:s,request:{method:i.method,params:i.params||null},chainId:o,expiry:yn(_.THIRTY_DAYS)};this.records.set(a.id,a),this.persist(),this.events.emit("history_created",a)}),Dn(this,"resolve",function(){var s=(0,l.A)(function*(i){if(r.isInitialized(),r.logger.debug("Updating JSON-RPC response history record"),r.logger.trace({type:"method",method:"update",response:i}),!r.records.has(i.id))return;const o=yield r.getRecord(i.id);typeof o.response>"u"&&(o.response=Cr(i)?{error:i.error}:{result:i.result},r.records.set(o.id,o),r.persist(),r.events.emit("history_updated",o))});return function(i){return s.apply(this,arguments)}}()),Dn(this,"get",function(){var s=(0,l.A)(function*(i,o){return r.isInitialized(),r.logger.debug("Getting record"),r.logger.trace({type:"method",method:"get",topic:i,id:o}),yield r.getRecord(o)});return function(i,o){return s.apply(this,arguments)}}()),Dn(this,"delete",(s,i)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:i}
193),this.values.forEach(o=>{if(o.topic===s){if(typeof i<"u"&&o.id!==i)return;this.records.delete(o.id),this.events.emit("history_deleted",o)}}),this.persist()}),Dn(this,"exists",function(){var s=(0,l.A)(function*(i,o){return r.isInitialized(),!!r.records.has(o)&&(yield r.getRecord(o)).topic===i});return function(i,o){return s.apply(this,arguments)}}()),Dn(this,"on",(s,i)=>{this.events.on(s,i)}),Dn(this,"once",(s,i)=>{this.events.once(s,i)}),Dn(this,"off",(s,i)=>{this.events.off(s,i)}),Dn(this,"removeListener",(s,i)=>{this.events.removeListener(s,i)}),this.logger=(0,Ct.U5)(n,this.name)}get context(){return(0,Ct.oI)(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(){const e=[];return this.values.forEach(n=>{if(typeof n.response<"u")return;const r={topic:n.topic,request:Ur(n.request.method,n.request.params,n.id),chainId:n.chainId};return e.push(r)}),e}setJsonRpcRecords(e){var n=this;return(0,l.A)(function*(){yield n.core.storage.setItem(n.storageKey,e)})()}getJsonRpcRecords(){var e=this;return(0,l.A)(function*(){return yield e.core.storage.getItem(e.storageKey)})()}getRecord(e){this.isInitialized();const n=this.records.get(e);if(!n){const{message:r}=et("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(r)}return n}persist(){var e=this;return(0,l.A)(function*(){yield e.setJsonRpcRecords(e.values),e.events.emit("history_sync")})()}restore(){var e=this;return(0,l.A)(function*(){try{const n=yield e.getJsonRpcRecords();if(typeof n>"u"||!n.length)return;if(e.records.size){const{message:r}=et("RESTORE_WILL_OVERRIDE",e.name);throw e.logger.error(r),new Error(r)}e.cached=n,e.logger.debug(`Successfully Restored records for ${e.name}`),e.logger.trace({type:"method",method:"restore",records:e.values})}catch(n){e.logger.debug(`Failed to Restore records for ${e.name}`),e.logger.error(n)}})()}registerEventListeners(){this.events.on("history_created",e=>{const n="history_created";this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,record:e})}),this.events.on("history_updated",e=>{const n="history_updated";this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,record:e})}),this.events.on("history_deleted",e=>{const n="history_deleted";this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,record:e})}),this.core.heartbeat.on(z_pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(n=>{(0,_.toMiliseconds)(n.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${n.id}`),this.records.delete(n.id),this.events.emit("history_deleted",n,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=et("NOT_INITIALIZED",this.name);throw new Error(e)}}}var A3=Object.defineProperty,zn=(t,e,n)=>((t,e,n)=>e in t?A3(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,"symbol"!=typeof e?e+"":e,n);class S3 extends fl{constructor(e,n){var r;super(e,n),r=this,this.core=e,this.logger=n,zn(this,"expirations",new Map),zn(this,"events",new O.EventEmitter),zn(this,"name","expirer"),zn(this,"version","0.3"),zn(this,"cached",[]),zn(this,"initialized",!1),zn(this,"storagePrefix",Jr),zn(this,"init",(0,l.A)(function*(){r.initialized||(r.logger.trace("Initialized"),yield r.restore(),r.cached.forEach(s=>r.expirations.set(s.target,s)),r.cached=[],r.registerEventListeners(),r.initialized=!0)})),zn(this,"has",s=>{try{const i=this.formatTarget(s);return typeof this.getExpiration(i)<"u"}catch{return!1}}),zn(this,"set",(s,i)=>{this.isInitialized();const o=this.formatTarget(s),a={target:o,expiry:i};this.expirations.set(o,a),this.checkExpiry(o,a),this.events.emit("expirer_created",{target:o,expiration:a})}),zn(this,"get",s=>{this.isInitialized();const i=this.formatTarget(s);return this.getExpiration(i)}),zn(this,"del",s=>{if(this.isInitialized(),this.has(s)){const i=this.formatTarget(s),o=this.getExpiration(i);this.expirations.delete(i),this.events.emit("expirer_deleted",{target:i,expiration:o})}}),zn(this,"on",(s,i)=>{this.events.on(s,i)}),zn(this,"once",(s,i)=>{this.events.once(s,i)}),zn(this,"off",(s,i)=>{this.events.off(s,i)}),zn(this,"removeListener",(s,i)=>{this.events.removeListener(s,i)}),this.logger=(0,Ct.U5)(n,this.name)}get context(){return(0,Ct.oI)(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 function kI(t){return Fm("topic",t)}(e);if("number"==typeof e)return function MI(t){return Fm("id",t)}(e);const{message:n}=et("UNKNOWN_TYPE","Target type: "+typeof e);throw new Error(n)}setExpirations(e){var n=this;return(0,l.A)(function*(){yield n.core.storage.setItem(n.storageKey,e)})()}getExpirations(){var e=this;return(0,l.A)(function*(){return yield e.core.storage.getItem(e.storageKey)})()}persist(){var e=this;return(0,l.A)(function*(){yield e.setExpirations(e.values),e.events.emit("expirer_sync")})()}restore(){var e=this;return(0,l.A)(function*(){try{const n=yield e.getExpirations();if(typeof n>"u"||!n.length)return;if(e.expirations.size){const{message:r}=et("RESTORE_WILL_OVERRIDE",e.name);throw e.logger.error(r),new Error(r)}
193e.cached=n,e.logger.debug(`Successfully Restored expirations for ${e.name}`),e.logger.trace({type:"method",method:"restore",expirations:e.values})}catch(n){e.logger.debug(`Failed to Restore expirations for ${e.name}`),e.logger.error(n)}})()}getExpiration(e){const n=this.expirations.get(e);if(!n){const{message:r}=et("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(r),new Error(r)}return n}checkExpiry(e,n){const{expiry:r}=n;(0,_.toMiliseconds)(r)-Date.now()<=0&&this.expire(e,n)}expire(e,n){this.expirations.delete(e),this.events.emit(Ir_expired,{target:e,expiration:n})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,n)=>this.checkExpiry(n,e))}registerEventListeners(){this.core.heartbeat.on(z_pulse,()=>this.checkExpirations()),this.events.on("expirer_created",e=>{const n="expirer_created";this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,data:e}),this.persist()}),this.events.on(Ir_expired,e=>{const n=Ir_expired;this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,data:e}),this.persist()}),this.events.on("expirer_deleted",e=>{const n="expirer_deleted";this.logger.info(`Emitting ${n}`),this.logger.debug({type:"event",event:n,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=et("NOT_INITIALIZED",this.name);throw new Error(e)}}}var T3=Object.defineProperty,En=(t,e,n)=>((t,e,n)=>e in t?T3(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,"symbol"!=typeof e?e+"":e,n);class N3 extends hl{constructor(e,n,r){var s;super(e,n,r),s=this,this.core=e,this.logger=n,this.store=r,En(this,"name","verify-api"),En(this,"abortController"),En(this,"isDevEnv"),En(this,"verifyUrlV3",PN),En(this,"storagePrefix",Jr),En(this,"version",2),En(this,"publicKey"),En(this,"fetchPromise"),En(this,"init",(0,l.A)(function*(){var i;s.isDevEnv||(s.publicKey=yield s.store.getItem(s.storeKey),s.publicKey&&(0,_.toMiliseconds)(null==(i=s.publicKey)?void 0:i.expiresAt)<Date.now()&&(s.logger.debug("verify v2 public key expired"),yield s.removePublicKey()))})),En(this,"register",function(){var i=(0,l.A)(function*(o){if(!ji()||s.isDevEnv)return;const a=window.location.origin,{id:c,decryptedId:d}=o,h=`${s.verifyUrlV3}/attestation?projectId=${s.core.projectId}&origin=${a}&id=${c}&decryptedId=${d}`;try{const b=(0,is.getDocument)(),M=s.startAbortTimer(5*_.ONE_SECOND),J=yield new Promise((te,re)=>{const ae=()=>{window.removeEventListener("message",Se),b.body.removeChild(ye),re("attestation aborted")};s.abortController.signal.addEventListener("abort",ae);const ye=b.createElement("iframe");ye.src=h,ye.style.display="none",ye.addEventListener("error",ae,{signal:s.abortController.signal});const Se=oe=>{if(oe.data&&"string"==typeof oe.data)try{const pe=JSON.parse(oe.data);if("verify_attestation"===pe.type){if(za(pe.attestation).payload.id!==c)return;clearInterval(M),b.body.removeChild(ye),s.abortController.signal.removeEventListener("abort",ae),window.removeEventListener("message",Se),te(null===pe.attestation?"":pe.attestation)}}catch(pe){s.logger.warn(pe)}};b.body.appendChild(ye),window.addEventListener("message",Se,{signal:s.abortController.signal})});return s.logger.debug(J,"jwt attestation"),J}catch(b){s.logger.warn(b)}return""});return function(o){return i.apply(this,arguments)}}()),En(this,"resolve",function(){var i=(0,l.A)(function*(o){if(s.isDevEnv)return"";const{attestationId:a,hash:c,encryptedId:d}=o;if(""===a)return void s.logger.debug("resolve: attestationId is empty, skipping");if(a){if(za(a).payload.id!==d)return;const b=yield s.isValidJwtAttestation(a);if(b)return b.isVerified?b:void s.logger.warn("resolve: jwt attestation: origin url not verified")}if(!c)return;const h=s.getVerifyUrl(o?.verifyUrl);return s.fetchAttestation(c,h)});return function(o){return i.apply(this,arguments)}}()),En(this,"fetchAttestation",function(){var i=(0,l.A)(function*(o,a){s.logger.debug(`resolving attestation: ${o} from url: ${a}`);const c=s.startAbortTimer(5*_.ONE_SECOND),d=yield fetch(`${a}/attestation/${o}?v2Supported=true`,{signal:s.abortController.signal});return clearTimeout(c),200===d.status?yield d.json():void 0});return function(o,a){return i.apply(this,arguments)}}()),En(this,"getVerifyUrl",i=>{let o=i||ga;return DN.includes(o)||(this.logger.info(`verify url: ${o}, not included in trusted list, assigning default: ${ga}`),o=ga),o}),En(this,"fetchPublicKey",(0,l.A)(function*(){try{s.logger.debug(`fetching public key from: ${s.verifyUrlV3}`);const i=s.startAbortTimer(_.FIVE_SECONDS),o=yield fetch(`${s.verifyUrlV3}/public-key`,{signal:s.abortController.signal});return clearTimeout(i),yield o.json()}catch(i){s.logger.warn(i)}})),En(this,"persistPublicKey",function(){var i=(0,l.A)(function*(o){s.logger.debug(o,"persisting public key to local storage"),yield s.store.setItem(s.storeKey,o),s.publicKey=o});return function(o){return i.apply(this,arguments)}}()),En(this,"removePublicKey",(0,l.A)(function*(){s.logger.debug("removing verify v2 public key from storage"),yield s.store.removeItem(s.storeKey),s.publicKey=void 0})),En(this,"isValidJwtAttestation",function(){var i=(0,l.A)(function*(o){const a=yield s.getPublicKey();try{if(a)return s.validateAttestation(o,a)}catch(d){s.logger.error(d),s.logger.warn("error validating attestation")}const c=yield s.fetchAndPersistPublicKey();try{if(c)return s.validateAttestation(o,c)}catch(d){s.logger.error(d),s.logger.warn("error validating attestation")}});return function(o){return i.apply(this,arguments)}}()),En(this,"getPublicKey",(0,l.A)(function*(){return s.publicKey?s.publicKey:yield s.fetchAndPersistPublicKey()})),En(this,"fetchAndPersistPublicKey",(0,l.A)(function*(){if(s.fetchPromise)return yield s.fetchPromise,s.publicKey;s.fetchPromise=new Promise(function(){var o=(0,l.A)(function*(a){const c=yield s.fetchPublicKey();c&&(yield s.persistPublicKey(c),a(c))});return function(a){return o.apply(this,arguments)}}());const i=yield s.fetchPromise;return s.fetchPromise=void 0,i})),En(this,"validateAttestation",(i,o)=>{const a=function PT(t,e){const[n,r,s]=t.split("."),i=sn.from(my(s),"base64");if(64!==i.length)throw new Error("Invalid signature length");const o=i.slice(0,32),a=i.slice(32,64),d=Mc(`${n}.${r}`),h=function RT(t){const e=sn.from(t.x,"base64"),n=sn.from(t.y,"base64");return Zo([new Uint8Array([4]),e,n])}(e);if(!wT.verify(Zo([o,a]),d,h))throw new Error("Invalid signature");return za(t).payload}(i,o.publicKey),c={hasExpired:(0,_.toMiliseconds)(a.exp)<Date.now(),payload:a};if(c.hasExpired)throw this.logger.warn("resolve: jwt attestation expired"),new Error("JWT attestation expired");return{origin:c.payload.origin,isScam:c.payload.isScam,isVerified:c.payload.isVerified}}),this.logger=(0,Ct.U5)(n,this.name),this.abortController=new AbortController,this.isDevEnv=Bd(),this.init()}get storeKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//verify:public:key"}
193get context(){return(0,Ct.oI)(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),(0,_.toMiliseconds)(e))}}var x3=Object.defineProperty,R_=(t,e,n)=>((t,e,n)=>e in t?x3(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,"symbol"!=typeof e?e+"":e,n);class P3 extends pl{constructor(e,n){var r;super(e,n),r=this,this.projectId=e,this.logger=n,R_(this,"context","echo"),R_(this,"registerDeviceToken",function(){var s=(0,l.A)(function*(i){const{clientId:o,token:a,notificationType:c,enableEncrypted:d=!1}=i,h=`https://echo.walletconnect.com/${r.projectId}/clients`;yield fetch(h,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:o,type:c,token:a,always_raw:d})})});return function(i){return s.apply(this,arguments)}}()),this.logger=(0,Ct.U5)(n,this.context)}}var D3=Object.defineProperty,P_=Object.getOwnPropertySymbols,U3=Object.prototype.hasOwnProperty,k3=Object.prototype.propertyIsEnumerable,Hf=(t,e,n)=>e in t?D3(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,ba=(t,e)=>{for(var n in e||(e={}))U3.call(e,n)&&Hf(t,n,e[n]);if(P_)for(var n of P_(e))k3.call(e,n)&&Hf(t,n,e[n]);return t},On=(t,e,n)=>Hf(t,"symbol"!=typeof e?e+"":e,n);class M3 extends gl{constructor(e,n,r=!0){var s;super(e,n,r),s=this,this.core=e,this.logger=n,On(this,"context","event-client"),On(this,"storagePrefix",Jr),On(this,"storageVersion",.1),On(this,"events",new Map),On(this,"shouldPersist",!1),On(this,"init",(0,l.A)(function*(){if(!Bd())try{const i={eventId:Hm(),timestamp:Date.now(),domain:s.getAppDomain(),props:{event:"INIT",type:"",properties:{client_id:yield s.core.crypto.getClientId(),user_agent:Lm(s.core.relayer.protocol,s.core.relayer.version,Pf)}}};yield s.sendEvent([i])}catch(i){s.logger.warn(i)}})),On(this,"createEvent",i=>{const{event:o="ERROR",type:a="",properties:{topic:c,trace:d}}=i,h=Hm(),b=this.core.projectId||"",M=Date.now(),J=ba({eventId:h,timestamp:M,props:{event:o,type:a,properties:{topic:c,trace:d}},bundleId:b,domain:this.getAppDomain()},this.setMethods(h));return this.telemetryEnabled&&(this.events.set(h,J),this.shouldPersist=!0),J}),On(this,"getEvent",i=>{const{eventId:o,topic:a}=i;if(o)return this.events.get(o);const c=Array.from(this.events.values()).find(d=>d.props.properties.topic===a);return c?ba(ba({},c),this.setMethods(c.eventId)):void 0}),On(this,"deleteEvent",i=>{const{eventId:o}=i;this.events.delete(o),this.shouldPersist=!0}),On(this,"setEventListeners",()=>{this.core.heartbeat.on(z_pulse,(0,l.A)(function*(){s.shouldPersist&&(yield s.persist()),s.events.forEach(i=>{(0,_.fromMiliseconds)(Date.now())-(0,_.fromMiliseconds)(i.timestamp)>86400&&(s.events.delete(i.eventId),s.shouldPersist=!0)})}))}),On(this,"setMethods",i=>({addTrace:o=>this.addTrace(i,o),setError:o=>this.setError(i,o)})),On(this,"addTrace",(i,o)=>{const a=this.events.get(i);a&&(a.props.properties.trace.push(o),this.events.set(i,a),this.shouldPersist=!0)}),On(this,"setError",(i,o)=>{const a=this.events.get(i);a&&(a.props.type=o,a.timestamp=Date.now(),this.events.set(i,a),this.shouldPersist=!0)}),On(this,"persist",(0,l.A)(function*(){yield s.core.storage.setItem(s.storageKey,Array.from(s.events.values())),s.shouldPersist=!1})),On(this,"restore",(0,l.A)(function*(){try{const i=(yield s.core.storage.getItem(s.storageKey))||[];if(!i.length)return;i.forEach(o=>{s.events.set(o.eventId,ba(ba({},o),s.setMethods(o.eventId)))})}catch(i){s.logger.warn(i)}})),On(this,"submit",(0,l.A)(function*(){if(!s.telemetryEnabled||0===s.events.size)return;const i=[];for(const[o,a]of s.events)a.props.type&&i.push(a);if(0!==i.length)try{if((yield s.sendEvent(i)).ok)for(const o of i)s.events.delete(o.eventId),s.shouldPersist=!0}catch(o){s.logger.warn(o)}})),On(this,"sendEvent",function(){var i=(0,l.A)(function*(o){const a=s.getAppDomain()?"":"&sp=desktop";return yield fetch(`https://pulse.walletconnect.org/batch?projectId=${s.core.projectId}&st=events_sdk&sv=js-${Pf}${a}`,{method:"POST",body:JSON.stringify(o)})});return function(o){return i.apply(this,arguments)}}()),On(this,"getAppDomain",()=>Bm().url),this.logger=(0,Ct.U5)(n,this.context),this.telemetryEnabled=r,r?this.restore(
193).then((0,l.A)(function*(){yield s.submit(),s.setEventListeners()})):this.persist()}get storageKey(){return this.storagePrefix+this.storageVersion+this.core.customStoragePrefix+"//"+this.context}}var B3=Object.defineProperty,D_=Object.getOwnPropertySymbols,L3=Object.prototype.hasOwnProperty,F3=Object.prototype.propertyIsEnumerable,Kf=(t,e,n)=>e in t?B3(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,U_=(t,e)=>{for(var n in e||(e={}))L3.call(e,n)&&Kf(t,n,e[n]);if(D_)for(var n of D_(e))F3.call(e,n)&&Kf(t,n,e[n]);return t},on=(t,e,n)=>Kf(t,"symbol"!=typeof e?e+"":e,n);class zf extends At{constructor(e){var n,r;super(e),n=this,on(this,"protocol","wc"),on(this,"version",2),on(this,"name",el),on(this,"relayUrl"),on(this,"projectId"),on(this,"customStoragePrefix"),on(this,"events",new O.EventEmitter),on(this,"logger"),on(this,"heartbeat"),on(this,"relayer"),on(this,"crypto"),on(this,"storage"),on(this,"history"),on(this,"expirer"),on(this,"pairing"),on(this,"verify"),on(this,"echoClient"),on(this,"linkModeSupportedApps"),on(this,"eventClient"),on(this,"initialized",!1),on(this,"logChunkController"),on(this,"on",(c,d)=>this.events.on(c,d)),on(this,"once",(c,d)=>this.events.once(c,d)),on(this,"off",(c,d)=>this.events.off(c,d)),on(this,"removeListener",(c,d)=>this.events.removeListener(c,d)),on(this,"dispatchEnvelope",({topic:c,message:d,sessionExists:h})=>{if(!c||!d)return;const b={topic:c,message:d,publishedAt:Date.now(),transportType:an.link_mode};this.relayer.onLinkMessageEvent(b,{sessionExists:h})});const s=this.getGlobalCore(e?.customStoragePrefix);if(s)try{return this.customStoragePrefix=s.customStoragePrefix,this.logger=s.logger,this.heartbeat=s.heartbeat,this.crypto=s.crypto,this.history=s.history,this.expirer=s.expirer,this.storage=s.storage,this.relayer=s.relayer,this.pairing=s.pairing,this.verify=s.verify,this.echoClient=s.echoClient,this.linkModeSupportedApps=s.linkModeSupportedApps,this.eventClient=s.eventClient,this.initialized=s.initialized,this.logChunkController=s.logChunkController,s}catch(c){console.warn("Failed to copy global core",c)}this.projectId=e?.projectId,this.relayUrl=e?.relayUrl||Qy,this.customStoragePrefix=null!=e&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const i=(0,Ct.iP)({level:"string"==typeof e?.logger&&e.logger?e.logger:"error",name:el}),{logger:o,chunkLoggerController:a}=(0,Ct.D5)({opts:i,maxSizeInBytes:e?.maxLogBlobSizeInBytes,loggerOverride:e?.logger});this.logChunkController=a,null!=(r=this.logChunkController)&&r.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=(0,l.A)(function*(){var c,d;null!=(c=n.logChunkController)&&c.downloadLogsBlobInBrowser&&(null==(d=n.logChunkController)||d.downloadLogsBlobInBrowser({clientId:yield n.crypto.getClientId()}))})),this.logger=(0,Ct.U5)(o,this.name),this.heartbeat=new T,this.crypto=new hR(this,this.logger,e?.keychain),this.history=new C3(this,this.logger),this.expirer=new S3(this,this.logger),this.storage=null!=e&&e.storage?e.storage:new Gt(U_(U_({},aN),e?.storageOptions)),this.relayer=new WR({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new v3(this,this.logger),this.verify=new N3(this,this.logger,this.storage),this.echoClient=new P3(this.projectId||"",this.logger),this.linkModeSupportedApps=[],this.eventClient=new M3(this,this.logger,e?.telemetryEnabled),this.setGlobalCore(this)}static init(e){return(0,l.A)(function*(){const n=new zf(e);yield n.initialize();const r=yield n.crypto.getClientId();return yield n.storage.setItem("WALLETCONNECT_CLIENT_ID",r),n})()}get context(){return(0,Ct.oI)(this.logger)}start(){var e=this;return(0,l.A)(function*(){e.initialized||(yield e.initialize())})()}getLogsBlob(){var e=this;return(0,l.A)(function*(){var n;return null==(n=e.logChunkController)?void 0:n.logsToBlob({clientId:yield e.crypto.getClientId()})})()}addLinkModeSupportedApp(e){var n=this;return(0,l.A)(function*(){n.linkModeSupportedApps.includes(e)||(n.linkModeSupportedApps.push(e),yield n.storage.setItem(e_,n.linkModeSupportedApps))})()}initialize(){var e=this;return(0,l.A)(function*(){e.logger.trace("Initialized");try{yield e.crypto.init(),yield e.history.init(),yield e.expirer.init(),yield e.relayer.init(),yield e.heartbeat.init(
193),yield e.pairing.init(),e.linkModeSupportedApps=(yield e.storage.getItem(e_))||[],e.initialized=!0,e.logger.info("Core Initialization Success")}catch(n){throw e.logger.warn(n,`Core Initialization Failure at epoch ${Date.now()}`),e.logger.error(n.message),n}})()}getGlobalCore(e=""){try{if(this.isGlobalCoreDisabled())return;const n=`_walletConnectCore_${e}`,r=`${n}_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[n]}catch(n){return void console.warn("Failed to get global WalletConnect core",n)}}setGlobalCore(e){var n;try{if(this.isGlobalCoreDisabled())return;const r=`_walletConnectCore_${(null==(n=e.opts)?void 0:n.customStoragePrefix)||""}`;globalThis[r]=e}catch(r){console.warn("Failed to set global WalletConnect core",r)}}isGlobalCoreDisabled(){try{return typeof process<"u"&&"true"===process.env.DISABLE_GLOBAL_CORE}catch{return!0}}}const W3=zf,Vf="wc@2:client:",L_="WALLETCONNECT_DEEPLINK_CHOICE",F_="Proposal expired",no=_.SEVEN_DAYS,Un={wc_sessionPropose:{req:{ttl:_.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:_.FIVE_MINUTES,prompt:!1,tag:1101},reject:{ttl:_.FIVE_MINUTES,prompt:!1,tag:1120},autoReject:{ttl:_.FIVE_MINUTES,prompt:!1,tag:1121}},wc_sessionSettle:{req:{ttl:_.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:_.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:_.ONE_DAY,prompt:!1,tag:1104},res:{ttl:_.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:_.ONE_DAY,prompt:!1,tag:1106},res:{ttl:_.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:3*_.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:3*_.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:_.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:_.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:_.ONE_DAY,prompt:!1,tag:1112},res:{ttl:_.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:_.ONE_DAY,prompt:!1,tag:1114},res:{ttl:_.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:_.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:_.ONE_HOUR,prompt:!1,tag:1117},reject:{ttl:_.FIVE_MINUTES,prompt:!1,tag:1118},autoReject:{ttl:_.FIVE_MINUTES,prompt:!1,tag:1119}}},qf={min:_.FIVE_MINUTES,max:_.SEVEN_DAYS},K3={eth_sendTransaction:{key:""},eth_sendRawTransaction:{key:""},wallet_sendCalls:{key:""},solana_signTransaction:{key:"signature"},solana_signAllTransactions:{key:"transactions"},solana_signAndSendTransaction:{key:"signature"},sui_signAndExecuteTransaction:{key:"digest"},sui_signTransaction:{key:""},hedera_signAndExecuteTransaction:{key:"transactionId"},hedera_executeTransaction:{key:"transactionId"},near_signTransaction:{key:""},near_signTransactions:{key:""},tron_signTransaction:{key:"txID"},xrpl_signTransaction:{key:""},xrpl_signTransactionFor:{key:""},algo_signTxn:{key:""},sendTransfer:{key:"txid"},stacks_stxTransfer:{key:"txId"},polkadot_signTransaction:{key:""},cosmos_signDirect:{key:""}},V3=["wc_sessionPropose","wc_sessionRequest","wc_authRequest","wc_sessionAuthenticate"],rl="[email protected]:auth:",sl=`${rl}:PUB_KEY`;var X3=Object.defineProperty,Q3=Object.defineProperties,eP=Object.getOwnPropertyDescriptors,W_=Object.getOwnPropertySymbols,tP=Object.prototype.hasOwnProperty,nP=Object.prototype.propertyIsEnumerable,Yf=(t,e,n)=>e in t?X3(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,Zt=(t,e)=>{for(var n in e||(e={}))tP.call(e,n)&&Yf(t,n,e[n]);if(W_)for(var n of W_(e))nP.call(e,n)&&Yf(t,n,e[n]);return t},kn=(t,e)=>Q3(t,eP(e)),Ye=(t,e,n)=>Yf(t,"symbol"!=typeof e?e+"":e,n);class rP extends El{constructor(e){var n;super(e),n=this,Ye(this,"name","engine"),Ye(this,"events",new O),Ye(this,"initialized",!1),Ye(this,"requestQueue",{state:"IDLE",queue:[]}),Ye(this,"sessionRequestQueue",{state:"IDLE",queue:[]}),Ye(this,"emittedSessionRequests",new zI({limit:500})),Ye(this,"requestQueueDelay",_.ONE_SECOND),Ye(this,"expectedPairingMethodMap",new Map),Ye(this,"recentlyDeletedMap",new Map),Ye(this,"recentlyDeletedLimit",200),Ye(this,"relayMessageCache",[]),Ye(this,"pendingSessions",new Map),Ye(this,"init",(0,l.A)(function*(){n.initialized||(yield n.cleanup(),n.registerRelayerEvents(),n.registerExpirerEvents(),n.registerPairingEvents(),yield n.registerLinkModeListeners(),n.client.core.pairing.register({methods:Object.keys(Un)}),n.initialized=!0,setTimeout((0,l.A)(function*(){yield n.processPendingMessageEvents(),n.sessionRequestQueue.queue=n.getPendingSessionRequests(),n.processSessionRequestQueue()}),(0,_.toMiliseconds)(n.requestQueueDelay)))})),Ye(this,"connect",function(){var r=(0,l.A)(function*(s){var i;n.isInitialized(),yield n.confirmOnlineStateOrThrow();const o=kn(Zt({},s),{requiredNamespaces:s.requiredNamespaces||{},optionalNamespaces:s.optionalNamespaces||{}});yield n.isValidConnect(o),o.optionalNamespaces=function tO(t,e){var n,r,s,i,o,a;const c=Yc(t),d=Yc(e),h={},b=Object.keys(c).concat(Object.keys(d));for(const M of b)h[M]={chains:rr(null==(n=c[M])?void 0:n.chains,null==(r=d[M])?void 0:r.chains),methods:rr(null==(s=c[M])?void 0:s.methods,null==(i=d[M])?void 0:i.methods),events:rr(null==(o=c[M])?void 0:o.events,null==(a=d[M]
193)?void 0:a.events)};return h}(o.requiredNamespaces,o.optionalNamespaces),o.requiredNamespaces={};const{pairingTopic:a,requiredNamespaces:c,optionalNamespaces:d,sessionProperties:h,scopedProperties:b,relays:M,authentication:J,walletPay:te}=o,re=(null==(i=J?.[0])?void 0:i.ttl)||Un.wc_sessionPropose.req.ttl||_.FIVE_MINUTES;n.validateRequestExpiry(re);let ye,ae=a,Se=!1;try{if(ae){const He=n.client.core.pairing.pairings.get(ae);n.client.logger.warn("connect() with existing pairing topic is deprecated and will be removed in the next major release."),Se=He.active}}catch(He){throw n.client.logger.error(`connect() -> pairing.get(${ae}) failed`),He}if(!ae||!Se){const{topic:He,uri:Me}=yield n.client.core.pairing.create({internal:{skipSubscribe:!0}});ae=He,ye=Me}if(!ae){const{message:He}=et("NO_MATCHING_KEY",`connect() pairing topic: ${ae}`);throw new Error(He)}const oe=yield n.client.core.crypto.generateKeyPair(),pe=yn(re),Ce=Zt(kn(Zt(Zt({requiredNamespaces:c,optionalNamespaces:d,relays:M??[{protocol:"irn"}],proposer:{publicKey:oe,metadata:n.client.metadata},expiryTimestamp:pe,pairingTopic:ae},h&&{sessionProperties:h}),b&&{scopedProperties:b}),{id:Yr()}),(J||te)&&{requests:{authentication:J?.map(He=>{const{domain:Me,chains:Ee,nonce:Ne,uri:le,exp:ue,nbf:be,type:Re,statement:we,requestId:De,resources:je,signatureTypes:ze}=He;return{domain:Me,chains:Ee,nonce:Ne,type:Re??"caip122",aud:le,version:"1",iat:(new Date).toISOString(),exp:ue,nbf:be,statement:we,requestId:De,resources:je,signatureTypes:ze}}),walletPay:te}}),ke=Jt("session_connect",Ce.id),{reject:Be,resolve:Fe,done:Pe}=di(re,F_),Ze=({id:He})=>{He===Ce.id&&(n.client.events.off("proposal_expire",Ze),n.pendingSessions.delete(Ce.id),n.events.emit(ke,{error:{message:F_,code:0}}))};return n.client.events.on("proposal_expire",Ze),n.events.once(ke,({error:He,session:Me})=>{n.client.events.off("proposal_expire",Ze),He?Be(He):Me&&Fe(Me)}),yield n.setProposal(Ce.id,Ce),yield n.sendProposeSession({proposal:Ce,publishOpts:{internal:{throwOnFailedPublish:!0},tvf:{correlationId:Ce.id}}}).catch(He=>{throw n.deleteProposal(Ce.id),He}),{uri:ye,approval:Pe}});return function(s){return r.apply(this,arguments)}}()),Ye(this,"pair",function(){var r=(0,l.A)(function*(s){n.isInitialized(),yield n.confirmOnlineStateOrThrow();try{return yield n.client.core.pairing.pair(s)}catch(i){throw n.client.logger.error("pair() failed"),i}});return function(s){return r.apply(this,arguments)}}()),Ye(this,"approve",function(){var r=(0,l.A)(function*(s){var i,o,a;const c=n.client.core.eventClient.createEvent({properties:{topic:null==(i=s?.id)?void 0:i.toString(),trace:["session_approve_started"]}});try{n.isInitialized(),yield n.confirmOnlineStateOrThrow()}catch(Me){throw c.setError("no_internet_connection"),Me}try{yield n.isValidProposalId(s?.id)}catch(Me){throw n.client.logger.error(`approve() -> proposal.get(${s?.id}) failed`),c.setError("proposal_not_found"),Me}try{yield n.isValidApprove(s)}catch(Me){throw n.client.logger.error("approve() -> isValidApprove() failed"),c.setError("session_approve_namespace_validation_failure"),Me}const{id:d,relayProtocol:h,namespaces:b,sessionProperties:M,scopedProperties:J,sessionConfig:te,proposalRequestsResponses:re}=s,ae=n.client.proposal.get(d);n.client.core.eventClient.deleteEvent({eventId:c.eventId});const{pairingTopic:ye,proposer:Se,requiredNamespaces:oe,optionalNamespaces:pe}=ae;let Ce=null==(o=n.client.core.eventClient)?void 0:o.getEvent({topic:ye});Ce||(Ce=null==(a=n.client.core.eventClient)?void 0:a.createEvent({type:"session_approve_started",properties:{topic:ye,trace:["session_approve_started","session_namespaces_validation_success"]}}));const ke=yield n.client.core.crypto.generateKeyPair(),Be=Se.publicKey,Fe=yield n.client.core.crypto.generateSharedKey(ke,Be),Pe=kn(Zt(Zt(Zt({relay:{protocol:h??"irn"},namespaces:b,controller:{publicKey:ke,metadata:n.client.metadata},expiry:yn(no)},M&&{sessionProperties:M}),J&&{scopedProperties:J}),te&&{sessionConfig:te}),{proposalRequestsResponses:re}),Ze=an.relay;Ce.addTrace("subscribing_session_topic");try{yield n.client.core.relayer.subscribe(Fe,{transportType:Ze,internal:{skipSubscribe:!0}})}catch(Me){throw Ce.setError("subscribe_session_topic_failure"),Me}Ce.addTrace("subscribe_session_topic_success");const He=kn(Zt({},Pe),{topic:Fe,requiredNamespaces:oe,optionalNamespaces:pe,pairingTopic:ye,acknowledged:!1,self:Pe.controller,peer:{publicKey:Se.publicKey,metadata:Se.metadata},controller:ke,transportType:an.relay,authentication:re?.authentication,walletPayResult:re?.walletPay});yield n.client.session.set(Fe,He),Ce.addTrace("store_session");try{yield n.sendApproveSession({sessionTopic:Fe,proposal:ae,pairingProposalResponse:{relay:{protocol:h??"irn"},responderPublicKey:ke},sessionSettleRequest:Pe,publishOpts:{internal:{throwOnFailedPublish:!0},tvf:Zt({correlationId:d}
193,n.getTVFApproveParams(He))}}),Ce.addTrace("session_approve_publish_success")}catch(Me){throw n.client.logger.error(Me),n.client.session.delete(Fe,cn("USER_DISCONNECTED")),yield n.client.core.relayer.unsubscribe(Fe),Me}return n.client.core.eventClient.deleteEvent({eventId:Ce.eventId}),yield n.client.core.pairing.updateMetadata({topic:ye,metadata:Se.metadata}),yield n.deleteProposal(d),yield n.client.core.pairing.activate({topic:ye}),yield n.setExpiry(Fe,yn(no)),{topic:Fe,acknowledged:()=>Promise.resolve(n.client.session.get(Fe))}});return function(s){return r.apply(this,arguments)}}()),Ye(this,"reject",function(){var r=(0,l.A)(function*(s){n.isInitialized(),yield n.confirmOnlineStateOrThrow();try{yield n.isValidReject(s)}catch(c){throw n.client.logger.error("reject() -> isValidReject() failed"),c}const{id:i,reason:o}=s;let a;try{a=n.client.proposal.get(i).pairingTopic}catch(c){throw n.client.logger.error(`reject() -> proposal.get(${i}) failed`),c}a&&(yield n.sendError({id:i,topic:a,error:o,rpcOpts:Un.wc_sessionPropose.reject})),yield n.deleteProposal(i)});return function(s){return r.apply(this,arguments)}}()),Ye(this,"update",function(){var r=(0,l.A)(function*(s){n.isInitialized(),yield n.confirmOnlineStateOrThrow();try{yield n.isValidUpdate(s)}catch(J){throw n.client.logger.error("update() -> isValidUpdate() failed"),J}const{topic:i,namespaces:o}=s,{done:a,resolve:c,reject:d}=di(_.FIVE_MINUTES,"Session update request expired without receiving any acknowledgement"),h=Yr(),b=Zs().toString(),M=n.client.session.get(i).namespaces;return n.events.once(Jt("session_update",h),({error:J})=>{J?d(J):c()}),yield n.client.session.update(i,{namespaces:o}),yield n.sendRequest({topic:i,method:"wc_sessionUpdate",params:{namespaces:o},throwOnFailedPublish:!0,clientRpcId:h,relayRpcId:b}).catch(J=>{n.client.logger.error(J),n.client.session.update(i,{namespaces:M}),d(J)}),{acknowledged:a}});return function(s){return r.apply(this,arguments)}}()),Ye(this,"extend",function(){var r=(0,l.A)(function*(s){n.isInitialized(),yield n.confirmOnlineStateOrThrow();try{yield n.isValidExtend(s)}catch(h){throw n.client.logger.error("extend() -> isValidExtend() failed"),h}const{topic:i}=s,o=Yr(),{done:a,resolve:c,reject:d}=di(_.FIVE_MINUTES,"Session extend request expired without receiving any acknowledgement");return n.events.once(Jt("session_extend",o),({error:h})=>{h?d(h):c()}),yield n.setExpiry(i,yn(no)),n.sendRequest({topic:i,method:"wc_sessionExtend",params:{},clientRpcId:o,throwOnFailedPublish:!0}).catch(h=>{d(h)}),{acknowledged:a}});return function(s){return r.apply(this,arguments)}}()),Ye(this,"request",function(){var r=(0,l.A)(function*(s){n.isInitialized();try{yield n.isValidRequest(s)}catch(Se){throw n.client.logger.error("request() -> isValidRequest() failed"),Se}const{chainId:i,request:o,topic:a,expiry:c=Un.wc_sessionRequest.req.ttl}=s,d=n.client.session.get(a);d?.transportType===an.relay&&(yield n.confirmOnlineStateOrThrow());const h=Yr(),b=Zs().toString(),{done:M,resolve:J,reject:te}=di(c,"Request expired. Please try again.");n.events.once(Jt("session_request",h),({error:Se,result:oe})=>{Se?te(Se):J(oe)});const re="wc_sessionRequest",ae=n.getAppLinkIfEnabled(d.peer.metadata,d.transportType);if(ae)return yield n.sendRequest({clientRpcId:h,relayRpcId:b,topic:a,method:re,params:{request:kn(Zt({},o),{expiryTimestamp:yn(c)}),chainId:i},expiry:c,throwOnFailedPublish:!0,appLink:ae}).catch(Se=>te(Se)),n.client.events.emit("session_request_sent",{topic:a,request:o,chainId:i,id:h}),yield M();const ye={request:kn(Zt({},o),{expiryTimestamp:yn(c)}),chainId:i};return yield Promise.all([new Promise(function(){var Se=(0,l.A)(function*(oe){yield n.sendRequest({clientRpcId:h,relayRpcId:b,topic:a,method:re,params:ye,expiry:c,throwOnFailedPublish:!0,tvf:n.getTVFParams(h,ye)}).catch(pe=>te(pe)),n.client.events.emit("session_request_sent",{topic:a,request:o,chainId:i,id:h}),oe()});return function(oe){return Se.apply(this,arguments)}}()),new Promise(function(){var Se=(0,l.A)(function*(oe){var pe;if(null==(pe=d.sessionConfig)||!pe.disableDeepLink){const Ce=yield function WI(t,e){return Md.apply(this,arguments)}(n.client.core.storage,L_);yield function BI(t){return kd.apply(this,arguments)}({id:h,topic:a,wcDeepLink:Ce})}oe()});return function(oe){return Se.apply(this,arguments)}}()),M()]).then(Se=>Se[2])});return function(s){return r.apply(this,arguments)}}()),Ye(this,"respond",function(){var r=(0,l.A)(function*(s){var i,o;n.isInitialized();const a=n.client.core.eventClient.createEvent({properties:{topic:s?.topic||(null==(o=null==(i=s?.response)?void 0:i.id)?void 0:o.toString()),trace:["session_request_response_started"]}});try{yield n.isValidRespond(s)}catch(J){throw a.addTrace(J?.message),a.setError("session_request_response_validation_failure"),J}a.addTrace("session_request_response_validation_success");const{topic:c,response:d}=s,{id:h}=d,b=n.client.session.get(c);b.transportType===an.relay&&(yield n.confirmOnlineStateOrThrow());const M=n.getAppLinkIfEnabled(b.peer.metadata,b.transportType);try{a.addTrace("session_request_response_publish_started"),Zr(d)?yield n.sendResult({id:h,topic:c,result:d.result,throwOnFailedPublish:!0,appLink:M}
193):Cr(d)&&(yield n.sendError({id:h,topic:c,error:d.error,appLink:M})),n.cleanupAfterResponse(s)}catch(J){throw a.addTrace(J?.message),a.setError("session_request_response_publish_failure"),J}});return function(s){return r.apply(this,arguments)}}()),Ye(this,"ping",function(){var r=(0,l.A)(function*(s){n.isInitialized(),yield n.confirmOnlineStateOrThrow();try{yield n.isValidPing(s)}catch(o){throw n.client.logger.error("ping() -> isValidPing() failed"),o}const{topic:i}=s;if(n.client.session.keys.includes(i)){const o=Yr(),a=Zs().toString(),{done:c,resolve:d,reject:h}=di(_.FIVE_MINUTES,"Ping request expired without receiving any acknowledgement");n.events.once(Jt("session_ping",o),({error:b})=>{b?h(b):d()}),yield Promise.all([n.sendRequest({topic:i,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:o,relayRpcId:a}),c()])}else n.client.core.pairing.pairings.keys.includes(i)&&(n.client.logger.warn("ping() on pairing topic is deprecated and will be removed in the next major release."),yield n.client.core.pairing.ping({topic:i}))});return function(s){return r.apply(this,arguments)}}()),Ye(this,"emit",function(){var r=(0,l.A)(function*(s){n.isInitialized(),yield n.confirmOnlineStateOrThrow(),yield n.isValidEmit(s);const{topic:i,event:o,chainId:a}=s,c=Zs().toString(),d=Yr();yield n.sendRequest({topic:i,method:"wc_sessionEvent",params:{event:o,chainId:a},throwOnFailedPublish:!0,relayRpcId:c,clientRpcId:d})});return function(s){return r.apply(this,arguments)}}()),Ye(this,"disconnect",function(){var r=(0,l.A)(function*(s){n.isInitialized(),yield n.confirmOnlineStateOrThrow(),yield n.isValidDisconnect(s);const{topic:i}=s;if(n.client.session.keys.includes(i))yield n.sendRequest({topic:i,method:"wc_sessionDelete",params:cn("USER_DISCONNECTED"),throwOnFailedPublish:!0}),yield n.deleteSession({topic:i,emitEvent:!1});else{if(!n.client.core.pairing.pairings.keys.includes(i)){const{message:o}=et("MISMATCHED_TOPIC",`Session or pairing topic not found: ${i}`);throw new Error(o)}yield n.client.core.pairing.disconnect({topic:i})}});return function(s){return r.apply(this,arguments)}}()),Ye(this,"find",r=>(this.isInitialized(),this.client.session.getAll().filter(s=>function nO(t,e){const{requiredNamespaces:n}=e,r=Object.keys(t.namespaces),s=Object.keys(n);let i=!0;return!!ui(s,r)&&(r.forEach(o=>{const{accounts:a,methods:c,events:d}=t.namespaces[o],h=Xi(a),b=n[o];ui(xd(o,b),h)&&ui(b.methods,c)&&ui(b.events,d)||(i=!1)}),i)}(s,r)))),Ye(this,"getPendingSessionRequests",()=>this.client.pendingRequest.getAll()),Ye(this,"authenticate",function(){var r=(0,l.A)(function*(s,i){var o;n.isInitialized(),n.isValidAuthenticate(s);const a=i&&n.client.core.linkModeSupportedApps.includes(i)&&(null==(o=n.client.metadata.redirect)?void 0:o.linkMode),c=a?an.link_mode:an.relay;c===an.relay&&(yield n.confirmOnlineStateOrThrow());const{chains:d,statement:h="",uri:b,domain:M,nonce:J,type:te,exp:re,nbf:ae,methods:ye=[],expiry:Se}=s,oe=[...s.resources||[]],{topic:pe,uri:Ce}=yield n.client.core.pairing.create({methods:["wc_sessionAuthenticate"],transportType:c});n.client.logger.info({message:"Generated new pairing",pairing:{topic:pe,uri:Ce}});const ke=yield n.client.core.crypto.generateKeyPair(),Be=zc(ke);if(yield Promise.all([n.client.auth.authKeys.set(sl,{responseTopic:Be,publicKey:ke}),n.client.auth.pairingTopics.set(Be,{topic:Be,pairingTopic:pe})]),yield n.client.core.relayer.subscribe(Be,{transportType:c}),n.client.logger.info(`sending request to new pairing topic: ${pe}`),ye.length>0){const{namespace:je}=Kr(d[0]);let ze=function s2(t,e,n){const r=function n2(t,e,n,r={}){return n?.sort((s,i)=>s.localeCompare(i)),{att:{[t]:_0(e,n,r)}}}(t,e,n);return Zd(r)}(je,"request",ye);zi(oe)&&(ze=i2(ze,oe.pop())),oe.push(ze)}const Fe=Se&&Se>Un.wc_sessionAuthenticate.req.ttl?Se:Un.wc_sessionAuthenticate.req.ttl,Pe={authPayload:{type:te??"caip122",chains:d,statement:h,aud:b,domain:M,version:"1",nonce:J,iat:(new Date).toISOString(),exp:re,nbf:ae,resources:oe},requester:{publicKey:ke,metadata:n.client.metadata},expiryTimestamp:yn(Fe)},He={requiredNamespaces:{},optionalNamespaces:{eip155:{chains:d,methods:[...new Set(["personal_sign",...ye])],events:["chainChanged","accountsChanged"]}},relays:[{protocol:"irn"}],pairingTopic:pe,proposer:{publicKey:ke,metadata:n.client.metadata},expiryTimestamp:yn(Un.wc_sessionPropose.req.ttl),id:Yr()},{done:Me,resolve:Ee,reject:Ne}=di(Fe,"Request expired"),le=Yr(),ue=Jt("session_connect",He.id),be=Jt("session_request",le),Re=function(){var je=(0,l.A)(function*({error:ze,session:ot}){n.events.off(be,we),ze?Ne(ze):ot&&Ee({session:ot})});return function(ot){return je.apply(this,arguments)}}(),we=function(){var je=(0,l.A)(function*(ze){var ot,mt,st;if(yield n.deletePendingAuthRequest(le,{message:"fulfilled",code:0}),ze.error){const fn=cn("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return ze.error.code===fn.code?void 0:(n.events.off(ue,Re),Ne(ze.error.message))}yield n.deleteProposal(He.id),n.events.off(ue,Re);const{cacaos:It,responder:St}=ze.result,Wt=[],Ot=[];for(const fn of It){(yield m0({cacao:fn,projectId:n.client.core.projectId}))||(n.client.logger.error(fn,"Signature verification failed"),Ne(cn("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:vn}=fn,Xn=zi(vn.resources),Lr=[qd(vn.iss)],ao=Dc(vn.iss);if(Xn){const Ca=b0(Xn),bh=w0(Xn);Wt.push(...Ca),Lr.push(...bh)}for(const Ca of Lr)Ot.push(`${Ca}:${ao}`)}const Lt=yield n.client.core.crypto.generateSharedKey(ke,St.publicKey);let ln;Wt.length>0&&(ln={topic:Lt,acknowledged:!0,self:{publicKey:ke,metadata:n.client.metadata},peer:St,controller:St.publicKey,expiry:yn(no),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:pe,namespaces:Oy([...new Set(Wt)],[...new Set(Ot)]),transportType:c},yield n.client.core.relayer.subscribe(Lt,{transportType:c}),yield n.client.session.set(Lt,ln),pe&&(yield n.client.core.pairing.updateMetadata({topic:pe,metadata:St.metadata})),ln=n.client.session.get(Lt)),null!=(ot=n.client.metadata.redirect)&&ot.linkMode&&null!=(mt=St.metadata.redirect)&&mt.linkMode&&null!=(st=St.metadata.redirect)&&st.universal&&i&&(n.client.core.addLinkModeSupportedApp(St.metadata.redirect.universal),n.client.session.update(Lt,{transportType:an.link_mode})),Ee({auths:It,session:ln})});return function(ot){return je.apply(this,arguments)}}();let De;n.events.once(ue,Re),n.events.once(be,we);try{if(a){const je=Ur("wc_sessionAuthenticate",Pe,le);n.client.core.history.set(pe,je);const ze=yield n.client.core.crypto.encode("",je,{type:2,encoding:Ys});De=Gc(i,pe,ze)}else yield Promise.all([n.sendRequest({topic:pe,method:"wc_sessionAuthenticate",params:Pe,expiry:s.expiry,throwOnFailedPublish:!0,clientRpcId:le}),n.sendRequest({topic:pe,method:"wc_sessionPropose",params:He,expiry:Un.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:He.id})])}catch(je){throw n.events.off(ue,Re),n.events.off(be,we),je}return yield n.setProposal(He.id,He),yield n.setAuthRequest(le,{request:kn(Zt({},Pe),{verifyContext:{}}),pairingTopic:pe,transportType:c}),{uri:De??Ce,response:Me}});return function(s,i){return r.apply(this,arguments)}}()),Ye(this,"approveSessionAuthenticate",function(){var r=(0,l.A)(function*(s){const{id:i,auths:o}=s,a=n.client.core.eventClient.createEvent({properties:{topic:i.toString(),trace:["authenticated_session_approve_started"]}});try{n.isInitialized()}catch(Se){throw a.setError("no_internet_connection"),Se}const c=n.getPendingAuthRequest(i);if(!c)throw a.setError("authenticated_session_pending_request_not_found"),new Error(`Could not find pending auth request with id ${i}`);const d=c.transportType||an.relay;d===an.relay&&(yield n.confirmOnlineStateOrThrow());const h=c.requester.publicKey,b=yield n.client.core.crypto.generateKeyPair(),M=zc(h),J={type:1,receiverPublicKey:h,senderPublicKey:b},te=[],re=[];for(const Se of o){if(!(yield m0({cacao:Se,projectId:n.client.core.projectId}))){a.setError("invalid_cacao");const Be=cn("SESSION_SETTLEMENT_FAILED","Signature verification failed");
193throw yield n.sendError({id:i,topic:M,error:Be,encodeOpts:J}),new Error(Be.message)}a.addTrace("cacaos_verified");const{p:oe}=Se,pe=zi(oe.resources),Ce=[qd(oe.iss)],ke=Dc(oe.iss);if(pe){const Be=b0(pe),Fe=w0(pe);te.push(...Be),Ce.push(...Fe)}for(const Be of Ce)re.push(`${Be}:${ke}`)}const ae=yield n.client.core.crypto.generateSharedKey(b,h);let ye;if(a.addTrace("create_authenticated_session_topic"),te?.length>0){ye={topic:ae,acknowledged:!0,self:{publicKey:b,metadata:n.client.metadata},peer:{publicKey:h,metadata:c.requester.metadata},controller:h,expiry:yn(no),authentication:o,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:c.pairingTopic,namespaces:Oy([...new Set(te)],[...new Set(re)]),transportType:d},a.addTrace("subscribing_authenticated_session_topic");try{yield n.client.core.relayer.subscribe(ae,{transportType:d})}catch(Se){throw a.setError("subscribe_authenticated_session_topic_failure"),Se}a.addTrace("subscribe_authenticated_session_topic_success"),yield n.client.session.set(ae,ye),a.addTrace("store_authenticated_session"),yield n.client.core.pairing.updateMetadata({topic:c.pairingTopic,metadata:c.requester.metadata})}a.addTrace("publishing_authenticated_session_approve");try{yield n.sendResult({topic:M,id:i,result:{cacaos:o,responder:{publicKey:b,metadata:n.client.metadata}},encodeOpts:J,throwOnFailedPublish:!0,appLink:n.getAppLinkIfEnabled(c.requester.metadata,d)})}catch(Se){throw a.setError("authenticated_session_approve_publish_failure"),Se}return yield n.client.auth.requests.delete(i,{message:"fulfilled",code:0}),yield n.client.core.pairing.activate({topic:c.pairingTopic}),n.client.core.eventClient.deleteEvent({eventId:a.eventId}),{session:ye}});return function(s){return r.apply(this,arguments)}}()),Ye(this,"rejectSessionAuthenticate",function(){var r=(0,l.A)(function*(s){n.isInitialized();const{id:i,reason:o}=s,a=n.getPendingAuthRequest(i);if(!a)throw new Error(`Could not find pending auth request with id ${i}`);a.transportType===an.relay&&(yield n.confirmOnlineStateOrThrow());const c=a.requester.publicKey,d=yield n.client.core.crypto.generateKeyPair(),h=zc(c),b={type:1,receiverPublicKey:c,senderPublicKey:d};yield n.sendError({id:i,topic:h,error:o,encodeOpts:b,rpcOpts:Un.wc_sessionAuthenticate.reject,appLink:n.getAppLinkIfEnabled(a.requester.metadata,a.transportType)}),yield n.client.auth.requests.delete(i,{message:"rejected",code:0}),yield n.deleteProposal(i)});return function(s){return r.apply(this,arguments)}}()),Ye(this,"formatAuthMessage",r=>{this.isInitialized();const{request:s,iss:i}=r;return y0(s,i)}),Ye(this,"processRelayMessageCache",()=>{setTimeout((0,l.A)(function*(){if(0!==n.relayMessageCache.length)for(;n.relayMessageCache.length>0;)try{const r=n.relayMessageCache.shift();r&&(yield n.onRelayMessage(r))}catch(r){n.client.logger.error(r)}}),50)}),Ye(this,"cleanupDuplicatePairings",function(){var r=(0,l.A)(function*(s){if(s.pairingTopic)try{const i=n.client.core.pairing.pairings.get(s.pairingTopic),o=n.client.core.pairing.pairings.getAll().filter(a=>{var c,d;return(null==(c=a.peerMetadata)?void 0:c.url)&&(null==(d=a.peerMetadata)?void 0:d.url)===s.peer.metadata.url&&a.topic&&a.topic!==i.topic});if(0===o.length)return;n.client.logger.info(`Cleaning up ${o.length} duplicate pairing(s)`),yield Promise.all(o.map(a=>n.client.core.pairing.disconnect({topic:a.topic}))),n.client.logger.info("Duplicate pairings clean up finished")}catch(i){n.client.logger.error(i)}});return function(s){return r.apply(this,arguments)}}()),Ye(this,"deleteSession",function(){var r=(0,l.A)(function*(s){var i;const{topic:o,expirerHasDeleted:a=!1,emitEvent:c=!0,id:d=0}=s,{self:h}=n.client.session.get(o);yield n.client.core.relayer.unsubscribe(o),yield n.client.session.delete(o,cn("USER_DISCONNECTED")),n.addToRecentlyDeleted(o,"session"),n.client.core.crypto.keychain.has(h.publicKey)&&(yield n.client.core.crypto.deleteKeyPair(h.publicKey)),n.client.core.crypto.keychain.has(o)&&(yield n.client.core.crypto.deleteSymKey(o)),a||n.client.core.expirer.del(o),n.client.core.storage.removeItem(L_).catch(b=>n.client.logger.warn(b)),o===(null==(i=n.sessionRequestQueue.queue[0])?void 0:i.topic)&&(n.sessionRequestQueue.state="IDLE"),yield Promise.all(n.getPendingSessionRequests().filter(b=>b.topic===o).map(b=>n.deletePendingSessionRequest(b.id,cn("USER_DISCONNECTED")))),c&&n.client.events.emit("session_delete",{id:d,topic:o})});return function(s){return r.apply(this,arguments)}}()),Ye(this,"deleteProposal",function(){var r=(0,l.A)(function*(s,i){if
193(i)try{const o=n.client.proposal.get(s);n.client.core.eventClient.getEvent({topic:o.pairingTopic})?.setError("proposal_expired")}catch{}yield Promise.all([n.client.proposal.delete(s,cn("USER_DISCONNECTED")),i?Promise.resolve():n.client.core.expirer.del(s)]),n.addToRecentlyDeleted(s,"proposal")});return function(s,i){return r.apply(this,arguments)}}()),Ye(this,"deletePendingSessionRequest",function(){var r=(0,l.A)(function*(s,i,o=!1){yield Promise.all([n.client.pendingRequest.delete(s,i),o?Promise.resolve():n.client.core.expirer.del(s)]),n.addToRecentlyDeleted(s,"request"),n.sessionRequestQueue.queue=n.sessionRequestQueue.queue.filter(a=>a.id!==s),o&&(n.sessionRequestQueue.state="IDLE",n.client.events.emit("session_request_expire",{id:s}))});return function(s,i){return r.apply(this,arguments)}}()),Ye(this,"deletePendingAuthRequest",function(){var r=(0,l.A)(function*(s,i,o=!1){yield Promise.all([n.client.auth.requests.delete(s,i),o?Promise.resolve():n.client.core.expirer.del(s)])});return function(s,i){return r.apply(this,arguments)}}()),Ye(this,"setExpiry",function(){var r=(0,l.A)(function*(s,i){n.client.session.keys.includes(s)&&(n.client.core.expirer.set(s,i),yield n.client.session.update(s,{expiry:i}))});return function(s,i){return r.apply(this,arguments)}}()),Ye(this,"setProposal",function(){var r=(0,l.A)(function*(s,i){n.client.core.expirer.set(s,yn(Un.wc_sessionPropose.req.ttl)),yield n.client.proposal.set(s,i)});return function(s,i){return r.apply(this,arguments)}}()),Ye(this,"setAuthRequest",function(){var r=(0,l.A)(function*(s,i){const{request:o,pairingTopic:a,transportType:c=an.relay}=i;n.client.core.expirer.set(s,o.expiryTimestamp),yield n.client.auth.requests.set(s,{authPayload:o.authPayload,requester:o.requester,expiryTimestamp:o.expiryTimestamp,id:s,pairingTopic:a,verifyContext:o.verifyContext,transportType:c})});return function(s,i){return r.apply(this,arguments)}}()),Ye(this,"setPendingSessionRequest",function(){var r=(0,l.A)(function*(s){const{id:i,topic:o,params:a,verifyContext:c}=s,d=a.request.expiryTimestamp||yn(Un.wc_sessionRequest.req.ttl);n.client.core.expirer.set(i,d),yield n.client.pendingRequest.set(i,{id:i,topic:o,params:a,verifyContext:c})});return function(s){return r.apply(this,arguments)}}()),Ye(this,"sendRequest",function(){var r=(0,l.A)(function*(s){const{topic:i,method:o,params:a,expiry:c,relayRpcId:d,clientRpcId:h,throwOnFailedPublish:b,appLink:M,tvf:J,publishOpts:te={}}=s,re=Ur(o,a,h);let ae;const ye=!!M;try{const pe=ye?Ys:or;ae=yield n.client.core.crypto.encode(i,re,{encoding:pe})}catch(pe){throw yield n.cleanup(),n.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${i} failed`),pe}let Se;if(V3.includes(o)){const pe=wr(JSON.stringify(re)),Ce=wr(ae);Se=yield n.client.core.verify.register({id:Ce,decryptedId:pe})}const oe=Zt(Zt({},Un[o].req),te);if(oe.attestation=Se,c&&(oe.ttl=c),d&&(oe.id=d),n.client.core.history.set(i,re),ye){const pe=Gc(M,i,ae);yield global.Linking.openURL(pe,n.client.name)}else oe.tvf=kn(Zt({},J),{correlationId:re.id}),b?(oe.internal=kn(Zt({},oe.internal),{throwOnFailedPublish:!0}),yield n.client.core.relayer.publish(i,ae,oe)):n.client.core.relayer.publish(i,ae,oe).catch(pe=>n.client.logger.error(pe));return re.id});return function(s){return r.apply(this,arguments)}}()),Ye(this,"sendProposeSession",function(){var r=(0,l.A)(function*(s){const{proposal:i,publishOpts:o}=s,a=Ur("wc_sessionPropose",i,i.id);n.client.core.history.set(i.pairingTopic,a);const c=yield n.client.core.crypto.encode(i.pairingTopic,a,{encoding:or}),d=wr(JSON.stringify(a)),h=wr(c),b=yield n.client.core.verify.register({id:h,decryptedId:d});yield n.client.core.relayer.publishCustom({payload:{pairingTopic:i.pairingTopic,sessionProposal:c},opts:kn(Zt({},o),{publishMethod:"wc_proposeSession",attestation:b})})});return function(s){return r.apply(this,arguments)}}()),Ye(this,"sendApproveSession",function(){var r=(0,l.A)(function*(s){const{sessionTopic:i,pairingProposalResponse:o,proposal:a,sessionSettleRequest:c,publishOpts:d}=s,h=ha(a.id,o),b=yield n.client.core.crypto.encode(a.pairingTopic,h,{encoding:or}
193),M=Ur("wc_sessionSettle",c,d?.id),J=yield n.client.core.crypto.encode(i,M,{encoding:or});n.client.core.history.set(i,M),yield n.client.core.relayer.publishCustom({payload:{sessionTopic:i,pairingTopic:a.pairingTopic,sessionProposalResponse:b,sessionSettlementRequest:J},opts:kn(Zt({},d),{publishMethod:"wc_approveSession"})})});return function(s){return r.apply(this,arguments)}}()),Ye(this,"sendResult",function(){var r=(0,l.A)(function*(s){const{id:i,topic:o,result:a,throwOnFailedPublish:c,encodeOpts:d,appLink:h}=s,b=ha(i,a);let M;const J=h&&typeof(null==global?void 0:global.Linking)<"u";try{const ae=J?Ys:or;M=yield n.client.core.crypto.encode(o,b,kn(Zt({},d||{}),{encoding:ae}))}catch(ae){throw yield n.cleanup(),n.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${o} failed`),ae}let te,re;try{te=yield n.client.core.history.get(o,i);const ae=te.request;try{re=n.getTVFParams(i,ae.params,a)}catch(ye){n.client.logger.warn(`sendResult() -> getTVFParams() failed: ${ye?.message}`)}}catch(ae){throw n.client.logger.error(`sendResult() -> history.get(${o}, ${i}) failed`),ae}if(J){const ae=Gc(h,o,M);yield global.Linking.openURL(ae,n.client.name)}else{const ye=Un[te.request.method].res;ye.tvf=kn(Zt({},re),{correlationId:i}),c?(ye.internal=kn(Zt({},ye.internal),{throwOnFailedPublish:!0}),yield n.client.core.relayer.publish(o,M,ye)):n.client.core.relayer.publish(o,M,ye).catch(Se=>n.client.logger.error(Se))}yield n.client.core.history.resolve(b)});return function(s){return r.apply(this,arguments)}}()),Ye(this,"sendError",function(){var r=(0,l.A)(function*(s){const{id:i,topic:o,error:a,encodeOpts:c,rpcOpts:d,appLink:h}=s,b=Xc(i,a);let M;const J=h&&typeof(null==global?void 0:global.Linking)<"u";try{const re=J?Ys:or;M=yield n.client.core.crypto.encode(o,b,kn(Zt({},c||{}),{encoding:re}))}catch(re){throw yield n.cleanup(),n.client.logger.error(`sendError() -> core.crypto.encode() for topic ${o} failed`),re}let te;try{te=yield n.client.core.history.get(o,i)}catch(re){throw n.client.logger.error(`sendError() -> history.get(${o}, ${i}) failed`),re}if(J){const re=Gc(h,o,M);yield global.Linking.openURL(re,n.client.name)}else n.client.core.relayer.publish(o,M,d||Un[te.request.method].res);yield n.client.core.history.resolve(b)});return function(s){return r.apply(this,arguments)}}()),Ye(this,"cleanup",(0,l.A)(function*(){const r=[],s=[];n.client.session.getAll().forEach(i=>{let o=!1;Vr(i.expiry)&&(o=!0),n.client.core.crypto.keychain.has(i.topic)||(o=!0),o&&r.push(i.topic)}),n.client.proposal.getAll().forEach(i=>{Vr(i.expiryTimestamp)&&s.push(i.id)}),yield Promise.all([...r.map(i=>n.deleteSession({topic:i})),...s.map(i=>n.deleteProposal(i))])})),Ye(this,"onProviderMessageEvent",function(){var r=(0,l.A)(function*(s){!n.initialized||n.relayMessageCache.length>0?n.relayMessageCache.push(s):yield n.onRelayMessage(s)});return function(s){return r.apply(this,arguments)}}()),Ye(this,"onRelayEventRequest",function(){var r=(0,l.A)(function*(s){n.requestQueue.queue.push(s),yield n.processRequestsQueue()});return function(s){return r.apply(this,arguments)}}()),Ye(this,"processRequestsQueue",(0,l.A)(function*(){if("ACTIVE"!==n.requestQueue.state){for(n.client.logger.info(`Request queue starting with ${n.requestQueue.queue.length} requests`);n.requestQueue.queue.length>0;){n.requestQueue.state="ACTIVE";const r=n.requestQueue.queue.shift();if(r)try{yield n.processRequest(r)}catch(s){n.client.logger.warn(s)}}n.requestQueue.state="IDLE"}else n.client.logger.info("Request queue already active, skipping...")})),Ye(this,"processRequest",function(){var r=(0,l.A)(function*(s){const{topic:i,payload:o,attestation:a,transportType:c,encryptedId:d}=s,h=o.method;if(!n.shouldIgnorePairingRequest({topic:i,requestMethod:h}))switch(h){case"wc_sessionPropose":return yield n.onSessionProposeRequest
193({topic:i,payload:o,attestation:a,encryptedId:d});case"wc_sessionSettle":return yield n.onSessionSettleRequest(i,o);case"wc_sessionUpdate":return yield n.onSessionUpdateRequest(i,o);case"wc_sessionExtend":return yield n.onSessionExtendRequest(i,o);case"wc_sessionPing":return yield n.onSessionPingRequest(i,o);case"wc_sessionDelete":return yield n.onSessionDeleteRequest(i,o);case"wc_sessionRequest":return yield n.onSessionRequest({topic:i,payload:o,attestation:a,encryptedId:d,transportType:c});case"wc_sessionEvent":return yield n.onSessionEventRequest(i,o);case"wc_sessionAuthenticate":return yield n.onSessionAuthenticateRequest({topic:i,payload:o,attestation:a,encryptedId:d,transportType:c});default:return n.client.logger.info(`Unsupported request method ${h}`)}});return function(s){return r.apply(this,arguments)}}()),Ye(this,"onRelayEventResponse",function(){var r=(0,l.A)(function*(s){const{topic:i,payload:o,transportType:a}=s,c=(yield n.client.core.history.get(i,o.id)).request.method;switch(c){case"wc_sessionPropose":return n.onSessionProposeResponse(i,o,a);case"wc_sessionSettle":return n.onSessionSettleResponse(i,o);case"wc_sessionUpdate":return n.onSessionUpdateResponse(i,o);case"wc_sessionExtend":return n.onSessionExtendResponse(i,o);case"wc_sessionPing":return n.onSessionPingResponse(i,o);case"wc_sessionRequest":return n.onSessionRequestResponse(i,o);case"wc_sessionAuthenticate":return n.onSessionAuthenticateResponse(i,o);default:return n.client.logger.info(`Unsupported response method ${c}`)}});return function(s){return r.apply(this,arguments)}}()),Ye(this,"onRelayEventUnknownPayload",r=>{const{topic:s}=r,{message:i}=et("MISSING_OR_INVALID",`Decoded payload on topic ${s} is not identifiable as a JSON-RPC request or a response.`);throw new Error(i)}),Ye(this,"shouldIgnorePairingRequest",r=>{const{topic:s,requestMethod:i}=r,o=this.expectedPairingMethodMap.get(s);return!(!o||o.includes(i)||!(o.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0))}),Ye(this,"onSessionProposeRequest",function(){var r=(0,l.A)(function*(s){const{topic:i,payload:o,attestation:a,encryptedId:c}=s,{params:d,id:h}=o;try{const b=n.client.core.eventClient.getEvent({topic:i});0===n.client.events.listenerCount("session_proposal")&&(console.warn("No listener for session_proposal event"),b?.setError("proposal_listener_not_found")),n.isValidConnect(Zt({},o.params));const M=d.expiryTimestamp||yn(Un.wc_sessionPropose.req.ttl),J=Zt({id:h,pairingTopic:i,expiryTimestamp:M,attestation:a,encryptedId:c},d);yield n.setProposal(h,J);const te=yield n.getVerifyContext({attestationId:a,hash:wr(JSON.stringify(o)),encryptedId:c,metadata:J.proposer.metadata});b?.addTrace("emit_session_proposal"),n.client.events.emit("session_proposal",{id:h,params:J,verifyContext:te})}catch(b){yield n.sendError({id:h,topic:i,error:b,rpcOpts:Un.wc_sessionPropose.autoReject}),n.client.logger.error(b)}});return function(s){return r.apply(this,arguments)}}()),Ye(this,"onSessionProposeResponse",function(){var r=(0,l.A)(function*(s,i,o){const{id:a}=i;if(Zr(i)){const{result:c}=i;n.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:c});const d=n.client.proposal.get(a);n.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:d});const h=d.proposer.publicKey;n.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:h});const b=c.responderPublicKey;n.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:b});const M=yield n.client.core.crypto.generateSharedKey(h,b);n.pendingSessions.set(a,{sessionTopic:M,pairingTopic:s,proposalId:a,publicKey:h});const J=yield n.client.core.relayer.subscribe(M,{transportType:o});n.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:J}),yield n.client.core.pairing.activate({topic:s})}else if(Cr(i)){yield n.deleteProposal(a);const c=Jt("session_connect",a);if(0===n.events.listenerCount(c))throw new Error(`emitting ${c} without any listeners, 954`);n.events.emit(c,{error:i.error})}});return function(s,i,o){return r.apply(this,arguments)}}()),Ye(this,"onSessionSettleRequest",function(){var r=(0,l.A)(function*(s,i){const{id:o,params:a}=i;try{n.isValidSessionSettleRequest(a);const{relay:c,controller:d,expiry:h,namespaces:b,sessionProperties:M,scopedProperties:J,sessionConfig:te,proposalRequestsResponses:re}=i.params,ae=[...n.pendingSessions.values()].find(oe=>oe.sessionTopic===s);if(!ae)return n.client.logger.error(`Pending session not found for topic ${s}`);const ye=n.client.proposal.get(ae.proposalId),Se=kn(Zt(Zt(Zt({topic:s,relay:c,expiry:h,namespaces:b,acknowledged:!0,pairingTopic:ae.pairingTopic,requiredNamespaces:ye.requiredNamespaces,optionalNamespaces:ye.optionalNamespaces,controller:d.publicKey,self:{publicKey:ae.publicKey,metadata:n.client.metadata},peer:{publicKey:d.publicKey,metadata:d.metadata}},M&&{sessionProperties:M}),J&&{scopedProperties:J}),te&&{sessionConfig:te}),{transportType:an.relay,authentication:re?.authentication,walletPayResult:re?.walletPay});yield n.client.session.set(Se.topic,Se),yield n.setExpiry(Se.topic,Se.expiry),yield n.client.core.pairing.updateMetadata({topic:ae.pairingTopic,metadata:Se.peer.metadata}
193),n.pendingSessions.delete(ae.proposalId),n.deleteProposal(ae.proposalId,!1),n.cleanupDuplicatePairings(Se),yield n.sendResult({id:i.id,topic:s,throwOnFailedPublish:!0,result:!0}),n.client.events.emit("session_connect",{session:Se}),n.events.emit(Jt("session_connect",ae.proposalId),{session:Se})}catch(c){yield n.sendError({id:o,topic:s,error:c}),n.client.logger.error(c)}});return function(s,i){return r.apply(this,arguments)}}()),Ye(this,"onSessionSettleResponse",function(){var r=(0,l.A)(function*(s,i){const{id:o}=i;Zr(i)?(yield n.client.session.update(s,{acknowledged:!0}),n.events.emit(Jt("session_approve",o),{})):Cr(i)&&(yield n.client.session.delete(s,cn("USER_DISCONNECTED")),n.events.emit(Jt("session_approve",o),{error:i.error}))});return function(s,i){return r.apply(this,arguments)}}()),Ye(this,"onSessionUpdateRequest",function(){var r=(0,l.A)(function*(s,i){const{params:o,id:a}=i;try{const c=`${s}_session_update`,d=da.get(c);if(d&&n.isRequestOutOfSync(d,a))return n.client.logger.warn(`Discarding out of sync request - ${a}`),void n.sendError({id:a,topic:s,error:cn("INVALID_UPDATE_REQUEST")});n.isValidUpdate(Zt({topic:s},o));try{da.set(c,a),yield n.client.session.update(s,{namespaces:o.namespaces}),yield n.sendResult({id:a,topic:s,result:!0})}catch(h){throw da.delete(c),h}n.client.events.emit("session_update",{id:a,topic:s,params:o})}catch(c){yield n.sendError({id:a,topic:s,error:c}),n.client.logger.error(c)}});return function(s,i){return r.apply(this,arguments)}}()),Ye(this,"isRequestOutOfSync",(r,s)=>s.toString().slice(0,-3)<r.toString().slice(0,-3)),Ye(this,"onSessionUpdateResponse",(r,s)=>{const{id:i}=s,o=Jt("session_update",i);if(0===this.events.listenerCount(o))throw new Error(`emitting ${o} without any listeners`);Zr(s)?this.events.emit(Jt("session_update",i),{}):Cr(s)&&this.events.emit(Jt("session_update",i),{error:s.error})}),Ye(this,"onSessionExtendRequest",function(){var r=(0,l.A)(function*(s,i){const{id:o}=i;try{n.isValidExtend({topic:s}),yield n.setExpiry(s,yn(no)),yield n.sendResult({id:o,topic:s,result:!0}),n.client.events.emit("session_extend",{id:o,topic:s})}catch(a){yield n.sendError({id:o,topic:s,error:a}),n.client.logger.error(a)}});return function(s,i){return r.apply(this,arguments)}}()),Ye(this,"onSessionExtendResponse",(r,s)=>{const{id:i}=s,o=Jt("session_extend",i);if(0===this.events.listenerCount(o))throw new Error(`emitting ${o} without any listeners`);Zr(s)?this.events.emit(Jt("session_extend",i),{}):Cr(s)&&this.events.emit(Jt("session_extend",i),{error:s.error})}),Ye(this,"onSessionPingRequest",function(){var r=(0,l.A)(function*(s,i){const{id:o}=i;try{n.isValidPing({topic:s}),yield n.sendResult({id:o,topic:s,result:!0,throwOnFailedPublish:!0}),n.client.events.emit("session_ping",{id:o,topic:s})}catch(a){yield n.sendError({id:o,topic:s,error:a}),n.client.logger.error(a)}});return function(s,i){return r.apply(this,arguments)}}()),Ye(this,"onSessionPingResponse",(r,s)=>{const{id:i}=s,o=Jt("session_ping",i);setTimeout(()=>{if(0===this.events.listenerCount(o))throw new Error(`emitting ${o} without any listeners 2176`);Zr(s)?this.events.emit(Jt("session_ping",i),{}):Cr(s)&&this.events.emit(Jt("session_ping",i),{error:s.error})},500)}),Ye(this,"onSessionDeleteRequest",function(){var r=(0,l.A)(function*(s,i){const{id:o}=i;try{yield n.isValidDisconnect({topic:s,reason:i.params}),n.cleanupPendingSentRequestsForTopic({topic:s,error:cn("USER_DISCONNECTED")}),yield n.deleteSession({topic:s,id:o})}catch(a){n.client.logger.error(a)}});return function(s,i){return r.apply(this,arguments)}}()),Ye(this,"onSessionRequest",function(){var r=(0,l.A)(function*(s){var i,o,a;const{topic:c,payload:d,attestation:h,encryptedId:b,transportType:M}=s,{id:J,params:te}=d;try{yield n.isValidRequest(Zt({topic:c},te));const re=n.client.session.get(c),ye={id:J,topic:c,params:te,verifyContext:yield n.getVerifyContext({attestationId:h,hash:wr(JSON.stringify(Ur("wc_sessionRequest",te,J))),encryptedId:b,metadata:re.peer.metadata,transportType:M})};yield n.setPendingSessionRequest(ye),M===an.link_mode&&null!=(i=re.peer.metadata.redirect)&&i.universal&&n.client.core.addLinkModeSupportedApp(null==(o=re.peer.metadata.redirect)?void 0:o.universal),null!=(a=n.client.signConfig)&&a.disableRequestQueue?n.emitSessionRequest(ye):(n.addSessionRequestToSessionRequestQueue(ye),n.processSessionRequestQueue())}
193catch(re){yield n.sendError({id:J,topic:c,error:re}),n.client.logger.error(re)}});return function(s){return r.apply(this,arguments)}}()),Ye(this,"onSessionRequestResponse",(r,s)=>{const{id:i}=s,o=Jt("session_request",i);if(0===this.events.listenerCount(o))throw new Error(`emitting ${o} without any listeners`);Zr(s)?this.events.emit(Jt("session_request",i),{result:s.result}):Cr(s)&&this.events.emit(Jt("session_request",i),{error:s.error})}),Ye(this,"onSessionEventRequest",function(){var r=(0,l.A)(function*(s,i){const{id:o,params:a}=i;try{const c=`${s}_session_event_${a.event.name}`,d=da.get(c);if(d&&n.isRequestOutOfSync(d,o))return void n.client.logger.info(`Discarding out of sync request - ${o}`);n.isValidEmit(Zt({topic:s},a)),n.client.events.emit("session_event",{id:o,topic:s,params:a}),da.set(c,o)}catch(c){yield n.sendError({id:o,topic:s,error:c}),n.client.logger.error(c)}});return function(s,i){return r.apply(this,arguments)}}()),Ye(this,"onSessionAuthenticateResponse",(r,s)=>{const{id:i}=s;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:r,payload:s}),Zr(s)?this.events.emit(Jt("session_request",i),{result:s.result}):Cr(s)&&this.events.emit(Jt("session_request",i),{error:s.error})}),Ye(this,"onSessionAuthenticateRequest",function(){var r=(0,l.A)(function*(s){var i;const{topic:o,payload:a,attestation:c,encryptedId:d,transportType:h}=s;try{const{requester:b,authPayload:M,expiryTimestamp:J}=a.params,te=yield n.getVerifyContext({attestationId:c,hash:wr(JSON.stringify(a)),encryptedId:d,metadata:b.metadata,transportType:h}),re={requester:b,pairingTopic:o,id:a.id,authPayload:M,verifyContext:te,expiryTimestamp:J};yield n.setAuthRequest(a.id,{request:re,pairingTopic:o,transportType:h}),h===an.link_mode&&null!=(i=b.metadata.redirect)&&i.universal&&n.client.core.addLinkModeSupportedApp(b.metadata.redirect.universal),n.client.events.emit("session_authenticate",{topic:o,params:a.params,id:a.id,verifyContext:te})}catch(b){n.client.logger.error(b);const M=a.params.requester.publicKey,J=yield n.client.core.crypto.generateKeyPair(),te=n.getAppLinkIfEnabled(a.params.requester.metadata,h),re={type:1,receiverPublicKey:M,senderPublicKey:J};yield n.sendError({id:a.id,topic:o,error:b,encodeOpts:re,rpcOpts:Un.wc_sessionAuthenticate.autoReject,appLink:te})}});return function(s){return r.apply(this,arguments)}}()),Ye(this,"addSessionRequestToSessionRequestQueue",r=>{this.sessionRequestQueue.queue.push(r)}),Ye(this,"cleanupAfterResponse",r=>{this.deletePendingSessionRequest(r.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state="IDLE",this.processSessionRequestQueue()},(0,_.toMiliseconds)(this.requestQueueDelay))}),Ye(this,"cleanupPendingSentRequestsForTopic",({topic:r,error:s})=>{const i=this.client.core.history.pending;i.length>0&&i.filter(o=>o.topic===r&&"wc_sessionRequest"===o.request.method).forEach(o=>{this.events.emit(Jt("session_request",o.request.id),{error:s})})}),Ye(this,"processSessionRequestQueue",()=>{if("ACTIVE"===this.sessionRequestQueue.state)return void this.client.logger.info("session request queue is already active.");const r=this.sessionRequestQueue.queue[0];if(r)try{this.emitSessionRequest(r)}catch(s){this.client.logger.error(s)}else this.client.logger.info("session request queue is empty.")}),Ye(this,"emitSessionRequest",r=>{this.emittedSessionRequests.has(r.id)?this.client.logger.warn({id:r.id},`Skipping emitting \`session_request\` event for duplicate request. id: ${r.id}`):(this.sessionRequestQueue.state="ACTIVE",this.emittedSessionRequests.add(r.id),this.client.events.emit("session_request",r))}),Ye(this,"onPairingCreated",r=>{if(r.methods&&this.expectedPairingMethodMap.set(r.topic,r.methods),r.active)return;const s=this.client.proposal.getAll().find(i=>i.pairingTopic===r.topic);
193s&&this.onSessionProposeRequest({topic:r.topic,payload:Ur("wc_sessionPropose",kn(Zt({},s),{requiredNamespaces:s.requiredNamespaces,optionalNamespaces:s.optionalNamespaces,relays:s.relays,proposer:s.proposer,sessionProperties:s.sessionProperties,scopedProperties:s.scopedProperties}),s.id),attestation:s.attestation,encryptedId:s.encryptedId})}),Ye(this,"isValidConnect",function(){var r=(0,l.A)(function*(s){if(!ar(s)){const{message:b}=et("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(s)}`);throw new Error(b)}const{pairingTopic:i,requiredNamespaces:o,optionalNamespaces:a,sessionProperties:c,scopedProperties:d,relays:h}=s;if(An(i)||(yield n.isValidPairingTopic(i)),!function pO(t,e){let n=!1;return e&&!t?n=!0:t&&bs(t)&&t.length&&t.forEach(r=>{n=Ry(r)}),n}(h,!0)){const{message:b}=et("MISSING_OR_INVALID",`connect() relays: ${h}`);throw new Error(b)}if(o&&!An(o)&&0!==qr(o)){const b="requiredNamespaces are deprecated and are automatically assigned to optionalNamespaces";["fatal","error","silent"].includes(n.client.logger.level)?console.warn(b):n.client.logger.warn(b),n.validateNamespaces(o,"requiredNamespaces")}if(a&&!An(a)&&0!==qr(a)&&n.validateNamespaces(a,"optionalNamespaces"),c&&!An(c)&&n.validateSessionProps(c,"sessionProperties"),d&&!An(d)){n.validateSessionProps(d,"scopedProperties");const b=Object.keys(o||{}).concat(Object.keys(a||{}));if(!Object.keys(d).every(M=>b.includes(M.split(":")[0])))throw new Error(`Scoped properties must be a subset of required/optional namespaces, received: ${JSON.stringify(d)}, required/optional namespaces: ${JSON.stringify(b)}`)}});return function(s){return r.apply(this,arguments)}}()),Ye(this,"validateNamespaces",(r,s)=>{const i=function hO(t,e,n){let r=null;if(t&&qr(t)){const s=xy(t,e);s&&(r=s);const i=function lO(t,e,n){let r=null;return Object.entries(t).forEach(([s,i])=>{if(r)return;const o=function cO(t,e,n){let r=null;return bs(e)&&e.length?e.forEach(s=>{r||Zc(s)||(r=cn("UNSUPPORTED_CHAINS",`${n}, chain ${s} should be a string and conform to "namespace:chainId" format`))}):Zc(t)||(r=cn("UNSUPPORTED_CHAINS",`${n}, 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"] }`)),r}(s,xd(s,i),`${e} ${n}`);o&&(r=o)}),r}(t,e,n);i&&(r=i)}else r=et("MISSING_OR_INVALID",`${e}, ${n} should be an object with data`);return r}(r,"connect()",s);if(i)throw new Error(i.message)}),Ye(this,"isValidApprove",function(){var r=(0,l.A)(function*(s){if(!ar(s))throw new Error(et("MISSING_OR_INVALID",`approve() params: ${s}`).message);const{id:i,namespaces:o,relayProtocol:a,sessionProperties:c,scopedProperties:d}=s;n.checkRecentlyDeleted(i),yield n.isValidProposalId(i);const h=n.client.proposal.get(i),b=Jc(o,"approve()");if(b)throw new Error(b.message);const M=Cf(h.requiredNamespaces,o,"approve()");if(M)throw new Error(M.message);if(!_n(a,!0)){const{message:J}=et("MISSING_OR_INVALID",`approve() relayProtocol: ${a}`);throw new Error(J)}if(c&&!An(c)&&n.validateSessionProps(c,"sessionProperties"),d&&!An(d)){n.validateSessionProps(d,"scopedProperties");const J=new Set(Object.keys(o));if(!Object.keys(d).every(te=>J.has(te.split(":")[0])))throw new Error(`Scoped properties must be a subset of approved namespaces, received: ${JSON.stringify(d)}, approved namespaces: ${Array.from(J).join(", ")}`)}});return function(s){return r.apply(this,arguments)}}()),Ye(this,"isValidReject",function(){var r=(0,l.A)(function*(s){if(!ar(s)){const{message:a}=et("MISSING_OR_INVALID",`reject() params: ${s}`);throw new Error(a)}const{id:i,reason:o}=s;if(n.checkRecentlyDeleted(i),yield n.isValidProposalId(i),!function mO(t){return!!(t&&"object"==typeof t&&t.code&&wf(t.code,!1)&&t.message&&_n(t.message,!1))}(o)){const{message:a}=et("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(o)}`);throw new Error(a)}});return function(s){return r.apply(this,arguments)}}()),Ye(this,"isValidSessionSettleRequest",r=>{if(!ar(r)){const{message:h}=et("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${r}`);throw new Error(h)}const{relay:s,controller:i,namespaces:o,expiry:a}=r;if(!Ry(s)){const{message:h}=et("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(h)}const c=function aO(t,e){let n=null;return _n(t?.publicKey,!1)||(n=et("MISSING_OR_INVALID",`${e} controller public key should be a string`)),n}(i,"onSessionSettleRequest()");if(c)throw new Error(c.message);const d=Jc(o,"onSessionSettleRequest()");if(d)throw new Error(d.message);if(Vr(a)){const{message:h}=et("EXPIRED","onSessionSettleRequest()");throw new Error(h)}}),Ye(this,"isValidUpdate",function(){var r=(0,l.A)(function*(s){if(!ar(s)){const{message:h}=et("MISSING_OR_INVALID",`update() params: ${s}`);throw new Error(h)}const{topic:i,namespaces:o}=s;n.checkRecentlyDeleted(i),yield n.isValidSessionTopic(i);
193const a=n.client.session.get(i),c=Jc(o,"update()");if(c)throw new Error(c.message);const d=Cf(a.requiredNamespaces,o,"update()");if(d)throw new Error(d.message)});return function(s){return r.apply(this,arguments)}}()),Ye(this,"isValidExtend",function(){var r=(0,l.A)(function*(s){if(!ar(s)){const{message:o}=et("MISSING_OR_INVALID",`extend() params: ${s}`);throw new Error(o)}const{topic:i}=s;n.checkRecentlyDeleted(i),yield n.isValidSessionTopic(i)});return function(s){return r.apply(this,arguments)}}()),Ye(this,"isValidRequest",function(){var r=(0,l.A)(function*(s){if(!ar(s)){const{message:h}=et("MISSING_OR_INVALID",`request() params: ${s}`);throw new Error(h)}const{topic:i,request:o,chainId:a,expiry:c}=s;n.checkRecentlyDeleted(i),yield n.isValidSessionTopic(i);const{namespaces:d}=n.client.session.get(i);if(!Py(d,a)){const{message:h}=et("MISSING_OR_INVALID",`request() chainId: ${a}`);throw new Error(h)}if(!function yO(t){return!(An(t)||!_n(t.method,!1))}(o)){const{message:h}=et("MISSING_OR_INVALID",`request() ${JSON.stringify(o)}`);throw new Error(h)}if(!function vO(t,e,n){return!!_n(n,!1)&&function XT(t,e){const n=[];return Object.values(t).forEach(r=>{Xi(r.accounts).includes(e)&&n.push(...r.methods)}),n}(t,e).includes(n)}(d,a,o.method)){const{message:h}=et("MISSING_OR_INVALID",`request() method: ${o.method}`);throw new Error(h)}n.validateRequestExpiry(c)});return function(s){return r.apply(this,arguments)}}()),Ye(this,"isValidRespond",function(){var r=(0,l.A)(function*(s){var i;if(!ar(s)){const{message:d}=et("MISSING_OR_INVALID",`respond() params: ${s}`);throw new Error(d)}const{topic:o,response:a}=s;try{yield n.isValidSessionTopic(o)}catch(d){throw null!=(i=s?.response)&&i.id&&n.cleanupAfterResponse(s),d}if(!function _O(t){return!(An(t)||An(t.result)&&An(t.error)||!wf(t.id,!1)||!_n(t.jsonrpc,!1))}(a)){const{message:d}=et("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(a)}`);throw new Error(d)}const c=n.client.pendingRequest.get(a.id);if(c.topic!==o){const{message:d}=et("MISMATCHED_TOPIC",`Request response topic mismatch. reqId: ${a.id}, expected topic: ${c.topic}, received topic: ${o}`);throw new Error(d)}});return function(s){return r.apply(this,arguments)}}()),Ye(this,"isValidPing",function(){var r=(0,l.A)(function*(s){if(!ar(s)){const{message:o}=et("MISSING_OR_INVALID",`ping() params: ${s}`);throw new Error(o)}const{topic:i}=s;yield n.isValidSessionOrPairingTopic(i)});return function(s){return r.apply(this,arguments)}}()),Ye(this,"isValidEmit",function(){var r=(0,l.A)(function*(s){if(!ar(s)){const{message:d}=et("MISSING_OR_INVALID",`emit() params: ${s}`);throw new Error(d)}const{topic:i,event:o,chainId:a}=s;yield n.isValidSessionTopic(i);const{namespaces:c}=n.client.session.get(i);if(!Py(c,a)){const{message:d}=et("MISSING_OR_INVALID",`emit() chainId: ${a}`);throw new Error(d)}if(!function EO(t){return!(An(t)||!_n(t.name,!1))}(o)){const{message:d}=et("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(o)}`);throw new Error(d)}if(!function bO(t,e,n){return!!_n(n,!1)&&function QT(t,e){const n=[];return Object.values(t).forEach(r=>{Xi(r.accounts).includes(e)&&n.push(...r.events)}),n}(t,e).includes(n)}(c,a,o.name)){const{message:d}=et("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(o)}`);throw new Error(d)}});return function(s){return r.apply(this,arguments)}}()),Ye(this,"isValidDisconnect",function(){var r=(0,l.A)(function*(s){if(!ar(s)){const{message:o}=et("MISSING_OR_INVALID",`disconnect() params: ${s}`);throw new Error(o)}const{topic:i}=s;yield n.isValidSessionOrPairingTopic(i)});return function(s){return r.apply(this,arguments)}}()),Ye(this,"isValidAuthenticate",r=>{const{chains:s,uri:i,domain:o,nonce:a}=r;if(!Array.isArray(s)||0===s.length)throw new Error("chains is required and must be a non-empty array");if(!_n(i,!1))throw new Error("uri is required parameter");if(!_n(o,!1))throw new Error("domain is required parameter");if(!_n(a,!1))throw new Error("nonce is required parameter");if([...new Set(s.map(d=>Kr(d).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:c}=Kr(s[0]);if("eip155"!==c)throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")}),Ye(this,"getVerifyContext",function(){var r=(0,l.A)(function*(s){const{attestationId:i,hash:o,encryptedId:a,metadata:c,transportType:d}=s,h={verified:{verifyUrl:c.verifyUrl||ga,validation:"UNKNOWN",origin:c.url||""}};try{if(d===an.link_mode){const M=n.getAppLinkIfEnabled(c,d);return h.verified.validation=M&&new URL(M).origin===new URL(c.url).origin?"VALID":"INVALID",h}const b=yield n.client.core.verify.resolve({attestationId:i,hash:o,encryptedId:a,verifyUrl:c.verifyUrl});b&&(h.verified.origin=b.origin,h.verified.isScam=b.isScam,h.verified.validation=b.origin===new URL(c.url).origin?"VALID":"INVALID")}catch(b){n.client.logger.warn(b)}return n.client.logger.debug(`Verify context: ${JSON.stringify(h)}`),h});return function(s){return r.apply(this,arguments)}}()),Ye(this,"validateSessionProps",(r,s)=>{Object.values(r).forEach((i,o)=>
193{if(null==i){const{message:a}=et("MISSING_OR_INVALID",`${s} must contain an existing value for each key. Received: ${i} for key ${Object.keys(r)[o]}`);throw new Error(a)}})}),Ye(this,"getPendingAuthRequest",r=>{const s=this.client.auth.requests.get(r);return"object"==typeof s?s:void 0}),Ye(this,"addToRecentlyDeleted",(r,s)=>{if(this.recentlyDeletedMap.set(r,s),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let i=0;const o=this.recentlyDeletedLimit/2;for(const a of this.recentlyDeletedMap.keys()){if(i++>=o)break;this.recentlyDeletedMap.delete(a)}}}),Ye(this,"checkRecentlyDeleted",r=>{const s=this.recentlyDeletedMap.get(r);if(s){const{message:i}=et("MISSING_OR_INVALID",`Record was recently deleted - ${s}: ${r}`);throw new Error(i)}}),Ye(this,"isLinkModeEnabled",(r,s)=>{var i,o,a,c,d,h,b,M,J;return!(!r||s!==an.link_mode)&&!0===(null==(o=null==(i=this.client.metadata)?void 0:i.redirect)?void 0:o.linkMode)&&void 0!==(null==(c=null==(a=this.client.metadata)?void 0:a.redirect)?void 0:c.universal)&&""!==(null==(h=null==(d=this.client.metadata)?void 0:d.redirect)?void 0:h.universal)&&void 0!==(null==(b=r?.redirect)?void 0:b.universal)&&""!==(null==(M=r?.redirect)?void 0:M.universal)&&!0===(null==(J=r?.redirect)?void 0:J.linkMode)&&this.client.core.linkModeSupportedApps.includes(r.redirect.universal)&&typeof(null==global?void 0:global.Linking)<"u"}),Ye(this,"getAppLinkIfEnabled",(r,s)=>{var i;return this.isLinkModeEnabled(r,s)?null==(i=r?.redirect)?void 0:i.universal:void 0}),Ye(this,"handleLinkModeMessage",({url:r})=>{if(!r||!r.includes("wc_ev")||!r.includes("topic"))return;const s=$m(r,"topic")||"",i=decodeURIComponent($m(r,"wc_ev")||""),o=this.client.session.keys.includes(s);o&&this.client.session.update(s,{transportType:an.link_mode}),this.client.core.dispatchEnvelope({topic:s,message:i,sessionExists:o})}),Ye(this,"registerLinkModeListeners",(0,l.A)(function*(){var r;if(Bd()||ks()&&null!=(r=n.client.metadata.redirect)&&r.linkMode){const s=null==global?void 0:global.Linking;if(typeof s<"u"){s.addEventListener("url",n.handleLinkModeMessage,n.client.name);const i=yield s.getInitialURL();i&&setTimeout(()=>{n.handleLinkModeMessage({url:i})},50)}}})),Ye(this,"getTVFApproveParams",r=>{try{const s=Ty(r.namespaces),i=function ZT(t){const e=[];return Object.values(t).forEach(n=>{e.push(...n.methods)}),[...new Set(e)]}(r.namespaces),o=function JT(t){const e=[];return Object.values(t).forEach(n=>{e.push(...n.events)}),[...new Set(e)]}(r.namespaces);return{approvedChains:s,approvedMethods:i,approvedEvents:o,sessionProperties:r.sessionProperties,scopedProperties:r.scopedProperties}}catch(s){return this.client.logger.warn(s,"Error getting TVF approve params"),{}}}),Ye(this,"getTVFParams",(r,s,i)=>{var o,a,c;if(null==(o=s.request)||!o.method)return{};const d={correlationId:r,rpcMethods:[s.request.method],chainId:s.chainId};try{const h=this.extractTxHashesFromResult(s.request,i);d.txHashes=h,d.contractAddresses=this.isValidContractData(s.request.params)?[null==(c=null==(a=s.request.params)?void 0:a[0])?void 0:c.to]:[]}catch(h){this.client.logger.warn(h,"Error getting TVF params")}return d}),Ye(this,"isValidContractData",r=>{var s;if(!r)return!1;try{const i=r?.data||(null==(s=r?.[0])?void 0:s.data);if(!i.startsWith("0x"))return!1;const o=i.slice(2);return!!/^[0-9a-fA-F]*$/.test(o)&&o.length%2==0}catch{}return!1}),Ye(this,"extractTxHashesFromResult",(r,s)=>{var i;try{if(!s)return[];const o=r.method,a=K3[o];if("sui_signTransaction"===o)return[LS(s.transactionBytes)];if("near_signTransaction"===o)return[u0(s)];if("near_signTransactions"===o)return s.map(d=>u0(d));if("xrpl_signTransactionFor"===o||"xrpl_signTransaction"===o)return[null==(i=s.tx_json)?void 0:i.hash];if("polkadot_signTransaction"===o)return[FO({transaction:r.params.transactionPayload,signature:s.signature})];if("algo_signTxn"===o)return bs(s)?s.map(d=>d0(d)):[d0(s)];if("cosmos_signDirect"===o)return[WS(s)];if("wallet_sendCalls"===o)return function jS(t){var e,n;const r=[];try{if("string"==typeof t)return r.push(t),r;if("object"!=typeof t)return r;null!=t&&t.id&&r.push(t.id);const s=null==(n=null==(e=t?.capabilities)?void 0:e.caip345)?void 0:n.transactionHashes;s&&r.push(...s)}catch(s){console.warn("getWalletSendCallsHashes failed: ",s)}return r}(s);if("string"==typeof s)return[s];const c=s[a.key];if(bs(c))return"solana_signAllTransactions"===o?c.map(d=>function BS(t){const e=atob(t),n=new Uint8Array(e.length);for(let o=0;o<e.length;o++)n[o]=e.charCodeAt(o);const r=n[0];if(0===r)throw new Error("No signatures found");if(n.length<1+64*r)throw new Error("Transaction data too short for claimed signature count");if(n.length<100)throw new Error("Transaction too short");const i=sn.from(t,"base64").slice(1,65);return fs.encode(i)}(d)):c;if("string"==typeof c)return[c]}catch(o){this.client.logger.warn(o,"Error extracting tx hashes from result")}return[]})}processPendingMessageEvents(){var e=this;return(0,l.A)(function*(){try{const r=e.client.core.relayer.messages.getWithoutAck(e.client.session.keys);for(const[s,i]of Object.entries(r))for(const o of i)try{yield e.onProviderMessageEvent({topic:s,message:o,publishedAt:Date.now()})}catch{e.client.logger.warn(`Error processing pending message event for topic: ${s}, message: ${o}`)}}catch(n){e.client.logger.warn(n,"processPendingMessageEvents failed")}})()}isInitialized(){if(!this.initialized){const{message:e}=et("NOT_INITIALIZED",this.name);throw new Error(e)}}confirmOnlineStateOrThrow(){var e=this;return(0,l.A)(function*(){yield e.client.core.relayer.confirmOnlineStateOrThrow()})()}registerRelayerEvents(){this.client.core.relayer.on("relayer_message",e=>{this.onProviderMessageEvent(e)})}onRelayMessage(e){var n=this;return(0,l.A)(function*(){const{topic:r,message:s,attestation:i,transportType:o}=e,{publicKey:a}=n.client.auth.authKeys.keys.includes(sl)?n.client.auth.authKeys.get(sl):{responseTopic:void 0,publicKey:void 0};try{const c=yield n.client.core.crypto.decode(r,s,{receiverPublicKey:a,encoding:o===an.link_mode?Ys:or});Nf(c)?(n.client.core.history.set(r,c),yield n.onRelayEventRequest({topic:r,payload:c,attestation:i,transportType:o,encryptedId:wr(s)})):Qc(c)?(yield n.client.core.history.resolve(c),yield n.onRelayEventResponse({topic:r,payload:c,transportType:o}),n.client.core.history.delete(r,c.id)):(n.client.logger.error(`onRelayMessage() -> unknown payload: ${JSON.stringify(c)}`),yield n.onRelayEventUnknownPayload({topic:r,payload:c,transportType:o})),yield n.client.core.relayer.messages.ack(r,s)}catch(c){n.client.logger.error(`onRelayMessage() ->
193 failed to process an inbound message: ${s}`),n.client.logger.error(c)}})()}registerExpirerEvents(){var e=this;this.client.core.expirer.on(Ir_expired,function(){var n=(0,l.A)(function*(r){const{topic:s,id:i}=Wm(r.target);return i&&e.client.pendingRequest.keys.includes(i)?yield e.deletePendingSessionRequest(i,et("EXPIRED"),!0):i&&e.client.auth.requests.keys.includes(i)?yield e.deletePendingAuthRequest(i,et("EXPIRED"),!0):void(s?e.client.session.keys.includes(s)&&(yield e.deleteSession({topic:s,expirerHasDeleted:!0}),e.client.events.emit("session_expire",{topic:s})):i&&(yield e.deleteProposal(i,!0),e.client.events.emit("proposal_expire",{id:i})))});return function(r){return n.apply(this,arguments)}}())}registerPairingEvents(){this.client.core.pairing.events.on("pairing_create",e=>this.onPairingCreated(e)),this.client.core.pairing.events.on("pairing_delete",e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!_n(e,!1)){const{message:n}=et("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(n)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:n}=et("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(n)}if(Vr(this.client.core.pairing.pairings.get(e).expiry)){const{message:n}=et("EXPIRED",`pairing topic: ${e}`);throw new Error(n)}}isValidSessionTopic(e){var n=this;return(0,l.A)(function*(){if(!_n(e,!1)){const{message:r}=et("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(r)}if(n.checkRecentlyDeleted(e),!n.client.session.keys.includes(e)){const{message:r}=et("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(r)}if(Vr(n.client.session.get(e).expiry)){yield n.deleteSession({topic:e});const{message:r}=et("EXPIRED",`session topic: ${e}`);throw new Error(r)}if(!n.client.core.crypto.keychain.has(e)){const{message:r}=et("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw yield n.deleteSession({topic:e}),new Error(r)}})()}isValidSessionOrPairingTopic(e){var n=this;return(0,l.A)(function*(){if(n.checkRecentlyDeleted(e),n.client.session.keys.includes(e))yield n.isValidSessionTopic(e);else{if(!n.client.core.pairing.pairings.keys.includes(e)){if(_n(e,!1)){const{message:r}=et("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(r)}{const{message:r}=et("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(r)}}n.isValidPairingTopic(e)}})()}isValidProposalId(e){var n=this;return(0,l.A)(function*(){if(!function gO(t){return"number"==typeof t}(e)){const{message:r}=et("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(r)}if(!n.client.proposal.keys.includes(e)){const{message:r}=et("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(r)}if(Vr(n.client.proposal.get(e).expiryTimestamp)){yield n.deleteProposal(e);const{message:r}=et("EXPIRED",`proposal id: ${e}`);throw new Error(r)}})()}validateRequestExpiry(e){if(e&&!function AO(t,e){return wf(t,!1)&&t<=e.max&&t>=e.min}(e,qf)){const{message:n}=et("MISSING_OR_INVALID",`request() expiry: ${e}. Expiry must be a number (in seconds) between ${qf.min} and ${qf.max}`);throw new Error(n)}}}class sP extends bi{constructor(e,n){super(e,n,"proposal",Vf),this.core=e,this.logger=n}}class iP extends bi{constructor(e,n){super(e,n,"session",Vf),this.core=e,this.logger=n}}class oP extends bi{constructor(e,n){super(e,n,"request",Vf,r=>r.id),this.core=e,this.logger=n}}class aP extends bi{constructor(e,n){super(e,n,"authKeys",rl,()=>sl),this.core=e,this.logger=n}}class cP extends bi{constructor(e,n){super(e,n,"pairingTopics",rl),this.core=e,this.logger=n}}class lP extends bi{constructor(e,n){super(e,n,"requests",rl,r=>r.id),this.core=e,this.logger=n}}var uP=Object.defineProperty,Zf=(t,e,n)=>((t,e,n)=>e in t?uP(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,"symbol"!=typeof e?e+"":e,n);class fP{constructor(e,n){this.core=e,this.logger=n,Zf(this,"authKeys"),Zf(this,"pairingTopics"),Zf(this,"requests"),this.authKeys=new aP(this.core,this.logger),this.pairingTopics=new cP(this.core,this.logger),this.requests=new lP(this.core,this.logger)}init(){var e=this;return(0,l.A)(function*(){yield e.authKeys.init(),yield e.pairingTopics.init(),yield e.requests.init()})()}}var hP=Object.defineProperty,zt=(t,e,n)=>((t,e,n)=>e in t?hP(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,"symbol"!=typeof e?e+"":e,n);class Jf extends _l{constructor(e){var n;super(e),n=this,zt(this,"protocol","wc"),zt(this,"version",2),zt(this,"name","client"),zt(this,"metadata"),zt(this,"core"),zt(this,"logger"),zt(this,"events",new O.EventEmitter),zt(this,"engine"),zt(this,"session"),zt(this,"proposal"),zt(this,"pendingRequest"),zt(this,"auth"),zt(this,"signConfig"),zt(this,"on",(s,i)=>this.events.on(s,i)),zt(this,"once",(s,i)=>this.events.once(s,i)),zt(this,"off",(s,i)=>this.events.off(s,i)),zt(this,"removeListener",(s,i)=>this.events.removeListener(s,i)),zt(this,"removeAllListeners",s=>this.events.removeAllListeners(s)),zt(this,"connect",function(){var s=(0,l.A)(function*(i){try{return yield n.engine.connect(i)}catch(o){throw n.logger.error(o.message),o}});return function(i){return s.apply(this,arguments)}}()),zt(this,"pair",function(){var s=(0,l.A)(function*(i){try{return yield n.engine.pair(i)}catch(o){throw n.logger.error(o.message),o}});return function(i){return s.apply(this,arguments)}}()),zt(this,"approve",function(){var s=(0,l.A)(function*(i){try{return yield n.engine.approve(i)}catch(o){throw n.logger.error(o.message),o}});return function(i){return s.apply(this,arguments)}}()),zt(this,"reject",function(){var s=(0,l.A)(function*(i){try{return yield n.engine.reject(i)}catch(o){throw n.logger.error(o.message),o}});return function(i){return s.apply(this,arguments)}}()),zt(this,"update",function(){var s=(0,l.A)(function*(i){try{return yield n.engine.update(i)}catch(o){throw n.logger.error(o.message),o}});return function(i){return s.apply(this,arguments)}}()),zt(this,"extend",function(){var s=(0,l.A)(function*(i){try{return yield n.engine.extend(i)}catch(o){throw n.logger.error(o.message),o}});return function(i){return s.apply(this,arguments)}}()),zt(this,"request",function(){var s=(0,l.A)(function*(i){try{return yield n.engine.request(i)}catch(o){throw n.logger.error(o.message),o}});return function(i){return s.apply(this,arguments)}}()),zt(this,"respond",function(){var s=(0,l.A)(function*(i){try{return yield n.engine.respond(i)}catch(o){throw n.logger.error(o.message),o}});return function(i){return s.apply(this,arguments)}}()),zt(this,"ping",function(){var s=(0,l.A)(function*(i){try{return yield n.engine.ping(i)}catch(o){throw n.logger.error(o.message),o}});return function(i){return s.apply(this,arguments)}}()),zt(this,"emit",function(){var s=(0,l.A)(function*(i){try{return yield n.engine.emit(i)}catch(o){throw n.logger.error(o.message),o}});return function(i){return s.apply(this,arguments)}}()),zt(this,"disconnect",function(){var s=(0,l.A)(function*(i){try{return yield n.engine.disconnect(i)}catch(o){throw n.logger.error(o.message),o}});return function(i){return s.apply(this,arguments)}}()),zt(this,"find",s=>{try{return this.engine.find(s)}catch(i){throw this.logger.error(i.message),i}}),zt(this,"getPendingSessionRequests",()=>{try{return this.engine.getPendingSessionRequests()}catch(s){throw this.logger.error(s.message),s}}),zt(this,"authenticate",function(){var s=(0,l.A)(function*(i,o){try{return yield n.engine.authenticate(i,o)}catch(a){throw n.logger.error(a.message),a}});return function(i,o){return s.apply(this,arguments)}}()),zt(this,"formatAuthMessage",s=>{try{return this.engine.formatAuthMessage(s)}catch(i){throw this.logger.error(i.message),i}}),zt(this,"approveSessionAuthenticate",function(){var s=(0,l.A)(function*(i){try{return yield n.engine.approveSessionAuthenticate(i)}catch(o){throw n.logger.error(o.message),o}});return function(i){return s.apply(this,arguments)}}()),zt(this,"rejectSessionAuthenticate",function(){var s=(0,l.A)(function*(i){try{return yield n.engine.rejectSessionAuthenticate(i)}catch(o){throw n.logger.error(o.message),o}});return function(i){return s.apply(this,arguments)}}()),this.name=e?.name||"client",this.metadata=function OI(t){var e,n;const r=Bm();try{return null!=t&&t.url&&r.url&&new URL(t.url).host!==new URL(r.url).host&&(console.warn(`The configured WalletConnect 'metadata.url':${t.url} differs from the actual page url:${r.url}. This is probably unintended and can lead to issues.`),t.url=r.url),null!=(e=t?.icons)&&e.length&&t.icons.length>0&&(t.icons=t.icons.filter(s=>""!==s)),((t,e)=>yI(t,_I(e)))(Dm(Dm({},r),t),{url:t?.url||r.url,name:t?.name||r.name,description:t?.description||r.description,icons:null!=(n=t?.
193icons)&&n.length&&t.icons.length>0?t.icons:r.icons})}catch(s){return console.warn("Error populating app metadata",s),t||r}}(e?.metadata),this.signConfig=e?.signConfig;const r=Tf({logger:e?.logger||"error",name:this.name});this.logger=r,this.core=e?.core||new W3(e),this.session=new iP(this.core,this.logger),this.proposal=new sP(this.core,this.logger),this.pendingRequest=new oP(this.core,this.logger),this.engine=new rP(this),this.auth=new fP(this.core,this.logger)}static init(e){return(0,l.A)(function*(){const n=new Jf(e);return yield n.initialize(),n})()}get context(){return(0,Ct.oI)(this.logger)}get pairing(){return this.core.pairing.pairings}initialize(){var e=this;return(0,l.A)(function*(){e.logger.trace("Initialized");try{yield e.core.start(),yield e.session.init(),yield e.proposal.init(),yield e.pendingRequest.init(),yield e.auth.init(),yield e.engine.init(),e.logger.info("SignClient Initialization Success")}catch(n){throw e.logger.info("SignClient Initialization Failure"),e.logger.error(n.message),n}})()}}const gP=Jf;var mP=u(27886),j_=u.n(mP),yP=Object.defineProperty,_P=Object.defineProperties,EP=Object.getOwnPropertyDescriptors,$_=Object.getOwnPropertySymbols,vP=Object.prototype.hasOwnProperty,bP=Object.prototype.propertyIsEnumerable,H_=(t,e,n)=>e in t?yP(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,K_=(t,e)=>{for(var n in e||(e={}))vP.call(e,n)&&H_(t,n,e[n]);if($_)for(var n of $_(e))bP.call(e,n)&&H_(t,n,e[n]);return t},z_=(t,e)=>_P(t,EP(e));const V_={headers:{Accept:"application/json","Content-Type":"application/json"},method:"POST"};class q_{constructor(e,n=!1){if(this.url=e,this.disableProviderPing=n,this.events=new O.EventEmitter,this.isAvailable=!1,this.registering=!1,!Ky(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=n}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,n){this.events.on(e,n)}once(e,n){this.events.once(e,n)}off(e,n){this.events.off(e,n)}removeListener(e,n){this.events.removeListener(e,n)}open(){var e=this;return(0,l.A)(function*(n=e.url){yield e.register(n)}).apply(this,arguments)}close(){var e=this;return(0,l.A)(function*(){if(!e.isAvailable)throw new Error("Connection already closed");e.onClose()})()}send(e){var n=this;return(0,l.A)(function*(){n.isAvailable||(yield n.register());try{const r=Oe(e),s=yield(yield j_()(n.url,z_(K_({},V_),{body:r}))).json();n.onPayload({data:s})}catch(r){n.onError(e.id,r)}})()}register(){var e=this;return(0,l.A)(function*(n=e.url){if(!Ky(n))throw new Error(`Provided URL is not compatible with HTTP connection: ${n}`);if(e.registering){const r=e.events.getMaxListeners();return(e.events.listenerCount("register_error")>=r||e.events.listenerCount("open")>=r)&&e.events.setMaxListeners(r+1),new Promise((s,i)=>{e.events.once("register_error",o=>{e.resetMaxListeners(),i(o)}),e.events.once("open",()=>{if(e.resetMaxListeners(),typeof e.isAvailable>"u")return i(new Error("HTTP connection is missing or invalid"));s()})})}e.url=n,e.registering=!0;try{if(!e.disableProviderPing){const r=Oe({id:1,jsonrpc:"2.0",method:"test",params:[]});yield j_()(n,z_(K_({},V_),{body:r}))}e.onOpen()}catch(r){const s=e.parseError(r);throw e.events.emit("register_error",s),e.onClose(),s}}).apply(this,arguments)}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;const n="string"==typeof e.data?he(e.data):e.data;this.events.emit("payload",n)}onError(e,n){const r=this.parseError(n),i=Xc(e,r.message||r.toString());this.events.emit("payload",i)}parseError(e,n=this.url){return jy(e,n,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>10&&this.events.setMaxListeners(10)}}var il=u(37044).hp;function SP(t){return"__proto__"===t}function Xf(t){return null==t||"object"!=typeof t&&"function"!=typeof t}function Y_(t){return Object.getOwnPropertySymbols(t).filter(e=>Object.prototype.propertyIsEnumerable.call(t,e))}
193function Qf(t){return null==t?void 0===t?"[object Undefined]":"[object Null]":Object.prototype.toString.call(t)}const Z_="[object String]",J_="[object Number]",X_="[object Boolean]",Q_="[object Arguments]",eE="[object Object]";function eh(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function ro(t,e,n,r=new Map,s=void 0){const i=s?.(t,e,n,r);if(void 0!==i)return i;if(Xf(t))return t;if(r.has(t))return r.get(t);if(Array.isArray(t)){const o=new Array(t.length);r.set(t,o);for(let a=0;a<t.length;a++)o[a]=ro(t[a],a,n,r,s);return Object.hasOwn(t,"index")&&(o.index=t.index),Object.hasOwn(t,"input")&&(o.input=t.input),o}if(t instanceof Date)return new Date(t.getTime());if(t instanceof RegExp){const o=new RegExp(t.source,t.flags);return o.lastIndex=t.lastIndex,o}if(t instanceof Map){const o=new Map;r.set(t,o);for(const[a,c]of t)o.set(a,ro(c,a,n,r,s));return o}if(t instanceof Set){const o=new Set;r.set(t,o);for(const a of t)o.add(ro(a,void 0,n,r,s));return o}if(typeof il<"u"&&il.isBuffer(t))return t.subarray();if(eh(t)){const o=new(Object.getPrototypeOf(t).constructor)(t.length);r.set(t,o);for(let a=0;a<t.length;a++)o[a]=ro(t[a],a,n,r,s);return o}if(t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer)return t.slice(0);if(t instanceof DataView){const o=new DataView(t.buffer.slice(0),t.byteOffset,t.byteLength);return r.set(t,o),Br(o,t,n,r,s),o}if(typeof File<"u"&&t instanceof File){const o=new File([t],t.name,{type:t.type});return r.set(t,o),Br(o,t,n,r,s),o}if(typeof Blob<"u"&&t instanceof Blob){const o=new Blob([t],{type:t.type});return r.set(t,o),Br(o,t,n,r,s),o}if(t instanceof Error){const o=new t.constructor;return r.set(t,o),o.message=t.message,o.name=t.name,o.stack=t.stack,o.cause=t.cause,Br(o,t,n,r,s),o}if(t instanceof Boolean){const o=new Boolean(t.valueOf());return r.set(t,o),Br(o,t,n,r,s),o}if(t instanceof Number){const o=new Number(t.valueOf());return r.set(t,o),Br(o,t,n,r,s),o}if(t instanceof String){const o=new String(t.valueOf());return r.set(t,o),Br(o,t,n,r,s),o}if("object"==typeof t&&function zP(t){switch(Qf(t)){case Q_:case"[object Array]":case"[object ArrayBuffer]":case"[object DataView]":case X_:case"[object Date]":case"[object Float32Array]":case"[object Float64Array]":case"[object Int8Array]":case"[object Int16Array]":case"[object Int32Array]":case"[object Map]":case J_:case eE:case"[object RegExp]":case"[object Set]":case Z_:case"[object Symbol]":case"[object Uint8Array]":case"[object Uint8ClampedArray]":case"[object Uint16Array]":case"[object Uint32Array]":return!0;default:return!1}}(t)){const o=Object.create(Object.getPrototypeOf(t));return r.set(t,o),Br(o,t,n,r,s),o}return t}function Br(t,e,n=t,r,s){const i=[...Object.keys(e),...Y_(e)];for(let o=0;o<i.length;o++){const a=i[o],c=Object.getOwnPropertyDescriptor(t,a);(null==c||c.writable)&&(t[a]=ro(e[a],a,n,r,s))}}function tE(t){return function VP(t,e){return function KP(t,e){return ro(t,void 0,t,new Map,e)}(t,(n,r,s,i)=>{const o=e?.(n,r,s,i);if(void 0!==o)return o;if("object"==typeof t){if(Qf(t)===eE&&"function"!=typeof t.constructor){const a={};return i.set(t,a),Br(a,t,s,i),a}switch(Object.prototype.toString.call(t)){case J_:case Z_:case X_:{const a=new t.constructor(t?.valueOf());return Br(a,t),a}case Q_:{const a={};return Br(a,t),a.length=t.length,a[Symbol.iterator]=t[Symbol.iterator],a}default:return}}})}(t)}function nE(t){return null!==t&&"object"==typeof t&&"[object Arguments]"===Qf(t)}function th(t){return"object"==typeof t&&null!==t}function GP(t){return th(t)&&function IP(t){return null!=t&&"function"!=typeof t&&function AP(t){return Number.isSafeInteger(t)&&t>=0}(t.length)}(t)}function qP(){}function nh(t){return eh(t)}function rh(t){if("object"!=typeof t||null==t)return!1;if(null===Object.getPrototypeOf(t))return!0;if("[object Object]"!==Object.prototype.toString.call(t)){const n=t[Symbol.toStringTag];return!(null==n||!Object.getOwnPropertyDescriptor(t,Symbol.toStringTag)?.writable)&&t.toString()===`[object ${n}]`}let e=t;for(;null!==Object.getPrototypeOf(e);)e=Object.getPrototypeOf(e);return Object.getPrototypeOf(t)===e}function sh(t,e,n,r){if(Xf(t)&&(t=Object(t)),null==e||"object"!=typeof e)return t;if(r.has(e))return function YP(t){if(Xf(t))return t;if(Array.isArray(t)||eh(t)||t instanceof ArrayBuffer||typeof SharedArrayBuffer<"u"&&t instanceof SharedArrayBuffer)return t.slice(0);const e=Object.getPrototypeOf(t);if(null==e)return Object.assign(Object.create(e),t);const n=e.constructor;if(t instanceof Date||t instanceof Map||t instanceof Set)return new n(t);if(t instanceof RegExp){const r=new n(t);return r.lastIndex=t.lastIndex,r}if(t instanceof DataView)return new n(t.buffer.slice(0));if(t instanceof Error){let r;return r=t instanceof AggregateError?new n(t.errors,t.message,{cause:t.cause}):new n(t.message,{cause:t.cause}),r.stack=t.stack,Object.assign(r,t),r}if(typeof File<"u"&&t instanceof File)return new n([t],t.name,{type:t.type,lastModified:t.lastModified});if("object"==typeof t){const r=Object.create(e);return Object.assign(r,t)}return t}(r.get(e));if(r.set(e,t),Array.isArray(e)){e=e.slice();for(let i=0;i<e.length;i++)e[i]=e[i]??void 0}const s=[...Object.keys(e),...Y_(e)];for(let i=0;i<s.length;i++){const o=s[i];if(SP(o))continue;let a=e[o],c=t[o];if(nE(a)&&(a={...a}),nE(c)&&(c={...c}
193),typeof il<"u"&&il.isBuffer(a)&&(a=tE(a)),Array.isArray(a))if(Array.isArray(c)){const h=[],b=Reflect.ownKeys(c);for(let M=0;M<b.length;M++){const J=b[M];h[J]=c[J]}c=h}else if(GP(c)){const h=[];for(let b=0;b<c.length;b++)h[b]=c[b];c=h}else c=[];const d=n(c,a,o,t,e,r);void 0!==d?t[o]=d:Array.isArray(a)||th(c)&&th(a)&&(rh(c)||rh(a)||nh(c)||nh(a))?t[o]=sh(c,a,n,r):null==c&&rh(a)?t[o]=sh({},a,n,r):null==c&&nh(a)?t[o]=tE(a):(void 0===c||void 0!==a)&&(t[o]=a)}return t}const sE="universal_provider",ol=`wc@2:${sE}:`,iE="https://rpc.walletconnect.org/v1/",oE="generic",eD=`${iE}bundler`,so="call_status";var nD=Object.defineProperty,rD=Object.defineProperties,sD=Object.getOwnPropertyDescriptors,aE=Object.getOwnPropertySymbols,iD=Object.prototype.hasOwnProperty,oD=Object.prototype.propertyIsEnumerable,cE=(t,e,n)=>e in t?nD(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,al=(t,e)=>{for(var n in e||(e={}))iD.call(e,n)&&cE(t,n,e[n]);if(aE)for(var n of aE(e))oD.call(e,n)&&cE(t,n,e[n]);return t},aD=(t,e)=>rD(t,sD(e));function lE(t,e,n){var r;const s=Kr(t);return(null==(r=e.rpcMap)?void 0:r[s.reference])||`${iE}?chainId=${s.namespace}:${s.reference}&projectId=${n}`}function uE(t){return t.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function dE(t){return Object.fromEntries(Object.entries(t).filter(([e,n])=>{var r,s;return(null==(r=n?.chains)?void 0:r.length)&&(null==(s=n?.chains)?void 0:s.length)>0}))}function cl(t={},e={}){return function JP(t,...e){return function ZP(t,...e){const n=e.slice(0,-1),r=e[e.length-1];let s=t;for(let i=0;i<n.length;i++)s=sh(s,n[i],r,new Map);return s}(t,...e,qP)}(dE(fE(t)),dE(fE(e)))}function fE(t){var e,n,r,s,i;const o={};if(!qr(t))return o;for(const[a,c]of Object.entries(t)){const d=qc(a)?[a]:c.chains,h=c.methods||[],b=c.events||[],M=c.rpcMap||{},J=Qi(a);o[J]=aD(al(al({},o[J]),c),{chains:rr(d,null==(e=o[J])?void 0:e.chains),methods:rr(h,null==(n=o[J])?void 0:n.methods),events:rr(b,null==(r=o[J])?void 0:r.events)}),(qr(M)||qr((null==(s=o[J])?void 0:s.rpcMap)||{}))&&(o[J].rpcMap=al(al({},M),null==(i=o[J])?void 0:i.rpcMap))}return o}function hE(t){return t.includes(":")?t.split(":")[2]:t}function pE(t){const e={};for(const[n,r]of Object.entries(t)){const s=r.methods||[],i=r.events||[],o=r.accounts||[],a=qc(n)?[n]:r.chains?r.chains:uE(r.accounts);e[n]={chains:a,methods:s,events:i,accounts:o}}return e}function oh(t){return"number"==typeof t?t:t.includes("0x")?parseInt(t,16):(t=t.includes(":")?t.split(":")[1]:t,isNaN(Number(t))?t:Number(t))}const gE={},io=t=>gE[t],ah=(t,e)=>{gE[t]=e};var dD=Object.defineProperty,mE=Object.getOwnPropertySymbols,fD=Object.prototype.hasOwnProperty,hD=Object.prototype.propertyIsEnumerable,yE=(t,e,n)=>e in t?dD(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,_E=(t,e)=>{for(var n in e||(e={}))fD.call(e,n)&&yE(t,n,e[n]);if(mE)for(var n of mE(e))hD.call(e,n)&&yE(t,n,e[n]);return t};const pD=["atomic","flow-control","paymasterService","sessionKeys","auxiliaryFunds"],gD=t=>t&&t.startsWith("0x")?BigInt(t).toString(10):t,ch=t=>t&&t.startsWith("0x")?t:`0x${BigInt(t).toString(16)}`,vE=t=>Object.keys(t).filter(e=>pD.includes(e)).reduce((e,n)=>(e[n]=mD(t[n]),e),{}),mD=t=>"string"==typeof t&&function uD(t){try{const e=JSON.parse(t);return"object"==typeof e&&null!==e&&!Array.isArray(e)}catch{return!1}}(t)?JSON.parse(t):t;var _D=Object.defineProperty;let lh;class uh{constructor(e){((t,e,n)=>{((t,e,n)=>{e in t?_D(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n})(t,"symbol"!=typeof e?e+"":e,n)})(this,"storage"),this.storage=e}getItem(e){var n=this;return(0,l.A)(function*(){return yield n.storage.getItem(e)})()}setItem(e,n){var r=this;return(0,l.A)(function*(){return yield r.storage.setItem(e,n)})()}removeItem(e){var n=this;return(0,l.A)(function*(){return yield n.storage.removeItem(e)})()}static getStorage(e){return lh||(lh=new uh(e)),lh}}var bD=Object.defineProperty,wD=Object.defineProperties,CD=Object.getOwnPropertyDescriptors,bE=Object.getOwnPropertySymbols,AD=Object.prototype.hasOwnProperty,ID=Object.prototype.propertyIsEnumerable,wE=(t,e,n)=>e in t?bD(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n;function dh(){return dh=(0,l.A)(function*(t,e){const n=Kr(t.result.capabilities.caip345.caip2),r=t.result.capabilities.caip345.transactionHashes,s=yield Promise.allSettled(r.map(b=>function ND(t,e,n){return fh.apply(this,arguments)}(n.reference,b,e))),i=s.filter(b=>"fulfilled"===b.status).map(b=>b.value).filter(b=>b);s.filter(b=>
193"rejected"===b.status).forEach(b=>console.warn("Failed to fetch transaction receipt:",b.reason));const o=!i.length||i.some(b=>!b),a=i.every(b=>"0x1"===b?.status),c=i.every(b=>"0x0"===b?.status),d=i.some(b=>"0x0"===b?.status);let h;return o?h=100:a?h=200:c?h=500:d&&(h=600),{id:t.result.id,version:t.request.version,atomic:t.request.atomicRequired,chainId:t.request.chainId,capabilities:t.result.capabilities,receipts:i,status:h}}),dh.apply(this,arguments)}function fh(){return fh=(0,l.A)(function*(t,e,n){return yield n(parseInt(t)).request(Ur("eth_getTransactionReceipt",[e]))}),fh.apply(this,arguments)}function hh(){return hh=(0,l.A)(function*({sendCalls:t,storage:e}){const n=yield e.getItem(so);yield e.setItem(so,((t,e)=>wD(t,CD(e)))(((t,e)=>{for(var n in e||(e={}))AD.call(e,n)&&wE(t,n,e[n]);if(bE)for(var n of bE(e))ID.call(e,n)&&wE(t,n,e[n]);return t})({},n),{[t.result.id]:{request:t.request,result:t.result,expiry:yn(86400)}}))}),hh.apply(this,arguments)}function ph(){return ph=(0,l.A)(function*({resultId:t,storage:e}){const n=yield e.getItem(so);if(n){delete n[t],yield e.setItem(so,n);for(const r in n)Vr(n[r].expiry)&&delete n[r];yield e.setItem(so,n)}}),ph.apply(this,arguments)}function gh(){return gh=(0,l.A)(function*({resultId:t,storage:e}){const n=yield e.getItem(so),r=n?.[t];if(r&&!Vr(r.expiry))return r;yield function RD(t){return ph.apply(this,arguments)}({resultId:t,storage:e})}),gh.apply(this,arguments)}var DD=Object.defineProperty,UD=Object.defineProperties,kD=Object.getOwnPropertyDescriptors,CE=Object.getOwnPropertySymbols,MD=Object.prototype.hasOwnProperty,BD=Object.prototype.propertyIsEnumerable,mh=(t,e,n)=>e in t?DD(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,yh=(t,e)=>{for(var n in e||(e={}))MD.call(e,n)&&mh(t,n,e[n]);if(CE)for(var n of CE(e))BD.call(e,n)&&mh(t,n,e[n]);return t},_h=(t,e)=>UD(t,kD(e)),wi=(t,e,n)=>mh(t,"symbol"!=typeof e?e+"":e,n);class LD{constructor(e){wi(this,"name","eip155"),wi(this,"client"),wi(this,"chainId"),wi(this,"namespace"),wi(this,"httpProviders"),wi(this,"events"),wi(this,"storage"),this.namespace=e.namespace,this.events=io("events"),this.client=io("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain()),this.storage=uh.getStorage(this.client.core.storage)}request(e){var n=this;return(0,l.A)(function*(){switch(e.request.method){case"eth_requestAccounts":case"eth_accounts":return n.getAccounts();case"wallet_switchEthereumChain":return yield n.handleSwitchChain(e);case"eth_chainId":return parseInt(n.getDefaultChain());case"wallet_getCapabilities":return yield n.getCapabilities(e);case"wallet_getCallsStatus":return yield n.getCallStatus(e);case"wallet_sendCalls":return yield n.sendCalls(e)}return n.namespace.methods.includes(e.request.method)?yield n.client.request(e):n.getHttpProvider().request(e.request)})()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,n){this.httpProviders[e]||this.setHttpProvider(parseInt(e),n);const r=this.chainId;this.chainId=parseInt(e),this.events.emit("default_chain_changed",{currentCaipChainId:`${this.name}:${e}`,previousCaipChainId:`${this.name}:${r}`})}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId.toString();if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}createHttpProvider(e,n){const r=n||lE(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${e}`);return new xf(new q_(r,io("disableProviderPing")))}setHttpProvider(e,n){const r=this.createHttpProvider(e,n);r&&(this.httpProviders[e]=r)}createHttpProviders(){const e={};return this.namespace.chains.forEach(n=>{var r;const s=parseInt(function cD(t){return t.includes(":")?t.split(":")[1]:t}(n));e[s]=this.createHttpProvider(s,null==(r=this.namespace.rpcMap)?void 0:r[n])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(n=>n.split(":")[1]===this.chainId.toString()).map(n=>n.split(":")[2]))]:[]}getHttpProvider(e){const n=e||this.chainId;return this.httpProviders[n]||(this.httpProviders=_h(yh({},this.httpProviders),{[n]:this.createHttpProvider(n)}),this.httpProviders[n])}handleSwitchChain(e){var n=this;return(0,l.A)(function*(){var r,s;let i=e.request.params?null==(r=e.request.params[0])?void 0:r.chainId:"0x0";i=i.startsWith("0x")?i:`0x${i}`;const o=parseInt(i,16);if(n.isChainApproved(o))n.setDefaultChain(`${o}`);else{if(!n.namespace.methods.includes("wallet_switchEthereumChain"))throw new Error(`Failed to switch to chain 'eip155:${o}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);yield n.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:i}]},chainId:null==(s=n.namespace.chains)?void 0:s[0]}),n.setDefaultChain(`${o}`)}return null})()}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}getCapabilities(e){var n=this;return(0,l.A)(function*(){var r,s,i,o,a;const c=null==(s=null==(r=e.request)?void 0:r.params)?void 0:s[0],d=(null==(o=null==(i=e.request)?void 0:i.params)?void 0:o[1])||[];if(!c)throw new Error("Missing address parameter in `wallet_getCapabilities` request");const h=n.client.session.get(e.topic),b=(null==(a=h?.sessionProperties)?void 0:a.capabilities)||{},J=`${c}${d.length>0?d.join(","):`0x${n.chainId.toString(16)}`}`,te=b?.[J];if(te)return te;let re;try{re=((t,e,n)=>{const{sessionProperties:r={},scopedProperties:s={}}=t,i={};if(!qr(s)&&!qr(r))return;const o=vE(r);for(const a of n){const c=gD(a);if(!c)continue;i[ch(c)]=o;const d=s?.[`eip155:${c}`];if(d){const h=d?.[`eip155:${c}:${e}`];i[ch(c)]=_E(_E({},i[ch(c)]),vE(h||d))}}for(const[a,c]of Object.entries(i))0===Object.keys(c).length&&delete i[a];return Object.keys(i).length>0?i:void 0})(h,c,d)}catch(ye){console.warn("Failed to extract capabilities from session",ye)}if(re)return re;const ae=yield n.client.request(e);try{yield n.client.session.update(e.topic,{sessionProperties:_h(yh({},h.sessionProperties||{}),{capabilities:_h(yh({},b||{}),{[J]:ae})})})}catch(ye){console.warn("Failed to update session with capabilities",ye)}return ae})()}getCallStatus(e){var n=this;return(0,l.A)(function*(){var r,s,i;const o=n.client.session.get(e.topic),a=null==(r=o.sessionProperties)?void 0:r.bundler_name;if(a){const h=n.getBundlerUrl(e.chainId,a);try{return yield n.getUserOperationReceipt(h,e)}catch(b){console.warn("Failed to fetch call status from bundler",b,h)}}const c=null==(s=o.sessionProperties)?void 0:s.bundler_url;if(c)try{return yield n.getUserOperationReceipt(c,e)}catch(h){console.warn("Failed to fetch call status from custom bundler",h,c)}const d=yield function PD(t){return gh.apply(this,arguments)}({resultId:null==(i=e.request.params)?void 0:i[0],storage:n.storage});if(d)try{return yield function OD(t,e){return dh.apply(this,arguments)}(d,n.getHttpProvider.bind(n))}catch(h){console.warn("Failed to fetch call status from stored send calls",h,d)}if(n.namespace.methods.includes(e.request.method))return yield n.client.request(e);throw new Error("Fetching call status not approved by the wallet.")})()}getUserOperationReceipt(e,n){return(0,l.A)(function*(){var r;const s=new URL(e),i=yield fetch(s,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(Ur("eth_getUserOperationReceipt",[null==(r=n.request.params)?void 0:r[0]]))});if(!i.ok)throw new Error(`Failed to fetch user operation receipt - ${i.status}`);return yield i.json()})()}
193getBundlerUrl(e,n){return`${eD}?projectId=${this.client.core.projectId}&chainId=${e}&bundler=${n}`}sendCalls(e){var n=this;return(0,l.A)(function*(){var r,s,i;const o=yield n.client.request(e),a=null==(r=e.request.params)?void 0:r[0],c=o?.id,d=o?.capabilities||{},h=null==(s=d?.caip345)?void 0:s.caip2,b=null==(i=d?.caip345)?void 0:i.transactionHashes;return!c||!h||!(null!=b&&b.length)||(yield function xD(t){return hh.apply(this,arguments)}({sendCalls:{request:a,result:o},storage:n.storage})),o})()}}var FD=Object.defineProperty,oo=(t,e,n)=>((t,e,n)=>e in t?FD(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n)(t,"symbol"!=typeof e?e+"":e,n);class jD{constructor(e){oo(this,"name",oE),oo(this,"client"),oo(this,"httpProviders"),oo(this,"events"),oo(this,"namespace"),oo(this,"chainId"),this.namespace=e.namespace,this.events=io("events"),this.client=io("client"),this.chainId=this.getDefaultChain(),this.name=this.getNamespaceName(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace.chains=[...new Set((this.namespace.chains||[]).concat(e.chains||[]))],this.namespace.accounts=[...new Set((this.namespace.accounts||[]).concat(e.accounts||[]))],this.namespace.methods=[...new Set((this.namespace.methods||[]).concat(e.methods||[]))],this.namespace.events=[...new Set((this.namespace.events||[]).concat(e.events||[]))],this.httpProviders=this.createHttpProviders()}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider(e.chainId).request(e.request)}setDefaultChain(e,n){this.httpProviders[e]||this.setHttpProvider(e,n);const r=this.chainId;this.chainId=e,this.events.emit("default_chain_changed",{currentCaipChainId:`${this.name}:${e}`,previousCaipChainId:`${this.name}:${r}`})}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}getNamespaceName(){const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return Kr(e).namespace}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(n=>n.split(":")[1]===this.chainId.toString()).map(n=>n.split(":")[2]))]:[]}createHttpProviders(){var e,n;const r={};return null==(n=null==(e=this.namespace)?void 0:e.accounts)||n.forEach(s=>{var i,o;const a=Kr(s),c=null==(o=null==(i=this.namespace)?void 0:i.rpcMap)?void 0:o[`${a.namespace}:${a.reference}`];r[a.reference]=this.createHttpProvider(s,c)}),r}getHttpProvider(e){const n=Kr(e).reference,r=this.httpProviders[n];if(typeof r>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return r}setHttpProvider(e,n){const r=this.createHttpProvider(e,n);r&&(this.httpProviders[e]=r)}createHttpProvider(e,n){const r=n||lE(e,this.namespace,this.client.core.projectId);if(!r)throw new Error(`No RPC url provided for chainId: ${e}`);return new xf(new q_(r,io("disableProviderPing")))}}var $D=Object.defineProperty,HD=Object.defineProperties,KD=Object.getOwnPropertyDescriptors,AE=Object.getOwnPropertySymbols,zD=Object.prototype.hasOwnProperty,VD=Object.prototype.propertyIsEnumerable,Eh=(t,e,n)=>e in t?$D(t,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):t[e]=n,wa=(t,e)=>{for(var n in e||(e={}))zD.call(e,n)&&Eh(t,n,e[n]);if(AE)for(var n of AE(e))VD.call(e,n)&&Eh(t,n,e[n]);return t},ll=(t,e)=>HD(t,KD(e)),yr=(t,e,n)=>Eh(t,"symbol"!=typeof e?e+"":e,n);class vh{constructor(e){var n,r;yr(this,"client"),yr(this,"namespaces"),yr(this,"optionalNamespaces"),yr(this,"sessionProperties"),yr(this,"scopedProperties"),yr(this,"events",new O),yr(this,"rpcProviders",{}),yr(this,"session"),yr(this,"providerOpts"),yr(this,"logger"),yr(this,"uri"),yr(this,"disableProviderPing",!1),yr(this,"connectParams"),this.providerOpts=e,this.logger=Tf({logger:null!=(n=e.logger)?n:"error",name:null!=(r=this.providerOpts.name)?r:sE}),this.disableProviderPing=e?.disableProviderPing||!1}static init(e){return(0,l.A)(function*(){const n=new vh(e);return yield n.initialize(),n})()}request(e,n,r){var s=this;return(0,l.A)(function*(){const[i,o]=s.validateChain(n);if(!s.session)throw new Error("Please call connect() before request()");return yield s.getProvider(i).request({request:wa({}
193,e),chainId:`${i}:${o}`,topic:s.session.topic,expiry:r})})()}sendAsync(e,n,r,s){const i=(new Date).getTime();this.request(e,r,s).then(o=>n(null,ha(i,o))).catch(o=>n(o,void 0))}enable(){var e=this;return(0,l.A)(function*(){if(!e.client)throw new Error("Sign Client not initialized");return e.session||(yield e.connect({namespaces:e.namespaces,optionalNamespaces:e.optionalNamespaces,sessionProperties:e.sessionProperties,scopedProperties:e.scopedProperties})),yield e.requestAccounts()})()}disconnect(){var e=this;return(0,l.A)(function*(){var n;if(!e.session)throw new Error("Please call connect() before enable()");yield e.client.disconnect({topic:null==(n=e.session)?void 0:n.topic,reason:cn("USER_DISCONNECTED")}),yield e.cleanup()})()}connect(e){var n=this;return(0,l.A)(function*(){if(!n.client)throw new Error("Sign Client not initialized");if(n.connectParams=e,n.setNamespaces(e),n.cleanupPendingPairings(),!e.skipPairing)return yield n.pair(e.pairingTopic)})()}authenticate(e,n){var r=this;return(0,l.A)(function*(){if(!r.client)throw new Error("Sign Client not initialized");r.setNamespaces(e),yield r.cleanupPendingPairings();const{uri:s,response:i}=yield r.client.authenticate(e,n);s&&(r.uri=s,r.events.emit("display_uri",s));const o=yield i();if(r.session=o.session,r.session){const a=pE(r.session.namespaces);r.namespaces=cl(r.namespaces,a),yield r.persist("namespaces",r.namespaces),r.onConnect()}return o})()}on(e,n){this.events.on(e,n)}once(e,n){this.events.once(e,n)}removeListener(e,n){this.events.removeListener(e,n)}off(e,n){this.events.off(e,n)}get isWalletConnect(){return!0}pair(e){var n=this;return(0,l.A)(function*(){var r,s;const{uri:i,approval:o}=yield n.client.connect({pairingTopic:e,requiredNamespaces:n.namespaces,optionalNamespaces:n.optionalNamespaces,sessionProperties:n.sessionProperties,scopedProperties:n.scopedProperties,authentication:null==(r=n.connectParams)?void 0:r.authentication,walletPay:null==(s=n.connectParams)?void 0:s.walletPay});i&&(n.uri=i,n.events.emit("display_uri",i));const a=yield o();n.session=a;const c=pE(a.namespaces);return n.namespaces=cl(n.namespaces,c),yield n.persist("namespaces",n.namespaces),yield n.persist("optionalNamespaces",n.optionalNamespaces),n.onConnect(),n.session})()}setDefaultChain(e,n){try{if(!this.session)return;const[r,s]=this.validateChain(e),i=this.getProvider(r);i?i.setDefaultChain(s,n):this.session&&this.logger.warn(`Provider for namespace '${r}' not found in setDefaultChain`)}catch(r){if(!/Please call connect/.test(r.message))throw r}}cleanupPendingPairings(){var e=this;return(0,l.A)(function*(n={}){try{e.logger.info("Cleaning up inactive pairings...");const r=e.client.pairing.getAll();if(!bs(r))return;for(const s of r)n.deletePairings?e.client.core.expirer.set(s.topic,0):yield e.client.core.relayer.subscriber.unsubscribe(s.topic);e.logger.info(`Inactive pairings cleared: ${r.length}`)}catch(r){e.logger.warn(r,"Failed to cleanup pending pairings")}}).apply(this,arguments)}abortPairingAttempt(){this.logger.warn("abortPairingAttempt is deprecated. This is now a no-op.")}checkStorage(){var e=this;return(0,l.A)(function*(){e.namespaces=(yield e.getFromStore("namespaces"))||{},e.optionalNamespaces=(yield e.getFromStore("optionalNamespaces"))||{},e.session&&e.createProviders()})()}initialize(){var e=this;return(0,l.A)(function*(){e.logger.trace("Initialized"),yield e.createClient(),yield e.checkStorage(),e.registerEventListeners()})()}createClient(){var e=this;return(0,l.A)(function*(){var n,r;if(e.client=e.providerOpts.client||(yield gP.init({core:e.providerOpts.core,logger:e.providerOpts.logger||"error",relayUrl:e.providerOpts.relayUrl||"wss://relay.walletconnect.org",projectId:e.providerOpts.projectId,metadata:e.providerOpts.metadata,storageOptions:e.providerOpts.storageOptions,storage:e.providerOpts.storage,name:e.providerOpts.name,customStoragePrefix:e.providerOpts.customStoragePrefix,telemetryEnabled:e.providerOpts.telemetryEnabled})),e.providerOpts.session)try{e.session=e.client.session.get(e.providerOpts.session.topic)}catch(s){throw e.logger.error(s,"Failed to get session"),new Error(`The provided session: ${null==(r=null==(n=e.providerOpts)?void 0:n.session)?void 0:r.topic} doesn't exist in the Sign client`)}else{const s=e.client.session.getAll();e.session=s[0]}e.logger.trace("SignClient Initialized")})()}createProviders(){if(!this.client)throw new Error("Sign Client not initialized");if(!this.session)throw new Error("Session not initialized. Please call connect() before enable()");const e=[...new Set(Object.keys(this.session.namespaces).map(n=>Qi(n)))];ah("client",this.client),ah("events",this.events),ah("disableProviderPing",this.disableProviderPing),e.forEach(n=>{if(!this.session)return;const r=function lD(t,e){const n=Object.keys(e.namespaces).filter(s=>s.includes(t));if(!n.length)return[];const r=[];
193return n.forEach(s=>{r.push(...e.namespaces[s].accounts)}),r}(n,this.session);if(0===r?.length)return;const s=uE(r),i=cl(this.namespaces,this.optionalNamespaces),o=ll(wa({},i[n]),{accounts:r,chains:s});this.rpcProviders[n]="eip155"===n?new LD({namespace:o}):new jD({namespace:o})})}registerEventListeners(){var e=this;if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",n=>{var r;const{topic:s}=n;s===(null==(r=this.session)?void 0:r.topic)&&this.events.emit("session_ping",n)}),this.client.on("session_event",n=>{var r;const{params:s,topic:i}=n;if(i!==(null==(r=this.session)?void 0:r.topic))return;const{event:o}=s;if("accountsChanged"===o.name){const a=o.data;a&&bs(a)&&this.events.emit("accountsChanged",a.map(hE))}else if("chainChanged"===o.name){const a=s.chainId,c=s.event.data,d=Qi(a),h=oh(a)!==oh(c)?`${d}:${oh(c)}`:a;this.onChainChanged({currentCaipChainId:h})}else this.events.emit(o.name,o.data);this.events.emit("session_event",n)}),this.client.on("session_update",({topic:n,params:r})=>{var s,i;if(n!==(null==(s=this.session)?void 0:s.topic))return;const{namespaces:o}=r,a=null==(i=this.client)?void 0:i.session.get(n);this.session=ll(wa({},a),{namespaces:o}),this.onSessionUpdate(),this.events.emit("session_update",{topic:n,params:r})}),this.client.on("session_delete",function(){var n=(0,l.A)(function*(r){var s;r.topic===(null==(s=e.session)?void 0:s.topic)&&(yield e.cleanup(),e.events.emit("session_delete",r),e.events.emit("disconnect",ll(wa({},cn("USER_DISCONNECTED")),{data:r.topic})))});return function(r){return n.apply(this,arguments)}}()),this.on("default_chain_changed",n=>{this.onChainChanged(ll(wa({},n),{internal:!0}))})}getProvider(e){return this.rpcProviders[e]||this.rpcProviders[oE]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var n;this.getProvider(e).updateNamespace(null==(n=this.session)?void 0:n.namespaces[e])})}setNamespaces(e){const{namespaces:n={},optionalNamespaces:r={},sessionProperties:s,scopedProperties:i}=e;this.optionalNamespaces=cl(n,r),this.sessionProperties=s,this.scopedProperties=i}validateChain(e){const[n,r]=e?.split(":")||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[n,r];if(n&&!Object.keys(this.namespaces||{}).map(o=>Qi(o)).includes(n))throw new Error(`Namespace '${n}' is not configured. Please call connect() first with namespace config.`);if(n&&r)return[n,r];const s=Qi(Object.keys(this.namespaces)[0]);return[s,this.rpcProviders[s].getDefaultChain()]}requestAccounts(){var e=this;return(0,l.A)(function*(){const[n]=e.validateChain();return yield e.getProvider(n).requestAccounts()})()}onChainChanged(e){var n=this;return(0,l.A)(function*({currentCaipChainId:r,previousCaipChainId:s,internal:i=!1}){if(!n.namespaces)return;const[o,a]=n.validateChain(r);if(a){if(n.updateNamespaceChain(o,a),i)n.events.emit("chainChanged",a),n.emitAccountsChangedOnChainChange({namespace:o,currentCaipChainId:r,previousCaipChainId:s});else{const c=n.getProvider(o);c?c.setDefaultChain(a):n.session&&n.logger.warn(`Provider for namespace '${o}' not found during chain change`)}yield n.persist("namespaces",n.namespaces)}}).apply(this,arguments)}emitAccountsChangedOnChainChange({namespace:e,currentCaipChainId:n,previousCaipChainId:r}){var s,i;try{if(r===n)return;const o=null==(i=null==(s=this.session)?void 0:s.namespaces[e])?void 0:i.accounts;if(!o)return;const a=o.filter(c=>c.includes(`${n}:`)).map(hE);if(!bs(a))return;this.events.emit("accountsChanged",a)}catch(o){this.logger.warn(o,"Failed to emit accountsChanged on chain change")}}updateNamespaceChain(e,n){if(!this.namespaces)return;const r=this.namespaces[e]?e:`${e}:${n}`,s={chains:[],methods:[],events:[],defaultChain:n};this.namespaces[r]?this.namespaces[r]&&(this.namespaces[r].defaultChain=n):this.namespaces[r]=s}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}cleanup(){var e=this;return(0,l.A)(function*(){e.connectParams=void 0,e.namespaces=void 0,e.optionalNamespaces=void 0,e.sessionProperties=void 0,yield e.deleteFromStore("namespaces"),yield e.deleteFromStore("optionalNamespaces"),yield e.deleteFromStore("sessionProperties"),e.session=void 0,e.cleanupPendingPairings({deletePairings:!0}),yield e.cleanupStorage()})()}persist(e,n){var r=this;return(0,l.A)(function*(){var s;const i=(null==(s=r.session)?void 0:s.topic)||"";yield r.client.core.storage.setItem(`${ol}/${e}${i}`,n)})()}getFromStore(e){var n=this;return(0,l.A)(function*(){var r;const s=(null==(r=n.session)?void 0:r.topic)||"";return yield n.client.core.storage.getItem(`${ol}/${e}${s}`)})()}deleteFromStore(e){var n=this;return(0,l.A)(function*(){var r;const s=(null==(r=n.session)?void 0:r.topic)||"";yield n.client.core.storage.removeItem(`${ol}/${e}${s}`)})()}cleanupStorage(){var e=this;return(0,l.A)(function*(){var n;try{if((null==(n=e.client)?void 0:n.session.length)>0)return;const r=yield e.client.core.storage.getKeys();for(const s of r)s.startsWith(ol)&&(yield e.client.core.storage.removeItem(s))}catch(r){e.logger.warn(r,"Failed to cleanup storage")}})()}}},10832(Ve,ne,u){"use strict";u.r(ne),u.d(ne,{default:()=>m});const m=function S(j){if(j.length>=255)throw new TypeError("Alphabet too long");const R=new Uint8Array(256);for(let p=0;p<R.length;p++)R[p]=255;for(let p=0;p<j.length;p++){const l=j.charAt(p),O=l.charCodeAt(0);if(255!==R[O])throw new TypeError(l+" is ambiguous");R[O]=p}const k=j.length,v=j.charAt(0),$=Math.log(k)/Math.log(256),x=Math.log(256)/Math.log(k);function X(p){if("string"!=typeof p)throw new TypeError("Expected String");if(0===p.length)return new Uint8Array;let l=0,O=0,L=0;for(;p[l]===v;)O++,l++;const _=(p.length-l)*$+1>>>0,I=new Uint8Array(_);for(;l<p.length;
193){const T=p.charCodeAt(l);if(T>255)return;let W=R[T];if(255===W)return;let A=0;for(let E=_-1;(0!==W||A<L)&&-1!==E;E--,A++)W+=k*I[E]>>>0,I[E]=W%256>>>0,W=W/256>>>0;if(0!==W)throw new Error("Non-zero carry");L=A,l++}let D=_-L;for(;D!==_&&0===I[D];)D++;const H=new Uint8Array(O+(_-D));let z=O;for(;D!==_;)H[z++]=I[D++];return H}return{encode:function U(p){if(p instanceof Uint8Array||(ArrayBuffer.isView(p)?p=new Uint8Array(p.buffer,p.byteOffset,p.byteLength):Array.isArray(p)&&(p=Uint8Array.from(p))),!(p instanceof Uint8Array))throw new TypeError("Expected Uint8Array");if(0===p.length)return"";let l=0,O=0,L=0;const _=p.length;for(;L!==_&&0===p[L];)L++,l++;const I=(_-L)*x+1>>>0,D=new Uint8Array(I);for(;L!==_;){let T=p[L],W=0;for(let A=I-1;(0!==T||W<O)&&-1!==A;A--,W++)T+=256*D[A]>>>0,D[A]=T%k>>>0,T=T/k>>>0;if(0!==T)throw new Error("Non-zero carry");O=W,L++}let H=I-O;for(;H!==I&&0===D[H];)H++;let z=v.repeat(l);for(;H<I;++H)z+=j.charAt(D[H]);return z},decodeUnsafe:X,decode:function B(p){const l=X(p);if(l)return l;throw new Error("Non-base"+k+" character")}}}("123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz")},39178(Ve,ne,u){"use strict";function S(L){return new Promise((_,I)=>{L.oncomplete=L.onsuccess=()=>_(L.result),L.onabort=L.onerror=()=>I(L.error)})}function P(L,_){const I=indexedDB.open(L);I.onupgradeneeded=()=>I.result.createObjectStore(_);const D=S(I);return(H,z)=>D.then(T=>z(T.transaction(_,H).objectStore(_)))}let K;function m(){return K||(K=P("keyval-store","keyval")),K}function j(L,_=m()){return _("readonly",I=>S(I.get(L)))}function R(L,_,I=m()){return I("readwrite",D=>(D.put(_,L),S(D.transaction)))}function x(L,_=m()){return _("readwrite",I=>(I.delete(L),S(I.transaction)))}function X(L=m()){return L("readwrite",_=>(_.clear(),S(_.transaction)))}function p(L=m()){return L("readonly",_=>{if(_.getAllKeys)return S(_.getAllKeys());const I=[];return function B(L,_){return L.openCursor().onsuccess=function(){this.result&&(_(this.result),this.result.continue())},S(L.transaction)}(_,D=>I.push(D.key)).then(()=>I)})}u.d(ne,{HP:()=>p,IU:()=>X,Jt:()=>j,hZ:()=>R,y$:()=>P,yH:()=>x})},39009(Ve,ne,u){"use strict";u.d(ne,{JW:()=>W,XX:()=>wt,c0:()=>E,ej:()=>A,ge:()=>jt,qy:()=>T,s6:()=>g});const S=globalThis,P=at=>at,K=S.trustedTypes,m=K?K.createPolicy("lit-html",{createHTML:at=>at}):void 0,j="$lit$",R=`lit$${Math.random().toFixed(9).slice(2)}$`,k="?"+R,v=`<${k}>`,$=document,x=()=>$.createComment(""),U=at=>null===at||"object"!=typeof at&&"function"!=typeof at,X=Array.isArray,B=at=>X(at)||"function"==typeof at?.[Symbol.iterator],p="[ \t\n\f\r]",l=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,O=/-->/g,L=/>/g,_=RegExp(`>|${p}(?:([^\\s"'>=/]+)(${p}*=${p}*(?:[^ \t\n\f\r"'\`<>=]|("|')|))|$)`,"g"),I=/'/g,D=/"/g,H=/^(?:script|style|textarea|title)$/i,z=at=>(xe,...tt)=>({_$litType$:at,strings:xe,values:tt}),T=z(1),W=z(2),A=z(3),E=Symbol.for("lit-noChange"),g=Symbol.for("lit-nothing"),w=new WeakMap,C=$.createTreeWalker($,129);function y(at,xe){if(!X(at)||!at.hasOwnProperty("raw"))throw Error("invalid template strings array");return void 0!==m?m.createHTML(xe):xe}const F=(at,xe)=>{const tt=at.length-1,nt=[];let lt,Nt=2===xe?"<svg>":3===xe?"<math>":"",Le=l;for(let ct=0;ct<tt;ct++){const Je=at[ct];let ut,bt,Xe=-1,yt=0;for(;yt<Je.length&&(Le.lastIndex=yt,bt=Le.exec(Je),null!==bt);)yt=Le.lastIndex,Le===l?"!--"===bt[1]?Le=O:void 0!==bt[1]?Le=L:void 0!==bt[2]?(H.test(bt[2])&&(lt=RegExp("</"+bt[2],"g")),Le=_):void 0!==bt[3]&&(Le=_):Le===_?">"===bt[0]?(Le=lt??l,Xe=-1):void 0===bt[1]?Xe=-2:(Xe=Le.lastIndex-bt[2].length,ut=bt[1],Le=void 0===bt[3]?_:'"'===bt[3]?D:I):Le===D||Le===I?Le=_:Le===O||Le===L?Le=l:(Le=_,lt=void 0);const rt=Le===_&&at[ct+1].startsWith("/>")?" ":"";Nt+=Le===l?Je+v:Xe>=0?(nt.push(ut),Je.slice(0,Xe)+j+Je.slice(Xe)+R+rt):Je+R+(-2===Xe?ct:rt)}return[y(at,Nt+(at[tt]||"<?>")+(2===xe?"</svg>":3===xe?"</math>":"")),nt]};class Q{constructor({strings:xe,_$litType$:tt},nt){let lt;this.parts=[];let Nt=0,Le=0;const ct=xe.length-1,Je=this.parts,[ut,bt]=F(xe,tt);if(this.el=Q.createElement(ut,nt),C.currentNode=this.el.content,2===tt||3===tt){const Xe=this.el.content.firstChild;Xe.replaceWith(...Xe.childNodes)}for(;null!==(lt=C.nextNode())&&Je.length<ct;){if(1===lt.nodeType){if(lt.hasAttributes())for(const Xe of lt.getAttributeNames())if(Xe.endsWith(j)){const yt=bt[Le++],rt=lt.getAttribute(Xe).split(R),Tt=/([.?@])?(.*)/.exec(yt);
vendor: 4,559 bytes, line 193
193Je.push({type:1,index:Nt,name:Tt[2],strings:rt,ctor:"."===Tt[1]?ve:"?"===Tt[1]?We:"@"===Tt[1]?Ke:Te}),lt.removeAttribute(Xe)}else Xe.startsWith(R)&&(Je.push({type:6,index:Nt}),lt.removeAttribute(Xe));if(H.test(lt.tagName)){const Xe=lt.textContent.split(R),yt=Xe.length-1;if(yt>0){lt.textContent=K?K.emptyScript:"";for(let rt=0;rt<yt;rt++)lt.append(Xe[rt],x()),C.nextNode(),Je.push({type:2,index:++Nt});lt.append(Xe[yt],x())}}}else if(8===lt.nodeType)if(lt.data===k)Je.push({type:2,index:Nt});else{let Xe=-1;for(;-1!==(Xe=lt.data.indexOf(R,Xe+1));)Je.push({type:7,index:Nt}),Xe+=R.length-1}Nt++}}static createElement(xe,tt){const nt=$.createElement("template");return nt.innerHTML=xe,nt}}function ge(at,xe,tt=at,nt){if(xe===E)return xe;let lt=void 0!==nt?tt._$Co?.[nt]:tt._$Cl;const Nt=U(xe)?void 0:xe._$litDirective$;return lt?.constructor!==Nt&&(lt?._$AO?.(!1),void 0===Nt?lt=void 0:(lt=new Nt(at),lt._$AT(at,tt,nt)),void 0!==nt?(tt._$Co??=[])[nt]=lt:tt._$Cl=lt),void 0!==lt&&(xe=ge(at,lt._$AS(at,xe.values),lt,nt)),xe}class ce{constructor(xe,tt){this._$AV=[],this._$AN=void 0,this._$AD=xe,this._$AM=tt}get parentNode(){return this._$AM.parentNode}get _$AU(){return this._$AM._$AU}u(xe){const{el:{content:tt},parts:nt}=this._$AD,lt=(xe?.creationScope??$).importNode(tt,!0);C.currentNode=lt;let Nt=C.nextNode(),Le=0,ct=0,Je=nt[0];for(;void 0!==Je;){if(Le===Je.index){let ut;2===Je.type?ut=new Ae(Nt,Nt.nextSibling,this,xe):1===Je.type?ut=new Je.ctor(Nt,Je.name,Je.strings,this,xe):6===Je.type&&(ut=new Et(Nt,this,xe)),this._$AV.push(ut),Je=nt[++ct]}Le!==Je?.index&&(Nt=C.nextNode(),Le++)}return C.currentNode=$,lt}p(xe){let tt=0;for(const nt of this._$AV)void 0!==nt&&(void 0!==nt.strings?(nt._$AI(xe,nt,tt),tt+=nt.strings.length-2):nt._$AI(xe[tt])),tt++}}class Ae{get _$AU(){return this._$AM?._$AU??this._$Cv}constructor(xe,tt,nt,lt){this.type=2,this._$AH=g,this._$AN=void 0,this._$AA=xe,this._$AB=tt,this._$AM=nt,this.options=lt,this._$Cv=lt?.isConnected??!0}get parentNode(){let xe=this._$AA.parentNode;const tt=this._$AM;return void 0!==tt&&11===xe?.nodeType&&(xe=tt.parentNode),xe}get startNode(){return this._$AA}get endNode(){return this._$AB}_$AI(xe,tt=this){xe=ge(this,xe,tt),U(xe)?xe===g||null==xe||""===xe?(this._$AH!==g&&this._$AR(),this._$AH=g):xe!==this._$AH&&xe!==E&&this._(xe):void 0!==xe._$litType$?this.$(xe):void 0!==xe.nodeType?this.T(xe):B(xe)?this.k(xe):this._(xe)}O(xe){return this._$AA.parentNode.insertBefore(xe,this._$AB)}T(xe){this._$AH!==xe&&(this._$AR(),this._$AH=this.O(xe))}_(xe){this._$AH!==g&&U(this._$AH)?this._$AA.nextSibling.data=xe:this.T($.createTextNode(xe)),this._$AH=xe}$(xe){const{values:tt,_$litType$:nt}=xe,lt="number"==typeof nt?this._$AC(xe):(void 0===nt.el&&(nt.el=Q.createElement(y(nt.h,nt.h[0]),this.options)),nt);if(this._$AH?._$AD===lt)this._$AH.p(tt);else{const Nt=new ce(lt,this),Le=Nt.u(this.options);Nt.p(tt),this.T(Le),this._$AH=Nt}}_$AC(xe){let tt=w.get(xe.strings);return void 0===tt&&w.set(xe.strings,tt=new Q(xe)),tt}k(xe){X(this._$AH)||(this._$AH=[],this._$AR());const tt=this._$AH;let nt,lt=0;for(const Nt of xe)lt===tt.length?tt.push(nt=new Ae(this.O(x()),this.O(x()),this,this.options)):nt=tt[lt],nt._$AI(Nt),lt++;lt<tt.length&&(this._$AR(nt&&nt._$AB.nextSibling,lt),tt.length=lt)}_$AR(xe=this._$AA.nextSibling,tt){for(this._$AP?.(!1,!0,tt);xe!==this._$AB;){const nt=P(xe).nextSibling;P(xe).remove(),xe=nt}}setConnected(xe){void 0===this._$AM&&(this._$Cv=xe,this._$AP?.(xe))}}class Te{get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}constructor(xe,tt,nt,lt,Nt){this.type=1,this._$AH=g,this._$AN=void 0,this.element=xe,this.name=tt,this._$AM=lt,this.options=Nt,nt.length>2||""!==nt[0]||""!==nt[1]?(this._$AH=Array(nt.length-1).fill(new String),this.strings=nt):this._$AH=g}_$AI(xe,tt=this,nt,lt){const Nt=this.strings;let Le=!1;if(void 0===Nt)xe=ge(this,xe,tt,0),Le=!U(xe)||xe!==this._$AH&&xe!==E,Le&&(this._$AH=xe);else{const ct=xe;let Je,ut;for(xe=Nt[0],Je=0;Je<Nt.length-1;Je++)ut=ge(this,ct[nt+Je],tt,Je),ut===E&&(ut=this._$AH[Je]),Le||=!U(ut)||ut!==this._$AH[Je],ut===g?xe=g:xe!==g&&(xe+=(ut??"")+Nt[Je+1]),this._$AH[Je]=ut}Le&&!lt&&this.j(xe)}j(xe){xe===g?this.element.removeAttribute(this.name):this.element.setAttribute(this.name,xe??"")}}class ve extends Te{constructor(){super(...arguments),this.type=3}j(xe){this.element[this.name]=xe===g?void 0:xe}}class We extends Te{constructor(){super(...arguments),this.type=4}j(xe){this.element.toggleAttribute(this.name,!!xe&&xe!==g)}}class Ke extends Te{constructor(xe,tt,nt,lt,Nt){super(xe,tt,nt,lt,Nt),this.type=5}
193_$AI(xe,tt=this){if((xe=ge(this,xe,tt,0)??g)===E)return;const nt=this._$AH,lt=xe===g&&nt!==g||xe.capture!==nt.capture||xe.once!==nt.once||xe.passive!==nt.passive,Nt=xe!==g&&(nt===g||lt);lt&&this.element.removeEventListener(this.name,this,nt),Nt&&this.element.addEventListener(this.name,this,xe),this._$AH=xe}handleEvent(xe){"function"==typeof this._$AH?this._$AH.call(this.options?.host??this.element,xe):this._$AH.handleEvent(xe)}}class Et{constructor(xe,tt,nt){this.element=xe,this.type=6,this._$AN=void 0,this._$AM=tt,this.options=nt}get _$AU(){return this._$AM._$AU}_$AI(xe){ge(this,xe)}}const jt={M:j,P:R,A:k,C:1,L:F,R:ce,D:B,V:ge,I:Ae,H:Te,N:We,U:Ke,B:ve,F:Et},Pt=S.litHtmlPolyfillSupport;Pt?.(Q,Ae),(S.litHtmlVersions??=[]).push("3.3.3");const wt=(at,xe,tt)=>{const nt=tt?.renderBefore??xe;let lt=nt._$litPart$;if(void 0===lt){const Nt=tt?.renderBefore??null;nt._$litPart$=lt=new Ae(xe.insertBefore(x(),Nt),Nt,void 0,tt??{})}return lt._$AI(at),lt}},38324(Ve,ne,u){"use strict";u.d(ne,{WF:()=>m,AH:()=>S.AH,qy:()=>P.qy,JW:()=>P.JW,iz:()=>S.iz});var S=u(16693),P=u(39009);const K=globalThis;class m extends S.mN{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){const v=super.createRenderRoot();return this.renderOptions.renderBefore??=v.firstChild,v}update(v){const $=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(v),this._$Do=(0,P.XX)($,this.renderRoot,this.renderOptions)}connectedCallback(){super.connectedCallback(),this._$Do?.setConnected(!0)}disconnectedCallback(){super.disconnectedCallback(),this._$Do?.setConnected(!1)}render(){return P.c0}}m._$litElement$=!0,m.finalized=!0,K.litElementHydrateSupport?.({LitElement:m});const j=K.litElementPolyfillSupport;j?.({LitElement:m}),(K.litElementVersions??=[]).push("4.2.2")},3631(Ve,ne,u){"use strict";u.d(ne,{BX:()=>wt,KR:()=>nt,P9:()=>tt,B1:()=>xe,h2:()=>lt});const P=Symbol(),B=Object.getPrototypeOf,p=new WeakMap,E=(Le,ct=!0)=>{p.set(Le,ct)},C=Le=>"object"==typeof Le&&null!==Le,F=(Le,ct)=>{const Je=Ae.get(Le);if(Je?.[0]===ct)return Je[1];const ut=Array.isArray(Le)?[]:Object.create(Object.getPrototypeOf(Le));return E(ut,!0),Ae.set(Le,[ct,ut]),Reflect.ownKeys(Le).forEach(bt=>{if(Object.getOwnPropertyDescriptor(ut,bt))return;const Xe=Reflect.get(Le,bt),{enumerable:yt}=Reflect.getOwnPropertyDescriptor(Le,bt),rt={value:Xe,enumerable:yt,configurable:!0};if(ce.has(Xe))E(Xe,!1);else if(ge.has(Xe)){const[Tt,Ft]=ge.get(Xe);rt.value=F(Tt,Ft())}Object.defineProperty(ut,bt,rt)}),Object.preventExtensions(ut)},ge=new WeakMap,ce=new WeakSet,Ae=new WeakMap,Te=[1],ve=new WeakMap;let We=Object.is,jt=F,Pt=(Le,ct,Je,ut)=>({deleteProperty(bt,Xe){const yt=Reflect.get(bt,Xe);Je(Xe);const rt=Reflect.deleteProperty(bt,Xe);return rt&&ut(["delete",[Xe],yt]),rt},set(bt,Xe,yt,rt){const Tt=!Le()&&Reflect.has(bt,Xe),Ft=Reflect.get(bt,Xe,rt);if(Tt&&(We(Ft,yt)||ve.has(yt)&&We(Ft,ve.get(yt))))return!0;Je(Xe),C(yt)&&(yt=(Le=>(Le=>Le&&(p.has(Le)?p.get(Le):B(Le)===Object.prototype||B(Le)===Array.prototype))(Le)&&Le[P]||null)(yt)||yt);const rn=!ge.has(yt)&&(Le=>C(Le)&&!ce.has(Le)&&(Array.isArray(Le)||!(Symbol.iterator in Le))&&!(Le instanceof WeakMap)&&!(Le instanceof WeakSet)&&!(Le instanceof Error)&&!(Le instanceof Number)&&!(Le instanceof Date)&&!(Le instanceof String)&&!(Le instanceof RegExp)&&!(Le instanceof ArrayBuffer)&&!(Le instanceof Promise))(yt)?wt(yt):yt;return ct(Xe,rn),Reflect.set(bt,Xe,rn,rt),ut(["set",[Xe],yt,Ft]),!0}});function wt(Le={}){if(!C(Le))throw new Error("object required");const ct=ve.get(Le);if(ct)return ct;let Je=Te[0];const ut=new Set,bt=(ie,he=++Te[0])=>{Je!==he&&(Xe=Je=he,ut.forEach(Oe=>Oe(ie,he)))};let Xe=Je;const rt=ie=>(he,Oe)=>{const $e=[...he];$e[1]=[ie,...$e[1]],bt($e,Oe)},Tt=new Map;let qe=!0;const N=Pt(()=>qe,(ie,he)=>{const Oe=!ce.has(he)&&ge.get(he);if(Oe){if(Tt.has(ie))throw new Error("prop listener already exists");if(ut.size){const $e=Oe[2](rt(ie));Tt.set(ie,[Oe,$e])}else Tt.set(ie,[Oe])}},ie=>{var he;const Oe=Tt.get(ie);Oe&&(Tt.delete(ie),null==(he=Oe[1])||he.call(Oe))},bt),Y=((Le,ct)=>new Proxy(Le,ct))(Le,N);return ve.set(Le,Y),ge.set(Y,[Le,(ie=Te[0])=>(Xe!==ie&&(Xe=ie,Tt.forEach(([he])=>{const Oe=he[1](ie);Oe>Je&&(Je=Oe)})),Je),ie=>(ut.add(ie),1===ut.size&&Tt.forEach(([Oe,$e],it)=>{if($e)throw new Error("remove already exists");const Qe=Oe[2](rt(it));Tt.set(it,[Oe,Qe])}),()=>{ut.delete(ie),0===ut.size&&Tt.forEach(([Oe,$e],it)=>
193{$e&&($e(),Tt.set(it,[Oe]))})})]),Reflect.ownKeys(Le).forEach(ie=>{const he=Object.getOwnPropertyDescriptor(Le,ie);"value"in he&&he.writable&&(Y[ie]=Le[ie])}),qe=!1,Y}function xe(Le,ct,Je){const ut=ge.get(Le);let bt;ut||console.warn("Please use proxy object");const Xe=[];let rt=!1;const Ft=(0,ut[2])(rn=>{Xe.push(rn),Je?ct(Xe.splice(0)):bt||(bt=Promise.resolve().then(()=>{bt=void 0,rt&&ct(Xe.splice(0))}))});return rt=!0,()=>{rt=!1,Ft()}}function tt(Le){const ct=ge.get(Le);ct||console.warn("Please use proxy object");const[Je,ut]=ct;return jt(Je,ut())}function nt(Le){return ce.add(Le),Le}function lt(){return{proxyStateMap:ge,refSet:ce,snapCache:Ae,versionHolder:Te,proxyCache:ve}}},98698(Ve,ne,u){"use strict";u.d(ne,{u$:()=>k,zC:()=>O});var R=u(3631);function k(g,w,C,y){let F=g[w];return(0,R.B1)(g,()=>{const Q=g[w];Object.is(F,Q)||C(F=Q)},y)}const{proxyStateMap:X,snapCache:B}=(0,R.h2)(),p=g=>X.has(g);function O(g){const w=[];let C=0;const y=new Map,F=new WeakMap,ge=Te=>F.get(Te)||y;if(g){if("function"!=typeof g[Symbol.iterator])throw new TypeError("proxyMap:\n\tinitial state must be iterable\n\t\ttip: structure should be [[key, value]]");for(const[Te,ve]of g)y.set(Te,C),w[C++]=ve}const ce={data:w,index:C,epoch:0,get size(){return p(this)||(()=>{const Te=B.get(ce),ve=Te?.[1];if(ve&&!F.has(ve)){const We=new Map(y);F.set(ve,We)}})(),ge(this).size},get(Te){const We=ge(this).get(Te);if(void 0!==We)return this.data[We]},has(Te){return ge(this).has(Te)},set(Te,ve){if(!p(this))throw new Error("Cannot perform mutations on a snapshot");const We=y.get(Te);return void 0===We?(y.set(Te,this.index),this.data[this.index++]=ve):this.data[We]=ve,this.epoch++,this},delete(Te){if(!p(this))throw new Error("Cannot perform mutations on a snapshot");const ve=y.get(Te);return void 0!==ve&&(delete this.data[ve],y.delete(Te),this.epoch++,!0)},clear(){if(!p(this))throw new Error("Cannot perform mutations on a snapshot");this.data.length=0,this.index=0,this.epoch++,y.clear()},forEach(Te){ge(this).forEach((We,Ke)=>{Te(this.data[We],Ke,this)})},*entries(){const Te=ge(this);for(const[ve,We]of Te)yield[ve,this.data[We]]},*keys(){const Te=ge(this);for(const ve of Te.keys())yield ve},*values(){const Te=ge(this);for(const ve of Te.values())yield this.data[ve]},[Symbol.iterator](){return this.entries()},get[Symbol.toStringTag](){return"Map"},toJSON(){return new Map(this.entries())}},Ae=(0,R.BX)(ce);return Object.defineProperties(Ae,{size:{enumerable:!1},index:{enumerable:!1},epoch:{enumerable:!1},data:{enumerable:!1},toJSON:{enumerable:!1}}),Object.seal(Ae),Ae}(0,R.h2)()},24995(Ve,ne,u){"use strict";u.d(ne,{o:()=>l});var S=u(10467),P=u(39826),K=u(7256),m=u(60798),j=u(20440);const k=new(u(71782).A)(8192);var $=u(96923),x=u(82666);function U(O,L={}){return function(){var _=(0,S.A)(function*(I,D={}){const{dedupe:H=!1,methods:z,retryDelay:T=150,retryCount:W=3,signal:A,uid:E}={...L,...D},{method:g}=I;if(z?.exclude?.includes(g))throw new m.ab(new Error("method not supported"),{method:g});if(z?.include&&!z.include.includes(g))throw new m.ab(new Error("method not supported"),{method:g});if(A?.aborted)throw(0,j.TY)(A);const w=H?function B(O,L=0){let _=3735928559^L,I=1103547991^L;for(let D=0;D<O.length;D++){const H=O.charCodeAt(D);_=Math.imul(_^H,2654435761),I=Math.imul(I^H,1597334677)}return _=Math.imul(_^_>>>16,2246822507),_^=Math.imul(I^I>>>16,3266489909),I=Math.imul(I^I>>>16,2246822507),I^=Math.imul(_^_>>>16,3266489909),(4294967296*(2097151&I)+(_>>>0)).toString(36)}(`${E}.${(0,x.A)(I)}`):void 0;return function v(O,{enabled:L=!0,id:_}){if(!L||!_)return O();if(k.get(_))return k.get(_);const I=O().finally(()=>k.delete(_));return k.set(_,I),I}(()=>(0,$.b)((0,S.A)(function*(){try{return yield O(I,A?{signal:A}:void 0)}catch(C){if(A?.aborted)throw(0,j.TY)(A);if((0,j.zf)(C))throw C;const y=C;switch(y.code){case m.XU.code:throw new m.XU(y);case m.CL.code:throw new m.CL(y);case m.Gi.code:throw new m.Gi(y,{method:I.method});case m.D5.code:throw new m.D5(y);case m.bq.code:throw new m.bq(y);case m.Di.code:throw new m.Di(y);case m.hA.code:throw new m.hA(y);case m.qZ.code:throw new m.qZ(y);case m.YW.code:throw new m.YW(y);case m.ab.code:throw new m.ab(y,{method:I.method});
193case m.s0.code:throw new m.s0(y);case m.xQ.code:throw new m.xQ(y);case m.vx.code:throw new m.vx(y);case m.sV.code:throw new m.sV(y);case m.Sf.code:throw new m.Sf(y);case m.RV.code:throw new m.RV(y);case m.xq.code:throw new m.xq(y);case m.ch.code:throw new m.ch(y);case m.L5.code:throw new m.L5(y);case m.WT.code:throw new m.WT(y);case m.hl.code:throw new m.hl(y);case m.cg.code:throw new m.cg(y);case m.uL.code:throw new m.uL(y);case m.G1.code:throw new m.G1(y);case m.jz.code:throw new m.jz(y);case 5e3:throw new m.vx(y);case m.nR.code:throw new m.nR(y);default:throw C instanceof P.C?C:new m.MI(y)}}}),{delay:({count:C,error:y})=>{if(y&&y instanceof K.Ci){const F=y?.headers?.get("Retry-After");if(F?.match(/\d/))return 1e3*Number.parseInt(F,10)}return(1<<C)*T},retryCount:W,signal:A,shouldRetry:({error:C})=>function X(O){return!((0,j.zf)(O)||("code"in O&&"number"==typeof O.code?-1!==O.code&&O.code!==m.s0.code&&O.code!==m.bq.code&&429!==O.code:O instanceof K.Ci&&O.status&&403!==O.status&&408!==O.status&&413!==O.status&&429!==O.status&&500!==O.status&&502!==O.status&&503!==O.status&&504!==O.status))}(C)}),{enabled:H,id:w})});return function(I){return _.apply(this,arguments)}}()}var p=u(21685);function l({key:O,methods:L,name:_,request:I,retryCount:D=3,retryDelay:H=150,timeout:z,type:T},W){return{config:{key:O,methods:L,name:_,request:I,retryCount:D,retryDelay:H,timeout:z,type:T},request:U(I,{methods:L,retryCount:D,retryDelay:H,uid:(0,p.L)()}),value:W}}},6439(Ve,ne,u){"use strict";u.d(ne,{Ey:()=>k,Np:()=>R});var S=u(10467),P=u(16757),K=u(60798),m=u(50706),j=u(24995);function R($,x={}){const{key:U="fallback",name:X="Fallback",rank:B=!1,shouldThrow:p=k,retryCount:l,retryDelay:O}=x;return({chain:L,pollingInterval:_=4e3,timeout:I,...D})=>{let H=$,z=()=>{};const T=(0,j.o)({key:U,name:X,request(W){return(0,S.A)(function*({method:A,params:E}){let g;const w=function(){var C=(0,S.A)(function*(y=0){const F=H[y]({...D,chain:L,retryCount:0,timeout:I});try{const Q=yield F.request({method:A,params:E});return z({method:A,params:E,response:Q,transport:F,status:"success"}),Q}catch(Q){if(z({error:Q,method:A,params:E,transport:F,status:"error"}),p(Q)||y===H.length-1||(g??=H.slice(y+1).some(ge=>{const{include:ce,exclude:Ae}=ge({chain:L}).config.methods||{};return ce?ce.includes(A):!Ae||!Ae.includes(A)}),!g))throw Q;return w(y+1)}});return function(){return C.apply(this,arguments)}}();return w()}).apply(this,arguments)},retryCount:l,retryDelay:O,type:"fallback"},{onResponse:W=>z=W,transports:H.map(W=>W({chain:L,retryCount:0}))});if(B){const W="object"==typeof B?B:{};!function v({chain:$,interval:x=4e3,onTransports:U,ping:X,sampleCount:B=10,timeout:p=1e3,transports:l,weights:O={}}){const{stability:L=.7,latency:_=.3}=O,I=[],D=function(){var H=(0,S.A)(function*(){const z=yield Promise.all(l.map(function(){var A=(0,S.A)(function*(E){const g=E({chain:$,retryCount:0,timeout:p}),w=Date.now();let C,y;try{yield X?X({transport:g}):g.request({method:"net_listening"}),y=1}catch{y=0}finally{C=Date.now()}return{latency:C-w,success:y}});return function(E){return A.apply(this,arguments)}}()));I.push(z),I.length>B&&I.shift();const T=Math.max(...I.map(A=>Math.max(...A.map(({latency:E})=>E)))),W=l.map((A,E)=>{const g=I.map(Q=>Q[E].latency),C=1-g.reduce((Q,ge)=>Q+ge,0)/g.length/T,y=I.map(Q=>Q[E].success),F=y.reduce((Q,ge)=>Q+ge,0)/y.length;return 0===F?[0,E]:[_*C+L*F,E]}).sort((A,E)=>E[0]-A[0]);U(W.map(([,A])=>l[A])),yield(0,m.u)(x),D()});return function(){return H.apply(this,arguments)}}();D()}({chain:L,interval:W.interval??_,onTransports:A=>H=A,ping:W.ping,sampleCount:W.sampleCount,timeout:W.timeout,transports:H,weights:W.weights})}return T}}function k($){return!(!("code"in $)||"number"!=typeof $.code||$.code!==K.YW.code&&$.code!==K.vx.code&&$.code!==K.nR.code&&!P.A7.nodeMessage.test($.message)&&5e3!==$.code)}},48253(Ve,ne,u){"use strict";u.d(ne,{L:()=>x});var S=u(10467),P=u(7256),K=u(49136),m=u(83484),j=u(83243),R=u(24995);let k=0;const v=new WeakMap;function $(U){if(!U)return"default";const X=v.get(U);if(void 0!==X)return X;const B=k++;return v.set(U,B),B}function x(U,X={}){const{batch:B,fetchFn:p,fetchOptions:l,key:O="http",methods:L,name:_="HTTP JSON-RPC",onFetchRequest:I,onFetchResponse:D,retryDelay:H,raw:z}=X;return({chain:T,retryCount:W,timeout:A})=>{const{batchSize:E=1e3,wait:g=0}="object"==typeof B?B:{},w=X.retryCount??W,C=A??X.timeout??1e4,y=U||T?.rpcUrls.default.http[0];if(!y)throw new K.b;const F=(0,j.d)(y,{fetchFn:p,fetchOptions:l,onRequest:I,onResponse:D,timeout:C});return(0,R.o)({key:O,methods:L,name:_,request(Q,ge){return(0,S.A)(function*({method:ce,params:Ae},Te){const ve={method:ce,params:Ae},We=Te?.signal?{signal:Te.signal}:void 0,{schedule:Ke}=(0,m.u)({id:`${y}.${$(Te?.signal)}`,wait:g,shouldSplitBatch:wt=>wt.length>E,fn:wt=>F.request({body:wt,fetchOptions:We}),sort:(wt,at)=>wt.id-at.id}),Et=function(){var wt=(0,S.A)(function*(at){return B?Ke(at):[yield F.request({body:at,fetchOptions:We})]});return function(xe){return wt.apply(this,arguments)}}(),[{error:jt,result:Pt}]=yield Et(ve);if(z)return{error:jt,result:Pt};if(jt)throw new P.J8({body:ve,error:jt,url:y});return Pt}).apply(this,arguments)},retryCount:w,retryDelay:H,timeout:C,type:"http"},{fetchOptions:l,url:y})}}},49136(Ve,ne,u){"use strict";u.d(ne,{b:()=>P});var S=u(39826);class P extends S.C{constructor(){super("No URL was provided to the Transport. Please provide a valid RPC URL to the Transport.",{docsPath:"/docs/clients/intro",name:"UrlRequiredError"})}}},96923(Ve,ne,u){"use strict";u.d(ne,{b:()=>m});var S=u(10467),P=u(20440),K=u(50706);function m(j,{delay:R=100,retryCount:k=2,shouldRetry:v=()=>!0,signal:$}={}){return new Promise((x,U)=>{const X=function(){var B=(0,S.A)(function*({count:p=0}={}){if($?.aborted)return void U((0,P.TY)($));const l=function(){var O=(0,S.A)(function*({error:L}){const _="function"==typeof R?R({count:p,error:L}):R;if(_)try{yield(0,K.u)(_,{signal:$})}catch(I){return void U(I)}X({count:p+1})});return function(_){return O.apply(this,arguments)}}();try{const O=yield j();x(O)}catch(O){if($?.aborted)return void U((0,P.TY)($));if((0,P.zf)(O))return void U(O);if(p<k&&(yield v({count:p,error:O}
193)))return l({error:O});U(O)}});return function(){return B.apply(this,arguments)}}();X()})}},70098(Ve,ne,u){"use strict";u.d(ne,{w:()=>K});var S=u(10467),P=u(20440);function K(m,{errorInstance:j=new Error("timed out"),timeout:R,signal:k}){return new Promise((v,$)=>{(0,S.A)(function*(){let x;const U=new AbortController;try{R>0&&(x=setTimeout(()=>{k?U.abort():$(j)},R)),v(yield m({signal:U?.signal||null}))}catch(X){if(U?.signal.aborted&&(0,P.zf)(X))return void $(j);$(X)}finally{clearTimeout(x)}})()})}},83243(Ve,ne,u){"use strict";u.d(ne,{d:()=>k});var S=u(10467),P=u(7256),K=u(20440),m=u(70098),j=u(82666),R=u(16090);function k($,x={}){const{url:U,headers:X}=function v($){try{const x=new URL($),U=(()=>{if(x.username){const X=`${decodeURIComponent(x.username)}:${decodeURIComponent(x.password)}`;return x.username="",x.password="",{url:x.toString(),headers:{Authorization:`Basic ${btoa(X)}`}}}})();return{url:x.toString(),...U}}catch{return{url:$}}}($);return{request:B=>(0,S.A)(function*(){const{body:p,fetchFn:l=x.fetchFn??fetch,onRequest:O=x.onRequest,onResponse:L=x.onResponse,timeout:_=x.timeout??1e4}=B,I={...x.fetchOptions??{},...B.fetchOptions??{}},{headers:D,method:H,signal:z}=I;try{const T=yield(0,m.w)(function(){var A=(0,S.A)(function*({signal:E}){const g={...I,body:Array.isArray(p)?(0,j.A)(p.map(F=>({jsonrpc:"2.0",id:F.id??R.q.take(),...F}))):(0,j.A)({jsonrpc:"2.0",id:p.id??R.q.take(),...p}),headers:{...X,"Content-Type":"application/json",...D},method:H||"POST",signal:z||(_>0?E:null)},w=new Request(U,g),C=(yield O?.(w,g))??{...g,url:U};return yield l(C.url??U,C)});return function(E){return A.apply(this,arguments)}}(),{errorInstance:new P.MU({body:p,url:U}),timeout:_,signal:!0});let W;if(L&&(yield L(T)),T.headers.get("Content-Type")?.startsWith("application/json"))W=yield T.json();else{W=yield T.text();try{W=JSON.parse(W||"{}")}catch(A){if(T.ok)throw A;W={error:W}}}if(!T.ok){if("number"==typeof W.error?.code&&"string"==typeof W.error?.message)return W;throw new P.Ci({body:p,details:(0,j.A)(W.error)||T.statusText,headers:T.headers,status:T.status,url:U})}return W}catch(T){throw z?.aborted?(0,K.TY)(z):(0,K.zf)(T)||T instanceof P.Ci||T instanceof P.MU?T:new P.Ci({body:p,cause:T,url:U})}})()}}},16090(Ve,ne,u){"use strict";function S(){return{current:0,take(){return this.current++},reset(){this.current=0}}}u.d(ne,{q:()=>P});const P=S()},21685(Ve,ne,u){"use strict";u.d(ne,{L:()=>m});let K,P=256;function m(j=11){if(!K||P+j>512){K="",P=0;for(let R=0;R<256;R++)K+=(256+256*Math.random()|0).toString(16).substring(1)}return K.substring(P,P+++j)}},50706(Ve,ne,u){"use strict";u.d(ne,{u:()=>K});var S=u(10467),P=u(20440);function K(j){return m.apply(this,arguments)}function m(){return(m=(0,S.A)(function*(j,{signal:R}={}){return new Promise((k,v)=>{if(R?.aborted)return void v((0,P.TY)(R));const $=()=>R?.removeEventListener("abort",U),x=setTimeout(()=>{$(),k()},j),U=()=>{clearTimeout(x),$(),v((0,P.TY)(R))};R?.addEventListener("abort",U,{once:!0})})})).apply(this,arguments)}}}]);

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.