@dcl/profile-site 0.4.1-5824379211.commit-5c7e1a0 → 0.4.1-5825543253.commit-f8e4ddd
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/dijkstra-f906a09e.js +1 -0
- package/assets/fortmatic-dbc2ffb8.js +13 -0
- package/assets/{index-f340ad4c.js → index-2e338a9b.js} +14 -14
- package/assets/index-597a0e62.js +4 -0
- package/assets/index-5be098ea.js +1 -0
- package/assets/{index-7ddc5742.css → index-9ea1eca8.css} +3 -3
- package/assets/{index-a137edc5.js → index-a023aac7.js} +5 -5
- package/assets/index-aa2489d5.js +1 -0
- package/assets/index-c0709bb3.js +347 -0
- package/assets/index-ea6b9fbe.js +551 -0
- package/assets/index.es-52325185.js +33 -0
- package/assets/tslib-171b5081.js +14 -0
- package/index.html +5 -5
- package/package.json +3 -3
- package/assets/index-9ce8dc30.js +0 -960
|
@@ -0,0 +1,551 @@
|
|
|
1
|
+
import{s as Kl,i as Zl,a as Wl,w as Vl,b as Me,c as cr,B as X,r as Se,d as Vt,m as Is,h as Vf,e as Gl,f as Ts,j as Gf,k as Jf,l as Jl,n as zi,o as jl,p as Yl,g as jf,q as Xl,t as v0,u as Cs,v as Yf,x as Ql,y as tc,E as ec}from"./index-c0709bb3.js";import{j as Xf,s as Di,r as rc,a as ic,b as nc,p as ac,i as Ls,c as Ps,e as fc,l as oc,d as Os}from"./index-597a0e62.js";import{p as Ns,s as Hi,a as Ki,d as Zi,c as Wi}from"./index-aa2489d5.js";import{d as sc}from"./dijkstra-f906a09e.js";import"./tslib-171b5081.js";var zr={},qs={},hc=Object.prototype.toString,uc=Function.prototype.toString,lc=/^\s*(?:function)?\*/,Us=Kl(),Ra=Object.getPrototypeOf,cc=function(){if(!Us)return!1;try{return Function("return function*() {}")()}catch{}},Ba,dc=function(n){if(typeof n!="function")return!1;if(lc.test(uc.call(n)))return!0;if(!Us){var h=hc.call(n);return h==="[object GeneratorFunction]"}if(!Ra)return!1;if(typeof Ba>"u"){var u=cc();Ba=u?Ra(u):!1}return Ra(n)===Ba};(function(a){var n=Zl,h=dc,u=Vl,v=Wl;function o(P){return P.call.bind(P)}var w=typeof BigInt<"u",y=typeof Symbol<"u",b=o(Object.prototype.toString),B=o(Number.prototype.valueOf),k=o(String.prototype.valueOf),L=o(Boolean.prototype.valueOf);if(w)var q=o(BigInt.prototype.valueOf);if(y)var $=o(Symbol.prototype.valueOf);function M(P,H){if(typeof P!="object")return!1;try{return H(P),!0}catch{return!1}}a.isArgumentsObject=n,a.isGeneratorFunction=h,a.isTypedArray=v;function N(P){return typeof Promise<"u"&&P instanceof Promise||P!==null&&typeof P=="object"&&typeof P.then=="function"&&typeof P.catch=="function"}a.isPromise=N;function x(P){return typeof ArrayBuffer<"u"&&ArrayBuffer.isView?ArrayBuffer.isView(P):v(P)||R(P)}a.isArrayBufferView=x;function A(P){return u(P)==="Uint8Array"}a.isUint8Array=A;function S(P){return u(P)==="Uint8ClampedArray"}a.isUint8ClampedArray=S;function T(P){return u(P)==="Uint16Array"}a.isUint16Array=T;function O(P){return u(P)==="Uint32Array"}a.isUint32Array=O;function W(P){return u(P)==="Int8Array"}a.isInt8Array=W;function K(P){return u(P)==="Int16Array"}a.isInt16Array=K;function pt(P){return u(P)==="Int32Array"}a.isInt32Array=pt;function ct(P){return u(P)==="Float32Array"}a.isFloat32Array=ct;function dt(P){return u(P)==="Float64Array"}a.isFloat64Array=dt;function g(P){return u(P)==="BigInt64Array"}a.isBigInt64Array=g;function e(P){return u(P)==="BigUint64Array"}a.isBigUint64Array=e;function t(P){return b(P)==="[object Map]"}t.working=typeof Map<"u"&&t(new Map);function i(P){return typeof Map>"u"?!1:t.working?t(P):P instanceof Map}a.isMap=i;function s(P){return b(P)==="[object Set]"}s.working=typeof Set<"u"&&s(new Set);function l(P){return typeof Set>"u"?!1:s.working?s(P):P instanceof Set}a.isSet=l;function c(P){return b(P)==="[object WeakMap]"}c.working=typeof WeakMap<"u"&&c(new WeakMap);function p(P){return typeof WeakMap>"u"?!1:c.working?c(P):P instanceof WeakMap}a.isWeakMap=p;function d(P){return b(P)==="[object WeakSet]"}d.working=typeof WeakSet<"u"&&d(new WeakSet);function r(P){return d(P)}a.isWeakSet=r;function f(P){return b(P)==="[object ArrayBuffer]"}f.working=typeof ArrayBuffer<"u"&&f(new ArrayBuffer);function m(P){return typeof ArrayBuffer>"u"?!1:f.working?f(P):P instanceof ArrayBuffer}a.isArrayBuffer=m;function _(P){return b(P)==="[object DataView]"}_.working=typeof ArrayBuffer<"u"&&typeof DataView<"u"&&_(new DataView(new ArrayBuffer(1),0,1));function R(P){return typeof DataView>"u"?!1:_.working?_(P):P instanceof DataView}a.isDataView=R;var C=typeof SharedArrayBuffer<"u"?SharedArrayBuffer:void 0;function F(P){return b(P)==="[object SharedArrayBuffer]"}function z(P){return typeof C>"u"?!1:(typeof F.working>"u"&&(F.working=F(new C)),F.working?F(P):P instanceof C)}a.isSharedArrayBuffer=z;function lt(P){return b(P)==="[object AsyncFunction]"}a.isAsyncFunction=lt;function G(P){return b(P)==="[object Map Iterator]"}a.isMapIterator=G;function Z(P){return b(P)==="[object Set Iterator]"}a.isSetIterator=Z;function mt(P){return b(P)==="[object Generator]"}a.isGeneratorObject=mt;function gt(P){return b(P)==="[object WebAssembly.Module]"}a.isWebAssemblyCompiledModule=gt;function j(P){return M(P,B)}a.isNumberObject=j;function Ct(P){return M(P,k)}a.isStringObject=Ct;function wt(P){return M(P,L)}a.isBooleanObject=wt;function Y(P){return w&&M(P,q)}a.isBigIntObject=Y;function U(P){return y&&M(P,$)}a.isSymbolObject=U;function I(P){return j(P)||Ct(P)||wt(P)||Y(P)||U(P)}a.isBoxedPrimitive=I;function E(P){return typeof Uint8Array<"u"&&(m(P)||z(P))}a.isAnyArrayBuffer=E,["isProxy","isExternal","isModuleNamespaceObject"].forEach(function(P){Object.defineProperty(a,P,{enumerable:!1,value:function(){throw new Error(P+" is not supported in userland")}})})})(qs);var vc=function(n){return n&&typeof n=="object"&&typeof n.copy=="function"&&typeof n.fill=="function"&&typeof n.readUInt8=="function"};(function(a){var n=Object.getOwnPropertyDescriptors||function(R){for(var C=Object.keys(R),F={},z=0;z<C.length;z++)F[C[z]]=Object.getOwnPropertyDescriptor(R,C[z]);return F},h=/%[sdj%]/g;a.format=function(_){if(!W(_)){for(var R=[],C=0;C<arguments.length;C++)R.push(w(arguments[C]));return R.join(" ")}for(var C=1,F=arguments,z=F.length,lt=String(_).replace(h,function(Z){if(Z==="%%")return"%";if(C>=z)return Z;switch(Z){case"%s":return String(F[C++]);case"%d":return Number(F[C++]);case"%j":try{return JSON.stringify(F[C++])}catch{return"[Circular]"}default:return Z}}),G=F[C];C<z;G=F[++C])S(G)||!dt(G)?lt+=" "+G:lt+=" "+w(G);return lt},a.deprecate=function(_,R){if(typeof Me<"u"&&Me.noDeprecation===!0)return _;if(typeof Me>"u")return function(){return a.deprecate(_,R).apply(this,arguments)};var C=!1;function F(){if(!C){if(Me.throwDeprecation)throw new Error(R);Me.traceDeprecation?console.trace(R):console.error(R),C=!0}return _.apply(this,arguments)}return F};var u={},v=/^$/;if({}.NODE_DEBUG){var o={}.NODE_DEBUG;o=o.replace(/[|\\{}()[\]^$+?.]/g,"\\$&").replace(/\*/g,".*").replace(/,/g,"$|^").toUpperCase(),v=new RegExp("^"+o+"$","i")}a.debuglog=function(_){if(_=_.toUpperCase(),!u[_])if(v.test(_)){var R=Me.pid;u[_]=function(){var C=a.format.apply(a,arguments);console.error("%s %d: %s",_,R,C)}}else u[_]=function(){};return u[_]};function w(_,R){var C={seen:[],stylize:b};return arguments.length>=3&&(C.depth=arguments[2]),arguments.length>=4&&(C.colors=arguments[3]),A(R)?C.showHidden=R:R&&a._extend(C,R),pt(C.showHidden)&&(C.showHidden=!1),pt(C.depth)&&(C.depth=2),pt(C.colors)&&(C.colors=!1),pt(C.customInspect)&&(C.customInspect=!0),C.colors&&(C.stylize=y),k(C,_,C.depth)}a.inspect=w,w.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]},w.styles={special:"cyan",number:"yellow",boolean:"yellow",undefined:"grey",null:"bold",string:"green",date:"magenta",regexp:"red"};function y(_,R){var C=w.styles[R];return C?"\x1B["+w.colors[C][0]+"m"+_+"\x1B["+w.colors[C][1]+"m":_}function b(_,R){return _}function B(_){var R={};return _.forEach(function(C,F){R[C]=!0}),R}function k(_,R,C){if(_.customInspect&&R&&t(R.inspect)&&R.inspect!==a.inspect&&!(R.constructor&&R.constructor.prototype===R)){var F=R.inspect(C,_);return W(F)||(F=k(_,F,C)),F}var z=L(_,R);if(z)return z;var lt=Object.keys(R),G=B(lt);if(_.showHidden&&(lt=Object.getOwnPropertyNames(R)),e(R)&&(lt.indexOf("message")>=0||lt.indexOf("description")>=0))return q(R);if(lt.length===0){if(t(R)){var Z=R.name?": "+R.name:"";return _.stylize("[Function"+Z+"]","special")}if(ct(R))return _.stylize(RegExp.prototype.toString.call(R),"regexp");if(g(R))return _.stylize(Date.prototype.toString.call(R),"date");if(e(R))return q(R)}var mt="",gt=!1,j=["{","}"];if(x(R)&&(gt=!0,j=["[","]"]),t(R)){var Ct=R.name?": "+R.name:"";mt=" [Function"+Ct+"]"}if(ct(R)&&(mt=" "+RegExp.prototype.toString.call(R)),g(R)&&(mt=" "+Date.prototype.toUTCString.call(R)),e(R)&&(mt=" "+q(R)),lt.length===0&&(!gt||R.length==0))return j[0]+mt+j[1];if(C<0)return ct(R)?_.stylize(RegExp.prototype.toString.call(R),"regexp"):_.stylize("[Object]","special");_.seen.push(R);var wt;return gt?wt=$(_,R,C,G,lt):wt=lt.map(function(Y){return M(_,R,C,G,Y,gt)}),_.seen.pop(),N(wt,mt,j)}function L(_,R){if(pt(R))return _.stylize("undefined","undefined");if(W(R)){var C="'"+JSON.stringify(R).replace(/^"|"$/g,"").replace(/'/g,"\\'").replace(/\\"/g,'"')+"'";return _.stylize(C,"string")}if(O(R))return _.stylize(""+R,"number");if(A(R))return _.stylize(""+R,"boolean");if(S(R))return _.stylize("null","null")}function q(_){return"["+Error.prototype.toString.call(_)+"]"}function $(_,R,C,F,z){for(var lt=[],G=0,Z=R.length;G<Z;++G)d(R,String(G))?lt.push(M(_,R,C,F,String(G),!0)):lt.push("");return z.forEach(function(mt){mt.match(/^\d+$/)||lt.push(M(_,R,C,F,mt,!0))}),lt}function M(_,R,C,F,z,lt){var G,Z,mt;if(mt=Object.getOwnPropertyDescriptor(R,z)||{value:R[z]},mt.get?mt.set?Z=_.stylize("[Getter/Setter]","special"):Z=_.stylize("[Getter]","special"):mt.set&&(Z=_.stylize("[Setter]","special")),d(F,z)||(G="["+z+"]"),Z||(_.seen.indexOf(mt.value)<0?(S(C)?Z=k(_,mt.value,null):Z=k(_,mt.value,C-1),Z.indexOf(`
|
|
2
|
+
`)>-1&&(lt?Z=Z.split(`
|
|
3
|
+
`).map(function(gt){return" "+gt}).join(`
|
|
4
|
+
`).slice(2):Z=`
|
|
5
|
+
`+Z.split(`
|
|
6
|
+
`).map(function(gt){return" "+gt}).join(`
|
|
7
|
+
`))):Z=_.stylize("[Circular]","special")),pt(G)){if(lt&&z.match(/^\d+$/))return Z;G=JSON.stringify(""+z),G.match(/^"([a-zA-Z_][a-zA-Z_0-9]*)"$/)?(G=G.slice(1,-1),G=_.stylize(G,"name")):(G=G.replace(/'/g,"\\'").replace(/\\"/g,'"').replace(/(^"|"$)/g,"'"),G=_.stylize(G,"string"))}return G+": "+Z}function N(_,R,C){var F=_.reduce(function(z,lt){return lt.indexOf(`
|
|
8
|
+
`)>=0,z+lt.replace(/\u001b\[\d\d?m/g,"").length+1},0);return F>60?C[0]+(R===""?"":R+`
|
|
9
|
+
`)+" "+_.join(`,
|
|
10
|
+
`)+" "+C[1]:C[0]+R+" "+_.join(", ")+" "+C[1]}a.types=qs;function x(_){return Array.isArray(_)}a.isArray=x;function A(_){return typeof _=="boolean"}a.isBoolean=A;function S(_){return _===null}a.isNull=S;function T(_){return _==null}a.isNullOrUndefined=T;function O(_){return typeof _=="number"}a.isNumber=O;function W(_){return typeof _=="string"}a.isString=W;function K(_){return typeof _=="symbol"}a.isSymbol=K;function pt(_){return _===void 0}a.isUndefined=pt;function ct(_){return dt(_)&&s(_)==="[object RegExp]"}a.isRegExp=ct,a.types.isRegExp=ct;function dt(_){return typeof _=="object"&&_!==null}a.isObject=dt;function g(_){return dt(_)&&s(_)==="[object Date]"}a.isDate=g,a.types.isDate=g;function e(_){return dt(_)&&(s(_)==="[object Error]"||_ instanceof Error)}a.isError=e,a.types.isNativeError=e;function t(_){return typeof _=="function"}a.isFunction=t;function i(_){return _===null||typeof _=="boolean"||typeof _=="number"||typeof _=="string"||typeof _=="symbol"||typeof _>"u"}a.isPrimitive=i,a.isBuffer=vc;function s(_){return Object.prototype.toString.call(_)}function l(_){return _<10?"0"+_.toString(10):_.toString(10)}var c=["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];function p(){var _=new Date,R=[l(_.getHours()),l(_.getMinutes()),l(_.getSeconds())].join(":");return[_.getDate(),c[_.getMonth()],R].join(" ")}a.log=function(){console.log("%s - %s",p(),a.format.apply(a,arguments))},a.inherits=cr,a._extend=function(_,R){if(!R||!dt(R))return _;for(var C=Object.keys(R),F=C.length;F--;)_[C[F]]=R[C[F]];return _};function d(_,R){return Object.prototype.hasOwnProperty.call(_,R)}var r=typeof Symbol<"u"?Symbol("util.promisify.custom"):void 0;a.promisify=function(R){if(typeof R!="function")throw new TypeError('The "original" argument must be of type Function');if(r&&R[r]){var C=R[r];if(typeof C!="function")throw new TypeError('The "util.promisify.custom" argument must be of type Function');return Object.defineProperty(C,r,{value:C,enumerable:!1,writable:!1,configurable:!0}),C}function C(){for(var F,z,lt=new Promise(function(mt,gt){F=mt,z=gt}),G=[],Z=0;Z<arguments.length;Z++)G.push(arguments[Z]);G.push(function(mt,gt){mt?z(mt):F(gt)});try{R.apply(this,G)}catch(mt){z(mt)}return lt}return Object.setPrototypeOf(C,Object.getPrototypeOf(R)),r&&Object.defineProperty(C,r,{value:C,enumerable:!1,writable:!1,configurable:!0}),Object.defineProperties(C,n(R))},a.promisify.custom=r;function f(_,R){if(!_){var C=new Error("Promise was rejected with a falsy value");C.reason=_,_=C}return R(_)}function m(_){if(typeof _!="function")throw new TypeError('The "original" argument must be of type Function');function R(){for(var C=[],F=0;F<arguments.length;F++)C.push(arguments[F]);var z=C.pop();if(typeof z!="function")throw new TypeError("The last argument must be of type Function");var lt=this,G=function(){return z.apply(lt,arguments)};_.apply(this,C).then(function(Z){Me.nextTick(G.bind(null,null,Z))},function(Z){Me.nextTick(f.bind(null,Z,G))})}return Object.setPrototypeOf(R,Object.getPrototypeOf(_)),Object.defineProperties(R,n(_)),R}a.callbackify=m})(zr);var Vi={},vi={},Qf={};Object.defineProperty(Qf,"__esModule",{value:!0});function pc(a){return function(n){var h=a();return h.update(n),X.from(h.digest())}}Qf.createHashFunction=pc;Object.defineProperty(vi,"__esModule",{value:!0});var qn=Qf,Un=Xf;vi.keccak224=qn.createHashFunction(function(){return Un("keccak224")});vi.keccak256=qn.createHashFunction(function(){return Un("keccak256")});vi.keccak384=qn.createHashFunction(function(){return Un("keccak384")});vi.keccak512=qn.createHashFunction(function(){return Un("keccak512")});var Fs={};const pe={IMPOSSIBLE_CASE:"Impossible case. Please create issue.",TWEAK_ADD:"The tweak was out of range or the resulted private key is invalid",TWEAK_MUL:"The tweak was out of range or equal to zero",CONTEXT_RANDOMIZE_UNKNOW:"Unknow error on context randomization",SECKEY_INVALID:"Private Key is invalid",PUBKEY_PARSE:"Public Key could not be parsed",PUBKEY_SERIALIZE:"Public Key serialization error",PUBKEY_COMBINE:"The sum of the public keys is not valid",SIG_PARSE:"Signature could not be parsed",SIGN:"The nonce generation function failed, or the private key was invalid",RECOVER:"Public key could not be recover",ECDH:"Scalar was invalid (zero or overflow)"};function Ve(a,n){if(!a)throw new Error(n)}function ve(a,n,h){if(Ve(n instanceof Uint8Array,`Expected ${a} to be an Uint8Array`),h!==void 0)if(Array.isArray(h)){const u=h.join(", "),v=`Expected ${a} to be an Uint8Array with length [${u}]`;Ve(h.includes(n.length),v)}else{const u=`Expected ${a} to be an Uint8Array with length ${h}`;Ve(n.length===h,u)}}function Rr(a){Ve(Jr(a)==="Boolean","Expected compressed to be a Boolean")}function Xe(a=h=>new Uint8Array(h),n){return typeof a=="function"&&(a=a(n)),ve("output",a,n),a}function Jr(a){return Object.prototype.toString.call(a).slice(8,-1)}var mc=a=>({contextRandomize(n){switch(Ve(n===null||n instanceof Uint8Array,"Expected seed to be an Uint8Array or null"),n!==null&&ve("seed",n,32),a.contextRandomize(n)){case 1:throw new Error(pe.CONTEXT_RANDOMIZE_UNKNOW)}},privateKeyVerify(n){return ve("private key",n,32),a.privateKeyVerify(n)===0},privateKeyNegate(n){switch(ve("private key",n,32),a.privateKeyNegate(n)){case 0:return n;case 1:throw new Error(pe.IMPOSSIBLE_CASE)}},privateKeyTweakAdd(n,h){switch(ve("private key",n,32),ve("tweak",h,32),a.privateKeyTweakAdd(n,h)){case 0:return n;case 1:throw new Error(pe.TWEAK_ADD)}},privateKeyTweakMul(n,h){switch(ve("private key",n,32),ve("tweak",h,32),a.privateKeyTweakMul(n,h)){case 0:return n;case 1:throw new Error(pe.TWEAK_MUL)}},publicKeyVerify(n){return ve("public key",n,[33,65]),a.publicKeyVerify(n)===0},publicKeyCreate(n,h=!0,u){switch(ve("private key",n,32),Rr(h),u=Xe(u,h?33:65),a.publicKeyCreate(u,n)){case 0:return u;case 1:throw new Error(pe.SECKEY_INVALID);case 2:throw new Error(pe.PUBKEY_SERIALIZE)}},publicKeyConvert(n,h=!0,u){switch(ve("public key",n,[33,65]),Rr(h),u=Xe(u,h?33:65),a.publicKeyConvert(u,n)){case 0:return u;case 1:throw new Error(pe.PUBKEY_PARSE);case 2:throw new Error(pe.PUBKEY_SERIALIZE)}},publicKeyNegate(n,h=!0,u){switch(ve("public key",n,[33,65]),Rr(h),u=Xe(u,h?33:65),a.publicKeyNegate(u,n)){case 0:return u;case 1:throw new Error(pe.PUBKEY_PARSE);case 2:throw new Error(pe.IMPOSSIBLE_CASE);case 3:throw new Error(pe.PUBKEY_SERIALIZE)}},publicKeyCombine(n,h=!0,u){Ve(Array.isArray(n),"Expected public keys to be an Array"),Ve(n.length>0,"Expected public keys array will have more than zero items");for(const v of n)ve("public key",v,[33,65]);switch(Rr(h),u=Xe(u,h?33:65),a.publicKeyCombine(u,n)){case 0:return u;case 1:throw new Error(pe.PUBKEY_PARSE);case 2:throw new Error(pe.PUBKEY_COMBINE);case 3:throw new Error(pe.PUBKEY_SERIALIZE)}},publicKeyTweakAdd(n,h,u=!0,v){switch(ve("public key",n,[33,65]),ve("tweak",h,32),Rr(u),v=Xe(v,u?33:65),a.publicKeyTweakAdd(v,n,h)){case 0:return v;case 1:throw new Error(pe.PUBKEY_PARSE);case 2:throw new Error(pe.TWEAK_ADD)}},publicKeyTweakMul(n,h,u=!0,v){switch(ve("public key",n,[33,65]),ve("tweak",h,32),Rr(u),v=Xe(v,u?33:65),a.publicKeyTweakMul(v,n,h)){case 0:return v;case 1:throw new Error(pe.PUBKEY_PARSE);case 2:throw new Error(pe.TWEAK_MUL)}},signatureNormalize(n){switch(ve("signature",n,64),a.signatureNormalize(n)){case 0:return n;case 1:throw new Error(pe.SIG_PARSE)}},signatureExport(n,h){ve("signature",n,64),h=Xe(h,72);const u={output:h,outputlen:72};switch(a.signatureExport(u,n)){case 0:return h.slice(0,u.outputlen);case 1:throw new Error(pe.SIG_PARSE);case 2:throw new Error(pe.IMPOSSIBLE_CASE)}},signatureImport(n,h){switch(ve("signature",n),h=Xe(h,64),a.signatureImport(h,n)){case 0:return h;case 1:throw new Error(pe.SIG_PARSE);case 2:throw new Error(pe.IMPOSSIBLE_CASE)}},ecdsaSign(n,h,u={},v){ve("message",n,32),ve("private key",h,32),Ve(Jr(u)==="Object","Expected options to be an Object"),u.data!==void 0&&ve("options.data",u.data),u.noncefn!==void 0&&Ve(Jr(u.noncefn)==="Function","Expected options.noncefn to be a Function"),v=Xe(v,64);const o={signature:v,recid:null};switch(a.ecdsaSign(o,n,h,u.data,u.noncefn)){case 0:return o;case 1:throw new Error(pe.SIGN);case 2:throw new Error(pe.IMPOSSIBLE_CASE)}},ecdsaVerify(n,h,u){switch(ve("signature",n,64),ve("message",h,32),ve("public key",u,[33,65]),a.ecdsaVerify(n,h,u)){case 0:return!0;case 3:return!1;case 1:throw new Error(pe.SIG_PARSE);case 2:throw new Error(pe.PUBKEY_PARSE)}},ecdsaRecover(n,h,u,v=!0,o){switch(ve("signature",n,64),Ve(Jr(h)==="Number"&&h>=0&&h<=3,"Expected recovery id to be a Number within interval [0, 3]"),ve("message",u,32),Rr(v),o=Xe(o,v?33:65),a.ecdsaRecover(o,n,h,u)){case 0:return o;case 1:throw new Error(pe.SIG_PARSE);case 2:throw new Error(pe.RECOVER);case 3:throw new Error(pe.IMPOSSIBLE_CASE)}},ecdh(n,h,u={},v){switch(ve("public key",n,[33,65]),ve("private key",h,32),Ve(Jr(u)==="Object","Expected options to be an Object"),u.data!==void 0&&ve("options.data",u.data),u.hashfn!==void 0?(Ve(Jr(u.hashfn)==="Function","Expected options.hashfn to be a Function"),u.xbuf!==void 0&&ve("options.xbuf",u.xbuf,32),u.ybuf!==void 0&&ve("options.ybuf",u.ybuf,32),ve("output",v)):v=Xe(v,32),a.ecdh(v,n,h,u.data,u.hashfn,u.xbuf,u.ybuf)){case 0:return v;case 1:throw new Error(pe.PUBKEY_PARSE);case 2:throw new Error(pe.ECDH)}}}),Gi={};const gc="elliptic",yc="6.5.4",wc="EC cryptography",bc="lib/elliptic.js",Mc=["lib"],xc={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/"},_c={type:"git",url:"git@github.com:indutny/elliptic"},Sc=["EC","Elliptic","curve","Cryptography"],Ac="Fedor Indutny <fedor@indutny.com>",Ec="MIT",kc={url:"https://github.com/indutny/elliptic/issues"},Rc="https://github.com/indutny/elliptic",Bc={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"},Ic={"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"},Tc={name:gc,version:yc,description:wc,main:bc,files:Mc,scripts:xc,repository:_c,keywords:Sc,author:Ac,license:Ec,bugs:kc,homepage:Rc,devDependencies:Bc,dependencies:Ic};var Ke={},to={exports:{}};to.exports;(function(a){(function(n,h){function u(e,t){if(!e)throw new Error(t||"Assertion failed")}function v(e,t){e.super_=t;var i=function(){};i.prototype=t.prototype,e.prototype=new i,e.prototype.constructor=e}function o(e,t,i){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,e!==null&&((t==="le"||t==="be")&&(i=t,t=10),this._init(e||0,t||10,i||"be"))}typeof n=="object"?n.exports=o:h.BN=o,o.BN=o,o.wordSize=26;var w;try{typeof window<"u"&&typeof window.Buffer<"u"?w=window.Buffer:w=Se.Buffer}catch{}o.isBN=function(t){return t instanceof o?!0:t!==null&&typeof t=="object"&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,i){return t.cmp(i)>0?t:i},o.min=function(t,i){return t.cmp(i)<0?t:i},o.prototype._init=function(t,i,s){if(typeof t=="number")return this._initNumber(t,i,s);if(typeof t=="object")return this._initArray(t,i,s);i==="hex"&&(i=16),u(i===(i|0)&&i>=2&&i<=36),t=t.toString().replace(/\s+/g,"");var l=0;t[0]==="-"&&(l++,this.negative=1),l<t.length&&(i===16?this._parseHex(t,l,s):(this._parseBase(t,i,l),s==="le"&&this._initArray(this.toArray(),i,s)))},o.prototype._initNumber=function(t,i,s){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[t&67108863],this.length=1):t<4503599627370496?(this.words=[t&67108863,t/67108864&67108863],this.length=2):(u(t<9007199254740992),this.words=[t&67108863,t/67108864&67108863,1],this.length=3),s==="le"&&this._initArray(this.toArray(),i,s)},o.prototype._initArray=function(t,i,s){if(u(typeof t.length=="number"),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var l=0;l<this.length;l++)this.words[l]=0;var c,p,d=0;if(s==="be")for(l=t.length-1,c=0;l>=0;l-=3)p=t[l]|t[l-1]<<8|t[l-2]<<16,this.words[c]|=p<<d&67108863,this.words[c+1]=p>>>26-d&67108863,d+=24,d>=26&&(d-=26,c++);else if(s==="le")for(l=0,c=0;l<t.length;l+=3)p=t[l]|t[l+1]<<8|t[l+2]<<16,this.words[c]|=p<<d&67108863,this.words[c+1]=p>>>26-d&67108863,d+=24,d>=26&&(d-=26,c++);return this.strip()};function y(e,t){var i=e.charCodeAt(t);return i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:i-48&15}function b(e,t,i){var s=y(e,i);return i-1>=t&&(s|=y(e,i-1)<<4),s}o.prototype._parseHex=function(t,i,s){this.length=Math.ceil((t.length-i)/6),this.words=new Array(this.length);for(var l=0;l<this.length;l++)this.words[l]=0;var c=0,p=0,d;if(s==="be")for(l=t.length-1;l>=i;l-=2)d=b(t,i,l)<<c,this.words[p]|=d&67108863,c>=18?(c-=18,p+=1,this.words[p]|=d>>>26):c+=8;else{var r=t.length-i;for(l=r%2===0?i+1:i;l<t.length;l+=2)d=b(t,i,l)<<c,this.words[p]|=d&67108863,c>=18?(c-=18,p+=1,this.words[p]|=d>>>26):c+=8}this.strip()};function B(e,t,i,s){for(var l=0,c=Math.min(e.length,i),p=t;p<c;p++){var d=e.charCodeAt(p)-48;l*=s,d>=49?l+=d-49+10:d>=17?l+=d-17+10:l+=d}return l}o.prototype._parseBase=function(t,i,s){this.words=[0],this.length=1;for(var l=0,c=1;c<=67108863;c*=i)l++;l--,c=c/i|0;for(var p=t.length-s,d=p%l,r=Math.min(p,p-d)+s,f=0,m=s;m<r;m+=l)f=B(t,m,m+l,i),this.imuln(c),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f);if(d!==0){var _=1;for(f=B(t,m,t.length,i),m=0;m<d;m++)_*=i;this.imuln(_),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f)}this.strip()},o.prototype.copy=function(t){t.words=new Array(this.length);for(var i=0;i<this.length;i++)t.words[i]=this.words[i];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},o.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var k=["","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"],L=[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],q=[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];o.prototype.toString=function(t,i){t=t||10,i=i|0||1;var s;if(t===16||t==="hex"){s="";for(var l=0,c=0,p=0;p<this.length;p++){var d=this.words[p],r=((d<<l|c)&16777215).toString(16);c=d>>>24-l&16777215,c!==0||p!==this.length-1?s=k[6-r.length]+r+s:s=r+s,l+=2,l>=26&&(l-=26,p--)}for(c!==0&&(s=c.toString(16)+s);s.length%i!==0;)s="0"+s;return this.negative!==0&&(s="-"+s),s}if(t===(t|0)&&t>=2&&t<=36){var f=L[t],m=q[t];s="";var _=this.clone();for(_.negative=0;!_.isZero();){var R=_.modn(m).toString(t);_=_.idivn(m),_.isZero()?s=R+s:s=k[f-R.length]+R+s}for(this.isZero()&&(s="0"+s);s.length%i!==0;)s="0"+s;return this.negative!==0&&(s="-"+s),s}u(!1,"Base should be between 2 and 36")},o.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&&u(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,i){return u(typeof w<"u"),this.toArrayLike(w,t,i)},o.prototype.toArray=function(t,i){return this.toArrayLike(Array,t,i)},o.prototype.toArrayLike=function(t,i,s){var l=this.byteLength(),c=s||Math.max(1,l);u(l<=c,"byte array longer than desired length"),u(c>0,"Requested array length <= 0"),this.strip();var p=i==="le",d=new t(c),r,f,m=this.clone();if(p){for(f=0;!m.isZero();f++)r=m.andln(255),m.iushrn(8),d[f]=r;for(;f<c;f++)d[f]=0}else{for(f=0;f<c-l;f++)d[f]=0;for(f=0;!m.isZero();f++)r=m.andln(255),m.iushrn(8),d[c-f-1]=r}return d},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var i=t,s=0;return i>=4096&&(s+=13,i>>>=13),i>=64&&(s+=7,i>>>=7),i>=8&&(s+=4,i>>>=4),i>=2&&(s+=2,i>>>=2),s+i},o.prototype._zeroBits=function(t){if(t===0)return 26;var i=t,s=0;return i&8191||(s+=13,i>>>=13),i&127||(s+=7,i>>>=7),i&15||(s+=4,i>>>=4),i&3||(s+=2,i>>>=2),i&1||s++,s},o.prototype.bitLength=function(){var t=this.words[this.length-1],i=this._countBits(t);return(this.length-1)*26+i};function $(e){for(var t=new Array(e.bitLength()),i=0;i<t.length;i++){var s=i/26|0,l=i%26;t[i]=(e.words[s]&1<<l)>>>l}return t}o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,i=0;i<this.length;i++){var s=this._zeroBits(this.words[i]);if(t+=s,s!==26)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return this.negative!==0?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return this.negative!==0},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var i=0;i<t.length;i++)this.words[i]=this.words[i]|t.words[i];return this.strip()},o.prototype.ior=function(t){return u((this.negative|t.negative)===0),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var i;this.length>t.length?i=t:i=this;for(var s=0;s<i.length;s++)this.words[s]=this.words[s]&t.words[s];return this.length=i.length,this.strip()},o.prototype.iand=function(t){return u((this.negative|t.negative)===0),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var i,s;this.length>t.length?(i=this,s=t):(i=t,s=this);for(var l=0;l<s.length;l++)this.words[l]=i.words[l]^s.words[l];if(this!==i)for(;l<i.length;l++)this.words[l]=i.words[l];return this.length=i.length,this.strip()},o.prototype.ixor=function(t){return u((this.negative|t.negative)===0),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){u(typeof t=="number"&&t>=0);var i=Math.ceil(t/26)|0,s=t%26;this._expand(i),s>0&&i--;for(var l=0;l<i;l++)this.words[l]=~this.words[l]&67108863;return s>0&&(this.words[l]=~this.words[l]&67108863>>26-s),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,i){u(typeof t=="number"&&t>=0);var s=t/26|0,l=t%26;return this._expand(s+1),i?this.words[s]=this.words[s]|1<<l:this.words[s]=this.words[s]&~(1<<l),this.strip()},o.prototype.iadd=function(t){var i;if(this.negative!==0&&t.negative===0)return this.negative=0,i=this.isub(t),this.negative^=1,this._normSign();if(this.negative===0&&t.negative!==0)return t.negative=0,i=this.isub(t),t.negative=1,i._normSign();var s,l;this.length>t.length?(s=this,l=t):(s=t,l=this);for(var c=0,p=0;p<l.length;p++)i=(s.words[p]|0)+(l.words[p]|0)+c,this.words[p]=i&67108863,c=i>>>26;for(;c!==0&&p<s.length;p++)i=(s.words[p]|0)+c,this.words[p]=i&67108863,c=i>>>26;if(this.length=s.length,c!==0)this.words[this.length]=c,this.length++;else if(s!==this)for(;p<s.length;p++)this.words[p]=s.words[p];return this},o.prototype.add=function(t){var i;return t.negative!==0&&this.negative===0?(t.negative=0,i=this.sub(t),t.negative^=1,i):t.negative===0&&this.negative!==0?(this.negative=0,i=t.sub(this),this.negative=1,i):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(t.negative!==0){t.negative=0;var i=this.iadd(t);return t.negative=1,i._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var s=this.cmp(t);if(s===0)return this.negative=0,this.length=1,this.words[0]=0,this;var l,c;s>0?(l=this,c=t):(l=t,c=this);for(var p=0,d=0;d<c.length;d++)i=(l.words[d]|0)-(c.words[d]|0)+p,p=i>>26,this.words[d]=i&67108863;for(;p!==0&&d<l.length;d++)i=(l.words[d]|0)+p,p=i>>26,this.words[d]=i&67108863;if(p===0&&d<l.length&&l!==this)for(;d<l.length;d++)this.words[d]=l.words[d];return this.length=Math.max(this.length,d),l!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};function M(e,t,i){i.negative=t.negative^e.negative;var s=e.length+t.length|0;i.length=s,s=s-1|0;var l=e.words[0]|0,c=t.words[0]|0,p=l*c,d=p&67108863,r=p/67108864|0;i.words[0]=d;for(var f=1;f<s;f++){for(var m=r>>>26,_=r&67108863,R=Math.min(f,t.length-1),C=Math.max(0,f-e.length+1);C<=R;C++){var F=f-C|0;l=e.words[F]|0,c=t.words[C]|0,p=l*c+_,m+=p/67108864|0,_=p&67108863}i.words[f]=_|0,r=m|0}return r!==0?i.words[f]=r|0:i.length--,i.strip()}var N=function(t,i,s){var l=t.words,c=i.words,p=s.words,d=0,r,f,m,_=l[0]|0,R=_&8191,C=_>>>13,F=l[1]|0,z=F&8191,lt=F>>>13,G=l[2]|0,Z=G&8191,mt=G>>>13,gt=l[3]|0,j=gt&8191,Ct=gt>>>13,wt=l[4]|0,Y=wt&8191,U=wt>>>13,I=l[5]|0,E=I&8191,P=I>>>13,H=l[6]|0,D=H&8191,ut=H>>>13,vt=l[7]|0,V=vt&8191,bt=vt>>>13,yt=l[8]|0,J=yt&8191,Lt=yt>>>13,Mt=l[9]|0,Q=Mt&8191,Ot=Mt>>>13,xt=c[0]|0,tt=xt&8191,Nt=xt>>>13,_t=c[1]|0,et=_t&8191,qt=_t>>>13,St=c[2]|0,rt=St&8191,Ut=St>>>13,At=c[3]|0,it=At&8191,Ft=At>>>13,Et=c[4]|0,nt=Et&8191,$t=Et>>>13,kt=c[5]|0,at=kt&8191,zt=kt>>>13,Rt=c[6]|0,ft=Rt&8191,Dt=Rt>>>13,Bt=c[7]|0,ot=Bt&8191,Ht=Bt>>>13,It=c[8]|0,st=It&8191,Kt=It>>>13,Tt=c[9]|0,ht=Tt&8191,Pt=Tt>>>13;s.negative=t.negative^i.negative,s.length=19,r=Math.imul(R,tt),f=Math.imul(R,Nt),f=f+Math.imul(C,tt)|0,m=Math.imul(C,Nt);var Jt=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,r=Math.imul(z,tt),f=Math.imul(z,Nt),f=f+Math.imul(lt,tt)|0,m=Math.imul(lt,Nt),r=r+Math.imul(R,et)|0,f=f+Math.imul(R,qt)|0,f=f+Math.imul(C,et)|0,m=m+Math.imul(C,qt)|0;var jt=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(jt>>>26)|0,jt&=67108863,r=Math.imul(Z,tt),f=Math.imul(Z,Nt),f=f+Math.imul(mt,tt)|0,m=Math.imul(mt,Nt),r=r+Math.imul(z,et)|0,f=f+Math.imul(z,qt)|0,f=f+Math.imul(lt,et)|0,m=m+Math.imul(lt,qt)|0,r=r+Math.imul(R,rt)|0,f=f+Math.imul(R,Ut)|0,f=f+Math.imul(C,rt)|0,m=m+Math.imul(C,Ut)|0;var Yt=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,r=Math.imul(j,tt),f=Math.imul(j,Nt),f=f+Math.imul(Ct,tt)|0,m=Math.imul(Ct,Nt),r=r+Math.imul(Z,et)|0,f=f+Math.imul(Z,qt)|0,f=f+Math.imul(mt,et)|0,m=m+Math.imul(mt,qt)|0,r=r+Math.imul(z,rt)|0,f=f+Math.imul(z,Ut)|0,f=f+Math.imul(lt,rt)|0,m=m+Math.imul(lt,Ut)|0,r=r+Math.imul(R,it)|0,f=f+Math.imul(R,Ft)|0,f=f+Math.imul(C,it)|0,m=m+Math.imul(C,Ft)|0;var Xt=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(Xt>>>26)|0,Xt&=67108863,r=Math.imul(Y,tt),f=Math.imul(Y,Nt),f=f+Math.imul(U,tt)|0,m=Math.imul(U,Nt),r=r+Math.imul(j,et)|0,f=f+Math.imul(j,qt)|0,f=f+Math.imul(Ct,et)|0,m=m+Math.imul(Ct,qt)|0,r=r+Math.imul(Z,rt)|0,f=f+Math.imul(Z,Ut)|0,f=f+Math.imul(mt,rt)|0,m=m+Math.imul(mt,Ut)|0,r=r+Math.imul(z,it)|0,f=f+Math.imul(z,Ft)|0,f=f+Math.imul(lt,it)|0,m=m+Math.imul(lt,Ft)|0,r=r+Math.imul(R,nt)|0,f=f+Math.imul(R,$t)|0,f=f+Math.imul(C,nt)|0,m=m+Math.imul(C,$t)|0;var Qt=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(Qt>>>26)|0,Qt&=67108863,r=Math.imul(E,tt),f=Math.imul(E,Nt),f=f+Math.imul(P,tt)|0,m=Math.imul(P,Nt),r=r+Math.imul(Y,et)|0,f=f+Math.imul(Y,qt)|0,f=f+Math.imul(U,et)|0,m=m+Math.imul(U,qt)|0,r=r+Math.imul(j,rt)|0,f=f+Math.imul(j,Ut)|0,f=f+Math.imul(Ct,rt)|0,m=m+Math.imul(Ct,Ut)|0,r=r+Math.imul(Z,it)|0,f=f+Math.imul(Z,Ft)|0,f=f+Math.imul(mt,it)|0,m=m+Math.imul(mt,Ft)|0,r=r+Math.imul(z,nt)|0,f=f+Math.imul(z,$t)|0,f=f+Math.imul(lt,nt)|0,m=m+Math.imul(lt,$t)|0,r=r+Math.imul(R,at)|0,f=f+Math.imul(R,zt)|0,f=f+Math.imul(C,at)|0,m=m+Math.imul(C,zt)|0;var te=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(te>>>26)|0,te&=67108863,r=Math.imul(D,tt),f=Math.imul(D,Nt),f=f+Math.imul(ut,tt)|0,m=Math.imul(ut,Nt),r=r+Math.imul(E,et)|0,f=f+Math.imul(E,qt)|0,f=f+Math.imul(P,et)|0,m=m+Math.imul(P,qt)|0,r=r+Math.imul(Y,rt)|0,f=f+Math.imul(Y,Ut)|0,f=f+Math.imul(U,rt)|0,m=m+Math.imul(U,Ut)|0,r=r+Math.imul(j,it)|0,f=f+Math.imul(j,Ft)|0,f=f+Math.imul(Ct,it)|0,m=m+Math.imul(Ct,Ft)|0,r=r+Math.imul(Z,nt)|0,f=f+Math.imul(Z,$t)|0,f=f+Math.imul(mt,nt)|0,m=m+Math.imul(mt,$t)|0,r=r+Math.imul(z,at)|0,f=f+Math.imul(z,zt)|0,f=f+Math.imul(lt,at)|0,m=m+Math.imul(lt,zt)|0,r=r+Math.imul(R,ft)|0,f=f+Math.imul(R,Dt)|0,f=f+Math.imul(C,ft)|0,m=m+Math.imul(C,Dt)|0;var ee=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(ee>>>26)|0,ee&=67108863,r=Math.imul(V,tt),f=Math.imul(V,Nt),f=f+Math.imul(bt,tt)|0,m=Math.imul(bt,Nt),r=r+Math.imul(D,et)|0,f=f+Math.imul(D,qt)|0,f=f+Math.imul(ut,et)|0,m=m+Math.imul(ut,qt)|0,r=r+Math.imul(E,rt)|0,f=f+Math.imul(E,Ut)|0,f=f+Math.imul(P,rt)|0,m=m+Math.imul(P,Ut)|0,r=r+Math.imul(Y,it)|0,f=f+Math.imul(Y,Ft)|0,f=f+Math.imul(U,it)|0,m=m+Math.imul(U,Ft)|0,r=r+Math.imul(j,nt)|0,f=f+Math.imul(j,$t)|0,f=f+Math.imul(Ct,nt)|0,m=m+Math.imul(Ct,$t)|0,r=r+Math.imul(Z,at)|0,f=f+Math.imul(Z,zt)|0,f=f+Math.imul(mt,at)|0,m=m+Math.imul(mt,zt)|0,r=r+Math.imul(z,ft)|0,f=f+Math.imul(z,Dt)|0,f=f+Math.imul(lt,ft)|0,m=m+Math.imul(lt,Dt)|0,r=r+Math.imul(R,ot)|0,f=f+Math.imul(R,Ht)|0,f=f+Math.imul(C,ot)|0,m=m+Math.imul(C,Ht)|0;var re=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(re>>>26)|0,re&=67108863,r=Math.imul(J,tt),f=Math.imul(J,Nt),f=f+Math.imul(Lt,tt)|0,m=Math.imul(Lt,Nt),r=r+Math.imul(V,et)|0,f=f+Math.imul(V,qt)|0,f=f+Math.imul(bt,et)|0,m=m+Math.imul(bt,qt)|0,r=r+Math.imul(D,rt)|0,f=f+Math.imul(D,Ut)|0,f=f+Math.imul(ut,rt)|0,m=m+Math.imul(ut,Ut)|0,r=r+Math.imul(E,it)|0,f=f+Math.imul(E,Ft)|0,f=f+Math.imul(P,it)|0,m=m+Math.imul(P,Ft)|0,r=r+Math.imul(Y,nt)|0,f=f+Math.imul(Y,$t)|0,f=f+Math.imul(U,nt)|0,m=m+Math.imul(U,$t)|0,r=r+Math.imul(j,at)|0,f=f+Math.imul(j,zt)|0,f=f+Math.imul(Ct,at)|0,m=m+Math.imul(Ct,zt)|0,r=r+Math.imul(Z,ft)|0,f=f+Math.imul(Z,Dt)|0,f=f+Math.imul(mt,ft)|0,m=m+Math.imul(mt,Dt)|0,r=r+Math.imul(z,ot)|0,f=f+Math.imul(z,Ht)|0,f=f+Math.imul(lt,ot)|0,m=m+Math.imul(lt,Ht)|0,r=r+Math.imul(R,st)|0,f=f+Math.imul(R,Kt)|0,f=f+Math.imul(C,st)|0,m=m+Math.imul(C,Kt)|0;var ie=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(ie>>>26)|0,ie&=67108863,r=Math.imul(Q,tt),f=Math.imul(Q,Nt),f=f+Math.imul(Ot,tt)|0,m=Math.imul(Ot,Nt),r=r+Math.imul(J,et)|0,f=f+Math.imul(J,qt)|0,f=f+Math.imul(Lt,et)|0,m=m+Math.imul(Lt,qt)|0,r=r+Math.imul(V,rt)|0,f=f+Math.imul(V,Ut)|0,f=f+Math.imul(bt,rt)|0,m=m+Math.imul(bt,Ut)|0,r=r+Math.imul(D,it)|0,f=f+Math.imul(D,Ft)|0,f=f+Math.imul(ut,it)|0,m=m+Math.imul(ut,Ft)|0,r=r+Math.imul(E,nt)|0,f=f+Math.imul(E,$t)|0,f=f+Math.imul(P,nt)|0,m=m+Math.imul(P,$t)|0,r=r+Math.imul(Y,at)|0,f=f+Math.imul(Y,zt)|0,f=f+Math.imul(U,at)|0,m=m+Math.imul(U,zt)|0,r=r+Math.imul(j,ft)|0,f=f+Math.imul(j,Dt)|0,f=f+Math.imul(Ct,ft)|0,m=m+Math.imul(Ct,Dt)|0,r=r+Math.imul(Z,ot)|0,f=f+Math.imul(Z,Ht)|0,f=f+Math.imul(mt,ot)|0,m=m+Math.imul(mt,Ht)|0,r=r+Math.imul(z,st)|0,f=f+Math.imul(z,Kt)|0,f=f+Math.imul(lt,st)|0,m=m+Math.imul(lt,Kt)|0,r=r+Math.imul(R,ht)|0,f=f+Math.imul(R,Pt)|0,f=f+Math.imul(C,ht)|0,m=m+Math.imul(C,Pt)|0;var ne=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(ne>>>26)|0,ne&=67108863,r=Math.imul(Q,et),f=Math.imul(Q,qt),f=f+Math.imul(Ot,et)|0,m=Math.imul(Ot,qt),r=r+Math.imul(J,rt)|0,f=f+Math.imul(J,Ut)|0,f=f+Math.imul(Lt,rt)|0,m=m+Math.imul(Lt,Ut)|0,r=r+Math.imul(V,it)|0,f=f+Math.imul(V,Ft)|0,f=f+Math.imul(bt,it)|0,m=m+Math.imul(bt,Ft)|0,r=r+Math.imul(D,nt)|0,f=f+Math.imul(D,$t)|0,f=f+Math.imul(ut,nt)|0,m=m+Math.imul(ut,$t)|0,r=r+Math.imul(E,at)|0,f=f+Math.imul(E,zt)|0,f=f+Math.imul(P,at)|0,m=m+Math.imul(P,zt)|0,r=r+Math.imul(Y,ft)|0,f=f+Math.imul(Y,Dt)|0,f=f+Math.imul(U,ft)|0,m=m+Math.imul(U,Dt)|0,r=r+Math.imul(j,ot)|0,f=f+Math.imul(j,Ht)|0,f=f+Math.imul(Ct,ot)|0,m=m+Math.imul(Ct,Ht)|0,r=r+Math.imul(Z,st)|0,f=f+Math.imul(Z,Kt)|0,f=f+Math.imul(mt,st)|0,m=m+Math.imul(mt,Kt)|0,r=r+Math.imul(z,ht)|0,f=f+Math.imul(z,Pt)|0,f=f+Math.imul(lt,ht)|0,m=m+Math.imul(lt,Pt)|0;var ae=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(ae>>>26)|0,ae&=67108863,r=Math.imul(Q,rt),f=Math.imul(Q,Ut),f=f+Math.imul(Ot,rt)|0,m=Math.imul(Ot,Ut),r=r+Math.imul(J,it)|0,f=f+Math.imul(J,Ft)|0,f=f+Math.imul(Lt,it)|0,m=m+Math.imul(Lt,Ft)|0,r=r+Math.imul(V,nt)|0,f=f+Math.imul(V,$t)|0,f=f+Math.imul(bt,nt)|0,m=m+Math.imul(bt,$t)|0,r=r+Math.imul(D,at)|0,f=f+Math.imul(D,zt)|0,f=f+Math.imul(ut,at)|0,m=m+Math.imul(ut,zt)|0,r=r+Math.imul(E,ft)|0,f=f+Math.imul(E,Dt)|0,f=f+Math.imul(P,ft)|0,m=m+Math.imul(P,Dt)|0,r=r+Math.imul(Y,ot)|0,f=f+Math.imul(Y,Ht)|0,f=f+Math.imul(U,ot)|0,m=m+Math.imul(U,Ht)|0,r=r+Math.imul(j,st)|0,f=f+Math.imul(j,Kt)|0,f=f+Math.imul(Ct,st)|0,m=m+Math.imul(Ct,Kt)|0,r=r+Math.imul(Z,ht)|0,f=f+Math.imul(Z,Pt)|0,f=f+Math.imul(mt,ht)|0,m=m+Math.imul(mt,Pt)|0;var fe=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(fe>>>26)|0,fe&=67108863,r=Math.imul(Q,it),f=Math.imul(Q,Ft),f=f+Math.imul(Ot,it)|0,m=Math.imul(Ot,Ft),r=r+Math.imul(J,nt)|0,f=f+Math.imul(J,$t)|0,f=f+Math.imul(Lt,nt)|0,m=m+Math.imul(Lt,$t)|0,r=r+Math.imul(V,at)|0,f=f+Math.imul(V,zt)|0,f=f+Math.imul(bt,at)|0,m=m+Math.imul(bt,zt)|0,r=r+Math.imul(D,ft)|0,f=f+Math.imul(D,Dt)|0,f=f+Math.imul(ut,ft)|0,m=m+Math.imul(ut,Dt)|0,r=r+Math.imul(E,ot)|0,f=f+Math.imul(E,Ht)|0,f=f+Math.imul(P,ot)|0,m=m+Math.imul(P,Ht)|0,r=r+Math.imul(Y,st)|0,f=f+Math.imul(Y,Kt)|0,f=f+Math.imul(U,st)|0,m=m+Math.imul(U,Kt)|0,r=r+Math.imul(j,ht)|0,f=f+Math.imul(j,Pt)|0,f=f+Math.imul(Ct,ht)|0,m=m+Math.imul(Ct,Pt)|0;var oe=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(oe>>>26)|0,oe&=67108863,r=Math.imul(Q,nt),f=Math.imul(Q,$t),f=f+Math.imul(Ot,nt)|0,m=Math.imul(Ot,$t),r=r+Math.imul(J,at)|0,f=f+Math.imul(J,zt)|0,f=f+Math.imul(Lt,at)|0,m=m+Math.imul(Lt,zt)|0,r=r+Math.imul(V,ft)|0,f=f+Math.imul(V,Dt)|0,f=f+Math.imul(bt,ft)|0,m=m+Math.imul(bt,Dt)|0,r=r+Math.imul(D,ot)|0,f=f+Math.imul(D,Ht)|0,f=f+Math.imul(ut,ot)|0,m=m+Math.imul(ut,Ht)|0,r=r+Math.imul(E,st)|0,f=f+Math.imul(E,Kt)|0,f=f+Math.imul(P,st)|0,m=m+Math.imul(P,Kt)|0,r=r+Math.imul(Y,ht)|0,f=f+Math.imul(Y,Pt)|0,f=f+Math.imul(U,ht)|0,m=m+Math.imul(U,Pt)|0;var se=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(se>>>26)|0,se&=67108863,r=Math.imul(Q,at),f=Math.imul(Q,zt),f=f+Math.imul(Ot,at)|0,m=Math.imul(Ot,zt),r=r+Math.imul(J,ft)|0,f=f+Math.imul(J,Dt)|0,f=f+Math.imul(Lt,ft)|0,m=m+Math.imul(Lt,Dt)|0,r=r+Math.imul(V,ot)|0,f=f+Math.imul(V,Ht)|0,f=f+Math.imul(bt,ot)|0,m=m+Math.imul(bt,Ht)|0,r=r+Math.imul(D,st)|0,f=f+Math.imul(D,Kt)|0,f=f+Math.imul(ut,st)|0,m=m+Math.imul(ut,Kt)|0,r=r+Math.imul(E,ht)|0,f=f+Math.imul(E,Pt)|0,f=f+Math.imul(P,ht)|0,m=m+Math.imul(P,Pt)|0;var he=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(he>>>26)|0,he&=67108863,r=Math.imul(Q,ft),f=Math.imul(Q,Dt),f=f+Math.imul(Ot,ft)|0,m=Math.imul(Ot,Dt),r=r+Math.imul(J,ot)|0,f=f+Math.imul(J,Ht)|0,f=f+Math.imul(Lt,ot)|0,m=m+Math.imul(Lt,Ht)|0,r=r+Math.imul(V,st)|0,f=f+Math.imul(V,Kt)|0,f=f+Math.imul(bt,st)|0,m=m+Math.imul(bt,Kt)|0,r=r+Math.imul(D,ht)|0,f=f+Math.imul(D,Pt)|0,f=f+Math.imul(ut,ht)|0,m=m+Math.imul(ut,Pt)|0;var ue=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(ue>>>26)|0,ue&=67108863,r=Math.imul(Q,ot),f=Math.imul(Q,Ht),f=f+Math.imul(Ot,ot)|0,m=Math.imul(Ot,Ht),r=r+Math.imul(J,st)|0,f=f+Math.imul(J,Kt)|0,f=f+Math.imul(Lt,st)|0,m=m+Math.imul(Lt,Kt)|0,r=r+Math.imul(V,ht)|0,f=f+Math.imul(V,Pt)|0,f=f+Math.imul(bt,ht)|0,m=m+Math.imul(bt,Pt)|0;var le=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(le>>>26)|0,le&=67108863,r=Math.imul(Q,st),f=Math.imul(Q,Kt),f=f+Math.imul(Ot,st)|0,m=Math.imul(Ot,Kt),r=r+Math.imul(J,ht)|0,f=f+Math.imul(J,Pt)|0,f=f+Math.imul(Lt,ht)|0,m=m+Math.imul(Lt,Pt)|0;var ce=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(ce>>>26)|0,ce&=67108863,r=Math.imul(Q,ht),f=Math.imul(Q,Pt),f=f+Math.imul(Ot,ht)|0,m=Math.imul(Ot,Pt);var Ue=(d+r|0)+((f&8191)<<13)|0;return d=(m+(f>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,p[0]=Jt,p[1]=jt,p[2]=Yt,p[3]=Xt,p[4]=Qt,p[5]=te,p[6]=ee,p[7]=re,p[8]=ie,p[9]=ne,p[10]=ae,p[11]=fe,p[12]=oe,p[13]=se,p[14]=he,p[15]=ue,p[16]=le,p[17]=ce,p[18]=Ue,d!==0&&(p[19]=d,s.length++),s};Math.imul||(N=M);function x(e,t,i){i.negative=t.negative^e.negative,i.length=e.length+t.length;for(var s=0,l=0,c=0;c<i.length-1;c++){var p=l;l=0;for(var d=s&67108863,r=Math.min(c,t.length-1),f=Math.max(0,c-e.length+1);f<=r;f++){var m=c-f,_=e.words[m]|0,R=t.words[f]|0,C=_*R,F=C&67108863;p=p+(C/67108864|0)|0,F=F+d|0,d=F&67108863,p=p+(F>>>26)|0,l+=p>>>26,p&=67108863}i.words[c]=d,s=p,p=l}return s!==0?i.words[c]=s:i.length--,i.strip()}function A(e,t,i){var s=new S;return s.mulp(e,t,i)}o.prototype.mulTo=function(t,i){var s,l=this.length+t.length;return this.length===10&&t.length===10?s=N(this,t,i):l<63?s=M(this,t,i):l<1024?s=x(this,t,i):s=A(this,t,i),s};function S(e,t){this.x=e,this.y=t}S.prototype.makeRBT=function(t){for(var i=new Array(t),s=o.prototype._countBits(t)-1,l=0;l<t;l++)i[l]=this.revBin(l,s,t);return i},S.prototype.revBin=function(t,i,s){if(t===0||t===s-1)return t;for(var l=0,c=0;c<i;c++)l|=(t&1)<<i-c-1,t>>=1;return l},S.prototype.permute=function(t,i,s,l,c,p){for(var d=0;d<p;d++)l[d]=i[t[d]],c[d]=s[t[d]]},S.prototype.transform=function(t,i,s,l,c,p){this.permute(p,t,i,s,l,c);for(var d=1;d<c;d<<=1)for(var r=d<<1,f=Math.cos(2*Math.PI/r),m=Math.sin(2*Math.PI/r),_=0;_<c;_+=r)for(var R=f,C=m,F=0;F<d;F++){var z=s[_+F],lt=l[_+F],G=s[_+F+d],Z=l[_+F+d],mt=R*G-C*Z;Z=R*Z+C*G,G=mt,s[_+F]=z+G,l[_+F]=lt+Z,s[_+F+d]=z-G,l[_+F+d]=lt-Z,F!==r&&(mt=f*R-m*C,C=f*C+m*R,R=mt)}},S.prototype.guessLen13b=function(t,i){var s=Math.max(i,t)|1,l=s&1,c=0;for(s=s/2|0;s;s=s>>>1)c++;return 1<<c+1+l},S.prototype.conjugate=function(t,i,s){if(!(s<=1))for(var l=0;l<s/2;l++){var c=t[l];t[l]=t[s-l-1],t[s-l-1]=c,c=i[l],i[l]=-i[s-l-1],i[s-l-1]=-c}},S.prototype.normalize13b=function(t,i){for(var s=0,l=0;l<i/2;l++){var c=Math.round(t[2*l+1]/i)*8192+Math.round(t[2*l]/i)+s;t[l]=c&67108863,c<67108864?s=0:s=c/67108864|0}return t},S.prototype.convert13b=function(t,i,s,l){for(var c=0,p=0;p<i;p++)c=c+(t[p]|0),s[2*p]=c&8191,c=c>>>13,s[2*p+1]=c&8191,c=c>>>13;for(p=2*i;p<l;++p)s[p]=0;u(c===0),u((c&-8192)===0)},S.prototype.stub=function(t){for(var i=new Array(t),s=0;s<t;s++)i[s]=0;return i},S.prototype.mulp=function(t,i,s){var l=2*this.guessLen13b(t.length,i.length),c=this.makeRBT(l),p=this.stub(l),d=new Array(l),r=new Array(l),f=new Array(l),m=new Array(l),_=new Array(l),R=new Array(l),C=s.words;C.length=l,this.convert13b(t.words,t.length,d,l),this.convert13b(i.words,i.length,m,l),this.transform(d,p,r,f,l,c),this.transform(m,p,_,R,l,c);for(var F=0;F<l;F++){var z=r[F]*_[F]-f[F]*R[F];f[F]=r[F]*R[F]+f[F]*_[F],r[F]=z}return this.conjugate(r,f,l),this.transform(r,f,C,p,l,c),this.conjugate(C,p,l),this.normalize13b(C,l),s.negative=t.negative^i.negative,s.length=t.length+i.length,s.strip()},o.prototype.mul=function(t){var i=new o(null);return i.words=new Array(this.length+t.length),this.mulTo(t,i)},o.prototype.mulf=function(t){var i=new o(null);return i.words=new Array(this.length+t.length),A(this,t,i)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){u(typeof t=="number"),u(t<67108864);for(var i=0,s=0;s<this.length;s++){var l=(this.words[s]|0)*t,c=(l&67108863)+(i&67108863);i>>=26,i+=l/67108864|0,i+=c>>>26,this.words[s]=c&67108863}return i!==0&&(this.words[s]=i,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var i=$(t);if(i.length===0)return new o(1);for(var s=this,l=0;l<i.length&&i[l]===0;l++,s=s.sqr());if(++l<i.length)for(var c=s.sqr();l<i.length;l++,c=c.sqr())i[l]!==0&&(s=s.mul(c));return s},o.prototype.iushln=function(t){u(typeof t=="number"&&t>=0);var i=t%26,s=(t-i)/26,l=67108863>>>26-i<<26-i,c;if(i!==0){var p=0;for(c=0;c<this.length;c++){var d=this.words[c]&l,r=(this.words[c]|0)-d<<i;this.words[c]=r|p,p=d>>>26-i}p&&(this.words[c]=p,this.length++)}if(s!==0){for(c=this.length-1;c>=0;c--)this.words[c+s]=this.words[c];for(c=0;c<s;c++)this.words[c]=0;this.length+=s}return this.strip()},o.prototype.ishln=function(t){return u(this.negative===0),this.iushln(t)},o.prototype.iushrn=function(t,i,s){u(typeof t=="number"&&t>=0);var l;i?l=(i-i%26)/26:l=0;var c=t%26,p=Math.min((t-c)/26,this.length),d=67108863^67108863>>>c<<c,r=s;if(l-=p,l=Math.max(0,l),r){for(var f=0;f<p;f++)r.words[f]=this.words[f];r.length=p}if(p!==0)if(this.length>p)for(this.length-=p,f=0;f<this.length;f++)this.words[f]=this.words[f+p];else this.words[0]=0,this.length=1;var m=0;for(f=this.length-1;f>=0&&(m!==0||f>=l);f--){var _=this.words[f]|0;this.words[f]=m<<26-c|_>>>c,m=_&d}return r&&m!==0&&(r.words[r.length++]=m),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,i,s){return u(this.negative===0),this.iushrn(t,i,s)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){u(typeof t=="number"&&t>=0);var i=t%26,s=(t-i)/26,l=1<<i;if(this.length<=s)return!1;var c=this.words[s];return!!(c&l)},o.prototype.imaskn=function(t){u(typeof t=="number"&&t>=0);var i=t%26,s=(t-i)/26;if(u(this.negative===0,"imaskn works only with positive numbers"),this.length<=s)return this;if(i!==0&&s++,this.length=Math.min(s,this.length),i!==0){var l=67108863^67108863>>>i<<i;this.words[this.length-1]&=l}return this.strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return u(typeof t=="number"),u(t<67108864),t<0?this.isubn(-t):this.negative!==0?this.length===1&&(this.words[0]|0)<t?(this.words[0]=t-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var i=0;i<this.length&&this.words[i]>=67108864;i++)this.words[i]-=67108864,i===this.length-1?this.words[i+1]=1:this.words[i+1]++;return this.length=Math.max(this.length,i+1),this},o.prototype.isubn=function(t){if(u(typeof t=="number"),u(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 i=0;i<this.length&&this.words[i]<0;i++)this.words[i]+=67108864,this.words[i+1]-=1;return this.strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,i,s){var l=t.length+s,c;this._expand(l);var p,d=0;for(c=0;c<t.length;c++){p=(this.words[c+s]|0)+d;var r=(t.words[c]|0)*i;p-=r&67108863,d=(p>>26)-(r/67108864|0),this.words[c+s]=p&67108863}for(;c<this.length-s;c++)p=(this.words[c+s]|0)+d,d=p>>26,this.words[c+s]=p&67108863;if(d===0)return this.strip();for(u(d===-1),d=0,c=0;c<this.length;c++)p=-(this.words[c]|0)+d,d=p>>26,this.words[c]=p&67108863;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,i){var s=this.length-t.length,l=this.clone(),c=t,p=c.words[c.length-1]|0,d=this._countBits(p);s=26-d,s!==0&&(c=c.ushln(s),l.iushln(s),p=c.words[c.length-1]|0);var r=l.length-c.length,f;if(i!=="mod"){f=new o(null),f.length=r+1,f.words=new Array(f.length);for(var m=0;m<f.length;m++)f.words[m]=0}var _=l.clone()._ishlnsubmul(c,1,r);_.negative===0&&(l=_,f&&(f.words[r]=1));for(var R=r-1;R>=0;R--){var C=(l.words[c.length+R]|0)*67108864+(l.words[c.length+R-1]|0);for(C=Math.min(C/p|0,67108863),l._ishlnsubmul(c,C,R);l.negative!==0;)C--,l.negative=0,l._ishlnsubmul(c,1,R),l.isZero()||(l.negative^=1);f&&(f.words[R]=C)}return f&&f.strip(),l.strip(),i!=="div"&&s!==0&&l.iushrn(s),{div:f||null,mod:l}},o.prototype.divmod=function(t,i,s){if(u(!t.isZero()),this.isZero())return{div:new o(0),mod:new o(0)};var l,c,p;return this.negative!==0&&t.negative===0?(p=this.neg().divmod(t,i),i!=="mod"&&(l=p.div.neg()),i!=="div"&&(c=p.mod.neg(),s&&c.negative!==0&&c.iadd(t)),{div:l,mod:c}):this.negative===0&&t.negative!==0?(p=this.divmod(t.neg(),i),i!=="mod"&&(l=p.div.neg()),{div:l,mod:p.mod}):this.negative&t.negative?(p=this.neg().divmod(t.neg(),i),i!=="div"&&(c=p.mod.neg(),s&&c.negative!==0&&c.isub(t)),{div:p.div,mod:c}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:t.length===1?i==="div"?{div:this.divn(t.words[0]),mod:null}:i==="mod"?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,i)},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var i=this.divmod(t);if(i.mod.isZero())return i.div;var s=i.div.negative!==0?i.mod.isub(t):i.mod,l=t.ushrn(1),c=t.andln(1),p=s.cmp(l);return p<0||c===1&&p===0?i.div:i.div.negative!==0?i.div.isubn(1):i.div.iaddn(1)},o.prototype.modn=function(t){u(t<=67108863);for(var i=(1<<26)%t,s=0,l=this.length-1;l>=0;l--)s=(i*s+(this.words[l]|0))%t;return s},o.prototype.idivn=function(t){u(t<=67108863);for(var i=0,s=this.length-1;s>=0;s--){var l=(this.words[s]|0)+i*67108864;this.words[s]=l/t|0,i=l%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){u(t.negative===0),u(!t.isZero());var i=this,s=t.clone();i.negative!==0?i=i.umod(t):i=i.clone();for(var l=new o(1),c=new o(0),p=new o(0),d=new o(1),r=0;i.isEven()&&s.isEven();)i.iushrn(1),s.iushrn(1),++r;for(var f=s.clone(),m=i.clone();!i.isZero();){for(var _=0,R=1;!(i.words[0]&R)&&_<26;++_,R<<=1);if(_>0)for(i.iushrn(_);_-- >0;)(l.isOdd()||c.isOdd())&&(l.iadd(f),c.isub(m)),l.iushrn(1),c.iushrn(1);for(var C=0,F=1;!(s.words[0]&F)&&C<26;++C,F<<=1);if(C>0)for(s.iushrn(C);C-- >0;)(p.isOdd()||d.isOdd())&&(p.iadd(f),d.isub(m)),p.iushrn(1),d.iushrn(1);i.cmp(s)>=0?(i.isub(s),l.isub(p),c.isub(d)):(s.isub(i),p.isub(l),d.isub(c))}return{a:p,b:d,gcd:s.iushln(r)}},o.prototype._invmp=function(t){u(t.negative===0),u(!t.isZero());var i=this,s=t.clone();i.negative!==0?i=i.umod(t):i=i.clone();for(var l=new o(1),c=new o(0),p=s.clone();i.cmpn(1)>0&&s.cmpn(1)>0;){for(var d=0,r=1;!(i.words[0]&r)&&d<26;++d,r<<=1);if(d>0)for(i.iushrn(d);d-- >0;)l.isOdd()&&l.iadd(p),l.iushrn(1);for(var f=0,m=1;!(s.words[0]&m)&&f<26;++f,m<<=1);if(f>0)for(s.iushrn(f);f-- >0;)c.isOdd()&&c.iadd(p),c.iushrn(1);i.cmp(s)>=0?(i.isub(s),l.isub(c)):(s.isub(i),c.isub(l))}var _;return i.cmpn(1)===0?_=l:_=c,_.cmpn(0)<0&&_.iadd(t),_},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var i=this.clone(),s=t.clone();i.negative=0,s.negative=0;for(var l=0;i.isEven()&&s.isEven();l++)i.iushrn(1),s.iushrn(1);do{for(;i.isEven();)i.iushrn(1);for(;s.isEven();)s.iushrn(1);var c=i.cmp(s);if(c<0){var p=i;i=s,s=p}else if(c===0||s.cmpn(1)===0)break;i.isub(s)}while(!0);return s.iushln(l)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return(this.words[0]&1)===0},o.prototype.isOdd=function(){return(this.words[0]&1)===1},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){u(typeof t=="number");var i=t%26,s=(t-i)/26,l=1<<i;if(this.length<=s)return this._expand(s+1),this.words[s]|=l,this;for(var c=l,p=s;c!==0&&p<this.length;p++){var d=this.words[p]|0;d+=c,c=d>>>26,d&=67108863,this.words[p]=d}return c!==0&&(this.words[p]=c,this.length++),this},o.prototype.isZero=function(){return this.length===1&&this.words[0]===0},o.prototype.cmpn=function(t){var i=t<0;if(this.negative!==0&&!i)return-1;if(this.negative===0&&i)return 1;this.strip();var s;if(this.length>1)s=1;else{i&&(t=-t),u(t<=67108863,"Number is too big");var l=this.words[0]|0;s=l===t?0:l<t?-1:1}return this.negative!==0?-s|0:s},o.prototype.cmp=function(t){if(this.negative!==0&&t.negative===0)return-1;if(this.negative===0&&t.negative!==0)return 1;var i=this.ucmp(t);return this.negative!==0?-i|0:i},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var i=0,s=this.length-1;s>=0;s--){var l=this.words[s]|0,c=t.words[s]|0;if(l!==c){l<c?i=-1:l>c&&(i=1);break}}return i},o.prototype.gtn=function(t){return this.cmpn(t)===1},o.prototype.gt=function(t){return this.cmp(t)===1},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return this.cmpn(t)===-1},o.prototype.lt=function(t){return this.cmp(t)===-1},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return this.cmpn(t)===0},o.prototype.eq=function(t){return this.cmp(t)===0},o.red=function(t){return new dt(t)},o.prototype.toRed=function(t){return u(!this.red,"Already a number in reduction context"),u(this.negative===0,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return u(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return u(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return u(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return u(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return u(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return u(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return u(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return u(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return u(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return u(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return u(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return u(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return u(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return u(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return u(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var T={k256:null,p224:null,p192:null,p25519:null};function O(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}O.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},O.prototype.ireduce=function(t){var i=t,s;do this.split(i,this.tmp),i=this.imulK(i),i=i.iadd(this.tmp),s=i.bitLength();while(s>this.n);var l=s<this.n?-1:i.ucmp(this.p);return l===0?(i.words[0]=0,i.length=1):l>0?i.isub(this.p):i.strip!==void 0?i.strip():i._strip(),i},O.prototype.split=function(t,i){t.iushrn(this.n,0,i)},O.prototype.imulK=function(t){return t.imul(this.k)};function W(){O.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}v(W,O),W.prototype.split=function(t,i){for(var s=4194303,l=Math.min(t.length,9),c=0;c<l;c++)i.words[c]=t.words[c];if(i.length=l,t.length<=9){t.words[0]=0,t.length=1;return}var p=t.words[9];for(i.words[i.length++]=p&s,c=10;c<t.length;c++){var d=t.words[c]|0;t.words[c-10]=(d&s)<<4|p>>>22,p=d}p>>>=22,t.words[c-10]=p,p===0&&t.length>10?t.length-=10:t.length-=9},W.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var i=0,s=0;s<t.length;s++){var l=t.words[s]|0;i+=l*977,t.words[s]=i&67108863,i=l*64+(i/67108864|0)}return t.words[t.length-1]===0&&(t.length--,t.words[t.length-1]===0&&t.length--),t};function K(){O.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}v(K,O);function pt(){O.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}v(pt,O);function ct(){O.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}v(ct,O),ct.prototype.imulK=function(t){for(var i=0,s=0;s<t.length;s++){var l=(t.words[s]|0)*19+i,c=l&67108863;l>>>=26,t.words[s]=c,i=l}return i!==0&&(t.words[t.length++]=i),t},o._prime=function(t){if(T[t])return T[t];var i;if(t==="k256")i=new W;else if(t==="p224")i=new K;else if(t==="p192")i=new pt;else if(t==="p25519")i=new ct;else throw new Error("Unknown prime "+t);return T[t]=i,i};function dt(e){if(typeof e=="string"){var t=o._prime(e);this.m=t.p,this.prime=t}else u(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}dt.prototype._verify1=function(t){u(t.negative===0,"red works only with positives"),u(t.red,"red works only with red numbers")},dt.prototype._verify2=function(t,i){u((t.negative|i.negative)===0,"red works only with positives"),u(t.red&&t.red===i.red,"red works only with red numbers")},dt.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},dt.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},dt.prototype.add=function(t,i){this._verify2(t,i);var s=t.add(i);return s.cmp(this.m)>=0&&s.isub(this.m),s._forceRed(this)},dt.prototype.iadd=function(t,i){this._verify2(t,i);var s=t.iadd(i);return s.cmp(this.m)>=0&&s.isub(this.m),s},dt.prototype.sub=function(t,i){this._verify2(t,i);var s=t.sub(i);return s.cmpn(0)<0&&s.iadd(this.m),s._forceRed(this)},dt.prototype.isub=function(t,i){this._verify2(t,i);var s=t.isub(i);return s.cmpn(0)<0&&s.iadd(this.m),s},dt.prototype.shl=function(t,i){return this._verify1(t),this.imod(t.ushln(i))},dt.prototype.imul=function(t,i){return this._verify2(t,i),this.imod(t.imul(i))},dt.prototype.mul=function(t,i){return this._verify2(t,i),this.imod(t.mul(i))},dt.prototype.isqr=function(t){return this.imul(t,t.clone())},dt.prototype.sqr=function(t){return this.mul(t,t)},dt.prototype.sqrt=function(t){if(t.isZero())return t.clone();var i=this.m.andln(3);if(u(i%2===1),i===3){var s=this.m.add(new o(1)).iushrn(2);return this.pow(t,s)}for(var l=this.m.subn(1),c=0;!l.isZero()&&l.andln(1)===0;)c++,l.iushrn(1);u(!l.isZero());var p=new o(1).toRed(this),d=p.redNeg(),r=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new o(2*f*f).toRed(this);this.pow(f,r).cmp(d)!==0;)f.redIAdd(d);for(var m=this.pow(f,l),_=this.pow(t,l.addn(1).iushrn(1)),R=this.pow(t,l),C=c;R.cmp(p)!==0;){for(var F=R,z=0;F.cmp(p)!==0;z++)F=F.redSqr();u(z<C);var lt=this.pow(m,new o(1).iushln(C-z-1));_=_.redMul(lt),m=lt.redSqr(),R=R.redMul(m),C=z}return _},dt.prototype.invm=function(t){var i=t._invmp(this.m);return i.negative!==0?(i.negative=0,this.imod(i).redNeg()):this.imod(i)},dt.prototype.pow=function(t,i){if(i.isZero())return new o(1).toRed(this);if(i.cmpn(1)===0)return t.clone();var s=4,l=new Array(1<<s);l[0]=new o(1).toRed(this),l[1]=t;for(var c=2;c<l.length;c++)l[c]=this.mul(l[c-1],t);var p=l[0],d=0,r=0,f=i.bitLength()%26;for(f===0&&(f=26),c=i.length-1;c>=0;c--){for(var m=i.words[c],_=f-1;_>=0;_--){var R=m>>_&1;if(p!==l[0]&&(p=this.sqr(p)),R===0&&d===0){r=0;continue}d<<=1,d|=R,r++,!(r!==s&&(c!==0||_!==0))&&(p=this.mul(p,l[d]),r=0,d=0)}f=26}return p},dt.prototype.convertTo=function(t){var i=t.umod(this.m);return i===t?i.clone():i},dt.prototype.convertFrom=function(t){var i=t.clone();return i.red=null,i},o.mont=function(t){return new g(t)};function g(e){dt.call(this,e),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v(g,dt),g.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},g.prototype.convertFrom=function(t){var i=this.imod(t.mul(this.rinv));return i.red=null,i},g.prototype.imul=function(t,i){if(t.isZero()||i.isZero())return t.words[0]=0,t.length=1,t;var s=t.imul(i),l=s.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),c=s.isub(l).iushrn(this.shift),p=c;return c.cmp(this.m)>=0?p=c.isub(this.m):c.cmpn(0)<0&&(p=c.iadd(this.m)),p._forceRed(this)},g.prototype.mul=function(t,i){if(t.isZero()||i.isZero())return new o(0)._forceRed(this);var s=t.mul(i),l=s.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),c=s.isub(l).iushrn(this.shift),p=c;return c.cmp(this.m)>=0?p=c.isub(this.m):c.cmpn(0)<0&&(p=c.iadd(this.m)),p._forceRed(this)},g.prototype.invm=function(t){var i=this.imod(t._invmp(this.m).mul(this.r2));return i._forceRed(this)}})(a,Vt)})(to);var dr=to.exports,eo={};(function(a){var n=a;function h(o,w){if(Array.isArray(o))return o.slice();if(!o)return[];var y=[];if(typeof o!="string"){for(var b=0;b<o.length;b++)y[b]=o[b]|0;return y}if(w==="hex"){o=o.replace(/[^a-z0-9]+/ig,""),o.length%2!==0&&(o="0"+o);for(var b=0;b<o.length;b+=2)y.push(parseInt(o[b]+o[b+1],16))}else for(var b=0;b<o.length;b++){var B=o.charCodeAt(b),k=B>>8,L=B&255;k?y.push(k,L):y.push(L)}return y}n.toArray=h;function u(o){return o.length===1?"0"+o:o}n.zero2=u;function v(o){for(var w="",y=0;y<o.length;y++)w+=u(o[y].toString(16));return w}n.toHex=v,n.encode=function(w,y){return y==="hex"?v(w):w}})(eo);(function(a){var n=a,h=dr,u=Is,v=eo;n.assert=u,n.toArray=v.toArray,n.zero2=v.zero2,n.toHex=v.toHex,n.encode=v.encode;function o(k,L,q){var $=new Array(Math.max(k.bitLength(),q)+1);$.fill(0);for(var M=1<<L+1,N=k.clone(),x=0;x<$.length;x++){var A,S=N.andln(M-1);N.isOdd()?(S>(M>>1)-1?A=(M>>1)-S:A=S,N.isubn(A)):A=0,$[x]=A,N.iushrn(1)}return $}n.getNAF=o;function w(k,L){var q=[[],[]];k=k.clone(),L=L.clone();for(var $=0,M=0,N;k.cmpn(-$)>0||L.cmpn(-M)>0;){var x=k.andln(3)+$&3,A=L.andln(3)+M&3;x===3&&(x=-1),A===3&&(A=-1);var S;x&1?(N=k.andln(7)+$&7,(N===3||N===5)&&A===2?S=-x:S=x):S=0,q[0].push(S);var T;A&1?(N=L.andln(7)+M&7,(N===3||N===5)&&x===2?T=-A:T=A):T=0,q[1].push(T),2*$===S+1&&($=1-$),2*M===T+1&&(M=1-M),k.iushrn(1),L.iushrn(1)}return q}n.getJSF=w;function y(k,L,q){var $="_"+L;k.prototype[L]=function(){return this[$]!==void 0?this[$]:this[$]=q.call(this)}}n.cachedProperty=y;function b(k){return typeof k=="string"?n.toArray(k,"hex"):k}n.parseBytes=b;function B(k){return new h(k,"hex","le")}n.intFromLE=B})(Ke);var ro={exports:{}},Ia;ro.exports=function(n){return Ia||(Ia=new gr(null)),Ia.generate(n)};function gr(a){this.rand=a}ro.exports.Rand=gr;gr.prototype.generate=function(n){return this._rand(n)};gr.prototype._rand=function(n){if(this.rand.getBytes)return this.rand.getBytes(n);for(var h=new Uint8Array(n),u=0;u<h.length;u++)h[u]=this.rand.getByte();return h};if(typeof self=="object")self.crypto&&self.crypto.getRandomValues?gr.prototype._rand=function(n){var h=new Uint8Array(n);return self.crypto.getRandomValues(h),h}:self.msCrypto&&self.msCrypto.getRandomValues?gr.prototype._rand=function(n){var h=new Uint8Array(n);return self.msCrypto.getRandomValues(h),h}:typeof window=="object"&&(gr.prototype._rand=function(){throw new Error("Not implemented yet")});else try{var p0=Se;if(typeof p0.randomBytes!="function")throw new Error("Not supported");gr.prototype._rand=function(n){return p0.randomBytes(n)}}catch{}var $s=ro.exports,io={},Br=dr,Ji=Ke,_n=Ji.getNAF,Cc=Ji.getJSF,Sn=Ji.assert;function Sr(a,n){this.type=a,this.p=new Br(n.p,16),this.red=n.prime?Br.red(n.prime):Br.mont(this.p),this.zero=new Br(0).toRed(this.red),this.one=new Br(1).toRed(this.red),this.two=new Br(2).toRed(this.red),this.n=n.n&&new Br(n.n,16),this.g=n.g&&this.pointFromJSON(n.g,n.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 Fn=Sr;Sr.prototype.point=function(){throw new Error("Not implemented")};Sr.prototype.validate=function(){throw new Error("Not implemented")};Sr.prototype._fixedNafMul=function(n,h){Sn(n.precomputed);var u=n._getDoubles(),v=_n(h,1,this._bitLength),o=(1<<u.step+1)-(u.step%2===0?2:1);o/=3;var w=[],y,b;for(y=0;y<v.length;y+=u.step){b=0;for(var B=y+u.step-1;B>=y;B--)b=(b<<1)+v[B];w.push(b)}for(var k=this.jpoint(null,null,null),L=this.jpoint(null,null,null),q=o;q>0;q--){for(y=0;y<w.length;y++)b=w[y],b===q?L=L.mixedAdd(u.points[y]):b===-q&&(L=L.mixedAdd(u.points[y].neg()));k=k.add(L)}return k.toP()};Sr.prototype._wnafMul=function(n,h){var u=4,v=n._getNAFPoints(u);u=v.wnd;for(var o=v.points,w=_n(h,u,this._bitLength),y=this.jpoint(null,null,null),b=w.length-1;b>=0;b--){for(var B=0;b>=0&&w[b]===0;b--)B++;if(b>=0&&B++,y=y.dblp(B),b<0)break;var k=w[b];Sn(k!==0),n.type==="affine"?k>0?y=y.mixedAdd(o[k-1>>1]):y=y.mixedAdd(o[-k-1>>1].neg()):k>0?y=y.add(o[k-1>>1]):y=y.add(o[-k-1>>1].neg())}return n.type==="affine"?y.toP():y};Sr.prototype._wnafMulAdd=function(n,h,u,v,o){var w=this._wnafT1,y=this._wnafT2,b=this._wnafT3,B=0,k,L,q;for(k=0;k<v;k++){q=h[k];var $=q._getNAFPoints(n);w[k]=$.wnd,y[k]=$.points}for(k=v-1;k>=1;k-=2){var M=k-1,N=k;if(w[M]!==1||w[N]!==1){b[M]=_n(u[M],w[M],this._bitLength),b[N]=_n(u[N],w[N],this._bitLength),B=Math.max(b[M].length,B),B=Math.max(b[N].length,B);continue}var x=[h[M],null,null,h[N]];h[M].y.cmp(h[N].y)===0?(x[1]=h[M].add(h[N]),x[2]=h[M].toJ().mixedAdd(h[N].neg())):h[M].y.cmp(h[N].y.redNeg())===0?(x[1]=h[M].toJ().mixedAdd(h[N]),x[2]=h[M].add(h[N].neg())):(x[1]=h[M].toJ().mixedAdd(h[N]),x[2]=h[M].toJ().mixedAdd(h[N].neg()));var A=[-3,-1,-5,-7,0,7,5,1,3],S=Cc(u[M],u[N]);for(B=Math.max(S[0].length,B),b[M]=new Array(B),b[N]=new Array(B),L=0;L<B;L++){var T=S[0][L]|0,O=S[1][L]|0;b[M][L]=A[(T+1)*3+(O+1)],b[N][L]=0,y[M]=x}}var W=this.jpoint(null,null,null),K=this._wnafT4;for(k=B;k>=0;k--){for(var pt=0;k>=0;){var ct=!0;for(L=0;L<v;L++)K[L]=b[L][k]|0,K[L]!==0&&(ct=!1);if(!ct)break;pt++,k--}if(k>=0&&pt++,W=W.dblp(pt),k<0)break;for(L=0;L<v;L++){var dt=K[L];dt!==0&&(dt>0?q=y[L][dt-1>>1]:dt<0&&(q=y[L][-dt-1>>1].neg()),q.type==="affine"?W=W.mixedAdd(q):W=W.add(q))}}for(k=0;k<v;k++)y[k]=null;return o?W:W.toP()};function je(a,n){this.curve=a,this.type=n,this.precomputed=null}Sr.BasePoint=je;je.prototype.eq=function(){throw new Error("Not implemented")};je.prototype.validate=function(){return this.curve.validate(this)};Sr.prototype.decodePoint=function(n,h){n=Ji.toArray(n,h);var u=this.p.byteLength();if((n[0]===4||n[0]===6||n[0]===7)&&n.length-1===2*u){n[0]===6?Sn(n[n.length-1]%2===0):n[0]===7&&Sn(n[n.length-1]%2===1);var v=this.point(n.slice(1,1+u),n.slice(1+u,1+2*u));return v}else if((n[0]===2||n[0]===3)&&n.length-1===u)return this.pointFromX(n.slice(1,1+u),n[0]===3);throw new Error("Unknown point format")};je.prototype.encodeCompressed=function(n){return this.encode(n,!0)};je.prototype._encode=function(n){var h=this.curve.p.byteLength(),u=this.getX().toArray("be",h);return n?[this.getY().isEven()?2:3].concat(u):[4].concat(u,this.getY().toArray("be",h))};je.prototype.encode=function(n,h){return Ji.encode(this._encode(h),n)};je.prototype.precompute=function(n){if(this.precomputed)return this;var h={doubles:null,naf:null,beta:null};return h.naf=this._getNAFPoints(8),h.doubles=this._getDoubles(4,n),h.beta=this._getBeta(),this.precomputed=h,this};je.prototype._hasDoubles=function(n){if(!this.precomputed)return!1;var h=this.precomputed.doubles;return h?h.points.length>=Math.ceil((n.bitLength()+1)/h.step):!1};je.prototype._getDoubles=function(n,h){if(this.precomputed&&this.precomputed.doubles)return this.precomputed.doubles;for(var u=[this],v=this,o=0;o<h;o+=n){for(var w=0;w<n;w++)v=v.dbl();u.push(v)}return{step:n,points:u}};je.prototype._getNAFPoints=function(n){if(this.precomputed&&this.precomputed.naf)return this.precomputed.naf;for(var h=[this],u=(1<<n)-1,v=u===1?null:this.dbl(),o=1;o<u;o++)h[o]=h[o-1].add(v);return{wnd:n,points:h}};je.prototype._getBeta=function(){return null};je.prototype.dblp=function(n){for(var h=this,u=0;u<n;u++)h=h.dbl();return h};var Lc=Ke,_e=dr,no=cr,pi=Fn,Pc=Lc.assert;function Ye(a){pi.call(this,"short",a),this.a=new _e(a.a,16).toRed(this.red),this.b=new _e(a.b,16).toRed(this.red),this.tinv=this.two.redInvm(),this.zeroA=this.a.fromRed().cmpn(0)===0,this.threeA=this.a.fromRed().sub(this.p).cmpn(-3)===0,this.endo=this._getEndomorphism(a),this._endoWnafT1=new Array(4),this._endoWnafT2=new Array(4)}no(Ye,pi);var Oc=Ye;Ye.prototype._getEndomorphism=function(n){if(!(!this.zeroA||!this.g||!this.n||this.p.modn(3)!==1)){var h,u;if(n.beta)h=new _e(n.beta,16).toRed(this.red);else{var v=this._getEndoRoots(this.p);h=v[0].cmp(v[1])<0?v[0]:v[1],h=h.toRed(this.red)}if(n.lambda)u=new _e(n.lambda,16);else{var o=this._getEndoRoots(this.n);this.g.mul(o[0]).x.cmp(this.g.x.redMul(h))===0?u=o[0]:(u=o[1],Pc(this.g.mul(u).x.cmp(this.g.x.redMul(h))===0))}var w;return n.basis?w=n.basis.map(function(y){return{a:new _e(y.a,16),b:new _e(y.b,16)}}):w=this._getEndoBasis(u),{beta:h,lambda:u,basis:w}}};Ye.prototype._getEndoRoots=function(n){var h=n===this.p?this.red:_e.mont(n),u=new _e(2).toRed(h).redInvm(),v=u.redNeg(),o=new _e(3).toRed(h).redNeg().redSqrt().redMul(u),w=v.redAdd(o).fromRed(),y=v.redSub(o).fromRed();return[w,y]};Ye.prototype._getEndoBasis=function(n){for(var h=this.n.ushrn(Math.floor(this.n.bitLength()/2)),u=n,v=this.n.clone(),o=new _e(1),w=new _e(0),y=new _e(0),b=new _e(1),B,k,L,q,$,M,N,x=0,A,S;u.cmpn(0)!==0;){var T=v.div(u);A=v.sub(T.mul(u)),S=y.sub(T.mul(o));var O=b.sub(T.mul(w));if(!L&&A.cmp(h)<0)B=N.neg(),k=o,L=A.neg(),q=S;else if(L&&++x===2)break;N=A,v=u,u=A,y=o,o=S,b=w,w=O}$=A.neg(),M=S;var W=L.sqr().add(q.sqr()),K=$.sqr().add(M.sqr());return K.cmp(W)>=0&&($=B,M=k),L.negative&&(L=L.neg(),q=q.neg()),$.negative&&($=$.neg(),M=M.neg()),[{a:L,b:q},{a:$,b:M}]};Ye.prototype._endoSplit=function(n){var h=this.endo.basis,u=h[0],v=h[1],o=v.b.mul(n).divRound(this.n),w=u.b.neg().mul(n).divRound(this.n),y=o.mul(u.a),b=w.mul(v.a),B=o.mul(u.b),k=w.mul(v.b),L=n.sub(y).sub(b),q=B.add(k).neg();return{k1:L,k2:q}};Ye.prototype.pointFromX=function(n,h){n=new _e(n,16),n.red||(n=n.toRed(this.red));var u=n.redSqr().redMul(n).redIAdd(n.redMul(this.a)).redIAdd(this.b),v=u.redSqrt();if(v.redSqr().redSub(u).cmp(this.zero)!==0)throw new Error("invalid point");var o=v.fromRed().isOdd();return(h&&!o||!h&&o)&&(v=v.redNeg()),this.point(n,v)};Ye.prototype.validate=function(n){if(n.inf)return!0;var h=n.x,u=n.y,v=this.a.redMul(h),o=h.redSqr().redMul(h).redIAdd(v).redIAdd(this.b);return u.redSqr().redISub(o).cmpn(0)===0};Ye.prototype._endoWnafMulAdd=function(n,h,u){for(var v=this._endoWnafT1,o=this._endoWnafT2,w=0;w<n.length;w++){var y=this._endoSplit(h[w]),b=n[w],B=b._getBeta();y.k1.negative&&(y.k1.ineg(),b=b.neg(!0)),y.k2.negative&&(y.k2.ineg(),B=B.neg(!0)),v[w*2]=b,v[w*2+1]=B,o[w*2]=y.k1,o[w*2+1]=y.k2}for(var k=this._wnafMulAdd(1,v,o,w*2,u),L=0;L<w*2;L++)v[L]=null,o[L]=null;return k};function Re(a,n,h,u){pi.BasePoint.call(this,a,"affine"),n===null&&h===null?(this.x=null,this.y=null,this.inf=!0):(this.x=new _e(n,16),this.y=new _e(h,16),u&&(this.x.forceRed(this.curve.red),this.y.forceRed(this.curve.red)),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.y.red||(this.y=this.y.toRed(this.curve.red)),this.inf=!1)}no(Re,pi.BasePoint);Ye.prototype.point=function(n,h,u){return new Re(this,n,h,u)};Ye.prototype.pointFromJSON=function(n,h){return Re.fromJSON(this,n,h)};Re.prototype._getBeta=function(){if(this.curve.endo){var n=this.precomputed;if(n&&n.beta)return n.beta;var h=this.curve.point(this.x.redMul(this.curve.endo.beta),this.y);if(n){var u=this.curve,v=function(o){return u.point(o.x.redMul(u.endo.beta),o.y)};n.beta=h,h.precomputed={beta:null,naf:n.naf&&{wnd:n.naf.wnd,points:n.naf.points.map(v)},doubles:n.doubles&&{step:n.doubles.step,points:n.doubles.points.map(v)}}}return h}};Re.prototype.toJSON=function(){return this.precomputed?[this.x,this.y,this.precomputed&&{doubles:this.precomputed.doubles&&{step:this.precomputed.doubles.step,points:this.precomputed.doubles.points.slice(1)},naf:this.precomputed.naf&&{wnd:this.precomputed.naf.wnd,points:this.precomputed.naf.points.slice(1)}}]:[this.x,this.y]};Re.fromJSON=function(n,h,u){typeof h=="string"&&(h=JSON.parse(h));var v=n.point(h[0],h[1],u);if(!h[2])return v;function o(y){return n.point(y[0],y[1],u)}var w=h[2];return v.precomputed={beta:null,doubles:w.doubles&&{step:w.doubles.step,points:[v].concat(w.doubles.points.map(o))},naf:w.naf&&{wnd:w.naf.wnd,points:[v].concat(w.naf.points.map(o))}},v};Re.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+">"};Re.prototype.isInfinity=function(){return this.inf};Re.prototype.add=function(n){if(this.inf)return n;if(n.inf)return this;if(this.eq(n))return this.dbl();if(this.neg().eq(n))return this.curve.point(null,null);if(this.x.cmp(n.x)===0)return this.curve.point(null,null);var h=this.y.redSub(n.y);h.cmpn(0)!==0&&(h=h.redMul(this.x.redSub(n.x).redInvm()));var u=h.redSqr().redISub(this.x).redISub(n.x),v=h.redMul(this.x.redSub(u)).redISub(this.y);return this.curve.point(u,v)};Re.prototype.dbl=function(){if(this.inf)return this;var n=this.y.redAdd(this.y);if(n.cmpn(0)===0)return this.curve.point(null,null);var h=this.curve.a,u=this.x.redSqr(),v=n.redInvm(),o=u.redAdd(u).redIAdd(u).redIAdd(h).redMul(v),w=o.redSqr().redISub(this.x.redAdd(this.x)),y=o.redMul(this.x.redSub(w)).redISub(this.y);return this.curve.point(w,y)};Re.prototype.getX=function(){return this.x.fromRed()};Re.prototype.getY=function(){return this.y.fromRed()};Re.prototype.mul=function(n){return n=new _e(n,16),this.isInfinity()?this:this._hasDoubles(n)?this.curve._fixedNafMul(this,n):this.curve.endo?this.curve._endoWnafMulAdd([this],[n]):this.curve._wnafMul(this,n)};Re.prototype.mulAdd=function(n,h,u){var v=[this,h],o=[n,u];return this.curve.endo?this.curve._endoWnafMulAdd(v,o):this.curve._wnafMulAdd(1,v,o,2)};Re.prototype.jmulAdd=function(n,h,u){var v=[this,h],o=[n,u];return this.curve.endo?this.curve._endoWnafMulAdd(v,o,!0):this.curve._wnafMulAdd(1,v,o,2,!0)};Re.prototype.eq=function(n){return this===n||this.inf===n.inf&&(this.inf||this.x.cmp(n.x)===0&&this.y.cmp(n.y)===0)};Re.prototype.neg=function(n){if(this.inf)return this;var h=this.curve.point(this.x,this.y.redNeg());if(n&&this.precomputed){var u=this.precomputed,v=function(o){return o.neg()};h.precomputed={naf:u.naf&&{wnd:u.naf.wnd,points:u.naf.points.map(v)},doubles:u.doubles&&{step:u.doubles.step,points:u.doubles.points.map(v)}}}return h};Re.prototype.toJ=function(){if(this.inf)return this.curve.jpoint(null,null,null);var n=this.curve.jpoint(this.x,this.y,this.curve.one);return n};function Be(a,n,h,u){pi.BasePoint.call(this,a,"jacobian"),n===null&&h===null&&u===null?(this.x=this.curve.one,this.y=this.curve.one,this.z=new _e(0)):(this.x=new _e(n,16),this.y=new _e(h,16),this.z=new _e(u,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}no(Be,pi.BasePoint);Ye.prototype.jpoint=function(n,h,u){return new Be(this,n,h,u)};Be.prototype.toP=function(){if(this.isInfinity())return this.curve.point(null,null);var n=this.z.redInvm(),h=n.redSqr(),u=this.x.redMul(h),v=this.y.redMul(h).redMul(n);return this.curve.point(u,v)};Be.prototype.neg=function(){return this.curve.jpoint(this.x,this.y.redNeg(),this.z)};Be.prototype.add=function(n){if(this.isInfinity())return n;if(n.isInfinity())return this;var h=n.z.redSqr(),u=this.z.redSqr(),v=this.x.redMul(h),o=n.x.redMul(u),w=this.y.redMul(h.redMul(n.z)),y=n.y.redMul(u.redMul(this.z)),b=v.redSub(o),B=w.redSub(y);if(b.cmpn(0)===0)return B.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var k=b.redSqr(),L=k.redMul(b),q=v.redMul(k),$=B.redSqr().redIAdd(L).redISub(q).redISub(q),M=B.redMul(q.redISub($)).redISub(w.redMul(L)),N=this.z.redMul(n.z).redMul(b);return this.curve.jpoint($,M,N)};Be.prototype.mixedAdd=function(n){if(this.isInfinity())return n.toJ();if(n.isInfinity())return this;var h=this.z.redSqr(),u=this.x,v=n.x.redMul(h),o=this.y,w=n.y.redMul(h).redMul(this.z),y=u.redSub(v),b=o.redSub(w);if(y.cmpn(0)===0)return b.cmpn(0)!==0?this.curve.jpoint(null,null,null):this.dbl();var B=y.redSqr(),k=B.redMul(y),L=u.redMul(B),q=b.redSqr().redIAdd(k).redISub(L).redISub(L),$=b.redMul(L.redISub(q)).redISub(o.redMul(k)),M=this.z.redMul(y);return this.curve.jpoint(q,$,M)};Be.prototype.dblp=function(n){if(n===0)return this;if(this.isInfinity())return this;if(!n)return this.dbl();var h;if(this.curve.zeroA||this.curve.threeA){var u=this;for(h=0;h<n;h++)u=u.dbl();return u}var v=this.curve.a,o=this.curve.tinv,w=this.x,y=this.y,b=this.z,B=b.redSqr().redSqr(),k=y.redAdd(y);for(h=0;h<n;h++){var L=w.redSqr(),q=k.redSqr(),$=q.redSqr(),M=L.redAdd(L).redIAdd(L).redIAdd(v.redMul(B)),N=w.redMul(q),x=M.redSqr().redISub(N.redAdd(N)),A=N.redISub(x),S=M.redMul(A);S=S.redIAdd(S).redISub($);var T=k.redMul(b);h+1<n&&(B=B.redMul($)),w=x,b=T,k=S}return this.curve.jpoint(w,k.redMul(o),b)};Be.prototype.dbl=function(){return this.isInfinity()?this:this.curve.zeroA?this._zeroDbl():this.curve.threeA?this._threeDbl():this._dbl()};Be.prototype._zeroDbl=function(){var n,h,u;if(this.zOne){var v=this.x.redSqr(),o=this.y.redSqr(),w=o.redSqr(),y=this.x.redAdd(o).redSqr().redISub(v).redISub(w);y=y.redIAdd(y);var b=v.redAdd(v).redIAdd(v),B=b.redSqr().redISub(y).redISub(y),k=w.redIAdd(w);k=k.redIAdd(k),k=k.redIAdd(k),n=B,h=b.redMul(y.redISub(B)).redISub(k),u=this.y.redAdd(this.y)}else{var L=this.x.redSqr(),q=this.y.redSqr(),$=q.redSqr(),M=this.x.redAdd(q).redSqr().redISub(L).redISub($);M=M.redIAdd(M);var N=L.redAdd(L).redIAdd(L),x=N.redSqr(),A=$.redIAdd($);A=A.redIAdd(A),A=A.redIAdd(A),n=x.redISub(M).redISub(M),h=N.redMul(M.redISub(n)).redISub(A),u=this.y.redMul(this.z),u=u.redIAdd(u)}return this.curve.jpoint(n,h,u)};Be.prototype._threeDbl=function(){var n,h,u;if(this.zOne){var v=this.x.redSqr(),o=this.y.redSqr(),w=o.redSqr(),y=this.x.redAdd(o).redSqr().redISub(v).redISub(w);y=y.redIAdd(y);var b=v.redAdd(v).redIAdd(v).redIAdd(this.curve.a),B=b.redSqr().redISub(y).redISub(y);n=B;var k=w.redIAdd(w);k=k.redIAdd(k),k=k.redIAdd(k),h=b.redMul(y.redISub(B)).redISub(k),u=this.y.redAdd(this.y)}else{var L=this.z.redSqr(),q=this.y.redSqr(),$=this.x.redMul(q),M=this.x.redSub(L).redMul(this.x.redAdd(L));M=M.redAdd(M).redIAdd(M);var N=$.redIAdd($);N=N.redIAdd(N);var x=N.redAdd(N);n=M.redSqr().redISub(x),u=this.y.redAdd(this.z).redSqr().redISub(q).redISub(L);var A=q.redSqr();A=A.redIAdd(A),A=A.redIAdd(A),A=A.redIAdd(A),h=M.redMul(N.redISub(n)).redISub(A)}return this.curve.jpoint(n,h,u)};Be.prototype._dbl=function(){var n=this.curve.a,h=this.x,u=this.y,v=this.z,o=v.redSqr().redSqr(),w=h.redSqr(),y=u.redSqr(),b=w.redAdd(w).redIAdd(w).redIAdd(n.redMul(o)),B=h.redAdd(h);B=B.redIAdd(B);var k=B.redMul(y),L=b.redSqr().redISub(k.redAdd(k)),q=k.redISub(L),$=y.redSqr();$=$.redIAdd($),$=$.redIAdd($),$=$.redIAdd($);var M=b.redMul(q).redISub($),N=u.redAdd(u).redMul(v);return this.curve.jpoint(L,M,N)};Be.prototype.trpl=function(){if(!this.curve.zeroA)return this.dbl().add(this);var n=this.x.redSqr(),h=this.y.redSqr(),u=this.z.redSqr(),v=h.redSqr(),o=n.redAdd(n).redIAdd(n),w=o.redSqr(),y=this.x.redAdd(h).redSqr().redISub(n).redISub(v);y=y.redIAdd(y),y=y.redAdd(y).redIAdd(y),y=y.redISub(w);var b=y.redSqr(),B=v.redIAdd(v);B=B.redIAdd(B),B=B.redIAdd(B),B=B.redIAdd(B);var k=o.redIAdd(y).redSqr().redISub(w).redISub(b).redISub(B),L=h.redMul(k);L=L.redIAdd(L),L=L.redIAdd(L);var q=this.x.redMul(b).redISub(L);q=q.redIAdd(q),q=q.redIAdd(q);var $=this.y.redMul(k.redMul(B.redISub(k)).redISub(y.redMul(b)));$=$.redIAdd($),$=$.redIAdd($),$=$.redIAdd($);var M=this.z.redAdd(y).redSqr().redISub(u).redISub(b);return this.curve.jpoint(q,$,M)};Be.prototype.mul=function(n,h){return n=new _e(n,h),this.curve._wnafMul(this,n)};Be.prototype.eq=function(n){if(n.type==="affine")return this.eq(n.toJ());if(this===n)return!0;var h=this.z.redSqr(),u=n.z.redSqr();if(this.x.redMul(u).redISub(n.x.redMul(h)).cmpn(0)!==0)return!1;var v=h.redMul(this.z),o=u.redMul(n.z);return this.y.redMul(o).redISub(n.y.redMul(v)).cmpn(0)===0};Be.prototype.eqXToP=function(n){var h=this.z.redSqr(),u=n.toRed(this.curve.red).redMul(h);if(this.x.cmp(u)===0)return!0;for(var v=n.clone(),o=this.curve.redN.redMul(h);;){if(v.iadd(this.curve.n),v.cmp(this.curve.p)>=0)return!1;if(u.redIAdd(o),this.x.cmp(u)===0)return!0}};Be.prototype.inspect=function(){return this.isInfinity()?"<EC JPoint Infinity>":"<EC JPoint x: "+this.x.toString(16,2)+" y: "+this.y.toString(16,2)+" z: "+this.z.toString(16,2)+">"};Be.prototype.isInfinity=function(){return this.z.cmpn(0)===0};var Yr=dr,zs=cr,$n=Fn,Nc=Ke;function mi(a){$n.call(this,"mont",a),this.a=new Yr(a.a,16).toRed(this.red),this.b=new Yr(a.b,16).toRed(this.red),this.i4=new Yr(4).toRed(this.red).redInvm(),this.two=new Yr(2).toRed(this.red),this.a24=this.i4.redMul(this.a.redAdd(this.two))}zs(mi,$n);var qc=mi;mi.prototype.validate=function(n){var h=n.normalize().x,u=h.redSqr(),v=u.redMul(h).redAdd(u.redMul(this.a)).redAdd(h),o=v.redSqrt();return o.redSqr().cmp(v)===0};function ke(a,n,h){$n.BasePoint.call(this,a,"projective"),n===null&&h===null?(this.x=this.curve.one,this.z=this.curve.zero):(this.x=new Yr(n,16),this.z=new Yr(h,16),this.x.red||(this.x=this.x.toRed(this.curve.red)),this.z.red||(this.z=this.z.toRed(this.curve.red)))}zs(ke,$n.BasePoint);mi.prototype.decodePoint=function(n,h){return this.point(Nc.toArray(n,h),1)};mi.prototype.point=function(n,h){return new ke(this,n,h)};mi.prototype.pointFromJSON=function(n){return ke.fromJSON(this,n)};ke.prototype.precompute=function(){};ke.prototype._encode=function(){return this.getX().toArray("be",this.curve.p.byteLength())};ke.fromJSON=function(n,h){return new ke(n,h[0],h[1]||n.one)};ke.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"};ke.prototype.isInfinity=function(){return this.z.cmpn(0)===0};ke.prototype.dbl=function(){var n=this.x.redAdd(this.z),h=n.redSqr(),u=this.x.redSub(this.z),v=u.redSqr(),o=h.redSub(v),w=h.redMul(v),y=o.redMul(v.redAdd(this.curve.a24.redMul(o)));return this.curve.point(w,y)};ke.prototype.add=function(){throw new Error("Not supported on Montgomery curve")};ke.prototype.diffAdd=function(n,h){var u=this.x.redAdd(this.z),v=this.x.redSub(this.z),o=n.x.redAdd(n.z),w=n.x.redSub(n.z),y=w.redMul(u),b=o.redMul(v),B=h.z.redMul(y.redAdd(b).redSqr()),k=h.x.redMul(y.redISub(b).redSqr());return this.curve.point(B,k)};ke.prototype.mul=function(n){for(var h=n.clone(),u=this,v=this.curve.point(null,null),o=this,w=[];h.cmpn(0)!==0;h.iushrn(1))w.push(h.andln(1));for(var y=w.length-1;y>=0;y--)w[y]===0?(u=u.diffAdd(v,o),v=v.dbl()):(v=u.diffAdd(v,o),u=u.dbl());return v};ke.prototype.mulAdd=function(){throw new Error("Not supported on Montgomery curve")};ke.prototype.jumlAdd=function(){throw new Error("Not supported on Montgomery curve")};ke.prototype.eq=function(n){return this.getX().cmp(n.getX())===0};ke.prototype.normalize=function(){return this.x=this.x.redMul(this.z.redInvm()),this.z=this.curve.one,this};ke.prototype.getX=function(){return this.normalize(),this.x.fromRed()};var Uc=Ke,sr=dr,Ds=cr,zn=Fn,Fc=Uc.assert;function fr(a){this.twisted=(a.a|0)!==1,this.mOneA=this.twisted&&(a.a|0)===-1,this.extended=this.mOneA,zn.call(this,"edwards",a),this.a=new sr(a.a,16).umod(this.red.m),this.a=this.a.toRed(this.red),this.c=new sr(a.c,16).toRed(this.red),this.c2=this.c.redSqr(),this.d=new sr(a.d,16).toRed(this.red),this.dd=this.d.redAdd(this.d),Fc(!this.twisted||this.c.fromRed().cmpn(1)===0),this.oneC=(a.c|0)===1}Ds(fr,zn);var $c=fr;fr.prototype._mulA=function(n){return this.mOneA?n.redNeg():this.a.redMul(n)};fr.prototype._mulC=function(n){return this.oneC?n:this.c.redMul(n)};fr.prototype.jpoint=function(n,h,u,v){return this.point(n,h,u,v)};fr.prototype.pointFromX=function(n,h){n=new sr(n,16),n.red||(n=n.toRed(this.red));var u=n.redSqr(),v=this.c2.redSub(this.a.redMul(u)),o=this.one.redSub(this.c2.redMul(this.d).redMul(u)),w=v.redMul(o.redInvm()),y=w.redSqrt();if(y.redSqr().redSub(w).cmp(this.zero)!==0)throw new Error("invalid point");var b=y.fromRed().isOdd();return(h&&!b||!h&&b)&&(y=y.redNeg()),this.point(n,y)};fr.prototype.pointFromY=function(n,h){n=new sr(n,16),n.red||(n=n.toRed(this.red));var u=n.redSqr(),v=u.redSub(this.c2),o=u.redMul(this.d).redMul(this.c2).redSub(this.a),w=v.redMul(o.redInvm());if(w.cmp(this.zero)===0){if(h)throw new Error("invalid point");return this.point(this.zero,n)}var y=w.redSqrt();if(y.redSqr().redSub(w).cmp(this.zero)!==0)throw new Error("invalid point");return y.fromRed().isOdd()!==h&&(y=y.redNeg()),this.point(y,n)};fr.prototype.validate=function(n){if(n.isInfinity())return!0;n.normalize();var h=n.x.redSqr(),u=n.y.redSqr(),v=h.redMul(this.a).redAdd(u),o=this.c2.redMul(this.one.redAdd(this.d.redMul(h).redMul(u)));return v.cmp(o)===0};function be(a,n,h,u,v){zn.BasePoint.call(this,a,"projective"),n===null&&h===null&&u===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 sr(n,16),this.y=new sr(h,16),this.z=u?new sr(u,16):this.curve.one,this.t=v&&new sr(v,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()))))}Ds(be,zn.BasePoint);fr.prototype.pointFromJSON=function(n){return be.fromJSON(this,n)};fr.prototype.point=function(n,h,u,v){return new be(this,n,h,u,v)};be.fromJSON=function(n,h){return new be(n,h[0],h[1],h[2])};be.prototype.inspect=function(){return this.isInfinity()?"<EC Point Infinity>":"<EC Point x: "+this.x.fromRed().toString(16,2)+" y: "+this.y.fromRed().toString(16,2)+" z: "+this.z.fromRed().toString(16,2)+">"};be.prototype.isInfinity=function(){return this.x.cmpn(0)===0&&(this.y.cmp(this.z)===0||this.zOne&&this.y.cmp(this.curve.c)===0)};be.prototype._extDbl=function(){var n=this.x.redSqr(),h=this.y.redSqr(),u=this.z.redSqr();u=u.redIAdd(u);var v=this.curve._mulA(n),o=this.x.redAdd(this.y).redSqr().redISub(n).redISub(h),w=v.redAdd(h),y=w.redSub(u),b=v.redSub(h),B=o.redMul(y),k=w.redMul(b),L=o.redMul(b),q=y.redMul(w);return this.curve.point(B,k,q,L)};be.prototype._projDbl=function(){var n=this.x.redAdd(this.y).redSqr(),h=this.x.redSqr(),u=this.y.redSqr(),v,o,w,y,b,B;if(this.curve.twisted){y=this.curve._mulA(h);var k=y.redAdd(u);this.zOne?(v=n.redSub(h).redSub(u).redMul(k.redSub(this.curve.two)),o=k.redMul(y.redSub(u)),w=k.redSqr().redSub(k).redSub(k)):(b=this.z.redSqr(),B=k.redSub(b).redISub(b),v=n.redSub(h).redISub(u).redMul(B),o=k.redMul(y.redSub(u)),w=k.redMul(B))}else y=h.redAdd(u),b=this.curve._mulC(this.z).redSqr(),B=y.redSub(b).redSub(b),v=this.curve._mulC(n.redISub(y)).redMul(B),o=this.curve._mulC(y).redMul(h.redISub(u)),w=y.redMul(B);return this.curve.point(v,o,w)};be.prototype.dbl=function(){return this.isInfinity()?this:this.curve.extended?this._extDbl():this._projDbl()};be.prototype._extAdd=function(n){var h=this.y.redSub(this.x).redMul(n.y.redSub(n.x)),u=this.y.redAdd(this.x).redMul(n.y.redAdd(n.x)),v=this.t.redMul(this.curve.dd).redMul(n.t),o=this.z.redMul(n.z.redAdd(n.z)),w=u.redSub(h),y=o.redSub(v),b=o.redAdd(v),B=u.redAdd(h),k=w.redMul(y),L=b.redMul(B),q=w.redMul(B),$=y.redMul(b);return this.curve.point(k,L,$,q)};be.prototype._projAdd=function(n){var h=this.z.redMul(n.z),u=h.redSqr(),v=this.x.redMul(n.x),o=this.y.redMul(n.y),w=this.curve.d.redMul(v).redMul(o),y=u.redSub(w),b=u.redAdd(w),B=this.x.redAdd(this.y).redMul(n.x.redAdd(n.y)).redISub(v).redISub(o),k=h.redMul(y).redMul(B),L,q;return this.curve.twisted?(L=h.redMul(b).redMul(o.redSub(this.curve._mulA(v))),q=y.redMul(b)):(L=h.redMul(b).redMul(o.redSub(v)),q=this.curve._mulC(y).redMul(b)),this.curve.point(k,L,q)};be.prototype.add=function(n){return this.isInfinity()?n:n.isInfinity()?this:this.curve.extended?this._extAdd(n):this._projAdd(n)};be.prototype.mul=function(n){return this._hasDoubles(n)?this.curve._fixedNafMul(this,n):this.curve._wnafMul(this,n)};be.prototype.mulAdd=function(n,h,u){return this.curve._wnafMulAdd(1,[this,h],[n,u],2,!1)};be.prototype.jmulAdd=function(n,h,u){return this.curve._wnafMulAdd(1,[this,h],[n,u],2,!0)};be.prototype.normalize=function(){if(this.zOne)return this;var n=this.z.redInvm();return this.x=this.x.redMul(n),this.y=this.y.redMul(n),this.t&&(this.t=this.t.redMul(n)),this.z=this.curve.one,this.zOne=!0,this};be.prototype.neg=function(){return this.curve.point(this.x.redNeg(),this.y,this.z,this.t&&this.t.redNeg())};be.prototype.getX=function(){return this.normalize(),this.x.fromRed()};be.prototype.getY=function(){return this.normalize(),this.y.fromRed()};be.prototype.eq=function(n){return this===n||this.getX().cmp(n.getX())===0&&this.getY().cmp(n.getY())===0};be.prototype.eqXToP=function(n){var h=n.toRed(this.curve.red).redMul(this.z);if(this.x.cmp(h)===0)return!0;for(var u=n.clone(),v=this.curve.redN.redMul(this.z);;){if(u.iadd(this.curve.n),u.cmp(this.curve.p)>=0)return!1;if(h.redIAdd(v),this.x.cmp(h)===0)return!0}};be.prototype.toP=be.prototype.normalize;be.prototype.mixedAdd=be.prototype.add;(function(a){var n=a;n.base=Fn,n.short=Oc,n.mont=qc,n.edwards=$c})(io);var Dn={},Ta,m0;function zc(){return m0||(m0=1,Ta={doubles:{step:4,points:[["e60fce93b59e9ec53011aabc21c23e97b2a31369b87a5ae9c44ee89e2a6dec0a","f7e3507399e595929db99f34f57937101296891e44d23f0be1f32cce69616821"],["8282263212c609d9ea2a6e3e172de238d8c39cabd5ac1ca10646e23fd5f51508","11f8a8098557dfe45e8256e830b60ace62d613ac2f7b17bed31b6eaff6e26caf"],["175e159f728b865a72f99cc6c6fc846de0b93833fd2222ed73fce5b551e5b739","d3506e0d9e3c79eba4ef97a51ff71f5eacb5955add24345c6efa6ffee9fed695"],["363d90d447b00c9c99ceac05b6262ee053441c7e55552ffe526bad8f83ff4640","4e273adfc732221953b445397f3363145b9a89008199ecb62003c7f3bee9de9"],["8b4b5f165df3c2be8c6244b5b745638843e4a781a15bcd1b69f79a55dffdf80c","4aad0a6f68d308b4b3fbd7813ab0da04f9e336546162ee56b3eff0c65fd4fd36"],["723cbaa6e5db996d6bf771c00bd548c7b700dbffa6c0e77bcb6115925232fcda","96e867b5595cc498a921137488824d6e2660a0653779494801dc069d9eb39f5f"],["eebfa4d493bebf98ba5feec812c2d3b50947961237a919839a533eca0e7dd7fa","5d9a8ca3970ef0f269ee7edaf178089d9ae4cdc3a711f712ddfd4fdae1de8999"],["100f44da696e71672791d0a09b7bde459f1215a29b3c03bfefd7835b39a48db0","cdd9e13192a00b772ec8f3300c090666b7ff4a18ff5195ac0fbd5cd62bc65a09"],["e1031be262c7ed1b1dc9227a4a04c017a77f8d4464f3b3852c8acde6e534fd2d","9d7061928940405e6bb6a4176597535af292dd419e1ced79a44f18f29456a00d"],["feea6cae46d55b530ac2839f143bd7ec5cf8b266a41d6af52d5e688d9094696d","e57c6b6c97dce1bab06e4e12bf3ecd5c981c8957cc41442d3155debf18090088"],["da67a91d91049cdcb367be4be6ffca3cfeed657d808583de33fa978bc1ec6cb1","9bacaa35481642bc41f463f7ec9780e5dec7adc508f740a17e9ea8e27a68be1d"],["53904faa0b334cdda6e000935ef22151ec08d0f7bb11069f57545ccc1a37b7c0","5bc087d0bc80106d88c9eccac20d3c1c13999981e14434699dcb096b022771c8"],["8e7bcd0bd35983a7719cca7764ca906779b53a043a9b8bcaeff959f43ad86047","10b7770b2a3da4b3940310420ca9514579e88e2e47fd68b3ea10047e8460372a"],["385eed34c1cdff21e6d0818689b81bde71a7f4f18397e6690a841e1599c43862","283bebc3e8ea23f56701de19e9ebf4576b304eec2086dc8cc0458fe5542e5453"],["6f9d9b803ecf191637c73a4413dfa180fddf84a5947fbc9c606ed86c3fac3a7","7c80c68e603059ba69b8e2a30e45c4d47ea4dd2f5c281002d86890603a842160"],["3322d401243c4e2582a2147c104d6ecbf774d163db0f5e5313b7e0e742d0e6bd","56e70797e9664ef5bfb019bc4ddaf9b72805f63ea2873af624f3a2e96c28b2a0"],["85672c7d2de0b7da2bd1770d89665868741b3f9af7643397721d74d28134ab83","7c481b9b5b43b2eb6374049bfa62c2e5e77f17fcc5298f44c8e3094f790313a6"],["948bf809b1988a46b06c9f1919413b10f9226c60f668832ffd959af60c82a0a","53a562856dcb6646dc6b74c5d1c3418c6d4dff08c97cd2bed4cb7f88d8c8e589"],["6260ce7f461801c34f067ce0f02873a8f1b0e44dfc69752accecd819f38fd8e8","bc2da82b6fa5b571a7f09049776a1ef7ecd292238051c198c1a84e95b2b4ae17"],["e5037de0afc1d8d43d8348414bbf4103043ec8f575bfdc432953cc8d2037fa2d","4571534baa94d3b5f9f98d09fb990bddbd5f5b03ec481f10e0e5dc841d755bda"],["e06372b0f4a207adf5ea905e8f1771b4e7e8dbd1c6a6c5b725866a0ae4fce725","7a908974bce18cfe12a27bb2ad5a488cd7484a7787104870b27034f94eee31dd"],["213c7a715cd5d45358d0bbf9dc0ce02204b10bdde2a3f58540ad6908d0559754","4b6dad0b5ae462507013ad06245ba190bb4850f5f36a7eeddff2c27534b458f2"],["4e7c272a7af4b34e8dbb9352a5419a87e2838c70adc62cddf0cc3a3b08fbd53c","17749c766c9d0b18e16fd09f6def681b530b9614bff7dd33e0b3941817dcaae6"],["fea74e3dbe778b1b10f238ad61686aa5c76e3db2be43057632427e2840fb27b6","6e0568db9b0b13297cf674deccb6af93126b596b973f7b77701d3db7f23cb96f"],["76e64113f677cf0e10a2570d599968d31544e179b760432952c02a4417bdde39","c90ddf8dee4e95cf577066d70681f0d35e2a33d2b56d2032b4b1752d1901ac01"],["c738c56b03b2abe1e8281baa743f8f9a8f7cc643df26cbee3ab150242bcbb891","893fb578951ad2537f718f2eacbfbbbb82314eef7880cfe917e735d9699a84c3"],["d895626548b65b81e264c7637c972877d1d72e5f3a925014372e9f6588f6c14b","febfaa38f2bc7eae728ec60818c340eb03428d632bb067e179363ed75d7d991f"],["b8da94032a957518eb0f6433571e8761ceffc73693e84edd49150a564f676e03","2804dfa44805a1e4d7c99cc9762808b092cc584d95ff3b511488e4e74efdf6e7"],["e80fea14441fb33a7d8adab9475d7fab2019effb5156a792f1a11778e3c0df5d","eed1de7f638e00771e89768ca3ca94472d155e80af322ea9fcb4291b6ac9ec78"],["a301697bdfcd704313ba48e51d567543f2a182031efd6915ddc07bbcc4e16070","7370f91cfb67e4f5081809fa25d40f9b1735dbf7c0a11a130c0d1a041e177ea1"],["90ad85b389d6b936463f9d0512678de208cc330b11307fffab7ac63e3fb04ed4","e507a3620a38261affdcbd9427222b839aefabe1582894d991d4d48cb6ef150"],["8f68b9d2f63b5f339239c1ad981f162ee88c5678723ea3351b7b444c9ec4c0da","662a9f2dba063986de1d90c2b6be215dbbea2cfe95510bfdf23cbf79501fff82"],["e4f3fb0176af85d65ff99ff9198c36091f48e86503681e3e6686fd5053231e11","1e63633ad0ef4f1c1661a6d0ea02b7286cc7e74ec951d1c9822c38576feb73bc"],["8c00fa9b18ebf331eb961537a45a4266c7034f2f0d4e1d0716fb6eae20eae29e","efa47267fea521a1a9dc343a3736c974c2fadafa81e36c54e7d2a4c66702414b"],["e7a26ce69dd4829f3e10cec0a9e98ed3143d084f308b92c0997fddfc60cb3e41","2a758e300fa7984b471b006a1aafbb18d0a6b2c0420e83e20e8a9421cf2cfd51"],["b6459e0ee3662ec8d23540c223bcbdc571cbcb967d79424f3cf29eb3de6b80ef","67c876d06f3e06de1dadf16e5661db3c4b3ae6d48e35b2ff30bf0b61a71ba45"],["d68a80c8280bb840793234aa118f06231d6f1fc67e73c5a5deda0f5b496943e8","db8ba9fff4b586d00c4b1f9177b0e28b5b0e7b8f7845295a294c84266b133120"],["324aed7df65c804252dc0270907a30b09612aeb973449cea4095980fc28d3d5d","648a365774b61f2ff130c0c35aec1f4f19213b0c7e332843967224af96ab7c84"],["4df9c14919cde61f6d51dfdbe5fee5dceec4143ba8d1ca888e8bd373fd054c96","35ec51092d8728050974c23a1d85d4b5d506cdc288490192ebac06cad10d5d"],["9c3919a84a474870faed8a9c1cc66021523489054d7f0308cbfc99c8ac1f98cd","ddb84f0f4a4ddd57584f044bf260e641905326f76c64c8e6be7e5e03d4fc599d"],["6057170b1dd12fdf8de05f281d8e06bb91e1493a8b91d4cc5a21382120a959e5","9a1af0b26a6a4807add9a2daf71df262465152bc3ee24c65e899be932385a2a8"],["a576df8e23a08411421439a4518da31880cef0fba7d4df12b1a6973eecb94266","40a6bf20e76640b2c92b97afe58cd82c432e10a7f514d9f3ee8be11ae1b28ec8"],["7778a78c28dec3e30a05fe9629de8c38bb30d1f5cf9a3a208f763889be58ad71","34626d9ab5a5b22ff7098e12f2ff580087b38411ff24ac563b513fc1fd9f43ac"],["928955ee637a84463729fd30e7afd2ed5f96274e5ad7e5cb09eda9c06d903ac","c25621003d3f42a827b78a13093a95eeac3d26efa8a8d83fc5180e935bcd091f"],["85d0fef3ec6db109399064f3a0e3b2855645b4a907ad354527aae75163d82751","1f03648413a38c0be29d496e582cf5663e8751e96877331582c237a24eb1f962"],["ff2b0dce97eece97c1c9b6041798b85dfdfb6d8882da20308f5404824526087e","493d13fef524ba188af4c4dc54d07936c7b7ed6fb90e2ceb2c951e01f0c29907"],["827fbbe4b1e880ea9ed2b2e6301b212b57f1ee148cd6dd28780e5e2cf856e241","c60f9c923c727b0b71bef2c67d1d12687ff7a63186903166d605b68baec293ec"],["eaa649f21f51bdbae7be4ae34ce6e5217a58fdce7f47f9aa7f3b58fa2120e2b3","be3279ed5bbbb03ac69a80f89879aa5a01a6b965f13f7e59d47a5305ba5ad93d"],["e4a42d43c5cf169d9391df6decf42ee541b6d8f0c9a137401e23632dda34d24f","4d9f92e716d1c73526fc99ccfb8ad34ce886eedfa8d8e4f13a7f7131deba9414"],["1ec80fef360cbdd954160fadab352b6b92b53576a88fea4947173b9d4300bf19","aeefe93756b5340d2f3a4958a7abbf5e0146e77f6295a07b671cdc1cc107cefd"],["146a778c04670c2f91b00af4680dfa8bce3490717d58ba889ddb5928366642be","b318e0ec3354028add669827f9d4b2870aaa971d2f7e5ed1d0b297483d83efd0"],["fa50c0f61d22e5f07e3acebb1aa07b128d0012209a28b9776d76a8793180eef9","6b84c6922397eba9b72cd2872281a68a5e683293a57a213b38cd8d7d3f4f2811"],["da1d61d0ca721a11b1a5bf6b7d88e8421a288ab5d5bba5220e53d32b5f067ec2","8157f55a7c99306c79c0766161c91e2966a73899d279b48a655fba0f1ad836f1"],["a8e282ff0c9706907215ff98e8fd416615311de0446f1e062a73b0610d064e13","7f97355b8db81c09abfb7f3c5b2515888b679a3e50dd6bd6cef7c73111f4cc0c"],["174a53b9c9a285872d39e56e6913cab15d59b1fa512508c022f382de8319497c","ccc9dc37abfc9c1657b4155f2c47f9e6646b3a1d8cb9854383da13ac079afa73"],["959396981943785c3d3e57edf5018cdbe039e730e4918b3d884fdff09475b7ba","2e7e552888c331dd8ba0386a4b9cd6849c653f64c8709385e9b8abf87524f2fd"],["d2a63a50ae401e56d645a1153b109a8fcca0a43d561fba2dbb51340c9d82b151","e82d86fb6443fcb7565aee58b2948220a70f750af484ca52d4142174dcf89405"],["64587e2335471eb890ee7896d7cfdc866bacbdbd3839317b3436f9b45617e073","d99fcdd5bf6902e2ae96dd6447c299a185b90a39133aeab358299e5e9faf6589"],["8481bde0e4e4d885b3a546d3e549de042f0aa6cea250e7fd358d6c86dd45e458","38ee7b8cba5404dd84a25bf39cecb2ca900a79c42b262e556d64b1b59779057e"],["13464a57a78102aa62b6979ae817f4637ffcfed3c4b1ce30bcd6303f6caf666b","69be159004614580ef7e433453ccb0ca48f300a81d0942e13f495a907f6ecc27"],["bc4a9df5b713fe2e9aef430bcc1dc97a0cd9ccede2f28588cada3a0d2d83f366","d3a81ca6e785c06383937adf4b798caa6e8a9fbfa547b16d758d666581f33c1"],["8c28a97bf8298bc0d23d8c749452a32e694b65e30a9472a3954ab30fe5324caa","40a30463a3305193378fedf31f7cc0eb7ae784f0451cb9459e71dc73cbef9482"],["8ea9666139527a8c1dd94ce4f071fd23c8b350c5a4bb33748c4ba111faccae0","620efabbc8ee2782e24e7c0cfb95c5d735b783be9cf0f8e955af34a30e62b945"],["dd3625faef5ba06074669716bbd3788d89bdde815959968092f76cc4eb9a9787","7a188fa3520e30d461da2501045731ca941461982883395937f68d00c644a573"],["f710d79d9eb962297e4f6232b40e8f7feb2bc63814614d692c12de752408221e","ea98e67232d3b3295d3b535532115ccac8612c721851617526ae47a9c77bfc82"]]},naf:{wnd:7,points:[["f9308a019258c31049344f85f89d5229b531c845836f99b08601f113bce036f9","388f7b0f632de8140fe337e62a37f3566500a99934c2231b6cb9fd7584b8e672"],["2f8bde4d1a07209355b4a7250a5c5128e88b84bddc619ab7cba8d569b240efe4","d8ac222636e5e3d6d4dba9dda6c9c426f788271bab0d6840dca87d3aa6ac62d6"],["5cbdf0646e5db4eaa398f365f2ea7a0e3d419b7e0330e39ce92bddedcac4f9bc","6aebca40ba255960a3178d6d861a54dba813d0b813fde7b5a5082628087264da"],["acd484e2f0c7f65309ad178a9f559abde09796974c57e714c35f110dfc27ccbe","cc338921b0a7d9fd64380971763b61e9add888a4375f8e0f05cc262ac64f9c37"],["774ae7f858a9411e5ef4246b70c65aac5649980be5c17891bbec17895da008cb","d984a032eb6b5e190243dd56d7b7b365372db1e2dff9d6a8301d74c9c953c61b"],["f28773c2d975288bc7d1d205c3748651b075fbc6610e58cddeeddf8f19405aa8","ab0902e8d880a89758212eb65cdaf473a1a06da521fa91f29b5cb52db03ed81"],["d7924d4f7d43ea965a465ae3095ff41131e5946f3c85f79e44adbcf8e27e080e","581e2872a86c72a683842ec228cc6defea40af2bd896d3a5c504dc9ff6a26b58"],["defdea4cdb677750a420fee807eacf21eb9898ae79b9768766e4faa04a2d4a34","4211ab0694635168e997b0ead2a93daeced1f4a04a95c0f6cfb199f69e56eb77"],["2b4ea0a797a443d293ef5cff444f4979f06acfebd7e86d277475656138385b6c","85e89bc037945d93b343083b5a1c86131a01f60c50269763b570c854e5c09b7a"],["352bbf4a4cdd12564f93fa332ce333301d9ad40271f8107181340aef25be59d5","321eb4075348f534d59c18259dda3e1f4a1b3b2e71b1039c67bd3d8bcf81998c"],["2fa2104d6b38d11b0230010559879124e42ab8dfeff5ff29dc9cdadd4ecacc3f","2de1068295dd865b64569335bd5dd80181d70ecfc882648423ba76b532b7d67"],["9248279b09b4d68dab21a9b066edda83263c3d84e09572e269ca0cd7f5453714","73016f7bf234aade5d1aa71bdea2b1ff3fc0de2a887912ffe54a32ce97cb3402"],["daed4f2be3a8bf278e70132fb0beb7522f570e144bf615c07e996d443dee8729","a69dce4a7d6c98e8d4a1aca87ef8d7003f83c230f3afa726ab40e52290be1c55"],["c44d12c7065d812e8acf28d7cbb19f9011ecd9e9fdf281b0e6a3b5e87d22e7db","2119a460ce326cdc76c45926c982fdac0e106e861edf61c5a039063f0e0e6482"],["6a245bf6dc698504c89a20cfded60853152b695336c28063b61c65cbd269e6b4","e022cf42c2bd4a708b3f5126f16a24ad8b33ba48d0423b6efd5e6348100d8a82"],["1697ffa6fd9de627c077e3d2fe541084ce13300b0bec1146f95ae57f0d0bd6a5","b9c398f186806f5d27561506e4557433a2cf15009e498ae7adee9d63d01b2396"],["605bdb019981718b986d0f07e834cb0d9deb8360ffb7f61df982345ef27a7479","2972d2de4f8d20681a78d93ec96fe23c26bfae84fb14db43b01e1e9056b8c49"],["62d14dab4150bf497402fdc45a215e10dcb01c354959b10cfe31c7e9d87ff33d","80fc06bd8cc5b01098088a1950eed0db01aa132967ab472235f5642483b25eaf"],["80c60ad0040f27dade5b4b06c408e56b2c50e9f56b9b8b425e555c2f86308b6f","1c38303f1cc5c30f26e66bad7fe72f70a65eed4cbe7024eb1aa01f56430bd57a"],["7a9375ad6167ad54aa74c6348cc54d344cc5dc9487d847049d5eabb0fa03c8fb","d0e3fa9eca8726909559e0d79269046bdc59ea10c70ce2b02d499ec224dc7f7"],["d528ecd9b696b54c907a9ed045447a79bb408ec39b68df504bb51f459bc3ffc9","eecf41253136e5f99966f21881fd656ebc4345405c520dbc063465b521409933"],["49370a4b5f43412ea25f514e8ecdad05266115e4a7ecb1387231808f8b45963","758f3f41afd6ed428b3081b0512fd62a54c3f3afbb5b6764b653052a12949c9a"],["77f230936ee88cbbd73df930d64702ef881d811e0e1498e2f1c13eb1fc345d74","958ef42a7886b6400a08266e9ba1b37896c95330d97077cbbe8eb3c7671c60d6"],["f2dac991cc4ce4b9ea44887e5c7c0bce58c80074ab9d4dbaeb28531b7739f530","e0dedc9b3b2f8dad4da1f32dec2531df9eb5fbeb0598e4fd1a117dba703a3c37"],["463b3d9f662621fb1b4be8fbbe2520125a216cdfc9dae3debcba4850c690d45b","5ed430d78c296c3543114306dd8622d7c622e27c970a1de31cb377b01af7307e"],["f16f804244e46e2a09232d4aff3b59976b98fac14328a2d1a32496b49998f247","cedabd9b82203f7e13d206fcdf4e33d92a6c53c26e5cce26d6579962c4e31df6"],["caf754272dc84563b0352b7a14311af55d245315ace27c65369e15f7151d41d1","cb474660ef35f5f2a41b643fa5e460575f4fa9b7962232a5c32f908318a04476"],["2600ca4b282cb986f85d0f1709979d8b44a09c07cb86d7c124497bc86f082120","4119b88753c15bd6a693b03fcddbb45d5ac6be74ab5f0ef44b0be9475a7e4b40"],["7635ca72d7e8432c338ec53cd12220bc01c48685e24f7dc8c602a7746998e435","91b649609489d613d1d5e590f78e6d74ecfc061d57048bad9e76f302c5b9c61"],["754e3239f325570cdbbf4a87deee8a66b7f2b33479d468fbc1a50743bf56cc18","673fb86e5bda30fb3cd0ed304ea49a023ee33d0197a695d0c5d98093c536683"],["e3e6bd1071a1e96aff57859c82d570f0330800661d1c952f9fe2694691d9b9e8","59c9e0bba394e76f40c0aa58379a3cb6a5a2283993e90c4167002af4920e37f5"],["186b483d056a033826ae73d88f732985c4ccb1f32ba35f4b4cc47fdcf04aa6eb","3b952d32c67cf77e2e17446e204180ab21fb8090895138b4a4a797f86e80888b"],["df9d70a6b9876ce544c98561f4be4f725442e6d2b737d9c91a8321724ce0963f","55eb2dafd84d6ccd5f862b785dc39d4ab157222720ef9da217b8c45cf2ba2417"],["5edd5cc23c51e87a497ca815d5dce0f8ab52554f849ed8995de64c5f34ce7143","efae9c8dbc14130661e8cec030c89ad0c13c66c0d17a2905cdc706ab7399a868"],["290798c2b6476830da12fe02287e9e777aa3fba1c355b17a722d362f84614fba","e38da76dcd440621988d00bcf79af25d5b29c094db2a23146d003afd41943e7a"],["af3c423a95d9f5b3054754efa150ac39cd29552fe360257362dfdecef4053b45","f98a3fd831eb2b749a93b0e6f35cfb40c8cd5aa667a15581bc2feded498fd9c6"],["766dbb24d134e745cccaa28c99bf274906bb66b26dcf98df8d2fed50d884249a","744b1152eacbe5e38dcc887980da38b897584a65fa06cedd2c924f97cbac5996"],["59dbf46f8c94759ba21277c33784f41645f7b44f6c596a58ce92e666191abe3e","c534ad44175fbc300f4ea6ce648309a042ce739a7919798cd85e216c4a307f6e"],["f13ada95103c4537305e691e74e9a4a8dd647e711a95e73cb62dc6018cfd87b8","e13817b44ee14de663bf4bc808341f326949e21a6a75c2570778419bdaf5733d"],["7754b4fa0e8aced06d4167a2c59cca4cda1869c06ebadfb6488550015a88522c","30e93e864e669d82224b967c3020b8fa8d1e4e350b6cbcc537a48b57841163a2"],["948dcadf5990e048aa3874d46abef9d701858f95de8041d2a6828c99e2262519","e491a42537f6e597d5d28a3224b1bc25df9154efbd2ef1d2cbba2cae5347d57e"],["7962414450c76c1689c7b48f8202ec37fb224cf5ac0bfa1570328a8a3d7c77ab","100b610ec4ffb4760d5c1fc133ef6f6b12507a051f04ac5760afa5b29db83437"],["3514087834964b54b15b160644d915485a16977225b8847bb0dd085137ec47ca","ef0afbb2056205448e1652c48e8127fc6039e77c15c2378b7e7d15a0de293311"],["d3cc30ad6b483e4bc79ce2c9dd8bc54993e947eb8df787b442943d3f7b527eaf","8b378a22d827278d89c5e9be8f9508ae3c2ad46290358630afb34db04eede0a4"],["1624d84780732860ce1c78fcbfefe08b2b29823db913f6493975ba0ff4847610","68651cf9b6da903e0914448c6cd9d4ca896878f5282be4c8cc06e2a404078575"],["733ce80da955a8a26902c95633e62a985192474b5af207da6df7b4fd5fc61cd4","f5435a2bd2badf7d485a4d8b8db9fcce3e1ef8e0201e4578c54673bc1dc5ea1d"],["15d9441254945064cf1a1c33bbd3b49f8966c5092171e699ef258dfab81c045c","d56eb30b69463e7234f5137b73b84177434800bacebfc685fc37bbe9efe4070d"],["a1d0fcf2ec9de675b612136e5ce70d271c21417c9d2b8aaaac138599d0717940","edd77f50bcb5a3cab2e90737309667f2641462a54070f3d519212d39c197a629"],["e22fbe15c0af8ccc5780c0735f84dbe9a790badee8245c06c7ca37331cb36980","a855babad5cd60c88b430a69f53a1a7a38289154964799be43d06d77d31da06"],["311091dd9860e8e20ee13473c1155f5f69635e394704eaa74009452246cfa9b3","66db656f87d1f04fffd1f04788c06830871ec5a64feee685bd80f0b1286d8374"],["34c1fd04d301be89b31c0442d3e6ac24883928b45a9340781867d4232ec2dbdf","9414685e97b1b5954bd46f730174136d57f1ceeb487443dc5321857ba73abee"],["f219ea5d6b54701c1c14de5b557eb42a8d13f3abbcd08affcc2a5e6b049b8d63","4cb95957e83d40b0f73af4544cccf6b1f4b08d3c07b27fb8d8c2962a400766d1"],["d7b8740f74a8fbaab1f683db8f45de26543a5490bca627087236912469a0b448","fa77968128d9c92ee1010f337ad4717eff15db5ed3c049b3411e0315eaa4593b"],["32d31c222f8f6f0ef86f7c98d3a3335ead5bcd32abdd94289fe4d3091aa824bf","5f3032f5892156e39ccd3d7915b9e1da2e6dac9e6f26e961118d14b8462e1661"],["7461f371914ab32671045a155d9831ea8793d77cd59592c4340f86cbc18347b5","8ec0ba238b96bec0cbdddcae0aa442542eee1ff50c986ea6b39847b3cc092ff6"],["ee079adb1df1860074356a25aa38206a6d716b2c3e67453d287698bad7b2b2d6","8dc2412aafe3be5c4c5f37e0ecc5f9f6a446989af04c4e25ebaac479ec1c8c1e"],["16ec93e447ec83f0467b18302ee620f7e65de331874c9dc72bfd8616ba9da6b5","5e4631150e62fb40d0e8c2a7ca5804a39d58186a50e497139626778e25b0674d"],["eaa5f980c245f6f038978290afa70b6bd8855897f98b6aa485b96065d537bd99","f65f5d3e292c2e0819a528391c994624d784869d7e6ea67fb18041024edc07dc"],["78c9407544ac132692ee1910a02439958ae04877151342ea96c4b6b35a49f51","f3e0319169eb9b85d5404795539a5e68fa1fbd583c064d2462b675f194a3ddb4"],["494f4be219a1a77016dcd838431aea0001cdc8ae7a6fc688726578d9702857a5","42242a969283a5f339ba7f075e36ba2af925ce30d767ed6e55f4b031880d562c"],["a598a8030da6d86c6bc7f2f5144ea549d28211ea58faa70ebf4c1e665c1fe9b5","204b5d6f84822c307e4b4a7140737aec23fc63b65b35f86a10026dbd2d864e6b"],["c41916365abb2b5d09192f5f2dbeafec208f020f12570a184dbadc3e58595997","4f14351d0087efa49d245b328984989d5caf9450f34bfc0ed16e96b58fa9913"],["841d6063a586fa475a724604da03bc5b92a2e0d2e0a36acfe4c73a5514742881","73867f59c0659e81904f9a1c7543698e62562d6744c169ce7a36de01a8d6154"],["5e95bb399a6971d376026947f89bde2f282b33810928be4ded112ac4d70e20d5","39f23f366809085beebfc71181313775a99c9aed7d8ba38b161384c746012865"],["36e4641a53948fd476c39f8a99fd974e5ec07564b5315d8bf99471bca0ef2f66","d2424b1b1abe4eb8164227b085c9aa9456ea13493fd563e06fd51cf5694c78fc"],["336581ea7bfbbb290c191a2f507a41cf5643842170e914faeab27c2c579f726","ead12168595fe1be99252129b6e56b3391f7ab1410cd1e0ef3dcdcabd2fda224"],["8ab89816dadfd6b6a1f2634fcf00ec8403781025ed6890c4849742706bd43ede","6fdcef09f2f6d0a044e654aef624136f503d459c3e89845858a47a9129cdd24e"],["1e33f1a746c9c5778133344d9299fcaa20b0938e8acff2544bb40284b8c5fb94","60660257dd11b3aa9c8ed618d24edff2306d320f1d03010e33a7d2057f3b3b6"],["85b7c1dcb3cec1b7ee7f30ded79dd20a0ed1f4cc18cbcfcfa410361fd8f08f31","3d98a9cdd026dd43f39048f25a8847f4fcafad1895d7a633c6fed3c35e999511"],["29df9fbd8d9e46509275f4b125d6d45d7fbe9a3b878a7af872a2800661ac5f51","b4c4fe99c775a606e2d8862179139ffda61dc861c019e55cd2876eb2a27d84b"],["a0b1cae06b0a847a3fea6e671aaf8adfdfe58ca2f768105c8082b2e449fce252","ae434102edde0958ec4b19d917a6a28e6b72da1834aff0e650f049503a296cf2"],["4e8ceafb9b3e9a136dc7ff67e840295b499dfb3b2133e4ba113f2e4c0e121e5","cf2174118c8b6d7a4b48f6d534ce5c79422c086a63460502b827ce62a326683c"],["d24a44e047e19b6f5afb81c7ca2f69080a5076689a010919f42725c2b789a33b","6fb8d5591b466f8fc63db50f1c0f1c69013f996887b8244d2cdec417afea8fa3"],["ea01606a7a6c9cdd249fdfcfacb99584001edd28abbab77b5104e98e8e3b35d4","322af4908c7312b0cfbfe369f7a7b3cdb7d4494bc2823700cfd652188a3ea98d"],["af8addbf2b661c8a6c6328655eb96651252007d8c5ea31be4ad196de8ce2131f","6749e67c029b85f52a034eafd096836b2520818680e26ac8f3dfbcdb71749700"],["e3ae1974566ca06cc516d47e0fb165a674a3dabcfca15e722f0e3450f45889","2aeabe7e4531510116217f07bf4d07300de97e4874f81f533420a72eeb0bd6a4"],["591ee355313d99721cf6993ffed1e3e301993ff3ed258802075ea8ced397e246","b0ea558a113c30bea60fc4775460c7901ff0b053d25ca2bdeee98f1a4be5d196"],["11396d55fda54c49f19aa97318d8da61fa8584e47b084945077cf03255b52984","998c74a8cd45ac01289d5833a7beb4744ff536b01b257be4c5767bea93ea57a4"],["3c5d2a1ba39c5a1790000738c9e0c40b8dcdfd5468754b6405540157e017aa7a","b2284279995a34e2f9d4de7396fc18b80f9b8b9fdd270f6661f79ca4c81bd257"],["cc8704b8a60a0defa3a99a7299f2e9c3fbc395afb04ac078425ef8a1793cc030","bdd46039feed17881d1e0862db347f8cf395b74fc4bcdc4e940b74e3ac1f1b13"],["c533e4f7ea8555aacd9777ac5cad29b97dd4defccc53ee7ea204119b2889b197","6f0a256bc5efdf429a2fb6242f1a43a2d9b925bb4a4b3a26bb8e0f45eb596096"],["c14f8f2ccb27d6f109f6d08d03cc96a69ba8c34eec07bbcf566d48e33da6593","c359d6923bb398f7fd4473e16fe1c28475b740dd098075e6c0e8649113dc3a38"],["a6cbc3046bc6a450bac24789fa17115a4c9739ed75f8f21ce441f72e0b90e6ef","21ae7f4680e889bb130619e2c0f95a360ceb573c70603139862afd617fa9b9f"],["347d6d9a02c48927ebfb86c1359b1caf130a3c0267d11ce6344b39f99d43cc38","60ea7f61a353524d1c987f6ecec92f086d565ab687870cb12689ff1e31c74448"],["da6545d2181db8d983f7dcb375ef5866d47c67b1bf31c8cf855ef7437b72656a","49b96715ab6878a79e78f07ce5680c5d6673051b4935bd897fea824b77dc208a"],["c40747cc9d012cb1a13b8148309c6de7ec25d6945d657146b9d5994b8feb1111","5ca560753be2a12fc6de6caf2cb489565db936156b9514e1bb5e83037e0fa2d4"],["4e42c8ec82c99798ccf3a610be870e78338c7f713348bd34c8203ef4037f3502","7571d74ee5e0fb92a7a8b33a07783341a5492144cc54bcc40a94473693606437"],["3775ab7089bc6af823aba2e1af70b236d251cadb0c86743287522a1b3b0dedea","be52d107bcfa09d8bcb9736a828cfa7fac8db17bf7a76a2c42ad961409018cf7"],["cee31cbf7e34ec379d94fb814d3d775ad954595d1314ba8846959e3e82f74e26","8fd64a14c06b589c26b947ae2bcf6bfa0149ef0be14ed4d80f448a01c43b1c6d"],["b4f9eaea09b6917619f6ea6a4eb5464efddb58fd45b1ebefcdc1a01d08b47986","39e5c9925b5a54b07433a4f18c61726f8bb131c012ca542eb24a8ac07200682a"],["d4263dfc3d2df923a0179a48966d30ce84e2515afc3dccc1b77907792ebcc60e","62dfaf07a0f78feb30e30d6295853ce189e127760ad6cf7fae164e122a208d54"],["48457524820fa65a4f8d35eb6930857c0032acc0a4a2de422233eeda897612c4","25a748ab367979d98733c38a1fa1c2e7dc6cc07db2d60a9ae7a76aaa49bd0f77"],["dfeeef1881101f2cb11644f3a2afdfc2045e19919152923f367a1767c11cceda","ecfb7056cf1de042f9420bab396793c0c390bde74b4bbdff16a83ae09a9a7517"],["6d7ef6b17543f8373c573f44e1f389835d89bcbc6062ced36c82df83b8fae859","cd450ec335438986dfefa10c57fea9bcc521a0959b2d80bbf74b190dca712d10"],["e75605d59102a5a2684500d3b991f2e3f3c88b93225547035af25af66e04541f","f5c54754a8f71ee540b9b48728473e314f729ac5308b06938360990e2bfad125"],["eb98660f4c4dfaa06a2be453d5020bc99a0c2e60abe388457dd43fefb1ed620c","6cb9a8876d9cb8520609af3add26cd20a0a7cd8a9411131ce85f44100099223e"],["13e87b027d8514d35939f2e6892b19922154596941888336dc3563e3b8dba942","fef5a3c68059a6dec5d624114bf1e91aac2b9da568d6abeb2570d55646b8adf1"],["ee163026e9fd6fe017c38f06a5be6fc125424b371ce2708e7bf4491691e5764a","1acb250f255dd61c43d94ccc670d0f58f49ae3fa15b96623e5430da0ad6c62b2"],["b268f5ef9ad51e4d78de3a750c2dc89b1e626d43505867999932e5db33af3d80","5f310d4b3c99b9ebb19f77d41c1dee018cf0d34fd4191614003e945a1216e423"],["ff07f3118a9df035e9fad85eb6c7bfe42b02f01ca99ceea3bf7ffdba93c4750d","438136d603e858a3a5c440c38eccbaddc1d2942114e2eddd4740d098ced1f0d8"],["8d8b9855c7c052a34146fd20ffb658bea4b9f69e0d825ebec16e8c3ce2b526a1","cdb559eedc2d79f926baf44fb84ea4d44bcf50fee51d7ceb30e2e7f463036758"],["52db0b5384dfbf05bfa9d472d7ae26dfe4b851ceca91b1eba54263180da32b63","c3b997d050ee5d423ebaf66a6db9f57b3180c902875679de924b69d84a7b375"],["e62f9490d3d51da6395efd24e80919cc7d0f29c3f3fa48c6fff543becbd43352","6d89ad7ba4876b0b22c2ca280c682862f342c8591f1daf5170e07bfd9ccafa7d"],["7f30ea2476b399b4957509c88f77d0191afa2ff5cb7b14fd6d8e7d65aaab1193","ca5ef7d4b231c94c3b15389a5f6311e9daff7bb67b103e9880ef4bff637acaec"],["5098ff1e1d9f14fb46a210fada6c903fef0fb7b4a1dd1d9ac60a0361800b7a00","9731141d81fc8f8084d37c6e7542006b3ee1b40d60dfe5362a5b132fd17ddc0"],["32b78c7de9ee512a72895be6b9cbefa6e2f3c4ccce445c96b9f2c81e2778ad58","ee1849f513df71e32efc3896ee28260c73bb80547ae2275ba497237794c8753c"],["e2cb74fddc8e9fbcd076eef2a7c72b0ce37d50f08269dfc074b581550547a4f7","d3aa2ed71c9dd2247a62df062736eb0baddea9e36122d2be8641abcb005cc4a4"],["8438447566d4d7bedadc299496ab357426009a35f235cb141be0d99cd10ae3a8","c4e1020916980a4da5d01ac5e6ad330734ef0d7906631c4f2390426b2edd791f"],["4162d488b89402039b584c6fc6c308870587d9c46f660b878ab65c82c711d67e","67163e903236289f776f22c25fb8a3afc1732f2b84b4e95dbda47ae5a0852649"],["3fad3fa84caf0f34f0f89bfd2dcf54fc175d767aec3e50684f3ba4a4bf5f683d","cd1bc7cb6cc407bb2f0ca647c718a730cf71872e7d0d2a53fa20efcdfe61826"],["674f2600a3007a00568c1a7ce05d0816c1fb84bf1370798f1c69532faeb1a86b","299d21f9413f33b3edf43b257004580b70db57da0b182259e09eecc69e0d38a5"],["d32f4da54ade74abb81b815ad1fb3b263d82d6c692714bcff87d29bd5ee9f08f","f9429e738b8e53b968e99016c059707782e14f4535359d582fc416910b3eea87"],["30e4e670435385556e593657135845d36fbb6931f72b08cb1ed954f1e3ce3ff6","462f9bce619898638499350113bbc9b10a878d35da70740dc695a559eb88db7b"],["be2062003c51cc3004682904330e4dee7f3dcd10b01e580bf1971b04d4cad297","62188bc49d61e5428573d48a74e1c655b1c61090905682a0d5558ed72dccb9bc"],["93144423ace3451ed29e0fb9ac2af211cb6e84a601df5993c419859fff5df04a","7c10dfb164c3425f5c71a3f9d7992038f1065224f72bb9d1d902a6d13037b47c"],["b015f8044f5fcbdcf21ca26d6c34fb8197829205c7b7d2a7cb66418c157b112c","ab8c1e086d04e813744a655b2df8d5f83b3cdc6faa3088c1d3aea1454e3a1d5f"],["d5e9e1da649d97d89e4868117a465a3a4f8a18de57a140d36b3f2af341a21b52","4cb04437f391ed73111a13cc1d4dd0db1693465c2240480d8955e8592f27447a"],["d3ae41047dd7ca065dbf8ed77b992439983005cd72e16d6f996a5316d36966bb","bd1aeb21ad22ebb22a10f0303417c6d964f8cdd7df0aca614b10dc14d125ac46"],["463e2763d885f958fc66cdd22800f0a487197d0a82e377b49f80af87c897b065","bfefacdb0e5d0fd7df3a311a94de062b26b80c61fbc97508b79992671ef7ca7f"],["7985fdfd127c0567c6f53ec1bb63ec3158e597c40bfe747c83cddfc910641917","603c12daf3d9862ef2b25fe1de289aed24ed291e0ec6708703a5bd567f32ed03"],["74a1ad6b5f76e39db2dd249410eac7f99e74c59cb83d2d0ed5ff1543da7703e9","cc6157ef18c9c63cd6193d83631bbea0093e0968942e8c33d5737fd790e0db08"],["30682a50703375f602d416664ba19b7fc9bab42c72747463a71d0896b22f6da3","553e04f6b018b4fa6c8f39e7f311d3176290d0e0f19ca73f17714d9977a22ff8"],["9e2158f0d7c0d5f26c3791efefa79597654e7a2b2464f52b1ee6c1347769ef57","712fcdd1b9053f09003a3481fa7762e9ffd7c8ef35a38509e2fbf2629008373"],["176e26989a43c9cfeba4029c202538c28172e566e3c4fce7322857f3be327d66","ed8cc9d04b29eb877d270b4878dc43c19aefd31f4eee09ee7b47834c1fa4b1c3"],["75d46efea3771e6e68abb89a13ad747ecf1892393dfc4f1b7004788c50374da8","9852390a99507679fd0b86fd2b39a868d7efc22151346e1a3ca4726586a6bed8"],["809a20c67d64900ffb698c4c825f6d5f2310fb0451c869345b7319f645605721","9e994980d9917e22b76b061927fa04143d096ccc54963e6a5ebfa5f3f8e286c1"],["1b38903a43f7f114ed4500b4eac7083fdefece1cf29c63528d563446f972c180","4036edc931a60ae889353f77fd53de4a2708b26b6f5da72ad3394119daf408f9"]]}}),Ta}(function(a){var n=a,h=Vf,u=io,v=Ke,o=v.assert;function w(B){B.type==="short"?this.curve=new u.short(B):B.type==="edwards"?this.curve=new u.edwards(B):this.curve=new u.mont(B),this.g=this.curve.g,this.n=this.curve.n,this.hash=B.hash,o(this.g.validate(),"Invalid curve"),o(this.g.mul(this.n).isInfinity(),"Invalid curve, G*N != O")}n.PresetCurve=w;function y(B,k){Object.defineProperty(n,B,{configurable:!0,enumerable:!0,get:function(){var L=new w(k);return Object.defineProperty(n,B,{configurable:!0,enumerable:!0,value:L}),L}})}y("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:h.sha256,gRed:!1,g:["188da80e b03090f6 7cbf20eb 43a18800 f4ff0afd 82ff1012","07192b95 ffc8da78 631011ed 6b24cdd5 73f977a1 1e794811"]}),y("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:h.sha256,gRed:!1,g:["b70e0cbd 6bb4bf7f 321390b9 4a03c1d3 56c21122 343280d6 115c1d21","bd376388 b5f723fb 4c22dfe6 cd4375a0 5a074764 44d58199 85007e34"]}),y("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:h.sha256,gRed:!1,g:["6b17d1f2 e12c4247 f8bce6e5 63a440f2 77037d81 2deb33a0 f4a13945 d898c296","4fe342e2 fe1a7f9b 8ee7eb4a 7c0f9e16 2bce3357 6b315ece cbb64068 37bf51f5"]}),y("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:h.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"]}),y("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:h.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"]}),y("curve25519",{type:"mont",prime:"p25519",p:"7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed",a:"76d06",b:"1",n:"1000000000000000 0000000000000000 14def9dea2f79cd6 5812631a5cf5d3ed",hash:h.sha256,gRed:!1,g:["9"]}),y("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:h.sha256,gRed:!1,g:["216936d3cd6e53fec0a4e231fdd6dc5c692cc7609525a7b2c9562d608f25d51a","6666666666666666666666666666666666666666666666666666666666666658"]});var b;try{b=zc()}catch{b=void 0}y("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:h.sha256,beta:"7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee",lambda:"5363ad4cc05c30e0a5261c028812645a122e22ea20816678df02967c1b23bd72",basis:[{a:"3086d221a7d46bcde86c90e49284eb15",b:"-e4437ed6010e88286f547fa90abfe4c3"},{a:"114ca50f7a8e2f3f657c1108d9d44cfd8",b:"3086d221a7d46bcde86c90e49284eb15"}],gRed:!1,g:["79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798","483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8",b]})})(Dn);var Dc=Vf,Ur=eo,Hs=Is;function Mr(a){if(!(this instanceof Mr))return new Mr(a);this.hash=a.hash,this.predResist=!!a.predResist,this.outLen=this.hash.outSize,this.minEntropy=a.minEntropy||this.hash.hmacStrength,this._reseed=null,this.reseedInterval=null,this.K=null,this.V=null;var n=Ur.toArray(a.entropy,a.entropyEnc||"hex"),h=Ur.toArray(a.nonce,a.nonceEnc||"hex"),u=Ur.toArray(a.pers,a.persEnc||"hex");Hs(n.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._init(n,h,u)}var Hc=Mr;Mr.prototype._init=function(n,h,u){var v=n.concat(h).concat(u);this.K=new Array(this.outLen/8),this.V=new Array(this.outLen/8);for(var o=0;o<this.V.length;o++)this.K[o]=0,this.V[o]=1;this._update(v),this._reseed=1,this.reseedInterval=281474976710656};Mr.prototype._hmac=function(){return new Dc.hmac(this.hash,this.K)};Mr.prototype._update=function(n){var h=this._hmac().update(this.V).update([0]);n&&(h=h.update(n)),this.K=h.digest(),this.V=this._hmac().update(this.V).digest(),n&&(this.K=this._hmac().update(this.V).update([1]).update(n).digest(),this.V=this._hmac().update(this.V).digest())};Mr.prototype.reseed=function(n,h,u,v){typeof h!="string"&&(v=u,u=h,h=null),n=Ur.toArray(n,h),u=Ur.toArray(u,v),Hs(n.length>=this.minEntropy/8,"Not enough entropy. Minimum is: "+this.minEntropy+" bits"),this._update(n.concat(u||[])),this._reseed=1};Mr.prototype.generate=function(n,h,u,v){if(this._reseed>this.reseedInterval)throw new Error("Reseed is required");typeof h!="string"&&(v=u,u=h,h=null),u&&(u=Ur.toArray(u,v||"hex"),this._update(u));for(var o=[];o.length<n;)this.V=this._hmac().update(this.V).digest(),o=o.concat(this.V);var w=o.slice(0,n);return this._update(u),this._reseed++,Ur.encode(w,h)};var Kc=dr,Zc=Ke,nf=Zc.assert;function qe(a,n){this.ec=a,this.priv=null,this.pub=null,n.priv&&this._importPrivate(n.priv,n.privEnc),n.pub&&this._importPublic(n.pub,n.pubEnc)}var Wc=qe;qe.fromPublic=function(n,h,u){return h instanceof qe?h:new qe(n,{pub:h,pubEnc:u})};qe.fromPrivate=function(n,h,u){return h instanceof qe?h:new qe(n,{priv:h,privEnc:u})};qe.prototype.validate=function(){var n=this.getPublic();return n.isInfinity()?{result:!1,reason:"Invalid public key"}:n.validate()?n.mul(this.ec.curve.n).isInfinity()?{result:!0,reason:null}:{result:!1,reason:"Public key * N != O"}:{result:!1,reason:"Public key is not a point"}};qe.prototype.getPublic=function(n,h){return typeof n=="string"&&(h=n,n=null),this.pub||(this.pub=this.ec.g.mul(this.priv)),h?this.pub.encode(h,n):this.pub};qe.prototype.getPrivate=function(n){return n==="hex"?this.priv.toString(16,2):this.priv};qe.prototype._importPrivate=function(n,h){this.priv=new Kc(n,h||16),this.priv=this.priv.umod(this.ec.curve.n)};qe.prototype._importPublic=function(n,h){if(n.x||n.y){this.ec.curve.type==="mont"?nf(n.x,"Need x coordinate"):(this.ec.curve.type==="short"||this.ec.curve.type==="edwards")&&nf(n.x&&n.y,"Need both x and y coordinate"),this.pub=this.ec.curve.point(n.x,n.y);return}this.pub=this.ec.curve.decodePoint(n,h)};qe.prototype.derive=function(n){return n.validate()||nf(n.validate(),"public point not validated"),n.mul(this.priv).getX()};qe.prototype.sign=function(n,h,u){return this.ec.sign(n,this,h,u)};qe.prototype.verify=function(n,h){return this.ec.verify(n,h,this)};qe.prototype.inspect=function(){return"<Key priv: "+(this.priv&&this.priv.toString(16,2))+" pub: "+(this.pub&&this.pub.inspect())+" >"};var An=dr,ao=Ke,Vc=ao.assert;function Hn(a,n){if(a instanceof Hn)return a;this._importDER(a,n)||(Vc(a.r&&a.s,"Signature without r or s"),this.r=new An(a.r,16),this.s=new An(a.s,16),a.recoveryParam===void 0?this.recoveryParam=null:this.recoveryParam=a.recoveryParam)}var Gc=Hn;function Jc(){this.place=0}function Ca(a,n){var h=a[n.place++];if(!(h&128))return h;var u=h&15;if(u===0||u>4)return!1;for(var v=0,o=0,w=n.place;o<u;o++,w++)v<<=8,v|=a[w],v>>>=0;return v<=127?!1:(n.place=w,v)}function g0(a){for(var n=0,h=a.length-1;!a[n]&&!(a[n+1]&128)&&n<h;)n++;return n===0?a:a.slice(n)}Hn.prototype._importDER=function(n,h){n=ao.toArray(n,h);var u=new Jc;if(n[u.place++]!==48)return!1;var v=Ca(n,u);if(v===!1||v+u.place!==n.length||n[u.place++]!==2)return!1;var o=Ca(n,u);if(o===!1)return!1;var w=n.slice(u.place,o+u.place);if(u.place+=o,n[u.place++]!==2)return!1;var y=Ca(n,u);if(y===!1||n.length!==y+u.place)return!1;var b=n.slice(u.place,y+u.place);if(w[0]===0)if(w[1]&128)w=w.slice(1);else return!1;if(b[0]===0)if(b[1]&128)b=b.slice(1);else return!1;return this.r=new An(w),this.s=new An(b),this.recoveryParam=null,!0};function La(a,n){if(n<128){a.push(n);return}var h=1+(Math.log(n)/Math.LN2>>>3);for(a.push(h|128);--h;)a.push(n>>>(h<<3)&255);a.push(n)}Hn.prototype.toDER=function(n){var h=this.r.toArray(),u=this.s.toArray();for(h[0]&128&&(h=[0].concat(h)),u[0]&128&&(u=[0].concat(u)),h=g0(h),u=g0(u);!u[0]&&!(u[1]&128);)u=u.slice(1);var v=[2];La(v,h.length),v=v.concat(h),v.push(2),La(v,u.length);var o=v.concat(u),w=[48];return La(w,o.length),w=w.concat(o),ao.encode(w,n)};var Fr=dr,Ks=Hc,jc=Ke,Pa=Dn,Yc=$s,Zs=jc.assert,fo=Wc,Kn=Gc;function Je(a){if(!(this instanceof Je))return new Je(a);typeof a=="string"&&(Zs(Object.prototype.hasOwnProperty.call(Pa,a),"Unknown curve "+a),a=Pa[a]),a instanceof Pa.PresetCurve&&(a={curve:a}),this.curve=a.curve.curve,this.n=this.curve.n,this.nh=this.n.ushrn(1),this.g=this.curve.g,this.g=a.curve.g,this.g.precompute(a.curve.n.bitLength()+1),this.hash=a.hash||a.curve.hash}var Xc=Je;Je.prototype.keyPair=function(n){return new fo(this,n)};Je.prototype.keyFromPrivate=function(n,h){return fo.fromPrivate(this,n,h)};Je.prototype.keyFromPublic=function(n,h){return fo.fromPublic(this,n,h)};Je.prototype.genKeyPair=function(n){n||(n={});for(var h=new Ks({hash:this.hash,pers:n.pers,persEnc:n.persEnc||"utf8",entropy:n.entropy||Yc(this.hash.hmacStrength),entropyEnc:n.entropy&&n.entropyEnc||"utf8",nonce:this.n.toArray()}),u=this.n.byteLength(),v=this.n.sub(new Fr(2));;){var o=new Fr(h.generate(u));if(!(o.cmp(v)>0))return o.iaddn(1),this.keyFromPrivate(o)}};Je.prototype._truncateToN=function(n,h){var u=n.byteLength()*8-this.n.bitLength();return u>0&&(n=n.ushrn(u)),!h&&n.cmp(this.n)>=0?n.sub(this.n):n};Je.prototype.sign=function(n,h,u,v){typeof u=="object"&&(v=u,u=null),v||(v={}),h=this.keyFromPrivate(h,u),n=this._truncateToN(new Fr(n,16));for(var o=this.n.byteLength(),w=h.getPrivate().toArray("be",o),y=n.toArray("be",o),b=new Ks({hash:this.hash,entropy:w,nonce:y,pers:v.pers,persEnc:v.persEnc||"utf8"}),B=this.n.sub(new Fr(1)),k=0;;k++){var L=v.k?v.k(k):new Fr(b.generate(this.n.byteLength()));if(L=this._truncateToN(L,!0),!(L.cmpn(1)<=0||L.cmp(B)>=0)){var q=this.g.mul(L);if(!q.isInfinity()){var $=q.getX(),M=$.umod(this.n);if(M.cmpn(0)!==0){var N=L.invm(this.n).mul(M.mul(h.getPrivate()).iadd(n));if(N=N.umod(this.n),N.cmpn(0)!==0){var x=(q.getY().isOdd()?1:0)|($.cmp(M)!==0?2:0);return v.canonical&&N.cmp(this.nh)>0&&(N=this.n.sub(N),x^=1),new Kn({r:M,s:N,recoveryParam:x})}}}}}};Je.prototype.verify=function(n,h,u,v){n=this._truncateToN(new Fr(n,16)),u=this.keyFromPublic(u,v),h=new Kn(h,"hex");var o=h.r,w=h.s;if(o.cmpn(1)<0||o.cmp(this.n)>=0||w.cmpn(1)<0||w.cmp(this.n)>=0)return!1;var y=w.invm(this.n),b=y.mul(n).umod(this.n),B=y.mul(o).umod(this.n),k;return this.curve._maxwellTrick?(k=this.g.jmulAdd(b,u.getPublic(),B),k.isInfinity()?!1:k.eqXToP(o)):(k=this.g.mulAdd(b,u.getPublic(),B),k.isInfinity()?!1:k.getX().umod(this.n).cmp(o)===0)};Je.prototype.recoverPubKey=function(a,n,h,u){Zs((3&h)===h,"The recovery param is more than two bits"),n=new Kn(n,u);var v=this.n,o=new Fr(a),w=n.r,y=n.s,b=h&1,B=h>>1;if(w.cmp(this.curve.p.umod(this.curve.n))>=0&&B)throw new Error("Unable to find sencond key candinate");B?w=this.curve.pointFromX(w.add(this.curve.n),b):w=this.curve.pointFromX(w,b);var k=n.r.invm(v),L=v.sub(o).mul(k).umod(v),q=y.mul(k).umod(v);return this.g.mulAdd(L,w,q)};Je.prototype.getKeyRecoveryParam=function(a,n,h,u){if(n=new Kn(n,u),n.recoveryParam!==null)return n.recoveryParam;for(var v=0;v<4;v++){var o;try{o=this.recoverPubKey(a,n,v)}catch{continue}if(o.eq(h))return v}throw new Error("Unable to find valid recovery factor")};var ji=Ke,Ws=ji.assert,y0=ji.parseBytes,gi=ji.cachedProperty;function Ee(a,n){this.eddsa=a,this._secret=y0(n.secret),a.isPoint(n.pub)?this._pub=n.pub:this._pubBytes=y0(n.pub)}Ee.fromPublic=function(n,h){return h instanceof Ee?h:new Ee(n,{pub:h})};Ee.fromSecret=function(n,h){return h instanceof Ee?h:new Ee(n,{secret:h})};Ee.prototype.secret=function(){return this._secret};gi(Ee,"pubBytes",function(){return this.eddsa.encodePoint(this.pub())});gi(Ee,"pub",function(){return this._pubBytes?this.eddsa.decodePoint(this._pubBytes):this.eddsa.g.mul(this.priv())});gi(Ee,"privBytes",function(){var n=this.eddsa,h=this.hash(),u=n.encodingLength-1,v=h.slice(0,n.encodingLength);return v[0]&=248,v[u]&=127,v[u]|=64,v});gi(Ee,"priv",function(){return this.eddsa.decodeInt(this.privBytes())});gi(Ee,"hash",function(){return this.eddsa.hash().update(this.secret()).digest()});gi(Ee,"messagePrefix",function(){return this.hash().slice(this.eddsa.encodingLength)});Ee.prototype.sign=function(n){return Ws(this._secret,"KeyPair can only verify"),this.eddsa.sign(n,this)};Ee.prototype.verify=function(n,h){return this.eddsa.verify(n,h,this)};Ee.prototype.getSecret=function(n){return Ws(this._secret,"KeyPair is public only"),ji.encode(this.secret(),n)};Ee.prototype.getPublic=function(n){return ji.encode(this.pubBytes(),n)};var Qc=Ee,td=dr,Zn=Ke,ed=Zn.assert,Wn=Zn.cachedProperty,rd=Zn.parseBytes;function Dr(a,n){this.eddsa=a,typeof n!="object"&&(n=rd(n)),Array.isArray(n)&&(n={R:n.slice(0,a.encodingLength),S:n.slice(a.encodingLength)}),ed(n.R&&n.S,"Signature without R or S"),a.isPoint(n.R)&&(this._R=n.R),n.S instanceof td&&(this._S=n.S),this._Rencoded=Array.isArray(n.R)?n.R:n.Rencoded,this._Sencoded=Array.isArray(n.S)?n.S:n.Sencoded}Wn(Dr,"S",function(){return this.eddsa.decodeInt(this.Sencoded())});Wn(Dr,"R",function(){return this.eddsa.decodePoint(this.Rencoded())});Wn(Dr,"Rencoded",function(){return this.eddsa.encodePoint(this.R())});Wn(Dr,"Sencoded",function(){return this.eddsa.encodeInt(this.S())});Dr.prototype.toBytes=function(){return this.Rencoded().concat(this.Sencoded())};Dr.prototype.toHex=function(){return Zn.encode(this.toBytes(),"hex").toUpperCase()};var id=Dr,nd=Vf,ad=Dn,ri=Ke,fd=ri.assert,Vs=ri.parseBytes,Gs=Qc,w0=id;function He(a){if(fd(a==="ed25519","only tested with ed25519 so far"),!(this instanceof He))return new He(a);a=ad[a].curve,this.curve=a,this.g=a.g,this.g.precompute(a.n.bitLength()+1),this.pointClass=a.point().constructor,this.encodingLength=Math.ceil(a.n.bitLength()/8),this.hash=nd.sha512}var od=He;He.prototype.sign=function(n,h){n=Vs(n);var u=this.keyFromSecret(h),v=this.hashInt(u.messagePrefix(),n),o=this.g.mul(v),w=this.encodePoint(o),y=this.hashInt(w,u.pubBytes(),n).mul(u.priv()),b=v.add(y).umod(this.curve.n);return this.makeSignature({R:o,S:b,Rencoded:w})};He.prototype.verify=function(n,h,u){n=Vs(n),h=this.makeSignature(h);var v=this.keyFromPublic(u),o=this.hashInt(h.Rencoded(),v.pubBytes(),n),w=this.g.mul(h.S()),y=h.R().add(v.pub().mul(o));return y.eq(w)};He.prototype.hashInt=function(){for(var n=this.hash(),h=0;h<arguments.length;h++)n.update(arguments[h]);return ri.intFromLE(n.digest()).umod(this.curve.n)};He.prototype.keyFromPublic=function(n){return Gs.fromPublic(this,n)};He.prototype.keyFromSecret=function(n){return Gs.fromSecret(this,n)};He.prototype.makeSignature=function(n){return n instanceof w0?n:new w0(this,n)};He.prototype.encodePoint=function(n){var h=n.getY().toArray("le",this.encodingLength);return h[this.encodingLength-1]|=n.getX().isOdd()?128:0,h};He.prototype.decodePoint=function(n){n=ri.parseBytes(n);var h=n.length-1,u=n.slice(0,h).concat(n[h]&-129),v=(n[h]&128)!==0,o=ri.intFromLE(u);return this.curve.pointFromY(o,v)};He.prototype.encodeInt=function(n){return n.toArray("le",this.encodingLength)};He.prototype.decodeInt=function(n){return ri.intFromLE(n)};He.prototype.isPoint=function(n){return n instanceof this.pointClass};(function(a){var n=a;n.version=Tc.version,n.utils=Ke,n.rand=$s,n.curve=io,n.curves=Dn,n.ec=Xc,n.eddsa=od})(Gi);const sd=Gi.ec,nr=new sd("secp256k1"),de=nr.curve,ye=de.n.constructor;function hd(a,n){let h=new ye(n);if(h.cmp(de.p)>=0)return null;h=h.toRed(de.red);let u=h.redSqr().redIMul(h).redIAdd(de.b).redSqrt();return a===3!==u.isOdd()&&(u=u.redNeg()),nr.keyPair({pub:{x:h,y:u}})}function ud(a,n,h){let u=new ye(n),v=new ye(h);if(u.cmp(de.p)>=0||v.cmp(de.p)>=0||(u=u.toRed(de.red),v=v.toRed(de.red),(a===6||a===7)&&v.isOdd()!==(a===7)))return null;const o=u.redSqr().redIMul(u);return v.redSqr().redISub(o.redIAdd(de.b)).isZero()?nr.keyPair({pub:{x:u,y:v}}):null}function pr(a){const n=a[0];switch(n){case 2:case 3:return a.length!==33?null:hd(n,a.subarray(1,33));case 4:case 6:case 7:return a.length!==65?null:ud(n,a.subarray(1,33),a.subarray(33,65));default:return null}}function Ir(a,n){const h=n.encode(null,a.length===33);for(let u=0;u<a.length;++u)a[u]=h[u]}var ld={contextRandomize(){return 0},privateKeyVerify(a){const n=new ye(a);return n.cmp(de.n)<0&&!n.isZero()?0:1},privateKeyNegate(a){const n=new ye(a),h=de.n.sub(n).umod(de.n).toArrayLike(Uint8Array,"be",32);return a.set(h),0},privateKeyTweakAdd(a,n){const h=new ye(n);if(h.cmp(de.n)>=0||(h.iadd(new ye(a)),h.cmp(de.n)>=0&&h.isub(de.n),h.isZero()))return 1;const u=h.toArrayLike(Uint8Array,"be",32);return a.set(u),0},privateKeyTweakMul(a,n){let h=new ye(n);if(h.cmp(de.n)>=0||h.isZero())return 1;h.imul(new ye(a)),h.cmp(de.n)>=0&&(h=h.umod(de.n));const u=h.toArrayLike(Uint8Array,"be",32);return a.set(u),0},publicKeyVerify(a){return pr(a)===null?1:0},publicKeyCreate(a,n){const h=new ye(n);if(h.cmp(de.n)>=0||h.isZero())return 1;const u=nr.keyFromPrivate(n).getPublic();return Ir(a,u),0},publicKeyConvert(a,n){const h=pr(n);if(h===null)return 1;const u=h.getPublic();return Ir(a,u),0},publicKeyNegate(a,n){const h=pr(n);if(h===null)return 1;const u=h.getPublic();return u.y=u.y.redNeg(),Ir(a,u),0},publicKeyCombine(a,n){const h=new Array(n.length);for(let v=0;v<n.length;++v)if(h[v]=pr(n[v]),h[v]===null)return 1;let u=h[0].getPublic();for(let v=1;v<h.length;++v)u=u.add(h[v].pub);return u.isInfinity()?2:(Ir(a,u),0)},publicKeyTweakAdd(a,n,h){const u=pr(n);if(u===null)return 1;if(h=new ye(h),h.cmp(de.n)>=0)return 2;const v=u.getPublic().add(de.g.mul(h));return v.isInfinity()?2:(Ir(a,v),0)},publicKeyTweakMul(a,n,h){const u=pr(n);if(u===null)return 1;if(h=new ye(h),h.cmp(de.n)>=0||h.isZero())return 2;const v=u.getPublic().mul(h);return Ir(a,v),0},signatureNormalize(a){const n=new ye(a.subarray(0,32)),h=new ye(a.subarray(32,64));return n.cmp(de.n)>=0||h.cmp(de.n)>=0?1:(h.cmp(nr.nh)===1&&a.set(de.n.sub(h).toArrayLike(Uint8Array,"be",32),32),0)},signatureExport(a,n){const h=n.subarray(0,32),u=n.subarray(32,64);if(new ye(h).cmp(de.n)>=0||new ye(u).cmp(de.n)>=0)return 1;const{output:v}=a;let o=v.subarray(4,4+33);o[0]=0,o.set(h,1);let w=33,y=0;for(;w>1&&o[y]===0&&!(o[y+1]&128);--w,++y);if(o=o.subarray(y),o[0]&128||w>1&&o[0]===0&&!(o[1]&128))return 1;let b=v.subarray(6+33,6+33+33);b[0]=0,b.set(u,1);let B=33,k=0;for(;B>1&&b[k]===0&&!(b[k+1]&128);--B,++k);return b=b.subarray(k),b[0]&128||B>1&&b[0]===0&&!(b[1]&128)?1:(a.outputlen=6+w+B,v[0]=48,v[1]=a.outputlen-2,v[2]=2,v[3]=o.length,v.set(o,4),v[4+w]=2,v[5+w]=b.length,v.set(b,6+w),0)},signatureImport(a,n){if(n.length<8||n.length>72||n[0]!==48||n[1]!==n.length-2||n[2]!==2)return 1;const h=n[3];if(h===0||5+h>=n.length||n[4+h]!==2)return 1;const u=n[5+h];if(u===0||6+h+u!==n.length||n[4]&128||h>1&&n[4]===0&&!(n[5]&128)||n[h+6]&128||u>1&&n[h+6]===0&&!(n[h+7]&128))return 1;let v=n.subarray(4,4+h);if(v.length===33&&v[0]===0&&(v=v.subarray(1)),v.length>32)return 1;let o=n.subarray(6+h);if(o.length===33&&o[0]===0&&(o=o.slice(1)),o.length>32)throw new Error("S length is too long");let w=new ye(v);w.cmp(de.n)>=0&&(w=new ye(0));let y=new ye(n.subarray(6+h));return y.cmp(de.n)>=0&&(y=new ye(0)),a.set(w.toArrayLike(Uint8Array,"be",32),0),a.set(y.toArrayLike(Uint8Array,"be",32),32),0},ecdsaSign(a,n,h,u,v){if(v){const y=v;v=b=>{const B=y(n,h,null,u,b);if(!(B instanceof Uint8Array&&B.length===32))throw new Error("This is the way");return new ye(B)}}const o=new ye(h);if(o.cmp(de.n)>=0||o.isZero())return 1;let w;try{w=nr.sign(n,h,{canonical:!0,k:v,pers:u})}catch{return 1}return a.signature.set(w.r.toArrayLike(Uint8Array,"be",32),0),a.signature.set(w.s.toArrayLike(Uint8Array,"be",32),32),a.recid=w.recoveryParam,0},ecdsaVerify(a,n,h){const u={r:a.subarray(0,32),s:a.subarray(32,64)},v=new ye(u.r),o=new ye(u.s);if(v.cmp(de.n)>=0||o.cmp(de.n)>=0)return 1;if(o.cmp(nr.nh)===1||v.isZero()||o.isZero())return 3;const w=pr(h);if(w===null)return 2;const y=w.getPublic();return nr.verify(n,u,y)?0:3},ecdsaRecover(a,n,h,u){const v={r:n.slice(0,32),s:n.slice(32,64)},o=new ye(v.r),w=new ye(v.s);if(o.cmp(de.n)>=0||w.cmp(de.n)>=0)return 1;if(o.isZero()||w.isZero())return 2;let y;try{y=nr.recoverPubKey(u,v,h)}catch{return 2}return Ir(a,y),0},ecdh(a,n,h,u,v,o,w){const y=pr(n);if(y===null)return 1;const b=new ye(h);if(b.cmp(de.n)>=0||b.isZero())return 2;const B=y.getPublic().mul(b);if(v===void 0){const k=B.encode(null,!0),L=nr.hash().update(k).digest();for(let q=0;q<32;++q)a[q]=L[q]}else{o||(o=new Uint8Array(32));const k=B.getX().toArray("be",32);for(let M=0;M<32;++M)o[M]=k[M];w||(w=new Uint8Array(32));const L=B.getY().toArray("be",32);for(let M=0;M<32;++M)w[M]=L[M];const q=v(o,w,u);if(!(q instanceof Uint8Array&&q.length===a.length))return 2;a.set(q)}return 0}},ii=mc(ld),Vn={},af={exports:{}},Oa=65536,cd=4294967295;function dd(){throw new Error(`Secure random number generation is not supported by this browser.
|
|
11
|
+
Use Chrome, Firefox or Internet Explorer 11`)}var vd=Di.Buffer,En=Vt.crypto||Vt.msCrypto;En&&En.getRandomValues?af.exports=pd:af.exports=dd;function pd(a,n){if(a>cd)throw new RangeError("requested too many random bytes");var h=vd.allocUnsafe(a);if(a>0)if(a>Oa)for(var u=0;u<a;u+=Oa)En.getRandomValues(h.slice(u,u+Oa));else En.getRandomValues(h);return typeof n=="function"?Me.nextTick(function(){n(null,h)}):h}var oo=af.exports;Object.defineProperty(Vn,"__esModule",{value:!0});var Js=oo;function md(a){return new Promise(function(n,h){Js(a,function(u,v){if(u){h(u);return}n(v)})})}Vn.getRandomBytes=md;function gd(a){return Js(a)}Vn.getRandomBytesSync=gd;(function(a){var n=Vt&&Vt.__awaiter||function(B,k,L,q){function $(M){return M instanceof L?M:new L(function(N){N(M)})}return new(L||(L=Promise))(function(M,N){function x(T){try{S(q.next(T))}catch(O){N(O)}}function A(T){try{S(q.throw(T))}catch(O){N(O)}}function S(T){T.done?M(T.value):$(T.value).then(x,A)}S((q=q.apply(B,k||[])).next())})},h=Vt&&Vt.__generator||function(B,k){var L={label:0,sent:function(){if(M[0]&1)throw M[1];return M[1]},trys:[],ops:[]},q,$,M,N;return N={next:x(0),throw:x(1),return:x(2)},typeof Symbol=="function"&&(N[Symbol.iterator]=function(){return this}),N;function x(S){return function(T){return A([S,T])}}function A(S){if(q)throw new TypeError("Generator is already executing.");for(;L;)try{if(q=1,$&&(M=S[0]&2?$.return:S[0]?$.throw||((M=$.return)&&M.call($),0):$.next)&&!(M=M.call($,S[1])).done)return M;switch($=0,M&&(S=[S[0]&2,M.value]),S[0]){case 0:case 1:M=S;break;case 4:return L.label++,{value:S[1],done:!1};case 5:L.label++,$=S[1],S=[0];continue;case 7:S=L.ops.pop(),L.trys.pop();continue;default:if(M=L.trys,!(M=M.length>0&&M[M.length-1])&&(S[0]===6||S[0]===2)){L=0;continue}if(S[0]===3&&(!M||S[1]>M[0]&&S[1]<M[3])){L.label=S[1];break}if(S[0]===6&&L.label<M[1]){L.label=M[1],M=S;break}if(M&&L.label<M[2]){L.label=M[2],L.ops.push(S);break}M[2]&&L.ops.pop(),L.trys.pop();continue}S=k.call(B,L)}catch(T){S=[6,T],$=0}finally{q=M=0}if(S[0]&5)throw S[1];return{value:S[0]?S[1]:void 0,done:!0}}};function u(B){for(var k in B)a.hasOwnProperty(k)||(a[k]=B[k])}Object.defineProperty(a,"__esModule",{value:!0});var v=ii,o=Vn,w=32;function y(){return n(this,void 0,void 0,function(){var B;return h(this,function(k){switch(k.label){case 0:return[4,o.getRandomBytes(w)];case 1:return B=k.sent(),v.privateKeyVerify(B)?[2,B]:[3,0];case 2:return[2]}})})}a.createPrivateKey=y;function b(){for(;;){var B=o.getRandomBytesSync(w);if(v.privateKeyVerify(B))return B}}a.createPrivateKeySync=b,u(ii)})(Fs);var Yi={},so={exports:{}};so.exports;(function(a){(function(n,h){function u(e,t){if(!e)throw new Error(t||"Assertion failed")}function v(e,t){e.super_=t;var i=function(){};i.prototype=t.prototype,e.prototype=new i,e.prototype.constructor=e}function o(e,t,i){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,e!==null&&((t==="le"||t==="be")&&(i=t,t=10),this._init(e||0,t||10,i||"be"))}typeof n=="object"?n.exports=o:h.BN=o,o.BN=o,o.wordSize=26;var w;try{typeof window<"u"&&typeof window.Buffer<"u"?w=window.Buffer:w=Se.Buffer}catch{}o.isBN=function(t){return t instanceof o?!0:t!==null&&typeof t=="object"&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,i){return t.cmp(i)>0?t:i},o.min=function(t,i){return t.cmp(i)<0?t:i},o.prototype._init=function(t,i,s){if(typeof t=="number")return this._initNumber(t,i,s);if(typeof t=="object")return this._initArray(t,i,s);i==="hex"&&(i=16),u(i===(i|0)&&i>=2&&i<=36),t=t.toString().replace(/\s+/g,"");var l=0;t[0]==="-"&&(l++,this.negative=1),l<t.length&&(i===16?this._parseHex(t,l,s):(this._parseBase(t,i,l),s==="le"&&this._initArray(this.toArray(),i,s)))},o.prototype._initNumber=function(t,i,s){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[t&67108863],this.length=1):t<4503599627370496?(this.words=[t&67108863,t/67108864&67108863],this.length=2):(u(t<9007199254740992),this.words=[t&67108863,t/67108864&67108863,1],this.length=3),s==="le"&&this._initArray(this.toArray(),i,s)},o.prototype._initArray=function(t,i,s){if(u(typeof t.length=="number"),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var l=0;l<this.length;l++)this.words[l]=0;var c,p,d=0;if(s==="be")for(l=t.length-1,c=0;l>=0;l-=3)p=t[l]|t[l-1]<<8|t[l-2]<<16,this.words[c]|=p<<d&67108863,this.words[c+1]=p>>>26-d&67108863,d+=24,d>=26&&(d-=26,c++);else if(s==="le")for(l=0,c=0;l<t.length;l+=3)p=t[l]|t[l+1]<<8|t[l+2]<<16,this.words[c]|=p<<d&67108863,this.words[c+1]=p>>>26-d&67108863,d+=24,d>=26&&(d-=26,c++);return this.strip()};function y(e,t){var i=e.charCodeAt(t);return i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:i-48&15}function b(e,t,i){var s=y(e,i);return i-1>=t&&(s|=y(e,i-1)<<4),s}o.prototype._parseHex=function(t,i,s){this.length=Math.ceil((t.length-i)/6),this.words=new Array(this.length);for(var l=0;l<this.length;l++)this.words[l]=0;var c=0,p=0,d;if(s==="be")for(l=t.length-1;l>=i;l-=2)d=b(t,i,l)<<c,this.words[p]|=d&67108863,c>=18?(c-=18,p+=1,this.words[p]|=d>>>26):c+=8;else{var r=t.length-i;for(l=r%2===0?i+1:i;l<t.length;l+=2)d=b(t,i,l)<<c,this.words[p]|=d&67108863,c>=18?(c-=18,p+=1,this.words[p]|=d>>>26):c+=8}this.strip()};function B(e,t,i,s){for(var l=0,c=Math.min(e.length,i),p=t;p<c;p++){var d=e.charCodeAt(p)-48;l*=s,d>=49?l+=d-49+10:d>=17?l+=d-17+10:l+=d}return l}o.prototype._parseBase=function(t,i,s){this.words=[0],this.length=1;for(var l=0,c=1;c<=67108863;c*=i)l++;l--,c=c/i|0;for(var p=t.length-s,d=p%l,r=Math.min(p,p-d)+s,f=0,m=s;m<r;m+=l)f=B(t,m,m+l,i),this.imuln(c),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f);if(d!==0){var _=1;for(f=B(t,m,t.length,i),m=0;m<d;m++)_*=i;this.imuln(_),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f)}this.strip()},o.prototype.copy=function(t){t.words=new Array(this.length);for(var i=0;i<this.length;i++)t.words[i]=this.words[i];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},o.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var k=["","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"],L=[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],q=[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];o.prototype.toString=function(t,i){t=t||10,i=i|0||1;var s;if(t===16||t==="hex"){s="";for(var l=0,c=0,p=0;p<this.length;p++){var d=this.words[p],r=((d<<l|c)&16777215).toString(16);c=d>>>24-l&16777215,c!==0||p!==this.length-1?s=k[6-r.length]+r+s:s=r+s,l+=2,l>=26&&(l-=26,p--)}for(c!==0&&(s=c.toString(16)+s);s.length%i!==0;)s="0"+s;return this.negative!==0&&(s="-"+s),s}if(t===(t|0)&&t>=2&&t<=36){var f=L[t],m=q[t];s="";var _=this.clone();for(_.negative=0;!_.isZero();){var R=_.modn(m).toString(t);_=_.idivn(m),_.isZero()?s=R+s:s=k[f-R.length]+R+s}for(this.isZero()&&(s="0"+s);s.length%i!==0;)s="0"+s;return this.negative!==0&&(s="-"+s),s}u(!1,"Base should be between 2 and 36")},o.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&&u(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,i){return u(typeof w<"u"),this.toArrayLike(w,t,i)},o.prototype.toArray=function(t,i){return this.toArrayLike(Array,t,i)},o.prototype.toArrayLike=function(t,i,s){var l=this.byteLength(),c=s||Math.max(1,l);u(l<=c,"byte array longer than desired length"),u(c>0,"Requested array length <= 0"),this.strip();var p=i==="le",d=new t(c),r,f,m=this.clone();if(p){for(f=0;!m.isZero();f++)r=m.andln(255),m.iushrn(8),d[f]=r;for(;f<c;f++)d[f]=0}else{for(f=0;f<c-l;f++)d[f]=0;for(f=0;!m.isZero();f++)r=m.andln(255),m.iushrn(8),d[c-f-1]=r}return d},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var i=t,s=0;return i>=4096&&(s+=13,i>>>=13),i>=64&&(s+=7,i>>>=7),i>=8&&(s+=4,i>>>=4),i>=2&&(s+=2,i>>>=2),s+i},o.prototype._zeroBits=function(t){if(t===0)return 26;var i=t,s=0;return i&8191||(s+=13,i>>>=13),i&127||(s+=7,i>>>=7),i&15||(s+=4,i>>>=4),i&3||(s+=2,i>>>=2),i&1||s++,s},o.prototype.bitLength=function(){var t=this.words[this.length-1],i=this._countBits(t);return(this.length-1)*26+i};function $(e){for(var t=new Array(e.bitLength()),i=0;i<t.length;i++){var s=i/26|0,l=i%26;t[i]=(e.words[s]&1<<l)>>>l}return t}o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,i=0;i<this.length;i++){var s=this._zeroBits(this.words[i]);if(t+=s,s!==26)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return this.negative!==0?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return this.negative!==0},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var i=0;i<t.length;i++)this.words[i]=this.words[i]|t.words[i];return this.strip()},o.prototype.ior=function(t){return u((this.negative|t.negative)===0),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var i;this.length>t.length?i=t:i=this;for(var s=0;s<i.length;s++)this.words[s]=this.words[s]&t.words[s];return this.length=i.length,this.strip()},o.prototype.iand=function(t){return u((this.negative|t.negative)===0),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var i,s;this.length>t.length?(i=this,s=t):(i=t,s=this);for(var l=0;l<s.length;l++)this.words[l]=i.words[l]^s.words[l];if(this!==i)for(;l<i.length;l++)this.words[l]=i.words[l];return this.length=i.length,this.strip()},o.prototype.ixor=function(t){return u((this.negative|t.negative)===0),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){u(typeof t=="number"&&t>=0);var i=Math.ceil(t/26)|0,s=t%26;this._expand(i),s>0&&i--;for(var l=0;l<i;l++)this.words[l]=~this.words[l]&67108863;return s>0&&(this.words[l]=~this.words[l]&67108863>>26-s),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,i){u(typeof t=="number"&&t>=0);var s=t/26|0,l=t%26;return this._expand(s+1),i?this.words[s]=this.words[s]|1<<l:this.words[s]=this.words[s]&~(1<<l),this.strip()},o.prototype.iadd=function(t){var i;if(this.negative!==0&&t.negative===0)return this.negative=0,i=this.isub(t),this.negative^=1,this._normSign();if(this.negative===0&&t.negative!==0)return t.negative=0,i=this.isub(t),t.negative=1,i._normSign();var s,l;this.length>t.length?(s=this,l=t):(s=t,l=this);for(var c=0,p=0;p<l.length;p++)i=(s.words[p]|0)+(l.words[p]|0)+c,this.words[p]=i&67108863,c=i>>>26;for(;c!==0&&p<s.length;p++)i=(s.words[p]|0)+c,this.words[p]=i&67108863,c=i>>>26;if(this.length=s.length,c!==0)this.words[this.length]=c,this.length++;else if(s!==this)for(;p<s.length;p++)this.words[p]=s.words[p];return this},o.prototype.add=function(t){var i;return t.negative!==0&&this.negative===0?(t.negative=0,i=this.sub(t),t.negative^=1,i):t.negative===0&&this.negative!==0?(this.negative=0,i=t.sub(this),this.negative=1,i):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(t.negative!==0){t.negative=0;var i=this.iadd(t);return t.negative=1,i._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var s=this.cmp(t);if(s===0)return this.negative=0,this.length=1,this.words[0]=0,this;var l,c;s>0?(l=this,c=t):(l=t,c=this);for(var p=0,d=0;d<c.length;d++)i=(l.words[d]|0)-(c.words[d]|0)+p,p=i>>26,this.words[d]=i&67108863;for(;p!==0&&d<l.length;d++)i=(l.words[d]|0)+p,p=i>>26,this.words[d]=i&67108863;if(p===0&&d<l.length&&l!==this)for(;d<l.length;d++)this.words[d]=l.words[d];return this.length=Math.max(this.length,d),l!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};function M(e,t,i){i.negative=t.negative^e.negative;var s=e.length+t.length|0;i.length=s,s=s-1|0;var l=e.words[0]|0,c=t.words[0]|0,p=l*c,d=p&67108863,r=p/67108864|0;i.words[0]=d;for(var f=1;f<s;f++){for(var m=r>>>26,_=r&67108863,R=Math.min(f,t.length-1),C=Math.max(0,f-e.length+1);C<=R;C++){var F=f-C|0;l=e.words[F]|0,c=t.words[C]|0,p=l*c+_,m+=p/67108864|0,_=p&67108863}i.words[f]=_|0,r=m|0}return r!==0?i.words[f]=r|0:i.length--,i.strip()}var N=function(t,i,s){var l=t.words,c=i.words,p=s.words,d=0,r,f,m,_=l[0]|0,R=_&8191,C=_>>>13,F=l[1]|0,z=F&8191,lt=F>>>13,G=l[2]|0,Z=G&8191,mt=G>>>13,gt=l[3]|0,j=gt&8191,Ct=gt>>>13,wt=l[4]|0,Y=wt&8191,U=wt>>>13,I=l[5]|0,E=I&8191,P=I>>>13,H=l[6]|0,D=H&8191,ut=H>>>13,vt=l[7]|0,V=vt&8191,bt=vt>>>13,yt=l[8]|0,J=yt&8191,Lt=yt>>>13,Mt=l[9]|0,Q=Mt&8191,Ot=Mt>>>13,xt=c[0]|0,tt=xt&8191,Nt=xt>>>13,_t=c[1]|0,et=_t&8191,qt=_t>>>13,St=c[2]|0,rt=St&8191,Ut=St>>>13,At=c[3]|0,it=At&8191,Ft=At>>>13,Et=c[4]|0,nt=Et&8191,$t=Et>>>13,kt=c[5]|0,at=kt&8191,zt=kt>>>13,Rt=c[6]|0,ft=Rt&8191,Dt=Rt>>>13,Bt=c[7]|0,ot=Bt&8191,Ht=Bt>>>13,It=c[8]|0,st=It&8191,Kt=It>>>13,Tt=c[9]|0,ht=Tt&8191,Pt=Tt>>>13;s.negative=t.negative^i.negative,s.length=19,r=Math.imul(R,tt),f=Math.imul(R,Nt),f=f+Math.imul(C,tt)|0,m=Math.imul(C,Nt);var Jt=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,r=Math.imul(z,tt),f=Math.imul(z,Nt),f=f+Math.imul(lt,tt)|0,m=Math.imul(lt,Nt),r=r+Math.imul(R,et)|0,f=f+Math.imul(R,qt)|0,f=f+Math.imul(C,et)|0,m=m+Math.imul(C,qt)|0;var jt=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(jt>>>26)|0,jt&=67108863,r=Math.imul(Z,tt),f=Math.imul(Z,Nt),f=f+Math.imul(mt,tt)|0,m=Math.imul(mt,Nt),r=r+Math.imul(z,et)|0,f=f+Math.imul(z,qt)|0,f=f+Math.imul(lt,et)|0,m=m+Math.imul(lt,qt)|0,r=r+Math.imul(R,rt)|0,f=f+Math.imul(R,Ut)|0,f=f+Math.imul(C,rt)|0,m=m+Math.imul(C,Ut)|0;var Yt=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,r=Math.imul(j,tt),f=Math.imul(j,Nt),f=f+Math.imul(Ct,tt)|0,m=Math.imul(Ct,Nt),r=r+Math.imul(Z,et)|0,f=f+Math.imul(Z,qt)|0,f=f+Math.imul(mt,et)|0,m=m+Math.imul(mt,qt)|0,r=r+Math.imul(z,rt)|0,f=f+Math.imul(z,Ut)|0,f=f+Math.imul(lt,rt)|0,m=m+Math.imul(lt,Ut)|0,r=r+Math.imul(R,it)|0,f=f+Math.imul(R,Ft)|0,f=f+Math.imul(C,it)|0,m=m+Math.imul(C,Ft)|0;var Xt=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(Xt>>>26)|0,Xt&=67108863,r=Math.imul(Y,tt),f=Math.imul(Y,Nt),f=f+Math.imul(U,tt)|0,m=Math.imul(U,Nt),r=r+Math.imul(j,et)|0,f=f+Math.imul(j,qt)|0,f=f+Math.imul(Ct,et)|0,m=m+Math.imul(Ct,qt)|0,r=r+Math.imul(Z,rt)|0,f=f+Math.imul(Z,Ut)|0,f=f+Math.imul(mt,rt)|0,m=m+Math.imul(mt,Ut)|0,r=r+Math.imul(z,it)|0,f=f+Math.imul(z,Ft)|0,f=f+Math.imul(lt,it)|0,m=m+Math.imul(lt,Ft)|0,r=r+Math.imul(R,nt)|0,f=f+Math.imul(R,$t)|0,f=f+Math.imul(C,nt)|0,m=m+Math.imul(C,$t)|0;var Qt=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(Qt>>>26)|0,Qt&=67108863,r=Math.imul(E,tt),f=Math.imul(E,Nt),f=f+Math.imul(P,tt)|0,m=Math.imul(P,Nt),r=r+Math.imul(Y,et)|0,f=f+Math.imul(Y,qt)|0,f=f+Math.imul(U,et)|0,m=m+Math.imul(U,qt)|0,r=r+Math.imul(j,rt)|0,f=f+Math.imul(j,Ut)|0,f=f+Math.imul(Ct,rt)|0,m=m+Math.imul(Ct,Ut)|0,r=r+Math.imul(Z,it)|0,f=f+Math.imul(Z,Ft)|0,f=f+Math.imul(mt,it)|0,m=m+Math.imul(mt,Ft)|0,r=r+Math.imul(z,nt)|0,f=f+Math.imul(z,$t)|0,f=f+Math.imul(lt,nt)|0,m=m+Math.imul(lt,$t)|0,r=r+Math.imul(R,at)|0,f=f+Math.imul(R,zt)|0,f=f+Math.imul(C,at)|0,m=m+Math.imul(C,zt)|0;var te=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(te>>>26)|0,te&=67108863,r=Math.imul(D,tt),f=Math.imul(D,Nt),f=f+Math.imul(ut,tt)|0,m=Math.imul(ut,Nt),r=r+Math.imul(E,et)|0,f=f+Math.imul(E,qt)|0,f=f+Math.imul(P,et)|0,m=m+Math.imul(P,qt)|0,r=r+Math.imul(Y,rt)|0,f=f+Math.imul(Y,Ut)|0,f=f+Math.imul(U,rt)|0,m=m+Math.imul(U,Ut)|0,r=r+Math.imul(j,it)|0,f=f+Math.imul(j,Ft)|0,f=f+Math.imul(Ct,it)|0,m=m+Math.imul(Ct,Ft)|0,r=r+Math.imul(Z,nt)|0,f=f+Math.imul(Z,$t)|0,f=f+Math.imul(mt,nt)|0,m=m+Math.imul(mt,$t)|0,r=r+Math.imul(z,at)|0,f=f+Math.imul(z,zt)|0,f=f+Math.imul(lt,at)|0,m=m+Math.imul(lt,zt)|0,r=r+Math.imul(R,ft)|0,f=f+Math.imul(R,Dt)|0,f=f+Math.imul(C,ft)|0,m=m+Math.imul(C,Dt)|0;var ee=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(ee>>>26)|0,ee&=67108863,r=Math.imul(V,tt),f=Math.imul(V,Nt),f=f+Math.imul(bt,tt)|0,m=Math.imul(bt,Nt),r=r+Math.imul(D,et)|0,f=f+Math.imul(D,qt)|0,f=f+Math.imul(ut,et)|0,m=m+Math.imul(ut,qt)|0,r=r+Math.imul(E,rt)|0,f=f+Math.imul(E,Ut)|0,f=f+Math.imul(P,rt)|0,m=m+Math.imul(P,Ut)|0,r=r+Math.imul(Y,it)|0,f=f+Math.imul(Y,Ft)|0,f=f+Math.imul(U,it)|0,m=m+Math.imul(U,Ft)|0,r=r+Math.imul(j,nt)|0,f=f+Math.imul(j,$t)|0,f=f+Math.imul(Ct,nt)|0,m=m+Math.imul(Ct,$t)|0,r=r+Math.imul(Z,at)|0,f=f+Math.imul(Z,zt)|0,f=f+Math.imul(mt,at)|0,m=m+Math.imul(mt,zt)|0,r=r+Math.imul(z,ft)|0,f=f+Math.imul(z,Dt)|0,f=f+Math.imul(lt,ft)|0,m=m+Math.imul(lt,Dt)|0,r=r+Math.imul(R,ot)|0,f=f+Math.imul(R,Ht)|0,f=f+Math.imul(C,ot)|0,m=m+Math.imul(C,Ht)|0;var re=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(re>>>26)|0,re&=67108863,r=Math.imul(J,tt),f=Math.imul(J,Nt),f=f+Math.imul(Lt,tt)|0,m=Math.imul(Lt,Nt),r=r+Math.imul(V,et)|0,f=f+Math.imul(V,qt)|0,f=f+Math.imul(bt,et)|0,m=m+Math.imul(bt,qt)|0,r=r+Math.imul(D,rt)|0,f=f+Math.imul(D,Ut)|0,f=f+Math.imul(ut,rt)|0,m=m+Math.imul(ut,Ut)|0,r=r+Math.imul(E,it)|0,f=f+Math.imul(E,Ft)|0,f=f+Math.imul(P,it)|0,m=m+Math.imul(P,Ft)|0,r=r+Math.imul(Y,nt)|0,f=f+Math.imul(Y,$t)|0,f=f+Math.imul(U,nt)|0,m=m+Math.imul(U,$t)|0,r=r+Math.imul(j,at)|0,f=f+Math.imul(j,zt)|0,f=f+Math.imul(Ct,at)|0,m=m+Math.imul(Ct,zt)|0,r=r+Math.imul(Z,ft)|0,f=f+Math.imul(Z,Dt)|0,f=f+Math.imul(mt,ft)|0,m=m+Math.imul(mt,Dt)|0,r=r+Math.imul(z,ot)|0,f=f+Math.imul(z,Ht)|0,f=f+Math.imul(lt,ot)|0,m=m+Math.imul(lt,Ht)|0,r=r+Math.imul(R,st)|0,f=f+Math.imul(R,Kt)|0,f=f+Math.imul(C,st)|0,m=m+Math.imul(C,Kt)|0;var ie=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(ie>>>26)|0,ie&=67108863,r=Math.imul(Q,tt),f=Math.imul(Q,Nt),f=f+Math.imul(Ot,tt)|0,m=Math.imul(Ot,Nt),r=r+Math.imul(J,et)|0,f=f+Math.imul(J,qt)|0,f=f+Math.imul(Lt,et)|0,m=m+Math.imul(Lt,qt)|0,r=r+Math.imul(V,rt)|0,f=f+Math.imul(V,Ut)|0,f=f+Math.imul(bt,rt)|0,m=m+Math.imul(bt,Ut)|0,r=r+Math.imul(D,it)|0,f=f+Math.imul(D,Ft)|0,f=f+Math.imul(ut,it)|0,m=m+Math.imul(ut,Ft)|0,r=r+Math.imul(E,nt)|0,f=f+Math.imul(E,$t)|0,f=f+Math.imul(P,nt)|0,m=m+Math.imul(P,$t)|0,r=r+Math.imul(Y,at)|0,f=f+Math.imul(Y,zt)|0,f=f+Math.imul(U,at)|0,m=m+Math.imul(U,zt)|0,r=r+Math.imul(j,ft)|0,f=f+Math.imul(j,Dt)|0,f=f+Math.imul(Ct,ft)|0,m=m+Math.imul(Ct,Dt)|0,r=r+Math.imul(Z,ot)|0,f=f+Math.imul(Z,Ht)|0,f=f+Math.imul(mt,ot)|0,m=m+Math.imul(mt,Ht)|0,r=r+Math.imul(z,st)|0,f=f+Math.imul(z,Kt)|0,f=f+Math.imul(lt,st)|0,m=m+Math.imul(lt,Kt)|0,r=r+Math.imul(R,ht)|0,f=f+Math.imul(R,Pt)|0,f=f+Math.imul(C,ht)|0,m=m+Math.imul(C,Pt)|0;var ne=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(ne>>>26)|0,ne&=67108863,r=Math.imul(Q,et),f=Math.imul(Q,qt),f=f+Math.imul(Ot,et)|0,m=Math.imul(Ot,qt),r=r+Math.imul(J,rt)|0,f=f+Math.imul(J,Ut)|0,f=f+Math.imul(Lt,rt)|0,m=m+Math.imul(Lt,Ut)|0,r=r+Math.imul(V,it)|0,f=f+Math.imul(V,Ft)|0,f=f+Math.imul(bt,it)|0,m=m+Math.imul(bt,Ft)|0,r=r+Math.imul(D,nt)|0,f=f+Math.imul(D,$t)|0,f=f+Math.imul(ut,nt)|0,m=m+Math.imul(ut,$t)|0,r=r+Math.imul(E,at)|0,f=f+Math.imul(E,zt)|0,f=f+Math.imul(P,at)|0,m=m+Math.imul(P,zt)|0,r=r+Math.imul(Y,ft)|0,f=f+Math.imul(Y,Dt)|0,f=f+Math.imul(U,ft)|0,m=m+Math.imul(U,Dt)|0,r=r+Math.imul(j,ot)|0,f=f+Math.imul(j,Ht)|0,f=f+Math.imul(Ct,ot)|0,m=m+Math.imul(Ct,Ht)|0,r=r+Math.imul(Z,st)|0,f=f+Math.imul(Z,Kt)|0,f=f+Math.imul(mt,st)|0,m=m+Math.imul(mt,Kt)|0,r=r+Math.imul(z,ht)|0,f=f+Math.imul(z,Pt)|0,f=f+Math.imul(lt,ht)|0,m=m+Math.imul(lt,Pt)|0;var ae=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(ae>>>26)|0,ae&=67108863,r=Math.imul(Q,rt),f=Math.imul(Q,Ut),f=f+Math.imul(Ot,rt)|0,m=Math.imul(Ot,Ut),r=r+Math.imul(J,it)|0,f=f+Math.imul(J,Ft)|0,f=f+Math.imul(Lt,it)|0,m=m+Math.imul(Lt,Ft)|0,r=r+Math.imul(V,nt)|0,f=f+Math.imul(V,$t)|0,f=f+Math.imul(bt,nt)|0,m=m+Math.imul(bt,$t)|0,r=r+Math.imul(D,at)|0,f=f+Math.imul(D,zt)|0,f=f+Math.imul(ut,at)|0,m=m+Math.imul(ut,zt)|0,r=r+Math.imul(E,ft)|0,f=f+Math.imul(E,Dt)|0,f=f+Math.imul(P,ft)|0,m=m+Math.imul(P,Dt)|0,r=r+Math.imul(Y,ot)|0,f=f+Math.imul(Y,Ht)|0,f=f+Math.imul(U,ot)|0,m=m+Math.imul(U,Ht)|0,r=r+Math.imul(j,st)|0,f=f+Math.imul(j,Kt)|0,f=f+Math.imul(Ct,st)|0,m=m+Math.imul(Ct,Kt)|0,r=r+Math.imul(Z,ht)|0,f=f+Math.imul(Z,Pt)|0,f=f+Math.imul(mt,ht)|0,m=m+Math.imul(mt,Pt)|0;var fe=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(fe>>>26)|0,fe&=67108863,r=Math.imul(Q,it),f=Math.imul(Q,Ft),f=f+Math.imul(Ot,it)|0,m=Math.imul(Ot,Ft),r=r+Math.imul(J,nt)|0,f=f+Math.imul(J,$t)|0,f=f+Math.imul(Lt,nt)|0,m=m+Math.imul(Lt,$t)|0,r=r+Math.imul(V,at)|0,f=f+Math.imul(V,zt)|0,f=f+Math.imul(bt,at)|0,m=m+Math.imul(bt,zt)|0,r=r+Math.imul(D,ft)|0,f=f+Math.imul(D,Dt)|0,f=f+Math.imul(ut,ft)|0,m=m+Math.imul(ut,Dt)|0,r=r+Math.imul(E,ot)|0,f=f+Math.imul(E,Ht)|0,f=f+Math.imul(P,ot)|0,m=m+Math.imul(P,Ht)|0,r=r+Math.imul(Y,st)|0,f=f+Math.imul(Y,Kt)|0,f=f+Math.imul(U,st)|0,m=m+Math.imul(U,Kt)|0,r=r+Math.imul(j,ht)|0,f=f+Math.imul(j,Pt)|0,f=f+Math.imul(Ct,ht)|0,m=m+Math.imul(Ct,Pt)|0;var oe=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(oe>>>26)|0,oe&=67108863,r=Math.imul(Q,nt),f=Math.imul(Q,$t),f=f+Math.imul(Ot,nt)|0,m=Math.imul(Ot,$t),r=r+Math.imul(J,at)|0,f=f+Math.imul(J,zt)|0,f=f+Math.imul(Lt,at)|0,m=m+Math.imul(Lt,zt)|0,r=r+Math.imul(V,ft)|0,f=f+Math.imul(V,Dt)|0,f=f+Math.imul(bt,ft)|0,m=m+Math.imul(bt,Dt)|0,r=r+Math.imul(D,ot)|0,f=f+Math.imul(D,Ht)|0,f=f+Math.imul(ut,ot)|0,m=m+Math.imul(ut,Ht)|0,r=r+Math.imul(E,st)|0,f=f+Math.imul(E,Kt)|0,f=f+Math.imul(P,st)|0,m=m+Math.imul(P,Kt)|0,r=r+Math.imul(Y,ht)|0,f=f+Math.imul(Y,Pt)|0,f=f+Math.imul(U,ht)|0,m=m+Math.imul(U,Pt)|0;var se=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(se>>>26)|0,se&=67108863,r=Math.imul(Q,at),f=Math.imul(Q,zt),f=f+Math.imul(Ot,at)|0,m=Math.imul(Ot,zt),r=r+Math.imul(J,ft)|0,f=f+Math.imul(J,Dt)|0,f=f+Math.imul(Lt,ft)|0,m=m+Math.imul(Lt,Dt)|0,r=r+Math.imul(V,ot)|0,f=f+Math.imul(V,Ht)|0,f=f+Math.imul(bt,ot)|0,m=m+Math.imul(bt,Ht)|0,r=r+Math.imul(D,st)|0,f=f+Math.imul(D,Kt)|0,f=f+Math.imul(ut,st)|0,m=m+Math.imul(ut,Kt)|0,r=r+Math.imul(E,ht)|0,f=f+Math.imul(E,Pt)|0,f=f+Math.imul(P,ht)|0,m=m+Math.imul(P,Pt)|0;var he=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(he>>>26)|0,he&=67108863,r=Math.imul(Q,ft),f=Math.imul(Q,Dt),f=f+Math.imul(Ot,ft)|0,m=Math.imul(Ot,Dt),r=r+Math.imul(J,ot)|0,f=f+Math.imul(J,Ht)|0,f=f+Math.imul(Lt,ot)|0,m=m+Math.imul(Lt,Ht)|0,r=r+Math.imul(V,st)|0,f=f+Math.imul(V,Kt)|0,f=f+Math.imul(bt,st)|0,m=m+Math.imul(bt,Kt)|0,r=r+Math.imul(D,ht)|0,f=f+Math.imul(D,Pt)|0,f=f+Math.imul(ut,ht)|0,m=m+Math.imul(ut,Pt)|0;var ue=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(ue>>>26)|0,ue&=67108863,r=Math.imul(Q,ot),f=Math.imul(Q,Ht),f=f+Math.imul(Ot,ot)|0,m=Math.imul(Ot,Ht),r=r+Math.imul(J,st)|0,f=f+Math.imul(J,Kt)|0,f=f+Math.imul(Lt,st)|0,m=m+Math.imul(Lt,Kt)|0,r=r+Math.imul(V,ht)|0,f=f+Math.imul(V,Pt)|0,f=f+Math.imul(bt,ht)|0,m=m+Math.imul(bt,Pt)|0;var le=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(le>>>26)|0,le&=67108863,r=Math.imul(Q,st),f=Math.imul(Q,Kt),f=f+Math.imul(Ot,st)|0,m=Math.imul(Ot,Kt),r=r+Math.imul(J,ht)|0,f=f+Math.imul(J,Pt)|0,f=f+Math.imul(Lt,ht)|0,m=m+Math.imul(Lt,Pt)|0;var ce=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(ce>>>26)|0,ce&=67108863,r=Math.imul(Q,ht),f=Math.imul(Q,Pt),f=f+Math.imul(Ot,ht)|0,m=Math.imul(Ot,Pt);var Ue=(d+r|0)+((f&8191)<<13)|0;return d=(m+(f>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,p[0]=Jt,p[1]=jt,p[2]=Yt,p[3]=Xt,p[4]=Qt,p[5]=te,p[6]=ee,p[7]=re,p[8]=ie,p[9]=ne,p[10]=ae,p[11]=fe,p[12]=oe,p[13]=se,p[14]=he,p[15]=ue,p[16]=le,p[17]=ce,p[18]=Ue,d!==0&&(p[19]=d,s.length++),s};Math.imul||(N=M);function x(e,t,i){i.negative=t.negative^e.negative,i.length=e.length+t.length;for(var s=0,l=0,c=0;c<i.length-1;c++){var p=l;l=0;for(var d=s&67108863,r=Math.min(c,t.length-1),f=Math.max(0,c-e.length+1);f<=r;f++){var m=c-f,_=e.words[m]|0,R=t.words[f]|0,C=_*R,F=C&67108863;p=p+(C/67108864|0)|0,F=F+d|0,d=F&67108863,p=p+(F>>>26)|0,l+=p>>>26,p&=67108863}i.words[c]=d,s=p,p=l}return s!==0?i.words[c]=s:i.length--,i.strip()}function A(e,t,i){var s=new S;return s.mulp(e,t,i)}o.prototype.mulTo=function(t,i){var s,l=this.length+t.length;return this.length===10&&t.length===10?s=N(this,t,i):l<63?s=M(this,t,i):l<1024?s=x(this,t,i):s=A(this,t,i),s};function S(e,t){this.x=e,this.y=t}S.prototype.makeRBT=function(t){for(var i=new Array(t),s=o.prototype._countBits(t)-1,l=0;l<t;l++)i[l]=this.revBin(l,s,t);return i},S.prototype.revBin=function(t,i,s){if(t===0||t===s-1)return t;for(var l=0,c=0;c<i;c++)l|=(t&1)<<i-c-1,t>>=1;return l},S.prototype.permute=function(t,i,s,l,c,p){for(var d=0;d<p;d++)l[d]=i[t[d]],c[d]=s[t[d]]},S.prototype.transform=function(t,i,s,l,c,p){this.permute(p,t,i,s,l,c);for(var d=1;d<c;d<<=1)for(var r=d<<1,f=Math.cos(2*Math.PI/r),m=Math.sin(2*Math.PI/r),_=0;_<c;_+=r)for(var R=f,C=m,F=0;F<d;F++){var z=s[_+F],lt=l[_+F],G=s[_+F+d],Z=l[_+F+d],mt=R*G-C*Z;Z=R*Z+C*G,G=mt,s[_+F]=z+G,l[_+F]=lt+Z,s[_+F+d]=z-G,l[_+F+d]=lt-Z,F!==r&&(mt=f*R-m*C,C=f*C+m*R,R=mt)}},S.prototype.guessLen13b=function(t,i){var s=Math.max(i,t)|1,l=s&1,c=0;for(s=s/2|0;s;s=s>>>1)c++;return 1<<c+1+l},S.prototype.conjugate=function(t,i,s){if(!(s<=1))for(var l=0;l<s/2;l++){var c=t[l];t[l]=t[s-l-1],t[s-l-1]=c,c=i[l],i[l]=-i[s-l-1],i[s-l-1]=-c}},S.prototype.normalize13b=function(t,i){for(var s=0,l=0;l<i/2;l++){var c=Math.round(t[2*l+1]/i)*8192+Math.round(t[2*l]/i)+s;t[l]=c&67108863,c<67108864?s=0:s=c/67108864|0}return t},S.prototype.convert13b=function(t,i,s,l){for(var c=0,p=0;p<i;p++)c=c+(t[p]|0),s[2*p]=c&8191,c=c>>>13,s[2*p+1]=c&8191,c=c>>>13;for(p=2*i;p<l;++p)s[p]=0;u(c===0),u((c&-8192)===0)},S.prototype.stub=function(t){for(var i=new Array(t),s=0;s<t;s++)i[s]=0;return i},S.prototype.mulp=function(t,i,s){var l=2*this.guessLen13b(t.length,i.length),c=this.makeRBT(l),p=this.stub(l),d=new Array(l),r=new Array(l),f=new Array(l),m=new Array(l),_=new Array(l),R=new Array(l),C=s.words;C.length=l,this.convert13b(t.words,t.length,d,l),this.convert13b(i.words,i.length,m,l),this.transform(d,p,r,f,l,c),this.transform(m,p,_,R,l,c);for(var F=0;F<l;F++){var z=r[F]*_[F]-f[F]*R[F];f[F]=r[F]*R[F]+f[F]*_[F],r[F]=z}return this.conjugate(r,f,l),this.transform(r,f,C,p,l,c),this.conjugate(C,p,l),this.normalize13b(C,l),s.negative=t.negative^i.negative,s.length=t.length+i.length,s.strip()},o.prototype.mul=function(t){var i=new o(null);return i.words=new Array(this.length+t.length),this.mulTo(t,i)},o.prototype.mulf=function(t){var i=new o(null);return i.words=new Array(this.length+t.length),A(this,t,i)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){u(typeof t=="number"),u(t<67108864);for(var i=0,s=0;s<this.length;s++){var l=(this.words[s]|0)*t,c=(l&67108863)+(i&67108863);i>>=26,i+=l/67108864|0,i+=c>>>26,this.words[s]=c&67108863}return i!==0&&(this.words[s]=i,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var i=$(t);if(i.length===0)return new o(1);for(var s=this,l=0;l<i.length&&i[l]===0;l++,s=s.sqr());if(++l<i.length)for(var c=s.sqr();l<i.length;l++,c=c.sqr())i[l]!==0&&(s=s.mul(c));return s},o.prototype.iushln=function(t){u(typeof t=="number"&&t>=0);var i=t%26,s=(t-i)/26,l=67108863>>>26-i<<26-i,c;if(i!==0){var p=0;for(c=0;c<this.length;c++){var d=this.words[c]&l,r=(this.words[c]|0)-d<<i;this.words[c]=r|p,p=d>>>26-i}p&&(this.words[c]=p,this.length++)}if(s!==0){for(c=this.length-1;c>=0;c--)this.words[c+s]=this.words[c];for(c=0;c<s;c++)this.words[c]=0;this.length+=s}return this.strip()},o.prototype.ishln=function(t){return u(this.negative===0),this.iushln(t)},o.prototype.iushrn=function(t,i,s){u(typeof t=="number"&&t>=0);var l;i?l=(i-i%26)/26:l=0;var c=t%26,p=Math.min((t-c)/26,this.length),d=67108863^67108863>>>c<<c,r=s;if(l-=p,l=Math.max(0,l),r){for(var f=0;f<p;f++)r.words[f]=this.words[f];r.length=p}if(p!==0)if(this.length>p)for(this.length-=p,f=0;f<this.length;f++)this.words[f]=this.words[f+p];else this.words[0]=0,this.length=1;var m=0;for(f=this.length-1;f>=0&&(m!==0||f>=l);f--){var _=this.words[f]|0;this.words[f]=m<<26-c|_>>>c,m=_&d}return r&&m!==0&&(r.words[r.length++]=m),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,i,s){return u(this.negative===0),this.iushrn(t,i,s)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){u(typeof t=="number"&&t>=0);var i=t%26,s=(t-i)/26,l=1<<i;if(this.length<=s)return!1;var c=this.words[s];return!!(c&l)},o.prototype.imaskn=function(t){u(typeof t=="number"&&t>=0);var i=t%26,s=(t-i)/26;if(u(this.negative===0,"imaskn works only with positive numbers"),this.length<=s)return this;if(i!==0&&s++,this.length=Math.min(s,this.length),i!==0){var l=67108863^67108863>>>i<<i;this.words[this.length-1]&=l}return this.strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return u(typeof t=="number"),u(t<67108864),t<0?this.isubn(-t):this.negative!==0?this.length===1&&(this.words[0]|0)<t?(this.words[0]=t-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var i=0;i<this.length&&this.words[i]>=67108864;i++)this.words[i]-=67108864,i===this.length-1?this.words[i+1]=1:this.words[i+1]++;return this.length=Math.max(this.length,i+1),this},o.prototype.isubn=function(t){if(u(typeof t=="number"),u(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 i=0;i<this.length&&this.words[i]<0;i++)this.words[i]+=67108864,this.words[i+1]-=1;return this.strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,i,s){var l=t.length+s,c;this._expand(l);var p,d=0;for(c=0;c<t.length;c++){p=(this.words[c+s]|0)+d;var r=(t.words[c]|0)*i;p-=r&67108863,d=(p>>26)-(r/67108864|0),this.words[c+s]=p&67108863}for(;c<this.length-s;c++)p=(this.words[c+s]|0)+d,d=p>>26,this.words[c+s]=p&67108863;if(d===0)return this.strip();for(u(d===-1),d=0,c=0;c<this.length;c++)p=-(this.words[c]|0)+d,d=p>>26,this.words[c]=p&67108863;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,i){var s=this.length-t.length,l=this.clone(),c=t,p=c.words[c.length-1]|0,d=this._countBits(p);s=26-d,s!==0&&(c=c.ushln(s),l.iushln(s),p=c.words[c.length-1]|0);var r=l.length-c.length,f;if(i!=="mod"){f=new o(null),f.length=r+1,f.words=new Array(f.length);for(var m=0;m<f.length;m++)f.words[m]=0}var _=l.clone()._ishlnsubmul(c,1,r);_.negative===0&&(l=_,f&&(f.words[r]=1));for(var R=r-1;R>=0;R--){var C=(l.words[c.length+R]|0)*67108864+(l.words[c.length+R-1]|0);for(C=Math.min(C/p|0,67108863),l._ishlnsubmul(c,C,R);l.negative!==0;)C--,l.negative=0,l._ishlnsubmul(c,1,R),l.isZero()||(l.negative^=1);f&&(f.words[R]=C)}return f&&f.strip(),l.strip(),i!=="div"&&s!==0&&l.iushrn(s),{div:f||null,mod:l}},o.prototype.divmod=function(t,i,s){if(u(!t.isZero()),this.isZero())return{div:new o(0),mod:new o(0)};var l,c,p;return this.negative!==0&&t.negative===0?(p=this.neg().divmod(t,i),i!=="mod"&&(l=p.div.neg()),i!=="div"&&(c=p.mod.neg(),s&&c.negative!==0&&c.iadd(t)),{div:l,mod:c}):this.negative===0&&t.negative!==0?(p=this.divmod(t.neg(),i),i!=="mod"&&(l=p.div.neg()),{div:l,mod:p.mod}):this.negative&t.negative?(p=this.neg().divmod(t.neg(),i),i!=="div"&&(c=p.mod.neg(),s&&c.negative!==0&&c.isub(t)),{div:p.div,mod:c}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:t.length===1?i==="div"?{div:this.divn(t.words[0]),mod:null}:i==="mod"?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,i)},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var i=this.divmod(t);if(i.mod.isZero())return i.div;var s=i.div.negative!==0?i.mod.isub(t):i.mod,l=t.ushrn(1),c=t.andln(1),p=s.cmp(l);return p<0||c===1&&p===0?i.div:i.div.negative!==0?i.div.isubn(1):i.div.iaddn(1)},o.prototype.modn=function(t){u(t<=67108863);for(var i=(1<<26)%t,s=0,l=this.length-1;l>=0;l--)s=(i*s+(this.words[l]|0))%t;return s},o.prototype.idivn=function(t){u(t<=67108863);for(var i=0,s=this.length-1;s>=0;s--){var l=(this.words[s]|0)+i*67108864;this.words[s]=l/t|0,i=l%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){u(t.negative===0),u(!t.isZero());var i=this,s=t.clone();i.negative!==0?i=i.umod(t):i=i.clone();for(var l=new o(1),c=new o(0),p=new o(0),d=new o(1),r=0;i.isEven()&&s.isEven();)i.iushrn(1),s.iushrn(1),++r;for(var f=s.clone(),m=i.clone();!i.isZero();){for(var _=0,R=1;!(i.words[0]&R)&&_<26;++_,R<<=1);if(_>0)for(i.iushrn(_);_-- >0;)(l.isOdd()||c.isOdd())&&(l.iadd(f),c.isub(m)),l.iushrn(1),c.iushrn(1);for(var C=0,F=1;!(s.words[0]&F)&&C<26;++C,F<<=1);if(C>0)for(s.iushrn(C);C-- >0;)(p.isOdd()||d.isOdd())&&(p.iadd(f),d.isub(m)),p.iushrn(1),d.iushrn(1);i.cmp(s)>=0?(i.isub(s),l.isub(p),c.isub(d)):(s.isub(i),p.isub(l),d.isub(c))}return{a:p,b:d,gcd:s.iushln(r)}},o.prototype._invmp=function(t){u(t.negative===0),u(!t.isZero());var i=this,s=t.clone();i.negative!==0?i=i.umod(t):i=i.clone();for(var l=new o(1),c=new o(0),p=s.clone();i.cmpn(1)>0&&s.cmpn(1)>0;){for(var d=0,r=1;!(i.words[0]&r)&&d<26;++d,r<<=1);if(d>0)for(i.iushrn(d);d-- >0;)l.isOdd()&&l.iadd(p),l.iushrn(1);for(var f=0,m=1;!(s.words[0]&m)&&f<26;++f,m<<=1);if(f>0)for(s.iushrn(f);f-- >0;)c.isOdd()&&c.iadd(p),c.iushrn(1);i.cmp(s)>=0?(i.isub(s),l.isub(c)):(s.isub(i),c.isub(l))}var _;return i.cmpn(1)===0?_=l:_=c,_.cmpn(0)<0&&_.iadd(t),_},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var i=this.clone(),s=t.clone();i.negative=0,s.negative=0;for(var l=0;i.isEven()&&s.isEven();l++)i.iushrn(1),s.iushrn(1);do{for(;i.isEven();)i.iushrn(1);for(;s.isEven();)s.iushrn(1);var c=i.cmp(s);if(c<0){var p=i;i=s,s=p}else if(c===0||s.cmpn(1)===0)break;i.isub(s)}while(!0);return s.iushln(l)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return(this.words[0]&1)===0},o.prototype.isOdd=function(){return(this.words[0]&1)===1},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){u(typeof t=="number");var i=t%26,s=(t-i)/26,l=1<<i;if(this.length<=s)return this._expand(s+1),this.words[s]|=l,this;for(var c=l,p=s;c!==0&&p<this.length;p++){var d=this.words[p]|0;d+=c,c=d>>>26,d&=67108863,this.words[p]=d}return c!==0&&(this.words[p]=c,this.length++),this},o.prototype.isZero=function(){return this.length===1&&this.words[0]===0},o.prototype.cmpn=function(t){var i=t<0;if(this.negative!==0&&!i)return-1;if(this.negative===0&&i)return 1;this.strip();var s;if(this.length>1)s=1;else{i&&(t=-t),u(t<=67108863,"Number is too big");var l=this.words[0]|0;s=l===t?0:l<t?-1:1}return this.negative!==0?-s|0:s},o.prototype.cmp=function(t){if(this.negative!==0&&t.negative===0)return-1;if(this.negative===0&&t.negative!==0)return 1;var i=this.ucmp(t);return this.negative!==0?-i|0:i},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var i=0,s=this.length-1;s>=0;s--){var l=this.words[s]|0,c=t.words[s]|0;if(l!==c){l<c?i=-1:l>c&&(i=1);break}}return i},o.prototype.gtn=function(t){return this.cmpn(t)===1},o.prototype.gt=function(t){return this.cmp(t)===1},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return this.cmpn(t)===-1},o.prototype.lt=function(t){return this.cmp(t)===-1},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return this.cmpn(t)===0},o.prototype.eq=function(t){return this.cmp(t)===0},o.red=function(t){return new dt(t)},o.prototype.toRed=function(t){return u(!this.red,"Already a number in reduction context"),u(this.negative===0,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return u(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return u(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return u(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return u(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return u(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return u(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return u(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return u(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return u(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return u(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return u(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return u(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return u(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return u(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return u(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var T={k256:null,p224:null,p192:null,p25519:null};function O(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}O.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},O.prototype.ireduce=function(t){var i=t,s;do this.split(i,this.tmp),i=this.imulK(i),i=i.iadd(this.tmp),s=i.bitLength();while(s>this.n);var l=s<this.n?-1:i.ucmp(this.p);return l===0?(i.words[0]=0,i.length=1):l>0?i.isub(this.p):i.strip!==void 0?i.strip():i._strip(),i},O.prototype.split=function(t,i){t.iushrn(this.n,0,i)},O.prototype.imulK=function(t){return t.imul(this.k)};function W(){O.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}v(W,O),W.prototype.split=function(t,i){for(var s=4194303,l=Math.min(t.length,9),c=0;c<l;c++)i.words[c]=t.words[c];if(i.length=l,t.length<=9){t.words[0]=0,t.length=1;return}var p=t.words[9];for(i.words[i.length++]=p&s,c=10;c<t.length;c++){var d=t.words[c]|0;t.words[c-10]=(d&s)<<4|p>>>22,p=d}p>>>=22,t.words[c-10]=p,p===0&&t.length>10?t.length-=10:t.length-=9},W.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var i=0,s=0;s<t.length;s++){var l=t.words[s]|0;i+=l*977,t.words[s]=i&67108863,i=l*64+(i/67108864|0)}return t.words[t.length-1]===0&&(t.length--,t.words[t.length-1]===0&&t.length--),t};function K(){O.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}v(K,O);function pt(){O.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}v(pt,O);function ct(){O.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}v(ct,O),ct.prototype.imulK=function(t){for(var i=0,s=0;s<t.length;s++){var l=(t.words[s]|0)*19+i,c=l&67108863;l>>>=26,t.words[s]=c,i=l}return i!==0&&(t.words[t.length++]=i),t},o._prime=function(t){if(T[t])return T[t];var i;if(t==="k256")i=new W;else if(t==="p224")i=new K;else if(t==="p192")i=new pt;else if(t==="p25519")i=new ct;else throw new Error("Unknown prime "+t);return T[t]=i,i};function dt(e){if(typeof e=="string"){var t=o._prime(e);this.m=t.p,this.prime=t}else u(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}dt.prototype._verify1=function(t){u(t.negative===0,"red works only with positives"),u(t.red,"red works only with red numbers")},dt.prototype._verify2=function(t,i){u((t.negative|i.negative)===0,"red works only with positives"),u(t.red&&t.red===i.red,"red works only with red numbers")},dt.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},dt.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},dt.prototype.add=function(t,i){this._verify2(t,i);var s=t.add(i);return s.cmp(this.m)>=0&&s.isub(this.m),s._forceRed(this)},dt.prototype.iadd=function(t,i){this._verify2(t,i);var s=t.iadd(i);return s.cmp(this.m)>=0&&s.isub(this.m),s},dt.prototype.sub=function(t,i){this._verify2(t,i);var s=t.sub(i);return s.cmpn(0)<0&&s.iadd(this.m),s._forceRed(this)},dt.prototype.isub=function(t,i){this._verify2(t,i);var s=t.isub(i);return s.cmpn(0)<0&&s.iadd(this.m),s},dt.prototype.shl=function(t,i){return this._verify1(t),this.imod(t.ushln(i))},dt.prototype.imul=function(t,i){return this._verify2(t,i),this.imod(t.imul(i))},dt.prototype.mul=function(t,i){return this._verify2(t,i),this.imod(t.mul(i))},dt.prototype.isqr=function(t){return this.imul(t,t.clone())},dt.prototype.sqr=function(t){return this.mul(t,t)},dt.prototype.sqrt=function(t){if(t.isZero())return t.clone();var i=this.m.andln(3);if(u(i%2===1),i===3){var s=this.m.add(new o(1)).iushrn(2);return this.pow(t,s)}for(var l=this.m.subn(1),c=0;!l.isZero()&&l.andln(1)===0;)c++,l.iushrn(1);u(!l.isZero());var p=new o(1).toRed(this),d=p.redNeg(),r=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new o(2*f*f).toRed(this);this.pow(f,r).cmp(d)!==0;)f.redIAdd(d);for(var m=this.pow(f,l),_=this.pow(t,l.addn(1).iushrn(1)),R=this.pow(t,l),C=c;R.cmp(p)!==0;){for(var F=R,z=0;F.cmp(p)!==0;z++)F=F.redSqr();u(z<C);var lt=this.pow(m,new o(1).iushln(C-z-1));_=_.redMul(lt),m=lt.redSqr(),R=R.redMul(m),C=z}return _},dt.prototype.invm=function(t){var i=t._invmp(this.m);return i.negative!==0?(i.negative=0,this.imod(i).redNeg()):this.imod(i)},dt.prototype.pow=function(t,i){if(i.isZero())return new o(1).toRed(this);if(i.cmpn(1)===0)return t.clone();var s=4,l=new Array(1<<s);l[0]=new o(1).toRed(this),l[1]=t;for(var c=2;c<l.length;c++)l[c]=this.mul(l[c-1],t);var p=l[0],d=0,r=0,f=i.bitLength()%26;for(f===0&&(f=26),c=i.length-1;c>=0;c--){for(var m=i.words[c],_=f-1;_>=0;_--){var R=m>>_&1;if(p!==l[0]&&(p=this.sqr(p)),R===0&&d===0){r=0;continue}d<<=1,d|=R,r++,!(r!==s&&(c!==0||_!==0))&&(p=this.mul(p,l[d]),r=0,d=0)}f=26}return p},dt.prototype.convertTo=function(t){var i=t.umod(this.m);return i===t?i.clone():i},dt.prototype.convertFrom=function(t){var i=t.clone();return i.red=null,i},o.mont=function(t){return new g(t)};function g(e){dt.call(this,e),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v(g,dt),g.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},g.prototype.convertFrom=function(t){var i=this.imod(t.mul(this.rinv));return i.red=null,i},g.prototype.imul=function(t,i){if(t.isZero()||i.isZero())return t.words[0]=0,t.length=1,t;var s=t.imul(i),l=s.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),c=s.isub(l).iushrn(this.shift),p=c;return c.cmp(this.m)>=0?p=c.isub(this.m):c.cmpn(0)<0&&(p=c.iadd(this.m)),p._forceRed(this)},g.prototype.mul=function(t,i){if(t.isZero()||i.isZero())return new o(0)._forceRed(this);var s=t.mul(i),l=s.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),c=s.isub(l).iushrn(this.shift),p=c;return c.cmp(this.m)>=0?p=c.isub(this.m):c.cmpn(0)<0&&(p=c.iadd(this.m)),p._forceRed(this)},g.prototype.invm=function(t){var i=this.imod(t._invmp(this.m).mul(this.r2));return i._forceRed(this)}})(a,Vt)})(so);var js=so.exports,Pr=js,yd=Gi.ec,ho=new yd("secp256k1"),ni=ho.curve;Yi.privateKeyExport=function(a,n){var h=new Pr(a);if(h.ucmp(ni.n)>=0)throw new Error("couldn't export to DER format");var u=ho.g.mul(h);return Ys(u.getX(),u.getY(),n)};Yi.privateKeyModInverse=function(a){var n=new Pr(a);if(n.ucmp(ni.n)>=0||n.isZero())throw new Error("private key range is invalid");return n.invm(ni.n).toArrayLike(X,"be",32)};Yi.signatureImport=function(a){var n=new Pr(a.r);n.ucmp(ni.n)>=0&&(n=new Pr(0));var h=new Pr(a.s);return h.ucmp(ni.n)>=0&&(h=new Pr(0)),X.concat([n.toArrayLike(X,"be",32),h.toArrayLike(X,"be",32)])};Yi.ecdhUnsafe=function(a,n,h){var u=ho.keyFromPublic(a),v=new Pr(n);if(v.ucmp(ni.n)>=0||v.isZero())throw new Error("scalar was invalid (zero or overflow)");var o=u.pub.mul(v);return Ys(o.getX(),o.getY(),h)};var Ys=function(n,h,u){var v=void 0;return u?(v=X.alloc(33),v[0]=h.isOdd()?3:2,n.toArrayLike(X,"be",32).copy(v,1)):(v=X.alloc(65),v[0]=4,n.toArrayLike(X,"be",32).copy(v,1),h.toArrayLike(X,"be",32).copy(v,33)),v},Gn={},wd=X.from([48,129,211,2,1,1,4,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,129,133,48,129,130,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,33,2,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,36,3,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),bd=X.from([48,130,1,19,2,1,1,4,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,129,165,48,129,162,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,65,4,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,72,58,218,119,38,163,196,101,93,164,251,252,14,17,8,168,253,23,180,72,166,133,84,25,156,71,208,143,251,16,212,184,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,68,3,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);Gn.privateKeyExport=function(a,n,h){var u=X.from(h?wd:bd);return a.copy(u,h?8:9),n.copy(u,h?181:214),u};Gn.privateKeyImport=function(a){var n=a.length,h=0;if(n<h+1||a[h]!==48||(h+=1,n<h+1||!(a[h]&128)))return null;var u=a[h]&127;if(h+=1,u<1||u>2||n<h+u)return null;var v=a[h+u-1]|(u>1?a[h+u-2]<<8:0);return h+=u,n<h+v||n<h+3||a[h]!==2||a[h+1]!==1||a[h+2]!==1||(h+=3,n<h+2||a[h]!==4||a[h+1]>32||n<h+2+a[h+1])?null:a.slice(h+2,h+2+a[h+1])};Gn.signatureImportLax=function(a){var n=X.alloc(32,0),h=X.alloc(32,0),u=a.length,v=0;if(a[v++]!==48)return null;var o=a[v++];if(o&128&&(v+=o-128,v>u)||a[v++]!==2)return null;var w=a[v++];if(w&128){if(o=w-128,v+o>u)return null;for(;o>0&&a[v]===0;v+=1,o-=1);for(w=0;o>0;v+=1,o-=1)w=(w<<8)+a[v]}if(w>u-v)return null;var y=v;if(v+=w,a[v++]!==2)return null;var b=a[v++];if(b&128){if(o=b-128,v+o>u)return null;for(;o>0&&a[v]===0;v+=1,o-=1);for(b=0;o>0;v+=1,o-=1)b=(b<<8)+a[v]}if(b>u-v)return null;var B=v;for(v+=b;w>0&&a[y]===0;w-=1,y+=1);if(w>32)return null;var k=a.slice(y,y+w);for(k.copy(n,32-k.length);b>0&&a[B]===0;b-=1,B+=1);if(b>32)return null;var L=a.slice(B,B+b);return L.copy(h,32-L.length),{r:n,s:h}};var Ie=Fs,Jn=Yi,uo=Gn,Xs=function(n){return n.length!==32?!1:Ie.privateKeyVerify(Uint8Array.from(n))},Md=function(n,h){if(n.length!==32)throw new RangeError("private key length is invalid");var u=Jn.privateKeyExport(n,h);return uo.privateKeyExport(n,u,h)},xd=function(n){if(n=uo.privateKeyImport(n),n!==null&&n.length===32&&Xs(n))return n;throw new Error("couldn't import from DER format")},_d=function(n){return X.from(Ie.privateKeyNegate(Uint8Array.from(n)))},Sd=function(n){if(n.length!==32)throw new Error("private key length is invalid");return X.from(Jn.privateKeyModInverse(Uint8Array.from(n)))},Ad=function(n,h){return X.from(Ie.privateKeyTweakAdd(Uint8Array.from(n),h))},Ed=function(n,h){return X.from(Ie.privateKeyTweakMul(Uint8Array.from(n),Uint8Array.from(h)))},kd=function(n,h){return X.from(Ie.publicKeyCreate(Uint8Array.from(n),h))},Rd=function(n,h){return X.from(Ie.publicKeyConvert(Uint8Array.from(n),h))},Bd=function(n){return n.length!==33&&n.length!==65?!1:Ie.publicKeyVerify(Uint8Array.from(n))},Id=function(n,h,u){return X.from(Ie.publicKeyTweakAdd(Uint8Array.from(n),Uint8Array.from(h),u))},Td=function(n,h,u){return X.from(Ie.publicKeyTweakMul(Uint8Array.from(n),Uint8Array.from(h),u))},Cd=function(n,h){var u=[];return n.forEach(function(v){u.push(Uint8Array.from(v))}),X.from(Ie.publicKeyCombine(u,h))},Ld=function(n){return X.from(Ie.signatureNormalize(Uint8Array.from(n)))},Pd=function(n){return X.from(Ie.signatureExport(Uint8Array.from(n)))},Od=function(n){return X.from(Ie.signatureImport(Uint8Array.from(n)))},Nd=function(n){if(n.length===0)throw new RangeError("signature length is invalid");var h=uo.signatureImportLax(n);if(h===null)throw new Error("couldn't parse DER signature");return Jn.signatureImport(h)},qd=function(n,h,u){if(u===null)throw new TypeError("options should be an Object");var v=void 0;if(u){if(v={},u.data===null)throw new TypeError("options.data should be a Buffer");if(u.data){if(u.data.length!==32)throw new RangeError("options.data length is invalid");v.data=new Uint8Array(u.data)}if(u.noncefn===null)throw new TypeError("options.noncefn should be a Function");u.noncefn&&(v.noncefn=function(w,y,b,B,k){var L=b!=null?X.from(b):null,q=B!=null?X.from(B):null,$=X.from("");return u.noncefn&&($=u.noncefn(X.from(w),X.from(y),L,q,k)),Uint8Array.from($)})}var o=Ie.ecdsaSign(Uint8Array.from(n),Uint8Array.from(h),v);return{signature:X.from(o.signature),recovery:o.recid}},Ud=function(n,h,u){return Ie.ecdsaVerify(Uint8Array.from(h),Uint8Array.from(n),u)},Fd=function(n,h,u,v){return X.from(Ie.ecdsaRecover(Uint8Array.from(h),u,Uint8Array.from(n),v))},$d=function(n,h){return X.from(Ie.ecdh(Uint8Array.from(n),Uint8Array.from(h),{}))},zd=function(n,h,u){if(n.length!==33&&n.length!==65)throw new RangeError("public key length is invalid");if(h.length!==32)throw new RangeError("private key length is invalid");return X.from(Jn.ecdhUnsafe(Uint8Array.from(n),Uint8Array.from(h),u))},Dd={privateKeyVerify:Xs,privateKeyExport:Md,privateKeyImport:xd,privateKeyNegate:_d,privateKeyModInverse:Sd,privateKeyTweakAdd:Ad,privateKeyTweakMul:Ed,publicKeyCreate:kd,publicKeyConvert:Rd,publicKeyVerify:Bd,publicKeyTweakAdd:Id,publicKeyTweakMul:Td,publicKeyCombine:Cd,signatureNormalize:Ld,signatureExport:Pd,signatureImport:Od,signatureImportLax:Nd,sign:qd,verify:Ud,recover:Fd,ecdh:$d,ecdhUnsafe:zd},Ge={},Hd=Vt&&Vt.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(Ge,"__esModule",{value:!0});Ge.getLength=Ge.decode=Ge.encode=void 0;var Kd=Hd(Gl);function Qs(a){if(Array.isArray(a)){for(var n=[],h=0;h<a.length;h++)n.push(Qs(a[h]));var u=X.concat(n);return X.concat([b0(u.length,192),u])}else{var v=lo(a);return v.length===1&&v[0]<128?v:X.concat([b0(v.length,128),v])}}Ge.encode=Qs;function ff(a,n){if(a[0]==="0"&&a[1]==="0")throw new Error("invalid RLP: extra zeros");return parseInt(a,n)}function b0(a,n){if(a<56)return X.from([a+n]);var h=sf(a),u=h.length/2,v=sf(n+55+u);return X.from(v+h,"hex")}function Zd(a,n){if(n===void 0&&(n=!1),!a||a.length===0)return X.from([]);var h=lo(a),u=of(h);if(n)return u;if(u.remainder.length!==0)throw new Error("invalid remainder");return u.data}Ge.decode=Zd;function Wd(a){if(!a||a.length===0)return X.from([]);var n=lo(a),h=n[0];if(h<=127)return n.length;if(h<=183)return h-127;if(h<=191)return h-182;if(h<=247)return h-191;var u=h-246,v=ff(n.slice(1,u).toString("hex"),16);return u+v}Ge.getLength=Wd;function of(a){var n,h,u,v,o,w=[],y=a[0];if(y<=127)return{data:a.slice(0,1),remainder:a.slice(1)};if(y<=183){if(n=y-127,y===128?u=X.from([]):u=a.slice(1,n),n===2&&u[0]<128)throw new Error("invalid rlp encoding: byte must be less 0x80");return{data:u,remainder:a.slice(n)}}else if(y<=191){if(h=y-182,a.length-1<h)throw new Error("invalid RLP: not enough bytes for string length");if(n=ff(a.slice(1,h).toString("hex"),16),n<=55)throw new Error("invalid RLP: expected string length to be greater than 55");if(u=a.slice(h,n+h),u.length<n)throw new Error("invalid RLP: not enough bytes for string");return{data:u,remainder:a.slice(n+h)}}else if(y<=247){for(n=y-191,v=a.slice(1,n);v.length;)o=of(v),w.push(o.data),v=o.remainder;return{data:w,remainder:a.slice(n)}}else{h=y-246,n=ff(a.slice(1,h).toString("hex"),16);var b=h+n;if(b>a.length)throw new Error("invalid rlp: total length is larger than the data");if(v=a.slice(h,b),v.length===0)throw new Error("invalid rlp, List has a invalid length");for(;v.length;)o=of(v),w.push(o.data),v=o.remainder;return{data:w,remainder:a.slice(b)}}}function th(a){return a.slice(0,2)==="0x"}function Vd(a){return typeof a!="string"?a:th(a)?a.slice(2):a}function sf(a){if(a<0)throw new Error("Invalid integer as argument, must be unsigned!");var n=a.toString(16);return n.length%2?"0"+n:n}function Gd(a){return a.length%2?"0"+a:a}function Jd(a){var n=sf(a);return X.from(n,"hex")}function lo(a){if(!X.isBuffer(a)){if(typeof a=="string")return th(a)?X.from(Gd(Vd(a)),"hex"):X.from(a);if(typeof a=="number"||typeof a=="bigint")return a?Jd(a):X.from([]);if(a==null)return X.from([]);if(a instanceof Uint8Array)return X.from(a);if(Kd.default.isBN(a))return X.from(a.toArray());throw new Error("invalid type")}return a}var kn=Di.Buffer,eh=rc.Transform,jd=cr;function Yd(a,n){if(!kn.isBuffer(a)&&typeof a!="string")throw new TypeError(n+" must be a string or a buffer")}function Ar(a){eh.call(this),this._block=kn.allocUnsafe(a),this._blockSize=a,this._blockOffset=0,this._length=[0,0,0,0],this._finalized=!1}jd(Ar,eh);Ar.prototype._transform=function(a,n,h){var u=null;try{this.update(a,n)}catch(v){u=v}h(u)};Ar.prototype._flush=function(a){var n=null;try{this.push(this.digest())}catch(h){n=h}a(n)};Ar.prototype.update=function(a,n){if(Yd(a,"Data"),this._finalized)throw new Error("Digest already called");kn.isBuffer(a)||(a=kn.from(a,n));for(var h=this._block,u=0;this._blockOffset+a.length-u>=this._blockSize;){for(var v=this._blockOffset;v<this._blockSize;)h[v++]=a[u++];this._update(),this._blockOffset=0}for(;u<a.length;)h[this._blockOffset++]=a[u++];for(var o=0,w=a.length*8;w>0;++o)this._length[o]+=w,w=this._length[o]/4294967296|0,w>0&&(this._length[o]-=4294967296*w);return this};Ar.prototype._update=function(){throw new Error("_update is not implemented")};Ar.prototype.digest=function(a){if(this._finalized)throw new Error("Digest already called");this._finalized=!0;var n=this._digest();a!==void 0&&(n=n.toString(a)),this._block.fill(0),this._blockOffset=0;for(var h=0;h<4;++h)this._length[h]=0;return n};Ar.prototype._digest=function(){throw new Error("_digest is not implemented")};var rh=Ar,Xd=cr,ih=rh,Qd=Di.Buffer,tv=new Array(16);function jn(){ih.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878}Xd(jn,ih);jn.prototype._update=function(){for(var a=tv,n=0;n<16;++n)a[n]=this._block.readInt32LE(n*4);var h=this._a,u=this._b,v=this._c,o=this._d;h=Ce(h,u,v,o,a[0],3614090360,7),o=Ce(o,h,u,v,a[1],3905402710,12),v=Ce(v,o,h,u,a[2],606105819,17),u=Ce(u,v,o,h,a[3],3250441966,22),h=Ce(h,u,v,o,a[4],4118548399,7),o=Ce(o,h,u,v,a[5],1200080426,12),v=Ce(v,o,h,u,a[6],2821735955,17),u=Ce(u,v,o,h,a[7],4249261313,22),h=Ce(h,u,v,o,a[8],1770035416,7),o=Ce(o,h,u,v,a[9],2336552879,12),v=Ce(v,o,h,u,a[10],4294925233,17),u=Ce(u,v,o,h,a[11],2304563134,22),h=Ce(h,u,v,o,a[12],1804603682,7),o=Ce(o,h,u,v,a[13],4254626195,12),v=Ce(v,o,h,u,a[14],2792965006,17),u=Ce(u,v,o,h,a[15],1236535329,22),h=Le(h,u,v,o,a[1],4129170786,5),o=Le(o,h,u,v,a[6],3225465664,9),v=Le(v,o,h,u,a[11],643717713,14),u=Le(u,v,o,h,a[0],3921069994,20),h=Le(h,u,v,o,a[5],3593408605,5),o=Le(o,h,u,v,a[10],38016083,9),v=Le(v,o,h,u,a[15],3634488961,14),u=Le(u,v,o,h,a[4],3889429448,20),h=Le(h,u,v,o,a[9],568446438,5),o=Le(o,h,u,v,a[14],3275163606,9),v=Le(v,o,h,u,a[3],4107603335,14),u=Le(u,v,o,h,a[8],1163531501,20),h=Le(h,u,v,o,a[13],2850285829,5),o=Le(o,h,u,v,a[2],4243563512,9),v=Le(v,o,h,u,a[7],1735328473,14),u=Le(u,v,o,h,a[12],2368359562,20),h=Pe(h,u,v,o,a[5],4294588738,4),o=Pe(o,h,u,v,a[8],2272392833,11),v=Pe(v,o,h,u,a[11],1839030562,16),u=Pe(u,v,o,h,a[14],4259657740,23),h=Pe(h,u,v,o,a[1],2763975236,4),o=Pe(o,h,u,v,a[4],1272893353,11),v=Pe(v,o,h,u,a[7],4139469664,16),u=Pe(u,v,o,h,a[10],3200236656,23),h=Pe(h,u,v,o,a[13],681279174,4),o=Pe(o,h,u,v,a[0],3936430074,11),v=Pe(v,o,h,u,a[3],3572445317,16),u=Pe(u,v,o,h,a[6],76029189,23),h=Pe(h,u,v,o,a[9],3654602809,4),o=Pe(o,h,u,v,a[12],3873151461,11),v=Pe(v,o,h,u,a[15],530742520,16),u=Pe(u,v,o,h,a[2],3299628645,23),h=Oe(h,u,v,o,a[0],4096336452,6),o=Oe(o,h,u,v,a[7],1126891415,10),v=Oe(v,o,h,u,a[14],2878612391,15),u=Oe(u,v,o,h,a[5],4237533241,21),h=Oe(h,u,v,o,a[12],1700485571,6),o=Oe(o,h,u,v,a[3],2399980690,10),v=Oe(v,o,h,u,a[10],4293915773,15),u=Oe(u,v,o,h,a[1],2240044497,21),h=Oe(h,u,v,o,a[8],1873313359,6),o=Oe(o,h,u,v,a[15],4264355552,10),v=Oe(v,o,h,u,a[6],2734768916,15),u=Oe(u,v,o,h,a[13],1309151649,21),h=Oe(h,u,v,o,a[4],4149444226,6),o=Oe(o,h,u,v,a[11],3174756917,10),v=Oe(v,o,h,u,a[2],718787259,15),u=Oe(u,v,o,h,a[9],3951481745,21),this._a=this._a+h|0,this._b=this._b+u|0,this._c=this._c+v|0,this._d=this._d+o|0};jn.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 a=Qd.allocUnsafe(16);return a.writeInt32LE(this._a,0),a.writeInt32LE(this._b,4),a.writeInt32LE(this._c,8),a.writeInt32LE(this._d,12),a};function Yn(a,n){return a<<n|a>>>32-n}function Ce(a,n,h,u,v,o,w){return Yn(a+(n&h|~n&u)+v+o|0,w)+n|0}function Le(a,n,h,u,v,o,w){return Yn(a+(n&u|h&~u)+v+o|0,w)+n|0}function Pe(a,n,h,u,v,o,w){return Yn(a+(n^h^u)+v+o|0,w)+n|0}function Oe(a,n,h,u,v,o,w){return Yn(a+(h^(n|~u))+v+o|0,w)+n|0}var ev=jn,Na=Ts().Buffer,rv=cr,nh=rh,iv=new Array(16),ki=[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],Ri=[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],Bi=[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],Ii=[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],Ti=[0,1518500249,1859775393,2400959708,2840853838],Ci=[1352829926,1548603684,1836072691,2053994217,0];function Xn(){nh.call(this,64),this._a=1732584193,this._b=4023233417,this._c=2562383102,this._d=271733878,this._e=3285377520}rv(Xn,nh);Xn.prototype._update=function(){for(var a=iv,n=0;n<16;++n)a[n]=this._block.readInt32LE(n*4);for(var h=this._a|0,u=this._b|0,v=this._c|0,o=this._d|0,w=this._e|0,y=this._a|0,b=this._b|0,B=this._c|0,k=this._d|0,L=this._e|0,q=0;q<80;q+=1){var $,M;q<16?($=M0(h,u,v,o,w,a[ki[q]],Ti[0],Bi[q]),M=A0(y,b,B,k,L,a[Ri[q]],Ci[0],Ii[q])):q<32?($=x0(h,u,v,o,w,a[ki[q]],Ti[1],Bi[q]),M=S0(y,b,B,k,L,a[Ri[q]],Ci[1],Ii[q])):q<48?($=_0(h,u,v,o,w,a[ki[q]],Ti[2],Bi[q]),M=_0(y,b,B,k,L,a[Ri[q]],Ci[2],Ii[q])):q<64?($=S0(h,u,v,o,w,a[ki[q]],Ti[3],Bi[q]),M=x0(y,b,B,k,L,a[Ri[q]],Ci[3],Ii[q])):($=A0(h,u,v,o,w,a[ki[q]],Ti[4],Bi[q]),M=M0(y,b,B,k,L,a[Ri[q]],Ci[4],Ii[q])),h=w,w=o,o=$r(v,10),v=u,u=$,y=L,L=k,k=$r(B,10),B=b,b=M}var N=this._b+v+k|0;this._b=this._c+o+L|0,this._c=this._d+w+y|0,this._d=this._e+h+b|0,this._e=this._a+u+B|0,this._a=N};Xn.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 a=Na.alloc?Na.alloc(20):new Na(20);return a.writeInt32LE(this._a,0),a.writeInt32LE(this._b,4),a.writeInt32LE(this._c,8),a.writeInt32LE(this._d,12),a.writeInt32LE(this._e,16),a};function $r(a,n){return a<<n|a>>>32-n}function M0(a,n,h,u,v,o,w,y){return $r(a+(n^h^u)+o+w|0,y)+v|0}function x0(a,n,h,u,v,o,w,y){return $r(a+(n&h|~n&u)+o+w|0,y)+v|0}function _0(a,n,h,u,v,o,w,y){return $r(a+((n|~h)^u)+o+w|0,y)+v|0}function S0(a,n,h,u,v,o,w,y){return $r(a+(n&u|h&~u)+o+w|0,y)+v|0}function A0(a,n,h,u,v,o,w,y){return $r(a+(n^(h|~u))+o+w|0,y)+v|0}var nv=Xn,ah=Di.Buffer,fh=Se.Transform,av=ic.StringDecoder,fv=cr;function er(a){fh.call(this),this.hashMode=typeof a=="string",this.hashMode?this[a]=this._finalOrDigest:this.final=this._finalOrDigest,this._final&&(this.__final=this._final,this._final=null),this._decoder=null,this._encoding=null}fv(er,fh);er.prototype.update=function(a,n,h){typeof a=="string"&&(a=ah.from(a,n));var u=this._update(a);return this.hashMode?this:(h&&(u=this._toString(u,h)),u)};er.prototype.setAutoPadding=function(){};er.prototype.getAuthTag=function(){throw new Error("trying to get auth tag in unsupported state")};er.prototype.setAuthTag=function(){throw new Error("trying to set auth tag in unsupported state")};er.prototype.setAAD=function(){throw new Error("trying to set aad in unsupported state")};er.prototype._transform=function(a,n,h){var u;try{this.hashMode?this._update(a):this.push(this._update(a))}catch(v){u=v}finally{h(u)}};er.prototype._flush=function(a){var n;try{this.push(this.__final())}catch(h){n=h}a(n)};er.prototype._finalOrDigest=function(a){var n=this.__final()||ah.alloc(0);return a&&(n=this._toString(n,a,!0)),n};er.prototype._toString=function(a,n,h){if(this._decoder||(this._decoder=new av(n),this._encoding=n),this._encoding!==n)throw new Error("can't switch encodings");var u=this._decoder.write(a);return h&&(u+=this._decoder.end()),u};var ov=er,sv=cr,hv=ev,uv=nv,lv=nc,oh=ov;function Qn(a){oh.call(this,"digest"),this._hash=a}sv(Qn,oh);Qn.prototype._update=function(a){this._hash.update(a)};Qn.prototype._final=function(){return this._hash.digest()};var co=function(n){return n=n.toLowerCase(),n==="md5"?new hv:n==="rmd160"||n==="ripemd160"?new uv:new Qn(lv(n))},hf={exports:{}};(function(a,n){var h=Ts(),u=h.Buffer;function v(w,y){for(var b in w)y[b]=w[b]}u.from&&u.alloc&&u.allocUnsafe&&u.allocUnsafeSlow?a.exports=h:(v(h,n),n.Buffer=o);function o(w,y,b){return u(w,y,b)}v(u,o),o.from=function(w,y,b){if(typeof w=="number")throw new TypeError("Argument must not be a number");return u(w,y,b)},o.alloc=function(w,y,b){if(typeof w!="number")throw new TypeError("Argument must be a number");var B=u(w);return y!==void 0?typeof b=="string"?B.fill(y,b):B.fill(y):B.fill(0),B},o.allocUnsafe=function(w){if(typeof w!="number")throw new TypeError("Argument must be a number");return u(w)},o.allocUnsafeSlow=function(w){if(typeof w!="number")throw new TypeError("Argument must be a number");return h.SlowBuffer(w)}})(hf,hf.exports);var cv=hf.exports,sh=function(n){if(typeof n!="string")throw new Error("[is-hex-prefixed] value must be type 'string', is currently type "+typeof n+", while checking isHexPrefixed.");return n.slice(0,2)==="0x"},dv=sh,vv=function(n){return typeof n!="string"?n:dv(n)?n.slice(2):n},pv=sh,hh=vv;function ta(a){var n=a;if(typeof n!="string")throw new Error("[ethjs-util] while padding to even, value must be string, is currently "+typeof n+", while padToEven.");return n.length%2&&(n="0"+n),n}function uh(a){var n=a.toString(16);return"0x"+n}function mv(a){var n=uh(a);return new X(ta(n.slice(2)),"hex")}function gv(a){if(typeof a!="string")throw new Error("[ethjs-util] while getting binary size, method getBinarySize requires input 'str' to be type String, got '"+typeof a+"'.");return X.byteLength(a,"utf8")}function yv(a,n,h){if(Array.isArray(a)!==!0)throw new Error("[ethjs-util] method arrayContainsArray requires input 'superset' to be an array got type '"+typeof a+"'");if(Array.isArray(n)!==!0)throw new Error("[ethjs-util] method arrayContainsArray requires input 'subset' to be an array got type '"+typeof n+"'");return n[!!h&&"some"||"every"](function(u){return a.indexOf(u)>=0})}function wv(a){var n=new X(ta(hh(a).replace(/^0+|0+$/g,"")),"hex");return n.toString("utf8")}function bv(a){var n="",h=0,u=a.length;for(a.substring(0,2)==="0x"&&(h=2);h<u;h+=2){var v=parseInt(a.substr(h,2),16);n+=String.fromCharCode(v)}return n}function Mv(a){var n=new X(a,"utf8");return"0x"+ta(n.toString("hex")).replace(/^0+|0+$/g,"")}function xv(a){for(var n="",h=0;h<a.length;h++){var u=a.charCodeAt(h),v=u.toString(16);n+=v.length<2?"0"+v:v}return"0x"+n}function _v(a,n,h){if(!Array.isArray(a))throw new Error("[ethjs-util] method getKeys expecting type Array as 'params' input, got '"+typeof a+"'");if(typeof n!="string")throw new Error("[ethjs-util] method getKeys expecting type String for input 'key' got '"+typeof n+"'.");for(var u=[],v=0;v<a.length;v++){var o=a[v][n];if(h&&!o)o="";else if(typeof o!="string")throw new Error("invalid abi");u.push(o)}return u}function Sv(a,n){return!(typeof a!="string"||!a.match(/^0x[0-9A-Fa-f]*$/)||n&&a.length!==2+2*n)}var Hr={arrayContainsArray:yv,intToBuffer:mv,getBinarySize:gv,isHexPrefixed:pv,stripHexPrefix:hh,padToEven:ta,intToHex:uh,fromAscii:xv,fromUtf8:Mv,toAscii:bv,toUtf8:wv,getKeys:_v,isHexString:Sv};(function(a){var n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(M){return typeof M}:function(M){return M&&typeof Symbol=="function"&&M.constructor===Symbol&&M!==Symbol.prototype?"symbol":typeof M},h=vi,u=h.keccak224,v=h.keccak384,o=h.keccak256,w=h.keccak512,y=Dd,b=Se,B=Ge,k=js,L=co,q=cv.Buffer;Object.assign(a,Hr),a.MAX_INTEGER=new k("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),a.TWO_POW256=new k("10000000000000000000000000000000000000000000000000000000000000000",16),a.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",a.SHA3_NULL_S=a.KECCAK256_NULL_S,a.KECCAK256_NULL=q.from(a.KECCAK256_NULL_S,"hex"),a.SHA3_NULL=a.KECCAK256_NULL,a.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",a.SHA3_RLP_ARRAY_S=a.KECCAK256_RLP_ARRAY_S,a.KECCAK256_RLP_ARRAY=q.from(a.KECCAK256_RLP_ARRAY_S,"hex"),a.SHA3_RLP_ARRAY=a.KECCAK256_RLP_ARRAY,a.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",a.SHA3_RLP_S=a.KECCAK256_RLP_S,a.KECCAK256_RLP=q.from(a.KECCAK256_RLP_S,"hex"),a.SHA3_RLP=a.KECCAK256_RLP,a.BN=k,a.rlp=B,a.secp256k1=y,a.zeros=function(M){return q.allocUnsafe(M).fill(0)},a.zeroAddress=function(){var M=20,N=a.zeros(M);return a.bufferToHex(N)},a.setLengthLeft=a.setLength=function(M,N,x){var A=a.zeros(N);return M=a.toBuffer(M),x?M.length<N?(M.copy(A),A):M.slice(0,N):M.length<N?(M.copy(A,N-M.length),A):M.slice(-N)},a.setLengthRight=function(M,N){return a.setLength(M,N,!0)},a.unpad=a.stripZeros=function(M){M=a.stripHexPrefix(M);for(var N=M[0];M.length>0&&N.toString()==="0";)M=M.slice(1),N=M[0];return M},a.toBuffer=function(M){if(!q.isBuffer(M))if(Array.isArray(M))M=q.from(M);else if(typeof M=="string")a.isHexString(M)?M=q.from(a.padToEven(a.stripHexPrefix(M)),"hex"):M=q.from(M);else if(typeof M=="number")M=a.intToBuffer(M);else if(M==null)M=q.allocUnsafe(0);else if(k.isBN(M))M=M.toArrayLike(q);else if(M.toArray)M=q.from(M.toArray());else throw new Error("invalid type");return M},a.bufferToInt=function(M){return new k(a.toBuffer(M)).toNumber()},a.bufferToHex=function(M){return M=a.toBuffer(M),"0x"+M.toString("hex")},a.fromSigned=function(M){return new k(M).fromTwos(256)},a.toUnsigned=function(M){return q.from(M.toTwos(256).toArray())},a.keccak=function(M,N){switch(M=a.toBuffer(M),N||(N=256),N){case 224:return u(M);case 256:return o(M);case 384:return v(M);case 512:return w(M);default:throw new Error("Invald algorithm: keccak"+N)}},a.keccak256=function(M){return a.keccak(M)},a.sha3=a.keccak,a.sha256=function(M){return M=a.toBuffer(M),L("sha256").update(M).digest()},a.ripemd160=function(M,N){M=a.toBuffer(M);var x=L("rmd160").update(M).digest();return N===!0?a.setLength(x,32):x},a.rlphash=function(M){return a.keccak(B.encode(M))},a.isValidPrivate=function(M){return y.privateKeyVerify(M)},a.isValidPublic=function(M,N){return M.length===64?y.publicKeyVerify(q.concat([q.from([4]),M])):N?y.publicKeyVerify(M):!1},a.pubToAddress=a.publicToAddress=function(M,N){return M=a.toBuffer(M),N&&M.length!==64&&(M=y.publicKeyConvert(M,!1).slice(1)),b(M.length===64),a.keccak(M).slice(-20)};var $=a.privateToPublic=function(M){return M=a.toBuffer(M),y.publicKeyCreate(M,!1).slice(1)};a.importPublic=function(M){return M=a.toBuffer(M),M.length!==64&&(M=y.publicKeyConvert(M,!1).slice(1)),M},a.ecsign=function(M,N){var x=y.sign(M,N),A={};return A.r=x.signature.slice(0,32),A.s=x.signature.slice(32,64),A.v=x.recovery+27,A},a.hashPersonalMessage=function(M){var N=a.toBuffer(`Ethereum Signed Message:
|
|
12
|
+
`+M.length.toString());return a.keccak(q.concat([N,M]))},a.ecrecover=function(M,N,x,A){var S=q.concat([a.setLength(x,32),a.setLength(A,32)],64),T=N-27;if(T!==0&&T!==1)throw new Error("Invalid signature v value");var O=y.recover(M,S,T);return y.publicKeyConvert(O,!1).slice(1)},a.toRpcSig=function(M,N,x){if(M!==27&&M!==28)throw new Error("Invalid recovery id");return a.bufferToHex(q.concat([a.setLengthLeft(N,32),a.setLengthLeft(x,32),a.toBuffer(M-27)]))},a.fromRpcSig=function(M){if(M=a.toBuffer(M),M.length!==65)throw new Error("Invalid signature length");var N=M[64];return N<27&&(N+=27),{v:N,r:M.slice(0,32),s:M.slice(32,64)}},a.privateToAddress=function(M){return a.publicToAddress($(M))},a.isValidAddress=function(M){return/^0x[0-9a-fA-F]{40}$/.test(M)},a.isZeroAddress=function(M){var N=a.zeroAddress();return N===a.addHexPrefix(M)},a.toChecksumAddress=function(M){M=a.stripHexPrefix(M).toLowerCase();for(var N=a.keccak(M).toString("hex"),x="0x",A=0;A<M.length;A++)parseInt(N[A],16)>=8?x+=M[A].toUpperCase():x+=M[A];return x},a.isValidChecksumAddress=function(M){return a.isValidAddress(M)&&a.toChecksumAddress(M)===M},a.generateAddress=function(M,N){return M=a.toBuffer(M),N=new k(N),N.isZero()?N=null:N=q.from(N.toArray()),a.rlphash([M,N]).slice(-20)},a.isPrecompiled=function(M){var N=a.unpad(M);return N.length===1&&N[0]>=1&&N[0]<=8},a.addHexPrefix=function(M){return typeof M!="string"||a.isHexPrefixed(M)?M:"0x"+M},a.isValidSignature=function(M,N,x,A){var S=new k("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),T=new k("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",16);return!(N.length!==32||x.length!==32||M!==27&&M!==28||(N=new k(N),x=new k(x),N.isZero()||N.gt(T)||x.isZero()||x.gt(T))||A===!1&&new k(x).cmp(S)===1)},a.baToJSON=function(M){if(q.isBuffer(M))return"0x"+M.toString("hex");if(M instanceof Array){for(var N=[],x=0;x<M.length;x++)N.push(a.baToJSON(M[x]));return N}},a.defineProperties=function(M,N,x){if(M.raw=[],M._fields=[],M.toJSON=function(S){if(S){var T={};return M._fields.forEach(function(O){T[O]="0x"+M[O].toString("hex")}),T}return a.baToJSON(this.raw)},M.serialize=function(){return B.encode(M.raw)},N.forEach(function(S,T){M._fields.push(S.name);function O(){return M.raw[T]}function W(K){K=a.toBuffer(K),K.toString("hex")==="00"&&!S.allowZero&&(K=q.allocUnsafe(0)),S.allowLess&&S.length?(K=a.stripZeros(K),b(S.length>=K.length,"The field "+S.name+" must not have more "+S.length+" bytes")):!(S.allowZero&&K.length===0)&&S.length&&b(S.length===K.length,"The field "+S.name+" must have byte length of "+S.length),M.raw[T]=K}Object.defineProperty(M,S.name,{enumerable:!0,configurable:!0,get:O,set:W}),S.default&&(M[S.name]=S.default),S.alias&&Object.defineProperty(M,S.alias,{enumerable:!1,configurable:!0,set:W,get:O})}),x)if(typeof x=="string"&&(x=q.from(a.stripHexPrefix(x),"hex")),q.isBuffer(x)&&(x=B.decode(x)),Array.isArray(x)){if(x.length>M._fields.length)throw new Error("wrong number of fields in data");x.forEach(function(S,T){M[M._fields[T]]=a.toBuffer(S)})}else if((typeof x>"u"?"undefined":n(x))==="object"){var A=Object.keys(x);N.forEach(function(S){A.indexOf(S.name)!==-1&&(M[S.name]=x[S.name]),A.indexOf(S.alias)!==-1&&(M[S.alias]=x[S.alias])})}else throw new Error("invalid data")}})(Vi);const Av=zr,lh=Gf;var qa=typeof Reflect=="object"?Reflect:null,Ev=qa&&typeof qa.apply=="function"?qa.apply:function(n,h,u){return Function.prototype.apply.call(n,h,u)},kv=vo;function vo(){lh.call(this)}Av.inherits(vo,lh);vo.prototype.emit=function(a){for(var n=[],h=1;h<arguments.length;h++)n.push(arguments[h]);var u=a==="error",v=this._events;if(v!==void 0)u=u&&v.error===void 0;else if(!u)return!1;if(u){var o;if(n.length>0&&(o=n[0]),o instanceof Error)throw o;var w=new Error("Unhandled error."+(o?" ("+o.message+")":""));throw w.context=o,w}var y=v[a];if(y===void 0)return!1;if(typeof y=="function")E0(y,this,n);else for(var b=y.length,B=Rv(y,b),h=0;h<b;++h)E0(B[h],this,n);return!0};function E0(a,n,h){try{Ev(a,n,h)}catch(u){setTimeout(()=>{throw u})}}function Rv(a,n){for(var h=new Array(n),u=0;u<n;++u)h[u]=a[u];return h}const Bv=kv,Iv=1e3,Tv=(a,n)=>a+n,k0=["sync","latest"];let Cv=class extends Bv{constructor(n={}){super(),this._blockResetDuration=n.blockResetDuration||20*Iv,this._blockResetTimeout,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()}isRunning(){return this._isRunning}getCurrentBlock(){return this._currentBlock}async getLatestBlock(){return this._currentBlock?this._currentBlock:await new Promise(h=>this.once("latest",h))}removeAllListeners(n){n?super.removeAllListeners(n):super.removeAllListeners(),this._setupInternalEvents(),this._onRemoveListener()}_start(){}_end(){}_setupInternalEvents(){this.removeListener("newListener",this._onNewListener),this.removeListener("removeListener",this._onRemoveListener),this.on("newListener",this._onNewListener),this.on("removeListener",this._onRemoveListener)}_onNewListener(n,h){k0.includes(n)&&this._maybeStart()}_onRemoveListener(n,h){this._getBlockTrackerEventCount()>0||this._maybeEnd()}_maybeStart(){this._isRunning||(this._isRunning=!0,this._cancelBlockResetTimeout(),this._start())}_maybeEnd(){this._isRunning&&(this._isRunning=!1,this._setupBlockResetTimeout(),this._end())}_getBlockTrackerEventCount(){return k0.map(n=>this.listenerCount(n)).reduce(Tv)}_newPotentialLatest(n){const h=this._currentBlock;h&&R0(n)<=R0(h)||this._setCurrentBlock(n)}_setCurrentBlock(n){const h=this._currentBlock;this._currentBlock=n,this.emit("latest",n),this.emit("sync",{oldBlock:h,newBlock:n})}_setupBlockResetTimeout(){this._cancelBlockResetTimeout(),this._blockResetTimeout=setTimeout(this._resetCurrentBlock,this._blockResetDuration),this._blockResetTimeout.unref&&this._blockResetTimeout.unref()}_cancelBlockResetTimeout(){clearTimeout(this._blockResetTimeout)}_resetCurrentBlock(){this._currentBlock=null}};var Lv=Cv;function R0(a){return Number.parseInt(a,16)}const Pv=ac,Ov=Lv,Nv=1e3;class qv extends Ov{constructor(n={}){if(!n.provider)throw new Error("PollingBlockTracker - no provider specified.");const h=n.pollingInterval||20*Nv,u=n.retryTimeout||h/10,v=n.keepEventLoopActive!==void 0?n.keepEventLoopActive:!0,o=n.setSkipCacheFlag||!1;super(Object.assign({blockResetDuration:h},n)),this._provider=n.provider,this._pollingInterval=h,this._retryTimeout=u,this._keepEventLoopActive=v,this._setSkipCacheFlag=o}async checkForLatestBlock(){return await this._updateLatestBlock(),await this.getLatestBlock()}_start(){this._performSync().catch(n=>this.emit("error",n))}async _performSync(){for(;this._isRunning;)try{await this._updateLatestBlock(),await B0(this._pollingInterval,!this._keepEventLoopActive)}catch(n){const h=new Error(`PollingBlockTracker - encountered an error while attempting to update latest block:
|
|
13
|
+
${n.stack}`);try{this.emit("error",h)}catch{console.error(h)}await B0(this._retryTimeout,!this._keepEventLoopActive)}}async _updateLatestBlock(){const n=await this._fetchLatestBlock();this._newPotentialLatest(n)}async _fetchLatestBlock(){const n={jsonrpc:"2.0",id:1,method:"eth_blockNumber",params:[]};this._setSkipCacheFlag&&(n.skipCache=!0);const h=await Pv(u=>this._provider.sendAsync(n,u))();if(h.error)throw new Error(`PollingBlockTracker - encountered error fetching block:
|
|
14
|
+
${h.error}`);return h.result}}var Uv=qv;function B0(a,n){return new Promise(h=>{const u=setTimeout(h,a);u.unref&&n&&u.unref()})}var uf={exports:{}},lf={exports:{}},cf={exports:{}},df={exports:{}};(function(a,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default={},a.exports=n.default})(df,df.exports);var ch=df.exports,vf={exports:{}},pf={exports:{}},mf={exports:{}};(function(a,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=h;function h(u){return function(){if(u!==null){var v=u;u=null,v.apply(this,arguments)}}}a.exports=n.default})(mf,mf.exports);var po=mf.exports,gf={exports:{}},yf={exports:{}};(function(a,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(u){return h&&u[h]&&u[h]()};var h=typeof Symbol=="function"&&Symbol.iterator;a.exports=n.default})(yf,yf.exports);var Fv=yf.exports;(function(a,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=q;var h=Jf(),u=b(h),v=Fv,o=b(v),w=Jl(),y=b(w);function b($){return $&&$.__esModule?$:{default:$}}function B($){var M=-1,N=$.length;return function(){return++M<N?{value:$[M],key:M}:null}}function k($){var M=-1;return function(){var x=$.next();return x.done?null:(M++,{value:x.value,key:M})}}function L($){var M=(0,y.default)($),N=-1,x=M.length;return function A(){var S=M[++N];return S==="__proto__"?A():N<x?{value:$[S],key:S}:null}}function q($){if((0,u.default)($))return B($);var M=(0,o.default)($);return M?k(M):L($)}a.exports=n.default})(gf,gf.exports);var $v=gf.exports,wf={exports:{}};(function(a,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=h;function h(u){return function(){if(u===null)throw new Error("Callback was already called.");var v=u;u=null,v.apply(this,arguments)}}a.exports=n.default})(wf,wf.exports);var mo=wf.exports;(function(a,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=$;var h=zi,u=q(h),v=po,o=q(v),w=$v,y=q(w),b=mo,B=q(b),k=ch,L=q(k);function q(M){return M&&M.__esModule?M:{default:M}}function $(M){return function(N,x,A){if(A=(0,o.default)(A||u.default),M<=0||!N)return A(null);var S=(0,y.default)(N),T=!1,O=0,W=!1;function K(ct,dt){if(O-=1,ct)T=!0,A(ct);else{if(dt===L.default||T&&O<=0)return T=!0,A(null);W||pt()}}function pt(){for(W=!0;O<M&&!T;){var ct=S();if(ct===null){T=!0,O<=0&&A(null);return}O+=1,x(ct.value,ct.key,(0,B.default)(K))}W=!1}pt()}}a.exports=n.default})(pf,pf.exports);var dh=pf.exports,rr={},bf={exports:{}},Mf={exports:{}},xf={exports:{}};(function(a,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=h;function h(u,v){v=v|0;for(var o=Math.max(u.length-v,0),w=Array(o),y=0;y<o;y++)w[y]=u[v+y];return w}a.exports=n.default})(xf,xf.exports);var ea=xf.exports;(function(a,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(o){return function(){var w=(0,u.default)(arguments),y=w.pop();o.call(this,w,y)}};var h=ea,u=v(h);function v(o){return o&&o.__esModule?o:{default:o}}a.exports=n.default})(Mf,Mf.exports);var zv=Mf.exports,lr={};Object.defineProperty(lr,"__esModule",{value:!0});lr.hasNextTick=lr.hasSetImmediate=void 0;lr.fallback=vh;lr.wrap=ph;var Dv=ea,Hv=Kv(Dv);function Kv(a){return a&&a.__esModule?a:{default:a}}var Zv=lr.hasSetImmediate=typeof setImmediate=="function"&&setImmediate,Wv=lr.hasNextTick=typeof Me=="object"&&typeof Me.nextTick=="function";function vh(a){setTimeout(a,0)}function ph(a){return function(n){var h=(0,Hv.default)(arguments,1);a(function(){n.apply(null,h)})}}var wn;Zv?wn=setImmediate:Wv?wn=Me.nextTick:wn=vh;lr.default=ph(wn);(function(a,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=B;var h=jl(),u=b(h),v=zv,o=b(v),w=lr,y=b(w);function b(q){return q&&q.__esModule?q:{default:q}}function B(q){return(0,o.default)(function($,M){var N;try{N=q.apply(this,$)}catch(x){return M(x)}(0,u.default)(N)&&typeof N.then=="function"?N.then(function(x){k(M,null,x)},function(x){k(M,x.message?x:new Error(x))}):M(null,N)})}function k(q,$,M){try{q($,M)}catch(N){(0,y.default)(L,N)}}function L(q){throw q}a.exports=n.default})(bf,bf.exports);var Vv=bf.exports;Object.defineProperty(rr,"__esModule",{value:!0});rr.isAsync=void 0;var Gv=Vv,Jv=jv(Gv);function jv(a){return a&&a.__esModule?a:{default:a}}var Yv=typeof Symbol=="function";function mh(a){return Yv&&a[Symbol.toStringTag]==="AsyncFunction"}function Xv(a){return mh(a)?(0,Jv.default)(a):a}rr.default=Xv;rr.isAsync=mh;(function(a,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=y;var h=dh,u=w(h),v=rr,o=w(v);function w(b){return b&&b.__esModule?b:{default:b}}function y(b,B,k,L){(0,u.default)(B)(b,(0,o.default)(k),L)}a.exports=n.default})(vf,vf.exports);var Qv=vf.exports,_f={exports:{}};(function(a,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=h;function h(u,v){return function(o,w,y){return u(o,v,w,y)}}a.exports=n.default})(_f,_f.exports);var gh=_f.exports;(function(a,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(W,K,pt){var ct=(0,u.default)(W)?T:O;ct(W,(0,A.default)(K),pt)};var h=Jf(),u=S(h),v=ch,o=S(v),w=Qv,y=S(w),b=gh,B=S(b),k=zi,L=S(k),q=po,$=S(q),M=mo,N=S(M),x=rr,A=S(x);function S(W){return W&&W.__esModule?W:{default:W}}function T(W,K,pt){pt=(0,$.default)(pt||L.default);var ct=0,dt=0,g=W.length;g===0&&pt(null);function e(t,i){t?pt(t):(++dt===g||i===o.default)&&pt(null)}for(;ct<g;ct++)K(W[ct],ct,(0,N.default)(e))}var O=(0,B.default)(y.default,1/0);a.exports=n.default})(cf,cf.exports);var yh=cf.exports;(function(a,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=y;var h=yh,u=w(h),v=rr,o=w(v);function w(b){return b&&b.__esModule?b:{default:b}}function y(b){return function(B,k,L){return b(u.default,B,(0,o.default)(k),L)}}a.exports=n.default})(lf,lf.exports);var tp=lf.exports,Sf={exports:{}};(function(a,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=y;var h=zi,u=w(h),v=rr,o=w(v);function w(b){return b&&b.__esModule?b:{default:b}}function y(b,B,k,L){L=L||u.default,B=B||[];var q=[],$=0,M=(0,o.default)(k);b(B,function(N,x,A){var S=$++;M(N,function(T,O){q[S]=O,A(T)})},function(N){L(N,q)})}a.exports=n.default})(Sf,Sf.exports);var ep=Sf.exports;(function(a,n){Object.defineProperty(n,"__esModule",{value:!0});var h=tp,u=w(h),v=ep,o=w(v);function w(y){return y&&y.__esModule?y:{default:y}}n.default=(0,u.default)(o.default),a.exports=n.default})(uf,uf.exports);var rp=uf.exports,Af={exports:{}},Ef={exports:{}},kf={exports:{}};(function(a,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=h;function h(u){return function(v,o,w){return u(v,w)}}a.exports=n.default})(kf,kf.exports);var ip=kf.exports;(function(a,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=B;var h=dh,u=b(h),v=ip,o=b(v),w=rr,y=b(w);function b(k){return k&&k.__esModule?k:{default:k}}function B(k,L,q,$){(0,u.default)(L)(k,(0,o.default)((0,y.default)(q)),$)}a.exports=n.default})(Ef,Ef.exports);var np=Ef.exports;(function(a,n){Object.defineProperty(n,"__esModule",{value:!0});var h=np,u=w(h),v=gh,o=w(v);function w(y){return y&&y.__esModule?y:{default:y}}n.default=(0,o.default)(u.default,1),a.exports=n.default})(Af,Af.exports);var ap=Af.exports;const wh=Gf.EventEmitter,fp=zr.inherits;var op=Xi;fp(Xi,wh);function Xi(){const a=this;wh.call(a),a.isLocked=!0}Xi.prototype.go=function(){const a=this;a.isLocked=!1,a.emit("unlock")};Xi.prototype.stop=function(){const a=this;a.isLocked=!0,a.emit("lock")};Xi.prototype.await=function(a){const n=this;n.isLocked?n.once("unlock",a):setTimeout(a)};var sn={},Ua,I0;function sp(){if(I0)return Ua;I0=1;var a,n,h={'"':'"',"\\":"\\","/":"/",b:"\b",f:"\f",n:`
|
|
15
|
+
`,r:"\r",t:" "},u;function v($){throw{name:"SyntaxError",message:$,at:a,text:u}}function o($){return $&&$!==n&&v("Expected '"+$+"' instead of '"+n+"'"),n=u.charAt(a),a+=1,n}function w(){var $,M="";for(n==="-"&&(M="-",o("-"));n>="0"&&n<="9";)M+=n,o();if(n===".")for(M+=".";o()&&n>="0"&&n<="9";)M+=n;if(n==="e"||n==="E")for(M+=n,o(),(n==="-"||n==="+")&&(M+=n,o());n>="0"&&n<="9";)M+=n,o();return $=Number(M),isFinite($)||v("Bad number"),$}function y(){var $,M,N="",x;if(n==='"')for(;o();){if(n==='"')return o(),N;if(n==="\\")if(o(),n==="u"){for(x=0,M=0;M<4&&($=parseInt(o(),16),!!isFinite($));M+=1)x=x*16+$;N+=String.fromCharCode(x)}else if(typeof h[n]=="string")N+=h[n];else break;else N+=n}v("Bad string")}function b(){for(;n&&n<=" ";)o()}function B(){switch(n){case"t":return o("t"),o("r"),o("u"),o("e"),!0;case"f":return o("f"),o("a"),o("l"),o("s"),o("e"),!1;case"n":return o("n"),o("u"),o("l"),o("l"),null;default:v("Unexpected '"+n+"'")}}function k(){var $=[];if(n==="["){if(o("["),b(),n==="]")return o("]"),$;for(;n;){if($.push(q()),b(),n==="]")return o("]"),$;o(","),b()}}v("Bad array")}function L(){var $,M={};if(n==="{"){if(o("{"),b(),n==="}")return o("}"),M;for(;n;){if($=y(),b(),o(":"),Object.prototype.hasOwnProperty.call(M,$)&&v('Duplicate key "'+$+'"'),M[$]=q(),b(),n==="}")return o("}"),M;o(","),b()}}v("Bad object")}function q(){switch(b(),n){case"{":return L();case"[":return k();case'"':return y();case"-":return w();default:return n>="0"&&n<="9"?w():B()}}return Ua=function($,M){var N;return u=$,a=0,n=" ",N=q(),b(),n&&v("Syntax error"),typeof M=="function"?function x(A,S){var T,O,W=A[S];if(W&&typeof W=="object")for(T in q)Object.prototype.hasOwnProperty.call(W,T)&&(O=x(W,T),typeof O>"u"?delete W[T]:W[T]=O);return M.call(A,S,W)}({"":N},""):N},Ua}var Fa,T0;function hp(){if(T0)return Fa;T0=1;var a=/[\\"\x00-\x1f\x7f-\x9f\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g,n,h,u={"\b":"\\b"," ":"\\t","\n":"\\n","\f":"\\f","\r":"\\r",'"':'\\"',"\\":"\\\\"},v;function o(y){return a.lastIndex=0,a.test(y)?'"'+y.replace(a,function(b){var B=u[b];return typeof B=="string"?B:"\\u"+("0000"+b.charCodeAt(0).toString(16)).slice(-4)})+'"':'"'+y+'"'}function w(y,b){var B,k,L,q,$=n,M,N=b[y];switch(N&&typeof N=="object"&&typeof N.toJSON=="function"&&(N=N.toJSON(y)),typeof v=="function"&&(N=v.call(b,y,N)),typeof N){case"string":return o(N);case"number":return isFinite(N)?String(N):"null";case"boolean":case"null":return String(N);case"object":if(!N)return"null";if(n+=h,M=[],Object.prototype.toString.apply(N)==="[object Array]"){for(q=N.length,B=0;B<q;B+=1)M[B]=w(B,N)||"null";return L=M.length===0?"[]":n?`[
|
|
16
|
+
`+n+M.join(`,
|
|
17
|
+
`+n)+`
|
|
18
|
+
`+$+"]":"["+M.join(",")+"]",n=$,L}if(v&&typeof v=="object")for(q=v.length,B=0;B<q;B+=1)k=v[B],typeof k=="string"&&(L=w(k,N),L&&M.push(o(k)+(n?": ":":")+L));else for(k in N)Object.prototype.hasOwnProperty.call(N,k)&&(L=w(k,N),L&&M.push(o(k)+(n?": ":":")+L));return L=M.length===0?"{}":n?`{
|
|
19
|
+
`+n+M.join(`,
|
|
20
|
+
`+n)+`
|
|
21
|
+
`+$+"}":"{"+M.join(",")+"}",n=$,L}}return Fa=function(y,b,B){var k;if(n="",h="",typeof B=="number")for(k=0;k<B;k+=1)h+=" ";else typeof B=="string"&&(h=B);if(v=b,b&&typeof b!="function"&&(typeof b!="object"||typeof b.length!="number"))throw new Error("JSON.stringify");return w("",{"":y})},Fa}var C0;function up(){return C0||(C0=1,sn.parse=sp(),sn.stringify=hp()),sn}var hn=typeof JSON<"u"?JSON:up(),lp=Array.isArray||function(a){return{}.toString.call(a)==="[object Array]"},cp=Object.keys||function(a){var n=Object.prototype.hasOwnProperty||function(){return!0},h=[];for(var u in a)n.call(a,u)&&h.push(u);return h},bh=function(a,n){n||(n={}),typeof n=="function"&&(n={cmp:n});var h=n.space||"";typeof h=="number"&&(h=Array(h+1).join(" "));var u=typeof n.cycles=="boolean"?n.cycles:!1,v=n.replacer||function(y,b){return b},o=n.cmp&&function(y){return function(b){return function(B,k){var L={key:B,value:b[B]},q={key:k,value:b[k]};return y(L,q)}}}(n.cmp),w=[];return function y(b,B,k,L){var q=h?`
|
|
22
|
+
`+new Array(L+1).join(h):"",$=h?": ":":";if(k&&k.toJSON&&typeof k.toJSON=="function"&&(k=k.toJSON()),k=v.call(b,B,k),k!==void 0){if(typeof k!="object"||k===null)return hn.stringify(k);if(lp(k)){for(var A=[],M=0;M<k.length;M++){var N=y(k,M,k[M],L+1)||hn.stringify(null);A.push(q+h+N)}return"["+A.join(",")+q+"]"}if(w.indexOf(k)!==-1){if(u)return hn.stringify("__cycle__");throw new TypeError("Converting circular structure to JSON")}else w.push(k);for(var x=cp(k).sort(o&&o(k)),A=[],M=0;M<x.length;M++){var B=x[M],S=y(k,B,k[B],L+1);if(S){var T=hn.stringify(B)+$+S;A.push(q+h+T)}}return w.splice(w.indexOf(k),1),"{"+A.join(",")+q+"}"}}({"":a},"",a,0)};const dp=bh;var vp={cacheIdentifierForPayload:pp,canCache:Mh,blockTagForPayload:mp,paramsWithoutBlockTag:xh,blockTagParamIndex:go,cacheTypeForPayload:_h};function pp(a,n={}){if(!Mh(a))return null;const{includeBlockRef:h}=n,u=h?a.params:xh(a);return a.method+":"+dp(u)}function Mh(a){return _h(a)!=="never"}function mp(a){var n=go(a);return n>=a.params.length?null:a.params[n]}function xh(a){var n=go(a);return n>=a.params.length?a.params:a.method==="eth_getBlockByNumber"?a.params.slice(1):a.params.slice(0,n)}function go(a){switch(a.method){case"eth_getStorageAt":return 2;case"eth_getBalance":case"eth_getCode":case"eth_getTransactionCount":case"eth_call":case"eth_estimateGas":return 1;case"eth_getBlockByNumber":return 0;default:return}}function _h(a){switch(a.method){case"web3_clientVersion":case"web3_sha3":case"eth_protocolVersion":case"eth_getBlockTransactionCountByHash":case"eth_getUncleCountByBlockHash":case"eth_getCode":case"eth_getBlockByHash":case"eth_getTransactionByHash":case"eth_getTransactionByBlockHashAndIndex":case"eth_getTransactionReceipt":case"eth_getUncleByBlockHashAndIndex":case"eth_getCompilers":case"eth_compileLLL":case"eth_compileSolidity":case"eth_compileSerpent":case"shh_version":return"perma";case"eth_getBlockByNumber":case"eth_getBlockTransactionCountByNumber":case"eth_getUncleCountByBlockNumber":case"eth_getTransactionByBlockNumberAndIndex":case"eth_getUncleByBlockNumberAndIndex":return"fork";case"eth_gasPrice":case"eth_getBalance":case"eth_getStorageAt":case"eth_getTransactionCount":case"eth_call":case"eth_estimateGas":case"eth_getFilterLogs":case"eth_getLogs":case"eth_blockNumber":return"block";case"net_version":case"net_peerCount":case"net_listening":case"eth_syncing":case"eth_sign":case"eth_coinbase":case"eth_mining":case"eth_hashrate":case"eth_accounts":case"eth_sendTransaction":case"eth_sendRawTransaction":case"eth_newFilter":case"eth_newBlockFilter":case"eth_newPendingTransactionFilter":case"eth_uninstallFilter":case"eth_getFilterChanges":case"eth_getWork":case"eth_submitWork":case"eth_submitHashrate":case"db_putString":case"db_getString":case"db_putHex":case"db_getHex":case"shh_post":case"shh_newIdentity":case"shh_hasIdentity":case"shh_newGroup":case"shh_addToGroup":case"shh_newFilter":case"shh_uninstallFilter":case"shh_getFilterChanges":case"shh_getMessages":return"never"}}var gp=yp;function yp(){return Math.floor(Number.MAX_SAFE_INTEGER*Math.random())}const wp=gp,bp=Ls;var yo=Mp;function Mp(a){return bp({id:wp(),jsonrpc:"2.0",params:[]},a)}const Sh=Gf.EventEmitter,xp=zr.inherits,Ae=Vi,_p=Uv,Sp=rp,Ap=ap,Ep=op,kp=yo,Rp=function(){};var Bp=Ze;xp(Ze,Sh);function Ze(a){const n=this;Sh.call(n),n.setMaxListeners(30),a=a||{};const h={sendAsync:n._handleAsync.bind(n)},u=a.blockTrackerProvider||h;n._blockTracker=a.blockTracker||new _p({provider:u,pollingInterval:a.pollingInterval||4e3,setSkipCacheFlag:!0}),n._ready=new Ep,n.currentBlock=null,n._providers=[]}Ze.prototype.start=function(a=Rp){const n=this;n._ready.go(),n._blockTracker.on("latest",h=>{n._getBlockByNumberWithRetry(h,(u,v)=>{if(u){this.emit("error",u);return}if(!v){console.log(v),this.emit("error",new Error("Could not find block"));return}const o=Ip(v);n._setCurrentBlock(o),n.emit("rawBlock",v),n.emit("latest",v)})}),n._blockTracker.on("sync",n.emit.bind(n,"sync")),n._blockTracker.on("error",n.emit.bind(n,"error")),n._running=!0,n.emit("start")};Ze.prototype.stop=function(){const a=this;a._blockTracker.removeAllListeners(),a._running=!1,a.emit("stop")};Ze.prototype.isRunning=function(){return this._running};Ze.prototype.addProvider=function(a,n){const h=this;typeof n=="number"?h._providers.splice(n,0,a):h._providers.push(a),a.setEngine(this)};Ze.prototype.removeProvider=function(a){const n=this,h=n._providers.indexOf(a);if(h<0)throw new Error("Provider not found.");n._providers.splice(h,1)};Ze.prototype.send=function(a){throw new Error("Web3ProviderEngine does not support synchronous requests.")};Ze.prototype.sendAsync=function(a,n){const h=this;h._ready.await(function(){Array.isArray(a)?Sp(a,h._handleAsync.bind(h),n):h._handleAsync(a,n)})};Ze.prototype._getBlockByNumberWithRetry=function(a,n){const h=this;let u=5;v();return;function v(){h._getBlockByNumber(a,o)}function o(w,y){if(w)return n(w);if(!y)if(u>0){u--,setTimeout(function(){v()},1e3);return}else{n(null,null);return}n(null,y)}};Ze.prototype._getBlockByNumber=function(a,n){const h=kp({method:"eth_getBlockByNumber",params:[a,!1],skipCache:!0});this._handleAsync(h,(u,v)=>u?n(u):n(null,v.result))};Ze.prototype._handleAsync=function(a,n){var h=this,u=-1,v=null,o=null,w=[];y();function y(B){if(u+=1,w.unshift(B),u>=h._providers.length)b(new Error('Request for method "'+a.method+'" not handled by any subprovider. Please check your subprovider configuration to ensure this method is handled.'));else try{var k=h._providers[u];k.handleRequest(a,y,b)}catch(L){b(L)}}function b(B,k){o=B,v=k,Ap(w,function(L,q){L?L(o,v,q):q()},function(){var L={id:a.id,jsonrpc:a.jsonrpc,result:v};o!=null?(L.error={message:o.stack||o.message||o,code:-32e3},n(o,L)):n(null,L)})}};Ze.prototype._setCurrentBlock=function(a){const n=this;n.currentBlock=a,n.emit("block",a)};function Ip(a){return{number:Ae.toBuffer(a.number),hash:Ae.toBuffer(a.hash),parentHash:Ae.toBuffer(a.parentHash),nonce:Ae.toBuffer(a.nonce),mixHash:Ae.toBuffer(a.mixHash),sha3Uncles:Ae.toBuffer(a.sha3Uncles),logsBloom:Ae.toBuffer(a.logsBloom),transactionsRoot:Ae.toBuffer(a.transactionsRoot),stateRoot:Ae.toBuffer(a.stateRoot),receiptsRoot:Ae.toBuffer(a.receiptRoot||a.receiptsRoot),miner:Ae.toBuffer(a.miner),difficulty:Ae.toBuffer(a.difficulty),totalDifficulty:Ae.toBuffer(a.totalDifficulty),size:Ae.toBuffer(a.size),extraData:Ae.toBuffer(a.extraData),gasLimit:Ae.toBuffer(a.gasLimit),gasUsed:Ae.toBuffer(a.gasUsed),timestamp:Ae.toBuffer(a.timestamp),transactions:a.transactions}}const Tp=yo;var ra=yi;function yi(){}yi.prototype.setEngine=function(a){const n=this;n.engine||(n.engine=a,a.on("block",function(h){n.currentBlock=h}),a.on("start",function(){n.start()}),a.on("stop",function(){n.stop()}))};yi.prototype.handleRequest=function(a,n,h){throw new Error("Subproviders should override `handleRequest`.")};yi.prototype.emitPayload=function(a,n){this.engine.sendAsync(Tp(a),n)};yi.prototype.stop=function(){};yi.prototype.start=function(){};const Cp=ra;class Lp extends Cp{constructor(n){if(super(),!n)throw new Error("JsonRpcEngineMiddlewareSubprovider - no constructorFn specified");this._constructorFn=n}setEngine(n){if(this.middleware)throw new Error("JsonRpcEngineMiddlewareSubprovider - subprovider added to engine twice");const h=n._blockTracker,u=this._constructorFn({engine:n,provider:n,blockTracker:h});if(!u)throw new Error("JsonRpcEngineMiddlewareSubprovider - _constructorFn did not return middleware");if(typeof u!="function")throw new Error("JsonRpcEngineMiddlewareSubprovider - specified middleware is not a function");this.middleware=u}handleRequest(n,h,u){const v={id:n.id};this.middleware(n,v,o,w);function o(y){h((b,B,k)=>{b?(delete v.result,v.error={message:b.message||b}):v.result=B,y?y(k):k()})}function w(y){if(y)return u(y);u(null,v.result)}}}var wo=Lp;const Pp=bh;var Op={cacheIdentifierForPayload:Np,canCache:Ah,blockTagForPayload:qp,paramsWithoutBlockTag:Eh,blockTagParamIndex:bo,cacheTypeForPayload:kh};function Np(a,n){const h=n?Eh(a):a.params;return Ah(a)?a.method+":"+Pp(h):null}function Ah(a){return kh(a)!=="never"}function qp(a){let n=bo(a);return n>=a.params.length?null:a.params[n]}function Eh(a){const n=bo(a);return n>=a.params.length?a.params:a.method==="eth_getBlockByNumber"?a.params.slice(1):a.params.slice(0,n)}function bo(a){switch(a.method){case"eth_getStorageAt":return 2;case"eth_getBalance":case"eth_getCode":case"eth_getTransactionCount":case"eth_call":return 1;case"eth_getBlockByNumber":return 0;default:return}}function kh(a){switch(a.method){case"web3_clientVersion":case"web3_sha3":case"eth_protocolVersion":case"eth_getBlockTransactionCountByHash":case"eth_getUncleCountByBlockHash":case"eth_getCode":case"eth_getBlockByHash":case"eth_getTransactionByHash":case"eth_getTransactionByBlockHashAndIndex":case"eth_getTransactionReceipt":case"eth_getUncleByBlockHashAndIndex":case"eth_getCompilers":case"eth_compileLLL":case"eth_compileSolidity":case"eth_compileSerpent":case"shh_version":case"test_permaCache":return"perma";case"eth_getBlockByNumber":case"eth_getBlockTransactionCountByNumber":case"eth_getUncleCountByBlockNumber":case"eth_getTransactionByBlockNumberAndIndex":case"eth_getUncleByBlockNumberAndIndex":case"test_forkCache":return"fork";case"eth_gasPrice":case"eth_blockNumber":case"eth_getBalance":case"eth_getStorageAt":case"eth_getTransactionCount":case"eth_call":case"eth_estimateGas":case"eth_getFilterLogs":case"eth_getLogs":case"test_blockCache":return"block";case"net_version":case"net_peerCount":case"net_listening":case"eth_syncing":case"eth_sign":case"eth_coinbase":case"eth_mining":case"eth_hashrate":case"eth_accounts":case"eth_sendTransaction":case"eth_sendRawTransaction":case"eth_newFilter":case"eth_newBlockFilter":case"eth_newPendingTransactionFilter":case"eth_uninstallFilter":case"eth_getFilterChanges":case"eth_getWork":case"eth_submitWork":case"eth_submitHashrate":case"db_putString":case"db_getString":case"db_putHex":case"db_getHex":case"shh_post":case"shh_newIdentity":case"shh_hasIdentity":case"shh_newGroup":case"shh_addToGroup":case"shh_newFilter":case"shh_uninstallFilter":case"shh_getFilterChanges":case"shh_getMessages":case"test_neverCache":return"never"}}var Up=function(n){return(h,u,v,o)=>{let w;const y=new Promise(L=>{w=L});let b,B;n(h,u,async()=>{B=!0,v(L=>{b=L,w()}),await y}).then(async()=>{B?(await y,b(null)):o(null)}).catch(L=>{b?b(L):o(L)})}};const Xr=Op,Fp=Up,$p=[void 0,null,"<nil>"];var zp=Dp;function Dp(a={}){const{blockTracker:n}=a;if(!n)throw new Error("createBlockCacheMiddleware - No BlockTracker specified");const h=new Hp,u={perma:h,block:h,fork:h};return Fp(async(v,o,w)=>{if(v.skipCache)return w();const y=Xr.cacheTypeForPayload(v),b=u[y];if(!b||!b.canCacheRequest(v))return w();let B=Xr.blockTagForPayload(v);B||(B="latest");let k;if(B==="earliest")k="0x00";else if(B==="latest"){const q=await n.getLatestBlock();h.clearBefore(q),k=q}else k=B;const L=await b.get(v,k);L===void 0?(await w(),await b.set(v,k,o.result)):o.result=L})}class Hp{constructor(){this.cache={}}getBlockCacheForPayload(n,h){const u=Number.parseInt(h,16);let v=this.cache[u];if(!v){const o={};this.cache[u]=o,v=o}return v}async get(n,h){const u=this.getBlockCacheForPayload(n,h);if(!u)return;const v=Xr.cacheIdentifierForPayload(n,!0);return u[v]}async set(n,h,u){if(!this.canCacheResult(n,u))return;const o=this.getBlockCacheForPayload(n,h),w=Xr.cacheIdentifierForPayload(n,!0);o[w]=u}canCacheRequest(n){return!(!Xr.canCache(n)||Xr.blockTagForPayload(n)==="pending")}canCacheResult(n,h){if(!$p.includes(h))return!(["eth_getTransactionByHash","eth_getTransactionReceipt"].includes(n.method)&&(!h||!h.blockHash||h.blockHash==="0x0000000000000000000000000000000000000000000000000000000000000000"))}clearBefore(n){const h=this,u=Number.parseInt(n,16);Object.keys(h.cache).map(Number).filter(v=>v<u).forEach(v=>delete h.cache[v])}}const Kp=wo,Zp=zp;class Wp extends Kp{constructor(n){super(({blockTracker:h})=>Zp(Object.assign({blockTracker:h},n)))}}var Vp=Wp;const Gp=zr.inherits,Jp=ra;var jp=Mo;Gp(Mo,Jp);function Mo(a){const n=this;a=a||{},n.staticResponses=a}Mo.prototype.handleRequest=function(a,n,h){var v=this.staticResponses[a.method];typeof v=="function"?v(a,n,h):v!==void 0?setTimeout(()=>h(null,v)):n()};var Yp=function(n){return(h,u,v,o)=>{const w=n[h.method];return w===void 0?v():typeof w=="function"?w(h,u,v,o):(u.result=w,o())}},Rh=Yp;const L0=(a,n,h,u)=>function(...v){const o=n.promiseModule;return new o((w,y)=>{n.multiArgs?v.push((...B)=>{n.errorFirst?B[0]?y(B):(B.shift(),w(B)):w(B)}):n.errorFirst?v.push((B,k)=>{B?y(B):w(k)}):v.push(w),Reflect.apply(a,this===h?u:this,v)})},P0=new WeakMap;var Xp=(a,n)=>{n={exclude:[/.+(?:Sync|Stream)$/],errorFirst:!0,promiseModule:Promise,...n};const h=typeof a;if(!(a!==null&&(h==="object"||h==="function")))throw new TypeError(`Expected \`input\` to be a \`Function\` or \`Object\`, got \`${a===null?"null":h}\``);const u=(w,y)=>{let b=P0.get(w);if(b||(b={},P0.set(w,b)),y in b)return b[y];const B=M=>typeof M=="string"||typeof y=="symbol"?y===M:M.test(y),k=Reflect.getOwnPropertyDescriptor(w,y),L=k===void 0||k.writable||k.configurable,$=(n.include?n.include.some(B):!n.exclude.some(B))&&L;return b[y]=$,$},v=new WeakMap,o=new Proxy(a,{apply(w,y,b){const B=v.get(w);if(B)return Reflect.apply(B,y,b);const k=n.excludeMain?w:L0(w,n,o,w);return v.set(w,k),Reflect.apply(k,y,b)},get(w,y){const b=w[y];if(!u(w,y)||b===Function.prototype[y])return b;const B=v.get(b);if(B)return B;if(typeof b=="function"){const k=L0(b,n,o,w);return v.set(b,k),k}return b}});return o};const Qp=Ps.default;let tm=class extends Qp{constructor(){super(),this.updates=[]}async initialize(){}async update(){throw new Error("BaseFilter - no update method specified")}addResults(n){this.updates=this.updates.concat(n),n.forEach(h=>this.emit("update",h))}addInitialResults(n){}getChangesAndClear(){const n=this.updates;return this.updates=[],n}};var xo=tm;const em=xo;let rm=class extends em{constructor(){super(),this.allResults=[]}async update(){throw new Error("BaseFilterWithHistory - no update method specified")}addResults(n){this.allResults=this.allResults.concat(n),super.addResults(n)}addInitialResults(n){this.allResults=this.allResults.concat(n),super.addInitialResults(n)}getAllResults(){return this.allResults}};var im=rm,Qi={minBlockRef:nm,maxBlockRef:am,sortBlockRefs:_o,bnToHex:fm,blockRefIsNumber:om,hexToInt:Rn,incrementHexInt:sm,intToHex:Bh,unsafeRandomBytes:hm};function nm(...a){return _o(a)[0]}function am(...a){const n=_o(a);return n[n.length-1]}function _o(a){return a.sort((n,h)=>n==="latest"||h==="earliest"?1:h==="latest"||n==="earliest"?-1:Rn(n)-Rn(h))}function fm(a){return"0x"+a.toString(16)}function om(a){return a&&!["earliest","latest","pending"].includes(a)}function Rn(a){return a==null?a:Number.parseInt(a,16)}function sm(a){if(a==null)return a;const n=Rn(a);return Bh(n+1)}function Bh(a){if(a==null)return a;let n=a.toString(16);return n.length%2&&(n="0"+n),"0x"+n}function hm(a){let n="0x";for(let h=0;h<a;h++)n+=O0(),n+=O0();return n}function O0(){return Math.floor(Math.random()*16).toString(16)}const um=fc,lm=Xp,cm=im,{bnToHex:k3,hexToInt:un,incrementHexInt:dm,minBlockRef:vm,blockRefIsNumber:pm}=Qi;let mm=class extends cm{constructor({provider:n,params:h}){super(),this.type="log",this.ethQuery=new um(n),this.params=Object.assign({fromBlock:"latest",toBlock:"latest",address:void 0,topics:[]},h),this.params.address&&(Array.isArray(this.params.address)||(this.params.address=[this.params.address]),this.params.address=this.params.address.map(u=>u.toLowerCase()))}async initialize({currentBlock:n}){let h=this.params.fromBlock;["latest","pending"].includes(h)&&(h=n),h==="earliest"&&(h="0x0"),this.params.fromBlock=h;const u=vm(this.params.toBlock,n),v=Object.assign({},this.params,{toBlock:u}),o=await this._fetchLogs(v);this.addInitialResults(o)}async update({oldBlock:n,newBlock:h}){const u=h;let v;n?v=dm(n):v=h;const o=Object.assign({},this.params,{fromBlock:v,toBlock:u}),y=(await this._fetchLogs(o)).filter(b=>this.matchLog(b));this.addResults(y)}async _fetchLogs(n){return await lm(u=>this.ethQuery.getLogs(n,u))()}matchLog(n){if(un(this.params.fromBlock)>=un(n.blockNumber)||pm(this.params.toBlock)&&un(this.params.toBlock)<=un(n.blockNumber))return!1;const h=n.address&&n.address.toLowerCase();return this.params.address&&h&&!this.params.address.includes(h)?!1:this.params.topics.every((v,o)=>{let w=n.topics[o];if(!w)return!1;w=w.toLowerCase();let y=Array.isArray(v)?v:[v];return y.includes(null)?!0:(y=y.map(k=>k.toLowerCase()),y.includes(w))})}};var gm=mm,So=ym;async function ym({provider:a,fromBlock:n,toBlock:h}){n||(n=h);const u=N0(n),o=N0(h)-u+1,w=Array(o).fill().map((b,B)=>u+B).map(wm);return await Promise.all(w.map(b=>bm(a,"eth_getBlockByNumber",[b,!1])))}function N0(a){return a==null?a:Number.parseInt(a,16)}function wm(a){return a==null?a:"0x"+a.toString(16)}function bm(a,n,h){return new Promise((u,v)=>{a.sendAsync({id:1,jsonrpc:"2.0",method:n,params:h},(o,w)=>{if(o)return v(o);u(w.result)})})}const Mm=xo,xm=So,{incrementHexInt:_m}=Qi;let Sm=class extends Mm{constructor({provider:n,params:h}){super(),this.type="block",this.provider=n}async update({oldBlock:n,newBlock:h}){const u=h,v=_m(n),w=(await xm({provider:this.provider,fromBlock:v,toBlock:u})).map(y=>y.hash);this.addResults(w)}};var Am=Sm;const Em=xo,km=So,{incrementHexInt:Rm}=Qi;let Bm=class extends Em{constructor({provider:n}){super(),this.type="tx",this.provider=n}async update({oldBlock:n}){const h=n,u=Rm(n),v=await km({provider:this.provider,fromBlock:u,toBlock:h}),o=[];for(const w of v)o.push(...w.transactions);this.addResults(o)}};var Im=Bm;const Tm=oc.Mutex,{createAsyncMiddleware:Cm}=Os,Lm=Rh,Pm=gm,Om=Am,Nm=Im,{intToHex:Ih,hexToInt:$a}=Qi;var Th=qm;function qm({blockTracker:a,provider:n}){let h=0,u={};const v=new Tm,o=Um({mutex:v}),w=Lm({eth_newFilter:o(za(b)),eth_newBlockFilter:o(za(B)),eth_newPendingTransactionFilter:o(za(k)),eth_uninstallFilter:o(bn($)),eth_getFilterChanges:o(bn(L)),eth_getFilterLogs:o(bn(q))}),y=async({oldBlock:S,newBlock:T})=>{if(u.length===0)return;const O=await v.acquire();try{await Promise.all(Vr(u).map(async W=>{try{await W.update({oldBlock:S,newBlock:T})}catch(K){console.error(K)}}))}catch(W){console.error(W)}O()};return w.newLogFilter=b,w.newBlockFilter=B,w.newPendingTransactionFilter=k,w.uninstallFilter=$,w.getFilterChanges=L,w.getFilterLogs=q,w.destroy=()=>{x()},w;async function b(S){const T=new Pm({provider:n,params:S});return await M(T),T}async function B(){const S=new Om({provider:n});return await M(S),S}async function k(){const S=new Nm({provider:n});return await M(S),S}async function L(S){const T=$a(S),O=u[T];if(!O)throw new Error(`No filter for index "${T}"`);return O.getChangesAndClear()}async function q(S){const T=$a(S),O=u[T];if(!O)throw new Error(`No filter for index "${T}"`);return O.type==="log"?results=O.getAllResults():results=[],results}async function $(S){const T=$a(S),W=!!u[T];return W&&await N(T),W}async function M(S){const T=Vr(u).length,O=await a.getLatestBlock();await S.initialize({currentBlock:O}),h++,u[h]=S,S.id=h,S.idHex=Ih(h);const W=Vr(u).length;return A({prevFilterCount:T,newFilterCount:W}),h}async function N(S){const T=Vr(u).length;delete u[S];const O=Vr(u).length;A({prevFilterCount:T,newFilterCount:O})}async function x(){const S=Vr(u).length;u={},A({prevFilterCount:S,newFilterCount:0})}function A({prevFilterCount:S,newFilterCount:T}){if(S===0&&T>0){a.on("sync",y);return}if(S>0&&T===0){a.removeListener("sync",y);return}}}function za(a){return bn(async(...n)=>{const h=await a(...n);return Ih(h.id)})}function bn(a){return Cm(async(n,h)=>{const u=await a.apply(null,n.params);h.result=u})}function Um({mutex:a}){return n=>async(h,u,v,o)=>{(await a.acquire())(),n(h,u,v,o)}}function Vr(a,n){const h=[];for(let u in a)h.push(a[u]);return h}const Fm=wo,$m=Th;let zm=class extends Fm{constructor(){super(({blockTracker:n,provider:h,engine:u})=>$m({blockTracker:n,provider:h}))}};var Dm=zm,Rf={exports:{}};(function(a,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=function(N,x){if(x=(0,y.default)(x||o.default),!(0,u.default)(N))return x(new Error("First argument to waterfall must be an array of functions"));if(!N.length)return x();var A=0;function S(O){var W=(0,$.default)(N[A++]);O.push((0,L.default)(T)),W.apply(null,O)}function T(O){if(O||A===N.length)return x.apply(null,arguments);S((0,B.default)(arguments,1))}S([])};var h=Yl,u=M(h),v=zi,o=M(v),w=po,y=M(w),b=ea,B=M(b),k=mo,L=M(k),q=rr,$=M(q);function M(N){return N&&N.__esModule?N:{default:N}}a.exports=n.default})(Rf,Rf.exports);var Hm=Rf.exports,Bf={exports:{}},If={exports:{}};(function(a,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=L;var h=zi,u=k(h),v=Jf(),o=k(v),w=ea,y=k(w),b=rr,B=k(b);function k(q){return q&&q.__esModule?q:{default:q}}function L(q,$,M){M=M||u.default;var N=(0,o.default)($)?[]:{};q($,function(x,A,S){(0,B.default)(x)(function(T,O){arguments.length>2&&(O=(0,y.default)(arguments,1)),N[A]=O,S(T)})},function(x){M(x,N)})}a.exports=n.default})(If,If.exports);var Km=If.exports;(function(a,n){Object.defineProperty(n,"__esModule",{value:!0}),n.default=y;var h=yh,u=w(h),v=Km,o=w(v);function w(b){return b&&b.__esModule?b:{default:b}}function y(b,B){(0,o.default)(u.default,b,B)}a.exports=n.default})(Bf,Bf.exports);var Zm=Bf.exports,Ch={},wi={},Ao={};Object.defineProperty(Ao,"__esModule",{value:!0});function Wm(a){return function(n){var h=a();return h.update(n),X.from(h.digest())}}Ao.createHashFunction=Wm;Object.defineProperty(wi,"__esModule",{value:!0});var ia=Ao,na=Xf;wi.keccak224=ia.createHashFunction(function(){return na("keccak224")});wi.keccak256=ia.createHashFunction(function(){return na("keccak256")});wi.keccak384=ia.createHashFunction(function(){return na("keccak384")});wi.keccak512=ia.createHashFunction(function(){return na("keccak512")});var Lh={},aa={};Object.defineProperty(aa,"__esModule",{value:!0});var Ph=oo;function Vm(a){return new Promise(function(n,h){Ph(a,function(u,v){if(u){h(u);return}n(v)})})}aa.getRandomBytes=Vm;function Gm(a){return Ph(a)}aa.getRandomBytesSync=Gm;(function(a){var n=Vt&&Vt.__awaiter||function(B,k,L,q){function $(M){return M instanceof L?M:new L(function(N){N(M)})}return new(L||(L=Promise))(function(M,N){function x(T){try{S(q.next(T))}catch(O){N(O)}}function A(T){try{S(q.throw(T))}catch(O){N(O)}}function S(T){T.done?M(T.value):$(T.value).then(x,A)}S((q=q.apply(B,k||[])).next())})},h=Vt&&Vt.__generator||function(B,k){var L={label:0,sent:function(){if(M[0]&1)throw M[1];return M[1]},trys:[],ops:[]},q,$,M,N;return N={next:x(0),throw:x(1),return:x(2)},typeof Symbol=="function"&&(N[Symbol.iterator]=function(){return this}),N;function x(S){return function(T){return A([S,T])}}function A(S){if(q)throw new TypeError("Generator is already executing.");for(;L;)try{if(q=1,$&&(M=S[0]&2?$.return:S[0]?$.throw||((M=$.return)&&M.call($),0):$.next)&&!(M=M.call($,S[1])).done)return M;switch($=0,M&&(S=[S[0]&2,M.value]),S[0]){case 0:case 1:M=S;break;case 4:return L.label++,{value:S[1],done:!1};case 5:L.label++,$=S[1],S=[0];continue;case 7:S=L.ops.pop(),L.trys.pop();continue;default:if(M=L.trys,!(M=M.length>0&&M[M.length-1])&&(S[0]===6||S[0]===2)){L=0;continue}if(S[0]===3&&(!M||S[1]>M[0]&&S[1]<M[3])){L.label=S[1];break}if(S[0]===6&&L.label<M[1]){L.label=M[1],M=S;break}if(M&&L.label<M[2]){L.label=M[2],L.ops.push(S);break}M[2]&&L.ops.pop(),L.trys.pop();continue}S=k.call(B,L)}catch(T){S=[6,T],$=0}finally{q=M=0}if(S[0]&5)throw S[1];return{value:S[0]?S[1]:void 0,done:!0}}};function u(B){for(var k in B)a.hasOwnProperty(k)||(a[k]=B[k])}Object.defineProperty(a,"__esModule",{value:!0});var v=ii,o=aa,w=32;function y(){return n(this,void 0,void 0,function(){var B;return h(this,function(k){switch(k.label){case 0:return[4,o.getRandomBytes(w)];case 1:return B=k.sent(),v.privateKeyVerify(B)?[2,B]:[3,0];case 2:return[2]}})})}a.createPrivateKey=y;function b(){for(;;){var B=o.getRandomBytesSync(w);if(v.privateKeyVerify(B))return B}}a.createPrivateKeySync=b,u(ii)})(Lh);var tn={},Eo={exports:{}};Eo.exports;(function(a){(function(n,h){function u(e,t){if(!e)throw new Error(t||"Assertion failed")}function v(e,t){e.super_=t;var i=function(){};i.prototype=t.prototype,e.prototype=new i,e.prototype.constructor=e}function o(e,t,i){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,e!==null&&((t==="le"||t==="be")&&(i=t,t=10),this._init(e||0,t||10,i||"be"))}typeof n=="object"?n.exports=o:h.BN=o,o.BN=o,o.wordSize=26;var w;try{typeof window<"u"&&typeof window.Buffer<"u"?w=window.Buffer:w=Se.Buffer}catch{}o.isBN=function(t){return t instanceof o?!0:t!==null&&typeof t=="object"&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,i){return t.cmp(i)>0?t:i},o.min=function(t,i){return t.cmp(i)<0?t:i},o.prototype._init=function(t,i,s){if(typeof t=="number")return this._initNumber(t,i,s);if(typeof t=="object")return this._initArray(t,i,s);i==="hex"&&(i=16),u(i===(i|0)&&i>=2&&i<=36),t=t.toString().replace(/\s+/g,"");var l=0;t[0]==="-"&&(l++,this.negative=1),l<t.length&&(i===16?this._parseHex(t,l,s):(this._parseBase(t,i,l),s==="le"&&this._initArray(this.toArray(),i,s)))},o.prototype._initNumber=function(t,i,s){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[t&67108863],this.length=1):t<4503599627370496?(this.words=[t&67108863,t/67108864&67108863],this.length=2):(u(t<9007199254740992),this.words=[t&67108863,t/67108864&67108863,1],this.length=3),s==="le"&&this._initArray(this.toArray(),i,s)},o.prototype._initArray=function(t,i,s){if(u(typeof t.length=="number"),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var l=0;l<this.length;l++)this.words[l]=0;var c,p,d=0;if(s==="be")for(l=t.length-1,c=0;l>=0;l-=3)p=t[l]|t[l-1]<<8|t[l-2]<<16,this.words[c]|=p<<d&67108863,this.words[c+1]=p>>>26-d&67108863,d+=24,d>=26&&(d-=26,c++);else if(s==="le")for(l=0,c=0;l<t.length;l+=3)p=t[l]|t[l+1]<<8|t[l+2]<<16,this.words[c]|=p<<d&67108863,this.words[c+1]=p>>>26-d&67108863,d+=24,d>=26&&(d-=26,c++);return this.strip()};function y(e,t){var i=e.charCodeAt(t);return i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:i-48&15}function b(e,t,i){var s=y(e,i);return i-1>=t&&(s|=y(e,i-1)<<4),s}o.prototype._parseHex=function(t,i,s){this.length=Math.ceil((t.length-i)/6),this.words=new Array(this.length);for(var l=0;l<this.length;l++)this.words[l]=0;var c=0,p=0,d;if(s==="be")for(l=t.length-1;l>=i;l-=2)d=b(t,i,l)<<c,this.words[p]|=d&67108863,c>=18?(c-=18,p+=1,this.words[p]|=d>>>26):c+=8;else{var r=t.length-i;for(l=r%2===0?i+1:i;l<t.length;l+=2)d=b(t,i,l)<<c,this.words[p]|=d&67108863,c>=18?(c-=18,p+=1,this.words[p]|=d>>>26):c+=8}this.strip()};function B(e,t,i,s){for(var l=0,c=Math.min(e.length,i),p=t;p<c;p++){var d=e.charCodeAt(p)-48;l*=s,d>=49?l+=d-49+10:d>=17?l+=d-17+10:l+=d}return l}o.prototype._parseBase=function(t,i,s){this.words=[0],this.length=1;for(var l=0,c=1;c<=67108863;c*=i)l++;l--,c=c/i|0;for(var p=t.length-s,d=p%l,r=Math.min(p,p-d)+s,f=0,m=s;m<r;m+=l)f=B(t,m,m+l,i),this.imuln(c),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f);if(d!==0){var _=1;for(f=B(t,m,t.length,i),m=0;m<d;m++)_*=i;this.imuln(_),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f)}this.strip()},o.prototype.copy=function(t){t.words=new Array(this.length);for(var i=0;i<this.length;i++)t.words[i]=this.words[i];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},o.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var k=["","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"],L=[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],q=[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];o.prototype.toString=function(t,i){t=t||10,i=i|0||1;var s;if(t===16||t==="hex"){s="";for(var l=0,c=0,p=0;p<this.length;p++){var d=this.words[p],r=((d<<l|c)&16777215).toString(16);c=d>>>24-l&16777215,c!==0||p!==this.length-1?s=k[6-r.length]+r+s:s=r+s,l+=2,l>=26&&(l-=26,p--)}for(c!==0&&(s=c.toString(16)+s);s.length%i!==0;)s="0"+s;return this.negative!==0&&(s="-"+s),s}if(t===(t|0)&&t>=2&&t<=36){var f=L[t],m=q[t];s="";var _=this.clone();for(_.negative=0;!_.isZero();){var R=_.modn(m).toString(t);_=_.idivn(m),_.isZero()?s=R+s:s=k[f-R.length]+R+s}for(this.isZero()&&(s="0"+s);s.length%i!==0;)s="0"+s;return this.negative!==0&&(s="-"+s),s}u(!1,"Base should be between 2 and 36")},o.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&&u(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,i){return u(typeof w<"u"),this.toArrayLike(w,t,i)},o.prototype.toArray=function(t,i){return this.toArrayLike(Array,t,i)},o.prototype.toArrayLike=function(t,i,s){var l=this.byteLength(),c=s||Math.max(1,l);u(l<=c,"byte array longer than desired length"),u(c>0,"Requested array length <= 0"),this.strip();var p=i==="le",d=new t(c),r,f,m=this.clone();if(p){for(f=0;!m.isZero();f++)r=m.andln(255),m.iushrn(8),d[f]=r;for(;f<c;f++)d[f]=0}else{for(f=0;f<c-l;f++)d[f]=0;for(f=0;!m.isZero();f++)r=m.andln(255),m.iushrn(8),d[c-f-1]=r}return d},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var i=t,s=0;return i>=4096&&(s+=13,i>>>=13),i>=64&&(s+=7,i>>>=7),i>=8&&(s+=4,i>>>=4),i>=2&&(s+=2,i>>>=2),s+i},o.prototype._zeroBits=function(t){if(t===0)return 26;var i=t,s=0;return i&8191||(s+=13,i>>>=13),i&127||(s+=7,i>>>=7),i&15||(s+=4,i>>>=4),i&3||(s+=2,i>>>=2),i&1||s++,s},o.prototype.bitLength=function(){var t=this.words[this.length-1],i=this._countBits(t);return(this.length-1)*26+i};function $(e){for(var t=new Array(e.bitLength()),i=0;i<t.length;i++){var s=i/26|0,l=i%26;t[i]=(e.words[s]&1<<l)>>>l}return t}o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,i=0;i<this.length;i++){var s=this._zeroBits(this.words[i]);if(t+=s,s!==26)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return this.negative!==0?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return this.negative!==0},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var i=0;i<t.length;i++)this.words[i]=this.words[i]|t.words[i];return this.strip()},o.prototype.ior=function(t){return u((this.negative|t.negative)===0),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var i;this.length>t.length?i=t:i=this;for(var s=0;s<i.length;s++)this.words[s]=this.words[s]&t.words[s];return this.length=i.length,this.strip()},o.prototype.iand=function(t){return u((this.negative|t.negative)===0),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var i,s;this.length>t.length?(i=this,s=t):(i=t,s=this);for(var l=0;l<s.length;l++)this.words[l]=i.words[l]^s.words[l];if(this!==i)for(;l<i.length;l++)this.words[l]=i.words[l];return this.length=i.length,this.strip()},o.prototype.ixor=function(t){return u((this.negative|t.negative)===0),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){u(typeof t=="number"&&t>=0);var i=Math.ceil(t/26)|0,s=t%26;this._expand(i),s>0&&i--;for(var l=0;l<i;l++)this.words[l]=~this.words[l]&67108863;return s>0&&(this.words[l]=~this.words[l]&67108863>>26-s),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,i){u(typeof t=="number"&&t>=0);var s=t/26|0,l=t%26;return this._expand(s+1),i?this.words[s]=this.words[s]|1<<l:this.words[s]=this.words[s]&~(1<<l),this.strip()},o.prototype.iadd=function(t){var i;if(this.negative!==0&&t.negative===0)return this.negative=0,i=this.isub(t),this.negative^=1,this._normSign();if(this.negative===0&&t.negative!==0)return t.negative=0,i=this.isub(t),t.negative=1,i._normSign();var s,l;this.length>t.length?(s=this,l=t):(s=t,l=this);for(var c=0,p=0;p<l.length;p++)i=(s.words[p]|0)+(l.words[p]|0)+c,this.words[p]=i&67108863,c=i>>>26;for(;c!==0&&p<s.length;p++)i=(s.words[p]|0)+c,this.words[p]=i&67108863,c=i>>>26;if(this.length=s.length,c!==0)this.words[this.length]=c,this.length++;else if(s!==this)for(;p<s.length;p++)this.words[p]=s.words[p];return this},o.prototype.add=function(t){var i;return t.negative!==0&&this.negative===0?(t.negative=0,i=this.sub(t),t.negative^=1,i):t.negative===0&&this.negative!==0?(this.negative=0,i=t.sub(this),this.negative=1,i):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(t.negative!==0){t.negative=0;var i=this.iadd(t);return t.negative=1,i._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var s=this.cmp(t);if(s===0)return this.negative=0,this.length=1,this.words[0]=0,this;var l,c;s>0?(l=this,c=t):(l=t,c=this);for(var p=0,d=0;d<c.length;d++)i=(l.words[d]|0)-(c.words[d]|0)+p,p=i>>26,this.words[d]=i&67108863;for(;p!==0&&d<l.length;d++)i=(l.words[d]|0)+p,p=i>>26,this.words[d]=i&67108863;if(p===0&&d<l.length&&l!==this)for(;d<l.length;d++)this.words[d]=l.words[d];return this.length=Math.max(this.length,d),l!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};function M(e,t,i){i.negative=t.negative^e.negative;var s=e.length+t.length|0;i.length=s,s=s-1|0;var l=e.words[0]|0,c=t.words[0]|0,p=l*c,d=p&67108863,r=p/67108864|0;i.words[0]=d;for(var f=1;f<s;f++){for(var m=r>>>26,_=r&67108863,R=Math.min(f,t.length-1),C=Math.max(0,f-e.length+1);C<=R;C++){var F=f-C|0;l=e.words[F]|0,c=t.words[C]|0,p=l*c+_,m+=p/67108864|0,_=p&67108863}i.words[f]=_|0,r=m|0}return r!==0?i.words[f]=r|0:i.length--,i.strip()}var N=function(t,i,s){var l=t.words,c=i.words,p=s.words,d=0,r,f,m,_=l[0]|0,R=_&8191,C=_>>>13,F=l[1]|0,z=F&8191,lt=F>>>13,G=l[2]|0,Z=G&8191,mt=G>>>13,gt=l[3]|0,j=gt&8191,Ct=gt>>>13,wt=l[4]|0,Y=wt&8191,U=wt>>>13,I=l[5]|0,E=I&8191,P=I>>>13,H=l[6]|0,D=H&8191,ut=H>>>13,vt=l[7]|0,V=vt&8191,bt=vt>>>13,yt=l[8]|0,J=yt&8191,Lt=yt>>>13,Mt=l[9]|0,Q=Mt&8191,Ot=Mt>>>13,xt=c[0]|0,tt=xt&8191,Nt=xt>>>13,_t=c[1]|0,et=_t&8191,qt=_t>>>13,St=c[2]|0,rt=St&8191,Ut=St>>>13,At=c[3]|0,it=At&8191,Ft=At>>>13,Et=c[4]|0,nt=Et&8191,$t=Et>>>13,kt=c[5]|0,at=kt&8191,zt=kt>>>13,Rt=c[6]|0,ft=Rt&8191,Dt=Rt>>>13,Bt=c[7]|0,ot=Bt&8191,Ht=Bt>>>13,It=c[8]|0,st=It&8191,Kt=It>>>13,Tt=c[9]|0,ht=Tt&8191,Pt=Tt>>>13;s.negative=t.negative^i.negative,s.length=19,r=Math.imul(R,tt),f=Math.imul(R,Nt),f=f+Math.imul(C,tt)|0,m=Math.imul(C,Nt);var Jt=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,r=Math.imul(z,tt),f=Math.imul(z,Nt),f=f+Math.imul(lt,tt)|0,m=Math.imul(lt,Nt),r=r+Math.imul(R,et)|0,f=f+Math.imul(R,qt)|0,f=f+Math.imul(C,et)|0,m=m+Math.imul(C,qt)|0;var jt=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(jt>>>26)|0,jt&=67108863,r=Math.imul(Z,tt),f=Math.imul(Z,Nt),f=f+Math.imul(mt,tt)|0,m=Math.imul(mt,Nt),r=r+Math.imul(z,et)|0,f=f+Math.imul(z,qt)|0,f=f+Math.imul(lt,et)|0,m=m+Math.imul(lt,qt)|0,r=r+Math.imul(R,rt)|0,f=f+Math.imul(R,Ut)|0,f=f+Math.imul(C,rt)|0,m=m+Math.imul(C,Ut)|0;var Yt=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,r=Math.imul(j,tt),f=Math.imul(j,Nt),f=f+Math.imul(Ct,tt)|0,m=Math.imul(Ct,Nt),r=r+Math.imul(Z,et)|0,f=f+Math.imul(Z,qt)|0,f=f+Math.imul(mt,et)|0,m=m+Math.imul(mt,qt)|0,r=r+Math.imul(z,rt)|0,f=f+Math.imul(z,Ut)|0,f=f+Math.imul(lt,rt)|0,m=m+Math.imul(lt,Ut)|0,r=r+Math.imul(R,it)|0,f=f+Math.imul(R,Ft)|0,f=f+Math.imul(C,it)|0,m=m+Math.imul(C,Ft)|0;var Xt=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(Xt>>>26)|0,Xt&=67108863,r=Math.imul(Y,tt),f=Math.imul(Y,Nt),f=f+Math.imul(U,tt)|0,m=Math.imul(U,Nt),r=r+Math.imul(j,et)|0,f=f+Math.imul(j,qt)|0,f=f+Math.imul(Ct,et)|0,m=m+Math.imul(Ct,qt)|0,r=r+Math.imul(Z,rt)|0,f=f+Math.imul(Z,Ut)|0,f=f+Math.imul(mt,rt)|0,m=m+Math.imul(mt,Ut)|0,r=r+Math.imul(z,it)|0,f=f+Math.imul(z,Ft)|0,f=f+Math.imul(lt,it)|0,m=m+Math.imul(lt,Ft)|0,r=r+Math.imul(R,nt)|0,f=f+Math.imul(R,$t)|0,f=f+Math.imul(C,nt)|0,m=m+Math.imul(C,$t)|0;var Qt=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(Qt>>>26)|0,Qt&=67108863,r=Math.imul(E,tt),f=Math.imul(E,Nt),f=f+Math.imul(P,tt)|0,m=Math.imul(P,Nt),r=r+Math.imul(Y,et)|0,f=f+Math.imul(Y,qt)|0,f=f+Math.imul(U,et)|0,m=m+Math.imul(U,qt)|0,r=r+Math.imul(j,rt)|0,f=f+Math.imul(j,Ut)|0,f=f+Math.imul(Ct,rt)|0,m=m+Math.imul(Ct,Ut)|0,r=r+Math.imul(Z,it)|0,f=f+Math.imul(Z,Ft)|0,f=f+Math.imul(mt,it)|0,m=m+Math.imul(mt,Ft)|0,r=r+Math.imul(z,nt)|0,f=f+Math.imul(z,$t)|0,f=f+Math.imul(lt,nt)|0,m=m+Math.imul(lt,$t)|0,r=r+Math.imul(R,at)|0,f=f+Math.imul(R,zt)|0,f=f+Math.imul(C,at)|0,m=m+Math.imul(C,zt)|0;var te=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(te>>>26)|0,te&=67108863,r=Math.imul(D,tt),f=Math.imul(D,Nt),f=f+Math.imul(ut,tt)|0,m=Math.imul(ut,Nt),r=r+Math.imul(E,et)|0,f=f+Math.imul(E,qt)|0,f=f+Math.imul(P,et)|0,m=m+Math.imul(P,qt)|0,r=r+Math.imul(Y,rt)|0,f=f+Math.imul(Y,Ut)|0,f=f+Math.imul(U,rt)|0,m=m+Math.imul(U,Ut)|0,r=r+Math.imul(j,it)|0,f=f+Math.imul(j,Ft)|0,f=f+Math.imul(Ct,it)|0,m=m+Math.imul(Ct,Ft)|0,r=r+Math.imul(Z,nt)|0,f=f+Math.imul(Z,$t)|0,f=f+Math.imul(mt,nt)|0,m=m+Math.imul(mt,$t)|0,r=r+Math.imul(z,at)|0,f=f+Math.imul(z,zt)|0,f=f+Math.imul(lt,at)|0,m=m+Math.imul(lt,zt)|0,r=r+Math.imul(R,ft)|0,f=f+Math.imul(R,Dt)|0,f=f+Math.imul(C,ft)|0,m=m+Math.imul(C,Dt)|0;var ee=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(ee>>>26)|0,ee&=67108863,r=Math.imul(V,tt),f=Math.imul(V,Nt),f=f+Math.imul(bt,tt)|0,m=Math.imul(bt,Nt),r=r+Math.imul(D,et)|0,f=f+Math.imul(D,qt)|0,f=f+Math.imul(ut,et)|0,m=m+Math.imul(ut,qt)|0,r=r+Math.imul(E,rt)|0,f=f+Math.imul(E,Ut)|0,f=f+Math.imul(P,rt)|0,m=m+Math.imul(P,Ut)|0,r=r+Math.imul(Y,it)|0,f=f+Math.imul(Y,Ft)|0,f=f+Math.imul(U,it)|0,m=m+Math.imul(U,Ft)|0,r=r+Math.imul(j,nt)|0,f=f+Math.imul(j,$t)|0,f=f+Math.imul(Ct,nt)|0,m=m+Math.imul(Ct,$t)|0,r=r+Math.imul(Z,at)|0,f=f+Math.imul(Z,zt)|0,f=f+Math.imul(mt,at)|0,m=m+Math.imul(mt,zt)|0,r=r+Math.imul(z,ft)|0,f=f+Math.imul(z,Dt)|0,f=f+Math.imul(lt,ft)|0,m=m+Math.imul(lt,Dt)|0,r=r+Math.imul(R,ot)|0,f=f+Math.imul(R,Ht)|0,f=f+Math.imul(C,ot)|0,m=m+Math.imul(C,Ht)|0;var re=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(re>>>26)|0,re&=67108863,r=Math.imul(J,tt),f=Math.imul(J,Nt),f=f+Math.imul(Lt,tt)|0,m=Math.imul(Lt,Nt),r=r+Math.imul(V,et)|0,f=f+Math.imul(V,qt)|0,f=f+Math.imul(bt,et)|0,m=m+Math.imul(bt,qt)|0,r=r+Math.imul(D,rt)|0,f=f+Math.imul(D,Ut)|0,f=f+Math.imul(ut,rt)|0,m=m+Math.imul(ut,Ut)|0,r=r+Math.imul(E,it)|0,f=f+Math.imul(E,Ft)|0,f=f+Math.imul(P,it)|0,m=m+Math.imul(P,Ft)|0,r=r+Math.imul(Y,nt)|0,f=f+Math.imul(Y,$t)|0,f=f+Math.imul(U,nt)|0,m=m+Math.imul(U,$t)|0,r=r+Math.imul(j,at)|0,f=f+Math.imul(j,zt)|0,f=f+Math.imul(Ct,at)|0,m=m+Math.imul(Ct,zt)|0,r=r+Math.imul(Z,ft)|0,f=f+Math.imul(Z,Dt)|0,f=f+Math.imul(mt,ft)|0,m=m+Math.imul(mt,Dt)|0,r=r+Math.imul(z,ot)|0,f=f+Math.imul(z,Ht)|0,f=f+Math.imul(lt,ot)|0,m=m+Math.imul(lt,Ht)|0,r=r+Math.imul(R,st)|0,f=f+Math.imul(R,Kt)|0,f=f+Math.imul(C,st)|0,m=m+Math.imul(C,Kt)|0;var ie=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(ie>>>26)|0,ie&=67108863,r=Math.imul(Q,tt),f=Math.imul(Q,Nt),f=f+Math.imul(Ot,tt)|0,m=Math.imul(Ot,Nt),r=r+Math.imul(J,et)|0,f=f+Math.imul(J,qt)|0,f=f+Math.imul(Lt,et)|0,m=m+Math.imul(Lt,qt)|0,r=r+Math.imul(V,rt)|0,f=f+Math.imul(V,Ut)|0,f=f+Math.imul(bt,rt)|0,m=m+Math.imul(bt,Ut)|0,r=r+Math.imul(D,it)|0,f=f+Math.imul(D,Ft)|0,f=f+Math.imul(ut,it)|0,m=m+Math.imul(ut,Ft)|0,r=r+Math.imul(E,nt)|0,f=f+Math.imul(E,$t)|0,f=f+Math.imul(P,nt)|0,m=m+Math.imul(P,$t)|0,r=r+Math.imul(Y,at)|0,f=f+Math.imul(Y,zt)|0,f=f+Math.imul(U,at)|0,m=m+Math.imul(U,zt)|0,r=r+Math.imul(j,ft)|0,f=f+Math.imul(j,Dt)|0,f=f+Math.imul(Ct,ft)|0,m=m+Math.imul(Ct,Dt)|0,r=r+Math.imul(Z,ot)|0,f=f+Math.imul(Z,Ht)|0,f=f+Math.imul(mt,ot)|0,m=m+Math.imul(mt,Ht)|0,r=r+Math.imul(z,st)|0,f=f+Math.imul(z,Kt)|0,f=f+Math.imul(lt,st)|0,m=m+Math.imul(lt,Kt)|0,r=r+Math.imul(R,ht)|0,f=f+Math.imul(R,Pt)|0,f=f+Math.imul(C,ht)|0,m=m+Math.imul(C,Pt)|0;var ne=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(ne>>>26)|0,ne&=67108863,r=Math.imul(Q,et),f=Math.imul(Q,qt),f=f+Math.imul(Ot,et)|0,m=Math.imul(Ot,qt),r=r+Math.imul(J,rt)|0,f=f+Math.imul(J,Ut)|0,f=f+Math.imul(Lt,rt)|0,m=m+Math.imul(Lt,Ut)|0,r=r+Math.imul(V,it)|0,f=f+Math.imul(V,Ft)|0,f=f+Math.imul(bt,it)|0,m=m+Math.imul(bt,Ft)|0,r=r+Math.imul(D,nt)|0,f=f+Math.imul(D,$t)|0,f=f+Math.imul(ut,nt)|0,m=m+Math.imul(ut,$t)|0,r=r+Math.imul(E,at)|0,f=f+Math.imul(E,zt)|0,f=f+Math.imul(P,at)|0,m=m+Math.imul(P,zt)|0,r=r+Math.imul(Y,ft)|0,f=f+Math.imul(Y,Dt)|0,f=f+Math.imul(U,ft)|0,m=m+Math.imul(U,Dt)|0,r=r+Math.imul(j,ot)|0,f=f+Math.imul(j,Ht)|0,f=f+Math.imul(Ct,ot)|0,m=m+Math.imul(Ct,Ht)|0,r=r+Math.imul(Z,st)|0,f=f+Math.imul(Z,Kt)|0,f=f+Math.imul(mt,st)|0,m=m+Math.imul(mt,Kt)|0,r=r+Math.imul(z,ht)|0,f=f+Math.imul(z,Pt)|0,f=f+Math.imul(lt,ht)|0,m=m+Math.imul(lt,Pt)|0;var ae=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(ae>>>26)|0,ae&=67108863,r=Math.imul(Q,rt),f=Math.imul(Q,Ut),f=f+Math.imul(Ot,rt)|0,m=Math.imul(Ot,Ut),r=r+Math.imul(J,it)|0,f=f+Math.imul(J,Ft)|0,f=f+Math.imul(Lt,it)|0,m=m+Math.imul(Lt,Ft)|0,r=r+Math.imul(V,nt)|0,f=f+Math.imul(V,$t)|0,f=f+Math.imul(bt,nt)|0,m=m+Math.imul(bt,$t)|0,r=r+Math.imul(D,at)|0,f=f+Math.imul(D,zt)|0,f=f+Math.imul(ut,at)|0,m=m+Math.imul(ut,zt)|0,r=r+Math.imul(E,ft)|0,f=f+Math.imul(E,Dt)|0,f=f+Math.imul(P,ft)|0,m=m+Math.imul(P,Dt)|0,r=r+Math.imul(Y,ot)|0,f=f+Math.imul(Y,Ht)|0,f=f+Math.imul(U,ot)|0,m=m+Math.imul(U,Ht)|0,r=r+Math.imul(j,st)|0,f=f+Math.imul(j,Kt)|0,f=f+Math.imul(Ct,st)|0,m=m+Math.imul(Ct,Kt)|0,r=r+Math.imul(Z,ht)|0,f=f+Math.imul(Z,Pt)|0,f=f+Math.imul(mt,ht)|0,m=m+Math.imul(mt,Pt)|0;var fe=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(fe>>>26)|0,fe&=67108863,r=Math.imul(Q,it),f=Math.imul(Q,Ft),f=f+Math.imul(Ot,it)|0,m=Math.imul(Ot,Ft),r=r+Math.imul(J,nt)|0,f=f+Math.imul(J,$t)|0,f=f+Math.imul(Lt,nt)|0,m=m+Math.imul(Lt,$t)|0,r=r+Math.imul(V,at)|0,f=f+Math.imul(V,zt)|0,f=f+Math.imul(bt,at)|0,m=m+Math.imul(bt,zt)|0,r=r+Math.imul(D,ft)|0,f=f+Math.imul(D,Dt)|0,f=f+Math.imul(ut,ft)|0,m=m+Math.imul(ut,Dt)|0,r=r+Math.imul(E,ot)|0,f=f+Math.imul(E,Ht)|0,f=f+Math.imul(P,ot)|0,m=m+Math.imul(P,Ht)|0,r=r+Math.imul(Y,st)|0,f=f+Math.imul(Y,Kt)|0,f=f+Math.imul(U,st)|0,m=m+Math.imul(U,Kt)|0,r=r+Math.imul(j,ht)|0,f=f+Math.imul(j,Pt)|0,f=f+Math.imul(Ct,ht)|0,m=m+Math.imul(Ct,Pt)|0;var oe=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(oe>>>26)|0,oe&=67108863,r=Math.imul(Q,nt),f=Math.imul(Q,$t),f=f+Math.imul(Ot,nt)|0,m=Math.imul(Ot,$t),r=r+Math.imul(J,at)|0,f=f+Math.imul(J,zt)|0,f=f+Math.imul(Lt,at)|0,m=m+Math.imul(Lt,zt)|0,r=r+Math.imul(V,ft)|0,f=f+Math.imul(V,Dt)|0,f=f+Math.imul(bt,ft)|0,m=m+Math.imul(bt,Dt)|0,r=r+Math.imul(D,ot)|0,f=f+Math.imul(D,Ht)|0,f=f+Math.imul(ut,ot)|0,m=m+Math.imul(ut,Ht)|0,r=r+Math.imul(E,st)|0,f=f+Math.imul(E,Kt)|0,f=f+Math.imul(P,st)|0,m=m+Math.imul(P,Kt)|0,r=r+Math.imul(Y,ht)|0,f=f+Math.imul(Y,Pt)|0,f=f+Math.imul(U,ht)|0,m=m+Math.imul(U,Pt)|0;var se=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(se>>>26)|0,se&=67108863,r=Math.imul(Q,at),f=Math.imul(Q,zt),f=f+Math.imul(Ot,at)|0,m=Math.imul(Ot,zt),r=r+Math.imul(J,ft)|0,f=f+Math.imul(J,Dt)|0,f=f+Math.imul(Lt,ft)|0,m=m+Math.imul(Lt,Dt)|0,r=r+Math.imul(V,ot)|0,f=f+Math.imul(V,Ht)|0,f=f+Math.imul(bt,ot)|0,m=m+Math.imul(bt,Ht)|0,r=r+Math.imul(D,st)|0,f=f+Math.imul(D,Kt)|0,f=f+Math.imul(ut,st)|0,m=m+Math.imul(ut,Kt)|0,r=r+Math.imul(E,ht)|0,f=f+Math.imul(E,Pt)|0,f=f+Math.imul(P,ht)|0,m=m+Math.imul(P,Pt)|0;var he=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(he>>>26)|0,he&=67108863,r=Math.imul(Q,ft),f=Math.imul(Q,Dt),f=f+Math.imul(Ot,ft)|0,m=Math.imul(Ot,Dt),r=r+Math.imul(J,ot)|0,f=f+Math.imul(J,Ht)|0,f=f+Math.imul(Lt,ot)|0,m=m+Math.imul(Lt,Ht)|0,r=r+Math.imul(V,st)|0,f=f+Math.imul(V,Kt)|0,f=f+Math.imul(bt,st)|0,m=m+Math.imul(bt,Kt)|0,r=r+Math.imul(D,ht)|0,f=f+Math.imul(D,Pt)|0,f=f+Math.imul(ut,ht)|0,m=m+Math.imul(ut,Pt)|0;var ue=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(ue>>>26)|0,ue&=67108863,r=Math.imul(Q,ot),f=Math.imul(Q,Ht),f=f+Math.imul(Ot,ot)|0,m=Math.imul(Ot,Ht),r=r+Math.imul(J,st)|0,f=f+Math.imul(J,Kt)|0,f=f+Math.imul(Lt,st)|0,m=m+Math.imul(Lt,Kt)|0,r=r+Math.imul(V,ht)|0,f=f+Math.imul(V,Pt)|0,f=f+Math.imul(bt,ht)|0,m=m+Math.imul(bt,Pt)|0;var le=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(le>>>26)|0,le&=67108863,r=Math.imul(Q,st),f=Math.imul(Q,Kt),f=f+Math.imul(Ot,st)|0,m=Math.imul(Ot,Kt),r=r+Math.imul(J,ht)|0,f=f+Math.imul(J,Pt)|0,f=f+Math.imul(Lt,ht)|0,m=m+Math.imul(Lt,Pt)|0;var ce=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(ce>>>26)|0,ce&=67108863,r=Math.imul(Q,ht),f=Math.imul(Q,Pt),f=f+Math.imul(Ot,ht)|0,m=Math.imul(Ot,Pt);var Ue=(d+r|0)+((f&8191)<<13)|0;return d=(m+(f>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,p[0]=Jt,p[1]=jt,p[2]=Yt,p[3]=Xt,p[4]=Qt,p[5]=te,p[6]=ee,p[7]=re,p[8]=ie,p[9]=ne,p[10]=ae,p[11]=fe,p[12]=oe,p[13]=se,p[14]=he,p[15]=ue,p[16]=le,p[17]=ce,p[18]=Ue,d!==0&&(p[19]=d,s.length++),s};Math.imul||(N=M);function x(e,t,i){i.negative=t.negative^e.negative,i.length=e.length+t.length;for(var s=0,l=0,c=0;c<i.length-1;c++){var p=l;l=0;for(var d=s&67108863,r=Math.min(c,t.length-1),f=Math.max(0,c-e.length+1);f<=r;f++){var m=c-f,_=e.words[m]|0,R=t.words[f]|0,C=_*R,F=C&67108863;p=p+(C/67108864|0)|0,F=F+d|0,d=F&67108863,p=p+(F>>>26)|0,l+=p>>>26,p&=67108863}i.words[c]=d,s=p,p=l}return s!==0?i.words[c]=s:i.length--,i.strip()}function A(e,t,i){var s=new S;return s.mulp(e,t,i)}o.prototype.mulTo=function(t,i){var s,l=this.length+t.length;return this.length===10&&t.length===10?s=N(this,t,i):l<63?s=M(this,t,i):l<1024?s=x(this,t,i):s=A(this,t,i),s};function S(e,t){this.x=e,this.y=t}S.prototype.makeRBT=function(t){for(var i=new Array(t),s=o.prototype._countBits(t)-1,l=0;l<t;l++)i[l]=this.revBin(l,s,t);return i},S.prototype.revBin=function(t,i,s){if(t===0||t===s-1)return t;for(var l=0,c=0;c<i;c++)l|=(t&1)<<i-c-1,t>>=1;return l},S.prototype.permute=function(t,i,s,l,c,p){for(var d=0;d<p;d++)l[d]=i[t[d]],c[d]=s[t[d]]},S.prototype.transform=function(t,i,s,l,c,p){this.permute(p,t,i,s,l,c);for(var d=1;d<c;d<<=1)for(var r=d<<1,f=Math.cos(2*Math.PI/r),m=Math.sin(2*Math.PI/r),_=0;_<c;_+=r)for(var R=f,C=m,F=0;F<d;F++){var z=s[_+F],lt=l[_+F],G=s[_+F+d],Z=l[_+F+d],mt=R*G-C*Z;Z=R*Z+C*G,G=mt,s[_+F]=z+G,l[_+F]=lt+Z,s[_+F+d]=z-G,l[_+F+d]=lt-Z,F!==r&&(mt=f*R-m*C,C=f*C+m*R,R=mt)}},S.prototype.guessLen13b=function(t,i){var s=Math.max(i,t)|1,l=s&1,c=0;for(s=s/2|0;s;s=s>>>1)c++;return 1<<c+1+l},S.prototype.conjugate=function(t,i,s){if(!(s<=1))for(var l=0;l<s/2;l++){var c=t[l];t[l]=t[s-l-1],t[s-l-1]=c,c=i[l],i[l]=-i[s-l-1],i[s-l-1]=-c}},S.prototype.normalize13b=function(t,i){for(var s=0,l=0;l<i/2;l++){var c=Math.round(t[2*l+1]/i)*8192+Math.round(t[2*l]/i)+s;t[l]=c&67108863,c<67108864?s=0:s=c/67108864|0}return t},S.prototype.convert13b=function(t,i,s,l){for(var c=0,p=0;p<i;p++)c=c+(t[p]|0),s[2*p]=c&8191,c=c>>>13,s[2*p+1]=c&8191,c=c>>>13;for(p=2*i;p<l;++p)s[p]=0;u(c===0),u((c&-8192)===0)},S.prototype.stub=function(t){for(var i=new Array(t),s=0;s<t;s++)i[s]=0;return i},S.prototype.mulp=function(t,i,s){var l=2*this.guessLen13b(t.length,i.length),c=this.makeRBT(l),p=this.stub(l),d=new Array(l),r=new Array(l),f=new Array(l),m=new Array(l),_=new Array(l),R=new Array(l),C=s.words;C.length=l,this.convert13b(t.words,t.length,d,l),this.convert13b(i.words,i.length,m,l),this.transform(d,p,r,f,l,c),this.transform(m,p,_,R,l,c);for(var F=0;F<l;F++){var z=r[F]*_[F]-f[F]*R[F];f[F]=r[F]*R[F]+f[F]*_[F],r[F]=z}return this.conjugate(r,f,l),this.transform(r,f,C,p,l,c),this.conjugate(C,p,l),this.normalize13b(C,l),s.negative=t.negative^i.negative,s.length=t.length+i.length,s.strip()},o.prototype.mul=function(t){var i=new o(null);return i.words=new Array(this.length+t.length),this.mulTo(t,i)},o.prototype.mulf=function(t){var i=new o(null);return i.words=new Array(this.length+t.length),A(this,t,i)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){u(typeof t=="number"),u(t<67108864);for(var i=0,s=0;s<this.length;s++){var l=(this.words[s]|0)*t,c=(l&67108863)+(i&67108863);i>>=26,i+=l/67108864|0,i+=c>>>26,this.words[s]=c&67108863}return i!==0&&(this.words[s]=i,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var i=$(t);if(i.length===0)return new o(1);for(var s=this,l=0;l<i.length&&i[l]===0;l++,s=s.sqr());if(++l<i.length)for(var c=s.sqr();l<i.length;l++,c=c.sqr())i[l]!==0&&(s=s.mul(c));return s},o.prototype.iushln=function(t){u(typeof t=="number"&&t>=0);var i=t%26,s=(t-i)/26,l=67108863>>>26-i<<26-i,c;if(i!==0){var p=0;for(c=0;c<this.length;c++){var d=this.words[c]&l,r=(this.words[c]|0)-d<<i;this.words[c]=r|p,p=d>>>26-i}p&&(this.words[c]=p,this.length++)}if(s!==0){for(c=this.length-1;c>=0;c--)this.words[c+s]=this.words[c];for(c=0;c<s;c++)this.words[c]=0;this.length+=s}return this.strip()},o.prototype.ishln=function(t){return u(this.negative===0),this.iushln(t)},o.prototype.iushrn=function(t,i,s){u(typeof t=="number"&&t>=0);var l;i?l=(i-i%26)/26:l=0;var c=t%26,p=Math.min((t-c)/26,this.length),d=67108863^67108863>>>c<<c,r=s;if(l-=p,l=Math.max(0,l),r){for(var f=0;f<p;f++)r.words[f]=this.words[f];r.length=p}if(p!==0)if(this.length>p)for(this.length-=p,f=0;f<this.length;f++)this.words[f]=this.words[f+p];else this.words[0]=0,this.length=1;var m=0;for(f=this.length-1;f>=0&&(m!==0||f>=l);f--){var _=this.words[f]|0;this.words[f]=m<<26-c|_>>>c,m=_&d}return r&&m!==0&&(r.words[r.length++]=m),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,i,s){return u(this.negative===0),this.iushrn(t,i,s)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){u(typeof t=="number"&&t>=0);var i=t%26,s=(t-i)/26,l=1<<i;if(this.length<=s)return!1;var c=this.words[s];return!!(c&l)},o.prototype.imaskn=function(t){u(typeof t=="number"&&t>=0);var i=t%26,s=(t-i)/26;if(u(this.negative===0,"imaskn works only with positive numbers"),this.length<=s)return this;if(i!==0&&s++,this.length=Math.min(s,this.length),i!==0){var l=67108863^67108863>>>i<<i;this.words[this.length-1]&=l}return this.strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return u(typeof t=="number"),u(t<67108864),t<0?this.isubn(-t):this.negative!==0?this.length===1&&(this.words[0]|0)<t?(this.words[0]=t-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var i=0;i<this.length&&this.words[i]>=67108864;i++)this.words[i]-=67108864,i===this.length-1?this.words[i+1]=1:this.words[i+1]++;return this.length=Math.max(this.length,i+1),this},o.prototype.isubn=function(t){if(u(typeof t=="number"),u(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 i=0;i<this.length&&this.words[i]<0;i++)this.words[i]+=67108864,this.words[i+1]-=1;return this.strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,i,s){var l=t.length+s,c;this._expand(l);var p,d=0;for(c=0;c<t.length;c++){p=(this.words[c+s]|0)+d;var r=(t.words[c]|0)*i;p-=r&67108863,d=(p>>26)-(r/67108864|0),this.words[c+s]=p&67108863}for(;c<this.length-s;c++)p=(this.words[c+s]|0)+d,d=p>>26,this.words[c+s]=p&67108863;if(d===0)return this.strip();for(u(d===-1),d=0,c=0;c<this.length;c++)p=-(this.words[c]|0)+d,d=p>>26,this.words[c]=p&67108863;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,i){var s=this.length-t.length,l=this.clone(),c=t,p=c.words[c.length-1]|0,d=this._countBits(p);s=26-d,s!==0&&(c=c.ushln(s),l.iushln(s),p=c.words[c.length-1]|0);var r=l.length-c.length,f;if(i!=="mod"){f=new o(null),f.length=r+1,f.words=new Array(f.length);for(var m=0;m<f.length;m++)f.words[m]=0}var _=l.clone()._ishlnsubmul(c,1,r);_.negative===0&&(l=_,f&&(f.words[r]=1));for(var R=r-1;R>=0;R--){var C=(l.words[c.length+R]|0)*67108864+(l.words[c.length+R-1]|0);for(C=Math.min(C/p|0,67108863),l._ishlnsubmul(c,C,R);l.negative!==0;)C--,l.negative=0,l._ishlnsubmul(c,1,R),l.isZero()||(l.negative^=1);f&&(f.words[R]=C)}return f&&f.strip(),l.strip(),i!=="div"&&s!==0&&l.iushrn(s),{div:f||null,mod:l}},o.prototype.divmod=function(t,i,s){if(u(!t.isZero()),this.isZero())return{div:new o(0),mod:new o(0)};var l,c,p;return this.negative!==0&&t.negative===0?(p=this.neg().divmod(t,i),i!=="mod"&&(l=p.div.neg()),i!=="div"&&(c=p.mod.neg(),s&&c.negative!==0&&c.iadd(t)),{div:l,mod:c}):this.negative===0&&t.negative!==0?(p=this.divmod(t.neg(),i),i!=="mod"&&(l=p.div.neg()),{div:l,mod:p.mod}):this.negative&t.negative?(p=this.neg().divmod(t.neg(),i),i!=="div"&&(c=p.mod.neg(),s&&c.negative!==0&&c.isub(t)),{div:p.div,mod:c}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:t.length===1?i==="div"?{div:this.divn(t.words[0]),mod:null}:i==="mod"?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,i)},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var i=this.divmod(t);if(i.mod.isZero())return i.div;var s=i.div.negative!==0?i.mod.isub(t):i.mod,l=t.ushrn(1),c=t.andln(1),p=s.cmp(l);return p<0||c===1&&p===0?i.div:i.div.negative!==0?i.div.isubn(1):i.div.iaddn(1)},o.prototype.modn=function(t){u(t<=67108863);for(var i=(1<<26)%t,s=0,l=this.length-1;l>=0;l--)s=(i*s+(this.words[l]|0))%t;return s},o.prototype.idivn=function(t){u(t<=67108863);for(var i=0,s=this.length-1;s>=0;s--){var l=(this.words[s]|0)+i*67108864;this.words[s]=l/t|0,i=l%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){u(t.negative===0),u(!t.isZero());var i=this,s=t.clone();i.negative!==0?i=i.umod(t):i=i.clone();for(var l=new o(1),c=new o(0),p=new o(0),d=new o(1),r=0;i.isEven()&&s.isEven();)i.iushrn(1),s.iushrn(1),++r;for(var f=s.clone(),m=i.clone();!i.isZero();){for(var _=0,R=1;!(i.words[0]&R)&&_<26;++_,R<<=1);if(_>0)for(i.iushrn(_);_-- >0;)(l.isOdd()||c.isOdd())&&(l.iadd(f),c.isub(m)),l.iushrn(1),c.iushrn(1);for(var C=0,F=1;!(s.words[0]&F)&&C<26;++C,F<<=1);if(C>0)for(s.iushrn(C);C-- >0;)(p.isOdd()||d.isOdd())&&(p.iadd(f),d.isub(m)),p.iushrn(1),d.iushrn(1);i.cmp(s)>=0?(i.isub(s),l.isub(p),c.isub(d)):(s.isub(i),p.isub(l),d.isub(c))}return{a:p,b:d,gcd:s.iushln(r)}},o.prototype._invmp=function(t){u(t.negative===0),u(!t.isZero());var i=this,s=t.clone();i.negative!==0?i=i.umod(t):i=i.clone();for(var l=new o(1),c=new o(0),p=s.clone();i.cmpn(1)>0&&s.cmpn(1)>0;){for(var d=0,r=1;!(i.words[0]&r)&&d<26;++d,r<<=1);if(d>0)for(i.iushrn(d);d-- >0;)l.isOdd()&&l.iadd(p),l.iushrn(1);for(var f=0,m=1;!(s.words[0]&m)&&f<26;++f,m<<=1);if(f>0)for(s.iushrn(f);f-- >0;)c.isOdd()&&c.iadd(p),c.iushrn(1);i.cmp(s)>=0?(i.isub(s),l.isub(c)):(s.isub(i),c.isub(l))}var _;return i.cmpn(1)===0?_=l:_=c,_.cmpn(0)<0&&_.iadd(t),_},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var i=this.clone(),s=t.clone();i.negative=0,s.negative=0;for(var l=0;i.isEven()&&s.isEven();l++)i.iushrn(1),s.iushrn(1);do{for(;i.isEven();)i.iushrn(1);for(;s.isEven();)s.iushrn(1);var c=i.cmp(s);if(c<0){var p=i;i=s,s=p}else if(c===0||s.cmpn(1)===0)break;i.isub(s)}while(!0);return s.iushln(l)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return(this.words[0]&1)===0},o.prototype.isOdd=function(){return(this.words[0]&1)===1},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){u(typeof t=="number");var i=t%26,s=(t-i)/26,l=1<<i;if(this.length<=s)return this._expand(s+1),this.words[s]|=l,this;for(var c=l,p=s;c!==0&&p<this.length;p++){var d=this.words[p]|0;d+=c,c=d>>>26,d&=67108863,this.words[p]=d}return c!==0&&(this.words[p]=c,this.length++),this},o.prototype.isZero=function(){return this.length===1&&this.words[0]===0},o.prototype.cmpn=function(t){var i=t<0;if(this.negative!==0&&!i)return-1;if(this.negative===0&&i)return 1;this.strip();var s;if(this.length>1)s=1;else{i&&(t=-t),u(t<=67108863,"Number is too big");var l=this.words[0]|0;s=l===t?0:l<t?-1:1}return this.negative!==0?-s|0:s},o.prototype.cmp=function(t){if(this.negative!==0&&t.negative===0)return-1;if(this.negative===0&&t.negative!==0)return 1;var i=this.ucmp(t);return this.negative!==0?-i|0:i},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var i=0,s=this.length-1;s>=0;s--){var l=this.words[s]|0,c=t.words[s]|0;if(l!==c){l<c?i=-1:l>c&&(i=1);break}}return i},o.prototype.gtn=function(t){return this.cmpn(t)===1},o.prototype.gt=function(t){return this.cmp(t)===1},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return this.cmpn(t)===-1},o.prototype.lt=function(t){return this.cmp(t)===-1},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return this.cmpn(t)===0},o.prototype.eq=function(t){return this.cmp(t)===0},o.red=function(t){return new dt(t)},o.prototype.toRed=function(t){return u(!this.red,"Already a number in reduction context"),u(this.negative===0,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return u(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return u(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return u(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return u(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return u(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return u(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return u(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return u(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return u(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return u(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return u(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return u(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return u(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return u(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return u(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var T={k256:null,p224:null,p192:null,p25519:null};function O(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}O.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},O.prototype.ireduce=function(t){var i=t,s;do this.split(i,this.tmp),i=this.imulK(i),i=i.iadd(this.tmp),s=i.bitLength();while(s>this.n);var l=s<this.n?-1:i.ucmp(this.p);return l===0?(i.words[0]=0,i.length=1):l>0?i.isub(this.p):i.strip!==void 0?i.strip():i._strip(),i},O.prototype.split=function(t,i){t.iushrn(this.n,0,i)},O.prototype.imulK=function(t){return t.imul(this.k)};function W(){O.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}v(W,O),W.prototype.split=function(t,i){for(var s=4194303,l=Math.min(t.length,9),c=0;c<l;c++)i.words[c]=t.words[c];if(i.length=l,t.length<=9){t.words[0]=0,t.length=1;return}var p=t.words[9];for(i.words[i.length++]=p&s,c=10;c<t.length;c++){var d=t.words[c]|0;t.words[c-10]=(d&s)<<4|p>>>22,p=d}p>>>=22,t.words[c-10]=p,p===0&&t.length>10?t.length-=10:t.length-=9},W.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var i=0,s=0;s<t.length;s++){var l=t.words[s]|0;i+=l*977,t.words[s]=i&67108863,i=l*64+(i/67108864|0)}return t.words[t.length-1]===0&&(t.length--,t.words[t.length-1]===0&&t.length--),t};function K(){O.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}v(K,O);function pt(){O.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}v(pt,O);function ct(){O.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}v(ct,O),ct.prototype.imulK=function(t){for(var i=0,s=0;s<t.length;s++){var l=(t.words[s]|0)*19+i,c=l&67108863;l>>>=26,t.words[s]=c,i=l}return i!==0&&(t.words[t.length++]=i),t},o._prime=function(t){if(T[t])return T[t];var i;if(t==="k256")i=new W;else if(t==="p224")i=new K;else if(t==="p192")i=new pt;else if(t==="p25519")i=new ct;else throw new Error("Unknown prime "+t);return T[t]=i,i};function dt(e){if(typeof e=="string"){var t=o._prime(e);this.m=t.p,this.prime=t}else u(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}dt.prototype._verify1=function(t){u(t.negative===0,"red works only with positives"),u(t.red,"red works only with red numbers")},dt.prototype._verify2=function(t,i){u((t.negative|i.negative)===0,"red works only with positives"),u(t.red&&t.red===i.red,"red works only with red numbers")},dt.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},dt.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},dt.prototype.add=function(t,i){this._verify2(t,i);var s=t.add(i);return s.cmp(this.m)>=0&&s.isub(this.m),s._forceRed(this)},dt.prototype.iadd=function(t,i){this._verify2(t,i);var s=t.iadd(i);return s.cmp(this.m)>=0&&s.isub(this.m),s},dt.prototype.sub=function(t,i){this._verify2(t,i);var s=t.sub(i);return s.cmpn(0)<0&&s.iadd(this.m),s._forceRed(this)},dt.prototype.isub=function(t,i){this._verify2(t,i);var s=t.isub(i);return s.cmpn(0)<0&&s.iadd(this.m),s},dt.prototype.shl=function(t,i){return this._verify1(t),this.imod(t.ushln(i))},dt.prototype.imul=function(t,i){return this._verify2(t,i),this.imod(t.imul(i))},dt.prototype.mul=function(t,i){return this._verify2(t,i),this.imod(t.mul(i))},dt.prototype.isqr=function(t){return this.imul(t,t.clone())},dt.prototype.sqr=function(t){return this.mul(t,t)},dt.prototype.sqrt=function(t){if(t.isZero())return t.clone();var i=this.m.andln(3);if(u(i%2===1),i===3){var s=this.m.add(new o(1)).iushrn(2);return this.pow(t,s)}for(var l=this.m.subn(1),c=0;!l.isZero()&&l.andln(1)===0;)c++,l.iushrn(1);u(!l.isZero());var p=new o(1).toRed(this),d=p.redNeg(),r=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new o(2*f*f).toRed(this);this.pow(f,r).cmp(d)!==0;)f.redIAdd(d);for(var m=this.pow(f,l),_=this.pow(t,l.addn(1).iushrn(1)),R=this.pow(t,l),C=c;R.cmp(p)!==0;){for(var F=R,z=0;F.cmp(p)!==0;z++)F=F.redSqr();u(z<C);var lt=this.pow(m,new o(1).iushln(C-z-1));_=_.redMul(lt),m=lt.redSqr(),R=R.redMul(m),C=z}return _},dt.prototype.invm=function(t){var i=t._invmp(this.m);return i.negative!==0?(i.negative=0,this.imod(i).redNeg()):this.imod(i)},dt.prototype.pow=function(t,i){if(i.isZero())return new o(1).toRed(this);if(i.cmpn(1)===0)return t.clone();var s=4,l=new Array(1<<s);l[0]=new o(1).toRed(this),l[1]=t;for(var c=2;c<l.length;c++)l[c]=this.mul(l[c-1],t);var p=l[0],d=0,r=0,f=i.bitLength()%26;for(f===0&&(f=26),c=i.length-1;c>=0;c--){for(var m=i.words[c],_=f-1;_>=0;_--){var R=m>>_&1;if(p!==l[0]&&(p=this.sqr(p)),R===0&&d===0){r=0;continue}d<<=1,d|=R,r++,!(r!==s&&(c!==0||_!==0))&&(p=this.mul(p,l[d]),r=0,d=0)}f=26}return p},dt.prototype.convertTo=function(t){var i=t.umod(this.m);return i===t?i.clone():i},dt.prototype.convertFrom=function(t){var i=t.clone();return i.red=null,i},o.mont=function(t){return new g(t)};function g(e){dt.call(this,e),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v(g,dt),g.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},g.prototype.convertFrom=function(t){var i=this.imod(t.mul(this.rinv));return i.red=null,i},g.prototype.imul=function(t,i){if(t.isZero()||i.isZero())return t.words[0]=0,t.length=1,t;var s=t.imul(i),l=s.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),c=s.isub(l).iushrn(this.shift),p=c;return c.cmp(this.m)>=0?p=c.isub(this.m):c.cmpn(0)<0&&(p=c.iadd(this.m)),p._forceRed(this)},g.prototype.mul=function(t,i){if(t.isZero()||i.isZero())return new o(0)._forceRed(this);var s=t.mul(i),l=s.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),c=s.isub(l).iushrn(this.shift),p=c;return c.cmp(this.m)>=0?p=c.isub(this.m):c.cmpn(0)<0&&(p=c.iadd(this.m)),p._forceRed(this)},g.prototype.invm=function(t){var i=this.imod(t._invmp(this.m).mul(this.r2));return i._forceRed(this)}})(a,Vt)})(Eo);var Oh=Eo.exports,Or=Oh,Jm=Gi.ec,ko=new Jm("secp256k1"),ai=ko.curve;tn.privateKeyExport=function(a,n){var h=new Or(a);if(h.ucmp(ai.n)>=0)throw new Error("couldn't export to DER format");var u=ko.g.mul(h);return Nh(u.getX(),u.getY(),n)};tn.privateKeyModInverse=function(a){var n=new Or(a);if(n.ucmp(ai.n)>=0||n.isZero())throw new Error("private key range is invalid");return n.invm(ai.n).toArrayLike(X,"be",32)};tn.signatureImport=function(a){var n=new Or(a.r);n.ucmp(ai.n)>=0&&(n=new Or(0));var h=new Or(a.s);return h.ucmp(ai.n)>=0&&(h=new Or(0)),X.concat([n.toArrayLike(X,"be",32),h.toArrayLike(X,"be",32)])};tn.ecdhUnsafe=function(a,n,h){var u=ko.keyFromPublic(a),v=new Or(n);if(v.ucmp(ai.n)>=0||v.isZero())throw new Error("scalar was invalid (zero or overflow)");var o=u.pub.mul(v);return Nh(o.getX(),o.getY(),h)};var Nh=function(n,h,u){var v=void 0;return u?(v=X.alloc(33),v[0]=h.isOdd()?3:2,n.toArrayLike(X,"be",32).copy(v,1)):(v=X.alloc(65),v[0]=4,n.toArrayLike(X,"be",32).copy(v,1),h.toArrayLike(X,"be",32).copy(v,33)),v},fa={},jm=X.from([48,129,211,2,1,1,4,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,129,133,48,129,130,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,33,2,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,36,3,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),Ym=X.from([48,130,1,19,2,1,1,4,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,129,165,48,129,162,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,65,4,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,72,58,218,119,38,163,196,101,93,164,251,252,14,17,8,168,253,23,180,72,166,133,84,25,156,71,208,143,251,16,212,184,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,68,3,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);fa.privateKeyExport=function(a,n,h){var u=X.from(h?jm:Ym);return a.copy(u,h?8:9),n.copy(u,h?181:214),u};fa.privateKeyImport=function(a){var n=a.length,h=0;if(n<h+1||a[h]!==48||(h+=1,n<h+1||!(a[h]&128)))return null;var u=a[h]&127;if(h+=1,u<1||u>2||n<h+u)return null;var v=a[h+u-1]|(u>1?a[h+u-2]<<8:0);return h+=u,n<h+v||n<h+3||a[h]!==2||a[h+1]!==1||a[h+2]!==1||(h+=3,n<h+2||a[h]!==4||a[h+1]>32||n<h+2+a[h+1])?null:a.slice(h+2,h+2+a[h+1])};fa.signatureImportLax=function(a){var n=X.alloc(32,0),h=X.alloc(32,0),u=a.length,v=0;if(a[v++]!==48)return null;var o=a[v++];if(o&128&&(v+=o-128,v>u)||a[v++]!==2)return null;var w=a[v++];if(w&128){if(o=w-128,v+o>u)return null;for(;o>0&&a[v]===0;v+=1,o-=1);for(w=0;o>0;v+=1,o-=1)w=(w<<8)+a[v]}if(w>u-v)return null;var y=v;if(v+=w,a[v++]!==2)return null;var b=a[v++];if(b&128){if(o=b-128,v+o>u)return null;for(;o>0&&a[v]===0;v+=1,o-=1);for(b=0;o>0;v+=1,o-=1)b=(b<<8)+a[v]}if(b>u-v)return null;var B=v;for(v+=b;w>0&&a[y]===0;w-=1,y+=1);if(w>32)return null;var k=a.slice(y,y+w);for(k.copy(n,32-k.length);b>0&&a[B]===0;b-=1,B+=1);if(b>32)return null;var L=a.slice(B,B+b);return L.copy(h,32-L.length),{r:n,s:h}};var Te=Lh,oa=tn,Ro=fa,qh=function(n){return n.length!==32?!1:Te.privateKeyVerify(Uint8Array.from(n))},Xm=function(n,h){if(n.length!==32)throw new RangeError("private key length is invalid");var u=oa.privateKeyExport(n,h);return Ro.privateKeyExport(n,u,h)},Qm=function(n){if(n=Ro.privateKeyImport(n),n!==null&&n.length===32&&qh(n))return n;throw new Error("couldn't import from DER format")},t1=function(n){return X.from(Te.privateKeyNegate(Uint8Array.from(n)))},e1=function(n){if(n.length!==32)throw new Error("private key length is invalid");return X.from(oa.privateKeyModInverse(Uint8Array.from(n)))},r1=function(n,h){return X.from(Te.privateKeyTweakAdd(Uint8Array.from(n),h))},i1=function(n,h){return X.from(Te.privateKeyTweakMul(Uint8Array.from(n),Uint8Array.from(h)))},n1=function(n,h){return X.from(Te.publicKeyCreate(Uint8Array.from(n),h))},a1=function(n,h){return X.from(Te.publicKeyConvert(Uint8Array.from(n),h))},f1=function(n){return n.length!==33&&n.length!==65?!1:Te.publicKeyVerify(Uint8Array.from(n))},o1=function(n,h,u){return X.from(Te.publicKeyTweakAdd(Uint8Array.from(n),Uint8Array.from(h),u))},s1=function(n,h,u){return X.from(Te.publicKeyTweakMul(Uint8Array.from(n),Uint8Array.from(h),u))},h1=function(n,h){var u=[];return n.forEach(function(v){u.push(Uint8Array.from(v))}),X.from(Te.publicKeyCombine(u,h))},u1=function(n){return X.from(Te.signatureNormalize(Uint8Array.from(n)))},l1=function(n){return X.from(Te.signatureExport(Uint8Array.from(n)))},c1=function(n){return X.from(Te.signatureImport(Uint8Array.from(n)))},d1=function(n){if(n.length===0)throw new RangeError("signature length is invalid");var h=Ro.signatureImportLax(n);if(h===null)throw new Error("couldn't parse DER signature");return oa.signatureImport(h)},v1=function(n,h,u){if(u===null)throw new TypeError("options should be an Object");var v=void 0;if(u){if(v={},u.data===null)throw new TypeError("options.data should be a Buffer");if(u.data){if(u.data.length!==32)throw new RangeError("options.data length is invalid");v.data=new Uint8Array(u.data)}if(u.noncefn===null)throw new TypeError("options.noncefn should be a Function");u.noncefn&&(v.noncefn=function(w,y,b,B,k){var L=b!=null?X.from(b):null,q=B!=null?X.from(B):null,$=X.from("");return u.noncefn&&($=u.noncefn(X.from(w),X.from(y),L,q,k)),Uint8Array.from($)})}var o=Te.ecdsaSign(Uint8Array.from(n),Uint8Array.from(h),v);return{signature:X.from(o.signature),recovery:o.recid}},p1=function(n,h,u){return Te.ecdsaVerify(Uint8Array.from(h),Uint8Array.from(n),u)},m1=function(n,h,u,v){return X.from(Te.ecdsaRecover(Uint8Array.from(h),u,Uint8Array.from(n),v))},g1=function(n,h){return X.from(Te.ecdh(Uint8Array.from(n),Uint8Array.from(h),{}))},y1=function(n,h,u){if(n.length!==33&&n.length!==65)throw new RangeError("public key length is invalid");if(h.length!==32)throw new RangeError("private key length is invalid");return X.from(oa.ecdhUnsafe(Uint8Array.from(n),Uint8Array.from(h),u))},w1={privateKeyVerify:qh,privateKeyExport:Xm,privateKeyImport:Qm,privateKeyNegate:t1,privateKeyModInverse:e1,privateKeyTweakAdd:r1,privateKeyTweakMul:i1,publicKeyCreate:n1,publicKeyConvert:a1,publicKeyVerify:f1,publicKeyTweakAdd:o1,publicKeyTweakMul:s1,publicKeyCombine:h1,signatureNormalize:u1,signatureExport:l1,signatureImport:c1,signatureImportLax:d1,sign:v1,verify:p1,recover:m1,ecdh:g1,ecdhUnsafe:y1};(function(a){var n=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(M){return typeof M}:function(M){return M&&typeof Symbol=="function"&&M.constructor===Symbol&&M!==Symbol.prototype?"symbol":typeof M},h=wi,u=h.keccak224,v=h.keccak384,o=h.keccak256,w=h.keccak512,y=w1,b=Se,B=Ge,k=Oh,L=co,q=Di.Buffer;Object.assign(a,Hr),a.MAX_INTEGER=new k("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),a.TWO_POW256=new k("10000000000000000000000000000000000000000000000000000000000000000",16),a.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",a.SHA3_NULL_S=a.KECCAK256_NULL_S,a.KECCAK256_NULL=q.from(a.KECCAK256_NULL_S,"hex"),a.SHA3_NULL=a.KECCAK256_NULL,a.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",a.SHA3_RLP_ARRAY_S=a.KECCAK256_RLP_ARRAY_S,a.KECCAK256_RLP_ARRAY=q.from(a.KECCAK256_RLP_ARRAY_S,"hex"),a.SHA3_RLP_ARRAY=a.KECCAK256_RLP_ARRAY,a.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",a.SHA3_RLP_S=a.KECCAK256_RLP_S,a.KECCAK256_RLP=q.from(a.KECCAK256_RLP_S,"hex"),a.SHA3_RLP=a.KECCAK256_RLP,a.BN=k,a.rlp=B,a.secp256k1=y,a.zeros=function(M){return q.allocUnsafe(M).fill(0)},a.zeroAddress=function(){var M=20,N=a.zeros(M);return a.bufferToHex(N)},a.setLengthLeft=a.setLength=function(M,N,x){var A=a.zeros(N);return M=a.toBuffer(M),x?M.length<N?(M.copy(A),A):M.slice(0,N):M.length<N?(M.copy(A,N-M.length),A):M.slice(-N)},a.setLengthRight=function(M,N){return a.setLength(M,N,!0)},a.unpad=a.stripZeros=function(M){M=a.stripHexPrefix(M);for(var N=M[0];M.length>0&&N.toString()==="0";)M=M.slice(1),N=M[0];return M},a.toBuffer=function(M){if(!q.isBuffer(M))if(Array.isArray(M))M=q.from(M);else if(typeof M=="string")a.isHexString(M)?M=q.from(a.padToEven(a.stripHexPrefix(M)),"hex"):M=q.from(M);else if(typeof M=="number")M=a.intToBuffer(M);else if(M==null)M=q.allocUnsafe(0);else if(k.isBN(M))M=M.toArrayLike(q);else if(M.toArray)M=q.from(M.toArray());else throw new Error("invalid type");return M},a.bufferToInt=function(M){return new k(a.toBuffer(M)).toNumber()},a.bufferToHex=function(M){return M=a.toBuffer(M),"0x"+M.toString("hex")},a.fromSigned=function(M){return new k(M).fromTwos(256)},a.toUnsigned=function(M){return q.from(M.toTwos(256).toArray())},a.keccak=function(M,N){switch(M=a.toBuffer(M),N||(N=256),N){case 224:return u(M);case 256:return o(M);case 384:return v(M);case 512:return w(M);default:throw new Error("Invald algorithm: keccak"+N)}},a.keccak256=function(M){return a.keccak(M)},a.sha3=a.keccak,a.sha256=function(M){return M=a.toBuffer(M),L("sha256").update(M).digest()},a.ripemd160=function(M,N){M=a.toBuffer(M);var x=L("rmd160").update(M).digest();return N===!0?a.setLength(x,32):x},a.rlphash=function(M){return a.keccak(B.encode(M))},a.isValidPrivate=function(M){return y.privateKeyVerify(M)},a.isValidPublic=function(M,N){return M.length===64?y.publicKeyVerify(q.concat([q.from([4]),M])):N?y.publicKeyVerify(M):!1},a.pubToAddress=a.publicToAddress=function(M,N){return M=a.toBuffer(M),N&&M.length!==64&&(M=y.publicKeyConvert(M,!1).slice(1)),b(M.length===64),a.keccak(M).slice(-20)};var $=a.privateToPublic=function(M){return M=a.toBuffer(M),y.publicKeyCreate(M,!1).slice(1)};a.importPublic=function(M){return M=a.toBuffer(M),M.length!==64&&(M=y.publicKeyConvert(M,!1).slice(1)),M},a.ecsign=function(M,N){var x=y.sign(M,N),A={};return A.r=x.signature.slice(0,32),A.s=x.signature.slice(32,64),A.v=x.recovery+27,A},a.hashPersonalMessage=function(M){var N=a.toBuffer(`Ethereum Signed Message:
|
|
23
|
+
`+M.length.toString());return a.keccak(q.concat([N,M]))},a.ecrecover=function(M,N,x,A){var S=q.concat([a.setLength(x,32),a.setLength(A,32)],64),T=N-27;if(T!==0&&T!==1)throw new Error("Invalid signature v value");var O=y.recover(M,S,T);return y.publicKeyConvert(O,!1).slice(1)},a.toRpcSig=function(M,N,x){if(M!==27&&M!==28)throw new Error("Invalid recovery id");return a.bufferToHex(q.concat([a.setLengthLeft(N,32),a.setLengthLeft(x,32),a.toBuffer(M-27)]))},a.fromRpcSig=function(M){if(M=a.toBuffer(M),M.length!==65)throw new Error("Invalid signature length");var N=M[64];return N<27&&(N+=27),{v:N,r:M.slice(0,32),s:M.slice(32,64)}},a.privateToAddress=function(M){return a.publicToAddress($(M))},a.isValidAddress=function(M){return/^0x[0-9a-fA-F]{40}$/.test(M)},a.isZeroAddress=function(M){var N=a.zeroAddress();return N===a.addHexPrefix(M)},a.toChecksumAddress=function(M){M=a.stripHexPrefix(M).toLowerCase();for(var N=a.keccak(M).toString("hex"),x="0x",A=0;A<M.length;A++)parseInt(N[A],16)>=8?x+=M[A].toUpperCase():x+=M[A];return x},a.isValidChecksumAddress=function(M){return a.isValidAddress(M)&&a.toChecksumAddress(M)===M},a.generateAddress=function(M,N){return M=a.toBuffer(M),N=new k(N),N.isZero()?N=null:N=q.from(N.toArray()),a.rlphash([M,N]).slice(-20)},a.isPrecompiled=function(M){var N=a.unpad(M);return N.length===1&&N[0]>=1&&N[0]<=8},a.addHexPrefix=function(M){return typeof M!="string"||a.isHexPrefixed(M)?M:"0x"+M},a.isValidSignature=function(M,N,x,A){var S=new k("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),T=new k("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",16);return!(N.length!==32||x.length!==32||M!==27&&M!==28||(N=new k(N),x=new k(x),N.isZero()||N.gt(T)||x.isZero()||x.gt(T))||A===!1&&new k(x).cmp(S)===1)},a.baToJSON=function(M){if(q.isBuffer(M))return"0x"+M.toString("hex");if(M instanceof Array){for(var N=[],x=0;x<M.length;x++)N.push(a.baToJSON(M[x]));return N}},a.defineProperties=function(M,N,x){if(M.raw=[],M._fields=[],M.toJSON=function(S){if(S){var T={};return M._fields.forEach(function(O){T[O]="0x"+M[O].toString("hex")}),T}return a.baToJSON(this.raw)},M.serialize=function(){return B.encode(M.raw)},N.forEach(function(S,T){M._fields.push(S.name);function O(){return M.raw[T]}function W(K){K=a.toBuffer(K),K.toString("hex")==="00"&&!S.allowZero&&(K=q.allocUnsafe(0)),S.allowLess&&S.length?(K=a.stripZeros(K),b(S.length>=K.length,"The field "+S.name+" must not have more "+S.length+" bytes")):!(S.allowZero&&K.length===0)&&S.length&&b(S.length===K.length,"The field "+S.name+" must have byte length of "+S.length),M.raw[T]=K}Object.defineProperty(M,S.name,{enumerable:!0,configurable:!0,get:O,set:W}),S.default&&(M[S.name]=S.default),S.alias&&Object.defineProperty(M,S.alias,{enumerable:!1,configurable:!0,set:W,get:O})}),x)if(typeof x=="string"&&(x=q.from(a.stripHexPrefix(x),"hex")),q.isBuffer(x)&&(x=B.decode(x)),Array.isArray(x)){if(x.length>M._fields.length)throw new Error("wrong number of fields in data");x.forEach(function(S,T){M[M._fields[T]]=a.toBuffer(S)})}else if((typeof x>"u"?"undefined":n(x))==="object"){var A=Object.keys(x);N.forEach(function(S){A.indexOf(S.name)!==-1&&(M[S.name]=x[S.name]),A.indexOf(S.alias)!==-1&&(M[S.alias]=x[S.alias])})}else throw new Error("invalid data")}})(Ch);var Uh={},sa={},Fh={},ha={};Object.defineProperty(ha,"__esModule",{value:!0});var $h=oo;function b1(a){return new Promise(function(n,h){$h(a,function(u,v){if(u){h(u);return}n(v)})})}ha.getRandomBytes=b1;function M1(a){return $h(a)}ha.getRandomBytesSync=M1;(function(a){var n=Vt&&Vt.__awaiter||function(B,k,L,q){function $(M){return M instanceof L?M:new L(function(N){N(M)})}return new(L||(L=Promise))(function(M,N){function x(T){try{S(q.next(T))}catch(O){N(O)}}function A(T){try{S(q.throw(T))}catch(O){N(O)}}function S(T){T.done?M(T.value):$(T.value).then(x,A)}S((q=q.apply(B,k||[])).next())})},h=Vt&&Vt.__generator||function(B,k){var L={label:0,sent:function(){if(M[0]&1)throw M[1];return M[1]},trys:[],ops:[]},q,$,M,N;return N={next:x(0),throw:x(1),return:x(2)},typeof Symbol=="function"&&(N[Symbol.iterator]=function(){return this}),N;function x(S){return function(T){return A([S,T])}}function A(S){if(q)throw new TypeError("Generator is already executing.");for(;L;)try{if(q=1,$&&(M=S[0]&2?$.return:S[0]?$.throw||((M=$.return)&&M.call($),0):$.next)&&!(M=M.call($,S[1])).done)return M;switch($=0,M&&(S=[S[0]&2,M.value]),S[0]){case 0:case 1:M=S;break;case 4:return L.label++,{value:S[1],done:!1};case 5:L.label++,$=S[1],S=[0];continue;case 7:S=L.ops.pop(),L.trys.pop();continue;default:if(M=L.trys,!(M=M.length>0&&M[M.length-1])&&(S[0]===6||S[0]===2)){L=0;continue}if(S[0]===3&&(!M||S[1]>M[0]&&S[1]<M[3])){L.label=S[1];break}if(S[0]===6&&L.label<M[1]){L.label=M[1],M=S;break}if(M&&L.label<M[2]){L.label=M[2],L.ops.push(S);break}M[2]&&L.ops.pop(),L.trys.pop();continue}S=k.call(B,L)}catch(T){S=[6,T],$=0}finally{q=M=0}if(S[0]&5)throw S[1];return{value:S[0]?S[1]:void 0,done:!0}}};function u(B){for(var k in B)a.hasOwnProperty(k)||(a[k]=B[k])}Object.defineProperty(a,"__esModule",{value:!0});var v=ii,o=ha,w=32;function y(){return n(this,void 0,void 0,function(){var B;return h(this,function(k){switch(k.label){case 0:return[4,o.getRandomBytes(w)];case 1:return B=k.sent(),v.privateKeyVerify(B)?[2,B]:[3,0];case 2:return[2]}})})}a.createPrivateKey=y;function b(){for(;;){var B=o.getRandomBytesSync(w);if(v.privateKeyVerify(B))return B}}a.createPrivateKeySync=b,u(ii)})(Fh);var bi={},Bo={exports:{}};Bo.exports;(function(a){(function(n,h){function u(e,t){if(!e)throw new Error(t||"Assertion failed")}function v(e,t){e.super_=t;var i=function(){};i.prototype=t.prototype,e.prototype=new i,e.prototype.constructor=e}function o(e,t,i){if(o.isBN(e))return e;this.negative=0,this.words=null,this.length=0,this.red=null,e!==null&&((t==="le"||t==="be")&&(i=t,t=10),this._init(e||0,t||10,i||"be"))}typeof n=="object"?n.exports=o:h.BN=o,o.BN=o,o.wordSize=26;var w;try{typeof window<"u"&&typeof window.Buffer<"u"?w=window.Buffer:w=Se.Buffer}catch{}o.isBN=function(t){return t instanceof o?!0:t!==null&&typeof t=="object"&&t.constructor.wordSize===o.wordSize&&Array.isArray(t.words)},o.max=function(t,i){return t.cmp(i)>0?t:i},o.min=function(t,i){return t.cmp(i)<0?t:i},o.prototype._init=function(t,i,s){if(typeof t=="number")return this._initNumber(t,i,s);if(typeof t=="object")return this._initArray(t,i,s);i==="hex"&&(i=16),u(i===(i|0)&&i>=2&&i<=36),t=t.toString().replace(/\s+/g,"");var l=0;t[0]==="-"&&(l++,this.negative=1),l<t.length&&(i===16?this._parseHex(t,l,s):(this._parseBase(t,i,l),s==="le"&&this._initArray(this.toArray(),i,s)))},o.prototype._initNumber=function(t,i,s){t<0&&(this.negative=1,t=-t),t<67108864?(this.words=[t&67108863],this.length=1):t<4503599627370496?(this.words=[t&67108863,t/67108864&67108863],this.length=2):(u(t<9007199254740992),this.words=[t&67108863,t/67108864&67108863,1],this.length=3),s==="le"&&this._initArray(this.toArray(),i,s)},o.prototype._initArray=function(t,i,s){if(u(typeof t.length=="number"),t.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(t.length/3),this.words=new Array(this.length);for(var l=0;l<this.length;l++)this.words[l]=0;var c,p,d=0;if(s==="be")for(l=t.length-1,c=0;l>=0;l-=3)p=t[l]|t[l-1]<<8|t[l-2]<<16,this.words[c]|=p<<d&67108863,this.words[c+1]=p>>>26-d&67108863,d+=24,d>=26&&(d-=26,c++);else if(s==="le")for(l=0,c=0;l<t.length;l+=3)p=t[l]|t[l+1]<<8|t[l+2]<<16,this.words[c]|=p<<d&67108863,this.words[c+1]=p>>>26-d&67108863,d+=24,d>=26&&(d-=26,c++);return this.strip()};function y(e,t){var i=e.charCodeAt(t);return i>=65&&i<=70?i-55:i>=97&&i<=102?i-87:i-48&15}function b(e,t,i){var s=y(e,i);return i-1>=t&&(s|=y(e,i-1)<<4),s}o.prototype._parseHex=function(t,i,s){this.length=Math.ceil((t.length-i)/6),this.words=new Array(this.length);for(var l=0;l<this.length;l++)this.words[l]=0;var c=0,p=0,d;if(s==="be")for(l=t.length-1;l>=i;l-=2)d=b(t,i,l)<<c,this.words[p]|=d&67108863,c>=18?(c-=18,p+=1,this.words[p]|=d>>>26):c+=8;else{var r=t.length-i;for(l=r%2===0?i+1:i;l<t.length;l+=2)d=b(t,i,l)<<c,this.words[p]|=d&67108863,c>=18?(c-=18,p+=1,this.words[p]|=d>>>26):c+=8}this.strip()};function B(e,t,i,s){for(var l=0,c=Math.min(e.length,i),p=t;p<c;p++){var d=e.charCodeAt(p)-48;l*=s,d>=49?l+=d-49+10:d>=17?l+=d-17+10:l+=d}return l}o.prototype._parseBase=function(t,i,s){this.words=[0],this.length=1;for(var l=0,c=1;c<=67108863;c*=i)l++;l--,c=c/i|0;for(var p=t.length-s,d=p%l,r=Math.min(p,p-d)+s,f=0,m=s;m<r;m+=l)f=B(t,m,m+l,i),this.imuln(c),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f);if(d!==0){var _=1;for(f=B(t,m,t.length,i),m=0;m<d;m++)_*=i;this.imuln(_),this.words[0]+f<67108864?this.words[0]+=f:this._iaddn(f)}this.strip()},o.prototype.copy=function(t){t.words=new Array(this.length);for(var i=0;i<this.length;i++)t.words[i]=this.words[i];t.length=this.length,t.negative=this.negative,t.red=this.red},o.prototype.clone=function(){var t=new o(null);return this.copy(t),t},o.prototype._expand=function(t){for(;this.length<t;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},o.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var k=["","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"],L=[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],q=[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];o.prototype.toString=function(t,i){t=t||10,i=i|0||1;var s;if(t===16||t==="hex"){s="";for(var l=0,c=0,p=0;p<this.length;p++){var d=this.words[p],r=((d<<l|c)&16777215).toString(16);c=d>>>24-l&16777215,c!==0||p!==this.length-1?s=k[6-r.length]+r+s:s=r+s,l+=2,l>=26&&(l-=26,p--)}for(c!==0&&(s=c.toString(16)+s);s.length%i!==0;)s="0"+s;return this.negative!==0&&(s="-"+s),s}if(t===(t|0)&&t>=2&&t<=36){var f=L[t],m=q[t];s="";var _=this.clone();for(_.negative=0;!_.isZero();){var R=_.modn(m).toString(t);_=_.idivn(m),_.isZero()?s=R+s:s=k[f-R.length]+R+s}for(this.isZero()&&(s="0"+s);s.length%i!==0;)s="0"+s;return this.negative!==0&&(s="-"+s),s}u(!1,"Base should be between 2 and 36")},o.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&&u(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-t:t},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(t,i){return u(typeof w<"u"),this.toArrayLike(w,t,i)},o.prototype.toArray=function(t,i){return this.toArrayLike(Array,t,i)},o.prototype.toArrayLike=function(t,i,s){var l=this.byteLength(),c=s||Math.max(1,l);u(l<=c,"byte array longer than desired length"),u(c>0,"Requested array length <= 0"),this.strip();var p=i==="le",d=new t(c),r,f,m=this.clone();if(p){for(f=0;!m.isZero();f++)r=m.andln(255),m.iushrn(8),d[f]=r;for(;f<c;f++)d[f]=0}else{for(f=0;f<c-l;f++)d[f]=0;for(f=0;!m.isZero();f++)r=m.andln(255),m.iushrn(8),d[c-f-1]=r}return d},Math.clz32?o.prototype._countBits=function(t){return 32-Math.clz32(t)}:o.prototype._countBits=function(t){var i=t,s=0;return i>=4096&&(s+=13,i>>>=13),i>=64&&(s+=7,i>>>=7),i>=8&&(s+=4,i>>>=4),i>=2&&(s+=2,i>>>=2),s+i},o.prototype._zeroBits=function(t){if(t===0)return 26;var i=t,s=0;return i&8191||(s+=13,i>>>=13),i&127||(s+=7,i>>>=7),i&15||(s+=4,i>>>=4),i&3||(s+=2,i>>>=2),i&1||s++,s},o.prototype.bitLength=function(){var t=this.words[this.length-1],i=this._countBits(t);return(this.length-1)*26+i};function $(e){for(var t=new Array(e.bitLength()),i=0;i<t.length;i++){var s=i/26|0,l=i%26;t[i]=(e.words[s]&1<<l)>>>l}return t}o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var t=0,i=0;i<this.length;i++){var s=this._zeroBits(this.words[i]);if(t+=s,s!==26)break}return t},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(t){return this.negative!==0?this.abs().inotn(t).iaddn(1):this.clone()},o.prototype.fromTwos=function(t){return this.testn(t-1)?this.notn(t).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return this.negative!==0},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(t){for(;this.length<t.length;)this.words[this.length++]=0;for(var i=0;i<t.length;i++)this.words[i]=this.words[i]|t.words[i];return this.strip()},o.prototype.ior=function(t){return u((this.negative|t.negative)===0),this.iuor(t)},o.prototype.or=function(t){return this.length>t.length?this.clone().ior(t):t.clone().ior(this)},o.prototype.uor=function(t){return this.length>t.length?this.clone().iuor(t):t.clone().iuor(this)},o.prototype.iuand=function(t){var i;this.length>t.length?i=t:i=this;for(var s=0;s<i.length;s++)this.words[s]=this.words[s]&t.words[s];return this.length=i.length,this.strip()},o.prototype.iand=function(t){return u((this.negative|t.negative)===0),this.iuand(t)},o.prototype.and=function(t){return this.length>t.length?this.clone().iand(t):t.clone().iand(this)},o.prototype.uand=function(t){return this.length>t.length?this.clone().iuand(t):t.clone().iuand(this)},o.prototype.iuxor=function(t){var i,s;this.length>t.length?(i=this,s=t):(i=t,s=this);for(var l=0;l<s.length;l++)this.words[l]=i.words[l]^s.words[l];if(this!==i)for(;l<i.length;l++)this.words[l]=i.words[l];return this.length=i.length,this.strip()},o.prototype.ixor=function(t){return u((this.negative|t.negative)===0),this.iuxor(t)},o.prototype.xor=function(t){return this.length>t.length?this.clone().ixor(t):t.clone().ixor(this)},o.prototype.uxor=function(t){return this.length>t.length?this.clone().iuxor(t):t.clone().iuxor(this)},o.prototype.inotn=function(t){u(typeof t=="number"&&t>=0);var i=Math.ceil(t/26)|0,s=t%26;this._expand(i),s>0&&i--;for(var l=0;l<i;l++)this.words[l]=~this.words[l]&67108863;return s>0&&(this.words[l]=~this.words[l]&67108863>>26-s),this.strip()},o.prototype.notn=function(t){return this.clone().inotn(t)},o.prototype.setn=function(t,i){u(typeof t=="number"&&t>=0);var s=t/26|0,l=t%26;return this._expand(s+1),i?this.words[s]=this.words[s]|1<<l:this.words[s]=this.words[s]&~(1<<l),this.strip()},o.prototype.iadd=function(t){var i;if(this.negative!==0&&t.negative===0)return this.negative=0,i=this.isub(t),this.negative^=1,this._normSign();if(this.negative===0&&t.negative!==0)return t.negative=0,i=this.isub(t),t.negative=1,i._normSign();var s,l;this.length>t.length?(s=this,l=t):(s=t,l=this);for(var c=0,p=0;p<l.length;p++)i=(s.words[p]|0)+(l.words[p]|0)+c,this.words[p]=i&67108863,c=i>>>26;for(;c!==0&&p<s.length;p++)i=(s.words[p]|0)+c,this.words[p]=i&67108863,c=i>>>26;if(this.length=s.length,c!==0)this.words[this.length]=c,this.length++;else if(s!==this)for(;p<s.length;p++)this.words[p]=s.words[p];return this},o.prototype.add=function(t){var i;return t.negative!==0&&this.negative===0?(t.negative=0,i=this.sub(t),t.negative^=1,i):t.negative===0&&this.negative!==0?(this.negative=0,i=t.sub(this),this.negative=1,i):this.length>t.length?this.clone().iadd(t):t.clone().iadd(this)},o.prototype.isub=function(t){if(t.negative!==0){t.negative=0;var i=this.iadd(t);return t.negative=1,i._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(t),this.negative=1,this._normSign();var s=this.cmp(t);if(s===0)return this.negative=0,this.length=1,this.words[0]=0,this;var l,c;s>0?(l=this,c=t):(l=t,c=this);for(var p=0,d=0;d<c.length;d++)i=(l.words[d]|0)-(c.words[d]|0)+p,p=i>>26,this.words[d]=i&67108863;for(;p!==0&&d<l.length;d++)i=(l.words[d]|0)+p,p=i>>26,this.words[d]=i&67108863;if(p===0&&d<l.length&&l!==this)for(;d<l.length;d++)this.words[d]=l.words[d];return this.length=Math.max(this.length,d),l!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(t){return this.clone().isub(t)};function M(e,t,i){i.negative=t.negative^e.negative;var s=e.length+t.length|0;i.length=s,s=s-1|0;var l=e.words[0]|0,c=t.words[0]|0,p=l*c,d=p&67108863,r=p/67108864|0;i.words[0]=d;for(var f=1;f<s;f++){for(var m=r>>>26,_=r&67108863,R=Math.min(f,t.length-1),C=Math.max(0,f-e.length+1);C<=R;C++){var F=f-C|0;l=e.words[F]|0,c=t.words[C]|0,p=l*c+_,m+=p/67108864|0,_=p&67108863}i.words[f]=_|0,r=m|0}return r!==0?i.words[f]=r|0:i.length--,i.strip()}var N=function(t,i,s){var l=t.words,c=i.words,p=s.words,d=0,r,f,m,_=l[0]|0,R=_&8191,C=_>>>13,F=l[1]|0,z=F&8191,lt=F>>>13,G=l[2]|0,Z=G&8191,mt=G>>>13,gt=l[3]|0,j=gt&8191,Ct=gt>>>13,wt=l[4]|0,Y=wt&8191,U=wt>>>13,I=l[5]|0,E=I&8191,P=I>>>13,H=l[6]|0,D=H&8191,ut=H>>>13,vt=l[7]|0,V=vt&8191,bt=vt>>>13,yt=l[8]|0,J=yt&8191,Lt=yt>>>13,Mt=l[9]|0,Q=Mt&8191,Ot=Mt>>>13,xt=c[0]|0,tt=xt&8191,Nt=xt>>>13,_t=c[1]|0,et=_t&8191,qt=_t>>>13,St=c[2]|0,rt=St&8191,Ut=St>>>13,At=c[3]|0,it=At&8191,Ft=At>>>13,Et=c[4]|0,nt=Et&8191,$t=Et>>>13,kt=c[5]|0,at=kt&8191,zt=kt>>>13,Rt=c[6]|0,ft=Rt&8191,Dt=Rt>>>13,Bt=c[7]|0,ot=Bt&8191,Ht=Bt>>>13,It=c[8]|0,st=It&8191,Kt=It>>>13,Tt=c[9]|0,ht=Tt&8191,Pt=Tt>>>13;s.negative=t.negative^i.negative,s.length=19,r=Math.imul(R,tt),f=Math.imul(R,Nt),f=f+Math.imul(C,tt)|0,m=Math.imul(C,Nt);var Jt=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,r=Math.imul(z,tt),f=Math.imul(z,Nt),f=f+Math.imul(lt,tt)|0,m=Math.imul(lt,Nt),r=r+Math.imul(R,et)|0,f=f+Math.imul(R,qt)|0,f=f+Math.imul(C,et)|0,m=m+Math.imul(C,qt)|0;var jt=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(jt>>>26)|0,jt&=67108863,r=Math.imul(Z,tt),f=Math.imul(Z,Nt),f=f+Math.imul(mt,tt)|0,m=Math.imul(mt,Nt),r=r+Math.imul(z,et)|0,f=f+Math.imul(z,qt)|0,f=f+Math.imul(lt,et)|0,m=m+Math.imul(lt,qt)|0,r=r+Math.imul(R,rt)|0,f=f+Math.imul(R,Ut)|0,f=f+Math.imul(C,rt)|0,m=m+Math.imul(C,Ut)|0;var Yt=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,r=Math.imul(j,tt),f=Math.imul(j,Nt),f=f+Math.imul(Ct,tt)|0,m=Math.imul(Ct,Nt),r=r+Math.imul(Z,et)|0,f=f+Math.imul(Z,qt)|0,f=f+Math.imul(mt,et)|0,m=m+Math.imul(mt,qt)|0,r=r+Math.imul(z,rt)|0,f=f+Math.imul(z,Ut)|0,f=f+Math.imul(lt,rt)|0,m=m+Math.imul(lt,Ut)|0,r=r+Math.imul(R,it)|0,f=f+Math.imul(R,Ft)|0,f=f+Math.imul(C,it)|0,m=m+Math.imul(C,Ft)|0;var Xt=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(Xt>>>26)|0,Xt&=67108863,r=Math.imul(Y,tt),f=Math.imul(Y,Nt),f=f+Math.imul(U,tt)|0,m=Math.imul(U,Nt),r=r+Math.imul(j,et)|0,f=f+Math.imul(j,qt)|0,f=f+Math.imul(Ct,et)|0,m=m+Math.imul(Ct,qt)|0,r=r+Math.imul(Z,rt)|0,f=f+Math.imul(Z,Ut)|0,f=f+Math.imul(mt,rt)|0,m=m+Math.imul(mt,Ut)|0,r=r+Math.imul(z,it)|0,f=f+Math.imul(z,Ft)|0,f=f+Math.imul(lt,it)|0,m=m+Math.imul(lt,Ft)|0,r=r+Math.imul(R,nt)|0,f=f+Math.imul(R,$t)|0,f=f+Math.imul(C,nt)|0,m=m+Math.imul(C,$t)|0;var Qt=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(Qt>>>26)|0,Qt&=67108863,r=Math.imul(E,tt),f=Math.imul(E,Nt),f=f+Math.imul(P,tt)|0,m=Math.imul(P,Nt),r=r+Math.imul(Y,et)|0,f=f+Math.imul(Y,qt)|0,f=f+Math.imul(U,et)|0,m=m+Math.imul(U,qt)|0,r=r+Math.imul(j,rt)|0,f=f+Math.imul(j,Ut)|0,f=f+Math.imul(Ct,rt)|0,m=m+Math.imul(Ct,Ut)|0,r=r+Math.imul(Z,it)|0,f=f+Math.imul(Z,Ft)|0,f=f+Math.imul(mt,it)|0,m=m+Math.imul(mt,Ft)|0,r=r+Math.imul(z,nt)|0,f=f+Math.imul(z,$t)|0,f=f+Math.imul(lt,nt)|0,m=m+Math.imul(lt,$t)|0,r=r+Math.imul(R,at)|0,f=f+Math.imul(R,zt)|0,f=f+Math.imul(C,at)|0,m=m+Math.imul(C,zt)|0;var te=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(te>>>26)|0,te&=67108863,r=Math.imul(D,tt),f=Math.imul(D,Nt),f=f+Math.imul(ut,tt)|0,m=Math.imul(ut,Nt),r=r+Math.imul(E,et)|0,f=f+Math.imul(E,qt)|0,f=f+Math.imul(P,et)|0,m=m+Math.imul(P,qt)|0,r=r+Math.imul(Y,rt)|0,f=f+Math.imul(Y,Ut)|0,f=f+Math.imul(U,rt)|0,m=m+Math.imul(U,Ut)|0,r=r+Math.imul(j,it)|0,f=f+Math.imul(j,Ft)|0,f=f+Math.imul(Ct,it)|0,m=m+Math.imul(Ct,Ft)|0,r=r+Math.imul(Z,nt)|0,f=f+Math.imul(Z,$t)|0,f=f+Math.imul(mt,nt)|0,m=m+Math.imul(mt,$t)|0,r=r+Math.imul(z,at)|0,f=f+Math.imul(z,zt)|0,f=f+Math.imul(lt,at)|0,m=m+Math.imul(lt,zt)|0,r=r+Math.imul(R,ft)|0,f=f+Math.imul(R,Dt)|0,f=f+Math.imul(C,ft)|0,m=m+Math.imul(C,Dt)|0;var ee=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(ee>>>26)|0,ee&=67108863,r=Math.imul(V,tt),f=Math.imul(V,Nt),f=f+Math.imul(bt,tt)|0,m=Math.imul(bt,Nt),r=r+Math.imul(D,et)|0,f=f+Math.imul(D,qt)|0,f=f+Math.imul(ut,et)|0,m=m+Math.imul(ut,qt)|0,r=r+Math.imul(E,rt)|0,f=f+Math.imul(E,Ut)|0,f=f+Math.imul(P,rt)|0,m=m+Math.imul(P,Ut)|0,r=r+Math.imul(Y,it)|0,f=f+Math.imul(Y,Ft)|0,f=f+Math.imul(U,it)|0,m=m+Math.imul(U,Ft)|0,r=r+Math.imul(j,nt)|0,f=f+Math.imul(j,$t)|0,f=f+Math.imul(Ct,nt)|0,m=m+Math.imul(Ct,$t)|0,r=r+Math.imul(Z,at)|0,f=f+Math.imul(Z,zt)|0,f=f+Math.imul(mt,at)|0,m=m+Math.imul(mt,zt)|0,r=r+Math.imul(z,ft)|0,f=f+Math.imul(z,Dt)|0,f=f+Math.imul(lt,ft)|0,m=m+Math.imul(lt,Dt)|0,r=r+Math.imul(R,ot)|0,f=f+Math.imul(R,Ht)|0,f=f+Math.imul(C,ot)|0,m=m+Math.imul(C,Ht)|0;var re=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(re>>>26)|0,re&=67108863,r=Math.imul(J,tt),f=Math.imul(J,Nt),f=f+Math.imul(Lt,tt)|0,m=Math.imul(Lt,Nt),r=r+Math.imul(V,et)|0,f=f+Math.imul(V,qt)|0,f=f+Math.imul(bt,et)|0,m=m+Math.imul(bt,qt)|0,r=r+Math.imul(D,rt)|0,f=f+Math.imul(D,Ut)|0,f=f+Math.imul(ut,rt)|0,m=m+Math.imul(ut,Ut)|0,r=r+Math.imul(E,it)|0,f=f+Math.imul(E,Ft)|0,f=f+Math.imul(P,it)|0,m=m+Math.imul(P,Ft)|0,r=r+Math.imul(Y,nt)|0,f=f+Math.imul(Y,$t)|0,f=f+Math.imul(U,nt)|0,m=m+Math.imul(U,$t)|0,r=r+Math.imul(j,at)|0,f=f+Math.imul(j,zt)|0,f=f+Math.imul(Ct,at)|0,m=m+Math.imul(Ct,zt)|0,r=r+Math.imul(Z,ft)|0,f=f+Math.imul(Z,Dt)|0,f=f+Math.imul(mt,ft)|0,m=m+Math.imul(mt,Dt)|0,r=r+Math.imul(z,ot)|0,f=f+Math.imul(z,Ht)|0,f=f+Math.imul(lt,ot)|0,m=m+Math.imul(lt,Ht)|0,r=r+Math.imul(R,st)|0,f=f+Math.imul(R,Kt)|0,f=f+Math.imul(C,st)|0,m=m+Math.imul(C,Kt)|0;var ie=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(ie>>>26)|0,ie&=67108863,r=Math.imul(Q,tt),f=Math.imul(Q,Nt),f=f+Math.imul(Ot,tt)|0,m=Math.imul(Ot,Nt),r=r+Math.imul(J,et)|0,f=f+Math.imul(J,qt)|0,f=f+Math.imul(Lt,et)|0,m=m+Math.imul(Lt,qt)|0,r=r+Math.imul(V,rt)|0,f=f+Math.imul(V,Ut)|0,f=f+Math.imul(bt,rt)|0,m=m+Math.imul(bt,Ut)|0,r=r+Math.imul(D,it)|0,f=f+Math.imul(D,Ft)|0,f=f+Math.imul(ut,it)|0,m=m+Math.imul(ut,Ft)|0,r=r+Math.imul(E,nt)|0,f=f+Math.imul(E,$t)|0,f=f+Math.imul(P,nt)|0,m=m+Math.imul(P,$t)|0,r=r+Math.imul(Y,at)|0,f=f+Math.imul(Y,zt)|0,f=f+Math.imul(U,at)|0,m=m+Math.imul(U,zt)|0,r=r+Math.imul(j,ft)|0,f=f+Math.imul(j,Dt)|0,f=f+Math.imul(Ct,ft)|0,m=m+Math.imul(Ct,Dt)|0,r=r+Math.imul(Z,ot)|0,f=f+Math.imul(Z,Ht)|0,f=f+Math.imul(mt,ot)|0,m=m+Math.imul(mt,Ht)|0,r=r+Math.imul(z,st)|0,f=f+Math.imul(z,Kt)|0,f=f+Math.imul(lt,st)|0,m=m+Math.imul(lt,Kt)|0,r=r+Math.imul(R,ht)|0,f=f+Math.imul(R,Pt)|0,f=f+Math.imul(C,ht)|0,m=m+Math.imul(C,Pt)|0;var ne=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(ne>>>26)|0,ne&=67108863,r=Math.imul(Q,et),f=Math.imul(Q,qt),f=f+Math.imul(Ot,et)|0,m=Math.imul(Ot,qt),r=r+Math.imul(J,rt)|0,f=f+Math.imul(J,Ut)|0,f=f+Math.imul(Lt,rt)|0,m=m+Math.imul(Lt,Ut)|0,r=r+Math.imul(V,it)|0,f=f+Math.imul(V,Ft)|0,f=f+Math.imul(bt,it)|0,m=m+Math.imul(bt,Ft)|0,r=r+Math.imul(D,nt)|0,f=f+Math.imul(D,$t)|0,f=f+Math.imul(ut,nt)|0,m=m+Math.imul(ut,$t)|0,r=r+Math.imul(E,at)|0,f=f+Math.imul(E,zt)|0,f=f+Math.imul(P,at)|0,m=m+Math.imul(P,zt)|0,r=r+Math.imul(Y,ft)|0,f=f+Math.imul(Y,Dt)|0,f=f+Math.imul(U,ft)|0,m=m+Math.imul(U,Dt)|0,r=r+Math.imul(j,ot)|0,f=f+Math.imul(j,Ht)|0,f=f+Math.imul(Ct,ot)|0,m=m+Math.imul(Ct,Ht)|0,r=r+Math.imul(Z,st)|0,f=f+Math.imul(Z,Kt)|0,f=f+Math.imul(mt,st)|0,m=m+Math.imul(mt,Kt)|0,r=r+Math.imul(z,ht)|0,f=f+Math.imul(z,Pt)|0,f=f+Math.imul(lt,ht)|0,m=m+Math.imul(lt,Pt)|0;var ae=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(ae>>>26)|0,ae&=67108863,r=Math.imul(Q,rt),f=Math.imul(Q,Ut),f=f+Math.imul(Ot,rt)|0,m=Math.imul(Ot,Ut),r=r+Math.imul(J,it)|0,f=f+Math.imul(J,Ft)|0,f=f+Math.imul(Lt,it)|0,m=m+Math.imul(Lt,Ft)|0,r=r+Math.imul(V,nt)|0,f=f+Math.imul(V,$t)|0,f=f+Math.imul(bt,nt)|0,m=m+Math.imul(bt,$t)|0,r=r+Math.imul(D,at)|0,f=f+Math.imul(D,zt)|0,f=f+Math.imul(ut,at)|0,m=m+Math.imul(ut,zt)|0,r=r+Math.imul(E,ft)|0,f=f+Math.imul(E,Dt)|0,f=f+Math.imul(P,ft)|0,m=m+Math.imul(P,Dt)|0,r=r+Math.imul(Y,ot)|0,f=f+Math.imul(Y,Ht)|0,f=f+Math.imul(U,ot)|0,m=m+Math.imul(U,Ht)|0,r=r+Math.imul(j,st)|0,f=f+Math.imul(j,Kt)|0,f=f+Math.imul(Ct,st)|0,m=m+Math.imul(Ct,Kt)|0,r=r+Math.imul(Z,ht)|0,f=f+Math.imul(Z,Pt)|0,f=f+Math.imul(mt,ht)|0,m=m+Math.imul(mt,Pt)|0;var fe=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(fe>>>26)|0,fe&=67108863,r=Math.imul(Q,it),f=Math.imul(Q,Ft),f=f+Math.imul(Ot,it)|0,m=Math.imul(Ot,Ft),r=r+Math.imul(J,nt)|0,f=f+Math.imul(J,$t)|0,f=f+Math.imul(Lt,nt)|0,m=m+Math.imul(Lt,$t)|0,r=r+Math.imul(V,at)|0,f=f+Math.imul(V,zt)|0,f=f+Math.imul(bt,at)|0,m=m+Math.imul(bt,zt)|0,r=r+Math.imul(D,ft)|0,f=f+Math.imul(D,Dt)|0,f=f+Math.imul(ut,ft)|0,m=m+Math.imul(ut,Dt)|0,r=r+Math.imul(E,ot)|0,f=f+Math.imul(E,Ht)|0,f=f+Math.imul(P,ot)|0,m=m+Math.imul(P,Ht)|0,r=r+Math.imul(Y,st)|0,f=f+Math.imul(Y,Kt)|0,f=f+Math.imul(U,st)|0,m=m+Math.imul(U,Kt)|0,r=r+Math.imul(j,ht)|0,f=f+Math.imul(j,Pt)|0,f=f+Math.imul(Ct,ht)|0,m=m+Math.imul(Ct,Pt)|0;var oe=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(oe>>>26)|0,oe&=67108863,r=Math.imul(Q,nt),f=Math.imul(Q,$t),f=f+Math.imul(Ot,nt)|0,m=Math.imul(Ot,$t),r=r+Math.imul(J,at)|0,f=f+Math.imul(J,zt)|0,f=f+Math.imul(Lt,at)|0,m=m+Math.imul(Lt,zt)|0,r=r+Math.imul(V,ft)|0,f=f+Math.imul(V,Dt)|0,f=f+Math.imul(bt,ft)|0,m=m+Math.imul(bt,Dt)|0,r=r+Math.imul(D,ot)|0,f=f+Math.imul(D,Ht)|0,f=f+Math.imul(ut,ot)|0,m=m+Math.imul(ut,Ht)|0,r=r+Math.imul(E,st)|0,f=f+Math.imul(E,Kt)|0,f=f+Math.imul(P,st)|0,m=m+Math.imul(P,Kt)|0,r=r+Math.imul(Y,ht)|0,f=f+Math.imul(Y,Pt)|0,f=f+Math.imul(U,ht)|0,m=m+Math.imul(U,Pt)|0;var se=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(se>>>26)|0,se&=67108863,r=Math.imul(Q,at),f=Math.imul(Q,zt),f=f+Math.imul(Ot,at)|0,m=Math.imul(Ot,zt),r=r+Math.imul(J,ft)|0,f=f+Math.imul(J,Dt)|0,f=f+Math.imul(Lt,ft)|0,m=m+Math.imul(Lt,Dt)|0,r=r+Math.imul(V,ot)|0,f=f+Math.imul(V,Ht)|0,f=f+Math.imul(bt,ot)|0,m=m+Math.imul(bt,Ht)|0,r=r+Math.imul(D,st)|0,f=f+Math.imul(D,Kt)|0,f=f+Math.imul(ut,st)|0,m=m+Math.imul(ut,Kt)|0,r=r+Math.imul(E,ht)|0,f=f+Math.imul(E,Pt)|0,f=f+Math.imul(P,ht)|0,m=m+Math.imul(P,Pt)|0;var he=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(he>>>26)|0,he&=67108863,r=Math.imul(Q,ft),f=Math.imul(Q,Dt),f=f+Math.imul(Ot,ft)|0,m=Math.imul(Ot,Dt),r=r+Math.imul(J,ot)|0,f=f+Math.imul(J,Ht)|0,f=f+Math.imul(Lt,ot)|0,m=m+Math.imul(Lt,Ht)|0,r=r+Math.imul(V,st)|0,f=f+Math.imul(V,Kt)|0,f=f+Math.imul(bt,st)|0,m=m+Math.imul(bt,Kt)|0,r=r+Math.imul(D,ht)|0,f=f+Math.imul(D,Pt)|0,f=f+Math.imul(ut,ht)|0,m=m+Math.imul(ut,Pt)|0;var ue=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(ue>>>26)|0,ue&=67108863,r=Math.imul(Q,ot),f=Math.imul(Q,Ht),f=f+Math.imul(Ot,ot)|0,m=Math.imul(Ot,Ht),r=r+Math.imul(J,st)|0,f=f+Math.imul(J,Kt)|0,f=f+Math.imul(Lt,st)|0,m=m+Math.imul(Lt,Kt)|0,r=r+Math.imul(V,ht)|0,f=f+Math.imul(V,Pt)|0,f=f+Math.imul(bt,ht)|0,m=m+Math.imul(bt,Pt)|0;var le=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(le>>>26)|0,le&=67108863,r=Math.imul(Q,st),f=Math.imul(Q,Kt),f=f+Math.imul(Ot,st)|0,m=Math.imul(Ot,Kt),r=r+Math.imul(J,ht)|0,f=f+Math.imul(J,Pt)|0,f=f+Math.imul(Lt,ht)|0,m=m+Math.imul(Lt,Pt)|0;var ce=(d+r|0)+((f&8191)<<13)|0;d=(m+(f>>>13)|0)+(ce>>>26)|0,ce&=67108863,r=Math.imul(Q,ht),f=Math.imul(Q,Pt),f=f+Math.imul(Ot,ht)|0,m=Math.imul(Ot,Pt);var Ue=(d+r|0)+((f&8191)<<13)|0;return d=(m+(f>>>13)|0)+(Ue>>>26)|0,Ue&=67108863,p[0]=Jt,p[1]=jt,p[2]=Yt,p[3]=Xt,p[4]=Qt,p[5]=te,p[6]=ee,p[7]=re,p[8]=ie,p[9]=ne,p[10]=ae,p[11]=fe,p[12]=oe,p[13]=se,p[14]=he,p[15]=ue,p[16]=le,p[17]=ce,p[18]=Ue,d!==0&&(p[19]=d,s.length++),s};Math.imul||(N=M);function x(e,t,i){i.negative=t.negative^e.negative,i.length=e.length+t.length;for(var s=0,l=0,c=0;c<i.length-1;c++){var p=l;l=0;for(var d=s&67108863,r=Math.min(c,t.length-1),f=Math.max(0,c-e.length+1);f<=r;f++){var m=c-f,_=e.words[m]|0,R=t.words[f]|0,C=_*R,F=C&67108863;p=p+(C/67108864|0)|0,F=F+d|0,d=F&67108863,p=p+(F>>>26)|0,l+=p>>>26,p&=67108863}i.words[c]=d,s=p,p=l}return s!==0?i.words[c]=s:i.length--,i.strip()}function A(e,t,i){var s=new S;return s.mulp(e,t,i)}o.prototype.mulTo=function(t,i){var s,l=this.length+t.length;return this.length===10&&t.length===10?s=N(this,t,i):l<63?s=M(this,t,i):l<1024?s=x(this,t,i):s=A(this,t,i),s};function S(e,t){this.x=e,this.y=t}S.prototype.makeRBT=function(t){for(var i=new Array(t),s=o.prototype._countBits(t)-1,l=0;l<t;l++)i[l]=this.revBin(l,s,t);return i},S.prototype.revBin=function(t,i,s){if(t===0||t===s-1)return t;for(var l=0,c=0;c<i;c++)l|=(t&1)<<i-c-1,t>>=1;return l},S.prototype.permute=function(t,i,s,l,c,p){for(var d=0;d<p;d++)l[d]=i[t[d]],c[d]=s[t[d]]},S.prototype.transform=function(t,i,s,l,c,p){this.permute(p,t,i,s,l,c);for(var d=1;d<c;d<<=1)for(var r=d<<1,f=Math.cos(2*Math.PI/r),m=Math.sin(2*Math.PI/r),_=0;_<c;_+=r)for(var R=f,C=m,F=0;F<d;F++){var z=s[_+F],lt=l[_+F],G=s[_+F+d],Z=l[_+F+d],mt=R*G-C*Z;Z=R*Z+C*G,G=mt,s[_+F]=z+G,l[_+F]=lt+Z,s[_+F+d]=z-G,l[_+F+d]=lt-Z,F!==r&&(mt=f*R-m*C,C=f*C+m*R,R=mt)}},S.prototype.guessLen13b=function(t,i){var s=Math.max(i,t)|1,l=s&1,c=0;for(s=s/2|0;s;s=s>>>1)c++;return 1<<c+1+l},S.prototype.conjugate=function(t,i,s){if(!(s<=1))for(var l=0;l<s/2;l++){var c=t[l];t[l]=t[s-l-1],t[s-l-1]=c,c=i[l],i[l]=-i[s-l-1],i[s-l-1]=-c}},S.prototype.normalize13b=function(t,i){for(var s=0,l=0;l<i/2;l++){var c=Math.round(t[2*l+1]/i)*8192+Math.round(t[2*l]/i)+s;t[l]=c&67108863,c<67108864?s=0:s=c/67108864|0}return t},S.prototype.convert13b=function(t,i,s,l){for(var c=0,p=0;p<i;p++)c=c+(t[p]|0),s[2*p]=c&8191,c=c>>>13,s[2*p+1]=c&8191,c=c>>>13;for(p=2*i;p<l;++p)s[p]=0;u(c===0),u((c&-8192)===0)},S.prototype.stub=function(t){for(var i=new Array(t),s=0;s<t;s++)i[s]=0;return i},S.prototype.mulp=function(t,i,s){var l=2*this.guessLen13b(t.length,i.length),c=this.makeRBT(l),p=this.stub(l),d=new Array(l),r=new Array(l),f=new Array(l),m=new Array(l),_=new Array(l),R=new Array(l),C=s.words;C.length=l,this.convert13b(t.words,t.length,d,l),this.convert13b(i.words,i.length,m,l),this.transform(d,p,r,f,l,c),this.transform(m,p,_,R,l,c);for(var F=0;F<l;F++){var z=r[F]*_[F]-f[F]*R[F];f[F]=r[F]*R[F]+f[F]*_[F],r[F]=z}return this.conjugate(r,f,l),this.transform(r,f,C,p,l,c),this.conjugate(C,p,l),this.normalize13b(C,l),s.negative=t.negative^i.negative,s.length=t.length+i.length,s.strip()},o.prototype.mul=function(t){var i=new o(null);return i.words=new Array(this.length+t.length),this.mulTo(t,i)},o.prototype.mulf=function(t){var i=new o(null);return i.words=new Array(this.length+t.length),A(this,t,i)},o.prototype.imul=function(t){return this.clone().mulTo(t,this)},o.prototype.imuln=function(t){u(typeof t=="number"),u(t<67108864);for(var i=0,s=0;s<this.length;s++){var l=(this.words[s]|0)*t,c=(l&67108863)+(i&67108863);i>>=26,i+=l/67108864|0,i+=c>>>26,this.words[s]=c&67108863}return i!==0&&(this.words[s]=i,this.length++),this},o.prototype.muln=function(t){return this.clone().imuln(t)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(t){var i=$(t);if(i.length===0)return new o(1);for(var s=this,l=0;l<i.length&&i[l]===0;l++,s=s.sqr());if(++l<i.length)for(var c=s.sqr();l<i.length;l++,c=c.sqr())i[l]!==0&&(s=s.mul(c));return s},o.prototype.iushln=function(t){u(typeof t=="number"&&t>=0);var i=t%26,s=(t-i)/26,l=67108863>>>26-i<<26-i,c;if(i!==0){var p=0;for(c=0;c<this.length;c++){var d=this.words[c]&l,r=(this.words[c]|0)-d<<i;this.words[c]=r|p,p=d>>>26-i}p&&(this.words[c]=p,this.length++)}if(s!==0){for(c=this.length-1;c>=0;c--)this.words[c+s]=this.words[c];for(c=0;c<s;c++)this.words[c]=0;this.length+=s}return this.strip()},o.prototype.ishln=function(t){return u(this.negative===0),this.iushln(t)},o.prototype.iushrn=function(t,i,s){u(typeof t=="number"&&t>=0);var l;i?l=(i-i%26)/26:l=0;var c=t%26,p=Math.min((t-c)/26,this.length),d=67108863^67108863>>>c<<c,r=s;if(l-=p,l=Math.max(0,l),r){for(var f=0;f<p;f++)r.words[f]=this.words[f];r.length=p}if(p!==0)if(this.length>p)for(this.length-=p,f=0;f<this.length;f++)this.words[f]=this.words[f+p];else this.words[0]=0,this.length=1;var m=0;for(f=this.length-1;f>=0&&(m!==0||f>=l);f--){var _=this.words[f]|0;this.words[f]=m<<26-c|_>>>c,m=_&d}return r&&m!==0&&(r.words[r.length++]=m),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(t,i,s){return u(this.negative===0),this.iushrn(t,i,s)},o.prototype.shln=function(t){return this.clone().ishln(t)},o.prototype.ushln=function(t){return this.clone().iushln(t)},o.prototype.shrn=function(t){return this.clone().ishrn(t)},o.prototype.ushrn=function(t){return this.clone().iushrn(t)},o.prototype.testn=function(t){u(typeof t=="number"&&t>=0);var i=t%26,s=(t-i)/26,l=1<<i;if(this.length<=s)return!1;var c=this.words[s];return!!(c&l)},o.prototype.imaskn=function(t){u(typeof t=="number"&&t>=0);var i=t%26,s=(t-i)/26;if(u(this.negative===0,"imaskn works only with positive numbers"),this.length<=s)return this;if(i!==0&&s++,this.length=Math.min(s,this.length),i!==0){var l=67108863^67108863>>>i<<i;this.words[this.length-1]&=l}return this.strip()},o.prototype.maskn=function(t){return this.clone().imaskn(t)},o.prototype.iaddn=function(t){return u(typeof t=="number"),u(t<67108864),t<0?this.isubn(-t):this.negative!==0?this.length===1&&(this.words[0]|0)<t?(this.words[0]=t-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(t),this.negative=1,this):this._iaddn(t)},o.prototype._iaddn=function(t){this.words[0]+=t;for(var i=0;i<this.length&&this.words[i]>=67108864;i++)this.words[i]-=67108864,i===this.length-1?this.words[i+1]=1:this.words[i+1]++;return this.length=Math.max(this.length,i+1),this},o.prototype.isubn=function(t){if(u(typeof t=="number"),u(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 i=0;i<this.length&&this.words[i]<0;i++)this.words[i]+=67108864,this.words[i+1]-=1;return this.strip()},o.prototype.addn=function(t){return this.clone().iaddn(t)},o.prototype.subn=function(t){return this.clone().isubn(t)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(t,i,s){var l=t.length+s,c;this._expand(l);var p,d=0;for(c=0;c<t.length;c++){p=(this.words[c+s]|0)+d;var r=(t.words[c]|0)*i;p-=r&67108863,d=(p>>26)-(r/67108864|0),this.words[c+s]=p&67108863}for(;c<this.length-s;c++)p=(this.words[c+s]|0)+d,d=p>>26,this.words[c+s]=p&67108863;if(d===0)return this.strip();for(u(d===-1),d=0,c=0;c<this.length;c++)p=-(this.words[c]|0)+d,d=p>>26,this.words[c]=p&67108863;return this.negative=1,this.strip()},o.prototype._wordDiv=function(t,i){var s=this.length-t.length,l=this.clone(),c=t,p=c.words[c.length-1]|0,d=this._countBits(p);s=26-d,s!==0&&(c=c.ushln(s),l.iushln(s),p=c.words[c.length-1]|0);var r=l.length-c.length,f;if(i!=="mod"){f=new o(null),f.length=r+1,f.words=new Array(f.length);for(var m=0;m<f.length;m++)f.words[m]=0}var _=l.clone()._ishlnsubmul(c,1,r);_.negative===0&&(l=_,f&&(f.words[r]=1));for(var R=r-1;R>=0;R--){var C=(l.words[c.length+R]|0)*67108864+(l.words[c.length+R-1]|0);for(C=Math.min(C/p|0,67108863),l._ishlnsubmul(c,C,R);l.negative!==0;)C--,l.negative=0,l._ishlnsubmul(c,1,R),l.isZero()||(l.negative^=1);f&&(f.words[R]=C)}return f&&f.strip(),l.strip(),i!=="div"&&s!==0&&l.iushrn(s),{div:f||null,mod:l}},o.prototype.divmod=function(t,i,s){if(u(!t.isZero()),this.isZero())return{div:new o(0),mod:new o(0)};var l,c,p;return this.negative!==0&&t.negative===0?(p=this.neg().divmod(t,i),i!=="mod"&&(l=p.div.neg()),i!=="div"&&(c=p.mod.neg(),s&&c.negative!==0&&c.iadd(t)),{div:l,mod:c}):this.negative===0&&t.negative!==0?(p=this.divmod(t.neg(),i),i!=="mod"&&(l=p.div.neg()),{div:l,mod:p.mod}):this.negative&t.negative?(p=this.neg().divmod(t.neg(),i),i!=="div"&&(c=p.mod.neg(),s&&c.negative!==0&&c.isub(t)),{div:p.div,mod:c}):t.length>this.length||this.cmp(t)<0?{div:new o(0),mod:this}:t.length===1?i==="div"?{div:this.divn(t.words[0]),mod:null}:i==="mod"?{div:null,mod:new o(this.modn(t.words[0]))}:{div:this.divn(t.words[0]),mod:new o(this.modn(t.words[0]))}:this._wordDiv(t,i)},o.prototype.div=function(t){return this.divmod(t,"div",!1).div},o.prototype.mod=function(t){return this.divmod(t,"mod",!1).mod},o.prototype.umod=function(t){return this.divmod(t,"mod",!0).mod},o.prototype.divRound=function(t){var i=this.divmod(t);if(i.mod.isZero())return i.div;var s=i.div.negative!==0?i.mod.isub(t):i.mod,l=t.ushrn(1),c=t.andln(1),p=s.cmp(l);return p<0||c===1&&p===0?i.div:i.div.negative!==0?i.div.isubn(1):i.div.iaddn(1)},o.prototype.modn=function(t){u(t<=67108863);for(var i=(1<<26)%t,s=0,l=this.length-1;l>=0;l--)s=(i*s+(this.words[l]|0))%t;return s},o.prototype.idivn=function(t){u(t<=67108863);for(var i=0,s=this.length-1;s>=0;s--){var l=(this.words[s]|0)+i*67108864;this.words[s]=l/t|0,i=l%t}return this.strip()},o.prototype.divn=function(t){return this.clone().idivn(t)},o.prototype.egcd=function(t){u(t.negative===0),u(!t.isZero());var i=this,s=t.clone();i.negative!==0?i=i.umod(t):i=i.clone();for(var l=new o(1),c=new o(0),p=new o(0),d=new o(1),r=0;i.isEven()&&s.isEven();)i.iushrn(1),s.iushrn(1),++r;for(var f=s.clone(),m=i.clone();!i.isZero();){for(var _=0,R=1;!(i.words[0]&R)&&_<26;++_,R<<=1);if(_>0)for(i.iushrn(_);_-- >0;)(l.isOdd()||c.isOdd())&&(l.iadd(f),c.isub(m)),l.iushrn(1),c.iushrn(1);for(var C=0,F=1;!(s.words[0]&F)&&C<26;++C,F<<=1);if(C>0)for(s.iushrn(C);C-- >0;)(p.isOdd()||d.isOdd())&&(p.iadd(f),d.isub(m)),p.iushrn(1),d.iushrn(1);i.cmp(s)>=0?(i.isub(s),l.isub(p),c.isub(d)):(s.isub(i),p.isub(l),d.isub(c))}return{a:p,b:d,gcd:s.iushln(r)}},o.prototype._invmp=function(t){u(t.negative===0),u(!t.isZero());var i=this,s=t.clone();i.negative!==0?i=i.umod(t):i=i.clone();for(var l=new o(1),c=new o(0),p=s.clone();i.cmpn(1)>0&&s.cmpn(1)>0;){for(var d=0,r=1;!(i.words[0]&r)&&d<26;++d,r<<=1);if(d>0)for(i.iushrn(d);d-- >0;)l.isOdd()&&l.iadd(p),l.iushrn(1);for(var f=0,m=1;!(s.words[0]&m)&&f<26;++f,m<<=1);if(f>0)for(s.iushrn(f);f-- >0;)c.isOdd()&&c.iadd(p),c.iushrn(1);i.cmp(s)>=0?(i.isub(s),l.isub(c)):(s.isub(i),c.isub(l))}var _;return i.cmpn(1)===0?_=l:_=c,_.cmpn(0)<0&&_.iadd(t),_},o.prototype.gcd=function(t){if(this.isZero())return t.abs();if(t.isZero())return this.abs();var i=this.clone(),s=t.clone();i.negative=0,s.negative=0;for(var l=0;i.isEven()&&s.isEven();l++)i.iushrn(1),s.iushrn(1);do{for(;i.isEven();)i.iushrn(1);for(;s.isEven();)s.iushrn(1);var c=i.cmp(s);if(c<0){var p=i;i=s,s=p}else if(c===0||s.cmpn(1)===0)break;i.isub(s)}while(!0);return s.iushln(l)},o.prototype.invm=function(t){return this.egcd(t).a.umod(t)},o.prototype.isEven=function(){return(this.words[0]&1)===0},o.prototype.isOdd=function(){return(this.words[0]&1)===1},o.prototype.andln=function(t){return this.words[0]&t},o.prototype.bincn=function(t){u(typeof t=="number");var i=t%26,s=(t-i)/26,l=1<<i;if(this.length<=s)return this._expand(s+1),this.words[s]|=l,this;for(var c=l,p=s;c!==0&&p<this.length;p++){var d=this.words[p]|0;d+=c,c=d>>>26,d&=67108863,this.words[p]=d}return c!==0&&(this.words[p]=c,this.length++),this},o.prototype.isZero=function(){return this.length===1&&this.words[0]===0},o.prototype.cmpn=function(t){var i=t<0;if(this.negative!==0&&!i)return-1;if(this.negative===0&&i)return 1;this.strip();var s;if(this.length>1)s=1;else{i&&(t=-t),u(t<=67108863,"Number is too big");var l=this.words[0]|0;s=l===t?0:l<t?-1:1}return this.negative!==0?-s|0:s},o.prototype.cmp=function(t){if(this.negative!==0&&t.negative===0)return-1;if(this.negative===0&&t.negative!==0)return 1;var i=this.ucmp(t);return this.negative!==0?-i|0:i},o.prototype.ucmp=function(t){if(this.length>t.length)return 1;if(this.length<t.length)return-1;for(var i=0,s=this.length-1;s>=0;s--){var l=this.words[s]|0,c=t.words[s]|0;if(l!==c){l<c?i=-1:l>c&&(i=1);break}}return i},o.prototype.gtn=function(t){return this.cmpn(t)===1},o.prototype.gt=function(t){return this.cmp(t)===1},o.prototype.gten=function(t){return this.cmpn(t)>=0},o.prototype.gte=function(t){return this.cmp(t)>=0},o.prototype.ltn=function(t){return this.cmpn(t)===-1},o.prototype.lt=function(t){return this.cmp(t)===-1},o.prototype.lten=function(t){return this.cmpn(t)<=0},o.prototype.lte=function(t){return this.cmp(t)<=0},o.prototype.eqn=function(t){return this.cmpn(t)===0},o.prototype.eq=function(t){return this.cmp(t)===0},o.red=function(t){return new dt(t)},o.prototype.toRed=function(t){return u(!this.red,"Already a number in reduction context"),u(this.negative===0,"red works only with positives"),t.convertTo(this)._forceRed(t)},o.prototype.fromRed=function(){return u(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(t){return this.red=t,this},o.prototype.forceRed=function(t){return u(!this.red,"Already a number in reduction context"),this._forceRed(t)},o.prototype.redAdd=function(t){return u(this.red,"redAdd works only with red numbers"),this.red.add(this,t)},o.prototype.redIAdd=function(t){return u(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,t)},o.prototype.redSub=function(t){return u(this.red,"redSub works only with red numbers"),this.red.sub(this,t)},o.prototype.redISub=function(t){return u(this.red,"redISub works only with red numbers"),this.red.isub(this,t)},o.prototype.redShl=function(t){return u(this.red,"redShl works only with red numbers"),this.red.shl(this,t)},o.prototype.redMul=function(t){return u(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.mul(this,t)},o.prototype.redIMul=function(t){return u(this.red,"redMul works only with red numbers"),this.red._verify2(this,t),this.red.imul(this,t)},o.prototype.redSqr=function(){return u(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return u(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return u(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return u(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return u(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(t){return u(this.red&&!t.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,t)};var T={k256:null,p224:null,p192:null,p25519:null};function O(e,t){this.name=e,this.p=new o(t,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}O.prototype._tmp=function(){var t=new o(null);return t.words=new Array(Math.ceil(this.n/13)),t},O.prototype.ireduce=function(t){var i=t,s;do this.split(i,this.tmp),i=this.imulK(i),i=i.iadd(this.tmp),s=i.bitLength();while(s>this.n);var l=s<this.n?-1:i.ucmp(this.p);return l===0?(i.words[0]=0,i.length=1):l>0?i.isub(this.p):i.strip!==void 0?i.strip():i._strip(),i},O.prototype.split=function(t,i){t.iushrn(this.n,0,i)},O.prototype.imulK=function(t){return t.imul(this.k)};function W(){O.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}v(W,O),W.prototype.split=function(t,i){for(var s=4194303,l=Math.min(t.length,9),c=0;c<l;c++)i.words[c]=t.words[c];if(i.length=l,t.length<=9){t.words[0]=0,t.length=1;return}var p=t.words[9];for(i.words[i.length++]=p&s,c=10;c<t.length;c++){var d=t.words[c]|0;t.words[c-10]=(d&s)<<4|p>>>22,p=d}p>>>=22,t.words[c-10]=p,p===0&&t.length>10?t.length-=10:t.length-=9},W.prototype.imulK=function(t){t.words[t.length]=0,t.words[t.length+1]=0,t.length+=2;for(var i=0,s=0;s<t.length;s++){var l=t.words[s]|0;i+=l*977,t.words[s]=i&67108863,i=l*64+(i/67108864|0)}return t.words[t.length-1]===0&&(t.length--,t.words[t.length-1]===0&&t.length--),t};function K(){O.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}v(K,O);function pt(){O.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}v(pt,O);function ct(){O.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}v(ct,O),ct.prototype.imulK=function(t){for(var i=0,s=0;s<t.length;s++){var l=(t.words[s]|0)*19+i,c=l&67108863;l>>>=26,t.words[s]=c,i=l}return i!==0&&(t.words[t.length++]=i),t},o._prime=function(t){if(T[t])return T[t];var i;if(t==="k256")i=new W;else if(t==="p224")i=new K;else if(t==="p192")i=new pt;else if(t==="p25519")i=new ct;else throw new Error("Unknown prime "+t);return T[t]=i,i};function dt(e){if(typeof e=="string"){var t=o._prime(e);this.m=t.p,this.prime=t}else u(e.gtn(1),"modulus must be greater than 1"),this.m=e,this.prime=null}dt.prototype._verify1=function(t){u(t.negative===0,"red works only with positives"),u(t.red,"red works only with red numbers")},dt.prototype._verify2=function(t,i){u((t.negative|i.negative)===0,"red works only with positives"),u(t.red&&t.red===i.red,"red works only with red numbers")},dt.prototype.imod=function(t){return this.prime?this.prime.ireduce(t)._forceRed(this):t.umod(this.m)._forceRed(this)},dt.prototype.neg=function(t){return t.isZero()?t.clone():this.m.sub(t)._forceRed(this)},dt.prototype.add=function(t,i){this._verify2(t,i);var s=t.add(i);return s.cmp(this.m)>=0&&s.isub(this.m),s._forceRed(this)},dt.prototype.iadd=function(t,i){this._verify2(t,i);var s=t.iadd(i);return s.cmp(this.m)>=0&&s.isub(this.m),s},dt.prototype.sub=function(t,i){this._verify2(t,i);var s=t.sub(i);return s.cmpn(0)<0&&s.iadd(this.m),s._forceRed(this)},dt.prototype.isub=function(t,i){this._verify2(t,i);var s=t.isub(i);return s.cmpn(0)<0&&s.iadd(this.m),s},dt.prototype.shl=function(t,i){return this._verify1(t),this.imod(t.ushln(i))},dt.prototype.imul=function(t,i){return this._verify2(t,i),this.imod(t.imul(i))},dt.prototype.mul=function(t,i){return this._verify2(t,i),this.imod(t.mul(i))},dt.prototype.isqr=function(t){return this.imul(t,t.clone())},dt.prototype.sqr=function(t){return this.mul(t,t)},dt.prototype.sqrt=function(t){if(t.isZero())return t.clone();var i=this.m.andln(3);if(u(i%2===1),i===3){var s=this.m.add(new o(1)).iushrn(2);return this.pow(t,s)}for(var l=this.m.subn(1),c=0;!l.isZero()&&l.andln(1)===0;)c++,l.iushrn(1);u(!l.isZero());var p=new o(1).toRed(this),d=p.redNeg(),r=this.m.subn(1).iushrn(1),f=this.m.bitLength();for(f=new o(2*f*f).toRed(this);this.pow(f,r).cmp(d)!==0;)f.redIAdd(d);for(var m=this.pow(f,l),_=this.pow(t,l.addn(1).iushrn(1)),R=this.pow(t,l),C=c;R.cmp(p)!==0;){for(var F=R,z=0;F.cmp(p)!==0;z++)F=F.redSqr();u(z<C);var lt=this.pow(m,new o(1).iushln(C-z-1));_=_.redMul(lt),m=lt.redSqr(),R=R.redMul(m),C=z}return _},dt.prototype.invm=function(t){var i=t._invmp(this.m);return i.negative!==0?(i.negative=0,this.imod(i).redNeg()):this.imod(i)},dt.prototype.pow=function(t,i){if(i.isZero())return new o(1).toRed(this);if(i.cmpn(1)===0)return t.clone();var s=4,l=new Array(1<<s);l[0]=new o(1).toRed(this),l[1]=t;for(var c=2;c<l.length;c++)l[c]=this.mul(l[c-1],t);var p=l[0],d=0,r=0,f=i.bitLength()%26;for(f===0&&(f=26),c=i.length-1;c>=0;c--){for(var m=i.words[c],_=f-1;_>=0;_--){var R=m>>_&1;if(p!==l[0]&&(p=this.sqr(p)),R===0&&d===0){r=0;continue}d<<=1,d|=R,r++,!(r!==s&&(c!==0||_!==0))&&(p=this.mul(p,l[d]),r=0,d=0)}f=26}return p},dt.prototype.convertTo=function(t){var i=t.umod(this.m);return i===t?i.clone():i},dt.prototype.convertFrom=function(t){var i=t.clone();return i.red=null,i},o.mont=function(t){return new g(t)};function g(e){dt.call(this,e),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v(g,dt),g.prototype.convertTo=function(t){return this.imod(t.ushln(this.shift))},g.prototype.convertFrom=function(t){var i=this.imod(t.mul(this.rinv));return i.red=null,i},g.prototype.imul=function(t,i){if(t.isZero()||i.isZero())return t.words[0]=0,t.length=1,t;var s=t.imul(i),l=s.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),c=s.isub(l).iushrn(this.shift),p=c;return c.cmp(this.m)>=0?p=c.isub(this.m):c.cmpn(0)<0&&(p=c.iadd(this.m)),p._forceRed(this)},g.prototype.mul=function(t,i){if(t.isZero()||i.isZero())return new o(0)._forceRed(this);var s=t.mul(i),l=s.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),c=s.isub(l).iushrn(this.shift),p=c;return c.cmp(this.m)>=0?p=c.isub(this.m):c.cmpn(0)<0&&(p=c.iadd(this.m)),p._forceRed(this)},g.prototype.invm=function(t){var i=this.imod(t._invmp(this.m).mul(this.r2));return i._forceRed(this)}})(a,Vt)})(Bo);var Kr=Bo.exports;Object.defineProperty(bi,"__esModule",{value:!0});var Nr=Kr,x1=Gi.ec,Io=new x1("secp256k1"),fi=Io.curve;bi.privateKeyExport=function(a,n){n===void 0&&(n=!0);var h=new Nr(a);if(h.ucmp(fi.n)>=0)throw new Error("couldn't export to DER format");var u=Io.g.mul(h);return zh(u.getX(),u.getY(),n)};bi.privateKeyModInverse=function(a){var n=new Nr(a);if(n.ucmp(fi.n)>=0||n.isZero())throw new Error("private key range is invalid");return n.invm(fi.n).toArrayLike(X,"be",32)};bi.signatureImport=function(a){var n=new Nr(a.r);n.ucmp(fi.n)>=0&&(n=new Nr(0));var h=new Nr(a.s);return h.ucmp(fi.n)>=0&&(h=new Nr(0)),X.concat([n.toArrayLike(X,"be",32),h.toArrayLike(X,"be",32)])};bi.ecdhUnsafe=function(a,n,h){h===void 0&&(h=!0);var u=Io.keyFromPublic(a),v=new Nr(n);if(v.ucmp(fi.n)>=0||v.isZero())throw new Error("scalar was invalid (zero or overflow)");var o=u.pub.mul(v);return zh(o.getX(),o.getY(),h)};var zh=function(a,n,h){var u;return h?(u=X.alloc(33),u[0]=n.isOdd()?3:2,a.toArrayLike(X,"be",32).copy(u,1)):(u=X.alloc(65),u[0]=4,a.toArrayLike(X,"be",32).copy(u,1),n.toArrayLike(X,"be",32).copy(u,33)),u},en={};Object.defineProperty(en,"__esModule",{value:!0});var _1=X.from([48,129,211,2,1,1,4,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,129,133,48,129,130,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,33,2,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,36,3,34,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]),S1=X.from([48,130,1,19,2,1,1,4,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,160,129,165,48,129,162,2,1,1,48,44,6,7,42,134,72,206,61,1,1,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,255,255,252,47,48,6,4,1,0,4,1,7,4,65,4,121,190,102,126,249,220,187,172,85,160,98,149,206,135,11,7,2,155,252,219,45,206,40,217,89,242,129,91,22,248,23,152,72,58,218,119,38,163,196,101,93,164,251,252,14,17,8,168,253,23,180,72,166,133,84,25,156,71,208,143,251,16,212,184,2,33,0,255,255,255,255,255,255,255,255,255,255,255,255,255,255,255,254,186,174,220,230,175,72,160,59,191,210,94,140,208,54,65,65,2,1,1,161,68,3,66,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]);en.privateKeyExport=function(a,n,h){h===void 0&&(h=!0);var u=X.from(h?_1:S1);return a.copy(u,h?8:9),n.copy(u,h?181:214),u};en.privateKeyImport=function(a){var n=a.length,h=0;if(n<h+1||a[h]!==48||(h+=1,n<h+1||!(a[h]&128)))return null;var u=a[h]&127;if(h+=1,u<1||u>2||n<h+u)return null;var v=a[h+u-1]|(u>1?a[h+u-2]<<8:0);return h+=u,n<h+v||n<h+3||a[h]!==2||a[h+1]!==1||a[h+2]!==1||(h+=3,n<h+2||a[h]!==4||a[h+1]>32||n<h+2+a[h+1])?null:a.slice(h+2,h+2+a[h+1])};en.signatureImportLax=function(a){var n=X.alloc(32,0),h=X.alloc(32,0),u=a.length,v=0;if(a[v++]!==48)return null;var o=a[v++];if(o&128&&(v+=o-128,v>u)||a[v++]!==2)return null;var w=a[v++];if(w&128){if(o=w-128,v+o>u)return null;for(;o>0&&a[v]===0;v+=1,o-=1);for(w=0;o>0;v+=1,o-=1)w=(w<<8)+a[v]}if(w>u-v)return null;var y=v;if(v+=w,a[v++]!==2)return null;var b=a[v++];if(b&128){if(o=b-128,v+o>u)return null;for(;o>0&&a[v]===0;v+=1,o-=1);for(b=0;o>0;v+=1,o-=1)b=(b<<8)+a[v]}if(b>u-v)return null;var B=v;for(v+=b;w>0&&a[y]===0;w-=1,y+=1);if(w>32)return null;var k=a.slice(y,y+w);for(k.copy(n,32-k.length);b>0&&a[B]===0;b-=1,B+=1);if(b>32)return null;var L=a.slice(B,B+b);return L.copy(h,32-L.length),{r:n,s:h}};(function(a){Object.defineProperty(a,"__esModule",{value:!0}),a.ecdhUnsafe=a.ecdh=a.recover=a.verify=a.sign=a.signatureImportLax=a.signatureImport=a.signatureExport=a.signatureNormalize=a.publicKeyCombine=a.publicKeyTweakMul=a.publicKeyTweakAdd=a.publicKeyVerify=a.publicKeyConvert=a.publicKeyCreate=a.privateKeyTweakMul=a.privateKeyTweakAdd=a.privateKeyModInverse=a.privateKeyNegate=a.privateKeyImport=a.privateKeyExport=a.privateKeyVerify=void 0;var n=Fh,h=bi,u=en;a.privateKeyVerify=function(v){return v.length!==32?!1:n.privateKeyVerify(Uint8Array.from(v))},a.privateKeyExport=function(v,o){if(v.length!==32)throw new RangeError("private key length is invalid");var w=h.privateKeyExport(v,o);return u.privateKeyExport(v,w,o)},a.privateKeyImport=function(v){if(v=u.privateKeyImport(v),v!==null&&v.length===32&&a.privateKeyVerify(v))return v;throw new Error("couldn't import from DER format")},a.privateKeyNegate=function(v){return X.from(n.privateKeyNegate(Uint8Array.from(v)))},a.privateKeyModInverse=function(v){if(v.length!==32)throw new Error("private key length is invalid");return X.from(h.privateKeyModInverse(Uint8Array.from(v)))},a.privateKeyTweakAdd=function(v,o){return X.from(n.privateKeyTweakAdd(Uint8Array.from(v),o))},a.privateKeyTweakMul=function(v,o){return X.from(n.privateKeyTweakMul(Uint8Array.from(v),Uint8Array.from(o)))},a.publicKeyCreate=function(v,o){return X.from(n.publicKeyCreate(Uint8Array.from(v),o))},a.publicKeyConvert=function(v,o){return X.from(n.publicKeyConvert(Uint8Array.from(v),o))},a.publicKeyVerify=function(v){return v.length!==33&&v.length!==65?!1:n.publicKeyVerify(Uint8Array.from(v))},a.publicKeyTweakAdd=function(v,o,w){return X.from(n.publicKeyTweakAdd(Uint8Array.from(v),Uint8Array.from(o),w))},a.publicKeyTweakMul=function(v,o,w){return X.from(n.publicKeyTweakMul(Uint8Array.from(v),Uint8Array.from(o),w))},a.publicKeyCombine=function(v,o){var w=[];return v.forEach(function(y){w.push(Uint8Array.from(y))}),X.from(n.publicKeyCombine(w,o))},a.signatureNormalize=function(v){return X.from(n.signatureNormalize(Uint8Array.from(v)))},a.signatureExport=function(v){return X.from(n.signatureExport(Uint8Array.from(v)))},a.signatureImport=function(v){return X.from(n.signatureImport(Uint8Array.from(v)))},a.signatureImportLax=function(v){if(v.length===0)throw new RangeError("signature length is invalid");var o=u.signatureImportLax(v);if(o===null)throw new Error("couldn't parse DER signature");return h.signatureImport(o)},a.sign=function(v,o,w){if(w===null)throw new TypeError("options should be an Object");var y=void 0;if(w){if(y={},w.data===null)throw new TypeError("options.data should be a Buffer");if(w.data){if(w.data.length!=32)throw new RangeError("options.data length is invalid");y.data=new Uint8Array(w.data)}if(w.noncefn===null)throw new TypeError("options.noncefn should be a Function");w.noncefn&&(y.noncefn=function(B,k,L,q,$){var M=L!=null?X.from(L):null,N=q!=null?X.from(q):null,x=X.from("");return w.noncefn&&(x=w.noncefn(X.from(B),X.from(k),M,N,$)),new Uint8Array(x)})}var b=n.ecdsaSign(Uint8Array.from(v),Uint8Array.from(o),y);return{signature:X.from(b.signature),recovery:b.recid}},a.verify=function(v,o,w){return n.ecdsaVerify(Uint8Array.from(o),Uint8Array.from(v),w)},a.recover=function(v,o,w,y){return X.from(n.ecdsaRecover(Uint8Array.from(o),w,Uint8Array.from(v),y))},a.ecdh=function(v,o){return X.from(n.ecdh(Uint8Array.from(v),Uint8Array.from(o),{}))},a.ecdhUnsafe=function(v,o,w){if(v.length!==33&&v.length!==65)throw new RangeError("public key length is invalid");if(o.length!==32)throw new RangeError("private key length is invalid");return X.from(h.ecdhUnsafe(Uint8Array.from(v),Uint8Array.from(o),w))}})(sa);var Dh={};(function(a){Object.defineProperty(a,"__esModule",{value:!0}),a.KECCAK256_RLP=a.KECCAK256_RLP_S=a.KECCAK256_RLP_ARRAY=a.KECCAK256_RLP_ARRAY_S=a.KECCAK256_NULL=a.KECCAK256_NULL_S=a.TWO_POW256=a.MAX_INTEGER=void 0;var n=Kr;a.MAX_INTEGER=new n("ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff",16),a.TWO_POW256=new n("10000000000000000000000000000000000000000000000000000000000000000",16),a.KECCAK256_NULL_S="c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470",a.KECCAK256_NULL=X.from(a.KECCAK256_NULL_S,"hex"),a.KECCAK256_RLP_ARRAY_S="1dcc4de8dec75d7aab85b567b6ccd41ad312451b948a7413f0a142fd40d49347",a.KECCAK256_RLP_ARRAY=X.from(a.KECCAK256_RLP_ARRAY_S,"hex"),a.KECCAK256_RLP_S="56e81f171bcc55a6ff8345e692c0f86e5b48e01b996cadc001622fb5e363b421",a.KECCAK256_RLP=X.from(a.KECCAK256_RLP_S,"hex")})(Dh);var Hh={},Mi={};(function(a){Object.defineProperty(a,"__esModule",{value:!0}),a.baToJSON=a.addHexPrefix=a.toUnsigned=a.fromSigned=a.bufferToHex=a.bufferToInt=a.toBuffer=a.stripZeros=a.unpad=a.setLengthRight=a.setLength=a.setLengthLeft=a.zeros=void 0;var n=Hr,h=Kr;a.zeros=function(u){return X.allocUnsafe(u).fill(0)},a.setLengthLeft=function(u,v,o){o===void 0&&(o=!1);var w=a.zeros(v);return u=a.toBuffer(u),o?u.length<v?(u.copy(w),w):u.slice(0,v):u.length<v?(u.copy(w,v-u.length),w):u.slice(-v)},a.setLength=a.setLengthLeft,a.setLengthRight=function(u,v){return a.setLength(u,v,!0)},a.unpad=function(u){u=n.stripHexPrefix(u);for(var v=u[0];u.length>0&&v.toString()==="0";)u=u.slice(1),v=u[0];return u},a.stripZeros=a.unpad,a.toBuffer=function(u){if(!X.isBuffer(u))if(Array.isArray(u))u=X.from(u);else if(typeof u=="string")if(n.isHexString(u))u=X.from(n.padToEven(n.stripHexPrefix(u)),"hex");else throw new Error("Cannot convert string to buffer. toBuffer only supports 0x-prefixed hex strings and this string was given: "+u);else if(typeof u=="number")u=n.intToBuffer(u);else if(u==null)u=X.allocUnsafe(0);else if(h.isBN(u))u=u.toArrayLike(X);else if(u.toArray)u=X.from(u.toArray());else throw new Error("invalid type");return u},a.bufferToInt=function(u){return new h(a.toBuffer(u)).toNumber()},a.bufferToHex=function(u){return u=a.toBuffer(u),"0x"+u.toString("hex")},a.fromSigned=function(u){return new h(u).fromTwos(256)},a.toUnsigned=function(u){return X.from(u.toTwos(256).toArray())},a.addHexPrefix=function(u){return typeof u!="string"||n.isHexPrefixed(u)?u:"0x"+u},a.baToJSON=function(u){if(X.isBuffer(u))return"0x"+u.toString("hex");if(u instanceof Array){for(var v=[],o=0;o<u.length;o++)v.push(a.baToJSON(u[o]));return v}}})(Mi);var ua={},xi={},To={};Object.defineProperty(To,"__esModule",{value:!0});function A1(a){return function(n){var h=a();return h.update(n),X.from(h.digest())}}To.createHashFunction=A1;Object.defineProperty(xi,"__esModule",{value:!0});var la=To,ca=Xf;xi.keccak224=la.createHashFunction(function(){return ca("keccak224")});xi.keccak256=la.createHashFunction(function(){return ca("keccak256")});xi.keccak384=la.createHashFunction(function(){return ca("keccak384")});xi.keccak512=la.createHashFunction(function(){return ca("keccak512")});(function(a){Object.defineProperty(a,"__esModule",{value:!0}),a.rlphash=a.ripemd160=a.sha256=a.keccak256=a.keccak=void 0;var n=xi,h=n.keccak224,u=n.keccak384,v=n.keccak256,o=n.keccak512,w=co,y=Hr,b=Ge,B=Mi;a.keccak=function(k,L){switch(L===void 0&&(L=256),typeof k=="string"&&!y.isHexString(k)?k=X.from(k,"utf8"):k=B.toBuffer(k),L||(L=256),L){case 224:return h(k);case 256:return v(k);case 384:return u(k);case 512:return o(k);default:throw new Error("Invald algorithm: keccak"+L)}},a.keccak256=function(k){return a.keccak(k)},a.sha256=function(k){return k=B.toBuffer(k),w("sha256").update(k).digest()},a.ripemd160=function(k,L){k=B.toBuffer(k);var q=w("rmd160").update(k).digest();return L===!0?B.setLength(q,32):q},a.rlphash=function(k){return a.keccak(b.encode(k))}})(ua);(function(a){Object.defineProperty(a,"__esModule",{value:!0}),a.importPublic=a.privateToPublic=a.privateToAddress=a.publicToAddress=a.pubToAddress=a.isValidPublic=a.isValidPrivate=a.isPrecompiled=a.generateAddress2=a.generateAddress=a.isValidChecksumAddress=a.toChecksumAddress=a.isZeroAddress=a.isValidAddress=a.zeroAddress=void 0;var n=Se,h=Hr,u=sa,v=Kr,o=Mi,w=ua;a.zeroAddress=function(){var y=20,b=o.zeros(y);return o.bufferToHex(b)},a.isValidAddress=function(y){return/^0x[0-9a-fA-F]{40}$/.test(y)},a.isZeroAddress=function(y){var b=a.zeroAddress();return b===o.addHexPrefix(y)},a.toChecksumAddress=function(y,b){y=h.stripHexPrefix(y).toLowerCase();for(var B=b!==void 0?b.toString()+"0x":"",k=w.keccak(B+y).toString("hex"),L="0x",q=0;q<y.length;q++)parseInt(k[q],16)>=8?L+=y[q].toUpperCase():L+=y[q];return L},a.isValidChecksumAddress=function(y,b){return a.isValidAddress(y)&&a.toChecksumAddress(y,b)===y},a.generateAddress=function(y,b){y=o.toBuffer(y);var B=new v(b);return B.isZero()?w.rlphash([y,null]).slice(-20):w.rlphash([y,X.from(B.toArray())]).slice(-20)},a.generateAddress2=function(y,b,B){var k=o.toBuffer(y),L=o.toBuffer(b),q=o.toBuffer(B);n(k.length===20),n(L.length===32);var $=w.keccak256(X.concat([X.from("ff","hex"),k,L,w.keccak256(q)]));return $.slice(-20)},a.isPrecompiled=function(y){var b=o.unpad(y);return b.length===1&&b[0]>=1&&b[0]<=8},a.isValidPrivate=function(y){return u.privateKeyVerify(y)},a.isValidPublic=function(y,b){return b===void 0&&(b=!1),y.length===64?u.publicKeyVerify(X.concat([X.from([4]),y])):b?u.publicKeyVerify(y):!1},a.pubToAddress=function(y,b){return b===void 0&&(b=!1),y=o.toBuffer(y),b&&y.length!==64&&(y=u.publicKeyConvert(y,!1).slice(1)),n(y.length===64),w.keccak(y).slice(-20)},a.publicToAddress=a.pubToAddress,a.privateToAddress=function(y){return a.publicToAddress(a.privateToPublic(y))},a.privateToPublic=function(y){return y=o.toBuffer(y),u.publicKeyCreate(y,!1).slice(1)},a.importPublic=function(y){return y=o.toBuffer(y),y.length!==64&&(y=u.publicKeyConvert(y,!1).slice(1)),y}})(Hh);var ze={};Object.defineProperty(ze,"__esModule",{value:!0});ze.hashPersonalMessage=ze.isValidSignature=ze.fromRpcSig=ze.toRpcSig=ze.ecrecover=ze.ecsign=void 0;var Tf=sa,ln=Kr,qr=Mi,E1=ua;ze.ecsign=function(a,n,h){var u=Tf.sign(a,n),v=u.recovery,o={r:u.signature.slice(0,32),s:u.signature.slice(32,64),v:h?v+(h*2+35):v+27};return o};ze.ecrecover=function(a,n,h,u,v){var o=X.concat([qr.setLength(h,32),qr.setLength(u,32)],64),w=Co(n,v);if(!Lo(w))throw new Error("Invalid signature v value");var y=Tf.recover(a,o,w);return Tf.publicKeyConvert(y,!1).slice(1)};ze.toRpcSig=function(a,n,h,u){var v=Co(a,u);if(!Lo(v))throw new Error("Invalid signature v value");return qr.bufferToHex(X.concat([qr.setLengthLeft(n,32),qr.setLengthLeft(h,32),qr.toBuffer(a)]))};ze.fromRpcSig=function(a){var n=qr.toBuffer(a);if(n.length!==65)throw new Error("Invalid signature length");var h=n[64];return h<27&&(h+=27),{v:h,r:n.slice(0,32),s:n.slice(32,64)}};ze.isValidSignature=function(a,n,h,u,v){u===void 0&&(u=!0);var o=new ln("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),w=new ln("fffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141",16);if(n.length!==32||h.length!==32||!Lo(Co(a,v)))return!1;var y=new ln(n),b=new ln(h);return!(y.isZero()||y.gt(w)||b.isZero()||b.gt(w)||u&&b.cmp(o)===1)};ze.hashPersonalMessage=function(a){var n=X.from(`Ethereum Signed Message:
|
|
24
|
+
`+a.length.toString(),"utf-8");return E1.keccak(X.concat([n,a]))};function Co(a,n){return n?a-(2*n+35):a-27}function Lo(a){return a===0||a===1}var da={};Object.defineProperty(da,"__esModule",{value:!0});da.defineProperties=void 0;var q0=Se,k1=Hr,U0=Ge,cn=Mi;da.defineProperties=function(a,n,h){if(a.raw=[],a._fields=[],a.toJSON=function(v){if(v===void 0&&(v=!1),v){var o={};return a._fields.forEach(function(w){o[w]="0x"+a[w].toString("hex")}),o}return cn.baToJSON(a.raw)},a.serialize=function(){return U0.encode(a.raw)},n.forEach(function(v,o){a._fields.push(v.name);function w(){return a.raw[o]}function y(b){b=cn.toBuffer(b),b.toString("hex")==="00"&&!v.allowZero&&(b=X.allocUnsafe(0)),v.allowLess&&v.length?(b=cn.stripZeros(b),q0(v.length>=b.length,"The field "+v.name+" must not have more "+v.length+" bytes")):!(v.allowZero&&b.length===0)&&v.length&&q0(v.length===b.length,"The field "+v.name+" must have byte length of "+v.length),a.raw[o]=b}Object.defineProperty(a,v.name,{enumerable:!0,configurable:!0,get:w,set:y}),v.default&&(a[v.name]=v.default),v.alias&&Object.defineProperty(a,v.alias,{enumerable:!1,configurable:!0,set:y,get:w})}),h)if(typeof h=="string"&&(h=X.from(k1.stripHexPrefix(h),"hex")),X.isBuffer(h)&&(h=U0.decode(h)),Array.isArray(h)){if(h.length>a._fields.length)throw new Error("wrong number of fields in data");h.forEach(function(v,o){a[a._fields[o]]=cn.toBuffer(v)})}else if(typeof h=="object"){var u=Object.keys(h);n.forEach(function(v){u.indexOf(v.name)!==-1&&(a[v.name]=h[v.name]),u.indexOf(v.alias)!==-1&&(a[v.alias]=h[v.alias])})}else throw new Error("invalid data")};(function(a){var n=Vt&&Vt.__createBinding||(Object.create?function(y,b,B,k){k===void 0&&(k=B),Object.defineProperty(y,k,{enumerable:!0,get:function(){return b[B]}})}:function(y,b,B,k){k===void 0&&(k=B),y[k]=b[B]}),h=Vt&&Vt.__exportStar||function(y,b){for(var B in y)B!=="default"&&!b.hasOwnProperty(B)&&n(b,y,B)};Object.defineProperty(a,"__esModule",{value:!0}),a.secp256k1=a.rlp=a.BN=void 0;var u=sa;a.secp256k1=u;var v=Hr,o=Kr;a.BN=o;var w=Ge;a.rlp=w,Object.assign(a,v),h(Dh,a),h(Hh,a),h(ua,a),h(ze,a),h(Mi,a),h(da,a)})(Uh);const ar=Uh,$e=Kr;var xe=function(){};function va(a){return a.startsWith("int[")?"int256"+a.slice(3):a==="int"?"int256":a.startsWith("uint[")?"uint256"+a.slice(4):a==="uint"?"uint256":a.startsWith("fixed[")?"fixed128x128"+a.slice(5):a==="fixed"?"fixed128x128":a.startsWith("ufixed[")?"ufixed128x128"+a.slice(6):a==="ufixed"?"ufixed128x128":a}xe.eventID=function(a,n){var h=a+"("+n.map(va).join(",")+")";return ar.keccak256(X.from(h))};xe.methodID=function(a,n){return xe.eventID(a,n).slice(0,4)};function wr(a){return parseInt(/^\D+(\d+)$/.exec(a)[1],10)}function Cf(a){var n=/^\D+(\d+)x(\d+)$/.exec(a);return[parseInt(n[1],10),parseInt(n[2],10)]}function rn(a){var n=a.match(/(.*)\[(.*?)\]$/);return n?n[2]===""?"dynamic":parseInt(n[2],10):null}function Lr(a){var n=typeof a;if(n==="string")return ar.isHexPrefixed(a)?new $e(ar.stripHexPrefix(a),16):new $e(a,10);if(n==="number")return new $e(a);if(a.toArray)return a;throw new Error("Argument is not a number")}function Kh(a){var n=/^(\w+)\((.*)\)$/.exec(a);if(n.length!==3)throw new Error("Invalid method signature");var h=/^(.+)\):\((.+)$/.exec(n[2]);if(h!==null&&h.length===3)return{method:n[1],args:h[1].split(","),retargs:h[2].split(",")};var u=n[2].split(",");return u.length===1&&u[0]===""&&(u=[]),{method:n[1],args:u}}function ir(a,n){var h,u,v,o;if(a==="address")return ir("uint160",Lr(n));if(a==="bool")return ir("uint8",n?1:0);if(a==="string")return ir("bytes",X.from(n,"utf8"));if(qi(a)){if(typeof n.length>"u")throw new Error("Not an array?");if(h=rn(a),h!=="dynamic"&&h!==0&&n.length>h)throw new Error("Elements exceed array size: "+h);v=[],a=a.slice(0,a.lastIndexOf("[")),typeof n=="string"&&(n=JSON.parse(n));for(o in n)v.push(ir(a,n[o]));if(h==="dynamic"){var w=ir("uint256",n.length);v.unshift(w)}return X.concat(v)}else{if(a==="bytes")return n=X.from(n),v=X.concat([ir("uint256",n.length),n]),n.length%32!==0&&(v=X.concat([v,ar.zeros(32-n.length%32)])),v;if(a.startsWith("bytes")){if(h=wr(a),h<1||h>32)throw new Error("Invalid bytes<N> width: "+h);return ar.setLengthRight(n,32)}else if(a.startsWith("uint")){if(h=wr(a),h%8||h<8||h>256)throw new Error("Invalid uint<N> width: "+h);if(u=Lr(n),u.bitLength()>h)throw new Error("Supplied uint exceeds width: "+h+" vs "+u.bitLength());if(u<0)throw new Error("Supplied uint is negative");return u.toArrayLike(X,"be",32)}else if(a.startsWith("int")){if(h=wr(a),h%8||h<8||h>256)throw new Error("Invalid int<N> width: "+h);if(u=Lr(n),u.bitLength()>h)throw new Error("Supplied int exceeds width: "+h+" vs "+u.bitLength());return u.toTwos(256).toArrayLike(X,"be",32)}else if(a.startsWith("ufixed")){if(h=Cf(a),u=Lr(n),u<0)throw new Error("Supplied ufixed is negative");return ir("uint256",u.mul(new $e(2).pow(new $e(h[1]))))}else if(a.startsWith("fixed"))return h=Cf(a),ir("int256",Lr(n).mul(new $e(2).pow(new $e(h[1]))))}throw new Error("Unsupported or invalid type: "+a)}function Qe(a,n,h){typeof a=="string"&&(a=Po(a));var u,v,o,w;if(a.name==="address")return Qe(a.rawType,n,h).toArrayLike(X,"be",20).toString("hex");if(a.name==="bool")return Qe(a.rawType,n,h).toString()===new $e(1).toString();if(a.name==="string"){var y=Qe(a.rawType,n,h);return X.from(y,"utf8").toString()}else if(a.isArray){for(o=[],u=a.size,a.size==="dynamic"&&(h=Qe("uint256",n,h).toNumber(),u=Qe("uint256",n,h).toNumber(),h=h+32),w=0;w<u;w++){var b=Qe(a.subArray,n,h);o.push(b),h+=a.subArray.memoryUsage}return o}else{if(a.name==="bytes")return h=Qe("uint256",n,h).toNumber(),u=Qe("uint256",n,h).toNumber(),n.slice(h+32,h+32+u);if(a.name.startsWith("bytes"))return n.slice(h,h+a.size);if(a.name.startsWith("uint")){if(v=new $e(n.slice(h,h+32),16,"be"),v.bitLength()>a.size)throw new Error("Decoded int exceeds width: "+a.size+" vs "+v.bitLength());return v}else if(a.name.startsWith("int")){if(v=new $e(n.slice(h,h+32),16,"be").fromTwos(256),v.bitLength()>a.size)throw new Error("Decoded uint exceeds width: "+a.size+" vs "+v.bitLength());return v}else if(a.name.startsWith("ufixed")){if(u=new $e(2).pow(new $e(a.size[1])),v=Qe("uint256",n,h),!v.mod(u).isZero())throw new Error("Decimals not supported yet");return v.div(u)}else if(a.name.startsWith("fixed")){if(u=new $e(2).pow(new $e(a.size[1])),v=Qe("int256",n,h),!v.mod(u).isZero())throw new Error("Decimals not supported yet");return v.div(u)}}throw new Error("Unsupported or invalid type: "+a.name)}function Po(a){var n,h;if(qi(a)){n=rn(a);var u=a.slice(0,a.lastIndexOf("["));return u=Po(u),h={isArray:!0,name:a,size:n,memoryUsage:n==="dynamic"?32:u.memoryUsage*n,subArray:u},h}else{var v;switch(a){case"address":v="uint160";break;case"bool":v="uint8";break;case"string":v="bytes";break}if(h={rawType:v,name:a,memoryUsage:32},a.startsWith("bytes")&&a!=="bytes"||a.startsWith("uint")||a.startsWith("int")?h.size=wr(a):(a.startsWith("ufixed")||a.startsWith("fixed"))&&(h.size=Cf(a)),a.startsWith("bytes")&&a!=="bytes"&&(h.size<1||h.size>32))throw new Error("Invalid bytes<N> width: "+h.size);if((a.startsWith("uint")||a.startsWith("int"))&&(h.size%8||h.size<8||h.size>256))throw new Error("Invalid int/uint<N> width: "+h.size);return h}}function R1(a){return a==="string"||a==="bytes"||rn(a)==="dynamic"}function qi(a){return a.lastIndexOf("]")===a.length-1}xe.rawEncode=function(a,n){var h=[],u=[],v=0;a.forEach(function(B){if(qi(B)){var k=rn(B);k!=="dynamic"?v+=32*k:v+=32}else v+=32});for(var o=0;o<a.length;o++){var w=va(a[o]),y=n[o],b=ir(w,y);R1(w)?(h.push(ir("uint256",v)),u.push(b),v+=b.length):h.push(b)}return X.concat(h.concat(u))};xe.rawDecode=function(a,n){var h=[];n=X.from(n);for(var u=0,v=0;v<a.length;v++){var o=va(a[v]),w=Po(o),y=Qe(w,n,u);u+=w.memoryUsage,h.push(y)}return h};xe.simpleEncode=function(a){var n=Array.prototype.slice.call(arguments).slice(1),h=Kh(a);if(n.length!==h.args.length)throw new Error("Argument count mismatch");return X.concat([xe.methodID(h.method,h.args),xe.rawEncode(h.args,n)])};xe.simpleDecode=function(a,n){var h=Kh(a);if(!h.retargs)throw new Error("No return values in method");return xe.rawDecode(h.retargs,n)};function F0(a,n){return a.startsWith("address")||a.startsWith("bytes")?"0x"+n.toString("hex"):n.toString()}xe.stringify=function(a,n){var h=[];for(var u in a){var v=a[u],o=n[u];/^[^\[]+\[.*\]$/.test(v)?o=o.map(function(w){return F0(v,w)}).join(", "):o=F0(v,o),h.push(o)}return h};xe.solidityHexValue=function(a,n,h){var u,v;if(qi(a)){var o=a.replace(/\[.*?\]/,"");if(!qi(o)){var w=rn(a);if(w!=="dynamic"&&w!==0&&n.length>w)throw new Error("Elements exceed array size: "+w)}var y=n.map(function(k){return xe.solidityHexValue(o,k,256)});return X.concat(y)}else{if(a==="bytes")return n;if(a==="string")return X.from(n,"utf8");if(a==="bool"){h=h||8;var b=Array(h/4).join("0");return X.from(n?b+"1":b+"0","hex")}else if(a==="address"){var B=20;return h&&(B=h/8),ar.setLengthLeft(n,B)}else if(a.startsWith("bytes")){if(u=wr(a),u<1||u>32)throw new Error("Invalid bytes<N> width: "+u);return ar.setLengthRight(n,u)}else if(a.startsWith("uint")){if(u=wr(a),u%8||u<8||u>256)throw new Error("Invalid uint<N> width: "+u);if(v=Lr(n),v.bitLength()>u)throw new Error("Supplied uint exceeds width: "+u+" vs "+v.bitLength());return h=h||u,v.toArrayLike(X,"be",h/8)}else if(a.startsWith("int")){if(u=wr(a),u%8||u<8||u>256)throw new Error("Invalid int<N> width: "+u);if(v=Lr(n),v.bitLength()>u)throw new Error("Supplied int exceeds width: "+u+" vs "+v.bitLength());return h=h||u,v.toTwos(u).toArrayLike(X,"be",h/8)}else throw new Error("Unsupported or invalid type: "+a)}};xe.solidityPack=function(a,n){if(a.length!==n.length)throw new Error("Number of types are not matching the values");for(var h=[],u=0;u<a.length;u++){var v=va(a[u]),o=n[u];h.push(xe.solidityHexValue(v,o,null))}return X.concat(h)};xe.soliditySHA3=function(a,n){return ar.keccak256(xe.solidityPack(a,n))};xe.soliditySHA256=function(a,n){return ar.sha256(xe.solidityPack(a,n))};xe.solidityRIPEMD160=function(a,n){return ar.ripemd160(xe.solidityPack(a,n),!0)};function B1(a){return a>="0"&&a<="9"}xe.fromSerpent=function(a){for(var n=[],h=0;h<a.length;h++){var u=a[h];if(u==="s")n.push("bytes");else if(u==="b"){for(var v="bytes",o=h+1;o<a.length&&B1(a[o]);)v+=a[o]-"0",o++;h=o-1,n.push(v)}else if(u==="i")n.push("int256");else if(u==="a")n.push("int256[]");else throw new Error("Unsupported or invalid type: "+u)}return n};xe.toSerpent=function(a){for(var n=[],h=0;h<a.length;h++){var u=a[h];if(u==="bytes")n.push("s");else if(u.startsWith("bytes"))n.push("b"+wr(u));else if(u==="int256")n.push("i");else if(u==="int256[]")n.push("a");else throw new Error("Unsupported or invalid type: "+u)}return n.join("")};var I1=xe,T1=I1;const ge=Ch,Da=T1;var C1={concatSig:function(a,n,h){const u=ge.fromSigned(n),v=ge.fromSigned(h),o=ge.bufferToInt(a),w=z0(ge.toUnsigned(u).toString("hex"),64),y=z0(ge.toUnsigned(v).toString("hex"),64),b=ge.stripHexPrefix(ge.intToHex(o));return ge.addHexPrefix(w.concat(y,b)).toString("hex")},normalize:function(a){if(a){if(typeof a=="number"){const h=ge.toBuffer(a);a=ge.bufferToHex(h)}if(typeof a!="string"){var n="eth-sig-util.normalize() requires hex string or integer input.";throw n+=" received "+typeof a+": "+a,new Error(n)}return ge.addHexPrefix(a.toLowerCase())}},personalSign:function(a,n){var h=ge.toBuffer(n.data),u=ge.hashPersonalMessage(h),v=ge.ecsign(u,a),o=ge.bufferToHex(this.concatSig(v.v,v.r,v.s));return o},recoverPersonalSignature:function(a){const n=$0(a),h=ge.publicToAddress(n);return ge.bufferToHex(h)},extractPublicKey:function(a){return"0x"+$0(a).toString("hex")},typedSignatureHash:function(a){const n=Ha(a);return ge.bufferToHex(n)},signTypedData:function(a,n){const h=Ha(n.data),u=ge.ecsign(h,a);return ge.bufferToHex(this.concatSig(u.v,u.r,u.s))},recoverTypedSignature:function(a){const n=Ha(a.data),h=Zh(n,a.sig),u=ge.publicToAddress(h);return ge.bufferToHex(u)}};function Ha(a){const n=new Error("Expect argument to be non-empty array");if(typeof a!="object"||!a.length)throw n;const h=a.map(function(o){return o.type==="bytes"?ge.toBuffer(o.value):o.value}),u=a.map(function(o){return o.type}),v=a.map(function(o){if(!o.name)throw n;return o.type+" "+o.name});return Da.soliditySHA3(["bytes32","bytes32"],[Da.soliditySHA3(new Array(a.length).fill("string"),v),Da.soliditySHA3(u,h)])}function Zh(a,n){const h=ge.toBuffer(n),u=ge.fromRpcSig(h);return ge.ecrecover(a,u.v,u.r,u.s)}function $0(a){const n=ge.toBuffer(a.data),h=ge.hashPersonalMessage(n);return Zh(h,a.sig)}function z0(a,n){for(var h=""+a;h.length<n;)h="0"+h;return h}var Wh={exports:{}};(function(a,n){(function(h){var u=function(o){setTimeout(o,0)};typeof Me<"u"&&Me&&typeof Me.nextTick=="function"&&(u=Me.nextTick);function v(o){var w={capacity:o||1,current:0,queue:[],firstHere:!1,take:function(){if(w.firstHere===!1){w.current++,w.firstHere=!0;var y=1}else var y=0;var b={n:1};typeof arguments[0]=="function"?b.task=arguments[0]:b.n=arguments[0],arguments.length>=2&&(typeof arguments[1]=="function"?b.task=arguments[1]:b.n=arguments[1]);var B=b.task;if(b.task=function(){B(w.leave)},w.current+b.n-y>w.capacity)return y===1&&(w.current--,w.firstHere=!1),w.queue.push(b);w.current+=b.n-y,b.task(w.leave),y===1&&(w.firstHere=!1)},leave:function(y){if(y=y||1,w.current-=y,!w.queue.length){if(w.current<0)throw new Error("leave called too many times.");return}var b=w.queue[0];b.n+w.current>w.capacity||(w.queue.shift(),w.current+=b.n,u(b.task))},available:function(y){return y=y||1,w.current+y<=w.capacity}};return w}a.exports=v})()})(Wh);var L1=Wh.exports;const P1=yo;var O1=N1;function N1(a,n,h){a.sendAsync(P1({method:"eth_estimateGas",params:[n]}),function(u,v){if(u)return u.message==="no contract code at given address"?h(null,"0xcf08"):h(u);h(null,v.result)})}const Ne=Hm,q1=Zm,U1=zr.inherits,Bn=Vi,F1=C1,jr=Ls,$1=L1,z1=ra,D1=O1,H1=/^[0-9A-Fa-f]+$/g;var K1=me;U1(me,z1);function me(a){const n=this;n.nonceLock=$1(1),a.getAccounts&&(n.getAccounts=a.getAccounts),a.processTransaction&&(n.processTransaction=a.processTransaction),a.processMessage&&(n.processMessage=a.processMessage),a.processPersonalMessage&&(n.processPersonalMessage=a.processPersonalMessage),a.processTypedMessage&&(n.processTypedMessage=a.processTypedMessage),n.approveTransaction=a.approveTransaction||n.autoApprove,n.approveMessage=a.approveMessage||n.autoApprove,n.approvePersonalMessage=a.approvePersonalMessage||n.autoApprove,n.approveDecryptMessage=a.approveDecryptMessage||n.autoApprove,n.approveEncryptionPublicKey=a.approveEncryptionPublicKey||n.autoApprove,n.approveTypedMessage=a.approveTypedMessage||n.autoApprove,a.signTransaction&&(n.signTransaction=a.signTransaction||Gr("signTransaction")),a.signMessage&&(n.signMessage=a.signMessage||Gr("signMessage")),a.signPersonalMessage&&(n.signPersonalMessage=a.signPersonalMessage||Gr("signPersonalMessage")),a.decryptMessage&&(n.decryptMessage=a.decryptMessage||Gr("decryptMessage")),a.encryptionPublicKey&&(n.encryptionPublicKey=a.encryptionPublicKey||Gr("encryptionPublicKey")),a.signTypedMessage&&(n.signTypedMessage=a.signTypedMessage||Gr("signTypedMessage")),a.recoverPersonalSignature&&(n.recoverPersonalSignature=a.recoverPersonalSignature),a.publishTransaction&&(n.publishTransaction=a.publishTransaction),n.estimateGas=a.estimateGas||n.estimateGas,n.getGasPrice=a.getGasPrice||n.getGasPrice}me.prototype.handleRequest=function(a,n,h){const u=this;u._parityRequests={},u._parityRequestCount=0;let v,o,w,y,b;switch(a.method){case"eth_coinbase":u.getAccounts(function(B,k){if(B)return h(B);let L=k[0]||null;h(null,L)});return;case"eth_accounts":u.getAccounts(function(B,k){if(B)return h(B);h(null,k)});return;case"eth_sendTransaction":v=a.params[0],Ne([B=>u.validateTransaction(v,B),B=>u.processTransaction(v,B)],h);return;case"eth_signTransaction":v=a.params[0],Ne([B=>u.validateTransaction(v,B),B=>u.processSignTransaction(v,B)],h);return;case"eth_sign":b=a.params[0],y=a.params[1],w=a.params[2]||{},o=jr(w,{from:b,data:y}),Ne([B=>u.validateMessage(o,B),B=>u.processMessage(o,B)],h);return;case"personal_sign":return function(){const B=a.params[0],k=a.params[1];if(D0(k)&&Ka(B)){let L="The eth_personalSign method requires params ordered ";L+="[message, address]. This was previously handled incorrectly, ",L+="and has been corrected automatically. ",L+="Please switch this param order for smooth behavior in the future.",console.warn(L),b=a.params[0],y=a.params[1]}else y=a.params[0],b=a.params[1];w=a.params[2]||{},o=jr(w,{from:b,data:y}),Ne([L=>u.validatePersonalMessage(o,L),L=>u.processPersonalMessage(o,L)],h)}();case"eth_decryptMessage":return function(){const B=a.params[0],k=a.params[1];if(D0(k)&&Ka(B)){let L="The eth_decryptMessage method requires params ordered ";L+="[message, address]. This was previously handled incorrectly, ",L+="and has been corrected automatically. ",L+="Please switch this param order for smooth behavior in the future.",console.warn(L),b=a.params[0],y=a.params[1]}else y=a.params[0],b=a.params[1];w=a.params[2]||{},o=jr(w,{from:b,data:y}),Ne([L=>u.validateDecryptMessage(o,L),L=>u.processDecryptMessage(o,L)],h)}();case"encryption_public_key":return function(){const B=a.params[0];Ne([k=>u.validateEncryptionPublicKey(B,k),k=>u.processEncryptionPublicKey(B,k)],h)}();case"personal_ecRecover":return function(){y=a.params[0];let B=a.params[1];w=a.params[2]||{},o=jr(w,{sig:B,data:y}),u.recoverPersonalSignature(o,h)}();case"eth_signTypedData":case"eth_signTypedData_v3":case"eth_signTypedData_v4":return function(){const B=a.params[0],k=a.params[1];Ka(B)?(b=B,y=k):(y=B,b=k),w=a.params[2]||{},o=jr(w,{from:b,data:y}),Ne([L=>u.validateTypedMessage(o,L),L=>u.processTypedMessage(o,L)],h)}();case"parity_postTransaction":v=a.params[0],u.parityPostTransaction(v,h);return;case"parity_postSign":b=a.params[0],y=a.params[1],u.parityPostSign(b,y,h);return;case"parity_checkRequest":return function(){const B=a.params[0];u.parityCheckRequest(B,h)}();case"parity_defaultAccount":u.getAccounts(function(B,k){if(B)return h(B);const L=k[0]||null;h(null,L)});return;default:n();return}};me.prototype.getAccounts=function(a){a(null,[])};me.prototype.processTransaction=function(a,n){const h=this;Ne([u=>h.approveTransaction(a,u),(u,v)=>h.checkApproval("transaction",u,v),u=>h.finalizeAndSubmitTx(a,u)],n)};me.prototype.processSignTransaction=function(a,n){const h=this;Ne([u=>h.approveTransaction(a,u),(u,v)=>h.checkApproval("transaction",u,v),u=>h.finalizeTx(a,u)],n)};me.prototype.processMessage=function(a,n){const h=this;Ne([u=>h.approveMessage(a,u),(u,v)=>h.checkApproval("message",u,v),u=>h.signMessage(a,u)],n)};me.prototype.processPersonalMessage=function(a,n){const h=this;Ne([u=>h.approvePersonalMessage(a,u),(u,v)=>h.checkApproval("message",u,v),u=>h.signPersonalMessage(a,u)],n)};me.prototype.processDecryptMessage=function(a,n){const h=this;Ne([u=>h.approveDecryptMessage(a,u),(u,v)=>h.checkApproval("decryptMessage",u,v),u=>h.decryptMessage(a,u)],n)};me.prototype.processEncryptionPublicKey=function(a,n){const h=this;Ne([u=>h.approveEncryptionPublicKey(a,u),(u,v)=>h.checkApproval("encryptionPublicKey",u,v),u=>h.encryptionPublicKey(a,u)],n)};me.prototype.processTypedMessage=function(a,n){const h=this;Ne([u=>h.approveTypedMessage(a,u),(u,v)=>h.checkApproval("message",u,v),u=>h.signTypedMessage(a,u)],n)};me.prototype.autoApprove=function(a,n){n(null,!0)};me.prototype.checkApproval=function(a,n,h){h(n?null:new Error("User denied "+a+" signature."))};me.prototype.parityPostTransaction=function(a,n){const h=this,v=`0x${h._parityRequestCount.toString(16)}`;h._parityRequestCount++,h.emitPayload({method:"eth_sendTransaction",params:[a]},function(o,w){if(o){h._parityRequests[v]={error:o};return}const y=w.result;h._parityRequests[v]=y}),n(null,v)};me.prototype.parityPostSign=function(a,n,h){const u=this,o=`0x${u._parityRequestCount.toString(16)}`;u._parityRequestCount++,u.emitPayload({method:"eth_sign",params:[a,n]},function(w,y){if(w){u._parityRequests[o]={error:w};return}const b=y.result;u._parityRequests[o]=b}),h(null,o)};me.prototype.parityCheckRequest=function(a,n){const u=this._parityRequests[a]||null;if(!u)return n(null,null);if(u.error)return n(u.error);n(null,u)};me.prototype.recoverPersonalSignature=function(a,n){let h;try{h=F1.recoverPersonalSignature(a)}catch(u){return n(u)}n(null,h)};me.prototype.validateTransaction=function(a,n){const h=this;if(a.from===void 0)return n(new Error("Undefined address - from address required to sign transaction."));h.validateSender(a.from,function(u,v){if(u)return n(u);if(!v)return n(new Error(`Unknown address - unable to sign transaction for this address: "${a.from}"`));n()})};me.prototype.validateMessage=function(a,n){const h=this;if(a.from===void 0)return n(new Error("Undefined address - from address required to sign message."));h.validateSender(a.from,function(u,v){if(u)return n(u);if(!v)return n(new Error(`Unknown address - unable to sign message for this address: "${a.from}"`));n()})};me.prototype.validatePersonalMessage=function(a,n){const h=this;if(a.from===void 0)return n(new Error("Undefined address - from address required to sign personal message."));if(a.data===void 0)return n(new Error("Undefined message - message required to sign personal message."));if(!Oo(a.data))return n(new Error("HookedWalletSubprovider - validateMessage - message was not encoded as hex."));h.validateSender(a.from,function(u,v){if(u)return n(u);if(!v)return n(new Error(`Unknown address - unable to sign message for this address: "${a.from}"`));n()})};me.prototype.validateDecryptMessage=function(a,n){const h=this;if(a.from===void 0)return n(new Error("Undefined address - from address required to decrypt message."));if(a.data===void 0)return n(new Error("Undefined message - message required to decrypt message."));if(!Oo(a.data))return n(new Error("HookedWalletSubprovider - validateDecryptMessage - message was not encoded as hex."));h.validateSender(a.from,function(u,v){if(u)return n(u);if(!v)return n(new Error(`Unknown address - unable to decrypt message for this address: "${a.from}"`));n()})};me.prototype.validateEncryptionPublicKey=function(a,n){this.validateSender(a,function(u,v){if(u)return n(u);if(!v)return n(new Error(`Unknown address - unable to obtain encryption public key for this address: "${a}"`));n()})};me.prototype.validateTypedMessage=function(a,n){if(a.from===void 0)return n(new Error("Undefined address - from address required to sign typed data."));if(a.data===void 0)return n(new Error("Undefined data - message required to sign typed data."));this.validateSender(a.from,function(h,u){if(h)return n(h);if(!u)return n(new Error(`Unknown address - unable to sign message for this address: "${a.from}"`));n()})};me.prototype.validateSender=function(a,n){const h=this;if(!a)return n(null,!1);h.getAccounts(function(u,v){if(u)return n(u);const o=v.map(W1).indexOf(a.toLowerCase())!==-1;n(null,o)})};me.prototype.finalizeAndSubmitTx=function(a,n){const h=this;h.nonceLock.take(function(){Ne([h.fillInTxExtras.bind(h,a),h.signTransaction.bind(h),h.publishTransaction.bind(h)],function(u,v){if(h.nonceLock.leave(),u)return n(u);n(null,v)})})};me.prototype.finalizeTx=function(a,n){const h=this;h.nonceLock.take(function(){Ne([h.fillInTxExtras.bind(h,a),h.signTransaction.bind(h)],function(u,v){if(h.nonceLock.leave(),u)return n(u);n(null,{raw:v,tx:a})})})};me.prototype.publishTransaction=function(a,n){this.emitPayload({method:"eth_sendRawTransaction",params:[a]},function(u,v){if(u)return n(u);n(null,v.result)})};me.prototype.estimateGas=function(a,n){D1(this.engine,a,n)};me.prototype.getGasPrice=function(a){this.emitPayload({method:"eth_gasPrice",params:[]},function(h,u){if(h)return a(h);a(null,u.result)})};me.prototype.fillInTxExtras=function(a,n){const h=this,u=a.from,v={};a.gasPrice===void 0&&(v.gasPrice=h.getGasPrice.bind(h)),a.nonce===void 0&&(v.nonce=h.emitPayload.bind(h,{method:"eth_getTransactionCount",params:[u,"pending"]})),a.gas===void 0&&(v.gas=h.estimateGas.bind(h,Z1(a))),q1(v,function(o,w){if(o)return n(o);const y={};w.gasPrice&&(y.gasPrice=w.gasPrice),w.nonce&&(y.nonce=w.nonce.result),w.gas&&(y.gas=w.gas),n(null,jr(a,y))})};function Z1(a){return{from:a.from,to:a.to,value:a.value,data:a.data,gas:a.gas,gasPrice:a.gasPrice,nonce:a.nonce}}function W1(a){return a.toLowerCase()}function Ka(a){const n=Bn.addHexPrefix(a);return Bn.isValidAddress(n)}function D0(a){const n=Bn.addHexPrefix(a);return!Bn.isValidAddress(n)&&Oo(a)}function Oo(a){return!(typeof a=="string")||!(a.slice(0,2)==="0x")?!1:a.slice(2).match(H1)}function Gr(a){return function(n,h){h(new Error('ProviderEngine - HookedWalletSubprovider - Must provide "'+a+'" fn in constructor options'))}}const V1={v:5e3,d:"Gas limit of the Genesis block."},G1={v:17179869184,d:"Difficulty of the Genesis block."},J1={v:"0x0000000000000042",d:"the geneis nonce"},j1={v:"0x11bbe8db4e347b4e8c937c1c8370e4b5ed33adb3db69cbdb7a38e1e50b1b82fa",d:"extra data "},Y1={v:"0xd4e56740f876aef8c010b86a40d5f56745a118d0906a34e69aec8c0db1cb8fa3",d:"genesis hash"},X1={v:"0xd7f8974fb5ac78d9ac099b9ad5018bedc2ce0a72dad1827a1709da30580f0544",d:"the genesis state root"},Q1={v:5e3,d:"Minimum the gas limit may ever be."},tg={v:1024,d:"The bound divisor of the gas limit, used in update calculations."},eg={v:131072,d:"The minimum that the difficulty may ever be."},rg={v:2048,d:"The bound divisor of the difficulty, used in the update calculations."},ig={v:13,d:"The decision boundary on the blocktime duration used to determine whether difficulty should go up or not."},ng={v:32,d:"Maximum size extra data may be after Genesis."},ag={v:3e4,d:"Duration between proof-of-work epochs."},fg={v:1024,d:"Maximum size of VM stack allowed."},og={v:1024,d:"Maximum depth of call/create stack."},sg={v:[0,2,3,5,8,10,20],d:"Once per operation, for a selection of them."},hg={v:10,d:"Once per EXP instuction."},ug={v:10,d:"Times ceil(log256(exponent)) for the EXP instruction."},lg={v:30,d:"Once per SHA3 operation."},cg={v:6,d:"Once per word of the SHA3 operation's data."},dg={v:50,d:"Once per SLOAD operation."},vg={v:2e4,d:"Once per SSTORE operation if the zeroness changes from zero."},pg={v:5e3,d:"Once per SSTORE operation if the zeroness does not change from zero."},mg={v:15e3,d:"Once per SSTORE operation if the zeroness changes to zero."},gg={v:1,d:"Refunded gas, once per SSTORE operation if the zeroness changes to zero."},yg={v:375,d:"Per LOG* operation."},wg={v:8,d:"Per byte in a LOG* operation's data."},bg={v:375,d:"Multiplied by the * of the LOG*, per LOG transaction. e.g. LOG0 incurs 0 * c_txLogTopicGas, LOG4 incurs 4 * c_txLogTopicGas."},Mg={v:32e3,d:"Once per CREATE operation & contract-creation transaction."},xg={v:40,d:"Once per CALL operation & message call transaction."},_g={v:2300,d:"Free gas given at beginning of call."},Sg={v:9e3,d:"Paid for CALL when the value transfor is non-zero."},Ag={v:25e3,d:"Paid for CALL when the destination address didn't exist prior."},Eg={v:24e3,d:"Refunded following a suicide operation."},kg={v:3,d:"Times the address of the (highest referenced byte in memory + 1). NOTE: referencing happens on read, write and in instructions such as RETURN and CALL."},Rg={v:512,d:"Divisor for the quadratic particle of the memory cost equation."},Bg={v:200,d:""},Ig={v:21e3,d:"Per transaction. NOTE: Not payable on data of calls between transactions."},Tg={v:32e3,d:"the cost of creating a contract via tx"},Cg={v:4,d:"Per byte of data attached to a transaction that equals zero. NOTE: Not payable on data of calls between transactions."},Lg={v:68,d:"Per byte of data attached to a transaction that is not equal to zero. NOTE: Not payable on data of calls between transactions."},Pg={v:3,d:"Multiplied by the number of 32-byte words that are copied (round up) for any *COPY operation and added."},Og={v:3e3,d:""},Ng={v:60,d:""},qg={v:12,d:""},Ug={v:600,d:""},Fg={v:120,d:""},$g={v:15,d:""},zg={v:3,d:""},Dg={v:"5000000000000000000",d:"the amount a miner get rewarded for mining a block"},Hg={v:"625000000000000000",d:"The amount of wei a miner of an uncle block gets for being inculded in the blockchain"},Kg={v:"156250000000000000",d:"the amount a miner gets for inculding a uncle"},Zg={v:115e4,d:"the block that the Homestead fork started at"},Wg={v:2463e3,d:"the block that the Homestead Reprice (EIP150) fork started at"},Vg={v:1e5,d:"Exponential difficulty timebomb period"},Gg={v:2},Jg={genesisGasLimit:V1,genesisDifficulty:G1,genesisNonce:J1,genesisExtraData:j1,genesisHash:Y1,genesisStateRoot:X1,minGasLimit:Q1,gasLimitBoundDivisor:tg,minimumDifficulty:eg,difficultyBoundDivisor:rg,durationLimit:ig,maximumExtraDataSize:ng,epochDuration:ag,stackLimit:fg,callCreateDepth:og,tierStepGas:sg,expGas:hg,expByteGas:ug,sha3Gas:lg,sha3WordGas:cg,sloadGas:dg,sstoreSetGas:vg,sstoreResetGas:pg,sstoreRefundGas:mg,jumpdestGas:gg,logGas:yg,logDataGas:wg,logTopicGas:bg,createGas:Mg,callGas:xg,callStipend:_g,callValueTransferGas:Sg,callNewAccountGas:Ag,suicideRefundGas:Eg,memoryGas:kg,quadCoeffDiv:Rg,createDataGas:Bg,txGas:Ig,txCreation:Tg,txDataZeroGas:Cg,txDataNonZeroGas:Lg,copyGas:Pg,ecrecoverGas:Og,sha256Gas:Ng,sha256WordGas:qg,ripemd160Gas:Ug,ripemd160WordGas:Fg,identityGas:$g,identityWordGas:zg,minerReward:Dg,ommerReward:Hg,niblingReward:Kg,homeSteadForkNumber:Zg,homesteadRepriceForkNumber:Wg,timebombPeriod:Vg,freeBlockPeriod:Gg};function jg(a,n){if(!(a instanceof n))throw new TypeError("Cannot call a class as a function")}var mr=Vi,dn=Jg,Cr=mr.BN,Yg=new Cr("7fffffffffffffffffffffffffffffff5d576e7357a4501ddfe92f46681b20a0",16),Xg=function(){function a(n){jg(this,a),n=n||{};var h=[{name:"nonce",length:32,allowLess:!0,default:new X([])},{name:"gasPrice",length:32,allowLess:!0,default:new X([])},{name:"gasLimit",alias:"gas",length:32,allowLess:!0,default:new X([])},{name:"to",allowZero:!0,length:20,default:new X([])},{name:"value",length:32,allowLess:!0,default:new X([])},{name:"data",alias:"input",allowZero:!0,default:new X([])},{name:"v",allowZero:!0,default:new X([28])},{name:"r",length:32,allowZero:!0,allowLess:!0,default:new X([])},{name:"s",length:32,allowZero:!0,allowLess:!0,default:new X([])}];mr.defineProperties(this,h,n),Object.defineProperty(this,"from",{enumerable:!0,configurable:!0,get:this.getSenderAddress.bind(this)});var u=mr.bufferToInt(this.v),v=Math.floor((u-35)/2);v<0&&(v=0),this._chainId=v||n.chainId||0,this._homestead=!0}return a.prototype.toCreationAddress=function(){return this.to.toString("hex")===""},a.prototype.hash=function(h){h===void 0&&(h=!0);var u=void 0;if(h)u=this.raw;else if(this._chainId>0){var v=this.raw.slice();this.v=this._chainId,this.r=0,this.s=0,u=this.raw,this.raw=v}else u=this.raw.slice(0,6);return mr.rlphash(u)},a.prototype.getChainId=function(){return this._chainId},a.prototype.getSenderAddress=function(){if(this._from)return this._from;var h=this.getSenderPublicKey();return this._from=mr.publicToAddress(h),this._from},a.prototype.getSenderPublicKey=function(){if((!this._senderPubKey||!this._senderPubKey.length)&&!this.verifySignature())throw new Error("Invalid Signature");return this._senderPubKey},a.prototype.verifySignature=function(){var h=this.hash(!1);if(this._homestead&&new Cr(this.s).cmp(Yg)===1)return!1;try{var u=mr.bufferToInt(this.v);this._chainId>0&&(u-=this._chainId*2+8),this._senderPubKey=mr.ecrecover(h,u,this.r,this.s)}catch{return!1}return!!this._senderPubKey},a.prototype.sign=function(h){var u=this.hash(!1),v=mr.ecsign(u,h);this._chainId>0&&(v.v+=this._chainId*2+8),Object.assign(this,v)},a.prototype.getDataFee=function(){for(var h=this.raw[5],u=new Cr(0),v=0;v<h.length;v++)h[v]===0?u.iaddn(dn.txDataZeroGas.v):u.iaddn(dn.txDataNonZeroGas.v);return u},a.prototype.getBaseFee=function(){var h=this.getDataFee().iaddn(dn.txGas.v);return this._homestead&&this.toCreationAddress()&&h.iaddn(dn.txCreation.v),h},a.prototype.getUpfrontCost=function(){return new Cr(this.gasLimit).imul(new Cr(this.gasPrice)).iadd(new Cr(this.value))},a.prototype.validate=function(h){var u=[];return this.verifySignature()||u.push("Invalid Signature"),this.getBaseFee().cmp(new Cr(this.gasLimit))>0&&u.push(["gas limit is too low. Need at least "+this.getBaseFee()]),h===void 0||h===!1?u.length===0:u.join(" ")},a}(),Qg=Xg;const ty=zr.inherits,ey=Qg,vn=Vi,ry=ra,iy=vp.blockTagForPayload;var ny=No;ty(No,ry);function No(a){const n=this;n.nonceCache={}}No.prototype.handleRequest=function(a,n,h){const u=this;switch(a.method){case"eth_getTransactionCount":var v=iy(a),o=a.params[0].toLowerCase(),w=u.nonceCache[o];v==="pending"?w?h(null,w):n(function(y,b,B){if(y)return B();u.nonceCache[o]===void 0&&(u.nonceCache[o]=b),B()}):n();return;case"eth_sendRawTransaction":n(function(y,b,B){if(y)return B();var k=a.params[0];vn.stripHexPrefix(k),X.from(vn.stripHexPrefix(k),"hex");var L=new ey(X.from(vn.stripHexPrefix(k),"hex")),q="0x"+L.getSenderAddress().toString("hex").toLowerCase(),$=vn.bufferToInt(L.nonce);$++;var M=$.toString(16);M.length%2&&(M="0"+M),M="0x"+M,u.nonceCache[q]=M,B()});return;case"evm_revert":u.nonceCache={},n();return;default:n();return}};const ay=Ps.default,fy=Rh,{createAsyncMiddleware:H0}=Os,oy=Th,{unsafeRandomBytes:sy,incrementHexInt:hy}=Qi,uy=So;var ly=cy;function cy({blockTracker:a,provider:n}){const h={},u=oy({blockTracker:a,provider:n});let v=!1;const o=new ay,w=fy({eth_subscribe:H0(y),eth_unsubscribe:H0(b)});return w.destroy=k,{events:o,middleware:w};async function y(L,q){if(v)throw new Error("SubscriptionManager - attempting to use after destroying");const $=L.params[0],M=sy(16);let N;switch($){case"newHeads":N=x({subId:M});break;case"logs":const S=L.params[1],T=await u.newLogFilter(S);N=A({subId:M,filter:T});break;default:throw new Error(`SubscriptionManager - unsupported subscription type "${$}"`)}h[M]=N,q.result=M;return;function x({subId:S}){const T={type:$,destroy:async()=>{a.removeListener("sync",T.update)},update:async({oldBlock:O,newBlock:W})=>{const K=W,pt=hy(O);(await uy({provider:n,fromBlock:pt,toBlock:K})).map(dy).forEach(g=>{B(S,g)})}};return a.on("sync",T.update),T}function A({subId:S,filter:T}){return T.on("update",W=>B(S,W)),{type:$,destroy:async()=>await u.uninstallFilter(T.idHex)}}}async function b(L,q){if(v)throw new Error("SubscriptionManager - attempting to use after destroying");const $=L.params[0],M=h[$];if(!M){q.result=!1;return}delete h[$],await M.destroy(),q.result=!0}function B(L,q){o.emit("notification",{jsonrpc:"2.0",method:"eth_subscription",params:{subscription:L,result:q}})}function k(){o.removeAllListeners();for(const L in h)h[L].destroy(),delete h[L];v=!0}}function dy(a){return{hash:a.hash,parentHash:a.parentHash,sha3Uncles:a.sha3Uncles,miner:a.miner,stateRoot:a.stateRoot,transactionsRoot:a.transactionsRoot,receiptsRoot:a.receiptsRoot,logsBloom:a.logsBloom,difficulty:a.difficulty,number:a.number,gasLimit:a.gasLimit,gasUsed:a.gasUsed,nonce:a.nonce,mixHash:a.mixHash,timestamp:a.timestamp,extraData:a.extraData}}const vy=wo,py=ly;let my=class extends vy{constructor(){super(({blockTracker:n,provider:h,engine:u})=>{const{events:v,middleware:o}=py({blockTracker:n,provider:h});return v.on("notification",w=>u.emit("data",null,w)),o})}};var gy=my,qo={},we={};Object.defineProperty(we,"__esModule",{value:!0});var Vh=we.getLocalStorage=nu=we.getLocalStorageOrThrow=iu=we.getCrypto=ru=we.getCryptoOrThrow=eu=we.getLocation=tu=we.getLocationOrThrow=Qh=we.getNavigator=Xh=we.getNavigatorOrThrow=Yh=we.getDocument=jh=we.getDocumentOrThrow=Jh=we.getFromWindowOrThrow=Gh=we.getFromWindow=void 0;function Zr(a){let n;return typeof window<"u"&&typeof window[a]<"u"&&(n=window[a]),n}var Gh=we.getFromWindow=Zr;function _i(a){const n=Zr(a);if(!n)throw new Error(`${a} is not defined in Window`);return n}var Jh=we.getFromWindowOrThrow=_i;function yy(){return _i("document")}var jh=we.getDocumentOrThrow=yy;function wy(){return Zr("document")}var Yh=we.getDocument=wy;function by(){return _i("navigator")}var Xh=we.getNavigatorOrThrow=by;function My(){return Zr("navigator")}var Qh=we.getNavigator=My;function xy(){return _i("location")}var tu=we.getLocationOrThrow=xy;function _y(){return Zr("location")}var eu=we.getLocation=_y;function Sy(){return _i("crypto")}var ru=we.getCryptoOrThrow=Sy;function Ay(){return Zr("crypto")}var iu=we.getCrypto=Ay;function Ey(){return _i("localStorage")}var nu=we.getLocalStorageOrThrow=Ey;function ky(){return Zr("localStorage")}Vh=we.getLocalStorage=ky;Object.defineProperty(qo,"__esModule",{value:!0});var au=qo.getWindowMetadata=void 0;const K0=we;function Ry(){let a,n;try{a=K0.getDocumentOrThrow(),n=K0.getLocationOrThrow()}catch{return null}function h(){const L=a.getElementsByTagName("link"),q=[];for(let $=0;$<L.length;$++){const M=L[$],N=M.getAttribute("rel");if(N&&N.toLowerCase().indexOf("icon")>-1){const x=M.getAttribute("href");if(x)if(x.toLowerCase().indexOf("https:")===-1&&x.toLowerCase().indexOf("http:")===-1&&x.indexOf("//")!==0){let A=n.protocol+"//"+n.host;if(x.indexOf("/")===0)A+=x;else{const S=n.pathname.split("/");S.pop();const T=S.join("/");A+=T+"/"+x}q.push(A)}else if(x.indexOf("//")===0){const A=n.protocol+x;q.push(A)}else q.push(x)}}return q}function u(...L){const q=a.getElementsByTagName("meta");for(let $=0;$<q.length;$++){const M=q[$],N=["itemprop","property","name"].map(x=>M.getAttribute(x)).filter(x=>x?L.includes(x):!1);if(N.length&&N){const x=M.getAttribute("content");if(x)return x}}return""}function v(){let L=u("name","og:site_name","og:title","twitter:title");return L||(L=a.title),L}function o(){return u("description","og:description","twitter:description","keywords")}const w=v(),y=o(),b=n.origin,B=h();return{description:y,url:b,icons:B,name:w}}au=qo.getWindowMetadata=Ry;var By=globalThis&&globalThis.__spreadArrays||function(){for(var a=0,n=0,h=arguments.length;n<h;n++)a+=arguments[n].length;for(var u=Array(a),v=0,n=0;n<h;n++)for(var o=arguments[n],w=0,y=o.length;w<y;w++,v++)u[v]=o[w];return u},Iy=function(){function a(n,h,u){this.name=n,this.version=h,this.os=u,this.type="browser"}return a}(),Ty=function(){function a(n){this.version=n,this.type="node",this.name="node",this.os=Me.platform}return a}(),Cy=function(){function a(n,h,u,v){this.name=n,this.version=h,this.os=u,this.bot=v,this.type="bot-device"}return a}(),Ly=function(){function a(){this.type="bot",this.bot=!0,this.name="bot",this.version=null,this.os=null}return a}(),Py=function(){function a(){this.type="react-native",this.name="react-native",this.version=null,this.os=null}return a}(),Oy=/alexa|bot|crawl(er|ing)|facebookexternalhit|feedburner|google web preview|nagios|postrank|pingdom|slurp|spider|yahoo!|yandex/,Ny=/(nuhk|Googlebot|Yammybot|Openbot|Slurp|MSNBot|Ask\ Jeeves\/Teoma|ia_archiver)/,Z0=3,qy=[["aol",/AOLShield\/([0-9\._]+)/],["edge",/Edge\/([0-9\._]+)/],["edge-ios",/EdgiOS\/([0-9\._]+)/],["yandexbrowser",/YaBrowser\/([0-9\._]+)/],["kakaotalk",/KAKAOTALK\s([0-9\.]+)/],["samsung",/SamsungBrowser\/([0-9\.]+)/],["silk",/\bSilk\/([0-9._-]+)\b/],["miui",/MiuiBrowser\/([0-9\.]+)$/],["beaker",/BeakerBrowser\/([0-9\.]+)/],["edge-chromium",/EdgA?\/([0-9\.]+)/],["chromium-webview",/(?!Chrom.*OPR)wv\).*Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["chrome",/(?!Chrom.*OPR)Chrom(?:e|ium)\/([0-9\.]+)(:?\s|$)/],["phantomjs",/PhantomJS\/([0-9\.]+)(:?\s|$)/],["crios",/CriOS\/([0-9\.]+)(:?\s|$)/],["firefox",/Firefox\/([0-9\.]+)(?:\s|$)/],["fxios",/FxiOS\/([0-9\.]+)/],["opera-mini",/Opera Mini.*Version\/([0-9\.]+)/],["opera",/Opera\/([0-9\.]+)(?:\s|$)/],["opera",/OPR\/([0-9\.]+)(:?\s|$)/],["ie",/Trident\/7\.0.*rv\:([0-9\.]+).*\).*Gecko$/],["ie",/MSIE\s([0-9\.]+);.*Trident\/[4-7].0/],["ie",/MSIE\s(7\.0)/],["bb10",/BB10;\sTouch.*Version\/([0-9\.]+)/],["android",/Android\s([0-9\.]+)/],["ios",/Version\/([0-9\._]+).*Mobile.*Safari.*/],["safari",/Version\/([0-9\._]+).*Safari/],["facebook",/FBAV\/([0-9\.]+)/],["instagram",/Instagram\s([0-9\.]+)/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Mobile/],["ios-webview",/AppleWebKit\/([0-9\.]+).*Gecko\)$/],["searchbot",Oy]],W0=[["iOS",/iP(hone|od|ad)/],["Android OS",/Android/],["BlackBerry OS",/BlackBerry|BB10/],["Windows Mobile",/IEMobile/],["Amazon OS",/Kindle/],["Windows 3.11",/Win16/],["Windows 95",/(Windows 95)|(Win95)|(Windows_95)/],["Windows 98",/(Windows 98)|(Win98)/],["Windows 2000",/(Windows NT 5.0)|(Windows 2000)/],["Windows XP",/(Windows NT 5.1)|(Windows XP)/],["Windows Server 2003",/(Windows NT 5.2)/],["Windows Vista",/(Windows NT 6.0)/],["Windows 7",/(Windows NT 6.1)/],["Windows 8",/(Windows NT 6.2)/],["Windows 8.1",/(Windows NT 6.3)/],["Windows 10",/(Windows NT 10.0)/],["Windows ME",/Windows ME/],["Open BSD",/OpenBSD/],["Sun OS",/SunOS/],["Chrome OS",/CrOS/],["Linux",/(Linux)|(X11)/],["Mac OS",/(Mac_PowerPC)|(Macintosh)/],["QNX",/QNX/],["BeOS",/BeOS/],["OS/2",/OS\/2/]];function Uy(a){return a?V0(a):typeof document>"u"&&typeof navigator<"u"&&navigator.product==="ReactNative"?new Py:typeof navigator<"u"?V0(navigator.userAgent):zy()}function Fy(a){return a!==""&&qy.reduce(function(n,h){var u=h[0],v=h[1];if(n)return n;var o=v.exec(a);return!!o&&[u,o]},!1)}function V0(a){var n=Fy(a);if(!n)return null;var h=n[0],u=n[1];if(h==="searchbot")return new Ly;var v=u[1]&&u[1].split(/[._]/).slice(0,3);v?v.length<Z0&&(v=By(v,Dy(Z0-v.length))):v=[];var o=v.join("."),w=$y(a),y=Ny.exec(a);return y&&y[1]?new Cy(h,o,w,y[1]):new Iy(h,o,w)}function $y(a){for(var n=0,h=W0.length;n<h;n++){var u=W0[n],v=u[0],o=u[1],w=o.exec(a);if(w)return v}return null}function zy(){var a=typeof Me<"u"&&Me.version;return a?new Ty(Me.version.slice(1)):null}function Dy(a){for(var n=[],h=0;h<a;h++)n.push("0");return n}function pa(a){return Uy(a)}function ma(){const a=pa();return a&&a.os?a.os:void 0}function fu(){const a=ma();return a?a.toLowerCase().includes("android"):!1}function ou(){const a=ma();return a?a.toLowerCase().includes("ios")||a.toLowerCase().includes("mac")&&navigator.maxTouchPoints>1:!1}function su(){return ma()?fu()||ou():!1}function hu(){const a=pa();return a&&a.name?a.name.toLowerCase()==="node":!1}function uu(){return!hu()&&!!cu()}const lu=Gh,Hy=Jh,Ky=jh,Zy=Yh,Wy=Xh,cu=Qh,Vy=tu,du=eu,Gy=ru,Jy=iu,jy=nu,ga=Vh;function Lf(){return au()}function Yy(a){if(typeof a!="string")throw new Error(`Cannot safe json parse value of type ${typeof a}`);try{return JSON.parse(a)}catch{return a}}function Xy(a){return typeof a=="string"?a:JSON.stringify(a)}const vu=Yy,pu=Xy;function Uo(a,n){const h=pu(n),u=ga();u&&u.setItem(a,h)}function Fo(a){let n=null,h=null;const u=ga();return u&&(h=u.getItem(a)),n=h&&vu(h),n}function $o(a){const n=ga();n&&n.removeItem(a)}const In="WALLETCONNECT_DEEPLINK_CHOICE";function Qy(a,n){const h=encodeURIComponent(a);return n.universalLink?`${n.universalLink}/wc?uri=${h}`:n.deepLink?`${n.deepLink}${n.deepLink.endsWith(":")?"//":"/"}wc?uri=${h}`:""}function tw(a){const n=a.href.split("?")[0];Uo(In,Object.assign(Object.assign({},a),{href:n}))}function mu(a,n){return a.filter(h=>h.name.toLowerCase().includes(n.toLowerCase()))[0]}function ew(a,n){let h=a;return n&&(h=n.map(u=>mu(a,u)).filter(Boolean)),h}const gu="https://registry.walletconnect.com";function rw(){return gu+"/api/v2/wallets"}function iw(){return gu+"/api/v2/dapps"}function yu(a,n="mobile"){var h;return{name:a.name||"",shortName:a.metadata.shortName||"",color:a.metadata.colors.primary||"",logo:(h=a.image_url.sm)!==null&&h!==void 0?h:"",universalLink:a[n].universal||"",deepLink:a[n].native||""}}function nw(a,n="mobile"){return Object.values(a).filter(h=>!!h[n].universal||!!h[n].native).map(h=>yu(h,n))}const aw=Object.freeze(Object.defineProperty({__proto__:null,detectEnv:pa,detectOS:ma,formatIOSMobile:Qy,formatMobileRegistry:nw,formatMobileRegistryEntry:yu,getClientMeta:Lf,getCrypto:Jy,getCryptoOrThrow:Gy,getDappRegistryUrl:iw,getDocument:Zy,getDocumentOrThrow:Ky,getFromWindow:lu,getFromWindowOrThrow:Hy,getLocal:Fo,getLocalStorage:ga,getLocalStorageOrThrow:jy,getLocation:du,getLocationOrThrow:Vy,getMobileLinkRegistry:ew,getMobileRegistryEntry:mu,getNavigator:cu,getNavigatorOrThrow:Wy,getWalletRegistryUrl:rw,isAndroid:fu,isBrowser:uu,isIOS:ou,isMobile:su,isNode:hu,mobileLinkChoiceKey:In,removeLocal:$o,safeJsonParse:vu,safeJsonStringify:pu,saveMobileLinkInfo:tw,setLocal:Uo},Symbol.toStringTag,{value:"Module"})),fw=["session_request","session_update","exchange_key","connect","disconnect","display_uri","modal_closed","transport_open","transport_close","transport_error"],wu=["eth_sendTransaction","eth_signTransaction","eth_sign","eth_signTypedData","eth_signTypedData_v1","eth_signTypedData_v2","eth_signTypedData_v3","eth_signTypedData_v4","personal_sign","wallet_addEthereumChain","wallet_switchEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode"];var zo={exports:{}};zo.exports;(function(a){(function(n,h){function u(g,e){if(!g)throw new Error(e||"Assertion failed")}function v(g,e){g.super_=e;var t=function(){};t.prototype=e.prototype,g.prototype=new t,g.prototype.constructor=g}function o(g,e,t){if(o.isBN(g))return g;this.negative=0,this.words=null,this.length=0,this.red=null,g!==null&&((e==="le"||e==="be")&&(t=e,e=10),this._init(g||0,e||10,t||"be"))}typeof n=="object"?n.exports=o:h.BN=o,o.BN=o,o.wordSize=26;var w;try{w=Se.Buffer}catch{}o.isBN=function(e){return e instanceof o?!0:e!==null&&typeof e=="object"&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,i){if(typeof e=="number")return this._initNumber(e,t,i);if(typeof e=="object")return this._initArray(e,t,i);t==="hex"&&(t=16),u(t===(t|0)&&t>=2&&t<=36),e=e.toString().replace(/\s+/g,"");var s=0;e[0]==="-"&&s++,t===16?this._parseHex(e,s):this._parseBase(e,t,s),e[0]==="-"&&(this.negative=1),this.strip(),i==="le"&&this._initArray(this.toArray(),t,i)},o.prototype._initNumber=function(e,t,i){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[e&67108863],this.length=1):e<4503599627370496?(this.words=[e&67108863,e/67108864&67108863],this.length=2):(u(e<9007199254740992),this.words=[e&67108863,e/67108864&67108863,1],this.length=3),i==="le"&&this._initArray(this.toArray(),t,i)},o.prototype._initArray=function(e,t,i){if(u(typeof e.length=="number"),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var s=0;s<this.length;s++)this.words[s]=0;var l,c,p=0;if(i==="be")for(s=e.length-1,l=0;s>=0;s-=3)c=e[s]|e[s-1]<<8|e[s-2]<<16,this.words[l]|=c<<p&67108863,this.words[l+1]=c>>>26-p&67108863,p+=24,p>=26&&(p-=26,l++);else if(i==="le")for(s=0,l=0;s<e.length;s+=3)c=e[s]|e[s+1]<<8|e[s+2]<<16,this.words[l]|=c<<p&67108863,this.words[l+1]=c>>>26-p&67108863,p+=24,p>=26&&(p-=26,l++);return this.strip()};function y(g,e,t){for(var i=0,s=Math.min(g.length,t),l=e;l<s;l++){var c=g.charCodeAt(l)-48;i<<=4,c>=49&&c<=54?i|=c-49+10:c>=17&&c<=22?i|=c-17+10:i|=c&15}return i}o.prototype._parseHex=function(e,t){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var s,l,c=0;for(i=e.length-6,s=0;i>=t;i-=6)l=y(e,i,i+6),this.words[s]|=l<<c&67108863,this.words[s+1]|=l>>>26-c&4194303,c+=24,c>=26&&(c-=26,s++);i+6!==t&&(l=y(e,t,i+6),this.words[s]|=l<<c&67108863,this.words[s+1]|=l>>>26-c&4194303),this.strip()};function b(g,e,t,i){for(var s=0,l=Math.min(g.length,t),c=e;c<l;c++){var p=g.charCodeAt(c)-48;s*=i,p>=49?s+=p-49+10:p>=17?s+=p-17+10:s+=p}return s}o.prototype._parseBase=function(e,t,i){this.words=[0],this.length=1;for(var s=0,l=1;l<=67108863;l*=t)s++;s--,l=l/t|0;for(var c=e.length-i,p=c%s,d=Math.min(c,c-p)+i,r=0,f=i;f<d;f+=s)r=b(e,f,f+s,t),this.imuln(l),this.words[0]+r<67108864?this.words[0]+=r:this._iaddn(r);if(p!==0){var m=1;for(r=b(e,f,e.length,t),f=0;f<p;f++)m*=t;this.imuln(m),this.words[0]+r<67108864?this.words[0]+=r:this._iaddn(r)}},o.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},o.prototype.clone=function(){var e=new o(null);return this.copy(e),e},o.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},o.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var B=["","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"],k=[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],L=[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];o.prototype.toString=function(e,t){e=e||10,t=t|0||1;var i;if(e===16||e==="hex"){i="";for(var s=0,l=0,c=0;c<this.length;c++){var p=this.words[c],d=((p<<s|l)&16777215).toString(16);l=p>>>24-s&16777215,l!==0||c!==this.length-1?i=B[6-d.length]+d+i:i=d+i,s+=2,s>=26&&(s-=26,c--)}for(l!==0&&(i=l.toString(16)+i);i.length%t!==0;)i="0"+i;return this.negative!==0&&(i="-"+i),i}if(e===(e|0)&&e>=2&&e<=36){var r=k[e],f=L[e];i="";var m=this.clone();for(m.negative=0;!m.isZero();){var _=m.modn(f).toString(e);m=m.idivn(f),m.isZero()?i=_+i:i=B[r-_.length]+_+i}for(this.isZero()&&(i="0"+i);i.length%t!==0;)i="0"+i;return this.negative!==0&&(i="-"+i),i}u(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return this.length===2?e+=this.words[1]*67108864:this.length===3&&this.words[2]===1?e+=4503599627370496+this.words[1]*67108864:this.length>2&&u(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-e:e},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(e,t){return u(typeof w<"u"),this.toArrayLike(w,e,t)},o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},o.prototype.toArrayLike=function(e,t,i){var s=this.byteLength(),l=i||Math.max(1,s);u(s<=l,"byte array longer than desired length"),u(l>0,"Requested array length <= 0"),this.strip();var c=t==="le",p=new e(l),d,r,f=this.clone();if(c){for(r=0;!f.isZero();r++)d=f.andln(255),f.iushrn(8),p[r]=d;for(;r<l;r++)p[r]=0}else{for(r=0;r<l-s;r++)p[r]=0;for(r=0;!f.isZero();r++)d=f.andln(255),f.iushrn(8),p[l-r-1]=d}return p},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,i=0;return t>=4096&&(i+=13,t>>>=13),t>=64&&(i+=7,t>>>=7),t>=8&&(i+=4,t>>>=4),t>=2&&(i+=2,t>>>=2),i+t},o.prototype._zeroBits=function(e){if(e===0)return 26;var t=e,i=0;return t&8191||(i+=13,t>>>=13),t&127||(i+=7,t>>>=7),t&15||(i+=4,t>>>=4),t&3||(i+=2,t>>>=2),t&1||i++,i},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return(this.length-1)*26+t};function q(g){for(var e=new Array(g.bitLength()),t=0;t<e.length;t++){var i=t/26|0,s=t%26;e[t]=(g.words[i]&1<<s)>>>s}return e}o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var i=this._zeroBits(this.words[t]);if(e+=i,i!==26)break}return e},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(e){return this.negative!==0?this.abs().inotn(e).iaddn(1):this.clone()},o.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return this.negative!==0},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this.strip()},o.prototype.ior=function(e){return u((this.negative|e.negative)===0),this.iuor(e)},o.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;this.length>e.length?t=e:t=this;for(var i=0;i<t.length;i++)this.words[i]=this.words[i]&e.words[i];return this.length=t.length,this.strip()},o.prototype.iand=function(e){return u((this.negative|e.negative)===0),this.iuand(e)},o.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,i;this.length>e.length?(t=this,i=e):(t=e,i=this);for(var s=0;s<i.length;s++)this.words[s]=t.words[s]^i.words[s];if(this!==t)for(;s<t.length;s++)this.words[s]=t.words[s];return this.length=t.length,this.strip()},o.prototype.ixor=function(e){return u((this.negative|e.negative)===0),this.iuxor(e)},o.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){u(typeof e=="number"&&e>=0);var t=Math.ceil(e/26)|0,i=e%26;this._expand(t),i>0&&t--;for(var s=0;s<t;s++)this.words[s]=~this.words[s]&67108863;return i>0&&(this.words[s]=~this.words[s]&67108863>>26-i),this.strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){u(typeof e=="number"&&e>=0);var i=e/26|0,s=e%26;return this._expand(i+1),t?this.words[i]=this.words[i]|1<<s:this.words[i]=this.words[i]&~(1<<s),this.strip()},o.prototype.iadd=function(e){var t;if(this.negative!==0&&e.negative===0)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(this.negative===0&&e.negative!==0)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();var i,s;this.length>e.length?(i=this,s=e):(i=e,s=this);for(var l=0,c=0;c<s.length;c++)t=(i.words[c]|0)+(s.words[c]|0)+l,this.words[c]=t&67108863,l=t>>>26;for(;l!==0&&c<i.length;c++)t=(i.words[c]|0)+l,this.words[c]=t&67108863,l=t>>>26;if(this.length=i.length,l!==0)this.words[this.length]=l,this.length++;else if(i!==this)for(;c<i.length;c++)this.words[c]=i.words[c];return this},o.prototype.add=function(e){var t;return e.negative!==0&&this.negative===0?(e.negative=0,t=this.sub(e),e.negative^=1,t):e.negative===0&&this.negative!==0?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(e.negative!==0){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var i=this.cmp(e);if(i===0)return this.negative=0,this.length=1,this.words[0]=0,this;var s,l;i>0?(s=this,l=e):(s=e,l=this);for(var c=0,p=0;p<l.length;p++)t=(s.words[p]|0)-(l.words[p]|0)+c,c=t>>26,this.words[p]=t&67108863;for(;c!==0&&p<s.length;p++)t=(s.words[p]|0)+c,c=t>>26,this.words[p]=t&67108863;if(c===0&&p<s.length&&s!==this)for(;p<s.length;p++)this.words[p]=s.words[p];return this.length=Math.max(this.length,p),s!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(e){return this.clone().isub(e)};function $(g,e,t){t.negative=e.negative^g.negative;var i=g.length+e.length|0;t.length=i,i=i-1|0;var s=g.words[0]|0,l=e.words[0]|0,c=s*l,p=c&67108863,d=c/67108864|0;t.words[0]=p;for(var r=1;r<i;r++){for(var f=d>>>26,m=d&67108863,_=Math.min(r,e.length-1),R=Math.max(0,r-g.length+1);R<=_;R++){var C=r-R|0;s=g.words[C]|0,l=e.words[R]|0,c=s*l+m,f+=c/67108864|0,m=c&67108863}t.words[r]=m|0,d=f|0}return d!==0?t.words[r]=d|0:t.length--,t.strip()}var M=function(e,t,i){var s=e.words,l=t.words,c=i.words,p=0,d,r,f,m=s[0]|0,_=m&8191,R=m>>>13,C=s[1]|0,F=C&8191,z=C>>>13,lt=s[2]|0,G=lt&8191,Z=lt>>>13,mt=s[3]|0,gt=mt&8191,j=mt>>>13,Ct=s[4]|0,wt=Ct&8191,Y=Ct>>>13,U=s[5]|0,I=U&8191,E=U>>>13,P=s[6]|0,H=P&8191,D=P>>>13,ut=s[7]|0,vt=ut&8191,V=ut>>>13,bt=s[8]|0,yt=bt&8191,J=bt>>>13,Lt=s[9]|0,Mt=Lt&8191,Q=Lt>>>13,Ot=l[0]|0,xt=Ot&8191,tt=Ot>>>13,Nt=l[1]|0,_t=Nt&8191,et=Nt>>>13,qt=l[2]|0,St=qt&8191,rt=qt>>>13,Ut=l[3]|0,At=Ut&8191,it=Ut>>>13,Ft=l[4]|0,Et=Ft&8191,nt=Ft>>>13,$t=l[5]|0,kt=$t&8191,at=$t>>>13,zt=l[6]|0,Rt=zt&8191,ft=zt>>>13,Dt=l[7]|0,Bt=Dt&8191,ot=Dt>>>13,Ht=l[8]|0,It=Ht&8191,st=Ht>>>13,Kt=l[9]|0,Tt=Kt&8191,ht=Kt>>>13;i.negative=e.negative^t.negative,i.length=19,d=Math.imul(_,xt),r=Math.imul(_,tt),r=r+Math.imul(R,xt)|0,f=Math.imul(R,tt);var Pt=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,d=Math.imul(F,xt),r=Math.imul(F,tt),r=r+Math.imul(z,xt)|0,f=Math.imul(z,tt),d=d+Math.imul(_,_t)|0,r=r+Math.imul(_,et)|0,r=r+Math.imul(R,_t)|0,f=f+Math.imul(R,et)|0;var Jt=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,d=Math.imul(G,xt),r=Math.imul(G,tt),r=r+Math.imul(Z,xt)|0,f=Math.imul(Z,tt),d=d+Math.imul(F,_t)|0,r=r+Math.imul(F,et)|0,r=r+Math.imul(z,_t)|0,f=f+Math.imul(z,et)|0,d=d+Math.imul(_,St)|0,r=r+Math.imul(_,rt)|0,r=r+Math.imul(R,St)|0,f=f+Math.imul(R,rt)|0;var jt=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(jt>>>26)|0,jt&=67108863,d=Math.imul(gt,xt),r=Math.imul(gt,tt),r=r+Math.imul(j,xt)|0,f=Math.imul(j,tt),d=d+Math.imul(G,_t)|0,r=r+Math.imul(G,et)|0,r=r+Math.imul(Z,_t)|0,f=f+Math.imul(Z,et)|0,d=d+Math.imul(F,St)|0,r=r+Math.imul(F,rt)|0,r=r+Math.imul(z,St)|0,f=f+Math.imul(z,rt)|0,d=d+Math.imul(_,At)|0,r=r+Math.imul(_,it)|0,r=r+Math.imul(R,At)|0,f=f+Math.imul(R,it)|0;var Yt=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,d=Math.imul(wt,xt),r=Math.imul(wt,tt),r=r+Math.imul(Y,xt)|0,f=Math.imul(Y,tt),d=d+Math.imul(gt,_t)|0,r=r+Math.imul(gt,et)|0,r=r+Math.imul(j,_t)|0,f=f+Math.imul(j,et)|0,d=d+Math.imul(G,St)|0,r=r+Math.imul(G,rt)|0,r=r+Math.imul(Z,St)|0,f=f+Math.imul(Z,rt)|0,d=d+Math.imul(F,At)|0,r=r+Math.imul(F,it)|0,r=r+Math.imul(z,At)|0,f=f+Math.imul(z,it)|0,d=d+Math.imul(_,Et)|0,r=r+Math.imul(_,nt)|0,r=r+Math.imul(R,Et)|0,f=f+Math.imul(R,nt)|0;var Xt=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(Xt>>>26)|0,Xt&=67108863,d=Math.imul(I,xt),r=Math.imul(I,tt),r=r+Math.imul(E,xt)|0,f=Math.imul(E,tt),d=d+Math.imul(wt,_t)|0,r=r+Math.imul(wt,et)|0,r=r+Math.imul(Y,_t)|0,f=f+Math.imul(Y,et)|0,d=d+Math.imul(gt,St)|0,r=r+Math.imul(gt,rt)|0,r=r+Math.imul(j,St)|0,f=f+Math.imul(j,rt)|0,d=d+Math.imul(G,At)|0,r=r+Math.imul(G,it)|0,r=r+Math.imul(Z,At)|0,f=f+Math.imul(Z,it)|0,d=d+Math.imul(F,Et)|0,r=r+Math.imul(F,nt)|0,r=r+Math.imul(z,Et)|0,f=f+Math.imul(z,nt)|0,d=d+Math.imul(_,kt)|0,r=r+Math.imul(_,at)|0,r=r+Math.imul(R,kt)|0,f=f+Math.imul(R,at)|0;var Qt=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(Qt>>>26)|0,Qt&=67108863,d=Math.imul(H,xt),r=Math.imul(H,tt),r=r+Math.imul(D,xt)|0,f=Math.imul(D,tt),d=d+Math.imul(I,_t)|0,r=r+Math.imul(I,et)|0,r=r+Math.imul(E,_t)|0,f=f+Math.imul(E,et)|0,d=d+Math.imul(wt,St)|0,r=r+Math.imul(wt,rt)|0,r=r+Math.imul(Y,St)|0,f=f+Math.imul(Y,rt)|0,d=d+Math.imul(gt,At)|0,r=r+Math.imul(gt,it)|0,r=r+Math.imul(j,At)|0,f=f+Math.imul(j,it)|0,d=d+Math.imul(G,Et)|0,r=r+Math.imul(G,nt)|0,r=r+Math.imul(Z,Et)|0,f=f+Math.imul(Z,nt)|0,d=d+Math.imul(F,kt)|0,r=r+Math.imul(F,at)|0,r=r+Math.imul(z,kt)|0,f=f+Math.imul(z,at)|0,d=d+Math.imul(_,Rt)|0,r=r+Math.imul(_,ft)|0,r=r+Math.imul(R,Rt)|0,f=f+Math.imul(R,ft)|0;var te=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(te>>>26)|0,te&=67108863,d=Math.imul(vt,xt),r=Math.imul(vt,tt),r=r+Math.imul(V,xt)|0,f=Math.imul(V,tt),d=d+Math.imul(H,_t)|0,r=r+Math.imul(H,et)|0,r=r+Math.imul(D,_t)|0,f=f+Math.imul(D,et)|0,d=d+Math.imul(I,St)|0,r=r+Math.imul(I,rt)|0,r=r+Math.imul(E,St)|0,f=f+Math.imul(E,rt)|0,d=d+Math.imul(wt,At)|0,r=r+Math.imul(wt,it)|0,r=r+Math.imul(Y,At)|0,f=f+Math.imul(Y,it)|0,d=d+Math.imul(gt,Et)|0,r=r+Math.imul(gt,nt)|0,r=r+Math.imul(j,Et)|0,f=f+Math.imul(j,nt)|0,d=d+Math.imul(G,kt)|0,r=r+Math.imul(G,at)|0,r=r+Math.imul(Z,kt)|0,f=f+Math.imul(Z,at)|0,d=d+Math.imul(F,Rt)|0,r=r+Math.imul(F,ft)|0,r=r+Math.imul(z,Rt)|0,f=f+Math.imul(z,ft)|0,d=d+Math.imul(_,Bt)|0,r=r+Math.imul(_,ot)|0,r=r+Math.imul(R,Bt)|0,f=f+Math.imul(R,ot)|0;var ee=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(ee>>>26)|0,ee&=67108863,d=Math.imul(yt,xt),r=Math.imul(yt,tt),r=r+Math.imul(J,xt)|0,f=Math.imul(J,tt),d=d+Math.imul(vt,_t)|0,r=r+Math.imul(vt,et)|0,r=r+Math.imul(V,_t)|0,f=f+Math.imul(V,et)|0,d=d+Math.imul(H,St)|0,r=r+Math.imul(H,rt)|0,r=r+Math.imul(D,St)|0,f=f+Math.imul(D,rt)|0,d=d+Math.imul(I,At)|0,r=r+Math.imul(I,it)|0,r=r+Math.imul(E,At)|0,f=f+Math.imul(E,it)|0,d=d+Math.imul(wt,Et)|0,r=r+Math.imul(wt,nt)|0,r=r+Math.imul(Y,Et)|0,f=f+Math.imul(Y,nt)|0,d=d+Math.imul(gt,kt)|0,r=r+Math.imul(gt,at)|0,r=r+Math.imul(j,kt)|0,f=f+Math.imul(j,at)|0,d=d+Math.imul(G,Rt)|0,r=r+Math.imul(G,ft)|0,r=r+Math.imul(Z,Rt)|0,f=f+Math.imul(Z,ft)|0,d=d+Math.imul(F,Bt)|0,r=r+Math.imul(F,ot)|0,r=r+Math.imul(z,Bt)|0,f=f+Math.imul(z,ot)|0,d=d+Math.imul(_,It)|0,r=r+Math.imul(_,st)|0,r=r+Math.imul(R,It)|0,f=f+Math.imul(R,st)|0;var re=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(re>>>26)|0,re&=67108863,d=Math.imul(Mt,xt),r=Math.imul(Mt,tt),r=r+Math.imul(Q,xt)|0,f=Math.imul(Q,tt),d=d+Math.imul(yt,_t)|0,r=r+Math.imul(yt,et)|0,r=r+Math.imul(J,_t)|0,f=f+Math.imul(J,et)|0,d=d+Math.imul(vt,St)|0,r=r+Math.imul(vt,rt)|0,r=r+Math.imul(V,St)|0,f=f+Math.imul(V,rt)|0,d=d+Math.imul(H,At)|0,r=r+Math.imul(H,it)|0,r=r+Math.imul(D,At)|0,f=f+Math.imul(D,it)|0,d=d+Math.imul(I,Et)|0,r=r+Math.imul(I,nt)|0,r=r+Math.imul(E,Et)|0,f=f+Math.imul(E,nt)|0,d=d+Math.imul(wt,kt)|0,r=r+Math.imul(wt,at)|0,r=r+Math.imul(Y,kt)|0,f=f+Math.imul(Y,at)|0,d=d+Math.imul(gt,Rt)|0,r=r+Math.imul(gt,ft)|0,r=r+Math.imul(j,Rt)|0,f=f+Math.imul(j,ft)|0,d=d+Math.imul(G,Bt)|0,r=r+Math.imul(G,ot)|0,r=r+Math.imul(Z,Bt)|0,f=f+Math.imul(Z,ot)|0,d=d+Math.imul(F,It)|0,r=r+Math.imul(F,st)|0,r=r+Math.imul(z,It)|0,f=f+Math.imul(z,st)|0,d=d+Math.imul(_,Tt)|0,r=r+Math.imul(_,ht)|0,r=r+Math.imul(R,Tt)|0,f=f+Math.imul(R,ht)|0;var ie=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(ie>>>26)|0,ie&=67108863,d=Math.imul(Mt,_t),r=Math.imul(Mt,et),r=r+Math.imul(Q,_t)|0,f=Math.imul(Q,et),d=d+Math.imul(yt,St)|0,r=r+Math.imul(yt,rt)|0,r=r+Math.imul(J,St)|0,f=f+Math.imul(J,rt)|0,d=d+Math.imul(vt,At)|0,r=r+Math.imul(vt,it)|0,r=r+Math.imul(V,At)|0,f=f+Math.imul(V,it)|0,d=d+Math.imul(H,Et)|0,r=r+Math.imul(H,nt)|0,r=r+Math.imul(D,Et)|0,f=f+Math.imul(D,nt)|0,d=d+Math.imul(I,kt)|0,r=r+Math.imul(I,at)|0,r=r+Math.imul(E,kt)|0,f=f+Math.imul(E,at)|0,d=d+Math.imul(wt,Rt)|0,r=r+Math.imul(wt,ft)|0,r=r+Math.imul(Y,Rt)|0,f=f+Math.imul(Y,ft)|0,d=d+Math.imul(gt,Bt)|0,r=r+Math.imul(gt,ot)|0,r=r+Math.imul(j,Bt)|0,f=f+Math.imul(j,ot)|0,d=d+Math.imul(G,It)|0,r=r+Math.imul(G,st)|0,r=r+Math.imul(Z,It)|0,f=f+Math.imul(Z,st)|0,d=d+Math.imul(F,Tt)|0,r=r+Math.imul(F,ht)|0,r=r+Math.imul(z,Tt)|0,f=f+Math.imul(z,ht)|0;var ne=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(ne>>>26)|0,ne&=67108863,d=Math.imul(Mt,St),r=Math.imul(Mt,rt),r=r+Math.imul(Q,St)|0,f=Math.imul(Q,rt),d=d+Math.imul(yt,At)|0,r=r+Math.imul(yt,it)|0,r=r+Math.imul(J,At)|0,f=f+Math.imul(J,it)|0,d=d+Math.imul(vt,Et)|0,r=r+Math.imul(vt,nt)|0,r=r+Math.imul(V,Et)|0,f=f+Math.imul(V,nt)|0,d=d+Math.imul(H,kt)|0,r=r+Math.imul(H,at)|0,r=r+Math.imul(D,kt)|0,f=f+Math.imul(D,at)|0,d=d+Math.imul(I,Rt)|0,r=r+Math.imul(I,ft)|0,r=r+Math.imul(E,Rt)|0,f=f+Math.imul(E,ft)|0,d=d+Math.imul(wt,Bt)|0,r=r+Math.imul(wt,ot)|0,r=r+Math.imul(Y,Bt)|0,f=f+Math.imul(Y,ot)|0,d=d+Math.imul(gt,It)|0,r=r+Math.imul(gt,st)|0,r=r+Math.imul(j,It)|0,f=f+Math.imul(j,st)|0,d=d+Math.imul(G,Tt)|0,r=r+Math.imul(G,ht)|0,r=r+Math.imul(Z,Tt)|0,f=f+Math.imul(Z,ht)|0;var ae=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(ae>>>26)|0,ae&=67108863,d=Math.imul(Mt,At),r=Math.imul(Mt,it),r=r+Math.imul(Q,At)|0,f=Math.imul(Q,it),d=d+Math.imul(yt,Et)|0,r=r+Math.imul(yt,nt)|0,r=r+Math.imul(J,Et)|0,f=f+Math.imul(J,nt)|0,d=d+Math.imul(vt,kt)|0,r=r+Math.imul(vt,at)|0,r=r+Math.imul(V,kt)|0,f=f+Math.imul(V,at)|0,d=d+Math.imul(H,Rt)|0,r=r+Math.imul(H,ft)|0,r=r+Math.imul(D,Rt)|0,f=f+Math.imul(D,ft)|0,d=d+Math.imul(I,Bt)|0,r=r+Math.imul(I,ot)|0,r=r+Math.imul(E,Bt)|0,f=f+Math.imul(E,ot)|0,d=d+Math.imul(wt,It)|0,r=r+Math.imul(wt,st)|0,r=r+Math.imul(Y,It)|0,f=f+Math.imul(Y,st)|0,d=d+Math.imul(gt,Tt)|0,r=r+Math.imul(gt,ht)|0,r=r+Math.imul(j,Tt)|0,f=f+Math.imul(j,ht)|0;var fe=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(fe>>>26)|0,fe&=67108863,d=Math.imul(Mt,Et),r=Math.imul(Mt,nt),r=r+Math.imul(Q,Et)|0,f=Math.imul(Q,nt),d=d+Math.imul(yt,kt)|0,r=r+Math.imul(yt,at)|0,r=r+Math.imul(J,kt)|0,f=f+Math.imul(J,at)|0,d=d+Math.imul(vt,Rt)|0,r=r+Math.imul(vt,ft)|0,r=r+Math.imul(V,Rt)|0,f=f+Math.imul(V,ft)|0,d=d+Math.imul(H,Bt)|0,r=r+Math.imul(H,ot)|0,r=r+Math.imul(D,Bt)|0,f=f+Math.imul(D,ot)|0,d=d+Math.imul(I,It)|0,r=r+Math.imul(I,st)|0,r=r+Math.imul(E,It)|0,f=f+Math.imul(E,st)|0,d=d+Math.imul(wt,Tt)|0,r=r+Math.imul(wt,ht)|0,r=r+Math.imul(Y,Tt)|0,f=f+Math.imul(Y,ht)|0;var oe=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(oe>>>26)|0,oe&=67108863,d=Math.imul(Mt,kt),r=Math.imul(Mt,at),r=r+Math.imul(Q,kt)|0,f=Math.imul(Q,at),d=d+Math.imul(yt,Rt)|0,r=r+Math.imul(yt,ft)|0,r=r+Math.imul(J,Rt)|0,f=f+Math.imul(J,ft)|0,d=d+Math.imul(vt,Bt)|0,r=r+Math.imul(vt,ot)|0,r=r+Math.imul(V,Bt)|0,f=f+Math.imul(V,ot)|0,d=d+Math.imul(H,It)|0,r=r+Math.imul(H,st)|0,r=r+Math.imul(D,It)|0,f=f+Math.imul(D,st)|0,d=d+Math.imul(I,Tt)|0,r=r+Math.imul(I,ht)|0,r=r+Math.imul(E,Tt)|0,f=f+Math.imul(E,ht)|0;var se=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(se>>>26)|0,se&=67108863,d=Math.imul(Mt,Rt),r=Math.imul(Mt,ft),r=r+Math.imul(Q,Rt)|0,f=Math.imul(Q,ft),d=d+Math.imul(yt,Bt)|0,r=r+Math.imul(yt,ot)|0,r=r+Math.imul(J,Bt)|0,f=f+Math.imul(J,ot)|0,d=d+Math.imul(vt,It)|0,r=r+Math.imul(vt,st)|0,r=r+Math.imul(V,It)|0,f=f+Math.imul(V,st)|0,d=d+Math.imul(H,Tt)|0,r=r+Math.imul(H,ht)|0,r=r+Math.imul(D,Tt)|0,f=f+Math.imul(D,ht)|0;var he=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(he>>>26)|0,he&=67108863,d=Math.imul(Mt,Bt),r=Math.imul(Mt,ot),r=r+Math.imul(Q,Bt)|0,f=Math.imul(Q,ot),d=d+Math.imul(yt,It)|0,r=r+Math.imul(yt,st)|0,r=r+Math.imul(J,It)|0,f=f+Math.imul(J,st)|0,d=d+Math.imul(vt,Tt)|0,r=r+Math.imul(vt,ht)|0,r=r+Math.imul(V,Tt)|0,f=f+Math.imul(V,ht)|0;var ue=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(ue>>>26)|0,ue&=67108863,d=Math.imul(Mt,It),r=Math.imul(Mt,st),r=r+Math.imul(Q,It)|0,f=Math.imul(Q,st),d=d+Math.imul(yt,Tt)|0,r=r+Math.imul(yt,ht)|0,r=r+Math.imul(J,Tt)|0,f=f+Math.imul(J,ht)|0;var le=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(le>>>26)|0,le&=67108863,d=Math.imul(Mt,Tt),r=Math.imul(Mt,ht),r=r+Math.imul(Q,Tt)|0,f=Math.imul(Q,ht);var ce=(p+d|0)+((r&8191)<<13)|0;return p=(f+(r>>>13)|0)+(ce>>>26)|0,ce&=67108863,c[0]=Pt,c[1]=Jt,c[2]=jt,c[3]=Yt,c[4]=Xt,c[5]=Qt,c[6]=te,c[7]=ee,c[8]=re,c[9]=ie,c[10]=ne,c[11]=ae,c[12]=fe,c[13]=oe,c[14]=se,c[15]=he,c[16]=ue,c[17]=le,c[18]=ce,p!==0&&(c[19]=p,i.length++),i};Math.imul||(M=$);function N(g,e,t){t.negative=e.negative^g.negative,t.length=g.length+e.length;for(var i=0,s=0,l=0;l<t.length-1;l++){var c=s;s=0;for(var p=i&67108863,d=Math.min(l,e.length-1),r=Math.max(0,l-g.length+1);r<=d;r++){var f=l-r,m=g.words[f]|0,_=e.words[r]|0,R=m*_,C=R&67108863;c=c+(R/67108864|0)|0,C=C+p|0,p=C&67108863,c=c+(C>>>26)|0,s+=c>>>26,c&=67108863}t.words[l]=p,i=c,c=s}return i!==0?t.words[l]=i:t.length--,t.strip()}function x(g,e,t){var i=new A;return i.mulp(g,e,t)}o.prototype.mulTo=function(e,t){var i,s=this.length+e.length;return this.length===10&&e.length===10?i=M(this,e,t):s<63?i=$(this,e,t):s<1024?i=N(this,e,t):i=x(this,e,t),i};function A(g,e){this.x=g,this.y=e}A.prototype.makeRBT=function(e){for(var t=new Array(e),i=o.prototype._countBits(e)-1,s=0;s<e;s++)t[s]=this.revBin(s,i,e);return t},A.prototype.revBin=function(e,t,i){if(e===0||e===i-1)return e;for(var s=0,l=0;l<t;l++)s|=(e&1)<<t-l-1,e>>=1;return s},A.prototype.permute=function(e,t,i,s,l,c){for(var p=0;p<c;p++)s[p]=t[e[p]],l[p]=i[e[p]]},A.prototype.transform=function(e,t,i,s,l,c){this.permute(c,e,t,i,s,l);for(var p=1;p<l;p<<=1)for(var d=p<<1,r=Math.cos(2*Math.PI/d),f=Math.sin(2*Math.PI/d),m=0;m<l;m+=d)for(var _=r,R=f,C=0;C<p;C++){var F=i[m+C],z=s[m+C],lt=i[m+C+p],G=s[m+C+p],Z=_*lt-R*G;G=_*G+R*lt,lt=Z,i[m+C]=F+lt,s[m+C]=z+G,i[m+C+p]=F-lt,s[m+C+p]=z-G,C!==d&&(Z=r*_-f*R,R=r*R+f*_,_=Z)}},A.prototype.guessLen13b=function(e,t){var i=Math.max(t,e)|1,s=i&1,l=0;for(i=i/2|0;i;i=i>>>1)l++;return 1<<l+1+s},A.prototype.conjugate=function(e,t,i){if(!(i<=1))for(var s=0;s<i/2;s++){var l=e[s];e[s]=e[i-s-1],e[i-s-1]=l,l=t[s],t[s]=-t[i-s-1],t[i-s-1]=-l}},A.prototype.normalize13b=function(e,t){for(var i=0,s=0;s<t/2;s++){var l=Math.round(e[2*s+1]/t)*8192+Math.round(e[2*s]/t)+i;e[s]=l&67108863,l<67108864?i=0:i=l/67108864|0}return e},A.prototype.convert13b=function(e,t,i,s){for(var l=0,c=0;c<t;c++)l=l+(e[c]|0),i[2*c]=l&8191,l=l>>>13,i[2*c+1]=l&8191,l=l>>>13;for(c=2*t;c<s;++c)i[c]=0;u(l===0),u((l&-8192)===0)},A.prototype.stub=function(e){for(var t=new Array(e),i=0;i<e;i++)t[i]=0;return t},A.prototype.mulp=function(e,t,i){var s=2*this.guessLen13b(e.length,t.length),l=this.makeRBT(s),c=this.stub(s),p=new Array(s),d=new Array(s),r=new Array(s),f=new Array(s),m=new Array(s),_=new Array(s),R=i.words;R.length=s,this.convert13b(e.words,e.length,p,s),this.convert13b(t.words,t.length,f,s),this.transform(p,c,d,r,s,l),this.transform(f,c,m,_,s,l);for(var C=0;C<s;C++){var F=d[C]*m[C]-r[C]*_[C];r[C]=d[C]*_[C]+r[C]*m[C],d[C]=F}return this.conjugate(d,r,s),this.transform(d,r,R,c,s,l),this.conjugate(R,c,s),this.normalize13b(R,s),i.negative=e.negative^t.negative,i.length=e.length+t.length,i.strip()},o.prototype.mul=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},o.prototype.mulf=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),x(this,e,t)},o.prototype.imul=function(e){return this.clone().mulTo(e,this)},o.prototype.imuln=function(e){u(typeof e=="number"),u(e<67108864);for(var t=0,i=0;i<this.length;i++){var s=(this.words[i]|0)*e,l=(s&67108863)+(t&67108863);t>>=26,t+=s/67108864|0,t+=l>>>26,this.words[i]=l&67108863}return t!==0&&(this.words[i]=t,this.length++),this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=q(e);if(t.length===0)return new o(1);for(var i=this,s=0;s<t.length&&t[s]===0;s++,i=i.sqr());if(++s<t.length)for(var l=i.sqr();s<t.length;s++,l=l.sqr())t[s]!==0&&(i=i.mul(l));return i},o.prototype.iushln=function(e){u(typeof e=="number"&&e>=0);var t=e%26,i=(e-t)/26,s=67108863>>>26-t<<26-t,l;if(t!==0){var c=0;for(l=0;l<this.length;l++){var p=this.words[l]&s,d=(this.words[l]|0)-p<<t;this.words[l]=d|c,c=p>>>26-t}c&&(this.words[l]=c,this.length++)}if(i!==0){for(l=this.length-1;l>=0;l--)this.words[l+i]=this.words[l];for(l=0;l<i;l++)this.words[l]=0;this.length+=i}return this.strip()},o.prototype.ishln=function(e){return u(this.negative===0),this.iushln(e)},o.prototype.iushrn=function(e,t,i){u(typeof e=="number"&&e>=0);var s;t?s=(t-t%26)/26:s=0;var l=e%26,c=Math.min((e-l)/26,this.length),p=67108863^67108863>>>l<<l,d=i;if(s-=c,s=Math.max(0,s),d){for(var r=0;r<c;r++)d.words[r]=this.words[r];d.length=c}if(c!==0)if(this.length>c)for(this.length-=c,r=0;r<this.length;r++)this.words[r]=this.words[r+c];else this.words[0]=0,this.length=1;var f=0;for(r=this.length-1;r>=0&&(f!==0||r>=s);r--){var m=this.words[r]|0;this.words[r]=f<<26-l|m>>>l,f=m&p}return d&&f!==0&&(d.words[d.length++]=f),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(e,t,i){return u(this.negative===0),this.iushrn(e,t,i)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){u(typeof e=="number"&&e>=0);var t=e%26,i=(e-t)/26,s=1<<t;if(this.length<=i)return!1;var l=this.words[i];return!!(l&s)},o.prototype.imaskn=function(e){u(typeof e=="number"&&e>=0);var t=e%26,i=(e-t)/26;if(u(this.negative===0,"imaskn works only with positive numbers"),this.length<=i)return this;if(t!==0&&i++,this.length=Math.min(i,this.length),t!==0){var s=67108863^67108863>>>t<<t;this.words[this.length-1]&=s}return this.strip()},o.prototype.maskn=function(e){return this.clone().imaskn(e)},o.prototype.iaddn=function(e){return u(typeof e=="number"),u(e<67108864),e<0?this.isubn(-e):this.negative!==0?this.length===1&&(this.words[0]|0)<e?(this.words[0]=e-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},o.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(u(typeof e=="number"),u(e<67108864),e<0)return this.iaddn(-e);if(this.negative!==0)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.strip()},o.prototype.addn=function(e){return this.clone().iaddn(e)},o.prototype.subn=function(e){return this.clone().isubn(e)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(e,t,i){var s=e.length+i,l;this._expand(s);var c,p=0;for(l=0;l<e.length;l++){c=(this.words[l+i]|0)+p;var d=(e.words[l]|0)*t;c-=d&67108863,p=(c>>26)-(d/67108864|0),this.words[l+i]=c&67108863}for(;l<this.length-i;l++)c=(this.words[l+i]|0)+p,p=c>>26,this.words[l+i]=c&67108863;if(p===0)return this.strip();for(u(p===-1),p=0,l=0;l<this.length;l++)c=-(this.words[l]|0)+p,p=c>>26,this.words[l]=c&67108863;return this.negative=1,this.strip()},o.prototype._wordDiv=function(e,t){var i=this.length-e.length,s=this.clone(),l=e,c=l.words[l.length-1]|0,p=this._countBits(c);i=26-p,i!==0&&(l=l.ushln(i),s.iushln(i),c=l.words[l.length-1]|0);var d=s.length-l.length,r;if(t!=="mod"){r=new o(null),r.length=d+1,r.words=new Array(r.length);for(var f=0;f<r.length;f++)r.words[f]=0}var m=s.clone()._ishlnsubmul(l,1,d);m.negative===0&&(s=m,r&&(r.words[d]=1));for(var _=d-1;_>=0;_--){var R=(s.words[l.length+_]|0)*67108864+(s.words[l.length+_-1]|0);for(R=Math.min(R/c|0,67108863),s._ishlnsubmul(l,R,_);s.negative!==0;)R--,s.negative=0,s._ishlnsubmul(l,1,_),s.isZero()||(s.negative^=1);r&&(r.words[_]=R)}return r&&r.strip(),s.strip(),t!=="div"&&i!==0&&s.iushrn(i),{div:r||null,mod:s}},o.prototype.divmod=function(e,t,i){if(u(!e.isZero()),this.isZero())return{div:new o(0),mod:new o(0)};var s,l,c;return this.negative!==0&&e.negative===0?(c=this.neg().divmod(e,t),t!=="mod"&&(s=c.div.neg()),t!=="div"&&(l=c.mod.neg(),i&&l.negative!==0&&l.iadd(e)),{div:s,mod:l}):this.negative===0&&e.negative!==0?(c=this.divmod(e.neg(),t),t!=="mod"&&(s=c.div.neg()),{div:s,mod:c.mod}):this.negative&e.negative?(c=this.neg().divmod(e.neg(),t),t!=="div"&&(l=c.mod.neg(),i&&l.negative!==0&&l.isub(e)),{div:c.div,mod:l}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:e.length===1?t==="div"?{div:this.divn(e.words[0]),mod:null}:t==="mod"?{div:null,mod:new o(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modn(e.words[0]))}:this._wordDiv(e,t)},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var i=t.div.negative!==0?t.mod.isub(e):t.mod,s=e.ushrn(1),l=e.andln(1),c=i.cmp(s);return c<0||l===1&&c===0?t.div:t.div.negative!==0?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modn=function(e){u(e<=67108863);for(var t=(1<<26)%e,i=0,s=this.length-1;s>=0;s--)i=(t*i+(this.words[s]|0))%e;return i},o.prototype.idivn=function(e){u(e<=67108863);for(var t=0,i=this.length-1;i>=0;i--){var s=(this.words[i]|0)+t*67108864;this.words[i]=s/e|0,t=s%e}return this.strip()},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){u(e.negative===0),u(!e.isZero());var t=this,i=e.clone();t.negative!==0?t=t.umod(e):t=t.clone();for(var s=new o(1),l=new o(0),c=new o(0),p=new o(1),d=0;t.isEven()&&i.isEven();)t.iushrn(1),i.iushrn(1),++d;for(var r=i.clone(),f=t.clone();!t.isZero();){for(var m=0,_=1;!(t.words[0]&_)&&m<26;++m,_<<=1);if(m>0)for(t.iushrn(m);m-- >0;)(s.isOdd()||l.isOdd())&&(s.iadd(r),l.isub(f)),s.iushrn(1),l.iushrn(1);for(var R=0,C=1;!(i.words[0]&C)&&R<26;++R,C<<=1);if(R>0)for(i.iushrn(R);R-- >0;)(c.isOdd()||p.isOdd())&&(c.iadd(r),p.isub(f)),c.iushrn(1),p.iushrn(1);t.cmp(i)>=0?(t.isub(i),s.isub(c),l.isub(p)):(i.isub(t),c.isub(s),p.isub(l))}return{a:c,b:p,gcd:i.iushln(d)}},o.prototype._invmp=function(e){u(e.negative===0),u(!e.isZero());var t=this,i=e.clone();t.negative!==0?t=t.umod(e):t=t.clone();for(var s=new o(1),l=new o(0),c=i.clone();t.cmpn(1)>0&&i.cmpn(1)>0;){for(var p=0,d=1;!(t.words[0]&d)&&p<26;++p,d<<=1);if(p>0)for(t.iushrn(p);p-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);for(var r=0,f=1;!(i.words[0]&f)&&r<26;++r,f<<=1);if(r>0)for(i.iushrn(r);r-- >0;)l.isOdd()&&l.iadd(c),l.iushrn(1);t.cmp(i)>=0?(t.isub(i),s.isub(l)):(i.isub(t),l.isub(s))}var m;return t.cmpn(1)===0?m=s:m=l,m.cmpn(0)<0&&m.iadd(e),m},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),i=e.clone();t.negative=0,i.negative=0;for(var s=0;t.isEven()&&i.isEven();s++)t.iushrn(1),i.iushrn(1);do{for(;t.isEven();)t.iushrn(1);for(;i.isEven();)i.iushrn(1);var l=t.cmp(i);if(l<0){var c=t;t=i,i=c}else if(l===0||i.cmpn(1)===0)break;t.isub(i)}while(!0);return i.iushln(s)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return(this.words[0]&1)===0},o.prototype.isOdd=function(){return(this.words[0]&1)===1},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){u(typeof e=="number");var t=e%26,i=(e-t)/26,s=1<<t;if(this.length<=i)return this._expand(i+1),this.words[i]|=s,this;for(var l=s,c=i;l!==0&&c<this.length;c++){var p=this.words[c]|0;p+=l,l=p>>>26,p&=67108863,this.words[c]=p}return l!==0&&(this.words[c]=l,this.length++),this},o.prototype.isZero=function(){return this.length===1&&this.words[0]===0},o.prototype.cmpn=function(e){var t=e<0;if(this.negative!==0&&!t)return-1;if(this.negative===0&&t)return 1;this.strip();var i;if(this.length>1)i=1;else{t&&(e=-e),u(e<=67108863,"Number is too big");var s=this.words[0]|0;i=s===e?0:s<e?-1:1}return this.negative!==0?-i|0:i},o.prototype.cmp=function(e){if(this.negative!==0&&e.negative===0)return-1;if(this.negative===0&&e.negative!==0)return 1;var t=this.ucmp(e);return this.negative!==0?-t|0:t},o.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,i=this.length-1;i>=0;i--){var s=this.words[i]|0,l=e.words[i]|0;if(s!==l){s<l?t=-1:s>l&&(t=1);break}}return t},o.prototype.gtn=function(e){return this.cmpn(e)===1},o.prototype.gt=function(e){return this.cmp(e)===1},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return this.cmpn(e)===-1},o.prototype.lt=function(e){return this.cmp(e)===-1},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return this.cmpn(e)===0},o.prototype.eq=function(e){return this.cmp(e)===0},o.red=function(e){return new ct(e)},o.prototype.toRed=function(e){return u(!this.red,"Already a number in reduction context"),u(this.negative===0,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return u(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return u(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return u(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return u(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return u(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return u(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return u(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return u(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return u(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return u(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return u(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return u(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return u(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return u(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return u(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var S={k256:null,p224:null,p192:null,p25519:null};function T(g,e){this.name=g,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}T.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},T.prototype.ireduce=function(e){var t=e,i;do this.split(t,this.tmp),t=this.imulK(t),t=t.iadd(this.tmp),i=t.bitLength();while(i>this.n);var s=i<this.n?-1:t.ucmp(this.p);return s===0?(t.words[0]=0,t.length=1):s>0?t.isub(this.p):t.strip(),t},T.prototype.split=function(e,t){e.iushrn(this.n,0,t)},T.prototype.imulK=function(e){return e.imul(this.k)};function O(){T.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}v(O,T),O.prototype.split=function(e,t){for(var i=4194303,s=Math.min(e.length,9),l=0;l<s;l++)t.words[l]=e.words[l];if(t.length=s,e.length<=9){e.words[0]=0,e.length=1;return}var c=e.words[9];for(t.words[t.length++]=c&i,l=10;l<e.length;l++){var p=e.words[l]|0;e.words[l-10]=(p&i)<<4|c>>>22,c=p}c>>>=22,e.words[l-10]=c,c===0&&e.length>10?e.length-=10:e.length-=9},O.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,i=0;i<e.length;i++){var s=e.words[i]|0;t+=s*977,e.words[i]=t&67108863,t=s*64+(t/67108864|0)}return e.words[e.length-1]===0&&(e.length--,e.words[e.length-1]===0&&e.length--),e};function W(){T.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}v(W,T);function K(){T.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}v(K,T);function pt(){T.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}v(pt,T),pt.prototype.imulK=function(e){for(var t=0,i=0;i<e.length;i++){var s=(e.words[i]|0)*19+t,l=s&67108863;s>>>=26,e.words[i]=l,t=s}return t!==0&&(e.words[e.length++]=t),e},o._prime=function(e){if(S[e])return S[e];var t;if(e==="k256")t=new O;else if(e==="p224")t=new W;else if(e==="p192")t=new K;else if(e==="p25519")t=new pt;else throw new Error("Unknown prime "+e);return S[e]=t,t};function ct(g){if(typeof g=="string"){var e=o._prime(g);this.m=e.p,this.prime=e}else u(g.gtn(1),"modulus must be greater than 1"),this.m=g,this.prime=null}ct.prototype._verify1=function(e){u(e.negative===0,"red works only with positives"),u(e.red,"red works only with red numbers")},ct.prototype._verify2=function(e,t){u((e.negative|t.negative)===0,"red works only with positives"),u(e.red&&e.red===t.red,"red works only with red numbers")},ct.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},ct.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},ct.prototype.add=function(e,t){this._verify2(e,t);var i=e.add(t);return i.cmp(this.m)>=0&&i.isub(this.m),i._forceRed(this)},ct.prototype.iadd=function(e,t){this._verify2(e,t);var i=e.iadd(t);return i.cmp(this.m)>=0&&i.isub(this.m),i},ct.prototype.sub=function(e,t){this._verify2(e,t);var i=e.sub(t);return i.cmpn(0)<0&&i.iadd(this.m),i._forceRed(this)},ct.prototype.isub=function(e,t){this._verify2(e,t);var i=e.isub(t);return i.cmpn(0)<0&&i.iadd(this.m),i},ct.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},ct.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},ct.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},ct.prototype.isqr=function(e){return this.imul(e,e.clone())},ct.prototype.sqr=function(e){return this.mul(e,e)},ct.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(u(t%2===1),t===3){var i=this.m.add(new o(1)).iushrn(2);return this.pow(e,i)}for(var s=this.m.subn(1),l=0;!s.isZero()&&s.andln(1)===0;)l++,s.iushrn(1);u(!s.isZero());var c=new o(1).toRed(this),p=c.redNeg(),d=this.m.subn(1).iushrn(1),r=this.m.bitLength();for(r=new o(2*r*r).toRed(this);this.pow(r,d).cmp(p)!==0;)r.redIAdd(p);for(var f=this.pow(r,s),m=this.pow(e,s.addn(1).iushrn(1)),_=this.pow(e,s),R=l;_.cmp(c)!==0;){for(var C=_,F=0;C.cmp(c)!==0;F++)C=C.redSqr();u(F<R);var z=this.pow(f,new o(1).iushln(R-F-1));m=m.redMul(z),f=z.redSqr(),_=_.redMul(f),R=F}return m},ct.prototype.invm=function(e){var t=e._invmp(this.m);return t.negative!==0?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},ct.prototype.pow=function(e,t){if(t.isZero())return new o(1).toRed(this);if(t.cmpn(1)===0)return e.clone();var i=4,s=new Array(1<<i);s[0]=new o(1).toRed(this),s[1]=e;for(var l=2;l<s.length;l++)s[l]=this.mul(s[l-1],e);var c=s[0],p=0,d=0,r=t.bitLength()%26;for(r===0&&(r=26),l=t.length-1;l>=0;l--){for(var f=t.words[l],m=r-1;m>=0;m--){var _=f>>m&1;if(c!==s[0]&&(c=this.sqr(c)),_===0&&p===0){d=0;continue}p<<=1,p|=_,d++,!(d!==i&&(l!==0||m!==0))&&(c=this.mul(c,s[p]),d=0,p=0)}r=26}return c},ct.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},ct.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new dt(e)};function dt(g){ct.call(this,g),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v(dt,ct),dt.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},dt.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},dt.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var i=e.imul(t),s=i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),l=i.isub(s).iushrn(this.shift),c=l;return l.cmp(this.m)>=0?c=l.isub(this.m):l.cmpn(0)<0&&(c=l.iadd(this.m)),c._forceRed(this)},dt.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var i=e.mul(t),s=i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),l=i.isub(s).iushrn(this.shift),c=l;return l.cmp(this.m)>=0?c=l.isub(this.m):l.cmpn(0)<0&&(c=l.iadd(this.m)),c._forceRed(this)},dt.prototype.invm=function(e){var t=this.imod(e._invmp(this.m).mul(this.r2));return t._forceRed(this)}})(a,Vt)})(zo);var ow=zo.exports;const sw=jf(ow);var hw=Do;Do.strict=bu;Do.loose=Mu;var uw=Object.prototype.toString,lw={"[object Int8Array]":!0,"[object Int16Array]":!0,"[object Int32Array]":!0,"[object Uint8Array]":!0,"[object Uint8ClampedArray]":!0,"[object Uint16Array]":!0,"[object Uint32Array]":!0,"[object Float32Array]":!0,"[object Float64Array]":!0};function Do(a){return bu(a)||Mu(a)}function bu(a){return a instanceof Int8Array||a instanceof Int16Array||a instanceof Int32Array||a instanceof Uint8Array||a instanceof Uint8ClampedArray||a instanceof Uint16Array||a instanceof Uint32Array||a instanceof Float32Array||a instanceof Float64Array}function Mu(a){return lw[uw.call(a)]}var cw=hw.strict,dw=function(n){if(cw(n)){var h=X.from(n.buffer);return n.byteLength!==n.buffer.byteLength&&(h=h.slice(n.byteOffset,n.byteOffset+n.byteLength)),h}else return X.from(n)};const vw=jf(dw),xu="hex",_u="utf8",ya="0";function oi(a){return new Uint8Array(a)}function Su(a,n=!1){const h=a.toString(xu);return n?Si(h):h}function pw(a){return a.toString(_u)}function wa(a){return vw(a)}function ti(a,n=!1){return Su(wa(a),n)}function mw(a){return pw(wa(a))}function gw(a){return X.from(xr(a),xu)}function ei(a){return oi(gw(a))}function Ho(a){return X.from(a,_u)}function yw(a){return oi(Ho(a))}function Au(a,n=!1){return Su(Ho(a),n)}function Eu(a,n){return!(typeof a!="string"||!a.match(/^0x[0-9A-Fa-f]*$/)||n&&a.length!==2+2*n)}function ku(...a){let n=[];return a.forEach(h=>n=n.concat(Array.from(h))),new Uint8Array([...n])}function ww(a,n=8){const h=a%n;return h?(a-h)/n*n+n:a}function bw(a,n=8,h=ya){return Mw(a,ww(a.length,n),h)}function Mw(a,n,h=ya){return _w(a,n,!0,h)}function xr(a){return a.replace(/^0x/,"")}function Si(a){return a.startsWith("0x")?a:`0x${a}`}function Ru(a){return a=xr(a),a=bw(a,2),a&&(a=Si(a)),a}function xw(a){const n=a.startsWith("0x");return a=xr(a),a=a.startsWith(ya)?a.substring(1):a,n?Si(a):a}function _w(a,n,h,u=ya){const v=n-a.length;let o=a;if(v>0){const w=u.repeat(v);o=h?w+a:a+w}return o}function Sw(a,n){return ti(new Uint8Array(a),!n)}function Aw(a){return Ho(a)}function Ew(a,n){return Au(a,!n)}function kw(a){return ei(a).buffer}function Bu(a,n){const h=xr(Ru(new sw(a).toString(16)));return n?h:Si(h)}function pn(a){return Ru(a)}function Rw(a){return xw(Si(a))}const Bw=Ns;function Za(){return((n,h)=>{for(h=n="";n++<36;h+=n*51&52?(n^15?8^Math.random()*(n^20?16:4):4).toString(16):"-");return h})()}function Iw(a){return a===""||typeof a=="string"&&a.trim()===""}function Tw(a){return!(a&&a.length)}function Iu(a,n){return Eu(a,n)}function Cw(a){return typeof a.method<"u"}function Li(a){return typeof a.result<"u"}function Tn(a){return typeof a.error<"u"}function G0(a){return typeof a.event<"u"}function Lw(a){return fw.includes(a)||a.startsWith("wc_")}function Pw(a){return a.method.startsWith("wc_")?!0:!wu.includes(a.method)}function Ow(a){a=xr(a.toLowerCase());const n=xr(Xl.keccak_256(Aw(a)));let h="";for(let u=0;u<a.length;u++)parseInt(n[u],16)>7?h+=a[u].toUpperCase():h+=a[u];return Si(h)}const Nw=a=>a?a.toLowerCase().substring(0,2)!=="0x"?!1:/^(0x)?[0-9a-f]{40}$/i.test(a)?/^(0x)?[0-9a-f]{40}$/.test(a)||/^(0x)?[0-9A-F]{40}$/.test(a)?!0:a===Ow(a):!1:!1;function J0(a){return!Tw(a)&&!Iu(a[0])&&(a[0]=Ew(a[0])),a}function Wa(a){if(typeof a.type<"u"&&a.type!=="0")return a;if(typeof a.from>"u"||!Nw(a.from))throw new Error("Transaction object must include a valid 'from' value.");function n(v){let o=v;return(typeof v=="number"||typeof v=="string"&&!Iw(v))&&(Iu(v)?typeof v=="string"&&(o=pn(v)):o=Bu(v)),typeof o=="string"&&(o=Rw(o)),o}const h={from:pn(a.from),to:typeof a.to>"u"?void 0:pn(a.to),gasPrice:typeof a.gasPrice>"u"?"":n(a.gasPrice),gas:typeof a.gas>"u"?typeof a.gasLimit>"u"?"":n(a.gasLimit):n(a.gas),value:typeof a.value>"u"?"":n(a.value),nonce:typeof a.nonce>"u"?"":n(a.nonce),data:typeof a.data>"u"?"":pn(a.data)||"0x"},u=["gasPrice","gas","value","nonce"];return Object.keys(h).forEach(v=>{(typeof h[v]>"u"||typeof h[v]=="string"&&!h[v].trim().length)&&u.includes(v)&&delete h[v]}),h}function qw(a){const n=a.message||"Failed or Rejected Request";let h=-32e3;if(a&&!a.code)switch(n){case"Parse error":h=-32700;break;case"Invalid request":h=-32600;break;case"Method not found":h=-32601;break;case"Invalid params":h=-32602;break;case"Internal error":h=-32603;break;default:h=-32e3;break}const u={code:h,message:n};return a.data&&(u.data=a.data),u}var Tu={};(function(a){const n=Ki,h=Zi,u=Hi,v=x=>x==null;function o(x){switch(x.arrayFormat){case"index":return A=>(S,T)=>{const O=S.length;return T===void 0||x.skipNull&&T===null||x.skipEmptyString&&T===""?S:T===null?[...S,[b(A,x),"[",O,"]"].join("")]:[...S,[b(A,x),"[",b(O,x),"]=",b(T,x)].join("")]};case"bracket":return A=>(S,T)=>T===void 0||x.skipNull&&T===null||x.skipEmptyString&&T===""?S:T===null?[...S,[b(A,x),"[]"].join("")]:[...S,[b(A,x),"[]=",b(T,x)].join("")];case"comma":case"separator":return A=>(S,T)=>T==null||T.length===0?S:S.length===0?[[b(A,x),"=",b(T,x)].join("")]:[[S,b(T,x)].join(x.arrayFormatSeparator)];default:return A=>(S,T)=>T===void 0||x.skipNull&&T===null||x.skipEmptyString&&T===""?S:T===null?[...S,b(A,x)]:[...S,[b(A,x),"=",b(T,x)].join("")]}}function w(x){let A;switch(x.arrayFormat){case"index":return(S,T,O)=>{if(A=/\[(\d*)\]$/.exec(S),S=S.replace(/\[\d*\]$/,""),!A){O[S]=T;return}O[S]===void 0&&(O[S]={}),O[S][A[1]]=T};case"bracket":return(S,T,O)=>{if(A=/(\[\])$/.exec(S),S=S.replace(/\[\]$/,""),!A){O[S]=T;return}if(O[S]===void 0){O[S]=[T];return}O[S]=[].concat(O[S],T)};case"comma":case"separator":return(S,T,O)=>{const K=typeof T=="string"&&T.split("").indexOf(x.arrayFormatSeparator)>-1?T.split(x.arrayFormatSeparator).map(pt=>B(pt,x)):T===null?T:B(T,x);O[S]=K};default:return(S,T,O)=>{if(O[S]===void 0){O[S]=T;return}O[S]=[].concat(O[S],T)}}}function y(x){if(typeof x!="string"||x.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function b(x,A){return A.encode?A.strict?n(x):encodeURIComponent(x):x}function B(x,A){return A.decode?h(x):x}function k(x){return Array.isArray(x)?x.sort():typeof x=="object"?k(Object.keys(x)).sort((A,S)=>Number(A)-Number(S)).map(A=>x[A]):x}function L(x){const A=x.indexOf("#");return A!==-1&&(x=x.slice(0,A)),x}function q(x){let A="";const S=x.indexOf("#");return S!==-1&&(A=x.slice(S)),A}function $(x){x=L(x);const A=x.indexOf("?");return A===-1?"":x.slice(A+1)}function M(x,A){return A.parseNumbers&&!Number.isNaN(Number(x))&&typeof x=="string"&&x.trim()!==""?x=Number(x):A.parseBooleans&&x!==null&&(x.toLowerCase()==="true"||x.toLowerCase()==="false")&&(x=x.toLowerCase()==="true"),x}function N(x,A){A=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},A),y(A.arrayFormatSeparator);const S=w(A),T=Object.create(null);if(typeof x!="string"||(x=x.trim().replace(/^[?#&]/,""),!x))return T;for(const O of x.split("&")){let[W,K]=u(A.decode?O.replace(/\+/g," "):O,"=");K=K===void 0?null:["comma","separator"].includes(A.arrayFormat)?K:B(K,A),S(B(W,A),K,T)}for(const O of Object.keys(T)){const W=T[O];if(typeof W=="object"&&W!==null)for(const K of Object.keys(W))W[K]=M(W[K],A);else T[O]=M(W,A)}return A.sort===!1?T:(A.sort===!0?Object.keys(T).sort():Object.keys(T).sort(A.sort)).reduce((O,W)=>{const K=T[W];return K&&typeof K=="object"&&!Array.isArray(K)?O[W]=k(K):O[W]=K,O},Object.create(null))}a.extract=$,a.parse=N,a.stringify=(x,A)=>{if(!x)return"";A=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},A),y(A.arrayFormatSeparator);const S=K=>A.skipNull&&v(x[K])||A.skipEmptyString&&x[K]==="",T=o(A),O={};for(const K of Object.keys(x))S(K)||(O[K]=x[K]);const W=Object.keys(O);return A.sort!==!1&&W.sort(A.sort),W.map(K=>{const pt=x[K];return pt===void 0?"":pt===null?b(K,A):Array.isArray(pt)?pt.reduce(T(K),[]).join("&"):b(K,A)+"="+b(pt,A)}).filter(K=>K.length>0).join("&")},a.parseUrl=(x,A)=>{A=Object.assign({decode:!0},A);const[S,T]=u(x,"#");return Object.assign({url:S.split("?")[0]||"",query:N($(x),A)},A&&A.parseFragmentIdentifier&&T?{fragmentIdentifier:B(T,A)}:{})},a.stringifyUrl=(x,A)=>{A=Object.assign({encode:!0,strict:!0},A);const S=L(x.url).split("?")[0]||"",T=a.extract(x.url),O=a.parse(T,{sort:!1}),W=Object.assign(O,x.query);let K=a.stringify(W,A);K&&(K=`?${K}`);let pt=q(x.url);return x.fragmentIdentifier&&(pt=`#${b(x.fragmentIdentifier,A)}`),`${S}${K}${pt}`}})(Tu);function Uw(a){return Tu.parse(a)}function Fw(a){return typeof a.bridge<"u"}function $w(a){const n=a.indexOf(":"),h=a.indexOf("?")!==-1?a.indexOf("?"):void 0,u=a.substring(0,n),v=a.substring(n+1,h);function o(L){const q="@",$=L.split(q);return{handshakeTopic:$[0],version:parseInt($[1],10)}}const w=o(v),y=typeof h<"u"?a.substr(h):"";function b(L){const q=Uw(L);return{key:q.key||"",bridge:q.bridge||""}}const B=b(y);return Object.assign(Object.assign({protocol:u},w),B)}var Va,j0;function zw(){return j0||(j0=1,Va=function(){throw new Error("ws does not work in the browser. Browser clients must use the native WebSocket object")}),Va}var Ko={exports:{}};Ko.exports;(function(a){(function(n,h){function u(g,e){if(!g)throw new Error(e||"Assertion failed")}function v(g,e){g.super_=e;var t=function(){};t.prototype=e.prototype,g.prototype=new t,g.prototype.constructor=g}function o(g,e,t){if(o.isBN(g))return g;this.negative=0,this.words=null,this.length=0,this.red=null,g!==null&&((e==="le"||e==="be")&&(t=e,e=10),this._init(g||0,e||10,t||"be"))}typeof n=="object"?n.exports=o:h.BN=o,o.BN=o,o.wordSize=26;var w;try{w=Se.Buffer}catch{}o.isBN=function(e){return e instanceof o?!0:e!==null&&typeof e=="object"&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,i){if(typeof e=="number")return this._initNumber(e,t,i);if(typeof e=="object")return this._initArray(e,t,i);t==="hex"&&(t=16),u(t===(t|0)&&t>=2&&t<=36),e=e.toString().replace(/\s+/g,"");var s=0;e[0]==="-"&&s++,t===16?this._parseHex(e,s):this._parseBase(e,t,s),e[0]==="-"&&(this.negative=1),this.strip(),i==="le"&&this._initArray(this.toArray(),t,i)},o.prototype._initNumber=function(e,t,i){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[e&67108863],this.length=1):e<4503599627370496?(this.words=[e&67108863,e/67108864&67108863],this.length=2):(u(e<9007199254740992),this.words=[e&67108863,e/67108864&67108863,1],this.length=3),i==="le"&&this._initArray(this.toArray(),t,i)},o.prototype._initArray=function(e,t,i){if(u(typeof e.length=="number"),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var s=0;s<this.length;s++)this.words[s]=0;var l,c,p=0;if(i==="be")for(s=e.length-1,l=0;s>=0;s-=3)c=e[s]|e[s-1]<<8|e[s-2]<<16,this.words[l]|=c<<p&67108863,this.words[l+1]=c>>>26-p&67108863,p+=24,p>=26&&(p-=26,l++);else if(i==="le")for(s=0,l=0;s<e.length;s+=3)c=e[s]|e[s+1]<<8|e[s+2]<<16,this.words[l]|=c<<p&67108863,this.words[l+1]=c>>>26-p&67108863,p+=24,p>=26&&(p-=26,l++);return this.strip()};function y(g,e,t){for(var i=0,s=Math.min(g.length,t),l=e;l<s;l++){var c=g.charCodeAt(l)-48;i<<=4,c>=49&&c<=54?i|=c-49+10:c>=17&&c<=22?i|=c-17+10:i|=c&15}return i}o.prototype._parseHex=function(e,t){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var s,l,c=0;for(i=e.length-6,s=0;i>=t;i-=6)l=y(e,i,i+6),this.words[s]|=l<<c&67108863,this.words[s+1]|=l>>>26-c&4194303,c+=24,c>=26&&(c-=26,s++);i+6!==t&&(l=y(e,t,i+6),this.words[s]|=l<<c&67108863,this.words[s+1]|=l>>>26-c&4194303),this.strip()};function b(g,e,t,i){for(var s=0,l=Math.min(g.length,t),c=e;c<l;c++){var p=g.charCodeAt(c)-48;s*=i,p>=49?s+=p-49+10:p>=17?s+=p-17+10:s+=p}return s}o.prototype._parseBase=function(e,t,i){this.words=[0],this.length=1;for(var s=0,l=1;l<=67108863;l*=t)s++;s--,l=l/t|0;for(var c=e.length-i,p=c%s,d=Math.min(c,c-p)+i,r=0,f=i;f<d;f+=s)r=b(e,f,f+s,t),this.imuln(l),this.words[0]+r<67108864?this.words[0]+=r:this._iaddn(r);if(p!==0){var m=1;for(r=b(e,f,e.length,t),f=0;f<p;f++)m*=t;this.imuln(m),this.words[0]+r<67108864?this.words[0]+=r:this._iaddn(r)}},o.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},o.prototype.clone=function(){var e=new o(null);return this.copy(e),e},o.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},o.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var B=["","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"],k=[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],L=[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];o.prototype.toString=function(e,t){e=e||10,t=t|0||1;var i;if(e===16||e==="hex"){i="";for(var s=0,l=0,c=0;c<this.length;c++){var p=this.words[c],d=((p<<s|l)&16777215).toString(16);l=p>>>24-s&16777215,l!==0||c!==this.length-1?i=B[6-d.length]+d+i:i=d+i,s+=2,s>=26&&(s-=26,c--)}for(l!==0&&(i=l.toString(16)+i);i.length%t!==0;)i="0"+i;return this.negative!==0&&(i="-"+i),i}if(e===(e|0)&&e>=2&&e<=36){var r=k[e],f=L[e];i="";var m=this.clone();for(m.negative=0;!m.isZero();){var _=m.modn(f).toString(e);m=m.idivn(f),m.isZero()?i=_+i:i=B[r-_.length]+_+i}for(this.isZero()&&(i="0"+i);i.length%t!==0;)i="0"+i;return this.negative!==0&&(i="-"+i),i}u(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return this.length===2?e+=this.words[1]*67108864:this.length===3&&this.words[2]===1?e+=4503599627370496+this.words[1]*67108864:this.length>2&&u(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-e:e},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(e,t){return u(typeof w<"u"),this.toArrayLike(w,e,t)},o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},o.prototype.toArrayLike=function(e,t,i){var s=this.byteLength(),l=i||Math.max(1,s);u(s<=l,"byte array longer than desired length"),u(l>0,"Requested array length <= 0"),this.strip();var c=t==="le",p=new e(l),d,r,f=this.clone();if(c){for(r=0;!f.isZero();r++)d=f.andln(255),f.iushrn(8),p[r]=d;for(;r<l;r++)p[r]=0}else{for(r=0;r<l-s;r++)p[r]=0;for(r=0;!f.isZero();r++)d=f.andln(255),f.iushrn(8),p[l-r-1]=d}return p},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,i=0;return t>=4096&&(i+=13,t>>>=13),t>=64&&(i+=7,t>>>=7),t>=8&&(i+=4,t>>>=4),t>=2&&(i+=2,t>>>=2),i+t},o.prototype._zeroBits=function(e){if(e===0)return 26;var t=e,i=0;return t&8191||(i+=13,t>>>=13),t&127||(i+=7,t>>>=7),t&15||(i+=4,t>>>=4),t&3||(i+=2,t>>>=2),t&1||i++,i},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return(this.length-1)*26+t};function q(g){for(var e=new Array(g.bitLength()),t=0;t<e.length;t++){var i=t/26|0,s=t%26;e[t]=(g.words[i]&1<<s)>>>s}return e}o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var i=this._zeroBits(this.words[t]);if(e+=i,i!==26)break}return e},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(e){return this.negative!==0?this.abs().inotn(e).iaddn(1):this.clone()},o.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return this.negative!==0},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this.strip()},o.prototype.ior=function(e){return u((this.negative|e.negative)===0),this.iuor(e)},o.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;this.length>e.length?t=e:t=this;for(var i=0;i<t.length;i++)this.words[i]=this.words[i]&e.words[i];return this.length=t.length,this.strip()},o.prototype.iand=function(e){return u((this.negative|e.negative)===0),this.iuand(e)},o.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,i;this.length>e.length?(t=this,i=e):(t=e,i=this);for(var s=0;s<i.length;s++)this.words[s]=t.words[s]^i.words[s];if(this!==t)for(;s<t.length;s++)this.words[s]=t.words[s];return this.length=t.length,this.strip()},o.prototype.ixor=function(e){return u((this.negative|e.negative)===0),this.iuxor(e)},o.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){u(typeof e=="number"&&e>=0);var t=Math.ceil(e/26)|0,i=e%26;this._expand(t),i>0&&t--;for(var s=0;s<t;s++)this.words[s]=~this.words[s]&67108863;return i>0&&(this.words[s]=~this.words[s]&67108863>>26-i),this.strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){u(typeof e=="number"&&e>=0);var i=e/26|0,s=e%26;return this._expand(i+1),t?this.words[i]=this.words[i]|1<<s:this.words[i]=this.words[i]&~(1<<s),this.strip()},o.prototype.iadd=function(e){var t;if(this.negative!==0&&e.negative===0)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(this.negative===0&&e.negative!==0)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();var i,s;this.length>e.length?(i=this,s=e):(i=e,s=this);for(var l=0,c=0;c<s.length;c++)t=(i.words[c]|0)+(s.words[c]|0)+l,this.words[c]=t&67108863,l=t>>>26;for(;l!==0&&c<i.length;c++)t=(i.words[c]|0)+l,this.words[c]=t&67108863,l=t>>>26;if(this.length=i.length,l!==0)this.words[this.length]=l,this.length++;else if(i!==this)for(;c<i.length;c++)this.words[c]=i.words[c];return this},o.prototype.add=function(e){var t;return e.negative!==0&&this.negative===0?(e.negative=0,t=this.sub(e),e.negative^=1,t):e.negative===0&&this.negative!==0?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(e.negative!==0){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var i=this.cmp(e);if(i===0)return this.negative=0,this.length=1,this.words[0]=0,this;var s,l;i>0?(s=this,l=e):(s=e,l=this);for(var c=0,p=0;p<l.length;p++)t=(s.words[p]|0)-(l.words[p]|0)+c,c=t>>26,this.words[p]=t&67108863;for(;c!==0&&p<s.length;p++)t=(s.words[p]|0)+c,c=t>>26,this.words[p]=t&67108863;if(c===0&&p<s.length&&s!==this)for(;p<s.length;p++)this.words[p]=s.words[p];return this.length=Math.max(this.length,p),s!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(e){return this.clone().isub(e)};function $(g,e,t){t.negative=e.negative^g.negative;var i=g.length+e.length|0;t.length=i,i=i-1|0;var s=g.words[0]|0,l=e.words[0]|0,c=s*l,p=c&67108863,d=c/67108864|0;t.words[0]=p;for(var r=1;r<i;r++){for(var f=d>>>26,m=d&67108863,_=Math.min(r,e.length-1),R=Math.max(0,r-g.length+1);R<=_;R++){var C=r-R|0;s=g.words[C]|0,l=e.words[R]|0,c=s*l+m,f+=c/67108864|0,m=c&67108863}t.words[r]=m|0,d=f|0}return d!==0?t.words[r]=d|0:t.length--,t.strip()}var M=function(e,t,i){var s=e.words,l=t.words,c=i.words,p=0,d,r,f,m=s[0]|0,_=m&8191,R=m>>>13,C=s[1]|0,F=C&8191,z=C>>>13,lt=s[2]|0,G=lt&8191,Z=lt>>>13,mt=s[3]|0,gt=mt&8191,j=mt>>>13,Ct=s[4]|0,wt=Ct&8191,Y=Ct>>>13,U=s[5]|0,I=U&8191,E=U>>>13,P=s[6]|0,H=P&8191,D=P>>>13,ut=s[7]|0,vt=ut&8191,V=ut>>>13,bt=s[8]|0,yt=bt&8191,J=bt>>>13,Lt=s[9]|0,Mt=Lt&8191,Q=Lt>>>13,Ot=l[0]|0,xt=Ot&8191,tt=Ot>>>13,Nt=l[1]|0,_t=Nt&8191,et=Nt>>>13,qt=l[2]|0,St=qt&8191,rt=qt>>>13,Ut=l[3]|0,At=Ut&8191,it=Ut>>>13,Ft=l[4]|0,Et=Ft&8191,nt=Ft>>>13,$t=l[5]|0,kt=$t&8191,at=$t>>>13,zt=l[6]|0,Rt=zt&8191,ft=zt>>>13,Dt=l[7]|0,Bt=Dt&8191,ot=Dt>>>13,Ht=l[8]|0,It=Ht&8191,st=Ht>>>13,Kt=l[9]|0,Tt=Kt&8191,ht=Kt>>>13;i.negative=e.negative^t.negative,i.length=19,d=Math.imul(_,xt),r=Math.imul(_,tt),r=r+Math.imul(R,xt)|0,f=Math.imul(R,tt);var Pt=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,d=Math.imul(F,xt),r=Math.imul(F,tt),r=r+Math.imul(z,xt)|0,f=Math.imul(z,tt),d=d+Math.imul(_,_t)|0,r=r+Math.imul(_,et)|0,r=r+Math.imul(R,_t)|0,f=f+Math.imul(R,et)|0;var Jt=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,d=Math.imul(G,xt),r=Math.imul(G,tt),r=r+Math.imul(Z,xt)|0,f=Math.imul(Z,tt),d=d+Math.imul(F,_t)|0,r=r+Math.imul(F,et)|0,r=r+Math.imul(z,_t)|0,f=f+Math.imul(z,et)|0,d=d+Math.imul(_,St)|0,r=r+Math.imul(_,rt)|0,r=r+Math.imul(R,St)|0,f=f+Math.imul(R,rt)|0;var jt=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(jt>>>26)|0,jt&=67108863,d=Math.imul(gt,xt),r=Math.imul(gt,tt),r=r+Math.imul(j,xt)|0,f=Math.imul(j,tt),d=d+Math.imul(G,_t)|0,r=r+Math.imul(G,et)|0,r=r+Math.imul(Z,_t)|0,f=f+Math.imul(Z,et)|0,d=d+Math.imul(F,St)|0,r=r+Math.imul(F,rt)|0,r=r+Math.imul(z,St)|0,f=f+Math.imul(z,rt)|0,d=d+Math.imul(_,At)|0,r=r+Math.imul(_,it)|0,r=r+Math.imul(R,At)|0,f=f+Math.imul(R,it)|0;var Yt=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,d=Math.imul(wt,xt),r=Math.imul(wt,tt),r=r+Math.imul(Y,xt)|0,f=Math.imul(Y,tt),d=d+Math.imul(gt,_t)|0,r=r+Math.imul(gt,et)|0,r=r+Math.imul(j,_t)|0,f=f+Math.imul(j,et)|0,d=d+Math.imul(G,St)|0,r=r+Math.imul(G,rt)|0,r=r+Math.imul(Z,St)|0,f=f+Math.imul(Z,rt)|0,d=d+Math.imul(F,At)|0,r=r+Math.imul(F,it)|0,r=r+Math.imul(z,At)|0,f=f+Math.imul(z,it)|0,d=d+Math.imul(_,Et)|0,r=r+Math.imul(_,nt)|0,r=r+Math.imul(R,Et)|0,f=f+Math.imul(R,nt)|0;var Xt=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(Xt>>>26)|0,Xt&=67108863,d=Math.imul(I,xt),r=Math.imul(I,tt),r=r+Math.imul(E,xt)|0,f=Math.imul(E,tt),d=d+Math.imul(wt,_t)|0,r=r+Math.imul(wt,et)|0,r=r+Math.imul(Y,_t)|0,f=f+Math.imul(Y,et)|0,d=d+Math.imul(gt,St)|0,r=r+Math.imul(gt,rt)|0,r=r+Math.imul(j,St)|0,f=f+Math.imul(j,rt)|0,d=d+Math.imul(G,At)|0,r=r+Math.imul(G,it)|0,r=r+Math.imul(Z,At)|0,f=f+Math.imul(Z,it)|0,d=d+Math.imul(F,Et)|0,r=r+Math.imul(F,nt)|0,r=r+Math.imul(z,Et)|0,f=f+Math.imul(z,nt)|0,d=d+Math.imul(_,kt)|0,r=r+Math.imul(_,at)|0,r=r+Math.imul(R,kt)|0,f=f+Math.imul(R,at)|0;var Qt=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(Qt>>>26)|0,Qt&=67108863,d=Math.imul(H,xt),r=Math.imul(H,tt),r=r+Math.imul(D,xt)|0,f=Math.imul(D,tt),d=d+Math.imul(I,_t)|0,r=r+Math.imul(I,et)|0,r=r+Math.imul(E,_t)|0,f=f+Math.imul(E,et)|0,d=d+Math.imul(wt,St)|0,r=r+Math.imul(wt,rt)|0,r=r+Math.imul(Y,St)|0,f=f+Math.imul(Y,rt)|0,d=d+Math.imul(gt,At)|0,r=r+Math.imul(gt,it)|0,r=r+Math.imul(j,At)|0,f=f+Math.imul(j,it)|0,d=d+Math.imul(G,Et)|0,r=r+Math.imul(G,nt)|0,r=r+Math.imul(Z,Et)|0,f=f+Math.imul(Z,nt)|0,d=d+Math.imul(F,kt)|0,r=r+Math.imul(F,at)|0,r=r+Math.imul(z,kt)|0,f=f+Math.imul(z,at)|0,d=d+Math.imul(_,Rt)|0,r=r+Math.imul(_,ft)|0,r=r+Math.imul(R,Rt)|0,f=f+Math.imul(R,ft)|0;var te=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(te>>>26)|0,te&=67108863,d=Math.imul(vt,xt),r=Math.imul(vt,tt),r=r+Math.imul(V,xt)|0,f=Math.imul(V,tt),d=d+Math.imul(H,_t)|0,r=r+Math.imul(H,et)|0,r=r+Math.imul(D,_t)|0,f=f+Math.imul(D,et)|0,d=d+Math.imul(I,St)|0,r=r+Math.imul(I,rt)|0,r=r+Math.imul(E,St)|0,f=f+Math.imul(E,rt)|0,d=d+Math.imul(wt,At)|0,r=r+Math.imul(wt,it)|0,r=r+Math.imul(Y,At)|0,f=f+Math.imul(Y,it)|0,d=d+Math.imul(gt,Et)|0,r=r+Math.imul(gt,nt)|0,r=r+Math.imul(j,Et)|0,f=f+Math.imul(j,nt)|0,d=d+Math.imul(G,kt)|0,r=r+Math.imul(G,at)|0,r=r+Math.imul(Z,kt)|0,f=f+Math.imul(Z,at)|0,d=d+Math.imul(F,Rt)|0,r=r+Math.imul(F,ft)|0,r=r+Math.imul(z,Rt)|0,f=f+Math.imul(z,ft)|0,d=d+Math.imul(_,Bt)|0,r=r+Math.imul(_,ot)|0,r=r+Math.imul(R,Bt)|0,f=f+Math.imul(R,ot)|0;var ee=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(ee>>>26)|0,ee&=67108863,d=Math.imul(yt,xt),r=Math.imul(yt,tt),r=r+Math.imul(J,xt)|0,f=Math.imul(J,tt),d=d+Math.imul(vt,_t)|0,r=r+Math.imul(vt,et)|0,r=r+Math.imul(V,_t)|0,f=f+Math.imul(V,et)|0,d=d+Math.imul(H,St)|0,r=r+Math.imul(H,rt)|0,r=r+Math.imul(D,St)|0,f=f+Math.imul(D,rt)|0,d=d+Math.imul(I,At)|0,r=r+Math.imul(I,it)|0,r=r+Math.imul(E,At)|0,f=f+Math.imul(E,it)|0,d=d+Math.imul(wt,Et)|0,r=r+Math.imul(wt,nt)|0,r=r+Math.imul(Y,Et)|0,f=f+Math.imul(Y,nt)|0,d=d+Math.imul(gt,kt)|0,r=r+Math.imul(gt,at)|0,r=r+Math.imul(j,kt)|0,f=f+Math.imul(j,at)|0,d=d+Math.imul(G,Rt)|0,r=r+Math.imul(G,ft)|0,r=r+Math.imul(Z,Rt)|0,f=f+Math.imul(Z,ft)|0,d=d+Math.imul(F,Bt)|0,r=r+Math.imul(F,ot)|0,r=r+Math.imul(z,Bt)|0,f=f+Math.imul(z,ot)|0,d=d+Math.imul(_,It)|0,r=r+Math.imul(_,st)|0,r=r+Math.imul(R,It)|0,f=f+Math.imul(R,st)|0;var re=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(re>>>26)|0,re&=67108863,d=Math.imul(Mt,xt),r=Math.imul(Mt,tt),r=r+Math.imul(Q,xt)|0,f=Math.imul(Q,tt),d=d+Math.imul(yt,_t)|0,r=r+Math.imul(yt,et)|0,r=r+Math.imul(J,_t)|0,f=f+Math.imul(J,et)|0,d=d+Math.imul(vt,St)|0,r=r+Math.imul(vt,rt)|0,r=r+Math.imul(V,St)|0,f=f+Math.imul(V,rt)|0,d=d+Math.imul(H,At)|0,r=r+Math.imul(H,it)|0,r=r+Math.imul(D,At)|0,f=f+Math.imul(D,it)|0,d=d+Math.imul(I,Et)|0,r=r+Math.imul(I,nt)|0,r=r+Math.imul(E,Et)|0,f=f+Math.imul(E,nt)|0,d=d+Math.imul(wt,kt)|0,r=r+Math.imul(wt,at)|0,r=r+Math.imul(Y,kt)|0,f=f+Math.imul(Y,at)|0,d=d+Math.imul(gt,Rt)|0,r=r+Math.imul(gt,ft)|0,r=r+Math.imul(j,Rt)|0,f=f+Math.imul(j,ft)|0,d=d+Math.imul(G,Bt)|0,r=r+Math.imul(G,ot)|0,r=r+Math.imul(Z,Bt)|0,f=f+Math.imul(Z,ot)|0,d=d+Math.imul(F,It)|0,r=r+Math.imul(F,st)|0,r=r+Math.imul(z,It)|0,f=f+Math.imul(z,st)|0,d=d+Math.imul(_,Tt)|0,r=r+Math.imul(_,ht)|0,r=r+Math.imul(R,Tt)|0,f=f+Math.imul(R,ht)|0;var ie=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(ie>>>26)|0,ie&=67108863,d=Math.imul(Mt,_t),r=Math.imul(Mt,et),r=r+Math.imul(Q,_t)|0,f=Math.imul(Q,et),d=d+Math.imul(yt,St)|0,r=r+Math.imul(yt,rt)|0,r=r+Math.imul(J,St)|0,f=f+Math.imul(J,rt)|0,d=d+Math.imul(vt,At)|0,r=r+Math.imul(vt,it)|0,r=r+Math.imul(V,At)|0,f=f+Math.imul(V,it)|0,d=d+Math.imul(H,Et)|0,r=r+Math.imul(H,nt)|0,r=r+Math.imul(D,Et)|0,f=f+Math.imul(D,nt)|0,d=d+Math.imul(I,kt)|0,r=r+Math.imul(I,at)|0,r=r+Math.imul(E,kt)|0,f=f+Math.imul(E,at)|0,d=d+Math.imul(wt,Rt)|0,r=r+Math.imul(wt,ft)|0,r=r+Math.imul(Y,Rt)|0,f=f+Math.imul(Y,ft)|0,d=d+Math.imul(gt,Bt)|0,r=r+Math.imul(gt,ot)|0,r=r+Math.imul(j,Bt)|0,f=f+Math.imul(j,ot)|0,d=d+Math.imul(G,It)|0,r=r+Math.imul(G,st)|0,r=r+Math.imul(Z,It)|0,f=f+Math.imul(Z,st)|0,d=d+Math.imul(F,Tt)|0,r=r+Math.imul(F,ht)|0,r=r+Math.imul(z,Tt)|0,f=f+Math.imul(z,ht)|0;var ne=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(ne>>>26)|0,ne&=67108863,d=Math.imul(Mt,St),r=Math.imul(Mt,rt),r=r+Math.imul(Q,St)|0,f=Math.imul(Q,rt),d=d+Math.imul(yt,At)|0,r=r+Math.imul(yt,it)|0,r=r+Math.imul(J,At)|0,f=f+Math.imul(J,it)|0,d=d+Math.imul(vt,Et)|0,r=r+Math.imul(vt,nt)|0,r=r+Math.imul(V,Et)|0,f=f+Math.imul(V,nt)|0,d=d+Math.imul(H,kt)|0,r=r+Math.imul(H,at)|0,r=r+Math.imul(D,kt)|0,f=f+Math.imul(D,at)|0,d=d+Math.imul(I,Rt)|0,r=r+Math.imul(I,ft)|0,r=r+Math.imul(E,Rt)|0,f=f+Math.imul(E,ft)|0,d=d+Math.imul(wt,Bt)|0,r=r+Math.imul(wt,ot)|0,r=r+Math.imul(Y,Bt)|0,f=f+Math.imul(Y,ot)|0,d=d+Math.imul(gt,It)|0,r=r+Math.imul(gt,st)|0,r=r+Math.imul(j,It)|0,f=f+Math.imul(j,st)|0,d=d+Math.imul(G,Tt)|0,r=r+Math.imul(G,ht)|0,r=r+Math.imul(Z,Tt)|0,f=f+Math.imul(Z,ht)|0;var ae=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(ae>>>26)|0,ae&=67108863,d=Math.imul(Mt,At),r=Math.imul(Mt,it),r=r+Math.imul(Q,At)|0,f=Math.imul(Q,it),d=d+Math.imul(yt,Et)|0,r=r+Math.imul(yt,nt)|0,r=r+Math.imul(J,Et)|0,f=f+Math.imul(J,nt)|0,d=d+Math.imul(vt,kt)|0,r=r+Math.imul(vt,at)|0,r=r+Math.imul(V,kt)|0,f=f+Math.imul(V,at)|0,d=d+Math.imul(H,Rt)|0,r=r+Math.imul(H,ft)|0,r=r+Math.imul(D,Rt)|0,f=f+Math.imul(D,ft)|0,d=d+Math.imul(I,Bt)|0,r=r+Math.imul(I,ot)|0,r=r+Math.imul(E,Bt)|0,f=f+Math.imul(E,ot)|0,d=d+Math.imul(wt,It)|0,r=r+Math.imul(wt,st)|0,r=r+Math.imul(Y,It)|0,f=f+Math.imul(Y,st)|0,d=d+Math.imul(gt,Tt)|0,r=r+Math.imul(gt,ht)|0,r=r+Math.imul(j,Tt)|0,f=f+Math.imul(j,ht)|0;var fe=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(fe>>>26)|0,fe&=67108863,d=Math.imul(Mt,Et),r=Math.imul(Mt,nt),r=r+Math.imul(Q,Et)|0,f=Math.imul(Q,nt),d=d+Math.imul(yt,kt)|0,r=r+Math.imul(yt,at)|0,r=r+Math.imul(J,kt)|0,f=f+Math.imul(J,at)|0,d=d+Math.imul(vt,Rt)|0,r=r+Math.imul(vt,ft)|0,r=r+Math.imul(V,Rt)|0,f=f+Math.imul(V,ft)|0,d=d+Math.imul(H,Bt)|0,r=r+Math.imul(H,ot)|0,r=r+Math.imul(D,Bt)|0,f=f+Math.imul(D,ot)|0,d=d+Math.imul(I,It)|0,r=r+Math.imul(I,st)|0,r=r+Math.imul(E,It)|0,f=f+Math.imul(E,st)|0,d=d+Math.imul(wt,Tt)|0,r=r+Math.imul(wt,ht)|0,r=r+Math.imul(Y,Tt)|0,f=f+Math.imul(Y,ht)|0;var oe=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(oe>>>26)|0,oe&=67108863,d=Math.imul(Mt,kt),r=Math.imul(Mt,at),r=r+Math.imul(Q,kt)|0,f=Math.imul(Q,at),d=d+Math.imul(yt,Rt)|0,r=r+Math.imul(yt,ft)|0,r=r+Math.imul(J,Rt)|0,f=f+Math.imul(J,ft)|0,d=d+Math.imul(vt,Bt)|0,r=r+Math.imul(vt,ot)|0,r=r+Math.imul(V,Bt)|0,f=f+Math.imul(V,ot)|0,d=d+Math.imul(H,It)|0,r=r+Math.imul(H,st)|0,r=r+Math.imul(D,It)|0,f=f+Math.imul(D,st)|0,d=d+Math.imul(I,Tt)|0,r=r+Math.imul(I,ht)|0,r=r+Math.imul(E,Tt)|0,f=f+Math.imul(E,ht)|0;var se=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(se>>>26)|0,se&=67108863,d=Math.imul(Mt,Rt),r=Math.imul(Mt,ft),r=r+Math.imul(Q,Rt)|0,f=Math.imul(Q,ft),d=d+Math.imul(yt,Bt)|0,r=r+Math.imul(yt,ot)|0,r=r+Math.imul(J,Bt)|0,f=f+Math.imul(J,ot)|0,d=d+Math.imul(vt,It)|0,r=r+Math.imul(vt,st)|0,r=r+Math.imul(V,It)|0,f=f+Math.imul(V,st)|0,d=d+Math.imul(H,Tt)|0,r=r+Math.imul(H,ht)|0,r=r+Math.imul(D,Tt)|0,f=f+Math.imul(D,ht)|0;var he=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(he>>>26)|0,he&=67108863,d=Math.imul(Mt,Bt),r=Math.imul(Mt,ot),r=r+Math.imul(Q,Bt)|0,f=Math.imul(Q,ot),d=d+Math.imul(yt,It)|0,r=r+Math.imul(yt,st)|0,r=r+Math.imul(J,It)|0,f=f+Math.imul(J,st)|0,d=d+Math.imul(vt,Tt)|0,r=r+Math.imul(vt,ht)|0,r=r+Math.imul(V,Tt)|0,f=f+Math.imul(V,ht)|0;var ue=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(ue>>>26)|0,ue&=67108863,d=Math.imul(Mt,It),r=Math.imul(Mt,st),r=r+Math.imul(Q,It)|0,f=Math.imul(Q,st),d=d+Math.imul(yt,Tt)|0,r=r+Math.imul(yt,ht)|0,r=r+Math.imul(J,Tt)|0,f=f+Math.imul(J,ht)|0;var le=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(le>>>26)|0,le&=67108863,d=Math.imul(Mt,Tt),r=Math.imul(Mt,ht),r=r+Math.imul(Q,Tt)|0,f=Math.imul(Q,ht);var ce=(p+d|0)+((r&8191)<<13)|0;return p=(f+(r>>>13)|0)+(ce>>>26)|0,ce&=67108863,c[0]=Pt,c[1]=Jt,c[2]=jt,c[3]=Yt,c[4]=Xt,c[5]=Qt,c[6]=te,c[7]=ee,c[8]=re,c[9]=ie,c[10]=ne,c[11]=ae,c[12]=fe,c[13]=oe,c[14]=se,c[15]=he,c[16]=ue,c[17]=le,c[18]=ce,p!==0&&(c[19]=p,i.length++),i};Math.imul||(M=$);function N(g,e,t){t.negative=e.negative^g.negative,t.length=g.length+e.length;for(var i=0,s=0,l=0;l<t.length-1;l++){var c=s;s=0;for(var p=i&67108863,d=Math.min(l,e.length-1),r=Math.max(0,l-g.length+1);r<=d;r++){var f=l-r,m=g.words[f]|0,_=e.words[r]|0,R=m*_,C=R&67108863;c=c+(R/67108864|0)|0,C=C+p|0,p=C&67108863,c=c+(C>>>26)|0,s+=c>>>26,c&=67108863}t.words[l]=p,i=c,c=s}return i!==0?t.words[l]=i:t.length--,t.strip()}function x(g,e,t){var i=new A;return i.mulp(g,e,t)}o.prototype.mulTo=function(e,t){var i,s=this.length+e.length;return this.length===10&&e.length===10?i=M(this,e,t):s<63?i=$(this,e,t):s<1024?i=N(this,e,t):i=x(this,e,t),i};function A(g,e){this.x=g,this.y=e}A.prototype.makeRBT=function(e){for(var t=new Array(e),i=o.prototype._countBits(e)-1,s=0;s<e;s++)t[s]=this.revBin(s,i,e);return t},A.prototype.revBin=function(e,t,i){if(e===0||e===i-1)return e;for(var s=0,l=0;l<t;l++)s|=(e&1)<<t-l-1,e>>=1;return s},A.prototype.permute=function(e,t,i,s,l,c){for(var p=0;p<c;p++)s[p]=t[e[p]],l[p]=i[e[p]]},A.prototype.transform=function(e,t,i,s,l,c){this.permute(c,e,t,i,s,l);for(var p=1;p<l;p<<=1)for(var d=p<<1,r=Math.cos(2*Math.PI/d),f=Math.sin(2*Math.PI/d),m=0;m<l;m+=d)for(var _=r,R=f,C=0;C<p;C++){var F=i[m+C],z=s[m+C],lt=i[m+C+p],G=s[m+C+p],Z=_*lt-R*G;G=_*G+R*lt,lt=Z,i[m+C]=F+lt,s[m+C]=z+G,i[m+C+p]=F-lt,s[m+C+p]=z-G,C!==d&&(Z=r*_-f*R,R=r*R+f*_,_=Z)}},A.prototype.guessLen13b=function(e,t){var i=Math.max(t,e)|1,s=i&1,l=0;for(i=i/2|0;i;i=i>>>1)l++;return 1<<l+1+s},A.prototype.conjugate=function(e,t,i){if(!(i<=1))for(var s=0;s<i/2;s++){var l=e[s];e[s]=e[i-s-1],e[i-s-1]=l,l=t[s],t[s]=-t[i-s-1],t[i-s-1]=-l}},A.prototype.normalize13b=function(e,t){for(var i=0,s=0;s<t/2;s++){var l=Math.round(e[2*s+1]/t)*8192+Math.round(e[2*s]/t)+i;e[s]=l&67108863,l<67108864?i=0:i=l/67108864|0}return e},A.prototype.convert13b=function(e,t,i,s){for(var l=0,c=0;c<t;c++)l=l+(e[c]|0),i[2*c]=l&8191,l=l>>>13,i[2*c+1]=l&8191,l=l>>>13;for(c=2*t;c<s;++c)i[c]=0;u(l===0),u((l&-8192)===0)},A.prototype.stub=function(e){for(var t=new Array(e),i=0;i<e;i++)t[i]=0;return t},A.prototype.mulp=function(e,t,i){var s=2*this.guessLen13b(e.length,t.length),l=this.makeRBT(s),c=this.stub(s),p=new Array(s),d=new Array(s),r=new Array(s),f=new Array(s),m=new Array(s),_=new Array(s),R=i.words;R.length=s,this.convert13b(e.words,e.length,p,s),this.convert13b(t.words,t.length,f,s),this.transform(p,c,d,r,s,l),this.transform(f,c,m,_,s,l);for(var C=0;C<s;C++){var F=d[C]*m[C]-r[C]*_[C];r[C]=d[C]*_[C]+r[C]*m[C],d[C]=F}return this.conjugate(d,r,s),this.transform(d,r,R,c,s,l),this.conjugate(R,c,s),this.normalize13b(R,s),i.negative=e.negative^t.negative,i.length=e.length+t.length,i.strip()},o.prototype.mul=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},o.prototype.mulf=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),x(this,e,t)},o.prototype.imul=function(e){return this.clone().mulTo(e,this)},o.prototype.imuln=function(e){u(typeof e=="number"),u(e<67108864);for(var t=0,i=0;i<this.length;i++){var s=(this.words[i]|0)*e,l=(s&67108863)+(t&67108863);t>>=26,t+=s/67108864|0,t+=l>>>26,this.words[i]=l&67108863}return t!==0&&(this.words[i]=t,this.length++),this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=q(e);if(t.length===0)return new o(1);for(var i=this,s=0;s<t.length&&t[s]===0;s++,i=i.sqr());if(++s<t.length)for(var l=i.sqr();s<t.length;s++,l=l.sqr())t[s]!==0&&(i=i.mul(l));return i},o.prototype.iushln=function(e){u(typeof e=="number"&&e>=0);var t=e%26,i=(e-t)/26,s=67108863>>>26-t<<26-t,l;if(t!==0){var c=0;for(l=0;l<this.length;l++){var p=this.words[l]&s,d=(this.words[l]|0)-p<<t;this.words[l]=d|c,c=p>>>26-t}c&&(this.words[l]=c,this.length++)}if(i!==0){for(l=this.length-1;l>=0;l--)this.words[l+i]=this.words[l];for(l=0;l<i;l++)this.words[l]=0;this.length+=i}return this.strip()},o.prototype.ishln=function(e){return u(this.negative===0),this.iushln(e)},o.prototype.iushrn=function(e,t,i){u(typeof e=="number"&&e>=0);var s;t?s=(t-t%26)/26:s=0;var l=e%26,c=Math.min((e-l)/26,this.length),p=67108863^67108863>>>l<<l,d=i;if(s-=c,s=Math.max(0,s),d){for(var r=0;r<c;r++)d.words[r]=this.words[r];d.length=c}if(c!==0)if(this.length>c)for(this.length-=c,r=0;r<this.length;r++)this.words[r]=this.words[r+c];else this.words[0]=0,this.length=1;var f=0;for(r=this.length-1;r>=0&&(f!==0||r>=s);r--){var m=this.words[r]|0;this.words[r]=f<<26-l|m>>>l,f=m&p}return d&&f!==0&&(d.words[d.length++]=f),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(e,t,i){return u(this.negative===0),this.iushrn(e,t,i)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){u(typeof e=="number"&&e>=0);var t=e%26,i=(e-t)/26,s=1<<t;if(this.length<=i)return!1;var l=this.words[i];return!!(l&s)},o.prototype.imaskn=function(e){u(typeof e=="number"&&e>=0);var t=e%26,i=(e-t)/26;if(u(this.negative===0,"imaskn works only with positive numbers"),this.length<=i)return this;if(t!==0&&i++,this.length=Math.min(i,this.length),t!==0){var s=67108863^67108863>>>t<<t;this.words[this.length-1]&=s}return this.strip()},o.prototype.maskn=function(e){return this.clone().imaskn(e)},o.prototype.iaddn=function(e){return u(typeof e=="number"),u(e<67108864),e<0?this.isubn(-e):this.negative!==0?this.length===1&&(this.words[0]|0)<e?(this.words[0]=e-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},o.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(u(typeof e=="number"),u(e<67108864),e<0)return this.iaddn(-e);if(this.negative!==0)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.strip()},o.prototype.addn=function(e){return this.clone().iaddn(e)},o.prototype.subn=function(e){return this.clone().isubn(e)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(e,t,i){var s=e.length+i,l;this._expand(s);var c,p=0;for(l=0;l<e.length;l++){c=(this.words[l+i]|0)+p;var d=(e.words[l]|0)*t;c-=d&67108863,p=(c>>26)-(d/67108864|0),this.words[l+i]=c&67108863}for(;l<this.length-i;l++)c=(this.words[l+i]|0)+p,p=c>>26,this.words[l+i]=c&67108863;if(p===0)return this.strip();for(u(p===-1),p=0,l=0;l<this.length;l++)c=-(this.words[l]|0)+p,p=c>>26,this.words[l]=c&67108863;return this.negative=1,this.strip()},o.prototype._wordDiv=function(e,t){var i=this.length-e.length,s=this.clone(),l=e,c=l.words[l.length-1]|0,p=this._countBits(c);i=26-p,i!==0&&(l=l.ushln(i),s.iushln(i),c=l.words[l.length-1]|0);var d=s.length-l.length,r;if(t!=="mod"){r=new o(null),r.length=d+1,r.words=new Array(r.length);for(var f=0;f<r.length;f++)r.words[f]=0}var m=s.clone()._ishlnsubmul(l,1,d);m.negative===0&&(s=m,r&&(r.words[d]=1));for(var _=d-1;_>=0;_--){var R=(s.words[l.length+_]|0)*67108864+(s.words[l.length+_-1]|0);for(R=Math.min(R/c|0,67108863),s._ishlnsubmul(l,R,_);s.negative!==0;)R--,s.negative=0,s._ishlnsubmul(l,1,_),s.isZero()||(s.negative^=1);r&&(r.words[_]=R)}return r&&r.strip(),s.strip(),t!=="div"&&i!==0&&s.iushrn(i),{div:r||null,mod:s}},o.prototype.divmod=function(e,t,i){if(u(!e.isZero()),this.isZero())return{div:new o(0),mod:new o(0)};var s,l,c;return this.negative!==0&&e.negative===0?(c=this.neg().divmod(e,t),t!=="mod"&&(s=c.div.neg()),t!=="div"&&(l=c.mod.neg(),i&&l.negative!==0&&l.iadd(e)),{div:s,mod:l}):this.negative===0&&e.negative!==0?(c=this.divmod(e.neg(),t),t!=="mod"&&(s=c.div.neg()),{div:s,mod:c.mod}):this.negative&e.negative?(c=this.neg().divmod(e.neg(),t),t!=="div"&&(l=c.mod.neg(),i&&l.negative!==0&&l.isub(e)),{div:c.div,mod:l}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:e.length===1?t==="div"?{div:this.divn(e.words[0]),mod:null}:t==="mod"?{div:null,mod:new o(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modn(e.words[0]))}:this._wordDiv(e,t)},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var i=t.div.negative!==0?t.mod.isub(e):t.mod,s=e.ushrn(1),l=e.andln(1),c=i.cmp(s);return c<0||l===1&&c===0?t.div:t.div.negative!==0?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modn=function(e){u(e<=67108863);for(var t=(1<<26)%e,i=0,s=this.length-1;s>=0;s--)i=(t*i+(this.words[s]|0))%e;return i},o.prototype.idivn=function(e){u(e<=67108863);for(var t=0,i=this.length-1;i>=0;i--){var s=(this.words[i]|0)+t*67108864;this.words[i]=s/e|0,t=s%e}return this.strip()},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){u(e.negative===0),u(!e.isZero());var t=this,i=e.clone();t.negative!==0?t=t.umod(e):t=t.clone();for(var s=new o(1),l=new o(0),c=new o(0),p=new o(1),d=0;t.isEven()&&i.isEven();)t.iushrn(1),i.iushrn(1),++d;for(var r=i.clone(),f=t.clone();!t.isZero();){for(var m=0,_=1;!(t.words[0]&_)&&m<26;++m,_<<=1);if(m>0)for(t.iushrn(m);m-- >0;)(s.isOdd()||l.isOdd())&&(s.iadd(r),l.isub(f)),s.iushrn(1),l.iushrn(1);for(var R=0,C=1;!(i.words[0]&C)&&R<26;++R,C<<=1);if(R>0)for(i.iushrn(R);R-- >0;)(c.isOdd()||p.isOdd())&&(c.iadd(r),p.isub(f)),c.iushrn(1),p.iushrn(1);t.cmp(i)>=0?(t.isub(i),s.isub(c),l.isub(p)):(i.isub(t),c.isub(s),p.isub(l))}return{a:c,b:p,gcd:i.iushln(d)}},o.prototype._invmp=function(e){u(e.negative===0),u(!e.isZero());var t=this,i=e.clone();t.negative!==0?t=t.umod(e):t=t.clone();for(var s=new o(1),l=new o(0),c=i.clone();t.cmpn(1)>0&&i.cmpn(1)>0;){for(var p=0,d=1;!(t.words[0]&d)&&p<26;++p,d<<=1);if(p>0)for(t.iushrn(p);p-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);for(var r=0,f=1;!(i.words[0]&f)&&r<26;++r,f<<=1);if(r>0)for(i.iushrn(r);r-- >0;)l.isOdd()&&l.iadd(c),l.iushrn(1);t.cmp(i)>=0?(t.isub(i),s.isub(l)):(i.isub(t),l.isub(s))}var m;return t.cmpn(1)===0?m=s:m=l,m.cmpn(0)<0&&m.iadd(e),m},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),i=e.clone();t.negative=0,i.negative=0;for(var s=0;t.isEven()&&i.isEven();s++)t.iushrn(1),i.iushrn(1);do{for(;t.isEven();)t.iushrn(1);for(;i.isEven();)i.iushrn(1);var l=t.cmp(i);if(l<0){var c=t;t=i,i=c}else if(l===0||i.cmpn(1)===0)break;t.isub(i)}while(!0);return i.iushln(s)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return(this.words[0]&1)===0},o.prototype.isOdd=function(){return(this.words[0]&1)===1},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){u(typeof e=="number");var t=e%26,i=(e-t)/26,s=1<<t;if(this.length<=i)return this._expand(i+1),this.words[i]|=s,this;for(var l=s,c=i;l!==0&&c<this.length;c++){var p=this.words[c]|0;p+=l,l=p>>>26,p&=67108863,this.words[c]=p}return l!==0&&(this.words[c]=l,this.length++),this},o.prototype.isZero=function(){return this.length===1&&this.words[0]===0},o.prototype.cmpn=function(e){var t=e<0;if(this.negative!==0&&!t)return-1;if(this.negative===0&&t)return 1;this.strip();var i;if(this.length>1)i=1;else{t&&(e=-e),u(e<=67108863,"Number is too big");var s=this.words[0]|0;i=s===e?0:s<e?-1:1}return this.negative!==0?-i|0:i},o.prototype.cmp=function(e){if(this.negative!==0&&e.negative===0)return-1;if(this.negative===0&&e.negative!==0)return 1;var t=this.ucmp(e);return this.negative!==0?-t|0:t},o.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,i=this.length-1;i>=0;i--){var s=this.words[i]|0,l=e.words[i]|0;if(s!==l){s<l?t=-1:s>l&&(t=1);break}}return t},o.prototype.gtn=function(e){return this.cmpn(e)===1},o.prototype.gt=function(e){return this.cmp(e)===1},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return this.cmpn(e)===-1},o.prototype.lt=function(e){return this.cmp(e)===-1},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return this.cmpn(e)===0},o.prototype.eq=function(e){return this.cmp(e)===0},o.red=function(e){return new ct(e)},o.prototype.toRed=function(e){return u(!this.red,"Already a number in reduction context"),u(this.negative===0,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return u(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return u(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return u(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return u(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return u(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return u(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return u(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return u(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return u(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return u(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return u(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return u(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return u(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return u(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return u(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var S={k256:null,p224:null,p192:null,p25519:null};function T(g,e){this.name=g,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}T.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},T.prototype.ireduce=function(e){var t=e,i;do this.split(t,this.tmp),t=this.imulK(t),t=t.iadd(this.tmp),i=t.bitLength();while(i>this.n);var s=i<this.n?-1:t.ucmp(this.p);return s===0?(t.words[0]=0,t.length=1):s>0?t.isub(this.p):t.strip(),t},T.prototype.split=function(e,t){e.iushrn(this.n,0,t)},T.prototype.imulK=function(e){return e.imul(this.k)};function O(){T.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}v(O,T),O.prototype.split=function(e,t){for(var i=4194303,s=Math.min(e.length,9),l=0;l<s;l++)t.words[l]=e.words[l];if(t.length=s,e.length<=9){e.words[0]=0,e.length=1;return}var c=e.words[9];for(t.words[t.length++]=c&i,l=10;l<e.length;l++){var p=e.words[l]|0;e.words[l-10]=(p&i)<<4|c>>>22,c=p}c>>>=22,e.words[l-10]=c,c===0&&e.length>10?e.length-=10:e.length-=9},O.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,i=0;i<e.length;i++){var s=e.words[i]|0;t+=s*977,e.words[i]=t&67108863,t=s*64+(t/67108864|0)}return e.words[e.length-1]===0&&(e.length--,e.words[e.length-1]===0&&e.length--),e};function W(){T.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}v(W,T);function K(){T.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}v(K,T);function pt(){T.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}v(pt,T),pt.prototype.imulK=function(e){for(var t=0,i=0;i<e.length;i++){var s=(e.words[i]|0)*19+t,l=s&67108863;s>>>=26,e.words[i]=l,t=s}return t!==0&&(e.words[e.length++]=t),e},o._prime=function(e){if(S[e])return S[e];var t;if(e==="k256")t=new O;else if(e==="p224")t=new W;else if(e==="p192")t=new K;else if(e==="p25519")t=new pt;else throw new Error("Unknown prime "+e);return S[e]=t,t};function ct(g){if(typeof g=="string"){var e=o._prime(g);this.m=e.p,this.prime=e}else u(g.gtn(1),"modulus must be greater than 1"),this.m=g,this.prime=null}ct.prototype._verify1=function(e){u(e.negative===0,"red works only with positives"),u(e.red,"red works only with red numbers")},ct.prototype._verify2=function(e,t){u((e.negative|t.negative)===0,"red works only with positives"),u(e.red&&e.red===t.red,"red works only with red numbers")},ct.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},ct.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},ct.prototype.add=function(e,t){this._verify2(e,t);var i=e.add(t);return i.cmp(this.m)>=0&&i.isub(this.m),i._forceRed(this)},ct.prototype.iadd=function(e,t){this._verify2(e,t);var i=e.iadd(t);return i.cmp(this.m)>=0&&i.isub(this.m),i},ct.prototype.sub=function(e,t){this._verify2(e,t);var i=e.sub(t);return i.cmpn(0)<0&&i.iadd(this.m),i._forceRed(this)},ct.prototype.isub=function(e,t){this._verify2(e,t);var i=e.isub(t);return i.cmpn(0)<0&&i.iadd(this.m),i},ct.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},ct.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},ct.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},ct.prototype.isqr=function(e){return this.imul(e,e.clone())},ct.prototype.sqr=function(e){return this.mul(e,e)},ct.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(u(t%2===1),t===3){var i=this.m.add(new o(1)).iushrn(2);return this.pow(e,i)}for(var s=this.m.subn(1),l=0;!s.isZero()&&s.andln(1)===0;)l++,s.iushrn(1);u(!s.isZero());var c=new o(1).toRed(this),p=c.redNeg(),d=this.m.subn(1).iushrn(1),r=this.m.bitLength();for(r=new o(2*r*r).toRed(this);this.pow(r,d).cmp(p)!==0;)r.redIAdd(p);for(var f=this.pow(r,s),m=this.pow(e,s.addn(1).iushrn(1)),_=this.pow(e,s),R=l;_.cmp(c)!==0;){for(var C=_,F=0;C.cmp(c)!==0;F++)C=C.redSqr();u(F<R);var z=this.pow(f,new o(1).iushln(R-F-1));m=m.redMul(z),f=z.redSqr(),_=_.redMul(f),R=F}return m},ct.prototype.invm=function(e){var t=e._invmp(this.m);return t.negative!==0?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},ct.prototype.pow=function(e,t){if(t.isZero())return new o(1).toRed(this);if(t.cmpn(1)===0)return e.clone();var i=4,s=new Array(1<<i);s[0]=new o(1).toRed(this),s[1]=e;for(var l=2;l<s.length;l++)s[l]=this.mul(s[l-1],e);var c=s[0],p=0,d=0,r=t.bitLength()%26;for(r===0&&(r=26),l=t.length-1;l>=0;l--){for(var f=t.words[l],m=r-1;m>=0;m--){var _=f>>m&1;if(c!==s[0]&&(c=this.sqr(c)),_===0&&p===0){d=0;continue}p<<=1,p|=_,d++,!(d!==i&&(l!==0||m!==0))&&(c=this.mul(c,s[p]),d=0,p=0)}r=26}return c},ct.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},ct.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new dt(e)};function dt(g){ct.call(this,g),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v(dt,ct),dt.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},dt.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},dt.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var i=e.imul(t),s=i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),l=i.isub(s).iushrn(this.shift),c=l;return l.cmp(this.m)>=0?c=l.isub(this.m):l.cmpn(0)<0&&(c=l.iadd(this.m)),c._forceRed(this)},dt.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var i=e.mul(t),s=i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),l=i.isub(s).iushrn(this.shift),c=l;return l.cmp(this.m)>=0?c=l.isub(this.m):l.cmpn(0)<0&&(c=l.iadd(this.m)),c._forceRed(this)},dt.prototype.invm=function(e){var t=this.imod(e._invmp(this.m).mul(this.r2));return t._forceRed(this)}})(a,Vt)})(Ko);Ko.exports;var Zo={};(function(a){const n=Ki,h=Zi,u=Hi,v=x=>x==null;function o(x){switch(x.arrayFormat){case"index":return A=>(S,T)=>{const O=S.length;return T===void 0||x.skipNull&&T===null||x.skipEmptyString&&T===""?S:T===null?[...S,[b(A,x),"[",O,"]"].join("")]:[...S,[b(A,x),"[",b(O,x),"]=",b(T,x)].join("")]};case"bracket":return A=>(S,T)=>T===void 0||x.skipNull&&T===null||x.skipEmptyString&&T===""?S:T===null?[...S,[b(A,x),"[]"].join("")]:[...S,[b(A,x),"[]=",b(T,x)].join("")];case"comma":case"separator":return A=>(S,T)=>T==null||T.length===0?S:S.length===0?[[b(A,x),"=",b(T,x)].join("")]:[[S,b(T,x)].join(x.arrayFormatSeparator)];default:return A=>(S,T)=>T===void 0||x.skipNull&&T===null||x.skipEmptyString&&T===""?S:T===null?[...S,b(A,x)]:[...S,[b(A,x),"=",b(T,x)].join("")]}}function w(x){let A;switch(x.arrayFormat){case"index":return(S,T,O)=>{if(A=/\[(\d*)\]$/.exec(S),S=S.replace(/\[\d*\]$/,""),!A){O[S]=T;return}O[S]===void 0&&(O[S]={}),O[S][A[1]]=T};case"bracket":return(S,T,O)=>{if(A=/(\[\])$/.exec(S),S=S.replace(/\[\]$/,""),!A){O[S]=T;return}if(O[S]===void 0){O[S]=[T];return}O[S]=[].concat(O[S],T)};case"comma":case"separator":return(S,T,O)=>{const K=typeof T=="string"&&T.split("").indexOf(x.arrayFormatSeparator)>-1?T.split(x.arrayFormatSeparator).map(pt=>B(pt,x)):T===null?T:B(T,x);O[S]=K};default:return(S,T,O)=>{if(O[S]===void 0){O[S]=T;return}O[S]=[].concat(O[S],T)}}}function y(x){if(typeof x!="string"||x.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function b(x,A){return A.encode?A.strict?n(x):encodeURIComponent(x):x}function B(x,A){return A.decode?h(x):x}function k(x){return Array.isArray(x)?x.sort():typeof x=="object"?k(Object.keys(x)).sort((A,S)=>Number(A)-Number(S)).map(A=>x[A]):x}function L(x){const A=x.indexOf("#");return A!==-1&&(x=x.slice(0,A)),x}function q(x){let A="";const S=x.indexOf("#");return S!==-1&&(A=x.slice(S)),A}function $(x){x=L(x);const A=x.indexOf("?");return A===-1?"":x.slice(A+1)}function M(x,A){return A.parseNumbers&&!Number.isNaN(Number(x))&&typeof x=="string"&&x.trim()!==""?x=Number(x):A.parseBooleans&&x!==null&&(x.toLowerCase()==="true"||x.toLowerCase()==="false")&&(x=x.toLowerCase()==="true"),x}function N(x,A){A=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},A),y(A.arrayFormatSeparator);const S=w(A),T=Object.create(null);if(typeof x!="string"||(x=x.trim().replace(/^[?#&]/,""),!x))return T;for(const O of x.split("&")){let[W,K]=u(A.decode?O.replace(/\+/g," "):O,"=");K=K===void 0?null:["comma","separator"].includes(A.arrayFormat)?K:B(K,A),S(B(W,A),K,T)}for(const O of Object.keys(T)){const W=T[O];if(typeof W=="object"&&W!==null)for(const K of Object.keys(W))W[K]=M(W[K],A);else T[O]=M(W,A)}return A.sort===!1?T:(A.sort===!0?Object.keys(T).sort():Object.keys(T).sort(A.sort)).reduce((O,W)=>{const K=T[W];return K&&typeof K=="object"&&!Array.isArray(K)?O[W]=k(K):O[W]=K,O},Object.create(null))}a.extract=$,a.parse=N,a.stringify=(x,A)=>{if(!x)return"";A=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},A),y(A.arrayFormatSeparator);const S=K=>A.skipNull&&v(x[K])||A.skipEmptyString&&x[K]==="",T=o(A),O={};for(const K of Object.keys(x))S(K)||(O[K]=x[K]);const W=Object.keys(O);return A.sort!==!1&&W.sort(A.sort),W.map(K=>{const pt=x[K];return pt===void 0?"":pt===null?b(K,A):Array.isArray(pt)?pt.reduce(T(K),[]).join("&"):b(K,A)+"="+b(pt,A)}).filter(K=>K.length>0).join("&")},a.parseUrl=(x,A)=>{A=Object.assign({decode:!0},A);const[S,T]=u(x,"#");return Object.assign({url:S.split("?")[0]||"",query:N($(x),A)},A&&A.parseFragmentIdentifier&&T?{fragmentIdentifier:B(T,A)}:{})},a.stringifyUrl=(x,A)=>{A=Object.assign({encode:!0,strict:!0},A);const S=L(x.url).split("?")[0]||"",T=a.extract(x.url),O=a.parse(T,{sort:!1}),W=Object.assign(O,x.query);let K=a.stringify(W,A);K&&(K=`?${K}`);let pt=q(x.url);return x.fragmentIdentifier&&(pt=`#${b(x.fragmentIdentifier,A)}`),`${S}${K}${pt}`}})(Zo);function Dw(a){const n=a.indexOf("?")!==-1?a.indexOf("?"):void 0;return typeof n<"u"?a.substr(n):""}function Hw(a,n){let h=Kw(a);return h=Object.assign(Object.assign({},h),n),a=Zw(h),a}function Kw(a){return Zo.parse(a)}function Zw(a){return Zo.stringify(a)}class Ww{constructor(){this._eventEmitters=[],typeof window<"u"&&typeof window.addEventListener<"u"&&(window.addEventListener("online",()=>this.trigger("online")),window.addEventListener("offline",()=>this.trigger("offline")))}on(n,h){this._eventEmitters.push({event:n,callback:h})}trigger(n){let h=[];n&&(h=this._eventEmitters.filter(u=>u.event===n)),h.forEach(u=>{u.callback()})}}const Vw=typeof v0.WebSocket<"u"?v0.WebSocket:zw();class Gw{constructor(n){if(this.opts=n,this._queue=[],this._events=[],this._subscriptions=[],this._protocol=n.protocol,this._version=n.version,this._url="",this._netMonitor=null,this._socket=null,this._nextSocket=null,this._subscriptions=n.subscriptions||[],this._netMonitor=n.netMonitor||new Ww,!n.url||typeof n.url!="string")throw new Error("Missing or invalid WebSocket url");this._url=n.url,this._netMonitor.on("online",()=>this._socketCreate())}set readyState(n){}get readyState(){return this._socket?this._socket.readyState:-1}set connecting(n){}get connecting(){return this.readyState===0}set connected(n){}get connected(){return this.readyState===1}set closing(n){}get closing(){return this.readyState===2}set closed(n){}get closed(){return this.readyState===3}open(){this._socketCreate()}close(){this._socketClose()}send(n,h,u){if(!h||typeof h!="string")throw new Error("Missing or invalid topic field");this._socketSend({topic:h,type:"pub",payload:n,silent:!!u})}subscribe(n){this._socketSend({topic:n,type:"sub",payload:"",silent:!0})}on(n,h){this._events.push({event:n,callback:h})}_socketCreate(){if(this._nextSocket)return;const n=Jw(this._url,this._protocol,this._version);if(this._nextSocket=new Vw(n),!this._nextSocket)throw new Error("Failed to create socket");this._nextSocket.onmessage=h=>this._socketReceive(h),this._nextSocket.onopen=()=>this._socketOpen(),this._nextSocket.onerror=h=>this._socketError(h),this._nextSocket.onclose=()=>{setTimeout(()=>{this._nextSocket=null,this._socketCreate()},1e3)}}_socketOpen(){this._socketClose(),this._socket=this._nextSocket,this._nextSocket=null,this._queueSubscriptions(),this._pushQueue()}_socketClose(){this._socket&&(this._socket.onclose=()=>{},this._socket.close())}_socketSend(n){const h=JSON.stringify(n);this._socket&&this._socket.readyState===1?this._socket.send(h):(this._setToQueue(n),this._socketCreate())}async _socketReceive(n){let h;try{h=JSON.parse(n.data)}catch{return}if(this._socketSend({topic:h.topic,type:"ack",payload:"",silent:!0}),this._socket&&this._socket.readyState===1){const u=this._events.filter(v=>v.event==="message");u&&u.length&&u.forEach(v=>v.callback(h))}}_socketError(n){const h=this._events.filter(u=>u.event==="error");h&&h.length&&h.forEach(u=>u.callback(n))}_queueSubscriptions(){this._subscriptions.forEach(h=>this._queue.push({topic:h,type:"sub",payload:"",silent:!0})),this._subscriptions=this.opts.subscriptions||[]}_setToQueue(n){this._queue.push(n)}_pushQueue(){this._queue.forEach(h=>this._socketSend(h)),this._queue=[]}}function Jw(a,n,h){var u,v;const w=(a.startsWith("https")?a.replace("https","wss"):a.startsWith("http")?a.replace("http","ws"):a).split("?"),y=uu()?{protocol:n,version:h,env:"browser",host:((u=du())===null||u===void 0?void 0:u.host)||""}:{protocol:n,version:h,env:((v=pa())===null||v===void 0?void 0:v.name)||""},b=Hw(Dw(w[1]||""),y);return w[0]+"?"+b}const Ga="Session currently connected",Tr="Session currently disconnected",jw="Session Rejected",Yw="Missing JSON RPC response",Xw='JSON-RPC success response must include "result" field',Qw='JSON-RPC error response must include "error" field',t2='JSON RPC request must have valid "method" value',e2='JSON RPC request must have valid "id" value',r2="Missing one of the required parameters: bridge / uri / session",Y0="JSON RPC response format is invalid",i2="URI format is invalid",n2="QRCode Modal not provided",X0="User close QRCode Modal";class a2{constructor(){this._eventEmitters=[]}subscribe(n){this._eventEmitters.push(n)}unsubscribe(n){this._eventEmitters=this._eventEmitters.filter(h=>h.event!==n)}trigger(n){let h=[],u;Cw(n)?u=n.method:Li(n)||Tn(n)?u=`response:${n.id}`:G0(n)?u=n.event:u="",u&&(h=this._eventEmitters.filter(v=>v.event===u)),(!h||!h.length)&&!Lw(u)&&!G0(u)&&(h=this._eventEmitters.filter(v=>v.event==="call_request")),h.forEach(v=>{if(Tn(n)){const o=new Error(n.error.message);v.callback(o,null)}else v.callback(null,n)})}}class f2{constructor(n="walletconnect"){this.storageId=n}getSession(){let n=null;const h=Fo(this.storageId);return h&&Fw(h)&&(n=h),n}setSession(n){return Uo(this.storageId,n),n}removeSession(){$o(this.storageId)}}const o2="walletconnect.org",s2="abcdefghijklmnopqrstuvwxyz0123456789",Cu=s2.split("").map(a=>`https://${a}.bridge.walletconnect.org`);function h2(a){let n=a.indexOf("//")>-1?a.split("/")[2]:a.split("/")[0];return n=n.split(":")[0],n=n.split("?")[0],n}function u2(a){return h2(a).split(".").slice(-2).join(".")}function l2(){return Math.floor(Math.random()*Cu.length)}function c2(){return Cu[l2()]}function d2(a){return u2(a)===o2}function v2(a){return d2(a)?c2():a}class p2{constructor(n){if(this.protocol="wc",this.version=1,this._bridge="",this._key=null,this._clientId="",this._clientMeta=null,this._peerId="",this._peerMeta=null,this._handshakeId=0,this._handshakeTopic="",this._connected=!1,this._accounts=[],this._chainId=0,this._networkId=0,this._rpcUrl="",this._eventManager=new a2,this._clientMeta=Lf()||n.connectorOpts.clientMeta||null,this._cryptoLib=n.cryptoLib,this._sessionStorage=n.sessionStorage||new f2(n.connectorOpts.storageId),this._qrcodeModal=n.connectorOpts.qrcodeModal,this._qrcodeModalOptions=n.connectorOpts.qrcodeModalOptions,this._signingMethods=[...wu,...n.connectorOpts.signingMethods||[]],!n.connectorOpts.bridge&&!n.connectorOpts.uri&&!n.connectorOpts.session)throw new Error(r2);n.connectorOpts.bridge&&(this.bridge=v2(n.connectorOpts.bridge)),n.connectorOpts.uri&&(this.uri=n.connectorOpts.uri);const h=n.connectorOpts.session||this._getStorageSession();h&&(this.session=h),this.handshakeId&&this._subscribeToSessionResponse(this.handshakeId,"Session request rejected"),this._transport=n.transport||new Gw({protocol:this.protocol,version:this.version,url:this.bridge,subscriptions:[this.clientId]}),this._subscribeToInternalEvents(),this._initTransport(),n.connectorOpts.uri&&this._subscribeToSessionRequest(),n.pushServerOpts&&this._registerPushServer(n.pushServerOpts)}set bridge(n){n&&(this._bridge=n)}get bridge(){return this._bridge}set key(n){if(!n)return;const h=kw(n);this._key=h}get key(){return this._key?Sw(this._key,!0):""}set clientId(n){n&&(this._clientId=n)}get clientId(){let n=this._clientId;return n||(n=this._clientId=Za()),this._clientId}set peerId(n){n&&(this._peerId=n)}get peerId(){return this._peerId}set clientMeta(n){}get clientMeta(){let n=this._clientMeta;return n||(n=this._clientMeta=Lf()),n}set peerMeta(n){this._peerMeta=n}get peerMeta(){return this._peerMeta}set handshakeTopic(n){n&&(this._handshakeTopic=n)}get handshakeTopic(){return this._handshakeTopic}set handshakeId(n){n&&(this._handshakeId=n)}get handshakeId(){return this._handshakeId}get uri(){return this._formatUri()}set uri(n){if(!n)return;const{handshakeTopic:h,bridge:u,key:v}=this._parseUri(n);this.handshakeTopic=h,this.bridge=u,this.key=v}set chainId(n){this._chainId=n}get chainId(){return this._chainId}set networkId(n){this._networkId=n}get networkId(){return this._networkId}set accounts(n){this._accounts=n}get accounts(){return this._accounts}set rpcUrl(n){this._rpcUrl=n}get rpcUrl(){return this._rpcUrl}set connected(n){}get connected(){return this._connected}set pending(n){}get pending(){return!!this._handshakeTopic}get session(){return{connected:this.connected,accounts:this.accounts,chainId:this.chainId,bridge:this.bridge,key:this.key,clientId:this.clientId,clientMeta:this.clientMeta,peerId:this.peerId,peerMeta:this.peerMeta,handshakeId:this.handshakeId,handshakeTopic:this.handshakeTopic}}set session(n){n&&(this._connected=n.connected,this.accounts=n.accounts,this.chainId=n.chainId,this.bridge=n.bridge,this.key=n.key,this.clientId=n.clientId,this.clientMeta=n.clientMeta,this.peerId=n.peerId,this.peerMeta=n.peerMeta,this.handshakeId=n.handshakeId,this.handshakeTopic=n.handshakeTopic)}on(n,h){const u={event:n,callback:h};this._eventManager.subscribe(u)}off(n){this._eventManager.unsubscribe(n)}async createInstantRequest(n){this._key=await this._generateKey();const h=this._formatRequest({method:"wc_instantRequest",params:[{peerId:this.clientId,peerMeta:this.clientMeta,request:this._formatRequest(n)}]});this.handshakeId=h.id,this.handshakeTopic=Za(),this._eventManager.trigger({event:"display_uri",params:[this.uri]}),this.on("modal_closed",()=>{throw new Error(X0)});const u=()=>{this.killSession()};try{const v=await this._sendCallRequest(h);return v&&u(),v}catch(v){throw u(),v}}async connect(n){if(!this._qrcodeModal)throw new Error(n2);return this.connected?{chainId:this.chainId,accounts:this.accounts}:(await this.createSession(n),new Promise(async(h,u)=>{this.on("modal_closed",()=>u(new Error(X0))),this.on("connect",(v,o)=>{if(v)return u(v);h(o.params[0])})}))}async createSession(n){if(this._connected)throw new Error(Ga);if(this.pending)return;this._key=await this._generateKey();const h=this._formatRequest({method:"wc_sessionRequest",params:[{peerId:this.clientId,peerMeta:this.clientMeta,chainId:n&&n.chainId?n.chainId:null}]});this.handshakeId=h.id,this.handshakeTopic=Za(),this._sendSessionRequest(h,"Session update rejected",{topic:this.handshakeTopic}),this._eventManager.trigger({event:"display_uri",params:[this.uri]})}approveSession(n){if(this._connected)throw new Error(Ga);this.chainId=n.chainId,this.accounts=n.accounts,this.networkId=n.networkId||0,this.rpcUrl=n.rpcUrl||"";const h={approved:!0,chainId:this.chainId,networkId:this.networkId,accounts:this.accounts,rpcUrl:this.rpcUrl,peerId:this.clientId,peerMeta:this.clientMeta},u={id:this.handshakeId,jsonrpc:"2.0",result:h};this._sendResponse(u),this._connected=!0,this._setStorageSession(),this._eventManager.trigger({event:"connect",params:[{peerId:this.peerId,peerMeta:this.peerMeta,chainId:this.chainId,accounts:this.accounts}]})}rejectSession(n){if(this._connected)throw new Error(Ga);const h=n&&n.message?n.message:jw,u=this._formatResponse({id:this.handshakeId,error:{message:h}});this._sendResponse(u),this._connected=!1,this._eventManager.trigger({event:"disconnect",params:[{message:h}]}),this._removeStorageSession()}updateSession(n){if(!this._connected)throw new Error(Tr);this.chainId=n.chainId,this.accounts=n.accounts,this.networkId=n.networkId||0,this.rpcUrl=n.rpcUrl||"";const h={approved:!0,chainId:this.chainId,networkId:this.networkId,accounts:this.accounts,rpcUrl:this.rpcUrl},u=this._formatRequest({method:"wc_sessionUpdate",params:[h]});this._sendSessionRequest(u,"Session update rejected"),this._eventManager.trigger({event:"session_update",params:[{chainId:this.chainId,accounts:this.accounts}]}),this._manageStorageSession()}async killSession(n){const h=n?n.message:"Session Disconnected",u={approved:!1,chainId:null,networkId:null,accounts:null},v=this._formatRequest({method:"wc_sessionUpdate",params:[u]});await this._sendRequest(v),this._handleSessionDisconnect(h)}async sendTransaction(n){if(!this._connected)throw new Error(Tr);const h=Wa(n),u=this._formatRequest({method:"eth_sendTransaction",params:[h]});return await this._sendCallRequest(u)}async signTransaction(n){if(!this._connected)throw new Error(Tr);const h=Wa(n),u=this._formatRequest({method:"eth_signTransaction",params:[h]});return await this._sendCallRequest(u)}async signMessage(n){if(!this._connected)throw new Error(Tr);const h=this._formatRequest({method:"eth_sign",params:n});return await this._sendCallRequest(h)}async signPersonalMessage(n){if(!this._connected)throw new Error(Tr);n=J0(n);const h=this._formatRequest({method:"personal_sign",params:n});return await this._sendCallRequest(h)}async signTypedData(n){if(!this._connected)throw new Error(Tr);const h=this._formatRequest({method:"eth_signTypedData",params:n});return await this._sendCallRequest(h)}async updateChain(n){if(!this._connected)throw new Error("Session currently disconnected");const h=this._formatRequest({method:"wallet_updateChain",params:[n]});return await this._sendCallRequest(h)}unsafeSend(n,h){return this._sendRequest(n,h),this._eventManager.trigger({event:"call_request_sent",params:[{request:n,options:h}]}),new Promise((u,v)=>{this._subscribeToResponse(n.id,(o,w)=>{if(o){v(o);return}if(!w)throw new Error(Yw);u(w)})})}async sendCustomRequest(n,h){if(!this._connected)throw new Error(Tr);switch(n.method){case"eth_accounts":return this.accounts;case"eth_chainId":return Bu(this.chainId);case"eth_sendTransaction":case"eth_signTransaction":n.params&&(n.params[0]=Wa(n.params[0]));break;case"personal_sign":n.params&&(n.params=J0(n.params));break}const u=this._formatRequest(n);return await this._sendCallRequest(u,h)}approveRequest(n){if(Li(n)){const h=this._formatResponse(n);this._sendResponse(h)}else throw new Error(Xw)}rejectRequest(n){if(Tn(n)){const h=this._formatResponse(n);this._sendResponse(h)}else throw new Error(Qw)}transportClose(){this._transport.close()}async _sendRequest(n,h){const u=this._formatRequest(n),v=await this._encrypt(u),o=typeof(h==null?void 0:h.topic)<"u"?h.topic:this.peerId,w=JSON.stringify(v),y=typeof(h==null?void 0:h.forcePushNotification)<"u"?!h.forcePushNotification:Pw(u);this._transport.send(w,o,y)}async _sendResponse(n){const h=await this._encrypt(n),u=this.peerId,v=JSON.stringify(h),o=!0;this._transport.send(v,u,o)}async _sendSessionRequest(n,h,u){this._sendRequest(n,u),this._subscribeToSessionResponse(n.id,h)}_sendCallRequest(n,h){return this._sendRequest(n,h),this._eventManager.trigger({event:"call_request_sent",params:[{request:n,options:h}]}),this._subscribeToCallResponse(n.id)}_formatRequest(n){if(typeof n.method>"u")throw new Error(t2);return{id:typeof n.id>"u"?Bw():n.id,jsonrpc:"2.0",method:n.method,params:typeof n.params>"u"?[]:n.params}}_formatResponse(n){if(typeof n.id>"u")throw new Error(e2);const h={id:n.id,jsonrpc:"2.0"};if(Tn(n)){const u=qw(n.error);return Object.assign(Object.assign(Object.assign({},h),n),{error:u})}else if(Li(n))return Object.assign(Object.assign({},h),n);throw new Error(Y0)}_handleSessionDisconnect(n){const h=n||"Session Disconnected";this._connected||(this._qrcodeModal&&this._qrcodeModal.close(),$o(In)),this._connected&&(this._connected=!1),this._handshakeId&&(this._handshakeId=0),this._handshakeTopic&&(this._handshakeTopic=""),this._peerId&&(this._peerId=""),this._eventManager.trigger({event:"disconnect",params:[{message:h}]}),this._removeStorageSession(),this.transportClose()}_handleSessionResponse(n,h){h?h.approved?(this._connected?(h.chainId&&(this.chainId=h.chainId),h.accounts&&(this.accounts=h.accounts),this._eventManager.trigger({event:"session_update",params:[{chainId:this.chainId,accounts:this.accounts}]})):(this._connected=!0,h.chainId&&(this.chainId=h.chainId),h.accounts&&(this.accounts=h.accounts),h.peerId&&!this.peerId&&(this.peerId=h.peerId),h.peerMeta&&!this.peerMeta&&(this.peerMeta=h.peerMeta),this._eventManager.trigger({event:"connect",params:[{peerId:this.peerId,peerMeta:this.peerMeta,chainId:this.chainId,accounts:this.accounts}]})),this._manageStorageSession()):this._handleSessionDisconnect(n):this._handleSessionDisconnect(n)}async _handleIncomingMessages(n){if(![this.clientId,this.handshakeTopic].includes(n.topic))return;let u;try{u=JSON.parse(n.payload)}catch{return}const v=await this._decrypt(u);v&&this._eventManager.trigger(v)}_subscribeToSessionRequest(){this._transport.subscribe(this.handshakeTopic)}_subscribeToResponse(n,h){this.on(`response:${n}`,h)}_subscribeToSessionResponse(n,h){this._subscribeToResponse(n,(u,v)=>{if(u){this._handleSessionResponse(u.message);return}Li(v)?this._handleSessionResponse(h,v.result):v.error&&v.error.message?this._handleSessionResponse(v.error.message):this._handleSessionResponse(h)})}_subscribeToCallResponse(n){return new Promise((h,u)=>{this._subscribeToResponse(n,(v,o)=>{if(v){u(v);return}Li(o)?h(o.result):o.error&&o.error.message?u(o.error):u(new Error(Y0))})})}_subscribeToInternalEvents(){this.on("display_uri",()=>{this._qrcodeModal&&this._qrcodeModal.open(this.uri,()=>{this._eventManager.trigger({event:"modal_closed",params:[]})},this._qrcodeModalOptions)}),this.on("connect",()=>{this._qrcodeModal&&this._qrcodeModal.close()}),this.on("call_request_sent",(n,h)=>{const{request:u}=h.params[0];if(su()&&this._signingMethods.includes(u.method)){const v=Fo(In);v&&(window.location.href=v.href)}}),this.on("wc_sessionRequest",(n,h)=>{n&&this._eventManager.trigger({event:"error",params:[{code:"SESSION_REQUEST_ERROR",message:n.toString()}]}),this.handshakeId=h.id,this.peerId=h.params[0].peerId,this.peerMeta=h.params[0].peerMeta;const u=Object.assign(Object.assign({},h),{method:"session_request"});this._eventManager.trigger(u)}),this.on("wc_sessionUpdate",(n,h)=>{n&&this._handleSessionResponse(n.message),this._handleSessionResponse("Session disconnected",h.params[0])})}_initTransport(){this._transport.on("message",n=>this._handleIncomingMessages(n)),this._transport.on("open",()=>this._eventManager.trigger({event:"transport_open",params:[]})),this._transport.on("close",()=>this._eventManager.trigger({event:"transport_close",params:[]})),this._transport.on("error",()=>this._eventManager.trigger({event:"transport_error",params:["Websocket connection failed"]})),this._transport.open()}_formatUri(){const n=this.protocol,h=this.handshakeTopic,u=this.version,v=encodeURIComponent(this.bridge),o=this.key;return`${n}:${h}@${u}?bridge=${v}&key=${o}`}_parseUri(n){const h=$w(n);if(h.protocol===this.protocol){if(!h.handshakeTopic)throw Error("Invalid or missing handshakeTopic parameter value");const u=h.handshakeTopic;if(!h.bridge)throw Error("Invalid or missing bridge url parameter value");const v=decodeURIComponent(h.bridge);if(!h.key)throw Error("Invalid or missing key parameter value");const o=h.key;return{handshakeTopic:u,bridge:v,key:o}}else throw new Error(i2)}async _generateKey(){return this._cryptoLib?await this._cryptoLib.generateKey():null}async _encrypt(n){const h=this._key;return this._cryptoLib&&h?await this._cryptoLib.encrypt(n,h):null}async _decrypt(n){const h=this._key;return this._cryptoLib&&h?await this._cryptoLib.decrypt(n,h):null}_getStorageSession(){let n=null;return this._sessionStorage&&(n=this._sessionStorage.getSession()),n}_setStorageSession(){this._sessionStorage&&this._sessionStorage.setSession(this.session)}_removeStorageSession(){this._sessionStorage&&this._sessionStorage.removeSession()}_manageStorageSession(){this._connected?this._setStorageSession():this._removeStorageSession()}_registerPushServer(n){if(!n.url||typeof n.url!="string")throw Error("Invalid or missing pushServerOpts.url parameter value");if(!n.type||typeof n.type!="string")throw Error("Invalid or missing pushServerOpts.type parameter value");if(!n.token||typeof n.token!="string")throw Error("Invalid or missing pushServerOpts.token parameter value");const h={bridge:this.bridge,topic:this.clientId,type:n.type,token:n.token,peerName:"",language:n.language||""};this.on("connect",async(u,v)=>{if(u)throw u;if(n.peerMeta){const o=v.params[0].peerMeta.name;h.peerName=o}try{if(!(await(await fetch(`${n.url}/new`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},body:JSON.stringify(h)})).json()).success)throw Error("Failed to register in Push Server")}catch{throw Error("Failed to register in Push Server")}})}}function m2(a){return Wi.getBrowerCrypto().getRandomValues(new Uint8Array(a))}const Lu=256,Pu=Lu,g2=Lu,_r="AES-CBC",y2=`SHA-${Pu}`,Pf="HMAC",w2="encrypt",b2="decrypt",M2="sign",x2="verify";function _2(a){return a===_r?{length:Pu,name:_r}:{hash:{name:y2},name:Pf}}function S2(a){return a===_r?[w2,b2]:[M2,x2]}async function Wo(a,n=_r){return Wi.getSubtleCrypto().importKey("raw",a,_2(n),!0,S2(n))}async function A2(a,n,h){const u=Wi.getSubtleCrypto(),v=await Wo(n,_r),o=await u.encrypt({iv:a,name:_r},v,h);return new Uint8Array(o)}async function E2(a,n,h){const u=Wi.getSubtleCrypto(),v=await Wo(n,_r),o=await u.decrypt({iv:a,name:_r},v,h);return new Uint8Array(o)}async function k2(a,n){const h=Wi.getSubtleCrypto(),u=await Wo(a,Pf),v=await h.sign({length:g2,name:Pf},u,n);return new Uint8Array(v)}function R2(a,n,h){return A2(a,n,h)}function B2(a,n,h){return E2(a,n,h)}async function Ou(a,n){return await k2(a,n)}var Vo={exports:{}};Vo.exports;(function(a){(function(n,h){function u(g,e){if(!g)throw new Error(e||"Assertion failed")}function v(g,e){g.super_=e;var t=function(){};t.prototype=e.prototype,g.prototype=new t,g.prototype.constructor=g}function o(g,e,t){if(o.isBN(g))return g;this.negative=0,this.words=null,this.length=0,this.red=null,g!==null&&((e==="le"||e==="be")&&(t=e,e=10),this._init(g||0,e||10,t||"be"))}typeof n=="object"?n.exports=o:h.BN=o,o.BN=o,o.wordSize=26;var w;try{w=Se.Buffer}catch{}o.isBN=function(e){return e instanceof o?!0:e!==null&&typeof e=="object"&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,i){if(typeof e=="number")return this._initNumber(e,t,i);if(typeof e=="object")return this._initArray(e,t,i);t==="hex"&&(t=16),u(t===(t|0)&&t>=2&&t<=36),e=e.toString().replace(/\s+/g,"");var s=0;e[0]==="-"&&s++,t===16?this._parseHex(e,s):this._parseBase(e,t,s),e[0]==="-"&&(this.negative=1),this.strip(),i==="le"&&this._initArray(this.toArray(),t,i)},o.prototype._initNumber=function(e,t,i){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[e&67108863],this.length=1):e<4503599627370496?(this.words=[e&67108863,e/67108864&67108863],this.length=2):(u(e<9007199254740992),this.words=[e&67108863,e/67108864&67108863,1],this.length=3),i==="le"&&this._initArray(this.toArray(),t,i)},o.prototype._initArray=function(e,t,i){if(u(typeof e.length=="number"),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var s=0;s<this.length;s++)this.words[s]=0;var l,c,p=0;if(i==="be")for(s=e.length-1,l=0;s>=0;s-=3)c=e[s]|e[s-1]<<8|e[s-2]<<16,this.words[l]|=c<<p&67108863,this.words[l+1]=c>>>26-p&67108863,p+=24,p>=26&&(p-=26,l++);else if(i==="le")for(s=0,l=0;s<e.length;s+=3)c=e[s]|e[s+1]<<8|e[s+2]<<16,this.words[l]|=c<<p&67108863,this.words[l+1]=c>>>26-p&67108863,p+=24,p>=26&&(p-=26,l++);return this.strip()};function y(g,e,t){for(var i=0,s=Math.min(g.length,t),l=e;l<s;l++){var c=g.charCodeAt(l)-48;i<<=4,c>=49&&c<=54?i|=c-49+10:c>=17&&c<=22?i|=c-17+10:i|=c&15}return i}o.prototype._parseHex=function(e,t){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var s,l,c=0;for(i=e.length-6,s=0;i>=t;i-=6)l=y(e,i,i+6),this.words[s]|=l<<c&67108863,this.words[s+1]|=l>>>26-c&4194303,c+=24,c>=26&&(c-=26,s++);i+6!==t&&(l=y(e,t,i+6),this.words[s]|=l<<c&67108863,this.words[s+1]|=l>>>26-c&4194303),this.strip()};function b(g,e,t,i){for(var s=0,l=Math.min(g.length,t),c=e;c<l;c++){var p=g.charCodeAt(c)-48;s*=i,p>=49?s+=p-49+10:p>=17?s+=p-17+10:s+=p}return s}o.prototype._parseBase=function(e,t,i){this.words=[0],this.length=1;for(var s=0,l=1;l<=67108863;l*=t)s++;s--,l=l/t|0;for(var c=e.length-i,p=c%s,d=Math.min(c,c-p)+i,r=0,f=i;f<d;f+=s)r=b(e,f,f+s,t),this.imuln(l),this.words[0]+r<67108864?this.words[0]+=r:this._iaddn(r);if(p!==0){var m=1;for(r=b(e,f,e.length,t),f=0;f<p;f++)m*=t;this.imuln(m),this.words[0]+r<67108864?this.words[0]+=r:this._iaddn(r)}},o.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},o.prototype.clone=function(){var e=new o(null);return this.copy(e),e},o.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},o.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var B=["","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"],k=[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],L=[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];o.prototype.toString=function(e,t){e=e||10,t=t|0||1;var i;if(e===16||e==="hex"){i="";for(var s=0,l=0,c=0;c<this.length;c++){var p=this.words[c],d=((p<<s|l)&16777215).toString(16);l=p>>>24-s&16777215,l!==0||c!==this.length-1?i=B[6-d.length]+d+i:i=d+i,s+=2,s>=26&&(s-=26,c--)}for(l!==0&&(i=l.toString(16)+i);i.length%t!==0;)i="0"+i;return this.negative!==0&&(i="-"+i),i}if(e===(e|0)&&e>=2&&e<=36){var r=k[e],f=L[e];i="";var m=this.clone();for(m.negative=0;!m.isZero();){var _=m.modn(f).toString(e);m=m.idivn(f),m.isZero()?i=_+i:i=B[r-_.length]+_+i}for(this.isZero()&&(i="0"+i);i.length%t!==0;)i="0"+i;return this.negative!==0&&(i="-"+i),i}u(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return this.length===2?e+=this.words[1]*67108864:this.length===3&&this.words[2]===1?e+=4503599627370496+this.words[1]*67108864:this.length>2&&u(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-e:e},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(e,t){return u(typeof w<"u"),this.toArrayLike(w,e,t)},o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},o.prototype.toArrayLike=function(e,t,i){var s=this.byteLength(),l=i||Math.max(1,s);u(s<=l,"byte array longer than desired length"),u(l>0,"Requested array length <= 0"),this.strip();var c=t==="le",p=new e(l),d,r,f=this.clone();if(c){for(r=0;!f.isZero();r++)d=f.andln(255),f.iushrn(8),p[r]=d;for(;r<l;r++)p[r]=0}else{for(r=0;r<l-s;r++)p[r]=0;for(r=0;!f.isZero();r++)d=f.andln(255),f.iushrn(8),p[l-r-1]=d}return p},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,i=0;return t>=4096&&(i+=13,t>>>=13),t>=64&&(i+=7,t>>>=7),t>=8&&(i+=4,t>>>=4),t>=2&&(i+=2,t>>>=2),i+t},o.prototype._zeroBits=function(e){if(e===0)return 26;var t=e,i=0;return t&8191||(i+=13,t>>>=13),t&127||(i+=7,t>>>=7),t&15||(i+=4,t>>>=4),t&3||(i+=2,t>>>=2),t&1||i++,i},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return(this.length-1)*26+t};function q(g){for(var e=new Array(g.bitLength()),t=0;t<e.length;t++){var i=t/26|0,s=t%26;e[t]=(g.words[i]&1<<s)>>>s}return e}o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var i=this._zeroBits(this.words[t]);if(e+=i,i!==26)break}return e},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(e){return this.negative!==0?this.abs().inotn(e).iaddn(1):this.clone()},o.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return this.negative!==0},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this.strip()},o.prototype.ior=function(e){return u((this.negative|e.negative)===0),this.iuor(e)},o.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;this.length>e.length?t=e:t=this;for(var i=0;i<t.length;i++)this.words[i]=this.words[i]&e.words[i];return this.length=t.length,this.strip()},o.prototype.iand=function(e){return u((this.negative|e.negative)===0),this.iuand(e)},o.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,i;this.length>e.length?(t=this,i=e):(t=e,i=this);for(var s=0;s<i.length;s++)this.words[s]=t.words[s]^i.words[s];if(this!==t)for(;s<t.length;s++)this.words[s]=t.words[s];return this.length=t.length,this.strip()},o.prototype.ixor=function(e){return u((this.negative|e.negative)===0),this.iuxor(e)},o.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){u(typeof e=="number"&&e>=0);var t=Math.ceil(e/26)|0,i=e%26;this._expand(t),i>0&&t--;for(var s=0;s<t;s++)this.words[s]=~this.words[s]&67108863;return i>0&&(this.words[s]=~this.words[s]&67108863>>26-i),this.strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){u(typeof e=="number"&&e>=0);var i=e/26|0,s=e%26;return this._expand(i+1),t?this.words[i]=this.words[i]|1<<s:this.words[i]=this.words[i]&~(1<<s),this.strip()},o.prototype.iadd=function(e){var t;if(this.negative!==0&&e.negative===0)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(this.negative===0&&e.negative!==0)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();var i,s;this.length>e.length?(i=this,s=e):(i=e,s=this);for(var l=0,c=0;c<s.length;c++)t=(i.words[c]|0)+(s.words[c]|0)+l,this.words[c]=t&67108863,l=t>>>26;for(;l!==0&&c<i.length;c++)t=(i.words[c]|0)+l,this.words[c]=t&67108863,l=t>>>26;if(this.length=i.length,l!==0)this.words[this.length]=l,this.length++;else if(i!==this)for(;c<i.length;c++)this.words[c]=i.words[c];return this},o.prototype.add=function(e){var t;return e.negative!==0&&this.negative===0?(e.negative=0,t=this.sub(e),e.negative^=1,t):e.negative===0&&this.negative!==0?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(e.negative!==0){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var i=this.cmp(e);if(i===0)return this.negative=0,this.length=1,this.words[0]=0,this;var s,l;i>0?(s=this,l=e):(s=e,l=this);for(var c=0,p=0;p<l.length;p++)t=(s.words[p]|0)-(l.words[p]|0)+c,c=t>>26,this.words[p]=t&67108863;for(;c!==0&&p<s.length;p++)t=(s.words[p]|0)+c,c=t>>26,this.words[p]=t&67108863;if(c===0&&p<s.length&&s!==this)for(;p<s.length;p++)this.words[p]=s.words[p];return this.length=Math.max(this.length,p),s!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(e){return this.clone().isub(e)};function $(g,e,t){t.negative=e.negative^g.negative;var i=g.length+e.length|0;t.length=i,i=i-1|0;var s=g.words[0]|0,l=e.words[0]|0,c=s*l,p=c&67108863,d=c/67108864|0;t.words[0]=p;for(var r=1;r<i;r++){for(var f=d>>>26,m=d&67108863,_=Math.min(r,e.length-1),R=Math.max(0,r-g.length+1);R<=_;R++){var C=r-R|0;s=g.words[C]|0,l=e.words[R]|0,c=s*l+m,f+=c/67108864|0,m=c&67108863}t.words[r]=m|0,d=f|0}return d!==0?t.words[r]=d|0:t.length--,t.strip()}var M=function(e,t,i){var s=e.words,l=t.words,c=i.words,p=0,d,r,f,m=s[0]|0,_=m&8191,R=m>>>13,C=s[1]|0,F=C&8191,z=C>>>13,lt=s[2]|0,G=lt&8191,Z=lt>>>13,mt=s[3]|0,gt=mt&8191,j=mt>>>13,Ct=s[4]|0,wt=Ct&8191,Y=Ct>>>13,U=s[5]|0,I=U&8191,E=U>>>13,P=s[6]|0,H=P&8191,D=P>>>13,ut=s[7]|0,vt=ut&8191,V=ut>>>13,bt=s[8]|0,yt=bt&8191,J=bt>>>13,Lt=s[9]|0,Mt=Lt&8191,Q=Lt>>>13,Ot=l[0]|0,xt=Ot&8191,tt=Ot>>>13,Nt=l[1]|0,_t=Nt&8191,et=Nt>>>13,qt=l[2]|0,St=qt&8191,rt=qt>>>13,Ut=l[3]|0,At=Ut&8191,it=Ut>>>13,Ft=l[4]|0,Et=Ft&8191,nt=Ft>>>13,$t=l[5]|0,kt=$t&8191,at=$t>>>13,zt=l[6]|0,Rt=zt&8191,ft=zt>>>13,Dt=l[7]|0,Bt=Dt&8191,ot=Dt>>>13,Ht=l[8]|0,It=Ht&8191,st=Ht>>>13,Kt=l[9]|0,Tt=Kt&8191,ht=Kt>>>13;i.negative=e.negative^t.negative,i.length=19,d=Math.imul(_,xt),r=Math.imul(_,tt),r=r+Math.imul(R,xt)|0,f=Math.imul(R,tt);var Pt=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,d=Math.imul(F,xt),r=Math.imul(F,tt),r=r+Math.imul(z,xt)|0,f=Math.imul(z,tt),d=d+Math.imul(_,_t)|0,r=r+Math.imul(_,et)|0,r=r+Math.imul(R,_t)|0,f=f+Math.imul(R,et)|0;var Jt=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,d=Math.imul(G,xt),r=Math.imul(G,tt),r=r+Math.imul(Z,xt)|0,f=Math.imul(Z,tt),d=d+Math.imul(F,_t)|0,r=r+Math.imul(F,et)|0,r=r+Math.imul(z,_t)|0,f=f+Math.imul(z,et)|0,d=d+Math.imul(_,St)|0,r=r+Math.imul(_,rt)|0,r=r+Math.imul(R,St)|0,f=f+Math.imul(R,rt)|0;var jt=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(jt>>>26)|0,jt&=67108863,d=Math.imul(gt,xt),r=Math.imul(gt,tt),r=r+Math.imul(j,xt)|0,f=Math.imul(j,tt),d=d+Math.imul(G,_t)|0,r=r+Math.imul(G,et)|0,r=r+Math.imul(Z,_t)|0,f=f+Math.imul(Z,et)|0,d=d+Math.imul(F,St)|0,r=r+Math.imul(F,rt)|0,r=r+Math.imul(z,St)|0,f=f+Math.imul(z,rt)|0,d=d+Math.imul(_,At)|0,r=r+Math.imul(_,it)|0,r=r+Math.imul(R,At)|0,f=f+Math.imul(R,it)|0;var Yt=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,d=Math.imul(wt,xt),r=Math.imul(wt,tt),r=r+Math.imul(Y,xt)|0,f=Math.imul(Y,tt),d=d+Math.imul(gt,_t)|0,r=r+Math.imul(gt,et)|0,r=r+Math.imul(j,_t)|0,f=f+Math.imul(j,et)|0,d=d+Math.imul(G,St)|0,r=r+Math.imul(G,rt)|0,r=r+Math.imul(Z,St)|0,f=f+Math.imul(Z,rt)|0,d=d+Math.imul(F,At)|0,r=r+Math.imul(F,it)|0,r=r+Math.imul(z,At)|0,f=f+Math.imul(z,it)|0,d=d+Math.imul(_,Et)|0,r=r+Math.imul(_,nt)|0,r=r+Math.imul(R,Et)|0,f=f+Math.imul(R,nt)|0;var Xt=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(Xt>>>26)|0,Xt&=67108863,d=Math.imul(I,xt),r=Math.imul(I,tt),r=r+Math.imul(E,xt)|0,f=Math.imul(E,tt),d=d+Math.imul(wt,_t)|0,r=r+Math.imul(wt,et)|0,r=r+Math.imul(Y,_t)|0,f=f+Math.imul(Y,et)|0,d=d+Math.imul(gt,St)|0,r=r+Math.imul(gt,rt)|0,r=r+Math.imul(j,St)|0,f=f+Math.imul(j,rt)|0,d=d+Math.imul(G,At)|0,r=r+Math.imul(G,it)|0,r=r+Math.imul(Z,At)|0,f=f+Math.imul(Z,it)|0,d=d+Math.imul(F,Et)|0,r=r+Math.imul(F,nt)|0,r=r+Math.imul(z,Et)|0,f=f+Math.imul(z,nt)|0,d=d+Math.imul(_,kt)|0,r=r+Math.imul(_,at)|0,r=r+Math.imul(R,kt)|0,f=f+Math.imul(R,at)|0;var Qt=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(Qt>>>26)|0,Qt&=67108863,d=Math.imul(H,xt),r=Math.imul(H,tt),r=r+Math.imul(D,xt)|0,f=Math.imul(D,tt),d=d+Math.imul(I,_t)|0,r=r+Math.imul(I,et)|0,r=r+Math.imul(E,_t)|0,f=f+Math.imul(E,et)|0,d=d+Math.imul(wt,St)|0,r=r+Math.imul(wt,rt)|0,r=r+Math.imul(Y,St)|0,f=f+Math.imul(Y,rt)|0,d=d+Math.imul(gt,At)|0,r=r+Math.imul(gt,it)|0,r=r+Math.imul(j,At)|0,f=f+Math.imul(j,it)|0,d=d+Math.imul(G,Et)|0,r=r+Math.imul(G,nt)|0,r=r+Math.imul(Z,Et)|0,f=f+Math.imul(Z,nt)|0,d=d+Math.imul(F,kt)|0,r=r+Math.imul(F,at)|0,r=r+Math.imul(z,kt)|0,f=f+Math.imul(z,at)|0,d=d+Math.imul(_,Rt)|0,r=r+Math.imul(_,ft)|0,r=r+Math.imul(R,Rt)|0,f=f+Math.imul(R,ft)|0;var te=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(te>>>26)|0,te&=67108863,d=Math.imul(vt,xt),r=Math.imul(vt,tt),r=r+Math.imul(V,xt)|0,f=Math.imul(V,tt),d=d+Math.imul(H,_t)|0,r=r+Math.imul(H,et)|0,r=r+Math.imul(D,_t)|0,f=f+Math.imul(D,et)|0,d=d+Math.imul(I,St)|0,r=r+Math.imul(I,rt)|0,r=r+Math.imul(E,St)|0,f=f+Math.imul(E,rt)|0,d=d+Math.imul(wt,At)|0,r=r+Math.imul(wt,it)|0,r=r+Math.imul(Y,At)|0,f=f+Math.imul(Y,it)|0,d=d+Math.imul(gt,Et)|0,r=r+Math.imul(gt,nt)|0,r=r+Math.imul(j,Et)|0,f=f+Math.imul(j,nt)|0,d=d+Math.imul(G,kt)|0,r=r+Math.imul(G,at)|0,r=r+Math.imul(Z,kt)|0,f=f+Math.imul(Z,at)|0,d=d+Math.imul(F,Rt)|0,r=r+Math.imul(F,ft)|0,r=r+Math.imul(z,Rt)|0,f=f+Math.imul(z,ft)|0,d=d+Math.imul(_,Bt)|0,r=r+Math.imul(_,ot)|0,r=r+Math.imul(R,Bt)|0,f=f+Math.imul(R,ot)|0;var ee=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(ee>>>26)|0,ee&=67108863,d=Math.imul(yt,xt),r=Math.imul(yt,tt),r=r+Math.imul(J,xt)|0,f=Math.imul(J,tt),d=d+Math.imul(vt,_t)|0,r=r+Math.imul(vt,et)|0,r=r+Math.imul(V,_t)|0,f=f+Math.imul(V,et)|0,d=d+Math.imul(H,St)|0,r=r+Math.imul(H,rt)|0,r=r+Math.imul(D,St)|0,f=f+Math.imul(D,rt)|0,d=d+Math.imul(I,At)|0,r=r+Math.imul(I,it)|0,r=r+Math.imul(E,At)|0,f=f+Math.imul(E,it)|0,d=d+Math.imul(wt,Et)|0,r=r+Math.imul(wt,nt)|0,r=r+Math.imul(Y,Et)|0,f=f+Math.imul(Y,nt)|0,d=d+Math.imul(gt,kt)|0,r=r+Math.imul(gt,at)|0,r=r+Math.imul(j,kt)|0,f=f+Math.imul(j,at)|0,d=d+Math.imul(G,Rt)|0,r=r+Math.imul(G,ft)|0,r=r+Math.imul(Z,Rt)|0,f=f+Math.imul(Z,ft)|0,d=d+Math.imul(F,Bt)|0,r=r+Math.imul(F,ot)|0,r=r+Math.imul(z,Bt)|0,f=f+Math.imul(z,ot)|0,d=d+Math.imul(_,It)|0,r=r+Math.imul(_,st)|0,r=r+Math.imul(R,It)|0,f=f+Math.imul(R,st)|0;var re=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(re>>>26)|0,re&=67108863,d=Math.imul(Mt,xt),r=Math.imul(Mt,tt),r=r+Math.imul(Q,xt)|0,f=Math.imul(Q,tt),d=d+Math.imul(yt,_t)|0,r=r+Math.imul(yt,et)|0,r=r+Math.imul(J,_t)|0,f=f+Math.imul(J,et)|0,d=d+Math.imul(vt,St)|0,r=r+Math.imul(vt,rt)|0,r=r+Math.imul(V,St)|0,f=f+Math.imul(V,rt)|0,d=d+Math.imul(H,At)|0,r=r+Math.imul(H,it)|0,r=r+Math.imul(D,At)|0,f=f+Math.imul(D,it)|0,d=d+Math.imul(I,Et)|0,r=r+Math.imul(I,nt)|0,r=r+Math.imul(E,Et)|0,f=f+Math.imul(E,nt)|0,d=d+Math.imul(wt,kt)|0,r=r+Math.imul(wt,at)|0,r=r+Math.imul(Y,kt)|0,f=f+Math.imul(Y,at)|0,d=d+Math.imul(gt,Rt)|0,r=r+Math.imul(gt,ft)|0,r=r+Math.imul(j,Rt)|0,f=f+Math.imul(j,ft)|0,d=d+Math.imul(G,Bt)|0,r=r+Math.imul(G,ot)|0,r=r+Math.imul(Z,Bt)|0,f=f+Math.imul(Z,ot)|0,d=d+Math.imul(F,It)|0,r=r+Math.imul(F,st)|0,r=r+Math.imul(z,It)|0,f=f+Math.imul(z,st)|0,d=d+Math.imul(_,Tt)|0,r=r+Math.imul(_,ht)|0,r=r+Math.imul(R,Tt)|0,f=f+Math.imul(R,ht)|0;var ie=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(ie>>>26)|0,ie&=67108863,d=Math.imul(Mt,_t),r=Math.imul(Mt,et),r=r+Math.imul(Q,_t)|0,f=Math.imul(Q,et),d=d+Math.imul(yt,St)|0,r=r+Math.imul(yt,rt)|0,r=r+Math.imul(J,St)|0,f=f+Math.imul(J,rt)|0,d=d+Math.imul(vt,At)|0,r=r+Math.imul(vt,it)|0,r=r+Math.imul(V,At)|0,f=f+Math.imul(V,it)|0,d=d+Math.imul(H,Et)|0,r=r+Math.imul(H,nt)|0,r=r+Math.imul(D,Et)|0,f=f+Math.imul(D,nt)|0,d=d+Math.imul(I,kt)|0,r=r+Math.imul(I,at)|0,r=r+Math.imul(E,kt)|0,f=f+Math.imul(E,at)|0,d=d+Math.imul(wt,Rt)|0,r=r+Math.imul(wt,ft)|0,r=r+Math.imul(Y,Rt)|0,f=f+Math.imul(Y,ft)|0,d=d+Math.imul(gt,Bt)|0,r=r+Math.imul(gt,ot)|0,r=r+Math.imul(j,Bt)|0,f=f+Math.imul(j,ot)|0,d=d+Math.imul(G,It)|0,r=r+Math.imul(G,st)|0,r=r+Math.imul(Z,It)|0,f=f+Math.imul(Z,st)|0,d=d+Math.imul(F,Tt)|0,r=r+Math.imul(F,ht)|0,r=r+Math.imul(z,Tt)|0,f=f+Math.imul(z,ht)|0;var ne=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(ne>>>26)|0,ne&=67108863,d=Math.imul(Mt,St),r=Math.imul(Mt,rt),r=r+Math.imul(Q,St)|0,f=Math.imul(Q,rt),d=d+Math.imul(yt,At)|0,r=r+Math.imul(yt,it)|0,r=r+Math.imul(J,At)|0,f=f+Math.imul(J,it)|0,d=d+Math.imul(vt,Et)|0,r=r+Math.imul(vt,nt)|0,r=r+Math.imul(V,Et)|0,f=f+Math.imul(V,nt)|0,d=d+Math.imul(H,kt)|0,r=r+Math.imul(H,at)|0,r=r+Math.imul(D,kt)|0,f=f+Math.imul(D,at)|0,d=d+Math.imul(I,Rt)|0,r=r+Math.imul(I,ft)|0,r=r+Math.imul(E,Rt)|0,f=f+Math.imul(E,ft)|0,d=d+Math.imul(wt,Bt)|0,r=r+Math.imul(wt,ot)|0,r=r+Math.imul(Y,Bt)|0,f=f+Math.imul(Y,ot)|0,d=d+Math.imul(gt,It)|0,r=r+Math.imul(gt,st)|0,r=r+Math.imul(j,It)|0,f=f+Math.imul(j,st)|0,d=d+Math.imul(G,Tt)|0,r=r+Math.imul(G,ht)|0,r=r+Math.imul(Z,Tt)|0,f=f+Math.imul(Z,ht)|0;var ae=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(ae>>>26)|0,ae&=67108863,d=Math.imul(Mt,At),r=Math.imul(Mt,it),r=r+Math.imul(Q,At)|0,f=Math.imul(Q,it),d=d+Math.imul(yt,Et)|0,r=r+Math.imul(yt,nt)|0,r=r+Math.imul(J,Et)|0,f=f+Math.imul(J,nt)|0,d=d+Math.imul(vt,kt)|0,r=r+Math.imul(vt,at)|0,r=r+Math.imul(V,kt)|0,f=f+Math.imul(V,at)|0,d=d+Math.imul(H,Rt)|0,r=r+Math.imul(H,ft)|0,r=r+Math.imul(D,Rt)|0,f=f+Math.imul(D,ft)|0,d=d+Math.imul(I,Bt)|0,r=r+Math.imul(I,ot)|0,r=r+Math.imul(E,Bt)|0,f=f+Math.imul(E,ot)|0,d=d+Math.imul(wt,It)|0,r=r+Math.imul(wt,st)|0,r=r+Math.imul(Y,It)|0,f=f+Math.imul(Y,st)|0,d=d+Math.imul(gt,Tt)|0,r=r+Math.imul(gt,ht)|0,r=r+Math.imul(j,Tt)|0,f=f+Math.imul(j,ht)|0;var fe=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(fe>>>26)|0,fe&=67108863,d=Math.imul(Mt,Et),r=Math.imul(Mt,nt),r=r+Math.imul(Q,Et)|0,f=Math.imul(Q,nt),d=d+Math.imul(yt,kt)|0,r=r+Math.imul(yt,at)|0,r=r+Math.imul(J,kt)|0,f=f+Math.imul(J,at)|0,d=d+Math.imul(vt,Rt)|0,r=r+Math.imul(vt,ft)|0,r=r+Math.imul(V,Rt)|0,f=f+Math.imul(V,ft)|0,d=d+Math.imul(H,Bt)|0,r=r+Math.imul(H,ot)|0,r=r+Math.imul(D,Bt)|0,f=f+Math.imul(D,ot)|0,d=d+Math.imul(I,It)|0,r=r+Math.imul(I,st)|0,r=r+Math.imul(E,It)|0,f=f+Math.imul(E,st)|0,d=d+Math.imul(wt,Tt)|0,r=r+Math.imul(wt,ht)|0,r=r+Math.imul(Y,Tt)|0,f=f+Math.imul(Y,ht)|0;var oe=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(oe>>>26)|0,oe&=67108863,d=Math.imul(Mt,kt),r=Math.imul(Mt,at),r=r+Math.imul(Q,kt)|0,f=Math.imul(Q,at),d=d+Math.imul(yt,Rt)|0,r=r+Math.imul(yt,ft)|0,r=r+Math.imul(J,Rt)|0,f=f+Math.imul(J,ft)|0,d=d+Math.imul(vt,Bt)|0,r=r+Math.imul(vt,ot)|0,r=r+Math.imul(V,Bt)|0,f=f+Math.imul(V,ot)|0,d=d+Math.imul(H,It)|0,r=r+Math.imul(H,st)|0,r=r+Math.imul(D,It)|0,f=f+Math.imul(D,st)|0,d=d+Math.imul(I,Tt)|0,r=r+Math.imul(I,ht)|0,r=r+Math.imul(E,Tt)|0,f=f+Math.imul(E,ht)|0;var se=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(se>>>26)|0,se&=67108863,d=Math.imul(Mt,Rt),r=Math.imul(Mt,ft),r=r+Math.imul(Q,Rt)|0,f=Math.imul(Q,ft),d=d+Math.imul(yt,Bt)|0,r=r+Math.imul(yt,ot)|0,r=r+Math.imul(J,Bt)|0,f=f+Math.imul(J,ot)|0,d=d+Math.imul(vt,It)|0,r=r+Math.imul(vt,st)|0,r=r+Math.imul(V,It)|0,f=f+Math.imul(V,st)|0,d=d+Math.imul(H,Tt)|0,r=r+Math.imul(H,ht)|0,r=r+Math.imul(D,Tt)|0,f=f+Math.imul(D,ht)|0;var he=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(he>>>26)|0,he&=67108863,d=Math.imul(Mt,Bt),r=Math.imul(Mt,ot),r=r+Math.imul(Q,Bt)|0,f=Math.imul(Q,ot),d=d+Math.imul(yt,It)|0,r=r+Math.imul(yt,st)|0,r=r+Math.imul(J,It)|0,f=f+Math.imul(J,st)|0,d=d+Math.imul(vt,Tt)|0,r=r+Math.imul(vt,ht)|0,r=r+Math.imul(V,Tt)|0,f=f+Math.imul(V,ht)|0;var ue=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(ue>>>26)|0,ue&=67108863,d=Math.imul(Mt,It),r=Math.imul(Mt,st),r=r+Math.imul(Q,It)|0,f=Math.imul(Q,st),d=d+Math.imul(yt,Tt)|0,r=r+Math.imul(yt,ht)|0,r=r+Math.imul(J,Tt)|0,f=f+Math.imul(J,ht)|0;var le=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(le>>>26)|0,le&=67108863,d=Math.imul(Mt,Tt),r=Math.imul(Mt,ht),r=r+Math.imul(Q,Tt)|0,f=Math.imul(Q,ht);var ce=(p+d|0)+((r&8191)<<13)|0;return p=(f+(r>>>13)|0)+(ce>>>26)|0,ce&=67108863,c[0]=Pt,c[1]=Jt,c[2]=jt,c[3]=Yt,c[4]=Xt,c[5]=Qt,c[6]=te,c[7]=ee,c[8]=re,c[9]=ie,c[10]=ne,c[11]=ae,c[12]=fe,c[13]=oe,c[14]=se,c[15]=he,c[16]=ue,c[17]=le,c[18]=ce,p!==0&&(c[19]=p,i.length++),i};Math.imul||(M=$);function N(g,e,t){t.negative=e.negative^g.negative,t.length=g.length+e.length;for(var i=0,s=0,l=0;l<t.length-1;l++){var c=s;s=0;for(var p=i&67108863,d=Math.min(l,e.length-1),r=Math.max(0,l-g.length+1);r<=d;r++){var f=l-r,m=g.words[f]|0,_=e.words[r]|0,R=m*_,C=R&67108863;c=c+(R/67108864|0)|0,C=C+p|0,p=C&67108863,c=c+(C>>>26)|0,s+=c>>>26,c&=67108863}t.words[l]=p,i=c,c=s}return i!==0?t.words[l]=i:t.length--,t.strip()}function x(g,e,t){var i=new A;return i.mulp(g,e,t)}o.prototype.mulTo=function(e,t){var i,s=this.length+e.length;return this.length===10&&e.length===10?i=M(this,e,t):s<63?i=$(this,e,t):s<1024?i=N(this,e,t):i=x(this,e,t),i};function A(g,e){this.x=g,this.y=e}A.prototype.makeRBT=function(e){for(var t=new Array(e),i=o.prototype._countBits(e)-1,s=0;s<e;s++)t[s]=this.revBin(s,i,e);return t},A.prototype.revBin=function(e,t,i){if(e===0||e===i-1)return e;for(var s=0,l=0;l<t;l++)s|=(e&1)<<t-l-1,e>>=1;return s},A.prototype.permute=function(e,t,i,s,l,c){for(var p=0;p<c;p++)s[p]=t[e[p]],l[p]=i[e[p]]},A.prototype.transform=function(e,t,i,s,l,c){this.permute(c,e,t,i,s,l);for(var p=1;p<l;p<<=1)for(var d=p<<1,r=Math.cos(2*Math.PI/d),f=Math.sin(2*Math.PI/d),m=0;m<l;m+=d)for(var _=r,R=f,C=0;C<p;C++){var F=i[m+C],z=s[m+C],lt=i[m+C+p],G=s[m+C+p],Z=_*lt-R*G;G=_*G+R*lt,lt=Z,i[m+C]=F+lt,s[m+C]=z+G,i[m+C+p]=F-lt,s[m+C+p]=z-G,C!==d&&(Z=r*_-f*R,R=r*R+f*_,_=Z)}},A.prototype.guessLen13b=function(e,t){var i=Math.max(t,e)|1,s=i&1,l=0;for(i=i/2|0;i;i=i>>>1)l++;return 1<<l+1+s},A.prototype.conjugate=function(e,t,i){if(!(i<=1))for(var s=0;s<i/2;s++){var l=e[s];e[s]=e[i-s-1],e[i-s-1]=l,l=t[s],t[s]=-t[i-s-1],t[i-s-1]=-l}},A.prototype.normalize13b=function(e,t){for(var i=0,s=0;s<t/2;s++){var l=Math.round(e[2*s+1]/t)*8192+Math.round(e[2*s]/t)+i;e[s]=l&67108863,l<67108864?i=0:i=l/67108864|0}return e},A.prototype.convert13b=function(e,t,i,s){for(var l=0,c=0;c<t;c++)l=l+(e[c]|0),i[2*c]=l&8191,l=l>>>13,i[2*c+1]=l&8191,l=l>>>13;for(c=2*t;c<s;++c)i[c]=0;u(l===0),u((l&-8192)===0)},A.prototype.stub=function(e){for(var t=new Array(e),i=0;i<e;i++)t[i]=0;return t},A.prototype.mulp=function(e,t,i){var s=2*this.guessLen13b(e.length,t.length),l=this.makeRBT(s),c=this.stub(s),p=new Array(s),d=new Array(s),r=new Array(s),f=new Array(s),m=new Array(s),_=new Array(s),R=i.words;R.length=s,this.convert13b(e.words,e.length,p,s),this.convert13b(t.words,t.length,f,s),this.transform(p,c,d,r,s,l),this.transform(f,c,m,_,s,l);for(var C=0;C<s;C++){var F=d[C]*m[C]-r[C]*_[C];r[C]=d[C]*_[C]+r[C]*m[C],d[C]=F}return this.conjugate(d,r,s),this.transform(d,r,R,c,s,l),this.conjugate(R,c,s),this.normalize13b(R,s),i.negative=e.negative^t.negative,i.length=e.length+t.length,i.strip()},o.prototype.mul=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},o.prototype.mulf=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),x(this,e,t)},o.prototype.imul=function(e){return this.clone().mulTo(e,this)},o.prototype.imuln=function(e){u(typeof e=="number"),u(e<67108864);for(var t=0,i=0;i<this.length;i++){var s=(this.words[i]|0)*e,l=(s&67108863)+(t&67108863);t>>=26,t+=s/67108864|0,t+=l>>>26,this.words[i]=l&67108863}return t!==0&&(this.words[i]=t,this.length++),this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=q(e);if(t.length===0)return new o(1);for(var i=this,s=0;s<t.length&&t[s]===0;s++,i=i.sqr());if(++s<t.length)for(var l=i.sqr();s<t.length;s++,l=l.sqr())t[s]!==0&&(i=i.mul(l));return i},o.prototype.iushln=function(e){u(typeof e=="number"&&e>=0);var t=e%26,i=(e-t)/26,s=67108863>>>26-t<<26-t,l;if(t!==0){var c=0;for(l=0;l<this.length;l++){var p=this.words[l]&s,d=(this.words[l]|0)-p<<t;this.words[l]=d|c,c=p>>>26-t}c&&(this.words[l]=c,this.length++)}if(i!==0){for(l=this.length-1;l>=0;l--)this.words[l+i]=this.words[l];for(l=0;l<i;l++)this.words[l]=0;this.length+=i}return this.strip()},o.prototype.ishln=function(e){return u(this.negative===0),this.iushln(e)},o.prototype.iushrn=function(e,t,i){u(typeof e=="number"&&e>=0);var s;t?s=(t-t%26)/26:s=0;var l=e%26,c=Math.min((e-l)/26,this.length),p=67108863^67108863>>>l<<l,d=i;if(s-=c,s=Math.max(0,s),d){for(var r=0;r<c;r++)d.words[r]=this.words[r];d.length=c}if(c!==0)if(this.length>c)for(this.length-=c,r=0;r<this.length;r++)this.words[r]=this.words[r+c];else this.words[0]=0,this.length=1;var f=0;for(r=this.length-1;r>=0&&(f!==0||r>=s);r--){var m=this.words[r]|0;this.words[r]=f<<26-l|m>>>l,f=m&p}return d&&f!==0&&(d.words[d.length++]=f),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(e,t,i){return u(this.negative===0),this.iushrn(e,t,i)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){u(typeof e=="number"&&e>=0);var t=e%26,i=(e-t)/26,s=1<<t;if(this.length<=i)return!1;var l=this.words[i];return!!(l&s)},o.prototype.imaskn=function(e){u(typeof e=="number"&&e>=0);var t=e%26,i=(e-t)/26;if(u(this.negative===0,"imaskn works only with positive numbers"),this.length<=i)return this;if(t!==0&&i++,this.length=Math.min(i,this.length),t!==0){var s=67108863^67108863>>>t<<t;this.words[this.length-1]&=s}return this.strip()},o.prototype.maskn=function(e){return this.clone().imaskn(e)},o.prototype.iaddn=function(e){return u(typeof e=="number"),u(e<67108864),e<0?this.isubn(-e):this.negative!==0?this.length===1&&(this.words[0]|0)<e?(this.words[0]=e-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},o.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(u(typeof e=="number"),u(e<67108864),e<0)return this.iaddn(-e);if(this.negative!==0)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.strip()},o.prototype.addn=function(e){return this.clone().iaddn(e)},o.prototype.subn=function(e){return this.clone().isubn(e)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(e,t,i){var s=e.length+i,l;this._expand(s);var c,p=0;for(l=0;l<e.length;l++){c=(this.words[l+i]|0)+p;var d=(e.words[l]|0)*t;c-=d&67108863,p=(c>>26)-(d/67108864|0),this.words[l+i]=c&67108863}for(;l<this.length-i;l++)c=(this.words[l+i]|0)+p,p=c>>26,this.words[l+i]=c&67108863;if(p===0)return this.strip();for(u(p===-1),p=0,l=0;l<this.length;l++)c=-(this.words[l]|0)+p,p=c>>26,this.words[l]=c&67108863;return this.negative=1,this.strip()},o.prototype._wordDiv=function(e,t){var i=this.length-e.length,s=this.clone(),l=e,c=l.words[l.length-1]|0,p=this._countBits(c);i=26-p,i!==0&&(l=l.ushln(i),s.iushln(i),c=l.words[l.length-1]|0);var d=s.length-l.length,r;if(t!=="mod"){r=new o(null),r.length=d+1,r.words=new Array(r.length);for(var f=0;f<r.length;f++)r.words[f]=0}var m=s.clone()._ishlnsubmul(l,1,d);m.negative===0&&(s=m,r&&(r.words[d]=1));for(var _=d-1;_>=0;_--){var R=(s.words[l.length+_]|0)*67108864+(s.words[l.length+_-1]|0);for(R=Math.min(R/c|0,67108863),s._ishlnsubmul(l,R,_);s.negative!==0;)R--,s.negative=0,s._ishlnsubmul(l,1,_),s.isZero()||(s.negative^=1);r&&(r.words[_]=R)}return r&&r.strip(),s.strip(),t!=="div"&&i!==0&&s.iushrn(i),{div:r||null,mod:s}},o.prototype.divmod=function(e,t,i){if(u(!e.isZero()),this.isZero())return{div:new o(0),mod:new o(0)};var s,l,c;return this.negative!==0&&e.negative===0?(c=this.neg().divmod(e,t),t!=="mod"&&(s=c.div.neg()),t!=="div"&&(l=c.mod.neg(),i&&l.negative!==0&&l.iadd(e)),{div:s,mod:l}):this.negative===0&&e.negative!==0?(c=this.divmod(e.neg(),t),t!=="mod"&&(s=c.div.neg()),{div:s,mod:c.mod}):this.negative&e.negative?(c=this.neg().divmod(e.neg(),t),t!=="div"&&(l=c.mod.neg(),i&&l.negative!==0&&l.isub(e)),{div:c.div,mod:l}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:e.length===1?t==="div"?{div:this.divn(e.words[0]),mod:null}:t==="mod"?{div:null,mod:new o(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modn(e.words[0]))}:this._wordDiv(e,t)},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var i=t.div.negative!==0?t.mod.isub(e):t.mod,s=e.ushrn(1),l=e.andln(1),c=i.cmp(s);return c<0||l===1&&c===0?t.div:t.div.negative!==0?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modn=function(e){u(e<=67108863);for(var t=(1<<26)%e,i=0,s=this.length-1;s>=0;s--)i=(t*i+(this.words[s]|0))%e;return i},o.prototype.idivn=function(e){u(e<=67108863);for(var t=0,i=this.length-1;i>=0;i--){var s=(this.words[i]|0)+t*67108864;this.words[i]=s/e|0,t=s%e}return this.strip()},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){u(e.negative===0),u(!e.isZero());var t=this,i=e.clone();t.negative!==0?t=t.umod(e):t=t.clone();for(var s=new o(1),l=new o(0),c=new o(0),p=new o(1),d=0;t.isEven()&&i.isEven();)t.iushrn(1),i.iushrn(1),++d;for(var r=i.clone(),f=t.clone();!t.isZero();){for(var m=0,_=1;!(t.words[0]&_)&&m<26;++m,_<<=1);if(m>0)for(t.iushrn(m);m-- >0;)(s.isOdd()||l.isOdd())&&(s.iadd(r),l.isub(f)),s.iushrn(1),l.iushrn(1);for(var R=0,C=1;!(i.words[0]&C)&&R<26;++R,C<<=1);if(R>0)for(i.iushrn(R);R-- >0;)(c.isOdd()||p.isOdd())&&(c.iadd(r),p.isub(f)),c.iushrn(1),p.iushrn(1);t.cmp(i)>=0?(t.isub(i),s.isub(c),l.isub(p)):(i.isub(t),c.isub(s),p.isub(l))}return{a:c,b:p,gcd:i.iushln(d)}},o.prototype._invmp=function(e){u(e.negative===0),u(!e.isZero());var t=this,i=e.clone();t.negative!==0?t=t.umod(e):t=t.clone();for(var s=new o(1),l=new o(0),c=i.clone();t.cmpn(1)>0&&i.cmpn(1)>0;){for(var p=0,d=1;!(t.words[0]&d)&&p<26;++p,d<<=1);if(p>0)for(t.iushrn(p);p-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);for(var r=0,f=1;!(i.words[0]&f)&&r<26;++r,f<<=1);if(r>0)for(i.iushrn(r);r-- >0;)l.isOdd()&&l.iadd(c),l.iushrn(1);t.cmp(i)>=0?(t.isub(i),s.isub(l)):(i.isub(t),l.isub(s))}var m;return t.cmpn(1)===0?m=s:m=l,m.cmpn(0)<0&&m.iadd(e),m},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),i=e.clone();t.negative=0,i.negative=0;for(var s=0;t.isEven()&&i.isEven();s++)t.iushrn(1),i.iushrn(1);do{for(;t.isEven();)t.iushrn(1);for(;i.isEven();)i.iushrn(1);var l=t.cmp(i);if(l<0){var c=t;t=i,i=c}else if(l===0||i.cmpn(1)===0)break;t.isub(i)}while(!0);return i.iushln(s)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return(this.words[0]&1)===0},o.prototype.isOdd=function(){return(this.words[0]&1)===1},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){u(typeof e=="number");var t=e%26,i=(e-t)/26,s=1<<t;if(this.length<=i)return this._expand(i+1),this.words[i]|=s,this;for(var l=s,c=i;l!==0&&c<this.length;c++){var p=this.words[c]|0;p+=l,l=p>>>26,p&=67108863,this.words[c]=p}return l!==0&&(this.words[c]=l,this.length++),this},o.prototype.isZero=function(){return this.length===1&&this.words[0]===0},o.prototype.cmpn=function(e){var t=e<0;if(this.negative!==0&&!t)return-1;if(this.negative===0&&t)return 1;this.strip();var i;if(this.length>1)i=1;else{t&&(e=-e),u(e<=67108863,"Number is too big");var s=this.words[0]|0;i=s===e?0:s<e?-1:1}return this.negative!==0?-i|0:i},o.prototype.cmp=function(e){if(this.negative!==0&&e.negative===0)return-1;if(this.negative===0&&e.negative!==0)return 1;var t=this.ucmp(e);return this.negative!==0?-t|0:t},o.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,i=this.length-1;i>=0;i--){var s=this.words[i]|0,l=e.words[i]|0;if(s!==l){s<l?t=-1:s>l&&(t=1);break}}return t},o.prototype.gtn=function(e){return this.cmpn(e)===1},o.prototype.gt=function(e){return this.cmp(e)===1},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return this.cmpn(e)===-1},o.prototype.lt=function(e){return this.cmp(e)===-1},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return this.cmpn(e)===0},o.prototype.eq=function(e){return this.cmp(e)===0},o.red=function(e){return new ct(e)},o.prototype.toRed=function(e){return u(!this.red,"Already a number in reduction context"),u(this.negative===0,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return u(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return u(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return u(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return u(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return u(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return u(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return u(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return u(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return u(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return u(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return u(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return u(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return u(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return u(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return u(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var S={k256:null,p224:null,p192:null,p25519:null};function T(g,e){this.name=g,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}T.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},T.prototype.ireduce=function(e){var t=e,i;do this.split(t,this.tmp),t=this.imulK(t),t=t.iadd(this.tmp),i=t.bitLength();while(i>this.n);var s=i<this.n?-1:t.ucmp(this.p);return s===0?(t.words[0]=0,t.length=1):s>0?t.isub(this.p):t.strip(),t},T.prototype.split=function(e,t){e.iushrn(this.n,0,t)},T.prototype.imulK=function(e){return e.imul(this.k)};function O(){T.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}v(O,T),O.prototype.split=function(e,t){for(var i=4194303,s=Math.min(e.length,9),l=0;l<s;l++)t.words[l]=e.words[l];if(t.length=s,e.length<=9){e.words[0]=0,e.length=1;return}var c=e.words[9];for(t.words[t.length++]=c&i,l=10;l<e.length;l++){var p=e.words[l]|0;e.words[l-10]=(p&i)<<4|c>>>22,c=p}c>>>=22,e.words[l-10]=c,c===0&&e.length>10?e.length-=10:e.length-=9},O.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,i=0;i<e.length;i++){var s=e.words[i]|0;t+=s*977,e.words[i]=t&67108863,t=s*64+(t/67108864|0)}return e.words[e.length-1]===0&&(e.length--,e.words[e.length-1]===0&&e.length--),e};function W(){T.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}v(W,T);function K(){T.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}v(K,T);function pt(){T.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}v(pt,T),pt.prototype.imulK=function(e){for(var t=0,i=0;i<e.length;i++){var s=(e.words[i]|0)*19+t,l=s&67108863;s>>>=26,e.words[i]=l,t=s}return t!==0&&(e.words[e.length++]=t),e},o._prime=function(e){if(S[e])return S[e];var t;if(e==="k256")t=new O;else if(e==="p224")t=new W;else if(e==="p192")t=new K;else if(e==="p25519")t=new pt;else throw new Error("Unknown prime "+e);return S[e]=t,t};function ct(g){if(typeof g=="string"){var e=o._prime(g);this.m=e.p,this.prime=e}else u(g.gtn(1),"modulus must be greater than 1"),this.m=g,this.prime=null}ct.prototype._verify1=function(e){u(e.negative===0,"red works only with positives"),u(e.red,"red works only with red numbers")},ct.prototype._verify2=function(e,t){u((e.negative|t.negative)===0,"red works only with positives"),u(e.red&&e.red===t.red,"red works only with red numbers")},ct.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},ct.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},ct.prototype.add=function(e,t){this._verify2(e,t);var i=e.add(t);return i.cmp(this.m)>=0&&i.isub(this.m),i._forceRed(this)},ct.prototype.iadd=function(e,t){this._verify2(e,t);var i=e.iadd(t);return i.cmp(this.m)>=0&&i.isub(this.m),i},ct.prototype.sub=function(e,t){this._verify2(e,t);var i=e.sub(t);return i.cmpn(0)<0&&i.iadd(this.m),i._forceRed(this)},ct.prototype.isub=function(e,t){this._verify2(e,t);var i=e.isub(t);return i.cmpn(0)<0&&i.iadd(this.m),i},ct.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},ct.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},ct.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},ct.prototype.isqr=function(e){return this.imul(e,e.clone())},ct.prototype.sqr=function(e){return this.mul(e,e)},ct.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(u(t%2===1),t===3){var i=this.m.add(new o(1)).iushrn(2);return this.pow(e,i)}for(var s=this.m.subn(1),l=0;!s.isZero()&&s.andln(1)===0;)l++,s.iushrn(1);u(!s.isZero());var c=new o(1).toRed(this),p=c.redNeg(),d=this.m.subn(1).iushrn(1),r=this.m.bitLength();for(r=new o(2*r*r).toRed(this);this.pow(r,d).cmp(p)!==0;)r.redIAdd(p);for(var f=this.pow(r,s),m=this.pow(e,s.addn(1).iushrn(1)),_=this.pow(e,s),R=l;_.cmp(c)!==0;){for(var C=_,F=0;C.cmp(c)!==0;F++)C=C.redSqr();u(F<R);var z=this.pow(f,new o(1).iushln(R-F-1));m=m.redMul(z),f=z.redSqr(),_=_.redMul(f),R=F}return m},ct.prototype.invm=function(e){var t=e._invmp(this.m);return t.negative!==0?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},ct.prototype.pow=function(e,t){if(t.isZero())return new o(1).toRed(this);if(t.cmpn(1)===0)return e.clone();var i=4,s=new Array(1<<i);s[0]=new o(1).toRed(this),s[1]=e;for(var l=2;l<s.length;l++)s[l]=this.mul(s[l-1],e);var c=s[0],p=0,d=0,r=t.bitLength()%26;for(r===0&&(r=26),l=t.length-1;l>=0;l--){for(var f=t.words[l],m=r-1;m>=0;m--){var _=f>>m&1;if(c!==s[0]&&(c=this.sqr(c)),_===0&&p===0){d=0;continue}p<<=1,p|=_,d++,!(d!==i&&(l!==0||m!==0))&&(c=this.mul(c,s[p]),d=0,p=0)}r=26}return c},ct.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},ct.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new dt(e)};function dt(g){ct.call(this,g),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v(dt,ct),dt.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},dt.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},dt.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var i=e.imul(t),s=i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),l=i.isub(s).iushrn(this.shift),c=l;return l.cmp(this.m)>=0?c=l.isub(this.m):l.cmpn(0)<0&&(c=l.iadd(this.m)),c._forceRed(this)},dt.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var i=e.mul(t),s=i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),l=i.isub(s).iushrn(this.shift),c=l;return l.cmp(this.m)>=0?c=l.isub(this.m):l.cmpn(0)<0&&(c=l.iadd(this.m)),c._forceRed(this)},dt.prototype.invm=function(e){var t=this.imod(e._invmp(this.m).mul(this.r2));return t._forceRed(this)}})(a,Vt)})(Vo);Vo.exports;function Of(a){return wa(new Uint8Array(a))}function I2(a){return oi(a).buffer}var T2={};(function(a){const n=Ki,h=Zi,u=Hi,v=x=>x==null;function o(x){switch(x.arrayFormat){case"index":return A=>(S,T)=>{const O=S.length;return T===void 0||x.skipNull&&T===null||x.skipEmptyString&&T===""?S:T===null?[...S,[b(A,x),"[",O,"]"].join("")]:[...S,[b(A,x),"[",b(O,x),"]=",b(T,x)].join("")]};case"bracket":return A=>(S,T)=>T===void 0||x.skipNull&&T===null||x.skipEmptyString&&T===""?S:T===null?[...S,[b(A,x),"[]"].join("")]:[...S,[b(A,x),"[]=",b(T,x)].join("")];case"comma":case"separator":return A=>(S,T)=>T==null||T.length===0?S:S.length===0?[[b(A,x),"=",b(T,x)].join("")]:[[S,b(T,x)].join(x.arrayFormatSeparator)];default:return A=>(S,T)=>T===void 0||x.skipNull&&T===null||x.skipEmptyString&&T===""?S:T===null?[...S,b(A,x)]:[...S,[b(A,x),"=",b(T,x)].join("")]}}function w(x){let A;switch(x.arrayFormat){case"index":return(S,T,O)=>{if(A=/\[(\d*)\]$/.exec(S),S=S.replace(/\[\d*\]$/,""),!A){O[S]=T;return}O[S]===void 0&&(O[S]={}),O[S][A[1]]=T};case"bracket":return(S,T,O)=>{if(A=/(\[\])$/.exec(S),S=S.replace(/\[\]$/,""),!A){O[S]=T;return}if(O[S]===void 0){O[S]=[T];return}O[S]=[].concat(O[S],T)};case"comma":case"separator":return(S,T,O)=>{const K=typeof T=="string"&&T.split("").indexOf(x.arrayFormatSeparator)>-1?T.split(x.arrayFormatSeparator).map(pt=>B(pt,x)):T===null?T:B(T,x);O[S]=K};default:return(S,T,O)=>{if(O[S]===void 0){O[S]=T;return}O[S]=[].concat(O[S],T)}}}function y(x){if(typeof x!="string"||x.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function b(x,A){return A.encode?A.strict?n(x):encodeURIComponent(x):x}function B(x,A){return A.decode?h(x):x}function k(x){return Array.isArray(x)?x.sort():typeof x=="object"?k(Object.keys(x)).sort((A,S)=>Number(A)-Number(S)).map(A=>x[A]):x}function L(x){const A=x.indexOf("#");return A!==-1&&(x=x.slice(0,A)),x}function q(x){let A="";const S=x.indexOf("#");return S!==-1&&(A=x.slice(S)),A}function $(x){x=L(x);const A=x.indexOf("?");return A===-1?"":x.slice(A+1)}function M(x,A){return A.parseNumbers&&!Number.isNaN(Number(x))&&typeof x=="string"&&x.trim()!==""?x=Number(x):A.parseBooleans&&x!==null&&(x.toLowerCase()==="true"||x.toLowerCase()==="false")&&(x=x.toLowerCase()==="true"),x}function N(x,A){A=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},A),y(A.arrayFormatSeparator);const S=w(A),T=Object.create(null);if(typeof x!="string"||(x=x.trim().replace(/^[?#&]/,""),!x))return T;for(const O of x.split("&")){let[W,K]=u(A.decode?O.replace(/\+/g," "):O,"=");K=K===void 0?null:["comma","separator"].includes(A.arrayFormat)?K:B(K,A),S(B(W,A),K,T)}for(const O of Object.keys(T)){const W=T[O];if(typeof W=="object"&&W!==null)for(const K of Object.keys(W))W[K]=M(W[K],A);else T[O]=M(W,A)}return A.sort===!1?T:(A.sort===!0?Object.keys(T).sort():Object.keys(T).sort(A.sort)).reduce((O,W)=>{const K=T[W];return K&&typeof K=="object"&&!Array.isArray(K)?O[W]=k(K):O[W]=K,O},Object.create(null))}a.extract=$,a.parse=N,a.stringify=(x,A)=>{if(!x)return"";A=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},A),y(A.arrayFormatSeparator);const S=K=>A.skipNull&&v(x[K])||A.skipEmptyString&&x[K]==="",T=o(A),O={};for(const K of Object.keys(x))S(K)||(O[K]=x[K]);const W=Object.keys(O);return A.sort!==!1&&W.sort(A.sort),W.map(K=>{const pt=x[K];return pt===void 0?"":pt===null?b(K,A):Array.isArray(pt)?pt.reduce(T(K),[]).join("&"):b(K,A)+"="+b(pt,A)}).filter(K=>K.length>0).join("&")},a.parseUrl=(x,A)=>{A=Object.assign({decode:!0},A);const[S,T]=u(x,"#");return Object.assign({url:S.split("?")[0]||"",query:N($(x),A)},A&&A.parseFragmentIdentifier&&T?{fragmentIdentifier:B(T,A)}:{})},a.stringifyUrl=(x,A)=>{A=Object.assign({encode:!0,strict:!0},A);const S=L(x.url).split("?")[0]||"",T=a.extract(x.url),O=a.parse(T,{sort:!1}),W=Object.assign(O,x.query);let K=a.stringify(W,A);K&&(K=`?${K}`);let pt=q(x.url);return x.fragmentIdentifier&&(pt=`#${b(x.fragmentIdentifier,A)}`),`${S}${K}${pt}`}})(T2);async function Nu(a){const n=(a||256)/8,h=m2(n);return I2(wa(h))}async function qu(a,n){const h=ei(a.data),u=ei(a.iv),v=ei(a.hmac),o=ti(v,!1),w=ku(h,u),y=await Ou(n,w),b=ti(y,!1);return xr(o)===xr(b)}async function C2(a,n,h){const u=oi(Of(n)),v=h||await Nu(128),o=oi(Of(v)),w=ti(o,!1),y=JSON.stringify(a),b=yw(y),B=await R2(o,u,b),k=ti(B,!1),L=ku(B,o),q=await Ou(u,L),$=ti(q,!1);return{data:k,hmac:$,iv:w}}async function L2(a,n){const h=oi(Of(n));if(!h)throw new Error("Missing key: required for decryption");if(!await qu(a,h))return null;const v=ei(a.data),o=ei(a.iv),w=await B2(o,h,v),y=mw(w);let b;try{b=JSON.parse(y)}catch{return null}return b}const P2=Object.freeze(Object.defineProperty({__proto__:null,decrypt:L2,encrypt:C2,generateKey:Nu,verifyHmac:qu},Symbol.toStringTag,{value:"Module"}));class O2 extends p2{constructor(n,h){super({cryptoLib:P2,connectorOpts:n,pushServerOpts:h})}}const N2=Cs(aw);var nn={},q2=function(){return typeof Promise=="function"&&Promise.prototype&&Promise.prototype.then},Uu={},Er={},U2=Yf;function F2(){try{var a=new Uint8Array(1);return a.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},a.foo()===42}catch{return!1}}Gt.TYPED_ARRAY_SUPPORT=F2();var Q0=Gt.TYPED_ARRAY_SUPPORT?2147483647:1073741823;function Gt(a,n,h){return!Gt.TYPED_ARRAY_SUPPORT&&!(this instanceof Gt)?new Gt(a,n,h):typeof a=="number"?Fu(this,a):W2(this,a,n,h)}Gt.TYPED_ARRAY_SUPPORT&&(Gt.prototype.__proto__=Uint8Array.prototype,Gt.__proto__=Uint8Array,typeof Symbol<"u"&&Symbol.species&&Gt[Symbol.species]===Gt&&Object.defineProperty(Gt,Symbol.species,{value:null,configurable:!0,enumerable:!1,writable:!1}));function Go(a){if(a>=Q0)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+Q0.toString(16)+" bytes");return a|0}function $2(a){return a!==a}function si(a,n){var h;return Gt.TYPED_ARRAY_SUPPORT?(h=new Uint8Array(n),h.__proto__=Gt.prototype):(h=a,h===null&&(h=new Gt(n)),h.length=n),h}function Fu(a,n){var h=si(a,n<0?0:Go(n)|0);if(!Gt.TYPED_ARRAY_SUPPORT)for(var u=0;u<n;++u)h[u]=0;return h}function z2(a,n){var h=zu(n)|0,u=si(a,h),v=u.write(n);return v!==h&&(u=u.slice(0,v)),u}function Nf(a,n){for(var h=n.length<0?0:Go(n.length)|0,u=si(a,h),v=0;v<h;v+=1)u[v]=n[v]&255;return u}function D2(a,n,h,u){if(h<0||n.byteLength<h)throw new RangeError("'offset' is out of bounds");if(n.byteLength<h+(u||0))throw new RangeError("'length' is out of bounds");var v;return h===void 0&&u===void 0?v=new Uint8Array(n):u===void 0?v=new Uint8Array(n,h):v=new Uint8Array(n,h,u),Gt.TYPED_ARRAY_SUPPORT?v.__proto__=Gt.prototype:v=Nf(a,v),v}function H2(a,n){if(Gt.isBuffer(n)){var h=Go(n.length)|0,u=si(a,h);return u.length===0||n.copy(u,0,0,h),u}if(n){if(typeof ArrayBuffer<"u"&&n.buffer instanceof ArrayBuffer||"length"in n)return typeof n.length!="number"||$2(n.length)?si(a,0):Nf(a,n);if(n.type==="Buffer"&&Array.isArray(n.data))return Nf(a,n.data)}throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}function $u(a,n){n=n||1/0;for(var h,u=a.length,v=null,o=[],w=0;w<u;++w){if(h=a.charCodeAt(w),h>55295&&h<57344){if(!v){if(h>56319){(n-=3)>-1&&o.push(239,191,189);continue}else if(w+1===u){(n-=3)>-1&&o.push(239,191,189);continue}v=h;continue}if(h<56320){(n-=3)>-1&&o.push(239,191,189),v=h;continue}h=(v-55296<<10|h-56320)+65536}else v&&(n-=3)>-1&&o.push(239,191,189);if(v=null,h<128){if((n-=1)<0)break;o.push(h)}else if(h<2048){if((n-=2)<0)break;o.push(h>>6|192,h&63|128)}else if(h<65536){if((n-=3)<0)break;o.push(h>>12|224,h>>6&63|128,h&63|128)}else if(h<1114112){if((n-=4)<0)break;o.push(h>>18|240,h>>12&63|128,h>>6&63|128,h&63|128)}else throw new Error("Invalid code point")}return o}function zu(a){if(Gt.isBuffer(a))return a.length;if(typeof ArrayBuffer<"u"&&typeof ArrayBuffer.isView=="function"&&(ArrayBuffer.isView(a)||a instanceof ArrayBuffer))return a.byteLength;typeof a!="string"&&(a=""+a);var n=a.length;return n===0?0:$u(a).length}function K2(a,n,h,u){for(var v=0;v<u&&!(v+h>=n.length||v>=a.length);++v)n[v+h]=a[v];return v}function Z2(a,n,h,u){return K2($u(n,a.length-h),a,h,u)}function W2(a,n,h,u){if(typeof n=="number")throw new TypeError('"value" argument must not be a number');return typeof ArrayBuffer<"u"&&n instanceof ArrayBuffer?D2(a,n,h,u):typeof n=="string"?z2(a,n):H2(a,n)}Gt.prototype.write=function(n,h,u){h===void 0?(u=this.length,h=0):u===void 0&&typeof h=="string"?(u=this.length,h=0):isFinite(h)&&(h=h|0,isFinite(u)?u=u|0:u=void 0);var v=this.length-h;if((u===void 0||u>v)&&(u=v),n.length>0&&(u<0||h<0)||h>this.length)throw new RangeError("Attempt to write outside buffer bounds");return Z2(this,n,h,u)};Gt.prototype.slice=function(n,h){var u=this.length;n=~~n,h=h===void 0?u:~~h,n<0?(n+=u,n<0&&(n=0)):n>u&&(n=u),h<0?(h+=u,h<0&&(h=0)):h>u&&(h=u),h<n&&(h=n);var v;if(Gt.TYPED_ARRAY_SUPPORT)v=this.subarray(n,h),v.__proto__=Gt.prototype;else{var o=h-n;v=new Gt(o,void 0);for(var w=0;w<o;++w)v[w]=this[w+n]}return v};Gt.prototype.copy=function(n,h,u,v){if(u||(u=0),!v&&v!==0&&(v=this.length),h>=n.length&&(h=n.length),h||(h=0),v>0&&v<u&&(v=u),v===u||n.length===0||this.length===0)return 0;if(h<0)throw new RangeError("targetStart out of bounds");if(u<0||u>=this.length)throw new RangeError("sourceStart out of bounds");if(v<0)throw new RangeError("sourceEnd out of bounds");v>this.length&&(v=this.length),n.length-h<v-u&&(v=n.length-h+u);var o=v-u,w;if(this===n&&u<h&&h<v)for(w=o-1;w>=0;--w)n[w+h]=this[w+u];else if(o<1e3||!Gt.TYPED_ARRAY_SUPPORT)for(w=0;w<o;++w)n[w+h]=this[w+u];else Uint8Array.prototype.set.call(n,this.subarray(u,u+o),h);return o};Gt.prototype.fill=function(n,h,u){if(typeof n=="string"){if(typeof h=="string"?(h=0,u=this.length):typeof u=="string"&&(u=this.length),n.length===1){var v=n.charCodeAt(0);v<256&&(n=v)}}else typeof n=="number"&&(n=n&255);if(h<0||this.length<h||this.length<u)throw new RangeError("Out of range index");if(u<=h)return this;h=h>>>0,u=u===void 0?this.length:u>>>0,n||(n=0);var o;if(typeof n=="number")for(o=h;o<u;++o)this[o]=n;else{var w=Gt.isBuffer(n)?n:new Gt(n),y=w.length;for(o=0;o<u-h;++o)this[o+h]=w[o%y]}return this};Gt.concat=function(n,h){if(!U2(n))throw new TypeError('"list" argument must be an Array of Buffers');if(n.length===0)return si(null,0);var u;if(h===void 0)for(h=0,u=0;u<n.length;++u)h+=n[u].length;var v=Fu(null,h),o=0;for(u=0;u<n.length;++u){var w=n[u];if(!Gt.isBuffer(w))throw new TypeError('"list" argument must be an Array of Buffers');w.copy(v,o),o+=w.length}return v};Gt.byteLength=zu;Gt.prototype._isBuffer=!0;Gt.isBuffer=function(n){return!!(n!=null&&n._isBuffer)};Er.alloc=function(a){var n=new Gt(a);return n.fill(0),n};Er.from=function(a){return new Gt(a)};var We={},Jo,V2=[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];We.getSymbolSize=function(n){if(!n)throw new Error('"version" cannot be null or undefined');if(n<1||n>40)throw new Error('"version" should be in range from 1 to 40');return n*4+17};We.getSymbolTotalCodewords=function(n){return V2[n]};We.getBCHDigit=function(a){for(var n=0;a!==0;)n++,a>>>=1;return n};We.setToSJISFunction=function(n){if(typeof n!="function")throw new Error('"toSJISFunc" is not a valid function.');Jo=n};We.isKanjiModeEnabled=function(){return typeof Jo<"u"};We.toSJIS=function(n){return Jo(n)};var ba={};(function(a){a.L={bit:1},a.M={bit:0},a.Q={bit:3},a.H={bit:2};function n(h){if(typeof h!="string")throw new Error("Param is not a string");var u=h.toLowerCase();switch(u){case"l":case"low":return a.L;case"m":case"medium":return a.M;case"q":case"quartile":return a.Q;case"h":case"high":return a.H;default:throw new Error("Unknown EC Level: "+h)}}a.isValid=function(u){return u&&typeof u.bit<"u"&&u.bit>=0&&u.bit<4},a.from=function(u,v){if(a.isValid(u))return u;try{return n(u)}catch{return v}}})(ba);function Du(){this.buffer=[],this.length=0}Du.prototype={get:function(a){var n=Math.floor(a/8);return(this.buffer[n]>>>7-a%8&1)===1},put:function(a,n){for(var h=0;h<n;h++)this.putBit((a>>>n-h-1&1)===1)},getLengthInBits:function(){return this.length},putBit:function(a){var n=Math.floor(this.length/8);this.buffer.length<=n&&this.buffer.push(0),a&&(this.buffer[n]|=128>>>this.length%8),this.length++}};var G2=Du,ts=Er;function an(a){if(!a||a<1)throw new Error("BitMatrix size must be defined and greater than 0");this.size=a,this.data=ts.alloc(a*a),this.reservedBit=ts.alloc(a*a)}an.prototype.set=function(a,n,h,u){var v=a*this.size+n;this.data[v]=h,u&&(this.reservedBit[v]=!0)};an.prototype.get=function(a,n){return this.data[a*this.size+n]};an.prototype.xor=function(a,n,h){this.data[a*this.size+n]^=h};an.prototype.isReserved=function(a,n){return this.reservedBit[a*this.size+n]};var J2=an,Hu={};(function(a){var n=We.getSymbolSize;a.getRowColCoords=function(u){if(u===1)return[];for(var v=Math.floor(u/7)+2,o=n(u),w=o===145?26:Math.ceil((o-13)/(2*v-2))*2,y=[o-7],b=1;b<v-1;b++)y[b]=y[b-1]-w;return y.push(6),y.reverse()},a.getPositions=function(u){for(var v=[],o=a.getRowColCoords(u),w=o.length,y=0;y<w;y++)for(var b=0;b<w;b++)y===0&&b===0||y===0&&b===w-1||y===w-1&&b===0||v.push([o[y],o[b]]);return v}})(Hu);var Ku={},j2=We.getSymbolSize,es=7;Ku.getPositions=function(n){var h=j2(n);return[[0,0],[h-es,0],[0,h-es]]};var Zu={};(function(a){a.Patterns={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var n={N1:3,N2:3,N3:40,N4:10};a.isValid=function(v){return v!=null&&v!==""&&!isNaN(v)&&v>=0&&v<=7},a.from=function(v){return a.isValid(v)?parseInt(v,10):void 0},a.getPenaltyN1=function(v){for(var o=v.size,w=0,y=0,b=0,B=null,k=null,L=0;L<o;L++){y=b=0,B=k=null;for(var q=0;q<o;q++){var $=v.get(L,q);$===B?y++:(y>=5&&(w+=n.N1+(y-5)),B=$,y=1),$=v.get(q,L),$===k?b++:(b>=5&&(w+=n.N1+(b-5)),k=$,b=1)}y>=5&&(w+=n.N1+(y-5)),b>=5&&(w+=n.N1+(b-5))}return w},a.getPenaltyN2=function(v){for(var o=v.size,w=0,y=0;y<o-1;y++)for(var b=0;b<o-1;b++){var B=v.get(y,b)+v.get(y,b+1)+v.get(y+1,b)+v.get(y+1,b+1);(B===4||B===0)&&w++}return w*n.N2},a.getPenaltyN3=function(v){for(var o=v.size,w=0,y=0,b=0,B=0;B<o;B++){y=b=0;for(var k=0;k<o;k++)y=y<<1&2047|v.get(B,k),k>=10&&(y===1488||y===93)&&w++,b=b<<1&2047|v.get(k,B),k>=10&&(b===1488||b===93)&&w++}return w*n.N3},a.getPenaltyN4=function(v){for(var o=0,w=v.data.length,y=0;y<w;y++)o+=v.data[y];var b=Math.abs(Math.ceil(o*100/w/5)-10);return b*n.N4};function h(u,v,o){switch(u){case a.Patterns.PATTERN000:return(v+o)%2===0;case a.Patterns.PATTERN001:return v%2===0;case a.Patterns.PATTERN010:return o%3===0;case a.Patterns.PATTERN011:return(v+o)%3===0;case a.Patterns.PATTERN100:return(Math.floor(v/2)+Math.floor(o/3))%2===0;case a.Patterns.PATTERN101:return v*o%2+v*o%3===0;case a.Patterns.PATTERN110:return(v*o%2+v*o%3)%2===0;case a.Patterns.PATTERN111:return(v*o%3+(v+o)%2)%2===0;default:throw new Error("bad maskPattern:"+u)}}a.applyMask=function(v,o){for(var w=o.size,y=0;y<w;y++)for(var b=0;b<w;b++)o.isReserved(b,y)||o.xor(b,y,h(v,b,y))},a.getBestMask=function(v,o){for(var w=Object.keys(a.Patterns).length,y=0,b=1/0,B=0;B<w;B++){o(B),a.applyMask(B,v);var k=a.getPenaltyN1(v)+a.getPenaltyN2(v)+a.getPenaltyN3(v)+a.getPenaltyN4(v);a.applyMask(B,v),k<b&&(b=k,y=B)}return y}})(Zu);var Ma={},yr=ba,mn=[1,1,1,1,1,1,1,1,1,1,2,2,1,2,2,4,1,2,4,4,2,4,4,4,2,4,6,5,2,4,6,6,2,5,8,8,4,5,8,8,4,5,8,11,4,8,10,11,4,9,12,16,4,9,16,16,6,10,12,18,6,10,17,16,6,11,16,19,6,13,18,21,7,14,21,25,8,16,20,25,8,17,23,25,9,17,23,34,9,18,25,30,10,20,27,32,12,21,29,35,12,23,34,37,12,25,34,40,13,26,35,42,14,28,38,45,15,29,40,48,16,31,43,51,17,33,45,54,18,35,48,57,19,37,51,60,19,38,53,63,20,40,56,66,21,43,59,70,22,45,62,74,24,47,65,77,25,49,68,81],gn=[7,10,13,17,10,16,22,28,15,26,36,44,20,36,52,64,26,48,72,88,36,64,96,112,40,72,108,130,48,88,132,156,60,110,160,192,72,130,192,224,80,150,224,264,96,176,260,308,104,198,288,352,120,216,320,384,132,240,360,432,144,280,408,480,168,308,448,532,180,338,504,588,196,364,546,650,224,416,600,700,224,442,644,750,252,476,690,816,270,504,750,900,300,560,810,960,312,588,870,1050,336,644,952,1110,360,700,1020,1200,390,728,1050,1260,420,784,1140,1350,450,812,1200,1440,480,868,1290,1530,510,924,1350,1620,540,980,1440,1710,570,1036,1530,1800,570,1064,1590,1890,600,1120,1680,1980,630,1204,1770,2100,660,1260,1860,2220,720,1316,1950,2310,750,1372,2040,2430];Ma.getBlocksCount=function(n,h){switch(h){case yr.L:return mn[(n-1)*4+0];case yr.M:return mn[(n-1)*4+1];case yr.Q:return mn[(n-1)*4+2];case yr.H:return mn[(n-1)*4+3];default:return}};Ma.getTotalCodewordsCount=function(n,h){switch(h){case yr.L:return gn[(n-1)*4+0];case yr.M:return gn[(n-1)*4+1];case yr.Q:return gn[(n-1)*4+2];case yr.H:return gn[(n-1)*4+3];default:return}};var Wu={},xa={},Vu=Er,Pi=Vu.alloc(512),Cn=Vu.alloc(256);(function(){for(var n=1,h=0;h<255;h++)Pi[h]=n,Cn[n]=h,n<<=1,n&256&&(n^=285);for(h=255;h<512;h++)Pi[h]=Pi[h-255]})();xa.log=function(n){if(n<1)throw new Error("log("+n+")");return Cn[n]};xa.exp=function(n){return Pi[n]};xa.mul=function(n,h){return n===0||h===0?0:Pi[Cn[n]+Cn[h]]};(function(a){var n=Er,h=xa;a.mul=function(v,o){for(var w=n.alloc(v.length+o.length-1),y=0;y<v.length;y++)for(var b=0;b<o.length;b++)w[y+b]^=h.mul(v[y],o[b]);return w},a.mod=function(v,o){for(var w=n.from(v);w.length-o.length>=0;){for(var y=w[0],b=0;b<o.length;b++)w[b]^=h.mul(o[b],y);for(var B=0;B<w.length&&w[B]===0;)B++;w=w.slice(B)}return w},a.generateECPolynomial=function(v){for(var o=n.from([1]),w=0;w<v;w++)o=a.mul(o,[1,h.exp(w)]);return o}})(Wu);var Gu={};/*!
|
|
25
|
+
* The buffer module from node.js, for the browser.
|
|
26
|
+
*
|
|
27
|
+
* @author Feross Aboukhadijeh <https://feross.org>
|
|
28
|
+
* @license MIT
|
|
29
|
+
*/(function(a){var n=Ql(),h=tc(),u=typeof Symbol=="function"&&typeof Symbol.for=="function"?Symbol.for("nodejs.util.inspect.custom"):null;a.Buffer=y,a.SlowBuffer=S,a.INSPECT_MAX_BYTES=50;var v=2147483647;a.kMaxLength=v,y.TYPED_ARRAY_SUPPORT=o(),!y.TYPED_ARRAY_SUPPORT&&typeof console<"u"&&typeof console.error=="function"&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function o(){try{var U=new Uint8Array(1),I={foo:function(){return 42}};return Object.setPrototypeOf(I,Uint8Array.prototype),Object.setPrototypeOf(U,I),U.foo()===42}catch{return!1}}Object.defineProperty(y.prototype,"parent",{enumerable:!0,get:function(){if(y.isBuffer(this))return this.buffer}}),Object.defineProperty(y.prototype,"offset",{enumerable:!0,get:function(){if(y.isBuffer(this))return this.byteOffset}});function w(U){if(U>v)throw new RangeError('The value "'+U+'" is invalid for option "size"');var I=new Uint8Array(U);return Object.setPrototypeOf(I,y.prototype),I}function y(U,I,E){if(typeof U=="number"){if(typeof I=="string")throw new TypeError('The "string" argument must be of type string. Received type number');return L(U)}return b(U,I,E)}y.poolSize=8192;function b(U,I,E){if(typeof U=="string")return q(U,I);if(ArrayBuffer.isView(U))return M(U);if(U==null)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof U);if(Ct(U,ArrayBuffer)||U&&Ct(U.buffer,ArrayBuffer)||typeof SharedArrayBuffer<"u"&&(Ct(U,SharedArrayBuffer)||U&&Ct(U.buffer,SharedArrayBuffer)))return N(U,I,E);if(typeof U=="number")throw new TypeError('The "value" argument must not be of type number. Received type number');var P=U.valueOf&&U.valueOf();if(P!=null&&P!==U)return y.from(P,I,E);var H=x(U);if(H)return H;if(typeof Symbol<"u"&&Symbol.toPrimitive!=null&&typeof U[Symbol.toPrimitive]=="function")return y.from(U[Symbol.toPrimitive]("string"),I,E);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof U)}y.from=function(U,I,E){return b(U,I,E)},Object.setPrototypeOf(y.prototype,Uint8Array.prototype),Object.setPrototypeOf(y,Uint8Array);function B(U){if(typeof U!="number")throw new TypeError('"size" argument must be of type number');if(U<0)throw new RangeError('The value "'+U+'" is invalid for option "size"')}function k(U,I,E){return B(U),U<=0?w(U):I!==void 0?typeof E=="string"?w(U).fill(I,E):w(U).fill(I):w(U)}y.alloc=function(U,I,E){return k(U,I,E)};function L(U){return B(U),w(U<0?0:A(U)|0)}y.allocUnsafe=function(U){return L(U)},y.allocUnsafeSlow=function(U){return L(U)};function q(U,I){if((typeof I!="string"||I==="")&&(I="utf8"),!y.isEncoding(I))throw new TypeError("Unknown encoding: "+I);var E=T(U,I)|0,P=w(E),H=P.write(U,I);return H!==E&&(P=P.slice(0,H)),P}function $(U){for(var I=U.length<0?0:A(U.length)|0,E=w(I),P=0;P<I;P+=1)E[P]=U[P]&255;return E}function M(U){if(Ct(U,Uint8Array)){var I=new Uint8Array(U);return N(I.buffer,I.byteOffset,I.byteLength)}return $(U)}function N(U,I,E){if(I<0||U.byteLength<I)throw new RangeError('"offset" is outside of buffer bounds');if(U.byteLength<I+(E||0))throw new RangeError('"length" is outside of buffer bounds');var P;return I===void 0&&E===void 0?P=new Uint8Array(U):E===void 0?P=new Uint8Array(U,I):P=new Uint8Array(U,I,E),Object.setPrototypeOf(P,y.prototype),P}function x(U){if(y.isBuffer(U)){var I=A(U.length)|0,E=w(I);return E.length===0||U.copy(E,0,0,I),E}if(U.length!==void 0)return typeof U.length!="number"||wt(U.length)?w(0):$(U);if(U.type==="Buffer"&&Array.isArray(U.data))return $(U.data)}function A(U){if(U>=v)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+v.toString(16)+" bytes");return U|0}function S(U){return+U!=U&&(U=0),y.alloc(+U)}y.isBuffer=function(I){return I!=null&&I._isBuffer===!0&&I!==y.prototype},y.compare=function(I,E){if(Ct(I,Uint8Array)&&(I=y.from(I,I.offset,I.byteLength)),Ct(E,Uint8Array)&&(E=y.from(E,E.offset,E.byteLength)),!y.isBuffer(I)||!y.isBuffer(E))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(I===E)return 0;for(var P=I.length,H=E.length,D=0,ut=Math.min(P,H);D<ut;++D)if(I[D]!==E[D]){P=I[D],H=E[D];break}return P<H?-1:H<P?1:0},y.isEncoding=function(I){switch(String(I).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},y.concat=function(I,E){if(!Array.isArray(I))throw new TypeError('"list" argument must be an Array of Buffers');if(I.length===0)return y.alloc(0);var P;if(E===void 0)for(E=0,P=0;P<I.length;++P)E+=I[P].length;var H=y.allocUnsafe(E),D=0;for(P=0;P<I.length;++P){var ut=I[P];if(Ct(ut,Uint8Array))D+ut.length>H.length?y.from(ut).copy(H,D):Uint8Array.prototype.set.call(H,ut,D);else if(y.isBuffer(ut))ut.copy(H,D);else throw new TypeError('"list" argument must be an Array of Buffers');D+=ut.length}return H};function T(U,I){if(y.isBuffer(U))return U.length;if(ArrayBuffer.isView(U)||Ct(U,ArrayBuffer))return U.byteLength;if(typeof U!="string")throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof U);var E=U.length,P=arguments.length>2&&arguments[2]===!0;if(!P&&E===0)return 0;for(var H=!1;;)switch(I){case"ascii":case"latin1":case"binary":return E;case"utf8":case"utf-8":return G(U).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E*2;case"hex":return E>>>1;case"base64":return gt(U).length;default:if(H)return P?-1:G(U).length;I=(""+I).toLowerCase(),H=!0}}y.byteLength=T;function O(U,I,E){var P=!1;if((I===void 0||I<0)&&(I=0),I>this.length||((E===void 0||E>this.length)&&(E=this.length),E<=0)||(E>>>=0,I>>>=0,E<=I))return"";for(U||(U="utf8");;)switch(U){case"hex":return r(this,I,E);case"utf8":case"utf-8":return s(this,I,E);case"ascii":return p(this,I,E);case"latin1":case"binary":return d(this,I,E);case"base64":return i(this,I,E);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return f(this,I,E);default:if(P)throw new TypeError("Unknown encoding: "+U);U=(U+"").toLowerCase(),P=!0}}y.prototype._isBuffer=!0;function W(U,I,E){var P=U[I];U[I]=U[E],U[E]=P}y.prototype.swap16=function(){var I=this.length;if(I%2!==0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var E=0;E<I;E+=2)W(this,E,E+1);return this},y.prototype.swap32=function(){var I=this.length;if(I%4!==0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var E=0;E<I;E+=4)W(this,E,E+3),W(this,E+1,E+2);return this},y.prototype.swap64=function(){var I=this.length;if(I%8!==0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var E=0;E<I;E+=8)W(this,E,E+7),W(this,E+1,E+6),W(this,E+2,E+5),W(this,E+3,E+4);return this},y.prototype.toString=function(){var I=this.length;return I===0?"":arguments.length===0?s(this,0,I):O.apply(this,arguments)},y.prototype.toLocaleString=y.prototype.toString,y.prototype.equals=function(I){if(!y.isBuffer(I))throw new TypeError("Argument must be a Buffer");return this===I?!0:y.compare(this,I)===0},y.prototype.inspect=function(){var I="",E=a.INSPECT_MAX_BYTES;return I=this.toString("hex",0,E).replace(/(.{2})/g,"$1 ").trim(),this.length>E&&(I+=" ... "),"<Buffer "+I+">"},u&&(y.prototype[u]=y.prototype.inspect),y.prototype.compare=function(I,E,P,H,D){if(Ct(I,Uint8Array)&&(I=y.from(I,I.offset,I.byteLength)),!y.isBuffer(I))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof I);if(E===void 0&&(E=0),P===void 0&&(P=I?I.length:0),H===void 0&&(H=0),D===void 0&&(D=this.length),E<0||P>I.length||H<0||D>this.length)throw new RangeError("out of range index");if(H>=D&&E>=P)return 0;if(H>=D)return-1;if(E>=P)return 1;if(E>>>=0,P>>>=0,H>>>=0,D>>>=0,this===I)return 0;for(var ut=D-H,vt=P-E,V=Math.min(ut,vt),bt=this.slice(H,D),yt=I.slice(E,P),J=0;J<V;++J)if(bt[J]!==yt[J]){ut=bt[J],vt=yt[J];break}return ut<vt?-1:vt<ut?1:0};function K(U,I,E,P,H){if(U.length===0)return-1;if(typeof E=="string"?(P=E,E=0):E>2147483647?E=2147483647:E<-2147483648&&(E=-2147483648),E=+E,wt(E)&&(E=H?0:U.length-1),E<0&&(E=U.length+E),E>=U.length){if(H)return-1;E=U.length-1}else if(E<0)if(H)E=0;else return-1;if(typeof I=="string"&&(I=y.from(I,P)),y.isBuffer(I))return I.length===0?-1:pt(U,I,E,P,H);if(typeof I=="number")return I=I&255,typeof Uint8Array.prototype.indexOf=="function"?H?Uint8Array.prototype.indexOf.call(U,I,E):Uint8Array.prototype.lastIndexOf.call(U,I,E):pt(U,[I],E,P,H);throw new TypeError("val must be string, number or Buffer")}function pt(U,I,E,P,H){var D=1,ut=U.length,vt=I.length;if(P!==void 0&&(P=String(P).toLowerCase(),P==="ucs2"||P==="ucs-2"||P==="utf16le"||P==="utf-16le")){if(U.length<2||I.length<2)return-1;D=2,ut/=2,vt/=2,E/=2}function V(Mt,Q){return D===1?Mt[Q]:Mt.readUInt16BE(Q*D)}var bt;if(H){var yt=-1;for(bt=E;bt<ut;bt++)if(V(U,bt)===V(I,yt===-1?0:bt-yt)){if(yt===-1&&(yt=bt),bt-yt+1===vt)return yt*D}else yt!==-1&&(bt-=bt-yt),yt=-1}else for(E+vt>ut&&(E=ut-vt),bt=E;bt>=0;bt--){for(var J=!0,Lt=0;Lt<vt;Lt++)if(V(U,bt+Lt)!==V(I,Lt)){J=!1;break}if(J)return bt}return-1}y.prototype.includes=function(I,E,P){return this.indexOf(I,E,P)!==-1},y.prototype.indexOf=function(I,E,P){return K(this,I,E,P,!0)},y.prototype.lastIndexOf=function(I,E,P){return K(this,I,E,P,!1)};function ct(U,I,E,P){E=Number(E)||0;var H=U.length-E;P?(P=Number(P),P>H&&(P=H)):P=H;var D=I.length;P>D/2&&(P=D/2);for(var ut=0;ut<P;++ut){var vt=parseInt(I.substr(ut*2,2),16);if(wt(vt))return ut;U[E+ut]=vt}return ut}function dt(U,I,E,P){return j(G(I,U.length-E),U,E,P)}function g(U,I,E,P){return j(Z(I),U,E,P)}function e(U,I,E,P){return j(gt(I),U,E,P)}function t(U,I,E,P){return j(mt(I,U.length-E),U,E,P)}y.prototype.write=function(I,E,P,H){if(E===void 0)H="utf8",P=this.length,E=0;else if(P===void 0&&typeof E=="string")H=E,P=this.length,E=0;else if(isFinite(E))E=E>>>0,isFinite(P)?(P=P>>>0,H===void 0&&(H="utf8")):(H=P,P=void 0);else throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");var D=this.length-E;if((P===void 0||P>D)&&(P=D),I.length>0&&(P<0||E<0)||E>this.length)throw new RangeError("Attempt to write outside buffer bounds");H||(H="utf8");for(var ut=!1;;)switch(H){case"hex":return ct(this,I,E,P);case"utf8":case"utf-8":return dt(this,I,E,P);case"ascii":case"latin1":case"binary":return g(this,I,E,P);case"base64":return e(this,I,E,P);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return t(this,I,E,P);default:if(ut)throw new TypeError("Unknown encoding: "+H);H=(""+H).toLowerCase(),ut=!0}},y.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};function i(U,I,E){return I===0&&E===U.length?n.fromByteArray(U):n.fromByteArray(U.slice(I,E))}function s(U,I,E){E=Math.min(U.length,E);for(var P=[],H=I;H<E;){var D=U[H],ut=null,vt=D>239?4:D>223?3:D>191?2:1;if(H+vt<=E){var V,bt,yt,J;switch(vt){case 1:D<128&&(ut=D);break;case 2:V=U[H+1],(V&192)===128&&(J=(D&31)<<6|V&63,J>127&&(ut=J));break;case 3:V=U[H+1],bt=U[H+2],(V&192)===128&&(bt&192)===128&&(J=(D&15)<<12|(V&63)<<6|bt&63,J>2047&&(J<55296||J>57343)&&(ut=J));break;case 4:V=U[H+1],bt=U[H+2],yt=U[H+3],(V&192)===128&&(bt&192)===128&&(yt&192)===128&&(J=(D&15)<<18|(V&63)<<12|(bt&63)<<6|yt&63,J>65535&&J<1114112&&(ut=J))}}ut===null?(ut=65533,vt=1):ut>65535&&(ut-=65536,P.push(ut>>>10&1023|55296),ut=56320|ut&1023),P.push(ut),H+=vt}return c(P)}var l=4096;function c(U){var I=U.length;if(I<=l)return String.fromCharCode.apply(String,U);for(var E="",P=0;P<I;)E+=String.fromCharCode.apply(String,U.slice(P,P+=l));return E}function p(U,I,E){var P="";E=Math.min(U.length,E);for(var H=I;H<E;++H)P+=String.fromCharCode(U[H]&127);return P}function d(U,I,E){var P="";E=Math.min(U.length,E);for(var H=I;H<E;++H)P+=String.fromCharCode(U[H]);return P}function r(U,I,E){var P=U.length;(!I||I<0)&&(I=0),(!E||E<0||E>P)&&(E=P);for(var H="",D=I;D<E;++D)H+=Y[U[D]];return H}function f(U,I,E){for(var P=U.slice(I,E),H="",D=0;D<P.length-1;D+=2)H+=String.fromCharCode(P[D]+P[D+1]*256);return H}y.prototype.slice=function(I,E){var P=this.length;I=~~I,E=E===void 0?P:~~E,I<0?(I+=P,I<0&&(I=0)):I>P&&(I=P),E<0?(E+=P,E<0&&(E=0)):E>P&&(E=P),E<I&&(E=I);var H=this.subarray(I,E);return Object.setPrototypeOf(H,y.prototype),H};function m(U,I,E){if(U%1!==0||U<0)throw new RangeError("offset is not uint");if(U+I>E)throw new RangeError("Trying to access beyond buffer length")}y.prototype.readUintLE=y.prototype.readUIntLE=function(I,E,P){I=I>>>0,E=E>>>0,P||m(I,E,this.length);for(var H=this[I],D=1,ut=0;++ut<E&&(D*=256);)H+=this[I+ut]*D;return H},y.prototype.readUintBE=y.prototype.readUIntBE=function(I,E,P){I=I>>>0,E=E>>>0,P||m(I,E,this.length);for(var H=this[I+--E],D=1;E>0&&(D*=256);)H+=this[I+--E]*D;return H},y.prototype.readUint8=y.prototype.readUInt8=function(I,E){return I=I>>>0,E||m(I,1,this.length),this[I]},y.prototype.readUint16LE=y.prototype.readUInt16LE=function(I,E){return I=I>>>0,E||m(I,2,this.length),this[I]|this[I+1]<<8},y.prototype.readUint16BE=y.prototype.readUInt16BE=function(I,E){return I=I>>>0,E||m(I,2,this.length),this[I]<<8|this[I+1]},y.prototype.readUint32LE=y.prototype.readUInt32LE=function(I,E){return I=I>>>0,E||m(I,4,this.length),(this[I]|this[I+1]<<8|this[I+2]<<16)+this[I+3]*16777216},y.prototype.readUint32BE=y.prototype.readUInt32BE=function(I,E){return I=I>>>0,E||m(I,4,this.length),this[I]*16777216+(this[I+1]<<16|this[I+2]<<8|this[I+3])},y.prototype.readIntLE=function(I,E,P){I=I>>>0,E=E>>>0,P||m(I,E,this.length);for(var H=this[I],D=1,ut=0;++ut<E&&(D*=256);)H+=this[I+ut]*D;return D*=128,H>=D&&(H-=Math.pow(2,8*E)),H},y.prototype.readIntBE=function(I,E,P){I=I>>>0,E=E>>>0,P||m(I,E,this.length);for(var H=E,D=1,ut=this[I+--H];H>0&&(D*=256);)ut+=this[I+--H]*D;return D*=128,ut>=D&&(ut-=Math.pow(2,8*E)),ut},y.prototype.readInt8=function(I,E){return I=I>>>0,E||m(I,1,this.length),this[I]&128?(255-this[I]+1)*-1:this[I]},y.prototype.readInt16LE=function(I,E){I=I>>>0,E||m(I,2,this.length);var P=this[I]|this[I+1]<<8;return P&32768?P|4294901760:P},y.prototype.readInt16BE=function(I,E){I=I>>>0,E||m(I,2,this.length);var P=this[I+1]|this[I]<<8;return P&32768?P|4294901760:P},y.prototype.readInt32LE=function(I,E){return I=I>>>0,E||m(I,4,this.length),this[I]|this[I+1]<<8|this[I+2]<<16|this[I+3]<<24},y.prototype.readInt32BE=function(I,E){return I=I>>>0,E||m(I,4,this.length),this[I]<<24|this[I+1]<<16|this[I+2]<<8|this[I+3]},y.prototype.readFloatLE=function(I,E){return I=I>>>0,E||m(I,4,this.length),h.read(this,I,!0,23,4)},y.prototype.readFloatBE=function(I,E){return I=I>>>0,E||m(I,4,this.length),h.read(this,I,!1,23,4)},y.prototype.readDoubleLE=function(I,E){return I=I>>>0,E||m(I,8,this.length),h.read(this,I,!0,52,8)},y.prototype.readDoubleBE=function(I,E){return I=I>>>0,E||m(I,8,this.length),h.read(this,I,!1,52,8)};function _(U,I,E,P,H,D){if(!y.isBuffer(U))throw new TypeError('"buffer" argument must be a Buffer instance');if(I>H||I<D)throw new RangeError('"value" argument is out of bounds');if(E+P>U.length)throw new RangeError("Index out of range")}y.prototype.writeUintLE=y.prototype.writeUIntLE=function(I,E,P,H){if(I=+I,E=E>>>0,P=P>>>0,!H){var D=Math.pow(2,8*P)-1;_(this,I,E,P,D,0)}var ut=1,vt=0;for(this[E]=I&255;++vt<P&&(ut*=256);)this[E+vt]=I/ut&255;return E+P},y.prototype.writeUintBE=y.prototype.writeUIntBE=function(I,E,P,H){if(I=+I,E=E>>>0,P=P>>>0,!H){var D=Math.pow(2,8*P)-1;_(this,I,E,P,D,0)}var ut=P-1,vt=1;for(this[E+ut]=I&255;--ut>=0&&(vt*=256);)this[E+ut]=I/vt&255;return E+P},y.prototype.writeUint8=y.prototype.writeUInt8=function(I,E,P){return I=+I,E=E>>>0,P||_(this,I,E,1,255,0),this[E]=I&255,E+1},y.prototype.writeUint16LE=y.prototype.writeUInt16LE=function(I,E,P){return I=+I,E=E>>>0,P||_(this,I,E,2,65535,0),this[E]=I&255,this[E+1]=I>>>8,E+2},y.prototype.writeUint16BE=y.prototype.writeUInt16BE=function(I,E,P){return I=+I,E=E>>>0,P||_(this,I,E,2,65535,0),this[E]=I>>>8,this[E+1]=I&255,E+2},y.prototype.writeUint32LE=y.prototype.writeUInt32LE=function(I,E,P){return I=+I,E=E>>>0,P||_(this,I,E,4,4294967295,0),this[E+3]=I>>>24,this[E+2]=I>>>16,this[E+1]=I>>>8,this[E]=I&255,E+4},y.prototype.writeUint32BE=y.prototype.writeUInt32BE=function(I,E,P){return I=+I,E=E>>>0,P||_(this,I,E,4,4294967295,0),this[E]=I>>>24,this[E+1]=I>>>16,this[E+2]=I>>>8,this[E+3]=I&255,E+4},y.prototype.writeIntLE=function(I,E,P,H){if(I=+I,E=E>>>0,!H){var D=Math.pow(2,8*P-1);_(this,I,E,P,D-1,-D)}var ut=0,vt=1,V=0;for(this[E]=I&255;++ut<P&&(vt*=256);)I<0&&V===0&&this[E+ut-1]!==0&&(V=1),this[E+ut]=(I/vt>>0)-V&255;return E+P},y.prototype.writeIntBE=function(I,E,P,H){if(I=+I,E=E>>>0,!H){var D=Math.pow(2,8*P-1);_(this,I,E,P,D-1,-D)}var ut=P-1,vt=1,V=0;for(this[E+ut]=I&255;--ut>=0&&(vt*=256);)I<0&&V===0&&this[E+ut+1]!==0&&(V=1),this[E+ut]=(I/vt>>0)-V&255;return E+P},y.prototype.writeInt8=function(I,E,P){return I=+I,E=E>>>0,P||_(this,I,E,1,127,-128),I<0&&(I=255+I+1),this[E]=I&255,E+1},y.prototype.writeInt16LE=function(I,E,P){return I=+I,E=E>>>0,P||_(this,I,E,2,32767,-32768),this[E]=I&255,this[E+1]=I>>>8,E+2},y.prototype.writeInt16BE=function(I,E,P){return I=+I,E=E>>>0,P||_(this,I,E,2,32767,-32768),this[E]=I>>>8,this[E+1]=I&255,E+2},y.prototype.writeInt32LE=function(I,E,P){return I=+I,E=E>>>0,P||_(this,I,E,4,2147483647,-2147483648),this[E]=I&255,this[E+1]=I>>>8,this[E+2]=I>>>16,this[E+3]=I>>>24,E+4},y.prototype.writeInt32BE=function(I,E,P){return I=+I,E=E>>>0,P||_(this,I,E,4,2147483647,-2147483648),I<0&&(I=4294967295+I+1),this[E]=I>>>24,this[E+1]=I>>>16,this[E+2]=I>>>8,this[E+3]=I&255,E+4};function R(U,I,E,P,H,D){if(E+P>U.length)throw new RangeError("Index out of range");if(E<0)throw new RangeError("Index out of range")}function C(U,I,E,P,H){return I=+I,E=E>>>0,H||R(U,I,E,4),h.write(U,I,E,P,23,4),E+4}y.prototype.writeFloatLE=function(I,E,P){return C(this,I,E,!0,P)},y.prototype.writeFloatBE=function(I,E,P){return C(this,I,E,!1,P)};function F(U,I,E,P,H){return I=+I,E=E>>>0,H||R(U,I,E,8),h.write(U,I,E,P,52,8),E+8}y.prototype.writeDoubleLE=function(I,E,P){return F(this,I,E,!0,P)},y.prototype.writeDoubleBE=function(I,E,P){return F(this,I,E,!1,P)},y.prototype.copy=function(I,E,P,H){if(!y.isBuffer(I))throw new TypeError("argument should be a Buffer");if(P||(P=0),!H&&H!==0&&(H=this.length),E>=I.length&&(E=I.length),E||(E=0),H>0&&H<P&&(H=P),H===P||I.length===0||this.length===0)return 0;if(E<0)throw new RangeError("targetStart out of bounds");if(P<0||P>=this.length)throw new RangeError("Index out of range");if(H<0)throw new RangeError("sourceEnd out of bounds");H>this.length&&(H=this.length),I.length-E<H-P&&(H=I.length-E+P);var D=H-P;return this===I&&typeof Uint8Array.prototype.copyWithin=="function"?this.copyWithin(E,P,H):Uint8Array.prototype.set.call(I,this.subarray(P,H),E),D},y.prototype.fill=function(I,E,P,H){if(typeof I=="string"){if(typeof E=="string"?(H=E,E=0,P=this.length):typeof P=="string"&&(H=P,P=this.length),H!==void 0&&typeof H!="string")throw new TypeError("encoding must be a string");if(typeof H=="string"&&!y.isEncoding(H))throw new TypeError("Unknown encoding: "+H);if(I.length===1){var D=I.charCodeAt(0);(H==="utf8"&&D<128||H==="latin1")&&(I=D)}}else typeof I=="number"?I=I&255:typeof I=="boolean"&&(I=Number(I));if(E<0||this.length<E||this.length<P)throw new RangeError("Out of range index");if(P<=E)return this;E=E>>>0,P=P===void 0?this.length:P>>>0,I||(I=0);var ut;if(typeof I=="number")for(ut=E;ut<P;++ut)this[ut]=I;else{var vt=y.isBuffer(I)?I:y.from(I,H),V=vt.length;if(V===0)throw new TypeError('The value "'+I+'" is invalid for argument "value"');for(ut=0;ut<P-E;++ut)this[ut+E]=vt[ut%V]}return this};var z=/[^+/0-9A-Za-z-_]/g;function lt(U){if(U=U.split("=")[0],U=U.trim().replace(z,""),U.length<2)return"";for(;U.length%4!==0;)U=U+"=";return U}function G(U,I){I=I||1/0;for(var E,P=U.length,H=null,D=[],ut=0;ut<P;++ut){if(E=U.charCodeAt(ut),E>55295&&E<57344){if(!H){if(E>56319){(I-=3)>-1&&D.push(239,191,189);continue}else if(ut+1===P){(I-=3)>-1&&D.push(239,191,189);continue}H=E;continue}if(E<56320){(I-=3)>-1&&D.push(239,191,189),H=E;continue}E=(H-55296<<10|E-56320)+65536}else H&&(I-=3)>-1&&D.push(239,191,189);if(H=null,E<128){if((I-=1)<0)break;D.push(E)}else if(E<2048){if((I-=2)<0)break;D.push(E>>6|192,E&63|128)}else if(E<65536){if((I-=3)<0)break;D.push(E>>12|224,E>>6&63|128,E&63|128)}else if(E<1114112){if((I-=4)<0)break;D.push(E>>18|240,E>>12&63|128,E>>6&63|128,E&63|128)}else throw new Error("Invalid code point")}return D}function Z(U){for(var I=[],E=0;E<U.length;++E)I.push(U.charCodeAt(E)&255);return I}function mt(U,I){for(var E,P,H,D=[],ut=0;ut<U.length&&!((I-=2)<0);++ut)E=U.charCodeAt(ut),P=E>>8,H=E%256,D.push(H),D.push(P);return D}function gt(U){return n.toByteArray(lt(U))}function j(U,I,E,P){for(var H=0;H<P&&!(H+E>=I.length||H>=U.length);++H)I[H+E]=U[H];return H}function Ct(U,I){return U instanceof I||U!=null&&U.constructor!=null&&U.constructor.name!=null&&U.constructor.name===I.name}function wt(U){return U!==U}var Y=function(){for(var U="0123456789abcdef",I=new Array(256),E=0;E<16;++E)for(var P=E*16,H=0;H<16;++H)I[P+H]=U[E]+U[H];return I}()})(Gu);var rs=Er,Ju=Wu,Y2=Gu.Buffer;function jo(a){this.genPoly=void 0,this.degree=a,this.degree&&this.initialize(this.degree)}jo.prototype.initialize=function(n){this.degree=n,this.genPoly=Ju.generateECPolynomial(this.degree)};jo.prototype.encode=function(n){if(!this.genPoly)throw new Error("Encoder not initialized");var h=rs.alloc(this.degree),u=Y2.concat([n,h],n.length+this.degree),v=Ju.mod(u,this.genPoly),o=this.degree-v.length;if(o>0){var w=rs.alloc(this.degree);return v.copy(w,o),w}return v};var X2=jo,ju={},kr={},Yo={};Yo.isValid=function(n){return!isNaN(n)&&n>=1&&n<=40};var or={},Yu="[0-9]+",Q2="[A-Z $%*+\\-./:]+",Ui="(?:[u3000-u303F]|[u3040-u309F]|[u30A0-u30FF]|[uFF00-uFFEF]|[u4E00-u9FAF]|[u2605-u2606]|[u2190-u2195]|u203B|[u2010u2015u2018u2019u2025u2026u201Cu201Du2225u2260]|[u0391-u0451]|[u00A7u00A8u00B1u00B4u00D7u00F7])+";Ui=Ui.replace(/u/g,"\\u");var tb="(?:(?![A-Z0-9 $%*+\\-./:]|"+Ui+`)(?:.|[\r
|
|
30
|
+
]))+`;or.KANJI=new RegExp(Ui,"g");or.BYTE_KANJI=new RegExp("[^A-Z0-9 $%*+\\-./:]+","g");or.BYTE=new RegExp(tb,"g");or.NUMERIC=new RegExp(Yu,"g");or.ALPHANUMERIC=new RegExp(Q2,"g");var eb=new RegExp("^"+Ui+"$"),rb=new RegExp("^"+Yu+"$"),ib=new RegExp("^[A-Z0-9 $%*+\\-./:]+$");or.testKanji=function(n){return eb.test(n)};or.testNumeric=function(n){return rb.test(n)};or.testAlphanumeric=function(n){return ib.test(n)};(function(a){var n=Yo,h=or;a.NUMERIC={id:"Numeric",bit:1,ccBits:[10,12,14]},a.ALPHANUMERIC={id:"Alphanumeric",bit:2,ccBits:[9,11,13]},a.BYTE={id:"Byte",bit:4,ccBits:[8,16,16]},a.KANJI={id:"Kanji",bit:8,ccBits:[8,10,12]},a.MIXED={bit:-1},a.getCharCountIndicator=function(o,w){if(!o.ccBits)throw new Error("Invalid mode: "+o);if(!n.isValid(w))throw new Error("Invalid version: "+w);return w>=1&&w<10?o.ccBits[0]:w<27?o.ccBits[1]:o.ccBits[2]},a.getBestModeForData=function(o){return h.testNumeric(o)?a.NUMERIC:h.testAlphanumeric(o)?a.ALPHANUMERIC:h.testKanji(o)?a.KANJI:a.BYTE},a.toString=function(o){if(o&&o.id)return o.id;throw new Error("Invalid mode")},a.isValid=function(o){return o&&o.bit&&o.ccBits};function u(v){if(typeof v!="string")throw new Error("Param is not a string");var o=v.toLowerCase();switch(o){case"numeric":return a.NUMERIC;case"alphanumeric":return a.ALPHANUMERIC;case"kanji":return a.KANJI;case"byte":return a.BYTE;default:throw new Error("Unknown mode: "+v)}}a.from=function(o,w){if(a.isValid(o))return o;try{return u(o)}catch{return w}}})(kr);(function(a){var n=We,h=Ma,u=ba,v=kr,o=Yo,w=Yf,y=7973,b=n.getBCHDigit(y);function B($,M,N){for(var x=1;x<=40;x++)if(M<=a.getCapacity(x,N,$))return x}function k($,M){return v.getCharCountIndicator($,M)+4}function L($,M){var N=0;return $.forEach(function(x){var A=k(x.mode,M);N+=A+x.getBitsLength()}),N}function q($,M){for(var N=1;N<=40;N++){var x=L($,N);if(x<=a.getCapacity(N,M,v.MIXED))return N}}a.from=function(M,N){return o.isValid(M)?parseInt(M,10):N},a.getCapacity=function(M,N,x){if(!o.isValid(M))throw new Error("Invalid QR Code version");typeof x>"u"&&(x=v.BYTE);var A=n.getSymbolTotalCodewords(M),S=h.getTotalCodewordsCount(M,N),T=(A-S)*8;if(x===v.MIXED)return T;var O=T-k(x,M);switch(x){case v.NUMERIC:return Math.floor(O/10*3);case v.ALPHANUMERIC:return Math.floor(O/11*2);case v.KANJI:return Math.floor(O/13);case v.BYTE:default:return Math.floor(O/8)}},a.getBestVersionForData=function(M,N){var x,A=u.from(N,u.M);if(w(M)){if(M.length>1)return q(M,A);if(M.length===0)return 1;x=M[0]}else x=M;return B(x.mode,x.getLength(),A)},a.getEncodedBits=function(M){if(!o.isValid(M)||M<7)throw new Error("Invalid QR Code version");for(var N=M<<12;n.getBCHDigit(N)-b>=0;)N^=y<<n.getBCHDigit(N)-b;return M<<12|N}})(ju);var Xu={},qf=We,Qu=1335,nb=21522,is=qf.getBCHDigit(Qu);Xu.getEncodedBits=function(n,h){for(var u=n.bit<<3|h,v=u<<10;qf.getBCHDigit(v)-is>=0;)v^=Qu<<qf.getBCHDigit(v)-is;return(u<<10|v)^nb};var tl={},ab=kr;function hi(a){this.mode=ab.NUMERIC,this.data=a.toString()}hi.getBitsLength=function(n){return 10*Math.floor(n/3)+(n%3?n%3*3+1:0)};hi.prototype.getLength=function(){return this.data.length};hi.prototype.getBitsLength=function(){return hi.getBitsLength(this.data.length)};hi.prototype.write=function(n){var h,u,v;for(h=0;h+3<=this.data.length;h+=3)u=this.data.substr(h,3),v=parseInt(u,10),n.put(v,10);var o=this.data.length-h;o>0&&(u=this.data.substr(h),v=parseInt(u,10),n.put(v,o*3+1))};var fb=hi,ob=kr,Ja=["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 ui(a){this.mode=ob.ALPHANUMERIC,this.data=a}ui.getBitsLength=function(n){return 11*Math.floor(n/2)+6*(n%2)};ui.prototype.getLength=function(){return this.data.length};ui.prototype.getBitsLength=function(){return ui.getBitsLength(this.data.length)};ui.prototype.write=function(n){var h;for(h=0;h+2<=this.data.length;h+=2){var u=Ja.indexOf(this.data[h])*45;u+=Ja.indexOf(this.data[h+1]),n.put(u,11)}this.data.length%2&&n.put(Ja.indexOf(this.data[h]),6)};var sb=ui,hb=Er,ub=kr;function li(a){this.mode=ub.BYTE,this.data=hb.from(a)}li.getBitsLength=function(n){return n*8};li.prototype.getLength=function(){return this.data.length};li.prototype.getBitsLength=function(){return li.getBitsLength(this.data.length)};li.prototype.write=function(a){for(var n=0,h=this.data.length;n<h;n++)a.put(this.data[n],8)};var lb=li,cb=kr,db=We;function ci(a){this.mode=cb.KANJI,this.data=a}ci.getBitsLength=function(n){return n*13};ci.prototype.getLength=function(){return this.data.length};ci.prototype.getBitsLength=function(){return ci.getBitsLength(this.data.length)};ci.prototype.write=function(a){var n;for(n=0;n<this.data.length;n++){var h=db.toSJIS(this.data[n]);if(h>=33088&&h<=40956)h-=33088;else if(h>=57408&&h<=60351)h-=49472;else throw new Error("Invalid SJIS character: "+this.data[n]+`
|
|
31
|
+
Make sure your charset is UTF-8`);h=(h>>>8&255)*192+(h&255),a.put(h,13)}};var vb=ci;(function(a){var n=kr,h=fb,u=sb,v=lb,o=vb,w=or,y=We,b=sc;function B(A){return unescape(encodeURIComponent(A)).length}function k(A,S,T){for(var O=[],W;(W=A.exec(T))!==null;)O.push({data:W[0],index:W.index,mode:S,length:W[0].length});return O}function L(A){var S=k(w.NUMERIC,n.NUMERIC,A),T=k(w.ALPHANUMERIC,n.ALPHANUMERIC,A),O,W;y.isKanjiModeEnabled()?(O=k(w.BYTE,n.BYTE,A),W=k(w.KANJI,n.KANJI,A)):(O=k(w.BYTE_KANJI,n.BYTE,A),W=[]);var K=S.concat(T,O,W);return K.sort(function(pt,ct){return pt.index-ct.index}).map(function(pt){return{data:pt.data,mode:pt.mode,length:pt.length}})}function q(A,S){switch(S){case n.NUMERIC:return h.getBitsLength(A);case n.ALPHANUMERIC:return u.getBitsLength(A);case n.KANJI:return o.getBitsLength(A);case n.BYTE:return v.getBitsLength(A)}}function $(A){return A.reduce(function(S,T){var O=S.length-1>=0?S[S.length-1]:null;return O&&O.mode===T.mode?(S[S.length-1].data+=T.data,S):(S.push(T),S)},[])}function M(A){for(var S=[],T=0;T<A.length;T++){var O=A[T];switch(O.mode){case n.NUMERIC:S.push([O,{data:O.data,mode:n.ALPHANUMERIC,length:O.length},{data:O.data,mode:n.BYTE,length:O.length}]);break;case n.ALPHANUMERIC:S.push([O,{data:O.data,mode:n.BYTE,length:O.length}]);break;case n.KANJI:S.push([O,{data:O.data,mode:n.BYTE,length:B(O.data)}]);break;case n.BYTE:S.push([{data:O.data,mode:n.BYTE,length:B(O.data)}])}}return S}function N(A,S){for(var T={},O={start:{}},W=["start"],K=0;K<A.length;K++){for(var pt=A[K],ct=[],dt=0;dt<pt.length;dt++){var g=pt[dt],e=""+K+dt;ct.push(e),T[e]={node:g,lastCount:0},O[e]={};for(var t=0;t<W.length;t++){var i=W[t];T[i]&&T[i].node.mode===g.mode?(O[i][e]=q(T[i].lastCount+g.length,g.mode)-q(T[i].lastCount,g.mode),T[i].lastCount+=g.length):(T[i]&&(T[i].lastCount=g.length),O[i][e]=q(g.length,g.mode)+4+n.getCharCountIndicator(g.mode,S))}}W=ct}for(t=0;t<W.length;t++)O[W[t]].end=0;return{map:O,table:T}}function x(A,S){var T,O=n.getBestModeForData(A);if(T=n.from(S,O),T!==n.BYTE&&T.bit<O.bit)throw new Error('"'+A+'" cannot be encoded with mode '+n.toString(T)+`.
|
|
32
|
+
Suggested mode is: `+n.toString(O));switch(T===n.KANJI&&!y.isKanjiModeEnabled()&&(T=n.BYTE),T){case n.NUMERIC:return new h(A);case n.ALPHANUMERIC:return new u(A);case n.KANJI:return new o(A);case n.BYTE:return new v(A)}}a.fromArray=function(S){return S.reduce(function(T,O){return typeof O=="string"?T.push(x(O,null)):O.data&&T.push(x(O.data,O.mode)),T},[])},a.fromString=function(S,T){for(var O=L(S,y.isKanjiModeEnabled()),W=M(O),K=N(W,T),pt=b.find_path(K.map,"start","end"),ct=[],dt=1;dt<pt.length-1;dt++)ct.push(K.table[pt[dt]].node);return a.fromArray($(ct))},a.rawSplit=function(S){return a.fromArray(L(S,y.isKanjiModeEnabled()))}})(tl);var ns=Er,_a=We,ja=ba,pb=G2,mb=J2,gb=Hu,yb=Ku,Uf=Zu,Ff=Ma,wb=X2,Ln=ju,bb=Xu,Mb=kr,Ya=tl,xb=Yf;function _b(a,n){for(var h=a.size,u=yb.getPositions(n),v=0;v<u.length;v++)for(var o=u[v][0],w=u[v][1],y=-1;y<=7;y++)if(!(o+y<=-1||h<=o+y))for(var b=-1;b<=7;b++)w+b<=-1||h<=w+b||(y>=0&&y<=6&&(b===0||b===6)||b>=0&&b<=6&&(y===0||y===6)||y>=2&&y<=4&&b>=2&&b<=4?a.set(o+y,w+b,!0,!0):a.set(o+y,w+b,!1,!0))}function Sb(a){for(var n=a.size,h=8;h<n-8;h++){var u=h%2===0;a.set(h,6,u,!0),a.set(6,h,u,!0)}}function Ab(a,n){for(var h=gb.getPositions(n),u=0;u<h.length;u++)for(var v=h[u][0],o=h[u][1],w=-2;w<=2;w++)for(var y=-2;y<=2;y++)w===-2||w===2||y===-2||y===2||w===0&&y===0?a.set(v+w,o+y,!0,!0):a.set(v+w,o+y,!1,!0)}function Eb(a,n){for(var h=a.size,u=Ln.getEncodedBits(n),v,o,w,y=0;y<18;y++)v=Math.floor(y/3),o=y%3+h-8-3,w=(u>>y&1)===1,a.set(v,o,w,!0),a.set(o,v,w,!0)}function Xa(a,n,h){var u=a.size,v=bb.getEncodedBits(n,h),o,w;for(o=0;o<15;o++)w=(v>>o&1)===1,o<6?a.set(o,8,w,!0):o<8?a.set(o+1,8,w,!0):a.set(u-15+o,8,w,!0),o<8?a.set(8,u-o-1,w,!0):o<9?a.set(8,15-o-1+1,w,!0):a.set(8,15-o-1,w,!0);a.set(u-8,8,1,!0)}function kb(a,n){for(var h=a.size,u=-1,v=h-1,o=7,w=0,y=h-1;y>0;y-=2)for(y===6&&y--;;){for(var b=0;b<2;b++)if(!a.isReserved(v,y-b)){var B=!1;w<n.length&&(B=(n[w]>>>o&1)===1),a.set(v,y-b,B),o--,o===-1&&(w++,o=7)}if(v+=u,v<0||h<=v){v-=u,u=-u;break}}}function Rb(a,n,h){var u=new pb;h.forEach(function(B){u.put(B.mode.bit,4),u.put(B.getLength(),Mb.getCharCountIndicator(B.mode,a)),B.write(u)});var v=_a.getSymbolTotalCodewords(a),o=Ff.getTotalCodewordsCount(a,n),w=(v-o)*8;for(u.getLengthInBits()+4<=w&&u.put(0,4);u.getLengthInBits()%8!==0;)u.putBit(0);for(var y=(w-u.getLengthInBits())/8,b=0;b<y;b++)u.put(b%2?17:236,8);return Bb(u,a,n)}function Bb(a,n,h){for(var u=_a.getSymbolTotalCodewords(n),v=Ff.getTotalCodewordsCount(n,h),o=u-v,w=Ff.getBlocksCount(n,h),y=u%w,b=w-y,B=Math.floor(u/w),k=Math.floor(o/w),L=k+1,q=B-k,$=new wb(q),M=0,N=new Array(w),x=new Array(w),A=0,S=ns.from(a.buffer),T=0;T<w;T++){var O=T<b?k:L;N[T]=S.slice(M,M+O),x[T]=$.encode(N[T]),M+=O,A=Math.max(A,O)}var W=ns.alloc(u),K=0,pt,ct;for(pt=0;pt<A;pt++)for(ct=0;ct<w;ct++)pt<N[ct].length&&(W[K++]=N[ct][pt]);for(pt=0;pt<q;pt++)for(ct=0;ct<w;ct++)W[K++]=x[ct][pt];return W}function Ib(a,n,h,u){var v;if(xb(a))v=Ya.fromArray(a);else if(typeof a=="string"){var o=n;if(!o){var w=Ya.rawSplit(a);o=Ln.getBestVersionForData(w,h)}v=Ya.fromString(a,o||40)}else throw new Error("Invalid data");var y=Ln.getBestVersionForData(v,h);if(!y)throw new Error("The amount of data is too big to be stored in a QR Code");if(!n)n=y;else if(n<y)throw new Error(`
|
|
33
|
+
The chosen QR Code version cannot contain this amount of data.
|
|
34
|
+
Minimum version required to store current data is: `+y+`.
|
|
35
|
+
`);var b=Rb(n,h,v),B=_a.getSymbolSize(n),k=new mb(B);return _b(k,n),Sb(k),Ab(k,n),Xa(k,h,0),n>=7&&Eb(k,n),kb(k,b),isNaN(u)&&(u=Uf.getBestMask(k,Xa.bind(null,k,h))),Uf.applyMask(u,k),Xa(k,h,u),{modules:k,version:n,errorCorrectionLevel:h,maskPattern:u,segments:v}}Uu.create=function(n,h){if(typeof n>"u"||n==="")throw new Error("No input text");var u=ja.M,v,o;return typeof h<"u"&&(u=ja.from(h.errorCorrectionLevel,ja.M),v=Ln.from(h.version),o=Uf.from(h.maskPattern),h.toSJISFunc&&_a.setToSJISFunction(h.toSJISFunc)),Ib(n,v,u,o)};var el={},Xo={};(function(a){function n(h){if(typeof h=="number"&&(h=h.toString()),typeof h!="string")throw new Error("Color should be defined as hex string");var u=h.slice().replace("#","").split("");if(u.length<3||u.length===5||u.length>8)throw new Error("Invalid hex color: "+h);(u.length===3||u.length===4)&&(u=Array.prototype.concat.apply([],u.map(function(o){return[o,o]}))),u.length===6&&u.push("F","F");var v=parseInt(u.join(""),16);return{r:v>>24&255,g:v>>16&255,b:v>>8&255,a:v&255,hex:"#"+u.slice(0,6).join("")}}a.getOptions=function(u){u||(u={}),u.color||(u.color={});var v=typeof u.margin>"u"||u.margin===null||u.margin<0?4:u.margin,o=u.width&&u.width>=21?u.width:void 0,w=u.scale||4;return{width:o,scale:o?4:w,margin:v,color:{dark:n(u.color.dark||"#000000ff"),light:n(u.color.light||"#ffffffff")},type:u.type,rendererOpts:u.rendererOpts||{}}},a.getScale=function(u,v){return v.width&&v.width>=u+v.margin*2?v.width/(u+v.margin*2):v.scale},a.getImageWidth=function(u,v){var o=a.getScale(u,v);return Math.floor((u+v.margin*2)*o)},a.qrToImageData=function(u,v,o){for(var w=v.modules.size,y=v.modules.data,b=a.getScale(w,o),B=Math.floor((w+o.margin*2)*b),k=o.margin*b,L=[o.color.light,o.color.dark],q=0;q<B;q++)for(var $=0;$<B;$++){var M=(q*B+$)*4,N=o.color.light;if(q>=k&&$>=k&&q<B-k&&$<B-k){var x=Math.floor((q-k)/b),A=Math.floor(($-k)/b);N=L[y[x*w+A]?1:0]}u[M++]=N.r,u[M++]=N.g,u[M++]=N.b,u[M]=N.a}}})(Xo);(function(a){var n=Xo;function h(v,o,w){v.clearRect(0,0,o.width,o.height),o.style||(o.style={}),o.height=w,o.width=w,o.style.height=w+"px",o.style.width=w+"px"}function u(){try{return document.createElement("canvas")}catch{throw new Error("You need to specify a canvas element")}}a.render=function(o,w,y){var b=y,B=w;typeof b>"u"&&(!w||!w.getContext)&&(b=w,w=void 0),w||(B=u()),b=n.getOptions(b);var k=n.getImageWidth(o.modules.size,b),L=B.getContext("2d"),q=L.createImageData(k,k);return n.qrToImageData(q.data,o,b),h(L,B,k),L.putImageData(q,0,0),B},a.renderToDataURL=function(o,w,y){var b=y;typeof b>"u"&&(!w||!w.getContext)&&(b=w,w=void 0),b||(b={});var B=a.render(o,w,b),k=b.type||"image/png",L=b.rendererOpts||{};return B.toDataURL(k,L.quality)}})(el);var rl={},Tb=Xo;function as(a,n){var h=a.a/255,u=n+'="'+a.hex+'"';return h<1?u+" "+n+'-opacity="'+h.toFixed(2).slice(1)+'"':u}function Qa(a,n,h){var u=a+n;return typeof h<"u"&&(u+=" "+h),u}function Cb(a,n,h){for(var u="",v=0,o=!1,w=0,y=0;y<a.length;y++){var b=Math.floor(y%n),B=Math.floor(y/n);!b&&!o&&(o=!0),a[y]?(w++,y>0&&b>0&&a[y-1]||(u+=o?Qa("M",b+h,.5+B+h):Qa("m",v,0),v=0,o=!1),b+1<n&&a[y+1]||(u+=Qa("h",w),w=0)):v++}return u}rl.render=function(n,h,u){var v=Tb.getOptions(h),o=n.modules.size,w=n.modules.data,y=o+v.margin*2,b=v.color.light.a?"<path "+as(v.color.light,"fill")+' d="M0 0h'+y+"v"+y+'H0z"/>':"",B="<path "+as(v.color.dark,"stroke")+' d="'+Cb(w,o,v.margin)+'"/>',k='viewBox="0 0 '+y+" "+y+'"',L=v.width?'width="'+v.width+'" height="'+v.width+'" ':"",q='<svg xmlns="http://www.w3.org/2000/svg" '+L+k+' shape-rendering="crispEdges">'+b+B+`</svg>
|
|
36
|
+
`;return typeof u=="function"&&u(null,q),q};var Lb=q2,$f=Uu,il=el,Pb=rl;function Qo(a,n,h,u,v){var o=[].slice.call(arguments,1),w=o.length,y=typeof o[w-1]=="function";if(!y&&!Lb())throw new Error("Callback required as last argument");if(y){if(w<2)throw new Error("Too few arguments provided");w===2?(v=h,h=n,n=u=void 0):w===3&&(n.getContext&&typeof v>"u"?(v=u,u=void 0):(v=u,u=h,h=n,n=void 0))}else{if(w<1)throw new Error("Too few arguments provided");return w===1?(h=n,n=u=void 0):w===2&&!n.getContext&&(u=h,h=n,n=void 0),new Promise(function(B,k){try{var L=$f.create(h,u);B(a(L,n,u))}catch(q){k(q)}})}try{var b=$f.create(h,u);v(null,a(b,n,u))}catch(B){v(B)}}nn.create=$f.create;nn.toCanvas=Qo.bind(null,il.render);nn.toDataURL=Qo.bind(null,il.renderToDataURL);nn.toString=Qo.bind(null,function(a,n,h){return Pb.render(a,h)});var Ob=function(){var a=document.getSelection();if(!a.rangeCount)return function(){};for(var n=document.activeElement,h=[],u=0;u<a.rangeCount;u++)h.push(a.getRangeAt(u));switch(n.tagName.toUpperCase()){case"INPUT":case"TEXTAREA":n.blur();break;default:n=null;break}return a.removeAllRanges(),function(){a.type==="Caret"&&a.removeAllRanges(),a.rangeCount||h.forEach(function(v){a.addRange(v)}),n&&n.focus()}},Nb=Ob,fs={"text/plain":"Text","text/html":"Url",default:"Text"},qb="Copy to clipboard: #{key}, Enter";function Ub(a){var n=(/mac os x/i.test(navigator.userAgent)?"⌘":"Ctrl")+"+C";return a.replace(/#{\s*key\s*}/g,n)}function Fb(a,n){var h,u,v,o,w,y,b=!1;n||(n={}),h=n.debug||!1;try{v=Nb(),o=document.createRange(),w=document.getSelection(),y=document.createElement("span"),y.textContent=a,y.ariaHidden="true",y.style.all="unset",y.style.position="fixed",y.style.top=0,y.style.clip="rect(0, 0, 0, 0)",y.style.whiteSpace="pre",y.style.webkitUserSelect="text",y.style.MozUserSelect="text",y.style.msUserSelect="text",y.style.userSelect="text",y.addEventListener("copy",function(k){if(k.stopPropagation(),n.format)if(k.preventDefault(),typeof k.clipboardData>"u"){h&&console.warn("unable to use e.clipboardData"),h&&console.warn("trying IE specific stuff"),window.clipboardData.clearData();var L=fs[n.format]||fs.default;window.clipboardData.setData(L,a)}else k.clipboardData.clearData(),k.clipboardData.setData(n.format,a);n.onCopy&&(k.preventDefault(),n.onCopy(k.clipboardData))}),document.body.appendChild(y),o.selectNodeContents(y),w.addRange(o);var B=document.execCommand("copy");if(!B)throw new Error("copy command was unsuccessful");b=!0}catch(k){h&&console.error("unable to copy using execCommand: ",k),h&&console.warn("trying IE specific stuff");try{window.clipboardData.setData(n.format||"text",a),n.onCopy&&n.onCopy(window.clipboardData),b=!0}catch(L){h&&console.error("unable to copy using clipboardData: ",L),h&&console.error("falling back to prompt"),u=Ub("message"in n?n.message:qb),window.prompt(u,a)}}finally{w&&(typeof w.removeRange=="function"?w.removeRange(o):w.removeAllRanges()),y&&document.body.removeChild(y),v()}return b}var $b=Fb,Wt,Oi,t0,nl,os,e0,al,ur={},Sa=[],zb=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord/i;function hr(a,n){for(var h in n)a[h]=n[h];return a}function fl(a){var n=a.parentNode;n&&n.removeChild(a)}function vr(a,n,h){var u,v=arguments,o={};for(u in n)u!=="key"&&u!=="ref"&&(o[u]=n[u]);if(arguments.length>3)for(h=[h],u=3;u<arguments.length;u++)h.push(v[u]);if(h!=null&&(o.children=h),typeof a=="function"&&a.defaultProps!=null)for(u in a.defaultProps)o[u]===void 0&&(o[u]=a.defaultProps[u]);return Pn(a,o,n&&n.key,n&&n.ref,null)}function Pn(a,n,h,u,v){var o={type:a,props:n,key:h,ref:u,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,constructor:void 0,__v:v};return v==null&&(o.__v=o),Wt.vnode&&Wt.vnode(o),o}function ol(){return{}}function fn(a){return a.children}function tr(a,n){this.props=a,this.context=n}function Fi(a,n){if(n==null)return a.__?Fi(a.__,a.__.__k.indexOf(a)+1):null;for(var h;n<a.__k.length;n++)if((h=a.__k[n])!=null&&h.__e!=null)return h.__e;return typeof a.type=="function"?Fi(a):null}function sl(a){var n,h;if((a=a.__)!=null&&a.__c!=null){for(a.__e=a.__c.base=null,n=0;n<a.__k.length;n++)if((h=a.__k[n])!=null&&h.__e!=null){a.__e=a.__c.base=h.__e;break}return sl(a)}}function Mn(a){(!a.__d&&(a.__d=!0)&&Oi.push(a)&&!t0++||os!==Wt.debounceRendering)&&((os=Wt.debounceRendering)||nl)(Db)}function Db(){for(var a;t0=Oi.length;)a=Oi.sort(function(n,h){return n.__v.__b-h.__v.__b}),Oi=[],a.some(function(n){var h,u,v,o,w,y,b;n.__d&&(y=(w=(h=n).__v).__e,(b=h.__P)&&(u=[],(v=hr({},w)).__v=v,o=r0(b,w,v,h.__n,b.ownerSVGElement!==void 0,null,u,y??Fi(w)),ul(u,w),o!=y&&sl(w)))})}function hl(a,n,h,u,v,o,w,y,b){var B,k,L,q,$,M,N,x=h&&h.__k||Sa,A=x.length;if(y==ur&&(y=o!=null?o[0]:A?Fi(h,0):null),B=0,n.__k=br(n.__k,function(S){if(S!=null){if(S.__=n,S.__b=n.__b+1,(L=x[B])===null||L&&S.key==L.key&&S.type===L.type)x[B]=void 0;else for(k=0;k<A;k++){if((L=x[k])&&S.key==L.key&&S.type===L.type){x[k]=void 0;break}L=null}if(q=r0(a,S,L=L||ur,u,v,o,w,y,b),(k=S.ref)&&L.ref!=k&&(N||(N=[]),L.ref&&N.push(L.ref,null,S),N.push(k,S.__c||q,S)),q!=null){var T;if(M==null&&(M=q),S.__d!==void 0)T=S.__d,S.__d=void 0;else if(o==L||q!=y||q.parentNode==null){t:if(y==null||y.parentNode!==a)a.appendChild(q),T=null;else{for($=y,k=0;($=$.nextSibling)&&k<A;k+=2)if($==q)break t;a.insertBefore(q,y),T=y}n.type=="option"&&(a.value="")}y=T!==void 0?T:q.nextSibling,typeof n.type=="function"&&(n.__d=y)}else y&&L.__e==y&&y.parentNode!=a&&(y=Fi(L))}return B++,S}),n.__e=M,o!=null&&typeof n.type!="function")for(B=o.length;B--;)o[B]!=null&&fl(o[B]);for(B=A;B--;)x[B]!=null&&Ni(x[B],x[B]);if(N)for(B=0;B<N.length;B++)ll(N[B],N[++B],N[++B])}function br(a,n,h){if(h==null&&(h=[]),a==null||typeof a=="boolean")n&&h.push(n(null));else if(Array.isArray(a))for(var u=0;u<a.length;u++)br(a[u],n,h);else h.push(n?n(typeof a=="string"||typeof a=="number"?Pn(null,a,null,null,a):a.__e!=null||a.__c!=null?Pn(a.type,a.props,a.key,null,a.__v):a):a);return h}function Hb(a,n,h,u,v){var o;for(o in h)o==="children"||o==="key"||o in n||On(a,o,null,h[o],u);for(o in n)v&&typeof n[o]!="function"||o==="children"||o==="key"||o==="value"||o==="checked"||h[o]===n[o]||On(a,o,n[o],h[o],u)}function ss(a,n,h){n[0]==="-"?a.setProperty(n,h):a[n]=typeof h=="number"&&zb.test(n)===!1?h+"px":h??""}function On(a,n,h,u,v){var o,w,y,b,B;if(v?n==="className"&&(n="class"):n==="class"&&(n="className"),n==="style")if(o=a.style,typeof h=="string")o.cssText=h;else{if(typeof u=="string"&&(o.cssText="",u=null),u)for(b in u)h&&b in h||ss(o,b,"");if(h)for(B in h)u&&h[B]===u[B]||ss(o,B,h[B])}else n[0]==="o"&&n[1]==="n"?(w=n!==(n=n.replace(/Capture$/,"")),y=n.toLowerCase(),n=(y in a?y:n).slice(2),h?(u||a.addEventListener(n,hs,w),(a.l||(a.l={}))[n]=h):a.removeEventListener(n,hs,w)):n!=="list"&&n!=="tagName"&&n!=="form"&&n!=="type"&&n!=="size"&&!v&&n in a?a[n]=h??"":typeof h!="function"&&n!=="dangerouslySetInnerHTML"&&(n!==(n=n.replace(/^xlink:?/,""))?h==null||h===!1?a.removeAttributeNS("http://www.w3.org/1999/xlink",n.toLowerCase()):a.setAttributeNS("http://www.w3.org/1999/xlink",n.toLowerCase(),h):h==null||h===!1&&!/^ar/.test(n)?a.removeAttribute(n):a.setAttribute(n,h))}function hs(a){this.l[a.type](Wt.event?Wt.event(a):a)}function r0(a,n,h,u,v,o,w,y,b){var B,k,L,q,$,M,N,x,A,S,T=n.type;if(n.constructor!==void 0)return null;(B=Wt.__b)&&B(n);try{t:if(typeof T=="function"){if(x=n.props,A=(B=T.contextType)&&u[B.__c],S=B?A?A.props.value:B.__:u,h.__c?N=(k=n.__c=h.__c).__=k.__E:("prototype"in T&&T.prototype.render?n.__c=k=new T(x,S):(n.__c=k=new tr(x,S),k.constructor=T,k.render=Zb),A&&A.sub(k),k.props=x,k.state||(k.state={}),k.context=S,k.__n=u,L=k.__d=!0,k.__h=[]),k.__s==null&&(k.__s=k.state),T.getDerivedStateFromProps!=null&&(k.__s==k.state&&(k.__s=hr({},k.__s)),hr(k.__s,T.getDerivedStateFromProps(x,k.__s))),q=k.props,$=k.state,L)T.getDerivedStateFromProps==null&&k.componentWillMount!=null&&k.componentWillMount(),k.componentDidMount!=null&&k.__h.push(k.componentDidMount);else{if(T.getDerivedStateFromProps==null&&x!==q&&k.componentWillReceiveProps!=null&&k.componentWillReceiveProps(x,S),!k.__e&&k.shouldComponentUpdate!=null&&k.shouldComponentUpdate(x,k.__s,S)===!1||n.__v===h.__v&&!k.__){for(k.props=x,k.state=k.__s,n.__v!==h.__v&&(k.__d=!1),k.__v=n,n.__e=h.__e,n.__k=h.__k,k.__h.length&&w.push(k),B=0;B<n.__k.length;B++)n.__k[B]&&(n.__k[B].__=n);break t}k.componentWillUpdate!=null&&k.componentWillUpdate(x,k.__s,S),k.componentDidUpdate!=null&&k.__h.push(function(){k.componentDidUpdate(q,$,M)})}k.context=S,k.props=x,k.state=k.__s,(B=Wt.__r)&&B(n),k.__d=!1,k.__v=n,k.__P=a,B=k.render(k.props,k.state,k.context),n.__k=B!=null&&B.type==fn&&B.key==null?B.props.children:Array.isArray(B)?B:[B],k.getChildContext!=null&&(u=hr(hr({},u),k.getChildContext())),L||k.getSnapshotBeforeUpdate==null||(M=k.getSnapshotBeforeUpdate(q,$)),hl(a,n,h,u,v,o,w,y,b),k.base=n.__e,k.__h.length&&w.push(k),N&&(k.__E=k.__=null),k.__e=!1}else o==null&&n.__v===h.__v?(n.__k=h.__k,n.__e=h.__e):n.__e=Kb(h.__e,n,h,u,v,o,w,b);(B=Wt.diffed)&&B(n)}catch(O){n.__v=null,Wt.__e(O,n,h)}return n.__e}function ul(a,n){Wt.__c&&Wt.__c(n,a),a.some(function(h){try{a=h.__h,h.__h=[],a.some(function(u){u.call(h)})}catch(u){Wt.__e(u,h.__v)}})}function Kb(a,n,h,u,v,o,w,y){var b,B,k,L,q,$=h.props,M=n.props;if(v=n.type==="svg"||v,o!=null){for(b=0;b<o.length;b++)if((B=o[b])!=null&&((n.type===null?B.nodeType===3:B.localName===n.type)||a==B)){a=B,o[b]=null;break}}if(a==null){if(n.type===null)return document.createTextNode(M);a=v?document.createElementNS("http://www.w3.org/2000/svg",n.type):document.createElement(n.type,M.is&&{is:M.is}),o=null,y=!1}if(n.type===null)$!==M&&a.data!=M&&(a.data=M);else{if(o!=null&&(o=Sa.slice.call(a.childNodes)),k=($=h.props||ur).dangerouslySetInnerHTML,L=M.dangerouslySetInnerHTML,!y){if($===ur)for($={},q=0;q<a.attributes.length;q++)$[a.attributes[q].name]=a.attributes[q].value;(L||k)&&(L&&k&&L.__html==k.__html||(a.innerHTML=L&&L.__html||""))}Hb(a,M,$,v,y),L?n.__k=[]:(n.__k=n.props.children,hl(a,n,h,u,n.type!=="foreignObject"&&v,o,w,ur,y)),y||("value"in M&&(b=M.value)!==void 0&&b!==a.value&&On(a,"value",b,$.value,!1),"checked"in M&&(b=M.checked)!==void 0&&b!==a.checked&&On(a,"checked",b,$.checked,!1))}return a}function ll(a,n,h){try{typeof a=="function"?a(n):a.current=n}catch(u){Wt.__e(u,h)}}function Ni(a,n,h){var u,v,o;if(Wt.unmount&&Wt.unmount(a),(u=a.ref)&&(u.current&&u.current!==a.__e||ll(u,null,n)),h||typeof a.type=="function"||(h=(v=a.__e)!=null),a.__e=a.__d=void 0,(u=a.__c)!=null){if(u.componentWillUnmount)try{u.componentWillUnmount()}catch(w){Wt.__e(w,n)}u.base=u.__P=null}if(u=a.__k)for(o=0;o<u.length;o++)u[o]&&Ni(u[o],n,h);v!=null&&fl(v)}function Zb(a,n,h){return this.constructor(a,h)}function $i(a,n,h){var u,v,o;Wt.__&&Wt.__(a,n),v=(u=h===e0)?null:h&&h.__k||n.__k,a=vr(fn,null,[a]),o=[],r0(n,(u?n:h||n).__k=a,v||ur,ur,n.ownerSVGElement!==void 0,h&&!u?[h]:v?null:Sa.slice.call(n.childNodes),o,h||ur,u),ul(o,a)}function cl(a,n){$i(a,n,e0)}function Wb(a,n){var h,u;for(u in n=hr(hr({},a.props),n),arguments.length>2&&(n.children=Sa.slice.call(arguments,2)),h={},n)u!=="key"&&u!=="ref"&&(h[u]=n[u]);return Pn(a.type,h,n.key||a.key,n.ref||a.ref,null)}function dl(a){var n={},h={__c:"__cC"+al++,__:a,Consumer:function(u,v){return u.children(v)},Provider:function(u){var v,o=this;return this.getChildContext||(v=[],this.getChildContext=function(){return n[h.__c]=o,n},this.shouldComponentUpdate=function(w){o.props.value!==w.value&&v.some(function(y){y.context=w.value,Mn(y)})},this.sub=function(w){v.push(w);var y=w.componentWillUnmount;w.componentWillUnmount=function(){v.splice(v.indexOf(w),1),y&&y.call(w)}}),u.children}};return h.Consumer.contextType=h,h.Provider.__=h,h}Wt={__e:function(a,n){for(var h,u;n=n.__;)if((h=n.__c)&&!h.__)try{if(h.constructor&&h.constructor.getDerivedStateFromError!=null&&(u=!0,h.setState(h.constructor.getDerivedStateFromError(a))),h.componentDidCatch!=null&&(u=!0,h.componentDidCatch(a)),u)return Mn(h.__E=h)}catch(v){a=v}throw a}},tr.prototype.setState=function(a,n){var h;h=this.__s!==this.state?this.__s:this.__s=hr({},this.state),typeof a=="function"&&(a=a(h,this.props)),a&&hr(h,a),a!=null&&this.__v&&(n&&this.__h.push(n),Mn(this))},tr.prototype.forceUpdate=function(a){this.__v&&(this.__e=!0,a&&this.__h.push(a),Mn(this))},tr.prototype.render=fn,Oi=[],t0=0,nl=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,e0=ur,al=0;var Wr,De,us,di=0,zf=[],ls=Wt.__r,cs=Wt.diffed,ds=Wt.__c,vs=Wt.unmount;function Ai(a,n){Wt.__h&&Wt.__h(De,a,di||n),di=0;var h=De.__H||(De.__H={__:[],__h:[]});return a>=h.__.length&&h.__.push({}),h.__[a]}function i0(a){return di=1,n0(bl,a)}function n0(a,n,h){var u=Ai(Wr++,2);return u.__c||(u.__c=De,u.__=[h?h(n):bl(void 0,n),function(v){var o=a(u.__[0],v);u.__[0]!==o&&(u.__[0]=o,u.__c.setState({}))}]),u.__}function vl(a,n){var h=Ai(Wr++,3);!Wt.__s&&f0(h.__H,n)&&(h.__=a,h.__H=n,De.__H.__h.push(h))}function a0(a,n){var h=Ai(Wr++,4);!Wt.__s&&f0(h.__H,n)&&(h.__=a,h.__H=n,De.__h.push(h))}function pl(a){return di=5,Aa(function(){return{current:a}},[])}function ml(a,n,h){di=6,a0(function(){typeof a=="function"?a(n()):a&&(a.current=n())},h==null?h:h.concat(a))}function Aa(a,n){var h=Ai(Wr++,7);return f0(h.__H,n)?(h.__H=n,h.__h=a,h.__=a()):h.__}function gl(a,n){return di=8,Aa(function(){return a},n)}function yl(a){var n=De.context[a.__c],h=Ai(Wr++,9);return h.__c=a,n?(h.__==null&&(h.__=!0,n.sub(De)),n.props.value):a.__}function wl(a,n){Wt.useDebugValue&&Wt.useDebugValue(n?n(a):a)}function Vb(a){var n=Ai(Wr++,10),h=i0();return n.__=a,De.componentDidCatch||(De.componentDidCatch=function(u){n.__&&n.__(u),h[1](u)}),[h[0],function(){h[1](void 0)}]}function Gb(){zf.some(function(a){if(a.__P)try{a.__H.__h.forEach(Df),a.__H.__h.forEach(Hf),a.__H.__h=[]}catch(n){return a.__H.__h=[],Wt.__e(n,a.__v),!0}}),zf=[]}function Df(a){a.t&&a.t()}function Hf(a){var n=a.__();typeof n=="function"&&(a.t=n)}function f0(a,n){return!a||n.some(function(h,u){return h!==a[u]})}function bl(a,n){return typeof n=="function"?n(a):n}Wt.__r=function(a){ls&&ls(a),Wr=0,(De=a.__c).__H&&(De.__H.__h.forEach(Df),De.__H.__h.forEach(Hf),De.__H.__h=[])},Wt.diffed=function(a){cs&&cs(a);var n=a.__c;if(n){var h=n.__H;h&&h.__h.length&&(zf.push(n)!==1&&us===Wt.requestAnimationFrame||((us=Wt.requestAnimationFrame)||function(u){var v,o=function(){clearTimeout(w),cancelAnimationFrame(v),setTimeout(u)},w=setTimeout(o,100);typeof window<"u"&&(v=requestAnimationFrame(o))})(Gb))}},Wt.__c=function(a,n){n.some(function(h){try{h.__h.forEach(Df),h.__h=h.__h.filter(function(u){return!u.__||Hf(u)})}catch(u){n.some(function(v){v.__h&&(v.__h=[])}),n=[],Wt.__e(u,h.__v)}}),ds&&ds(a,n)},Wt.unmount=function(a){vs&&vs(a);var n=a.__c;if(n){var h=n.__H;if(h)try{h.__.forEach(function(u){return u.t&&u.t()})}catch(u){Wt.__e(u,n.__v)}}};function o0(a,n){for(var h in n)a[h]=n[h];return a}function Kf(a,n){for(var h in a)if(h!=="__source"&&!(h in n))return!0;for(var u in n)if(u!=="__source"&&a[u]!==n[u])return!0;return!1}var Ml=function(a){var n,h;function u(v){var o;return(o=a.call(this,v)||this).isPureReactComponent=!0,o}return h=a,(n=u).prototype=Object.create(h.prototype),n.prototype.constructor=n,n.__proto__=h,u.prototype.shouldComponentUpdate=function(v,o){return Kf(this.props,v)||Kf(this.state,o)},u}(tr);function xl(a,n){function h(v){var o=this.props.ref,w=o==v.ref;return!w&&o&&(o.call?o(null):o.current=null),n?!n(this.props,v)||!w:Kf(this.props,v)}function u(v){return this.shouldComponentUpdate=h,vr(a,o0({},v))}return u.prototype.isReactComponent=!0,u.displayName="Memo("+(a.displayName||a.name)+")",u.t=!0,u}var ps=Wt.__b;function _l(a){function n(h){var u=o0({},h);return delete u.ref,a(u,h.ref)}return n.prototype.isReactComponent=n.t=!0,n.displayName="ForwardRef("+(a.displayName||a.name)+")",n}Wt.__b=function(a){a.type&&a.type.t&&a.ref&&(a.props.ref=a.ref,a.ref=null),ps&&ps(a)};var ms=function(a,n){return a?br(a).reduce(function(h,u,v){return h.concat(n(u,v))},[]):null},Sl={map:ms,forEach:ms,count:function(a){return a?br(a).length:0},only:function(a){if((a=br(a)).length!==1)throw new Error("Children.only() expects only one child.");return a[0]},toArray:br},Jb=Wt.__e;function Al(a){return a&&((a=o0({},a)).__c=null,a.__k=a.__k&&a.__k.map(Al)),a}function Nn(){this.__u=0,this.o=null,this.__b=null}function El(a){var n=a.__.__c;return n&&n.u&&n.u(a)}function kl(a){var n,h,u;function v(o){if(n||(n=a()).then(function(w){h=w.default||w},function(w){u=w}),u)throw u;if(!h)throw n;return vr(h,o)}return v.displayName="Lazy",v.t=!0,v}function Qr(){this.i=null,this.l=null}Wt.__e=function(a,n,h){if(a.then){for(var u,v=n;v=v.__;)if((u=v.__c)&&u.__c)return u.__c(a,n.__c)}Jb(a,n,h)},(Nn.prototype=new tr).__c=function(a,n){var h=this;h.o==null&&(h.o=[]),h.o.push(n);var u=El(h.__v),v=!1,o=function(){v||(v=!0,u?u(w):w())};n.__c=n.componentWillUnmount,n.componentWillUnmount=function(){o(),n.__c&&n.__c()};var w=function(){var y;if(!--h.__u)for(h.__v.__k[0]=h.state.u,h.setState({u:h.__b=null});y=h.o.pop();)y.forceUpdate()};h.__u++||h.setState({u:h.__b=h.__v.__k[0]}),a.then(o,o)},Nn.prototype.render=function(a,n){return this.__b&&(this.__v.__k[0]=Al(this.__b),this.__b=null),[vr(tr,null,n.u?null:a.children),n.u&&a.fallback]};var gs=function(a,n,h){if(++h[1]===h[0]&&a.l.delete(n),a.props.revealOrder&&(a.props.revealOrder[0]!=="t"||!a.l.size))for(h=a.i;h;){for(;h.length>3;)h.pop()();if(h[1]<h[0])break;a.i=h=h[2]}};(Qr.prototype=new tr).u=function(a){var n=this,h=El(n.__v),u=n.l.get(a);return u[0]++,function(v){var o=function(){n.props.revealOrder?(u.push(v),gs(n,a,u)):v()};h?h(o):o()}},Qr.prototype.render=function(a){this.i=null,this.l=new Map;var n=br(a.children);a.revealOrder&&a.revealOrder[0]==="b"&&n.reverse();for(var h=n.length;h--;)this.l.set(n[h],this.i=[1,0,this.i]);return a.children},Qr.prototype.componentDidUpdate=Qr.prototype.componentDidMount=function(){var a=this;a.l.forEach(function(n,h){gs(a,h,n)})};var jb=function(){function a(){}var n=a.prototype;return n.getChildContext=function(){return this.props.context},n.render=function(h){return h.children},a}();function Yb(a){var n=this,h=a.container,u=vr(jb,{context:n.context},a.vnode);return n.s&&n.s!==h&&(n.v.parentNode&&n.s.removeChild(n.v),Ni(n.h),n.p=!1),a.vnode?n.p?(h.__k=n.__k,$i(u,h),n.__k=h.__k):(n.v=document.createTextNode(""),cl("",h),h.appendChild(n.v),n.p=!0,n.s=h,$i(u,h,n.v),n.__k=n.v.__k):n.p&&(n.v.parentNode&&n.s.removeChild(n.v),Ni(n.h)),n.h=u,n.componentWillUnmount=function(){n.v.parentNode&&n.s.removeChild(n.v),Ni(n.h)},null}function Rl(a,n){return vr(Yb,{vnode:a,container:n})}var ys=/^(?:accent|alignment|arabic|baseline|cap|clip(?!PathU)|color|fill|flood|font|glyph(?!R)|horiz|marker(?!H|W|U)|overline|paint|stop|strikethrough|stroke|text(?!L)|underline|unicode|units|v|vector|vert|word|writing|x(?!C))[A-Z]/;tr.prototype.isReactComponent={};var Bl=typeof Symbol<"u"&&Symbol.for&&Symbol.for("react.element")||60103;function Zf(a,n,h){if(n.__k==null)for(;n.firstChild;)n.removeChild(n.firstChild);return $i(a,n),typeof h=="function"&&h(),a?a.__c:null}function Xb(a,n,h){return cl(a,n),typeof h=="function"&&h(),a?a.__c:null}var ws=Wt.event;function tf(a,n){a["UNSAFE_"+n]&&!a[n]&&Object.defineProperty(a,n,{configurable:!1,get:function(){return this["UNSAFE_"+n]},set:function(h){this["UNSAFE_"+n]=h}})}Wt.event=function(a){ws&&(a=ws(a)),a.persist=function(){};var n=!1,h=!1,u=a.stopPropagation;a.stopPropagation=function(){u.call(a),n=!0};var v=a.preventDefault;return a.preventDefault=function(){v.call(a),h=!0},a.isPropagationStopped=function(){return n},a.isDefaultPrevented=function(){return h},a.nativeEvent=a};var bs={configurable:!0,get:function(){return this.class}},Ms=Wt.vnode;Wt.vnode=function(a){a.$$typeof=Bl;var n=a.type,h=a.props;if(n){if(h.class!=h.className&&(bs.enumerable="className"in h,h.className!=null&&(h.class=h.className),Object.defineProperty(h,"className",bs)),typeof n!="function"){var u,v,o;for(o in h.defaultValue&&h.value!==void 0&&(h.value||h.value===0||(h.value=h.defaultValue),delete h.defaultValue),Array.isArray(h.value)&&h.multiple&&n==="select"&&(br(h.children).forEach(function(w){h.value.indexOf(w.props.value)!=-1&&(w.props.selected=!0)}),delete h.value),h)if(u=ys.test(o))break;if(u)for(o in v=a.props={},h)v[ys.test(o)?o.replace(/[A-Z0-9]/,"-$&").toLowerCase():o]=h[o]}(function(w){var y=a.type,b=a.props;if(b&&typeof y=="string"){var B={};for(var k in b)/^on(Ani|Tra|Tou)/.test(k)&&(b[k.toLowerCase()]=b[k],delete b[k]),B[k.toLowerCase()]=k;if(B.ondoubleclick&&(b.ondblclick=b[B.ondoubleclick],delete b[B.ondoubleclick]),B.onbeforeinput&&(b.onbeforeinput=b[B.onbeforeinput],delete b[B.onbeforeinput]),B.onchange&&(y==="textarea"||y.toLowerCase()==="input"&&!/^fil|che|ra/i.test(b.type))){var L=B.oninput||"oninput";b[L]||(b[L]=b[B.onchange],delete b[B.onchange])}}})(),typeof n=="function"&&!n.m&&n.prototype&&(tf(n.prototype,"componentWillMount"),tf(n.prototype,"componentWillReceiveProps"),tf(n.prototype,"componentWillUpdate"),n.m=!0)}Ms&&Ms(a)};var Qb="16.8.0";function Il(a){return vr.bind(null,a)}function s0(a){return!!a&&a.$$typeof===Bl}function Tl(a){return s0(a)?Wb.apply(null,arguments):a}function Cl(a){return!!a.__k&&($i(null,a),!0)}function Ll(a){return a&&(a.base||a.nodeType===1&&a)||null}var Pl=function(a,n){return a(n)};const tM={useState:i0,useReducer:n0,useEffect:vl,useLayoutEffect:a0,useRef:pl,useImperativeHandle:ml,useMemo:Aa,useCallback:gl,useContext:yl,useDebugValue:wl,version:"16.8.0",Children:Sl,render:Zf,hydrate:Zf,unmountComponentAtNode:Cl,createPortal:Rl,createElement:vr,createContext:dl,createFactory:Il,cloneElement:Tl,createRef:ol,Fragment:fn,isValidElement:s0,findDOMNode:Ll,Component:tr,PureComponent:Ml,memo:xl,forwardRef:_l,unstable_batchedUpdates:Pl,Suspense:Nn,SuspenseList:Qr,lazy:kl},eM=Object.freeze(Object.defineProperty({__proto__:null,Children:Sl,Component:tr,Fragment:fn,PureComponent:Ml,Suspense:Nn,SuspenseList:Qr,cloneElement:Tl,createContext:dl,createElement:vr,createFactory:Il,createPortal:Rl,createRef:ol,default:tM,findDOMNode:Ll,forwardRef:_l,hydrate:Xb,isValidElement:s0,lazy:kl,memo:xl,render:Zf,unmountComponentAtNode:Cl,unstable_batchedUpdates:Pl,useCallback:gl,useContext:yl,useDebugValue:wl,useEffect:vl,useErrorBoundary:Vb,useImperativeHandle:ml,useLayoutEffect:a0,useMemo:Aa,useReducer:n0,useRef:pl,useState:i0,version:Qb},Symbol.toStringTag,{value:"Module"})),rM=Cs(eM);function Ol(a){return a&&typeof a=="object"&&"default"in a?a.default:a}var Fe=N2,Nl=Ol(nn),iM=Ol($b),Zt=rM;function nM(a){Nl.toString(a,{type:"terminal"}).then(console.log)}var aM=`:root {
|
|
37
|
+
--animation-duration: 300ms;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@keyframes fadeIn {
|
|
41
|
+
from {
|
|
42
|
+
opacity: 0;
|
|
43
|
+
}
|
|
44
|
+
to {
|
|
45
|
+
opacity: 1;
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
@keyframes fadeOut {
|
|
50
|
+
from {
|
|
51
|
+
opacity: 1;
|
|
52
|
+
}
|
|
53
|
+
to {
|
|
54
|
+
opacity: 0;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.animated {
|
|
59
|
+
animation-duration: var(--animation-duration);
|
|
60
|
+
animation-fill-mode: both;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.fadeIn {
|
|
64
|
+
animation-name: fadeIn;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
.fadeOut {
|
|
68
|
+
animation-name: fadeOut;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
#walletconnect-wrapper {
|
|
72
|
+
-webkit-user-select: none;
|
|
73
|
+
align-items: center;
|
|
74
|
+
display: flex;
|
|
75
|
+
height: 100%;
|
|
76
|
+
justify-content: center;
|
|
77
|
+
left: 0;
|
|
78
|
+
pointer-events: none;
|
|
79
|
+
position: fixed;
|
|
80
|
+
top: 0;
|
|
81
|
+
user-select: none;
|
|
82
|
+
width: 100%;
|
|
83
|
+
z-index: 99999999999999;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
.walletconnect-modal__headerLogo {
|
|
87
|
+
height: 21px;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
.walletconnect-modal__header p {
|
|
91
|
+
color: #ffffff;
|
|
92
|
+
font-size: 20px;
|
|
93
|
+
font-weight: 600;
|
|
94
|
+
margin: 0;
|
|
95
|
+
align-items: flex-start;
|
|
96
|
+
display: flex;
|
|
97
|
+
flex: 1;
|
|
98
|
+
margin-left: 5px;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
.walletconnect-modal__close__wrapper {
|
|
102
|
+
position: absolute;
|
|
103
|
+
top: 0px;
|
|
104
|
+
right: 0px;
|
|
105
|
+
z-index: 10000;
|
|
106
|
+
background: white;
|
|
107
|
+
border-radius: 26px;
|
|
108
|
+
padding: 6px;
|
|
109
|
+
box-sizing: border-box;
|
|
110
|
+
width: 26px;
|
|
111
|
+
height: 26px;
|
|
112
|
+
cursor: pointer;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
.walletconnect-modal__close__icon {
|
|
116
|
+
position: relative;
|
|
117
|
+
top: 7px;
|
|
118
|
+
right: 0;
|
|
119
|
+
display: flex;
|
|
120
|
+
align-items: center;
|
|
121
|
+
justify-content: center;
|
|
122
|
+
transform: rotate(45deg);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
.walletconnect-modal__close__line1 {
|
|
126
|
+
position: absolute;
|
|
127
|
+
width: 100%;
|
|
128
|
+
border: 1px solid rgb(48, 52, 59);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
.walletconnect-modal__close__line2 {
|
|
132
|
+
position: absolute;
|
|
133
|
+
width: 100%;
|
|
134
|
+
border: 1px solid rgb(48, 52, 59);
|
|
135
|
+
transform: rotate(90deg);
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
.walletconnect-qrcode__base {
|
|
139
|
+
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
140
|
+
background: rgba(37, 41, 46, 0.95);
|
|
141
|
+
height: 100%;
|
|
142
|
+
left: 0;
|
|
143
|
+
pointer-events: auto;
|
|
144
|
+
position: fixed;
|
|
145
|
+
top: 0;
|
|
146
|
+
transition: 0.4s cubic-bezier(0.19, 1, 0.22, 1);
|
|
147
|
+
width: 100%;
|
|
148
|
+
will-change: opacity;
|
|
149
|
+
padding: 40px;
|
|
150
|
+
box-sizing: border-box;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
.walletconnect-qrcode__text {
|
|
154
|
+
color: rgba(60, 66, 82, 0.6);
|
|
155
|
+
font-size: 16px;
|
|
156
|
+
font-weight: 600;
|
|
157
|
+
letter-spacing: 0;
|
|
158
|
+
line-height: 1.1875em;
|
|
159
|
+
margin: 10px 0 20px 0;
|
|
160
|
+
text-align: center;
|
|
161
|
+
width: 100%;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
@media only screen and (max-width: 768px) {
|
|
165
|
+
.walletconnect-qrcode__text {
|
|
166
|
+
font-size: 4vw;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
@media only screen and (max-width: 320px) {
|
|
171
|
+
.walletconnect-qrcode__text {
|
|
172
|
+
font-size: 14px;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
.walletconnect-qrcode__image {
|
|
177
|
+
width: calc(100% - 30px);
|
|
178
|
+
box-sizing: border-box;
|
|
179
|
+
cursor: none;
|
|
180
|
+
margin: 0 auto;
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
.walletconnect-qrcode__notification {
|
|
184
|
+
position: absolute;
|
|
185
|
+
bottom: 0;
|
|
186
|
+
left: 0;
|
|
187
|
+
right: 0;
|
|
188
|
+
font-size: 16px;
|
|
189
|
+
padding: 16px 20px;
|
|
190
|
+
border-radius: 16px;
|
|
191
|
+
text-align: center;
|
|
192
|
+
transition: all 0.1s ease-in-out;
|
|
193
|
+
background: white;
|
|
194
|
+
color: black;
|
|
195
|
+
margin-bottom: -60px;
|
|
196
|
+
opacity: 0;
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
.walletconnect-qrcode__notification.notification__show {
|
|
200
|
+
opacity: 1;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
@media only screen and (max-width: 768px) {
|
|
204
|
+
.walletconnect-modal__header {
|
|
205
|
+
height: 130px;
|
|
206
|
+
}
|
|
207
|
+
.walletconnect-modal__base {
|
|
208
|
+
overflow: auto;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
@media only screen and (min-device-width: 415px) and (max-width: 768px) {
|
|
213
|
+
#content {
|
|
214
|
+
max-width: 768px;
|
|
215
|
+
box-sizing: border-box;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
@media only screen and (min-width: 375px) and (max-width: 415px) {
|
|
220
|
+
#content {
|
|
221
|
+
max-width: 414px;
|
|
222
|
+
box-sizing: border-box;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
@media only screen and (min-width: 320px) and (max-width: 375px) {
|
|
227
|
+
#content {
|
|
228
|
+
max-width: 375px;
|
|
229
|
+
box-sizing: border-box;
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
@media only screen and (max-width: 320px) {
|
|
234
|
+
#content {
|
|
235
|
+
max-width: 320px;
|
|
236
|
+
box-sizing: border-box;
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
.walletconnect-modal__base {
|
|
241
|
+
-webkit-font-smoothing: antialiased;
|
|
242
|
+
background: #ffffff;
|
|
243
|
+
border-radius: 24px;
|
|
244
|
+
box-shadow: 0 10px 50px 5px rgba(0, 0, 0, 0.4);
|
|
245
|
+
font-family: ui-rounded, "SF Pro Rounded", "SF Pro Text", medium-content-sans-serif-font,
|
|
246
|
+
-apple-system, BlinkMacSystemFont, ui-sans-serif, "Segoe UI", Roboto, Oxygen, Ubuntu, Cantarell,
|
|
247
|
+
"Open Sans", "Helvetica Neue", sans-serif;
|
|
248
|
+
margin-top: 41px;
|
|
249
|
+
padding: 24px 24px 22px;
|
|
250
|
+
pointer-events: auto;
|
|
251
|
+
position: relative;
|
|
252
|
+
text-align: center;
|
|
253
|
+
transition: 0.4s cubic-bezier(0.19, 1, 0.22, 1);
|
|
254
|
+
will-change: transform;
|
|
255
|
+
overflow: visible;
|
|
256
|
+
transform: translateY(-50%);
|
|
257
|
+
top: 50%;
|
|
258
|
+
max-width: 500px;
|
|
259
|
+
margin: auto;
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
@media only screen and (max-width: 320px) {
|
|
263
|
+
.walletconnect-modal__base {
|
|
264
|
+
padding: 24px 12px;
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
|
|
268
|
+
.walletconnect-modal__base .hidden {
|
|
269
|
+
transform: translateY(150%);
|
|
270
|
+
transition: 0.125s cubic-bezier(0.4, 0, 1, 1);
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
.walletconnect-modal__header {
|
|
274
|
+
align-items: center;
|
|
275
|
+
display: flex;
|
|
276
|
+
height: 26px;
|
|
277
|
+
left: 0;
|
|
278
|
+
justify-content: space-between;
|
|
279
|
+
position: absolute;
|
|
280
|
+
top: -42px;
|
|
281
|
+
width: 100%;
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
.walletconnect-modal__base .wc-logo {
|
|
285
|
+
align-items: center;
|
|
286
|
+
display: flex;
|
|
287
|
+
height: 26px;
|
|
288
|
+
margin-top: 15px;
|
|
289
|
+
padding-bottom: 15px;
|
|
290
|
+
pointer-events: auto;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
.walletconnect-modal__base .wc-logo div {
|
|
294
|
+
background-color: #3399ff;
|
|
295
|
+
height: 21px;
|
|
296
|
+
margin-right: 5px;
|
|
297
|
+
mask-image: url("images/wc-logo.svg") center no-repeat;
|
|
298
|
+
width: 32px;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
.walletconnect-modal__base .wc-logo p {
|
|
302
|
+
color: #ffffff;
|
|
303
|
+
font-size: 20px;
|
|
304
|
+
font-weight: 600;
|
|
305
|
+
margin: 0;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
.walletconnect-modal__base h2 {
|
|
309
|
+
color: rgba(60, 66, 82, 0.6);
|
|
310
|
+
font-size: 16px;
|
|
311
|
+
font-weight: 600;
|
|
312
|
+
letter-spacing: 0;
|
|
313
|
+
line-height: 1.1875em;
|
|
314
|
+
margin: 0 0 19px 0;
|
|
315
|
+
text-align: center;
|
|
316
|
+
width: 100%;
|
|
317
|
+
}
|
|
318
|
+
|
|
319
|
+
.walletconnect-modal__base__row {
|
|
320
|
+
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
|
|
321
|
+
align-items: center;
|
|
322
|
+
border-radius: 20px;
|
|
323
|
+
cursor: pointer;
|
|
324
|
+
display: flex;
|
|
325
|
+
height: 56px;
|
|
326
|
+
justify-content: space-between;
|
|
327
|
+
padding: 0 15px;
|
|
328
|
+
position: relative;
|
|
329
|
+
margin: 0px 0px 8px;
|
|
330
|
+
text-align: left;
|
|
331
|
+
transition: 0.15s cubic-bezier(0.25, 0.46, 0.45, 0.94);
|
|
332
|
+
will-change: transform;
|
|
333
|
+
text-decoration: none;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
.walletconnect-modal__base__row:hover {
|
|
337
|
+
background: rgba(60, 66, 82, 0.06);
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
.walletconnect-modal__base__row:active {
|
|
341
|
+
background: rgba(60, 66, 82, 0.06);
|
|
342
|
+
transform: scale(0.975);
|
|
343
|
+
transition: 0.1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
.walletconnect-modal__base__row__h3 {
|
|
347
|
+
color: #25292e;
|
|
348
|
+
font-size: 20px;
|
|
349
|
+
font-weight: 700;
|
|
350
|
+
margin: 0;
|
|
351
|
+
padding-bottom: 3px;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
.walletconnect-modal__base__row__right {
|
|
355
|
+
align-items: center;
|
|
356
|
+
display: flex;
|
|
357
|
+
justify-content: center;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
.walletconnect-modal__base__row__right__app-icon {
|
|
361
|
+
border-radius: 8px;
|
|
362
|
+
height: 34px;
|
|
363
|
+
margin: 0 11px 2px 0;
|
|
364
|
+
width: 34px;
|
|
365
|
+
background-size: 100%;
|
|
366
|
+
box-shadow: 0 4px 12px 0 rgba(37, 41, 46, 0.25);
|
|
367
|
+
}
|
|
368
|
+
|
|
369
|
+
.walletconnect-modal__base__row__right__caret {
|
|
370
|
+
height: 18px;
|
|
371
|
+
opacity: 0.3;
|
|
372
|
+
transition: 0.1s cubic-bezier(0.25, 0.46, 0.45, 0.94);
|
|
373
|
+
width: 8px;
|
|
374
|
+
will-change: opacity;
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
.walletconnect-modal__base__row:hover .caret,
|
|
378
|
+
.walletconnect-modal__base__row:active .caret {
|
|
379
|
+
opacity: 0.6;
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
.walletconnect-modal__mobile__toggle {
|
|
383
|
+
width: 80%;
|
|
384
|
+
display: flex;
|
|
385
|
+
margin: 0 auto;
|
|
386
|
+
position: relative;
|
|
387
|
+
overflow: hidden;
|
|
388
|
+
border-radius: 8px;
|
|
389
|
+
margin-bottom: 18px;
|
|
390
|
+
background: #d4d5d9;
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
.walletconnect-modal__single_wallet {
|
|
394
|
+
display: flex;
|
|
395
|
+
justify-content: center;
|
|
396
|
+
margin-top: 7px;
|
|
397
|
+
margin-bottom: 18px;
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
.walletconnect-modal__single_wallet a {
|
|
401
|
+
cursor: pointer;
|
|
402
|
+
color: rgb(64, 153, 255);
|
|
403
|
+
font-size: 21px;
|
|
404
|
+
font-weight: 800;
|
|
405
|
+
text-decoration: none !important;
|
|
406
|
+
margin: 0 auto;
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
.walletconnect-modal__mobile__toggle_selector {
|
|
410
|
+
width: calc(50% - 8px);
|
|
411
|
+
background: white;
|
|
412
|
+
position: absolute;
|
|
413
|
+
border-radius: 5px;
|
|
414
|
+
height: calc(100% - 8px);
|
|
415
|
+
top: 4px;
|
|
416
|
+
transition: all 0.2s ease-in-out;
|
|
417
|
+
transform: translate3d(4px, 0, 0);
|
|
418
|
+
}
|
|
419
|
+
|
|
420
|
+
.walletconnect-modal__mobile__toggle.right__selected .walletconnect-modal__mobile__toggle_selector {
|
|
421
|
+
transform: translate3d(calc(100% + 12px), 0, 0);
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
.walletconnect-modal__mobile__toggle a {
|
|
425
|
+
font-size: 12px;
|
|
426
|
+
width: 50%;
|
|
427
|
+
text-align: center;
|
|
428
|
+
padding: 8px;
|
|
429
|
+
margin: 0;
|
|
430
|
+
font-weight: 600;
|
|
431
|
+
z-index: 1;
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
.walletconnect-modal__footer {
|
|
435
|
+
display: flex;
|
|
436
|
+
justify-content: center;
|
|
437
|
+
margin-top: 20px;
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
@media only screen and (max-width: 768px) {
|
|
441
|
+
.walletconnect-modal__footer {
|
|
442
|
+
margin-top: 5vw;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
|
|
446
|
+
.walletconnect-modal__footer a {
|
|
447
|
+
cursor: pointer;
|
|
448
|
+
color: #898d97;
|
|
449
|
+
font-size: 15px;
|
|
450
|
+
margin: 0 auto;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
@media only screen and (max-width: 320px) {
|
|
454
|
+
.walletconnect-modal__footer a {
|
|
455
|
+
font-size: 14px;
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
.walletconnect-connect__buttons__wrapper {
|
|
460
|
+
max-height: 44vh;
|
|
461
|
+
}
|
|
462
|
+
|
|
463
|
+
.walletconnect-connect__buttons__wrapper__android {
|
|
464
|
+
margin: 50% 0;
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
.walletconnect-connect__buttons__wrapper__wrap {
|
|
468
|
+
display: grid;
|
|
469
|
+
grid-template-columns: repeat(4, 1fr);
|
|
470
|
+
margin: 10px 0;
|
|
471
|
+
}
|
|
472
|
+
|
|
473
|
+
@media only screen and (min-width: 768px) {
|
|
474
|
+
.walletconnect-connect__buttons__wrapper__wrap {
|
|
475
|
+
margin-top: 40px;
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
|
|
479
|
+
.walletconnect-connect__button {
|
|
480
|
+
background-color: rgb(64, 153, 255);
|
|
481
|
+
padding: 12px;
|
|
482
|
+
border-radius: 8px;
|
|
483
|
+
text-decoration: none;
|
|
484
|
+
color: rgb(255, 255, 255);
|
|
485
|
+
font-weight: 500;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
.walletconnect-connect__button__icon_anchor {
|
|
489
|
+
cursor: pointer;
|
|
490
|
+
display: flex;
|
|
491
|
+
justify-content: flex-start;
|
|
492
|
+
align-items: center;
|
|
493
|
+
margin: 8px;
|
|
494
|
+
width: 42px;
|
|
495
|
+
justify-self: center;
|
|
496
|
+
flex-direction: column;
|
|
497
|
+
text-decoration: none !important;
|
|
498
|
+
}
|
|
499
|
+
|
|
500
|
+
@media only screen and (max-width: 320px) {
|
|
501
|
+
.walletconnect-connect__button__icon_anchor {
|
|
502
|
+
margin: 4px;
|
|
503
|
+
}
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
.walletconnect-connect__button__icon {
|
|
507
|
+
border-radius: 10px;
|
|
508
|
+
height: 42px;
|
|
509
|
+
margin: 0;
|
|
510
|
+
width: 42px;
|
|
511
|
+
background-size: cover !important;
|
|
512
|
+
box-shadow: 0 4px 12px 0 rgba(37, 41, 46, 0.25);
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
.walletconnect-connect__button__text {
|
|
516
|
+
color: #424952;
|
|
517
|
+
font-size: 2.7vw;
|
|
518
|
+
text-decoration: none !important;
|
|
519
|
+
padding: 0;
|
|
520
|
+
margin-top: 1.8vw;
|
|
521
|
+
font-weight: 600;
|
|
522
|
+
}
|
|
523
|
+
|
|
524
|
+
@media only screen and (min-width: 768px) {
|
|
525
|
+
.walletconnect-connect__button__text {
|
|
526
|
+
font-size: 16px;
|
|
527
|
+
margin-top: 12px;
|
|
528
|
+
}
|
|
529
|
+
}
|
|
530
|
+
|
|
531
|
+
.walletconnect-search__input {
|
|
532
|
+
border: none;
|
|
533
|
+
background: #d4d5d9;
|
|
534
|
+
border-style: none;
|
|
535
|
+
padding: 8px 16px;
|
|
536
|
+
outline: none;
|
|
537
|
+
font-style: normal;
|
|
538
|
+
font-stretch: normal;
|
|
539
|
+
font-size: 16px;
|
|
540
|
+
font-style: normal;
|
|
541
|
+
font-stretch: normal;
|
|
542
|
+
line-height: normal;
|
|
543
|
+
letter-spacing: normal;
|
|
544
|
+
text-align: left;
|
|
545
|
+
border-radius: 8px;
|
|
546
|
+
width: calc(100% - 16px);
|
|
547
|
+
margin: 0;
|
|
548
|
+
margin-bottom: 8px;
|
|
549
|
+
}
|
|
550
|
+
`;typeof Symbol<"u"&&(Symbol.iterator||(Symbol.iterator=Symbol("Symbol.iterator")));typeof Symbol<"u"&&(Symbol.asyncIterator||(Symbol.asyncIterator=Symbol("Symbol.asyncIterator")));function fM(a,n){try{var h=a()}catch(u){return n(u)}return h&&h.then?h.then(void 0,n):h}var oM="data:image/svg+xml,%3Csvg height='185' viewBox='0 0 300 185' width='300' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='m61.4385429 36.2562612c48.9112241-47.8881663 128.2119871-47.8881663 177.1232091 0l5.886545 5.7634174c2.445561 2.3944081 2.445561 6.2765112 0 8.6709204l-20.136695 19.715503c-1.222781 1.1972051-3.2053 1.1972051-4.428081 0l-8.100584-7.9311479c-34.121692-33.4079817-89.443886-33.4079817-123.5655788 0l-8.6750562 8.4936051c-1.2227816 1.1972041-3.205301 1.1972041-4.4280806 0l-20.1366949-19.7155031c-2.4455612-2.3944092-2.4455612-6.2765122 0-8.6709204zm218.7677961 40.7737449 17.921697 17.546897c2.445549 2.3943969 2.445563 6.2764769.000031 8.6708899l-80.810171 79.121134c-2.445544 2.394426-6.410582 2.394453-8.85616.000062-.00001-.00001-.000022-.000022-.000032-.000032l-57.354143-56.154572c-.61139-.598602-1.60265-.598602-2.21404 0-.000004.000004-.000007.000008-.000011.000011l-57.3529212 56.154531c-2.4455368 2.394432-6.4105755 2.394472-8.8561612.000087-.0000143-.000014-.0000296-.000028-.0000449-.000044l-80.81241943-79.122185c-2.44556021-2.394408-2.44556021-6.2765115 0-8.6709197l17.92172963-17.5468673c2.4455602-2.3944082 6.4105989-2.3944082 8.8561602 0l57.3549775 56.155357c.6113908.598602 1.602649.598602 2.2140398 0 .0000092-.000009.0000174-.000017.0000265-.000024l57.3521031-56.155333c2.445505-2.3944633 6.410544-2.3945531 8.856161-.0002.000034.0000336.000068.0000673.000101.000101l57.354902 56.155432c.61139.598601 1.60265.598601 2.21404 0l57.353975-56.1543249c2.445561-2.3944092 6.410599-2.3944092 8.85616 0z' fill='%233b99fc'/%3E%3C/svg%3E",sM="WalletConnect",hM=300,uM="rgb(64, 153, 255)",ql="walletconnect-wrapper",xs="walletconnect-style-sheet",Ul="walletconnect-qrcode-modal",lM="walletconnect-qrcode-close",Fl="walletconnect-qrcode-text",cM="walletconnect-connect-button";function dM(a){return Zt.createElement("div",{className:"walletconnect-modal__header"},Zt.createElement("img",{src:oM,className:"walletconnect-modal__headerLogo"}),Zt.createElement("p",null,sM),Zt.createElement("div",{className:"walletconnect-modal__close__wrapper",onClick:a.onClose},Zt.createElement("div",{id:lM,className:"walletconnect-modal__close__icon"},Zt.createElement("div",{className:"walletconnect-modal__close__line1"}),Zt.createElement("div",{className:"walletconnect-modal__close__line2"}))))}function vM(a){return Zt.createElement("a",{className:"walletconnect-connect__button",href:a.href,id:cM+"-"+a.name,onClick:a.onClick,rel:"noopener noreferrer",style:{backgroundColor:a.color},target:"_blank"},a.name)}var pM="data:image/svg+xml,%3Csvg fill='none' height='18' viewBox='0 0 8 18' width='8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath clip-rule='evenodd' d='m.586301.213898c-.435947.33907-.5144813.967342-.175411 1.403292l4.87831 6.27212c.28087.36111.28087.86677 0 1.22788l-4.878311 6.27211c-.33907.436-.260536 1.0642.175412 1.4033.435949.3391 1.064219.2605 1.403289-.1754l4.87832-6.2721c.84259-1.08336.84259-2.60034 0-3.68367l-4.87832-6.27212c-.33907-.4359474-.96734-.514482-1.403289-.175412z' fill='%233c4252' fill-rule='evenodd'/%3E%3C/svg%3E";function mM(a){var n=a.color,h=a.href,u=a.name,v=a.logo,o=a.onClick;return Zt.createElement("a",{className:"walletconnect-modal__base__row",href:h,onClick:o,rel:"noopener noreferrer",target:"_blank"},Zt.createElement("h3",{className:"walletconnect-modal__base__row__h3"},u),Zt.createElement("div",{className:"walletconnect-modal__base__row__right"},Zt.createElement("div",{className:"walletconnect-modal__base__row__right__app-icon",style:{background:"url('"+v+"') "+n,backgroundSize:"100%"}}),Zt.createElement("img",{src:pM,className:"walletconnect-modal__base__row__right__caret"})))}function gM(a){var n=a.color,h=a.href,u=a.name,v=a.logo,o=a.onClick,w=window.innerWidth<768?(u.length>8?2.5:2.7)+"vw":"inherit";return Zt.createElement("a",{className:"walletconnect-connect__button__icon_anchor",href:h,onClick:o,rel:"noopener noreferrer",target:"_blank"},Zt.createElement("div",{className:"walletconnect-connect__button__icon",style:{background:"url('"+v+"') "+n,backgroundSize:"100%"}}),Zt.createElement("div",{style:{fontSize:w},className:"walletconnect-connect__button__text"},u))}var yM=5,ef=12;function wM(a){var n=Fe.isAndroid(),h=Zt.useState(""),u=h[0],v=h[1],o=Zt.useState(""),w=o[0],y=o[1],b=Zt.useState(1),B=b[0],k=b[1],L=w?a.links.filter(function(O){return O.name.toLowerCase().includes(w.toLowerCase())}):a.links,q=a.errorMessage,$=w||L.length>yM,M=Math.ceil(L.length/ef),N=[(B-1)*ef+1,B*ef],x=L.length?L.filter(function(O,W){return W+1>=N[0]&&W+1<=N[1]}):[],A=!n&&M>1,S=void 0;function T(O){v(O.target.value),clearTimeout(S),O.target.value?S=setTimeout(function(){y(O.target.value),k(1)},1e3):(v(""),y(""),k(1))}return Zt.createElement("div",null,Zt.createElement("p",{id:Fl,className:"walletconnect-qrcode__text"},n?a.text.connect_mobile_wallet:a.text.choose_preferred_wallet),!n&&Zt.createElement("input",{className:"walletconnect-search__input",placeholder:"Search",value:u,onChange:T}),Zt.createElement("div",{className:"walletconnect-connect__buttons__wrapper"+(n?"__android":$&&L.length?"__wrap":"")},n?Zt.createElement(vM,{name:a.text.connect,color:uM,href:a.uri,onClick:Zt.useCallback(function(){Fe.saveMobileLinkInfo({name:"Unknown",href:a.uri})},[])}):x.length?x.map(function(O){var W=O.color,K=O.name,pt=O.shortName,ct=O.logo,dt=Fe.formatIOSMobile(a.uri,O),g=Zt.useCallback(function(){Fe.saveMobileLinkInfo({name:K,href:dt})},[x]);return $?Zt.createElement(gM,{color:W,href:dt,name:pt||K,logo:ct,onClick:g}):Zt.createElement(mM,{color:W,href:dt,name:K,logo:ct,onClick:g})}):Zt.createElement(Zt.Fragment,null,Zt.createElement("p",null,q.length?a.errorMessage:a.links.length&&!L.length?a.text.no_wallets_found:a.text.loading))),A&&Zt.createElement("div",{className:"walletconnect-modal__footer"},Array(M).fill(0).map(function(O,W){var K=W+1,pt=B===K;return Zt.createElement("a",{style:{margin:"auto 10px",fontWeight:pt?"bold":"normal"},onClick:function(){return k(K)}},K)})))}function bM(a){var n=!!a.message.trim();return Zt.createElement("div",{className:"walletconnect-qrcode__notification"+(n?" notification__show":"")},a.message)}var MM=function(a){try{var n="";return Promise.resolve(Nl.toString(a,{margin:0,type:"svg"})).then(function(h){return typeof h=="string"&&(n=h.replace("<svg",'<svg class="walletconnect-qrcode__image"')),n})}catch(h){return Promise.reject(h)}};function xM(a){var n=Zt.useState(""),h=n[0],u=n[1],v=Zt.useState(""),o=v[0],w=v[1];Zt.useEffect(function(){try{return Promise.resolve(MM(a.uri)).then(function(b){w(b)})}catch(b){Promise.reject(b)}},[]);var y=function(){var b=iM(a.uri);b?(u(a.text.copied_to_clipboard),setInterval(function(){return u("")},1200)):(u("Error"),setInterval(function(){return u("")},1200))};return Zt.createElement("div",null,Zt.createElement("p",{id:Fl,className:"walletconnect-qrcode__text"},a.text.scan_qrcode_with_wallet),Zt.createElement("div",{dangerouslySetInnerHTML:{__html:o}}),Zt.createElement("div",{className:"walletconnect-modal__footer"},Zt.createElement("a",{onClick:y},a.text.copy_to_clipboard)),Zt.createElement(bM,{message:h}))}function _M(a){var n=Fe.isAndroid(),h=Fe.isMobile(),u=h?a.qrcodeModalOptions&&a.qrcodeModalOptions.mobileLinks?a.qrcodeModalOptions.mobileLinks:void 0:a.qrcodeModalOptions&&a.qrcodeModalOptions.desktopLinks?a.qrcodeModalOptions.desktopLinks:void 0,v=Zt.useState(!1),o=v[0],w=v[1],y=Zt.useState(!1),b=y[0],B=y[1],k=Zt.useState(!h),L=k[0],q=k[1],$={mobile:h,text:a.text,uri:a.uri,qrcodeModalOptions:a.qrcodeModalOptions},M=Zt.useState(""),N=M[0],x=M[1],A=Zt.useState(!1),S=A[0],T=A[1],O=Zt.useState([]),W=O[0],K=O[1],pt=Zt.useState(""),ct=pt[0],dt=pt[1],g=function(){b||o||u&&!u.length||W.length>0||Zt.useEffect(function(){var t=function(){try{if(n)return Promise.resolve();w(!0);var i=fM(function(){var s=a.qrcodeModalOptions&&a.qrcodeModalOptions.registryUrl?a.qrcodeModalOptions.registryUrl:Fe.getWalletRegistryUrl();return Promise.resolve(fetch(s)).then(function(l){return Promise.resolve(l.json()).then(function(c){var p=c.listings,d=h?"mobile":"desktop",r=Fe.getMobileLinkRegistry(Fe.formatMobileRegistry(p,d),u);w(!1),B(!0),dt(r.length?"":a.text.no_supported_wallets),K(r);var f=r.length===1;f&&(x(Fe.formatIOSMobile(a.uri,r[0])),q(!0)),T(f)})})},function(s){w(!1),B(!0),dt(a.text.something_went_wrong),console.error(s)});return Promise.resolve(i&&i.then?i.then(function(){}):void 0)}catch(s){return Promise.reject(s)}};t()})};g();var e=h?L:!L;return Zt.createElement("div",{id:Ul,className:"walletconnect-qrcode__base animated fadeIn"},Zt.createElement("div",{className:"walletconnect-modal__base"},Zt.createElement(dM,{onClose:a.onClose}),S&&L?Zt.createElement("div",{className:"walletconnect-modal__single_wallet"},Zt.createElement("a",{onClick:function(){return Fe.saveMobileLinkInfo({name:W[0].name,href:N})},href:N,rel:"noopener noreferrer",target:"_blank"},a.text.connect_with+" "+(S?W[0].name:"")+" ›")):n||o||!o&&W.length?Zt.createElement("div",{className:"walletconnect-modal__mobile__toggle"+(e?" right__selected":"")},Zt.createElement("div",{className:"walletconnect-modal__mobile__toggle_selector"}),h?Zt.createElement(Zt.Fragment,null,Zt.createElement("a",{onClick:function(){return q(!1),g()}},a.text.mobile),Zt.createElement("a",{onClick:function(){return q(!0)}},a.text.qrcode)):Zt.createElement(Zt.Fragment,null,Zt.createElement("a",{onClick:function(){return q(!0)}},a.text.qrcode),Zt.createElement("a",{onClick:function(){return q(!1),g()}},a.text.desktop))):null,Zt.createElement("div",null,L||!n&&!o&&!W.length?Zt.createElement(xM,Object.assign({},$)):Zt.createElement(wM,Object.assign({},$,{links:W,errorMessage:ct})))))}var SM={choose_preferred_wallet:"Wähle bevorzugte Wallet",connect_mobile_wallet:"Verbinde mit Mobile Wallet",scan_qrcode_with_wallet:"Scanne den QR-code mit einer WalletConnect kompatiblen Wallet",connect:"Verbinden",qrcode:"QR-Code",mobile:"Mobile",desktop:"Desktop",copy_to_clipboard:"In die Zwischenablage kopieren",copied_to_clipboard:"In die Zwischenablage kopiert!",connect_with:"Verbinden mit Hilfe von",loading:"Laden...",something_went_wrong:"Etwas ist schief gelaufen",no_supported_wallets:"Es gibt noch keine unterstützten Wallet",no_wallets_found:"keine Wallet gefunden"},AM={choose_preferred_wallet:"Choose your preferred wallet",connect_mobile_wallet:"Connect to Mobile Wallet",scan_qrcode_with_wallet:"Scan QR code with a WalletConnect-compatible wallet",connect:"Connect",qrcode:"QR Code",mobile:"Mobile",desktop:"Desktop",copy_to_clipboard:"Copy to clipboard",copied_to_clipboard:"Copied to clipboard!",connect_with:"Connect with",loading:"Loading...",something_went_wrong:"Something went wrong",no_supported_wallets:"There are no supported wallets yet",no_wallets_found:"No wallets found"},EM={choose_preferred_wallet:"Elige tu billetera preferida",connect_mobile_wallet:"Conectar a billetera móvil",scan_qrcode_with_wallet:"Escanea el código QR con una billetera compatible con WalletConnect",connect:"Conectar",qrcode:"Código QR",mobile:"Móvil",desktop:"Desktop",copy_to_clipboard:"Copiar",copied_to_clipboard:"Copiado!",connect_with:"Conectar mediante",loading:"Cargando...",something_went_wrong:"Algo salió mal",no_supported_wallets:"Todavía no hay billeteras compatibles",no_wallets_found:"No se encontraron billeteras"},kM={choose_preferred_wallet:"Choisissez votre portefeuille préféré",connect_mobile_wallet:"Se connecter au portefeuille mobile",scan_qrcode_with_wallet:"Scannez le QR code avec un portefeuille compatible WalletConnect",connect:"Se connecter",qrcode:"QR Code",mobile:"Mobile",desktop:"Desktop",copy_to_clipboard:"Copier",copied_to_clipboard:"Copié!",connect_with:"Connectez-vous à l'aide de",loading:"Chargement...",something_went_wrong:"Quelque chose a mal tourné",no_supported_wallets:"Il n'y a pas encore de portefeuilles pris en charge",no_wallets_found:"Aucun portefeuille trouvé"},RM={choose_preferred_wallet:"원하는 지갑을 선택하세요",connect_mobile_wallet:"모바일 지갑과 연결",scan_qrcode_with_wallet:"WalletConnect 지원 지갑에서 QR코드를 스캔하세요",connect:"연결",qrcode:"QR 코드",mobile:"모바일",desktop:"데스크탑",copy_to_clipboard:"클립보드에 복사",copied_to_clipboard:"클립보드에 복사되었습니다!",connect_with:"와 연결하다",loading:"로드 중...",something_went_wrong:"문제가 발생했습니다.",no_supported_wallets:"아직 지원되는 지갑이 없습니다",no_wallets_found:"지갑을 찾을 수 없습니다"},BM={choose_preferred_wallet:"Escolha sua carteira preferida",connect_mobile_wallet:"Conectar-se à carteira móvel",scan_qrcode_with_wallet:"Ler o código QR com uma carteira compatível com WalletConnect",connect:"Conectar",qrcode:"Código QR",mobile:"Móvel",desktop:"Desktop",copy_to_clipboard:"Copiar",copied_to_clipboard:"Copiado!",connect_with:"Ligar por meio de",loading:"Carregamento...",something_went_wrong:"Algo correu mal",no_supported_wallets:"Ainda não há carteiras suportadas",no_wallets_found:"Nenhuma carteira encontrada"},IM={choose_preferred_wallet:"选择你的钱包",connect_mobile_wallet:"连接至移动端钱包",scan_qrcode_with_wallet:"使用兼容 WalletConnect 的钱包扫描二维码",connect:"连接",qrcode:"二维码",mobile:"移动",desktop:"桌面",copy_to_clipboard:"复制到剪贴板",copied_to_clipboard:"复制到剪贴板成功!",connect_with:"通过以下方式连接",loading:"正在加载...",something_went_wrong:"出了问题",no_supported_wallets:"目前还没有支持的钱包",no_wallets_found:"没有找到钱包"},TM={choose_preferred_wallet:"کیف پول مورد نظر خود را انتخاب کنید",connect_mobile_wallet:"به کیف پول موبایل وصل شوید",scan_qrcode_with_wallet:"کد QR را با یک کیف پول سازگار با WalletConnect اسکن کنید",connect:"اتصال",qrcode:"کد QR",mobile:"سیار",desktop:"دسکتاپ",copy_to_clipboard:"کپی به کلیپ بورد",copied_to_clipboard:"در کلیپ بورد کپی شد!",connect_with:"ارتباط با",loading:"...بارگذاری",something_went_wrong:"مشکلی پیش آمد",no_supported_wallets:"هنوز هیچ کیف پول پشتیبانی شده ای وجود ندارد",no_wallets_found:"هیچ کیف پولی پیدا نشد"},_s={de:SM,en:AM,es:EM,fr:kM,ko:RM,pt:BM,zh:IM,fa:TM};function CM(){var a=Fe.getDocumentOrThrow(),n=a.getElementById(xs);n&&a.head.removeChild(n);var h=a.createElement("style");h.setAttribute("id",xs),h.innerText=aM,a.head.appendChild(h)}function LM(){var a=Fe.getDocumentOrThrow(),n=a.createElement("div");return n.setAttribute("id",ql),a.body.appendChild(n),n}function $l(){var a=Fe.getDocumentOrThrow(),n=a.getElementById(Ul);n&&(n.className=n.className.replace("fadeIn","fadeOut"),setTimeout(function(){var h=a.getElementById(ql);h&&a.body.removeChild(h)},hM))}function PM(a){return function(){$l(),a&&a()}}function OM(){var a=Fe.getNavigatorOrThrow().language.split("-")[0]||"en";return _s[a]||_s.en}function NM(a,n,h){CM();var u=LM();Zt.render(Zt.createElement(_M,{text:OM(),uri:a,onClose:PM(n),qrcodeModalOptions:h}),u)}function qM(){$l()}var zl=function(){return typeof Me<"u"&&typeof Me.versions<"u"&&typeof Me.versions.node<"u"};function UM(a,n,h){console.log(a),zl()?nM(a):NM(a,n,h)}function FM(){zl()||qM()}var $M={open:UM,close:FM},zM=$M;const DM=jf(zM);var Dl={},h0={},u0={};Object.defineProperty(u0,"__esModule",{value:!0});var HM=function(){function a(n){this.type=n,this.bubbles=!1,this.cancelable=!1,this.loaded=0,this.lengthComputable=!1,this.total=0}return a}();u0.ProgressEvent=HM;var Ei={},Ea=Vt&&Vt.__extends||function(){var a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,h){n.__proto__=h}||function(n,h){for(var u in h)h.hasOwnProperty(u)&&(n[u]=h[u])};return function(n,h){a(n,h);function u(){this.constructor=n}n.prototype=h===null?Object.create(h):(u.prototype=h.prototype,new u)}}();Object.defineProperty(Ei,"__esModule",{value:!0});var KM=function(a){Ea(n,a);function n(){return a!==null&&a.apply(this,arguments)||this}return n}(Error);Ei.SecurityError=KM;var ZM=function(a){Ea(n,a);function n(){return a!==null&&a.apply(this,arguments)||this}return n}(Error);Ei.InvalidStateError=ZM;var WM=function(a){Ea(n,a);function n(){return a!==null&&a.apply(this,arguments)||this}return n}(Error);Ei.NetworkError=WM;var VM=function(a){Ea(n,a);function n(){return a!==null&&a.apply(this,arguments)||this}return n}(Error);Ei.SyntaxError=VM;var on={};Object.defineProperty(on,"__esModule",{value:!0});var GM=function(){function a(){this.listeners={}}return a.prototype.addEventListener=function(n,h){n=n.toLowerCase(),this.listeners[n]=this.listeners[n]||[],this.listeners[n].push(h.handleEvent||h)},a.prototype.removeEventListener=function(n,h){if(n=n.toLowerCase(),!!this.listeners[n]){var u=this.listeners[n].indexOf(h.handleEvent||h);u<0||this.listeners[n].splice(u,1)}},a.prototype.dispatchEvent=function(n){var h=n.type.toLowerCase();if(n.target=this,this.listeners[h])for(var u=0,v=this.listeners[h];u<v.length;u++){var o=v[u];o.call(this,n)}var w=this["on"+h];return w&&w.call(this,n),!0},a}();on.XMLHttpRequestEventTarget=GM;var l0={},JM=Vt&&Vt.__extends||function(){var a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,h){n.__proto__=h}||function(n,h){for(var u in h)h.hasOwnProperty(u)&&(n[u]=h[u])};return function(n,h){a(n,h);function u(){this.constructor=n}n.prototype=h===null?Object.create(h):(u.prototype=h.prototype,new u)}}();Object.defineProperty(l0,"__esModule",{value:!0});var jM=on,YM=function(a){JM(n,a);function n(){var h=a.call(this)||this;return h._contentType=null,h._body=null,h._reset(),h}return n.prototype._reset=function(){this._contentType=null,this._body=null},n.prototype._setData=function(h){if(h!=null)if(typeof h=="string")h.length!==0&&(this._contentType="text/plain;charset=UTF-8"),this._body=new X(h,"utf-8");else if(X.isBuffer(h))this._body=h;else if(h instanceof ArrayBuffer){for(var u=new X(h.byteLength),v=new Uint8Array(h),o=0;o<h.byteLength;o++)u[o]=v[o];this._body=u}else if(h.buffer&&h.buffer instanceof ArrayBuffer){for(var u=new X(h.byteLength),w=h.byteOffset,v=new Uint8Array(h.buffer),o=0;o<h.byteLength;o++)u[o]=v[o+w];this._body=u}else throw new Error("Unsupported send() data "+h)},n.prototype._finalizeHeaders=function(h,u){this._contentType&&!u["content-type"]&&(h["Content-Type"]=this._contentType),this._body&&(h["Content-Length"]=this._body.length.toString())},n.prototype._startUpload=function(h){this._body&&h.write(this._body),h.end()},n}(jM.XMLHttpRequestEventTarget);l0.XMLHttpRequestUpload=YM;var xn={};(function(){function a(v,o,w,y){return this instanceof a?(this.domain=v||void 0,this.path=o||"/",this.secure=!!w,this.script=!!y,this):new a(v,o,w,y)}a.All=Object.freeze(Object.create(null)),xn.CookieAccessInfo=a;function n(v,o,w){return v instanceof n?v:this instanceof n?(this.name=null,this.value=null,this.expiration_date=1/0,this.path=String(w||"/"),this.explicit_path=!1,this.domain=o||null,this.explicit_domain=!1,this.secure=!1,this.noscript=!1,v&&this.parse(v,o,w),this):new n(v,o,w)}xn.Cookie=n,n.prototype.toString=function(){var o=[this.name+"="+this.value];return this.expiration_date!==1/0&&o.push("expires="+new Date(this.expiration_date).toGMTString()),this.domain&&o.push("domain="+this.domain),this.path&&o.push("path="+this.path),this.secure&&o.push("secure"),this.noscript&&o.push("httponly"),o.join("; ")},n.prototype.toValueString=function(){return this.name+"="+this.value};var h=/[:](?=\s*[a-zA-Z0-9_\-]+\s*[=])/g;n.prototype.parse=function(o,w,y){if(this instanceof n){if(o.length>32768){console.warn("Cookie too long for parsing (>32768 characters)");return}var b=o.split(";").filter(function($){return!!$}),B,k=b[0].match(/([^=]+)=([\s\S]*)/);if(!k){console.warn("Invalid cookie header encountered. Header: '"+o+"'");return}var L=k[1],q=k[2];if(typeof L!="string"||L.length===0||typeof q!="string"){console.warn("Unable to extract values from cookie header. Cookie: '"+o+"'");return}for(this.name=L,this.value=q,B=1;B<b.length;B+=1)switch(k=b[B].match(/([^=]+)(?:=([\s\S]*))?/),L=k[1].trim().toLowerCase(),q=k[2],L){case"httponly":this.noscript=!0;break;case"expires":this.expiration_date=q?Number(Date.parse(q)):1/0;break;case"path":this.path=q?q.trim():"",this.explicit_path=!0;break;case"domain":this.domain=q?q.trim():"",this.explicit_domain=!!this.domain;break;case"secure":this.secure=!0;break}return this.explicit_path||(this.path=y||"/"),this.explicit_domain||(this.domain=w),this}return new n().parse(o,w,y)},n.prototype.matches=function(o){return o===a.All?!0:!(this.noscript&&o.script||this.secure&&!o.secure||!this.collidesWith(o))},n.prototype.collidesWith=function(o){if(this.path&&!o.path||this.domain&&!o.domain||this.path&&o.path.indexOf(this.path)!==0||this.explicit_path&&o.path.indexOf(this.path)!==0)return!1;var w=o.domain&&o.domain.replace(/^[\.]/,""),y=this.domain&&this.domain.replace(/^[\.]/,"");if(y===w)return!0;if(y){if(!this.explicit_domain)return!1;var b=w.indexOf(y);return!(b===-1||b!==w.length-y.length)}return!0};function u(){var v,o,w;return this instanceof u?(v=Object.create(null),this.setCookie=function(b,B,k){var L,q;if(b=new n(b,B,k),L=b.expiration_date<=Date.now(),v[b.name]!==void 0){for(o=v[b.name],q=0;q<o.length;q+=1)if(w=o[q],w.collidesWith(b))return L?(o.splice(q,1),o.length===0&&delete v[b.name],!1):(o[q]=b,b);return L?!1:(o.push(b),b)}return L?!1:(v[b.name]=[b],v[b.name])},this.getCookie=function(b,B){var k,L;if(o=v[b],!!o)for(L=0;L<o.length;L+=1){if(k=o[L],k.expiration_date<=Date.now()){o.length===0&&delete v[k.name];continue}if(k.matches(B))return k}},this.getCookies=function(b){var B=[],k,L;for(k in v)L=this.getCookie(k,b),L&&B.push(L);return B.toString=function(){return B.join(":")},B.toValueString=function(){return B.map(function($){return $.toValueString()}).join("; ")},B},this):new u}xn.CookieJar=u,u.prototype.setCookies=function(o,w,y){o=Array.isArray(o)?o:o.split(h);var b=[],B,k;for(o=o.map(function(L){return new n(L,w,y)}),B=0;B<o.length;B+=1)k=o[B],this.setCookie(k,w,y)&&b.push(k);return b}})();var XM=Vt&&Vt.__extends||function(){var a=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(n,h){n.__proto__=h}||function(n,h){for(var u in h)h.hasOwnProperty(u)&&(n[u]=h[u])};return function(n,h){a(n,h);function u(){this.constructor=n}n.prototype=h===null?Object.create(h):(u.prototype=h.prototype,new u)}}(),QM=Vt&&Vt.__assign||Object.assign||function(a){for(var n,h=1,u=arguments.length;h<u;h++){n=arguments[h];for(var v in n)Object.prototype.hasOwnProperty.call(n,v)&&(a[v]=n[v])}return a};Object.defineProperty(h0,"__esModule",{value:!0});var Wf=Se,Hl=Se,Ss=Se,rf=Se,As=u0,yn=Ei,t3=on,Es=l0,ks=xn,ka=function(a){XM(n,a);function n(h){h===void 0&&(h={});var u=a.call(this)||this;return u.UNSENT=n.UNSENT,u.OPENED=n.OPENED,u.HEADERS_RECEIVED=n.HEADERS_RECEIVED,u.LOADING=n.LOADING,u.DONE=n.DONE,u.onreadystatechange=null,u.readyState=n.UNSENT,u.response=null,u.responseText="",u.responseType="",u.status=0,u.statusText="",u.timeout=0,u.upload=new Es.XMLHttpRequestUpload,u.responseUrl="",u.withCredentials=!1,u._method=null,u._url=null,u._sync=!1,u._headers={},u._loweredHeaders={},u._mimeOverride=null,u._request=null,u._response=null,u._responseParts=null,u._responseHeaders=null,u._aborting=null,u._error=null,u._loadedBytes=0,u._totalBytes=0,u._lengthComputable=!1,u._restrictedMethods={CONNECT:!0,TRACE:!0,TRACK:!0},u._restrictedHeaders={"accept-charset":!0,"accept-encoding":!0,"access-control-request-headers":!0,"access-control-request-method":!0,connection:!0,"content-length":!0,cookie:!0,cookie2:!0,date:!0,dnt:!0,expect:!0,host:!0,"keep-alive":!0,origin:!0,referer:!0,te:!0,trailer:!0,"transfer-encoding":!0,upgrade:!0,"user-agent":!0,via:!0},u._privateHeaders={"set-cookie":!0,"set-cookie2":!0},u._userAgent="Mozilla/5.0 ("+Ss.type()+" "+Ss.arch()+") node.js/"+Me.versions.node+" v8/"+Me.versions.v8,u._anonymous=h.anon||!1,u}return n.prototype.open=function(h,u,v,o,w){if(v===void 0&&(v=!0),h=h.toUpperCase(),this._restrictedMethods[h])throw new n.SecurityError("HTTP method "+h+" is not allowed in XHR");var y=this._parseUrl(u,o,w);this.readyState===n.HEADERS_RECEIVED||(this.readyState,n.LOADING),this._method=h,this._url=y,this._sync=!v,this._headers={},this._loweredHeaders={},this._mimeOverride=null,this._setReadyState(n.OPENED),this._request=null,this._response=null,this.status=0,this.statusText="",this._responseParts=[],this._responseHeaders=null,this._loadedBytes=0,this._totalBytes=0,this._lengthComputable=!1},n.prototype.setRequestHeader=function(h,u){if(this.readyState!==n.OPENED)throw new n.InvalidStateError("XHR readyState must be OPENED");var v=h.toLowerCase();if(this._restrictedHeaders[v]||/^sec-/.test(v)||/^proxy-/.test(v)){console.warn('Refused to set unsafe header "'+h+'"');return}u=u.toString(),this._loweredHeaders[v]!=null?(h=this._loweredHeaders[v],this._headers[h]=this._headers[h]+", "+u):(this._loweredHeaders[v]=h,this._headers[h]=u)},n.prototype.send=function(h){if(this.readyState!==n.OPENED)throw new n.InvalidStateError("XHR readyState must be OPENED");if(this._request)throw new n.InvalidStateError("send() already called");switch(this._url.protocol){case"file:":return this._sendFile(h);case"http:":case"https:":return this._sendHttp(h);default:throw new n.NetworkError("Unsupported protocol "+this._url.protocol)}},n.prototype.abort=function(){this._request!=null&&(this._request.abort(),this._setError(),this._dispatchProgress("abort"),this._dispatchProgress("loadend"))},n.prototype.getResponseHeader=function(h){if(this._responseHeaders==null||h==null)return null;var u=h.toLowerCase();return this._responseHeaders.hasOwnProperty(u)?this._responseHeaders[h.toLowerCase()]:null},n.prototype.getAllResponseHeaders=function(){var h=this;return this._responseHeaders==null?"":Object.keys(this._responseHeaders).map(function(u){return u+": "+h._responseHeaders[u]}).join(`\r
|
|
551
|
+
`)},n.prototype.overrideMimeType=function(h){if(this.readyState===n.LOADING||this.readyState===n.DONE)throw new n.InvalidStateError("overrideMimeType() not allowed in LOADING or DONE");this._mimeOverride=h.toLowerCase()},n.prototype.nodejsSet=function(h){if(this.nodejsHttpAgent=h.httpAgent||this.nodejsHttpAgent,this.nodejsHttpsAgent=h.httpsAgent||this.nodejsHttpsAgent,h.hasOwnProperty("baseUrl")){if(h.baseUrl!=null){var u=rf.parse(h.baseUrl,!1,!0);if(!u.protocol)throw new n.SyntaxError("baseUrl must be an absolute URL")}this.nodejsBaseUrl=h.baseUrl}},n.nodejsSet=function(h){n.prototype.nodejsSet(h)},n.prototype._setReadyState=function(h){this.readyState=h,this.dispatchEvent(new As.ProgressEvent("readystatechange"))},n.prototype._sendFile=function(h){throw new Error("Protocol file: not implemented")},n.prototype._sendHttp=function(h){if(this._sync)throw new Error("Synchronous XHR processing not implemented");h&&(this._method==="GET"||this._method==="HEAD")?(console.warn("Discarding entity body for "+this._method+" requests"),h=null):h=h||"",this.upload._setData(h),this._finalizeHeaders(),this._sendHxxpRequest()},n.prototype._sendHxxpRequest=function(){var h=this;if(this.withCredentials){var u=n.cookieJar.getCookies(ks.CookieAccessInfo(this._url.hostname,this._url.pathname,this._url.protocol==="https:")).toValueString();this._headers.cookie=this._headers.cookie2=u}var v=this._url.protocol==="http:"?[Wf,this.nodejsHttpAgent]:[Hl,this.nodejsHttpsAgent],o=v[0],w=v[1],y=o.request.bind(o),b=y({hostname:this._url.hostname,port:+this._url.port,path:this._url.path,auth:this._url.auth,method:this._method,headers:this._headers,agent:w});this._request=b,this.timeout&&b.setTimeout(this.timeout,function(){return h._onHttpTimeout(b)}),b.on("response",function(B){return h._onHttpResponse(b,B)}),b.on("error",function(B){return h._onHttpRequestError(b,B)}),this.upload._startUpload(b),this._request===b&&this._dispatchProgress("loadstart")},n.prototype._finalizeHeaders=function(){this._headers=QM({},this._headers,{Connection:"keep-alive",Host:this._url.host,"User-Agent":this._userAgent},this._anonymous?{Referer:"about:blank"}:{}),this.upload._finalizeHeaders(this._headers,this._loweredHeaders)},n.prototype._onHttpResponse=function(h,u){var v=this;if(this._request===h){if(this.withCredentials&&(u.headers["set-cookie"]||u.headers["set-cookie2"])&&n.cookieJar.setCookies(u.headers["set-cookie"]||u.headers["set-cookie2"]),[301,302,303,307,308].indexOf(u.statusCode)>=0){this._url=this._parseUrl(u.headers.location),this._method="GET",this._loweredHeaders["content-type"]&&(delete this._headers[this._loweredHeaders["content-type"]],delete this._loweredHeaders["content-type"]),this._headers["Content-Type"]!=null&&delete this._headers["Content-Type"],delete this._headers["Content-Length"],this.upload._reset(),this._finalizeHeaders(),this._sendHxxpRequest();return}this._response=u,this._response.on("data",function(w){return v._onHttpResponseData(u,w)}),this._response.on("end",function(){return v._onHttpResponseEnd(u)}),this._response.on("close",function(){return v._onHttpResponseClose(u)}),this.responseUrl=this._url.href.split("#")[0],this.status=u.statusCode,this.statusText=Wf.STATUS_CODES[this.status],this._parseResponseHeaders(u);var o=this._responseHeaders["content-length"]||"";this._totalBytes=+o,this._lengthComputable=!!o,this._setReadyState(n.HEADERS_RECEIVED)}},n.prototype._onHttpResponseData=function(h,u){this._response===h&&(this._responseParts.push(new X(u)),this._loadedBytes+=u.length,this.readyState!==n.LOADING&&this._setReadyState(n.LOADING),this._dispatchProgress("progress"))},n.prototype._onHttpResponseEnd=function(h){this._response===h&&(this._parseResponse(),this._request=null,this._response=null,this._setReadyState(n.DONE),this._dispatchProgress("load"),this._dispatchProgress("loadend"))},n.prototype._onHttpResponseClose=function(h){if(this._response===h){var u=this._request;this._setError(),u.abort(),this._setReadyState(n.DONE),this._dispatchProgress("error"),this._dispatchProgress("loadend")}},n.prototype._onHttpTimeout=function(h){this._request===h&&(this._setError(),h.abort(),this._setReadyState(n.DONE),this._dispatchProgress("timeout"),this._dispatchProgress("loadend"))},n.prototype._onHttpRequestError=function(h,u){this._request===h&&(this._setError(),h.abort(),this._setReadyState(n.DONE),this._dispatchProgress("error"),this._dispatchProgress("loadend"))},n.prototype._dispatchProgress=function(h){var u=new n.ProgressEvent(h);u.lengthComputable=this._lengthComputable,u.loaded=this._loadedBytes,u.total=this._totalBytes,this.dispatchEvent(u)},n.prototype._setError=function(){this._request=null,this._response=null,this._responseHeaders=null,this._responseParts=null},n.prototype._parseUrl=function(h,u,v){var o=this.nodejsBaseUrl==null?h:rf.resolve(this.nodejsBaseUrl,h),w=rf.parse(o,!1,!0);w.hash=null;var y=(w.auth||"").split(":"),b=y[0],B=y[1];return(b||B||u||v)&&(w.auth=(u||b||"")+":"+(v||B||"")),w},n.prototype._parseResponseHeaders=function(h){this._responseHeaders={};for(var u in h.headers){var v=u.toLowerCase();this._privateHeaders[v]||(this._responseHeaders[v]=h.headers[u])}this._mimeOverride!=null&&(this._responseHeaders["content-type"]=this._mimeOverride)},n.prototype._parseResponse=function(){var h=X.concat(this._responseParts);switch(this._responseParts=null,this.responseType){case"json":this.responseText=null;try{this.response=JSON.parse(h.toString("utf-8"))}catch{this.response=null}return;case"buffer":this.responseText=null,this.response=h;return;case"arraybuffer":this.responseText=null;for(var u=new ArrayBuffer(h.length),v=new Uint8Array(u),o=0;o<h.length;o++)v[o]=h[o];this.response=u;return;case"text":default:try{this.responseText=h.toString(this._parseResponseEncoding())}catch{this.responseText=h.toString("binary")}this.response=this.responseText}},n.prototype._parseResponseEncoding=function(){return/;\s*charset=(.*)$/.exec(this._responseHeaders["content-type"]||"")[1]||"utf-8"},n.ProgressEvent=As.ProgressEvent,n.InvalidStateError=yn.InvalidStateError,n.NetworkError=yn.NetworkError,n.SecurityError=yn.SecurityError,n.SyntaxError=yn.SyntaxError,n.XMLHttpRequestUpload=Es.XMLHttpRequestUpload,n.UNSENT=0,n.OPENED=1,n.HEADERS_RECEIVED=2,n.LOADING=3,n.DONE=4,n.cookieJar=ks.CookieJar(),n}(t3.XMLHttpRequestEventTarget);h0.XMLHttpRequest=ka;ka.prototype.nodejsHttpAgent=Wf.globalAgent;ka.prototype.nodejsHttpsAgent=Hl.globalAgent;ka.prototype.nodejsBaseUrl=null;(function(a){function n(u){for(var v in u)a.hasOwnProperty(v)||(a[v]=u[v])}Object.defineProperty(a,"__esModule",{value:!0}),n(h0);var h=on;a.XMLHttpRequestEventTarget=h.XMLHttpRequestEventTarget})(Dl);var c0={exports:{}};c0.exports;(function(a){(function(n,h){function u(g,e){if(!g)throw new Error(e||"Assertion failed")}function v(g,e){g.super_=e;var t=function(){};t.prototype=e.prototype,g.prototype=new t,g.prototype.constructor=g}function o(g,e,t){if(o.isBN(g))return g;this.negative=0,this.words=null,this.length=0,this.red=null,g!==null&&((e==="le"||e==="be")&&(t=e,e=10),this._init(g||0,e||10,t||"be"))}typeof n=="object"?n.exports=o:h.BN=o,o.BN=o,o.wordSize=26;var w;try{w=Se.Buffer}catch{}o.isBN=function(e){return e instanceof o?!0:e!==null&&typeof e=="object"&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,i){if(typeof e=="number")return this._initNumber(e,t,i);if(typeof e=="object")return this._initArray(e,t,i);t==="hex"&&(t=16),u(t===(t|0)&&t>=2&&t<=36),e=e.toString().replace(/\s+/g,"");var s=0;e[0]==="-"&&s++,t===16?this._parseHex(e,s):this._parseBase(e,t,s),e[0]==="-"&&(this.negative=1),this.strip(),i==="le"&&this._initArray(this.toArray(),t,i)},o.prototype._initNumber=function(e,t,i){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[e&67108863],this.length=1):e<4503599627370496?(this.words=[e&67108863,e/67108864&67108863],this.length=2):(u(e<9007199254740992),this.words=[e&67108863,e/67108864&67108863,1],this.length=3),i==="le"&&this._initArray(this.toArray(),t,i)},o.prototype._initArray=function(e,t,i){if(u(typeof e.length=="number"),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var s=0;s<this.length;s++)this.words[s]=0;var l,c,p=0;if(i==="be")for(s=e.length-1,l=0;s>=0;s-=3)c=e[s]|e[s-1]<<8|e[s-2]<<16,this.words[l]|=c<<p&67108863,this.words[l+1]=c>>>26-p&67108863,p+=24,p>=26&&(p-=26,l++);else if(i==="le")for(s=0,l=0;s<e.length;s+=3)c=e[s]|e[s+1]<<8|e[s+2]<<16,this.words[l]|=c<<p&67108863,this.words[l+1]=c>>>26-p&67108863,p+=24,p>=26&&(p-=26,l++);return this.strip()};function y(g,e,t){for(var i=0,s=Math.min(g.length,t),l=e;l<s;l++){var c=g.charCodeAt(l)-48;i<<=4,c>=49&&c<=54?i|=c-49+10:c>=17&&c<=22?i|=c-17+10:i|=c&15}return i}o.prototype._parseHex=function(e,t){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var s,l,c=0;for(i=e.length-6,s=0;i>=t;i-=6)l=y(e,i,i+6),this.words[s]|=l<<c&67108863,this.words[s+1]|=l>>>26-c&4194303,c+=24,c>=26&&(c-=26,s++);i+6!==t&&(l=y(e,t,i+6),this.words[s]|=l<<c&67108863,this.words[s+1]|=l>>>26-c&4194303),this.strip()};function b(g,e,t,i){for(var s=0,l=Math.min(g.length,t),c=e;c<l;c++){var p=g.charCodeAt(c)-48;s*=i,p>=49?s+=p-49+10:p>=17?s+=p-17+10:s+=p}return s}o.prototype._parseBase=function(e,t,i){this.words=[0],this.length=1;for(var s=0,l=1;l<=67108863;l*=t)s++;s--,l=l/t|0;for(var c=e.length-i,p=c%s,d=Math.min(c,c-p)+i,r=0,f=i;f<d;f+=s)r=b(e,f,f+s,t),this.imuln(l),this.words[0]+r<67108864?this.words[0]+=r:this._iaddn(r);if(p!==0){var m=1;for(r=b(e,f,e.length,t),f=0;f<p;f++)m*=t;this.imuln(m),this.words[0]+r<67108864?this.words[0]+=r:this._iaddn(r)}},o.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},o.prototype.clone=function(){var e=new o(null);return this.copy(e),e},o.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},o.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var B=["","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"],k=[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],L=[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];o.prototype.toString=function(e,t){e=e||10,t=t|0||1;var i;if(e===16||e==="hex"){i="";for(var s=0,l=0,c=0;c<this.length;c++){var p=this.words[c],d=((p<<s|l)&16777215).toString(16);l=p>>>24-s&16777215,l!==0||c!==this.length-1?i=B[6-d.length]+d+i:i=d+i,s+=2,s>=26&&(s-=26,c--)}for(l!==0&&(i=l.toString(16)+i);i.length%t!==0;)i="0"+i;return this.negative!==0&&(i="-"+i),i}if(e===(e|0)&&e>=2&&e<=36){var r=k[e],f=L[e];i="";var m=this.clone();for(m.negative=0;!m.isZero();){var _=m.modn(f).toString(e);m=m.idivn(f),m.isZero()?i=_+i:i=B[r-_.length]+_+i}for(this.isZero()&&(i="0"+i);i.length%t!==0;)i="0"+i;return this.negative!==0&&(i="-"+i),i}u(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return this.length===2?e+=this.words[1]*67108864:this.length===3&&this.words[2]===1?e+=4503599627370496+this.words[1]*67108864:this.length>2&&u(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-e:e},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(e,t){return u(typeof w<"u"),this.toArrayLike(w,e,t)},o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},o.prototype.toArrayLike=function(e,t,i){var s=this.byteLength(),l=i||Math.max(1,s);u(s<=l,"byte array longer than desired length"),u(l>0,"Requested array length <= 0"),this.strip();var c=t==="le",p=new e(l),d,r,f=this.clone();if(c){for(r=0;!f.isZero();r++)d=f.andln(255),f.iushrn(8),p[r]=d;for(;r<l;r++)p[r]=0}else{for(r=0;r<l-s;r++)p[r]=0;for(r=0;!f.isZero();r++)d=f.andln(255),f.iushrn(8),p[l-r-1]=d}return p},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,i=0;return t>=4096&&(i+=13,t>>>=13),t>=64&&(i+=7,t>>>=7),t>=8&&(i+=4,t>>>=4),t>=2&&(i+=2,t>>>=2),i+t},o.prototype._zeroBits=function(e){if(e===0)return 26;var t=e,i=0;return t&8191||(i+=13,t>>>=13),t&127||(i+=7,t>>>=7),t&15||(i+=4,t>>>=4),t&3||(i+=2,t>>>=2),t&1||i++,i},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return(this.length-1)*26+t};function q(g){for(var e=new Array(g.bitLength()),t=0;t<e.length;t++){var i=t/26|0,s=t%26;e[t]=(g.words[i]&1<<s)>>>s}return e}o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var i=this._zeroBits(this.words[t]);if(e+=i,i!==26)break}return e},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(e){return this.negative!==0?this.abs().inotn(e).iaddn(1):this.clone()},o.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return this.negative!==0},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this.strip()},o.prototype.ior=function(e){return u((this.negative|e.negative)===0),this.iuor(e)},o.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;this.length>e.length?t=e:t=this;for(var i=0;i<t.length;i++)this.words[i]=this.words[i]&e.words[i];return this.length=t.length,this.strip()},o.prototype.iand=function(e){return u((this.negative|e.negative)===0),this.iuand(e)},o.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,i;this.length>e.length?(t=this,i=e):(t=e,i=this);for(var s=0;s<i.length;s++)this.words[s]=t.words[s]^i.words[s];if(this!==t)for(;s<t.length;s++)this.words[s]=t.words[s];return this.length=t.length,this.strip()},o.prototype.ixor=function(e){return u((this.negative|e.negative)===0),this.iuxor(e)},o.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){u(typeof e=="number"&&e>=0);var t=Math.ceil(e/26)|0,i=e%26;this._expand(t),i>0&&t--;for(var s=0;s<t;s++)this.words[s]=~this.words[s]&67108863;return i>0&&(this.words[s]=~this.words[s]&67108863>>26-i),this.strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){u(typeof e=="number"&&e>=0);var i=e/26|0,s=e%26;return this._expand(i+1),t?this.words[i]=this.words[i]|1<<s:this.words[i]=this.words[i]&~(1<<s),this.strip()},o.prototype.iadd=function(e){var t;if(this.negative!==0&&e.negative===0)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(this.negative===0&&e.negative!==0)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();var i,s;this.length>e.length?(i=this,s=e):(i=e,s=this);for(var l=0,c=0;c<s.length;c++)t=(i.words[c]|0)+(s.words[c]|0)+l,this.words[c]=t&67108863,l=t>>>26;for(;l!==0&&c<i.length;c++)t=(i.words[c]|0)+l,this.words[c]=t&67108863,l=t>>>26;if(this.length=i.length,l!==0)this.words[this.length]=l,this.length++;else if(i!==this)for(;c<i.length;c++)this.words[c]=i.words[c];return this},o.prototype.add=function(e){var t;return e.negative!==0&&this.negative===0?(e.negative=0,t=this.sub(e),e.negative^=1,t):e.negative===0&&this.negative!==0?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(e.negative!==0){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var i=this.cmp(e);if(i===0)return this.negative=0,this.length=1,this.words[0]=0,this;var s,l;i>0?(s=this,l=e):(s=e,l=this);for(var c=0,p=0;p<l.length;p++)t=(s.words[p]|0)-(l.words[p]|0)+c,c=t>>26,this.words[p]=t&67108863;for(;c!==0&&p<s.length;p++)t=(s.words[p]|0)+c,c=t>>26,this.words[p]=t&67108863;if(c===0&&p<s.length&&s!==this)for(;p<s.length;p++)this.words[p]=s.words[p];return this.length=Math.max(this.length,p),s!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(e){return this.clone().isub(e)};function $(g,e,t){t.negative=e.negative^g.negative;var i=g.length+e.length|0;t.length=i,i=i-1|0;var s=g.words[0]|0,l=e.words[0]|0,c=s*l,p=c&67108863,d=c/67108864|0;t.words[0]=p;for(var r=1;r<i;r++){for(var f=d>>>26,m=d&67108863,_=Math.min(r,e.length-1),R=Math.max(0,r-g.length+1);R<=_;R++){var C=r-R|0;s=g.words[C]|0,l=e.words[R]|0,c=s*l+m,f+=c/67108864|0,m=c&67108863}t.words[r]=m|0,d=f|0}return d!==0?t.words[r]=d|0:t.length--,t.strip()}var M=function(e,t,i){var s=e.words,l=t.words,c=i.words,p=0,d,r,f,m=s[0]|0,_=m&8191,R=m>>>13,C=s[1]|0,F=C&8191,z=C>>>13,lt=s[2]|0,G=lt&8191,Z=lt>>>13,mt=s[3]|0,gt=mt&8191,j=mt>>>13,Ct=s[4]|0,wt=Ct&8191,Y=Ct>>>13,U=s[5]|0,I=U&8191,E=U>>>13,P=s[6]|0,H=P&8191,D=P>>>13,ut=s[7]|0,vt=ut&8191,V=ut>>>13,bt=s[8]|0,yt=bt&8191,J=bt>>>13,Lt=s[9]|0,Mt=Lt&8191,Q=Lt>>>13,Ot=l[0]|0,xt=Ot&8191,tt=Ot>>>13,Nt=l[1]|0,_t=Nt&8191,et=Nt>>>13,qt=l[2]|0,St=qt&8191,rt=qt>>>13,Ut=l[3]|0,At=Ut&8191,it=Ut>>>13,Ft=l[4]|0,Et=Ft&8191,nt=Ft>>>13,$t=l[5]|0,kt=$t&8191,at=$t>>>13,zt=l[6]|0,Rt=zt&8191,ft=zt>>>13,Dt=l[7]|0,Bt=Dt&8191,ot=Dt>>>13,Ht=l[8]|0,It=Ht&8191,st=Ht>>>13,Kt=l[9]|0,Tt=Kt&8191,ht=Kt>>>13;i.negative=e.negative^t.negative,i.length=19,d=Math.imul(_,xt),r=Math.imul(_,tt),r=r+Math.imul(R,xt)|0,f=Math.imul(R,tt);var Pt=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,d=Math.imul(F,xt),r=Math.imul(F,tt),r=r+Math.imul(z,xt)|0,f=Math.imul(z,tt),d=d+Math.imul(_,_t)|0,r=r+Math.imul(_,et)|0,r=r+Math.imul(R,_t)|0,f=f+Math.imul(R,et)|0;var Jt=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,d=Math.imul(G,xt),r=Math.imul(G,tt),r=r+Math.imul(Z,xt)|0,f=Math.imul(Z,tt),d=d+Math.imul(F,_t)|0,r=r+Math.imul(F,et)|0,r=r+Math.imul(z,_t)|0,f=f+Math.imul(z,et)|0,d=d+Math.imul(_,St)|0,r=r+Math.imul(_,rt)|0,r=r+Math.imul(R,St)|0,f=f+Math.imul(R,rt)|0;var jt=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(jt>>>26)|0,jt&=67108863,d=Math.imul(gt,xt),r=Math.imul(gt,tt),r=r+Math.imul(j,xt)|0,f=Math.imul(j,tt),d=d+Math.imul(G,_t)|0,r=r+Math.imul(G,et)|0,r=r+Math.imul(Z,_t)|0,f=f+Math.imul(Z,et)|0,d=d+Math.imul(F,St)|0,r=r+Math.imul(F,rt)|0,r=r+Math.imul(z,St)|0,f=f+Math.imul(z,rt)|0,d=d+Math.imul(_,At)|0,r=r+Math.imul(_,it)|0,r=r+Math.imul(R,At)|0,f=f+Math.imul(R,it)|0;var Yt=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,d=Math.imul(wt,xt),r=Math.imul(wt,tt),r=r+Math.imul(Y,xt)|0,f=Math.imul(Y,tt),d=d+Math.imul(gt,_t)|0,r=r+Math.imul(gt,et)|0,r=r+Math.imul(j,_t)|0,f=f+Math.imul(j,et)|0,d=d+Math.imul(G,St)|0,r=r+Math.imul(G,rt)|0,r=r+Math.imul(Z,St)|0,f=f+Math.imul(Z,rt)|0,d=d+Math.imul(F,At)|0,r=r+Math.imul(F,it)|0,r=r+Math.imul(z,At)|0,f=f+Math.imul(z,it)|0,d=d+Math.imul(_,Et)|0,r=r+Math.imul(_,nt)|0,r=r+Math.imul(R,Et)|0,f=f+Math.imul(R,nt)|0;var Xt=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(Xt>>>26)|0,Xt&=67108863,d=Math.imul(I,xt),r=Math.imul(I,tt),r=r+Math.imul(E,xt)|0,f=Math.imul(E,tt),d=d+Math.imul(wt,_t)|0,r=r+Math.imul(wt,et)|0,r=r+Math.imul(Y,_t)|0,f=f+Math.imul(Y,et)|0,d=d+Math.imul(gt,St)|0,r=r+Math.imul(gt,rt)|0,r=r+Math.imul(j,St)|0,f=f+Math.imul(j,rt)|0,d=d+Math.imul(G,At)|0,r=r+Math.imul(G,it)|0,r=r+Math.imul(Z,At)|0,f=f+Math.imul(Z,it)|0,d=d+Math.imul(F,Et)|0,r=r+Math.imul(F,nt)|0,r=r+Math.imul(z,Et)|0,f=f+Math.imul(z,nt)|0,d=d+Math.imul(_,kt)|0,r=r+Math.imul(_,at)|0,r=r+Math.imul(R,kt)|0,f=f+Math.imul(R,at)|0;var Qt=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(Qt>>>26)|0,Qt&=67108863,d=Math.imul(H,xt),r=Math.imul(H,tt),r=r+Math.imul(D,xt)|0,f=Math.imul(D,tt),d=d+Math.imul(I,_t)|0,r=r+Math.imul(I,et)|0,r=r+Math.imul(E,_t)|0,f=f+Math.imul(E,et)|0,d=d+Math.imul(wt,St)|0,r=r+Math.imul(wt,rt)|0,r=r+Math.imul(Y,St)|0,f=f+Math.imul(Y,rt)|0,d=d+Math.imul(gt,At)|0,r=r+Math.imul(gt,it)|0,r=r+Math.imul(j,At)|0,f=f+Math.imul(j,it)|0,d=d+Math.imul(G,Et)|0,r=r+Math.imul(G,nt)|0,r=r+Math.imul(Z,Et)|0,f=f+Math.imul(Z,nt)|0,d=d+Math.imul(F,kt)|0,r=r+Math.imul(F,at)|0,r=r+Math.imul(z,kt)|0,f=f+Math.imul(z,at)|0,d=d+Math.imul(_,Rt)|0,r=r+Math.imul(_,ft)|0,r=r+Math.imul(R,Rt)|0,f=f+Math.imul(R,ft)|0;var te=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(te>>>26)|0,te&=67108863,d=Math.imul(vt,xt),r=Math.imul(vt,tt),r=r+Math.imul(V,xt)|0,f=Math.imul(V,tt),d=d+Math.imul(H,_t)|0,r=r+Math.imul(H,et)|0,r=r+Math.imul(D,_t)|0,f=f+Math.imul(D,et)|0,d=d+Math.imul(I,St)|0,r=r+Math.imul(I,rt)|0,r=r+Math.imul(E,St)|0,f=f+Math.imul(E,rt)|0,d=d+Math.imul(wt,At)|0,r=r+Math.imul(wt,it)|0,r=r+Math.imul(Y,At)|0,f=f+Math.imul(Y,it)|0,d=d+Math.imul(gt,Et)|0,r=r+Math.imul(gt,nt)|0,r=r+Math.imul(j,Et)|0,f=f+Math.imul(j,nt)|0,d=d+Math.imul(G,kt)|0,r=r+Math.imul(G,at)|0,r=r+Math.imul(Z,kt)|0,f=f+Math.imul(Z,at)|0,d=d+Math.imul(F,Rt)|0,r=r+Math.imul(F,ft)|0,r=r+Math.imul(z,Rt)|0,f=f+Math.imul(z,ft)|0,d=d+Math.imul(_,Bt)|0,r=r+Math.imul(_,ot)|0,r=r+Math.imul(R,Bt)|0,f=f+Math.imul(R,ot)|0;var ee=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(ee>>>26)|0,ee&=67108863,d=Math.imul(yt,xt),r=Math.imul(yt,tt),r=r+Math.imul(J,xt)|0,f=Math.imul(J,tt),d=d+Math.imul(vt,_t)|0,r=r+Math.imul(vt,et)|0,r=r+Math.imul(V,_t)|0,f=f+Math.imul(V,et)|0,d=d+Math.imul(H,St)|0,r=r+Math.imul(H,rt)|0,r=r+Math.imul(D,St)|0,f=f+Math.imul(D,rt)|0,d=d+Math.imul(I,At)|0,r=r+Math.imul(I,it)|0,r=r+Math.imul(E,At)|0,f=f+Math.imul(E,it)|0,d=d+Math.imul(wt,Et)|0,r=r+Math.imul(wt,nt)|0,r=r+Math.imul(Y,Et)|0,f=f+Math.imul(Y,nt)|0,d=d+Math.imul(gt,kt)|0,r=r+Math.imul(gt,at)|0,r=r+Math.imul(j,kt)|0,f=f+Math.imul(j,at)|0,d=d+Math.imul(G,Rt)|0,r=r+Math.imul(G,ft)|0,r=r+Math.imul(Z,Rt)|0,f=f+Math.imul(Z,ft)|0,d=d+Math.imul(F,Bt)|0,r=r+Math.imul(F,ot)|0,r=r+Math.imul(z,Bt)|0,f=f+Math.imul(z,ot)|0,d=d+Math.imul(_,It)|0,r=r+Math.imul(_,st)|0,r=r+Math.imul(R,It)|0,f=f+Math.imul(R,st)|0;var re=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(re>>>26)|0,re&=67108863,d=Math.imul(Mt,xt),r=Math.imul(Mt,tt),r=r+Math.imul(Q,xt)|0,f=Math.imul(Q,tt),d=d+Math.imul(yt,_t)|0,r=r+Math.imul(yt,et)|0,r=r+Math.imul(J,_t)|0,f=f+Math.imul(J,et)|0,d=d+Math.imul(vt,St)|0,r=r+Math.imul(vt,rt)|0,r=r+Math.imul(V,St)|0,f=f+Math.imul(V,rt)|0,d=d+Math.imul(H,At)|0,r=r+Math.imul(H,it)|0,r=r+Math.imul(D,At)|0,f=f+Math.imul(D,it)|0,d=d+Math.imul(I,Et)|0,r=r+Math.imul(I,nt)|0,r=r+Math.imul(E,Et)|0,f=f+Math.imul(E,nt)|0,d=d+Math.imul(wt,kt)|0,r=r+Math.imul(wt,at)|0,r=r+Math.imul(Y,kt)|0,f=f+Math.imul(Y,at)|0,d=d+Math.imul(gt,Rt)|0,r=r+Math.imul(gt,ft)|0,r=r+Math.imul(j,Rt)|0,f=f+Math.imul(j,ft)|0,d=d+Math.imul(G,Bt)|0,r=r+Math.imul(G,ot)|0,r=r+Math.imul(Z,Bt)|0,f=f+Math.imul(Z,ot)|0,d=d+Math.imul(F,It)|0,r=r+Math.imul(F,st)|0,r=r+Math.imul(z,It)|0,f=f+Math.imul(z,st)|0,d=d+Math.imul(_,Tt)|0,r=r+Math.imul(_,ht)|0,r=r+Math.imul(R,Tt)|0,f=f+Math.imul(R,ht)|0;var ie=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(ie>>>26)|0,ie&=67108863,d=Math.imul(Mt,_t),r=Math.imul(Mt,et),r=r+Math.imul(Q,_t)|0,f=Math.imul(Q,et),d=d+Math.imul(yt,St)|0,r=r+Math.imul(yt,rt)|0,r=r+Math.imul(J,St)|0,f=f+Math.imul(J,rt)|0,d=d+Math.imul(vt,At)|0,r=r+Math.imul(vt,it)|0,r=r+Math.imul(V,At)|0,f=f+Math.imul(V,it)|0,d=d+Math.imul(H,Et)|0,r=r+Math.imul(H,nt)|0,r=r+Math.imul(D,Et)|0,f=f+Math.imul(D,nt)|0,d=d+Math.imul(I,kt)|0,r=r+Math.imul(I,at)|0,r=r+Math.imul(E,kt)|0,f=f+Math.imul(E,at)|0,d=d+Math.imul(wt,Rt)|0,r=r+Math.imul(wt,ft)|0,r=r+Math.imul(Y,Rt)|0,f=f+Math.imul(Y,ft)|0,d=d+Math.imul(gt,Bt)|0,r=r+Math.imul(gt,ot)|0,r=r+Math.imul(j,Bt)|0,f=f+Math.imul(j,ot)|0,d=d+Math.imul(G,It)|0,r=r+Math.imul(G,st)|0,r=r+Math.imul(Z,It)|0,f=f+Math.imul(Z,st)|0,d=d+Math.imul(F,Tt)|0,r=r+Math.imul(F,ht)|0,r=r+Math.imul(z,Tt)|0,f=f+Math.imul(z,ht)|0;var ne=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(ne>>>26)|0,ne&=67108863,d=Math.imul(Mt,St),r=Math.imul(Mt,rt),r=r+Math.imul(Q,St)|0,f=Math.imul(Q,rt),d=d+Math.imul(yt,At)|0,r=r+Math.imul(yt,it)|0,r=r+Math.imul(J,At)|0,f=f+Math.imul(J,it)|0,d=d+Math.imul(vt,Et)|0,r=r+Math.imul(vt,nt)|0,r=r+Math.imul(V,Et)|0,f=f+Math.imul(V,nt)|0,d=d+Math.imul(H,kt)|0,r=r+Math.imul(H,at)|0,r=r+Math.imul(D,kt)|0,f=f+Math.imul(D,at)|0,d=d+Math.imul(I,Rt)|0,r=r+Math.imul(I,ft)|0,r=r+Math.imul(E,Rt)|0,f=f+Math.imul(E,ft)|0,d=d+Math.imul(wt,Bt)|0,r=r+Math.imul(wt,ot)|0,r=r+Math.imul(Y,Bt)|0,f=f+Math.imul(Y,ot)|0,d=d+Math.imul(gt,It)|0,r=r+Math.imul(gt,st)|0,r=r+Math.imul(j,It)|0,f=f+Math.imul(j,st)|0,d=d+Math.imul(G,Tt)|0,r=r+Math.imul(G,ht)|0,r=r+Math.imul(Z,Tt)|0,f=f+Math.imul(Z,ht)|0;var ae=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(ae>>>26)|0,ae&=67108863,d=Math.imul(Mt,At),r=Math.imul(Mt,it),r=r+Math.imul(Q,At)|0,f=Math.imul(Q,it),d=d+Math.imul(yt,Et)|0,r=r+Math.imul(yt,nt)|0,r=r+Math.imul(J,Et)|0,f=f+Math.imul(J,nt)|0,d=d+Math.imul(vt,kt)|0,r=r+Math.imul(vt,at)|0,r=r+Math.imul(V,kt)|0,f=f+Math.imul(V,at)|0,d=d+Math.imul(H,Rt)|0,r=r+Math.imul(H,ft)|0,r=r+Math.imul(D,Rt)|0,f=f+Math.imul(D,ft)|0,d=d+Math.imul(I,Bt)|0,r=r+Math.imul(I,ot)|0,r=r+Math.imul(E,Bt)|0,f=f+Math.imul(E,ot)|0,d=d+Math.imul(wt,It)|0,r=r+Math.imul(wt,st)|0,r=r+Math.imul(Y,It)|0,f=f+Math.imul(Y,st)|0,d=d+Math.imul(gt,Tt)|0,r=r+Math.imul(gt,ht)|0,r=r+Math.imul(j,Tt)|0,f=f+Math.imul(j,ht)|0;var fe=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(fe>>>26)|0,fe&=67108863,d=Math.imul(Mt,Et),r=Math.imul(Mt,nt),r=r+Math.imul(Q,Et)|0,f=Math.imul(Q,nt),d=d+Math.imul(yt,kt)|0,r=r+Math.imul(yt,at)|0,r=r+Math.imul(J,kt)|0,f=f+Math.imul(J,at)|0,d=d+Math.imul(vt,Rt)|0,r=r+Math.imul(vt,ft)|0,r=r+Math.imul(V,Rt)|0,f=f+Math.imul(V,ft)|0,d=d+Math.imul(H,Bt)|0,r=r+Math.imul(H,ot)|0,r=r+Math.imul(D,Bt)|0,f=f+Math.imul(D,ot)|0,d=d+Math.imul(I,It)|0,r=r+Math.imul(I,st)|0,r=r+Math.imul(E,It)|0,f=f+Math.imul(E,st)|0,d=d+Math.imul(wt,Tt)|0,r=r+Math.imul(wt,ht)|0,r=r+Math.imul(Y,Tt)|0,f=f+Math.imul(Y,ht)|0;var oe=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(oe>>>26)|0,oe&=67108863,d=Math.imul(Mt,kt),r=Math.imul(Mt,at),r=r+Math.imul(Q,kt)|0,f=Math.imul(Q,at),d=d+Math.imul(yt,Rt)|0,r=r+Math.imul(yt,ft)|0,r=r+Math.imul(J,Rt)|0,f=f+Math.imul(J,ft)|0,d=d+Math.imul(vt,Bt)|0,r=r+Math.imul(vt,ot)|0,r=r+Math.imul(V,Bt)|0,f=f+Math.imul(V,ot)|0,d=d+Math.imul(H,It)|0,r=r+Math.imul(H,st)|0,r=r+Math.imul(D,It)|0,f=f+Math.imul(D,st)|0,d=d+Math.imul(I,Tt)|0,r=r+Math.imul(I,ht)|0,r=r+Math.imul(E,Tt)|0,f=f+Math.imul(E,ht)|0;var se=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(se>>>26)|0,se&=67108863,d=Math.imul(Mt,Rt),r=Math.imul(Mt,ft),r=r+Math.imul(Q,Rt)|0,f=Math.imul(Q,ft),d=d+Math.imul(yt,Bt)|0,r=r+Math.imul(yt,ot)|0,r=r+Math.imul(J,Bt)|0,f=f+Math.imul(J,ot)|0,d=d+Math.imul(vt,It)|0,r=r+Math.imul(vt,st)|0,r=r+Math.imul(V,It)|0,f=f+Math.imul(V,st)|0,d=d+Math.imul(H,Tt)|0,r=r+Math.imul(H,ht)|0,r=r+Math.imul(D,Tt)|0,f=f+Math.imul(D,ht)|0;var he=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(he>>>26)|0,he&=67108863,d=Math.imul(Mt,Bt),r=Math.imul(Mt,ot),r=r+Math.imul(Q,Bt)|0,f=Math.imul(Q,ot),d=d+Math.imul(yt,It)|0,r=r+Math.imul(yt,st)|0,r=r+Math.imul(J,It)|0,f=f+Math.imul(J,st)|0,d=d+Math.imul(vt,Tt)|0,r=r+Math.imul(vt,ht)|0,r=r+Math.imul(V,Tt)|0,f=f+Math.imul(V,ht)|0;var ue=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(ue>>>26)|0,ue&=67108863,d=Math.imul(Mt,It),r=Math.imul(Mt,st),r=r+Math.imul(Q,It)|0,f=Math.imul(Q,st),d=d+Math.imul(yt,Tt)|0,r=r+Math.imul(yt,ht)|0,r=r+Math.imul(J,Tt)|0,f=f+Math.imul(J,ht)|0;var le=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(le>>>26)|0,le&=67108863,d=Math.imul(Mt,Tt),r=Math.imul(Mt,ht),r=r+Math.imul(Q,Tt)|0,f=Math.imul(Q,ht);var ce=(p+d|0)+((r&8191)<<13)|0;return p=(f+(r>>>13)|0)+(ce>>>26)|0,ce&=67108863,c[0]=Pt,c[1]=Jt,c[2]=jt,c[3]=Yt,c[4]=Xt,c[5]=Qt,c[6]=te,c[7]=ee,c[8]=re,c[9]=ie,c[10]=ne,c[11]=ae,c[12]=fe,c[13]=oe,c[14]=se,c[15]=he,c[16]=ue,c[17]=le,c[18]=ce,p!==0&&(c[19]=p,i.length++),i};Math.imul||(M=$);function N(g,e,t){t.negative=e.negative^g.negative,t.length=g.length+e.length;for(var i=0,s=0,l=0;l<t.length-1;l++){var c=s;s=0;for(var p=i&67108863,d=Math.min(l,e.length-1),r=Math.max(0,l-g.length+1);r<=d;r++){var f=l-r,m=g.words[f]|0,_=e.words[r]|0,R=m*_,C=R&67108863;c=c+(R/67108864|0)|0,C=C+p|0,p=C&67108863,c=c+(C>>>26)|0,s+=c>>>26,c&=67108863}t.words[l]=p,i=c,c=s}return i!==0?t.words[l]=i:t.length--,t.strip()}function x(g,e,t){var i=new A;return i.mulp(g,e,t)}o.prototype.mulTo=function(e,t){var i,s=this.length+e.length;return this.length===10&&e.length===10?i=M(this,e,t):s<63?i=$(this,e,t):s<1024?i=N(this,e,t):i=x(this,e,t),i};function A(g,e){this.x=g,this.y=e}A.prototype.makeRBT=function(e){for(var t=new Array(e),i=o.prototype._countBits(e)-1,s=0;s<e;s++)t[s]=this.revBin(s,i,e);return t},A.prototype.revBin=function(e,t,i){if(e===0||e===i-1)return e;for(var s=0,l=0;l<t;l++)s|=(e&1)<<t-l-1,e>>=1;return s},A.prototype.permute=function(e,t,i,s,l,c){for(var p=0;p<c;p++)s[p]=t[e[p]],l[p]=i[e[p]]},A.prototype.transform=function(e,t,i,s,l,c){this.permute(c,e,t,i,s,l);for(var p=1;p<l;p<<=1)for(var d=p<<1,r=Math.cos(2*Math.PI/d),f=Math.sin(2*Math.PI/d),m=0;m<l;m+=d)for(var _=r,R=f,C=0;C<p;C++){var F=i[m+C],z=s[m+C],lt=i[m+C+p],G=s[m+C+p],Z=_*lt-R*G;G=_*G+R*lt,lt=Z,i[m+C]=F+lt,s[m+C]=z+G,i[m+C+p]=F-lt,s[m+C+p]=z-G,C!==d&&(Z=r*_-f*R,R=r*R+f*_,_=Z)}},A.prototype.guessLen13b=function(e,t){var i=Math.max(t,e)|1,s=i&1,l=0;for(i=i/2|0;i;i=i>>>1)l++;return 1<<l+1+s},A.prototype.conjugate=function(e,t,i){if(!(i<=1))for(var s=0;s<i/2;s++){var l=e[s];e[s]=e[i-s-1],e[i-s-1]=l,l=t[s],t[s]=-t[i-s-1],t[i-s-1]=-l}},A.prototype.normalize13b=function(e,t){for(var i=0,s=0;s<t/2;s++){var l=Math.round(e[2*s+1]/t)*8192+Math.round(e[2*s]/t)+i;e[s]=l&67108863,l<67108864?i=0:i=l/67108864|0}return e},A.prototype.convert13b=function(e,t,i,s){for(var l=0,c=0;c<t;c++)l=l+(e[c]|0),i[2*c]=l&8191,l=l>>>13,i[2*c+1]=l&8191,l=l>>>13;for(c=2*t;c<s;++c)i[c]=0;u(l===0),u((l&-8192)===0)},A.prototype.stub=function(e){for(var t=new Array(e),i=0;i<e;i++)t[i]=0;return t},A.prototype.mulp=function(e,t,i){var s=2*this.guessLen13b(e.length,t.length),l=this.makeRBT(s),c=this.stub(s),p=new Array(s),d=new Array(s),r=new Array(s),f=new Array(s),m=new Array(s),_=new Array(s),R=i.words;R.length=s,this.convert13b(e.words,e.length,p,s),this.convert13b(t.words,t.length,f,s),this.transform(p,c,d,r,s,l),this.transform(f,c,m,_,s,l);for(var C=0;C<s;C++){var F=d[C]*m[C]-r[C]*_[C];r[C]=d[C]*_[C]+r[C]*m[C],d[C]=F}return this.conjugate(d,r,s),this.transform(d,r,R,c,s,l),this.conjugate(R,c,s),this.normalize13b(R,s),i.negative=e.negative^t.negative,i.length=e.length+t.length,i.strip()},o.prototype.mul=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},o.prototype.mulf=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),x(this,e,t)},o.prototype.imul=function(e){return this.clone().mulTo(e,this)},o.prototype.imuln=function(e){u(typeof e=="number"),u(e<67108864);for(var t=0,i=0;i<this.length;i++){var s=(this.words[i]|0)*e,l=(s&67108863)+(t&67108863);t>>=26,t+=s/67108864|0,t+=l>>>26,this.words[i]=l&67108863}return t!==0&&(this.words[i]=t,this.length++),this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=q(e);if(t.length===0)return new o(1);for(var i=this,s=0;s<t.length&&t[s]===0;s++,i=i.sqr());if(++s<t.length)for(var l=i.sqr();s<t.length;s++,l=l.sqr())t[s]!==0&&(i=i.mul(l));return i},o.prototype.iushln=function(e){u(typeof e=="number"&&e>=0);var t=e%26,i=(e-t)/26,s=67108863>>>26-t<<26-t,l;if(t!==0){var c=0;for(l=0;l<this.length;l++){var p=this.words[l]&s,d=(this.words[l]|0)-p<<t;this.words[l]=d|c,c=p>>>26-t}c&&(this.words[l]=c,this.length++)}if(i!==0){for(l=this.length-1;l>=0;l--)this.words[l+i]=this.words[l];for(l=0;l<i;l++)this.words[l]=0;this.length+=i}return this.strip()},o.prototype.ishln=function(e){return u(this.negative===0),this.iushln(e)},o.prototype.iushrn=function(e,t,i){u(typeof e=="number"&&e>=0);var s;t?s=(t-t%26)/26:s=0;var l=e%26,c=Math.min((e-l)/26,this.length),p=67108863^67108863>>>l<<l,d=i;if(s-=c,s=Math.max(0,s),d){for(var r=0;r<c;r++)d.words[r]=this.words[r];d.length=c}if(c!==0)if(this.length>c)for(this.length-=c,r=0;r<this.length;r++)this.words[r]=this.words[r+c];else this.words[0]=0,this.length=1;var f=0;for(r=this.length-1;r>=0&&(f!==0||r>=s);r--){var m=this.words[r]|0;this.words[r]=f<<26-l|m>>>l,f=m&p}return d&&f!==0&&(d.words[d.length++]=f),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(e,t,i){return u(this.negative===0),this.iushrn(e,t,i)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){u(typeof e=="number"&&e>=0);var t=e%26,i=(e-t)/26,s=1<<t;if(this.length<=i)return!1;var l=this.words[i];return!!(l&s)},o.prototype.imaskn=function(e){u(typeof e=="number"&&e>=0);var t=e%26,i=(e-t)/26;if(u(this.negative===0,"imaskn works only with positive numbers"),this.length<=i)return this;if(t!==0&&i++,this.length=Math.min(i,this.length),t!==0){var s=67108863^67108863>>>t<<t;this.words[this.length-1]&=s}return this.strip()},o.prototype.maskn=function(e){return this.clone().imaskn(e)},o.prototype.iaddn=function(e){return u(typeof e=="number"),u(e<67108864),e<0?this.isubn(-e):this.negative!==0?this.length===1&&(this.words[0]|0)<e?(this.words[0]=e-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},o.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(u(typeof e=="number"),u(e<67108864),e<0)return this.iaddn(-e);if(this.negative!==0)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.strip()},o.prototype.addn=function(e){return this.clone().iaddn(e)},o.prototype.subn=function(e){return this.clone().isubn(e)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(e,t,i){var s=e.length+i,l;this._expand(s);var c,p=0;for(l=0;l<e.length;l++){c=(this.words[l+i]|0)+p;var d=(e.words[l]|0)*t;c-=d&67108863,p=(c>>26)-(d/67108864|0),this.words[l+i]=c&67108863}for(;l<this.length-i;l++)c=(this.words[l+i]|0)+p,p=c>>26,this.words[l+i]=c&67108863;if(p===0)return this.strip();for(u(p===-1),p=0,l=0;l<this.length;l++)c=-(this.words[l]|0)+p,p=c>>26,this.words[l]=c&67108863;return this.negative=1,this.strip()},o.prototype._wordDiv=function(e,t){var i=this.length-e.length,s=this.clone(),l=e,c=l.words[l.length-1]|0,p=this._countBits(c);i=26-p,i!==0&&(l=l.ushln(i),s.iushln(i),c=l.words[l.length-1]|0);var d=s.length-l.length,r;if(t!=="mod"){r=new o(null),r.length=d+1,r.words=new Array(r.length);for(var f=0;f<r.length;f++)r.words[f]=0}var m=s.clone()._ishlnsubmul(l,1,d);m.negative===0&&(s=m,r&&(r.words[d]=1));for(var _=d-1;_>=0;_--){var R=(s.words[l.length+_]|0)*67108864+(s.words[l.length+_-1]|0);for(R=Math.min(R/c|0,67108863),s._ishlnsubmul(l,R,_);s.negative!==0;)R--,s.negative=0,s._ishlnsubmul(l,1,_),s.isZero()||(s.negative^=1);r&&(r.words[_]=R)}return r&&r.strip(),s.strip(),t!=="div"&&i!==0&&s.iushrn(i),{div:r||null,mod:s}},o.prototype.divmod=function(e,t,i){if(u(!e.isZero()),this.isZero())return{div:new o(0),mod:new o(0)};var s,l,c;return this.negative!==0&&e.negative===0?(c=this.neg().divmod(e,t),t!=="mod"&&(s=c.div.neg()),t!=="div"&&(l=c.mod.neg(),i&&l.negative!==0&&l.iadd(e)),{div:s,mod:l}):this.negative===0&&e.negative!==0?(c=this.divmod(e.neg(),t),t!=="mod"&&(s=c.div.neg()),{div:s,mod:c.mod}):this.negative&e.negative?(c=this.neg().divmod(e.neg(),t),t!=="div"&&(l=c.mod.neg(),i&&l.negative!==0&&l.isub(e)),{div:c.div,mod:l}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:e.length===1?t==="div"?{div:this.divn(e.words[0]),mod:null}:t==="mod"?{div:null,mod:new o(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modn(e.words[0]))}:this._wordDiv(e,t)},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var i=t.div.negative!==0?t.mod.isub(e):t.mod,s=e.ushrn(1),l=e.andln(1),c=i.cmp(s);return c<0||l===1&&c===0?t.div:t.div.negative!==0?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modn=function(e){u(e<=67108863);for(var t=(1<<26)%e,i=0,s=this.length-1;s>=0;s--)i=(t*i+(this.words[s]|0))%e;return i},o.prototype.idivn=function(e){u(e<=67108863);for(var t=0,i=this.length-1;i>=0;i--){var s=(this.words[i]|0)+t*67108864;this.words[i]=s/e|0,t=s%e}return this.strip()},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){u(e.negative===0),u(!e.isZero());var t=this,i=e.clone();t.negative!==0?t=t.umod(e):t=t.clone();for(var s=new o(1),l=new o(0),c=new o(0),p=new o(1),d=0;t.isEven()&&i.isEven();)t.iushrn(1),i.iushrn(1),++d;for(var r=i.clone(),f=t.clone();!t.isZero();){for(var m=0,_=1;!(t.words[0]&_)&&m<26;++m,_<<=1);if(m>0)for(t.iushrn(m);m-- >0;)(s.isOdd()||l.isOdd())&&(s.iadd(r),l.isub(f)),s.iushrn(1),l.iushrn(1);for(var R=0,C=1;!(i.words[0]&C)&&R<26;++R,C<<=1);if(R>0)for(i.iushrn(R);R-- >0;)(c.isOdd()||p.isOdd())&&(c.iadd(r),p.isub(f)),c.iushrn(1),p.iushrn(1);t.cmp(i)>=0?(t.isub(i),s.isub(c),l.isub(p)):(i.isub(t),c.isub(s),p.isub(l))}return{a:c,b:p,gcd:i.iushln(d)}},o.prototype._invmp=function(e){u(e.negative===0),u(!e.isZero());var t=this,i=e.clone();t.negative!==0?t=t.umod(e):t=t.clone();for(var s=new o(1),l=new o(0),c=i.clone();t.cmpn(1)>0&&i.cmpn(1)>0;){for(var p=0,d=1;!(t.words[0]&d)&&p<26;++p,d<<=1);if(p>0)for(t.iushrn(p);p-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);for(var r=0,f=1;!(i.words[0]&f)&&r<26;++r,f<<=1);if(r>0)for(i.iushrn(r);r-- >0;)l.isOdd()&&l.iadd(c),l.iushrn(1);t.cmp(i)>=0?(t.isub(i),s.isub(l)):(i.isub(t),l.isub(s))}var m;return t.cmpn(1)===0?m=s:m=l,m.cmpn(0)<0&&m.iadd(e),m},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),i=e.clone();t.negative=0,i.negative=0;for(var s=0;t.isEven()&&i.isEven();s++)t.iushrn(1),i.iushrn(1);do{for(;t.isEven();)t.iushrn(1);for(;i.isEven();)i.iushrn(1);var l=t.cmp(i);if(l<0){var c=t;t=i,i=c}else if(l===0||i.cmpn(1)===0)break;t.isub(i)}while(!0);return i.iushln(s)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return(this.words[0]&1)===0},o.prototype.isOdd=function(){return(this.words[0]&1)===1},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){u(typeof e=="number");var t=e%26,i=(e-t)/26,s=1<<t;if(this.length<=i)return this._expand(i+1),this.words[i]|=s,this;for(var l=s,c=i;l!==0&&c<this.length;c++){var p=this.words[c]|0;p+=l,l=p>>>26,p&=67108863,this.words[c]=p}return l!==0&&(this.words[c]=l,this.length++),this},o.prototype.isZero=function(){return this.length===1&&this.words[0]===0},o.prototype.cmpn=function(e){var t=e<0;if(this.negative!==0&&!t)return-1;if(this.negative===0&&t)return 1;this.strip();var i;if(this.length>1)i=1;else{t&&(e=-e),u(e<=67108863,"Number is too big");var s=this.words[0]|0;i=s===e?0:s<e?-1:1}return this.negative!==0?-i|0:i},o.prototype.cmp=function(e){if(this.negative!==0&&e.negative===0)return-1;if(this.negative===0&&e.negative!==0)return 1;var t=this.ucmp(e);return this.negative!==0?-t|0:t},o.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,i=this.length-1;i>=0;i--){var s=this.words[i]|0,l=e.words[i]|0;if(s!==l){s<l?t=-1:s>l&&(t=1);break}}return t},o.prototype.gtn=function(e){return this.cmpn(e)===1},o.prototype.gt=function(e){return this.cmp(e)===1},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return this.cmpn(e)===-1},o.prototype.lt=function(e){return this.cmp(e)===-1},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return this.cmpn(e)===0},o.prototype.eq=function(e){return this.cmp(e)===0},o.red=function(e){return new ct(e)},o.prototype.toRed=function(e){return u(!this.red,"Already a number in reduction context"),u(this.negative===0,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return u(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return u(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return u(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return u(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return u(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return u(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return u(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return u(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return u(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return u(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return u(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return u(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return u(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return u(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return u(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var S={k256:null,p224:null,p192:null,p25519:null};function T(g,e){this.name=g,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}T.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},T.prototype.ireduce=function(e){var t=e,i;do this.split(t,this.tmp),t=this.imulK(t),t=t.iadd(this.tmp),i=t.bitLength();while(i>this.n);var s=i<this.n?-1:t.ucmp(this.p);return s===0?(t.words[0]=0,t.length=1):s>0?t.isub(this.p):t.strip(),t},T.prototype.split=function(e,t){e.iushrn(this.n,0,t)},T.prototype.imulK=function(e){return e.imul(this.k)};function O(){T.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}v(O,T),O.prototype.split=function(e,t){for(var i=4194303,s=Math.min(e.length,9),l=0;l<s;l++)t.words[l]=e.words[l];if(t.length=s,e.length<=9){e.words[0]=0,e.length=1;return}var c=e.words[9];for(t.words[t.length++]=c&i,l=10;l<e.length;l++){var p=e.words[l]|0;e.words[l-10]=(p&i)<<4|c>>>22,c=p}c>>>=22,e.words[l-10]=c,c===0&&e.length>10?e.length-=10:e.length-=9},O.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,i=0;i<e.length;i++){var s=e.words[i]|0;t+=s*977,e.words[i]=t&67108863,t=s*64+(t/67108864|0)}return e.words[e.length-1]===0&&(e.length--,e.words[e.length-1]===0&&e.length--),e};function W(){T.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}v(W,T);function K(){T.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}v(K,T);function pt(){T.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}v(pt,T),pt.prototype.imulK=function(e){for(var t=0,i=0;i<e.length;i++){var s=(e.words[i]|0)*19+t,l=s&67108863;s>>>=26,e.words[i]=l,t=s}return t!==0&&(e.words[e.length++]=t),e},o._prime=function(e){if(S[e])return S[e];var t;if(e==="k256")t=new O;else if(e==="p224")t=new W;else if(e==="p192")t=new K;else if(e==="p25519")t=new pt;else throw new Error("Unknown prime "+e);return S[e]=t,t};function ct(g){if(typeof g=="string"){var e=o._prime(g);this.m=e.p,this.prime=e}else u(g.gtn(1),"modulus must be greater than 1"),this.m=g,this.prime=null}ct.prototype._verify1=function(e){u(e.negative===0,"red works only with positives"),u(e.red,"red works only with red numbers")},ct.prototype._verify2=function(e,t){u((e.negative|t.negative)===0,"red works only with positives"),u(e.red&&e.red===t.red,"red works only with red numbers")},ct.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},ct.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},ct.prototype.add=function(e,t){this._verify2(e,t);var i=e.add(t);return i.cmp(this.m)>=0&&i.isub(this.m),i._forceRed(this)},ct.prototype.iadd=function(e,t){this._verify2(e,t);var i=e.iadd(t);return i.cmp(this.m)>=0&&i.isub(this.m),i},ct.prototype.sub=function(e,t){this._verify2(e,t);var i=e.sub(t);return i.cmpn(0)<0&&i.iadd(this.m),i._forceRed(this)},ct.prototype.isub=function(e,t){this._verify2(e,t);var i=e.isub(t);return i.cmpn(0)<0&&i.iadd(this.m),i},ct.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},ct.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},ct.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},ct.prototype.isqr=function(e){return this.imul(e,e.clone())},ct.prototype.sqr=function(e){return this.mul(e,e)},ct.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(u(t%2===1),t===3){var i=this.m.add(new o(1)).iushrn(2);return this.pow(e,i)}for(var s=this.m.subn(1),l=0;!s.isZero()&&s.andln(1)===0;)l++,s.iushrn(1);u(!s.isZero());var c=new o(1).toRed(this),p=c.redNeg(),d=this.m.subn(1).iushrn(1),r=this.m.bitLength();for(r=new o(2*r*r).toRed(this);this.pow(r,d).cmp(p)!==0;)r.redIAdd(p);for(var f=this.pow(r,s),m=this.pow(e,s.addn(1).iushrn(1)),_=this.pow(e,s),R=l;_.cmp(c)!==0;){for(var C=_,F=0;C.cmp(c)!==0;F++)C=C.redSqr();u(F<R);var z=this.pow(f,new o(1).iushln(R-F-1));m=m.redMul(z),f=z.redSqr(),_=_.redMul(f),R=F}return m},ct.prototype.invm=function(e){var t=e._invmp(this.m);return t.negative!==0?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},ct.prototype.pow=function(e,t){if(t.isZero())return new o(1).toRed(this);if(t.cmpn(1)===0)return e.clone();var i=4,s=new Array(1<<i);s[0]=new o(1).toRed(this),s[1]=e;for(var l=2;l<s.length;l++)s[l]=this.mul(s[l-1],e);var c=s[0],p=0,d=0,r=t.bitLength()%26;for(r===0&&(r=26),l=t.length-1;l>=0;l--){for(var f=t.words[l],m=r-1;m>=0;m--){var _=f>>m&1;if(c!==s[0]&&(c=this.sqr(c)),_===0&&p===0){d=0;continue}p<<=1,p|=_,d++,!(d!==i&&(l!==0||m!==0))&&(c=this.mul(c,s[p]),d=0,p=0)}r=26}return c},ct.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},ct.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new dt(e)};function dt(g){ct.call(this,g),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v(dt,ct),dt.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},dt.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},dt.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var i=e.imul(t),s=i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),l=i.isub(s).iushrn(this.shift),c=l;return l.cmp(this.m)>=0?c=l.isub(this.m):l.cmpn(0)<0&&(c=l.iadd(this.m)),c._forceRed(this)},dt.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var i=e.mul(t),s=i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),l=i.isub(s).iushrn(this.shift),c=l;return l.cmp(this.m)>=0?c=l.isub(this.m):l.cmpn(0)<0&&(c=l.iadd(this.m)),c._forceRed(this)},dt.prototype.invm=function(e){var t=this.imod(e._invmp(this.m).mul(this.r2));return t._forceRed(this)}})(a,Vt)})(c0);c0.exports;var e3={};(function(a){const n=Ki,h=Zi,u=Hi,v=x=>x==null;function o(x){switch(x.arrayFormat){case"index":return A=>(S,T)=>{const O=S.length;return T===void 0||x.skipNull&&T===null||x.skipEmptyString&&T===""?S:T===null?[...S,[b(A,x),"[",O,"]"].join("")]:[...S,[b(A,x),"[",b(O,x),"]=",b(T,x)].join("")]};case"bracket":return A=>(S,T)=>T===void 0||x.skipNull&&T===null||x.skipEmptyString&&T===""?S:T===null?[...S,[b(A,x),"[]"].join("")]:[...S,[b(A,x),"[]=",b(T,x)].join("")];case"comma":case"separator":return A=>(S,T)=>T==null||T.length===0?S:S.length===0?[[b(A,x),"=",b(T,x)].join("")]:[[S,b(T,x)].join(x.arrayFormatSeparator)];default:return A=>(S,T)=>T===void 0||x.skipNull&&T===null||x.skipEmptyString&&T===""?S:T===null?[...S,b(A,x)]:[...S,[b(A,x),"=",b(T,x)].join("")]}}function w(x){let A;switch(x.arrayFormat){case"index":return(S,T,O)=>{if(A=/\[(\d*)\]$/.exec(S),S=S.replace(/\[\d*\]$/,""),!A){O[S]=T;return}O[S]===void 0&&(O[S]={}),O[S][A[1]]=T};case"bracket":return(S,T,O)=>{if(A=/(\[\])$/.exec(S),S=S.replace(/\[\]$/,""),!A){O[S]=T;return}if(O[S]===void 0){O[S]=[T];return}O[S]=[].concat(O[S],T)};case"comma":case"separator":return(S,T,O)=>{const K=typeof T=="string"&&T.split("").indexOf(x.arrayFormatSeparator)>-1?T.split(x.arrayFormatSeparator).map(pt=>B(pt,x)):T===null?T:B(T,x);O[S]=K};default:return(S,T,O)=>{if(O[S]===void 0){O[S]=T;return}O[S]=[].concat(O[S],T)}}}function y(x){if(typeof x!="string"||x.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function b(x,A){return A.encode?A.strict?n(x):encodeURIComponent(x):x}function B(x,A){return A.decode?h(x):x}function k(x){return Array.isArray(x)?x.sort():typeof x=="object"?k(Object.keys(x)).sort((A,S)=>Number(A)-Number(S)).map(A=>x[A]):x}function L(x){const A=x.indexOf("#");return A!==-1&&(x=x.slice(0,A)),x}function q(x){let A="";const S=x.indexOf("#");return S!==-1&&(A=x.slice(S)),A}function $(x){x=L(x);const A=x.indexOf("?");return A===-1?"":x.slice(A+1)}function M(x,A){return A.parseNumbers&&!Number.isNaN(Number(x))&&typeof x=="string"&&x.trim()!==""?x=Number(x):A.parseBooleans&&x!==null&&(x.toLowerCase()==="true"||x.toLowerCase()==="false")&&(x=x.toLowerCase()==="true"),x}function N(x,A){A=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},A),y(A.arrayFormatSeparator);const S=w(A),T=Object.create(null);if(typeof x!="string"||(x=x.trim().replace(/^[?#&]/,""),!x))return T;for(const O of x.split("&")){let[W,K]=u(A.decode?O.replace(/\+/g," "):O,"=");K=K===void 0?null:["comma","separator"].includes(A.arrayFormat)?K:B(K,A),S(B(W,A),K,T)}for(const O of Object.keys(T)){const W=T[O];if(typeof W=="object"&&W!==null)for(const K of Object.keys(W))W[K]=M(W[K],A);else T[O]=M(W,A)}return A.sort===!1?T:(A.sort===!0?Object.keys(T).sort():Object.keys(T).sort(A.sort)).reduce((O,W)=>{const K=T[W];return K&&typeof K=="object"&&!Array.isArray(K)?O[W]=k(K):O[W]=K,O},Object.create(null))}a.extract=$,a.parse=N,a.stringify=(x,A)=>{if(!x)return"";A=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},A),y(A.arrayFormatSeparator);const S=K=>A.skipNull&&v(x[K])||A.skipEmptyString&&x[K]==="",T=o(A),O={};for(const K of Object.keys(x))S(K)||(O[K]=x[K]);const W=Object.keys(O);return A.sort!==!1&&W.sort(A.sort),W.map(K=>{const pt=x[K];return pt===void 0?"":pt===null?b(K,A):Array.isArray(pt)?pt.reduce(T(K),[]).join("&"):b(K,A)+"="+b(pt,A)}).filter(K=>K.length>0).join("&")},a.parseUrl=(x,A)=>{A=Object.assign({decode:!0},A);const[S,T]=u(x,"#");return Object.assign({url:S.split("?")[0]||"",query:N($(x),A)},A&&A.parseFragmentIdentifier&&T?{fragmentIdentifier:B(T,A)}:{})},a.stringifyUrl=(x,A)=>{A=Object.assign({encode:!0,strict:!0},A);const S=L(x.url).split("?")[0]||"",T=a.extract(x.url),O=a.parse(T,{sort:!1}),W=Object.assign(O,x.query);let K=a.stringify(W,A);K&&(K=`?${K}`);let pt=q(x.url);return x.fragmentIdentifier&&(pt=`#${b(x.fragmentIdentifier,A)}`),`${S}${K}${pt}`}})(e3);const r3=lu("XMLHttpRequest")||Dl.XMLHttpRequest;class i3 extends ec{constructor(n){super(),this.url=n}formatError(n,h,u=-1){return{error:{message:h,code:u},id:n.id,jsonrpc:n.jsonrpc}}send(n,h){return new Promise(u=>{if(n.method==="eth_subscribe"){const y=this.formatError(n,"Subscriptions are not supported by this HTTP endpoint");return this.emit("error",y),u(y)}const v=new r3;let o=!1;const w=(y,b)=>{if(!o)if(v.abort(),o=!0,h)h(y,b);else{const{id:B,jsonrpc:k}=n,L=y?{id:B,jsonrpc:k,error:{message:y.message,code:y.code}}:{id:B,jsonrpc:k,result:b};this.emit("payload",L),u(L)}};v.open("POST",this.url,!0),v.setRequestHeader("Content-Type","application/json"),v.timeout=60*1e3,v.onerror=w,v.ontimeout=w,v.onreadystatechange=()=>{if(v.readyState===4)try{const y=JSON.parse(v.responseText);w(y.error,y.result)}catch(y){w(y)}},v.send(JSON.stringify(n))})}}const n3=["eth_sendTransaction","eth_signTransaction","eth_sign","eth_signTypedData","eth_signTypedData_v1","eth_signTypedData_v2","eth_signTypedData_v3","eth_signTypedData_v4","personal_sign","wallet_addEthereumChain","wallet_switchEthereumChain","wallet_getPermissions","wallet_requestPermissions","wallet_registerOnboarding","wallet_watchAsset","wallet_scanQRCode"],a3={1:"mainnet",3:"ropsten",4:"rinkeby",5:"goerli",42:"kovan"};var d0={exports:{}};d0.exports;(function(a){(function(n,h){function u(g,e){if(!g)throw new Error(e||"Assertion failed")}function v(g,e){g.super_=e;var t=function(){};t.prototype=e.prototype,g.prototype=new t,g.prototype.constructor=g}function o(g,e,t){if(o.isBN(g))return g;this.negative=0,this.words=null,this.length=0,this.red=null,g!==null&&((e==="le"||e==="be")&&(t=e,e=10),this._init(g||0,e||10,t||"be"))}typeof n=="object"?n.exports=o:h.BN=o,o.BN=o,o.wordSize=26;var w;try{w=Se.Buffer}catch{}o.isBN=function(e){return e instanceof o?!0:e!==null&&typeof e=="object"&&e.constructor.wordSize===o.wordSize&&Array.isArray(e.words)},o.max=function(e,t){return e.cmp(t)>0?e:t},o.min=function(e,t){return e.cmp(t)<0?e:t},o.prototype._init=function(e,t,i){if(typeof e=="number")return this._initNumber(e,t,i);if(typeof e=="object")return this._initArray(e,t,i);t==="hex"&&(t=16),u(t===(t|0)&&t>=2&&t<=36),e=e.toString().replace(/\s+/g,"");var s=0;e[0]==="-"&&s++,t===16?this._parseHex(e,s):this._parseBase(e,t,s),e[0]==="-"&&(this.negative=1),this.strip(),i==="le"&&this._initArray(this.toArray(),t,i)},o.prototype._initNumber=function(e,t,i){e<0&&(this.negative=1,e=-e),e<67108864?(this.words=[e&67108863],this.length=1):e<4503599627370496?(this.words=[e&67108863,e/67108864&67108863],this.length=2):(u(e<9007199254740992),this.words=[e&67108863,e/67108864&67108863,1],this.length=3),i==="le"&&this._initArray(this.toArray(),t,i)},o.prototype._initArray=function(e,t,i){if(u(typeof e.length=="number"),e.length<=0)return this.words=[0],this.length=1,this;this.length=Math.ceil(e.length/3),this.words=new Array(this.length);for(var s=0;s<this.length;s++)this.words[s]=0;var l,c,p=0;if(i==="be")for(s=e.length-1,l=0;s>=0;s-=3)c=e[s]|e[s-1]<<8|e[s-2]<<16,this.words[l]|=c<<p&67108863,this.words[l+1]=c>>>26-p&67108863,p+=24,p>=26&&(p-=26,l++);else if(i==="le")for(s=0,l=0;s<e.length;s+=3)c=e[s]|e[s+1]<<8|e[s+2]<<16,this.words[l]|=c<<p&67108863,this.words[l+1]=c>>>26-p&67108863,p+=24,p>=26&&(p-=26,l++);return this.strip()};function y(g,e,t){for(var i=0,s=Math.min(g.length,t),l=e;l<s;l++){var c=g.charCodeAt(l)-48;i<<=4,c>=49&&c<=54?i|=c-49+10:c>=17&&c<=22?i|=c-17+10:i|=c&15}return i}o.prototype._parseHex=function(e,t){this.length=Math.ceil((e.length-t)/6),this.words=new Array(this.length);for(var i=0;i<this.length;i++)this.words[i]=0;var s,l,c=0;for(i=e.length-6,s=0;i>=t;i-=6)l=y(e,i,i+6),this.words[s]|=l<<c&67108863,this.words[s+1]|=l>>>26-c&4194303,c+=24,c>=26&&(c-=26,s++);i+6!==t&&(l=y(e,t,i+6),this.words[s]|=l<<c&67108863,this.words[s+1]|=l>>>26-c&4194303),this.strip()};function b(g,e,t,i){for(var s=0,l=Math.min(g.length,t),c=e;c<l;c++){var p=g.charCodeAt(c)-48;s*=i,p>=49?s+=p-49+10:p>=17?s+=p-17+10:s+=p}return s}o.prototype._parseBase=function(e,t,i){this.words=[0],this.length=1;for(var s=0,l=1;l<=67108863;l*=t)s++;s--,l=l/t|0;for(var c=e.length-i,p=c%s,d=Math.min(c,c-p)+i,r=0,f=i;f<d;f+=s)r=b(e,f,f+s,t),this.imuln(l),this.words[0]+r<67108864?this.words[0]+=r:this._iaddn(r);if(p!==0){var m=1;for(r=b(e,f,e.length,t),f=0;f<p;f++)m*=t;this.imuln(m),this.words[0]+r<67108864?this.words[0]+=r:this._iaddn(r)}},o.prototype.copy=function(e){e.words=new Array(this.length);for(var t=0;t<this.length;t++)e.words[t]=this.words[t];e.length=this.length,e.negative=this.negative,e.red=this.red},o.prototype.clone=function(){var e=new o(null);return this.copy(e),e},o.prototype._expand=function(e){for(;this.length<e;)this.words[this.length++]=0;return this},o.prototype.strip=function(){for(;this.length>1&&this.words[this.length-1]===0;)this.length--;return this._normSign()},o.prototype._normSign=function(){return this.length===1&&this.words[0]===0&&(this.negative=0),this},o.prototype.inspect=function(){return(this.red?"<BN-R: ":"<BN: ")+this.toString(16)+">"};var B=["","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"],k=[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],L=[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];o.prototype.toString=function(e,t){e=e||10,t=t|0||1;var i;if(e===16||e==="hex"){i="";for(var s=0,l=0,c=0;c<this.length;c++){var p=this.words[c],d=((p<<s|l)&16777215).toString(16);l=p>>>24-s&16777215,l!==0||c!==this.length-1?i=B[6-d.length]+d+i:i=d+i,s+=2,s>=26&&(s-=26,c--)}for(l!==0&&(i=l.toString(16)+i);i.length%t!==0;)i="0"+i;return this.negative!==0&&(i="-"+i),i}if(e===(e|0)&&e>=2&&e<=36){var r=k[e],f=L[e];i="";var m=this.clone();for(m.negative=0;!m.isZero();){var _=m.modn(f).toString(e);m=m.idivn(f),m.isZero()?i=_+i:i=B[r-_.length]+_+i}for(this.isZero()&&(i="0"+i);i.length%t!==0;)i="0"+i;return this.negative!==0&&(i="-"+i),i}u(!1,"Base should be between 2 and 36")},o.prototype.toNumber=function(){var e=this.words[0];return this.length===2?e+=this.words[1]*67108864:this.length===3&&this.words[2]===1?e+=4503599627370496+this.words[1]*67108864:this.length>2&&u(!1,"Number can only safely store up to 53 bits"),this.negative!==0?-e:e},o.prototype.toJSON=function(){return this.toString(16)},o.prototype.toBuffer=function(e,t){return u(typeof w<"u"),this.toArrayLike(w,e,t)},o.prototype.toArray=function(e,t){return this.toArrayLike(Array,e,t)},o.prototype.toArrayLike=function(e,t,i){var s=this.byteLength(),l=i||Math.max(1,s);u(s<=l,"byte array longer than desired length"),u(l>0,"Requested array length <= 0"),this.strip();var c=t==="le",p=new e(l),d,r,f=this.clone();if(c){for(r=0;!f.isZero();r++)d=f.andln(255),f.iushrn(8),p[r]=d;for(;r<l;r++)p[r]=0}else{for(r=0;r<l-s;r++)p[r]=0;for(r=0;!f.isZero();r++)d=f.andln(255),f.iushrn(8),p[l-r-1]=d}return p},Math.clz32?o.prototype._countBits=function(e){return 32-Math.clz32(e)}:o.prototype._countBits=function(e){var t=e,i=0;return t>=4096&&(i+=13,t>>>=13),t>=64&&(i+=7,t>>>=7),t>=8&&(i+=4,t>>>=4),t>=2&&(i+=2,t>>>=2),i+t},o.prototype._zeroBits=function(e){if(e===0)return 26;var t=e,i=0;return t&8191||(i+=13,t>>>=13),t&127||(i+=7,t>>>=7),t&15||(i+=4,t>>>=4),t&3||(i+=2,t>>>=2),t&1||i++,i},o.prototype.bitLength=function(){var e=this.words[this.length-1],t=this._countBits(e);return(this.length-1)*26+t};function q(g){for(var e=new Array(g.bitLength()),t=0;t<e.length;t++){var i=t/26|0,s=t%26;e[t]=(g.words[i]&1<<s)>>>s}return e}o.prototype.zeroBits=function(){if(this.isZero())return 0;for(var e=0,t=0;t<this.length;t++){var i=this._zeroBits(this.words[t]);if(e+=i,i!==26)break}return e},o.prototype.byteLength=function(){return Math.ceil(this.bitLength()/8)},o.prototype.toTwos=function(e){return this.negative!==0?this.abs().inotn(e).iaddn(1):this.clone()},o.prototype.fromTwos=function(e){return this.testn(e-1)?this.notn(e).iaddn(1).ineg():this.clone()},o.prototype.isNeg=function(){return this.negative!==0},o.prototype.neg=function(){return this.clone().ineg()},o.prototype.ineg=function(){return this.isZero()||(this.negative^=1),this},o.prototype.iuor=function(e){for(;this.length<e.length;)this.words[this.length++]=0;for(var t=0;t<e.length;t++)this.words[t]=this.words[t]|e.words[t];return this.strip()},o.prototype.ior=function(e){return u((this.negative|e.negative)===0),this.iuor(e)},o.prototype.or=function(e){return this.length>e.length?this.clone().ior(e):e.clone().ior(this)},o.prototype.uor=function(e){return this.length>e.length?this.clone().iuor(e):e.clone().iuor(this)},o.prototype.iuand=function(e){var t;this.length>e.length?t=e:t=this;for(var i=0;i<t.length;i++)this.words[i]=this.words[i]&e.words[i];return this.length=t.length,this.strip()},o.prototype.iand=function(e){return u((this.negative|e.negative)===0),this.iuand(e)},o.prototype.and=function(e){return this.length>e.length?this.clone().iand(e):e.clone().iand(this)},o.prototype.uand=function(e){return this.length>e.length?this.clone().iuand(e):e.clone().iuand(this)},o.prototype.iuxor=function(e){var t,i;this.length>e.length?(t=this,i=e):(t=e,i=this);for(var s=0;s<i.length;s++)this.words[s]=t.words[s]^i.words[s];if(this!==t)for(;s<t.length;s++)this.words[s]=t.words[s];return this.length=t.length,this.strip()},o.prototype.ixor=function(e){return u((this.negative|e.negative)===0),this.iuxor(e)},o.prototype.xor=function(e){return this.length>e.length?this.clone().ixor(e):e.clone().ixor(this)},o.prototype.uxor=function(e){return this.length>e.length?this.clone().iuxor(e):e.clone().iuxor(this)},o.prototype.inotn=function(e){u(typeof e=="number"&&e>=0);var t=Math.ceil(e/26)|0,i=e%26;this._expand(t),i>0&&t--;for(var s=0;s<t;s++)this.words[s]=~this.words[s]&67108863;return i>0&&(this.words[s]=~this.words[s]&67108863>>26-i),this.strip()},o.prototype.notn=function(e){return this.clone().inotn(e)},o.prototype.setn=function(e,t){u(typeof e=="number"&&e>=0);var i=e/26|0,s=e%26;return this._expand(i+1),t?this.words[i]=this.words[i]|1<<s:this.words[i]=this.words[i]&~(1<<s),this.strip()},o.prototype.iadd=function(e){var t;if(this.negative!==0&&e.negative===0)return this.negative=0,t=this.isub(e),this.negative^=1,this._normSign();if(this.negative===0&&e.negative!==0)return e.negative=0,t=this.isub(e),e.negative=1,t._normSign();var i,s;this.length>e.length?(i=this,s=e):(i=e,s=this);for(var l=0,c=0;c<s.length;c++)t=(i.words[c]|0)+(s.words[c]|0)+l,this.words[c]=t&67108863,l=t>>>26;for(;l!==0&&c<i.length;c++)t=(i.words[c]|0)+l,this.words[c]=t&67108863,l=t>>>26;if(this.length=i.length,l!==0)this.words[this.length]=l,this.length++;else if(i!==this)for(;c<i.length;c++)this.words[c]=i.words[c];return this},o.prototype.add=function(e){var t;return e.negative!==0&&this.negative===0?(e.negative=0,t=this.sub(e),e.negative^=1,t):e.negative===0&&this.negative!==0?(this.negative=0,t=e.sub(this),this.negative=1,t):this.length>e.length?this.clone().iadd(e):e.clone().iadd(this)},o.prototype.isub=function(e){if(e.negative!==0){e.negative=0;var t=this.iadd(e);return e.negative=1,t._normSign()}else if(this.negative!==0)return this.negative=0,this.iadd(e),this.negative=1,this._normSign();var i=this.cmp(e);if(i===0)return this.negative=0,this.length=1,this.words[0]=0,this;var s,l;i>0?(s=this,l=e):(s=e,l=this);for(var c=0,p=0;p<l.length;p++)t=(s.words[p]|0)-(l.words[p]|0)+c,c=t>>26,this.words[p]=t&67108863;for(;c!==0&&p<s.length;p++)t=(s.words[p]|0)+c,c=t>>26,this.words[p]=t&67108863;if(c===0&&p<s.length&&s!==this)for(;p<s.length;p++)this.words[p]=s.words[p];return this.length=Math.max(this.length,p),s!==this&&(this.negative=1),this.strip()},o.prototype.sub=function(e){return this.clone().isub(e)};function $(g,e,t){t.negative=e.negative^g.negative;var i=g.length+e.length|0;t.length=i,i=i-1|0;var s=g.words[0]|0,l=e.words[0]|0,c=s*l,p=c&67108863,d=c/67108864|0;t.words[0]=p;for(var r=1;r<i;r++){for(var f=d>>>26,m=d&67108863,_=Math.min(r,e.length-1),R=Math.max(0,r-g.length+1);R<=_;R++){var C=r-R|0;s=g.words[C]|0,l=e.words[R]|0,c=s*l+m,f+=c/67108864|0,m=c&67108863}t.words[r]=m|0,d=f|0}return d!==0?t.words[r]=d|0:t.length--,t.strip()}var M=function(e,t,i){var s=e.words,l=t.words,c=i.words,p=0,d,r,f,m=s[0]|0,_=m&8191,R=m>>>13,C=s[1]|0,F=C&8191,z=C>>>13,lt=s[2]|0,G=lt&8191,Z=lt>>>13,mt=s[3]|0,gt=mt&8191,j=mt>>>13,Ct=s[4]|0,wt=Ct&8191,Y=Ct>>>13,U=s[5]|0,I=U&8191,E=U>>>13,P=s[6]|0,H=P&8191,D=P>>>13,ut=s[7]|0,vt=ut&8191,V=ut>>>13,bt=s[8]|0,yt=bt&8191,J=bt>>>13,Lt=s[9]|0,Mt=Lt&8191,Q=Lt>>>13,Ot=l[0]|0,xt=Ot&8191,tt=Ot>>>13,Nt=l[1]|0,_t=Nt&8191,et=Nt>>>13,qt=l[2]|0,St=qt&8191,rt=qt>>>13,Ut=l[3]|0,At=Ut&8191,it=Ut>>>13,Ft=l[4]|0,Et=Ft&8191,nt=Ft>>>13,$t=l[5]|0,kt=$t&8191,at=$t>>>13,zt=l[6]|0,Rt=zt&8191,ft=zt>>>13,Dt=l[7]|0,Bt=Dt&8191,ot=Dt>>>13,Ht=l[8]|0,It=Ht&8191,st=Ht>>>13,Kt=l[9]|0,Tt=Kt&8191,ht=Kt>>>13;i.negative=e.negative^t.negative,i.length=19,d=Math.imul(_,xt),r=Math.imul(_,tt),r=r+Math.imul(R,xt)|0,f=Math.imul(R,tt);var Pt=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(Pt>>>26)|0,Pt&=67108863,d=Math.imul(F,xt),r=Math.imul(F,tt),r=r+Math.imul(z,xt)|0,f=Math.imul(z,tt),d=d+Math.imul(_,_t)|0,r=r+Math.imul(_,et)|0,r=r+Math.imul(R,_t)|0,f=f+Math.imul(R,et)|0;var Jt=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(Jt>>>26)|0,Jt&=67108863,d=Math.imul(G,xt),r=Math.imul(G,tt),r=r+Math.imul(Z,xt)|0,f=Math.imul(Z,tt),d=d+Math.imul(F,_t)|0,r=r+Math.imul(F,et)|0,r=r+Math.imul(z,_t)|0,f=f+Math.imul(z,et)|0,d=d+Math.imul(_,St)|0,r=r+Math.imul(_,rt)|0,r=r+Math.imul(R,St)|0,f=f+Math.imul(R,rt)|0;var jt=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(jt>>>26)|0,jt&=67108863,d=Math.imul(gt,xt),r=Math.imul(gt,tt),r=r+Math.imul(j,xt)|0,f=Math.imul(j,tt),d=d+Math.imul(G,_t)|0,r=r+Math.imul(G,et)|0,r=r+Math.imul(Z,_t)|0,f=f+Math.imul(Z,et)|0,d=d+Math.imul(F,St)|0,r=r+Math.imul(F,rt)|0,r=r+Math.imul(z,St)|0,f=f+Math.imul(z,rt)|0,d=d+Math.imul(_,At)|0,r=r+Math.imul(_,it)|0,r=r+Math.imul(R,At)|0,f=f+Math.imul(R,it)|0;var Yt=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(Yt>>>26)|0,Yt&=67108863,d=Math.imul(wt,xt),r=Math.imul(wt,tt),r=r+Math.imul(Y,xt)|0,f=Math.imul(Y,tt),d=d+Math.imul(gt,_t)|0,r=r+Math.imul(gt,et)|0,r=r+Math.imul(j,_t)|0,f=f+Math.imul(j,et)|0,d=d+Math.imul(G,St)|0,r=r+Math.imul(G,rt)|0,r=r+Math.imul(Z,St)|0,f=f+Math.imul(Z,rt)|0,d=d+Math.imul(F,At)|0,r=r+Math.imul(F,it)|0,r=r+Math.imul(z,At)|0,f=f+Math.imul(z,it)|0,d=d+Math.imul(_,Et)|0,r=r+Math.imul(_,nt)|0,r=r+Math.imul(R,Et)|0,f=f+Math.imul(R,nt)|0;var Xt=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(Xt>>>26)|0,Xt&=67108863,d=Math.imul(I,xt),r=Math.imul(I,tt),r=r+Math.imul(E,xt)|0,f=Math.imul(E,tt),d=d+Math.imul(wt,_t)|0,r=r+Math.imul(wt,et)|0,r=r+Math.imul(Y,_t)|0,f=f+Math.imul(Y,et)|0,d=d+Math.imul(gt,St)|0,r=r+Math.imul(gt,rt)|0,r=r+Math.imul(j,St)|0,f=f+Math.imul(j,rt)|0,d=d+Math.imul(G,At)|0,r=r+Math.imul(G,it)|0,r=r+Math.imul(Z,At)|0,f=f+Math.imul(Z,it)|0,d=d+Math.imul(F,Et)|0,r=r+Math.imul(F,nt)|0,r=r+Math.imul(z,Et)|0,f=f+Math.imul(z,nt)|0,d=d+Math.imul(_,kt)|0,r=r+Math.imul(_,at)|0,r=r+Math.imul(R,kt)|0,f=f+Math.imul(R,at)|0;var Qt=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(Qt>>>26)|0,Qt&=67108863,d=Math.imul(H,xt),r=Math.imul(H,tt),r=r+Math.imul(D,xt)|0,f=Math.imul(D,tt),d=d+Math.imul(I,_t)|0,r=r+Math.imul(I,et)|0,r=r+Math.imul(E,_t)|0,f=f+Math.imul(E,et)|0,d=d+Math.imul(wt,St)|0,r=r+Math.imul(wt,rt)|0,r=r+Math.imul(Y,St)|0,f=f+Math.imul(Y,rt)|0,d=d+Math.imul(gt,At)|0,r=r+Math.imul(gt,it)|0,r=r+Math.imul(j,At)|0,f=f+Math.imul(j,it)|0,d=d+Math.imul(G,Et)|0,r=r+Math.imul(G,nt)|0,r=r+Math.imul(Z,Et)|0,f=f+Math.imul(Z,nt)|0,d=d+Math.imul(F,kt)|0,r=r+Math.imul(F,at)|0,r=r+Math.imul(z,kt)|0,f=f+Math.imul(z,at)|0,d=d+Math.imul(_,Rt)|0,r=r+Math.imul(_,ft)|0,r=r+Math.imul(R,Rt)|0,f=f+Math.imul(R,ft)|0;var te=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(te>>>26)|0,te&=67108863,d=Math.imul(vt,xt),r=Math.imul(vt,tt),r=r+Math.imul(V,xt)|0,f=Math.imul(V,tt),d=d+Math.imul(H,_t)|0,r=r+Math.imul(H,et)|0,r=r+Math.imul(D,_t)|0,f=f+Math.imul(D,et)|0,d=d+Math.imul(I,St)|0,r=r+Math.imul(I,rt)|0,r=r+Math.imul(E,St)|0,f=f+Math.imul(E,rt)|0,d=d+Math.imul(wt,At)|0,r=r+Math.imul(wt,it)|0,r=r+Math.imul(Y,At)|0,f=f+Math.imul(Y,it)|0,d=d+Math.imul(gt,Et)|0,r=r+Math.imul(gt,nt)|0,r=r+Math.imul(j,Et)|0,f=f+Math.imul(j,nt)|0,d=d+Math.imul(G,kt)|0,r=r+Math.imul(G,at)|0,r=r+Math.imul(Z,kt)|0,f=f+Math.imul(Z,at)|0,d=d+Math.imul(F,Rt)|0,r=r+Math.imul(F,ft)|0,r=r+Math.imul(z,Rt)|0,f=f+Math.imul(z,ft)|0,d=d+Math.imul(_,Bt)|0,r=r+Math.imul(_,ot)|0,r=r+Math.imul(R,Bt)|0,f=f+Math.imul(R,ot)|0;var ee=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(ee>>>26)|0,ee&=67108863,d=Math.imul(yt,xt),r=Math.imul(yt,tt),r=r+Math.imul(J,xt)|0,f=Math.imul(J,tt),d=d+Math.imul(vt,_t)|0,r=r+Math.imul(vt,et)|0,r=r+Math.imul(V,_t)|0,f=f+Math.imul(V,et)|0,d=d+Math.imul(H,St)|0,r=r+Math.imul(H,rt)|0,r=r+Math.imul(D,St)|0,f=f+Math.imul(D,rt)|0,d=d+Math.imul(I,At)|0,r=r+Math.imul(I,it)|0,r=r+Math.imul(E,At)|0,f=f+Math.imul(E,it)|0,d=d+Math.imul(wt,Et)|0,r=r+Math.imul(wt,nt)|0,r=r+Math.imul(Y,Et)|0,f=f+Math.imul(Y,nt)|0,d=d+Math.imul(gt,kt)|0,r=r+Math.imul(gt,at)|0,r=r+Math.imul(j,kt)|0,f=f+Math.imul(j,at)|0,d=d+Math.imul(G,Rt)|0,r=r+Math.imul(G,ft)|0,r=r+Math.imul(Z,Rt)|0,f=f+Math.imul(Z,ft)|0,d=d+Math.imul(F,Bt)|0,r=r+Math.imul(F,ot)|0,r=r+Math.imul(z,Bt)|0,f=f+Math.imul(z,ot)|0,d=d+Math.imul(_,It)|0,r=r+Math.imul(_,st)|0,r=r+Math.imul(R,It)|0,f=f+Math.imul(R,st)|0;var re=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(re>>>26)|0,re&=67108863,d=Math.imul(Mt,xt),r=Math.imul(Mt,tt),r=r+Math.imul(Q,xt)|0,f=Math.imul(Q,tt),d=d+Math.imul(yt,_t)|0,r=r+Math.imul(yt,et)|0,r=r+Math.imul(J,_t)|0,f=f+Math.imul(J,et)|0,d=d+Math.imul(vt,St)|0,r=r+Math.imul(vt,rt)|0,r=r+Math.imul(V,St)|0,f=f+Math.imul(V,rt)|0,d=d+Math.imul(H,At)|0,r=r+Math.imul(H,it)|0,r=r+Math.imul(D,At)|0,f=f+Math.imul(D,it)|0,d=d+Math.imul(I,Et)|0,r=r+Math.imul(I,nt)|0,r=r+Math.imul(E,Et)|0,f=f+Math.imul(E,nt)|0,d=d+Math.imul(wt,kt)|0,r=r+Math.imul(wt,at)|0,r=r+Math.imul(Y,kt)|0,f=f+Math.imul(Y,at)|0,d=d+Math.imul(gt,Rt)|0,r=r+Math.imul(gt,ft)|0,r=r+Math.imul(j,Rt)|0,f=f+Math.imul(j,ft)|0,d=d+Math.imul(G,Bt)|0,r=r+Math.imul(G,ot)|0,r=r+Math.imul(Z,Bt)|0,f=f+Math.imul(Z,ot)|0,d=d+Math.imul(F,It)|0,r=r+Math.imul(F,st)|0,r=r+Math.imul(z,It)|0,f=f+Math.imul(z,st)|0,d=d+Math.imul(_,Tt)|0,r=r+Math.imul(_,ht)|0,r=r+Math.imul(R,Tt)|0,f=f+Math.imul(R,ht)|0;var ie=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(ie>>>26)|0,ie&=67108863,d=Math.imul(Mt,_t),r=Math.imul(Mt,et),r=r+Math.imul(Q,_t)|0,f=Math.imul(Q,et),d=d+Math.imul(yt,St)|0,r=r+Math.imul(yt,rt)|0,r=r+Math.imul(J,St)|0,f=f+Math.imul(J,rt)|0,d=d+Math.imul(vt,At)|0,r=r+Math.imul(vt,it)|0,r=r+Math.imul(V,At)|0,f=f+Math.imul(V,it)|0,d=d+Math.imul(H,Et)|0,r=r+Math.imul(H,nt)|0,r=r+Math.imul(D,Et)|0,f=f+Math.imul(D,nt)|0,d=d+Math.imul(I,kt)|0,r=r+Math.imul(I,at)|0,r=r+Math.imul(E,kt)|0,f=f+Math.imul(E,at)|0,d=d+Math.imul(wt,Rt)|0,r=r+Math.imul(wt,ft)|0,r=r+Math.imul(Y,Rt)|0,f=f+Math.imul(Y,ft)|0,d=d+Math.imul(gt,Bt)|0,r=r+Math.imul(gt,ot)|0,r=r+Math.imul(j,Bt)|0,f=f+Math.imul(j,ot)|0,d=d+Math.imul(G,It)|0,r=r+Math.imul(G,st)|0,r=r+Math.imul(Z,It)|0,f=f+Math.imul(Z,st)|0,d=d+Math.imul(F,Tt)|0,r=r+Math.imul(F,ht)|0,r=r+Math.imul(z,Tt)|0,f=f+Math.imul(z,ht)|0;var ne=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(ne>>>26)|0,ne&=67108863,d=Math.imul(Mt,St),r=Math.imul(Mt,rt),r=r+Math.imul(Q,St)|0,f=Math.imul(Q,rt),d=d+Math.imul(yt,At)|0,r=r+Math.imul(yt,it)|0,r=r+Math.imul(J,At)|0,f=f+Math.imul(J,it)|0,d=d+Math.imul(vt,Et)|0,r=r+Math.imul(vt,nt)|0,r=r+Math.imul(V,Et)|0,f=f+Math.imul(V,nt)|0,d=d+Math.imul(H,kt)|0,r=r+Math.imul(H,at)|0,r=r+Math.imul(D,kt)|0,f=f+Math.imul(D,at)|0,d=d+Math.imul(I,Rt)|0,r=r+Math.imul(I,ft)|0,r=r+Math.imul(E,Rt)|0,f=f+Math.imul(E,ft)|0,d=d+Math.imul(wt,Bt)|0,r=r+Math.imul(wt,ot)|0,r=r+Math.imul(Y,Bt)|0,f=f+Math.imul(Y,ot)|0,d=d+Math.imul(gt,It)|0,r=r+Math.imul(gt,st)|0,r=r+Math.imul(j,It)|0,f=f+Math.imul(j,st)|0,d=d+Math.imul(G,Tt)|0,r=r+Math.imul(G,ht)|0,r=r+Math.imul(Z,Tt)|0,f=f+Math.imul(Z,ht)|0;var ae=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(ae>>>26)|0,ae&=67108863,d=Math.imul(Mt,At),r=Math.imul(Mt,it),r=r+Math.imul(Q,At)|0,f=Math.imul(Q,it),d=d+Math.imul(yt,Et)|0,r=r+Math.imul(yt,nt)|0,r=r+Math.imul(J,Et)|0,f=f+Math.imul(J,nt)|0,d=d+Math.imul(vt,kt)|0,r=r+Math.imul(vt,at)|0,r=r+Math.imul(V,kt)|0,f=f+Math.imul(V,at)|0,d=d+Math.imul(H,Rt)|0,r=r+Math.imul(H,ft)|0,r=r+Math.imul(D,Rt)|0,f=f+Math.imul(D,ft)|0,d=d+Math.imul(I,Bt)|0,r=r+Math.imul(I,ot)|0,r=r+Math.imul(E,Bt)|0,f=f+Math.imul(E,ot)|0,d=d+Math.imul(wt,It)|0,r=r+Math.imul(wt,st)|0,r=r+Math.imul(Y,It)|0,f=f+Math.imul(Y,st)|0,d=d+Math.imul(gt,Tt)|0,r=r+Math.imul(gt,ht)|0,r=r+Math.imul(j,Tt)|0,f=f+Math.imul(j,ht)|0;var fe=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(fe>>>26)|0,fe&=67108863,d=Math.imul(Mt,Et),r=Math.imul(Mt,nt),r=r+Math.imul(Q,Et)|0,f=Math.imul(Q,nt),d=d+Math.imul(yt,kt)|0,r=r+Math.imul(yt,at)|0,r=r+Math.imul(J,kt)|0,f=f+Math.imul(J,at)|0,d=d+Math.imul(vt,Rt)|0,r=r+Math.imul(vt,ft)|0,r=r+Math.imul(V,Rt)|0,f=f+Math.imul(V,ft)|0,d=d+Math.imul(H,Bt)|0,r=r+Math.imul(H,ot)|0,r=r+Math.imul(D,Bt)|0,f=f+Math.imul(D,ot)|0,d=d+Math.imul(I,It)|0,r=r+Math.imul(I,st)|0,r=r+Math.imul(E,It)|0,f=f+Math.imul(E,st)|0,d=d+Math.imul(wt,Tt)|0,r=r+Math.imul(wt,ht)|0,r=r+Math.imul(Y,Tt)|0,f=f+Math.imul(Y,ht)|0;var oe=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(oe>>>26)|0,oe&=67108863,d=Math.imul(Mt,kt),r=Math.imul(Mt,at),r=r+Math.imul(Q,kt)|0,f=Math.imul(Q,at),d=d+Math.imul(yt,Rt)|0,r=r+Math.imul(yt,ft)|0,r=r+Math.imul(J,Rt)|0,f=f+Math.imul(J,ft)|0,d=d+Math.imul(vt,Bt)|0,r=r+Math.imul(vt,ot)|0,r=r+Math.imul(V,Bt)|0,f=f+Math.imul(V,ot)|0,d=d+Math.imul(H,It)|0,r=r+Math.imul(H,st)|0,r=r+Math.imul(D,It)|0,f=f+Math.imul(D,st)|0,d=d+Math.imul(I,Tt)|0,r=r+Math.imul(I,ht)|0,r=r+Math.imul(E,Tt)|0,f=f+Math.imul(E,ht)|0;var se=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(se>>>26)|0,se&=67108863,d=Math.imul(Mt,Rt),r=Math.imul(Mt,ft),r=r+Math.imul(Q,Rt)|0,f=Math.imul(Q,ft),d=d+Math.imul(yt,Bt)|0,r=r+Math.imul(yt,ot)|0,r=r+Math.imul(J,Bt)|0,f=f+Math.imul(J,ot)|0,d=d+Math.imul(vt,It)|0,r=r+Math.imul(vt,st)|0,r=r+Math.imul(V,It)|0,f=f+Math.imul(V,st)|0,d=d+Math.imul(H,Tt)|0,r=r+Math.imul(H,ht)|0,r=r+Math.imul(D,Tt)|0,f=f+Math.imul(D,ht)|0;var he=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(he>>>26)|0,he&=67108863,d=Math.imul(Mt,Bt),r=Math.imul(Mt,ot),r=r+Math.imul(Q,Bt)|0,f=Math.imul(Q,ot),d=d+Math.imul(yt,It)|0,r=r+Math.imul(yt,st)|0,r=r+Math.imul(J,It)|0,f=f+Math.imul(J,st)|0,d=d+Math.imul(vt,Tt)|0,r=r+Math.imul(vt,ht)|0,r=r+Math.imul(V,Tt)|0,f=f+Math.imul(V,ht)|0;var ue=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(ue>>>26)|0,ue&=67108863,d=Math.imul(Mt,It),r=Math.imul(Mt,st),r=r+Math.imul(Q,It)|0,f=Math.imul(Q,st),d=d+Math.imul(yt,Tt)|0,r=r+Math.imul(yt,ht)|0,r=r+Math.imul(J,Tt)|0,f=f+Math.imul(J,ht)|0;var le=(p+d|0)+((r&8191)<<13)|0;p=(f+(r>>>13)|0)+(le>>>26)|0,le&=67108863,d=Math.imul(Mt,Tt),r=Math.imul(Mt,ht),r=r+Math.imul(Q,Tt)|0,f=Math.imul(Q,ht);var ce=(p+d|0)+((r&8191)<<13)|0;return p=(f+(r>>>13)|0)+(ce>>>26)|0,ce&=67108863,c[0]=Pt,c[1]=Jt,c[2]=jt,c[3]=Yt,c[4]=Xt,c[5]=Qt,c[6]=te,c[7]=ee,c[8]=re,c[9]=ie,c[10]=ne,c[11]=ae,c[12]=fe,c[13]=oe,c[14]=se,c[15]=he,c[16]=ue,c[17]=le,c[18]=ce,p!==0&&(c[19]=p,i.length++),i};Math.imul||(M=$);function N(g,e,t){t.negative=e.negative^g.negative,t.length=g.length+e.length;for(var i=0,s=0,l=0;l<t.length-1;l++){var c=s;s=0;for(var p=i&67108863,d=Math.min(l,e.length-1),r=Math.max(0,l-g.length+1);r<=d;r++){var f=l-r,m=g.words[f]|0,_=e.words[r]|0,R=m*_,C=R&67108863;c=c+(R/67108864|0)|0,C=C+p|0,p=C&67108863,c=c+(C>>>26)|0,s+=c>>>26,c&=67108863}t.words[l]=p,i=c,c=s}return i!==0?t.words[l]=i:t.length--,t.strip()}function x(g,e,t){var i=new A;return i.mulp(g,e,t)}o.prototype.mulTo=function(e,t){var i,s=this.length+e.length;return this.length===10&&e.length===10?i=M(this,e,t):s<63?i=$(this,e,t):s<1024?i=N(this,e,t):i=x(this,e,t),i};function A(g,e){this.x=g,this.y=e}A.prototype.makeRBT=function(e){for(var t=new Array(e),i=o.prototype._countBits(e)-1,s=0;s<e;s++)t[s]=this.revBin(s,i,e);return t},A.prototype.revBin=function(e,t,i){if(e===0||e===i-1)return e;for(var s=0,l=0;l<t;l++)s|=(e&1)<<t-l-1,e>>=1;return s},A.prototype.permute=function(e,t,i,s,l,c){for(var p=0;p<c;p++)s[p]=t[e[p]],l[p]=i[e[p]]},A.prototype.transform=function(e,t,i,s,l,c){this.permute(c,e,t,i,s,l);for(var p=1;p<l;p<<=1)for(var d=p<<1,r=Math.cos(2*Math.PI/d),f=Math.sin(2*Math.PI/d),m=0;m<l;m+=d)for(var _=r,R=f,C=0;C<p;C++){var F=i[m+C],z=s[m+C],lt=i[m+C+p],G=s[m+C+p],Z=_*lt-R*G;G=_*G+R*lt,lt=Z,i[m+C]=F+lt,s[m+C]=z+G,i[m+C+p]=F-lt,s[m+C+p]=z-G,C!==d&&(Z=r*_-f*R,R=r*R+f*_,_=Z)}},A.prototype.guessLen13b=function(e,t){var i=Math.max(t,e)|1,s=i&1,l=0;for(i=i/2|0;i;i=i>>>1)l++;return 1<<l+1+s},A.prototype.conjugate=function(e,t,i){if(!(i<=1))for(var s=0;s<i/2;s++){var l=e[s];e[s]=e[i-s-1],e[i-s-1]=l,l=t[s],t[s]=-t[i-s-1],t[i-s-1]=-l}},A.prototype.normalize13b=function(e,t){for(var i=0,s=0;s<t/2;s++){var l=Math.round(e[2*s+1]/t)*8192+Math.round(e[2*s]/t)+i;e[s]=l&67108863,l<67108864?i=0:i=l/67108864|0}return e},A.prototype.convert13b=function(e,t,i,s){for(var l=0,c=0;c<t;c++)l=l+(e[c]|0),i[2*c]=l&8191,l=l>>>13,i[2*c+1]=l&8191,l=l>>>13;for(c=2*t;c<s;++c)i[c]=0;u(l===0),u((l&-8192)===0)},A.prototype.stub=function(e){for(var t=new Array(e),i=0;i<e;i++)t[i]=0;return t},A.prototype.mulp=function(e,t,i){var s=2*this.guessLen13b(e.length,t.length),l=this.makeRBT(s),c=this.stub(s),p=new Array(s),d=new Array(s),r=new Array(s),f=new Array(s),m=new Array(s),_=new Array(s),R=i.words;R.length=s,this.convert13b(e.words,e.length,p,s),this.convert13b(t.words,t.length,f,s),this.transform(p,c,d,r,s,l),this.transform(f,c,m,_,s,l);for(var C=0;C<s;C++){var F=d[C]*m[C]-r[C]*_[C];r[C]=d[C]*_[C]+r[C]*m[C],d[C]=F}return this.conjugate(d,r,s),this.transform(d,r,R,c,s,l),this.conjugate(R,c,s),this.normalize13b(R,s),i.negative=e.negative^t.negative,i.length=e.length+t.length,i.strip()},o.prototype.mul=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),this.mulTo(e,t)},o.prototype.mulf=function(e){var t=new o(null);return t.words=new Array(this.length+e.length),x(this,e,t)},o.prototype.imul=function(e){return this.clone().mulTo(e,this)},o.prototype.imuln=function(e){u(typeof e=="number"),u(e<67108864);for(var t=0,i=0;i<this.length;i++){var s=(this.words[i]|0)*e,l=(s&67108863)+(t&67108863);t>>=26,t+=s/67108864|0,t+=l>>>26,this.words[i]=l&67108863}return t!==0&&(this.words[i]=t,this.length++),this},o.prototype.muln=function(e){return this.clone().imuln(e)},o.prototype.sqr=function(){return this.mul(this)},o.prototype.isqr=function(){return this.imul(this.clone())},o.prototype.pow=function(e){var t=q(e);if(t.length===0)return new o(1);for(var i=this,s=0;s<t.length&&t[s]===0;s++,i=i.sqr());if(++s<t.length)for(var l=i.sqr();s<t.length;s++,l=l.sqr())t[s]!==0&&(i=i.mul(l));return i},o.prototype.iushln=function(e){u(typeof e=="number"&&e>=0);var t=e%26,i=(e-t)/26,s=67108863>>>26-t<<26-t,l;if(t!==0){var c=0;for(l=0;l<this.length;l++){var p=this.words[l]&s,d=(this.words[l]|0)-p<<t;this.words[l]=d|c,c=p>>>26-t}c&&(this.words[l]=c,this.length++)}if(i!==0){for(l=this.length-1;l>=0;l--)this.words[l+i]=this.words[l];for(l=0;l<i;l++)this.words[l]=0;this.length+=i}return this.strip()},o.prototype.ishln=function(e){return u(this.negative===0),this.iushln(e)},o.prototype.iushrn=function(e,t,i){u(typeof e=="number"&&e>=0);var s;t?s=(t-t%26)/26:s=0;var l=e%26,c=Math.min((e-l)/26,this.length),p=67108863^67108863>>>l<<l,d=i;if(s-=c,s=Math.max(0,s),d){for(var r=0;r<c;r++)d.words[r]=this.words[r];d.length=c}if(c!==0)if(this.length>c)for(this.length-=c,r=0;r<this.length;r++)this.words[r]=this.words[r+c];else this.words[0]=0,this.length=1;var f=0;for(r=this.length-1;r>=0&&(f!==0||r>=s);r--){var m=this.words[r]|0;this.words[r]=f<<26-l|m>>>l,f=m&p}return d&&f!==0&&(d.words[d.length++]=f),this.length===0&&(this.words[0]=0,this.length=1),this.strip()},o.prototype.ishrn=function(e,t,i){return u(this.negative===0),this.iushrn(e,t,i)},o.prototype.shln=function(e){return this.clone().ishln(e)},o.prototype.ushln=function(e){return this.clone().iushln(e)},o.prototype.shrn=function(e){return this.clone().ishrn(e)},o.prototype.ushrn=function(e){return this.clone().iushrn(e)},o.prototype.testn=function(e){u(typeof e=="number"&&e>=0);var t=e%26,i=(e-t)/26,s=1<<t;if(this.length<=i)return!1;var l=this.words[i];return!!(l&s)},o.prototype.imaskn=function(e){u(typeof e=="number"&&e>=0);var t=e%26,i=(e-t)/26;if(u(this.negative===0,"imaskn works only with positive numbers"),this.length<=i)return this;if(t!==0&&i++,this.length=Math.min(i,this.length),t!==0){var s=67108863^67108863>>>t<<t;this.words[this.length-1]&=s}return this.strip()},o.prototype.maskn=function(e){return this.clone().imaskn(e)},o.prototype.iaddn=function(e){return u(typeof e=="number"),u(e<67108864),e<0?this.isubn(-e):this.negative!==0?this.length===1&&(this.words[0]|0)<e?(this.words[0]=e-(this.words[0]|0),this.negative=0,this):(this.negative=0,this.isubn(e),this.negative=1,this):this._iaddn(e)},o.prototype._iaddn=function(e){this.words[0]+=e;for(var t=0;t<this.length&&this.words[t]>=67108864;t++)this.words[t]-=67108864,t===this.length-1?this.words[t+1]=1:this.words[t+1]++;return this.length=Math.max(this.length,t+1),this},o.prototype.isubn=function(e){if(u(typeof e=="number"),u(e<67108864),e<0)return this.iaddn(-e);if(this.negative!==0)return this.negative=0,this.iaddn(e),this.negative=1,this;if(this.words[0]-=e,this.length===1&&this.words[0]<0)this.words[0]=-this.words[0],this.negative=1;else for(var t=0;t<this.length&&this.words[t]<0;t++)this.words[t]+=67108864,this.words[t+1]-=1;return this.strip()},o.prototype.addn=function(e){return this.clone().iaddn(e)},o.prototype.subn=function(e){return this.clone().isubn(e)},o.prototype.iabs=function(){return this.negative=0,this},o.prototype.abs=function(){return this.clone().iabs()},o.prototype._ishlnsubmul=function(e,t,i){var s=e.length+i,l;this._expand(s);var c,p=0;for(l=0;l<e.length;l++){c=(this.words[l+i]|0)+p;var d=(e.words[l]|0)*t;c-=d&67108863,p=(c>>26)-(d/67108864|0),this.words[l+i]=c&67108863}for(;l<this.length-i;l++)c=(this.words[l+i]|0)+p,p=c>>26,this.words[l+i]=c&67108863;if(p===0)return this.strip();for(u(p===-1),p=0,l=0;l<this.length;l++)c=-(this.words[l]|0)+p,p=c>>26,this.words[l]=c&67108863;return this.negative=1,this.strip()},o.prototype._wordDiv=function(e,t){var i=this.length-e.length,s=this.clone(),l=e,c=l.words[l.length-1]|0,p=this._countBits(c);i=26-p,i!==0&&(l=l.ushln(i),s.iushln(i),c=l.words[l.length-1]|0);var d=s.length-l.length,r;if(t!=="mod"){r=new o(null),r.length=d+1,r.words=new Array(r.length);for(var f=0;f<r.length;f++)r.words[f]=0}var m=s.clone()._ishlnsubmul(l,1,d);m.negative===0&&(s=m,r&&(r.words[d]=1));for(var _=d-1;_>=0;_--){var R=(s.words[l.length+_]|0)*67108864+(s.words[l.length+_-1]|0);for(R=Math.min(R/c|0,67108863),s._ishlnsubmul(l,R,_);s.negative!==0;)R--,s.negative=0,s._ishlnsubmul(l,1,_),s.isZero()||(s.negative^=1);r&&(r.words[_]=R)}return r&&r.strip(),s.strip(),t!=="div"&&i!==0&&s.iushrn(i),{div:r||null,mod:s}},o.prototype.divmod=function(e,t,i){if(u(!e.isZero()),this.isZero())return{div:new o(0),mod:new o(0)};var s,l,c;return this.negative!==0&&e.negative===0?(c=this.neg().divmod(e,t),t!=="mod"&&(s=c.div.neg()),t!=="div"&&(l=c.mod.neg(),i&&l.negative!==0&&l.iadd(e)),{div:s,mod:l}):this.negative===0&&e.negative!==0?(c=this.divmod(e.neg(),t),t!=="mod"&&(s=c.div.neg()),{div:s,mod:c.mod}):this.negative&e.negative?(c=this.neg().divmod(e.neg(),t),t!=="div"&&(l=c.mod.neg(),i&&l.negative!==0&&l.isub(e)),{div:c.div,mod:l}):e.length>this.length||this.cmp(e)<0?{div:new o(0),mod:this}:e.length===1?t==="div"?{div:this.divn(e.words[0]),mod:null}:t==="mod"?{div:null,mod:new o(this.modn(e.words[0]))}:{div:this.divn(e.words[0]),mod:new o(this.modn(e.words[0]))}:this._wordDiv(e,t)},o.prototype.div=function(e){return this.divmod(e,"div",!1).div},o.prototype.mod=function(e){return this.divmod(e,"mod",!1).mod},o.prototype.umod=function(e){return this.divmod(e,"mod",!0).mod},o.prototype.divRound=function(e){var t=this.divmod(e);if(t.mod.isZero())return t.div;var i=t.div.negative!==0?t.mod.isub(e):t.mod,s=e.ushrn(1),l=e.andln(1),c=i.cmp(s);return c<0||l===1&&c===0?t.div:t.div.negative!==0?t.div.isubn(1):t.div.iaddn(1)},o.prototype.modn=function(e){u(e<=67108863);for(var t=(1<<26)%e,i=0,s=this.length-1;s>=0;s--)i=(t*i+(this.words[s]|0))%e;return i},o.prototype.idivn=function(e){u(e<=67108863);for(var t=0,i=this.length-1;i>=0;i--){var s=(this.words[i]|0)+t*67108864;this.words[i]=s/e|0,t=s%e}return this.strip()},o.prototype.divn=function(e){return this.clone().idivn(e)},o.prototype.egcd=function(e){u(e.negative===0),u(!e.isZero());var t=this,i=e.clone();t.negative!==0?t=t.umod(e):t=t.clone();for(var s=new o(1),l=new o(0),c=new o(0),p=new o(1),d=0;t.isEven()&&i.isEven();)t.iushrn(1),i.iushrn(1),++d;for(var r=i.clone(),f=t.clone();!t.isZero();){for(var m=0,_=1;!(t.words[0]&_)&&m<26;++m,_<<=1);if(m>0)for(t.iushrn(m);m-- >0;)(s.isOdd()||l.isOdd())&&(s.iadd(r),l.isub(f)),s.iushrn(1),l.iushrn(1);for(var R=0,C=1;!(i.words[0]&C)&&R<26;++R,C<<=1);if(R>0)for(i.iushrn(R);R-- >0;)(c.isOdd()||p.isOdd())&&(c.iadd(r),p.isub(f)),c.iushrn(1),p.iushrn(1);t.cmp(i)>=0?(t.isub(i),s.isub(c),l.isub(p)):(i.isub(t),c.isub(s),p.isub(l))}return{a:c,b:p,gcd:i.iushln(d)}},o.prototype._invmp=function(e){u(e.negative===0),u(!e.isZero());var t=this,i=e.clone();t.negative!==0?t=t.umod(e):t=t.clone();for(var s=new o(1),l=new o(0),c=i.clone();t.cmpn(1)>0&&i.cmpn(1)>0;){for(var p=0,d=1;!(t.words[0]&d)&&p<26;++p,d<<=1);if(p>0)for(t.iushrn(p);p-- >0;)s.isOdd()&&s.iadd(c),s.iushrn(1);for(var r=0,f=1;!(i.words[0]&f)&&r<26;++r,f<<=1);if(r>0)for(i.iushrn(r);r-- >0;)l.isOdd()&&l.iadd(c),l.iushrn(1);t.cmp(i)>=0?(t.isub(i),s.isub(l)):(i.isub(t),l.isub(s))}var m;return t.cmpn(1)===0?m=s:m=l,m.cmpn(0)<0&&m.iadd(e),m},o.prototype.gcd=function(e){if(this.isZero())return e.abs();if(e.isZero())return this.abs();var t=this.clone(),i=e.clone();t.negative=0,i.negative=0;for(var s=0;t.isEven()&&i.isEven();s++)t.iushrn(1),i.iushrn(1);do{for(;t.isEven();)t.iushrn(1);for(;i.isEven();)i.iushrn(1);var l=t.cmp(i);if(l<0){var c=t;t=i,i=c}else if(l===0||i.cmpn(1)===0)break;t.isub(i)}while(!0);return i.iushln(s)},o.prototype.invm=function(e){return this.egcd(e).a.umod(e)},o.prototype.isEven=function(){return(this.words[0]&1)===0},o.prototype.isOdd=function(){return(this.words[0]&1)===1},o.prototype.andln=function(e){return this.words[0]&e},o.prototype.bincn=function(e){u(typeof e=="number");var t=e%26,i=(e-t)/26,s=1<<t;if(this.length<=i)return this._expand(i+1),this.words[i]|=s,this;for(var l=s,c=i;l!==0&&c<this.length;c++){var p=this.words[c]|0;p+=l,l=p>>>26,p&=67108863,this.words[c]=p}return l!==0&&(this.words[c]=l,this.length++),this},o.prototype.isZero=function(){return this.length===1&&this.words[0]===0},o.prototype.cmpn=function(e){var t=e<0;if(this.negative!==0&&!t)return-1;if(this.negative===0&&t)return 1;this.strip();var i;if(this.length>1)i=1;else{t&&(e=-e),u(e<=67108863,"Number is too big");var s=this.words[0]|0;i=s===e?0:s<e?-1:1}return this.negative!==0?-i|0:i},o.prototype.cmp=function(e){if(this.negative!==0&&e.negative===0)return-1;if(this.negative===0&&e.negative!==0)return 1;var t=this.ucmp(e);return this.negative!==0?-t|0:t},o.prototype.ucmp=function(e){if(this.length>e.length)return 1;if(this.length<e.length)return-1;for(var t=0,i=this.length-1;i>=0;i--){var s=this.words[i]|0,l=e.words[i]|0;if(s!==l){s<l?t=-1:s>l&&(t=1);break}}return t},o.prototype.gtn=function(e){return this.cmpn(e)===1},o.prototype.gt=function(e){return this.cmp(e)===1},o.prototype.gten=function(e){return this.cmpn(e)>=0},o.prototype.gte=function(e){return this.cmp(e)>=0},o.prototype.ltn=function(e){return this.cmpn(e)===-1},o.prototype.lt=function(e){return this.cmp(e)===-1},o.prototype.lten=function(e){return this.cmpn(e)<=0},o.prototype.lte=function(e){return this.cmp(e)<=0},o.prototype.eqn=function(e){return this.cmpn(e)===0},o.prototype.eq=function(e){return this.cmp(e)===0},o.red=function(e){return new ct(e)},o.prototype.toRed=function(e){return u(!this.red,"Already a number in reduction context"),u(this.negative===0,"red works only with positives"),e.convertTo(this)._forceRed(e)},o.prototype.fromRed=function(){return u(this.red,"fromRed works only with numbers in reduction context"),this.red.convertFrom(this)},o.prototype._forceRed=function(e){return this.red=e,this},o.prototype.forceRed=function(e){return u(!this.red,"Already a number in reduction context"),this._forceRed(e)},o.prototype.redAdd=function(e){return u(this.red,"redAdd works only with red numbers"),this.red.add(this,e)},o.prototype.redIAdd=function(e){return u(this.red,"redIAdd works only with red numbers"),this.red.iadd(this,e)},o.prototype.redSub=function(e){return u(this.red,"redSub works only with red numbers"),this.red.sub(this,e)},o.prototype.redISub=function(e){return u(this.red,"redISub works only with red numbers"),this.red.isub(this,e)},o.prototype.redShl=function(e){return u(this.red,"redShl works only with red numbers"),this.red.shl(this,e)},o.prototype.redMul=function(e){return u(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.mul(this,e)},o.prototype.redIMul=function(e){return u(this.red,"redMul works only with red numbers"),this.red._verify2(this,e),this.red.imul(this,e)},o.prototype.redSqr=function(){return u(this.red,"redSqr works only with red numbers"),this.red._verify1(this),this.red.sqr(this)},o.prototype.redISqr=function(){return u(this.red,"redISqr works only with red numbers"),this.red._verify1(this),this.red.isqr(this)},o.prototype.redSqrt=function(){return u(this.red,"redSqrt works only with red numbers"),this.red._verify1(this),this.red.sqrt(this)},o.prototype.redInvm=function(){return u(this.red,"redInvm works only with red numbers"),this.red._verify1(this),this.red.invm(this)},o.prototype.redNeg=function(){return u(this.red,"redNeg works only with red numbers"),this.red._verify1(this),this.red.neg(this)},o.prototype.redPow=function(e){return u(this.red&&!e.red,"redPow(normalNum)"),this.red._verify1(this),this.red.pow(this,e)};var S={k256:null,p224:null,p192:null,p25519:null};function T(g,e){this.name=g,this.p=new o(e,16),this.n=this.p.bitLength(),this.k=new o(1).iushln(this.n).isub(this.p),this.tmp=this._tmp()}T.prototype._tmp=function(){var e=new o(null);return e.words=new Array(Math.ceil(this.n/13)),e},T.prototype.ireduce=function(e){var t=e,i;do this.split(t,this.tmp),t=this.imulK(t),t=t.iadd(this.tmp),i=t.bitLength();while(i>this.n);var s=i<this.n?-1:t.ucmp(this.p);return s===0?(t.words[0]=0,t.length=1):s>0?t.isub(this.p):t.strip(),t},T.prototype.split=function(e,t){e.iushrn(this.n,0,t)},T.prototype.imulK=function(e){return e.imul(this.k)};function O(){T.call(this,"k256","ffffffff ffffffff ffffffff ffffffff ffffffff ffffffff fffffffe fffffc2f")}v(O,T),O.prototype.split=function(e,t){for(var i=4194303,s=Math.min(e.length,9),l=0;l<s;l++)t.words[l]=e.words[l];if(t.length=s,e.length<=9){e.words[0]=0,e.length=1;return}var c=e.words[9];for(t.words[t.length++]=c&i,l=10;l<e.length;l++){var p=e.words[l]|0;e.words[l-10]=(p&i)<<4|c>>>22,c=p}c>>>=22,e.words[l-10]=c,c===0&&e.length>10?e.length-=10:e.length-=9},O.prototype.imulK=function(e){e.words[e.length]=0,e.words[e.length+1]=0,e.length+=2;for(var t=0,i=0;i<e.length;i++){var s=e.words[i]|0;t+=s*977,e.words[i]=t&67108863,t=s*64+(t/67108864|0)}return e.words[e.length-1]===0&&(e.length--,e.words[e.length-1]===0&&e.length--),e};function W(){T.call(this,"p224","ffffffff ffffffff ffffffff ffffffff 00000000 00000000 00000001")}v(W,T);function K(){T.call(this,"p192","ffffffff ffffffff ffffffff fffffffe ffffffff ffffffff")}v(K,T);function pt(){T.call(this,"25519","7fffffffffffffff ffffffffffffffff ffffffffffffffff ffffffffffffffed")}v(pt,T),pt.prototype.imulK=function(e){for(var t=0,i=0;i<e.length;i++){var s=(e.words[i]|0)*19+t,l=s&67108863;s>>>=26,e.words[i]=l,t=s}return t!==0&&(e.words[e.length++]=t),e},o._prime=function(e){if(S[e])return S[e];var t;if(e==="k256")t=new O;else if(e==="p224")t=new W;else if(e==="p192")t=new K;else if(e==="p25519")t=new pt;else throw new Error("Unknown prime "+e);return S[e]=t,t};function ct(g){if(typeof g=="string"){var e=o._prime(g);this.m=e.p,this.prime=e}else u(g.gtn(1),"modulus must be greater than 1"),this.m=g,this.prime=null}ct.prototype._verify1=function(e){u(e.negative===0,"red works only with positives"),u(e.red,"red works only with red numbers")},ct.prototype._verify2=function(e,t){u((e.negative|t.negative)===0,"red works only with positives"),u(e.red&&e.red===t.red,"red works only with red numbers")},ct.prototype.imod=function(e){return this.prime?this.prime.ireduce(e)._forceRed(this):e.umod(this.m)._forceRed(this)},ct.prototype.neg=function(e){return e.isZero()?e.clone():this.m.sub(e)._forceRed(this)},ct.prototype.add=function(e,t){this._verify2(e,t);var i=e.add(t);return i.cmp(this.m)>=0&&i.isub(this.m),i._forceRed(this)},ct.prototype.iadd=function(e,t){this._verify2(e,t);var i=e.iadd(t);return i.cmp(this.m)>=0&&i.isub(this.m),i},ct.prototype.sub=function(e,t){this._verify2(e,t);var i=e.sub(t);return i.cmpn(0)<0&&i.iadd(this.m),i._forceRed(this)},ct.prototype.isub=function(e,t){this._verify2(e,t);var i=e.isub(t);return i.cmpn(0)<0&&i.iadd(this.m),i},ct.prototype.shl=function(e,t){return this._verify1(e),this.imod(e.ushln(t))},ct.prototype.imul=function(e,t){return this._verify2(e,t),this.imod(e.imul(t))},ct.prototype.mul=function(e,t){return this._verify2(e,t),this.imod(e.mul(t))},ct.prototype.isqr=function(e){return this.imul(e,e.clone())},ct.prototype.sqr=function(e){return this.mul(e,e)},ct.prototype.sqrt=function(e){if(e.isZero())return e.clone();var t=this.m.andln(3);if(u(t%2===1),t===3){var i=this.m.add(new o(1)).iushrn(2);return this.pow(e,i)}for(var s=this.m.subn(1),l=0;!s.isZero()&&s.andln(1)===0;)l++,s.iushrn(1);u(!s.isZero());var c=new o(1).toRed(this),p=c.redNeg(),d=this.m.subn(1).iushrn(1),r=this.m.bitLength();for(r=new o(2*r*r).toRed(this);this.pow(r,d).cmp(p)!==0;)r.redIAdd(p);for(var f=this.pow(r,s),m=this.pow(e,s.addn(1).iushrn(1)),_=this.pow(e,s),R=l;_.cmp(c)!==0;){for(var C=_,F=0;C.cmp(c)!==0;F++)C=C.redSqr();u(F<R);var z=this.pow(f,new o(1).iushln(R-F-1));m=m.redMul(z),f=z.redSqr(),_=_.redMul(f),R=F}return m},ct.prototype.invm=function(e){var t=e._invmp(this.m);return t.negative!==0?(t.negative=0,this.imod(t).redNeg()):this.imod(t)},ct.prototype.pow=function(e,t){if(t.isZero())return new o(1).toRed(this);if(t.cmpn(1)===0)return e.clone();var i=4,s=new Array(1<<i);s[0]=new o(1).toRed(this),s[1]=e;for(var l=2;l<s.length;l++)s[l]=this.mul(s[l-1],e);var c=s[0],p=0,d=0,r=t.bitLength()%26;for(r===0&&(r=26),l=t.length-1;l>=0;l--){for(var f=t.words[l],m=r-1;m>=0;m--){var _=f>>m&1;if(c!==s[0]&&(c=this.sqr(c)),_===0&&p===0){d=0;continue}p<<=1,p|=_,d++,!(d!==i&&(l!==0||m!==0))&&(c=this.mul(c,s[p]),d=0,p=0)}r=26}return c},ct.prototype.convertTo=function(e){var t=e.umod(this.m);return t===e?t.clone():t},ct.prototype.convertFrom=function(e){var t=e.clone();return t.red=null,t},o.mont=function(e){return new dt(e)};function dt(g){ct.call(this,g),this.shift=this.m.bitLength(),this.shift%26!==0&&(this.shift+=26-this.shift%26),this.r=new o(1).iushln(this.shift),this.r2=this.imod(this.r.sqr()),this.rinv=this.r._invmp(this.m),this.minv=this.rinv.mul(this.r).isubn(1).div(this.m),this.minv=this.minv.umod(this.r),this.minv=this.r.sub(this.minv)}v(dt,ct),dt.prototype.convertTo=function(e){return this.imod(e.ushln(this.shift))},dt.prototype.convertFrom=function(e){var t=this.imod(e.mul(this.rinv));return t.red=null,t},dt.prototype.imul=function(e,t){if(e.isZero()||t.isZero())return e.words[0]=0,e.length=1,e;var i=e.imul(t),s=i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),l=i.isub(s).iushrn(this.shift),c=l;return l.cmp(this.m)>=0?c=l.isub(this.m):l.cmpn(0)<0&&(c=l.iadd(this.m)),c._forceRed(this)},dt.prototype.mul=function(e,t){if(e.isZero()||t.isZero())return new o(0)._forceRed(this);var i=e.mul(t),s=i.maskn(this.shift).mul(this.minv).imaskn(this.shift).mul(this.m),l=i.isub(s).iushrn(this.shift),c=l;return l.cmp(this.m)>=0?c=l.isub(this.m):l.cmpn(0)<0&&(c=l.iadd(this.m)),c._forceRed(this)},dt.prototype.invm=function(e){var t=this.imod(e._invmp(this.m).mul(this.r2));return t._forceRed(this)}})(a,Vt)})(d0);d0.exports;function f3(a,n){return Au(a,!n)}const Rs=Ns;function o3(a,n){let h;const u=a3[a];return u&&(h=`https://${u}.infura.io/v3/${n}`),h}function s3(a,n){let h;const u=o3(a,n.infuraId);return n.custom&&n.custom[a]?h=n.custom[a]:u&&(h=u),h}function h3(a){return!(a&&a.length)}function u3(a,n){return Eu(a,n)}function Bs(a){return!h3(a)&&!u3(a[0])&&(a[0]=f3(a[0])),a}var l3={};(function(a){const n=Ki,h=Zi,u=Hi,v=x=>x==null;function o(x){switch(x.arrayFormat){case"index":return A=>(S,T)=>{const O=S.length;return T===void 0||x.skipNull&&T===null||x.skipEmptyString&&T===""?S:T===null?[...S,[b(A,x),"[",O,"]"].join("")]:[...S,[b(A,x),"[",b(O,x),"]=",b(T,x)].join("")]};case"bracket":return A=>(S,T)=>T===void 0||x.skipNull&&T===null||x.skipEmptyString&&T===""?S:T===null?[...S,[b(A,x),"[]"].join("")]:[...S,[b(A,x),"[]=",b(T,x)].join("")];case"comma":case"separator":return A=>(S,T)=>T==null||T.length===0?S:S.length===0?[[b(A,x),"=",b(T,x)].join("")]:[[S,b(T,x)].join(x.arrayFormatSeparator)];default:return A=>(S,T)=>T===void 0||x.skipNull&&T===null||x.skipEmptyString&&T===""?S:T===null?[...S,b(A,x)]:[...S,[b(A,x),"=",b(T,x)].join("")]}}function w(x){let A;switch(x.arrayFormat){case"index":return(S,T,O)=>{if(A=/\[(\d*)\]$/.exec(S),S=S.replace(/\[\d*\]$/,""),!A){O[S]=T;return}O[S]===void 0&&(O[S]={}),O[S][A[1]]=T};case"bracket":return(S,T,O)=>{if(A=/(\[\])$/.exec(S),S=S.replace(/\[\]$/,""),!A){O[S]=T;return}if(O[S]===void 0){O[S]=[T];return}O[S]=[].concat(O[S],T)};case"comma":case"separator":return(S,T,O)=>{const K=typeof T=="string"&&T.split("").indexOf(x.arrayFormatSeparator)>-1?T.split(x.arrayFormatSeparator).map(pt=>B(pt,x)):T===null?T:B(T,x);O[S]=K};default:return(S,T,O)=>{if(O[S]===void 0){O[S]=T;return}O[S]=[].concat(O[S],T)}}}function y(x){if(typeof x!="string"||x.length!==1)throw new TypeError("arrayFormatSeparator must be single character string")}function b(x,A){return A.encode?A.strict?n(x):encodeURIComponent(x):x}function B(x,A){return A.decode?h(x):x}function k(x){return Array.isArray(x)?x.sort():typeof x=="object"?k(Object.keys(x)).sort((A,S)=>Number(A)-Number(S)).map(A=>x[A]):x}function L(x){const A=x.indexOf("#");return A!==-1&&(x=x.slice(0,A)),x}function q(x){let A="";const S=x.indexOf("#");return S!==-1&&(A=x.slice(S)),A}function $(x){x=L(x);const A=x.indexOf("?");return A===-1?"":x.slice(A+1)}function M(x,A){return A.parseNumbers&&!Number.isNaN(Number(x))&&typeof x=="string"&&x.trim()!==""?x=Number(x):A.parseBooleans&&x!==null&&(x.toLowerCase()==="true"||x.toLowerCase()==="false")&&(x=x.toLowerCase()==="true"),x}function N(x,A){A=Object.assign({decode:!0,sort:!0,arrayFormat:"none",arrayFormatSeparator:",",parseNumbers:!1,parseBooleans:!1},A),y(A.arrayFormatSeparator);const S=w(A),T=Object.create(null);if(typeof x!="string"||(x=x.trim().replace(/^[?#&]/,""),!x))return T;for(const O of x.split("&")){let[W,K]=u(A.decode?O.replace(/\+/g," "):O,"=");K=K===void 0?null:["comma","separator"].includes(A.arrayFormat)?K:B(K,A),S(B(W,A),K,T)}for(const O of Object.keys(T)){const W=T[O];if(typeof W=="object"&&W!==null)for(const K of Object.keys(W))W[K]=M(W[K],A);else T[O]=M(W,A)}return A.sort===!1?T:(A.sort===!0?Object.keys(T).sort():Object.keys(T).sort(A.sort)).reduce((O,W)=>{const K=T[W];return K&&typeof K=="object"&&!Array.isArray(K)?O[W]=k(K):O[W]=K,O},Object.create(null))}a.extract=$,a.parse=N,a.stringify=(x,A)=>{if(!x)return"";A=Object.assign({encode:!0,strict:!0,arrayFormat:"none",arrayFormatSeparator:","},A),y(A.arrayFormatSeparator);const S=K=>A.skipNull&&v(x[K])||A.skipEmptyString&&x[K]==="",T=o(A),O={};for(const K of Object.keys(x))S(K)||(O[K]=x[K]);const W=Object.keys(O);return A.sort!==!1&&W.sort(A.sort),W.map(K=>{const pt=x[K];return pt===void 0?"":pt===null?b(K,A):Array.isArray(pt)?pt.reduce(T(K),[]).join("&"):b(K,A)+"="+b(pt,A)}).filter(K=>K.length>0).join("&")},a.parseUrl=(x,A)=>{A=Object.assign({decode:!0},A);const[S,T]=u(x,"#");return Object.assign({url:S.split("?")[0]||"",query:N($(x),A)},A&&A.parseFragmentIdentifier&&T?{fragmentIdentifier:B(T,A)}:{})},a.stringifyUrl=(x,A)=>{A=Object.assign({encode:!0,strict:!0},A);const S=L(x.url).split("?")[0]||"",T=a.extract(x.url),O=a.parse(T,{sort:!1}),W=Object.assign(O,x.query);let K=a.stringify(W,A);K&&(K=`?${K}`);let pt=q(x.url);return x.fragmentIdentifier&&(pt=`#${b(x.fragmentIdentifier,A)}`),`${S}${K}${pt}`}})(l3);const c3=Bp,d3=Vp,v3=jp,p3=Dm,m3=K1,g3=ny,y3=gy;class L3 extends c3{constructor(n){if(super({pollingInterval:n.pollingInterval||8e3}),this.bridge="https://bridge.walletconnect.org",this.qrcode=!0,this.qrcodeModal=DM,this.qrcodeModalOptions=void 0,this.rpc=null,this.infuraId="",this.http=null,this.isConnecting=!1,this.connected=!1,this.connectCallbacks=[],this.accounts=[],this.chainId=1,this.rpcUrl="",this.enable=async()=>{const h=await this.getWalletConnector();if(h)return this.start(),this.subscribeWalletConnector(),h.accounts;throw new Error("Failed to connect to WalleConnect")},this.request=async h=>this.send(h),this.send=async(h,u)=>{var v;if(typeof h=="string"){const o=h;let w=u;return o==="personal_sign"&&(w=Bs(w)),this.sendAsyncPromise(o,w)}if(h=Object.assign({id:Rs(),jsonrpc:"2.0"},h),h.method==="personal_sign"&&(h.params=Bs(h.params)),u){this.sendAsync(h,u);return}if(h.method==="eth_signTypedData_v4"&&((v=this.walletMeta)===null||v===void 0?void 0:v.name)==="MetaMask"){const{result:o}=await this.handleOtherRequests(h);return o}else return this.sendAsyncPromise(h.method,h.params)},this.onConnect=h=>{this.connectCallbacks.push(h)},this.triggerConnect=h=>{this.connectCallbacks&&this.connectCallbacks.length&&this.connectCallbacks.forEach(u=>u(h))},this.bridge=n.connector?n.connector.bridge:n.bridge||"https://bridge.walletconnect.org",this.qrcode=typeof n.qrcode>"u"||n.qrcode!==!1,this.qrcodeModal=n.qrcodeModal||this.qrcodeModal,this.qrcodeModalOptions=n.qrcodeModalOptions,this.wc=n.connector||new O2({bridge:this.bridge,qrcodeModal:this.qrcode?this.qrcodeModal:void 0,qrcodeModalOptions:this.qrcodeModalOptions,storageId:n==null?void 0:n.storageId,signingMethods:n==null?void 0:n.signingMethods,clientMeta:n==null?void 0:n.clientMeta}),this.rpc=n.rpc||null,!this.rpc&&(!n.infuraId||typeof n.infuraId!="string"||!n.infuraId.trim()))throw new Error("Missing one of the required parameters: rpc or infuraId");this.infuraId=n.infuraId||"",this.chainId=(n==null?void 0:n.chainId)||this.chainId,this.initialize()}get isWalletConnect(){return!0}get connector(){return this.wc}get walletMeta(){return this.wc.peerMeta}async disconnect(){this.close()}async close(){await(await this.getWalletConnector({disableSessionCreation:!0})).killSession(),await this.onDisconnect()}async handleRequest(n){try{let h,u=null;const v=await this.getWalletConnector();switch(n.method){case"wc_killSession":await this.close(),u=null;break;case"eth_accounts":u=v.accounts;break;case"eth_coinbase":u=v.accounts[0];break;case"eth_chainId":u=v.chainId;break;case"net_version":u=v.chainId;break;case"eth_uninstallFilter":this.sendAsync(n,o=>o),u=!0;break;default:h=await this.handleOtherRequests(n)}return h||this.formatResponse(n,u)}catch(h){throw this.emit("error",h),h}}async handleOtherRequests(n){if(!n3.includes(n.method)&&n.method.startsWith("eth_"))return this.handleReadRequests(n);const u=await(await this.getWalletConnector()).sendCustomRequest(n);return this.formatResponse(n,u)}async handleReadRequests(n){if(!this.http){const h=new Error("HTTP Connection not available");throw this.emit("error",h),h}return this.http.send(n)}formatResponse(n,h){return{id:n.id,jsonrpc:n.jsonrpc,result:h}}getWalletConnector(n={}){const{disableSessionCreation:h=!1}=n;return new Promise((u,v)=>{const o=this.wc;this.isConnecting?this.onConnect(w=>u(w)):!o.connected&&!h?(this.isConnecting=!0,o.on("modal_closed",()=>{v(new Error("User closed modal"))}),o.createSession({chainId:this.chainId}).then(()=>{o.on("connect",(w,y)=>{if(w)return this.isConnecting=!1,v(w);this.isConnecting=!1,this.connected=!0,y&&this.updateState(y.params[0]),this.emit("connect"),this.triggerConnect(o),u(o)})}).catch(w=>{this.isConnecting=!1,v(w)})):(this.connected||(this.connected=!0,this.updateState(o.session)),u(o))})}async subscribeWalletConnector(){const n=await this.getWalletConnector();n.on("disconnect",h=>{if(h){this.emit("error",h);return}this.onDisconnect()}),n.on("session_update",(h,u)=>{if(h){this.emit("error",h);return}this.updateState(u.params[0])})}async onDisconnect(){await this.stop(),this.emit("close",1e3,"Connection closed"),this.emit("disconnect",1e3,"Connection disconnected"),this.connected=!1}async updateState(n){const{accounts:h,chainId:u,networkId:v,rpcUrl:o}=n;(!this.accounts||h&&this.accounts!==h)&&(this.accounts=h,this.emit("accountsChanged",h)),(!this.chainId||u&&this.chainId!==u)&&(this.chainId=u,this.emit("chainChanged",u)),(!this.networkId||v&&this.networkId!==v)&&(this.networkId=v,this.emit("networkChanged",v)),this.updateRpcUrl(this.chainId,o||"")}updateRpcUrl(n,h=""){const u={infuraId:this.infuraId,custom:this.rpc||void 0};h=h||s3(n,u),h?(this.rpcUrl=h,this.updateHttpConnection()):this.emit("error",new Error(`No RPC Url available for chainId: ${n}`))}updateHttpConnection(){this.rpcUrl&&(this.http=new i3(this.rpcUrl),this.http.on("payload",n=>this.emit("payload",n)),this.http.on("error",n=>this.emit("error",n)))}sendAsyncPromise(n,h){return new Promise((u,v)=>{this.sendAsync({id:Rs(),jsonrpc:"2.0",method:n,params:h||[]},(o,w)=>{if(o){v(o);return}u(w.result)})})}initialize(){this.updateRpcUrl(this.chainId),this.addProvider(new v3({eth_hashrate:"0x00",eth_mining:!1,eth_syncing:!0,net_listening:!0,web3_clientVersion:"WalletConnect/v1.x.x/javascript"})),this.addProvider(new d3),this.addProvider(new y3),this.addProvider(new p3),this.addProvider(new g3),this.addProvider(new m3(this.configWallet())),this.addProvider({handleRequest:async(n,h,u)=>{try{const{error:v,result:o}=await this.handleRequest(n);u(v,o)}catch(v){u(v)}},setEngine:n=>n})}configWallet(){return{getAccounts:async n=>{try{const u=(await this.getWalletConnector()).accounts;u&&u.length?n(null,u):n(new Error("Failed to get accounts"))}catch(h){n(h)}},processMessage:async(n,h)=>{try{const v=await(await this.getWalletConnector()).signMessage([n.from,n.data]);h(null,v)}catch(u){h(u)}},processPersonalMessage:async(n,h)=>{try{const v=await(await this.getWalletConnector()).signPersonalMessage([n.data,n.from]);h(null,v)}catch(u){h(u)}},processSignTransaction:async(n,h)=>{try{const v=await(await this.getWalletConnector()).signTransaction(n);h(null,v)}catch(u){h(u)}},processTransaction:async(n,h)=>{try{const v=await(await this.getWalletConnector()).sendTransaction(n);h(null,v)}catch(u){h(u)}},processTypedMessage:async(n,h)=>{try{const v=await(await this.getWalletConnector()).signTypedData([n.from,n.data]);h(null,v)}catch(u){h(u)}}}}}export{L3 as default};
|