PageSourceSearch

https://kyberswap.com/assets/eciesjsProxy-3d269eb3.js

js kyberswap.com collected 2026-10-01 11:51:50 UTC 73,330 bytes, 1 lines download raw bytes

1import{g8 as Ge,g as Ht}from"./index-23810fa3.js";import{u as dt,c as Rt,m as yt,h as Nt,e as jt}from"./ed25519-466655a2.js";import{a as xt,r as ht,b as Mt,s as Vt}from"./sha2-facc5d62.js";import{u as gt}from"./utils-d9c93a5f.js";function Dt(e,t){for(var n=0;n<t.length;n++){const f=t[n];if(typeof f!="string"&&!Array.isArray(f)){for(const g in f)if(g!=="default"&&!(g in e)){const d=Object.getOwnPropertyDescriptor(f,g);d&&Object.defineProperty(e,g,d.get?d:{enumerable:!0,get:()=>f[g]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var tt={},Pe={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.wrapCipher=e.Hash=e.nextTick=e.isLE=void 0,e.isBytes=t,e.abool=n,e.anumber=f,e.abytes=g,e.ahash=d,e.aexists=I,e.aoutput=S,e.u8=D,e.u32=x,e.clean=V,e.createView=N,e.bytesToHex=C,e.hexToBytes=U,e.hexToNumber=j,e.bytesToNumberBE=F,e.numberToBytesBE=$,e.utf8ToBytes=ee,e.bytesToUtf8=le,e.toBytes=ge,e.overlapBytes=ce,e.complexOverlapBytes=de,e.concatBytes=fe,e.checkOpts=ye,e.equalBytes=W,e.getOutput=_,e.setBigUint64=v,e.u64Lengths=s,e.isAligned32=B,e.copyBytes=q;function t(i){return i instanceof Uint8Array||ArrayBuffer.isView(i)&&i.constructor.name==="Uint8Array"}function n(i){if(typeof i!="boolean")throw new Error(`boolean expected, not ${i}`)}function f(i){if(!Number.isSafeInteger(i)||i<0)throw new Error("positive integer expected, got "+i)}function g(i,...r){if(!t(i))throw new Error("Uint8Array expected");if(r.length>0&&!r.includes(i.length))throw new Error("Uint8Array expected of length "+r+", got length="+i.length)}function d(i){if(typeof i!="function"||typeof i.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");f(i.outputLen),f(i.blockLen)}function I(i,r=!0){if(i.destroyed)throw new Error("Hash instance has been destroyed");if(r&&i.finished)throw new Error("Hash#digest() has already been called")}function S(i,r){g(i);const c=r.outputLen;if(i.length<c)throw new Error("digestInto() expects output buffer of length at least "+c)}function D(i){return new Uint8Array(i.buffer,i.byteOffset,i.byteLength)}function x(i){return new Uint32Array(i.buffer,i.byteOffset,Math.floor(i.byteLength/4))}function V(...i){for(let r=0;r<i.length;r++)i[r].fill(0)}function N(i){return new DataView(i.buffer,i.byteOffset,i.byteLength)}e.isLE=(()=>new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68)();const O=(()=>typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function")(),L=Array.from({length:256},(i,r)=>r.toString(16).padStart(2,"0"));function C(i){if(g(i),O)return i.toHex();let r="";for(let c=0;c<i.length;c++)r+=L[i[c]];return r}const H={_0:48,_9:57,A:65,F:70,a:97,f:102};function E(i){if(i>=H._0&&i<=H._9)return i-H._0;if(i>=H.A&&i<=H.F)return i-(H.A-10);if(i>=H.a&&i<=H.f)return i-(H.a-10)}function U(i){if(typeof i!="string")throw new Error("hex string expected, got "+typeof i);if(O)return Uint8Array.fromHex(i);const r=i.length,c=r/2;if(r%2)throw new Error("hex string expected, got unpadded hex of length "+r);const a=new Uint8Array(c);for(let u=0,l=0;u<c;u++,l+=2){const m=E(i.charCodeAt(l)),y=E(i.charCodeAt(l+1));if(m===void 0||y===void 0){const h=i[l]+i[l+1];throw new Error('hex string expected, got non-hex character "'+h+'" at index '+l)}a[u]=m*16+y}return a}function j(i){if(typeof i!="string")throw new Error("hex string expected, got "+typeof i);return BigInt(i===""?"0":"0x"+i)}function F(i){return j(C(i))}function $(i,r){return U(i.toString(16).padStart(r*2,"0"))}const se=async()=>{};e.nextTick=se;function ee(i){if(typeof i!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(i))}function le(i){return new TextDecoder().decode(i)}function ge(i){if(typeof i=="string")i=ee(i);else if(t(i))i=q(i);else throw new Error("Uint8Array expected, got "+typeof i);return i}function ce(i,r){return i.buffer===r.buffer&&i.byteOffset<r.byteOffset+r.byteLength&&r.byteOffset<i.byteOffset+i.byteLength}function de(i,r){if(ce(i,r)&&i.byteOffset<r.byteOffset)throw new Error("complex overlap of input and output is not supported")}function fe(...i){let r=0;for(let a=0;a<i.length;a++){const u=i[a];g(u),r+=u.length}const c=new Uint8Array(r);for(let a=0,u=0;a<i.length;a++){const l=i[a];
1c.set(l,u),u+=l.length}return c}function ye(i,r){if(r==null||typeof r!="object")throw new Error("options must be defined");return Object.assign(i,r)}function W(i,r){if(i.length!==r.length)return!1;let c=0;for(let a=0;a<i.length;a++)c|=i[a]^r[a];return c===0}class G{}e.Hash=G;const o=(i,r)=>{function c(a,...u){if(g(a),!e.isLE)throw new Error("Non little-endian hardware is not yet supported");if(i.nonceLength!==void 0){const w=u[0];if(!w)throw new Error("nonce / iv required");i.varSizeNonce?g(w):g(w,i.nonceLength)}const l=i.tagLength;l&&u[1]!==void 0&&g(u[1]);const m=r(a,...u),y=(w,p)=>{if(p!==void 0){if(w!==2)throw new Error("cipher output not supported");g(p)}};let h=!1;return{encrypt(w,p){if(h)throw new Error("cannot encrypt() twice with same key + nonce");return h=!0,g(w),y(m.encrypt.length,p),m.encrypt(w,p)},decrypt(w,p){if(g(w),l&&w.length<l)throw new Error("invalid ciphertext length: smaller than tagLength="+l);return y(m.decrypt.length,p),m.decrypt(w,p)}}}return Object.assign(c,i),c};e.wrapCipher=o;function _(i,r,c=!0){if(r===void 0)return new Uint8Array(i);if(r.length!==i)throw new Error("invalid output length, expected "+i+", got: "+r.length);if(c&&!B(r))throw new Error("invalid output, must be aligned");return r}function v(i,r,c,a){if(typeof i.setBigUint64=="function")return i.setBigUint64(r,c,a);const u=BigInt(32),l=BigInt(4294967295),m=Number(c>>u&l),y=Number(c&l),h=a?4:0,b=a?0:4;i.setUint32(r+h,m,a),i.setUint32(r+b,y,a)}function s(i,r,c){n(c);const a=new Uint8Array(16),u=N(a);return v(u,0,BigInt(r),c),v(u,8,BigInt(i),c),a}function B(i){return i.byteOffset%4===0}function q(i){return Uint8Array.from(i)}})(Pe);var Ve={},Ce={};Object.defineProperty(Ce,"__esModule",{value:!0});Ce.AEAD_TAG_LENGTH=Ce.XCHACHA20_NONCE_LENGTH=Ce.CURVE25519_PUBLIC_KEY_SIZE=Ce.ETH_PUBLIC_KEY_SIZE=Ce.UNCOMPRESSED_PUBLIC_KEY_SIZE=Ce.COMPRESSED_PUBLIC_KEY_SIZE=Ce.SECRET_KEY_LENGTH=void 0;Ce.SECRET_KEY_LENGTH=32;Ce.COMPRESSED_PUBLIC_KEY_SIZE=33;Ce.UNCOMPRESSED_PUBLIC_KEY_SIZE=65;Ce.ETH_PUBLIC_KEY_SIZE=64;Ce.CURVE25519_PUBLIC_KEY_SIZE=32;Ce.XCHACHA20_NONCE_LENGTH=24;Ce.AEAD_TAG_LENGTH=16;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.ephemeralKeySize=e.symmetricNonceLength=e.symmetricAlgorithm=e.isHkdfKeyCompressed=e.isEphemeralKeyCompressed=e.ellipticCurve=e.ECIES_CONFIG=e.Config=void 0;var t=Ce,n=function(){function x(){this.ellipticCurve="secp256k1",this.isEphemeralKeyCompressed=!1,this.isHkdfKeyCompressed=!1,this.symmetricAlgorithm="aes-256-gcm",this.symmetricNonceLength=16}return Object.defineProperty(x.prototype,"ephemeralKeySize",{get:function(){var V={secp256k1:this.isEphemeralKeyCompressed?t.COMPRESSED_PUBLIC_KEY_SIZE:t.UNCOMPRESSED_PUBLIC_KEY_SIZE,x25519:t.CURVE25519_PUBLIC_KEY_SIZE,ed25519:t.CURVE25519_PUBLIC_KEY_SIZE};if(this.ellipticCurve in V)return V[this.ellipticCurve];throw new Error("Not implemented")},enumerable:!1,configurable:!0}),x}();e.Config=n,e.ECIES_CONFIG=new n;var f=function(){return e.ECIES_CONFIG.ellipticCurve};e.ellipticCurve=f;var g=function(){return e.ECIES_CONFIG.isEphemeralKeyCompressed};e.isEphemeralKeyCompressed=g;var d=function(){return e.ECIES_CONFIG.isHkdfKeyCompressed};e.isHkdfKeyCompressed=d;var I=function(){return e.ECIES_CONFIG.symmetricAlgorithm};e.symmetricAlgorithm=I;var S=function(){return e.ECIES_CONFIG.symmetricNonceLength};e.symmetricNonceLength=S;var D=function(){return e.ECIES_CONFIG.ephemeralKeySize};e.ephemeralKeySize=D})(Ve);var Je={},Ye={},$e={},bt={},nt={},We={};Object.defineProperty(We,"__esModule",{value:!0});We.crypto=void 0;We.crypto=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.gcm=e.ctr=e.cbc=e.utils=void 0,e.randomBytes=f,e.getWebcryptoSubtle=g,e.managedNonce=d;const t=We,n=Pe;function f(x=32){if(t.crypto&&typeof t.crypto.getRandomValues=="function")return t.crypto.getRandomValues(new Uint8Array(x));if(t.crypto&&typeof t.crypto.randomBytes=="function")return Uint8Array.from(t.crypto.randomBytes(x));throw new Error("crypto.getRandomValues must be defined")}function g(){if(t.crypto&&typeof t.crypto.subtle=="object"&&t.crypto.subtle!=null)return t.crypto.subtle;throw new Error("crypto.subtle must be defined")}function d(x){const{nonceLength:V}=x;return(0,n.anumber)(V),(N,...O)=>
1({encrypt(L,...C){const H=f(V),E=x(N,H,...O).encrypt(L,...C),U=(0,n.concatBytes)(H,E);return E.fill(0),U},decrypt(L,...C){const H=L.subarray(0,V),E=L.subarray(V);return x(N,H,...O).decrypt(E,...C)}})}e.utils={async encrypt(x,V,N,O){const L=g(),C=await L.importKey("raw",x,V,!0,["encrypt"]),H=await L.encrypt(N,C,O);return new Uint8Array(H)},async decrypt(x,V,N,O){const L=g(),C=await L.importKey("raw",x,V,!0,["decrypt"]),H=await L.decrypt(N,C,O);return new Uint8Array(H)}};const I={CBC:"AES-CBC",CTR:"AES-CTR",GCM:"AES-GCM"};function S(x,V,N){if(x===I.CBC)return{name:I.CBC,iv:V};if(x===I.CTR)return{name:I.CTR,counter:V,length:64};if(x===I.GCM)return N?{name:I.GCM,iv:V,additionalData:N}:{name:I.GCM,iv:V};throw new Error("unknown aes block mode")}function D(x){return(V,N,O)=>{(0,n.abytes)(V),(0,n.abytes)(N);const L={name:x,length:V.length*8},C=S(x,N,O);let H=!1;return{encrypt(E){if((0,n.abytes)(E),H)throw new Error("Cannot encrypt() twice with same key / nonce");return H=!0,e.utils.encrypt(V,L,C,E)},decrypt(E){return(0,n.abytes)(E),e.utils.decrypt(V,L,C,E)}}}}e.cbc=(()=>D(I.CBC))(),e.ctr=(()=>D(I.CTR))(),e.gcm=(()=>D(I.GCM))()})(nt);var mt={},Xe={},rt={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.DER=e.DERErr=void 0,e._splitEndoScalar=S,e._normFnElement=E,e.weierstrassN=U,e.SWUFpSqrtRatio=F,e.mapToCurveSimpleSWU=$,e.ecdh=ee,e.ecdsa=le,e.weierstrassPoints=ge,e._legacyHelperEquat=fe,e.weierstrass=G;const t=xt,n=ht,f=dt,g=Rt,d=yt,I=(o,_)=>(o+(o>=0?_:-_)/L)/_;function S(o,_,v){const[[s,B],[q,i]]=_,r=I(i*o,v),c=I(-B*o,v);let a=o-r*s-c*q,u=-r*B-c*i;const l=a<N,m=u<N;l&&(a=-a),m&&(u=-u);const y=(0,f.bitMask)(Math.ceil((0,f.bitLen)(v)/2))+O;if(a<N||a>=y||u<N||u>=y)throw new Error("splitScalar (endomorphism): failed, k="+o);return{k1neg:l,k1:a,k2neg:m,k2:u}}function D(o){if(!["compact","recovered","der"].includes(o))throw new Error('Signature format must be "compact", "recovered", or "der"');return o}function x(o,_){const v={};for(let s of Object.keys(_))v[s]=o[s]===void 0?_[s]:o[s];return(0,f._abool2)(v.lowS,"lowS"),(0,f._abool2)(v.prehash,"prehash"),v.format!==void 0&&D(v.format),v}class V extends Error{constructor(_=""){super(_)}}e.DERErr=V,e.DER={Err:V,_tlv:{encode:(o,_)=>{const{Err:v}=e.DER;if(o<0||o>256)throw new v("tlv.encode: wrong tag");if(_.length&1)throw new v("tlv.encode: unpadded data");const s=_.length/2,B=(0,f.numberToHexUnpadded)(s);if(B.length/2&128)throw new v("tlv.encode: long form length too big");const q=s>127?(0,f.numberToHexUnpadded)(B.length/2|128):"";return(0,f.numberToHexUnpadded)(o)+q+B+_},decode(o,_){const{Err:v}=e.DER;let s=0;if(o<0||o>256)throw new v("tlv.encode: wrong tag");if(_.length<2||_[s++]!==o)throw new v("tlv.decode: wrong tlv");const B=_[s++],q=!!(B&128);let i=0;if(!q)i=B;else{const c=B&127;if(!c)throw new v("tlv.decode(long): indefinite length not supported");if(c>4)throw new v("tlv.decode(long): byte length is too big");const a=_.subarray(s,s+c);if(a.length!==c)throw new v("tlv.decode: length bytes not complete");if(a[0]===0)throw new v("tlv.decode(long): zero leftmost byte");for(const u of a)i=i<<8|u;if(s+=c,i<128)throw new v("tlv.decode(long): not minimal encoding")}const r=_.subarray(s,s+i);if(r.length!==i)throw new v("tlv.decode: wrong value length");return{v:r,l:_.subarray(s+i)}}},_int:{encode(o){const{Err:_}=e.DER;if(o<N)throw new _("integer: negative integers are not allowed");let v=(0,f.numberToHexUnpadded)(o);if(Number.parseInt(v[0],16)&8&&(v="00"+v),v.length&1)throw new _("unexpected DER parsing assertion: unpadded hex");return v},decode(o){const{Err:_}=e.DER;if(o[0]&128)throw new _("invalid signature integer: negative");if(o[0]===0&&!(o[1]&128))throw new _("invalid signature integer: unnecessary leading zero");return(0,f.bytesToNumberBE)(o)}},toSig(o){const{Err:_,_int:v,_tlv:s}=e.DER,B=(0,f.ensureBytes)("signature",o),{v:q,l:i}=s.decode(48,B);if(i.length)throw new _("invalid signature: left bytes after parsing");const{v:r,l:c}=s.decode(2,q),{v:a,l:u}=s.decode(2,c);if(u.length)throw new _("invalid signature: left bytes after parsing");return{r:v.decode(r),s:v.decode(a)}},hexFromSig(o){const{_tlv:_,_int:v}=e.DER,s=_.encode(2,v.encode(o.r)),B=_.encode(2,v.encode(o.s)),q=s+B;return _.encode(48,q)}};const N=BigInt(0),O=BigInt(1),L=BigInt(2),C=BigInt(3),H=BigInt(4);function E(o,_){const{BYTES:v}=o;let s;if(typeof _=="bigint")s=_;else{let B=(0,f.ensureBytes)("private key",_);
1try{s=o.fromBytes(B)}catch{throw new Error(`invalid private key: expected ui8a of size ${v}, got ${typeof _}`)}}if(!o.isValidNot0(s))throw new Error("invalid private key: out of range [1..N-1]");return s}function U(o,_={}){const v=(0,g._createCurveFields)("weierstrass",o,_),{Fp:s,Fn:B}=v;let q=v.CURVE;const{h:i,n:r}=q;(0,f._validateObject)(_,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:c}=_;if(c&&(!s.is0(q.a)||typeof c.beta!="bigint"||!Array.isArray(c.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const a=se(s,B);function u(){if(!s.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function l(re,R,T){const{x:A,y:z}=R.toAffine(),J=s.toBytes(A);if((0,f._abool2)(T,"isCompressed"),T){u();const oe=!s.isOdd(z);return(0,f.concatBytes)(j(oe),J)}else return(0,f.concatBytes)(Uint8Array.of(4),J,s.toBytes(z))}function m(re){(0,f._abytes2)(re,void 0,"Point");const{publicKey:R,publicKeyUncompressed:T}=a,A=re.length,z=re[0],J=re.subarray(1);if(A===R&&(z===2||z===3)){const oe=s.fromBytes(J);if(!s.isValid(oe))throw new Error("bad point: is not on curve, wrong x");const ne=b(oe);let te;try{te=s.sqrt(ne)}catch(_e){const be=_e instanceof Error?": "+_e.message:"";throw new Error("bad point: is not on curve, sqrt error"+be)}u();const ie=s.isOdd(te);return(z&1)===1!==ie&&(te=s.neg(te)),{x:oe,y:te}}else if(A===T&&z===4){const oe=s.BYTES,ne=s.fromBytes(J.subarray(0,oe)),te=s.fromBytes(J.subarray(oe,oe*2));if(!w(ne,te))throw new Error("bad point: is not on curve");return{x:ne,y:te}}else throw new Error(`bad point: got length ${A}, expected compressed=${R} or uncompressed=${T}`)}const y=_.toBytes||l,h=_.fromBytes||m;function b(re){const R=s.sqr(re),T=s.mul(R,re);return s.add(s.add(T,s.mul(re,q.a)),q.b)}function w(re,R){const T=s.sqr(R),A=b(re);return s.eql(T,A)}if(!w(q.Gx,q.Gy))throw new Error("bad curve params: generator point");const p=s.mul(s.pow(q.a,C),H),K=s.mul(s.sqr(q.b),BigInt(27));if(s.is0(s.add(p,K)))throw new Error("bad curve params: a or b");function P(re,R,T=!1){if(!s.isValid(R)||T&&s.is0(R))throw new Error(`bad point coordinate ${re}`);return R}function Z(re){if(!(re instanceof M))throw new Error("ProjectivePoint expected")}function k(re){if(!c||!c.basises)throw new Error("no endo");return S(re,c.basises,B.ORDER)}const X=(0,f.memoized)((re,R)=>{const{X:T,Y:A,Z:z}=re;if(s.eql(z,s.ONE))return{x:T,y:A};const J=re.is0();R==null&&(R=J?s.ONE:s.inv(z));const oe=s.mul(T,R),ne=s.mul(A,R),te=s.mul(z,R);if(J)return{x:s.ZERO,y:s.ZERO};if(!s.eql(te,s.ONE))throw new Error("invZ was invalid");return{x:oe,y:ne}}),Y=(0,f.memoized)(re=>{if(re.is0()){if(_.allowInfinityPoint&&!s.is0(re.Y))return;throw new Error("bad point: ZERO")}const{x:R,y:T}=re.toAffine();if(!s.isValid(R)||!s.isValid(T))throw new Error("bad point: x or y not field elements");if(!w(R,T))throw new Error("bad point: equation left != right");if(!re.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function Q(re,R,T,A,z){return T=new M(s.mul(T.X,re),T.Y,T.Z),R=(0,g.negateCt)(A,R),T=(0,g.negateCt)(z,T),R.add(T)}class M{constructor(R,T,A){this.X=P("x",R),this.Y=P("y",T,!0),this.Z=P("z",A),Object.freeze(this)}static CURVE(){return q}static fromAffine(R){const{x:T,y:A}=R||{};if(!R||!s.isValid(T)||!s.isValid(A))throw new Error("invalid affine point");if(R instanceof M)throw new Error("projective point not allowed");return s.is0(T)&&s.is0(A)?M.ZERO:new M(T,A,s.ONE)}static fromBytes(R){const T=M.fromAffine(h((0,f._abytes2)(R,void 0,"point")));return T.assertValidity(),T}static fromHex(R){return M.fromBytes((0,f.ensureBytes)("pointHex",R))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(R=8,T=!0){return ue.createCache(this,R),T||this.multiply(C),this}assertValidity(){Y(this)}hasEvenY(){const{y:R}=this.toAffine();if(!s.isOdd)throw new Error("Field doesn't support isOdd");return!s.isOdd(R)}equals(R){Z(R);const{X:T,Y:A,Z:z}=this,{X:J,Y:oe,Z:ne}=R,te=s.eql(s.mul(T,ne),s.mul(J,z)),ie=s.eql(s.mul(A,ne),s.mul(oe,z));return te&&ie}negate(){return new M(this.X,s.neg(this.Y),this.Z)}double(){const{a:R,b:T}=q,A=s.mul(T,C),{X:z,Y:J,Z:oe}=this;let ne=s.ZERO,te=s.ZERO,ie=s.ZERO,ae=s.mul(z,z),_e=s.mul(J,J),be=s.mul(oe,oe),he=s.mul(z,J);return he=s.add(he,he),ie=s.mul(z,oe),ie=s.add(ie,ie),ne=s.mul(R,ie),te=s.mul(A,be),te=s.add(ne,te),ne=s.sub(_e,te),te=s.add(_e,te),te=s.mul(ne,te),ne=s.mul(he,ne),ie=s.mul(A,ie),be=s.mul(R,be),he=s.sub(ae,be),he=s.mul(R,he),he=s.add(he,ie),ie=s.add(ae,ae),ae=s.add(ie,ae),ae=s.add(ae,be),ae=s.mul(ae,he),te=s.add(te,ae),be=s.mul(J,oe),be=s.add(be,be),ae=s.mul(be,he),ne=s.sub(ne,ae),ie=s.mul(be,_e),ie=s.add(ie,ie),ie=s.add(ie,ie),new M(ne,te,ie)}add(R){Z(R);const{X:T,Y:A,Z:z}=this,{X:J,Y:oe,Z:ne}=R;let te=s.ZERO,ie=s.ZERO,ae=s.ZERO;const _e=q.a,be=s.mul(q.b,C);let he=s.mul(T,J),pe=s.mul(A,oe),Be=s.mul(z,ne),Oe=s.add(T,A),ve=s.add(J,oe);Oe=s.mul(Oe,ve),ve=s.add(he,pe),Oe=s.sub(Oe,ve),ve=s.add(T,z);let Ke=s.add(J,ne);return ve=s.mul(ve,Ke),Ke=s.add(he,Be),ve=s.sub(ve,Ke),Ke=s.add(A,z),te=s.add(oe,ne),Ke=s.mul(Ke,te),te=s.add(pe,Be),Ke=s.sub(Ke,te),ae=s.mul(_e,ve),te=s.mul(be,Be),ae=s.add(te,ae),te=s.sub(pe,ae),ae=s.add(pe,ae),ie=s.mul(te,ae),pe=s.add(he,he),pe=s.add(pe,he),Be=s.mul(_e,Be),ve=s.mul(be,ve),pe=s.add(pe,Be),Be=s.sub(he,Be),Be=s.mul(_e,Be),ve=s.add(ve,Be),he=s.mul(pe,ve),ie=s.add(ie,he),he=s.mul(Ke,ve),te=s.mul(Oe,te),te=s.sub(te,he),he=s.mul(Oe,pe),ae=s.mul(Ke,ae),ae=s.add(ae,he),new M(te,ie,ae)}subtract(R){return this.add(R.negate())}is0(){return this.equals(M.ZERO)}
1multiply(R){const{endo:T}=_;if(!B.isValidNot0(R))throw new Error("invalid scalar: out of range");let A,z;const J=oe=>ue.cached(this,oe,ne=>(0,g.normalizeZ)(M,ne));if(T){const{k1neg:oe,k1:ne,k2neg:te,k2:ie}=k(R),{p:ae,f:_e}=J(ne),{p:be,f:he}=J(ie);z=_e.add(he),A=Q(T.beta,ae,be,oe,te)}else{const{p:oe,f:ne}=J(R);A=oe,z=ne}return(0,g.normalizeZ)(M,[A,z])[0]}multiplyUnsafe(R){const{endo:T}=_,A=this;if(!B.isValid(R))throw new Error("invalid scalar: out of range");if(R===N||A.is0())return M.ZERO;if(R===O)return A;if(ue.hasCache(this))return this.multiply(R);if(T){const{k1neg:z,k1:J,k2neg:oe,k2:ne}=k(R),{p1:te,p2:ie}=(0,g.mulEndoUnsafe)(M,A,J,ne);return Q(T.beta,te,ie,z,oe)}else return ue.unsafe(A,R)}multiplyAndAddUnsafe(R,T,A){const z=this.multiplyUnsafe(T).add(R.multiplyUnsafe(A));return z.is0()?void 0:z}toAffine(R){return X(this,R)}isTorsionFree(){const{isTorsionFree:R}=_;return i===O?!0:R?R(M,this):ue.unsafe(this,r).is0()}clearCofactor(){const{clearCofactor:R}=_;return i===O?this:R?R(M,this):this.multiplyUnsafe(i)}isSmallOrder(){return this.multiplyUnsafe(i).is0()}toBytes(R=!0){return(0,f._abool2)(R,"isCompressed"),this.assertValidity(),y(M,this,R)}toHex(R=!0){return(0,f.bytesToHex)(this.toBytes(R))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(R=!0){return this.toBytes(R)}_setWindowSize(R){this.precompute(R)}static normalizeZ(R){return(0,g.normalizeZ)(M,R)}static msm(R,T){return(0,g.pippenger)(M,B,R,T)}static fromPrivateKey(R){return M.BASE.multiply(E(B,R))}}M.BASE=new M(q.Gx,q.Gy,s.ONE),M.ZERO=new M(s.ZERO,s.ONE,s.ZERO),M.Fp=s,M.Fn=B;const we=B.BITS,ue=new g.wNAF(M,_.endo?Math.ceil(we/2):we);return M.BASE.precompute(8),M}function j(o){return Uint8Array.of(o?2:3)}function F(o,_){const v=o.ORDER;let s=N;for(let h=v-O;h%L===N;h/=L)s+=O;const B=s,q=L<<B-O-O,i=q*L,r=(v-O)/i,c=(r-O)/L,a=i-O,u=q,l=o.pow(_,r),m=o.pow(_,(r+O)/L);let y=(h,b)=>{let w=l,p=o.pow(b,a),K=o.sqr(p);K=o.mul(K,b);let P=o.mul(h,K);P=o.pow(P,c),P=o.mul(P,p),p=o.mul(P,b),K=o.mul(P,h);let Z=o.mul(K,p);P=o.pow(Z,u);let k=o.eql(P,o.ONE);p=o.mul(K,m),P=o.mul(Z,w),K=o.cmov(p,K,k),Z=o.cmov(P,Z,k);for(let X=B;X>O;X--){let Y=X-L;Y=L<<Y-O;let Q=o.pow(Z,Y);const M=o.eql(Q,o.ONE);p=o.mul(K,w),w=o.mul(w,w),Q=o.mul(Z,w),K=o.cmov(p,K,M),Z=o.cmov(Q,Z,M)}return{isValid:k,value:K}};if(o.ORDER%H===C){const h=(o.ORDER-C)/H,b=o.sqrt(o.neg(_));y=(w,p)=>{let K=o.sqr(p);const P=o.mul(w,p);K=o.mul(K,P);let Z=o.pow(K,h);Z=o.mul(Z,P);const k=o.mul(Z,b),X=o.mul(o.sqr(Z),p),Y=o.eql(X,w);let Q=o.cmov(k,Z,Y);return{isValid:Y,value:Q}}}return y}function $(o,_){(0,d.validateField)(o);const{A:v,B:s,Z:B}=_;if(!o.isValid(v)||!o.isValid(s)||!o.isValid(B))throw new Error("mapToCurveSimpleSWU: invalid opts");const q=F(o,B);if(!o.isOdd)throw new Error("Field does not have .isOdd()");return i=>{let r,c,a,u,l,m,y,h;r=o.sqr(i),r=o.mul(r,B),c=o.sqr(r),c=o.add(c,r),a=o.add(c,o.ONE),a=o.mul(a,s),u=o.cmov(B,o.neg(c),!o.eql(c,o.ZERO)),u=o.mul(u,v),c=o.sqr(a),m=o.sqr(u),l=o.mul(m,v),c=o.add(c,l),c=o.mul(c,a),m=o.mul(m,u),l=o.mul(m,s),c=o.add(c,l),y=o.mul(r,a);const{isValid:b,value:w}=q(c,m);h=o.mul(r,i),h=o.mul(h,w),y=o.cmov(y,a,b),h=o.cmov(h,w,b);const p=o.isOdd(i)===o.isOdd(h);h=o.cmov(o.neg(h),h,p);const K=(0,d.FpInvertBatch)(o,[u],!0)[0];return y=o.mul(y,K),{x:y,y:h}}}function se(o,_){return{secretKey:_.BYTES,publicKey:1+o.BYTES,publicKeyUncompressed:1+2*o.BYTES,publicKeyHasPrefix:!0,signature:2*_.BYTES}}function ee(o,_={}){const{Fn:v}=o,s=_.randomBytes||f.randomBytes,B=Object.assign(se(o.Fp,v),{seed:(0,d.getMinHashLength)(v.ORDER)});function q(y){try{return!!E(v,y)}catch{return!1}}function i(y,h){const{publicKey:b,publicKeyUncompressed:w}=B;try{const p=y.length;return h===!0&&p!==b||h===!1&&p!==w?!1:!!o.fromBytes(y)}catch{return!1}}function r(y=s(B.seed)){return(0,d.mapHashToField)((0,f._abytes2)(y,B.seed,"seed"),v.ORDER)}function c(y,h=!0){return o.BASE.multiply(E(v,y)).toBytes(h)}function a(y){const h=r(y);return{secretKey:h,publicKey:c(h)}}function u(y){if(typeof y=="bigint")return!1;if(y instanceof o)return!0;const{secretKey:h,publicKey:b,publicKeyUncompressed:w}=B;if(v.allowedLengths||h===b)return;const p=(0,f.ensureBytes)("key",y).length;return p===b||p===w}function l(y,h,b=!0){if(u(y)===!0)throw new Error("first arg must be private key");if(u(h)===!1)throw new Error("second arg must be public key");const w=E(v,y);return o.fromHex(h).multiply(w).toBytes(b)}return Object.freeze({getPublicKey:c,getSharedSecret:l,keygen:a,Point:o,utils:{isValidSecretKey:q,isValidPublicKey:i,randomSecretKey:r,isValidPrivateKey:q,randomPrivateKey:r,normPrivateKeyToScalar:y=>E(v,y),precompute(y=8,h=o.BASE){return h.precompute(y,!1)}},lengths:B})}function le(o,_,v={}){(0,n.ahash)(_),(0,f._validateObject)(v,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const s=v.randomBytes||f.randomBytes,B=v.hmac||((T,...A)=>(0,t.hmac)(_,T,(0,f.concatBytes)(...A))),{Fp:q,Fn:i}=o,{ORDER:r,BITS:c}=i,{keygen:a,getPublicKey:u,getSharedSecret:l,utils:m,lengths:y}=ee(o,v),h={prehash:!1,lowS:typeof v.lowS=="boolean"?v.lowS:!1,format:void 0,extraEntropy:!1},b="compact";function w(T){const A=r>>O;return T>A}function p(T,A){if(!i.isValidNot0(A))throw new Error(`invalid signature ${T}: out of range 1..Point.Fn.ORDER`);return A}function K(T,A){D(A);const z=y.signature,J=A==="compact"?z:A==="recovered"?z+1:void 0;return(0,f._abytes2)(T,J,`${A} signature`)}class P{constructor(A,z,J){this.r=p("r",A),this.s=p("s",z),J!=null&&(this.recovery=J),Object.freeze(this)}static fromBytes(A,z=b){K(A,z);let J;if(z==="der"){const{r:ie,s:ae}=e.DER.toSig((0,f._abytes2)(A));return new P(ie,ae)}z==="recovered"&&(J=A[0],z="compact",A=A.subarray(1));const oe=i.BYTES,ne=A.subarray(0,oe),te=A.subarray(oe,oe*2);return new P(i.fromBytes(ne),i.fromBytes(te),J)}static fromHex(A,z){return this.fromBytes((0,f.hexToBytes)(A),z)}
1addRecoveryBit(A){return new P(this.r,this.s,A)}recoverPublicKey(A){const z=q.ORDER,{r:J,s:oe,recovery:ne}=this;if(ne==null||![0,1,2,3].includes(ne))throw new Error("recovery id invalid");if(r*L<z&&ne>1)throw new Error("recovery id is ambiguous for h>1 curve");const ie=ne===2||ne===3?J+r:J;if(!q.isValid(ie))throw new Error("recovery id 2 or 3 invalid");const ae=q.toBytes(ie),_e=o.fromBytes((0,f.concatBytes)(j((ne&1)===0),ae)),be=i.inv(ie),he=k((0,f.ensureBytes)("msgHash",A)),pe=i.create(-he*be),Be=i.create(oe*be),Oe=o.BASE.multiplyUnsafe(pe).add(_e.multiplyUnsafe(Be));if(Oe.is0())throw new Error("point at infinify");return Oe.assertValidity(),Oe}hasHighS(){return w(this.s)}toBytes(A=b){if(D(A),A==="der")return(0,f.hexToBytes)(e.DER.hexFromSig(this));const z=i.toBytes(this.r),J=i.toBytes(this.s);if(A==="recovered"){if(this.recovery==null)throw new Error("recovery bit must be present");return(0,f.concatBytes)(Uint8Array.of(this.recovery),z,J)}return(0,f.concatBytes)(z,J)}toHex(A){return(0,f.bytesToHex)(this.toBytes(A))}assertValidity(){}static fromCompact(A){return P.fromBytes((0,f.ensureBytes)("sig",A),"compact")}static fromDER(A){return P.fromBytes((0,f.ensureBytes)("sig",A),"der")}normalizeS(){return this.hasHighS()?new P(this.r,i.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return(0,f.bytesToHex)(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return(0,f.bytesToHex)(this.toBytes("compact"))}}const Z=v.bits2int||function(A){if(A.length>8192)throw new Error("input is too large");const z=(0,f.bytesToNumberBE)(A),J=A.length*8-c;return J>0?z>>BigInt(J):z},k=v.bits2int_modN||function(A){return i.create(Z(A))},X=(0,f.bitMask)(c);function Y(T){return(0,f.aInRange)("num < 2^"+c,T,N,X),i.toBytes(T)}function Q(T,A){return(0,f._abytes2)(T,void 0,"message"),A?(0,f._abytes2)(_(T),void 0,"prehashed message"):T}function M(T,A,z){if(["recovered","canonical"].some(pe=>pe in z))throw new Error("sign() legacy options not supported");const{lowS:J,prehash:oe,extraEntropy:ne}=x(z,h);T=Q(T,oe);const te=k(T),ie=E(i,A),ae=[Y(ie),Y(te)];if(ne!=null&&ne!==!1){const pe=ne===!0?s(y.secretKey):ne;ae.push((0,f.ensureBytes)("extraEntropy",pe))}const _e=(0,f.concatBytes)(...ae),be=te;function he(pe){const Be=Z(pe);if(!i.isValidNot0(Be))return;const Oe=i.inv(Be),ve=o.BASE.multiply(Be).toAffine(),Ke=i.create(ve.x);if(Ke===N)return;const Ze=i.create(Oe*i.create(be+Ke*ie));if(Ze===N)return;let it=(ve.x===Ke?0:2)|Number(ve.y&O),ct=Ze;return J&&w(Ze)&&(ct=i.neg(Ze),it^=1),new P(Ke,ct,it)}return{seed:_e,k2sig:he}}function we(T,A,z={}){T=(0,f.ensureBytes)("message",T);const{seed:J,k2sig:oe}=M(T,A,z);return(0,f.createHmacDrbg)(_.outputLen,i.BYTES,B)(J,oe)}function ue(T){let A;const z=typeof T=="string"||(0,f.isBytes)(T),J=!z&&T!==null&&typeof T=="object"&&typeof T.r=="bigint"&&typeof T.s=="bigint";if(!z&&!J)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(J)A=new P(T.r,T.s);else if(z){try{A=P.fromBytes((0,f.ensureBytes)("sig",T),"der")}catch(oe){if(!(oe instanceof e.DER.Err))throw oe}if(!A)try{A=P.fromBytes((0,f.ensureBytes)("sig",T),"compact")}catch{return!1}}return A||!1}function re(T,A,z,J={}){const{lowS:oe,prehash:ne,format:te}=x(J,h);if(z=(0,f.ensureBytes)("publicKey",z),A=Q((0,f.ensureBytes)("message",A),ne),"strict"in J)throw new Error("options.strict was renamed to lowS");const ie=te===void 0?ue(T):P.fromBytes((0,f.ensureBytes)("sig",T),te);if(ie===!1)return!1;try{const ae=o.fromBytes(z);if(oe&&ie.hasHighS())return!1;const{r:_e,s:be}=ie,he=k(A),pe=i.inv(be),Be=i.create(he*pe),Oe=i.create(_e*pe),ve=o.BASE.multiplyUnsafe(Be).add(ae.multiplyUnsafe(Oe));return ve.is0()?!1:i.create(ve.x)===_e}catch{return!1}}function R(T,A,z={}){const{prehash:J}=x(z,h);return A=Q(A,J),P.fromBytes(T,"recovered").recoverPublicKey(A).toBytes()}return Object.freeze({keygen:a,getPublicKey:u,getSharedSecret:l,utils:m,lengths:y,Point:o,sign:we,verify:re,recoverPublicKey:R,Signature:P,hash:_})}function ge(o){const{CURVE:_,curveOpts:v}=ce(o),s=U(_,v);return ye(o,s)}function ce(o){const _={a:o.a,b:o.b,p:o.Fp.ORDER,n:o.n,h:o.h,Gx:o.Gx,Gy:o.Gy},v=o.Fp;let s=o.allowedPrivateKeyLengths?Array.from(new Set(o.allowedPrivateKeyLengths.map(i=>Math.ceil(i/2)))):void 0;const B=(0,d.Field)(_.n,{BITS:o.nBitLength,allowedLengths:s,modFromBytes:o.wrapPrivateKey}),q={Fp:v,Fn:B,allowInfinityPoint:o.allowInfinityPoint,endo:o.endo,isTorsionFree:o.isTorsionFree,clearCofactor:o.clearCofactor,fromBytes:o.fromBytes,toBytes:o.toBytes};return{CURVE:_,curveOpts:q}}function de(o){const{CURVE:_,curveOpts:v}=ce(o),s={hmac:o.hmac,randomBytes:o.randomBytes,lowS:o.lowS,bits2int:o.bits2int,bits2int_modN:o.bits2int_modN};return{CURVE:_,curveOpts:v,hash:o.hash,ecdsaOpts:s}}function fe(o,_,v){function s(B){const q=o.sqr(B),i=o.mul(q,B);return o.add(o.add(i,o.mul(B,_)),v)}return s}function ye(o,_){const{Fp:v,Fn:s}=_;function B(i){return(0,f.inRange)(i,O,s.ORDER)}const q=fe(v,o.a,o.b);return Object.assign({},{CURVE:o,Point:_,ProjectivePoint:_,normPrivateKeyToScalar:i=>E(s,i),weierstrassEquation:q,isWithinCurveOrder:B})}function W(o,_){const v=_.Point;return Object.assign({},_,{ProjectivePoint:v,CURVE:Object.assign({},o,(0,d.nLength)(v.Fn.ORDER,v.Fn.BITS))})}function G(o){const{CURVE:_,curveOpts:v,hash:s,ecdsaOpts:B}=de(o),q=U(_,v),i=le(q,s,B);return W(o,i)}})(rt);
1Object.defineProperty(Xe,"__esModule",{value:!0});Xe.getHash=Zt;Xe.createCurve=Gt;const qt=rt;function Zt(e){return{hash:e}}function Gt(e,t){const n=f=>(0,qt.weierstrass)({...e,hash:f});return{...n(t),create:n}}(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.encodeToCurve=e.hashToCurve=e.secp256k1_hasher=e.schnorr=e.secp256k1=void 0;const t=Mt,n=ht,f=Xe,g=Nt,d=yt,I=rt,S=dt,D={p:BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),n:BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),h:BigInt(1),a:BigInt(0),b:BigInt(7),Gx:BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),Gy:BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")},x={beta:BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),basises:[[BigInt("0x3086d221a7d46bcde86c90e49284eb15"),-BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"),BigInt("0x3086d221a7d46bcde86c90e49284eb15")]]},V=BigInt(0),N=BigInt(1),O=BigInt(2);function L(W){const G=D.p,o=BigInt(3),_=BigInt(6),v=BigInt(11),s=BigInt(22),B=BigInt(23),q=BigInt(44),i=BigInt(88),r=W*W*W%G,c=r*r*W%G,a=(0,d.pow2)(c,o,G)*c%G,u=(0,d.pow2)(a,o,G)*c%G,l=(0,d.pow2)(u,O,G)*r%G,m=(0,d.pow2)(l,v,G)*l%G,y=(0,d.pow2)(m,s,G)*m%G,h=(0,d.pow2)(y,q,G)*y%G,b=(0,d.pow2)(h,i,G)*h%G,w=(0,d.pow2)(b,q,G)*y%G,p=(0,d.pow2)(w,o,G)*c%G,K=(0,d.pow2)(p,B,G)*m%G,P=(0,d.pow2)(K,_,G)*r%G,Z=(0,d.pow2)(P,O,G);if(!C.eql(C.sqr(Z),W))throw new Error("Cannot find square root");return Z}const C=(0,d.Field)(D.p,{sqrt:L});e.secp256k1=(0,f.createCurve)({...D,Fp:C,lowS:!0,endo:x},t.sha256);const H={};function E(W,...G){let o=H[W];if(o===void 0){const _=(0,t.sha256)((0,S.utf8ToBytes)(W));o=(0,S.concatBytes)(_,_),H[W]=o}return(0,t.sha256)((0,S.concatBytes)(o,...G))}const U=W=>W.toBytes(!0).slice(1),j=(()=>e.secp256k1.Point)(),F=W=>W%O===V;function $(W){const{Fn:G,BASE:o}=j,_=(0,I._normFnElement)(G,W),v=o.multiply(_);return{scalar:F(v.y)?_:G.neg(_),bytes:U(v)}}function se(W){const G=C;if(!G.isValidNot0(W))throw new Error("invalid x: Fail if x ≥ p");const o=G.create(W*W),_=G.create(o*W+BigInt(7));let v=G.sqrt(_);F(v)||(v=G.neg(v));const s=j.fromAffine({x:W,y:v});return s.assertValidity(),s}const ee=S.bytesToNumberBE;function le(...W){return j.Fn.create(ee(E("BIP0340/challenge",...W)))}function ge(W){return $(W).bytes}function ce(W,G,o=(0,n.randomBytes)(32)){const{Fn:_}=j,v=(0,S.ensureBytes)("message",W),{bytes:s,scalar:B}=$(G),q=(0,S.ensureBytes)("auxRand",o,32),i=_.toBytes(B^ee(E("BIP0340/aux",q))),r=E("BIP0340/nonce",i,s,v),{bytes:c,scalar:a}=$(r),u=le(c,s,v),l=new Uint8Array(64);if(l.set(c,0),l.set(_.toBytes(_.create(a+u*B)),32),!de(l,v,s))throw new Error("sign: Invalid signature produced");return l}function de(W,G,o){const{Fn:_,BASE:v}=j,s=(0,S.ensureBytes)("signature",W,64),B=(0,S.ensureBytes)("message",G),q=(0,S.ensureBytes)("publicKey",o,32);try{const i=se(ee(q)),r=ee(s.subarray(0,32));if(!(0,S.inRange)(r,N,D.p))return!1;const c=ee(s.subarray(32,64));if(!(0,S.inRange)(c,N,D.n))return!1;const a=le(_.toBytes(r),U(i),B),u=v.multiplyUnsafe(c).add(i.multiplyUnsafe(_.neg(a))),{x:l,y:m}=u.toAffine();return!(u.is0()||!F(m)||l!==r)}catch{return!1}}e.schnorr=(()=>{const o=(v=(0,n.randomBytes)(48))=>(0,d.mapHashToField)(v,D.n);e.secp256k1.utils.randomSecretKey;function _(v){const s=o(v);return{secretKey:s,publicKey:ge(s)}}return{keygen:_,getPublicKey:ge,sign:ce,verify:de,Point:j,utils:{randomSecretKey:o,randomPrivateKey:o,taggedHash:E,lift_x:se,pointToBytes:U,numberToBytesBE:S.numberToBytesBE,bytesToNumberBE:S.bytesToNumberBE,mod:d.mod},lengths:{secretKey:32,publicKey:32,publicKeyHasPrefix:!1,signature:32*2,seed:48}}})();const fe=(()=>(0,g.isogenyMap)(C,[["0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa8c7","0x7d3d4c80bc321d5b9f315cea7fd44c5d595d2fc0bf63b92dfff1044f17c6581","0x534c328d23f234e6e2a413deca25caece4506144037c40314ecbd0b53d9dd262","0x8e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38e38daaaaa88c"],["0xd35771193d94918a9ca34ccbb7b640dd86cd409542f8487d9fe6b745781eb49b","0xedadc6f64383dc1df7c4b2d51b54225406d36b641f5e41bbc52a56612a8c6d14","0x0000000000000000000000000000000000000000000000000000000000000001"],["0x4bda12f684bda12f684bda12f684bda12f684bda12f684bda12f684b8e38e23c","0xc75e0c32d5cb7c0fa9d0a54b12a0a6d5647ab046d686da6fdffc90fc201d71a3","0x29a6194691f91a73715209ef6512e576722830a201be2018a765e85a9ecee931","0x2f684bda12f684bda12f684bda12f684bda12f684bda12f684bda12f38e38d84"],["0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffff93b","0x7a06534bb8bdb49fd5e9e6632722c2989467c1bfc8e8d978dfb425d2685c2573","0x6484aa716545ca2cf3a70c3fa8fe337e0a3d21162f0d6299a7bf8192bfd2a76f","0x0000000000000000000000000000000000000000000000000000000000000001"]].map(W=>W.map(G=>BigInt(G)))))(),ye=(()=>(0,I.mapToCurveSimpleSWU)(C,{A:BigInt("0x3f8731abdd661adca08a5558f0f5d272e953d363cb6f0e5d405447c01a444533"),B:BigInt("1771"),Z:C.create(BigInt("-11"))}))();e.secp256k1_hasher=(()=>(0,g.createHasher)(e.secp256k1.Point,W=>{const{x:G,y:o}=ye(C.create(W[0]));return fe(G,o)},{DST:"secp256k1_XMD:SHA-256_SSWU_RO_",encodeDST:"secp256k1_XMD:SHA-256_SSWU_NU_",p:C.ORDER,m:1,k:128,expand:"xmd",hash:t.sha256}))(),e.hashToCurve=(()=>e.secp256k1_hasher.hashToCurve)(),e.encodeToCurve=(()=>e.secp256k1_hasher.encodeToCurve)()})(mt);var ot={};
1(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.decodeHex=e.remove0x=void 0;var t=Pe,n=function(g){return g.startsWith("0x")||g.startsWith("0X")?g.slice(2):g};e.remove0x=n;var f=function(g){return(0,t.hexToBytes)((0,e.remove0x)(g))};e.decodeHex=f})(ot);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hexToPublicKey=e.convertPublicKeyFormat=e.getSharedPoint=e.getPublicKey=e.isValidPrivateKey=e.getValidSecret=void 0;var t=nt,n=jt,f=mt,g=Ve,d=Ce,I=ot,S=function(E){var U;do U=(0,t.randomBytes)(d.SECRET_KEY_LENGTH);while(!(0,e.isValidPrivateKey)(U,E));return U};e.getValidSecret=S;var D=function(E,U){return L(U,function(j){return j.utils.isValidSecretKey(E)},function(){return!0},function(){return!0})};e.isValidPrivateKey=D;var x=function(E,U){return L(U,function(j){return j.getPublicKey(E)},function(j){return j.getPublicKey(E)},function(j){return j.getPublicKey(E)})};e.getPublicKey=x;var V=function(E,U,j,F){return L(F,function($){return $.getSharedSecret(E,U,j)},function($){return $.getSharedSecret(E,U)},function($){return H($,E,U)})};e.getSharedPoint=V;var N=function(E,U,j){return L(j,function(F){return F.getSharedSecret(Uint8Array.from(Array(31).fill(0).concat([1])),E,U)},function(){return E},function(){return E})};e.convertPublicKeyFormat=N;var O=function(E,U){var j=(0,I.decodeHex)(E);return L(U,function(){return C(j)},function(){return j},function(){return j})};e.hexToPublicKey=O;function L(E,U,j,F){var $=E||g.ECIES_CONFIG.ellipticCurve;if($==="secp256k1")return U(f.secp256k1);if($==="x25519")return j(n.x25519);if($==="ed25519")return F(n.ed25519);throw new Error("Not implemented")}var C=function(E){if(E.length===d.ETH_PUBLIC_KEY_SIZE){var U=new Uint8Array(1+E.length);return U.set([4]),U.set(E,1),U}return E},H=function(E,U,j){var F=E.utils.getExtendedPublicKey(U).scalar,$=E.Point.fromBytes(j).multiply(F);return $.toBytes()}})(bt);var wt={},xe={},pt={};(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.hmac=e.HMAC=void 0;const t=gt;class n extends t.Hash{constructor(d,I){super(),this.finished=!1,this.destroyed=!1,(0,t.ahash)(d);const S=(0,t.toBytes)(I);if(this.iHash=d.create(),typeof this.iHash.update!="function")throw new Error("Expected instance of class which extends utils.Hash");this.blockLen=this.iHash.blockLen,this.outputLen=this.iHash.outputLen;const D=this.blockLen,x=new Uint8Array(D);x.set(S.length>D?d.create().update(S).digest():S);for(let V=0;V<x.length;V++)x[V]^=54;this.iHash.update(x),this.oHash=d.create();for(let V=0;V<x.length;V++)x[V]^=106;this.oHash.update(x),(0,t.clean)(x)}update(d){return(0,t.aexists)(this),this.iHash.update(d),this}digestInto(d){(0,t.aexists)(this),(0,t.abytes)(d,this.outputLen),this.finished=!0,this.iHash.digestInto(d),this.oHash.update(d),this.oHash.digestInto(d),this.destroy()}digest(){const d=new Uint8Array(this.oHash.outputLen);return this.digestInto(d),d}_cloneInto(d){d||(d=Object.create(Object.getPrototypeOf(this),{}));const{oHash:I,iHash:S,finished:D,destroyed:x,blockLen:V,outputLen:N}=this;return d=d,d.finished=D,d.destroyed=x,d.blockLen=V,d.outputLen=N,d.oHash=I._cloneInto(d.oHash),d.iHash=S._cloneInto(d.iHash),d}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}}e.HMAC=n;const f=(g,d,I)=>new n(g,d).update(I).digest();e.hmac=f,e.hmac.create=(g,d)=>new n(g,d)})(pt);Object.defineProperty(xe,"__esModule",{value:!0});xe.hkdf=void 0;xe.extract=Et;xe.expand=_t;const vt=pt,Re=gt;function Et(e,t,n){return(0,Re.ahash)(e),n===void 0&&(n=new Uint8Array(e.outputLen)),(0,vt.hmac)(e,(0,Re.toBytes)(n),(0,Re.toBytes)(t))}const Qe=Uint8Array.from([0]),at=Uint8Array.of();function _t(e,t,n,f=32){(0,Re.ahash)(e),(0,Re.anumber)(f);const g=e.outputLen;if(f>255*g)throw new Error("Length should be <= 255*HashLen");const d=Math.ceil(f/g);n===void 0&&(n=at);const I=new Uint8Array(d*g),S=vt.hmac.create(e,t),D=S._cloneInto(),x=new Uint8Array(S.outputLen);for(let V=0;V<d;V++)Qe[0]=V+1,D.update(V===0?at:x).update(n).update(Qe).digestInto(x),I.set(x,g*V),S._cloneInto(D);return S.destroy(),D.destroy(),(0,Re.clean)(x,Qe),I.slice(0,f)}const kt=(e,t,n,f,g)=>_t(e,Et(e,t,n),f,g);xe.hkdf=kt;
1(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.getSharedKey=e.deriveKey=void 0;var t=Pe,n=xe,f=Vt,g=function(I,S,D){return(0,n.hkdf)(f.sha256,I,S,D,32)};e.deriveKey=g;var d=function(){for(var I=[],S=0;S<arguments.length;S++)I[S]=arguments[S];return(0,e.deriveKey)(t.concatBytes.apply(void 0,I))};e.getSharedKey=d})(wt);var Bt={},Ne={},Ct={},Te={};Object.defineProperty(Te,"__esModule",{value:!0});Te.polyval=Te.ghash=void 0;Te._toGHASHKey=St;const me=Pe,Le=16,st=new Uint8Array(16),Ie=(0,me.u32)(st),zt=225,Yt=(e,t,n,f)=>{const g=f&1;return{s3:n<<31|f>>>1,s2:t<<31|n>>>1,s1:e<<31|t>>>1,s0:e>>>1^zt<<24&-(g&1)}},Ae=e=>(e>>>0&255)<<24|(e>>>8&255)<<16|(e>>>16&255)<<8|e>>>24&255|0;function St(e){e.reverse();const t=e[15]&1;let n=0;for(let f=0;f<e.length;f++){const g=e[f];e[f]=g>>>1|n,n=(g&1)<<7}return e[0]^=-t&225,e}const $t=e=>e>64*1024?8:e>1024?4:2;class Kt{constructor(t,n){this.blockLen=Le,this.outputLen=Le,this.s0=0,this.s1=0,this.s2=0,this.s3=0,this.finished=!1,t=(0,me.toBytes)(t),(0,me.abytes)(t,16);const f=(0,me.createView)(t);let g=f.getUint32(0,!1),d=f.getUint32(4,!1),I=f.getUint32(8,!1),S=f.getUint32(12,!1);const D=[];for(let C=0;C<128;C++)D.push({s0:Ae(g),s1:Ae(d),s2:Ae(I),s3:Ae(S)}),{s0:g,s1:d,s2:I,s3:S}=Yt(g,d,I,S);const x=$t(n||1024);if(![1,2,4,8].includes(x))throw new Error("ghash: invalid window size, expected 2, 4 or 8");this.W=x;const N=128/x,O=this.windowSize=2**x,L=[];for(let C=0;C<N;C++)for(let H=0;H<O;H++){let E=0,U=0,j=0,F=0;for(let $=0;$<x;$++){if(!(H>>>x-$-1&1))continue;const{s0:ee,s1:le,s2:ge,s3:ce}=D[x*C+$];E^=ee,U^=le,j^=ge,F^=ce}L.push({s0:E,s1:U,s2:j,s3:F})}this.t=L}_updateBlock(t,n,f,g){t^=this.s0,n^=this.s1,f^=this.s2,g^=this.s3;const{W:d,t:I,windowSize:S}=this;let D=0,x=0,V=0,N=0;const O=(1<<d)-1;let L=0;for(const C of[t,n,f,g])for(let H=0;H<4;H++){const E=C>>>8*H&255;for(let U=8/d-1;U>=0;U--){const j=E>>>d*U&O,{s0:F,s1:$,s2:se,s3:ee}=I[L*S+j];D^=F,x^=$,V^=se,N^=ee,L+=1}}this.s0=D,this.s1=x,this.s2=V,this.s3=N}update(t){(0,me.aexists)(this),t=(0,me.toBytes)(t),(0,me.abytes)(t);const n=(0,me.u32)(t),f=Math.floor(t.length/Le),g=t.length%Le;for(let d=0;d<f;d++)this._updateBlock(n[d*4+0],n[d*4+1],n[d*4+2],n[d*4+3]);return g&&(st.set(t.subarray(f*Le)),this._updateBlock(Ie[0],Ie[1],Ie[2],Ie[3]),(0,me.clean)(Ie)),this}destroy(){const{t}=this;for(const n of t)n.s0=0,n.s1=0,n.s2=0,n.s3=0}digestInto(t){(0,me.aexists)(this),(0,me.aoutput)(t,this),this.finished=!0;const{s0:n,s1:f,s2:g,s3:d}=this,I=(0,me.u32)(t);return I[0]=n,I[1]=f,I[2]=g,I[3]=d,t}digest(){const t=new Uint8Array(Le);return this.digestInto(t),this.destroy(),t}}class Wt extends Kt{constructor(t,n){t=(0,me.toBytes)(t),(0,me.abytes)(t);const f=St((0,me.copyBytes)(t));super(f,n),(0,me.clean)(f)}update(t){t=(0,me.toBytes)(t),(0,me.aexists)(this);const n=(0,me.u32)(t),f=t.length%Le,g=Math.floor(t.length/Le);for(let d=0;d<g;d++)this._updateBlock(Ae(n[d*4+3]),Ae(n[d*4+2]),Ae(n[d*4+1]),Ae(n[d*4+0]));return f&&(st.set(t.subarray(g*Le)),this._updateBlock(Ae(Ie[3]),Ae(Ie[2]),Ae(Ie[1]),Ae(Ie[0])),(0,me.clean)(Ie)),this}digestInto(t){(0,me.aexists)(this),(0,me.aoutput)(t,this),this.finished=!0;const{s0:n,s1:f,s2:g,s3:d}=this,I=(0,me.u32)(t);return I[0]=n,I[1]=f,I[2]=g,I[3]=d,t.reverse()}}function Ot(e){const t=(f,g)=>e(g,f.length).update((0,me.toBytes)(f)).digest(),n=e(new Uint8Array(16),0);return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=(f,g)=>e(f,g),t}Te.ghash=Ot((e,t)=>new Kt(e,t));Te.polyval=Ot((e,t)=>new Wt(e,t));(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.unsafe=e.aeskwp=e.aeskw=e.siv=e.gcmsiv=e.gcm=e.cfb=e.cbc=e.ecb=e.ctr=void 0;const t=Te,n=Pe,f=16,g=4,d=new Uint8Array(f),I=283;function S(r){return r<<1^I&-(r>>7)}function D(r,c){let a=0;for(;c>0;c>>=1)a^=r&-(c&1),r=S(r);return a}const x=(()=>{const r=new Uint8Array(256);for(let a=0,u=1;a<256;a++,u^=S(u))r[a]=u;const c=new Uint8Array(256);c[0]=99;for(let a=0;a<255;a++){let u=r[255-a];u|=u<<8,c[r[a]]=(u^u>>4^u>>5^u>>6^u>>7^99)&255}return(0,n.clean)(r),c})(),V=x.map((r,c)=>x.indexOf(c)),N=r=>r<<24|r>>>8,O=r=>r<<8|r>>>24,L=r=>r<<24&4278190080|r<<8&16711680|r>>>8&65280|r>>>24&255;function C(r,c){if(r.length!==256)throw new Error("Wrong sbox length");const a=new Uint32Array(256).map((w,p)=>c(r[p])),u=a.map(O),l=u.map(O),m=l.map(O),y=new Uint32Array(256*256),h=new Uint32Array(256*256),b=new Uint16Array(256*256);for(let w=0;w<256;w++)for(let p=0;p<256;p++){const K=w*256+p;y[K]=a[w]^u[p],h[K]=l[w]^m[p],b[K]=r[w]<<8|r[p]}return{sbox:r,sbox2:b,T0:a,T1:u,T2:l,T3:m,T01:y,T23:h}}const H=C(x,r=>D(r,3)<<24|r<<16|r<<8|D(r,2)),E=C(V,r=>D(r,11)<<24|D(r,13)<<16|D(r,9)<<8|D(r,14)),U=(()=>
1{const r=new Uint8Array(16);for(let c=0,a=1;c<16;c++,a=S(a))r[c]=a;return r})();function j(r){(0,n.abytes)(r);const c=r.length;if(![16,24,32].includes(c))throw new Error("aes: invalid key size, should be 16, 24 or 32, got "+c);const{sbox2:a}=H,u=[];(0,n.isAligned32)(r)||u.push(r=(0,n.copyBytes)(r));const l=(0,n.u32)(r),m=l.length,y=b=>se(a,b,b,b,b),h=new Uint32Array(c+28);h.set(l);for(let b=m;b<h.length;b++){let w=h[b-1];b%m===0?w=y(N(w))^U[b/m-1]:m>6&&b%m===4&&(w=y(w)),h[b]=h[b-m]^w}return(0,n.clean)(...u),h}function F(r){const c=j(r),a=c.slice(),u=c.length,{sbox2:l}=H,{T0:m,T1:y,T2:h,T3:b}=E;for(let w=0;w<u;w+=4)for(let p=0;p<4;p++)a[w+p]=c[u-w-4+p];(0,n.clean)(c);for(let w=4;w<u-4;w++){const p=a[w],K=se(l,p,p,p,p);a[w]=m[K&255]^y[K>>>8&255]^h[K>>>16&255]^b[K>>>24]}return a}function $(r,c,a,u,l,m){return r[a<<8&65280|u>>>8&255]^c[l>>>8&65280|m>>>24&255]}function se(r,c,a,u,l){return r[c&255|a&65280]|r[u>>>16&255|l>>>16&65280]<<16}function ee(r,c,a,u,l){const{sbox2:m,T01:y,T23:h}=H;let b=0;c^=r[b++],a^=r[b++],u^=r[b++],l^=r[b++];const w=r.length/4-2;for(let k=0;k<w;k++){const X=r[b++]^$(y,h,c,a,u,l),Y=r[b++]^$(y,h,a,u,l,c),Q=r[b++]^$(y,h,u,l,c,a),M=r[b++]^$(y,h,l,c,a,u);c=X,a=Y,u=Q,l=M}const p=r[b++]^se(m,c,a,u,l),K=r[b++]^se(m,a,u,l,c),P=r[b++]^se(m,u,l,c,a),Z=r[b++]^se(m,l,c,a,u);return{s0:p,s1:K,s2:P,s3:Z}}function le(r,c,a,u,l){const{sbox2:m,T01:y,T23:h}=E;let b=0;c^=r[b++],a^=r[b++],u^=r[b++],l^=r[b++];const w=r.length/4-2;for(let k=0;k<w;k++){const X=r[b++]^$(y,h,c,l,u,a),Y=r[b++]^$(y,h,a,c,l,u),Q=r[b++]^$(y,h,u,a,c,l),M=r[b++]^$(y,h,l,u,a,c);c=X,a=Y,u=Q,l=M}const p=r[b++]^se(m,c,l,u,a),K=r[b++]^se(m,a,c,l,u),P=r[b++]^se(m,u,a,c,l),Z=r[b++]^se(m,l,u,a,c);return{s0:p,s1:K,s2:P,s3:Z}}function ge(r,c,a,u){(0,n.abytes)(c,f),(0,n.abytes)(a);const l=a.length;u=(0,n.getOutput)(l,u),(0,n.complexOverlapBytes)(a,u);const m=c,y=(0,n.u32)(m);let{s0:h,s1:b,s2:w,s3:p}=ee(r,y[0],y[1],y[2],y[3]);const K=(0,n.u32)(a),P=(0,n.u32)(u);for(let k=0;k+4<=K.length;k+=4){P[k+0]=K[k+0]^h,P[k+1]=K[k+1]^b,P[k+2]=K[k+2]^w,P[k+3]=K[k+3]^p;let X=1;for(let Y=m.length-1;Y>=0;Y--)X=X+(m[Y]&255)|0,m[Y]=X&255,X>>>=8;({s0:h,s1:b,s2:w,s3:p}=ee(r,y[0],y[1],y[2],y[3]))}const Z=f*Math.floor(K.length/g);if(Z<l){const k=new Uint32Array([h,b,w,p]),X=(0,n.u8)(k);for(let Y=Z,Q=0;Y<l;Y++,Q++)u[Y]=a[Y]^X[Q];(0,n.clean)(k)}return u}function ce(r,c,a,u,l){(0,n.abytes)(a,f),(0,n.abytes)(u),l=(0,n.getOutput)(u.length,l);const m=a,y=(0,n.u32)(m),h=(0,n.createView)(m),b=(0,n.u32)(u),w=(0,n.u32)(l),p=c?0:12,K=u.length;let P=h.getUint32(p,c),{s0:Z,s1:k,s2:X,s3:Y}=ee(r,y[0],y[1],y[2],y[3]);for(let M=0;M+4<=b.length;M+=4)w[M+0]=b[M+0]^Z,w[M+1]=b[M+1]^k,w[M+2]=b[M+2]^X,w[M+3]=b[M+3]^Y,P=P+1>>>0,h.setUint32(p,P,c),{s0:Z,s1:k,s2:X,s3:Y}=ee(r,y[0],y[1],y[2],y[3]);const Q=f*Math.floor(b.length/g);if(Q<K){const M=new Uint32Array([Z,k,X,Y]),we=(0,n.u8)(M);for(let ue=Q,re=0;ue<K;ue++,re++)l[ue]=u[ue]^we[re];(0,n.clean)(M)}return l}e.ctr=(0,n.wrapCipher)({blockSize:16,nonceLength:16},function(c,a){function u(l,m){if((0,n.abytes)(l),m!==void 0&&((0,n.abytes)(m),!(0,n.isAligned32)(m)))throw new Error("unaligned destination");const y=j(c),h=(0,n.copyBytes)(a),b=[y,h];(0,n.isAligned32)(l)||b.push(l=(0,n.copyBytes)(l));const w=ge(y,h,l,m);return(0,n.clean)(...b),w}return{encrypt:(l,m)=>u(l,m),decrypt:(l,m)=>u(l,m)}});function de(r){if((0,n.abytes)(r),r.length%f!==0)throw new Error("aes-(cbc/ecb).decrypt ciphertext should consist of blocks with size "+f)}function fe(r,c,a){(0,n.abytes)(r);let u=r.length;const l=u%f;if(!c&&l!==0)throw new Error("aec/(cbc-ecb): unpadded plaintext with disabled padding");(0,n.isAligned32)(r)||(r=(0,n.copyBytes)(r));const m=(0,n.u32)(r);if(c){let h=f-l;h||(h=f),u=u+h}a=(0,n.getOutput)(u,a),(0,n.complexOverlapBytes)(r,a);const y=(0,n.u32)(a);return{b:m,o:y,out:a}}function ye(r,c){if(!c)return r;const a=r.length;if(!a)throw new Error("aes/pcks5: empty ciphertext not allowed");const u=r[a-1];if(u<=0||u>16)throw new Error("aes/pcks5: wrong padding");const l=r.subarray(0,-u);for(let m=0;m<u;m++)if(r[a-m-1]!==u)throw new Error("aes/pcks5: wrong padding");return l}function W(r){const c=new Uint8Array(16),a=(0,n.u32)(c);c.set(r);const u=f-r.length;for(let l=f-u;l<f;l++)c[l]=u;return a}e.ecb=(0,n.wrapCipher)({blockSize:16},function(c,a={}){const u=!a.disablePadding;return{encrypt(l,m){const{b:y,o:h,out:b}=fe(l,u,m),w=j(c);let p=0;for(;p+4<=y.length;){const{s0:K,s1:P,s2:Z,s3:k}=ee(w,y[p+0],y[p+1],y[p+2],y[p+3]);h[p++]=K,h[p++]=P,h[p++]=Z,h[p++]=k}
1if(u){const K=W(l.subarray(p*4)),{s0:P,s1:Z,s2:k,s3:X}=ee(w,K[0],K[1],K[2],K[3]);h[p++]=P,h[p++]=Z,h[p++]=k,h[p++]=X}return(0,n.clean)(w),b},decrypt(l,m){de(l);const y=F(c);m=(0,n.getOutput)(l.length,m);const h=[y];(0,n.isAligned32)(l)||h.push(l=(0,n.copyBytes)(l)),(0,n.complexOverlapBytes)(l,m);const b=(0,n.u32)(l),w=(0,n.u32)(m);for(let p=0;p+4<=b.length;){const{s0:K,s1:P,s2:Z,s3:k}=le(y,b[p+0],b[p+1],b[p+2],b[p+3]);w[p++]=K,w[p++]=P,w[p++]=Z,w[p++]=k}return(0,n.clean)(...h),ye(m,u)}}}),e.cbc=(0,n.wrapCipher)({blockSize:16,nonceLength:16},function(c,a,u={}){const l=!u.disablePadding;return{encrypt(m,y){const h=j(c),{b,o:w,out:p}=fe(m,l,y);let K=a;const P=[h];(0,n.isAligned32)(K)||P.push(K=(0,n.copyBytes)(K));const Z=(0,n.u32)(K);let k=Z[0],X=Z[1],Y=Z[2],Q=Z[3],M=0;for(;M+4<=b.length;)k^=b[M+0],X^=b[M+1],Y^=b[M+2],Q^=b[M+3],{s0:k,s1:X,s2:Y,s3:Q}=ee(h,k,X,Y,Q),w[M++]=k,w[M++]=X,w[M++]=Y,w[M++]=Q;if(l){const we=W(m.subarray(M*4));k^=we[0],X^=we[1],Y^=we[2],Q^=we[3],{s0:k,s1:X,s2:Y,s3:Q}=ee(h,k,X,Y,Q),w[M++]=k,w[M++]=X,w[M++]=Y,w[M++]=Q}return(0,n.clean)(...P),p},decrypt(m,y){de(m);const h=F(c);let b=a;const w=[h];(0,n.isAligned32)(b)||w.push(b=(0,n.copyBytes)(b));const p=(0,n.u32)(b);y=(0,n.getOutput)(m.length,y),(0,n.isAligned32)(m)||w.push(m=(0,n.copyBytes)(m)),(0,n.complexOverlapBytes)(m,y);const K=(0,n.u32)(m),P=(0,n.u32)(y);let Z=p[0],k=p[1],X=p[2],Y=p[3];for(let Q=0;Q+4<=K.length;){const M=Z,we=k,ue=X,re=Y;Z=K[Q+0],k=K[Q+1],X=K[Q+2],Y=K[Q+3];const{s0:R,s1:T,s2:A,s3:z}=le(h,Z,k,X,Y);P[Q++]=R^M,P[Q++]=T^we,P[Q++]=A^ue,P[Q++]=z^re}return(0,n.clean)(...w),ye(y,l)}}}),e.cfb=(0,n.wrapCipher)({blockSize:16,nonceLength:16},function(c,a){function u(l,m,y){(0,n.abytes)(l);const h=l.length;if(y=(0,n.getOutput)(h,y),(0,n.overlapBytes)(l,y))throw new Error("overlapping src and dst not supported.");const b=j(c);let w=a;const p=[b];(0,n.isAligned32)(w)||p.push(w=(0,n.copyBytes)(w)),(0,n.isAligned32)(l)||p.push(l=(0,n.copyBytes)(l));const K=(0,n.u32)(l),P=(0,n.u32)(y),Z=m?P:K,k=(0,n.u32)(w);let X=k[0],Y=k[1],Q=k[2],M=k[3];for(let ue=0;ue+4<=K.length;){const{s0:re,s1:R,s2:T,s3:A}=ee(b,X,Y,Q,M);P[ue+0]=K[ue+0]^re,P[ue+1]=K[ue+1]^R,P[ue+2]=K[ue+2]^T,P[ue+3]=K[ue+3]^A,X=Z[ue++],Y=Z[ue++],Q=Z[ue++],M=Z[ue++]}const we=f*Math.floor(K.length/g);if(we<h){({s0:X,s1:Y,s2:Q,s3:M}=ee(b,X,Y,Q,M));const ue=(0,n.u8)(new Uint32Array([X,Y,Q,M]));for(let re=we,R=0;re<h;re++,R++)y[re]=l[re]^ue[R];(0,n.clean)(ue)}return(0,n.clean)(...p),y}return{encrypt:(l,m)=>u(l,!0,m),decrypt:(l,m)=>u(l,!1,m)}});function G(r,c,a,u,l){const m=l?l.length:0,y=r.create(a,u.length+m);l&&y.update(l);const h=(0,n.u64Lengths)(8*u.length,8*m,c);y.update(u),y.update(h);const b=y.digest();return(0,n.clean)(h),b}e.gcm=(0,n.wrapCipher)({blockSize:16,nonceLength:12,tagLength:16,varSizeNonce:!0},function(c,a,u){if(a.length<8)throw new Error("aes/gcm: invalid nonce length");const l=16;function m(h,b,w){const p=G(t.ghash,!1,h,w,u);for(let K=0;K<b.length;K++)p[K]^=b[K];return p}function y(){const h=j(c),b=d.slice(),w=d.slice();if(ce(h,!1,w,w,b),a.length===12)w.set(a);else{const K=d.slice(),P=(0,n.createView)(K);(0,n.setBigUint64)(P,8,BigInt(a.length*8),!1);const Z=t.ghash.create(b).update(a).update(K);Z.digestInto(w),Z.destroy()}const p=ce(h,!1,w,d);return{xk:h,authKey:b,counter:w,tagMask:p}}return{encrypt(h){const{xk:b,authKey:w,counter:p,tagMask:K}=y(),P=new Uint8Array(h.length+l),Z=[b,w,p,K];(0,n.isAligned32)(h)||Z.push(h=(0,n.copyBytes)(h)),ce(b,!1,p,h,P.subarray(0,h.length));const k=m(w,K,P.subarray(0,P.length-l));return Z.push(k),P.set(k,h.length),(0,n.clean)(...Z),P},decrypt(h){const{xk:b,authKey:w,counter:p,tagMask:K}=y(),P=[b,w,K,p];(0,n.isAligned32)(h)||P.push(h=(0,n.copyBytes)(h));const Z=h.subarray(0,-l),k=h.subarray(-l),X=m(w,K,Z);if(P.push(X),!(0,n.equalBytes)(X,k))throw new Error("aes/gcm: invalid ghash tag");const Y=ce(b,!1,p,Z);return(0,n.clean)(...P),Y}}});const o=(r,c,a)=>u=>{if(!Number.isSafeInteger(u)||c>u||u>a){const l="["+c+".."+a+"]";throw new Error(""+r+": expected value in range "+l+", got "+u)}};e.gcmsiv=(0,n.wrapCipher)({blockSize:16,nonceLength:12,tagLength:16,varSizeNonce:!0},function(c,a,u){const m=o("AAD",0,68719476736),y=o("plaintext",0,2**36),h=o("nonce",12,12),b=o("ciphertext",16,2**36+16);(0,n.abytes)(c,16,24,32),h(a.length),u!==void 0&&m(u.length);function w(){const P=j(c),Z=new Uint8Array(c.length),k=new Uint8Array(16),X=[P,Z];let Y=a;
1(0,n.isAligned32)(Y)||X.push(Y=(0,n.copyBytes)(Y));const Q=(0,n.u32)(Y);let M=0,we=Q[0],ue=Q[1],re=Q[2],R=0;for(const A of[k,Z].map(n.u32)){const z=(0,n.u32)(A);for(let J=0;J<z.length;J+=2){const{s0:oe,s1:ne}=ee(P,M,we,ue,re);z[J+0]=oe,z[J+1]=ne,M=++R}}const T={authKey:k,encKey:j(Z)};return(0,n.clean)(...X),T}function p(P,Z,k){const X=G(t.polyval,!0,Z,k,u);for(let re=0;re<12;re++)X[re]^=a[re];X[15]&=127;const Y=(0,n.u32)(X);let Q=Y[0],M=Y[1],we=Y[2],ue=Y[3];return{s0:Q,s1:M,s2:we,s3:ue}=ee(P,Q,M,we,ue),Y[0]=Q,Y[1]=M,Y[2]=we,Y[3]=ue,X}function K(P,Z,k){let X=(0,n.copyBytes)(Z);X[15]|=128;const Y=ce(P,!0,X,k);return(0,n.clean)(X),Y}return{encrypt(P){y(P.length);const{encKey:Z,authKey:k}=w(),X=p(Z,k,P),Y=[Z,k,X];(0,n.isAligned32)(P)||Y.push(P=(0,n.copyBytes)(P));const Q=new Uint8Array(P.length+16);return Q.set(X,P.length),Q.set(K(Z,X,P)),(0,n.clean)(...Y),Q},decrypt(P){b(P.length);const Z=P.subarray(-16),{encKey:k,authKey:X}=w(),Y=[k,X];(0,n.isAligned32)(P)||Y.push(P=(0,n.copyBytes)(P));const Q=K(k,Z,P.subarray(0,-16)),M=p(k,X,Q);if(Y.push(M),!(0,n.equalBytes)(Z,M))throw(0,n.clean)(...Y),new Error("invalid polyval tag");return(0,n.clean)(...Y),Q}}}),e.siv=e.gcmsiv;function _(r){return r instanceof Uint32Array||ArrayBuffer.isView(r)&&r.constructor.name==="Uint32Array"}function v(r,c){if((0,n.abytes)(c,16),!_(r))throw new Error("_encryptBlock accepts result of expandKeyLE");const a=(0,n.u32)(c);let{s0:u,s1:l,s2:m,s3:y}=ee(r,a[0],a[1],a[2],a[3]);return a[0]=u,a[1]=l,a[2]=m,a[3]=y,c}function s(r,c){if((0,n.abytes)(c,16),!_(r))throw new Error("_decryptBlock accepts result of expandKeyLE");const a=(0,n.u32)(c);let{s0:u,s1:l,s2:m,s3:y}=le(r,a[0],a[1],a[2],a[3]);return a[0]=u,a[1]=l,a[2]=m,a[3]=y,c}const B={encrypt(r,c){if(c.length>=2**32)throw new Error("plaintext should be less than 4gb");const a=j(r);if(c.length===16)v(a,c);else{const u=(0,n.u32)(c);let l=u[0],m=u[1];for(let y=0,h=1;y<6;y++)for(let b=2;b<u.length;b+=2,h++){const{s0:w,s1:p,s2:K,s3:P}=ee(a,l,m,u[b],u[b+1]);l=w,m=p^L(h),u[b]=K,u[b+1]=P}u[0]=l,u[1]=m}a.fill(0)},decrypt(r,c){if(c.length-8>=2**32)throw new Error("ciphertext should be less than 4gb");const a=F(r),u=c.length/8-1;if(u===1)s(a,c);else{const l=(0,n.u32)(c);let m=l[0],y=l[1];for(let h=0,b=u*6;h<6;h++)for(let w=u*2;w>=1;w-=2,b--){y^=L(b);const{s0:p,s1:K,s2:P,s3:Z}=le(a,m,y,l[w],l[w+1]);m=p,y=K,l[w]=P,l[w+1]=Z}l[0]=m,l[1]=y}a.fill(0)}},q=new Uint8Array(8).fill(166);e.aeskw=(0,n.wrapCipher)({blockSize:8},r=>({encrypt(c){if(!c.length||c.length%8!==0)throw new Error("invalid plaintext length");if(c.length===8)throw new Error("8-byte keys not allowed in AESKW, use AESKWP instead");const a=(0,n.concatBytes)(q,c);return B.encrypt(r,a),a},decrypt(c){if(c.length%8!==0||c.length<3*8)throw new Error("invalid ciphertext length");const a=(0,n.copyBytes)(c);if(B.decrypt(r,a),!(0,n.equalBytes)(a.subarray(0,8),q))throw new Error("integrity check failed");return a.subarray(0,8).fill(0),a.subarray(8)}}));const i=2790873510;e.aeskwp=(0,n.wrapCipher)({blockSize:8},r=>({encrypt(c){if(!c.length)throw new Error("invalid plaintext length");const a=Math.ceil(c.length/8)*8,u=new Uint8Array(8+a);u.set(c,8);const l=(0,n.u32)(u);return l[0]=i,l[1]=L(c.length),B.encrypt(r,u),u},decrypt(c){if(c.length<16)throw new Error("invalid ciphertext length");const a=(0,n.copyBytes)(c),u=(0,n.u32)(a);B.decrypt(r,a);const l=L(u[1])>>>0,m=Math.ceil(l/8)*8;if(u[0]!==i||a.length-8!==m)throw new Error("integrity check failed");for(let y=l;y<m;y++)if(a[8+y]!==0)throw new Error("integrity check failed");return a.subarray(0,8).fill(0),a.subarray(8,8+l)}})),e.unsafe={expandKeyLE:j,expandKeyDecLE:F,encrypt:ee,decrypt:le,encryptBlock:v,decryptBlock:s,ctrCounter:ge,ctr32:ce}})(Ct);Object.defineProperty(Ne,"__esModule",{value:!0});Ne.aes256cbc=Ne.aes256gcm=void 0;const Pt=Ct,Xt=(e,t,n)=>(0,Pt.gcm)(e,t,n);Ne.aes256gcm=Xt;const Ft=(e,t,n)=>(0,Pt.cbc)(e,t);Ne.aes256cbc=Ft;var je={},At={},Fe={};Object.defineProperty(Fe,"__esModule",{value:!0});Fe.rotl=nn;Fe.createCipher=sn;const Ee=Pe,Ut=e=>Uint8Array.from(e.split("").map(t=>
1t.charCodeAt(0))),Qt=Ut("expand 16-byte k"),Jt=Ut("expand 32-byte k"),en=(0,Ee.u32)(Qt),tn=(0,Ee.u32)(Jt);function nn(e,t){return e<<t|e>>>32-t}function et(e){return e.byteOffset%4===0}const ke=64,rn=16,It=2**32-1,ft=new Uint32Array;function on(e,t,n,f,g,d,I,S){const D=g.length,x=new Uint8Array(ke),V=(0,Ee.u32)(x),N=et(g)&&et(d),O=N?(0,Ee.u32)(g):ft,L=N?(0,Ee.u32)(d):ft;for(let C=0;C<D;I++){if(e(t,n,f,V,I,S),I>=It)throw new Error("arx: counter overflow");const H=Math.min(ke,D-C);if(N&&H===ke){const E=C/4;if(C%4!==0)throw new Error("arx: invalid block position");for(let U=0,j;U<rn;U++)j=E+U,L[j]=O[j]^V[U];C+=ke;continue}for(let E=0,U;E<H;E++)U=C+E,d[U]=g[U]^x[E];C+=H}}function sn(e,t){const{allowShortKeys:n,extendNonceFn:f,counterLength:g,counterRight:d,rounds:I}=(0,Ee.checkOpts)({allowShortKeys:!1,counterLength:8,counterRight:!1,rounds:20},t);if(typeof e!="function")throw new Error("core must be a function");return(0,Ee.anumber)(g),(0,Ee.anumber)(I),(0,Ee.abool)(d),(0,Ee.abool)(n),(S,D,x,V,N=0)=>{(0,Ee.abytes)(S),(0,Ee.abytes)(D),(0,Ee.abytes)(x);const O=x.length;if(V===void 0&&(V=new Uint8Array(O)),(0,Ee.abytes)(V),(0,Ee.anumber)(N),N<0||N>=It)throw new Error("arx: counter overflow");if(V.length<O)throw new Error(`arx: output (${V.length}) is shorter than data (${O})`);const L=[];let C=S.length,H,E;if(C===32)L.push(H=(0,Ee.copyBytes)(S)),E=tn;else if(C===16&&n)H=new Uint8Array(32),H.set(S),H.set(S,16),E=en,L.push(H);else throw new Error(`arx: invalid 32-byte key, got length=${C}`);et(D)||L.push(D=(0,Ee.copyBytes)(D));const U=(0,Ee.u32)(H);if(f){if(D.length!==24)throw new Error("arx: extended nonce must be 24 bytes");f(E,U,(0,Ee.u32)(D.subarray(0,16)),U),D=D.subarray(16)}const j=16-g;if(j!==D.length)throw new Error(`arx: nonce must be ${j} or 16 bytes`);if(j!==12){const $=new Uint8Array(12);$.set(D,d?0:12-D.length),D=$,L.push(D)}const F=(0,Ee.u32)(D);return on(e,E,U,F,x,V,N,I),(0,Ee.clean)(...L),V}}var De={};Object.defineProperty(De,"__esModule",{value:!0});De.poly1305=void 0;De.wrapConstructorWithKey=Lt;const Ue=Pe,Se=(e,t)=>e[t++]&255|(e[t++]&255)<<8;class cn{constructor(t){this.blockLen=16,this.outputLen=16,this.buffer=new Uint8Array(16),this.r=new Uint16Array(10),this.h=new Uint16Array(10),this.pad=new Uint16Array(8),this.pos=0,this.finished=!1,t=(0,Ue.toBytes)(t),(0,Ue.abytes)(t,32);const n=Se(t,0),f=Se(t,2),g=Se(t,4),d=Se(t,6),I=Se(t,8),S=Se(t,10),D=Se(t,12),x=Se(t,14);this.r[0]=n&8191,this.r[1]=(n>>>13|f<<3)&8191,this.r[2]=(f>>>10|g<<6)&7939,this.r[3]=(g>>>7|d<<9)&8191,this.r[4]=(d>>>4|I<<12)&255,this.r[5]=I>>>1&8190,this.r[6]=(I>>>14|S<<2)&8191,this.r[7]=(S>>>11|D<<5)&8065,this.r[8]=(D>>>8|x<<8)&8191,this.r[9]=x>>>5&127;for(let V=0;V<8;V++)this.pad[V]=Se(t,16+2*V)}process(t,n,f=!1){const g=f?0:2048,{h:d,r:I}=this,S=I[0],D=I[1],x=I[2],V=I[3],N=I[4],O=I[5],L=I[6],C=I[7],H=I[8],E=I[9],U=Se(t,n+0),j=Se(t,n+2),F=Se(t,n+4),$=Se(t,n+6),se=Se(t,n+8),ee=Se(t,n+10),le=Se(t,n+12),ge=Se(t,n+14);let ce=d[0]+(U&8191),de=d[1]+((U>>>13|j<<3)&8191),fe=d[2]+((j>>>10|F<<6)&8191),ye=d[3]+((F>>>7|$<<9)&8191),W=d[4]+(($>>>4|se<<12)&8191),G=d[5]+(se>>>1&8191),o=d[6]+((se>>>14|ee<<2)&8191),_=d[7]+((ee>>>11|le<<5)&8191),v=d[8]+((le>>>8|ge<<8)&8191),s=d[9]+(ge>>>5|g),B=0,q=B+ce*S+de*(5*E)+fe*(5*H)+ye*(5*C)+W*(5*L);B=q>>>13,q&=8191,q+=G*(5*O)+o*(5*N)+_*(5*V)+v*(5*x)+s*(5*D),B+=q>>>13,q&=8191;let i=B+ce*D+de*S+fe*(5*E)+ye*(5*H)+W*(5*C);B=i>>>13,i&=8191,i+=G*(5*L)+o*(5*O)+_*(5*N)+v*(5*V)+s*(5*x),B+=i>>>13,i&=8191;let r=B+ce*x+de*D+fe*S+ye*(5*E)+W*(5*H);B=r>>>13,r&=8191,r+=G*(5*C)+o*(5*L)+_*(5*O)+v*(5*N)+s*(5*V),B+=r>>>13,r&=8191;let c=B+ce*V+de*x+fe*D+ye*S+W*(5*E);B=c>>>13,c&=8191,c+=G*(5*H)+o*(5*C)+_*(5*L)+v*(5*O)+s*(5*N),B+=c>>>13,c&=8191;let a=B+ce*N+de*V+fe*x+ye*D+W*S;B=a>>>13,a&=8191,a+=G*(5*E)+o*(5*H)+_*(5*C)+v*(5*L)+s*(5*O),B+=a>>>13,a&=8191;let u=B+ce*O+de*N+fe*V+ye*x+W*D;B=u>>>13,u&=8191,u+=G*S+o*(5*E)+_*(5*H)+v*(5*C)+s*(5*L),B+=u>>>13,u&=8191;let l=B+ce*L+de*O+fe*N+ye*V+W*x;B=l>>>13,l&=8191,l+=G*D+o*S+_*(5*E)+v*(5*H)+s*(5*C),B+=l>>>13,l&=8191;let m=B+ce*C+de*L+fe*O+ye*N+W*V;B=m>>>13,m&=8191,m+=G*x+o*D+_*S+v*(5*E)+s*(5*H),B+=m>>>13,m&=8191;let y=B+ce*H+de*C+fe*L+ye*O+W*N;B=y>>>13,y&=8191,y+=G*V+o*x+_*D+v*S+s*(5*E),B+=y>>>13,y&=8191;let h=B+ce*E+de*H+fe*C+ye*L+W*O;B=h>>>
113,h&=8191,h+=G*N+o*V+_*x+v*D+s*S,B+=h>>>13,h&=8191,B=(B<<2)+B|0,B=B+q|0,q=B&8191,B=B>>>13,i+=B,d[0]=q,d[1]=i,d[2]=r,d[3]=c,d[4]=a,d[5]=u,d[6]=l,d[7]=m,d[8]=y,d[9]=h}finalize(){const{h:t,pad:n}=this,f=new Uint16Array(10);let g=t[1]>>>13;t[1]&=8191;for(let S=2;S<10;S++)t[S]+=g,g=t[S]>>>13,t[S]&=8191;t[0]+=g*5,g=t[0]>>>13,t[0]&=8191,t[1]+=g,g=t[1]>>>13,t[1]&=8191,t[2]+=g,f[0]=t[0]+5,g=f[0]>>>13,f[0]&=8191;for(let S=1;S<10;S++)f[S]=t[S]+g,g=f[S]>>>13,f[S]&=8191;f[9]-=8192;let d=(g^1)-1;for(let S=0;S<10;S++)f[S]&=d;d=~d;for(let S=0;S<10;S++)t[S]=t[S]&d|f[S];t[0]=(t[0]|t[1]<<13)&65535,t[1]=(t[1]>>>3|t[2]<<10)&65535,t[2]=(t[2]>>>6|t[3]<<7)&65535,t[3]=(t[3]>>>9|t[4]<<4)&65535,t[4]=(t[4]>>>12|t[5]<<1|t[6]<<14)&65535,t[5]=(t[6]>>>2|t[7]<<11)&65535,t[6]=(t[7]>>>5|t[8]<<8)&65535,t[7]=(t[8]>>>8|t[9]<<5)&65535;let I=t[0]+n[0];t[0]=I&65535;for(let S=1;S<8;S++)I=(t[S]+n[S]|0)+(I>>>16)|0,t[S]=I&65535;(0,Ue.clean)(f)}update(t){(0,Ue.aexists)(this),t=(0,Ue.toBytes)(t),(0,Ue.abytes)(t);const{buffer:n,blockLen:f}=this,g=t.length;for(let d=0;d<g;){const I=Math.min(f-this.pos,g-d);if(I===f){for(;f<=g-d;d+=f)this.process(t,d);continue}n.set(t.subarray(d,d+I),this.pos),this.pos+=I,d+=I,this.pos===f&&(this.process(n,0,!1),this.pos=0)}return this}destroy(){(0,Ue.clean)(this.h,this.r,this.buffer,this.pad)}digestInto(t){(0,Ue.aexists)(this),(0,Ue.aoutput)(t,this),this.finished=!0;const{buffer:n,h:f}=this;let{pos:g}=this;if(g){for(n[g++]=1;g<16;g++)n[g]=0;this.process(n,0,!0)}this.finalize();let d=0;for(let I=0;I<8;I++)t[d++]=f[I]>>>0,t[d++]=f[I]>>>8;return t}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const f=t.slice(0,n);return this.destroy(),f}}function Lt(e){const t=(f,g)=>e(g).update((0,Ue.toBytes)(f)).digest(),n=e(new Uint8Array(32));return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=f=>e(f),t}De.poly1305=Lt(e=>new cn(e));(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.xchacha20poly1305=e.chacha20poly1305=e._poly1305_aead=e.chacha12=e.chacha8=e.xchacha20=e.chacha20=e.chacha20orig=void 0,e.hchacha=d;const t=Fe,n=De,f=Pe;function g(N,O,L,C,H,E=20){let U=N[0],j=N[1],F=N[2],$=N[3],se=O[0],ee=O[1],le=O[2],ge=O[3],ce=O[4],de=O[5],fe=O[6],ye=O[7],W=H,G=L[0],o=L[1],_=L[2],v=U,s=j,B=F,q=$,i=se,r=ee,c=le,a=ge,u=ce,l=de,m=fe,y=ye,h=W,b=G,w=o,p=_;for(let P=0;P<E;P+=2)v=v+i|0,h=(0,t.rotl)(h^v,16),u=u+h|0,i=(0,t.rotl)(i^u,12),v=v+i|0,h=(0,t.rotl)(h^v,8),u=u+h|0,i=(0,t.rotl)(i^u,7),s=s+r|0,b=(0,t.rotl)(b^s,16),l=l+b|0,r=(0,t.rotl)(r^l,12),s=s+r|0,b=(0,t.rotl)(b^s,8),l=l+b|0,r=(0,t.rotl)(r^l,7),B=B+c|0,w=(0,t.rotl)(w^B,16),m=m+w|0,c=(0,t.rotl)(c^m,12),B=B+c|0,w=(0,t.rotl)(w^B,8),m=m+w|0,c=(0,t.rotl)(c^m,7),q=q+a|0,p=(0,t.rotl)(p^q,16),y=y+p|0,a=(0,t.rotl)(a^y,12),q=q+a|0,p=(0,t.rotl)(p^q,8),y=y+p|0,a=(0,t.rotl)(a^y,7),v=v+r|0,p=(0,t.rotl)(p^v,16),m=m+p|0,r=(0,t.rotl)(r^m,12),v=v+r|0,p=(0,t.rotl)(p^v,8),m=m+p|0,r=(0,t.rotl)(r^m,7),s=s+c|0,h=(0,t.rotl)(h^s,16),y=y+h|0,c=(0,t.rotl)(c^y,12),s=s+c|0,h=(0,t.rotl)(h^s,8),y=y+h|0,c=(0,t.rotl)(c^y,7),B=B+a|0,b=(0,t.rotl)(b^B,16),u=u+b|0,a=(0,t.rotl)(a^u,12),B=B+a|0,b=(0,t.rotl)(b^B,8),u=u+b|0,a=(0,t.rotl)(a^u,7),q=q+i|0,w=(0,t.rotl)(w^q,16),l=l+w|0,i=(0,t.rotl)(i^l,12),q=q+i|0,w=(0,t.rotl)(w^q,8),l=l+w|0,i=(0,t.rotl)(i^l,7);let K=0;C[K++]=U+v|0,C[K++]=j+s|0,C[K++]=F+B|0,C[K++]=$+q|0,C[K++]=se+i|0,C[K++]=ee+r|0,C[K++]=le+c|0,C[K++]=ge+a|0,C[K++]=ce+u|0,C[K++]=de+l|0,C[K++]=fe+m|0,C[K++]=ye+y|0,C[K++]=W+h|0,C[K++]=G+b|0,C[K++]=o+w|0,C[K++]=_+p|0}function d(N,O,L,C){let H=N[0],E=N[1],U=N[2],j=N[3],F=O[0],$=O[1],se=O[2],ee=O[3],le=O[4],ge=O[5],ce=O[6],de=O[7],fe=L[0],ye=L[1],W=L[2],G=L[3];for(let _=0;_<20;_+=2)H=H+F|0,fe=(0,t.rotl)(fe^H,16),le=le+fe|0,F=(0,t.rotl)(F^le,12),H=H+F|0,fe=(0,t.rotl)(fe^H,8),le=le+fe|0,F=(0,t.rotl)(F^le,7),E=E+$|0,ye=(0,t.rotl)(ye^E,16),ge=ge+ye|0,$=(0,t.rotl)($^ge,12),E=E+$|0,ye=(0,t.rotl)(ye^E,8),ge=ge+ye|0,$=(0,t.rotl)($^ge,7),U=U+se|0,W=(0,t.rotl)(W^U,16),ce=ce+W|0,se=(0,t.rotl)(se^ce,12),U=U+se|0,W=(0,t.rotl)(W^U,8),ce=ce+W|0,se=(0,t.rotl)(se^ce,7),j=j+ee|0,G=(0,t.rotl)(G^j,16),de=de+G|0,ee=(0,t.rotl)(ee^de,12),j=j+ee|0,G=(0,t.rotl)(G^j,8),de=de+G|0,ee=(0,t.rotl)(ee^de,7),H=H+$|0,G=(0,t.rotl)(G^H,16),ce=ce+G|0,$=(0,t.rotl)($^ce,12),H=H+$|0,G=(0,t.rotl)(G^H,8),ce=ce+G|0,$=(0,t.rotl)($^ce,7),E=E+se|0,fe=(0,t.rotl)(fe^E,16),de=de+fe|0,se=(0,t.rotl)(se^de,12),E=E+se|0,fe=(0,t.rotl)(fe^E,8),de=
1de+fe|0,se=(0,t.rotl)(se^de,7),U=U+ee|0,ye=(0,t.rotl)(ye^U,16),le=le+ye|0,ee=(0,t.rotl)(ee^le,12),U=U+ee|0,ye=(0,t.rotl)(ye^U,8),le=le+ye|0,ee=(0,t.rotl)(ee^le,7),j=j+F|0,W=(0,t.rotl)(W^j,16),ge=ge+W|0,F=(0,t.rotl)(F^ge,12),j=j+F|0,W=(0,t.rotl)(W^j,8),ge=ge+W|0,F=(0,t.rotl)(F^ge,7);let o=0;C[o++]=H,C[o++]=E,C[o++]=U,C[o++]=j,C[o++]=fe,C[o++]=ye,C[o++]=W,C[o++]=G}e.chacha20orig=(0,t.createCipher)(g,{counterRight:!1,counterLength:8,allowShortKeys:!0}),e.chacha20=(0,t.createCipher)(g,{counterRight:!1,counterLength:4,allowShortKeys:!1}),e.xchacha20=(0,t.createCipher)(g,{counterRight:!1,counterLength:8,extendNonceFn:d,allowShortKeys:!1}),e.chacha8=(0,t.createCipher)(g,{counterRight:!1,counterLength:4,rounds:8}),e.chacha12=(0,t.createCipher)(g,{counterRight:!1,counterLength:4,rounds:12});const I=new Uint8Array(16),S=(N,O)=>{N.update(O);const L=O.length%16;L&&N.update(I.subarray(L))},D=new Uint8Array(32);function x(N,O,L,C,H){const E=N(O,L,D),U=n.poly1305.create(E);H&&S(U,H),S(U,C);const j=(0,f.u64Lengths)(C.length,H?H.length:0,!0);U.update(j);const F=U.digest();return(0,f.clean)(E,j),F}const V=N=>(O,L,C)=>({encrypt(E,U){const j=E.length;U=(0,f.getOutput)(j+16,U,!1),U.set(E);const F=U.subarray(0,-16);N(O,L,F,F,1);const $=x(N,O,L,F,C);return U.set($,j),(0,f.clean)($),U},decrypt(E,U){U=(0,f.getOutput)(E.length-16,U,!1);const j=E.subarray(0,-16),F=E.subarray(-16),$=x(N,O,L,j,C);if(!(0,f.equalBytes)(F,$))throw new Error("invalid tag");return U.set(E.subarray(0,-16)),N(O,L,U,U,1),(0,f.clean)($),U}});e._poly1305_aead=V,e.chacha20poly1305=(0,f.wrapCipher)({blockSize:64,nonceLength:12,tagLength:16},(0,e._poly1305_aead)(e.chacha20)),e.xchacha20poly1305=(0,f.wrapCipher)({blockSize:64,nonceLength:24,tagLength:16},(0,e._poly1305_aead)(e.xchacha20))})(At);Object.defineProperty(je,"__esModule",{value:!0});je.chacha20=je.xchacha20=void 0;const Tt=At,an=(e,t,n)=>(0,Tt.xchacha20poly1305)(e,t,n);je.xchacha20=an;const fn=(e,t,n)=>(0,Tt.chacha20poly1305)(e,t,n);je.chacha20=fn;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.aesDecrypt=e.aesEncrypt=e.symDecrypt=e.symEncrypt=void 0;var t=Ne,n=je,f=Pe,g=nt,d=Ve,I=Ce,S=function(O,L,C){return x(V,d.ECIES_CONFIG.symmetricAlgorithm,d.ECIES_CONFIG.symmetricNonceLength,O,L,C)};e.symEncrypt=S;var D=function(O,L,C){return x(N,d.ECIES_CONFIG.symmetricAlgorithm,d.ECIES_CONFIG.symmetricNonceLength,O,L,C)};e.symDecrypt=D,e.aesEncrypt=e.symEncrypt,e.aesDecrypt=e.symDecrypt;function x(O,L,C,H,E,U){if(L==="aes-256-gcm")return O(t.aes256gcm,H,E,C,I.AEAD_TAG_LENGTH,U);if(L==="xchacha20")return O(n.xchacha20,H,E,I.XCHACHA20_NONCE_LENGTH,I.AEAD_TAG_LENGTH,U);if(L==="aes-256-cbc")return O(t.aes256cbc,H,E,16,0);throw new Error("Not implemented")}function V(O,L,C,H,E,U){var j=(0,g.randomBytes)(H),F=O(L,j,U),$=F.encrypt(C);if(E===0)return(0,f.concatBytes)(j,$);var se=$.length-E,ee=$.subarray(0,se),le=$.subarray(se);return(0,f.concatBytes)(j,le,ee)}function N(O,L,C,H,E,U){var j=C.subarray(0,H),F=O(L,Uint8Array.from(j),U),$=C.subarray(H);if(E===0)return F.decrypt($);var se=$.subarray(0,E),ee=$.subarray(E);return F.decrypt((0,f.concatBytes)(ee,se))}})(Bt);(function(e){var t=Ge&&Ge.__createBinding||(Object.create?function(f,g,d,I){I===void 0&&(I=d);var S=Object.getOwnPropertyDescriptor(g,d);(!S||("get"in S?!g.__esModule:S.writable||S.configurable))&&(S={enumerable:!0,get:function(){return g[d]}}),Object.defineProperty(f,I,S)}:function(f,g,d,I){I===void 0&&(I=d),f[I]=g[d]}),n=Ge&&Ge.__exportStar||function(f,g){for(var d in f)d!=="default"&&!Object.prototype.hasOwnProperty.call(g,d)&&t(g,f,d)};Object.defineProperty(e,"__esModule",{value:!0}),n(bt,e),n(wt,e),n(ot,e),n(Bt,e)})($e);var qe={};Object.defineProperty(qe,"__esModule",{value:!0});qe.PublicKey=void 0;var ut=Pe,ze=$e,un=function(){function e(t,n){var f=(0,ze.convertPublicKeyFormat)(t,!0,n),g=(0,ze.convertPublicKeyFormat)(t,!1,n);this.data=f,this.dataUncompressed=f.length!==g.length?g:null}return e.fromHex=function(t,n){return new e((0,ze.hexToPublicKey)(t,n),n)},Object.defineProperty(e.prototype,"_uncompressed",{get:function(){return this.dataUncompressed!==null?this.dataUncompressed:this.data}
1,enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"uncompressed",{get:function(){return Buffer.from(this._uncompressed)},enumerable:!1,configurable:!0}),Object.defineProperty(e.prototype,"compressed",{get:function(){return Buffer.from(this.data)},enumerable:!1,configurable:!0}),e.prototype.toBytes=function(t){return t===void 0&&(t=!0),t?this.data:this._uncompressed},e.prototype.toHex=function(t){return t===void 0&&(t=!0),(0,ut.bytesToHex)(this.toBytes(t))},e.prototype.decapsulate=function(t,n){n===void 0&&(n=!1);var f=this.toBytes(n),g=t.multiply(this,n);return(0,ze.getSharedKey)(f,g)},e.prototype.equals=function(t){return(0,ut.equalBytes)(this.data,t.data)},e}();qe.PublicKey=un;Object.defineProperty(Ye,"__esModule",{value:!0});Ye.PrivateKey=void 0;var lt=Pe,He=$e,ln=qe,dn=function(){function e(t,n){if(this.curve=n,t===void 0)this.data=(0,He.getValidSecret)(n);else if((0,He.isValidPrivateKey)(t,n))this.data=t;else throw new Error("Invalid private key");this.publicKey=new ln.PublicKey((0,He.getPublicKey)(this.data,n),n)}return e.fromHex=function(t,n){return new e((0,He.decodeHex)(t),n)},Object.defineProperty(e.prototype,"secret",{get:function(){return Buffer.from(this.data)},enumerable:!1,configurable:!0}),e.prototype.toHex=function(){return(0,lt.bytesToHex)(this.data)},e.prototype.encapsulate=function(t,n){n===void 0&&(n=!1);var f=this.publicKey.toBytes(n),g=this.multiply(t,n);return(0,He.getSharedKey)(f,g)},e.prototype.multiply=function(t,n){return n===void 0&&(n=!1),(0,He.getSharedPoint)(this.data,t.toBytes(!0),n,this.curve)},e.prototype.equals=function(t){return(0,lt.equalBytes)(this.data,t.data)},e}();Ye.PrivateKey=dn;(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.PublicKey=e.PrivateKey=void 0;var t=Ye;Object.defineProperty(e,"PrivateKey",{enumerable:!0,get:function(){return t.PrivateKey}});var n=qe;Object.defineProperty(e,"PublicKey",{enumerable:!0,get:function(){return n.PublicKey}})})(Je);(function(e){Object.defineProperty(e,"__esModule",{value:!0}),e.utils=e.PublicKey=e.PrivateKey=e.ECIES_CONFIG=void 0,e.encrypt=d,e.decrypt=S;var t=Pe,n=Ve,f=Je,g=$e;function d(N,O){return Buffer.from(I(N,O,n.ECIES_CONFIG))}function I(N,O,L){var C=L.ellipticCurve,H=new f.PrivateKey(void 0,C),E=N instanceof Uint8Array?new f.PublicKey(N,C):f.PublicKey.fromHex(N,C),U=H.encapsulate(E,L.isHkdfKeyCompressed),j=H.publicKey.toBytes(L.isEphemeralKeyCompressed),F=(0,g.symEncrypt)(U,O);return(0,t.concatBytes)(j,F)}function S(N,O){return Buffer.from(D(N,O))}function D(N,O,L){L===void 0&&(L=n.ECIES_CONFIG);var C=L.ellipticCurve,H=N instanceof Uint8Array?new f.PrivateKey(N,C):f.PrivateKey.fromHex(N,C),E=L.ephemeralKeySize,U=new f.PublicKey(O.subarray(0,E),C),j=O.subarray(E),F=U.decapsulate(H,L.isHkdfKeyCompressed);return(0,g.symDecrypt)(F,j)}var x=Ve;Object.defineProperty(e,"ECIES_CONFIG",{enumerable:!0,get:function(){return x.ECIES_CONFIG}});var V=Je;Object.defineProperty(e,"PrivateKey",{enumerable:!0,get:function(){return V.PrivateKey}}),Object.defineProperty(e,"PublicKey",{enumerable:!0,get:function(){return V.PublicKey}}),e.utils={aesEncrypt:g.aesEncrypt,aesDecrypt:g.aesDecrypt,symEncrypt:g.symEncrypt,symDecrypt:g.symDecrypt,decodeHex:g.decodeHex,getValidSecret:g.getValidSecret,remove0x:g.remove0x}})(tt);const yn=Ht(tt),hn=Dt({__proto__:null,default:yn},[tt]),Me=hn,pn=Me.PrivateKey,vn=Me.PublicKey,En=Me.encrypt,_n=Me.decrypt,Bn=Me.utils,Cn=Me.ECIES_CONFIG;export{Cn as ECIES_CONFIG,pn as PrivateKey,vn as PublicKey,_n as decrypt,Me as default,En as encrypt,Bn as utils};

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.