jobsys-newbie
Version:
Enhanced component based on ant-design-vue
1 lines • 139 kB
JavaScript
"use strict";var hi=Object.defineProperty;var gi=(e,t,n)=>t in e?hi(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n;var le=(e,t,n)=>gi(e,typeof t!="symbol"?t+"":t,n);const Ct=require("dayjs"),we=require("lodash-es"),mn=require("ant-design-vue"),Xn=require("axios"),Q=require("vue"),Tt=typeof globalThis=="object"&&"crypto"in globalThis?globalThis.crypto:void 0;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function On(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function Zn(e){if(!Number.isSafeInteger(e)||e<0)throw new Error("positive integer expected, got "+e)}function en(e,...t){if(!On(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function Ws(e){if(typeof e!="function"||typeof e.create!="function")throw new Error("Hash should be wrapped by utils.createHasher");Zn(e.outputLen),Zn(e.blockLen)}function Wr(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function Ei(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}const Ys=typeof Uint8Array.from([]).toHex=="function"&&typeof Uint8Array.fromHex=="function",pi=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function pt(e){if(en(e),Ys)return e.toHex();let t="";for(let n=0;n<e.length;n++)t+=pi[e[n]];return t}const Xe={_0:48,_9:57,A:65,F:70,a:97,f:102};function Yr(e){if(e>=Xe._0&&e<=Xe._9)return e-Xe._0;if(e>=Xe.A&&e<=Xe.F)return e-(Xe.A-10);if(e>=Xe.a&&e<=Xe.f)return e-(Xe.a-10)}function _n(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);if(Ys)return Uint8Array.fromHex(e);const t=e.length,n=t/2;if(t%2)throw new Error("hex string expected, got unpadded hex of length "+t);const r=new Uint8Array(n);for(let s=0,o=0;s<n;s++,o+=2){const i=Yr(e.charCodeAt(o)),a=Yr(e.charCodeAt(o+1));if(i===void 0||a===void 0){const l=e[o]+e[o+1];throw new Error('hex string expected, got non-hex character "'+l+'" at index '+o)}r[s]=i*16+a}return r}function Ks(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function bi(e){return typeof e=="string"&&(e=Ks(e)),en(e),e}function ze(...e){let t=0;for(let r=0;r<e.length;r++){const s=e[r];en(s),t+=s.length}const n=new Uint8Array(t);for(let r=0,s=0;r<e.length;r++){const o=e[r];n.set(o,s),s+=o.length}return n}let yi=class{};function Gs(e=32){if(Tt&&typeof Tt.getRandomValues=="function")return Tt.getRandomValues(new Uint8Array(e));if(Tt&&typeof Tt.randomBytes=="function")return Uint8Array.from(Tt.randomBytes(e));throw new Error("crypto.getRandomValues must be defined")}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const hr=BigInt(0),Jn=BigInt(1);function hn(e,t=""){if(typeof e!="boolean"){const n=t&&`"${t}"`;throw new Error(n+"expected boolean, got type="+typeof e)}return e}function mt(e,t,n=""){const r=On(e),s=e==null?void 0:e.length,o=t!==void 0;if(!r||o&&s!==t){const i=n&&`"${n}" `,a=o?` of length ${t}`:"",l=r?`length=${s}`:`type=${typeof e}`;throw new Error(i+"expected Uint8Array"+a+", got "+l)}return e}function $t(e){const t=e.toString(16);return t.length&1?"0"+t:t}function gr(e){if(typeof e!="string")throw new Error("hex string expected, got "+typeof e);return e===""?hr:BigInt("0x"+e)}function In(e){return gr(pt(e))}function js(e){return en(e),gr(pt(Uint8Array.from(e).reverse()))}function An(e,t){return _n(e.toString(16).padStart(t*2,"0"))}function qs(e,t){return An(e,t).reverse()}function Oe(e,t,n){let r;if(typeof t=="string")try{r=_n(t)}catch(o){throw new Error(e+" must be hex string or Uint8Array, cause: "+o)}else if(On(t))r=Uint8Array.from(t);else throw new Error(e+" must be hex string or Uint8Array");const s=r.length;if(typeof n=="number"&&s!==n)throw new Error(e+" of length "+n+" expected, got "+s);return r}const xn=e=>typeof e=="bigint"&&hr<=e;function wi(e,t,n){return xn(e)&&xn(t)&&xn(n)&&t<=e&&e<n}function vi(e,t,n,r){if(!wi(t,n,r))throw new Error("expected valid "+e+": "+n+" <= n < "+r+", got "+t)}function Xs(e){let t;for(t=0;e>hr;e>>=Jn,t+=1);return t}const tn=e=>(Jn<<BigInt(e))-Jn;function Ni(e,t,n){if(typeof e!="number"||e<2)throw new Error("hashLen must be a number");if(typeof t!="number"||t<2)throw new Error("qByteLen must be a number");if(typeof n!="function")throw new Error("hmacFn must be a function");const r=g=>new Uint8Array(g),s=g=>Uint8Array.of(g);let o=r(e),i=r(e),a=0;const l=()=>{o.fill(1),i.fill(0),a=0},c=(...g)=>n(i,o,...g),_=(g=r(0))=>{i=c(s(0),g),o=c(),g.length!==0&&(i=c(s(1),g),o=c())},m=()=>{if(a++>=1e3)throw new Error("drbg: tried 1000 values");let g=0;const y=[];for(;g<t;){o=c();const E=o.slice();y.push(E),g+=o.length}return ze(...y)};return(g,y)=>{l(),_(g);let E;for(;!(E=y(m()));)_();return l(),E}}function Er(e,t,n={}){if(!e||typeof e!="object")throw new Error("expected valid options object");function r(s,o,i){const a=e[s];if(i&&a===void 0)return;const l=typeof a;if(l!==o||a===null)throw new Error(`param "${s}" is invalid: expected ${o}, got ${l}`)}Object.entries(t).forEach(([s,o])=>r(s,o,!1)),Object.entries(n).forEach(([s,o])=>r(s,o,!0))}function Kr(e){const t=new WeakMap;return(n,...r)=>{const s=t.get(n);if(s!==void 0)return s;const o=e(n,...r);return t.set(n,o),o}}const gn=pt,at=ze,Ti=Ks,Ae=$t,ge=gr,Li=An;let Zs=class extends yi{constructor(t,n){super(),this.finished=!1,this.destroyed=!1,Ws(t);const r=bi(n);if(this.iHash=t.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 s=this.blockLen,o=new Uint8Array(s);o.set(r.length>s?t.create().update(r).digest():r);for(let i=0;i<o.length;i++)o[i]^=54;this.iHash.update(o),this.oHash=t.create();for(let i=0;i<o.length;i++)o[i]^=106;this.oHash.update(o),Ei(o)}update(t){return Wr(this),this.iHash.update(t),this}digestInto(t){Wr(this),en(t,this.outputLen),this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:r,finished:s,destroyed:o,blockLen:i,outputLen:a}=this;return t=t,t.finished=s,t.destroyed=o,t.blockLen=i,t.outputLen=a,t.oHash=n._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}clone(){return this._cloneInto()}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}};const Js=(e,t,n)=>new Zs(e,t).update(n).digest();Js.create=(e,t)=>new Zs(e,t);/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Re=BigInt(0),Te=BigInt(1),_t=BigInt(2),Qs=BigInt(3),zs=BigInt(4),eo=BigInt(5),Oi=BigInt(7),to=BigInt(8),Ii=BigInt(9),no=BigInt(16);function Ce(e,t){const n=e%t;return n>=Re?n:t+n}function Gr(e,t){if(e===Re)throw new Error("invert: expected non-zero number");if(t<=Re)throw new Error("invert: expected positive modulus, got "+t);let n=Ce(e,t),r=t,s=Re,o=Te;for(;n!==Re;){const a=r/n,l=r%n,c=s-o*a;r=n,n=l,s=o,o=c}if(r!==Te)throw new Error("invert: does not exist");return Ce(s,t)}function pr(e,t,n){if(!e.eql(e.sqr(t),n))throw new Error("Cannot find square root")}function ro(e,t){const n=(e.ORDER+Te)/zs,r=e.pow(t,n);return pr(e,r,t),r}function Ai(e,t){const n=(e.ORDER-eo)/to,r=e.mul(t,_t),s=e.pow(r,n),o=e.mul(t,s),i=e.mul(e.mul(o,_t),s),a=e.mul(o,e.sub(i,e.ONE));return pr(e,a,t),a}function Si(e){const t=xt(e),n=so(e),r=n(t,t.neg(t.ONE)),s=n(t,r),o=n(t,t.neg(r)),i=(e+Oi)/no;return(a,l)=>{let c=a.pow(l,i),_=a.mul(c,r);const m=a.mul(c,s),u=a.mul(c,o),g=a.eql(a.sqr(_),l),y=a.eql(a.sqr(m),l);c=a.cmov(c,_,g),_=a.cmov(u,m,y);const E=a.eql(a.sqr(_),l),p=a.cmov(c,_,E);return pr(a,p,l),p}}function so(e){if(e<Qs)throw new Error("sqrt is not defined for small field");let t=e-Te,n=0;for(;t%_t===Re;)t/=_t,n++;let r=_t;const s=xt(e);for(;jr(s,r)===1;)if(r++>1e3)throw new Error("Cannot find square root: probably non-prime P");if(n===1)return ro;let o=s.pow(r,t);const i=(t+Te)/_t;return function(l,c){if(l.is0(c))return c;if(jr(l,c)!==1)throw new Error("Cannot find square root");let _=n,m=l.mul(l.ONE,o),u=l.pow(c,t),g=l.pow(c,i);for(;!l.eql(u,l.ONE);){if(l.is0(u))return l.ZERO;let y=1,E=l.sqr(u);for(;!l.eql(E,l.ONE);)if(y++,E=l.sqr(E),y===_)throw new Error("Cannot find square root");const p=Te<<BigInt(_-y-1),f=l.pow(m,p);_=y,m=l.sqr(f),u=l.mul(u,m),g=l.mul(g,f)}return g}}function Ci(e){return e%zs===Qs?ro:e%to===eo?Ai:e%no===Ii?Si(e):so(e)}const Pi=["create","isValid","is0","neg","inv","sqrt","sqr","eql","add","sub","mul","pow","div","addN","subN","mulN","sqrN"];function Ri(e){const t={ORDER:"bigint",MASK:"bigint",BYTES:"number",BITS:"number"},n=Pi.reduce((r,s)=>(r[s]="function",r),t);return Er(e,n),e}function Di(e,t,n){if(n<Re)throw new Error("invalid exponent, negatives unsupported");if(n===Re)return e.ONE;if(n===Te)return t;let r=e.ONE,s=t;for(;n>Re;)n&Te&&(r=e.mul(r,s)),s=e.sqr(s),n>>=Te;return r}function oo(e,t,n=!1){const r=new Array(t.length).fill(n?e.ZERO:void 0),s=t.reduce((i,a,l)=>e.is0(a)?i:(r[l]=i,e.mul(i,a)),e.ONE),o=e.inv(s);return t.reduceRight((i,a,l)=>e.is0(a)?i:(r[l]=e.mul(i,r[l]),e.mul(i,a)),o),r}function jr(e,t){const n=(e.ORDER-Te)/_t,r=e.pow(t,n),s=e.eql(r,e.ONE),o=e.eql(r,e.ZERO),i=e.eql(r,e.neg(e.ONE));if(!s&&!o&&!i)throw new Error("invalid Legendre symbol result");return s?1:o?0:-1}function io(e,t){t!==void 0&&Zn(t);const n=t!==void 0?t:e.toString(2).length,r=Math.ceil(n/8);return{nBitLength:n,nByteLength:r}}function xt(e,t,n=!1,r={}){if(e<=Re)throw new Error("invalid field: expected ORDER > 0, got "+e);let s,o,i=!1,a;if(typeof t=="object"&&t!=null){if(r.sqrt||n)throw new Error("cannot specify opts in two arguments");const u=t;u.BITS&&(s=u.BITS),u.sqrt&&(o=u.sqrt),typeof u.isLE=="boolean"&&(n=u.isLE),typeof u.modFromBytes=="boolean"&&(i=u.modFromBytes),a=u.allowedLengths}else typeof t=="number"&&(s=t),r.sqrt&&(o=r.sqrt);const{nBitLength:l,nByteLength:c}=io(e,s);if(c>2048)throw new Error("invalid field: expected ORDER of <= 2048 bytes");let _;const m=Object.freeze({ORDER:e,isLE:n,BITS:l,BYTES:c,MASK:tn(l),ZERO:Re,ONE:Te,allowedLengths:a,create:u=>Ce(u,e),isValid:u=>{if(typeof u!="bigint")throw new Error("invalid field element: expected bigint, got "+typeof u);return Re<=u&&u<e},is0:u=>u===Re,isValidNot0:u=>!m.is0(u)&&m.isValid(u),isOdd:u=>(u&Te)===Te,neg:u=>Ce(-u,e),eql:(u,g)=>u===g,sqr:u=>Ce(u*u,e),add:(u,g)=>Ce(u+g,e),sub:(u,g)=>Ce(u-g,e),mul:(u,g)=>Ce(u*g,e),pow:(u,g)=>Di(m,u,g),div:(u,g)=>Ce(u*Gr(g,e),e),sqrN:u=>u*u,addN:(u,g)=>u+g,subN:(u,g)=>u-g,mulN:(u,g)=>u*g,inv:u=>Gr(u,e),sqrt:o||(u=>(_||(_=Ci(e)),_(m,u))),toBytes:u=>n?qs(u,c):An(u,c),fromBytes:(u,g=!0)=>{if(a){if(!a.includes(u.length)||u.length>c)throw new Error("Field.fromBytes: expected "+a+" bytes, got "+u.length);const E=new Uint8Array(c);E.set(u,n?0:E.length-u.length),u=E}if(u.length!==c)throw new Error("Field.fromBytes: expected "+c+" bytes, got "+u.length);let y=n?js(u):In(u);if(i&&(y=Ce(y,e)),!g&&!m.isValid(y))throw new Error("invalid field element: outside of range 0..ORDER");return y},invertBatch:u=>oo(m,u),cmov:(u,g,y)=>y?g:u});return Object.freeze(m)}function ao(e){if(typeof e!="bigint")throw new Error("field order must be bigint");const t=e.toString(2).length;return Math.ceil(t/8)}function lo(e){const t=ao(e);return t+Math.ceil(t/2)}function Ui(e,t,n=!1){const r=e.length,s=ao(t),o=lo(t);if(r<16||r<o||r>1024)throw new Error("expected "+o+"-1024 bytes of input, got "+r);const i=n?js(e):In(e),a=Ce(i,t-Te)+Te;return n?qs(a,s):An(a,s)}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Pt=BigInt(0),ht=BigInt(1);function En(e,t){const n=t.negate();return e?n:t}function Fn(e,t){const n=oo(e.Fp,t.map(r=>r.Z));return t.map((r,s)=>e.fromAffine(r.toAffine(n[s])))}function co(e,t){if(!Number.isSafeInteger(e)||e<=0||e>t)throw new Error("invalid window size, expected [1.."+t+"], got W="+e)}function Mn(e,t){co(e,t);const n=Math.ceil(t/e)+1,r=2**(e-1),s=2**e,o=tn(e),i=BigInt(e);return{windows:n,windowSize:r,mask:o,maxNumber:s,shiftBy:i}}function qr(e,t,n){const{windowSize:r,mask:s,maxNumber:o,shiftBy:i}=n;let a=Number(e&s),l=e>>i;a>r&&(a-=o,l+=ht);const c=t*r,_=c+Math.abs(a)-1,m=a===0,u=a<0,g=t%2!==0;return{nextN:l,offset:_,isZero:m,isNeg:u,isNegF:g,offsetF:c}}function ki(e,t){if(!Array.isArray(e))throw new Error("array expected");e.forEach((n,r)=>{if(!(n instanceof t))throw new Error("invalid point at index "+r)})}function xi(e,t){if(!Array.isArray(e))throw new Error("array of scalars expected");e.forEach((n,r)=>{if(!t.isValid(n))throw new Error("invalid scalar at index "+r)})}const Bn=new WeakMap,uo=new WeakMap;function Vn(e){return uo.get(e)||1}function Xr(e){if(e!==Pt)throw new Error("invalid wNAF")}class Fi{constructor(t,n){this.BASE=t.BASE,this.ZERO=t.ZERO,this.Fn=t.Fn,this.bits=n}_unsafeLadder(t,n,r=this.ZERO){let s=t;for(;n>Pt;)n&ht&&(r=r.add(s)),s=s.double(),n>>=ht;return r}precomputeWindow(t,n){const{windows:r,windowSize:s}=Mn(n,this.bits),o=[];let i=t,a=i;for(let l=0;l<r;l++){a=i,o.push(a);for(let c=1;c<s;c++)a=a.add(i),o.push(a);i=a.double()}return o}wNAF(t,n,r){if(!this.Fn.isValid(r))throw new Error("invalid scalar");let s=this.ZERO,o=this.BASE;const i=Mn(t,this.bits);for(let a=0;a<i.windows;a++){const{nextN:l,offset:c,isZero:_,isNeg:m,isNegF:u,offsetF:g}=qr(r,a,i);r=l,_?o=o.add(En(u,n[g])):s=s.add(En(m,n[c]))}return Xr(r),{p:s,f:o}}wNAFUnsafe(t,n,r,s=this.ZERO){const o=Mn(t,this.bits);for(let i=0;i<o.windows&&r!==Pt;i++){const{nextN:a,offset:l,isZero:c,isNeg:_}=qr(r,i,o);if(r=a,!c){const m=n[l];s=s.add(_?m.negate():m)}}return Xr(r),s}getPrecomputes(t,n,r){let s=Bn.get(n);return s||(s=this.precomputeWindow(n,t),t!==1&&(typeof r=="function"&&(s=r(s)),Bn.set(n,s))),s}cached(t,n,r){const s=Vn(t);return this.wNAF(s,this.getPrecomputes(s,t,r),n)}unsafe(t,n,r,s){const o=Vn(t);return o===1?this._unsafeLadder(t,n,s):this.wNAFUnsafe(o,this.getPrecomputes(o,t,r),n,s)}createCache(t,n){co(n,this.bits),uo.set(t,n),Bn.delete(t)}hasCache(t){return Vn(t)!==1}}function Mi(e,t,n,r){let s=t,o=e.ZERO,i=e.ZERO;for(;n>Pt||r>Pt;)n&ht&&(o=o.add(s)),r&ht&&(i=i.add(s)),s=s.double(),n>>=ht,r>>=ht;return{p1:o,p2:i}}function Bi(e,t,n,r){ki(n,e),xi(r,t);const s=n.length,o=r.length;if(s!==o)throw new Error("arrays of points and scalars must have equal length");const i=e.ZERO,a=Xs(BigInt(s));let l=1;a>12?l=a-3:a>4?l=a-2:a>0&&(l=2);const c=tn(l),_=new Array(Number(c)+1).fill(i),m=Math.floor((t.BITS-1)/l)*l;let u=i;for(let g=m;g>=0;g-=l){_.fill(i);for(let E=0;E<o;E++){const p=r[E],f=Number(p>>BigInt(g)&c);_[f]=_[f].add(n[E])}let y=i;for(let E=_.length-1,p=i;E>0;E--)p=p.add(_[E]),y=y.add(p);if(u=u.add(y),g!==0)for(let E=0;E<l;E++)u=u.double()}return u}function Zr(e,t,n){if(t){if(t.ORDER!==e)throw new Error("Field.ORDER must match order: Fp == p, Fn == n");return Ri(t),t}else return xt(e,{isLE:n})}function Vi(e,t,n={},r){if(r===void 0&&(r=e==="edwards"),!t||typeof t!="object")throw new Error(`expected valid ${e} CURVE object`);for(const l of["p","n","h"]){const c=t[l];if(!(typeof c=="bigint"&&c>Pt))throw new Error(`CURVE.${l} must be positive bigint`)}const s=Zr(t.p,n.Fp,r),o=Zr(t.n,n.Fn,r),a=["Gx","Gy","a","b"];for(const l of a)if(!s.isValid(t[l]))throw new Error(`CURVE.${l} must be valid field element of CURVE.Fp`);return t=Object.freeze(Object.assign({},t)),{CURVE:t,Fp:s,Fn:o}}/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */const Jr=(e,t)=>(e+(e>=0?t:-t)/fo)/t;function Hi(e,t,n){const[[r,s],[o,i]]=t,a=Jr(i*e,n),l=Jr(-s*e,n);let c=e-a*r-l*o,_=-a*s-l*i;const m=c<et,u=_<et;m&&(c=-c),u&&(_=-_);const g=tn(Math.ceil(Xs(n)/2))+St;if(c<et||c>=g||_<et||_>=g)throw new Error("splitScalar (endomorphism): failed, k="+e);return{k1neg:m,k1:c,k2neg:u,k2:_}}function Qn(e){if(!["compact","recovered","der"].includes(e))throw new Error('Signature format must be "compact", "recovered", or "der"');return e}function Hn(e,t){const n={};for(let r of Object.keys(t))n[r]=e[r]===void 0?t[r]:e[r];return hn(n.lowS,"lowS"),hn(n.prehash,"prehash"),n.format!==void 0&&Qn(n.format),n}class $i extends Error{constructor(t=""){super(t)}}const Je={Err:$i,_tlv:{encode:(e,t)=>{const{Err:n}=Je;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length&1)throw new n("tlv.encode: unpadded data");const r=t.length/2,s=$t(r);if(s.length/2&128)throw new n("tlv.encode: long form length too big");const o=r>127?$t(s.length/2|128):"";return $t(e)+o+s+t},decode(e,t){const{Err:n}=Je;let r=0;if(e<0||e>256)throw new n("tlv.encode: wrong tag");if(t.length<2||t[r++]!==e)throw new n("tlv.decode: wrong tlv");const s=t[r++],o=!!(s&128);let i=0;if(!o)i=s;else{const l=s&127;if(!l)throw new n("tlv.decode(long): indefinite length not supported");if(l>4)throw new n("tlv.decode(long): byte length is too big");const c=t.subarray(r,r+l);if(c.length!==l)throw new n("tlv.decode: length bytes not complete");if(c[0]===0)throw new n("tlv.decode(long): zero leftmost byte");for(const _ of c)i=i<<8|_;if(r+=l,i<128)throw new n("tlv.decode(long): not minimal encoding")}const a=t.subarray(r,r+i);if(a.length!==i)throw new n("tlv.decode: wrong value length");return{v:a,l:t.subarray(r+i)}}},_int:{encode(e){const{Err:t}=Je;if(e<et)throw new t("integer: negative integers are not allowed");let n=$t(e);if(Number.parseInt(n[0],16)&8&&(n="00"+n),n.length&1)throw new t("unexpected DER parsing assertion: unpadded hex");return n},decode(e){const{Err:t}=Je;if(e[0]&128)throw new t("invalid signature integer: negative");if(e[0]===0&&!(e[1]&128))throw new t("invalid signature integer: unnecessary leading zero");return In(e)}},toSig(e){const{Err:t,_int:n,_tlv:r}=Je,s=Oe("signature",e),{v:o,l:i}=r.decode(48,s);if(i.length)throw new t("invalid signature: left bytes after parsing");const{v:a,l}=r.decode(2,o),{v:c,l:_}=r.decode(2,l);if(_.length)throw new t("invalid signature: left bytes after parsing");return{r:n.decode(a),s:n.decode(c)}},hexFromSig(e){const{_tlv:t,_int:n}=Je,r=t.encode(2,n.encode(e.r)),s=t.encode(2,n.encode(e.s)),o=r+s;return t.encode(48,o)}},et=BigInt(0),St=BigInt(1),fo=BigInt(2),rn=BigInt(3),Wi=BigInt(4);function It(e,t){const{BYTES:n}=e;let r;if(typeof t=="bigint")r=t;else{let s=Oe("private key",t);try{r=e.fromBytes(s)}catch{throw new Error(`invalid private key: expected ui8a of size ${n}, got ${typeof t}`)}}if(!e.isValidNot0(r))throw new Error("invalid private key: out of range [1..N-1]");return r}function Yi(e,t={}){const n=Vi("weierstrass",e,t),{Fp:r,Fn:s}=n;let o=n.CURVE;const{h:i,n:a}=o;Er(t,{},{allowInfinityPoint:"boolean",clearCofactor:"function",isTorsionFree:"function",fromBytes:"function",toBytes:"function",endo:"object",wrapPrivateKey:"boolean"});const{endo:l}=t;if(l&&(!r.is0(o.a)||typeof l.beta!="bigint"||!Array.isArray(l.basises)))throw new Error('invalid endo: expected "beta": bigint and "basises": array');const c=_o(r,s);function _(){if(!r.isOdd)throw new Error("compression is not supported: Field does not have .isOdd()")}function m(M,S,I){const{x:L,y:R}=S.toAffine(),x=r.toBytes(L);if(hn(I,"isCompressed"),I){_();const V=!r.isOdd(R);return ze(mo(V),x)}else return ze(Uint8Array.of(4),x,r.toBytes(R))}function u(M){mt(M,void 0,"Point");const{publicKey:S,publicKeyUncompressed:I}=c,L=M.length,R=M[0],x=M.subarray(1);if(L===S&&(R===2||R===3)){const V=r.fromBytes(x);if(!r.isValid(V))throw new Error("bad point: is not on curve, wrong x");const B=E(V);let k;try{k=r.sqrt(B)}catch(ie){const J=ie instanceof Error?": "+ie.message:"";throw new Error("bad point: is not on curve, sqrt error"+J)}_();const H=r.isOdd(k);return(R&1)===1!==H&&(k=r.neg(k)),{x:V,y:k}}else if(L===I&&R===4){const V=r.BYTES,B=r.fromBytes(x.subarray(0,V)),k=r.fromBytes(x.subarray(V,V*2));if(!p(B,k))throw new Error("bad point: is not on curve");return{x:B,y:k}}else throw new Error(`bad point: got length ${L}, expected compressed=${S} or uncompressed=${I}`)}const g=t.toBytes||m,y=t.fromBytes||u;function E(M){const S=r.sqr(M),I=r.mul(S,M);return r.add(r.add(I,r.mul(M,o.a)),o.b)}function p(M,S){const I=r.sqr(S),L=E(M);return r.eql(I,L)}if(!p(o.Gx,o.Gy))throw new Error("bad curve params: generator point");const f=r.mul(r.pow(o.a,rn),Wi),b=r.mul(r.sqr(o.b),BigInt(27));if(r.is0(r.add(f,b)))throw new Error("bad curve params: a or b");function v(M,S,I=!1){if(!r.isValid(S)||I&&r.is0(S))throw new Error(`bad point coordinate ${M}`);return S}function w(M){if(!(M instanceof U))throw new Error("ProjectivePoint expected")}function O(M){if(!l||!l.basises)throw new Error("no endo");return Hi(M,l.basises,s.ORDER)}const P=Kr((M,S)=>{const{X:I,Y:L,Z:R}=M;if(r.eql(R,r.ONE))return{x:I,y:L};const x=M.is0();S==null&&(S=x?r.ONE:r.inv(R));const V=r.mul(I,S),B=r.mul(L,S),k=r.mul(R,S);if(x)return{x:r.ZERO,y:r.ZERO};if(!r.eql(k,r.ONE))throw new Error("invZ was invalid");return{x:V,y:B}}),T=Kr(M=>{if(M.is0()){if(t.allowInfinityPoint&&!r.is0(M.Y))return;throw new Error("bad point: ZERO")}const{x:S,y:I}=M.toAffine();if(!r.isValid(S)||!r.isValid(I))throw new Error("bad point: x or y not field elements");if(!p(S,I))throw new Error("bad point: equation left != right");if(!M.isTorsionFree())throw new Error("bad point: not in prime-order subgroup");return!0});function $(M,S,I,L,R){return I=new U(r.mul(I.X,M),I.Y,I.Z),S=En(L,S),I=En(R,I),S.add(I)}class U{constructor(S,I,L){this.X=v("x",S),this.Y=v("y",I,!0),this.Z=v("z",L),Object.freeze(this)}static CURVE(){return o}static fromAffine(S){const{x:I,y:L}=S||{};if(!S||!r.isValid(I)||!r.isValid(L))throw new Error("invalid affine point");if(S instanceof U)throw new Error("projective point not allowed");return r.is0(I)&&r.is0(L)?U.ZERO:new U(I,L,r.ONE)}static fromBytes(S){const I=U.fromAffine(y(mt(S,void 0,"point")));return I.assertValidity(),I}static fromHex(S){return U.fromBytes(Oe("pointHex",S))}get x(){return this.toAffine().x}get y(){return this.toAffine().y}precompute(S=8,I=!0){return Ee.createCache(this,S),I||this.multiply(rn),this}assertValidity(){T(this)}hasEvenY(){const{y:S}=this.toAffine();if(!r.isOdd)throw new Error("Field doesn't support isOdd");return!r.isOdd(S)}equals(S){w(S);const{X:I,Y:L,Z:R}=this,{X:x,Y:V,Z:B}=S,k=r.eql(r.mul(I,B),r.mul(x,R)),H=r.eql(r.mul(L,B),r.mul(V,R));return k&&H}negate(){return new U(this.X,r.neg(this.Y),this.Z)}double(){const{a:S,b:I}=o,L=r.mul(I,rn),{X:R,Y:x,Z:V}=this;let B=r.ZERO,k=r.ZERO,H=r.ZERO,Y=r.mul(R,R),ie=r.mul(x,x),J=r.mul(V,V),G=r.mul(R,x);return G=r.add(G,G),H=r.mul(R,V),H=r.add(H,H),B=r.mul(S,H),k=r.mul(L,J),k=r.add(B,k),B=r.sub(ie,k),k=r.add(ie,k),k=r.mul(B,k),B=r.mul(G,B),H=r.mul(L,H),J=r.mul(S,J),G=r.sub(Y,J),G=r.mul(S,G),G=r.add(G,H),H=r.add(Y,Y),Y=r.add(H,Y),Y=r.add(Y,J),Y=r.mul(Y,G),k=r.add(k,Y),J=r.mul(x,V),J=r.add(J,J),Y=r.mul(J,G),B=r.sub(B,Y),H=r.mul(J,ie),H=r.add(H,H),H=r.add(H,H),new U(B,k,H)}add(S){w(S);const{X:I,Y:L,Z:R}=this,{X:x,Y:V,Z:B}=S;let k=r.ZERO,H=r.ZERO,Y=r.ZERO;const ie=o.a,J=r.mul(o.b,rn);let G=r.mul(I,x),re=r.mul(L,V),ae=r.mul(R,B),pe=r.add(I,L),te=r.add(x,V);pe=r.mul(pe,te),te=r.add(G,re),pe=r.sub(pe,te),te=r.add(I,R);let me=r.add(x,B);return te=r.mul(te,me),me=r.add(G,ae),te=r.sub(te,me),me=r.add(L,R),k=r.add(V,B),me=r.mul(me,k),k=r.add(re,ae),me=r.sub(me,k),Y=r.mul(ie,te),k=r.mul(J,ae),Y=r.add(k,Y),k=r.sub(re,Y),Y=r.add(re,Y),H=r.mul(k,Y),re=r.add(G,G),re=r.add(re,G),ae=r.mul(ie,ae),te=r.mul(J,te),re=r.add(re,ae),ae=r.sub(G,ae),ae=r.mul(ie,ae),te=r.add(te,ae),G=r.mul(re,te),H=r.add(H,G),G=r.mul(me,te),k=r.mul(pe,k),k=r.sub(k,G),G=r.mul(pe,re),Y=r.mul(me,Y),Y=r.add(Y,G),new U(k,H,Y)}subtract(S){return this.add(S.negate())}is0(){return this.equals(U.ZERO)}multiply(S){const{endo:I}=t;if(!s.isValidNot0(S))throw new Error("invalid scalar: out of range");let L,R;const x=V=>Ee.cached(this,V,B=>Fn(U,B));if(I){const{k1neg:V,k1:B,k2neg:k,k2:H}=O(S),{p:Y,f:ie}=x(B),{p:J,f:G}=x(H);R=ie.add(G),L=$(I.beta,Y,J,V,k)}else{const{p:V,f:B}=x(S);L=V,R=B}return Fn(U,[L,R])[0]}multiplyUnsafe(S){const{endo:I}=t,L=this;if(!s.isValid(S))throw new Error("invalid scalar: out of range");if(S===et||L.is0())return U.ZERO;if(S===St)return L;if(Ee.hasCache(this))return this.multiply(S);if(I){const{k1neg:R,k1:x,k2neg:V,k2:B}=O(S),{p1:k,p2:H}=Mi(U,L,x,B);return $(I.beta,k,H,R,V)}else return Ee.unsafe(L,S)}multiplyAndAddUnsafe(S,I,L){const R=this.multiplyUnsafe(I).add(S.multiplyUnsafe(L));return R.is0()?void 0:R}toAffine(S){return P(this,S)}isTorsionFree(){const{isTorsionFree:S}=t;return i===St?!0:S?S(U,this):Ee.unsafe(this,a).is0()}clearCofactor(){const{clearCofactor:S}=t;return i===St?this:S?S(U,this):this.multiplyUnsafe(i)}isSmallOrder(){return this.multiplyUnsafe(i).is0()}toBytes(S=!0){return hn(S,"isCompressed"),this.assertValidity(),g(U,this,S)}toHex(S=!0){return pt(this.toBytes(S))}toString(){return`<Point ${this.is0()?"ZERO":this.toHex()}>`}get px(){return this.X}get py(){return this.X}get pz(){return this.Z}toRawBytes(S=!0){return this.toBytes(S)}_setWindowSize(S){this.precompute(S)}static normalizeZ(S){return Fn(U,S)}static msm(S,I){return Bi(U,s,S,I)}static fromPrivateKey(S){return U.BASE.multiply(It(s,S))}}U.BASE=new U(o.Gx,o.Gy,r.ONE),U.ZERO=new U(r.ZERO,r.ONE,r.ZERO),U.Fp=r,U.Fn=s;const oe=s.BITS,Ee=new Fi(U,t.endo?Math.ceil(oe/2):oe);return U.BASE.precompute(8),U}function mo(e){return Uint8Array.of(e?2:3)}function _o(e,t){return{secretKey:t.BYTES,publicKey:1+e.BYTES,publicKeyUncompressed:1+2*e.BYTES,publicKeyHasPrefix:!0,signature:2*t.BYTES}}function Ki(e,t={}){const{Fn:n}=e,r=t.randomBytes||Gs,s=Object.assign(_o(e.Fp,n),{seed:lo(n.ORDER)});function o(g){try{return!!It(n,g)}catch{return!1}}function i(g,y){const{publicKey:E,publicKeyUncompressed:p}=s;try{const f=g.length;return y===!0&&f!==E||y===!1&&f!==p?!1:!!e.fromBytes(g)}catch{return!1}}function a(g=r(s.seed)){return Ui(mt(g,s.seed,"seed"),n.ORDER)}function l(g,y=!0){return e.BASE.multiply(It(n,g)).toBytes(y)}function c(g){const y=a(g);return{secretKey:y,publicKey:l(y)}}function _(g){if(typeof g=="bigint")return!1;if(g instanceof e)return!0;const{secretKey:y,publicKey:E,publicKeyUncompressed:p}=s;if(n.allowedLengths||y===E)return;const f=Oe("key",g).length;return f===E||f===p}function m(g,y,E=!0){if(_(g)===!0)throw new Error("first arg must be private key");if(_(y)===!1)throw new Error("second arg must be public key");const p=It(n,g);return e.fromHex(y).multiply(p).toBytes(E)}return Object.freeze({getPublicKey:l,getSharedSecret:m,keygen:c,Point:e,utils:{isValidSecretKey:o,isValidPublicKey:i,randomSecretKey:a,isValidPrivateKey:o,randomPrivateKey:a,normPrivateKeyToScalar:g=>It(n,g),precompute(g=8,y=e.BASE){return y.precompute(g,!1)}},lengths:s})}function Gi(e,t,n={}){Ws(t),Er(n,{},{hmac:"function",lowS:"boolean",randomBytes:"function",bits2int:"function",bits2int_modN:"function"});const r=n.randomBytes||Gs,s=n.hmac||((I,...L)=>Js(t,I,ze(...L))),{Fp:o,Fn:i}=e,{ORDER:a,BITS:l}=i,{keygen:c,getPublicKey:_,getSharedSecret:m,utils:u,lengths:g}=Ki(e,n),y={prehash:!1,lowS:typeof n.lowS=="boolean"?n.lowS:!1,format:void 0,extraEntropy:!1},E="compact";function p(I){const L=a>>St;return I>L}function f(I,L){if(!i.isValidNot0(L))throw new Error(`invalid signature ${I}: out of range 1..Point.Fn.ORDER`);return L}function b(I,L){Qn(L);const R=g.signature,x=L==="compact"?R:L==="recovered"?R+1:void 0;return mt(I,x,`${L} signature`)}class v{constructor(L,R,x){this.r=f("r",L),this.s=f("s",R),x!=null&&(this.recovery=x),Object.freeze(this)}static fromBytes(L,R=E){b(L,R);let x;if(R==="der"){const{r:H,s:Y}=Je.toSig(mt(L));return new v(H,Y)}R==="recovered"&&(x=L[0],R="compact",L=L.subarray(1));const V=i.BYTES,B=L.subarray(0,V),k=L.subarray(V,V*2);return new v(i.fromBytes(B),i.fromBytes(k),x)}static fromHex(L,R){return this.fromBytes(_n(L),R)}addRecoveryBit(L){return new v(this.r,this.s,L)}recoverPublicKey(L){const R=o.ORDER,{r:x,s:V,recovery:B}=this;if(B==null||![0,1,2,3].includes(B))throw new Error("recovery id invalid");if(a*fo<R&&B>1)throw new Error("recovery id is ambiguous for h>1 curve");const H=B===2||B===3?x+a:x;if(!o.isValid(H))throw new Error("recovery id 2 or 3 invalid");const Y=o.toBytes(H),ie=e.fromBytes(ze(mo((B&1)===0),Y)),J=i.inv(H),G=O(Oe("msgHash",L)),re=i.create(-G*J),ae=i.create(V*J),pe=e.BASE.multiplyUnsafe(re).add(ie.multiplyUnsafe(ae));if(pe.is0())throw new Error("point at infinify");return pe.assertValidity(),pe}hasHighS(){return p(this.s)}toBytes(L=E){if(Qn(L),L==="der")return _n(Je.hexFromSig(this));const R=i.toBytes(this.r),x=i.toBytes(this.s);if(L==="recovered"){if(this.recovery==null)throw new Error("recovery bit must be present");return ze(Uint8Array.of(this.recovery),R,x)}return ze(R,x)}toHex(L){return pt(this.toBytes(L))}assertValidity(){}static fromCompact(L){return v.fromBytes(Oe("sig",L),"compact")}static fromDER(L){return v.fromBytes(Oe("sig",L),"der")}normalizeS(){return this.hasHighS()?new v(this.r,i.neg(this.s),this.recovery):this}toDERRawBytes(){return this.toBytes("der")}toDERHex(){return pt(this.toBytes("der"))}toCompactRawBytes(){return this.toBytes("compact")}toCompactHex(){return pt(this.toBytes("compact"))}}const w=n.bits2int||function(L){if(L.length>8192)throw new Error("input is too large");const R=In(L),x=L.length*8-l;return x>0?R>>BigInt(x):R},O=n.bits2int_modN||function(L){return i.create(w(L))},P=tn(l);function T(I){return vi("num < 2^"+l,I,et,P),i.toBytes(I)}function $(I,L){return mt(I,void 0,"message"),L?mt(t(I),void 0,"prehashed message"):I}function U(I,L,R){if(["recovered","canonical"].some(re=>re in R))throw new Error("sign() legacy options not supported");const{lowS:x,prehash:V,extraEntropy:B}=Hn(R,y);I=$(I,V);const k=O(I),H=It(i,L),Y=[T(H),T(k)];if(B!=null&&B!==!1){const re=B===!0?r(g.secretKey):B;Y.push(Oe("extraEntropy",re))}const ie=ze(...Y),J=k;function G(re){const ae=w(re);if(!i.isValidNot0(ae))return;const pe=i.inv(ae),te=e.BASE.multiply(ae).toAffine(),me=i.create(te.x);if(me===et)return;const nt=i.create(pe*i.create(J+me*H));if(nt===et)return;let vt=(te.x===me?0:2)|Number(te.y&St),rt=nt;return x&&p(nt)&&(rt=i.neg(nt),vt^=1),new v(me,rt,vt)}return{seed:ie,k2sig:G}}function oe(I,L,R={}){I=Oe("message",I);const{seed:x,k2sig:V}=U(I,L,R);return Ni(t.outputLen,i.BYTES,s)(x,V)}function Ee(I){let L;const R=typeof I=="string"||On(I),x=!R&&I!==null&&typeof I=="object"&&typeof I.r=="bigint"&&typeof I.s=="bigint";if(!R&&!x)throw new Error("invalid signature, expected Uint8Array, hex string or Signature instance");if(x)L=new v(I.r,I.s);else if(R){try{L=v.fromBytes(Oe("sig",I),"der")}catch(V){if(!(V instanceof Je.Err))throw V}if(!L)try{L=v.fromBytes(Oe("sig",I),"compact")}catch{return!1}}return L||!1}function M(I,L,R,x={}){const{lowS:V,prehash:B,format:k}=Hn(x,y);if(R=Oe("publicKey",R),L=$(Oe("message",L),B),"strict"in x)throw new Error("options.strict was renamed to lowS");const H=k===void 0?Ee(I):v.fromBytes(Oe("sig",I),k);if(H===!1)return!1;try{const Y=e.fromBytes(R);if(V&&H.hasHighS())return!1;const{r:ie,s:J}=H,G=O(L),re=i.inv(J),ae=i.create(G*re),pe=i.create(ie*re),te=e.BASE.multiplyUnsafe(ae).add(Y.multiplyUnsafe(pe));return te.is0()?!1:i.create(te.x)===ie}catch{return!1}}function S(I,L,R={}){const{prehash:x}=Hn(R,y);return L=$(L,x),v.fromBytes(I,"recovered").recoverPublicKey(L).toBytes()}return Object.freeze({keygen:c,getPublicKey:_,getSharedSecret:m,utils:u,lengths:g,Point:e,sign:oe,verify:M,recoverPublicKey:S,Signature:v,hash:t})}function ji(e){const t={a:e.a,b:e.b,p:e.Fp.ORDER,n:e.n,h:e.h,Gx:e.Gx,Gy:e.Gy},n=e.Fp;let r=e.allowedPrivateKeyLengths?Array.from(new Set(e.allowedPrivateKeyLengths.map(i=>Math.ceil(i/2)))):void 0;const s=xt(t.n,{BITS:e.nBitLength,allowedLengths:r,modFromBytes:e.wrapPrivateKey}),o={Fp:n,Fn:s,allowInfinityPoint:e.allowInfinityPoint,endo:e.endo,isTorsionFree:e.isTorsionFree,clearCofactor:e.clearCofactor,fromBytes:e.fromBytes,toBytes:e.toBytes};return{CURVE:t,curveOpts:o}}function qi(e){const{CURVE:t,curveOpts:n}=ji(e),r={hmac:e.hmac,randomBytes:e.randomBytes,lowS:e.lowS,bits2int:e.bits2int,bits2int_modN:e.bits2int_modN};return{CURVE:t,curveOpts:n,hash:e.hash,ecdsaOpts:r}}function Xi(e,t){const n=t.Point;return Object.assign({},t,{ProjectivePoint:n,CURVE:Object.assign({},e,io(n.Fn.ORDER,n.Fn.BITS))})}function Zi(e){const{CURVE:t,curveOpts:n,hash:r,ecdsaOpts:s}=qi(e),o=Yi(t,n),i=Gi(o,r,s);return Xi(e,i)}/*! noble-ciphers - MIT License (c) 2023 Paul Miller (paulmillr.com) */function ho(e){return e instanceof Uint8Array||ArrayBuffer.isView(e)&&e.constructor.name==="Uint8Array"}function pn(e,...t){if(!ho(e))throw new Error("Uint8Array expected");if(t.length>0&&!t.includes(e.length))throw new Error("Uint8Array expected of length "+t+", got length="+e.length)}function bn(e,t=!0){if(e.destroyed)throw new Error("Hash instance has been destroyed");if(t&&e.finished)throw new Error("Hash#digest() has already been called")}function go(e,t){pn(e);const n=t.outputLen;if(e.length<n)throw new Error("digestInto() expects output buffer of length at least "+n)}function Kt(e){return new Uint32Array(e.buffer,e.byteOffset,Math.floor(e.byteLength/4))}function zn(...e){for(let t=0;t<e.length;t++)e[t].fill(0)}function er(e){return new DataView(e.buffer,e.byteOffset,e.byteLength)}function Ji(e){if(typeof e!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(e))}function Gt(e){if(typeof e=="string")e=Ji(e);else if(ho(e))e=Eo(e);else throw new Error("Uint8Array expected, got "+typeof e);return e}function $n(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const s=BigInt(32),o=BigInt(4294967295),i=Number(n>>s&o),a=Number(n&o),l=0,c=4;e.setUint32(t+l,i,r),e.setUint32(t+c,a,r)}function Eo(e){return Uint8Array.from(e)}const Qe=16,br=new Uint8Array(16),Ye=Kt(br),Qi=225,zi=(e,t,n,r)=>{const s=r&1;return{s3:n<<31|r>>>1,s2:t<<31|n>>>1,s1:e<<31|t>>>1,s0:e>>>1^Qi<<24&-(s&1)}},Ue=e=>(e>>>0&255)<<24|(e>>>8&255)<<16|(e>>>16&255)<<8|e>>>24&255|0;function ea(e){e.reverse();const t=e[15]&1;let n=0;for(let r=0;r<e.length;r++){const s=e[r];e[r]=s>>>1|n,n=(s&1)<<7}return e[0]^=-t&225,e}const ta=e=>e>64*1024?8:e>1024?4:2;class po{constructor(t,n){this.blockLen=Qe,this.outputLen=Qe,this.s0=0,this.s1=0,this.s2=0,this.s3=0,this.finished=!1,t=Gt(t),pn(t,16);const r=er(t);let s=r.getUint32(0,!1),o=r.getUint32(4,!1),i=r.getUint32(8,!1),a=r.getUint32(12,!1);const l=[];for(let y=0;y<128;y++)l.push({s0:Ue(s),s1:Ue(o),s2:Ue(i),s3:Ue(a)}),{s0:s,s1:o,s2:i,s3:a}=zi(s,o,i,a);const c=ta(n||1024);if(![1,2,4,8].includes(c))throw new Error("ghash: invalid window size, expected 2, 4 or 8");this.W=c;const m=128/c,u=this.windowSize=2**c,g=[];for(let y=0;y<m;y++)for(let E=0;E<u;E++){let p=0,f=0,b=0,v=0;for(let w=0;w<c;w++){if(!(E>>>c-w-1&1))continue;const{s0:P,s1:T,s2:$,s3:U}=l[c*y+w];p^=P,f^=T,b^=$,v^=U}g.push({s0:p,s1:f,s2:b,s3:v})}this.t=g}_updateBlock(t,n,r,s){t^=this.s0,n^=this.s1,r^=this.s2,s^=this.s3;const{W:o,t:i,windowSize:a}=this;let l=0,c=0,_=0,m=0;const u=(1<<o)-1;let g=0;for(const y of[t,n,r,s])for(let E=0;E<4;E++){const p=y>>>8*E&255;for(let f=8/o-1;f>=0;f--){const b=p>>>o*f&u,{s0:v,s1:w,s2:O,s3:P}=i[g*a+b];l^=v,c^=w,_^=O,m^=P,g+=1}}this.s0=l,this.s1=c,this.s2=_,this.s3=m}update(t){bn(this),t=Gt(t),pn(t);const n=Kt(t),r=Math.floor(t.length/Qe),s=t.length%Qe;for(let o=0;o<r;o++)this._updateBlock(n[o*4+0],n[o*4+1],n[o*4+2],n[o*4+3]);return s&&(br.set(t.subarray(r*Qe)),this._updateBlock(Ye[0],Ye[1],Ye[2],Ye[3]),zn(Ye)),this}destroy(){const{t}=this;for(const n of t)n.s0=0,n.s1=0,n.s2=0,n.s3=0}digestInto(t){bn(this),go(t,this),this.finished=!0;const{s0:n,s1:r,s2:s,s3:o}=this,i=Kt(t);return i[0]=n,i[1]=r,i[2]=s,i[3]=o,t}digest(){const t=new Uint8Array(Qe);return this.digestInto(t),this.destroy(),t}}class na extends po{constructor(t,n){t=Gt(t),pn(t);const r=ea(Eo(t));super(r,n),zn(r)}update(t){t=Gt(t),bn(this);const n=Kt(t),r=t.length%Qe,s=Math.floor(t.length/Qe);for(let o=0;o<s;o++)this._updateBlock(Ue(n[o*4+3]),Ue(n[o*4+2]),Ue(n[o*4+1]),Ue(n[o*4+0]));return r&&(br.set(t.subarray(s*Qe)),this._updateBlock(Ue(Ye[3]),Ue(Ye[2]),Ue(Ye[1]),Ue(Ye[0])),zn(Ye)),this}digestInto(t){bn(this),go(t,this),this.finished=!0;const{s0:n,s1:r,s2:s,s3:o}=this,i=Kt(t);return i[0]=n,i[1]=r,i[2]=s,i[3]=o,t.reverse()}}function bo(e){const t=(r,s)=>e(s,r.length).update(Gt(r)).digest(),n=e(new Uint8Array(16),0);return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=(r,s)=>e(r,s),t}const Qr=bo((e,t)=>new po(e,t));bo((e,t)=>new na(e,t));var ra=Object.defineProperty,yo=(e,t)=>{for(var n in t)ra(e,n,{get:t[n],enumerable:!0})},wo={};yo(wo,{EmptyArray:()=>Lr,arrayToHex:()=>Sn,arrayToUtf8:()=>vn,calculateSharedKey:()=>Sa,comparePublicKeyHex:()=>Ia,compressPublicKeyHex:()=>La,doDecrypt:()=>Pa,doEncrypt:()=>Ca,doSignature:()=>Ra,doVerifySignature:()=>Da,generateKeyPairHex:()=>Tr,getHash:()=>Or,getPoint:()=>So,getPublicKeyFromPrivateKey:()=>Ao,getZ:()=>Tn,hexToArray:()=>_e,initRNGPool:()=>wr,leftPad:()=>be,precomputePublicKey:()=>Ua,utf8ToHex:()=>Rt,verifyPublicKey:()=>Oa});var yn=BigInt(0),jt=BigInt(1),sa=BigInt(2);BigInt(3);function oa(e){let t=e.toString(16);if(t[0]!=="-")t.length%2===1?t="0"+t:t.match(/^[0-7]/)||(t="00"+t);else{t=t.substring(1);let n=t.length;n%2===1?n+=1:t.match(/^[0-7]/)||(n+=2);let r="";for(let i=0;i<n;i++)r+="f";t=((ge(r)^e)+jt).toString(16).replace(/^-/,"")}return t}var yr=class{constructor(e=null,t="00",n="00",r=""){this.tlv=e,this.t=t,this.l=n,this.v=r}getEncodedHex(){return this.tlv||(this.v=this.getValue(),this.l=this.getLength(),this.tlv=this.t+this.l+this.v),this.tlv}getLength(){const e=this.v.length/2;let t=e.toString(16);return t.length%2===1&&(t="0"+t),e<128?t:(128+t.length/2).toString(16)+t}getValue(){return""}},wn=class extends yr{constructor(e){super(),this.t="02",e&&(this.v=oa(e))}getValue(){return this.v}},zr=class extends yr{constructor(t){super();le(this,"hV","");this.s=t,this.t="04",t&&(this.v=t.toLowerCase())}getValue(){return this.v}},vo=class extends yr{constructor(t){super();le(this,"t","30");this.asn1Array=t}getValue(){return this.v=this.asn1Array.map(t=>t.getEncodedHex()).join(""),this.v}};function No(e,t){if(+e[t+2]<8)return 1;const r=e.slice(t+2,t+6).slice(0,2);return(parseInt(r,16)-128)*2}function tr(e,t){const n=No(e,t),r=e.substring(t+2,t+2+n*2);return r?+(+r[0]<8?ge(r):ge(r.substring(2))).toString():-1}function Yt(e,t){const n=No(e,t);return t+(n+1)*2}function ia(e,t){const n=new wn(e),r=new wn(t);return new vo([n,r]).getEncodedHex()}function es(e,t,n,r){const s=new wn(e),o=new wn(t),i=new zr(n),a=new zr(r);return new vo([s,o,i,a]).getEncodedHex()}function aa(e){const t=Yt(e,0),n=Yt(e,t),r=tr(e,t),s=e.substring(n,n+r*2),o=n+s.length,i=Yt(e,o),a=tr(e,o),l=e.substring(i,i+a*2),c=ge(s),_=ge(l);return{r:c,s:_}}function la(e){function t(u,g){const y=Yt(u,g),E=tr(u,g),p=u.substring(y,y+E*2),f=y+p.length;return{value:p,nextStart:f}}const n=Yt(e,0),{value:r,nextStart:s}=t(e,n),{value:o,nextStart:i}=t(e,s),{value:a,nextStart:l}=t(e,i),{value:c}=t(e,l),_=ge(r),m=ge(o);return{x:_,y:m,hash:a,cipher:c}}var Wn=16384,gt=new Uint8Array(0),At;async function wr(){if("crypto"in globalThis){At=globalThis.crypto;return}if(!(gt.length>Wn/2))if("wx"in globalThis&&"getRandomValues"in globalThis.wx)gt=await new Promise(e=>{wx.getRandomValues({length:Wn,success(t){e(new Uint8Array(t.randomValues))}})});else try{globalThis.crypto?At=globalThis.crypto:At=(await Promise.resolve().then(()=>require("./__vite-browser-external-BcPniuRQ.cjs"))).webcrypto;const e=new Uint8Array(Wn);At.getRandomValues(e),gt=e}catch{throw new Error("no available csprng, abort.")}}wr();function ca(e){if(gt.length>e){const t=gt.slice(0,e);return gt=gt.slice(e),wr(),t}else throw new Error("random number pool is not ready or insufficient, prevent getting too long random values or too often.")}function ua(e=0){const t=new Uint8Array(e);return At?At.getRandomValues(t):ca(e)}var To=e=>e instanceof Uint8Array,Yn=e=>new DataView(e.buffer,e.byteOffset,e.byteLength),fa=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;if(!fa)throw new Error("Non little-endian hardware is not supported");var da=Array.from({length:256},(e,t)=>t.toString(16).padStart(2,"0"));function Ke(e){if(!To(e))throw new Error("Uint8Array expected");let t="";for(let n=0;n<e.length;n++)t+=da[e[n]];return t}function ma(e){if(typeof e!="string")throw new Error(`utf8ToBytes expected string, got ${typeof e}`);return new Uint8Array(new TextEncoder().encode(e))}function vr(e){if(typeof e=="string"&&(e=ma(e)),!To(e))throw new Error(`expected Uint8Array, got ${typeof e}`);return e}var Lo=class{clone(){return this._cloneInto()}};function _a(e){const t=r=>e().update(vr(r)).digest(),n=e();return t.outputLen=n.outputLen,t.blockLen=n.blockLen,t.create=()=>e(),t}var ha=(e,t,n)=>e&t|e&n|t&n,ts=(e,t,n)=>e^t^n,ga=(e,t,n)=>e&t|~e&n;function Ea(e,t,n,r){if(typeof e.setBigUint64=="function")return e.setBigUint64(t,n,r);const s=BigInt(32),o=BigInt(4294967295),i=Number(n>>s&o),a=Number(n&o),l=r?4:0,c=r?0:4;e.setUint32(t+l,i,r),e.setUint32(t+c,a,r)}function ke(e,t){const n=t&31;return e<<n|e>>>32-n}function pa(e){return e^ke(e,9)^ke(e,17)}function ba(e){return e^ke(e,15)^ke(e,23)}var ya=class extends Lo{constructor(t,n,r,s){super();le(this,"buffer");le(this,"view");le(this,"finished",!1);le(this,"length",0);le(this,"pos",0);le(this,"destroyed",!1);this.blockLen=t,this.outputLen=n,this.padOffset=r,this.isLE=s,this.buffer=new Uint8Array(t),this.view=Yn(this.buffer)}update(t){const{view:n,buffer:r,blockLen:s}=this;t=vr(t);const o=t.length;for(let i=0;i<o;){const a=Math.min(s-this.pos,o-i);if(a===s){const l=Yn(t);for(;s<=o-i;i+=s)this.process(l,i);continue}r.set(t.subarray(i,i+a),this.pos),this.pos+=a,i+=a,this.pos===s&&(this.process(n,0),this.pos=0)}return this.length+=t.length,this.roundClean(),this}digestInto(t){this.finished=!0;const{buffer:n,view:r,blockLen:s,isLE:o}=this;let{pos:i}=this;n[i++]=128,this.buffer.subarray(i).fill(0),this.padOffset>s-i&&(this.process(r,0),i=0);for(let m=i;m<s;m++)n[m]=0;Ea(r,s-8,BigInt(this.length*8),o),this.process(r,0);const a=Yn(t),l=this.outputLen;if(l%4)throw new Error("_sha2: outputLen should be aligned to 32bit");const c=l/4,_=this.get();if(c>_.length)throw new Error("_sha2: outputLen bigger than state");for(let m=0;m<c;m++)a.setUint32(4*m,_[m],o)}digest(){const{buffer:t,outputLen:n}=this;this.digestInto(t);const r=t.slice(0,n);return this.destroy(),r}_cloneInto(t){t||(t=new this.constructor),t.set(...this.get());const{blockLen:n,buffer:r,length:s,finished:o,destroyed:i,pos:a}=this;return t.length=s,t.pos=a,t.finished=o,t.destroyed=i,s%n&&t.buffer.set(r),t}},st=new Uint32Array([1937774191,1226093241,388252375,3666478592,2842636476,372324522,3817729613,2969243214]),Be=new Uint32Array(68),ns=new Uint32Array(64),wa=2043430169,va=2055708042,Na=class extends ya{constructor(){super(64,32,8,!1);le(this,"A",st[0]|0);le(this,"B",st[1]|0);le(this,"C",st[2]|0);le(this,"D",st[3]|0);le(this,"E",st[4]|0);le(this,"F",st[5]|0);le(this,"G",st[6]|0);le(this,"H",st[7]|0)}get(){const{A:t,B:n,C:r,D:s,E:o,F:i,G:a,H:l}=this;return[t,n,r,s,o,i,a,l]}set(t,n,r,s,o,i,a,l){this.A=t|0,this.B=n|0,this.C=r|0,this.D=s|0,this.E=o|0,this.F=i|0,this.G=a|0,this.H=l|0}process(t,n){for(let m=0;m<16;m++,n+=4)Be[m]=t.getUint32(n,!1);for(let m=16;m<68;m++)Be[m]=ba(Be[m-16]^Be[m-9]^ke(Be[m-3],15))^ke(Be[m-13],7)^Be[m-6];for(let m=0;m<64;m++)ns[m]=Be[m]^Be[m+4];let{A:r,B:s,C:o,D:i,E:a,F:l,G:c,H:_}=this;for(let m=0;m<64;m++){let u=m>=0&&m<=15,g=u?wa:va,y=ke(ke(r,12)+a+ke(g,m),7),E=y^ke(r,12),p=(u?ts(r,s,o):ha(r,s,o))+i+E+ns[m]|0,f=(u?ts(a,l,c):ga(a,l,c))+_+y+Be[m]|0;i=o,o=ke(s,9),s=r,r=p,_=c,c=ke(l,19),l=a,a=pa(f)}r=r^this.A|0,s=s^this.B|0,o=o^this.C|0,i=i^this.D|0,a=a^this.E|0,l=l^this.F|0,c=c^this.G|0,_=_^this.H|0,this.set(r,s,o,i,a,l,c,_)}roundClean(){Be.fill(0)}destroy(){this.set(0,0,0,0,0,0,0,0),this.buffer.fill(0)}},Ge=_a(()=>new Na),Oo=class extends Lo{constructor(t,n){super();le(this,"oHash");le(this,"iHash");le(this,"blockLen");le(this,"outputLen");le(this,"finished",!1);le(this,"destroyed",!1);const r=vr(n);if(this.iHash=t.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 s=this.blockLen,o=new Uint8Array(s);o.set(r.length>s?t.create().update(r).digest():r);for(let i=0;i<o.length;i++)o[i]^=54;this.iHash.update(o),this.oHash=t.create();for(let i=0;i<o.length;i++)o[i]^=106;this.oHash.update(o),o.fill(0)}update(t){return this.iHash.update(t),this}digestInto(t){this.finished=!0,this.iHash.digestInto(t),this.oHash.update(t),this.oHash.digestInto(t),this.destroy()}digest(){const t=new Uint8Array(this.oHash.outputLen);return this.digestInto(t),t}_cloneInto(t){t||(t=Object.create(Object.getPrototypeOf(this),{}));const{oHash:n,iHash:r,finished:s,destroyed:o,blockLen:i,outputLen:a}=this;return t=t,t.finished=s,t.destroyed=o,t.blockLen=i,t.outputLen=a,t.oHash=n._cloneInto(t.oHash),t.iHash=r._cloneInto(t.iHash),t}destroy(){this.destroyed=!0,this.oHash.destroy(),this.iHash.destroy()}},Nr=(e,t,n)=>new Oo(e,t).update(n).digest();Nr.create=(e,t)=>new Oo(e,t);var Ta=xt(BigInt("115792089210356248756420345214020892766250353991924191454421193933289684991999")),se=Zi({a:BigInt("115792089210356248756420345214020892766250353991924191454421193933289684991996"),b:BigInt("18505919022281880113072981827955639221458448578012075254857346196103069175443"),Fp:Ta,h:jt,n:BigInt("115792089210356248756420345214020892766061623724957744567843809356293439045923"),Gx:BigInt("22963146547237050559479531362550074578802567295341616970375194840604139615431"),Gy:BigInt("85132369209828568825618990617112496413088388631904505083283536607588877201568"),hash:Ge,hmac:(e,...t)=>Nr(Ge,e,at(...t)),randomBytes:ua}),Ve=xt(BigInt(se.CURVE.n));function Tr(e){const t=e?Li(Ce(BigInt(e),jt)+jt,32):se.utils.randomPrivateKey(),n=se.getPublicKey(t,!1),r=be(gn(t),64),s=be(gn(n),64);return{privateKey:r,publicKey:s}}function La(e){if(e.length!==130)throw new Error("Invalid public key to compress");const t=(e.length-2)/2,n=e.substring(2,2+t),r=ge(e.substring(t+2,t+t+2));let s="03";return Ce(r,sa)===yn&&(s="02"),s+n}function Rt(e){const t=Ti(e);return gn(t)}function be(e,t){return e.length>=t?e:new Array(t-e.length+1).join("0")+e}function Sn(e){return e.map(t=>{const n=t.toString(16);return n.length===1?"0"+n:n}).join("")}function vn(e){const t=[];for(let n=0,r=e.length;n<r;n++)e[n]>=240&&e[n]<=247?(t.push(String.fromCodePoint(((e[n]&7)<<18)+((e[n+1]&63)<<12)+((e[n+2]&63)<<6)+(e[n+3]&63))),n+=3):e[n]>=224&&e[n]<=239?(t.push(String.fromCodePoint(((e[n]&15)<<12)+((e[n+1]&63)<<6)+(e[n+2]&63))),n+=2):e[n]>=192&&e[n]<=223?(t.push(String.fromCodePoint(((e[n]&31)<<6)+(e[n+1]&63))),n++):t.push(String.fromCodePoint(e[n]));return t.join("")}function _e(e){let t=e.length;t%2!==0&&(e=be(e,t+1)),t=e.length;const n=t/2,r=new Uint8Array(n);for(let s=0;s<n;s++)r[s]=parseInt(e.substring(s*2,s*2+2),16);return r}function Oa(e){const t=se.ProjectivePoint.fromHex(e);if(!t)return!1;try{return t.assertValidity(),!0}catch{return!1}}function Ia(e,t){const n=se.ProjectivePoint.fromHex(e);if(!n)return!1;const r=se.ProjectivePoint.fromHex(t);return r?n.equals(r):!1}var rs=ge("80000000000000000000000000000000"),ss=ge("7fffffffffffffffffffffffffffffff");function Aa(e,t){let n=new Uint8Array(t),r=1,s=0,o=Lr;const i=new Uint8Array(4),a=()=>{i[0]=r>>24&255,i[1]=r>>16&255,i[2]=r>>8&255,i[3]=r&255,o=Ge(at(e,i)),r++,s=0};a();for(let l=0,c=n.length;l<c;l++)s===o.length&&a(),n[l]=o[s++]&255;return n}function Sa(e,t,n,r,s,o=!1,i="1234567812345678",a="1234567812345678"){const l=se.ProjectivePoint.fromHex(t.publicKey),c=se.ProjectivePoint.fromHex(r),_=se.ProjectivePoint.fromHex(n);let m=Tn(e.publicKey,i),u=Tn(n,a);o&&([m,u]=[u,m]);const g=ge(t.privateKey),y=ge(e.privateKey),E=l.x,p=rs+(E&ss),f=Ve.add(y,Ve.mulN(p,g)),b=c.x,v=Ve.add(rs,b&ss),w=c.multiply(v).add(_).multiply(f),O=_e(be(Ae(w.x),64)),P=_e(be(Ae(w.y),64));return Aa(at(O,P,m,u),s)}var Nn=0,Lr=new Uint8Array;function Ca(e,t,n=1,r){const s=typeof e=="string"?_e(Rt(e)):Uint8Array.from(e),o=typeof t=="string"?se.ProjectivePoint.fromHex(t):t,i=Tr(),a=ge(i.privateKey);let l=i.publicKey;l.length>128&&(l=l.substring(l.length-128));const c=o.multiply(a),_=_e(be(Ae(c.x),64)),m=_e(be(Ae(c.y),64)),u=Ke(Ge(at(_,s,m)));Io(_,m,s);const g=Ke(s);if(r!=null&&r.asn1){const y=se.ProjectivePoint.fromHex(i.publicKey);return n===Nn?es(y.x,y.y,g,u):es(y.x,y.y,u,g)}return n===Nn?l+g+u:l+u+g}function Io(e,t,n){let r=1,s=0,o=Lr;const i=new Uint8Array(4),a=()=>{i[0]=r>>24&255,i[1]=r>>16&255,i[2]=r>>8&255,i[3]=r&255,o=Ge(at(e,t,i)),r++,s=0};a();for(let l=0,c=n.length;l<c;l++)s===o.length&&a(),n[l]^=o[s++]&255}function Pa(e,t,n=1,{output:r="string",asn1:s=!1}={}){const o=ge(t);let i,a,l;if(s){const{x:y,y:E,cipher:p,hash:f}=la(e);i=se.ProjectivePoint.fromAffine({x:y,y:E}),l=f,a=p,n===Nn&&([a,l]=[l,a])}else i=se.ProjectivePoint.fromHex("04"+e.substring(0,128)),l=e.substring(128,192),a=e.substring(192),n===Nn&&(l=e.substring(e.length-64),a=e.substring(128,e.length-64));const c=_e(a),_=i.multiply(o),m=_e(be(Ae(_.x),64)),u=_e(be(Ae(_.y),64));return Io(m,u,c),Sn(Array.from(Ge(at(m,c,u))))===l.toLowerCase()?r==="array"?c:vn(c):r==="array"?[]:""}function Ra(e,t,n={}){let{pointPool:r,der:s,hash:o,publicKey:i,userId:a}=n,l=typeof e=="string"?Rt(e):Sn(Array.from(e));o&&(i=i||Ao(t),l=Or(l,i,a));const c=ge(t),_=ge(l);let m=null,u=null,g=null;do{do{let y;r&&r.length?y=r.pop():y=So(),m=y.k,u=Ve.add(_,y.x1)}while(u===yn||u+m===se.CURVE.n);g=Ve.mul(Ve.inv(Ve.addN(c,jt)),Ve.subN(m,Ve.mulN(u,c)))}while(g===yn);return s?ia(u,g):be(Ae(u),64)+be(Ae(g),64)}function Da(e,t,n,r={}){let s;const{hash:o,der:i,userId:a}=r,l=typeof n=="string"?n:n.toHex(!1);o?s=Or(typeof e=="string"?Rt(e):e,l,a):s=typeof e=="string"?Rt(e):Sn(Array.from(e));let c,_;if(i){const p=aa(t);c=p.r,_=p.s}else c=ge(t.substring(0,64)),_=ge(t.substring(64));const m=typeof n=="string"?se.ProjectivePoint.fromHex(n):n,u=ge(s),g=Ve.add(c,_);if(g===yn)return!1;const y=se.ProjectivePoint.BASE.multiply(_).add(m.multiply(g)),E=Ve.add(u,y.x);return c===E}function Tn(e,t="1234567812345678"){t=Rt(t);const n=be(Ae(se