From 276b3ec11f74eaa6c7f6f35ac05e3ffec94b5665 Mon Sep 17 00:00:00 2001 From: dr-frmr Date: Mon, 8 Jul 2024 13:51:00 +0200 Subject: [PATCH] delete old files --- .../app_store/pkg/ui/assets/index-GWVzNPug.js | 10 --- .../app_store/pkg/ui/assets/index-VRt0i4zS.js | 7 -- .../app_store/pkg/ui/assets/index-bjPUX0JA.js | 54 --------------- .../app_store/pkg/ui/assets/index-t0IPNnth.js | 1 - .../app_store/pkg/ui/assets/index-u1isGxGg.js | 7 -- .../pkg/ui/assets/index.es-Yrb0qG1G.js | 68 ------------------- my_nodes/home/tchotchke/.eth_providers | 1 - 7 files changed, 148 deletions(-) delete mode 100644 kinode/packages/app_store/pkg/ui/assets/index-GWVzNPug.js delete mode 100644 kinode/packages/app_store/pkg/ui/assets/index-VRt0i4zS.js delete mode 100644 kinode/packages/app_store/pkg/ui/assets/index-bjPUX0JA.js delete mode 100644 kinode/packages/app_store/pkg/ui/assets/index-t0IPNnth.js delete mode 100644 kinode/packages/app_store/pkg/ui/assets/index-u1isGxGg.js delete mode 100644 kinode/packages/app_store/pkg/ui/assets/index.es-Yrb0qG1G.js delete mode 100644 my_nodes/home/tchotchke/.eth_providers diff --git a/kinode/packages/app_store/pkg/ui/assets/index-GWVzNPug.js b/kinode/packages/app_store/pkg/ui/assets/index-GWVzNPug.js deleted file mode 100644 index bad82c00..00000000 --- a/kinode/packages/app_store/pkg/ui/assets/index-GWVzNPug.js +++ /dev/null @@ -1,10 +0,0 @@ -import{k as sn,j as un,l as ln,c as le,p as k}from"./index-9L6Bkx0q.js";var Bt={exports:{}},Ee=typeof Reflect=="object"?Reflect:null,Ut=Ee&&typeof Ee.apply=="function"?Ee.apply:function(t,r,a){return Function.prototype.apply.call(t,r,a)},De;Ee&&typeof Ee.ownKeys=="function"?De=Ee.ownKeys:Object.getOwnPropertySymbols?De=function(t){return Object.getOwnPropertyNames(t).concat(Object.getOwnPropertySymbols(t))}:De=function(t){return Object.getOwnPropertyNames(t)};function cn(e){console&&console.warn&&console.warn(e)}var mr=Number.isNaN||function(t){return t!==t};function H(){H.init.call(this)}Bt.exports=H;Bt.exports.once=yn;H.EventEmitter=H;H.prototype._events=void 0;H.prototype._eventsCount=0;H.prototype._maxListeners=void 0;var Wt=10;function Ve(e){if(typeof e!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof e)}Object.defineProperty(H,"defaultMaxListeners",{enumerable:!0,get:function(){return Wt},set:function(e){if(typeof e!="number"||e<0||mr(e))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+e+".");Wt=e}});H.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0};H.prototype.setMaxListeners=function(t){if(typeof t!="number"||t<0||mr(t))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+t+".");return this._maxListeners=t,this};function Er(e){return e._maxListeners===void 0?H.defaultMaxListeners:e._maxListeners}H.prototype.getMaxListeners=function(){return Er(this)};H.prototype.emit=function(t){for(var r=[],a=1;a0&&(c=r[0]),c instanceof Error)throw c;var p=new Error("Unhandled error."+(c?" ("+c.message+")":""));throw p.context=c,p}var d=l[t];if(d===void 0)return!1;if(typeof d=="function")Ut(d,this,r);else for(var S=d.length,O=Or(d,S),a=0;a0&&c.length>o&&!c.warned){c.warned=!0;var p=new Error("Possible EventEmitter memory leak detected. "+c.length+" "+String(t)+" listeners added. Use emitter.setMaxListeners() to increase limit");p.name="MaxListenersExceededWarning",p.emitter=e,p.type=t,p.count=c.length,cn(p)}return e}H.prototype.addListener=function(t,r){return Sr(this,t,r,!1)};H.prototype.on=H.prototype.addListener;H.prototype.prependListener=function(t,r){return Sr(this,t,r,!0)};function hn(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function Ar(e,t,r){var a={fired:!1,wrapFn:void 0,target:e,type:t,listener:r},o=hn.bind(a);return o.listener=r,a.wrapFn=o,o}H.prototype.once=function(t,r){return Ve(r),this.on(t,Ar(this,t,r)),this};H.prototype.prependOnceListener=function(t,r){return Ve(r),this.prependListener(t,Ar(this,t,r)),this};H.prototype.removeListener=function(t,r){var a,o,l,c,p;if(Ve(r),o=this._events,o===void 0)return this;if(a=o[t],a===void 0)return this;if(a===r||a.listener===r)--this._eventsCount===0?this._events=Object.create(null):(delete o[t],o.removeListener&&this.emit("removeListener",t,a.listener||r));else if(typeof a!="function"){for(l=-1,c=a.length-1;c>=0;c--)if(a[c]===r||a[c].listener===r){p=a[c].listener,l=c;break}if(l<0)return this;l===0?a.shift():dn(a,l),a.length===1&&(o[t]=a[0]),o.removeListener!==void 0&&this.emit("removeListener",t,p||r)}return this};H.prototype.off=H.prototype.removeListener;H.prototype.removeAllListeners=function(t){var r,a,o;if(a=this._events,a===void 0)return this;if(a.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):a[t]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete a[t]),this;if(arguments.length===0){var l=Object.keys(a),c;for(o=0;o=0;o--)this.removeListener(t,r[o]);return this};function Rr(e,t,r){var a=e._events;if(a===void 0)return[];var o=a[t];return o===void 0?[]:typeof o=="function"?r?[o.listener||o]:[o]:r?pn(o):Or(o,o.length)}H.prototype.listeners=function(t){return Rr(this,t,!0)};H.prototype.rawListeners=function(t){return Rr(this,t,!1)};H.listenerCount=function(e,t){return typeof e.listenerCount=="function"?e.listenerCount(t):xr.call(e,t)};H.prototype.listenerCount=xr;function xr(e){var t=this._events;if(t!==void 0){var r=t[e];if(typeof r=="function")return 1;if(r!==void 0)return r.length}return 0}H.prototype.eventNames=function(){return this._eventsCount>0?De(this._events):[]};function Or(e,t){for(var r=new Array(t),a=0;a"u"||!Y?$:Y(Uint8Array),de={__proto__:null,"%AggregateError%":typeof AggregateError>"u"?$:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>"u"?$:ArrayBuffer,"%ArrayIteratorPrototype%":ge&&Y?Y([][Symbol.iterator]()):$,"%AsyncFromSyncIteratorPrototype%":$,"%AsyncFunction%":we,"%AsyncGenerator%":we,"%AsyncGeneratorFunction%":we,"%AsyncIteratorPrototype%":we,"%Atomics%":typeof Atomics>"u"?$:Atomics,"%BigInt%":typeof BigInt>"u"?$:BigInt,"%BigInt64Array%":typeof BigInt64Array>"u"?$:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>"u"?$:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>"u"?$:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":$n,"%eval%":eval,"%EvalError%":kn,"%Float32Array%":typeof Float32Array>"u"?$:Float32Array,"%Float64Array%":typeof Float64Array>"u"?$:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>"u"?$:FinalizationRegistry,"%Function%":Mr,"%GeneratorFunction%":we,"%Int8Array%":typeof Int8Array>"u"?$:Int8Array,"%Int16Array%":typeof Int16Array>"u"?$:Int16Array,"%Int32Array%":typeof Int32Array>"u"?$:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":ge&&Y?Y(Y([][Symbol.iterator]())):$,"%JSON%":typeof JSON=="object"?JSON:$,"%Map%":typeof Map>"u"?$:Map,"%MapIteratorPrototype%":typeof Map>"u"||!ge||!Y?$:Y(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":Object,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>"u"?$:Promise,"%Proxy%":typeof Proxy>"u"?$:Proxy,"%RangeError%":Un,"%ReferenceError%":Wn,"%Reflect%":typeof Reflect>"u"?$:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>"u"?$:Set,"%SetIteratorPrototype%":typeof Set>"u"||!ge||!Y?$:Y(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>"u"?$:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":ge&&Y?Y(""[Symbol.iterator]()):$,"%Symbol%":ge?Symbol:$,"%SyntaxError%":Ae,"%ThrowTypeError%":qn,"%TypedArray%":Vn,"%TypeError%":Se,"%Uint8Array%":typeof Uint8Array>"u"?$:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>"u"?$:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>"u"?$:Uint16Array,"%Uint32Array%":typeof Uint32Array>"u"?$:Uint32Array,"%URIError%":Hn,"%WeakMap%":typeof WeakMap>"u"?$:WeakMap,"%WeakRef%":typeof WeakRef>"u"?$:WeakRef,"%WeakSet%":typeof WeakSet>"u"?$:WeakSet};if(Y)try{null.error}catch(e){var zn=Y(Y(e));de["%Error.prototype%"]=zn}var Kn=function e(t){var r;if(t==="%AsyncFunction%")r=it("async function () {}");else if(t==="%GeneratorFunction%")r=it("function* () {}");else if(t==="%AsyncGeneratorFunction%")r=it("async function* () {}");else if(t==="%AsyncGenerator%"){var a=e("%AsyncGeneratorFunction%");a&&(r=a.prototype)}else if(t==="%AsyncIteratorPrototype%"){var o=e("%AsyncGenerator%");o&&Y&&(r=Y(o.prototype))}return de[t]=r,r},Vt={__proto__:null,"%ArrayBufferPrototype%":["ArrayBuffer","prototype"],"%ArrayPrototype%":["Array","prototype"],"%ArrayProto_entries%":["Array","prototype","entries"],"%ArrayProto_forEach%":["Array","prototype","forEach"],"%ArrayProto_keys%":["Array","prototype","keys"],"%ArrayProto_values%":["Array","prototype","values"],"%AsyncFunctionPrototype%":["AsyncFunction","prototype"],"%AsyncGenerator%":["AsyncGeneratorFunction","prototype"],"%AsyncGeneratorPrototype%":["AsyncGeneratorFunction","prototype","prototype"],"%BooleanPrototype%":["Boolean","prototype"],"%DataViewPrototype%":["DataView","prototype"],"%DatePrototype%":["Date","prototype"],"%ErrorPrototype%":["Error","prototype"],"%EvalErrorPrototype%":["EvalError","prototype"],"%Float32ArrayPrototype%":["Float32Array","prototype"],"%Float64ArrayPrototype%":["Float64Array","prototype"],"%FunctionPrototype%":["Function","prototype"],"%Generator%":["GeneratorFunction","prototype"],"%GeneratorPrototype%":["GeneratorFunction","prototype","prototype"],"%Int8ArrayPrototype%":["Int8Array","prototype"],"%Int16ArrayPrototype%":["Int16Array","prototype"],"%Int32ArrayPrototype%":["Int32Array","prototype"],"%JSONParse%":["JSON","parse"],"%JSONStringify%":["JSON","stringify"],"%MapPrototype%":["Map","prototype"],"%NumberPrototype%":["Number","prototype"],"%ObjectPrototype%":["Object","prototype"],"%ObjProto_toString%":["Object","prototype","toString"],"%ObjProto_valueOf%":["Object","prototype","valueOf"],"%PromisePrototype%":["Promise","prototype"],"%PromiseProto_then%":["Promise","prototype","then"],"%Promise_all%":["Promise","all"],"%Promise_reject%":["Promise","reject"],"%Promise_resolve%":["Promise","resolve"],"%RangeErrorPrototype%":["RangeError","prototype"],"%ReferenceErrorPrototype%":["ReferenceError","prototype"],"%RegExpPrototype%":["RegExp","prototype"],"%SetPrototype%":["Set","prototype"],"%SharedArrayBufferPrototype%":["SharedArrayBuffer","prototype"],"%StringPrototype%":["String","prototype"],"%SymbolPrototype%":["Symbol","prototype"],"%SyntaxErrorPrototype%":["SyntaxError","prototype"],"%TypedArrayPrototype%":["TypedArray","prototype"],"%TypeErrorPrototype%":["TypeError","prototype"],"%Uint8ArrayPrototype%":["Uint8Array","prototype"],"%Uint8ClampedArrayPrototype%":["Uint8ClampedArray","prototype"],"%Uint16ArrayPrototype%":["Uint16Array","prototype"],"%Uint32ArrayPrototype%":["Uint32Array","prototype"],"%URIErrorPrototype%":["URIError","prototype"],"%WeakMapPrototype%":["WeakMap","prototype"],"%WeakSetPrototype%":["WeakSet","prototype"]},Pe=Ct,We=Nn,Jn=Pe.call(Function.call,Array.prototype.concat),Yn=Pe.call(Function.apply,Array.prototype.splice),zt=Pe.call(Function.call,String.prototype.replace),He=Pe.call(Function.call,String.prototype.slice),Zn=Pe.call(Function.call,RegExp.prototype.exec),Xn=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,Qn=/\\(\\)?/g,ei=function(t){var r=He(t,0,1),a=He(t,-1);if(r==="%"&&a!=="%")throw new Ae("invalid intrinsic syntax, expected closing `%`");if(a==="%"&&r!=="%")throw new Ae("invalid intrinsic syntax, expected opening `%`");var o=[];return zt(t,Xn,function(l,c,p,d){o[o.length]=p?zt(d,Qn,"$1"):c||l}),o},ti=function(t,r){var a=t,o;if(We(Vt,a)&&(o=Vt[a],a="%"+o[0]+"%"),We(de,a)){var l=de[a];if(l===we&&(l=Kn(a)),typeof l>"u"&&!r)throw new Se("intrinsic "+t+" exists, but is not available. Please file an issue!");return{alias:o,name:a,value:l}}throw new Ae("intrinsic "+t+" does not exist!")},Be=function(t,r){if(typeof t!="string"||t.length===0)throw new Se("intrinsic name must be a non-empty string");if(arguments.length>1&&typeof r!="boolean")throw new Se('"allowMissing" argument must be a boolean');if(Zn(/^%?[^%]*%?$/,t)===null)throw new Ae("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var a=ei(t),o=a.length>0?a[0]:"",l=ti("%"+o+"%",r),c=l.name,p=l.value,d=!1,S=l.alias;S&&(o=S[0],Yn(a,Jn([0,1],S)));for(var O=1,I=!0;O=a.length){var j=he(p,D);I=!!j,I&&"get"in j&&!("originalValue"in j.get)?p=j.get:p=p[D]}else I=We(p,D),p=p[D];I&&!d&&(de[c]=p)}}return p},Cr={exports:{}},ot,Kt;function Lt(){if(Kt)return ot;Kt=1;var e=Be,t=e("%Object.defineProperty%",!0)||!1;if(t)try{t({},"a",{value:1})}catch{t=!1}return ot=t,ot}var ri=Be,Fe=ri("%Object.getOwnPropertyDescriptor%",!0);if(Fe)try{Fe([],"length")}catch{Fe=null}var Dt=Fe,Jt=Lt(),ni=Ir,_e=Ke,Yt=Dt,ii=function(t,r,a){if(!t||typeof t!="object"&&typeof t!="function")throw new _e("`obj` must be an object or a function`");if(typeof r!="string"&&typeof r!="symbol")throw new _e("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!="boolean"&&arguments[3]!==null)throw new _e("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!="boolean"&&arguments[4]!==null)throw new _e("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!="boolean"&&arguments[5]!==null)throw new _e("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!="boolean")throw new _e("`loose`, if provided, must be a boolean");var o=arguments.length>3?arguments[3]:null,l=arguments.length>4?arguments[4]:null,c=arguments.length>5?arguments[5]:null,p=arguments.length>6?arguments[6]:!1,d=!!Yt&&Yt(t,r);if(Jt)Jt(t,r,{configurable:c===null&&d?d.configurable:!c,enumerable:o===null&&d?d.enumerable:!o,value:a,writable:l===null&&d?d.writable:!l});else if(p||!o&&!l&&!c)t[r]=a;else throw new ni("This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.")},mt=Lt(),Lr=function(){return!!mt};Lr.hasArrayLengthDefineBug=function(){if(!mt)return null;try{return mt([],"length",{value:1}).length!==1}catch{return!0}};var ai=Lr,oi=Be,Zt=ii,fi=ai(),Xt=Dt,Qt=Ke,si=oi("%Math.floor%"),ui=function(t,r){if(typeof t!="function")throw new Qt("`fn` is not a function");if(typeof r!="number"||r<0||r>4294967295||si(r)!==r)throw new Qt("`length` must be a positive 32-bit integer");var a=arguments.length>2&&!!arguments[2],o=!0,l=!0;if("length"in t&&Xt){var c=Xt(t,"length");c&&!c.configurable&&(o=!1),c&&!c.writable&&(l=!1)}return(o||l||!a)&&(fi?Zt(t,"length",r,!0,!0):Zt(t,"length",r)),t};(function(e){var t=Ct,r=Be,a=ui,o=Ke,l=r("%Function.prototype.apply%"),c=r("%Function.prototype.call%"),p=r("%Reflect.apply%",!0)||t.call(c,l),d=Lt(),S=r("%Math.max%");e.exports=function(D){if(typeof D!="function")throw new o("a function is required");var N=p(t,c,arguments);return a(N,1+S(0,D.length-(arguments.length-1)),!0)};var O=function(){return p(t,l,arguments)};d?d(e.exports,"apply",{value:O}):e.exports.apply=O})(Cr);var Dr=Cr.exports,Fr=Be,Nr=Dr,li=Nr(Fr("String.prototype.indexOf")),$r=function(t,r){var a=Fr(t,!!r);return typeof a=="function"&&li(t,".prototype.")>-1?Nr(a):a},ci=Mt(),hi=$r,Et=hi("Object.prototype.toString"),Je=function(t){return ci&&t&&typeof t=="object"&&Symbol.toStringTag in t?!1:Et(t)==="[object Arguments]"},kr=function(t){return Je(t)?!0:t!==null&&typeof t=="object"&&typeof t.length=="number"&&t.length>=0&&Et(t)!=="[object Array]"&&Et(t.callee)==="[object Function]"},di=function(){return Je(arguments)}();Je.isLegacyArguments=kr;var pi=di?Je:kr,yi=Object.prototype.toString,bi=Function.prototype.toString,vi=/^\s*(?:function)?\*/,Ur=Mt(),ft=Object.getPrototypeOf,gi=function(){if(!Ur)return!1;try{return Function("return function*() {}")()}catch{}},st,_i=function(t){if(typeof t!="function")return!1;if(vi.test(bi.call(t)))return!0;if(!Ur){var r=yi.call(t);return r==="[object GeneratorFunction]"}if(!ft)return!1;if(typeof st>"u"){var a=gi();st=a?ft(a):!1}return ft(t)===st},Wr=Function.prototype.toString,me=typeof Reflect=="object"&&Reflect!==null&&Reflect.apply,St,Ne;if(typeof me=="function"&&typeof Object.defineProperty=="function")try{St=Object.defineProperty({},"length",{get:function(){throw Ne}}),Ne={},me(function(){throw 42},null,St)}catch(e){e!==Ne&&(me=null)}else me=null;var wi=/^\s*class\b/,At=function(t){try{var r=Wr.call(t);return wi.test(r)}catch{return!1}},ut=function(t){try{return At(t)?!1:(Wr.call(t),!0)}catch{return!1}},$e=Object.prototype.toString,mi="[object Object]",Ei="[object Function]",Si="[object GeneratorFunction]",Ai="[object HTMLAllCollection]",Ri="[object HTML document.all class]",xi="[object HTMLCollection]",Oi=typeof Symbol=="function"&&!!Symbol.toStringTag,Ti=!(0 in[,]),Rt=function(){return!1};if(typeof document=="object"){var Pi=document.all;$e.call(Pi)===$e.call(document.all)&&(Rt=function(t){if((Ti||!t)&&(typeof t>"u"||typeof t=="object"))try{var r=$e.call(t);return(r===Ai||r===Ri||r===xi||r===mi)&&t("")==null}catch{}return!1})}var Bi=me?function(t){if(Rt(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;try{me(t,null,St)}catch(r){if(r!==Ne)return!1}return!At(t)&&ut(t)}:function(t){if(Rt(t))return!0;if(!t||typeof t!="function"&&typeof t!="object")return!1;if(Oi)return ut(t);if(At(t))return!1;var r=$e.call(t);return r!==Ei&&r!==Si&&!/^\[object HTML/.test(r)?!1:ut(t)},ji=Bi,Ii=Object.prototype.toString,Hr=Object.prototype.hasOwnProperty,Mi=function(t,r,a){for(var o=0,l=t.length;o=3&&(o=a),Ii.call(t)==="[object Array]"?Mi(t,r,o):typeof t=="string"?Ci(t,r,o):Li(t,r,o)},Fi=Di,lt=["BigInt64Array","BigUint64Array","Float32Array","Float64Array","Int16Array","Int32Array","Int8Array","Uint16Array","Uint32Array","Uint8Array","Uint8ClampedArray"],Ni=typeof globalThis>"u"?le:globalThis,$i=function(){for(var t=[],r=0;r"u"?le:globalThis,xt=ki(),Nt=Ft("String.prototype.slice"),ct=Object.getPrototypeOf,Wi=Ft("Array.prototype.indexOf",!0)||function(t,r){for(var a=0;a-1?r:r!=="Object"?!1:qi(t)}return ke?Hi(t):null},Gi=Gr,Vi=function(t){return!!Gi(t)};(function(e){var t=pi,r=_i,a=Gr,o=Vi;function l(g){return g.call.bind(g)}var c=typeof BigInt<"u",p=typeof Symbol<"u",d=l(Object.prototype.toString),S=l(Number.prototype.valueOf),O=l(String.prototype.valueOf),I=l(Boolean.prototype.valueOf);if(c)var D=l(BigInt.prototype.valueOf);if(p)var N=l(Symbol.prototype.valueOf);function x(g,Le){if(typeof g!="object")return!1;try{return Le(g),!0}catch{return!1}}e.isArgumentsObject=t,e.isGeneratorFunction=r,e.isTypedArray=o;function j(g){return typeof Promise<"u"&&g instanceof Promise||g!==null&&typeof g=="object"&&typeof g.then=="function"&&typeof g.catch=="function"}e.isPromise=j;function R(g){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(g):o(g)||h(g)}e.isArrayBufferView=R;function u(g){return a(g)==="Uint8Array"}e.isUint8Array=u;function y(g){return a(g)==="Uint8ClampedArray"}e.isUint8ClampedArray=y;function m(g){return a(g)==="Uint16Array"}e.isUint16Array=m;function A(g){return a(g)==="Uint32Array"}e.isUint32Array=A;function T(g){return a(g)==="Int8Array"}e.isInt8Array=T;function C(g){return a(g)==="Int16Array"}e.isInt16Array=C;function q(g){return a(g)==="Int32Array"}e.isInt32Array=q;function L(g){return a(g)==="Float32Array"}e.isFloat32Array=L;function M(g){return a(g)==="Float64Array"}e.isFloat64Array=M;function V(g){return a(g)==="BigInt64Array"}e.isBigInt64Array=V;function Q(g){return a(g)==="BigUint64Array"}e.isBigUint64Array=Q;function Z(g){return d(g)==="[object Map]"}Z.working=typeof Map<"u"&&Z(new Map);function G(g){return typeof Map>"u"?!1:Z.working?Z(g):g instanceof Map}e.isMap=G;function K(g){return d(g)==="[object Set]"}K.working=typeof Set<"u"&&K(new Set);function X(g){return typeof Set>"u"?!1:K.working?K(g):g instanceof Set}e.isSet=X;function ee(g){return d(g)==="[object WeakMap]"}ee.working=typeof WeakMap<"u"&&ee(new WeakMap);function re(g){return typeof WeakMap>"u"?!1:ee.working?ee(g):g instanceof WeakMap}e.isWeakMap=re;function ie(g){return d(g)==="[object WeakSet]"}ie.working=typeof WeakSet<"u"&&ie(new WeakSet);function te(g){return ie(g)}e.isWeakSet=te;function z(g){return d(g)==="[object ArrayBuffer]"}z.working=typeof ArrayBuffer<"u"&&z(new ArrayBuffer);function fe(g){return typeof ArrayBuffer>"u"?!1:z.working?z(g):g instanceof ArrayBuffer}e.isArrayBuffer=fe;function ne(g){return d(g)==="[object DataView]"}ne.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&ne(new DataView(new ArrayBuffer(1),0,1));function h(g){return typeof DataView>"u"?!1:ne.working?ne(g):g instanceof DataView}e.isDataView=h;var v=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function w(g){return d(g)==="[object SharedArrayBuffer]"}function f(g){return typeof v>"u"?!1:(typeof w.working>"u"&&(w.working=w(new v)),w.working?w(g):g instanceof v)}e.isSharedArrayBuffer=f;function s(g){return d(g)==="[object AsyncFunction]"}e.isAsyncFunction=s;function b(g){return d(g)==="[object Map Iterator]"}e.isMapIterator=b;function E(g){return d(g)==="[object Set Iterator]"}e.isSetIterator=E;function P(g){return d(g)==="[object Generator]"}e.isGeneratorObject=P;function n(g){return d(g)==="[object WebAssembly.Module]"}e.isWebAssemblyCompiledModule=n;function i(g){return x(g,S)}e.isNumberObject=i;function _(g){return x(g,O)}e.isStringObject=_;function B(g){return x(g,I)}e.isBooleanObject=B;function U(g){return c&&x(g,D)}e.isBigIntObject=U;function F(g){return p&&x(g,N)}e.isSymbolObject=F;function W(g){return i(g)||_(g)||B(g)||U(g)||F(g)}e.isBoxedPrimitive=W;function ue(g){return typeof Uint8Array<"u"&&(fe(g)||f(g))}e.isAnyArrayBuffer=ue,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(g){Object.defineProperty(e,g,{enumerable:!1,value:function(){throw new Error(g+" is not supported in userland")}})})})(Br);var zi=function(t){return t&&typeof t=="object"&&typeof t.copy=="function"&&typeof t.fill=="function"&&typeof t.readUInt8=="function"},Ot={exports:{}};typeof Object.create=="function"?Ot.exports=function(t,r){r&&(t.super_=r,t.prototype=Object.create(r.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}))}:Ot.exports=function(t,r){if(r){t.super_=r;var a=function(){};a.prototype=r.prototype,t.prototype=new a,t.prototype.constructor=t}};var ae=Ot.exports;(function(e){var t={},r=Object.getOwnPropertyDescriptors||function(v){for(var w=Object.keys(v),f={},s=0;s=s)return P;switch(P){case"%s":return String(f[w++]);case"%d":return Number(f[w++]);case"%j":try{return JSON.stringify(f[w++])}catch{return"[Circular]"}default:return P}}),E=f[w];w"u")return function(){return e.deprecate(h,v).apply(this,arguments)};var w=!1;function f(){if(!w){if(k.throwDeprecation)throw new Error(v);k.traceDeprecation?console.trace(v):console.error(v),w=!0}return h.apply(this,arguments)}return f};var o={},l=/^$/;if(t.NODE_DEBUG){var c=t.NODE_DEBUG;c=c.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),l=new RegExp("^"+c+"$","i")}e.debuglog=function(h){if(h=h.toUpperCase(),!o[h])if(l.test(h)){var v=k.pid;o[h]=function(){var w=e.format.apply(e,arguments);console.error("%s %d: %s",h,v,w)}}else o[h]=function(){};return o[h]};function p(h,v){var w={seen:[],stylize:S};return arguments.length>=3&&(w.depth=arguments[2]),arguments.length>=4&&(w.colors=arguments[3]),y(v)?w.showHidden=v:v&&e._extend(w,v),L(w.showHidden)&&(w.showHidden=!1),L(w.depth)&&(w.depth=2),L(w.colors)&&(w.colors=!1),L(w.customInspect)&&(w.customInspect=!0),w.colors&&(w.stylize=d),I(w,h,w.depth)}e.inspect=p,p.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},p.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function d(h,v){var w=p.styles[v];return w?"\x1B["+p.colors[w][0]+"m"+h+"\x1B["+p.colors[w][1]+"m":h}function S(h,v){return h}function O(h){var v={};return h.forEach(function(w,f){v[w]=!0}),v}function I(h,v,w){if(h.customInspect&&v&&G(v.inspect)&&v.inspect!==e.inspect&&!(v.constructor&&v.constructor.prototype===v)){var f=v.inspect(w,h);return C(f)||(f=I(h,f,w)),f}var s=D(h,v);if(s)return s;var b=Object.keys(v),E=O(b);if(h.showHidden&&(b=Object.getOwnPropertyNames(v)),Z(v)&&(b.indexOf("message")>=0||b.indexOf("description")>=0))return N(v);if(b.length===0){if(G(v)){var P=v.name?": "+v.name:"";return h.stylize("[Function"+P+"]","special")}if(M(v))return h.stylize(RegExp.prototype.toString.call(v),"regexp");if(Q(v))return h.stylize(Date.prototype.toString.call(v),"date");if(Z(v))return N(v)}var n="",i=!1,_=["{","}"];if(u(v)&&(i=!0,_=["[","]"]),G(v)){var B=v.name?": "+v.name:"";n=" [Function"+B+"]"}if(M(v)&&(n=" "+RegExp.prototype.toString.call(v)),Q(v)&&(n=" "+Date.prototype.toUTCString.call(v)),Z(v)&&(n=" "+N(v)),b.length===0&&(!i||v.length==0))return _[0]+n+_[1];if(w<0)return M(v)?h.stylize(RegExp.prototype.toString.call(v),"regexp"):h.stylize("[Object]","special");h.seen.push(v);var U;return i?U=x(h,v,w,E,b):U=b.map(function(F){return j(h,v,w,E,F,i)}),h.seen.pop(),R(U,n,_)}function D(h,v){if(L(v))return h.stylize("undefined","undefined");if(C(v)){var w="'"+JSON.stringify(v).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return h.stylize(w,"string")}if(T(v))return h.stylize(""+v,"number");if(y(v))return h.stylize(""+v,"boolean");if(m(v))return h.stylize("null","null")}function N(h){return"["+Error.prototype.toString.call(h)+"]"}function x(h,v,w,f,s){for(var b=[],E=0,P=v.length;E-1&&(b?P=P.split(` -`).map(function(i){return" "+i}).join(` -`).slice(2):P=` -`+P.split(` -`).map(function(i){return" "+i}).join(` -`))):P=h.stylize("[Circular]","special")),L(E)){if(b&&s.match(/^\d+$/))return P;E=JSON.stringify(""+s),E.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(E=E.slice(1,-1),E=h.stylize(E,"name")):(E=E.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),E=h.stylize(E,"string"))}return E+": "+P}function R(h,v,w){var f=h.reduce(function(s,b){return b.indexOf(` -`)>=0,s+b.replace(/\u001b\[\d\d?m/g,"").length+1},0);return f>60?w[0]+(v===""?"":v+` - `)+" "+h.join(`, - `)+" "+w[1]:w[0]+v+" "+h.join(", ")+" "+w[1]}e.types=Br;function u(h){return Array.isArray(h)}e.isArray=u;function y(h){return typeof h=="boolean"}e.isBoolean=y;function m(h){return h===null}e.isNull=m;function A(h){return h==null}e.isNullOrUndefined=A;function T(h){return typeof h=="number"}e.isNumber=T;function C(h){return typeof h=="string"}e.isString=C;function q(h){return typeof h=="symbol"}e.isSymbol=q;function L(h){return h===void 0}e.isUndefined=L;function M(h){return V(h)&&X(h)==="[object RegExp]"}e.isRegExp=M,e.types.isRegExp=M;function V(h){return typeof h=="object"&&h!==null}e.isObject=V;function Q(h){return V(h)&&X(h)==="[object Date]"}e.isDate=Q,e.types.isDate=Q;function Z(h){return V(h)&&(X(h)==="[object Error]"||h instanceof Error)}e.isError=Z,e.types.isNativeError=Z;function G(h){return typeof h=="function"}e.isFunction=G;function K(h){return h===null||typeof h=="boolean"||typeof h=="number"||typeof h=="string"||typeof h=="symbol"||typeof h>"u"}e.isPrimitive=K,e.isBuffer=zi;function X(h){return Object.prototype.toString.call(h)}function ee(h){return h<10?"0"+h.toString(10):h.toString(10)}var re=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function ie(){var h=new Date,v=[ee(h.getHours()),ee(h.getMinutes()),ee(h.getSeconds())].join(":");return[h.getDate(),re[h.getMonth()],v].join(" ")}e.log=function(){console.log("%s - %s",ie(),e.format.apply(e,arguments))},e.inherits=ae,e._extend=function(h,v){if(!v||!V(v))return h;for(var w=Object.keys(v),f=w.length;f--;)h[w[f]]=v[w[f]];return h};function te(h,v){return Object.prototype.hasOwnProperty.call(h,v)}var z=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;e.promisify=function(v){if(typeof v!="function")throw new TypeError('The "original" argument must be of type Function');if(z&&v[z]){var w=v[z];if(typeof w!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(w,z,{value:w,enumerable:!1,writable:!1,configurable:!0}),w}function w(){for(var f,s,b=new Promise(function(n,i){f=n,s=i}),E=[],P=0;P0?this.tail.next=u:this.head=u,this.tail=u,++this.length}},{key:"unshift",value:function(R){var u={data:R,next:this.head};this.length===0&&(this.tail=u),this.head=u,++this.length}},{key:"shift",value:function(){if(this.length!==0){var R=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,R}}},{key:"clear",value:function(){this.head=this.tail=null,this.length=0}},{key:"join",value:function(R){if(this.length===0)return"";for(var u=this.head,y=""+u.data;u=u.next;)y+=R+u.data;return y}},{key:"concat",value:function(R){if(this.length===0)return S.alloc(0);for(var u=S.allocUnsafe(R>>>0),y=this.head,m=0;y;)N(y.data,u,m),m+=y.data.length,y=y.next;return u}},{key:"consume",value:function(R,u){var y;return RA.length?A.length:R;if(T===A.length?m+=A:m+=A.slice(0,R),R-=T,R===0){T===A.length?(++y,u.next?this.head=u.next:this.head=this.tail=null):(this.head=u,u.data=A.slice(T));break}++y}return this.length-=y,m}},{key:"_getBuffer",value:function(R){var u=S.allocUnsafe(R),y=this.head,m=1;for(y.data.copy(u),R-=y.data.length;y=y.next;){var A=y.data,T=R>A.length?A.length:R;if(A.copy(u,u.length-R,0,T),R-=T,R===0){T===A.length?(++m,y.next?this.head=y.next:this.head=this.tail=null):(this.head=y,y.data=A.slice(T));break}++m}return this.length-=m,u}},{key:D,value:function(R,u){return I(this,t(t({},u),{},{depth:0,customInspect:!1}))}}]),x}(),ht}function Ji(e,t){var r=this,a=this._readableState&&this._readableState.destroyed,o=this._writableState&&this._writableState.destroyed;return a||o?(t?t(e):e&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,k.nextTick(Tt,this,e)):k.nextTick(Tt,this,e)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(e||null,function(l){!t&&l?r._writableState?r._writableState.errorEmitted?k.nextTick(Ue,r):(r._writableState.errorEmitted=!0,k.nextTick(nr,r,l)):k.nextTick(nr,r,l):t?(k.nextTick(Ue,r),t(l)):k.nextTick(Ue,r)}),this)}function nr(e,t){Tt(e,t),Ue(e)}function Ue(e){e._writableState&&!e._writableState.emitClose||e._readableState&&!e._readableState.emitClose||e.emit("close")}function Yi(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function Tt(e,t){e.emit("error",t)}function Zi(e,t){var r=e._readableState,a=e._writableState;r&&r.autoDestroy||a&&a.autoDestroy?e.destroy(t):e.emit("error",t)}var Vr={destroy:Ji,undestroy:Yi,errorOrDestroy:Zi},pe={};function Xi(e,t){e.prototype=Object.create(t.prototype),e.prototype.constructor=e,e.__proto__=t}var zr={};function oe(e,t,r){r||(r=Error);function a(l,c,p){return typeof t=="string"?t:t(l,c,p)}var o=function(l){Xi(c,l);function c(p,d,S){return l.call(this,a(p,d,S))||this}return c}(r);o.prototype.name=r.name,o.prototype.code=e,zr[e]=o}function ir(e,t){if(Array.isArray(e)){var r=e.length;return e=e.map(function(a){return String(a)}),r>2?"one of ".concat(t," ").concat(e.slice(0,r-1).join(", "),", or ")+e[r-1]:r===2?"one of ".concat(t," ").concat(e[0]," or ").concat(e[1]):"of ".concat(t," ").concat(e[0])}else return"of ".concat(t," ").concat(String(e))}function Qi(e,t,r){return e.substr(!r||r<0?0:+r,t.length)===t}function ea(e,t,r){return(r===void 0||r>e.length)&&(r=e.length),e.substring(r-t.length,r)===t}function ta(e,t,r){return typeof r!="number"&&(r=0),r+t.length>e.length?!1:e.indexOf(t,r)!==-1}oe("ERR_INVALID_OPT_VALUE",function(e,t){return'The value "'+t+'" is invalid for option "'+e+'"'},TypeError);oe("ERR_INVALID_ARG_TYPE",function(e,t,r){var a;typeof t=="string"&&Qi(t,"not ")?(a="must not be",t=t.replace(/^not /,"")):a="must be";var o;if(ea(e," argument"))o="The ".concat(e," ").concat(a," ").concat(ir(t,"type"));else{var l=ta(e,".")?"property":"argument";o='The "'.concat(e,'" ').concat(l," ").concat(a," ").concat(ir(t,"type"))}return o+=". Received type ".concat(typeof r),o},TypeError);oe("ERR_STREAM_PUSH_AFTER_EOF","stream.push() after EOF");oe("ERR_METHOD_NOT_IMPLEMENTED",function(e){return"The "+e+" method is not implemented"});oe("ERR_STREAM_PREMATURE_CLOSE","Premature close");oe("ERR_STREAM_DESTROYED",function(e){return"Cannot call "+e+" after a stream was destroyed"});oe("ERR_MULTIPLE_CALLBACK","Callback called multiple times");oe("ERR_STREAM_CANNOT_PIPE","Cannot pipe, not readable");oe("ERR_STREAM_WRITE_AFTER_END","write after end");oe("ERR_STREAM_NULL_VALUES","May not write null values to stream",TypeError);oe("ERR_UNKNOWN_ENCODING",function(e){return"Unknown encoding: "+e},TypeError);oe("ERR_STREAM_UNSHIFT_AFTER_END_EVENT","stream.unshift() after end event");pe.codes=zr;var ra=pe.codes.ERR_INVALID_OPT_VALUE;function na(e,t,r){return e.highWaterMark!=null?e.highWaterMark:t?e[r]:null}function ia(e,t,r,a){var o=na(t,a,r);if(o!=null){if(!(isFinite(o)&&Math.floor(o)===o)||o<0){var l=a?r:"highWaterMark";throw new ra(l,o)}return Math.floor(o)}return e.objectMode?16:16*1024}var Kr={getHighWaterMark:ia},aa=oa;function oa(e,t){if(dt("noDeprecation"))return e;var r=!1;function a(){if(!r){if(dt("throwDeprecation"))throw new Error(t);dt("traceDeprecation")?console.trace(t):console.warn(t),r=!0}return e.apply(this,arguments)}return a}function dt(e){try{if(!le.localStorage)return!1}catch{return!1}var t=le.localStorage[e];return t==null?!1:String(t).toLowerCase()==="true"}var pt,ar;function fa(){if(ar)return pt;ar=1,pt=L;function e(f){var s=this;this.next=null,this.entry=null,this.finish=function(){w(s,f)}}var t;L.WritableState=C;var r={deprecate:aa},a=Pr,o=ze.Buffer,l=(typeof le<"u"?le:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function c(f){return o.from(f)}function p(f){return o.isBuffer(f)||f instanceof l}var d=Vr,S=Kr,O=S.getHighWaterMark,I=pe.codes,D=I.ERR_INVALID_ARG_TYPE,N=I.ERR_METHOD_NOT_IMPLEMENTED,x=I.ERR_MULTIPLE_CALLBACK,j=I.ERR_STREAM_CANNOT_PIPE,R=I.ERR_STREAM_DESTROYED,u=I.ERR_STREAM_NULL_VALUES,y=I.ERR_STREAM_WRITE_AFTER_END,m=I.ERR_UNKNOWN_ENCODING,A=d.errorOrDestroy;ae(L,a);function T(){}function C(f,s,b){t=t||Oe(),f=f||{},typeof b!="boolean"&&(b=s instanceof t),this.objectMode=!!f.objectMode,b&&(this.objectMode=this.objectMode||!!f.writableObjectMode),this.highWaterMark=O(this,f,"writableHighWaterMark",b),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var E=f.decodeStrings===!1;this.decodeStrings=!E,this.defaultEncoding=f.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(P){ee(s,P)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.emitClose=f.emitClose!==!1,this.autoDestroy=!!f.autoDestroy,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}C.prototype.getBuffer=function(){for(var s=this.bufferedRequest,b=[];s;)b.push(s),s=s.next;return b},function(){try{Object.defineProperty(C.prototype,"buffer",{get:r.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var q;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(q=Function.prototype[Symbol.hasInstance],Object.defineProperty(L,Symbol.hasInstance,{value:function(s){return q.call(this,s)?!0:this!==L?!1:s&&s._writableState instanceof C}})):q=function(s){return s instanceof this};function L(f){t=t||Oe();var s=this instanceof t;if(!s&&!q.call(L,this))return new L(f);this._writableState=new C(f,this,s),this.writable=!0,f&&(typeof f.write=="function"&&(this._write=f.write),typeof f.writev=="function"&&(this._writev=f.writev),typeof f.destroy=="function"&&(this._destroy=f.destroy),typeof f.final=="function"&&(this._final=f.final)),a.call(this)}L.prototype.pipe=function(){A(this,new j)};function M(f,s){var b=new y;A(f,b),k.nextTick(s,b)}function V(f,s,b,E){var P;return b===null?P=new u:typeof b!="string"&&!s.objectMode&&(P=new D("chunk",["string","Buffer"],b)),P?(A(f,P),k.nextTick(E,P),!1):!0}L.prototype.write=function(f,s,b){var E=this._writableState,P=!1,n=!E.objectMode&&p(f);return n&&!o.isBuffer(f)&&(f=c(f)),typeof s=="function"&&(b=s,s=null),n?s="buffer":s||(s=E.defaultEncoding),typeof b!="function"&&(b=T),E.ending?M(this,b):(n||V(this,E,f,b))&&(E.pendingcb++,P=Z(this,E,n,f,s,b)),P},L.prototype.cork=function(){this._writableState.corked++},L.prototype.uncork=function(){var f=this._writableState;f.corked&&(f.corked--,!f.writing&&!f.corked&&!f.bufferProcessing&&f.bufferedRequest&&te(this,f))},L.prototype.setDefaultEncoding=function(s){if(typeof s=="string"&&(s=s.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((s+"").toLowerCase())>-1))throw new m(s);return this._writableState.defaultEncoding=s,this},Object.defineProperty(L.prototype,"writableBuffer",{enumerable:!1,get:function(){return this._writableState&&this._writableState.getBuffer()}});function Q(f,s,b){return!f.objectMode&&f.decodeStrings!==!1&&typeof s=="string"&&(s=o.from(s,b)),s}Object.defineProperty(L.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function Z(f,s,b,E,P,n){if(!b){var i=Q(s,E,P);E!==i&&(b=!0,P="buffer",E=i)}var _=s.objectMode?1:E.length;s.length+=_;var B=s.length */(function(e,t){var r=ze,a=r.Buffer;function o(c,p){for(var d in c)p[d]=c[d]}a.from&&a.alloc&&a.allocUnsafe&&a.allocUnsafeSlow?e.exports=r:(o(r,t),t.Buffer=l);function l(c,p,d){return a(c,p,d)}l.prototype=Object.create(a.prototype),o(a,l),l.from=function(c,p,d){if(typeof c=="number")throw new TypeError("Argument must not be a number");return a(c,p,d)},l.alloc=function(c,p,d){if(typeof c!="number")throw new TypeError("Argument must be a number");var S=a(c);return p!==void 0?typeof d=="string"?S.fill(p,d):S.fill(p):S.fill(0),S},l.allocUnsafe=function(c){if(typeof c!="number")throw new TypeError("Argument must be a number");return a(c)},l.allocUnsafeSlow=function(c){if(typeof c!="number")throw new TypeError("Argument must be a number");return r.SlowBuffer(c)}})(Pt,Pt.exports);var ce=Pt.exports,fr;function sr(){if(fr)return bt;fr=1;var e=ce.Buffer,t=e.isEncoding||function(u){switch(u=""+u,u&&u.toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":case"raw":return!0;default:return!1}};function r(u){if(!u)return"utf8";for(var y;;)switch(u){case"utf8":case"utf-8":return"utf8";case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return"utf16le";case"latin1":case"binary":return"latin1";case"base64":case"ascii":case"hex":return u;default:if(y)return;u=(""+u).toLowerCase(),y=!0}}function a(u){var y=r(u);if(typeof y!="string"&&(e.isEncoding===t||!t(u)))throw new Error("Unknown encoding: "+u);return y||u}bt.StringDecoder=o;function o(u){this.encoding=a(u);var y;switch(this.encoding){case"utf16le":this.text=I,this.end=D,y=4;break;case"utf8":this.fillLast=d,y=4;break;case"base64":this.text=N,this.end=x,y=3;break;default:this.write=j,this.end=R;return}this.lastNeed=0,this.lastTotal=0,this.lastChar=e.allocUnsafe(y)}o.prototype.write=function(u){if(u.length===0)return"";var y,m;if(this.lastNeed){if(y=this.fillLast(u),y===void 0)return"";m=this.lastNeed,this.lastNeed=0}else m=0;return m>5===6?2:u>>4===14?3:u>>3===30?4:u>>6===2?-1:-2}function c(u,y,m){var A=y.length-1;if(A=0?(T>0&&(u.lastNeed=T-1),T):--A=0?(T>0&&(u.lastNeed=T-2),T):--A=0?(T>0&&(T===2?T=0:u.lastNeed=T-3),T):0))}function p(u,y,m){if((y[0]&192)!==128)return u.lastNeed=0,"�";if(u.lastNeed>1&&y.length>1){if((y[1]&192)!==128)return u.lastNeed=1,"�";if(u.lastNeed>2&&y.length>2&&(y[2]&192)!==128)return u.lastNeed=2,"�"}}function d(u){var y=this.lastTotal-this.lastNeed,m=p(this,u);if(m!==void 0)return m;if(this.lastNeed<=u.length)return u.copy(this.lastChar,y,0,this.lastNeed),this.lastChar.toString(this.encoding,0,this.lastTotal);u.copy(this.lastChar,y,0,u.length),this.lastNeed-=u.length}function S(u,y){var m=c(this,u,y);if(!this.lastNeed)return u.toString("utf8",y);this.lastTotal=m;var A=u.length-(m-this.lastNeed);return u.copy(this.lastChar,0,A),u.toString("utf8",y,A)}function O(u){var y=u&&u.length?this.write(u):"";return this.lastNeed?y+"�":y}function I(u,y){if((u.length-y)%2===0){var m=u.toString("utf16le",y);if(m){var A=m.charCodeAt(m.length-1);if(A>=55296&&A<=56319)return this.lastNeed=2,this.lastTotal=4,this.lastChar[0]=u[u.length-2],this.lastChar[1]=u[u.length-1],m.slice(0,-1)}return m}return this.lastNeed=1,this.lastTotal=2,this.lastChar[0]=u[u.length-1],u.toString("utf16le",y,u.length-1)}function D(u){var y=u&&u.length?this.write(u):"";if(this.lastNeed){var m=this.lastTotal-this.lastNeed;return y+this.lastChar.toString("utf16le",0,m)}return y}function N(u,y){var m=(u.length-y)%3;return m===0?u.toString("base64",y):(this.lastNeed=3-m,this.lastTotal=3,m===1?this.lastChar[0]=u[u.length-1]:(this.lastChar[0]=u[u.length-2],this.lastChar[1]=u[u.length-1]),u.toString("base64",y,u.length-m))}function x(u){var y=u&&u.length?this.write(u):"";return this.lastNeed?y+this.lastChar.toString("base64",0,3-this.lastNeed):y}function j(u){return u.toString(this.encoding)}function R(u){return u&&u.length?this.write(u):""}return bt}var ur=pe.codes.ERR_STREAM_PREMATURE_CLOSE;function sa(e){var t=!1;return function(){if(!t){t=!0;for(var r=arguments.length,a=new Array(r),o=0;o0)if(typeof i!="string"&&!F.objectMode&&Object.getPrototypeOf(i)!==a.prototype&&(i=l(i)),B)F.endEmitted?T(n,new u):Q(n,F,i,!0);else if(F.ended)T(n,new j);else{if(F.destroyed)return!1;F.reading=!1,F.decoder&&!_?(i=F.decoder.write(i),F.objectMode||i.length!==0?Q(n,F,i,!1):te(n,F)):Q(n,F,i,!1)}else B||(F.reading=!1,te(n,F))}return!F.ended&&(F.length=G?n=G:(n--,n|=n>>>1,n|=n>>>2,n|=n>>>4,n|=n>>>8,n|=n>>>16,n++),n}function X(n,i){return n<=0||i.length===0&&i.ended?0:i.objectMode?1:n!==n?i.flowing&&i.length?i.buffer.head.data.length:i.length:(n>i.highWaterMark&&(i.highWaterMark=K(n)),n<=i.length?n:i.ended?i.length:(i.needReadable=!0,0))}M.prototype.read=function(n){d("read",n),n=parseInt(n,10);var i=this._readableState,_=n;if(n!==0&&(i.emittedReadable=!1),n===0&&i.needReadable&&((i.highWaterMark!==0?i.length>=i.highWaterMark:i.length>0)||i.ended))return d("read: emitReadable",i.length,i.ended),i.length===0&&i.ended?b(this):re(this),null;if(n=X(n,i),n===0&&i.ended)return i.length===0&&b(this),null;var B=i.needReadable;d("need readable",B),(i.length===0||i.length-n0?U=s(n,i):U=null,U===null?(i.needReadable=i.length<=i.highWaterMark,n=0):(i.length-=n,i.awaitDrain=0),i.length===0&&(i.ended||(i.needReadable=!0),_!==n&&i.ended&&b(this)),U!==null&&this.emit("data",U),U};function ee(n,i){if(d("onEofChunk"),!i.ended){if(i.decoder){var _=i.decoder.end();_&&_.length&&(i.buffer.push(_),i.length+=i.objectMode?1:_.length)}i.ended=!0,i.sync?re(n):(i.needReadable=!1,i.emittedReadable||(i.emittedReadable=!0,ie(n)))}}function re(n){var i=n._readableState;d("emitReadable",i.needReadable,i.emittedReadable),i.needReadable=!1,i.emittedReadable||(d("emitReadable",i.flowing),i.emittedReadable=!0,k.nextTick(ie,n))}function ie(n){var i=n._readableState;d("emitReadable_",i.destroyed,i.length,i.ended),!i.destroyed&&(i.length||i.ended)&&(n.emit("readable"),i.emittedReadable=!1),i.needReadable=!i.flowing&&!i.ended&&i.length<=i.highWaterMark,f(n)}function te(n,i){i.readingMore||(i.readingMore=!0,k.nextTick(z,n,i))}function z(n,i){for(;!i.reading&&!i.ended&&(i.length1&&P(B.pipes,n)!==-1)&&!Le&&(d("false write response, pause",B.awaitDrain),B.awaitDrain++),_.pause())}function tt(be){d("onerror",be),xe(),n.removeListener("error",tt),t(n,"error")===0&&T(n,be)}q(n,"error",tt);function rt(){n.removeListener("finish",nt),xe()}n.once("close",rt);function nt(){d("onfinish"),n.removeListener("close",rt),xe()}n.once("finish",nt);function xe(){d("unpipe"),_.unpipe(n)}return n.emit("pipe",_),B.flowing||(d("pipe resume"),_.resume()),n};function fe(n){return function(){var _=n._readableState;d("pipeOnDrain",_.awaitDrain),_.awaitDrain&&_.awaitDrain--,_.awaitDrain===0&&t(n,"data")&&(_.flowing=!0,f(n))}}M.prototype.unpipe=function(n){var i=this._readableState,_={hasUnpiped:!1};if(i.pipesCount===0)return this;if(i.pipesCount===1)return n&&n!==i.pipes?this:(n||(n=i.pipes),i.pipes=null,i.pipesCount=0,i.flowing=!1,n&&n.emit("unpipe",this,_),this);if(!n){var B=i.pipes,U=i.pipesCount;i.pipes=null,i.pipesCount=0,i.flowing=!1;for(var F=0;F0,B.flowing!==!1&&this.resume()):n==="readable"&&!B.endEmitted&&!B.readableListening&&(B.readableListening=B.needReadable=!0,B.flowing=!1,B.emittedReadable=!1,d("on readable",B.length,B.reading),B.length?re(this):B.reading||k.nextTick(h,this)),_},M.prototype.addListener=M.prototype.on,M.prototype.removeListener=function(n,i){var _=r.prototype.removeListener.call(this,n,i);return n==="readable"&&k.nextTick(ne,this),_},M.prototype.removeAllListeners=function(n){var i=r.prototype.removeAllListeners.apply(this,arguments);return(n==="readable"||n===void 0)&&k.nextTick(ne,this),i};function ne(n){var i=n._readableState;i.readableListening=n.listenerCount("readable")>0,i.resumeScheduled&&!i.paused?i.flowing=!0:n.listenerCount("data")>0&&n.resume()}function h(n){d("readable nexttick read 0"),n.read(0)}M.prototype.resume=function(){var n=this._readableState;return n.flowing||(d("resume"),n.flowing=!n.readableListening,v(this,n)),n.paused=!1,this};function v(n,i){i.resumeScheduled||(i.resumeScheduled=!0,k.nextTick(w,n,i))}function w(n,i){d("resume",i.reading),i.reading||n.read(0),i.resumeScheduled=!1,n.emit("resume"),f(n),i.flowing&&!i.reading&&n.read(0)}M.prototype.pause=function(){return d("call pause flowing=%j",this._readableState.flowing),this._readableState.flowing!==!1&&(d("pause"),this._readableState.flowing=!1,this.emit("pause")),this._readableState.paused=!0,this};function f(n){var i=n._readableState;for(d("flow",i.flowing);i.flowing&&n.read()!==null;);}M.prototype.wrap=function(n){var i=this,_=this._readableState,B=!1;n.on("end",function(){if(d("wrapped end"),_.decoder&&!_.ended){var W=_.decoder.end();W&&W.length&&i.push(W)}i.push(null)}),n.on("data",function(W){if(d("wrapped data"),_.decoder&&(W=_.decoder.write(W)),!(_.objectMode&&W==null)&&!(!_.objectMode&&(!W||!W.length))){var ue=i.push(W);ue||(B=!0,n.pause())}});for(var U in n)this[U]===void 0&&typeof n[U]=="function"&&(this[U]=function(ue){return function(){return n[ue].apply(n,arguments)}}(U));for(var F=0;F=i.length?(i.decoder?_=i.buffer.join(""):i.buffer.length===1?_=i.buffer.first():_=i.buffer.concat(i.length),i.buffer.clear()):_=i.buffer.consume(n,i.decoder),_}function b(n){var i=n._readableState;d("endReadable",i.endEmitted),i.endEmitted||(i.ended=!0,k.nextTick(E,i,n))}function E(n,i){if(d("endReadableNT",n.endEmitted,n.length),!n.endEmitted&&n.length===0&&(n.endEmitted=!0,i.readable=!1,i.emit("end"),n.autoDestroy)){var _=i._writableState;(!_||_.autoDestroy&&_.finished)&&i.destroy()}}typeof Symbol=="function"&&(M.from=function(n,i){return A===void 0&&(A=ha()),A(M,n,i)});function P(n,i){for(var _=0,B=n.length;_0;return Ra(c,d,S,function(O){o||(o=O),O&&l.forEach(yr),!d&&(l.forEach(yr),a(o))})});return t.reduce(xa)}var Ro=Ta,Qr={exports:{}},en=ce.Buffer;function Xe(e,t){this._block=en.alloc(e),this._finalSize=t,this._blockSize=e,this._len=0}Xe.prototype.update=function(e,t){typeof e=="string"&&(t=t||"utf8",e=en.from(e,t));for(var r=this._block,a=this._blockSize,o=e.length,l=this._len,c=0;c=this._finalSize&&(this._update(this._block),this._block.fill(0));var r=this._len*8;if(r<=4294967295)this._block.writeUInt32BE(r,this._blockSize-4);else{var a=(r&4294967295)>>>0,o=(r-a)/4294967296;this._block.writeUInt32BE(o,this._blockSize-8),this._block.writeUInt32BE(a,this._blockSize-4)}this._update(this._block);var l=this._hash();return e?l.toString(e):l};Xe.prototype._update=function(){throw new Error("_update must be implemented by subclass")};var Re=Xe,Pa=ae,tn=Re,Ba=ce.Buffer,ja=[1518500249,1859775393,-1894007588,-899497514],Ia=new Array(80);function je(){this.init(),this._w=Ia,tn.call(this,64,56)}Pa(je,tn);je.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function Ma(e){return e<<5|e>>>27}function Ca(e){return e<<30|e>>>2}function La(e,t,r,a){return e===0?t&r|~t&a:e===2?t&r|t&a|r&a:t^r^a}je.prototype._update=function(e){for(var t=this._w,r=this._a|0,a=this._b|0,o=this._c|0,l=this._d|0,c=this._e|0,p=0;p<16;++p)t[p]=e.readInt32BE(p*4);for(;p<80;++p)t[p]=t[p-3]^t[p-8]^t[p-14]^t[p-16];for(var d=0;d<80;++d){var S=~~(d/20),O=Ma(r)+La(S,a,o,l)+c+t[d]+ja[S]|0;c=l,l=o,o=Ca(a),a=r,r=O}this._a=r+this._a|0,this._b=a+this._b|0,this._c=o+this._c|0,this._d=l+this._d|0,this._e=c+this._e|0};je.prototype._hash=function(){var e=Ba.allocUnsafe(20);return e.writeInt32BE(this._a|0,0),e.writeInt32BE(this._b|0,4),e.writeInt32BE(this._c|0,8),e.writeInt32BE(this._d|0,12),e.writeInt32BE(this._e|0,16),e};var Da=je,Fa=ae,rn=Re,Na=ce.Buffer,$a=[1518500249,1859775393,-1894007588,-899497514],ka=new Array(80);function Ie(){this.init(),this._w=ka,rn.call(this,64,56)}Fa(Ie,rn);Ie.prototype.init=function(){return this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520,this};function Ua(e){return e<<1|e>>>31}function Wa(e){return e<<5|e>>>27}function Ha(e){return e<<30|e>>>2}function qa(e,t,r,a){return e===0?t&r|~t&a:e===2?t&r|t&a|r&a:t^r^a}Ie.prototype._update=function(e){for(var t=this._w,r=this._a|0,a=this._b|0,o=this._c|0,l=this._d|0,c=this._e|0,p=0;p<16;++p)t[p]=e.readInt32BE(p*4);for(;p<80;++p)t[p]=Ua(t[p-3]^t[p-8]^t[p-14]^t[p-16]);for(var d=0;d<80;++d){var S=~~(d/20),O=Wa(r)+qa(S,a,o,l)+c+t[d]+$a[S]|0;c=l,l=o,o=Ha(a),a=r,r=O}this._a=r+this._a|0,this._b=a+this._b|0,this._c=o+this._c|0,this._d=l+this._d|0,this._e=c+this._e|0};Ie.prototype._hash=function(){var e=Na.allocUnsafe(20);return e.writeInt32BE(this._a|0,0),e.writeInt32BE(this._b|0,4),e.writeInt32BE(this._c|0,8),e.writeInt32BE(this._d|0,12),e.writeInt32BE(this._e|0,16),e};var Ga=Ie,Va=ae,nn=Re,za=ce.Buffer,Ka=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],Ja=new Array(64);function Me(){this.init(),this._w=Ja,nn.call(this,64,56)}Va(Me,nn);Me.prototype.init=function(){return this._a=1779033703,this._b=3144134277,this._c=1013904242,this._d=2773480762,this._e=1359893119,this._f=2600822924,this._g=528734635,this._h=1541459225,this};function Ya(e,t,r){return r^e&(t^r)}function Za(e,t,r){return e&t|r&(e|t)}function Xa(e){return(e>>>2|e<<30)^(e>>>13|e<<19)^(e>>>22|e<<10)}function Qa(e){return(e>>>6|e<<26)^(e>>>11|e<<21)^(e>>>25|e<<7)}function eo(e){return(e>>>7|e<<25)^(e>>>18|e<<14)^e>>>3}function to(e){return(e>>>17|e<<15)^(e>>>19|e<<13)^e>>>10}Me.prototype._update=function(e){for(var t=this._w,r=this._a|0,a=this._b|0,o=this._c|0,l=this._d|0,c=this._e|0,p=this._f|0,d=this._g|0,S=this._h|0,O=0;O<16;++O)t[O]=e.readInt32BE(O*4);for(;O<64;++O)t[O]=to(t[O-2])+t[O-7]+eo(t[O-15])+t[O-16]|0;for(var I=0;I<64;++I){var D=S+Qa(c)+Ya(c,p,d)+Ka[I]+t[I]|0,N=Xa(r)+Za(r,a,o)|0;S=d,d=p,p=c,c=l+D|0,l=o,o=a,a=r,r=D+N|0}this._a=r+this._a|0,this._b=a+this._b|0,this._c=o+this._c|0,this._d=l+this._d|0,this._e=c+this._e|0,this._f=p+this._f|0,this._g=d+this._g|0,this._h=S+this._h|0};Me.prototype._hash=function(){var e=za.allocUnsafe(32);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e.writeInt32BE(this._h,28),e};var an=Me,ro=ae,no=an,io=Re,ao=ce.Buffer,oo=new Array(64);function Qe(){this.init(),this._w=oo,io.call(this,64,56)}ro(Qe,no);Qe.prototype.init=function(){return this._a=3238371032,this._b=914150663,this._c=812702999,this._d=4144912697,this._e=4290775857,this._f=1750603025,this._g=1694076839,this._h=3204075428,this};Qe.prototype._hash=function(){var e=ao.allocUnsafe(28);return e.writeInt32BE(this._a,0),e.writeInt32BE(this._b,4),e.writeInt32BE(this._c,8),e.writeInt32BE(this._d,12),e.writeInt32BE(this._e,16),e.writeInt32BE(this._f,20),e.writeInt32BE(this._g,24),e};var fo=Qe,so=ae,on=Re,uo=ce.Buffer,br=[1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591],lo=new Array(160);function Ce(){this.init(),this._w=lo,on.call(this,128,112)}so(Ce,on);Ce.prototype.init=function(){return this._ah=1779033703,this._bh=3144134277,this._ch=1013904242,this._dh=2773480762,this._eh=1359893119,this._fh=2600822924,this._gh=528734635,this._hh=1541459225,this._al=4089235720,this._bl=2227873595,this._cl=4271175723,this._dl=1595750129,this._el=2917565137,this._fl=725511199,this._gl=4215389547,this._hl=327033209,this};function vr(e,t,r){return r^e&(t^r)}function gr(e,t,r){return e&t|r&(e|t)}function _r(e,t){return(e>>>28|t<<4)^(t>>>2|e<<30)^(t>>>7|e<<25)}function wr(e,t){return(e>>>14|t<<18)^(e>>>18|t<<14)^(t>>>9|e<<23)}function co(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^e>>>7}function ho(e,t){return(e>>>1|t<<31)^(e>>>8|t<<24)^(e>>>7|t<<25)}function po(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^e>>>6}function yo(e,t){return(e>>>19|t<<13)^(t>>>29|e<<3)^(e>>>6|t<<26)}function J(e,t){return e>>>0>>0?1:0}Ce.prototype._update=function(e){for(var t=this._w,r=this._ah|0,a=this._bh|0,o=this._ch|0,l=this._dh|0,c=this._eh|0,p=this._fh|0,d=this._gh|0,S=this._hh|0,O=this._al|0,I=this._bl|0,D=this._cl|0,N=this._dl|0,x=this._el|0,j=this._fl|0,R=this._gl|0,u=this._hl|0,y=0;y<32;y+=2)t[y]=e.readInt32BE(y*4),t[y+1]=e.readInt32BE(y*4+4);for(;y<160;y+=2){var m=t[y-30],A=t[y-15*2+1],T=co(m,A),C=ho(A,m);m=t[y-2*2],A=t[y-2*2+1];var q=po(m,A),L=yo(A,m),M=t[y-7*2],V=t[y-7*2+1],Q=t[y-16*2],Z=t[y-16*2+1],G=C+V|0,K=T+M+J(G,C)|0;G=G+L|0,K=K+q+J(G,L)|0,G=G+Z|0,K=K+Q+J(G,Z)|0,t[y]=K,t[y+1]=G}for(var X=0;X<160;X+=2){K=t[X],G=t[X+1];var ee=gr(r,a,o),re=gr(O,I,D),ie=_r(r,O),te=_r(O,r),z=wr(c,x),fe=wr(x,c),ne=br[X],h=br[X+1],v=vr(c,p,d),w=vr(x,j,R),f=u+fe|0,s=S+z+J(f,u)|0;f=f+w|0,s=s+v+J(f,w)|0,f=f+h|0,s=s+ne+J(f,h)|0,f=f+G|0,s=s+K+J(f,G)|0;var b=te+re|0,E=ie+ee+J(b,te)|0;S=d,u=R,d=p,R=j,p=c,j=x,x=N+f|0,c=l+s+J(x,N)|0,l=o,N=D,o=a,D=I,a=r,I=O,O=f+b|0,r=s+E+J(O,f)|0}this._al=this._al+O|0,this._bl=this._bl+I|0,this._cl=this._cl+D|0,this._dl=this._dl+N|0,this._el=this._el+x|0,this._fl=this._fl+j|0,this._gl=this._gl+R|0,this._hl=this._hl+u|0,this._ah=this._ah+r+J(this._al,O)|0,this._bh=this._bh+a+J(this._bl,I)|0,this._ch=this._ch+o+J(this._cl,D)|0,this._dh=this._dh+l+J(this._dl,N)|0,this._eh=this._eh+c+J(this._el,x)|0,this._fh=this._fh+p+J(this._fl,j)|0,this._gh=this._gh+d+J(this._gl,R)|0,this._hh=this._hh+S+J(this._hl,u)|0};Ce.prototype._hash=function(){var e=uo.allocUnsafe(64);function t(r,a,o){e.writeInt32BE(r,o),e.writeInt32BE(a,o+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),t(this._gh,this._gl,48),t(this._hh,this._hl,56),e};var fn=Ce,bo=ae,vo=fn,go=Re,_o=ce.Buffer,wo=new Array(160);function et(){this.init(),this._w=wo,go.call(this,128,112)}bo(et,vo);et.prototype.init=function(){return this._ah=3418070365,this._bh=1654270250,this._ch=2438529370,this._dh=355462360,this._eh=1731405415,this._fh=2394180231,this._gh=3675008525,this._hh=1203062813,this._al=3238371032,this._bl=914150663,this._cl=812702999,this._dl=4144912697,this._el=4290775857,this._fl=1750603025,this._gl=1694076839,this._hl=3204075428,this};et.prototype._hash=function(){var e=_o.allocUnsafe(48);function t(r,a,o){e.writeInt32BE(r,o),e.writeInt32BE(a,o+4)}return t(this._ah,this._al,0),t(this._bh,this._bl,8),t(this._ch,this._cl,16),t(this._dh,this._dl,24),t(this._eh,this._el,32),t(this._fh,this._fl,40),e};var mo=et,ye=Qr.exports=function(t){t=t.toLowerCase();var r=ye[t];if(!r)throw new Error(t+" is not supported (we accept pull requests)");return new r};ye.sha=Da;ye.sha1=Ga;ye.sha224=fo;ye.sha256=an;ye.sha384=mo;ye.sha512=fn;var xo=Qr.exports;export{So as W,pa as _,da as a,fa as b,Oe as c,Ao as d,Yr as e,jt as f,ce as g,sr as h,ae as i,aa as j,Ro as p,ze as r,xo as s,It as u}; diff --git a/kinode/packages/app_store/pkg/ui/assets/index-VRt0i4zS.js b/kinode/packages/app_store/pkg/ui/assets/index-VRt0i4zS.js deleted file mode 100644 index 05b7cc7c..00000000 --- a/kinode/packages/app_store/pkg/ui/assets/index-VRt0i4zS.js +++ /dev/null @@ -1,7 +0,0 @@ -import{c as k,h as B,j as io,p as Yn,k as oc}from"./index-9L6Bkx0q.js";import{b as jr}from"./bn-6njz35pn.js";import{s as ac,f as oo}from"./index-GWVzNPug.js";import{a as ue,b as Fr,r as Xt,j as cc}from"./hooks.module-Yb8DqZG0.js";function lc(t,e){for(var r=0;rn[s]})}}}return Object.freeze(Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}))}var as={},Gt={},Br={};Object.defineProperty(Br,"__esModule",{value:!0});Br.walletLogo=void 0;const uc=(t,e)=>{let r;switch(t){case"standard":return r=e,`data:image/svg+xml,%3Csvg width='${e}' height='${r}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `;case"circle":return r=e,`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${e}' height='${r}' viewBox='0 0 999.81 999.81'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052fe;%7D.cls-2%7Bfill:%23fefefe;%7D.cls-3%7Bfill:%230152fe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M655-115.9h56c.83,1.59,2.36.88,3.56,1a478,478,0,0,1,75.06,10.42C891.4-81.76,978.33-32.58,1049.19,44q116.7,126,131.94,297.61c.38,4.14-.34,8.53,1.78,12.45v59c-1.58.84-.91,2.35-1,3.56a482.05,482.05,0,0,1-10.38,74.05c-24,106.72-76.64,196.76-158.83,268.93s-178.18,112.82-287.2,122.6c-4.83.43-9.86-.25-14.51,1.77H654c-1-1.68-2.69-.91-4.06-1a496.89,496.89,0,0,1-105.9-18.59c-93.54-27.42-172.78-77.59-236.91-150.94Q199.34,590.1,184.87,426.58c-.47-5.19.25-10.56-1.77-15.59V355c1.68-1,.91-2.7,1-4.06a498.12,498.12,0,0,1,18.58-105.9c26-88.75,72.64-164.9,140.6-227.57q126-116.27,297.21-131.61C645.32-114.57,650.35-113.88,655-115.9Zm377.92,500c0-192.44-156.31-349.49-347.56-350.15-194.13-.68-350.94,155.13-352.29,347.42-1.37,194.55,155.51,352.1,348.56,352.47C876.15,734.23,1032.93,577.84,1032.93,384.11Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-2' d='M1032.93,384.11c0,193.73-156.78,350.12-351.29,349.74-193-.37-349.93-157.92-348.56-352.47C334.43,189.09,491.24,33.28,685.37,34,876.62,34.62,1032.94,191.67,1032.93,384.11ZM683,496.81q43.74,0,87.48,0c15.55,0,25.32-9.72,25.33-25.21q0-87.48,0-175c0-15.83-9.68-25.46-25.59-25.46H595.77c-15.88,0-25.57,9.64-25.58,25.46q0,87.23,0,174.45c0,16.18,9.59,25.7,25.84,25.71Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-3' d='M683,496.81H596c-16.25,0-25.84-9.53-25.84-25.71q0-87.23,0-174.45c0-15.82,9.7-25.46,25.58-25.46H770.22c15.91,0,25.59,9.63,25.59,25.46q0,87.47,0,175c0,15.49-9.78,25.2-25.33,25.21Q726.74,496.84,683,496.81Z' transform='translate(-183.1 115.9)'/%3E%3C/svg%3E`;case"text":return r=(.1*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogo":return r=(.25*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;case"textLight":return r=(.1*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogoLight":return r=(.25*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${r}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;default:return r=e,`data:image/svg+xml,%3Csvg width='${e}' height='${r}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `}};Br.walletLogo=uc;var Dr={};Object.defineProperty(Dr,"__esModule",{value:!0});Dr.LINK_API_URL=void 0;Dr.LINK_API_URL="https://www.walletlink.org";var S={},Kt={},Ue={};Object.defineProperty(Ue,"__esModule",{value:!0});Ue.errorValues=Ue.standardErrorCodes=void 0;Ue.standardErrorCodes={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901,unsupportedChain:4902}};Ue.errorValues={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."},4902:{standard:"EIP-3085",message:"Unrecognized chain ID."}};var Hr={},Ur={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.serialize=t.getErrorCode=t.isValidCode=t.getMessageFromCode=t.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const e=Ue,r="Unspecified error message.";t.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.";function n(h,f=r){if(h&&Number.isInteger(h)){const g=h.toString();if(u(e.errorValues,g))return e.errorValues[g].message;if(l(h))return t.JSON_RPC_SERVER_ERROR_MESSAGE}return f}t.getMessageFromCode=n;function s(h){if(!Number.isInteger(h))return!1;const f=h.toString();return!!(e.errorValues[f]||l(h))}t.isValidCode=s;function i(h){var f;if(typeof h=="number")return h;if(o(h))return(f=h.code)!==null&&f!==void 0?f:h.errorCode}t.getErrorCode=i;function o(h){return typeof h=="object"&&h!==null&&(typeof h.code=="number"||typeof h.errorCode=="number")}function a(h,{shouldIncludeStack:f=!1}={}){const g={};if(h&&typeof h=="object"&&!Array.isArray(h)&&u(h,"code")&&s(h.code)){const b=h;g.code=b.code,b.message&&typeof b.message=="string"?(g.message=b.message,u(b,"data")&&(g.data=b.data)):(g.message=n(g.code),g.data={originalError:c(h)})}else g.code=e.standardErrorCodes.rpc.internal,g.message=d(h,"message")?h.message:r,g.data={originalError:c(h)};return f&&(g.stack=d(h,"stack")?h.stack:void 0),g}t.serialize=a;function l(h){return h>=-32099&&h<=-32e3}function c(h){return h&&typeof h=="object"&&!Array.isArray(h)?Object.assign({},h):h}function u(h,f){return Object.prototype.hasOwnProperty.call(h,f)}function d(h,f){return typeof h=="object"&&h!==null&&f in h&&typeof h[f]=="string"}})(Ur);Object.defineProperty(Hr,"__esModule",{value:!0});Hr.standardErrors=void 0;const re=Ue,ao=Ur;Hr.standardErrors={rpc:{parse:t=>ye(re.standardErrorCodes.rpc.parse,t),invalidRequest:t=>ye(re.standardErrorCodes.rpc.invalidRequest,t),invalidParams:t=>ye(re.standardErrorCodes.rpc.invalidParams,t),methodNotFound:t=>ye(re.standardErrorCodes.rpc.methodNotFound,t),internal:t=>ye(re.standardErrorCodes.rpc.internal,t),server:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:e}=t;if(!Number.isInteger(e)||e>-32005||e<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return ye(e,t)},invalidInput:t=>ye(re.standardErrorCodes.rpc.invalidInput,t),resourceNotFound:t=>ye(re.standardErrorCodes.rpc.resourceNotFound,t),resourceUnavailable:t=>ye(re.standardErrorCodes.rpc.resourceUnavailable,t),transactionRejected:t=>ye(re.standardErrorCodes.rpc.transactionRejected,t),methodNotSupported:t=>ye(re.standardErrorCodes.rpc.methodNotSupported,t),limitExceeded:t=>ye(re.standardErrorCodes.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>ht(re.standardErrorCodes.provider.userRejectedRequest,t),unauthorized:t=>ht(re.standardErrorCodes.provider.unauthorized,t),unsupportedMethod:t=>ht(re.standardErrorCodes.provider.unsupportedMethod,t),disconnected:t=>ht(re.standardErrorCodes.provider.disconnected,t),chainDisconnected:t=>ht(re.standardErrorCodes.provider.chainDisconnected,t),unsupportedChain:t=>ht(re.standardErrorCodes.provider.unsupportedChain,t),custom:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:e,message:r,data:n}=t;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new uo(e,r,n)}}};function ye(t,e){const[r,n]=co(e);return new lo(t,r||(0,ao.getMessageFromCode)(t),n)}function ht(t,e){const[r,n]=co(e);return new uo(t,r||(0,ao.getMessageFromCode)(t),n)}function co(t){if(t){if(typeof t=="string")return[t];if(typeof t=="object"&&!Array.isArray(t)){const{message:e,data:r}=t;if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,r]}}return[]}let lo=class extends Error{constructor(e,r,n){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string.');super(r),this.code=e,n!==void 0&&(this.data=n)}},uo=class extends lo{constructor(e,r,n){if(!dc(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,r,n)}};function dc(t){return Number.isInteger(t)&&t>=1e3&&t<=4999}var Vr={},Ot={};Object.defineProperty(Ot,"__esModule",{value:!0});Ot.isErrorResponse=void 0;function hc(t){return t.errorMessage!==void 0}Ot.isErrorResponse=hc;var Pt={};Object.defineProperty(Pt,"__esModule",{value:!0});Pt.LIB_VERSION=void 0;Pt.LIB_VERSION="3.9.3";Object.defineProperty(Vr,"__esModule",{value:!0});Vr.serializeError=void 0;const fc=Ot,gc=Pt,pc=Ue,mc=Ur;function bc(t,e){const r=(0,mc.serialize)(yc(t),{shouldIncludeStack:!0}),n=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");n.searchParams.set("version",gc.LIB_VERSION),n.searchParams.set("code",r.code.toString());const s=wc(r.data,e);return s&&n.searchParams.set("method",s),n.searchParams.set("message",r.message),Object.assign(Object.assign({},r),{docUrl:n.href})}Vr.serializeError=bc;function yc(t){return typeof t=="string"?{message:t,code:pc.standardErrorCodes.rpc.internal}:(0,fc.isErrorResponse)(t)?Object.assign(Object.assign({},t),{message:t.errorMessage,code:t.errorCode,data:{method:t.method}}):t}function wc(t,e){const r=t==null?void 0:t.method;if(r)return r;if(e!==void 0){if(typeof e=="string")return e;if(Array.isArray(e)){if(e.length>0)return e[0].method}else return e.method}}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.standardErrors=t.standardErrorCodes=t.serializeError=t.getMessageFromCode=t.getErrorCode=void 0;const e=Ue;Object.defineProperty(t,"standardErrorCodes",{enumerable:!0,get:function(){return e.standardErrorCodes}});const r=Hr;Object.defineProperty(t,"standardErrors",{enumerable:!0,get:function(){return r.standardErrors}});const n=Vr;Object.defineProperty(t,"serializeError",{enumerable:!0,get:function(){return n.serializeError}});const s=Ur;Object.defineProperty(t,"getErrorCode",{enumerable:!0,get:function(){return s.getErrorCode}}),Object.defineProperty(t,"getMessageFromCode",{enumerable:!0,get:function(){return s.getMessageFromCode}})})(Kt);var Q={};Object.defineProperty(Q,"__esModule",{value:!0});Q.ProviderType=Q.RegExpString=Q.IntNumber=Q.BigIntString=Q.AddressString=Q.HexString=Q.OpaqueType=void 0;function Yt(){return t=>t}Q.OpaqueType=Yt;Q.HexString=Yt();Q.AddressString=Yt();Q.BigIntString=Yt();function vc(t){return Math.floor(t)}Q.IntNumber=vc;Q.RegExpString=Yt();var zs;(function(t){t.CoinbaseWallet="CoinbaseWallet",t.MetaMask="MetaMask",t.Unselected=""})(zs||(Q.ProviderType=zs={}));var Ec=k&&k.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(S,"__esModule",{value:!0});S.isMobileWeb=S.getLocation=S.isInIFrame=S.createQrUrl=S.getFavicon=S.range=S.isBigNumber=S.ensureParsedJSONObject=S.ensureBN=S.ensureRegExpString=S.ensureIntNumber=S.ensureBuffer=S.ensureAddressString=S.ensureEvenLengthHexString=S.ensureHexString=S.isHexString=S.prepend0x=S.strip0x=S.has0xPrefix=S.hexStringFromIntNumber=S.intNumberFromHexString=S.bigIntStringFromBN=S.hexStringFromBuffer=S.hexStringToUint8Array=S.uint8ArrayToHex=S.randomBytesHex=void 0;const ze=Ec(jr),lt=Kt,_e=Q,ho=/^[0-9]*$/,fo=/^[a-f0-9]*$/;function _c(t){return go(crypto.getRandomValues(new Uint8Array(t)))}S.randomBytesHex=_c;function go(t){return[...t].map(e=>e.toString(16).padStart(2,"0")).join("")}S.uint8ArrayToHex=go;function Sc(t){return new Uint8Array(t.match(/.{1,2}/g).map(e=>parseInt(e,16)))}S.hexStringToUint8Array=Sc;function Cc(t,e=!1){const r=t.toString("hex");return(0,_e.HexString)(e?`0x${r}`:r)}S.hexStringFromBuffer=Cc;function Rc(t){return(0,_e.BigIntString)(t.toString(10))}S.bigIntStringFromBN=Rc;function kc(t){return(0,_e.IntNumber)(new ze.default(tr(t,!1),16).toNumber())}S.intNumberFromHexString=kc;function Ic(t){return(0,_e.HexString)(`0x${new ze.default(t).toString(16)}`)}S.hexStringFromIntNumber=Ic;function cs(t){return t.startsWith("0x")||t.startsWith("0X")}S.has0xPrefix=cs;function Wr(t){return cs(t)?t.slice(2):t}S.strip0x=Wr;function po(t){return cs(t)?`0x${t.slice(2)}`:`0x${t}`}S.prepend0x=po;function er(t){if(typeof t!="string")return!1;const e=Wr(t).toLowerCase();return fo.test(e)}S.isHexString=er;function mo(t,e=!1){if(typeof t=="string"){const r=Wr(t).toLowerCase();if(fo.test(r))return(0,_e.HexString)(e?`0x${r}`:r)}throw lt.standardErrors.rpc.invalidParams(`"${String(t)}" is not a hexadecimal string`)}S.ensureHexString=mo;function tr(t,e=!1){let r=mo(t,!1);return r.length%2===1&&(r=(0,_e.HexString)(`0${r}`)),e?(0,_e.HexString)(`0x${r}`):r}S.ensureEvenLengthHexString=tr;function Ac(t){if(typeof t=="string"){const e=Wr(t).toLowerCase();if(er(e)&&e.length===40)return(0,_e.AddressString)(po(e))}throw lt.standardErrors.rpc.invalidParams(`Invalid Ethereum address: ${String(t)}`)}S.ensureAddressString=Ac;function Nc(t){if(B.isBuffer(t))return t;if(typeof t=="string"){if(er(t)){const e=tr(t,!1);return B.from(e,"hex")}return B.from(t,"utf8")}throw lt.standardErrors.rpc.invalidParams(`Not binary data: ${String(t)}`)}S.ensureBuffer=Nc;function bo(t){if(typeof t=="number"&&Number.isInteger(t))return(0,_e.IntNumber)(t);if(typeof t=="string"){if(ho.test(t))return(0,_e.IntNumber)(Number(t));if(er(t))return(0,_e.IntNumber)(new ze.default(tr(t,!1),16).toNumber())}throw lt.standardErrors.rpc.invalidParams(`Not an integer: ${String(t)}`)}S.ensureIntNumber=bo;function Mc(t){if(t instanceof RegExp)return(0,_e.RegExpString)(t.toString());throw lt.standardErrors.rpc.invalidParams(`Not a RegExp: ${String(t)}`)}S.ensureRegExpString=Mc;function Tc(t){if(t!==null&&(ze.default.isBN(t)||yo(t)))return new ze.default(t.toString(10),10);if(typeof t=="number")return new ze.default(bo(t));if(typeof t=="string"){if(ho.test(t))return new ze.default(t,10);if(er(t))return new ze.default(tr(t,!1),16)}throw lt.standardErrors.rpc.invalidParams(`Not an integer: ${String(t)}`)}S.ensureBN=Tc;function Lc(t){if(typeof t=="string")return JSON.parse(t);if(typeof t=="object")return t;throw lt.standardErrors.rpc.invalidParams(`Not a JSON string or an object: ${String(t)}`)}S.ensureParsedJSONObject=Lc;function yo(t){if(t==null||typeof t.constructor!="function")return!1;const{constructor:e}=t;return typeof e.config=="function"&&typeof e.EUCLID=="number"}S.isBigNumber=yo;function Oc(t,e){return Array.from({length:e-t},(r,n)=>t+n)}S.range=Oc;function Pc(){const t=document.querySelector('link[sizes="192x192"]')||document.querySelector('link[sizes="180x180"]')||document.querySelector('link[rel="icon"]')||document.querySelector('link[rel="shortcut icon"]'),{protocol:e,host:r}=document.location,n=t?t.getAttribute("href"):null;return!n||n.startsWith("javascript:")||n.startsWith("vbscript:")?null:n.startsWith("http://")||n.startsWith("https://")||n.startsWith("data:")?n:n.startsWith("//")?e+n:`${e}//${r}${n}`}S.getFavicon=Pc;function $c(t,e,r,n,s,i){const o=n?"parent-id":"id",a=new URLSearchParams({[o]:t,secret:e,server:r,v:s,chainId:i.toString()}).toString();return`${r}/#/link?${a}`}S.createQrUrl=$c;function wo(){try{return window.frameElement!==null}catch{return!1}}S.isInIFrame=wo;function xc(){try{return wo()&&window.top?window.top.location:window.location}catch{return window.location}}S.getLocation=xc;function jc(){var t;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((t=window==null?void 0:window.navigator)===null||t===void 0?void 0:t.userAgent)}S.isMobileWeb=jc;var zr={};Object.defineProperty(zr,"__esModule",{value:!0});zr.ScopedLocalStorage=void 0;class Fc{constructor(e){this.scope=e}setItem(e,r){localStorage.setItem(this.scopedKey(e),r)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),r=[];for(let n=0;nlocalStorage.removeItem(n))}scopedKey(e){return`${this.scope}:${e}`}}zr.ScopedLocalStorage=Fc;var kt={},vo={exports:{}};(function(t){var e=Object.prototype.hasOwnProperty,r="~";function n(){}Object.create&&(n.prototype=Object.create(null),new n().__proto__||(r=!1));function s(l,c,u){this.fn=l,this.context=c,this.once=u||!1}function i(l,c,u,d,h){if(typeof u!="function")throw new TypeError("The listener must be a function");var f=new s(u,d||l,h),g=r?r+c:c;return l._events[g]?l._events[g].fn?l._events[g]=[l._events[g],f]:l._events[g].push(f):(l._events[g]=f,l._eventsCount++),l}function o(l,c){--l._eventsCount===0?l._events=new n:delete l._events[c]}function a(){this._events=new n,this._eventsCount=0}a.prototype.eventNames=function(){var c=[],u,d;if(this._eventsCount===0)return c;for(d in u=this._events)e.call(u,d)&&c.push(r?d.slice(1):d);return Object.getOwnPropertySymbols?c.concat(Object.getOwnPropertySymbols(u)):c},a.prototype.listeners=function(c){var u=r?r+c:c,d=this._events[u];if(!d)return[];if(d.fn)return[d.fn];for(var h=0,f=d.length,g=new Array(f);hn.json()).then(n=>{if(!n)throw Js.standardErrors.rpc.parse({});const s=n,{error:i}=s;if(i)throw(0,Js.serializeError)(i,e.method);return s})}}Ee.RelayAbstract=Dc;var xt={};Object.defineProperty(xt,"__esModule",{value:!0});xt.Session=void 0;const qs=ac,Gs=S,Zs="session:id",Qs="session:secret",Xs="session:linked";class ls{constructor(e,r,n,s){this._storage=e,this._id=r||(0,Gs.randomBytesHex)(16),this._secret=n||(0,Gs.randomBytesHex)(32),this._key=new qs.sha256().update(`${this._id}, ${this._secret} WalletLink`).digest("hex"),this._linked=!!s}static load(e){const r=e.getItem(Zs),n=e.getItem(Xs),s=e.getItem(Qs);return r&&s?new ls(e,r,s,n==="1"):null}static hash(e){return new qs.sha256().update(e).digest("hex")}get id(){return this._id}get secret(){return this._secret}get key(){return this._key}get linked(){return this._linked}set linked(e){this._linked=e,this.persistLinked()}save(){return this._storage.setItem(Zs,this._id),this._storage.setItem(Qs,this._secret),this.persistLinked(),this}persistLinked(){this._storage.setItem(Xs,this._linked?"1":"0")}}xt.Session=ls;var Jr={},qr={};Object.defineProperty(qr,"__esModule",{value:!0});qr.Cipher=void 0;const yr=S;class Hc{constructor(e){this.secret=e}async encrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");const n=crypto.getRandomValues(new Uint8Array(12)),s=await crypto.subtle.importKey("raw",(0,yr.hexStringToUint8Array)(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),i=new TextEncoder,o=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:n},s,i.encode(e)),a=16,l=o.slice(o.byteLength-a),c=o.slice(0,o.byteLength-a),u=new Uint8Array(l),d=new Uint8Array(c),h=new Uint8Array([...n,...u,...d]);return(0,yr.uint8ArrayToHex)(h)}async decrypt(e){const r=this.secret;if(r.length!==64)throw Error("secret must be 256 bits");return new Promise((n,s)=>{(async function(){const i=await crypto.subtle.importKey("raw",(0,yr.hexStringToUint8Array)(r),{name:"aes-gcm"},!1,["encrypt","decrypt"]),o=(0,yr.hexStringToUint8Array)(e),a=o.slice(0,12),l=o.slice(12,28),c=o.slice(28),u=new Uint8Array([...c,...l]),d={name:"AES-GCM",iv:new Uint8Array(a)};try{const h=await window.crypto.subtle.decrypt(d,i,u),f=new TextDecoder;n(f.decode(h))}catch(h){s(h)}})()})}}qr.Cipher=Hc;var Gr={};Object.defineProperty(Gr,"__esModule",{value:!0});Gr.WalletLinkHTTP=void 0;class Uc{constructor(e,r,n){this.linkAPIUrl=e,this.sessionId=r;const s=`${r}:${n}`;this.auth=`Basic ${btoa(s)}`}async markUnseenEventsAsSeen(e){return Promise.all(e.map(r=>fetch(`${this.linkAPIUrl}/events/${r.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(r=>console.error("Unabled to mark event as failed:",r))}async fetchUnseenEvents(){var e;const r=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(r.ok){const{events:n,error:s}=await r.json();if(s)throw new Error(`Check unseen events failed: ${s}`);const i=(e=n==null?void 0:n.filter(o=>o.event==="Web3Response").map(o=>({type:"Event",sessionId:this.sessionId,eventId:o.id,event:o.event,data:o.data})))!==null&&e!==void 0?e:[];return this.markUnseenEventsAsSeen(i),i}throw new Error(`Check unseen events failed: ${r.status}`)}}Gr.WalletLinkHTTP=Uc;var It={};Object.defineProperty(It,"__esModule",{value:!0});It.WalletLinkWebSocket=It.ConnectionState=void 0;var vt;(function(t){t[t.DISCONNECTED=0]="DISCONNECTED",t[t.CONNECTING=1]="CONNECTING",t[t.CONNECTED=2]="CONNECTED"})(vt||(It.ConnectionState=vt={}));class Vc{setConnectionStateListener(e){this.connectionStateListener=e}setIncomingDataListener(e){this.incomingDataListener=e}constructor(e,r=WebSocket){this.WebSocketClass=r,this.webSocket=null,this.pendingData=[],this.url=e.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise((e,r)=>{var n;let s;try{this.webSocket=s=new this.WebSocketClass(this.url)}catch(i){r(i);return}(n=this.connectionStateListener)===null||n===void 0||n.call(this,vt.CONNECTING),s.onclose=i=>{var o;this.clearWebSocket(),r(new Error(`websocket error ${i.code}: ${i.reason}`)),(o=this.connectionStateListener)===null||o===void 0||o.call(this,vt.DISCONNECTED)},s.onopen=i=>{var o;e(),(o=this.connectionStateListener)===null||o===void 0||o.call(this,vt.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(l=>this.sendData(l)),this.pendingData=[])},s.onmessage=i=>{var o,a;if(i.data==="h")(o=this.incomingDataListener)===null||o===void 0||o.call(this,{type:"Heartbeat"});else try{const l=JSON.parse(i.data);(a=this.incomingDataListener)===null||a===void 0||a.call(this,l)}catch{}}})}disconnect(){var e;const{webSocket:r}=this;if(r){this.clearWebSocket(),(e=this.connectionStateListener)===null||e===void 0||e.call(this,vt.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{r.close()}catch{}}}sendData(e){const{webSocket:r}=this;if(!r){this.pendingData.push(e),this.connect();return}r.send(e)}clearWebSocket(){const{webSocket:e}=this;e&&(this.webSocket=null,e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null)}}It.WalletLinkWebSocket=Vc;Object.defineProperty(Jr,"__esModule",{value:!0});Jr.WalletLinkConnection=void 0;const ft=Q,Wc=qr,Ne=$t,Ks=Ee,gt=xt,zc=Gr,wr=It,Ys=1e4,Jc=6e4;class qc{constructor({session:e,linkAPIUrl:r,listener:n,diagnostic:s,WebSocketClass:i=WebSocket}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=(0,ft.IntNumber)(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=a=>{if(!a)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",c=>a.JsonRpcUrl&&this.handleChainUpdated(c,a.JsonRpcUrl)]]).forEach((c,u)=>{const d=a[u];d!==void 0&&c(d)})},this.handleDestroyed=a=>{var l,c;a==="1"&&((l=this.listener)===null||l===void 0||l.resetAndReload(),(c=this.diagnostic)===null||c===void 0||c.log(Ne.EVENTS.METADATA_DESTROYED,{alreadyDestroyed:this.isDestroyed,sessionIdHash:gt.Session.hash(this.session.id)}))},this.handleAccountUpdated=async a=>{var l,c;try{const u=await this.cipher.decrypt(a);(l=this.listener)===null||l===void 0||l.accountUpdated(u)}catch{(c=this.diagnostic)===null||c===void 0||c.log(Ne.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"selectedAddress"})}},this.handleMetadataUpdated=async(a,l)=>{var c,u;try{const d=await this.cipher.decrypt(l);(c=this.listener)===null||c===void 0||c.metadataUpdated(a,d)}catch{(u=this.diagnostic)===null||u===void 0||u.log(Ne.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:a})}},this.handleWalletUsernameUpdated=async a=>{this.handleMetadataUpdated(Ks.WALLET_USER_NAME_KEY,a)},this.handleAppVersionUpdated=async a=>{this.handleMetadataUpdated(Ks.APP_VERSION_KEY,a)},this.handleChainUpdated=async(a,l)=>{var c,u;try{const d=await this.cipher.decrypt(a),h=await this.cipher.decrypt(l);(c=this.listener)===null||c===void 0||c.chainUpdated(d,h)}catch{(u=this.diagnostic)===null||u===void 0||u.log(Ne.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"chainId|jsonRpcUrl"})}},this.session=e,this.cipher=new Wc.Cipher(e.secret),this.diagnostic=s,this.listener=n;const o=new wr.WalletLinkWebSocket(`${r}/rpc`,i);o.setConnectionStateListener(async a=>{var l;(l=this.diagnostic)===null||l===void 0||l.log(Ne.EVENTS.CONNECTED_STATE_CHANGE,{state:a,sessionIdHash:gt.Session.hash(e.id)});let c=!1;switch(a){case wr.ConnectionState.DISCONNECTED:if(!this.destroyed){const u=async()=>{await new Promise(d=>setTimeout(d,5e3)),this.destroyed||o.connect().catch(()=>{u()})};u()}break;case wr.ConnectionState.CONNECTED:try{await this.authenticate(),this.sendIsLinked(),this.sendGetSessionConfig(),c=!0}catch{}this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},Ys),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case wr.ConnectionState.CONNECTING:break}this.connected!==c&&(this.connected=c)}),o.setIncomingDataListener(a=>{var l,c,u;switch(a.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const d=a.type==="IsLinkedOK"?a.linked:void 0;(l=this.diagnostic)===null||l===void 0||l.log(Ne.EVENTS.LINKED,{sessionIdHash:gt.Session.hash(e.id),linked:d,type:a.type,onlineGuests:a.onlineGuests}),this.linked=d||a.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{(c=this.diagnostic)===null||c===void 0||c.log(Ne.EVENTS.SESSION_CONFIG_RECEIVED,{sessionIdHash:gt.Session.hash(e.id),metadata_keys:a&&a.metadata?Object.keys(a.metadata):void 0}),this.handleSessionMetadataUpdated(a.metadata);break}case"Event":{this.handleIncomingEvent(a);break}}a.id!==void 0&&((u=this.requestResolutions.get(a.id))===null||u===void 0||u(a))}),this.ws=o,this.http=new zc.WalletLinkHTTP(r,e.id,e.key)}connect(){var e;if(this.destroyed)throw new Error("instance is destroyed");(e=this.diagnostic)===null||e===void 0||e.log(Ne.EVENTS.STARTED_CONNECTING,{sessionIdHash:gt.Session.hash(this.session.id)}),this.ws.connect()}destroy(){var e;this.destroyed=!0,this.ws.disconnect(),(e=this.diagnostic)===null||e===void 0||e.log(Ne.EVENTS.DISCONNECTED,{sessionIdHash:gt.Session.hash(this.session.id)}),this.listener=void 0}get isDestroyed(){return this.destroyed}get connected(){return this._connected}set connected(e){var r,n;this._connected=e,e&&((r=this.onceConnected)===null||r===void 0||r.call(this)),(n=this.listener)===null||n===void 0||n.connectedUpdated(e)}setOnceConnected(e){return new Promise(r=>{this.connected?e().then(r):this.onceConnected=()=>{e().then(r),this.onceConnected=void 0}})}get linked(){return this._linked}set linked(e){var r,n;this._linked=e,e&&((r=this.onceLinked)===null||r===void 0||r.call(this)),(n=this.listener)===null||n===void 0||n.linkedUpdated(e)}setOnceLinked(e){return new Promise(r=>{this.linked?e().then(r):this.onceLinked=()=>{e().then(r),this.onceLinked=void 0}})}async handleIncomingEvent(e){var r,n;if(!(e.type!=="Event"||e.event!=="Web3Response"))try{const s=await this.cipher.decrypt(e.data),i=JSON.parse(s);if(i.type!=="WEB3_RESPONSE")return;(r=this.listener)===null||r===void 0||r.handleWeb3ResponseMessage(i)}catch{(n=this.diagnostic)===null||n===void 0||n.log(Ne.EVENTS.GENERAL_ERROR,{message:"Had error decrypting",value:"incomingEvent"})}}async checkUnseenEvents(){if(!this.connected){this.shouldFetchUnseenEventsOnConnect=!0;return}await new Promise(e=>setTimeout(e,250));try{await this.fetchUnseenEventsAPI()}catch(e){console.error("Unable to check for unseen events",e)}}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1,(await this.http.fetchUnseenEvents()).forEach(r=>this.handleIncomingEvent(r))}async setSessionMetadata(e,r){const n={type:"SetSessionConfig",id:(0,ft.IntNumber)(this.nextReqId++),sessionId:this.session.id,metadata:{[e]:r}};return this.setOnceConnected(async()=>{const s=await this.makeRequest(n);if(s.type==="Fail")throw new Error(s.error||"failed to set session metadata")})}async publishEvent(e,r,n=!1){const s=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},r),{origin:location.origin,relaySource:window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),i={type:"PublishEvent",id:(0,ft.IntNumber)(this.nextReqId++),sessionId:this.session.id,event:e,data:s,callWebhook:n};return this.setOnceLinked(async()=>{const o=await this.makeRequest(i);if(o.type==="Fail")throw new Error(o.error||"failed to publish event");return o.eventId})}sendData(e){this.ws.sendData(JSON.stringify(e))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>Ys*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(e,r=Jc){const n=e.id;this.sendData(e);let s;return Promise.race([new Promise((i,o)=>{s=window.setTimeout(()=>{o(new Error(`request ${n} timed out`))},r)}),new Promise(i=>{this.requestResolutions.set(n,o=>{clearTimeout(s),i(o),this.requestResolutions.delete(n)})})])}async authenticate(){const e={type:"HostSession",id:(0,ft.IntNumber)(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key},r=await this.makeRequest(e);if(r.type==="Fail")throw new Error(r.error||"failed to authentcate")}sendIsLinked(){const e={type:"IsLinked",id:(0,ft.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(e)}sendGetSessionConfig(){const e={type:"GetSessionConfig",id:(0,ft.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(e)}}Jr.WalletLinkConnection=qc;var sr={},ir={},us={};Object.defineProperty(us,"__esModule",{value:!0});us.default='@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}';var Gc=k&&k.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(ir,"__esModule",{value:!0});ir.injectCssReset=void 0;const Zc=Gc(us);function Qc(){const t=document.createElement("style");t.type="text/css",t.appendChild(document.createTextNode(Zc.default)),document.documentElement.appendChild(t)}ir.injectCssReset=Qc;var Zr={},Qr={},At={},Xr={};Object.defineProperty(Xr,"__esModule",{value:!0});Xr.CloseIcon=void 0;const ei=ue;function Xc(t){return(0,ei.h)("svg",Object.assign({width:"40",height:"40",viewBox:"0 0 40 40",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),(0,ei.h)("path",{d:"M13.7677 13L12.3535 14.4142L18.3535 20.4142L12.3535 26.4142L13.7677 27.8284L19.7677 21.8284L25.7677 27.8284L27.1819 26.4142L21.1819 20.4142L27.1819 14.4142L25.7677 13L19.7677 19L13.7677 13Z"}))}Xr.CloseIcon=Xc;var Kr={};Object.defineProperty(Kr,"__esModule",{value:!0});Kr.CoinbaseWalletRound=void 0;const vr=ue;function Kc(t){return(0,vr.h)("svg",Object.assign({width:"28",height:"28",viewBox:"0 0 28 28",fill:"none",xmlns:"http://www.w3.org/2000/svg"},t),(0,vr.h)("circle",{cx:"14",cy:"14",r:"14",fill:"#0052FF"}),(0,vr.h)("path",{d:"M23.8521 14.0003C23.8521 19.455 19.455 23.8521 14.0003 23.8521C8.54559 23.8521 4.14844 19.455 4.14844 14.0003C4.14844 8.54559 8.54559 4.14844 14.0003 4.14844C19.455 4.14844 23.8521 8.54559 23.8521 14.0003Z",fill:"white"}),(0,vr.h)("path",{d:"M11.1855 12.5042C11.1855 12.0477 11.1855 11.7942 11.2835 11.642C11.3814 11.4899 11.4793 11.3377 11.6261 11.287C11.8219 11.1855 12.0178 11.1855 12.5073 11.1855H15.4934C15.983 11.1855 16.1788 11.1855 16.3746 11.287C16.5215 11.3884 16.6683 11.4899 16.7173 11.642C16.8152 11.8449 16.8152 12.0477 16.8152 12.5042V15.4965C16.8152 15.953 16.8152 16.2066 16.7173 16.3587C16.6194 16.5109 16.5215 16.663 16.3746 16.7137C16.1788 16.8152 15.983 16.8152 15.4934 16.8152H12.5073C12.0178 16.8152 11.8219 16.8152 11.6261 16.7137C11.4793 16.6123 11.3324 16.5109 11.2835 16.3587C11.1855 16.1558 11.1855 15.953 11.1855 15.4965V12.5042Z",fill:"#0052FF"}))}Kr.CoinbaseWalletRound=Kc;var Yr={};Object.defineProperty(Yr,"__esModule",{value:!0});Yr.QRCodeIcon=void 0;const Ht=ue;function Yc(t){return(0,Ht.h)("svg",Object.assign({width:"18",height:"18",viewBox:"0 0 24 24",xmlns:"http://www.w3.org/2000/svg"},t),(0,Ht.h)("path",{d:"M3 3V8.99939L5 8.99996V5H9V3H3Z"}),(0,Ht.h)("path",{d:"M15 21L21 21V15.0006L19 15V19L15 19V21Z"}),(0,Ht.h)("path",{d:"M21 9H19V5H15.0006L15 3H21V9Z"}),(0,Ht.h)("path",{d:"M3 15V21H8.99939L8.99996 19H5L5 15H3Z"}))}Yr.QRCodeIcon=Yc;var en={};function Eo(t){this.mode=pe.MODE_8BIT_BYTE,this.data=t,this.parsedData=[];for(var e=0,r=this.data.length;e65536?(n[0]=240|(s&1835008)>>>18,n[1]=128|(s&258048)>>>12,n[2]=128|(s&4032)>>>6,n[3]=128|s&63):s>2048?(n[0]=224|(s&61440)>>>12,n[1]=128|(s&4032)>>>6,n[2]=128|s&63):s>128?(n[0]=192|(s&1984)>>>6,n[1]=128|s&63):n[0]=s,this.parsedData.push(n)}this.parsedData=Array.prototype.concat.apply([],this.parsedData),this.parsedData.length!=this.data.length&&(this.parsedData.unshift(191),this.parsedData.unshift(187),this.parsedData.unshift(239))}Eo.prototype={getLength:function(t){return this.parsedData.length},write:function(t){for(var e=0,r=this.parsedData.length;e=7&&this.setupTypeNumber(t),this.dataCache==null&&(this.dataCache=$e.createData(this.typeNumber,this.errorCorrectLevel,this.dataList)),this.mapData(this.dataCache,e)},setupPositionProbePattern:function(t,e){for(var r=-1;r<=7;r++)if(!(t+r<=-1||this.moduleCount<=t+r))for(var n=-1;n<=7;n++)e+n<=-1||this.moduleCount<=e+n||(0<=r&&r<=6&&(n==0||n==6)||0<=n&&n<=6&&(r==0||r==6)||2<=r&&r<=4&&2<=n&&n<=4?this.modules[t+r][e+n]=!0:this.modules[t+r][e+n]=!1)},getBestMaskPattern:function(){for(var t=0,e=0,r=0;r<8;r++){this.makeImpl(!0,r);var n=W.getLostPoint(this);(r==0||t>n)&&(t=n,e=r)}return e},createMovieClip:function(t,e,r){var n=t.createEmptyMovieClip(e,r),s=1;this.make();for(var i=0;i>r&1)==1;this.modules[Math.floor(r/3)][r%3+this.moduleCount-8-3]=n}for(var r=0;r<18;r++){var n=!t&&(e>>r&1)==1;this.modules[r%3+this.moduleCount-8-3][Math.floor(r/3)]=n}},setupTypeInfo:function(t,e){for(var r=this.errorCorrectLevel<<3|e,n=W.getBCHTypeInfo(r),s=0;s<15;s++){var i=!t&&(n>>s&1)==1;s<6?this.modules[s][8]=i:s<8?this.modules[s+1][8]=i:this.modules[this.moduleCount-15+s][8]=i}for(var s=0;s<15;s++){var i=!t&&(n>>s&1)==1;s<8?this.modules[8][this.moduleCount-s-1]=i:s<9?this.modules[8][15-s-1+1]=i:this.modules[8][15-s-1]=i}this.modules[this.moduleCount-8][8]=!t},mapData:function(t,e){for(var r=-1,n=this.moduleCount-1,s=7,i=0,o=this.moduleCount-1;o>0;o-=2)for(o==6&&o--;;){for(var a=0;a<2;a++)if(this.modules[n][o-a]==null){var l=!1;i>>s&1)==1);var c=W.getMask(e,n,o-a);c&&(l=!l),this.modules[n][o-a]=l,s--,s==-1&&(i++,s=7)}if(n+=r,n<0||this.moduleCount<=n){n-=r,r=-r;break}}}};$e.PAD0=236;$e.PAD1=17;$e.createData=function(t,e,r){for(var n=Pe.getRSBlocks(t,e),s=new _o,i=0;ia*8)throw new Error("code length overflow. ("+s.getLengthInBits()+">"+a*8+")");for(s.getLengthInBits()+4<=a*8&&s.put(0,4);s.getLengthInBits()%8!=0;)s.putBit(!1);for(;!(s.getLengthInBits()>=a*8||(s.put($e.PAD0,8),s.getLengthInBits()>=a*8));)s.put($e.PAD1,8);return $e.createBytes(s,n)};$e.createBytes=function(t,e){for(var r=0,n=0,s=0,i=new Array(e.length),o=new Array(e.length),a=0;a=0?f.get(g):0}}for(var b=0,u=0;u=0;)e^=W.G15<=0;)e^=W.G18<>>=1;return e},getPatternPosition:function(t){return W.PATTERN_POSITION_TABLE[t-1]},getMask:function(t,e,r){switch(t){case Ve.PATTERN000:return(e+r)%2==0;case Ve.PATTERN001:return e%2==0;case Ve.PATTERN010:return r%3==0;case Ve.PATTERN011:return(e+r)%3==0;case Ve.PATTERN100:return(Math.floor(e/2)+Math.floor(r/3))%2==0;case Ve.PATTERN101:return e*r%2+e*r%3==0;case Ve.PATTERN110:return(e*r%2+e*r%3)%2==0;case Ve.PATTERN111:return(e*r%3+(e+r)%2)%2==0;default:throw new Error("bad maskPattern:"+t)}},getErrorCorrectPolynomial:function(t){for(var e=new Et([1],0),r=0;r5&&(r+=3+i-5)}for(var n=0;n=256;)t-=255;return te.EXP_TABLE[t]},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(var ne=0;ne<8;ne++)te.EXP_TABLE[ne]=1<>>7-t%8&1)==1},put:function(t,e){for(var r=0;r>>e-r-1&1)==1)},getLengthInBits:function(){return this.length},putBit:function(t){var e=Math.floor(this.length/8);this.buffer.length<=e&&this.buffer.push(0),t&&(this.buffer[e]|=128>>>this.length%8),this.length++}};var Mn=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]];function So(t){if(this.options={padding:4,width:256,height:256,typeNumber:4,color:"#000000",background:"#ffffff",ecl:"M",image:{svg:"",width:0,height:0}},typeof t=="string"&&(t={content:t}),t)for(var e in t)this.options[e]=t[e];if(typeof this.options.content!="string")throw new Error("Expected 'content' as string!");if(this.options.content.length===0)throw new Error("Expected 'content' to be non-empty!");if(!(this.options.padding>=0))throw new Error("Expected 'padding' value to be non-negative!");if(!(this.options.width>0)||!(this.options.height>0))throw new Error("Expected 'width' or 'height' value to be higher than zero!");function r(l){switch(l){case"L":return Je.L;case"M":return Je.M;case"Q":return Je.Q;case"H":return Je.H;default:throw new Error("Unknwon error correction level: "+l)}}function n(l,c){for(var u=s(l),d=1,h=0,f=0,g=Mn.length;f<=g;f++){var b=Mn[f];if(!b)throw new Error("Content too long: expected "+h+" but got "+u);switch(c){case"L":h=b[0];break;case"M":h=b[1];break;case"Q":h=b[2];break;case"H":h=b[3];break;default:throw new Error("Unknwon error correction level: "+c)}if(u<=h)break;d++}if(d>Mn.length)throw new Error("Content too long");return d}function s(l){var c=encodeURI(l).toString().replace(/\%[0-9a-fA-F]{2}/g,"a");return c.length+(c.length!=l?3:0)}var i=this.options.content,o=n(i,this.options.ecl),a=r(this.options.ecl);this.qrcode=new $e(o,a),this.qrcode.addData(i),this.qrcode.make()}So.prototype.svg=function(t){var e=this.options||{},r=this.qrcode.modules;typeof t>"u"&&(t={container:e.container||"svg"});for(var n=typeof e.pretty<"u"?!!e.pretty:!0,s=n?" ":"",i=n?`\r -`:"",o=e.width,a=e.height,l=r.length,c=o/(l+2*e.padding),u=a/(l+2*e.padding),d=typeof e.join<"u"?!!e.join:!1,h=typeof e.swap<"u"?!!e.swap:!1,f=typeof e.xmlDeclaration<"u"?!!e.xmlDeclaration:!0,g=typeof e.predefined<"u"?!!e.predefined:!1,b=g?s+''+i:"",p=s+''+i,_="",y="",m=0;m'+i:_+=s+''+i}}d&&(_=s+'');let be="";if(this.options.image!==void 0&&this.options.image.svg){const E=o*this.options.image.width/100,w=a*this.options.image.height/100,I=o/2-E/2,R=a/2-w/2;be+=``,be+=this.options.image.svg+i,be+=""}var Y="";switch(t.container){case"svg":f&&(Y+=''+i),Y+=''+i,Y+=b+p+_,Y+=be,Y+="";break;case"svg-viewbox":f&&(Y+=''+i),Y+=''+i,Y+=b+p+_,Y+=be,Y+="";break;case"g":Y+=''+i,Y+=b+p+_,Y+=be,Y+="";break;default:Y+=(b+p+_+be).replace(/^\s+/,"");break}return Y};var el=So,tl=k&&k.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(en,"__esModule",{value:!0});en.QRCode=void 0;const rl=ue,ti=Fr,nl=tl(el),sl=t=>{const[e,r]=(0,ti.useState)("");return(0,ti.useEffect)(()=>{var n,s;const i=new nl.default({content:t.content,background:t.bgColor||"#ffffff",color:t.fgColor||"#000000",container:"svg",ecl:"M",width:(n=t.width)!==null&&n!==void 0?n:256,height:(s=t.height)!==null&&s!==void 0?s:256,padding:0,image:t.image}),o=B.from(i.svg(),"utf8").toString("base64");r(`data:image/svg+xml;base64,${o}`)},[t.bgColor,t.content,t.fgColor,t.height,t.image,t.width]),e?(0,rl.h)("img",{src:e,alt:"QR Code"}):null};en.QRCode=sl;var tn={},ds={};Object.defineProperty(ds,"__esModule",{value:!0});ds.default=".-cbwsdk-css-reset .-cbwsdk-spinner{display:inline-block}.-cbwsdk-css-reset .-cbwsdk-spinner svg{display:inline-block;animation:2s linear infinite -cbwsdk-spinner-svg}.-cbwsdk-css-reset .-cbwsdk-spinner svg circle{animation:1.9s ease-in-out infinite both -cbwsdk-spinner-circle;display:block;fill:rgba(0,0,0,0);stroke-dasharray:283;stroke-dashoffset:280;stroke-linecap:round;stroke-width:10px;transform-origin:50% 50%}@keyframes -cbwsdk-spinner-svg{0%{transform:rotateZ(0deg)}100%{transform:rotateZ(360deg)}}@keyframes -cbwsdk-spinner-circle{0%,25%{stroke-dashoffset:280;transform:rotate(0)}50%,75%{stroke-dashoffset:75;transform:rotate(45deg)}100%{stroke-dashoffset:280;transform:rotate(360deg)}}";var il=k&&k.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(tn,"__esModule",{value:!0});tn.Spinner=void 0;const Er=ue,ol=il(ds),al=t=>{var e;const r=(e=t.size)!==null&&e!==void 0?e:64,n=t.color||"#000";return(0,Er.h)("div",{class:"-cbwsdk-spinner"},(0,Er.h)("style",null,ol.default),(0,Er.h)("svg",{viewBox:"0 0 100 100",xmlns:"http://www.w3.org/2000/svg",style:{width:r,height:r}},(0,Er.h)("circle",{style:{cx:50,cy:50,r:45,stroke:n}})))};tn.Spinner=al;var hs={};Object.defineProperty(hs,"__esModule",{value:!0});hs.default=".-cbwsdk-css-reset .-cbwsdk-connect-content{height:430px;width:700px;border-radius:12px;padding:30px}.-cbwsdk-css-reset .-cbwsdk-connect-content.light{background:#fff}.-cbwsdk-css-reset .-cbwsdk-connect-content.dark{background:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-connect-content-header{display:flex;align-items:center;justify-content:space-between;margin:0 0 30px}.-cbwsdk-css-reset .-cbwsdk-connect-content-heading{font-style:normal;font-weight:500;font-size:28px;line-height:36px;margin:0}.-cbwsdk-css-reset .-cbwsdk-connect-content-heading.light{color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-connect-content-heading.dark{color:#fff}.-cbwsdk-css-reset .-cbwsdk-connect-content-layout{display:flex;flex-direction:row}.-cbwsdk-css-reset .-cbwsdk-connect-content-column-left{margin-right:30px;display:flex;flex-direction:column;justify-content:space-between}.-cbwsdk-css-reset .-cbwsdk-connect-content-column-right{flex:25%;margin-right:34px}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-wrapper{width:220px;height:220px;border-radius:12px;display:flex;justify-content:center;align-items:center;background:#fff}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-connecting{position:absolute;top:0;bottom:0;left:0;right:0;display:flex;flex-direction:column;align-items:center;justify-content:center}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-connecting.light{background-color:rgba(255,255,255,.95)}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-connecting.light>p{color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-connecting.dark{background-color:rgba(10,11,13,.9)}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-connecting.dark>p{color:#fff}.-cbwsdk-css-reset .-cbwsdk-connect-content-qr-connecting>p{font-size:12px;font-weight:bold;margin-top:16px}.-cbwsdk-css-reset .-cbwsdk-connect-content-update-app{border-radius:8px;font-size:14px;line-height:20px;padding:12px;width:339px}.-cbwsdk-css-reset .-cbwsdk-connect-content-update-app.light{background:#eef0f3;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-connect-content-update-app.dark{background:#1e2025;color:#8a919e}.-cbwsdk-css-reset .-cbwsdk-cancel-button{-webkit-appearance:none;border:none;background:none;cursor:pointer;padding:0;margin:0}.-cbwsdk-css-reset .-cbwsdk-cancel-button-x{position:relative;display:block;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-wallet-steps{padding:0 0 0 16px;margin:0;width:100%;list-style:decimal}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-item{list-style-type:decimal;display:list-item;font-style:normal;font-weight:400;font-size:16px;line-height:24px;margin-top:20px}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-item.light{color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-item.dark{color:#fff}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-item-wrapper{display:flex;align-items:center}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-pad-left{margin-left:6px}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-icon{display:flex;border-radius:50%;height:24px;width:24px}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-icon svg{margin:auto;display:block}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-icon.light{background:#0052ff}.-cbwsdk-css-reset .-cbwsdk-wallet-steps-icon.dark{background:#588af5}.-cbwsdk-css-reset .-cbwsdk-connect-item{align-items:center;display:flex;flex-direction:row;padding:16px 24px;gap:12px;cursor:pointer;border-radius:100px;font-weight:600}.-cbwsdk-css-reset .-cbwsdk-connect-item.light{background:#f5f8ff;color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-connect-item.dark{background:#001033;color:#588af5}.-cbwsdk-css-reset .-cbwsdk-connect-item-copy-wrapper{margin:0 4px 0 8px}.-cbwsdk-css-reset .-cbwsdk-connect-item-title{margin:0 0 0;font-size:16px;line-height:24px;font-weight:500}.-cbwsdk-css-reset .-cbwsdk-connect-item-description{font-weight:400;font-size:14px;line-height:20px;margin:0}";var Co=k&&k.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(At,"__esModule",{value:!0});At.CoinbaseWalletSteps=At.ConnectContent=void 0;const it=Co(Xt),j=ue,cl=S,ll=Pt,ul=Xr,dl=Kr,hl=Yr,fl=en,gl=tn,pl=Co(hs),Tn={title:"Coinbase Wallet app",description:"Connect with your self-custody wallet",steps:Ro},ml=t=>t==="light"?"#FFFFFF":"#0A0B0D";function bl(t){const{theme:e}=t,r=(0,cl.createQrUrl)(t.sessionId,t.sessionSecret,t.linkAPIUrl,t.isParentConnection,t.version,t.chainId),n=Tn.steps;return(0,j.h)("div",{"data-testid":"connect-content",className:(0,it.default)("-cbwsdk-connect-content",e)},(0,j.h)("style",null,pl.default),(0,j.h)("div",{className:"-cbwsdk-connect-content-header"},(0,j.h)("h2",{className:(0,it.default)("-cbwsdk-connect-content-heading",e)},"Scan to connect with our mobile app"),t.onCancel&&(0,j.h)("button",{type:"button",className:"-cbwsdk-cancel-button",onClick:t.onCancel},(0,j.h)(ul.CloseIcon,{fill:e==="light"?"#0A0B0D":"#FFFFFF"}))),(0,j.h)("div",{className:"-cbwsdk-connect-content-layout"},(0,j.h)("div",{className:"-cbwsdk-connect-content-column-left"},(0,j.h)(yl,{title:Tn.title,description:Tn.description,theme:e})),(0,j.h)("div",{className:"-cbwsdk-connect-content-column-right"},(0,j.h)("div",{className:"-cbwsdk-connect-content-qr-wrapper"},(0,j.h)(fl.QRCode,{content:r,width:200,height:200,fgColor:"#000",bgColor:"transparent"}),(0,j.h)("input",{type:"hidden",name:"cbw-cbwsdk-version",value:ll.LIB_VERSION}),(0,j.h)("input",{type:"hidden",value:r})),(0,j.h)(n,{theme:e}),!t.isConnected&&(0,j.h)("div",{"data-testid":"connecting-spinner",className:(0,it.default)("-cbwsdk-connect-content-qr-connecting",e)},(0,j.h)(gl.Spinner,{size:36,color:e==="dark"?"#FFF":"#000"}),(0,j.h)("p",null,"Connecting...")))))}At.ConnectContent=bl;function yl({title:t,description:e,theme:r}){return(0,j.h)("div",{className:(0,it.default)("-cbwsdk-connect-item",r)},(0,j.h)("div",null,(0,j.h)(dl.CoinbaseWalletRound,null)),(0,j.h)("div",{className:"-cbwsdk-connect-item-copy-wrapper"},(0,j.h)("h3",{className:"-cbwsdk-connect-item-title"},t),(0,j.h)("p",{className:"-cbwsdk-connect-item-description"},e)))}function Ro({theme:t}){return(0,j.h)("ol",{className:"-cbwsdk-wallet-steps"},(0,j.h)("li",{className:(0,it.default)("-cbwsdk-wallet-steps-item",t)},(0,j.h)("div",{className:"-cbwsdk-wallet-steps-item-wrapper"},"Open Coinbase Wallet app")),(0,j.h)("li",{className:(0,it.default)("-cbwsdk-wallet-steps-item",t)},(0,j.h)("div",{className:"-cbwsdk-wallet-steps-item-wrapper"},(0,j.h)("span",null,"Tap ",(0,j.h)("strong",null,"Scan")," "),(0,j.h)("span",{className:(0,it.default)("-cbwsdk-wallet-steps-pad-left","-cbwsdk-wallet-steps-icon",t)},(0,j.h)(hl.QRCodeIcon,{fill:ml(t)})))))}At.CoinbaseWalletSteps=Ro;var rn={},nn={};Object.defineProperty(nn,"__esModule",{value:!0});nn.ArrowLeftIcon=void 0;const ri=ue;function wl(t){return(0,ri.h)("svg",Object.assign({width:"16",height:"16",viewBox:"0 0 16 16",xmlns:"http://www.w3.org/2000/svg"},t),(0,ri.h)("path",{d:"M8.60675 0.155884L7.37816 1.28209L12.7723 7.16662H0V8.83328H12.6548L6.82149 14.6666L8 15.8451L15.8201 8.02501L8.60675 0.155884Z"}))}nn.ArrowLeftIcon=wl;var sn={};Object.defineProperty(sn,"__esModule",{value:!0});sn.LaptopIcon=void 0;const Ln=ue;function vl(t){return(0,Ln.h)("svg",Object.assign({width:"14",height:"14",viewBox:"0 0 14 14",xmlns:"http://www.w3.org/2000/svg"},t),(0,Ln.h)("path",{d:"M1.8001 2.2002H12.2001V9.40019H1.8001V2.2002ZM3.4001 3.8002V7.80019H10.6001V3.8002H3.4001Z"}),(0,Ln.h)("path",{d:"M13.4001 10.2002H0.600098C0.600098 11.0838 1.31644 11.8002 2.2001 11.8002H11.8001C12.6838 11.8002 13.4001 11.0838 13.4001 10.2002Z"}))}sn.LaptopIcon=vl;var on={};Object.defineProperty(on,"__esModule",{value:!0});on.SafeIcon=void 0;const ni=ue;function El(t){return(0,ni.h)("svg",Object.assign({width:"14",height:"14",viewBox:"0 0 14 14",xmlns:"http://www.w3.org/2000/svg"},t),(0,ni.h)("path",{"fill-rule":"evenodd","clip-rule":"evenodd",d:"M0.600098 0.600098V11.8001H13.4001V0.600098H0.600098ZM7.0001 9.2001C5.3441 9.2001 4.0001 7.8561 4.0001 6.2001C4.0001 4.5441 5.3441 3.2001 7.0001 3.2001C8.6561 3.2001 10.0001 4.5441 10.0001 6.2001C10.0001 7.8561 8.6561 9.2001 7.0001 9.2001ZM0.600098 12.6001H3.8001V13.4001H0.600098V12.6001ZM10.2001 12.6001H13.4001V13.4001H10.2001V12.6001ZM8.8001 6.2001C8.8001 7.19421 7.99421 8.0001 7.0001 8.0001C6.00598 8.0001 5.2001 7.19421 5.2001 6.2001C5.2001 5.20598 6.00598 4.4001 7.0001 4.4001C7.99421 4.4001 8.8001 5.20598 8.8001 6.2001Z"}))}on.SafeIcon=El;var fs={};Object.defineProperty(fs,"__esModule",{value:!0});fs.default=".-cbwsdk-css-reset .-cbwsdk-try-extension{display:flex;margin-top:12px;height:202px;width:700px;border-radius:12px;padding:30px}.-cbwsdk-css-reset .-cbwsdk-try-extension.light{background:#fff}.-cbwsdk-css-reset .-cbwsdk-try-extension.dark{background:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-try-extension-column-half{flex:50%}.-cbwsdk-css-reset .-cbwsdk-try-extension-heading{font-style:normal;font-weight:500;font-size:25px;line-height:32px;margin:0;max-width:204px}.-cbwsdk-css-reset .-cbwsdk-try-extension-heading.light{color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-try-extension-heading.dark{color:#fff}.-cbwsdk-css-reset .-cbwsdk-try-extension-cta{appearance:none;border:none;background:none;color:#0052ff;cursor:pointer;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-try-extension-cta.light{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-try-extension-cta.dark{color:#588af5}.-cbwsdk-css-reset .-cbwsdk-try-extension-cta-wrapper{display:flex;align-items:center;margin-top:12px}.-cbwsdk-css-reset .-cbwsdk-try-extension-cta-icon{display:block;margin-left:4px;height:14px}.-cbwsdk-css-reset .-cbwsdk-try-extension-list{display:flex;flex-direction:column;justify-content:center;align-items:center;margin:0;padding:0;list-style:none;height:100%}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item{display:flex;align-items:center;flex-flow:nowrap;margin-top:24px}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item:first-of-type{margin-top:0}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-icon-wrapper{display:block}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-icon{display:flex;height:32px;width:32px;border-radius:50%}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-icon svg{margin:auto;display:block}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-icon.light{background:#eef0f3}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-icon.dark{background:#1e2025}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-copy{display:block;font-weight:400;font-size:14px;line-height:20px;padding-left:12px}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-copy.light{color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-try-extension-list-item-copy.dark{color:#8a919e}";var ko=k&&k.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(rn,"__esModule",{value:!0});rn.TryExtensionContent=void 0;const Ze=ko(Xt),Z=ue,On=Fr,_l=nn,Sl=sn,Cl=on,Rl=ko(fs);function kl({theme:t}){const[e,r]=(0,On.useState)(!1),n=(0,On.useCallback)(()=>{window.open("https://api.wallet.coinbase.com/rpc/v2/desktop/chrome","_blank")},[]),s=(0,On.useCallback)(()=>{e?window.location.reload():(n(),r(!0))},[n,e]);return(0,Z.h)("div",{class:(0,Ze.default)("-cbwsdk-try-extension",t)},(0,Z.h)("style",null,Rl.default),(0,Z.h)("div",{class:"-cbwsdk-try-extension-column-half"},(0,Z.h)("h3",{class:(0,Ze.default)("-cbwsdk-try-extension-heading",t)},"Or try the Coinbase Wallet browser extension"),(0,Z.h)("div",{class:"-cbwsdk-try-extension-cta-wrapper"},(0,Z.h)("button",{class:(0,Ze.default)("-cbwsdk-try-extension-cta",t),onClick:s},e?"Refresh":"Install"),(0,Z.h)("div",null,!e&&(0,Z.h)(_l.ArrowLeftIcon,{class:"-cbwsdk-try-extension-cta-icon",fill:t==="light"?"#0052FF":"#588AF5"})))),(0,Z.h)("div",{class:"-cbwsdk-try-extension-column-half"},(0,Z.h)("ul",{class:"-cbwsdk-try-extension-list"},(0,Z.h)("li",{class:"-cbwsdk-try-extension-list-item"},(0,Z.h)("div",{class:"-cbwsdk-try-extension-list-item-icon-wrapper"},(0,Z.h)("span",{class:(0,Ze.default)("-cbwsdk-try-extension-list-item-icon",t)},(0,Z.h)(Sl.LaptopIcon,{fill:t==="light"?"#0A0B0D":"#FFFFFF"}))),(0,Z.h)("div",{class:(0,Ze.default)("-cbwsdk-try-extension-list-item-copy",t)},"Connect with dapps with just one click on your desktop browser")),(0,Z.h)("li",{class:"-cbwsdk-try-extension-list-item"},(0,Z.h)("div",{class:"-cbwsdk-try-extension-list-item-icon-wrapper"},(0,Z.h)("span",{class:(0,Ze.default)("-cbwsdk-try-extension-list-item-icon",t)},(0,Z.h)(Cl.SafeIcon,{fill:t==="light"?"#0A0B0D":"#FFFFFF"}))),(0,Z.h)("div",{class:(0,Ze.default)("-cbwsdk-try-extension-list-item-copy",t)},"Add an additional layer of security by using a supported Ledger hardware wallet")))))}rn.TryExtensionContent=kl;var gs={};Object.defineProperty(gs,"__esModule",{value:!0});gs.default=".-cbwsdk-css-reset .-cbwsdk-connect-dialog{z-index:2147483647;position:fixed;top:0;left:0;right:0;bottom:0;display:flex;align-items:center;justify-content:center}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-backdrop{z-index:2147483647;position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-backdrop.light{background-color:rgba(0,0,0,.5)}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-backdrop.dark{background-color:rgba(50,53,61,.4)}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-box{display:flex;position:relative;flex-direction:column;transform:scale(1);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-box-hidden{opacity:0;transform:scale(0.85)}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-container{display:block}.-cbwsdk-css-reset .-cbwsdk-connect-dialog-container-hidden{display:none}";var Io=k&&k.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Qr,"__esModule",{value:!0});Qr.ConnectDialog=void 0;const Pn=Io(Xt),Qe=ue,$n=Fr,Il=At,Al=rn,Nl=Io(gs),Ml=t=>{const{isOpen:e,darkMode:r}=t,[n,s]=(0,$n.useState)(!e),[i,o]=(0,$n.useState)(!e);(0,$n.useEffect)(()=>{const l=[window.setTimeout(()=>{o(!e)},10)];return e?s(!1):l.push(window.setTimeout(()=>{s(!0)},360)),()=>{l.forEach(window.clearTimeout)}},[e]);const a=r?"dark":"light";return(0,Qe.h)("div",{class:(0,Pn.default)("-cbwsdk-connect-dialog-container",n&&"-cbwsdk-connect-dialog-container-hidden")},(0,Qe.h)("style",null,Nl.default),(0,Qe.h)("div",{class:(0,Pn.default)("-cbwsdk-connect-dialog-backdrop",a,i&&"-cbwsdk-connect-dialog-backdrop-hidden")}),(0,Qe.h)("div",{class:"-cbwsdk-connect-dialog"},(0,Qe.h)("div",{class:(0,Pn.default)("-cbwsdk-connect-dialog-box",i&&"-cbwsdk-connect-dialog-box-hidden")},t.connectDisabled?null:(0,Qe.h)(Il.ConnectContent,{theme:a,version:t.version,sessionId:t.sessionId,sessionSecret:t.sessionSecret,linkAPIUrl:t.linkAPIUrl,isConnected:t.isConnected,isParentConnection:t.isParentConnection,chainId:t.chainId,onCancel:t.onCancel}),(0,Qe.h)(Al.TryExtensionContent,{theme:a}))))};Qr.ConnectDialog=Ml;Object.defineProperty(Zr,"__esModule",{value:!0});Zr.LinkFlow=void 0;const xn=ue,Tl=Qr;class Ll{constructor(e){this.connected=!1,this.chainId=1,this.isOpen=!1,this.onCancel=null,this.root=null,this.connectDisabled=!1,this.darkMode=e.darkMode,this.version=e.version,this.sessionId=e.sessionId,this.sessionSecret=e.sessionSecret,this.linkAPIUrl=e.linkAPIUrl,this.isParentConnection=e.isParentConnection}attach(e){this.root=document.createElement("div"),this.root.className="-cbwsdk-link-flow-root",e.appendChild(this.root),this.render()}setConnected(e){this.connected!==e&&(this.connected=e,this.render())}setChainId(e){this.chainId!==e&&(this.chainId=e,this.render())}detach(){var e;this.root&&((0,xn.render)(null,this.root),(e=this.root.parentElement)===null||e===void 0||e.removeChild(this.root))}setConnectDisabled(e){this.connectDisabled=e}open(e){this.isOpen=!0,this.onCancel=e.onCancel,this.render()}close(){this.isOpen=!1,this.onCancel=null,this.render()}render(){this.root&&(0,xn.render)((0,xn.h)(Tl.ConnectDialog,{darkMode:this.darkMode,version:this.version,sessionId:this.sessionId,sessionSecret:this.sessionSecret,linkAPIUrl:this.linkAPIUrl,isOpen:this.isOpen,isConnected:this.connected,isParentConnection:this.isParentConnection,chainId:this.chainId,onCancel:this.onCancel,connectDisabled:this.connectDisabled}),this.root)}}Zr.LinkFlow=Ll;var ps={},ms={};Object.defineProperty(ms,"__esModule",{value:!0});ms.default=".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}";(function(t){var e=k&&k.__importDefault||function(d){return d&&d.__esModule?d:{default:d}};Object.defineProperty(t,"__esModule",{value:!0}),t.SnackbarInstance=t.SnackbarContainer=t.Snackbar=void 0;const r=e(Xt),n=ue,s=Fr,i=e(ms),o="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",a="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=";class l{constructor(h){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=h.darkMode}attach(h){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",h.appendChild(this.root),this.render()}presentItem(h){const f=this.nextItemKey++;return this.items.set(f,h),this.render(),()=>{this.items.delete(f),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&(0,n.render)((0,n.h)("div",null,(0,n.h)(t.SnackbarContainer,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([h,f])=>(0,n.h)(t.SnackbarInstance,Object.assign({},f,{key:h}))))),this.root)}}t.Snackbar=l;const c=d=>(0,n.h)("div",{class:(0,r.default)("-cbwsdk-snackbar-container")},(0,n.h)("style",null,i.default),(0,n.h)("div",{class:"-cbwsdk-snackbar"},d.children));t.SnackbarContainer=c;const u=({autoExpand:d,message:h,menuItems:f})=>{const[g,b]=(0,s.useState)(!0),[p,_]=(0,s.useState)(d??!1);(0,s.useEffect)(()=>{const m=[window.setTimeout(()=>{b(!1)},1),window.setTimeout(()=>{_(!0)},1e4)];return()=>{m.forEach(window.clearTimeout)}});const y=()=>{_(!p)};return(0,n.h)("div",{class:(0,r.default)("-cbwsdk-snackbar-instance",g&&"-cbwsdk-snackbar-instance-hidden",p&&"-cbwsdk-snackbar-instance-expanded")},(0,n.h)("div",{class:"-cbwsdk-snackbar-instance-header",onClick:y},(0,n.h)("img",{src:o,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",(0,n.h)("div",{class:"-cbwsdk-snackbar-instance-header-message"},h),(0,n.h)("div",{class:"-gear-container"},!p&&(0,n.h)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,n.h)("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),(0,n.h)("img",{src:a,class:"-gear-icon",title:"Expand"}))),f&&f.length>0&&(0,n.h)("div",{class:"-cbwsdk-snackbar-instance-menu"},f.map((m,$)=>(0,n.h)("div",{class:(0,r.default)("-cbwsdk-snackbar-instance-menu-item",m.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:m.onClick,key:$},(0,n.h)("svg",{width:m.svgWidth,height:m.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,n.h)("path",{"fill-rule":m.defaultFillRule,"clip-rule":m.defaultClipRule,d:m.path,fill:"#AAAAAA"})),(0,n.h)("span",{class:(0,r.default)("-cbwsdk-snackbar-instance-menu-item-info",m.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},m.info)))))};t.SnackbarInstance=u})(ps);Object.defineProperty(sr,"__esModule",{value:!0});sr.WalletLinkRelayUI=void 0;const Ol=ir,Pl=Zr,$l=ps;class xl{constructor(e){this.standalone=null,this.attached=!1,this.snackbar=new $l.Snackbar({darkMode:e.darkMode}),this.linkFlow=new Pl.LinkFlow({darkMode:e.darkMode,version:e.version,sessionId:e.session.id,sessionSecret:e.session.secret,linkAPIUrl:e.linkAPIUrl,isParentConnection:!1})}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const e=document.documentElement,r=document.createElement("div");r.className="-cbwsdk-css-reset",e.appendChild(r),this.linkFlow.attach(r),this.snackbar.attach(r),this.attached=!0,(0,Ol.injectCssReset)()}setConnected(e){this.linkFlow.setConnected(e)}setChainId(e){this.linkFlow.setChainId(e)}setConnectDisabled(e){this.linkFlow.setConnectDisabled(e)}addEthereumChain(){}watchAsset(){}switchEthereumChain(){}requestEthereumAccounts(e){this.linkFlow.open({onCancel:e.onCancel})}hideRequestEthereumAccounts(){this.linkFlow.close()}signEthereumMessage(){}signEthereumTransaction(){}submitEthereumTransaction(){}ethereumAddressFromSignedMessage(){}showConnecting(e){let r;return e.isUnlinkedErrorState?r={autoExpand:!0,message:"Connection lost",menuItems:[{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]}:r={message:"Confirm on phone",menuItems:[{isRed:!0,info:"Cancel transaction",svgWidth:"11",svgHeight:"11",path:"M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z",defaultFillRule:"inherit",defaultClipRule:"inherit",onClick:e.onCancel},{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]},this.snackbar.presentItem(r)}reloadUI(){document.location.reload()}inlineAccountsResponse(){return!1}inlineAddEthereumChain(){return!1}inlineWatchAsset(){return!1}inlineSwitchEthereumChain(){return!1}setStandalone(e){this.standalone=e}isStandalone(){var e;return(e=this.standalone)!==null&&e!==void 0?e:!1}}sr.WalletLinkRelayUI=xl;Object.defineProperty(nr,"__esModule",{value:!0});nr.WalletLinkRelay=void 0;const pt=Kt,jl=Q,V=S,Xe=$t,si=Ee,We=xt,Fl=Jr,Ke=Ot,Bl=sr;class De extends si.RelayAbstract{constructor(e){var r;super(),this.accountsCallback=null,this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.chainCallback=null,this.dappDefaultChain=1,this.appName="",this.appLogoUrl=null,this.linkedUpdated=o=>{var a;this.isLinked=o;const l=this.storage.getItem(si.LOCAL_STORAGE_ADDRESSES_KEY);if(o&&(this.session.linked=o),this.isUnlinkedErrorState=!1,l){const c=l.split(" "),u=this.storage.getItem("IsStandaloneSigning")==="true";if(c[0]!==""&&!o&&this.session.linked&&!u){this.isUnlinkedErrorState=!0;const d=this.getSessionIdHash();(a=this.diagnostic)===null||a===void 0||a.log(Xe.EVENTS.UNLINKED_ERROR_STATE,{sessionIdHash:d})}}},this.metadataUpdated=(o,a)=>{this.storage.setItem(o,a)},this.chainUpdated=(o,a)=>{this.chainCallbackParams.chainId===o&&this.chainCallbackParams.jsonRpcUrl===a||(this.chainCallbackParams={chainId:o,jsonRpcUrl:a},this.chainCallback&&this.chainCallback(o,a))},this.accountUpdated=o=>{this.accountsCallback&&this.accountsCallback([o]),De.accountRequestCallbackIds.size>0&&(Array.from(De.accountRequestCallbackIds.values()).forEach(a=>{const l={type:"WEB3_RESPONSE",id:a,response:{method:"requestEthereumAccounts",result:[o]}};this.invokeCallback(Object.assign(Object.assign({},l),{id:a}))}),De.accountRequestCallbackIds.clear())},this.connectedUpdated=o=>{this.ui.setConnected(o)},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=e.linkAPIUrl,this.storage=e.storage,this.options=e;const{session:n,ui:s,connection:i}=this.subscribe();this._session=n,this.connection=i,this.relayEventManager=e.relayEventManager,this.diagnostic=e.diagnosticLogger,this._reloadOnDisconnect=(r=e.reloadOnDisconnect)!==null&&r!==void 0?r:!0,this.ui=s}subscribe(){const e=We.Session.load(this.storage)||new We.Session(this.storage).save(),{linkAPIUrl:r,diagnostic:n}=this,s=new Fl.WalletLinkConnection({session:e,linkAPIUrl:r,diagnostic:n,listener:this}),{version:i,darkMode:o}=this.options,a=this.options.uiConstructor({linkAPIUrl:r,version:i,darkMode:o,session:e});return s.connect(),{session:e,ui:a,connection:s}}attachUI(){this.ui.attach()}resetAndReload(){Promise.race([this.connection.setSessionMetadata("__destroyed","1"),new Promise(e=>setTimeout(()=>e(null),1e3))]).then(()=>{var e,r;const n=this.ui.isStandalone();(e=this.diagnostic)===null||e===void 0||e.log(Xe.EVENTS.SESSION_STATE_CHANGE,{method:"relay::resetAndReload",sessionMetadataChange:"__destroyed, 1",sessionIdHash:this.getSessionIdHash()}),this.connection.destroy();const s=We.Session.load(this.storage);if((s==null?void 0:s.id)===this._session.id?this.storage.clear():s&&((r=this.diagnostic)===null||r===void 0||r.log(Xe.EVENTS.SKIPPED_CLEARING_SESSION,{sessionIdHash:this.getSessionIdHash(),storedSessionIdHash:We.Session.hash(s.id)})),this._reloadOnDisconnect){this.ui.reloadUI();return}this.accountsCallback&&this.accountsCallback([],!0);const{session:i,ui:o,connection:a}=this.subscribe();this._session=i,this.connection=a,this.ui=o,n&&this.ui.setStandalone&&this.ui.setStandalone(!0),this.options.headlessMode||this.attachUI()}).catch(e=>{var r;(r=this.diagnostic)===null||r===void 0||r.log(Xe.EVENTS.FAILURE,{method:"relay::resetAndReload",message:`failed to reset and reload with ${e}`,sessionIdHash:this.getSessionIdHash()})})}setAppInfo(e,r){this.appName=e,this.appLogoUrl=r}getStorageItem(e){return this.storage.getItem(e)}get session(){return this._session}setStorageItem(e,r){this.storage.setItem(e,r)}signEthereumMessage(e,r,n,s){return this.sendRequest({method:"signEthereumMessage",params:{message:(0,V.hexStringFromBuffer)(e,!0),address:r,addPrefix:n,typedDataJson:s||null}})}ethereumAddressFromSignedMessage(e,r,n){return this.sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:(0,V.hexStringFromBuffer)(e,!0),signature:(0,V.hexStringFromBuffer)(r,!0),addPrefix:n}})}signEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:(0,V.bigIntStringFromBN)(e.weiValue),data:(0,V.hexStringFromBuffer)(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?(0,V.bigIntStringFromBN)(e.gasPriceInWei):null,maxFeePerGas:e.gasPriceInWei?(0,V.bigIntStringFromBN)(e.gasPriceInWei):null,maxPriorityFeePerGas:e.gasPriceInWei?(0,V.bigIntStringFromBN)(e.gasPriceInWei):null,gasLimit:e.gasLimit?(0,V.bigIntStringFromBN)(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:(0,V.bigIntStringFromBN)(e.weiValue),data:(0,V.hexStringFromBuffer)(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?(0,V.bigIntStringFromBN)(e.gasPriceInWei):null,maxFeePerGas:e.maxFeePerGas?(0,V.bigIntStringFromBN)(e.maxFeePerGas):null,maxPriorityFeePerGas:e.maxPriorityFeePerGas?(0,V.bigIntStringFromBN)(e.maxPriorityFeePerGas):null,gasLimit:e.gasLimit?(0,V.bigIntStringFromBN)(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!0}})}submitEthereumTransaction(e,r){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:(0,V.hexStringFromBuffer)(e,!0),chainId:r}})}scanQRCode(e){return this.sendRequest({method:"scanQRCode",params:{regExp:e}})}getQRCodeUrl(){return(0,V.createQrUrl)(this._session.id,this._session.secret,this.linkAPIUrl,!1,this.options.version,this.dappDefaultChain)}genericRequest(e,r){return this.sendRequest({method:"generic",params:{action:r,data:e}})}sendGenericMessage(e){return this.sendRequest(e)}sendRequest(e){let r=null;const n=(0,V.randomBytesHex)(8),s=o=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,e.method,o),r==null||r()};return{promise:new Promise((o,a)=>{this.ui.isStandalone()||(r=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:s,onResetConnection:this.resetAndReload})),this.relayEventManager.callbacks.set(n,l=>{if(r==null||r(),(0,Ke.isErrorResponse)(l))return a(new Error(l.errorMessage));o(l)}),this.ui.isStandalone()?this.sendRequestStandalone(n,e):this.publishWeb3RequestEvent(n,e)}),cancel:s}}setConnectDisabled(e){this.ui.setConnectDisabled(e)}setAccountsCallback(e){this.accountsCallback=e}setChainCallback(e){this.chainCallback=e}setDappDefaultChainCallback(e){this.dappDefaultChain=e,this.ui instanceof Bl.WalletLinkRelayUI&&this.ui.setChainId(e)}publishWeb3RequestEvent(e,r){var n;const s={type:"WEB3_REQUEST",id:e,request:r},i=We.Session.load(this.storage);(n=this.diagnostic)===null||n===void 0||n.log(Xe.EVENTS.WEB3_REQUEST,{eventId:s.id,method:`relay::${r.method}`,sessionIdHash:this.getSessionIdHash(),storedSessionIdHash:i?We.Session.hash(i.id):"",isSessionMismatched:((i==null?void 0:i.id)!==this._session.id).toString()}),this.publishEvent("Web3Request",s,!0).then(o=>{var a;(a=this.diagnostic)===null||a===void 0||a.log(Xe.EVENTS.WEB3_REQUEST_PUBLISHED,{eventId:s.id,method:`relay::${r.method}`,sessionIdHash:this.getSessionIdHash(),storedSessionIdHash:i?We.Session.hash(i.id):"",isSessionMismatched:((i==null?void 0:i.id)!==this._session.id).toString()})}).catch(o=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:s.id,response:{method:r.method,errorMessage:o.message}})})}publishWeb3RequestCanceledEvent(e){const r={type:"WEB3_REQUEST_CANCELED",id:e};this.publishEvent("Web3RequestCanceled",r,!1).then()}publishEvent(e,r,n){return this.connection.publishEvent(e,r,n)}handleWeb3ResponseMessage(e){var r;const{response:n}=e;if((r=this.diagnostic)===null||r===void 0||r.log(Xe.EVENTS.WEB3_RESPONSE,{eventId:e.id,method:`relay::${n.method}`,sessionIdHash:this.getSessionIdHash()}),n.method==="requestEthereumAccounts"){De.accountRequestCallbackIds.forEach(s=>this.invokeCallback(Object.assign(Object.assign({},e),{id:s}))),De.accountRequestCallbackIds.clear();return}this.invokeCallback(e)}handleErrorResponse(e,r,n,s){var i;const o=(i=n==null?void 0:n.message)!==null&&i!==void 0?i:(0,pt.getMessageFromCode)(s);this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:e,response:{method:r,errorMessage:o,errorCode:s}})}invokeCallback(e){const r=this.relayEventManager.callbacks.get(e.id);r&&(r(e.response),this.relayEventManager.callbacks.delete(e.id))}requestEthereumAccounts(){const e={method:"requestEthereumAccounts",params:{appName:this.appName,appLogoUrl:this.appLogoUrl||null}},r=(0,V.randomBytesHex)(8),n=i=>{this.publishWeb3RequestCanceledEvent(r),this.handleErrorResponse(r,e.method,i)};return{promise:new Promise((i,o)=>{if(this.relayEventManager.callbacks.set(r,a=>{if(this.ui.hideRequestEthereumAccounts(),(0,Ke.isErrorResponse)(a))return o(new Error(a.errorMessage));i(a)}),this.ui.inlineAccountsResponse()){const a=l=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:r,response:{method:"requestEthereumAccounts",result:l}})};this.ui.requestEthereumAccounts({onCancel:n,onAccounts:a})}else{const a=pt.standardErrors.provider.userRejectedRequest("User denied account authorization");this.ui.requestEthereumAccounts({onCancel:()=>n(a)})}De.accountRequestCallbackIds.add(r),!this.ui.inlineAccountsResponse()&&!this.ui.isStandalone()&&this.publishWeb3RequestEvent(r,e)}),cancel:n}}selectProvider(e){const r={method:"selectProvider",params:{providerOptions:e}},n=(0,V.randomBytesHex)(8),s=o=>{this.publishWeb3RequestCanceledEvent(n),this.handleErrorResponse(n,r.method,o)},i=new Promise((o,a)=>{this.relayEventManager.callbacks.set(n,u=>{if((0,Ke.isErrorResponse)(u))return a(new Error(u.errorMessage));o(u)});const l=u=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:n,response:{method:"selectProvider",result:jl.ProviderType.Unselected}})},c=u=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:n,response:{method:"selectProvider",result:u}})};this.ui.selectProvider&&this.ui.selectProvider({onApprove:c,onCancel:l,providerOptions:e})});return{cancel:s,promise:i}}watchAsset(e,r,n,s,i,o){const a={method:"watchAsset",params:{type:e,options:{address:r,symbol:n,decimals:s,image:i},chainId:o}};let l=null;const c=(0,V.randomBytesHex)(8),u=h=>{this.publishWeb3RequestCanceledEvent(c),this.handleErrorResponse(c,a.method,h),l==null||l()};this.ui.inlineWatchAsset()||(l=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:u,onResetConnection:this.resetAndReload}));const d=new Promise((h,f)=>{this.relayEventManager.callbacks.set(c,p=>{if(l==null||l(),(0,Ke.isErrorResponse)(p))return f(new Error(p.errorMessage));h(p)});const g=p=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:c,response:{method:"watchAsset",result:!1}})},b=()=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:c,response:{method:"watchAsset",result:!0}})};this.ui.inlineWatchAsset()&&this.ui.watchAsset({onApprove:b,onCancel:g,type:e,address:r,symbol:n,decimals:s,image:i,chainId:o}),!this.ui.inlineWatchAsset()&&!this.ui.isStandalone()&&this.publishWeb3RequestEvent(c,a)});return{cancel:u,promise:d}}addEthereumChain(e,r,n,s,i,o){const a={method:"addEthereumChain",params:{chainId:e,rpcUrls:r,blockExplorerUrls:s,chainName:i,iconUrls:n,nativeCurrency:o}};let l=null;const c=(0,V.randomBytesHex)(8),u=h=>{this.publishWeb3RequestCanceledEvent(c),this.handleErrorResponse(c,a.method,h),l==null||l()};return this.ui.inlineAddEthereumChain(e)||(l=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:u,onResetConnection:this.resetAndReload})),{promise:new Promise((h,f)=>{this.relayEventManager.callbacks.set(c,p=>{if(l==null||l(),(0,Ke.isErrorResponse)(p))return f(new Error(p.errorMessage));h(p)});const g=p=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:c,response:{method:"addEthereumChain",result:{isApproved:!1,rpcUrl:""}}})},b=p=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:c,response:{method:"addEthereumChain",result:{isApproved:!0,rpcUrl:p}}})};this.ui.inlineAddEthereumChain(e)&&this.ui.addEthereumChain({onCancel:g,onApprove:b,chainId:a.params.chainId,rpcUrls:a.params.rpcUrls,blockExplorerUrls:a.params.blockExplorerUrls,chainName:a.params.chainName,iconUrls:a.params.iconUrls,nativeCurrency:a.params.nativeCurrency}),!this.ui.inlineAddEthereumChain(e)&&!this.ui.isStandalone()&&this.publishWeb3RequestEvent(c,a)}),cancel:u}}switchEthereumChain(e,r){const n={method:"switchEthereumChain",params:Object.assign({chainId:e},{address:r})},s=(0,V.randomBytesHex)(8),i=a=>{this.publishWeb3RequestCanceledEvent(s),this.handleErrorResponse(s,n.method,a)};return{promise:new Promise((a,l)=>{this.relayEventManager.callbacks.set(s,d=>{if((0,Ke.isErrorResponse)(d)&&d.errorCode)return l(pt.standardErrors.provider.custom({code:d.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if((0,Ke.isErrorResponse)(d))return l(new Error(d.errorMessage));a(d)});const c=d=>{var h;if(d){const f=(h=(0,pt.getErrorCode)(d))!==null&&h!==void 0?h:pt.standardErrorCodes.provider.unsupportedChain;this.handleErrorResponse(s,"switchEthereumChain",d instanceof Error?d:pt.standardErrors.provider.unsupportedChain(e),f)}else this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:s,response:{method:"switchEthereumChain",result:{isApproved:!1,rpcUrl:""}}})},u=d=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:s,response:{method:"switchEthereumChain",result:{isApproved:!0,rpcUrl:d}}})};this.ui.switchEthereumChain({onCancel:c,onApprove:u,chainId:n.params.chainId,address:n.params.address}),!this.ui.inlineSwitchEthereumChain()&&!this.ui.isStandalone()&&this.publishWeb3RequestEvent(s,n)}),cancel:i}}inlineAddEthereumChain(e){return this.ui.inlineAddEthereumChain(e)}getSessionIdHash(){return We.Session.hash(this._session.id)}sendRequestStandalone(e,r){const n=i=>{this.handleErrorResponse(e,r.method,i)},s=i=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:e,response:i})};switch(r.method){case"signEthereumMessage":this.ui.signEthereumMessage({request:r,onSuccess:s,onCancel:n});break;case"signEthereumTransaction":this.ui.signEthereumTransaction({request:r,onSuccess:s,onCancel:n});break;case"submitEthereumTransaction":this.ui.submitEthereumTransaction({request:r,onSuccess:s,onCancel:n});break;case"ethereumAddressFromSignedMessage":this.ui.ethereumAddressFromSignedMessage({request:r,onSuccess:s});break;default:n();break}}}nr.WalletLinkRelay=De;De.accountRequestCallbackIds=new Set;var or={},an={},Ao={};(function(t){var e=k&&k.__createBinding||(Object.create?function(n,s,i,o){o===void 0&&(o=i);var a=Object.getOwnPropertyDescriptor(s,i);(!a||("get"in a?!s.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return s[i]}}),Object.defineProperty(n,o,a)}:function(n,s,i,o){o===void 0&&(o=i),n[o]=s[i]}),r=k&&k.__exportStar||function(n,s){for(var i in n)i!=="default"&&!Object.prototype.hasOwnProperty.call(s,i)&&e(s,n,i)};Object.defineProperty(t,"__esModule",{value:!0}),r(ps,t)})(Ao);var bs={};Object.defineProperty(bs,"__esModule",{value:!0});bs.default=".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}";var No=k&&k.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(an,"__esModule",{value:!0});an.RedirectDialog=void 0;const Dl=No(Xt),Oe=ue,Hl=ir,Ul=Ao,Vl=No(bs);class Wl{constructor(){this.root=null}attach(){const e=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",e.appendChild(this.root),(0,Hl.injectCssReset)()}present(e){this.render(e)}clear(){this.render(null)}render(e){this.root&&((0,Oe.render)(null,this.root),e&&(0,Oe.render)((0,Oe.h)(zl,Object.assign({},e,{onDismiss:()=>{this.clear()}})),this.root))}}an.RedirectDialog=Wl;const zl=({title:t,buttonText:e,darkMode:r,onButtonClick:n,onDismiss:s})=>{const i=r?"dark":"light";return(0,Oe.h)(Ul.SnackbarContainer,{darkMode:r},(0,Oe.h)("div",{class:"-cbwsdk-redirect-dialog"},(0,Oe.h)("style",null,Vl.default),(0,Oe.h)("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:s}),(0,Oe.h)("div",{class:(0,Dl.default)("-cbwsdk-redirect-dialog-box",i)},(0,Oe.h)("p",null,t),(0,Oe.h)("button",{onClick:n},e))))};Object.defineProperty(or,"__esModule",{value:!0});or.MobileRelayUI=void 0;const Jl=an;class ql{constructor(e){this.attached=!1,this.darkMode=!1,this.redirectDialog=new Jl.RedirectDialog,this.darkMode=e.darkMode}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}setConnected(e){}redirectToCoinbaseWallet(e){const r=new URL("https://go.cb-w.com/walletlink");r.searchParams.append("redirect_url",window.location.href),e&&r.searchParams.append("wl_url",e);const n=document.createElement("a");n.target="cbw-opener",n.href=r.href,n.rel="noreferrer noopener",n.click()}openCoinbaseWalletDeeplink(e){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",darkMode:this.darkMode,onButtonClick:()=>{this.redirectToCoinbaseWallet(e)}}),setTimeout(()=>{this.redirectToCoinbaseWallet(e)},99)}showConnecting(e){return()=>{this.redirectDialog.clear()}}hideRequestEthereumAccounts(){this.redirectDialog.clear()}requestEthereumAccounts(){}addEthereumChain(){}watchAsset(){}selectProvider(){}switchEthereumChain(){}signEthereumMessage(){}signEthereumTransaction(){}submitEthereumTransaction(){}ethereumAddressFromSignedMessage(){}reloadUI(){}setStandalone(){}setConnectDisabled(){}inlineAccountsResponse(){return!1}inlineAddEthereumChain(){return!1}inlineWatchAsset(){return!1}inlineSwitchEthereumChain(){return!1}isStandalone(){return!1}}or.MobileRelayUI=ql;Object.defineProperty(rr,"__esModule",{value:!0});rr.MobileRelay=void 0;const Gl=S,Zl=nr,Ql=or;class Xl extends Zl.WalletLinkRelay{constructor(e){var r;super(e),this._enableMobileWalletLink=(r=e.enableMobileWalletLink)!==null&&r!==void 0?r:!1}requestEthereumAccounts(){return this._enableMobileWalletLink?super.requestEthereumAccounts():{promise:new Promise(()=>{const e=(0,Gl.getLocation)();e.href=`https://go.cb-w.com/dapp?cb_url=${encodeURIComponent(e.href)}`}),cancel:()=>{}}}publishWeb3RequestEvent(e,r){if(super.publishWeb3RequestEvent(e,r),!(this._enableMobileWalletLink&&this.ui instanceof Ql.MobileRelayUI))return;let n=!1;switch(r.method){case"requestEthereumAccounts":case"connectAndSignIn":n=!0,this.ui.openCoinbaseWalletDeeplink(this.getQRCodeUrl());break;case"switchEthereumChain":return;default:n=!0,this.ui.openCoinbaseWalletDeeplink();break}n&&window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{this.connection.checkUnseenEvents()},{once:!0})},{once:!0})}handleWeb3ResponseMessage(e){super.handleWeb3ResponseMessage(e)}connectAndSignIn(e){if(!this._enableMobileWalletLink)throw new Error("connectAndSignIn is supported only when enableMobileWalletLink is on");return this.sendRequest({method:"connectAndSignIn",params:{appName:this.appName,appLogoUrl:this.appLogoUrl,domain:window.location.hostname,aud:window.location.href,version:"1",type:"eip4361",nonce:e.nonce,iat:new Date().toISOString(),chainId:`eip155:${this.dappDefaultChain}`,statement:e.statement,resources:e.resources}})}}rr.MobileRelay=Xl;const Kl=cc,Yl=jr;function Mo(t){return B.allocUnsafe(t).fill(0)}function To(t,e,r){const n=Mo(e);return t=cn(t),r?t.length"u")throw new Error("Not an array?");if(r=xo(t),r!=="dynamic"&&r!==0&&e.length>r)throw new Error("Elements exceed array size: "+r);s=[],t=t.slice(0,t.lastIndexOf("[")),typeof e=="string"&&(e=JSON.parse(e));for(i in e)s.push(Le(t,e[i]));if(r==="dynamic"){var o=Le("uint256",e.length);s.unshift(o)}return B.concat(s)}else{if(t==="bytes")return e=new B(e),s=B.concat([Le("uint256",e.length),e]),e.length%32!==0&&(s=B.concat([s,ot.zeros(32-e.length%32)])),s;if(t.startsWith("bytes")){if(r=_t(t),r<1||r>32)throw new Error("Invalid bytes width: "+r);return ot.setLengthRight(e,32)}else if(t.startsWith("uint")){if(r=_t(t),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);if(n=Ye(e),n.bitLength()>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+n.bitLength());if(n<0)throw new Error("Supplied uint is negative");return n.toArrayLike(B,"be",32)}else if(t.startsWith("int")){if(r=_t(t),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);if(n=Ye(e),n.bitLength()>r)throw new Error("Supplied int exceeds width: "+r+" vs "+n.bitLength());return n.toTwos(256).toArrayLike(B,"be",32)}else if(t.startsWith("ufixed")){if(r=ii(t),n=Ye(e),n<0)throw new Error("Supplied ufixed is negative");return Le("uint256",n.mul(new rt(2).pow(new rt(r[1]))))}else if(t.startsWith("fixed"))return r=ii(t),Le("int256",Ye(e).mul(new rt(2).pow(new rt(r[1]))))}throw new Error("Unsupported or invalid type: "+t)}function su(t){return t==="string"||t==="bytes"||xo(t)==="dynamic"}function iu(t){return t.lastIndexOf("]")===t.length-1}function ou(t,e){var r=[],n=[],s=32*t.length;for(var i in t){var o=$o(t[i]),a=e[i],l=Le(o,a);su(o)?(r.push(Le("uint256",s)),n.push(l),s+=l.length):r.push(l)}return B.concat(r.concat(n))}function jo(t,e){if(t.length!==e.length)throw new Error("Number of types are not matching the values");for(var r,n,s=[],i=0;i32)throw new Error("Invalid bytes width: "+r);s.push(ot.setLengthRight(a,r))}else if(o.startsWith("uint")){if(r=_t(o),r%8||r<8||r>256)throw new Error("Invalid uint width: "+r);if(n=Ye(a),n.bitLength()>r)throw new Error("Supplied uint exceeds width: "+r+" vs "+n.bitLength());s.push(n.toArrayLike(B,"be",r/8))}else if(o.startsWith("int")){if(r=_t(o),r%8||r<8||r>256)throw new Error("Invalid int width: "+r);if(n=Ye(a),n.bitLength()>r)throw new Error("Supplied int exceeds width: "+r+" vs "+n.bitLength());s.push(n.toTwos(r).toArrayLike(B,"be",r/8))}else throw new Error("Unsupported or invalid type: "+o)}return B.concat(s)}function au(t,e){return ot.keccak(jo(t,e))}var cu={rawEncode:ou,solidityPack:jo,soliditySHA3:au};const Re=Po,Jt=cu,Fo={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]},jn={encodeData(t,e,r,n=!0){const s=["bytes32"],i=[this.hashType(t,r)];if(n){const o=(a,l,c)=>{if(r[l]!==void 0)return["bytes32",c==null?"0x0000000000000000000000000000000000000000000000000000000000000000":Re.keccak(this.encodeData(l,c,r,n))];if(c===void 0)throw new Error(`missing value for field ${a} of type ${l}`);if(l==="bytes")return["bytes32",Re.keccak(c)];if(l==="string")return typeof c=="string"&&(c=B.from(c,"utf8")),["bytes32",Re.keccak(c)];if(l.lastIndexOf("]")===l.length-1){const u=l.slice(0,l.lastIndexOf("[")),d=c.map(h=>o(a,u,h));return["bytes32",Re.keccak(Jt.rawEncode(d.map(([h])=>h),d.map(([,h])=>h)))]}return[l,c]};for(const a of r[t]){const[l,c]=o(a.name,a.type,e[a.name]);s.push(l),i.push(c)}}else for(const o of r[t]){let a=e[o.name];if(a!==void 0)if(o.type==="bytes")s.push("bytes32"),a=Re.keccak(a),i.push(a);else if(o.type==="string")s.push("bytes32"),typeof a=="string"&&(a=B.from(a,"utf8")),a=Re.keccak(a),i.push(a);else if(r[o.type]!==void 0)s.push("bytes32"),a=Re.keccak(this.encodeData(o.type,a,r,n)),i.push(a);else{if(o.type.lastIndexOf("]")===o.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");s.push(o.type),i.push(a)}}return Jt.rawEncode(s,i)},encodeType(t,e){let r="",n=this.findTypeDependencies(t,e).filter(s=>s!==t);n=[t].concat(n.sort());for(const s of n){if(!e[s])throw new Error("No type definition specified: "+s);r+=s+"("+e[s].map(({name:o,type:a})=>a+" "+o).join(",")+")"}return r},findTypeDependencies(t,e,r=[]){if(t=t.match(/^\w*/)[0],r.includes(t)||e[t]===void 0)return r;r.push(t);for(const n of e[t])for(const s of this.findTypeDependencies(n.type,e,r))!r.includes(s)&&r.push(s);return r},hashStruct(t,e,r,n=!0){return Re.keccak(this.encodeData(t,e,r,n))},hashType(t,e){return Re.keccak(this.encodeType(t,e))},sanitizeData(t){const e={};for(const r in Fo.properties)t[r]&&(e[r]=t[r]);return e.types&&(e.types=Object.assign({EIP712Domain:[]},e.types)),e},hash(t,e=!0){const r=this.sanitizeData(t),n=[B.from("1901","hex")];return n.push(this.hashStruct("EIP712Domain",r.domain,r.types,e)),r.primaryType!=="EIP712Domain"&&n.push(this.hashStruct(r.primaryType,r.message,r.types,e)),Re.keccak(B.concat(n))}};var lu={TYPED_MESSAGE_SCHEMA:Fo,TypedDataUtils:jn,hashForSignTypedDataLegacy:function(t){return uu(t.data)},hashForSignTypedData_v3:function(t){return jn.hash(t.data,!1)},hashForSignTypedData_v4:function(t){return jn.hash(t.data)}};function uu(t){const e=new Error("Expect argument to be non-empty array");if(typeof t!="object"||!t.length)throw e;const r=t.map(function(i){return i.type==="bytes"?Re.toBuffer(i.value):i.value}),n=t.map(function(i){return i.type}),s=t.map(function(i){if(!i.name)throw e;return i.type+" "+i.name});return Jt.soliditySHA3(["bytes32","bytes32"],[Jt.soliditySHA3(new Array(t.length).fill("string"),s),Jt.soliditySHA3(n,r)])}var Nt={};Object.defineProperty(Nt,"__esModule",{value:!0});Nt.filterFromParam=Nt.FilterPolyfill=void 0;const wt=Q,ae=S,du=5*60*1e3,et={jsonrpc:"2.0",id:0};class hu{constructor(e){this.logFilters=new Map,this.blockFilters=new Set,this.pendingTransactionFilters=new Set,this.cursors=new Map,this.timeouts=new Map,this.nextFilterId=(0,wt.IntNumber)(1),this.REQUEST_THROTTLE_INTERVAL=1e3,this.lastFetchTimestamp=new Date(0),this.resolvers=[],this.provider=e}async newFilter(e){const r=Bo(e),n=this.makeFilterId(),s=await this.setInitialCursorPosition(n,r.fromBlock);return console.info(`Installing new log filter(${n}):`,r,"initial cursor position:",s),this.logFilters.set(n,r),this.setFilterTimeout(n),(0,ae.hexStringFromIntNumber)(n)}async newBlockFilter(){const e=this.makeFilterId(),r=await this.setInitialCursorPosition(e,"latest");return console.info(`Installing new block filter (${e}) with initial cursor position:`,r),this.blockFilters.add(e),this.setFilterTimeout(e),(0,ae.hexStringFromIntNumber)(e)}async newPendingTransactionFilter(){const e=this.makeFilterId(),r=await this.setInitialCursorPosition(e,"latest");return console.info(`Installing new block filter (${e}) with initial cursor position:`,r),this.pendingTransactionFilters.add(e),this.setFilterTimeout(e),(0,ae.hexStringFromIntNumber)(e)}uninstallFilter(e){const r=(0,ae.intNumberFromHexString)(e);return console.info(`Uninstalling filter (${r})`),this.deleteFilter(r),!0}getFilterChanges(e){const r=(0,ae.intNumberFromHexString)(e);return this.timeouts.has(r)&&this.setFilterTimeout(r),this.logFilters.has(r)?this.getLogFilterChanges(r):this.blockFilters.has(r)?this.getBlockFilterChanges(r):this.pendingTransactionFilters.has(r)?this.getPendingTransactionFilterChanges(r):Promise.resolve(_r())}async getFilterLogs(e){const r=(0,ae.intNumberFromHexString)(e),n=this.logFilters.get(r);return n?this.sendAsyncPromise(Object.assign(Object.assign({},et),{method:"eth_getLogs",params:[oi(n)]})):_r()}makeFilterId(){return(0,wt.IntNumber)(++this.nextFilterId)}sendAsyncPromise(e){return new Promise((r,n)=>{this.provider.sendAsync(e,(s,i)=>{if(s)return n(s);if(Array.isArray(i)||i==null)return n(new Error(`unexpected response received: ${JSON.stringify(i)}`));r(i)})})}deleteFilter(e){console.info(`Deleting filter (${e})`),this.logFilters.delete(e),this.blockFilters.delete(e),this.pendingTransactionFilters.delete(e),this.cursors.delete(e),this.timeouts.delete(e)}async getLogFilterChanges(e){const r=this.logFilters.get(e),n=this.cursors.get(e);if(!n||!r)return _r();const s=await this.getCurrentBlockHeight(),i=r.toBlock==="latest"?s:r.toBlock;if(n>s||n>Number(r.toBlock))return Sr();console.info(`Fetching logs from ${n} to ${i} for filter ${e}`);const o=await this.sendAsyncPromise(Object.assign(Object.assign({},et),{method:"eth_getLogs",params:[oi(Object.assign(Object.assign({},r),{fromBlock:n,toBlock:i}))]}));if(Array.isArray(o.result)){const a=o.result.map(c=>(0,ae.intNumberFromHexString)(c.blockNumber||"0x0")),l=Math.max(...a);if(l&&l>n){const c=(0,wt.IntNumber)(l+1);console.info(`Moving cursor position for filter (${e}) from ${n} to ${c}`),this.cursors.set(e,c)}}return o}async getBlockFilterChanges(e){const r=this.cursors.get(e);if(!r)return _r();const n=await this.getCurrentBlockHeight();if(r>n)return Sr();console.info(`Fetching blocks from ${r} to ${n} for filter (${e})`);const s=(await Promise.all((0,ae.range)(r,n+1).map(o=>this.getBlockHashByNumber((0,wt.IntNumber)(o))))).filter(o=>!!o),i=(0,wt.IntNumber)(r+s.length);return console.info(`Moving cursor position for filter (${e}) from ${r} to ${i}`),this.cursors.set(e,i),Object.assign(Object.assign({},et),{result:s})}async getPendingTransactionFilterChanges(e){return Promise.resolve(Sr())}async setInitialCursorPosition(e,r){const n=await this.getCurrentBlockHeight(),s=typeof r=="number"&&r>n?r:n;return this.cursors.set(e,s),s}setFilterTimeout(e){const r=this.timeouts.get(e);r&&window.clearTimeout(r);const n=window.setTimeout(()=>{console.info(`Filter (${e}) timed out`),this.deleteFilter(e)},du);this.timeouts.set(e,n)}async getCurrentBlockHeight(){const e=new Date;if(e.getTime()-this.lastFetchTimestamp.getTime()>this.REQUEST_THROTTLE_INTERVAL){this.lastFetchTimestamp=e;const r=await this._getCurrentBlockHeight();this.currentBlockHeight=r,this.resolvers.forEach(n=>n(r)),this.resolvers=[]}return this.currentBlockHeight?this.currentBlockHeight:new Promise(r=>this.resolvers.push(r))}async _getCurrentBlockHeight(){const{result:e}=await this.sendAsyncPromise(Object.assign(Object.assign({},et),{method:"eth_blockNumber",params:[]}));return(0,ae.intNumberFromHexString)((0,ae.ensureHexString)(e))}async getBlockHashByNumber(e){const r=await this.sendAsyncPromise(Object.assign(Object.assign({},et),{method:"eth_getBlockByNumber",params:[(0,ae.hexStringFromIntNumber)(e),!1]}));return r.result&&typeof r.result.hash=="string"?(0,ae.ensureHexString)(r.result.hash):null}}Nt.FilterPolyfill=hu;function Bo(t){return{fromBlock:ai(t.fromBlock),toBlock:ai(t.toBlock),addresses:t.address===void 0?null:Array.isArray(t.address)?t.address:[t.address],topics:t.topics||[]}}Nt.filterFromParam=Bo;function oi(t){const e={fromBlock:ci(t.fromBlock),toBlock:ci(t.toBlock),topics:t.topics};return t.addresses!==null&&(e.address=t.addresses),e}function ai(t){if(t===void 0||t==="latest"||t==="pending")return"latest";if(t==="earliest")return(0,wt.IntNumber)(0);if((0,ae.isHexString)(t))return(0,ae.intNumberFromHexString)(t);throw new Error(`Invalid block option: ${String(t)}`)}function ci(t){return t==="latest"?t:(0,ae.hexStringFromIntNumber)(t)}function _r(){return Object.assign(Object.assign({},et),{error:{code:-32e3,message:"filter not found"}})}function Sr(){return Object.assign(Object.assign({},et),{result:[]})}var ln={},Do={},un={},ys=fu;function fu(t){t=t||{};var e=t.max||Number.MAX_SAFE_INTEGER,r=typeof t.start<"u"?t.start:Math.floor(Math.random()*e);return function(){return r=r%e,r++}}const li=(t,e)=>function(){const r=e.promiseModule,n=new Array(arguments.length);for(let s=0;s{e.errorFirst?n.push(function(o,a){if(e.multiArgs){const l=new Array(arguments.length-1);for(let c=1;c{e=Object.assign({exclude:[/.+(Sync|Stream)$/],errorFirst:!0,promiseModule:Promise},e);const r=s=>{const i=o=>typeof o=="string"?s===o:o.test(s);return e.include?e.include.some(i):!e.exclude.some(i)};let n;typeof t=="function"?n=function(){return e.excludeMain?t.apply(this,arguments):li(t,e).apply(this,arguments)}:n=Object.create(Object.getPrototypeOf(t));for(const s in t){const i=t[s];n[s]=typeof i=="function"&&r(s)?li(i,e):i}return n},ar={},cr={};Object.defineProperty(cr,"__esModule",{value:!0});const pu=oo;function ui(t,e,r){try{Reflect.apply(t,e,r)}catch(n){setTimeout(()=>{throw n})}}function mu(t){const e=t.length,r=new Array(e);for(let n=0;n0&&([o]=r),o instanceof Error)throw o;const a=new Error(`Unhandled error.${o?` (${o.message})`:""}`);throw a.context=o,a}const i=s[e];if(i===void 0)return!1;if(typeof i=="function")ui(i,this,r);else{const o=i.length,a=mu(i);for(let l=0;lt+e,di=["sync","latest"];class _u extends wu.default{constructor(e){super(),this._blockResetDuration=e.blockResetDuration||20*vu,this._usePastBlocks=e.usePastBlocks||!1,this._currentBlock=null,this._isRunning=!1,this._onNewListener=this._onNewListener.bind(this),this._onRemoveListener=this._onRemoveListener.bind(this),this._resetCurrentBlock=this._resetCurrentBlock.bind(this),this._setupInternalEvents()}async destroy(){this._cancelBlockResetTimeout(),await this._maybeEnd(),super.removeAllListeners()}isRunning(){return this._isRunning}getCurrentBlock(){return this._currentBlock}async getLatestBlock(){return this._currentBlock?this._currentBlock:await new Promise(r=>this.once("latest",r))}removeAllListeners(e){return e?super.removeAllListeners(e):super.removeAllListeners(),this._setupInternalEvents(),this._onRemoveListener(),this}_setupInternalEvents(){this.removeListener("newListener",this._onNewListener),this.removeListener("removeListener",this._onRemoveListener),this.on("newListener",this._onNewListener),this.on("removeListener",this._onRemoveListener)}_onNewListener(e){di.includes(e)&&this._maybeStart()}_onRemoveListener(){this._getBlockTrackerEventCount()>0||this._maybeEnd()}async _maybeStart(){this._isRunning||(this._isRunning=!0,this._cancelBlockResetTimeout(),await this._start(),this.emit("_started"))}async _maybeEnd(){this._isRunning&&(this._isRunning=!1,this._setupBlockResetTimeout(),await this._end(),this.emit("_ended"))}_getBlockTrackerEventCount(){return di.map(e=>this.listenerCount(e)).reduce(Eu)}_shouldUseNewBlock(e){const r=this._currentBlock;if(!r)return!0;const n=hi(e),s=hi(r);return this._usePastBlocks&&ns}_newPotentialLatest(e){this._shouldUseNewBlock(e)&&this._setCurrentBlock(e)}_setCurrentBlock(e){const r=this._currentBlock;this._currentBlock=e,this.emit("latest",e),this.emit("sync",{oldBlock:r,newBlock:e})}_setupBlockResetTimeout(){this._cancelBlockResetTimeout(),this._blockResetTimeout=setTimeout(this._resetCurrentBlock,this._blockResetDuration),this._blockResetTimeout.unref&&this._blockResetTimeout.unref()}_cancelBlockResetTimeout(){this._blockResetTimeout&&clearTimeout(this._blockResetTimeout)}_resetCurrentBlock(){this._currentBlock=null}}ar.BaseBlockTracker=_u;function hi(t){return Number.parseInt(t,16)}var Ho={},Uo={},se={};class Vo extends TypeError{constructor(e,r){let n;const{message:s,explanation:i,...o}=e,{path:a}=e,l=a.length===0?s:`At path: ${a.join(".")} -- ${s}`;super(i??l),i!=null&&(this.cause=l),Object.assign(this,o),this.name=this.constructor.name,this.failures=()=>n??(n=[e,...r()])}}function Su(t){return Se(t)&&typeof t[Symbol.iterator]=="function"}function Se(t){return typeof t=="object"&&t!=null}function fi(t){if(Object.prototype.toString.call(t)!=="[object Object]")return!1;const e=Object.getPrototypeOf(t);return e===null||e===Object.prototype}function X(t){return typeof t=="symbol"?t.toString():typeof t=="string"?JSON.stringify(t):`${t}`}function Cu(t){const{done:e,value:r}=t.next();return e?void 0:r}function Ru(t,e,r,n){if(t===!0)return;t===!1?t={}:typeof t=="string"&&(t={message:t});const{path:s,branch:i}=e,{type:o}=r,{refinement:a,message:l=`Expected a value of type \`${o}\`${a?` with refinement \`${a}\``:""}, but received: \`${X(n)}\``}=t;return{value:n,type:o,refinement:a,key:s[s.length-1],path:s,branch:i,...t,message:l}}function*es(t,e,r,n){Su(t)||(t=[t]);for(const s of t){const i=Ru(s,e,r,n);i&&(yield i)}}function*ws(t,e,r={}){const{path:n=[],branch:s=[t],coerce:i=!1,mask:o=!1}=r,a={path:n,branch:s};if(i&&(t=e.coercer(t,a),o&&e.type!=="type"&&Se(e.schema)&&Se(t)&&!Array.isArray(t)))for(const c in t)e.schema[c]===void 0&&delete t[c];let l="valid";for(const c of e.validator(t,a))c.explanation=r.message,l="not_valid",yield[c,void 0];for(let[c,u,d]of e.entries(t,a)){const h=ws(u,d,{path:c===void 0?n:[...n,c],branch:c===void 0?s:[...s,u],coerce:i,mask:o,message:r.message});for(const f of h)f[0]?(l=f[0].refinement!=null?"not_refined":"not_valid",yield[f[0],void 0]):i&&(u=f[1],c===void 0?t=u:t instanceof Map?t.set(c,u):t instanceof Set?t.add(u):Se(t)&&(u!==void 0||c in t)&&(t[c]=u))}if(l!=="not_valid")for(const c of e.refiner(t,a))c.explanation=r.message,l="not_refined",yield[c,void 0];l==="valid"&&(yield[void 0,t])}class q{constructor(e){const{type:r,schema:n,validator:s,refiner:i,coercer:o=l=>l,entries:a=function*(){}}=e;this.type=r,this.schema=n,this.entries=a,this.coercer=o,s?this.validator=(l,c)=>{const u=s(l,c);return es(u,c,this,l)}:this.validator=()=>[],i?this.refiner=(l,c)=>{const u=i(l,c);return es(u,c,this,l)}:this.refiner=()=>[]}assert(e,r){return Wo(e,this,r)}create(e,r){return zo(e,this,r)}is(e){return vs(e,this)}mask(e,r){return Jo(e,this,r)}validate(e,r={}){return jt(e,this,r)}}function Wo(t,e,r){const n=jt(t,e,{message:r});if(n[0])throw n[0]}function zo(t,e,r){const n=jt(t,e,{coerce:!0,message:r});if(n[0])throw n[0];return n[1]}function Jo(t,e,r){const n=jt(t,e,{coerce:!0,mask:!0,message:r});if(n[0])throw n[0];return n[1]}function vs(t,e){return!jt(t,e)[0]}function jt(t,e,r={}){const n=ws(t,e,r),s=Cu(n);return s[0]?[new Vo(s[0],function*(){for(const o of n)o[0]&&(yield o[0])}),void 0]:[void 0,s[1]]}function ku(...t){const e=t[0].type==="type",r=t.map(s=>s.schema),n=Object.assign({},...r);return e?ur(n):lr(n)}function de(t,e){return new q({type:t,schema:null,validator:e})}function Iu(t,e){return new q({...t,refiner:(r,n)=>r===void 0||t.refiner(r,n),validator(r,n){return r===void 0?!0:(e(r,n),t.validator(r,n))}})}function Au(t){return new q({type:"dynamic",schema:null,*entries(e,r){yield*t(e,r).entries(e,r)},validator(e,r){return t(e,r).validator(e,r)},coercer(e,r){return t(e,r).coercer(e,r)},refiner(e,r){return t(e,r).refiner(e,r)}})}function Nu(t){let e;return new q({type:"lazy",schema:null,*entries(r,n){e??(e=t()),yield*e.entries(r,n)},validator(r,n){return e??(e=t()),e.validator(r,n)},coercer(r,n){return e??(e=t()),e.coercer(r,n)},refiner(r,n){return e??(e=t()),e.refiner(r,n)}})}function Mu(t,e){const{schema:r}=t,n={...r};for(const s of e)delete n[s];switch(t.type){case"type":return ur(n);default:return lr(n)}}function Tu(t){const e=t instanceof q,r=e?{...t.schema}:{...t};for(const n in r)r[n]=qo(r[n]);return e&&t.type==="type"?ur(r):lr(r)}function Lu(t,e){const{schema:r}=t,n={};for(const s of e)n[s]=r[s];switch(t.type){case"type":return ur(n);default:return lr(n)}}function Ou(t,e){return console.warn("superstruct@0.11 - The `struct` helper has been renamed to `define`."),de(t,e)}function Pu(){return de("any",()=>!0)}function $u(t){return new q({type:"array",schema:t,*entries(e){if(t&&Array.isArray(e))for(const[r,n]of e.entries())yield[r,n,t]},coercer(e){return Array.isArray(e)?e.slice():e},validator(e){return Array.isArray(e)||`Expected an array value, but received: ${X(e)}`}})}function xu(){return de("bigint",t=>typeof t=="bigint")}function ju(){return de("boolean",t=>typeof t=="boolean")}function Fu(){return de("date",t=>t instanceof Date&&!isNaN(t.getTime())||`Expected a valid \`Date\` object, but received: ${X(t)}`)}function Bu(t){const e={},r=t.map(n=>X(n)).join();for(const n of t)e[n]=n;return new q({type:"enums",schema:e,validator(n){return t.includes(n)||`Expected one of \`${r}\`, but received: ${X(n)}`}})}function Du(){return de("func",t=>typeof t=="function"||`Expected a function, but received: ${X(t)}`)}function Hu(t){return de("instance",e=>e instanceof t||`Expected a \`${t.name}\` instance, but received: ${X(e)}`)}function Uu(){return de("integer",t=>typeof t=="number"&&!isNaN(t)&&Number.isInteger(t)||`Expected an integer, but received: ${X(t)}`)}function Vu(t){return new q({type:"intersection",schema:null,*entries(e,r){for(const n of t)yield*n.entries(e,r)},*validator(e,r){for(const n of t)yield*n.validator(e,r)},*refiner(e,r){for(const n of t)yield*n.refiner(e,r)}})}function Wu(t){const e=X(t),r=typeof t;return new q({type:"literal",schema:r==="string"||r==="number"||r==="boolean"?t:null,validator(n){return n===t||`Expected the literal \`${e}\`, but received: ${X(n)}`}})}function zu(t,e){return new q({type:"map",schema:null,*entries(r){if(t&&e&&r instanceof Map)for(const[n,s]of r.entries())yield[n,n,t],yield[n,s,e]},coercer(r){return r instanceof Map?new Map(r):r},validator(r){return r instanceof Map||`Expected a \`Map\` object, but received: ${X(r)}`}})}function Es(){return de("never",()=>!1)}function Ju(t){return new q({...t,validator:(e,r)=>e===null||t.validator(e,r),refiner:(e,r)=>e===null||t.refiner(e,r)})}function qu(){return de("number",t=>typeof t=="number"&&!isNaN(t)||`Expected a number, but received: ${X(t)}`)}function lr(t){const e=t?Object.keys(t):[],r=Es();return new q({type:"object",schema:t||null,*entries(n){if(t&&Se(n)){const s=new Set(Object.keys(n));for(const i of e)s.delete(i),yield[i,n[i],t[i]];for(const i of s)yield[i,n[i],r]}},validator(n){return Se(n)||`Expected an object, but received: ${X(n)}`},coercer(n){return Se(n)?{...n}:n}})}function qo(t){return new q({...t,validator:(e,r)=>e===void 0||t.validator(e,r),refiner:(e,r)=>e===void 0||t.refiner(e,r)})}function Gu(t,e){return new q({type:"record",schema:null,*entries(r){if(Se(r))for(const n in r){const s=r[n];yield[n,n,t],yield[n,s,e]}},validator(r){return Se(r)||`Expected an object, but received: ${X(r)}`}})}function Zu(){return de("regexp",t=>t instanceof RegExp)}function Qu(t){return new q({type:"set",schema:null,*entries(e){if(t&&e instanceof Set)for(const r of e)yield[r,r,t]},coercer(e){return e instanceof Set?new Set(e):e},validator(e){return e instanceof Set||`Expected a \`Set\` object, but received: ${X(e)}`}})}function Go(){return de("string",t=>typeof t=="string"||`Expected a string, but received: ${X(t)}`)}function Xu(t){const e=Es();return new q({type:"tuple",schema:null,*entries(r){if(Array.isArray(r)){const n=Math.max(t.length,r.length);for(let s=0;sr.type).join(" | ");return new q({type:"union",schema:null,coercer(r){for(const n of t){const[s,i]=n.validate(r,{coerce:!0});if(!s)return i}return r},validator(r,n){const s=[];for(const i of t){const[...o]=ws(r,i,n),[a]=o;if(a[0])for(const[l]of o)l&&s.push(l);else return[]}return[`Expected the value to satisfy a union of \`${e}\`, but received: ${X(r)}`,...s]}})}function Zo(){return de("unknown",()=>!0)}function _s(t,e,r){return new q({...t,coercer:(n,s)=>vs(n,e)?t.coercer(r(n,s),s):t.coercer(n,s)})}function Yu(t,e,r={}){return _s(t,Zo(),n=>{const s=typeof e=="function"?e():e;if(n===void 0)return s;if(!r.strict&&fi(n)&&fi(s)){const i={...n};let o=!1;for(const a in s)i[a]===void 0&&(i[a]=s[a],o=!0);if(o)return i}return n})}function ed(t){return _s(t,Go(),e=>e.trim())}function td(t){return ut(t,"empty",e=>{const r=Qo(e);return r===0||`Expected an empty ${t.type} but received one with a size of \`${r}\``})}function Qo(t){return t instanceof Map||t instanceof Set?t.size:t.length}function rd(t,e,r={}){const{exclusive:n}=r;return ut(t,"max",s=>n?sn?s>e:s>=e||`Expected a ${t.type} greater than ${n?"":"or equal to "}${e} but received \`${s}\``)}function sd(t){return ut(t,"nonempty",e=>Qo(e)>0||`Expected a nonempty ${t.type} but received an empty one`)}function id(t,e){return ut(t,"pattern",r=>e.test(r)||`Expected a ${t.type} matching \`/${e.source}/\` but received "${r}"`)}function od(t,e,r=e){const n=`Expected a ${t.type}`,s=e===r?`of \`${e}\``:`between \`${e}\` and \`${r}\``;return ut(t,"size",i=>{if(typeof i=="number"||i instanceof Date)return e<=i&&i<=r||`${n} ${s} but received \`${i}\``;if(i instanceof Map||i instanceof Set){const{size:o}=i;return e<=o&&o<=r||`${n} with a size ${s} but received one with a size of \`${o}\``}else{const{length:o}=i;return e<=o&&o<=r||`${n} with a length ${s} but received one with a length of \`${o}\``}})}function ut(t,e,r){return new q({...t,*refiner(n,s){yield*t.refiner(n,s);const i=r(n,s),o=es(i,s,t,n);for(const a of o)yield{...a,refinement:e}}})}const ad=Object.freeze(Object.defineProperty({__proto__:null,Struct:q,StructError:Vo,any:Pu,array:$u,assert:Wo,assign:ku,bigint:xu,boolean:ju,coerce:_s,create:zo,date:Fu,defaulted:Yu,define:de,deprecated:Iu,dynamic:Au,empty:td,enums:Bu,func:Du,instance:Hu,integer:Uu,intersection:Vu,is:vs,lazy:Nu,literal:Wu,map:zu,mask:Jo,max:rd,min:nd,never:Es,nonempty:sd,nullable:Ju,number:qu,object:lr,omit:Mu,optional:qo,partial:Tu,pattern:id,pick:Lu,record:Gu,refine:ut,regexp:Zu,set:Qu,size:od,string:Go,struct:Ou,trimmed:ed,tuple:Xu,type:ur,union:Ku,unknown:Zo,validate:jt},Symbol.toStringTag,{value:"Module"})),dt=io(ad);Object.defineProperty(se,"__esModule",{value:!0});se.assertExhaustive=se.assertStruct=se.assert=se.AssertionError=void 0;const cd=dt;function ld(t){return typeof t=="object"&&t!==null&&"message"in t}function ud(t){var e,r;return typeof((r=(e=t==null?void 0:t.prototype)===null||e===void 0?void 0:e.constructor)===null||r===void 0?void 0:r.name)=="string"}function dd(t){const e=ld(t)?t.message:String(t);return e.endsWith(".")?e.slice(0,-1):e}function Xo(t,e){return ud(t)?new t({message:e}):t({message:e})}class Ss extends Error{constructor(e){super(e.message),this.code="ERR_ASSERTION"}}se.AssertionError=Ss;function hd(t,e="Assertion failed.",r=Ss){if(!t)throw e instanceof Error?e:Xo(r,e)}se.assert=hd;function fd(t,e,r="Assertion failed",n=Ss){try{(0,cd.assert)(t,e)}catch(s){throw Xo(n,`${r}: ${dd(s)}.`)}}se.assertStruct=fd;function gd(t){throw new Error("Invalid branch reached. Should be detected during compilation.")}se.assertExhaustive=gd;var dr={};Object.defineProperty(dr,"__esModule",{value:!0});dr.base64=void 0;const pd=dt,md=se,bd=(t,e={})=>{var r,n;const s=(r=e.paddingRequired)!==null&&r!==void 0?r:!1,i=(n=e.characterSet)!==null&&n!==void 0?n:"base64";let o;i==="base64"?o=String.raw`[A-Za-z0-9+\/]`:((0,md.assert)(i==="base64url"),o=String.raw`[-_A-Za-z0-9]`);let a;return s?a=new RegExp(`^(?:${o}{4})*(?:${o}{3}=|${o}{2}==)?$`,"u"):a=new RegExp(`^(?:${o}{4})*(?:${o}{2,3}|${o}{3}=|${o}{2}==)?$`,"u"),(0,pd.pattern)(t,a)};dr.base64=bd;var F={},hr={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.remove0x=t.add0x=t.assertIsStrictHexString=t.assertIsHexString=t.isStrictHexString=t.isHexString=t.StrictHexStruct=t.HexStruct=void 0;const e=dt,r=se;t.HexStruct=(0,e.pattern)((0,e.string)(),/^(?:0x)?[0-9a-f]+$/iu),t.StrictHexStruct=(0,e.pattern)((0,e.string)(),/^0x[0-9a-f]+$/iu);function n(c){return(0,e.is)(c,t.HexStruct)}t.isHexString=n;function s(c){return(0,e.is)(c,t.StrictHexStruct)}t.isStrictHexString=s;function i(c){(0,r.assert)(n(c),"Value must be a hexadecimal string.")}t.assertIsHexString=i;function o(c){(0,r.assert)(s(c),'Value must be a hexadecimal string, starting with "0x".')}t.assertIsStrictHexString=o;function a(c){return c.startsWith("0x")?c:c.startsWith("0X")?`0x${c.substring(2)}`:`0x${c}`}t.add0x=a;function l(c){return c.startsWith("0x")||c.startsWith("0X")?c.substring(2):c}t.remove0x=l})(hr);Object.defineProperty(F,"__esModule",{value:!0});F.createDataView=F.concatBytes=F.valueToBytes=F.stringToBytes=F.numberToBytes=F.signedBigIntToBytes=F.bigIntToBytes=F.hexToBytes=F.bytesToString=F.bytesToNumber=F.bytesToSignedBigInt=F.bytesToBigInt=F.bytesToHex=F.assertIsBytes=F.isBytes=void 0;const me=se,ts=hr,gi=48,pi=58,mi=87;function yd(){const t=[];return()=>{if(t.length===0)for(let e=0;e<256;e++)t.push(e.toString(16).padStart(2,"0"));return t}}const wd=yd();function Cs(t){return t instanceof Uint8Array}F.isBytes=Cs;function Ft(t){(0,me.assert)(Cs(t),"Value must be a Uint8Array.")}F.assertIsBytes=Ft;function Ko(t){if(Ft(t),t.length===0)return"0x";const e=wd(),r=new Array(t.length);for(let n=0;n=BigInt(0),"Value must be a non-negative bigint.");const e=t.toString(16);return dn(e)}F.bigIntToBytes=ea;function Sd(t,e){(0,me.assert)(e>0);const r=t>>BigInt(31);return!((~t&r)+(t&~r)>>BigInt(e*8+-1))}function Cd(t,e){(0,me.assert)(typeof t=="bigint","Value must be a bigint."),(0,me.assert)(typeof e=="number","Byte length must be a number."),(0,me.assert)(e>0,"Byte length must be greater than 0."),(0,me.assert)(Sd(t,e),"Byte length is too small to represent the given value.");let r=t;const n=new Uint8Array(e);for(let s=0;s>=BigInt(8);return n.reverse()}F.signedBigIntToBytes=Cd;function ta(t){(0,me.assert)(typeof t=="number","Value must be a number."),(0,me.assert)(t>=0,"Value must be a non-negative number."),(0,me.assert)(Number.isSafeInteger(t),"Value is not a safe integer. Use `bigIntToBytes` instead.");const e=t.toString(16);return dn(e)}F.numberToBytes=ta;function ra(t){return(0,me.assert)(typeof t=="string","Value must be a string."),new TextEncoder().encode(t)}F.stringToBytes=ra;function na(t){if(typeof t=="bigint")return ea(t);if(typeof t=="number")return ta(t);if(typeof t=="string")return t.startsWith("0x")?dn(t):ra(t);if(Cs(t))return t;throw new TypeError(`Unsupported value type: "${typeof t}".`)}F.valueToBytes=na;function Rd(t){const e=new Array(t.length);let r=0;for(let s=0;se.call(r,n,s,this))}get(e){return ce(this,Ce,"f").get(e)}has(e){return ce(this,Ce,"f").has(e)}keys(){return ce(this,Ce,"f").keys()}values(){return ce(this,Ce,"f").values()}toString(){return`FrozenMap(${this.size}) {${this.size>0?` ${[...this.entries()].map(([e,r])=>`${String(e)} => ${String(r)}`).join(", ")} `:""}}`}}Mt.FrozenMap=Rs;class ks{constructor(e){Me.set(this,void 0),oa(this,Me,new Set(e),"f"),Object.freeze(this)}get size(){return ce(this,Me,"f").size}[(Me=new WeakMap,Symbol.iterator)](){return ce(this,Me,"f")[Symbol.iterator]()}entries(){return ce(this,Me,"f").entries()}forEach(e,r){return ce(this,Me,"f").forEach((n,s,i)=>e.call(r,n,s,this))}has(e){return ce(this,Me,"f").has(e)}keys(){return ce(this,Me,"f").keys()}values(){return ce(this,Me,"f").values()}toString(){return`FrozenSet(${this.size}) {${this.size>0?` ${[...this.values()].map(e=>String(e)).join(", ")} `:""}}`}}Mt.FrozenSet=ks;Object.freeze(Rs);Object.freeze(Rs.prototype);Object.freeze(ks);Object.freeze(ks.prototype);var aa={};Object.defineProperty(aa,"__esModule",{value:!0});var ca={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getJsonRpcIdValidator=t.assertIsJsonRpcError=t.isJsonRpcError=t.assertIsJsonRpcFailure=t.isJsonRpcFailure=t.assertIsJsonRpcSuccess=t.isJsonRpcSuccess=t.assertIsJsonRpcResponse=t.isJsonRpcResponse=t.assertIsPendingJsonRpcResponse=t.isPendingJsonRpcResponse=t.JsonRpcResponseStruct=t.JsonRpcFailureStruct=t.JsonRpcSuccessStruct=t.PendingJsonRpcResponseStruct=t.assertIsJsonRpcRequest=t.isJsonRpcRequest=t.assertIsJsonRpcNotification=t.isJsonRpcNotification=t.JsonRpcNotificationStruct=t.JsonRpcRequestStruct=t.JsonRpcParamsStruct=t.JsonRpcErrorStruct=t.JsonRpcIdStruct=t.JsonRpcVersionStruct=t.jsonrpc2=t.getJsonSize=t.isValidJson=t.JsonStruct=t.UnsafeJsonStruct=void 0;const e=dt,r=se,n=()=>(0,e.define)("finite number",v=>(0,e.is)(v,(0,e.number)())&&Number.isFinite(v));t.UnsafeJsonStruct=(0,e.union)([(0,e.literal)(null),(0,e.boolean)(),n(),(0,e.string)(),(0,e.array)((0,e.lazy)(()=>t.UnsafeJsonStruct)),(0,e.record)((0,e.string)(),(0,e.lazy)(()=>t.UnsafeJsonStruct))]),t.JsonStruct=(0,e.define)("Json",(v,M)=>{function J(ie,he){const be=[...he.validator(ie,M)];return be.length>0?be:!0}try{const ie=J(v,t.UnsafeJsonStruct);return ie!==!0?ie:J(JSON.parse(JSON.stringify(v)),t.UnsafeJsonStruct)}catch(ie){return ie instanceof RangeError?"Circular reference detected":!1}});function s(v){return(0,e.is)(v,t.JsonStruct)}t.isValidJson=s;function i(v){(0,r.assertStruct)(v,t.JsonStruct,"Invalid JSON value");const M=JSON.stringify(v);return new TextEncoder().encode(M).byteLength}t.getJsonSize=i,t.jsonrpc2="2.0",t.JsonRpcVersionStruct=(0,e.literal)(t.jsonrpc2),t.JsonRpcIdStruct=(0,e.nullable)((0,e.union)([(0,e.number)(),(0,e.string)()])),t.JsonRpcErrorStruct=(0,e.object)({code:(0,e.integer)(),message:(0,e.string)(),data:(0,e.optional)(t.JsonStruct),stack:(0,e.optional)((0,e.string)())}),t.JsonRpcParamsStruct=(0,e.optional)((0,e.union)([(0,e.record)((0,e.string)(),t.JsonStruct),(0,e.array)(t.JsonStruct)])),t.JsonRpcRequestStruct=(0,e.object)({id:t.JsonRpcIdStruct,jsonrpc:t.JsonRpcVersionStruct,method:(0,e.string)(),params:t.JsonRpcParamsStruct}),t.JsonRpcNotificationStruct=(0,e.omit)(t.JsonRpcRequestStruct,["id"]);function o(v){return(0,e.is)(v,t.JsonRpcNotificationStruct)}t.isJsonRpcNotification=o;function a(v,M){(0,r.assertStruct)(v,t.JsonRpcNotificationStruct,"Invalid JSON-RPC notification",M)}t.assertIsJsonRpcNotification=a;function l(v){return(0,e.is)(v,t.JsonRpcRequestStruct)}t.isJsonRpcRequest=l;function c(v,M){(0,r.assertStruct)(v,t.JsonRpcRequestStruct,"Invalid JSON-RPC request",M)}t.assertIsJsonRpcRequest=c,t.PendingJsonRpcResponseStruct=(0,e.object)({id:t.JsonRpcIdStruct,jsonrpc:t.JsonRpcVersionStruct,result:(0,e.optional)((0,e.unknown)()),error:(0,e.optional)(t.JsonRpcErrorStruct)}),t.JsonRpcSuccessStruct=(0,e.object)({id:t.JsonRpcIdStruct,jsonrpc:t.JsonRpcVersionStruct,result:t.JsonStruct}),t.JsonRpcFailureStruct=(0,e.object)({id:t.JsonRpcIdStruct,jsonrpc:t.JsonRpcVersionStruct,error:t.JsonRpcErrorStruct}),t.JsonRpcResponseStruct=(0,e.union)([t.JsonRpcSuccessStruct,t.JsonRpcFailureStruct]);function u(v){return(0,e.is)(v,t.PendingJsonRpcResponseStruct)}t.isPendingJsonRpcResponse=u;function d(v,M){(0,r.assertStruct)(v,t.PendingJsonRpcResponseStruct,"Invalid pending JSON-RPC response",M)}t.assertIsPendingJsonRpcResponse=d;function h(v){return(0,e.is)(v,t.JsonRpcResponseStruct)}t.isJsonRpcResponse=h;function f(v,M){(0,r.assertStruct)(v,t.JsonRpcResponseStruct,"Invalid JSON-RPC response",M)}t.assertIsJsonRpcResponse=f;function g(v){return(0,e.is)(v,t.JsonRpcSuccessStruct)}t.isJsonRpcSuccess=g;function b(v,M){(0,r.assertStruct)(v,t.JsonRpcSuccessStruct,"Invalid JSON-RPC success response",M)}t.assertIsJsonRpcSuccess=b;function p(v){return(0,e.is)(v,t.JsonRpcFailureStruct)}t.isJsonRpcFailure=p;function _(v,M){(0,r.assertStruct)(v,t.JsonRpcFailureStruct,"Invalid JSON-RPC failure response",M)}t.assertIsJsonRpcFailure=_;function y(v){return(0,e.is)(v,t.JsonRpcErrorStruct)}t.isJsonRpcError=y;function m(v,M){(0,r.assertStruct)(v,t.JsonRpcErrorStruct,"Invalid JSON-RPC error",M)}t.assertIsJsonRpcError=m;function $(v){const{permitEmptyString:M,permitFractions:J,permitNull:ie}=Object.assign({permitEmptyString:!0,permitFractions:!1,permitNull:!0},v);return K=>!!(typeof K=="number"&&(J||Number.isInteger(K))||typeof K=="string"&&(M||K.length>0)||ie&&K===null)}t.getJsonRpcIdValidator=$})(ca);var la={};Object.defineProperty(la,"__esModule",{value:!0});var Tt={},rs={exports:{}},Fn,yi;function jd(){if(yi)return Fn;yi=1;var t=1e3,e=t*60,r=e*60,n=r*24,s=n*7,i=n*365.25;Fn=function(u,d){d=d||{};var h=typeof u;if(h==="string"&&u.length>0)return o(u);if(h==="number"&&isFinite(u))return d.long?l(u):a(u);throw new Error("val is not a non-empty string or a valid number. val="+JSON.stringify(u))};function o(u){if(u=String(u),!(u.length>100)){var d=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(u);if(d){var h=parseFloat(d[1]),f=(d[2]||"ms").toLowerCase();switch(f){case"years":case"year":case"yrs":case"yr":case"y":return h*i;case"weeks":case"week":case"w":return h*s;case"days":case"day":case"d":return h*n;case"hours":case"hour":case"hrs":case"hr":case"h":return h*r;case"minutes":case"minute":case"mins":case"min":case"m":return h*e;case"seconds":case"second":case"secs":case"sec":case"s":return h*t;case"milliseconds":case"millisecond":case"msecs":case"msec":case"ms":return h;default:return}}}}function a(u){var d=Math.abs(u);return d>=n?Math.round(u/n)+"d":d>=r?Math.round(u/r)+"h":d>=e?Math.round(u/e)+"m":d>=t?Math.round(u/t)+"s":u+"ms"}function l(u){var d=Math.abs(u);return d>=n?c(u,d,n,"day"):d>=r?c(u,d,r,"hour"):d>=e?c(u,d,e,"minute"):d>=t?c(u,d,t,"second"):u+" ms"}function c(u,d,h,f){var g=d>=h*1.5;return Math.round(u/h)+" "+f+(g?"s":"")}return Fn}function Fd(t){r.debug=r,r.default=r,r.coerce=l,r.disable=i,r.enable=s,r.enabled=o,r.humanize=jd(),r.destroy=c,Object.keys(t).forEach(u=>{r[u]=t[u]}),r.names=[],r.skips=[],r.formatters={};function e(u){let d=0;for(let h=0;h{if(M==="%%")return"%";$++;const ie=r.formatters[J];if(typeof ie=="function"){const he=p[$];M=ie.call(_,he),p.splice($,1),$--}return M}),r.formatArgs.call(_,p),(_.log||r.log).apply(_,p)}return b.namespace=u,b.useColors=r.useColors(),b.color=r.selectColor(u),b.extend=n,b.destroy=r.destroy,Object.defineProperty(b,"enabled",{enumerable:!0,configurable:!1,get:()=>h!==null?h:(f!==r.namespaces&&(f=r.namespaces,g=r.enabled(u)),g),set:p=>{h=p}}),typeof r.init=="function"&&r.init(b),b}function n(u,d){const h=r(this.namespace+(typeof d>"u"?":":d)+u);return h.log=this.log,h}function s(u){r.save(u),r.namespaces=u,r.names=[],r.skips=[];let d;const h=(typeof u=="string"?u:"").split(/[\s,]+/),f=h.length;for(d=0;d"-"+d)].join(",");return r.enable(""),u}function o(u){if(u[u.length-1]==="*")return!0;let d,h;for(d=0,h=r.skips.length;d{let c=!1;return()=>{c||(c=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})(),e.colors=["#0000CC","#0000FF","#0033CC","#0033FF","#0066CC","#0066FF","#0099CC","#0099FF","#00CC00","#00CC33","#00CC66","#00CC99","#00CCCC","#00CCFF","#3300CC","#3300FF","#3333CC","#3333FF","#3366CC","#3366FF","#3399CC","#3399FF","#33CC00","#33CC33","#33CC66","#33CC99","#33CCCC","#33CCFF","#6600CC","#6600FF","#6633CC","#6633FF","#66CC00","#66CC33","#9900CC","#9900FF","#9933CC","#9933FF","#99CC00","#99CC33","#CC0000","#CC0033","#CC0066","#CC0099","#CC00CC","#CC00FF","#CC3300","#CC3333","#CC3366","#CC3399","#CC33CC","#CC33FF","#CC6600","#CC6633","#CC9900","#CC9933","#CCCC00","#CCCC33","#FF0000","#FF0033","#FF0066","#FF0099","#FF00CC","#FF00FF","#FF3300","#FF3333","#FF3366","#FF3399","#FF33CC","#FF33FF","#FF6600","#FF6633","#FF9900","#FF9933","#FFCC00","#FFCC33"];function n(){return typeof window<"u"&&window.process&&(window.process.type==="renderer"||window.process.__nwjs)?!0:typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:typeof document<"u"&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||typeof window<"u"&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&parseInt(RegExp.$1,10)>=31||typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)}function s(c){if(c[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+c[0]+(this.useColors?"%c ":" ")+"+"+t.exports.humanize(this.diff),!this.useColors)return;const u="color: "+this.color;c.splice(1,0,u,"color: inherit");let d=0,h=0;c[0].replace(/%[a-zA-Z%]/g,f=>{f!=="%%"&&(d++,f==="%c"&&(h=d))}),c.splice(h,0,u)}e.log=console.debug||console.log||(()=>{});function i(c){try{c?e.storage.setItem("debug",c):e.storage.removeItem("debug")}catch{}}function o(){let c;try{c=e.storage.getItem("debug")}catch{}return!c&&typeof Yn<"u"&&"env"in Yn&&(c=r.DEBUG),c}function a(){try{return localStorage}catch{}}t.exports=Bd(e);const{formatters:l}=t.exports;l.j=function(c){try{return JSON.stringify(c)}catch(u){return"[UnexpectedJSONParseError]: "+u.message}}})(rs,rs.exports);var Dd=rs.exports,Hd=k&&k.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(Tt,"__esModule",{value:!0});Tt.createModuleLogger=Tt.createProjectLogger=void 0;const Ud=Hd(Dd),Vd=(0,Ud.default)("metamask");function Wd(t){return Vd.extend(t)}Tt.createProjectLogger=Wd;function zd(t,e){return t.extend(e)}Tt.createModuleLogger=zd;var ua={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.calculateNumberSize=t.calculateStringSize=t.isASCII=t.isPlainObject=t.ESCAPE_CHARACTERS_REGEXP=t.JsonSize=t.hasProperty=t.isObject=t.isNullOrUndefined=t.isNonEmptyArray=void 0;function e(c){return Array.isArray(c)&&c.length>0}t.isNonEmptyArray=e;function r(c){return c==null}t.isNullOrUndefined=r;function n(c){return!!c&&typeof c=="object"&&!Array.isArray(c)}t.isObject=n;const s=(c,u)=>Object.hasOwnProperty.call(c,u);t.hasProperty=s,function(c){c[c.Null=4]="Null",c[c.Comma=1]="Comma",c[c.Wrapper=1]="Wrapper",c[c.True=4]="True",c[c.False=5]="False",c[c.Quote=1]="Quote",c[c.Colon=1]="Colon",c[c.Date=24]="Date"}(t.JsonSize||(t.JsonSize={})),t.ESCAPE_CHARACTERS_REGEXP=/"|\\|\n|\r|\t/gu;function i(c){if(typeof c!="object"||c===null)return!1;try{let u=c;for(;Object.getPrototypeOf(u)!==null;)u=Object.getPrototypeOf(u);return Object.getPrototypeOf(c)===u}catch{return!1}}t.isPlainObject=i;function o(c){return c.charCodeAt(0)<=127}t.isASCII=o;function a(c){var u;return c.split("").reduce((h,f)=>o(f)?h+1:h+2,0)+((u=c.match(t.ESCAPE_CHARACTERS_REGEXP))!==null&&u!==void 0?u:[]).length}t.calculateStringSize=a;function l(c){return c.toString().length}t.calculateNumberSize=l})(ua);var je={};Object.defineProperty(je,"__esModule",{value:!0});je.hexToBigInt=je.hexToNumber=je.bigIntToHex=je.numberToHex=void 0;const St=se,Zt=hr,Jd=t=>((0,St.assert)(typeof t=="number","Value must be a number."),(0,St.assert)(t>=0,"Value must be a non-negative number."),(0,St.assert)(Number.isSafeInteger(t),"Value is not a safe integer. Use `bigIntToHex` instead."),(0,Zt.add0x)(t.toString(16)));je.numberToHex=Jd;const qd=t=>((0,St.assert)(typeof t=="bigint","Value must be a bigint."),(0,St.assert)(t>=0,"Value must be a non-negative bigint."),(0,Zt.add0x)(t.toString(16)));je.bigIntToHex=qd;const Gd=t=>{(0,Zt.assertIsHexString)(t);const e=parseInt(t,16);return(0,St.assert)(Number.isSafeInteger(e),"Value is not a safe integer. Use `hexToBigInt` instead."),e};je.hexToNumber=Gd;const Zd=t=>((0,Zt.assertIsHexString)(t),BigInt((0,Zt.add0x)(t)));je.hexToBigInt=Zd;var da={};Object.defineProperty(da,"__esModule",{value:!0});var ha={};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.timeSince=t.inMilliseconds=t.Duration=void 0,function(i){i[i.Millisecond=1]="Millisecond",i[i.Second=1e3]="Second",i[i.Minute=6e4]="Minute",i[i.Hour=36e5]="Hour",i[i.Day=864e5]="Day",i[i.Week=6048e5]="Week",i[i.Year=31536e6]="Year"}(t.Duration||(t.Duration={}));const e=i=>Number.isInteger(i)&&i>=0,r=(i,o)=>{if(!e(i))throw new Error(`"${o}" must be a non-negative integer. Received: "${i}".`)};function n(i,o){return r(i,"count"),i*o}t.inMilliseconds=n;function s(i){return r(i,"timestamp"),Date.now()-i}t.timeSince=s})(ha);var fa={};Object.defineProperty(fa,"__esModule",{value:!0});var ga={},ns={exports:{}};const Qd="2.0.0",pa=256,Xd=Number.MAX_SAFE_INTEGER||9007199254740991,Kd=16,Yd=pa-6,eh=["major","premajor","minor","preminor","patch","prepatch","prerelease"];var gn={MAX_LENGTH:pa,MAX_SAFE_COMPONENT_LENGTH:Kd,MAX_SAFE_BUILD_LENGTH:Yd,MAX_SAFE_INTEGER:Xd,RELEASE_TYPES:eh,SEMVER_SPEC_VERSION:Qd,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},Bn={};const th=typeof Yn=="object"&&Bn&&Bn.NODE_DEBUG&&/\bsemver\b/i.test(Bn.NODE_DEBUG)?(...t)=>console.error("SEMVER",...t):()=>{};var pn=th;(function(t,e){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:s}=gn,i=pn;e=t.exports={};const o=e.re=[],a=e.safeRe=[],l=e.src=[],c=e.t={};let u=0;const d="[a-zA-Z0-9-]",h=[["\\s",1],["\\d",s],[d,n]],f=b=>{for(const[p,_]of h)b=b.split(`${p}*`).join(`${p}{0,${_}}`).split(`${p}+`).join(`${p}{1,${_}}`);return b},g=(b,p,_)=>{const y=f(p),m=u++;i(b,m,p),c[b]=m,l[m]=p,o[m]=new RegExp(p,_?"g":void 0),a[m]=new RegExp(y,_?"g":void 0)};g("NUMERICIDENTIFIER","0|[1-9]\\d*"),g("NUMERICIDENTIFIERLOOSE","\\d+"),g("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${d}*`),g("MAINVERSION",`(${l[c.NUMERICIDENTIFIER]})\\.(${l[c.NUMERICIDENTIFIER]})\\.(${l[c.NUMERICIDENTIFIER]})`),g("MAINVERSIONLOOSE",`(${l[c.NUMERICIDENTIFIERLOOSE]})\\.(${l[c.NUMERICIDENTIFIERLOOSE]})\\.(${l[c.NUMERICIDENTIFIERLOOSE]})`),g("PRERELEASEIDENTIFIER",`(?:${l[c.NUMERICIDENTIFIER]}|${l[c.NONNUMERICIDENTIFIER]})`),g("PRERELEASEIDENTIFIERLOOSE",`(?:${l[c.NUMERICIDENTIFIERLOOSE]}|${l[c.NONNUMERICIDENTIFIER]})`),g("PRERELEASE",`(?:-(${l[c.PRERELEASEIDENTIFIER]}(?:\\.${l[c.PRERELEASEIDENTIFIER]})*))`),g("PRERELEASELOOSE",`(?:-?(${l[c.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${l[c.PRERELEASEIDENTIFIERLOOSE]})*))`),g("BUILDIDENTIFIER",`${d}+`),g("BUILD",`(?:\\+(${l[c.BUILDIDENTIFIER]}(?:\\.${l[c.BUILDIDENTIFIER]})*))`),g("FULLPLAIN",`v?${l[c.MAINVERSION]}${l[c.PRERELEASE]}?${l[c.BUILD]}?`),g("FULL",`^${l[c.FULLPLAIN]}$`),g("LOOSEPLAIN",`[v=\\s]*${l[c.MAINVERSIONLOOSE]}${l[c.PRERELEASELOOSE]}?${l[c.BUILD]}?`),g("LOOSE",`^${l[c.LOOSEPLAIN]}$`),g("GTLT","((?:<|>)?=?)"),g("XRANGEIDENTIFIERLOOSE",`${l[c.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),g("XRANGEIDENTIFIER",`${l[c.NUMERICIDENTIFIER]}|x|X|\\*`),g("XRANGEPLAIN",`[v=\\s]*(${l[c.XRANGEIDENTIFIER]})(?:\\.(${l[c.XRANGEIDENTIFIER]})(?:\\.(${l[c.XRANGEIDENTIFIER]})(?:${l[c.PRERELEASE]})?${l[c.BUILD]}?)?)?`),g("XRANGEPLAINLOOSE",`[v=\\s]*(${l[c.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[c.XRANGEIDENTIFIERLOOSE]})(?:\\.(${l[c.XRANGEIDENTIFIERLOOSE]})(?:${l[c.PRERELEASELOOSE]})?${l[c.BUILD]}?)?)?`),g("XRANGE",`^${l[c.GTLT]}\\s*${l[c.XRANGEPLAIN]}$`),g("XRANGELOOSE",`^${l[c.GTLT]}\\s*${l[c.XRANGEPLAINLOOSE]}$`),g("COERCE",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?(?:$|[^\\d])`),g("COERCERTL",l[c.COERCE],!0),g("LONETILDE","(?:~>?)"),g("TILDETRIM",`(\\s*)${l[c.LONETILDE]}\\s+`,!0),e.tildeTrimReplace="$1~",g("TILDE",`^${l[c.LONETILDE]}${l[c.XRANGEPLAIN]}$`),g("TILDELOOSE",`^${l[c.LONETILDE]}${l[c.XRANGEPLAINLOOSE]}$`),g("LONECARET","(?:\\^)"),g("CARETTRIM",`(\\s*)${l[c.LONECARET]}\\s+`,!0),e.caretTrimReplace="$1^",g("CARET",`^${l[c.LONECARET]}${l[c.XRANGEPLAIN]}$`),g("CARETLOOSE",`^${l[c.LONECARET]}${l[c.XRANGEPLAINLOOSE]}$`),g("COMPARATORLOOSE",`^${l[c.GTLT]}\\s*(${l[c.LOOSEPLAIN]})$|^$`),g("COMPARATOR",`^${l[c.GTLT]}\\s*(${l[c.FULLPLAIN]})$|^$`),g("COMPARATORTRIM",`(\\s*)${l[c.GTLT]}\\s*(${l[c.LOOSEPLAIN]}|${l[c.XRANGEPLAIN]})`,!0),e.comparatorTrimReplace="$1$2$3",g("HYPHENRANGE",`^\\s*(${l[c.XRANGEPLAIN]})\\s+-\\s+(${l[c.XRANGEPLAIN]})\\s*$`),g("HYPHENRANGELOOSE",`^\\s*(${l[c.XRANGEPLAINLOOSE]})\\s+-\\s+(${l[c.XRANGEPLAINLOOSE]})\\s*$`),g("STAR","(<|>)?=?\\s*\\*"),g("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),g("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(ns,ns.exports);var fr=ns.exports;const rh=Object.freeze({loose:!0}),nh=Object.freeze({}),sh=t=>t?typeof t!="object"?rh:t:nh;var Is=sh;const wi=/^[0-9]+$/,ma=(t,e)=>{const r=wi.test(t),n=wi.test(e);return r&&n&&(t=+t,e=+e),t===e?0:r&&!n?-1:n&&!r?1:tma(e,t);var ba={compareIdentifiers:ma,rcompareIdentifiers:ih};const Cr=pn,{MAX_LENGTH:vi,MAX_SAFE_INTEGER:Rr}=gn,{safeRe:Ei,t:_i}=fr,oh=Is,{compareIdentifiers:mt}=ba;let ah=class Te{constructor(e,r){if(r=oh(r),e instanceof Te){if(e.loose===!!r.loose&&e.includePrerelease===!!r.includePrerelease)return e;e=e.version}else if(typeof e!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof e}".`);if(e.length>vi)throw new TypeError(`version is longer than ${vi} characters`);Cr("SemVer",e,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;const n=e.trim().match(r.loose?Ei[_i.LOOSE]:Ei[_i.FULL]);if(!n)throw new TypeError(`Invalid Version: ${e}`);if(this.raw=e,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>Rr||this.major<0)throw new TypeError("Invalid major version");if(this.minor>Rr||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>Rr||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(s=>{if(/^[0-9]+$/.test(s)){const i=+s;if(i>=0&&i=0;)typeof this.prerelease[i]=="number"&&(this.prerelease[i]++,i=-2);if(i===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(s)}}if(r){let i=[r,s];n===!1&&(i=[r]),mt(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=i):this.prerelease=i}break}default:throw new Error(`invalid increment argument: ${e}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};var le=ah;const Si=le,ch=(t,e,r=!1)=>{if(t instanceof Si)return t;try{return new Si(t,e)}catch(n){if(!r)return null;throw n}};var Bt=ch;const lh=Bt,uh=(t,e)=>{const r=lh(t,e);return r?r.version:null};var dh=uh;const hh=Bt,fh=(t,e)=>{const r=hh(t.trim().replace(/^[=v]+/,""),e);return r?r.version:null};var gh=fh;const Ci=le,ph=(t,e,r,n,s)=>{typeof r=="string"&&(s=n,n=r,r=void 0);try{return new Ci(t instanceof Ci?t.version:t,r).inc(e,n,s).version}catch{return null}};var mh=ph;const Ri=Bt,bh=(t,e)=>{const r=Ri(t,null,!0),n=Ri(e,null,!0),s=r.compare(n);if(s===0)return null;const i=s>0,o=i?r:n,a=i?n:r,l=!!o.prerelease.length;if(!!a.prerelease.length&&!l)return!a.patch&&!a.minor?"major":o.patch?"patch":o.minor?"minor":"major";const u=l?"pre":"";return r.major!==n.major?u+"major":r.minor!==n.minor?u+"minor":r.patch!==n.patch?u+"patch":"prerelease"};var yh=bh;const wh=le,vh=(t,e)=>new wh(t,e).major;var Eh=vh;const _h=le,Sh=(t,e)=>new _h(t,e).minor;var Ch=Sh;const Rh=le,kh=(t,e)=>new Rh(t,e).patch;var Ih=kh;const Ah=Bt,Nh=(t,e)=>{const r=Ah(t,e);return r&&r.prerelease.length?r.prerelease:null};var Mh=Nh;const ki=le,Th=(t,e,r)=>new ki(t,r).compare(new ki(e,r));var Ie=Th;const Lh=Ie,Oh=(t,e,r)=>Lh(e,t,r);var Ph=Oh;const $h=Ie,xh=(t,e)=>$h(t,e,!0);var jh=xh;const Ii=le,Fh=(t,e,r)=>{const n=new Ii(t,r),s=new Ii(e,r);return n.compare(s)||n.compareBuild(s)};var As=Fh;const Bh=As,Dh=(t,e)=>t.sort((r,n)=>Bh(r,n,e));var Hh=Dh;const Uh=As,Vh=(t,e)=>t.sort((r,n)=>Uh(n,r,e));var Wh=Vh;const zh=Ie,Jh=(t,e,r)=>zh(t,e,r)>0;var mn=Jh;const qh=Ie,Gh=(t,e,r)=>qh(t,e,r)<0;var Ns=Gh;const Zh=Ie,Qh=(t,e,r)=>Zh(t,e,r)===0;var ya=Qh;const Xh=Ie,Kh=(t,e,r)=>Xh(t,e,r)!==0;var wa=Kh;const Yh=Ie,ef=(t,e,r)=>Yh(t,e,r)>=0;var Ms=ef;const tf=Ie,rf=(t,e,r)=>tf(t,e,r)<=0;var Ts=rf;const nf=ya,sf=wa,of=mn,af=Ms,cf=Ns,lf=Ts,uf=(t,e,r,n)=>{switch(e){case"===":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t===r;case"!==":return typeof t=="object"&&(t=t.version),typeof r=="object"&&(r=r.version),t!==r;case"":case"=":case"==":return nf(t,r,n);case"!=":return sf(t,r,n);case">":return of(t,r,n);case">=":return af(t,r,n);case"<":return cf(t,r,n);case"<=":return lf(t,r,n);default:throw new TypeError(`Invalid operator: ${e}`)}};var va=uf;const df=le,hf=Bt,{safeRe:kr,t:Ir}=fr,ff=(t,e)=>{if(t instanceof df)return t;if(typeof t=="number"&&(t=String(t)),typeof t!="string")return null;e=e||{};let r=null;if(!e.rtl)r=t.match(kr[Ir.COERCE]);else{let n;for(;(n=kr[Ir.COERCERTL].exec(t))&&(!r||r.index+r[0].length!==t.length);)(!r||n.index+n[0].length!==r.index+r[0].length)&&(r=n),kr[Ir.COERCERTL].lastIndex=n.index+n[1].length+n[2].length;kr[Ir.COERCERTL].lastIndex=-1}return r===null?null:hf(`${r[2]}.${r[3]||"0"}.${r[4]||"0"}`,e)};var gf=ff,Dn,Ai;function pf(){return Ai||(Ai=1,Dn=function(t){t.prototype[Symbol.iterator]=function*(){for(let e=this.head;e;e=e.next)yield e.value}}),Dn}var mf=D;D.Node=at;D.create=D;function D(t){var e=this;if(e instanceof D||(e=new D),e.tail=null,e.head=null,e.length=0,t&&typeof t.forEach=="function")t.forEach(function(s){e.push(s)});else if(arguments.length>0)for(var r=0,n=arguments.length;r1)r=e;else if(this.head)n=this.head.next,r=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var s=0;n!==null;s++)r=t(r,n.value,s),n=n.next;return r};D.prototype.reduceReverse=function(t,e){var r,n=this.tail;if(arguments.length>1)r=e;else if(this.tail)n=this.tail.prev,r=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var s=this.length-1;n!==null;s--)r=t(r,n.value,s),n=n.prev;return r};D.prototype.toArray=function(){for(var t=new Array(this.length),e=0,r=this.head;r!==null;e++)t[e]=r.value,r=r.next;return t};D.prototype.toArrayReverse=function(){for(var t=new Array(this.length),e=0,r=this.tail;r!==null;e++)t[e]=r.value,r=r.prev;return t};D.prototype.slice=function(t,e){e=e||this.length,e<0&&(e+=this.length),t=t||0,t<0&&(t+=this.length);var r=new D;if(ethis.length&&(e=this.length);for(var n=0,s=this.head;s!==null&&nthis.length&&(e=this.length);for(var n=this.length,s=this.tail;s!==null&&n>e;n--)s=s.prev;for(;s!==null&&n>t;n--,s=s.prev)r.push(s.value);return r};D.prototype.splice=function(t,e,...r){t>this.length&&(t=this.length-1),t<0&&(t=this.length+t);for(var n=0,s=this.head;s!==null&&n1;class Ef{constructor(e){if(typeof e=="number"&&(e={max:e}),e||(e={}),e.max&&(typeof e.max!="number"||e.max<0))throw new TypeError("max must be a non-negative number");this[tt]=e.max||1/0;const r=e.length||Hn;if(this[bt]=typeof r!="function"?Hn:r,this[qt]=e.stale||!1,e.maxAge&&typeof e.maxAge!="number")throw new TypeError("maxAge must be a number");this[nt]=e.maxAge||0,this[Fe]=e.dispose,this[Ni]=e.noDisposeOnSet||!1,this[Ea]=e.updateAgeOnGet||!1,this.reset()}set max(e){if(typeof e!="number"||e<0)throw new TypeError("max must be a non-negative number");this[tt]=e||1/0,Ut(this)}get max(){return this[tt]}set allowStale(e){this[qt]=!!e}get allowStale(){return this[qt]}set maxAge(e){if(typeof e!="number")throw new TypeError("maxAge must be a non-negative number");this[nt]=e,Ut(this)}get maxAge(){return this[nt]}set lengthCalculator(e){typeof e!="function"&&(e=Hn),e!==this[bt]&&(this[bt]=e,this[He]=0,this[ee].forEach(r=>{r.length=this[bt](r.value,r.key),this[He]+=r.length})),Ut(this)}get lengthCalculator(){return this[bt]}get length(){return this[He]}get itemCount(){return this[ee].length}rforEach(e,r){r=r||this;for(let n=this[ee].tail;n!==null;){const s=n.prev;Mi(this,e,n,r),n=s}}forEach(e,r){r=r||this;for(let n=this[ee].head;n!==null;){const s=n.next;Mi(this,e,n,r),n=s}}keys(){return this[ee].toArray().map(e=>e.key)}values(){return this[ee].toArray().map(e=>e.value)}reset(){this[Fe]&&this[ee]&&this[ee].length&&this[ee].forEach(e=>this[Fe](e.key,e.value)),this[ke]=new Map,this[ee]=new vf,this[He]=0}dump(){return this[ee].map(e=>Lr(this,e)?!1:{k:e.key,v:e.value,e:e.now+(e.maxAge||0)}).toArray().filter(e=>e)}dumpLru(){return this[ee]}set(e,r,n){if(n=n||this[nt],n&&typeof n!="number")throw new TypeError("maxAge must be a number");const s=n?Date.now():0,i=this[bt](r,e);if(this[ke].has(e)){if(i>this[tt])return Ct(this,this[ke].get(e)),!1;const l=this[ke].get(e).value;return this[Fe]&&(this[Ni]||this[Fe](e,l.value)),l.now=s,l.maxAge=n,l.value=r,this[He]+=i-l.length,l.length=i,this.get(e),Ut(this),!0}const o=new _f(e,r,i,s,n);return o.length>this[tt]?(this[Fe]&&this[Fe](e,r),!1):(this[He]+=o.length,this[ee].unshift(o),this[ke].set(e,this[ee].head),Ut(this),!0)}has(e){if(!this[ke].has(e))return!1;const r=this[ke].get(e).value;return!Lr(this,r)}get(e){return Un(this,e,!0)}peek(e){return Un(this,e,!1)}pop(){const e=this[ee].tail;return e?(Ct(this,e),e.value):null}del(e){Ct(this,this[ke].get(e))}load(e){this.reset();const r=Date.now();for(let n=e.length-1;n>=0;n--){const s=e[n],i=s.e||0;if(i===0)this.set(s.k,s.v);else{const o=i-r;o>0&&this.set(s.k,s.v,o)}}}prune(){this[ke].forEach((e,r)=>Un(this,r,!1))}}const Un=(t,e,r)=>{const n=t[ke].get(e);if(n){const s=n.value;if(Lr(t,s)){if(Ct(t,n),!t[qt])return}else r&&(t[Ea]&&(n.value.now=Date.now()),t[ee].unshiftNode(n));return s.value}},Lr=(t,e)=>{if(!e||!e.maxAge&&!t[nt])return!1;const r=Date.now()-e.now;return e.maxAge?r>e.maxAge:t[nt]&&r>t[nt]},Ut=t=>{if(t[He]>t[tt])for(let e=t[ee].tail;t[He]>t[tt]&&e!==null;){const r=e.prev;Ct(t,e),e=r}},Ct=(t,e)=>{if(e){const r=e.value;t[Fe]&&t[Fe](r.key,r.value),t[He]-=r.length,t[ke].delete(r.key),t[ee].removeNode(e)}};class _f{constructor(e,r,n,s,i){this.key=e,this.value=r,this.length=n,this.now=s,this.maxAge=i||0}}const Mi=(t,e,r,n)=>{let s=r.value;Lr(t,s)&&(Ct(t,r),t[qt]||(s=void 0)),s&&e.call(n,s.value,s.key,t)};var Sf=Ef,Vn,Ti;function Ae(){if(Ti)return Vn;Ti=1;class t{constructor(w,I){if(I=n(I),w instanceof t)return w.loose===!!I.loose&&w.includePrerelease===!!I.includePrerelease?w:new t(w.raw,I);if(w instanceof s)return this.raw=w.value,this.set=[[w]],this.format(),this;if(this.options=I,this.loose=!!I.loose,this.includePrerelease=!!I.includePrerelease,this.raw=w.trim().split(/\s+/).join(" "),this.set=this.raw.split("||").map(R=>this.parseRange(R.trim())).filter(R=>R.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const R=this.set[0];if(this.set=this.set.filter(A=>!g(A[0])),this.set.length===0)this.set=[R];else if(this.set.length>1){for(const A of this.set)if(A.length===1&&b(A[0])){this.set=[A];break}}}this.format()}format(){return this.range=this.set.map(w=>w.join(" ").trim()).join("||").trim(),this.range}toString(){return this.range}parseRange(w){const R=((this.options.includePrerelease&&h)|(this.options.loose&&f))+":"+w,A=r.get(R);if(A)return A;const C=this.options.loose,T=C?a[l.HYPHENRANGELOOSE]:a[l.HYPHENRANGE];w=w.replace(T,be(this.options.includePrerelease)),i("hyphen replace",w),w=w.replace(a[l.COMPARATORTRIM],c),i("comparator trim",w),w=w.replace(a[l.TILDETRIM],u),i("tilde trim",w),w=w.replace(a[l.CARETTRIM],d),i("caret trim",w);let H=w.split(" ").map(G=>_(G,this.options)).join(" ").split(/\s+/).map(G=>K(G,this.options));C&&(H=H.filter(G=>(i("loose invalid filter",G,this.options),!!G.match(a[l.COMPARATORLOOSE])))),i("range list",H);const P=new Map,U=H.map(G=>new s(G,this.options));for(const G of U){if(g(G))return[G];P.set(G.value,G)}P.size>1&&P.has("")&&P.delete("");const fe=[...P.values()];return r.set(R,fe),fe}intersects(w,I){if(!(w instanceof t))throw new TypeError("a Range is required");return this.set.some(R=>p(R,I)&&w.set.some(A=>p(A,I)&&R.every(C=>A.every(T=>C.intersects(T,I)))))}test(w){if(!w)return!1;if(typeof w=="string")try{w=new o(w,this.options)}catch{return!1}for(let I=0;IE.value==="<0.0.0-0",b=E=>E.value==="",p=(E,w)=>{let I=!0;const R=E.slice();let A=R.pop();for(;I&&R.length;)I=R.every(C=>A.intersects(C,w)),A=R.pop();return I},_=(E,w)=>(i("comp",E,w),E=v(E,w),i("caret",E),E=m(E,w),i("tildes",E),E=J(E,w),i("xrange",E),E=he(E,w),i("stars",E),E),y=E=>!E||E.toLowerCase()==="x"||E==="*",m=(E,w)=>E.trim().split(/\s+/).map(I=>$(I,w)).join(" "),$=(E,w)=>{const I=w.loose?a[l.TILDELOOSE]:a[l.TILDE];return E.replace(I,(R,A,C,T,H)=>{i("tilde",E,R,A,C,T,H);let P;return y(A)?P="":y(C)?P=`>=${A}.0.0 <${+A+1}.0.0-0`:y(T)?P=`>=${A}.${C}.0 <${A}.${+C+1}.0-0`:H?(i("replaceTilde pr",H),P=`>=${A}.${C}.${T}-${H} <${A}.${+C+1}.0-0`):P=`>=${A}.${C}.${T} <${A}.${+C+1}.0-0`,i("tilde return",P),P})},v=(E,w)=>E.trim().split(/\s+/).map(I=>M(I,w)).join(" "),M=(E,w)=>{i("caret",E,w);const I=w.loose?a[l.CARETLOOSE]:a[l.CARET],R=w.includePrerelease?"-0":"";return E.replace(I,(A,C,T,H,P)=>{i("caret",E,A,C,T,H,P);let U;return y(C)?U="":y(T)?U=`>=${C}.0.0${R} <${+C+1}.0.0-0`:y(H)?C==="0"?U=`>=${C}.${T}.0${R} <${C}.${+T+1}.0-0`:U=`>=${C}.${T}.0${R} <${+C+1}.0.0-0`:P?(i("replaceCaret pr",P),C==="0"?T==="0"?U=`>=${C}.${T}.${H}-${P} <${C}.${T}.${+H+1}-0`:U=`>=${C}.${T}.${H}-${P} <${C}.${+T+1}.0-0`:U=`>=${C}.${T}.${H}-${P} <${+C+1}.0.0-0`):(i("no pr"),C==="0"?T==="0"?U=`>=${C}.${T}.${H}${R} <${C}.${T}.${+H+1}-0`:U=`>=${C}.${T}.${H}${R} <${C}.${+T+1}.0-0`:U=`>=${C}.${T}.${H} <${+C+1}.0.0-0`),i("caret return",U),U})},J=(E,w)=>(i("replaceXRanges",E,w),E.split(/\s+/).map(I=>ie(I,w)).join(" ")),ie=(E,w)=>{E=E.trim();const I=w.loose?a[l.XRANGELOOSE]:a[l.XRANGE];return E.replace(I,(R,A,C,T,H,P)=>{i("xRange",E,R,A,C,T,H,P);const U=y(C),fe=U||y(T),G=fe||y(H),Dt=G;return A==="="&&Dt&&(A=""),P=w.includePrerelease?"-0":"",U?A===">"||A==="<"?R="<0.0.0-0":R="*":A&&Dt?(fe&&(T=0),H=0,A===">"?(A=">=",fe?(C=+C+1,T=0,H=0):(T=+T+1,H=0)):A==="<="&&(A="<",fe?C=+C+1:T=+T+1),A==="<"&&(P="-0"),R=`${A+C}.${T}.${H}${P}`):fe?R=`>=${C}.0.0${P} <${+C+1}.0.0-0`:G&&(R=`>=${C}.${T}.0${P} <${C}.${+T+1}.0-0`),i("xRange return",R),R})},he=(E,w)=>(i("replaceStars",E,w),E.trim().replace(a[l.STAR],"")),K=(E,w)=>(i("replaceGTE0",E,w),E.trim().replace(a[w.includePrerelease?l.GTE0PRE:l.GTE0],"")),be=E=>(w,I,R,A,C,T,H,P,U,fe,G,Dt,l1)=>(y(R)?I="":y(A)?I=`>=${R}.0.0${E?"-0":""}`:y(C)?I=`>=${R}.${A}.0${E?"-0":""}`:T?I=`>=${I}`:I=`>=${I}${E?"-0":""}`,y(U)?P="":y(fe)?P=`<${+U+1}.0.0-0`:y(G)?P=`<${U}.${+fe+1}.0-0`:Dt?P=`<=${U}.${fe}.${G}-${Dt}`:E?P=`<${U}.${fe}.${+G+1}-0`:P=`<=${P}`,`${I} ${P}`.trim()),Y=(E,w,I)=>{for(let R=0;R0){const A=E[R].semver;if(A.major===w.major&&A.minor===w.minor&&A.patch===w.patch)return!0}return!1}return!0};return Vn}var Wn,Li;function bn(){if(Li)return Wn;Li=1;const t=Symbol("SemVer ANY");class e{static get ANY(){return t}constructor(u,d){if(d=r(d),u instanceof e){if(u.loose===!!d.loose)return u;u=u.value}u=u.trim().split(/\s+/).join(" "),o("comparator",u,d),this.options=d,this.loose=!!d.loose,this.parse(u),this.semver===t?this.value="":this.value=this.operator+this.semver.version,o("comp",this)}parse(u){const d=this.options.loose?n[s.COMPARATORLOOSE]:n[s.COMPARATOR],h=u.match(d);if(!h)throw new TypeError(`Invalid comparator: ${u}`);this.operator=h[1]!==void 0?h[1]:"",this.operator==="="&&(this.operator=""),h[2]?this.semver=new a(h[2],this.options.loose):this.semver=t}toString(){return this.value}test(u){if(o("Comparator.test",u,this.options.loose),this.semver===t||u===t)return!0;if(typeof u=="string")try{u=new a(u,this.options)}catch{return!1}return i(u,this.operator,this.semver,this.options)}intersects(u,d){if(!(u instanceof e))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new l(u.value,d).test(this.value):u.operator===""?u.value===""?!0:new l(this.value,d).test(u.semver):(d=r(d),d.includePrerelease&&(this.value==="<0.0.0-0"||u.value==="<0.0.0-0")||!d.includePrerelease&&(this.value.startsWith("<0.0.0")||u.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&u.operator.startsWith(">")||this.operator.startsWith("<")&&u.operator.startsWith("<")||this.semver.version===u.semver.version&&this.operator.includes("=")&&u.operator.includes("=")||i(this.semver,"<",u.semver,d)&&this.operator.startsWith(">")&&u.operator.startsWith("<")||i(this.semver,">",u.semver,d)&&this.operator.startsWith("<")&&u.operator.startsWith(">")))}}Wn=e;const r=Is,{safeRe:n,t:s}=fr,i=va,o=pn,a=le,l=Ae();return Wn}const Cf=Ae(),Rf=(t,e,r)=>{try{e=new Cf(e,r)}catch{return!1}return e.test(t)};var yn=Rf;const kf=Ae(),If=(t,e)=>new kf(t,e).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));var Af=If;const Nf=le,Mf=Ae(),Tf=(t,e,r)=>{let n=null,s=null,i=null;try{i=new Mf(e,r)}catch{return null}return t.forEach(o=>{i.test(o)&&(!n||s.compare(o)===-1)&&(n=o,s=new Nf(n,r))}),n};var Lf=Tf;const Of=le,Pf=Ae(),$f=(t,e,r)=>{let n=null,s=null,i=null;try{i=new Pf(e,r)}catch{return null}return t.forEach(o=>{i.test(o)&&(!n||s.compare(o)===1)&&(n=o,s=new Of(n,r))}),n};var xf=$f;const zn=le,jf=Ae(),Oi=mn,Ff=(t,e)=>{t=new jf(t,e);let r=new zn("0.0.0");if(t.test(r)||(r=new zn("0.0.0-0"),t.test(r)))return r;r=null;for(let n=0;n{const a=new zn(o.semver.version);switch(o.operator){case">":a.prerelease.length===0?a.patch++:a.prerelease.push(0),a.raw=a.format();case"":case">=":(!i||Oi(a,i))&&(i=a);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${o.operator}`)}}),i&&(!r||Oi(r,i))&&(r=i)}return r&&t.test(r)?r:null};var Bf=Ff;const Df=Ae(),Hf=(t,e)=>{try{return new Df(t,e).range||"*"}catch{return null}};var Uf=Hf;const Vf=le,_a=bn(),{ANY:Wf}=_a,zf=Ae(),Jf=yn,Pi=mn,$i=Ns,qf=Ts,Gf=Ms,Zf=(t,e,r,n)=>{t=new Vf(t,n),e=new zf(e,n);let s,i,o,a,l;switch(r){case">":s=Pi,i=qf,o=$i,a=">",l=">=";break;case"<":s=$i,i=Gf,o=Pi,a="<",l="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(Jf(t,e,n))return!1;for(let c=0;c{f.semver===Wf&&(f=new _a(">=0.0.0")),d=d||f,h=h||f,s(f.semver,d.semver,n)?d=f:o(f.semver,h.semver,n)&&(h=f)}),d.operator===a||d.operator===l||(!h.operator||h.operator===a)&&i(t,h.semver))return!1;if(h.operator===l&&o(t,h.semver))return!1}return!0};var Ls=Zf;const Qf=Ls,Xf=(t,e,r)=>Qf(t,e,">",r);var Kf=Xf;const Yf=Ls,e0=(t,e,r)=>Yf(t,e,"<",r);var t0=e0;const xi=Ae(),r0=(t,e,r)=>(t=new xi(t,r),e=new xi(e,r),t.intersects(e,r));var n0=r0;const s0=yn,i0=Ie;var o0=(t,e,r)=>{const n=[];let s=null,i=null;const o=t.sort((u,d)=>i0(u,d,r));for(const u of o)s0(u,e,r)?(i=u,s||(s=u)):(i&&n.push([s,i]),i=null,s=null);s&&n.push([s,null]);const a=[];for(const[u,d]of n)u===d?a.push(u):!d&&u===o[0]?a.push("*"):d?u===o[0]?a.push(`<=${d}`):a.push(`${u} - ${d}`):a.push(`>=${u}`);const l=a.join(" || "),c=typeof e.raw=="string"?e.raw:String(e);return l.length{if(t===e)return!0;t=new ji(t,r),e=new ji(e,r);let n=!1;e:for(const s of t.set){for(const i of e.set){const o=l0(s,i,r);if(n=n||o!==null,o)continue e}if(n)return!1}return!0},c0=[new Os(">=0.0.0-0")],Fi=[new Os(">=0.0.0")],l0=(t,e,r)=>{if(t===e)return!0;if(t.length===1&&t[0].semver===Jn){if(e.length===1&&e[0].semver===Jn)return!0;r.includePrerelease?t=c0:t=Fi}if(e.length===1&&e[0].semver===Jn){if(r.includePrerelease)return!0;e=Fi}const n=new Set;let s,i;for(const f of t)f.operator===">"||f.operator===">="?s=Bi(s,f,r):f.operator==="<"||f.operator==="<="?i=Di(i,f,r):n.add(f.semver);if(n.size>1)return null;let o;if(s&&i){if(o=Ps(s.semver,i.semver,r),o>0)return null;if(o===0&&(s.operator!==">="||i.operator!=="<="))return null}for(const f of n){if(s&&!Vt(f,String(s),r)||i&&!Vt(f,String(i),r))return null;for(const g of e)if(!Vt(f,String(g),r))return!1;return!0}let a,l,c,u,d=i&&!r.includePrerelease&&i.semver.prerelease.length?i.semver:!1,h=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1;d&&d.prerelease.length===1&&i.operator==="<"&&d.prerelease[0]===0&&(d=!1);for(const f of e){if(u=u||f.operator===">"||f.operator===">=",c=c||f.operator==="<"||f.operator==="<=",s){if(h&&f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===h.major&&f.semver.minor===h.minor&&f.semver.patch===h.patch&&(h=!1),f.operator===">"||f.operator===">="){if(a=Bi(s,f,r),a===f&&a!==s)return!1}else if(s.operator===">="&&!Vt(s.semver,String(f),r))return!1}if(i){if(d&&f.semver.prerelease&&f.semver.prerelease.length&&f.semver.major===d.major&&f.semver.minor===d.minor&&f.semver.patch===d.patch&&(d=!1),f.operator==="<"||f.operator==="<="){if(l=Di(i,f,r),l===f&&l!==i)return!1}else if(i.operator==="<="&&!Vt(i.semver,String(f),r))return!1}if(!f.operator&&(i||s)&&o!==0)return!1}return!(s&&c&&!i&&o!==0||i&&u&&!s&&o!==0||h||d)},Bi=(t,e,r)=>{if(!t)return e;const n=Ps(t.semver,e.semver,r);return n>0?t:n<0||e.operator===">"&&t.operator===">="?e:t},Di=(t,e,r)=>{if(!t)return e;const n=Ps(t.semver,e.semver,r);return n<0?t:n>0||e.operator==="<"&&t.operator==="<="?e:t};var u0=a0;const qn=fr,Hi=gn,d0=le,Ui=ba,h0=Bt,f0=dh,g0=gh,p0=mh,m0=yh,b0=Eh,y0=Ch,w0=Ih,v0=Mh,E0=Ie,_0=Ph,S0=jh,C0=As,R0=Hh,k0=Wh,I0=mn,A0=Ns,N0=ya,M0=wa,T0=Ms,L0=Ts,O0=va,P0=gf,$0=bn(),x0=Ae(),j0=yn,F0=Af,B0=Lf,D0=xf,H0=Bf,U0=Uf,V0=Ls,W0=Kf,z0=t0,J0=n0,q0=o0,G0=u0;var Z0={parse:h0,valid:f0,clean:g0,inc:p0,diff:m0,major:b0,minor:y0,patch:w0,prerelease:v0,compare:E0,rcompare:_0,compareLoose:S0,compareBuild:C0,sort:R0,rsort:k0,gt:I0,lt:A0,eq:N0,neq:M0,gte:T0,lte:L0,cmp:O0,coerce:P0,Comparator:$0,Range:x0,satisfies:j0,toComparators:F0,maxSatisfying:B0,minSatisfying:D0,minVersion:H0,validRange:U0,outside:V0,gtr:W0,ltr:z0,intersects:J0,simplifyRange:q0,subset:G0,SemVer:d0,re:qn.re,src:qn.src,tokens:qn.t,SEMVER_SPEC_VERSION:Hi.SEMVER_SPEC_VERSION,RELEASE_TYPES:Hi.RELEASE_TYPES,compareIdentifiers:Ui.compareIdentifiers,rcompareIdentifiers:Ui.rcompareIdentifiers};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.satisfiesVersionRange=t.gtRange=t.gtVersion=t.assertIsSemVerRange=t.assertIsSemVerVersion=t.isValidSemVerRange=t.isValidSemVerVersion=t.VersionRangeStruct=t.VersionStruct=void 0;const e=Z0,r=dt,n=se;t.VersionStruct=(0,r.refine)((0,r.string)(),"Version",d=>(0,e.valid)(d)===null?`Expected SemVer version, got "${d}"`:!0),t.VersionRangeStruct=(0,r.refine)((0,r.string)(),"Version range",d=>(0,e.validRange)(d)===null?`Expected SemVer range, got "${d}"`:!0);function s(d){return(0,r.is)(d,t.VersionStruct)}t.isValidSemVerVersion=s;function i(d){return(0,r.is)(d,t.VersionRangeStruct)}t.isValidSemVerRange=i;function o(d){(0,n.assertStruct)(d,t.VersionStruct)}t.assertIsSemVerVersion=o;function a(d){(0,n.assertStruct)(d,t.VersionRangeStruct)}t.assertIsSemVerRange=a;function l(d,h){return(0,e.gt)(d,h)}t.gtVersion=l;function c(d,h){return(0,e.gtr)(d,h)}t.gtRange=c;function u(d,h){return(0,e.satisfies)(d,h,{includePrerelease:!0})}t.satisfiesVersionRange=u})(ga);(function(t){var e=k&&k.__createBinding||(Object.create?function(n,s,i,o){o===void 0&&(o=i);var a=Object.getOwnPropertyDescriptor(s,i);(!a||("get"in a?!s.__esModule:a.writable||a.configurable))&&(a={enumerable:!0,get:function(){return s[i]}}),Object.defineProperty(n,o,a)}:function(n,s,i,o){o===void 0&&(o=i),n[o]=s[i]}),r=k&&k.__exportStar||function(n,s){for(var i in n)i!=="default"&&!Object.prototype.hasOwnProperty.call(s,i)&&e(s,n,i)};Object.defineProperty(t,"__esModule",{value:!0}),r(se,t),r(dr,t),r(F,t),r(hn,t),r(xe,t),r(Mt,t),r(aa,t),r(hr,t),r(ca,t),r(la,t),r(Tt,t),r(ua,t),r(je,t),r(da,t),r(ha,t),r(fa,t),r(ga,t)})(Uo);(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.createModuleLogger=t.projectLogger=void 0;const e=Uo;Object.defineProperty(t,"createModuleLogger",{enumerable:!0,get:function(){return e.createModuleLogger}}),t.projectLogger=(0,e.createProjectLogger)("eth-block-tracker")})(Ho);var Sa=k&&k.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(un,"__esModule",{value:!0});un.PollingBlockTracker=void 0;const Q0=Sa(ys),X0=Sa(gu),K0=ar,Vi=Ho,Wi=(0,Vi.createModuleLogger)(Vi.projectLogger,"polling-block-tracker"),Y0=(0,Q0.default)(),eg=1e3;class tg extends K0.BaseBlockTracker{constructor(e={}){var r;if(!e.provider)throw new Error("PollingBlockTracker - no provider specified.");super(Object.assign(Object.assign({},e),{blockResetDuration:(r=e.blockResetDuration)!==null&&r!==void 0?r:e.pollingInterval})),this._provider=e.provider,this._pollingInterval=e.pollingInterval||20*eg,this._retryTimeout=e.retryTimeout||this._pollingInterval/10,this._keepEventLoopActive=e.keepEventLoopActive===void 0?!0:e.keepEventLoopActive,this._setSkipCacheFlag=e.setSkipCacheFlag||!1}async checkForLatestBlock(){return await this._updateLatestBlock(),await this.getLatestBlock()}async _start(){this._synchronize()}async _end(){}async _synchronize(){for(var e;this._isRunning;)try{await this._updateLatestBlock();const r=zi(this._pollingInterval,!this._keepEventLoopActive);this.emit("_waitingForNextIteration"),await r}catch(r){const n=new Error(`PollingBlockTracker - encountered an error while attempting to update latest block: -${(e=r.stack)!==null&&e!==void 0?e:r}`);try{this.emit("error",n)}catch{console.error(n)}const s=zi(this._retryTimeout,!this._keepEventLoopActive);this.emit("_waitingForNextIteration"),await s}}async _updateLatestBlock(){const e=await this._fetchLatestBlock();this._newPotentialLatest(e)}async _fetchLatestBlock(){const e={jsonrpc:"2.0",id:Y0(),method:"eth_blockNumber",params:[]};this._setSkipCacheFlag&&(e.skipCache=!0),Wi("Making request",e);const r=await(0,X0.default)(n=>this._provider.sendAsync(e,n))();if(Wi("Got response",r),r.error)throw new Error(`PollingBlockTracker - encountered error fetching block: -${r.error.message}`);return r.result}}un.PollingBlockTracker=tg;function zi(t,e){return new Promise(r=>{const n=setTimeout(r,t);n.unref&&e&&n.unref()})}var wn={},rg=k&&k.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(wn,"__esModule",{value:!0});wn.SubscribeBlockTracker=void 0;const ng=rg(ys),sg=ar,ig=(0,ng.default)();class og extends sg.BaseBlockTracker{constructor(e={}){if(!e.provider)throw new Error("SubscribeBlockTracker - no provider specified.");super(e),this._provider=e.provider,this._subscriptionId=null}async checkForLatestBlock(){return await this.getLatestBlock()}async _start(){if(this._subscriptionId===void 0||this._subscriptionId===null)try{const e=await this._call("eth_blockNumber");this._subscriptionId=await this._call("eth_subscribe","newHeads"),this._provider.on("data",this._handleSubData.bind(this)),this._newPotentialLatest(e)}catch(e){this.emit("error",e)}}async _end(){if(this._subscriptionId!==null&&this._subscriptionId!==void 0)try{await this._call("eth_unsubscribe",this._subscriptionId),this._subscriptionId=null}catch(e){this.emit("error",e)}}_call(e,...r){return new Promise((n,s)=>{this._provider.sendAsync({id:ig(),method:e,params:r,jsonrpc:"2.0"},(i,o)=>{i?s(i):n(o.result)})})}_handleSubData(e,r){var n;r.method==="eth_subscription"&&((n=r.params)===null||n===void 0?void 0:n.subscription)===this._subscriptionId&&this._newPotentialLatest(r.params.result.number)}}wn.SubscribeBlockTracker=og;(function(t){var e=k&&k.__createBinding||(Object.create?function(n,s,i,o){o===void 0&&(o=i),Object.defineProperty(n,o,{enumerable:!0,get:function(){return s[i]}})}:function(n,s,i,o){o===void 0&&(o=i),n[o]=s[i]}),r=k&&k.__exportStar||function(n,s){for(var i in n)i!=="default"&&!Object.prototype.hasOwnProperty.call(s,i)&&e(s,n,i)};Object.defineProperty(t,"__esModule",{value:!0}),r(un,t),r(wn,t)})(Do);var $s={},vn={},gr={};Object.defineProperty(gr,"__esModule",{value:!0});gr.getUniqueId=void 0;const Ca=4294967295;let Gn=Math.floor(Math.random()*Ca);function ag(){return Gn=(Gn+1)%Ca,Gn}gr.getUniqueId=ag;Object.defineProperty(vn,"__esModule",{value:!0});vn.createIdRemapMiddleware=void 0;const cg=gr;function lg(){return(t,e,r,n)=>{const s=t.id,i=cg.getUniqueId();t.id=i,e.id=i,r(o=>{t.id=s,e.id=s,o()})}}vn.createIdRemapMiddleware=lg;var En={};Object.defineProperty(En,"__esModule",{value:!0});En.createAsyncMiddleware=void 0;function ug(t){return async(e,r,n,s)=>{let i;const o=new Promise(u=>{i=u});let a=null,l=!1;const c=async()=>{l=!0,n(u=>{a=u,i()}),await o};try{await t(e,r,c),l?(await o,a(null)):s(null)}catch(u){a?a(u):s(u)}}}En.createAsyncMiddleware=ug;var _n={};Object.defineProperty(_n,"__esModule",{value:!0});_n.createScaffoldMiddleware=void 0;function dg(t){return(e,r,n,s)=>{const i=t[e.method];return i===void 0?n():typeof i=="function"?i(e,r,n,s):(r.result=i,s())}}_n.createScaffoldMiddleware=dg;var pr={},xs={};Object.defineProperty(xs,"__esModule",{value:!0});const hg=oo;function Ji(t,e,r){try{Reflect.apply(t,e,r)}catch(n){setTimeout(()=>{throw n})}}function fg(t){const e=t.length,r=new Array(e);for(let n=0;n0&&([o]=r),o instanceof Error)throw o;const a=new Error(`Unhandled error.${o?` (${o.message})`:""}`);throw a.context=o,a}const i=s[e];if(i===void 0)return!1;if(typeof i=="function")Ji(i,this,r);else{const o=i.length,a=fg(i);for(let l=0;l"u"&&(n=Ia()),ss(t,"",0,[],void 0,0,n);var s;try{st.length===0?s=JSON.stringify(t,e,r):s=JSON.stringify(t,Na(e),r)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;ct.length!==0;){var i=ct.pop();i.length===4?Object.defineProperty(i[0],i[1],i[3]):i[0][i[1]]=i[2]}}return s}function Rt(t,e,r,n){var s=Object.getOwnPropertyDescriptor(n,r);s.get!==void 0?s.configurable?(Object.defineProperty(n,r,{value:t}),ct.push([n,r,e,s])):st.push([e,r,t]):(n[r]=t,ct.push([n,r,e]))}function ss(t,e,r,n,s,i,o){i+=1;var a;if(typeof t=="object"&&t!==null){for(a=0;ao.depthLimit){Rt(Or,t,e,s);return}if(typeof o.edgesLimit<"u"&&r+1>o.edgesLimit){Rt(Or,t,e,s);return}if(n.push(t),Array.isArray(t))for(a=0;ae?1:0}function Aa(t,e,r,n){typeof n>"u"&&(n=Ia());var s=is(t,"",0,[],void 0,0,n)||t,i;try{st.length===0?i=JSON.stringify(s,e,r):i=JSON.stringify(s,Na(e),r)}catch{return JSON.stringify("[unable to serialize, circular reference is too complex to analyze]")}finally{for(;ct.length!==0;){var o=ct.pop();o.length===4?Object.defineProperty(o[0],o[1],o[3]):o[0][o[1]]=o[2]}}return i}function is(t,e,r,n,s,i,o){i+=1;var a;if(typeof t=="object"&&t!==null){for(a=0;ao.depthLimit){Rt(Or,t,e,s);return}if(typeof o.edgesLimit<"u"&&r+1>o.edgesLimit){Rt(Or,t,e,s);return}if(n.push(t),Array.isArray(t))for(a=0;a0)for(var n=0;n=1e3&&t<=4999}function vg(t,e){if(e!=="[Circular]")return e}var js={},Ge={};Object.defineProperty(Ge,"__esModule",{value:!0});Ge.errorValues=Ge.errorCodes=void 0;Ge.errorCodes={rpc:{invalidInput:-32e3,resourceNotFound:-32001,resourceUnavailable:-32002,transactionRejected:-32003,methodNotSupported:-32004,limitExceeded:-32005,parse:-32700,invalidRequest:-32600,methodNotFound:-32601,invalidParams:-32602,internal:-32603},provider:{userRejectedRequest:4001,unauthorized:4100,unsupportedMethod:4200,disconnected:4900,chainDisconnected:4901}};Ge.errorValues={"-32700":{standard:"JSON RPC 2.0",message:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."},"-32600":{standard:"JSON RPC 2.0",message:"The JSON sent is not a valid Request object."},"-32601":{standard:"JSON RPC 2.0",message:"The method does not exist / is not available."},"-32602":{standard:"JSON RPC 2.0",message:"Invalid method parameter(s)."},"-32603":{standard:"JSON RPC 2.0",message:"Internal JSON-RPC error."},"-32000":{standard:"EIP-1474",message:"Invalid input."},"-32001":{standard:"EIP-1474",message:"Resource not found."},"-32002":{standard:"EIP-1474",message:"Resource unavailable."},"-32003":{standard:"EIP-1474",message:"Transaction rejected."},"-32004":{standard:"EIP-1474",message:"Method not supported."},"-32005":{standard:"EIP-1474",message:"Request limit exceeded."},4001:{standard:"EIP-1193",message:"User rejected the request."},4100:{standard:"EIP-1193",message:"The requested account and/or method has not been authorized by the user."},4200:{standard:"EIP-1193",message:"The requested method is not supported by this Ethereum provider."},4900:{standard:"EIP-1193",message:"The provider is disconnected from all chains."},4901:{standard:"EIP-1193",message:"The provider is disconnected from the specified chain."}};(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.serializeError=t.isValidCode=t.getMessageFromCode=t.JSON_RPC_SERVER_ERROR_MESSAGE=void 0;const e=Ge,r=qe,n=e.errorCodes.rpc.internal,s="Unspecified error message. This is a bug, please report it.",i={code:n,message:o(n)};t.JSON_RPC_SERVER_ERROR_MESSAGE="Unspecified server error.";function o(h,f=s){if(Number.isInteger(h)){const g=h.toString();if(d(e.errorValues,g))return e.errorValues[g].message;if(c(h))return t.JSON_RPC_SERVER_ERROR_MESSAGE}return f}t.getMessageFromCode=o;function a(h){if(!Number.isInteger(h))return!1;const f=h.toString();return!!(e.errorValues[f]||c(h))}t.isValidCode=a;function l(h,{fallbackError:f=i,shouldIncludeStack:g=!1}={}){var b,p;if(!f||!Number.isInteger(f.code)||typeof f.message!="string")throw new Error("Must provide fallback error with integer number code and string message.");if(h instanceof r.EthereumRpcError)return h.serialize();const _={};if(h&&typeof h=="object"&&!Array.isArray(h)&&d(h,"code")&&a(h.code)){const m=h;_.code=m.code,m.message&&typeof m.message=="string"?(_.message=m.message,d(m,"data")&&(_.data=m.data)):(_.message=o(_.code),_.data={originalError:u(h)})}else{_.code=f.code;const m=(b=h)===null||b===void 0?void 0:b.message;_.message=m&&typeof m=="string"?m:f.message,_.data={originalError:u(h)}}const y=(p=h)===null||p===void 0?void 0:p.stack;return g&&h&&y&&typeof y=="string"&&(_.stack=y),_}t.serializeError=l;function c(h){return h>=-32099&&h<=-32e3}function u(h){return h&&typeof h=="object"&&!Array.isArray(h)?Object.assign({},h):h}function d(h,f){return Object.prototype.hasOwnProperty.call(h,f)}})(js);var Sn={};Object.defineProperty(Sn,"__esModule",{value:!0});Sn.ethErrors=void 0;const Fs=qe,Ta=js,oe=Ge;Sn.ethErrors={rpc:{parse:t=>we(oe.errorCodes.rpc.parse,t),invalidRequest:t=>we(oe.errorCodes.rpc.invalidRequest,t),invalidParams:t=>we(oe.errorCodes.rpc.invalidParams,t),methodNotFound:t=>we(oe.errorCodes.rpc.methodNotFound,t),internal:t=>we(oe.errorCodes.rpc.internal,t),server:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:e}=t;if(!Number.isInteger(e)||e>-32005||e<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return we(e,t)},invalidInput:t=>we(oe.errorCodes.rpc.invalidInput,t),resourceNotFound:t=>we(oe.errorCodes.rpc.resourceNotFound,t),resourceUnavailable:t=>we(oe.errorCodes.rpc.resourceUnavailable,t),transactionRejected:t=>we(oe.errorCodes.rpc.transactionRejected,t),methodNotSupported:t=>we(oe.errorCodes.rpc.methodNotSupported,t),limitExceeded:t=>we(oe.errorCodes.rpc.limitExceeded,t)},provider:{userRejectedRequest:t=>Wt(oe.errorCodes.provider.userRejectedRequest,t),unauthorized:t=>Wt(oe.errorCodes.provider.unauthorized,t),unsupportedMethod:t=>Wt(oe.errorCodes.provider.unsupportedMethod,t),disconnected:t=>Wt(oe.errorCodes.provider.disconnected,t),chainDisconnected:t=>Wt(oe.errorCodes.provider.chainDisconnected,t),custom:t=>{if(!t||typeof t!="object"||Array.isArray(t))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:e,message:r,data:n}=t;if(!r||typeof r!="string")throw new Error('"message" must be a nonempty string');return new Fs.EthereumProviderError(e,r,n)}}};function we(t,e){const[r,n]=La(e);return new Fs.EthereumRpcError(t,r||Ta.getMessageFromCode(t),n)}function Wt(t,e){const[r,n]=La(e);return new Fs.EthereumProviderError(t,r||Ta.getMessageFromCode(t),n)}function La(t){if(t){if(typeof t=="string")return[t];if(typeof t=="object"&&!Array.isArray(t)){const{message:e,data:r}=t;if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,r]}}return[]}(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.getMessageFromCode=t.serializeError=t.EthereumProviderError=t.EthereumRpcError=t.ethErrors=t.errorCodes=void 0;const e=qe;Object.defineProperty(t,"EthereumRpcError",{enumerable:!0,get:function(){return e.EthereumRpcError}}),Object.defineProperty(t,"EthereumProviderError",{enumerable:!0,get:function(){return e.EthereumProviderError}});const r=js;Object.defineProperty(t,"serializeError",{enumerable:!0,get:function(){return r.serializeError}}),Object.defineProperty(t,"getMessageFromCode",{enumerable:!0,get:function(){return r.getMessageFromCode}});const n=Sn;Object.defineProperty(t,"ethErrors",{enumerable:!0,get:function(){return n.ethErrors}});const s=Ge;Object.defineProperty(t,"errorCodes",{enumerable:!0,get:function(){return s.errorCodes}})})(Ra);var Eg=k&&k.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(pr,"__esModule",{value:!0});pr.JsonRpcEngine=void 0;const _g=Eg(xs),ve=Ra;class Be extends _g.default{constructor(){super(),this._middleware=[]}push(e){this._middleware.push(e)}handle(e,r){if(r&&typeof r!="function")throw new Error('"callback" must be a function if provided.');return Array.isArray(e)?r?this._handleBatch(e,r):this._handleBatch(e):r?this._handle(e,r):this._promiseHandle(e)}asMiddleware(){return async(e,r,n,s)=>{try{const[i,o,a]=await Be._runAllMiddleware(e,r,this._middleware);return o?(await Be._runReturnHandlers(a),s(i)):n(async l=>{try{await Be._runReturnHandlers(a)}catch(c){return l(c)}return l()})}catch(i){return s(i)}}}async _handleBatch(e,r){try{const n=await Promise.all(e.map(this._promiseHandle.bind(this)));return r?r(null,n):n}catch(n){if(r)return r(n);throw n}}_promiseHandle(e){return new Promise(r=>{this._handle(e,(n,s)=>{r(s)})})}async _handle(e,r){if(!e||Array.isArray(e)||typeof e!="object"){const o=new ve.EthereumRpcError(ve.errorCodes.rpc.invalidRequest,`Requests must be plain objects. Received: ${typeof e}`,{request:e});return r(o,{id:void 0,jsonrpc:"2.0",error:o})}if(typeof e.method!="string"){const o=new ve.EthereumRpcError(ve.errorCodes.rpc.invalidRequest,`Must specify a string method. Received: ${typeof e.method}`,{request:e});return r(o,{id:e.id,jsonrpc:"2.0",error:o})}const n=Object.assign({},e),s={id:n.id,jsonrpc:n.jsonrpc};let i=null;try{await this._processRequest(n,s)}catch(o){i=o}return i&&(delete s.result,s.error||(s.error=ve.serializeError(i))),r(i,s)}async _processRequest(e,r){const[n,s,i]=await Be._runAllMiddleware(e,r,this._middleware);if(Be._checkForCompletion(e,r,s),await Be._runReturnHandlers(i),n)throw n}static async _runAllMiddleware(e,r,n){const s=[];let i=null,o=!1;for(const a of n)if([i,o]=await Be._runMiddleware(e,r,a,s),o)break;return[i,o,s.reverse()]}static _runMiddleware(e,r,n,s){return new Promise(i=>{const o=l=>{const c=l||r.error;c&&(r.error=ve.serializeError(c)),i([c,!0])},a=l=>{r.error?o(r.error):(l&&(typeof l!="function"&&o(new ve.EthereumRpcError(ve.errorCodes.rpc.internal,`JsonRpcEngine: "next" return handlers must be functions. Received "${typeof l}" for request: -${Zn(e)}`,{request:e})),s.push(l)),i([null,!1]))};try{n(e,r,a,o)}catch(l){o(l)}})}static async _runReturnHandlers(e){for(const r of e)await new Promise((n,s)=>{r(i=>i?s(i):n())})}static _checkForCompletion(e,r,n){if(!("result"in r)&&!("error"in r))throw new ve.EthereumRpcError(ve.errorCodes.rpc.internal,`JsonRpcEngine: Response has no error or result for request: -${Zn(e)}`,{request:e});if(!n)throw new ve.EthereumRpcError(ve.errorCodes.rpc.internal,`JsonRpcEngine: Nothing ended request: -${Zn(e)}`,{request:e})}}pr.JsonRpcEngine=Be;function Zn(t){return JSON.stringify(t,null,2)}var Cn={};Object.defineProperty(Cn,"__esModule",{value:!0});Cn.mergeMiddleware=void 0;const Sg=pr;function Cg(t){const e=new Sg.JsonRpcEngine;return t.forEach(r=>e.push(r)),e.asMiddleware()}Cn.mergeMiddleware=Cg;(function(t){var e=k&&k.__createBinding||(Object.create?function(n,s,i,o){o===void 0&&(o=i),Object.defineProperty(n,o,{enumerable:!0,get:function(){return s[i]}})}:function(n,s,i,o){o===void 0&&(o=i),n[o]=s[i]}),r=k&&k.__exportStar||function(n,s){for(var i in n)i!=="default"&&!Object.prototype.hasOwnProperty.call(s,i)&&e(s,n,i)};Object.defineProperty(t,"__esModule",{value:!0}),r(vn,t),r(En,t),r(_n,t),r(gr,t),r(pr,t),r(Cn,t)})($s);var Oa={},Bs={},os=function(t,e){return os=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(r,n){r.__proto__=n}||function(r,n){for(var s in n)Object.prototype.hasOwnProperty.call(n,s)&&(r[s]=n[s])},os(t,e)};function Pa(t,e){if(typeof e!="function"&&e!==null)throw new TypeError("Class extends value "+String(e)+" is not a constructor or null");os(t,e);function r(){this.constructor=t}t.prototype=e===null?Object.create(e):(r.prototype=e.prototype,new r)}var Pr=function(){return Pr=Object.assign||function(e){for(var r,n=1,s=arguments.length;n=0;a--)(o=t[a])&&(i=(s<3?o(i):s>3?o(e,r,i):o(e,r))||i);return s>3&&i&&Object.defineProperty(e,r,i),i}function ja(t,e){return function(r,n){e(r,n,t)}}function Rg(t,e,r,n,s,i){function o(_){if(_!==void 0&&typeof _!="function")throw new TypeError("Function expected");return _}for(var a=n.kind,l=a==="getter"?"get":a==="setter"?"set":"value",c=!e&&t?n.static?t:t.prototype:null,u=e||(c?Object.getOwnPropertyDescriptor(c,n.name):{}),d,h=!1,f=r.length-1;f>=0;f--){var g={};for(var b in n)g[b]=b==="access"?{}:n[b];for(var b in n.access)g.access[b]=n.access[b];g.addInitializer=function(_){if(h)throw new TypeError("Cannot add initializers after decoration has completed");i.push(o(_||null))};var p=(0,r[f])(a==="accessor"?{get:u.get,set:u.set}:u[l],g);if(a==="accessor"){if(p===void 0)continue;if(p===null||typeof p!="object")throw new TypeError("Object expected");(d=o(p.get))&&(u.get=d),(d=o(p.set))&&(u.set=d),(d=o(p.init))&&s.unshift(d)}else(d=o(p))&&(a==="field"?s.unshift(d):u[l]=d)}c&&Object.defineProperty(c,n.name,u),h=!0}function kg(t,e,r){for(var n=arguments.length>2,s=0;s0&&i[i.length-1])&&(c[0]===6||c[0]===2)){r=0;continue}if(c[0]===3&&(!i||c[1]>i[0]&&c[1]=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function Ds(t,e){var r=typeof Symbol=="function"&&t[Symbol.iterator];if(!r)return t;var n=r.call(t),s,i=[],o;try{for(;(e===void 0||e-- >0)&&!(s=n.next()).done;)i.push(s.value)}catch(a){o={error:a}}finally{try{s&&!s.done&&(r=n.return)&&r.call(n)}finally{if(o)throw o.error}}return i}function Ua(){for(var t=[],e=0;e1||a(h,f)})})}function a(h,f){try{l(n[h](f))}catch(g){d(i[0][3],g)}}function l(h){h.value instanceof Lt?Promise.resolve(h.value.v).then(c,u):d(i[0][2],h)}function c(h){a("next",h)}function u(h){a("throw",h)}function d(h,f){h(f),i.shift(),i.length&&a(i[0][0],i[0][1])}}function Ja(t){var e,r;return e={},n("next"),n("throw",function(s){throw s}),n("return"),e[Symbol.iterator]=function(){return this},e;function n(s,i){e[s]=t[s]?function(o){return(r=!r)?{value:Lt(t[s](o)),done:!1}:i?i(o):o}:i}}function qa(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=t[Symbol.asyncIterator],r;return e?e.call(t):(t=typeof $r=="function"?$r(t):t[Symbol.iterator](),r={},n("next"),n("throw"),n("return"),r[Symbol.asyncIterator]=function(){return this},r);function n(i){r[i]=t[i]&&function(o){return new Promise(function(a,l){o=t[i](o),s(a,l,o.done,o.value)})}}function s(i,o,a,l){Promise.resolve(l).then(function(c){i({value:c,done:a})},o)}}function Ga(t,e){return Object.defineProperty?Object.defineProperty(t,"raw",{value:e}):t.raw=e,t}var Ng=Object.create?function(t,e){Object.defineProperty(t,"default",{enumerable:!0,value:e})}:function(t,e){t.default=e};function Za(t){if(t&&t.__esModule)return t;var e={};if(t!=null)for(var r in t)r!=="default"&&Object.prototype.hasOwnProperty.call(t,r)&&Rn(e,t,r);return Ng(e,t),e}function Qa(t){return t&&t.__esModule?t:{default:t}}function Xa(t,e,r,n){if(r==="a"&&!n)throw new TypeError("Private accessor was defined without a getter");if(typeof e=="function"?t!==e||!n:!e.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return r==="m"?n:r==="a"?n.call(t):n?n.value:e.get(t)}function Ka(t,e,r,n,s){if(n==="m")throw new TypeError("Private method is not writable");if(n==="a"&&!s)throw new TypeError("Private accessor was defined without a setter");if(typeof e=="function"?t!==e||!s:!e.has(t))throw new TypeError("Cannot write private member to an object whose class did not declare it");return n==="a"?s.call(t,r):s?s.value=r:e.set(t,r),r}function Ya(t,e){if(e===null||typeof e!="object"&&typeof e!="function")throw new TypeError("Cannot use 'in' operator on non-object");return typeof t=="function"?e===t:t.has(e)}function ec(t,e,r){if(e!=null){if(typeof e!="object"&&typeof e!="function")throw new TypeError("Object expected.");var n;if(r){if(!Symbol.asyncDispose)throw new TypeError("Symbol.asyncDispose is not defined.");n=e[Symbol.asyncDispose]}if(n===void 0){if(!Symbol.dispose)throw new TypeError("Symbol.dispose is not defined.");n=e[Symbol.dispose]}if(typeof n!="function")throw new TypeError("Object not disposable.");t.stack.push({value:e,dispose:n,async:r})}else r&&t.stack.push({async:!0});return e}var Mg=typeof SuppressedError=="function"?SuppressedError:function(t,e,r){var n=new Error(r);return n.name="SuppressedError",n.error=t,n.suppressed=e,n};function tc(t){function e(n){t.error=t.hasError?new Mg(n,t.error,"An error was suppressed during disposal."):n,t.hasError=!0}function r(){for(;t.stack.length;){var n=t.stack.pop();try{var s=n.dispose&&n.dispose.call(n.value);if(n.async)return Promise.resolve(s).then(r,function(i){return e(i),r()})}catch(i){e(i)}}if(t.hasError)throw t.error}return r()}const Tg={__extends:Pa,__assign:Pr,__rest:$a,__decorate:xa,__param:ja,__metadata:Fa,__awaiter:Ba,__generator:Da,__createBinding:Rn,__exportStar:Ha,__values:$r,__read:Ds,__spread:Ua,__spreadArrays:Va,__spreadArray:Wa,__await:Lt,__asyncGenerator:za,__asyncDelegator:Ja,__asyncValues:qa,__makeTemplateObject:Ga,__importStar:Za,__importDefault:Qa,__classPrivateFieldGet:Xa,__classPrivateFieldSet:Ka,__classPrivateFieldIn:Ya,__addDisposableResource:ec,__disposeResources:tc},Lg=Object.freeze(Object.defineProperty({__proto__:null,__addDisposableResource:ec,get __assign(){return Pr},__asyncDelegator:Ja,__asyncGenerator:za,__asyncValues:qa,__await:Lt,__awaiter:Ba,__classPrivateFieldGet:Xa,__classPrivateFieldIn:Ya,__classPrivateFieldSet:Ka,__createBinding:Rn,__decorate:xa,__disposeResources:tc,__esDecorate:Rg,__exportStar:Ha,__extends:Pa,__generator:Da,__importDefault:Qa,__importStar:Za,__makeTemplateObject:Ga,__metadata:Fa,__param:ja,__propKey:Ig,__read:Ds,__rest:$a,__runInitializers:kg,__setFunctionName:Ag,__spread:Ua,__spreadArray:Wa,__spreadArrays:Va,__values:$r,default:Tg},Symbol.toStringTag,{value:"Module"})),Hs=io(Lg);var kn={};Object.defineProperty(kn,"__esModule",{value:!0});var qi=Hs,Og=function(){function t(e){if(this._maxConcurrency=e,this._queue=[],e<=0)throw new Error("semaphore must be initialized to a positive value");this._value=e}return t.prototype.acquire=function(){var e=this,r=this.isLocked(),n=new Promise(function(s){return e._queue.push(s)});return r||this._dispatch(),n},t.prototype.runExclusive=function(e){return qi.__awaiter(this,void 0,void 0,function(){var r,n,s;return qi.__generator(this,function(i){switch(i.label){case 0:return[4,this.acquire()];case 1:r=i.sent(),n=r[0],s=r[1],i.label=2;case 2:return i.trys.push([2,,4,5]),[4,e(n)];case 3:return[2,i.sent()];case 4:return s(),[7];case 5:return[2]}})})},t.prototype.isLocked=function(){return this._value<=0},t.prototype.release=function(){if(this._maxConcurrency>1)throw new Error("this method is unavailabel on semaphores with concurrency > 1; use the scoped release returned by acquire instead");if(this._currentReleaser){var e=this._currentReleaser;this._currentReleaser=void 0,e()}},t.prototype._dispatch=function(){var e=this,r=this._queue.shift();if(r){var n=!1;this._currentReleaser=function(){n||(n=!0,e._value++,e._dispatch())},r([this._value--,this._currentReleaser])}},t}();kn.default=Og;Object.defineProperty(Bs,"__esModule",{value:!0});var Gi=Hs,Pg=kn,$g=function(){function t(){this._semaphore=new Pg.default(1)}return t.prototype.acquire=function(){return Gi.__awaiter(this,void 0,void 0,function(){var e,r;return Gi.__generator(this,function(n){switch(n.label){case 0:return[4,this._semaphore.acquire()];case 1:return e=n.sent(),r=e[1],[2,r]}})})},t.prototype.runExclusive=function(e){return this._semaphore.runExclusive(function(){return e()})},t.prototype.isLocked=function(){return this._semaphore.isLocked()},t.prototype.release=function(){this._semaphore.release()},t}();Bs.default=$g;var In={};Object.defineProperty(In,"__esModule",{value:!0});In.withTimeout=void 0;var Ar=Hs;function xg(t,e,r){var n=this;return r===void 0&&(r=new Error("timeout")),{acquire:function(){return new Promise(function(s,i){return Ar.__awaiter(n,void 0,void 0,function(){var o,a,l;return Ar.__generator(this,function(c){switch(c.label){case 0:return o=!1,setTimeout(function(){o=!0,i(r)},e),[4,t.acquire()];case 1:return a=c.sent(),o?(l=Array.isArray(a)?a[1]:a,l()):s(a),[2]}})})})},runExclusive:function(s){return Ar.__awaiter(this,void 0,void 0,function(){var i,o;return Ar.__generator(this,function(a){switch(a.label){case 0:i=function(){},a.label=1;case 1:return a.trys.push([1,,7,8]),[4,this.acquire()];case 2:return o=a.sent(),Array.isArray(o)?(i=o[1],[4,s(o[0])]):[3,4];case 3:return[2,a.sent()];case 4:return i=o,[4,s()];case 5:return[2,a.sent()];case 6:return[3,8];case 7:return i(),[7];case 8:return[2]}})})},release:function(){t.release()},isLocked:function(){return t.isLocked()}}}In.withTimeout=xg;(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.withTimeout=t.Semaphore=t.Mutex=void 0;var e=Bs;Object.defineProperty(t,"Mutex",{enumerable:!0,get:function(){return e.default}});var r=kn;Object.defineProperty(t,"Semaphore",{enumerable:!0,get:function(){return r.default}});var n=In;Object.defineProperty(t,"withTimeout",{enumerable:!0,get:function(){return n.withTimeout}})})(Oa);var jg=Bg,Fg=Object.prototype.hasOwnProperty;function Bg(){for(var t={},e=0;efunction(...s){const i=e.promiseModule;return new i((o,a)=>{e.multiArgs?s.push((...c)=>{e.errorFirst?c[0]?a(c):(c.shift(),o(c)):o(c)}):e.errorFirst?s.push((c,u)=>{c?a(c):o(u)}):s.push(o),Reflect.apply(t,this===r?n:this,s)})},Qi=new WeakMap;var Wg=(t,e)=>{e={exclude:[/.+(?:Sync|Stream)$/],errorFirst:!0,promiseModule:Promise,...e};const r=typeof t;if(!(t!==null&&(r==="object"||r==="function")))throw new TypeError(`Expected \`input\` to be a \`Function\` or \`Object\`, got \`${t===null?"null":r}\``);const n=(o,a)=>{let l=Qi.get(o);if(l||(l={},Qi.set(o,l)),a in l)return l[a];const c=g=>typeof g=="string"||typeof a=="symbol"?a===g:g.test(a),u=Reflect.getOwnPropertyDescriptor(o,a),d=u===void 0||u.writable||u.configurable,f=(e.include?e.include.some(c):!e.exclude.some(c))&&d;return l[a]=f,f},s=new WeakMap,i=new Proxy(t,{apply(o,a,l){const c=s.get(o);if(c)return Reflect.apply(c,a,l);const u=e.excludeMain?o:Zi(o,e,i,o);return s.set(o,u),Reflect.apply(u,a,l)},get(o,a){const l=o[a];if(!n(o,a)||l===Function.prototype[a])return l;const c=s.get(l);if(c)return c;if(typeof l=="function"){const u=Zi(l,e,i,o);return s.set(l,u),u}return l}});return i};const zg=cr.default;let Jg=class extends zg{constructor(){super(),this.updates=[]}async initialize(){}async update(){throw new Error("BaseFilter - no update method specified")}addResults(e){this.updates=this.updates.concat(e),e.forEach(r=>this.emit("update",r))}addInitialResults(e){}getChangesAndClear(){const e=this.updates;return this.updates=[],e}};var Us=Jg;const qg=Us;let Gg=class extends qg{constructor(){super(),this.allResults=[]}async update(){throw new Error("BaseFilterWithHistory - no update method specified")}addResults(e){this.allResults=this.allResults.concat(e),super.addResults(e)}addInitialResults(e){this.allResults=this.allResults.concat(e),super.addInitialResults(e)}getAllResults(){return this.allResults}};var Zg=Gg,br={minBlockRef:Qg,maxBlockRef:Xg,sortBlockRefs:Vs,bnToHex:Kg,blockRefIsNumber:Yg,hexToInt:xr,incrementHexInt:ep,intToHex:rc,unsafeRandomBytes:tp};function Qg(...t){return Vs(t)[0]}function Xg(...t){const e=Vs(t);return e[e.length-1]}function Vs(t){return t.sort((e,r)=>e==="latest"||r==="earliest"?1:r==="latest"||e==="earliest"?-1:xr(e)-xr(r))}function Kg(t){return"0x"+t.toString(16)}function Yg(t){return t&&!["earliest","latest","pending"].includes(t)}function xr(t){return t==null?t:Number.parseInt(t,16)}function ep(t){if(t==null)return t;const e=xr(t);return rc(e+1)}function rc(t){if(t==null)return t;let e=t.toString(16);return e.length%2&&(e="0"+e),"0x"+e}function tp(t){let e="0x";for(let r=0;rn.toLowerCase()))}async initialize({currentBlock:e}){let r=this.params.fromBlock;["latest","pending"].includes(r)&&(r=e),r==="earliest"&&(r="0x0"),this.params.fromBlock=r;const n=op(this.params.toBlock,e),s=Object.assign({},this.params,{toBlock:n}),i=await this._fetchLogs(s);this.addInitialResults(i)}async update({oldBlock:e,newBlock:r}){const n=r;let s;e?s=ip(e):s=r;const i=Object.assign({},this.params,{fromBlock:s,toBlock:n}),a=(await this._fetchLogs(i)).filter(l=>this.matchLog(l));this.addResults(a)}async _fetchLogs(e){return await np(n=>this.ethQuery.getLogs(e,n))()}matchLog(e){if(Nr(this.params.fromBlock)>=Nr(e.blockNumber)||ap(this.params.toBlock)&&Nr(this.params.toBlock)<=Nr(e.blockNumber))return!1;const r=e.address&&e.address.toLowerCase();return this.params.address&&r&&!this.params.address.includes(r)?!1:this.params.topics.every((s,i)=>{let o=e.topics[i];if(!o)return!1;o=o.toLowerCase();let a=Array.isArray(s)?s:[s];return a.includes(null)?!0:(a=a.map(u=>u.toLowerCase()),a.includes(o))})}};var lp=cp,Ws=up;async function up({provider:t,fromBlock:e,toBlock:r}){e||(e=r);const n=Ki(e),i=Ki(r)-n+1,o=Array(i).fill().map((l,c)=>n+c).map(dp);let a=await Promise.all(o.map(l=>fp(t,"eth_getBlockByNumber",[l,!1])));return a=a.filter(l=>l!==null),a}function Ki(t){return t==null?t:Number.parseInt(t,16)}function dp(t){return t==null?t:"0x"+t.toString(16)}function hp(t,e){return new Promise((r,n)=>{t.sendAsync(e,(s,i)=>{s?n(s):i.error?n(i.error):i.result?r(i.result):n(new Error("Result was empty"))})})}async function fp(t,e,r){for(let n=0;n<3;n++)try{return await hp(t,{id:1,jsonrpc:"2.0",method:e,params:r})}catch(s){console.error(`provider.sendAsync failed: ${s.stack||s.message||s}`)}return null}const gp=Us,pp=Ws,{incrementHexInt:mp}=br;let bp=class extends gp{constructor({provider:e,params:r}){super(),this.type="block",this.provider=e}async update({oldBlock:e,newBlock:r}){const n=r,s=mp(e),o=(await pp({provider:this.provider,fromBlock:s,toBlock:n})).map(a=>a.hash);this.addResults(o)}};var yp=bp;const wp=Us,vp=Ws,{incrementHexInt:Ep}=br;let _p=class extends wp{constructor({provider:e}){super(),this.type="tx",this.provider=e}async update({oldBlock:e}){const r=e,n=Ep(e),s=await vp({provider:this.provider,fromBlock:n,toBlock:r}),i=[];for(const o of s)i.push(...o.transactions);this.addResults(i)}};var Sp=_p;const Cp=Oa.Mutex,{createAsyncMiddleware:Rp,createScaffoldMiddleware:kp}=$s,Ip=lp,Ap=yp,Np=Sp,{intToHex:nc,hexToInt:Qn}=br;var Mp=Tp;function Tp({blockTracker:t,provider:e}){let r=0,n={};const s=new Cp,i=Lp({mutex:s}),o=kp({eth_newFilter:i(Xn(l)),eth_newBlockFilter:i(Xn(c)),eth_newPendingTransactionFilter:i(Xn(u)),eth_uninstallFilter:i(Tr(f)),eth_getFilterChanges:i(Tr(d)),eth_getFilterLogs:i(Tr(h))}),a=async({oldBlock:y,newBlock:m})=>{if(n.length===0)return;const $=await s.acquire();try{await Promise.all(yt(n).map(async v=>{try{await v.update({oldBlock:y,newBlock:m})}catch(M){console.error(M)}}))}catch(v){console.error(v)}$()};return o.newLogFilter=l,o.newBlockFilter=c,o.newPendingTransactionFilter=u,o.uninstallFilter=f,o.getFilterChanges=d,o.getFilterLogs=h,o.destroy=()=>{p()},o;async function l(y){const m=new Ip({provider:e,params:y});return await g(m),m}async function c(){const y=new Ap({provider:e});return await g(y),y}async function u(){const y=new Np({provider:e});return await g(y),y}async function d(y){const m=Qn(y),$=n[m];if(!$)throw new Error(`No filter for index "${m}"`);return $.getChangesAndClear()}async function h(y){const m=Qn(y),$=n[m];if(!$)throw new Error(`No filter for index "${m}"`);let v=[];return $.type==="log"&&(v=$.getAllResults()),v}async function f(y){const m=Qn(y),v=!!n[m];return v&&await b(m),v}async function g(y){const m=yt(n).length,$=await t.getLatestBlock();await y.initialize({currentBlock:$}),r++,n[r]=y,y.id=r,y.idHex=nc(r);const v=yt(n).length;return _({prevFilterCount:m,newFilterCount:v}),r}async function b(y){const m=yt(n).length;delete n[y];const $=yt(n).length;_({prevFilterCount:m,newFilterCount:$})}async function p(){const y=yt(n).length;n={},_({prevFilterCount:y,newFilterCount:0})}function _({prevFilterCount:y,newFilterCount:m}){if(y===0&&m>0){t.on("sync",a);return}if(y>0&&m===0){t.removeListener("sync",a);return}}}function Xn(t){return Tr(async(...e)=>{const r=await t(...e);return nc(r.id)})}function Tr(t){return Rp(async(e,r)=>{const n=await t.apply(null,e.params);r.result=n})}function Lp({mutex:t}){return e=>async(r,n,s,i)=>{(await t.acquire())(),e(r,n,s,i)}}function yt(t,e){const r=[];for(let n in t)r.push(t[n]);return r}const Op=cr.default,{createAsyncMiddleware:Yi,createScaffoldMiddleware:Pp}=$s,$p=Mp,{unsafeRandomBytes:xp,incrementHexInt:jp}=br,Fp=Ws;var Bp=Dp;function Dp({blockTracker:t,provider:e}){const r={},n=$p({blockTracker:t,provider:e});let s=!1;const i=new Op,o=Pp({eth_subscribe:Yi(a),eth_unsubscribe:Yi(l)});return o.destroy=u,{events:i,middleware:o};async function a(d,h){if(s)throw new Error("SubscriptionManager - attempting to use after destroying");const f=d.params[0],g=xp(16);let b;switch(f){case"newHeads":b=p({subId:g});break;case"logs":const y=d.params[1],m=await n.newLogFilter(y);b=_({subId:g,filter:m});break;default:throw new Error(`SubscriptionManager - unsupported subscription type "${f}"`)}r[g]=b,h.result=g;return;function p({subId:y}){const m={type:f,destroy:async()=>{t.removeListener("sync",m.update)},update:async({oldBlock:$,newBlock:v})=>{const M=v,J=jp($);(await Fp({provider:e,fromBlock:J,toBlock:M})).map(Hp).filter(K=>K!==null).forEach(K=>{c(y,K)})}};return t.on("sync",m.update),m}function _({subId:y,filter:m}){return m.on("update",v=>c(y,v)),{type:f,destroy:async()=>await n.uninstallFilter(m.idHex)}}}async function l(d,h){if(s)throw new Error("SubscriptionManager - attempting to use after destroying");const f=d.params[0],g=r[f];if(!g){h.result=!1;return}delete r[f],await g.destroy(),h.result=!0}function c(d,h){i.emit("notification",{jsonrpc:"2.0",method:"eth_subscription",params:{subscription:d,result:h}})}function u(){i.removeAllListeners();for(const d in r)r[d].destroy(),delete r[d];s=!0}}function Hp(t){return t==null?null:{hash:t.hash,parentHash:t.parentHash,sha3Uncles:t.sha3Uncles,miner:t.miner,stateRoot:t.stateRoot,transactionsRoot:t.transactionsRoot,receiptsRoot:t.receiptsRoot,logsBloom:t.logsBloom,difficulty:t.difficulty,number:t.number,gasLimit:t.gasLimit,gasUsed:t.gasUsed,nonce:t.nonce,mixHash:t.mixHash,timestamp:t.timestamp,extraData:t.extraData}}Object.defineProperty(ln,"__esModule",{value:!0});ln.SubscriptionManager=void 0;const Up=Do,Vp=Bp,eo=()=>{};class Wp{constructor(e){const r=new Up.PollingBlockTracker({provider:e,pollingInterval:15e3,setSkipCacheFlag:!0}),{events:n,middleware:s}=Vp({blockTracker:r,provider:e});this.events=n,this.subscriptionMiddleware=s}async handleRequest(e){const r={};return await this.subscriptionMiddleware(e,r,eo,eo),r}destroy(){this.subscriptionMiddleware.destroy()}}ln.SubscriptionManager=Wp;var sc=k&&k.__importDefault||function(t){return t&&t.__esModule?t:{default:t}};Object.defineProperty(kt,"__esModule",{value:!0});kt.CoinbaseWalletProvider=void 0;const zp=sc(jr),Jp=Bc,x=Kt,L=S,qp=rr,to=Ee,Mr=xt,ge=Ot,Kn=sc(lu),zt=$t,Gp=Nt,Zp=ln,ro="DefaultChainId",no="DefaultJsonRpcUrl";class Qp extends Jp.EventEmitter{constructor(e){var r,n;super(),this._filterPolyfill=new Gp.FilterPolyfill(this),this._subscriptionManager=new Zp.SubscriptionManager(this),this._relay=null,this._addresses=[],this.hasMadeFirstChainChangedEmission=!1,this.setProviderInfo=this.setProviderInfo.bind(this),this.updateProviderInfo=this.updateProviderInfo.bind(this),this.getChainId=this.getChainId.bind(this),this.setAppInfo=this.setAppInfo.bind(this),this.enable=this.enable.bind(this),this.close=this.close.bind(this),this.send=this.send.bind(this),this.sendAsync=this.sendAsync.bind(this),this.request=this.request.bind(this),this._setAddresses=this._setAddresses.bind(this),this.scanQRCode=this.scanQRCode.bind(this),this.genericRequest=this.genericRequest.bind(this),this._chainIdFromOpts=e.chainId,this._jsonRpcUrlFromOpts=e.jsonRpcUrl,this._overrideIsMetaMask=e.overrideIsMetaMask,this._relayProvider=e.relayProvider,this._storage=e.storage,this._relayEventManager=e.relayEventManager,this.diagnostic=e.diagnosticLogger,this.reloadOnDisconnect=!0,this.isCoinbaseWallet=(r=e.overrideIsCoinbaseWallet)!==null&&r!==void 0?r:!0,this.isCoinbaseBrowser=(n=e.overrideIsCoinbaseBrowser)!==null&&n!==void 0?n:!1,this.qrUrl=e.qrUrl;const s=this.getChainId(),i=(0,L.prepend0x)(s.toString(16));this.emit("connect",{chainIdStr:i});const o=this._storage.getItem(to.LOCAL_STORAGE_ADDRESSES_KEY);if(o){const a=o.split(" ");a[0]!==""&&(this._addresses=a.map(l=>(0,L.ensureAddressString)(l)),this.emit("accountsChanged",a))}this._subscriptionManager.events.on("notification",a=>{this.emit("message",{type:a.method,data:a.params})}),this._isAuthorized()&&this.initializeRelay(),window.addEventListener("message",a=>{var l;if(!(a.origin!==location.origin||a.source!==window)&&a.data.type==="walletLinkMessage"&&a.data.data.action==="dappChainSwitched"){const c=a.data.data.chainId,u=(l=a.data.data.jsonRpcUrl)!==null&&l!==void 0?l:this.jsonRpcUrl;this.updateProviderInfo(u,Number(c))}})}get selectedAddress(){return this._addresses[0]||void 0}get networkVersion(){return this.getChainId().toString(10)}get chainId(){return(0,L.prepend0x)(this.getChainId().toString(16))}get isWalletLink(){return!0}get isMetaMask(){return this._overrideIsMetaMask}get host(){return this.jsonRpcUrl}get connected(){return!0}isConnected(){return!0}get jsonRpcUrl(){var e;return(e=this._storage.getItem(no))!==null&&e!==void 0?e:this._jsonRpcUrlFromOpts}set jsonRpcUrl(e){this._storage.setItem(no,e)}disableReloadOnDisconnect(){this.reloadOnDisconnect=!1}setProviderInfo(e,r){this.isCoinbaseBrowser||(this._chainIdFromOpts=r,this._jsonRpcUrlFromOpts=e),this.updateProviderInfo(this.jsonRpcUrl,this.getChainId())}updateProviderInfo(e,r){this.jsonRpcUrl=e;const n=this.getChainId();this._storage.setItem(ro,r.toString(10)),((0,L.ensureIntNumber)(r)!==n||!this.hasMadeFirstChainChangedEmission)&&(this.emit("chainChanged",this.getChainId()),this.hasMadeFirstChainChangedEmission=!0)}async watchAsset(e,r,n,s,i,o){const l=await(await this.initializeRelay()).watchAsset(e,r,n,s,i,o==null?void 0:o.toString()).promise;return(0,ge.isErrorResponse)(l)?!1:!!l.result}async addEthereumChain(e,r,n,s,i,o){var a,l;if((0,L.ensureIntNumber)(e)===this.getChainId())return!1;const c=await this.initializeRelay(),u=c.inlineAddEthereumChain(e.toString());!this._isAuthorized()&&!u&&await c.requestEthereumAccounts().promise;const d=await c.addEthereumChain(e.toString(),r,i,n,s,o).promise;return(0,ge.isErrorResponse)(d)?!1:(((a=d.result)===null||a===void 0?void 0:a.isApproved)===!0&&this.updateProviderInfo(r[0],e),((l=d.result)===null||l===void 0?void 0:l.isApproved)===!0)}async switchEthereumChain(e){const n=await(await this.initializeRelay()).switchEthereumChain(e.toString(10),this.selectedAddress||void 0).promise;if((0,ge.isErrorResponse)(n)){if(!n.errorCode)return;throw n.errorCode===x.standardErrorCodes.provider.unsupportedChain?x.standardErrors.provider.unsupportedChain():x.standardErrors.provider.custom({message:n.errorMessage,code:n.errorCode})}const s=n.result;s.isApproved&&s.rpcUrl.length>0&&this.updateProviderInfo(s.rpcUrl,e)}setAppInfo(e,r){this.initializeRelay().then(n=>n.setAppInfo(e,r))}async enable(){var e;return(e=this.diagnostic)===null||e===void 0||e.log(zt.EVENTS.ETH_ACCOUNTS_STATE,{method:"provider::enable",addresses_length:this._addresses.length,sessionIdHash:this._relay?Mr.Session.hash(this._relay.session.id):void 0}),this._isAuthorized()?[...this._addresses]:await this.send("eth_requestAccounts")}async close(){(await this.initializeRelay()).resetAndReload()}send(e,r){try{const n=this._send(e,r);if(n instanceof Promise)return n.catch(s=>{throw(0,x.serializeError)(s,e)})}catch(n){throw(0,x.serializeError)(n,e)}}_send(e,r){if(typeof e=="string"){const s=e,i=Array.isArray(r)?r:r!==void 0?[r]:[],o={jsonrpc:"2.0",id:0,method:s,params:i};return this._sendRequestAsync(o).then(a=>a.result)}if(typeof r=="function"){const s=e,i=r;return this._sendAsync(s,i)}if(Array.isArray(e))return e.map(i=>this._sendRequest(i));const n=e;return this._sendRequest(n)}async sendAsync(e,r){try{return this._sendAsync(e,r).catch(n=>{throw(0,x.serializeError)(n,e)})}catch(n){return Promise.reject((0,x.serializeError)(n,e))}}async _sendAsync(e,r){if(typeof r!="function")throw new Error("callback is required");if(Array.isArray(e)){const s=r;this._sendMultipleRequestsAsync(e).then(i=>s(null,i)).catch(i=>s(i,null));return}const n=r;return this._sendRequestAsync(e).then(s=>n(null,s)).catch(s=>n(s,null))}async request(e){try{return this._request(e).catch(r=>{throw(0,x.serializeError)(r,e.method)})}catch(r){return Promise.reject((0,x.serializeError)(r,e.method))}}async _request(e){if(!e||typeof e!="object"||Array.isArray(e))throw x.standardErrors.rpc.invalidRequest({message:"Expected a single, non-array, object argument.",data:e});const{method:r,params:n}=e;if(typeof r!="string"||r.length===0)throw x.standardErrors.rpc.invalidRequest({message:"'args.method' must be a non-empty string.",data:e});if(n!==void 0&&!Array.isArray(n)&&(typeof n!="object"||n===null))throw x.standardErrors.rpc.invalidRequest({message:"'args.params' must be an object or array if provided.",data:e});const s=n===void 0?[]:n,i=this._relayEventManager.makeRequestId();return(await this._sendRequestAsync({method:r,params:s,jsonrpc:"2.0",id:i})).result}async scanQRCode(e){const n=await(await this.initializeRelay()).scanQRCode((0,L.ensureRegExpString)(e)).promise;if((0,ge.isErrorResponse)(n))throw(0,x.serializeError)(n.errorMessage,"scanQRCode");if(typeof n.result!="string")throw(0,x.serializeError)("result was not a string","scanQRCode");return n.result}async genericRequest(e,r){const s=await(await this.initializeRelay()).genericRequest(e,r).promise;if((0,ge.isErrorResponse)(s))throw(0,x.serializeError)(s.errorMessage,"generic");if(typeof s.result!="string")throw(0,x.serializeError)("result was not a string","generic");return s.result}async connectAndSignIn(e){var r;(r=this.diagnostic)===null||r===void 0||r.log(zt.EVENTS.ETH_ACCOUNTS_STATE,{method:"provider::connectAndSignIn",sessionIdHash:this._relay?Mr.Session.hash(this._relay.session.id):void 0});let n;try{const i=await this.initializeRelay();if(!(i instanceof qp.MobileRelay))throw new Error("connectAndSignIn is only supported on mobile");if(n=await i.connectAndSignIn(e).promise,(0,ge.isErrorResponse)(n))throw new Error(n.errorMessage)}catch(i){throw typeof i.message=="string"&&i.message.match(/(denied|rejected)/i)?x.standardErrors.provider.userRejectedRequest("User denied account authorization"):i}if(!n.result)throw new Error("accounts received is empty");const{accounts:s}=n.result;return this._setAddresses(s),this.isCoinbaseBrowser||await this.switchEthereumChain(this.getChainId()),n.result}async selectProvider(e){const n=await(await this.initializeRelay()).selectProvider(e).promise;if((0,ge.isErrorResponse)(n))throw(0,x.serializeError)(n.errorMessage,"selectProvider");if(typeof n.result!="string")throw(0,x.serializeError)("result was not a string","selectProvider");return n.result}supportsSubscriptions(){return!1}subscribe(){throw new Error("Subscriptions are not supported")}unsubscribe(){throw new Error("Subscriptions are not supported")}disconnect(){return!0}_sendRequest(e){const r={jsonrpc:"2.0",id:e.id},{method:n}=e;if(r.result=this._handleSynchronousMethods(e),r.result===void 0)throw new Error(`Coinbase Wallet does not support calling ${n} synchronously without a callback. Please provide a callback parameter to call ${n} asynchronously.`);return r}_setAddresses(e,r){if(!Array.isArray(e))throw new Error("addresses is not an array");const n=e.map(s=>(0,L.ensureAddressString)(s));JSON.stringify(n)!==JSON.stringify(this._addresses)&&(this._addresses=n,this.emit("accountsChanged",this._addresses),this._storage.setItem(to.LOCAL_STORAGE_ADDRESSES_KEY,n.join(" ")))}_sendRequestAsync(e){return new Promise((r,n)=>{try{const s=this._handleSynchronousMethods(e);if(s!==void 0)return r({jsonrpc:"2.0",id:e.id,result:s});const i=this._handleAsynchronousFilterMethods(e);if(i!==void 0){i.then(a=>r(Object.assign(Object.assign({},a),{id:e.id}))).catch(a=>n(a));return}const o=this._handleSubscriptionMethods(e);if(o!==void 0){o.then(a=>r({jsonrpc:"2.0",id:e.id,result:a.result})).catch(a=>n(a));return}}catch(s){return n(s)}this._handleAsynchronousMethods(e).then(s=>s&&r(Object.assign(Object.assign({},s),{id:e.id}))).catch(s=>n(s))})}_sendMultipleRequestsAsync(e){return Promise.all(e.map(r=>this._sendRequestAsync(r)))}_handleSynchronousMethods(e){const{method:r}=e,n=e.params||[];switch(r){case"eth_accounts":return this._eth_accounts();case"eth_coinbase":return this._eth_coinbase();case"eth_uninstallFilter":return this._eth_uninstallFilter(n);case"net_version":return this._net_version();case"eth_chainId":return this._eth_chainId();default:return}}async _handleAsynchronousMethods(e){const{method:r}=e,n=e.params||[];switch(r){case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_sign":return this._eth_sign(n);case"eth_ecRecover":return this._eth_ecRecover(n);case"personal_sign":return this._personal_sign(n);case"personal_ecRecover":return this._personal_ecRecover(n);case"eth_signTransaction":return this._eth_signTransaction(n);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(n);case"eth_sendTransaction":return this._eth_sendTransaction(n);case"eth_signTypedData_v1":return this._eth_signTypedData_v1(n);case"eth_signTypedData_v2":return this._throwUnsupportedMethodError();case"eth_signTypedData_v3":return this._eth_signTypedData_v3(n);case"eth_signTypedData_v4":case"eth_signTypedData":return this._eth_signTypedData_v4(n);case"cbWallet_arbitrary":return this._cbwallet_arbitrary(n);case"wallet_addEthereumChain":return this._wallet_addEthereumChain(n);case"wallet_switchEthereumChain":return this._wallet_switchEthereumChain(n);case"wallet_watchAsset":return this._wallet_watchAsset(n)}return(await this.initializeRelay()).makeEthereumJSONRPCRequest(e,this.jsonRpcUrl).catch(i=>{var o;throw(i.code===x.standardErrorCodes.rpc.methodNotFound||i.code===x.standardErrorCodes.rpc.methodNotSupported)&&((o=this.diagnostic)===null||o===void 0||o.log(zt.EVENTS.METHOD_NOT_IMPLEMENTED,{method:e.method,sessionIdHash:this._relay?Mr.Session.hash(this._relay.session.id):void 0})),i})}_handleAsynchronousFilterMethods(e){const{method:r}=e,n=e.params||[];switch(r){case"eth_newFilter":return this._eth_newFilter(n);case"eth_newBlockFilter":return this._eth_newBlockFilter();case"eth_newPendingTransactionFilter":return this._eth_newPendingTransactionFilter();case"eth_getFilterChanges":return this._eth_getFilterChanges(n);case"eth_getFilterLogs":return this._eth_getFilterLogs(n)}}_handleSubscriptionMethods(e){switch(e.method){case"eth_subscribe":case"eth_unsubscribe":return this._subscriptionManager.handleRequest(e)}}_isKnownAddress(e){try{const r=(0,L.ensureAddressString)(e);return this._addresses.map(s=>(0,L.ensureAddressString)(s)).includes(r)}catch{}return!1}_ensureKnownAddress(e){var r;if(!this._isKnownAddress(e))throw(r=this.diagnostic)===null||r===void 0||r.log(zt.EVENTS.UNKNOWN_ADDRESS_ENCOUNTERED),new Error("Unknown Ethereum address")}_prepareTransactionParams(e){const r=e.from?(0,L.ensureAddressString)(e.from):this.selectedAddress;if(!r)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(r);const n=e.to?(0,L.ensureAddressString)(e.to):null,s=e.value!=null?(0,L.ensureBN)(e.value):new zp.default(0),i=e.data?(0,L.ensureBuffer)(e.data):B.alloc(0),o=e.nonce!=null?(0,L.ensureIntNumber)(e.nonce):null,a=e.gasPrice!=null?(0,L.ensureBN)(e.gasPrice):null,l=e.maxFeePerGas!=null?(0,L.ensureBN)(e.maxFeePerGas):null,c=e.maxPriorityFeePerGas!=null?(0,L.ensureBN)(e.maxPriorityFeePerGas):null,u=e.gas!=null?(0,L.ensureBN)(e.gas):null,d=e.chainId?(0,L.ensureIntNumber)(e.chainId):this.getChainId();return{fromAddress:r,toAddress:n,weiValue:s,data:i,nonce:o,gasPriceInWei:a,maxFeePerGas:l,maxPriorityFeePerGas:c,gasLimit:u,chainId:d}}_isAuthorized(){return this._addresses.length>0}_requireAuthorization(){if(!this._isAuthorized())throw x.standardErrors.provider.unauthorized({})}_throwUnsupportedMethodError(){throw x.standardErrors.provider.unsupportedMethod({})}async _signEthereumMessage(e,r,n,s){this._ensureKnownAddress(r);try{const o=await(await this.initializeRelay()).signEthereumMessage(e,r,n,s).promise;if((0,ge.isErrorResponse)(o))throw new Error(o.errorMessage);return{jsonrpc:"2.0",id:0,result:o.result}}catch(i){throw typeof i.message=="string"&&i.message.match(/(denied|rejected)/i)?x.standardErrors.provider.userRejectedRequest("User denied message signature"):i}}async _ethereumAddressFromSignedMessage(e,r,n){const i=await(await this.initializeRelay()).ethereumAddressFromSignedMessage(e,r,n).promise;if((0,ge.isErrorResponse)(i))throw new Error(i.errorMessage);return{jsonrpc:"2.0",id:0,result:i.result}}_eth_accounts(){return[...this._addresses]}_eth_coinbase(){return this.selectedAddress||null}_net_version(){return this.getChainId().toString(10)}_eth_chainId(){return(0,L.hexStringFromIntNumber)(this.getChainId())}getChainId(){const e=this._storage.getItem(ro);if(!e)return(0,L.ensureIntNumber)(this._chainIdFromOpts);const r=parseInt(e,10);return(0,L.ensureIntNumber)(r)}async _eth_requestAccounts(){var e;if((e=this.diagnostic)===null||e===void 0||e.log(zt.EVENTS.ETH_ACCOUNTS_STATE,{method:"provider::_eth_requestAccounts",addresses_length:this._addresses.length,sessionIdHash:this._relay?Mr.Session.hash(this._relay.session.id):void 0}),this._isAuthorized())return Promise.resolve({jsonrpc:"2.0",id:0,result:this._addresses});let r;try{if(r=await(await this.initializeRelay()).requestEthereumAccounts().promise,(0,ge.isErrorResponse)(r))throw new Error(r.errorMessage)}catch(n){throw typeof n.message=="string"&&n.message.match(/(denied|rejected)/i)?x.standardErrors.provider.userRejectedRequest("User denied account authorization"):n}if(!r.result)throw new Error("accounts received is empty");return this._setAddresses(r.result),this.isCoinbaseBrowser||await this.switchEthereumChain(this.getChainId()),{jsonrpc:"2.0",id:0,result:this._addresses}}_eth_sign(e){this._requireAuthorization();const r=(0,L.ensureAddressString)(e[0]),n=(0,L.ensureBuffer)(e[1]);return this._signEthereumMessage(n,r,!1)}_eth_ecRecover(e){const r=(0,L.ensureBuffer)(e[0]),n=(0,L.ensureBuffer)(e[1]);return this._ethereumAddressFromSignedMessage(r,n,!1)}_personal_sign(e){this._requireAuthorization();const r=(0,L.ensureBuffer)(e[0]),n=(0,L.ensureAddressString)(e[1]);return this._signEthereumMessage(r,n,!0)}_personal_ecRecover(e){const r=(0,L.ensureBuffer)(e[0]),n=(0,L.ensureBuffer)(e[1]);return this._ethereumAddressFromSignedMessage(r,n,!0)}async _eth_signTransaction(e){this._requireAuthorization();const r=this._prepareTransactionParams(e[0]||{});try{const s=await(await this.initializeRelay()).signEthereumTransaction(r).promise;if((0,ge.isErrorResponse)(s))throw new Error(s.errorMessage);return{jsonrpc:"2.0",id:0,result:s.result}}catch(n){throw typeof n.message=="string"&&n.message.match(/(denied|rejected)/i)?x.standardErrors.provider.userRejectedRequest("User denied transaction signature"):n}}async _eth_sendRawTransaction(e){const r=(0,L.ensureBuffer)(e[0]),s=await(await this.initializeRelay()).submitEthereumTransaction(r,this.getChainId()).promise;if((0,ge.isErrorResponse)(s))throw new Error(s.errorMessage);return{jsonrpc:"2.0",id:0,result:s.result}}async _eth_sendTransaction(e){this._requireAuthorization();const r=this._prepareTransactionParams(e[0]||{});try{const s=await(await this.initializeRelay()).signAndSubmitEthereumTransaction(r).promise;if((0,ge.isErrorResponse)(s))throw new Error(s.errorMessage);return{jsonrpc:"2.0",id:0,result:s.result}}catch(n){throw typeof n.message=="string"&&n.message.match(/(denied|rejected)/i)?x.standardErrors.provider.userRejectedRequest("User denied transaction signature"):n}}async _eth_signTypedData_v1(e){this._requireAuthorization();const r=(0,L.ensureParsedJSONObject)(e[0]),n=(0,L.ensureAddressString)(e[1]);this._ensureKnownAddress(n);const s=Kn.default.hashForSignTypedDataLegacy({data:r}),i=JSON.stringify(r,null,2);return this._signEthereumMessage(s,n,!1,i)}async _eth_signTypedData_v3(e){this._requireAuthorization();const r=(0,L.ensureAddressString)(e[0]),n=(0,L.ensureParsedJSONObject)(e[1]);this._ensureKnownAddress(r);const s=Kn.default.hashForSignTypedData_v3({data:n}),i=JSON.stringify(n,null,2);return this._signEthereumMessage(s,r,!1,i)}async _eth_signTypedData_v4(e){this._requireAuthorization();const r=(0,L.ensureAddressString)(e[0]),n=(0,L.ensureParsedJSONObject)(e[1]);this._ensureKnownAddress(r);const s=Kn.default.hashForSignTypedData_v4({data:n}),i=JSON.stringify(n,null,2);return this._signEthereumMessage(s,r,!1,i)}async _cbwallet_arbitrary(e){const r=e[0],n=e[1];if(typeof n!="string")throw new Error("parameter must be a string");if(typeof r!="object"||r===null)throw new Error("parameter must be an object");return{jsonrpc:"2.0",id:0,result:await this.genericRequest(r,n)}}async _wallet_addEthereumChain(e){var r,n,s,i;const o=e[0];if(((r=o.rpcUrls)===null||r===void 0?void 0:r.length)===0)return{jsonrpc:"2.0",id:0,error:{code:2,message:"please pass in at least 1 rpcUrl"}};if(!o.chainName||o.chainName.trim()==="")throw x.standardErrors.rpc.invalidParams("chainName is a required field");if(!o.nativeCurrency)throw x.standardErrors.rpc.invalidParams("nativeCurrency is a required field");const a=parseInt(o.chainId,16);return await this.addEthereumChain(a,(n=o.rpcUrls)!==null&&n!==void 0?n:[],(s=o.blockExplorerUrls)!==null&&s!==void 0?s:[],o.chainName,(i=o.iconUrls)!==null&&i!==void 0?i:[],o.nativeCurrency)?{jsonrpc:"2.0",id:0,result:null}:{jsonrpc:"2.0",id:0,error:{code:2,message:"unable to add ethereum chain"}}}async _wallet_switchEthereumChain(e){const r=e[0];return await this.switchEthereumChain(parseInt(r.chainId,16)),{jsonrpc:"2.0",id:0,result:null}}async _wallet_watchAsset(e){const r=Array.isArray(e)?e[0]:e;if(!r.type)throw x.standardErrors.rpc.invalidParams("Type is required");if((r==null?void 0:r.type)!=="ERC20")throw x.standardErrors.rpc.invalidParams(`Asset of type '${r.type}' is not supported`);if(!(r!=null&&r.options))throw x.standardErrors.rpc.invalidParams("Options are required");if(!(r!=null&&r.options.address))throw x.standardErrors.rpc.invalidParams("Address is required");const n=this.getChainId(),{address:s,symbol:i,image:o,decimals:a}=r.options;return{jsonrpc:"2.0",id:0,result:await this.watchAsset(r.type,s,i,a,o,n)}}_eth_uninstallFilter(e){const r=(0,L.ensureHexString)(e[0]);return this._filterPolyfill.uninstallFilter(r)}async _eth_newFilter(e){const r=e[0];return{jsonrpc:"2.0",id:0,result:await this._filterPolyfill.newFilter(r)}}async _eth_newBlockFilter(){return{jsonrpc:"2.0",id:0,result:await this._filterPolyfill.newBlockFilter()}}async _eth_newPendingTransactionFilter(){return{jsonrpc:"2.0",id:0,result:await this._filterPolyfill.newPendingTransactionFilter()}}_eth_getFilterChanges(e){const r=(0,L.ensureHexString)(e[0]);return this._filterPolyfill.getFilterChanges(r)}_eth_getFilterLogs(e){const r=(0,L.ensureHexString)(e[0]);return this._filterPolyfill.getFilterLogs(r)}initializeRelay(){return this._relay?Promise.resolve(this._relay):this._relayProvider().then(e=>(e.setAccountsCallback((r,n)=>this._setAddresses(r,n)),e.setChainCallback((r,n)=>{this.updateProviderInfo(n,parseInt(r,10))}),e.setDappDefaultChainCallback(this._chainIdFromOpts),this._relay=e,e))}}kt.CoinbaseWalletProvider=Qp;var An={};Object.defineProperty(An,"__esModule",{value:!0});An.RelayEventManager=void 0;const Xp=S;class Kp{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const e=this._nextRequestId,r=(0,Xp.prepend0x)(e.toString(16));return this.callbacks.get(r)&&this.callbacks.delete(r),e}}An.RelayEventManager=Kp;Object.defineProperty(Gt,"__esModule",{value:!0});Gt.CoinbaseWalletSDK=void 0;const Yp=Br,e1=Dr,so=S,t1=zr,r1=kt,n1=rr,s1=or,i1=An,o1=sr,a1=nr,ic=Pt;class Nn{constructor(e){var r,n,s;this._appName="",this._appLogoUrl=null,this._relay=null,this._relayEventManager=null;const i=e.linkAPIUrl||e1.LINK_API_URL;typeof e.overrideIsMetaMask>"u"?this._overrideIsMetaMask=!1:this._overrideIsMetaMask=e.overrideIsMetaMask,this._overrideIsCoinbaseWallet=(r=e.overrideIsCoinbaseWallet)!==null&&r!==void 0?r:!0,this._overrideIsCoinbaseBrowser=(n=e.overrideIsCoinbaseBrowser)!==null&&n!==void 0?n:!1,this._diagnosticLogger=e.diagnosticLogger,this._reloadOnDisconnect=(s=e.reloadOnDisconnect)!==null&&s!==void 0?s:!0;const o=new URL(i),a=`${o.protocol}//${o.host}`;if(this._storage=new t1.ScopedLocalStorage(`-walletlink:${a}`),this._storage.setItem("version",Nn.VERSION),this.walletExtension||this.coinbaseBrowser)return;this._relayEventManager=new i1.RelayEventManager;const l=(0,so.isMobileWeb)(),c=e.uiConstructor||(d=>l?new s1.MobileRelayUI(d):new o1.WalletLinkRelayUI(d)),u={linkAPIUrl:i,version:ic.LIB_VERSION,darkMode:!!e.darkMode,headlessMode:!!e.headlessMode,uiConstructor:c,storage:this._storage,relayEventManager:this._relayEventManager,diagnosticLogger:this._diagnosticLogger,reloadOnDisconnect:this._reloadOnDisconnect,enableMobileWalletLink:e.enableMobileWalletLink};this._relay=l?new n1.MobileRelay(u):new a1.WalletLinkRelay(u),this.setAppInfo(e.appName,e.appLogoUrl),!e.headlessMode&&this._relay.attachUI()}makeWeb3Provider(e="",r=1){const n=this.walletExtension;if(n)return this.isCipherProvider(n)||n.setProviderInfo(e,r),this._reloadOnDisconnect===!1&&typeof n.disableReloadOnDisconnect=="function"&&n.disableReloadOnDisconnect(),n;const s=this.coinbaseBrowser;if(s)return s;const i=this._relay;if(!i||!this._relayEventManager||!this._storage)throw new Error("Relay not initialized, should never happen");return e||i.setConnectDisabled(!0),new r1.CoinbaseWalletProvider({relayProvider:()=>Promise.resolve(i),relayEventManager:this._relayEventManager,storage:this._storage,jsonRpcUrl:e,chainId:r,qrUrl:this.getQrUrl(),diagnosticLogger:this._diagnosticLogger,overrideIsMetaMask:this._overrideIsMetaMask,overrideIsCoinbaseWallet:this._overrideIsCoinbaseWallet,overrideIsCoinbaseBrowser:this._overrideIsCoinbaseBrowser})}setAppInfo(e,r){var n;this._appName=e||"DApp",this._appLogoUrl=r||(0,so.getFavicon)();const s=this.walletExtension;s?this.isCipherProvider(s)||s.setAppInfo(this._appName,this._appLogoUrl):(n=this._relay)===null||n===void 0||n.setAppInfo(this._appName,this._appLogoUrl)}disconnect(){var e;const r=this===null||this===void 0?void 0:this.walletExtension;r?r.close():(e=this._relay)===null||e===void 0||e.resetAndReload()}getQrUrl(){var e,r;return(r=(e=this._relay)===null||e===void 0?void 0:e.getQRCodeUrl())!==null&&r!==void 0?r:null}getCoinbaseWalletLogo(e,r=240){return(0,Yp.walletLogo)(e,r)}get walletExtension(){var e;return(e=window.coinbaseWalletExtension)!==null&&e!==void 0?e:window.walletLinkExtension}get coinbaseBrowser(){var e,r;try{const n=(e=window.ethereum)!==null&&e!==void 0?e:(r=window.top)===null||r===void 0?void 0:r.ethereum;return n&&"isCoinbaseBrowser"in n&&n.isCoinbaseBrowser?n:void 0}catch{return}}isCipherProvider(e){return typeof e.isCipher=="boolean"&&e.isCipher}}Gt.CoinbaseWalletSDK=Nn;Nn.VERSION=ic.LIB_VERSION;(function(t){Object.defineProperty(t,"__esModule",{value:!0}),t.CoinbaseWalletProvider=t.CoinbaseWalletSDK=void 0;const e=Gt,r=kt;var n=Gt;Object.defineProperty(t,"CoinbaseWalletSDK",{enumerable:!0,get:function(){return n.CoinbaseWalletSDK}});var s=kt;Object.defineProperty(t,"CoinbaseWalletProvider",{enumerable:!0,get:function(){return s.CoinbaseWalletProvider}}),t.default=e.CoinbaseWalletSDK,typeof window<"u"&&(window.CoinbaseWalletSDK=e.CoinbaseWalletSDK,window.CoinbaseWalletProvider=r.CoinbaseWalletProvider,window.WalletLink=e.CoinbaseWalletSDK,window.WalletLinkProvider=r.CoinbaseWalletProvider)})(as);const c1=oc(as),C1=lc({__proto__:null,default:c1},[as]);export{C1 as i}; diff --git a/kinode/packages/app_store/pkg/ui/assets/index-bjPUX0JA.js b/kinode/packages/app_store/pkg/ui/assets/index-bjPUX0JA.js deleted file mode 100644 index 4b738b2e..00000000 --- a/kinode/packages/app_store/pkg/ui/assets/index-bjPUX0JA.js +++ /dev/null @@ -1,54 +0,0 @@ -import{n as _t,s as ce,T as N,t as j,a as C,o as ot,R as Do,p as K,y as gt}from"./index-u1isGxGg.js";import{m as Uo,n as Wo}from"./index-9L6Bkx0q.js";/** - * @license - * Copyright 2019 Google LLC - * SPDX-License-Identifier: BSD-3-Clause - */const de=window,fr=de.ShadowRoot&&(de.ShadyCSS===void 0||de.ShadyCSS.nativeShadow)&&"adoptedStyleSheets"in Document.prototype&&"replace"in CSSStyleSheet.prototype,wr=Symbol(),Ar=new WeakMap;let oo=class{constructor(t,r,n){if(this._$cssResult$=!0,n!==wr)throw Error("CSSResult is not constructable. Use `unsafeCSS` or `css` instead.");this.cssText=t,this.t=r}get styleSheet(){let t=this.o;const r=this.t;if(fr&&t===void 0){const n=r!==void 0&&r.length===1;n&&(t=Ar.get(r)),t===void 0&&((this.o=t=new CSSStyleSheet).replaceSync(this.cssText),n&&Ar.set(r,t))}return t}toString(){return this.cssText}};const jo=e=>new oo(typeof e=="string"?e:e+"",void 0,wr),T=(e,...t)=>{const r=e.length===1?e[0]:t.reduce((n,o,i)=>n+(s=>{if(s._$cssResult$===!0)return s.cssText;if(typeof s=="number")return s;throw Error("Value passed to 'css' function must be a 'css' function result: "+s+". Use 'unsafeCSS' to pass non-literal values, but take care to ensure page security.")})(o)+e[i+1],e[0]);return new oo(r,e,wr)},Ho=(e,t)=>{fr?e.adoptedStyleSheets=t.map(r=>r instanceof CSSStyleSheet?r:r.styleSheet):t.forEach(r=>{const n=document.createElement("style"),o=de.litNonce;o!==void 0&&n.setAttribute("nonce",o),n.textContent=r.cssText,e.appendChild(n)})},_r=fr?e=>e:e=>e instanceof CSSStyleSheet?(t=>{let r="";for(const n of t.cssRules)r+=n.cssText;return jo(r)})(e):e;/** - * @license - * Copyright 2017 Google LLC - * SPDX-License-Identifier: BSD-3-Clause - */var Ce;const he=window,Or=he.trustedTypes,zo=Or?Or.emptyScript:"",Ir=he.reactiveElementPolyfillSupport,sr={toAttribute(e,t){switch(t){case Boolean:e=e?zo:null;break;case Object:case Array:e=e==null?e:JSON.stringify(e)}return e},fromAttribute(e,t){let r=e;switch(t){case Boolean:r=e!==null;break;case Number:r=e===null?null:Number(e);break;case Object:case Array:try{r=JSON.parse(e)}catch{r=null}}return r}},no=(e,t)=>t!==e&&(t==t||e==e),Ee={attribute:!0,type:String,converter:sr,reflect:!1,hasChanged:no},ar="finalized";let $t=class extends HTMLElement{constructor(){super(),this._$Ei=new Map,this.isUpdatePending=!1,this.hasUpdated=!1,this._$El=null,this._$Eu()}static addInitializer(t){var r;this.finalize(),((r=this.h)!==null&&r!==void 0?r:this.h=[]).push(t)}static get observedAttributes(){this.finalize();const t=[];return this.elementProperties.forEach((r,n)=>{const o=this._$Ep(n,r);o!==void 0&&(this._$Ev.set(o,n),t.push(o))}),t}static createProperty(t,r=Ee){if(r.state&&(r.attribute=!1),this.finalize(),this.elementProperties.set(t,r),!r.noAccessor&&!this.prototype.hasOwnProperty(t)){const n=typeof t=="symbol"?Symbol():"__"+t,o=this.getPropertyDescriptor(t,n,r);o!==void 0&&Object.defineProperty(this.prototype,t,o)}}static getPropertyDescriptor(t,r,n){return{get(){return this[r]},set(o){const i=this[t];this[r]=o,this.requestUpdate(t,i,n)},configurable:!0,enumerable:!0}}static getPropertyOptions(t){return this.elementProperties.get(t)||Ee}static finalize(){if(this.hasOwnProperty(ar))return!1;this[ar]=!0;const t=Object.getPrototypeOf(this);if(t.finalize(),t.h!==void 0&&(this.h=[...t.h]),this.elementProperties=new Map(t.elementProperties),this._$Ev=new Map,this.hasOwnProperty("properties")){const r=this.properties,n=[...Object.getOwnPropertyNames(r),...Object.getOwnPropertySymbols(r)];for(const o of n)this.createProperty(o,r[o])}return this.elementStyles=this.finalizeStyles(this.styles),!0}static finalizeStyles(t){const r=[];if(Array.isArray(t)){const n=new Set(t.flat(1/0).reverse());for(const o of n)r.unshift(_r(o))}else t!==void 0&&r.push(_r(t));return r}static _$Ep(t,r){const n=r.attribute;return n===!1?void 0:typeof n=="string"?n:typeof t=="string"?t.toLowerCase():void 0}_$Eu(){var t;this._$E_=new Promise(r=>this.enableUpdating=r),this._$AL=new Map,this._$Eg(),this.requestUpdate(),(t=this.constructor.h)===null||t===void 0||t.forEach(r=>r(this))}addController(t){var r,n;((r=this._$ES)!==null&&r!==void 0?r:this._$ES=[]).push(t),this.renderRoot!==void 0&&this.isConnected&&((n=t.hostConnected)===null||n===void 0||n.call(t))}removeController(t){var r;(r=this._$ES)===null||r===void 0||r.splice(this._$ES.indexOf(t)>>>0,1)}_$Eg(){this.constructor.elementProperties.forEach((t,r)=>{this.hasOwnProperty(r)&&(this._$Ei.set(r,this[r]),delete this[r])})}createRenderRoot(){var t;const r=(t=this.shadowRoot)!==null&&t!==void 0?t:this.attachShadow(this.constructor.shadowRootOptions);return Ho(r,this.constructor.elementStyles),r}connectedCallback(){var t;this.renderRoot===void 0&&(this.renderRoot=this.createRenderRoot()),this.enableUpdating(!0),(t=this._$ES)===null||t===void 0||t.forEach(r=>{var n;return(n=r.hostConnected)===null||n===void 0?void 0:n.call(r)})}enableUpdating(t){}disconnectedCallback(){var t;(t=this._$ES)===null||t===void 0||t.forEach(r=>{var n;return(n=r.hostDisconnected)===null||n===void 0?void 0:n.call(r)})}attributeChangedCallback(t,r,n){this._$AK(t,n)}_$EO(t,r,n=Ee){var o;const i=this.constructor._$Ep(t,n);if(i!==void 0&&n.reflect===!0){const s=(((o=n.converter)===null||o===void 0?void 0:o.toAttribute)!==void 0?n.converter:sr).toAttribute(r,n.type);this._$El=t,s==null?this.removeAttribute(i):this.setAttribute(i,s),this._$El=null}}_$AK(t,r){var n;const o=this.constructor,i=o._$Ev.get(t);if(i!==void 0&&this._$El!==i){const s=o.getPropertyOptions(i),a=typeof s.converter=="function"?{fromAttribute:s.converter}:((n=s.converter)===null||n===void 0?void 0:n.fromAttribute)!==void 0?s.converter:sr;this._$El=i,this[i]=a.fromAttribute(r,s.type),this._$El=null}}requestUpdate(t,r,n){let o=!0;t!==void 0&&(((n=n||this.constructor.getPropertyOptions(t)).hasChanged||no)(this[t],r)?(this._$AL.has(t)||this._$AL.set(t,r),n.reflect===!0&&this._$El!==t&&(this._$EC===void 0&&(this._$EC=new Map),this._$EC.set(t,n))):o=!1),!this.isUpdatePending&&o&&(this._$E_=this._$Ej())}async _$Ej(){this.isUpdatePending=!0;try{await this._$E_}catch(r){Promise.reject(r)}const t=this.scheduleUpdate();return t!=null&&await t,!this.isUpdatePending}scheduleUpdate(){return this.performUpdate()}performUpdate(){var t;if(!this.isUpdatePending)return;this.hasUpdated,this._$Ei&&(this._$Ei.forEach((o,i)=>this[i]=o),this._$Ei=void 0);let r=!1;const n=this._$AL;try{r=this.shouldUpdate(n),r?(this.willUpdate(n),(t=this._$ES)===null||t===void 0||t.forEach(o=>{var i;return(i=o.hostUpdate)===null||i===void 0?void 0:i.call(o)}),this.update(n)):this._$Ek()}catch(o){throw r=!1,this._$Ek(),o}r&&this._$AE(n)}willUpdate(t){}_$AE(t){var r;(r=this._$ES)===null||r===void 0||r.forEach(n=>{var o;return(o=n.hostUpdated)===null||o===void 0?void 0:o.call(n)}),this.hasUpdated||(this.hasUpdated=!0,this.firstUpdated(t)),this.updated(t)}_$Ek(){this._$AL=new Map,this.isUpdatePending=!1}get updateComplete(){return this.getUpdateComplete()}getUpdateComplete(){return this._$E_}shouldUpdate(t){return!0}update(t){this._$EC!==void 0&&(this._$EC.forEach((r,n)=>this._$EO(n,this[n],r)),this._$EC=void 0),this._$Ek()}updated(t){}firstUpdated(t){}};$t[ar]=!0,$t.elementProperties=new Map,$t.elementStyles=[],$t.shadowRootOptions={mode:"open"},Ir==null||Ir({ReactiveElement:$t}),((Ce=he.reactiveElementVersions)!==null&&Ce!==void 0?Ce:he.reactiveElementVersions=[]).push("1.6.3");/** - * @license - * Copyright 2017 Google LLC - * SPDX-License-Identifier: BSD-3-Clause - */var Ae;const ue=window,Ot=ue.trustedTypes,Tr=Ot?Ot.createPolicy("lit-html",{createHTML:e=>e}):void 0,lr="$lit$",rt=`lit$${(Math.random()+"").slice(9)}$`,io="?"+rt,Fo=`<${io}>`,pt=document,Zt=()=>pt.createComment(""),Vt=e=>e===null||typeof e!="object"&&typeof e!="function",so=Array.isArray,Zo=e=>so(e)||typeof(e==null?void 0:e[Symbol.iterator])=="function",_e=`[ -\f\r]`,Rt=/<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g,kr=/-->/g,Mr=/>/g,lt=RegExp(`>|${_e}(?:([^\\s"'>=/]+)(${_e}*=${_e}*(?:[^ -\f\r"'\`<>=]|("|')|))|$)`,"g"),Pr=/'/g,Sr=/"/g,ao=/^(?:script|style|textarea|title)$/i,lo=e=>(t,...r)=>({_$litType$:e,strings:t,values:r}),u=lo(1),L=lo(2),ft=Symbol.for("lit-noChange"),B=Symbol.for("lit-nothing"),Rr=new WeakMap,ut=pt.createTreeWalker(pt,129,null,!1);function co(e,t){if(!Array.isArray(e)||!e.hasOwnProperty("raw"))throw Error("invalid template strings array");return Tr!==void 0?Tr.createHTML(t):t}const Vo=(e,t)=>{const r=e.length-1,n=[];let o,i=t===2?"":"",s=Rt;for(let a=0;a"?(s=o??Rt,y=-1):d[1]===void 0?y=-2:(y=s.lastIndex-d[2].length,c=d[1],s=d[3]===void 0?lt:d[3]==='"'?Sr:Pr):s===Sr||s===Pr?s=lt:s===kr||s===Mr?s=Rt:(s=lt,o=void 0);const p=s===lt&&e[a+1].startsWith("/>")?" ":"";i+=s===Rt?l+Fo:y>=0?(n.push(c),l.slice(0,y)+lr+l.slice(y)+rt+p):l+rt+(y===-2?(n.push(void 0),a):p)}return[co(e,i+(e[r]||"")+(t===2?"":"")),n]};class Kt{constructor({strings:t,_$litType$:r},n){let o;this.parts=[];let i=0,s=0;const a=t.length-1,l=this.parts,[c,d]=Vo(t,r);if(this.el=Kt.createElement(c,n),ut.currentNode=this.el.content,r===2){const y=this.el.content,h=y.firstChild;h.remove(),y.append(...h.childNodes)}for(;(o=ut.nextNode())!==null&&l.length0){o.textContent=Ot?Ot.emptyScript:"";for(let p=0;p2||n[0]!==""||n[1]!==""?(this._$AH=Array(n.length-1).fill(new String),this.strings=n):this._$AH=B}get tagName(){return this.element.tagName}get _$AU(){return this._$AM._$AU}_$AI(t,r=this,n,o){const i=this.strings;let s=!1;if(i===void 0)t=It(this,t,r,0),s=!Vt(t)||t!==this._$AH&&t!==ft,s&&(this._$AH=t);else{const a=t;let l,c;for(t=i[0],l=0;l{var n,o;const i=(n=r==null?void 0:r.renderBefore)!==null&&n!==void 0?n:t;let s=i._$litPart$;if(s===void 0){const a=(o=r==null?void 0:r.renderBefore)!==null&&o!==void 0?o:null;i._$litPart$=s=new Jt(t.insertBefore(Zt(),a),a,void 0,r??{})}return s._$AI(e),s};/** - * @license - * Copyright 2017 Google LLC - * SPDX-License-Identifier: BSD-3-Clause - */var Oe,Ie;class A extends $t{constructor(){super(...arguments),this.renderOptions={host:this},this._$Do=void 0}createRenderRoot(){var t,r;const n=super.createRenderRoot();return(t=(r=this.renderOptions).renderBefore)!==null&&t!==void 0||(r.renderBefore=n.firstChild),n}update(t){const r=this.render();this.hasUpdated||(this.renderOptions.isConnected=this.isConnected),super.update(t),this._$Do=Xo(r,this.renderRoot,this.renderOptions)}connectedCallback(){var t;super.connectedCallback(),(t=this._$Do)===null||t===void 0||t.setConnected(!0)}disconnectedCallback(){var t;super.disconnectedCallback(),(t=this._$Do)===null||t===void 0||t.setConnected(!1)}render(){return ft}}A.finalized=!0,A._$litElement$=!0,(Oe=globalThis.litElementHydrateSupport)===null||Oe===void 0||Oe.call(globalThis,{LitElement:A});const Nr=globalThis.litElementPolyfillSupport;Nr==null||Nr({LitElement:A});((Ie=globalThis.litElementVersions)!==null&&Ie!==void 0?Ie:globalThis.litElementVersions=[]).push("3.3.3");/** - * @license - * Copyright 2017 Google LLC - * SPDX-License-Identifier: BSD-3-Clause - */const I=e=>t=>typeof t=="function"?((r,n)=>(customElements.define(r,n),n))(e,t):((r,n)=>{const{kind:o,elements:i}=n;return{kind:o,elements:i,finisher(s){customElements.define(r,s)}}})(e,t);/** - * @license - * Copyright 2017 Google LLC - * SPDX-License-Identifier: BSD-3-Clause - */const tn=(e,t)=>t.kind==="method"&&t.descriptor&&!("value"in t.descriptor)?{...t,finisher(r){r.createProperty(t.key,e)}}:{kind:"field",key:Symbol(),placement:"own",descriptor:{},originalKey:t.key,initializer(){typeof t.initializer=="function"&&(this[t.key]=t.initializer.call(this))},finisher(r){r.createProperty(t.key,e)}},en=(e,t,r)=>{t.constructor.createProperty(r,e)};function $(e){return(t,r)=>r!==void 0?en(e,t,r):tn(e,t)}/** - * @license - * Copyright 2017 Google LLC - * SPDX-License-Identifier: BSD-3-Clause - */function H(e){return $({...e,state:!0})}/** - * @license - * Copyright 2021 Google LLC - * SPDX-License-Identifier: BSD-3-Clause - */var Te;((Te=window.HTMLSlotElement)===null||Te===void 0?void 0:Te.prototype.assignedElements)!=null;/** - * @license - * Copyright 2017 Google LLC - * SPDX-License-Identifier: BSD-3-Clause - */const rn={ATTRIBUTE:1,CHILD:2,PROPERTY:3,BOOLEAN_ATTRIBUTE:4,EVENT:5,ELEMENT:6},on=e=>(...t)=>({_$litDirective$:e,values:t});class nn{constructor(t){}get _$AU(){return this._$AM._$AU}_$AT(t,r,n){this._$Ct=t,this._$AM=r,this._$Ci=n}_$AS(t,r){return this.update(t,r)}update(t,r){return this.render(...r)}}/** - * @license - * Copyright 2018 Google LLC - * SPDX-License-Identifier: BSD-3-Clause - */const G=on(class extends nn{constructor(e){var t;if(super(e),e.type!==rn.ATTRIBUTE||e.name!=="class"||((t=e.strings)===null||t===void 0?void 0:t.length)>2)throw Error("`classMap()` can only be used in the `class` attribute and must be the only part in the attribute.")}render(e){return" "+Object.keys(e).filter(t=>e[t]).join(" ")+" "}update(e,[t]){var r,n;if(this.it===void 0){this.it=new Set,e.strings!==void 0&&(this.nt=new Set(e.strings.join(" ").split(/\s/).filter(i=>i!=="")));for(const i in t)t[i]&&!(!((r=this.nt)===null||r===void 0)&&r.has(i))&&this.it.add(i);return this.render(t)}const o=e.element.classList;this.it.forEach(i=>{i in t||(o.remove(i),this.it.delete(i))});for(const i in t){const s=!!t[i];s===this.it.has(i)||!((n=this.nt)===null||n===void 0)&&n.has(i)||(s?(o.add(i),this.it.add(i)):(o.remove(i),this.it.delete(i)))}return ft}});function sn(e,t){e.indexOf(t)===-1&&e.push(t)}const ho=(e,t,r)=>Math.min(Math.max(r,e),t),Z={duration:.3,delay:0,endDelay:0,repeat:0,easing:"ease"},me=e=>typeof e=="number",Et=e=>Array.isArray(e)&&!me(e[0]),an=(e,t,r)=>{const n=t-e;return((r-e)%n+n)%n+e};function ln(e,t){return Et(e)?e[an(0,e.length,t)]:e}const uo=(e,t,r)=>-r*e+r*t+e,mo=()=>{},it=e=>e,vr=(e,t,r)=>t-e===0?1:(r-e)/(t-e);function go(e,t){const r=e[e.length-1];for(let n=1;n<=t;n++){const o=vr(0,t,n);e.push(uo(r,1,o))}}function cn(e){const t=[0];return go(t,e-1),t}function dn(e,t=cn(e.length),r=it){const n=e.length,o=n-t.length;return o>0&&go(t,o),i=>{let s=0;for(;sArray.isArray(e)&&me(e[0]),cr=e=>typeof e=="object"&&!!e.createAnimation,Tt=e=>typeof e=="function",hn=e=>typeof e=="string",zt={ms:e=>e*1e3,s:e=>e/1e3},fo=(e,t,r)=>(((1-3*r+3*t)*e+(3*r-6*t))*e+3*t)*e,un=1e-7,mn=12;function gn(e,t,r,n,o){let i,s,a=0;do s=t+(r-t)/2,i=fo(s,n,o)-e,i>0?r=s:t=s;while(Math.abs(i)>un&&++agn(i,0,1,e,r);return i=>i===0||i===1?i:fo(o(i),t,n)}const pn=(e,t="end")=>r=>{r=t==="end"?Math.min(r,.999):Math.max(r,.001);const n=r*e,o=t==="end"?Math.floor(n):Math.ceil(n);return ho(0,1,o/e)},Br={ease:Ht(.25,.1,.25,1),"ease-in":Ht(.42,0,1,1),"ease-in-out":Ht(.42,0,.58,1),"ease-out":Ht(0,0,.58,1)},fn=/\((.*?)\)/;function Dr(e){if(Tt(e))return e;if(po(e))return Ht(...e);if(Br[e])return Br[e];if(e.startsWith("steps")){const t=fn.exec(e);if(t){const r=t[1].split(",");return pn(parseFloat(r[0]),r[1].trim())}}return it}class wo{constructor(t,r=[0,1],{easing:n,duration:o=Z.duration,delay:i=Z.delay,endDelay:s=Z.endDelay,repeat:a=Z.repeat,offset:l,direction:c="normal",autoplay:d=!0}={}){if(this.startTime=null,this.rate=1,this.t=0,this.cancelTimestamp=null,this.easing=it,this.duration=0,this.totalDuration=0,this.repeat=0,this.playState="idle",this.finished=new Promise((h,p)=>{this.resolve=h,this.reject=p}),n=n||Z.easing,cr(n)){const h=n.createAnimation(r);n=h.easing,r=h.keyframes||r,o=h.duration||o}this.repeat=a,this.easing=Et(n)?it:Dr(n),this.updateDuration(o);const y=dn(r,l,Et(n)?n.map(Dr):it);this.tick=h=>{var p;i=i;let f=0;this.pauseTime!==void 0?f=this.pauseTime:f=(h-this.startTime)*this.rate,this.t=f,f/=1e3,f=Math.max(f-i,0),this.playState==="finished"&&this.pauseTime===void 0&&(f=this.totalDuration);const g=f/this.duration;let O=Math.floor(g),m=g%1;!m&&g>=1&&(m=1),m===1&&O--;const b=O%2;(c==="reverse"||c==="alternate"&&b||c==="alternate-reverse"&&!b)&&(m=1-m);const w=f>=this.totalDuration?1:Math.min(m,1),v=y(this.easing(w));t(v),this.pauseTime===void 0&&(this.playState==="finished"||f>=this.totalDuration+s)?(this.playState="finished",(p=this.resolve)===null||p===void 0||p.call(this,v)):this.playState!=="idle"&&(this.frameRequestId=requestAnimationFrame(this.tick))},d&&this.play()}play(){const t=performance.now();this.playState="running",this.pauseTime!==void 0?this.startTime=t-this.pauseTime:this.startTime||(this.startTime=t),this.cancelTimestamp=this.startTime,this.pauseTime=void 0,this.frameRequestId=requestAnimationFrame(this.tick)}pause(){this.playState="paused",this.pauseTime=this.t}finish(){this.playState="finished",this.tick(0)}stop(){var t;this.playState="idle",this.frameRequestId!==void 0&&cancelAnimationFrame(this.frameRequestId),(t=this.reject)===null||t===void 0||t.call(this,!1)}cancel(){this.stop(),this.tick(this.cancelTimestamp)}reverse(){this.rate*=-1}commitStyles(){}updateDuration(t){this.duration=t,this.totalDuration=t*(this.repeat+1)}get currentTime(){return this.t}set currentTime(t){this.pauseTime!==void 0||this.rate===0?this.pauseTime=t:this.startTime=performance.now()-t/this.rate}get playbackRate(){return this.rate}set playbackRate(t){this.rate=t}}class wn{setAnimation(t){this.animation=t,t==null||t.finished.then(()=>this.clearAnimation()).catch(()=>{})}clearAnimation(){this.animation=this.generator=void 0}}const ke=new WeakMap;function vo(e){return ke.has(e)||ke.set(e,{transforms:[],values:new Map}),ke.get(e)}function vn(e,t){return e.has(t)||e.set(t,new wn),e.get(t)}const bn=["","X","Y","Z"],yn=["translate","scale","rotate","skew"],ge={x:"translateX",y:"translateY",z:"translateZ"},Ur={syntax:"",initialValue:"0deg",toDefaultUnit:e=>e+"deg"},xn={translate:{syntax:"",initialValue:"0px",toDefaultUnit:e=>e+"px"},rotate:Ur,scale:{syntax:"",initialValue:1,toDefaultUnit:it},skew:Ur},qt=new Map,br=e=>`--motion-${e}`,pe=["x","y","z"];yn.forEach(e=>{bn.forEach(t=>{pe.push(e+t),qt.set(br(e+t),xn[e])})});const $n=(e,t)=>pe.indexOf(e)-pe.indexOf(t),Cn=new Set(pe),bo=e=>Cn.has(e),En=(e,t)=>{ge[t]&&(t=ge[t]);const{transforms:r}=vo(e);sn(r,t),e.style.transform=An(r)},An=e=>e.sort($n).reduce(_n,"").trim(),_n=(e,t)=>`${e} ${t}(var(${br(t)}))`,dr=e=>e.startsWith("--"),Wr=new Set;function On(e){if(!Wr.has(e)){Wr.add(e);try{const{syntax:t,initialValue:r}=qt.has(e)?qt.get(e):{};CSS.registerProperty({name:e,inherits:!1,syntax:t,initialValue:r})}catch{}}}const Me=(e,t)=>document.createElement("div").animate(e,t),jr={cssRegisterProperty:()=>typeof CSS<"u"&&Object.hasOwnProperty.call(CSS,"registerProperty"),waapi:()=>Object.hasOwnProperty.call(Element.prototype,"animate"),partialKeyframes:()=>{try{Me({opacity:[1]})}catch{return!1}return!0},finished:()=>!!Me({opacity:[0,1]},{duration:.001}).finished,linearEasing:()=>{try{Me({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0}},Pe={},Ct={};for(const e in jr)Ct[e]=()=>(Pe[e]===void 0&&(Pe[e]=jr[e]()),Pe[e]);const In=.015,Tn=(e,t)=>{let r="";const n=Math.round(t/In);for(let o=0;oTt(e)?Ct.linearEasing()?`linear(${Tn(e,t)})`:Z.easing:po(e)?kn(e):e,kn=([e,t,r,n])=>`cubic-bezier(${e}, ${t}, ${r}, ${n})`;function Mn(e,t){for(let r=0;rArray.isArray(e)?e:[e];function hr(e){return ge[e]&&(e=ge[e]),bo(e)?br(e):e}const Xt={get:(e,t)=>{t=hr(t);let r=dr(t)?e.style.getPropertyValue(t):getComputedStyle(e)[t];if(!r&&r!==0){const n=qt.get(t);n&&(r=n.initialValue)}return r},set:(e,t,r)=>{t=hr(t),dr(t)?e.style.setProperty(t,r):e.style[t]=r}};function yo(e,t=!0){if(!(!e||e.playState==="finished"))try{e.stop?e.stop():(t&&e.commitStyles(),e.cancel())}catch{}}function Sn(e,t){var r;let n=(t==null?void 0:t.toDefaultUnit)||it;const o=e[e.length-1];if(hn(o)){const i=((r=o.match(/(-?[\d.]+)([a-z%]*)/))===null||r===void 0?void 0:r[2])||"";i&&(n=s=>s+i)}return n}function Rn(){return window.__MOTION_DEV_TOOLS_RECORD}function Ln(e,t,r,n={},o){const i=Rn(),s=n.record!==!1&&i;let a,{duration:l=Z.duration,delay:c=Z.delay,endDelay:d=Z.endDelay,repeat:y=Z.repeat,easing:h=Z.easing,persist:p=!1,direction:f,offset:g,allowWebkitAcceleration:O=!1,autoplay:m=!0}=n;const b=vo(e),w=bo(t);let v=Ct.waapi();w&&En(e,t);const E=hr(t),P=vn(b.values,E),S=qt.get(E);return yo(P.animation,!(cr(h)&&P.generator)&&n.record!==!1),()=>{const U=()=>{var R,Y;return(Y=(R=Xt.get(e,E))!==null&&R!==void 0?R:S==null?void 0:S.initialValue)!==null&&Y!==void 0?Y:0};let M=Mn(Pn(r),U);const z=Sn(M,S);if(cr(h)){const R=h.createAnimation(M,t!=="opacity",U,E,P);h=R.easing,M=R.keyframes||M,l=R.duration||l}if(dr(E)&&(Ct.cssRegisterProperty()?On(E):v=!1),w&&!Ct.linearEasing()&&(Tt(h)||Et(h)&&h.some(Tt))&&(v=!1),v){S&&(M=M.map(D=>me(D)?S.toDefaultUnit(D):D)),M.length===1&&(!Ct.partialKeyframes()||s)&&M.unshift(U());const R={delay:zt.ms(c),duration:zt.ms(l),endDelay:zt.ms(d),easing:Et(h)?void 0:Hr(h,l),direction:f,iterations:y+1,fill:"both"};a=e.animate({[E]:M,offset:g,easing:Et(h)?h.map(D=>Hr(D,l)):void 0},R),a.finished||(a.finished=new Promise((D,Bo)=>{a.onfinish=D,a.oncancel=Bo}));const Y=M[M.length-1];a.finished.then(()=>{p||(Xt.set(e,E,Y),a.cancel())}).catch(mo),O||(a.playbackRate=1.000001)}else if(o&&w)M=M.map(R=>typeof R=="string"?parseFloat(R):R),M.length===1&&M.unshift(parseFloat(U())),a=new o(R=>{Xt.set(e,E,z?z(R):R)},M,Object.assign(Object.assign({},n),{duration:l,easing:h}));else{const R=M[M.length-1];Xt.set(e,E,S&&me(R)?S.toDefaultUnit(R):R)}return s&&i(e,t,M,{duration:l,delay:c,easing:h,repeat:y,offset:g},"motion-one"),P.setAnimation(a),a&&!m&&a.pause(),a}}const Nn=(e,t)=>e[t]?Object.assign(Object.assign({},e),e[t]):Object.assign({},e);function Bn(e,t){var r;return typeof e=="string"?t?((r=t[e])!==null&&r!==void 0||(t[e]=document.querySelectorAll(e)),e=t[e]):e=document.querySelectorAll(e):e instanceof Element&&(e=[e]),Array.from(e||[])}const Dn=e=>e(),xo=(e,t,r=Z.duration)=>new Proxy({animations:e.map(Dn).filter(Boolean),duration:r,options:t},Wn),Un=e=>e.animations[0],Wn={get:(e,t)=>{const r=Un(e);switch(t){case"duration":return e.duration;case"currentTime":return zt.s((r==null?void 0:r[t])||0);case"playbackRate":case"playState":return r==null?void 0:r[t];case"finished":return e.finished||(e.finished=Promise.all(e.animations.map(jn)).catch(mo)),e.finished;case"stop":return()=>{e.animations.forEach(n=>yo(n))};case"forEachNative":return n=>{e.animations.forEach(o=>n(o,e))};default:return typeof(r==null?void 0:r[t])>"u"?void 0:()=>e.animations.forEach(n=>n[t]())}},set:(e,t,r)=>{switch(t){case"currentTime":r=zt.ms(r);case"playbackRate":for(let n=0;ne.finished;function Hn(e,t,r){return Tt(e)?e(t,r):e}function zn(e){return function(r,n,o={}){r=Bn(r);const i=r.length,s=[];for(let a=0;a{const r=new wo(e,[0,1],t);return r.finished.catch(()=>{}),r}],t,t.duration)}function mt(e,t,r){return(Tt(e)?Zn:Fn)(e,t,r)}/** - * @license - * Copyright 2018 Google LLC - * SPDX-License-Identifier: BSD-3-Clause - */const W=e=>e??B;var Gt={},Vn=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},$o={},F={};let yr;const Kn=[0,26,44,70,100,134,172,196,242,292,346,404,466,532,581,655,733,815,901,991,1085,1156,1258,1364,1474,1588,1706,1828,1921,2051,2185,2323,2465,2611,2761,2876,3034,3196,3362,3532,3706];F.getSymbolSize=function(t){if(!t)throw new Error('"version" cannot be null or undefined');if(t<1||t>40)throw new Error('"version" should be in range from 1 to 40');return t*4+17};F.getSymbolTotalCodewords=function(t){return Kn[t]};F.getBCHDigit=function(e){let t=0;for(;e!==0;)t++,e>>>=1;return t};F.setToSJISFunction=function(t){if(typeof t!="function")throw new Error('"toSJISFunc" is not a valid function.');yr=t};F.isKanjiModeEnabled=function(){return typeof yr<"u"};F.toSJIS=function(t){return yr(t)};var be={};(function(e){e.L={bit:1},e.M={bit:0},e.Q={bit:3},e.H={bit:2};function t(r){if(typeof r!="string")throw new Error("Param is not a string");switch(r.toLowerCase()){case"l":case"low":return e.L;case"m":case"medium":return e.M;case"q":case"quartile":return e.Q;case"h":case"high":return e.H;default:throw new Error("Unknown EC Level: "+r)}}e.isValid=function(n){return n&&typeof n.bit<"u"&&n.bit>=0&&n.bit<4},e.from=function(n,o){if(e.isValid(n))return n;try{return t(n)}catch{return o}}})(be);function Co(){this.buffer=[],this.length=0}Co.prototype={get:function(e){const t=Math.floor(e/8);return(this.buffer[t]>>>7-e%8&1)===1},put:function(e,t){for(let r=0;r>>t-r-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(e){const t=Math.floor(this.length/8);this.buffer.length<=t&&this.buffer.push(0),e&&(this.buffer[t]|=128>>>this.length%8),this.length++}};var qn=Co;function Qt(e){if(!e||e<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=e,this.data=new Uint8Array(e*e),this.reservedBit=new Uint8Array(e*e)}Qt.prototype.set=function(e,t,r,n){const o=e*this.size+t;this.data[o]=r,n&&(this.reservedBit[o]=!0)};Qt.prototype.get=function(e,t){return this.data[e*this.size+t]};Qt.prototype.xor=function(e,t,r){this.data[e*this.size+t]^=r};Qt.prototype.isReserved=function(e,t){return this.reservedBit[e*this.size+t]};var Yn=Qt,Eo={};(function(e){const t=F.getSymbolSize;e.getRowColCoords=function(n){if(n===1)return[];const o=Math.floor(n/7)+2,i=t(n),s=i===145?26:Math.ceil((i-13)/(2*o-2))*2,a=[i-7];for(let l=1;l=0&&o<=7},e.from=function(o){return e.isValid(o)?parseInt(o,10):void 0},e.getPenaltyN1=function(o){const i=o.size;let s=0,a=0,l=0,c=null,d=null;for(let y=0;y=5&&(s+=t.N1+(a-5)),c=p,a=1),p=o.get(h,y),p===d?l++:(l>=5&&(s+=t.N1+(l-5)),d=p,l=1)}a>=5&&(s+=t.N1+(a-5)),l>=5&&(s+=t.N1+(l-5))}return s},e.getPenaltyN2=function(o){const i=o.size;let s=0;for(let a=0;a=10&&(a===1488||a===93)&&s++,l=l<<1&2047|o.get(d,c),d>=10&&(l===1488||l===93)&&s++}return s*t.N3},e.getPenaltyN4=function(o){let i=0;const s=o.data.length;for(let l=0;l=0;){const s=i[0];for(let l=0;l0){const i=new Uint8Array(this.degree);return i.set(n,o),i}return n};var Gn=xr,To={},at={},$r={};$r.isValid=function(t){return!isNaN(t)&&t>=1&&t<=40};var q={};const ko="[0-9]+",Qn="[A-Z $%*+\\-./:]+";let Yt="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Yt=Yt.replace(/u/g,"\\u");const Xn="(?:(?![A-Z0-9 $%*+\\-./:]|"+Yt+`)(?:.|[\r -]))+`;q.KANJI=new RegExp(Yt,"g");q.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");q.BYTE=new RegExp(Xn,"g");q.NUMERIC=new RegExp(ko,"g");q.ALPHANUMERIC=new RegExp(Qn,"g");const ti=new RegExp("^"+Yt+"$"),ei=new RegExp("^"+ko+"$"),ri=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");q.testKanji=function(t){return ti.test(t)};q.testNumeric=function(t){return ei.test(t)};q.testAlphanumeric=function(t){return ri.test(t)};(function(e){const t=$r,r=q;e.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},e.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},e.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},e.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},e.MIXED={bit:-1},e.getCharCountIndicator=function(i,s){if(!i.ccBits)throw new Error("Invalid mode: "+i);if(!t.isValid(s))throw new Error("Invalid version: "+s);return s>=1&&s<10?i.ccBits[0]:s<27?i.ccBits[1]:i.ccBits[2]},e.getBestModeForData=function(i){return r.testNumeric(i)?e.NUMERIC:r.testAlphanumeric(i)?e.ALPHANUMERIC:r.testKanji(i)?e.KANJI:e.BYTE},e.toString=function(i){if(i&&i.id)return i.id;throw new Error("Invalid mode")},e.isValid=function(i){return i&&i.bit&&i.ccBits};function n(o){if(typeof o!="string")throw new Error("Param is not a string");switch(o.toLowerCase()){case"numeric":return e.NUMERIC;case"alphanumeric":return e.ALPHANUMERIC;case"kanji":return e.KANJI;case"byte":return e.BYTE;default:throw new Error("Unknown mode: "+o)}}e.from=function(i,s){if(e.isValid(i))return i;try{return n(i)}catch{return s}}})(at);(function(e){const t=F,r=ye,n=be,o=at,i=$r,s=7973,a=t.getBCHDigit(s);function l(h,p,f){for(let g=1;g<=40;g++)if(p<=e.getCapacity(g,f,h))return g}function c(h,p){return o.getCharCountIndicator(h,p)+4}function d(h,p){let f=0;return h.forEach(function(g){const O=c(g.mode,p);f+=O+g.getBitsLength()}),f}function y(h,p){for(let f=1;f<=40;f++)if(d(h,f)<=e.getCapacity(f,p,o.MIXED))return f}e.from=function(p,f){return i.isValid(p)?parseInt(p,10):f},e.getCapacity=function(p,f,g){if(!i.isValid(p))throw new Error("Invalid QR Code version");typeof g>"u"&&(g=o.BYTE);const O=t.getSymbolTotalCodewords(p),m=r.getTotalCodewordsCount(p,f),b=(O-m)*8;if(g===o.MIXED)return b;const w=b-c(g,p);switch(g){case o.NUMERIC:return Math.floor(w/10*3);case o.ALPHANUMERIC:return Math.floor(w/11*2);case o.KANJI:return Math.floor(w/13);case o.BYTE:default:return Math.floor(w/8)}},e.getBestVersionForData=function(p,f){let g;const O=n.from(f,n.M);if(Array.isArray(p)){if(p.length>1)return y(p,O);if(p.length===0)return 1;g=p[0]}else g=p;return l(g.mode,g.getLength(),O)},e.getEncodedBits=function(p){if(!i.isValid(p)||p<7)throw new Error("Invalid QR Code version");let f=p<<12;for(;t.getBCHDigit(f)-a>=0;)f^=s<=0;)o^=Po<0&&(n=this.data.substr(r),o=parseInt(n,10),t.put(o,i*3+1))};var ii=kt;const si=at,Se=["0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z"," ","$","%","*","+","-",".","/",":"];function Mt(e){this.mode=si.ALPHANUMERIC,this.data=e}Mt.getBitsLength=function(t){return 11*Math.floor(t/2)+6*(t%2)};Mt.prototype.getLength=function(){return this.data.length};Mt.prototype.getBitsLength=function(){return Mt.getBitsLength(this.data.length)};Mt.prototype.write=function(t){let r;for(r=0;r+2<=this.data.length;r+=2){let n=Se.indexOf(this.data[r])*45;n+=Se.indexOf(this.data[r+1]),t.put(n,11)}this.data.length%2&&t.put(Se.indexOf(this.data[r]),6)};var ai=Mt;const li=Uo,ci=at;function Pt(e){this.mode=ci.BYTE,typeof e=="string"&&(e=li(e)),this.data=new Uint8Array(e)}Pt.getBitsLength=function(t){return t*8};Pt.prototype.getLength=function(){return this.data.length};Pt.prototype.getBitsLength=function(){return Pt.getBitsLength(this.data.length)};Pt.prototype.write=function(e){for(let t=0,r=this.data.length;t=33088&&r<=40956)r-=33088;else if(r>=57408&&r<=60351)r-=49472;else throw new Error("Invalid SJIS character: "+this.data[t]+` -Make sure your charset is UTF-8`);r=(r>>>8&255)*192+(r&255),e.put(r,13)}};var mi=St;(function(e){const t=at,r=ii,n=ai,o=di,i=mi,s=q,a=F,l=Wo;function c(m){return unescape(encodeURIComponent(m)).length}function d(m,b,w){const v=[];let E;for(;(E=m.exec(w))!==null;)v.push({data:E[0],index:E.index,mode:b,length:E[0].length});return v}function y(m){const b=d(s.NUMERIC,t.NUMERIC,m),w=d(s.ALPHANUMERIC,t.ALPHANUMERIC,m);let v,E;return a.isKanjiModeEnabled()?(v=d(s.BYTE,t.BYTE,m),E=d(s.KANJI,t.KANJI,m)):(v=d(s.BYTE_KANJI,t.BYTE,m),E=[]),b.concat(w,v,E).sort(function(S,U){return S.index-U.index}).map(function(S){return{data:S.data,mode:S.mode,length:S.length}})}function h(m,b){switch(b){case t.NUMERIC:return r.getBitsLength(m);case t.ALPHANUMERIC:return n.getBitsLength(m);case t.KANJI:return i.getBitsLength(m);case t.BYTE:return o.getBitsLength(m)}}function p(m){return m.reduce(function(b,w){const v=b.length-1>=0?b[b.length-1]:null;return v&&v.mode===w.mode?(b[b.length-1].data+=w.data,b):(b.push(w),b)},[])}function f(m){const b=[];for(let w=0;w=0&&a<=6&&(l===0||l===6)||l>=0&&l<=6&&(a===0||a===6)||a>=2&&a<=4&&l>=2&&l<=4?e.set(i+a,s+l,!0,!0):e.set(i+a,s+l,!1,!0))}}function $i(e){const t=e.size;for(let r=8;r>a&1)===1,e.set(o,i,s,!0),e.set(i,o,s,!0)}function Ne(e,t,r){const n=e.size,o=bi.getEncodedBits(t,r);let i,s;for(i=0;i<15;i++)s=(o>>i&1)===1,i<6?e.set(i,8,s,!0):i<8?e.set(i+1,8,s,!0):e.set(n-15+i,8,s,!0),i<8?e.set(8,n-i-1,s,!0):i<9?e.set(8,15-i-1+1,s,!0):e.set(8,15-i-1,s,!0);e.set(n-8,8,1,!0)}function Ai(e,t){const r=e.size;let n=-1,o=r-1,i=7,s=0;for(let a=r-1;a>0;a-=2)for(a===6&&a--;;){for(let l=0;l<2;l++)if(!e.isReserved(o,a-l)){let c=!1;s>>i&1)===1),e.set(o,a-l,c),i--,i===-1&&(s++,i=7)}if(o+=n,o<0||r<=o){o-=n,n=-n;break}}}function _i(e,t,r){const n=new gi;r.forEach(function(l){n.put(l.mode.bit,4),n.put(l.getLength(),yi.getCharCountIndicator(l.mode,e)),l.write(n)});const o=$e.getSymbolTotalCodewords(e),i=gr.getTotalCodewordsCount(e,t),s=(o-i)*8;for(n.getLengthInBits()+4<=s&&n.put(0,4);n.getLengthInBits()%8!==0;)n.putBit(0);const a=(s-n.getLengthInBits())/8;for(let l=0;l=7&&Ei(l,t),Ai(l,s),isNaN(n)&&(n=mr.getBestMask(l,Ne.bind(null,l,r))),mr.applyMask(n,l),Ne(l,r,n),{modules:l,version:t,errorCorrectionLevel:r,maskPattern:n,segments:o}}$o.create=function(t,r){if(typeof t>"u"||t==="")throw new Error("No input text");let n=Re.M,o,i;return typeof r<"u"&&(n=Re.from(r.errorCorrectionLevel,Re.M),o=we.from(r.version),i=mr.from(r.maskPattern),r.toSJISFunc&&$e.setToSJISFunction(r.toSJISFunc)),Ii(t,o,n,i)};var Ro={},Cr={};(function(e){function t(r){if(typeof r=="number"&&(r=r.toString()),typeof r!="string")throw new Error("Color should be defined as hex string");let n=r.slice().replace("#","").split("");if(n.length<3||n.length===5||n.length>8)throw new Error("Invalid hex color: "+r);(n.length===3||n.length===4)&&(n=Array.prototype.concat.apply([],n.map(function(i){return[i,i]}))),n.length===6&&n.push("F","F");const o=parseInt(n.join(""),16);return{r:o>>24&255,g:o>>16&255,b:o>>8&255,a:o&255,hex:"#"+n.slice(0,6).join("")}}e.getOptions=function(n){n||(n={}),n.color||(n.color={});const o=typeof n.margin>"u"||n.margin===null||n.margin<0?4:n.margin,i=n.width&&n.width>=21?n.width:void 0,s=n.scale||4;return{width:i,scale:i?4:s,margin:o,color:{dark:t(n.color.dark||"#000000ff"),light:t(n.color.light||"#ffffffff")},type:n.type,rendererOpts:n.rendererOpts||{}}},e.getScale=function(n,o){return o.width&&o.width>=n+o.margin*2?o.width/(n+o.margin*2):o.scale},e.getImageWidth=function(n,o){const i=e.getScale(n,o);return Math.floor((n+o.margin*2)*i)},e.qrToImageData=function(n,o,i){const s=o.modules.size,a=o.modules.data,l=e.getScale(s,i),c=Math.floor((s+i.margin*2)*l),d=i.margin*l,y=[i.color.light,i.color.dark];for(let h=0;h=d&&p>=d&&h"u"&&(!s||!s.getContext)&&(l=s,s=void 0),s||(c=n()),l=t.getOptions(l);const d=t.getImageWidth(i.modules.size,l),y=c.getContext("2d"),h=y.createImageData(d,d);return t.qrToImageData(h.data,i,l),r(y,c,d),y.putImageData(h,0,0),c},e.renderToDataURL=function(i,s,a){let l=a;typeof l>"u"&&(!s||!s.getContext)&&(l=s,s=void 0),l||(l={});const c=e.render(i,s,l),d=l.type||"image/png",y=l.rendererOpts||{};return c.toDataURL(d,y.quality)}})(Ro);var Lo={};const Ti=Cr;function Zr(e,t){const r=e.a/255,n=t+'="'+e.hex+'"';return r<1?n+" "+t+'-opacity="'+r.toFixed(2).slice(1)+'"':n}function Be(e,t,r){let n=e+t;return typeof r<"u"&&(n+=" "+r),n}function ki(e,t,r){let n="",o=0,i=!1,s=0;for(let a=0;a0&&l>0&&e[a-1]||(n+=i?Be("M",l+r,.5+c+r):Be("m",o,0),o=0,i=!1),l+1':"",c="',d='viewBox="0 0 '+a+" "+a+'"',h=''+l+c+` -`;return typeof n=="function"&&n(null,h),h};const Mi=Vn,pr=$o,No=Ro,Pi=Lo;function Er(e,t,r,n,o){const i=[].slice.call(arguments,1),s=i.length,a=typeof i[s-1]=="function";if(!a&&!Mi())throw new Error("Callback required as last argument");if(a){if(s<2)throw new Error("Too few arguments provided");s===2?(o=r,r=t,t=n=void 0):s===3&&(t.getContext&&typeof o>"u"?(o=n,n=void 0):(o=n,n=r,r=t,t=void 0))}else{if(s<1)throw new Error("Too few arguments provided");return s===1?(r=t,t=n=void 0):s===2&&!t.getContext&&(n=r,r=t,t=void 0),new Promise(function(l,c){try{const d=pr.create(r,n);l(e(d,t,n))}catch(d){c(d)}})}try{const l=pr.create(r,n);o(null,e(l,t,n))}catch(l){o(l)}}Gt.create=pr.create;Gt.toCanvas=Er.bind(null,No.render);Gt.toDataURL=Er.bind(null,No.renderToDataURL);Gt.toString=Er.bind(null,function(e,t,r){return Pi.render(e,r)});var Si=Object.defineProperty,Vr=Object.getOwnPropertySymbols,Ri=Object.prototype.hasOwnProperty,Li=Object.prototype.propertyIsEnumerable,Kr=(e,t,r)=>t in e?Si(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,De=(e,t)=>{for(var r in t||(t={}))Ri.call(t,r)&&Kr(e,r,t[r]);if(Vr)for(var r of Vr(t))Li.call(t,r)&&Kr(e,r,t[r]);return e};function Ni(){var e;const t=(e=_t.state.themeMode)!=null?e:"dark",r={light:{foreground:{1:"rgb(20,20,20)",2:"rgb(121,134,134)",3:"rgb(158,169,169)"},background:{1:"rgb(255,255,255)",2:"rgb(241,243,243)",3:"rgb(228,231,231)"},overlay:"rgba(0,0,0,0.1)"},dark:{foreground:{1:"rgb(228,231,231)",2:"rgb(148,158,158)",3:"rgb(110,119,119)"},background:{1:"rgb(20,20,20)",2:"rgb(39,42,42)",3:"rgb(59,64,64)"},overlay:"rgba(255,255,255,0.1)"}}[t];return{"--wcm-color-fg-1":r.foreground[1],"--wcm-color-fg-2":r.foreground[2],"--wcm-color-fg-3":r.foreground[3],"--wcm-color-bg-1":r.background[1],"--wcm-color-bg-2":r.background[2],"--wcm-color-bg-3":r.background[3],"--wcm-color-overlay":r.overlay}}function qr(){return{"--wcm-accent-color":"#3396FF","--wcm-accent-fill-color":"#FFFFFF","--wcm-z-index":"89","--wcm-background-color":"#3396FF","--wcm-background-border-radius":"8px","--wcm-container-border-radius":"30px","--wcm-wallet-icon-border-radius":"15px","--wcm-wallet-icon-large-border-radius":"30px","--wcm-wallet-icon-small-border-radius":"7px","--wcm-input-border-radius":"28px","--wcm-button-border-radius":"10px","--wcm-notification-border-radius":"36px","--wcm-secondary-button-border-radius":"28px","--wcm-icon-button-border-radius":"50%","--wcm-button-hover-highlight-border-radius":"10px","--wcm-text-big-bold-size":"20px","--wcm-text-big-bold-weight":"600","--wcm-text-big-bold-line-height":"24px","--wcm-text-big-bold-letter-spacing":"-0.03em","--wcm-text-big-bold-text-transform":"none","--wcm-text-xsmall-bold-size":"10px","--wcm-text-xsmall-bold-weight":"700","--wcm-text-xsmall-bold-line-height":"12px","--wcm-text-xsmall-bold-letter-spacing":"0.02em","--wcm-text-xsmall-bold-text-transform":"uppercase","--wcm-text-xsmall-regular-size":"12px","--wcm-text-xsmall-regular-weight":"600","--wcm-text-xsmall-regular-line-height":"14px","--wcm-text-xsmall-regular-letter-spacing":"-0.03em","--wcm-text-xsmall-regular-text-transform":"none","--wcm-text-small-thin-size":"14px","--wcm-text-small-thin-weight":"500","--wcm-text-small-thin-line-height":"16px","--wcm-text-small-thin-letter-spacing":"-0.03em","--wcm-text-small-thin-text-transform":"none","--wcm-text-small-regular-size":"14px","--wcm-text-small-regular-weight":"600","--wcm-text-small-regular-line-height":"16px","--wcm-text-small-regular-letter-spacing":"-0.03em","--wcm-text-small-regular-text-transform":"none","--wcm-text-medium-regular-size":"16px","--wcm-text-medium-regular-weight":"600","--wcm-text-medium-regular-line-height":"20px","--wcm-text-medium-regular-letter-spacing":"-0.03em","--wcm-text-medium-regular-text-transform":"none","--wcm-font-family":"-apple-system, system-ui, BlinkMacSystemFont, 'Segoe UI', Roboto, Ubuntu, 'Helvetica Neue', sans-serif","--wcm-font-feature-settings":"'tnum' on, 'lnum' on, 'case' on","--wcm-success-color":"rgb(38,181,98)","--wcm-error-color":"rgb(242, 90, 103)","--wcm-overlay-background-color":"rgba(0, 0, 0, 0.3)","--wcm-overlay-backdrop-filter":"none"}}const _={getPreset(e){return qr()[e]},setTheme(){const e=document.querySelector(":root"),{themeVariables:t}=_t.state;if(e){const r=De(De(De({},Ni()),qr()),t);Object.entries(r).forEach(([n,o])=>e.style.setProperty(n,o))}},globalCss:T`*,::after,::before{margin:0;padding:0;box-sizing:border-box;font-style:normal;text-rendering:optimizeSpeed;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;-webkit-tap-highlight-color:transparent;backface-visibility:hidden}button{cursor:pointer;display:flex;justify-content:center;align-items:center;position:relative;border:none;background-color:transparent;transition:all .2s ease}@media (hover:hover) and (pointer:fine){button:active{transition:all .1s ease;transform:scale(.93)}}button::after{content:'';position:absolute;top:0;bottom:0;left:0;right:0;transition:background-color,.2s ease}button:disabled{cursor:not-allowed}button svg,button wcm-text{position:relative;z-index:1}input{border:none;outline:0;appearance:none}img{display:block}::selection{color:var(--wcm-accent-fill-color);background:var(--wcm-accent-color)}`},Bi=T`button{border-radius:var(--wcm-secondary-button-border-radius);height:28px;padding:0 10px;background-color:var(--wcm-accent-color)}button path{fill:var(--wcm-accent-fill-color)}button::after{border-radius:inherit;border:1px solid var(--wcm-color-overlay)}button:disabled::after{background-color:transparent}.wcm-icon-left svg{margin-right:5px}.wcm-icon-right svg{margin-left:5px}button:active::after{background-color:var(--wcm-color-overlay)}.wcm-ghost,.wcm-ghost:active::after,.wcm-outline{background-color:transparent}.wcm-ghost:active{opacity:.5}@media(hover:hover){button:hover::after{background-color:var(--wcm-color-overlay)}.wcm-ghost:hover::after{background-color:transparent}.wcm-ghost:hover{opacity:.5}}button:disabled{background-color:var(--wcm-color-bg-3);pointer-events:none}.wcm-ghost::after{border-color:transparent}.wcm-ghost path{fill:var(--wcm-color-fg-2)}.wcm-outline path{fill:var(--wcm-accent-color)}.wcm-outline:disabled{background-color:transparent;opacity:.5}`;var Di=Object.defineProperty,Ui=Object.getOwnPropertyDescriptor,wt=(e,t,r,n)=>{for(var o=n>1?void 0:n?Ui(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&Di(t,r,o),o};let Q=class extends A{constructor(){super(...arguments),this.disabled=!1,this.iconLeft=void 0,this.iconRight=void 0,this.onClick=()=>null,this.variant="default"}render(){const e={"wcm-icon-left":this.iconLeft!==void 0,"wcm-icon-right":this.iconRight!==void 0,"wcm-ghost":this.variant==="ghost","wcm-outline":this.variant==="outline"};let t="inverse";return this.variant==="ghost"&&(t="secondary"),this.variant==="outline"&&(t="accent"),u``}};Q.styles=[_.globalCss,Bi],wt([$({type:Boolean})],Q.prototype,"disabled",2),wt([$()],Q.prototype,"iconLeft",2),wt([$()],Q.prototype,"iconRight",2),wt([$()],Q.prototype,"onClick",2),wt([$()],Q.prototype,"variant",2),Q=wt([I("wcm-button")],Q);const Wi=T`:host{display:inline-block}button{padding:0 15px 1px;height:40px;border-radius:var(--wcm-button-border-radius);color:var(--wcm-accent-fill-color);background-color:var(--wcm-accent-color)}button::after{content:'';top:0;bottom:0;left:0;right:0;position:absolute;background-color:transparent;border-radius:inherit;transition:background-color .2s ease;border:1px solid var(--wcm-color-overlay)}button:active::after{background-color:var(--wcm-color-overlay)}button:disabled{padding-bottom:0;background-color:var(--wcm-color-bg-3);color:var(--wcm-color-fg-3)}.wcm-secondary{color:var(--wcm-accent-color);background-color:transparent}.wcm-secondary::after{display:none}@media(hover:hover){button:hover::after{background-color:var(--wcm-color-overlay)}}`;var ji=Object.defineProperty,Hi=Object.getOwnPropertyDescriptor,Ue=(e,t,r,n)=>{for(var o=n>1?void 0:n?Hi(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&ji(t,r,o),o};let Lt=class extends A{constructor(){super(...arguments),this.disabled=!1,this.variant="primary"}render(){const e={"wcm-secondary":this.variant==="secondary"};return u``}};Lt.styles=[_.globalCss,Wi],Ue([$({type:Boolean})],Lt.prototype,"disabled",2),Ue([$()],Lt.prototype,"variant",2),Lt=Ue([I("wcm-button-big")],Lt);const zi=T`:host{background-color:var(--wcm-color-bg-2);border-top:1px solid var(--wcm-color-bg-3)}div{padding:10px 20px;display:inherit;flex-direction:inherit;align-items:inherit;width:inherit;justify-content:inherit}`;var Fi=Object.defineProperty,Zi=Object.getOwnPropertyDescriptor,Vi=(e,t,r,n)=>{for(var o=n>1?void 0:n?Zi(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&Fi(t,r,o),o};let We=class extends A{render(){return u`
`}};We.styles=[_.globalCss,zi],We=Vi([I("wcm-info-footer")],We);const k={CROSS_ICON:L``,WALLET_CONNECT_LOGO:L``,WALLET_CONNECT_ICON:L``,WALLET_CONNECT_ICON_COLORED:L``,BACK_ICON:L``,COPY_ICON:L``,RETRY_ICON:L``,DESKTOP_ICON:L``,MOBILE_ICON:L``,ARROW_DOWN_ICON:L``,ARROW_UP_RIGHT_ICON:L``,ARROW_RIGHT_ICON:L``,QRCODE_ICON:L``,SCAN_ICON:L``,CHECKMARK_ICON:L``,SEARCH_ICON:L``,WALLET_PLACEHOLDER:L``,GLOBE_ICON:L``},Ki=T`.wcm-toolbar-placeholder{top:0;bottom:0;left:0;right:0;width:100%;position:absolute;display:block;pointer-events:none;height:100px;border-radius:calc(var(--wcm-background-border-radius) * .9);background-color:var(--wcm-background-color);background-position:center;background-size:cover}.wcm-toolbar{height:38px;display:flex;position:relative;margin:5px 15px 5px 5px;justify-content:space-between;align-items:center}.wcm-toolbar img,.wcm-toolbar svg{height:28px;object-position:left center;object-fit:contain}#wcm-wc-logo path{fill:var(--wcm-accent-fill-color)}button{width:28px;height:28px;border-radius:var(--wcm-icon-button-border-radius);border:0;display:flex;justify-content:center;align-items:center;cursor:pointer;background-color:var(--wcm-color-bg-1);box-shadow:0 0 0 1px var(--wcm-color-overlay)}button:active{background-color:var(--wcm-color-bg-2)}button svg{display:block;object-position:center}button path{fill:var(--wcm-color-fg-1)}.wcm-toolbar div{display:flex}@media(hover:hover){button:hover{background-color:var(--wcm-color-bg-2)}}`;var qi=Object.defineProperty,Yi=Object.getOwnPropertyDescriptor,Ji=(e,t,r,n)=>{for(var o=n>1?void 0:n?Yi(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&qi(t,r,o),o};let je=class extends A{render(){return u`
${k.WALLET_CONNECT_LOGO}
`}};je.styles=[_.globalCss,Ki],je=Ji([I("wcm-modal-backcard")],je);const Gi=T`main{padding:20px;padding-top:0;width:100%}`;var Qi=Object.defineProperty,Xi=Object.getOwnPropertyDescriptor,ts=(e,t,r,n)=>{for(var o=n>1?void 0:n?Xi(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&Qi(t,r,o),o};let He=class extends A{render(){return u`
`}};He.styles=[_.globalCss,Gi],He=ts([I("wcm-modal-content")],He);const es=T`footer{padding:10px;display:flex;flex-direction:column;align-items:inherit;justify-content:inherit;border-top:1px solid var(--wcm-color-bg-2)}`;var rs=Object.defineProperty,os=Object.getOwnPropertyDescriptor,ns=(e,t,r,n)=>{for(var o=n>1?void 0:n?os(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&rs(t,r,o),o};let ze=class extends A{render(){return u`
`}};ze.styles=[_.globalCss,es],ze=ns([I("wcm-modal-footer")],ze);const is=T`header{display:flex;justify-content:center;align-items:center;padding:20px;position:relative}.wcm-border{border-bottom:1px solid var(--wcm-color-bg-2);margin-bottom:20px}header button{padding:15px 20px}header button:active{opacity:.5}@media(hover:hover){header button:hover{opacity:.5}}.wcm-back-btn{position:absolute;left:0}.wcm-action-btn{position:absolute;right:0}path{fill:var(--wcm-accent-color)}`;var ss=Object.defineProperty,as=Object.getOwnPropertyDescriptor,Nt=(e,t,r,n)=>{for(var o=n>1?void 0:n?as(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&ss(t,r,o),o};let ct=class extends A{constructor(){super(...arguments),this.title="",this.onAction=void 0,this.actionIcon=void 0,this.border=!1}backBtnTemplate(){return u``}actionBtnTemplate(){return u``}render(){const e={"wcm-border":this.border},t=N.state.history.length>1,r=this.title?u`${this.title}`:u``;return u`
${t?this.backBtnTemplate():null} ${r} ${this.onAction?this.actionBtnTemplate():null}
`}};ct.styles=[_.globalCss,is],Nt([$()],ct.prototype,"title",2),Nt([$()],ct.prototype,"onAction",2),Nt([$()],ct.prototype,"actionIcon",2),Nt([$({type:Boolean})],ct.prototype,"border",2),ct=Nt([I("wcm-modal-header")],ct);const x={MOBILE_BREAKPOINT:600,WCM_RECENT_WALLET_DATA:"WCM_RECENT_WALLET_DATA",EXPLORER_WALLET_URL:"https://explorer.walletconnect.com/?type=wallet",getShadowRootElement(e,t){const r=e.renderRoot.querySelector(t);if(!r)throw new Error(`${t} not found`);return r},getWalletIcon({id:e,image_id:t}){const{walletImages:r}=gt.state;return r!=null&&r[e]?r[e]:t?j.getWalletImageUrl(t):""},getWalletName(e,t=!1){return t&&e.length>8?`${e.substring(0,8)}..`:e},isMobileAnimation(){return window.innerWidth<=x.MOBILE_BREAKPOINT},async preloadImage(e){const t=new Promise((r,n)=>{const o=new Image;o.onload=r,o.onerror=n,o.crossOrigin="anonymous",o.src=e});return Promise.race([t,C.wait(3e3)])},getErrorMessage(e){return e instanceof Error?e.message:"Unknown Error"},debounce(e,t=500){let r;return(...n)=>{function o(){e(...n)}r&&clearTimeout(r),r=setTimeout(o,t)}},handleMobileLinking(e){const{walletConnectUri:t}=K.state,{mobile:r,name:n}=e,o=r==null?void 0:r.native,i=r==null?void 0:r.universal;x.setRecentWallet(e);function s(a){let l="";o?l=C.formatUniversalUrl(o,a,n):i&&(l=C.formatNativeUrl(i,a,n)),C.openHref(l,"_self")}t&&s(t)},handleAndroidLinking(){const{walletConnectUri:e}=K.state;e&&(C.setWalletConnectAndroidDeepLink(e),C.openHref(e,"_self"))},async handleUriCopy(){const{walletConnectUri:e}=K.state;if(e)try{await navigator.clipboard.writeText(e),ot.openToast("Link copied","success")}catch{ot.openToast("Failed to copy","error")}},getCustomImageUrls(){const{walletImages:e}=gt.state,t=Object.values(e??{});return Object.values(t)},truncate(e,t=8){return e.length<=t?e:`${e.substring(0,4)}...${e.substring(e.length-4)}`},setRecentWallet(e){try{localStorage.setItem(x.WCM_RECENT_WALLET_DATA,JSON.stringify(e))}catch{console.info("Unable to set recent wallet")}},getRecentWallet(){try{const e=localStorage.getItem(x.WCM_RECENT_WALLET_DATA);return e?JSON.parse(e):void 0}catch{console.info("Unable to get recent wallet")}},caseSafeIncludes(e,t){return e.toUpperCase().includes(t.toUpperCase())},openWalletExplorerUrl(){C.openHref(x.EXPLORER_WALLET_URL,"_blank")},getCachedRouterWalletPlatforms(){const{desktop:e,mobile:t}=C.getWalletRouterData(),r=!!(e!=null&&e.native),n=!!(e!=null&&e.universal),o=!!(t!=null&&t.native)||!!(t!=null&&t.universal);return{isDesktop:r,isMobile:o,isWeb:n}},goToConnectingView(e){N.setData({Wallet:e});const t=C.isMobile(),{isDesktop:r,isWeb:n,isMobile:o}=x.getCachedRouterWalletPlatforms();t?o?N.push("MobileConnecting"):n?N.push("WebConnecting"):N.push("InstallWallet"):r?N.push("DesktopConnecting"):n?N.push("WebConnecting"):o?N.push("MobileQrcodeConnecting"):N.push("InstallWallet")}},ls=T`.wcm-router{overflow:hidden;will-change:transform}.wcm-content{display:flex;flex-direction:column}`;var cs=Object.defineProperty,ds=Object.getOwnPropertyDescriptor,Fe=(e,t,r,n)=>{for(var o=n>1?void 0:n?ds(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&cs(t,r,o),o};let Bt=class extends A{constructor(){super(),this.view=N.state.view,this.prevView=N.state.view,this.unsubscribe=void 0,this.oldHeight="0px",this.resizeObserver=void 0,this.unsubscribe=N.subscribe(e=>{this.view!==e.view&&this.onChangeRoute()})}firstUpdated(){this.resizeObserver=new ResizeObserver(([e])=>{const t=`${e.contentRect.height}px`;this.oldHeight!=="0px"&&mt(this.routerEl,{height:[this.oldHeight,t]},{duration:.2}),this.oldHeight=t}),this.resizeObserver.observe(this.contentEl)}disconnectedCallback(){var e,t;(e=this.unsubscribe)==null||e.call(this),(t=this.resizeObserver)==null||t.disconnect()}get routerEl(){return x.getShadowRootElement(this,".wcm-router")}get contentEl(){return x.getShadowRootElement(this,".wcm-content")}viewTemplate(){switch(this.view){case"ConnectWallet":return u``;case"DesktopConnecting":return u``;case"MobileConnecting":return u``;case"WebConnecting":return u``;case"MobileQrcodeConnecting":return u``;case"WalletExplorer":return u``;case"Qrcode":return u``;case"InstallWallet":return u``;default:return u`
Not Found
`}}async onChangeRoute(){await mt(this.routerEl,{opacity:[1,0],scale:[1,1.02]},{duration:.15,delay:.1}).finished,this.view=N.state.view,mt(this.routerEl,{opacity:[0,1],scale:[.99,1]},{duration:.37,delay:.05})}render(){return u`
${this.viewTemplate()}
`}};Bt.styles=[_.globalCss,ls],Fe([H()],Bt.prototype,"view",2),Fe([H()],Bt.prototype,"prevView",2),Bt=Fe([I("wcm-modal-router")],Bt);const hs=T`div{height:36px;width:max-content;display:flex;justify-content:center;align-items:center;padding:9px 15px 11px;position:absolute;top:12px;box-shadow:0 6px 14px -6px rgba(10,16,31,.3),0 10px 32px -4px rgba(10,16,31,.15);z-index:2;left:50%;transform:translateX(-50%);pointer-events:none;backdrop-filter:blur(20px) saturate(1.8);-webkit-backdrop-filter:blur(20px) saturate(1.8);border-radius:var(--wcm-notification-border-radius);border:1px solid var(--wcm-color-overlay);background-color:var(--wcm-color-overlay)}svg{margin-right:5px}@-moz-document url-prefix(){div{background-color:var(--wcm-color-bg-3)}}.wcm-success path{fill:var(--wcm-accent-color)}.wcm-error path{fill:var(--wcm-error-color)}`;var us=Object.defineProperty,ms=Object.getOwnPropertyDescriptor,Yr=(e,t,r,n)=>{for(var o=n>1?void 0:n?ms(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&us(t,r,o),o};let re=class extends A{constructor(){super(),this.open=!1,this.unsubscribe=void 0,this.timeout=void 0,this.unsubscribe=ot.subscribe(e=>{e.open?(this.open=!0,this.timeout=setTimeout(()=>ot.closeToast(),2200)):(this.open=!1,clearTimeout(this.timeout))})}disconnectedCallback(){var e;(e=this.unsubscribe)==null||e.call(this),clearTimeout(this.timeout),ot.closeToast()}render(){const{message:e,variant:t}=ot.state,r={"wcm-success":t==="success","wcm-error":t==="error"};return this.open?u`
${t==="success"?k.CHECKMARK_ICON:null} ${t==="error"?k.CROSS_ICON:null}${e}
`:null}};re.styles=[_.globalCss,hs],Yr([H()],re.prototype,"open",2),re=Yr([I("wcm-modal-toast")],re);const gs=.1,Jr=2.5,J=7;function Ze(e,t,r){return e===t?!1:(e-t<0?t-e:e-t)<=r+gs}function ps(e,t){const r=Array.prototype.slice.call(Gt.create(e,{errorCorrectionLevel:t}).modules.data,0),n=Math.sqrt(r.length);return r.reduce((o,i,s)=>(s%n===0?o.push([i]):o[o.length-1].push(i))&&o,[])}const fs={generate(e,t,r){const n="#141414",o="#ffffff",i=[],s=ps(e,"Q"),a=t/s.length,l=[{x:0,y:0},{x:1,y:0},{x:0,y:1}];l.forEach(({x:f,y:g})=>{const O=(s.length-J)*a*f,m=(s.length-J)*a*g,b=.45;for(let w=0;w`)}});const c=Math.floor((r+25)/a),d=s.length/2-c/2,y=s.length/2+c/2-1,h=[];s.forEach((f,g)=>{f.forEach((O,m)=>{if(s[g][m]&&!(gs.length-(J+1)&&ms.length-(J+1))&&!(g>d&&gd&&m{p[f]?p[f].push(g):p[f]=[g]}),Object.entries(p).map(([f,g])=>{const O=g.filter(m=>g.every(b=>!Ze(m,b,a)));return[Number(f),O]}).forEach(([f,g])=>{g.forEach(O=>{i.push(L``)})}),Object.entries(p).filter(([f,g])=>g.length>1).map(([f,g])=>{const O=g.filter(m=>g.some(b=>Ze(m,b,a)));return[Number(f),O]}).map(([f,g])=>{g.sort((m,b)=>mw.some(v=>Ze(m,v,a)));b?b.push(m):O.push([m])}return[f,O.map(m=>[m[0],m[m.length-1]])]}).forEach(([f,g])=>{g.forEach(([O,m])=>{i.push(L``)})}),i}},ws=T`@keyframes fadeIn{0%{opacity:0}100%{opacity:1}}div{position:relative;user-select:none;display:block;overflow:hidden;aspect-ratio:1/1;animation:fadeIn ease .2s}.wcm-dark{background-color:#fff;border-radius:var(--wcm-container-border-radius);padding:18px;box-shadow:0 2px 5px #000}svg:first-child,wcm-wallet-image{position:absolute;top:50%;left:50%;transform:translateY(-50%) translateX(-50%)}wcm-wallet-image{transform:translateY(-50%) translateX(-50%)}wcm-wallet-image{width:25%;height:25%;border-radius:var(--wcm-wallet-icon-border-radius)}svg:first-child{transform:translateY(-50%) translateX(-50%) scale(.9)}svg:first-child path:first-child{fill:var(--wcm-accent-color)}svg:first-child path:last-child{stroke:var(--wcm-color-overlay)}`;var vs=Object.defineProperty,bs=Object.getOwnPropertyDescriptor,vt=(e,t,r,n)=>{for(var o=n>1?void 0:n?bs(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&vs(t,r,o),o};let X=class extends A{constructor(){super(...arguments),this.uri="",this.size=0,this.imageId=void 0,this.walletId=void 0,this.imageUrl=void 0}svgTemplate(){const e=_t.state.themeMode==="light"?this.size:this.size-36;return L`${fs.generate(this.uri,e,e/4)}`}render(){const e={"wcm-dark":_t.state.themeMode==="dark"};return u`
${this.walletId||this.imageUrl?u``:k.WALLET_CONNECT_ICON_COLORED} ${this.svgTemplate()}
`}};X.styles=[_.globalCss,ws],vt([$()],X.prototype,"uri",2),vt([$({type:Number})],X.prototype,"size",2),vt([$()],X.prototype,"imageId",2),vt([$()],X.prototype,"walletId",2),vt([$()],X.prototype,"imageUrl",2),X=vt([I("wcm-qrcode")],X);const ys=T`:host{position:relative;height:28px;width:80%}input{width:100%;height:100%;line-height:28px!important;border-radius:var(--wcm-input-border-radius);font-style:normal;font-family:-apple-system,system-ui,BlinkMacSystemFont,'Segoe UI',Roboto,Ubuntu,'Helvetica Neue',sans-serif;font-feature-settings:'case' on;font-weight:500;font-size:16px;letter-spacing:-.03em;padding:0 10px 0 34px;transition:.2s all ease;color:var(--wcm-color-fg-1);background-color:var(--wcm-color-bg-3);box-shadow:inset 0 0 0 1px var(--wcm-color-overlay);caret-color:var(--wcm-accent-color)}input::placeholder{color:var(--wcm-color-fg-2)}svg{left:10px;top:4px;pointer-events:none;position:absolute;width:20px;height:20px}input:focus-within{box-shadow:inset 0 0 0 1px var(--wcm-accent-color)}path{fill:var(--wcm-color-fg-2)}`;var xs=Object.defineProperty,$s=Object.getOwnPropertyDescriptor,Gr=(e,t,r,n)=>{for(var o=n>1?void 0:n?$s(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&xs(t,r,o),o};let oe=class extends A{constructor(){super(...arguments),this.onChange=()=>null}render(){return u` ${k.SEARCH_ICON}`}};oe.styles=[_.globalCss,ys],Gr([$()],oe.prototype,"onChange",2),oe=Gr([I("wcm-search-input")],oe);const Cs=T`@keyframes rotate{100%{transform:rotate(360deg)}}@keyframes dash{0%{stroke-dasharray:1,150;stroke-dashoffset:0}50%{stroke-dasharray:90,150;stroke-dashoffset:-35}100%{stroke-dasharray:90,150;stroke-dashoffset:-124}}svg{animation:rotate 2s linear infinite;display:flex;justify-content:center;align-items:center}svg circle{stroke-linecap:round;animation:dash 1.5s ease infinite;stroke:var(--wcm-accent-color)}`;var Es=Object.defineProperty,As=Object.getOwnPropertyDescriptor,_s=(e,t,r,n)=>{for(var o=n>1?void 0:n?As(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&Es(t,r,o),o};let Ve=class extends A{render(){return u``}};Ve.styles=[_.globalCss,Cs],Ve=_s([I("wcm-spinner")],Ve);const Os=T`span{font-style:normal;font-family:var(--wcm-font-family);font-feature-settings:var(--wcm-font-feature-settings)}.wcm-xsmall-bold{font-family:var(--wcm-text-xsmall-bold-font-family);font-weight:var(--wcm-text-xsmall-bold-weight);font-size:var(--wcm-text-xsmall-bold-size);line-height:var(--wcm-text-xsmall-bold-line-height);letter-spacing:var(--wcm-text-xsmall-bold-letter-spacing);text-transform:var(--wcm-text-xsmall-bold-text-transform)}.wcm-xsmall-regular{font-family:var(--wcm-text-xsmall-regular-font-family);font-weight:var(--wcm-text-xsmall-regular-weight);font-size:var(--wcm-text-xsmall-regular-size);line-height:var(--wcm-text-xsmall-regular-line-height);letter-spacing:var(--wcm-text-xsmall-regular-letter-spacing);text-transform:var(--wcm-text-xsmall-regular-text-transform)}.wcm-small-thin{font-family:var(--wcm-text-small-thin-font-family);font-weight:var(--wcm-text-small-thin-weight);font-size:var(--wcm-text-small-thin-size);line-height:var(--wcm-text-small-thin-line-height);letter-spacing:var(--wcm-text-small-thin-letter-spacing);text-transform:var(--wcm-text-small-thin-text-transform)}.wcm-small-regular{font-family:var(--wcm-text-small-regular-font-family);font-weight:var(--wcm-text-small-regular-weight);font-size:var(--wcm-text-small-regular-size);line-height:var(--wcm-text-small-regular-line-height);letter-spacing:var(--wcm-text-small-regular-letter-spacing);text-transform:var(--wcm-text-small-regular-text-transform)}.wcm-medium-regular{font-family:var(--wcm-text-medium-regular-font-family);font-weight:var(--wcm-text-medium-regular-weight);font-size:var(--wcm-text-medium-regular-size);line-height:var(--wcm-text-medium-regular-line-height);letter-spacing:var(--wcm-text-medium-regular-letter-spacing);text-transform:var(--wcm-text-medium-regular-text-transform)}.wcm-big-bold{font-family:var(--wcm-text-big-bold-font-family);font-weight:var(--wcm-text-big-bold-weight);font-size:var(--wcm-text-big-bold-size);line-height:var(--wcm-text-big-bold-line-height);letter-spacing:var(--wcm-text-big-bold-letter-spacing);text-transform:var(--wcm-text-big-bold-text-transform)}:host(*){color:var(--wcm-color-fg-1)}.wcm-color-primary{color:var(--wcm-color-fg-1)}.wcm-color-secondary{color:var(--wcm-color-fg-2)}.wcm-color-tertiary{color:var(--wcm-color-fg-3)}.wcm-color-inverse{color:var(--wcm-accent-fill-color)}.wcm-color-accnt{color:var(--wcm-accent-color)}.wcm-color-error{color:var(--wcm-error-color)}`;var Is=Object.defineProperty,Ts=Object.getOwnPropertyDescriptor,Ke=(e,t,r,n)=>{for(var o=n>1?void 0:n?Ts(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&Is(t,r,o),o};let Dt=class extends A{constructor(){super(...arguments),this.variant="medium-regular",this.color="primary"}render(){const e={"wcm-big-bold":this.variant==="big-bold","wcm-medium-regular":this.variant==="medium-regular","wcm-small-regular":this.variant==="small-regular","wcm-small-thin":this.variant==="small-thin","wcm-xsmall-regular":this.variant==="xsmall-regular","wcm-xsmall-bold":this.variant==="xsmall-bold","wcm-color-primary":this.color==="primary","wcm-color-secondary":this.color==="secondary","wcm-color-tertiary":this.color==="tertiary","wcm-color-inverse":this.color==="inverse","wcm-color-accnt":this.color==="accent","wcm-color-error":this.color==="error"};return u``}};Dt.styles=[_.globalCss,Os],Ke([$()],Dt.prototype,"variant",2),Ke([$()],Dt.prototype,"color",2),Dt=Ke([I("wcm-text")],Dt);const ks=T`button{width:100%;height:100%;border-radius:var(--wcm-button-hover-highlight-border-radius);display:flex;align-items:flex-start}button:active{background-color:var(--wcm-color-overlay)}@media(hover:hover){button:hover{background-color:var(--wcm-color-overlay)}}button>div{width:80px;padding:5px 0;display:flex;flex-direction:column;align-items:center}wcm-text{width:100%;white-space:nowrap;overflow:hidden;text-overflow:ellipsis;text-align:center}wcm-wallet-image{height:60px;width:60px;transition:all .2s ease;border-radius:var(--wcm-wallet-icon-border-radius);margin-bottom:5px}.wcm-sublabel{margin-top:2px}`;var Ms=Object.defineProperty,Ps=Object.getOwnPropertyDescriptor,tt=(e,t,r,n)=>{for(var o=n>1?void 0:n?Ps(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&Ms(t,r,o),o};let V=class extends A{constructor(){super(...arguments),this.onClick=()=>null,this.name="",this.walletId="",this.label=void 0,this.imageId=void 0,this.installed=!1,this.recent=!1}sublabelTemplate(){return this.recent?u`RECENT`:this.installed?u`INSTALLED`:null}handleClick(){Do.click({name:"WALLET_BUTTON",walletId:this.walletId}),this.onClick()}render(){var e;return u``}};V.styles=[_.globalCss,ks],tt([$()],V.prototype,"onClick",2),tt([$()],V.prototype,"name",2),tt([$()],V.prototype,"walletId",2),tt([$()],V.prototype,"label",2),tt([$()],V.prototype,"imageId",2),tt([$({type:Boolean})],V.prototype,"installed",2),tt([$({type:Boolean})],V.prototype,"recent",2),V=tt([I("wcm-wallet-button")],V);const Ss=T`:host{display:block}div{overflow:hidden;position:relative;border-radius:inherit;width:100%;height:100%;background-color:var(--wcm-color-overlay)}svg{position:relative;width:100%;height:100%}div::after{content:'';position:absolute;top:0;bottom:0;left:0;right:0;border-radius:inherit;border:1px solid var(--wcm-color-overlay)}div img{width:100%;height:100%;object-fit:cover;object-position:center}#wallet-placeholder-fill{fill:var(--wcm-color-bg-3)}#wallet-placeholder-dash{stroke:var(--wcm-color-overlay)}`;var Rs=Object.defineProperty,Ls=Object.getOwnPropertyDescriptor,ne=(e,t,r,n)=>{for(var o=n>1?void 0:n?Ls(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&Rs(t,r,o),o};let bt=class extends A{constructor(){super(...arguments),this.walletId="",this.imageId=void 0,this.imageUrl=void 0}render(){var e;const t=(e=this.imageUrl)!=null&&e.length?this.imageUrl:x.getWalletIcon({id:this.walletId,image_id:this.imageId});return u`${t.length?u`
${this.id}
`:k.WALLET_PLACEHOLDER}`}};bt.styles=[_.globalCss,Ss],ne([$()],bt.prototype,"walletId",2),ne([$()],bt.prototype,"imageId",2),ne([$()],bt.prototype,"imageUrl",2),bt=ne([I("wcm-wallet-image")],bt);var Ns=Object.defineProperty,Bs=Object.getOwnPropertyDescriptor,Qr=(e,t,r,n)=>{for(var o=n>1?void 0:n?Bs(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&Ns(t,r,o),o};let qe=class extends A{constructor(){super(),this.preload=!0,this.preloadData()}async loadImages(e){try{e!=null&&e.length&&await Promise.all(e.map(async t=>x.preloadImage(t)))}catch{console.info("Unsuccessful attempt at preloading some images",e)}}async preloadListings(){if(gt.state.enableExplorer){await j.getRecomendedWallets(),K.setIsDataLoaded(!0);const{recomendedWallets:e}=j.state,t=e.map(r=>x.getWalletIcon(r));await this.loadImages(t)}else K.setIsDataLoaded(!0)}async preloadCustomImages(){const e=x.getCustomImageUrls();await this.loadImages(e)}async preloadData(){try{this.preload&&(this.preload=!1,await Promise.all([this.preloadListings(),this.preloadCustomImages()]))}catch(e){console.error(e),ot.openToast("Failed preloading","error")}}};Qr([H()],qe.prototype,"preload",2),qe=Qr([I("wcm-explorer-context")],qe);var Ds=Object.defineProperty,Us=Object.getOwnPropertyDescriptor,Ws=(e,t,r,n)=>{for(var o=n>1?void 0:n?Us(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&Ds(t,r,o),o};let Xr=class extends A{constructor(){super(),this.unsubscribeTheme=void 0,_.setTheme(),this.unsubscribeTheme=_t.subscribe(_.setTheme)}disconnectedCallback(){var e;(e=this.unsubscribeTheme)==null||e.call(this)}};Xr=Ws([I("wcm-theme-context")],Xr);const js=T`@keyframes scroll{0%{transform:translate3d(0,0,0)}100%{transform:translate3d(calc(-70px * 9),0,0)}}.wcm-slider{position:relative;overflow-x:hidden;padding:10px 0;margin:0 -20px;width:calc(100% + 40px)}.wcm-track{display:flex;width:calc(70px * 18);animation:scroll 20s linear infinite;opacity:.7}.wcm-track svg{margin:0 5px}wcm-wallet-image{width:60px;height:60px;margin:0 5px;border-radius:var(--wcm-wallet-icon-border-radius)}.wcm-grid{display:grid;grid-template-columns:repeat(4,80px);justify-content:space-between}.wcm-title{display:flex;align-items:center;margin-bottom:10px}.wcm-title svg{margin-right:6px}.wcm-title path{fill:var(--wcm-accent-color)}wcm-modal-footer .wcm-title{padding:0 10px}wcm-button-big{position:absolute;top:50%;left:50%;transform:translateY(-50%) translateX(-50%);filter:drop-shadow(0 0 17px var(--wcm-color-bg-1))}wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-info-footer wcm-text{text-align:center;margin-bottom:15px}#wallet-placeholder-fill{fill:var(--wcm-color-bg-3)}#wallet-placeholder-dash{stroke:var(--wcm-color-overlay)}`;var Hs=Object.defineProperty,zs=Object.getOwnPropertyDescriptor,Fs=(e,t,r,n)=>{for(var o=n>1?void 0:n?zs(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&Hs(t,r,o),o};let Ye=class extends A{onGoToQrcode(){N.push("Qrcode")}render(){const{recomendedWallets:e}=j.state,t=[...e,...e],r=C.RECOMMENDED_WALLET_AMOUNT*2;return u`
${k.MOBILE_ICON}WalletConnect
${[...Array(r)].map((n,o)=>{const i=t[o%t.length];return i?u``:k.WALLET_PLACEHOLDER})}
Select Wallet
Choose WalletConnect to see supported apps on your device`}};Ye.styles=[_.globalCss,js],Ye=Fs([I("wcm-android-wallet-selection")],Ye);const Zs=T`@keyframes loading{to{stroke-dashoffset:0}}@keyframes shake{10%,90%{transform:translate3d(-1px,0,0)}20%,80%{transform:translate3d(1px,0,0)}30%,50%,70%{transform:translate3d(-2px,0,0)}40%,60%{transform:translate3d(2px,0,0)}}:host{display:flex;flex-direction:column;align-items:center}div{position:relative;width:110px;height:110px;display:flex;justify-content:center;align-items:center;margin:40px 0 20px 0;transform:translate3d(0,0,0)}svg{position:absolute;width:110px;height:110px;fill:none;stroke:transparent;stroke-linecap:round;stroke-width:2px;top:0;left:0}use{stroke:var(--wcm-accent-color);animation:loading 1s linear infinite}wcm-wallet-image{border-radius:var(--wcm-wallet-icon-large-border-radius);width:90px;height:90px}wcm-text{margin-bottom:40px}.wcm-error svg{stroke:var(--wcm-error-color)}.wcm-error use{display:none}.wcm-error{animation:shake .4s cubic-bezier(.36,.07,.19,.97) both}.wcm-stale svg,.wcm-stale use{display:none}`;var Vs=Object.defineProperty,Ks=Object.getOwnPropertyDescriptor,yt=(e,t,r,n)=>{for(var o=n>1?void 0:n?Ks(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&Vs(t,r,o),o};let et=class extends A{constructor(){super(...arguments),this.walletId=void 0,this.imageId=void 0,this.isError=!1,this.isStale=!1,this.label=""}svgLoaderTemplate(){var e,t;const r=(t=(e=_t.state.themeVariables)==null?void 0:e["--wcm-wallet-icon-large-border-radius"])!=null?t:_.getPreset("--wcm-wallet-icon-large-border-radius");let n=0;r.includes("%")?n=88/100*parseInt(r,10):n=parseInt(r,10),n*=1.17;const o=317-n*1.57,i=425-n*1.8;return u``}render(){const e={"wcm-error":this.isError,"wcm-stale":this.isStale};return u`
${this.svgLoaderTemplate()}
${this.isError?"Connection declined":this.label}`}};et.styles=[_.globalCss,Zs],yt([$()],et.prototype,"walletId",2),yt([$()],et.prototype,"imageId",2),yt([$({type:Boolean})],et.prototype,"isError",2),yt([$({type:Boolean})],et.prototype,"isStale",2),yt([$()],et.prototype,"label",2),et=yt([I("wcm-connector-waiting")],et);const At={manualWallets(){var e,t;const{mobileWallets:r,desktopWallets:n}=gt.state,o=(e=At.recentWallet())==null?void 0:e.id,i=C.isMobile()?r:n,s=i==null?void 0:i.filter(a=>o!==a.id);return(t=C.isMobile()?s==null?void 0:s.map(({id:a,name:l,links:c})=>({id:a,name:l,mobile:c,links:c})):s==null?void 0:s.map(({id:a,name:l,links:c})=>({id:a,name:l,desktop:c,links:c})))!=null?t:[]},recentWallet(){return x.getRecentWallet()},recomendedWallets(e=!1){var t;const r=e||(t=At.recentWallet())==null?void 0:t.id,{recomendedWallets:n}=j.state;return n.filter(o=>r!==o.id)}},st={onConnecting(e){x.goToConnectingView(e)},manualWalletsTemplate(){return At.manualWallets().map(e=>u``)},recomendedWalletsTemplate(e=!1){return At.recomendedWallets(e).map(t=>u``)},recentWalletTemplate(){const e=At.recentWallet();if(e)return u``}},qs=T`.wcm-grid{display:grid;grid-template-columns:repeat(4,80px);justify-content:space-between}.wcm-desktop-title,.wcm-mobile-title{display:flex;align-items:center}.wcm-mobile-title{justify-content:space-between;margin-bottom:20px;margin-top:-10px}.wcm-desktop-title{margin-bottom:10px;padding:0 10px}.wcm-subtitle{display:flex;align-items:center}.wcm-subtitle:last-child path{fill:var(--wcm-color-fg-3)}.wcm-desktop-title svg,.wcm-mobile-title svg{margin-right:6px}.wcm-desktop-title path,.wcm-mobile-title path{fill:var(--wcm-accent-color)}`;var Ys=Object.defineProperty,Js=Object.getOwnPropertyDescriptor,Gs=(e,t,r,n)=>{for(var o=n>1?void 0:n?Js(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&Ys(t,r,o),o};let Je=class extends A{render(){const{explorerExcludedWalletIds:e,enableExplorer:t}=gt.state,r=e!=="ALL"&&t,n=st.manualWalletsTemplate(),o=st.recomendedWalletsTemplate();let i=[st.recentWalletTemplate(),...n,...o];i=i.filter(Boolean);const s=i.length>4||r;let a=[];s?a=i.slice(0,3):a=i;const l=!!a.length;return u`
${k.MOBILE_ICON}Mobile
${k.SCAN_ICON}Scan with your wallet
${l?u`
${k.DESKTOP_ICON}Desktop
${a} ${s?u``:null}
`:null}`}};Je.styles=[_.globalCss,qs],Je=Gs([I("wcm-desktop-wallet-selection")],Je);const Qs=T`div{background-color:var(--wcm-color-bg-2);padding:10px 20px 15px 20px;border-top:1px solid var(--wcm-color-bg-3);text-align:center}a{color:var(--wcm-accent-color);text-decoration:none;transition:opacity .2s ease-in-out;display:inline}a:active{opacity:.8}@media(hover:hover){a:hover{opacity:.8}}`;var Xs=Object.defineProperty,ta=Object.getOwnPropertyDescriptor,ea=(e,t,r,n)=>{for(var o=n>1?void 0:n?ta(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&Xs(t,r,o),o};let Ge=class extends A{render(){const{termsOfServiceUrl:e,privacyPolicyUrl:t}=gt.state;return e??t?u`
By connecting your wallet to this app, you agree to the app's ${e?u`Terms of Service`:null} ${e&&t?"and":null} ${t?u`Privacy Policy`:null}
`:null}};Ge.styles=[_.globalCss,Qs],Ge=ea([I("wcm-legal-notice")],Ge);const ra=T`div{display:grid;grid-template-columns:repeat(4,80px);margin:0 -10px;justify-content:space-between;row-gap:10px}`;var oa=Object.defineProperty,na=Object.getOwnPropertyDescriptor,ia=(e,t,r,n)=>{for(var o=n>1?void 0:n?na(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&oa(t,r,o),o};let Qe=class extends A{onQrcode(){N.push("Qrcode")}render(){const{explorerExcludedWalletIds:e,enableExplorer:t}=gt.state,r=e!=="ALL"&&t,n=st.manualWalletsTemplate(),o=st.recomendedWalletsTemplate();let i=[st.recentWalletTemplate(),...n,...o];i=i.filter(Boolean);const s=i.length>8||r;let a=[];s?a=i.slice(0,7):a=i;const l=!!a.length;return u`${l?u`
${a} ${s?u``:null}
`:null}`}};Qe.styles=[_.globalCss,ra],Qe=ia([I("wcm-mobile-wallet-selection")],Qe);const sa=T`:host{all:initial}.wcm-overlay{top:0;bottom:0;left:0;right:0;position:fixed;z-index:var(--wcm-z-index);overflow:hidden;display:flex;justify-content:center;align-items:center;opacity:0;pointer-events:none;background-color:var(--wcm-overlay-background-color);backdrop-filter:var(--wcm-overlay-backdrop-filter)}@media(max-height:720px) and (orientation:landscape){.wcm-overlay{overflow:scroll;align-items:flex-start;padding:20px 0}}.wcm-active{pointer-events:auto}.wcm-container{position:relative;max-width:360px;width:100%;outline:0;border-radius:var(--wcm-background-border-radius) var(--wcm-background-border-radius) var(--wcm-container-border-radius) var(--wcm-container-border-radius);border:1px solid var(--wcm-color-overlay);overflow:hidden}.wcm-card{width:100%;position:relative;border-radius:var(--wcm-container-border-radius);overflow:hidden;box-shadow:0 6px 14px -6px rgba(10,16,31,.12),0 10px 32px -4px rgba(10,16,31,.1),0 0 0 1px var(--wcm-color-overlay);background-color:var(--wcm-color-bg-1);color:var(--wcm-color-fg-1)}@media(max-width:600px){.wcm-container{max-width:440px;border-radius:var(--wcm-background-border-radius) var(--wcm-background-border-radius) 0 0}.wcm-card{border-radius:var(--wcm-container-border-radius) var(--wcm-container-border-radius) 0 0}.wcm-overlay{align-items:flex-end}}@media(max-width:440px){.wcm-container{border:0}}`;var aa=Object.defineProperty,la=Object.getOwnPropertyDescriptor,Xe=(e,t,r,n)=>{for(var o=n>1?void 0:n?la(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&aa(t,r,o),o};let Ut=class extends A{constructor(){super(),this.open=!1,this.active=!1,this.unsubscribeModal=void 0,this.abortController=void 0,this.unsubscribeModal=ce.subscribe(e=>{e.open?this.onOpenModalEvent():this.onCloseModalEvent()})}disconnectedCallback(){var e;(e=this.unsubscribeModal)==null||e.call(this)}get overlayEl(){return x.getShadowRootElement(this,".wcm-overlay")}get containerEl(){return x.getShadowRootElement(this,".wcm-container")}toggleBodyScroll(e){if(document.querySelector("body"))if(e){const t=document.getElementById("wcm-styles");t==null||t.remove()}else document.head.insertAdjacentHTML("beforeend",'')}onCloseModal(e){e.target===e.currentTarget&&ce.close()}onOpenModalEvent(){this.toggleBodyScroll(!1),this.addKeyboardEvents(),this.open=!0,setTimeout(async()=>{const e=x.isMobileAnimation()?{y:["50vh","0vh"]}:{scale:[.98,1]},t=.1,r=.2;await Promise.all([mt(this.overlayEl,{opacity:[0,1]},{delay:t,duration:r}).finished,mt(this.containerEl,e,{delay:t,duration:r}).finished]),this.active=!0},0)}async onCloseModalEvent(){this.toggleBodyScroll(!0),this.removeKeyboardEvents();const e=x.isMobileAnimation()?{y:["0vh","50vh"]}:{scale:[1,.98]},t=.2;await Promise.all([mt(this.overlayEl,{opacity:[1,0]},{duration:t}).finished,mt(this.containerEl,e,{duration:t}).finished]),this.containerEl.removeAttribute("style"),this.active=!1,this.open=!1}addKeyboardEvents(){this.abortController=new AbortController,window.addEventListener("keydown",e=>{var t;e.key==="Escape"?ce.close():e.key==="Tab"&&((t=e.target)!=null&&t.tagName.includes("wcm-")||this.containerEl.focus())},this.abortController),this.containerEl.focus()}removeKeyboardEvents(){var e;(e=this.abortController)==null||e.abort(),this.abortController=void 0}render(){const e={"wcm-overlay":!0,"wcm-active":this.active};return u`
${this.open?u`
`:null}
`}};Ut.styles=[_.globalCss,sa],Xe([H()],Ut.prototype,"open",2),Xe([H()],Ut.prototype,"active",2),Ut=Xe([I("wcm-modal")],Ut);const ca=T`div{display:flex;margin-top:15px}slot{display:inline-block;margin:0 5px}wcm-button{margin:0 5px}`;var da=Object.defineProperty,ha=Object.getOwnPropertyDescriptor,Wt=(e,t,r,n)=>{for(var o=n>1?void 0:n?ha(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&da(t,r,o),o};let dt=class extends A{constructor(){super(...arguments),this.isMobile=!1,this.isDesktop=!1,this.isWeb=!1,this.isRetry=!1}onMobile(){C.isMobile()?N.replace("MobileConnecting"):N.replace("MobileQrcodeConnecting")}onDesktop(){N.replace("DesktopConnecting")}onWeb(){N.replace("WebConnecting")}render(){return u`
${this.isRetry?u``:null} ${this.isMobile?u`Mobile`:null} ${this.isDesktop?u`Desktop`:null} ${this.isWeb?u`Web`:null}
`}};dt.styles=[_.globalCss,ca],Wt([$({type:Boolean})],dt.prototype,"isMobile",2),Wt([$({type:Boolean})],dt.prototype,"isDesktop",2),Wt([$({type:Boolean})],dt.prototype,"isWeb",2),Wt([$({type:Boolean})],dt.prototype,"isRetry",2),dt=Wt([I("wcm-platform-selection")],dt);const ua=T`button{display:flex;flex-direction:column;padding:5px 10px;border-radius:var(--wcm-button-hover-highlight-border-radius);height:100%;justify-content:flex-start}.wcm-icons{width:60px;height:60px;display:flex;flex-wrap:wrap;padding:7px;border-radius:var(--wcm-wallet-icon-border-radius);justify-content:space-between;align-items:center;margin-bottom:5px;background-color:var(--wcm-color-bg-2);box-shadow:inset 0 0 0 1px var(--wcm-color-overlay)}button:active{background-color:var(--wcm-color-overlay)}@media(hover:hover){button:hover{background-color:var(--wcm-color-overlay)}}.wcm-icons img{width:21px;height:21px;object-fit:cover;object-position:center;border-radius:calc(var(--wcm-wallet-icon-border-radius)/ 2);border:1px solid var(--wcm-color-overlay)}.wcm-icons svg{width:21px;height:21px}.wcm-icons img:nth-child(1),.wcm-icons img:nth-child(2),.wcm-icons svg:nth-child(1),.wcm-icons svg:nth-child(2){margin-bottom:4px}wcm-text{width:100%;text-align:center}#wallet-placeholder-fill{fill:var(--wcm-color-bg-3)}#wallet-placeholder-dash{stroke:var(--wcm-color-overlay)}`;var ma=Object.defineProperty,ga=Object.getOwnPropertyDescriptor,pa=(e,t,r,n)=>{for(var o=n>1?void 0:n?ga(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&ma(t,r,o),o};let tr=class extends A{onClick(){N.push("WalletExplorer")}render(){const{recomendedWallets:e}=j.state,t=At.manualWallets(),r=[...e,...t].reverse().slice(0,4);return u``}};tr.styles=[_.globalCss,ua],tr=pa([I("wcm-view-all-wallets-button")],tr);const fa=T`.wcm-qr-container{width:100%;display:flex;justify-content:center;align-items:center;aspect-ratio:1/1}`;var wa=Object.defineProperty,va=Object.getOwnPropertyDescriptor,ie=(e,t,r,n)=>{for(var o=n>1?void 0:n?va(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&wa(t,r,o),o};let xt=class extends A{constructor(){super(),this.walletId="",this.imageId="",this.uri="",setTimeout(()=>{const{walletConnectUri:e}=K.state;this.uri=e},0)}get overlayEl(){return x.getShadowRootElement(this,".wcm-qr-container")}render(){return u`
${this.uri?u``:u``}
`}};xt.styles=[_.globalCss,fa],ie([$()],xt.prototype,"walletId",2),ie([$()],xt.prototype,"imageId",2),ie([H()],xt.prototype,"uri",2),xt=ie([I("wcm-walletconnect-qr")],xt);var ba=Object.defineProperty,ya=Object.getOwnPropertyDescriptor,xa=(e,t,r,n)=>{for(var o=n>1?void 0:n?ya(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&ba(t,r,o),o};let er=class extends A{viewTemplate(){return C.isAndroid()?u``:C.isMobile()?u``:u``}render(){return u`${this.viewTemplate()}`}};er.styles=[_.globalCss],er=xa([I("wcm-connect-wallet-view")],er);const $a=T`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var Ca=Object.defineProperty,Ea=Object.getOwnPropertyDescriptor,to=(e,t,r,n)=>{for(var o=n>1?void 0:n?Ea(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&Ca(t,r,o),o};let se=class extends A{constructor(){super(),this.isError=!1,this.openDesktopApp()}onFormatAndRedirect(e){const{desktop:t,name:r}=C.getWalletRouterData(),n=t==null?void 0:t.native;if(n){const o=C.formatNativeUrl(n,e,r);C.openHref(o,"_self")}}openDesktopApp(){const{walletConnectUri:e}=K.state,t=C.getWalletRouterData();x.setRecentWallet(t),e&&this.onFormatAndRedirect(e)}render(){const{name:e,id:t,image_id:r}=C.getWalletRouterData(),{isMobile:n,isWeb:o}=x.getCachedRouterWalletPlatforms();return u`${`Connection can continue loading if ${e} is not installed on your device`}Retry`}};se.styles=[_.globalCss,$a],to([H()],se.prototype,"isError",2),se=to([I("wcm-desktop-connecting-view")],se);const Aa=T`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}wcm-button{margin-top:15px}`;var _a=Object.defineProperty,Oa=Object.getOwnPropertyDescriptor,Ia=(e,t,r,n)=>{for(var o=n>1?void 0:n?Oa(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&_a(t,r,o),o};let rr=class extends A{onInstall(e){e&&C.openHref(e,"_blank")}render(){const{name:e,id:t,image_id:r,homepage:n}=C.getWalletRouterData();return u`${`Download ${e} to continue. If multiple browser extensions are installed, disable non ${e} ones and try again`}Download`}};rr.styles=[_.globalCss,Aa],rr=Ia([I("wcm-install-wallet-view")],rr);const Ta=T`wcm-wallet-image{border-radius:var(--wcm-wallet-icon-large-border-radius);width:96px;height:96px;margin-bottom:20px}wcm-info-footer{display:flex;width:100%}.wcm-app-store{justify-content:space-between}.wcm-app-store wcm-wallet-image{margin-right:10px;margin-bottom:0;width:28px;height:28px;border-radius:var(--wcm-wallet-icon-small-border-radius)}.wcm-app-store div{display:flex;align-items:center}.wcm-app-store wcm-button{margin-right:-10px}.wcm-note{flex-direction:column;align-items:center;padding:5px 0}.wcm-note wcm-text{text-align:center}wcm-platform-selection{margin-top:-15px}.wcm-note wcm-text{margin-top:15px}.wcm-note wcm-text span{color:var(--wcm-accent-color)}`;var ka=Object.defineProperty,Ma=Object.getOwnPropertyDescriptor,eo=(e,t,r,n)=>{for(var o=n>1?void 0:n?Ma(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&ka(t,r,o),o};let ae=class extends A{constructor(){super(),this.isError=!1,this.openMobileApp()}onFormatAndRedirect(e,t=!1){const{mobile:r,name:n}=C.getWalletRouterData(),o=r==null?void 0:r.native,i=r==null?void 0:r.universal;if(o&&!t){const s=C.formatNativeUrl(o,e,n);C.openHref(s,"_self")}else if(i){const s=C.formatUniversalUrl(i,e,n);C.openHref(s,"_self")}}openMobileApp(e=!1){const{walletConnectUri:t}=K.state,r=C.getWalletRouterData();x.setRecentWallet(r),t&&this.onFormatAndRedirect(t,e)}onGoToAppStore(e){e&&C.openHref(e,"_blank")}render(){const{name:e,id:t,image_id:r,app:n,mobile:o}=C.getWalletRouterData(),{isWeb:i}=x.getCachedRouterWalletPlatforms(),s=n==null?void 0:n.ios,a=o==null?void 0:o.universal;return u`Retry${a?u`Still doesn't work? Try this alternate link`:null}
${`Get ${e}`}
App Store
`}};ae.styles=[_.globalCss,Ta],eo([H()],ae.prototype,"isError",2),ae=eo([I("wcm-mobile-connecting-view")],ae);const Pa=T`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var Sa=Object.defineProperty,Ra=Object.getOwnPropertyDescriptor,La=(e,t,r,n)=>{for(var o=n>1?void 0:n?Ra(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&Sa(t,r,o),o};let or=class extends A{render(){const{name:e,id:t,image_id:r}=C.getWalletRouterData(),{isDesktop:n,isWeb:o}=x.getCachedRouterWalletPlatforms();return u`${`Scan this QR Code with your phone's camera or inside ${e} app`}`}};or.styles=[_.globalCss,Pa],or=La([I("wcm-mobile-qr-connecting-view")],or);var Na=Object.defineProperty,Ba=Object.getOwnPropertyDescriptor,Da=(e,t,r,n)=>{for(var o=n>1?void 0:n?Ba(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&Na(t,r,o),o};let nr=class extends A{render(){return u``}};nr.styles=[_.globalCss],nr=Da([I("wcm-qrcode-view")],nr);const Ua=T`wcm-modal-content{height:clamp(200px,60vh,600px);display:block;overflow:scroll;scrollbar-width:none;position:relative;margin-top:1px}.wcm-grid{display:grid;grid-template-columns:repeat(4,80px);justify-content:space-between;margin:-15px -10px;padding-top:20px}wcm-modal-content::after,wcm-modal-content::before{content:'';position:fixed;pointer-events:none;z-index:1;width:100%;height:20px;opacity:1}wcm-modal-content::before{box-shadow:0 -1px 0 0 var(--wcm-color-bg-1);background:linear-gradient(var(--wcm-color-bg-1),rgba(255,255,255,0))}wcm-modal-content::after{box-shadow:0 1px 0 0 var(--wcm-color-bg-1);background:linear-gradient(rgba(255,255,255,0),var(--wcm-color-bg-1));top:calc(100% - 20px)}wcm-modal-content::-webkit-scrollbar{display:none}.wcm-placeholder-block{display:flex;justify-content:center;align-items:center;height:100px;overflow:hidden}.wcm-empty,.wcm-loading{display:flex}.wcm-loading .wcm-placeholder-block{height:100%}.wcm-end-reached .wcm-placeholder-block{height:0;opacity:0}.wcm-empty .wcm-placeholder-block{opacity:1;height:100%}wcm-wallet-button{margin:calc((100% - 60px)/ 3) 0}`;var Wa=Object.defineProperty,ja=Object.getOwnPropertyDescriptor,jt=(e,t,r,n)=>{for(var o=n>1?void 0:n?ja(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&Wa(t,r,o),o};const ir=40;let ht=class extends A{constructor(){super(...arguments),this.loading=!j.state.wallets.listings.length,this.firstFetch=!j.state.wallets.listings.length,this.search="",this.endReached=!1,this.intersectionObserver=void 0,this.searchDebounce=x.debounce(e=>{e.length>=1?(this.firstFetch=!0,this.endReached=!1,this.search=e,j.resetSearch(),this.fetchWallets()):this.search&&(this.search="",this.endReached=this.isLastPage(),j.resetSearch())})}firstUpdated(){this.createPaginationObserver()}disconnectedCallback(){var e;(e=this.intersectionObserver)==null||e.disconnect()}get placeholderEl(){return x.getShadowRootElement(this,".wcm-placeholder-block")}createPaginationObserver(){this.intersectionObserver=new IntersectionObserver(([e])=>{e.isIntersecting&&!(this.search&&this.firstFetch)&&this.fetchWallets()}),this.intersectionObserver.observe(this.placeholderEl)}isLastPage(){const{wallets:e,search:t}=j.state,{listings:r,total:n}=this.search?t:e;return n<=ir||r.length>=n}async fetchWallets(){var e;const{wallets:t,search:r}=j.state,{listings:n,total:o,page:i}=this.search?r:t;if(!this.endReached&&(this.firstFetch||o>ir&&n.lengthx.getWalletIcon(c));await Promise.all([...l.map(async c=>x.preloadImage(c)),C.wait(300)]),this.endReached=this.isLastPage()}catch(s){console.error(s),ot.openToast(x.getErrorMessage(s),"error")}finally{this.loading=!1,this.firstFetch=!1}}onConnect(e){C.isAndroid()?x.handleMobileLinking(e):x.goToConnectingView(e)}onSearchChange(e){const{value:t}=e.target;this.searchDebounce(t)}render(){const{wallets:e,search:t}=j.state,{listings:r}=this.search?t:e,n=this.loading&&!r.length,o=this.search.length>=3;let i=st.manualWalletsTemplate(),s=st.recomendedWalletsTemplate(!0);o&&(i=i.filter(({values:c})=>x.caseSafeIncludes(c[0],this.search)),s=s.filter(({values:c})=>x.caseSafeIncludes(c[0],this.search)));const a=!this.loading&&!r.length&&!s.length,l={"wcm-loading":n,"wcm-end-reached":this.endReached||!this.loading,"wcm-empty":a};return u`
${n?null:i} ${n?null:s} ${n?null:r.map(c=>u`${c?u``:null}`)}
${a?u`No results found`:null} ${!a&&this.loading?u``:null}
`}};ht.styles=[_.globalCss,Ua],jt([H()],ht.prototype,"loading",2),jt([H()],ht.prototype,"firstFetch",2),jt([H()],ht.prototype,"search",2),jt([H()],ht.prototype,"endReached",2),ht=jt([I("wcm-wallet-explorer-view")],ht);const Ha=T`wcm-info-footer{flex-direction:column;align-items:center;display:flex;width:100%;padding:5px 0}wcm-text{text-align:center}`;var za=Object.defineProperty,Fa=Object.getOwnPropertyDescriptor,ro=(e,t,r,n)=>{for(var o=n>1?void 0:n?Fa(t,r):t,i=e.length-1,s;i>=0;i--)(s=e[i])&&(o=(n?s(t,r,o):s(o))||o);return n&&o&&za(t,r,o),o};let le=class extends A{constructor(){super(),this.isError=!1,this.openWebWallet()}onFormatAndRedirect(e){const{desktop:t,name:r}=C.getWalletRouterData(),n=t==null?void 0:t.universal;if(n){const o=C.formatUniversalUrl(n,e,r);C.openHref(o,"_blank")}}openWebWallet(){const{walletConnectUri:e}=K.state,t=C.getWalletRouterData();x.setRecentWallet(t),e&&this.onFormatAndRedirect(e)}render(){const{name:e,id:t,image_id:r}=C.getWalletRouterData(),{isMobile:n,isDesktop:o}=x.getCachedRouterWalletPlatforms(),i=C.isMobile();return u`${`${e} web app has opened in a new tab. Go there, accept the connection, and come back`}Retry`}};le.styles=[_.globalCss,Ha],ro([H()],le.prototype,"isError",2),le=ro([I("wcm-web-connecting-view")],le);export{Ut as WcmModal,X as WcmQrCode}; diff --git a/kinode/packages/app_store/pkg/ui/assets/index-t0IPNnth.js b/kinode/packages/app_store/pkg/ui/assets/index-t0IPNnth.js deleted file mode 100644 index 96d5475b..00000000 --- a/kinode/packages/app_store/pkg/ui/assets/index-t0IPNnth.js +++ /dev/null @@ -1 +0,0 @@ -import{h as b,c as N,k as sn}from"./index-9L6Bkx0q.js";import{j as an,r as kt,a as It,b as on}from"./hooks.module-Yb8DqZG0.js";import{s as cn}from"./index-GWVzNPug.js";function dn(n,e){for(var t=0;tr[s]})}}}return Object.freeze(Object.defineProperty(n,Symbol.toStringTag,{value:"Module"}))}var Ge={},oe={},Ee={};Object.defineProperty(Ee,"__esModule",{value:!0});Ee.walletLogo=void 0;const ln=(n,e)=>{let t;switch(n){case"standard":return t=e,`data:image/svg+xml,%3Csvg width='${e}' height='${t}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `;case"circle":return t=e,`data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='${e}' height='${t}' viewBox='0 0 999.81 999.81'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052fe;%7D.cls-2%7Bfill:%23fefefe;%7D.cls-3%7Bfill:%230152fe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M655-115.9h56c.83,1.59,2.36.88,3.56,1a478,478,0,0,1,75.06,10.42C891.4-81.76,978.33-32.58,1049.19,44q116.7,126,131.94,297.61c.38,4.14-.34,8.53,1.78,12.45v59c-1.58.84-.91,2.35-1,3.56a482.05,482.05,0,0,1-10.38,74.05c-24,106.72-76.64,196.76-158.83,268.93s-178.18,112.82-287.2,122.6c-4.83.43-9.86-.25-14.51,1.77H654c-1-1.68-2.69-.91-4.06-1a496.89,496.89,0,0,1-105.9-18.59c-93.54-27.42-172.78-77.59-236.91-150.94Q199.34,590.1,184.87,426.58c-.47-5.19.25-10.56-1.77-15.59V355c1.68-1,.91-2.7,1-4.06a498.12,498.12,0,0,1,18.58-105.9c26-88.75,72.64-164.9,140.6-227.57q126-116.27,297.21-131.61C645.32-114.57,650.35-113.88,655-115.9Zm377.92,500c0-192.44-156.31-349.49-347.56-350.15-194.13-.68-350.94,155.13-352.29,347.42-1.37,194.55,155.51,352.1,348.56,352.47C876.15,734.23,1032.93,577.84,1032.93,384.11Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-2' d='M1032.93,384.11c0,193.73-156.78,350.12-351.29,349.74-193-.37-349.93-157.92-348.56-352.47C334.43,189.09,491.24,33.28,685.37,34,876.62,34.62,1032.94,191.67,1032.93,384.11ZM683,496.81q43.74,0,87.48,0c15.55,0,25.32-9.72,25.33-25.21q0-87.48,0-175c0-15.83-9.68-25.46-25.59-25.46H595.77c-15.88,0-25.57,9.64-25.58,25.46q0,87.23,0,174.45c0,16.18,9.59,25.7,25.84,25.71Z' transform='translate(-183.1 115.9)'/%3E%3Cpath class='cls-3' d='M683,496.81H596c-16.25,0-25.84-9.53-25.84-25.71q0-87.23,0-174.45c0-15.82,9.7-25.46,25.58-25.46H770.22c15.91,0,25.59,9.63,25.59,25.46q0,87.47,0,175c0,15.49-9.78,25.2-25.33,25.21Q726.74,496.84,683,496.81Z' transform='translate(-183.1 115.9)'/%3E%3C/svg%3E`;case"text":return t=(.1*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${t}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogo":return t=(.25*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${t}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%230052ff;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;case"textLight":return t=(.1*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${t}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 528.15 53.64'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Ctitle%3ECoinbase_Wordmark_SubBrands_ALL%3C/title%3E%3Cpath class='cls-1' d='M164.45,15a15,15,0,0,0-11.74,5.4V0h-8.64V52.92h8.5V48a15,15,0,0,0,11.88,5.62c10.37,0,18.21-8.21,18.21-19.3S174.67,15,164.45,15Zm-1.3,30.67c-6.19,0-10.73-4.83-10.73-11.31S157,23,163.22,23s10.66,4.82,10.66,11.37S169.34,45.65,163.15,45.65Zm83.31-14.91-6.34-.93c-3-.43-5.18-1.44-5.18-3.82,0-2.59,2.8-3.89,6.62-3.89,4.18,0,6.84,1.8,7.42,4.76h8.35c-.94-7.49-6.7-11.88-15.55-11.88-9.15,0-15.2,4.68-15.2,11.3,0,6.34,4,10,12,11.16l6.33.94c3.1.43,4.83,1.65,4.83,4,0,2.95-3,4.17-7.2,4.17-5.12,0-8-2.09-8.43-5.25h-8.49c.79,7.27,6.48,12.38,16.84,12.38,9.44,0,15.7-4.32,15.7-11.74C258.12,35.28,253.58,31.82,246.46,30.74Zm-27.65-2.3c0-8.06-4.9-13.46-15.27-13.46-9.79,0-15.26,5-16.34,12.6h8.57c.43-3,2.73-5.4,7.63-5.4,4.39,0,6.55,1.94,6.55,4.32,0,3.09-4,3.88-8.85,4.39-6.63.72-14.84,3-14.84,11.66,0,6.7,5,11,12.89,11,6.19,0,10.08-2.59,12-6.7.28,3.67,3,6.05,6.84,6.05h5v-7.7h-4.25Zm-8.5,9.36c0,5-4.32,8.64-9.57,8.64-3.24,0-6-1.37-6-4.25,0-3.67,4.39-4.68,8.42-5.11s6-1.22,7.13-2.88ZM281.09,15c-11.09,0-19.23,8.35-19.23,19.36,0,11.6,8.72,19.3,19.37,19.3,9,0,16.06-5.33,17.86-12.89h-9c-1.3,3.31-4.47,5.19-8.71,5.19-5.55,0-9.72-3.46-10.66-9.51H299.3V33.12C299.3,22.46,291.53,15,281.09,15Zm-9.87,15.26c1.37-5.18,5.26-7.7,9.72-7.7,4.9,0,8.64,2.8,9.51,7.7ZM19.3,23a9.84,9.84,0,0,1,9.5,7h9.14c-1.65-8.93-9-15-18.57-15A19,19,0,0,0,0,34.34c0,11.09,8.28,19.3,19.37,19.3,9.36,0,16.85-6,18.5-15H28.8a9.75,9.75,0,0,1-9.43,7.06c-6.27,0-10.66-4.83-10.66-11.31S13,23,19.3,23Zm41.11-8A19,19,0,0,0,41,34.34c0,11.09,8.28,19.3,19.37,19.3A19,19,0,0,0,79.92,34.27C79.92,23.33,71.64,15,60.41,15Zm.07,30.67c-6.19,0-10.73-4.83-10.73-11.31S54.22,23,60.41,23s10.8,4.89,10.8,11.37S66.67,45.65,60.48,45.65ZM123.41,15c-5.62,0-9.29,2.3-11.45,5.54V15.7h-8.57V52.92H112V32.69C112,27,115.63,23,121,23c5,0,8.06,3.53,8.06,8.64V52.92h8.64V31C137.66,21.6,132.84,15,123.41,15ZM92,.36a5.36,5.36,0,0,0-5.55,5.47,5.55,5.55,0,0,0,11.09,0A5.35,5.35,0,0,0,92,.36Zm-9.72,23h5.4V52.92h8.64V15.7h-14Zm298.17-7.7L366.2,52.92H372L375.29,44H392l3.33,8.88h6L386.87,15.7ZM377,39.23l6.45-17.56h.1l6.56,17.56ZM362.66,15.7l-7.88,29h-.11l-8.14-29H341l-8,28.93h-.1l-8-28.87H319L329.82,53h5.45l8.19-29.24h.11L352,53h5.66L368.1,15.7Zm135.25,0v4.86h12.32V52.92h5.6V20.56h12.32V15.7ZM467.82,52.92h25.54V48.06H473.43v-12h18.35V31.35H473.43V20.56h19.93V15.7H467.82ZM443,15.7h-5.6V52.92h24.32V48.06H443Zm-30.45,0h-5.61V52.92h24.32V48.06H412.52Z'/%3E%3C/svg%3E`;case"textWithLogoLight":return t=(.25*e).toFixed(2),`data:image/svg+xml,%3Csvg width='${e}' height='${t}' xmlns='http://www.w3.org/2000/svg' viewBox='0 0 308.44 77.61'%3E%3Cdefs%3E%3Cstyle%3E.cls-1%7Bfill:%23fefefe;%7D%3C/style%3E%3C/defs%3E%3Cpath class='cls-1' d='M142.94,20.2l-7.88,29H135l-8.15-29h-5.55l-8,28.93h-.11l-8-28.87H99.27l10.84,37.27h5.44l8.2-29.24h.1l8.41,29.24h5.66L148.39,20.2Zm17.82,0L146.48,57.42h5.82l3.28-8.88h16.65l3.34,8.88h6L167.16,20.2Zm-3.44,23.52,6.45-17.55h.11l6.56,17.55ZM278.2,20.2v4.86h12.32V57.42h5.6V25.06h12.32V20.2ZM248.11,57.42h25.54V52.55H253.71V40.61h18.35V35.85H253.71V25.06h19.94V20.2H248.11ZM223.26,20.2h-5.61V57.42H242V52.55H223.26Zm-30.46,0h-5.6V57.42h24.32V52.55H192.8Zm-154,38A19.41,19.41,0,1,1,57.92,35.57H77.47a38.81,38.81,0,1,0,0,6.47H57.92A19.39,19.39,0,0,1,38.81,58.21Z'/%3E%3C/svg%3E`;default:return t=e,`data:image/svg+xml,%3Csvg width='${e}' height='${t}' viewBox='0 0 1024 1024' fill='none' xmlns='http://www.w3.org/2000/svg'%3E %3Crect width='1024' height='1024' fill='%230052FF'/%3E %3Cpath fill-rule='evenodd' clip-rule='evenodd' d='M152 512C152 710.823 313.177 872 512 872C710.823 872 872 710.823 872 512C872 313.177 710.823 152 512 152C313.177 152 152 313.177 152 512ZM420 396C406.745 396 396 406.745 396 420V604C396 617.255 406.745 628 420 628H604C617.255 628 628 617.255 628 604V420C628 406.745 617.255 396 604 396H420Z' fill='white'/%3E %3C/svg%3E `}};Ee.walletLogo=ln;var Se={},Mt={exports:{}};(function(n){var e=Object.prototype.hasOwnProperty,t="~";function r(){}Object.create&&(r.prototype=Object.create(null),new r().__proto__||(t=!1));function s(c,d,u){this.fn=c,this.context=d,this.once=u||!1}function a(c,d,u,h,l){if(typeof u!="function")throw new TypeError("The listener must be a function");var p=new s(u,h||c,l),f=t?t+d:d;return c._events[f]?c._events[f].fn?c._events[f]=[c._events[f],p]:c._events[f].push(p):(c._events[f]=p,c._eventsCount++),c}function i(c,d){--c._eventsCount===0?c._events=new r:delete c._events[d]}function o(){this._events=new r,this._eventsCount=0}o.prototype.eventNames=function(){var d=[],u,h;if(this._eventsCount===0)return d;for(h in u=this._events)e.call(u,h)&&d.push(t?h.slice(1):h);return Object.getOwnPropertySymbols?d.concat(Object.getOwnPropertySymbols(u)):d},o.prototype.listeners=function(d){var u=t?t+d:d,h=this._events[u];if(!h)return[];if(h.fn)return[h.fn];for(var l=0,p=h.length,f=new Array(p);l=-32099&&l<=-32e3}function d(l){return l&&typeof l=="object"&&!Array.isArray(l)?Object.assign({},l):l}function u(l,p){return Object.prototype.hasOwnProperty.call(l,p)}function h(l,p){return typeof l=="object"&&l!==null&&p in l&&typeof l[p]=="string"}})(Ye);Object.defineProperty(Ce,"__esModule",{value:!0});Ce.standardErrors=void 0;const C=F,Lt=Ye;Ce.standardErrors={rpc:{parse:n=>R(C.standardErrorCodes.rpc.parse,n),invalidRequest:n=>R(C.standardErrorCodes.rpc.invalidRequest,n),invalidParams:n=>R(C.standardErrorCodes.rpc.invalidParams,n),methodNotFound:n=>R(C.standardErrorCodes.rpc.methodNotFound,n),internal:n=>R(C.standardErrorCodes.rpc.internal,n),server:n=>{if(!n||typeof n!="object"||Array.isArray(n))throw new Error("Ethereum RPC Server errors must provide single object argument.");const{code:e}=n;if(!Number.isInteger(e)||e>-32005||e<-32099)throw new Error('"code" must be an integer such that: -32099 <= code <= -32005');return R(e,n)},invalidInput:n=>R(C.standardErrorCodes.rpc.invalidInput,n),resourceNotFound:n=>R(C.standardErrorCodes.rpc.resourceNotFound,n),resourceUnavailable:n=>R(C.standardErrorCodes.rpc.resourceUnavailable,n),transactionRejected:n=>R(C.standardErrorCodes.rpc.transactionRejected,n),methodNotSupported:n=>R(C.standardErrorCodes.rpc.methodNotSupported,n),limitExceeded:n=>R(C.standardErrorCodes.rpc.limitExceeded,n)},provider:{userRejectedRequest:n=>Y(C.standardErrorCodes.provider.userRejectedRequest,n),unauthorized:n=>Y(C.standardErrorCodes.provider.unauthorized,n),unsupportedMethod:n=>Y(C.standardErrorCodes.provider.unsupportedMethod,n),disconnected:n=>Y(C.standardErrorCodes.provider.disconnected,n),chainDisconnected:n=>Y(C.standardErrorCodes.provider.chainDisconnected,n),unsupportedChain:n=>Y(C.standardErrorCodes.provider.unsupportedChain,n),custom:n=>{if(!n||typeof n!="object"||Array.isArray(n))throw new Error("Ethereum Provider custom errors must provide single object argument.");const{code:e,message:t,data:r}=n;if(!t||typeof t!="string")throw new Error('"message" must be a nonempty string');return new xt(e,t,r)}}};function R(n,e){const[t,r]=At(e);return new Rt(n,t||(0,Lt.getMessageFromCode)(n),r)}function Y(n,e){const[t,r]=At(e);return new xt(n,t||(0,Lt.getMessageFromCode)(n),r)}function At(n){if(n){if(typeof n=="string")return[n];if(typeof n=="object"&&!Array.isArray(n)){const{message:e,data:t}=n;if(e&&typeof e!="string")throw new Error("Must specify string message.");return[e||void 0,t]}}return[]}class Rt extends Error{constructor(e,t,r){if(!Number.isInteger(e))throw new Error('"code" must be an integer.');if(!t||typeof t!="string")throw new Error('"message" must be a nonempty string.');super(t),this.code=e,r!==void 0&&(this.data=r)}}class xt extends Rt{constructor(e,t,r){if(!hn(e))throw new Error('"code" must be an integer such that: 1000 <= code <= 4999');super(e,t,r)}}function hn(n){return Number.isInteger(n)&&n>=1e3&&n<=4999}(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.standardErrors=n.standardErrorCodes=void 0;var e=F;Object.defineProperty(n,"standardErrorCodes",{enumerable:!0,get:function(){return e.standardErrorCodes}});var t=Ce;Object.defineProperty(n,"standardErrors",{enumerable:!0,get:function(){return t.standardErrors}})})(H);var ke={},se={};Object.defineProperty(se,"__esModule",{value:!0});se.isErrorResponse=void 0;function gn(n){return n.errorMessage!==void 0}se.isErrorResponse=gn;var Z={};Object.defineProperty(Z,"__esModule",{value:!0});Z.LIB_VERSION=void 0;Z.LIB_VERSION="4.0.3";Object.defineProperty(ke,"__esModule",{value:!0});ke.serializeError=void 0;const pn=se,fn=Z,mn=F,yn=Ye;function bn(n,e){const t=(0,yn.serialize)(wn(n),{shouldIncludeStack:!0}),r=new URL("https://docs.cloud.coinbase.com/wallet-sdk/docs/errors");r.searchParams.set("version",fn.LIB_VERSION),r.searchParams.set("code",t.code.toString());const s=vn(t.data,e);return s&&r.searchParams.set("method",s),r.searchParams.set("message",t.message),Object.assign(Object.assign({},t),{docUrl:r.href})}ke.serializeError=bn;function wn(n){return typeof n=="string"?{message:n,code:mn.standardErrorCodes.rpc.internal}:(0,pn.isErrorResponse)(n)?Object.assign(Object.assign({},n),{message:n.errorMessage,code:n.errorCode,data:{method:n.method}}):n}function vn(n,e){const t=n==null?void 0:n.method;if(t)return t;if(e!==void 0){if(typeof e=="string")return e;if(Array.isArray(e)){if(e.length>0)return e[0].method}else return e.method}}var k={};Object.defineProperty(k,"__esModule",{value:!0});k.RegExpString=k.IntNumber=k.BigIntString=k.AddressString=k.HexString=k.OpaqueType=void 0;function ce(){return n=>n}k.OpaqueType=ce;k.HexString=ce();k.AddressString=ce();k.BigIntString=ce();function _n(n){return Math.floor(n)}k.IntNumber=_n;k.RegExpString=ce();var g={};Object.defineProperty(g,"__esModule",{value:!0});g.areAddressArraysEqual=g.getFavicon=g.range=g.isBigNumber=g.ensureParsedJSONObject=g.ensureBigInt=g.ensureRegExpString=g.ensureIntNumber=g.ensureBuffer=g.ensureAddressString=g.ensureEvenLengthHexString=g.ensureHexString=g.isHexString=g.prepend0x=g.strip0x=g.has0xPrefix=g.hexStringFromIntNumber=g.intNumberFromHexString=g.bigIntStringFromBigInt=g.hexStringFromBuffer=g.hexStringToUint8Array=g.uint8ArrayToHex=g.randomBytesHex=void 0;const G=H,P=k,Pt=/^[0-9]*$/,Nt=/^[a-f0-9]*$/;function En(n){return Ot(crypto.getRandomValues(new Uint8Array(n)))}g.randomBytesHex=En;function Ot(n){return[...n].map(e=>e.toString(16).padStart(2,"0")).join("")}g.uint8ArrayToHex=Ot;function Sn(n){return new Uint8Array(n.match(/.{1,2}/g).map(e=>parseInt(e,16)))}g.hexStringToUint8Array=Sn;function Cn(n,e=!1){const t=n.toString("hex");return(0,P.HexString)(e?`0x${t}`:t)}g.hexStringFromBuffer=Cn;function kn(n){return(0,P.BigIntString)(n.toString(10))}g.bigIntStringFromBigInt=kn;function In(n){return(0,P.IntNumber)(Number(BigInt(le(n,!0))))}g.intNumberFromHexString=In;function Mn(n){return(0,P.HexString)(`0x${BigInt(n).toString(16)}`)}g.hexStringFromIntNumber=Mn;function Je(n){return n.startsWith("0x")||n.startsWith("0X")}g.has0xPrefix=Je;function Ie(n){return Je(n)?n.slice(2):n}g.strip0x=Ie;function Tt(n){return Je(n)?`0x${n.slice(2)}`:`0x${n}`}g.prepend0x=Tt;function de(n){if(typeof n!="string")return!1;const e=Ie(n).toLowerCase();return Nt.test(e)}g.isHexString=de;function jt(n,e=!1){if(typeof n=="string"){const t=Ie(n).toLowerCase();if(Nt.test(t))return(0,P.HexString)(e?`0x${t}`:t)}throw G.standardErrors.rpc.invalidParams(`"${String(n)}" is not a hexadecimal string`)}g.ensureHexString=jt;function le(n,e=!1){let t=jt(n,!1);return t.length%2===1&&(t=(0,P.HexString)(`0${t}`)),e?(0,P.HexString)(`0x${t}`):t}g.ensureEvenLengthHexString=le;function Ln(n){if(typeof n=="string"){const e=Ie(n).toLowerCase();if(de(e)&&e.length===40)return(0,P.AddressString)(Tt(e))}throw G.standardErrors.rpc.invalidParams(`Invalid Ethereum address: ${String(n)}`)}g.ensureAddressString=Ln;function An(n){if(b.isBuffer(n))return n;if(typeof n=="string"){if(de(n)){const e=le(n,!1);return b.from(e,"hex")}return b.from(n,"utf8")}throw G.standardErrors.rpc.invalidParams(`Not binary data: ${String(n)}`)}g.ensureBuffer=An;function Dt(n){if(typeof n=="number"&&Number.isInteger(n))return(0,P.IntNumber)(n);if(typeof n=="string"){if(Pt.test(n))return(0,P.IntNumber)(Number(n));if(de(n))return(0,P.IntNumber)(Number(BigInt(le(n,!0))))}throw G.standardErrors.rpc.invalidParams(`Not an integer: ${String(n)}`)}g.ensureIntNumber=Dt;function Rn(n){if(n instanceof RegExp)return(0,P.RegExpString)(n.toString());throw G.standardErrors.rpc.invalidParams(`Not a RegExp: ${String(n)}`)}g.ensureRegExpString=Rn;function xn(n){if(n!==null&&(typeof n=="bigint"||Wt(n)))return BigInt(n.toString(10));if(typeof n=="number")return BigInt(Dt(n));if(typeof n=="string"){if(Pt.test(n))return BigInt(n);if(de(n))return BigInt(le(n,!0))}throw G.standardErrors.rpc.invalidParams(`Not an integer: ${String(n)}`)}g.ensureBigInt=xn;function Pn(n){if(typeof n=="string")return JSON.parse(n);if(typeof n=="object")return n;throw G.standardErrors.rpc.invalidParams(`Not a JSON string or an object: ${String(n)}`)}g.ensureParsedJSONObject=Pn;function Wt(n){if(n==null||typeof n.constructor!="function")return!1;const{constructor:e}=n;return typeof e.config=="function"&&typeof e.EUCLID=="number"}g.isBigNumber=Wt;function Nn(n,e){return Array.from({length:e-n},(t,r)=>n+r)}g.range=Nn;function On(){const n=document.querySelector('link[sizes="192x192"]')||document.querySelector('link[sizes="180x180"]')||document.querySelector('link[rel="icon"]')||document.querySelector('link[rel="shortcut icon"]'),{protocol:e,host:t}=document.location,r=n?n.getAttribute("href"):null;return!r||r.startsWith("javascript:")||r.startsWith("vbscript:")?null:r.startsWith("http://")||r.startsWith("https://")||r.startsWith("data:")?r:r.startsWith("//")?e+r:`${e}//${t}${r}`}g.getFavicon=On;function Tn(n,e){return n.length===e.length&&n.every((t,r)=>t===e[r])}g.areAddressArraysEqual=Tn;var W={},Me={},Le={},_={};Object.defineProperty(_,"__esModule",{value:!0});_.decryptContent=_.encryptContent=_.importKeyFromHexString=_.exportKeyToHexString=_.decrypt=_.encrypt=_.deriveSharedSecret=_.generateKeyPair=void 0;const Ut=g;async function jn(){return crypto.subtle.generateKey({name:"ECDH",namedCurve:"P-256"},!0,["deriveKey"])}_.generateKeyPair=jn;async function Dn(n,e){return crypto.subtle.deriveKey({name:"ECDH",public:e},n,{name:"AES-GCM",length:256},!1,["encrypt","decrypt"])}_.deriveSharedSecret=Dn;async function Bt(n,e){const t=crypto.getRandomValues(new Uint8Array(12)),r=await crypto.subtle.encrypt({name:"AES-GCM",iv:t},n,new TextEncoder().encode(e));return{iv:t,cipherText:r}}_.encrypt=Bt;async function Ht(n,{iv:e,cipherText:t}){const r=await crypto.subtle.decrypt({name:"AES-GCM",iv:e},n,t);return new TextDecoder().decode(r)}_.decrypt=Ht;function Kt(n){switch(n){case"public":return"spki";case"private":return"pkcs8"}}async function Wn(n,e){const t=Kt(n),r=await crypto.subtle.exportKey(t,e);return(0,Ut.uint8ArrayToHex)(new Uint8Array(r))}_.exportKeyToHexString=Wn;async function Un(n,e){const t=Kt(n),r=(0,Ut.hexStringToUint8Array)(e).buffer;return await crypto.subtle.importKey(t,r,{name:"ECDH",namedCurve:"P-256"},!0,n==="private"?["deriveKey"]:[])}_.importKeyFromHexString=Un;async function Bn(n,e){const t=JSON.stringify(n,(r,s)=>{if(!(s instanceof Error))return s;const a=s;return Object.assign(Object.assign({},a.code?{code:a.code}:{}),{message:a.message})});return Bt(e,t)}_.encryptContent=Bn;async function Hn(n,e){return JSON.parse(await Ht(e,n))}_.decryptContent=Hn;var K={};Object.defineProperty(K,"__esModule",{value:!0});K.ScopedLocalStorage=void 0;class _e{constructor(e,t){this.scope=e,this.module=t}setItem(e,t){localStorage.setItem(this.scopedKey(e),t)}getItem(e){return localStorage.getItem(this.scopedKey(e))}removeItem(e){localStorage.removeItem(this.scopedKey(e))}clear(){const e=this.scopedKey(""),t=[];for(let r=0;rlocalStorage.removeItem(r))}scopedKey(e){return`-${this.scope}${this.module?`:${this.module}`:""}:${e}`}static clearAll(){new _e("CBWSDK").clear(),new _e("walletlink").clear()}}K.ScopedLocalStorage=_e;Object.defineProperty(Le,"__esModule",{value:!0});Le.SCWKeyManager=void 0;const ge=_,Kn=K,Ke={storageKey:"ownPrivateKey",keyType:"private"},qe={storageKey:"ownPublicKey",keyType:"public"},$e={storageKey:"peerPublicKey",keyType:"public"};class qn{constructor(){this.storage=new Kn.ScopedLocalStorage("CBWSDK","SCWKeyManager"),this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null}async getOwnPublicKey(){return await this.loadKeysIfNeeded(),this.ownPublicKey}async getSharedSecret(){return await this.loadKeysIfNeeded(),this.sharedSecret}async setPeerPublicKey(e){this.sharedSecret=null,this.peerPublicKey=e,await this.storeKey($e,e),await this.loadKeysIfNeeded()}async clear(){this.ownPrivateKey=null,this.ownPublicKey=null,this.peerPublicKey=null,this.sharedSecret=null,this.storage.removeItem(qe.storageKey),this.storage.removeItem(Ke.storageKey),this.storage.removeItem($e.storageKey)}async generateKeyPair(){const e=await(0,ge.generateKeyPair)();this.ownPrivateKey=e.privateKey,this.ownPublicKey=e.publicKey,await this.storeKey(Ke,e.privateKey),await this.storeKey(qe,e.publicKey)}async loadKeysIfNeeded(){if(this.ownPrivateKey===null&&(this.ownPrivateKey=await this.loadKey(Ke)),this.ownPublicKey===null&&(this.ownPublicKey=await this.loadKey(qe)),(this.ownPrivateKey===null||this.ownPublicKey===null)&&await this.generateKeyPair(),this.peerPublicKey===null&&(this.peerPublicKey=await this.loadKey($e)),this.sharedSecret===null){if(this.ownPrivateKey===null||this.peerPublicKey===null)return;this.sharedSecret=await(0,ge.deriveSharedSecret)(this.ownPrivateKey,this.peerPublicKey)}}async loadKey(e){const t=this.storage.getItem(e.storageKey);return t?(0,ge.importKeyFromHexString)(e.keyType,t):null}async storeKey(e,t){const r=await(0,ge.exportKeyToHexString)(e.keyType,t);this.storage.setItem(e.storageKey,r)}}Le.SCWKeyManager=qn;var Ae={};Object.defineProperty(Ae,"__esModule",{value:!0});Ae.SCWStateManager=void 0;const $n=K,rt="accounts",st="activeChain",it="availableChains",at="walletCapabilities";class Fn{get accounts(){return this._accounts}get activeChain(){return this._activeChain}get walletCapabilities(){return this._walletCapabilities}constructor(e){var t,r;this.storage=new $n.ScopedLocalStorage("CBWSDK","SCWStateManager"),this.updateListener=e.updateListener,this.availableChains=this.loadItemFromStorage(it),this._walletCapabilities=this.loadItemFromStorage(at);const s=this.loadItemFromStorage(rt),a=this.loadItemFromStorage(st);s&&this.updateListener.onAccountsUpdate({accounts:s,source:"storage"}),a&&this.updateListener.onChainUpdate({chain:a,source:"storage"}),this._accounts=s||[],this._activeChain=a||{id:(r=(t=e.appChainIds)===null||t===void 0?void 0:t[0])!==null&&r!==void 0?r:1}}updateAccounts(e){this._accounts=e,this.storeItemToStorage(rt,e),this.updateListener.onAccountsUpdate({accounts:e,source:"wallet"})}switchChain(e){var t;const r=(t=this.availableChains)===null||t===void 0?void 0:t.find(s=>s.id===e);return r?(r===this._activeChain||(this._activeChain=r,this.storeItemToStorage(st,r),this.updateListener.onChainUpdate({chain:r,source:"wallet"})),!0):!1}updateAvailableChains(e){if(!e||Object.keys(e).length===0)return;const t=Object.entries(e).map(([r,s])=>({id:Number(r),rpcUrl:s}));this.availableChains=t,this.storeItemToStorage(it,t),this.switchChain(this._activeChain.id)}updateWalletCapabilities(e){this._walletCapabilities=e,this.storeItemToStorage(at,e)}storeItemToStorage(e,t){this.storage.setItem(e,JSON.stringify(t))}loadItemFromStorage(e){const t=this.storage.getItem(e);return t?JSON.parse(t):void 0}clear(){this.storage.clear()}}Ae.SCWStateManager=Fn;Object.defineProperty(Me,"__esModule",{value:!0});Me.SCWSigner=void 0;const Vn=Le,zn=Ae,pe=H,ot=g,fe=_;class Zn{constructor(e){this.metadata=e.metadata,this.communicator=e.communicator,this.keyManager=new Vn.SCWKeyManager,this.stateManager=new zn.SCWStateManager({appChainIds:this.metadata.appChainIds,updateListener:e.updateListener}),this.handshake=this.handshake.bind(this),this.request=this.request.bind(this),this.createRequestMessage=this.createRequestMessage.bind(this),this.decryptResponseMessage=this.decryptResponseMessage.bind(this)}async handshake(){const e=await this.createRequestMessage({handshake:{method:"eth_requestAccounts",params:this.metadata}}),t=await this.communicator.postRequestAndWaitForResponse(e);if("failure"in t.content)throw t.content.failure;const r=await(0,fe.importKeyFromHexString)("public",t.sender);await this.keyManager.setPeerPublicKey(r);const s=await this.decryptResponseMessage(t);this.updateInternalState({method:"eth_requestAccounts"},s);const a=s.result;if("error"in a)throw a.error;return this.stateManager.accounts}async request(e){const t=this.tryLocalHandling(e);if(t!==void 0){if(t instanceof Error)throw t;return t}await this.communicator.waitForPopupLoaded();const r=await this.sendEncryptedRequest(e),s=await this.decryptResponseMessage(r);this.updateInternalState(e,s);const a=s.result;if("error"in a)throw a.error;return a.value}async disconnect(){this.stateManager.clear(),await this.keyManager.clear()}tryLocalHandling(e){var t;switch(e.method){case"wallet_switchEthereumChain":{const r=e.params;if(!r||!(!((t=r[0])===null||t===void 0)&&t.chainId))throw pe.standardErrors.rpc.invalidParams();const s=(0,ot.ensureIntNumber)(r[0].chainId);return this.stateManager.switchChain(s)?null:void 0}case"wallet_getCapabilities":{const r=this.stateManager.walletCapabilities;if(!r)throw pe.standardErrors.provider.unauthorized("No wallet capabilities found, please disconnect and reconnect");return r}default:return}}async sendEncryptedRequest(e){const t=await this.keyManager.getSharedSecret();if(!t)throw pe.standardErrors.provider.unauthorized("No valid session found, try requestAccounts before other methods");const r=await(0,fe.encryptContent)({action:e,chainId:this.stateManager.activeChain.id},t),s=await this.createRequestMessage({encrypted:r});return this.communicator.postRequestAndWaitForResponse(s)}async createRequestMessage(e){const t=await(0,fe.exportKeyToHexString)("public",await this.keyManager.getOwnPublicKey());return{id:crypto.randomUUID(),sender:t,content:e,timestamp:new Date}}async decryptResponseMessage(e){const t=e.content;if("failure"in t)throw t.failure;const r=await this.keyManager.getSharedSecret();if(!r)throw pe.standardErrors.provider.unauthorized("Invalid session");return(0,fe.decryptContent)(t.encrypted,r)}updateInternalState(e,t){var r,s;const a=(r=t.data)===null||r===void 0?void 0:r.chains;a&&this.stateManager.updateAvailableChains(a);const i=(s=t.data)===null||s===void 0?void 0:s.capabilities;i&&this.stateManager.updateWalletCapabilities(i);const o=t.result;if(!("error"in o))switch(e.method){case"eth_requestAccounts":{const c=o.value;this.stateManager.updateAccounts(c);break}case"wallet_switchEthereumChain":{if(o.value!==null)return;const c=e.params,d=(0,ot.ensureIntNumber)(c[0].chainId);this.stateManager.switchChain(d);break}}}}Me.SCWSigner=Zn;var Re={};const Gn=an;function qt(n){return b.allocUnsafe(n).fill(0)}function Yn(n){return n.toString(2).length}function $t(n,e){let t=n.toString(16);t.length%2!==0&&(t="0"+t);const r=t.match(/.{1,2}/g).map(s=>parseInt(s,16));for(;r.length"u")throw new Error("Not an array?");if(t=Yt(n),t!=="dynamic"&&t!==0&&e.length>t)throw new Error("Elements exceed array size: "+t);s=[],n=n.slice(0,n.lastIndexOf("[")),typeof e=="string"&&(e=JSON.parse(e));for(a in e)s.push(j(n,e[a]));if(t==="dynamic"){var i=j("uint256",e.length);s.unshift(i)}return b.concat(s)}else{if(n==="bytes")return e=new b(e),s=b.concat([j("uint256",e.length),e]),e.length%32!==0&&(s=b.concat([s,I.zeros(32-e.length%32)])),s;if(n.startsWith("bytes")){if(t=te(n),t<1||t>32)throw new Error("Invalid bytes width: "+t);return I.setLengthRight(e,32)}else if(n.startsWith("uint")){if(t=te(n),t%8||t<8||t>256)throw new Error("Invalid uint width: "+t);r=z(e);const o=I.bitLengthFromBigInt(r);if(o>t)throw new Error("Supplied uint exceeds width: "+t+" vs "+o);if(r<0)throw new Error("Supplied uint is negative");return I.bufferBEFromBigInt(r,32)}else if(n.startsWith("int")){if(t=te(n),t%8||t<8||t>256)throw new Error("Invalid int width: "+t);r=z(e);const o=I.bitLengthFromBigInt(r);if(o>t)throw new Error("Supplied int exceeds width: "+t+" vs "+o);const c=I.twosFromBigInt(r,256);return I.bufferBEFromBigInt(c,32)}else if(n.startsWith("ufixed")){if(t=ct(n),r=z(e),r<0)throw new Error("Supplied ufixed is negative");return j("uint256",r*BigInt(2)**BigInt(t[1]))}else if(n.startsWith("fixed"))return t=ct(n),j("int256",z(e)*BigInt(2)**BigInt(t[1]))}throw new Error("Unsupported or invalid type: "+n)}function nr(n){return n==="string"||n==="bytes"||Yt(n)==="dynamic"}function rr(n){return n.lastIndexOf("]")===n.length-1}function sr(n,e){var t=[],r=[],s=32*n.length;for(var a in n){var i=Gt(n[a]),o=e[a],c=j(i,o);nr(i)?(t.push(j("uint256",s)),r.push(c),s+=c.length):t.push(c)}return b.concat(t.concat(r))}function Jt(n,e){if(n.length!==e.length)throw new Error("Number of types are not matching the values");for(var t,r,s=[],a=0;a32)throw new Error("Invalid bytes width: "+t);s.push(I.setLengthRight(o,t))}else if(i.startsWith("uint")){if(t=te(i),t%8||t<8||t>256)throw new Error("Invalid uint width: "+t);r=z(o);const c=I.bitLengthFromBigInt(r);if(c>t)throw new Error("Supplied uint exceeds width: "+t+" vs "+c);s.push(I.bufferBEFromBigInt(r,t/8))}else if(i.startsWith("int")){if(t=te(i),t%8||t<8||t>256)throw new Error("Invalid int width: "+t);r=z(o);const c=I.bitLengthFromBigInt(r);if(c>t)throw new Error("Supplied int exceeds width: "+t+" vs "+c);const d=I.twosFromBigInt(r,t);s.push(I.bufferBEFromBigInt(d,t/8))}else throw new Error("Unsupported or invalid type: "+i)}return b.concat(s)}function ir(n,e){return I.keccak(Jt(n,e))}var ar={rawEncode:sr,solidityPack:Jt,soliditySHA3:ir};const O=Zt,ae=ar,Qt={type:"object",properties:{types:{type:"object",additionalProperties:{type:"array",items:{type:"object",properties:{name:{type:"string"},type:{type:"string"}},required:["name","type"]}}},primaryType:{type:"string"},domain:{type:"object"},message:{type:"object"}},required:["types","primaryType","domain","message"]},Fe={encodeData(n,e,t,r=!0){const s=["bytes32"],a=[this.hashType(n,t)];if(r){const i=(o,c,d)=>{if(t[c]!==void 0)return["bytes32",d==null?"0x0000000000000000000000000000000000000000000000000000000000000000":O.keccak(this.encodeData(c,d,t,r))];if(d===void 0)throw new Error(`missing value for field ${o} of type ${c}`);if(c==="bytes")return["bytes32",O.keccak(d)];if(c==="string")return typeof d=="string"&&(d=b.from(d,"utf8")),["bytes32",O.keccak(d)];if(c.lastIndexOf("]")===c.length-1){const u=c.slice(0,c.lastIndexOf("[")),h=d.map(l=>i(o,u,l));return["bytes32",O.keccak(ae.rawEncode(h.map(([l])=>l),h.map(([,l])=>l)))]}return[c,d]};for(const o of t[n]){const[c,d]=i(o.name,o.type,e[o.name]);s.push(c),a.push(d)}}else for(const i of t[n]){let o=e[i.name];if(o!==void 0)if(i.type==="bytes")s.push("bytes32"),o=O.keccak(o),a.push(o);else if(i.type==="string")s.push("bytes32"),typeof o=="string"&&(o=b.from(o,"utf8")),o=O.keccak(o),a.push(o);else if(t[i.type]!==void 0)s.push("bytes32"),o=O.keccak(this.encodeData(i.type,o,t,r)),a.push(o);else{if(i.type.lastIndexOf("]")===i.type.length-1)throw new Error("Arrays currently unimplemented in encodeData");s.push(i.type),a.push(o)}}return ae.rawEncode(s,a)},encodeType(n,e){let t="",r=this.findTypeDependencies(n,e).filter(s=>s!==n);r=[n].concat(r.sort());for(const s of r){if(!e[s])throw new Error("No type definition specified: "+s);t+=s+"("+e[s].map(({name:i,type:o})=>o+" "+i).join(",")+")"}return t},findTypeDependencies(n,e,t=[]){if(n=n.match(/^\w*/)[0],t.includes(n)||e[n]===void 0)return t;t.push(n);for(const r of e[n])for(const s of this.findTypeDependencies(r.type,e,t))!t.includes(s)&&t.push(s);return t},hashStruct(n,e,t,r=!0){return O.keccak(this.encodeData(n,e,t,r))},hashType(n,e){return O.keccak(this.encodeType(n,e))},sanitizeData(n){const e={};for(const t in Qt.properties)n[t]&&(e[t]=n[t]);return e.types&&(e.types=Object.assign({EIP712Domain:[]},e.types)),e},hash(n,e=!0){const t=this.sanitizeData(n),r=[b.from("1901","hex")];return r.push(this.hashStruct("EIP712Domain",t.domain,t.types,e)),t.primaryType!=="EIP712Domain"&&r.push(this.hashStruct(t.primaryType,t.message,t.types,e)),O.keccak(b.concat(r))}};var or={TYPED_MESSAGE_SCHEMA:Qt,TypedDataUtils:Fe,hashForSignTypedDataLegacy:function(n){return cr(n.data)},hashForSignTypedData_v3:function(n){return Fe.hash(n.data,!1)},hashForSignTypedData_v4:function(n){return Fe.hash(n.data)}};function cr(n){const e=new Error("Expect argument to be non-empty array");if(typeof n!="object"||!n.length)throw e;const t=n.map(function(a){return a.type==="bytes"?O.toBuffer(a.value):a.value}),r=n.map(function(a){return a.type}),s=n.map(function(a){if(!a.name)throw e;return a.type+" "+a.name});return ae.soliditySHA3(["bytes32","bytes32"],[ae.soliditySHA3(new Array(n.length).fill("string"),s),ae.soliditySHA3(r,t)])}var U={};Object.defineProperty(U,"__esModule",{value:!0});U.APP_VERSION_KEY=U.LOCAL_STORAGE_ADDRESSES_KEY=U.WALLET_USER_NAME_KEY=void 0;U.WALLET_USER_NAME_KEY="walletUsername";U.LOCAL_STORAGE_ADDRESSES_KEY="Addresses";U.APP_VERSION_KEY="AppVersion";var ue={};Object.defineProperty(ue,"__esModule",{value:!0});ue.RelayEventManager=void 0;const dr=g;class lr{constructor(){this._nextRequestId=0,this.callbacks=new Map}makeRequestId(){this._nextRequestId=(this._nextRequestId+1)%2147483647;const e=this._nextRequestId,t=(0,dr.prepend0x)(e.toString(16));return this.callbacks.get(t)&&this.callbacks.delete(t),e}}ue.RelayEventManager=lr;var Pe={},Ne={},Oe={};Object.defineProperty(Oe,"__esModule",{value:!0});Oe.WalletLinkCipher=void 0;const me=g;class ur{constructor(e){this.secret=e}async encrypt(e){const t=this.secret;if(t.length!==64)throw Error("secret must be 256 bits");const r=crypto.getRandomValues(new Uint8Array(12)),s=await crypto.subtle.importKey("raw",(0,me.hexStringToUint8Array)(t),{name:"aes-gcm"},!1,["encrypt","decrypt"]),a=new TextEncoder,i=await window.crypto.subtle.encrypt({name:"AES-GCM",iv:r},s,a.encode(e)),o=16,c=i.slice(i.byteLength-o),d=i.slice(0,i.byteLength-o),u=new Uint8Array(c),h=new Uint8Array(d),l=new Uint8Array([...r,...u,...h]);return(0,me.uint8ArrayToHex)(l)}async decrypt(e){const t=this.secret;if(t.length!==64)throw Error("secret must be 256 bits");return new Promise((r,s)=>{(async function(){const a=await crypto.subtle.importKey("raw",(0,me.hexStringToUint8Array)(t),{name:"aes-gcm"},!1,["encrypt","decrypt"]),i=(0,me.hexStringToUint8Array)(e),o=i.slice(0,12),c=i.slice(12,28),d=i.slice(28),u=new Uint8Array([...d,...c]),h={name:"AES-GCM",iv:new Uint8Array(o)};try{const l=await window.crypto.subtle.decrypt(h,a,u),p=new TextDecoder;r(p.decode(l))}catch(l){s(l)}})()})}}Oe.WalletLinkCipher=ur;var Te={};Object.defineProperty(Te,"__esModule",{value:!0});Te.WalletLinkHTTP=void 0;class hr{constructor(e,t,r){this.linkAPIUrl=e,this.sessionId=t;const s=`${t}:${r}`;this.auth=`Basic ${btoa(s)}`}async markUnseenEventsAsSeen(e){return Promise.all(e.map(t=>fetch(`${this.linkAPIUrl}/events/${t.eventId}/seen`,{method:"POST",headers:{Authorization:this.auth}}))).catch(t=>console.error("Unabled to mark event as failed:",t))}async fetchUnseenEvents(){var e;const t=await fetch(`${this.linkAPIUrl}/events?unseen=true`,{headers:{Authorization:this.auth}});if(t.ok){const{events:r,error:s}=await t.json();if(s)throw new Error(`Check unseen events failed: ${s}`);const a=(e=r==null?void 0:r.filter(i=>i.event==="Web3Response").map(i=>({type:"Event",sessionId:this.sessionId,eventId:i.id,event:i.event,data:i.data})))!==null&&e!==void 0?e:[];return this.markUnseenEventsAsSeen(a),a}throw new Error(`Check unseen events failed: ${t.status}`)}}Te.WalletLinkHTTP=hr;var ne={};Object.defineProperty(ne,"__esModule",{value:!0});ne.WalletLinkWebSocket=ne.ConnectionState=void 0;var ee;(function(n){n[n.DISCONNECTED=0]="DISCONNECTED",n[n.CONNECTING=1]="CONNECTING",n[n.CONNECTED=2]="CONNECTED"})(ee||(ne.ConnectionState=ee={}));class gr{setConnectionStateListener(e){this.connectionStateListener=e}setIncomingDataListener(e){this.incomingDataListener=e}constructor(e,t=WebSocket){this.WebSocketClass=t,this.webSocket=null,this.pendingData=[],this.url=e.replace(/^http/,"ws")}async connect(){if(this.webSocket)throw new Error("webSocket object is not null");return new Promise((e,t)=>{var r;let s;try{this.webSocket=s=new this.WebSocketClass(this.url)}catch(a){t(a);return}(r=this.connectionStateListener)===null||r===void 0||r.call(this,ee.CONNECTING),s.onclose=a=>{var i;this.clearWebSocket(),t(new Error(`websocket error ${a.code}: ${a.reason}`)),(i=this.connectionStateListener)===null||i===void 0||i.call(this,ee.DISCONNECTED)},s.onopen=a=>{var i;e(),(i=this.connectionStateListener)===null||i===void 0||i.call(this,ee.CONNECTED),this.pendingData.length>0&&([...this.pendingData].forEach(c=>this.sendData(c)),this.pendingData=[])},s.onmessage=a=>{var i,o;if(a.data==="h")(i=this.incomingDataListener)===null||i===void 0||i.call(this,{type:"Heartbeat"});else try{const c=JSON.parse(a.data);(o=this.incomingDataListener)===null||o===void 0||o.call(this,c)}catch{}}})}disconnect(){var e;const{webSocket:t}=this;if(t){this.clearWebSocket(),(e=this.connectionStateListener)===null||e===void 0||e.call(this,ee.DISCONNECTED),this.connectionStateListener=void 0,this.incomingDataListener=void 0;try{t.close()}catch{}}}sendData(e){const{webSocket:t}=this;if(!t){this.pendingData.push(e),this.connect();return}t.send(e)}clearWebSocket(){const{webSocket:e}=this;e&&(this.webSocket=null,e.onclose=null,e.onerror=null,e.onmessage=null,e.onopen=null)}}ne.WalletLinkWebSocket=gr;Object.defineProperty(Ne,"__esModule",{value:!0});Ne.WalletLinkConnection=void 0;const dt=U,pr=Oe,fr=Te,ye=ne,J=k,lt=1e4,mr=6e4;class yr{constructor({session:e,linkAPIUrl:t,listener:r,WebSocketClass:s=WebSocket}){this.destroyed=!1,this.lastHeartbeatResponse=0,this.nextReqId=(0,J.IntNumber)(1),this._connected=!1,this._linked=!1,this.shouldFetchUnseenEventsOnConnect=!1,this.requestResolutions=new Map,this.handleSessionMetadataUpdated=i=>{if(!i)return;new Map([["__destroyed",this.handleDestroyed],["EthereumAddress",this.handleAccountUpdated],["WalletUsername",this.handleWalletUsernameUpdated],["AppVersion",this.handleAppVersionUpdated],["ChainId",c=>i.JsonRpcUrl&&this.handleChainUpdated(c,i.JsonRpcUrl)]]).forEach((c,d)=>{const u=i[d];u!==void 0&&c(u)})},this.handleDestroyed=i=>{var o;i==="1"&&((o=this.listener)===null||o===void 0||o.resetAndReload())},this.handleAccountUpdated=async i=>{var o;{const c=await this.cipher.decrypt(i);(o=this.listener)===null||o===void 0||o.accountUpdated(c)}},this.handleMetadataUpdated=async(i,o)=>{var c;{const d=await this.cipher.decrypt(o);(c=this.listener)===null||c===void 0||c.metadataUpdated(i,d)}},this.handleWalletUsernameUpdated=async i=>{this.handleMetadataUpdated(dt.WALLET_USER_NAME_KEY,i)},this.handleAppVersionUpdated=async i=>{this.handleMetadataUpdated(dt.APP_VERSION_KEY,i)},this.handleChainUpdated=async(i,o)=>{var c;{const d=await this.cipher.decrypt(i),u=await this.cipher.decrypt(o);(c=this.listener)===null||c===void 0||c.chainUpdated(d,u)}},this.session=e,this.cipher=new pr.WalletLinkCipher(e.secret),this.listener=r;const a=new ye.WalletLinkWebSocket(`${t}/rpc`,s);a.setConnectionStateListener(async i=>{let o=!1;switch(i){case ye.ConnectionState.DISCONNECTED:if(!this.destroyed){const c=async()=>{await new Promise(d=>setTimeout(d,5e3)),this.destroyed||a.connect().catch(()=>{c()})};c()}break;case ye.ConnectionState.CONNECTED:try{await this.authenticate(),this.sendIsLinked(),this.sendGetSessionConfig(),o=!0}catch{}this.updateLastHeartbeat(),setInterval(()=>{this.heartbeat()},lt),this.shouldFetchUnseenEventsOnConnect&&this.fetchUnseenEventsAPI();break;case ye.ConnectionState.CONNECTING:break}this.connected!==o&&(this.connected=o)}),a.setIncomingDataListener(i=>{var o;switch(i.type){case"Heartbeat":this.updateLastHeartbeat();return;case"IsLinkedOK":case"Linked":{const c=i.type==="IsLinkedOK"?i.linked:void 0;this.linked=c||i.onlineGuests>0;break}case"GetSessionConfigOK":case"SessionConfigUpdated":{this.handleSessionMetadataUpdated(i.metadata);break}case"Event":{this.handleIncomingEvent(i);break}}i.id!==void 0&&((o=this.requestResolutions.get(i.id))===null||o===void 0||o(i))}),this.ws=a,this.http=new fr.WalletLinkHTTP(t,e.id,e.key)}connect(){if(this.destroyed)throw new Error("instance is destroyed");this.ws.connect()}destroy(){this.destroyed=!0,this.ws.disconnect(),this.listener=void 0}get isDestroyed(){return this.destroyed}get connected(){return this._connected}set connected(e){var t;this._connected=e,e&&((t=this.onceConnected)===null||t===void 0||t.call(this))}setOnceConnected(e){return new Promise(t=>{this.connected?e().then(t):this.onceConnected=()=>{e().then(t),this.onceConnected=void 0}})}get linked(){return this._linked}set linked(e){var t,r;this._linked=e,e&&((t=this.onceLinked)===null||t===void 0||t.call(this)),(r=this.listener)===null||r===void 0||r.linkedUpdated(e)}setOnceLinked(e){return new Promise(t=>{this.linked?e().then(t):this.onceLinked=()=>{e().then(t),this.onceLinked=void 0}})}async handleIncomingEvent(e){var t;if(!(e.type!=="Event"||e.event!=="Web3Response")){const r=await this.cipher.decrypt(e.data),s=JSON.parse(r);if(s.type!=="WEB3_RESPONSE")return;(t=this.listener)===null||t===void 0||t.handleWeb3ResponseMessage(s)}}async checkUnseenEvents(){if(!this.connected){this.shouldFetchUnseenEventsOnConnect=!0;return}await new Promise(e=>setTimeout(e,250));try{await this.fetchUnseenEventsAPI()}catch(e){console.error("Unable to check for unseen events",e)}}async fetchUnseenEventsAPI(){this.shouldFetchUnseenEventsOnConnect=!1,(await this.http.fetchUnseenEvents()).forEach(t=>this.handleIncomingEvent(t))}async setSessionMetadata(e,t){const r={type:"SetSessionConfig",id:(0,J.IntNumber)(this.nextReqId++),sessionId:this.session.id,metadata:{[e]:t}};return this.setOnceConnected(async()=>{const s=await this.makeRequest(r);if(s.type==="Fail")throw new Error(s.error||"failed to set session metadata")})}async publishEvent(e,t,r=!1){const s=await this.cipher.encrypt(JSON.stringify(Object.assign(Object.assign({},t),{origin:location.origin,relaySource:"coinbaseWalletExtension"in window&&window.coinbaseWalletExtension?"injected_sdk":"sdk"}))),a={type:"PublishEvent",id:(0,J.IntNumber)(this.nextReqId++),sessionId:this.session.id,event:e,data:s,callWebhook:r};return this.setOnceLinked(async()=>{const i=await this.makeRequest(a);if(i.type==="Fail")throw new Error(i.error||"failed to publish event");return i.eventId})}sendData(e){this.ws.sendData(JSON.stringify(e))}updateLastHeartbeat(){this.lastHeartbeatResponse=Date.now()}heartbeat(){if(Date.now()-this.lastHeartbeatResponse>lt*2){this.ws.disconnect();return}try{this.ws.sendData("h")}catch{}}async makeRequest(e,t=mr){const r=e.id;this.sendData(e);let s;return Promise.race([new Promise((a,i)=>{s=window.setTimeout(()=>{i(new Error(`request ${r} timed out`))},t)}),new Promise(a=>{this.requestResolutions.set(r,i=>{clearTimeout(s),a(i),this.requestResolutions.delete(r)})})])}async authenticate(){const e={type:"HostSession",id:(0,J.IntNumber)(this.nextReqId++),sessionId:this.session.id,sessionKey:this.session.key},t=await this.makeRequest(e);if(t.type==="Fail")throw new Error(t.error||"failed to authenticate")}sendIsLinked(){const e={type:"IsLinked",id:(0,J.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(e)}sendGetSessionConfig(){const e={type:"GetSessionConfig",id:(0,J.IntNumber)(this.nextReqId++),sessionId:this.session.id};this.sendData(e)}}Ne.WalletLinkConnection=yr;var je={};Object.defineProperty(je,"__esModule",{value:!0});je.WalletLinkSession=void 0;const br=cn,ut=g,ht="session:id",gt="session:secret",pt="session:linked";class Qe{constructor(e,t,r,s){this._storage=e,this._id=t||(0,ut.randomBytesHex)(16),this._secret=r||(0,ut.randomBytesHex)(32),this._key=new br.sha256().update(`${this._id}, ${this._secret} WalletLink`).digest("hex"),this._linked=!!s}static load(e){const t=e.getItem(ht),r=e.getItem(pt),s=e.getItem(gt);return t&&s?new Qe(e,t,s,r==="1"):null}get id(){return this._id}get secret(){return this._secret}get key(){return this._key}get linked(){return this._linked}set linked(e){this._linked=e,this.persistLinked()}save(){return this._storage.setItem(ht,this._id),this._storage.setItem(gt,this._secret),this.persistLinked(),this}persistLinked(){this._storage.setItem(pt,this._linked?"1":"0")}}je.WalletLinkSession=Qe;var L={};Object.defineProperty(L,"__esModule",{value:!0});L.isDarkMode=L.isMobileWeb=L.getLocation=L.createQrUrl=void 0;function wr(n,e,t,r,s,a){const i=r?"parent-id":"id",o=new URLSearchParams({[i]:n,secret:e,server:t,v:s,chainId:a.toString()}).toString();return`${t}/#/link?${o}`}L.createQrUrl=wr;function vr(){try{return window.frameElement!==null}catch{return!1}}function _r(){try{return vr()&&window.top?window.top.location:window.location}catch{return window.location}}L.getLocation=_r;function Er(){var n;return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test((n=window==null?void 0:window.navigator)===null||n===void 0?void 0:n.userAgent)}L.isMobileWeb=Er;function Sr(){var n,e;return(e=(n=window==null?void 0:window.matchMedia)===null||n===void 0?void 0:n.call(window,"(prefers-color-scheme: dark)").matches)!==null&&e!==void 0?e:!1}L.isDarkMode=Sr;var De={},he={},Xe={};Object.defineProperty(Xe,"__esModule",{value:!0});Xe.default='@namespace svg "http://www.w3.org/2000/svg";.-cbwsdk-css-reset,.-cbwsdk-css-reset *{animation:none;animation-delay:0;animation-direction:normal;animation-duration:0;animation-fill-mode:none;animation-iteration-count:1;animation-name:none;animation-play-state:running;animation-timing-function:ease;backface-visibility:visible;background:0;background-attachment:scroll;background-clip:border-box;background-color:rgba(0,0,0,0);background-image:none;background-origin:padding-box;background-position:0 0;background-position-x:0;background-position-y:0;background-repeat:repeat;background-size:auto auto;border:0;border-style:none;border-width:medium;border-color:inherit;border-bottom:0;border-bottom-color:inherit;border-bottom-left-radius:0;border-bottom-right-radius:0;border-bottom-style:none;border-bottom-width:medium;border-collapse:separate;border-image:none;border-left:0;border-left-color:inherit;border-left-style:none;border-left-width:medium;border-radius:0;border-right:0;border-right-color:inherit;border-right-style:none;border-right-width:medium;border-spacing:0;border-top:0;border-top-color:inherit;border-top-left-radius:0;border-top-right-radius:0;border-top-style:none;border-top-width:medium;box-shadow:none;box-sizing:border-box;caption-side:top;clear:none;clip:auto;color:inherit;columns:auto;column-count:auto;column-fill:balance;column-gap:normal;column-rule:medium none currentColor;column-rule-color:currentColor;column-rule-style:none;column-rule-width:none;column-span:1;column-width:auto;counter-increment:none;counter-reset:none;direction:ltr;empty-cells:show;float:none;font:normal;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;font-size:medium;font-style:normal;font-variant:normal;font-weight:normal;height:auto;hyphens:none;letter-spacing:normal;line-height:normal;list-style:none;list-style-image:none;list-style-position:outside;list-style-type:disc;margin:0;margin-bottom:0;margin-left:0;margin-right:0;margin-top:0;opacity:1;orphans:0;outline:0;outline-color:invert;outline-style:none;outline-width:medium;overflow:visible;overflow-x:visible;overflow-y:visible;padding:0;padding-bottom:0;padding-left:0;padding-right:0;padding-top:0;page-break-after:auto;page-break-before:auto;page-break-inside:auto;perspective:none;perspective-origin:50% 50%;pointer-events:auto;position:static;quotes:"\\201C" "\\201D" "\\2018" "\\2019";tab-size:8;table-layout:auto;text-align:inherit;text-align-last:auto;text-decoration:none;text-decoration-color:inherit;text-decoration-line:none;text-decoration-style:solid;text-indent:0;text-shadow:none;text-transform:none;transform:none;transform-style:flat;transition:none;transition-delay:0s;transition-duration:0s;transition-property:none;transition-timing-function:ease;unicode-bidi:normal;vertical-align:baseline;visibility:visible;white-space:normal;widows:0;word-spacing:normal;z-index:auto}.-cbwsdk-css-reset strong{font-weight:bold}.-cbwsdk-css-reset *{box-sizing:border-box;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI","Helvetica Neue",Arial,sans-serif;line-height:1}.-cbwsdk-css-reset [class*=container]{margin:0;padding:0}.-cbwsdk-css-reset style{display:none}';var Cr=N&&N.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(he,"__esModule",{value:!0});he.injectCssReset=void 0;const kr=Cr(Xe);function Ir(){const n=document.createElement("style");n.type="text/css",n.appendChild(document.createTextNode(kr.default)),document.documentElement.appendChild(n)}he.injectCssReset=Ir;var et={},tt={};Object.defineProperty(tt,"__esModule",{value:!0});tt.default=".-cbwsdk-css-reset .-gear-container{margin-left:16px !important;margin-right:9px !important;display:flex;align-items:center;justify-content:center;width:24px;height:24px;transition:opacity .25s}.-cbwsdk-css-reset .-gear-container *{user-select:none}.-cbwsdk-css-reset .-gear-container svg{opacity:0;position:absolute}.-cbwsdk-css-reset .-gear-icon{height:12px;width:12px;z-index:10000}.-cbwsdk-css-reset .-cbwsdk-snackbar{align-items:flex-end;display:flex;flex-direction:column;position:fixed;right:0;top:0;z-index:2147483647}.-cbwsdk-css-reset .-cbwsdk-snackbar *{user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance{display:flex;flex-direction:column;margin:8px 16px 0 16px;overflow:visible;text-align:left;transform:translateX(0);transition:opacity .25s,transform .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header:hover .-gear-container svg{opacity:1}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header{display:flex;align-items:center;background:#fff;overflow:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-cblogo{margin:8px 8px 8px 8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-header-message{color:#000;font-size:13px;line-height:1.5;user-select:none}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu{background:#fff;transition:opacity .25s ease-in-out,transform .25s linear,visibility 0s;visibility:hidden;border:1px solid #e7ebee;box-sizing:border-box;border-radius:8px;opacity:0;flex-direction:column;padding-left:8px;padding-right:8px}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:last-child{margin-bottom:8px !important}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover{background:#f5f7f8;border-radius:6px;transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover span{color:#050f19;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item:hover svg path{fill:#000;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item{visibility:inherit;height:35px;margin-top:8px;margin-bottom:0;display:flex;flex-direction:row;align-items:center;padding:8px;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item *{visibility:inherit;cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover{background:rgba(223,95,103,.2);transition:background .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover *{cursor:pointer}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover svg path{fill:#df5f67;transition:fill .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-is-red:hover span{color:#df5f67;transition:color .25s}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-menu-item-info{color:#aaa;font-size:13px;margin:0 8px 0 32px;position:absolute}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-hidden{opacity:0;text-align:left;transform:translateX(25%);transition:opacity .5s linear}.-cbwsdk-css-reset .-cbwsdk-snackbar-instance-expanded .-cbwsdk-snackbar-instance-menu{opacity:1;display:flex;transform:translateY(8px);visibility:visible}";(function(n){var e=N&&N.__importDefault||function(l){return l&&l.__esModule?l:{default:l}};Object.defineProperty(n,"__esModule",{value:!0}),n.SnackbarInstance=n.SnackbarContainer=n.Snackbar=void 0;const t=e(kt),r=It,s=on,a=L,i=e(tt),o="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMzIiIGhlaWdodD0iMzIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEuNDkyIDEwLjQxOWE4LjkzIDguOTMgMCAwMTguOTMtOC45M2gxMS4xNjNhOC45MyA4LjkzIDAgMDE4LjkzIDguOTN2MTEuMTYzYTguOTMgOC45MyAwIDAxLTguOTMgOC45M0gxMC40MjJhOC45MyA4LjkzIDAgMDEtOC45My04LjkzVjEwLjQxOXoiIGZpbGw9IiMxNjUyRjAiLz48cGF0aCBmaWxsLXJ1bGU9ImV2ZW5vZGQiIGNsaXAtcnVsZT0iZXZlbm9kZCIgZD0iTTEwLjQxOSAwSDIxLjU4QzI3LjMzNSAwIDMyIDQuNjY1IDMyIDEwLjQxOVYyMS41OEMzMiAyNy4zMzUgMjcuMzM1IDMyIDIxLjU4MSAzMkgxMC40MkM0LjY2NSAzMiAwIDI3LjMzNSAwIDIxLjU4MVYxMC40MkMwIDQuNjY1IDQuNjY1IDAgMTAuNDE5IDB6bTAgMS40ODhhOC45MyA4LjkzIDAgMDAtOC45MyA4LjkzdjExLjE2M2E4LjkzIDguOTMgMCAwMDguOTMgOC45M0gyMS41OGE4LjkzIDguOTMgMCAwMDguOTMtOC45M1YxMC40MmE4LjkzIDguOTMgMCAwMC04LjkzLTguOTNIMTAuNDJ6IiBmaWxsPSIjZmZmIi8+PHBhdGggZmlsbC1ydWxlPSJldmVub2RkIiBjbGlwLXJ1bGU9ImV2ZW5vZGQiIGQ9Ik0xNS45OTggMjYuMDQ5Yy01LjU0OSAwLTEwLjA0Ny00LjQ5OC0xMC4wNDctMTAuMDQ3IDAtNS41NDggNC40OTgtMTAuMDQ2IDEwLjA0Ny0xMC4wNDYgNS41NDggMCAxMC4wNDYgNC40OTggMTAuMDQ2IDEwLjA0NiAwIDUuNTQ5LTQuNDk4IDEwLjA0Ny0xMC4wNDYgMTAuMDQ3eiIgZmlsbD0iI2ZmZiIvPjxwYXRoIGQ9Ik0xMi43NjIgMTQuMjU0YzAtLjgyMi42NjctMS40ODkgMS40ODktMS40ODloMy40OTdjLjgyMiAwIDEuNDg4LjY2NiAxLjQ4OCAxLjQ4OXYzLjQ5N2MwIC44MjItLjY2NiAxLjQ4OC0xLjQ4OCAxLjQ4OGgtMy40OTdhMS40ODggMS40ODggMCAwMS0xLjQ4OS0xLjQ4OHYtMy40OTh6IiBmaWxsPSIjMTY1MkYwIi8+PC9zdmc+",c="data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMTIiIGhlaWdodD0iMTIiIGZpbGw9Im5vbmUiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyI+PHBhdGggZD0iTTEyIDYuNzV2LTEuNWwtMS43Mi0uNTdjLS4wOC0uMjctLjE5LS41Mi0uMzItLjc3bC44MS0xLjYyLTEuMDYtMS4wNi0xLjYyLjgxYy0uMjQtLjEzLS41LS4yNC0uNzctLjMyTDYuNzUgMGgtMS41bC0uNTcgMS43MmMtLjI3LjA4LS41My4xOS0uNzcuMzJsLTEuNjItLjgxLTEuMDYgMS4wNi44MSAxLjYyYy0uMTMuMjQtLjI0LjUtLjMyLjc3TDAgNS4yNXYxLjVsMS43Mi41N2MuMDguMjcuMTkuNTMuMzIuNzdsLS44MSAxLjYyIDEuMDYgMS4wNiAxLjYyLS44MWMuMjQuMTMuNS4yMy43Ny4zMkw1LjI1IDEyaDEuNWwuNTctMS43MmMuMjctLjA4LjUyLS4xOS43Ny0uMzJsMS42Mi44MSAxLjA2LTEuMDYtLjgxLTEuNjJjLjEzLS4yNC4yMy0uNS4zMi0uNzdMMTIgNi43NXpNNiA4LjVhMi41IDIuNSAwIDAxMC01IDIuNSAyLjUgMCAwMTAgNXoiIGZpbGw9IiMwNTBGMTkiLz48L3N2Zz4=";class d{constructor(){this.items=new Map,this.nextItemKey=0,this.root=null,this.darkMode=(0,a.isDarkMode)()}attach(p){this.root=document.createElement("div"),this.root.className="-cbwsdk-snackbar-root",p.appendChild(this.root),this.render()}presentItem(p){const f=this.nextItemKey++;return this.items.set(f,p),this.render(),()=>{this.items.delete(f),this.render()}}clear(){this.items.clear(),this.render()}render(){this.root&&(0,r.render)((0,r.h)("div",null,(0,r.h)(n.SnackbarContainer,{darkMode:this.darkMode},Array.from(this.items.entries()).map(([p,f])=>(0,r.h)(n.SnackbarInstance,Object.assign({},f,{key:p}))))),this.root)}}n.Snackbar=d;const u=l=>(0,r.h)("div",{class:(0,t.default)("-cbwsdk-snackbar-container")},(0,r.h)("style",null,i.default),(0,r.h)("div",{class:"-cbwsdk-snackbar"},l.children));n.SnackbarContainer=u;const h=({autoExpand:l,message:p,menuItems:f})=>{const[E,m]=(0,s.useState)(!0),[A,T]=(0,s.useState)(l??!1);(0,s.useEffect)(()=>{const M=[window.setTimeout(()=>{m(!1)},1),window.setTimeout(()=>{T(!0)},1e4)];return()=>{M.forEach(window.clearTimeout)}});const w=()=>{T(!A)};return(0,r.h)("div",{class:(0,t.default)("-cbwsdk-snackbar-instance",E&&"-cbwsdk-snackbar-instance-hidden",A&&"-cbwsdk-snackbar-instance-expanded")},(0,r.h)("div",{class:"-cbwsdk-snackbar-instance-header",onClick:w},(0,r.h)("img",{src:o,class:"-cbwsdk-snackbar-instance-header-cblogo"})," ",(0,r.h)("div",{class:"-cbwsdk-snackbar-instance-header-message"},p),(0,r.h)("div",{class:"-gear-container"},!A&&(0,r.h)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,r.h)("circle",{cx:"12",cy:"12",r:"12",fill:"#F5F7F8"})),(0,r.h)("img",{src:c,class:"-gear-icon",title:"Expand"}))),f&&f.length>0&&(0,r.h)("div",{class:"-cbwsdk-snackbar-instance-menu"},f.map((M,V)=>(0,r.h)("div",{class:(0,t.default)("-cbwsdk-snackbar-instance-menu-item",M.isRed&&"-cbwsdk-snackbar-instance-menu-item-is-red"),onClick:M.onClick,key:V},(0,r.h)("svg",{width:M.svgWidth,height:M.svgHeight,viewBox:"0 0 10 11",fill:"none",xmlns:"http://www.w3.org/2000/svg"},(0,r.h)("path",{"fill-rule":M.defaultFillRule,"clip-rule":M.defaultClipRule,d:M.path,fill:"#AAAAAA"})),(0,r.h)("span",{class:(0,t.default)("-cbwsdk-snackbar-instance-menu-item-info",M.isRed&&"-cbwsdk-snackbar-instance-menu-item-info-is-red")},M.info)))))};n.SnackbarInstance=h})(et);Object.defineProperty(De,"__esModule",{value:!0});De.WalletLinkRelayUI=void 0;const Mr=he,Lr=et;class Ar{constructor(){this.attached=!1,this.snackbar=new Lr.Snackbar}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");const e=document.documentElement,t=document.createElement("div");t.className="-cbwsdk-css-reset",e.appendChild(t),this.snackbar.attach(t),this.attached=!0,(0,Mr.injectCssReset)()}showConnecting(e){let t;return e.isUnlinkedErrorState?t={autoExpand:!0,message:"Connection lost",menuItems:[{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]}:t={message:"Confirm on phone",menuItems:[{isRed:!0,info:"Cancel transaction",svgWidth:"11",svgHeight:"11",path:"M10.3711 1.52346L9.21775 0.370117L5.37109 4.21022L1.52444 0.370117L0.371094 1.52346L4.2112 5.37012L0.371094 9.21677L1.52444 10.3701L5.37109 6.53001L9.21775 10.3701L10.3711 9.21677L6.53099 5.37012L10.3711 1.52346Z",defaultFillRule:"inherit",defaultClipRule:"inherit",onClick:e.onCancel},{isRed:!1,info:"Reset connection",svgWidth:"10",svgHeight:"11",path:"M5.00008 0.96875C6.73133 0.96875 8.23758 1.94375 9.00008 3.375L10.0001 2.375V5.5H9.53133H7.96883H6.87508L7.80633 4.56875C7.41258 3.3875 6.31258 2.53125 5.00008 2.53125C3.76258 2.53125 2.70633 3.2875 2.25633 4.36875L0.812576 3.76875C1.50008 2.125 3.11258 0.96875 5.00008 0.96875ZM2.19375 6.43125C2.5875 7.6125 3.6875 8.46875 5 8.46875C6.2375 8.46875 7.29375 7.7125 7.74375 6.63125L9.1875 7.23125C8.5 8.875 6.8875 10.0312 5 10.0312C3.26875 10.0312 1.7625 9.05625 1 7.625L0 8.625V5.5H0.46875H2.03125H3.125L2.19375 6.43125Z",defaultFillRule:"evenodd",defaultClipRule:"evenodd",onClick:e.onResetConnection}]},this.snackbar.presentItem(t)}}De.WalletLinkRelayUI=Ar;var We={},Ue={},nt={};Object.defineProperty(nt,"__esModule",{value:!0});nt.default=".-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop{position:fixed;top:0;left:0;right:0;bottom:0;transition:opacity .25s;background-color:rgba(10,11,13,.5)}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-backdrop-hidden{opacity:0}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box{display:block;position:fixed;top:50%;left:50%;transform:translate(-50%, -50%);padding:20px;border-radius:8px;background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box p{display:block;font-weight:400;font-size:14px;line-height:20px;padding-bottom:12px;color:#5b636e}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box button{appearance:none;border:none;background:none;color:#0052ff;padding:0;text-decoration:none;display:block;font-weight:600;font-size:16px;line-height:24px}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark{background-color:#0a0b0d;color:#fff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.dark button{color:#0052ff}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light{background-color:#fff;color:#0a0b0d}.-cbwsdk-css-reset .-cbwsdk-redirect-dialog-box.light button{color:#0052ff}";var Xt=N&&N.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(Ue,"__esModule",{value:!0});Ue.RedirectDialog=void 0;const Rr=Xt(kt),D=It,xr=he,Pr=et,Nr=L,Or=Xt(nt);class Tr{constructor(){this.root=null,this.darkMode=(0,Nr.isDarkMode)()}attach(){const e=document.documentElement;this.root=document.createElement("div"),this.root.className="-cbwsdk-css-reset",e.appendChild(this.root),(0,xr.injectCssReset)()}present(e){this.render(e)}clear(){this.render(null)}render(e){this.root&&((0,D.render)(null,this.root),e&&(0,D.render)((0,D.h)(jr,Object.assign({},e,{onDismiss:()=>{this.clear()},darkMode:this.darkMode})),this.root))}}Ue.RedirectDialog=Tr;const jr=({title:n,buttonText:e,darkMode:t,onButtonClick:r,onDismiss:s})=>{const a=t?"dark":"light";return(0,D.h)(Pr.SnackbarContainer,{darkMode:t},(0,D.h)("div",{class:"-cbwsdk-redirect-dialog"},(0,D.h)("style",null,Or.default),(0,D.h)("div",{class:"-cbwsdk-redirect-dialog-backdrop",onClick:s}),(0,D.h)("div",{class:(0,Rr.default)("-cbwsdk-redirect-dialog-box",a)},(0,D.h)("p",null,n),(0,D.h)("button",{onClick:r},e))))};var B={};Object.defineProperty(B,"__esModule",{value:!0});B.CBW_MOBILE_DEEPLINK_URL=B.WALLETLINK_URL=B.CB_KEYS_URL=void 0;B.CB_KEYS_URL="https://keys.coinbase.com/connect";B.WALLETLINK_URL="https://www.walletlink.org";B.CBW_MOBILE_DEEPLINK_URL="https://go.cb-w.com/walletlink";Object.defineProperty(We,"__esModule",{value:!0});We.WLMobileRelayUI=void 0;const Dr=Ue,Wr=L,Ur=B;class Br{constructor(){this.attached=!1,this.redirectDialog=new Dr.RedirectDialog}attach(){if(this.attached)throw new Error("Coinbase Wallet SDK UI is already attached");this.redirectDialog.attach(),this.attached=!0}redirectToCoinbaseWallet(e){const t=new URL(Ur.CBW_MOBILE_DEEPLINK_URL);t.searchParams.append("redirect_url",(0,Wr.getLocation)().href),e&&t.searchParams.append("wl_url",e);const r=document.createElement("a");r.target="cbw-opener",r.href=t.href,r.rel="noreferrer noopener",r.click()}openCoinbaseWalletDeeplink(e){this.redirectDialog.present({title:"Redirecting to Coinbase Wallet...",buttonText:"Open",onButtonClick:()=>{this.redirectToCoinbaseWallet(e)}}),setTimeout(()=>{this.redirectToCoinbaseWallet(e)},99)}showConnecting(e){return()=>{this.redirectDialog.clear()}}}We.WLMobileRelayUI=Br;Object.defineProperty(Pe,"__esModule",{value:!0});Pe.WalletLinkRelay=void 0;const Hr=Ne,Kr=U,qr=ue,Ve=je,Q=se,$r=L,Fr=De,ft=We,Vr=H,v=g,zr=K;class ${constructor(e){this.accountsCallback=null,this.chainCallbackParams={chainId:"",jsonRpcUrl:""},this.chainCallback=null,this.dappDefaultChain=1,this.isMobileWeb=(0,$r.isMobileWeb)(),this.appName="",this.appLogoUrl=null,this.linkedUpdated=a=>{this.isLinked=a;const i=this.storage.getItem(Kr.LOCAL_STORAGE_ADDRESSES_KEY);if(a&&(this._session.linked=a),this.isUnlinkedErrorState=!1,i){const o=i.split(" "),c=this.storage.getItem("IsStandaloneSigning")==="true";o[0]!==""&&!a&&this._session.linked&&!c&&(this.isUnlinkedErrorState=!0)}},this.metadataUpdated=(a,i)=>{this.storage.setItem(a,i)},this.chainUpdated=(a,i)=>{this.chainCallbackParams.chainId===a&&this.chainCallbackParams.jsonRpcUrl===i||(this.chainCallbackParams={chainId:a,jsonRpcUrl:i},this.chainCallback&&this.chainCallback(a,i))},this.accountUpdated=a=>{this.accountsCallback&&this.accountsCallback([a]),$.accountRequestCallbackIds.size>0&&(Array.from($.accountRequestCallbackIds.values()).forEach(i=>{const o={type:"WEB3_RESPONSE",id:i,response:{method:"requestEthereumAccounts",result:[a]}};this.invokeCallback(Object.assign(Object.assign({},o),{id:i}))}),$.accountRequestCallbackIds.clear())},this.resetAndReload=this.resetAndReload.bind(this),this.linkAPIUrl=e.linkAPIUrl,this.storage=e.storage;const{session:t,ui:r,connection:s}=this.subscribe();this._session=t,this.connection=s,this.relayEventManager=new qr.RelayEventManager,this.ui=r}subscribe(){const e=Ve.WalletLinkSession.load(this.storage)||new Ve.WalletLinkSession(this.storage).save(),{linkAPIUrl:t}=this,r=new Hr.WalletLinkConnection({session:e,linkAPIUrl:t,listener:this}),s=this.isMobileWeb?new ft.WLMobileRelayUI:new Fr.WalletLinkRelayUI;return r.connect(),{session:e,ui:s,connection:r}}attachUI(){this.ui.attach()}resetAndReload(){Promise.race([this.connection.setSessionMetadata("__destroyed","1"),new Promise(e=>setTimeout(()=>e(null),1e3))]).then(()=>{this.connection.destroy();const e=Ve.WalletLinkSession.load(this.storage);(e==null?void 0:e.id)===this._session.id&&zr.ScopedLocalStorage.clearAll(),document.location.reload()}).catch(e=>{})}setAppInfo(e,t){this.appName=e,this.appLogoUrl=t}getStorageItem(e){return this.storage.getItem(e)}setStorageItem(e,t){this.storage.setItem(e,t)}signEthereumMessage(e,t,r,s){return this.sendRequest({method:"signEthereumMessage",params:{message:(0,v.hexStringFromBuffer)(e,!0),address:t,addPrefix:r,typedDataJson:s||null}})}ethereumAddressFromSignedMessage(e,t,r){return this.sendRequest({method:"ethereumAddressFromSignedMessage",params:{message:(0,v.hexStringFromBuffer)(e,!0),signature:(0,v.hexStringFromBuffer)(t,!0),addPrefix:r}})}signEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:(0,v.bigIntStringFromBigInt)(e.weiValue),data:(0,v.hexStringFromBuffer)(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?(0,v.bigIntStringFromBigInt)(e.gasPriceInWei):null,maxFeePerGas:e.gasPriceInWei?(0,v.bigIntStringFromBigInt)(e.gasPriceInWei):null,maxPriorityFeePerGas:e.gasPriceInWei?(0,v.bigIntStringFromBigInt)(e.gasPriceInWei):null,gasLimit:e.gasLimit?(0,v.bigIntStringFromBigInt)(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!1}})}signAndSubmitEthereumTransaction(e){return this.sendRequest({method:"signEthereumTransaction",params:{fromAddress:e.fromAddress,toAddress:e.toAddress,weiValue:(0,v.bigIntStringFromBigInt)(e.weiValue),data:(0,v.hexStringFromBuffer)(e.data,!0),nonce:e.nonce,gasPriceInWei:e.gasPriceInWei?(0,v.bigIntStringFromBigInt)(e.gasPriceInWei):null,maxFeePerGas:e.maxFeePerGas?(0,v.bigIntStringFromBigInt)(e.maxFeePerGas):null,maxPriorityFeePerGas:e.maxPriorityFeePerGas?(0,v.bigIntStringFromBigInt)(e.maxPriorityFeePerGas):null,gasLimit:e.gasLimit?(0,v.bigIntStringFromBigInt)(e.gasLimit):null,chainId:e.chainId,shouldSubmit:!0}})}submitEthereumTransaction(e,t){return this.sendRequest({method:"submitEthereumTransaction",params:{signedTransaction:(0,v.hexStringFromBuffer)(e,!0),chainId:t}})}scanQRCode(e){return this.sendRequest({method:"scanQRCode",params:{regExp:e}})}getWalletLinkSession(){return this._session}genericRequest(e,t){return this.sendRequest({method:"generic",params:{action:t,data:e}})}sendGenericMessage(e){return this.sendRequest(e)}sendRequest(e){let t=null;const r=(0,v.randomBytesHex)(8),s=a=>{this.publishWeb3RequestCanceledEvent(r),this.handleErrorResponse(r,e.method,a),t==null||t()};return new Promise((a,i)=>{t=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:s,onResetConnection:this.resetAndReload}),this.relayEventManager.callbacks.set(r,o=>{if(t==null||t(),(0,Q.isErrorResponse)(o))return i(new Error(o.errorMessage));a(o)}),this.publishWeb3RequestEvent(r,e)})}setAccountsCallback(e){this.accountsCallback=e}setChainCallback(e){this.chainCallback=e}setDappDefaultChainCallback(e){this.dappDefaultChain=e}publishWeb3RequestEvent(e,t){const r={type:"WEB3_REQUEST",id:e,request:t};this.publishEvent("Web3Request",r,!0).then(s=>{}).catch(s=>{this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:r.id,response:{method:t.method,errorMessage:s.message}})}),this.isMobileWeb&&this.openCoinbaseWalletDeeplink(t.method)}openCoinbaseWalletDeeplink(e){if(this.ui instanceof ft.WLMobileRelayUI)switch(e){case"requestEthereumAccounts":case"switchEthereumChain":return;default:window.addEventListener("blur",()=>{window.addEventListener("focus",()=>{this.connection.checkUnseenEvents()},{once:!0})},{once:!0}),this.ui.openCoinbaseWalletDeeplink();break}}publishWeb3RequestCanceledEvent(e){const t={type:"WEB3_REQUEST_CANCELED",id:e};this.publishEvent("Web3RequestCanceled",t,!1).then()}publishEvent(e,t,r){return this.connection.publishEvent(e,t,r)}handleWeb3ResponseMessage(e){const{response:t}=e;if(t.method==="requestEthereumAccounts"){$.accountRequestCallbackIds.forEach(r=>this.invokeCallback(Object.assign(Object.assign({},e),{id:r}))),$.accountRequestCallbackIds.clear();return}this.invokeCallback(e)}handleErrorResponse(e,t,r){var s;const a=(s=r==null?void 0:r.message)!==null&&s!==void 0?s:"Unspecified error message.";this.handleWeb3ResponseMessage({type:"WEB3_RESPONSE",id:e,response:{method:t,errorMessage:a}})}invokeCallback(e){const t=this.relayEventManager.callbacks.get(e.id);t&&(t(e.response),this.relayEventManager.callbacks.delete(e.id))}requestEthereumAccounts(){const e={method:"requestEthereumAccounts",params:{appName:this.appName,appLogoUrl:this.appLogoUrl||null}},t=(0,v.randomBytesHex)(8);return new Promise((r,s)=>{this.relayEventManager.callbacks.set(t,a=>{if((0,Q.isErrorResponse)(a))return s(new Error(a.errorMessage));r(a)}),$.accountRequestCallbackIds.add(t),this.publishWeb3RequestEvent(t,e)})}watchAsset(e,t,r,s,a,i){const o={method:"watchAsset",params:{type:e,options:{address:t,symbol:r,decimals:s,image:a},chainId:i}};let c=null;const d=(0,v.randomBytesHex)(8),u=h=>{this.publishWeb3RequestCanceledEvent(d),this.handleErrorResponse(d,o.method,h),c==null||c()};return c=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:u,onResetConnection:this.resetAndReload}),new Promise((h,l)=>{this.relayEventManager.callbacks.set(d,p=>{if(c==null||c(),(0,Q.isErrorResponse)(p))return l(new Error(p.errorMessage));h(p)}),this.publishWeb3RequestEvent(d,o)})}addEthereumChain(e,t,r,s,a,i){const o={method:"addEthereumChain",params:{chainId:e,rpcUrls:t,blockExplorerUrls:s,chainName:a,iconUrls:r,nativeCurrency:i}};let c=null;const d=(0,v.randomBytesHex)(8),u=h=>{this.publishWeb3RequestCanceledEvent(d),this.handleErrorResponse(d,o.method,h),c==null||c()};return c=this.ui.showConnecting({isUnlinkedErrorState:this.isUnlinkedErrorState,onCancel:u,onResetConnection:this.resetAndReload}),new Promise((h,l)=>{this.relayEventManager.callbacks.set(d,p=>{if(c==null||c(),(0,Q.isErrorResponse)(p))return l(new Error(p.errorMessage));h(p)}),this.publishWeb3RequestEvent(d,o)})}switchEthereumChain(e,t){const r={method:"switchEthereumChain",params:Object.assign({chainId:e},{address:t})},s=(0,v.randomBytesHex)(8);return new Promise((a,i)=>{this.relayEventManager.callbacks.set(s,o=>{if((0,Q.isErrorResponse)(o)&&o.errorCode)return i(Vr.standardErrors.provider.custom({code:o.errorCode,message:"Unrecognized chain ID. Try adding the chain using addEthereumChain first."}));if((0,Q.isErrorResponse)(o))return i(new Error(o.errorMessage));a(o)}),this.publishWeb3RequestEvent(s,r)})}}Pe.WalletLinkRelay=$;$.accountRequestCallbackIds=new Set;var Zr=N&&N.__importDefault||function(n){return n&&n.__esModule?n:{default:n}};Object.defineProperty(Re,"__esModule",{value:!0});Re.WalletLinkSigner=void 0;const ze=Zr(or),mt=U,Gr=ue,q=se,Yr=Pe,yt=B,S=H,y=g,Jr=K,Ze="DefaultChainId",bt="DefaultJsonRpcUrl";class Qr{constructor(e){var t,r;this._relay=null,this._addresses=[],this.hasMadeFirstChainChangedEmission=!1;const{appName:s,appLogoUrl:a}=e.metadata;this._appName=s,this._appLogoUrl=a,this._storage=new Jr.ScopedLocalStorage("walletlink",yt.WALLETLINK_URL),this.updateListener=e.updateListener,this._relayEventManager=new Gr.RelayEventManager,this._jsonRpcUrlFromOpts="";const i=this._storage.getItem(mt.LOCAL_STORAGE_ADDRESSES_KEY);if(i){const c=i.split(" ");c[0]!==""&&(this._addresses=c.map(d=>(0,y.ensureAddressString)(d)),(t=this.updateListener)===null||t===void 0||t.onAccountsUpdate({accounts:this._addresses,source:"storage"}))}this._storage.getItem(Ze)&&((r=this.updateListener)===null||r===void 0||r.onChainUpdate({chain:{id:this.getChainId(),rpcUrl:this.jsonRpcUrl},source:"storage"}),this.hasMadeFirstChainChangedEmission=!0),this.initializeRelay()}getSession(){const e=this.initializeRelay(),{id:t,secret:r}=e.getWalletLinkSession();return{id:t,secret:r}}async handshake(){return await this.request({method:"eth_requestAccounts"})}get selectedAddress(){return this._addresses[0]||void 0}get jsonRpcUrl(){var e;return(e=this._storage.getItem(bt))!==null&&e!==void 0?e:this._jsonRpcUrlFromOpts}set jsonRpcUrl(e){this._storage.setItem(bt,e)}updateProviderInfo(e,t){var r;this.jsonRpcUrl=e;const s=this.getChainId();this._storage.setItem(Ze,t.toString(10)),((0,y.ensureIntNumber)(t)!==s||!this.hasMadeFirstChainChangedEmission)&&((r=this.updateListener)===null||r===void 0||r.onChainUpdate({chain:{id:t,rpcUrl:e},source:"wallet"}),this.hasMadeFirstChainChangedEmission=!0)}async watchAsset(e,t,r,s,a,i){const c=await this.initializeRelay().watchAsset(e,t,r,s,a,i==null?void 0:i.toString());return(0,q.isErrorResponse)(c)?!1:!!c.result}async addEthereumChain(e,t,r,s,a,i){var o,c;if((0,y.ensureIntNumber)(e)===this.getChainId())return!1;const d=this.initializeRelay();this._isAuthorized()||await d.requestEthereumAccounts();const u=await d.addEthereumChain(e.toString(),t,a,r,s,i);return(0,q.isErrorResponse)(u)?!1:(((o=u.result)===null||o===void 0?void 0:o.isApproved)===!0&&this.updateProviderInfo(t[0],e),((c=u.result)===null||c===void 0?void 0:c.isApproved)===!0)}async switchEthereumChain(e){const r=await this.initializeRelay().switchEthereumChain(e.toString(10),this.selectedAddress||void 0);if((0,q.isErrorResponse)(r)){if(!r.errorCode)return;throw r.errorCode===S.standardErrorCodes.provider.unsupportedChain?S.standardErrors.provider.unsupportedChain():S.standardErrors.provider.custom({message:r.errorMessage,code:r.errorCode})}const s=r.result;s.isApproved&&s.rpcUrl.length>0&&this.updateProviderInfo(s.rpcUrl,e)}async disconnect(){this._relay&&this._relay.resetAndReload(),this._storage.clear()}async request(e){try{return this._request(e).catch(t=>{throw t})}catch(t){return Promise.reject(t)}}async _request(e){if(!e||typeof e!="object"||Array.isArray(e))throw S.standardErrors.rpc.invalidRequest({message:"Expected a single, non-array, object argument.",data:e});const{method:t,params:r}=e;if(typeof t!="string"||t.length===0)throw S.standardErrors.rpc.invalidRequest({message:"'args.method' must be a non-empty string.",data:e});if(r!==void 0&&!Array.isArray(r)&&(typeof r!="object"||r===null))throw S.standardErrors.rpc.invalidRequest({message:"'args.params' must be an object or array if provided.",data:e});const s=r===void 0?[]:r,a=this._relayEventManager.makeRequestId();return(await this._sendRequestAsync({method:t,params:s,jsonrpc:"2.0",id:a})).result}_setAddresses(e,t){var r;if(!Array.isArray(e))throw new Error("addresses is not an array");const s=e.map(a=>(0,y.ensureAddressString)(a));JSON.stringify(s)!==JSON.stringify(this._addresses)&&(this._addresses=s,(r=this.updateListener)===null||r===void 0||r.onAccountsUpdate({accounts:s,source:"wallet"}),this._storage.setItem(mt.LOCAL_STORAGE_ADDRESSES_KEY,s.join(" ")))}_sendRequestAsync(e){return new Promise((t,r)=>{try{const s=this._handleSynchronousMethods(e);if(s!==void 0)return t({jsonrpc:"2.0",id:e.id,result:s})}catch(s){return r(s)}this._handleAsynchronousMethods(e).then(s=>s&&t(Object.assign(Object.assign({},s),{id:e.id}))).catch(s=>r(s))})}_handleSynchronousMethods(e){const{method:t}=e;switch(t){case"eth_accounts":return this._eth_accounts();case"eth_coinbase":return this._eth_coinbase();case"net_version":return this._net_version();case"eth_chainId":return this._eth_chainId();default:return}}async _handleAsynchronousMethods(e){const{method:t}=e,r=e.params||[];switch(t){case"eth_requestAccounts":return this._eth_requestAccounts();case"eth_sign":return this._eth_sign(r);case"eth_ecRecover":return this._eth_ecRecover(r);case"personal_sign":return this._personal_sign(r);case"personal_ecRecover":return this._personal_ecRecover(r);case"eth_signTransaction":return this._eth_signTransaction(r);case"eth_sendRawTransaction":return this._eth_sendRawTransaction(r);case"eth_sendTransaction":return this._eth_sendTransaction(r);case"eth_signTypedData_v1":return this._eth_signTypedData_v1(r);case"eth_signTypedData_v2":return this._throwUnsupportedMethodError();case"eth_signTypedData_v3":return this._eth_signTypedData_v3(r);case"eth_signTypedData_v4":case"eth_signTypedData":return this._eth_signTypedData_v4(r);case"wallet_addEthereumChain":return this._wallet_addEthereumChain(r);case"wallet_switchEthereumChain":return this._wallet_switchEthereumChain(r);case"wallet_watchAsset":return this._wallet_watchAsset(r);default:return this._throwUnsupportedMethodError()}}_isKnownAddress(e){try{const t=(0,y.ensureAddressString)(e);return this._addresses.map(s=>(0,y.ensureAddressString)(s)).includes(t)}catch{}return!1}_ensureKnownAddress(e){if(!this._isKnownAddress(e))throw new Error("Unknown Ethereum address")}_prepareTransactionParams(e){const t=e.from?(0,y.ensureAddressString)(e.from):this.selectedAddress;if(!t)throw new Error("Ethereum address is unavailable");this._ensureKnownAddress(t);const r=e.to?(0,y.ensureAddressString)(e.to):null,s=e.value!=null?(0,y.ensureBigInt)(e.value):BigInt(0),a=e.data?(0,y.ensureBuffer)(e.data):b.alloc(0),i=e.nonce!=null?(0,y.ensureIntNumber)(e.nonce):null,o=e.gasPrice!=null?(0,y.ensureBigInt)(e.gasPrice):null,c=e.maxFeePerGas!=null?(0,y.ensureBigInt)(e.maxFeePerGas):null,d=e.maxPriorityFeePerGas!=null?(0,y.ensureBigInt)(e.maxPriorityFeePerGas):null,u=e.gas!=null?(0,y.ensureBigInt)(e.gas):null,h=e.chainId?(0,y.ensureIntNumber)(e.chainId):this.getChainId();return{fromAddress:t,toAddress:r,weiValue:s,data:a,nonce:i,gasPriceInWei:o,maxFeePerGas:c,maxPriorityFeePerGas:d,gasLimit:u,chainId:h}}_isAuthorized(){return this._addresses.length>0}_requireAuthorization(){if(!this._isAuthorized())throw S.standardErrors.provider.unauthorized({})}_throwUnsupportedMethodError(){throw S.standardErrors.provider.unsupportedMethod({})}async _signEthereumMessage(e,t,r,s){this._ensureKnownAddress(t);try{const i=await this.initializeRelay().signEthereumMessage(e,t,r,s);if((0,q.isErrorResponse)(i))throw new Error(i.errorMessage);return{jsonrpc:"2.0",id:0,result:i.result}}catch(a){throw typeof a.message=="string"&&a.message.match(/(denied|rejected)/i)?S.standardErrors.provider.userRejectedRequest("User denied message signature"):a}}async _ethereumAddressFromSignedMessage(e,t,r){const a=await this.initializeRelay().ethereumAddressFromSignedMessage(e,t,r);if((0,q.isErrorResponse)(a))throw new Error(a.errorMessage);return{jsonrpc:"2.0",id:0,result:a.result}}_eth_accounts(){return[...this._addresses]}_eth_coinbase(){return this.selectedAddress||null}_net_version(){return this.getChainId().toString(10)}_eth_chainId(){return(0,y.hexStringFromIntNumber)(this.getChainId())}getChainId(){const e=this._storage.getItem(Ze);if(!e)return(0,y.ensureIntNumber)(1);const t=parseInt(e,10);return(0,y.ensureIntNumber)(t)}async _eth_requestAccounts(){if(this._isAuthorized())return Promise.resolve({jsonrpc:"2.0",id:0,result:this._addresses});let e;try{if(e=await this.initializeRelay().requestEthereumAccounts(),(0,q.isErrorResponse)(e))throw new Error(e.errorMessage)}catch(t){throw typeof t.message=="string"&&t.message.match(/(denied|rejected)/i)?S.standardErrors.provider.userRejectedRequest("User denied account authorization"):t}if(!e.result)throw new Error("accounts received is empty");return this._setAddresses(e.result),{jsonrpc:"2.0",id:0,result:this._addresses}}_eth_sign(e){this._requireAuthorization();const t=(0,y.ensureAddressString)(e[0]),r=(0,y.ensureBuffer)(e[1]);return this._signEthereumMessage(r,t,!1)}_eth_ecRecover(e){const t=(0,y.ensureBuffer)(e[0]),r=(0,y.ensureBuffer)(e[1]);return this._ethereumAddressFromSignedMessage(t,r,!1)}_personal_sign(e){this._requireAuthorization();const t=(0,y.ensureBuffer)(e[0]),r=(0,y.ensureAddressString)(e[1]);return this._signEthereumMessage(t,r,!0)}_personal_ecRecover(e){const t=(0,y.ensureBuffer)(e[0]),r=(0,y.ensureBuffer)(e[1]);return this._ethereumAddressFromSignedMessage(t,r,!0)}async _eth_signTransaction(e){this._requireAuthorization();const t=this._prepareTransactionParams(e[0]||{});try{const s=await this.initializeRelay().signEthereumTransaction(t);if((0,q.isErrorResponse)(s))throw new Error(s.errorMessage);return{jsonrpc:"2.0",id:0,result:s.result}}catch(r){throw typeof r.message=="string"&&r.message.match(/(denied|rejected)/i)?S.standardErrors.provider.userRejectedRequest("User denied transaction signature"):r}}async _eth_sendRawTransaction(e){const t=(0,y.ensureBuffer)(e[0]),s=await this.initializeRelay().submitEthereumTransaction(t,this.getChainId());if((0,q.isErrorResponse)(s))throw new Error(s.errorMessage);return{jsonrpc:"2.0",id:0,result:s.result}}async _eth_sendTransaction(e){this._requireAuthorization();const t=this._prepareTransactionParams(e[0]||{});try{const s=await this.initializeRelay().signAndSubmitEthereumTransaction(t);if((0,q.isErrorResponse)(s))throw new Error(s.errorMessage);return{jsonrpc:"2.0",id:0,result:s.result}}catch(r){throw typeof r.message=="string"&&r.message.match(/(denied|rejected)/i)?S.standardErrors.provider.userRejectedRequest("User denied transaction signature"):r}}async _eth_signTypedData_v1(e){this._requireAuthorization();const t=(0,y.ensureParsedJSONObject)(e[0]),r=(0,y.ensureAddressString)(e[1]);this._ensureKnownAddress(r);const s=ze.default.hashForSignTypedDataLegacy({data:t}),a=JSON.stringify(t,null,2);return this._signEthereumMessage(s,r,!1,a)}async _eth_signTypedData_v3(e){this._requireAuthorization();const t=(0,y.ensureAddressString)(e[0]),r=(0,y.ensureParsedJSONObject)(e[1]);this._ensureKnownAddress(t);const s=ze.default.hashForSignTypedData_v3({data:r}),a=JSON.stringify(r,null,2);return this._signEthereumMessage(s,t,!1,a)}async _eth_signTypedData_v4(e){this._requireAuthorization();const t=(0,y.ensureAddressString)(e[0]),r=(0,y.ensureParsedJSONObject)(e[1]);this._ensureKnownAddress(t);const s=ze.default.hashForSignTypedData_v4({data:r}),a=JSON.stringify(r,null,2);return this._signEthereumMessage(s,t,!1,a)}async _wallet_addEthereumChain(e){var t,r,s,a;const i=e[0];if(((t=i.rpcUrls)===null||t===void 0?void 0:t.length)===0)return{jsonrpc:"2.0",id:0,error:{code:2,message:"please pass in at least 1 rpcUrl"}};if(!i.chainName||i.chainName.trim()==="")throw S.standardErrors.rpc.invalidParams("chainName is a required field");if(!i.nativeCurrency)throw S.standardErrors.rpc.invalidParams("nativeCurrency is a required field");const o=parseInt(i.chainId,16);return await this.addEthereumChain(o,(r=i.rpcUrls)!==null&&r!==void 0?r:[],(s=i.blockExplorerUrls)!==null&&s!==void 0?s:[],i.chainName,(a=i.iconUrls)!==null&&a!==void 0?a:[],i.nativeCurrency)?{jsonrpc:"2.0",id:0,result:null}:{jsonrpc:"2.0",id:0,error:{code:2,message:"unable to add ethereum chain"}}}async _wallet_switchEthereumChain(e){const t=e[0];return await this.switchEthereumChain(parseInt(t.chainId,16)),{jsonrpc:"2.0",id:0,result:null}}async _wallet_watchAsset(e){const t=Array.isArray(e)?e[0]:e;if(!t.type)throw S.standardErrors.rpc.invalidParams("Type is required");if((t==null?void 0:t.type)!=="ERC20")throw S.standardErrors.rpc.invalidParams(`Asset of type '${t.type}' is not supported`);if(!(t!=null&&t.options))throw S.standardErrors.rpc.invalidParams("Options are required");if(!(t!=null&&t.options.address))throw S.standardErrors.rpc.invalidParams("Address is required");const r=this.getChainId(),{address:s,symbol:a,image:i,decimals:o}=t.options;return{jsonrpc:"2.0",id:0,result:await this.watchAsset(t.type,s,a,o,i,r)}}initializeRelay(){if(!this._relay){const e=new Yr.WalletLinkRelay({linkAPIUrl:yt.WALLETLINK_URL,storage:this._storage});e.setAppInfo(this._appName,this._appLogoUrl),e.attachUI(),e.setAccountsCallback((t,r)=>this._setAddresses(t,r)),e.setChainCallback((t,r)=>{this.updateProviderInfo(r,parseInt(t,10))}),this._relay=e}return this._relay}}Re.WalletLinkSigner=Qr;var x={};Object.defineProperty(x,"__esModule",{value:!0});x.checkErrorForInvalidRequestArgs=x.getCoinbaseInjectedProvider=x.getCoinbaseInjectedSigner=x.fetchRPCRequest=void 0;const Xr=Z,ve=H;async function es(n,e){if(!e.rpcUrl)throw ve.standardErrors.rpc.internal("No RPC URL set for chain");const t=Object.assign(Object.assign({},n),{jsonrpc:"2.0",id:crypto.randomUUID()});return(await(await window.fetch(e.rpcUrl,{method:"POST",body:JSON.stringify(t),mode:"cors",headers:{"Content-Type":"application/json","X-Cbw-Sdk-Version":Xr.LIB_VERSION}})).json()).result}x.fetchRPCRequest=es;function en(){return globalThis.coinbaseWalletSigner}x.getCoinbaseInjectedSigner=en;function ts({metadata:n,preference:e}){var t,r,s;const a=globalThis;if(e.options!=="smartWalletOnly"){if(en())return;const c=a.coinbaseWalletExtension;if(c){const{appName:d,appLogoUrl:u,appChainIds:h}=n;return(t=c.setAppInfo)===null||t===void 0||t.call(c,d,u,h),c}}const i=(r=a.ethereum)!==null&&r!==void 0?r:(s=a.top)===null||s===void 0?void 0:s.ethereum;if(i!=null&&i.isCoinbaseBrowser)return i}x.getCoinbaseInjectedProvider=ts;function ns(n){if(!n||typeof n!="object"||Array.isArray(n))return ve.standardErrors.rpc.invalidParams({message:"Expected a single, non-array, object argument.",data:n});const{method:e,params:t}=n;if(typeof e!="string"||e.length===0)return ve.standardErrors.rpc.invalidParams({message:"'args.method' must be a non-empty string.",data:n});if(t!==void 0&&!Array.isArray(t)&&(typeof t!="object"||t===null))return ve.standardErrors.rpc.invalidParams({message:"'args.params' must be an object or array if provided.",data:n})}x.checkErrorForInvalidRequestArgs=ns;Object.defineProperty(W,"__esModule",{value:!0});W.createSigner=W.fetchSignerType=W.storeSignerType=W.loadSignerType=void 0;const rs=Me,tn=Re,ss=H,is=x,as=K,nn="SignerType",rn=new as.ScopedLocalStorage("CBWSDK","SignerConfigurator");function os(){return rn.getItem(nn)}W.loadSignerType=os;function cs(n){rn.setItem(nn,n)}W.storeSignerType=cs;async function ds(n){const{communicator:e,metadata:t}=n;us(e,t).catch(()=>{});const r={id:crypto.randomUUID(),event:"selectSignerType",data:n.preference},{data:s}=await e.postRequestAndWaitForResponse(r);return s}W.fetchSignerType=ds;function ls(n){const{signerType:e,metadata:t,communicator:r,updateListener:s}=n;switch(e){case"scw":return new rs.SCWSigner({metadata:t,updateListener:s,communicator:r});case"walletlink":return new tn.WalletLinkSigner({metadata:t,updateListener:s});case"extension":{const a=(0,is.getCoinbaseInjectedSigner)();if(!a)throw ss.standardErrors.rpc.internal("injected signer not found");return a}}}W.createSigner=ls;async function us(n,e){await n.onMessage(({event:r})=>r==="WalletLinkSessionRequest");const t=new tn.WalletLinkSigner({metadata:e});n.postMessage({event:"WalletLinkUpdate",data:{session:t.getSession()}}),await t.handshake(),n.postMessage({event:"WalletLinkUpdate",data:{connected:!0}})}var Be={},re={};Object.defineProperty(re,"__esModule",{value:!0});re.closePopup=re.openPopup=void 0;const hs=H,wt=420,vt=540;function gs(n){const e=(window.innerWidth-wt)/2+window.screenX,t=(window.innerHeight-vt)/2+window.screenY,r=window.open(n,"Smart Wallet",`width=${wt}, height=${vt}, left=${e}, top=${t}`);if(r==null||r.focus(),!r)throw hs.standardErrors.rpc.internal("Pop up window failed to open");return r}re.openPopup=gs;function ps(n){n&&!n.closed&&n.close()}re.closePopup=ps;Object.defineProperty(Be,"__esModule",{value:!0});Be.Communicator=void 0;const fs=Z,_t=re,ms=B,Et=H;class ys{constructor(e=ms.CB_KEYS_URL){this.popup=null,this.listeners=new Map,this.postMessage=async t=>{(await this.waitForPopupLoaded()).postMessage(t,this.url.origin)},this.postRequestAndWaitForResponse=async t=>{const r=this.onMessage(({requestId:s})=>s===t.id);return this.postMessage(t),await r},this.onMessage=async t=>new Promise((r,s)=>{const a=i=>{if(i.origin!==this.url.origin)return;const o=i.data;t(o)&&(r(o),window.removeEventListener("message",a),this.listeners.delete(a))};window.addEventListener("message",a),this.listeners.set(a,{reject:s})}),this.disconnect=()=>{(0,_t.closePopup)(this.popup),this.popup=null,this.listeners.forEach(({reject:t},r)=>{t(Et.standardErrors.provider.userRejectedRequest("Request rejected")),window.removeEventListener("message",r)}),this.listeners.clear()},this.waitForPopupLoaded=async()=>this.popup&&!this.popup.closed?this.popup:(this.popup=(0,_t.openPopup)(this.url),this.onMessage(({event:t})=>t==="PopupUnload").then(this.disconnect).catch(()=>{}),this.onMessage(({event:t})=>t==="PopupLoaded").then(t=>{this.postMessage({requestId:t.id,data:{version:fs.LIB_VERSION}})}).then(()=>{if(!this.popup)throw Et.standardErrors.rpc.internal();return this.popup})),this.url=new URL(e)}}Be.Communicator=ys;var He={};Object.defineProperty(He,"__esModule",{value:!0});He.determineMethodCategory=void 0;const St={handshake:["eth_requestAccounts"],sign:["eth_ecRecover","personal_sign","personal_ecRecover","eth_signTransaction","eth_sendTransaction","eth_signTypedData_v1","eth_signTypedData_v3","eth_signTypedData_v4","eth_signTypedData","wallet_addEthereumChain","wallet_switchEthereumChain","wallet_watchAsset","wallet_getCapabilities","wallet_sendCalls","wallet_showCallsStatus"],state:["eth_chainId","eth_accounts","eth_coinbase","net_version"],deprecated:["eth_sign","eth_signTypedData_v2"],unsupported:["eth_subscribe","eth_unsubscribe"],fetch:[]};function bs(n){for(const e in St){const t=e;if(St[t].includes(n))return t}}He.determineMethodCategory=bs;var ws=N&&N.__rest||function(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var s=0,r=Object.getOwnPropertySymbols(n);s{try{if(this.connected)return this.emit("connect",{chainId:(0,ie.hexStringFromIntNumber)((0,be.IntNumber)(this.chain.id))}),this.accounts;const u=await this.requestSignerSelection(),h=this.initSigner(u),l=await h.handshake();return this.signer=h,(0,we.storeSignerType)(u),this.emit("connect",{chainId:(0,ie.hexStringFromIntNumber)((0,be.IntNumber)(this.chain.id))}),l}catch(u){throw this.handleUnauthorizedError(u),u}},sign:async d=>{if(!this.connected||!this.signer)throw X.standardErrors.provider.unauthorized("Must call 'eth_requestAccounts' before other methods");try{return await this.signer.request(d)}catch(u){throw this.handleUnauthorizedError(u),u}},fetch:d=>(0,Ct.fetchRPCRequest)(d,this.chain),state:d=>{const u=()=>{if(this.connected)return this.accounts;throw X.standardErrors.provider.unauthorized("Must call 'eth_requestAccounts' before other methods")};switch(d.method){case"eth_chainId":return(0,ie.hexStringFromIntNumber)((0,be.IntNumber)(this.chain.id));case"net_version":return this.chain.id;case"eth_accounts":return u();case"eth_coinbase":return u()[0];default:return this.handlers.unsupported(d)}},deprecated:({method:d})=>{throw X.standardErrors.rpc.methodNotSupported(`Method ${d} is deprecated.`)},unsupported:({method:d})=>{throw X.standardErrors.rpc.methodNotSupported(`Method ${d} is not supported.`)}},this.isCoinbaseWallet=!0,this.updateListener={onAccountsUpdate:({accounts:d,source:u})=>{(0,ie.areAddressArraysEqual)(this.accounts,d)||(this.accounts=d,u!=="storage"&&this.emit("accountsChanged",this.accounts))},onChainUpdate:({chain:d,source:u})=>{d.id===this.chain.id&&d.rpcUrl===this.chain.rpcUrl||(this.chain=d,u!=="storage"&&this.emit("chainChanged",(0,ie.hexStringFromIntNumber)((0,be.IntNumber)(d.id))))}},this.metadata=s,this.preference=o,this.communicator=new Ss.Communicator(i),this.chain={id:(r=(t=s.appChainIds)===null||t===void 0?void 0:t[0])!==null&&r!==void 0?r:1};const c=(0,we.loadSignerType)();this.signer=c?this.initSigner(c):null}get connected(){return this.accounts.length>0}async request(e){var t;try{const r=(0,Ct.checkErrorForInvalidRequestArgs)(e);if(r)throw r;const s=(t=(0,Cs.determineMethodCategory)(e.method))!==null&&t!==void 0?t:"fetch";return this.handlers[s](e)}catch(r){return Promise.reject((0,Es.serializeError)(r,e.method))}}handleUnauthorizedError(e){e.code===X.standardErrorCodes.provider.unauthorized&&this.disconnect()}async enable(){return console.warn('.enable() has been deprecated. Please use .request({ method: "eth_requestAccounts" }) instead.'),await this.request({method:"eth_requestAccounts"})}async disconnect(){this.accounts=[],this.chain={id:1},ks.ScopedLocalStorage.clearAll(),this.emit("disconnect",X.standardErrors.provider.disconnected("User initiated disconnection"))}requestSignerSelection(){return(0,we.fetchSignerType)({communicator:this.communicator,preference:this.preference,metadata:this.metadata})}initSigner(e){return(0,we.createSigner)({signerType:e,metadata:this.metadata,communicator:this.communicator,updateListener:this.updateListener})}}Se.CoinbaseWalletProvider=Is;Object.defineProperty(oe,"__esModule",{value:!0});oe.CoinbaseWalletSDK=void 0;const Ms=Ee,Ls=Se,As=K,Rs=Z,xs=g,Ps=x;class Ns{constructor(e){this.metadata={appName:e.appName||"Dapp",appLogoUrl:e.appLogoUrl||(0,xs.getFavicon)(),appChainIds:e.appChainIds||[]},this.storeLatestVersion()}makeWeb3Provider(e={options:"all"}){var t;const r={metadata:this.metadata,preference:e};return(t=(0,Ps.getCoinbaseInjectedProvider)(r))!==null&&t!==void 0?t:new Ls.CoinbaseWalletProvider(r)}getCoinbaseWalletLogo(e,t=240){return(0,Ms.walletLogo)(e,t)}storeLatestVersion(){new As.ScopedLocalStorage("CBWSDK").setItem("VERSION",Rs.LIB_VERSION)}}oe.CoinbaseWalletSDK=Ns;(function(n){Object.defineProperty(n,"__esModule",{value:!0}),n.CoinbaseWalletSDK=void 0;const e=oe;n.default=e.CoinbaseWalletSDK;var t=oe;Object.defineProperty(n,"CoinbaseWalletSDK",{enumerable:!0,get:function(){return t.CoinbaseWalletSDK}})})(Ge);const Os=sn(Ge),Ws=dn({__proto__:null,default:Os},[Ge]);export{Ws as i}; diff --git a/kinode/packages/app_store/pkg/ui/assets/index-u1isGxGg.js b/kinode/packages/app_store/pkg/ui/assets/index-u1isGxGg.js deleted file mode 100644 index b008fffa..00000000 --- a/kinode/packages/app_store/pkg/ui/assets/index-u1isGxGg.js +++ /dev/null @@ -1,7 +0,0 @@ -import{_ as fe}from"./index-9L6Bkx0q.js";const me=Symbol(),ee=Object.getPrototypeOf,G=new WeakMap,ge=e=>e&&(G.has(e)?G.get(e):ee(e)===Object.prototype||ee(e)===Array.prototype),he=e=>ge(e)&&e[me]||null,te=(e,t=!0)=>{G.set(e,t)};var z={BASE_URL:"/main:app_store:sys",MODE:"production",DEV:!1,PROD:!0,SSR:!1};const q=e=>typeof e=="object"&&e!==null,A=new WeakMap,x=new WeakSet,be=(e=Object.is,t=(n,h)=>new Proxy(n,h),s=n=>q(n)&&!x.has(n)&&(Array.isArray(n)||!(Symbol.iterator in n))&&!(n instanceof WeakMap)&&!(n instanceof WeakSet)&&!(n instanceof Error)&&!(n instanceof Number)&&!(n instanceof Date)&&!(n instanceof String)&&!(n instanceof RegExp)&&!(n instanceof ArrayBuffer),r=n=>{switch(n.status){case"fulfilled":return n.value;case"rejected":throw n.reason;default:throw n}},l=new WeakMap,c=(n,h,I=r)=>{const y=l.get(n);if((y==null?void 0:y[0])===h)return y[1];const v=Array.isArray(n)?[]:Object.create(Object.getPrototypeOf(n));return te(v,!0),l.set(n,[h,v]),Reflect.ownKeys(n).forEach(S=>{if(Object.getOwnPropertyDescriptor(v,S))return;const E=Reflect.get(n,S),M={value:E,enumerable:!0,configurable:!0};if(x.has(E))te(E,!1);else if(E instanceof Promise)delete M.value,M.get=()=>I(E);else if(A.has(E)){const[b,H]=A.get(E);M.value=c(b,H(),I)}Object.defineProperty(v,S,M)}),Object.preventExtensions(v)},m=new WeakMap,f=[1,1],W=n=>{if(!q(n))throw new Error("object required");const h=m.get(n);if(h)return h;let I=f[0];const y=new Set,v=(a,i=++f[0])=>{I!==i&&(I=i,y.forEach(o=>o(a,i)))};let S=f[1];const E=(a=++f[1])=>(S!==a&&!y.size&&(S=a,b.forEach(([i])=>{const o=i[1](a);o>I&&(I=o)})),I),M=a=>(i,o)=>{const g=[...i];g[1]=[a,...g[1]],v(g,o)},b=new Map,H=(a,i)=>{if((z?"production":void 0)!=="production"&&b.has(a))throw new Error("prop listener already exists");if(y.size){const o=i[3](M(a));b.set(a,[i,o])}else b.set(a,[i])},Z=a=>{var i;const o=b.get(a);o&&(b.delete(a),(i=o[1])==null||i.call(o))},ue=a=>(y.add(a),y.size===1&&b.forEach(([o,g],_)=>{if((z?"production":void 0)!=="production"&&g)throw new Error("remove already exists");const R=o[3](M(_));b.set(_,[o,R])}),()=>{y.delete(a),y.size===0&&b.forEach(([o,g],_)=>{g&&(g(),b.set(_,[o]))})}),J=Array.isArray(n)?[]:Object.create(Object.getPrototypeOf(n)),$=t(J,{deleteProperty(a,i){const o=Reflect.get(a,i);Z(i);const g=Reflect.deleteProperty(a,i);return g&&v(["delete",[i],o]),g},set(a,i,o,g){const _=Reflect.has(a,i),R=Reflect.get(a,i,g);if(_&&(e(R,o)||m.has(o)&&e(R,m.get(o))))return!0;Z(i),q(o)&&(o=he(o)||o);let V=o;if(o instanceof Promise)o.then(C=>{o.status="fulfilled",o.value=C,v(["resolve",[i],C])}).catch(C=>{o.status="rejected",o.reason=C,v(["reject",[i],C])});else{!A.has(o)&&s(o)&&(V=W(o));const C=!x.has(V)&&A.get(V);C&&H(i,C)}return Reflect.set(a,i,V,g),v(["set",[i],o,R]),!0}});m.set(n,$);const pe=[J,E,c,ue];return A.set($,pe),Reflect.ownKeys(n).forEach(a=>{const i=Object.getOwnPropertyDescriptor(n,a);"value"in i&&($[a]=n[a],delete i.value,delete i.writable),Object.defineProperty(J,a,i)}),$})=>[W,A,x,e,t,s,r,l,c,m,f],[ye]=be();function j(e={}){return ye(e)}function P(e,t,s){const r=A.get(e);(z?"production":void 0)!=="production"&&!r&&console.warn("Please use proxy object");let l;const c=[],m=r[3];let f=!1;const n=m(h=>{if(c.push(h),s){t(c.splice(0));return}l||(l=Promise.resolve().then(()=>{l=void 0,f&&t(c.splice(0))}))});return f=!0,()=>{f=!1,n()}}function ve(e,t){const s=A.get(e);(z?"production":void 0)!=="production"&&!s&&console.warn("Please use proxy object");const[r,l,c]=s;return c(r,l(),t)}const d=j({history:["ConnectWallet"],view:"ConnectWallet",data:void 0}),de={state:d,subscribe(e){return P(d,()=>e(d))},push(e,t){e!==d.view&&(d.view=e,t&&(d.data=t),d.history.push(e))},reset(e){d.view=e,d.history=[e]},replace(e){d.history.length>1&&(d.history[d.history.length-1]=e,d.view=e)},goBack(){if(d.history.length>1){d.history.pop();const[e]=d.history.slice(-1);d.view=e}},setData(e){d.data=e}},p={WALLETCONNECT_DEEPLINK_CHOICE:"WALLETCONNECT_DEEPLINK_CHOICE",WCM_VERSION:"WCM_VERSION",RECOMMENDED_WALLET_AMOUNT:9,isMobile(){return typeof window<"u"?!!(window.matchMedia("(pointer:coarse)").matches||/Android|webOS|iPhone|iPad|iPod|BlackBerry|Opera Mini/u.test(navigator.userAgent)):!1},isAndroid(){return p.isMobile()&&navigator.userAgent.toLowerCase().includes("android")},isIos(){const e=navigator.userAgent.toLowerCase();return p.isMobile()&&(e.includes("iphone")||e.includes("ipad"))},isHttpUrl(e){return e.startsWith("http://")||e.startsWith("https://")},isArray(e){return Array.isArray(e)&&e.length>0},formatNativeUrl(e,t,s){if(p.isHttpUrl(e))return this.formatUniversalUrl(e,t,s);let r=e;r.includes("://")||(r=e.replaceAll("/","").replaceAll(":",""),r=`${r}://`),r.endsWith("/")||(r=`${r}/`),this.setWalletConnectDeepLink(r,s);const l=encodeURIComponent(t);return`${r}wc?uri=${l}`},formatUniversalUrl(e,t,s){if(!p.isHttpUrl(e))return this.formatNativeUrl(e,t,s);let r=e;r.endsWith("/")||(r=`${r}/`),this.setWalletConnectDeepLink(r,s);const l=encodeURIComponent(t);return`${r}wc?uri=${l}`},async wait(e){return new Promise(t=>{setTimeout(t,e)})},openHref(e,t){window.open(e,t,"noreferrer noopener")},setWalletConnectDeepLink(e,t){try{localStorage.setItem(p.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:e,name:t}))}catch{console.info("Unable to set WalletConnect deep link")}},setWalletConnectAndroidDeepLink(e){try{const[t]=e.split("?");localStorage.setItem(p.WALLETCONNECT_DEEPLINK_CHOICE,JSON.stringify({href:t,name:"Android"}))}catch{console.info("Unable to set WalletConnect android deep link")}},removeWalletConnectDeepLink(){try{localStorage.removeItem(p.WALLETCONNECT_DEEPLINK_CHOICE)}catch{console.info("Unable to remove WalletConnect deep link")}},setModalVersionInStorage(){try{typeof localStorage<"u"&&localStorage.setItem(p.WCM_VERSION,"2.6.2")}catch{console.info("Unable to set Web3Modal version in storage")}},getWalletRouterData(){var e;const t=(e=de.state.data)==null?void 0:e.Wallet;if(!t)throw new Error('Missing "Wallet" view data');return t}},we=typeof location<"u"&&(location.hostname.includes("localhost")||location.protocol.includes("https")),u=j({enabled:we,userSessionId:"",events:[],connectedWalletId:void 0}),Ie={state:u,subscribe(e){return P(u.events,()=>e(ve(u.events[u.events.length-1])))},initialize(){u.enabled&&typeof(crypto==null?void 0:crypto.randomUUID)<"u"&&(u.userSessionId=crypto.randomUUID())},setConnectedWalletId(e){u.connectedWalletId=e},click(e){if(u.enabled){const t={type:"CLICK",name:e.name,userSessionId:u.userSessionId,timestamp:Date.now(),data:e};u.events.push(t)}},track(e){if(u.enabled){const t={type:"TRACK",name:e.name,userSessionId:u.userSessionId,timestamp:Date.now(),data:e};u.events.push(t)}},view(e){if(u.enabled){const t={type:"VIEW",name:e.name,userSessionId:u.userSessionId,timestamp:Date.now(),data:e};u.events.push(t)}}},L=j({chains:void 0,walletConnectUri:void 0,isAuth:!1,isCustomDesktop:!1,isCustomMobile:!1,isDataLoaded:!1,isUiLoaded:!1}),w={state:L,subscribe(e){return P(L,()=>e(L))},setChains(e){L.chains=e},setWalletConnectUri(e){L.walletConnectUri=e},setIsCustomDesktop(e){L.isCustomDesktop=e},setIsCustomMobile(e){L.isCustomMobile=e},setIsDataLoaded(e){L.isDataLoaded=e},setIsUiLoaded(e){L.isUiLoaded=e},setIsAuth(e){L.isAuth=e}},B=j({projectId:"",mobileWallets:void 0,desktopWallets:void 0,walletImages:void 0,chains:void 0,enableAuthMode:!1,enableExplorer:!0,explorerExcludedWalletIds:void 0,explorerRecommendedWalletIds:void 0,termsOfServiceUrl:void 0,privacyPolicyUrl:void 0}),N={state:B,subscribe(e){return P(B,()=>e(B))},setConfig(e){var t,s;Ie.initialize(),w.setChains(e.chains),w.setIsAuth(!!e.enableAuthMode),w.setIsCustomMobile(!!((t=e.mobileWallets)!=null&&t.length)),w.setIsCustomDesktop(!!((s=e.desktopWallets)!=null&&s.length)),p.setModalVersionInStorage(),Object.assign(B,e)}};var Le=Object.defineProperty,se=Object.getOwnPropertySymbols,Oe=Object.prototype.hasOwnProperty,Ee=Object.prototype.propertyIsEnumerable,ne=(e,t,s)=>t in e?Le(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,We=(e,t)=>{for(var s in t||(t={}))Oe.call(t,s)&&ne(e,s,t[s]);if(se)for(var s of se(t))Ee.call(t,s)&&ne(e,s,t[s]);return e};const Q="https://explorer-api.walletconnect.com",X="wcm",Y="js-2.6.2";async function K(e,t){const s=We({sdkType:X,sdkVersion:Y},t),r=new URL(e,Q);return r.searchParams.append("projectId",N.state.projectId),Object.entries(s).forEach(([l,c])=>{c&&r.searchParams.append(l,String(c))}),(await fetch(r)).json()}const U={async getDesktopListings(e){return K("/w3m/v1/getDesktopListings",e)},async getMobileListings(e){return K("/w3m/v1/getMobileListings",e)},async getInjectedListings(e){return K("/w3m/v1/getInjectedListings",e)},async getAllListings(e){return K("/w3m/v1/getAllListings",e)},getWalletImageUrl(e){return`${Q}/w3m/v1/getWalletImage/${e}?projectId=${N.state.projectId}&sdkType=${X}&sdkVersion=${Y}`},getAssetImageUrl(e){return`${Q}/w3m/v1/getAssetImage/${e}?projectId=${N.state.projectId}&sdkType=${X}&sdkVersion=${Y}`}};var Ce=Object.defineProperty,oe=Object.getOwnPropertySymbols,Ae=Object.prototype.hasOwnProperty,je=Object.prototype.propertyIsEnumerable,re=(e,t,s)=>t in e?Ce(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Me=(e,t)=>{for(var s in t||(t={}))Ae.call(t,s)&&re(e,s,t[s]);if(oe)for(var s of oe(t))je.call(t,s)&&re(e,s,t[s]);return e};const ie=p.isMobile(),O=j({wallets:{listings:[],total:0,page:1},search:{listings:[],total:0,page:1},recomendedWallets:[]}),Te={state:O,async getRecomendedWallets(){const{explorerRecommendedWalletIds:e,explorerExcludedWalletIds:t}=N.state;if(e==="NONE"||t==="ALL"&&!e)return O.recomendedWallets;if(p.isArray(e)){const s={recommendedIds:e.join(",")},{listings:r}=await U.getAllListings(s),l=Object.values(r);l.sort((c,m)=>{const f=e.indexOf(c.id),W=e.indexOf(m.id);return f-W}),O.recomendedWallets=l}else{const{chains:s,isAuth:r}=w.state,l=s==null?void 0:s.join(","),c=p.isArray(t),m={page:1,sdks:r?"auth_v1":void 0,entries:p.RECOMMENDED_WALLET_AMOUNT,chains:l,version:2,excludedIds:c?t.join(","):void 0},{listings:f}=ie?await U.getMobileListings(m):await U.getDesktopListings(m);O.recomendedWallets=Object.values(f)}return O.recomendedWallets},async getWallets(e){const t=Me({},e),{explorerRecommendedWalletIds:s,explorerExcludedWalletIds:r}=N.state,{recomendedWallets:l}=O;if(r==="ALL")return O.wallets;l.length?t.excludedIds=l.map(I=>I.id).join(","):p.isArray(s)&&(t.excludedIds=s.join(",")),p.isArray(r)&&(t.excludedIds=[t.excludedIds,r].filter(Boolean).join(",")),w.state.isAuth&&(t.sdks="auth_v1");const{page:c,search:m}=e,{listings:f,total:W}=ie?await U.getMobileListings(t):await U.getDesktopListings(t),n=Object.values(f),h=m?"search":"wallets";return O[h]={listings:[...O[h].listings,...n],total:W,page:c??1},{listings:n,total:W}},getWalletImageUrl(e){return U.getWalletImageUrl(e)},getAssetImageUrl(e){return U.getAssetImageUrl(e)},resetSearch(){O.search={listings:[],total:0,page:1}}},k=j({open:!1}),F={state:k,subscribe(e){return P(k,()=>e(k))},async open(e){return new Promise(t=>{const{isUiLoaded:s,isDataLoaded:r}=w.state;if(p.removeWalletConnectDeepLink(),w.setWalletConnectUri(e==null?void 0:e.uri),w.setChains(e==null?void 0:e.chains),de.reset("ConnectWallet"),s&&r)k.open=!0,t();else{const l=setInterval(()=>{const c=w.state;c.isUiLoaded&&c.isDataLoaded&&(clearInterval(l),k.open=!0,t())},200)}})},close(){k.open=!1}};var Ue=Object.defineProperty,ae=Object.getOwnPropertySymbols,De=Object.prototype.hasOwnProperty,Pe=Object.prototype.propertyIsEnumerable,le=(e,t,s)=>t in e?Ue(e,t,{enumerable:!0,configurable:!0,writable:!0,value:s}):e[t]=s,Se=(e,t)=>{for(var s in t||(t={}))De.call(t,s)&&le(e,s,t[s]);if(ae)for(var s of ae(t))Pe.call(t,s)&&le(e,s,t[s]);return e};function _e(){return typeof matchMedia<"u"&&matchMedia("(prefers-color-scheme: dark)").matches}const T=j({themeMode:_e()?"dark":"light"}),ce={state:T,subscribe(e){return P(T,()=>e(T))},setThemeConfig(e){const{themeMode:t,themeVariables:s}=e;t&&(T.themeMode=t),s&&(T.themeVariables=Se({},s))}},D=j({open:!1,message:"",variant:"success"}),$e={state:D,subscribe(e){return P(D,()=>e(D))},openToast(e,t){D.open=!0,D.message=e,D.variant=t},closeToast(){D.open=!1}};class ke{constructor(t){this.openModal=F.open,this.closeModal=F.close,this.subscribeModal=F.subscribe,this.setTheme=ce.setThemeConfig,ce.setThemeConfig(t),N.setConfig(t),this.initUi()}async initUi(){if(typeof window<"u"){await fe(()=>import("./index-bjPUX0JA.js"),__vite__mapDeps([0,1,2]));const t=document.createElement("wcm-modal");document.body.insertAdjacentElement("beforeend",t),w.setIsUiLoaded(!0)}}}const Ve=Object.freeze(Object.defineProperty({__proto__:null,WalletConnectModal:ke},Symbol.toStringTag,{value:"Module"}));export{Ie as R,de as T,p as a,Ve as i,ce as n,$e as o,w as p,F as s,Te as t,N as y}; -function __vite__mapDeps(indexes) { - if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["assets/index-bjPUX0JA.js","assets/index-9L6Bkx0q.js","assets/index-bN28jcF1.css"] - } - return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) -} diff --git a/kinode/packages/app_store/pkg/ui/assets/index.es-Yrb0qG1G.js b/kinode/packages/app_store/pkg/ui/assets/index.es-Yrb0qG1G.js deleted file mode 100644 index a5efc860..00000000 --- a/kinode/packages/app_store/pkg/ui/assets/index.es-Yrb0qG1G.js +++ /dev/null @@ -1,68 +0,0 @@ -import{p as process$1,j as getAugmentedNamespace,c as commonjsGlobal,h as Buffer,k as getDefaultExportFromCjs,_ as __vitePreload}from"./index-9L6Bkx0q.js";import{g as safeBufferExports,f as eventsExports,a as require_stream_readable$1,b as require_stream_writable$1,c as require_stream_duplex$1,_ as _stream_transform$1,d as _stream_passthrough$1,e as endOfStream,p as pipeline_1,i as inherits_browserExports,r as require$$0$3,h as requireString_decoder,s as sha_jsExports,u as util$1,j as browser$e,W as Wg}from"./index-GWVzNPug.js";import{b as bnExports}from"./bn-6njz35pn.js";const global=globalThis||void 0||self;var __spreadArray=function(G,e,H){if(H||arguments.length===2)for(var Y=0,Ne=e.length,W;Y"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new ReactNativeInfo:typeof navigator<"u"?parseUserAgent(navigator.userAgent):getNodeVersion()}function matchUserAgent(G){return G!==""&&userAgentRules.reduce(function(e,H){var Y=H[0],Ne=H[1];if(e)return e;var W=Ne.exec(G);return!!W&&[Y,W]},!1)}function parseUserAgent(G){var e=matchUserAgent(G);if(!e)return null;var H=e[0],Y=e[1];if(H==="searchbot")return new BotInfo;var Ne=Y[1]&&Y[1].split(".").join("_").split("_").slice(0,3);Ne?Ne.length=0;si--)(ri=G[si])&&(W=(Ne<3?ri(W):Ne>3?ri(e,H,W):ri(e,H))||W);return Ne>3&&W&&Object.defineProperty(e,H,W),W}function __param(G,e){return function(H,Y){e(H,Y,G)}}function __metadata(G,e){if(typeof Reflect=="object"&&typeof Reflect.metadata=="function")return Reflect.metadata(G,e)}function __awaiter(G,e,H,Y){function Ne(W){return W instanceof H?W:new H(function(ri){ri(W)})}return new(H||(H=Promise))(function(W,ri){function si(ti){try{ai(Y.next(ti))}catch(hi){ri(hi)}}function fi(ti){try{ai(Y.throw(ti))}catch(hi){ri(hi)}}function ai(ti){ti.done?W(ti.value):Ne(ti.value).then(si,fi)}ai((Y=Y.apply(G,e||[])).next())})}function __generator(G,e){var H={label:0,sent:function(){if(W[0]&1)throw W[1];return W[1]},trys:[],ops:[]},Y,Ne,W,ri;return ri={next:si(0),throw:si(1),return:si(2)},typeof Symbol=="function"&&(ri[Symbol.iterator]=function(){return this}),ri;function si(ai){return function(ti){return fi([ai,ti])}}function fi(ai){if(Y)throw new TypeError("Generator is already executing.");for(;H;)try{if(Y=1,Ne&&(W=ai[0]&2?Ne.return:ai[0]?Ne.throw||((W=Ne.return)&&W.call(Ne),0):Ne.next)&&!(W=W.call(Ne,ai[1])).done)return W;switch(Ne=0,W&&(ai=[ai[0]&2,W.value]),ai[0]){case 0:case 1:W=ai;break;case 4:return H.label++,{value:ai[1],done:!1};case 5:H.label++,Ne=ai[1],ai=[0];continue;case 7:ai=H.ops.pop(),H.trys.pop();continue;default:if(W=H.trys,!(W=W.length>0&&W[W.length-1])&&(ai[0]===6||ai[0]===2)){H=0;continue}if(ai[0]===3&&(!W||ai[1]>W[0]&&ai[1]=G.length&&(G=void 0),{value:G&&G[Y++],done:!G}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")}function __read(G,e){var H=typeof Symbol=="function"&&G[Symbol.iterator];if(!H)return G;var Y=H.call(G),Ne,W=[],ri;try{for(;(e===void 0||e-- >0)&&!(Ne=Y.next()).done;)W.push(Ne.value)}catch(si){ri={error:si}}finally{try{Ne&&!Ne.done&&(H=Y.return)&&H.call(Y)}finally{if(ri)throw ri.error}}return W}function __spread(){for(var G=[],e=0;e1||si(ci,ui)})})}function si(ci,ui){try{fi(Y[ci](ui))}catch(li){hi(W[0][3],li)}}function fi(ci){ci.value instanceof __await?Promise.resolve(ci.value.v).then(ai,ti):hi(W[0][2],ci)}function ai(ci){si("next",ci)}function ti(ci){si("throw",ci)}function hi(ci,ui){ci(ui),W.shift(),W.length&&si(W[0][0],W[0][1])}}function __asyncDelegator(G){var e,H;return e={},Y("next"),Y("throw",function(Ne){throw Ne}),Y("return"),e[Symbol.iterator]=function(){return this},e;function Y(Ne,W){e[Ne]=G[Ne]?function(ri){return(H=!H)?{value:__await(G[Ne](ri)),done:Ne==="return"}:W?W(ri):ri}:W}}function __asyncValues(G){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var e=G[Symbol.asyncIterator],H;return e?e.call(G):(G=typeof __values=="function"?__values(G):G[Symbol.iterator](),H={},Y("next"),Y("throw"),Y("return"),H[Symbol.asyncIterator]=function(){return this},H);function Y(W){H[W]=G[W]&&function(ri){return new Promise(function(si,fi){ri=G[W](ri),Ne(si,fi,ri.done,ri.value)})}}function Ne(W,ri,si,fi){Promise.resolve(fi).then(function(ai){W({value:ai,done:si})},ri)}}function __makeTemplateObject(G,e){return Object.defineProperty?Object.defineProperty(G,"raw",{value:e}):G.raw=e,G}function __importStar(G){if(G&&G.__esModule)return G;var e={};if(G!=null)for(var H in G)Object.hasOwnProperty.call(G,H)&&(e[H]=G[H]);return e.default=G,e}function __importDefault(G){return G&&G.__esModule?G:{default:G}}function __classPrivateFieldGet(G,e){if(!e.has(G))throw new TypeError("attempted to get private field on non-instance");return e.get(G)}function __classPrivateFieldSet(G,e,H){if(!e.has(G))throw new TypeError("attempted to set private field on non-instance");return e.set(G,H),H}const tslib_es6=Object.freeze(Object.defineProperty({__proto__:null,get __assign(){return __assign},__asyncDelegator,__asyncGenerator,__asyncValues,__await,__awaiter,__classPrivateFieldGet,__classPrivateFieldSet,__createBinding,__decorate,__exportStar,__extends,__generator,__importDefault,__importStar,__makeTemplateObject,__metadata,__param,__read,__rest,__spread,__spreadArrays,__values},Symbol.toStringTag,{value:"Module"})),require$$0$2=getAugmentedNamespace(tslib_es6);var utils$4={},delay={},hasRequiredDelay;function requireDelay(){if(hasRequiredDelay)return delay;hasRequiredDelay=1,Object.defineProperty(delay,"__esModule",{value:!0}),delay.delay=void 0;function G(e){return new Promise(H=>{setTimeout(()=>{H(!0)},e)})}return delay.delay=G,delay}var convert={},constants$1={},misc={},hasRequiredMisc;function requireMisc(){return hasRequiredMisc||(hasRequiredMisc=1,Object.defineProperty(misc,"__esModule",{value:!0}),misc.ONE_THOUSAND=misc.ONE_HUNDRED=void 0,misc.ONE_HUNDRED=100,misc.ONE_THOUSAND=1e3),misc}var time={},hasRequiredTime;function requireTime(){return hasRequiredTime||(hasRequiredTime=1,function(G){Object.defineProperty(G,"__esModule",{value:!0}),G.ONE_YEAR=G.FOUR_WEEKS=G.THREE_WEEKS=G.TWO_WEEKS=G.ONE_WEEK=G.THIRTY_DAYS=G.SEVEN_DAYS=G.FIVE_DAYS=G.THREE_DAYS=G.ONE_DAY=G.TWENTY_FOUR_HOURS=G.TWELVE_HOURS=G.SIX_HOURS=G.THREE_HOURS=G.ONE_HOUR=G.SIXTY_MINUTES=G.THIRTY_MINUTES=G.TEN_MINUTES=G.FIVE_MINUTES=G.ONE_MINUTE=G.SIXTY_SECONDS=G.THIRTY_SECONDS=G.TEN_SECONDS=G.FIVE_SECONDS=G.ONE_SECOND=void 0,G.ONE_SECOND=1,G.FIVE_SECONDS=5,G.TEN_SECONDS=10,G.THIRTY_SECONDS=30,G.SIXTY_SECONDS=60,G.ONE_MINUTE=G.SIXTY_SECONDS,G.FIVE_MINUTES=G.ONE_MINUTE*5,G.TEN_MINUTES=G.ONE_MINUTE*10,G.THIRTY_MINUTES=G.ONE_MINUTE*30,G.SIXTY_MINUTES=G.ONE_MINUTE*60,G.ONE_HOUR=G.SIXTY_MINUTES,G.THREE_HOURS=G.ONE_HOUR*3,G.SIX_HOURS=G.ONE_HOUR*6,G.TWELVE_HOURS=G.ONE_HOUR*12,G.TWENTY_FOUR_HOURS=G.ONE_HOUR*24,G.ONE_DAY=G.TWENTY_FOUR_HOURS,G.THREE_DAYS=G.ONE_DAY*3,G.FIVE_DAYS=G.ONE_DAY*5,G.SEVEN_DAYS=G.ONE_DAY*7,G.THIRTY_DAYS=G.ONE_DAY*30,G.ONE_WEEK=G.SEVEN_DAYS,G.TWO_WEEKS=G.ONE_WEEK*2,G.THREE_WEEKS=G.ONE_WEEK*3,G.FOUR_WEEKS=G.ONE_WEEK*4,G.ONE_YEAR=G.ONE_DAY*365}(time)),time}var hasRequiredConstants$1;function requireConstants$1(){return hasRequiredConstants$1||(hasRequiredConstants$1=1,function(G){Object.defineProperty(G,"__esModule",{value:!0});const e=require$$0$2;e.__exportStar(requireMisc(),G),e.__exportStar(requireTime(),G)}(constants$1)),constants$1}var hasRequiredConvert;function requireConvert(){if(hasRequiredConvert)return convert;hasRequiredConvert=1,Object.defineProperty(convert,"__esModule",{value:!0}),convert.fromMiliseconds=convert.toMiliseconds=void 0;const G=requireConstants$1();function e(Y){return Y*G.ONE_THOUSAND}convert.toMiliseconds=e;function H(Y){return Math.floor(Y/G.ONE_THOUSAND)}return convert.fromMiliseconds=H,convert}var hasRequiredUtils$4;function requireUtils$4(){return hasRequiredUtils$4||(hasRequiredUtils$4=1,function(G){Object.defineProperty(G,"__esModule",{value:!0});const e=require$$0$2;e.__exportStar(requireDelay(),G),e.__exportStar(requireConvert(),G)}(utils$4)),utils$4}var watch$2={},hasRequiredWatch$1;function requireWatch$1(){if(hasRequiredWatch$1)return watch$2;hasRequiredWatch$1=1,Object.defineProperty(watch$2,"__esModule",{value:!0}),watch$2.Watch=void 0;class G{constructor(){this.timestamps=new Map}start(H){if(this.timestamps.has(H))throw new Error(`Watch already started for label: ${H}`);this.timestamps.set(H,{started:Date.now()})}stop(H){const Y=this.get(H);if(typeof Y.elapsed<"u")throw new Error(`Watch already stopped for label: ${H}`);const Ne=Date.now()-Y.started;this.timestamps.set(H,{started:Y.started,elapsed:Ne})}get(H){const Y=this.timestamps.get(H);if(typeof Y>"u")throw new Error(`No timestamp found for label: ${H}`);return Y}elapsed(H){const Y=this.get(H);return Y.elapsed||Date.now()-Y.started}}return watch$2.Watch=G,watch$2.default=G,watch$2}var types={},watch$1={},hasRequiredWatch;function requireWatch(){if(hasRequiredWatch)return watch$1;hasRequiredWatch=1,Object.defineProperty(watch$1,"__esModule",{value:!0}),watch$1.IWatch=void 0;class G{}return watch$1.IWatch=G,watch$1}var hasRequiredTypes;function requireTypes(){return hasRequiredTypes||(hasRequiredTypes=1,function(G){Object.defineProperty(G,"__esModule",{value:!0}),require$$0$2.__exportStar(requireWatch(),G)}(types)),types}(function(G){Object.defineProperty(G,"__esModule",{value:!0});const e=require$$0$2;e.__exportStar(requireUtils$4(),G),e.__exportStar(requireWatch$1(),G),e.__exportStar(requireTypes(),G),e.__exportStar(requireConstants$1(),G)})(cjs$3);var cjs$2={};Object.defineProperty(cjs$2,"__esModule",{value:!0});cjs$2.getLocalStorage=cjs$2.getLocalStorageOrThrow=cjs$2.getCrypto=cjs$2.getCryptoOrThrow=getLocation_1=cjs$2.getLocation=cjs$2.getLocationOrThrow=getNavigator_1=cjs$2.getNavigator=cjs$2.getNavigatorOrThrow=getDocument_1=cjs$2.getDocument=cjs$2.getDocumentOrThrow=cjs$2.getFromWindowOrThrow=cjs$2.getFromWindow=void 0;function getFromWindow(G){let e;return typeof window<"u"&&typeof window[G]<"u"&&(e=window[G]),e}cjs$2.getFromWindow=getFromWindow;function getFromWindowOrThrow(G){const e=getFromWindow(G);if(!e)throw new Error(`${G} is not defined in Window`);return e}cjs$2.getFromWindowOrThrow=getFromWindowOrThrow;function getDocumentOrThrow(){return getFromWindowOrThrow("document")}cjs$2.getDocumentOrThrow=getDocumentOrThrow;function getDocument(){return getFromWindow("document")}var getDocument_1=cjs$2.getDocument=getDocument;function getNavigatorOrThrow(){return getFromWindowOrThrow("navigator")}cjs$2.getNavigatorOrThrow=getNavigatorOrThrow;function getNavigator(){return getFromWindow("navigator")}var getNavigator_1=cjs$2.getNavigator=getNavigator;function getLocationOrThrow(){return getFromWindowOrThrow("location")}cjs$2.getLocationOrThrow=getLocationOrThrow;function getLocation(){return getFromWindow("location")}var getLocation_1=cjs$2.getLocation=getLocation;function getCryptoOrThrow(){return getFromWindowOrThrow("crypto")}cjs$2.getCryptoOrThrow=getCryptoOrThrow;function getCrypto(){return getFromWindow("crypto")}cjs$2.getCrypto=getCrypto;function getLocalStorageOrThrow(){return getFromWindowOrThrow("localStorage")}cjs$2.getLocalStorageOrThrow=getLocalStorageOrThrow;function getLocalStorage(){return getFromWindow("localStorage")}cjs$2.getLocalStorage=getLocalStorage;var cjs$1={};Object.defineProperty(cjs$1,"__esModule",{value:!0});var getWindowMetadata_1=cjs$1.getWindowMetadata=void 0;const window_getters_1=cjs$2;function getWindowMetadata(){let G,e;try{G=window_getters_1.getDocumentOrThrow(),e=window_getters_1.getLocationOrThrow()}catch{return null}function H(){const hi=G.getElementsByTagName("link"),ci=[];for(let ui=0;ui-1){const hn=li.getAttribute("href");if(hn)if(hn.toLowerCase().indexOf("https:")===-1&&hn.toLowerCase().indexOf("http:")===-1&&hn.indexOf("//")!==0){let ln=e.protocol+"//"+e.host;if(hn.indexOf("/")===0)ln+=hn;else{const fn=e.pathname.split("/");fn.pop();const gn=fn.join("/");ln+=gn+"/"+hn}ci.push(ln)}else if(hn.indexOf("//")===0){const ln=e.protocol+hn;ci.push(ln)}else ci.push(hn)}}return ci}function Y(...hi){const ci=G.getElementsByTagName("meta");for(let ui=0;uili.getAttribute(hn)).filter(hn=>hn?hi.includes(hn):!1);if(mi.length&&mi){const hn=li.getAttribute("content");if(hn)return hn}}return""}function Ne(){let hi=Y("name","og:site_name","og:title","twitter:title");return hi||(hi=G.title),hi}function W(){return Y("description","og:description","twitter:description","keywords")}const ri=Ne(),si=W(),fi=e.origin,ai=H();return{description:si,url:fi,icons:ai,name:ri}}getWindowMetadata_1=cjs$1.getWindowMetadata=getWindowMetadata;var queryString={},strictUriEncode=G=>encodeURIComponent(G).replace(/[!'()*]/g,e=>`%${e.charCodeAt(0).toString(16).toUpperCase()}`),token="%[a-f0-9]{2}",singleMatcher=new RegExp("("+token+")|([^%]+?)","gi"),multiMatcher=new RegExp("("+token+")+","gi");function decodeComponents(G,e){try{return[decodeURIComponent(G.join(""))]}catch{}if(G.length===1)return G;e=e||1;var H=G.slice(0,e),Y=G.slice(e);return Array.prototype.concat.call([],decodeComponents(H),decodeComponents(Y))}function decode$2(G){try{return decodeURIComponent(G)}catch{for(var e=G.match(singleMatcher)||[],H=1;H{if(!(typeof G=="string"&&typeof e=="string"))throw new TypeError("Expected the arguments to be of type `string`");if(e==="")return[G];const H=G.indexOf(e);return H===-1?[G]:[G.slice(0,H),G.slice(H+e.length)]},filterObj=function(G,e){for(var H={},Y=Object.keys(G),Ne=Array.isArray(e),W=0;Wfn==null,ri=Symbol("encodeFragmentIdentifier");function si(fn){switch(fn.arrayFormat){case"index":return gn=>(cn,An)=>{const Cn=cn.length;return An===void 0||fn.skipNull&&An===null||fn.skipEmptyString&&An===""?cn:An===null?[...cn,[ti(gn,fn),"[",Cn,"]"].join("")]:[...cn,[ti(gn,fn),"[",ti(Cn,fn),"]=",ti(An,fn)].join("")]};case"bracket":return gn=>(cn,An)=>An===void 0||fn.skipNull&&An===null||fn.skipEmptyString&&An===""?cn:An===null?[...cn,[ti(gn,fn),"[]"].join("")]:[...cn,[ti(gn,fn),"[]=",ti(An,fn)].join("")];case"colon-list-separator":return gn=>(cn,An)=>An===void 0||fn.skipNull&&An===null||fn.skipEmptyString&&An===""?cn:An===null?[...cn,[ti(gn,fn),":list="].join("")]:[...cn,[ti(gn,fn),":list=",ti(An,fn)].join("")];case"comma":case"separator":case"bracket-separator":{const gn=fn.arrayFormat==="bracket-separator"?"[]=":"=";return cn=>(An,Cn)=>Cn===void 0||fn.skipNull&&Cn===null||fn.skipEmptyString&&Cn===""?An:(Cn=Cn===null?"":Cn,An.length===0?[[ti(cn,fn),gn,ti(Cn,fn)].join("")]:[[An,ti(Cn,fn)].join(fn.arrayFormatSeparator)])}default:return gn=>(cn,An)=>An===void 0||fn.skipNull&&An===null||fn.skipEmptyString&&An===""?cn:An===null?[...cn,ti(gn,fn)]:[...cn,[ti(gn,fn),"=",ti(An,fn)].join("")]}}function fi(fn){let gn;switch(fn.arrayFormat){case"index":return(cn,An,Cn)=>{if(gn=/\[(\d*)\]$/.exec(cn),cn=cn.replace(/\[\d*\]$/,""),!gn){Cn[cn]=An;return}Cn[cn]===void 0&&(Cn[cn]={}),Cn[cn][gn[1]]=An};case"bracket":return(cn,An,Cn)=>{if(gn=/(\[\])$/.exec(cn),cn=cn.replace(/\[\]$/,""),!gn){Cn[cn]=An;return}if(Cn[cn]===void 0){Cn[cn]=[An];return}Cn[cn]=[].concat(Cn[cn],An)};case"colon-list-separator":return(cn,An,Cn)=>{if(gn=/(:list)$/.exec(cn),cn=cn.replace(/:list$/,""),!gn){Cn[cn]=An;return}if(Cn[cn]===void 0){Cn[cn]=[An];return}Cn[cn]=[].concat(Cn[cn],An)};case"comma":case"separator":return(cn,An,Cn)=>{const an=typeof An=="string"&&An.includes(fn.arrayFormatSeparator),Rn=typeof An=="string"&&!an&&hi(An,fn).includes(fn.arrayFormatSeparator);An=Rn?hi(An,fn):An;const Ya=an||Rn?An.split(fn.arrayFormatSeparator).map(Ho=>hi(Ho,fn)):An===null?An:hi(An,fn);Cn[cn]=Ya};case"bracket-separator":return(cn,An,Cn)=>{const an=/(\[\])$/.test(cn);if(cn=cn.replace(/\[\]$/,""),!an){Cn[cn]=An&&hi(An,fn);return}const Rn=An===null?[]:An.split(fn.arrayFormatSeparator).map(Ya=>hi(Ya,fn));if(Cn[cn]===void 0){Cn[cn]=Rn;return}Cn[cn]=[].concat(Cn[cn],Rn)};default:return(cn,An,Cn)=>{if(Cn[cn]===void 0){Cn[cn]=An;return}Cn[cn]=[].concat(Cn[cn],An)}}}function ai(fn){if(typeof fn!="string"||fn.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function ti(fn,gn){return gn.encode?gn.strict?e(fn):encodeURIComponent(fn):fn}function hi(fn,gn){return gn.decode?H(fn):fn}function ci(fn){return Array.isArray(fn)?fn.sort():typeof fn=="object"?ci(Object.keys(fn)).sort((gn,cn)=>Number(gn)-Number(cn)).map(gn=>fn[gn]):fn}function ui(fn){const gn=fn.indexOf("#");return gn!==-1&&(fn=fn.slice(0,gn)),fn}function li(fn){let gn="";const cn=fn.indexOf("#");return cn!==-1&&(gn=fn.slice(cn)),gn}function mi(fn){fn=ui(fn);const gn=fn.indexOf("?");return gn===-1?"":fn.slice(gn+1)}function hn(fn,gn){return gn.parseNumbers&&!Number.isNaN(Number(fn))&&typeof fn=="string"&&fn.trim()!==""?fn=Number(fn):gn.parseBooleans&&fn!==null&&(fn.toLowerCase()==="true"||fn.toLowerCase()==="false")&&(fn=fn.toLowerCase()==="true"),fn}function ln(fn,gn){gn=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},gn),ai(gn.arrayFormatSeparator);const cn=fi(gn),An=Object.create(null);if(typeof fn!="string"||(fn=fn.trim().replace(/^[?#&]/,""),!fn))return An;for(const Cn of fn.split("&")){if(Cn==="")continue;let[an,Rn]=Y(gn.decode?Cn.replace(/\+/g," "):Cn,"=");Rn=Rn===void 0?null:["comma","separator","bracket-separator"].includes(gn.arrayFormat)?Rn:hi(Rn,gn),cn(hi(an,gn),Rn,An)}for(const Cn of Object.keys(An)){const an=An[Cn];if(typeof an=="object"&&an!==null)for(const Rn of Object.keys(an))an[Rn]=hn(an[Rn],gn);else An[Cn]=hn(an,gn)}return gn.sort===!1?An:(gn.sort===!0?Object.keys(An).sort():Object.keys(An).sort(gn.sort)).reduce((Cn,an)=>{const Rn=An[an];return Rn&&typeof Rn=="object"&&!Array.isArray(Rn)?Cn[an]=ci(Rn):Cn[an]=Rn,Cn},Object.create(null))}G.extract=mi,G.parse=ln,G.stringify=(fn,gn)=>{if(!fn)return"";gn=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},gn),ai(gn.arrayFormatSeparator);const cn=Rn=>gn.skipNull&&W(fn[Rn])||gn.skipEmptyString&&fn[Rn]==="",An=si(gn),Cn={};for(const Rn of Object.keys(fn))cn(Rn)||(Cn[Rn]=fn[Rn]);const an=Object.keys(Cn);return gn.sort!==!1&&an.sort(gn.sort),an.map(Rn=>{const Ya=fn[Rn];return Ya===void 0?"":Ya===null?ti(Rn,gn):Array.isArray(Ya)?Ya.length===0&&gn.arrayFormat==="bracket-separator"?ti(Rn,gn)+"[]":Ya.reduce(An(Rn),[]).join("&"):ti(Rn,gn)+"="+ti(Ya,gn)}).filter(Rn=>Rn.length>0).join("&")},G.parseUrl=(fn,gn)=>{gn=Object.assign({decode:!0},gn);const[cn,An]=Y(fn,"#");return Object.assign({url:cn.split("?")[0]||"",query:ln(mi(fn),gn)},gn&&gn.parseFragmentIdentifier&&An?{fragmentIdentifier:hi(An,gn)}:{})},G.stringifyUrl=(fn,gn)=>{gn=Object.assign({encode:!0,strict:!0,[ri]:!0},gn);const cn=ui(fn.url).split("?")[0]||"",An=G.extract(fn.url),Cn=G.parse(An,{sort:!1}),an=Object.assign(Cn,fn.query);let Rn=G.stringify(an,gn);Rn&&(Rn=`?${Rn}`);let Ya=li(fn.url);return fn.fragmentIdentifier&&(Ya=`#${gn[ri]?ti(fn.fragmentIdentifier,gn):fn.fragmentIdentifier}`),`${cn}${Rn}${Ya}`},G.pick=(fn,gn,cn)=>{cn=Object.assign({parseFragmentIdentifier:!0,[ri]:!1},cn);const{url:An,query:Cn,fragmentIdentifier:an}=G.parseUrl(fn,cn);return G.stringifyUrl({url:An,query:Ne(Cn,gn),fragmentIdentifier:an},cn)},G.exclude=(fn,gn,cn)=>{const An=Array.isArray(gn)?Cn=>!gn.includes(Cn):(Cn,an)=>!gn(Cn,an);return G.pick(fn,An,cn)}})(queryString);var chacha20poly1305={},chacha={},binary={},int={};(function(G){Object.defineProperty(G,"__esModule",{value:!0});function e(si,fi){var ai=si>>>16&65535,ti=si&65535,hi=fi>>>16&65535,ci=fi&65535;return ti*ci+(ai*ci+ti*hi<<16>>>0)|0}G.mul=Math.imul||e;function H(si,fi){return si+fi|0}G.add=H;function Y(si,fi){return si-fi|0}G.sub=Y;function Ne(si,fi){return si<>>32-fi}G.rotl=Ne;function W(si,fi){return si<<32-fi|si>>>fi}G.rotr=W;function ri(si){return typeof si=="number"&&isFinite(si)&&Math.floor(si)===si}G.isInteger=Number.isInteger||ri,G.MAX_SAFE_INTEGER=9007199254740991,G.isSafeInteger=function(si){return G.isInteger(si)&&si>=-G.MAX_SAFE_INTEGER&&si<=G.MAX_SAFE_INTEGER}})(int);Object.defineProperty(binary,"__esModule",{value:!0});var int_1=int;function readInt16BE(G,e){return e===void 0&&(e=0),(G[e+0]<<8|G[e+1])<<16>>16}binary.readInt16BE=readInt16BE;function readUint16BE(G,e){return e===void 0&&(e=0),(G[e+0]<<8|G[e+1])>>>0}binary.readUint16BE=readUint16BE;function readInt16LE(G,e){return e===void 0&&(e=0),(G[e+1]<<8|G[e])<<16>>16}binary.readInt16LE=readInt16LE;function readUint16LE(G,e){return e===void 0&&(e=0),(G[e+1]<<8|G[e])>>>0}binary.readUint16LE=readUint16LE;function writeUint16BE(G,e,H){return e===void 0&&(e=new Uint8Array(2)),H===void 0&&(H=0),e[H+0]=G>>>8,e[H+1]=G>>>0,e}binary.writeUint16BE=writeUint16BE;binary.writeInt16BE=writeUint16BE;function writeUint16LE(G,e,H){return e===void 0&&(e=new Uint8Array(2)),H===void 0&&(H=0),e[H+0]=G>>>0,e[H+1]=G>>>8,e}binary.writeUint16LE=writeUint16LE;binary.writeInt16LE=writeUint16LE;function readInt32BE(G,e){return e===void 0&&(e=0),G[e]<<24|G[e+1]<<16|G[e+2]<<8|G[e+3]}binary.readInt32BE=readInt32BE;function readUint32BE(G,e){return e===void 0&&(e=0),(G[e]<<24|G[e+1]<<16|G[e+2]<<8|G[e+3])>>>0}binary.readUint32BE=readUint32BE;function readInt32LE(G,e){return e===void 0&&(e=0),G[e+3]<<24|G[e+2]<<16|G[e+1]<<8|G[e]}binary.readInt32LE=readInt32LE;function readUint32LE(G,e){return e===void 0&&(e=0),(G[e+3]<<24|G[e+2]<<16|G[e+1]<<8|G[e])>>>0}binary.readUint32LE=readUint32LE;function writeUint32BE(G,e,H){return e===void 0&&(e=new Uint8Array(4)),H===void 0&&(H=0),e[H+0]=G>>>24,e[H+1]=G>>>16,e[H+2]=G>>>8,e[H+3]=G>>>0,e}binary.writeUint32BE=writeUint32BE;binary.writeInt32BE=writeUint32BE;function writeUint32LE(G,e,H){return e===void 0&&(e=new Uint8Array(4)),H===void 0&&(H=0),e[H+0]=G>>>0,e[H+1]=G>>>8,e[H+2]=G>>>16,e[H+3]=G>>>24,e}binary.writeUint32LE=writeUint32LE;binary.writeInt32LE=writeUint32LE;function readInt64BE(G,e){e===void 0&&(e=0);var H=readInt32BE(G,e),Y=readInt32BE(G,e+4);return H*4294967296+Y-(Y>>31)*4294967296}binary.readInt64BE=readInt64BE;function readUint64BE(G,e){e===void 0&&(e=0);var H=readUint32BE(G,e),Y=readUint32BE(G,e+4);return H*4294967296+Y}binary.readUint64BE=readUint64BE;function readInt64LE(G,e){e===void 0&&(e=0);var H=readInt32LE(G,e),Y=readInt32LE(G,e+4);return Y*4294967296+H-(H>>31)*4294967296}binary.readInt64LE=readInt64LE;function readUint64LE(G,e){e===void 0&&(e=0);var H=readUint32LE(G,e),Y=readUint32LE(G,e+4);return Y*4294967296+H}binary.readUint64LE=readUint64LE;function writeUint64BE(G,e,H){return e===void 0&&(e=new Uint8Array(8)),H===void 0&&(H=0),writeUint32BE(G/4294967296>>>0,e,H),writeUint32BE(G>>>0,e,H+4),e}binary.writeUint64BE=writeUint64BE;binary.writeInt64BE=writeUint64BE;function writeUint64LE(G,e,H){return e===void 0&&(e=new Uint8Array(8)),H===void 0&&(H=0),writeUint32LE(G>>>0,e,H),writeUint32LE(G/4294967296>>>0,e,H+4),e}binary.writeUint64LE=writeUint64LE;binary.writeInt64LE=writeUint64LE;function readUintBE(G,e,H){if(H===void 0&&(H=0),G%8!==0)throw new Error("readUintBE supports only bitLengths divisible by 8");if(G/8>e.length-H)throw new Error("readUintBE: array is too short for the given bitLength");for(var Y=0,Ne=1,W=G/8+H-1;W>=H;W--)Y+=e[W]*Ne,Ne*=256;return Y}binary.readUintBE=readUintBE;function readUintLE(G,e,H){if(H===void 0&&(H=0),G%8!==0)throw new Error("readUintLE supports only bitLengths divisible by 8");if(G/8>e.length-H)throw new Error("readUintLE: array is too short for the given bitLength");for(var Y=0,Ne=1,W=H;W=Y;W--)H[W]=e/Ne&255,Ne*=256;return H}binary.writeUintBE=writeUintBE;function writeUintLE(G,e,H,Y){if(H===void 0&&(H=new Uint8Array(G/8)),Y===void 0&&(Y=0),G%8!==0)throw new Error("writeUintLE supports only bitLengths divisible by 8");if(!int_1.isSafeInteger(e))throw new Error("writeUintLE value must be an integer");for(var Ne=1,W=Y;W>>16|Te<<16,oi=oi+Te|0,an^=oi,an=an>>>20|an<<12,cn=cn+Rn|0,Xr^=cn,Xr=Xr>>>16|Xr<<16,t=t+Xr|0,Rn^=t,Rn=Rn>>>20|Rn<<12,An=An+Ya|0,ei^=An,ei=ei>>>16|ei<<16,F=F+ei|0,Ya^=F,Ya=Ya>>>20|Ya<<12,Cn=Cn+Ho|0,ii^=Cn,ii=ii>>>16|ii<<16,Ie=Ie+ii|0,Ho^=Ie,Ho=Ho>>>20|Ho<<12,An=An+Ya|0,ei^=An,ei=ei>>>24|ei<<8,F=F+ei|0,Ya^=F,Ya=Ya>>>25|Ya<<7,Cn=Cn+Ho|0,ii^=Cn,ii=ii>>>24|ii<<8,Ie=Ie+ii|0,Ho^=Ie,Ho=Ho>>>25|Ho<<7,cn=cn+Rn|0,Xr^=cn,Xr=Xr>>>24|Xr<<8,t=t+Xr|0,Rn^=t,Rn=Rn>>>25|Rn<<7,gn=gn+an|0,Te^=gn,Te=Te>>>24|Te<<8,oi=oi+Te|0,an^=oi,an=an>>>25|an<<7,gn=gn+Rn|0,ii^=gn,ii=ii>>>16|ii<<16,F=F+ii|0,Rn^=F,Rn=Rn>>>20|Rn<<12,cn=cn+Ya|0,Te^=cn,Te=Te>>>16|Te<<16,Ie=Ie+Te|0,Ya^=Ie,Ya=Ya>>>20|Ya<<12,An=An+Ho|0,Xr^=An,Xr=Xr>>>16|Xr<<16,oi=oi+Xr|0,Ho^=oi,Ho=Ho>>>20|Ho<<12,Cn=Cn+an|0,ei^=Cn,ei=ei>>>16|ei<<16,t=t+ei|0,an^=t,an=an>>>20|an<<12,An=An+Ho|0,Xr^=An,Xr=Xr>>>24|Xr<<8,oi=oi+Xr|0,Ho^=oi,Ho=Ho>>>25|Ho<<7,Cn=Cn+an|0,ei^=Cn,ei=ei>>>24|ei<<8,t=t+ei|0,an^=t,an=an>>>25|an<<7,cn=cn+Ya|0,Te^=cn,Te=Te>>>24|Te<<8,Ie=Ie+Te|0,Ya^=Ie,Ya=Ya>>>25|Ya<<7,gn=gn+Rn|0,ii^=gn,ii=ii>>>24|ii<<8,F=F+ii|0,Rn^=F,Rn=Rn>>>25|Rn<<7;binary_1.writeUint32LE(gn+Y|0,G,0),binary_1.writeUint32LE(cn+Ne|0,G,4),binary_1.writeUint32LE(An+W|0,G,8),binary_1.writeUint32LE(Cn+ri|0,G,12),binary_1.writeUint32LE(an+si|0,G,16),binary_1.writeUint32LE(Rn+fi|0,G,20),binary_1.writeUint32LE(Ya+ai|0,G,24),binary_1.writeUint32LE(Ho+ti|0,G,28),binary_1.writeUint32LE(oi+hi|0,G,32),binary_1.writeUint32LE(t+ci|0,G,36),binary_1.writeUint32LE(F+ui|0,G,40),binary_1.writeUint32LE(Ie+li|0,G,44),binary_1.writeUint32LE(Te+mi|0,G,48),binary_1.writeUint32LE(Xr+hn|0,G,52),binary_1.writeUint32LE(ei+ln|0,G,56),binary_1.writeUint32LE(ii+fn|0,G,60)}function streamXOR(G,e,H,Y,Ne){if(Ne===void 0&&(Ne=0),G.length!==32)throw new Error("ChaCha: key size must be 32 bytes");if(Y.length>>=8,e++;if(Y>0)throw new Error("ChaCha: counter overflow")}var poly1305={},constantTime={};Object.defineProperty(constantTime,"__esModule",{value:!0});function select(G,e,H){return~(G-1)&e|G-1&H}constantTime.select=select;function lessOrEqual(G,e){return(G|0)-(e|0)-1>>>31&1}constantTime.lessOrEqual=lessOrEqual;function compare(G,e){if(G.length!==e.length)return 0;for(var H=0,Y=0;Y>>8}constantTime.compare=compare;function equal(G,e){return G.length===0||e.length===0?!1:compare(G,e)!==0}constantTime.equal=equal;(function(G){Object.defineProperty(G,"__esModule",{value:!0});var e=constantTime,H=wipe$1;G.DIGEST_LENGTH=16;var Y=function(){function ri(si){this.digestLength=G.DIGEST_LENGTH,this._buffer=new Uint8Array(16),this._r=new Uint16Array(10),this._h=new Uint16Array(10),this._pad=new Uint16Array(8),this._leftover=0,this._fin=0,this._finished=!1;var fi=si[0]|si[1]<<8;this._r[0]=fi&8191;var ai=si[2]|si[3]<<8;this._r[1]=(fi>>>13|ai<<3)&8191;var ti=si[4]|si[5]<<8;this._r[2]=(ai>>>10|ti<<6)&7939;var hi=si[6]|si[7]<<8;this._r[3]=(ti>>>7|hi<<9)&8191;var ci=si[8]|si[9]<<8;this._r[4]=(hi>>>4|ci<<12)&255,this._r[5]=ci>>>1&8190;var ui=si[10]|si[11]<<8;this._r[6]=(ci>>>14|ui<<2)&8191;var li=si[12]|si[13]<<8;this._r[7]=(ui>>>11|li<<5)&8065;var mi=si[14]|si[15]<<8;this._r[8]=(li>>>8|mi<<8)&8191,this._r[9]=mi>>>5&127,this._pad[0]=si[16]|si[17]<<8,this._pad[1]=si[18]|si[19]<<8,this._pad[2]=si[20]|si[21]<<8,this._pad[3]=si[22]|si[23]<<8,this._pad[4]=si[24]|si[25]<<8,this._pad[5]=si[26]|si[27]<<8,this._pad[6]=si[28]|si[29]<<8,this._pad[7]=si[30]|si[31]<<8}return ri.prototype._blocks=function(si,fi,ai){for(var ti=this._fin?0:2048,hi=this._h[0],ci=this._h[1],ui=this._h[2],li=this._h[3],mi=this._h[4],hn=this._h[5],ln=this._h[6],fn=this._h[7],gn=this._h[8],cn=this._h[9],An=this._r[0],Cn=this._r[1],an=this._r[2],Rn=this._r[3],Ya=this._r[4],Ho=this._r[5],oi=this._r[6],t=this._r[7],F=this._r[8],Ie=this._r[9];ai>=16;){var Te=si[fi+0]|si[fi+1]<<8;hi+=Te&8191;var Xr=si[fi+2]|si[fi+3]<<8;ci+=(Te>>>13|Xr<<3)&8191;var ei=si[fi+4]|si[fi+5]<<8;ui+=(Xr>>>10|ei<<6)&8191;var ii=si[fi+6]|si[fi+7]<<8;li+=(ei>>>7|ii<<9)&8191;var Wr=si[fi+8]|si[fi+9]<<8;mi+=(ii>>>4|Wr<<12)&8191,hn+=Wr>>>1&8191;var R=si[fi+10]|si[fi+11]<<8;ln+=(Wr>>>14|R<<2)&8191;var Le=si[fi+12]|si[fi+13]<<8;fn+=(R>>>11|Le<<5)&8191;var nn=si[fi+14]|si[fi+15]<<8;gn+=(Le>>>8|nn<<8)&8191,cn+=nn>>>5|ti;var vn=0,Mn=vn;Mn+=hi*An,Mn+=ci*(5*Ie),Mn+=ui*(5*F),Mn+=li*(5*t),Mn+=mi*(5*oi),vn=Mn>>>13,Mn&=8191,Mn+=hn*(5*Ho),Mn+=ln*(5*Ya),Mn+=fn*(5*Rn),Mn+=gn*(5*an),Mn+=cn*(5*Cn),vn+=Mn>>>13,Mn&=8191;var sn=vn;sn+=hi*Cn,sn+=ci*An,sn+=ui*(5*Ie),sn+=li*(5*F),sn+=mi*(5*t),vn=sn>>>13,sn&=8191,sn+=hn*(5*oi),sn+=ln*(5*Ho),sn+=fn*(5*Ya),sn+=gn*(5*Rn),sn+=cn*(5*an),vn+=sn>>>13,sn&=8191;var Zn=vn;Zn+=hi*an,Zn+=ci*Cn,Zn+=ui*An,Zn+=li*(5*Ie),Zn+=mi*(5*F),vn=Zn>>>13,Zn&=8191,Zn+=hn*(5*t),Zn+=ln*(5*oi),Zn+=fn*(5*Ho),Zn+=gn*(5*Ya),Zn+=cn*(5*Rn),vn+=Zn>>>13,Zn&=8191;var on=vn;on+=hi*Rn,on+=ci*an,on+=ui*Cn,on+=li*An,on+=mi*(5*Ie),vn=on>>>13,on&=8191,on+=hn*(5*F),on+=ln*(5*t),on+=fn*(5*oi),on+=gn*(5*Ho),on+=cn*(5*Ya),vn+=on>>>13,on&=8191;var pn=vn;pn+=hi*Ya,pn+=ci*Rn,pn+=ui*an,pn+=li*Cn,pn+=mi*An,vn=pn>>>13,pn&=8191,pn+=hn*(5*Ie),pn+=ln*(5*F),pn+=fn*(5*t),pn+=gn*(5*oi),pn+=cn*(5*Ho),vn+=pn>>>13,pn&=8191;var mn=vn;mn+=hi*Ho,mn+=ci*Ya,mn+=ui*Rn,mn+=li*an,mn+=mi*Cn,vn=mn>>>13,mn&=8191,mn+=hn*An,mn+=ln*(5*Ie),mn+=fn*(5*F),mn+=gn*(5*t),mn+=cn*(5*oi),vn+=mn>>>13,mn&=8191;var $i=vn;$i+=hi*oi,$i+=ci*Ho,$i+=ui*Ya,$i+=li*Rn,$i+=mi*an,vn=$i>>>13,$i&=8191,$i+=hn*Cn,$i+=ln*An,$i+=fn*(5*Ie),$i+=gn*(5*F),$i+=cn*(5*t),vn+=$i>>>13,$i&=8191;var ho=vn;ho+=hi*t,ho+=ci*oi,ho+=ui*Ho,ho+=li*Ya,ho+=mi*Rn,vn=ho>>>13,ho&=8191,ho+=hn*an,ho+=ln*Cn,ho+=fn*An,ho+=gn*(5*Ie),ho+=cn*(5*F),vn+=ho>>>13,ho&=8191;var Do=vn;Do+=hi*F,Do+=ci*t,Do+=ui*oi,Do+=li*Ho,Do+=mi*Ya,vn=Do>>>13,Do&=8191,Do+=hn*Rn,Do+=ln*an,Do+=fn*Cn,Do+=gn*An,Do+=cn*(5*Ie),vn+=Do>>>13,Do&=8191;var To=vn;To+=hi*Ie,To+=ci*F,To+=ui*t,To+=li*oi,To+=mi*Ho,vn=To>>>13,To&=8191,To+=hn*Ya,To+=ln*Rn,To+=fn*an,To+=gn*Cn,To+=cn*An,vn+=To>>>13,To&=8191,vn=(vn<<2)+vn|0,vn=vn+Mn|0,Mn=vn&8191,vn=vn>>>13,sn+=vn,hi=Mn,ci=sn,ui=Zn,li=on,mi=pn,hn=mn,ln=$i,fn=ho,gn=Do,cn=To,fi+=16,ai-=16}this._h[0]=hi,this._h[1]=ci,this._h[2]=ui,this._h[3]=li,this._h[4]=mi,this._h[5]=hn,this._h[6]=ln,this._h[7]=fn,this._h[8]=gn,this._h[9]=cn},ri.prototype.finish=function(si,fi){fi===void 0&&(fi=0);var ai=new Uint16Array(10),ti,hi,ci,ui;if(this._leftover){for(ui=this._leftover,this._buffer[ui++]=1;ui<16;ui++)this._buffer[ui]=0;this._fin=1,this._blocks(this._buffer,0,16)}for(ti=this._h[1]>>>13,this._h[1]&=8191,ui=2;ui<10;ui++)this._h[ui]+=ti,ti=this._h[ui]>>>13,this._h[ui]&=8191;for(this._h[0]+=ti*5,ti=this._h[0]>>>13,this._h[0]&=8191,this._h[1]+=ti,ti=this._h[1]>>>13,this._h[1]&=8191,this._h[2]+=ti,ai[0]=this._h[0]+5,ti=ai[0]>>>13,ai[0]&=8191,ui=1;ui<10;ui++)ai[ui]=this._h[ui]+ti,ti=ai[ui]>>>13,ai[ui]&=8191;for(ai[9]-=8192,hi=(ti^1)-1,ui=0;ui<10;ui++)ai[ui]&=hi;for(hi=~hi,ui=0;ui<10;ui++)this._h[ui]=this._h[ui]&hi|ai[ui];for(this._h[0]=(this._h[0]|this._h[1]<<13)&65535,this._h[1]=(this._h[1]>>>3|this._h[2]<<10)&65535,this._h[2]=(this._h[2]>>>6|this._h[3]<<7)&65535,this._h[3]=(this._h[3]>>>9|this._h[4]<<4)&65535,this._h[4]=(this._h[4]>>>12|this._h[5]<<1|this._h[6]<<14)&65535,this._h[5]=(this._h[6]>>>2|this._h[7]<<11)&65535,this._h[6]=(this._h[7]>>>5|this._h[8]<<8)&65535,this._h[7]=(this._h[8]>>>8|this._h[9]<<5)&65535,ci=this._h[0]+this._pad[0],this._h[0]=ci&65535,ui=1;ui<8;ui++)ci=(this._h[ui]+this._pad[ui]|0)+(ci>>>16)|0,this._h[ui]=ci&65535;return si[fi+0]=this._h[0]>>>0,si[fi+1]=this._h[0]>>>8,si[fi+2]=this._h[1]>>>0,si[fi+3]=this._h[1]>>>8,si[fi+4]=this._h[2]>>>0,si[fi+5]=this._h[2]>>>8,si[fi+6]=this._h[3]>>>0,si[fi+7]=this._h[3]>>>8,si[fi+8]=this._h[4]>>>0,si[fi+9]=this._h[4]>>>8,si[fi+10]=this._h[5]>>>0,si[fi+11]=this._h[5]>>>8,si[fi+12]=this._h[6]>>>0,si[fi+13]=this._h[6]>>>8,si[fi+14]=this._h[7]>>>0,si[fi+15]=this._h[7]>>>8,this._finished=!0,this},ri.prototype.update=function(si){var fi=0,ai=si.length,ti;if(this._leftover){ti=16-this._leftover,ti>ai&&(ti=ai);for(var hi=0;hi=16&&(ti=ai-ai%16,this._blocks(si,fi,ti),fi+=ti,ai-=ti),ai){for(var hi=0;hi16)throw new Error("ChaCha20Poly1305: incorrect nonce length");var ui=new Uint8Array(16);ui.set(ai,ui.length-ai.length);var li=new Uint8Array(32);e.stream(this._key,ui,li,4);var mi=ti.length+this.tagLength,hn;if(ci){if(ci.length!==mi)throw new Error("ChaCha20Poly1305: incorrect destination length");hn=ci}else hn=new Uint8Array(mi);return e.streamXOR(this._key,ui,ti,hn,4),this._authenticate(hn.subarray(hn.length-this.tagLength,hn.length),li,hn.subarray(0,hn.length-this.tagLength),hi),Y.wipe(ui),hn},fi.prototype.open=function(ai,ti,hi,ci){if(ai.length>16)throw new Error("ChaCha20Poly1305: incorrect nonce length");if(ti.length0&&ui.update(ri.subarray(ci.length%16))),ui.update(hi),hi.length%16>0&&ui.update(ri.subarray(hi.length%16));var li=new Uint8Array(8);ci&&Ne.writeUint64LE(ci.length,li),ui.update(li),Ne.writeUint64LE(hi.length,li),ui.update(li);for(var mi=ui.digest(),hn=0;hnthis.blockSize?this._inner.update(H).finish(Y).clean():Y.set(H);for(var Ne=0;Ne1&&this._hmac.update(this._buffer),this._info&&this._hmac.update(this._info),this._hmac.update(this._counter),this._hmac.finish(this._buffer),this._bufpos=0},G.prototype.expand=function(e){for(var H=new Uint8Array(e),Y=0;Ye)throw new RangeError("requested too many random bytes");var fi=Y.allocUnsafe(ri);if(ri>0)if(ri>G)for(var ai=0;ai=this._blockSize;){for(var ai=this._blockOffset;ai0;++ti)this._length[ti]+=hi,hi=this._length[ti]/4294967296|0,hi>0&&(this._length[ti]-=4294967296*hi);return this},Ne.prototype._update=function(){throw new Error("_update is not implemented")},Ne.prototype.digest=function(W){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var ri=this._digest();W!==void 0&&(ri=ri.toString(W)),this._block.fill(0),this._blockOffset=0;for(var si=0;si<4;++si)this._length[si]=0;return ri},Ne.prototype._digest=function(){throw new Error("_digest is not implemented")},hashBase=Ne,hashBase}var md5_js,hasRequiredMd5_js;function requireMd5_js(){if(hasRequiredMd5_js)return md5_js;hasRequiredMd5_js=1;var G=inherits_browserExports,e=requireHashBase(),H=safeBufferExports.Buffer,Y=new Array(16);function Ne(){e.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}G(Ne,e),Ne.prototype._update=function(){for(var ti=Y,hi=0;hi<16;++hi)ti[hi]=this._block.readInt32LE(hi*4);var ci=this._a,ui=this._b,li=this._c,mi=this._d;ci=ri(ci,ui,li,mi,ti[0],3614090360,7),mi=ri(mi,ci,ui,li,ti[1],3905402710,12),li=ri(li,mi,ci,ui,ti[2],606105819,17),ui=ri(ui,li,mi,ci,ti[3],3250441966,22),ci=ri(ci,ui,li,mi,ti[4],4118548399,7),mi=ri(mi,ci,ui,li,ti[5],1200080426,12),li=ri(li,mi,ci,ui,ti[6],2821735955,17),ui=ri(ui,li,mi,ci,ti[7],4249261313,22),ci=ri(ci,ui,li,mi,ti[8],1770035416,7),mi=ri(mi,ci,ui,li,ti[9],2336552879,12),li=ri(li,mi,ci,ui,ti[10],4294925233,17),ui=ri(ui,li,mi,ci,ti[11],2304563134,22),ci=ri(ci,ui,li,mi,ti[12],1804603682,7),mi=ri(mi,ci,ui,li,ti[13],4254626195,12),li=ri(li,mi,ci,ui,ti[14],2792965006,17),ui=ri(ui,li,mi,ci,ti[15],1236535329,22),ci=si(ci,ui,li,mi,ti[1],4129170786,5),mi=si(mi,ci,ui,li,ti[6],3225465664,9),li=si(li,mi,ci,ui,ti[11],643717713,14),ui=si(ui,li,mi,ci,ti[0],3921069994,20),ci=si(ci,ui,li,mi,ti[5],3593408605,5),mi=si(mi,ci,ui,li,ti[10],38016083,9),li=si(li,mi,ci,ui,ti[15],3634488961,14),ui=si(ui,li,mi,ci,ti[4],3889429448,20),ci=si(ci,ui,li,mi,ti[9],568446438,5),mi=si(mi,ci,ui,li,ti[14],3275163606,9),li=si(li,mi,ci,ui,ti[3],4107603335,14),ui=si(ui,li,mi,ci,ti[8],1163531501,20),ci=si(ci,ui,li,mi,ti[13],2850285829,5),mi=si(mi,ci,ui,li,ti[2],4243563512,9),li=si(li,mi,ci,ui,ti[7],1735328473,14),ui=si(ui,li,mi,ci,ti[12],2368359562,20),ci=fi(ci,ui,li,mi,ti[5],4294588738,4),mi=fi(mi,ci,ui,li,ti[8],2272392833,11),li=fi(li,mi,ci,ui,ti[11],1839030562,16),ui=fi(ui,li,mi,ci,ti[14],4259657740,23),ci=fi(ci,ui,li,mi,ti[1],2763975236,4),mi=fi(mi,ci,ui,li,ti[4],1272893353,11),li=fi(li,mi,ci,ui,ti[7],4139469664,16),ui=fi(ui,li,mi,ci,ti[10],3200236656,23),ci=fi(ci,ui,li,mi,ti[13],681279174,4),mi=fi(mi,ci,ui,li,ti[0],3936430074,11),li=fi(li,mi,ci,ui,ti[3],3572445317,16),ui=fi(ui,li,mi,ci,ti[6],76029189,23),ci=fi(ci,ui,li,mi,ti[9],3654602809,4),mi=fi(mi,ci,ui,li,ti[12],3873151461,11),li=fi(li,mi,ci,ui,ti[15],530742520,16),ui=fi(ui,li,mi,ci,ti[2],3299628645,23),ci=ai(ci,ui,li,mi,ti[0],4096336452,6),mi=ai(mi,ci,ui,li,ti[7],1126891415,10),li=ai(li,mi,ci,ui,ti[14],2878612391,15),ui=ai(ui,li,mi,ci,ti[5],4237533241,21),ci=ai(ci,ui,li,mi,ti[12],1700485571,6),mi=ai(mi,ci,ui,li,ti[3],2399980690,10),li=ai(li,mi,ci,ui,ti[10],4293915773,15),ui=ai(ui,li,mi,ci,ti[1],2240044497,21),ci=ai(ci,ui,li,mi,ti[8],1873313359,6),mi=ai(mi,ci,ui,li,ti[15],4264355552,10),li=ai(li,mi,ci,ui,ti[6],2734768916,15),ui=ai(ui,li,mi,ci,ti[13],1309151649,21),ci=ai(ci,ui,li,mi,ti[4],4149444226,6),mi=ai(mi,ci,ui,li,ti[11],3174756917,10),li=ai(li,mi,ci,ui,ti[2],718787259,15),ui=ai(ui,li,mi,ci,ti[9],3951481745,21),this._a=this._a+ci|0,this._b=this._b+ui|0,this._c=this._c+li|0,this._d=this._d+mi|0},Ne.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var ti=H.allocUnsafe(16);return ti.writeInt32LE(this._a,0),ti.writeInt32LE(this._b,4),ti.writeInt32LE(this._c,8),ti.writeInt32LE(this._d,12),ti};function W(ti,hi){return ti<>>32-hi}function ri(ti,hi,ci,ui,li,mi,hn){return W(ti+(hi&ci|~hi&ui)+li+mi|0,hn)+hi|0}function si(ti,hi,ci,ui,li,mi,hn){return W(ti+(hi&ui|ci&~ui)+li+mi|0,hn)+hi|0}function fi(ti,hi,ci,ui,li,mi,hn){return W(ti+(hi^ci^ui)+li+mi|0,hn)+hi|0}function ai(ti,hi,ci,ui,li,mi,hn){return W(ti+(ci^(hi|~ui))+li+mi|0,hn)+hi|0}return md5_js=Ne,md5_js}var ripemd160,hasRequiredRipemd160;function requireRipemd160(){if(hasRequiredRipemd160)return ripemd160;hasRequiredRipemd160=1;var G=require$$0$3.Buffer,e=inherits_browserExports,H=requireHashBase(),Y=new Array(16),Ne=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13],W=[5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11],ri=[11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6],si=[8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11],fi=[0,1518500249,1859775393,2400959708,2840853838],ai=[1352829926,1548603684,1836072691,2053994217,0];function ti(){H.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}e(ti,H),ti.prototype._update=function(){for(var ln=Y,fn=0;fn<16;++fn)ln[fn]=this._block.readInt32LE(fn*4);for(var gn=this._a|0,cn=this._b|0,An=this._c|0,Cn=this._d|0,an=this._e|0,Rn=this._a|0,Ya=this._b|0,Ho=this._c|0,oi=this._d|0,t=this._e|0,F=0;F<80;F+=1){var Ie,Te;F<16?(Ie=ci(gn,cn,An,Cn,an,ln[Ne[F]],fi[0],ri[F]),Te=hn(Rn,Ya,Ho,oi,t,ln[W[F]],ai[0],si[F])):F<32?(Ie=ui(gn,cn,An,Cn,an,ln[Ne[F]],fi[1],ri[F]),Te=mi(Rn,Ya,Ho,oi,t,ln[W[F]],ai[1],si[F])):F<48?(Ie=li(gn,cn,An,Cn,an,ln[Ne[F]],fi[2],ri[F]),Te=li(Rn,Ya,Ho,oi,t,ln[W[F]],ai[2],si[F])):F<64?(Ie=mi(gn,cn,An,Cn,an,ln[Ne[F]],fi[3],ri[F]),Te=ui(Rn,Ya,Ho,oi,t,ln[W[F]],ai[3],si[F])):(Ie=hn(gn,cn,An,Cn,an,ln[Ne[F]],fi[4],ri[F]),Te=ci(Rn,Ya,Ho,oi,t,ln[W[F]],ai[4],si[F])),gn=an,an=Cn,Cn=hi(An,10),An=cn,cn=Ie,Rn=t,t=oi,oi=hi(Ho,10),Ho=Ya,Ya=Te}var Xr=this._b+An+oi|0;this._b=this._c+Cn+t|0,this._c=this._d+an+Rn|0,this._d=this._e+gn+Ya|0,this._e=this._a+cn+Ho|0,this._a=Xr},ti.prototype._digest=function(){this._block[this._blockOffset++]=128,this._blockOffset>56&&(this._block.fill(0,this._blockOffset,64),this._update(),this._blockOffset=0),this._block.fill(0,this._blockOffset,56),this._block.writeUInt32LE(this._length[0],56),this._block.writeUInt32LE(this._length[1],60),this._update();var ln=G.alloc?G.alloc(20):new G(20);return ln.writeInt32LE(this._a,0),ln.writeInt32LE(this._b,4),ln.writeInt32LE(this._c,8),ln.writeInt32LE(this._d,12),ln.writeInt32LE(this._e,16),ln};function hi(ln,fn){return ln<>>32-fn}function ci(ln,fn,gn,cn,An,Cn,an,Rn){return hi(ln+(fn^gn^cn)+Cn+an|0,Rn)+An|0}function ui(ln,fn,gn,cn,An,Cn,an,Rn){return hi(ln+(fn&gn|~fn&cn)+Cn+an|0,Rn)+An|0}function li(ln,fn,gn,cn,An,Cn,an,Rn){return hi(ln+((fn|~gn)^cn)+Cn+an|0,Rn)+An|0}function mi(ln,fn,gn,cn,An,Cn,an,Rn){return hi(ln+(fn&cn|gn&~cn)+Cn+an|0,Rn)+An|0}function hn(ln,fn,gn,cn,An,Cn,an,Rn){return hi(ln+(fn^(gn|~cn))+Cn+an|0,Rn)+An|0}return ripemd160=ti,ripemd160}var cipherBase,hasRequiredCipherBase;function requireCipherBase(){if(hasRequiredCipherBase)return cipherBase;hasRequiredCipherBase=1;var G=safeBufferExports.Buffer,e=requireStreamBrowserify().Transform,H=requireString_decoder().StringDecoder,Y=inherits_browserExports;function Ne(W){e.call(this),this.hashMode=typeof W=="string",this.hashMode?this[W]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}return Y(Ne,e),Ne.prototype.update=function(W,ri,si){typeof W=="string"&&(W=G.from(W,ri));var fi=this._update(W);return this.hashMode?this:(si&&(fi=this._toString(fi,si)),fi)},Ne.prototype.setAutoPadding=function(){},Ne.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")},Ne.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")},Ne.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")},Ne.prototype._transform=function(W,ri,si){var fi;try{this.hashMode?this._update(W):this.push(this._update(W))}catch(ai){fi=ai}finally{si(fi)}},Ne.prototype._flush=function(W){var ri;try{this.push(this.__final())}catch(si){ri=si}W(ri)},Ne.prototype._finalOrDigest=function(W){var ri=this.__final()||G.alloc(0);return W&&(ri=this._toString(ri,W,!0)),ri},Ne.prototype._toString=function(W,ri,si){if(this._decoder||(this._decoder=new H(ri),this._encoding=ri),this._encoding!==ri)throw new Error("can't switch encodings");var fi=this._decoder.write(W);return si&&(fi+=this._decoder.end()),fi},cipherBase=Ne,cipherBase}var browser$b,hasRequiredBrowser$9;function requireBrowser$9(){if(hasRequiredBrowser$9)return browser$b;hasRequiredBrowser$9=1;var G=inherits_browserExports,e=requireMd5_js(),H=requireRipemd160(),Y=sha_jsExports,Ne=requireCipherBase();function W(ri){Ne.call(this,"digest"),this._hash=ri}return G(W,Ne),W.prototype._update=function(ri){this._hash.update(ri)},W.prototype._final=function(){return this._hash.digest()},browser$b=function(si){return si=si.toLowerCase(),si==="md5"?new e:si==="rmd160"||si==="ripemd160"?new H:new W(Y(si))},browser$b}var legacy,hasRequiredLegacy;function requireLegacy(){if(hasRequiredLegacy)return legacy;hasRequiredLegacy=1;var G=inherits_browserExports,e=safeBufferExports.Buffer,H=requireCipherBase(),Y=e.alloc(128),Ne=64;function W(ri,si){H.call(this,"digest"),typeof si=="string"&&(si=e.from(si)),this._alg=ri,this._key=si,si.length>Ne?si=ri(si):si.lengthhi){var ci=ai==="rmd160"?new W:ri(ai);ti=ci.update(ti).digest()}else ti.lengthG||H!==H)throw new TypeError("Bad key length")},precondition}var defaultEncoding_1,hasRequiredDefaultEncoding;function requireDefaultEncoding(){if(hasRequiredDefaultEncoding)return defaultEncoding_1;hasRequiredDefaultEncoding=1;var G;if(commonjsGlobal.process&&commonjsGlobal.process.browser)G="utf-8";else if(commonjsGlobal.process&&commonjsGlobal.process.version){var e=parseInt(process$1.version.split(".")[0].slice(1),10);G=e>=6?"utf-8":"binary"}else G="utf-8";return defaultEncoding_1=G,defaultEncoding_1}var toBuffer,hasRequiredToBuffer;function requireToBuffer(){if(hasRequiredToBuffer)return toBuffer;hasRequiredToBuffer=1;var G=safeBufferExports.Buffer;return toBuffer=function(e,H,Y){if(G.isBuffer(e))return e;if(typeof e=="string")return G.from(e,H);if(ArrayBuffer.isView(e))return G.from(e.buffer);throw new TypeError(Y+" must be a string, a Buffer, a typed array or a DataView")},toBuffer}var syncBrowser,hasRequiredSyncBrowser;function requireSyncBrowser(){if(hasRequiredSyncBrowser)return syncBrowser;hasRequiredSyncBrowser=1;var G=requireMd5(),e=requireRipemd160(),H=sha_jsExports,Y=safeBufferExports.Buffer,Ne=requirePrecondition(),W=requireDefaultEncoding(),ri=requireToBuffer(),si=Y.alloc(128),fi={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,rmd160:20,ripemd160:20};function ai(ci,ui,li){var mi=ti(ci),hn=ci==="sha512"||ci==="sha384"?128:64;ui.length>hn?ui=mi(ui):ui.length>>0},utils$3.writeUInt32BE=function(Ne,W,ri){Ne[0+ri]=W>>>24,Ne[1+ri]=W>>>16&255,Ne[2+ri]=W>>>8&255,Ne[3+ri]=W&255},utils$3.ip=function(Ne,W,ri,si){for(var fi=0,ai=0,ti=6;ti>=0;ti-=2){for(var hi=0;hi<=24;hi+=8)fi<<=1,fi|=W>>>hi+ti&1;for(var hi=0;hi<=24;hi+=8)fi<<=1,fi|=Ne>>>hi+ti&1}for(var ti=6;ti>=0;ti-=2){for(var hi=1;hi<=25;hi+=8)ai<<=1,ai|=W>>>hi+ti&1;for(var hi=1;hi<=25;hi+=8)ai<<=1,ai|=Ne>>>hi+ti&1}ri[si+0]=fi>>>0,ri[si+1]=ai>>>0},utils$3.rip=function(Ne,W,ri,si){for(var fi=0,ai=0,ti=0;ti<4;ti++)for(var hi=24;hi>=0;hi-=8)fi<<=1,fi|=W>>>hi+ti&1,fi<<=1,fi|=Ne>>>hi+ti&1;for(var ti=4;ti<8;ti++)for(var hi=24;hi>=0;hi-=8)ai<<=1,ai|=W>>>hi+ti&1,ai<<=1,ai|=Ne>>>hi+ti&1;ri[si+0]=fi>>>0,ri[si+1]=ai>>>0},utils$3.pc1=function(Ne,W,ri,si){for(var fi=0,ai=0,ti=7;ti>=5;ti--){for(var hi=0;hi<=24;hi+=8)fi<<=1,fi|=W>>hi+ti&1;for(var hi=0;hi<=24;hi+=8)fi<<=1,fi|=Ne>>hi+ti&1}for(var hi=0;hi<=24;hi+=8)fi<<=1,fi|=W>>hi+ti&1;for(var ti=1;ti<=3;ti++){for(var hi=0;hi<=24;hi+=8)ai<<=1,ai|=W>>hi+ti&1;for(var hi=0;hi<=24;hi+=8)ai<<=1,ai|=Ne>>hi+ti&1}for(var hi=0;hi<=24;hi+=8)ai<<=1,ai|=Ne>>hi+ti&1;ri[si+0]=fi>>>0,ri[si+1]=ai>>>0},utils$3.r28shl=function(Ne,W){return Ne<>>28-W};var G=[14,11,17,4,27,23,25,0,13,22,7,18,5,9,16,24,2,20,12,21,1,8,15,26,15,4,25,19,9,1,26,16,5,11,23,8,12,7,17,0,22,3,10,14,6,20,27,24];utils$3.pc2=function(Ne,W,ri,si){for(var fi=0,ai=0,ti=G.length>>>1,hi=0;hi>>G[hi]&1;for(var hi=ti;hi>>G[hi]&1;ri[si+0]=fi>>>0,ri[si+1]=ai>>>0},utils$3.expand=function(Ne,W,ri){var si=0,fi=0;si=(Ne&1)<<5|Ne>>>27;for(var ai=23;ai>=15;ai-=4)si<<=6,si|=Ne>>>ai&63;for(var ai=11;ai>=3;ai-=4)fi|=Ne>>>ai&63,fi<<=6;fi|=(Ne&31)<<1|Ne>>>31,W[ri+0]=si>>>0,W[ri+1]=fi>>>0};var e=[14,0,4,15,13,7,1,4,2,14,15,2,11,13,8,1,3,10,10,6,6,12,12,11,5,9,9,5,0,3,7,8,4,15,1,12,14,8,8,2,13,4,6,9,2,1,11,7,15,5,12,11,9,3,7,14,3,10,10,0,5,6,0,13,15,3,1,13,8,4,14,7,6,15,11,2,3,8,4,14,9,12,7,0,2,1,13,10,12,6,0,9,5,11,10,5,0,13,14,8,7,10,11,1,10,3,4,15,13,4,1,2,5,11,8,6,12,7,6,12,9,0,3,5,2,14,15,9,10,13,0,7,9,0,14,9,6,3,3,4,15,6,5,10,1,2,13,8,12,5,7,14,11,12,4,11,2,15,8,1,13,1,6,10,4,13,9,0,8,6,15,9,3,8,0,7,11,4,1,15,2,14,12,3,5,11,10,5,14,2,7,12,7,13,13,8,14,11,3,5,0,6,6,15,9,0,10,3,1,4,2,7,8,2,5,12,11,1,12,10,4,14,15,9,10,3,6,15,9,0,0,6,12,10,11,1,7,13,13,8,15,9,1,4,3,5,14,11,5,12,2,7,8,2,4,14,2,14,12,11,4,2,1,12,7,4,10,7,11,13,6,1,8,5,5,0,3,15,15,10,13,3,0,9,14,8,9,6,4,11,2,8,1,12,11,7,10,1,13,14,7,2,8,13,15,6,9,15,12,0,5,9,6,10,3,4,0,5,14,3,12,10,1,15,10,4,15,2,9,7,2,12,6,9,8,5,0,6,13,1,3,13,4,14,14,0,7,11,5,3,11,8,9,4,14,3,15,2,5,12,2,9,8,5,12,15,3,10,7,11,0,14,4,1,10,7,1,6,13,0,11,8,6,13,4,13,11,0,2,11,14,7,15,4,0,9,8,1,13,10,3,14,12,3,9,5,7,12,5,2,10,15,6,8,1,6,1,6,4,11,11,13,13,8,12,1,3,4,7,10,14,7,10,9,15,5,6,0,8,15,0,14,5,2,9,3,2,12,13,1,2,15,8,13,4,8,6,10,15,3,11,7,1,4,10,12,9,5,3,6,14,11,5,0,0,14,12,9,7,2,7,2,11,1,4,14,1,7,9,4,12,10,14,8,2,13,0,15,6,12,10,9,13,0,15,3,3,5,5,6,8,11];utils$3.substitute=function(Ne,W){for(var ri=0,si=0;si<4;si++){var fi=Ne>>>18-si*6&63,ai=e[si*64+fi];ri<<=4,ri|=ai}for(var si=0;si<4;si++){var fi=W>>>18-si*6&63,ai=e[4*64+si*64+fi];ri<<=4,ri|=ai}return ri>>>0};var H=[16,25,12,11,3,20,4,15,31,17,9,6,27,14,1,22,30,24,8,18,0,5,29,23,13,19,2,26,10,21,28,7];return utils$3.permute=function(Ne){for(var W=0,ri=0;ri>>H[ri]&1;return W>>>0},utils$3.padSplit=function(Ne,W,ri){for(var si=Ne.toString(2);si.length0;ri--)Ne+=this._buffer(Y,Ne),W+=this._flushBuffer(si,W);return Ne+=this._buffer(Y,Ne),si},e.prototype.final=function(Y){var Ne;Y&&(Ne=this.update(Y));var W;return this.type==="encrypt"?W=this._finalEncrypt():W=this._finalDecrypt(),Ne?Ne.concat(W):W},e.prototype._pad=function(Y,Ne){if(Ne===0)return!1;for(;Ne>>1];ti=H.r28shl(ti,ui),hi=H.r28shl(hi,ui),H.pc2(ti,hi,fi.keys,ci)}},W.prototype._update=function(fi,ai,ti,hi){var ci=this._desState,ui=H.readUInt32BE(fi,ai),li=H.readUInt32BE(fi,ai+4);H.ip(ui,li,ci.tmp,0),ui=ci.tmp[0],li=ci.tmp[1],this.type==="encrypt"?this._encrypt(ci,ui,li,ci.tmp,0):this._decrypt(ci,ui,li,ci.tmp,0),ui=ci.tmp[0],li=ci.tmp[1],H.writeUInt32BE(ti,ui,hi),H.writeUInt32BE(ti,li,hi+4)},W.prototype._pad=function(fi,ai){if(this.padding===!1)return!1;for(var ti=fi.length-ai,hi=ai;hi>>0,ui=cn}H.rip(li,ui,hi,ci)},W.prototype._decrypt=function(fi,ai,ti,hi,ci){for(var ui=ti,li=ai,mi=fi.keys.length-2;mi>=0;mi-=2){var hn=fi.keys[mi],ln=fi.keys[mi+1];H.expand(ui,fi.tmp,0),hn^=fi.tmp[0],ln^=fi.tmp[1];var fn=H.substitute(hn,ln),gn=H.permute(fn),cn=ui;ui=(li^gn)>>>0,li=cn}H.rip(ui,li,hi,ci)},des}var cbc$1={},hasRequiredCbc$1;function requireCbc$1(){if(hasRequiredCbc$1)return cbc$1;hasRequiredCbc$1=1;var G=requireMinimalisticAssert(),e=inherits_browserExports,H={};function Y(W){G.equal(W.length,8,"Invalid IV length"),this.iv=new Array(8);for(var ri=0;ri>si%8,Y._prev=H(Y._prev,W?ti:hi);return ai}function H(Y,Ne){var W=Y.length,ri=-1,si=G.allocUnsafe(Y.length);for(Y=G.concat([Y,G.from([Ne])]);++ri>7;return si}return cfb1.encrypt=function(Y,Ne,W){for(var ri=Ne.length,si=G.allocUnsafe(ri),fi=-1;++fi>>24]^ui[ln>>>16&255]^li[fn>>>8&255]^mi[gn&255]^fi[Rn++],An=ci[ln>>>24]^ui[fn>>>16&255]^li[gn>>>8&255]^mi[hn&255]^fi[Rn++],Cn=ci[fn>>>24]^ui[gn>>>16&255]^li[hn>>>8&255]^mi[ln&255]^fi[Rn++],an=ci[gn>>>24]^ui[hn>>>16&255]^li[ln>>>8&255]^mi[fn&255]^fi[Rn++],hn=cn,ln=An,fn=Cn,gn=an;return cn=(ti[hn>>>24]<<24|ti[ln>>>16&255]<<16|ti[fn>>>8&255]<<8|ti[gn&255])^fi[Rn++],An=(ti[ln>>>24]<<24|ti[fn>>>16&255]<<16|ti[gn>>>8&255]<<8|ti[hn&255])^fi[Rn++],Cn=(ti[fn>>>24]<<24|ti[gn>>>16&255]<<16|ti[hn>>>8&255]<<8|ti[ln&255])^fi[Rn++],an=(ti[gn>>>24]<<24|ti[hn>>>16&255]<<16|ti[ln>>>8&255]<<8|ti[fn&255])^fi[Rn++],cn=cn>>>0,An=An>>>0,Cn=Cn>>>0,an=an>>>0,[cn,An,Cn,an]}var Ne=[0,1,2,4,8,16,32,64,128,27,54],W=function(){for(var si=new Array(256),fi=0;fi<256;fi++)fi<128?si[fi]=fi<<1:si[fi]=fi<<1^283;for(var ai=[],ti=[],hi=[[],[],[],[]],ci=[[],[],[],[]],ui=0,li=0,mi=0;mi<256;++mi){var hn=li^li<<1^li<<2^li<<3^li<<4;hn=hn>>>8^hn&255^99,ai[ui]=hn,ti[hn]=ui;var ln=si[ui],fn=si[ln],gn=si[fn],cn=si[hn]*257^hn*16843008;hi[0][ui]=cn<<24|cn>>>8,hi[1][ui]=cn<<16|cn>>>16,hi[2][ui]=cn<<8|cn>>>24,hi[3][ui]=cn,cn=gn*16843009^fn*65537^ln*257^ui*16843008,ci[0][hn]=cn<<24|cn>>>8,ci[1][hn]=cn<<16|cn>>>16,ci[2][hn]=cn<<8|cn>>>24,ci[3][hn]=cn,ui===0?ui=li=1:(ui=ln^si[si[si[gn^ln]]],li^=si[si[li]])}return{SBOX:ai,INV_SBOX:ti,SUB_MIX:hi,INV_SUB_MIX:ci}}();function ri(si){this._key=e(si),this._reset()}return ri.blockSize=4*4,ri.keySize=256/8,ri.prototype.blockSize=ri.blockSize,ri.prototype.keySize=ri.keySize,ri.prototype._reset=function(){for(var si=this._key,fi=si.length,ai=fi+6,ti=(ai+1)*4,hi=[],ci=0;ci>>24,ui=W.SBOX[ui>>>24]<<24|W.SBOX[ui>>>16&255]<<16|W.SBOX[ui>>>8&255]<<8|W.SBOX[ui&255],ui^=Ne[ci/fi|0]<<24):fi>6&&ci%fi===4&&(ui=W.SBOX[ui>>>24]<<24|W.SBOX[ui>>>16&255]<<16|W.SBOX[ui>>>8&255]<<8|W.SBOX[ui&255]),hi[ci]=hi[ci-fi]^ui}for(var li=[],mi=0;mi>>24]]^W.INV_SUB_MIX[1][W.SBOX[ln>>>16&255]]^W.INV_SUB_MIX[2][W.SBOX[ln>>>8&255]]^W.INV_SUB_MIX[3][W.SBOX[ln&255]]}this._nRounds=ai,this._keySchedule=hi,this._invKeySchedule=li},ri.prototype.encryptBlockRaw=function(si){return si=e(si),Y(si,this._keySchedule,W.SUB_MIX,W.SBOX,this._nRounds)},ri.prototype.encryptBlock=function(si){var fi=this.encryptBlockRaw(si),ai=G.allocUnsafe(16);return ai.writeUInt32BE(fi[0],0),ai.writeUInt32BE(fi[1],4),ai.writeUInt32BE(fi[2],8),ai.writeUInt32BE(fi[3],12),ai},ri.prototype.decryptBlock=function(si){si=e(si);var fi=si[1];si[1]=si[3],si[3]=fi;var ai=Y(si,this._invKeySchedule,W.INV_SUB_MIX,W.INV_SBOX,this._nRounds),ti=G.allocUnsafe(16);return ti.writeUInt32BE(ai[0],0),ti.writeUInt32BE(ai[3],4),ti.writeUInt32BE(ai[2],8),ti.writeUInt32BE(ai[1],12),ti},ri.prototype.scrub=function(){H(this._keySchedule),H(this._invKeySchedule),H(this._key)},aes.AES=ri,aes}var ghash,hasRequiredGhash;function requireGhash(){if(hasRequiredGhash)return ghash;hasRequiredGhash=1;var G=safeBufferExports.Buffer,e=G.alloc(16,0);function H(W){return[W.readUInt32BE(0),W.readUInt32BE(4),W.readUInt32BE(8),W.readUInt32BE(12)]}function Y(W){var ri=G.allocUnsafe(16);return ri.writeUInt32BE(W[0]>>>0,0),ri.writeUInt32BE(W[1]>>>0,4),ri.writeUInt32BE(W[2]>>>0,8),ri.writeUInt32BE(W[3]>>>0,12),ri}function Ne(W){this.h=W,this.state=G.alloc(16,0),this.cache=G.allocUnsafe(0)}return Ne.prototype.ghash=function(W){for(var ri=-1;++ri0;si--)W[si]=W[si]>>>1|(W[si-1]&1)<<31;W[0]=W[0]>>>1,ai&&(W[0]=W[0]^225<<24)}this.state=Y(ri)},Ne.prototype.update=function(W){this.cache=G.concat([this.cache,W]);for(var ri;this.cache.length>=16;)ri=this.cache.slice(0,16),this.cache=this.cache.slice(16),this.ghash(ri)},Ne.prototype.final=function(W,ri){return this.cache.length&&this.ghash(G.concat([this.cache,e],16)),this.ghash(Y([0,W,0,ri])),this.state},ghash=Ne,ghash}var authCipher,hasRequiredAuthCipher;function requireAuthCipher(){if(hasRequiredAuthCipher)return authCipher;hasRequiredAuthCipher=1;var G=requireAes(),e=safeBufferExports.Buffer,H=requireCipherBase(),Y=inherits_browserExports,Ne=requireGhash(),W=requireBufferXor(),ri=requireIncr32();function si(ti,hi){var ci=0;ti.length!==hi.length&&ci++;for(var ui=Math.min(ti.length,hi.length),li=0;li0||ri>0;){var hi=new e;hi.update(ti),hi.update(Y),Ne&&hi.update(Ne),ti=hi.digest();var ci=0;if(si>0){var ui=fi.length-si;ci=Math.min(si,ti.length),ti.copy(fi,ui,0,ci),si-=ci}if(ci0){var li=ai.length-ri,mi=Math.min(ri,ti.length-ci);ti.copy(ai,li,ci,ci+mi),ri-=mi}}return ti.fill(0),{key:fi,iv:ai}}return evp_bytestokey=H,evp_bytestokey}var hasRequiredEncrypter;function requireEncrypter(){if(hasRequiredEncrypter)return encrypter;hasRequiredEncrypter=1;var G=requireModes$1(),e=requireAuthCipher(),H=safeBufferExports.Buffer,Y=requireStreamCipher(),Ne=requireCipherBase(),W=requireAes(),ri=requireEvp_bytestokey(),si=inherits_browserExports;function fi(ui,li,mi){Ne.call(this),this._cache=new ti,this._cipher=new W.AES(li),this._prev=H.from(mi),this._mode=ui,this._autopadding=!0}si(fi,Ne),fi.prototype._update=function(ui){this._cache.add(ui);for(var li,mi,hn=[];li=this._cache.get();)mi=this._mode.encrypt(this,li),hn.push(mi);return H.concat(hn)};var ai=H.alloc(16,16);fi.prototype._final=function(){var ui=this._cache.flush();if(this._autopadding)return ui=this._mode.encrypt(this,ui),this._cipher.scrub(),ui;if(!ui.equals(ai))throw this._cipher.scrub(),new Error("data not multiple of block length")},fi.prototype.setAutoPadding=function(ui){return this._autopadding=!!ui,this};function ti(){this.cache=H.allocUnsafe(0)}ti.prototype.add=function(ui){this.cache=H.concat([this.cache,ui])},ti.prototype.get=function(){if(this.cache.length>15){var ui=this.cache.slice(0,16);return this.cache=this.cache.slice(16),ui}return null},ti.prototype.flush=function(){for(var ui=16-this.cache.length,li=H.allocUnsafe(ui),mi=-1;++mi16)return li=this.cache.slice(0,16),this.cache=this.cache.slice(16),li}else if(this.cache.length>=16)return li=this.cache.slice(0,16),this.cache=this.cache.slice(16),li;return null},ai.prototype.flush=function(){if(this.cache.length)return this.cache};function ti(ui){var li=ui[15];if(li<1||li>16)throw new Error("unable to decrypt data");for(var mi=-1;++mi0?t:F},W.min=function(t,F){return t.cmp(F)<0?t:F},W.prototype._init=function(t,F,Ie){if(typeof t=="number")return this._initNumber(t,F,Ie);if(typeof t=="object")return this._initArray(t,F,Ie);F==="hex"&&(F=16),Y(F===(F|0)&&F>=2&&F<=36),t=t.toString().replace(/\s+/g,"");var Te=0;t[0]==="-"&&(Te++,this.negative=1),Te=0;Te-=3)ei=t[Te]|t[Te-1]<<8|t[Te-2]<<16,this.words[Xr]|=ei<>>26-ii&67108863,ii+=24,ii>=26&&(ii-=26,Xr++);else if(Ie==="le")for(Te=0,Xr=0;Te>>26-ii&67108863,ii+=24,ii>=26&&(ii-=26,Xr++);return this.strip()};function si(oi,t){var F=oi.charCodeAt(t);return F>=65&&F<=70?F-55:F>=97&&F<=102?F-87:F-48&15}function fi(oi,t,F){var Ie=si(oi,F);return F-1>=t&&(Ie|=si(oi,F-1)<<4),Ie}W.prototype._parseHex=function(t,F,Ie){this.length=Math.ceil((t.length-F)/6),this.words=new Array(this.length);for(var Te=0;Te=F;Te-=2)ii=fi(t,F,Te)<=18?(Xr-=18,ei+=1,this.words[ei]|=ii>>>26):Xr+=8;else{var Wr=t.length-F;for(Te=Wr%2===0?F+1:F;Te=18?(Xr-=18,ei+=1,this.words[ei]|=ii>>>26):Xr+=8}this.strip()};function ai(oi,t,F,Ie){for(var Te=0,Xr=Math.min(oi.length,F),ei=t;ei=49?Te+=ii-49+10:ii>=17?Te+=ii-17+10:Te+=ii}return Te}W.prototype._parseBase=function(t,F,Ie){this.words=[0],this.length=1;for(var Te=0,Xr=1;Xr<=67108863;Xr*=F)Te++;Te--,Xr=Xr/F|0;for(var ei=t.length-Ie,ii=ei%Te,Wr=Math.min(ei,ei-ii)+Ie,R=0,Le=Ie;Le1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},W.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},W.prototype.inspect=function(){return(this.red?""};var ti=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],hi=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],ci=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];W.prototype.toString=function(t,F){t=t||10,F=F|0||1;var Ie;if(t===16||t==="hex"){Ie="";for(var Te=0,Xr=0,ei=0;ei>>24-Te&16777215,Xr!==0||ei!==this.length-1?Ie=ti[6-Wr.length]+Wr+Ie:Ie=Wr+Ie,Te+=2,Te>=26&&(Te-=26,ei--)}for(Xr!==0&&(Ie=Xr.toString(16)+Ie);Ie.length%F!==0;)Ie="0"+Ie;return this.negative!==0&&(Ie="-"+Ie),Ie}if(t===(t|0)&&t>=2&&t<=36){var R=hi[t],Le=ci[t];Ie="";var nn=this.clone();for(nn.negative=0;!nn.isZero();){var vn=nn.modn(Le).toString(t);nn=nn.idivn(Le),nn.isZero()?Ie=vn+Ie:Ie=ti[R-vn.length]+vn+Ie}for(this.isZero()&&(Ie="0"+Ie);Ie.length%F!==0;)Ie="0"+Ie;return this.negative!==0&&(Ie="-"+Ie),Ie}Y(!1,"Base should be between 2 and 36")},W.prototype.toNumber=function(){var t=this.words[0];return this.length===2?t+=this.words[1]*67108864:this.length===3&&this.words[2]===1?t+=4503599627370496+this.words[1]*67108864:this.length>2&&Y(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-t:t},W.prototype.toJSON=function(){return this.toString(16)},W.prototype.toBuffer=function(t,F){return Y(typeof ri<"u"),this.toArrayLike(ri,t,F)},W.prototype.toArray=function(t,F){return this.toArrayLike(Array,t,F)},W.prototype.toArrayLike=function(t,F,Ie){var Te=this.byteLength(),Xr=Ie||Math.max(1,Te);Y(Te<=Xr,"byte array longer than desired length"),Y(Xr>0,"Requested array length <= 0"),this.strip();var ei=F==="le",ii=new t(Xr),Wr,R,Le=this.clone();if(ei){for(R=0;!Le.isZero();R++)Wr=Le.andln(255),Le.iushrn(8),ii[R]=Wr;for(;R=4096&&(Ie+=13,F>>>=13),F>=64&&(Ie+=7,F>>>=7),F>=8&&(Ie+=4,F>>>=4),F>=2&&(Ie+=2,F>>>=2),Ie+F},W.prototype._zeroBits=function(t){if(t===0)return 26;var F=t,Ie=0;return F&8191||(Ie+=13,F>>>=13),F&127||(Ie+=7,F>>>=7),F&15||(Ie+=4,F>>>=4),F&3||(Ie+=2,F>>>=2),F&1||Ie++,Ie},W.prototype.bitLength=function(){var t=this.words[this.length-1],F=this._countBits(t);return(this.length-1)*26+F};function ui(oi){for(var t=new Array(oi.bitLength()),F=0;F>>Te}return t}W.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,F=0;Ft.length?this.clone().ior(t):t.clone().ior(this)},W.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},W.prototype.iuand=function(t){var F;this.length>t.length?F=t:F=this;for(var Ie=0;Iet.length?this.clone().iand(t):t.clone().iand(this)},W.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},W.prototype.iuxor=function(t){var F,Ie;this.length>t.length?(F=this,Ie=t):(F=t,Ie=this);for(var Te=0;Tet.length?this.clone().ixor(t):t.clone().ixor(this)},W.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},W.prototype.inotn=function(t){Y(typeof t=="number"&&t>=0);var F=Math.ceil(t/26)|0,Ie=t%26;this._expand(F),Ie>0&&F--;for(var Te=0;Te0&&(this.words[Te]=~this.words[Te]&67108863>>26-Ie),this.strip()},W.prototype.notn=function(t){return this.clone().inotn(t)},W.prototype.setn=function(t,F){Y(typeof t=="number"&&t>=0);var Ie=t/26|0,Te=t%26;return this._expand(Ie+1),F?this.words[Ie]=this.words[Ie]|1<t.length?(Ie=this,Te=t):(Ie=t,Te=this);for(var Xr=0,ei=0;ei>>26;for(;Xr!==0&&ei>>26;if(this.length=Ie.length,Xr!==0)this.words[this.length]=Xr,this.length++;else if(Ie!==this)for(;eit.length?this.clone().iadd(t):t.clone().iadd(this)},W.prototype.isub=function(t){if(t.negative!==0){t.negative=0;var F=this.iadd(t);return t.negative=1,F._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var Ie=this.cmp(t);if(Ie===0)return this.negative=0,this.length=1,this.words[0]=0,this;var Te,Xr;Ie>0?(Te=this,Xr=t):(Te=t,Xr=this);for(var ei=0,ii=0;ii>26,this.words[ii]=F&67108863;for(;ei!==0&&ii>26,this.words[ii]=F&67108863;if(ei===0&&ii>>26,nn=Wr&67108863,vn=Math.min(R,t.length-1),Mn=Math.max(0,R-oi.length+1);Mn<=vn;Mn++){var sn=R-Mn|0;Te=oi.words[sn]|0,Xr=t.words[Mn]|0,ei=Te*Xr+nn,Le+=ei/67108864|0,nn=ei&67108863}F.words[R]=nn|0,Wr=Le|0}return Wr!==0?F.words[R]=Wr|0:F.length--,F.strip()}var mi=function(t,F,Ie){var Te=t.words,Xr=F.words,ei=Ie.words,ii=0,Wr,R,Le,nn=Te[0]|0,vn=nn&8191,Mn=nn>>>13,sn=Te[1]|0,Zn=sn&8191,on=sn>>>13,pn=Te[2]|0,mn=pn&8191,$i=pn>>>13,ho=Te[3]|0,Do=ho&8191,To=ho>>>13,Oh=Te[4]|0,Fo=Oh&8191,Vo=Oh>>>13,Hh=Te[5]|0,Ah=Hh&8191,Qf=Hh>>>13,Gh=Te[6]|0,tf=Gh&8191,Ko=Gh>>>13,Kh=Te[7]|0,Lf=Kh&8191,Uo=Kh>>>13,Vh=Te[8]|0,jf=Vh&8191,Zo=Vh>>>13,Wh=Te[9]|0,vh=Wh&8191,Yo=Wh>>>13,Jh=Xr[0]|0,xh=Jh&8191,Vf=Jh>>>13,Zh=Xr[1]|0,Ch=Zh&8191,Eh=Zh>>>13,Lu=Xr[2]|0,Ph=Lu&8191,Sh=Lu>>>13,Uu=Xr[3]|0,Th=Uu&8191,gh=Uu>>>13,Xh=Xr[4]|0,Rh=Xh&8191,bh=Xh>>>13,au=Xr[5]|0,$h=au&8191,wh=au>>>13,qu=Xr[6]|0,Ih=qu&8191,_h=qu>>>13,uu=Xr[7]|0,Dh=uu&8191,yh=uu>>>13,Yh=Xr[8]|0,Bh=Yh&8191,Mh=Yh>>>13,Hu=Xr[9]|0,kh=Hu&8191,qh=Hu>>>13;Ie.negative=t.negative^F.negative,Ie.length=19,Wr=Math.imul(vn,xh),R=Math.imul(vn,Vf),R=R+Math.imul(Mn,xh)|0,Le=Math.imul(Mn,Vf);var Tu=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(Tu>>>26)|0,Tu&=67108863,Wr=Math.imul(Zn,xh),R=Math.imul(Zn,Vf),R=R+Math.imul(on,xh)|0,Le=Math.imul(on,Vf),Wr=Wr+Math.imul(vn,Ch)|0,R=R+Math.imul(vn,Eh)|0,R=R+Math.imul(Mn,Ch)|0,Le=Le+Math.imul(Mn,Eh)|0;var tc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(tc>>>26)|0,tc&=67108863,Wr=Math.imul(mn,xh),R=Math.imul(mn,Vf),R=R+Math.imul($i,xh)|0,Le=Math.imul($i,Vf),Wr=Wr+Math.imul(Zn,Ch)|0,R=R+Math.imul(Zn,Eh)|0,R=R+Math.imul(on,Ch)|0,Le=Le+Math.imul(on,Eh)|0,Wr=Wr+Math.imul(vn,Ph)|0,R=R+Math.imul(vn,Sh)|0,R=R+Math.imul(Mn,Ph)|0,Le=Le+Math.imul(Mn,Sh)|0;var rc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(rc>>>26)|0,rc&=67108863,Wr=Math.imul(Do,xh),R=Math.imul(Do,Vf),R=R+Math.imul(To,xh)|0,Le=Math.imul(To,Vf),Wr=Wr+Math.imul(mn,Ch)|0,R=R+Math.imul(mn,Eh)|0,R=R+Math.imul($i,Ch)|0,Le=Le+Math.imul($i,Eh)|0,Wr=Wr+Math.imul(Zn,Ph)|0,R=R+Math.imul(Zn,Sh)|0,R=R+Math.imul(on,Ph)|0,Le=Le+Math.imul(on,Sh)|0,Wr=Wr+Math.imul(vn,Th)|0,R=R+Math.imul(vn,gh)|0,R=R+Math.imul(Mn,Th)|0,Le=Le+Math.imul(Mn,gh)|0;var ic=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(ic>>>26)|0,ic&=67108863,Wr=Math.imul(Fo,xh),R=Math.imul(Fo,Vf),R=R+Math.imul(Vo,xh)|0,Le=Math.imul(Vo,Vf),Wr=Wr+Math.imul(Do,Ch)|0,R=R+Math.imul(Do,Eh)|0,R=R+Math.imul(To,Ch)|0,Le=Le+Math.imul(To,Eh)|0,Wr=Wr+Math.imul(mn,Ph)|0,R=R+Math.imul(mn,Sh)|0,R=R+Math.imul($i,Ph)|0,Le=Le+Math.imul($i,Sh)|0,Wr=Wr+Math.imul(Zn,Th)|0,R=R+Math.imul(Zn,gh)|0,R=R+Math.imul(on,Th)|0,Le=Le+Math.imul(on,gh)|0,Wr=Wr+Math.imul(vn,Rh)|0,R=R+Math.imul(vn,bh)|0,R=R+Math.imul(Mn,Rh)|0,Le=Le+Math.imul(Mn,bh)|0;var nc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(nc>>>26)|0,nc&=67108863,Wr=Math.imul(Ah,xh),R=Math.imul(Ah,Vf),R=R+Math.imul(Qf,xh)|0,Le=Math.imul(Qf,Vf),Wr=Wr+Math.imul(Fo,Ch)|0,R=R+Math.imul(Fo,Eh)|0,R=R+Math.imul(Vo,Ch)|0,Le=Le+Math.imul(Vo,Eh)|0,Wr=Wr+Math.imul(Do,Ph)|0,R=R+Math.imul(Do,Sh)|0,R=R+Math.imul(To,Ph)|0,Le=Le+Math.imul(To,Sh)|0,Wr=Wr+Math.imul(mn,Th)|0,R=R+Math.imul(mn,gh)|0,R=R+Math.imul($i,Th)|0,Le=Le+Math.imul($i,gh)|0,Wr=Wr+Math.imul(Zn,Rh)|0,R=R+Math.imul(Zn,bh)|0,R=R+Math.imul(on,Rh)|0,Le=Le+Math.imul(on,bh)|0,Wr=Wr+Math.imul(vn,$h)|0,R=R+Math.imul(vn,wh)|0,R=R+Math.imul(Mn,$h)|0,Le=Le+Math.imul(Mn,wh)|0;var sc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(sc>>>26)|0,sc&=67108863,Wr=Math.imul(tf,xh),R=Math.imul(tf,Vf),R=R+Math.imul(Ko,xh)|0,Le=Math.imul(Ko,Vf),Wr=Wr+Math.imul(Ah,Ch)|0,R=R+Math.imul(Ah,Eh)|0,R=R+Math.imul(Qf,Ch)|0,Le=Le+Math.imul(Qf,Eh)|0,Wr=Wr+Math.imul(Fo,Ph)|0,R=R+Math.imul(Fo,Sh)|0,R=R+Math.imul(Vo,Ph)|0,Le=Le+Math.imul(Vo,Sh)|0,Wr=Wr+Math.imul(Do,Th)|0,R=R+Math.imul(Do,gh)|0,R=R+Math.imul(To,Th)|0,Le=Le+Math.imul(To,gh)|0,Wr=Wr+Math.imul(mn,Rh)|0,R=R+Math.imul(mn,bh)|0,R=R+Math.imul($i,Rh)|0,Le=Le+Math.imul($i,bh)|0,Wr=Wr+Math.imul(Zn,$h)|0,R=R+Math.imul(Zn,wh)|0,R=R+Math.imul(on,$h)|0,Le=Le+Math.imul(on,wh)|0,Wr=Wr+Math.imul(vn,Ih)|0,R=R+Math.imul(vn,_h)|0,R=R+Math.imul(Mn,Ih)|0,Le=Le+Math.imul(Mn,_h)|0;var s0=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(s0>>>26)|0,s0&=67108863,Wr=Math.imul(Lf,xh),R=Math.imul(Lf,Vf),R=R+Math.imul(Uo,xh)|0,Le=Math.imul(Uo,Vf),Wr=Wr+Math.imul(tf,Ch)|0,R=R+Math.imul(tf,Eh)|0,R=R+Math.imul(Ko,Ch)|0,Le=Le+Math.imul(Ko,Eh)|0,Wr=Wr+Math.imul(Ah,Ph)|0,R=R+Math.imul(Ah,Sh)|0,R=R+Math.imul(Qf,Ph)|0,Le=Le+Math.imul(Qf,Sh)|0,Wr=Wr+Math.imul(Fo,Th)|0,R=R+Math.imul(Fo,gh)|0,R=R+Math.imul(Vo,Th)|0,Le=Le+Math.imul(Vo,gh)|0,Wr=Wr+Math.imul(Do,Rh)|0,R=R+Math.imul(Do,bh)|0,R=R+Math.imul(To,Rh)|0,Le=Le+Math.imul(To,bh)|0,Wr=Wr+Math.imul(mn,$h)|0,R=R+Math.imul(mn,wh)|0,R=R+Math.imul($i,$h)|0,Le=Le+Math.imul($i,wh)|0,Wr=Wr+Math.imul(Zn,Ih)|0,R=R+Math.imul(Zn,_h)|0,R=R+Math.imul(on,Ih)|0,Le=Le+Math.imul(on,_h)|0,Wr=Wr+Math.imul(vn,Dh)|0,R=R+Math.imul(vn,yh)|0,R=R+Math.imul(Mn,Dh)|0,Le=Le+Math.imul(Mn,yh)|0;var hc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(hc>>>26)|0,hc&=67108863,Wr=Math.imul(jf,xh),R=Math.imul(jf,Vf),R=R+Math.imul(Zo,xh)|0,Le=Math.imul(Zo,Vf),Wr=Wr+Math.imul(Lf,Ch)|0,R=R+Math.imul(Lf,Eh)|0,R=R+Math.imul(Uo,Ch)|0,Le=Le+Math.imul(Uo,Eh)|0,Wr=Wr+Math.imul(tf,Ph)|0,R=R+Math.imul(tf,Sh)|0,R=R+Math.imul(Ko,Ph)|0,Le=Le+Math.imul(Ko,Sh)|0,Wr=Wr+Math.imul(Ah,Th)|0,R=R+Math.imul(Ah,gh)|0,R=R+Math.imul(Qf,Th)|0,Le=Le+Math.imul(Qf,gh)|0,Wr=Wr+Math.imul(Fo,Rh)|0,R=R+Math.imul(Fo,bh)|0,R=R+Math.imul(Vo,Rh)|0,Le=Le+Math.imul(Vo,bh)|0,Wr=Wr+Math.imul(Do,$h)|0,R=R+Math.imul(Do,wh)|0,R=R+Math.imul(To,$h)|0,Le=Le+Math.imul(To,wh)|0,Wr=Wr+Math.imul(mn,Ih)|0,R=R+Math.imul(mn,_h)|0,R=R+Math.imul($i,Ih)|0,Le=Le+Math.imul($i,_h)|0,Wr=Wr+Math.imul(Zn,Dh)|0,R=R+Math.imul(Zn,yh)|0,R=R+Math.imul(on,Dh)|0,Le=Le+Math.imul(on,yh)|0,Wr=Wr+Math.imul(vn,Bh)|0,R=R+Math.imul(vn,Mh)|0,R=R+Math.imul(Mn,Bh)|0,Le=Le+Math.imul(Mn,Mh)|0;var pc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(pc>>>26)|0,pc&=67108863,Wr=Math.imul(vh,xh),R=Math.imul(vh,Vf),R=R+Math.imul(Yo,xh)|0,Le=Math.imul(Yo,Vf),Wr=Wr+Math.imul(jf,Ch)|0,R=R+Math.imul(jf,Eh)|0,R=R+Math.imul(Zo,Ch)|0,Le=Le+Math.imul(Zo,Eh)|0,Wr=Wr+Math.imul(Lf,Ph)|0,R=R+Math.imul(Lf,Sh)|0,R=R+Math.imul(Uo,Ph)|0,Le=Le+Math.imul(Uo,Sh)|0,Wr=Wr+Math.imul(tf,Th)|0,R=R+Math.imul(tf,gh)|0,R=R+Math.imul(Ko,Th)|0,Le=Le+Math.imul(Ko,gh)|0,Wr=Wr+Math.imul(Ah,Rh)|0,R=R+Math.imul(Ah,bh)|0,R=R+Math.imul(Qf,Rh)|0,Le=Le+Math.imul(Qf,bh)|0,Wr=Wr+Math.imul(Fo,$h)|0,R=R+Math.imul(Fo,wh)|0,R=R+Math.imul(Vo,$h)|0,Le=Le+Math.imul(Vo,wh)|0,Wr=Wr+Math.imul(Do,Ih)|0,R=R+Math.imul(Do,_h)|0,R=R+Math.imul(To,Ih)|0,Le=Le+Math.imul(To,_h)|0,Wr=Wr+Math.imul(mn,Dh)|0,R=R+Math.imul(mn,yh)|0,R=R+Math.imul($i,Dh)|0,Le=Le+Math.imul($i,yh)|0,Wr=Wr+Math.imul(Zn,Bh)|0,R=R+Math.imul(Zn,Mh)|0,R=R+Math.imul(on,Bh)|0,Le=Le+Math.imul(on,Mh)|0,Wr=Wr+Math.imul(vn,kh)|0,R=R+Math.imul(vn,qh)|0,R=R+Math.imul(Mn,kh)|0,Le=Le+Math.imul(Mn,qh)|0;var uc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(uc>>>26)|0,uc&=67108863,Wr=Math.imul(vh,Ch),R=Math.imul(vh,Eh),R=R+Math.imul(Yo,Ch)|0,Le=Math.imul(Yo,Eh),Wr=Wr+Math.imul(jf,Ph)|0,R=R+Math.imul(jf,Sh)|0,R=R+Math.imul(Zo,Ph)|0,Le=Le+Math.imul(Zo,Sh)|0,Wr=Wr+Math.imul(Lf,Th)|0,R=R+Math.imul(Lf,gh)|0,R=R+Math.imul(Uo,Th)|0,Le=Le+Math.imul(Uo,gh)|0,Wr=Wr+Math.imul(tf,Rh)|0,R=R+Math.imul(tf,bh)|0,R=R+Math.imul(Ko,Rh)|0,Le=Le+Math.imul(Ko,bh)|0,Wr=Wr+Math.imul(Ah,$h)|0,R=R+Math.imul(Ah,wh)|0,R=R+Math.imul(Qf,$h)|0,Le=Le+Math.imul(Qf,wh)|0,Wr=Wr+Math.imul(Fo,Ih)|0,R=R+Math.imul(Fo,_h)|0,R=R+Math.imul(Vo,Ih)|0,Le=Le+Math.imul(Vo,_h)|0,Wr=Wr+Math.imul(Do,Dh)|0,R=R+Math.imul(Do,yh)|0,R=R+Math.imul(To,Dh)|0,Le=Le+Math.imul(To,yh)|0,Wr=Wr+Math.imul(mn,Bh)|0,R=R+Math.imul(mn,Mh)|0,R=R+Math.imul($i,Bh)|0,Le=Le+Math.imul($i,Mh)|0,Wr=Wr+Math.imul(Zn,kh)|0,R=R+Math.imul(Zn,qh)|0,R=R+Math.imul(on,kh)|0,Le=Le+Math.imul(on,qh)|0;var vc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(vc>>>26)|0,vc&=67108863,Wr=Math.imul(vh,Ph),R=Math.imul(vh,Sh),R=R+Math.imul(Yo,Ph)|0,Le=Math.imul(Yo,Sh),Wr=Wr+Math.imul(jf,Th)|0,R=R+Math.imul(jf,gh)|0,R=R+Math.imul(Zo,Th)|0,Le=Le+Math.imul(Zo,gh)|0,Wr=Wr+Math.imul(Lf,Rh)|0,R=R+Math.imul(Lf,bh)|0,R=R+Math.imul(Uo,Rh)|0,Le=Le+Math.imul(Uo,bh)|0,Wr=Wr+Math.imul(tf,$h)|0,R=R+Math.imul(tf,wh)|0,R=R+Math.imul(Ko,$h)|0,Le=Le+Math.imul(Ko,wh)|0,Wr=Wr+Math.imul(Ah,Ih)|0,R=R+Math.imul(Ah,_h)|0,R=R+Math.imul(Qf,Ih)|0,Le=Le+Math.imul(Qf,_h)|0,Wr=Wr+Math.imul(Fo,Dh)|0,R=R+Math.imul(Fo,yh)|0,R=R+Math.imul(Vo,Dh)|0,Le=Le+Math.imul(Vo,yh)|0,Wr=Wr+Math.imul(Do,Bh)|0,R=R+Math.imul(Do,Mh)|0,R=R+Math.imul(To,Bh)|0,Le=Le+Math.imul(To,Mh)|0,Wr=Wr+Math.imul(mn,kh)|0,R=R+Math.imul(mn,qh)|0,R=R+Math.imul($i,kh)|0,Le=Le+Math.imul($i,qh)|0;var mc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(mc>>>26)|0,mc&=67108863,Wr=Math.imul(vh,Th),R=Math.imul(vh,gh),R=R+Math.imul(Yo,Th)|0,Le=Math.imul(Yo,gh),Wr=Wr+Math.imul(jf,Rh)|0,R=R+Math.imul(jf,bh)|0,R=R+Math.imul(Zo,Rh)|0,Le=Le+Math.imul(Zo,bh)|0,Wr=Wr+Math.imul(Lf,$h)|0,R=R+Math.imul(Lf,wh)|0,R=R+Math.imul(Uo,$h)|0,Le=Le+Math.imul(Uo,wh)|0,Wr=Wr+Math.imul(tf,Ih)|0,R=R+Math.imul(tf,_h)|0,R=R+Math.imul(Ko,Ih)|0,Le=Le+Math.imul(Ko,_h)|0,Wr=Wr+Math.imul(Ah,Dh)|0,R=R+Math.imul(Ah,yh)|0,R=R+Math.imul(Qf,Dh)|0,Le=Le+Math.imul(Qf,yh)|0,Wr=Wr+Math.imul(Fo,Bh)|0,R=R+Math.imul(Fo,Mh)|0,R=R+Math.imul(Vo,Bh)|0,Le=Le+Math.imul(Vo,Mh)|0,Wr=Wr+Math.imul(Do,kh)|0,R=R+Math.imul(Do,qh)|0,R=R+Math.imul(To,kh)|0,Le=Le+Math.imul(To,qh)|0;var cc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(cc>>>26)|0,cc&=67108863,Wr=Math.imul(vh,Rh),R=Math.imul(vh,bh),R=R+Math.imul(Yo,Rh)|0,Le=Math.imul(Yo,bh),Wr=Wr+Math.imul(jf,$h)|0,R=R+Math.imul(jf,wh)|0,R=R+Math.imul(Zo,$h)|0,Le=Le+Math.imul(Zo,wh)|0,Wr=Wr+Math.imul(Lf,Ih)|0,R=R+Math.imul(Lf,_h)|0,R=R+Math.imul(Uo,Ih)|0,Le=Le+Math.imul(Uo,_h)|0,Wr=Wr+Math.imul(tf,Dh)|0,R=R+Math.imul(tf,yh)|0,R=R+Math.imul(Ko,Dh)|0,Le=Le+Math.imul(Ko,yh)|0,Wr=Wr+Math.imul(Ah,Bh)|0,R=R+Math.imul(Ah,Mh)|0,R=R+Math.imul(Qf,Bh)|0,Le=Le+Math.imul(Qf,Mh)|0,Wr=Wr+Math.imul(Fo,kh)|0,R=R+Math.imul(Fo,qh)|0,R=R+Math.imul(Vo,kh)|0,Le=Le+Math.imul(Vo,qh)|0;var lc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(lc>>>26)|0,lc&=67108863,Wr=Math.imul(vh,$h),R=Math.imul(vh,wh),R=R+Math.imul(Yo,$h)|0,Le=Math.imul(Yo,wh),Wr=Wr+Math.imul(jf,Ih)|0,R=R+Math.imul(jf,_h)|0,R=R+Math.imul(Zo,Ih)|0,Le=Le+Math.imul(Zo,_h)|0,Wr=Wr+Math.imul(Lf,Dh)|0,R=R+Math.imul(Lf,yh)|0,R=R+Math.imul(Uo,Dh)|0,Le=Le+Math.imul(Uo,yh)|0,Wr=Wr+Math.imul(tf,Bh)|0,R=R+Math.imul(tf,Mh)|0,R=R+Math.imul(Ko,Bh)|0,Le=Le+Math.imul(Ko,Mh)|0,Wr=Wr+Math.imul(Ah,kh)|0,R=R+Math.imul(Ah,qh)|0,R=R+Math.imul(Qf,kh)|0,Le=Le+Math.imul(Qf,qh)|0;var dc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(dc>>>26)|0,dc&=67108863,Wr=Math.imul(vh,Ih),R=Math.imul(vh,_h),R=R+Math.imul(Yo,Ih)|0,Le=Math.imul(Yo,_h),Wr=Wr+Math.imul(jf,Dh)|0,R=R+Math.imul(jf,yh)|0,R=R+Math.imul(Zo,Dh)|0,Le=Le+Math.imul(Zo,yh)|0,Wr=Wr+Math.imul(Lf,Bh)|0,R=R+Math.imul(Lf,Mh)|0,R=R+Math.imul(Uo,Bh)|0,Le=Le+Math.imul(Uo,Mh)|0,Wr=Wr+Math.imul(tf,kh)|0,R=R+Math.imul(tf,qh)|0,R=R+Math.imul(Ko,kh)|0,Le=Le+Math.imul(Ko,qh)|0;var $0=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+($0>>>26)|0,$0&=67108863,Wr=Math.imul(vh,Dh),R=Math.imul(vh,yh),R=R+Math.imul(Yo,Dh)|0,Le=Math.imul(Yo,yh),Wr=Wr+Math.imul(jf,Bh)|0,R=R+Math.imul(jf,Mh)|0,R=R+Math.imul(Zo,Bh)|0,Le=Le+Math.imul(Zo,Mh)|0,Wr=Wr+Math.imul(Lf,kh)|0,R=R+Math.imul(Lf,qh)|0,R=R+Math.imul(Uo,kh)|0,Le=Le+Math.imul(Uo,qh)|0;var gc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(gc>>>26)|0,gc&=67108863,Wr=Math.imul(vh,Bh),R=Math.imul(vh,Mh),R=R+Math.imul(Yo,Bh)|0,Le=Math.imul(Yo,Mh),Wr=Wr+Math.imul(jf,kh)|0,R=R+Math.imul(jf,qh)|0,R=R+Math.imul(Zo,kh)|0,Le=Le+Math.imul(Zo,qh)|0;var bc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(bc>>>26)|0,bc&=67108863,Wr=Math.imul(vh,kh),R=Math.imul(vh,qh),R=R+Math.imul(Yo,kh)|0,Le=Math.imul(Yo,qh);var yc=(ii+Wr|0)+((R&8191)<<13)|0;return ii=(Le+(R>>>13)|0)+(yc>>>26)|0,yc&=67108863,ei[0]=Tu,ei[1]=tc,ei[2]=rc,ei[3]=ic,ei[4]=nc,ei[5]=sc,ei[6]=s0,ei[7]=hc,ei[8]=pc,ei[9]=uc,ei[10]=vc,ei[11]=mc,ei[12]=cc,ei[13]=lc,ei[14]=dc,ei[15]=$0,ei[16]=gc,ei[17]=bc,ei[18]=yc,ii!==0&&(ei[19]=ii,Ie.length++),Ie};Math.imul||(mi=li);function hn(oi,t,F){F.negative=t.negative^oi.negative,F.length=oi.length+t.length;for(var Ie=0,Te=0,Xr=0;Xr>>26)|0,Te+=ei>>>26,ei&=67108863}F.words[Xr]=ii,Ie=ei,ei=Te}return Ie!==0?F.words[Xr]=Ie:F.length--,F.strip()}function ln(oi,t,F){var Ie=new fn;return Ie.mulp(oi,t,F)}W.prototype.mulTo=function(t,F){var Ie,Te=this.length+t.length;return this.length===10&&t.length===10?Ie=mi(this,t,F):Te<63?Ie=li(this,t,F):Te<1024?Ie=hn(this,t,F):Ie=ln(this,t,F),Ie};function fn(oi,t){this.x=oi,this.y=t}fn.prototype.makeRBT=function(t){for(var F=new Array(t),Ie=W.prototype._countBits(t)-1,Te=0;Te>=1;return Te},fn.prototype.permute=function(t,F,Ie,Te,Xr,ei){for(var ii=0;ii>>1)Xr++;return 1<>>13,Ie[2*ei+1]=Xr&8191,Xr=Xr>>>13;for(ei=2*F;ei>=26,F+=Te/67108864|0,F+=Xr>>>26,this.words[Ie]=Xr&67108863}return F!==0&&(this.words[Ie]=F,this.length++),this},W.prototype.muln=function(t){return this.clone().imuln(t)},W.prototype.sqr=function(){return this.mul(this)},W.prototype.isqr=function(){return this.imul(this.clone())},W.prototype.pow=function(t){var F=ui(t);if(F.length===0)return new W(1);for(var Ie=this,Te=0;Te=0);var F=t%26,Ie=(t-F)/26,Te=67108863>>>26-F<<26-F,Xr;if(F!==0){var ei=0;for(Xr=0;Xr>>26-F}ei&&(this.words[Xr]=ei,this.length++)}if(Ie!==0){for(Xr=this.length-1;Xr>=0;Xr--)this.words[Xr+Ie]=this.words[Xr];for(Xr=0;Xr=0);var Te;F?Te=(F-F%26)/26:Te=0;var Xr=t%26,ei=Math.min((t-Xr)/26,this.length),ii=67108863^67108863>>>Xr<ei)for(this.length-=ei,R=0;R=0&&(Le!==0||R>=Te);R--){var nn=this.words[R]|0;this.words[R]=Le<<26-Xr|nn>>>Xr,Le=nn&ii}return Wr&&Le!==0&&(Wr.words[Wr.length++]=Le),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},W.prototype.ishrn=function(t,F,Ie){return Y(this.negative===0),this.iushrn(t,F,Ie)},W.prototype.shln=function(t){return this.clone().ishln(t)},W.prototype.ushln=function(t){return this.clone().iushln(t)},W.prototype.shrn=function(t){return this.clone().ishrn(t)},W.prototype.ushrn=function(t){return this.clone().iushrn(t)},W.prototype.testn=function(t){Y(typeof t=="number"&&t>=0);var F=t%26,Ie=(t-F)/26,Te=1<=0);var F=t%26,Ie=(t-F)/26;if(Y(this.negative===0,"imaskn works only with positive numbers"),this.length<=Ie)return this;if(F!==0&&Ie++,this.length=Math.min(Ie,this.length),F!==0){var Te=67108863^67108863>>>F<=67108864;F++)this.words[F]-=67108864,F===this.length-1?this.words[F+1]=1:this.words[F+1]++;return this.length=Math.max(this.length,F+1),this},W.prototype.isubn=function(t){if(Y(typeof t=="number"),Y(t<67108864),t<0)return this.iaddn(-t);if(this.negative!==0)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var F=0;F>26)-(Wr/67108864|0),this.words[Xr+Ie]=ei&67108863}for(;Xr>26,this.words[Xr+Ie]=ei&67108863;if(ii===0)return this.strip();for(Y(ii===-1),ii=0,Xr=0;Xr>26,this.words[Xr]=ei&67108863;return this.negative=1,this.strip()},W.prototype._wordDiv=function(t,F){var Ie=this.length-t.length,Te=this.clone(),Xr=t,ei=Xr.words[Xr.length-1]|0,ii=this._countBits(ei);Ie=26-ii,Ie!==0&&(Xr=Xr.ushln(Ie),Te.iushln(Ie),ei=Xr.words[Xr.length-1]|0);var Wr=Te.length-Xr.length,R;if(F!=="mod"){R=new W(null),R.length=Wr+1,R.words=new Array(R.length);for(var Le=0;Le=0;vn--){var Mn=(Te.words[Xr.length+vn]|0)*67108864+(Te.words[Xr.length+vn-1]|0);for(Mn=Math.min(Mn/ei|0,67108863),Te._ishlnsubmul(Xr,Mn,vn);Te.negative!==0;)Mn--,Te.negative=0,Te._ishlnsubmul(Xr,1,vn),Te.isZero()||(Te.negative^=1);R&&(R.words[vn]=Mn)}return R&&R.strip(),Te.strip(),F!=="div"&&Ie!==0&&Te.iushrn(Ie),{div:R||null,mod:Te}},W.prototype.divmod=function(t,F,Ie){if(Y(!t.isZero()),this.isZero())return{div:new W(0),mod:new W(0)};var Te,Xr,ei;return this.negative!==0&&t.negative===0?(ei=this.neg().divmod(t,F),F!=="mod"&&(Te=ei.div.neg()),F!=="div"&&(Xr=ei.mod.neg(),Ie&&Xr.negative!==0&&Xr.iadd(t)),{div:Te,mod:Xr}):this.negative===0&&t.negative!==0?(ei=this.divmod(t.neg(),F),F!=="mod"&&(Te=ei.div.neg()),{div:Te,mod:ei.mod}):this.negative&t.negative?(ei=this.neg().divmod(t.neg(),F),F!=="div"&&(Xr=ei.mod.neg(),Ie&&Xr.negative!==0&&Xr.isub(t)),{div:ei.div,mod:Xr}):t.length>this.length||this.cmp(t)<0?{div:new W(0),mod:this}:t.length===1?F==="div"?{div:this.divn(t.words[0]),mod:null}:F==="mod"?{div:null,mod:new W(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new W(this.modn(t.words[0]))}:this._wordDiv(t,F)},W.prototype.div=function(t){return this.divmod(t,"div",!1).div},W.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},W.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},W.prototype.divRound=function(t){var F=this.divmod(t);if(F.mod.isZero())return F.div;var Ie=F.div.negative!==0?F.mod.isub(t):F.mod,Te=t.ushrn(1),Xr=t.andln(1),ei=Ie.cmp(Te);return ei<0||Xr===1&&ei===0?F.div:F.div.negative!==0?F.div.isubn(1):F.div.iaddn(1)},W.prototype.modn=function(t){Y(t<=67108863);for(var F=(1<<26)%t,Ie=0,Te=this.length-1;Te>=0;Te--)Ie=(F*Ie+(this.words[Te]|0))%t;return Ie},W.prototype.idivn=function(t){Y(t<=67108863);for(var F=0,Ie=this.length-1;Ie>=0;Ie--){var Te=(this.words[Ie]|0)+F*67108864;this.words[Ie]=Te/t|0,F=Te%t}return this.strip()},W.prototype.divn=function(t){return this.clone().idivn(t)},W.prototype.egcd=function(t){Y(t.negative===0),Y(!t.isZero());var F=this,Ie=t.clone();F.negative!==0?F=F.umod(t):F=F.clone();for(var Te=new W(1),Xr=new W(0),ei=new W(0),ii=new W(1),Wr=0;F.isEven()&&Ie.isEven();)F.iushrn(1),Ie.iushrn(1),++Wr;for(var R=Ie.clone(),Le=F.clone();!F.isZero();){for(var nn=0,vn=1;!(F.words[0]&vn)&&nn<26;++nn,vn<<=1);if(nn>0)for(F.iushrn(nn);nn-- >0;)(Te.isOdd()||Xr.isOdd())&&(Te.iadd(R),Xr.isub(Le)),Te.iushrn(1),Xr.iushrn(1);for(var Mn=0,sn=1;!(Ie.words[0]&sn)&&Mn<26;++Mn,sn<<=1);if(Mn>0)for(Ie.iushrn(Mn);Mn-- >0;)(ei.isOdd()||ii.isOdd())&&(ei.iadd(R),ii.isub(Le)),ei.iushrn(1),ii.iushrn(1);F.cmp(Ie)>=0?(F.isub(Ie),Te.isub(ei),Xr.isub(ii)):(Ie.isub(F),ei.isub(Te),ii.isub(Xr))}return{a:ei,b:ii,gcd:Ie.iushln(Wr)}},W.prototype._invmp=function(t){Y(t.negative===0),Y(!t.isZero());var F=this,Ie=t.clone();F.negative!==0?F=F.umod(t):F=F.clone();for(var Te=new W(1),Xr=new W(0),ei=Ie.clone();F.cmpn(1)>0&&Ie.cmpn(1)>0;){for(var ii=0,Wr=1;!(F.words[0]&Wr)&&ii<26;++ii,Wr<<=1);if(ii>0)for(F.iushrn(ii);ii-- >0;)Te.isOdd()&&Te.iadd(ei),Te.iushrn(1);for(var R=0,Le=1;!(Ie.words[0]&Le)&&R<26;++R,Le<<=1);if(R>0)for(Ie.iushrn(R);R-- >0;)Xr.isOdd()&&Xr.iadd(ei),Xr.iushrn(1);F.cmp(Ie)>=0?(F.isub(Ie),Te.isub(Xr)):(Ie.isub(F),Xr.isub(Te))}var nn;return F.cmpn(1)===0?nn=Te:nn=Xr,nn.cmpn(0)<0&&nn.iadd(t),nn},W.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var F=this.clone(),Ie=t.clone();F.negative=0,Ie.negative=0;for(var Te=0;F.isEven()&&Ie.isEven();Te++)F.iushrn(1),Ie.iushrn(1);do{for(;F.isEven();)F.iushrn(1);for(;Ie.isEven();)Ie.iushrn(1);var Xr=F.cmp(Ie);if(Xr<0){var ei=F;F=Ie,Ie=ei}else if(Xr===0||Ie.cmpn(1)===0)break;F.isub(Ie)}while(!0);return Ie.iushln(Te)},W.prototype.invm=function(t){return this.egcd(t).a.umod(t)},W.prototype.isEven=function(){return(this.words[0]&1)===0},W.prototype.isOdd=function(){return(this.words[0]&1)===1},W.prototype.andln=function(t){return this.words[0]&t},W.prototype.bincn=function(t){Y(typeof t=="number");var F=t%26,Ie=(t-F)/26,Te=1<>>26,ii&=67108863,this.words[ei]=ii}return Xr!==0&&(this.words[ei]=Xr,this.length++),this},W.prototype.isZero=function(){return this.length===1&&this.words[0]===0},W.prototype.cmpn=function(t){var F=t<0;if(this.negative!==0&&!F)return-1;if(this.negative===0&&F)return 1;this.strip();var Ie;if(this.length>1)Ie=1;else{F&&(t=-t),Y(t<=67108863,"Number is too big");var Te=this.words[0]|0;Ie=Te===t?0:Tet.length)return 1;if(this.length=0;Ie--){var Te=this.words[Ie]|0,Xr=t.words[Ie]|0;if(Te!==Xr){TeXr&&(F=1);break}}return F},W.prototype.gtn=function(t){return this.cmpn(t)===1},W.prototype.gt=function(t){return this.cmp(t)===1},W.prototype.gten=function(t){return this.cmpn(t)>=0},W.prototype.gte=function(t){return this.cmp(t)>=0},W.prototype.ltn=function(t){return this.cmpn(t)===-1},W.prototype.lt=function(t){return this.cmp(t)===-1},W.prototype.lten=function(t){return this.cmpn(t)<=0},W.prototype.lte=function(t){return this.cmp(t)<=0},W.prototype.eqn=function(t){return this.cmpn(t)===0},W.prototype.eq=function(t){return this.cmp(t)===0},W.red=function(t){return new Ya(t)},W.prototype.toRed=function(t){return Y(!this.red,"Already a number in reduction context"),Y(this.negative===0,"red works only with positives"),t.convertTo(this)._forceRed(t)},W.prototype.fromRed=function(){return Y(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},W.prototype._forceRed=function(t){return this.red=t,this},W.prototype.forceRed=function(t){return Y(!this.red,"Already a number in reduction context"),this._forceRed(t)},W.prototype.redAdd=function(t){return Y(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},W.prototype.redIAdd=function(t){return Y(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},W.prototype.redSub=function(t){return Y(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},W.prototype.redISub=function(t){return Y(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},W.prototype.redShl=function(t){return Y(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},W.prototype.redMul=function(t){return Y(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},W.prototype.redIMul=function(t){return Y(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},W.prototype.redSqr=function(){return Y(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},W.prototype.redISqr=function(){return Y(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},W.prototype.redSqrt=function(){return Y(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},W.prototype.redInvm=function(){return Y(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},W.prototype.redNeg=function(){return Y(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},W.prototype.redPow=function(t){return Y(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var gn={k256:null,p224:null,p192:null,p25519:null};function cn(oi,t){this.name=oi,this.p=new W(t,16),this.n=this.p.bitLength(),this.k=new W(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}cn.prototype._tmp=function(){var t=new W(null);return t.words=new Array(Math.ceil(this.n/13)),t},cn.prototype.ireduce=function(t){var F=t,Ie;do this.split(F,this.tmp),F=this.imulK(F),F=F.iadd(this.tmp),Ie=F.bitLength();while(Ie>this.n);var Te=Ie0?F.isub(this.p):F.strip!==void 0?F.strip():F._strip(),F},cn.prototype.split=function(t,F){t.iushrn(this.n,0,F)},cn.prototype.imulK=function(t){return t.imul(this.k)};function An(){cn.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}Ne(An,cn),An.prototype.split=function(t,F){for(var Ie=4194303,Te=Math.min(t.length,9),Xr=0;Xr>>22,ei=ii}ei>>>=22,t.words[Xr-10]=ei,ei===0&&t.length>10?t.length-=10:t.length-=9},An.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var F=0,Ie=0;Ie>>=26,t.words[Ie]=Xr,F=Te}return F!==0&&(t.words[t.length++]=F),t},W._prime=function(t){if(gn[t])return gn[t];var F;if(t==="k256")F=new An;else if(t==="p224")F=new Cn;else if(t==="p192")F=new an;else if(t==="p25519")F=new Rn;else throw new Error("Unknown prime "+t);return gn[t]=F,F};function Ya(oi){if(typeof oi=="string"){var t=W._prime(oi);this.m=t.p,this.prime=t}else Y(oi.gtn(1),"modulus must be greater than 1"),this.m=oi,this.prime=null}Ya.prototype._verify1=function(t){Y(t.negative===0,"red works only with positives"),Y(t.red,"red works only with red numbers")},Ya.prototype._verify2=function(t,F){Y((t.negative|F.negative)===0,"red works only with positives"),Y(t.red&&t.red===F.red,"red works only with red numbers")},Ya.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},Ya.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},Ya.prototype.add=function(t,F){this._verify2(t,F);var Ie=t.add(F);return Ie.cmp(this.m)>=0&&Ie.isub(this.m),Ie._forceRed(this)},Ya.prototype.iadd=function(t,F){this._verify2(t,F);var Ie=t.iadd(F);return Ie.cmp(this.m)>=0&&Ie.isub(this.m),Ie},Ya.prototype.sub=function(t,F){this._verify2(t,F);var Ie=t.sub(F);return Ie.cmpn(0)<0&&Ie.iadd(this.m),Ie._forceRed(this)},Ya.prototype.isub=function(t,F){this._verify2(t,F);var Ie=t.isub(F);return Ie.cmpn(0)<0&&Ie.iadd(this.m),Ie},Ya.prototype.shl=function(t,F){return this._verify1(t),this.imod(t.ushln(F))},Ya.prototype.imul=function(t,F){return this._verify2(t,F),this.imod(t.imul(F))},Ya.prototype.mul=function(t,F){return this._verify2(t,F),this.imod(t.mul(F))},Ya.prototype.isqr=function(t){return this.imul(t,t.clone())},Ya.prototype.sqr=function(t){return this.mul(t,t)},Ya.prototype.sqrt=function(t){if(t.isZero())return t.clone();var F=this.m.andln(3);if(Y(F%2===1),F===3){var Ie=this.m.add(new W(1)).iushrn(2);return this.pow(t,Ie)}for(var Te=this.m.subn(1),Xr=0;!Te.isZero()&&Te.andln(1)===0;)Xr++,Te.iushrn(1);Y(!Te.isZero());var ei=new W(1).toRed(this),ii=ei.redNeg(),Wr=this.m.subn(1).iushrn(1),R=this.m.bitLength();for(R=new W(2*R*R).toRed(this);this.pow(R,Wr).cmp(ii)!==0;)R.redIAdd(ii);for(var Le=this.pow(R,Te),nn=this.pow(t,Te.addn(1).iushrn(1)),vn=this.pow(t,Te),Mn=Xr;vn.cmp(ei)!==0;){for(var sn=vn,Zn=0;sn.cmp(ei)!==0;Zn++)sn=sn.redSqr();Y(Zn=0;Xr--){for(var Le=F.words[Xr],nn=R-1;nn>=0;nn--){var vn=Le>>nn&1;if(ei!==Te[0]&&(ei=this.sqr(ei)),vn===0&&ii===0){Wr=0;continue}ii<<=1,ii|=vn,Wr++,!(Wr!==Ie&&(Xr!==0||nn!==0))&&(ei=this.mul(ei,Te[ii]),Wr=0,ii=0)}R=26}return ei},Ya.prototype.convertTo=function(t){var F=t.umod(this.m);return F===t?F.clone():F},Ya.prototype.convertFrom=function(t){var F=t.clone();return F.red=null,F},W.mont=function(t){return new Ho(t)};function Ho(oi){Ya.call(this,oi),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new W(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}Ne(Ho,Ya),Ho.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},Ho.prototype.convertFrom=function(t){var F=this.imod(t.mul(this.rinv));return F.red=null,F},Ho.prototype.imul=function(t,F){if(t.isZero()||F.isZero())return t.words[0]=0,t.length=1,t;var Ie=t.imul(F),Te=Ie.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Xr=Ie.isub(Te).iushrn(this.shift),ei=Xr;return Xr.cmp(this.m)>=0?ei=Xr.isub(this.m):Xr.cmpn(0)<0&&(ei=Xr.iadd(this.m)),ei._forceRed(this)},Ho.prototype.mul=function(t,F){if(t.isZero()||F.isZero())return new W(0)._forceRed(this);var Ie=t.mul(F),Te=Ie.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Xr=Ie.isub(Te).iushrn(this.shift),ei=Xr;return Xr.cmp(this.m)>=0?ei=Xr.isub(this.m):Xr.cmpn(0)<0&&(ei=Xr.iadd(this.m)),ei._forceRed(this)},Ho.prototype.invm=function(t){var F=this.imod(t._invmp(this.m).mul(this.r2));return F._forceRed(this)}})(G,commonjsGlobal)}(bn$6)),bn$6.exports}var bn$5={exports:{}};bn$5.exports;var hasRequiredBn$4;function requireBn$4(){return hasRequiredBn$4||(hasRequiredBn$4=1,function(G){(function(e,H){function Y(oi,t){if(!oi)throw new Error(t||"Assertion failed")}function Ne(oi,t){oi.super_=t;var F=function(){};F.prototype=t.prototype,oi.prototype=new F,oi.prototype.constructor=oi}function W(oi,t,F){if(W.isBN(oi))return oi;this.negative=0,this.words=null,this.length=0,this.red=null,oi!==null&&((t==="le"||t==="be")&&(F=t,t=10),this._init(oi||0,t||10,F||"be"))}typeof e=="object"?e.exports=W:H.BN=W,W.BN=W,W.wordSize=26;var ri;try{typeof window<"u"&&typeof window.Buffer<"u"?ri=window.Buffer:ri=require$$0$3.Buffer}catch{}W.isBN=function(t){return t instanceof W?!0:t!==null&&typeof t=="object"&&t.constructor.wordSize===W.wordSize&&Array.isArray(t.words)},W.max=function(t,F){return t.cmp(F)>0?t:F},W.min=function(t,F){return t.cmp(F)<0?t:F},W.prototype._init=function(t,F,Ie){if(typeof t=="number")return this._initNumber(t,F,Ie);if(typeof t=="object")return this._initArray(t,F,Ie);F==="hex"&&(F=16),Y(F===(F|0)&&F>=2&&F<=36),t=t.toString().replace(/\s+/g,"");var Te=0;t[0]==="-"&&(Te++,this.negative=1),Te=0;Te-=3)ei=t[Te]|t[Te-1]<<8|t[Te-2]<<16,this.words[Xr]|=ei<>>26-ii&67108863,ii+=24,ii>=26&&(ii-=26,Xr++);else if(Ie==="le")for(Te=0,Xr=0;Te>>26-ii&67108863,ii+=24,ii>=26&&(ii-=26,Xr++);return this.strip()};function si(oi,t){var F=oi.charCodeAt(t);return F>=65&&F<=70?F-55:F>=97&&F<=102?F-87:F-48&15}function fi(oi,t,F){var Ie=si(oi,F);return F-1>=t&&(Ie|=si(oi,F-1)<<4),Ie}W.prototype._parseHex=function(t,F,Ie){this.length=Math.ceil((t.length-F)/6),this.words=new Array(this.length);for(var Te=0;Te=F;Te-=2)ii=fi(t,F,Te)<=18?(Xr-=18,ei+=1,this.words[ei]|=ii>>>26):Xr+=8;else{var Wr=t.length-F;for(Te=Wr%2===0?F+1:F;Te=18?(Xr-=18,ei+=1,this.words[ei]|=ii>>>26):Xr+=8}this.strip()};function ai(oi,t,F,Ie){for(var Te=0,Xr=Math.min(oi.length,F),ei=t;ei=49?Te+=ii-49+10:ii>=17?Te+=ii-17+10:Te+=ii}return Te}W.prototype._parseBase=function(t,F,Ie){this.words=[0],this.length=1;for(var Te=0,Xr=1;Xr<=67108863;Xr*=F)Te++;Te--,Xr=Xr/F|0;for(var ei=t.length-Ie,ii=ei%Te,Wr=Math.min(ei,ei-ii)+Ie,R=0,Le=Ie;Le1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},W.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},W.prototype.inspect=function(){return(this.red?""};var ti=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],hi=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],ci=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];W.prototype.toString=function(t,F){t=t||10,F=F|0||1;var Ie;if(t===16||t==="hex"){Ie="";for(var Te=0,Xr=0,ei=0;ei>>24-Te&16777215,Xr!==0||ei!==this.length-1?Ie=ti[6-Wr.length]+Wr+Ie:Ie=Wr+Ie,Te+=2,Te>=26&&(Te-=26,ei--)}for(Xr!==0&&(Ie=Xr.toString(16)+Ie);Ie.length%F!==0;)Ie="0"+Ie;return this.negative!==0&&(Ie="-"+Ie),Ie}if(t===(t|0)&&t>=2&&t<=36){var R=hi[t],Le=ci[t];Ie="";var nn=this.clone();for(nn.negative=0;!nn.isZero();){var vn=nn.modn(Le).toString(t);nn=nn.idivn(Le),nn.isZero()?Ie=vn+Ie:Ie=ti[R-vn.length]+vn+Ie}for(this.isZero()&&(Ie="0"+Ie);Ie.length%F!==0;)Ie="0"+Ie;return this.negative!==0&&(Ie="-"+Ie),Ie}Y(!1,"Base should be between 2 and 36")},W.prototype.toNumber=function(){var t=this.words[0];return this.length===2?t+=this.words[1]*67108864:this.length===3&&this.words[2]===1?t+=4503599627370496+this.words[1]*67108864:this.length>2&&Y(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-t:t},W.prototype.toJSON=function(){return this.toString(16)},W.prototype.toBuffer=function(t,F){return Y(typeof ri<"u"),this.toArrayLike(ri,t,F)},W.prototype.toArray=function(t,F){return this.toArrayLike(Array,t,F)},W.prototype.toArrayLike=function(t,F,Ie){var Te=this.byteLength(),Xr=Ie||Math.max(1,Te);Y(Te<=Xr,"byte array longer than desired length"),Y(Xr>0,"Requested array length <= 0"),this.strip();var ei=F==="le",ii=new t(Xr),Wr,R,Le=this.clone();if(ei){for(R=0;!Le.isZero();R++)Wr=Le.andln(255),Le.iushrn(8),ii[R]=Wr;for(;R=4096&&(Ie+=13,F>>>=13),F>=64&&(Ie+=7,F>>>=7),F>=8&&(Ie+=4,F>>>=4),F>=2&&(Ie+=2,F>>>=2),Ie+F},W.prototype._zeroBits=function(t){if(t===0)return 26;var F=t,Ie=0;return F&8191||(Ie+=13,F>>>=13),F&127||(Ie+=7,F>>>=7),F&15||(Ie+=4,F>>>=4),F&3||(Ie+=2,F>>>=2),F&1||Ie++,Ie},W.prototype.bitLength=function(){var t=this.words[this.length-1],F=this._countBits(t);return(this.length-1)*26+F};function ui(oi){for(var t=new Array(oi.bitLength()),F=0;F>>Te}return t}W.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,F=0;Ft.length?this.clone().ior(t):t.clone().ior(this)},W.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},W.prototype.iuand=function(t){var F;this.length>t.length?F=t:F=this;for(var Ie=0;Iet.length?this.clone().iand(t):t.clone().iand(this)},W.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},W.prototype.iuxor=function(t){var F,Ie;this.length>t.length?(F=this,Ie=t):(F=t,Ie=this);for(var Te=0;Tet.length?this.clone().ixor(t):t.clone().ixor(this)},W.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},W.prototype.inotn=function(t){Y(typeof t=="number"&&t>=0);var F=Math.ceil(t/26)|0,Ie=t%26;this._expand(F),Ie>0&&F--;for(var Te=0;Te0&&(this.words[Te]=~this.words[Te]&67108863>>26-Ie),this.strip()},W.prototype.notn=function(t){return this.clone().inotn(t)},W.prototype.setn=function(t,F){Y(typeof t=="number"&&t>=0);var Ie=t/26|0,Te=t%26;return this._expand(Ie+1),F?this.words[Ie]=this.words[Ie]|1<t.length?(Ie=this,Te=t):(Ie=t,Te=this);for(var Xr=0,ei=0;ei>>26;for(;Xr!==0&&ei>>26;if(this.length=Ie.length,Xr!==0)this.words[this.length]=Xr,this.length++;else if(Ie!==this)for(;eit.length?this.clone().iadd(t):t.clone().iadd(this)},W.prototype.isub=function(t){if(t.negative!==0){t.negative=0;var F=this.iadd(t);return t.negative=1,F._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var Ie=this.cmp(t);if(Ie===0)return this.negative=0,this.length=1,this.words[0]=0,this;var Te,Xr;Ie>0?(Te=this,Xr=t):(Te=t,Xr=this);for(var ei=0,ii=0;ii>26,this.words[ii]=F&67108863;for(;ei!==0&&ii>26,this.words[ii]=F&67108863;if(ei===0&&ii>>26,nn=Wr&67108863,vn=Math.min(R,t.length-1),Mn=Math.max(0,R-oi.length+1);Mn<=vn;Mn++){var sn=R-Mn|0;Te=oi.words[sn]|0,Xr=t.words[Mn]|0,ei=Te*Xr+nn,Le+=ei/67108864|0,nn=ei&67108863}F.words[R]=nn|0,Wr=Le|0}return Wr!==0?F.words[R]=Wr|0:F.length--,F.strip()}var mi=function(t,F,Ie){var Te=t.words,Xr=F.words,ei=Ie.words,ii=0,Wr,R,Le,nn=Te[0]|0,vn=nn&8191,Mn=nn>>>13,sn=Te[1]|0,Zn=sn&8191,on=sn>>>13,pn=Te[2]|0,mn=pn&8191,$i=pn>>>13,ho=Te[3]|0,Do=ho&8191,To=ho>>>13,Oh=Te[4]|0,Fo=Oh&8191,Vo=Oh>>>13,Hh=Te[5]|0,Ah=Hh&8191,Qf=Hh>>>13,Gh=Te[6]|0,tf=Gh&8191,Ko=Gh>>>13,Kh=Te[7]|0,Lf=Kh&8191,Uo=Kh>>>13,Vh=Te[8]|0,jf=Vh&8191,Zo=Vh>>>13,Wh=Te[9]|0,vh=Wh&8191,Yo=Wh>>>13,Jh=Xr[0]|0,xh=Jh&8191,Vf=Jh>>>13,Zh=Xr[1]|0,Ch=Zh&8191,Eh=Zh>>>13,Lu=Xr[2]|0,Ph=Lu&8191,Sh=Lu>>>13,Uu=Xr[3]|0,Th=Uu&8191,gh=Uu>>>13,Xh=Xr[4]|0,Rh=Xh&8191,bh=Xh>>>13,au=Xr[5]|0,$h=au&8191,wh=au>>>13,qu=Xr[6]|0,Ih=qu&8191,_h=qu>>>13,uu=Xr[7]|0,Dh=uu&8191,yh=uu>>>13,Yh=Xr[8]|0,Bh=Yh&8191,Mh=Yh>>>13,Hu=Xr[9]|0,kh=Hu&8191,qh=Hu>>>13;Ie.negative=t.negative^F.negative,Ie.length=19,Wr=Math.imul(vn,xh),R=Math.imul(vn,Vf),R=R+Math.imul(Mn,xh)|0,Le=Math.imul(Mn,Vf);var Tu=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(Tu>>>26)|0,Tu&=67108863,Wr=Math.imul(Zn,xh),R=Math.imul(Zn,Vf),R=R+Math.imul(on,xh)|0,Le=Math.imul(on,Vf),Wr=Wr+Math.imul(vn,Ch)|0,R=R+Math.imul(vn,Eh)|0,R=R+Math.imul(Mn,Ch)|0,Le=Le+Math.imul(Mn,Eh)|0;var tc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(tc>>>26)|0,tc&=67108863,Wr=Math.imul(mn,xh),R=Math.imul(mn,Vf),R=R+Math.imul($i,xh)|0,Le=Math.imul($i,Vf),Wr=Wr+Math.imul(Zn,Ch)|0,R=R+Math.imul(Zn,Eh)|0,R=R+Math.imul(on,Ch)|0,Le=Le+Math.imul(on,Eh)|0,Wr=Wr+Math.imul(vn,Ph)|0,R=R+Math.imul(vn,Sh)|0,R=R+Math.imul(Mn,Ph)|0,Le=Le+Math.imul(Mn,Sh)|0;var rc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(rc>>>26)|0,rc&=67108863,Wr=Math.imul(Do,xh),R=Math.imul(Do,Vf),R=R+Math.imul(To,xh)|0,Le=Math.imul(To,Vf),Wr=Wr+Math.imul(mn,Ch)|0,R=R+Math.imul(mn,Eh)|0,R=R+Math.imul($i,Ch)|0,Le=Le+Math.imul($i,Eh)|0,Wr=Wr+Math.imul(Zn,Ph)|0,R=R+Math.imul(Zn,Sh)|0,R=R+Math.imul(on,Ph)|0,Le=Le+Math.imul(on,Sh)|0,Wr=Wr+Math.imul(vn,Th)|0,R=R+Math.imul(vn,gh)|0,R=R+Math.imul(Mn,Th)|0,Le=Le+Math.imul(Mn,gh)|0;var ic=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(ic>>>26)|0,ic&=67108863,Wr=Math.imul(Fo,xh),R=Math.imul(Fo,Vf),R=R+Math.imul(Vo,xh)|0,Le=Math.imul(Vo,Vf),Wr=Wr+Math.imul(Do,Ch)|0,R=R+Math.imul(Do,Eh)|0,R=R+Math.imul(To,Ch)|0,Le=Le+Math.imul(To,Eh)|0,Wr=Wr+Math.imul(mn,Ph)|0,R=R+Math.imul(mn,Sh)|0,R=R+Math.imul($i,Ph)|0,Le=Le+Math.imul($i,Sh)|0,Wr=Wr+Math.imul(Zn,Th)|0,R=R+Math.imul(Zn,gh)|0,R=R+Math.imul(on,Th)|0,Le=Le+Math.imul(on,gh)|0,Wr=Wr+Math.imul(vn,Rh)|0,R=R+Math.imul(vn,bh)|0,R=R+Math.imul(Mn,Rh)|0,Le=Le+Math.imul(Mn,bh)|0;var nc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(nc>>>26)|0,nc&=67108863,Wr=Math.imul(Ah,xh),R=Math.imul(Ah,Vf),R=R+Math.imul(Qf,xh)|0,Le=Math.imul(Qf,Vf),Wr=Wr+Math.imul(Fo,Ch)|0,R=R+Math.imul(Fo,Eh)|0,R=R+Math.imul(Vo,Ch)|0,Le=Le+Math.imul(Vo,Eh)|0,Wr=Wr+Math.imul(Do,Ph)|0,R=R+Math.imul(Do,Sh)|0,R=R+Math.imul(To,Ph)|0,Le=Le+Math.imul(To,Sh)|0,Wr=Wr+Math.imul(mn,Th)|0,R=R+Math.imul(mn,gh)|0,R=R+Math.imul($i,Th)|0,Le=Le+Math.imul($i,gh)|0,Wr=Wr+Math.imul(Zn,Rh)|0,R=R+Math.imul(Zn,bh)|0,R=R+Math.imul(on,Rh)|0,Le=Le+Math.imul(on,bh)|0,Wr=Wr+Math.imul(vn,$h)|0,R=R+Math.imul(vn,wh)|0,R=R+Math.imul(Mn,$h)|0,Le=Le+Math.imul(Mn,wh)|0;var sc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(sc>>>26)|0,sc&=67108863,Wr=Math.imul(tf,xh),R=Math.imul(tf,Vf),R=R+Math.imul(Ko,xh)|0,Le=Math.imul(Ko,Vf),Wr=Wr+Math.imul(Ah,Ch)|0,R=R+Math.imul(Ah,Eh)|0,R=R+Math.imul(Qf,Ch)|0,Le=Le+Math.imul(Qf,Eh)|0,Wr=Wr+Math.imul(Fo,Ph)|0,R=R+Math.imul(Fo,Sh)|0,R=R+Math.imul(Vo,Ph)|0,Le=Le+Math.imul(Vo,Sh)|0,Wr=Wr+Math.imul(Do,Th)|0,R=R+Math.imul(Do,gh)|0,R=R+Math.imul(To,Th)|0,Le=Le+Math.imul(To,gh)|0,Wr=Wr+Math.imul(mn,Rh)|0,R=R+Math.imul(mn,bh)|0,R=R+Math.imul($i,Rh)|0,Le=Le+Math.imul($i,bh)|0,Wr=Wr+Math.imul(Zn,$h)|0,R=R+Math.imul(Zn,wh)|0,R=R+Math.imul(on,$h)|0,Le=Le+Math.imul(on,wh)|0,Wr=Wr+Math.imul(vn,Ih)|0,R=R+Math.imul(vn,_h)|0,R=R+Math.imul(Mn,Ih)|0,Le=Le+Math.imul(Mn,_h)|0;var s0=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(s0>>>26)|0,s0&=67108863,Wr=Math.imul(Lf,xh),R=Math.imul(Lf,Vf),R=R+Math.imul(Uo,xh)|0,Le=Math.imul(Uo,Vf),Wr=Wr+Math.imul(tf,Ch)|0,R=R+Math.imul(tf,Eh)|0,R=R+Math.imul(Ko,Ch)|0,Le=Le+Math.imul(Ko,Eh)|0,Wr=Wr+Math.imul(Ah,Ph)|0,R=R+Math.imul(Ah,Sh)|0,R=R+Math.imul(Qf,Ph)|0,Le=Le+Math.imul(Qf,Sh)|0,Wr=Wr+Math.imul(Fo,Th)|0,R=R+Math.imul(Fo,gh)|0,R=R+Math.imul(Vo,Th)|0,Le=Le+Math.imul(Vo,gh)|0,Wr=Wr+Math.imul(Do,Rh)|0,R=R+Math.imul(Do,bh)|0,R=R+Math.imul(To,Rh)|0,Le=Le+Math.imul(To,bh)|0,Wr=Wr+Math.imul(mn,$h)|0,R=R+Math.imul(mn,wh)|0,R=R+Math.imul($i,$h)|0,Le=Le+Math.imul($i,wh)|0,Wr=Wr+Math.imul(Zn,Ih)|0,R=R+Math.imul(Zn,_h)|0,R=R+Math.imul(on,Ih)|0,Le=Le+Math.imul(on,_h)|0,Wr=Wr+Math.imul(vn,Dh)|0,R=R+Math.imul(vn,yh)|0,R=R+Math.imul(Mn,Dh)|0,Le=Le+Math.imul(Mn,yh)|0;var hc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(hc>>>26)|0,hc&=67108863,Wr=Math.imul(jf,xh),R=Math.imul(jf,Vf),R=R+Math.imul(Zo,xh)|0,Le=Math.imul(Zo,Vf),Wr=Wr+Math.imul(Lf,Ch)|0,R=R+Math.imul(Lf,Eh)|0,R=R+Math.imul(Uo,Ch)|0,Le=Le+Math.imul(Uo,Eh)|0,Wr=Wr+Math.imul(tf,Ph)|0,R=R+Math.imul(tf,Sh)|0,R=R+Math.imul(Ko,Ph)|0,Le=Le+Math.imul(Ko,Sh)|0,Wr=Wr+Math.imul(Ah,Th)|0,R=R+Math.imul(Ah,gh)|0,R=R+Math.imul(Qf,Th)|0,Le=Le+Math.imul(Qf,gh)|0,Wr=Wr+Math.imul(Fo,Rh)|0,R=R+Math.imul(Fo,bh)|0,R=R+Math.imul(Vo,Rh)|0,Le=Le+Math.imul(Vo,bh)|0,Wr=Wr+Math.imul(Do,$h)|0,R=R+Math.imul(Do,wh)|0,R=R+Math.imul(To,$h)|0,Le=Le+Math.imul(To,wh)|0,Wr=Wr+Math.imul(mn,Ih)|0,R=R+Math.imul(mn,_h)|0,R=R+Math.imul($i,Ih)|0,Le=Le+Math.imul($i,_h)|0,Wr=Wr+Math.imul(Zn,Dh)|0,R=R+Math.imul(Zn,yh)|0,R=R+Math.imul(on,Dh)|0,Le=Le+Math.imul(on,yh)|0,Wr=Wr+Math.imul(vn,Bh)|0,R=R+Math.imul(vn,Mh)|0,R=R+Math.imul(Mn,Bh)|0,Le=Le+Math.imul(Mn,Mh)|0;var pc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(pc>>>26)|0,pc&=67108863,Wr=Math.imul(vh,xh),R=Math.imul(vh,Vf),R=R+Math.imul(Yo,xh)|0,Le=Math.imul(Yo,Vf),Wr=Wr+Math.imul(jf,Ch)|0,R=R+Math.imul(jf,Eh)|0,R=R+Math.imul(Zo,Ch)|0,Le=Le+Math.imul(Zo,Eh)|0,Wr=Wr+Math.imul(Lf,Ph)|0,R=R+Math.imul(Lf,Sh)|0,R=R+Math.imul(Uo,Ph)|0,Le=Le+Math.imul(Uo,Sh)|0,Wr=Wr+Math.imul(tf,Th)|0,R=R+Math.imul(tf,gh)|0,R=R+Math.imul(Ko,Th)|0,Le=Le+Math.imul(Ko,gh)|0,Wr=Wr+Math.imul(Ah,Rh)|0,R=R+Math.imul(Ah,bh)|0,R=R+Math.imul(Qf,Rh)|0,Le=Le+Math.imul(Qf,bh)|0,Wr=Wr+Math.imul(Fo,$h)|0,R=R+Math.imul(Fo,wh)|0,R=R+Math.imul(Vo,$h)|0,Le=Le+Math.imul(Vo,wh)|0,Wr=Wr+Math.imul(Do,Ih)|0,R=R+Math.imul(Do,_h)|0,R=R+Math.imul(To,Ih)|0,Le=Le+Math.imul(To,_h)|0,Wr=Wr+Math.imul(mn,Dh)|0,R=R+Math.imul(mn,yh)|0,R=R+Math.imul($i,Dh)|0,Le=Le+Math.imul($i,yh)|0,Wr=Wr+Math.imul(Zn,Bh)|0,R=R+Math.imul(Zn,Mh)|0,R=R+Math.imul(on,Bh)|0,Le=Le+Math.imul(on,Mh)|0,Wr=Wr+Math.imul(vn,kh)|0,R=R+Math.imul(vn,qh)|0,R=R+Math.imul(Mn,kh)|0,Le=Le+Math.imul(Mn,qh)|0;var uc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(uc>>>26)|0,uc&=67108863,Wr=Math.imul(vh,Ch),R=Math.imul(vh,Eh),R=R+Math.imul(Yo,Ch)|0,Le=Math.imul(Yo,Eh),Wr=Wr+Math.imul(jf,Ph)|0,R=R+Math.imul(jf,Sh)|0,R=R+Math.imul(Zo,Ph)|0,Le=Le+Math.imul(Zo,Sh)|0,Wr=Wr+Math.imul(Lf,Th)|0,R=R+Math.imul(Lf,gh)|0,R=R+Math.imul(Uo,Th)|0,Le=Le+Math.imul(Uo,gh)|0,Wr=Wr+Math.imul(tf,Rh)|0,R=R+Math.imul(tf,bh)|0,R=R+Math.imul(Ko,Rh)|0,Le=Le+Math.imul(Ko,bh)|0,Wr=Wr+Math.imul(Ah,$h)|0,R=R+Math.imul(Ah,wh)|0,R=R+Math.imul(Qf,$h)|0,Le=Le+Math.imul(Qf,wh)|0,Wr=Wr+Math.imul(Fo,Ih)|0,R=R+Math.imul(Fo,_h)|0,R=R+Math.imul(Vo,Ih)|0,Le=Le+Math.imul(Vo,_h)|0,Wr=Wr+Math.imul(Do,Dh)|0,R=R+Math.imul(Do,yh)|0,R=R+Math.imul(To,Dh)|0,Le=Le+Math.imul(To,yh)|0,Wr=Wr+Math.imul(mn,Bh)|0,R=R+Math.imul(mn,Mh)|0,R=R+Math.imul($i,Bh)|0,Le=Le+Math.imul($i,Mh)|0,Wr=Wr+Math.imul(Zn,kh)|0,R=R+Math.imul(Zn,qh)|0,R=R+Math.imul(on,kh)|0,Le=Le+Math.imul(on,qh)|0;var vc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(vc>>>26)|0,vc&=67108863,Wr=Math.imul(vh,Ph),R=Math.imul(vh,Sh),R=R+Math.imul(Yo,Ph)|0,Le=Math.imul(Yo,Sh),Wr=Wr+Math.imul(jf,Th)|0,R=R+Math.imul(jf,gh)|0,R=R+Math.imul(Zo,Th)|0,Le=Le+Math.imul(Zo,gh)|0,Wr=Wr+Math.imul(Lf,Rh)|0,R=R+Math.imul(Lf,bh)|0,R=R+Math.imul(Uo,Rh)|0,Le=Le+Math.imul(Uo,bh)|0,Wr=Wr+Math.imul(tf,$h)|0,R=R+Math.imul(tf,wh)|0,R=R+Math.imul(Ko,$h)|0,Le=Le+Math.imul(Ko,wh)|0,Wr=Wr+Math.imul(Ah,Ih)|0,R=R+Math.imul(Ah,_h)|0,R=R+Math.imul(Qf,Ih)|0,Le=Le+Math.imul(Qf,_h)|0,Wr=Wr+Math.imul(Fo,Dh)|0,R=R+Math.imul(Fo,yh)|0,R=R+Math.imul(Vo,Dh)|0,Le=Le+Math.imul(Vo,yh)|0,Wr=Wr+Math.imul(Do,Bh)|0,R=R+Math.imul(Do,Mh)|0,R=R+Math.imul(To,Bh)|0,Le=Le+Math.imul(To,Mh)|0,Wr=Wr+Math.imul(mn,kh)|0,R=R+Math.imul(mn,qh)|0,R=R+Math.imul($i,kh)|0,Le=Le+Math.imul($i,qh)|0;var mc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(mc>>>26)|0,mc&=67108863,Wr=Math.imul(vh,Th),R=Math.imul(vh,gh),R=R+Math.imul(Yo,Th)|0,Le=Math.imul(Yo,gh),Wr=Wr+Math.imul(jf,Rh)|0,R=R+Math.imul(jf,bh)|0,R=R+Math.imul(Zo,Rh)|0,Le=Le+Math.imul(Zo,bh)|0,Wr=Wr+Math.imul(Lf,$h)|0,R=R+Math.imul(Lf,wh)|0,R=R+Math.imul(Uo,$h)|0,Le=Le+Math.imul(Uo,wh)|0,Wr=Wr+Math.imul(tf,Ih)|0,R=R+Math.imul(tf,_h)|0,R=R+Math.imul(Ko,Ih)|0,Le=Le+Math.imul(Ko,_h)|0,Wr=Wr+Math.imul(Ah,Dh)|0,R=R+Math.imul(Ah,yh)|0,R=R+Math.imul(Qf,Dh)|0,Le=Le+Math.imul(Qf,yh)|0,Wr=Wr+Math.imul(Fo,Bh)|0,R=R+Math.imul(Fo,Mh)|0,R=R+Math.imul(Vo,Bh)|0,Le=Le+Math.imul(Vo,Mh)|0,Wr=Wr+Math.imul(Do,kh)|0,R=R+Math.imul(Do,qh)|0,R=R+Math.imul(To,kh)|0,Le=Le+Math.imul(To,qh)|0;var cc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(cc>>>26)|0,cc&=67108863,Wr=Math.imul(vh,Rh),R=Math.imul(vh,bh),R=R+Math.imul(Yo,Rh)|0,Le=Math.imul(Yo,bh),Wr=Wr+Math.imul(jf,$h)|0,R=R+Math.imul(jf,wh)|0,R=R+Math.imul(Zo,$h)|0,Le=Le+Math.imul(Zo,wh)|0,Wr=Wr+Math.imul(Lf,Ih)|0,R=R+Math.imul(Lf,_h)|0,R=R+Math.imul(Uo,Ih)|0,Le=Le+Math.imul(Uo,_h)|0,Wr=Wr+Math.imul(tf,Dh)|0,R=R+Math.imul(tf,yh)|0,R=R+Math.imul(Ko,Dh)|0,Le=Le+Math.imul(Ko,yh)|0,Wr=Wr+Math.imul(Ah,Bh)|0,R=R+Math.imul(Ah,Mh)|0,R=R+Math.imul(Qf,Bh)|0,Le=Le+Math.imul(Qf,Mh)|0,Wr=Wr+Math.imul(Fo,kh)|0,R=R+Math.imul(Fo,qh)|0,R=R+Math.imul(Vo,kh)|0,Le=Le+Math.imul(Vo,qh)|0;var lc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(lc>>>26)|0,lc&=67108863,Wr=Math.imul(vh,$h),R=Math.imul(vh,wh),R=R+Math.imul(Yo,$h)|0,Le=Math.imul(Yo,wh),Wr=Wr+Math.imul(jf,Ih)|0,R=R+Math.imul(jf,_h)|0,R=R+Math.imul(Zo,Ih)|0,Le=Le+Math.imul(Zo,_h)|0,Wr=Wr+Math.imul(Lf,Dh)|0,R=R+Math.imul(Lf,yh)|0,R=R+Math.imul(Uo,Dh)|0,Le=Le+Math.imul(Uo,yh)|0,Wr=Wr+Math.imul(tf,Bh)|0,R=R+Math.imul(tf,Mh)|0,R=R+Math.imul(Ko,Bh)|0,Le=Le+Math.imul(Ko,Mh)|0,Wr=Wr+Math.imul(Ah,kh)|0,R=R+Math.imul(Ah,qh)|0,R=R+Math.imul(Qf,kh)|0,Le=Le+Math.imul(Qf,qh)|0;var dc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(dc>>>26)|0,dc&=67108863,Wr=Math.imul(vh,Ih),R=Math.imul(vh,_h),R=R+Math.imul(Yo,Ih)|0,Le=Math.imul(Yo,_h),Wr=Wr+Math.imul(jf,Dh)|0,R=R+Math.imul(jf,yh)|0,R=R+Math.imul(Zo,Dh)|0,Le=Le+Math.imul(Zo,yh)|0,Wr=Wr+Math.imul(Lf,Bh)|0,R=R+Math.imul(Lf,Mh)|0,R=R+Math.imul(Uo,Bh)|0,Le=Le+Math.imul(Uo,Mh)|0,Wr=Wr+Math.imul(tf,kh)|0,R=R+Math.imul(tf,qh)|0,R=R+Math.imul(Ko,kh)|0,Le=Le+Math.imul(Ko,qh)|0;var $0=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+($0>>>26)|0,$0&=67108863,Wr=Math.imul(vh,Dh),R=Math.imul(vh,yh),R=R+Math.imul(Yo,Dh)|0,Le=Math.imul(Yo,yh),Wr=Wr+Math.imul(jf,Bh)|0,R=R+Math.imul(jf,Mh)|0,R=R+Math.imul(Zo,Bh)|0,Le=Le+Math.imul(Zo,Mh)|0,Wr=Wr+Math.imul(Lf,kh)|0,R=R+Math.imul(Lf,qh)|0,R=R+Math.imul(Uo,kh)|0,Le=Le+Math.imul(Uo,qh)|0;var gc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(gc>>>26)|0,gc&=67108863,Wr=Math.imul(vh,Bh),R=Math.imul(vh,Mh),R=R+Math.imul(Yo,Bh)|0,Le=Math.imul(Yo,Mh),Wr=Wr+Math.imul(jf,kh)|0,R=R+Math.imul(jf,qh)|0,R=R+Math.imul(Zo,kh)|0,Le=Le+Math.imul(Zo,qh)|0;var bc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(bc>>>26)|0,bc&=67108863,Wr=Math.imul(vh,kh),R=Math.imul(vh,qh),R=R+Math.imul(Yo,kh)|0,Le=Math.imul(Yo,qh);var yc=(ii+Wr|0)+((R&8191)<<13)|0;return ii=(Le+(R>>>13)|0)+(yc>>>26)|0,yc&=67108863,ei[0]=Tu,ei[1]=tc,ei[2]=rc,ei[3]=ic,ei[4]=nc,ei[5]=sc,ei[6]=s0,ei[7]=hc,ei[8]=pc,ei[9]=uc,ei[10]=vc,ei[11]=mc,ei[12]=cc,ei[13]=lc,ei[14]=dc,ei[15]=$0,ei[16]=gc,ei[17]=bc,ei[18]=yc,ii!==0&&(ei[19]=ii,Ie.length++),Ie};Math.imul||(mi=li);function hn(oi,t,F){F.negative=t.negative^oi.negative,F.length=oi.length+t.length;for(var Ie=0,Te=0,Xr=0;Xr>>26)|0,Te+=ei>>>26,ei&=67108863}F.words[Xr]=ii,Ie=ei,ei=Te}return Ie!==0?F.words[Xr]=Ie:F.length--,F.strip()}function ln(oi,t,F){var Ie=new fn;return Ie.mulp(oi,t,F)}W.prototype.mulTo=function(t,F){var Ie,Te=this.length+t.length;return this.length===10&&t.length===10?Ie=mi(this,t,F):Te<63?Ie=li(this,t,F):Te<1024?Ie=hn(this,t,F):Ie=ln(this,t,F),Ie};function fn(oi,t){this.x=oi,this.y=t}fn.prototype.makeRBT=function(t){for(var F=new Array(t),Ie=W.prototype._countBits(t)-1,Te=0;Te>=1;return Te},fn.prototype.permute=function(t,F,Ie,Te,Xr,ei){for(var ii=0;ii>>1)Xr++;return 1<>>13,Ie[2*ei+1]=Xr&8191,Xr=Xr>>>13;for(ei=2*F;ei>=26,F+=Te/67108864|0,F+=Xr>>>26,this.words[Ie]=Xr&67108863}return F!==0&&(this.words[Ie]=F,this.length++),this},W.prototype.muln=function(t){return this.clone().imuln(t)},W.prototype.sqr=function(){return this.mul(this)},W.prototype.isqr=function(){return this.imul(this.clone())},W.prototype.pow=function(t){var F=ui(t);if(F.length===0)return new W(1);for(var Ie=this,Te=0;Te=0);var F=t%26,Ie=(t-F)/26,Te=67108863>>>26-F<<26-F,Xr;if(F!==0){var ei=0;for(Xr=0;Xr>>26-F}ei&&(this.words[Xr]=ei,this.length++)}if(Ie!==0){for(Xr=this.length-1;Xr>=0;Xr--)this.words[Xr+Ie]=this.words[Xr];for(Xr=0;Xr=0);var Te;F?Te=(F-F%26)/26:Te=0;var Xr=t%26,ei=Math.min((t-Xr)/26,this.length),ii=67108863^67108863>>>Xr<ei)for(this.length-=ei,R=0;R=0&&(Le!==0||R>=Te);R--){var nn=this.words[R]|0;this.words[R]=Le<<26-Xr|nn>>>Xr,Le=nn&ii}return Wr&&Le!==0&&(Wr.words[Wr.length++]=Le),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},W.prototype.ishrn=function(t,F,Ie){return Y(this.negative===0),this.iushrn(t,F,Ie)},W.prototype.shln=function(t){return this.clone().ishln(t)},W.prototype.ushln=function(t){return this.clone().iushln(t)},W.prototype.shrn=function(t){return this.clone().ishrn(t)},W.prototype.ushrn=function(t){return this.clone().iushrn(t)},W.prototype.testn=function(t){Y(typeof t=="number"&&t>=0);var F=t%26,Ie=(t-F)/26,Te=1<=0);var F=t%26,Ie=(t-F)/26;if(Y(this.negative===0,"imaskn works only with positive numbers"),this.length<=Ie)return this;if(F!==0&&Ie++,this.length=Math.min(Ie,this.length),F!==0){var Te=67108863^67108863>>>F<=67108864;F++)this.words[F]-=67108864,F===this.length-1?this.words[F+1]=1:this.words[F+1]++;return this.length=Math.max(this.length,F+1),this},W.prototype.isubn=function(t){if(Y(typeof t=="number"),Y(t<67108864),t<0)return this.iaddn(-t);if(this.negative!==0)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var F=0;F>26)-(Wr/67108864|0),this.words[Xr+Ie]=ei&67108863}for(;Xr>26,this.words[Xr+Ie]=ei&67108863;if(ii===0)return this.strip();for(Y(ii===-1),ii=0,Xr=0;Xr>26,this.words[Xr]=ei&67108863;return this.negative=1,this.strip()},W.prototype._wordDiv=function(t,F){var Ie=this.length-t.length,Te=this.clone(),Xr=t,ei=Xr.words[Xr.length-1]|0,ii=this._countBits(ei);Ie=26-ii,Ie!==0&&(Xr=Xr.ushln(Ie),Te.iushln(Ie),ei=Xr.words[Xr.length-1]|0);var Wr=Te.length-Xr.length,R;if(F!=="mod"){R=new W(null),R.length=Wr+1,R.words=new Array(R.length);for(var Le=0;Le=0;vn--){var Mn=(Te.words[Xr.length+vn]|0)*67108864+(Te.words[Xr.length+vn-1]|0);for(Mn=Math.min(Mn/ei|0,67108863),Te._ishlnsubmul(Xr,Mn,vn);Te.negative!==0;)Mn--,Te.negative=0,Te._ishlnsubmul(Xr,1,vn),Te.isZero()||(Te.negative^=1);R&&(R.words[vn]=Mn)}return R&&R.strip(),Te.strip(),F!=="div"&&Ie!==0&&Te.iushrn(Ie),{div:R||null,mod:Te}},W.prototype.divmod=function(t,F,Ie){if(Y(!t.isZero()),this.isZero())return{div:new W(0),mod:new W(0)};var Te,Xr,ei;return this.negative!==0&&t.negative===0?(ei=this.neg().divmod(t,F),F!=="mod"&&(Te=ei.div.neg()),F!=="div"&&(Xr=ei.mod.neg(),Ie&&Xr.negative!==0&&Xr.iadd(t)),{div:Te,mod:Xr}):this.negative===0&&t.negative!==0?(ei=this.divmod(t.neg(),F),F!=="mod"&&(Te=ei.div.neg()),{div:Te,mod:ei.mod}):this.negative&t.negative?(ei=this.neg().divmod(t.neg(),F),F!=="div"&&(Xr=ei.mod.neg(),Ie&&Xr.negative!==0&&Xr.isub(t)),{div:ei.div,mod:Xr}):t.length>this.length||this.cmp(t)<0?{div:new W(0),mod:this}:t.length===1?F==="div"?{div:this.divn(t.words[0]),mod:null}:F==="mod"?{div:null,mod:new W(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new W(this.modn(t.words[0]))}:this._wordDiv(t,F)},W.prototype.div=function(t){return this.divmod(t,"div",!1).div},W.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},W.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},W.prototype.divRound=function(t){var F=this.divmod(t);if(F.mod.isZero())return F.div;var Ie=F.div.negative!==0?F.mod.isub(t):F.mod,Te=t.ushrn(1),Xr=t.andln(1),ei=Ie.cmp(Te);return ei<0||Xr===1&&ei===0?F.div:F.div.negative!==0?F.div.isubn(1):F.div.iaddn(1)},W.prototype.modn=function(t){Y(t<=67108863);for(var F=(1<<26)%t,Ie=0,Te=this.length-1;Te>=0;Te--)Ie=(F*Ie+(this.words[Te]|0))%t;return Ie},W.prototype.idivn=function(t){Y(t<=67108863);for(var F=0,Ie=this.length-1;Ie>=0;Ie--){var Te=(this.words[Ie]|0)+F*67108864;this.words[Ie]=Te/t|0,F=Te%t}return this.strip()},W.prototype.divn=function(t){return this.clone().idivn(t)},W.prototype.egcd=function(t){Y(t.negative===0),Y(!t.isZero());var F=this,Ie=t.clone();F.negative!==0?F=F.umod(t):F=F.clone();for(var Te=new W(1),Xr=new W(0),ei=new W(0),ii=new W(1),Wr=0;F.isEven()&&Ie.isEven();)F.iushrn(1),Ie.iushrn(1),++Wr;for(var R=Ie.clone(),Le=F.clone();!F.isZero();){for(var nn=0,vn=1;!(F.words[0]&vn)&&nn<26;++nn,vn<<=1);if(nn>0)for(F.iushrn(nn);nn-- >0;)(Te.isOdd()||Xr.isOdd())&&(Te.iadd(R),Xr.isub(Le)),Te.iushrn(1),Xr.iushrn(1);for(var Mn=0,sn=1;!(Ie.words[0]&sn)&&Mn<26;++Mn,sn<<=1);if(Mn>0)for(Ie.iushrn(Mn);Mn-- >0;)(ei.isOdd()||ii.isOdd())&&(ei.iadd(R),ii.isub(Le)),ei.iushrn(1),ii.iushrn(1);F.cmp(Ie)>=0?(F.isub(Ie),Te.isub(ei),Xr.isub(ii)):(Ie.isub(F),ei.isub(Te),ii.isub(Xr))}return{a:ei,b:ii,gcd:Ie.iushln(Wr)}},W.prototype._invmp=function(t){Y(t.negative===0),Y(!t.isZero());var F=this,Ie=t.clone();F.negative!==0?F=F.umod(t):F=F.clone();for(var Te=new W(1),Xr=new W(0),ei=Ie.clone();F.cmpn(1)>0&&Ie.cmpn(1)>0;){for(var ii=0,Wr=1;!(F.words[0]&Wr)&&ii<26;++ii,Wr<<=1);if(ii>0)for(F.iushrn(ii);ii-- >0;)Te.isOdd()&&Te.iadd(ei),Te.iushrn(1);for(var R=0,Le=1;!(Ie.words[0]&Le)&&R<26;++R,Le<<=1);if(R>0)for(Ie.iushrn(R);R-- >0;)Xr.isOdd()&&Xr.iadd(ei),Xr.iushrn(1);F.cmp(Ie)>=0?(F.isub(Ie),Te.isub(Xr)):(Ie.isub(F),Xr.isub(Te))}var nn;return F.cmpn(1)===0?nn=Te:nn=Xr,nn.cmpn(0)<0&&nn.iadd(t),nn},W.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var F=this.clone(),Ie=t.clone();F.negative=0,Ie.negative=0;for(var Te=0;F.isEven()&&Ie.isEven();Te++)F.iushrn(1),Ie.iushrn(1);do{for(;F.isEven();)F.iushrn(1);for(;Ie.isEven();)Ie.iushrn(1);var Xr=F.cmp(Ie);if(Xr<0){var ei=F;F=Ie,Ie=ei}else if(Xr===0||Ie.cmpn(1)===0)break;F.isub(Ie)}while(!0);return Ie.iushln(Te)},W.prototype.invm=function(t){return this.egcd(t).a.umod(t)},W.prototype.isEven=function(){return(this.words[0]&1)===0},W.prototype.isOdd=function(){return(this.words[0]&1)===1},W.prototype.andln=function(t){return this.words[0]&t},W.prototype.bincn=function(t){Y(typeof t=="number");var F=t%26,Ie=(t-F)/26,Te=1<>>26,ii&=67108863,this.words[ei]=ii}return Xr!==0&&(this.words[ei]=Xr,this.length++),this},W.prototype.isZero=function(){return this.length===1&&this.words[0]===0},W.prototype.cmpn=function(t){var F=t<0;if(this.negative!==0&&!F)return-1;if(this.negative===0&&F)return 1;this.strip();var Ie;if(this.length>1)Ie=1;else{F&&(t=-t),Y(t<=67108863,"Number is too big");var Te=this.words[0]|0;Ie=Te===t?0:Tet.length)return 1;if(this.length=0;Ie--){var Te=this.words[Ie]|0,Xr=t.words[Ie]|0;if(Te!==Xr){TeXr&&(F=1);break}}return F},W.prototype.gtn=function(t){return this.cmpn(t)===1},W.prototype.gt=function(t){return this.cmp(t)===1},W.prototype.gten=function(t){return this.cmpn(t)>=0},W.prototype.gte=function(t){return this.cmp(t)>=0},W.prototype.ltn=function(t){return this.cmpn(t)===-1},W.prototype.lt=function(t){return this.cmp(t)===-1},W.prototype.lten=function(t){return this.cmpn(t)<=0},W.prototype.lte=function(t){return this.cmp(t)<=0},W.prototype.eqn=function(t){return this.cmpn(t)===0},W.prototype.eq=function(t){return this.cmp(t)===0},W.red=function(t){return new Ya(t)},W.prototype.toRed=function(t){return Y(!this.red,"Already a number in reduction context"),Y(this.negative===0,"red works only with positives"),t.convertTo(this)._forceRed(t)},W.prototype.fromRed=function(){return Y(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},W.prototype._forceRed=function(t){return this.red=t,this},W.prototype.forceRed=function(t){return Y(!this.red,"Already a number in reduction context"),this._forceRed(t)},W.prototype.redAdd=function(t){return Y(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},W.prototype.redIAdd=function(t){return Y(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},W.prototype.redSub=function(t){return Y(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},W.prototype.redISub=function(t){return Y(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},W.prototype.redShl=function(t){return Y(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},W.prototype.redMul=function(t){return Y(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},W.prototype.redIMul=function(t){return Y(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},W.prototype.redSqr=function(){return Y(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},W.prototype.redISqr=function(){return Y(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},W.prototype.redSqrt=function(){return Y(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},W.prototype.redInvm=function(){return Y(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},W.prototype.redNeg=function(){return Y(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},W.prototype.redPow=function(t){return Y(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var gn={k256:null,p224:null,p192:null,p25519:null};function cn(oi,t){this.name=oi,this.p=new W(t,16),this.n=this.p.bitLength(),this.k=new W(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}cn.prototype._tmp=function(){var t=new W(null);return t.words=new Array(Math.ceil(this.n/13)),t},cn.prototype.ireduce=function(t){var F=t,Ie;do this.split(F,this.tmp),F=this.imulK(F),F=F.iadd(this.tmp),Ie=F.bitLength();while(Ie>this.n);var Te=Ie0?F.isub(this.p):F.strip!==void 0?F.strip():F._strip(),F},cn.prototype.split=function(t,F){t.iushrn(this.n,0,F)},cn.prototype.imulK=function(t){return t.imul(this.k)};function An(){cn.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}Ne(An,cn),An.prototype.split=function(t,F){for(var Ie=4194303,Te=Math.min(t.length,9),Xr=0;Xr>>22,ei=ii}ei>>>=22,t.words[Xr-10]=ei,ei===0&&t.length>10?t.length-=10:t.length-=9},An.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var F=0,Ie=0;Ie>>=26,t.words[Ie]=Xr,F=Te}return F!==0&&(t.words[t.length++]=F),t},W._prime=function(t){if(gn[t])return gn[t];var F;if(t==="k256")F=new An;else if(t==="p224")F=new Cn;else if(t==="p192")F=new an;else if(t==="p25519")F=new Rn;else throw new Error("Unknown prime "+t);return gn[t]=F,F};function Ya(oi){if(typeof oi=="string"){var t=W._prime(oi);this.m=t.p,this.prime=t}else Y(oi.gtn(1),"modulus must be greater than 1"),this.m=oi,this.prime=null}Ya.prototype._verify1=function(t){Y(t.negative===0,"red works only with positives"),Y(t.red,"red works only with red numbers")},Ya.prototype._verify2=function(t,F){Y((t.negative|F.negative)===0,"red works only with positives"),Y(t.red&&t.red===F.red,"red works only with red numbers")},Ya.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},Ya.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},Ya.prototype.add=function(t,F){this._verify2(t,F);var Ie=t.add(F);return Ie.cmp(this.m)>=0&&Ie.isub(this.m),Ie._forceRed(this)},Ya.prototype.iadd=function(t,F){this._verify2(t,F);var Ie=t.iadd(F);return Ie.cmp(this.m)>=0&&Ie.isub(this.m),Ie},Ya.prototype.sub=function(t,F){this._verify2(t,F);var Ie=t.sub(F);return Ie.cmpn(0)<0&&Ie.iadd(this.m),Ie._forceRed(this)},Ya.prototype.isub=function(t,F){this._verify2(t,F);var Ie=t.isub(F);return Ie.cmpn(0)<0&&Ie.iadd(this.m),Ie},Ya.prototype.shl=function(t,F){return this._verify1(t),this.imod(t.ushln(F))},Ya.prototype.imul=function(t,F){return this._verify2(t,F),this.imod(t.imul(F))},Ya.prototype.mul=function(t,F){return this._verify2(t,F),this.imod(t.mul(F))},Ya.prototype.isqr=function(t){return this.imul(t,t.clone())},Ya.prototype.sqr=function(t){return this.mul(t,t)},Ya.prototype.sqrt=function(t){if(t.isZero())return t.clone();var F=this.m.andln(3);if(Y(F%2===1),F===3){var Ie=this.m.add(new W(1)).iushrn(2);return this.pow(t,Ie)}for(var Te=this.m.subn(1),Xr=0;!Te.isZero()&&Te.andln(1)===0;)Xr++,Te.iushrn(1);Y(!Te.isZero());var ei=new W(1).toRed(this),ii=ei.redNeg(),Wr=this.m.subn(1).iushrn(1),R=this.m.bitLength();for(R=new W(2*R*R).toRed(this);this.pow(R,Wr).cmp(ii)!==0;)R.redIAdd(ii);for(var Le=this.pow(R,Te),nn=this.pow(t,Te.addn(1).iushrn(1)),vn=this.pow(t,Te),Mn=Xr;vn.cmp(ei)!==0;){for(var sn=vn,Zn=0;sn.cmp(ei)!==0;Zn++)sn=sn.redSqr();Y(Zn=0;Xr--){for(var Le=F.words[Xr],nn=R-1;nn>=0;nn--){var vn=Le>>nn&1;if(ei!==Te[0]&&(ei=this.sqr(ei)),vn===0&&ii===0){Wr=0;continue}ii<<=1,ii|=vn,Wr++,!(Wr!==Ie&&(Xr!==0||nn!==0))&&(ei=this.mul(ei,Te[ii]),Wr=0,ii=0)}R=26}return ei},Ya.prototype.convertTo=function(t){var F=t.umod(this.m);return F===t?F.clone():F},Ya.prototype.convertFrom=function(t){var F=t.clone();return F.red=null,F},W.mont=function(t){return new Ho(t)};function Ho(oi){Ya.call(this,oi),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new W(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}Ne(Ho,Ya),Ho.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},Ho.prototype.convertFrom=function(t){var F=this.imod(t.mul(this.rinv));return F.red=null,F},Ho.prototype.imul=function(t,F){if(t.isZero()||F.isZero())return t.words[0]=0,t.length=1,t;var Ie=t.imul(F),Te=Ie.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Xr=Ie.isub(Te).iushrn(this.shift),ei=Xr;return Xr.cmp(this.m)>=0?ei=Xr.isub(this.m):Xr.cmpn(0)<0&&(ei=Xr.iadd(this.m)),ei._forceRed(this)},Ho.prototype.mul=function(t,F){if(t.isZero()||F.isZero())return new W(0)._forceRed(this);var Ie=t.mul(F),Te=Ie.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Xr=Ie.isub(Te).iushrn(this.shift),ei=Xr;return Xr.cmp(this.m)>=0?ei=Xr.isub(this.m):Xr.cmpn(0)<0&&(ei=Xr.iadd(this.m)),ei._forceRed(this)},Ho.prototype.invm=function(t){var F=this.imod(t._invmp(this.m).mul(this.r2));return F._forceRed(this)}})(G,commonjsGlobal)}(bn$5)),bn$5.exports}var brorand={exports:{}},hasRequiredBrorand;function requireBrorand(){if(hasRequiredBrorand)return brorand.exports;hasRequiredBrorand=1;var G;brorand.exports=function(Ne){return G||(G=new e(null)),G.generate(Ne)};function e(Y){this.rand=Y}if(brorand.exports.Rand=e,e.prototype.generate=function(Ne){return this._rand(Ne)},e.prototype._rand=function(Ne){if(this.rand.getBytes)return this.rand.getBytes(Ne);for(var W=new Uint8Array(Ne),ri=0;ri=0);return si},H.prototype._randrange=function(Ne,W){var ri=W.sub(Ne);return Ne.add(this._randbelow(ri))},H.prototype.test=function(Ne,W,ri){var si=Ne.bitLength(),fi=G.mont(Ne),ai=new G(1).toRed(fi);W||(W=Math.max(1,si/48|0));for(var ti=Ne.subn(1),hi=0;!ti.testn(hi);hi++);for(var ci=Ne.shrn(hi),ui=ti.toRed(fi),li=!0;W>0;W--){var mi=this._randrange(new G(2),ti);ri&&ri(mi);var hn=mi.toRed(fi).redPow(ci);if(!(hn.cmp(ai)===0||hn.cmp(ui)===0)){for(var ln=1;ln0;W--){var ui=this._randrange(new G(2),ai),li=Ne.gcd(ui);if(li.cmpn(1)!==0)return li;var mi=ui.toRed(si).redPow(hi);if(!(mi.cmp(fi)===0||mi.cmp(ci)===0)){for(var hn=1;hnln;)gn.ishrn(1);if(gn.isEven()&&gn.iadd(W),gn.testn(1)||gn.iadd(ri),fn.cmp(ri)){if(!fn.cmp(si))for(;gn.mod(fi).cmp(ai);)gn.iadd(hi)}else for(;gn.mod(H).cmp(ti);)gn.iadd(hi);if(cn=gn.shrn(1),li(cn)&&li(gn)&&mi(cn)&&mi(gn)&&Ne.test(cn)&&Ne.test(gn))return gn}}return generatePrime}const modp1={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a63a3620ffffffffffffffff"},modp2={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece65381ffffffffffffffff"},modp5={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca237327ffffffffffffffff"},modp14={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aacaa68ffffffffffffffff"},modp15={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffff"},modp16={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffff"},modp17={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffff"},modp18={gen:"02",prime:"ffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffff"},require$$1$1={modp1,modp2,modp5,modp14,modp15,modp16,modp17,modp18};var dh,hasRequiredDh;function requireDh(){if(hasRequiredDh)return dh;hasRequiredDh=1;var G=requireBn$5(),e=requireMr(),H=new e,Y=new G(24),Ne=new G(11),W=new G(10),ri=new G(3),si=new G(7),fi=requireGeneratePrime(),ai=requireBrowser$a();dh=li;function ti(hn,ln){return ln=ln||"utf8",Buffer.isBuffer(hn)||(hn=new Buffer(hn,ln)),this._pub=new G(hn),this}function hi(hn,ln){return ln=ln||"utf8",Buffer.isBuffer(hn)||(hn=new Buffer(hn,ln)),this._priv=new G(hn),this}var ci={};function ui(hn,ln){var fn=ln.toString("hex"),gn=[fn,hn.toString(16)].join("_");if(gn in ci)return ci[gn];var cn=0;if(hn.isEven()||!fi.simpleSieve||!fi.fermatTest(hn)||!H.test(hn))return cn+=1,fn==="02"||fn==="05"?cn+=8:cn+=4,ci[gn]=cn,cn;H.test(hn.shrn(1))||(cn+=2);var An;switch(fn){case"02":hn.mod(Y).cmp(Ne)&&(cn+=8);break;case"05":An=hn.mod(W),An.cmp(ri)&&An.cmp(si)&&(cn+=8);break;default:cn+=4}return ci[gn]=cn,cn}function li(hn,ln,fn){this.setGenerator(ln),this.__prime=new G(hn),this._prime=G.mont(this.__prime),this._primeLen=hn.length,this._pub=void 0,this._priv=void 0,this._primeCode=void 0,fn?(this.setPublicKey=ti,this.setPrivateKey=hi):this._primeCode=8}Object.defineProperty(li.prototype,"verifyError",{enumerable:!0,get:function(){return typeof this._primeCode!="number"&&(this._primeCode=ui(this.__prime,this.__gen)),this._primeCode}}),li.prototype.generateKeys=function(){return this._priv||(this._priv=new G(ai(this._primeLen))),this._pub=this._gen.toRed(this._prime).redPow(this._priv).fromRed(),this.getPublicKey()},li.prototype.computeSecret=function(hn){hn=new G(hn),hn=hn.toRed(this._prime);var ln=hn.redPow(this._priv).fromRed(),fn=new Buffer(ln.toArray()),gn=this.getPrime();if(fn.length"u"||!process$1.version||process$1.version.indexOf("v0.")===0||process$1.version.indexOf("v1.")===0&&process$1.version.indexOf("v1.8.")!==0?processNextickArgs.exports={nextTick:G}:processNextickArgs.exports=process$1;function G(e,H,Y,Ne){if(typeof e!="function")throw new TypeError('"callback" argument must be a function');var W=arguments.length,ri,si;switch(W){case 0:case 1:return process$1.nextTick(e);case 2:return process$1.nextTick(function(){e.call(null,H)});case 3:return process$1.nextTick(function(){e.call(null,H,Y)});case 4:return process$1.nextTick(function(){e.call(null,H,Y,Ne)});default:for(ri=new Array(W-1),si=0;si"u"}util.isPrimitive=ui,util.isBuffer=require$$0$3.Buffer.isBuffer;function li(mi){return Object.prototype.toString.call(mi)}return util}var BufferList={exports:{}},hasRequiredBufferList;function requireBufferList(){return hasRequiredBufferList||(hasRequiredBufferList=1,function(G){function e(W,ri){if(!(W instanceof ri))throw new TypeError("Cannot call a class as a function")}var H=requireSafeBuffer().Buffer,Y=util$1;function Ne(W,ri,si){W.copy(ri,si)}G.exports=function(){function W(){e(this,W),this.head=null,this.tail=null,this.length=0}return W.prototype.push=function(si){var fi={data:si,next:null};this.length>0?this.tail.next=fi:this.head=fi,this.tail=fi,++this.length},W.prototype.unshift=function(si){var fi={data:si,next:this.head};this.length===0&&(this.tail=fi),this.head=fi,++this.length},W.prototype.shift=function(){if(this.length!==0){var si=this.head.data;return this.length===1?this.head=this.tail=null:this.head=this.head.next,--this.length,si}},W.prototype.clear=function(){this.head=this.tail=null,this.length=0},W.prototype.join=function(si){if(this.length===0)return"";for(var fi=this.head,ai=""+fi.data;fi=fi.next;)ai+=si+fi.data;return ai},W.prototype.concat=function(si){if(this.length===0)return H.alloc(0);for(var fi=H.allocUnsafe(si>>>0),ai=this.head,ti=0;ai;)Ne(ai.data,fi,ti),ti+=ai.data.length,ai=ai.next;return fi},W}(),Y&&Y.inspect&&Y.inspect.custom&&(G.exports.prototype[Y.inspect.custom]=function(){var W=Y.inspect({length:this.length});return this.constructor.name+" "+W})}(BufferList)),BufferList.exports}var destroy_1,hasRequiredDestroy;function requireDestroy(){if(hasRequiredDestroy)return destroy_1;hasRequiredDestroy=1;var G=requireProcessNextickArgs();function e(Ne,W){var ri=this,si=this._readableState&&this._readableState.destroyed,fi=this._writableState&&this._writableState.destroyed;return si||fi?(W?W(Ne):Ne&&(this._writableState?this._writableState.errorEmitted||(this._writableState.errorEmitted=!0,G.nextTick(Y,this,Ne)):G.nextTick(Y,this,Ne)),this):(this._readableState&&(this._readableState.destroyed=!0),this._writableState&&(this._writableState.destroyed=!0),this._destroy(Ne||null,function(ai){!W&&ai?ri._writableState?ri._writableState.errorEmitted||(ri._writableState.errorEmitted=!0,G.nextTick(Y,ri,ai)):G.nextTick(Y,ri,ai):W&&W(ai)}),this)}function H(){this._readableState&&(this._readableState.destroyed=!1,this._readableState.reading=!1,this._readableState.ended=!1,this._readableState.endEmitted=!1),this._writableState&&(this._writableState.destroyed=!1,this._writableState.ended=!1,this._writableState.ending=!1,this._writableState.finalCalled=!1,this._writableState.prefinished=!1,this._writableState.finished=!1,this._writableState.errorEmitted=!1)}function Y(Ne,W){Ne.emit("error",W)}return destroy_1={destroy:e,undestroy:H},destroy_1}var _stream_writable,hasRequired_stream_writable;function require_stream_writable(){if(hasRequired_stream_writable)return _stream_writable;hasRequired_stream_writable=1;var G=requireProcessNextickArgs();_stream_writable=mi;function e(ei){var ii=this;this.next=null,this.entry=null,this.finish=function(){Xr(ii,ei)}}var H=!process$1.browser&&["v0.10","v0.9."].indexOf(process$1.version.slice(0,5))>-1?setImmediate:G.nextTick,Y;mi.WritableState=ui;var Ne=Object.create(requireUtil());Ne.inherits=inherits_browserExports;var W={deprecate:browser$e},ri=requireStreamBrowser(),si=requireSafeBuffer().Buffer,fi=(typeof commonjsGlobal<"u"?commonjsGlobal:typeof window<"u"?window:typeof self<"u"?self:{}).Uint8Array||function(){};function ai(ei){return si.from(ei)}function ti(ei){return si.isBuffer(ei)||ei instanceof fi}var hi=requireDestroy();Ne.inherits(mi,ri);function ci(){}function ui(ei,ii){Y=Y||require_stream_duplex(),ei=ei||{};var Wr=ii instanceof Y;this.objectMode=!!ei.objectMode,Wr&&(this.objectMode=this.objectMode||!!ei.writableObjectMode);var R=ei.highWaterMark,Le=ei.writableHighWaterMark,nn=this.objectMode?16:16*1024;R||R===0?this.highWaterMark=R:Wr&&(Le||Le===0)?this.highWaterMark=Le:this.highWaterMark=nn,this.highWaterMark=Math.floor(this.highWaterMark),this.finalCalled=!1,this.needDrain=!1,this.ending=!1,this.ended=!1,this.finished=!1,this.destroyed=!1;var vn=ei.decodeStrings===!1;this.decodeStrings=!vn,this.defaultEncoding=ei.defaultEncoding||"utf8",this.length=0,this.writing=!1,this.corked=0,this.sync=!0,this.bufferProcessing=!1,this.onwrite=function(Mn){an(ii,Mn)},this.writecb=null,this.writelen=0,this.bufferedRequest=null,this.lastBufferedRequest=null,this.pendingcb=0,this.prefinished=!1,this.errorEmitted=!1,this.bufferedRequestCount=0,this.corkedRequestsFree=new e(this)}ui.prototype.getBuffer=function(){for(var ii=this.bufferedRequest,Wr=[];ii;)Wr.push(ii),ii=ii.next;return Wr},function(){try{Object.defineProperty(ui.prototype,"buffer",{get:W.deprecate(function(){return this.getBuffer()},"_writableState.buffer is deprecated. Use _writableState.getBuffer instead.","DEP0003")})}catch{}}();var li;typeof Symbol=="function"&&Symbol.hasInstance&&typeof Function.prototype[Symbol.hasInstance]=="function"?(li=Function.prototype[Symbol.hasInstance],Object.defineProperty(mi,Symbol.hasInstance,{value:function(ei){return li.call(this,ei)?!0:this!==mi?!1:ei&&ei._writableState instanceof ui}})):li=function(ei){return ei instanceof this};function mi(ei){if(Y=Y||require_stream_duplex(),!li.call(mi,this)&&!(this instanceof Y))return new mi(ei);this._writableState=new ui(ei,this),this.writable=!0,ei&&(typeof ei.write=="function"&&(this._write=ei.write),typeof ei.writev=="function"&&(this._writev=ei.writev),typeof ei.destroy=="function"&&(this._destroy=ei.destroy),typeof ei.final=="function"&&(this._final=ei.final)),ri.call(this)}mi.prototype.pipe=function(){this.emit("error",new Error("Cannot pipe, not readable"))};function hn(ei,ii){var Wr=new Error("write after end");ei.emit("error",Wr),G.nextTick(ii,Wr)}function ln(ei,ii,Wr,R){var Le=!0,nn=!1;return Wr===null?nn=new TypeError("May not write null values to stream"):typeof Wr!="string"&&Wr!==void 0&&!ii.objectMode&&(nn=new TypeError("Invalid non-string/buffer chunk")),nn&&(ei.emit("error",nn),G.nextTick(R,nn),Le=!1),Le}mi.prototype.write=function(ei,ii,Wr){var R=this._writableState,Le=!1,nn=!R.objectMode&&ti(ei);return nn&&!si.isBuffer(ei)&&(ei=ai(ei)),typeof ii=="function"&&(Wr=ii,ii=null),nn?ii="buffer":ii||(ii=R.defaultEncoding),typeof Wr!="function"&&(Wr=ci),R.ended?hn(this,Wr):(nn||ln(this,R,ei,Wr))&&(R.pendingcb++,Le=gn(this,R,nn,ei,ii,Wr)),Le},mi.prototype.cork=function(){var ei=this._writableState;ei.corked++},mi.prototype.uncork=function(){var ei=this._writableState;ei.corked&&(ei.corked--,!ei.writing&&!ei.corked&&!ei.bufferProcessing&&ei.bufferedRequest&&Ho(this,ei))},mi.prototype.setDefaultEncoding=function(ii){if(typeof ii=="string"&&(ii=ii.toLowerCase()),!(["hex","utf8","utf-8","ascii","binary","base64","ucs2","ucs-2","utf16le","utf-16le","raw"].indexOf((ii+"").toLowerCase())>-1))throw new TypeError("Unknown encoding: "+ii);return this._writableState.defaultEncoding=ii,this};function fn(ei,ii,Wr){return!ei.objectMode&&ei.decodeStrings!==!1&&typeof ii=="string"&&(ii=si.from(ii,Wr)),ii}Object.defineProperty(mi.prototype,"writableHighWaterMark",{enumerable:!1,get:function(){return this._writableState.highWaterMark}});function gn(ei,ii,Wr,R,Le,nn){if(!Wr){var vn=fn(ii,R,Le);R!==vn&&(Wr=!0,Le="buffer",R=vn)}var Mn=ii.objectMode?1:R.length;ii.length+=Mn;var sn=ii.length0?(typeof pn!="string"&&!Do.objectMode&&Object.getPrototypeOf(pn)!==W.prototype&&(pn=si(pn)),$i?Do.endEmitted?on.emit("error",new Error("stream.unshift() after end event")):cn(on,Do,pn,!0):Do.ended?on.emit("error",new Error("stream.push() after EOF")):(Do.reading=!1,Do.decoder&&!mn?(pn=Do.decoder.write(pn),Do.objectMode||pn.length!==0?cn(on,Do,pn,!1):F(on,Do)):cn(on,Do,pn,!1))):$i||(Do.reading=!1)}return Cn(Do)}function cn(on,pn,mn,$i){pn.flowing&&pn.length===0&&!pn.sync?(on.emit("data",mn),on.read(0)):(pn.length+=pn.objectMode?1:mn.length,$i?pn.buffer.unshift(mn):pn.buffer.push(mn),pn.needReadable&&oi(on)),F(on,pn)}function An(on,pn){var mn;return!fi(pn)&&typeof pn!="string"&&pn!==void 0&&!on.objectMode&&(mn=new TypeError("Invalid non-string/buffer chunk")),mn}function Cn(on){return!on.ended&&(on.needReadable||on.length=an?on=an:(on--,on|=on>>>1,on|=on>>>2,on|=on>>>4,on|=on>>>8,on|=on>>>16,on++),on}function Ya(on,pn){return on<=0||pn.length===0&&pn.ended?0:pn.objectMode?1:on!==on?pn.flowing&&pn.length?pn.buffer.head.data.length:pn.length:(on>pn.highWaterMark&&(pn.highWaterMark=Rn(on)),on<=pn.length?on:pn.ended?pn.length:(pn.needReadable=!0,0))}fn.prototype.read=function(on){hi("read",on),on=parseInt(on,10);var pn=this._readableState,mn=on;if(on!==0&&(pn.emittedReadable=!1),on===0&&pn.needReadable&&(pn.length>=pn.highWaterMark||pn.ended))return hi("read: emitReadable",pn.length,pn.ended),pn.length===0&&pn.ended?Mn(this):oi(this),null;if(on=Ya(on,pn),on===0&&pn.ended)return pn.length===0&&Mn(this),null;var $i=pn.needReadable;hi("need readable",$i),(pn.length===0||pn.length-on0?ho=R(on,pn):ho=null,ho===null?(pn.needReadable=!0,on=0):pn.length-=on,pn.length===0&&(pn.ended||(pn.needReadable=!0),mn!==on&&pn.ended&&Mn(this)),ho!==null&&this.emit("data",ho),ho};function Ho(on,pn){if(!pn.ended){if(pn.decoder){var mn=pn.decoder.end();mn&&mn.length&&(pn.buffer.push(mn),pn.length+=pn.objectMode?1:mn.length)}pn.ended=!0,oi(on)}}function oi(on){var pn=on._readableState;pn.needReadable=!1,pn.emittedReadable||(hi("emitReadable",pn.flowing),pn.emittedReadable=!0,pn.sync?G.nextTick(t,on):t(on))}function t(on){hi("emit readable"),on.emit("readable"),Wr(on)}function F(on,pn){pn.readingMore||(pn.readingMore=!0,G.nextTick(Ie,on,pn))}function Ie(on,pn){for(var mn=pn.length;!pn.reading&&!pn.flowing&&!pn.ended&&pn.length1&&Zn($i.pipes,on)!==-1)&&!Vo&&(hi("false write response, pause",$i.awaitDrain),$i.awaitDrain++,Ah=!0),mn.pause())}function Gh(Lf){hi("onerror",Lf),Kh(),on.removeListener("error",Gh),Y(on,"error")===0&&on.emit("error",Lf)}hn(on,"error",Gh);function tf(){on.removeListener("finish",Ko),Kh()}on.once("close",tf);function Ko(){hi("onfinish"),on.removeListener("close",tf),Kh()}on.once("finish",Ko);function Kh(){hi("unpipe"),mn.unpipe(on)}return on.emit("pipe",mn),$i.flowing||(hi("pipe resume"),mn.resume()),on};function Te(on){return function(){var pn=on._readableState;hi("pipeOnDrain",pn.awaitDrain),pn.awaitDrain&&pn.awaitDrain--,pn.awaitDrain===0&&Y(on,"data")&&(pn.flowing=!0,Wr(on))}}fn.prototype.unpipe=function(on){var pn=this._readableState,mn={hasUnpiped:!1};if(pn.pipesCount===0)return this;if(pn.pipesCount===1)return on&&on!==pn.pipes?this:(on||(on=pn.pipes),pn.pipes=null,pn.pipesCount=0,pn.flowing=!1,on&&on.emit("unpipe",this,mn),this);if(!on){var $i=pn.pipes,ho=pn.pipesCount;pn.pipes=null,pn.pipesCount=0,pn.flowing=!1;for(var Do=0;Do=pn.length?(pn.decoder?mn=pn.buffer.join(""):pn.buffer.length===1?mn=pn.buffer.head.data:mn=pn.buffer.concat(pn.length),pn.buffer.clear()):mn=Le(on,pn.buffer,pn.decoder),mn}function Le(on,pn,mn){var $i;return onDo.length?Do.length:on;if(To===Do.length?ho+=Do:ho+=Do.slice(0,on),on-=To,on===0){To===Do.length?(++$i,mn.next?pn.head=mn.next:pn.head=pn.tail=null):(pn.head=mn,mn.data=Do.slice(To));break}++$i}return pn.length-=$i,ho}function vn(on,pn){var mn=W.allocUnsafe(on),$i=pn.head,ho=1;for($i.data.copy(mn),on-=$i.data.length;$i=$i.next;){var Do=$i.data,To=on>Do.length?Do.length:on;if(Do.copy(mn,mn.length-on,0,To),on-=To,on===0){To===Do.length?(++ho,$i.next?pn.head=$i.next:pn.head=pn.tail=null):(pn.head=$i,$i.data=Do.slice(To));break}++ho}return pn.length-=ho,mn}function Mn(on){var pn=on._readableState;if(pn.length>0)throw new Error('"endReadable()" called on non-empty stream');pn.endEmitted||(pn.ended=!0,G.nextTick(sn,pn,on))}function sn(on,pn){!on.endEmitted&&on.length===0&&(on.endEmitted=!0,pn.readable=!1,pn.emit("end"))}function Zn(on,pn){for(var mn=0,$i=on.length;mn<$i;mn++)if(on[mn]===pn)return mn;return-1}return _stream_readable}var _stream_transform,hasRequired_stream_transform;function require_stream_transform(){if(hasRequired_stream_transform)return _stream_transform;hasRequired_stream_transform=1,_stream_transform=Y;var G=require_stream_duplex(),e=Object.create(requireUtil());e.inherits=inherits_browserExports,e.inherits(Y,G);function H(ri,si){var fi=this._transformState;fi.transforming=!1;var ai=fi.writecb;if(!ai)return this.emit("error",new Error("write callback called multiple times"));fi.writechunk=null,fi.writecb=null,si!=null&&this.push(si),ai(ri);var ti=this._readableState;ti.reading=!1,(ti.needReadable||ti.length=0||!si.umod(W.prime1)||!si.umod(W.prime2));return si}function Ne(W,ri){var si=H(ri),fi=ri.modulus.byteLength(),ai=new G(W).mul(si.blinder).umod(ri.modulus),ti=ai.toRed(G.mont(ri.prime1)),hi=ai.toRed(G.mont(ri.prime2)),ci=ri.coefficient,ui=ri.prime1,li=ri.prime2,mi=ti.redPow(ri.exponent1).fromRed(),hn=hi.redPow(ri.exponent2).fromRed(),ln=mi.isub(hn).imul(ci).umod(ui).imul(li);return hn.iadd(ln).imul(si.unblinder).umod(ri.modulus).toArrayLike(Buffer,"be",fi)}return Ne.getr=Y,browserifyRsa=Ne,browserifyRsa}var elliptic={};const name="elliptic",version="6.5.5",description="EC cryptography",main="lib/elliptic.js",files=["lib"],scripts={lint:"eslint lib test","lint:fix":"npm run lint -- --fix",unit:"istanbul test _mocha --reporter=spec test/index.js",test:"npm run lint && npm run unit",version:"grunt dist && git add dist/"},repository={type:"git",url:"git@github.com:indutny/elliptic"},keywords=["EC","Elliptic","curve","Cryptography"],author="Fedor Indutny ",license="MIT",bugs={url:"https://github.com/indutny/elliptic/issues"},homepage="https://github.com/indutny/elliptic",devDependencies={brfs:"^2.0.2",coveralls:"^3.1.0",eslint:"^7.6.0",grunt:"^1.2.1","grunt-browserify":"^5.3.0","grunt-cli":"^1.3.2","grunt-contrib-connect":"^3.0.0","grunt-contrib-copy":"^1.0.0","grunt-contrib-uglify":"^5.0.0","grunt-mocha-istanbul":"^5.0.2","grunt-saucelabs":"^9.0.1",istanbul:"^0.4.5",mocha:"^8.0.1"},dependencies={"bn.js":"^4.11.9",brorand:"^1.1.0","hash.js":"^1.0.0","hmac-drbg":"^1.0.1",inherits:"^2.0.4","minimalistic-assert":"^1.0.1","minimalistic-crypto-utils":"^1.0.1"},require$$0$1={name,version,description,main,files,scripts,repository,keywords,author,license,bugs,homepage,devDependencies,dependencies};var utils$2={},bn$4={exports:{}};bn$4.exports;var hasRequiredBn$3;function requireBn$3(){return hasRequiredBn$3||(hasRequiredBn$3=1,function(G){(function(e,H){function Y(oi,t){if(!oi)throw new Error(t||"Assertion failed")}function Ne(oi,t){oi.super_=t;var F=function(){};F.prototype=t.prototype,oi.prototype=new F,oi.prototype.constructor=oi}function W(oi,t,F){if(W.isBN(oi))return oi;this.negative=0,this.words=null,this.length=0,this.red=null,oi!==null&&((t==="le"||t==="be")&&(F=t,t=10),this._init(oi||0,t||10,F||"be"))}typeof e=="object"?e.exports=W:H.BN=W,W.BN=W,W.wordSize=26;var ri;try{typeof window<"u"&&typeof window.Buffer<"u"?ri=window.Buffer:ri=require$$0$3.Buffer}catch{}W.isBN=function(t){return t instanceof W?!0:t!==null&&typeof t=="object"&&t.constructor.wordSize===W.wordSize&&Array.isArray(t.words)},W.max=function(t,F){return t.cmp(F)>0?t:F},W.min=function(t,F){return t.cmp(F)<0?t:F},W.prototype._init=function(t,F,Ie){if(typeof t=="number")return this._initNumber(t,F,Ie);if(typeof t=="object")return this._initArray(t,F,Ie);F==="hex"&&(F=16),Y(F===(F|0)&&F>=2&&F<=36),t=t.toString().replace(/\s+/g,"");var Te=0;t[0]==="-"&&(Te++,this.negative=1),Te=0;Te-=3)ei=t[Te]|t[Te-1]<<8|t[Te-2]<<16,this.words[Xr]|=ei<>>26-ii&67108863,ii+=24,ii>=26&&(ii-=26,Xr++);else if(Ie==="le")for(Te=0,Xr=0;Te>>26-ii&67108863,ii+=24,ii>=26&&(ii-=26,Xr++);return this.strip()};function si(oi,t){var F=oi.charCodeAt(t);return F>=65&&F<=70?F-55:F>=97&&F<=102?F-87:F-48&15}function fi(oi,t,F){var Ie=si(oi,F);return F-1>=t&&(Ie|=si(oi,F-1)<<4),Ie}W.prototype._parseHex=function(t,F,Ie){this.length=Math.ceil((t.length-F)/6),this.words=new Array(this.length);for(var Te=0;Te=F;Te-=2)ii=fi(t,F,Te)<=18?(Xr-=18,ei+=1,this.words[ei]|=ii>>>26):Xr+=8;else{var Wr=t.length-F;for(Te=Wr%2===0?F+1:F;Te=18?(Xr-=18,ei+=1,this.words[ei]|=ii>>>26):Xr+=8}this.strip()};function ai(oi,t,F,Ie){for(var Te=0,Xr=Math.min(oi.length,F),ei=t;ei=49?Te+=ii-49+10:ii>=17?Te+=ii-17+10:Te+=ii}return Te}W.prototype._parseBase=function(t,F,Ie){this.words=[0],this.length=1;for(var Te=0,Xr=1;Xr<=67108863;Xr*=F)Te++;Te--,Xr=Xr/F|0;for(var ei=t.length-Ie,ii=ei%Te,Wr=Math.min(ei,ei-ii)+Ie,R=0,Le=Ie;Le1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},W.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},W.prototype.inspect=function(){return(this.red?""};var ti=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],hi=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],ci=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];W.prototype.toString=function(t,F){t=t||10,F=F|0||1;var Ie;if(t===16||t==="hex"){Ie="";for(var Te=0,Xr=0,ei=0;ei>>24-Te&16777215,Xr!==0||ei!==this.length-1?Ie=ti[6-Wr.length]+Wr+Ie:Ie=Wr+Ie,Te+=2,Te>=26&&(Te-=26,ei--)}for(Xr!==0&&(Ie=Xr.toString(16)+Ie);Ie.length%F!==0;)Ie="0"+Ie;return this.negative!==0&&(Ie="-"+Ie),Ie}if(t===(t|0)&&t>=2&&t<=36){var R=hi[t],Le=ci[t];Ie="";var nn=this.clone();for(nn.negative=0;!nn.isZero();){var vn=nn.modn(Le).toString(t);nn=nn.idivn(Le),nn.isZero()?Ie=vn+Ie:Ie=ti[R-vn.length]+vn+Ie}for(this.isZero()&&(Ie="0"+Ie);Ie.length%F!==0;)Ie="0"+Ie;return this.negative!==0&&(Ie="-"+Ie),Ie}Y(!1,"Base should be between 2 and 36")},W.prototype.toNumber=function(){var t=this.words[0];return this.length===2?t+=this.words[1]*67108864:this.length===3&&this.words[2]===1?t+=4503599627370496+this.words[1]*67108864:this.length>2&&Y(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-t:t},W.prototype.toJSON=function(){return this.toString(16)},W.prototype.toBuffer=function(t,F){return Y(typeof ri<"u"),this.toArrayLike(ri,t,F)},W.prototype.toArray=function(t,F){return this.toArrayLike(Array,t,F)},W.prototype.toArrayLike=function(t,F,Ie){var Te=this.byteLength(),Xr=Ie||Math.max(1,Te);Y(Te<=Xr,"byte array longer than desired length"),Y(Xr>0,"Requested array length <= 0"),this.strip();var ei=F==="le",ii=new t(Xr),Wr,R,Le=this.clone();if(ei){for(R=0;!Le.isZero();R++)Wr=Le.andln(255),Le.iushrn(8),ii[R]=Wr;for(;R=4096&&(Ie+=13,F>>>=13),F>=64&&(Ie+=7,F>>>=7),F>=8&&(Ie+=4,F>>>=4),F>=2&&(Ie+=2,F>>>=2),Ie+F},W.prototype._zeroBits=function(t){if(t===0)return 26;var F=t,Ie=0;return F&8191||(Ie+=13,F>>>=13),F&127||(Ie+=7,F>>>=7),F&15||(Ie+=4,F>>>=4),F&3||(Ie+=2,F>>>=2),F&1||Ie++,Ie},W.prototype.bitLength=function(){var t=this.words[this.length-1],F=this._countBits(t);return(this.length-1)*26+F};function ui(oi){for(var t=new Array(oi.bitLength()),F=0;F>>Te}return t}W.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,F=0;Ft.length?this.clone().ior(t):t.clone().ior(this)},W.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},W.prototype.iuand=function(t){var F;this.length>t.length?F=t:F=this;for(var Ie=0;Iet.length?this.clone().iand(t):t.clone().iand(this)},W.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},W.prototype.iuxor=function(t){var F,Ie;this.length>t.length?(F=this,Ie=t):(F=t,Ie=this);for(var Te=0;Tet.length?this.clone().ixor(t):t.clone().ixor(this)},W.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},W.prototype.inotn=function(t){Y(typeof t=="number"&&t>=0);var F=Math.ceil(t/26)|0,Ie=t%26;this._expand(F),Ie>0&&F--;for(var Te=0;Te0&&(this.words[Te]=~this.words[Te]&67108863>>26-Ie),this.strip()},W.prototype.notn=function(t){return this.clone().inotn(t)},W.prototype.setn=function(t,F){Y(typeof t=="number"&&t>=0);var Ie=t/26|0,Te=t%26;return this._expand(Ie+1),F?this.words[Ie]=this.words[Ie]|1<t.length?(Ie=this,Te=t):(Ie=t,Te=this);for(var Xr=0,ei=0;ei>>26;for(;Xr!==0&&ei>>26;if(this.length=Ie.length,Xr!==0)this.words[this.length]=Xr,this.length++;else if(Ie!==this)for(;eit.length?this.clone().iadd(t):t.clone().iadd(this)},W.prototype.isub=function(t){if(t.negative!==0){t.negative=0;var F=this.iadd(t);return t.negative=1,F._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var Ie=this.cmp(t);if(Ie===0)return this.negative=0,this.length=1,this.words[0]=0,this;var Te,Xr;Ie>0?(Te=this,Xr=t):(Te=t,Xr=this);for(var ei=0,ii=0;ii>26,this.words[ii]=F&67108863;for(;ei!==0&&ii>26,this.words[ii]=F&67108863;if(ei===0&&ii>>26,nn=Wr&67108863,vn=Math.min(R,t.length-1),Mn=Math.max(0,R-oi.length+1);Mn<=vn;Mn++){var sn=R-Mn|0;Te=oi.words[sn]|0,Xr=t.words[Mn]|0,ei=Te*Xr+nn,Le+=ei/67108864|0,nn=ei&67108863}F.words[R]=nn|0,Wr=Le|0}return Wr!==0?F.words[R]=Wr|0:F.length--,F.strip()}var mi=function(t,F,Ie){var Te=t.words,Xr=F.words,ei=Ie.words,ii=0,Wr,R,Le,nn=Te[0]|0,vn=nn&8191,Mn=nn>>>13,sn=Te[1]|0,Zn=sn&8191,on=sn>>>13,pn=Te[2]|0,mn=pn&8191,$i=pn>>>13,ho=Te[3]|0,Do=ho&8191,To=ho>>>13,Oh=Te[4]|0,Fo=Oh&8191,Vo=Oh>>>13,Hh=Te[5]|0,Ah=Hh&8191,Qf=Hh>>>13,Gh=Te[6]|0,tf=Gh&8191,Ko=Gh>>>13,Kh=Te[7]|0,Lf=Kh&8191,Uo=Kh>>>13,Vh=Te[8]|0,jf=Vh&8191,Zo=Vh>>>13,Wh=Te[9]|0,vh=Wh&8191,Yo=Wh>>>13,Jh=Xr[0]|0,xh=Jh&8191,Vf=Jh>>>13,Zh=Xr[1]|0,Ch=Zh&8191,Eh=Zh>>>13,Lu=Xr[2]|0,Ph=Lu&8191,Sh=Lu>>>13,Uu=Xr[3]|0,Th=Uu&8191,gh=Uu>>>13,Xh=Xr[4]|0,Rh=Xh&8191,bh=Xh>>>13,au=Xr[5]|0,$h=au&8191,wh=au>>>13,qu=Xr[6]|0,Ih=qu&8191,_h=qu>>>13,uu=Xr[7]|0,Dh=uu&8191,yh=uu>>>13,Yh=Xr[8]|0,Bh=Yh&8191,Mh=Yh>>>13,Hu=Xr[9]|0,kh=Hu&8191,qh=Hu>>>13;Ie.negative=t.negative^F.negative,Ie.length=19,Wr=Math.imul(vn,xh),R=Math.imul(vn,Vf),R=R+Math.imul(Mn,xh)|0,Le=Math.imul(Mn,Vf);var Tu=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(Tu>>>26)|0,Tu&=67108863,Wr=Math.imul(Zn,xh),R=Math.imul(Zn,Vf),R=R+Math.imul(on,xh)|0,Le=Math.imul(on,Vf),Wr=Wr+Math.imul(vn,Ch)|0,R=R+Math.imul(vn,Eh)|0,R=R+Math.imul(Mn,Ch)|0,Le=Le+Math.imul(Mn,Eh)|0;var tc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(tc>>>26)|0,tc&=67108863,Wr=Math.imul(mn,xh),R=Math.imul(mn,Vf),R=R+Math.imul($i,xh)|0,Le=Math.imul($i,Vf),Wr=Wr+Math.imul(Zn,Ch)|0,R=R+Math.imul(Zn,Eh)|0,R=R+Math.imul(on,Ch)|0,Le=Le+Math.imul(on,Eh)|0,Wr=Wr+Math.imul(vn,Ph)|0,R=R+Math.imul(vn,Sh)|0,R=R+Math.imul(Mn,Ph)|0,Le=Le+Math.imul(Mn,Sh)|0;var rc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(rc>>>26)|0,rc&=67108863,Wr=Math.imul(Do,xh),R=Math.imul(Do,Vf),R=R+Math.imul(To,xh)|0,Le=Math.imul(To,Vf),Wr=Wr+Math.imul(mn,Ch)|0,R=R+Math.imul(mn,Eh)|0,R=R+Math.imul($i,Ch)|0,Le=Le+Math.imul($i,Eh)|0,Wr=Wr+Math.imul(Zn,Ph)|0,R=R+Math.imul(Zn,Sh)|0,R=R+Math.imul(on,Ph)|0,Le=Le+Math.imul(on,Sh)|0,Wr=Wr+Math.imul(vn,Th)|0,R=R+Math.imul(vn,gh)|0,R=R+Math.imul(Mn,Th)|0,Le=Le+Math.imul(Mn,gh)|0;var ic=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(ic>>>26)|0,ic&=67108863,Wr=Math.imul(Fo,xh),R=Math.imul(Fo,Vf),R=R+Math.imul(Vo,xh)|0,Le=Math.imul(Vo,Vf),Wr=Wr+Math.imul(Do,Ch)|0,R=R+Math.imul(Do,Eh)|0,R=R+Math.imul(To,Ch)|0,Le=Le+Math.imul(To,Eh)|0,Wr=Wr+Math.imul(mn,Ph)|0,R=R+Math.imul(mn,Sh)|0,R=R+Math.imul($i,Ph)|0,Le=Le+Math.imul($i,Sh)|0,Wr=Wr+Math.imul(Zn,Th)|0,R=R+Math.imul(Zn,gh)|0,R=R+Math.imul(on,Th)|0,Le=Le+Math.imul(on,gh)|0,Wr=Wr+Math.imul(vn,Rh)|0,R=R+Math.imul(vn,bh)|0,R=R+Math.imul(Mn,Rh)|0,Le=Le+Math.imul(Mn,bh)|0;var nc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(nc>>>26)|0,nc&=67108863,Wr=Math.imul(Ah,xh),R=Math.imul(Ah,Vf),R=R+Math.imul(Qf,xh)|0,Le=Math.imul(Qf,Vf),Wr=Wr+Math.imul(Fo,Ch)|0,R=R+Math.imul(Fo,Eh)|0,R=R+Math.imul(Vo,Ch)|0,Le=Le+Math.imul(Vo,Eh)|0,Wr=Wr+Math.imul(Do,Ph)|0,R=R+Math.imul(Do,Sh)|0,R=R+Math.imul(To,Ph)|0,Le=Le+Math.imul(To,Sh)|0,Wr=Wr+Math.imul(mn,Th)|0,R=R+Math.imul(mn,gh)|0,R=R+Math.imul($i,Th)|0,Le=Le+Math.imul($i,gh)|0,Wr=Wr+Math.imul(Zn,Rh)|0,R=R+Math.imul(Zn,bh)|0,R=R+Math.imul(on,Rh)|0,Le=Le+Math.imul(on,bh)|0,Wr=Wr+Math.imul(vn,$h)|0,R=R+Math.imul(vn,wh)|0,R=R+Math.imul(Mn,$h)|0,Le=Le+Math.imul(Mn,wh)|0;var sc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(sc>>>26)|0,sc&=67108863,Wr=Math.imul(tf,xh),R=Math.imul(tf,Vf),R=R+Math.imul(Ko,xh)|0,Le=Math.imul(Ko,Vf),Wr=Wr+Math.imul(Ah,Ch)|0,R=R+Math.imul(Ah,Eh)|0,R=R+Math.imul(Qf,Ch)|0,Le=Le+Math.imul(Qf,Eh)|0,Wr=Wr+Math.imul(Fo,Ph)|0,R=R+Math.imul(Fo,Sh)|0,R=R+Math.imul(Vo,Ph)|0,Le=Le+Math.imul(Vo,Sh)|0,Wr=Wr+Math.imul(Do,Th)|0,R=R+Math.imul(Do,gh)|0,R=R+Math.imul(To,Th)|0,Le=Le+Math.imul(To,gh)|0,Wr=Wr+Math.imul(mn,Rh)|0,R=R+Math.imul(mn,bh)|0,R=R+Math.imul($i,Rh)|0,Le=Le+Math.imul($i,bh)|0,Wr=Wr+Math.imul(Zn,$h)|0,R=R+Math.imul(Zn,wh)|0,R=R+Math.imul(on,$h)|0,Le=Le+Math.imul(on,wh)|0,Wr=Wr+Math.imul(vn,Ih)|0,R=R+Math.imul(vn,_h)|0,R=R+Math.imul(Mn,Ih)|0,Le=Le+Math.imul(Mn,_h)|0;var s0=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(s0>>>26)|0,s0&=67108863,Wr=Math.imul(Lf,xh),R=Math.imul(Lf,Vf),R=R+Math.imul(Uo,xh)|0,Le=Math.imul(Uo,Vf),Wr=Wr+Math.imul(tf,Ch)|0,R=R+Math.imul(tf,Eh)|0,R=R+Math.imul(Ko,Ch)|0,Le=Le+Math.imul(Ko,Eh)|0,Wr=Wr+Math.imul(Ah,Ph)|0,R=R+Math.imul(Ah,Sh)|0,R=R+Math.imul(Qf,Ph)|0,Le=Le+Math.imul(Qf,Sh)|0,Wr=Wr+Math.imul(Fo,Th)|0,R=R+Math.imul(Fo,gh)|0,R=R+Math.imul(Vo,Th)|0,Le=Le+Math.imul(Vo,gh)|0,Wr=Wr+Math.imul(Do,Rh)|0,R=R+Math.imul(Do,bh)|0,R=R+Math.imul(To,Rh)|0,Le=Le+Math.imul(To,bh)|0,Wr=Wr+Math.imul(mn,$h)|0,R=R+Math.imul(mn,wh)|0,R=R+Math.imul($i,$h)|0,Le=Le+Math.imul($i,wh)|0,Wr=Wr+Math.imul(Zn,Ih)|0,R=R+Math.imul(Zn,_h)|0,R=R+Math.imul(on,Ih)|0,Le=Le+Math.imul(on,_h)|0,Wr=Wr+Math.imul(vn,Dh)|0,R=R+Math.imul(vn,yh)|0,R=R+Math.imul(Mn,Dh)|0,Le=Le+Math.imul(Mn,yh)|0;var hc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(hc>>>26)|0,hc&=67108863,Wr=Math.imul(jf,xh),R=Math.imul(jf,Vf),R=R+Math.imul(Zo,xh)|0,Le=Math.imul(Zo,Vf),Wr=Wr+Math.imul(Lf,Ch)|0,R=R+Math.imul(Lf,Eh)|0,R=R+Math.imul(Uo,Ch)|0,Le=Le+Math.imul(Uo,Eh)|0,Wr=Wr+Math.imul(tf,Ph)|0,R=R+Math.imul(tf,Sh)|0,R=R+Math.imul(Ko,Ph)|0,Le=Le+Math.imul(Ko,Sh)|0,Wr=Wr+Math.imul(Ah,Th)|0,R=R+Math.imul(Ah,gh)|0,R=R+Math.imul(Qf,Th)|0,Le=Le+Math.imul(Qf,gh)|0,Wr=Wr+Math.imul(Fo,Rh)|0,R=R+Math.imul(Fo,bh)|0,R=R+Math.imul(Vo,Rh)|0,Le=Le+Math.imul(Vo,bh)|0,Wr=Wr+Math.imul(Do,$h)|0,R=R+Math.imul(Do,wh)|0,R=R+Math.imul(To,$h)|0,Le=Le+Math.imul(To,wh)|0,Wr=Wr+Math.imul(mn,Ih)|0,R=R+Math.imul(mn,_h)|0,R=R+Math.imul($i,Ih)|0,Le=Le+Math.imul($i,_h)|0,Wr=Wr+Math.imul(Zn,Dh)|0,R=R+Math.imul(Zn,yh)|0,R=R+Math.imul(on,Dh)|0,Le=Le+Math.imul(on,yh)|0,Wr=Wr+Math.imul(vn,Bh)|0,R=R+Math.imul(vn,Mh)|0,R=R+Math.imul(Mn,Bh)|0,Le=Le+Math.imul(Mn,Mh)|0;var pc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(pc>>>26)|0,pc&=67108863,Wr=Math.imul(vh,xh),R=Math.imul(vh,Vf),R=R+Math.imul(Yo,xh)|0,Le=Math.imul(Yo,Vf),Wr=Wr+Math.imul(jf,Ch)|0,R=R+Math.imul(jf,Eh)|0,R=R+Math.imul(Zo,Ch)|0,Le=Le+Math.imul(Zo,Eh)|0,Wr=Wr+Math.imul(Lf,Ph)|0,R=R+Math.imul(Lf,Sh)|0,R=R+Math.imul(Uo,Ph)|0,Le=Le+Math.imul(Uo,Sh)|0,Wr=Wr+Math.imul(tf,Th)|0,R=R+Math.imul(tf,gh)|0,R=R+Math.imul(Ko,Th)|0,Le=Le+Math.imul(Ko,gh)|0,Wr=Wr+Math.imul(Ah,Rh)|0,R=R+Math.imul(Ah,bh)|0,R=R+Math.imul(Qf,Rh)|0,Le=Le+Math.imul(Qf,bh)|0,Wr=Wr+Math.imul(Fo,$h)|0,R=R+Math.imul(Fo,wh)|0,R=R+Math.imul(Vo,$h)|0,Le=Le+Math.imul(Vo,wh)|0,Wr=Wr+Math.imul(Do,Ih)|0,R=R+Math.imul(Do,_h)|0,R=R+Math.imul(To,Ih)|0,Le=Le+Math.imul(To,_h)|0,Wr=Wr+Math.imul(mn,Dh)|0,R=R+Math.imul(mn,yh)|0,R=R+Math.imul($i,Dh)|0,Le=Le+Math.imul($i,yh)|0,Wr=Wr+Math.imul(Zn,Bh)|0,R=R+Math.imul(Zn,Mh)|0,R=R+Math.imul(on,Bh)|0,Le=Le+Math.imul(on,Mh)|0,Wr=Wr+Math.imul(vn,kh)|0,R=R+Math.imul(vn,qh)|0,R=R+Math.imul(Mn,kh)|0,Le=Le+Math.imul(Mn,qh)|0;var uc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(uc>>>26)|0,uc&=67108863,Wr=Math.imul(vh,Ch),R=Math.imul(vh,Eh),R=R+Math.imul(Yo,Ch)|0,Le=Math.imul(Yo,Eh),Wr=Wr+Math.imul(jf,Ph)|0,R=R+Math.imul(jf,Sh)|0,R=R+Math.imul(Zo,Ph)|0,Le=Le+Math.imul(Zo,Sh)|0,Wr=Wr+Math.imul(Lf,Th)|0,R=R+Math.imul(Lf,gh)|0,R=R+Math.imul(Uo,Th)|0,Le=Le+Math.imul(Uo,gh)|0,Wr=Wr+Math.imul(tf,Rh)|0,R=R+Math.imul(tf,bh)|0,R=R+Math.imul(Ko,Rh)|0,Le=Le+Math.imul(Ko,bh)|0,Wr=Wr+Math.imul(Ah,$h)|0,R=R+Math.imul(Ah,wh)|0,R=R+Math.imul(Qf,$h)|0,Le=Le+Math.imul(Qf,wh)|0,Wr=Wr+Math.imul(Fo,Ih)|0,R=R+Math.imul(Fo,_h)|0,R=R+Math.imul(Vo,Ih)|0,Le=Le+Math.imul(Vo,_h)|0,Wr=Wr+Math.imul(Do,Dh)|0,R=R+Math.imul(Do,yh)|0,R=R+Math.imul(To,Dh)|0,Le=Le+Math.imul(To,yh)|0,Wr=Wr+Math.imul(mn,Bh)|0,R=R+Math.imul(mn,Mh)|0,R=R+Math.imul($i,Bh)|0,Le=Le+Math.imul($i,Mh)|0,Wr=Wr+Math.imul(Zn,kh)|0,R=R+Math.imul(Zn,qh)|0,R=R+Math.imul(on,kh)|0,Le=Le+Math.imul(on,qh)|0;var vc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(vc>>>26)|0,vc&=67108863,Wr=Math.imul(vh,Ph),R=Math.imul(vh,Sh),R=R+Math.imul(Yo,Ph)|0,Le=Math.imul(Yo,Sh),Wr=Wr+Math.imul(jf,Th)|0,R=R+Math.imul(jf,gh)|0,R=R+Math.imul(Zo,Th)|0,Le=Le+Math.imul(Zo,gh)|0,Wr=Wr+Math.imul(Lf,Rh)|0,R=R+Math.imul(Lf,bh)|0,R=R+Math.imul(Uo,Rh)|0,Le=Le+Math.imul(Uo,bh)|0,Wr=Wr+Math.imul(tf,$h)|0,R=R+Math.imul(tf,wh)|0,R=R+Math.imul(Ko,$h)|0,Le=Le+Math.imul(Ko,wh)|0,Wr=Wr+Math.imul(Ah,Ih)|0,R=R+Math.imul(Ah,_h)|0,R=R+Math.imul(Qf,Ih)|0,Le=Le+Math.imul(Qf,_h)|0,Wr=Wr+Math.imul(Fo,Dh)|0,R=R+Math.imul(Fo,yh)|0,R=R+Math.imul(Vo,Dh)|0,Le=Le+Math.imul(Vo,yh)|0,Wr=Wr+Math.imul(Do,Bh)|0,R=R+Math.imul(Do,Mh)|0,R=R+Math.imul(To,Bh)|0,Le=Le+Math.imul(To,Mh)|0,Wr=Wr+Math.imul(mn,kh)|0,R=R+Math.imul(mn,qh)|0,R=R+Math.imul($i,kh)|0,Le=Le+Math.imul($i,qh)|0;var mc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(mc>>>26)|0,mc&=67108863,Wr=Math.imul(vh,Th),R=Math.imul(vh,gh),R=R+Math.imul(Yo,Th)|0,Le=Math.imul(Yo,gh),Wr=Wr+Math.imul(jf,Rh)|0,R=R+Math.imul(jf,bh)|0,R=R+Math.imul(Zo,Rh)|0,Le=Le+Math.imul(Zo,bh)|0,Wr=Wr+Math.imul(Lf,$h)|0,R=R+Math.imul(Lf,wh)|0,R=R+Math.imul(Uo,$h)|0,Le=Le+Math.imul(Uo,wh)|0,Wr=Wr+Math.imul(tf,Ih)|0,R=R+Math.imul(tf,_h)|0,R=R+Math.imul(Ko,Ih)|0,Le=Le+Math.imul(Ko,_h)|0,Wr=Wr+Math.imul(Ah,Dh)|0,R=R+Math.imul(Ah,yh)|0,R=R+Math.imul(Qf,Dh)|0,Le=Le+Math.imul(Qf,yh)|0,Wr=Wr+Math.imul(Fo,Bh)|0,R=R+Math.imul(Fo,Mh)|0,R=R+Math.imul(Vo,Bh)|0,Le=Le+Math.imul(Vo,Mh)|0,Wr=Wr+Math.imul(Do,kh)|0,R=R+Math.imul(Do,qh)|0,R=R+Math.imul(To,kh)|0,Le=Le+Math.imul(To,qh)|0;var cc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(cc>>>26)|0,cc&=67108863,Wr=Math.imul(vh,Rh),R=Math.imul(vh,bh),R=R+Math.imul(Yo,Rh)|0,Le=Math.imul(Yo,bh),Wr=Wr+Math.imul(jf,$h)|0,R=R+Math.imul(jf,wh)|0,R=R+Math.imul(Zo,$h)|0,Le=Le+Math.imul(Zo,wh)|0,Wr=Wr+Math.imul(Lf,Ih)|0,R=R+Math.imul(Lf,_h)|0,R=R+Math.imul(Uo,Ih)|0,Le=Le+Math.imul(Uo,_h)|0,Wr=Wr+Math.imul(tf,Dh)|0,R=R+Math.imul(tf,yh)|0,R=R+Math.imul(Ko,Dh)|0,Le=Le+Math.imul(Ko,yh)|0,Wr=Wr+Math.imul(Ah,Bh)|0,R=R+Math.imul(Ah,Mh)|0,R=R+Math.imul(Qf,Bh)|0,Le=Le+Math.imul(Qf,Mh)|0,Wr=Wr+Math.imul(Fo,kh)|0,R=R+Math.imul(Fo,qh)|0,R=R+Math.imul(Vo,kh)|0,Le=Le+Math.imul(Vo,qh)|0;var lc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(lc>>>26)|0,lc&=67108863,Wr=Math.imul(vh,$h),R=Math.imul(vh,wh),R=R+Math.imul(Yo,$h)|0,Le=Math.imul(Yo,wh),Wr=Wr+Math.imul(jf,Ih)|0,R=R+Math.imul(jf,_h)|0,R=R+Math.imul(Zo,Ih)|0,Le=Le+Math.imul(Zo,_h)|0,Wr=Wr+Math.imul(Lf,Dh)|0,R=R+Math.imul(Lf,yh)|0,R=R+Math.imul(Uo,Dh)|0,Le=Le+Math.imul(Uo,yh)|0,Wr=Wr+Math.imul(tf,Bh)|0,R=R+Math.imul(tf,Mh)|0,R=R+Math.imul(Ko,Bh)|0,Le=Le+Math.imul(Ko,Mh)|0,Wr=Wr+Math.imul(Ah,kh)|0,R=R+Math.imul(Ah,qh)|0,R=R+Math.imul(Qf,kh)|0,Le=Le+Math.imul(Qf,qh)|0;var dc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(dc>>>26)|0,dc&=67108863,Wr=Math.imul(vh,Ih),R=Math.imul(vh,_h),R=R+Math.imul(Yo,Ih)|0,Le=Math.imul(Yo,_h),Wr=Wr+Math.imul(jf,Dh)|0,R=R+Math.imul(jf,yh)|0,R=R+Math.imul(Zo,Dh)|0,Le=Le+Math.imul(Zo,yh)|0,Wr=Wr+Math.imul(Lf,Bh)|0,R=R+Math.imul(Lf,Mh)|0,R=R+Math.imul(Uo,Bh)|0,Le=Le+Math.imul(Uo,Mh)|0,Wr=Wr+Math.imul(tf,kh)|0,R=R+Math.imul(tf,qh)|0,R=R+Math.imul(Ko,kh)|0,Le=Le+Math.imul(Ko,qh)|0;var $0=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+($0>>>26)|0,$0&=67108863,Wr=Math.imul(vh,Dh),R=Math.imul(vh,yh),R=R+Math.imul(Yo,Dh)|0,Le=Math.imul(Yo,yh),Wr=Wr+Math.imul(jf,Bh)|0,R=R+Math.imul(jf,Mh)|0,R=R+Math.imul(Zo,Bh)|0,Le=Le+Math.imul(Zo,Mh)|0,Wr=Wr+Math.imul(Lf,kh)|0,R=R+Math.imul(Lf,qh)|0,R=R+Math.imul(Uo,kh)|0,Le=Le+Math.imul(Uo,qh)|0;var gc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(gc>>>26)|0,gc&=67108863,Wr=Math.imul(vh,Bh),R=Math.imul(vh,Mh),R=R+Math.imul(Yo,Bh)|0,Le=Math.imul(Yo,Mh),Wr=Wr+Math.imul(jf,kh)|0,R=R+Math.imul(jf,qh)|0,R=R+Math.imul(Zo,kh)|0,Le=Le+Math.imul(Zo,qh)|0;var bc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(bc>>>26)|0,bc&=67108863,Wr=Math.imul(vh,kh),R=Math.imul(vh,qh),R=R+Math.imul(Yo,kh)|0,Le=Math.imul(Yo,qh);var yc=(ii+Wr|0)+((R&8191)<<13)|0;return ii=(Le+(R>>>13)|0)+(yc>>>26)|0,yc&=67108863,ei[0]=Tu,ei[1]=tc,ei[2]=rc,ei[3]=ic,ei[4]=nc,ei[5]=sc,ei[6]=s0,ei[7]=hc,ei[8]=pc,ei[9]=uc,ei[10]=vc,ei[11]=mc,ei[12]=cc,ei[13]=lc,ei[14]=dc,ei[15]=$0,ei[16]=gc,ei[17]=bc,ei[18]=yc,ii!==0&&(ei[19]=ii,Ie.length++),Ie};Math.imul||(mi=li);function hn(oi,t,F){F.negative=t.negative^oi.negative,F.length=oi.length+t.length;for(var Ie=0,Te=0,Xr=0;Xr>>26)|0,Te+=ei>>>26,ei&=67108863}F.words[Xr]=ii,Ie=ei,ei=Te}return Ie!==0?F.words[Xr]=Ie:F.length--,F.strip()}function ln(oi,t,F){var Ie=new fn;return Ie.mulp(oi,t,F)}W.prototype.mulTo=function(t,F){var Ie,Te=this.length+t.length;return this.length===10&&t.length===10?Ie=mi(this,t,F):Te<63?Ie=li(this,t,F):Te<1024?Ie=hn(this,t,F):Ie=ln(this,t,F),Ie};function fn(oi,t){this.x=oi,this.y=t}fn.prototype.makeRBT=function(t){for(var F=new Array(t),Ie=W.prototype._countBits(t)-1,Te=0;Te>=1;return Te},fn.prototype.permute=function(t,F,Ie,Te,Xr,ei){for(var ii=0;ii>>1)Xr++;return 1<>>13,Ie[2*ei+1]=Xr&8191,Xr=Xr>>>13;for(ei=2*F;ei>=26,F+=Te/67108864|0,F+=Xr>>>26,this.words[Ie]=Xr&67108863}return F!==0&&(this.words[Ie]=F,this.length++),this},W.prototype.muln=function(t){return this.clone().imuln(t)},W.prototype.sqr=function(){return this.mul(this)},W.prototype.isqr=function(){return this.imul(this.clone())},W.prototype.pow=function(t){var F=ui(t);if(F.length===0)return new W(1);for(var Ie=this,Te=0;Te=0);var F=t%26,Ie=(t-F)/26,Te=67108863>>>26-F<<26-F,Xr;if(F!==0){var ei=0;for(Xr=0;Xr>>26-F}ei&&(this.words[Xr]=ei,this.length++)}if(Ie!==0){for(Xr=this.length-1;Xr>=0;Xr--)this.words[Xr+Ie]=this.words[Xr];for(Xr=0;Xr=0);var Te;F?Te=(F-F%26)/26:Te=0;var Xr=t%26,ei=Math.min((t-Xr)/26,this.length),ii=67108863^67108863>>>Xr<ei)for(this.length-=ei,R=0;R=0&&(Le!==0||R>=Te);R--){var nn=this.words[R]|0;this.words[R]=Le<<26-Xr|nn>>>Xr,Le=nn&ii}return Wr&&Le!==0&&(Wr.words[Wr.length++]=Le),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},W.prototype.ishrn=function(t,F,Ie){return Y(this.negative===0),this.iushrn(t,F,Ie)},W.prototype.shln=function(t){return this.clone().ishln(t)},W.prototype.ushln=function(t){return this.clone().iushln(t)},W.prototype.shrn=function(t){return this.clone().ishrn(t)},W.prototype.ushrn=function(t){return this.clone().iushrn(t)},W.prototype.testn=function(t){Y(typeof t=="number"&&t>=0);var F=t%26,Ie=(t-F)/26,Te=1<=0);var F=t%26,Ie=(t-F)/26;if(Y(this.negative===0,"imaskn works only with positive numbers"),this.length<=Ie)return this;if(F!==0&&Ie++,this.length=Math.min(Ie,this.length),F!==0){var Te=67108863^67108863>>>F<=67108864;F++)this.words[F]-=67108864,F===this.length-1?this.words[F+1]=1:this.words[F+1]++;return this.length=Math.max(this.length,F+1),this},W.prototype.isubn=function(t){if(Y(typeof t=="number"),Y(t<67108864),t<0)return this.iaddn(-t);if(this.negative!==0)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var F=0;F>26)-(Wr/67108864|0),this.words[Xr+Ie]=ei&67108863}for(;Xr>26,this.words[Xr+Ie]=ei&67108863;if(ii===0)return this.strip();for(Y(ii===-1),ii=0,Xr=0;Xr>26,this.words[Xr]=ei&67108863;return this.negative=1,this.strip()},W.prototype._wordDiv=function(t,F){var Ie=this.length-t.length,Te=this.clone(),Xr=t,ei=Xr.words[Xr.length-1]|0,ii=this._countBits(ei);Ie=26-ii,Ie!==0&&(Xr=Xr.ushln(Ie),Te.iushln(Ie),ei=Xr.words[Xr.length-1]|0);var Wr=Te.length-Xr.length,R;if(F!=="mod"){R=new W(null),R.length=Wr+1,R.words=new Array(R.length);for(var Le=0;Le=0;vn--){var Mn=(Te.words[Xr.length+vn]|0)*67108864+(Te.words[Xr.length+vn-1]|0);for(Mn=Math.min(Mn/ei|0,67108863),Te._ishlnsubmul(Xr,Mn,vn);Te.negative!==0;)Mn--,Te.negative=0,Te._ishlnsubmul(Xr,1,vn),Te.isZero()||(Te.negative^=1);R&&(R.words[vn]=Mn)}return R&&R.strip(),Te.strip(),F!=="div"&&Ie!==0&&Te.iushrn(Ie),{div:R||null,mod:Te}},W.prototype.divmod=function(t,F,Ie){if(Y(!t.isZero()),this.isZero())return{div:new W(0),mod:new W(0)};var Te,Xr,ei;return this.negative!==0&&t.negative===0?(ei=this.neg().divmod(t,F),F!=="mod"&&(Te=ei.div.neg()),F!=="div"&&(Xr=ei.mod.neg(),Ie&&Xr.negative!==0&&Xr.iadd(t)),{div:Te,mod:Xr}):this.negative===0&&t.negative!==0?(ei=this.divmod(t.neg(),F),F!=="mod"&&(Te=ei.div.neg()),{div:Te,mod:ei.mod}):this.negative&t.negative?(ei=this.neg().divmod(t.neg(),F),F!=="div"&&(Xr=ei.mod.neg(),Ie&&Xr.negative!==0&&Xr.isub(t)),{div:ei.div,mod:Xr}):t.length>this.length||this.cmp(t)<0?{div:new W(0),mod:this}:t.length===1?F==="div"?{div:this.divn(t.words[0]),mod:null}:F==="mod"?{div:null,mod:new W(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new W(this.modn(t.words[0]))}:this._wordDiv(t,F)},W.prototype.div=function(t){return this.divmod(t,"div",!1).div},W.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},W.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},W.prototype.divRound=function(t){var F=this.divmod(t);if(F.mod.isZero())return F.div;var Ie=F.div.negative!==0?F.mod.isub(t):F.mod,Te=t.ushrn(1),Xr=t.andln(1),ei=Ie.cmp(Te);return ei<0||Xr===1&&ei===0?F.div:F.div.negative!==0?F.div.isubn(1):F.div.iaddn(1)},W.prototype.modn=function(t){Y(t<=67108863);for(var F=(1<<26)%t,Ie=0,Te=this.length-1;Te>=0;Te--)Ie=(F*Ie+(this.words[Te]|0))%t;return Ie},W.prototype.idivn=function(t){Y(t<=67108863);for(var F=0,Ie=this.length-1;Ie>=0;Ie--){var Te=(this.words[Ie]|0)+F*67108864;this.words[Ie]=Te/t|0,F=Te%t}return this.strip()},W.prototype.divn=function(t){return this.clone().idivn(t)},W.prototype.egcd=function(t){Y(t.negative===0),Y(!t.isZero());var F=this,Ie=t.clone();F.negative!==0?F=F.umod(t):F=F.clone();for(var Te=new W(1),Xr=new W(0),ei=new W(0),ii=new W(1),Wr=0;F.isEven()&&Ie.isEven();)F.iushrn(1),Ie.iushrn(1),++Wr;for(var R=Ie.clone(),Le=F.clone();!F.isZero();){for(var nn=0,vn=1;!(F.words[0]&vn)&&nn<26;++nn,vn<<=1);if(nn>0)for(F.iushrn(nn);nn-- >0;)(Te.isOdd()||Xr.isOdd())&&(Te.iadd(R),Xr.isub(Le)),Te.iushrn(1),Xr.iushrn(1);for(var Mn=0,sn=1;!(Ie.words[0]&sn)&&Mn<26;++Mn,sn<<=1);if(Mn>0)for(Ie.iushrn(Mn);Mn-- >0;)(ei.isOdd()||ii.isOdd())&&(ei.iadd(R),ii.isub(Le)),ei.iushrn(1),ii.iushrn(1);F.cmp(Ie)>=0?(F.isub(Ie),Te.isub(ei),Xr.isub(ii)):(Ie.isub(F),ei.isub(Te),ii.isub(Xr))}return{a:ei,b:ii,gcd:Ie.iushln(Wr)}},W.prototype._invmp=function(t){Y(t.negative===0),Y(!t.isZero());var F=this,Ie=t.clone();F.negative!==0?F=F.umod(t):F=F.clone();for(var Te=new W(1),Xr=new W(0),ei=Ie.clone();F.cmpn(1)>0&&Ie.cmpn(1)>0;){for(var ii=0,Wr=1;!(F.words[0]&Wr)&&ii<26;++ii,Wr<<=1);if(ii>0)for(F.iushrn(ii);ii-- >0;)Te.isOdd()&&Te.iadd(ei),Te.iushrn(1);for(var R=0,Le=1;!(Ie.words[0]&Le)&&R<26;++R,Le<<=1);if(R>0)for(Ie.iushrn(R);R-- >0;)Xr.isOdd()&&Xr.iadd(ei),Xr.iushrn(1);F.cmp(Ie)>=0?(F.isub(Ie),Te.isub(Xr)):(Ie.isub(F),Xr.isub(Te))}var nn;return F.cmpn(1)===0?nn=Te:nn=Xr,nn.cmpn(0)<0&&nn.iadd(t),nn},W.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var F=this.clone(),Ie=t.clone();F.negative=0,Ie.negative=0;for(var Te=0;F.isEven()&&Ie.isEven();Te++)F.iushrn(1),Ie.iushrn(1);do{for(;F.isEven();)F.iushrn(1);for(;Ie.isEven();)Ie.iushrn(1);var Xr=F.cmp(Ie);if(Xr<0){var ei=F;F=Ie,Ie=ei}else if(Xr===0||Ie.cmpn(1)===0)break;F.isub(Ie)}while(!0);return Ie.iushln(Te)},W.prototype.invm=function(t){return this.egcd(t).a.umod(t)},W.prototype.isEven=function(){return(this.words[0]&1)===0},W.prototype.isOdd=function(){return(this.words[0]&1)===1},W.prototype.andln=function(t){return this.words[0]&t},W.prototype.bincn=function(t){Y(typeof t=="number");var F=t%26,Ie=(t-F)/26,Te=1<>>26,ii&=67108863,this.words[ei]=ii}return Xr!==0&&(this.words[ei]=Xr,this.length++),this},W.prototype.isZero=function(){return this.length===1&&this.words[0]===0},W.prototype.cmpn=function(t){var F=t<0;if(this.negative!==0&&!F)return-1;if(this.negative===0&&F)return 1;this.strip();var Ie;if(this.length>1)Ie=1;else{F&&(t=-t),Y(t<=67108863,"Number is too big");var Te=this.words[0]|0;Ie=Te===t?0:Tet.length)return 1;if(this.length=0;Ie--){var Te=this.words[Ie]|0,Xr=t.words[Ie]|0;if(Te!==Xr){TeXr&&(F=1);break}}return F},W.prototype.gtn=function(t){return this.cmpn(t)===1},W.prototype.gt=function(t){return this.cmp(t)===1},W.prototype.gten=function(t){return this.cmpn(t)>=0},W.prototype.gte=function(t){return this.cmp(t)>=0},W.prototype.ltn=function(t){return this.cmpn(t)===-1},W.prototype.lt=function(t){return this.cmp(t)===-1},W.prototype.lten=function(t){return this.cmpn(t)<=0},W.prototype.lte=function(t){return this.cmp(t)<=0},W.prototype.eqn=function(t){return this.cmpn(t)===0},W.prototype.eq=function(t){return this.cmp(t)===0},W.red=function(t){return new Ya(t)},W.prototype.toRed=function(t){return Y(!this.red,"Already a number in reduction context"),Y(this.negative===0,"red works only with positives"),t.convertTo(this)._forceRed(t)},W.prototype.fromRed=function(){return Y(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},W.prototype._forceRed=function(t){return this.red=t,this},W.prototype.forceRed=function(t){return Y(!this.red,"Already a number in reduction context"),this._forceRed(t)},W.prototype.redAdd=function(t){return Y(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},W.prototype.redIAdd=function(t){return Y(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},W.prototype.redSub=function(t){return Y(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},W.prototype.redISub=function(t){return Y(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},W.prototype.redShl=function(t){return Y(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},W.prototype.redMul=function(t){return Y(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},W.prototype.redIMul=function(t){return Y(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},W.prototype.redSqr=function(){return Y(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},W.prototype.redISqr=function(){return Y(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},W.prototype.redSqrt=function(){return Y(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},W.prototype.redInvm=function(){return Y(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},W.prototype.redNeg=function(){return Y(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},W.prototype.redPow=function(t){return Y(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var gn={k256:null,p224:null,p192:null,p25519:null};function cn(oi,t){this.name=oi,this.p=new W(t,16),this.n=this.p.bitLength(),this.k=new W(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}cn.prototype._tmp=function(){var t=new W(null);return t.words=new Array(Math.ceil(this.n/13)),t},cn.prototype.ireduce=function(t){var F=t,Ie;do this.split(F,this.tmp),F=this.imulK(F),F=F.iadd(this.tmp),Ie=F.bitLength();while(Ie>this.n);var Te=Ie0?F.isub(this.p):F.strip!==void 0?F.strip():F._strip(),F},cn.prototype.split=function(t,F){t.iushrn(this.n,0,F)},cn.prototype.imulK=function(t){return t.imul(this.k)};function An(){cn.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}Ne(An,cn),An.prototype.split=function(t,F){for(var Ie=4194303,Te=Math.min(t.length,9),Xr=0;Xr>>22,ei=ii}ei>>>=22,t.words[Xr-10]=ei,ei===0&&t.length>10?t.length-=10:t.length-=9},An.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var F=0,Ie=0;Ie>>=26,t.words[Ie]=Xr,F=Te}return F!==0&&(t.words[t.length++]=F),t},W._prime=function(t){if(gn[t])return gn[t];var F;if(t==="k256")F=new An;else if(t==="p224")F=new Cn;else if(t==="p192")F=new an;else if(t==="p25519")F=new Rn;else throw new Error("Unknown prime "+t);return gn[t]=F,F};function Ya(oi){if(typeof oi=="string"){var t=W._prime(oi);this.m=t.p,this.prime=t}else Y(oi.gtn(1),"modulus must be greater than 1"),this.m=oi,this.prime=null}Ya.prototype._verify1=function(t){Y(t.negative===0,"red works only with positives"),Y(t.red,"red works only with red numbers")},Ya.prototype._verify2=function(t,F){Y((t.negative|F.negative)===0,"red works only with positives"),Y(t.red&&t.red===F.red,"red works only with red numbers")},Ya.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},Ya.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},Ya.prototype.add=function(t,F){this._verify2(t,F);var Ie=t.add(F);return Ie.cmp(this.m)>=0&&Ie.isub(this.m),Ie._forceRed(this)},Ya.prototype.iadd=function(t,F){this._verify2(t,F);var Ie=t.iadd(F);return Ie.cmp(this.m)>=0&&Ie.isub(this.m),Ie},Ya.prototype.sub=function(t,F){this._verify2(t,F);var Ie=t.sub(F);return Ie.cmpn(0)<0&&Ie.iadd(this.m),Ie._forceRed(this)},Ya.prototype.isub=function(t,F){this._verify2(t,F);var Ie=t.isub(F);return Ie.cmpn(0)<0&&Ie.iadd(this.m),Ie},Ya.prototype.shl=function(t,F){return this._verify1(t),this.imod(t.ushln(F))},Ya.prototype.imul=function(t,F){return this._verify2(t,F),this.imod(t.imul(F))},Ya.prototype.mul=function(t,F){return this._verify2(t,F),this.imod(t.mul(F))},Ya.prototype.isqr=function(t){return this.imul(t,t.clone())},Ya.prototype.sqr=function(t){return this.mul(t,t)},Ya.prototype.sqrt=function(t){if(t.isZero())return t.clone();var F=this.m.andln(3);if(Y(F%2===1),F===3){var Ie=this.m.add(new W(1)).iushrn(2);return this.pow(t,Ie)}for(var Te=this.m.subn(1),Xr=0;!Te.isZero()&&Te.andln(1)===0;)Xr++,Te.iushrn(1);Y(!Te.isZero());var ei=new W(1).toRed(this),ii=ei.redNeg(),Wr=this.m.subn(1).iushrn(1),R=this.m.bitLength();for(R=new W(2*R*R).toRed(this);this.pow(R,Wr).cmp(ii)!==0;)R.redIAdd(ii);for(var Le=this.pow(R,Te),nn=this.pow(t,Te.addn(1).iushrn(1)),vn=this.pow(t,Te),Mn=Xr;vn.cmp(ei)!==0;){for(var sn=vn,Zn=0;sn.cmp(ei)!==0;Zn++)sn=sn.redSqr();Y(Zn=0;Xr--){for(var Le=F.words[Xr],nn=R-1;nn>=0;nn--){var vn=Le>>nn&1;if(ei!==Te[0]&&(ei=this.sqr(ei)),vn===0&&ii===0){Wr=0;continue}ii<<=1,ii|=vn,Wr++,!(Wr!==Ie&&(Xr!==0||nn!==0))&&(ei=this.mul(ei,Te[ii]),Wr=0,ii=0)}R=26}return ei},Ya.prototype.convertTo=function(t){var F=t.umod(this.m);return F===t?F.clone():F},Ya.prototype.convertFrom=function(t){var F=t.clone();return F.red=null,F},W.mont=function(t){return new Ho(t)};function Ho(oi){Ya.call(this,oi),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new W(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}Ne(Ho,Ya),Ho.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},Ho.prototype.convertFrom=function(t){var F=this.imod(t.mul(this.rinv));return F.red=null,F},Ho.prototype.imul=function(t,F){if(t.isZero()||F.isZero())return t.words[0]=0,t.length=1,t;var Ie=t.imul(F),Te=Ie.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Xr=Ie.isub(Te).iushrn(this.shift),ei=Xr;return Xr.cmp(this.m)>=0?ei=Xr.isub(this.m):Xr.cmpn(0)<0&&(ei=Xr.iadd(this.m)),ei._forceRed(this)},Ho.prototype.mul=function(t,F){if(t.isZero()||F.isZero())return new W(0)._forceRed(this);var Ie=t.mul(F),Te=Ie.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Xr=Ie.isub(Te).iushrn(this.shift),ei=Xr;return Xr.cmp(this.m)>=0?ei=Xr.isub(this.m):Xr.cmpn(0)<0&&(ei=Xr.iadd(this.m)),ei._forceRed(this)},Ho.prototype.invm=function(t){var F=this.imod(t._invmp(this.m).mul(this.r2));return F._forceRed(this)}})(G,commonjsGlobal)}(bn$4)),bn$4.exports}var utils$1={},hasRequiredUtils$2;function requireUtils$2(){return hasRequiredUtils$2||(hasRequiredUtils$2=1,function(G){var e=G;function H(W,ri){if(Array.isArray(W))return W.slice();if(!W)return[];var si=[];if(typeof W!="string"){for(var fi=0;fi>8,hi=ai&255;ti?si.push(ti,hi):si.push(hi)}return si}e.toArray=H;function Y(W){return W.length===1?"0"+W:W}e.zero2=Y;function Ne(W){for(var ri="",si=0;si(mi>>1)-1?ln=(mi>>1)-fn:ln=fn,hn.isubn(ln)):ln=0,ui[li]=ln,hn.iushrn(1)}return ui}e.getNAF=W;function ri(ti,hi){var ci=[[],[]];ti=ti.clone(),hi=hi.clone();for(var ui=0,li=0,mi;ti.cmpn(-ui)>0||hi.cmpn(-li)>0;){var hn=ti.andln(3)+ui&3,ln=hi.andln(3)+li&3;hn===3&&(hn=-1),ln===3&&(ln=-1);var fn;hn&1?(mi=ti.andln(7)+ui&7,(mi===3||mi===5)&&ln===2?fn=-hn:fn=hn):fn=0,ci[0].push(fn);var gn;ln&1?(mi=hi.andln(7)+li&7,(mi===3||mi===5)&&hn===2?gn=-ln:gn=ln):gn=0,ci[1].push(gn),2*ui===fn+1&&(ui=1-ui),2*li===gn+1&&(li=1-li),ti.iushrn(1),hi.iushrn(1)}return ci}e.getJSF=ri;function si(ti,hi,ci){var ui="_"+hi;ti.prototype[hi]=function(){return this[ui]!==void 0?this[ui]:this[ui]=ci.call(this)}}e.cachedProperty=si;function fi(ti){return typeof ti=="string"?e.toArray(ti,"hex"):ti}e.parseBytes=fi;function ai(ti){return new H(ti,"hex","le")}e.intFromLE=ai}(utils$2)),utils$2}var curve={},base$2,hasRequiredBase$1;function requireBase$1(){if(hasRequiredBase$1)return base$2;hasRequiredBase$1=1;var G=requireBn$3(),e=requireUtils$1(),H=e.getNAF,Y=e.getJSF,Ne=e.assert;function W(si,fi){this.type=si,this.p=new G(fi.p,16),this.red=fi.prime?G.red(fi.prime):G.mont(this.p),this.zero=new G(0).toRed(this.red),this.one=new G(1).toRed(this.red),this.two=new G(2).toRed(this.red),this.n=fi.n&&new G(fi.n,16),this.g=fi.g&&this.pointFromJSON(fi.g,fi.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var ai=this.n&&this.p.div(this.n);!ai||ai.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}base$2=W,W.prototype.point=function(){throw new Error("Not implemented")},W.prototype.validate=function(){throw new Error("Not implemented")},W.prototype._fixedNafMul=function(fi,ai){Ne(fi.precomputed);var ti=fi._getDoubles(),hi=H(ai,1,this._bitLength),ci=(1<=li;hn--)mi=(mi<<1)+hi[hn];ui.push(mi)}for(var ln=this.jpoint(null,null,null),fn=this.jpoint(null,null,null),gn=ci;gn>0;gn--){for(li=0;li=0;mi--){for(var hn=0;mi>=0&&ui[mi]===0;mi--)hn++;if(mi>=0&&hn++,li=li.dblp(hn),mi<0)break;var ln=ui[mi];Ne(ln!==0),fi.type==="affine"?ln>0?li=li.mixedAdd(ci[ln-1>>1]):li=li.mixedAdd(ci[-ln-1>>1].neg()):ln>0?li=li.add(ci[ln-1>>1]):li=li.add(ci[-ln-1>>1].neg())}return fi.type==="affine"?li.toP():li},W.prototype._wnafMulAdd=function(fi,ai,ti,hi,ci){var ui=this._wnafT1,li=this._wnafT2,mi=this._wnafT3,hn=0,ln,fn,gn;for(ln=0;ln=1;ln-=2){var An=ln-1,Cn=ln;if(ui[An]!==1||ui[Cn]!==1){mi[An]=H(ti[An],ui[An],this._bitLength),mi[Cn]=H(ti[Cn],ui[Cn],this._bitLength),hn=Math.max(mi[An].length,hn),hn=Math.max(mi[Cn].length,hn);continue}var an=[ai[An],null,null,ai[Cn]];ai[An].y.cmp(ai[Cn].y)===0?(an[1]=ai[An].add(ai[Cn]),an[2]=ai[An].toJ().mixedAdd(ai[Cn].neg())):ai[An].y.cmp(ai[Cn].y.redNeg())===0?(an[1]=ai[An].toJ().mixedAdd(ai[Cn]),an[2]=ai[An].add(ai[Cn].neg())):(an[1]=ai[An].toJ().mixedAdd(ai[Cn]),an[2]=ai[An].toJ().mixedAdd(ai[Cn].neg()));var Rn=[-3,-1,-5,-7,0,7,5,1,3],Ya=Y(ti[An],ti[Cn]);for(hn=Math.max(Ya[0].length,hn),mi[An]=new Array(hn),mi[Cn]=new Array(hn),fn=0;fn=0;ln--){for(var Ie=0;ln>=0;){var Te=!0;for(fn=0;fn=0&&Ie++,t=t.dblp(Ie),ln<0)break;for(fn=0;fn0?gn=li[fn][Xr-1>>1]:Xr<0&&(gn=li[fn][-Xr-1>>1].neg()),gn.type==="affine"?t=t.mixedAdd(gn):t=t.add(gn))}}for(ln=0;ln=Math.ceil((fi.bitLength()+1)/ai.step):!1},ri.prototype._getDoubles=function(fi,ai){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var ti=[this],hi=this,ci=0;ci=0&&(An=ln,Cn=fn),gn.negative&&(gn=gn.neg(),cn=cn.neg()),An.negative&&(An=An.neg(),Cn=Cn.neg()),[{a:gn,b:cn},{a:An,b:Cn}]},W.prototype._endoSplit=function(ai){var ti=this.endo.basis,hi=ti[0],ci=ti[1],ui=ci.b.mul(ai).divRound(this.n),li=hi.b.neg().mul(ai).divRound(this.n),mi=ui.mul(hi.a),hn=li.mul(ci.a),ln=ui.mul(hi.b),fn=li.mul(ci.b),gn=ai.sub(mi).sub(hn),cn=ln.add(fn).neg();return{k1:gn,k2:cn}},W.prototype.pointFromX=function(ai,ti){ai=new e(ai,16),ai.red||(ai=ai.toRed(this.red));var hi=ai.redSqr().redMul(ai).redIAdd(ai.redMul(this.a)).redIAdd(this.b),ci=hi.redSqrt();if(ci.redSqr().redSub(hi).cmp(this.zero)!==0)throw new Error("invalid point");var ui=ci.fromRed().isOdd();return(ti&&!ui||!ti&&ui)&&(ci=ci.redNeg()),this.point(ai,ci)},W.prototype.validate=function(ai){if(ai.inf)return!0;var ti=ai.x,hi=ai.y,ci=this.a.redMul(ti),ui=ti.redSqr().redMul(ti).redIAdd(ci).redIAdd(this.b);return hi.redSqr().redISub(ui).cmpn(0)===0},W.prototype._endoWnafMulAdd=function(ai,ti,hi){for(var ci=this._endoWnafT1,ui=this._endoWnafT2,li=0;li":""},ri.prototype.isInfinity=function(){return this.inf},ri.prototype.add=function(ai){if(this.inf)return ai;if(ai.inf)return this;if(this.eq(ai))return this.dbl();if(this.neg().eq(ai))return this.curve.point(null,null);if(this.x.cmp(ai.x)===0)return this.curve.point(null,null);var ti=this.y.redSub(ai.y);ti.cmpn(0)!==0&&(ti=ti.redMul(this.x.redSub(ai.x).redInvm()));var hi=ti.redSqr().redISub(this.x).redISub(ai.x),ci=ti.redMul(this.x.redSub(hi)).redISub(this.y);return this.curve.point(hi,ci)},ri.prototype.dbl=function(){if(this.inf)return this;var ai=this.y.redAdd(this.y);if(ai.cmpn(0)===0)return this.curve.point(null,null);var ti=this.curve.a,hi=this.x.redSqr(),ci=ai.redInvm(),ui=hi.redAdd(hi).redIAdd(hi).redIAdd(ti).redMul(ci),li=ui.redSqr().redISub(this.x.redAdd(this.x)),mi=ui.redMul(this.x.redSub(li)).redISub(this.y);return this.curve.point(li,mi)},ri.prototype.getX=function(){return this.x.fromRed()},ri.prototype.getY=function(){return this.y.fromRed()},ri.prototype.mul=function(ai){return ai=new e(ai,16),this.isInfinity()?this:this._hasDoubles(ai)?this.curve._fixedNafMul(this,ai):this.curve.endo?this.curve._endoWnafMulAdd([this],[ai]):this.curve._wnafMul(this,ai)},ri.prototype.mulAdd=function(ai,ti,hi){var ci=[this,ti],ui=[ai,hi];return this.curve.endo?this.curve._endoWnafMulAdd(ci,ui):this.curve._wnafMulAdd(1,ci,ui,2)},ri.prototype.jmulAdd=function(ai,ti,hi){var ci=[this,ti],ui=[ai,hi];return this.curve.endo?this.curve._endoWnafMulAdd(ci,ui,!0):this.curve._wnafMulAdd(1,ci,ui,2,!0)},ri.prototype.eq=function(ai){return this===ai||this.inf===ai.inf&&(this.inf||this.x.cmp(ai.x)===0&&this.y.cmp(ai.y)===0)},ri.prototype.neg=function(ai){if(this.inf)return this;var ti=this.curve.point(this.x,this.y.redNeg());if(ai&&this.precomputed){var hi=this.precomputed,ci=function(ui){return ui.neg()};ti.precomputed={naf:hi.naf&&{wnd:hi.naf.wnd,points:hi.naf.points.map(ci)},doubles:hi.doubles&&{step:hi.doubles.step,points:hi.doubles.points.map(ci)}}}return ti},ri.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var ai=this.curve.jpoint(this.x,this.y,this.curve.one);return ai};function si(fi,ai,ti,hi){Y.BasePoint.call(this,fi,"jacobian"),ai===null&&ti===null&&hi===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new e(0)):(this.x=new e(ai,16),this.y=new e(ti,16),this.z=new e(hi,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}return H(si,Y.BasePoint),W.prototype.jpoint=function(ai,ti,hi){return new si(this,ai,ti,hi)},si.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var ai=this.z.redInvm(),ti=ai.redSqr(),hi=this.x.redMul(ti),ci=this.y.redMul(ti).redMul(ai);return this.curve.point(hi,ci)},si.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},si.prototype.add=function(ai){if(this.isInfinity())return ai;if(ai.isInfinity())return this;var ti=ai.z.redSqr(),hi=this.z.redSqr(),ci=this.x.redMul(ti),ui=ai.x.redMul(hi),li=this.y.redMul(ti.redMul(ai.z)),mi=ai.y.redMul(hi.redMul(this.z)),hn=ci.redSub(ui),ln=li.redSub(mi);if(hn.cmpn(0)===0)return ln.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var fn=hn.redSqr(),gn=fn.redMul(hn),cn=ci.redMul(fn),An=ln.redSqr().redIAdd(gn).redISub(cn).redISub(cn),Cn=ln.redMul(cn.redISub(An)).redISub(li.redMul(gn)),an=this.z.redMul(ai.z).redMul(hn);return this.curve.jpoint(An,Cn,an)},si.prototype.mixedAdd=function(ai){if(this.isInfinity())return ai.toJ();if(ai.isInfinity())return this;var ti=this.z.redSqr(),hi=this.x,ci=ai.x.redMul(ti),ui=this.y,li=ai.y.redMul(ti).redMul(this.z),mi=hi.redSub(ci),hn=ui.redSub(li);if(mi.cmpn(0)===0)return hn.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var ln=mi.redSqr(),fn=ln.redMul(mi),gn=hi.redMul(ln),cn=hn.redSqr().redIAdd(fn).redISub(gn).redISub(gn),An=hn.redMul(gn.redISub(cn)).redISub(ui.redMul(fn)),Cn=this.z.redMul(mi);return this.curve.jpoint(cn,An,Cn)},si.prototype.dblp=function(ai){if(ai===0)return this;if(this.isInfinity())return this;if(!ai)return this.dbl();var ti;if(this.curve.zeroA||this.curve.threeA){var hi=this;for(ti=0;ti=0)return!1;if(hi.redIAdd(ui),this.x.cmp(hi)===0)return!0}},si.prototype.inspect=function(){return this.isInfinity()?"":""},si.prototype.isInfinity=function(){return this.z.cmpn(0)===0},short}var mont,hasRequiredMont;function requireMont(){if(hasRequiredMont)return mont;hasRequiredMont=1;var G=requireBn$3(),e=inherits_browserExports,H=requireBase$1(),Y=requireUtils$1();function Ne(ri){H.call(this,"mont",ri),this.a=new G(ri.a,16).toRed(this.red),this.b=new G(ri.b,16).toRed(this.red),this.i4=new G(4).toRed(this.red).redInvm(),this.two=new G(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}e(Ne,H),mont=Ne,Ne.prototype.validate=function(si){var fi=si.normalize().x,ai=fi.redSqr(),ti=ai.redMul(fi).redAdd(ai.redMul(this.a)).redAdd(fi),hi=ti.redSqrt();return hi.redSqr().cmp(ti)===0};function W(ri,si,fi){H.BasePoint.call(this,ri,"projective"),si===null&&fi===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new G(si,16),this.z=new G(fi,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}return e(W,H.BasePoint),Ne.prototype.decodePoint=function(si,fi){return this.point(Y.toArray(si,fi),1)},Ne.prototype.point=function(si,fi){return new W(this,si,fi)},Ne.prototype.pointFromJSON=function(si){return W.fromJSON(this,si)},W.prototype.precompute=function(){},W.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())},W.fromJSON=function(si,fi){return new W(si,fi[0],fi[1]||si.one)},W.prototype.inspect=function(){return this.isInfinity()?"":""},W.prototype.isInfinity=function(){return this.z.cmpn(0)===0},W.prototype.dbl=function(){var si=this.x.redAdd(this.z),fi=si.redSqr(),ai=this.x.redSub(this.z),ti=ai.redSqr(),hi=fi.redSub(ti),ci=fi.redMul(ti),ui=hi.redMul(ti.redAdd(this.curve.a24.redMul(hi)));return this.curve.point(ci,ui)},W.prototype.add=function(){throw new Error("Not supported on Montgomery curve")},W.prototype.diffAdd=function(si,fi){var ai=this.x.redAdd(this.z),ti=this.x.redSub(this.z),hi=si.x.redAdd(si.z),ci=si.x.redSub(si.z),ui=ci.redMul(ai),li=hi.redMul(ti),mi=fi.z.redMul(ui.redAdd(li).redSqr()),hn=fi.x.redMul(ui.redISub(li).redSqr());return this.curve.point(mi,hn)},W.prototype.mul=function(si){for(var fi=si.clone(),ai=this,ti=this.curve.point(null,null),hi=this,ci=[];fi.cmpn(0)!==0;fi.iushrn(1))ci.push(fi.andln(1));for(var ui=ci.length-1;ui>=0;ui--)ci[ui]===0?(ai=ai.diffAdd(ti,hi),ti=ti.dbl()):(ti=ai.diffAdd(ti,hi),ai=ai.dbl());return ti},W.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")},W.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")},W.prototype.eq=function(si){return this.getX().cmp(si.getX())===0},W.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this},W.prototype.getX=function(){return this.normalize(),this.x.fromRed()},mont}var edwards,hasRequiredEdwards;function requireEdwards(){if(hasRequiredEdwards)return edwards;hasRequiredEdwards=1;var G=requireUtils$1(),e=requireBn$3(),H=inherits_browserExports,Y=requireBase$1(),Ne=G.assert;function W(si){this.twisted=(si.a|0)!==1,this.mOneA=this.twisted&&(si.a|0)===-1,this.extended=this.mOneA,Y.call(this,"edwards",si),this.a=new e(si.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new e(si.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new e(si.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),Ne(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(si.c|0)===1}H(W,Y),edwards=W,W.prototype._mulA=function(fi){return this.mOneA?fi.redNeg():this.a.redMul(fi)},W.prototype._mulC=function(fi){return this.oneC?fi:this.c.redMul(fi)},W.prototype.jpoint=function(fi,ai,ti,hi){return this.point(fi,ai,ti,hi)},W.prototype.pointFromX=function(fi,ai){fi=new e(fi,16),fi.red||(fi=fi.toRed(this.red));var ti=fi.redSqr(),hi=this.c2.redSub(this.a.redMul(ti)),ci=this.one.redSub(this.c2.redMul(this.d).redMul(ti)),ui=hi.redMul(ci.redInvm()),li=ui.redSqrt();if(li.redSqr().redSub(ui).cmp(this.zero)!==0)throw new Error("invalid point");var mi=li.fromRed().isOdd();return(ai&&!mi||!ai&&mi)&&(li=li.redNeg()),this.point(fi,li)},W.prototype.pointFromY=function(fi,ai){fi=new e(fi,16),fi.red||(fi=fi.toRed(this.red));var ti=fi.redSqr(),hi=ti.redSub(this.c2),ci=ti.redMul(this.d).redMul(this.c2).redSub(this.a),ui=hi.redMul(ci.redInvm());if(ui.cmp(this.zero)===0){if(ai)throw new Error("invalid point");return this.point(this.zero,fi)}var li=ui.redSqrt();if(li.redSqr().redSub(ui).cmp(this.zero)!==0)throw new Error("invalid point");return li.fromRed().isOdd()!==ai&&(li=li.redNeg()),this.point(li,fi)},W.prototype.validate=function(fi){if(fi.isInfinity())return!0;fi.normalize();var ai=fi.x.redSqr(),ti=fi.y.redSqr(),hi=ai.redMul(this.a).redAdd(ti),ci=this.c2.redMul(this.one.redAdd(this.d.redMul(ai).redMul(ti)));return hi.cmp(ci)===0};function ri(si,fi,ai,ti,hi){Y.BasePoint.call(this,si,"projective"),fi===null&&ai===null&&ti===null?(this.x=this.curve.zero,this.y=this.curve.one,this.z=this.curve.one,this.t=this.curve.zero,this.zOne=!0):(this.x=new e(fi,16),this.y=new e(ai,16),this.z=ti?new e(ti,16):this.curve.one,this.t=hi&&new e(hi,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.t&&!this.t.red&&(this.t=this.t.toRed(this.curve.red)),this.zOne=this.z===this.curve.one,this.curve.extended&&!this.t&&(this.t=this.x.redMul(this.y),this.zOne||(this.t=this.t.redMul(this.z.redInvm()))))}return H(ri,Y.BasePoint),W.prototype.pointFromJSON=function(fi){return ri.fromJSON(this,fi)},W.prototype.point=function(fi,ai,ti,hi){return new ri(this,fi,ai,ti,hi)},ri.fromJSON=function(fi,ai){return new ri(fi,ai[0],ai[1],ai[2])},ri.prototype.inspect=function(){return this.isInfinity()?"":""},ri.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)},ri.prototype._extDbl=function(){var fi=this.x.redSqr(),ai=this.y.redSqr(),ti=this.z.redSqr();ti=ti.redIAdd(ti);var hi=this.curve._mulA(fi),ci=this.x.redAdd(this.y).redSqr().redISub(fi).redISub(ai),ui=hi.redAdd(ai),li=ui.redSub(ti),mi=hi.redSub(ai),hn=ci.redMul(li),ln=ui.redMul(mi),fn=ci.redMul(mi),gn=li.redMul(ui);return this.curve.point(hn,ln,gn,fn)},ri.prototype._projDbl=function(){var fi=this.x.redAdd(this.y).redSqr(),ai=this.x.redSqr(),ti=this.y.redSqr(),hi,ci,ui,li,mi,hn;if(this.curve.twisted){li=this.curve._mulA(ai);var ln=li.redAdd(ti);this.zOne?(hi=fi.redSub(ai).redSub(ti).redMul(ln.redSub(this.curve.two)),ci=ln.redMul(li.redSub(ti)),ui=ln.redSqr().redSub(ln).redSub(ln)):(mi=this.z.redSqr(),hn=ln.redSub(mi).redISub(mi),hi=fi.redSub(ai).redISub(ti).redMul(hn),ci=ln.redMul(li.redSub(ti)),ui=ln.redMul(hn))}else li=ai.redAdd(ti),mi=this.curve._mulC(this.z).redSqr(),hn=li.redSub(mi).redSub(mi),hi=this.curve._mulC(fi.redISub(li)).redMul(hn),ci=this.curve._mulC(li).redMul(ai.redISub(ti)),ui=li.redMul(hn);return this.curve.point(hi,ci,ui)},ri.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()},ri.prototype._extAdd=function(fi){var ai=this.y.redSub(this.x).redMul(fi.y.redSub(fi.x)),ti=this.y.redAdd(this.x).redMul(fi.y.redAdd(fi.x)),hi=this.t.redMul(this.curve.dd).redMul(fi.t),ci=this.z.redMul(fi.z.redAdd(fi.z)),ui=ti.redSub(ai),li=ci.redSub(hi),mi=ci.redAdd(hi),hn=ti.redAdd(ai),ln=ui.redMul(li),fn=mi.redMul(hn),gn=ui.redMul(hn),cn=li.redMul(mi);return this.curve.point(ln,fn,cn,gn)},ri.prototype._projAdd=function(fi){var ai=this.z.redMul(fi.z),ti=ai.redSqr(),hi=this.x.redMul(fi.x),ci=this.y.redMul(fi.y),ui=this.curve.d.redMul(hi).redMul(ci),li=ti.redSub(ui),mi=ti.redAdd(ui),hn=this.x.redAdd(this.y).redMul(fi.x.redAdd(fi.y)).redISub(hi).redISub(ci),ln=ai.redMul(li).redMul(hn),fn,gn;return this.curve.twisted?(fn=ai.redMul(mi).redMul(ci.redSub(this.curve._mulA(hi))),gn=li.redMul(mi)):(fn=ai.redMul(mi).redMul(ci.redSub(hi)),gn=this.curve._mulC(li).redMul(mi)),this.curve.point(ln,fn,gn)},ri.prototype.add=function(fi){return this.isInfinity()?fi:fi.isInfinity()?this:this.curve.extended?this._extAdd(fi):this._projAdd(fi)},ri.prototype.mul=function(fi){return this._hasDoubles(fi)?this.curve._fixedNafMul(this,fi):this.curve._wnafMul(this,fi)},ri.prototype.mulAdd=function(fi,ai,ti){return this.curve._wnafMulAdd(1,[this,ai],[fi,ti],2,!1)},ri.prototype.jmulAdd=function(fi,ai,ti){return this.curve._wnafMulAdd(1,[this,ai],[fi,ti],2,!0)},ri.prototype.normalize=function(){if(this.zOne)return this;var fi=this.z.redInvm();return this.x=this.x.redMul(fi),this.y=this.y.redMul(fi),this.t&&(this.t=this.t.redMul(fi)),this.z=this.curve.one,this.zOne=!0,this},ri.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())},ri.prototype.getX=function(){return this.normalize(),this.x.fromRed()},ri.prototype.getY=function(){return this.normalize(),this.y.fromRed()},ri.prototype.eq=function(fi){return this===fi||this.getX().cmp(fi.getX())===0&&this.getY().cmp(fi.getY())===0},ri.prototype.eqXToP=function(fi){var ai=fi.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(ai)===0)return!0;for(var ti=fi.clone(),hi=this.curve.redN.redMul(this.z);;){if(ti.iadd(this.curve.n),ti.cmp(this.curve.p)>=0)return!1;if(ai.redIAdd(hi),this.x.cmp(ai)===0)return!0}},ri.prototype.toP=ri.prototype.normalize,ri.prototype.mixedAdd=ri.prototype.add,edwards}var hasRequiredCurve;function requireCurve(){return hasRequiredCurve||(hasRequiredCurve=1,function(G){var e=G;e.base=requireBase$1(),e.short=requireShort(),e.mont=requireMont(),e.edwards=requireEdwards()}(curve)),curve}var curves={},hash={},utils={},hasRequiredUtils;function requireUtils(){if(hasRequiredUtils)return utils;hasRequiredUtils=1;var G=requireMinimalisticAssert(),e=inherits_browserExports;utils.inherits=e;function H(t,F){return(t.charCodeAt(F)&64512)!==55296||F<0||F+1>=t.length?!1:(t.charCodeAt(F+1)&64512)===56320}function Y(t,F){if(Array.isArray(t))return t.slice();if(!t)return[];var Ie=[];if(typeof t=="string")if(F){if(F==="hex")for(t=t.replace(/[^a-z0-9]+/ig,""),t.length%2!==0&&(t="0"+t),Xr=0;Xr>6|192,Ie[Te++]=ei&63|128):H(t,Xr)?(ei=65536+((ei&1023)<<10)+(t.charCodeAt(++Xr)&1023),Ie[Te++]=ei>>18|240,Ie[Te++]=ei>>12&63|128,Ie[Te++]=ei>>6&63|128,Ie[Te++]=ei&63|128):(Ie[Te++]=ei>>12|224,Ie[Te++]=ei>>6&63|128,Ie[Te++]=ei&63|128)}else for(Xr=0;Xr>>24|t>>>8&65280|t<<8&16711680|(t&255)<<24;return F>>>0}utils.htonl=W;function ri(t,F){for(var Ie="",Te=0;Te>>0}return ei}utils.join32=ai;function ti(t,F){for(var Ie=new Array(t.length*4),Te=0,Xr=0;Te>>24,Ie[Xr+1]=ei>>>16&255,Ie[Xr+2]=ei>>>8&255,Ie[Xr+3]=ei&255):(Ie[Xr+3]=ei>>>24,Ie[Xr+2]=ei>>>16&255,Ie[Xr+1]=ei>>>8&255,Ie[Xr]=ei&255)}return Ie}utils.split32=ti;function hi(t,F){return t>>>F|t<<32-F}utils.rotr32=hi;function ci(t,F){return t<>>32-F}utils.rotl32=ci;function ui(t,F){return t+F>>>0}utils.sum32=ui;function li(t,F,Ie){return t+F+Ie>>>0}utils.sum32_3=li;function mi(t,F,Ie,Te){return t+F+Ie+Te>>>0}utils.sum32_4=mi;function hn(t,F,Ie,Te,Xr){return t+F+Ie+Te+Xr>>>0}utils.sum32_5=hn;function ln(t,F,Ie,Te){var Xr=t[F],ei=t[F+1],ii=Te+ei>>>0,Wr=(ii>>0,t[F+1]=ii}utils.sum64=ln;function fn(t,F,Ie,Te){var Xr=F+Te>>>0,ei=(Xr>>0}utils.sum64_hi=fn;function gn(t,F,Ie,Te){var Xr=F+Te;return Xr>>>0}utils.sum64_lo=gn;function cn(t,F,Ie,Te,Xr,ei,ii,Wr){var R=0,Le=F;Le=Le+Te>>>0,R+=Le>>0,R+=Le>>0,R+=Le>>0}utils.sum64_4_hi=cn;function An(t,F,Ie,Te,Xr,ei,ii,Wr){var R=F+Te+ei+Wr;return R>>>0}utils.sum64_4_lo=An;function Cn(t,F,Ie,Te,Xr,ei,ii,Wr,R,Le){var nn=0,vn=F;vn=vn+Te>>>0,nn+=vn>>0,nn+=vn>>0,nn+=vn>>0,nn+=vn>>0}utils.sum64_5_hi=Cn;function an(t,F,Ie,Te,Xr,ei,ii,Wr,R,Le){var nn=F+Te+ei+Wr+Le;return nn>>>0}utils.sum64_5_lo=an;function Rn(t,F,Ie){var Te=F<<32-Ie|t>>>Ie;return Te>>>0}utils.rotr64_hi=Rn;function Ya(t,F,Ie){var Te=t<<32-Ie|F>>>Ie;return Te>>>0}utils.rotr64_lo=Ya;function Ho(t,F,Ie){return t>>>Ie}utils.shr64_hi=Ho;function oi(t,F,Ie){var Te=t<<32-Ie|F>>>Ie;return Te>>>0}return utils.shr64_lo=oi,utils}var common$1={},hasRequiredCommon$1;function requireCommon$1(){if(hasRequiredCommon$1)return common$1;hasRequiredCommon$1=1;var G=requireUtils(),e=requireMinimalisticAssert();function H(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}return common$1.BlockHash=H,H.prototype.update=function(Ne,W){if(Ne=G.toArray(Ne,W),this.pending?this.pending=this.pending.concat(Ne):this.pending=Ne,this.pendingTotal+=Ne.length,this.pending.length>=this._delta8){Ne=this.pending;var ri=Ne.length%this._delta8;this.pending=Ne.slice(Ne.length-ri,Ne.length),this.pending.length===0&&(this.pending=null),Ne=G.join32(Ne,0,Ne.length-ri,this.endian);for(var si=0;si>>24&255,si[fi++]=Ne>>>16&255,si[fi++]=Ne>>>8&255,si[fi++]=Ne&255}else for(si[fi++]=Ne&255,si[fi++]=Ne>>>8&255,si[fi++]=Ne>>>16&255,si[fi++]=Ne>>>24&255,si[fi++]=0,si[fi++]=0,si[fi++]=0,si[fi++]=0,ai=8;ai>>3}common.g0_256=fi;function ai(ti){return e(ti,17)^e(ti,19)^ti>>>10}return common.g1_256=ai,common}var _1,hasRequired_1;function require_1(){if(hasRequired_1)return _1;hasRequired_1=1;var G=requireUtils(),e=requireCommon$1(),H=requireCommon(),Y=G.rotl32,Ne=G.sum32,W=G.sum32_5,ri=H.ft_1,si=e.BlockHash,fi=[1518500249,1859775393,2400959708,3395469782];function ai(){if(!(this instanceof ai))return new ai;si.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}return G.inherits(ai,si),_1=ai,ai.blockSize=512,ai.outSize=160,ai.hmacStrength=80,ai.padLength=64,ai.prototype._update=function(hi,ci){for(var ui=this.W,li=0;li<16;li++)ui[li]=hi[ci+li];for(;lithis.blockSize&&(Ne=new this.Hash().update(Ne).digest()),e(Ne.length<=this.blockSize);for(var W=Ne.length;W=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(W,ri,si)}return hmacDrbg=Y,Y.prototype._init=function(W,ri,si){var fi=W.concat(ri).concat(si);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var ai=0;ai=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(W.concat(si||[])),this._reseed=1},Y.prototype.generate=function(W,ri,si,fi){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof ri!="string"&&(fi=si,si=ri,ri=null),si&&(si=e.toArray(si,fi||"hex"),this._update(si));for(var ai=[];ai.length"},key$1}var signature$1,hasRequiredSignature$1;function requireSignature$1(){if(hasRequiredSignature$1)return signature$1;hasRequiredSignature$1=1;var G=requireBn$3(),e=requireUtils$1(),H=e.assert;function Y(fi,ai){if(fi instanceof Y)return fi;this._importDER(fi,ai)||(H(fi.r&&fi.s,"Signature without r or s"),this.r=new G(fi.r,16),this.s=new G(fi.s,16),fi.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=fi.recoveryParam)}signature$1=Y;function Ne(){this.place=0}function W(fi,ai){var ti=fi[ai.place++];if(!(ti&128))return ti;var hi=ti&15;if(hi===0||hi>4)return!1;for(var ci=0,ui=0,li=ai.place;ui>>=0;return ci<=127?!1:(ai.place=li,ci)}function ri(fi){for(var ai=0,ti=fi.length-1;!fi[ai]&&!(fi[ai+1]&128)&&ai>>3);for(fi.push(ti|128);--ti;)fi.push(ai>>>(ti<<3)&255);fi.push(ai)}return Y.prototype.toDER=function(ai){var ti=this.r.toArray(),hi=this.s.toArray();for(ti[0]&128&&(ti=[0].concat(ti)),hi[0]&128&&(hi=[0].concat(hi)),ti=ri(ti),hi=ri(hi);!hi[0]&&!(hi[1]&128);)hi=hi.slice(1);var ci=[2];si(ci,ti.length),ci=ci.concat(ti),ci.push(2),si(ci,hi.length);var ui=ci.concat(hi),li=[48];return si(li,ui.length),li=li.concat(ui),e.encode(li,ai)},signature$1}var ec,hasRequiredEc;function requireEc(){if(hasRequiredEc)return ec;hasRequiredEc=1;var G=requireBn$3(),e=requireHmacDrbg(),H=requireUtils$1(),Y=requireCurves(),Ne=requireBrorand(),W=H.assert,ri=requireKey$1(),si=requireSignature$1();function fi(ai){if(!(this instanceof fi))return new fi(ai);typeof ai=="string"&&(W(Object.prototype.hasOwnProperty.call(Y,ai),"Unknown curve "+ai),ai=Y[ai]),ai instanceof Y.PresetCurve&&(ai={curve:ai}),this.curve=ai.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=ai.curve.g,this.g.precompute(ai.curve.n.bitLength()+1),this.hash=ai.hash||ai.curve.hash}return ec=fi,fi.prototype.keyPair=function(ti){return new ri(this,ti)},fi.prototype.keyFromPrivate=function(ti,hi){return ri.fromPrivate(this,ti,hi)},fi.prototype.keyFromPublic=function(ti,hi){return ri.fromPublic(this,ti,hi)},fi.prototype.genKeyPair=function(ti){ti||(ti={});for(var hi=new e({hash:this.hash,pers:ti.pers,persEnc:ti.persEnc||"utf8",entropy:ti.entropy||Ne(this.hash.hmacStrength),entropyEnc:ti.entropy&&ti.entropyEnc||"utf8",nonce:this.n.toArray()}),ci=this.n.byteLength(),ui=this.n.sub(new G(2));;){var li=new G(hi.generate(ci));if(!(li.cmp(ui)>0))return li.iaddn(1),this.keyFromPrivate(li)}},fi.prototype._truncateToN=function(ti,hi){var ci=ti.byteLength()*8-this.n.bitLength();return ci>0&&(ti=ti.ushrn(ci)),!hi&&ti.cmp(this.n)>=0?ti.sub(this.n):ti},fi.prototype.sign=function(ti,hi,ci,ui){typeof ci=="object"&&(ui=ci,ci=null),ui||(ui={}),hi=this.keyFromPrivate(hi,ci),ti=this._truncateToN(new G(ti,16));for(var li=this.n.byteLength(),mi=hi.getPrivate().toArray("be",li),hn=ti.toArray("be",li),ln=new e({hash:this.hash,entropy:mi,nonce:hn,pers:ui.pers,persEnc:ui.persEnc||"utf8"}),fn=this.n.sub(new G(1)),gn=0;;gn++){var cn=ui.k?ui.k(gn):new G(ln.generate(this.n.byteLength()));if(cn=this._truncateToN(cn,!0),!(cn.cmpn(1)<=0||cn.cmp(fn)>=0)){var An=this.g.mul(cn);if(!An.isInfinity()){var Cn=An.getX(),an=Cn.umod(this.n);if(an.cmpn(0)!==0){var Rn=cn.invm(this.n).mul(an.mul(hi.getPrivate()).iadd(ti));if(Rn=Rn.umod(this.n),Rn.cmpn(0)!==0){var Ya=(An.getY().isOdd()?1:0)|(Cn.cmp(an)!==0?2:0);return ui.canonical&&Rn.cmp(this.nh)>0&&(Rn=this.n.sub(Rn),Ya^=1),new si({r:an,s:Rn,recoveryParam:Ya})}}}}}},fi.prototype.verify=function(ti,hi,ci,ui){ti=this._truncateToN(new G(ti,16)),ci=this.keyFromPublic(ci,ui),hi=new si(hi,"hex");var li=hi.r,mi=hi.s;if(li.cmpn(1)<0||li.cmp(this.n)>=0||mi.cmpn(1)<0||mi.cmp(this.n)>=0)return!1;var hn=mi.invm(this.n),ln=hn.mul(ti).umod(this.n),fn=hn.mul(li).umod(this.n),gn;return this.curve._maxwellTrick?(gn=this.g.jmulAdd(ln,ci.getPublic(),fn),gn.isInfinity()?!1:gn.eqXToP(li)):(gn=this.g.mulAdd(ln,ci.getPublic(),fn),gn.isInfinity()?!1:gn.getX().umod(this.n).cmp(li)===0)},fi.prototype.recoverPubKey=function(ai,ti,hi,ci){W((3&hi)===hi,"The recovery param is more than two bits"),ti=new si(ti,ci);var ui=this.n,li=new G(ai),mi=ti.r,hn=ti.s,ln=hi&1,fn=hi>>1;if(mi.cmp(this.curve.p.umod(this.curve.n))>=0&&fn)throw new Error("Unable to find sencond key candinate");fn?mi=this.curve.pointFromX(mi.add(this.curve.n),ln):mi=this.curve.pointFromX(mi,ln);var gn=ti.r.invm(ui),cn=ui.sub(li).mul(gn).umod(ui),An=hn.mul(gn).umod(ui);return this.g.mulAdd(cn,mi,An)},fi.prototype.getKeyRecoveryParam=function(ai,ti,hi,ci){if(ti=new si(ti,ci),ti.recoveryParam!==null)return ti.recoveryParam;for(var ui=0;ui<4;ui++){var li;try{li=this.recoverPubKey(ai,ti,ui)}catch{continue}if(li.eq(hi))return ui}throw new Error("Unable to find valid recovery factor")},ec}var key,hasRequiredKey;function requireKey(){if(hasRequiredKey)return key;hasRequiredKey=1;var G=requireUtils$1(),e=G.assert,H=G.parseBytes,Y=G.cachedProperty;function Ne(W,ri){this.eddsa=W,this._secret=H(ri.secret),W.isPoint(ri.pub)?this._pub=ri.pub:this._pubBytes=H(ri.pub)}return Ne.fromPublic=function(ri,si){return si instanceof Ne?si:new Ne(ri,{pub:si})},Ne.fromSecret=function(ri,si){return si instanceof Ne?si:new Ne(ri,{secret:si})},Ne.prototype.secret=function(){return this._secret},Y(Ne,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())}),Y(Ne,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())}),Y(Ne,"privBytes",function(){var ri=this.eddsa,si=this.hash(),fi=ri.encodingLength-1,ai=si.slice(0,ri.encodingLength);return ai[0]&=248,ai[fi]&=127,ai[fi]|=64,ai}),Y(Ne,"priv",function(){return this.eddsa.decodeInt(this.privBytes())}),Y(Ne,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()}),Y(Ne,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)}),Ne.prototype.sign=function(ri){return e(this._secret,"KeyPair can only verify"),this.eddsa.sign(ri,this)},Ne.prototype.verify=function(ri,si){return this.eddsa.verify(ri,si,this)},Ne.prototype.getSecret=function(ri){return e(this._secret,"KeyPair is public only"),G.encode(this.secret(),ri)},Ne.prototype.getPublic=function(ri){return G.encode(this.pubBytes(),ri)},key=Ne,key}var signature,hasRequiredSignature;function requireSignature(){if(hasRequiredSignature)return signature;hasRequiredSignature=1;var G=requireBn$3(),e=requireUtils$1(),H=e.assert,Y=e.cachedProperty,Ne=e.parseBytes;function W(ri,si){this.eddsa=ri,typeof si!="object"&&(si=Ne(si)),Array.isArray(si)&&(si={R:si.slice(0,ri.encodingLength),S:si.slice(ri.encodingLength)}),H(si.R&&si.S,"Signature without R or S"),ri.isPoint(si.R)&&(this._R=si.R),si.S instanceof G&&(this._S=si.S),this._Rencoded=Array.isArray(si.R)?si.R:si.Rencoded,this._Sencoded=Array.isArray(si.S)?si.S:si.Sencoded}return Y(W,"S",function(){return this.eddsa.decodeInt(this.Sencoded())}),Y(W,"R",function(){return this.eddsa.decodePoint(this.Rencoded())}),Y(W,"Rencoded",function(){return this.eddsa.encodePoint(this.R())}),Y(W,"Sencoded",function(){return this.eddsa.encodeInt(this.S())}),W.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())},W.prototype.toHex=function(){return e.encode(this.toBytes(),"hex").toUpperCase()},signature=W,signature}var eddsa,hasRequiredEddsa;function requireEddsa(){if(hasRequiredEddsa)return eddsa;hasRequiredEddsa=1;var G=requireHash(),e=requireCurves(),H=requireUtils$1(),Y=H.assert,Ne=H.parseBytes,W=requireKey(),ri=requireSignature();function si(fi){if(Y(fi==="ed25519","only tested with ed25519 so far"),!(this instanceof si))return new si(fi);fi=e[fi].curve,this.curve=fi,this.g=fi.g,this.g.precompute(fi.n.bitLength()+1),this.pointClass=fi.point().constructor,this.encodingLength=Math.ceil(fi.n.bitLength()/8),this.hash=G.sha512}return eddsa=si,si.prototype.sign=function(ai,ti){ai=Ne(ai);var hi=this.keyFromSecret(ti),ci=this.hashInt(hi.messagePrefix(),ai),ui=this.g.mul(ci),li=this.encodePoint(ui),mi=this.hashInt(li,hi.pubBytes(),ai).mul(hi.priv()),hn=ci.add(mi).umod(this.curve.n);return this.makeSignature({R:ui,S:hn,Rencoded:li})},si.prototype.verify=function(ai,ti,hi){ai=Ne(ai),ti=this.makeSignature(ti);var ci=this.keyFromPublic(hi),ui=this.hashInt(ti.Rencoded(),ci.pubBytes(),ai),li=this.g.mul(ti.S()),mi=ti.R().add(ci.pub().mul(ui));return mi.eq(li)},si.prototype.hashInt=function(){for(var ai=this.hash(),ti=0;ti0?t:F},W.min=function(t,F){return t.cmp(F)<0?t:F},W.prototype._init=function(t,F,Ie){if(typeof t=="number")return this._initNumber(t,F,Ie);if(typeof t=="object")return this._initArray(t,F,Ie);F==="hex"&&(F=16),Y(F===(F|0)&&F>=2&&F<=36),t=t.toString().replace(/\s+/g,"");var Te=0;t[0]==="-"&&(Te++,this.negative=1),Te=0;Te-=3)ei=t[Te]|t[Te-1]<<8|t[Te-2]<<16,this.words[Xr]|=ei<>>26-ii&67108863,ii+=24,ii>=26&&(ii-=26,Xr++);else if(Ie==="le")for(Te=0,Xr=0;Te>>26-ii&67108863,ii+=24,ii>=26&&(ii-=26,Xr++);return this.strip()};function si(oi,t){var F=oi.charCodeAt(t);return F>=65&&F<=70?F-55:F>=97&&F<=102?F-87:F-48&15}function fi(oi,t,F){var Ie=si(oi,F);return F-1>=t&&(Ie|=si(oi,F-1)<<4),Ie}W.prototype._parseHex=function(t,F,Ie){this.length=Math.ceil((t.length-F)/6),this.words=new Array(this.length);for(var Te=0;Te=F;Te-=2)ii=fi(t,F,Te)<=18?(Xr-=18,ei+=1,this.words[ei]|=ii>>>26):Xr+=8;else{var Wr=t.length-F;for(Te=Wr%2===0?F+1:F;Te=18?(Xr-=18,ei+=1,this.words[ei]|=ii>>>26):Xr+=8}this.strip()};function ai(oi,t,F,Ie){for(var Te=0,Xr=Math.min(oi.length,F),ei=t;ei=49?Te+=ii-49+10:ii>=17?Te+=ii-17+10:Te+=ii}return Te}W.prototype._parseBase=function(t,F,Ie){this.words=[0],this.length=1;for(var Te=0,Xr=1;Xr<=67108863;Xr*=F)Te++;Te--,Xr=Xr/F|0;for(var ei=t.length-Ie,ii=ei%Te,Wr=Math.min(ei,ei-ii)+Ie,R=0,Le=Ie;Le1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},W.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},W.prototype.inspect=function(){return(this.red?""};var ti=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],hi=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],ci=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];W.prototype.toString=function(t,F){t=t||10,F=F|0||1;var Ie;if(t===16||t==="hex"){Ie="";for(var Te=0,Xr=0,ei=0;ei>>24-Te&16777215,Xr!==0||ei!==this.length-1?Ie=ti[6-Wr.length]+Wr+Ie:Ie=Wr+Ie,Te+=2,Te>=26&&(Te-=26,ei--)}for(Xr!==0&&(Ie=Xr.toString(16)+Ie);Ie.length%F!==0;)Ie="0"+Ie;return this.negative!==0&&(Ie="-"+Ie),Ie}if(t===(t|0)&&t>=2&&t<=36){var R=hi[t],Le=ci[t];Ie="";var nn=this.clone();for(nn.negative=0;!nn.isZero();){var vn=nn.modn(Le).toString(t);nn=nn.idivn(Le),nn.isZero()?Ie=vn+Ie:Ie=ti[R-vn.length]+vn+Ie}for(this.isZero()&&(Ie="0"+Ie);Ie.length%F!==0;)Ie="0"+Ie;return this.negative!==0&&(Ie="-"+Ie),Ie}Y(!1,"Base should be between 2 and 36")},W.prototype.toNumber=function(){var t=this.words[0];return this.length===2?t+=this.words[1]*67108864:this.length===3&&this.words[2]===1?t+=4503599627370496+this.words[1]*67108864:this.length>2&&Y(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-t:t},W.prototype.toJSON=function(){return this.toString(16)},W.prototype.toBuffer=function(t,F){return Y(typeof ri<"u"),this.toArrayLike(ri,t,F)},W.prototype.toArray=function(t,F){return this.toArrayLike(Array,t,F)},W.prototype.toArrayLike=function(t,F,Ie){var Te=this.byteLength(),Xr=Ie||Math.max(1,Te);Y(Te<=Xr,"byte array longer than desired length"),Y(Xr>0,"Requested array length <= 0"),this.strip();var ei=F==="le",ii=new t(Xr),Wr,R,Le=this.clone();if(ei){for(R=0;!Le.isZero();R++)Wr=Le.andln(255),Le.iushrn(8),ii[R]=Wr;for(;R=4096&&(Ie+=13,F>>>=13),F>=64&&(Ie+=7,F>>>=7),F>=8&&(Ie+=4,F>>>=4),F>=2&&(Ie+=2,F>>>=2),Ie+F},W.prototype._zeroBits=function(t){if(t===0)return 26;var F=t,Ie=0;return F&8191||(Ie+=13,F>>>=13),F&127||(Ie+=7,F>>>=7),F&15||(Ie+=4,F>>>=4),F&3||(Ie+=2,F>>>=2),F&1||Ie++,Ie},W.prototype.bitLength=function(){var t=this.words[this.length-1],F=this._countBits(t);return(this.length-1)*26+F};function ui(oi){for(var t=new Array(oi.bitLength()),F=0;F>>Te}return t}W.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,F=0;Ft.length?this.clone().ior(t):t.clone().ior(this)},W.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},W.prototype.iuand=function(t){var F;this.length>t.length?F=t:F=this;for(var Ie=0;Iet.length?this.clone().iand(t):t.clone().iand(this)},W.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},W.prototype.iuxor=function(t){var F,Ie;this.length>t.length?(F=this,Ie=t):(F=t,Ie=this);for(var Te=0;Tet.length?this.clone().ixor(t):t.clone().ixor(this)},W.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},W.prototype.inotn=function(t){Y(typeof t=="number"&&t>=0);var F=Math.ceil(t/26)|0,Ie=t%26;this._expand(F),Ie>0&&F--;for(var Te=0;Te0&&(this.words[Te]=~this.words[Te]&67108863>>26-Ie),this.strip()},W.prototype.notn=function(t){return this.clone().inotn(t)},W.prototype.setn=function(t,F){Y(typeof t=="number"&&t>=0);var Ie=t/26|0,Te=t%26;return this._expand(Ie+1),F?this.words[Ie]=this.words[Ie]|1<t.length?(Ie=this,Te=t):(Ie=t,Te=this);for(var Xr=0,ei=0;ei>>26;for(;Xr!==0&&ei>>26;if(this.length=Ie.length,Xr!==0)this.words[this.length]=Xr,this.length++;else if(Ie!==this)for(;eit.length?this.clone().iadd(t):t.clone().iadd(this)},W.prototype.isub=function(t){if(t.negative!==0){t.negative=0;var F=this.iadd(t);return t.negative=1,F._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var Ie=this.cmp(t);if(Ie===0)return this.negative=0,this.length=1,this.words[0]=0,this;var Te,Xr;Ie>0?(Te=this,Xr=t):(Te=t,Xr=this);for(var ei=0,ii=0;ii>26,this.words[ii]=F&67108863;for(;ei!==0&&ii>26,this.words[ii]=F&67108863;if(ei===0&&ii>>26,nn=Wr&67108863,vn=Math.min(R,t.length-1),Mn=Math.max(0,R-oi.length+1);Mn<=vn;Mn++){var sn=R-Mn|0;Te=oi.words[sn]|0,Xr=t.words[Mn]|0,ei=Te*Xr+nn,Le+=ei/67108864|0,nn=ei&67108863}F.words[R]=nn|0,Wr=Le|0}return Wr!==0?F.words[R]=Wr|0:F.length--,F.strip()}var mi=function(t,F,Ie){var Te=t.words,Xr=F.words,ei=Ie.words,ii=0,Wr,R,Le,nn=Te[0]|0,vn=nn&8191,Mn=nn>>>13,sn=Te[1]|0,Zn=sn&8191,on=sn>>>13,pn=Te[2]|0,mn=pn&8191,$i=pn>>>13,ho=Te[3]|0,Do=ho&8191,To=ho>>>13,Oh=Te[4]|0,Fo=Oh&8191,Vo=Oh>>>13,Hh=Te[5]|0,Ah=Hh&8191,Qf=Hh>>>13,Gh=Te[6]|0,tf=Gh&8191,Ko=Gh>>>13,Kh=Te[7]|0,Lf=Kh&8191,Uo=Kh>>>13,Vh=Te[8]|0,jf=Vh&8191,Zo=Vh>>>13,Wh=Te[9]|0,vh=Wh&8191,Yo=Wh>>>13,Jh=Xr[0]|0,xh=Jh&8191,Vf=Jh>>>13,Zh=Xr[1]|0,Ch=Zh&8191,Eh=Zh>>>13,Lu=Xr[2]|0,Ph=Lu&8191,Sh=Lu>>>13,Uu=Xr[3]|0,Th=Uu&8191,gh=Uu>>>13,Xh=Xr[4]|0,Rh=Xh&8191,bh=Xh>>>13,au=Xr[5]|0,$h=au&8191,wh=au>>>13,qu=Xr[6]|0,Ih=qu&8191,_h=qu>>>13,uu=Xr[7]|0,Dh=uu&8191,yh=uu>>>13,Yh=Xr[8]|0,Bh=Yh&8191,Mh=Yh>>>13,Hu=Xr[9]|0,kh=Hu&8191,qh=Hu>>>13;Ie.negative=t.negative^F.negative,Ie.length=19,Wr=Math.imul(vn,xh),R=Math.imul(vn,Vf),R=R+Math.imul(Mn,xh)|0,Le=Math.imul(Mn,Vf);var Tu=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(Tu>>>26)|0,Tu&=67108863,Wr=Math.imul(Zn,xh),R=Math.imul(Zn,Vf),R=R+Math.imul(on,xh)|0,Le=Math.imul(on,Vf),Wr=Wr+Math.imul(vn,Ch)|0,R=R+Math.imul(vn,Eh)|0,R=R+Math.imul(Mn,Ch)|0,Le=Le+Math.imul(Mn,Eh)|0;var tc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(tc>>>26)|0,tc&=67108863,Wr=Math.imul(mn,xh),R=Math.imul(mn,Vf),R=R+Math.imul($i,xh)|0,Le=Math.imul($i,Vf),Wr=Wr+Math.imul(Zn,Ch)|0,R=R+Math.imul(Zn,Eh)|0,R=R+Math.imul(on,Ch)|0,Le=Le+Math.imul(on,Eh)|0,Wr=Wr+Math.imul(vn,Ph)|0,R=R+Math.imul(vn,Sh)|0,R=R+Math.imul(Mn,Ph)|0,Le=Le+Math.imul(Mn,Sh)|0;var rc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(rc>>>26)|0,rc&=67108863,Wr=Math.imul(Do,xh),R=Math.imul(Do,Vf),R=R+Math.imul(To,xh)|0,Le=Math.imul(To,Vf),Wr=Wr+Math.imul(mn,Ch)|0,R=R+Math.imul(mn,Eh)|0,R=R+Math.imul($i,Ch)|0,Le=Le+Math.imul($i,Eh)|0,Wr=Wr+Math.imul(Zn,Ph)|0,R=R+Math.imul(Zn,Sh)|0,R=R+Math.imul(on,Ph)|0,Le=Le+Math.imul(on,Sh)|0,Wr=Wr+Math.imul(vn,Th)|0,R=R+Math.imul(vn,gh)|0,R=R+Math.imul(Mn,Th)|0,Le=Le+Math.imul(Mn,gh)|0;var ic=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(ic>>>26)|0,ic&=67108863,Wr=Math.imul(Fo,xh),R=Math.imul(Fo,Vf),R=R+Math.imul(Vo,xh)|0,Le=Math.imul(Vo,Vf),Wr=Wr+Math.imul(Do,Ch)|0,R=R+Math.imul(Do,Eh)|0,R=R+Math.imul(To,Ch)|0,Le=Le+Math.imul(To,Eh)|0,Wr=Wr+Math.imul(mn,Ph)|0,R=R+Math.imul(mn,Sh)|0,R=R+Math.imul($i,Ph)|0,Le=Le+Math.imul($i,Sh)|0,Wr=Wr+Math.imul(Zn,Th)|0,R=R+Math.imul(Zn,gh)|0,R=R+Math.imul(on,Th)|0,Le=Le+Math.imul(on,gh)|0,Wr=Wr+Math.imul(vn,Rh)|0,R=R+Math.imul(vn,bh)|0,R=R+Math.imul(Mn,Rh)|0,Le=Le+Math.imul(Mn,bh)|0;var nc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(nc>>>26)|0,nc&=67108863,Wr=Math.imul(Ah,xh),R=Math.imul(Ah,Vf),R=R+Math.imul(Qf,xh)|0,Le=Math.imul(Qf,Vf),Wr=Wr+Math.imul(Fo,Ch)|0,R=R+Math.imul(Fo,Eh)|0,R=R+Math.imul(Vo,Ch)|0,Le=Le+Math.imul(Vo,Eh)|0,Wr=Wr+Math.imul(Do,Ph)|0,R=R+Math.imul(Do,Sh)|0,R=R+Math.imul(To,Ph)|0,Le=Le+Math.imul(To,Sh)|0,Wr=Wr+Math.imul(mn,Th)|0,R=R+Math.imul(mn,gh)|0,R=R+Math.imul($i,Th)|0,Le=Le+Math.imul($i,gh)|0,Wr=Wr+Math.imul(Zn,Rh)|0,R=R+Math.imul(Zn,bh)|0,R=R+Math.imul(on,Rh)|0,Le=Le+Math.imul(on,bh)|0,Wr=Wr+Math.imul(vn,$h)|0,R=R+Math.imul(vn,wh)|0,R=R+Math.imul(Mn,$h)|0,Le=Le+Math.imul(Mn,wh)|0;var sc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(sc>>>26)|0,sc&=67108863,Wr=Math.imul(tf,xh),R=Math.imul(tf,Vf),R=R+Math.imul(Ko,xh)|0,Le=Math.imul(Ko,Vf),Wr=Wr+Math.imul(Ah,Ch)|0,R=R+Math.imul(Ah,Eh)|0,R=R+Math.imul(Qf,Ch)|0,Le=Le+Math.imul(Qf,Eh)|0,Wr=Wr+Math.imul(Fo,Ph)|0,R=R+Math.imul(Fo,Sh)|0,R=R+Math.imul(Vo,Ph)|0,Le=Le+Math.imul(Vo,Sh)|0,Wr=Wr+Math.imul(Do,Th)|0,R=R+Math.imul(Do,gh)|0,R=R+Math.imul(To,Th)|0,Le=Le+Math.imul(To,gh)|0,Wr=Wr+Math.imul(mn,Rh)|0,R=R+Math.imul(mn,bh)|0,R=R+Math.imul($i,Rh)|0,Le=Le+Math.imul($i,bh)|0,Wr=Wr+Math.imul(Zn,$h)|0,R=R+Math.imul(Zn,wh)|0,R=R+Math.imul(on,$h)|0,Le=Le+Math.imul(on,wh)|0,Wr=Wr+Math.imul(vn,Ih)|0,R=R+Math.imul(vn,_h)|0,R=R+Math.imul(Mn,Ih)|0,Le=Le+Math.imul(Mn,_h)|0;var s0=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(s0>>>26)|0,s0&=67108863,Wr=Math.imul(Lf,xh),R=Math.imul(Lf,Vf),R=R+Math.imul(Uo,xh)|0,Le=Math.imul(Uo,Vf),Wr=Wr+Math.imul(tf,Ch)|0,R=R+Math.imul(tf,Eh)|0,R=R+Math.imul(Ko,Ch)|0,Le=Le+Math.imul(Ko,Eh)|0,Wr=Wr+Math.imul(Ah,Ph)|0,R=R+Math.imul(Ah,Sh)|0,R=R+Math.imul(Qf,Ph)|0,Le=Le+Math.imul(Qf,Sh)|0,Wr=Wr+Math.imul(Fo,Th)|0,R=R+Math.imul(Fo,gh)|0,R=R+Math.imul(Vo,Th)|0,Le=Le+Math.imul(Vo,gh)|0,Wr=Wr+Math.imul(Do,Rh)|0,R=R+Math.imul(Do,bh)|0,R=R+Math.imul(To,Rh)|0,Le=Le+Math.imul(To,bh)|0,Wr=Wr+Math.imul(mn,$h)|0,R=R+Math.imul(mn,wh)|0,R=R+Math.imul($i,$h)|0,Le=Le+Math.imul($i,wh)|0,Wr=Wr+Math.imul(Zn,Ih)|0,R=R+Math.imul(Zn,_h)|0,R=R+Math.imul(on,Ih)|0,Le=Le+Math.imul(on,_h)|0,Wr=Wr+Math.imul(vn,Dh)|0,R=R+Math.imul(vn,yh)|0,R=R+Math.imul(Mn,Dh)|0,Le=Le+Math.imul(Mn,yh)|0;var hc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(hc>>>26)|0,hc&=67108863,Wr=Math.imul(jf,xh),R=Math.imul(jf,Vf),R=R+Math.imul(Zo,xh)|0,Le=Math.imul(Zo,Vf),Wr=Wr+Math.imul(Lf,Ch)|0,R=R+Math.imul(Lf,Eh)|0,R=R+Math.imul(Uo,Ch)|0,Le=Le+Math.imul(Uo,Eh)|0,Wr=Wr+Math.imul(tf,Ph)|0,R=R+Math.imul(tf,Sh)|0,R=R+Math.imul(Ko,Ph)|0,Le=Le+Math.imul(Ko,Sh)|0,Wr=Wr+Math.imul(Ah,Th)|0,R=R+Math.imul(Ah,gh)|0,R=R+Math.imul(Qf,Th)|0,Le=Le+Math.imul(Qf,gh)|0,Wr=Wr+Math.imul(Fo,Rh)|0,R=R+Math.imul(Fo,bh)|0,R=R+Math.imul(Vo,Rh)|0,Le=Le+Math.imul(Vo,bh)|0,Wr=Wr+Math.imul(Do,$h)|0,R=R+Math.imul(Do,wh)|0,R=R+Math.imul(To,$h)|0,Le=Le+Math.imul(To,wh)|0,Wr=Wr+Math.imul(mn,Ih)|0,R=R+Math.imul(mn,_h)|0,R=R+Math.imul($i,Ih)|0,Le=Le+Math.imul($i,_h)|0,Wr=Wr+Math.imul(Zn,Dh)|0,R=R+Math.imul(Zn,yh)|0,R=R+Math.imul(on,Dh)|0,Le=Le+Math.imul(on,yh)|0,Wr=Wr+Math.imul(vn,Bh)|0,R=R+Math.imul(vn,Mh)|0,R=R+Math.imul(Mn,Bh)|0,Le=Le+Math.imul(Mn,Mh)|0;var pc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(pc>>>26)|0,pc&=67108863,Wr=Math.imul(vh,xh),R=Math.imul(vh,Vf),R=R+Math.imul(Yo,xh)|0,Le=Math.imul(Yo,Vf),Wr=Wr+Math.imul(jf,Ch)|0,R=R+Math.imul(jf,Eh)|0,R=R+Math.imul(Zo,Ch)|0,Le=Le+Math.imul(Zo,Eh)|0,Wr=Wr+Math.imul(Lf,Ph)|0,R=R+Math.imul(Lf,Sh)|0,R=R+Math.imul(Uo,Ph)|0,Le=Le+Math.imul(Uo,Sh)|0,Wr=Wr+Math.imul(tf,Th)|0,R=R+Math.imul(tf,gh)|0,R=R+Math.imul(Ko,Th)|0,Le=Le+Math.imul(Ko,gh)|0,Wr=Wr+Math.imul(Ah,Rh)|0,R=R+Math.imul(Ah,bh)|0,R=R+Math.imul(Qf,Rh)|0,Le=Le+Math.imul(Qf,bh)|0,Wr=Wr+Math.imul(Fo,$h)|0,R=R+Math.imul(Fo,wh)|0,R=R+Math.imul(Vo,$h)|0,Le=Le+Math.imul(Vo,wh)|0,Wr=Wr+Math.imul(Do,Ih)|0,R=R+Math.imul(Do,_h)|0,R=R+Math.imul(To,Ih)|0,Le=Le+Math.imul(To,_h)|0,Wr=Wr+Math.imul(mn,Dh)|0,R=R+Math.imul(mn,yh)|0,R=R+Math.imul($i,Dh)|0,Le=Le+Math.imul($i,yh)|0,Wr=Wr+Math.imul(Zn,Bh)|0,R=R+Math.imul(Zn,Mh)|0,R=R+Math.imul(on,Bh)|0,Le=Le+Math.imul(on,Mh)|0,Wr=Wr+Math.imul(vn,kh)|0,R=R+Math.imul(vn,qh)|0,R=R+Math.imul(Mn,kh)|0,Le=Le+Math.imul(Mn,qh)|0;var uc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(uc>>>26)|0,uc&=67108863,Wr=Math.imul(vh,Ch),R=Math.imul(vh,Eh),R=R+Math.imul(Yo,Ch)|0,Le=Math.imul(Yo,Eh),Wr=Wr+Math.imul(jf,Ph)|0,R=R+Math.imul(jf,Sh)|0,R=R+Math.imul(Zo,Ph)|0,Le=Le+Math.imul(Zo,Sh)|0,Wr=Wr+Math.imul(Lf,Th)|0,R=R+Math.imul(Lf,gh)|0,R=R+Math.imul(Uo,Th)|0,Le=Le+Math.imul(Uo,gh)|0,Wr=Wr+Math.imul(tf,Rh)|0,R=R+Math.imul(tf,bh)|0,R=R+Math.imul(Ko,Rh)|0,Le=Le+Math.imul(Ko,bh)|0,Wr=Wr+Math.imul(Ah,$h)|0,R=R+Math.imul(Ah,wh)|0,R=R+Math.imul(Qf,$h)|0,Le=Le+Math.imul(Qf,wh)|0,Wr=Wr+Math.imul(Fo,Ih)|0,R=R+Math.imul(Fo,_h)|0,R=R+Math.imul(Vo,Ih)|0,Le=Le+Math.imul(Vo,_h)|0,Wr=Wr+Math.imul(Do,Dh)|0,R=R+Math.imul(Do,yh)|0,R=R+Math.imul(To,Dh)|0,Le=Le+Math.imul(To,yh)|0,Wr=Wr+Math.imul(mn,Bh)|0,R=R+Math.imul(mn,Mh)|0,R=R+Math.imul($i,Bh)|0,Le=Le+Math.imul($i,Mh)|0,Wr=Wr+Math.imul(Zn,kh)|0,R=R+Math.imul(Zn,qh)|0,R=R+Math.imul(on,kh)|0,Le=Le+Math.imul(on,qh)|0;var vc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(vc>>>26)|0,vc&=67108863,Wr=Math.imul(vh,Ph),R=Math.imul(vh,Sh),R=R+Math.imul(Yo,Ph)|0,Le=Math.imul(Yo,Sh),Wr=Wr+Math.imul(jf,Th)|0,R=R+Math.imul(jf,gh)|0,R=R+Math.imul(Zo,Th)|0,Le=Le+Math.imul(Zo,gh)|0,Wr=Wr+Math.imul(Lf,Rh)|0,R=R+Math.imul(Lf,bh)|0,R=R+Math.imul(Uo,Rh)|0,Le=Le+Math.imul(Uo,bh)|0,Wr=Wr+Math.imul(tf,$h)|0,R=R+Math.imul(tf,wh)|0,R=R+Math.imul(Ko,$h)|0,Le=Le+Math.imul(Ko,wh)|0,Wr=Wr+Math.imul(Ah,Ih)|0,R=R+Math.imul(Ah,_h)|0,R=R+Math.imul(Qf,Ih)|0,Le=Le+Math.imul(Qf,_h)|0,Wr=Wr+Math.imul(Fo,Dh)|0,R=R+Math.imul(Fo,yh)|0,R=R+Math.imul(Vo,Dh)|0,Le=Le+Math.imul(Vo,yh)|0,Wr=Wr+Math.imul(Do,Bh)|0,R=R+Math.imul(Do,Mh)|0,R=R+Math.imul(To,Bh)|0,Le=Le+Math.imul(To,Mh)|0,Wr=Wr+Math.imul(mn,kh)|0,R=R+Math.imul(mn,qh)|0,R=R+Math.imul($i,kh)|0,Le=Le+Math.imul($i,qh)|0;var mc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(mc>>>26)|0,mc&=67108863,Wr=Math.imul(vh,Th),R=Math.imul(vh,gh),R=R+Math.imul(Yo,Th)|0,Le=Math.imul(Yo,gh),Wr=Wr+Math.imul(jf,Rh)|0,R=R+Math.imul(jf,bh)|0,R=R+Math.imul(Zo,Rh)|0,Le=Le+Math.imul(Zo,bh)|0,Wr=Wr+Math.imul(Lf,$h)|0,R=R+Math.imul(Lf,wh)|0,R=R+Math.imul(Uo,$h)|0,Le=Le+Math.imul(Uo,wh)|0,Wr=Wr+Math.imul(tf,Ih)|0,R=R+Math.imul(tf,_h)|0,R=R+Math.imul(Ko,Ih)|0,Le=Le+Math.imul(Ko,_h)|0,Wr=Wr+Math.imul(Ah,Dh)|0,R=R+Math.imul(Ah,yh)|0,R=R+Math.imul(Qf,Dh)|0,Le=Le+Math.imul(Qf,yh)|0,Wr=Wr+Math.imul(Fo,Bh)|0,R=R+Math.imul(Fo,Mh)|0,R=R+Math.imul(Vo,Bh)|0,Le=Le+Math.imul(Vo,Mh)|0,Wr=Wr+Math.imul(Do,kh)|0,R=R+Math.imul(Do,qh)|0,R=R+Math.imul(To,kh)|0,Le=Le+Math.imul(To,qh)|0;var cc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(cc>>>26)|0,cc&=67108863,Wr=Math.imul(vh,Rh),R=Math.imul(vh,bh),R=R+Math.imul(Yo,Rh)|0,Le=Math.imul(Yo,bh),Wr=Wr+Math.imul(jf,$h)|0,R=R+Math.imul(jf,wh)|0,R=R+Math.imul(Zo,$h)|0,Le=Le+Math.imul(Zo,wh)|0,Wr=Wr+Math.imul(Lf,Ih)|0,R=R+Math.imul(Lf,_h)|0,R=R+Math.imul(Uo,Ih)|0,Le=Le+Math.imul(Uo,_h)|0,Wr=Wr+Math.imul(tf,Dh)|0,R=R+Math.imul(tf,yh)|0,R=R+Math.imul(Ko,Dh)|0,Le=Le+Math.imul(Ko,yh)|0,Wr=Wr+Math.imul(Ah,Bh)|0,R=R+Math.imul(Ah,Mh)|0,R=R+Math.imul(Qf,Bh)|0,Le=Le+Math.imul(Qf,Mh)|0,Wr=Wr+Math.imul(Fo,kh)|0,R=R+Math.imul(Fo,qh)|0,R=R+Math.imul(Vo,kh)|0,Le=Le+Math.imul(Vo,qh)|0;var lc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(lc>>>26)|0,lc&=67108863,Wr=Math.imul(vh,$h),R=Math.imul(vh,wh),R=R+Math.imul(Yo,$h)|0,Le=Math.imul(Yo,wh),Wr=Wr+Math.imul(jf,Ih)|0,R=R+Math.imul(jf,_h)|0,R=R+Math.imul(Zo,Ih)|0,Le=Le+Math.imul(Zo,_h)|0,Wr=Wr+Math.imul(Lf,Dh)|0,R=R+Math.imul(Lf,yh)|0,R=R+Math.imul(Uo,Dh)|0,Le=Le+Math.imul(Uo,yh)|0,Wr=Wr+Math.imul(tf,Bh)|0,R=R+Math.imul(tf,Mh)|0,R=R+Math.imul(Ko,Bh)|0,Le=Le+Math.imul(Ko,Mh)|0,Wr=Wr+Math.imul(Ah,kh)|0,R=R+Math.imul(Ah,qh)|0,R=R+Math.imul(Qf,kh)|0,Le=Le+Math.imul(Qf,qh)|0;var dc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(dc>>>26)|0,dc&=67108863,Wr=Math.imul(vh,Ih),R=Math.imul(vh,_h),R=R+Math.imul(Yo,Ih)|0,Le=Math.imul(Yo,_h),Wr=Wr+Math.imul(jf,Dh)|0,R=R+Math.imul(jf,yh)|0,R=R+Math.imul(Zo,Dh)|0,Le=Le+Math.imul(Zo,yh)|0,Wr=Wr+Math.imul(Lf,Bh)|0,R=R+Math.imul(Lf,Mh)|0,R=R+Math.imul(Uo,Bh)|0,Le=Le+Math.imul(Uo,Mh)|0,Wr=Wr+Math.imul(tf,kh)|0,R=R+Math.imul(tf,qh)|0,R=R+Math.imul(Ko,kh)|0,Le=Le+Math.imul(Ko,qh)|0;var $0=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+($0>>>26)|0,$0&=67108863,Wr=Math.imul(vh,Dh),R=Math.imul(vh,yh),R=R+Math.imul(Yo,Dh)|0,Le=Math.imul(Yo,yh),Wr=Wr+Math.imul(jf,Bh)|0,R=R+Math.imul(jf,Mh)|0,R=R+Math.imul(Zo,Bh)|0,Le=Le+Math.imul(Zo,Mh)|0,Wr=Wr+Math.imul(Lf,kh)|0,R=R+Math.imul(Lf,qh)|0,R=R+Math.imul(Uo,kh)|0,Le=Le+Math.imul(Uo,qh)|0;var gc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(gc>>>26)|0,gc&=67108863,Wr=Math.imul(vh,Bh),R=Math.imul(vh,Mh),R=R+Math.imul(Yo,Bh)|0,Le=Math.imul(Yo,Mh),Wr=Wr+Math.imul(jf,kh)|0,R=R+Math.imul(jf,qh)|0,R=R+Math.imul(Zo,kh)|0,Le=Le+Math.imul(Zo,qh)|0;var bc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(bc>>>26)|0,bc&=67108863,Wr=Math.imul(vh,kh),R=Math.imul(vh,qh),R=R+Math.imul(Yo,kh)|0,Le=Math.imul(Yo,qh);var yc=(ii+Wr|0)+((R&8191)<<13)|0;return ii=(Le+(R>>>13)|0)+(yc>>>26)|0,yc&=67108863,ei[0]=Tu,ei[1]=tc,ei[2]=rc,ei[3]=ic,ei[4]=nc,ei[5]=sc,ei[6]=s0,ei[7]=hc,ei[8]=pc,ei[9]=uc,ei[10]=vc,ei[11]=mc,ei[12]=cc,ei[13]=lc,ei[14]=dc,ei[15]=$0,ei[16]=gc,ei[17]=bc,ei[18]=yc,ii!==0&&(ei[19]=ii,Ie.length++),Ie};Math.imul||(mi=li);function hn(oi,t,F){F.negative=t.negative^oi.negative,F.length=oi.length+t.length;for(var Ie=0,Te=0,Xr=0;Xr>>26)|0,Te+=ei>>>26,ei&=67108863}F.words[Xr]=ii,Ie=ei,ei=Te}return Ie!==0?F.words[Xr]=Ie:F.length--,F.strip()}function ln(oi,t,F){var Ie=new fn;return Ie.mulp(oi,t,F)}W.prototype.mulTo=function(t,F){var Ie,Te=this.length+t.length;return this.length===10&&t.length===10?Ie=mi(this,t,F):Te<63?Ie=li(this,t,F):Te<1024?Ie=hn(this,t,F):Ie=ln(this,t,F),Ie};function fn(oi,t){this.x=oi,this.y=t}fn.prototype.makeRBT=function(t){for(var F=new Array(t),Ie=W.prototype._countBits(t)-1,Te=0;Te>=1;return Te},fn.prototype.permute=function(t,F,Ie,Te,Xr,ei){for(var ii=0;ii>>1)Xr++;return 1<>>13,Ie[2*ei+1]=Xr&8191,Xr=Xr>>>13;for(ei=2*F;ei>=26,F+=Te/67108864|0,F+=Xr>>>26,this.words[Ie]=Xr&67108863}return F!==0&&(this.words[Ie]=F,this.length++),this},W.prototype.muln=function(t){return this.clone().imuln(t)},W.prototype.sqr=function(){return this.mul(this)},W.prototype.isqr=function(){return this.imul(this.clone())},W.prototype.pow=function(t){var F=ui(t);if(F.length===0)return new W(1);for(var Ie=this,Te=0;Te=0);var F=t%26,Ie=(t-F)/26,Te=67108863>>>26-F<<26-F,Xr;if(F!==0){var ei=0;for(Xr=0;Xr>>26-F}ei&&(this.words[Xr]=ei,this.length++)}if(Ie!==0){for(Xr=this.length-1;Xr>=0;Xr--)this.words[Xr+Ie]=this.words[Xr];for(Xr=0;Xr=0);var Te;F?Te=(F-F%26)/26:Te=0;var Xr=t%26,ei=Math.min((t-Xr)/26,this.length),ii=67108863^67108863>>>Xr<ei)for(this.length-=ei,R=0;R=0&&(Le!==0||R>=Te);R--){var nn=this.words[R]|0;this.words[R]=Le<<26-Xr|nn>>>Xr,Le=nn&ii}return Wr&&Le!==0&&(Wr.words[Wr.length++]=Le),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},W.prototype.ishrn=function(t,F,Ie){return Y(this.negative===0),this.iushrn(t,F,Ie)},W.prototype.shln=function(t){return this.clone().ishln(t)},W.prototype.ushln=function(t){return this.clone().iushln(t)},W.prototype.shrn=function(t){return this.clone().ishrn(t)},W.prototype.ushrn=function(t){return this.clone().iushrn(t)},W.prototype.testn=function(t){Y(typeof t=="number"&&t>=0);var F=t%26,Ie=(t-F)/26,Te=1<=0);var F=t%26,Ie=(t-F)/26;if(Y(this.negative===0,"imaskn works only with positive numbers"),this.length<=Ie)return this;if(F!==0&&Ie++,this.length=Math.min(Ie,this.length),F!==0){var Te=67108863^67108863>>>F<=67108864;F++)this.words[F]-=67108864,F===this.length-1?this.words[F+1]=1:this.words[F+1]++;return this.length=Math.max(this.length,F+1),this},W.prototype.isubn=function(t){if(Y(typeof t=="number"),Y(t<67108864),t<0)return this.iaddn(-t);if(this.negative!==0)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var F=0;F>26)-(Wr/67108864|0),this.words[Xr+Ie]=ei&67108863}for(;Xr>26,this.words[Xr+Ie]=ei&67108863;if(ii===0)return this.strip();for(Y(ii===-1),ii=0,Xr=0;Xr>26,this.words[Xr]=ei&67108863;return this.negative=1,this.strip()},W.prototype._wordDiv=function(t,F){var Ie=this.length-t.length,Te=this.clone(),Xr=t,ei=Xr.words[Xr.length-1]|0,ii=this._countBits(ei);Ie=26-ii,Ie!==0&&(Xr=Xr.ushln(Ie),Te.iushln(Ie),ei=Xr.words[Xr.length-1]|0);var Wr=Te.length-Xr.length,R;if(F!=="mod"){R=new W(null),R.length=Wr+1,R.words=new Array(R.length);for(var Le=0;Le=0;vn--){var Mn=(Te.words[Xr.length+vn]|0)*67108864+(Te.words[Xr.length+vn-1]|0);for(Mn=Math.min(Mn/ei|0,67108863),Te._ishlnsubmul(Xr,Mn,vn);Te.negative!==0;)Mn--,Te.negative=0,Te._ishlnsubmul(Xr,1,vn),Te.isZero()||(Te.negative^=1);R&&(R.words[vn]=Mn)}return R&&R.strip(),Te.strip(),F!=="div"&&Ie!==0&&Te.iushrn(Ie),{div:R||null,mod:Te}},W.prototype.divmod=function(t,F,Ie){if(Y(!t.isZero()),this.isZero())return{div:new W(0),mod:new W(0)};var Te,Xr,ei;return this.negative!==0&&t.negative===0?(ei=this.neg().divmod(t,F),F!=="mod"&&(Te=ei.div.neg()),F!=="div"&&(Xr=ei.mod.neg(),Ie&&Xr.negative!==0&&Xr.iadd(t)),{div:Te,mod:Xr}):this.negative===0&&t.negative!==0?(ei=this.divmod(t.neg(),F),F!=="mod"&&(Te=ei.div.neg()),{div:Te,mod:ei.mod}):this.negative&t.negative?(ei=this.neg().divmod(t.neg(),F),F!=="div"&&(Xr=ei.mod.neg(),Ie&&Xr.negative!==0&&Xr.isub(t)),{div:ei.div,mod:Xr}):t.length>this.length||this.cmp(t)<0?{div:new W(0),mod:this}:t.length===1?F==="div"?{div:this.divn(t.words[0]),mod:null}:F==="mod"?{div:null,mod:new W(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new W(this.modn(t.words[0]))}:this._wordDiv(t,F)},W.prototype.div=function(t){return this.divmod(t,"div",!1).div},W.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},W.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},W.prototype.divRound=function(t){var F=this.divmod(t);if(F.mod.isZero())return F.div;var Ie=F.div.negative!==0?F.mod.isub(t):F.mod,Te=t.ushrn(1),Xr=t.andln(1),ei=Ie.cmp(Te);return ei<0||Xr===1&&ei===0?F.div:F.div.negative!==0?F.div.isubn(1):F.div.iaddn(1)},W.prototype.modn=function(t){Y(t<=67108863);for(var F=(1<<26)%t,Ie=0,Te=this.length-1;Te>=0;Te--)Ie=(F*Ie+(this.words[Te]|0))%t;return Ie},W.prototype.idivn=function(t){Y(t<=67108863);for(var F=0,Ie=this.length-1;Ie>=0;Ie--){var Te=(this.words[Ie]|0)+F*67108864;this.words[Ie]=Te/t|0,F=Te%t}return this.strip()},W.prototype.divn=function(t){return this.clone().idivn(t)},W.prototype.egcd=function(t){Y(t.negative===0),Y(!t.isZero());var F=this,Ie=t.clone();F.negative!==0?F=F.umod(t):F=F.clone();for(var Te=new W(1),Xr=new W(0),ei=new W(0),ii=new W(1),Wr=0;F.isEven()&&Ie.isEven();)F.iushrn(1),Ie.iushrn(1),++Wr;for(var R=Ie.clone(),Le=F.clone();!F.isZero();){for(var nn=0,vn=1;!(F.words[0]&vn)&&nn<26;++nn,vn<<=1);if(nn>0)for(F.iushrn(nn);nn-- >0;)(Te.isOdd()||Xr.isOdd())&&(Te.iadd(R),Xr.isub(Le)),Te.iushrn(1),Xr.iushrn(1);for(var Mn=0,sn=1;!(Ie.words[0]&sn)&&Mn<26;++Mn,sn<<=1);if(Mn>0)for(Ie.iushrn(Mn);Mn-- >0;)(ei.isOdd()||ii.isOdd())&&(ei.iadd(R),ii.isub(Le)),ei.iushrn(1),ii.iushrn(1);F.cmp(Ie)>=0?(F.isub(Ie),Te.isub(ei),Xr.isub(ii)):(Ie.isub(F),ei.isub(Te),ii.isub(Xr))}return{a:ei,b:ii,gcd:Ie.iushln(Wr)}},W.prototype._invmp=function(t){Y(t.negative===0),Y(!t.isZero());var F=this,Ie=t.clone();F.negative!==0?F=F.umod(t):F=F.clone();for(var Te=new W(1),Xr=new W(0),ei=Ie.clone();F.cmpn(1)>0&&Ie.cmpn(1)>0;){for(var ii=0,Wr=1;!(F.words[0]&Wr)&&ii<26;++ii,Wr<<=1);if(ii>0)for(F.iushrn(ii);ii-- >0;)Te.isOdd()&&Te.iadd(ei),Te.iushrn(1);for(var R=0,Le=1;!(Ie.words[0]&Le)&&R<26;++R,Le<<=1);if(R>0)for(Ie.iushrn(R);R-- >0;)Xr.isOdd()&&Xr.iadd(ei),Xr.iushrn(1);F.cmp(Ie)>=0?(F.isub(Ie),Te.isub(Xr)):(Ie.isub(F),Xr.isub(Te))}var nn;return F.cmpn(1)===0?nn=Te:nn=Xr,nn.cmpn(0)<0&&nn.iadd(t),nn},W.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var F=this.clone(),Ie=t.clone();F.negative=0,Ie.negative=0;for(var Te=0;F.isEven()&&Ie.isEven();Te++)F.iushrn(1),Ie.iushrn(1);do{for(;F.isEven();)F.iushrn(1);for(;Ie.isEven();)Ie.iushrn(1);var Xr=F.cmp(Ie);if(Xr<0){var ei=F;F=Ie,Ie=ei}else if(Xr===0||Ie.cmpn(1)===0)break;F.isub(Ie)}while(!0);return Ie.iushln(Te)},W.prototype.invm=function(t){return this.egcd(t).a.umod(t)},W.prototype.isEven=function(){return(this.words[0]&1)===0},W.prototype.isOdd=function(){return(this.words[0]&1)===1},W.prototype.andln=function(t){return this.words[0]&t},W.prototype.bincn=function(t){Y(typeof t=="number");var F=t%26,Ie=(t-F)/26,Te=1<>>26,ii&=67108863,this.words[ei]=ii}return Xr!==0&&(this.words[ei]=Xr,this.length++),this},W.prototype.isZero=function(){return this.length===1&&this.words[0]===0},W.prototype.cmpn=function(t){var F=t<0;if(this.negative!==0&&!F)return-1;if(this.negative===0&&F)return 1;this.strip();var Ie;if(this.length>1)Ie=1;else{F&&(t=-t),Y(t<=67108863,"Number is too big");var Te=this.words[0]|0;Ie=Te===t?0:Tet.length)return 1;if(this.length=0;Ie--){var Te=this.words[Ie]|0,Xr=t.words[Ie]|0;if(Te!==Xr){TeXr&&(F=1);break}}return F},W.prototype.gtn=function(t){return this.cmpn(t)===1},W.prototype.gt=function(t){return this.cmp(t)===1},W.prototype.gten=function(t){return this.cmpn(t)>=0},W.prototype.gte=function(t){return this.cmp(t)>=0},W.prototype.ltn=function(t){return this.cmpn(t)===-1},W.prototype.lt=function(t){return this.cmp(t)===-1},W.prototype.lten=function(t){return this.cmpn(t)<=0},W.prototype.lte=function(t){return this.cmp(t)<=0},W.prototype.eqn=function(t){return this.cmpn(t)===0},W.prototype.eq=function(t){return this.cmp(t)===0},W.red=function(t){return new Ya(t)},W.prototype.toRed=function(t){return Y(!this.red,"Already a number in reduction context"),Y(this.negative===0,"red works only with positives"),t.convertTo(this)._forceRed(t)},W.prototype.fromRed=function(){return Y(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},W.prototype._forceRed=function(t){return this.red=t,this},W.prototype.forceRed=function(t){return Y(!this.red,"Already a number in reduction context"),this._forceRed(t)},W.prototype.redAdd=function(t){return Y(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},W.prototype.redIAdd=function(t){return Y(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},W.prototype.redSub=function(t){return Y(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},W.prototype.redISub=function(t){return Y(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},W.prototype.redShl=function(t){return Y(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},W.prototype.redMul=function(t){return Y(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},W.prototype.redIMul=function(t){return Y(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},W.prototype.redSqr=function(){return Y(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},W.prototype.redISqr=function(){return Y(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},W.prototype.redSqrt=function(){return Y(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},W.prototype.redInvm=function(){return Y(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},W.prototype.redNeg=function(){return Y(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},W.prototype.redPow=function(t){return Y(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var gn={k256:null,p224:null,p192:null,p25519:null};function cn(oi,t){this.name=oi,this.p=new W(t,16),this.n=this.p.bitLength(),this.k=new W(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}cn.prototype._tmp=function(){var t=new W(null);return t.words=new Array(Math.ceil(this.n/13)),t},cn.prototype.ireduce=function(t){var F=t,Ie;do this.split(F,this.tmp),F=this.imulK(F),F=F.iadd(this.tmp),Ie=F.bitLength();while(Ie>this.n);var Te=Ie0?F.isub(this.p):F.strip!==void 0?F.strip():F._strip(),F},cn.prototype.split=function(t,F){t.iushrn(this.n,0,F)},cn.prototype.imulK=function(t){return t.imul(this.k)};function An(){cn.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}Ne(An,cn),An.prototype.split=function(t,F){for(var Ie=4194303,Te=Math.min(t.length,9),Xr=0;Xr>>22,ei=ii}ei>>>=22,t.words[Xr-10]=ei,ei===0&&t.length>10?t.length-=10:t.length-=9},An.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var F=0,Ie=0;Ie>>=26,t.words[Ie]=Xr,F=Te}return F!==0&&(t.words[t.length++]=F),t},W._prime=function(t){if(gn[t])return gn[t];var F;if(t==="k256")F=new An;else if(t==="p224")F=new Cn;else if(t==="p192")F=new an;else if(t==="p25519")F=new Rn;else throw new Error("Unknown prime "+t);return gn[t]=F,F};function Ya(oi){if(typeof oi=="string"){var t=W._prime(oi);this.m=t.p,this.prime=t}else Y(oi.gtn(1),"modulus must be greater than 1"),this.m=oi,this.prime=null}Ya.prototype._verify1=function(t){Y(t.negative===0,"red works only with positives"),Y(t.red,"red works only with red numbers")},Ya.prototype._verify2=function(t,F){Y((t.negative|F.negative)===0,"red works only with positives"),Y(t.red&&t.red===F.red,"red works only with red numbers")},Ya.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},Ya.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},Ya.prototype.add=function(t,F){this._verify2(t,F);var Ie=t.add(F);return Ie.cmp(this.m)>=0&&Ie.isub(this.m),Ie._forceRed(this)},Ya.prototype.iadd=function(t,F){this._verify2(t,F);var Ie=t.iadd(F);return Ie.cmp(this.m)>=0&&Ie.isub(this.m),Ie},Ya.prototype.sub=function(t,F){this._verify2(t,F);var Ie=t.sub(F);return Ie.cmpn(0)<0&&Ie.iadd(this.m),Ie._forceRed(this)},Ya.prototype.isub=function(t,F){this._verify2(t,F);var Ie=t.isub(F);return Ie.cmpn(0)<0&&Ie.iadd(this.m),Ie},Ya.prototype.shl=function(t,F){return this._verify1(t),this.imod(t.ushln(F))},Ya.prototype.imul=function(t,F){return this._verify2(t,F),this.imod(t.imul(F))},Ya.prototype.mul=function(t,F){return this._verify2(t,F),this.imod(t.mul(F))},Ya.prototype.isqr=function(t){return this.imul(t,t.clone())},Ya.prototype.sqr=function(t){return this.mul(t,t)},Ya.prototype.sqrt=function(t){if(t.isZero())return t.clone();var F=this.m.andln(3);if(Y(F%2===1),F===3){var Ie=this.m.add(new W(1)).iushrn(2);return this.pow(t,Ie)}for(var Te=this.m.subn(1),Xr=0;!Te.isZero()&&Te.andln(1)===0;)Xr++,Te.iushrn(1);Y(!Te.isZero());var ei=new W(1).toRed(this),ii=ei.redNeg(),Wr=this.m.subn(1).iushrn(1),R=this.m.bitLength();for(R=new W(2*R*R).toRed(this);this.pow(R,Wr).cmp(ii)!==0;)R.redIAdd(ii);for(var Le=this.pow(R,Te),nn=this.pow(t,Te.addn(1).iushrn(1)),vn=this.pow(t,Te),Mn=Xr;vn.cmp(ei)!==0;){for(var sn=vn,Zn=0;sn.cmp(ei)!==0;Zn++)sn=sn.redSqr();Y(Zn=0;Xr--){for(var Le=F.words[Xr],nn=R-1;nn>=0;nn--){var vn=Le>>nn&1;if(ei!==Te[0]&&(ei=this.sqr(ei)),vn===0&&ii===0){Wr=0;continue}ii<<=1,ii|=vn,Wr++,!(Wr!==Ie&&(Xr!==0||nn!==0))&&(ei=this.mul(ei,Te[ii]),Wr=0,ii=0)}R=26}return ei},Ya.prototype.convertTo=function(t){var F=t.umod(this.m);return F===t?F.clone():F},Ya.prototype.convertFrom=function(t){var F=t.clone();return F.red=null,F},W.mont=function(t){return new Ho(t)};function Ho(oi){Ya.call(this,oi),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new W(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}Ne(Ho,Ya),Ho.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},Ho.prototype.convertFrom=function(t){var F=this.imod(t.mul(this.rinv));return F.red=null,F},Ho.prototype.imul=function(t,F){if(t.isZero()||F.isZero())return t.words[0]=0,t.length=1,t;var Ie=t.imul(F),Te=Ie.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Xr=Ie.isub(Te).iushrn(this.shift),ei=Xr;return Xr.cmp(this.m)>=0?ei=Xr.isub(this.m):Xr.cmpn(0)<0&&(ei=Xr.iadd(this.m)),ei._forceRed(this)},Ho.prototype.mul=function(t,F){if(t.isZero()||F.isZero())return new W(0)._forceRed(this);var Ie=t.mul(F),Te=Ie.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Xr=Ie.isub(Te).iushrn(this.shift),ei=Xr;return Xr.cmp(this.m)>=0?ei=Xr.isub(this.m):Xr.cmpn(0)<0&&(ei=Xr.iadd(this.m)),ei._forceRed(this)},Ho.prototype.invm=function(t){var F=this.imod(t._invmp(this.m).mul(this.r2));return F._forceRed(this)}})(G,commonjsGlobal)}(bn$3)),bn$3.exports}var api={},vmBrowserify={},hasRequiredVmBrowserify;function requireVmBrowserify(){return hasRequiredVmBrowserify||(hasRequiredVmBrowserify=1,function(exports){var indexOf=function(G,e){if(G.indexOf)return G.indexOf(e);for(var H=0;H>6],ui=(hi&32)===0;if((hi&31)===31){var li=hi;for(hi=0;(li&128)===128;){if(li=ai.readUInt8(ti),ai.isError(li))return li;hi<<=7,hi|=li&127}}else hi&=31;var mi=Ne.tag[hi];return{cls:ci,primitive:ui,tag:hi,tagStr:mi}}function fi(ai,ti,hi){var ci=ai.readUInt8(hi);if(ai.isError(ci))return ci;if(!ti&&ci===128)return null;if(!(ci&128))return ci;var ui=ci&127;if(ui>4)return ai.error("length octect is too long");ci=0;for(var li=0;li=256;hn>>=8)mi++;var ln=new e(2+mi);ln[0]=li,ln[1]=128|mi;for(var hn=1+mi,fn=ui.length;fn>0;hn--,fn>>=8)ln[hn]=fn&255;return this._createEncoderBuffer([ln,ui])},ri.prototype._encodeStr=function(ti,hi){if(hi==="bitstr")return this._createEncoderBuffer([ti.unused|0,ti.data]);if(hi==="bmpstr"){for(var ci=new e(ti.length*2),ui=0;ui=40)return this.reporter.error("Second objid identifier OOB");ti.splice(0,2,ti[0]*40+ti[1])}for(var li=0,ui=0;ui=128;mi>>=7)li++}for(var hn=new e(li),ln=hn.length-1,ui=ti.length-1;ui>=0;ui--){var mi=ti[ui];for(hn[ln--]=mi&127;(mi>>=7)>0;)hn[ln--]=128|mi&127}return this._createEncoderBuffer(hn)};function si(ai){return ai<10?"0"+ai:ai}ri.prototype._encodeTime=function(ti,hi){var ci,ui=new Date(ti);return hi==="gentime"?ci=[si(ui.getFullYear()),si(ui.getUTCMonth()+1),si(ui.getUTCDate()),si(ui.getUTCHours()),si(ui.getUTCMinutes()),si(ui.getUTCSeconds()),"Z"].join(""):hi==="utctime"?ci=[si(ui.getFullYear()%100),si(ui.getUTCMonth()+1),si(ui.getUTCDate()),si(ui.getUTCHours()),si(ui.getUTCMinutes()),si(ui.getUTCSeconds()),"Z"].join(""):this.reporter.error("Encoding "+hi+" time is not supported yet"),this._encodeStr(ci,"octstr")},ri.prototype._encodeNull=function(){return this._createEncoderBuffer("")},ri.prototype._encodeInt=function(ti,hi){if(typeof ti=="string"){if(!hi)return this.reporter.error("String int or enum given, but no values map");if(!hi.hasOwnProperty(ti))return this.reporter.error("Values map doesn't contain: "+JSON.stringify(ti));ti=hi[ti]}if(typeof ti!="number"&&!e.isBuffer(ti)){var ci=ti.toArray();!ti.sign&&ci[0]&128&&ci.unshift(0),ti=new e(ci)}if(e.isBuffer(ti)){var ui=ti.length;ti.length===0&&ui++;var mi=new e(ui);return ti.copy(mi),ti.length===0&&(mi[0]=0),this._createEncoderBuffer(mi)}if(ti<128)return this._createEncoderBuffer(ti);if(ti<256)return this._createEncoderBuffer([0,ti]);for(var ui=1,li=ti;li>=256;li>>=8)ui++;for(var mi=new Array(ui),li=mi.length-1;li>=0;li--)mi[li]=ti&255,ti>>=8;return mi[0]&128&&mi.unshift(0),this._createEncoderBuffer(new e(mi))},ri.prototype._encodeBool=function(ti){return this._createEncoderBuffer(ti?255:0)},ri.prototype._use=function(ti,hi){return typeof ti=="function"&&(ti=ti(hi)),ti._getEncoder("der").tree},ri.prototype._skipDefault=function(ti,hi,ci){var ui=this._baseState,li;if(ui.default===null)return!1;var mi=ti.join();if(ui.defaultBuffer===void 0&&(ui.defaultBuffer=this._encodeValue(ui.default,hi,ci).join()),mi.length!==ui.defaultBuffer.length)return!1;for(li=0;li=31?ci.error("Multi-octet tag encoding unsupported"):(ti||(ui|=32),ui|=Ne.tagClassByName[hi||"universal"]<<6,ui)}return der_1}var pem,hasRequiredPem;function requirePem(){if(hasRequiredPem)return pem;hasRequiredPem=1;var G=inherits_browserExports,e=requireDer();function H(Y){e.call(this,Y),this.enc="pem"}return G(H,e),pem=H,H.prototype.encode=function(Ne,W){for(var ri=e.prototype.encode.call(this,Ne),si=ri.toString("base64"),fi=["-----BEGIN "+W.label+"-----"],ai=0;ai0&&gn.ishrn(cn),gn}function li(ln,fn){ln=ui(ln,fn),ln=ln.mod(fn);var gn=G.from(ln.toArray());if(gn.length=0)throw new Error("invalid sig")}return verify_1=W,verify_1}var browser$5,hasRequiredBrowser$3;function requireBrowser$3(){if(hasRequiredBrowser$3)return browser$5;hasRequiredBrowser$3=1;var G=safeBufferExports.Buffer,e=requireBrowser$9(),H=requireReadableBrowser(),Y=inherits_browserExports,Ne=requireSign(),W=requireVerify(),ri=require$$6;Object.keys(ri).forEach(function(hi){ri[hi].id=G.from(ri[hi].id,"hex"),ri[hi.toLowerCase()]=ri[hi]});function si(hi){H.Writable.call(this);var ci=ri[hi];if(!ci)throw new Error("Unknown message digest");this._hashType=ci.hash,this._hash=e(ci.hash),this._tag=ci.id,this._signType=ci.sign}Y(si,H.Writable),si.prototype._write=function(ci,ui,li){this._hash.update(ci),li()},si.prototype.update=function(ci,ui){return this._hash.update(typeof ci=="string"?G.from(ci,ui):ci),this},si.prototype.sign=function(ci,ui){this.end();var li=this._hash.digest(),mi=Ne(li,ci,this._hashType,this._signType,this._tag);return ui?mi.toString(ui):mi};function fi(hi){H.Writable.call(this);var ci=ri[hi];if(!ci)throw new Error("Unknown message digest");this._hash=e(ci.hash),this._tag=ci.id,this._signType=ci.sign}Y(fi,H.Writable),fi.prototype._write=function(ci,ui,li){this._hash.update(ci),li()},fi.prototype.update=function(ci,ui){return this._hash.update(typeof ci=="string"?G.from(ci,ui):ci),this},fi.prototype.verify=function(ci,ui,li){var mi=typeof ui=="string"?G.from(ui,li):ui;this.end();var hn=this._hash.digest();return W(mi,hn,ci,this._signType,this._tag)};function ai(hi){return new si(hi)}function ti(hi){return new fi(hi)}return browser$5={Sign:ai,Verify:ti,createSign:ai,createVerify:ti},browser$5}var bn$2={exports:{}};bn$2.exports;var hasRequiredBn$1;function requireBn$1(){return hasRequiredBn$1||(hasRequiredBn$1=1,function(G){(function(e,H){function Y(oi,t){if(!oi)throw new Error(t||"Assertion failed")}function Ne(oi,t){oi.super_=t;var F=function(){};F.prototype=t.prototype,oi.prototype=new F,oi.prototype.constructor=oi}function W(oi,t,F){if(W.isBN(oi))return oi;this.negative=0,this.words=null,this.length=0,this.red=null,oi!==null&&((t==="le"||t==="be")&&(F=t,t=10),this._init(oi||0,t||10,F||"be"))}typeof e=="object"?e.exports=W:H.BN=W,W.BN=W,W.wordSize=26;var ri;try{typeof window<"u"&&typeof window.Buffer<"u"?ri=window.Buffer:ri=require$$0$3.Buffer}catch{}W.isBN=function(t){return t instanceof W?!0:t!==null&&typeof t=="object"&&t.constructor.wordSize===W.wordSize&&Array.isArray(t.words)},W.max=function(t,F){return t.cmp(F)>0?t:F},W.min=function(t,F){return t.cmp(F)<0?t:F},W.prototype._init=function(t,F,Ie){if(typeof t=="number")return this._initNumber(t,F,Ie);if(typeof t=="object")return this._initArray(t,F,Ie);F==="hex"&&(F=16),Y(F===(F|0)&&F>=2&&F<=36),t=t.toString().replace(/\s+/g,"");var Te=0;t[0]==="-"&&(Te++,this.negative=1),Te=0;Te-=3)ei=t[Te]|t[Te-1]<<8|t[Te-2]<<16,this.words[Xr]|=ei<>>26-ii&67108863,ii+=24,ii>=26&&(ii-=26,Xr++);else if(Ie==="le")for(Te=0,Xr=0;Te>>26-ii&67108863,ii+=24,ii>=26&&(ii-=26,Xr++);return this.strip()};function si(oi,t){var F=oi.charCodeAt(t);return F>=65&&F<=70?F-55:F>=97&&F<=102?F-87:F-48&15}function fi(oi,t,F){var Ie=si(oi,F);return F-1>=t&&(Ie|=si(oi,F-1)<<4),Ie}W.prototype._parseHex=function(t,F,Ie){this.length=Math.ceil((t.length-F)/6),this.words=new Array(this.length);for(var Te=0;Te=F;Te-=2)ii=fi(t,F,Te)<=18?(Xr-=18,ei+=1,this.words[ei]|=ii>>>26):Xr+=8;else{var Wr=t.length-F;for(Te=Wr%2===0?F+1:F;Te=18?(Xr-=18,ei+=1,this.words[ei]|=ii>>>26):Xr+=8}this.strip()};function ai(oi,t,F,Ie){for(var Te=0,Xr=Math.min(oi.length,F),ei=t;ei=49?Te+=ii-49+10:ii>=17?Te+=ii-17+10:Te+=ii}return Te}W.prototype._parseBase=function(t,F,Ie){this.words=[0],this.length=1;for(var Te=0,Xr=1;Xr<=67108863;Xr*=F)Te++;Te--,Xr=Xr/F|0;for(var ei=t.length-Ie,ii=ei%Te,Wr=Math.min(ei,ei-ii)+Ie,R=0,Le=Ie;Le1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},W.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},W.prototype.inspect=function(){return(this.red?""};var ti=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],hi=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],ci=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];W.prototype.toString=function(t,F){t=t||10,F=F|0||1;var Ie;if(t===16||t==="hex"){Ie="";for(var Te=0,Xr=0,ei=0;ei>>24-Te&16777215,Xr!==0||ei!==this.length-1?Ie=ti[6-Wr.length]+Wr+Ie:Ie=Wr+Ie,Te+=2,Te>=26&&(Te-=26,ei--)}for(Xr!==0&&(Ie=Xr.toString(16)+Ie);Ie.length%F!==0;)Ie="0"+Ie;return this.negative!==0&&(Ie="-"+Ie),Ie}if(t===(t|0)&&t>=2&&t<=36){var R=hi[t],Le=ci[t];Ie="";var nn=this.clone();for(nn.negative=0;!nn.isZero();){var vn=nn.modn(Le).toString(t);nn=nn.idivn(Le),nn.isZero()?Ie=vn+Ie:Ie=ti[R-vn.length]+vn+Ie}for(this.isZero()&&(Ie="0"+Ie);Ie.length%F!==0;)Ie="0"+Ie;return this.negative!==0&&(Ie="-"+Ie),Ie}Y(!1,"Base should be between 2 and 36")},W.prototype.toNumber=function(){var t=this.words[0];return this.length===2?t+=this.words[1]*67108864:this.length===3&&this.words[2]===1?t+=4503599627370496+this.words[1]*67108864:this.length>2&&Y(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-t:t},W.prototype.toJSON=function(){return this.toString(16)},W.prototype.toBuffer=function(t,F){return Y(typeof ri<"u"),this.toArrayLike(ri,t,F)},W.prototype.toArray=function(t,F){return this.toArrayLike(Array,t,F)},W.prototype.toArrayLike=function(t,F,Ie){var Te=this.byteLength(),Xr=Ie||Math.max(1,Te);Y(Te<=Xr,"byte array longer than desired length"),Y(Xr>0,"Requested array length <= 0"),this.strip();var ei=F==="le",ii=new t(Xr),Wr,R,Le=this.clone();if(ei){for(R=0;!Le.isZero();R++)Wr=Le.andln(255),Le.iushrn(8),ii[R]=Wr;for(;R=4096&&(Ie+=13,F>>>=13),F>=64&&(Ie+=7,F>>>=7),F>=8&&(Ie+=4,F>>>=4),F>=2&&(Ie+=2,F>>>=2),Ie+F},W.prototype._zeroBits=function(t){if(t===0)return 26;var F=t,Ie=0;return F&8191||(Ie+=13,F>>>=13),F&127||(Ie+=7,F>>>=7),F&15||(Ie+=4,F>>>=4),F&3||(Ie+=2,F>>>=2),F&1||Ie++,Ie},W.prototype.bitLength=function(){var t=this.words[this.length-1],F=this._countBits(t);return(this.length-1)*26+F};function ui(oi){for(var t=new Array(oi.bitLength()),F=0;F>>Te}return t}W.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,F=0;Ft.length?this.clone().ior(t):t.clone().ior(this)},W.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},W.prototype.iuand=function(t){var F;this.length>t.length?F=t:F=this;for(var Ie=0;Iet.length?this.clone().iand(t):t.clone().iand(this)},W.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},W.prototype.iuxor=function(t){var F,Ie;this.length>t.length?(F=this,Ie=t):(F=t,Ie=this);for(var Te=0;Tet.length?this.clone().ixor(t):t.clone().ixor(this)},W.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},W.prototype.inotn=function(t){Y(typeof t=="number"&&t>=0);var F=Math.ceil(t/26)|0,Ie=t%26;this._expand(F),Ie>0&&F--;for(var Te=0;Te0&&(this.words[Te]=~this.words[Te]&67108863>>26-Ie),this.strip()},W.prototype.notn=function(t){return this.clone().inotn(t)},W.prototype.setn=function(t,F){Y(typeof t=="number"&&t>=0);var Ie=t/26|0,Te=t%26;return this._expand(Ie+1),F?this.words[Ie]=this.words[Ie]|1<t.length?(Ie=this,Te=t):(Ie=t,Te=this);for(var Xr=0,ei=0;ei>>26;for(;Xr!==0&&ei>>26;if(this.length=Ie.length,Xr!==0)this.words[this.length]=Xr,this.length++;else if(Ie!==this)for(;eit.length?this.clone().iadd(t):t.clone().iadd(this)},W.prototype.isub=function(t){if(t.negative!==0){t.negative=0;var F=this.iadd(t);return t.negative=1,F._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var Ie=this.cmp(t);if(Ie===0)return this.negative=0,this.length=1,this.words[0]=0,this;var Te,Xr;Ie>0?(Te=this,Xr=t):(Te=t,Xr=this);for(var ei=0,ii=0;ii>26,this.words[ii]=F&67108863;for(;ei!==0&&ii>26,this.words[ii]=F&67108863;if(ei===0&&ii>>26,nn=Wr&67108863,vn=Math.min(R,t.length-1),Mn=Math.max(0,R-oi.length+1);Mn<=vn;Mn++){var sn=R-Mn|0;Te=oi.words[sn]|0,Xr=t.words[Mn]|0,ei=Te*Xr+nn,Le+=ei/67108864|0,nn=ei&67108863}F.words[R]=nn|0,Wr=Le|0}return Wr!==0?F.words[R]=Wr|0:F.length--,F.strip()}var mi=function(t,F,Ie){var Te=t.words,Xr=F.words,ei=Ie.words,ii=0,Wr,R,Le,nn=Te[0]|0,vn=nn&8191,Mn=nn>>>13,sn=Te[1]|0,Zn=sn&8191,on=sn>>>13,pn=Te[2]|0,mn=pn&8191,$i=pn>>>13,ho=Te[3]|0,Do=ho&8191,To=ho>>>13,Oh=Te[4]|0,Fo=Oh&8191,Vo=Oh>>>13,Hh=Te[5]|0,Ah=Hh&8191,Qf=Hh>>>13,Gh=Te[6]|0,tf=Gh&8191,Ko=Gh>>>13,Kh=Te[7]|0,Lf=Kh&8191,Uo=Kh>>>13,Vh=Te[8]|0,jf=Vh&8191,Zo=Vh>>>13,Wh=Te[9]|0,vh=Wh&8191,Yo=Wh>>>13,Jh=Xr[0]|0,xh=Jh&8191,Vf=Jh>>>13,Zh=Xr[1]|0,Ch=Zh&8191,Eh=Zh>>>13,Lu=Xr[2]|0,Ph=Lu&8191,Sh=Lu>>>13,Uu=Xr[3]|0,Th=Uu&8191,gh=Uu>>>13,Xh=Xr[4]|0,Rh=Xh&8191,bh=Xh>>>13,au=Xr[5]|0,$h=au&8191,wh=au>>>13,qu=Xr[6]|0,Ih=qu&8191,_h=qu>>>13,uu=Xr[7]|0,Dh=uu&8191,yh=uu>>>13,Yh=Xr[8]|0,Bh=Yh&8191,Mh=Yh>>>13,Hu=Xr[9]|0,kh=Hu&8191,qh=Hu>>>13;Ie.negative=t.negative^F.negative,Ie.length=19,Wr=Math.imul(vn,xh),R=Math.imul(vn,Vf),R=R+Math.imul(Mn,xh)|0,Le=Math.imul(Mn,Vf);var Tu=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(Tu>>>26)|0,Tu&=67108863,Wr=Math.imul(Zn,xh),R=Math.imul(Zn,Vf),R=R+Math.imul(on,xh)|0,Le=Math.imul(on,Vf),Wr=Wr+Math.imul(vn,Ch)|0,R=R+Math.imul(vn,Eh)|0,R=R+Math.imul(Mn,Ch)|0,Le=Le+Math.imul(Mn,Eh)|0;var tc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(tc>>>26)|0,tc&=67108863,Wr=Math.imul(mn,xh),R=Math.imul(mn,Vf),R=R+Math.imul($i,xh)|0,Le=Math.imul($i,Vf),Wr=Wr+Math.imul(Zn,Ch)|0,R=R+Math.imul(Zn,Eh)|0,R=R+Math.imul(on,Ch)|0,Le=Le+Math.imul(on,Eh)|0,Wr=Wr+Math.imul(vn,Ph)|0,R=R+Math.imul(vn,Sh)|0,R=R+Math.imul(Mn,Ph)|0,Le=Le+Math.imul(Mn,Sh)|0;var rc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(rc>>>26)|0,rc&=67108863,Wr=Math.imul(Do,xh),R=Math.imul(Do,Vf),R=R+Math.imul(To,xh)|0,Le=Math.imul(To,Vf),Wr=Wr+Math.imul(mn,Ch)|0,R=R+Math.imul(mn,Eh)|0,R=R+Math.imul($i,Ch)|0,Le=Le+Math.imul($i,Eh)|0,Wr=Wr+Math.imul(Zn,Ph)|0,R=R+Math.imul(Zn,Sh)|0,R=R+Math.imul(on,Ph)|0,Le=Le+Math.imul(on,Sh)|0,Wr=Wr+Math.imul(vn,Th)|0,R=R+Math.imul(vn,gh)|0,R=R+Math.imul(Mn,Th)|0,Le=Le+Math.imul(Mn,gh)|0;var ic=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(ic>>>26)|0,ic&=67108863,Wr=Math.imul(Fo,xh),R=Math.imul(Fo,Vf),R=R+Math.imul(Vo,xh)|0,Le=Math.imul(Vo,Vf),Wr=Wr+Math.imul(Do,Ch)|0,R=R+Math.imul(Do,Eh)|0,R=R+Math.imul(To,Ch)|0,Le=Le+Math.imul(To,Eh)|0,Wr=Wr+Math.imul(mn,Ph)|0,R=R+Math.imul(mn,Sh)|0,R=R+Math.imul($i,Ph)|0,Le=Le+Math.imul($i,Sh)|0,Wr=Wr+Math.imul(Zn,Th)|0,R=R+Math.imul(Zn,gh)|0,R=R+Math.imul(on,Th)|0,Le=Le+Math.imul(on,gh)|0,Wr=Wr+Math.imul(vn,Rh)|0,R=R+Math.imul(vn,bh)|0,R=R+Math.imul(Mn,Rh)|0,Le=Le+Math.imul(Mn,bh)|0;var nc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(nc>>>26)|0,nc&=67108863,Wr=Math.imul(Ah,xh),R=Math.imul(Ah,Vf),R=R+Math.imul(Qf,xh)|0,Le=Math.imul(Qf,Vf),Wr=Wr+Math.imul(Fo,Ch)|0,R=R+Math.imul(Fo,Eh)|0,R=R+Math.imul(Vo,Ch)|0,Le=Le+Math.imul(Vo,Eh)|0,Wr=Wr+Math.imul(Do,Ph)|0,R=R+Math.imul(Do,Sh)|0,R=R+Math.imul(To,Ph)|0,Le=Le+Math.imul(To,Sh)|0,Wr=Wr+Math.imul(mn,Th)|0,R=R+Math.imul(mn,gh)|0,R=R+Math.imul($i,Th)|0,Le=Le+Math.imul($i,gh)|0,Wr=Wr+Math.imul(Zn,Rh)|0,R=R+Math.imul(Zn,bh)|0,R=R+Math.imul(on,Rh)|0,Le=Le+Math.imul(on,bh)|0,Wr=Wr+Math.imul(vn,$h)|0,R=R+Math.imul(vn,wh)|0,R=R+Math.imul(Mn,$h)|0,Le=Le+Math.imul(Mn,wh)|0;var sc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(sc>>>26)|0,sc&=67108863,Wr=Math.imul(tf,xh),R=Math.imul(tf,Vf),R=R+Math.imul(Ko,xh)|0,Le=Math.imul(Ko,Vf),Wr=Wr+Math.imul(Ah,Ch)|0,R=R+Math.imul(Ah,Eh)|0,R=R+Math.imul(Qf,Ch)|0,Le=Le+Math.imul(Qf,Eh)|0,Wr=Wr+Math.imul(Fo,Ph)|0,R=R+Math.imul(Fo,Sh)|0,R=R+Math.imul(Vo,Ph)|0,Le=Le+Math.imul(Vo,Sh)|0,Wr=Wr+Math.imul(Do,Th)|0,R=R+Math.imul(Do,gh)|0,R=R+Math.imul(To,Th)|0,Le=Le+Math.imul(To,gh)|0,Wr=Wr+Math.imul(mn,Rh)|0,R=R+Math.imul(mn,bh)|0,R=R+Math.imul($i,Rh)|0,Le=Le+Math.imul($i,bh)|0,Wr=Wr+Math.imul(Zn,$h)|0,R=R+Math.imul(Zn,wh)|0,R=R+Math.imul(on,$h)|0,Le=Le+Math.imul(on,wh)|0,Wr=Wr+Math.imul(vn,Ih)|0,R=R+Math.imul(vn,_h)|0,R=R+Math.imul(Mn,Ih)|0,Le=Le+Math.imul(Mn,_h)|0;var s0=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(s0>>>26)|0,s0&=67108863,Wr=Math.imul(Lf,xh),R=Math.imul(Lf,Vf),R=R+Math.imul(Uo,xh)|0,Le=Math.imul(Uo,Vf),Wr=Wr+Math.imul(tf,Ch)|0,R=R+Math.imul(tf,Eh)|0,R=R+Math.imul(Ko,Ch)|0,Le=Le+Math.imul(Ko,Eh)|0,Wr=Wr+Math.imul(Ah,Ph)|0,R=R+Math.imul(Ah,Sh)|0,R=R+Math.imul(Qf,Ph)|0,Le=Le+Math.imul(Qf,Sh)|0,Wr=Wr+Math.imul(Fo,Th)|0,R=R+Math.imul(Fo,gh)|0,R=R+Math.imul(Vo,Th)|0,Le=Le+Math.imul(Vo,gh)|0,Wr=Wr+Math.imul(Do,Rh)|0,R=R+Math.imul(Do,bh)|0,R=R+Math.imul(To,Rh)|0,Le=Le+Math.imul(To,bh)|0,Wr=Wr+Math.imul(mn,$h)|0,R=R+Math.imul(mn,wh)|0,R=R+Math.imul($i,$h)|0,Le=Le+Math.imul($i,wh)|0,Wr=Wr+Math.imul(Zn,Ih)|0,R=R+Math.imul(Zn,_h)|0,R=R+Math.imul(on,Ih)|0,Le=Le+Math.imul(on,_h)|0,Wr=Wr+Math.imul(vn,Dh)|0,R=R+Math.imul(vn,yh)|0,R=R+Math.imul(Mn,Dh)|0,Le=Le+Math.imul(Mn,yh)|0;var hc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(hc>>>26)|0,hc&=67108863,Wr=Math.imul(jf,xh),R=Math.imul(jf,Vf),R=R+Math.imul(Zo,xh)|0,Le=Math.imul(Zo,Vf),Wr=Wr+Math.imul(Lf,Ch)|0,R=R+Math.imul(Lf,Eh)|0,R=R+Math.imul(Uo,Ch)|0,Le=Le+Math.imul(Uo,Eh)|0,Wr=Wr+Math.imul(tf,Ph)|0,R=R+Math.imul(tf,Sh)|0,R=R+Math.imul(Ko,Ph)|0,Le=Le+Math.imul(Ko,Sh)|0,Wr=Wr+Math.imul(Ah,Th)|0,R=R+Math.imul(Ah,gh)|0,R=R+Math.imul(Qf,Th)|0,Le=Le+Math.imul(Qf,gh)|0,Wr=Wr+Math.imul(Fo,Rh)|0,R=R+Math.imul(Fo,bh)|0,R=R+Math.imul(Vo,Rh)|0,Le=Le+Math.imul(Vo,bh)|0,Wr=Wr+Math.imul(Do,$h)|0,R=R+Math.imul(Do,wh)|0,R=R+Math.imul(To,$h)|0,Le=Le+Math.imul(To,wh)|0,Wr=Wr+Math.imul(mn,Ih)|0,R=R+Math.imul(mn,_h)|0,R=R+Math.imul($i,Ih)|0,Le=Le+Math.imul($i,_h)|0,Wr=Wr+Math.imul(Zn,Dh)|0,R=R+Math.imul(Zn,yh)|0,R=R+Math.imul(on,Dh)|0,Le=Le+Math.imul(on,yh)|0,Wr=Wr+Math.imul(vn,Bh)|0,R=R+Math.imul(vn,Mh)|0,R=R+Math.imul(Mn,Bh)|0,Le=Le+Math.imul(Mn,Mh)|0;var pc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(pc>>>26)|0,pc&=67108863,Wr=Math.imul(vh,xh),R=Math.imul(vh,Vf),R=R+Math.imul(Yo,xh)|0,Le=Math.imul(Yo,Vf),Wr=Wr+Math.imul(jf,Ch)|0,R=R+Math.imul(jf,Eh)|0,R=R+Math.imul(Zo,Ch)|0,Le=Le+Math.imul(Zo,Eh)|0,Wr=Wr+Math.imul(Lf,Ph)|0,R=R+Math.imul(Lf,Sh)|0,R=R+Math.imul(Uo,Ph)|0,Le=Le+Math.imul(Uo,Sh)|0,Wr=Wr+Math.imul(tf,Th)|0,R=R+Math.imul(tf,gh)|0,R=R+Math.imul(Ko,Th)|0,Le=Le+Math.imul(Ko,gh)|0,Wr=Wr+Math.imul(Ah,Rh)|0,R=R+Math.imul(Ah,bh)|0,R=R+Math.imul(Qf,Rh)|0,Le=Le+Math.imul(Qf,bh)|0,Wr=Wr+Math.imul(Fo,$h)|0,R=R+Math.imul(Fo,wh)|0,R=R+Math.imul(Vo,$h)|0,Le=Le+Math.imul(Vo,wh)|0,Wr=Wr+Math.imul(Do,Ih)|0,R=R+Math.imul(Do,_h)|0,R=R+Math.imul(To,Ih)|0,Le=Le+Math.imul(To,_h)|0,Wr=Wr+Math.imul(mn,Dh)|0,R=R+Math.imul(mn,yh)|0,R=R+Math.imul($i,Dh)|0,Le=Le+Math.imul($i,yh)|0,Wr=Wr+Math.imul(Zn,Bh)|0,R=R+Math.imul(Zn,Mh)|0,R=R+Math.imul(on,Bh)|0,Le=Le+Math.imul(on,Mh)|0,Wr=Wr+Math.imul(vn,kh)|0,R=R+Math.imul(vn,qh)|0,R=R+Math.imul(Mn,kh)|0,Le=Le+Math.imul(Mn,qh)|0;var uc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(uc>>>26)|0,uc&=67108863,Wr=Math.imul(vh,Ch),R=Math.imul(vh,Eh),R=R+Math.imul(Yo,Ch)|0,Le=Math.imul(Yo,Eh),Wr=Wr+Math.imul(jf,Ph)|0,R=R+Math.imul(jf,Sh)|0,R=R+Math.imul(Zo,Ph)|0,Le=Le+Math.imul(Zo,Sh)|0,Wr=Wr+Math.imul(Lf,Th)|0,R=R+Math.imul(Lf,gh)|0,R=R+Math.imul(Uo,Th)|0,Le=Le+Math.imul(Uo,gh)|0,Wr=Wr+Math.imul(tf,Rh)|0,R=R+Math.imul(tf,bh)|0,R=R+Math.imul(Ko,Rh)|0,Le=Le+Math.imul(Ko,bh)|0,Wr=Wr+Math.imul(Ah,$h)|0,R=R+Math.imul(Ah,wh)|0,R=R+Math.imul(Qf,$h)|0,Le=Le+Math.imul(Qf,wh)|0,Wr=Wr+Math.imul(Fo,Ih)|0,R=R+Math.imul(Fo,_h)|0,R=R+Math.imul(Vo,Ih)|0,Le=Le+Math.imul(Vo,_h)|0,Wr=Wr+Math.imul(Do,Dh)|0,R=R+Math.imul(Do,yh)|0,R=R+Math.imul(To,Dh)|0,Le=Le+Math.imul(To,yh)|0,Wr=Wr+Math.imul(mn,Bh)|0,R=R+Math.imul(mn,Mh)|0,R=R+Math.imul($i,Bh)|0,Le=Le+Math.imul($i,Mh)|0,Wr=Wr+Math.imul(Zn,kh)|0,R=R+Math.imul(Zn,qh)|0,R=R+Math.imul(on,kh)|0,Le=Le+Math.imul(on,qh)|0;var vc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(vc>>>26)|0,vc&=67108863,Wr=Math.imul(vh,Ph),R=Math.imul(vh,Sh),R=R+Math.imul(Yo,Ph)|0,Le=Math.imul(Yo,Sh),Wr=Wr+Math.imul(jf,Th)|0,R=R+Math.imul(jf,gh)|0,R=R+Math.imul(Zo,Th)|0,Le=Le+Math.imul(Zo,gh)|0,Wr=Wr+Math.imul(Lf,Rh)|0,R=R+Math.imul(Lf,bh)|0,R=R+Math.imul(Uo,Rh)|0,Le=Le+Math.imul(Uo,bh)|0,Wr=Wr+Math.imul(tf,$h)|0,R=R+Math.imul(tf,wh)|0,R=R+Math.imul(Ko,$h)|0,Le=Le+Math.imul(Ko,wh)|0,Wr=Wr+Math.imul(Ah,Ih)|0,R=R+Math.imul(Ah,_h)|0,R=R+Math.imul(Qf,Ih)|0,Le=Le+Math.imul(Qf,_h)|0,Wr=Wr+Math.imul(Fo,Dh)|0,R=R+Math.imul(Fo,yh)|0,R=R+Math.imul(Vo,Dh)|0,Le=Le+Math.imul(Vo,yh)|0,Wr=Wr+Math.imul(Do,Bh)|0,R=R+Math.imul(Do,Mh)|0,R=R+Math.imul(To,Bh)|0,Le=Le+Math.imul(To,Mh)|0,Wr=Wr+Math.imul(mn,kh)|0,R=R+Math.imul(mn,qh)|0,R=R+Math.imul($i,kh)|0,Le=Le+Math.imul($i,qh)|0;var mc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(mc>>>26)|0,mc&=67108863,Wr=Math.imul(vh,Th),R=Math.imul(vh,gh),R=R+Math.imul(Yo,Th)|0,Le=Math.imul(Yo,gh),Wr=Wr+Math.imul(jf,Rh)|0,R=R+Math.imul(jf,bh)|0,R=R+Math.imul(Zo,Rh)|0,Le=Le+Math.imul(Zo,bh)|0,Wr=Wr+Math.imul(Lf,$h)|0,R=R+Math.imul(Lf,wh)|0,R=R+Math.imul(Uo,$h)|0,Le=Le+Math.imul(Uo,wh)|0,Wr=Wr+Math.imul(tf,Ih)|0,R=R+Math.imul(tf,_h)|0,R=R+Math.imul(Ko,Ih)|0,Le=Le+Math.imul(Ko,_h)|0,Wr=Wr+Math.imul(Ah,Dh)|0,R=R+Math.imul(Ah,yh)|0,R=R+Math.imul(Qf,Dh)|0,Le=Le+Math.imul(Qf,yh)|0,Wr=Wr+Math.imul(Fo,Bh)|0,R=R+Math.imul(Fo,Mh)|0,R=R+Math.imul(Vo,Bh)|0,Le=Le+Math.imul(Vo,Mh)|0,Wr=Wr+Math.imul(Do,kh)|0,R=R+Math.imul(Do,qh)|0,R=R+Math.imul(To,kh)|0,Le=Le+Math.imul(To,qh)|0;var cc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(cc>>>26)|0,cc&=67108863,Wr=Math.imul(vh,Rh),R=Math.imul(vh,bh),R=R+Math.imul(Yo,Rh)|0,Le=Math.imul(Yo,bh),Wr=Wr+Math.imul(jf,$h)|0,R=R+Math.imul(jf,wh)|0,R=R+Math.imul(Zo,$h)|0,Le=Le+Math.imul(Zo,wh)|0,Wr=Wr+Math.imul(Lf,Ih)|0,R=R+Math.imul(Lf,_h)|0,R=R+Math.imul(Uo,Ih)|0,Le=Le+Math.imul(Uo,_h)|0,Wr=Wr+Math.imul(tf,Dh)|0,R=R+Math.imul(tf,yh)|0,R=R+Math.imul(Ko,Dh)|0,Le=Le+Math.imul(Ko,yh)|0,Wr=Wr+Math.imul(Ah,Bh)|0,R=R+Math.imul(Ah,Mh)|0,R=R+Math.imul(Qf,Bh)|0,Le=Le+Math.imul(Qf,Mh)|0,Wr=Wr+Math.imul(Fo,kh)|0,R=R+Math.imul(Fo,qh)|0,R=R+Math.imul(Vo,kh)|0,Le=Le+Math.imul(Vo,qh)|0;var lc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(lc>>>26)|0,lc&=67108863,Wr=Math.imul(vh,$h),R=Math.imul(vh,wh),R=R+Math.imul(Yo,$h)|0,Le=Math.imul(Yo,wh),Wr=Wr+Math.imul(jf,Ih)|0,R=R+Math.imul(jf,_h)|0,R=R+Math.imul(Zo,Ih)|0,Le=Le+Math.imul(Zo,_h)|0,Wr=Wr+Math.imul(Lf,Dh)|0,R=R+Math.imul(Lf,yh)|0,R=R+Math.imul(Uo,Dh)|0,Le=Le+Math.imul(Uo,yh)|0,Wr=Wr+Math.imul(tf,Bh)|0,R=R+Math.imul(tf,Mh)|0,R=R+Math.imul(Ko,Bh)|0,Le=Le+Math.imul(Ko,Mh)|0,Wr=Wr+Math.imul(Ah,kh)|0,R=R+Math.imul(Ah,qh)|0,R=R+Math.imul(Qf,kh)|0,Le=Le+Math.imul(Qf,qh)|0;var dc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(dc>>>26)|0,dc&=67108863,Wr=Math.imul(vh,Ih),R=Math.imul(vh,_h),R=R+Math.imul(Yo,Ih)|0,Le=Math.imul(Yo,_h),Wr=Wr+Math.imul(jf,Dh)|0,R=R+Math.imul(jf,yh)|0,R=R+Math.imul(Zo,Dh)|0,Le=Le+Math.imul(Zo,yh)|0,Wr=Wr+Math.imul(Lf,Bh)|0,R=R+Math.imul(Lf,Mh)|0,R=R+Math.imul(Uo,Bh)|0,Le=Le+Math.imul(Uo,Mh)|0,Wr=Wr+Math.imul(tf,kh)|0,R=R+Math.imul(tf,qh)|0,R=R+Math.imul(Ko,kh)|0,Le=Le+Math.imul(Ko,qh)|0;var $0=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+($0>>>26)|0,$0&=67108863,Wr=Math.imul(vh,Dh),R=Math.imul(vh,yh),R=R+Math.imul(Yo,Dh)|0,Le=Math.imul(Yo,yh),Wr=Wr+Math.imul(jf,Bh)|0,R=R+Math.imul(jf,Mh)|0,R=R+Math.imul(Zo,Bh)|0,Le=Le+Math.imul(Zo,Mh)|0,Wr=Wr+Math.imul(Lf,kh)|0,R=R+Math.imul(Lf,qh)|0,R=R+Math.imul(Uo,kh)|0,Le=Le+Math.imul(Uo,qh)|0;var gc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(gc>>>26)|0,gc&=67108863,Wr=Math.imul(vh,Bh),R=Math.imul(vh,Mh),R=R+Math.imul(Yo,Bh)|0,Le=Math.imul(Yo,Mh),Wr=Wr+Math.imul(jf,kh)|0,R=R+Math.imul(jf,qh)|0,R=R+Math.imul(Zo,kh)|0,Le=Le+Math.imul(Zo,qh)|0;var bc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(bc>>>26)|0,bc&=67108863,Wr=Math.imul(vh,kh),R=Math.imul(vh,qh),R=R+Math.imul(Yo,kh)|0,Le=Math.imul(Yo,qh);var yc=(ii+Wr|0)+((R&8191)<<13)|0;return ii=(Le+(R>>>13)|0)+(yc>>>26)|0,yc&=67108863,ei[0]=Tu,ei[1]=tc,ei[2]=rc,ei[3]=ic,ei[4]=nc,ei[5]=sc,ei[6]=s0,ei[7]=hc,ei[8]=pc,ei[9]=uc,ei[10]=vc,ei[11]=mc,ei[12]=cc,ei[13]=lc,ei[14]=dc,ei[15]=$0,ei[16]=gc,ei[17]=bc,ei[18]=yc,ii!==0&&(ei[19]=ii,Ie.length++),Ie};Math.imul||(mi=li);function hn(oi,t,F){F.negative=t.negative^oi.negative,F.length=oi.length+t.length;for(var Ie=0,Te=0,Xr=0;Xr>>26)|0,Te+=ei>>>26,ei&=67108863}F.words[Xr]=ii,Ie=ei,ei=Te}return Ie!==0?F.words[Xr]=Ie:F.length--,F.strip()}function ln(oi,t,F){var Ie=new fn;return Ie.mulp(oi,t,F)}W.prototype.mulTo=function(t,F){var Ie,Te=this.length+t.length;return this.length===10&&t.length===10?Ie=mi(this,t,F):Te<63?Ie=li(this,t,F):Te<1024?Ie=hn(this,t,F):Ie=ln(this,t,F),Ie};function fn(oi,t){this.x=oi,this.y=t}fn.prototype.makeRBT=function(t){for(var F=new Array(t),Ie=W.prototype._countBits(t)-1,Te=0;Te>=1;return Te},fn.prototype.permute=function(t,F,Ie,Te,Xr,ei){for(var ii=0;ii>>1)Xr++;return 1<>>13,Ie[2*ei+1]=Xr&8191,Xr=Xr>>>13;for(ei=2*F;ei>=26,F+=Te/67108864|0,F+=Xr>>>26,this.words[Ie]=Xr&67108863}return F!==0&&(this.words[Ie]=F,this.length++),this},W.prototype.muln=function(t){return this.clone().imuln(t)},W.prototype.sqr=function(){return this.mul(this)},W.prototype.isqr=function(){return this.imul(this.clone())},W.prototype.pow=function(t){var F=ui(t);if(F.length===0)return new W(1);for(var Ie=this,Te=0;Te=0);var F=t%26,Ie=(t-F)/26,Te=67108863>>>26-F<<26-F,Xr;if(F!==0){var ei=0;for(Xr=0;Xr>>26-F}ei&&(this.words[Xr]=ei,this.length++)}if(Ie!==0){for(Xr=this.length-1;Xr>=0;Xr--)this.words[Xr+Ie]=this.words[Xr];for(Xr=0;Xr=0);var Te;F?Te=(F-F%26)/26:Te=0;var Xr=t%26,ei=Math.min((t-Xr)/26,this.length),ii=67108863^67108863>>>Xr<ei)for(this.length-=ei,R=0;R=0&&(Le!==0||R>=Te);R--){var nn=this.words[R]|0;this.words[R]=Le<<26-Xr|nn>>>Xr,Le=nn&ii}return Wr&&Le!==0&&(Wr.words[Wr.length++]=Le),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},W.prototype.ishrn=function(t,F,Ie){return Y(this.negative===0),this.iushrn(t,F,Ie)},W.prototype.shln=function(t){return this.clone().ishln(t)},W.prototype.ushln=function(t){return this.clone().iushln(t)},W.prototype.shrn=function(t){return this.clone().ishrn(t)},W.prototype.ushrn=function(t){return this.clone().iushrn(t)},W.prototype.testn=function(t){Y(typeof t=="number"&&t>=0);var F=t%26,Ie=(t-F)/26,Te=1<=0);var F=t%26,Ie=(t-F)/26;if(Y(this.negative===0,"imaskn works only with positive numbers"),this.length<=Ie)return this;if(F!==0&&Ie++,this.length=Math.min(Ie,this.length),F!==0){var Te=67108863^67108863>>>F<=67108864;F++)this.words[F]-=67108864,F===this.length-1?this.words[F+1]=1:this.words[F+1]++;return this.length=Math.max(this.length,F+1),this},W.prototype.isubn=function(t){if(Y(typeof t=="number"),Y(t<67108864),t<0)return this.iaddn(-t);if(this.negative!==0)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var F=0;F>26)-(Wr/67108864|0),this.words[Xr+Ie]=ei&67108863}for(;Xr>26,this.words[Xr+Ie]=ei&67108863;if(ii===0)return this.strip();for(Y(ii===-1),ii=0,Xr=0;Xr>26,this.words[Xr]=ei&67108863;return this.negative=1,this.strip()},W.prototype._wordDiv=function(t,F){var Ie=this.length-t.length,Te=this.clone(),Xr=t,ei=Xr.words[Xr.length-1]|0,ii=this._countBits(ei);Ie=26-ii,Ie!==0&&(Xr=Xr.ushln(Ie),Te.iushln(Ie),ei=Xr.words[Xr.length-1]|0);var Wr=Te.length-Xr.length,R;if(F!=="mod"){R=new W(null),R.length=Wr+1,R.words=new Array(R.length);for(var Le=0;Le=0;vn--){var Mn=(Te.words[Xr.length+vn]|0)*67108864+(Te.words[Xr.length+vn-1]|0);for(Mn=Math.min(Mn/ei|0,67108863),Te._ishlnsubmul(Xr,Mn,vn);Te.negative!==0;)Mn--,Te.negative=0,Te._ishlnsubmul(Xr,1,vn),Te.isZero()||(Te.negative^=1);R&&(R.words[vn]=Mn)}return R&&R.strip(),Te.strip(),F!=="div"&&Ie!==0&&Te.iushrn(Ie),{div:R||null,mod:Te}},W.prototype.divmod=function(t,F,Ie){if(Y(!t.isZero()),this.isZero())return{div:new W(0),mod:new W(0)};var Te,Xr,ei;return this.negative!==0&&t.negative===0?(ei=this.neg().divmod(t,F),F!=="mod"&&(Te=ei.div.neg()),F!=="div"&&(Xr=ei.mod.neg(),Ie&&Xr.negative!==0&&Xr.iadd(t)),{div:Te,mod:Xr}):this.negative===0&&t.negative!==0?(ei=this.divmod(t.neg(),F),F!=="mod"&&(Te=ei.div.neg()),{div:Te,mod:ei.mod}):this.negative&t.negative?(ei=this.neg().divmod(t.neg(),F),F!=="div"&&(Xr=ei.mod.neg(),Ie&&Xr.negative!==0&&Xr.isub(t)),{div:ei.div,mod:Xr}):t.length>this.length||this.cmp(t)<0?{div:new W(0),mod:this}:t.length===1?F==="div"?{div:this.divn(t.words[0]),mod:null}:F==="mod"?{div:null,mod:new W(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new W(this.modn(t.words[0]))}:this._wordDiv(t,F)},W.prototype.div=function(t){return this.divmod(t,"div",!1).div},W.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},W.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},W.prototype.divRound=function(t){var F=this.divmod(t);if(F.mod.isZero())return F.div;var Ie=F.div.negative!==0?F.mod.isub(t):F.mod,Te=t.ushrn(1),Xr=t.andln(1),ei=Ie.cmp(Te);return ei<0||Xr===1&&ei===0?F.div:F.div.negative!==0?F.div.isubn(1):F.div.iaddn(1)},W.prototype.modn=function(t){Y(t<=67108863);for(var F=(1<<26)%t,Ie=0,Te=this.length-1;Te>=0;Te--)Ie=(F*Ie+(this.words[Te]|0))%t;return Ie},W.prototype.idivn=function(t){Y(t<=67108863);for(var F=0,Ie=this.length-1;Ie>=0;Ie--){var Te=(this.words[Ie]|0)+F*67108864;this.words[Ie]=Te/t|0,F=Te%t}return this.strip()},W.prototype.divn=function(t){return this.clone().idivn(t)},W.prototype.egcd=function(t){Y(t.negative===0),Y(!t.isZero());var F=this,Ie=t.clone();F.negative!==0?F=F.umod(t):F=F.clone();for(var Te=new W(1),Xr=new W(0),ei=new W(0),ii=new W(1),Wr=0;F.isEven()&&Ie.isEven();)F.iushrn(1),Ie.iushrn(1),++Wr;for(var R=Ie.clone(),Le=F.clone();!F.isZero();){for(var nn=0,vn=1;!(F.words[0]&vn)&&nn<26;++nn,vn<<=1);if(nn>0)for(F.iushrn(nn);nn-- >0;)(Te.isOdd()||Xr.isOdd())&&(Te.iadd(R),Xr.isub(Le)),Te.iushrn(1),Xr.iushrn(1);for(var Mn=0,sn=1;!(Ie.words[0]&sn)&&Mn<26;++Mn,sn<<=1);if(Mn>0)for(Ie.iushrn(Mn);Mn-- >0;)(ei.isOdd()||ii.isOdd())&&(ei.iadd(R),ii.isub(Le)),ei.iushrn(1),ii.iushrn(1);F.cmp(Ie)>=0?(F.isub(Ie),Te.isub(ei),Xr.isub(ii)):(Ie.isub(F),ei.isub(Te),ii.isub(Xr))}return{a:ei,b:ii,gcd:Ie.iushln(Wr)}},W.prototype._invmp=function(t){Y(t.negative===0),Y(!t.isZero());var F=this,Ie=t.clone();F.negative!==0?F=F.umod(t):F=F.clone();for(var Te=new W(1),Xr=new W(0),ei=Ie.clone();F.cmpn(1)>0&&Ie.cmpn(1)>0;){for(var ii=0,Wr=1;!(F.words[0]&Wr)&&ii<26;++ii,Wr<<=1);if(ii>0)for(F.iushrn(ii);ii-- >0;)Te.isOdd()&&Te.iadd(ei),Te.iushrn(1);for(var R=0,Le=1;!(Ie.words[0]&Le)&&R<26;++R,Le<<=1);if(R>0)for(Ie.iushrn(R);R-- >0;)Xr.isOdd()&&Xr.iadd(ei),Xr.iushrn(1);F.cmp(Ie)>=0?(F.isub(Ie),Te.isub(Xr)):(Ie.isub(F),Xr.isub(Te))}var nn;return F.cmpn(1)===0?nn=Te:nn=Xr,nn.cmpn(0)<0&&nn.iadd(t),nn},W.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var F=this.clone(),Ie=t.clone();F.negative=0,Ie.negative=0;for(var Te=0;F.isEven()&&Ie.isEven();Te++)F.iushrn(1),Ie.iushrn(1);do{for(;F.isEven();)F.iushrn(1);for(;Ie.isEven();)Ie.iushrn(1);var Xr=F.cmp(Ie);if(Xr<0){var ei=F;F=Ie,Ie=ei}else if(Xr===0||Ie.cmpn(1)===0)break;F.isub(Ie)}while(!0);return Ie.iushln(Te)},W.prototype.invm=function(t){return this.egcd(t).a.umod(t)},W.prototype.isEven=function(){return(this.words[0]&1)===0},W.prototype.isOdd=function(){return(this.words[0]&1)===1},W.prototype.andln=function(t){return this.words[0]&t},W.prototype.bincn=function(t){Y(typeof t=="number");var F=t%26,Ie=(t-F)/26,Te=1<>>26,ii&=67108863,this.words[ei]=ii}return Xr!==0&&(this.words[ei]=Xr,this.length++),this},W.prototype.isZero=function(){return this.length===1&&this.words[0]===0},W.prototype.cmpn=function(t){var F=t<0;if(this.negative!==0&&!F)return-1;if(this.negative===0&&F)return 1;this.strip();var Ie;if(this.length>1)Ie=1;else{F&&(t=-t),Y(t<=67108863,"Number is too big");var Te=this.words[0]|0;Ie=Te===t?0:Tet.length)return 1;if(this.length=0;Ie--){var Te=this.words[Ie]|0,Xr=t.words[Ie]|0;if(Te!==Xr){TeXr&&(F=1);break}}return F},W.prototype.gtn=function(t){return this.cmpn(t)===1},W.prototype.gt=function(t){return this.cmp(t)===1},W.prototype.gten=function(t){return this.cmpn(t)>=0},W.prototype.gte=function(t){return this.cmp(t)>=0},W.prototype.ltn=function(t){return this.cmpn(t)===-1},W.prototype.lt=function(t){return this.cmp(t)===-1},W.prototype.lten=function(t){return this.cmpn(t)<=0},W.prototype.lte=function(t){return this.cmp(t)<=0},W.prototype.eqn=function(t){return this.cmpn(t)===0},W.prototype.eq=function(t){return this.cmp(t)===0},W.red=function(t){return new Ya(t)},W.prototype.toRed=function(t){return Y(!this.red,"Already a number in reduction context"),Y(this.negative===0,"red works only with positives"),t.convertTo(this)._forceRed(t)},W.prototype.fromRed=function(){return Y(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},W.prototype._forceRed=function(t){return this.red=t,this},W.prototype.forceRed=function(t){return Y(!this.red,"Already a number in reduction context"),this._forceRed(t)},W.prototype.redAdd=function(t){return Y(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},W.prototype.redIAdd=function(t){return Y(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},W.prototype.redSub=function(t){return Y(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},W.prototype.redISub=function(t){return Y(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},W.prototype.redShl=function(t){return Y(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},W.prototype.redMul=function(t){return Y(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},W.prototype.redIMul=function(t){return Y(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},W.prototype.redSqr=function(){return Y(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},W.prototype.redISqr=function(){return Y(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},W.prototype.redSqrt=function(){return Y(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},W.prototype.redInvm=function(){return Y(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},W.prototype.redNeg=function(){return Y(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},W.prototype.redPow=function(t){return Y(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var gn={k256:null,p224:null,p192:null,p25519:null};function cn(oi,t){this.name=oi,this.p=new W(t,16),this.n=this.p.bitLength(),this.k=new W(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}cn.prototype._tmp=function(){var t=new W(null);return t.words=new Array(Math.ceil(this.n/13)),t},cn.prototype.ireduce=function(t){var F=t,Ie;do this.split(F,this.tmp),F=this.imulK(F),F=F.iadd(this.tmp),Ie=F.bitLength();while(Ie>this.n);var Te=Ie0?F.isub(this.p):F.strip!==void 0?F.strip():F._strip(),F},cn.prototype.split=function(t,F){t.iushrn(this.n,0,F)},cn.prototype.imulK=function(t){return t.imul(this.k)};function An(){cn.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}Ne(An,cn),An.prototype.split=function(t,F){for(var Ie=4194303,Te=Math.min(t.length,9),Xr=0;Xr>>22,ei=ii}ei>>>=22,t.words[Xr-10]=ei,ei===0&&t.length>10?t.length-=10:t.length-=9},An.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var F=0,Ie=0;Ie>>=26,t.words[Ie]=Xr,F=Te}return F!==0&&(t.words[t.length++]=F),t},W._prime=function(t){if(gn[t])return gn[t];var F;if(t==="k256")F=new An;else if(t==="p224")F=new Cn;else if(t==="p192")F=new an;else if(t==="p25519")F=new Rn;else throw new Error("Unknown prime "+t);return gn[t]=F,F};function Ya(oi){if(typeof oi=="string"){var t=W._prime(oi);this.m=t.p,this.prime=t}else Y(oi.gtn(1),"modulus must be greater than 1"),this.m=oi,this.prime=null}Ya.prototype._verify1=function(t){Y(t.negative===0,"red works only with positives"),Y(t.red,"red works only with red numbers")},Ya.prototype._verify2=function(t,F){Y((t.negative|F.negative)===0,"red works only with positives"),Y(t.red&&t.red===F.red,"red works only with red numbers")},Ya.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},Ya.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},Ya.prototype.add=function(t,F){this._verify2(t,F);var Ie=t.add(F);return Ie.cmp(this.m)>=0&&Ie.isub(this.m),Ie._forceRed(this)},Ya.prototype.iadd=function(t,F){this._verify2(t,F);var Ie=t.iadd(F);return Ie.cmp(this.m)>=0&&Ie.isub(this.m),Ie},Ya.prototype.sub=function(t,F){this._verify2(t,F);var Ie=t.sub(F);return Ie.cmpn(0)<0&&Ie.iadd(this.m),Ie._forceRed(this)},Ya.prototype.isub=function(t,F){this._verify2(t,F);var Ie=t.isub(F);return Ie.cmpn(0)<0&&Ie.iadd(this.m),Ie},Ya.prototype.shl=function(t,F){return this._verify1(t),this.imod(t.ushln(F))},Ya.prototype.imul=function(t,F){return this._verify2(t,F),this.imod(t.imul(F))},Ya.prototype.mul=function(t,F){return this._verify2(t,F),this.imod(t.mul(F))},Ya.prototype.isqr=function(t){return this.imul(t,t.clone())},Ya.prototype.sqr=function(t){return this.mul(t,t)},Ya.prototype.sqrt=function(t){if(t.isZero())return t.clone();var F=this.m.andln(3);if(Y(F%2===1),F===3){var Ie=this.m.add(new W(1)).iushrn(2);return this.pow(t,Ie)}for(var Te=this.m.subn(1),Xr=0;!Te.isZero()&&Te.andln(1)===0;)Xr++,Te.iushrn(1);Y(!Te.isZero());var ei=new W(1).toRed(this),ii=ei.redNeg(),Wr=this.m.subn(1).iushrn(1),R=this.m.bitLength();for(R=new W(2*R*R).toRed(this);this.pow(R,Wr).cmp(ii)!==0;)R.redIAdd(ii);for(var Le=this.pow(R,Te),nn=this.pow(t,Te.addn(1).iushrn(1)),vn=this.pow(t,Te),Mn=Xr;vn.cmp(ei)!==0;){for(var sn=vn,Zn=0;sn.cmp(ei)!==0;Zn++)sn=sn.redSqr();Y(Zn=0;Xr--){for(var Le=F.words[Xr],nn=R-1;nn>=0;nn--){var vn=Le>>nn&1;if(ei!==Te[0]&&(ei=this.sqr(ei)),vn===0&&ii===0){Wr=0;continue}ii<<=1,ii|=vn,Wr++,!(Wr!==Ie&&(Xr!==0||nn!==0))&&(ei=this.mul(ei,Te[ii]),Wr=0,ii=0)}R=26}return ei},Ya.prototype.convertTo=function(t){var F=t.umod(this.m);return F===t?F.clone():F},Ya.prototype.convertFrom=function(t){var F=t.clone();return F.red=null,F},W.mont=function(t){return new Ho(t)};function Ho(oi){Ya.call(this,oi),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new W(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}Ne(Ho,Ya),Ho.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},Ho.prototype.convertFrom=function(t){var F=this.imod(t.mul(this.rinv));return F.red=null,F},Ho.prototype.imul=function(t,F){if(t.isZero()||F.isZero())return t.words[0]=0,t.length=1,t;var Ie=t.imul(F),Te=Ie.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Xr=Ie.isub(Te).iushrn(this.shift),ei=Xr;return Xr.cmp(this.m)>=0?ei=Xr.isub(this.m):Xr.cmpn(0)<0&&(ei=Xr.iadd(this.m)),ei._forceRed(this)},Ho.prototype.mul=function(t,F){if(t.isZero()||F.isZero())return new W(0)._forceRed(this);var Ie=t.mul(F),Te=Ie.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Xr=Ie.isub(Te).iushrn(this.shift),ei=Xr;return Xr.cmp(this.m)>=0?ei=Xr.isub(this.m):Xr.cmpn(0)<0&&(ei=Xr.iadd(this.m)),ei._forceRed(this)},Ho.prototype.invm=function(t){var F=this.imod(t._invmp(this.m).mul(this.r2));return F._forceRed(this)}})(G,commonjsGlobal)}(bn$2)),bn$2.exports}var browser$4,hasRequiredBrowser$2;function requireBrowser$2(){if(hasRequiredBrowser$2)return browser$4;hasRequiredBrowser$2=1;var G=requireElliptic(),e=requireBn$1();browser$4=function(ri){return new Y(ri)};var H={secp256k1:{name:"secp256k1",byteLength:32},secp224r1:{name:"p224",byteLength:28},prime256v1:{name:"p256",byteLength:32},prime192v1:{name:"p192",byteLength:24},ed25519:{name:"ed25519",byteLength:32},secp384r1:{name:"p384",byteLength:48},secp521r1:{name:"p521",byteLength:66}};H.p224=H.secp224r1,H.p256=H.secp256r1=H.prime256v1,H.p192=H.secp192r1=H.prime192v1,H.p384=H.secp384r1,H.p521=H.secp521r1;function Y(W){this.curveType=H[W],this.curveType||(this.curveType={name:W}),this.curve=new G.ec(this.curveType.name),this.keys=void 0}Y.prototype.generateKeys=function(W,ri){return this.keys=this.curve.genKeyPair(),this.getPublicKey(W,ri)},Y.prototype.computeSecret=function(W,ri,si){ri=ri||"utf8",Buffer.isBuffer(W)||(W=new Buffer(W,ri));var fi=this.curve.keyFromPublic(W).getPublic(),ai=fi.mul(this.keys.getPrivate()).getX();return Ne(ai,si,this.curveType.byteLength)},Y.prototype.getPublicKey=function(W,ri){var si=this.keys.getPublic(ri==="compressed",!0);return ri==="hybrid"&&(si[si.length-1]%2?si[0]=7:si[0]=6),Ne(si,W)},Y.prototype.getPrivateKey=function(W){return Ne(this.keys.getPrivate(),W)},Y.prototype.setPublicKey=function(W,ri){return ri=ri||"utf8",Buffer.isBuffer(W)||(W=new Buffer(W,ri)),this.keys._importPublic(W),this},Y.prototype.setPrivateKey=function(W,ri){ri=ri||"utf8",Buffer.isBuffer(W)||(W=new Buffer(W,ri));var si=new e(W);return si=si.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(si),this};function Ne(W,ri,si){Array.isArray(W)||(W=W.toArray());var fi=new Buffer(W);if(si&&fi.length0?t:F},W.min=function(t,F){return t.cmp(F)<0?t:F},W.prototype._init=function(t,F,Ie){if(typeof t=="number")return this._initNumber(t,F,Ie);if(typeof t=="object")return this._initArray(t,F,Ie);F==="hex"&&(F=16),Y(F===(F|0)&&F>=2&&F<=36),t=t.toString().replace(/\s+/g,"");var Te=0;t[0]==="-"&&(Te++,this.negative=1),Te=0;Te-=3)ei=t[Te]|t[Te-1]<<8|t[Te-2]<<16,this.words[Xr]|=ei<>>26-ii&67108863,ii+=24,ii>=26&&(ii-=26,Xr++);else if(Ie==="le")for(Te=0,Xr=0;Te>>26-ii&67108863,ii+=24,ii>=26&&(ii-=26,Xr++);return this.strip()};function si(oi,t){var F=oi.charCodeAt(t);return F>=65&&F<=70?F-55:F>=97&&F<=102?F-87:F-48&15}function fi(oi,t,F){var Ie=si(oi,F);return F-1>=t&&(Ie|=si(oi,F-1)<<4),Ie}W.prototype._parseHex=function(t,F,Ie){this.length=Math.ceil((t.length-F)/6),this.words=new Array(this.length);for(var Te=0;Te=F;Te-=2)ii=fi(t,F,Te)<=18?(Xr-=18,ei+=1,this.words[ei]|=ii>>>26):Xr+=8;else{var Wr=t.length-F;for(Te=Wr%2===0?F+1:F;Te=18?(Xr-=18,ei+=1,this.words[ei]|=ii>>>26):Xr+=8}this.strip()};function ai(oi,t,F,Ie){for(var Te=0,Xr=Math.min(oi.length,F),ei=t;ei=49?Te+=ii-49+10:ii>=17?Te+=ii-17+10:Te+=ii}return Te}W.prototype._parseBase=function(t,F,Ie){this.words=[0],this.length=1;for(var Te=0,Xr=1;Xr<=67108863;Xr*=F)Te++;Te--,Xr=Xr/F|0;for(var ei=t.length-Ie,ii=ei%Te,Wr=Math.min(ei,ei-ii)+Ie,R=0,Le=Ie;Le1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},W.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},W.prototype.inspect=function(){return(this.red?""};var ti=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],hi=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],ci=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];W.prototype.toString=function(t,F){t=t||10,F=F|0||1;var Ie;if(t===16||t==="hex"){Ie="";for(var Te=0,Xr=0,ei=0;ei>>24-Te&16777215,Xr!==0||ei!==this.length-1?Ie=ti[6-Wr.length]+Wr+Ie:Ie=Wr+Ie,Te+=2,Te>=26&&(Te-=26,ei--)}for(Xr!==0&&(Ie=Xr.toString(16)+Ie);Ie.length%F!==0;)Ie="0"+Ie;return this.negative!==0&&(Ie="-"+Ie),Ie}if(t===(t|0)&&t>=2&&t<=36){var R=hi[t],Le=ci[t];Ie="";var nn=this.clone();for(nn.negative=0;!nn.isZero();){var vn=nn.modn(Le).toString(t);nn=nn.idivn(Le),nn.isZero()?Ie=vn+Ie:Ie=ti[R-vn.length]+vn+Ie}for(this.isZero()&&(Ie="0"+Ie);Ie.length%F!==0;)Ie="0"+Ie;return this.negative!==0&&(Ie="-"+Ie),Ie}Y(!1,"Base should be between 2 and 36")},W.prototype.toNumber=function(){var t=this.words[0];return this.length===2?t+=this.words[1]*67108864:this.length===3&&this.words[2]===1?t+=4503599627370496+this.words[1]*67108864:this.length>2&&Y(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-t:t},W.prototype.toJSON=function(){return this.toString(16)},W.prototype.toBuffer=function(t,F){return Y(typeof ri<"u"),this.toArrayLike(ri,t,F)},W.prototype.toArray=function(t,F){return this.toArrayLike(Array,t,F)},W.prototype.toArrayLike=function(t,F,Ie){var Te=this.byteLength(),Xr=Ie||Math.max(1,Te);Y(Te<=Xr,"byte array longer than desired length"),Y(Xr>0,"Requested array length <= 0"),this.strip();var ei=F==="le",ii=new t(Xr),Wr,R,Le=this.clone();if(ei){for(R=0;!Le.isZero();R++)Wr=Le.andln(255),Le.iushrn(8),ii[R]=Wr;for(;R=4096&&(Ie+=13,F>>>=13),F>=64&&(Ie+=7,F>>>=7),F>=8&&(Ie+=4,F>>>=4),F>=2&&(Ie+=2,F>>>=2),Ie+F},W.prototype._zeroBits=function(t){if(t===0)return 26;var F=t,Ie=0;return F&8191||(Ie+=13,F>>>=13),F&127||(Ie+=7,F>>>=7),F&15||(Ie+=4,F>>>=4),F&3||(Ie+=2,F>>>=2),F&1||Ie++,Ie},W.prototype.bitLength=function(){var t=this.words[this.length-1],F=this._countBits(t);return(this.length-1)*26+F};function ui(oi){for(var t=new Array(oi.bitLength()),F=0;F>>Te}return t}W.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,F=0;Ft.length?this.clone().ior(t):t.clone().ior(this)},W.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},W.prototype.iuand=function(t){var F;this.length>t.length?F=t:F=this;for(var Ie=0;Iet.length?this.clone().iand(t):t.clone().iand(this)},W.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},W.prototype.iuxor=function(t){var F,Ie;this.length>t.length?(F=this,Ie=t):(F=t,Ie=this);for(var Te=0;Tet.length?this.clone().ixor(t):t.clone().ixor(this)},W.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},W.prototype.inotn=function(t){Y(typeof t=="number"&&t>=0);var F=Math.ceil(t/26)|0,Ie=t%26;this._expand(F),Ie>0&&F--;for(var Te=0;Te0&&(this.words[Te]=~this.words[Te]&67108863>>26-Ie),this.strip()},W.prototype.notn=function(t){return this.clone().inotn(t)},W.prototype.setn=function(t,F){Y(typeof t=="number"&&t>=0);var Ie=t/26|0,Te=t%26;return this._expand(Ie+1),F?this.words[Ie]=this.words[Ie]|1<t.length?(Ie=this,Te=t):(Ie=t,Te=this);for(var Xr=0,ei=0;ei>>26;for(;Xr!==0&&ei>>26;if(this.length=Ie.length,Xr!==0)this.words[this.length]=Xr,this.length++;else if(Ie!==this)for(;eit.length?this.clone().iadd(t):t.clone().iadd(this)},W.prototype.isub=function(t){if(t.negative!==0){t.negative=0;var F=this.iadd(t);return t.negative=1,F._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var Ie=this.cmp(t);if(Ie===0)return this.negative=0,this.length=1,this.words[0]=0,this;var Te,Xr;Ie>0?(Te=this,Xr=t):(Te=t,Xr=this);for(var ei=0,ii=0;ii>26,this.words[ii]=F&67108863;for(;ei!==0&&ii>26,this.words[ii]=F&67108863;if(ei===0&&ii>>26,nn=Wr&67108863,vn=Math.min(R,t.length-1),Mn=Math.max(0,R-oi.length+1);Mn<=vn;Mn++){var sn=R-Mn|0;Te=oi.words[sn]|0,Xr=t.words[Mn]|0,ei=Te*Xr+nn,Le+=ei/67108864|0,nn=ei&67108863}F.words[R]=nn|0,Wr=Le|0}return Wr!==0?F.words[R]=Wr|0:F.length--,F.strip()}var mi=function(t,F,Ie){var Te=t.words,Xr=F.words,ei=Ie.words,ii=0,Wr,R,Le,nn=Te[0]|0,vn=nn&8191,Mn=nn>>>13,sn=Te[1]|0,Zn=sn&8191,on=sn>>>13,pn=Te[2]|0,mn=pn&8191,$i=pn>>>13,ho=Te[3]|0,Do=ho&8191,To=ho>>>13,Oh=Te[4]|0,Fo=Oh&8191,Vo=Oh>>>13,Hh=Te[5]|0,Ah=Hh&8191,Qf=Hh>>>13,Gh=Te[6]|0,tf=Gh&8191,Ko=Gh>>>13,Kh=Te[7]|0,Lf=Kh&8191,Uo=Kh>>>13,Vh=Te[8]|0,jf=Vh&8191,Zo=Vh>>>13,Wh=Te[9]|0,vh=Wh&8191,Yo=Wh>>>13,Jh=Xr[0]|0,xh=Jh&8191,Vf=Jh>>>13,Zh=Xr[1]|0,Ch=Zh&8191,Eh=Zh>>>13,Lu=Xr[2]|0,Ph=Lu&8191,Sh=Lu>>>13,Uu=Xr[3]|0,Th=Uu&8191,gh=Uu>>>13,Xh=Xr[4]|0,Rh=Xh&8191,bh=Xh>>>13,au=Xr[5]|0,$h=au&8191,wh=au>>>13,qu=Xr[6]|0,Ih=qu&8191,_h=qu>>>13,uu=Xr[7]|0,Dh=uu&8191,yh=uu>>>13,Yh=Xr[8]|0,Bh=Yh&8191,Mh=Yh>>>13,Hu=Xr[9]|0,kh=Hu&8191,qh=Hu>>>13;Ie.negative=t.negative^F.negative,Ie.length=19,Wr=Math.imul(vn,xh),R=Math.imul(vn,Vf),R=R+Math.imul(Mn,xh)|0,Le=Math.imul(Mn,Vf);var Tu=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(Tu>>>26)|0,Tu&=67108863,Wr=Math.imul(Zn,xh),R=Math.imul(Zn,Vf),R=R+Math.imul(on,xh)|0,Le=Math.imul(on,Vf),Wr=Wr+Math.imul(vn,Ch)|0,R=R+Math.imul(vn,Eh)|0,R=R+Math.imul(Mn,Ch)|0,Le=Le+Math.imul(Mn,Eh)|0;var tc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(tc>>>26)|0,tc&=67108863,Wr=Math.imul(mn,xh),R=Math.imul(mn,Vf),R=R+Math.imul($i,xh)|0,Le=Math.imul($i,Vf),Wr=Wr+Math.imul(Zn,Ch)|0,R=R+Math.imul(Zn,Eh)|0,R=R+Math.imul(on,Ch)|0,Le=Le+Math.imul(on,Eh)|0,Wr=Wr+Math.imul(vn,Ph)|0,R=R+Math.imul(vn,Sh)|0,R=R+Math.imul(Mn,Ph)|0,Le=Le+Math.imul(Mn,Sh)|0;var rc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(rc>>>26)|0,rc&=67108863,Wr=Math.imul(Do,xh),R=Math.imul(Do,Vf),R=R+Math.imul(To,xh)|0,Le=Math.imul(To,Vf),Wr=Wr+Math.imul(mn,Ch)|0,R=R+Math.imul(mn,Eh)|0,R=R+Math.imul($i,Ch)|0,Le=Le+Math.imul($i,Eh)|0,Wr=Wr+Math.imul(Zn,Ph)|0,R=R+Math.imul(Zn,Sh)|0,R=R+Math.imul(on,Ph)|0,Le=Le+Math.imul(on,Sh)|0,Wr=Wr+Math.imul(vn,Th)|0,R=R+Math.imul(vn,gh)|0,R=R+Math.imul(Mn,Th)|0,Le=Le+Math.imul(Mn,gh)|0;var ic=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(ic>>>26)|0,ic&=67108863,Wr=Math.imul(Fo,xh),R=Math.imul(Fo,Vf),R=R+Math.imul(Vo,xh)|0,Le=Math.imul(Vo,Vf),Wr=Wr+Math.imul(Do,Ch)|0,R=R+Math.imul(Do,Eh)|0,R=R+Math.imul(To,Ch)|0,Le=Le+Math.imul(To,Eh)|0,Wr=Wr+Math.imul(mn,Ph)|0,R=R+Math.imul(mn,Sh)|0,R=R+Math.imul($i,Ph)|0,Le=Le+Math.imul($i,Sh)|0,Wr=Wr+Math.imul(Zn,Th)|0,R=R+Math.imul(Zn,gh)|0,R=R+Math.imul(on,Th)|0,Le=Le+Math.imul(on,gh)|0,Wr=Wr+Math.imul(vn,Rh)|0,R=R+Math.imul(vn,bh)|0,R=R+Math.imul(Mn,Rh)|0,Le=Le+Math.imul(Mn,bh)|0;var nc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(nc>>>26)|0,nc&=67108863,Wr=Math.imul(Ah,xh),R=Math.imul(Ah,Vf),R=R+Math.imul(Qf,xh)|0,Le=Math.imul(Qf,Vf),Wr=Wr+Math.imul(Fo,Ch)|0,R=R+Math.imul(Fo,Eh)|0,R=R+Math.imul(Vo,Ch)|0,Le=Le+Math.imul(Vo,Eh)|0,Wr=Wr+Math.imul(Do,Ph)|0,R=R+Math.imul(Do,Sh)|0,R=R+Math.imul(To,Ph)|0,Le=Le+Math.imul(To,Sh)|0,Wr=Wr+Math.imul(mn,Th)|0,R=R+Math.imul(mn,gh)|0,R=R+Math.imul($i,Th)|0,Le=Le+Math.imul($i,gh)|0,Wr=Wr+Math.imul(Zn,Rh)|0,R=R+Math.imul(Zn,bh)|0,R=R+Math.imul(on,Rh)|0,Le=Le+Math.imul(on,bh)|0,Wr=Wr+Math.imul(vn,$h)|0,R=R+Math.imul(vn,wh)|0,R=R+Math.imul(Mn,$h)|0,Le=Le+Math.imul(Mn,wh)|0;var sc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(sc>>>26)|0,sc&=67108863,Wr=Math.imul(tf,xh),R=Math.imul(tf,Vf),R=R+Math.imul(Ko,xh)|0,Le=Math.imul(Ko,Vf),Wr=Wr+Math.imul(Ah,Ch)|0,R=R+Math.imul(Ah,Eh)|0,R=R+Math.imul(Qf,Ch)|0,Le=Le+Math.imul(Qf,Eh)|0,Wr=Wr+Math.imul(Fo,Ph)|0,R=R+Math.imul(Fo,Sh)|0,R=R+Math.imul(Vo,Ph)|0,Le=Le+Math.imul(Vo,Sh)|0,Wr=Wr+Math.imul(Do,Th)|0,R=R+Math.imul(Do,gh)|0,R=R+Math.imul(To,Th)|0,Le=Le+Math.imul(To,gh)|0,Wr=Wr+Math.imul(mn,Rh)|0,R=R+Math.imul(mn,bh)|0,R=R+Math.imul($i,Rh)|0,Le=Le+Math.imul($i,bh)|0,Wr=Wr+Math.imul(Zn,$h)|0,R=R+Math.imul(Zn,wh)|0,R=R+Math.imul(on,$h)|0,Le=Le+Math.imul(on,wh)|0,Wr=Wr+Math.imul(vn,Ih)|0,R=R+Math.imul(vn,_h)|0,R=R+Math.imul(Mn,Ih)|0,Le=Le+Math.imul(Mn,_h)|0;var s0=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(s0>>>26)|0,s0&=67108863,Wr=Math.imul(Lf,xh),R=Math.imul(Lf,Vf),R=R+Math.imul(Uo,xh)|0,Le=Math.imul(Uo,Vf),Wr=Wr+Math.imul(tf,Ch)|0,R=R+Math.imul(tf,Eh)|0,R=R+Math.imul(Ko,Ch)|0,Le=Le+Math.imul(Ko,Eh)|0,Wr=Wr+Math.imul(Ah,Ph)|0,R=R+Math.imul(Ah,Sh)|0,R=R+Math.imul(Qf,Ph)|0,Le=Le+Math.imul(Qf,Sh)|0,Wr=Wr+Math.imul(Fo,Th)|0,R=R+Math.imul(Fo,gh)|0,R=R+Math.imul(Vo,Th)|0,Le=Le+Math.imul(Vo,gh)|0,Wr=Wr+Math.imul(Do,Rh)|0,R=R+Math.imul(Do,bh)|0,R=R+Math.imul(To,Rh)|0,Le=Le+Math.imul(To,bh)|0,Wr=Wr+Math.imul(mn,$h)|0,R=R+Math.imul(mn,wh)|0,R=R+Math.imul($i,$h)|0,Le=Le+Math.imul($i,wh)|0,Wr=Wr+Math.imul(Zn,Ih)|0,R=R+Math.imul(Zn,_h)|0,R=R+Math.imul(on,Ih)|0,Le=Le+Math.imul(on,_h)|0,Wr=Wr+Math.imul(vn,Dh)|0,R=R+Math.imul(vn,yh)|0,R=R+Math.imul(Mn,Dh)|0,Le=Le+Math.imul(Mn,yh)|0;var hc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(hc>>>26)|0,hc&=67108863,Wr=Math.imul(jf,xh),R=Math.imul(jf,Vf),R=R+Math.imul(Zo,xh)|0,Le=Math.imul(Zo,Vf),Wr=Wr+Math.imul(Lf,Ch)|0,R=R+Math.imul(Lf,Eh)|0,R=R+Math.imul(Uo,Ch)|0,Le=Le+Math.imul(Uo,Eh)|0,Wr=Wr+Math.imul(tf,Ph)|0,R=R+Math.imul(tf,Sh)|0,R=R+Math.imul(Ko,Ph)|0,Le=Le+Math.imul(Ko,Sh)|0,Wr=Wr+Math.imul(Ah,Th)|0,R=R+Math.imul(Ah,gh)|0,R=R+Math.imul(Qf,Th)|0,Le=Le+Math.imul(Qf,gh)|0,Wr=Wr+Math.imul(Fo,Rh)|0,R=R+Math.imul(Fo,bh)|0,R=R+Math.imul(Vo,Rh)|0,Le=Le+Math.imul(Vo,bh)|0,Wr=Wr+Math.imul(Do,$h)|0,R=R+Math.imul(Do,wh)|0,R=R+Math.imul(To,$h)|0,Le=Le+Math.imul(To,wh)|0,Wr=Wr+Math.imul(mn,Ih)|0,R=R+Math.imul(mn,_h)|0,R=R+Math.imul($i,Ih)|0,Le=Le+Math.imul($i,_h)|0,Wr=Wr+Math.imul(Zn,Dh)|0,R=R+Math.imul(Zn,yh)|0,R=R+Math.imul(on,Dh)|0,Le=Le+Math.imul(on,yh)|0,Wr=Wr+Math.imul(vn,Bh)|0,R=R+Math.imul(vn,Mh)|0,R=R+Math.imul(Mn,Bh)|0,Le=Le+Math.imul(Mn,Mh)|0;var pc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(pc>>>26)|0,pc&=67108863,Wr=Math.imul(vh,xh),R=Math.imul(vh,Vf),R=R+Math.imul(Yo,xh)|0,Le=Math.imul(Yo,Vf),Wr=Wr+Math.imul(jf,Ch)|0,R=R+Math.imul(jf,Eh)|0,R=R+Math.imul(Zo,Ch)|0,Le=Le+Math.imul(Zo,Eh)|0,Wr=Wr+Math.imul(Lf,Ph)|0,R=R+Math.imul(Lf,Sh)|0,R=R+Math.imul(Uo,Ph)|0,Le=Le+Math.imul(Uo,Sh)|0,Wr=Wr+Math.imul(tf,Th)|0,R=R+Math.imul(tf,gh)|0,R=R+Math.imul(Ko,Th)|0,Le=Le+Math.imul(Ko,gh)|0,Wr=Wr+Math.imul(Ah,Rh)|0,R=R+Math.imul(Ah,bh)|0,R=R+Math.imul(Qf,Rh)|0,Le=Le+Math.imul(Qf,bh)|0,Wr=Wr+Math.imul(Fo,$h)|0,R=R+Math.imul(Fo,wh)|0,R=R+Math.imul(Vo,$h)|0,Le=Le+Math.imul(Vo,wh)|0,Wr=Wr+Math.imul(Do,Ih)|0,R=R+Math.imul(Do,_h)|0,R=R+Math.imul(To,Ih)|0,Le=Le+Math.imul(To,_h)|0,Wr=Wr+Math.imul(mn,Dh)|0,R=R+Math.imul(mn,yh)|0,R=R+Math.imul($i,Dh)|0,Le=Le+Math.imul($i,yh)|0,Wr=Wr+Math.imul(Zn,Bh)|0,R=R+Math.imul(Zn,Mh)|0,R=R+Math.imul(on,Bh)|0,Le=Le+Math.imul(on,Mh)|0,Wr=Wr+Math.imul(vn,kh)|0,R=R+Math.imul(vn,qh)|0,R=R+Math.imul(Mn,kh)|0,Le=Le+Math.imul(Mn,qh)|0;var uc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(uc>>>26)|0,uc&=67108863,Wr=Math.imul(vh,Ch),R=Math.imul(vh,Eh),R=R+Math.imul(Yo,Ch)|0,Le=Math.imul(Yo,Eh),Wr=Wr+Math.imul(jf,Ph)|0,R=R+Math.imul(jf,Sh)|0,R=R+Math.imul(Zo,Ph)|0,Le=Le+Math.imul(Zo,Sh)|0,Wr=Wr+Math.imul(Lf,Th)|0,R=R+Math.imul(Lf,gh)|0,R=R+Math.imul(Uo,Th)|0,Le=Le+Math.imul(Uo,gh)|0,Wr=Wr+Math.imul(tf,Rh)|0,R=R+Math.imul(tf,bh)|0,R=R+Math.imul(Ko,Rh)|0,Le=Le+Math.imul(Ko,bh)|0,Wr=Wr+Math.imul(Ah,$h)|0,R=R+Math.imul(Ah,wh)|0,R=R+Math.imul(Qf,$h)|0,Le=Le+Math.imul(Qf,wh)|0,Wr=Wr+Math.imul(Fo,Ih)|0,R=R+Math.imul(Fo,_h)|0,R=R+Math.imul(Vo,Ih)|0,Le=Le+Math.imul(Vo,_h)|0,Wr=Wr+Math.imul(Do,Dh)|0,R=R+Math.imul(Do,yh)|0,R=R+Math.imul(To,Dh)|0,Le=Le+Math.imul(To,yh)|0,Wr=Wr+Math.imul(mn,Bh)|0,R=R+Math.imul(mn,Mh)|0,R=R+Math.imul($i,Bh)|0,Le=Le+Math.imul($i,Mh)|0,Wr=Wr+Math.imul(Zn,kh)|0,R=R+Math.imul(Zn,qh)|0,R=R+Math.imul(on,kh)|0,Le=Le+Math.imul(on,qh)|0;var vc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(vc>>>26)|0,vc&=67108863,Wr=Math.imul(vh,Ph),R=Math.imul(vh,Sh),R=R+Math.imul(Yo,Ph)|0,Le=Math.imul(Yo,Sh),Wr=Wr+Math.imul(jf,Th)|0,R=R+Math.imul(jf,gh)|0,R=R+Math.imul(Zo,Th)|0,Le=Le+Math.imul(Zo,gh)|0,Wr=Wr+Math.imul(Lf,Rh)|0,R=R+Math.imul(Lf,bh)|0,R=R+Math.imul(Uo,Rh)|0,Le=Le+Math.imul(Uo,bh)|0,Wr=Wr+Math.imul(tf,$h)|0,R=R+Math.imul(tf,wh)|0,R=R+Math.imul(Ko,$h)|0,Le=Le+Math.imul(Ko,wh)|0,Wr=Wr+Math.imul(Ah,Ih)|0,R=R+Math.imul(Ah,_h)|0,R=R+Math.imul(Qf,Ih)|0,Le=Le+Math.imul(Qf,_h)|0,Wr=Wr+Math.imul(Fo,Dh)|0,R=R+Math.imul(Fo,yh)|0,R=R+Math.imul(Vo,Dh)|0,Le=Le+Math.imul(Vo,yh)|0,Wr=Wr+Math.imul(Do,Bh)|0,R=R+Math.imul(Do,Mh)|0,R=R+Math.imul(To,Bh)|0,Le=Le+Math.imul(To,Mh)|0,Wr=Wr+Math.imul(mn,kh)|0,R=R+Math.imul(mn,qh)|0,R=R+Math.imul($i,kh)|0,Le=Le+Math.imul($i,qh)|0;var mc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(mc>>>26)|0,mc&=67108863,Wr=Math.imul(vh,Th),R=Math.imul(vh,gh),R=R+Math.imul(Yo,Th)|0,Le=Math.imul(Yo,gh),Wr=Wr+Math.imul(jf,Rh)|0,R=R+Math.imul(jf,bh)|0,R=R+Math.imul(Zo,Rh)|0,Le=Le+Math.imul(Zo,bh)|0,Wr=Wr+Math.imul(Lf,$h)|0,R=R+Math.imul(Lf,wh)|0,R=R+Math.imul(Uo,$h)|0,Le=Le+Math.imul(Uo,wh)|0,Wr=Wr+Math.imul(tf,Ih)|0,R=R+Math.imul(tf,_h)|0,R=R+Math.imul(Ko,Ih)|0,Le=Le+Math.imul(Ko,_h)|0,Wr=Wr+Math.imul(Ah,Dh)|0,R=R+Math.imul(Ah,yh)|0,R=R+Math.imul(Qf,Dh)|0,Le=Le+Math.imul(Qf,yh)|0,Wr=Wr+Math.imul(Fo,Bh)|0,R=R+Math.imul(Fo,Mh)|0,R=R+Math.imul(Vo,Bh)|0,Le=Le+Math.imul(Vo,Mh)|0,Wr=Wr+Math.imul(Do,kh)|0,R=R+Math.imul(Do,qh)|0,R=R+Math.imul(To,kh)|0,Le=Le+Math.imul(To,qh)|0;var cc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(cc>>>26)|0,cc&=67108863,Wr=Math.imul(vh,Rh),R=Math.imul(vh,bh),R=R+Math.imul(Yo,Rh)|0,Le=Math.imul(Yo,bh),Wr=Wr+Math.imul(jf,$h)|0,R=R+Math.imul(jf,wh)|0,R=R+Math.imul(Zo,$h)|0,Le=Le+Math.imul(Zo,wh)|0,Wr=Wr+Math.imul(Lf,Ih)|0,R=R+Math.imul(Lf,_h)|0,R=R+Math.imul(Uo,Ih)|0,Le=Le+Math.imul(Uo,_h)|0,Wr=Wr+Math.imul(tf,Dh)|0,R=R+Math.imul(tf,yh)|0,R=R+Math.imul(Ko,Dh)|0,Le=Le+Math.imul(Ko,yh)|0,Wr=Wr+Math.imul(Ah,Bh)|0,R=R+Math.imul(Ah,Mh)|0,R=R+Math.imul(Qf,Bh)|0,Le=Le+Math.imul(Qf,Mh)|0,Wr=Wr+Math.imul(Fo,kh)|0,R=R+Math.imul(Fo,qh)|0,R=R+Math.imul(Vo,kh)|0,Le=Le+Math.imul(Vo,qh)|0;var lc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(lc>>>26)|0,lc&=67108863,Wr=Math.imul(vh,$h),R=Math.imul(vh,wh),R=R+Math.imul(Yo,$h)|0,Le=Math.imul(Yo,wh),Wr=Wr+Math.imul(jf,Ih)|0,R=R+Math.imul(jf,_h)|0,R=R+Math.imul(Zo,Ih)|0,Le=Le+Math.imul(Zo,_h)|0,Wr=Wr+Math.imul(Lf,Dh)|0,R=R+Math.imul(Lf,yh)|0,R=R+Math.imul(Uo,Dh)|0,Le=Le+Math.imul(Uo,yh)|0,Wr=Wr+Math.imul(tf,Bh)|0,R=R+Math.imul(tf,Mh)|0,R=R+Math.imul(Ko,Bh)|0,Le=Le+Math.imul(Ko,Mh)|0,Wr=Wr+Math.imul(Ah,kh)|0,R=R+Math.imul(Ah,qh)|0,R=R+Math.imul(Qf,kh)|0,Le=Le+Math.imul(Qf,qh)|0;var dc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(dc>>>26)|0,dc&=67108863,Wr=Math.imul(vh,Ih),R=Math.imul(vh,_h),R=R+Math.imul(Yo,Ih)|0,Le=Math.imul(Yo,_h),Wr=Wr+Math.imul(jf,Dh)|0,R=R+Math.imul(jf,yh)|0,R=R+Math.imul(Zo,Dh)|0,Le=Le+Math.imul(Zo,yh)|0,Wr=Wr+Math.imul(Lf,Bh)|0,R=R+Math.imul(Lf,Mh)|0,R=R+Math.imul(Uo,Bh)|0,Le=Le+Math.imul(Uo,Mh)|0,Wr=Wr+Math.imul(tf,kh)|0,R=R+Math.imul(tf,qh)|0,R=R+Math.imul(Ko,kh)|0,Le=Le+Math.imul(Ko,qh)|0;var $0=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+($0>>>26)|0,$0&=67108863,Wr=Math.imul(vh,Dh),R=Math.imul(vh,yh),R=R+Math.imul(Yo,Dh)|0,Le=Math.imul(Yo,yh),Wr=Wr+Math.imul(jf,Bh)|0,R=R+Math.imul(jf,Mh)|0,R=R+Math.imul(Zo,Bh)|0,Le=Le+Math.imul(Zo,Mh)|0,Wr=Wr+Math.imul(Lf,kh)|0,R=R+Math.imul(Lf,qh)|0,R=R+Math.imul(Uo,kh)|0,Le=Le+Math.imul(Uo,qh)|0;var gc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(gc>>>26)|0,gc&=67108863,Wr=Math.imul(vh,Bh),R=Math.imul(vh,Mh),R=R+Math.imul(Yo,Bh)|0,Le=Math.imul(Yo,Mh),Wr=Wr+Math.imul(jf,kh)|0,R=R+Math.imul(jf,qh)|0,R=R+Math.imul(Zo,kh)|0,Le=Le+Math.imul(Zo,qh)|0;var bc=(ii+Wr|0)+((R&8191)<<13)|0;ii=(Le+(R>>>13)|0)+(bc>>>26)|0,bc&=67108863,Wr=Math.imul(vh,kh),R=Math.imul(vh,qh),R=R+Math.imul(Yo,kh)|0,Le=Math.imul(Yo,qh);var yc=(ii+Wr|0)+((R&8191)<<13)|0;return ii=(Le+(R>>>13)|0)+(yc>>>26)|0,yc&=67108863,ei[0]=Tu,ei[1]=tc,ei[2]=rc,ei[3]=ic,ei[4]=nc,ei[5]=sc,ei[6]=s0,ei[7]=hc,ei[8]=pc,ei[9]=uc,ei[10]=vc,ei[11]=mc,ei[12]=cc,ei[13]=lc,ei[14]=dc,ei[15]=$0,ei[16]=gc,ei[17]=bc,ei[18]=yc,ii!==0&&(ei[19]=ii,Ie.length++),Ie};Math.imul||(mi=li);function hn(oi,t,F){F.negative=t.negative^oi.negative,F.length=oi.length+t.length;for(var Ie=0,Te=0,Xr=0;Xr>>26)|0,Te+=ei>>>26,ei&=67108863}F.words[Xr]=ii,Ie=ei,ei=Te}return Ie!==0?F.words[Xr]=Ie:F.length--,F.strip()}function ln(oi,t,F){var Ie=new fn;return Ie.mulp(oi,t,F)}W.prototype.mulTo=function(t,F){var Ie,Te=this.length+t.length;return this.length===10&&t.length===10?Ie=mi(this,t,F):Te<63?Ie=li(this,t,F):Te<1024?Ie=hn(this,t,F):Ie=ln(this,t,F),Ie};function fn(oi,t){this.x=oi,this.y=t}fn.prototype.makeRBT=function(t){for(var F=new Array(t),Ie=W.prototype._countBits(t)-1,Te=0;Te>=1;return Te},fn.prototype.permute=function(t,F,Ie,Te,Xr,ei){for(var ii=0;ii>>1)Xr++;return 1<>>13,Ie[2*ei+1]=Xr&8191,Xr=Xr>>>13;for(ei=2*F;ei>=26,F+=Te/67108864|0,F+=Xr>>>26,this.words[Ie]=Xr&67108863}return F!==0&&(this.words[Ie]=F,this.length++),this},W.prototype.muln=function(t){return this.clone().imuln(t)},W.prototype.sqr=function(){return this.mul(this)},W.prototype.isqr=function(){return this.imul(this.clone())},W.prototype.pow=function(t){var F=ui(t);if(F.length===0)return new W(1);for(var Ie=this,Te=0;Te=0);var F=t%26,Ie=(t-F)/26,Te=67108863>>>26-F<<26-F,Xr;if(F!==0){var ei=0;for(Xr=0;Xr>>26-F}ei&&(this.words[Xr]=ei,this.length++)}if(Ie!==0){for(Xr=this.length-1;Xr>=0;Xr--)this.words[Xr+Ie]=this.words[Xr];for(Xr=0;Xr=0);var Te;F?Te=(F-F%26)/26:Te=0;var Xr=t%26,ei=Math.min((t-Xr)/26,this.length),ii=67108863^67108863>>>Xr<ei)for(this.length-=ei,R=0;R=0&&(Le!==0||R>=Te);R--){var nn=this.words[R]|0;this.words[R]=Le<<26-Xr|nn>>>Xr,Le=nn&ii}return Wr&&Le!==0&&(Wr.words[Wr.length++]=Le),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},W.prototype.ishrn=function(t,F,Ie){return Y(this.negative===0),this.iushrn(t,F,Ie)},W.prototype.shln=function(t){return this.clone().ishln(t)},W.prototype.ushln=function(t){return this.clone().iushln(t)},W.prototype.shrn=function(t){return this.clone().ishrn(t)},W.prototype.ushrn=function(t){return this.clone().iushrn(t)},W.prototype.testn=function(t){Y(typeof t=="number"&&t>=0);var F=t%26,Ie=(t-F)/26,Te=1<=0);var F=t%26,Ie=(t-F)/26;if(Y(this.negative===0,"imaskn works only with positive numbers"),this.length<=Ie)return this;if(F!==0&&Ie++,this.length=Math.min(Ie,this.length),F!==0){var Te=67108863^67108863>>>F<=67108864;F++)this.words[F]-=67108864,F===this.length-1?this.words[F+1]=1:this.words[F+1]++;return this.length=Math.max(this.length,F+1),this},W.prototype.isubn=function(t){if(Y(typeof t=="number"),Y(t<67108864),t<0)return this.iaddn(-t);if(this.negative!==0)return this.negative=0,this.iaddn(t),this.negative=1,this;if(this.words[0]-=t,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var F=0;F>26)-(Wr/67108864|0),this.words[Xr+Ie]=ei&67108863}for(;Xr>26,this.words[Xr+Ie]=ei&67108863;if(ii===0)return this.strip();for(Y(ii===-1),ii=0,Xr=0;Xr>26,this.words[Xr]=ei&67108863;return this.negative=1,this.strip()},W.prototype._wordDiv=function(t,F){var Ie=this.length-t.length,Te=this.clone(),Xr=t,ei=Xr.words[Xr.length-1]|0,ii=this._countBits(ei);Ie=26-ii,Ie!==0&&(Xr=Xr.ushln(Ie),Te.iushln(Ie),ei=Xr.words[Xr.length-1]|0);var Wr=Te.length-Xr.length,R;if(F!=="mod"){R=new W(null),R.length=Wr+1,R.words=new Array(R.length);for(var Le=0;Le=0;vn--){var Mn=(Te.words[Xr.length+vn]|0)*67108864+(Te.words[Xr.length+vn-1]|0);for(Mn=Math.min(Mn/ei|0,67108863),Te._ishlnsubmul(Xr,Mn,vn);Te.negative!==0;)Mn--,Te.negative=0,Te._ishlnsubmul(Xr,1,vn),Te.isZero()||(Te.negative^=1);R&&(R.words[vn]=Mn)}return R&&R.strip(),Te.strip(),F!=="div"&&Ie!==0&&Te.iushrn(Ie),{div:R||null,mod:Te}},W.prototype.divmod=function(t,F,Ie){if(Y(!t.isZero()),this.isZero())return{div:new W(0),mod:new W(0)};var Te,Xr,ei;return this.negative!==0&&t.negative===0?(ei=this.neg().divmod(t,F),F!=="mod"&&(Te=ei.div.neg()),F!=="div"&&(Xr=ei.mod.neg(),Ie&&Xr.negative!==0&&Xr.iadd(t)),{div:Te,mod:Xr}):this.negative===0&&t.negative!==0?(ei=this.divmod(t.neg(),F),F!=="mod"&&(Te=ei.div.neg()),{div:Te,mod:ei.mod}):this.negative&t.negative?(ei=this.neg().divmod(t.neg(),F),F!=="div"&&(Xr=ei.mod.neg(),Ie&&Xr.negative!==0&&Xr.isub(t)),{div:ei.div,mod:Xr}):t.length>this.length||this.cmp(t)<0?{div:new W(0),mod:this}:t.length===1?F==="div"?{div:this.divn(t.words[0]),mod:null}:F==="mod"?{div:null,mod:new W(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new W(this.modn(t.words[0]))}:this._wordDiv(t,F)},W.prototype.div=function(t){return this.divmod(t,"div",!1).div},W.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},W.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},W.prototype.divRound=function(t){var F=this.divmod(t);if(F.mod.isZero())return F.div;var Ie=F.div.negative!==0?F.mod.isub(t):F.mod,Te=t.ushrn(1),Xr=t.andln(1),ei=Ie.cmp(Te);return ei<0||Xr===1&&ei===0?F.div:F.div.negative!==0?F.div.isubn(1):F.div.iaddn(1)},W.prototype.modn=function(t){Y(t<=67108863);for(var F=(1<<26)%t,Ie=0,Te=this.length-1;Te>=0;Te--)Ie=(F*Ie+(this.words[Te]|0))%t;return Ie},W.prototype.idivn=function(t){Y(t<=67108863);for(var F=0,Ie=this.length-1;Ie>=0;Ie--){var Te=(this.words[Ie]|0)+F*67108864;this.words[Ie]=Te/t|0,F=Te%t}return this.strip()},W.prototype.divn=function(t){return this.clone().idivn(t)},W.prototype.egcd=function(t){Y(t.negative===0),Y(!t.isZero());var F=this,Ie=t.clone();F.negative!==0?F=F.umod(t):F=F.clone();for(var Te=new W(1),Xr=new W(0),ei=new W(0),ii=new W(1),Wr=0;F.isEven()&&Ie.isEven();)F.iushrn(1),Ie.iushrn(1),++Wr;for(var R=Ie.clone(),Le=F.clone();!F.isZero();){for(var nn=0,vn=1;!(F.words[0]&vn)&&nn<26;++nn,vn<<=1);if(nn>0)for(F.iushrn(nn);nn-- >0;)(Te.isOdd()||Xr.isOdd())&&(Te.iadd(R),Xr.isub(Le)),Te.iushrn(1),Xr.iushrn(1);for(var Mn=0,sn=1;!(Ie.words[0]&sn)&&Mn<26;++Mn,sn<<=1);if(Mn>0)for(Ie.iushrn(Mn);Mn-- >0;)(ei.isOdd()||ii.isOdd())&&(ei.iadd(R),ii.isub(Le)),ei.iushrn(1),ii.iushrn(1);F.cmp(Ie)>=0?(F.isub(Ie),Te.isub(ei),Xr.isub(ii)):(Ie.isub(F),ei.isub(Te),ii.isub(Xr))}return{a:ei,b:ii,gcd:Ie.iushln(Wr)}},W.prototype._invmp=function(t){Y(t.negative===0),Y(!t.isZero());var F=this,Ie=t.clone();F.negative!==0?F=F.umod(t):F=F.clone();for(var Te=new W(1),Xr=new W(0),ei=Ie.clone();F.cmpn(1)>0&&Ie.cmpn(1)>0;){for(var ii=0,Wr=1;!(F.words[0]&Wr)&&ii<26;++ii,Wr<<=1);if(ii>0)for(F.iushrn(ii);ii-- >0;)Te.isOdd()&&Te.iadd(ei),Te.iushrn(1);for(var R=0,Le=1;!(Ie.words[0]&Le)&&R<26;++R,Le<<=1);if(R>0)for(Ie.iushrn(R);R-- >0;)Xr.isOdd()&&Xr.iadd(ei),Xr.iushrn(1);F.cmp(Ie)>=0?(F.isub(Ie),Te.isub(Xr)):(Ie.isub(F),Xr.isub(Te))}var nn;return F.cmpn(1)===0?nn=Te:nn=Xr,nn.cmpn(0)<0&&nn.iadd(t),nn},W.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var F=this.clone(),Ie=t.clone();F.negative=0,Ie.negative=0;for(var Te=0;F.isEven()&&Ie.isEven();Te++)F.iushrn(1),Ie.iushrn(1);do{for(;F.isEven();)F.iushrn(1);for(;Ie.isEven();)Ie.iushrn(1);var Xr=F.cmp(Ie);if(Xr<0){var ei=F;F=Ie,Ie=ei}else if(Xr===0||Ie.cmpn(1)===0)break;F.isub(Ie)}while(!0);return Ie.iushln(Te)},W.prototype.invm=function(t){return this.egcd(t).a.umod(t)},W.prototype.isEven=function(){return(this.words[0]&1)===0},W.prototype.isOdd=function(){return(this.words[0]&1)===1},W.prototype.andln=function(t){return this.words[0]&t},W.prototype.bincn=function(t){Y(typeof t=="number");var F=t%26,Ie=(t-F)/26,Te=1<>>26,ii&=67108863,this.words[ei]=ii}return Xr!==0&&(this.words[ei]=Xr,this.length++),this},W.prototype.isZero=function(){return this.length===1&&this.words[0]===0},W.prototype.cmpn=function(t){var F=t<0;if(this.negative!==0&&!F)return-1;if(this.negative===0&&F)return 1;this.strip();var Ie;if(this.length>1)Ie=1;else{F&&(t=-t),Y(t<=67108863,"Number is too big");var Te=this.words[0]|0;Ie=Te===t?0:Tet.length)return 1;if(this.length=0;Ie--){var Te=this.words[Ie]|0,Xr=t.words[Ie]|0;if(Te!==Xr){TeXr&&(F=1);break}}return F},W.prototype.gtn=function(t){return this.cmpn(t)===1},W.prototype.gt=function(t){return this.cmp(t)===1},W.prototype.gten=function(t){return this.cmpn(t)>=0},W.prototype.gte=function(t){return this.cmp(t)>=0},W.prototype.ltn=function(t){return this.cmpn(t)===-1},W.prototype.lt=function(t){return this.cmp(t)===-1},W.prototype.lten=function(t){return this.cmpn(t)<=0},W.prototype.lte=function(t){return this.cmp(t)<=0},W.prototype.eqn=function(t){return this.cmpn(t)===0},W.prototype.eq=function(t){return this.cmp(t)===0},W.red=function(t){return new Ya(t)},W.prototype.toRed=function(t){return Y(!this.red,"Already a number in reduction context"),Y(this.negative===0,"red works only with positives"),t.convertTo(this)._forceRed(t)},W.prototype.fromRed=function(){return Y(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},W.prototype._forceRed=function(t){return this.red=t,this},W.prototype.forceRed=function(t){return Y(!this.red,"Already a number in reduction context"),this._forceRed(t)},W.prototype.redAdd=function(t){return Y(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},W.prototype.redIAdd=function(t){return Y(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},W.prototype.redSub=function(t){return Y(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},W.prototype.redISub=function(t){return Y(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},W.prototype.redShl=function(t){return Y(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},W.prototype.redMul=function(t){return Y(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},W.prototype.redIMul=function(t){return Y(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},W.prototype.redSqr=function(){return Y(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},W.prototype.redISqr=function(){return Y(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},W.prototype.redSqrt=function(){return Y(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},W.prototype.redInvm=function(){return Y(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},W.prototype.redNeg=function(){return Y(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},W.prototype.redPow=function(t){return Y(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var gn={k256:null,p224:null,p192:null,p25519:null};function cn(oi,t){this.name=oi,this.p=new W(t,16),this.n=this.p.bitLength(),this.k=new W(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}cn.prototype._tmp=function(){var t=new W(null);return t.words=new Array(Math.ceil(this.n/13)),t},cn.prototype.ireduce=function(t){var F=t,Ie;do this.split(F,this.tmp),F=this.imulK(F),F=F.iadd(this.tmp),Ie=F.bitLength();while(Ie>this.n);var Te=Ie0?F.isub(this.p):F.strip!==void 0?F.strip():F._strip(),F},cn.prototype.split=function(t,F){t.iushrn(this.n,0,F)},cn.prototype.imulK=function(t){return t.imul(this.k)};function An(){cn.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}Ne(An,cn),An.prototype.split=function(t,F){for(var Ie=4194303,Te=Math.min(t.length,9),Xr=0;Xr>>22,ei=ii}ei>>>=22,t.words[Xr-10]=ei,ei===0&&t.length>10?t.length-=10:t.length-=9},An.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var F=0,Ie=0;Ie>>=26,t.words[Ie]=Xr,F=Te}return F!==0&&(t.words[t.length++]=F),t},W._prime=function(t){if(gn[t])return gn[t];var F;if(t==="k256")F=new An;else if(t==="p224")F=new Cn;else if(t==="p192")F=new an;else if(t==="p25519")F=new Rn;else throw new Error("Unknown prime "+t);return gn[t]=F,F};function Ya(oi){if(typeof oi=="string"){var t=W._prime(oi);this.m=t.p,this.prime=t}else Y(oi.gtn(1),"modulus must be greater than 1"),this.m=oi,this.prime=null}Ya.prototype._verify1=function(t){Y(t.negative===0,"red works only with positives"),Y(t.red,"red works only with red numbers")},Ya.prototype._verify2=function(t,F){Y((t.negative|F.negative)===0,"red works only with positives"),Y(t.red&&t.red===F.red,"red works only with red numbers")},Ya.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},Ya.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},Ya.prototype.add=function(t,F){this._verify2(t,F);var Ie=t.add(F);return Ie.cmp(this.m)>=0&&Ie.isub(this.m),Ie._forceRed(this)},Ya.prototype.iadd=function(t,F){this._verify2(t,F);var Ie=t.iadd(F);return Ie.cmp(this.m)>=0&&Ie.isub(this.m),Ie},Ya.prototype.sub=function(t,F){this._verify2(t,F);var Ie=t.sub(F);return Ie.cmpn(0)<0&&Ie.iadd(this.m),Ie._forceRed(this)},Ya.prototype.isub=function(t,F){this._verify2(t,F);var Ie=t.isub(F);return Ie.cmpn(0)<0&&Ie.iadd(this.m),Ie},Ya.prototype.shl=function(t,F){return this._verify1(t),this.imod(t.ushln(F))},Ya.prototype.imul=function(t,F){return this._verify2(t,F),this.imod(t.imul(F))},Ya.prototype.mul=function(t,F){return this._verify2(t,F),this.imod(t.mul(F))},Ya.prototype.isqr=function(t){return this.imul(t,t.clone())},Ya.prototype.sqr=function(t){return this.mul(t,t)},Ya.prototype.sqrt=function(t){if(t.isZero())return t.clone();var F=this.m.andln(3);if(Y(F%2===1),F===3){var Ie=this.m.add(new W(1)).iushrn(2);return this.pow(t,Ie)}for(var Te=this.m.subn(1),Xr=0;!Te.isZero()&&Te.andln(1)===0;)Xr++,Te.iushrn(1);Y(!Te.isZero());var ei=new W(1).toRed(this),ii=ei.redNeg(),Wr=this.m.subn(1).iushrn(1),R=this.m.bitLength();for(R=new W(2*R*R).toRed(this);this.pow(R,Wr).cmp(ii)!==0;)R.redIAdd(ii);for(var Le=this.pow(R,Te),nn=this.pow(t,Te.addn(1).iushrn(1)),vn=this.pow(t,Te),Mn=Xr;vn.cmp(ei)!==0;){for(var sn=vn,Zn=0;sn.cmp(ei)!==0;Zn++)sn=sn.redSqr();Y(Zn=0;Xr--){for(var Le=F.words[Xr],nn=R-1;nn>=0;nn--){var vn=Le>>nn&1;if(ei!==Te[0]&&(ei=this.sqr(ei)),vn===0&&ii===0){Wr=0;continue}ii<<=1,ii|=vn,Wr++,!(Wr!==Ie&&(Xr!==0||nn!==0))&&(ei=this.mul(ei,Te[ii]),Wr=0,ii=0)}R=26}return ei},Ya.prototype.convertTo=function(t){var F=t.umod(this.m);return F===t?F.clone():F},Ya.prototype.convertFrom=function(t){var F=t.clone();return F.red=null,F},W.mont=function(t){return new Ho(t)};function Ho(oi){Ya.call(this,oi),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new W(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}Ne(Ho,Ya),Ho.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},Ho.prototype.convertFrom=function(t){var F=this.imod(t.mul(this.rinv));return F.red=null,F},Ho.prototype.imul=function(t,F){if(t.isZero()||F.isZero())return t.words[0]=0,t.length=1,t;var Ie=t.imul(F),Te=Ie.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Xr=Ie.isub(Te).iushrn(this.shift),ei=Xr;return Xr.cmp(this.m)>=0?ei=Xr.isub(this.m):Xr.cmpn(0)<0&&(ei=Xr.iadd(this.m)),ei._forceRed(this)},Ho.prototype.mul=function(t,F){if(t.isZero()||F.isZero())return new W(0)._forceRed(this);var Ie=t.mul(F),Te=Ie.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),Xr=Ie.isub(Te).iushrn(this.shift),ei=Xr;return Xr.cmp(this.m)>=0?ei=Xr.isub(this.m):Xr.cmpn(0)<0&&(ei=Xr.iadd(this.m)),ei._forceRed(this)},Ho.prototype.invm=function(t){var F=this.imod(t._invmp(this.m).mul(this.r2));return F._forceRed(this)}})(G,commonjsGlobal)}(bn$1)),bn$1.exports}var withPublic_1,hasRequiredWithPublic;function requireWithPublic(){if(hasRequiredWithPublic)return withPublic_1;hasRequiredWithPublic=1;var G=requireBn(),e=safeBufferExports.Buffer;function H(Y,Ne){return e.from(Y.toRed(G.mont(Ne.modulus)).redPow(new G(Ne.publicExponent)).fromRed().toArray())}return withPublic_1=H,withPublic_1}var publicEncrypt,hasRequiredPublicEncrypt;function requirePublicEncrypt(){if(hasRequiredPublicEncrypt)return publicEncrypt;hasRequiredPublicEncrypt=1;var G=requireParseAsn1(),e=requireBrowser$a(),H=requireBrowser$9(),Y=requireMgf(),Ne=requireXor(),W=requireBn(),ri=requireWithPublic(),si=requireBrowserifyRsa(),fi=safeBufferExports.Buffer;publicEncrypt=function(ui,li,mi){var hn;ui.padding?hn=ui.padding:mi?hn=1:hn=4;var ln=G(ui),fn;if(hn===4)fn=ai(ln,li);else if(hn===1)fn=ti(ln,li,mi);else if(hn===3){if(fn=new W(li),fn.cmp(ln.modulus)>=0)throw new Error("data too long for modulus")}else throw new Error("unknown padding");return mi?si(fn,ln):ri(fn,ln)};function ai(ci,ui){var li=ci.modulus.byteLength(),mi=ui.length,hn=H("sha1").update(fi.alloc(0)).digest(),ln=hn.length,fn=2*ln;if(mi>li-fn-2)throw new Error("message too long");var gn=fi.alloc(li-mi-fn-2),cn=li-ln-1,An=e(ln),Cn=Ne(fi.concat([hn,gn,fi.alloc(1,1),ui],cn),Y(An,cn)),an=Ne(An,Y(Cn,ln));return new W(fi.concat([fi.alloc(1),an,Cn],li))}function ti(ci,ui,li){var mi=ui.length,hn=ci.modulus.byteLength();if(mi>hn-11)throw new Error("message too long");var ln;return li?ln=fi.alloc(hn-mi-3,255):ln=hi(hn-mi-3),new W(fi.concat([fi.from([0,li?1:2]),ln,fi.alloc(1),ui],hn))}function hi(ci){for(var ui=fi.allocUnsafe(ci),li=0,mi=e(ci*2),hn=0,ln;liln||new Y(ui).cmp(hn.modulus)>=0)throw new Error("decryption error");var fn;li?fn=ri(new Y(ui),hn):fn=Ne(ui,hn);var gn=si.alloc(ln-fn.length);if(fn=si.concat([gn,fn],ln),mi===4)return fi(hn,fn);if(mi===1)return ai(hn,fn,li);if(mi===3)return fn;throw new Error("unknown padding")};function fi(hi,ci){var ui=hi.modulus.byteLength(),li=W("sha1").update(si.alloc(0)).digest(),mi=li.length;if(ci[0]!==0)throw new Error("decryption error");var hn=ci.slice(1,mi+1),ln=ci.slice(mi+1),fn=H(hn,e(ln,mi)),gn=H(ln,e(fn,ui-mi-1));if(ti(li,gn.slice(0,mi)))throw new Error("decryption error");for(var cn=mi;gn[cn]===0;)cn++;if(gn[cn++]!==1)throw new Error("decryption error");return gn.slice(cn)}function ai(hi,ci,ui){for(var li=ci.slice(0,2),mi=2,hn=0;ci[mi++]!==0;)if(mi>=ci.length){hn++;break}var ln=ci.slice(2,mi-1);if((li.toString("hex")!=="0002"&&!ui||li.toString("hex")!=="0001"&&ui)&&hn++,ln.length<8&&hn++,hn)throw new Error("decryption error");return ci.slice(mi)}function ti(hi,ci){hi=si.from(hi),ci=si.from(ci);var ui=0,li=hi.length;hi.length!==ci.length&&(ui++,li=Math.min(hi.length,ci.length));for(var mi=-1;++miri||ci<0)throw new TypeError("offset must be a uint32");if(ci>Ne||ci>ui)throw new RangeError("offset out of range")}function fi(ci,ui,li){if(typeof ci!="number"||ci!==ci)throw new TypeError("size must be a number");if(ci>ri||ci<0)throw new TypeError("size must be a uint32");if(ci+ui>li||ci>Ne)throw new RangeError("buffer too small")}W&&W.getRandomValues||!process$1.browser?(browser$2.randomFill=ai,browser$2.randomFillSync=hi):(browser$2.randomFill=G,browser$2.randomFillSync=G);function ai(ci,ui,li,mi){if(!Y.isBuffer(ci)&&!(ci instanceof commonjsGlobal.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');if(typeof ui=="function")mi=ui,ui=0,li=ci.length;else if(typeof li=="function")mi=li,li=ci.length-ui;else if(typeof mi!="function")throw new TypeError('"cb" argument must be a function');return si(ui,ci.length),fi(li,ui,ci.length),ti(ci,ui,li,mi)}function ti(ci,ui,li,mi){if(process$1.browser){var hn=ci.buffer,ln=new Uint8Array(hn,ui,li);if(W.getRandomValues(ln),mi){process$1.nextTick(function(){mi(null,ci)});return}return ci}if(mi){H(li,function(gn,cn){if(gn)return mi(gn);cn.copy(ci,ui),mi(null,ci)});return}var fn=H(li);return fn.copy(ci,ui),ci}function hi(ci,ui,li){if(typeof ui>"u"&&(ui=0),!Y.isBuffer(ci)&&!(ci instanceof commonjsGlobal.Uint8Array))throw new TypeError('"buf" argument must be a Buffer or Uint8Array');return si(ui,ci.length),li===void 0&&(li=ci.length-ui),fi(li,ui,ci.length),ti(ci,ui,li)}return browser$2}var hasRequiredCryptoBrowserify;function requireCryptoBrowserify(){if(hasRequiredCryptoBrowserify)return cryptoBrowserify;hasRequiredCryptoBrowserify=1,cryptoBrowserify.randomBytes=cryptoBrowserify.rng=cryptoBrowserify.pseudoRandomBytes=cryptoBrowserify.prng=requireBrowser$a(),cryptoBrowserify.createHash=cryptoBrowserify.Hash=requireBrowser$9(),cryptoBrowserify.createHmac=cryptoBrowserify.Hmac=requireBrowser$8();var G=requireAlgos(),e=Object.keys(G),H=["sha1","sha224","sha256","sha384","sha512","md5","rmd160"].concat(e);cryptoBrowserify.getHashes=function(){return H};var Y=requireBrowser$7();cryptoBrowserify.pbkdf2=Y.pbkdf2,cryptoBrowserify.pbkdf2Sync=Y.pbkdf2Sync;var Ne=requireBrowser$5();cryptoBrowserify.Cipher=Ne.Cipher,cryptoBrowserify.createCipher=Ne.createCipher,cryptoBrowserify.Cipheriv=Ne.Cipheriv,cryptoBrowserify.createCipheriv=Ne.createCipheriv,cryptoBrowserify.Decipher=Ne.Decipher,cryptoBrowserify.createDecipher=Ne.createDecipher,cryptoBrowserify.Decipheriv=Ne.Decipheriv,cryptoBrowserify.createDecipheriv=Ne.createDecipheriv,cryptoBrowserify.getCiphers=Ne.getCiphers,cryptoBrowserify.listCiphers=Ne.listCiphers;var W=requireBrowser$4();cryptoBrowserify.DiffieHellmanGroup=W.DiffieHellmanGroup,cryptoBrowserify.createDiffieHellmanGroup=W.createDiffieHellmanGroup,cryptoBrowserify.getDiffieHellman=W.getDiffieHellman,cryptoBrowserify.createDiffieHellman=W.createDiffieHellman,cryptoBrowserify.DiffieHellman=W.DiffieHellman;var ri=requireBrowser$3();cryptoBrowserify.createSign=ri.createSign,cryptoBrowserify.Sign=ri.Sign,cryptoBrowserify.createVerify=ri.createVerify,cryptoBrowserify.Verify=ri.Verify,cryptoBrowserify.createECDH=requireBrowser$2();var si=requireBrowser$1();cryptoBrowserify.publicEncrypt=si.publicEncrypt,cryptoBrowserify.privateEncrypt=si.privateEncrypt,cryptoBrowserify.publicDecrypt=si.publicDecrypt,cryptoBrowserify.privateDecrypt=si.privateDecrypt;var fi=requireBrowser();return cryptoBrowserify.randomFill=fi.randomFill,cryptoBrowserify.randomFillSync=fi.randomFillSync,cryptoBrowserify.createCredentials=function(){throw new Error(["sorry, createCredentials is not implemented yet","we accept pull requests","https://github.com/crypto-browserify/crypto-browserify"].join(` -`))},cryptoBrowserify.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6},cryptoBrowserify}Object.defineProperty(node$1,"__esModule",{value:!0});node$1.NodeRandomSource=void 0;const wipe_1=wipe$1;class NodeRandomSource{constructor(){if(this.isAvailable=!1,this.isInstantiated=!1,typeof commonjsRequire<"u"){const e=requireCryptoBrowserify();e&&e.randomBytes&&(this._crypto=e,this.isAvailable=!0,this.isInstantiated=!0)}}randomBytes(e){if(!this.isAvailable||!this._crypto)throw new Error("Node.js random byte generator is not available.");let H=this._crypto.randomBytes(e);if(H.length!==e)throw new Error("NodeRandomSource: got fewer bytes than requested");const Y=new Uint8Array(e);for(let Ne=0;Ne256)throw new Error("randomString charset is too long");let ci="";const ui=ti.length,li=256-256%ui;for(;ai>0;){const mi=Ne(Math.ceil(ai*256/li),hi);for(let hn=0;hn0;hn++){const ln=mi[hn];ln0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=fi[ti++],ai--;this._bufferLength===this.blockSize&&(W(this._temp,this._state,this._buffer,0,this.blockSize),this._bufferLength=0)}for(ai>=this.blockSize&&(ti=W(this._temp,this._state,fi,ti,ai),ai%=this.blockSize);ai>0;)this._buffer[this._bufferLength++]=fi[ti++],ai--;return this},si.prototype.finish=function(fi){if(!this._finished){var ai=this._bytesHashed,ti=this._bufferLength,hi=ai/536870912|0,ci=ai<<3,ui=ai%64<56?64:128;this._buffer[ti]=128;for(var li=ti+1;li0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},si.prototype.restoreState=function(fi){return this._state.set(fi.state),this._bufferLength=fi.bufferLength,fi.buffer&&this._buffer.set(fi.buffer),this._bytesHashed=fi.bytesHashed,this._finished=!1,this},si.prototype.cleanSavedState=function(fi){H.wipe(fi.state),fi.buffer&&H.wipe(fi.buffer),fi.bufferLength=0,fi.bytesHashed=0},si}();G.SHA256=Y;var Ne=new Int32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]);function W(si,fi,ai,ti,hi){for(;hi>=64;){for(var ci=fi[0],ui=fi[1],li=fi[2],mi=fi[3],hn=fi[4],ln=fi[5],fn=fi[6],gn=fi[7],cn=0;cn<16;cn++){var An=ti+cn*4;si[cn]=e.readUint32BE(ai,An)}for(var cn=16;cn<64;cn++){var Cn=si[cn-2],an=(Cn>>>17|Cn<<15)^(Cn>>>19|Cn<<13)^Cn>>>10;Cn=si[cn-15];var Rn=(Cn>>>7|Cn<<25)^(Cn>>>18|Cn<<14)^Cn>>>3;si[cn]=(an+si[cn-7]|0)+(Rn+si[cn-16]|0)}for(var cn=0;cn<64;cn++){var an=(((hn>>>6|hn<<26)^(hn>>>11|hn<<21)^(hn>>>25|hn<<7))+(hn&ln^~hn&fn)|0)+(gn+(Ne[cn]+si[cn]|0)|0)|0,Rn=((ci>>>2|ci<<30)^(ci>>>13|ci<<19)^(ci>>>22|ci<<10))+(ci&ui^ci&li^ui&li)|0;gn=fn,fn=ln,ln=hn,hn=mi+an|0,mi=li,li=ui,ui=ci,ci=an+Rn|0}fi[0]+=ci,fi[1]+=ui,fi[2]+=li,fi[3]+=mi,fi[4]+=hn,fi[5]+=ln,fi[6]+=fn,fi[7]+=gn,ti+=64,hi-=64}return ti}function ri(si){var fi=new Y;fi.update(si);var ai=fi.digest();return fi.clean(),ai}G.hash=ri})(sha256);var x25519={};(function(G){Object.defineProperty(G,"__esModule",{value:!0}),G.sharedKey=G.generateKeyPair=G.generateKeyPairFromSeed=G.scalarMultBase=G.scalarMult=G.SHARED_KEY_LENGTH=G.SECRET_KEY_LENGTH=G.PUBLIC_KEY_LENGTH=void 0;const e=random,H=wipe$1;G.PUBLIC_KEY_LENGTH=32,G.SECRET_KEY_LENGTH=32,G.SHARED_KEY_LENGTH=32;function Y(cn){const An=new Float64Array(16);if(cn)for(let Cn=0;Cn>16&1),Cn[Ho-1]&=65535;Cn[15]=an[15]-32767-(Cn[14]>>16&1);const Ya=Cn[15]>>16&1;Cn[14]&=65535,si(an,Cn,1-Ya)}for(let Rn=0;Rn<16;Rn++)cn[2*Rn]=an[Rn]&255,cn[2*Rn+1]=an[Rn]>>8}function ai(cn,An){for(let Cn=0;Cn<16;Cn++)cn[Cn]=An[2*Cn]+(An[2*Cn+1]<<8);cn[15]&=32767}function ti(cn,An,Cn){for(let an=0;an<16;an++)cn[an]=An[an]+Cn[an]}function hi(cn,An,Cn){for(let an=0;an<16;an++)cn[an]=An[an]-Cn[an]}function ci(cn,An,Cn){let an,Rn,Ya=0,Ho=0,oi=0,t=0,F=0,Ie=0,Te=0,Xr=0,ei=0,ii=0,Wr=0,R=0,Le=0,nn=0,vn=0,Mn=0,sn=0,Zn=0,on=0,pn=0,mn=0,$i=0,ho=0,Do=0,To=0,Oh=0,Fo=0,Vo=0,Hh=0,Ah=0,Qf=0,Gh=Cn[0],tf=Cn[1],Ko=Cn[2],Kh=Cn[3],Lf=Cn[4],Uo=Cn[5],Vh=Cn[6],jf=Cn[7],Zo=Cn[8],Wh=Cn[9],vh=Cn[10],Yo=Cn[11],Jh=Cn[12],xh=Cn[13],Vf=Cn[14],Zh=Cn[15];an=An[0],Ya+=an*Gh,Ho+=an*tf,oi+=an*Ko,t+=an*Kh,F+=an*Lf,Ie+=an*Uo,Te+=an*Vh,Xr+=an*jf,ei+=an*Zo,ii+=an*Wh,Wr+=an*vh,R+=an*Yo,Le+=an*Jh,nn+=an*xh,vn+=an*Vf,Mn+=an*Zh,an=An[1],Ho+=an*Gh,oi+=an*tf,t+=an*Ko,F+=an*Kh,Ie+=an*Lf,Te+=an*Uo,Xr+=an*Vh,ei+=an*jf,ii+=an*Zo,Wr+=an*Wh,R+=an*vh,Le+=an*Yo,nn+=an*Jh,vn+=an*xh,Mn+=an*Vf,sn+=an*Zh,an=An[2],oi+=an*Gh,t+=an*tf,F+=an*Ko,Ie+=an*Kh,Te+=an*Lf,Xr+=an*Uo,ei+=an*Vh,ii+=an*jf,Wr+=an*Zo,R+=an*Wh,Le+=an*vh,nn+=an*Yo,vn+=an*Jh,Mn+=an*xh,sn+=an*Vf,Zn+=an*Zh,an=An[3],t+=an*Gh,F+=an*tf,Ie+=an*Ko,Te+=an*Kh,Xr+=an*Lf,ei+=an*Uo,ii+=an*Vh,Wr+=an*jf,R+=an*Zo,Le+=an*Wh,nn+=an*vh,vn+=an*Yo,Mn+=an*Jh,sn+=an*xh,Zn+=an*Vf,on+=an*Zh,an=An[4],F+=an*Gh,Ie+=an*tf,Te+=an*Ko,Xr+=an*Kh,ei+=an*Lf,ii+=an*Uo,Wr+=an*Vh,R+=an*jf,Le+=an*Zo,nn+=an*Wh,vn+=an*vh,Mn+=an*Yo,sn+=an*Jh,Zn+=an*xh,on+=an*Vf,pn+=an*Zh,an=An[5],Ie+=an*Gh,Te+=an*tf,Xr+=an*Ko,ei+=an*Kh,ii+=an*Lf,Wr+=an*Uo,R+=an*Vh,Le+=an*jf,nn+=an*Zo,vn+=an*Wh,Mn+=an*vh,sn+=an*Yo,Zn+=an*Jh,on+=an*xh,pn+=an*Vf,mn+=an*Zh,an=An[6],Te+=an*Gh,Xr+=an*tf,ei+=an*Ko,ii+=an*Kh,Wr+=an*Lf,R+=an*Uo,Le+=an*Vh,nn+=an*jf,vn+=an*Zo,Mn+=an*Wh,sn+=an*vh,Zn+=an*Yo,on+=an*Jh,pn+=an*xh,mn+=an*Vf,$i+=an*Zh,an=An[7],Xr+=an*Gh,ei+=an*tf,ii+=an*Ko,Wr+=an*Kh,R+=an*Lf,Le+=an*Uo,nn+=an*Vh,vn+=an*jf,Mn+=an*Zo,sn+=an*Wh,Zn+=an*vh,on+=an*Yo,pn+=an*Jh,mn+=an*xh,$i+=an*Vf,ho+=an*Zh,an=An[8],ei+=an*Gh,ii+=an*tf,Wr+=an*Ko,R+=an*Kh,Le+=an*Lf,nn+=an*Uo,vn+=an*Vh,Mn+=an*jf,sn+=an*Zo,Zn+=an*Wh,on+=an*vh,pn+=an*Yo,mn+=an*Jh,$i+=an*xh,ho+=an*Vf,Do+=an*Zh,an=An[9],ii+=an*Gh,Wr+=an*tf,R+=an*Ko,Le+=an*Kh,nn+=an*Lf,vn+=an*Uo,Mn+=an*Vh,sn+=an*jf,Zn+=an*Zo,on+=an*Wh,pn+=an*vh,mn+=an*Yo,$i+=an*Jh,ho+=an*xh,Do+=an*Vf,To+=an*Zh,an=An[10],Wr+=an*Gh,R+=an*tf,Le+=an*Ko,nn+=an*Kh,vn+=an*Lf,Mn+=an*Uo,sn+=an*Vh,Zn+=an*jf,on+=an*Zo,pn+=an*Wh,mn+=an*vh,$i+=an*Yo,ho+=an*Jh,Do+=an*xh,To+=an*Vf,Oh+=an*Zh,an=An[11],R+=an*Gh,Le+=an*tf,nn+=an*Ko,vn+=an*Kh,Mn+=an*Lf,sn+=an*Uo,Zn+=an*Vh,on+=an*jf,pn+=an*Zo,mn+=an*Wh,$i+=an*vh,ho+=an*Yo,Do+=an*Jh,To+=an*xh,Oh+=an*Vf,Fo+=an*Zh,an=An[12],Le+=an*Gh,nn+=an*tf,vn+=an*Ko,Mn+=an*Kh,sn+=an*Lf,Zn+=an*Uo,on+=an*Vh,pn+=an*jf,mn+=an*Zo,$i+=an*Wh,ho+=an*vh,Do+=an*Yo,To+=an*Jh,Oh+=an*xh,Fo+=an*Vf,Vo+=an*Zh,an=An[13],nn+=an*Gh,vn+=an*tf,Mn+=an*Ko,sn+=an*Kh,Zn+=an*Lf,on+=an*Uo,pn+=an*Vh,mn+=an*jf,$i+=an*Zo,ho+=an*Wh,Do+=an*vh,To+=an*Yo,Oh+=an*Jh,Fo+=an*xh,Vo+=an*Vf,Hh+=an*Zh,an=An[14],vn+=an*Gh,Mn+=an*tf,sn+=an*Ko,Zn+=an*Kh,on+=an*Lf,pn+=an*Uo,mn+=an*Vh,$i+=an*jf,ho+=an*Zo,Do+=an*Wh,To+=an*vh,Oh+=an*Yo,Fo+=an*Jh,Vo+=an*xh,Hh+=an*Vf,Ah+=an*Zh,an=An[15],Mn+=an*Gh,sn+=an*tf,Zn+=an*Ko,on+=an*Kh,pn+=an*Lf,mn+=an*Uo,$i+=an*Vh,ho+=an*jf,Do+=an*Zo,To+=an*Wh,Oh+=an*vh,Fo+=an*Yo,Vo+=an*Jh,Hh+=an*xh,Ah+=an*Vf,Qf+=an*Zh,Ya+=38*sn,Ho+=38*Zn,oi+=38*on,t+=38*pn,F+=38*mn,Ie+=38*$i,Te+=38*ho,Xr+=38*Do,ei+=38*To,ii+=38*Oh,Wr+=38*Fo,R+=38*Vo,Le+=38*Hh,nn+=38*Ah,vn+=38*Qf,Rn=1,an=Ya+Rn+65535,Rn=Math.floor(an/65536),Ya=an-Rn*65536,an=Ho+Rn+65535,Rn=Math.floor(an/65536),Ho=an-Rn*65536,an=oi+Rn+65535,Rn=Math.floor(an/65536),oi=an-Rn*65536,an=t+Rn+65535,Rn=Math.floor(an/65536),t=an-Rn*65536,an=F+Rn+65535,Rn=Math.floor(an/65536),F=an-Rn*65536,an=Ie+Rn+65535,Rn=Math.floor(an/65536),Ie=an-Rn*65536,an=Te+Rn+65535,Rn=Math.floor(an/65536),Te=an-Rn*65536,an=Xr+Rn+65535,Rn=Math.floor(an/65536),Xr=an-Rn*65536,an=ei+Rn+65535,Rn=Math.floor(an/65536),ei=an-Rn*65536,an=ii+Rn+65535,Rn=Math.floor(an/65536),ii=an-Rn*65536,an=Wr+Rn+65535,Rn=Math.floor(an/65536),Wr=an-Rn*65536,an=R+Rn+65535,Rn=Math.floor(an/65536),R=an-Rn*65536,an=Le+Rn+65535,Rn=Math.floor(an/65536),Le=an-Rn*65536,an=nn+Rn+65535,Rn=Math.floor(an/65536),nn=an-Rn*65536,an=vn+Rn+65535,Rn=Math.floor(an/65536),vn=an-Rn*65536,an=Mn+Rn+65535,Rn=Math.floor(an/65536),Mn=an-Rn*65536,Ya+=Rn-1+37*(Rn-1),Rn=1,an=Ya+Rn+65535,Rn=Math.floor(an/65536),Ya=an-Rn*65536,an=Ho+Rn+65535,Rn=Math.floor(an/65536),Ho=an-Rn*65536,an=oi+Rn+65535,Rn=Math.floor(an/65536),oi=an-Rn*65536,an=t+Rn+65535,Rn=Math.floor(an/65536),t=an-Rn*65536,an=F+Rn+65535,Rn=Math.floor(an/65536),F=an-Rn*65536,an=Ie+Rn+65535,Rn=Math.floor(an/65536),Ie=an-Rn*65536,an=Te+Rn+65535,Rn=Math.floor(an/65536),Te=an-Rn*65536,an=Xr+Rn+65535,Rn=Math.floor(an/65536),Xr=an-Rn*65536,an=ei+Rn+65535,Rn=Math.floor(an/65536),ei=an-Rn*65536,an=ii+Rn+65535,Rn=Math.floor(an/65536),ii=an-Rn*65536,an=Wr+Rn+65535,Rn=Math.floor(an/65536),Wr=an-Rn*65536,an=R+Rn+65535,Rn=Math.floor(an/65536),R=an-Rn*65536,an=Le+Rn+65535,Rn=Math.floor(an/65536),Le=an-Rn*65536,an=nn+Rn+65535,Rn=Math.floor(an/65536),nn=an-Rn*65536,an=vn+Rn+65535,Rn=Math.floor(an/65536),vn=an-Rn*65536,an=Mn+Rn+65535,Rn=Math.floor(an/65536),Mn=an-Rn*65536,Ya+=Rn-1+37*(Rn-1),cn[0]=Ya,cn[1]=Ho,cn[2]=oi,cn[3]=t,cn[4]=F,cn[5]=Ie,cn[6]=Te,cn[7]=Xr,cn[8]=ei,cn[9]=ii,cn[10]=Wr,cn[11]=R,cn[12]=Le,cn[13]=nn,cn[14]=vn,cn[15]=Mn}function ui(cn,An){ci(cn,An,An)}function li(cn,An){const Cn=Y();for(let an=0;an<16;an++)Cn[an]=An[an];for(let an=253;an>=0;an--)ui(Cn,Cn),an!==2&&an!==4&&ci(Cn,Cn,An);for(let an=0;an<16;an++)cn[an]=Cn[an]}function mi(cn,An){const Cn=new Uint8Array(32),an=new Float64Array(80),Rn=Y(),Ya=Y(),Ho=Y(),oi=Y(),t=Y(),F=Y();for(let ei=0;ei<31;ei++)Cn[ei]=cn[ei];Cn[31]=cn[31]&127|64,Cn[0]&=248,ai(an,An);for(let ei=0;ei<16;ei++)Ya[ei]=an[ei];Rn[0]=oi[0]=1;for(let ei=254;ei>=0;--ei){const ii=Cn[ei>>>3]>>>(ei&7)&1;si(Rn,Ya,ii),si(Ho,oi,ii),ti(t,Rn,Ho),hi(Rn,Rn,Ho),ti(Ho,Ya,oi),hi(Ya,Ya,oi),ui(oi,t),ui(F,Rn),ci(Rn,Ho,Rn),ci(Ho,Ya,t),ti(t,Rn,Ho),hi(Rn,Rn,Ho),ui(Ya,Rn),hi(Ho,oi,F),ci(Rn,Ho,W),ti(Rn,Rn,oi),ci(Ho,Ho,Rn),ci(Rn,oi,F),ci(oi,Ya,an),ui(Ya,t),si(Rn,Ya,ii),si(Ho,oi,ii)}for(let ei=0;ei<16;ei++)an[ei+16]=Rn[ei],an[ei+32]=Ho[ei],an[ei+48]=Ya[ei],an[ei+64]=oi[ei];const Ie=an.subarray(32),Te=an.subarray(16);li(Ie,Ie),ci(Te,Te,Ie);const Xr=new Uint8Array(32);return fi(Xr,Te),Xr}G.scalarMult=mi;function hn(cn){return mi(cn,Ne)}G.scalarMultBase=hn;function ln(cn){if(cn.length!==G.SECRET_KEY_LENGTH)throw new Error(`x25519: seed must be ${G.SECRET_KEY_LENGTH} bytes`);const An=new Uint8Array(cn);return{publicKey:hn(An),secretKey:An}}G.generateKeyPairFromSeed=ln;function fn(cn){const An=(0,e.randomBytes)(32,cn),Cn=ln(An);return(0,H.wipe)(An),Cn}G.generateKeyPair=fn;function gn(cn,An,Cn=!1){if(cn.length!==G.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect secret key length");if(An.length!==G.PUBLIC_KEY_LENGTH)throw new Error("X25519: incorrect public key length");const an=mi(cn,An);if(Cn){let Rn=0;for(let Ya=0;YaNe+W.length,0));const H=allocUnsafe$1(e);let Y=0;for(const Ne of G)H.set(Ne,Y),Y+=Ne.length;return H}function base(G,e){if(G.length>=255)throw new TypeError("Alphabet too long");for(var H=new Uint8Array(256),Y=0;Y>>0,cn=new Uint8Array(gn);ln!==fn;){for(var An=li[ln],Cn=0,an=gn-1;(An!==0||Cn>>0,cn[an]=An%si>>>0,An=An/si>>>0;if(An!==0)throw new Error("Non-zero carry");hn=Cn,ln++}for(var Rn=gn-hn;Rn!==gn&&cn[Rn]===0;)Rn++;for(var Ya=fi.repeat(mi);Rn>>0,gn=new Uint8Array(fn);li[mi];){var cn=H[li.charCodeAt(mi)];if(cn===255)return;for(var An=0,Cn=fn-1;(cn!==0||An>>0,gn[Cn]=cn%256>>>0,cn=cn/256>>>0;if(cn!==0)throw new Error("Non-zero carry");ln=An,mi++}if(li[mi]!==" "){for(var an=fn-ln;an!==fn&&gn[an]===0;)an++;for(var Rn=new Uint8Array(hn+(fn-an)),Ya=hn;an!==fn;)Rn[Ya++]=gn[an++];return Rn}}}function ui(li){var mi=ci(li);if(mi)return mi;throw new Error(`Non-${e} character`)}return{encode:hi,decodeUnsafe:ci,decode:ui}}var src=base,_brrp__multiformats_scope_baseX=src;const coerce=G=>{if(G instanceof Uint8Array&&G.constructor.name==="Uint8Array")return G;if(G instanceof ArrayBuffer)return new Uint8Array(G);if(ArrayBuffer.isView(G))return new Uint8Array(G.buffer,G.byteOffset,G.byteLength);throw new Error("Unknown type, must be binary type")},fromString$2=G=>new TextEncoder().encode(G),toString$2=G=>new TextDecoder().decode(G);class Encoder{constructor(e,H,Y){this.name=e,this.prefix=H,this.baseEncode=Y}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}class Decoder{constructor(e,H,Y){if(this.name=e,this.prefix=H,H.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=H.codePointAt(0),this.baseDecode=Y}decode(e){if(typeof e=="string"){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))}else throw Error("Can only multibase decode strings")}or(e){return or$2(this,e)}}class ComposedDecoder{constructor(e){this.decoders=e}or(e){return or$2(this,e)}decode(e){const H=e[0],Y=this.decoders[H];if(Y)return Y.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}}const or$2=(G,e)=>new ComposedDecoder({...G.decoders||{[G.prefix]:G},...e.decoders||{[e.prefix]:e}});class Codec{constructor(e,H,Y,Ne){this.name=e,this.prefix=H,this.baseEncode=Y,this.baseDecode=Ne,this.encoder=new Encoder(e,H,Y),this.decoder=new Decoder(e,H,Ne)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}}const from=({name:G,prefix:e,encode:H,decode:Y})=>new Codec(G,e,H,Y),baseX=({prefix:G,name:e,alphabet:H})=>{const{encode:Y,decode:Ne}=_brrp__multiformats_scope_baseX(H,e);return from({prefix:G,name:e,encode:Y,decode:W=>coerce(Ne(W))})},decode$1=(G,e,H,Y)=>{const Ne={};for(let ti=0;ti=8&&(si-=8,ri[ai++]=255&fi>>si)}if(si>=H||255&fi<<8-si)throw new SyntaxError("Unexpected end of data");return ri},encode$1=(G,e,H)=>{const Y=e[e.length-1]==="=",Ne=(1<H;)ri-=H,W+=e[Ne&si>>ri];if(ri&&(W+=e[Ne&si<from({prefix:e,name:G,encode(Ne){return encode$1(Ne,Y,H)},decode(Ne){return decode$1(Ne,Y,H,G)}}),identity=from({prefix:"\0",name:"identity",encode:G=>toString$2(G),decode:G=>fromString$2(G)}),identityBase=Object.freeze(Object.defineProperty({__proto__:null,identity},Symbol.toStringTag,{value:"Module"})),base2=rfc4648({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1}),base2$1=Object.freeze(Object.defineProperty({__proto__:null,base2},Symbol.toStringTag,{value:"Module"})),base8=rfc4648({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3}),base8$1=Object.freeze(Object.defineProperty({__proto__:null,base8},Symbol.toStringTag,{value:"Module"})),base10=baseX({prefix:"9",name:"base10",alphabet:"0123456789"}),base10$1=Object.freeze(Object.defineProperty({__proto__:null,base10},Symbol.toStringTag,{value:"Module"})),base16=rfc4648({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),base16upper=rfc4648({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4}),base16$1=Object.freeze(Object.defineProperty({__proto__:null,base16,base16upper},Symbol.toStringTag,{value:"Module"})),base32=rfc4648({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),base32upper=rfc4648({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),base32pad=rfc4648({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),base32padupper=rfc4648({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),base32hex=rfc4648({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),base32hexupper=rfc4648({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),base32hexpad=rfc4648({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),base32hexpadupper=rfc4648({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),base32z=rfc4648({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5}),base32$1=Object.freeze(Object.defineProperty({__proto__:null,base32,base32hex,base32hexpad,base32hexpadupper,base32hexupper,base32pad,base32padupper,base32upper,base32z},Symbol.toStringTag,{value:"Module"})),base36=baseX({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),base36upper=baseX({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"}),base36$1=Object.freeze(Object.defineProperty({__proto__:null,base36,base36upper},Symbol.toStringTag,{value:"Module"})),base58btc=baseX({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),base58flickr=baseX({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"}),base58=Object.freeze(Object.defineProperty({__proto__:null,base58btc,base58flickr},Symbol.toStringTag,{value:"Module"})),base64=rfc4648({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),base64pad=rfc4648({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),base64url=rfc4648({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),base64urlpad=rfc4648({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6}),base64$1=Object.freeze(Object.defineProperty({__proto__:null,base64,base64pad,base64url,base64urlpad},Symbol.toStringTag,{value:"Module"})),alphabet=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),alphabetBytesToChars=alphabet.reduce((G,e,H)=>(G[H]=e,G),[]),alphabetCharsToBytes=alphabet.reduce((G,e,H)=>(G[e.codePointAt(0)]=H,G),[]);function encode(G){return G.reduce((e,H)=>(e+=alphabetBytesToChars[H],e),"")}function decode(G){const e=[];for(const H of G){const Y=alphabetCharsToBytes[H.codePointAt(0)];if(Y===void 0)throw new Error(`Non-base256emoji character: ${H}`);e.push(Y)}return new Uint8Array(e)}const base256emoji=from({prefix:"🚀",name:"base256emoji",encode,decode}),base256emoji$1=Object.freeze(Object.defineProperty({__proto__:null,base256emoji},Symbol.toStringTag,{value:"Module"}));new TextEncoder;new TextDecoder;const bases={...identityBase,...base2$1,...base8$1,...base10$1,...base16$1,...base32$1,...base36$1,...base58,...base64$1,...base256emoji$1};function createCodec$1(G,e,H,Y){return{name:G,prefix:e,encoder:{name:G,prefix:e,encode:H},decoder:{decode:Y}}}const string$1=createCodec$1("utf8","u",G=>"u"+new TextDecoder("utf8").decode(G),G=>new TextEncoder().encode(G.substring(1))),ascii$1=createCodec$1("ascii","a",G=>{let e="a";for(let H=0;H{G=G.substring(1);const e=allocUnsafe$1(G.length);for(let H=0;H{if(e.length&&!e.includes(Y))return;const Ne=G[Y];H.push(...Ne.accounts)}),H}function _r$1(G,e){return G.includes(":")?[G]:e.chains||[]}var Qo=Object.defineProperty,bn=Object.getOwnPropertySymbols,Jo=Object.prototype.hasOwnProperty,Go=Object.prototype.propertyIsEnumerable,yn=(G,e,H)=>e in G?Qo(G,e,{enumerable:!0,configurable:!0,writable:!0,value:H}):G[e]=H,wn=(G,e)=>{for(var H in e||(e={}))Jo.call(e,H)&&yn(G,H,e[H]);if(bn)for(var H of bn(e))Go.call(e,H)&&yn(G,H,e[H]);return G};const xn="ReactNative",qt$1={reactNative:"react-native",node:"node",browser:"browser",unknown:"unknown"},En="js";function pi(){return typeof process$1<"u"&&typeof process$1.versions<"u"&&typeof process$1.versions.node<"u"}function er$1(){return!getDocument_1()&&!!getNavigator_1()&&navigator.product===xn}function pr$1(){return!pi()&&!!getNavigator_1()&&!!getDocument_1()}function We$2(){return er$1()?qt$1.reactNative:pi()?qt$1.node:pr$1()?qt$1.browser:qt$1.unknown}function Wo(){var G;try{return er$1()&&typeof global<"u"&&typeof(global==null?void 0:global.Application)<"u"?(G=global.Application)==null?void 0:G.applicationId:void 0}catch{return}}function Sn(G,e){let H=queryString.parse(G);return H=wn(wn({},H),e),G=queryString.stringify(H),G}function Xo(){return getWindowMetadata_1()||{name:"",description:"",url:"",icons:[""]}}function Nn(){if(We$2()===qt$1.reactNative&&typeof global<"u"&&typeof(global==null?void 0:global.Platform)<"u"){const{OS:H,Version:Y}=global.Platform;return[H,Y].join("-")}const G=detect();if(G===null)return"unknown";const e=G.os?G.os.replace(" ","").toLowerCase():"unknown";return G.type==="browser"?[e,G.name,G.version].join("-"):[e,G.version].join("-")}function In(){var G;const e=We$2();return e===qt$1.browser?[e,((G=getLocation_1())==null?void 0:G.host)||"unknown"].join(":"):e}function _n(G,e,H){const Y=Nn(),Ne=In();return[[G,e].join("-"),[En,H].join("-"),Y,Ne].join("/")}function $o({protocol:G,version:e,relayUrl:H,sdkVersion:Y,auth:Ne,projectId:W,useOnCloseEvent:ri,bundleId:si}){const fi=H.split("?"),ai=_n(G,e,Y),ti={auth:Ne,ua:ai,projectId:W,useOnCloseEvent:ri||void 0,origin:si||void 0},hi=Sn(fi[1]||"",ti);return fi[0]+"?"+hi}function _e$1(G,e){return G.filter(H=>e.includes(H)).length===G.length}function i0(G){return Object.fromEntries(G.entries())}function n0(G){return new Map(Object.entries(G))}function a0(G=cjs$3.FIVE_MINUTES,e){const H=cjs$3.toMiliseconds(G||cjs$3.FIVE_MINUTES);let Y,Ne,W;return{resolve:ri=>{W&&Y&&(clearTimeout(W),Y(ri))},reject:ri=>{W&&Ne&&(clearTimeout(W),Ne(ri))},done:()=>new Promise((ri,si)=>{W=setTimeout(()=>{si(new Error(e))},H),Y=ri,Ne=si})}}function u0(G,e,H){return new Promise(async(Y,Ne)=>{const W=setTimeout(()=>Ne(new Error(H)),e);try{const ri=await G;Y(ri)}catch(ri){Ne(ri)}clearTimeout(W)})}function vi(G,e){if(typeof e=="string"&&e.startsWith(`${G}:`))return e;if(G.toLowerCase()==="topic"){if(typeof e!="string")throw new Error('Value must be "string" for expirer target type: topic');return`topic:${e}`}else if(G.toLowerCase()==="id"){if(typeof e!="number")throw new Error('Value must be "number" for expirer target type: id');return`id:${e}`}throw new Error(`Unknown expirer target type: ${G}`)}function h0(G){return vi("topic",G)}function c0(G){return vi("id",G)}function l0(G){const[e,H]=G.split(":"),Y={id:void 0,topic:void 0};if(e==="topic"&&typeof H=="string")Y.topic=H;else if(e==="id"&&Number.isInteger(Number(H)))Y.id=Number(H);else throw new Error(`Invalid target, expected id:number or topic:string, got ${e}:${H}`);return Y}function d0(G,e){return cjs$3.fromMiliseconds((e||Date.now())+cjs$3.toMiliseconds(G))}function p0(G){return Date.now()>=cjs$3.toMiliseconds(G)}function v0(G,e){return`${G}${e?`:${e}`:""}`}function ge$2(G=[],e=[]){return[...new Set([...G,...e])]}async function m0({id:G,topic:e,wcDeepLink:H}){try{if(!H)return;const Y=typeof H=="string"?JSON.parse(H):H;let Ne=Y==null?void 0:Y.href;if(typeof Ne!="string")return;Ne.endsWith("/")&&(Ne=Ne.slice(0,-1));const W=`${Ne}/wc?requestId=${G}&sessionTopic=${e}`,ri=We$2();ri===qt$1.browser?W.startsWith("https://")||W.startsWith("http://")?window.open(W,"_blank","noreferrer noopener"):window.open(W,"_self","noreferrer noopener"):ri===qt$1.reactNative&&typeof(global==null?void 0:global.Linking)<"u"&&await global.Linking.openURL(W)}catch(Y){console.error(Y)}}async function g0(G,e){try{return await G.getItem(e)||(pr$1()?localStorage.getItem(e):void 0)}catch(H){console.error(H)}}var On=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function A0(G){var e=G.default;if(typeof e=="function"){var H=function(){return e.apply(this,arguments)};H.prototype=e.prototype}else H={};return Object.defineProperty(H,"__esModule",{value:!0}),Object.keys(G).forEach(function(Y){var Ne=Object.getOwnPropertyDescriptor(G,Y);Object.defineProperty(H,Y,Ne.get?Ne:{enumerable:!0,get:function(){return G[Y]}})}),H}var Pn={exports:{}};/** -* [js-sha3]{@link https://github.com/emn178/js-sha3} -* -* @version 0.8.0 -* @author Chen, Yi-Cyuan [emn178@gmail.com] -* @copyright Chen, Yi-Cyuan 2015-2018 -* @license MIT -*/(function(G){(function(){var e="input is invalid type",H="finalize already called",Y=typeof window=="object",Ne=Y?window:{};Ne.JS_SHA3_NO_WINDOW&&(Y=!1);var W=!Y&&typeof self=="object",ri=!Ne.JS_SHA3_NO_NODE_JS&&typeof process$1=="object"&&process$1.versions&&process$1.versions.node;ri?Ne=On:W&&(Ne=self);var si=!Ne.JS_SHA3_NO_COMMON_JS&&!0&&G.exports,fi=!Ne.JS_SHA3_NO_ARRAY_BUFFER&&typeof ArrayBuffer<"u",ai="0123456789abcdef".split(""),ti=[31,7936,2031616,520093696],hi=[4,1024,262144,67108864],ci=[1,256,65536,16777216],ui=[6,1536,393216,100663296],li=[0,8,16,24],mi=[1,0,32898,0,32906,2147483648,2147516416,2147483648,32907,0,2147483649,0,2147516545,2147483648,32777,2147483648,138,0,136,0,2147516425,0,2147483658,0,2147516555,0,139,2147483648,32905,2147483648,32771,2147483648,32770,2147483648,128,2147483648,32778,0,2147483658,2147483648,2147516545,2147483648,32896,2147483648,2147483649,0,2147516424,2147483648],hn=[224,256,384,512],ln=[128,256],fn=["hex","buffer","arrayBuffer","array","digest"],gn={128:168,256:136};(Ne.JS_SHA3_NO_NODE_JS||!Array.isArray)&&(Array.isArray=function(sn){return Object.prototype.toString.call(sn)==="[object Array]"}),fi&&(Ne.JS_SHA3_NO_ARRAY_BUFFER_IS_VIEW||!ArrayBuffer.isView)&&(ArrayBuffer.isView=function(sn){return typeof sn=="object"&&sn.buffer&&sn.buffer.constructor===ArrayBuffer});for(var cn=function(sn,Zn,on){return function(pn){return new nn(sn,Zn,sn).update(pn)[on]()}},An=function(sn,Zn,on){return function(pn,mn){return new nn(sn,Zn,mn).update(pn)[on]()}},Cn=function(sn,Zn,on){return function(pn,mn,$i,ho){return Ie["cshake"+sn].update(pn,mn,$i,ho)[on]()}},an=function(sn,Zn,on){return function(pn,mn,$i,ho){return Ie["kmac"+sn].update(pn,mn,$i,ho)[on]()}},Rn=function(sn,Zn,on,pn){for(var mn=0;mn>5,this.byteCount=this.blockCount<<2,this.outputBlocks=on>>5,this.extraBytes=(on&31)>>3;for(var pn=0;pn<50;++pn)this.s[pn]=0}nn.prototype.update=function(sn){if(this.finalized)throw new Error(H);var Zn,on=typeof sn;if(on!=="string"){if(on==="object"){if(sn===null)throw new Error(e);if(fi&&sn.constructor===ArrayBuffer)sn=new Uint8Array(sn);else if(!Array.isArray(sn)&&(!fi||!ArrayBuffer.isView(sn)))throw new Error(e)}else throw new Error(e);Zn=!0}for(var pn=this.blocks,mn=this.byteCount,$i=sn.length,ho=this.blockCount,Do=0,To=this.s,Oh,Fo;Do<$i;){if(this.reset)for(this.reset=!1,pn[0]=this.block,Oh=1;Oh>2]|=sn[Do]<>2]|=Fo<>2]|=(192|Fo>>6)<>2]|=(128|Fo&63)<=57344?(pn[Oh>>2]|=(224|Fo>>12)<>2]|=(128|Fo>>6&63)<>2]|=(128|Fo&63)<>2]|=(240|Fo>>18)<>2]|=(128|Fo>>12&63)<>2]|=(128|Fo>>6&63)<>2]|=(128|Fo&63)<=mn){for(this.start=Oh-mn,this.block=pn[ho],Oh=0;Oh>8,on=sn&255;on>0;)mn.unshift(on),sn=sn>>8,on=sn&255,++pn;return Zn?mn.push(pn):mn.unshift(pn),this.update(mn),mn.length},nn.prototype.encodeString=function(sn){var Zn,on=typeof sn;if(on!=="string"){if(on==="object"){if(sn===null)throw new Error(e);if(fi&&sn.constructor===ArrayBuffer)sn=new Uint8Array(sn);else if(!Array.isArray(sn)&&(!fi||!ArrayBuffer.isView(sn)))throw new Error(e)}else throw new Error(e);Zn=!0}var pn=0,mn=sn.length;if(Zn)pn=mn;else for(var $i=0;$i=57344?pn+=3:(ho=65536+((ho&1023)<<10|sn.charCodeAt(++$i)&1023),pn+=4)}return pn+=this.encode(pn*8),this.update(sn),pn},nn.prototype.bytepad=function(sn,Zn){for(var on=this.encode(Zn),pn=0;pn>2]|=this.padding[Zn&3],this.lastByteIndex===this.byteCount)for(sn[0]=sn[on],Zn=1;Zn>4&15]+ai[Do&15]+ai[Do>>12&15]+ai[Do>>8&15]+ai[Do>>20&15]+ai[Do>>16&15]+ai[Do>>28&15]+ai[Do>>24&15];$i%sn===0&&(Mn(Zn),mn=0)}return pn&&(Do=Zn[mn],ho+=ai[Do>>4&15]+ai[Do&15],pn>1&&(ho+=ai[Do>>12&15]+ai[Do>>8&15]),pn>2&&(ho+=ai[Do>>20&15]+ai[Do>>16&15])),ho},nn.prototype.arrayBuffer=function(){this.finalize();var sn=this.blockCount,Zn=this.s,on=this.outputBlocks,pn=this.extraBytes,mn=0,$i=0,ho=this.outputBits>>3,Do;pn?Do=new ArrayBuffer(on+1<<2):Do=new ArrayBuffer(ho);for(var To=new Uint32Array(Do);$i>8&255,ho[Do+2]=To>>16&255,ho[Do+3]=To>>24&255;$i%sn===0&&Mn(Zn)}return pn&&(Do=$i<<2,To=Zn[mn],ho[Do]=To&255,pn>1&&(ho[Do+1]=To>>8&255),pn>2&&(ho[Do+2]=To>>16&255)),ho};function vn(sn,Zn,on){nn.call(this,sn,Zn,on)}vn.prototype=new nn,vn.prototype.finalize=function(){return this.encode(this.outputBits,!0),nn.prototype.finalize.call(this)};var Mn=function(sn){var Zn,on,pn,mn,$i,ho,Do,To,Oh,Fo,Vo,Hh,Ah,Qf,Gh,tf,Ko,Kh,Lf,Uo,Vh,jf,Zo,Wh,vh,Yo,Jh,xh,Vf,Zh,Ch,Eh,Lu,Ph,Sh,Uu,Th,gh,Xh,Rh,bh,au,$h,wh,qu,Ih,_h,uu,Dh,yh,Yh,Bh,Mh,Hu,kh,qh,Tu,tc,rc,ic,nc,sc,s0;for(pn=0;pn<48;pn+=2)mn=sn[0]^sn[10]^sn[20]^sn[30]^sn[40],$i=sn[1]^sn[11]^sn[21]^sn[31]^sn[41],ho=sn[2]^sn[12]^sn[22]^sn[32]^sn[42],Do=sn[3]^sn[13]^sn[23]^sn[33]^sn[43],To=sn[4]^sn[14]^sn[24]^sn[34]^sn[44],Oh=sn[5]^sn[15]^sn[25]^sn[35]^sn[45],Fo=sn[6]^sn[16]^sn[26]^sn[36]^sn[46],Vo=sn[7]^sn[17]^sn[27]^sn[37]^sn[47],Hh=sn[8]^sn[18]^sn[28]^sn[38]^sn[48],Ah=sn[9]^sn[19]^sn[29]^sn[39]^sn[49],Zn=Hh^(ho<<1|Do>>>31),on=Ah^(Do<<1|ho>>>31),sn[0]^=Zn,sn[1]^=on,sn[10]^=Zn,sn[11]^=on,sn[20]^=Zn,sn[21]^=on,sn[30]^=Zn,sn[31]^=on,sn[40]^=Zn,sn[41]^=on,Zn=mn^(To<<1|Oh>>>31),on=$i^(Oh<<1|To>>>31),sn[2]^=Zn,sn[3]^=on,sn[12]^=Zn,sn[13]^=on,sn[22]^=Zn,sn[23]^=on,sn[32]^=Zn,sn[33]^=on,sn[42]^=Zn,sn[43]^=on,Zn=ho^(Fo<<1|Vo>>>31),on=Do^(Vo<<1|Fo>>>31),sn[4]^=Zn,sn[5]^=on,sn[14]^=Zn,sn[15]^=on,sn[24]^=Zn,sn[25]^=on,sn[34]^=Zn,sn[35]^=on,sn[44]^=Zn,sn[45]^=on,Zn=To^(Hh<<1|Ah>>>31),on=Oh^(Ah<<1|Hh>>>31),sn[6]^=Zn,sn[7]^=on,sn[16]^=Zn,sn[17]^=on,sn[26]^=Zn,sn[27]^=on,sn[36]^=Zn,sn[37]^=on,sn[46]^=Zn,sn[47]^=on,Zn=Fo^(mn<<1|$i>>>31),on=Vo^($i<<1|mn>>>31),sn[8]^=Zn,sn[9]^=on,sn[18]^=Zn,sn[19]^=on,sn[28]^=Zn,sn[29]^=on,sn[38]^=Zn,sn[39]^=on,sn[48]^=Zn,sn[49]^=on,Qf=sn[0],Gh=sn[1],Ih=sn[11]<<4|sn[10]>>>28,_h=sn[10]<<4|sn[11]>>>28,xh=sn[20]<<3|sn[21]>>>29,Vf=sn[21]<<3|sn[20]>>>29,ic=sn[31]<<9|sn[30]>>>23,nc=sn[30]<<9|sn[31]>>>23,au=sn[40]<<18|sn[41]>>>14,$h=sn[41]<<18|sn[40]>>>14,Ph=sn[2]<<1|sn[3]>>>31,Sh=sn[3]<<1|sn[2]>>>31,tf=sn[13]<<12|sn[12]>>>20,Ko=sn[12]<<12|sn[13]>>>20,uu=sn[22]<<10|sn[23]>>>22,Dh=sn[23]<<10|sn[22]>>>22,Zh=sn[33]<<13|sn[32]>>>19,Ch=sn[32]<<13|sn[33]>>>19,sc=sn[42]<<2|sn[43]>>>30,s0=sn[43]<<2|sn[42]>>>30,Hu=sn[5]<<30|sn[4]>>>2,kh=sn[4]<<30|sn[5]>>>2,Uu=sn[14]<<6|sn[15]>>>26,Th=sn[15]<<6|sn[14]>>>26,Kh=sn[25]<<11|sn[24]>>>21,Lf=sn[24]<<11|sn[25]>>>21,yh=sn[34]<<15|sn[35]>>>17,Yh=sn[35]<<15|sn[34]>>>17,Eh=sn[45]<<29|sn[44]>>>3,Lu=sn[44]<<29|sn[45]>>>3,Wh=sn[6]<<28|sn[7]>>>4,vh=sn[7]<<28|sn[6]>>>4,qh=sn[17]<<23|sn[16]>>>9,Tu=sn[16]<<23|sn[17]>>>9,gh=sn[26]<<25|sn[27]>>>7,Xh=sn[27]<<25|sn[26]>>>7,Uo=sn[36]<<21|sn[37]>>>11,Vh=sn[37]<<21|sn[36]>>>11,Bh=sn[47]<<24|sn[46]>>>8,Mh=sn[46]<<24|sn[47]>>>8,wh=sn[8]<<27|sn[9]>>>5,qu=sn[9]<<27|sn[8]>>>5,Yo=sn[18]<<20|sn[19]>>>12,Jh=sn[19]<<20|sn[18]>>>12,tc=sn[29]<<7|sn[28]>>>25,rc=sn[28]<<7|sn[29]>>>25,Rh=sn[38]<<8|sn[39]>>>24,bh=sn[39]<<8|sn[38]>>>24,jf=sn[48]<<14|sn[49]>>>18,Zo=sn[49]<<14|sn[48]>>>18,sn[0]=Qf^~tf&Kh,sn[1]=Gh^~Ko&Lf,sn[10]=Wh^~Yo&xh,sn[11]=vh^~Jh&Vf,sn[20]=Ph^~Uu&gh,sn[21]=Sh^~Th&Xh,sn[30]=wh^~Ih&uu,sn[31]=qu^~_h&Dh,sn[40]=Hu^~qh&tc,sn[41]=kh^~Tu&rc,sn[2]=tf^~Kh&Uo,sn[3]=Ko^~Lf&Vh,sn[12]=Yo^~xh&Zh,sn[13]=Jh^~Vf&Ch,sn[22]=Uu^~gh&Rh,sn[23]=Th^~Xh&bh,sn[32]=Ih^~uu&yh,sn[33]=_h^~Dh&Yh,sn[42]=qh^~tc&ic,sn[43]=Tu^~rc&nc,sn[4]=Kh^~Uo&jf,sn[5]=Lf^~Vh&Zo,sn[14]=xh^~Zh&Eh,sn[15]=Vf^~Ch&Lu,sn[24]=gh^~Rh&au,sn[25]=Xh^~bh&$h,sn[34]=uu^~yh&Bh,sn[35]=Dh^~Yh&Mh,sn[44]=tc^~ic&sc,sn[45]=rc^~nc&s0,sn[6]=Uo^~jf&Qf,sn[7]=Vh^~Zo&Gh,sn[16]=Zh^~Eh&Wh,sn[17]=Ch^~Lu&vh,sn[26]=Rh^~au&Ph,sn[27]=bh^~$h&Sh,sn[36]=yh^~Bh&wh,sn[37]=Yh^~Mh&qu,sn[46]=ic^~sc&Hu,sn[47]=nc^~s0&kh,sn[8]=jf^~Qf&tf,sn[9]=Zo^~Gh&Ko,sn[18]=Eh^~Wh&Yo,sn[19]=Lu^~vh&Jh,sn[28]=au^~Ph&Uu,sn[29]=$h^~Sh&Th,sn[38]=Bh^~wh&Ih,sn[39]=Mh^~qu&_h,sn[48]=sc^~Hu&qh,sn[49]=s0^~kh&Tu,sn[0]^=mi[pn],sn[1]^=mi[pn+1]};if(si)G.exports=Ie;else for(Xr=0;Xr{try{if("test".normalize(e)!=="test")throw new Error("bad normalize")}catch{G.push(e)}}),G.length)throw new Error("missing "+G.join(", "));if("é".normalize("NFD")!=="é")throw new Error("broken implementation")}catch(G){return G.message}return null}const Un=w0();var Ai;(function(G){G.DEBUG="DEBUG",G.INFO="INFO",G.WARNING="WARNING",G.ERROR="ERROR",G.OFF="OFF"})(Ai||(Ai={}));var re$1;(function(G){G.UNKNOWN_ERROR="UNKNOWN_ERROR",G.NOT_IMPLEMENTED="NOT_IMPLEMENTED",G.UNSUPPORTED_OPERATION="UNSUPPORTED_OPERATION",G.NETWORK_ERROR="NETWORK_ERROR",G.SERVER_ERROR="SERVER_ERROR",G.TIMEOUT="TIMEOUT",G.BUFFER_OVERRUN="BUFFER_OVERRUN",G.NUMERIC_FAULT="NUMERIC_FAULT",G.MISSING_NEW="MISSING_NEW",G.INVALID_ARGUMENT="INVALID_ARGUMENT",G.MISSING_ARGUMENT="MISSING_ARGUMENT",G.UNEXPECTED_ARGUMENT="UNEXPECTED_ARGUMENT",G.CALL_EXCEPTION="CALL_EXCEPTION",G.INSUFFICIENT_FUNDS="INSUFFICIENT_FUNDS",G.NONCE_EXPIRED="NONCE_EXPIRED",G.REPLACEMENT_UNDERPRICED="REPLACEMENT_UNDERPRICED",G.UNPREDICTABLE_GAS_LIMIT="UNPREDICTABLE_GAS_LIMIT",G.TRANSACTION_REPLACED="TRANSACTION_REPLACED",G.ACTION_REJECTED="ACTION_REJECTED"})(re$1||(re$1={}));const kn="0123456789abcdef";let L$4=class Uc{constructor(e){Object.defineProperty(this,"version",{enumerable:!0,value:e,writable:!1})}_log(e,H){const Y=e.toLowerCase();Cr$1[Y]==null&&this.throwArgumentError("invalid log level name","logLevel",e),!(Tn>Cr$1[Y])&&console.log.apply(console,H)}debug(...e){this._log(Uc.levels.DEBUG,e)}info(...e){this._log(Uc.levels.INFO,e)}warn(...e){this._log(Uc.levels.WARNING,e)}makeError(e,H,Y){if(Fn)return this.makeError("censored error",H,{});H||(H=Uc.errors.UNKNOWN_ERROR),Y||(Y={});const Ne=[];Object.keys(Y).forEach(fi=>{const ai=Y[fi];try{if(ai instanceof Uint8Array){let ti="";for(let hi=0;hi>4],ti+=kn[ai[hi]&15];Ne.push(fi+"=Uint8Array(0x"+ti+")")}else Ne.push(fi+"="+JSON.stringify(ai))}catch{Ne.push(fi+"="+JSON.stringify(Y[fi].toString()))}}),Ne.push(`code=${H}`),Ne.push(`version=${this.version}`);const W=e;let ri="";switch(H){case re$1.NUMERIC_FAULT:{ri="NUMERIC_FAULT";const fi=e;switch(fi){case"overflow":case"underflow":case"division-by-zero":ri+="-"+fi;break;case"negative-power":case"negative-width":ri+="-unsupported";break;case"unbound-bitwise-result":ri+="-unbound-result";break}break}case re$1.CALL_EXCEPTION:case re$1.INSUFFICIENT_FUNDS:case re$1.MISSING_NEW:case re$1.NONCE_EXPIRED:case re$1.REPLACEMENT_UNDERPRICED:case re$1.TRANSACTION_REPLACED:case re$1.UNPREDICTABLE_GAS_LIMIT:ri=H;break}ri&&(e+=" [ See: https://links.ethers.org/v5-errors-"+ri+" ]"),Ne.length&&(e+=" ("+Ne.join(", ")+")");const si=new Error(e);return si.reason=W,si.code=H,Object.keys(Y).forEach(function(fi){si[fi]=Y[fi]}),si}throwError(e,H,Y){throw this.makeError(e,H,Y)}throwArgumentError(e,H,Y){return this.throwError(e,Uc.errors.INVALID_ARGUMENT,{argument:H,value:Y})}assert(e,H,Y,Ne){e||this.throwError(H,Y,Ne)}assertArgument(e,H,Y,Ne){e||this.throwArgumentError(H,Y,Ne)}checkNormalize(e){Un&&this.throwError("platform missing String.prototype.normalize",Uc.errors.UNSUPPORTED_OPERATION,{operation:"String.prototype.normalize",form:Un})}checkSafeUint53(e,H){typeof e=="number"&&(H==null&&(H="value not safe"),(e<0||e>=9007199254740991)&&this.throwError(H,Uc.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"out-of-safe-range",value:e}),e%1&&this.throwError(H,Uc.errors.NUMERIC_FAULT,{operation:"checkSafeInteger",fault:"non-integer",value:e}))}checkArgumentCount(e,H,Y){Y?Y=": "+Y:Y="",eH&&this.throwError("too many arguments"+Y,Uc.errors.UNEXPECTED_ARGUMENT,{count:e,expectedCount:H})}checkNew(e,H){(e===Object||e==null)&&this.throwError("missing new",Uc.errors.MISSING_NEW,{name:H.name})}checkAbstract(e,H){e===H?this.throwError("cannot instantiate abstract class "+JSON.stringify(H.name)+" directly; use a sub-class",Uc.errors.UNSUPPORTED_OPERATION,{name:e.name,operation:"new"}):(e===Object||e==null)&&this.throwError("missing new",Uc.errors.MISSING_NEW,{name:H.name})}static globalLogger(){return gi||(gi=new Uc(y0)),gi}static setCensorship(e,H){if(!e&&H&&this.globalLogger().throwError("cannot permanently disable censorship",Uc.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"}),Dn){if(!e)return;this.globalLogger().throwError("error censorship permanent",Uc.errors.UNSUPPORTED_OPERATION,{operation:"setCensorship"})}Fn=!!e,Dn=!!H}static setLogLevel(e){const H=Cr$1[e.toLowerCase()];if(H==null){Uc.globalLogger().warn("invalid log level - "+e);return}Tn=H}static from(e){return new Uc(e)}};L$4.errors=re$1,L$4.levels=Ai;const x0="bytes/5.7.0",Dt$1=new L$4(x0);function qn(G){return!!G.toHexString}function rr$1(G){return G.slice||(G.slice=function(){const e=Array.prototype.slice.call(arguments);return rr$1(new Uint8Array(Array.prototype.slice.apply(G,e)))}),G}function M0(G){return Qt(G)&&!(G.length%2)||ir$1(G)}function Kn(G){return typeof G=="number"&&G==G&&G%1===0}function ir$1(G){if(G==null)return!1;if(G.constructor===Uint8Array)return!0;if(typeof G=="string"||!Kn(G.length)||G.length<0)return!1;for(let e=0;e=256)return!1}return!0}function Ot$1(G,e){if(e||(e={}),typeof G=="number"){Dt$1.checkSafeUint53(G,"invalid arrayify value");const H=[];for(;G;)H.unshift(G&255),G=parseInt(String(G/256));return H.length===0&&H.push(0),rr$1(new Uint8Array(H))}if(e.allowMissingPrefix&&typeof G=="string"&&G.substring(0,2)!=="0x"&&(G="0x"+G),qn(G)&&(G=G.toHexString()),Qt(G)){let H=G.substring(2);H.length%2&&(e.hexPad==="left"?H="0"+H:e.hexPad==="right"?H+="0":Dt$1.throwArgumentError("hex data is odd-length","value",G));const Y=[];for(let Ne=0;NeOt$1(Ne)),H=e.reduce((Ne,W)=>Ne+W.length,0),Y=new Uint8Array(H);return e.reduce((Ne,W)=>(Y.set(W,Ne),Ne+W.length),0),rr$1(Y)}function S0(G,e){G=Ot$1(G),G.length>e&&Dt$1.throwArgumentError("value out of range","value",arguments[0]);const H=new Uint8Array(e);return H.set(G,e-G.length),rr$1(H)}function Qt(G,e){return!(typeof G!="string"||!G.match(/^0x[0-9A-Fa-f]*$/)||e&&G.length!==2+2*e)}const bi="0123456789abcdef";function Kt$1(G,e){if(e||(e={}),typeof G=="number"){Dt$1.checkSafeUint53(G,"invalid hexlify value");let H="";for(;G;)H=bi[G&15]+H,G=Math.floor(G/16);return H.length?(H.length%2&&(H="0"+H),"0x"+H):"0x00"}if(typeof G=="bigint")return G=G.toString(16),G.length%2?"0x0"+G:"0x"+G;if(e.allowMissingPrefix&&typeof G=="string"&&G.substring(0,2)!=="0x"&&(G="0x"+G),qn(G))return G.toHexString();if(Qt(G))return G.length%2&&(e.hexPad==="left"?G="0x0"+G.substring(2):e.hexPad==="right"?G+="0":Dt$1.throwArgumentError("hex data is odd-length","value",G)),G.toLowerCase();if(ir$1(G)){let H="0x";for(let Y=0;Y>4]+bi[Ne&15]}return H}return Dt$1.throwArgumentError("invalid hexlify value","value",G)}function N0(G){if(typeof G!="string")G=Kt$1(G);else if(!Qt(G)||G.length%2)return null;return(G.length-2)/2}function Hn(G,e,H){return typeof G!="string"?G=Kt$1(G):(!Qt(G)||G.length%2)&&Dt$1.throwArgumentError("invalid hexData","value",G),e=2+2*e,H!=null?"0x"+G.substring(e,2+2*H):"0x"+G.substring(e)}function oe$1(G,e){for(typeof G!="string"?G=Kt$1(G):Qt(G)||Dt$1.throwArgumentError("invalid hex string","value",G),G.length>2*e+2&&Dt$1.throwArgumentError("value out of range","value",arguments[1]);G.length<2*e+2;)G="0x0"+G.substring(2);return G}function zn(G){const e={r:"0x",s:"0x",_vs:"0x",recoveryParam:0,v:0,yParityAndS:"0x",compact:"0x"};if(M0(G)){let H=Ot$1(G);H.length===64?(e.v=27+(H[32]>>7),H[32]&=127,e.r=Kt$1(H.slice(0,32)),e.s=Kt$1(H.slice(32,64))):H.length===65?(e.r=Kt$1(H.slice(0,32)),e.s=Kt$1(H.slice(32,64)),e.v=H[64]):Dt$1.throwArgumentError("invalid signature string","signature",G),e.v<27&&(e.v===0||e.v===1?e.v+=27:Dt$1.throwArgumentError("signature invalid v byte","signature",G)),e.recoveryParam=1-e.v%2,e.recoveryParam&&(H[32]|=128),e._vs=Kt$1(H.slice(32,64))}else{if(e.r=G.r,e.s=G.s,e.v=G.v,e.recoveryParam=G.recoveryParam,e._vs=G._vs,e._vs!=null){const Ne=S0(Ot$1(e._vs),32);e._vs=Kt$1(Ne);const W=Ne[0]>=128?1:0;e.recoveryParam==null?e.recoveryParam=W:e.recoveryParam!==W&&Dt$1.throwArgumentError("signature recoveryParam mismatch _vs","signature",G),Ne[0]&=127;const ri=Kt$1(Ne);e.s==null?e.s=ri:e.s!==ri&&Dt$1.throwArgumentError("signature v mismatch _vs","signature",G)}if(e.recoveryParam==null)e.v==null?Dt$1.throwArgumentError("signature missing v and recoveryParam","signature",G):e.v===0||e.v===1?e.recoveryParam=e.v:e.recoveryParam=1-e.v%2;else if(e.v==null)e.v=27+e.recoveryParam;else{const Ne=e.v===0||e.v===1?e.v:1-e.v%2;e.recoveryParam!==Ne&&Dt$1.throwArgumentError("signature recoveryParam mismatch v","signature",G)}e.r==null||!Qt(e.r)?Dt$1.throwArgumentError("signature missing or invalid r","signature",G):e.r=oe$1(e.r,32),e.s==null||!Qt(e.s)?Dt$1.throwArgumentError("signature missing or invalid s","signature",G):e.s=oe$1(e.s,32);const H=Ot$1(e.s);H[0]>=128&&Dt$1.throwArgumentError("signature s out of range","signature",G),e.recoveryParam&&(H[0]|=128);const Y=Kt$1(H);e._vs&&(Qt(e._vs)||Dt$1.throwArgumentError("signature invalid _vs","signature",G),e._vs=oe$1(e._vs,32)),e._vs==null?e._vs=Y:e._vs!==Y&&Dt$1.throwArgumentError("signature _vs mismatch v and s","signature",G)}return e.yParityAndS=e._vs,e.compact=e.r+e.yParityAndS.substring(2),e}function yi(G){return"0x"+b0.keccak_256(Ot$1(G))}var Ln={exports:{}},I0={},_0=Object.freeze({__proto__:null,default:I0}),B0=A0(_0);(function(G){(function(e,H){function Y(F,Ie){if(!F)throw new Error(Ie||"Assertion failed")}function Ne(F,Ie){F.super_=Ie;var Te=function(){};Te.prototype=Ie.prototype,F.prototype=new Te,F.prototype.constructor=F}function W(F,Ie,Te){if(W.isBN(F))return F;this.negative=0,this.words=null,this.length=0,this.red=null,F!==null&&((Ie==="le"||Ie==="be")&&(Te=Ie,Ie=10),this._init(F||0,Ie||10,Te||"be"))}typeof e=="object"?e.exports=W:H.BN=W,W.BN=W,W.wordSize=26;var ri;try{typeof window<"u"&&typeof window.Buffer<"u"?ri=window.Buffer:ri=B0.Buffer}catch{}W.isBN=function(F){return F instanceof W?!0:F!==null&&typeof F=="object"&&F.constructor.wordSize===W.wordSize&&Array.isArray(F.words)},W.max=function(F,Ie){return F.cmp(Ie)>0?F:Ie},W.min=function(F,Ie){return F.cmp(Ie)<0?F:Ie},W.prototype._init=function(F,Ie,Te){if(typeof F=="number")return this._initNumber(F,Ie,Te);if(typeof F=="object")return this._initArray(F,Ie,Te);Ie==="hex"&&(Ie=16),Y(Ie===(Ie|0)&&Ie>=2&&Ie<=36),F=F.toString().replace(/\s+/g,"");var Xr=0;F[0]==="-"&&(Xr++,this.negative=1),Xr=0;Xr-=3)ii=F[Xr]|F[Xr-1]<<8|F[Xr-2]<<16,this.words[ei]|=ii<>>26-Wr&67108863,Wr+=24,Wr>=26&&(Wr-=26,ei++);else if(Te==="le")for(Xr=0,ei=0;Xr>>26-Wr&67108863,Wr+=24,Wr>=26&&(Wr-=26,ei++);return this._strip()};function si(F,Ie){var Te=F.charCodeAt(Ie);if(Te>=48&&Te<=57)return Te-48;if(Te>=65&&Te<=70)return Te-55;if(Te>=97&&Te<=102)return Te-87;Y(!1,"Invalid character in "+F)}function fi(F,Ie,Te){var Xr=si(F,Te);return Te-1>=Ie&&(Xr|=si(F,Te-1)<<4),Xr}W.prototype._parseHex=function(F,Ie,Te){this.length=Math.ceil((F.length-Ie)/6),this.words=new Array(this.length);for(var Xr=0;Xr=Ie;Xr-=2)Wr=fi(F,Ie,Xr)<=18?(ei-=18,ii+=1,this.words[ii]|=Wr>>>26):ei+=8;else{var R=F.length-Ie;for(Xr=R%2===0?Ie+1:Ie;Xr=18?(ei-=18,ii+=1,this.words[ii]|=Wr>>>26):ei+=8}this._strip()};function ai(F,Ie,Te,Xr){for(var ei=0,ii=0,Wr=Math.min(F.length,Te),R=Ie;R=49?ii=Le-49+10:Le>=17?ii=Le-17+10:ii=Le,Y(Le>=0&&ii1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},W.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},typeof Symbol<"u"&&typeof Symbol.for=="function")try{W.prototype[Symbol.for("nodejs.util.inspect.custom")]=hi}catch{W.prototype.inspect=hi}else W.prototype.inspect=hi;function hi(){return(this.red?""}var ci=["","0","00","000","0000","00000","000000","0000000","00000000","000000000","0000000000","00000000000","000000000000","0000000000000","00000000000000","000000000000000","0000000000000000","00000000000000000","000000000000000000","0000000000000000000","00000000000000000000","000000000000000000000","0000000000000000000000","00000000000000000000000","000000000000000000000000","0000000000000000000000000"],ui=[0,0,25,16,12,11,10,9,8,8,7,7,7,7,6,6,6,6,6,6,6,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5],li=[0,0,33554432,43046721,16777216,48828125,60466176,40353607,16777216,43046721,1e7,19487171,35831808,62748517,7529536,11390625,16777216,24137569,34012224,47045881,64e6,4084101,5153632,6436343,7962624,9765625,11881376,14348907,17210368,20511149,243e5,28629151,33554432,39135393,45435424,52521875,60466176];W.prototype.toString=function(F,Ie){F=F||10,Ie=Ie|0||1;var Te;if(F===16||F==="hex"){Te="";for(var Xr=0,ei=0,ii=0;ii>>24-Xr&16777215,Xr+=2,Xr>=26&&(Xr-=26,ii--),ei!==0||ii!==this.length-1?Te=ci[6-R.length]+R+Te:Te=R+Te}for(ei!==0&&(Te=ei.toString(16)+Te);Te.length%Ie!==0;)Te="0"+Te;return this.negative!==0&&(Te="-"+Te),Te}if(F===(F|0)&&F>=2&&F<=36){var Le=ui[F],nn=li[F];Te="";var vn=this.clone();for(vn.negative=0;!vn.isZero();){var Mn=vn.modrn(nn).toString(F);vn=vn.idivn(nn),vn.isZero()?Te=Mn+Te:Te=ci[Le-Mn.length]+Mn+Te}for(this.isZero()&&(Te="0"+Te);Te.length%Ie!==0;)Te="0"+Te;return this.negative!==0&&(Te="-"+Te),Te}Y(!1,"Base should be between 2 and 36")},W.prototype.toNumber=function(){var F=this.words[0];return this.length===2?F+=this.words[1]*67108864:this.length===3&&this.words[2]===1?F+=4503599627370496+this.words[1]*67108864:this.length>2&&Y(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-F:F},W.prototype.toJSON=function(){return this.toString(16,2)},ri&&(W.prototype.toBuffer=function(F,Ie){return this.toArrayLike(ri,F,Ie)}),W.prototype.toArray=function(F,Ie){return this.toArrayLike(Array,F,Ie)};var mi=function(F,Ie){return F.allocUnsafe?F.allocUnsafe(Ie):new F(Ie)};W.prototype.toArrayLike=function(F,Ie,Te){this._strip();var Xr=this.byteLength(),ei=Te||Math.max(1,Xr);Y(Xr<=ei,"byte array longer than desired length"),Y(ei>0,"Requested array length <= 0");var ii=mi(F,ei),Wr=Ie==="le"?"LE":"BE";return this["_toArrayLike"+Wr](ii,Xr),ii},W.prototype._toArrayLikeLE=function(F,Ie){for(var Te=0,Xr=0,ei=0,ii=0;ei>8&255),Te>16&255),ii===6?(Te>24&255),Xr=0,ii=0):(Xr=Wr>>>24,ii+=2)}if(Te=0&&(F[Te--]=Wr>>8&255),Te>=0&&(F[Te--]=Wr>>16&255),ii===6?(Te>=0&&(F[Te--]=Wr>>24&255),Xr=0,ii=0):(Xr=Wr>>>24,ii+=2)}if(Te>=0)for(F[Te--]=Xr;Te>=0;)F[Te--]=0},Math.clz32?W.prototype._countBits=function(F){return 32-Math.clz32(F)}:W.prototype._countBits=function(F){var Ie=F,Te=0;return Ie>=4096&&(Te+=13,Ie>>>=13),Ie>=64&&(Te+=7,Ie>>>=7),Ie>=8&&(Te+=4,Ie>>>=4),Ie>=2&&(Te+=2,Ie>>>=2),Te+Ie},W.prototype._zeroBits=function(F){if(F===0)return 26;var Ie=F,Te=0;return Ie&8191||(Te+=13,Ie>>>=13),Ie&127||(Te+=7,Ie>>>=7),Ie&15||(Te+=4,Ie>>>=4),Ie&3||(Te+=2,Ie>>>=2),Ie&1||Te++,Te},W.prototype.bitLength=function(){var F=this.words[this.length-1],Ie=this._countBits(F);return(this.length-1)*26+Ie};function hn(F){for(var Ie=new Array(F.bitLength()),Te=0;Te>>ei&1}return Ie}W.prototype.zeroBits=function(){if(this.isZero())return 0;for(var F=0,Ie=0;IeF.length?this.clone().ior(F):F.clone().ior(this)},W.prototype.uor=function(F){return this.length>F.length?this.clone().iuor(F):F.clone().iuor(this)},W.prototype.iuand=function(F){var Ie;this.length>F.length?Ie=F:Ie=this;for(var Te=0;TeF.length?this.clone().iand(F):F.clone().iand(this)},W.prototype.uand=function(F){return this.length>F.length?this.clone().iuand(F):F.clone().iuand(this)},W.prototype.iuxor=function(F){var Ie,Te;this.length>F.length?(Ie=this,Te=F):(Ie=F,Te=this);for(var Xr=0;XrF.length?this.clone().ixor(F):F.clone().ixor(this)},W.prototype.uxor=function(F){return this.length>F.length?this.clone().iuxor(F):F.clone().iuxor(this)},W.prototype.inotn=function(F){Y(typeof F=="number"&&F>=0);var Ie=Math.ceil(F/26)|0,Te=F%26;this._expand(Ie),Te>0&&Ie--;for(var Xr=0;Xr0&&(this.words[Xr]=~this.words[Xr]&67108863>>26-Te),this._strip()},W.prototype.notn=function(F){return this.clone().inotn(F)},W.prototype.setn=function(F,Ie){Y(typeof F=="number"&&F>=0);var Te=F/26|0,Xr=F%26;return this._expand(Te+1),Ie?this.words[Te]=this.words[Te]|1<F.length?(Te=this,Xr=F):(Te=F,Xr=this);for(var ei=0,ii=0;ii>>26;for(;ei!==0&&ii>>26;if(this.length=Te.length,ei!==0)this.words[this.length]=ei,this.length++;else if(Te!==this)for(;iiF.length?this.clone().iadd(F):F.clone().iadd(this)},W.prototype.isub=function(F){if(F.negative!==0){F.negative=0;var Ie=this.iadd(F);return F.negative=1,Ie._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(F),this.negative=1,this._normSign();var Te=this.cmp(F);if(Te===0)return this.negative=0,this.length=1,this.words[0]=0,this;var Xr,ei;Te>0?(Xr=this,ei=F):(Xr=F,ei=this);for(var ii=0,Wr=0;Wr>26,this.words[Wr]=Ie&67108863;for(;ii!==0&&Wr>26,this.words[Wr]=Ie&67108863;if(ii===0&&Wr>>26,Mn=Le&67108863,sn=Math.min(nn,Ie.length-1),Zn=Math.max(0,nn-F.length+1);Zn<=sn;Zn++){var on=nn-Zn|0;ei=F.words[on]|0,ii=Ie.words[Zn]|0,Wr=ei*ii+Mn,vn+=Wr/67108864|0,Mn=Wr&67108863}Te.words[nn]=Mn|0,Le=vn|0}return Le!==0?Te.words[nn]=Le|0:Te.length--,Te._strip()}var fn=function(F,Ie,Te){var Xr=F.words,ei=Ie.words,ii=Te.words,Wr=0,R,Le,nn,vn=Xr[0]|0,Mn=vn&8191,sn=vn>>>13,Zn=Xr[1]|0,on=Zn&8191,pn=Zn>>>13,mn=Xr[2]|0,$i=mn&8191,ho=mn>>>13,Do=Xr[3]|0,To=Do&8191,Oh=Do>>>13,Fo=Xr[4]|0,Vo=Fo&8191,Hh=Fo>>>13,Ah=Xr[5]|0,Qf=Ah&8191,Gh=Ah>>>13,tf=Xr[6]|0,Ko=tf&8191,Kh=tf>>>13,Lf=Xr[7]|0,Uo=Lf&8191,Vh=Lf>>>13,jf=Xr[8]|0,Zo=jf&8191,Wh=jf>>>13,vh=Xr[9]|0,Yo=vh&8191,Jh=vh>>>13,xh=ei[0]|0,Vf=xh&8191,Zh=xh>>>13,Ch=ei[1]|0,Eh=Ch&8191,Lu=Ch>>>13,Ph=ei[2]|0,Sh=Ph&8191,Uu=Ph>>>13,Th=ei[3]|0,gh=Th&8191,Xh=Th>>>13,Rh=ei[4]|0,bh=Rh&8191,au=Rh>>>13,$h=ei[5]|0,wh=$h&8191,qu=$h>>>13,Ih=ei[6]|0,_h=Ih&8191,uu=Ih>>>13,Dh=ei[7]|0,yh=Dh&8191,Yh=Dh>>>13,Bh=ei[8]|0,Mh=Bh&8191,Hu=Bh>>>13,kh=ei[9]|0,qh=kh&8191,Tu=kh>>>13;Te.negative=F.negative^Ie.negative,Te.length=19,R=Math.imul(Mn,Vf),Le=Math.imul(Mn,Zh),Le=Le+Math.imul(sn,Vf)|0,nn=Math.imul(sn,Zh);var tc=(Wr+R|0)+((Le&8191)<<13)|0;Wr=(nn+(Le>>>13)|0)+(tc>>>26)|0,tc&=67108863,R=Math.imul(on,Vf),Le=Math.imul(on,Zh),Le=Le+Math.imul(pn,Vf)|0,nn=Math.imul(pn,Zh),R=R+Math.imul(Mn,Eh)|0,Le=Le+Math.imul(Mn,Lu)|0,Le=Le+Math.imul(sn,Eh)|0,nn=nn+Math.imul(sn,Lu)|0;var rc=(Wr+R|0)+((Le&8191)<<13)|0;Wr=(nn+(Le>>>13)|0)+(rc>>>26)|0,rc&=67108863,R=Math.imul($i,Vf),Le=Math.imul($i,Zh),Le=Le+Math.imul(ho,Vf)|0,nn=Math.imul(ho,Zh),R=R+Math.imul(on,Eh)|0,Le=Le+Math.imul(on,Lu)|0,Le=Le+Math.imul(pn,Eh)|0,nn=nn+Math.imul(pn,Lu)|0,R=R+Math.imul(Mn,Sh)|0,Le=Le+Math.imul(Mn,Uu)|0,Le=Le+Math.imul(sn,Sh)|0,nn=nn+Math.imul(sn,Uu)|0;var ic=(Wr+R|0)+((Le&8191)<<13)|0;Wr=(nn+(Le>>>13)|0)+(ic>>>26)|0,ic&=67108863,R=Math.imul(To,Vf),Le=Math.imul(To,Zh),Le=Le+Math.imul(Oh,Vf)|0,nn=Math.imul(Oh,Zh),R=R+Math.imul($i,Eh)|0,Le=Le+Math.imul($i,Lu)|0,Le=Le+Math.imul(ho,Eh)|0,nn=nn+Math.imul(ho,Lu)|0,R=R+Math.imul(on,Sh)|0,Le=Le+Math.imul(on,Uu)|0,Le=Le+Math.imul(pn,Sh)|0,nn=nn+Math.imul(pn,Uu)|0,R=R+Math.imul(Mn,gh)|0,Le=Le+Math.imul(Mn,Xh)|0,Le=Le+Math.imul(sn,gh)|0,nn=nn+Math.imul(sn,Xh)|0;var nc=(Wr+R|0)+((Le&8191)<<13)|0;Wr=(nn+(Le>>>13)|0)+(nc>>>26)|0,nc&=67108863,R=Math.imul(Vo,Vf),Le=Math.imul(Vo,Zh),Le=Le+Math.imul(Hh,Vf)|0,nn=Math.imul(Hh,Zh),R=R+Math.imul(To,Eh)|0,Le=Le+Math.imul(To,Lu)|0,Le=Le+Math.imul(Oh,Eh)|0,nn=nn+Math.imul(Oh,Lu)|0,R=R+Math.imul($i,Sh)|0,Le=Le+Math.imul($i,Uu)|0,Le=Le+Math.imul(ho,Sh)|0,nn=nn+Math.imul(ho,Uu)|0,R=R+Math.imul(on,gh)|0,Le=Le+Math.imul(on,Xh)|0,Le=Le+Math.imul(pn,gh)|0,nn=nn+Math.imul(pn,Xh)|0,R=R+Math.imul(Mn,bh)|0,Le=Le+Math.imul(Mn,au)|0,Le=Le+Math.imul(sn,bh)|0,nn=nn+Math.imul(sn,au)|0;var sc=(Wr+R|0)+((Le&8191)<<13)|0;Wr=(nn+(Le>>>13)|0)+(sc>>>26)|0,sc&=67108863,R=Math.imul(Qf,Vf),Le=Math.imul(Qf,Zh),Le=Le+Math.imul(Gh,Vf)|0,nn=Math.imul(Gh,Zh),R=R+Math.imul(Vo,Eh)|0,Le=Le+Math.imul(Vo,Lu)|0,Le=Le+Math.imul(Hh,Eh)|0,nn=nn+Math.imul(Hh,Lu)|0,R=R+Math.imul(To,Sh)|0,Le=Le+Math.imul(To,Uu)|0,Le=Le+Math.imul(Oh,Sh)|0,nn=nn+Math.imul(Oh,Uu)|0,R=R+Math.imul($i,gh)|0,Le=Le+Math.imul($i,Xh)|0,Le=Le+Math.imul(ho,gh)|0,nn=nn+Math.imul(ho,Xh)|0,R=R+Math.imul(on,bh)|0,Le=Le+Math.imul(on,au)|0,Le=Le+Math.imul(pn,bh)|0,nn=nn+Math.imul(pn,au)|0,R=R+Math.imul(Mn,wh)|0,Le=Le+Math.imul(Mn,qu)|0,Le=Le+Math.imul(sn,wh)|0,nn=nn+Math.imul(sn,qu)|0;var s0=(Wr+R|0)+((Le&8191)<<13)|0;Wr=(nn+(Le>>>13)|0)+(s0>>>26)|0,s0&=67108863,R=Math.imul(Ko,Vf),Le=Math.imul(Ko,Zh),Le=Le+Math.imul(Kh,Vf)|0,nn=Math.imul(Kh,Zh),R=R+Math.imul(Qf,Eh)|0,Le=Le+Math.imul(Qf,Lu)|0,Le=Le+Math.imul(Gh,Eh)|0,nn=nn+Math.imul(Gh,Lu)|0,R=R+Math.imul(Vo,Sh)|0,Le=Le+Math.imul(Vo,Uu)|0,Le=Le+Math.imul(Hh,Sh)|0,nn=nn+Math.imul(Hh,Uu)|0,R=R+Math.imul(To,gh)|0,Le=Le+Math.imul(To,Xh)|0,Le=Le+Math.imul(Oh,gh)|0,nn=nn+Math.imul(Oh,Xh)|0,R=R+Math.imul($i,bh)|0,Le=Le+Math.imul($i,au)|0,Le=Le+Math.imul(ho,bh)|0,nn=nn+Math.imul(ho,au)|0,R=R+Math.imul(on,wh)|0,Le=Le+Math.imul(on,qu)|0,Le=Le+Math.imul(pn,wh)|0,nn=nn+Math.imul(pn,qu)|0,R=R+Math.imul(Mn,_h)|0,Le=Le+Math.imul(Mn,uu)|0,Le=Le+Math.imul(sn,_h)|0,nn=nn+Math.imul(sn,uu)|0;var hc=(Wr+R|0)+((Le&8191)<<13)|0;Wr=(nn+(Le>>>13)|0)+(hc>>>26)|0,hc&=67108863,R=Math.imul(Uo,Vf),Le=Math.imul(Uo,Zh),Le=Le+Math.imul(Vh,Vf)|0,nn=Math.imul(Vh,Zh),R=R+Math.imul(Ko,Eh)|0,Le=Le+Math.imul(Ko,Lu)|0,Le=Le+Math.imul(Kh,Eh)|0,nn=nn+Math.imul(Kh,Lu)|0,R=R+Math.imul(Qf,Sh)|0,Le=Le+Math.imul(Qf,Uu)|0,Le=Le+Math.imul(Gh,Sh)|0,nn=nn+Math.imul(Gh,Uu)|0,R=R+Math.imul(Vo,gh)|0,Le=Le+Math.imul(Vo,Xh)|0,Le=Le+Math.imul(Hh,gh)|0,nn=nn+Math.imul(Hh,Xh)|0,R=R+Math.imul(To,bh)|0,Le=Le+Math.imul(To,au)|0,Le=Le+Math.imul(Oh,bh)|0,nn=nn+Math.imul(Oh,au)|0,R=R+Math.imul($i,wh)|0,Le=Le+Math.imul($i,qu)|0,Le=Le+Math.imul(ho,wh)|0,nn=nn+Math.imul(ho,qu)|0,R=R+Math.imul(on,_h)|0,Le=Le+Math.imul(on,uu)|0,Le=Le+Math.imul(pn,_h)|0,nn=nn+Math.imul(pn,uu)|0,R=R+Math.imul(Mn,yh)|0,Le=Le+Math.imul(Mn,Yh)|0,Le=Le+Math.imul(sn,yh)|0,nn=nn+Math.imul(sn,Yh)|0;var pc=(Wr+R|0)+((Le&8191)<<13)|0;Wr=(nn+(Le>>>13)|0)+(pc>>>26)|0,pc&=67108863,R=Math.imul(Zo,Vf),Le=Math.imul(Zo,Zh),Le=Le+Math.imul(Wh,Vf)|0,nn=Math.imul(Wh,Zh),R=R+Math.imul(Uo,Eh)|0,Le=Le+Math.imul(Uo,Lu)|0,Le=Le+Math.imul(Vh,Eh)|0,nn=nn+Math.imul(Vh,Lu)|0,R=R+Math.imul(Ko,Sh)|0,Le=Le+Math.imul(Ko,Uu)|0,Le=Le+Math.imul(Kh,Sh)|0,nn=nn+Math.imul(Kh,Uu)|0,R=R+Math.imul(Qf,gh)|0,Le=Le+Math.imul(Qf,Xh)|0,Le=Le+Math.imul(Gh,gh)|0,nn=nn+Math.imul(Gh,Xh)|0,R=R+Math.imul(Vo,bh)|0,Le=Le+Math.imul(Vo,au)|0,Le=Le+Math.imul(Hh,bh)|0,nn=nn+Math.imul(Hh,au)|0,R=R+Math.imul(To,wh)|0,Le=Le+Math.imul(To,qu)|0,Le=Le+Math.imul(Oh,wh)|0,nn=nn+Math.imul(Oh,qu)|0,R=R+Math.imul($i,_h)|0,Le=Le+Math.imul($i,uu)|0,Le=Le+Math.imul(ho,_h)|0,nn=nn+Math.imul(ho,uu)|0,R=R+Math.imul(on,yh)|0,Le=Le+Math.imul(on,Yh)|0,Le=Le+Math.imul(pn,yh)|0,nn=nn+Math.imul(pn,Yh)|0,R=R+Math.imul(Mn,Mh)|0,Le=Le+Math.imul(Mn,Hu)|0,Le=Le+Math.imul(sn,Mh)|0,nn=nn+Math.imul(sn,Hu)|0;var uc=(Wr+R|0)+((Le&8191)<<13)|0;Wr=(nn+(Le>>>13)|0)+(uc>>>26)|0,uc&=67108863,R=Math.imul(Yo,Vf),Le=Math.imul(Yo,Zh),Le=Le+Math.imul(Jh,Vf)|0,nn=Math.imul(Jh,Zh),R=R+Math.imul(Zo,Eh)|0,Le=Le+Math.imul(Zo,Lu)|0,Le=Le+Math.imul(Wh,Eh)|0,nn=nn+Math.imul(Wh,Lu)|0,R=R+Math.imul(Uo,Sh)|0,Le=Le+Math.imul(Uo,Uu)|0,Le=Le+Math.imul(Vh,Sh)|0,nn=nn+Math.imul(Vh,Uu)|0,R=R+Math.imul(Ko,gh)|0,Le=Le+Math.imul(Ko,Xh)|0,Le=Le+Math.imul(Kh,gh)|0,nn=nn+Math.imul(Kh,Xh)|0,R=R+Math.imul(Qf,bh)|0,Le=Le+Math.imul(Qf,au)|0,Le=Le+Math.imul(Gh,bh)|0,nn=nn+Math.imul(Gh,au)|0,R=R+Math.imul(Vo,wh)|0,Le=Le+Math.imul(Vo,qu)|0,Le=Le+Math.imul(Hh,wh)|0,nn=nn+Math.imul(Hh,qu)|0,R=R+Math.imul(To,_h)|0,Le=Le+Math.imul(To,uu)|0,Le=Le+Math.imul(Oh,_h)|0,nn=nn+Math.imul(Oh,uu)|0,R=R+Math.imul($i,yh)|0,Le=Le+Math.imul($i,Yh)|0,Le=Le+Math.imul(ho,yh)|0,nn=nn+Math.imul(ho,Yh)|0,R=R+Math.imul(on,Mh)|0,Le=Le+Math.imul(on,Hu)|0,Le=Le+Math.imul(pn,Mh)|0,nn=nn+Math.imul(pn,Hu)|0,R=R+Math.imul(Mn,qh)|0,Le=Le+Math.imul(Mn,Tu)|0,Le=Le+Math.imul(sn,qh)|0,nn=nn+Math.imul(sn,Tu)|0;var vc=(Wr+R|0)+((Le&8191)<<13)|0;Wr=(nn+(Le>>>13)|0)+(vc>>>26)|0,vc&=67108863,R=Math.imul(Yo,Eh),Le=Math.imul(Yo,Lu),Le=Le+Math.imul(Jh,Eh)|0,nn=Math.imul(Jh,Lu),R=R+Math.imul(Zo,Sh)|0,Le=Le+Math.imul(Zo,Uu)|0,Le=Le+Math.imul(Wh,Sh)|0,nn=nn+Math.imul(Wh,Uu)|0,R=R+Math.imul(Uo,gh)|0,Le=Le+Math.imul(Uo,Xh)|0,Le=Le+Math.imul(Vh,gh)|0,nn=nn+Math.imul(Vh,Xh)|0,R=R+Math.imul(Ko,bh)|0,Le=Le+Math.imul(Ko,au)|0,Le=Le+Math.imul(Kh,bh)|0,nn=nn+Math.imul(Kh,au)|0,R=R+Math.imul(Qf,wh)|0,Le=Le+Math.imul(Qf,qu)|0,Le=Le+Math.imul(Gh,wh)|0,nn=nn+Math.imul(Gh,qu)|0,R=R+Math.imul(Vo,_h)|0,Le=Le+Math.imul(Vo,uu)|0,Le=Le+Math.imul(Hh,_h)|0,nn=nn+Math.imul(Hh,uu)|0,R=R+Math.imul(To,yh)|0,Le=Le+Math.imul(To,Yh)|0,Le=Le+Math.imul(Oh,yh)|0,nn=nn+Math.imul(Oh,Yh)|0,R=R+Math.imul($i,Mh)|0,Le=Le+Math.imul($i,Hu)|0,Le=Le+Math.imul(ho,Mh)|0,nn=nn+Math.imul(ho,Hu)|0,R=R+Math.imul(on,qh)|0,Le=Le+Math.imul(on,Tu)|0,Le=Le+Math.imul(pn,qh)|0,nn=nn+Math.imul(pn,Tu)|0;var mc=(Wr+R|0)+((Le&8191)<<13)|0;Wr=(nn+(Le>>>13)|0)+(mc>>>26)|0,mc&=67108863,R=Math.imul(Yo,Sh),Le=Math.imul(Yo,Uu),Le=Le+Math.imul(Jh,Sh)|0,nn=Math.imul(Jh,Uu),R=R+Math.imul(Zo,gh)|0,Le=Le+Math.imul(Zo,Xh)|0,Le=Le+Math.imul(Wh,gh)|0,nn=nn+Math.imul(Wh,Xh)|0,R=R+Math.imul(Uo,bh)|0,Le=Le+Math.imul(Uo,au)|0,Le=Le+Math.imul(Vh,bh)|0,nn=nn+Math.imul(Vh,au)|0,R=R+Math.imul(Ko,wh)|0,Le=Le+Math.imul(Ko,qu)|0,Le=Le+Math.imul(Kh,wh)|0,nn=nn+Math.imul(Kh,qu)|0,R=R+Math.imul(Qf,_h)|0,Le=Le+Math.imul(Qf,uu)|0,Le=Le+Math.imul(Gh,_h)|0,nn=nn+Math.imul(Gh,uu)|0,R=R+Math.imul(Vo,yh)|0,Le=Le+Math.imul(Vo,Yh)|0,Le=Le+Math.imul(Hh,yh)|0,nn=nn+Math.imul(Hh,Yh)|0,R=R+Math.imul(To,Mh)|0,Le=Le+Math.imul(To,Hu)|0,Le=Le+Math.imul(Oh,Mh)|0,nn=nn+Math.imul(Oh,Hu)|0,R=R+Math.imul($i,qh)|0,Le=Le+Math.imul($i,Tu)|0,Le=Le+Math.imul(ho,qh)|0,nn=nn+Math.imul(ho,Tu)|0;var cc=(Wr+R|0)+((Le&8191)<<13)|0;Wr=(nn+(Le>>>13)|0)+(cc>>>26)|0,cc&=67108863,R=Math.imul(Yo,gh),Le=Math.imul(Yo,Xh),Le=Le+Math.imul(Jh,gh)|0,nn=Math.imul(Jh,Xh),R=R+Math.imul(Zo,bh)|0,Le=Le+Math.imul(Zo,au)|0,Le=Le+Math.imul(Wh,bh)|0,nn=nn+Math.imul(Wh,au)|0,R=R+Math.imul(Uo,wh)|0,Le=Le+Math.imul(Uo,qu)|0,Le=Le+Math.imul(Vh,wh)|0,nn=nn+Math.imul(Vh,qu)|0,R=R+Math.imul(Ko,_h)|0,Le=Le+Math.imul(Ko,uu)|0,Le=Le+Math.imul(Kh,_h)|0,nn=nn+Math.imul(Kh,uu)|0,R=R+Math.imul(Qf,yh)|0,Le=Le+Math.imul(Qf,Yh)|0,Le=Le+Math.imul(Gh,yh)|0,nn=nn+Math.imul(Gh,Yh)|0,R=R+Math.imul(Vo,Mh)|0,Le=Le+Math.imul(Vo,Hu)|0,Le=Le+Math.imul(Hh,Mh)|0,nn=nn+Math.imul(Hh,Hu)|0,R=R+Math.imul(To,qh)|0,Le=Le+Math.imul(To,Tu)|0,Le=Le+Math.imul(Oh,qh)|0,nn=nn+Math.imul(Oh,Tu)|0;var lc=(Wr+R|0)+((Le&8191)<<13)|0;Wr=(nn+(Le>>>13)|0)+(lc>>>26)|0,lc&=67108863,R=Math.imul(Yo,bh),Le=Math.imul(Yo,au),Le=Le+Math.imul(Jh,bh)|0,nn=Math.imul(Jh,au),R=R+Math.imul(Zo,wh)|0,Le=Le+Math.imul(Zo,qu)|0,Le=Le+Math.imul(Wh,wh)|0,nn=nn+Math.imul(Wh,qu)|0,R=R+Math.imul(Uo,_h)|0,Le=Le+Math.imul(Uo,uu)|0,Le=Le+Math.imul(Vh,_h)|0,nn=nn+Math.imul(Vh,uu)|0,R=R+Math.imul(Ko,yh)|0,Le=Le+Math.imul(Ko,Yh)|0,Le=Le+Math.imul(Kh,yh)|0,nn=nn+Math.imul(Kh,Yh)|0,R=R+Math.imul(Qf,Mh)|0,Le=Le+Math.imul(Qf,Hu)|0,Le=Le+Math.imul(Gh,Mh)|0,nn=nn+Math.imul(Gh,Hu)|0,R=R+Math.imul(Vo,qh)|0,Le=Le+Math.imul(Vo,Tu)|0,Le=Le+Math.imul(Hh,qh)|0,nn=nn+Math.imul(Hh,Tu)|0;var dc=(Wr+R|0)+((Le&8191)<<13)|0;Wr=(nn+(Le>>>13)|0)+(dc>>>26)|0,dc&=67108863,R=Math.imul(Yo,wh),Le=Math.imul(Yo,qu),Le=Le+Math.imul(Jh,wh)|0,nn=Math.imul(Jh,qu),R=R+Math.imul(Zo,_h)|0,Le=Le+Math.imul(Zo,uu)|0,Le=Le+Math.imul(Wh,_h)|0,nn=nn+Math.imul(Wh,uu)|0,R=R+Math.imul(Uo,yh)|0,Le=Le+Math.imul(Uo,Yh)|0,Le=Le+Math.imul(Vh,yh)|0,nn=nn+Math.imul(Vh,Yh)|0,R=R+Math.imul(Ko,Mh)|0,Le=Le+Math.imul(Ko,Hu)|0,Le=Le+Math.imul(Kh,Mh)|0,nn=nn+Math.imul(Kh,Hu)|0,R=R+Math.imul(Qf,qh)|0,Le=Le+Math.imul(Qf,Tu)|0,Le=Le+Math.imul(Gh,qh)|0,nn=nn+Math.imul(Gh,Tu)|0;var $0=(Wr+R|0)+((Le&8191)<<13)|0;Wr=(nn+(Le>>>13)|0)+($0>>>26)|0,$0&=67108863,R=Math.imul(Yo,_h),Le=Math.imul(Yo,uu),Le=Le+Math.imul(Jh,_h)|0,nn=Math.imul(Jh,uu),R=R+Math.imul(Zo,yh)|0,Le=Le+Math.imul(Zo,Yh)|0,Le=Le+Math.imul(Wh,yh)|0,nn=nn+Math.imul(Wh,Yh)|0,R=R+Math.imul(Uo,Mh)|0,Le=Le+Math.imul(Uo,Hu)|0,Le=Le+Math.imul(Vh,Mh)|0,nn=nn+Math.imul(Vh,Hu)|0,R=R+Math.imul(Ko,qh)|0,Le=Le+Math.imul(Ko,Tu)|0,Le=Le+Math.imul(Kh,qh)|0,nn=nn+Math.imul(Kh,Tu)|0;var gc=(Wr+R|0)+((Le&8191)<<13)|0;Wr=(nn+(Le>>>13)|0)+(gc>>>26)|0,gc&=67108863,R=Math.imul(Yo,yh),Le=Math.imul(Yo,Yh),Le=Le+Math.imul(Jh,yh)|0,nn=Math.imul(Jh,Yh),R=R+Math.imul(Zo,Mh)|0,Le=Le+Math.imul(Zo,Hu)|0,Le=Le+Math.imul(Wh,Mh)|0,nn=nn+Math.imul(Wh,Hu)|0,R=R+Math.imul(Uo,qh)|0,Le=Le+Math.imul(Uo,Tu)|0,Le=Le+Math.imul(Vh,qh)|0,nn=nn+Math.imul(Vh,Tu)|0;var bc=(Wr+R|0)+((Le&8191)<<13)|0;Wr=(nn+(Le>>>13)|0)+(bc>>>26)|0,bc&=67108863,R=Math.imul(Yo,Mh),Le=Math.imul(Yo,Hu),Le=Le+Math.imul(Jh,Mh)|0,nn=Math.imul(Jh,Hu),R=R+Math.imul(Zo,qh)|0,Le=Le+Math.imul(Zo,Tu)|0,Le=Le+Math.imul(Wh,qh)|0,nn=nn+Math.imul(Wh,Tu)|0;var yc=(Wr+R|0)+((Le&8191)<<13)|0;Wr=(nn+(Le>>>13)|0)+(yc>>>26)|0,yc&=67108863,R=Math.imul(Yo,qh),Le=Math.imul(Yo,Tu),Le=Le+Math.imul(Jh,qh)|0,nn=Math.imul(Jh,Tu);var Vl=(Wr+R|0)+((Le&8191)<<13)|0;return Wr=(nn+(Le>>>13)|0)+(Vl>>>26)|0,Vl&=67108863,ii[0]=tc,ii[1]=rc,ii[2]=ic,ii[3]=nc,ii[4]=sc,ii[5]=s0,ii[6]=hc,ii[7]=pc,ii[8]=uc,ii[9]=vc,ii[10]=mc,ii[11]=cc,ii[12]=lc,ii[13]=dc,ii[14]=$0,ii[15]=gc,ii[16]=bc,ii[17]=yc,ii[18]=Vl,Wr!==0&&(ii[19]=Wr,Te.length++),Te};Math.imul||(fn=ln);function gn(F,Ie,Te){Te.negative=Ie.negative^F.negative,Te.length=F.length+Ie.length;for(var Xr=0,ei=0,ii=0;ii>>26)|0,ei+=Wr>>>26,Wr&=67108863}Te.words[ii]=R,Xr=Wr,Wr=ei}return Xr!==0?Te.words[ii]=Xr:Te.length--,Te._strip()}function cn(F,Ie,Te){return gn(F,Ie,Te)}W.prototype.mulTo=function(F,Ie){var Te,Xr=this.length+F.length;return this.length===10&&F.length===10?Te=fn(this,F,Ie):Xr<63?Te=ln(this,F,Ie):Xr<1024?Te=gn(this,F,Ie):Te=cn(this,F,Ie),Te},W.prototype.mul=function(F){var Ie=new W(null);return Ie.words=new Array(this.length+F.length),this.mulTo(F,Ie)},W.prototype.mulf=function(F){var Ie=new W(null);return Ie.words=new Array(this.length+F.length),cn(this,F,Ie)},W.prototype.imul=function(F){return this.clone().mulTo(F,this)},W.prototype.imuln=function(F){var Ie=F<0;Ie&&(F=-F),Y(typeof F=="number"),Y(F<67108864);for(var Te=0,Xr=0;Xr>=26,Te+=ei/67108864|0,Te+=ii>>>26,this.words[Xr]=ii&67108863}return Te!==0&&(this.words[Xr]=Te,this.length++),Ie?this.ineg():this},W.prototype.muln=function(F){return this.clone().imuln(F)},W.prototype.sqr=function(){return this.mul(this)},W.prototype.isqr=function(){return this.imul(this.clone())},W.prototype.pow=function(F){var Ie=hn(F);if(Ie.length===0)return new W(1);for(var Te=this,Xr=0;Xr=0);var Ie=F%26,Te=(F-Ie)/26,Xr=67108863>>>26-Ie<<26-Ie,ei;if(Ie!==0){var ii=0;for(ei=0;ei>>26-Ie}ii&&(this.words[ei]=ii,this.length++)}if(Te!==0){for(ei=this.length-1;ei>=0;ei--)this.words[ei+Te]=this.words[ei];for(ei=0;ei=0);var Xr;Ie?Xr=(Ie-Ie%26)/26:Xr=0;var ei=F%26,ii=Math.min((F-ei)/26,this.length),Wr=67108863^67108863>>>ei<ii)for(this.length-=ii,Le=0;Le=0&&(nn!==0||Le>=Xr);Le--){var vn=this.words[Le]|0;this.words[Le]=nn<<26-ei|vn>>>ei,nn=vn&Wr}return R&&nn!==0&&(R.words[R.length++]=nn),this.length===0&&(this.words[0]=0,this.length=1),this._strip()},W.prototype.ishrn=function(F,Ie,Te){return Y(this.negative===0),this.iushrn(F,Ie,Te)},W.prototype.shln=function(F){return this.clone().ishln(F)},W.prototype.ushln=function(F){return this.clone().iushln(F)},W.prototype.shrn=function(F){return this.clone().ishrn(F)},W.prototype.ushrn=function(F){return this.clone().iushrn(F)},W.prototype.testn=function(F){Y(typeof F=="number"&&F>=0);var Ie=F%26,Te=(F-Ie)/26,Xr=1<=0);var Ie=F%26,Te=(F-Ie)/26;if(Y(this.negative===0,"imaskn works only with positive numbers"),this.length<=Te)return this;if(Ie!==0&&Te++,this.length=Math.min(Te,this.length),Ie!==0){var Xr=67108863^67108863>>>Ie<=67108864;Ie++)this.words[Ie]-=67108864,Ie===this.length-1?this.words[Ie+1]=1:this.words[Ie+1]++;return this.length=Math.max(this.length,Ie+1),this},W.prototype.isubn=function(F){if(Y(typeof F=="number"),Y(F<67108864),F<0)return this.iaddn(-F);if(this.negative!==0)return this.negative=0,this.iaddn(F),this.negative=1,this;if(this.words[0]-=F,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var Ie=0;Ie>26)-(R/67108864|0),this.words[ei+Te]=ii&67108863}for(;ei>26,this.words[ei+Te]=ii&67108863;if(Wr===0)return this._strip();for(Y(Wr===-1),Wr=0,ei=0;ei>26,this.words[ei]=ii&67108863;return this.negative=1,this._strip()},W.prototype._wordDiv=function(F,Ie){var Te=this.length-F.length,Xr=this.clone(),ei=F,ii=ei.words[ei.length-1]|0,Wr=this._countBits(ii);Te=26-Wr,Te!==0&&(ei=ei.ushln(Te),Xr.iushln(Te),ii=ei.words[ei.length-1]|0);var R=Xr.length-ei.length,Le;if(Ie!=="mod"){Le=new W(null),Le.length=R+1,Le.words=new Array(Le.length);for(var nn=0;nn=0;Mn--){var sn=(Xr.words[ei.length+Mn]|0)*67108864+(Xr.words[ei.length+Mn-1]|0);for(sn=Math.min(sn/ii|0,67108863),Xr._ishlnsubmul(ei,sn,Mn);Xr.negative!==0;)sn--,Xr.negative=0,Xr._ishlnsubmul(ei,1,Mn),Xr.isZero()||(Xr.negative^=1);Le&&(Le.words[Mn]=sn)}return Le&&Le._strip(),Xr._strip(),Ie!=="div"&&Te!==0&&Xr.iushrn(Te),{div:Le||null,mod:Xr}},W.prototype.divmod=function(F,Ie,Te){if(Y(!F.isZero()),this.isZero())return{div:new W(0),mod:new W(0)};var Xr,ei,ii;return this.negative!==0&&F.negative===0?(ii=this.neg().divmod(F,Ie),Ie!=="mod"&&(Xr=ii.div.neg()),Ie!=="div"&&(ei=ii.mod.neg(),Te&&ei.negative!==0&&ei.iadd(F)),{div:Xr,mod:ei}):this.negative===0&&F.negative!==0?(ii=this.divmod(F.neg(),Ie),Ie!=="mod"&&(Xr=ii.div.neg()),{div:Xr,mod:ii.mod}):this.negative&F.negative?(ii=this.neg().divmod(F.neg(),Ie),Ie!=="div"&&(ei=ii.mod.neg(),Te&&ei.negative!==0&&ei.isub(F)),{div:ii.div,mod:ei}):F.length>this.length||this.cmp(F)<0?{div:new W(0),mod:this}:F.length===1?Ie==="div"?{div:this.divn(F.words[0]),mod:null}:Ie==="mod"?{div:null,mod:new W(this.modrn(F.words[0]))}:{div:this.divn(F.words[0]),mod:new W(this.modrn(F.words[0]))}:this._wordDiv(F,Ie)},W.prototype.div=function(F){return this.divmod(F,"div",!1).div},W.prototype.mod=function(F){return this.divmod(F,"mod",!1).mod},W.prototype.umod=function(F){return this.divmod(F,"mod",!0).mod},W.prototype.divRound=function(F){var Ie=this.divmod(F);if(Ie.mod.isZero())return Ie.div;var Te=Ie.div.negative!==0?Ie.mod.isub(F):Ie.mod,Xr=F.ushrn(1),ei=F.andln(1),ii=Te.cmp(Xr);return ii<0||ei===1&&ii===0?Ie.div:Ie.div.negative!==0?Ie.div.isubn(1):Ie.div.iaddn(1)},W.prototype.modrn=function(F){var Ie=F<0;Ie&&(F=-F),Y(F<=67108863);for(var Te=(1<<26)%F,Xr=0,ei=this.length-1;ei>=0;ei--)Xr=(Te*Xr+(this.words[ei]|0))%F;return Ie?-Xr:Xr},W.prototype.modn=function(F){return this.modrn(F)},W.prototype.idivn=function(F){var Ie=F<0;Ie&&(F=-F),Y(F<=67108863);for(var Te=0,Xr=this.length-1;Xr>=0;Xr--){var ei=(this.words[Xr]|0)+Te*67108864;this.words[Xr]=ei/F|0,Te=ei%F}return this._strip(),Ie?this.ineg():this},W.prototype.divn=function(F){return this.clone().idivn(F)},W.prototype.egcd=function(F){Y(F.negative===0),Y(!F.isZero());var Ie=this,Te=F.clone();Ie.negative!==0?Ie=Ie.umod(F):Ie=Ie.clone();for(var Xr=new W(1),ei=new W(0),ii=new W(0),Wr=new W(1),R=0;Ie.isEven()&&Te.isEven();)Ie.iushrn(1),Te.iushrn(1),++R;for(var Le=Te.clone(),nn=Ie.clone();!Ie.isZero();){for(var vn=0,Mn=1;!(Ie.words[0]&Mn)&&vn<26;++vn,Mn<<=1);if(vn>0)for(Ie.iushrn(vn);vn-- >0;)(Xr.isOdd()||ei.isOdd())&&(Xr.iadd(Le),ei.isub(nn)),Xr.iushrn(1),ei.iushrn(1);for(var sn=0,Zn=1;!(Te.words[0]&Zn)&&sn<26;++sn,Zn<<=1);if(sn>0)for(Te.iushrn(sn);sn-- >0;)(ii.isOdd()||Wr.isOdd())&&(ii.iadd(Le),Wr.isub(nn)),ii.iushrn(1),Wr.iushrn(1);Ie.cmp(Te)>=0?(Ie.isub(Te),Xr.isub(ii),ei.isub(Wr)):(Te.isub(Ie),ii.isub(Xr),Wr.isub(ei))}return{a:ii,b:Wr,gcd:Te.iushln(R)}},W.prototype._invmp=function(F){Y(F.negative===0),Y(!F.isZero());var Ie=this,Te=F.clone();Ie.negative!==0?Ie=Ie.umod(F):Ie=Ie.clone();for(var Xr=new W(1),ei=new W(0),ii=Te.clone();Ie.cmpn(1)>0&&Te.cmpn(1)>0;){for(var Wr=0,R=1;!(Ie.words[0]&R)&&Wr<26;++Wr,R<<=1);if(Wr>0)for(Ie.iushrn(Wr);Wr-- >0;)Xr.isOdd()&&Xr.iadd(ii),Xr.iushrn(1);for(var Le=0,nn=1;!(Te.words[0]&nn)&&Le<26;++Le,nn<<=1);if(Le>0)for(Te.iushrn(Le);Le-- >0;)ei.isOdd()&&ei.iadd(ii),ei.iushrn(1);Ie.cmp(Te)>=0?(Ie.isub(Te),Xr.isub(ei)):(Te.isub(Ie),ei.isub(Xr))}var vn;return Ie.cmpn(1)===0?vn=Xr:vn=ei,vn.cmpn(0)<0&&vn.iadd(F),vn},W.prototype.gcd=function(F){if(this.isZero())return F.abs();if(F.isZero())return this.abs();var Ie=this.clone(),Te=F.clone();Ie.negative=0,Te.negative=0;for(var Xr=0;Ie.isEven()&&Te.isEven();Xr++)Ie.iushrn(1),Te.iushrn(1);do{for(;Ie.isEven();)Ie.iushrn(1);for(;Te.isEven();)Te.iushrn(1);var ei=Ie.cmp(Te);if(ei<0){var ii=Ie;Ie=Te,Te=ii}else if(ei===0||Te.cmpn(1)===0)break;Ie.isub(Te)}while(!0);return Te.iushln(Xr)},W.prototype.invm=function(F){return this.egcd(F).a.umod(F)},W.prototype.isEven=function(){return(this.words[0]&1)===0},W.prototype.isOdd=function(){return(this.words[0]&1)===1},W.prototype.andln=function(F){return this.words[0]&F},W.prototype.bincn=function(F){Y(typeof F=="number");var Ie=F%26,Te=(F-Ie)/26,Xr=1<>>26,Wr&=67108863,this.words[ii]=Wr}return ei!==0&&(this.words[ii]=ei,this.length++),this},W.prototype.isZero=function(){return this.length===1&&this.words[0]===0},W.prototype.cmpn=function(F){var Ie=F<0;if(this.negative!==0&&!Ie)return-1;if(this.negative===0&&Ie)return 1;this._strip();var Te;if(this.length>1)Te=1;else{Ie&&(F=-F),Y(F<=67108863,"Number is too big");var Xr=this.words[0]|0;Te=Xr===F?0:XrF.length)return 1;if(this.length=0;Te--){var Xr=this.words[Te]|0,ei=F.words[Te]|0;if(Xr!==ei){Xrei&&(Ie=1);break}}return Ie},W.prototype.gtn=function(F){return this.cmpn(F)===1},W.prototype.gt=function(F){return this.cmp(F)===1},W.prototype.gten=function(F){return this.cmpn(F)>=0},W.prototype.gte=function(F){return this.cmp(F)>=0},W.prototype.ltn=function(F){return this.cmpn(F)===-1},W.prototype.lt=function(F){return this.cmp(F)===-1},W.prototype.lten=function(F){return this.cmpn(F)<=0},W.prototype.lte=function(F){return this.cmp(F)<=0},W.prototype.eqn=function(F){return this.cmpn(F)===0},W.prototype.eq=function(F){return this.cmp(F)===0},W.red=function(F){return new oi(F)},W.prototype.toRed=function(F){return Y(!this.red,"Already a number in reduction context"),Y(this.negative===0,"red works only with positives"),F.convertTo(this)._forceRed(F)},W.prototype.fromRed=function(){return Y(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},W.prototype._forceRed=function(F){return this.red=F,this},W.prototype.forceRed=function(F){return Y(!this.red,"Already a number in reduction context"),this._forceRed(F)},W.prototype.redAdd=function(F){return Y(this.red,"redAdd works only with red numbers"),this.red.add(this,F)},W.prototype.redIAdd=function(F){return Y(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,F)},W.prototype.redSub=function(F){return Y(this.red,"redSub works only with red numbers"),this.red.sub(this,F)},W.prototype.redISub=function(F){return Y(this.red,"redISub works only with red numbers"),this.red.isub(this,F)},W.prototype.redShl=function(F){return Y(this.red,"redShl works only with red numbers"),this.red.shl(this,F)},W.prototype.redMul=function(F){return Y(this.red,"redMul works only with red numbers"),this.red._verify2(this,F),this.red.mul(this,F)},W.prototype.redIMul=function(F){return Y(this.red,"redMul works only with red numbers"),this.red._verify2(this,F),this.red.imul(this,F)},W.prototype.redSqr=function(){return Y(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},W.prototype.redISqr=function(){return Y(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},W.prototype.redSqrt=function(){return Y(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},W.prototype.redInvm=function(){return Y(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},W.prototype.redNeg=function(){return Y(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},W.prototype.redPow=function(F){return Y(this.red&&!F.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,F)};var An={k256:null,p224:null,p192:null,p25519:null};function Cn(F,Ie){this.name=F,this.p=new W(Ie,16),this.n=this.p.bitLength(),this.k=new W(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}Cn.prototype._tmp=function(){var F=new W(null);return F.words=new Array(Math.ceil(this.n/13)),F},Cn.prototype.ireduce=function(F){var Ie=F,Te;do this.split(Ie,this.tmp),Ie=this.imulK(Ie),Ie=Ie.iadd(this.tmp),Te=Ie.bitLength();while(Te>this.n);var Xr=Te0?Ie.isub(this.p):Ie.strip!==void 0?Ie.strip():Ie._strip(),Ie},Cn.prototype.split=function(F,Ie){F.iushrn(this.n,0,Ie)},Cn.prototype.imulK=function(F){return F.imul(this.k)};function an(){Cn.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}Ne(an,Cn),an.prototype.split=function(F,Ie){for(var Te=4194303,Xr=Math.min(F.length,9),ei=0;ei>>22,ii=Wr}ii>>>=22,F.words[ei-10]=ii,ii===0&&F.length>10?F.length-=10:F.length-=9},an.prototype.imulK=function(F){F.words[F.length]=0,F.words[F.length+1]=0,F.length+=2;for(var Ie=0,Te=0;Te>>=26,F.words[Te]=ei,Ie=Xr}return Ie!==0&&(F.words[F.length++]=Ie),F},W._prime=function(F){if(An[F])return An[F];var Ie;if(F==="k256")Ie=new an;else if(F==="p224")Ie=new Rn;else if(F==="p192")Ie=new Ya;else if(F==="p25519")Ie=new Ho;else throw new Error("Unknown prime "+F);return An[F]=Ie,Ie};function oi(F){if(typeof F=="string"){var Ie=W._prime(F);this.m=Ie.p,this.prime=Ie}else Y(F.gtn(1),"modulus must be greater than 1"),this.m=F,this.prime=null}oi.prototype._verify1=function(F){Y(F.negative===0,"red works only with positives"),Y(F.red,"red works only with red numbers")},oi.prototype._verify2=function(F,Ie){Y((F.negative|Ie.negative)===0,"red works only with positives"),Y(F.red&&F.red===Ie.red,"red works only with red numbers")},oi.prototype.imod=function(F){return this.prime?this.prime.ireduce(F)._forceRed(this):(ti(F,F.umod(this.m)._forceRed(this)),F)},oi.prototype.neg=function(F){return F.isZero()?F.clone():this.m.sub(F)._forceRed(this)},oi.prototype.add=function(F,Ie){this._verify2(F,Ie);var Te=F.add(Ie);return Te.cmp(this.m)>=0&&Te.isub(this.m),Te._forceRed(this)},oi.prototype.iadd=function(F,Ie){this._verify2(F,Ie);var Te=F.iadd(Ie);return Te.cmp(this.m)>=0&&Te.isub(this.m),Te},oi.prototype.sub=function(F,Ie){this._verify2(F,Ie);var Te=F.sub(Ie);return Te.cmpn(0)<0&&Te.iadd(this.m),Te._forceRed(this)},oi.prototype.isub=function(F,Ie){this._verify2(F,Ie);var Te=F.isub(Ie);return Te.cmpn(0)<0&&Te.iadd(this.m),Te},oi.prototype.shl=function(F,Ie){return this._verify1(F),this.imod(F.ushln(Ie))},oi.prototype.imul=function(F,Ie){return this._verify2(F,Ie),this.imod(F.imul(Ie))},oi.prototype.mul=function(F,Ie){return this._verify2(F,Ie),this.imod(F.mul(Ie))},oi.prototype.isqr=function(F){return this.imul(F,F.clone())},oi.prototype.sqr=function(F){return this.mul(F,F)},oi.prototype.sqrt=function(F){if(F.isZero())return F.clone();var Ie=this.m.andln(3);if(Y(Ie%2===1),Ie===3){var Te=this.m.add(new W(1)).iushrn(2);return this.pow(F,Te)}for(var Xr=this.m.subn(1),ei=0;!Xr.isZero()&&Xr.andln(1)===0;)ei++,Xr.iushrn(1);Y(!Xr.isZero());var ii=new W(1).toRed(this),Wr=ii.redNeg(),R=this.m.subn(1).iushrn(1),Le=this.m.bitLength();for(Le=new W(2*Le*Le).toRed(this);this.pow(Le,R).cmp(Wr)!==0;)Le.redIAdd(Wr);for(var nn=this.pow(Le,Xr),vn=this.pow(F,Xr.addn(1).iushrn(1)),Mn=this.pow(F,Xr),sn=ei;Mn.cmp(ii)!==0;){for(var Zn=Mn,on=0;Zn.cmp(ii)!==0;on++)Zn=Zn.redSqr();Y(on=0;ei--){for(var nn=Ie.words[ei],vn=Le-1;vn>=0;vn--){var Mn=nn>>vn&1;if(ii!==Xr[0]&&(ii=this.sqr(ii)),Mn===0&&Wr===0){R=0;continue}Wr<<=1,Wr|=Mn,R++,!(R!==Te&&(ei!==0||vn!==0))&&(ii=this.mul(ii,Xr[Wr]),R=0,Wr=0)}Le=26}return ii},oi.prototype.convertTo=function(F){var Ie=F.umod(this.m);return Ie===F?Ie.clone():Ie},oi.prototype.convertFrom=function(F){var Ie=F.clone();return Ie.red=null,Ie},W.mont=function(F){return new t(F)};function t(F){oi.call(this,F),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new W(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}Ne(t,oi),t.prototype.convertTo=function(F){return this.imod(F.ushln(this.shift))},t.prototype.convertFrom=function(F){var Ie=this.imod(F.mul(this.rinv));return Ie.red=null,Ie},t.prototype.imul=function(F,Ie){if(F.isZero()||Ie.isZero())return F.words[0]=0,F.length=1,F;var Te=F.imul(Ie),Xr=Te.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),ei=Te.isub(Xr).iushrn(this.shift),ii=ei;return ei.cmp(this.m)>=0?ii=ei.isub(this.m):ei.cmpn(0)<0&&(ii=ei.iadd(this.m)),ii._forceRed(this)},t.prototype.mul=function(F,Ie){if(F.isZero()||Ie.isZero())return new W(0)._forceRed(this);var Te=F.mul(Ie),Xr=Te.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),ei=Te.isub(Xr).iushrn(this.shift),ii=ei;return ei.cmp(this.m)>=0?ii=ei.isub(this.m):ei.cmpn(0)<0&&(ii=ei.iadd(this.m)),ii._forceRed(this)},t.prototype.invm=function(F){var Ie=this.imod(F._invmp(this.m).mul(this.r2));return Ie._forceRed(this)}})(G,On)})(Ln);var K$1=Ln.exports;const jn="bignumber/5.7.0";var Rr$1=K$1.BN;const Ae=new L$4(jn),wi={},Qn=9007199254740991;function C0(G){return G!=null&&(V$1.isBigNumber(G)||typeof G=="number"&&G%1===0||typeof G=="string"&&!!G.match(/^-?[0-9]+$/)||Qt(G)||typeof G=="bigint"||ir$1(G))}let Jn=!1,V$1=class _l{constructor(e,H){e!==wi&&Ae.throwError("cannot call constructor directly; use BigNumber.from",L$4.errors.UNSUPPORTED_OPERATION,{operation:"new (BigNumber)"}),this._hex=H,this._isBigNumber=!0,Object.freeze(this)}fromTwos(e){return Lt$1(j$4(this).fromTwos(e))}toTwos(e){return Lt$1(j$4(this).toTwos(e))}abs(){return this._hex[0]==="-"?_l.from(this._hex.substring(1)):this}add(e){return Lt$1(j$4(this).add(j$4(e)))}sub(e){return Lt$1(j$4(this).sub(j$4(e)))}div(e){return _l.from(e).isZero()&&Wt$1("division-by-zero","div"),Lt$1(j$4(this).div(j$4(e)))}mul(e){return Lt$1(j$4(this).mul(j$4(e)))}mod(e){const H=j$4(e);return H.isNeg()&&Wt$1("division-by-zero","mod"),Lt$1(j$4(this).umod(H))}pow(e){const H=j$4(e);return H.isNeg()&&Wt$1("negative-power","pow"),Lt$1(j$4(this).pow(H))}and(e){const H=j$4(e);return(this.isNegative()||H.isNeg())&&Wt$1("unbound-bitwise-result","and"),Lt$1(j$4(this).and(H))}or(e){const H=j$4(e);return(this.isNegative()||H.isNeg())&&Wt$1("unbound-bitwise-result","or"),Lt$1(j$4(this).or(H))}xor(e){const H=j$4(e);return(this.isNegative()||H.isNeg())&&Wt$1("unbound-bitwise-result","xor"),Lt$1(j$4(this).xor(H))}mask(e){return(this.isNegative()||e<0)&&Wt$1("negative-width","mask"),Lt$1(j$4(this).maskn(e))}shl(e){return(this.isNegative()||e<0)&&Wt$1("negative-width","shl"),Lt$1(j$4(this).shln(e))}shr(e){return(this.isNegative()||e<0)&&Wt$1("negative-width","shr"),Lt$1(j$4(this).shrn(e))}eq(e){return j$4(this).eq(j$4(e))}lt(e){return j$4(this).lt(j$4(e))}lte(e){return j$4(this).lte(j$4(e))}gt(e){return j$4(this).gt(j$4(e))}gte(e){return j$4(this).gte(j$4(e))}isNegative(){return this._hex[0]==="-"}isZero(){return j$4(this).isZero()}toNumber(){try{return j$4(this).toNumber()}catch{Wt$1("overflow","toNumber",this.toString())}return null}toBigInt(){try{return BigInt(this.toString())}catch{}return Ae.throwError("this platform does not support BigInt",L$4.errors.UNSUPPORTED_OPERATION,{value:this.toString()})}toString(){return arguments.length>0&&(arguments[0]===10?Jn||(Jn=!0,Ae.warn("BigNumber.toString does not accept any parameters; base-10 is assumed")):arguments[0]===16?Ae.throwError("BigNumber.toString does not accept any parameters; use bigNumber.toHexString()",L$4.errors.UNEXPECTED_ARGUMENT,{}):Ae.throwError("BigNumber.toString does not accept parameters",L$4.errors.UNEXPECTED_ARGUMENT,{})),j$4(this).toString(10)}toHexString(){return this._hex}toJSON(e){return{type:"BigNumber",hex:this.toHexString()}}static from(e){if(e instanceof _l)return e;if(typeof e=="string")return e.match(/^-?0x[0-9a-f]+$/i)?new _l(wi,vr$1(e)):e.match(/^-?[0-9]+$/)?new _l(wi,vr$1(new Rr$1(e))):Ae.throwArgumentError("invalid BigNumber string","value",e);if(typeof e=="number")return e%1&&Wt$1("underflow","BigNumber.from",e),(e>=Qn||e<=-Qn)&&Wt$1("overflow","BigNumber.from",e),_l.from(String(e));const H=e;if(typeof H=="bigint")return _l.from(H.toString());if(ir$1(H))return _l.from(Kt$1(H));if(H)if(H.toHexString){const Y=H.toHexString();if(typeof Y=="string")return _l.from(Y)}else{let Y=H._hex;if(Y==null&&H.type==="BigNumber"&&(Y=H.hex),typeof Y=="string"&&(Qt(Y)||Y[0]==="-"&&Qt(Y.substring(1))))return _l.from(Y)}return Ae.throwArgumentError("invalid BigNumber value","value",e)}static isBigNumber(e){return!!(e&&e._isBigNumber)}};function vr$1(G){if(typeof G!="string")return vr$1(G.toString(16));if(G[0]==="-")return G=G.substring(1),G[0]==="-"&&Ae.throwArgumentError("invalid hex","value",G),G=vr$1(G),G==="0x00"?G:"-"+G;if(G.substring(0,2)!=="0x"&&(G="0x"+G),G==="0x")return"0x00";for(G.length%2&&(G="0x0"+G.substring(2));G.length>4&&G.substring(0,4)==="0x00";)G="0x"+G.substring(4);return G}function Lt$1(G){return V$1.from(vr$1(G))}function j$4(G){const e=V$1.from(G).toHexString();return e[0]==="-"?new Rr$1("-"+e.substring(3),16):new Rr$1(e.substring(2),16)}function Wt$1(G,e,H){const Y={fault:G,operation:e};return H!=null&&(Y.value=H),Ae.throwError(G,L$4.errors.NUMERIC_FAULT,Y)}function R0(G){return new Rr$1(G,36).toString(16)}const Ht$1=new L$4(jn),mr$1={},Gn=V$1.from(0),Yn=V$1.from(-1);function Vn$1(G,e,H,Y){const Ne={fault:e,operation:H};return Y!==void 0&&(Ne.value=Y),Ht$1.throwError(G,L$4.errors.NUMERIC_FAULT,Ne)}let gr$1="0";for(;gr$1.length<256;)gr$1+=gr$1;function xi(G){if(typeof G!="number")try{G=V$1.from(G).toNumber()}catch{}return typeof G=="number"&&G>=0&&G<=256&&!(G%1)?"1"+gr$1.substring(0,G):Ht$1.throwArgumentError("invalid decimal size","decimals",G)}function Mi$1(G,e){e==null&&(e=0);const H=xi(e);G=V$1.from(G);const Y=G.lt(Gn);Y&&(G=G.mul(Yn));let Ne=G.mod(H).toString();for(;Ne.length2&&Ht$1.throwArgumentError("too many decimal points","value",G);let W=Ne[0],ri=Ne[1];for(W||(W="0"),ri||(ri="0");ri[ri.length-1]==="0";)ri=ri.substring(0,ri.length-1);for(ri.length>H.length-1&&Vn$1("fractional component exceeds decimals","underflow","parseFixed"),ri===""&&(ri="0");ri.lengthe[ri]==null?fi:(typeof e[ri]!==si&&Ht$1.throwArgumentError("invalid fixed format ("+ri+" not "+si+")","format."+ri,e[ri]),e[ri]);H=W("signed","boolean",H),Y=W("width","number",Y),Ne=W("decimals","number",Ne)}return Y%8&&Ht$1.throwArgumentError("invalid fixed format width (not byte aligned)","format.width",Y),Ne>80&&Ht$1.throwArgumentError("invalid fixed format (decimals too large)","format.decimals",Ne),new dv(mr$1,H,Y,Ne)}},Ut$1=class Zc{constructor(e,H,Y,Ne){e!==mr$1&&Ht$1.throwError("cannot use FixedNumber constructor; use FixedNumber.from",L$4.errors.UNSUPPORTED_OPERATION,{operation:"new FixedFormat"}),this.format=Ne,this._hex=H,this._value=Y,this._isFixedNumber=!0,Object.freeze(this)}_checkFormat(e){this.format.name!==e.format.name&&Ht$1.throwArgumentError("incompatible format; use fixedNumber.toFormat","other",e)}addUnsafe(e){this._checkFormat(e);const H=be$1(this._value,this.format.decimals),Y=be$1(e._value,e.format.decimals);return Zc.fromValue(H.add(Y),this.format.decimals,this.format)}subUnsafe(e){this._checkFormat(e);const H=be$1(this._value,this.format.decimals),Y=be$1(e._value,e.format.decimals);return Zc.fromValue(H.sub(Y),this.format.decimals,this.format)}mulUnsafe(e){this._checkFormat(e);const H=be$1(this._value,this.format.decimals),Y=be$1(e._value,e.format.decimals);return Zc.fromValue(H.mul(Y).div(this.format._multiplier),this.format.decimals,this.format)}divUnsafe(e){this._checkFormat(e);const H=be$1(this._value,this.format.decimals),Y=be$1(e._value,e.format.decimals);return Zc.fromValue(H.mul(this.format._multiplier).div(Y),this.format.decimals,this.format)}floor(){const e=this.toString().split(".");e.length===1&&e.push("0");let H=Zc.from(e[0],this.format);const Y=!e[1].match(/^(0*)$/);return this.isNegative()&&Y&&(H=H.subUnsafe(Wn.toFormat(H.format))),H}ceiling(){const e=this.toString().split(".");e.length===1&&e.push("0");let H=Zc.from(e[0],this.format);const Y=!e[1].match(/^(0*)$/);return!this.isNegative()&&Y&&(H=H.addUnsafe(Wn.toFormat(H.format))),H}round(e){e==null&&(e=0);const H=this.toString().split(".");if(H.length===1&&H.push("0"),(e<0||e>80||e%1)&&Ht$1.throwArgumentError("invalid decimal count","decimals",e),H[1].length<=e)return this;const Y=Zc.from("1"+gr$1.substring(0,e),this.format),Ne=O0.toFormat(this.format);return this.mulUnsafe(Y).addUnsafe(Ne).floor().divUnsafe(Y)}isZero(){return this._value==="0.0"||this._value==="0"}isNegative(){return this._value[0]==="-"}toString(){return this._value}toHexString(e){if(e==null)return this._hex;e%8&&Ht$1.throwArgumentError("invalid byte width","width",e);const H=V$1.from(this._hex).fromTwos(this.format.width).toTwos(e).toHexString();return oe$1(H,e/8)}toUnsafeFloat(){return parseFloat(this.toString())}toFormat(e){return Zc.fromString(this._value,e)}static fromValue(e,H,Y){return Y==null&&H!=null&&!C0(H)&&(Y=H,H=null),H==null&&(H=0),Y==null&&(Y="fixed"),Zc.fromString(Mi$1(e,H),dr$1.from(Y))}static fromString(e,H){H==null&&(H="fixed");const Y=dr$1.from(H),Ne=be$1(e,Y.decimals);!Y.signed&&Ne.lt(Gn)&&Vn$1("unsigned value cannot be negative","overflow","value",e);let W=null;Y.signed?W=Ne.toTwos(Y.width).toHexString():(W=Ne.toHexString(),W=oe$1(W,Y.width/8));const ri=Mi$1(Ne,Y.decimals);return new Zc(mr$1,W,ri,Y)}static fromBytes(e,H){H==null&&(H="fixed");const Y=dr$1.from(H);if(Ot$1(e).length>Y.width/8)throw new Error("overflow");let Ne=V$1.from(e);Y.signed&&(Ne=Ne.fromTwos(Y.width));const W=Ne.toTwos((Y.signed?0:1)+Y.width).toHexString(),ri=Mi$1(Ne,Y.decimals);return new Zc(mr$1,W,ri,Y)}static from(e,H){if(typeof e=="string")return Zc.fromString(e,H);if(ir$1(e))return Zc.fromBytes(e,H);try{return Zc.fromValue(e,0,H)}catch(Y){if(Y.code!==L$4.errors.INVALID_ARGUMENT)throw Y}return Ht$1.throwArgumentError("invalid FixedNumber value","value",e)}static isFixedNumber(e){return!!(e&&e._isFixedNumber)}};const Wn=Ut$1.from(1),O0=Ut$1.from("0.5"),P0="strings/5.7.0",Xn=new L$4(P0);var Or$1;(function(G){G.current="",G.NFC="NFC",G.NFD="NFD",G.NFKC="NFKC",G.NFKD="NFKD"})(Or$1||(Or$1={}));var nr$1;(function(G){G.UNEXPECTED_CONTINUE="unexpected continuation byte",G.BAD_PREFIX="bad codepoint prefix",G.OVERRUN="string overrun",G.MISSING_CONTINUE="missing continuation byte",G.OUT_OF_RANGE="out of UTF-8 range",G.UTF16_SURROGATE="UTF-16 surrogate",G.OVERLONG="overlong representation"})(nr$1||(nr$1={}));function Ei(G,e=Or$1.current){e!=Or$1.current&&(Xn.checkNormalize(),G=G.normalize(e));let H=[];for(let Y=0;Y>6|192),H.push(Ne&63|128);else if((Ne&64512)==55296){Y++;const W=G.charCodeAt(Y);if(Y>=G.length||(W&64512)!==56320)throw new Error("invalid utf-8 string");const ri=65536+((Ne&1023)<<10)+(W&1023);H.push(ri>>18|240),H.push(ri>>12&63|128),H.push(ri>>6&63|128),H.push(ri&63|128)}else H.push(Ne>>12|224),H.push(Ne>>6&63|128),H.push(Ne&63|128)}return Ot$1(H)}function T0(G){if(G.length%4!==0)throw new Error("bad data");let e=[];for(let H=0;H{let W=Ne.split(":");H+=parseInt(W[0],16),Y[H]=e(W[1])}),Y}function $n(G){let e=0;return G.split(",").map(H=>{let Y=H.split("-");Y.length===1?Y[1]="0":Y[1]===""&&(Y[1]="1");let Ne=e+parseInt(Y[0],16);return e=parseInt(Y[1],16),{l:Ne,h:e}})}$n("221,13-1b,5f-,40-10,51-f,11-3,3-3,2-2,2-4,8,2,15,2d,28-8,88,48,27-,3-5,11-20,27-,8,28,3-5,12,18,b-a,1c-4,6-16,2-d,2-2,2,1b-4,17-9,8f-,10,f,1f-2,1c-34,33-14e,4,36-,13-,6-2,1a-f,4,9-,3-,17,8,2-2,5-,2,8-,3-,4-8,2-3,3,6-,16-6,2-,7-3,3-,17,8,3,3,3-,2,6-3,3-,4-a,5,2-6,10-b,4,8,2,4,17,8,3,6-,b,4,4-,2-e,2-4,b-10,4,9-,3-,17,8,3-,5-,9-2,3-,4-7,3-3,3,4-3,c-10,3,7-2,4,5-2,3,2,3-2,3-2,4-2,9,4-3,6-2,4,5-8,2-e,d-d,4,9,4,18,b,6-3,8,4,5-6,3-8,3-3,b-11,3,9,4,18,b,6-3,8,4,5-6,3-6,2,3-3,b-11,3,9,4,18,11-3,7-,4,5-8,2-7,3-3,b-11,3,13-2,19,a,2-,8-2,2-3,7,2,9-11,4-b,3b-3,1e-24,3,2-,3,2-,2-5,5,8,4,2,2-,3,e,4-,6,2,7-,b-,3-21,49,23-5,1c-3,9,25,10-,2-2f,23,6,3,8-2,5-5,1b-45,27-9,2a-,2-3,5b-4,45-4,53-5,8,40,2,5-,8,2,5-,28,2,5-,20,2,5-,8,2,5-,8,8,18,20,2,5-,8,28,14-5,1d-22,56-b,277-8,1e-2,52-e,e,8-a,18-8,15-b,e,4,3-b,5e-2,b-15,10,b-5,59-7,2b-555,9d-3,5b-5,17-,7-,27-,7-,9,2,2,2,20-,36,10,f-,7,14-,4,a,54-3,2-6,6-5,9-,1c-10,13-1d,1c-14,3c-,10-6,32-b,240-30,28-18,c-14,a0,115-,3,66-,b-76,5,5-,1d,24,2,5-2,2,8-,35-2,19,f-10,1d-3,311-37f,1b,5a-b,d7-19,d-3,41,57-,68-4,29-3,5f,29-37,2e-2,25-c,2c-2,4e-3,30,78-3,64-,20,19b7-49,51a7-59,48e-2,38-738,2ba5-5b,222f-,3c-94,8-b,6-4,1b,6,2,3,3,6d-20,16e-f,41-,37-7,2e-2,11-f,5-b,18-,b,14,5-3,6,88-,2,bf-2,7-,7-,7-,4-2,8,8-9,8-2ff,20,5-b,1c-b4,27-,27-cbb1,f7-9,28-2,b5-221,56,48,3-,2-,3-,5,d,2,5,3,42,5-,9,8,1d,5,6,2-2,8,153-3,123-3,33-27fd,a6da-5128,21f-5df,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3-fffd,3,2-1d,61-ff7d"),"ad,34f,1806,180b,180c,180d,200b,200c,200d,2060,feff".split(",").map(G=>parseInt(G,16)),Si("b5:3bc,c3:ff,7:73,2:253,5:254,3:256,1:257,5:259,1:25b,3:260,1:263,2:269,1:268,5:26f,1:272,2:275,7:280,3:283,5:288,3:28a,1:28b,5:292,3f:195,1:1bf,29:19e,125:3b9,8b:3b2,1:3b8,1:3c5,3:3c6,1:3c0,1a:3ba,1:3c1,1:3c3,2:3b8,1:3b5,1bc9:3b9,1c:1f76,1:1f77,f:1f7a,1:1f7b,d:1f78,1:1f79,1:1f7c,1:1f7d,107:63,5:25b,4:68,1:68,1:68,3:69,1:69,1:6c,3:6e,4:70,1:71,1:72,1:72,1:72,7:7a,2:3c9,2:7a,2:6b,1:e5,1:62,1:63,3:65,1:66,2:6d,b:3b3,1:3c0,6:64,1b574:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3,20:3b8,1a:3c3"),Si("179:1,2:1,2:1,5:1,2:1,a:4f,a:1,8:1,2:1,2:1,3:1,5:1,3:1,4:1,2:1,3:1,4:1,8:2,1:1,2:2,1:1,2:2,27:2,195:26,2:25,1:25,1:25,2:40,2:3f,1:3f,33:1,11:-6,1:-9,1ac7:-3a,6d:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,b:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,c:-8,2:-8,2:-8,2:-8,9:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,1:-8,49:-8,1:-8,1:-4a,1:-4a,d:-56,1:-56,1:-56,1:-56,d:-8,1:-8,f:-8,1:-8,3:-7"),Si("df:00730073,51:00690307,19:02BC006E,a7:006A030C,18a:002003B9,16:03B903080301,20:03C503080301,1d7:05650582,190f:00680331,1:00740308,1:0077030A,1:0079030A,1:006102BE,b6:03C50313,2:03C503130300,2:03C503130301,2:03C503130342,2a:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F0003B9,1:1F0103B9,1:1F0203B9,1:1F0303B9,1:1F0403B9,1:1F0503B9,1:1F0603B9,1:1F0703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F2003B9,1:1F2103B9,1:1F2203B9,1:1F2303B9,1:1F2403B9,1:1F2503B9,1:1F2603B9,1:1F2703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,1:1F6003B9,1:1F6103B9,1:1F6203B9,1:1F6303B9,1:1F6403B9,1:1F6503B9,1:1F6603B9,1:1F6703B9,3:1F7003B9,1:03B103B9,1:03AC03B9,2:03B10342,1:03B1034203B9,5:03B103B9,6:1F7403B9,1:03B703B9,1:03AE03B9,2:03B70342,1:03B7034203B9,5:03B703B9,6:03B903080300,1:03B903080301,3:03B90342,1:03B903080342,b:03C503080300,1:03C503080301,1:03C10313,2:03C50342,1:03C503080342,b:1F7C03B9,1:03C903B9,1:03CE03B9,2:03C90342,1:03C9034203B9,5:03C903B9,ac:00720073,5b:00B00063,6:00B00066,d:006E006F,a:0073006D,1:00740065006C,1:0074006D,124f:006800700061,2:00610075,2:006F0076,b:00700061,1:006E0061,1:03BC0061,1:006D0061,1:006B0061,1:006B0062,1:006D0062,1:00670062,3:00700066,1:006E0066,1:03BC0066,4:0068007A,1:006B0068007A,1:006D0068007A,1:00670068007A,1:00740068007A,15:00700061,1:006B00700061,1:006D00700061,1:006700700061,8:00700076,1:006E0076,1:03BC0076,1:006D0076,1:006B0076,1:006D0076,1:00700077,1:006E0077,1:03BC0077,1:006D0077,1:006B0077,1:006D0077,1:006B03C9,1:006D03C9,2:00620071,3:00632215006B0067,1:0063006F002E,1:00640062,1:00670079,2:00680070,2:006B006B,1:006B006D,9:00700068,2:00700070006D,1:00700072,2:00730076,1:00770062,c723:00660066,1:00660069,1:0066006C,1:006600660069,1:00660066006C,1:00730074,1:00730074,d:05740576,1:05740565,1:0574056B,1:057E0576,1:0574056D",T0),$n("80-20,2a0-,39c,32,f71,18e,7f2-f,19-7,30-4,7-5,f81-b,5,a800-20ff,4d1-1f,110,fa-6,d174-7,2e84-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,ffff-,2,1f-5f,ff7f-20001");function U0(G){G=atob(G);const e=[];for(let H=0;H0&&Array.isArray(si)?Ne(si,ri-1):H.push(si)})};return Ne(G,e),H}function k0(G){const e={};for(let H=0;H>--fi&1}const hi=31,ci=Math.pow(2,hi),ui=ci>>>1,li=ui>>1,mi=ci-1;let hn=0;for(let An=0;An1;){let Ho=Cn+an>>>1;An>>1|ti(),Rn=Rn<<1^ui,Ya=(Ya^ui)<<1|ui|1;fn=Rn,gn=1+Ya-Rn}let cn=Y-4;return ln.map(An=>{switch(An-cn){case 3:return cn+65792+(G[si++]<<16|G[si++]<<8|G[si++]);case 2:return cn+256+(G[si++]<<8|G[si++]);case 1:return cn+G[si++];default:return An-1}})}function K0(G){let e=0;return()=>G[e++]}function H0(G){return K0(q0(G))}function z0(G){return G&1?~G>>1:G>>1}function L0(G,e){let H=Array(G);for(let Y=0;Ye[ri]):H}function Q0(G){let e=[];for(;;){let H=G();if(H==0)break;e.push(G0(H,G))}for(;;){let H=G()-1;if(H<0)break;e.push(Y0(H,G))}return k0(ef(e))}function J0(G){let e=[];for(;;){let H=G();if(H==0)break;e.push(H)}return e}function nf(G,e,H){let Y=Array(G).fill(void 0).map(()=>[]);for(let Ne=0;NeY[ri].push(W));return Y}function G0(G,e){let H=1+e(),Y=e(),Ne=J0(e),W=nf(Ne.length,1+G,e);return ef(W.map((ri,si)=>{const fi=ri[0],ai=ri.slice(1);return Array(Ne[si]).fill(void 0).map((ti,hi)=>{let ci=hi*Y;return[fi+hi*H,ai.map(ui=>ui+ci)]})}))}function Y0(G,e){let H=1+e();return nf(H,1+G,e).map(Y=>[Y[0],Y.slice(1)])}function V0(G){let e=Pr$1(G).sort((Y,Ne)=>Y-Ne);return H();function H(){let Y=[];for(;;){let ai=Pr$1(G,e);if(ai.length==0)break;Y.push({set:new Set(ai),node:H()})}Y.sort((ai,ti)=>ti.set.size-ai.set.size);let Ne=G(),W=Ne%3;Ne=Ne/3|0;let ri=!!(Ne&1);Ne>>=1;let si=Ne==1,fi=Ne==2;return{branches:Y,valid:W,fe0f:ri,save:si,check:fi}}}function W0(){return H0(U0("AEQF2AO2DEsA2wIrAGsBRABxAN8AZwCcAEwAqgA0AGwAUgByADcATAAVAFYAIQAyACEAKAAYAFgAGwAjABQAMAAmADIAFAAfABQAKwATACoADgAbAA8AHQAYABoAGQAxADgALAAoADwAEwA9ABMAGgARAA4ADwAWABMAFgAIAA8AHgQXBYMA5BHJAS8JtAYoAe4AExozi0UAH21tAaMnBT8CrnIyhrMDhRgDygIBUAEHcoFHUPe8AXBjAewCjgDQR8IICIcEcQLwATXCDgzvHwBmBoHNAqsBdBcUAykgDhAMShskMgo8AY8jqAQfAUAfHw8BDw87MioGlCIPBwZCa4ELatMAAMspJVgsDl8AIhckSg8XAHdvTwBcIQEiDT4OPhUqbyECAEoAS34Aej8Ybx83JgT/Xw8gHxZ/7w8RICxPHA9vBw+Pfw8PHwAPFv+fAsAvCc8vEr8ivwD/EQ8Bol8OEBa/A78hrwAPCU8vESNvvwWfHwNfAVoDHr+ZAAED34YaAdJPAK7PLwSEgDLHAGo1Pz8Pvx9fUwMrpb8O/58VTzAPIBoXIyQJNF8hpwIVAT8YGAUADDNBaX3RAMomJCg9EhUeA29MABsZBTMNJipjOhc19gcIDR8bBwQHEggCWi6DIgLuAQYA+BAFCha3A5XiAEsqM7UFFgFLhAMjFTMYE1Klnw74nRVBG/ASCm0BYRN/BrsU3VoWy+S0vV8LQx+vN8gF2AC2AK5EAWwApgYDKmAAroQ0NDQ0AT+OCg7wAAIHRAbpNgVcBV0APTA5BfbPFgMLzcYL/QqqA82eBALKCjQCjqYCht0/k2+OAsXQAoP3ASTKDgDw6ACKAUYCMpIKJpRaAE4A5womABzZvs0REEKiACIQAd5QdAECAj4Ywg/wGqY2AVgAYADYvAoCGAEubA0gvAY2ALAAbpbvqpyEAGAEpgQAJgAG7gAgAEACmghUFwCqAMpAINQIwC4DthRAAPcycKgApoIdABwBfCisABoATwBqASIAvhnSBP8aH/ECeAKXAq40NjgDBTwFYQU6AXs3oABgAD4XNgmcCY1eCl5tIFZeUqGgyoNHABgAEQAaABNwWQAmABMATPMa3T34ADldyprmM1M2XociUQgLzvwAXT3xABgAEQAaABNwIGFAnADD8AAgAD4BBJWzaCcIAIEBFMAWwKoAAdq9BWAF5wLQpALEtQAKUSGkahR4GnJM+gsAwCgeFAiUAECQ0BQuL8AAIAAAADKeIheclvFqQAAETr4iAMxIARMgAMIoHhQIAn0E0pDQFC4HhznoAAAAIAI2C0/4lvFqQAAETgBJJwYCAy4ABgYAFAA8MBKYEH4eRhTkAjYeFcgACAYAeABsOqyQ5gRwDayqugEgaIIAtgoACgDmEABmBAWGme5OBJJA2m4cDeoAmITWAXwrMgOgAGwBCh6CBXYF1Tzg1wKAAFdiuABRAFwAXQBsAG8AdgBrAHYAbwCEAHEwfxQBVE5TEQADVFhTBwBDANILAqcCzgLTApQCrQL6vAAMAL8APLhNBKkE6glGKTAU4Dr4N2EYEwBCkABKk8rHAbYBmwIoAiU4Ajf/Aq4CowCAANIChzgaNBsCsTgeODcFXrgClQKdAqQBiQGYAqsCsjTsNHsfNPA0ixsAWTWiOAMFPDQSNCk2BDZHNow2TTZUNhk28Jk9VzI3QkEoAoICoQKwAqcAQAAxBV4FXbS9BW47YkIXP1ciUqs05DS/FwABUwJW11e6nHuYZmSh/RAYA8oMKvZ8KASoUAJYWAJ6ILAsAZSoqjpgA0ocBIhmDgDWAAawRDQoAAcuAj5iAHABZiR2AIgiHgCaAU68ACxuHAG0ygM8MiZIAlgBdF4GagJqAPZOHAMuBgoATkYAsABiAHgAMLoGDPj0HpKEBAAOJgAuALggTAHWAeAMEDbd20Uege0ADwAWADkAQgA9OHd+2MUQZBBhBgNNDkxxPxUQArEPqwvqERoM1irQ090ANK4H8ANYB/ADWANYB/AH8ANYB/ADWANYA1gDWBwP8B/YxRBkD00EcgWTBZAE2wiIJk4RhgctCNdUEnQjHEwDSgEBIypJITuYMxAlR0wRTQgIATZHbKx9PQNMMbBU+pCnA9AyVDlxBgMedhKlAC8PeCE1uk6DekxxpQpQT7NX9wBFBgASqwAS5gBJDSgAUCwGPQBI4zTYABNGAE2bAE3KAExdGABKaAbgAFBXAFCOAFBJABI2SWdObALDOq0//QomCZhvwHdTBkIQHCemEPgMNAG2ATwN7kvZBPIGPATKH34ZGg/OlZ0Ipi3eDO4m5C6igFsj9iqEBe5L9TzeC05RaQ9aC2YJ5DpkgU8DIgEOIowK3g06CG4Q9ArKbA3mEUYHOgPWSZsApgcCCxIdNhW2JhFirQsKOXgG/Br3C5AmsBMqev0F1BoiBk4BKhsAANAu6IWxWjJcHU9gBgQLJiPIFKlQIQ0mQLh4SRocBxYlqgKSQ3FKiFE3HpQh9zw+DWcuFFF9B/Y8BhlQC4I8n0asRQ8R0z6OPUkiSkwtBDaALDAnjAnQD4YMunxzAVoJIgmyDHITMhEYN8YIOgcaLpclJxYIIkaWYJsE+KAD9BPSAwwFQAlCBxQDthwuEy8VKgUOgSXYAvQ21i60ApBWgQEYBcwPJh/gEFFH4Q7qCJwCZgOEJewALhUiABginAhEZABgj9lTBi7MCMhqbSN1A2gU6GIRdAeSDlgHqBw0FcAc4nDJXgyGCSiksAlcAXYJmgFgBOQICjVcjKEgQmdUi1kYnCBiQUBd/QIyDGYVoES+h3kCjA9sEhwBNgF0BzoNAgJ4Ee4RbBCWCOyGBTW2M/k6JgRQIYQgEgooA1BszwsoJvoM+WoBpBJjAw00PnfvZ6xgtyUX/gcaMsZBYSHyC5NPzgydGsIYQ1QvGeUHwAP0GvQn60FYBgADpAQUOk4z7wS+C2oIjAlAAEoOpBgH2BhrCnKM0QEyjAG4mgNYkoQCcJAGOAcMAGgMiAV65gAeAqgIpAAGANADWAA6Aq4HngAaAIZCAT4DKDABIuYCkAOUCDLMAZYwAfQqBBzEDBYA+DhuSwLDsgKAa2ajBd5ZAo8CSjYBTiYEBk9IUgOwcuIA3ABMBhTgSAEWrEvMG+REAeBwLADIAPwABjYHBkIBzgH0bgC4AWALMgmjtLYBTuoqAIQAFmwB2AKKAN4ANgCA8gFUAE4FWvoF1AJQSgESMhksWGIBvAMgATQBDgB6BsyOpsoIIARuB9QCEBwV4gLvLwe2AgMi4BPOQsYCvd9WADIXUu5eZwqoCqdeaAC0YTQHMnM9UQAPH6k+yAdy/BZIiQImSwBQ5gBQQzSaNTFWSTYBpwGqKQK38AFtqwBI/wK37gK3rQK3sAK6280C0gK33AK3zxAAUEIAUD9SklKDArekArw5AEQAzAHCO147WTteO1k7XjtZO147WTteO1kDmChYI03AVU0oJqkKbV9GYewMpw3VRMk6ShPcYFJgMxPJLbgUwhXPJVcZPhq9JwYl5VUKDwUt1GYxCC00dhe9AEApaYNCY4ceMQpMHOhTklT5LRwAskujM7ANrRsWREEFSHXuYisWDwojAmSCAmJDXE6wXDchAqH4AmiZAmYKAp+FOBwMAmY8AmYnBG8EgAN/FAN+kzkHOXgYOYM6JCQCbB4CMjc4CwJtyAJtr/CLADRoRiwBaADfAOIASwYHmQyOAP8MwwAOtgJ3MAJ2o0ACeUxEAni7Hl3cRa9G9AJ8QAJ6yQJ9CgJ88UgBSH5kJQAsFklZSlwWGErNAtECAtDNSygDiFADh+dExpEzAvKiXQQDA69Lz0wuJgTQTU1NsAKLQAKK2cIcCB5EaAa4Ao44Ao5dQZiCAo7aAo5deVG1UzYLUtVUhgKT/AKTDQDqAB1VH1WwVdEHLBwplocy4nhnRTw6ApegAu+zWCKpAFomApaQApZ9nQCqWa1aCoJOADwClrYClk9cRVzSApnMApllXMtdCBoCnJw5wzqeApwXAp+cAp65iwAeEDIrEAKd8gKekwC2PmE1YfACntQCoG8BqgKeoCACnk+mY8lkKCYsAiewAiZ/AqD8AqBN2AKmMAKlzwKoAAB+AqfzaH1osgAESmodatICrOQCrK8CrWgCrQMCVx4CVd0CseLYAx9PbJgCsr4OArLpGGzhbWRtSWADJc4Ctl08QG6RAylGArhfArlIFgK5K3hwN3DiAr0aAy2zAzISAr6JcgMDM3ICvhtzI3NQAsPMAsMFc4N0TDZGdOEDPKgDPJsDPcACxX0CxkgCxhGKAshqUgLIRQLJUALJLwJkngLd03h6YniveSZL0QMYpGcDAmH1GfSVJXsMXpNevBICz2wCz20wTFTT9BSgAMeuAs90ASrrA04TfkwGAtwoAtuLAtJQA1JdA1NgAQIDVY2AikABzBfuYUZ2AILPg44C2sgC2d+EEYRKpz0DhqYAMANkD4ZyWvoAVgLfZgLeuXR4AuIw7RUB8zEoAfScAfLTiALr9ALpcXoAAur6AurlAPpIAboC7ooC652Wq5cEAu5AA4XhmHpw4XGiAvMEAGoDjheZlAL3FAORbwOSiAL3mQL52gL4Z5odmqy8OJsfA52EAv77ARwAOp8dn7QDBY4DpmsDptoA0sYDBmuhiaIGCgMMSgFgASACtgNGAJwEgLpoBgC8BGzAEowcggCEDC6kdjoAJAM0C5IKRoABZCgiAIzw3AYBLACkfng9ogigkgNmWAN6AEQCvrkEVqTGAwCsBRbAA+4iQkMCHR072jI2PTbUNsk2RjY5NvA23TZKNiU3EDcZN5I+RTxDRTBCJkK5VBYKFhZfwQCWygU3AJBRHpu+OytgNxa61A40GMsYjsn7BVwFXQVcBV0FaAVdBVwFXQVcBV0FXAVdBVwFXUsaCNyKAK4AAQUHBwKU7oICoW1e7jAEzgPxA+YDwgCkBFDAwADABKzAAOxFLhitA1UFTDeyPkM+bj51QkRCuwTQWWQ8X+0AWBYzsACNA8xwzAGm7EZ/QisoCTAbLDs6fnLfb8H2GccsbgFw13M1HAVkBW/Jxsm9CNRO8E8FDD0FBQw9FkcClOYCoMFegpDfADgcMiA2AJQACB8AsigKAIzIEAJKeBIApY5yPZQIAKQiHb4fvj5BKSRPQrZCOz0oXyxgOywfKAnGbgMClQaCAkILXgdeCD9IIGUgQj5fPoY+dT52Ao5CM0dAX9BTVG9SDzFwWTQAbxBzJF/lOEIQQglCCkKJIAls5AcClQICoKPMODEFxhi6KSAbiyfIRrMjtCgdWCAkPlFBIitCsEJRzAbMAV/OEyQzDg0OAQQEJ36i328/Mk9AybDJsQlq3tDRApUKAkFzXf1d/j9uALYP6hCoFgCTGD8kPsFKQiobrm0+zj0KSD8kPnVCRBwMDyJRTHFgMTJa5rwXQiQ2YfI/JD7BMEJEHGINTw4TOFlIRzwJO0icMQpyPyQ+wzJCRBv6DVgnKB01NgUKj2bwYzMqCoBkznBgEF+zYDIocwRIX+NgHj4HICNfh2C4CwdwFWpTG/lgUhYGAwRfv2Ts8mAaXzVgml/XYIJfuWC4HI1gUF9pYJZgMR6ilQHMAOwLAlDRefC0in4AXAEJA6PjCwc0IamOANMMCAECRQDFNRTZBgd+CwQlRA+r6+gLBDEFBnwUBXgKATIArwAGRAAHA3cDdAN2A3kDdwN9A3oDdQN7A30DfAN4A3oDfQAYEAAlAtYASwMAUAFsAHcKAHcAmgB3AHUAdQB2AHVu8UgAygDAAHcAdQB1AHYAdQALCgB3AAsAmgB3AAsCOwB3AAtu8UgAygDAAHgKAJoAdwB3AHUAdQB2AHUAeAB1AHUAdgB1bvFIAMoAwAALCgCaAHcACwB3AAsCOwB3AAtu8UgAygDAAH4ACwGgALcBpwC6AahdAu0COwLtbvFIAMoAwAALCgCaAu0ACwLtAAsCOwLtAAtu8UgAygDAA24ACwNvAAu0VsQAAzsAABCkjUIpAAsAUIusOggWcgMeBxVsGwL67U/2HlzmWOEeOgALASvuAAseAfpKUpnpGgYJDCIZM6YyARUE9ThqAD5iXQgnAJYJPnOzw0ZAEZxEKsIAkA4DhAHnTAIDxxUDK0lxCQlPYgIvIQVYJQBVqE1GakUAKGYiDToSBA1EtAYAXQJYAIF8GgMHRyAAIAjOe9YncekRAA0KACUrjwE7Ayc6AAYWAqaiKG4McEcqANoN3+Mg9TwCBhIkuCny+JwUQ29L008JluRxu3K+oAdqiHOqFH0AG5SUIfUJ5SxCGfxdipRzqTmT4V5Zb+r1Uo4Vm+NqSSEl2mNvR2JhIa8SpYO6ntdwFXHCWTCK8f2+Hxo7uiG3drDycAuKIMP5bhi06ACnqArH1rz4Rqg//lm6SgJGEVbF9xJHISaR6HxqxSnkw6shDnelHKNEfGUXSJRJ1GcsmtJw25xrZMDK9gXSm1/YMkdX4/6NKYOdtk/NQ3/NnDASjTc3fPjIjW/5sVfVObX2oTDWkr1dF9f3kxBsD3/3aQO8hPfRz+e0uEiJqt1161griu7gz8hDDwtpy+F+BWtefnKHZPAxcZoWbnznhJpy0e842j36bcNzGnIEusgGX0a8ZxsnjcSsPDZ09yZ36fCQbriHeQ72JRMILNl6ePPf2HWoVwgWAm1fb3V2sAY0+B6rAXqSwPBgseVmoqsBTSrm91+XasMYYySI8eeRxH3ZvHkMz3BQ5aJ3iUVbYPNM3/7emRtjlsMgv/9VyTsyt/mK+8fgWeT6SoFaclXqn42dAIsvAarF5vNNWHzKSkKQ/8Hfk5ZWK7r9yliOsooyBjRhfkHP4Q2DkWXQi6FG/9r/IwbmkV5T7JSopHKn1pJwm9tb5Ot0oyN1Z2mPpKXHTxx2nlK08fKk1hEYA8WgVVWL5lgx0iTv+KdojJeU23ZDjmiubXOxVXJKKi2Wjuh2HLZOFLiSC7Tls5SMh4f+Pj6xUSrNjFqLGehRNB8lC0QSLNmkJJx/wSG3MnjE9T1CkPwJI0wH2lfzwETIiVqUxg0dfu5q39Gt+hwdcxkhhNvQ4TyrBceof3Mhs/IxFci1HmHr4FMZgXEEczPiGCx0HRwzAqDq2j9AVm1kwN0mRVLWLylgtoPNapF5cY4Y1wJh/e0BBwZj44YgZrDNqvD/9Hv7GFYdUQeDJuQ3EWI4HaKqavU1XjC/n41kT4L79kqGq0kLhdTZvgP3TA3fS0ozVz+5piZsoOtIvBUFoMKbNcmBL6YxxaUAusHB38XrS8dQMnQwJfUUkpRoGr5AUeWicvBTzyK9g77+yCkf5PAysL7r/JjcZgrbvRpMW9iyaxZvKO6ceZN2EwIxKwVFPuvFuiEPGCoagbMo+SpydLrXqBzNCDGFCrO/rkcwa2xhokQZ5CdZ0AsU3JfSqJ6n5I14YA+P/uAgfhPU84Tlw7cEFfp7AEE8ey4sP12PTt4Cods1GRgDOB5xvyiR5m+Bx8O5nBCNctU8BevfV5A08x6RHd5jcwPTMDSZJOedIZ1cGQ704lxbAzqZOP05ZxaOghzSdvFBHYqomATARyAADK4elP8Ly3IrUZKfWh23Xy20uBUmLS4Pfagu9+oyVa2iPgqRP3F2CTUsvJ7+RYnN8fFZbU/HVvxvcFFDKkiTqV5UBZ3Gz54JAKByi9hkKMZJvuGgcSYXFmw08UyoQyVdfTD1/dMkCHXcTGAKeROgArsvmRrQTLUOXioOHGK2QkjHuoYFgXciZoTJd6Fs5q1QX1G+p/e26hYsEf7QZD1nnIyl/SFkNtYYmmBhpBrxl9WbY0YpHWRuw2Ll/tj9mD8P4snVzJl4F9J+1arVeTb9E5r2ILH04qStjxQNwn3m4YNqxmaNbLAqW2TN6LidwuJRqS+NXbtqxoeDXpxeGWmxzSkWxjkyCkX4NQRme6q5SAcC+M7+9ETfA/EwrzQajKakCwYyeunP6ZFlxU2oMEn1Pz31zeStW74G406ZJFCl1wAXIoUKkWotYEpOuXB1uVNxJ63dpJEqfxBeptwIHNrPz8BllZoIcBoXwgfJ+8VAUnVPvRvexnw0Ma/WiGYuJO5y8QTvEYBigFmhUxY5RqzE8OcywN/8m4UYrlaniJO75XQ6KSo9+tWHlu+hMi0UVdiKQp7NelnoZUzNaIyBPVeOwK6GNp+FfHuPOoyhaWuNvTYFkvxscMQWDh+zeFCFkgwbXftiV23ywJ4+uwRqmg9k3KzwIQpzppt8DBBOMbrqwQM5Gb05sEwdKzMiAqOloaA/lr0KA+1pr0/+HiWoiIjHA/wir2nIuS3PeU/ji3O6ZwoxcR1SZ9FhtLC5S0FIzFhbBWcGVP/KpxOPSiUoAdWUpqKH++6Scz507iCcxYI6rdMBICPJZea7OcmeFw5mObJSiqpjg2UoWNIs+cFhyDSt6geV5qgi3FunmwwDoGSMgerFOZGX1m0dMCYo5XOruxO063dwENK9DbnVM9wYFREzh4vyU1WYYJ/LRRp6oxgjqP/X5a8/4Af6p6NWkQferzBmXme0zY/4nwMJm/wd1tIqSwGz+E3xPEAOoZlJit3XddD7/BT1pllzOx+8bmQtANQ/S6fZexc6qi3W+Q2xcmXTUhuS5mpHQRvcxZUN0S5+PL9lXWUAaRZhEH8hTdAcuNMMCuVNKTEGtSUKNi3O6KhSaTzck8csZ2vWRZ+d7mW8c4IKwXIYd25S/zIftPkwPzufjEvOHWVD1m+FjpDVUTV0DGDuHj6QnaEwLu/dEgdLQOg9E1Sro9XHJ8ykLAwtPu+pxqKDuFexqON1sKQm7rwbE1E68UCfA/erovrTCG+DBSNg0l4goDQvZN6uNlbyLpcZAwj2UclycvLpIZMgv4yRlpb3YuMftozorbcGVHt/VeDV3+Fdf1TP0iuaCsPi2G4XeGhsyF1ubVDxkoJhmniQ0/jSg/eYML9KLfnCFgISWkp91eauR3IQvED0nAPXK+6hPCYs+n3+hCZbiskmVMG2da+0EsZPonUeIY8EbfusQXjsK/eFDaosbPjEfQS0RKG7yj5GG69M7MeO1HmiUYocgygJHL6M1qzUDDwUSmr99V7Sdr2F3JjQAJY+F0yH33Iv3+C9M38eML7gTgmNu/r2bUMiPvpYbZ6v1/IaESirBHNa7mPKn4dEmYg7v/+HQgPN1G79jBQ1+soydfDC2r+h2Bl/KIc5KjMK7OH6nb1jLsNf0EHVe2KBiE51ox636uyG6Lho0t3J34L5QY/ilE3mikaF4HKXG1mG1rCevT1Vv6GavltxoQe/bMrpZvRggnBxSEPEeEzkEdOxTnPXHVjUYdw8JYvjB/o7Eegc3Ma+NUxLLnsK0kJlinPmUHzHGtrk5+CAbVzFOBqpyy3QVUnzTDfC/0XD94/okH+OB+i7g9lolhWIjSnfIb+Eq43ZXOWmwvjyV/qqD+t0e+7mTEM74qP/Ozt8nmC7mRpyu63OB4KnUzFc074SqoyPUAgM+/TJGFo6T44EHnQU4X4z6qannVqgw/U7zCpwcmXV1AubIrvOmkKHazJAR55ePjp5tLBsN8vAqs3NAHdcEHOR2xQ0lsNAFzSUuxFQCFYvXLZJdOj9p4fNq6p0HBGUik2YzaI4xySy91KzhQ0+q1hjxvImRwPRf76tChlRkhRCi74NXZ9qUNeIwP+s5p+3m5nwPdNOHgSLD79n7O9m1n1uDHiMntq4nkYwV5OZ1ENbXxFd4PgrlvavZsyUO4MqYlqqn1O8W/I1dEZq5dXhrbETLaZIbC2Kj/Aa/QM+fqUOHdf0tXAQ1huZ3cmWECWSXy/43j35+Mvq9xws7JKseriZ1pEWKc8qlzNrGPUGcVgOa9cPJYIJsGnJTAUsEcDOEVULO5x0rXBijc1lgXEzQQKhROf8zIV82w8eswc78YX11KYLWQRcgHNJElBxfXr72lS2RBSl07qTKorO2uUDZr3sFhYsvnhLZn0A94KRzJ/7DEGIAhW5ZWFpL8gEwu1aLA9MuWZzNwl8Oze9Y+bX+v9gywRVnoB5I/8kXTXU3141yRLYrIOOz6SOnyHNy4SieqzkBXharjfjqq1q6tklaEbA8Qfm2DaIPs7OTq/nvJBjKfO2H9bH2cCMh1+5gspfycu8f/cuuRmtDjyqZ7uCIMyjdV3a+p3fqmXsRx4C8lujezIFHnQiVTXLXuI1XrwN3+siYYj2HHTvESUx8DlOTXpak9qFRK+L3mgJ1WsD7F4cu1aJoFoYQnu+wGDMOjJM3kiBQWHCcvhJ/HRdxodOQp45YZaOTA22Nb4XKCVxqkbwMYFhzYQYIAnCW8FW14uf98jhUG2zrKhQQ0q0CEq0t5nXyvUyvR8DvD69LU+g3i+HFWQMQ8PqZuHD+sNKAV0+M6EJC0szq7rEr7B5bQ8BcNHzvDMc9eqB5ZCQdTf80Obn4uzjwpYU7SISdtV0QGa9D3Wrh2BDQtpBKxaNFV+/Cy2P/Sv+8s7Ud0Fd74X4+o/TNztWgETUapy+majNQ68Lq3ee0ZO48VEbTZYiH1Co4OlfWef82RWeyUXo7woM03PyapGfikTnQinoNq5z5veLpeMV3HCAMTaZmA1oGLAn7XS3XYsz+XK7VMQsc4XKrmDXOLU/pSXVNUq8dIqTba///3x6LiLS6xs1xuCAYSfcQ3+rQgmu7uvf3THKt5Ooo97TqcbRqxx7EASizaQCBQllG/rYxVapMLgtLbZS64w1MDBMXX+PQpBKNwqUKOf2DDRDUXQf9EhOS0Qj4nTmlA8dzSLz/G1d+Ud8MTy/6ghhdiLpeerGY/UlDOfiuqFsMUU5/UYlP+BAmgRLuNpvrUaLlVkrqDievNVEAwF+4CoM1MZTmjxjJMsKJq+u8Zd7tNCUFy6LiyYXRJQ4VyvEQFFaCGKsxIwQkk7EzZ6LTJq2hUuPhvAW+gQnSG6J+MszC+7QCRHcnqDdyNRJ6T9xyS87A6MDutbzKGvGktpbXqtzWtXb9HsfK2cBMomjN9a4y+TaJLnXxAeX/HWzmf4cR4vALt/P4w4qgKY04ml4ZdLOinFYS6cup3G/1ie4+t1eOnpBNlqGqs75ilzkT4+DsZQxNvaSKJ//6zIbbk/M7LOhFmRc/1R+kBtz7JFGdZm/COotIdvQoXpTqP/1uqEUmCb/QWoGLMwO5ANcHzxdY48IGP5+J+zKOTBFZ4Pid+GTM+Wq12MV/H86xEJptBa6T+p3kgpwLedManBHC2GgNrFpoN2xnrMz9WFWX/8/ygSBkavq2Uv7FdCsLEYLu9LLIvAU0bNRDtzYl+/vXmjpIvuJFYjmI0im6QEYqnIeMsNjXG4vIutIGHijeAG/9EDBozKV5cldkHbLxHh25vT+ZEzbhXlqvpzKJwcEgfNwLAKFeo0/pvEE10XDB+EXRTXtSzJozQKFFAJhMxYkVaCW+E9AL7tMeU8acxidHqzb6lX4691UsDpy/LLRmT+epgW56+5Cw8tB4kMUv6s9lh3eRKbyGs+H/4mQMaYzPTf2OOdokEn+zzgvoD3FqNKk8QqGAXVsqcGdXrT62fSPkR2vROFi68A6se86UxRUk4cajfPyCC4G5wDhD+zNq4jodQ4u4n/m37Lr36n4LIAAsVr02dFi9AiwA81MYs2rm4eDlDNmdMRvEKRHfBwW5DdMNp0jPFZMeARqF/wL4XBfd+EMLBfMzpH5GH6NaW+1vrvMdg+VxDzatk3MXgO3ro3P/DpcC6+Mo4MySJhKJhSR01SGGGp5hPWmrrUgrv3lDnP+HhcI3nt3YqBoVAVTBAQT5iuhTg8nvPtd8ZeYj6w1x6RqGUBrSku7+N1+BaasZvjTk64RoIDlL8brpEcJx3OmY7jLoZsswdtmhfC/G21llXhITOwmvRDDeTTPbyASOa16cF5/A1fZAidJpqju3wYAy9avPR1ya6eNp9K8XYrrtuxlqi+bDKwlfrYdR0RRiKRVTLOH85+ZY7XSmzRpfZBJjaTa81VDcJHpZnZnSQLASGYW9l51ZV/h7eVzTi3Hv6hUsgc/51AqJRTkpbFVLXXszoBL8nBX0u/0jBLT8nH+fJePbrwURT58OY+UieRjd1vs04w0VG5VN2U6MoGZkQzKN/ptz0Q366dxoTGmj7i1NQGHi9GgnquXFYdrCfZBmeb7s0T6yrdlZH5cZuwHFyIJ/kAtGsTg0xH5taAAq44BAk1CPk9KVVbqQzrCUiFdF/6gtlPQ8bHHc1G1W92MXGZ5HEHftyLYs8mbD/9xYRUWkHmlM0zC2ilJlnNgV4bfALpQghxOUoZL7VTqtCHIaQSXm+YUMnpkXybnV+A6xlm2CVy8fn0Xlm2XRa0+zzOa21JWWmixfiPMSCZ7qA4rS93VN3pkpF1s5TonQjisHf7iU9ZGvUPOAKZcR1pbeVf/Ul7OhepGCaId9wOtqo7pJ7yLcBZ0pFkOF28y4zEI/kcUNmutBHaQpBdNM8vjCS6HZRokkeo88TBAjGyG7SR+6vUgTcyK9Imalj0kuxz0wmK+byQU11AiJFk/ya5dNduRClcnU64yGu/ieWSeOos1t3ep+RPIWQ2pyTYVbZltTbsb7NiwSi3AV+8KLWk7LxCnfZUetEM8ThnsSoGH38/nyAwFguJp8FjvlHtcWZuU4hPva0rHfr0UhOOJ/F6vS62FW7KzkmRll2HEc7oUq4fyi5T70Vl7YVIfsPHUCdHesf9Lk7WNVWO75JDkYbMI8TOW8JKVtLY9d6UJRITO8oKo0xS+o99Yy04iniGHAaGj88kEWgwv0OrHdY/nr76DOGNS59hXCGXzTKUvDl9iKpLSWYN1lxIeyywdNpTkhay74w2jFT6NS8qkjo5CxA1yfSYwp6AJIZNKIeEK5PJAW7ORgWgwp0VgzYpqovMrWxbu+DGZ6Lhie1RAqpzm8VUzKJOH3mCzWuTOLsN3VT/dv2eeYe9UjbR8YTBsLz7q60VN1sU51k+um1f8JxD5pPhbhSC8rRaB454tmh6YUWrJI3+GWY0qeWioj/tbkYITOkJaeuGt4JrJvHA+l0Gu7kY7XOaa05alMnRWVCXqFgLIwSY4uF59Ue5SU4QKuc/HamDxbr0x6csCetXGoP7Qn1Bk/J9DsynO/UD6iZ1Hyrz+jit0hDCwi/E9OjgKTbB3ZQKQ/0ZOvevfNHG0NK4Aj3Cp7NpRk07RT1i/S0EL93Ag8GRgKI9CfpajKyK6+Jj/PI1KO5/85VAwz2AwzP8FTBb075IxCXv6T9RVvWT2tUaqxDS92zrGUbWzUYk9mSs82pECH+fkqsDt93VW++4YsR/dHCYcQSYTO/KaBMDj9LSD/J/+z20Kq8XvZUAIHtm9hRPP3ItbuAu2Hm5lkPs92pd7kCxgRs0xOVBnZ13ccdA0aunrwv9SdqElJRC3g+oCu+nXyCgmXUs9yMjTMAIHfxZV+aPKcZeUBWt057Xo85Ks1Ir5gzEHCWqZEhrLZMuF11ziGtFQUds/EESajhagzcKsxamcSZxGth4UII+adPhQkUnx2WyN+4YWR+r3f8MnkyGFuR4zjzxJS8WsQYR5PTyRaD9ixa6Mh741nBHbzfjXHskGDq179xaRNrCIB1z1xRfWfjqw2pHc1zk9xlPpL8sQWAIuETZZhbnmL54rceXVNRvUiKrrqIkeogsl0XXb17ylNb0f4GA9Wd44vffEG8FSZGHEL2fbaTGRcSiCeA8PmA/f6Hz8HCS76fXUHwgwkzSwlI71ekZ7Fapmlk/KC+Hs8hUcw3N2LN5LhkVYyizYFl/uPeVP5lsoJHhhfWvvSWruCUW1ZcJOeuTbrDgywJ/qG07gZJplnTvLcYdNaH0KMYOYMGX+rB4NGPFmQsNaIwlWrfCezxre8zXBrsMT+edVLbLqN1BqB76JH4BvZTqUIMfGwPGEn+EnmTV86fPBaYbFL3DFEhjB45CewkXEAtJxk4/Ms2pPXnaRqdky0HOYdcUcE2zcXq4vaIvW2/v0nHFJH2XXe22ueDmq/18XGtELSq85j9X8q0tcNSSKJIX8FTuJF/Pf8j5PhqG2u+osvsLxYrvvfeVJL+4tkcXcr9JV7v0ERmj/X6fM3NC4j6dS1+9Umr2oPavqiAydTZPLMNRGY23LO9zAVDly7jD+70G5TPPLdhRIl4WxcYjLnM+SNcJ26FOrkrISUtPObIz5Zb3AG612krnpy15RMW+1cQjlnWFI6538qky9axd2oJmHIHP08KyP0ubGO+TQNOYuv2uh17yCIvR8VcStw7o1g0NM60sk+8Tq7YfIBJrtp53GkvzXH7OA0p8/n/u1satf/VJhtR1l8Wa6Gmaug7haSpaCaYQax6ta0mkutlb+eAOSG1aobM81D9A4iS1RRlzBBoVX6tU1S6WE2N9ORY6DfeLRC4l9Rvr5h95XDWB2mR1d4WFudpsgVYwiTwT31ljskD8ZyDOlm5DkGh9N/UB/0AI5Xvb8ZBmai2hQ4BWMqFwYnzxwB26YHSOv9WgY3JXnvoN+2R4rqGVh/LLDMtpFP+SpMGJNWvbIl5SOodbCczW2RKleksPoUeGEzrjtKHVdtZA+kfqO+rVx/iclCqwoopepvJpSTDjT+b9GWylGRF8EDbGlw6eUzmJM95Ovoz+kwLX3c2fTjFeYEsE7vUZm3mqdGJuKh2w9/QGSaqRHs99aScGOdDqkFcACoqdbBoQqqjamhH6Q9ng39JCg3lrGJwd50Qk9ovnqBTr8MME7Ps2wiVfygUmPoUBJJfJWX5Nda0nuncbFkA=="))}const Dr$1=W0();new Set(Pr$1(Dr$1)),new Set(Pr$1(Dr$1)),Q0(Dr$1),V0(Dr$1);const X0=new Uint8Array(32);X0.fill(0);const Z0=`Ethereum Signed Message: -`;function ff(G){return typeof G=="string"&&(G=Ei(G)),yi(E0([Ei(Z0),Ei(String(G.length)),G]))}const ts$2="address/5.7.0",Ar$1=new L$4(ts$2);function of(G){Qt(G,20)||Ar$1.throwArgumentError("invalid address","address",G),G=G.toLowerCase();const e=G.substring(2).split(""),H=new Uint8Array(40);for(let Ne=0;Ne<40;Ne++)H[Ne]=e[Ne].charCodeAt(0);const Y=Ot$1(yi(H));for(let Ne=0;Ne<40;Ne+=2)Y[Ne>>1]>>4>=8&&(e[Ne]=e[Ne].toUpperCase()),(Y[Ne>>1]&15)>=8&&(e[Ne+1]=e[Ne+1].toUpperCase());return"0x"+e.join("")}const es$2=9007199254740991;function rs$2(G){return Math.log10?Math.log10(G):Math.log(G)/Math.LN10}const Ni={};for(let G=0;G<10;G++)Ni[String(G)]=String(G);for(let G=0;G<26;G++)Ni[String.fromCharCode(65+G)]=String(10+G);const sf=Math.floor(rs$2(es$2));function is$2(G){G=G.toUpperCase(),G=G.substring(4)+G.substring(0,2)+"00";let e=G.split("").map(Y=>Ni[Y]).join("");for(;e.length>=sf;){let Y=e.substring(0,sf);e=parseInt(Y,10)%97+e.substring(Y.length)}let H=String(98-parseInt(e,10)%97);for(;H.length<2;)H="0"+H;return H}function ns$2(G){let e=null;if(typeof G!="string"&&Ar$1.throwArgumentError("invalid address","address",G),G.match(/^(0x)?[0-9a-fA-F]{40}$/))G.substring(0,2)!=="0x"&&(G="0x"+G),e=of(G),G.match(/([A-F].*[a-f])|([a-f].*[A-F])/)&&e!==G&&Ar$1.throwArgumentError("bad address checksum","address",G);else if(G.match(/^XE[0-9]{2}[0-9A-Za-z]{30,31}$/)){for(G.substring(2,4)!==is$2(G)&&Ar$1.throwArgumentError("bad icap checksum","address",G),e=R0(G.substring(4));e.length<40;)e="0"+e;e=of("0x"+e)}else Ar$1.throwArgumentError("invalid address","address",G);return e}function br(G,e,H){Object.defineProperty(G,e,{enumerable:!0,value:H,writable:!1})}const os$1=new Uint8Array(32);os$1.fill(0),V$1.from(-1);const ss$2=V$1.from(0),as$1=V$1.from(1);V$1.from("0xffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff"),oe$1(as$1.toHexString(),32),oe$1(ss$2.toHexString(),32);var se={},Q$2={},yr$1=af;function af(G,e){if(!G)throw new Error(e||"Assertion failed")}af.equal=function(G,e,H){if(G!=e)throw new Error(H||"Assertion failed: "+G+" != "+e)};var Ii={exports:{}};typeof Object.create=="function"?Ii.exports=function(G,e){e&&(G.super_=e,G.prototype=Object.create(e.prototype,{constructor:{value:G,enumerable:!1,writable:!0,configurable:!0}}))}:Ii.exports=function(G,e){if(e){G.super_=e;var H=function(){};H.prototype=e.prototype,G.prototype=new H,G.prototype.constructor=G}};var us$1=yr$1,hs$1=Ii.exports;Q$2.inherits=hs$1;function cs$1(G,e){return(G.charCodeAt(e)&64512)!==55296||e<0||e+1>=G.length?!1:(G.charCodeAt(e+1)&64512)===56320}function ls$1(G,e){if(Array.isArray(G))return G.slice();if(!G)return[];var H=[];if(typeof G=="string")if(e){if(e==="hex")for(G=G.replace(/[^a-z0-9]+/ig,""),G.length%2!==0&&(G="0"+G),Ne=0;Ne>6|192,H[Y++]=W&63|128):cs$1(G,Ne)?(W=65536+((W&1023)<<10)+(G.charCodeAt(++Ne)&1023),H[Y++]=W>>18|240,H[Y++]=W>>12&63|128,H[Y++]=W>>6&63|128,H[Y++]=W&63|128):(H[Y++]=W>>12|224,H[Y++]=W>>6&63|128,H[Y++]=W&63|128)}else for(Ne=0;Ne>>24|G>>>8&65280|G<<8&16711680|(G&255)<<24;return e>>>0}Q$2.htonl=uf;function ps$1(G,e){for(var H="",Y=0;Y>>0}return W}Q$2.join32=vs$1;function ms$1(G,e){for(var H=new Array(G.length*4),Y=0,Ne=0;Y>>24,H[Ne+1]=W>>>16&255,H[Ne+2]=W>>>8&255,H[Ne+3]=W&255):(H[Ne+3]=W>>>24,H[Ne+2]=W>>>16&255,H[Ne+1]=W>>>8&255,H[Ne]=W&255)}return H}Q$2.split32=ms$1;function gs$1(G,e){return G>>>e|G<<32-e}Q$2.rotr32=gs$1;function As$1(G,e){return G<>>32-e}Q$2.rotl32=As$1;function bs$1(G,e){return G+e>>>0}Q$2.sum32=bs$1;function ys$1(G,e,H){return G+e+H>>>0}Q$2.sum32_3=ys$1;function ws$1(G,e,H,Y){return G+e+H+Y>>>0}Q$2.sum32_4=ws$1;function xs$1(G,e,H,Y,Ne){return G+e+H+Y+Ne>>>0}Q$2.sum32_5=xs$1;function Ms$1(G,e,H,Y){var Ne=G[e],W=G[e+1],ri=Y+W>>>0,si=(ri>>0,G[e+1]=ri}Q$2.sum64=Ms$1;function Es$1(G,e,H,Y){var Ne=e+Y>>>0,W=(Ne>>0}Q$2.sum64_hi=Es$1;function Ss$1(G,e,H,Y){var Ne=e+Y;return Ne>>>0}Q$2.sum64_lo=Ss$1;function Ns$1(G,e,H,Y,Ne,W,ri,si){var fi=0,ai=e;ai=ai+Y>>>0,fi+=ai>>0,fi+=ai>>0,fi+=ai>>0}Q$2.sum64_4_hi=Ns$1;function Is$1(G,e,H,Y,Ne,W,ri,si){var fi=e+Y+W+si;return fi>>>0}Q$2.sum64_4_lo=Is$1;function _s$1(G,e,H,Y,Ne,W,ri,si,fi,ai){var ti=0,hi=e;hi=hi+Y>>>0,ti+=hi>>0,ti+=hi>>0,ti+=hi>>0,ti+=hi>>0}Q$2.sum64_5_hi=_s$1;function Bs$1(G,e,H,Y,Ne,W,ri,si,fi,ai){var ti=e+Y+W+si+ai;return ti>>>0}Q$2.sum64_5_lo=Bs$1;function Cs$1(G,e,H){var Y=e<<32-H|G>>>H;return Y>>>0}Q$2.rotr64_hi=Cs$1;function Rs$1(G,e,H){var Y=G<<32-H|e>>>H;return Y>>>0}Q$2.rotr64_lo=Rs$1;function Os$1(G,e,H){return G>>>H}Q$2.shr64_hi=Os$1;function Ps$1(G,e,H){var Y=G<<32-H|e>>>H;return Y>>>0}Q$2.shr64_lo=Ps$1;var fr={},lf=Q$2,Ds$1=yr$1;function Fr$1(){this.pending=null,this.pendingTotal=0,this.blockSize=this.constructor.blockSize,this.outSize=this.constructor.outSize,this.hmacStrength=this.constructor.hmacStrength,this.padLength=this.constructor.padLength/8,this.endian="big",this._delta8=this.blockSize/8,this._delta32=this.blockSize/32}fr.BlockHash=Fr$1,Fr$1.prototype.update=function(G,e){if(G=lf.toArray(G,e),this.pending?this.pending=this.pending.concat(G):this.pending=G,this.pendingTotal+=G.length,this.pending.length>=this._delta8){G=this.pending;var H=G.length%this._delta8;this.pending=G.slice(G.length-H,G.length),this.pending.length===0&&(this.pending=null),G=lf.join32(G,0,G.length-H,this.endian);for(var Y=0;Y>>24&255,Y[Ne++]=G>>>16&255,Y[Ne++]=G>>>8&255,Y[Ne++]=G&255}else for(Y[Ne++]=G&255,Y[Ne++]=G>>>8&255,Y[Ne++]=G>>>16&255,Y[Ne++]=G>>>24&255,Y[Ne++]=0,Y[Ne++]=0,Y[Ne++]=0,Y[Ne++]=0,W=8;W>>3}ae.g0_256=qs$1;function Ks$1(G){return ue(G,17)^ue(G,19)^G>>>10}ae.g1_256=Ks$1;var sr$1=Q$2,Hs$1=fr,zs$1=ae,_i=sr$1.rotl32,wr=sr$1.sum32,Ls$1=sr$1.sum32_5,js$1=zs$1.ft_1,mf=Hs$1.BlockHash,Qs$1=[1518500249,1859775393,2400959708,3395469782];function he(){if(!(this instanceof he))return new he;mf.call(this),this.h=[1732584193,4023233417,2562383102,271733878,3285377520],this.W=new Array(80)}sr$1.inherits(he,mf);var Js$1=he;he.blockSize=512,he.outSize=160,he.hmacStrength=80,he.padLength=64,he.prototype._update=function(G,e){for(var H=this.W,Y=0;Y<16;Y++)H[Y]=G[e+Y];for(;Ythis.blockSize&&(G=new this.Hash().update(G).digest()),Pa(G.length<=this.blockSize);for(var e=G.length;e>8,ci=ti&255;hi?fi.push(hi,ci):fi.push(ci)}return fi}H.toArray=Y;function Ne(ri){return ri.length===1?"0"+ri:ri}H.zero2=Ne;function W(ri){for(var si="",fi=0;fi(ci>>1)-1?mi=(ci>>1)-hn:mi=hn,ui.isubn(mi)):mi=0,hi[li]=mi,ui.iushrn(1)}return hi}H.getNAF=Y;function Ne(fi,ai){var ti=[[],[]];fi=fi.clone(),ai=ai.clone();for(var hi=0,ci=0,ui;fi.cmpn(-hi)>0||ai.cmpn(-ci)>0;){var li=fi.andln(3)+hi&3,mi=ai.andln(3)+ci&3;li===3&&(li=-1),mi===3&&(mi=-1);var hn;li&1?(ui=fi.andln(7)+hi&7,(ui===3||ui===5)&&mi===2?hn=-li:hn=li):hn=0,ti[0].push(hn);var ln;mi&1?(ui=ai.andln(7)+ci&7,(ui===3||ui===5)&&li===2?ln=-mi:ln=mi):ln=0,ti[1].push(ln),2*hi===hn+1&&(hi=1-hi),2*ci===ln+1&&(ci=1-ci),fi.iushrn(1),ai.iushrn(1)}return ti}H.getJSF=Ne;function W(fi,ai,ti){var hi="_"+ai;fi.prototype[ai]=function(){return this[hi]!==void 0?this[hi]:this[hi]=ti.call(this)}}H.cachedProperty=W;function ri(fi){return typeof fi=="string"?H.toArray(fi,"hex"):fi}H.parseBytes=ri;function si(fi){return new K$1(fi,"hex","le")}H.intFromLE=si}),Ur$1=Jt$2.getNAF,Ta$1=Jt$2.getJSF,kr=Jt$2.assert;function Ce(G,e){this.type=G,this.p=new K$1(e.p,16),this.red=e.prime?K$1.red(e.prime):K$1.mont(this.p),this.zero=new K$1(0).toRed(this.red),this.one=new K$1(1).toRed(this.red),this.two=new K$1(2).toRed(this.red),this.n=e.n&&new K$1(e.n,16),this.g=e.g&&this.pointFromJSON(e.g,e.gRed),this._wnafT1=new Array(4),this._wnafT2=new Array(4),this._wnafT3=new Array(4),this._wnafT4=new Array(4),this._bitLength=this.n?this.n.bitLength():0;var H=this.n&&this.p.div(this.n);!H||H.cmpn(100)>0?this.redN=null:(this._maxwellTrick=!0,this.redN=this.n.toRed(this.red))}var Ze$2=Ce;Ce.prototype.point=function(){throw new Error("Not implemented")},Ce.prototype.validate=function(){throw new Error("Not implemented")},Ce.prototype._fixedNafMul=function(G,e){kr(G.precomputed);var H=G._getDoubles(),Y=Ur$1(e,1,this._bitLength),Ne=(1<=ri;fi--)si=(si<<1)+Y[fi];W.push(si)}for(var ai=this.jpoint(null,null,null),ti=this.jpoint(null,null,null),hi=Ne;hi>0;hi--){for(ri=0;ri=0;si--){for(var fi=0;si>=0&&W[si]===0;si--)fi++;if(si>=0&&fi++,ri=ri.dblp(fi),si<0)break;var ai=W[si];kr(ai!==0),G.type==="affine"?ai>0?ri=ri.mixedAdd(Ne[ai-1>>1]):ri=ri.mixedAdd(Ne[-ai-1>>1].neg()):ai>0?ri=ri.add(Ne[ai-1>>1]):ri=ri.add(Ne[-ai-1>>1].neg())}return G.type==="affine"?ri.toP():ri},Ce.prototype._wnafMulAdd=function(G,e,H,Y,Ne){var W=this._wnafT1,ri=this._wnafT2,si=this._wnafT3,fi=0,ai,ti,hi;for(ai=0;ai=1;ai-=2){var ui=ai-1,li=ai;if(W[ui]!==1||W[li]!==1){si[ui]=Ur$1(H[ui],W[ui],this._bitLength),si[li]=Ur$1(H[li],W[li],this._bitLength),fi=Math.max(si[ui].length,fi),fi=Math.max(si[li].length,fi);continue}var mi=[e[ui],null,null,e[li]];e[ui].y.cmp(e[li].y)===0?(mi[1]=e[ui].add(e[li]),mi[2]=e[ui].toJ().mixedAdd(e[li].neg())):e[ui].y.cmp(e[li].y.redNeg())===0?(mi[1]=e[ui].toJ().mixedAdd(e[li]),mi[2]=e[ui].add(e[li].neg())):(mi[1]=e[ui].toJ().mixedAdd(e[li]),mi[2]=e[ui].toJ().mixedAdd(e[li].neg()));var hn=[-3,-1,-5,-7,0,7,5,1,3],ln=Ta$1(H[ui],H[li]);for(fi=Math.max(ln[0].length,fi),si[ui]=new Array(fi),si[li]=new Array(fi),ti=0;ti=0;ai--){for(var Cn=0;ai>=0;){var an=!0;for(ti=0;ti=0&&Cn++,cn=cn.dblp(Cn),ai<0)break;for(ti=0;ti0?hi=ri[ti][Rn-1>>1]:Rn<0&&(hi=ri[ti][-Rn-1>>1].neg()),hi.type==="affine"?cn=cn.mixedAdd(hi):cn=cn.add(hi))}}for(ai=0;ai=Math.ceil((G.bitLength()+1)/e.step):!1},Xt$2.prototype._getDoubles=function(G,e){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var H=[this],Y=this,Ne=0;Ne=0&&(ci=fi,ui=ai),ti.negative&&(ti=ti.neg(),hi=hi.neg()),ci.negative&&(ci=ci.neg(),ui=ui.neg()),[{a:ti,b:hi},{a:ci,b:ui}]},Zt$1.prototype._endoSplit=function(G){var e=this.endo.basis,H=e[0],Y=e[1],Ne=Y.b.mul(G).divRound(this.n),W=H.b.neg().mul(G).divRound(this.n),ri=Ne.mul(H.a),si=W.mul(Y.a),fi=Ne.mul(H.b),ai=W.mul(Y.b),ti=G.sub(ri).sub(si),hi=fi.add(ai).neg();return{k1:ti,k2:hi}},Zt$1.prototype.pointFromX=function(G,e){G=new K$1(G,16),G.red||(G=G.toRed(this.red));var H=G.redSqr().redMul(G).redIAdd(G.redMul(this.a)).redIAdd(this.b),Y=H.redSqrt();if(Y.redSqr().redSub(H).cmp(this.zero)!==0)throw new Error("invalid point");var Ne=Y.fromRed().isOdd();return(e&&!Ne||!e&&Ne)&&(Y=Y.redNeg()),this.point(G,Y)},Zt$1.prototype.validate=function(G){if(G.inf)return!0;var e=G.x,H=G.y,Y=this.a.redMul(e),Ne=e.redSqr().redMul(e).redIAdd(Y).redIAdd(this.b);return H.redSqr().redISub(Ne).cmpn(0)===0},Zt$1.prototype._endoWnafMulAdd=function(G,e,H){for(var Y=this._endoWnafT1,Ne=this._endoWnafT2,W=0;W":""},Ft$1.prototype.isInfinity=function(){return this.inf},Ft$1.prototype.add=function(G){if(this.inf)return G;if(G.inf)return this;if(this.eq(G))return this.dbl();if(this.neg().eq(G))return this.curve.point(null,null);if(this.x.cmp(G.x)===0)return this.curve.point(null,null);var e=this.y.redSub(G.y);e.cmpn(0)!==0&&(e=e.redMul(this.x.redSub(G.x).redInvm()));var H=e.redSqr().redISub(this.x).redISub(G.x),Y=e.redMul(this.x.redSub(H)).redISub(this.y);return this.curve.point(H,Y)},Ft$1.prototype.dbl=function(){if(this.inf)return this;var G=this.y.redAdd(this.y);if(G.cmpn(0)===0)return this.curve.point(null,null);var e=this.curve.a,H=this.x.redSqr(),Y=G.redInvm(),Ne=H.redAdd(H).redIAdd(H).redIAdd(e).redMul(Y),W=Ne.redSqr().redISub(this.x.redAdd(this.x)),ri=Ne.redMul(this.x.redSub(W)).redISub(this.y);return this.curve.point(W,ri)},Ft$1.prototype.getX=function(){return this.x.fromRed()},Ft$1.prototype.getY=function(){return this.y.fromRed()},Ft$1.prototype.mul=function(G){return G=new K$1(G,16),this.isInfinity()?this:this._hasDoubles(G)?this.curve._fixedNafMul(this,G):this.curve.endo?this.curve._endoWnafMulAdd([this],[G]):this.curve._wnafMul(this,G)},Ft$1.prototype.mulAdd=function(G,e,H){var Y=[this,e],Ne=[G,H];return this.curve.endo?this.curve._endoWnafMulAdd(Y,Ne):this.curve._wnafMulAdd(1,Y,Ne,2)},Ft$1.prototype.jmulAdd=function(G,e,H){var Y=[this,e],Ne=[G,H];return this.curve.endo?this.curve._endoWnafMulAdd(Y,Ne,!0):this.curve._wnafMulAdd(1,Y,Ne,2,!0)},Ft$1.prototype.eq=function(G){return this===G||this.inf===G.inf&&(this.inf||this.x.cmp(G.x)===0&&this.y.cmp(G.y)===0)},Ft$1.prototype.neg=function(G){if(this.inf)return this;var e=this.curve.point(this.x,this.y.redNeg());if(G&&this.precomputed){var H=this.precomputed,Y=function(Ne){return Ne.neg()};e.precomputed={naf:H.naf&&{wnd:H.naf.wnd,points:H.naf.points.map(Y)},doubles:H.doubles&&{step:H.doubles.step,points:H.doubles.points.map(Y)}}}return e},Ft$1.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var G=this.curve.jpoint(this.x,this.y,this.curve.one);return G};function Tt$1(G,e,H,Y){Ze$2.BasePoint.call(this,G,"jacobian"),e===null&&H===null&&Y===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new K$1(0)):(this.x=new K$1(e,16),this.y=new K$1(H,16),this.z=new K$1(Y,16)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)),this.zOne=this.z===this.curve.one}Di(Tt$1,Ze$2.BasePoint),Zt$1.prototype.jpoint=function(G,e,H){return new Tt$1(this,G,e,H)},Tt$1.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var G=this.z.redInvm(),e=G.redSqr(),H=this.x.redMul(e),Y=this.y.redMul(e).redMul(G);return this.curve.point(H,Y)},Tt$1.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)},Tt$1.prototype.add=function(G){if(this.isInfinity())return G;if(G.isInfinity())return this;var e=G.z.redSqr(),H=this.z.redSqr(),Y=this.x.redMul(e),Ne=G.x.redMul(H),W=this.y.redMul(e.redMul(G.z)),ri=G.y.redMul(H.redMul(this.z)),si=Y.redSub(Ne),fi=W.redSub(ri);if(si.cmpn(0)===0)return fi.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var ai=si.redSqr(),ti=ai.redMul(si),hi=Y.redMul(ai),ci=fi.redSqr().redIAdd(ti).redISub(hi).redISub(hi),ui=fi.redMul(hi.redISub(ci)).redISub(W.redMul(ti)),li=this.z.redMul(G.z).redMul(si);return this.curve.jpoint(ci,ui,li)},Tt$1.prototype.mixedAdd=function(G){if(this.isInfinity())return G.toJ();if(G.isInfinity())return this;var e=this.z.redSqr(),H=this.x,Y=G.x.redMul(e),Ne=this.y,W=G.y.redMul(e).redMul(this.z),ri=H.redSub(Y),si=Ne.redSub(W);if(ri.cmpn(0)===0)return si.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var fi=ri.redSqr(),ai=fi.redMul(ri),ti=H.redMul(fi),hi=si.redSqr().redIAdd(ai).redISub(ti).redISub(ti),ci=si.redMul(ti.redISub(hi)).redISub(Ne.redMul(ai)),ui=this.z.redMul(ri);return this.curve.jpoint(hi,ci,ui)},Tt$1.prototype.dblp=function(G){if(G===0)return this;if(this.isInfinity())return this;if(!G)return this.dbl();var e;if(this.curve.zeroA||this.curve.threeA){var H=this;for(e=0;e=0)return!1;if(H.redIAdd(Ne),this.x.cmp(H)===0)return!0}},Tt$1.prototype.inspect=function(){return this.isInfinity()?"":""},Tt$1.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var qr=cr$2(function(G,e){var H=e;H.base=Ze$2,H.short=ka,H.mont=null,H.edwards=null}),Kr=cr$2(function(G,e){var H=e,Y=Jt$2.assert;function Ne(si){si.type==="short"?this.curve=new qr.short(si):si.type==="edwards"?this.curve=new qr.edwards(si):this.curve=new qr.mont(si),this.g=this.curve.g,this.n=this.curve.n,this.hash=si.hash,Y(this.g.validate(),"Invalid curve"),Y(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}H.PresetCurve=Ne;function W(si,fi){Object.defineProperty(H,si,{configurable:!0,enumerable:!0,get:function(){var ai=new Ne(fi);return Object.defineProperty(H,si,{configurable:!0,enumerable:!0,value:ai}),ai}})}W("p192",{type:"short",prime:"p192",p:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff",a:"ffffffff ffffffff ffffffff fffffffe ffffffff fffffffc",b:"64210519 e59c80e7 0fa7e9ab 72243049 feb8deec c146b9b1",n:"ffffffff ffffffff ffffffff 99def836 146bc9b1 b4d22831",hash:se.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),W("p224",{type:"short",prime:"p224",p:"ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001",a:"ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff fffffffe",b:"b4050a85 0c04b3ab f5413256 5044b0b7 d7bfd8ba 270b3943 2355ffb4",n:"ffffffff ffffffff ffffffff ffff16a2 e0b8f03e 13dd2945 5c5c2a3d",hash:se.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),W("p256",{type:"short",prime:null,p:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff ffffffff",a:"ffffffff 00000001 00000000 00000000 00000000 ffffffff ffffffff fffffffc",b:"5ac635d8 aa3a93e7 b3ebbd55 769886bc 651d06b0 cc53b0f6 3bce3c3e 27d2604b",n:"ffffffff 00000000 ffffffff ffffffff bce6faad a7179e84 f3b9cac2 fc632551",hash:se.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),W("p384",{type:"short",prime:null,p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 ffffffff",a:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe ffffffff 00000000 00000000 fffffffc",b:"b3312fa7 e23ee7e4 988e056b e3f82d19 181d9c6e fe814112 0314088f 5013875a c656398d 8a2ed19d 2a85c8ed d3ec2aef",n:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff c7634d81 f4372ddf 581a0db2 48b0a77a ecec196a ccc52973",hash:se.sha384,gRed:!1,g:["aa87ca22 be8b0537 8eb1c71e f320ad74 6e1d3b62 8ba79b98 59f741e0 82542a38 5502f25d bf55296c 3a545e38 72760ab7","3617de4a 96262c6f 5d9e98bf 9292dc29 f8f41dbd 289a147c e9da3113 b5f0b8c0 0a60b1ce 1d7e819d 7a431d7c 90ea0e5f"]}),W("p521",{type:"short",prime:null,p:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff",a:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffc",b:"00000051 953eb961 8e1c9a1f 929a21a0 b68540ee a2da725b 99b315f3 b8b48991 8ef109e1 56193951 ec7e937b 1652c0bd 3bb1bf07 3573df88 3d2c34f1 ef451fd4 6b503f00",n:"000001ff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffa 51868783 bf2f966b 7fcc0148 f709a5d0 3bb5c9b8 899c47ae bb6fb71e 91386409",hash:se.sha512,gRed:!1,g:["000000c6 858e06b7 0404e9cd 9e3ecb66 2395b442 9c648139 053fb521 f828af60 6b4d3dba a14b5e77 efe75928 fe1dc127 a2ffa8de 3348b3c1 856a429b f97e7e31 c2e5bd66","00000118 39296a78 9a3bc004 5c8a5fb4 2c7d1bd9 98f54449 579b4468 17afbd17 273e662c 97ee7299 5ef42640 c550b901 3fad0761 353c7086 a272c240 88be9476 9fd16650"]}),W("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:se.sha256,gRed:!1,g:["9"]}),W("ed25519",{type:"edwards",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"-1",c:"1",d:"52036cee2b6ffe73 8cc740797779e898 00700a4d4141d8ab 75eb4dca135978a3",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:se.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var ri;try{ri=null.crash()}catch{ri=void 0}W("secp256k1",{type:"short",prime:"k256",p:"ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f",a:"0",b:"7",n:"ffffffff ffffffff ffffffff fffffffe baaedce6 af48a03b bfd25e8c d0364141",h:"1",hash:se.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",ri]})});function Re$1(G){if(!(this instanceof Re$1))return new Re$1(G);this.hash=G.hash,this.predResist=!!G.predResist,this.outLen=this.hash.outSize,this.minEntropy=G.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var e=fe$1.toArray(G.entropy,G.entropyEnc||"hex"),H=fe$1.toArray(G.nonce,G.nonceEnc||"hex"),Y=fe$1.toArray(G.pers,G.persEnc||"hex");Pi(e.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(e,H,Y)}var Rf=Re$1;Re$1.prototype._init=function(G,e,H){var Y=G.concat(e).concat(H);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var Ne=0;Ne=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(G.concat(H||[])),this._reseed=1},Re$1.prototype.generate=function(G,e,H,Y){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof e!="string"&&(Y=H,H=e,e=null),H&&(H=fe$1.toArray(H,Y||"hex"),this._update(H));for(var Ne=[];Ne.length"};var qa=Jt$2.assert;function Hr(G,e){if(G instanceof Hr)return G;this._importDER(G,e)||(qa(G.r&&G.s,"Signature without r or s"),this.r=new K$1(G.r,16),this.s=new K$1(G.s,16),G.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=G.recoveryParam)}var zr$1=Hr;function Ka(){this.place=0}function Ui$1(G,e){var H=G[e.place++];if(!(H&128))return H;var Y=H&15;if(Y===0||Y>4)return!1;for(var Ne=0,W=0,ri=e.place;W>>=0;return Ne<=127?!1:(e.place=ri,Ne)}function Of(G){for(var e=0,H=G.length-1;!G[e]&&!(G[e+1]&128)&&e>>3);for(G.push(H|128);--H;)G.push(e>>>(H<<3)&255);G.push(e)}Hr.prototype.toDER=function(G){var e=this.r.toArray(),H=this.s.toArray();for(e[0]&128&&(e=[0].concat(e)),H[0]&128&&(H=[0].concat(H)),e=Of(e),H=Of(H);!H[0]&&!(H[1]&128);)H=H.slice(1);var Y=[2];ki(Y,e.length),Y=Y.concat(e),Y.push(2),ki(Y,H.length);var Ne=Y.concat(H),W=[48];return ki(W,Ne.length),W=W.concat(Ne),Jt$2.encode(W,G)};var Ha=function(){throw new Error("unsupported")},Pf=Jt$2.assert;function $t$1(G){if(!(this instanceof $t$1))return new $t$1(G);typeof G=="string"&&(Pf(Object.prototype.hasOwnProperty.call(Kr,G),"Unknown curve "+G),G=Kr[G]),G instanceof Kr.PresetCurve&&(G={curve:G}),this.curve=G.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=G.curve.g,this.g.precompute(G.curve.n.bitLength()+1),this.hash=G.hash||G.curve.hash}var za=$t$1;$t$1.prototype.keyPair=function(G){return new Ti(this,G)},$t$1.prototype.keyFromPrivate=function(G,e){return Ti.fromPrivate(this,G,e)},$t$1.prototype.keyFromPublic=function(G,e){return Ti.fromPublic(this,G,e)},$t$1.prototype.genKeyPair=function(G){G||(G={});for(var e=new Rf({hash:this.hash,pers:G.pers,persEnc:G.persEnc||"utf8",entropy:G.entropy||Ha(this.hash.hmacStrength),entropyEnc:G.entropy&&G.entropyEnc||"utf8",nonce:this.n.toArray()}),H=this.n.byteLength(),Y=this.n.sub(new K$1(2));;){var Ne=new K$1(e.generate(H));if(!(Ne.cmp(Y)>0))return Ne.iaddn(1),this.keyFromPrivate(Ne)}},$t$1.prototype._truncateToN=function(G,e){var H=G.byteLength()*8-this.n.bitLength();return H>0&&(G=G.ushrn(H)),!e&&G.cmp(this.n)>=0?G.sub(this.n):G},$t$1.prototype.sign=function(G,e,H,Y){typeof H=="object"&&(Y=H,H=null),Y||(Y={}),e=this.keyFromPrivate(e,H),G=this._truncateToN(new K$1(G,16));for(var Ne=this.n.byteLength(),W=e.getPrivate().toArray("be",Ne),ri=G.toArray("be",Ne),si=new Rf({hash:this.hash,entropy:W,nonce:ri,pers:Y.pers,persEnc:Y.persEnc||"utf8"}),fi=this.n.sub(new K$1(1)),ai=0;;ai++){var ti=Y.k?Y.k(ai):new K$1(si.generate(this.n.byteLength()));if(ti=this._truncateToN(ti,!0),!(ti.cmpn(1)<=0||ti.cmp(fi)>=0)){var hi=this.g.mul(ti);if(!hi.isInfinity()){var ci=hi.getX(),ui=ci.umod(this.n);if(ui.cmpn(0)!==0){var li=ti.invm(this.n).mul(ui.mul(e.getPrivate()).iadd(G));if(li=li.umod(this.n),li.cmpn(0)!==0){var mi=(hi.getY().isOdd()?1:0)|(ci.cmp(ui)!==0?2:0);return Y.canonical&&li.cmp(this.nh)>0&&(li=this.n.sub(li),mi^=1),new zr$1({r:ui,s:li,recoveryParam:mi})}}}}}},$t$1.prototype.verify=function(G,e,H,Y){G=this._truncateToN(new K$1(G,16)),H=this.keyFromPublic(H,Y),e=new zr$1(e,"hex");var Ne=e.r,W=e.s;if(Ne.cmpn(1)<0||Ne.cmp(this.n)>=0||W.cmpn(1)<0||W.cmp(this.n)>=0)return!1;var ri=W.invm(this.n),si=ri.mul(G).umod(this.n),fi=ri.mul(Ne).umod(this.n),ai;return this.curve._maxwellTrick?(ai=this.g.jmulAdd(si,H.getPublic(),fi),ai.isInfinity()?!1:ai.eqXToP(Ne)):(ai=this.g.mulAdd(si,H.getPublic(),fi),ai.isInfinity()?!1:ai.getX().umod(this.n).cmp(Ne)===0)},$t$1.prototype.recoverPubKey=function(G,e,H,Y){Pf((3&H)===H,"The recovery param is more than two bits"),e=new zr$1(e,Y);var Ne=this.n,W=new K$1(G),ri=e.r,si=e.s,fi=H&1,ai=H>>1;if(ri.cmp(this.curve.p.umod(this.curve.n))>=0&&ai)throw new Error("Unable to find sencond key candinate");ai?ri=this.curve.pointFromX(ri.add(this.curve.n),fi):ri=this.curve.pointFromX(ri,fi);var ti=e.r.invm(Ne),hi=Ne.sub(W).mul(ti).umod(Ne),ci=si.mul(ti).umod(Ne);return this.g.mulAdd(hi,ri,ci)},$t$1.prototype.getKeyRecoveryParam=function(G,e,H,Y){if(e=new zr$1(e,Y),e.recoveryParam!==null)return e.recoveryParam;for(var Ne=0;Ne<4;Ne++){var W;try{W=this.recoverPubKey(G,e,Ne)}catch{continue}if(W.eq(H))return Ne}throw new Error("Unable to find valid recovery factor")};var La$1=cr$2(function(G,e){var H=e;H.version="6.5.4",H.utils=Jt$2,H.rand=function(){throw new Error("unsupported")},H.curve=qr,H.curves=Kr,H.ec=za,H.eddsa=null}),ja=La$1.ec;const Qa="signing-key/5.7.0",qi$1=new L$4(Qa);let Ki=null;function ve(){return Ki||(Ki=new ja("secp256k1")),Ki}class Ja{constructor(e){br(this,"curve","secp256k1"),br(this,"privateKey",Kt$1(e)),N0(this.privateKey)!==32&&qi$1.throwArgumentError("invalid private key","privateKey","[[ REDACTED ]]");const H=ve().keyFromPrivate(Ot$1(this.privateKey));br(this,"publicKey","0x"+H.getPublic(!1,"hex")),br(this,"compressedPublicKey","0x"+H.getPublic(!0,"hex")),br(this,"_isSigningKey",!0)}_addPoint(e){const H=ve().keyFromPublic(Ot$1(this.publicKey)),Y=ve().keyFromPublic(Ot$1(e));return"0x"+H.pub.add(Y.pub).encodeCompressed("hex")}signDigest(e){const H=ve().keyFromPrivate(Ot$1(this.privateKey)),Y=Ot$1(e);Y.length!==32&&qi$1.throwArgumentError("bad digest length","digest",e);const Ne=H.sign(Y,{canonical:!0});return zn({recoveryParam:Ne.recoveryParam,r:oe$1("0x"+Ne.r.toString(16),32),s:oe$1("0x"+Ne.s.toString(16),32)})}computeSharedSecret(e){const H=ve().keyFromPrivate(Ot$1(this.privateKey)),Y=ve().keyFromPublic(Ot$1(Df(e)));return oe$1("0x"+H.derive(Y.getPublic()).toString(16),32)}static isSigningKey(e){return!!(e&&e._isSigningKey)}}function Ga(G,e){const H=zn(e),Y={r:Ot$1(H.r),s:Ot$1(H.s)};return"0x"+ve().recoverPubKey(Ot$1(G),Y,H.recoveryParam).encode("hex",!1)}function Df(G,e){const H=Ot$1(G);if(H.length===32){const Y=new Ja(H);return e?"0x"+ve().keyFromPrivate(H).getPublic(!0,"hex"):Y.publicKey}else{if(H.length===33)return e?Kt$1(H):"0x"+ve().keyFromPublic(H).getPublic(!1,"hex");if(H.length===65)return e?"0x"+ve().keyFromPublic(H).getPublic(!0,"hex"):Kt$1(H)}return qi$1.throwArgumentError("invalid public or private key","key","[REDACTED]")}var Ff;(function(G){G[G.legacy=0]="legacy",G[G.eip2930=1]="eip2930",G[G.eip1559=2]="eip1559"})(Ff||(Ff={}));function Va(G){const e=Df(G);return ns$2(Hn(yi(Hn(e,1)),12))}function Wa(G,e){return Va(Ga(Ot$1(G),e))}const Xa="https://rpc.walletconnect.com/v1";async function Tf(G,e,H,Y,Ne,W){switch(H.t){case"eip191":return Uf(G,e,H.s);case"eip1271":return await kf(G,e,H.s,Y,Ne,W);default:throw new Error(`verifySignature failed: Attempted to verify CacaoSignature with unknown type: ${H.t}`)}}function Uf(G,e,H){return Wa(ff(e),H).toLowerCase()===G.toLowerCase()}async function kf(G,e,H,Y,Ne,W){try{const ri="0x1626ba7e",si="0000000000000000000000000000000000000000000000000000000000000040",fi="0000000000000000000000000000000000000000000000000000000000000041",ai=H.substring(2),ti=ff(e).substring(2),hi=ri+ti+si+fi+ai,ci=await fetch(`${W||Xa}/?chainId=${Y}&projectId=${Ne}`,{method:"POST",body:JSON.stringify({id:Za(),jsonrpc:"2.0",method:"eth_call",params:[{to:G,data:hi},"latest"]})}),{result:ui}=await ci.json();return ui?ui.slice(0,ri.length).toLowerCase()===ri.toLowerCase():!1}catch(ri){return console.error("isValidEip1271Signature: ",ri),!1}}function Za(){return Date.now()+Math.floor(Math.random()*1e3)}var $a=Object.defineProperty,tu=Object.defineProperties,eu=Object.getOwnPropertyDescriptors,qf=Object.getOwnPropertySymbols,ru=Object.prototype.hasOwnProperty,iu=Object.prototype.propertyIsEnumerable,Kf=(G,e,H)=>e in G?$a(G,e,{enumerable:!0,configurable:!0,writable:!0,value:H}):G[e]=H,Hi$1=(G,e)=>{for(var H in e||(e={}))ru.call(e,H)&&Kf(G,H,e[H]);if(qf)for(var H of qf(e))iu.call(e,H)&&Kf(G,H,e[H]);return G},Hf=(G,e)=>tu(G,eu(e));const nu="did:pkh:",Lr$1=G=>G==null?void 0:G.split(":"),zi=G=>{const e=G&&Lr$1(G);if(e)return G.includes(nu)?e[3]:e[1]},fu=G=>{const e=G&&Lr$1(G);if(e)return e[2]+":"+e[3]},Li=G=>{const e=G&&Lr$1(G);if(e)return e.pop()};async function ou(G){const{cacao:e,projectId:H}=G,{s:Y,p:Ne}=e,W=zf(Ne,Ne.iss),ri=Li(Ne.iss);return await Tf(ri,W,Y,zi(Ne.iss),H)}const zf=(G,e)=>{const H=`${G.domain} wants you to sign in with your Ethereum account:`,Y=Li(e);if(!G.aud&&!G.uri)throw new Error("Either `aud` or `uri` is required to construct the message");let Ne=G.statement||void 0;const W=`URI: ${G.aud||G.uri}`,ri=`Version: ${G.version}`,si=`Chain ID: ${zi(e)}`,fi=`Nonce: ${G.nonce}`,ai=`Issued At: ${G.iat}`,ti=G.resources?`Resources:${G.resources.map(ci=>` -- ${ci}`).join("")}`:void 0,hi=Qr(G.resources);if(hi){const ci=Oe(hi);Ne=Ji$1(Ne,ci)}return[H,Y,"",Ne,"",W,ri,si,fi,ai,ti].filter(ci=>ci!=null).join(` -`)};function Jf(G){return Buffer.from(JSON.stringify(G)).toString("base64")}function Gf(G){return JSON.parse(Buffer.from(G,"base64").toString("utf-8"))}function me$1(G){if(!G)throw new Error("No recap provided, value is undefined");if(!G.att)throw new Error("No `att` property found");const e=Object.keys(G.att);if(!(e!=null&&e.length))throw new Error("No resources found in `att` property");e.forEach(H=>{const Y=G.att[H];if(Array.isArray(Y))throw new Error(`Resource must be an object: ${H}`);if(typeof Y!="object")throw new Error(`Resource must be an object: ${H}`);if(!Object.keys(Y).length)throw new Error(`Resource object is empty: ${H}`);Object.keys(Y).forEach(Ne=>{const W=Y[Ne];if(!Array.isArray(W))throw new Error(`Ability limits ${Ne} must be an array of objects, found: ${W}`);if(!W.length)throw new Error(`Value of ${Ne} is empty array, must be an array with objects`);W.forEach(ri=>{if(typeof ri!="object")throw new Error(`Ability limits (${Ne}) must be an array of objects, found: ${ri}`)})})})}function Yf(G,e,H,Y={}){return H==null||H.sort((Ne,W)=>Ne.localeCompare(W)),{att:{[G]:ji(e,H,Y)}}}function ji(G,e,H={}){e=e==null?void 0:e.sort((Ne,W)=>Ne.localeCompare(W));const Y=e.map(Ne=>({[`${G}/${Ne}`]:[H]}));return Object.assign({},...Y)}function jr(G){return me$1(G),`urn:recap:${Jf(G).replace(/=/g,"")}`}function Oe(G){const e=Gf(G.replace("urn:recap:",""));return me$1(e),e}function cu(G,e,H){const Y=Yf(G,e,H);return jr(Y)}function Qi$1(G){return G&&G.includes("urn:recap:")}function lu(G,e){const H=Oe(G),Y=Oe(e),Ne=Wf(H,Y);return jr(Ne)}function Wf(G,e){me$1(G),me$1(e);const H=Object.keys(G.att).concat(Object.keys(e.att)).sort((Ne,W)=>Ne.localeCompare(W)),Y={att:{}};return H.forEach(Ne=>{var W,ri;Object.keys(((W=G.att)==null?void 0:W[Ne])||{}).concat(Object.keys(((ri=e.att)==null?void 0:ri[Ne])||{})).sort((si,fi)=>si.localeCompare(fi)).forEach(si=>{var fi,ai;Y.att[Ne]=Hf(Hi$1({},Y.att[Ne]),{[si]:((fi=G.att[Ne])==null?void 0:fi[si])||((ai=e.att[Ne])==null?void 0:ai[si])})})}),Y}function Ji$1(G="",e){me$1(e);const H="I further authorize the stated URI to perform the following actions on my behalf: ";if(G.includes(H))return G;const Y=[];let Ne=0;Object.keys(e.att).forEach(si=>{const fi=Object.keys(e.att[si]).map(hi=>({ability:hi.split("/")[0],action:hi.split("/")[1]}));fi.sort((hi,ci)=>hi.action.localeCompare(ci.action));const ai={};fi.forEach(hi=>{ai[hi.ability]||(ai[hi.ability]=[]),ai[hi.ability].push(hi.action)});const ti=Object.keys(ai).map(hi=>(Ne++,`(${Ne}) '${hi}': '${ai[hi].join("', '")}' for '${si}'.`));Y.push(ti.join(", ").replace(".,","."))});const W=Y.join(" "),ri=`${H}${W}`;return`${G?G+" ":""}${ri}`}function du(G){var e;const H=Oe(G);me$1(H);const Y=(e=H.att)==null?void 0:e.eip155;return Y?Object.keys(Y).map(Ne=>Ne.split("/")[1]):[]}function pu(G){const e=Oe(G);me$1(e);const H=[];return Object.values(e.att).forEach(Y=>{Object.values(Y).forEach(Ne=>{var W;(W=Ne==null?void 0:Ne[0])!=null&&W.chains&&H.push(Ne[0].chains)})}),[...new Set(H.flat())]}function Qr(G){if(!G)return;const e=G==null?void 0:G[G.length-1];return Qi$1(e)?e:void 0}const Gi$1="base10",zt$1="base16",Jr="base64pad",Gr="utf8",Yi$1=0,lr$2=1,vu=0,Zf=1,Vi=12,Wi$2=32;function mu(){const G=x25519.generateKeyPair();return{privateKey:toString$1(G.secretKey,zt$1),publicKey:toString$1(G.publicKey,zt$1)}}function gu(){const G=random.randomBytes(Wi$2);return toString$1(G,zt$1)}function Au(G,e){const H=x25519.sharedKey(fromString$1(G,zt$1),fromString$1(e,zt$1),!0),Y=new HKDF_1(sha256.SHA256,H).expand(Wi$2);return toString$1(Y,zt$1)}function bu(G){const e=sha256.hash(fromString$1(G,zt$1));return toString$1(e,zt$1)}function yu(G){const e=sha256.hash(fromString$1(G,Gr));return toString$1(e,zt$1)}function $f(G){return fromString$1(`${G}`,Gi$1)}function Mr(G){return Number(toString$1(G,Gi$1))}function wu(G){const e=$f(typeof G.type<"u"?G.type:Yi$1);if(Mr(e)===lr$2&&typeof G.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");const H=typeof G.senderPublicKey<"u"?fromString$1(G.senderPublicKey,zt$1):void 0,Y=typeof G.iv<"u"?fromString$1(G.iv,zt$1):random.randomBytes(Vi),Ne=new chacha20poly1305.ChaCha20Poly1305(fromString$1(G.symKey,zt$1)).seal(Y,fromString$1(G.message,Gr));return to({type:e,sealed:Ne,iv:Y,senderPublicKey:H})}function xu(G){const e=new chacha20poly1305.ChaCha20Poly1305(fromString$1(G.symKey,zt$1)),{sealed:H,iv:Y}=Xi$1(G.encoded),Ne=e.open(Y,H);if(Ne===null)throw new Error("Failed to decrypt");return toString$1(Ne,Gr)}function to(G){if(Mr(G.type)===lr$2){if(typeof G.senderPublicKey>"u")throw new Error("Missing sender public key for type 1 envelope");return toString$1(concat$1([G.type,G.senderPublicKey,G.iv,G.sealed]),Jr)}return toString$1(concat$1([G.type,G.iv,G.sealed]),Jr)}function Xi$1(G){const e=fromString$1(G,Jr),H=e.slice(vu,Zf),Y=Zf;if(Mr(H)===lr$2){const si=Y+Wi$2,fi=si+Vi,ai=e.slice(Y,si),ti=e.slice(si,fi),hi=e.slice(fi);return{type:H,sealed:hi,iv:ti,senderPublicKey:ai}}const Ne=Y+Vi,W=e.slice(Y,Ne),ri=e.slice(Ne);return{type:H,sealed:ri,iv:W}}function Mu(G,e){const H=Xi$1(G);return eo({type:Mr(H.type),senderPublicKey:typeof H.senderPublicKey<"u"?toString$1(H.senderPublicKey,zt$1):void 0,receiverPublicKey:e==null?void 0:e.receiverPublicKey})}function eo(G){const e=(G==null?void 0:G.type)||Yi$1;if(e===lr$2){if(typeof(G==null?void 0:G.senderPublicKey)>"u")throw new Error("missing sender public key");if(typeof(G==null?void 0:G.receiverPublicKey)>"u")throw new Error("missing receiver public key")}return{type:e,senderPublicKey:G==null?void 0:G.senderPublicKey,receiverPublicKey:G==null?void 0:G.receiverPublicKey}}function Eu(G){return G.type===lr$2&&typeof G.senderPublicKey=="string"&&typeof G.receiverPublicKey=="string"}const ro="irn";function Su(G){return(G==null?void 0:G.relay)||{protocol:ro}}function Nu(G){const e=C$3[G];if(typeof e>"u")throw new Error(`Relay Protocol not supported: ${G}`);return e}var Iu=Object.defineProperty,_u=Object.defineProperties,Bu=Object.getOwnPropertyDescriptors,io=Object.getOwnPropertySymbols,Cu=Object.prototype.hasOwnProperty,Ru=Object.prototype.propertyIsEnumerable,no=(G,e,H)=>e in G?Iu(G,e,{enumerable:!0,configurable:!0,writable:!0,value:H}):G[e]=H,fo=(G,e)=>{for(var H in e||(e={}))Cu.call(e,H)&&no(G,H,e[H]);if(io)for(var H of io(e))Ru.call(e,H)&&no(G,H,e[H]);return G},Ou=(G,e)=>_u(G,Bu(e));function oo(G,e="-"){const H={},Y="relay"+e;return Object.keys(G).forEach(Ne=>{if(Ne.startsWith(Y)){const W=Ne.replace(Y,""),ri=G[Ne];H[W]=ri}}),H}function Pu(G){G=G.includes("wc://")?G.replace("wc://",""):G,G=G.includes("wc:")?G.replace("wc:",""):G;const e=G.indexOf(":"),H=G.indexOf("?")!==-1?G.indexOf("?"):void 0,Y=G.substring(0,e),Ne=G.substring(e+1,H).split("@"),W=typeof H<"u"?G.substring(H):"",ri=queryString.parse(W),si=typeof ri.methods=="string"?ri.methods.split(","):void 0;return{protocol:Y,topic:so(Ne[0]),version:parseInt(Ne[1],10),symKey:ri.symKey,relay:oo(ri),methods:si,expiryTimestamp:ri.expiryTimestamp?parseInt(ri.expiryTimestamp,10):void 0}}function so(G){return G.startsWith("//")?G.substring(2):G}function ao(G,e="-"){const H="relay",Y={};return Object.keys(G).forEach(Ne=>{const W=H+e+Ne;G[Ne]&&(Y[W]=G[Ne])}),Y}function Du(G){return`${G.protocol}:${G.topic}@${G.version}?`+queryString.stringify(fo(Ou(fo({symKey:G.symKey},ao(G.relay)),{expiryTimestamp:G.expiryTimestamp}),G.methods?{methods:G.methods.join(",")}:{}))}function $e$1(G){const e=[];return G.forEach(H=>{const[Y,Ne]=H.split(":");e.push(`${Y}:${Ne}`)}),e}function co(G){const e=[];return Object.values(G).forEach(H=>{e.push(...$e$1(H.accounts))}),e}function lo(G,e){const H=[];return Object.values(G).forEach(Y=>{$e$1(Y.accounts).includes(e)&&H.push(...Y.methods)}),H}function po(G,e){const H=[];return Object.values(G).forEach(Y=>{$e$1(Y.accounts).includes(e)&&H.push(...Y.events)}),H}function Zi$1(G){return G.includes(":")}function vo(G){return Zi$1(G)?G.split(":")[0]:G}function mo(G){const e={};return G==null||G.forEach(H=>{const[Y,Ne]=H.split(":");e[Y]||(e[Y]={accounts:[],chains:[],events:[]}),e[Y].accounts.push(H),e[Y].chains.push(`${Y}:${Ne}`)}),e}function ju(G,e){e=e.map(Y=>Y.replace("did:pkh:",""));const H=mo(e);for(const[Y,Ne]of Object.entries(H))Ne.methods?Ne.methods=ge$2(Ne.methods,G):Ne.methods=G,Ne.events=["chainChanged","accountsChanged"];return H}const go={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}},Ao={NOT_INITIALIZED:{message:"Not initialized.",code:1},NO_MATCHING_KEY:{message:"No matching key.",code:2},RESTORE_WILL_OVERRIDE:{message:"Restore will override.",code:3},RESUBSCRIBED:{message:"Resubscribed.",code:4},MISSING_OR_INVALID:{message:"Missing or invalid.",code:5},EXPIRED:{message:"Expired.",code:6},UNKNOWN_TYPE:{message:"Unknown type.",code:7},MISMATCHED_TOPIC:{message:"Mismatched topic.",code:8},NON_CONFORMING_NAMESPACES:{message:"Non conforming namespaces.",code:9}};function xe(G,e){const{message:H,code:Y}=Ao[G];return{message:e?`${H} ${e}`:H,code:Y}}function tr$1(G,e){const{message:H,code:Y}=go[G];return{message:e?`${H} ${e}`:H,code:Y}}function Er(G,e){return Array.isArray(G)?typeof e<"u"&&G.length?G.every(e):!0:!1}function Yr(G){return Object.getPrototypeOf(G)===Object.prototype&&Object.keys(G).length}function Pe(G){return typeof G>"u"}function Gt$1(G,e){return e&&Pe(G)?!0:typeof G=="string"&&!!G.trim().length}function Vr(G,e){return e&&Pe(G)?!0:typeof G=="number"&&!isNaN(G)}function Qu(G,e){const{requiredNamespaces:H}=e,Y=Object.keys(G.namespaces),Ne=Object.keys(H);let W=!0;return _e$1(Ne,Y)?(Y.forEach(ri=>{const{accounts:si,methods:fi,events:ai}=G.namespaces[ri],ti=$e$1(si),hi=H[ri];(!_e$1(_r$1(ri,hi),ti)||!_e$1(hi.methods,fi)||!_e$1(hi.events,ai))&&(W=!1)}),W):!1}function Sr$1(G){return Gt$1(G,!1)&&G.includes(":")?G.split(":").length===2:!1}function bo(G){if(Gt$1(G,!1)&&G.includes(":")){const e=G.split(":");if(e.length===3){const H=e[0]+":"+e[1];return!!e[2]&&Sr$1(H)}}return!1}function Ju(G){if(Gt$1(G,!1))try{return typeof new URL(G)<"u"}catch{return!1}return!1}function Gu(G){var e;return(e=G==null?void 0:G.proposer)==null?void 0:e.publicKey}function Yu(G){return G==null?void 0:G.topic}function Vu(G,e){let H=null;return Gt$1(G==null?void 0:G.publicKey,!1)||(H=xe("MISSING_OR_INVALID",`${e} controller public key should be a string`)),H}function tn(G){let e=!0;return Er(G)?G.length&&(e=G.every(H=>Gt$1(H,!1))):e=!1,e}function yo(G,e,H){let Y=null;return Er(e)&&e.length?e.forEach(Ne=>{Y||Sr$1(Ne)||(Y=tr$1("UNSUPPORTED_CHAINS",`${H}, chain ${Ne} should be a string and conform to "namespace:chainId" format`))}):Sr$1(G)||(Y=tr$1("UNSUPPORTED_CHAINS",`${H}, 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"] }`)),Y}function wo(G,e,H){let Y=null;return Object.entries(G).forEach(([Ne,W])=>{if(Y)return;const ri=yo(Ne,_r$1(Ne,W),`${e} ${H}`);ri&&(Y=ri)}),Y}function xo(G,e){let H=null;return Er(G)?G.forEach(Y=>{H||bo(Y)||(H=tr$1("UNSUPPORTED_ACCOUNTS",`${e}, account ${Y} should be a string and conform to "namespace:chainId:address" format`))}):H=tr$1("UNSUPPORTED_ACCOUNTS",`${e}, accounts should be an array of strings conforming to "namespace:chainId:address" format`),H}function Mo(G,e){let H=null;return Object.values(G).forEach(Y=>{if(H)return;const Ne=xo(Y==null?void 0:Y.accounts,`${e} namespace`);Ne&&(H=Ne)}),H}function Eo(G,e){let H=null;return tn(G==null?void 0:G.methods)?tn(G==null?void 0:G.events)||(H=tr$1("UNSUPPORTED_EVENTS",`${e}, events should be an array of strings or empty array for no events`)):H=tr$1("UNSUPPORTED_METHODS",`${e}, methods should be an array of strings or empty array for no methods`),H}function en(G,e){let H=null;return Object.values(G).forEach(Y=>{if(H)return;const Ne=Eo(Y,`${e}, namespace`);Ne&&(H=Ne)}),H}function Wu(G,e,H){let Y=null;if(G&&Yr(G)){const Ne=en(G,e);Ne&&(Y=Ne);const W=wo(G,e,H);W&&(Y=W)}else Y=xe("MISSING_OR_INVALID",`${e}, ${H} should be an object with data`);return Y}function So(G,e){let H=null;if(G&&Yr(G)){const Y=en(G,e);Y&&(H=Y);const Ne=Mo(G,e);Ne&&(H=Ne)}else H=xe("MISSING_OR_INVALID",`${e}, namespaces should be an object with data`);return H}function No(G){return Gt$1(G.protocol,!0)}function Xu(G,e){let H=!1;return e&&!G?H=!0:G&&Er(G)&&G.length&&G.forEach(Y=>{H=No(Y)}),H}function Zu(G){return typeof G=="number"}function $u(G){return typeof G<"u"&&typeof G!==null}function th(G){return!(!G||typeof G!="object"||!G.code||!Vr(G.code,!1)||!G.message||!Gt$1(G.message,!1))}function eh(G){return!(Pe(G)||!Gt$1(G.method,!1))}function rh(G){return!(Pe(G)||Pe(G.result)&&Pe(G.error)||!Vr(G.id,!1)||!Gt$1(G.jsonrpc,!1))}function ih(G){return!(Pe(G)||!Gt$1(G.name,!1))}function nh(G,e){return!(!Sr$1(e)||!co(G).includes(e))}function fh(G,e,H){return Gt$1(H,!1)?lo(G,e).includes(H):!1}function oh(G,e,H){return Gt$1(H,!1)?po(G,e).includes(H):!1}function Io(G,e,H){let Y=null;const Ne=sh(G),W=ah(e),ri=Object.keys(Ne),si=Object.keys(W),fi=_o(Object.keys(G)),ai=_o(Object.keys(e)),ti=fi.filter(hi=>!ai.includes(hi));return ti.length&&(Y=xe("NON_CONFORMING_NAMESPACES",`${H} namespaces keys don't satisfy requiredNamespaces. - Required: ${ti.toString()} - Received: ${Object.keys(e).toString()}`)),_e$1(ri,si)||(Y=xe("NON_CONFORMING_NAMESPACES",`${H} namespaces chains don't satisfy required namespaces. - Required: ${ri.toString()} - Approved: ${si.toString()}`)),Object.keys(e).forEach(hi=>{if(!hi.includes(":")||Y)return;const ci=$e$1(e[hi].accounts);ci.includes(hi)||(Y=xe("NON_CONFORMING_NAMESPACES",`${H} namespaces accounts don't satisfy namespace accounts for ${hi} - Required: ${hi} - Approved: ${ci.toString()}`))}),ri.forEach(hi=>{Y||(_e$1(Ne[hi].methods,W[hi].methods)?_e$1(Ne[hi].events,W[hi].events)||(Y=xe("NON_CONFORMING_NAMESPACES",`${H} namespaces events don't satisfy namespace events for ${hi}`)):Y=xe("NON_CONFORMING_NAMESPACES",`${H} namespaces methods don't satisfy namespace methods for ${hi}`))}),Y}function sh(G){const e={};return Object.keys(G).forEach(H=>{var Y;H.includes(":")?e[H]=G[H]:(Y=G[H].chains)==null||Y.forEach(Ne=>{e[Ne]={methods:G[H].methods,events:G[H].events}})}),e}function _o(G){return[...new Set(G.map(e=>e.includes(":")?e.split(":")[0]:e))]}function ah(G){const e={};return Object.keys(G).forEach(H=>{if(H.includes(":"))e[H]=G[H];else{const Y=$e$1(G[H].accounts);Y==null||Y.forEach(Ne=>{e[Ne]={accounts:G[H].accounts.filter(W=>W.includes(`${Ne}:`)),methods:G[H].methods,events:G[H].events}})}}),e}function uh(G,e){return Vr(G,!1)&&G<=e.max&&G>=e.min}function hh(){const G=We$2();return new Promise(e=>{switch(G){case qt$1.browser:e(Bo());break;case qt$1.reactNative:e(Co());break;case qt$1.node:e(Ro());break;default:e(!0)}})}function Bo(){return pr$1()&&(navigator==null?void 0:navigator.onLine)}async function Co(){if(er$1()&&typeof global<"u"&&global!=null&&global.NetInfo){const G=await(global==null?void 0:global.NetInfo.fetch());return G==null?void 0:G.isConnected}return!0}function Ro(){return!0}function ch(G){switch(We$2()){case qt$1.browser:Oo(G);break;case qt$1.reactNative:Po(G);break}}function Oo(G){!er$1()&&pr$1()&&(window.addEventListener("online",()=>G(!0)),window.addEventListener("offline",()=>G(!1)))}function Po(G){er$1()&&typeof global<"u"&&global!=null&&global.NetInfo&&(global==null||global.NetInfo.addEventListener(e=>G(e==null?void 0:e.isConnected)))}const rn={};class lh{static get(e){return rn[e]}static set(e,H){rn[e]=H}static delete(e){delete rn[e]}}const suspectProtoRx=/"(?:_|\\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*:/,suspectConstructorRx=/"(?: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*:/,JsonSigRx=/^\s*["[{]|^\s*-?\d{1,16}(\.\d{1,17})?([Ee][+-]?\d+)?\s*$/;function jsonParseTransform(G,e){if(G==="__proto__"||G==="constructor"&&e&&typeof e=="object"&&"prototype"in e){warnKeyDropped(G);return}return e}function warnKeyDropped(G){console.warn(`[destr] Dropping "${G}" key to prevent prototype pollution.`)}function destr(G,e={}){if(typeof G!="string")return G;const H=G.trim();if(G[0]==='"'&&G.endsWith('"')&&!G.includes("\\"))return H.slice(1,-1);if(H.length<=9){const Y=H.toLowerCase();if(Y==="true")return!0;if(Y==="false")return!1;if(Y==="undefined")return;if(Y==="null")return null;if(Y==="nan")return Number.NaN;if(Y==="infinity")return Number.POSITIVE_INFINITY;if(Y==="-infinity")return Number.NEGATIVE_INFINITY}if(!JsonSigRx.test(G)){if(e.strict)throw new SyntaxError("[destr] Invalid JSON");return G}try{if(suspectProtoRx.test(G)||suspectConstructorRx.test(G)){if(e.strict)throw new Error("[destr] Possible prototype pollution");return JSON.parse(G,jsonParseTransform)}return JSON.parse(G)}catch(Y){if(e.strict)throw Y;return G}}function wrapToPromise(G){return!G||typeof G.then!="function"?Promise.resolve(G):G}function asyncCall(G,...e){try{return wrapToPromise(G(...e))}catch(H){return Promise.reject(H)}}function isPrimitive(G){const e=typeof G;return G===null||e!=="object"&&e!=="function"}function isPureObject(G){const e=Object.getPrototypeOf(G);return!e||e.isPrototypeOf(Object)}function stringify(G){if(isPrimitive(G))return String(G);if(isPureObject(G)||Array.isArray(G))return JSON.stringify(G);if(typeof G.toJSON=="function")return stringify(G.toJSON());throw new Error("[unstorage] Cannot stringify value!")}function checkBufferSupport(){if(typeof Buffer===void 0)throw new TypeError("[unstorage] Buffer is not supported!")}const BASE64_PREFIX="base64:";function serializeRaw(G){if(typeof G=="string")return G;checkBufferSupport();const e=Buffer.from(G).toString("base64");return BASE64_PREFIX+e}function deserializeRaw(G){return typeof G!="string"||!G.startsWith(BASE64_PREFIX)?G:(checkBufferSupport(),Buffer.from(G.slice(BASE64_PREFIX.length),"base64"))}function normalizeKey(G){return G?G.split("?")[0].replace(/[/\\]/g,":").replace(/:+/g,":").replace(/^:|:$/g,""):""}function joinKeys(...G){return normalizeKey(G.join(":"))}function normalizeBaseKey(G){return G=normalizeKey(G),G?G+":":""}function defineDriver(G){return G}const DRIVER_NAME="memory",memory=()=>{const G=new Map;return{name:DRIVER_NAME,options:{},hasItem(e){return G.has(e)},getItem(e){return G.get(e)??null},getItemRaw(e){return G.get(e)??null},setItem(e,H){G.set(e,H)},setItemRaw(e,H){G.set(e,H)},removeItem(e){G.delete(e)},getKeys(){return Array.from(G.keys())},clear(){G.clear()},dispose(){G.clear()}}};function createStorage(G={}){const e={mounts:{"":G.driver||memory()},mountpoints:[""],watching:!1,watchListeners:[],unwatch:{}},H=ai=>{for(const ti of e.mountpoints)if(ai.startsWith(ti))return{base:ti,relativeKey:ai.slice(ti.length),driver:e.mounts[ti]};return{base:"",relativeKey:ai,driver:e.mounts[""]}},Y=(ai,ti)=>e.mountpoints.filter(hi=>hi.startsWith(ai)||ti&&ai.startsWith(hi)).map(hi=>({relativeBase:ai.length>hi.length?ai.slice(hi.length):void 0,mountpoint:hi,driver:e.mounts[hi]})),Ne=(ai,ti)=>{if(e.watching){ti=normalizeKey(ti);for(const hi of e.watchListeners)hi(ai,ti)}},W=async()=>{if(!e.watching){e.watching=!0;for(const ai in e.mounts)e.unwatch[ai]=await watch(e.mounts[ai],Ne,ai)}},ri=async()=>{if(e.watching){for(const ai in e.unwatch)await e.unwatch[ai]();e.unwatch={},e.watching=!1}},si=(ai,ti,hi)=>{const ci=new Map,ui=li=>{let mi=ci.get(li.base);return mi||(mi={driver:li.driver,base:li.base,items:[]},ci.set(li.base,mi)),mi};for(const li of ai){const mi=typeof li=="string",hn=normalizeKey(mi?li:li.key),ln=mi?void 0:li.value,fn=mi||!li.options?ti:{...ti,...li.options},gn=H(hn);ui(gn).items.push({key:hn,value:ln,relativeKey:gn.relativeKey,options:fn})}return Promise.all([...ci.values()].map(li=>hi(li))).then(li=>li.flat())},fi={hasItem(ai,ti={}){ai=normalizeKey(ai);const{relativeKey:hi,driver:ci}=H(ai);return asyncCall(ci.hasItem,hi,ti)},getItem(ai,ti={}){ai=normalizeKey(ai);const{relativeKey:hi,driver:ci}=H(ai);return asyncCall(ci.getItem,hi,ti).then(ui=>destr(ui))},getItems(ai,ti){return si(ai,ti,hi=>hi.driver.getItems?asyncCall(hi.driver.getItems,hi.items.map(ci=>({key:ci.relativeKey,options:ci.options})),ti).then(ci=>ci.map(ui=>({key:joinKeys(hi.base,ui.key),value:destr(ui.value)}))):Promise.all(hi.items.map(ci=>asyncCall(hi.driver.getItem,ci.relativeKey,ci.options).then(ui=>({key:ci.key,value:destr(ui)})))))},getItemRaw(ai,ti={}){ai=normalizeKey(ai);const{relativeKey:hi,driver:ci}=H(ai);return ci.getItemRaw?asyncCall(ci.getItemRaw,hi,ti):asyncCall(ci.getItem,hi,ti).then(ui=>deserializeRaw(ui))},async setItem(ai,ti,hi={}){if(ti===void 0)return fi.removeItem(ai);ai=normalizeKey(ai);const{relativeKey:ci,driver:ui}=H(ai);ui.setItem&&(await asyncCall(ui.setItem,ci,stringify(ti),hi),ui.watch||Ne("update",ai))},async setItems(ai,ti){await si(ai,ti,async hi=>{hi.driver.setItems&&await asyncCall(hi.driver.setItems,hi.items.map(ci=>({key:ci.relativeKey,value:stringify(ci.value),options:ci.options})),ti),hi.driver.setItem&&await Promise.all(hi.items.map(ci=>asyncCall(hi.driver.setItem,ci.relativeKey,stringify(ci.value),ci.options)))})},async setItemRaw(ai,ti,hi={}){if(ti===void 0)return fi.removeItem(ai,hi);ai=normalizeKey(ai);const{relativeKey:ci,driver:ui}=H(ai);if(ui.setItemRaw)await asyncCall(ui.setItemRaw,ci,ti,hi);else if(ui.setItem)await asyncCall(ui.setItem,ci,serializeRaw(ti),hi);else return;ui.watch||Ne("update",ai)},async removeItem(ai,ti={}){typeof ti=="boolean"&&(ti={removeMeta:ti}),ai=normalizeKey(ai);const{relativeKey:hi,driver:ci}=H(ai);ci.removeItem&&(await asyncCall(ci.removeItem,hi,ti),(ti.removeMeta||ti.removeMata)&&await asyncCall(ci.removeItem,hi+"$",ti),ci.watch||Ne("remove",ai))},async getMeta(ai,ti={}){typeof ti=="boolean"&&(ti={nativeOnly:ti}),ai=normalizeKey(ai);const{relativeKey:hi,driver:ci}=H(ai),ui=Object.create(null);if(ci.getMeta&&Object.assign(ui,await asyncCall(ci.getMeta,hi,ti)),!ti.nativeOnly){const li=await asyncCall(ci.getItem,hi+"$",ti).then(mi=>destr(mi));li&&typeof li=="object"&&(typeof li.atime=="string"&&(li.atime=new Date(li.atime)),typeof li.mtime=="string"&&(li.mtime=new Date(li.mtime)),Object.assign(ui,li))}return ui},setMeta(ai,ti,hi={}){return this.setItem(ai+"$",ti,hi)},removeMeta(ai,ti={}){return this.removeItem(ai+"$",ti)},async getKeys(ai,ti={}){ai=normalizeBaseKey(ai);const hi=Y(ai,!0);let ci=[];const ui=[];for(const li of hi){const hn=(await asyncCall(li.driver.getKeys,li.relativeBase,ti)).map(ln=>li.mountpoint+normalizeKey(ln)).filter(ln=>!ci.some(fn=>ln.startsWith(fn)));ui.push(...hn),ci=[li.mountpoint,...ci.filter(ln=>!ln.startsWith(li.mountpoint))]}return ai?ui.filter(li=>li.startsWith(ai)&&!li.endsWith("$")):ui.filter(li=>!li.endsWith("$"))},async clear(ai,ti={}){ai=normalizeBaseKey(ai),await Promise.all(Y(ai,!1).map(async hi=>{if(hi.driver.clear)return asyncCall(hi.driver.clear,hi.relativeBase,ti);if(hi.driver.removeItem){const ci=await hi.driver.getKeys(hi.relativeBase||"",ti);return Promise.all(ci.map(ui=>hi.driver.removeItem(ui,ti)))}}))},async dispose(){await Promise.all(Object.values(e.mounts).map(ai=>dispose(ai)))},async watch(ai){return await W(),e.watchListeners.push(ai),async()=>{e.watchListeners=e.watchListeners.filter(ti=>ti!==ai),e.watchListeners.length===0&&await ri()}},async unwatch(){e.watchListeners=[],await ri()},mount(ai,ti){if(ai=normalizeBaseKey(ai),ai&&e.mounts[ai])throw new Error(`already mounted at ${ai}`);return ai&&(e.mountpoints.push(ai),e.mountpoints.sort((hi,ci)=>ci.length-hi.length)),e.mounts[ai]=ti,e.watching&&Promise.resolve(watch(ti,Ne,ai)).then(hi=>{e.unwatch[ai]=hi}).catch(console.error),fi},async unmount(ai,ti=!0){ai=normalizeBaseKey(ai),!(!ai||!e.mounts[ai])&&(e.watching&&ai in e.unwatch&&(e.unwatch[ai](),delete e.unwatch[ai]),ti&&await dispose(e.mounts[ai]),e.mountpoints=e.mountpoints.filter(hi=>hi!==ai),delete e.mounts[ai])},getMount(ai=""){ai=normalizeKey(ai)+":";const ti=H(ai);return{driver:ti.driver,base:ti.base}},getMounts(ai="",ti={}){return ai=normalizeKey(ai),Y(ai,ti.parents).map(ci=>({driver:ci.driver,base:ci.mountpoint}))}};return fi}function watch(G,e,H){return G.watch?G.watch((Y,Ne)=>e(Y,H+Ne)):()=>{}}async function dispose(G){typeof G.dispose=="function"&&await asyncCall(G.dispose)}function promisifyRequest(G){return new Promise((e,H)=>{G.oncomplete=G.onsuccess=()=>e(G.result),G.onabort=G.onerror=()=>H(G.error)})}function createStore(G,e){const H=indexedDB.open(G);H.onupgradeneeded=()=>H.result.createObjectStore(e);const Y=promisifyRequest(H);return(Ne,W)=>Y.then(ri=>W(ri.transaction(e,Ne).objectStore(e)))}let defaultGetStoreFunc;function defaultGetStore(){return defaultGetStoreFunc||(defaultGetStoreFunc=createStore("keyval-store","keyval")),defaultGetStoreFunc}function get(G,e=defaultGetStore()){return e("readonly",H=>promisifyRequest(H.get(G)))}function set$1(G,e,H=defaultGetStore()){return H("readwrite",Y=>(Y.put(e,G),promisifyRequest(Y.transaction)))}function del(G,e=defaultGetStore()){return e("readwrite",H=>(H.delete(G),promisifyRequest(H.transaction)))}function clear(G=defaultGetStore()){return G("readwrite",e=>(e.clear(),promisifyRequest(e.transaction)))}function eachCursor(G,e){return G.openCursor().onsuccess=function(){this.result&&(e(this.result),this.result.continue())},promisifyRequest(G.transaction)}function keys(G=defaultGetStore()){return G("readonly",e=>{if(e.getAllKeys)return promisifyRequest(e.getAllKeys());const H=[];return eachCursor(e,Y=>H.push(Y.key)).then(()=>H)})}const JSONStringify=G=>JSON.stringify(G,(e,H)=>typeof H=="bigint"?H.toString()+"n":H),JSONParse=G=>{const e=/([\[:])?(\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,H=G.replace(e,'$1"$2n"$3');return JSON.parse(H,(Y,Ne)=>typeof Ne=="string"&&Ne.match(/^\d+n$/)?BigInt(Ne.substring(0,Ne.length-1)):Ne)};function safeJsonParse(G){if(typeof G!="string")throw new Error(`Cannot safe json parse value of type ${typeof G}`);try{return JSONParse(G)}catch{return G}}function safeJsonStringify(G){return typeof G=="string"?G:JSONStringify(G)||""}const x$1="idb-keyval";var z$4=(G={})=>{const e=G.base&&G.base.length>0?`${G.base}:`:"",H=Ne=>e+Ne;let Y;return G.dbName&&G.storeName&&(Y=createStore(G.dbName,G.storeName)),{name:x$1,options:G,async hasItem(Ne){return!(typeof await get(H(Ne),Y)>"u")},async getItem(Ne){return await get(H(Ne),Y)??null},setItem(Ne,W){return set$1(H(Ne),W,Y)},removeItem(Ne){return del(H(Ne),Y)},getKeys(){return keys(Y)},clear(){return clear(Y)}}};const D$2="WALLET_CONNECT_V2_INDEXED_DB",E$5="keyvaluestorage";let _$1=class{constructor(){this.indexedDb=createStorage({driver:z$4({dbName:D$2,storeName:E$5})})}async getKeys(){return this.indexedDb.getKeys()}async getEntries(){return(await this.indexedDb.getItems(await this.indexedDb.getKeys())).map(e=>[e.key,e.value])}async getItem(e){const H=await this.indexedDb.getItem(e);if(H!==null)return H}async setItem(e,H){await this.indexedDb.setItem(e,safeJsonStringify(H))}async removeItem(e){await this.indexedDb.removeItem(e)}};var l$2=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},c$2={exports:{}};(function(){let G;function e(){}G=e,G.prototype.getItem=function(H){return this.hasOwnProperty(H)?String(this[H]):null},G.prototype.setItem=function(H,Y){this[H]=String(Y)},G.prototype.removeItem=function(H){delete this[H]},G.prototype.clear=function(){const H=this;Object.keys(H).forEach(function(Y){H[Y]=void 0,delete H[Y]})},G.prototype.key=function(H){return H=H||0,Object.keys(this)[H]},G.prototype.__defineGetter__("length",function(){return Object.keys(this).length}),typeof l$2<"u"&&l$2.localStorage?c$2.exports=l$2.localStorage:typeof window<"u"&&window.localStorage?c$2.exports=window.localStorage:c$2.exports=new e})();function k$1(G){var e;return[G[0],safeJsonParse((e=G[1])!=null?e:"")]}class K{constructor(){this.localStorage=c$2.exports}async getKeys(){return Object.keys(this.localStorage)}async getEntries(){return Object.entries(this.localStorage).map(k$1)}async getItem(e){const H=this.localStorage.getItem(e);if(H!==null)return safeJsonParse(H)}async setItem(e,H){this.localStorage.setItem(e,safeJsonStringify(H))}async removeItem(e){this.localStorage.removeItem(e)}}const N$1="wc_storage_version",y$5=1,O$3=async(G,e,H)=>{const Y=N$1,Ne=await e.getItem(Y);if(Ne&&Ne>=y$5){H(e);return}const W=await G.getKeys();if(!W.length){H(e);return}const ri=[];for(;W.length;){const si=W.shift();if(!si)continue;const fi=si.toLowerCase();if(fi.includes("wc@")||fi.includes("walletconnect")||fi.includes("wc_")||fi.includes("wallet_connect")){const ai=await G.getItem(si);await e.setItem(si,ai),ri.push(si)}}await e.setItem(Y,y$5),H(e),j$3(G,ri)},j$3=async(G,e)=>{e.length&&e.forEach(async H=>{await G.removeItem(H)})};let h$2=class{constructor(){this.initialized=!1,this.setInitialized=H=>{this.storage=H,this.initialized=!0};const e=new K;this.storage=e;try{const H=new _$1;O$3(e,H,this.setInitialized)}catch{this.initialized=!0}}async getKeys(){return await this.initialize(),this.storage.getKeys()}async getEntries(){return await this.initialize(),this.storage.getEntries()}async getItem(e){return await this.initialize(),this.storage.getItem(e)}async setItem(e,H){return await this.initialize(),this.storage.setItem(e,H)}async removeItem(e){return await this.initialize(),this.storage.removeItem(e)}async initialize(){this.initialized||await new Promise(e=>{const H=setInterval(()=>{this.initialized&&(clearInterval(H),e())},20)})}},IEvents$1=class{},n$2=class extends IEvents$1{constructor(e){super()}};const s=cjs$3.FIVE_SECONDS,r={pulse:"heartbeat_pulse"};let i$1=class dg extends n$2{constructor(e){super(e),this.events=new eventsExports.EventEmitter,this.interval=s,this.interval=(e==null?void 0:e.interval)||s}static async init(e){const H=new dg(e);return await H.init(),H}async init(){await this.initialize()}stop(){clearInterval(this.intervalRef)}on(e,H){this.events.on(e,H)}once(e,H){this.events.once(e,H)}off(e,H){this.events.off(e,H)}removeListener(e,H){this.events.removeListener(e,H)}async initialize(){this.intervalRef=setInterval(()=>this.pulse(),cjs$3.toMiliseconds(this.interval))}pulse(){this.events.emit(r.pulse)}};function tryStringify(G){try{return JSON.stringify(G)}catch{return'"[Circular]"'}}var quickFormatUnescaped=format$1;function format$1(G,e,H){var Y=H&&H.stringify||tryStringify,Ne=1;if(typeof G=="object"&&G!==null){var W=e.length+Ne;if(W===1)return G;var ri=new Array(W);ri[0]=Y(G);for(var si=1;si-1?hi:0,G.charCodeAt(ui+1)){case 100:case 102:if(ti>=fi||e[ti]==null)break;hi=fi||e[ti]==null)break;hi=fi||e[ti]===void 0)break;hi",hi=ui+2,ui++;break}ai+=Y(e[ti]),hi=ui+2,ui++;break;case 115:if(ti>=fi)break;hi-1&&(W=!1);const ri=["error","fatal","warn","info","debug","trace"];typeof H=="function"&&(H.error=H.fatal=H.warn=H.info=H.debug=H.trace=H),G.enabled===!1&&(G.level="silent");const si=G.level||"info",fi=Object.create(H);fi.log||(fi.log=noop),Object.defineProperty(fi,"levelVal",{get:ti}),Object.defineProperty(fi,"level",{get:hi,set:ci});const ai={transmit:e,serialize:Ne,asObject:G.browser.asObject,levels:ri,timestamp:getTimeFunction(G)};fi.levels=pino.levels,fi.level=si,fi.setMaxListeners=fi.getMaxListeners=fi.emit=fi.addListener=fi.on=fi.prependListener=fi.once=fi.prependOnceListener=fi.removeListener=fi.removeAllListeners=fi.listeners=fi.listenerCount=fi.eventNames=fi.write=fi.flush=noop,fi.serializers=Y,fi._serialize=Ne,fi._stdErrSerialize=W,fi.child=ui,e&&(fi._logEvent=createLogEventShape());function ti(){return this.level==="silent"?1/0:this.levels.values[this.level]}function hi(){return this._level}function ci(li){if(li!=="silent"&&!this.levels.values[li])throw Error("unknown level "+li);this._level=li,set(ai,fi,"error","log"),set(ai,fi,"fatal","error"),set(ai,fi,"warn","error"),set(ai,fi,"info","log"),set(ai,fi,"debug","log"),set(ai,fi,"trace","log")}function ui(li,mi){if(!li)throw new Error("missing bindings for child Pino");mi=mi||{},Ne&&li.serializers&&(mi.serializers=li.serializers);const hn=mi.serializers;if(Ne&&hn){var ln=Object.assign({},Y,hn),fn=G.browser.serialize===!0?Object.keys(ln):Ne;delete li.serializers,applySerializers([li],fn,ln,this._stdErrSerialize)}function gn(cn){this._childLevel=(cn._childLevel|0)+1,this.error=bind(cn,li,"error"),this.fatal=bind(cn,li,"fatal"),this.warn=bind(cn,li,"warn"),this.info=bind(cn,li,"info"),this.debug=bind(cn,li,"debug"),this.trace=bind(cn,li,"trace"),ln&&(this.serializers=ln,this._serialize=fn),e&&(this._logEvent=createLogEventShape([].concat(cn._logEvent.bindings,li)))}return gn.prototype=this,new gn(this)}return fi}pino.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"}};pino.stdSerializers=stdSerializers;pino.stdTimeFunctions=Object.assign({},{nullTime,epochTime,unixTime,isoTime});function set(G,e,H,Y){const Ne=Object.getPrototypeOf(e);e[H]=e.levelVal>e.levels.values[H]?noop:Ne[H]?Ne[H]:_console[H]||_console[Y]||noop,wrap(G,e,H)}function wrap(G,e,H){!G.transmit&&e[H]===noop||(e[H]=function(Y){return function(){const W=G.timestamp(),ri=new Array(arguments.length),si=Object.getPrototypeOf&&Object.getPrototypeOf(this)===_console?_console:this;for(var fi=0;fi-1&&W in H&&(G[Ne][W]=H[W](G[Ne][W]))}function bind(G,e,H){return function(){const Y=new Array(1+arguments.length);Y[0]=e;for(var Ne=1;Nethis.maxSizeInBytes)throw new Error(`[LinkedList] Value too big to insert into list: ${e} with size ${H.size}`);for(;this.size+H.size>this.maxSizeInBytes;)this.shift();this.head?(this.tail&&(this.tail.next=H),this.tail=H):(this.head=H,this.tail=H),this.lengthInNodes++,this.sizeInBytes+=H.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 H=this.head;for(;H!==null;)e.push(H.value),H=H.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 H=e.value;return e=e.next,{done:!1,value:H}}}}},L$3=class{constructor(e,H=l$1){this.level=e??"error",this.levelValue=browser$1.levels.values[this.level],this.MAX_LOG_SIZE_IN_BYTES=H,this.logs=new d$2(this.MAX_LOG_SIZE_IN_BYTES)}forwardToConsole(e,H){H===browser$1.levels.values.error?console.error(e):H===browser$1.levels.values.warn?console.warn(e):H===browser$1.levels.values.debug?console.debug(e):H===browser$1.levels.values.trace?console.trace(e):console.log(e)}appendToLogs(e){this.logs.append(safeJsonStringify({timestamp:new Date().toISOString(),log:e}));const H=typeof e=="string"?JSON.parse(e).level:e.level;H>=this.levelValue&&this.forwardToConsole(e,H)}getLogs(){return this.logs}clearLogs(){this.logs=new d$2(this.MAX_LOG_SIZE_IN_BYTES)}getLogArray(){return Array.from(this.logs)}logsToBlob(e){const H=this.getLogArray();return H.push(safeJsonStringify({extraMetadata:e})),new Blob(H,{type:"application/json"})}},m$1=class{constructor(e,H=l$1){this.baseChunkLogger=new L$3(e,H)}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 H=URL.createObjectURL(this.logsToBlob(e)),Y=document.createElement("a");Y.href=H,Y.download=`walletconnect-logs-${new Date().toISOString()}.txt`,document.body.appendChild(Y),Y.click(),document.body.removeChild(Y),URL.revokeObjectURL(H)}},B$1=class{constructor(e,H=l$1){this.baseChunkLogger=new L$3(e,H)}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 x=Object.defineProperty,S$3=Object.defineProperties,_=Object.getOwnPropertyDescriptors,p$3=Object.getOwnPropertySymbols,T$2=Object.prototype.hasOwnProperty,z$3=Object.prototype.propertyIsEnumerable,f$4=(G,e,H)=>e in G?x(G,e,{enumerable:!0,configurable:!0,writable:!0,value:H}):G[e]=H,i=(G,e)=>{for(var H in e||(e={}))T$2.call(e,H)&&f$4(G,H,e[H]);if(p$3)for(var H of p$3(e))z$3.call(e,H)&&f$4(G,H,e[H]);return G},g$3=(G,e)=>S$3(G,_(e));function k(G){return g$3(i({},G),{level:(G==null?void 0:G.level)||c$1.level})}function v$3(G,e=n$1){return G[e]||""}function b$3(G,e,H=n$1){return G[H]=e,G}function y$4(G,e=n$1){let H="";return typeof G.bindings>"u"?H=v$3(G,e):H=G.bindings().context||"",H}function w$3(G,e,H=n$1){const Y=y$4(G,H);return Y.trim()?`${Y}/${e}`:e}function E$4(G,e,H=n$1){const Y=w$3(G,e,H),Ne=G.child({context:Y});return b$3(Ne,Y,H)}function C$2(G){var e,H;const Y=new m$1((e=G.opts)==null?void 0:e.level,G.maxSizeInBytes);return{logger:Hg(g$3(i({},G.opts),{level:"trace",browser:g$3(i({},(H=G.opts)==null?void 0:H.browser),{write:Ne=>Y.write(Ne)})})),chunkLoggerController:Y}}function I$1(G){var e;const H=new B$1((e=G.opts)==null?void 0:e.level,G.maxSizeInBytes);return{logger:Hg(g$3(i({},G.opts),{level:"trace"}),H),chunkLoggerController:H}}function A(G){return typeof G.loggerOverride<"u"&&typeof G.loggerOverride!="string"?{logger:G.loggerOverride,chunkLoggerController:null}:typeof window<"u"?C$2(G):I$1(G)}class n extends IEvents$1{constructor(e){super(),this.opts=e,this.protocol="wc",this.version=2}}let h$1=class extends IEvents$1{constructor(e,H){super(),this.core=e,this.logger=H,this.records=new Map}},a$1=class{constructor(e,H){this.logger=e,this.core=H}},u$1=class extends IEvents$1{constructor(e,H){super(),this.relayer=e,this.logger=H}},g$2=class extends IEvents$1{constructor(e){super()}},p$2=class{constructor(e,H,Y,Ne){this.core=e,this.logger=H,this.name=Y}},d$1=class extends IEvents$1{constructor(e,H){super(),this.relayer=e,this.logger=H}},E$3=class extends IEvents$1{constructor(e,H){super(),this.core=e,this.logger=H}},y$3=class{constructor(e,H){this.projectId=e,this.logger=H}},v$2=class{constructor(e,H){this.projectId=e,this.logger=H}},b$2=class{constructor(e){this.opts=e,this.protocol="wc",this.version=2}},w$2=class{constructor(e){this.client=e}};var ed25519={},sha512={};(function(G){Object.defineProperty(G,"__esModule",{value:!0});var e=binary,H=wipe$1;G.DIGEST_LENGTH=64,G.BLOCK_SIZE=128;var Y=function(){function si(){this.digestLength=G.DIGEST_LENGTH,this.blockSize=G.BLOCK_SIZE,this._stateHi=new Int32Array(8),this._stateLo=new Int32Array(8),this._tempHi=new Int32Array(16),this._tempLo=new Int32Array(16),this._buffer=new Uint8Array(256),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this.reset()}return si.prototype._initState=function(){this._stateHi[0]=1779033703,this._stateHi[1]=3144134277,this._stateHi[2]=1013904242,this._stateHi[3]=2773480762,this._stateHi[4]=1359893119,this._stateHi[5]=2600822924,this._stateHi[6]=528734635,this._stateHi[7]=1541459225,this._stateLo[0]=4089235720,this._stateLo[1]=2227873595,this._stateLo[2]=4271175723,this._stateLo[3]=1595750129,this._stateLo[4]=2917565137,this._stateLo[5]=725511199,this._stateLo[6]=4215389547,this._stateLo[7]=327033209},si.prototype.reset=function(){return this._initState(),this._bufferLength=0,this._bytesHashed=0,this._finished=!1,this},si.prototype.clean=function(){H.wipe(this._buffer),H.wipe(this._tempHi),H.wipe(this._tempLo),this.reset()},si.prototype.update=function(fi,ai){if(ai===void 0&&(ai=fi.length),this._finished)throw new Error("SHA512: can't update because hash was finished.");var ti=0;if(this._bytesHashed+=ai,this._bufferLength>0){for(;this._bufferLength0;)this._buffer[this._bufferLength++]=fi[ti++],ai--;this._bufferLength===this.blockSize&&(W(this._tempHi,this._tempLo,this._stateHi,this._stateLo,this._buffer,0,this.blockSize),this._bufferLength=0)}for(ai>=this.blockSize&&(ti=W(this._tempHi,this._tempLo,this._stateHi,this._stateLo,fi,ti,ai),ai%=this.blockSize);ai>0;)this._buffer[this._bufferLength++]=fi[ti++],ai--;return this},si.prototype.finish=function(fi){if(!this._finished){var ai=this._bytesHashed,ti=this._bufferLength,hi=ai/536870912|0,ci=ai<<3,ui=ai%128<112?128:256;this._buffer[ti]=128;for(var li=ti+1;li0?new Uint8Array(this._buffer):void 0,bufferLength:this._bufferLength,bytesHashed:this._bytesHashed}},si.prototype.restoreState=function(fi){return this._stateHi.set(fi.stateHi),this._stateLo.set(fi.stateLo),this._bufferLength=fi.bufferLength,fi.buffer&&this._buffer.set(fi.buffer),this._bytesHashed=fi.bytesHashed,this._finished=!1,this},si.prototype.cleanSavedState=function(fi){H.wipe(fi.stateHi),H.wipe(fi.stateLo),fi.buffer&&H.wipe(fi.buffer),fi.bufferLength=0,fi.bytesHashed=0},si}();G.SHA512=Y;var Ne=new Int32Array([1116352408,3609767458,1899447441,602891725,3049323471,3964484399,3921009573,2173295548,961987163,4081628472,1508970993,3053834265,2453635748,2937671579,2870763221,3664609560,3624381080,2734883394,310598401,1164996542,607225278,1323610764,1426881987,3590304994,1925078388,4068182383,2162078206,991336113,2614888103,633803317,3248222580,3479774868,3835390401,2666613458,4022224774,944711139,264347078,2341262773,604807628,2007800933,770255983,1495990901,1249150122,1856431235,1555081692,3175218132,1996064986,2198950837,2554220882,3999719339,2821834349,766784016,2952996808,2566594879,3210313671,3203337956,3336571891,1034457026,3584528711,2466948901,113926993,3758326383,338241895,168717936,666307205,1188179964,773529912,1546045734,1294757372,1522805485,1396182291,2643833823,1695183700,2343527390,1986661051,1014477480,2177026350,1206759142,2456956037,344077627,2730485921,1290863460,2820302411,3158454273,3259730800,3505952657,3345764771,106217008,3516065817,3606008344,3600352804,1432725776,4094571909,1467031594,275423344,851169720,430227734,3100823752,506948616,1363258195,659060556,3750685593,883997877,3785050280,958139571,3318307427,1322822218,3812723403,1537002063,2003034995,1747873779,3602036899,1955562222,1575990012,2024104815,1125592928,2227730452,2716904306,2361852424,442776044,2428436474,593698344,2756734187,3733110249,3204031479,2999351573,3329325298,3815920427,3391569614,3928383900,3515267271,566280711,3940187606,3454069534,4118630271,4000239992,116418474,1914138554,174292421,2731055270,289380356,3203993006,460393269,320620315,685471733,587496836,852142971,1086792851,1017036298,365543100,1126000580,2618297676,1288033470,3409855158,1501505948,4234509866,1607167915,987167468,1816402316,1246189591]);function W(si,fi,ai,ti,hi,ci,ui){for(var li=ai[0],mi=ai[1],hn=ai[2],ln=ai[3],fn=ai[4],gn=ai[5],cn=ai[6],An=ai[7],Cn=ti[0],an=ti[1],Rn=ti[2],Ya=ti[3],Ho=ti[4],oi=ti[5],t=ti[6],F=ti[7],Ie,Te,Xr,ei,ii,Wr,R,Le;ui>=128;){for(var nn=0;nn<16;nn++){var vn=8*nn+ci;si[nn]=e.readUint32BE(hi,vn),fi[nn]=e.readUint32BE(hi,vn+4)}for(var nn=0;nn<80;nn++){var Mn=li,sn=mi,Zn=hn,on=ln,pn=fn,mn=gn,$i=cn,ho=An,Do=Cn,To=an,Oh=Rn,Fo=Ya,Vo=Ho,Hh=oi,Ah=t,Qf=F;if(Ie=An,Te=F,ii=Te&65535,Wr=Te>>>16,R=Ie&65535,Le=Ie>>>16,Ie=(fn>>>14|Ho<<18)^(fn>>>18|Ho<<14)^(Ho>>>9|fn<<23),Te=(Ho>>>14|fn<<18)^(Ho>>>18|fn<<14)^(fn>>>9|Ho<<23),ii+=Te&65535,Wr+=Te>>>16,R+=Ie&65535,Le+=Ie>>>16,Ie=fn&gn^~fn&cn,Te=Ho&oi^~Ho&t,ii+=Te&65535,Wr+=Te>>>16,R+=Ie&65535,Le+=Ie>>>16,Ie=Ne[nn*2],Te=Ne[nn*2+1],ii+=Te&65535,Wr+=Te>>>16,R+=Ie&65535,Le+=Ie>>>16,Ie=si[nn%16],Te=fi[nn%16],ii+=Te&65535,Wr+=Te>>>16,R+=Ie&65535,Le+=Ie>>>16,Wr+=ii>>>16,R+=Wr>>>16,Le+=R>>>16,Xr=R&65535|Le<<16,ei=ii&65535|Wr<<16,Ie=Xr,Te=ei,ii=Te&65535,Wr=Te>>>16,R=Ie&65535,Le=Ie>>>16,Ie=(li>>>28|Cn<<4)^(Cn>>>2|li<<30)^(Cn>>>7|li<<25),Te=(Cn>>>28|li<<4)^(li>>>2|Cn<<30)^(li>>>7|Cn<<25),ii+=Te&65535,Wr+=Te>>>16,R+=Ie&65535,Le+=Ie>>>16,Ie=li&mi^li&hn^mi&hn,Te=Cn&an^Cn&Rn^an&Rn,ii+=Te&65535,Wr+=Te>>>16,R+=Ie&65535,Le+=Ie>>>16,Wr+=ii>>>16,R+=Wr>>>16,Le+=R>>>16,ho=R&65535|Le<<16,Qf=ii&65535|Wr<<16,Ie=on,Te=Fo,ii=Te&65535,Wr=Te>>>16,R=Ie&65535,Le=Ie>>>16,Ie=Xr,Te=ei,ii+=Te&65535,Wr+=Te>>>16,R+=Ie&65535,Le+=Ie>>>16,Wr+=ii>>>16,R+=Wr>>>16,Le+=R>>>16,on=R&65535|Le<<16,Fo=ii&65535|Wr<<16,mi=Mn,hn=sn,ln=Zn,fn=on,gn=pn,cn=mn,An=$i,li=ho,an=Do,Rn=To,Ya=Oh,Ho=Fo,oi=Vo,t=Hh,F=Ah,Cn=Qf,nn%16===15)for(var vn=0;vn<16;vn++)Ie=si[vn],Te=fi[vn],ii=Te&65535,Wr=Te>>>16,R=Ie&65535,Le=Ie>>>16,Ie=si[(vn+9)%16],Te=fi[(vn+9)%16],ii+=Te&65535,Wr+=Te>>>16,R+=Ie&65535,Le+=Ie>>>16,Xr=si[(vn+1)%16],ei=fi[(vn+1)%16],Ie=(Xr>>>1|ei<<31)^(Xr>>>8|ei<<24)^Xr>>>7,Te=(ei>>>1|Xr<<31)^(ei>>>8|Xr<<24)^(ei>>>7|Xr<<25),ii+=Te&65535,Wr+=Te>>>16,R+=Ie&65535,Le+=Ie>>>16,Xr=si[(vn+14)%16],ei=fi[(vn+14)%16],Ie=(Xr>>>19|ei<<13)^(ei>>>29|Xr<<3)^Xr>>>6,Te=(ei>>>19|Xr<<13)^(Xr>>>29|ei<<3)^(ei>>>6|Xr<<26),ii+=Te&65535,Wr+=Te>>>16,R+=Ie&65535,Le+=Ie>>>16,Wr+=ii>>>16,R+=Wr>>>16,Le+=R>>>16,si[vn]=R&65535|Le<<16,fi[vn]=ii&65535|Wr<<16}Ie=li,Te=Cn,ii=Te&65535,Wr=Te>>>16,R=Ie&65535,Le=Ie>>>16,Ie=ai[0],Te=ti[0],ii+=Te&65535,Wr+=Te>>>16,R+=Ie&65535,Le+=Ie>>>16,Wr+=ii>>>16,R+=Wr>>>16,Le+=R>>>16,ai[0]=li=R&65535|Le<<16,ti[0]=Cn=ii&65535|Wr<<16,Ie=mi,Te=an,ii=Te&65535,Wr=Te>>>16,R=Ie&65535,Le=Ie>>>16,Ie=ai[1],Te=ti[1],ii+=Te&65535,Wr+=Te>>>16,R+=Ie&65535,Le+=Ie>>>16,Wr+=ii>>>16,R+=Wr>>>16,Le+=R>>>16,ai[1]=mi=R&65535|Le<<16,ti[1]=an=ii&65535|Wr<<16,Ie=hn,Te=Rn,ii=Te&65535,Wr=Te>>>16,R=Ie&65535,Le=Ie>>>16,Ie=ai[2],Te=ti[2],ii+=Te&65535,Wr+=Te>>>16,R+=Ie&65535,Le+=Ie>>>16,Wr+=ii>>>16,R+=Wr>>>16,Le+=R>>>16,ai[2]=hn=R&65535|Le<<16,ti[2]=Rn=ii&65535|Wr<<16,Ie=ln,Te=Ya,ii=Te&65535,Wr=Te>>>16,R=Ie&65535,Le=Ie>>>16,Ie=ai[3],Te=ti[3],ii+=Te&65535,Wr+=Te>>>16,R+=Ie&65535,Le+=Ie>>>16,Wr+=ii>>>16,R+=Wr>>>16,Le+=R>>>16,ai[3]=ln=R&65535|Le<<16,ti[3]=Ya=ii&65535|Wr<<16,Ie=fn,Te=Ho,ii=Te&65535,Wr=Te>>>16,R=Ie&65535,Le=Ie>>>16,Ie=ai[4],Te=ti[4],ii+=Te&65535,Wr+=Te>>>16,R+=Ie&65535,Le+=Ie>>>16,Wr+=ii>>>16,R+=Wr>>>16,Le+=R>>>16,ai[4]=fn=R&65535|Le<<16,ti[4]=Ho=ii&65535|Wr<<16,Ie=gn,Te=oi,ii=Te&65535,Wr=Te>>>16,R=Ie&65535,Le=Ie>>>16,Ie=ai[5],Te=ti[5],ii+=Te&65535,Wr+=Te>>>16,R+=Ie&65535,Le+=Ie>>>16,Wr+=ii>>>16,R+=Wr>>>16,Le+=R>>>16,ai[5]=gn=R&65535|Le<<16,ti[5]=oi=ii&65535|Wr<<16,Ie=cn,Te=t,ii=Te&65535,Wr=Te>>>16,R=Ie&65535,Le=Ie>>>16,Ie=ai[6],Te=ti[6],ii+=Te&65535,Wr+=Te>>>16,R+=Ie&65535,Le+=Ie>>>16,Wr+=ii>>>16,R+=Wr>>>16,Le+=R>>>16,ai[6]=cn=R&65535|Le<<16,ti[6]=t=ii&65535|Wr<<16,Ie=An,Te=F,ii=Te&65535,Wr=Te>>>16,R=Ie&65535,Le=Ie>>>16,Ie=ai[7],Te=ti[7],ii+=Te&65535,Wr+=Te>>>16,R+=Ie&65535,Le+=Ie>>>16,Wr+=ii>>>16,R+=Wr>>>16,Le+=R>>>16,ai[7]=An=R&65535|Le<<16,ti[7]=F=ii&65535|Wr<<16,ci+=128,ui-=128}return ci}function ri(si){var fi=new Y;fi.update(si);var ai=fi.digest();return fi.clean(),ai}G.hash=ri})(sha512);(function(G){Object.defineProperty(G,"__esModule",{value:!0}),G.convertSecretKeyToX25519=G.convertPublicKeyToX25519=G.verify=G.sign=G.extractPublicKeyFromSecretKey=G.generateKeyPair=G.generateKeyPairFromSeed=G.SEED_LENGTH=G.SECRET_KEY_LENGTH=G.PUBLIC_KEY_LENGTH=G.SIGNATURE_LENGTH=void 0;const e=random,H=sha512,Y=wipe$1;G.SIGNATURE_LENGTH=64,G.PUBLIC_KEY_LENGTH=32,G.SECRET_KEY_LENGTH=64,G.SEED_LENGTH=32;function Ne(on){const pn=new Float64Array(16);if(on)for(let mn=0;mn>16&1),mn[To-1]&=65535;mn[15]=$i[15]-32767-(mn[14]>>16&1);const Do=mn[15]>>16&1;mn[14]&=65535,mi($i,mn,1-Do)}for(let ho=0;ho<16;ho++)on[2*ho]=$i[ho]&255,on[2*ho+1]=$i[ho]>>8}function ln(on,pn){let mn=0;for(let $i=0;$i<32;$i++)mn|=on[$i]^pn[$i];return(1&mn-1>>>8)-1}function fn(on,pn){const mn=new Uint8Array(32),$i=new Uint8Array(32);return hn(mn,on),hn($i,pn),ln(mn,$i)}function gn(on){const pn=new Uint8Array(32);return hn(pn,on),pn[0]&1}function cn(on,pn){for(let mn=0;mn<16;mn++)on[mn]=pn[2*mn]+(pn[2*mn+1]<<8);on[15]&=32767}function An(on,pn,mn){for(let $i=0;$i<16;$i++)on[$i]=pn[$i]+mn[$i]}function Cn(on,pn,mn){for(let $i=0;$i<16;$i++)on[$i]=pn[$i]-mn[$i]}function an(on,pn,mn){let $i,ho,Do=0,To=0,Oh=0,Fo=0,Vo=0,Hh=0,Ah=0,Qf=0,Gh=0,tf=0,Ko=0,Kh=0,Lf=0,Uo=0,Vh=0,jf=0,Zo=0,Wh=0,vh=0,Yo=0,Jh=0,xh=0,Vf=0,Zh=0,Ch=0,Eh=0,Lu=0,Ph=0,Sh=0,Uu=0,Th=0,gh=mn[0],Xh=mn[1],Rh=mn[2],bh=mn[3],au=mn[4],$h=mn[5],wh=mn[6],qu=mn[7],Ih=mn[8],_h=mn[9],uu=mn[10],Dh=mn[11],yh=mn[12],Yh=mn[13],Bh=mn[14],Mh=mn[15];$i=pn[0],Do+=$i*gh,To+=$i*Xh,Oh+=$i*Rh,Fo+=$i*bh,Vo+=$i*au,Hh+=$i*$h,Ah+=$i*wh,Qf+=$i*qu,Gh+=$i*Ih,tf+=$i*_h,Ko+=$i*uu,Kh+=$i*Dh,Lf+=$i*yh,Uo+=$i*Yh,Vh+=$i*Bh,jf+=$i*Mh,$i=pn[1],To+=$i*gh,Oh+=$i*Xh,Fo+=$i*Rh,Vo+=$i*bh,Hh+=$i*au,Ah+=$i*$h,Qf+=$i*wh,Gh+=$i*qu,tf+=$i*Ih,Ko+=$i*_h,Kh+=$i*uu,Lf+=$i*Dh,Uo+=$i*yh,Vh+=$i*Yh,jf+=$i*Bh,Zo+=$i*Mh,$i=pn[2],Oh+=$i*gh,Fo+=$i*Xh,Vo+=$i*Rh,Hh+=$i*bh,Ah+=$i*au,Qf+=$i*$h,Gh+=$i*wh,tf+=$i*qu,Ko+=$i*Ih,Kh+=$i*_h,Lf+=$i*uu,Uo+=$i*Dh,Vh+=$i*yh,jf+=$i*Yh,Zo+=$i*Bh,Wh+=$i*Mh,$i=pn[3],Fo+=$i*gh,Vo+=$i*Xh,Hh+=$i*Rh,Ah+=$i*bh,Qf+=$i*au,Gh+=$i*$h,tf+=$i*wh,Ko+=$i*qu,Kh+=$i*Ih,Lf+=$i*_h,Uo+=$i*uu,Vh+=$i*Dh,jf+=$i*yh,Zo+=$i*Yh,Wh+=$i*Bh,vh+=$i*Mh,$i=pn[4],Vo+=$i*gh,Hh+=$i*Xh,Ah+=$i*Rh,Qf+=$i*bh,Gh+=$i*au,tf+=$i*$h,Ko+=$i*wh,Kh+=$i*qu,Lf+=$i*Ih,Uo+=$i*_h,Vh+=$i*uu,jf+=$i*Dh,Zo+=$i*yh,Wh+=$i*Yh,vh+=$i*Bh,Yo+=$i*Mh,$i=pn[5],Hh+=$i*gh,Ah+=$i*Xh,Qf+=$i*Rh,Gh+=$i*bh,tf+=$i*au,Ko+=$i*$h,Kh+=$i*wh,Lf+=$i*qu,Uo+=$i*Ih,Vh+=$i*_h,jf+=$i*uu,Zo+=$i*Dh,Wh+=$i*yh,vh+=$i*Yh,Yo+=$i*Bh,Jh+=$i*Mh,$i=pn[6],Ah+=$i*gh,Qf+=$i*Xh,Gh+=$i*Rh,tf+=$i*bh,Ko+=$i*au,Kh+=$i*$h,Lf+=$i*wh,Uo+=$i*qu,Vh+=$i*Ih,jf+=$i*_h,Zo+=$i*uu,Wh+=$i*Dh,vh+=$i*yh,Yo+=$i*Yh,Jh+=$i*Bh,xh+=$i*Mh,$i=pn[7],Qf+=$i*gh,Gh+=$i*Xh,tf+=$i*Rh,Ko+=$i*bh,Kh+=$i*au,Lf+=$i*$h,Uo+=$i*wh,Vh+=$i*qu,jf+=$i*Ih,Zo+=$i*_h,Wh+=$i*uu,vh+=$i*Dh,Yo+=$i*yh,Jh+=$i*Yh,xh+=$i*Bh,Vf+=$i*Mh,$i=pn[8],Gh+=$i*gh,tf+=$i*Xh,Ko+=$i*Rh,Kh+=$i*bh,Lf+=$i*au,Uo+=$i*$h,Vh+=$i*wh,jf+=$i*qu,Zo+=$i*Ih,Wh+=$i*_h,vh+=$i*uu,Yo+=$i*Dh,Jh+=$i*yh,xh+=$i*Yh,Vf+=$i*Bh,Zh+=$i*Mh,$i=pn[9],tf+=$i*gh,Ko+=$i*Xh,Kh+=$i*Rh,Lf+=$i*bh,Uo+=$i*au,Vh+=$i*$h,jf+=$i*wh,Zo+=$i*qu,Wh+=$i*Ih,vh+=$i*_h,Yo+=$i*uu,Jh+=$i*Dh,xh+=$i*yh,Vf+=$i*Yh,Zh+=$i*Bh,Ch+=$i*Mh,$i=pn[10],Ko+=$i*gh,Kh+=$i*Xh,Lf+=$i*Rh,Uo+=$i*bh,Vh+=$i*au,jf+=$i*$h,Zo+=$i*wh,Wh+=$i*qu,vh+=$i*Ih,Yo+=$i*_h,Jh+=$i*uu,xh+=$i*Dh,Vf+=$i*yh,Zh+=$i*Yh,Ch+=$i*Bh,Eh+=$i*Mh,$i=pn[11],Kh+=$i*gh,Lf+=$i*Xh,Uo+=$i*Rh,Vh+=$i*bh,jf+=$i*au,Zo+=$i*$h,Wh+=$i*wh,vh+=$i*qu,Yo+=$i*Ih,Jh+=$i*_h,xh+=$i*uu,Vf+=$i*Dh,Zh+=$i*yh,Ch+=$i*Yh,Eh+=$i*Bh,Lu+=$i*Mh,$i=pn[12],Lf+=$i*gh,Uo+=$i*Xh,Vh+=$i*Rh,jf+=$i*bh,Zo+=$i*au,Wh+=$i*$h,vh+=$i*wh,Yo+=$i*qu,Jh+=$i*Ih,xh+=$i*_h,Vf+=$i*uu,Zh+=$i*Dh,Ch+=$i*yh,Eh+=$i*Yh,Lu+=$i*Bh,Ph+=$i*Mh,$i=pn[13],Uo+=$i*gh,Vh+=$i*Xh,jf+=$i*Rh,Zo+=$i*bh,Wh+=$i*au,vh+=$i*$h,Yo+=$i*wh,Jh+=$i*qu,xh+=$i*Ih,Vf+=$i*_h,Zh+=$i*uu,Ch+=$i*Dh,Eh+=$i*yh,Lu+=$i*Yh,Ph+=$i*Bh,Sh+=$i*Mh,$i=pn[14],Vh+=$i*gh,jf+=$i*Xh,Zo+=$i*Rh,Wh+=$i*bh,vh+=$i*au,Yo+=$i*$h,Jh+=$i*wh,xh+=$i*qu,Vf+=$i*Ih,Zh+=$i*_h,Ch+=$i*uu,Eh+=$i*Dh,Lu+=$i*yh,Ph+=$i*Yh,Sh+=$i*Bh,Uu+=$i*Mh,$i=pn[15],jf+=$i*gh,Zo+=$i*Xh,Wh+=$i*Rh,vh+=$i*bh,Yo+=$i*au,Jh+=$i*$h,xh+=$i*wh,Vf+=$i*qu,Zh+=$i*Ih,Ch+=$i*_h,Eh+=$i*uu,Lu+=$i*Dh,Ph+=$i*yh,Sh+=$i*Yh,Uu+=$i*Bh,Th+=$i*Mh,Do+=38*Zo,To+=38*Wh,Oh+=38*vh,Fo+=38*Yo,Vo+=38*Jh,Hh+=38*xh,Ah+=38*Vf,Qf+=38*Zh,Gh+=38*Ch,tf+=38*Eh,Ko+=38*Lu,Kh+=38*Ph,Lf+=38*Sh,Uo+=38*Uu,Vh+=38*Th,ho=1,$i=Do+ho+65535,ho=Math.floor($i/65536),Do=$i-ho*65536,$i=To+ho+65535,ho=Math.floor($i/65536),To=$i-ho*65536,$i=Oh+ho+65535,ho=Math.floor($i/65536),Oh=$i-ho*65536,$i=Fo+ho+65535,ho=Math.floor($i/65536),Fo=$i-ho*65536,$i=Vo+ho+65535,ho=Math.floor($i/65536),Vo=$i-ho*65536,$i=Hh+ho+65535,ho=Math.floor($i/65536),Hh=$i-ho*65536,$i=Ah+ho+65535,ho=Math.floor($i/65536),Ah=$i-ho*65536,$i=Qf+ho+65535,ho=Math.floor($i/65536),Qf=$i-ho*65536,$i=Gh+ho+65535,ho=Math.floor($i/65536),Gh=$i-ho*65536,$i=tf+ho+65535,ho=Math.floor($i/65536),tf=$i-ho*65536,$i=Ko+ho+65535,ho=Math.floor($i/65536),Ko=$i-ho*65536,$i=Kh+ho+65535,ho=Math.floor($i/65536),Kh=$i-ho*65536,$i=Lf+ho+65535,ho=Math.floor($i/65536),Lf=$i-ho*65536,$i=Uo+ho+65535,ho=Math.floor($i/65536),Uo=$i-ho*65536,$i=Vh+ho+65535,ho=Math.floor($i/65536),Vh=$i-ho*65536,$i=jf+ho+65535,ho=Math.floor($i/65536),jf=$i-ho*65536,Do+=ho-1+37*(ho-1),ho=1,$i=Do+ho+65535,ho=Math.floor($i/65536),Do=$i-ho*65536,$i=To+ho+65535,ho=Math.floor($i/65536),To=$i-ho*65536,$i=Oh+ho+65535,ho=Math.floor($i/65536),Oh=$i-ho*65536,$i=Fo+ho+65535,ho=Math.floor($i/65536),Fo=$i-ho*65536,$i=Vo+ho+65535,ho=Math.floor($i/65536),Vo=$i-ho*65536,$i=Hh+ho+65535,ho=Math.floor($i/65536),Hh=$i-ho*65536,$i=Ah+ho+65535,ho=Math.floor($i/65536),Ah=$i-ho*65536,$i=Qf+ho+65535,ho=Math.floor($i/65536),Qf=$i-ho*65536,$i=Gh+ho+65535,ho=Math.floor($i/65536),Gh=$i-ho*65536,$i=tf+ho+65535,ho=Math.floor($i/65536),tf=$i-ho*65536,$i=Ko+ho+65535,ho=Math.floor($i/65536),Ko=$i-ho*65536,$i=Kh+ho+65535,ho=Math.floor($i/65536),Kh=$i-ho*65536,$i=Lf+ho+65535,ho=Math.floor($i/65536),Lf=$i-ho*65536,$i=Uo+ho+65535,ho=Math.floor($i/65536),Uo=$i-ho*65536,$i=Vh+ho+65535,ho=Math.floor($i/65536),Vh=$i-ho*65536,$i=jf+ho+65535,ho=Math.floor($i/65536),jf=$i-ho*65536,Do+=ho-1+37*(ho-1),on[0]=Do,on[1]=To,on[2]=Oh,on[3]=Fo,on[4]=Vo,on[5]=Hh,on[6]=Ah,on[7]=Qf,on[8]=Gh,on[9]=tf,on[10]=Ko,on[11]=Kh,on[12]=Lf,on[13]=Uo,on[14]=Vh,on[15]=jf}function Rn(on,pn){an(on,pn,pn)}function Ya(on,pn){const mn=Ne();let $i;for($i=0;$i<16;$i++)mn[$i]=pn[$i];for($i=253;$i>=0;$i--)Rn(mn,mn),$i!==2&&$i!==4&&an(mn,mn,pn);for($i=0;$i<16;$i++)on[$i]=mn[$i]}function Ho(on,pn){const mn=Ne();let $i;for($i=0;$i<16;$i++)mn[$i]=pn[$i];for($i=250;$i>=0;$i--)Rn(mn,mn),$i!==1&&an(mn,mn,pn);for($i=0;$i<16;$i++)on[$i]=mn[$i]}function oi(on,pn){const mn=Ne(),$i=Ne(),ho=Ne(),Do=Ne(),To=Ne(),Oh=Ne(),Fo=Ne(),Vo=Ne(),Hh=Ne();Cn(mn,on[1],on[0]),Cn(Hh,pn[1],pn[0]),an(mn,mn,Hh),An($i,on[0],on[1]),An(Hh,pn[0],pn[1]),an($i,$i,Hh),an(ho,on[3],pn[3]),an(ho,ho,ai),an(Do,on[2],pn[2]),An(Do,Do,Do),Cn(To,$i,mn),Cn(Oh,Do,ho),An(Fo,Do,ho),An(Vo,$i,mn),an(on[0],To,Oh),an(on[1],Vo,Fo),an(on[2],Fo,Oh),an(on[3],To,Vo)}function t(on,pn,mn){for(let $i=0;$i<4;$i++)mi(on[$i],pn[$i],mn)}function F(on,pn){const mn=Ne(),$i=Ne(),ho=Ne();Ya(ho,pn[2]),an(mn,pn[0],ho),an($i,pn[1],ho),hn(on,$i),on[31]^=gn(mn)<<7}function Ie(on,pn,mn){ui(on[0],ri),ui(on[1],si),ui(on[2],si),ui(on[3],ri);for(let $i=255;$i>=0;--$i){const ho=mn[$i/8|0]>>($i&7)&1;t(on,pn,ho),oi(pn,on),oi(on,on),t(on,pn,ho)}}function Te(on,pn){const mn=[Ne(),Ne(),Ne(),Ne()];ui(mn[0],ti),ui(mn[1],hi),ui(mn[2],si),an(mn[3],ti,hi),Ie(on,mn,pn)}function Xr(on){if(on.length!==G.SEED_LENGTH)throw new Error(`ed25519: seed must be ${G.SEED_LENGTH} bytes`);const pn=(0,H.hash)(on);pn[0]&=248,pn[31]&=127,pn[31]|=64;const mn=new Uint8Array(32),$i=[Ne(),Ne(),Ne(),Ne()];Te($i,pn),F(mn,$i);const ho=new Uint8Array(64);return ho.set(on),ho.set(mn,32),{publicKey:mn,secretKey:ho}}G.generateKeyPairFromSeed=Xr;function ei(on){const pn=(0,e.randomBytes)(32,on),mn=Xr(pn);return(0,Y.wipe)(pn),mn}G.generateKeyPair=ei;function ii(on){if(on.length!==G.SECRET_KEY_LENGTH)throw new Error(`ed25519: secret key must be ${G.SECRET_KEY_LENGTH} bytes`);return new Uint8Array(on.subarray(32))}G.extractPublicKeyFromSecretKey=ii;const Wr=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]);function R(on,pn){let mn,$i,ho,Do;for($i=63;$i>=32;--$i){for(mn=0,ho=$i-32,Do=$i-12;ho>4)*Wr[ho],mn=pn[ho]>>8,pn[ho]&=255;for(ho=0;ho<32;ho++)pn[ho]-=mn*Wr[ho];for($i=0;$i<32;$i++)pn[$i+1]+=pn[$i]>>8,on[$i]=pn[$i]&255}function Le(on){const pn=new Float64Array(64);for(let mn=0;mn<64;mn++)pn[mn]=on[mn];for(let mn=0;mn<64;mn++)on[mn]=0;R(on,pn)}function nn(on,pn){const mn=new Float64Array(64),$i=[Ne(),Ne(),Ne(),Ne()],ho=(0,H.hash)(on.subarray(0,32));ho[0]&=248,ho[31]&=127,ho[31]|=64;const Do=new Uint8Array(64);Do.set(ho.subarray(32),32);const To=new H.SHA512;To.update(Do.subarray(32)),To.update(pn);const Oh=To.digest();To.clean(),Le(Oh),Te($i,Oh),F(Do,$i),To.reset(),To.update(Do.subarray(0,32)),To.update(on.subarray(32)),To.update(pn);const Fo=To.digest();Le(Fo);for(let Vo=0;Vo<32;Vo++)mn[Vo]=Oh[Vo];for(let Vo=0;Vo<32;Vo++)for(let Hh=0;Hh<32;Hh++)mn[Vo+Hh]+=Fo[Vo]*ho[Hh];return R(Do.subarray(32),mn),Do}G.sign=nn;function vn(on,pn){const mn=Ne(),$i=Ne(),ho=Ne(),Do=Ne(),To=Ne(),Oh=Ne(),Fo=Ne();return ui(on[2],si),cn(on[1],pn),Rn(ho,on[1]),an(Do,ho,fi),Cn(ho,ho,on[2]),An(Do,on[2],Do),Rn(To,Do),Rn(Oh,To),an(Fo,Oh,To),an(mn,Fo,ho),an(mn,mn,Do),Ho(mn,mn),an(mn,mn,ho),an(mn,mn,Do),an(mn,mn,Do),an(on[0],mn,Do),Rn($i,on[0]),an($i,$i,Do),fn($i,ho)&&an(on[0],on[0],ci),Rn($i,on[0]),an($i,$i,Do),fn($i,ho)?-1:(gn(on[0])===pn[31]>>7&&Cn(on[0],ri,on[0]),an(on[3],on[0],on[1]),0)}function Mn(on,pn,mn){const $i=new Uint8Array(32),ho=[Ne(),Ne(),Ne(),Ne()],Do=[Ne(),Ne(),Ne(),Ne()];if(mn.length!==G.SIGNATURE_LENGTH)throw new Error(`ed25519: signature must be ${G.SIGNATURE_LENGTH} bytes`);if(vn(Do,on))return!1;const To=new H.SHA512;To.update(mn.subarray(0,32)),To.update(on),To.update(pn);const Oh=To.digest();return Le(Oh),Ie(ho,Do,Oh),Te(Do,mn.subarray(32)),oi(ho,Do),F($i,ho),!ln(mn,$i)}G.verify=Mn;function sn(on){let pn=[Ne(),Ne(),Ne(),Ne()];if(vn(pn,on))throw new Error("Ed25519: invalid public key");let mn=Ne(),$i=Ne(),ho=pn[1];An(mn,si,ho),Cn($i,si,ho),Ya($i,$i),an(mn,mn,$i);let Do=new Uint8Array(32);return hn(Do,mn),Do}G.convertPublicKeyToX25519=sn;function Zn(on){const pn=(0,H.hash)(on.subarray(0,32));pn[0]&=248,pn[31]&=127,pn[31]|=64;const mn=new Uint8Array(pn.subarray(0,32));return(0,Y.wipe)(pn),mn}G.convertSecretKeyToX25519=Zn})(ed25519);const JWT_IRIDIUM_ALG="EdDSA",JWT_IRIDIUM_TYP="JWT",JWT_DELIMITER=".",JWT_ENCODING="base64url",JSON_ENCODING="utf8",DATA_ENCODING="utf8",DID_DELIMITER=":",DID_PREFIX="did",DID_METHOD="key",MULTICODEC_ED25519_ENCODING="base58btc",MULTICODEC_ED25519_BASE="z",MULTICODEC_ED25519_HEADER="K36",KEY_PAIR_SEED_LENGTH=32;function asUint8Array(G){return globalThis.Buffer!=null?new Uint8Array(G.buffer,G.byteOffset,G.byteLength):G}function allocUnsafe(G=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?asUint8Array(globalThis.Buffer.allocUnsafe(G)):new Uint8Array(G)}function concat(G,e){e||(e=G.reduce((Ne,W)=>Ne+W.length,0));const H=allocUnsafe(e);let Y=0;for(const Ne of G)H.set(Ne,Y),Y+=Ne.length;return asUint8Array(H)}function createCodec(G,e,H,Y){return{name:G,prefix:e,encoder:{name:G,prefix:e,encode:H},decoder:{decode:Y}}}const string=createCodec("utf8","u",G=>"u"+new TextDecoder("utf8").decode(G),G=>new TextEncoder().encode(G.substring(1))),ascii=createCodec("ascii","a",G=>{let e="a";for(let H=0;H{G=G.substring(1);const e=allocUnsafe(G.length);for(let H=0;HH.code===G);return e||STANDARD_ERROR_MAP[DEFAULT_ERROR]}function parseConnectionError(G,e,H){return G.message.includes("getaddrinfo ENOTFOUND")||G.message.includes("connect ECONNREFUSED")?new Error(`Unavailable ${H} RPC url at ${e}`):G}var cjs={},crypto$1={},hasRequiredCrypto;function requireCrypto(){if(hasRequiredCrypto)return crypto$1;hasRequiredCrypto=1,Object.defineProperty(crypto$1,"__esModule",{value:!0}),crypto$1.isBrowserCryptoAvailable=crypto$1.getSubtleCrypto=crypto$1.getBrowerCrypto=void 0;function G(){return(commonjsGlobal===null||commonjsGlobal===void 0?void 0:commonjsGlobal.crypto)||(commonjsGlobal===null||commonjsGlobal===void 0?void 0:commonjsGlobal.msCrypto)||{}}crypto$1.getBrowerCrypto=G;function e(){const Y=G();return Y.subtle||Y.webkitSubtle}crypto$1.getSubtleCrypto=e;function H(){return!!G()&&!!e()}return crypto$1.isBrowserCryptoAvailable=H,crypto$1}var env={},hasRequiredEnv;function requireEnv(){if(hasRequiredEnv)return env;hasRequiredEnv=1,Object.defineProperty(env,"__esModule",{value:!0}),env.isBrowser=env.isNode=env.isReactNative=void 0;function G(){return typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"}env.isReactNative=G;function e(){return typeof process$1<"u"&&typeof process$1.versions<"u"&&typeof process$1.versions.node<"u"}env.isNode=e;function H(){return!G()&&!e()}return env.isBrowser=H,env}(function(G){Object.defineProperty(G,"__esModule",{value:!0});const e=require$$0$2;e.__exportStar(requireCrypto(),G),e.__exportStar(requireEnv(),G)})(cjs);function payloadId(G=3){const e=Date.now()*Math.pow(10,G),H=Math.floor(Math.random()*Math.pow(10,G));return e+H}function getBigIntRpcId(G=6){return BigInt(payloadId(G))}function formatJsonRpcRequest(G,e,H){return{id:H||payloadId(),jsonrpc:"2.0",method:G,params:e}}function formatJsonRpcResult(G,e){return{id:G,jsonrpc:"2.0",result:e}}function formatJsonRpcError(G,e,H){return{id:G,jsonrpc:"2.0",error:formatErrorMessage(e,H)}}function formatErrorMessage(G,e){return typeof G>"u"?getError(INTERNAL_ERROR):(typeof G=="string"&&(G=Object.assign(Object.assign({},getError(SERVER_ERROR)),{message:G})),typeof e<"u"&&(G.data=e),isReservedErrorCode(G.code)&&(G=getErrorByCode(G.code)),G)}class IEvents{}class IBaseJsonRpcProvider extends IEvents{constructor(){super()}}class IJsonRpcProvider extends IBaseJsonRpcProvider{constructor(e){super()}}const HTTP_REGEX="^https?:",WS_REGEX="^wss?:";function getUrlProtocol(G){const e=G.match(new RegExp(/^\w+:/,"gi"));if(!(!e||!e.length))return e[0]}function matchRegexProtocol(G,e){const H=getUrlProtocol(G);return typeof H>"u"?!1:new RegExp(e).test(H)}function isHttpUrl(G){return matchRegexProtocol(G,HTTP_REGEX)}function isWsUrl(G){return matchRegexProtocol(G,WS_REGEX)}function isLocalhostUrl(G){return new RegExp("wss?://localhost(:d{2,5})?").test(G)}function isJsonRpcPayload(G){return typeof G=="object"&&"id"in G&&"jsonrpc"in G&&G.jsonrpc==="2.0"}function isJsonRpcRequest(G){return isJsonRpcPayload(G)&&"method"in G}function isJsonRpcResponse(G){return isJsonRpcPayload(G)&&(isJsonRpcResult(G)||isJsonRpcError(G))}function isJsonRpcResult(G){return"result"in G}function isJsonRpcError(G){return"error"in G}let o$1=class extends IJsonRpcProvider{constructor(e){super(e),this.events=new eventsExports.EventEmitter,this.hasRegisteredEventListeners=!1,this.connection=this.setConnection(e),this.connection.connected&&this.registerEventListeners()}async connect(e=this.connection){await this.open(e)}async disconnect(){await this.close()}on(e,H){this.events.on(e,H)}once(e,H){this.events.once(e,H)}off(e,H){this.events.off(e,H)}removeListener(e,H){this.events.removeListener(e,H)}async request(e,H){return this.requestStrict(formatJsonRpcRequest(e.method,e.params||[],e.id||getBigIntRpcId().toString()),H)}async requestStrict(e,H){return new Promise(async(Y,Ne)=>{if(!this.connection.connected)try{await this.open()}catch(W){Ne(W)}this.events.on(`${e.id}`,W=>{isJsonRpcError(W)?Ne(W.error):Y(W.result)});try{await this.connection.send(e,H)}catch(W){Ne(W)}})}setConnection(e=this.connection){return e}onPayload(e){this.events.emit("payload",e),isJsonRpcResponse(e)?this.events.emit(`${e.id}`,e):this.events.emit("message",{type:e.method,data:e.params})}onClose(e){e&&e.code===3e3&&this.events.emit("error",new Error(`WebSocket connection closed abnormally with code: ${e.code} ${e.reason?`(${e.reason})`:""}`)),this.events.emit("disconnect")}async open(e=this.connection){this.connection===e&&this.connection.connected||(this.connection.connected&&this.close(),typeof e=="string"&&(await this.connection.open(e),e=this.connection),this.connection=this.setConnection(e),await this.connection.open(),this.registerEventListeners(),this.events.emit("connect"))}async close(){await this.connection.close()}registerEventListeners(){this.hasRegisteredEventListeners||(this.connection.on("payload",e=>this.onPayload(e)),this.connection.on("close",e=>this.onClose(e)),this.connection.on("error",e=>this.events.emit("error",e)),this.connection.on("register_error",e=>this.onClose()),this.hasRegisteredEventListeners=!0)}};const w$1=()=>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:require("ws"),b$1=()=>typeof WebSocket<"u"||typeof global<"u"&&typeof global.WebSocket<"u"||typeof window<"u"&&typeof window.WebSocket<"u"||typeof self<"u"&&typeof self.WebSocket<"u",a=G=>G.split("?")[0],h=10,S$2=w$1();let f$3=class{constructor(e){if(this.url=e,this.events=new eventsExports.EventEmitter,this.registering=!1,!isWsUrl(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,H){this.events.on(e,H)}once(e,H){this.events.once(e,H)}off(e,H){this.events.off(e,H)}removeListener(e,H){this.events.removeListener(e,H)}async open(e=this.url){await this.register(e)}async close(){return new Promise((e,H)=>{if(typeof this.socket>"u"){H(new Error("Connection already closed"));return}this.socket.onclose=Y=>{this.onClose(Y),e()},this.socket.close()})}async send(e){typeof this.socket>"u"&&(this.socket=await this.register());try{this.socket.send(safeJsonStringify(e))}catch(H){this.onError(e.id,H)}}register(e=this.url){if(!isWsUrl(e))throw new Error(`Provided URL is not compatible with WebSocket connection: ${e}`);if(this.registering){const H=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=H||this.events.listenerCount("open")>=H)&&this.events.setMaxListeners(H+1),new Promise((Y,Ne)=>{this.events.once("register_error",W=>{this.resetMaxListeners(),Ne(W)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.socket>"u")return Ne(new Error("WebSocket connection is missing or invalid"));Y(this.socket)})})}return this.url=e,this.registering=!0,new Promise((H,Y)=>{const Ne=new URLSearchParams(e).get("origin"),W=cjs.isReactNative()?{headers:{origin:Ne}}:{rejectUnauthorized:!isLocalhostUrl(e)},ri=new S$2(e,[],W);b$1()?ri.onerror=si=>{const fi=si;Y(this.emitError(fi.error))}:ri.on("error",si=>{Y(this.emitError(si))}),ri.onopen=()=>{this.onOpen(ri),H(ri)}})}onOpen(e){e.onmessage=H=>this.onPayload(H),e.onclose=H=>this.onClose(H),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 H=typeof e.data=="string"?safeJsonParse(e.data):e.data;this.events.emit("payload",H)}onError(e,H){const Y=this.parseError(H),Ne=Y.message||Y.toString(),W=formatJsonRpcError(e,Ne);this.events.emit("payload",W)}parseError(e,H=this.url){return parseConnectionError(e,a(H),"WS")}resetMaxListeners(){this.events.getMaxListeners()>h&&this.events.setMaxListeners(h)}emitError(e){const H=this.parseError(new Error((e==null?void 0:e.message)||`WebSocket connection failed for host: ${a(this.url)}`));return this.events.emit("register_error",H),H}};var lodash_isequal={exports:{}};lodash_isequal.exports;(function(G,e){var H=200,Y="__lodash_hash_undefined__",Ne=1,W=2,ri=9007199254740991,si="[object Arguments]",fi="[object Array]",ai="[object AsyncFunction]",ti="[object Boolean]",hi="[object Date]",ci="[object Error]",ui="[object Function]",li="[object GeneratorFunction]",mi="[object Map]",hn="[object Number]",ln="[object Null]",fn="[object Object]",gn="[object Promise]",cn="[object Proxy]",An="[object RegExp]",Cn="[object Set]",an="[object String]",Rn="[object Symbol]",Ya="[object Undefined]",Ho="[object WeakMap]",oi="[object ArrayBuffer]",t="[object DataView]",F="[object Float32Array]",Ie="[object Float64Array]",Te="[object Int8Array]",Xr="[object Int16Array]",ei="[object Int32Array]",ii="[object Uint8Array]",Wr="[object Uint8ClampedArray]",R="[object Uint16Array]",Le="[object Uint32Array]",nn=/[\\^$.*+?()[\]{}|]/g,vn=/^\[object .+?Constructor\]$/,Mn=/^(?:0|[1-9]\d*)$/,sn={};sn[F]=sn[Ie]=sn[Te]=sn[Xr]=sn[ei]=sn[ii]=sn[Wr]=sn[R]=sn[Le]=!0,sn[si]=sn[fi]=sn[oi]=sn[ti]=sn[t]=sn[hi]=sn[ci]=sn[ui]=sn[mi]=sn[hn]=sn[fn]=sn[An]=sn[Cn]=sn[an]=sn[Ho]=!1;var Zn=typeof commonjsGlobal=="object"&&commonjsGlobal&&commonjsGlobal.Object===Object&&commonjsGlobal,on=typeof self=="object"&&self&&self.Object===Object&&self,pn=Zn||on||Function("return this")(),mn=e&&!e.nodeType&&e,$i=mn&&!0&&G&&!G.nodeType&&G,ho=$i&&$i.exports===mn,Do=ho&&Zn.process,To=function(){try{return Do&&Do.binding&&Do.binding("util")}catch{}}(),Oh=To&&To.isTypedArray;function Fo(ko,Xf){for(var jh=-1,su=ko==null?0:ko.length,Ac=0,t0=[];++jh-1}function sc(ko,Xf){var jh=this.__data__,su=Wl(jh,ko);return su<0?(++this.size,jh.push([ko,Xf])):jh[su][1]=Xf,this}Tu.prototype.clear=tc,Tu.prototype.delete=rc,Tu.prototype.get=ic,Tu.prototype.has=nc,Tu.prototype.set=sc;function s0(ko){var Xf=-1,jh=ko==null?0:ko.length;for(this.clear();++XfTc))return!1;var Sc=t0.get(ko);if(Sc&&t0.get(Xf))return Sc==Xf;var Cc=-1,Qc=!0,Nc=jh&W?new cc:void 0;for(t0.set(ko,Xf),t0.set(Xf,ko);++Cc-1&&ko%1==0&&ko-1&&ko%1==0&&ko<=ri}function n1(ko){var Xf=typeof ko;return ko!=null&&(Xf=="object"||Xf=="function")}function Ql(ko){return ko!=null&&typeof ko=="object"}var s1=Oh?Qf(Oh):Gd;function Q1(ko){return J1(ko)?Kd(ko):Vd(ko)}function Ec(){return[]}function xc(){return!1}G.exports=Z1})(lodash_isequal,lodash_isequal.exports);var lodash_isequalExports=lodash_isequal.exports;const Gi=getDefaultExportFromCjs(lodash_isequalExports);function unfetch_module(G,e){return e=e||{},new Promise(function(H,Y){var Ne=new XMLHttpRequest,W=[],ri=[],si={},fi=function(){return{ok:(Ne.status/100|0)==2,statusText:Ne.statusText,status:Ne.status,url:Ne.responseURL,text:function(){return Promise.resolve(Ne.responseText)},json:function(){return Promise.resolve(Ne.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([Ne.response]))},clone:fi,headers:{keys:function(){return W},entries:function(){return ri},get:function(ti){return si[ti.toLowerCase()]},has:function(ti){return ti.toLowerCase()in si}}}};for(var ai in Ne.open(e.method||"get",G,!0),Ne.onload=function(){Ne.getAllResponseHeaders().replace(/^(.*?):[^\S\n]*([\s\S]*?)$/gm,function(ti,hi,ci){W.push(hi=hi.toLowerCase()),ri.push([hi,ci]),si[hi]=si[hi]?si[hi]+","+ci:ci}),H(fi())},Ne.onerror=Y,Ne.withCredentials=e.credentials=="include",e.headers)Ne.setRequestHeader(ai,e.headers[ai]);Ne.send(e.body||null)})}const unfetch_module$1=Object.freeze(Object.defineProperty({__proto__:null,default:unfetch_module},Symbol.toStringTag,{value:"Module"})),require$$0=getAugmentedNamespace(unfetch_module$1);var browser=self.fetch||(self.fetch=require$$0.default||require$$0);const Yi=getDefaultExportFromCjs(browser);var define_process_env_default={};function Hi(G,e){if(G.length>=255)throw new TypeError("Alphabet too long");for(var H=new Uint8Array(256),Y=0;Y>>0,cn=new Uint8Array(gn);ln!==fn;){for(var An=li[ln],Cn=0,an=gn-1;(An!==0||Cn>>0,cn[an]=An%si>>>0,An=An/si>>>0;if(An!==0)throw new Error("Non-zero carry");hn=Cn,ln++}for(var Rn=gn-hn;Rn!==gn&&cn[Rn]===0;)Rn++;for(var Ya=fi.repeat(mi);Rn>>0,gn=new Uint8Array(fn);li[mi];){var cn=H[li.charCodeAt(mi)];if(cn===255)return;for(var An=0,Cn=fn-1;(cn!==0||An>>0,gn[Cn]=cn%256>>>0,cn=cn/256>>>0;if(cn!==0)throw new Error("Non-zero carry");ln=An,mi++}if(li[mi]!==" "){for(var an=fn-ln;an!==fn&&gn[an]===0;)an++;for(var Rn=new Uint8Array(hn+(fn-an)),Ya=hn;an!==fn;)Rn[Ya++]=gn[an++];return Rn}}}function ui(li){var mi=ci(li);if(mi)return mi;throw new Error(`Non-${e} character`)}return{encode:hi,decodeUnsafe:ci,decode:ui}}var Ji=Hi,Xi=Ji;const Ue$1=G=>{if(G instanceof Uint8Array&&G.constructor.name==="Uint8Array")return G;if(G instanceof ArrayBuffer)return new Uint8Array(G);if(ArrayBuffer.isView(G))return new Uint8Array(G.buffer,G.byteOffset,G.byteLength);throw new Error("Unknown type, must be binary type")},Wi$1=G=>new TextEncoder().encode(G),Qi=G=>new TextDecoder().decode(G);class Zi{constructor(e,H,Y){this.name=e,this.prefix=H,this.baseEncode=Y}encode(e){if(e instanceof Uint8Array)return`${this.prefix}${this.baseEncode(e)}`;throw Error("Unknown type, must be binary type")}}let es$1=class{constructor(e,H,Y){if(this.name=e,this.prefix=H,H.codePointAt(0)===void 0)throw new Error("Invalid prefix character");this.prefixCodePoint=H.codePointAt(0),this.baseDecode=Y}decode(e){if(typeof e=="string"){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))}else throw Error("Can only multibase decode strings")}or(e){return Fe$1(this,e)}},ts$1=class{constructor(e){this.decoders=e}or(e){return Fe$1(this,e)}decode(e){const H=e[0],Y=this.decoders[H];if(Y)return Y.decode(e);throw RangeError(`Unable to decode multibase string ${JSON.stringify(e)}, only inputs prefixed with ${Object.keys(this.decoders)} are supported`)}};const Fe$1=(G,e)=>new ts$1({...G.decoders||{[G.prefix]:G},...e.decoders||{[e.prefix]:e}});let is$1=class{constructor(e,H,Y,Ne){this.name=e,this.prefix=H,this.baseEncode=Y,this.baseDecode=Ne,this.encoder=new Zi(e,H,Y),this.decoder=new es$1(e,H,Ne)}encode(e){return this.encoder.encode(e)}decode(e){return this.decoder.decode(e)}};const Q$1=({name:G,prefix:e,encode:H,decode:Y})=>new is$1(G,e,H,Y),V=({prefix:G,name:e,alphabet:H})=>{const{encode:Y,decode:Ne}=Xi(H,e);return Q$1({prefix:G,name:e,encode:Y,decode:W=>Ue$1(Ne(W))})},ss$1=(G,e,H,Y)=>{const Ne={};for(let ti=0;ti=8&&(si-=8,ri[ai++]=255&fi>>si)}if(si>=H||255&fi<<8-si)throw new SyntaxError("Unexpected end of data");return ri},rs$1=(G,e,H)=>{const Y=e[e.length-1]==="=",Ne=(1<H;)ri-=H,W+=e[Ne&si>>ri];if(ri&&(W+=e[Ne&si<Q$1({prefix:e,name:G,encode(Ne){return rs$1(Ne,Y,H)},decode(Ne){return ss$1(Ne,Y,H,G)}}),ns$1=Q$1({prefix:"\0",name:"identity",encode:G=>Qi(G),decode:G=>Wi$1(G)});var os=Object.freeze({__proto__:null,identity:ns$1});const as=y$2({prefix:"0",name:"base2",alphabet:"01",bitsPerChar:1});var hs=Object.freeze({__proto__:null,base2:as});const cs=y$2({prefix:"7",name:"base8",alphabet:"01234567",bitsPerChar:3});var ls=Object.freeze({__proto__:null,base8:cs});const us=V({prefix:"9",name:"base10",alphabet:"0123456789"});var ds=Object.freeze({__proto__:null,base10:us});const gs=y$2({prefix:"f",name:"base16",alphabet:"0123456789abcdef",bitsPerChar:4}),ps=y$2({prefix:"F",name:"base16upper",alphabet:"0123456789ABCDEF",bitsPerChar:4});var Ds=Object.freeze({__proto__:null,base16:gs,base16upper:ps});const ys=y$2({prefix:"b",name:"base32",alphabet:"abcdefghijklmnopqrstuvwxyz234567",bitsPerChar:5}),ms=y$2({prefix:"B",name:"base32upper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567",bitsPerChar:5}),bs=y$2({prefix:"c",name:"base32pad",alphabet:"abcdefghijklmnopqrstuvwxyz234567=",bitsPerChar:5}),fs=y$2({prefix:"C",name:"base32padupper",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZ234567=",bitsPerChar:5}),Es=y$2({prefix:"v",name:"base32hex",alphabet:"0123456789abcdefghijklmnopqrstuv",bitsPerChar:5}),ws=y$2({prefix:"V",name:"base32hexupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV",bitsPerChar:5}),vs=y$2({prefix:"t",name:"base32hexpad",alphabet:"0123456789abcdefghijklmnopqrstuv=",bitsPerChar:5}),Is=y$2({prefix:"T",name:"base32hexpadupper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUV=",bitsPerChar:5}),Cs=y$2({prefix:"h",name:"base32z",alphabet:"ybndrfg8ejkmcpqxot1uwisza345h769",bitsPerChar:5});var Ts=Object.freeze({__proto__:null,base32:ys,base32upper:ms,base32pad:bs,base32padupper:fs,base32hex:Es,base32hexupper:ws,base32hexpad:vs,base32hexpadupper:Is,base32z:Cs});const _s=V({prefix:"k",name:"base36",alphabet:"0123456789abcdefghijklmnopqrstuvwxyz"}),Rs=V({prefix:"K",name:"base36upper",alphabet:"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"});var Ss=Object.freeze({__proto__:null,base36:_s,base36upper:Rs});const Ps=V({name:"base58btc",prefix:"z",alphabet:"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz"}),xs=V({name:"base58flickr",prefix:"Z",alphabet:"123456789abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRSTUVWXYZ"});var Os=Object.freeze({__proto__:null,base58btc:Ps,base58flickr:xs});const As=y$2({prefix:"m",name:"base64",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",bitsPerChar:6}),zs=y$2({prefix:"M",name:"base64pad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",bitsPerChar:6}),Ns=y$2({prefix:"u",name:"base64url",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_",bitsPerChar:6}),Ls=y$2({prefix:"U",name:"base64urlpad",alphabet:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_=",bitsPerChar:6});var Us=Object.freeze({__proto__:null,base64:As,base64pad:zs,base64url:Ns,base64urlpad:Ls});const $e=Array.from("🚀🪐☄🛰🌌🌑🌒🌓🌔🌕🌖🌗🌘🌍🌏🌎🐉☀💻🖥💾💿😂❤😍🤣😊🙏💕😭😘👍😅👏😁🔥🥰💔💖💙😢🤔😆🙄💪😉☺👌🤗💜😔😎😇🌹🤦🎉💞✌✨🤷😱😌🌸🙌😋💗💚😏💛🙂💓🤩😄😀🖤😃💯🙈👇🎶😒🤭❣😜💋👀😪😑💥🙋😞😩😡🤪👊🥳😥🤤👉💃😳✋😚😝😴🌟😬🙃🍀🌷😻😓⭐✅🥺🌈😈🤘💦✔😣🏃💐☹🎊💘😠☝😕🌺🎂🌻😐🖕💝🙊😹🗣💫💀👑🎵🤞😛🔴😤🌼😫⚽🤙☕🏆🤫👈😮🙆🍻🍃🐶💁😲🌿🧡🎁⚡🌞🎈❌✊👋😰🤨😶🤝🚶💰🍓💢🤟🙁🚨💨🤬✈🎀🍺🤓😙💟🌱😖👶🥴▶➡❓💎💸⬇😨🌚🦋😷🕺⚠🙅😟😵👎🤲🤠🤧📌🔵💅🧐🐾🍒😗🤑🌊🤯🐷☎💧😯💆👆🎤🙇🍑❄🌴💣🐸💌📍🥀🤢👅💡💩👐📸👻🤐🤮🎼🥵🚩🍎🍊👼💍📣🥂"),Fs=$e.reduce((G,e,H)=>(G[H]=e,G),[]),$s=$e.reduce((G,e,H)=>(G[e.codePointAt(0)]=H,G),[]);function Bs(G){return G.reduce((e,H)=>(e+=Fs[H],e),"")}function Ms(G){const e=[];for(const H of G){const Y=$s[H.codePointAt(0)];if(Y===void 0)throw new Error(`Non-base256emoji character: ${H}`);e.push(Y)}return new Uint8Array(e)}const ks=Q$1({prefix:"🚀",name:"base256emoji",encode:Bs,decode:Ms});var Ks=Object.freeze({__proto__:null,base256emoji:ks}),Vs=Me,Be$1=128,qs=127,js=~qs,Gs=Math.pow(2,31);function Me(G,e,H){e=e||[],H=H||0;for(var Y=H;G>=Gs;)e[H++]=G&255|Be$1,G/=128;for(;G&js;)e[H++]=G&255|Be$1,G>>>=7;return e[H]=G|0,Me.bytes=H-Y+1,e}var Ys=de,Hs=128,ke$1=127;function de(G,Y){var H=0,Y=Y||0,Ne=0,W=Y,ri,si=G.length;do{if(W>=si)throw de.bytes=0,new RangeError("Could not decode varint");ri=G[W++],H+=Ne<28?(ri&ke$1)<=Hs);return de.bytes=W-Y,H}var Js=Math.pow(2,7),Xs=Math.pow(2,14),Ws=Math.pow(2,21),Qs=Math.pow(2,28),Zs=Math.pow(2,35),er=Math.pow(2,42),tr=Math.pow(2,49),ir=Math.pow(2,56),sr=Math.pow(2,63),rr=function(G){return G(Ke.encode(G,e,H),e),qe=G=>Ke.encodingLength(G),ge$1=(G,e)=>{const H=e.byteLength,Y=qe(G),Ne=Y+qe(H),W=new Uint8Array(Ne+H);return Ve(G,W,0),Ve(H,W,Y),W.set(e,Ne),new or(G,H,e,W)};class or{constructor(e,H,Y,Ne){this.code=e,this.size=H,this.digest=Y,this.bytes=Ne}}const je$1=({name:G,code:e,encode:H})=>new ar(G,e,H);class ar{constructor(e,H,Y){this.name=e,this.code=H,this.encode=Y}digest(e){if(e instanceof Uint8Array){const H=this.encode(e);return H instanceof Uint8Array?ge$1(this.code,H):H.then(Y=>ge$1(this.code,Y))}else throw Error("Unknown type, must be binary type")}}const Ge$1=G=>async e=>new Uint8Array(await crypto.subtle.digest(G,e)),hr$1=je$1({name:"sha2-256",code:18,encode:Ge$1("SHA-256")}),cr$1=je$1({name:"sha2-512",code:19,encode:Ge$1("SHA-512")});var lr$1=Object.freeze({__proto__:null,sha256:hr$1,sha512:cr$1});const Ye$1=0,ur="identity",He$1=Ue$1,dr=G=>ge$1(Ye$1,He$1(G)),gr={code:Ye$1,name:ur,encode:He$1,digest:dr};var pr=Object.freeze({__proto__:null,identity:gr});new TextEncoder,new TextDecoder;const Je$1={...os,...hs,...ls,...ds,...Ds,...Ts,...Ss,...Os,...Us,...Ks};({...lr$1,...pr});function Dr(G=0){return globalThis.Buffer!=null&&globalThis.Buffer.allocUnsafe!=null?globalThis.Buffer.allocUnsafe(G):new Uint8Array(G)}function Xe$1(G,e,H,Y){return{name:G,prefix:e,encoder:{name:G,prefix:e,encode:H},decoder:{decode:Y}}}const We$1=Xe$1("utf8","u",G=>"u"+new TextDecoder("utf8").decode(G),G=>new TextEncoder().encode(G.substring(1))),pe=Xe$1("ascii","a",G=>{let e="a";for(let H=0;H{G=G.substring(1);const e=Dr(G.length);for(let H=0;H{if(!this.initialized){const Y=await this.getKeyChain();typeof Y<"u"&&(this.keychain=Y),this.initialized=!0}},this.has=Y=>(this.isInitialized(),this.keychain.has(Y)),this.set=async(Y,Ne)=>{this.isInitialized(),this.keychain.set(Y,Ne),await this.persist()},this.get=Y=>{this.isInitialized();const Ne=this.keychain.get(Y);if(typeof Ne>"u"){const{message:W}=xe("NO_MATCHING_KEY",`${this.name}: ${Y}`);throw new Error(W)}return Ne},this.del=async Y=>{this.isInitialized(),this.keychain.delete(Y),await this.persist()},this.core=e,this.logger=E$4(H,this.name)}get context(){return y$4(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setKeyChain(e){await this.core.storage.setItem(this.storageKey,i0(e))}async getKeyChain(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?n0(e):void 0}async persist(){await this.setKeyChain(this.keychain)}isInitialized(){if(!this.initialized){const{message:e}=xe("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Ot{constructor(e,H,Y){this.core=e,this.logger=H,this.name=tt,this.initialized=!1,this.init=async()=>{this.initialized||(await this.keychain.init(),this.initialized=!0)},this.hasKeys=Ne=>(this.isInitialized(),this.keychain.has(Ne)),this.getClientId=async()=>{this.isInitialized();const Ne=await this.getClientSeed(),W=generateKeyPair(Ne);return encodeIss(W.publicKey)},this.generateKeyPair=()=>{this.isInitialized();const Ne=mu();return this.setPrivateKey(Ne.publicKey,Ne.privateKey)},this.signJWT=async Ne=>{this.isInitialized();const W=await this.getClientSeed(),ri=generateKeyPair(W),si=gu();return await signJWT(si,Ne,it,ri)},this.generateSharedKey=(Ne,W,ri)=>{this.isInitialized();const si=this.getPrivateKey(Ne),fi=Au(si,W);return this.setSymKey(fi,ri)},this.setSymKey=async(Ne,W)=>{this.isInitialized();const ri=W||bu(Ne);return await this.keychain.set(ri,Ne),ri},this.deleteKeyPair=async Ne=>{this.isInitialized(),await this.keychain.del(Ne)},this.deleteSymKey=async Ne=>{this.isInitialized(),await this.keychain.del(Ne)},this.encode=async(Ne,W,ri)=>{this.isInitialized();const si=eo(ri),fi=safeJsonStringify(W);if(Eu(si)){const ci=si.senderPublicKey,ui=si.receiverPublicKey;Ne=await this.generateSharedKey(ci,ui)}const ai=this.getSymKey(Ne),{type:ti,senderPublicKey:hi}=si;return wu({type:ti,symKey:ai,message:fi,senderPublicKey:hi})},this.decode=async(Ne,W,ri)=>{this.isInitialized();const si=Mu(W,ri);if(Eu(si)){const fi=si.receiverPublicKey,ai=si.senderPublicKey;Ne=await this.generateSharedKey(fi,ai)}try{const fi=this.getSymKey(Ne),ai=xu({symKey:fi,encoded:W});return safeJsonParse(ai)}catch(fi){this.logger.error(`Failed to decode message from topic: '${Ne}', clientId: '${await this.getClientId()}'`),this.logger.error(fi)}},this.getPayloadType=Ne=>{const W=Xi$1(Ne);return Mr(W.type)},this.getPayloadSenderPublicKey=Ne=>{const W=Xi$1(Ne);return W.senderPublicKey?toString$1(W.senderPublicKey,zt$1):void 0},this.core=e,this.logger=E$4(H,this.name),this.keychain=Y||new xt(this.core,this.logger)}get context(){return y$4(this.logger)}async setPrivateKey(e,H){return await this.keychain.set(e,H),e}getPrivateKey(e){return this.keychain.get(e)}async getClientSeed(){let e="";try{e=this.keychain.get(ye)}catch{e=gu(),await this.keychain.set(ye,e)}return mr(e,"base16")}getSymKey(e){return this.keychain.get(e)}isInitialized(){if(!this.initialized){const{message:e}=xe("NOT_INITIALIZED",this.name);throw new Error(e)}}}class At extends a$1{constructor(e,H){super(e,H),this.logger=e,this.core=H,this.messages=new Map,this.name=nt,this.version=ot,this.initialized=!1,this.storagePrefix=z$2,this.init=async()=>{if(!this.initialized){this.logger.trace("Initialized");try{const Y=await this.getRelayerMessages();typeof Y<"u"&&(this.messages=Y),this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",size:this.messages.size})}catch(Y){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(Y)}finally{this.initialized=!0}}},this.set=async(Y,Ne)=>{this.isInitialized();const W=yu(Ne);let ri=this.messages.get(Y);return typeof ri>"u"&&(ri={}),typeof ri[W]<"u"||(ri[W]=Ne,this.messages.set(Y,ri),await this.persist()),W},this.get=Y=>{this.isInitialized();let Ne=this.messages.get(Y);return typeof Ne>"u"&&(Ne={}),Ne},this.has=(Y,Ne)=>{this.isInitialized();const W=this.get(Y),ri=yu(Ne);return typeof W[ri]<"u"},this.del=async Y=>{this.isInitialized(),this.messages.delete(Y),await this.persist()},this.logger=E$4(e,this.name),this.core=H}get context(){return y$4(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}async setRelayerMessages(e){await this.core.storage.setItem(this.storageKey,i0(e))}async getRelayerMessages(){const e=await this.core.storage.getItem(this.storageKey);return typeof e<"u"?n0(e):void 0}async persist(){await this.setRelayerMessages(this.messages)}isInitialized(){if(!this.initialized){const{message:e}=xe("NOT_INITIALIZED",this.name);throw new Error(e)}}}class vr extends u$1{constructor(e,H){super(e,H),this.relayer=e,this.logger=H,this.events=new eventsExports.EventEmitter,this.name=ht,this.queue=new Map,this.publishTimeout=cjs$3.toMiliseconds(cjs$3.ONE_MINUTE),this.failedPublishTimeout=cjs$3.toMiliseconds(cjs$3.ONE_SECOND),this.needsTransportRestart=!1,this.publish=async(Y,Ne,W)=>{var ri;this.logger.debug("Publishing Payload"),this.logger.trace({type:"method",method:"publish",params:{topic:Y,message:Ne,opts:W}});const si=(W==null?void 0:W.ttl)||at,fi=Su(W),ai=(W==null?void 0:W.prompt)||!1,ti=(W==null?void 0:W.tag)||0,hi=(W==null?void 0:W.id)||getBigIntRpcId().toString(),ci={topic:Y,message:Ne,opts:{ttl:si,relay:fi,prompt:ai,tag:ti,id:hi}},ui=`Failed to publish payload, please try again. id:${hi} tag:${ti}`,li=Date.now();let mi,hn=1;try{for(;mi===void 0;){if(Date.now()-li>this.publishTimeout)throw new Error(ui);this.logger.trace({id:hi,attempts:hn},`publisher.publish - attempt ${hn}`),mi=await await u0(this.rpcPublish(Y,Ne,si,fi,ai,ti,hi).catch(ln=>this.logger.warn(ln)),this.publishTimeout,ui),hn++,mi||await new Promise(ln=>setTimeout(ln,this.failedPublishTimeout))}this.relayer.events.emit(f$2.publish,ci),this.logger.debug("Successfully Published Payload"),this.logger.trace({type:"method",method:"publish",params:{id:hi,topic:Y,message:Ne,opts:W}})}catch(ln){if(this.logger.debug("Failed to Publish Payload"),this.logger.error(ln),(ri=W==null?void 0:W.internal)!=null&&ri.throwOnFailedPublish)throw ln;this.queue.set(hi,ci)}},this.on=(Y,Ne)=>{this.events.on(Y,Ne)},this.once=(Y,Ne)=>{this.events.once(Y,Ne)},this.off=(Y,Ne)=>{this.events.off(Y,Ne)},this.removeListener=(Y,Ne)=>{this.events.removeListener(Y,Ne)},this.relayer=e,this.logger=E$4(H,this.name),this.registerEventListeners()}get context(){return y$4(this.logger)}rpcPublish(e,H,Y,Ne,W,ri,si){var fi,ai,ti,hi;const ci={method:Nu(Ne.protocol).publish,params:{topic:e,message:H,ttl:Y,prompt:W,tag:ri},id:si};return Pe((fi=ci.params)==null?void 0:fi.prompt)&&((ai=ci.params)==null||delete ai.prompt),Pe((ti=ci.params)==null?void 0:ti.tag)&&((hi=ci.params)==null||delete hi.tag),this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"message",direction:"outgoing",request:ci}),this.relayer.request(ci)}removeRequestFromQueue(e){this.queue.delete(e)}checkQueue(){this.queue.forEach(async e=>{const{topic:H,message:Y,opts:Ne}=e;await this.publish(H,Y,Ne)})}registerEventListeners(){this.relayer.core.heartbeat.on(r.pulse,()=>{if(this.needsTransportRestart){this.needsTransportRestart=!1,this.relayer.events.emit(f$2.connection_stalled);return}this.checkQueue()}),this.relayer.on(f$2.message_ack,e=>{this.removeRequestFromQueue(e.id.toString())})}}class Ir{constructor(){this.map=new Map,this.set=(e,H)=>{const Y=this.get(e);this.exists(e,H)||this.map.set(e,[...Y,H])},this.get=e=>this.map.get(e)||[],this.exists=(e,H)=>this.get(e).includes(H),this.delete=(e,H)=>{if(typeof H>"u"){this.map.delete(e);return}if(!this.map.has(e))return;const Y=this.get(e);if(!this.exists(e,H))return;const Ne=Y.filter(W=>W!==H);if(!Ne.length){this.map.delete(e);return}this.map.set(e,Ne)},this.clear=()=>{this.map.clear()}}get topics(){return Array.from(this.map.keys())}}var Cr=Object.defineProperty,Tr=Object.defineProperties,_r=Object.getOwnPropertyDescriptors,zt=Object.getOwnPropertySymbols,Rr=Object.prototype.hasOwnProperty,Sr=Object.prototype.propertyIsEnumerable,Nt=(G,e,H)=>e in G?Cr(G,e,{enumerable:!0,configurable:!0,writable:!0,value:H}):G[e]=H,j$2=(G,e)=>{for(var H in e||(e={}))Rr.call(e,H)&&Nt(G,H,e[H]);if(zt)for(var H of zt(e))Sr.call(e,H)&&Nt(G,H,e[H]);return G},fe=(G,e)=>Tr(G,_r(e));class Lt extends d$1{constructor(e,H){super(e,H),this.relayer=e,this.logger=H,this.subscriptions=new Map,this.topicMap=new Ir,this.events=new eventsExports.EventEmitter,this.name=bt,this.version=ft$1,this.pending=new Map,this.cached=[],this.initialized=!1,this.pendingSubscriptionWatchLabel="pending_sub_watch_label",this.pollingInterval=20,this.storagePrefix=z$2,this.subscribeTimeout=cjs$3.toMiliseconds(cjs$3.ONE_MINUTE),this.restartInProgress=!1,this.batchSubscribeTopicsLimit=500,this.pendingBatchMessages=[],this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),this.registerEventListeners(),this.clientId=await this.relayer.core.crypto.getClientId())},this.subscribe=async(Y,Ne)=>{await this.restartToComplete(),this.isInitialized(),this.logger.debug("Subscribing Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:Y,opts:Ne}});try{const W=Su(Ne),ri={topic:Y,relay:W};this.pending.set(Y,ri);const si=await this.rpcSubscribe(Y,W);return typeof si=="string"&&(this.onSubscribe(si,ri),this.logger.debug("Successfully Subscribed Topic"),this.logger.trace({type:"method",method:"subscribe",params:{topic:Y,opts:Ne}})),si}catch(W){throw this.logger.debug("Failed to Subscribe Topic"),this.logger.error(W),W}},this.unsubscribe=async(Y,Ne)=>{await this.restartToComplete(),this.isInitialized(),typeof(Ne==null?void 0:Ne.id)<"u"?await this.unsubscribeById(Y,Ne.id,Ne):await this.unsubscribeByTopic(Y,Ne)},this.isSubscribed=async Y=>{if(this.topics.includes(Y))return!0;const Ne=`${this.pendingSubscriptionWatchLabel}_${Y}`;return await new Promise((W,ri)=>{const si=new cjs$3.Watch;si.start(Ne);const fi=setInterval(()=>{!this.pending.has(Y)&&this.topics.includes(Y)&&(clearInterval(fi),si.stop(Ne),W(!0)),si.elapsed(Ne)>=Et&&(clearInterval(fi),si.stop(Ne),ri(new Error("Subscription resolution timeout")))},this.pollingInterval)}).catch(()=>!1)},this.on=(Y,Ne)=>{this.events.on(Y,Ne)},this.once=(Y,Ne)=>{this.events.once(Y,Ne)},this.off=(Y,Ne)=>{this.events.off(Y,Ne)},this.removeListener=(Y,Ne)=>{this.events.removeListener(Y,Ne)},this.start=async()=>{await this.onConnect()},this.stop=async()=>{await this.onDisconnect()},this.restart=async()=>{this.restartInProgress=!0,await this.restore(),await this.reset(),this.restartInProgress=!1},this.relayer=e,this.logger=E$4(H,this.name),this.clientId=""}get context(){return y$4(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}hasSubscription(e,H){let Y=!1;try{Y=this.getSubscription(e).topic===H}catch{}return Y}onEnable(){this.cached=[],this.initialized=!0}onDisable(){this.cached=this.values,this.subscriptions.clear(),this.topicMap.clear()}async unsubscribeByTopic(e,H){const Y=this.topicMap.get(e);await Promise.all(Y.map(async Ne=>await this.unsubscribeById(e,Ne,H)))}async unsubscribeById(e,H,Y){this.logger.debug("Unsubscribing Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:H,opts:Y}});try{const Ne=Su(Y);await this.rpcUnsubscribe(e,H,Ne);const W=tr$1("USER_DISCONNECTED",`${this.name}, ${e}`);await this.onUnsubscribe(e,H,W),this.logger.debug("Successfully Unsubscribed Topic"),this.logger.trace({type:"method",method:"unsubscribe",params:{topic:e,id:H,opts:Y}})}catch(Ne){throw this.logger.debug("Failed to Unsubscribe Topic"),this.logger.error(Ne),Ne}}async rpcSubscribe(e,H){const Y={method:Nu(H.protocol).subscribe,params:{topic:e}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:Y});try{return await await u0(this.relayer.request(Y).catch(Ne=>this.logger.warn(Ne)),this.subscribeTimeout)?yu(e+this.clientId):null}catch{this.logger.debug("Outgoing Relay Subscribe Payload stalled"),this.relayer.events.emit(f$2.connection_stalled)}return null}async rpcBatchSubscribe(e){if(!e.length)return;const H=e[0].relay,Y={method:Nu(H.protocol).batchSubscribe,params:{topics:e.map(Ne=>Ne.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:Y});try{return await await u0(this.relayer.request(Y).catch(Ne=>this.logger.warn(Ne)),this.subscribeTimeout)}catch{this.relayer.events.emit(f$2.connection_stalled)}}async rpcBatchFetchMessages(e){if(!e.length)return;const H=e[0].relay,Y={method:Nu(H.protocol).batchFetchMessages,params:{topics:e.map(W=>W.topic)}};this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:Y});let Ne;try{Ne=await await u0(this.relayer.request(Y).catch(W=>this.logger.warn(W)),this.subscribeTimeout)}catch{this.relayer.events.emit(f$2.connection_stalled)}return Ne}rpcUnsubscribe(e,H,Y){const Ne={method:Nu(Y.protocol).unsubscribe,params:{topic:e,id:H}};return this.logger.debug("Outgoing Relay Payload"),this.logger.trace({type:"payload",direction:"outgoing",request:Ne}),this.relayer.request(Ne)}onSubscribe(e,H){this.setSubscription(e,fe(j$2({},H),{id:e})),this.pending.delete(H.topic)}onBatchSubscribe(e){e.length&&e.forEach(H=>{this.setSubscription(H.id,j$2({},H)),this.pending.delete(H.topic)})}async onUnsubscribe(e,H,Y){this.events.removeAllListeners(H),this.hasSubscription(H,e)&&this.deleteSubscription(H,Y),await this.relayer.messages.del(e)}async setRelayerSubscriptions(e){await this.relayer.core.storage.setItem(this.storageKey,e)}async getRelayerSubscriptions(){return await this.relayer.core.storage.getItem(this.storageKey)}setSubscription(e,H){this.logger.debug("Setting subscription"),this.logger.trace({type:"method",method:"setSubscription",id:e,subscription:H}),this.addSubscription(e,H)}addSubscription(e,H){this.subscriptions.set(e,j$2({},H)),this.topicMap.set(H.topic,e),this.events.emit(S$1.created,H)}getSubscription(e){this.logger.debug("Getting subscription"),this.logger.trace({type:"method",method:"getSubscription",id:e});const H=this.subscriptions.get(e);if(!H){const{message:Y}=xe("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(Y)}return H}deleteSubscription(e,H){this.logger.debug("Deleting subscription"),this.logger.trace({type:"method",method:"deleteSubscription",id:e,reason:H});const Y=this.getSubscription(e);this.subscriptions.delete(e),this.topicMap.delete(Y.topic,e),this.events.emit(S$1.deleted,fe(j$2({},Y),{reason:H}))}async persist(){await this.setRelayerSubscriptions(this.values),this.events.emit(S$1.sync)}async reset(){if(this.cached.length){const e=Math.ceil(this.cached.length/this.batchSubscribeTopicsLimit);for(let H=0;H"u"||!e.length)return;if(this.subscriptions.size){const{message:H}=xe("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(H),this.logger.error(`${this.name}: ${JSON.stringify(this.values)}`),new Error(H)}this.cached=e,this.logger.debug(`Successfully Restored subscriptions for ${this.name}`),this.logger.trace({type:"method",method:"restore",subscriptions:this.values})}catch(e){this.logger.debug(`Failed to Restore subscriptions for ${this.name}`),this.logger.error(e)}}async batchSubscribe(e){if(!e.length)return;const H=await this.rpcBatchSubscribe(e);Er(H)&&this.onBatchSubscribe(H.map((Y,Ne)=>fe(j$2({},e[Ne]),{id:Y})))}async batchFetchMessages(e){if(!e.length)return;this.logger.trace(`Fetching batch messages for ${e.length} subscriptions`);const H=await this.rpcBatchFetchMessages(e);H&&H.messages&&(this.pendingBatchMessages=this.pendingBatchMessages.concat(H.messages))}async onConnect(){await this.restart(),this.onEnable()}onDisconnect(){this.onDisable()}async checkPending(){if(!this.initialized||!this.relayer.connected)return;const e=[];this.pending.forEach(H=>{e.push(H)}),await this.batchSubscribe(e),this.pendingBatchMessages.length&&(await this.relayer.handleBatchMessageEvents(this.pendingBatchMessages),this.pendingBatchMessages=[])}registerEventListeners(){this.relayer.core.heartbeat.on(r.pulse,async()=>{await this.checkPending()}),this.events.on(S$1.created,async e=>{const H=S$1.created;this.logger.info(`Emitting ${H}`),this.logger.debug({type:"event",event:H,data:e}),await this.persist()}),this.events.on(S$1.deleted,async e=>{const H=S$1.deleted;this.logger.info(`Emitting ${H}`),this.logger.debug({type:"event",event:H,data:e}),await this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=xe("NOT_INITIALIZED",this.name);throw new Error(e)}}async restartToComplete(){this.restartInProgress&&await new Promise(e=>{const H=setInterval(()=>{this.restartInProgress||(clearInterval(H),e())},this.pollingInterval)})}}var Pr=Object.defineProperty,Ut=Object.getOwnPropertySymbols,xr=Object.prototype.hasOwnProperty,Or=Object.prototype.propertyIsEnumerable,Ft=(G,e,H)=>e in G?Pr(G,e,{enumerable:!0,configurable:!0,writable:!0,value:H}):G[e]=H,Ar=(G,e)=>{for(var H in e||(e={}))xr.call(e,H)&&Ft(G,H,e[H]);if(Ut)for(var H of Ut(e))Or.call(e,H)&&Ft(G,H,e[H]);return G};class $t extends g$2{constructor(e){super(e),this.protocol="wc",this.version=2,this.events=new eventsExports.EventEmitter,this.name=ut,this.transportExplicitlyClosed=!1,this.initialized=!1,this.connectionAttemptInProgress=!1,this.connectionStatusPollingInterval=20,this.staleConnectionErrors=["socket hang up","stalled","interrupted"],this.hasExperiencedNetworkDisruption=!1,this.requestsInFlight=new Map,this.heartBeatTimeout=cjs$3.toMiliseconds(cjs$3.THIRTY_SECONDS+cjs$3.ONE_SECOND),this.request=async H=>{var Y,Ne;this.logger.debug("Publishing Request Payload");const W=H.id||getBigIntRpcId().toString();await this.toEstablishConnection();try{const ri=this.provider.request(H);this.requestsInFlight.set(W,{promise:ri,request:H}),this.logger.trace({id:W,method:H.method,topic:(Y=H.params)==null?void 0:Y.topic},"relayer.request - attempt to publish...");const si=await new Promise(async(fi,ai)=>{const ti=()=>{ai(new Error(`relayer.request - publish interrupted, id: ${W}`))};this.provider.on(E$2.disconnect,ti);const hi=await ri;this.provider.off(E$2.disconnect,ti),fi(hi)});return this.logger.trace({id:W,method:H.method,topic:(Ne=H.params)==null?void 0:Ne.topic},"relayer.request - published"),si}catch(ri){throw this.logger.debug(`Failed to Publish Request: ${W}`),ri}finally{this.requestsInFlight.delete(W)}},this.resetPingTimeout=()=>{if(pi())try{clearTimeout(this.pingTimeout),this.pingTimeout=setTimeout(()=>{var H,Y,Ne;(Ne=(Y=(H=this.provider)==null?void 0:H.connection)==null?void 0:Y.socket)==null||Ne.terminate()},this.heartBeatTimeout)}catch(H){this.logger.warn(H)}},this.onPayloadHandler=H=>{this.onProviderPayload(H),this.resetPingTimeout()},this.onConnectHandler=()=>{this.startPingTimeout(),this.events.emit(f$2.connect)},this.onDisconnectHandler=()=>{this.onProviderDisconnect()},this.onProviderErrorHandler=H=>{this.logger.error(H),this.events.emit(f$2.error,H),this.logger.info("Fatal socket error received, closing transport"),this.transportClose()},this.registerProviderListeners=()=>{this.provider.on(E$2.payload,this.onPayloadHandler),this.provider.on(E$2.connect,this.onConnectHandler),this.provider.on(E$2.disconnect,this.onDisconnectHandler),this.provider.on(E$2.error,this.onProviderErrorHandler)},this.core=e.core,this.logger=typeof e.logger<"u"&&typeof e.logger!="string"?E$4(e.logger,this.name):Hg(k({level:e.logger||lt})),this.messages=new At(this.logger,e.core),this.subscriber=new Lt(this,this.logger),this.publisher=new vr(this,this.logger),this.relayUrl=(e==null?void 0:e.relayUrl)||me,this.projectId=e.projectId,this.bundleId=Wo(),this.provider={}}async init(){this.logger.trace("Initialized"),this.registerEventListeners(),await Promise.all([this.messages.init(),this.subscriber.init()]);try{await this.transportOpen()}catch{this.logger.warn(`Connection via ${this.relayUrl} failed, attempting to connect via failover domain ${be}...`),await this.restartTransport(be)}this.initialized=!0,setTimeout(async()=>{this.subscriber.topics.length===0&&this.subscriber.pending.size===0&&(this.logger.info("No topics subscribed to after init, closing transport"),await this.transportClose(),this.transportExplicitlyClosed=!1)},Dt)}get context(){return y$4(this.logger)}get connected(){var e,H,Y;return((Y=(H=(e=this.provider)==null?void 0:e.connection)==null?void 0:H.socket)==null?void 0:Y.readyState)===1}get connecting(){var e,H,Y;return((Y=(H=(e=this.provider)==null?void 0:e.connection)==null?void 0:H.socket)==null?void 0:Y.readyState)===0}async publish(e,H,Y){this.isInitialized(),await this.publisher.publish(e,H,Y),await this.recordMessageEvent({topic:e,message:H,publishedAt:Date.now()})}async subscribe(e,H){var Y;this.isInitialized();let Ne=((Y=this.subscriber.topicMap.get(e))==null?void 0:Y[0])||"",W;const ri=si=>{si.topic===e&&(this.subscriber.off(S$1.created,ri),W())};return await Promise.all([new Promise(si=>{W=si,this.subscriber.on(S$1.created,ri)}),new Promise(async si=>{Ne=await this.subscriber.subscribe(e,H)||Ne,si()})]),Ne}async unsubscribe(e,H){this.isInitialized(),await this.subscriber.unsubscribe(e,H)}on(e,H){this.events.on(e,H)}once(e,H){this.events.once(e,H)}off(e,H){this.events.off(e,H)}removeListener(e,H){this.events.removeListener(e,H)}async transportDisconnect(){if(!this.hasExperiencedNetworkDisruption&&this.connected&&this.requestsInFlight.size>0)try{await Promise.all(Array.from(this.requestsInFlight.values()).map(e=>e.promise))}catch(e){this.logger.warn(e)}this.hasExperiencedNetworkDisruption||this.connected?await u0(this.provider.disconnect(),2e3,"provider.disconnect()").catch(()=>this.onProviderDisconnect()):this.onProviderDisconnect()}async transportClose(){this.transportExplicitlyClosed=!0,await this.transportDisconnect()}async transportOpen(e){await this.confirmOnlineStateOrThrow(),e&&e!==this.relayUrl&&(this.relayUrl=e,await this.transportDisconnect()),await this.createProvider(),this.connectionAttemptInProgress=!0,this.transportExplicitlyClosed=!1;try{await new Promise(async(H,Y)=>{const Ne=()=>{this.provider.off(E$2.disconnect,Ne),Y(new Error("Connection interrupted while trying to subscribe"))};this.provider.on(E$2.disconnect,Ne),await u0(this.provider.connect(),cjs$3.toMiliseconds(cjs$3.ONE_MINUTE),`Socket stalled when trying to connect to ${this.relayUrl}`).catch(W=>{Y(W)}),await this.subscriber.start(),this.hasExperiencedNetworkDisruption=!1,H()})}catch(H){this.logger.error(H);const Y=H;if(this.hasExperiencedNetworkDisruption=!0,!this.isConnectionStalled(Y.message))throw H}finally{this.connectionAttemptInProgress=!1}}async restartTransport(e){this.connectionAttemptInProgress||(this.relayUrl=e||this.relayUrl,await this.confirmOnlineStateOrThrow(),await this.transportClose(),await this.transportOpen())}async confirmOnlineStateOrThrow(){if(!await hh())throw new Error("No internet connection detected. Please restart your network and try again.")}async handleBatchMessageEvents(e){if((e==null?void 0:e.length)===0){this.logger.trace("Batch message events is empty. Ignoring...");return}const H=e.sort((Y,Ne)=>Y.publishedAt-Ne.publishedAt);this.logger.trace(`Batch of ${H.length} message events sorted`);for(const Y of H)try{await this.onMessageEvent(Y)}catch(Ne){this.logger.warn(Ne)}this.logger.trace(`Batch of ${H.length} message events processed`)}startPingTimeout(){var e,H,Y,Ne,W;if(pi())try{(H=(e=this.provider)==null?void 0:e.connection)!=null&&H.socket&&((W=(Ne=(Y=this.provider)==null?void 0:Y.connection)==null?void 0:Ne.socket)==null||W.once("ping",()=>{this.resetPingTimeout()})),this.resetPingTimeout()}catch(ri){this.logger.warn(ri)}}isConnectionStalled(e){return this.staleConnectionErrors.some(H=>e.includes(H))}async createProvider(){this.provider.connection&&this.unregisterProviderListeners();const e=await this.core.crypto.signJWT(this.relayUrl);this.provider=new o$1(new f$3($o({sdkVersion:pt,protocol:this.protocol,version:this.version,relayUrl:this.relayUrl,projectId:this.projectId,auth:e,useOnCloseEvent:!0,bundleId:this.bundleId}))),this.registerProviderListeners()}async recordMessageEvent(e){const{topic:H,message:Y}=e;await this.messages.set(H,Y)}async shouldIgnoreMessageEvent(e){const{topic:H,message:Y}=e;if(!Y||Y.length===0)return this.logger.debug(`Ignoring invalid/empty message: ${Y}`),!0;if(!await this.subscriber.isSubscribed(H))return this.logger.debug(`Ignoring message for non-subscribed topic ${H}`),!0;const Ne=this.messages.has(H,Y);return Ne&&this.logger.debug(`Ignoring duplicate message: ${Y}`),Ne}async onProviderPayload(e){if(this.logger.debug("Incoming Relay Payload"),this.logger.trace({type:"payload",direction:"incoming",payload:e}),isJsonRpcRequest(e)){if(!e.method.endsWith(dt))return;const H=e.params,{topic:Y,message:Ne,publishedAt:W}=H.data,ri={topic:Y,message:Ne,publishedAt:W};this.logger.debug("Emitting Relayer Payload"),this.logger.trace(Ar({type:"event",event:H.id},ri)),this.events.emit(H.id,ri),await this.acknowledgePayload(e),await this.onMessageEvent(ri)}else isJsonRpcResponse(e)&&this.events.emit(f$2.message_ack,e)}async onMessageEvent(e){await this.shouldIgnoreMessageEvent(e)||(this.events.emit(f$2.message,e),await this.recordMessageEvent(e))}async acknowledgePayload(e){const H=formatJsonRpcResult(e.id,!0);await this.provider.connection.send(H)}unregisterProviderListeners(){this.provider.off(E$2.payload,this.onPayloadHandler),this.provider.off(E$2.connect,this.onConnectHandler),this.provider.off(E$2.disconnect,this.onDisconnectHandler),this.provider.off(E$2.error,this.onProviderErrorHandler),clearTimeout(this.pingTimeout)}async registerEventListeners(){let e=await hh();ch(async H=>{e!==H&&(e=H,H?await this.restartTransport().catch(Y=>this.logger.error(Y)):(this.hasExperiencedNetworkDisruption=!0,await this.transportDisconnect(),this.transportExplicitlyClosed=!1))})}async onProviderDisconnect(){await this.subscriber.stop(),this.requestsInFlight.clear(),clearTimeout(this.pingTimeout),this.events.emit(f$2.disconnect),this.connectionAttemptInProgress=!1,!this.transportExplicitlyClosed&&setTimeout(async()=>{await this.transportOpen().catch(e=>this.logger.error(e))},cjs$3.toMiliseconds(gt))}isInitialized(){if(!this.initialized){const{message:e}=xe("NOT_INITIALIZED",this.name);throw new Error(e)}}async toEstablishConnection(){await this.confirmOnlineStateOrThrow(),!this.connected&&(this.connectionAttemptInProgress&&await new Promise(e=>{const H=setInterval(()=>{this.connected&&(clearInterval(H),e())},this.connectionStatusPollingInterval)}),await this.transportOpen())}}var zr=Object.defineProperty,Bt$1=Object.getOwnPropertySymbols,Nr=Object.prototype.hasOwnProperty,Lr=Object.prototype.propertyIsEnumerable,Mt=(G,e,H)=>e in G?zr(G,e,{enumerable:!0,configurable:!0,writable:!0,value:H}):G[e]=H,kt=(G,e)=>{for(var H in e||(e={}))Nr.call(e,H)&&Mt(G,H,e[H]);if(Bt$1)for(var H of Bt$1(e))Lr.call(e,H)&&Mt(G,H,e[H]);return G};class Kt extends p$2{constructor(e,H,Y,Ne=z$2,W=void 0){super(e,H,Y,Ne),this.core=e,this.logger=H,this.name=Y,this.map=new Map,this.version=yt,this.cached=[],this.initialized=!1,this.storagePrefix=z$2,this.recentlyDeleted=[],this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(ri=>{this.getKey&&ri!==null&&!Pe(ri)?this.map.set(this.getKey(ri),ri):Gu(ri)?this.map.set(ri.id,ri):Yu(ri)&&this.map.set(ri.topic,ri)}),this.cached=[],this.initialized=!0)},this.set=async(ri,si)=>{this.isInitialized(),this.map.has(ri)?await this.update(ri,si):(this.logger.debug("Setting value"),this.logger.trace({type:"method",method:"set",key:ri,value:si}),this.map.set(ri,si),await this.persist())},this.get=ri=>(this.isInitialized(),this.logger.debug("Getting value"),this.logger.trace({type:"method",method:"get",key:ri}),this.getData(ri)),this.getAll=ri=>(this.isInitialized(),ri?this.values.filter(si=>Object.keys(ri).every(fi=>Gi(si[fi],ri[fi]))):this.values),this.update=async(ri,si)=>{this.isInitialized(),this.logger.debug("Updating value"),this.logger.trace({type:"method",method:"update",key:ri,update:si});const fi=kt(kt({},this.getData(ri)),si);this.map.set(ri,fi),await this.persist()},this.delete=async(ri,si)=>{this.isInitialized(),this.map.has(ri)&&(this.logger.debug("Deleting value"),this.logger.trace({type:"method",method:"delete",key:ri,reason:si}),this.map.delete(ri),this.addToRecentlyDeleted(ri),await this.persist())},this.logger=E$4(H,this.name),this.storagePrefix=Ne,this.getKey=W}get context(){return y$4(this.logger)}get storageKey(){return this.storagePrefix+this.version+this.core.customStoragePrefix+"//"+this.name}get length(){return this.map.size}get keys(){return Array.from(this.map.keys())}get values(){return Array.from(this.map.values())}addToRecentlyDeleted(e){this.recentlyDeleted.push(e),this.recentlyDeleted.length>=this.recentlyDeletedLimit&&this.recentlyDeleted.splice(0,this.recentlyDeletedLimit/2)}async setDataStore(e){await this.core.storage.setItem(this.storageKey,e)}async getDataStore(){return await this.core.storage.getItem(this.storageKey)}getData(e){const H=this.map.get(e);if(!H){if(this.recentlyDeleted.includes(e)){const{message:Ne}=xe("MISSING_OR_INVALID",`Record was recently deleted - ${this.name}: ${e}`);throw this.logger.error(Ne),new Error(Ne)}const{message:Y}=xe("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.error(Y),new Error(Y)}return H}async persist(){await this.setDataStore(this.values)}async restore(){try{const e=await this.getDataStore();if(typeof e>"u"||!e.length)return;if(this.map.size){const{message:H}=xe("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(H),new Error(H)}this.cached=e,this.logger.debug(`Successfully Restored value for ${this.name}`),this.logger.trace({type:"method",method:"restore",value:this.values})}catch(e){this.logger.debug(`Failed to Restore value for ${this.name}`),this.logger.error(e)}}isInitialized(){if(!this.initialized){const{message:e}=xe("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Vt{constructor(e,H){this.core=e,this.logger=H,this.name=wt,this.version=vt,this.events=new Wg,this.initialized=!1,this.storagePrefix=z$2,this.ignoredPayloadTypes=[lr$2],this.registeredMethods=[],this.init=async()=>{this.initialized||(await this.pairings.init(),await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.initialized=!0,this.logger.trace("Initialized"))},this.register=({methods:Y})=>{this.isInitialized(),this.registeredMethods=[...new Set([...this.registeredMethods,...Y])]},this.create=async Y=>{this.isInitialized();const Ne=gu(),W=await this.core.crypto.setSymKey(Ne),ri=d0(cjs$3.FIVE_MINUTES),si={protocol:ct},fi={topic:W,expiry:ri,relay:si,active:!1},ai=Du({protocol:this.core.protocol,version:this.core.version,topic:W,symKey:Ne,relay:si,expiryTimestamp:ri,methods:Y==null?void 0:Y.methods});return this.core.expirer.set(W,ri),await this.pairings.set(W,fi),await this.core.relayer.subscribe(W),{topic:W,uri:ai}},this.pair=async Y=>{this.isInitialized(),this.isValidPair(Y);const{topic:Ne,symKey:W,relay:ri,expiryTimestamp:si,methods:fi}=Pu(Y.uri);let ai;if(this.pairings.keys.includes(Ne)&&(ai=this.pairings.get(Ne),ai.active))throw new Error(`Pairing already exists: ${Ne}. Please try again with a new connection URI.`);const ti=si||d0(cjs$3.FIVE_MINUTES),hi={topic:Ne,relay:ri,expiry:ti,active:!1,methods:fi};return this.core.expirer.set(Ne,ti),await this.pairings.set(Ne,hi),Y.activatePairing&&await this.activate({topic:Ne}),this.events.emit(q$1.create,hi),this.core.crypto.keychain.has(Ne)||await this.core.crypto.setSymKey(W,Ne),await this.core.relayer.subscribe(Ne,{relay:ri}),hi},this.activate=async({topic:Y})=>{this.isInitialized();const Ne=d0(cjs$3.THIRTY_DAYS);this.core.expirer.set(Y,Ne),await this.pairings.update(Y,{active:!0,expiry:Ne})},this.ping=async Y=>{this.isInitialized(),await this.isValidPing(Y);const{topic:Ne}=Y;if(this.pairings.keys.includes(Ne)){const W=await this.sendRequest(Ne,"wc_pairingPing",{}),{done:ri,resolve:si,reject:fi}=a0();this.events.once(v0("pairing_ping",W),({error:ai})=>{ai?fi(ai):si()}),await ri()}},this.updateExpiry=async({topic:Y,expiry:Ne})=>{this.isInitialized(),await this.pairings.update(Y,{expiry:Ne})},this.updateMetadata=async({topic:Y,metadata:Ne})=>{this.isInitialized(),await this.pairings.update(Y,{peerMetadata:Ne})},this.getPairings=()=>(this.isInitialized(),this.pairings.values),this.disconnect=async Y=>{this.isInitialized(),await this.isValidDisconnect(Y);const{topic:Ne}=Y;this.pairings.keys.includes(Ne)&&(await this.sendRequest(Ne,"wc_pairingDelete",tr$1("USER_DISCONNECTED")),await this.deletePairing(Ne))},this.sendRequest=async(Y,Ne,W)=>{const ri=formatJsonRpcRequest(Ne,W),si=await this.core.crypto.encode(Y,ri),fi=B[Ne].req;return this.core.history.set(Y,ri),this.core.relayer.publish(Y,si,fi),ri.id},this.sendResult=async(Y,Ne,W)=>{const ri=formatJsonRpcResult(Y,W),si=await this.core.crypto.encode(Ne,ri),fi=await this.core.history.get(Ne,Y),ai=B[fi.request.method].res;await this.core.relayer.publish(Ne,si,ai),await this.core.history.resolve(ri)},this.sendError=async(Y,Ne,W)=>{const ri=formatJsonRpcError(Y,W),si=await this.core.crypto.encode(Ne,ri),fi=await this.core.history.get(Ne,Y),ai=B[fi.request.method]?B[fi.request.method].res:B.unregistered_method.res;await this.core.relayer.publish(Ne,si,ai),await this.core.history.resolve(ri)},this.deletePairing=async(Y,Ne)=>{await this.core.relayer.unsubscribe(Y),await Promise.all([this.pairings.delete(Y,tr$1("USER_DISCONNECTED")),this.core.crypto.deleteSymKey(Y),Ne?Promise.resolve():this.core.expirer.del(Y)])},this.cleanup=async()=>{const Y=this.pairings.getAll().filter(Ne=>p0(Ne.expiry));await Promise.all(Y.map(Ne=>this.deletePairing(Ne.topic)))},this.onRelayEventRequest=Y=>{const{topic:Ne,payload:W}=Y;switch(W.method){case"wc_pairingPing":return this.onPairingPingRequest(Ne,W);case"wc_pairingDelete":return this.onPairingDeleteRequest(Ne,W);default:return this.onUnknownRpcMethodRequest(Ne,W)}},this.onRelayEventResponse=async Y=>{const{topic:Ne,payload:W}=Y,ri=(await this.core.history.get(Ne,W.id)).request.method;switch(ri){case"wc_pairingPing":return this.onPairingPingResponse(Ne,W);default:return this.onUnknownRpcMethodResponse(ri)}},this.onPairingPingRequest=async(Y,Ne)=>{const{id:W}=Ne;try{this.isValidPing({topic:Y}),await this.sendResult(W,Y,!0),this.events.emit(q$1.ping,{id:W,topic:Y})}catch(ri){await this.sendError(W,Y,ri),this.logger.error(ri)}},this.onPairingPingResponse=(Y,Ne)=>{const{id:W}=Ne;setTimeout(()=>{isJsonRpcResult(Ne)?this.events.emit(v0("pairing_ping",W),{}):isJsonRpcError(Ne)&&this.events.emit(v0("pairing_ping",W),{error:Ne.error})},500)},this.onPairingDeleteRequest=async(Y,Ne)=>{const{id:W}=Ne;try{this.isValidDisconnect({topic:Y}),await this.deletePairing(Y),this.events.emit(q$1.delete,{id:W,topic:Y})}catch(ri){await this.sendError(W,Y,ri),this.logger.error(ri)}},this.onUnknownRpcMethodRequest=async(Y,Ne)=>{const{id:W,method:ri}=Ne;try{if(this.registeredMethods.includes(ri))return;const si=tr$1("WC_METHOD_UNSUPPORTED",ri);await this.sendError(W,Y,si),this.logger.error(si)}catch(si){await this.sendError(W,Y,si),this.logger.error(si)}},this.onUnknownRpcMethodResponse=Y=>{this.registeredMethods.includes(Y)||this.logger.error(tr$1("WC_METHOD_UNSUPPORTED",Y))},this.isValidPair=Y=>{var Ne;if(!$u(Y)){const{message:ri}=xe("MISSING_OR_INVALID",`pair() params: ${Y}`);throw new Error(ri)}if(!Ju(Y.uri)){const{message:ri}=xe("MISSING_OR_INVALID",`pair() uri: ${Y.uri}`);throw new Error(ri)}const W=Pu(Y.uri);if(!((Ne=W==null?void 0:W.relay)!=null&&Ne.protocol)){const{message:ri}=xe("MISSING_OR_INVALID","pair() uri#relay-protocol");throw new Error(ri)}if(!(W!=null&&W.symKey)){const{message:ri}=xe("MISSING_OR_INVALID","pair() uri#symKey");throw new Error(ri)}if(W!=null&&W.expiryTimestamp&&cjs$3.toMiliseconds(W==null?void 0:W.expiryTimestamp){if(!$u(Y)){const{message:W}=xe("MISSING_OR_INVALID",`ping() params: ${Y}`);throw new Error(W)}const{topic:Ne}=Y;await this.isValidPairingTopic(Ne)},this.isValidDisconnect=async Y=>{if(!$u(Y)){const{message:W}=xe("MISSING_OR_INVALID",`disconnect() params: ${Y}`);throw new Error(W)}const{topic:Ne}=Y;await this.isValidPairingTopic(Ne)},this.isValidPairingTopic=async Y=>{if(!Gt$1(Y,!1)){const{message:Ne}=xe("MISSING_OR_INVALID",`pairing topic should be a string: ${Y}`);throw new Error(Ne)}if(!this.pairings.keys.includes(Y)){const{message:Ne}=xe("NO_MATCHING_KEY",`pairing topic doesn't exist: ${Y}`);throw new Error(Ne)}if(p0(this.pairings.get(Y).expiry)){await this.deletePairing(Y);const{message:Ne}=xe("EXPIRED",`pairing topic: ${Y}`);throw new Error(Ne)}},this.core=e,this.logger=E$4(H,this.name),this.pairings=new Kt(this.core,this.logger,this.name,this.storagePrefix)}get context(){return y$4(this.logger)}isInitialized(){if(!this.initialized){const{message:e}=xe("NOT_INITIALIZED",this.name);throw new Error(e)}}registerRelayerEvents(){this.core.relayer.on(f$2.message,async e=>{const{topic:H,message:Y}=e;if(!this.pairings.keys.includes(H)||this.ignoredPayloadTypes.includes(this.core.crypto.getPayloadType(Y)))return;const Ne=await this.core.crypto.decode(H,Y);try{isJsonRpcRequest(Ne)?(this.core.history.set(H,Ne),this.onRelayEventRequest({topic:H,payload:Ne})):isJsonRpcResponse(Ne)&&(await this.core.history.resolve(Ne),await this.onRelayEventResponse({topic:H,payload:Ne}),this.core.history.delete(H,Ne.id))}catch(W){this.logger.error(W)}})}registerExpirerEvents(){this.core.expirer.on(C$1.expired,async e=>{const{topic:H}=l0(e.target);H&&this.pairings.keys.includes(H)&&(await this.deletePairing(H,!0),this.events.emit(q$1.expire,{topic:H}))})}}class qt extends h$1{constructor(e,H){super(e,H),this.core=e,this.logger=H,this.records=new Map,this.events=new eventsExports.EventEmitter,this.name=It,this.version=Ct$1,this.cached=[],this.initialized=!1,this.storagePrefix=z$2,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(Y=>this.records.set(Y.id,Y)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.set=(Y,Ne,W)=>{if(this.isInitialized(),this.logger.debug("Setting JSON-RPC request history record"),this.logger.trace({type:"method",method:"set",topic:Y,request:Ne,chainId:W}),this.records.has(Ne.id))return;const ri={id:Ne.id,topic:Y,request:{method:Ne.method,params:Ne.params||null},chainId:W,expiry:d0(cjs$3.THIRTY_DAYS)};this.records.set(ri.id,ri),this.persist(),this.events.emit(I.created,ri)},this.resolve=async Y=>{if(this.isInitialized(),this.logger.debug("Updating JSON-RPC response history record"),this.logger.trace({type:"method",method:"update",response:Y}),!this.records.has(Y.id))return;const Ne=await this.getRecord(Y.id);typeof Ne.response>"u"&&(Ne.response=isJsonRpcError(Y)?{error:Y.error}:{result:Y.result},this.records.set(Ne.id,Ne),this.persist(),this.events.emit(I.updated,Ne))},this.get=async(Y,Ne)=>(this.isInitialized(),this.logger.debug("Getting record"),this.logger.trace({type:"method",method:"get",topic:Y,id:Ne}),await this.getRecord(Ne)),this.delete=(Y,Ne)=>{this.isInitialized(),this.logger.debug("Deleting record"),this.logger.trace({type:"method",method:"delete",id:Ne}),this.values.forEach(W=>{if(W.topic===Y){if(typeof Ne<"u"&&W.id!==Ne)return;this.records.delete(W.id),this.events.emit(I.deleted,W)}}),this.persist()},this.exists=async(Y,Ne)=>(this.isInitialized(),this.records.has(Ne)?(await this.getRecord(Ne)).topic===Y:!1),this.on=(Y,Ne)=>{this.events.on(Y,Ne)},this.once=(Y,Ne)=>{this.events.once(Y,Ne)},this.off=(Y,Ne)=>{this.events.off(Y,Ne)},this.removeListener=(Y,Ne)=>{this.events.removeListener(Y,Ne)},this.logger=E$4(H,this.name)}get context(){return y$4(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(H=>{if(typeof H.response<"u")return;const Y={topic:H.topic,request:formatJsonRpcRequest(H.request.method,H.request.params,H.id),chainId:H.chainId};return e.push(Y)}),e}async setJsonRpcRecords(e){await this.core.storage.setItem(this.storageKey,e)}async getJsonRpcRecords(){return await this.core.storage.getItem(this.storageKey)}getRecord(e){this.isInitialized();const H=this.records.get(e);if(!H){const{message:Y}=xe("NO_MATCHING_KEY",`${this.name}: ${e}`);throw new Error(Y)}return H}async persist(){await this.setJsonRpcRecords(this.values),this.events.emit(I.sync)}async restore(){try{const e=await this.getJsonRpcRecords();if(typeof e>"u"||!e.length)return;if(this.records.size){const{message:H}=xe("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(H),new Error(H)}this.cached=e,this.logger.debug(`Successfully Restored records for ${this.name}`),this.logger.trace({type:"method",method:"restore",records:this.values})}catch(e){this.logger.debug(`Failed to Restore records for ${this.name}`),this.logger.error(e)}}registerEventListeners(){this.events.on(I.created,e=>{const H=I.created;this.logger.info(`Emitting ${H}`),this.logger.debug({type:"event",event:H,record:e})}),this.events.on(I.updated,e=>{const H=I.updated;this.logger.info(`Emitting ${H}`),this.logger.debug({type:"event",event:H,record:e})}),this.events.on(I.deleted,e=>{const H=I.deleted;this.logger.info(`Emitting ${H}`),this.logger.debug({type:"event",event:H,record:e})}),this.core.heartbeat.on(r.pulse,()=>{this.cleanup()})}cleanup(){try{this.isInitialized();let e=!1;this.records.forEach(H=>{cjs$3.toMiliseconds(H.expiry||0)-Date.now()<=0&&(this.logger.info(`Deleting expired history log: ${H.id}`),this.records.delete(H.id),this.events.emit(I.deleted,H,!1),e=!0)}),e&&this.persist()}catch(e){this.logger.warn(e)}}isInitialized(){if(!this.initialized){const{message:e}=xe("NOT_INITIALIZED",this.name);throw new Error(e)}}}class jt extends E$3{constructor(e,H){super(e,H),this.core=e,this.logger=H,this.expirations=new Map,this.events=new eventsExports.EventEmitter,this.name=Tt,this.version=_t,this.cached=[],this.initialized=!1,this.storagePrefix=z$2,this.init=async()=>{this.initialized||(this.logger.trace("Initialized"),await this.restore(),this.cached.forEach(Y=>this.expirations.set(Y.target,Y)),this.cached=[],this.registerEventListeners(),this.initialized=!0)},this.has=Y=>{try{const Ne=this.formatTarget(Y);return typeof this.getExpiration(Ne)<"u"}catch{return!1}},this.set=(Y,Ne)=>{this.isInitialized();const W=this.formatTarget(Y),ri={target:W,expiry:Ne};this.expirations.set(W,ri),this.checkExpiry(W,ri),this.events.emit(C$1.created,{target:W,expiration:ri})},this.get=Y=>{this.isInitialized();const Ne=this.formatTarget(Y);return this.getExpiration(Ne)},this.del=Y=>{if(this.isInitialized(),this.has(Y)){const Ne=this.formatTarget(Y),W=this.getExpiration(Ne);this.expirations.delete(Ne),this.events.emit(C$1.deleted,{target:Ne,expiration:W})}},this.on=(Y,Ne)=>{this.events.on(Y,Ne)},this.once=(Y,Ne)=>{this.events.once(Y,Ne)},this.off=(Y,Ne)=>{this.events.off(Y,Ne)},this.removeListener=(Y,Ne)=>{this.events.removeListener(Y,Ne)},this.logger=E$4(H,this.name)}get context(){return y$4(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(typeof e=="string")return h0(e);if(typeof e=="number")return c0(e);const{message:H}=xe("UNKNOWN_TYPE",`Target type: ${typeof e}`);throw new Error(H)}async setExpirations(e){await this.core.storage.setItem(this.storageKey,e)}async getExpirations(){return await this.core.storage.getItem(this.storageKey)}async persist(){await this.setExpirations(this.values),this.events.emit(C$1.sync)}async restore(){try{const e=await this.getExpirations();if(typeof e>"u"||!e.length)return;if(this.expirations.size){const{message:H}=xe("RESTORE_WILL_OVERRIDE",this.name);throw this.logger.error(H),new Error(H)}this.cached=e,this.logger.debug(`Successfully Restored expirations for ${this.name}`),this.logger.trace({type:"method",method:"restore",expirations:this.values})}catch(e){this.logger.debug(`Failed to Restore expirations for ${this.name}`),this.logger.error(e)}}getExpiration(e){const H=this.expirations.get(e);if(!H){const{message:Y}=xe("NO_MATCHING_KEY",`${this.name}: ${e}`);throw this.logger.warn(Y),new Error(Y)}return H}checkExpiry(e,H){const{expiry:Y}=H;cjs$3.toMiliseconds(Y)-Date.now()<=0&&this.expire(e,H)}expire(e,H){this.expirations.delete(e),this.events.emit(C$1.expired,{target:e,expiration:H})}checkExpirations(){this.core.relayer.connected&&this.expirations.forEach((e,H)=>this.checkExpiry(H,e))}registerEventListeners(){this.core.heartbeat.on(r.pulse,()=>this.checkExpirations()),this.events.on(C$1.created,e=>{const H=C$1.created;this.logger.info(`Emitting ${H}`),this.logger.debug({type:"event",event:H,data:e}),this.persist()}),this.events.on(C$1.expired,e=>{const H=C$1.expired;this.logger.info(`Emitting ${H}`),this.logger.debug({type:"event",event:H,data:e}),this.persist()}),this.events.on(C$1.deleted,e=>{const H=C$1.deleted;this.logger.info(`Emitting ${H}`),this.logger.debug({type:"event",event:H,data:e}),this.persist()})}isInitialized(){if(!this.initialized){const{message:e}=xe("NOT_INITIALIZED",this.name);throw new Error(e)}}}class Gt extends y$3{constructor(e,H){super(e,H),this.projectId=e,this.logger=H,this.name=ee,this.initialized=!1,this.queue=[],this.verifyDisabled=!1,this.init=async Y=>{if(this.verifyDisabled||er$1()||!pr$1())return;const Ne=this.getVerifyUrl(Y==null?void 0:Y.verifyUrl);this.verifyUrl!==Ne&&this.removeIframe(),this.verifyUrl=Ne;try{await this.createIframe()}catch(W){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(W)}if(!this.initialized){this.removeIframe(),this.verifyUrl=te;try{await this.createIframe()}catch(W){this.logger.info(`Verify iframe failed to load: ${this.verifyUrl}`),this.logger.info(W),this.verifyDisabled=!0}}},this.register=async Y=>{this.initialized?this.sendPost(Y.attestationId):(this.addToQueue(Y.attestationId),await this.init())},this.resolve=async Y=>{if(this.isDevEnv)return"";const Ne=this.getVerifyUrl(Y==null?void 0:Y.verifyUrl);let W;try{W=await this.fetchAttestation(Y.attestationId,Ne)}catch(ri){this.logger.info(`failed to resolve attestation: ${Y.attestationId} from url: ${Ne}`),this.logger.info(ri),W=await this.fetchAttestation(Y.attestationId,te)}return W},this.fetchAttestation=async(Y,Ne)=>{this.logger.info(`resolving attestation: ${Y} from url: ${Ne}`);const W=this.startAbortTimer(cjs$3.ONE_SECOND*2),ri=await fetch(`${Ne}/attestation/${Y}`,{signal:this.abortController.signal});return clearTimeout(W),ri.status===200?await ri.json():void 0},this.addToQueue=Y=>{this.queue.push(Y)},this.processQueue=()=>{this.queue.length!==0&&(this.queue.forEach(Y=>this.sendPost(Y)),this.queue=[])},this.sendPost=Y=>{var Ne;try{if(!this.iframe)return;(Ne=this.iframe.contentWindow)==null||Ne.postMessage(Y,"*"),this.logger.info(`postMessage sent: ${Y} ${this.verifyUrl}`)}catch{}},this.createIframe=async()=>{let Y;const Ne=W=>{W.data==="verify_ready"&&(this.onInit(),window.removeEventListener("message",Ne),Y())};await Promise.race([new Promise(W=>{const ri=document.getElementById(ee);if(ri)return this.iframe=ri,this.onInit(),W();window.addEventListener("message",Ne);const si=document.createElement("iframe");si.id=ee,si.src=`${this.verifyUrl}/${this.projectId}`,si.style.display="none",document.body.append(si),this.iframe=si,Y=W}),new Promise((W,ri)=>setTimeout(()=>{window.removeEventListener("message",Ne),ri("verify iframe load timeout")},cjs$3.toMiliseconds(cjs$3.FIVE_SECONDS)))])},this.onInit=()=>{this.initialized=!0,this.processQueue()},this.removeIframe=()=>{this.iframe&&(this.iframe.remove(),this.iframe=void 0,this.initialized=!1)},this.getVerifyUrl=Y=>{let Ne=Y||M$2;return Rt.includes(Ne)||(this.logger.info(`verify url: ${Ne}, not included in trusted list, assigning default: ${M$2}`),Ne=M$2),Ne},this.logger=E$4(H,this.name),this.verifyUrl=M$2,this.abortController=new AbortController,this.isDevEnv=pi()&&define_process_env_default.IS_VITEST}get context(){return y$4(this.logger)}startAbortTimer(e){return this.abortController=new AbortController,setTimeout(()=>this.abortController.abort(),cjs$3.toMiliseconds(e))}}let Yt$1=class extends v$2{constructor(e,H){super(e,H),this.projectId=e,this.logger=H,this.context=St,this.registerDeviceToken=async Y=>{const{clientId:Ne,token:W,notificationType:ri,enableEncrypted:si=!1}=Y,fi=`${Pt}/${this.projectId}/clients`;await Yi(fi,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({client_id:Ne,type:ri,token:W,always_raw:si})})},this.logger=E$4(H,this.context)}};var Ur=Object.defineProperty,Ht=Object.getOwnPropertySymbols,Fr=Object.prototype.hasOwnProperty,$r=Object.prototype.propertyIsEnumerable,Jt$1=(G,e,H)=>e in G?Ur(G,e,{enumerable:!0,configurable:!0,writable:!0,value:H}):G[e]=H,Xt$1=(G,e)=>{for(var H in e||(e={}))Fr.call(e,H)&&Jt$1(G,H,e[H]);if(Ht)for(var H of Ht(e))$r.call(e,H)&&Jt$1(G,H,e[H]);return G};let ie$1=class pg extends n{constructor(e){var H;super(e),this.protocol=De,this.version=Qe$1,this.name=Z,this.events=new eventsExports.EventEmitter,this.initialized=!1,this.on=(ri,si)=>this.events.on(ri,si),this.once=(ri,si)=>this.events.once(ri,si),this.off=(ri,si)=>this.events.off(ri,si),this.removeListener=(ri,si)=>this.events.removeListener(ri,si),this.projectId=e==null?void 0:e.projectId,this.relayUrl=(e==null?void 0:e.relayUrl)||me,this.customStoragePrefix=e!=null&&e.customStoragePrefix?`:${e.customStoragePrefix}`:"";const Y=k({level:typeof(e==null?void 0:e.logger)=="string"&&e.logger?e.logger:Ze$1.logger}),{logger:Ne,chunkLoggerController:W}=A({opts:Y,maxSizeInBytes:e==null?void 0:e.maxLogBlobSizeInBytes,loggerOverride:e==null?void 0:e.logger});this.logChunkController=W,(H=this.logChunkController)!=null&&H.downloadLogsBlobInBrowser&&(window.downloadLogsBlobInBrowser=async()=>{var ri,si;(ri=this.logChunkController)!=null&&ri.downloadLogsBlobInBrowser&&((si=this.logChunkController)==null||si.downloadLogsBlobInBrowser({clientId:await this.crypto.getClientId()}))}),this.logger=E$4(Ne,this.name),this.heartbeat=new i$1,this.crypto=new Ot(this,this.logger,e==null?void 0:e.keychain),this.history=new qt(this,this.logger),this.expirer=new jt(this,this.logger),this.storage=e!=null&&e.storage?e.storage:new h$2(Xt$1(Xt$1({},et),e==null?void 0:e.storageOptions)),this.relayer=new $t({core:this,logger:this.logger,relayUrl:this.relayUrl,projectId:this.projectId}),this.pairing=new Vt(this,this.logger),this.verify=new Gt(this.projectId||"",this.logger),this.echoClient=new Yt$1(this.projectId||"",this.logger)}static async init(e){const H=new pg(e);await H.initialize();const Y=await H.crypto.getClientId();return await H.storage.setItem(mt,Y),H}get context(){return y$4(this.logger)}async start(){this.initialized||await this.initialize()}async getLogsBlob(){var e;return(e=this.logChunkController)==null?void 0:e.logsToBlob({clientId:await this.crypto.getClientId()})}async initialize(){this.logger.trace("Initialized");try{await this.crypto.init(),await this.history.init(),await this.expirer.init(),await this.relayer.init(),await this.heartbeat.init(),await this.pairing.init(),this.initialized=!0,this.logger.info("Core Initialization Success")}catch(e){throw this.logger.warn(`Core Initialization Failure at epoch ${Date.now()}`,e),this.logger.error(e.message),e}}};const Br=ie$1,Re="wc",Ee=2,Se="client",ie=`${Re}@${Ee}:${Se}:`,re={name:Se,logger:"error",controller:!1,relayUrl:"wss://relay.walletconnect.com"},_e="WALLETCONNECT_DEEPLINK_CHOICE",Ue="proposal",Ge="Proposal expired",ke="session",L$2=cjs$3.SEVEN_DAYS,Fe="engine",f$1={wc_sessionPropose:{req:{ttl:cjs$3.FIVE_MINUTES,prompt:!0,tag:1100},res:{ttl:cjs$3.FIVE_MINUTES,prompt:!1,tag:1101}},wc_sessionSettle:{req:{ttl:cjs$3.FIVE_MINUTES,prompt:!1,tag:1102},res:{ttl:cjs$3.FIVE_MINUTES,prompt:!1,tag:1103}},wc_sessionUpdate:{req:{ttl:cjs$3.ONE_DAY,prompt:!1,tag:1104},res:{ttl:cjs$3.ONE_DAY,prompt:!1,tag:1105}},wc_sessionExtend:{req:{ttl:cjs$3.ONE_DAY,prompt:!1,tag:1106},res:{ttl:cjs$3.ONE_DAY,prompt:!1,tag:1107}},wc_sessionRequest:{req:{ttl:cjs$3.FIVE_MINUTES,prompt:!0,tag:1108},res:{ttl:cjs$3.FIVE_MINUTES,prompt:!1,tag:1109}},wc_sessionEvent:{req:{ttl:cjs$3.FIVE_MINUTES,prompt:!0,tag:1110},res:{ttl:cjs$3.FIVE_MINUTES,prompt:!1,tag:1111}},wc_sessionDelete:{req:{ttl:cjs$3.ONE_DAY,prompt:!1,tag:1112},res:{ttl:cjs$3.ONE_DAY,prompt:!1,tag:1113}},wc_sessionPing:{req:{ttl:cjs$3.ONE_DAY,prompt:!1,tag:1114},res:{ttl:cjs$3.ONE_DAY,prompt:!1,tag:1115}},wc_sessionAuthenticate:{req:{ttl:cjs$3.ONE_HOUR,prompt:!0,tag:1116},res:{ttl:cjs$3.ONE_HOUR,prompt:!1,tag:1117}}},ne={min:cjs$3.FIVE_MINUTES,max:cjs$3.SEVEN_DAYS},D$1={idle:"IDLE",active:"ACTIVE"},Qe="request",je=["wc_sessionPropose","wc_sessionRequest","wc_authRequest"],ze="wc",He="auth",Ye="authKeys",Xe="pairingTopics",Je="requests",X=`${ze}@${1.5}:${He}:`,J=`${X}:PUB_KEY`;var Yt=Object.defineProperty,Xt=Object.defineProperties,Jt=Object.getOwnPropertyDescriptors,Be=Object.getOwnPropertySymbols,Bt=Object.prototype.hasOwnProperty,Wt=Object.prototype.propertyIsEnumerable,We=(G,e,H)=>e in G?Yt(G,e,{enumerable:!0,configurable:!0,writable:!0,value:H}):G[e]=H,y$1=(G,e)=>{for(var H in e||(e={}))Bt.call(e,H)&&We(G,H,e[H]);if(Be)for(var H of Be(e))Wt.call(e,H)&&We(G,H,e[H]);return G},M$1=(G,e)=>Xt(G,Jt(e));class Zt extends w$2{constructor(e){super(e),this.name=Fe,this.events=new Wg,this.initialized=!1,this.requestQueue={state:D$1.idle,queue:[]},this.sessionRequestQueue={state:D$1.idle,queue:[]},this.requestQueueDelay=cjs$3.ONE_SECOND,this.expectedPairingMethodMap=new Map,this.recentlyDeletedMap=new Map,this.recentlyDeletedLimit=200,this.init=async()=>{this.initialized||(await this.cleanup(),this.registerRelayerEvents(),this.registerExpirerEvents(),this.registerPairingEvents(),this.client.core.pairing.register({methods:Object.keys(f$1)}),this.initialized=!0,setTimeout(()=>{this.sessionRequestQueue.queue=this.getPendingSessionRequests(),this.processSessionRequestQueue()},cjs$3.toMiliseconds(this.requestQueueDelay)))},this.connect=async H=>{await this.isInitialized();const Y=M$1(y$1({},H),{requiredNamespaces:H.requiredNamespaces||{},optionalNamespaces:H.optionalNamespaces||{}});await this.isValidConnect(Y);const{pairingTopic:Ne,requiredNamespaces:W,optionalNamespaces:ri,sessionProperties:si,relays:fi}=Y;let ai=Ne,ti,hi=!1;try{ai&&(hi=this.client.core.pairing.pairings.get(ai).active)}catch(cn){throw this.client.logger.error(`connect() -> pairing.get(${ai}) failed`),cn}if(!ai||!hi){const{topic:cn,uri:An}=await this.client.core.pairing.create();ai=cn,ti=An}if(!ai){const{message:cn}=xe("NO_MATCHING_KEY",`connect() pairing topic: ${ai}`);throw new Error(cn)}const ci=await this.client.core.crypto.generateKeyPair(),ui=f$1.wc_sessionPropose.req.ttl||cjs$3.FIVE_MINUTES,li=d0(ui),mi=y$1({requiredNamespaces:W,optionalNamespaces:ri,relays:fi??[{protocol:ct}],proposer:{publicKey:ci,metadata:this.client.metadata},expiryTimestamp:li},si&&{sessionProperties:si}),{reject:hn,resolve:ln,done:fn}=a0(ui,Ge);this.events.once(v0("session_connect"),async({error:cn,session:An})=>{if(cn)hn(cn);else if(An){An.self.publicKey=ci;const Cn=M$1(y$1({},An),{requiredNamespaces:mi.requiredNamespaces,optionalNamespaces:mi.optionalNamespaces});await this.client.session.set(An.topic,Cn),await this.setExpiry(An.topic,An.expiry),ai&&await this.client.core.pairing.updateMetadata({topic:ai,metadata:An.peer.metadata}),ln(Cn)}});const gn=await this.sendRequest({topic:ai,method:"wc_sessionPropose",params:mi,throwOnFailedPublish:!0});return await this.setProposal(gn,y$1({id:gn},mi)),{uri:ti,approval:fn}},this.pair=async H=>{await this.isInitialized();try{return await this.client.core.pairing.pair(H)}catch(Y){throw this.client.logger.error("pair() failed"),Y}},this.approve=async H=>{await this.isInitialized();try{await this.isValidApprove(H)}catch(fn){throw this.client.logger.error("approve() -> isValidApprove() failed"),fn}const{id:Y,relayProtocol:Ne,namespaces:W,sessionProperties:ri,sessionConfig:si}=H;let fi;try{fi=this.client.proposal.get(Y)}catch(fn){throw this.client.logger.error(`approve() -> proposal.get(${Y}) failed`),fn}let{pairingTopic:ai,proposer:ti,requiredNamespaces:hi,optionalNamespaces:ci}=fi;ai=ai||"";const ui=await this.client.core.crypto.generateKeyPair(),li=ti.publicKey,mi=await this.client.core.crypto.generateSharedKey(ui,li),hn=y$1(y$1({relay:{protocol:Ne??"irn"},namespaces:W,pairingTopic:ai,controller:{publicKey:ui,metadata:this.client.metadata},expiry:d0(L$2)},ri&&{sessionProperties:ri}),si&&{sessionConfig:si});await this.client.core.relayer.subscribe(mi);const ln=M$1(y$1({},hn),{topic:mi,requiredNamespaces:hi,optionalNamespaces:ci,pairingTopic:ai,acknowledged:!1,self:hn.controller,peer:{publicKey:ti.publicKey,metadata:ti.metadata},controller:ui});await this.client.session.set(mi,ln);try{await this.sendResult({id:Y,topic:ai,result:{relay:{protocol:Ne??"irn"},responderPublicKey:ui},throwOnFailedPublish:!0}),await this.sendRequest({topic:mi,method:"wc_sessionSettle",params:hn,throwOnFailedPublish:!0})}catch(fn){throw this.client.logger.error(fn),this.client.session.delete(mi,tr$1("USER_DISCONNECTED")),await this.client.core.relayer.unsubscribe(mi),fn}return await this.client.core.pairing.updateMetadata({topic:ai,metadata:ti.metadata}),await this.client.proposal.delete(Y,tr$1("USER_DISCONNECTED")),await this.client.core.pairing.activate({topic:ai}),await this.setExpiry(mi,d0(L$2)),{topic:mi,acknowledged:()=>new Promise(fn=>setTimeout(()=>fn(this.client.session.get(mi)),500))}},this.reject=async H=>{await this.isInitialized();try{await this.isValidReject(H)}catch(ri){throw this.client.logger.error("reject() -> isValidReject() failed"),ri}const{id:Y,reason:Ne}=H;let W;try{W=this.client.proposal.get(Y).pairingTopic}catch(ri){throw this.client.logger.error(`reject() -> proposal.get(${Y}) failed`),ri}W&&(await this.sendError({id:Y,topic:W,error:Ne}),await this.client.proposal.delete(Y,tr$1("USER_DISCONNECTED")))},this.update=async H=>{await this.isInitialized();try{await this.isValidUpdate(H)}catch(hi){throw this.client.logger.error("update() -> isValidUpdate() failed"),hi}const{topic:Y,namespaces:Ne}=H,{done:W,resolve:ri,reject:si}=a0(),fi=payloadId(),ai=getBigIntRpcId().toString(),ti=this.client.session.get(Y).namespaces;return this.events.once(v0("session_update",fi),({error:hi})=>{hi?si(hi):ri()}),await this.client.session.update(Y,{namespaces:Ne}),await this.sendRequest({topic:Y,method:"wc_sessionUpdate",params:{namespaces:Ne},throwOnFailedPublish:!0,clientRpcId:fi,relayRpcId:ai}).catch(hi=>{this.client.logger.error(hi),this.client.session.update(Y,{namespaces:ti}),si(hi)}),{acknowledged:W}},this.extend=async H=>{await this.isInitialized();try{await this.isValidExtend(H)}catch(fi){throw this.client.logger.error("extend() -> isValidExtend() failed"),fi}const{topic:Y}=H,Ne=payloadId(),{done:W,resolve:ri,reject:si}=a0();return this.events.once(v0("session_extend",Ne),({error:fi})=>{fi?si(fi):ri()}),await this.setExpiry(Y,d0(L$2)),this.sendRequest({topic:Y,method:"wc_sessionExtend",params:{},clientRpcId:Ne,throwOnFailedPublish:!0}).catch(fi=>{si(fi)}),{acknowledged:W}},this.request=async H=>{await this.isInitialized();try{await this.isValidRequest(H)}catch(ui){throw this.client.logger.error("request() -> isValidRequest() failed"),ui}const{chainId:Y,request:Ne,topic:W,expiry:ri=f$1.wc_sessionRequest.req.ttl}=H,si=this.client.session.get(W),fi=payloadId(),ai=getBigIntRpcId().toString(),{done:ti,resolve:hi,reject:ci}=a0(ri,"Request expired. Please try again.");return this.events.once(v0("session_request",fi),({error:ui,result:li})=>{ui?ci(ui):hi(li)}),await Promise.all([new Promise(async ui=>{await this.sendRequest({clientRpcId:fi,relayRpcId:ai,topic:W,method:"wc_sessionRequest",params:{request:M$1(y$1({},Ne),{expiryTimestamp:d0(ri)}),chainId:Y},expiry:ri,throwOnFailedPublish:!0}).catch(li=>ci(li)),this.client.events.emit("session_request_sent",{topic:W,request:Ne,chainId:Y,id:fi}),ui()}),new Promise(async ui=>{var li;if(!((li=si.sessionConfig)!=null&&li.disableDeepLink)){const mi=await g0(this.client.core.storage,_e);m0({id:fi,topic:W,wcDeepLink:mi})}ui()}),ti()]).then(ui=>ui[2])},this.respond=async H=>{await this.isInitialized(),await this.isValidRespond(H);const{topic:Y,response:Ne}=H,{id:W}=Ne;isJsonRpcResult(Ne)?await this.sendResult({id:W,topic:Y,result:Ne.result,throwOnFailedPublish:!0}):isJsonRpcError(Ne)&&await this.sendError({id:W,topic:Y,error:Ne.error}),this.cleanupAfterResponse(H)},this.ping=async H=>{await this.isInitialized();try{await this.isValidPing(H)}catch(Ne){throw this.client.logger.error("ping() -> isValidPing() failed"),Ne}const{topic:Y}=H;if(this.client.session.keys.includes(Y)){const Ne=payloadId(),W=getBigIntRpcId().toString(),{done:ri,resolve:si,reject:fi}=a0();this.events.once(v0("session_ping",Ne),({error:ai})=>{ai?fi(ai):si()}),await Promise.all([this.sendRequest({topic:Y,method:"wc_sessionPing",params:{},throwOnFailedPublish:!0,clientRpcId:Ne,relayRpcId:W}),ri()])}else this.client.core.pairing.pairings.keys.includes(Y)&&await this.client.core.pairing.ping({topic:Y})},this.emit=async H=>{await this.isInitialized(),await this.isValidEmit(H);const{topic:Y,event:Ne,chainId:W}=H,ri=getBigIntRpcId().toString();await this.sendRequest({topic:Y,method:"wc_sessionEvent",params:{event:Ne,chainId:W},throwOnFailedPublish:!0,relayRpcId:ri})},this.disconnect=async H=>{await this.isInitialized(),await this.isValidDisconnect(H);const{topic:Y}=H;if(this.client.session.keys.includes(Y))await this.sendRequest({topic:Y,method:"wc_sessionDelete",params:tr$1("USER_DISCONNECTED"),throwOnFailedPublish:!0}),await this.deleteSession({topic:Y,emitEvent:!1});else if(this.client.core.pairing.pairings.keys.includes(Y))await this.client.core.pairing.disconnect({topic:Y});else{const{message:Ne}=xe("MISMATCHED_TOPIC",`Session or pairing topic not found: ${Y}`);throw new Error(Ne)}},this.find=H=>(this.isInitialized(),this.client.session.getAll().filter(Y=>Qu(Y,H))),this.getPendingSessionRequests=()=>this.client.pendingRequest.getAll(),this.authenticate=async H=>{this.isInitialized(),this.isValidAuthenticate(H);const{chains:Y,statement:Ne="",uri:W,domain:ri,nonce:si,type:fi,exp:ai,nbf:ti,methods:hi=[],expiry:ci}=H,ui=[...H.resources||[]],{topic:li,uri:mi}=await this.client.core.pairing.create({methods:["wc_sessionAuthenticate"]});this.client.logger.info({message:"Generated new pairing",pairing:{topic:li,uri:mi}});const hn=await this.client.core.crypto.generateKeyPair(),ln=bu(hn);if(await Promise.all([this.client.auth.authKeys.set(J,{responseTopic:ln,publicKey:hn}),this.client.auth.pairingTopics.set(ln,{topic:ln,pairingTopic:li})]),await this.client.core.relayer.subscribe(ln),this.client.logger.info(`sending request to new pairing topic: ${li}`),hi.length>0){const{namespace:F}=dn(Y[0]);let Ie=cu(F,"request",hi);Qr(ui)&&(Ie=lu(Ie,ui.pop())),ui.push(Ie)}const fn=ci&&ci>f$1.wc_sessionAuthenticate.req.ttl?ci:f$1.wc_sessionAuthenticate.req.ttl,gn={authPayload:{type:fi??"caip122",chains:Y,statement:Ne,aud:W,domain:ri,version:"1",nonce:si,iat:new Date().toISOString(),exp:ai,nbf:ti,resources:ui},requester:{publicKey:hn,metadata:this.client.metadata},expiryTimestamp:d0(fn)},cn={eip155:{chains:Y,methods:[...new Set(["personal_sign",...hi])],events:["chainChanged","accountsChanged"]}},An={requiredNamespaces:{},optionalNamespaces:cn,relays:[{protocol:"irn"}],proposer:{publicKey:hn,metadata:this.client.metadata},expiryTimestamp:d0(f$1.wc_sessionPropose.req.ttl)},{done:Cn,resolve:an,reject:Rn}=a0(fn,"Request expired"),Ya=async({error:F,session:Ie})=>{if(this.events.off(v0("session_request",oi),Ho),F)Rn(F);else if(Ie){Ie.self.publicKey=hn,await this.client.session.set(Ie.topic,Ie),await this.setExpiry(Ie.topic,Ie.expiry),li&&await this.client.core.pairing.updateMetadata({topic:li,metadata:Ie.peer.metadata});const Te=this.client.session.get(Ie.topic);await this.deleteProposal(t),an({session:Te})}},Ho=async F=>{if(await this.deletePendingAuthRequest(oi,{message:"fulfilled",code:0}),F.error){const R=tr$1("WC_METHOD_UNSUPPORTED","wc_sessionAuthenticate");return F.error.code===R.code?void 0:(this.events.off(v0("session_connect"),Ya),Rn(F.error.message))}await this.deleteProposal(t),this.events.off(v0("session_connect"),Ya);const{cacaos:Ie,responder:Te}=F.result,Xr=[],ei=[];for(const R of Ie){await ou({cacao:R,projectId:this.client.core.projectId})||(this.client.logger.error(R,"Signature verification failed"),Rn(tr$1("SESSION_SETTLEMENT_FAILED","Signature verification failed")));const{p:Le}=R,nn=Qr(Le.resources),vn=[fu(Le.iss)],Mn=Li(Le.iss);if(nn){const sn=du(nn),Zn=pu(nn);Xr.push(...sn),vn.push(...Zn)}for(const sn of vn)ei.push(`${sn}:${Mn}`)}const ii=await this.client.core.crypto.generateSharedKey(hn,Te.publicKey);let Wr;Xr.length>0&&(Wr={topic:ii,acknowledged:!0,self:{publicKey:hn,metadata:this.client.metadata},peer:Te,controller:Te.publicKey,expiry:d0(L$2),requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:li,namespaces:ju([...new Set(Xr)],[...new Set(ei)])},await this.client.core.relayer.subscribe(ii),await this.client.session.set(ii,Wr),Wr=this.client.session.get(ii)),an({auths:Ie,session:Wr})},oi=payloadId(),t=payloadId();this.events.once(v0("session_connect"),Ya),this.events.once(v0("session_request",oi),Ho);try{await Promise.all([this.sendRequest({topic:li,method:"wc_sessionAuthenticate",params:gn,expiry:H.expiry,throwOnFailedPublish:!0,clientRpcId:oi}),this.sendRequest({topic:li,method:"wc_sessionPropose",params:An,expiry:f$1.wc_sessionPropose.req.ttl,throwOnFailedPublish:!0,clientRpcId:t})])}catch(F){throw this.events.off(v0("session_connect"),Ya),this.events.off(v0("session_request",oi),Ho),F}return await this.setProposal(t,y$1({id:t},An)),await this.setAuthRequest(oi,{request:M$1(y$1({},gn),{verifyContext:{}}),pairingTopic:li}),{uri:mi,response:Cn}},this.approveSessionAuthenticate=async H=>{this.isInitialized();const{id:Y,auths:Ne}=H,W=this.getPendingAuthRequest(Y);if(!W)throw new Error(`Could not find pending auth request with id ${Y}`);const ri=W.requester.publicKey,si=await this.client.core.crypto.generateKeyPair(),fi=bu(ri),ai={type:lr$2,receiverPublicKey:ri,senderPublicKey:si},ti=[],hi=[];for(const li of Ne){if(!await ou({cacao:li,projectId:this.client.core.projectId})){const gn=tr$1("SESSION_SETTLEMENT_FAILED","Signature verification failed");throw await this.sendError({id:Y,topic:fi,error:gn,encodeOpts:ai}),new Error(gn.message)}const{p:mi}=li,hn=Qr(mi.resources),ln=[fu(mi.iss)],fn=Li(mi.iss);if(hn){const gn=du(hn),cn=pu(hn);ti.push(...gn),ln.push(...cn)}for(const gn of ln)hi.push(`${gn}:${fn}`)}const ci=await this.client.core.crypto.generateSharedKey(si,ri);let ui;return(ti==null?void 0:ti.length)>0&&(ui={topic:ci,acknowledged:!0,self:{publicKey:si,metadata:this.client.metadata},peer:{publicKey:ri,metadata:W.requester.metadata},controller:ri,expiry:d0(L$2),authentication:Ne,requiredNamespaces:{},optionalNamespaces:{},relay:{protocol:"irn"},pairingTopic:"",namespaces:ju([...new Set(ti)],[...new Set(hi)])},await this.client.core.relayer.subscribe(ci),await this.client.session.set(ci,ui)),await this.sendResult({topic:fi,id:Y,result:{cacaos:Ne,responder:{publicKey:si,metadata:this.client.metadata}},encodeOpts:ai,throwOnFailedPublish:!0}),await this.client.auth.requests.delete(Y,{message:"fullfilled",code:0}),await this.client.core.pairing.activate({topic:W.pairingTopic}),{session:ui}},this.rejectSessionAuthenticate=async H=>{await this.isInitialized();const{id:Y,reason:Ne}=H,W=this.getPendingAuthRequest(Y);if(!W)throw new Error(`Could not find pending auth request with id ${Y}`);const ri=W.requester.publicKey,si=await this.client.core.crypto.generateKeyPair(),fi=bu(ri),ai={type:lr$2,receiverPublicKey:ri,senderPublicKey:si};await this.sendError({id:Y,topic:fi,error:Ne,encodeOpts:ai}),await this.client.auth.requests.delete(Y,{message:"rejected",code:0}),await this.client.proposal.delete(Y,tr$1("USER_DISCONNECTED"))},this.formatAuthMessage=H=>{this.isInitialized();const{request:Y,iss:Ne}=H;return zf(Y,Ne)},this.cleanupDuplicatePairings=async H=>{if(H.pairingTopic)try{const Y=this.client.core.pairing.pairings.get(H.pairingTopic),Ne=this.client.core.pairing.pairings.getAll().filter(W=>{var ri,si;return((ri=W.peerMetadata)==null?void 0:ri.url)&&((si=W.peerMetadata)==null?void 0:si.url)===H.peer.metadata.url&&W.topic&&W.topic!==Y.topic});if(Ne.length===0)return;this.client.logger.info(`Cleaning up ${Ne.length} duplicate pairing(s)`),await Promise.all(Ne.map(W=>this.client.core.pairing.disconnect({topic:W.topic}))),this.client.logger.info("Duplicate pairings clean up finished")}catch(Y){this.client.logger.error(Y)}},this.deleteSession=async H=>{const{topic:Y,expirerHasDeleted:Ne=!1,emitEvent:W=!0,id:ri=0}=H,{self:si}=this.client.session.get(Y);await this.client.core.relayer.unsubscribe(Y),await this.client.session.delete(Y,tr$1("USER_DISCONNECTED")),this.addToRecentlyDeleted(Y,"session"),this.client.core.crypto.keychain.has(si.publicKey)&&await this.client.core.crypto.deleteKeyPair(si.publicKey),this.client.core.crypto.keychain.has(Y)&&await this.client.core.crypto.deleteSymKey(Y),Ne||this.client.core.expirer.del(Y),this.client.core.storage.removeItem(_e).catch(fi=>this.client.logger.warn(fi)),this.getPendingSessionRequests().forEach(fi=>{fi.topic===Y&&this.deletePendingSessionRequest(fi.id,tr$1("USER_DISCONNECTED"))}),W&&this.client.events.emit("session_delete",{id:ri,topic:Y})},this.deleteProposal=async(H,Y)=>{await Promise.all([this.client.proposal.delete(H,tr$1("USER_DISCONNECTED")),Y?Promise.resolve():this.client.core.expirer.del(H)]),this.addToRecentlyDeleted(H,"proposal")},this.deletePendingSessionRequest=async(H,Y,Ne=!1)=>{await Promise.all([this.client.pendingRequest.delete(H,Y),Ne?Promise.resolve():this.client.core.expirer.del(H)]),this.addToRecentlyDeleted(H,"request"),this.sessionRequestQueue.queue=this.sessionRequestQueue.queue.filter(W=>W.id!==H),Ne&&(this.sessionRequestQueue.state=D$1.idle,this.client.events.emit("session_request_expire",{id:H}))},this.deletePendingAuthRequest=async(H,Y,Ne=!1)=>{await Promise.all([this.client.auth.requests.delete(H,Y),Ne?Promise.resolve():this.client.core.expirer.del(H)])},this.setExpiry=async(H,Y)=>{this.client.session.keys.includes(H)&&(this.client.core.expirer.set(H,Y),await this.client.session.update(H,{expiry:Y}))},this.setProposal=async(H,Y)=>{this.client.core.expirer.set(H,d0(f$1.wc_sessionPropose.req.ttl)),await this.client.proposal.set(H,Y)},this.setAuthRequest=async(H,Y)=>{const{request:Ne,pairingTopic:W}=Y;this.client.core.expirer.set(H,Ne.expiryTimestamp),await this.client.auth.requests.set(H,{authPayload:Ne.authPayload,requester:Ne.requester,expiryTimestamp:Ne.expiryTimestamp,id:H,pairingTopic:W,verifyContext:Ne.verifyContext})},this.setPendingSessionRequest=async H=>{const{id:Y,topic:Ne,params:W,verifyContext:ri}=H,si=W.request.expiryTimestamp||d0(f$1.wc_sessionRequest.req.ttl);this.client.core.expirer.set(Y,si),await this.client.pendingRequest.set(Y,{id:Y,topic:Ne,params:W,verifyContext:ri})},this.sendRequest=async H=>{const{topic:Y,method:Ne,params:W,expiry:ri,relayRpcId:si,clientRpcId:fi,throwOnFailedPublish:ai}=H,ti=formatJsonRpcRequest(Ne,W,fi);if(pr$1()&&je.includes(Ne)){const ui=yu(JSON.stringify(ti));this.client.core.verify.register({attestationId:ui})}let hi;try{hi=await this.client.core.crypto.encode(Y,ti)}catch(ui){throw await this.cleanup(),this.client.logger.error(`sendRequest() -> core.crypto.encode() for topic ${Y} failed`),ui}const ci=f$1[Ne].req;return ri&&(ci.ttl=ri),si&&(ci.id=si),this.client.core.history.set(Y,ti),ai?(ci.internal=M$1(y$1({},ci.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(Y,hi,ci)):this.client.core.relayer.publish(Y,hi,ci).catch(ui=>this.client.logger.error(ui)),ti.id},this.sendResult=async H=>{const{id:Y,topic:Ne,result:W,throwOnFailedPublish:ri,encodeOpts:si}=H,fi=formatJsonRpcResult(Y,W);let ai;try{ai=await this.client.core.crypto.encode(Ne,fi,si)}catch(ci){throw await this.cleanup(),this.client.logger.error(`sendResult() -> core.crypto.encode() for topic ${Ne} failed`),ci}let ti;try{ti=await this.client.core.history.get(Ne,Y)}catch(ci){throw this.client.logger.error(`sendResult() -> history.get(${Ne}, ${Y}) failed`),ci}const hi=f$1[ti.request.method].res;ri?(hi.internal=M$1(y$1({},hi.internal),{throwOnFailedPublish:!0}),await this.client.core.relayer.publish(Ne,ai,hi)):this.client.core.relayer.publish(Ne,ai,hi).catch(ci=>this.client.logger.error(ci)),await this.client.core.history.resolve(fi)},this.sendError=async H=>{const{id:Y,topic:Ne,error:W,encodeOpts:ri}=H,si=formatJsonRpcError(Y,W);let fi;try{fi=await this.client.core.crypto.encode(Ne,si,ri)}catch(hi){throw await this.cleanup(),this.client.logger.error(`sendError() -> core.crypto.encode() for topic ${Ne} failed`),hi}let ai;try{ai=await this.client.core.history.get(Ne,Y)}catch(hi){throw this.client.logger.error(`sendError() -> history.get(${Ne}, ${Y}) failed`),hi}const ti=f$1[ai.request.method].res;this.client.core.relayer.publish(Ne,fi,ti),await this.client.core.history.resolve(si)},this.cleanup=async()=>{const H=[],Y=[];this.client.session.getAll().forEach(Ne=>{let W=!1;p0(Ne.expiry)&&(W=!0),this.client.core.crypto.keychain.has(Ne.topic)||(W=!0),W&&H.push(Ne.topic)}),this.client.proposal.getAll().forEach(Ne=>{p0(Ne.expiryTimestamp)&&Y.push(Ne.id)}),await Promise.all([...H.map(Ne=>this.deleteSession({topic:Ne})),...Y.map(Ne=>this.deleteProposal(Ne))])},this.onRelayEventRequest=async H=>{this.requestQueue.queue.push(H),await this.processRequestsQueue()},this.processRequestsQueue=async()=>{if(this.requestQueue.state===D$1.active){this.client.logger.info("Request queue already active, skipping...");return}for(this.client.logger.info(`Request queue starting with ${this.requestQueue.queue.length} requests`);this.requestQueue.queue.length>0;){this.requestQueue.state=D$1.active;const H=this.requestQueue.queue.shift();if(H)try{this.processRequest(H),await new Promise(Y=>setTimeout(Y,300))}catch(Y){this.client.logger.warn(Y)}}this.requestQueue.state=D$1.idle},this.processRequest=H=>{const{topic:Y,payload:Ne}=H,W=Ne.method;if(!this.shouldIgnorePairingRequest({topic:Y,requestMethod:W}))switch(W){case"wc_sessionPropose":return this.onSessionProposeRequest(Y,Ne);case"wc_sessionSettle":return this.onSessionSettleRequest(Y,Ne);case"wc_sessionUpdate":return this.onSessionUpdateRequest(Y,Ne);case"wc_sessionExtend":return this.onSessionExtendRequest(Y,Ne);case"wc_sessionPing":return this.onSessionPingRequest(Y,Ne);case"wc_sessionDelete":return this.onSessionDeleteRequest(Y,Ne);case"wc_sessionRequest":return this.onSessionRequest(Y,Ne);case"wc_sessionEvent":return this.onSessionEventRequest(Y,Ne);case"wc_sessionAuthenticate":return this.onSessionAuthenticateRequest(Y,Ne);default:return this.client.logger.info(`Unsupported request method ${W}`)}},this.onRelayEventResponse=async H=>{const{topic:Y,payload:Ne}=H,W=(await this.client.core.history.get(Y,Ne.id)).request.method;switch(W){case"wc_sessionPropose":return this.onSessionProposeResponse(Y,Ne);case"wc_sessionSettle":return this.onSessionSettleResponse(Y,Ne);case"wc_sessionUpdate":return this.onSessionUpdateResponse(Y,Ne);case"wc_sessionExtend":return this.onSessionExtendResponse(Y,Ne);case"wc_sessionPing":return this.onSessionPingResponse(Y,Ne);case"wc_sessionRequest":return this.onSessionRequestResponse(Y,Ne);case"wc_sessionAuthenticate":return this.onSessionAuthenticateResponse(Y,Ne);default:return this.client.logger.info(`Unsupported response method ${W}`)}},this.onRelayEventUnknownPayload=H=>{const{topic:Y}=H,{message:Ne}=xe("MISSING_OR_INVALID",`Decoded payload on topic ${Y} is not identifiable as a JSON-RPC request or a response.`);throw new Error(Ne)},this.shouldIgnorePairingRequest=H=>{const{topic:Y,requestMethod:Ne}=H,W=this.expectedPairingMethodMap.get(Y);return!W||W.includes(Ne)?!1:!!(W.includes("wc_sessionAuthenticate")&&this.client.events.listenerCount("session_authenticate")>0)},this.onSessionProposeRequest=async(H,Y)=>{const{params:Ne,id:W}=Y;try{this.isValidConnect(y$1({},Y.params));const ri=Ne.expiryTimestamp||d0(f$1.wc_sessionPropose.req.ttl),si=y$1({id:W,pairingTopic:H,expiryTimestamp:ri},Ne);await this.setProposal(W,si);const fi=yu(JSON.stringify(Y)),ai=await this.getVerifyContext(fi,si.proposer.metadata);this.client.events.emit("session_proposal",{id:W,params:si,verifyContext:ai})}catch(ri){await this.sendError({id:W,topic:H,error:ri}),this.client.logger.error(ri)}},this.onSessionProposeResponse=async(H,Y)=>{const{id:Ne}=Y;if(isJsonRpcResult(Y)){const{result:W}=Y;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",result:W});const ri=this.client.proposal.get(Ne);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",proposal:ri});const si=ri.proposer.publicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",selfPublicKey:si});const fi=W.responderPublicKey;this.client.logger.trace({type:"method",method:"onSessionProposeResponse",peerPublicKey:fi});const ai=await this.client.core.crypto.generateSharedKey(si,fi);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",sessionTopic:ai});const ti=await this.client.core.relayer.subscribe(ai);this.client.logger.trace({type:"method",method:"onSessionProposeResponse",subscriptionId:ti}),await this.client.core.pairing.activate({topic:H})}else if(isJsonRpcError(Y)){await this.client.proposal.delete(Ne,tr$1("USER_DISCONNECTED"));const W=v0("session_connect");if(this.events.listenerCount(W)===0)throw new Error(`emitting ${W} without any listeners, 954`);this.events.emit(v0("session_connect"),{error:Y.error})}},this.onSessionSettleRequest=async(H,Y)=>{const{id:Ne,params:W}=Y;try{this.isValidSessionSettleRequest(W);const{relay:ri,controller:si,expiry:fi,namespaces:ai,sessionProperties:ti,pairingTopic:hi,sessionConfig:ci}=Y.params,ui=y$1(y$1({topic:H,relay:ri,expiry:fi,namespaces:ai,acknowledged:!0,pairingTopic:hi,requiredNamespaces:{},optionalNamespaces:{},controller:si.publicKey,self:{publicKey:"",metadata:this.client.metadata},peer:{publicKey:si.publicKey,metadata:si.metadata}},ti&&{sessionProperties:ti}),ci&&{sessionConfig:ci});await this.sendResult({id:Y.id,topic:H,result:!0,throwOnFailedPublish:!0});const li=v0("session_connect");if(this.events.listenerCount(li)===0)throw new Error(`emitting ${li} without any listeners 997`);this.events.emit(v0("session_connect"),{session:ui}),this.cleanupDuplicatePairings(ui)}catch(ri){await this.sendError({id:Ne,topic:H,error:ri}),this.client.logger.error(ri)}},this.onSessionSettleResponse=async(H,Y)=>{const{id:Ne}=Y;isJsonRpcResult(Y)?(await this.client.session.update(H,{acknowledged:!0}),this.events.emit(v0("session_approve",Ne),{})):isJsonRpcError(Y)&&(await this.client.session.delete(H,tr$1("USER_DISCONNECTED")),this.events.emit(v0("session_approve",Ne),{error:Y.error}))},this.onSessionUpdateRequest=async(H,Y)=>{const{params:Ne,id:W}=Y;try{const ri=`${H}_session_update`,si=lh.get(ri);if(si&&this.isRequestOutOfSync(si,W)){this.client.logger.info(`Discarding out of sync request - ${W}`),this.sendError({id:W,topic:H,error:tr$1("INVALID_UPDATE_REQUEST")});return}this.isValidUpdate(y$1({topic:H},Ne));try{lh.set(ri,W),await this.client.session.update(H,{namespaces:Ne.namespaces}),await this.sendResult({id:W,topic:H,result:!0,throwOnFailedPublish:!0})}catch(fi){throw lh.delete(ri),fi}this.client.events.emit("session_update",{id:W,topic:H,params:Ne})}catch(ri){await this.sendError({id:W,topic:H,error:ri}),this.client.logger.error(ri)}},this.isRequestOutOfSync=(H,Y)=>parseInt(Y.toString().slice(0,-3))<=parseInt(H.toString().slice(0,-3)),this.onSessionUpdateResponse=(H,Y)=>{const{id:Ne}=Y,W=v0("session_update",Ne);if(this.events.listenerCount(W)===0)throw new Error(`emitting ${W} without any listeners`);isJsonRpcResult(Y)?this.events.emit(v0("session_update",Ne),{}):isJsonRpcError(Y)&&this.events.emit(v0("session_update",Ne),{error:Y.error})},this.onSessionExtendRequest=async(H,Y)=>{const{id:Ne}=Y;try{this.isValidExtend({topic:H}),await this.setExpiry(H,d0(L$2)),await this.sendResult({id:Ne,topic:H,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_extend",{id:Ne,topic:H})}catch(W){await this.sendError({id:Ne,topic:H,error:W}),this.client.logger.error(W)}},this.onSessionExtendResponse=(H,Y)=>{const{id:Ne}=Y,W=v0("session_extend",Ne);if(this.events.listenerCount(W)===0)throw new Error(`emitting ${W} without any listeners`);isJsonRpcResult(Y)?this.events.emit(v0("session_extend",Ne),{}):isJsonRpcError(Y)&&this.events.emit(v0("session_extend",Ne),{error:Y.error})},this.onSessionPingRequest=async(H,Y)=>{const{id:Ne}=Y;try{this.isValidPing({topic:H}),await this.sendResult({id:Ne,topic:H,result:!0,throwOnFailedPublish:!0}),this.client.events.emit("session_ping",{id:Ne,topic:H})}catch(W){await this.sendError({id:Ne,topic:H,error:W}),this.client.logger.error(W)}},this.onSessionPingResponse=(H,Y)=>{const{id:Ne}=Y,W=v0("session_ping",Ne);if(this.events.listenerCount(W)===0)throw new Error(`emitting ${W} without any listeners`);setTimeout(()=>{isJsonRpcResult(Y)?this.events.emit(v0("session_ping",Ne),{}):isJsonRpcError(Y)&&this.events.emit(v0("session_ping",Ne),{error:Y.error})},500)},this.onSessionDeleteRequest=async(H,Y)=>{const{id:Ne}=Y;try{this.isValidDisconnect({topic:H,reason:Y.params}),await Promise.all([new Promise(W=>{this.client.core.relayer.once(f$2.publish,async()=>{W(await this.deleteSession({topic:H,id:Ne}))})}),this.sendResult({id:Ne,topic:H,result:!0,throwOnFailedPublish:!0}),this.cleanupPendingSentRequestsForTopic({topic:H,error:tr$1("USER_DISCONNECTED")})])}catch(W){this.client.logger.error(W)}},this.onSessionRequest=async(H,Y)=>{var Ne;const{id:W,params:ri}=Y;try{await this.isValidRequest(y$1({topic:H},ri));const si=yu(JSON.stringify(formatJsonRpcRequest("wc_sessionRequest",ri,W))),fi=this.client.session.get(H),ai=await this.getVerifyContext(si,fi.peer.metadata),ti={id:W,topic:H,params:ri,verifyContext:ai};await this.setPendingSessionRequest(ti),(Ne=this.client.signConfig)!=null&&Ne.disableRequestQueue?this.emitSessionRequest(ti):(this.addSessionRequestToSessionRequestQueue(ti),this.processSessionRequestQueue())}catch(si){await this.sendError({id:W,topic:H,error:si}),this.client.logger.error(si)}},this.onSessionRequestResponse=(H,Y)=>{const{id:Ne}=Y,W=v0("session_request",Ne);if(this.events.listenerCount(W)===0)throw new Error(`emitting ${W} without any listeners`);isJsonRpcResult(Y)?this.events.emit(v0("session_request",Ne),{result:Y.result}):isJsonRpcError(Y)&&this.events.emit(v0("session_request",Ne),{error:Y.error})},this.onSessionEventRequest=async(H,Y)=>{const{id:Ne,params:W}=Y;try{const ri=`${H}_session_event_${W.event.name}`,si=lh.get(ri);if(si&&this.isRequestOutOfSync(si,Ne)){this.client.logger.info(`Discarding out of sync request - ${Ne}`);return}this.isValidEmit(y$1({topic:H},W)),this.client.events.emit("session_event",{id:Ne,topic:H,params:W}),lh.set(ri,Ne)}catch(ri){await this.sendError({id:Ne,topic:H,error:ri}),this.client.logger.error(ri)}},this.onSessionAuthenticateResponse=(H,Y)=>{const{id:Ne}=Y;this.client.logger.trace({type:"method",method:"onSessionAuthenticateResponse",topic:H,payload:Y}),isJsonRpcResult(Y)?this.events.emit(v0("session_request",Ne),{result:Y.result}):isJsonRpcError(Y)&&this.events.emit(v0("session_request",Ne),{error:Y.error})},this.onSessionAuthenticateRequest=async(H,Y)=>{const{requester:Ne,authPayload:W,expiryTimestamp:ri}=Y.params,si=yu(JSON.stringify(Y)),fi=await this.getVerifyContext(si,this.client.metadata),ai={requester:Ne,pairingTopic:H,id:Y.id,authPayload:W,verifyContext:fi,expiryTimestamp:ri};await this.setAuthRequest(Y.id,{request:ai,pairingTopic:H}),this.client.events.emit("session_authenticate",{topic:H,params:Y.params,id:Y.id})},this.addSessionRequestToSessionRequestQueue=H=>{this.sessionRequestQueue.queue.push(H)},this.cleanupAfterResponse=H=>{this.deletePendingSessionRequest(H.response.id,{message:"fulfilled",code:0}),setTimeout(()=>{this.sessionRequestQueue.state=D$1.idle,this.processSessionRequestQueue()},cjs$3.toMiliseconds(this.requestQueueDelay))},this.cleanupPendingSentRequestsForTopic=({topic:H,error:Y})=>{const Ne=this.client.core.history.pending;Ne.length>0&&Ne.filter(W=>W.topic===H&&W.request.method==="wc_sessionRequest").forEach(W=>{const ri=W.request.id,si=v0("session_request",ri);if(this.events.listenerCount(si)===0)throw new Error(`emitting ${si} without any listeners`);this.events.emit(v0("session_request",W.request.id),{error:Y})})},this.processSessionRequestQueue=()=>{if(this.sessionRequestQueue.state===D$1.active){this.client.logger.info("session request queue is already active.");return}const H=this.sessionRequestQueue.queue[0];if(!H){this.client.logger.info("session request queue is empty.");return}try{this.sessionRequestQueue.state=D$1.active,this.emitSessionRequest(H)}catch(Y){this.client.logger.error(Y)}},this.emitSessionRequest=H=>{this.client.events.emit("session_request",H)},this.onPairingCreated=H=>{if(H.methods&&this.expectedPairingMethodMap.set(H.topic,H.methods),H.active)return;const Y=this.client.proposal.getAll().find(Ne=>Ne.pairingTopic===H.topic);Y&&this.onSessionProposeRequest(H.topic,formatJsonRpcRequest("wc_sessionPropose",{requiredNamespaces:Y.requiredNamespaces,optionalNamespaces:Y.optionalNamespaces,relays:Y.relays,proposer:Y.proposer,sessionProperties:Y.sessionProperties},Y.id))},this.isValidConnect=async H=>{if(!$u(H)){const{message:fi}=xe("MISSING_OR_INVALID",`connect() params: ${JSON.stringify(H)}`);throw new Error(fi)}const{pairingTopic:Y,requiredNamespaces:Ne,optionalNamespaces:W,sessionProperties:ri,relays:si}=H;if(Pe(Y)||await this.isValidPairingTopic(Y),!Xu(si,!0)){const{message:fi}=xe("MISSING_OR_INVALID",`connect() relays: ${si}`);throw new Error(fi)}!Pe(Ne)&&Yr(Ne)!==0&&this.validateNamespaces(Ne,"requiredNamespaces"),!Pe(W)&&Yr(W)!==0&&this.validateNamespaces(W,"optionalNamespaces"),Pe(ri)||this.validateSessionProps(ri,"sessionProperties")},this.validateNamespaces=(H,Y)=>{const Ne=Wu(H,"connect()",Y);if(Ne)throw new Error(Ne.message)},this.isValidApprove=async H=>{if(!$u(H))throw new Error(xe("MISSING_OR_INVALID",`approve() params: ${H}`).message);const{id:Y,namespaces:Ne,relayProtocol:W,sessionProperties:ri}=H;this.checkRecentlyDeleted(Y),await this.isValidProposalId(Y);const si=this.client.proposal.get(Y),fi=So(Ne,"approve()");if(fi)throw new Error(fi.message);const ai=Io(si.requiredNamespaces,Ne,"approve()");if(ai)throw new Error(ai.message);if(!Gt$1(W,!0)){const{message:ti}=xe("MISSING_OR_INVALID",`approve() relayProtocol: ${W}`);throw new Error(ti)}Pe(ri)||this.validateSessionProps(ri,"sessionProperties")},this.isValidReject=async H=>{if(!$u(H)){const{message:W}=xe("MISSING_OR_INVALID",`reject() params: ${H}`);throw new Error(W)}const{id:Y,reason:Ne}=H;if(this.checkRecentlyDeleted(Y),await this.isValidProposalId(Y),!th(Ne)){const{message:W}=xe("MISSING_OR_INVALID",`reject() reason: ${JSON.stringify(Ne)}`);throw new Error(W)}},this.isValidSessionSettleRequest=H=>{if(!$u(H)){const{message:ai}=xe("MISSING_OR_INVALID",`onSessionSettleRequest() params: ${H}`);throw new Error(ai)}const{relay:Y,controller:Ne,namespaces:W,expiry:ri}=H;if(!No(Y)){const{message:ai}=xe("MISSING_OR_INVALID","onSessionSettleRequest() relay protocol should be a string");throw new Error(ai)}const si=Vu(Ne,"onSessionSettleRequest()");if(si)throw new Error(si.message);const fi=So(W,"onSessionSettleRequest()");if(fi)throw new Error(fi.message);if(p0(ri)){const{message:ai}=xe("EXPIRED","onSessionSettleRequest()");throw new Error(ai)}},this.isValidUpdate=async H=>{if(!$u(H)){const{message:fi}=xe("MISSING_OR_INVALID",`update() params: ${H}`);throw new Error(fi)}const{topic:Y,namespaces:Ne}=H;this.checkRecentlyDeleted(Y),await this.isValidSessionTopic(Y);const W=this.client.session.get(Y),ri=So(Ne,"update()");if(ri)throw new Error(ri.message);const si=Io(W.requiredNamespaces,Ne,"update()");if(si)throw new Error(si.message)},this.isValidExtend=async H=>{if(!$u(H)){const{message:Ne}=xe("MISSING_OR_INVALID",`extend() params: ${H}`);throw new Error(Ne)}const{topic:Y}=H;this.checkRecentlyDeleted(Y),await this.isValidSessionTopic(Y)},this.isValidRequest=async H=>{if(!$u(H)){const{message:fi}=xe("MISSING_OR_INVALID",`request() params: ${H}`);throw new Error(fi)}const{topic:Y,request:Ne,chainId:W,expiry:ri}=H;this.checkRecentlyDeleted(Y),await this.isValidSessionTopic(Y);const{namespaces:si}=this.client.session.get(Y);if(!nh(si,W)){const{message:fi}=xe("MISSING_OR_INVALID",`request() chainId: ${W}`);throw new Error(fi)}if(!eh(Ne)){const{message:fi}=xe("MISSING_OR_INVALID",`request() ${JSON.stringify(Ne)}`);throw new Error(fi)}if(!fh(si,W,Ne.method)){const{message:fi}=xe("MISSING_OR_INVALID",`request() method: ${Ne.method}`);throw new Error(fi)}if(ri&&!uh(ri,ne)){const{message:fi}=xe("MISSING_OR_INVALID",`request() expiry: ${ri}. Expiry must be a number (in seconds) between ${ne.min} and ${ne.max}`);throw new Error(fi)}},this.isValidRespond=async H=>{var Y;if(!$u(H)){const{message:ri}=xe("MISSING_OR_INVALID",`respond() params: ${H}`);throw new Error(ri)}const{topic:Ne,response:W}=H;try{await this.isValidSessionTopic(Ne)}catch(ri){throw(Y=H==null?void 0:H.response)!=null&&Y.id&&this.cleanupAfterResponse(H),ri}if(!rh(W)){const{message:ri}=xe("MISSING_OR_INVALID",`respond() response: ${JSON.stringify(W)}`);throw new Error(ri)}},this.isValidPing=async H=>{if(!$u(H)){const{message:Ne}=xe("MISSING_OR_INVALID",`ping() params: ${H}`);throw new Error(Ne)}const{topic:Y}=H;await this.isValidSessionOrPairingTopic(Y)},this.isValidEmit=async H=>{if(!$u(H)){const{message:si}=xe("MISSING_OR_INVALID",`emit() params: ${H}`);throw new Error(si)}const{topic:Y,event:Ne,chainId:W}=H;await this.isValidSessionTopic(Y);const{namespaces:ri}=this.client.session.get(Y);if(!nh(ri,W)){const{message:si}=xe("MISSING_OR_INVALID",`emit() chainId: ${W}`);throw new Error(si)}if(!ih(Ne)){const{message:si}=xe("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(Ne)}`);throw new Error(si)}if(!oh(ri,W,Ne.name)){const{message:si}=xe("MISSING_OR_INVALID",`emit() event: ${JSON.stringify(Ne)}`);throw new Error(si)}},this.isValidDisconnect=async H=>{if(!$u(H)){const{message:Ne}=xe("MISSING_OR_INVALID",`disconnect() params: ${H}`);throw new Error(Ne)}const{topic:Y}=H;await this.isValidSessionOrPairingTopic(Y)},this.isValidAuthenticate=H=>{const{chains:Y,uri:Ne,domain:W,nonce:ri}=H;if(!Array.isArray(Y)||Y.length===0)throw new Error("chains is required and must be a non-empty array");if(!Gt$1(Ne,!1))throw new Error("uri is required parameter");if(!Gt$1(W,!1))throw new Error("domain is required parameter");if(!Gt$1(ri,!1))throw new Error("nonce is required parameter");if([...new Set(Y.map(fi=>dn(fi).namespace))].length>1)throw new Error("Multi-namespace requests are not supported. Please request single namespace only.");const{namespace:si}=dn(Y[0]);if(si!=="eip155")throw new Error("Only eip155 namespace is supported for authenticated sessions. Please use .connect() for non-eip155 chains.")},this.getVerifyContext=async(H,Y)=>{const Ne={verified:{verifyUrl:Y.verifyUrl||M$2,validation:"UNKNOWN",origin:Y.url||""}};try{const W=await this.client.core.verify.resolve({attestationId:H,verifyUrl:Y.verifyUrl});W&&(Ne.verified.origin=W.origin,Ne.verified.isScam=W.isScam,Ne.verified.validation=W.origin===new URL(Y.url).origin?"VALID":"INVALID")}catch(W){this.client.logger.info(W)}return this.client.logger.info(`Verify context: ${JSON.stringify(Ne)}`),Ne},this.validateSessionProps=(H,Y)=>{Object.values(H).forEach(Ne=>{if(!Gt$1(Ne,!1)){const{message:W}=xe("MISSING_OR_INVALID",`${Y} must be in Record format. Received: ${JSON.stringify(Ne)}`);throw new Error(W)}})},this.getPendingAuthRequest=H=>{const Y=this.client.auth.requests.get(H);return typeof Y=="object"?Y:void 0},this.addToRecentlyDeleted=(H,Y)=>{if(this.recentlyDeletedMap.set(H,Y),this.recentlyDeletedMap.size>=this.recentlyDeletedLimit){let Ne=0;const W=this.recentlyDeletedLimit/2;for(const ri of this.recentlyDeletedMap.keys()){if(Ne++>=W)break;this.recentlyDeletedMap.delete(ri)}}},this.checkRecentlyDeleted=H=>{const Y=this.recentlyDeletedMap.get(H);if(Y){const{message:Ne}=xe("MISSING_OR_INVALID",`Record was recently deleted - ${Y}: ${H}`);throw new Error(Ne)}}}async isInitialized(){if(!this.initialized){const{message:e}=xe("NOT_INITIALIZED",this.name);throw new Error(e)}await this.client.core.relayer.confirmOnlineStateOrThrow()}registerRelayerEvents(){this.client.core.relayer.on(f$2.message,async e=>{const{topic:H,message:Y}=e,{publicKey:Ne}=this.client.auth.authKeys.keys.includes(J)?this.client.auth.authKeys.get(J):{responseTopic:void 0,publicKey:void 0},W=await this.client.core.crypto.decode(H,Y,{receiverPublicKey:Ne});try{isJsonRpcRequest(W)?(this.client.core.history.set(H,W),this.onRelayEventRequest({topic:H,payload:W})):isJsonRpcResponse(W)?(await this.client.core.history.resolve(W),await this.onRelayEventResponse({topic:H,payload:W}),this.client.core.history.delete(H,W.id)):this.onRelayEventUnknownPayload({topic:H,payload:W})}catch(ri){this.client.logger.error(ri)}})}registerExpirerEvents(){this.client.core.expirer.on(C$1.expired,async e=>{const{topic:H,id:Y}=l0(e.target);if(Y&&this.client.pendingRequest.keys.includes(Y))return await this.deletePendingSessionRequest(Y,xe("EXPIRED"),!0);if(Y&&this.client.auth.requests.keys.includes(Y))return await this.deletePendingAuthRequest(Y,xe("EXPIRED"),!0);H?this.client.session.keys.includes(H)&&(await this.deleteSession({topic:H,expirerHasDeleted:!0}),this.client.events.emit("session_expire",{topic:H})):Y&&(await this.deleteProposal(Y,!0),this.client.events.emit("proposal_expire",{id:Y}))})}registerPairingEvents(){this.client.core.pairing.events.on(q$1.create,e=>this.onPairingCreated(e)),this.client.core.pairing.events.on(q$1.delete,e=>{this.addToRecentlyDeleted(e.topic,"pairing")})}isValidPairingTopic(e){if(!Gt$1(e,!1)){const{message:H}=xe("MISSING_OR_INVALID",`pairing topic should be a string: ${e}`);throw new Error(H)}if(!this.client.core.pairing.pairings.keys.includes(e)){const{message:H}=xe("NO_MATCHING_KEY",`pairing topic doesn't exist: ${e}`);throw new Error(H)}if(p0(this.client.core.pairing.pairings.get(e).expiry)){const{message:H}=xe("EXPIRED",`pairing topic: ${e}`);throw new Error(H)}}async isValidSessionTopic(e){if(!Gt$1(e,!1)){const{message:H}=xe("MISSING_OR_INVALID",`session topic should be a string: ${e}`);throw new Error(H)}if(this.checkRecentlyDeleted(e),!this.client.session.keys.includes(e)){const{message:H}=xe("NO_MATCHING_KEY",`session topic doesn't exist: ${e}`);throw new Error(H)}if(p0(this.client.session.get(e).expiry)){await this.deleteSession({topic:e});const{message:H}=xe("EXPIRED",`session topic: ${e}`);throw new Error(H)}if(!this.client.core.crypto.keychain.has(e)){const{message:H}=xe("MISSING_OR_INVALID",`session topic does not exist in keychain: ${e}`);throw await this.deleteSession({topic:e}),new Error(H)}}async isValidSessionOrPairingTopic(e){if(this.checkRecentlyDeleted(e),this.client.session.keys.includes(e))await this.isValidSessionTopic(e);else if(this.client.core.pairing.pairings.keys.includes(e))this.isValidPairingTopic(e);else if(Gt$1(e,!1)){const{message:H}=xe("NO_MATCHING_KEY",`session or pairing topic doesn't exist: ${e}`);throw new Error(H)}else{const{message:H}=xe("MISSING_OR_INVALID",`session or pairing topic should be a string: ${e}`);throw new Error(H)}}async isValidProposalId(e){if(!Zu(e)){const{message:H}=xe("MISSING_OR_INVALID",`proposal id should be a number: ${e}`);throw new Error(H)}if(!this.client.proposal.keys.includes(e)){const{message:H}=xe("NO_MATCHING_KEY",`proposal id doesn't exist: ${e}`);throw new Error(H)}if(p0(this.client.proposal.get(e).expiryTimestamp)){await this.deleteProposal(e);const{message:H}=xe("EXPIRED",`proposal id: ${e}`);throw new Error(H)}}}class es extends Kt{constructor(e,H){super(e,H,Ue,ie),this.core=e,this.logger=H}}class Ze extends Kt{constructor(e,H){super(e,H,ke,ie),this.core=e,this.logger=H}}class ts extends Kt{constructor(e,H){super(e,H,Qe,ie,Y=>Y.id),this.core=e,this.logger=H}}class ss extends Kt{constructor(e,H){super(e,H,Ye,X,()=>J),this.core=e,this.logger=H}}class is extends Kt{constructor(e,H){super(e,H,Xe,X),this.core=e,this.logger=H}}class rs extends Kt{constructor(e,H){super(e,H,Je,X,Y=>Y.id),this.core=e,this.logger=H}}class ns{constructor(e,H){this.core=e,this.logger=H,this.authKeys=new ss(this.core,this.logger),this.pairingTopics=new is(this.core,this.logger),this.requests=new rs(this.core,this.logger)}async init(){await this.authKeys.init(),await this.pairingTopics.init(),await this.requests.init()}}class oe extends b$2{constructor(e){super(e),this.protocol=Re,this.version=Ee,this.name=re.name,this.events=new eventsExports.EventEmitter,this.on=(Y,Ne)=>this.events.on(Y,Ne),this.once=(Y,Ne)=>this.events.once(Y,Ne),this.off=(Y,Ne)=>this.events.off(Y,Ne),this.removeListener=(Y,Ne)=>this.events.removeListener(Y,Ne),this.removeAllListeners=Y=>this.events.removeAllListeners(Y),this.connect=async Y=>{try{return await this.engine.connect(Y)}catch(Ne){throw this.logger.error(Ne.message),Ne}},this.pair=async Y=>{try{return await this.engine.pair(Y)}catch(Ne){throw this.logger.error(Ne.message),Ne}},this.approve=async Y=>{try{return await this.engine.approve(Y)}catch(Ne){throw this.logger.error(Ne.message),Ne}},this.reject=async Y=>{try{return await this.engine.reject(Y)}catch(Ne){throw this.logger.error(Ne.message),Ne}},this.update=async Y=>{try{return await this.engine.update(Y)}catch(Ne){throw this.logger.error(Ne.message),Ne}},this.extend=async Y=>{try{return await this.engine.extend(Y)}catch(Ne){throw this.logger.error(Ne.message),Ne}},this.request=async Y=>{try{return await this.engine.request(Y)}catch(Ne){throw this.logger.error(Ne.message),Ne}},this.respond=async Y=>{try{return await this.engine.respond(Y)}catch(Ne){throw this.logger.error(Ne.message),Ne}},this.ping=async Y=>{try{return await this.engine.ping(Y)}catch(Ne){throw this.logger.error(Ne.message),Ne}},this.emit=async Y=>{try{return await this.engine.emit(Y)}catch(Ne){throw this.logger.error(Ne.message),Ne}},this.disconnect=async Y=>{try{return await this.engine.disconnect(Y)}catch(Ne){throw this.logger.error(Ne.message),Ne}},this.find=Y=>{try{return this.engine.find(Y)}catch(Ne){throw this.logger.error(Ne.message),Ne}},this.getPendingSessionRequests=()=>{try{return this.engine.getPendingSessionRequests()}catch(Y){throw this.logger.error(Y.message),Y}},this.authenticate=async Y=>{try{return await this.engine.authenticate(Y)}catch(Ne){throw this.logger.error(Ne.message),Ne}},this.formatAuthMessage=Y=>{try{return this.engine.formatAuthMessage(Y)}catch(Ne){throw this.logger.error(Ne.message),Ne}},this.approveSessionAuthenticate=async Y=>{try{return await this.engine.approveSessionAuthenticate(Y)}catch(Ne){throw this.logger.error(Ne.message),Ne}},this.rejectSessionAuthenticate=async Y=>{try{return await this.engine.rejectSessionAuthenticate(Y)}catch(Ne){throw this.logger.error(Ne.message),Ne}},this.name=(e==null?void 0:e.name)||re.name,this.metadata=(e==null?void 0:e.metadata)||Xo(),this.signConfig=e==null?void 0:e.signConfig;const H=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Hg(k({level:(e==null?void 0:e.logger)||re.logger}));this.core=(e==null?void 0:e.core)||new Br(e),this.logger=E$4(H,this.name),this.session=new Ze(this.core,this.logger),this.proposal=new es(this.core,this.logger),this.pendingRequest=new ts(this.core,this.logger),this.engine=new Zt(this),this.auth=new ns(this.core,this.logger)}static async init(e){const H=new oe(e);return await H.initialize(),H}get context(){return y$4(this.logger)}get pairing(){return this.core.pairing.pairings}async initialize(){this.logger.trace("Initialized");try{await this.core.start(),await this.session.init(),await this.proposal.init(),await this.pendingRequest.init(),await this.engine.init(),await this.auth.init(),this.core.verify.init({verifyUrl:this.metadata.verifyUrl}),this.logger.info("SignClient Initialization Success")}catch(e){throw this.logger.info("SignClient Initialization Failure"),this.logger.error(e.message),e}}}var browserPonyfill={exports:{}};(function(G,e){var H=typeof self<"u"?self:commonjsGlobal,Y=function(){function W(){this.fetch=!1,this.DOMException=H.DOMException}return W.prototype=H,new W}();(function(W){(function(ri){var si={searchParams:"URLSearchParams"in W,iterable:"Symbol"in W&&"iterator"in Symbol,blob:"FileReader"in W&&"Blob"in W&&function(){try{return new Blob,!0}catch{return!1}}(),formData:"FormData"in W,arrayBuffer:"ArrayBuffer"in W};function fi(Ie){return Ie&&DataView.prototype.isPrototypeOf(Ie)}if(si.arrayBuffer)var ai=["[object Int8Array]","[object Uint8Array]","[object Uint8ClampedArray]","[object Int16Array]","[object Uint16Array]","[object Int32Array]","[object Uint32Array]","[object Float32Array]","[object Float64Array]"],ti=ArrayBuffer.isView||function(Ie){return Ie&&ai.indexOf(Object.prototype.toString.call(Ie))>-1};function hi(Ie){if(typeof Ie!="string"&&(Ie=String(Ie)),/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(Ie))throw new TypeError("Invalid character in header field name");return Ie.toLowerCase()}function ci(Ie){return typeof Ie!="string"&&(Ie=String(Ie)),Ie}function ui(Ie){var Te={next:function(){var Xr=Ie.shift();return{done:Xr===void 0,value:Xr}}};return si.iterable&&(Te[Symbol.iterator]=function(){return Te}),Te}function li(Ie){this.map={},Ie instanceof li?Ie.forEach(function(Te,Xr){this.append(Xr,Te)},this):Array.isArray(Ie)?Ie.forEach(function(Te){this.append(Te[0],Te[1])},this):Ie&&Object.getOwnPropertyNames(Ie).forEach(function(Te){this.append(Te,Ie[Te])},this)}li.prototype.append=function(Ie,Te){Ie=hi(Ie),Te=ci(Te);var Xr=this.map[Ie];this.map[Ie]=Xr?Xr+", "+Te:Te},li.prototype.delete=function(Ie){delete this.map[hi(Ie)]},li.prototype.get=function(Ie){return Ie=hi(Ie),this.has(Ie)?this.map[Ie]:null},li.prototype.has=function(Ie){return this.map.hasOwnProperty(hi(Ie))},li.prototype.set=function(Ie,Te){this.map[hi(Ie)]=ci(Te)},li.prototype.forEach=function(Ie,Te){for(var Xr in this.map)this.map.hasOwnProperty(Xr)&&Ie.call(Te,this.map[Xr],Xr,this)},li.prototype.keys=function(){var Ie=[];return this.forEach(function(Te,Xr){Ie.push(Xr)}),ui(Ie)},li.prototype.values=function(){var Ie=[];return this.forEach(function(Te){Ie.push(Te)}),ui(Ie)},li.prototype.entries=function(){var Ie=[];return this.forEach(function(Te,Xr){Ie.push([Xr,Te])}),ui(Ie)},si.iterable&&(li.prototype[Symbol.iterator]=li.prototype.entries);function mi(Ie){if(Ie.bodyUsed)return Promise.reject(new TypeError("Already read"));Ie.bodyUsed=!0}function hn(Ie){return new Promise(function(Te,Xr){Ie.onload=function(){Te(Ie.result)},Ie.onerror=function(){Xr(Ie.error)}})}function ln(Ie){var Te=new FileReader,Xr=hn(Te);return Te.readAsArrayBuffer(Ie),Xr}function fn(Ie){var Te=new FileReader,Xr=hn(Te);return Te.readAsText(Ie),Xr}function gn(Ie){for(var Te=new Uint8Array(Ie),Xr=new Array(Te.length),ei=0;ei-1?Te:Ie}function Rn(Ie,Te){Te=Te||{};var Xr=Te.body;if(Ie instanceof Rn){if(Ie.bodyUsed)throw new TypeError("Already read");this.url=Ie.url,this.credentials=Ie.credentials,Te.headers||(this.headers=new li(Ie.headers)),this.method=Ie.method,this.mode=Ie.mode,this.signal=Ie.signal,!Xr&&Ie._bodyInit!=null&&(Xr=Ie._bodyInit,Ie.bodyUsed=!0)}else this.url=String(Ie);if(this.credentials=Te.credentials||this.credentials||"same-origin",(Te.headers||!this.headers)&&(this.headers=new li(Te.headers)),this.method=an(Te.method||this.method||"GET"),this.mode=Te.mode||this.mode||null,this.signal=Te.signal||this.signal,this.referrer=null,(this.method==="GET"||this.method==="HEAD")&&Xr)throw new TypeError("Body not allowed for GET or HEAD requests");this._initBody(Xr)}Rn.prototype.clone=function(){return new Rn(this,{body:this._bodyInit})};function Ya(Ie){var Te=new FormData;return Ie.trim().split("&").forEach(function(Xr){if(Xr){var ei=Xr.split("="),ii=ei.shift().replace(/\+/g," "),Wr=ei.join("=").replace(/\+/g," ");Te.append(decodeURIComponent(ii),decodeURIComponent(Wr))}}),Te}function Ho(Ie){var Te=new li,Xr=Ie.replace(/\r?\n[\t ]+/g," ");return Xr.split(/\r?\n/).forEach(function(ei){var ii=ei.split(":"),Wr=ii.shift().trim();if(Wr){var R=ii.join(":").trim();Te.append(Wr,R)}}),Te}An.call(Rn.prototype);function oi(Ie,Te){Te||(Te={}),this.type="default",this.status=Te.status===void 0?200:Te.status,this.ok=this.status>=200&&this.status<300,this.statusText="statusText"in Te?Te.statusText:"OK",this.headers=new li(Te.headers),this.url=Te.url||"",this._initBody(Ie)}An.call(oi.prototype),oi.prototype.clone=function(){return new oi(this._bodyInit,{status:this.status,statusText:this.statusText,headers:new li(this.headers),url:this.url})},oi.error=function(){var Ie=new oi(null,{status:0,statusText:""});return Ie.type="error",Ie};var t=[301,302,303,307,308];oi.redirect=function(Ie,Te){if(t.indexOf(Te)===-1)throw new RangeError("Invalid status code");return new oi(null,{status:Te,headers:{location:Ie}})},ri.DOMException=W.DOMException;try{new ri.DOMException}catch{ri.DOMException=function(Te,Xr){this.message=Te,this.name=Xr;var ei=Error(Te);this.stack=ei.stack},ri.DOMException.prototype=Object.create(Error.prototype),ri.DOMException.prototype.constructor=ri.DOMException}function F(Ie,Te){return new Promise(function(Xr,ei){var ii=new Rn(Ie,Te);if(ii.signal&&ii.signal.aborted)return ei(new ri.DOMException("Aborted","AbortError"));var Wr=new XMLHttpRequest;function R(){Wr.abort()}Wr.onload=function(){var Le={status:Wr.status,statusText:Wr.statusText,headers:Ho(Wr.getAllResponseHeaders()||"")};Le.url="responseURL"in Wr?Wr.responseURL:Le.headers.get("X-Request-URL");var nn="response"in Wr?Wr.response:Wr.responseText;Xr(new oi(nn,Le))},Wr.onerror=function(){ei(new TypeError("Network request failed"))},Wr.ontimeout=function(){ei(new TypeError("Network request failed"))},Wr.onabort=function(){ei(new ri.DOMException("Aborted","AbortError"))},Wr.open(ii.method,ii.url,!0),ii.credentials==="include"?Wr.withCredentials=!0:ii.credentials==="omit"&&(Wr.withCredentials=!1),"responseType"in Wr&&si.blob&&(Wr.responseType="blob"),ii.headers.forEach(function(Le,nn){Wr.setRequestHeader(nn,Le)}),ii.signal&&(ii.signal.addEventListener("abort",R),Wr.onreadystatechange=function(){Wr.readyState===4&&ii.signal.removeEventListener("abort",R)}),Wr.send(typeof ii._bodyInit>"u"?null:ii._bodyInit)})}return F.polyfill=!0,W.fetch||(W.fetch=F,W.Headers=li,W.Request=Rn,W.Response=oi),ri.Headers=li,ri.Request=Rn,ri.Response=oi,ri.fetch=F,Object.defineProperty(ri,"__esModule",{value:!0}),ri})({})})(Y),Y.fetch.ponyfill=!0,delete Y.fetch.polyfill;var Ne=Y;e=Ne.fetch,e.default=Ne.fetch,e.fetch=Ne.fetch,e.Headers=Ne.Headers,e.Request=Ne.Request,e.Response=Ne.Response,G.exports=e})(browserPonyfill,browserPonyfill.exports);var browserPonyfillExports=browserPonyfill.exports;const o=getDefaultExportFromCjs(browserPonyfillExports);var P=Object.defineProperty,w=Object.defineProperties,E$1=Object.getOwnPropertyDescriptors,c=Object.getOwnPropertySymbols,L$1=Object.prototype.hasOwnProperty,O$1=Object.prototype.propertyIsEnumerable,l=(G,e,H)=>e in G?P(G,e,{enumerable:!0,configurable:!0,writable:!0,value:H}):G[e]=H,p$1=(G,e)=>{for(var H in e||(e={}))L$1.call(e,H)&&l(G,H,e[H]);if(c)for(var H of c(e))O$1.call(e,H)&&l(G,H,e[H]);return G},v$1=(G,e)=>w(G,E$1(e));const j$1={Accept:"application/json","Content-Type":"application/json"},T$1="POST",d={headers:j$1,method:T$1},g$1=10;class f{constructor(e,H=!1){if(this.url=e,this.disableProviderPing=H,this.events=new eventsExports.EventEmitter,this.isAvailable=!1,this.registering=!1,!isHttpUrl(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);this.url=e,this.disableProviderPing=H}get connected(){return this.isAvailable}get connecting(){return this.registering}on(e,H){this.events.on(e,H)}once(e,H){this.events.once(e,H)}off(e,H){this.events.off(e,H)}removeListener(e,H){this.events.removeListener(e,H)}async open(e=this.url){await this.register(e)}async close(){if(!this.isAvailable)throw new Error("Connection already closed");this.onClose()}async send(e){this.isAvailable||await this.register();try{const H=safeJsonStringify(e),Y=await(await o(this.url,v$1(p$1({},d),{body:H}))).json();this.onPayload({data:Y})}catch(H){this.onError(e.id,H)}}async register(e=this.url){if(!isHttpUrl(e))throw new Error(`Provided URL is not compatible with HTTP connection: ${e}`);if(this.registering){const H=this.events.getMaxListeners();return(this.events.listenerCount("register_error")>=H||this.events.listenerCount("open")>=H)&&this.events.setMaxListeners(H+1),new Promise((Y,Ne)=>{this.events.once("register_error",W=>{this.resetMaxListeners(),Ne(W)}),this.events.once("open",()=>{if(this.resetMaxListeners(),typeof this.isAvailable>"u")return Ne(new Error("HTTP connection is missing or invalid"));Y()})})}this.url=e,this.registering=!0;try{if(!this.disableProviderPing){const H=safeJsonStringify({id:1,jsonrpc:"2.0",method:"test",params:[]});await o(e,v$1(p$1({},d),{body:H}))}this.onOpen()}catch(H){const Y=this.parseError(H);throw this.events.emit("register_error",Y),this.onClose(),Y}}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 H=typeof e.data=="string"?safeJsonParse(e.data):e.data;this.events.emit("payload",H)}onError(e,H){const Y=this.parseError(H),Ne=Y.message||Y.toString(),W=formatJsonRpcError(e,Ne);this.events.emit("payload",W)}parseError(e,H=this.url){return parseConnectionError(e,H,"HTTP")}resetMaxListeners(){this.events.getMaxListeners()>g$1&&this.events.setMaxListeners(g$1)}}const xa="error",Mg="wss://relay.walletconnect.com",qg="wc",Bg="universal_provider",Ea=`${qg}@2:${Bg}:`,Gg="https://rpc.walletconnect.com/v1/",Vn={DEFAULT_CHAIN_CHANGED:"default_chain_changed"};var ge=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{},Ui={exports:{}};/** -* @license -* Lodash -* Copyright OpenJS Foundation and other contributors -* Released under MIT license -* Based on Underscore.js 1.8.3 -* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors -*/(function(G,e){(function(){var H,Y="4.17.21",Ne=200,W="Unsupported core-js use. Try https://npms.io/search?q=ponyfill.",ri="Expected a function",si="Invalid `variable` option passed into `_.template`",fi="__lodash_hash_undefined__",ai=500,ti="__lodash_placeholder__",hi=1,ci=2,ui=4,li=1,mi=2,hn=1,ln=2,fn=4,gn=8,cn=16,An=32,Cn=64,an=128,Rn=256,Ya=512,Ho=30,oi="...",t=800,F=16,Ie=1,Te=2,Xr=3,ei=1/0,ii=9007199254740991,Wr=17976931348623157e292,R=NaN,Le=4294967295,nn=Le-1,vn=Le>>>1,Mn=[["ary",an],["bind",hn],["bindKey",ln],["curry",gn],["curryRight",cn],["flip",Ya],["partial",An],["partialRight",Cn],["rearg",Rn]],sn="[object Arguments]",Zn="[object Array]",on="[object AsyncFunction]",pn="[object Boolean]",mn="[object Date]",$i="[object DOMException]",ho="[object Error]",Do="[object Function]",To="[object GeneratorFunction]",Oh="[object Map]",Fo="[object Number]",Vo="[object Null]",Hh="[object Object]",Ah="[object Promise]",Qf="[object Proxy]",Gh="[object RegExp]",tf="[object Set]",Ko="[object String]",Kh="[object Symbol]",Lf="[object Undefined]",Uo="[object WeakMap]",Vh="[object WeakSet]",jf="[object ArrayBuffer]",Zo="[object DataView]",Wh="[object Float32Array]",vh="[object Float64Array]",Yo="[object Int8Array]",Jh="[object Int16Array]",xh="[object Int32Array]",Vf="[object Uint8Array]",Zh="[object Uint8ClampedArray]",Ch="[object Uint16Array]",Eh="[object Uint32Array]",Lu=/\b__p \+= '';/g,Ph=/\b(__p \+=) '' \+/g,Sh=/(__e\(.*?\)|\b__t\)) \+\n'';/g,Uu=/&(?:amp|lt|gt|quot|#39);/g,Th=/[&<>"']/g,gh=RegExp(Uu.source),Xh=RegExp(Th.source),Rh=/<%-([\s\S]+?)%>/g,bh=/<%([\s\S]+?)%>/g,au=/<%=([\s\S]+?)%>/g,$h=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,wh=/^\w*$/,qu=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,Ih=/[\\^$.*+?()[\]{}|]/g,_h=RegExp(Ih.source),uu=/^\s+/,Dh=/\s/,yh=/\{(?:\n\/\* \[wrapped with .+\] \*\/)?\n?/,Yh=/\{\n\/\* \[wrapped with (.+)\] \*/,Bh=/,? & /,Mh=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g,Hu=/[()=,{}\[\]\/\s]/,kh=/\\(\\)?/g,qh=/\$\{([^\\}]*(?:\\.[^\\}]*)*)\}/g,Tu=/\w*$/,tc=/^[-+]0x[0-9a-f]+$/i,rc=/^0b[01]+$/i,ic=/^\[object .+?Constructor\]$/,nc=/^0o[0-7]+$/i,sc=/^(?:0|[1-9]\d*)$/,s0=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,hc=/($^)/,pc=/['\n\r\u2028\u2029\\]/g,uc="\\ud800-\\udfff",vc="\\u0300-\\u036f",mc="\\ufe20-\\ufe2f",cc="\\u20d0-\\u20ff",lc=vc+mc+cc,dc="\\u2700-\\u27bf",$0="a-z\\xdf-\\xf6\\xf8-\\xff",gc="\\xac\\xb1\\xd7\\xf7",bc="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",yc="\\u2000-\\u206f",Vl=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",Fd="A-Z\\xc0-\\xd6\\xd8-\\xde",Kd="\\ufe0e\\ufe0f",Wl=gc+bc+yc+Vl,Ed="['’]",Jl="["+uc+"]",Ad="["+Wl+"]",Zl="["+lc+"]",Hd="\\d+",G1="["+dc+"]",Gd="["+$0+"]",Vd="[^"+uc+Wl+Hd+dc+$0+Fd+"]",od="\\ud83c[\\udffb-\\udfff]",V1="(?:"+Zl+"|"+od+")",Wd="[^"+uc+"]",fd="(?:\\ud83c[\\udde6-\\uddff]){2}",Nl="[\\ud800-\\udbff][\\udc00-\\udfff]",rl="["+Fd+"]",Jd="\\u200d",Zd="(?:"+Gd+"|"+Vd+")",Ml="(?:"+rl+"|"+Vd+")",Qd="(?:"+Ed+"(?:d|ll|m|re|s|t|ve))?",Yd="(?:"+Ed+"(?:D|LL|M|RE|S|T|VE))?",Xd=V1+"?",e1="["+Kd+"]?",W1="(?:"+Jd+"(?:"+[Wd,fd,Nl].join("|")+")"+e1+Xd+")*",$l="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",t1="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",r1=e1+Xd+W1,hd="(?:"+[G1,fd,Nl].join("|")+")"+r1,J1="(?:"+[Wd+Zl+"?",Zl,fd,Nl,Jl].join("|")+")",Sd=RegExp(Ed,"g"),Z1=RegExp(Zl,"g"),ud=RegExp(od+"(?="+od+")|"+J1+r1,"g"),i1=RegExp([rl+"?"+Gd+"+"+Qd+"(?="+[Ad,rl,"$"].join("|")+")",Ml+"+"+Yd+"(?="+[Ad,rl+Zd,"$"].join("|")+")",rl+"?"+Zd+"+"+Qd,rl+"+"+Yd,t1,$l,Hd,hd].join("|"),"g"),n1=RegExp("["+Jd+uc+lc+Kd+"]"),Ql=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/,s1=["Array","Buffer","DataView","Date","Error","Float32Array","Float64Array","Function","Int8Array","Int16Array","Int32Array","Map","Math","Object","Promise","RegExp","Set","String","Symbol","TypeError","Uint8Array","Uint8ClampedArray","Uint16Array","Uint32Array","WeakMap","_","clearTimeout","isFinite","parseInt","setTimeout"],Q1=-1,Ec={};Ec[Wh]=Ec[vh]=Ec[Yo]=Ec[Jh]=Ec[xh]=Ec[Vf]=Ec[Zh]=Ec[Ch]=Ec[Eh]=!0,Ec[sn]=Ec[Zn]=Ec[jf]=Ec[pn]=Ec[Zo]=Ec[mn]=Ec[ho]=Ec[Do]=Ec[Oh]=Ec[Fo]=Ec[Hh]=Ec[Gh]=Ec[tf]=Ec[Ko]=Ec[Uo]=!1;var xc={};xc[sn]=xc[Zn]=xc[jf]=xc[Zo]=xc[pn]=xc[mn]=xc[Wh]=xc[vh]=xc[Yo]=xc[Jh]=xc[xh]=xc[Oh]=xc[Fo]=xc[Hh]=xc[Gh]=xc[tf]=xc[Ko]=xc[Kh]=xc[Vf]=xc[Zh]=xc[Ch]=xc[Eh]=!0,xc[ho]=xc[Do]=xc[Uo]=!1;var ko={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},Xf={"&":"&","<":"<",">":">",'"':""","'":"'"},jh={"&":"&","<":"<",">":">",""":'"',"'":"'"},su={"\\":"\\","'":"'","\n":"n","\r":"r","\u2028":"u2028","\u2029":"u2029"},Ac=parseFloat,t0=parseInt,Rc=typeof ge=="object"&&ge&&ge.Object===Object&&ge,Tc=typeof self=="object"&&self&&self.Object===Object&&self,oc=Rc||Tc||Function("return this")(),Sc=e&&!e.nodeType&&e,Cc=Sc&&!0&&G&&!G.nodeType&&G,Qc=Cc&&Cc.exports===Sc,Nc=Qc&&Rc.process,Ic=function(){try{var ph=Cc&&Cc.require&&Cc.require("util").types;return ph||Nc&&Nc.binding&&Nc.binding("util")}catch{}}(),Gc=Ic&&Ic.isArrayBuffer,ml=Ic&&Ic.isDate,fl=Ic&&Ic.isMap,xl=Ic&&Ic.isRegExp,$d=Ic&&Ic.isSet,Yl=Ic&&Ic.isTypedArray;function zc(ph,Lh,Nh){switch(Nh.length){case 0:return ph.call(Lh);case 1:return ph.call(Lh,Nh[0]);case 2:return ph.call(Lh,Nh[0],Nh[1]);case 3:return ph.call(Lh,Nh[0],Nh[1],Nh[2])}return ph.apply(Lh,Nh)}function vg(ph,Lh,Nh,hu){for(var e0=-1,wc=ph==null?0:ph.length;++e0-1}function Y1(ph,Lh,Nh){for(var hu=-1,e0=ph==null?0:ph.length;++hu-1;);return Nh}function _v(ph,Lh){for(var Nh=ph.length;Nh--&&cd(Lh,ph[Nh],0)>-1;);return Nh}function Ag(ph,Lh){for(var Nh=ph.length,hu=0;Nh--;)ph[Nh]===Lh&&++hu;return hu}var Sg=rp(ko),$g=rp(Xf);function Rg(ph){return"\\"+su[ph]}function Ig(ph,Lh){return ph==null?H:ph[Lh]}function ld(ph){return n1.test(ph)}function Dg(ph){return Ql.test(ph)}function Cg(ph){for(var Lh,Nh=[];!(Lh=ph.next()).done;)Nh.push(Lh.value);return Nh}function ap(ph){var Lh=-1,Nh=Array(ph.size);return ph.forEach(function(hu,e0){Nh[++Lh]=[e0,hu]}),Nh}function Mv(ph,Lh){return function(Nh){return ph(Lh(Nh))}}function Ul(ph,Lh){for(var Nh=-1,hu=ph.length,e0=0,wc=[];++Nh-1}function C2(Zr,ni){var di=this.__data__,un=E1(di,Zr);return un<0?(++this.size,di.push([Zr,ni])):di[un][1]=ni,this}Rl.prototype.clear=I2,Rl.prototype.delete=D2,Rl.prototype.get=q2,Rl.prototype.has=B2,Rl.prototype.set=C2;function Il(Zr){var ni=-1,di=Zr==null?0:Zr.length;for(this.clear();++ni=ni?Zr:ni)),Zr}function ll(Zr,ni,di,un,Bn,qo){var Lo,jo=ni&hi,mh=ni&ci,Uh=ni&ui;if(di&&(Lo=Bn?di(Zr,un,Bn,qo):di(Zr)),Lo!==H)return Lo;if(!qc(Zr))return Zr;var zh=r0(Zr);if(zh){if(Lo=Nb(Zr),!jo)return Yc(Zr,Lo)}else{var Fh=Hc(Zr),Qh=Fh==Do||Fh==To;if(Gl(Zr))return nm(Zr,jo);if(Fh==Hh||Fh==sn||Qh&&!Bn){if(Lo=mh||Qh?{}:xm(Zr),!jo)return mh?Sb(Zr,J2(Lo,Zr)):Ab(Zr,Pv(Lo,Zr))}else{if(!xc[Fh])return Bn?Zr:{};Lo=kb(Zr,Fh,jo)}}qo||(qo=new bl);var ku=qo.get(Zr);if(ku)return ku;qo.set(Zr,Lo),Ym(Zr)?Zr.forEach(function(Ku){Lo.add(ll(Ku,ni,di,Ku,Zr,qo))}):Zm(Zr)&&Zr.forEach(function(Ku,F0){Lo.set(F0,ll(Ku,ni,di,F0,Zr,qo))});var Fu=Uh?mh?Bp:qp:mh?el:jc,f0=zh?H:Fu(Zr);return hl(f0||Zr,function(Ku,F0){f0&&(F0=Ku,Ku=Zr[F0]),Pd(Lo,F0,ll(Ku,ni,di,F0,Zr,qo))}),Lo}function Z2(Zr){var ni=jc(Zr);return function(di){return Ov(di,Zr,ni)}}function Ov(Zr,ni,di){var un=di.length;if(Zr==null)return!un;for(Zr=$c(Zr);un--;){var Bn=di[un],qo=ni[Bn],Lo=Zr[Bn];if(Lo===H&&!(Bn in Zr)||!qo(Lo))return!1}return!0}function Tv(Zr,ni,di){if(typeof Zr!="function")throw new ul(ri);return zd(function(){Zr.apply(H,di)},ni)}function Od(Zr,ni,di,un){var Bn=-1,qo=a1,Lo=!0,jo=Zr.length,mh=[],Uh=ni.length;if(!jo)return mh;di&&(ni=Dc(ni,il(di))),un?(qo=Y1,Lo=!1):ni.length>=Ne&&(qo=Rd,Lo=!1,ni=new td(ni));e:for(;++BnBn?0:Bn+di),un=un===H||un>Bn?Bn:o0(un),un<0&&(un+=Bn),un=di>un?0:eg(un);di0&&di(jo)?ni>1?Fc(jo,ni-1,di,un,Bn):Ll(Bn,jo):un||(Bn[Bn.length]=jo)}return Bn}var dp=um(),Lv=um(!0);function El(Zr,ni){return Zr&&dp(Zr,ni,jc)}function pp(Zr,ni){return Zr&&Lv(Zr,ni,jc)}function S1(Zr,ni){return kl(ni,function(di){return Pl(Zr[di])})}function id(Zr,ni){ni=Kl(ni,Zr);for(var di=0,un=ni.length;Zr!=null&&dini}function X2(Zr,ni){return Zr!=null&&Mc.call(Zr,ni)}function eb(Zr,ni){return Zr!=null&&ni in $c(Zr)}function tb(Zr,ni,di){return Zr>=Kc(ni,di)&&Zr=120&&zh.length>=120)?new td(Lo&&zh):H}zh=Zr[0];var Fh=-1,Qh=jo[0];e:for(;++Fh-1;)jo!==Zr&&m1.call(jo,mh,1),m1.call(Zr,mh,1);return Zr}function Zv(Zr,ni){for(var di=Zr?ni.length:0,un=di-1;di--;){var Bn=ni[di];if(di==un||Bn!==qo){var qo=Bn;Cl(Bn)?m1.call(Zr,Bn,1):Ep(Zr,Bn)}}return Zr}function _p(Zr,ni){return Zr+y1(Dv()*(ni-Zr+1))}function pb(Zr,ni,di,un){for(var Bn=-1,qo=Lc(b1((ni-Zr)/(di||1)),0),Lo=Nh(qo);qo--;)Lo[un?qo:++Bn]=Zr,Zr+=di;return Lo}function Mp(Zr,ni){var di="";if(!Zr||ni<1||ni>ii)return di;do ni%2&&(di+=Zr),ni=y1(ni/2),ni&&(Zr+=Zr);while(ni);return di}function D0(Zr,ni){return Lp(Sm(Zr,ni,tl),Zr+"")}function vb(Zr){return Cv(xd(Zr))}function mb(Zr,ni){var di=xd(Zr);return N1(di,rd(ni,0,di.length))}function kd(Zr,ni,di,un){if(!qc(Zr))return Zr;ni=Kl(ni,Zr);for(var Bn=-1,qo=ni.length,Lo=qo-1,jo=Zr;jo!=null&&++BnBn?0:Bn+ni),di=di>Bn?Bn:di,di<0&&(di+=Bn),Bn=ni>di?0:di-ni>>>0,ni>>>=0;for(var qo=Nh(Bn);++un>>1,Lo=Zr[qo];Lo!==null&&!sl(Lo)&&(di?Lo<=ni:Lo=Ne){var Uh=ni?null:Db(Zr);if(Uh)return f1(Uh);Lo=!1,Bn=Rd,mh=new td}else mh=ni?[]:jo;e:for(;++un=un?Zr:dl(Zr,ni,di)}var im=o2||function(Zr){return oc.clearTimeout(Zr)};function nm(Zr,ni){if(ni)return Zr.slice();var di=Zr.length,un=Av?Av(di):new Zr.constructor(di);return Zr.copy(un),un}function Rp(Zr){var ni=new Zr.constructor(Zr.byteLength);return new p1(ni).set(new p1(Zr)),ni}function _b(Zr,ni){var di=ni?Rp(Zr.buffer):Zr.buffer;return new Zr.constructor(di,Zr.byteOffset,Zr.byteLength)}function Mb(Zr){var ni=new Zr.constructor(Zr.source,Tu.exec(Zr));return ni.lastIndex=Zr.lastIndex,ni}function xb(Zr){return Cd?$c(Cd.call(Zr)):{}}function sm(Zr,ni){var di=ni?Rp(Zr.buffer):Zr.buffer;return new Zr.constructor(di,Zr.byteOffset,Zr.length)}function am(Zr,ni){if(Zr!==ni){var di=Zr!==H,un=Zr===null,Bn=Zr===Zr,qo=sl(Zr),Lo=ni!==H,jo=ni===null,mh=ni===ni,Uh=sl(ni);if(!jo&&!Uh&&!qo&&Zr>ni||qo&&Lo&&mh&&!jo&&!Uh||un&&Lo&&mh||!di&&mh||!Bn)return 1;if(!un&&!qo&&!Uh&&Zr=jo)return mh;var Uh=di[un];return mh*(Uh=="desc"?-1:1)}}return Zr.index-ni.index}function om(Zr,ni,di,un){for(var Bn=-1,qo=Zr.length,Lo=di.length,jo=-1,mh=ni.length,Uh=Lc(qo-Lo,0),zh=Nh(mh+Uh),Fh=!un;++jo1?di[Bn-1]:H,Lo=Bn>2?di[2]:H;for(qo=Zr.length>3&&typeof qo=="function"?(Bn--,qo):H,Lo&&Wc(di[0],di[1],Lo)&&(qo=Bn<3?H:qo,Bn=1),ni=$c(ni);++un-1?Bn[qo?ni[Lo]:Lo]:H}}function dm(Zr){return Bl(function(ni){var di=ni.length,un=di,Bn=cl.prototype.thru;for(Zr&&ni.reverse();un--;){var qo=ni[un];if(typeof qo!="function")throw new ul(ri);if(Bn&&!Lo&&O1(qo)=="wrapper")var Lo=new cl([],!0)}for(un=Lo?un:di;++un1&&fc.reverse(),zh&&mhjo))return!1;var Uh=qo.get(Zr),zh=qo.get(ni);if(Uh&&zh)return Uh==ni&&zh==Zr;var Fh=-1,Qh=!0,ku=di&mi?new td:H;for(qo.set(Zr,ni),qo.set(ni,Zr);++Fh1?"& ":"")+ni[un],ni=ni.join(di>2?", ":" "),Zr.replace(yh,`{ -/* [wrapped with `+ni+`] */ -`)}function Ub(Zr){return r0(Zr)||ad(Zr)||!!(Rv&&Zr&&Zr[Rv])}function Cl(Zr,ni){var di=typeof Zr;return ni=ni??ii,!!ni&&(di=="number"||di!="symbol"&&sc.test(Zr))&&Zr>-1&&Zr%1==0&&Zr0){if(++ni>=t)return arguments[0]}else ni=0;return Zr.apply(H,arguments)}}function N1(Zr,ni){var di=-1,un=Zr.length,Bn=un-1;for(ni=ni===H?un:ni;++di1?Zr[ni-1]:H;return di=typeof di=="function"?(Zr.pop(),di):H,km(Zr,di)});function Lm(Zr){var ni=uo(Zr);return ni.__chain__=!0,ni}function Qy(Zr,ni){return ni(Zr),Zr}function k1(Zr,ni){return ni(Zr)}var Yy=Bl(function(Zr){var ni=Zr.length,di=ni?Zr[0]:0,un=this.__wrapped__,Bn=function(qo){return lp(qo,Zr)};return ni>1||this.__actions__.length||!(un instanceof ac)||!Cl(di)?this.thru(Bn):(un=un.slice(di,+di+(ni?1:0)),un.__actions__.push({func:k1,args:[Bn],thisArg:H}),new cl(un,this.__chain__).thru(function(qo){return ni&&!qo.length&&qo.push(H),qo}))});function Xy(){return Lm(this)}function e3(){return new cl(this.value(),this.__chain__)}function t3(){this.__values__===H&&(this.__values__=Xm(this.value()));var Zr=this.__index__>=this.__values__.length,ni=Zr?H:this.__values__[this.__index__++];return{done:Zr,value:ni}}function r3(){return this}function i3(Zr){for(var ni,di=this;di instanceof x1;){var un=Bm(di);un.__index__=0,un.__values__=H,ni?Bn.__wrapped__=un:ni=un;var Bn=un;di=di.__wrapped__}return Bn.__wrapped__=Zr,ni}function n3(){var Zr=this.__wrapped__;if(Zr instanceof ac){var ni=Zr;return this.__actions__.length&&(ni=new ac(this)),ni=ni.reverse(),ni.__actions__.push({func:k1,args:[Up],thisArg:H}),new cl(ni,this.__chain__)}return this.thru(Up)}function s3(){return tm(this.__wrapped__,this.__actions__)}var a3=D1(function(Zr,ni,di){Mc.call(Zr,di)?++Zr[di]:Dl(Zr,di,1)});function o3(Zr,ni,di){var un=r0(Zr)?pv:Q2;return di&&Wc(Zr,ni,di)&&(ni=H),un(Zr,zu(ni,3))}function f3(Zr,ni){var di=r0(Zr)?kl:kv;return di(Zr,zu(ni,3))}var h3=lm(Cm),u3=lm(Pm);function c3(Zr,ni){return Fc(L1(Zr,ni),1)}function l3(Zr,ni){return Fc(L1(Zr,ni),ei)}function d3(Zr,ni,di){return di=di===H?1:o0(di),Fc(L1(Zr,ni),di)}function Um(Zr,ni){var di=r0(Zr)?hl:jl;return di(Zr,zu(ni,3))}function zm(Zr,ni){var di=r0(Zr)?mg:Nv;return di(Zr,zu(ni,3))}var p3=D1(function(Zr,ni,di){Mc.call(Zr,di)?Zr[di].push(ni):Dl(Zr,di,[ni])});function v3(Zr,ni,di,un){Zr=Xc(Zr)?Zr:xd(Zr),di=di&&!un?o0(di):0;var Bn=Zr.length;return di<0&&(di=Lc(Bn+di,0)),K1(Zr)?di<=Bn&&Zr.indexOf(ni,di)>-1:!!Bn&&cd(Zr,ni,di)>-1}var m3=D0(function(Zr,ni,di){var un=-1,Bn=typeof ni=="function",qo=Xc(Zr)?Nh(Zr.length):[];return jl(Zr,function(Lo){qo[++un]=Bn?zc(ni,Lo,di):Td(Lo,ni,di)}),qo}),g3=D1(function(Zr,ni,di){Dl(Zr,di,ni)});function L1(Zr,ni){var di=r0(Zr)?Dc:Kv;return di(Zr,zu(ni,3))}function b3(Zr,ni,di,un){return Zr==null?[]:(r0(ni)||(ni=ni==null?[]:[ni]),di=un?H:di,r0(di)||(di=di==null?[]:[di]),Wv(Zr,ni,di))}var y3=D1(function(Zr,ni,di){Zr[di?0:1].push(ni)},function(){return[[],[]]});function w3(Zr,ni,di){var un=r0(Zr)?X1:bv,Bn=arguments.length<3;return un(Zr,zu(ni,4),di,Bn,jl)}function _3(Zr,ni,di){var un=r0(Zr)?gg:bv,Bn=arguments.length<3;return un(Zr,zu(ni,4),di,Bn,Nv)}function M3(Zr,ni){var di=r0(Zr)?kl:kv;return di(Zr,j1(zu(ni,3)))}function x3(Zr){var ni=r0(Zr)?Cv:vb;return ni(Zr)}function E3(Zr,ni,di){(di?Wc(Zr,ni,di):ni===H)?ni=1:ni=o0(ni);var un=r0(Zr)?G2:mb;return un(Zr,ni)}function A3(Zr){var ni=r0(Zr)?V2:bb;return ni(Zr)}function S3(Zr){if(Zr==null)return 0;if(Xc(Zr))return K1(Zr)?dd(Zr):Zr.length;var ni=Hc(Zr);return ni==Oh||ni==tf?Zr.size:bp(Zr).length}function $3(Zr,ni,di){var un=r0(Zr)?ep:yb;return di&&Wc(Zr,ni,di)&&(ni=H),un(Zr,zu(ni,3))}var R3=D0(function(Zr,ni){if(Zr==null)return[];var di=ni.length;return di>1&&Wc(Zr,ni[0],ni[1])?ni=[]:di>2&&Wc(ni[0],ni[1],ni[2])&&(ni=[ni[0]]),Wv(Zr,Fc(ni,1),[])}),U1=f2||function(){return oc.Date.now()};function I3(Zr,ni){if(typeof ni!="function")throw new ul(ri);return Zr=o0(Zr),function(){if(--Zr<1)return ni.apply(this,arguments)}}function jm(Zr,ni,di){return ni=di?H:ni,ni=Zr&&ni==null?Zr.length:ni,ql(Zr,an,H,H,H,H,ni)}function Fm(Zr,ni){var di;if(typeof ni!="function")throw new ul(ri);return Zr=o0(Zr),function(){return--Zr>0&&(di=ni.apply(this,arguments)),Zr<=1&&(ni=H),di}}var jp=D0(function(Zr,ni,di){var un=hn;if(di.length){var Bn=Ul(di,_d(jp));un|=An}return ql(Zr,un,ni,di,Bn)}),Km=D0(function(Zr,ni,di){var un=hn|ln;if(di.length){var Bn=Ul(di,_d(Km));un|=An}return ql(ni,un,Zr,di,Bn)});function Hm(Zr,ni,di){ni=di?H:ni;var un=ql(Zr,gn,H,H,H,H,H,ni);return un.placeholder=Hm.placeholder,un}function Gm(Zr,ni,di){ni=di?H:ni;var un=ql(Zr,cn,H,H,H,H,H,ni);return un.placeholder=Gm.placeholder,un}function Vm(Zr,ni,di){var un,Bn,qo,Lo,jo,mh,Uh=0,zh=!1,Fh=!1,Qh=!0;if(typeof Zr!="function")throw new ul(ri);ni=vl(ni)||0,qc(di)&&(zh=!!di.leading,Fh="maxWait"in di,qo=Fh?Lc(vl(di.maxWait)||0,ni):qo,Qh="trailing"in di?!!di.trailing:Qh);function ku(Oc){var wl=un,Tl=Bn;return un=Bn=H,Uh=Oc,Lo=Zr.apply(Tl,wl),Lo}function Fu(Oc){return Uh=Oc,jo=zd(F0,ni),zh?ku(Oc):Lo}function f0(Oc){var wl=Oc-mh,Tl=Oc-Uh,lg=ni-wl;return Fh?Kc(lg,qo-Tl):lg}function Ku(Oc){var wl=Oc-mh,Tl=Oc-Uh;return mh===H||wl>=ni||wl<0||Fh&&Tl>=qo}function F0(){var Oc=U1();if(Ku(Oc))return fc(Oc);jo=zd(F0,f0(Oc))}function fc(Oc){return jo=H,Qh&&un?ku(Oc):(un=Bn=H,Lo)}function al(){jo!==H&&im(jo),Uh=0,un=mh=Bn=jo=H}function Jc(){return jo===H?Lo:fc(U1())}function ol(){var Oc=U1(),wl=Ku(Oc);if(un=arguments,Bn=this,mh=Oc,wl){if(jo===H)return Fu(mh);if(Fh)return im(jo),jo=zd(F0,ni),ku(mh)}return jo===H&&(jo=zd(F0,ni)),Lo}return ol.cancel=al,ol.flush=Jc,ol}var D3=D0(function(Zr,ni){return Tv(Zr,1,ni)}),q3=D0(function(Zr,ni,di){return Tv(Zr,vl(ni)||0,di)});function B3(Zr){return ql(Zr,Ya)}function z1(Zr,ni){if(typeof Zr!="function"||ni!=null&&typeof ni!="function")throw new ul(ri);var di=function(){var un=arguments,Bn=ni?ni.apply(this,un):un[0],qo=di.cache;if(qo.has(Bn))return qo.get(Bn);var Lo=Zr.apply(this,un);return di.cache=qo.set(Bn,Lo)||qo,Lo};return di.cache=new(z1.Cache||Il),di}z1.Cache=Il;function j1(Zr){if(typeof Zr!="function")throw new ul(ri);return function(){var ni=arguments;switch(ni.length){case 0:return!Zr.call(this);case 1:return!Zr.call(this,ni[0]);case 2:return!Zr.call(this,ni[0],ni[1]);case 3:return!Zr.call(this,ni[0],ni[1],ni[2])}return!Zr.apply(this,ni)}}function C3(Zr){return Fm(2,Zr)}var P3=wb(function(Zr,ni){ni=ni.length==1&&r0(ni[0])?Dc(ni[0],il(zu())):Dc(Fc(ni,1),il(zu()));var di=ni.length;return D0(function(un){for(var Bn=-1,qo=Kc(un.length,di);++Bn=ni}),ad=zv(function(){return arguments}())?zv:function(Zr){return Bc(Zr)&&Mc.call(Zr,"callee")&&!$v.call(Zr,"callee")},r0=Nh.isArray,J3=Gc?il(Gc):ib;function Xc(Zr){return Zr!=null&&F1(Zr.length)&&!Pl(Zr)}function Pc(Zr){return Bc(Zr)&&Xc(Zr)}function Z3(Zr){return Zr===!0||Zr===!1||Bc(Zr)&&Vc(Zr)==pn}var Gl=u2||lv,Q3=ml?il(ml):nb;function Y3(Zr){return Bc(Zr)&&Zr.nodeType===1&&!jd(Zr)}function X3(Zr){if(Zr==null)return!0;if(Xc(Zr)&&(r0(Zr)||typeof Zr=="string"||typeof Zr.splice=="function"||Gl(Zr)||Md(Zr)||ad(Zr)))return!Zr.length;var ni=Hc(Zr);if(ni==Oh||ni==tf)return!Zr.size;if(Ud(Zr))return!bp(Zr).length;for(var di in Zr)if(Mc.call(Zr,di))return!1;return!0}function ew(Zr,ni){return Nd(Zr,ni)}function tw(Zr,ni,di){di=typeof di=="function"?di:H;var un=di?di(Zr,ni):H;return un===H?Nd(Zr,ni,H,di):!!un}function Kp(Zr){if(!Bc(Zr))return!1;var ni=Vc(Zr);return ni==ho||ni==$i||typeof Zr.message=="string"&&typeof Zr.name=="string"&&!jd(Zr)}function rw(Zr){return typeof Zr=="number"&&Iv(Zr)}function Pl(Zr){if(!qc(Zr))return!1;var ni=Vc(Zr);return ni==Do||ni==To||ni==on||ni==Qf}function Jm(Zr){return typeof Zr=="number"&&Zr==o0(Zr)}function F1(Zr){return typeof Zr=="number"&&Zr>-1&&Zr%1==0&&Zr<=ii}function qc(Zr){var ni=typeof Zr;return Zr!=null&&(ni=="object"||ni=="function")}function Bc(Zr){return Zr!=null&&typeof Zr=="object"}var Zm=fl?il(fl):ab;function iw(Zr,ni){return Zr===ni||gp(Zr,ni,Pp(ni))}function nw(Zr,ni,di){return di=typeof di=="function"?di:H,gp(Zr,ni,Pp(ni),di)}function sw(Zr){return Qm(Zr)&&Zr!=+Zr}function aw(Zr){if(Fb(Zr))throw new e0(W);return jv(Zr)}function ow(Zr){return Zr===null}function fw(Zr){return Zr==null}function Qm(Zr){return typeof Zr=="number"||Bc(Zr)&&Vc(Zr)==Fo}function jd(Zr){if(!Bc(Zr)||Vc(Zr)!=Hh)return!1;var ni=v1(Zr);if(ni===null)return!0;var di=Mc.call(ni,"constructor")&&ni.constructor;return typeof di=="function"&&di instanceof di&&c1.call(di)==n2}var Hp=xl?il(xl):ob;function hw(Zr){return Jm(Zr)&&Zr>=-ii&&Zr<=ii}var Ym=$d?il($d):fb;function K1(Zr){return typeof Zr=="string"||!r0(Zr)&&Bc(Zr)&&Vc(Zr)==Ko}function sl(Zr){return typeof Zr=="symbol"||Bc(Zr)&&Vc(Zr)==Kh}var Md=Yl?il(Yl):hb;function uw(Zr){return Zr===H}function cw(Zr){return Bc(Zr)&&Hc(Zr)==Uo}function lw(Zr){return Bc(Zr)&&Vc(Zr)==Vh}var dw=P1(yp),pw=P1(function(Zr,ni){return Zr<=ni});function Xm(Zr){if(!Zr)return[];if(Xc(Zr))return K1(Zr)?gl(Zr):Yc(Zr);if(Id&&Zr[Id])return Cg(Zr[Id]());var ni=Hc(Zr),di=ni==Oh?ap:ni==tf?f1:xd;return di(Zr)}function Ol(Zr){if(!Zr)return Zr===0?Zr:0;if(Zr=vl(Zr),Zr===ei||Zr===-ei){var ni=Zr<0?-1:1;return ni*Wr}return Zr===Zr?Zr:0}function o0(Zr){var ni=Ol(Zr),di=ni%1;return ni===ni?di?ni-di:ni:0}function eg(Zr){return Zr?rd(o0(Zr),0,Le):0}function vl(Zr){if(typeof Zr=="number")return Zr;if(sl(Zr))return R;if(qc(Zr)){var ni=typeof Zr.valueOf=="function"?Zr.valueOf():Zr;Zr=qc(ni)?ni+"":ni}if(typeof Zr!="string")return Zr===0?Zr:+Zr;Zr=yv(Zr);var di=rc.test(Zr);return di||nc.test(Zr)?t0(Zr.slice(2),di?2:8):tc.test(Zr)?R:+Zr}function tg(Zr){return Al(Zr,el(Zr))}function vw(Zr){return Zr?rd(o0(Zr),-ii,ii):Zr===0?Zr:0}function _c(Zr){return Zr==null?"":nl(Zr)}var mw=yd(function(Zr,ni){if(Ud(ni)||Xc(ni)){Al(ni,jc(ni),Zr);return}for(var di in ni)Mc.call(ni,di)&&Pd(Zr,di,ni[di])}),rg=yd(function(Zr,ni){Al(ni,el(ni),Zr)}),H1=yd(function(Zr,ni,di,un){Al(ni,el(ni),Zr,un)}),gw=yd(function(Zr,ni,di,un){Al(ni,jc(ni),Zr,un)}),bw=Bl(lp);function yw(Zr,ni){var di=bd(Zr);return ni==null?di:Pv(di,ni)}var ww=D0(function(Zr,ni){Zr=$c(Zr);var di=-1,un=ni.length,Bn=un>2?ni[2]:H;for(Bn&&Wc(ni[0],ni[1],Bn)&&(un=1);++di1),qo}),Al(Zr,Bp(Zr),di),un&&(di=ll(di,hi|ci|ui,qb));for(var Bn=ni.length;Bn--;)Ep(di,ni[Bn]);return di});function kw(Zr,ni){return ng(Zr,j1(zu(ni)))}var Lw=Bl(function(Zr,ni){return Zr==null?{}:lb(Zr,ni)});function ng(Zr,ni){if(Zr==null)return{};var di=Dc(Bp(Zr),function(un){return[un]});return ni=zu(ni),Jv(Zr,di,function(un,Bn){return ni(un,Bn[0])})}function Uw(Zr,ni,di){ni=Kl(ni,Zr);var un=-1,Bn=ni.length;for(Bn||(Bn=1,Zr=H);++unni){var un=Zr;Zr=ni,ni=un}if(di||Zr%1||ni%1){var Bn=Dv();return Kc(Zr+Bn*(ni-Zr+Ac("1e-"+((Bn+"").length-1))),ni)}return _p(Zr,ni)}var Qw=wd(function(Zr,ni,di){return ni=ni.toLowerCase(),Zr+(di?og(ni):ni)});function og(Zr){return Wp(_c(Zr).toLowerCase())}function fg(Zr){return Zr=_c(Zr),Zr&&Zr.replace(s0,Sg).replace(Z1,"")}function Yw(Zr,ni,di){Zr=_c(Zr),ni=nl(ni);var un=Zr.length;di=di===H?un:rd(o0(di),0,un);var Bn=di;return di-=ni.length,di>=0&&Zr.slice(di,Bn)==ni}function Xw(Zr){return Zr=_c(Zr),Zr&&Xh.test(Zr)?Zr.replace(Th,$g):Zr}function e6(Zr){return Zr=_c(Zr),Zr&&_h.test(Zr)?Zr.replace(Ih,"\\$&"):Zr}var t6=wd(function(Zr,ni,di){return Zr+(di?"-":"")+ni.toLowerCase()}),r6=wd(function(Zr,ni,di){return Zr+(di?" ":"")+ni.toLowerCase()}),i6=cm("toLowerCase");function n6(Zr,ni,di){Zr=_c(Zr),ni=o0(ni);var un=ni?dd(Zr):0;if(!ni||un>=ni)return Zr;var Bn=(ni-un)/2;return C1(y1(Bn),di)+Zr+C1(b1(Bn),di)}function s6(Zr,ni,di){Zr=_c(Zr),ni=o0(ni);var un=ni?dd(Zr):0;return ni&&un>>0,di?(Zr=_c(Zr),Zr&&(typeof ni=="string"||ni!=null&&!Hp(ni))&&(ni=nl(ni),!ni&&ld(Zr))?Hl(gl(Zr),0,di):Zr.split(ni,di)):[]}var l6=wd(function(Zr,ni,di){return Zr+(di?" ":"")+Wp(ni)});function d6(Zr,ni,di){return Zr=_c(Zr),di=di==null?0:rd(o0(di),0,Zr.length),ni=nl(ni),Zr.slice(di,di+ni.length)==ni}function p6(Zr,ni,di){var un=uo.templateSettings;di&&Wc(Zr,ni,di)&&(ni=H),Zr=_c(Zr),ni=H1({},ni,un,bm);var Bn=H1({},ni.imports,un.imports,bm),qo=jc(Bn),Lo=sp(Bn,qo),jo,mh,Uh=0,zh=ni.interpolate||hc,Fh="__p += '",Qh=op((ni.escape||hc).source+"|"+zh.source+"|"+(zh===au?qh:hc).source+"|"+(ni.evaluate||hc).source+"|$","g"),ku="//# sourceURL="+(Mc.call(ni,"sourceURL")?(ni.sourceURL+"").replace(/\s/g," "):"lodash.templateSources["+ ++Q1+"]")+` -`;Zr.replace(Qh,function(Ku,F0,fc,al,Jc,ol){return fc||(fc=al),Fh+=Zr.slice(Uh,ol).replace(pc,Rg),F0&&(jo=!0,Fh+=`' + -__e(`+F0+`) + -'`),Jc&&(mh=!0,Fh+=`'; -`+Jc+`; -__p += '`),fc&&(Fh+=`' + -((__t = (`+fc+`)) == null ? '' : __t) + -'`),Uh=ol+Ku.length,Ku}),Fh+=`'; -`;var Fu=Mc.call(ni,"variable")&&ni.variable;if(!Fu)Fh=`with (obj) { -`+Fh+` -} -`;else if(Hu.test(Fu))throw new e0(si);Fh=(mh?Fh.replace(Lu,""):Fh).replace(Ph,"$1").replace(Sh,"$1;"),Fh="function("+(Fu||"obj")+`) { -`+(Fu?"":`obj || (obj = {}); -`)+"var __t, __p = ''"+(jo?", __e = _.escape":"")+(mh?`, __j = Array.prototype.join; -function print() { __p += __j.call(arguments, '') } -`:`; -`)+Fh+`return __p -}`;var f0=ug(function(){return wc(qo,ku+"return "+Fh).apply(H,Lo)});if(f0.source=Fh,Kp(f0))throw f0;return f0}function v6(Zr){return _c(Zr).toLowerCase()}function m6(Zr){return _c(Zr).toUpperCase()}function g6(Zr,ni,di){if(Zr=_c(Zr),Zr&&(di||ni===H))return yv(Zr);if(!Zr||!(ni=nl(ni)))return Zr;var un=gl(Zr),Bn=gl(ni),qo=wv(un,Bn),Lo=_v(un,Bn)+1;return Hl(un,qo,Lo).join("")}function b6(Zr,ni,di){if(Zr=_c(Zr),Zr&&(di||ni===H))return Zr.slice(0,xv(Zr)+1);if(!Zr||!(ni=nl(ni)))return Zr;var un=gl(Zr),Bn=_v(un,gl(ni))+1;return Hl(un,0,Bn).join("")}function y6(Zr,ni,di){if(Zr=_c(Zr),Zr&&(di||ni===H))return Zr.replace(uu,"");if(!Zr||!(ni=nl(ni)))return Zr;var un=gl(Zr),Bn=wv(un,gl(ni));return Hl(un,Bn).join("")}function w6(Zr,ni){var di=Ho,un=oi;if(qc(ni)){var Bn="separator"in ni?ni.separator:Bn;di="length"in ni?o0(ni.length):di,un="omission"in ni?nl(ni.omission):un}Zr=_c(Zr);var qo=Zr.length;if(ld(Zr)){var Lo=gl(Zr);qo=Lo.length}if(di>=qo)return Zr;var jo=di-dd(un);if(jo<1)return un;var mh=Lo?Hl(Lo,0,jo).join(""):Zr.slice(0,jo);if(Bn===H)return mh+un;if(Lo&&(jo+=mh.length-jo),Hp(Bn)){if(Zr.slice(jo).search(Bn)){var Uh,zh=mh;for(Bn.global||(Bn=op(Bn.source,_c(Tu.exec(Bn))+"g")),Bn.lastIndex=0;Uh=Bn.exec(zh);)var Fh=Uh.index;mh=mh.slice(0,Fh===H?jo:Fh)}}else if(Zr.indexOf(nl(Bn),jo)!=jo){var Qh=mh.lastIndexOf(Bn);Qh>-1&&(mh=mh.slice(0,Qh))}return mh+un}function _6(Zr){return Zr=_c(Zr),Zr&&gh.test(Zr)?Zr.replace(Uu,Ng):Zr}var M6=wd(function(Zr,ni,di){return Zr+(di?" ":"")+ni.toUpperCase()}),Wp=cm("toUpperCase");function hg(Zr,ni,di){return Zr=_c(Zr),ni=di?H:ni,ni===H?Dg(Zr)?Fg(Zr):wg(Zr):Zr.match(ni)||[]}var ug=D0(function(Zr,ni){try{return zc(Zr,H,ni)}catch(di){return Kp(di)?di:new e0(di)}}),x6=Bl(function(Zr,ni){return hl(ni,function(di){di=Sl(di),Dl(Zr,di,jp(Zr[di],Zr))}),Zr});function E6(Zr){var ni=Zr==null?0:Zr.length,di=zu();return Zr=ni?Dc(Zr,function(un){if(typeof un[1]!="function")throw new ul(ri);return[di(un[0]),un[1]]}):[],D0(function(un){for(var Bn=-1;++Bnii)return[];var di=Le,un=Kc(Zr,Le);ni=zu(ni),Zr-=Le;for(var Bn=np(un,ni);++di0||ni<0)?new ac(di):(Zr<0?di=di.takeRight(-Zr):Zr&&(di=di.drop(Zr)),ni!==H&&(ni=o0(ni),di=ni<0?di.dropRight(-ni):di.take(ni-Zr)),di)},ac.prototype.takeRightWhile=function(Zr){return this.reverse().takeWhile(Zr).reverse()},ac.prototype.toArray=function(){return this.take(Le)},El(ac.prototype,function(Zr,ni){var di=/^(?:filter|find|map|reject)|While$/.test(ni),un=/^(?:head|last)$/.test(ni),Bn=uo[un?"take"+(ni=="last"?"Right":""):ni],qo=un||/^find/.test(ni);Bn&&(uo.prototype[ni]=function(){var Lo=this.__wrapped__,jo=un?[1]:arguments,mh=Lo instanceof ac,Uh=jo[0],zh=mh||r0(Lo),Fh=function(F0){var fc=Bn.apply(uo,Ll([F0],jo));return un&&Qh?fc[0]:fc};zh&&di&&typeof Uh=="function"&&Uh.length!=1&&(mh=zh=!1);var Qh=this.__chain__,ku=!!this.__actions__.length,Fu=qo&&!Qh,f0=mh&&!ku;if(!qo&&zh){Lo=f0?Lo:new ac(this);var Ku=Zr.apply(Lo,jo);return Ku.__actions__.push({func:k1,args:[Fh],thisArg:H}),new cl(Ku,Qh)}return Fu&&f0?Zr.apply(this,jo):(Ku=this.thru(Fh),Fu?un?Ku.value()[0]:Ku.value():Ku)})}),hl(["pop","push","shift","sort","splice","unshift"],function(Zr){var ni=h1[Zr],di=/^(?:push|sort|unshift)$/.test(Zr)?"tap":"thru",un=/^(?:pop|shift)$/.test(Zr);uo.prototype[Zr]=function(){var Bn=arguments;if(un&&!this.__chain__){var qo=this.value();return ni.apply(r0(qo)?qo:[],Bn)}return this[di](function(Lo){return ni.apply(r0(Lo)?Lo:[],Bn)})}}),El(ac.prototype,function(Zr,ni){var di=uo[ni];if(di){var un=di.name+"";Mc.call(gd,un)||(gd[un]=[]),gd[un].push({name:ni,func:di})}}),gd[q1(H,ln).name]=[{name:"wrapper",func:H}],ac.prototype.clone=_2,ac.prototype.reverse=M2,ac.prototype.value=x2,uo.prototype.at=Yy,uo.prototype.chain=Xy,uo.prototype.commit=e3,uo.prototype.next=t3,uo.prototype.plant=i3,uo.prototype.reverse=n3,uo.prototype.toJSON=uo.prototype.valueOf=uo.prototype.value=s3,uo.prototype.first=uo.prototype.head,Id&&(uo.prototype[Id]=r3),uo},pd=e2();Cc?((Cc.exports=pd)._=pd,Sc._=pd):oc._=pd}).call(ge)})(Ui,Ui.exports);var zg=Object.defineProperty,Kg=Object.defineProperties,Yg=Object.getOwnPropertyDescriptors,ya=Object.getOwnPropertySymbols,Zg=Object.prototype.hasOwnProperty,Jg=Object.prototype.propertyIsEnumerable,Sa=(G,e,H)=>e in G?zg(G,e,{enumerable:!0,configurable:!0,writable:!0,value:H}):G[e]=H,cr=(G,e)=>{for(var H in e||(e={}))Zg.call(e,H)&&Sa(G,H,e[H]);if(ya)for(var H of ya(e))Jg.call(e,H)&&Sa(G,H,e[H]);return G},Xg=(G,e)=>Kg(G,Yg(e));function ft(G,e,H){var Y;const Ne=dn(G);return((Y=e.rpcMap)==null?void 0:Y[Ne.reference])||`${Gg}?chainId=${Ne.namespace}:${Ne.reference}&projectId=${H}`}function Ct(G){return G.includes(":")?G.split(":")[1]:G}function Oa(G){return G.map(e=>`${e.split(":")[0]}:${e.split(":")[1]}`)}function Qg(G,e){const H=Object.keys(e.namespaces).filter(Ne=>Ne.includes(G));if(!H.length)return[];const Y=[];return H.forEach(Ne=>{const W=e.namespaces[Ne].accounts;Y.push(...W)}),Y}function Wi(G={},e={}){const H=Ra(G),Y=Ra(e);return Ui.exports.merge(H,Y)}function Ra(G){var e,H,Y,Ne;const W={};if(!Yr(G))return W;for(const[ri,si]of Object.entries(G)){const fi=Zi$1(ri)?[ri]:si.chains,ai=si.methods||[],ti=si.events||[],hi=si.rpcMap||{},ci=vo(ri);W[ci]=Xg(cr(cr({},W[ci]),si),{chains:ge$2(fi,(e=W[ci])==null?void 0:e.chains),methods:ge$2(ai,(H=W[ci])==null?void 0:H.methods),events:ge$2(ti,(Y=W[ci])==null?void 0:Y.events),rpcMap:cr(cr({},hi),(Ne=W[ci])==null?void 0:Ne.rpcMap)})}return W}function Vg(G){return G.includes(":")?G.split(":")[2]:G}function ba(G){const e={};for(const[H,Y]of Object.entries(G)){const Ne=Y.methods||[],W=Y.events||[],ri=Y.accounts||[],si=Zi$1(H)?[H]:Y.chains?Y.chains:Oa(Y.accounts);e[H]={chains:si,methods:Ne,events:W,accounts:ri}}return e}function Fi(G){return typeof G=="number"?G:G.includes("0x")?parseInt(G,16):(G=G.includes(":")?G.split(":")[1]:G,isNaN(Number(G))?G:Number(G))}const Ta={},z$1=G=>Ta[G],Mi=(G,e)=>{Ta[G]=e};class kg{constructor(e){this.name="polkadot",this.namespace=e.namespace,this.events=z$1("events"),this.client=z$1("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,H){this.httpProviders[e]||this.setHttpProvider(e,H),this.chainId=e,this.events.emit(Vn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(H=>H.split(":")[1]===this.chainId.toString()).map(H=>H.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(H=>{var Y;const Ne=Ct(H);e[Ne]=this.createHttpProvider(Ne,(Y=this.namespace.rpcMap)==null?void 0:Y[H])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,H=this.httpProviders[e];if(typeof H>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return H}setHttpProvider(e,H){const Y=this.createHttpProvider(e,H);Y&&(this.httpProviders[e]=Y)}createHttpProvider(e,H){const Y=H||ft(e,this.namespace,this.client.core.projectId);if(!Y)throw new Error(`No RPC url provided for chainId: ${e}`);return new o$1(new f(Y,z$1("disableProviderPing")))}}class jg{constructor(e){this.name="eip155",this.namespace=e.namespace,this.events=z$1("events"),this.client=z$1("client"),this.httpProviders=this.createHttpProviders(),this.chainId=parseInt(this.getDefaultChain())}async request(e){switch(e.request.method){case"eth_requestAccounts":return this.getAccounts();case"eth_accounts":return this.getAccounts();case"wallet_switchEthereumChain":return await this.handleSwitchChain(e);case"eth_chainId":return parseInt(this.getDefaultChain())}return this.namespace.methods.includes(e.request.method)?await this.client.request(e):this.getHttpProvider().request(e.request)}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}setDefaultChain(e,H){this.httpProviders[e]||this.setHttpProvider(parseInt(e),H),this.chainId=parseInt(e),this.events.emit(Vn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}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,H){const Y=H||ft(`${this.name}:${e}`,this.namespace,this.client.core.projectId);if(!Y)throw new Error(`No RPC url provided for chainId: ${e}`);return new o$1(new f(Y,z$1("disableProviderPing")))}setHttpProvider(e,H){const Y=this.createHttpProvider(e,H);Y&&(this.httpProviders[e]=Y)}createHttpProviders(){const e={};return this.namespace.chains.forEach(H=>{var Y;const Ne=parseInt(Ct(H));e[Ne]=this.createHttpProvider(Ne,(Y=this.namespace.rpcMap)==null?void 0:Y[H])}),e}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(H=>H.split(":")[1]===this.chainId.toString()).map(H=>H.split(":")[2]))]:[]}getHttpProvider(){const e=this.chainId,H=this.httpProviders[e];if(typeof H>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return H}async handleSwitchChain(e){var H,Y;let Ne=e.request.params?(H=e.request.params[0])==null?void 0:H.chainId:"0x0";Ne=Ne.startsWith("0x")?Ne:`0x${Ne}`;const W=parseInt(Ne,16);if(this.isChainApproved(W))this.setDefaultChain(`${W}`);else if(this.namespace.methods.includes("wallet_switchEthereumChain"))await this.client.request({topic:e.topic,request:{method:e.request.method,params:[{chainId:Ne}]},chainId:(Y=this.namespace.chains)==null?void 0:Y[0]}),this.setDefaultChain(`${W}`);else throw new Error(`Failed to switch to chain 'eip155:${W}'. The chain is not approved or the wallet does not support 'wallet_switchEthereumChain' method.`);return null}isChainApproved(e){return this.namespace.chains.includes(`${this.name}:${e}`)}}class nv{constructor(e){this.name="solana",this.namespace=e.namespace,this.events=z$1("events"),this.client=z$1("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,H){this.httpProviders[e]||this.setHttpProvider(e,H),this.chainId=e,this.events.emit(Vn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}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]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(H=>H.split(":")[1]===this.chainId.toString()).map(H=>H.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(H=>{var Y;const Ne=Ct(H);e[Ne]=this.createHttpProvider(Ne,(Y=this.namespace.rpcMap)==null?void 0:Y[H])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,H=this.httpProviders[e];if(typeof H>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return H}setHttpProvider(e,H){const Y=this.createHttpProvider(e,H);Y&&(this.httpProviders[e]=Y)}createHttpProvider(e,H){const Y=H||ft(e,this.namespace,this.client.core.projectId);if(!Y)throw new Error(`No RPC url provided for chainId: ${e}`);return new o$1(new f(Y,z$1("disableProviderPing")))}}class tv{constructor(e){this.name="cosmos",this.namespace=e.namespace,this.events=z$1("events"),this.client=z$1("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,H){this.httpProviders[e]||this.setHttpProvider(e,H),this.chainId=e,this.events.emit(Vn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(H=>H.split(":")[1]===this.chainId.toString()).map(H=>H.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(H=>{var Y;const Ne=Ct(H);e[Ne]=this.createHttpProvider(Ne,(Y=this.namespace.rpcMap)==null?void 0:Y[H])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,H=this.httpProviders[e];if(typeof H>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return H}setHttpProvider(e,H){const Y=this.createHttpProvider(e,H);Y&&(this.httpProviders[e]=Y)}createHttpProvider(e,H){const Y=H||ft(e,this.namespace,this.client.core.projectId);if(!Y)throw new Error(`No RPC url provided for chainId: ${e}`);return new o$1(new f(Y,z$1("disableProviderPing")))}}class ev{constructor(e){this.name="cip34",this.namespace=e.namespace,this.events=z$1("events"),this.client=z$1("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,H){this.httpProviders[e]||this.setHttpProvider(e,H),this.chainId=e,this.events.emit(Vn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(H=>H.split(":")[1]===this.chainId.toString()).map(H=>H.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(H=>{const Y=this.getCardanoRPCUrl(H),Ne=Ct(H);e[Ne]=this.createHttpProvider(Ne,Y)}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,H=this.httpProviders[e];if(typeof H>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return H}getCardanoRPCUrl(e){const H=this.namespace.rpcMap;if(H)return H[e]}setHttpProvider(e,H){const Y=this.createHttpProvider(e,H);Y&&(this.httpProviders[e]=Y)}createHttpProvider(e,H){const Y=H||this.getCardanoRPCUrl(e);if(!Y)throw new Error(`No RPC url provided for chainId: ${e}`);return new o$1(new f(Y,z$1("disableProviderPing")))}}class rv{constructor(e){this.name="elrond",this.namespace=e.namespace,this.events=z$1("events"),this.client=z$1("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,H){this.httpProviders[e]||this.setHttpProvider(e,H),this.chainId=e,this.events.emit(Vn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}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]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(H=>H.split(":")[1]===this.chainId.toString()).map(H=>H.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(H=>{var Y;const Ne=Ct(H);e[Ne]=this.createHttpProvider(Ne,(Y=this.namespace.rpcMap)==null?void 0:Y[H])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,H=this.httpProviders[e];if(typeof H>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return H}setHttpProvider(e,H){const Y=this.createHttpProvider(e,H);Y&&(this.httpProviders[e]=Y)}createHttpProvider(e,H){const Y=H||ft(e,this.namespace,this.client.core.projectId);if(!Y)throw new Error(`No RPC url provided for chainId: ${e}`);return new o$1(new f(Y,z$1("disableProviderPing")))}}class iv{constructor(e){this.name="multiversx",this.namespace=e.namespace,this.events=z$1("events"),this.client=z$1("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,H){this.httpProviders[e]||this.setHttpProvider(e,H),this.chainId=e,this.events.emit(Vn.DEFAULT_CHAIN_CHANGED,`${this.name}:${e}`)}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]}getAccounts(){const e=this.namespace.accounts;return e?[...new Set(e.filter(H=>H.split(":")[1]===this.chainId.toString()).map(H=>H.split(":")[2]))]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(H=>{var Y;const Ne=Ct(H);e[Ne]=this.createHttpProvider(Ne,(Y=this.namespace.rpcMap)==null?void 0:Y[H])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,H=this.httpProviders[e];if(typeof H>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return H}setHttpProvider(e,H){const Y=this.createHttpProvider(e,H);Y&&(this.httpProviders[e]=Y)}createHttpProvider(e,H){const Y=H||ft(e,this.namespace,this.client.core.projectId);if(!Y)throw new Error(`No RPC url provided for chainId: ${e}`);return new o$1(new f(Y,z$1("disableProviderPing")))}}class sv{constructor(e){this.name="near",this.namespace=e.namespace,this.events=z$1("events"),this.client=z$1("client"),this.chainId=this.getDefaultChain(),this.httpProviders=this.createHttpProviders()}updateNamespace(e){this.namespace=Object.assign(this.namespace,e)}requestAccounts(){return this.getAccounts()}getDefaultChain(){if(this.chainId)return this.chainId;if(this.namespace.defaultChain)return this.namespace.defaultChain;const e=this.namespace.chains[0];if(!e)throw new Error("ChainId not found");return e.split(":")[1]}request(e){return this.namespace.methods.includes(e.request.method)?this.client.request(e):this.getHttpProvider().request(e.request)}setDefaultChain(e,H){if(this.chainId=e,!this.httpProviders[e]){const Y=H||ft(`${this.name}:${e}`,this.namespace);if(!Y)throw new Error(`No RPC url provided for chainId: ${e}`);this.setHttpProvider(e,Y)}this.events.emit(Vn.DEFAULT_CHAIN_CHANGED,`${this.name}:${this.chainId}`)}getAccounts(){const e=this.namespace.accounts;return e?e.filter(H=>H.split(":")[1]===this.chainId.toString()).map(H=>H.split(":")[2])||[]:[]}createHttpProviders(){const e={};return this.namespace.chains.forEach(H=>{var Y;e[H]=this.createHttpProvider(H,(Y=this.namespace.rpcMap)==null?void 0:Y[H])}),e}getHttpProvider(){const e=`${this.name}:${this.chainId}`,H=this.httpProviders[e];if(typeof H>"u")throw new Error(`JSON-RPC provider for ${e} not found`);return H}setHttpProvider(e,H){const Y=this.createHttpProvider(e,H);Y&&(this.httpProviders[e]=Y)}createHttpProvider(e,H){const Y=H||ft(e,this.namespace);return typeof Y>"u"?void 0:new o$1(new f(Y,z$1("disableProviderPing")))}}var uv=Object.defineProperty,av=Object.defineProperties,ov=Object.getOwnPropertyDescriptors,La=Object.getOwnPropertySymbols,fv=Object.prototype.hasOwnProperty,cv=Object.prototype.propertyIsEnumerable,Da=(G,e,H)=>e in G?uv(G,e,{enumerable:!0,configurable:!0,writable:!0,value:H}):G[e]=H,hr=(G,e)=>{for(var H in e||(e={}))fv.call(e,H)&&Da(G,H,e[H]);if(La)for(var H of La(e))cv.call(e,H)&&Da(G,H,e[H]);return G},qi=(G,e)=>av(G,ov(e));class lr{constructor(e){this.events=new Wg,this.rpcProviders={},this.shouldAbortPairingAttempt=!1,this.maxPairingAttempts=10,this.disableProviderPing=!1,this.providerOpts=e,this.logger=typeof(e==null?void 0:e.logger)<"u"&&typeof(e==null?void 0:e.logger)!="string"?e.logger:Hg(k({level:(e==null?void 0:e.logger)||xa})),this.disableProviderPing=(e==null?void 0:e.disableProviderPing)||!1}static async init(e){const H=new lr(e);return await H.initialize(),H}async request(e,H,Y){const[Ne,W]=this.validateChain(H);if(!this.session)throw new Error("Please call connect() before request()");return await this.getProvider(Ne).request({request:hr({},e),chainId:`${Ne}:${W}`,topic:this.session.topic,expiry:Y})}sendAsync(e,H,Y,Ne){const W=new Date().getTime();this.request(e,Y,Ne).then(ri=>H(null,formatJsonRpcResult(W,ri))).catch(ri=>H(ri,void 0))}async enable(){if(!this.client)throw new Error("Sign Client not initialized");return this.session||await this.connect({namespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties}),await this.requestAccounts()}async disconnect(){var e;if(!this.session)throw new Error("Please call connect() before enable()");await this.client.disconnect({topic:(e=this.session)==null?void 0:e.topic,reason:tr$1("USER_DISCONNECTED")}),await this.cleanup()}async connect(e){if(!this.client)throw new Error("Sign Client not initialized");if(this.setNamespaces(e),await this.cleanupPendingPairings(),!e.skipPairing)return await this.pair(e.pairingTopic)}async authenticate(e){if(!this.client)throw new Error("Sign Client not initialized");this.setNamespaces(e),await this.cleanupPendingPairings();const{uri:H,response:Y}=await this.client.authenticate(e);H&&(this.uri=H,this.events.emit("display_uri",H));const Ne=await Y();if(this.session=Ne.session,this.session){const W=ba(this.session.namespaces);this.namespaces=Wi(this.namespaces,W),this.persist("namespaces",this.namespaces),this.onConnect()}return Ne}on(e,H){this.events.on(e,H)}once(e,H){this.events.once(e,H)}removeListener(e,H){this.events.removeListener(e,H)}off(e,H){this.events.off(e,H)}get isWalletConnect(){return!0}async pair(e){this.shouldAbortPairingAttempt=!1;let H=0;do{if(this.shouldAbortPairingAttempt)throw new Error("Pairing aborted");if(H>=this.maxPairingAttempts)throw new Error("Max auto pairing attempts reached");const{uri:Y,approval:Ne}=await this.client.connect({pairingTopic:e,requiredNamespaces:this.namespaces,optionalNamespaces:this.optionalNamespaces,sessionProperties:this.sessionProperties});Y&&(this.uri=Y,this.events.emit("display_uri",Y)),await Ne().then(W=>{this.session=W;const ri=ba(W.namespaces);this.namespaces=Wi(this.namespaces,ri),this.persist("namespaces",this.namespaces)}).catch(W=>{if(W.message!==Ge)throw W;H++})}while(!this.session);return this.onConnect(),this.session}setDefaultChain(e,H){try{if(!this.session)return;const[Y,Ne]=this.validateChain(e);this.getProvider(Y).setDefaultChain(Ne,H)}catch(Y){if(!/Please call connect/.test(Y.message))throw Y}}async cleanupPendingPairings(e={}){this.logger.info("Cleaning up inactive pairings...");const H=this.client.pairing.getAll();if(Er(H)){for(const Y of H)e.deletePairings?this.client.core.expirer.set(Y.topic,0):await this.client.core.relayer.subscriber.unsubscribe(Y.topic);this.logger.info(`Inactive pairings cleared: ${H.length}`)}}abortPairingAttempt(){this.shouldAbortPairingAttempt=!0}async checkStorage(){if(this.namespaces=await this.getFromStore("namespaces"),this.optionalNamespaces=await this.getFromStore("optionalNamespaces")||{},this.client.session.length){const e=this.client.session.keys.length-1;this.session=this.client.session.get(this.client.session.keys[e]),this.createProviders()}}async initialize(){this.logger.trace("Initialized"),await this.createClient(),await this.checkStorage(),this.registerEventListeners()}async createClient(){this.client=this.providerOpts.client||await oe.init({logger:this.providerOpts.logger||xa,relayUrl:this.providerOpts.relayUrl||Mg,projectId:this.providerOpts.projectId,metadata:this.providerOpts.metadata,storageOptions:this.providerOpts.storageOptions,storage:this.providerOpts.storage,name:this.providerOpts.name}),this.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(H=>vo(H)))];Mi("client",this.client),Mi("events",this.events),Mi("disableProviderPing",this.disableProviderPing),e.forEach(H=>{if(!this.session)return;const Y=Qg(H,this.session),Ne=Oa(Y),W=Wi(this.namespaces,this.optionalNamespaces),ri=qi(hr({},W[H]),{accounts:Y,chains:Ne});switch(H){case"eip155":this.rpcProviders[H]=new jg({namespace:ri});break;case"solana":this.rpcProviders[H]=new nv({namespace:ri});break;case"cosmos":this.rpcProviders[H]=new tv({namespace:ri});break;case"polkadot":this.rpcProviders[H]=new kg({namespace:ri});break;case"cip34":this.rpcProviders[H]=new ev({namespace:ri});break;case"elrond":this.rpcProviders[H]=new rv({namespace:ri});break;case"multiversx":this.rpcProviders[H]=new iv({namespace:ri});break;case"near":this.rpcProviders[H]=new sv({namespace:ri});break}})}registerEventListeners(){if(typeof this.client>"u")throw new Error("Sign Client is not initialized");this.client.on("session_ping",e=>{this.events.emit("session_ping",e)}),this.client.on("session_event",e=>{const{params:H}=e,{event:Y}=H;if(Y.name==="accountsChanged"){const Ne=Y.data;Ne&&Er(Ne)&&this.events.emit("accountsChanged",Ne.map(Vg))}else if(Y.name==="chainChanged"){const Ne=H.chainId,W=H.event.data,ri=vo(Ne),si=Fi(Ne)!==Fi(W)?`${ri}:${Fi(W)}`:Ne;this.onChainChanged(si)}else this.events.emit(Y.name,Y.data);this.events.emit("session_event",e)}),this.client.on("session_update",({topic:e,params:H})=>{var Y;const{namespaces:Ne}=H,W=(Y=this.client)==null?void 0:Y.session.get(e);this.session=qi(hr({},W),{namespaces:Ne}),this.onSessionUpdate(),this.events.emit("session_update",{topic:e,params:H})}),this.client.on("session_delete",async e=>{await this.cleanup(),this.events.emit("session_delete",e),this.events.emit("disconnect",qi(hr({},tr$1("USER_DISCONNECTED")),{data:e.topic}))}),this.on(Vn.DEFAULT_CHAIN_CHANGED,e=>{this.onChainChanged(e,!0)})}getProvider(e){if(!this.rpcProviders[e])throw new Error(`Provider not found: ${e}`);return this.rpcProviders[e]}onSessionUpdate(){Object.keys(this.rpcProviders).forEach(e=>{var H;this.getProvider(e).updateNamespace((H=this.session)==null?void 0:H.namespaces[e])})}setNamespaces(e){const{namespaces:H,optionalNamespaces:Y,sessionProperties:Ne}=e;H&&Object.keys(H).length&&(this.namespaces=H),Y&&Object.keys(Y).length&&(this.optionalNamespaces=Y),this.sessionProperties=Ne,this.persist("namespaces",H),this.persist("optionalNamespaces",Y)}validateChain(e){const[H,Y]=(e==null?void 0:e.split(":"))||["",""];if(!this.namespaces||!Object.keys(this.namespaces).length)return[H,Y];if(H&&!Object.keys(this.namespaces||{}).map(ri=>vo(ri)).includes(H))throw new Error(`Namespace '${H}' is not configured. Please call connect() first with namespace config.`);if(H&&Y)return[H,Y];const Ne=vo(Object.keys(this.namespaces)[0]),W=this.rpcProviders[Ne].getDefaultChain();return[Ne,W]}async requestAccounts(){const[e]=this.validateChain();return await this.getProvider(e).requestAccounts()}onChainChanged(e,H=!1){if(!this.namespaces)return;const[Y,Ne]=this.validateChain(e);Ne&&(H||this.getProvider(Y).setDefaultChain(Ne),this.namespaces[Y]?this.namespaces[Y].defaultChain=Ne:this.namespaces[`${Y}:${Ne}`]?this.namespaces[`${Y}:${Ne}`].defaultChain=Ne:this.namespaces[`${Y}:${Ne}`]={defaultChain:Ne},this.persist("namespaces",this.namespaces),this.events.emit("chainChanged",Ne))}onConnect(){this.createProviders(),this.events.emit("connect",{session:this.session})}async cleanup(){this.session=void 0,this.namespaces=void 0,this.optionalNamespaces=void 0,this.sessionProperties=void 0,this.persist("namespaces",void 0),this.persist("optionalNamespaces",void 0),this.persist("sessionProperties",void 0),await this.cleanupPendingPairings({deletePairings:!0})}persist(e,H){this.client.core.storage.setItem(`${Ea}/${e}`,H)}async getFromStore(e){return await this.client.core.storage.getItem(`${Ea}/${e}`)}}const hv=lr,T="wc",S="ethereum_provider",$=`${T}@2:${S}:`,j="https://rpc.walletconnect.com/v1/",u=["eth_sendTransaction","personal_sign"],y=["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_sendCalls","wallet_getCapabilities","wallet_getCallsStatus","wallet_showCallsStatus"],g=["chainChanged","accountsChanged"],M=["chainChanged","accountsChanged","message","disconnect","connect"];var q=Object.defineProperty,N=Object.defineProperties,D=Object.getOwnPropertyDescriptors,O=Object.getOwnPropertySymbols,U=Object.prototype.hasOwnProperty,Q=Object.prototype.propertyIsEnumerable,b=(G,e,H)=>e in G?q(G,e,{enumerable:!0,configurable:!0,writable:!0,value:H}):G[e]=H,p=(G,e)=>{for(var H in e||(e={}))U.call(e,H)&&b(G,H,e[H]);if(O)for(var H of O(e))Q.call(e,H)&&b(G,H,e[H]);return G},E=(G,e)=>N(G,D(e));function m(G){return Number(G[0].split(":")[1])}function v(G){return`0x${G.toString(16)}`}function L(G){const{chains:e,optionalChains:H,methods:Y,optionalMethods:Ne,events:W,optionalEvents:ri,rpcMap:si}=G;if(!Er(e))throw new Error("Invalid chains");const fi={chains:e,methods:Y||u,events:W||g,rpcMap:p({},e.length?{[m(e)]:si[m(e)]}:{})},ai=W==null?void 0:W.filter(ui=>!g.includes(ui)),ti=Y==null?void 0:Y.filter(ui=>!u.includes(ui));if(!H&&!ri&&!Ne&&!(ai!=null&&ai.length)&&!(ti!=null&&ti.length))return{required:e.length?fi:void 0};const hi=(ai==null?void 0:ai.length)&&(ti==null?void 0:ti.length)||!H,ci={chains:[...new Set(hi?fi.chains.concat(H||[]):H)],methods:[...new Set(fi.methods.concat(Ne!=null&&Ne.length?Ne:y))],events:[...new Set(fi.events.concat(ri!=null&&ri.length?ri:M))],rpcMap:si};return{required:e.length?fi:void 0,optional:H.length?ci:void 0}}class C{constructor(){this.events=new eventsExports.EventEmitter,this.namespace="eip155",this.accounts=[],this.chainId=1,this.STORAGE_KEY=$,this.on=(e,H)=>(this.events.on(e,H),this),this.once=(e,H)=>(this.events.once(e,H),this),this.removeListener=(e,H)=>(this.events.removeListener(e,H),this),this.off=(e,H)=>(this.events.off(e,H),this),this.parseAccount=e=>this.isCompatibleChainId(e)?this.parseAccountId(e).address:e,this.signer={},this.rpc={}}static async init(e){const H=new C;return await H.initialize(e),H}async request(e,H){return await this.signer.request(e,this.formatChainId(this.chainId),H)}sendAsync(e,H,Y){this.signer.sendAsync(e,H,this.formatChainId(this.chainId),Y)}get connected(){return this.signer.client?this.signer.client.core.relayer.connected:!1}get connecting(){return this.signer.client?this.signer.client.core.relayer.connecting:!1}async enable(){return this.session||await this.connect(),await this.request({method:"eth_requestAccounts"})}async connect(e){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts(e);const{required:H,optional:Y}=L(this.rpc);try{const Ne=await new Promise(async(ri,si)=>{var fi;this.rpc.showQrModal&&((fi=this.modal)==null||fi.subscribeModal(ai=>{!ai.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),si(new Error("Connection request reset. Please try again.")))})),await this.signer.connect(E(p({namespaces:p({},H&&{[this.namespace]:H})},Y&&{optionalNamespaces:{[this.namespace]:Y}}),{pairingTopic:e==null?void 0:e.pairingTopic})).then(ai=>{ri(ai)}).catch(ai=>{si(new Error(ai.message))})});if(!Ne)return;const W=zo(Ne.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:W),this.setAccounts(W),this.events.emit("connect",{chainId:v(this.chainId)})}catch(Ne){throw this.signer.logger.error(Ne),Ne}finally{this.modal&&this.modal.closeModal()}}async authenticate(e){if(!this.signer.client)throw new Error("Provider not initialized. Call init() first");this.loadConnectOpts({chains:e==null?void 0:e.chains});try{const H=await new Promise(async(Ne,W)=>{var ri;this.rpc.showQrModal&&((ri=this.modal)==null||ri.subscribeModal(si=>{!si.open&&!this.signer.session&&(this.signer.abortPairingAttempt(),W(new Error("Connection request reset. Please try again.")))})),await this.signer.authenticate(E(p({},e),{chains:this.rpc.chains})).then(si=>{Ne(si)}).catch(si=>{W(new Error(si.message))})}),Y=H.session;if(Y){const Ne=zo(Y.namespaces,[this.namespace]);this.setChainIds(this.rpc.chains.length?this.rpc.chains:Ne),this.setAccounts(Ne),this.events.emit("connect",{chainId:v(this.chainId)})}return H}catch(H){throw this.signer.logger.error(H),H}finally{this.modal&&this.modal.closeModal()}}async disconnect(){this.session&&await this.signer.disconnect(),this.reset()}get isWalletConnect(){return!0}get session(){return this.signer.session}registerEventListeners(){this.signer.on("session_event",e=>{const{params:H}=e,{event:Y}=H;Y.name==="accountsChanged"?(this.accounts=this.parseAccounts(Y.data),this.events.emit("accountsChanged",this.accounts)):Y.name==="chainChanged"?this.setChainId(this.formatChainId(Y.data)):this.events.emit(Y.name,Y.data),this.events.emit("session_event",e)}),this.signer.on("chainChanged",e=>{const H=parseInt(e);this.chainId=H,this.events.emit("chainChanged",v(this.chainId)),this.persist()}),this.signer.on("session_update",e=>{this.events.emit("session_update",e)}),this.signer.on("session_delete",e=>{this.reset(),this.events.emit("session_delete",e),this.events.emit("disconnect",E(p({},tr$1("USER_DISCONNECTED")),{data:e.topic,name:"USER_DISCONNECTED"}))}),this.signer.on("display_uri",e=>{var H,Y;this.rpc.showQrModal&&((H=this.modal)==null||H.closeModal(),(Y=this.modal)==null||Y.openModal({uri:e})),this.events.emit("display_uri",e)})}switchEthereumChain(e){this.request({method:"wallet_switchEthereumChain",params:[{chainId:e.toString(16)}]})}isCompatibleChainId(e){return typeof e=="string"?e.startsWith(`${this.namespace}:`):!1}formatChainId(e){return`${this.namespace}:${e}`}parseChainId(e){return Number(e.split(":")[1])}setChainIds(e){const H=e.filter(Y=>this.isCompatibleChainId(Y)).map(Y=>this.parseChainId(Y));H.length&&(this.chainId=H[0],this.events.emit("chainChanged",v(this.chainId)),this.persist())}setChainId(e){if(this.isCompatibleChainId(e)){const H=this.parseChainId(e);this.chainId=H,this.switchEthereumChain(H)}}parseAccountId(e){const[H,Y,Ne]=e.split(":");return{chainId:`${H}:${Y}`,address:Ne}}setAccounts(e){this.accounts=e.filter(H=>this.parseChainId(this.parseAccountId(H).chainId)===this.chainId).map(H=>this.parseAccountId(H).address),this.events.emit("accountsChanged",this.accounts)}getRpcConfig(e){var H,Y;const Ne=(H=e==null?void 0:e.chains)!=null?H:[],W=(Y=e==null?void 0:e.optionalChains)!=null?Y:[],ri=Ne.concat(W);if(!ri.length)throw new Error("No chains specified in either `chains` or `optionalChains`");const si=Ne.length?(e==null?void 0:e.methods)||u:[],fi=Ne.length?(e==null?void 0:e.events)||g:[],ai=(e==null?void 0:e.optionalMethods)||[],ti=(e==null?void 0:e.optionalEvents)||[],hi=(e==null?void 0:e.rpcMap)||this.buildRpcMap(ri,e.projectId),ci=(e==null?void 0:e.qrModalOptions)||void 0;return{chains:Ne==null?void 0:Ne.map(ui=>this.formatChainId(ui)),optionalChains:W.map(ui=>this.formatChainId(ui)),methods:si,events:fi,optionalMethods:ai,optionalEvents:ti,rpcMap:hi,showQrModal:!!(e!=null&&e.showQrModal),qrModalOptions:ci,projectId:e.projectId,metadata:e.metadata}}buildRpcMap(e,H){const Y={};return e.forEach(Ne=>{Y[Ne]=this.getRpcUrl(Ne,H)}),Y}async initialize(e){if(this.rpc=this.getRpcConfig(e),this.chainId=this.rpc.chains.length?m(this.rpc.chains):m(this.rpc.optionalChains),this.signer=await hv.init({projectId:this.rpc.projectId,metadata:this.rpc.metadata,disableProviderPing:e.disableProviderPing,relayUrl:e.relayUrl,storageOptions:e.storageOptions}),this.registerEventListeners(),await this.loadPersistedSession(),this.rpc.showQrModal){let H;try{const{WalletConnectModal:Y}=await __vitePreload(()=>import("./index-u1isGxGg.js").then(Ne=>Ne.i),__vite__mapDeps([0,1,2]));H=Y}catch{throw new Error("To use QR modal, please install @walletconnect/modal package")}if(H)try{this.modal=new H(p({projectId:this.rpc.projectId},this.rpc.qrModalOptions))}catch(Y){throw this.signer.logger.error(Y),new Error("Could not generate WalletConnectModal Instance")}}}loadConnectOpts(e){if(!e)return;const{chains:H,optionalChains:Y,rpcMap:Ne}=e;H&&Er(H)&&(this.rpc.chains=H.map(W=>this.formatChainId(W)),H.forEach(W=>{this.rpc.rpcMap[W]=(Ne==null?void 0:Ne[W])||this.getRpcUrl(W)})),Y&&Er(Y)&&(this.rpc.optionalChains=[],this.rpc.optionalChains=Y==null?void 0:Y.map(W=>this.formatChainId(W)),Y.forEach(W=>{this.rpc.rpcMap[W]=(Ne==null?void 0:Ne[W])||this.getRpcUrl(W)}))}getRpcUrl(e,H){var Y;return((Y=this.rpc.rpcMap)==null?void 0:Y[e])||`${j}?chainId=eip155:${e}&projectId=${H||this.rpc.projectId}`}async loadPersistedSession(){if(this.session)try{const e=await this.signer.client.core.storage.getItem(`${this.STORAGE_KEY}/chainId`),H=this.session.namespaces[`${this.namespace}:${e}`]?this.session.namespaces[`${this.namespace}:${e}`]:this.session.namespaces[this.namespace];this.setChainIds(e?[this.formatChainId(e)]:H==null?void 0:H.accounts),this.setAccounts(H==null?void 0:H.accounts)}catch(e){this.signer.logger.error("Failed to load persisted session, clearing state..."),this.signer.logger.error(e),await this.disconnect().catch(H=>this.signer.logger.warn(H))}}reset(){this.chainId=1,this.accounts=[]}persist(){this.session&&this.signer.client.core.storage.setItem(`${this.STORAGE_KEY}/chainId`,this.chainId)}parseAccounts(e){return typeof e=="string"||e instanceof String?[this.parseAccount(e)]:e.map(H=>this.parseAccount(H))}}const z=C;export{z as EthereumProvider,M as OPTIONAL_EVENTS,y as OPTIONAL_METHODS,g as REQUIRED_EVENTS,u as REQUIRED_METHODS,C as default}; -function __vite__mapDeps(indexes) { - if (!__vite__mapDeps.viteFileDeps) { - __vite__mapDeps.viteFileDeps = ["assets/index-u1isGxGg.js","assets/index-9L6Bkx0q.js","assets/index-bN28jcF1.css"] - } - return indexes.map((i) => __vite__mapDeps.viteFileDeps[i]) -} diff --git a/my_nodes/home/tchotchke/.eth_providers b/my_nodes/home/tchotchke/.eth_providers deleted file mode 100644 index 363da60e..00000000 --- a/my_nodes/home/tchotchke/.eth_providers +++ /dev/null @@ -1 +0,0 @@ -[{"chain_id":1,"trusted":false,"provider":{"Node":{"kns_update":{"name":"providerfren.os","owner":"","node":"","public_key":"0x54f5a8a4c625d5925e63ed3f0203b63e007e3f822d7858bd98b1fd9704c99451","ips":["147.135.114.167"],"ports":{"ws":9999},"routers":[]},"use_as_provider":true}}},{"chain_id":11155111,"trusted":false,"provider":{"Node":{"kns_update":{"name":"providerfren.os","owner":"","node":"","public_key":"0x54f5a8a4c625d5925e63ed3f0203b63e007e3f822d7858bd98b1fd9704c99451","ips":["147.135.114.167"],"ports":{"ws":9999},"routers":[]},"use_as_provider":true}}},{"chain_id":10,"trusted":true,"provider":{"RpcUrl":"wss://opt-mainnet.g.alchemy.com/v2/phOnE7X9A3mnzAVjfyR1idu1yYX1mqSL"}},{"chain_id":10,"trusted":false,"provider":{"Node":{"kns_update":{"name":"providerfren.os","owner":"","node":"","public_key":"0x54f5a8a4c625d5925e63ed3f0203b63e007e3f822d7858bd98b1fd9704c99451","ips":["147.135.114.167"],"ports":{"ws":9999},"routers":[]},"use_as_provider":true}}}] \ No newline at end of file