1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6709],{6709:function(t,e,r){r.d(e,{secp256k1:function(){return tq}});var n={};r.r(n),r.d(n,{Fy:function(){return F},uw:function(){return E},gk:function(){return m},Dd:function(){return P},dQ:function(){return C},ci:function(){return B},bytesToNumberBE:function(){return O},ty:function(){return q},eV:function(){return H},n$:function(){return _},ql:function(){return L},hexToBytes:function(){return S},Z2:function(){return z},_t:function(){return w},H9:function(){return j},tL:function(){return N},S5:function(){return R},uz:function(){return v},FF:function(){return V}});var i=r(12518),o=r(91220);class s extends o.kb{constructor(t,e,r,n){super(),this.blockLen=t,this.outputLen=e,this.padOffset=r,this.isLE=n,this.finished=!1,this.length=0,this.pos=0,this.destroyed=!1,this.buffer=new Uint8Array(t),this.view=(0,o.GL)(this.buffer)}update(t){(0,i.$h)(this);let{view:e,buffer:r,blockLen:n}=this,s=(t=(0,o.O0)(t)).length;for(let i=0;i<s;){let l=Math.min(n-this.pos,s-i);if(l===n){let e=(0,o.GL)(t);for(;n<=s-i;i+=n)this.process(e,i);continue}r.set(t.subarray(i,i+l),this.pos),this.pos+=l,i+=l,this.pos===n&&(this.process(e,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){(0,i.$h)(this),(0,i.eB)(t,this),this.finished=!0;let{buffer:e,view:r,blockLen:n,isLE:s}=this,{pos:l}=this;e[l++]=128,this.buffer.subarray(l).fill(0),this.padOffset>n-l&&(this.process(r,0),l=0);for(let t=l;t<n;t++)e[t]=0;!function(t,e,r,n){if("function"==typeof t.setBigUint64)return t.setBigUint64(e,r,n);let i=BigInt(32),o=BigInt(4294967295),s=Number(r>>i&o),l=Number(r&o),f=n?4:0,u=n?0:4;t.setUint32(e+f,s,n),t.setUint32(e+u,l,n)}(r,n-8,BigInt(8*this.length),s),this.process(r,0);let f=(0,o.GL)(t),u=this.outputLen;if(u%4)throw Error("_sha2: outputLen should be aligned to 32bit");let a=u/4,h=this.get();if(a>h.length)throw Error("_sha2: outputLen bigger than state");for(let t=0;t<a;t++)f.setUint32(4*t,h[t],s)}digest(){let{buffer:t,outputLen:e}=this;this.digestInto(t);let r=t.slice(0,e);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());let{blockLen:e,buffer:r,length:n,finished:i,destroyed:o,pos:s}=this;return t.length=n,t.pos=s,t.finished=i,t.destroyed=o,n%e&&t.buffer.set(r),t}}let l=new Uint32Array([1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298]),f=new Uint32Array([1779033703,3144134277,1013904242,2773480762,1359893119,2600822924,528734635,1541459225]),u=new Uint32Array(64);class a extends s{constructor(){super(64,32,8,!1),this.A=0|f[0],this.B=0|f[1],this.C=0|f[2],this.D=0|f[3],this.E=0|f[4],this.F=0|f[5],this.G=0|f[6],this.H=0|f[7]}get(){let{A:t,B:e,C:r,D:n,E:i,F:o,G:s,H:l}=this;return[t,e,r,n,i,o,s,l]}set(t,e,r,n,i,o,s,l){this.A=0|t,this.B=0|e,this.C=0|r,this.D=0|n,this.E=0|i,this.F=0|o,this.G=0|s,this.H=0|l}process(t,e){for(let r=0;r<16;r++,e+=4)u[r]=t.getUint32(e,!1);for(let t=16;t<64;t++){let e=u[t-15],r=u[t-2],n=(0,o.np)(e,7)^(0,o.np)(e,18)^e>>>3,i=(0,o.np)(r,17)^(0,o.np)(r,19)^r>>>10;u[t]=i+u[t-7]+n+u[t-16]|0}let{A:r,B:n,C:i,D:s,E:f,F:a,G:h,H:d}=this;for(let t=0;t<64;t++){var c,g,p,y;let e=d+((0,o.np)(f,6)^(0,o.np)(f,11)^(0,o.np)(f,25))+((c=f)&a^~c&h)+l[t]+u[t]|0,w=((0,o.np)(r,2)^(0,o.np)(r,13)^(0,o.np)(r,22))+((g=r)&(p=n)^g&(y=i)^p&y)|0;d=h,h=a,a=f,f=s+e|0,s=i,i=n,n=r,r=e+w|0}r=r+this.A|0,n=n+this.B|0,i=i+this.C|0,s=s+this.D|0,f=f+this.E|0,a=a+this.F|0,h=h+this.G|0,d=d+this.H|0,this.set(r,n,i,s,f,a,h,d)}roundClean(){u.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}}let h=(0,o.hE)(()=>new a);class d extends o.kb{constructor(t,e){super(),this.finished=!1,this.destroyed=!1,(0,i.z3)(t);let r=(0,o.O0)(e);if(this.iHash=t.create(),"function"!=typeof this.iHash.update)throw Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;let n=this.blockLen,s=new Uint8Array(n);s.set(r.length>n?t.create().update(r).digest():r);for(let t=0;t<s.length;t++)s[t]^=54;this.iHash.update(s),this.oHash=t.create();for(let t=0;t<s.length;t++)s[t]^=106;this.oHash.update(s),s.fill(0)}update(t){return(0,i.$h)(this),this.iHash.update(t),this}digestInto(t){(0,i.$h)(this),(0,i.gk)(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){let t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));let{oHash:e,iHash:r,finished:n,destroyed:i,blockLen:o,outputLen:s}=this;return t.finished=n,t.destroyed=i,t.blockLen=o,t.outputLen=s,t.oHash=e._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}let c=(t,e,r)=>new d(t,e).update(r).digest();c.create=(t,e)=>new d(t,e);let g=BigInt(0),p=BigInt(1),y=BigInt(2);function w(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&"Uint8Array"===t.constructor.name}function m(t){if(!w(t))throw Error("Uint8Array expected")}function E(t,e){if("boolean"!=typeof e)throw Error(t+" boolean expected, got "+e)}let b=Array.from({length:256},(t,e)=>e.toString(16).padStart(2,"0"));function B(t){m(t);let e="";for(let r=0;r<t.length;r++)e+=b[t[r]];return e}function v(t){let e=t.toString(16);return 1&e.length?"0"+e:e}function x(t){if("string"!=typeof t)throw Error("hex string expected, got "+typeof t);return""===t?g:BigInt("0x"+t)}let A={_0:48,_9:57,A:65,F:70,a:97,f:102};function I(t){return t>
1=A._0&&t<=A._9?t-A._0:t>=A.A&&t<=A.F?t-(A.A-10):t>=A.a&&t<=A.f?t-(A.a-10):void 0}function S(t){if("string"!=typeof t)throw Error("hex string expected, got "+typeof t);let e=t.length,r=e/2;if(e%2)throw Error("hex string expected, got unpadded hex of length "+e);let n=new Uint8Array(r);for(let e=0,i=0;e<r;e++,i+=2){let r=I(t.charCodeAt(i)),o=I(t.charCodeAt(i+1));if(void 0===r||void 0===o)throw Error('hex string expected, got non-hex character "'+(t[i]+t[i+1])+'" at index '+i);n[e]=16*r+o}return n}function O(t){return x(B(t))}function q(t){return m(t),x(B(Uint8Array.from(t).reverse()))}function N(t,e){return S(t.toString(16).padStart(2*e,"0"))}function R(t,e){return N(t,e).reverse()}function L(t,e,r){let n;if("string"==typeof e)try{n=S(e)}catch(e){throw Error(t+" must be hex string or Uint8Array, cause: "+e)}else if(w(e))n=Uint8Array.from(e);else throw Error(t+" must be hex string or Uint8Array");let i=n.length;if("number"==typeof r&&i!==r)throw Error(t+" of length "+r+" expected, got "+i);return n}function H(...t){let e=0;for(let r=0;r<t.length;r++){let n=t[r];m(n),e+=n.length}let r=new Uint8Array(e);for(let e=0,n=0;e<t.length;e++){let i=t[e];r.set(i,n),n+=i.length}return r}let U=t=>"bigint"==typeof t&&g<=t;function z(t,e,r){return U(t)&&U(e)&&U(r)&&e<=t&&t<r}function F(t,e,r,n){if(!z(e,r,n))throw Error("expected valid "+t+": "+r+" <= n < "+n+", got "+e)}function P(t){let e;for(e=0;t>g;t>>=p,e+=1);return e}let C=t=>(y<<BigInt(t-1))-p,Z=t=>new Uint8Array(t),k=t=>Uint8Array.from(t);function _(t,e,r){if("number"!=typeof t||t<2)throw Error("hashLen must be a number");if("number"!=typeof e||e<2)throw Error("qByteLen must be a number");if("function"!=typeof r)throw Error("hmacFn must be a function");let n=Z(t),i=Z(t),o=0,s=()=>{n.fill(1),i.fill(0),o=0},l=(...t)=>r(i,n,...t),f=(t=Z())=>{i=l(k([0]),t),n=l(),0!==t.length&&(i=l(k([1]),t),n=l())},u=()=>{if(o++>=1e3)throw Error("drbg: tried 1000 values");let t=0,r=[];for(;t<e;){let e=(n=l()).slice();r.push(e),t+=n.length}return H(...r)};return(t,e)=>{let r;for(s(),f(t);!(r=e(u()));)f();return s(),r}}let T={bigint:t=>"bigint"==typeof t,function:t=>"function"==typeof t,boolean:t=>"boolean"==typeof t,string:t=>"string"==typeof t,stringOrUint8Array:t=>"string"==typeof t||w(t),isSafeInteger:t=>Number.isSafeInteger(t),array:t=>Array.isArray(t),field:(t,e)=>e.Fp.isValid(t),hash:t=>"function"==typeof t&&Number.isSafeInteger(t.outputLen)};function V(t,e,r={}){let n=(e,r,n)=>{let i=T[r];if("function"!=typeof i)throw Error("invalid validator function");let o=t[e];if((!n||void 0!==o)&&!i(o,t))throw Error("param "+String(e)+" is invalid. Expected "+r+", got "+o)};for(let[t,r]of Object.entries(e))n(t,r,!1);for(let[t,e]of Object.entries(r))n(t,e,!0);return t}function j(t){let e=new WeakMap;return(r,...n)=>{let i=e.get(r);if(void 0!==i)return i;let o=t(r,...n);return e.set(r,o),o}}let D=BigInt(0),G=BigInt(1),K=BigInt(2),M=BigInt(3),W=BigInt(4),Y=BigInt(5),$=BigInt(8);function Q(t,e){let r=t%e;return r>=D?r:e+r}function J(t,e,r){let n=t;for(;e-- >D;)n*=n,n%=r;return n}function X(t,e){if(t===D)throw Error("invert: expected non-zero number");if(e<=D)throw Error("invert: expected positive modulus, got "+e);let r=Q(t,e),n=e,i=D,o=G,s=G,l=D;for(;r!==D;){let t=n/r,e=n%r,f=i-s*t,u=o-l*t;n=r,r=e,i=s,o=l,s=f,l=u}if(n!==G)throw Error("invert: does not exist");return Q(i,e)}let tt=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function te(t,e){let r=void 0!==e?e:t.toString(2).length;return{nBitLength:r,nByteLength:Math.ceil(r/8)}}function tr(t,e,r=!1,n={}){let i;if(t<=D)throw Error("invalid field: expected ORDER > 0, got "+t);let{nBitLength:o,nByteLength:s}=te(t,e);if(s>2048)throw Error("invalid field: expected ORDER of <= 2048 bytes");let l=Object.freeze({ORDER:t,isLE:r,BITS:o,BYTES:s,MASK:C(o),ZERO:D,ONE:G,create:e=>Q(e,t),isValid:e=>{if("bigint"!=typeof e)throw Error("invalid field element: expected bigint, got "+typeof e);return D<=e&&e<t},is0:t=>t===D,isOdd:t=>(t&G)===G,neg:e=>Q(-e,t),eql:(t,e)=>t===e,sqr:e=>Q(e*e,t),add:(e,r)=>Q(e+r,t),sub:(e,r)=>Q(e-r,t),mul:(e,r)=>Q(e*r,t),pow:(t,e)=>(function(t,e,r){if(r<D)throw Error("invalid exponent, negatives unsupported");if(r===D)return t.ONE;if(r===G)return e;let n=t.ONE,i=e;for(;r>D;)r&G&&(n=t.mul(n,i)),i=t.sqr(i),r>>=G;return n})(l,t,e),div:(e,r)=>Q(e*X(r,t),t),sqrN:t=>t*t,addN:(t,e)=>t+e,subN:(t,e)=>t-e,mulN:(t,e)=>t*e,inv:e=>X(e,t),sqrt:n.sqrt||(e=>(i||(i=function(t){if(t%W===M){let e=(t+G)/W;return function(t,r){let n=t.pow(r,e);if(!t.eql(t.sqr(n),r))throw Error("Cannot find square root");return n}}if(t%$===Y){let e=(t-Y)/$;return function(t,r){let n=t.mul(r,K),i=t.pow(n,e),o=t.mul(r,i),s=t.mul(t.mul(o,K),i),l=t.mul(
1o,t.sub(s,t.ONE));if(!t.eql(t.sqr(l),r))throw Error("Cannot find square root");return l}}return function(t){let e,r,n;let i=(t-G)/K;for(e=t-G,r=0;e%K===D;e/=K,r++);for(n=K;n<t&&function(t,e,r){if(e<D)throw Error("invalid exponent, negatives unsupported");if(r<=D)throw Error("invalid modulus");if(r===G)return D;let n=G;for(;e>D;)e&G&&(n=n*t%r),t=t*t%r,e>>=G;return n}(n,i,t)!==t-G;n++)if(n>1e3)throw Error("Cannot find square root: likely non-prime P");if(1===r){let e=(t+G)/W;return function(t,r){let n=t.pow(r,e);if(!t.eql(t.sqr(n),r))throw Error("Cannot find square root");return n}}let o=(e+G)/K;return function(t,s){if(t.pow(s,i)===t.neg(t.ONE))throw Error("Cannot find square root");let l=r,f=t.pow(t.mul(t.ONE,n),e),u=t.pow(s,o),a=t.pow(s,e);for(;!t.eql(a,t.ONE);){if(t.eql(a,t.ZERO))return t.ZERO;let e=1;for(let r=t.sqr(a);e<l&&!t.eql(r,t.ONE);e++)r=t.sqr(r);let r=t.pow(f,G<<BigInt(l-e-1));f=t.sqr(r),u=t.mul(u,r),a=t.mul(a,f),l=e}return u}}(t)}(t)),i(l,e))),invertBatch:t=>(function(t,e){let r=Array(e.length),n=e.reduce((e,n,i)=>t.is0(n)?e:(r[i]=e,t.mul(e,n)),t.ONE),i=t.inv(n);return e.reduceRight((e,n,i)=>t.is0(n)?e:(r[i]=t.mul(e,r[i]),t.mul(e,n)),i),r})(l,t),cmov:(t,e,r)=>r?e:t,toBytes:t=>r?R(t,s):N(t,s),fromBytes:t=>{if(t.length!==s)throw Error("Field.fromBytes: expected "+s+" bytes, got "+t.length);return r?q(t):O(t)}});return Object.freeze(l)}function tn(t){if("bigint"!=typeof t)throw Error("field order must be bigint");return Math.ceil(t.toString(2).length/8)}function ti(t){let e=tn(t);return e+Math.ceil(e/2)}let to=BigInt(0),ts=BigInt(1);function tl(t,e){let r=e.negate();return t?r:e}function tf(t,e){if(!Number.isSafeInteger(t)||t<=0||t>e)throw Error("invalid window size, expected [1.."+e+"], got W="+t)}function tu(t,e){return tf(t,e),{windows:Math.ceil(e/t)+1,windowSize:2**(t-1)}}let ta=new WeakMap,th=new WeakMap;function td(t){return th.get(t)||1}function tc(t){return V(t.Fp,tt.reduce((t,e)=>(t[e]="function",t),{ORDER:"bigint",MASK:"bigint",BYTES:"isSafeInteger",BITS:"isSafeInteger"})),V(t,{n:"bigint",h:"bigint",Gx:"field",Gy:"field"},{nBitLength:"isSafeInteger",nByteLength:"isSafeInteger"}),Object.freeze({...te(t.n,t.nBitLength),...t,p:t.Fp.ORDER})}function tg(t){void 0!==t.lowS&&E("lowS",t.lowS),void 0!==t.prehash&&E("prehash",t.prehash)}let{bytesToNumberBE:tp,hexToBytes:ty}=n;class tw extends Error{constructor(t=""){super(t)}}let tm={Err:tw,_tlv:{encode:(t,e)=>{let{Err:r}=tm;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(1&e.length)throw new r("tlv.encode: unpadded data");let n=e.length/2,i=v(n);if(i.length/2&128)throw new r("tlv.encode: long form length too big");let o=n>127?v(i.length/2|128):"";return v(t)+o+i+e},decode(t,e){let{Err:r}=tm,n=0;if(t<0||t>256)throw new r("tlv.encode: wrong tag");if(e.length<2||e[n++]!==t)throw new r("tlv.decode: wrong tlv");let i=e[n++],o=0;if(128&i){let t=127&i;if(!t)throw new r("tlv.decode(long): indefinite length not supported");if(t>4)throw new r("tlv.decode(long): byte length is too big");let s=e.subarray(n,n+t);if(s.length!==t)throw new r("tlv.decode: length bytes not complete");if(0===s[0])throw new r("tlv.decode(long): zero leftmost byte");for(let t of s)o=o<<8|t;if(n+=t,o<128)throw new r("tlv.decode(long): not minimal encoding")}else o=i;let s=e.subarray(n,n+o);if(s.length!==o)throw new r("tlv.decode: wrong value length");return{v:s,l:e.subarray(n+o)}}},_int:{encode(t){let{Err:e}=tm;if(t<tE)throw new e("integer: negative integers are not allowed");let r=v(t);if(8&Number.parseInt(r[0],16)&&(r="00"+r),1&r.length)throw new e("unexpected DER parsing assertion: unpadded hex");return r},decode(t){let{Err:e}=tm;if(128&t[0])throw new e("invalid signature integer: negative");if(0===t[0]&&!(128&t[1]))throw new e("invalid signature integer: unnecessary leading zero");return tp(t)}},toSig(t){let{Err:e,_int:r,_tlv:n}=tm,i="string"==typeof t?ty(t):t;m(i);let{v:o,l:s}=n.decode(48,i);if(s.length)throw new e("invalid signature: left bytes after parsing");let{v:l,l:f}=n.decode(2,o),{v:u,l:a}=n.decode(2,f);if(a.length)throw new e("invalid signature: left bytes after parsing");return{r:r.decode(l),s:r.decode(u)}},hexFromSig(t){let{_tlv:e,_int:r}=tm,n=e.encode(2,r.encode(t.r)),i=e.encode(2,r.encode(t.s));return e.encode(48,n+i)}},tE=BigInt(0),tb=BigInt(1),tB=(BigInt(2),BigInt(3));BigInt(4);let tv=BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),tx=BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),tA=BigInt(1),tI=BigInt(2),tS=(t,e)=>(t+e/tI)/e,tO=tr(tv,void 0,void 0,{sqrt:function(t){let e=BigInt(3),r=BigInt(6),n=BigInt(11),i=BigInt(22),o=BigInt(23),s=BigInt(44),l=BigInt(88),f=t*t*t%tv,u=f*f*t%tv,a=J(u,e,tv)*u%tv,h=J(a,e,tv)*u%tv,d=J(h,tI,tv)*f%tv,c=J(d,n,tv)*d%tv,g=J(c,i,tv)*c%tv,p=J(g,s,tv)*g%tv,y=J(p,l,tv)*p%tv,w=J(y,s,tv)*g%tv,m=J(w,e,tv)*u%tv,E=J(m,o,tv)*c%tv,b
1=J(E,r,tv)*f%tv,B=J(b,tI,tv);if(!tO.eql(tO.sqr(B),t))throw Error("Cannot find square root");return B}}),tq=function(t,e){let r=e=>(function(t){let e=function(t){let e=tc(t);return V(e,{hash:"hash",hmac:"function",randomBytes:"function"},{bits2int:"function",bits2int_modN:"function",lowS:"boolean"}),Object.freeze({lowS:!0,...e})}(t),{Fp:r,n:n}=e,i=r.BYTES+1,o=2*r.BYTES+1;function s(t){return Q(t,n)}let{ProjectivePoint:l,normPrivateKeyToScalar:f,weierstrassEquation:u,isWithinCurveOrder:a}=function(t){var e;let r=function(t){let e=tc(t);V(e,{a:"field",b:"field"},{allowedPrivateKeyLengths:"array",wrapPrivateKey:"boolean",isTorsionFree:"function",clearCofactor:"function",allowInfinityPoint:"boolean",fromBytes:"function",toBytes:"function"});let{endo:r,Fp:n,a:i}=e;if(r){if(!n.eql(i,n.ZERO))throw Error("invalid endomorphism, can only be defined for Koblitz curves that have a=0");if("object"!=typeof r||"bigint"!=typeof r.beta||"function"!=typeof r.splitScalar)throw Error("invalid endomorphism, expected beta: bigint and splitScalar: function")}return Object.freeze({...e})}(t),{Fp:n}=r,i=tr(r.n,r.nBitLength),o=r.toBytes||((t,e,r)=>{let i=e.toAffine();return H(Uint8Array.from([4]),n.toBytes(i.x),n.toBytes(i.y))}),s=r.fromBytes||(t=>{let e=t.subarray(1);return{x:n.fromBytes(e.subarray(0,n.BYTES)),y:n.fromBytes(e.subarray(n.BYTES,2*n.BYTES))}});function l(t){let{a:e,b:i}=r,o=n.sqr(t),s=n.mul(o,t);return n.add(n.add(s,n.mul(t,e)),i)}if(!n.eql(n.sqr(r.Gy),l(r.Gx)))throw Error("bad generator point: equation left != right");function f(t){let e;let{allowedPrivateKeyLengths:n,nByteLength:i,wrapPrivateKey:o,n:s}=r;if(n&&"bigint"!=typeof t){if(w(t)&&(t=B(t)),"string"!=typeof t||!n.includes(t.length))throw Error("invalid private key");t=t.padStart(2*i,"0")}try{e="bigint"==typeof t?t:O(L("private key",t,i))}catch(e){throw Error("invalid private key, expected hex or "+i+" bytes, got "+typeof t)}return o&&(e=Q(e,s)),F("private key",e,tb,s),e}function u(t){if(!(t instanceof d))throw Error("ProjectivePoint expected")}let a=j((t,e)=>{let{px:r,py:i,pz:o}=t;if(n.eql(o,n.ONE))return{x:r,y:i};let s=t.is0();null==e&&(e=s?n.ONE:n.inv(o));let l=n.mul(r,e),f=n.mul(i,e),u=n.mul(o,e);if(s)return{x:n.ZERO,y:n.ZERO};if(!n.eql(u,n.ONE))throw Error("invZ was invalid");return{x:l,y:f}}),h=j(t=>{if(t.is0()){if(r.allowInfinityPoint&&!n.is0(t.py))return;throw Error("bad point: ZERO")}let{x:e,y:i}=t.toAffine();if(!n.isValid(e)||!n.isValid(i))throw Error("bad point: x or y not FE");let o=n.sqr(i),s=l(e);if(!n.eql(o,s))throw Error("bad point: equation left != right");if(!t.isTorsionFree())throw Error("bad point: not in prime-order subgroup");return!0});class d{constructor(t,e,r){if(this.px=t,this.py=e,this.pz=r,null==t||!n.isValid(t))throw Error("x required");if(null==e||!n.isValid(e))throw Error("y required");if(null==r||!n.isValid(r))throw Error("z required");Object.freeze(this)}static fromAffine(t){let{x:e,y:r}=t||{};if(!t||!n.isValid(e)||!n.isValid(r))throw Error("invalid affine point");if(t instanceof d)throw Error("projective point not allowed");let i=t=>n.eql(t,n.ZERO);return i(e)&&i(r)?d.ZERO:new d(e,r,n.ONE)}get x(){return this.toAffine().x}get y(){return this.toAffine().y}static normalizeZ(t){let e=n.invertBatch(t.map(t=>t.pz));return t.map((t,r)=>t.toAffine(e[r])).map(d.fromAffine)}static fromHex(t){let e=d.fromAffine(s(L("pointHex",t)));return e.assertValidity(),e}static fromPrivateKey(t){return d.BASE.multiply(f(t))}static msm(t,e){return function(t,e,r,n){if(!function(t,e){if(!Array.isArray(t))throw Error("array expected");t.forEach((t,r)=>{if(!(t instanceof e))throw Error("invalid point at index "+r)})}(r,t),!function(t,e){if(!Array.isArray(t))throw Error("array of scalars expected");t.forEach((t,r)=>{if(!e.isValid(t))throw Error("invalid scalar at index "+r)})}(n,e),r.length!==n.length)throw Error("arrays of points and scalars must have equal length");let i=t.ZERO,o=P(BigInt(r.length)),s=o>12?o-3:o>4?o-2:o?2:1,l=(1<<s)-1,f=Array(l+1).fill(i),u=Math.floor((e.BITS-1)/s)*s,a=i;for(let t=u;t>=0;t-=s){f.fill(i);for(let e=0;e<n.length;e++){let i=Number(n[e]>>BigInt(t)&BigInt(l));f[i]=f[i].add(r[e])}let e=i;for(let t=f.length-1,r=i;t>0;t--)r=r.add(f[t]),e=e.add(r);if(a=a.add(e),0!==t)for(let t=0;t<s;t++)a=a.double()}return a}(d,i,t,e)}_setWindowSize(t){g.setWindowSize(this,t)}assertValidity(){h(this)}hasEvenY(){let{y:t}=this.toAffine();if(n.isOdd)return!n.isOdd(t);throw Error("Field doesn't support isOdd")}equals(t){u(t);let{px:e,py:r,pz:i}=this,{px:o,py:s,pz:l}=t,f=n.eql(n.mul(e,l),n.mul(o,i)),a=n.eql(n.mul(r,l),n.mul(s,i));return f&&a}negate(){return new d(this.px,n.neg(this.py),this.pz)}double(){let{a:t,b:e}=r,i=n.mul(e,tB),{px:o,py:s,pz:l}=this,f=n.ZERO,u=n.ZERO,a=n.ZERO,h=n.mul(o,o),c=n.mul(s,s),g=n.mul(l,l),p=n.mul(o,s);return p=n.add(p,p),a=n.mul(o,l),a=n.add(a,a),f=n.mul(t,a),u=n.mul(i,g),u=n.add(f,u),f=n.sub(c,u),u=n.add(c,u),u=n.mul(f,u),f=n.mul(p,f),a=n.mul(i,a),g=n.mul(t,g),p=n.sub(h,g),p=n.mul(t,p),p=n.add(p,a),a=n.add(h,h),h=n.add(a,h),h=n.add(h,g),h=n.mul(h,p),u=n.add(u,h),g=n.mul(s,l),g=n.add(g,g),h=n.mul(g,p),f=n.sub(f,h),a=n.mul(g,c),a=n.add(a,a),new d(f,u,a=n.add(a,a))}add(t){u(t);let{px:e,py:i,pz:o}=this,{px:s,py:l,pz:f}=t,a=n.ZERO,h=n.ZERO,c=n.ZERO,g=r.a,p=n.mul(r.b,tB),y=n.mul(e,s),w=n.mul(i,l),m=n.mul(o,f),E=n.add(e,i),b=n.add(s,l);E=n.mul(E,b),b=n.add(y,w),E=n.sub(E,b),b=n.add(e,o);let B=n.add(s,f);return b=n.mul(b,B),B=n.add(y,m),b=n.sub(b,B),B=n.add(i,o),a=n.add(l,f),B=n.mul(B,a),a=n.add(w,m),B=n.sub(B,a),c=n.mul(g,b),a=n.mul(p,m),c=n.add(a,c),a=n.sub(w,c),c=n.add(w,c),h=n.mul(a,c),w=n.add(y,y),w=n.add(w,y),m=n.mul(g,m),b=n.mul(p,b),w=n.add(w,m),m=n.sub(y,m),m=n.mul(g,m),b=n.add(b,m),y=n.mul(w,b),h=n.add(h,y),y=n.mul(B,b),a=n.mul(E,a),a=n.sub(a,y),y=n.mul(E,w),c=n.mul(B,c),new d(a,h,c=n.add(c,y))}subtract(t){return this.add(t.negate())}is0(){return this.equals(d.ZERO)}wNAF(t){return g.wNAFCached(this,t,d.normalizeZ)}multiplyUnsafe(t){let{endo:e,n:i}=r;F("scalar",t,tE,i);let o=d.ZERO;if(t===tE)return o;if(this.is0()||t===tb)return this;if(!e||g.hasPrecomputes(this))return g.wNAFCachedUnsafe(this,t,d.normalizeZ);
1let{k1neg:s,k1:l,k2neg:f,k2:u}=e.splitScalar(t),a=o,h=o,c=this;for(;l>tE||u>tE;)l&tb&&(a=a.add(c)),u&tb&&(h=h.add(c)),c=c.double(),l>>=tb,u>>=tb;return s&&(a=a.negate()),f&&(h=h.negate()),h=new d(n.mul(h.px,e.beta),h.py,h.pz),a.add(h)}multiply(t){let e,i;let{endo:o,n:s}=r;if(F("scalar",t,tb,s),o){let{k1neg:r,k1:s,k2neg:l,k2:f}=o.splitScalar(t),{p:u,f:a}=this.wNAF(s),{p:h,f:c}=this.wNAF(f);u=g.constTimeNegate(r,u),h=g.constTimeNegate(l,h),h=new d(n.mul(h.px,o.beta),h.py,h.pz),e=u.add(h),i=a.add(c)}else{let{p:r,f:n}=this.wNAF(t);e=r,i=n}return d.normalizeZ([e,i])[0]}multiplyAndAddUnsafe(t,e,r){let n=d.BASE,i=(t,e)=>e!==tE&&e!==tb&&t.equals(n)?t.multiply(e):t.multiplyUnsafe(e),o=i(this,e).add(i(t,r));return o.is0()?void 0:o}toAffine(t){return a(this,t)}isTorsionFree(){let{h:t,isTorsionFree:e}=r;if(t===tb)return!0;if(e)return e(d,this);throw Error("isTorsionFree() has not been declared for the elliptic curve")}clearCofactor(){let{h:t,clearCofactor:e}=r;return t===tb?this:e?e(d,this):this.multiplyUnsafe(r.h)}toRawBytes(t=!0){return E("isCompressed",t),this.assertValidity(),o(d,this,t)}toHex(t=!0){return E("isCompressed",t),B(this.toRawBytes(t))}}d.BASE=new d(r.Gx,r.Gy,n.ONE),d.ZERO=new d(n.ZERO,n.ONE,n.ZERO);let c=r.nBitLength,g=(e=r.endo?Math.ceil(c/2):c,{constTimeNegate:tl,hasPrecomputes:t=>1!==td(t),unsafeLadder(t,e,r=d.ZERO){let n=t;for(;e>to;)e&ts&&(r=r.add(n)),n=n.double(),e>>=ts;return r},precomputeWindow(t,r){let{windows:n,windowSize:i}=tu(r,e),o=[],s=t,l=s;for(let t=0;t<n;t++){l=s,o.push(l);for(let t=1;t<i;t++)l=l.add(s),o.push(l);s=l.double()}return o},wNAF(t,r,n){let{windows:i,windowSize:o}=tu(t,e),s=d.ZERO,l=d.BASE,f=BigInt(2**t-1),u=2**t,a=BigInt(t);for(let t=0;t<i;t++){let e=t*o,i=Number(n&f);n>>=a,i>o&&(i-=u,n+=ts);let h=e+Math.abs(i)-1,d=t%2!=0,c=i<0;0===i?l=l.add(tl(d,r[e])):s=s.add(tl(c,r[h]))}return{p:s,f:l}},wNAFUnsafe(t,r,n,i=d.ZERO){let{windows:o,windowSize:s}=tu(t,e),l=BigInt(2**t-1),f=2**t,u=BigInt(t);for(let t=0;t<o;t++){let e=t*s;if(n===to)break;let o=Number(n&l);if(n>>=u,o>s&&(o-=f,n+=ts),0===o)continue;let a=r[e+Math.abs(o)-1];o<0&&(a=a.negate()),i=i.add(a)}return i},getPrecomputes(t,e,r){let n=ta.get(e);return n||(n=this.precomputeWindow(e,t),1!==t&&ta.set(e,r(n))),n},wNAFCached(t,e,r){let n=td(t);return this.wNAF(n,this.getPrecomputes(n,t,r),e)},wNAFCachedUnsafe(t,e,r,n){let i=td(t);return 1===i?this.unsafeLadder(t,e,n):this.wNAFUnsafe(i,this.getPrecomputes(i,t,r),e,n)},setWindowSize(t,r){tf(r,e),th.set(t,r),ta.delete(t)}});return{CURVE:r,ProjectivePoint:d,normPrivateKeyToScalar:f,weierstrassEquation:l,isWithinCurveOrder:function(t){return z(t,tb,r.n)}}}({...e,toBytes(t,e,n){let i=e.toAffine(),o=r.toBytes(i.x),s=H;return(E("isCompressed",n),n)?s(Uint8Array.from([e.hasEvenY()?2:3]),o):s(Uint8Array.from([4]),o,r.toBytes(i.y))},fromBytes(t){let e=t.length,n=t[0],s=t.subarray(1);if(e===i&&(2===n||3===n)){let t;let e=O(s);if(!z(e,tb,r.ORDER))throw Error("Point is not on curve");let i=u(e);try{t=r.sqrt(i)}catch(t){throw Error("Point is not on curve"+(t instanceof Error?": "+t.message:""))}return(1&n)==1!=((t&tb)===tb)&&(t=r.neg(t)),{x:e,y:t}}if(e===o&&4===n)return{x:r.fromBytes(s.subarray(0,r.BYTES)),y:r.fromBytes(s.subarray(r.BYTES,2*r.BYTES))};throw Error("invalid Point, expected length of "+i+", or uncompressed "+o+", got "+e)}}),h=t=>B(N(t,e.nByteLength)),d=(t,e,r)=>O(t.slice(e,r));class c{constructor(t,e,r){this.r=t,this.s=e,this.recovery=r,this.assertValidity()}static fromCompact(t){let r=e.nByteLength;return new c(d(t=L("compactSignature",t,2*r),0,r),d(t,r,2*r))}static fromDER(t){let{r:e,s:r}=tm.toSig(L("DER",t));return new c(e,r)}assertValidity(){F("r",this.r,tb,n),F("s",this.s,tb,n)}addRecoveryBit(t){return new c(this.r,this.s,t)}recoverPublicKey(t){let{r:i,s:o,recovery:f}=this,u=y(L("msgHash",t));if(null==f||![0,1,2,3].includes(f))throw Error("recovery id invalid");let a=2===f||3===f?i+e.n:i;if(a>=r.ORDER)throw Error("recovery id 2 or 3 invalid");let d=(1&f)==0?"02":"03",c=l.fromHex(d+h(a)),g=X(a,n),p=s(-u*g),w=s(o*g),m=l.BASE.multiplyAndAddUnsafe(c,p,w);if(!m)throw Error("point at infinify");return m.assertValidity(),m}hasHighS(){return this.s>n>>tb}normalizeS(){return this.hasHighS()?new c(this.r,s(-this.s),this.recovery):this}toDERRawBytes(){return S(this.toDERHex())}toDERHex(){return tm.hexFromSig({r:this.r,s:this.s})}toCompactRawBytes(){return S(this.toCompactHex())}toCompactHex(){return h(this.r)+h(this.s)}}function g(t){let e=w(t),r="string"==typeof t,n=(e||r)&&t.length;return e?n===i||n===o:r?n===2*i||n===2*o:t instanceof l}let p=e.bits2int||function(t){if(t.length>8192)throw Error("input is too large");let r=O(t),n=8*t.length-e.nBitLength;return n>0?r>>BigInt(n):r},y=e.bits2int_modN||function(t){return s(p(t))},m=C(e.nBitLength);function b(t){return F("num < 2^"+e.nBitLength,t,tE,m),N(t,e.nByteLength)}let v={lowS:e.lowS,prehash:!1},x={lowS:e.lowS,prehash:!1};return l.BASE._setWindowSize(8),{CURVE:e,getPublicKey:function(t,e=!0){return l.fromPrivateKey(t).toRawBytes(e)},getSharedSecret:function(t,e,r=!0){if(g(t))throw Error("first arg must be private key");if(!g(e))throw Error("second arg must be public key");return l.fromHex(e).multiply(f(t)).toRawBytes(r)},sign:function(t,i,o=v){let{seed:u,k2sig:h}=function(t,i,o=v){if(["recovered","canonical"].some(t=>t in o))throw Error("sign() legacy options not supported");let{hash:u,randomBytes:h}=e,{lowS:d,prehash:g,extraEntropy:w}=o;null==d&&(d=!0),t=L("msgHash",t),tg(o),g&&(t=L("prehashed msgHash",u(t)));let m=y(t),E=f(i),B=[b(E),b(m)];if(null!=w&&!1!==w){let t=!0===w?h(r.BYTES):w;B.push(L("extraEntropy",t))}return{seed:H(...B),k2sig:function(t){let e=p(t);if(!a(e))return;let r=X(e,n),i=l.BASE.multiply(e).toAffine(),o=s(i.x);if(o===tE)return;let f=s(r*s(m+o*E));if(f===tE)return;let u=(i.x===o?0:2)|Number(i.y&tb),h=f;if(d&&f>n>>tb)h=f>n>>tb?s(-f):f,u^=1;return new c(o,h,u)}}}(t,i,o);return _(e.hash.outputLen,e.nByteLength,e.hmac)(u,h)},verify:function(t,r,i,o=x){let f,u;r=L("msgHash",r),i=L("publicKey",i);let{lowS:a,prehash:h,format:d}=o;if(tg(o),"strict"in o)throw Error("options.strict was renamed to lowS");if(void 0!==d&&"compact"!==d&&"der"!==d)throw Error("format must be compact or der");let g="string"==typeof t||w(t),p=!g&&!d&&"object"==typeof t&&null!==t&&"bigint"==typeof t.r&&"bigint"==typeof t.s;if(!g&&!p)throw Error("invalid signature, expected Uint8Array, hex string or Signature instance");try{if(p&&(u=new c(t.r,t.s)),g){try{"compact"!==d&&(u=c.fromDER(t))}catch(t){if(!(t instanceof tm.Err))throw t}u||"der"===d||(u=c.fromCompact(t))}f=l.fromHex(i)}catch(t){return!1}if(!u||a&&u.hasHighS())return!1;h&&(r=e.hash(r));let{r:m,s:E}=u,b=y(r),B=X(E,n),v=s(b*B),A=s(m*B),I=l.BASE.multiplyAndAddUnsafe(f,v,A)?.toAffine();return!!I&&s(I.x)===m},ProjectivePoint:l,Signature:c,utils:{isValidPrivateKey(t){try{return f(t),!0}catch(t){return!1}},normPrivateKeyToScalar:f,randomPrivateKey:()=>{let t=ti(e.n);return function(t,e,r=!1){let n=t.length,i=tn(e),o=ti(e);if(n<16||n<o||n>1024)throw Error("expected "+o+"-1024 bytes of input, got "+n);let s=Q(r?q(t):O(t),e-G)+G;return r?R(s,i):N(s,i)}(e.randomBytes(t),e.n)},precompute:(t=8,e=l.BASE)=>(e._setWindowSize(t),e.multiply(BigInt(3)),e)}}})({...t,hash:e,hmac:(t,...r)=>c(e,t,(0,o.eV)(...r)),randomBytes:o.O6});return{...r(e),create:r}}({a:BigInt(0),b:BigInt(7),Fp:tO,n:tx,Gx:BigInt("55066263022277343669578718895168534326250603453777594175500187360389116729240"),Gy:BigInt("32670510020758816978083085130507043184471273380659243275938904335757337482424"),h:BigInt(1),lowS:!0,endo:{beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),splitScalar:t=>{let e=BigInt("0x3086d221a7d46bcde86c90e49284eb15"),r=-tA*BigInt("0xe4437ed6010e88286f547fa90abfe4c3"),n=BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),i=BigInt("0x100000000000000000000000000000000"),o=tS(e*t,tx),s=tS(-r*t,tx),l=Q(t-o*e-s*n,tx),f=Q(-o*r-s*e,tx),u=l>i,a=f>i;if(u&&(l=tx-l),a&&(f=tx-f),l>i||f>i)throw Error("splitScalar: Endomorphism failed, k="+t);return{k1neg:u,k1:l,k2neg:a,k2:f}}}},h);BigInt(0),tq.ProjectivePoint}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.