index-265ab49b.js 38 KB

1
  1. import{a3 as zi,a4 as ji}from"./index-b3d5c748.js";var Yt={exports:{}};(function(r,n){(function(){var f,h=0xdeadbeefcafe,u=(h&16777215)==15715070;function s(t,e,i){t!=null&&(typeof t=="number"?this.fromNumber(t,e,i):e==null&&typeof t!="string"?this.fromString(t,256):this.fromString(t,e))}function a(){return new s(null)}function T(t,e,i,o,c,l){for(;--l>=0;){var x=e*this[t++]+i[o]+c;c=Math.floor(x/67108864),i[o++]=x&67108863}return c}function d(t,e,i,o,c,l){for(var x=e&32767,p=e>>15;--l>=0;){var D=this[t]&32767,q=this[t++]>>15,L=p*D+q*x;D=x*D+((L&32767)<<15)+i[o]+(c&1073741823),c=(D>>>30)+(L>>>15)+p*q+(c>>>30),i[o++]=D&1073741823}return c}function B(t,e,i,o,c,l){for(var x=e&16383,p=e>>14;--l>=0;){var D=this[t]&16383,q=this[t++]>>14,L=p*D+q*x;D=x*D+((L&16383)<<14)+i[o]+c,c=(D>>28)+(L>>14)+p*q,i[o++]=D&268435455}return c}var g=typeof navigator<"u";g&&u&&navigator.appName=="Microsoft Internet Explorer"?(s.prototype.am=d,f=30):g&&u&&navigator.appName!="Netscape"?(s.prototype.am=T,f=26):(s.prototype.am=B,f=28),s.prototype.DB=f,s.prototype.DM=(1<<f)-1,s.prototype.DV=1<<f;var m=52;s.prototype.FV=Math.pow(2,m),s.prototype.F1=m-f,s.prototype.F2=2*f-m;var v="0123456789abcdefghijklmnopqrstuvwxyz",w=new Array,y,S;for(y="0".charCodeAt(0),S=0;S<=9;++S)w[y++]=S;for(y="a".charCodeAt(0),S=10;S<36;++S)w[y++]=S;for(y="A".charCodeAt(0),S=10;S<36;++S)w[y++]=S;function E(t){return v.charAt(t)}function A(t,e){var i=w[t.charCodeAt(e)];return i??-1}function M(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s}function $(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0}function R(t){var e=a();return e.fromInt(t),e}function Q(t,e){var i;if(e==16)i=4;else if(e==8)i=3;else if(e==256)i=8;else if(e==2)i=1;else if(e==32)i=5;else if(e==4)i=2;else{this.fromRadix(t,e);return}this.t=0,this.s=0;for(var o=t.length,c=!1,l=0;--o>=0;){var x=i==8?t[o]&255:A(t,o);if(x<0){t.charAt(o)=="-"&&(c=!0);continue}c=!1,l==0?this[this.t++]=x:l+i>this.DB?(this[this.t-1]|=(x&(1<<this.DB-l)-1)<<l,this[this.t++]=x>>this.DB-l):this[this.t-1]|=x<<l,l+=i,l>=this.DB&&(l-=this.DB)}i==8&&t[0]&128&&(this.s=-1,l>0&&(this[this.t-1]|=(1<<this.DB-l)-1<<l)),this.clamp(),c&&s.ZERO.subTo(this,this)}function J(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t}function xt(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(t==16)e=4;else if(t==8)e=3;else if(t==2)e=1;else if(t==32)e=5;else if(t==4)e=2;else return this.toRadix(t);var i=(1<<e)-1,o,c=!1,l="",x=this.t,p=this.DB-x*this.DB%e;if(x-- >0)for(p<this.DB&&(o=this[x]>>p)>0&&(c=!0,l=E(o));x>=0;)p<e?(o=(this[x]&(1<<p)-1)<<e-p,o|=this[--x]>>(p+=this.DB-e)):(o=this[x]>>(p-=e)&i,p<=0&&(p+=this.DB,--x)),o>0&&(c=!0),c&&(l+=E(o));return c?l:"0"}function pt(){var t=a();return s.ZERO.subTo(this,t),t}function dt(){return this.s<0?this.negate():this}function gt(t){var e=this.s-t.s;if(e!=0)return e;var i=this.t;if(e=i-t.t,e!=0)return this.s<0?-e:e;for(;--i>=0;)if((e=this[i]-t[i])!=0)return e;return 0}function F(t){var e=1,i;return(i=t>>>16)!=0&&(t=i,e+=16),(i=t>>8)!=0&&(t=i,e+=8),(i=t>>4)!=0&&(t=i,e+=4),(i=t>>2)!=0&&(t=i,e+=2),(i=t>>1)!=0&&(t=i,e+=1),e}function oe(){return this.t<=0?0:this.DB*(this.t-1)+F(this[this.t-1]^this.s&this.DM)}function fe(t,e){var i;for(i=this.t-1;i>=0;--i)e[i+t]=this[i];for(i=t-1;i>=0;--i)e[i]=0;e.t=this.t+t,e.s=this.s}function he(t,e){for(var i=t;i<this.t;++i)e[i-t]=this[i];e.t=Math.max(this.t-t,0),e.s=this.s}function ue(t,e){var i=t%this.DB,o=this.DB-i,c=(1<<o)-1,l=Math.floor(t/this.DB),x=this.s<<i&this.DM,p;for(p=this.t-1;p>=0;--p)e[p+l+1]=this[p]>>o|x,x=(this[p]&c)<<i;for(p=l-1;p>=0;--p)e[p]=0;e[l]=x,e.t=this.t+l+1,e.s=this.s,e.clamp()}function ce(t,e){e.s=this.s;var i=Math.floor(t/this.DB);if(i>=this.t){e.t=0;return}var o=t%this.DB,c=this.DB-o,l=(1<<o)-1;e[0]=this[i]>>o;for(var x=i+1;x<this.t;++x)e[x-i-1]|=(this[x]&l)<<c,e[x-i]=this[x]>>o;o>0&&(e[this.t-i-1]|=(this.s&l)<<c),e.t=this.t-i,e.clamp()}function le(t,e){for(var i=0,o=0,c=Math.min(t.t,this.t);i<c;)o+=this[i]-t[i],e[i++]=o&this.DM,o>>=this.DB;if(t.t<this.t){for(o-=t.s;i<this.t;)o+=this[i],e[i++]=o&this.DM,o>>=this.DB;o+=this.s}else{for(o+=this.s;i<t.t;)o-=t[i],e[i++]=o&this.DM,o>>=this.DB;o-=t.s}e.s=o<0?-1:0,o<-1?e[i++]=this.DV+o:o>0&&(e[i++]=o),e.t=i,e.clamp()}function ae(t,e){var i=this.abs(),o=t.abs(),c=i.t;for(e.t=c+o.t;--c>=0;)e[c]=0;for(c=0;c<o.t;++c)e[c+i.t]=i.am(0,o[c],e,c,0,i.t);e.s=0,e.clamp(),this.s!=t.s&&s.ZERO.subTo(e,e)}function xe(t){for(var e=this.abs(),i=t.t=2*e.t;--i>=0;)t[i]=0;for(i=0;i<e.t-1;++i){var o=e.am(i,e[i],t,2*i,0,1);(t[i+e.t]+=e.am(i+1,2*e[i],t,2*i+1,o,e.t-i-1))>=e.DV&&(t[i+e.t]-=e.DV,t[i+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(i,e[i],t,2*i,0,1)),t.s=0,t.clamp()}function pe(t,e,i){var o=t.abs();if(!(o.t<=0)){var c=this.abs();if(c.t<o.t){e!=null&&e.fromInt(0),i!=null&&this.copyTo(i);return}i==null&&(i=a());var l=a(),x=this.s,p=t.s,D=this.DB-F(o[o.t-1]);D>0?(o.lShiftTo(D,l),c.lShiftTo(D,i)):(o.copyTo(l),c.copyTo(i));var q=l.t,L=l[q-1];if(L!=0){var H=L*(1<<this.F1)+(q>1?l[q-2]>>this.F2:0),_=this.FV/H,yt=(1<<this.F1)/H,j=1<<this.F2,k=i.t,vt=k-q,G=e??a();for(l.dlShiftTo(vt,G),i.compareTo(G)>=0&&(i[i.t++]=1,i.subTo(G,i)),s.ONE.dlShiftTo(q,G),G.subTo(l,l);l.t<q;)l[l.t++]=0;for(;--vt>=0;){var Et=i[--k]==L?this.DM:Math.floor(i[k]*_+(i[k-1]+j)*yt);if((i[k]+=l.am(0,Et,i,vt,0,q))<Et)for(l.dlShiftTo(vt,G),i.subTo(G,i);i[k]<--Et;)i.subTo(G,i)}e!=null&&(i.drShiftTo(q,e),x!=p&&s.ZERO.subTo(e,e)),i.t=q,i.clamp(),D>0&&i.rShiftTo(D,i),x<0&&s.ZERO.subTo(i,i)}}}function de(t){var e=a();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(s.ZERO)>0&&t.subTo(e,e),e}function tt(t){this.m=t}function ge(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t}function me(t){return t}function ye(t){t.divRemTo(this.m,null,t)}function ve(t,e,i){t.multiplyTo(e,i),this.reduce(i)}function be(t,e){t.squareTo(e),this.reduce(e)}tt.prototype.convert=ge,tt.prototype.revert=me,tt.prototype.reduce=ye,tt.prototype.mulTo=ve,tt.prototype.sqrTo=be;function Te(){if(this.t<1)return 0;var t=this[0];if(!(t&1))return 0;var e=t&3;return e=e*(2-(t&15)*e)&15,e=e*(2-(t&255)*e)&255,e=e*(2-((t&65535)*e&65535))&65535,e=e*(2-t*e%this.DV)%this.DV,e>0?this.DV-e:-e}function et(t){this.m=t,this.mp=t.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}function we(t){var e=a();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(s.ZERO)>0&&this.m.subTo(e,e),e}function Fe(t){var e=a();return t.copyTo(e),this.reduce(e),e}function Be(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e<this.m.t;++e){var i=t[e]&32767,o=i*this.mpl+((i*this.mph+(t[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(i=e+this.m.t,t[i]+=this.m.am(0,o,t,e,0,this.m.t);t[i]>=t.DV;)t[i]-=t.DV,t[++i]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)}function Se(t,e){t.squareTo(e),this.reduce(e)}function De(t,e,i){t.multiplyTo(e,i),this.reduce(i)}et.prototype.convert=we,et.prototype.revert=Fe,et.prototype.reduce=Be,et.prototype.mulTo=De,et.prototype.sqrTo=Se;function Ie(){return(this.t>0?this[0]&1:this.s)==0}function qe(t,e){if(t>4294967295||t<1)return s.ONE;var i=a(),o=a(),c=e.convert(this),l=F(t)-1;for(c.copyTo(i);--l>=0;)if(e.sqrTo(i,o),(t&1<<l)>0)e.mulTo(o,c,i);else{var x=i;i=o,o=x}return e.revert(i)}function Ee(t,e){var i;return t<256||e.isEven()?i=new tt(e):i=new et(e),this.exp(t,i)}s.prototype.copyTo=M,s.prototype.fromInt=$,s.prototype.fromString=Q,s.prototype.clamp=J,s.prototype.dlShiftTo=fe,s.prototype.drShiftTo=he,s.prototype.lShiftTo=ue,s.prototype.rShiftTo=ce,s.prototype.subTo=le,s.prototype.multiplyTo=ae,s.prototype.squareTo=xe,s.prototype.divRemTo=pe,s.prototype.invDigit=Te,s.prototype.isEven=Ie,s.prototype.exp=qe,s.prototype.toString=xt,s.prototype.negate=pt,s.prototype.abs=dt,s.prototype.compareTo=gt,s.prototype.bitLength=oe,s.prototype.mod=de,s.prototype.modPowInt=Ee,s.ZERO=R(0),s.ONE=R(1);function Ae(){var t=a();return this.copyTo(t),t}function Re(){if(this.s<0){if(this.t==1)return this[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this[0];if(this.t==0)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]}function Pe(){return this.t==0?this.s:this[0]<<24>>24}function Ce(){return this.t==0?this.s:this[0]<<16>>16}function Me(t){return Math.floor(Math.LN2*this.DB/Math.log(t))}function Oe(){return this.s<0?-1:this.t<=0||this.t==1&&this[0]<=0?0:1}function He(t){if(t==null&&(t=10),this.signum()==0||t<2||t>36)return"0";var e=this.chunkSize(t),i=Math.pow(t,e),o=R(i),c=a(),l=a(),x="";for(this.divRemTo(o,c,l);c.signum()>0;)x=(i+l.intValue()).toString(t).substr(1)+x,c.divRemTo(o,c,l);return l.intValue().toString(t)+x}function Ve(t,e){this.fromInt(0),e==null&&(e=10);for(var i=this.chunkSize(e),o=Math.pow(e,i),c=!1,l=0,x=0,p=0;p<t.length;++p){var D=A(t,p);if(D<0){t.charAt(p)=="-"&&this.signum()==0&&(c=!0);continue}x=e*x+D,++l>=i&&(this.dMultiply(o),this.dAddOffset(x,0),l=0,x=0)}l>0&&(this.dMultiply(Math.pow(e,l)),this.dAddOffset(x,0)),c&&s.ZERO.subTo(this,this)}function Le(t,e,i){if(typeof e=="number")if(t<2)this.fromInt(1);else for(this.fromNumber(t,i),this.testBit(t-1)||this.bitwiseTo(s.ONE.shiftLeft(t-1),Dt,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(s.ONE.shiftLeft(t-1),this);else{var o=new Array,c=t&7;o.length=(t>>3)+1,e.nextBytes(o),c>0?o[0]&=(1<<c)-1:o[0]=0,this.fromString(o,256)}}function Ne(){var t=this.t,e=new Array;e[0]=this.s;var i=this.DB-t*this.DB%8,o,c=0;if(t-- >0)for(i<this.DB&&(o=this[t]>>i)!=(this.s&this.DM)>>i&&(e[c++]=o|this.s<<this.DB-i);t>=0;)i<8?(o=(this[t]&(1<<i)-1)<<8-i,o|=this[--t]>>(i+=this.DB-8)):(o=this[t]>>(i-=8)&255,i<=0&&(i+=this.DB,--t)),o&128&&(o|=-256),c==0&&(this.s&128)!=(o&128)&&++c,(c>0||o!=this.s)&&(e[c++]=o);return e}function ze(t){return this.compareTo(t)==0}function je(t){return this.compareTo(t)<0?this:t}function ke(t){return this.compareTo(t)>0?this:t}function Ze(t,e,i){var o,c,l=Math.min(t.t,this.t);for(o=0;o<l;++o)i[o]=e(this[o],t[o]);if(t.t<this.t){for(c=t.s&this.DM,o=l;o<this.t;++o)i[o]=e(this[o],c);i.t=this.t}else{for(c=this.s&this.DM,o=l;o<t.t;++o)i[o]=e(c,t[o]);i.t=t.t}i.s=e(this.s,t.s),i.clamp()}function Ue(t,e){return t&e}function $e(t){var e=a();return this.bitwiseTo(t,Ue,e),e}function Dt(t,e){return t|e}function _e(t){var e=a();return this.bitwiseTo(t,Dt,e),e}function Ct(t,e){return t^e}function Ge(t){var e=a();return this.bitwiseTo(t,Ct,e),e}function Mt(t,e){return t&~e}function Ye(t){var e=a();return this.bitwiseTo(t,Mt,e),e}function Ke(){for(var t=a(),e=0;e<this.t;++e)t[e]=this.DM&~this[e];return t.t=this.t,t.s=~this.s,t}function Xe(t){var e=a();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e}function We(t){var e=a();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e}function Qe(t){if(t==0)return-1;var e=0;return t&65535||(t>>=16,e+=16),t&255||(t>>=8,e+=8),t&15||(t>>=4,e+=4),t&3||(t>>=2,e+=2),t&1||++e,e}function Je(){for(var t=0;t<this.t;++t)if(this[t]!=0)return t*this.DB+Qe(this[t]);return this.s<0?this.t*this.DB:-1}function ti(t){for(var e=0;t!=0;)t&=t-1,++e;return e}function ei(){for(var t=0,e=this.s&this.DM,i=0;i<this.t;++i)t+=ti(this[i]^e);return t}function ii(t){var e=Math.floor(t/this.DB);return e>=this.t?this.s!=0:(this[e]&1<<t%this.DB)!=0}function ni(t,e){var i=s.ONE.shiftLeft(t);return this.bitwiseTo(i,e,i),i}function ri(t){return this.changeBit(t,Dt)}function si(t){return this.changeBit(t,Mt)}function oi(t){return this.changeBit(t,Ct)}function fi(t,e){for(var i=0,o=0,c=Math.min(t.t,this.t);i<c;)o+=this[i]+t[i],e[i++]=o&this.DM,o>>=this.DB;if(t.t<this.t){for(o+=t.s;i<this.t;)o+=this[i],e[i++]=o&this.DM,o>>=this.DB;o+=this.s}else{for(o+=this.s;i<t.t;)o+=t[i],e[i++]=o&this.DM,o>>=this.DB;o+=t.s}e.s=o<0?-1:0,o>0?e[i++]=o:o<-1&&(e[i++]=this.DV+o),e.t=i,e.clamp()}function hi(t){var e=a();return this.addTo(t,e),e}function ui(t){var e=a();return this.subTo(t,e),e}function ci(t){var e=a();return this.multiplyTo(t,e),e}function li(){var t=a();return this.squareTo(t),t}function ai(t){var e=a();return this.divRemTo(t,e,null),e}function xi(t){var e=a();return this.divRemTo(t,null,e),e}function pi(t){var e=a(),i=a();return this.divRemTo(t,e,i),new Array(e,i)}function di(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()}function gi(t,e){if(t!=0){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}}function ct(){}function Ot(t){return t}function mi(t,e,i){t.multiplyTo(e,i)}function yi(t,e){t.squareTo(e)}ct.prototype.convert=Ot,ct.prototype.revert=Ot,ct.prototype.mulTo=mi,ct.prototype.sqrTo=yi;function vi(t){return this.exp(t,new ct)}function bi(t,e,i){var o=Math.min(this.t+t.t,e);for(i.s=0,i.t=o;o>0;)i[--o]=0;var c;for(c=i.t-this.t;o<c;++o)i[o+this.t]=this.am(0,t[o],i,o,0,this.t);for(c=Math.min(t.t,e);o<c;++o)this.am(0,t[o],i,o,0,e-o);i.clamp()}function Ti(t,e,i){--e;var o=i.t=this.t+t.t-e;for(i.s=0;--o>=0;)i[o]=0;for(o=Math.max(e-this.t,0);o<t.t;++o)i[this.t+o-e]=this.am(e-o,t[o],i,0,0,this.t+o-e);i.clamp(),i.drShiftTo(1,i)}function it(t){this.r2=a(),this.q3=a(),s.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}function wi(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=a();return t.copyTo(e),this.reduce(e),e}function Fi(t){return t}function Bi(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)}function Si(t,e){t.squareTo(e),this.reduce(e)}function Di(t,e,i){t.multiplyTo(e,i),this.reduce(i)}it.prototype.convert=wi,it.prototype.revert=Fi,it.prototype.reduce=Bi,it.prototype.mulTo=Di,it.prototype.sqrTo=Si;function Ii(t,e){var i=t.bitLength(),o,c=R(1),l;if(i<=0)return c;i<18?o=1:i<48?o=3:i<144?o=4:i<768?o=5:o=6,i<8?l=new tt(e):e.isEven()?l=new it(e):l=new et(e);var x=new Array,p=3,D=o-1,q=(1<<o)-1;if(x[1]=l.convert(this),o>1){var L=a();for(l.sqrTo(x[1],L);p<=q;)x[p]=a(),l.mulTo(L,x[p-2],x[p]),p+=2}var H=t.t-1,_,yt=!0,j=a(),k;for(i=F(t[H])-1;H>=0;){for(i>=D?_=t[H]>>i-D&q:(_=(t[H]&(1<<i+1)-1)<<D-i,H>0&&(_|=t[H-1]>>this.DB+i-D)),p=o;!(_&1);)_>>=1,--p;if((i-=p)<0&&(i+=this.DB,--H),yt)x[_].copyTo(c),yt=!1;else{for(;p>1;)l.sqrTo(c,j),l.sqrTo(j,c),p-=2;p>0?l.sqrTo(c,j):(k=c,c=j,j=k),l.mulTo(j,x[_],c)}for(;H>=0&&!(t[H]&1<<i);)l.sqrTo(c,j),k=c,c=j,j=k,--i<0&&(i=this.DB-1,--H)}return l.revert(c)}function qi(t){var e=this.s<0?this.negate():this.clone(),i=t.s<0?t.negate():t.clone();if(e.compareTo(i)<0){var o=e;e=i,i=o}var c=e.getLowestSetBit(),l=i.getLowestSetBit();if(l<0)return e;for(c<l&&(l=c),l>0&&(e.rShiftTo(l,e),i.rShiftTo(l,i));e.signum()>0;)(c=e.getLowestSetBit())>0&&e.rShiftTo(c,e),(c=i.getLowestSetBit())>0&&i.rShiftTo(c,i),e.compareTo(i)>=0?(e.subTo(i,e),e.rShiftTo(1,e)):(i.subTo(e,i),i.rShiftTo(1,i));return l>0&&i.lShiftTo(l,i),i}function Ei(t){if(t<=0)return 0;var e=this.DV%t,i=this.s<0?t-1:0;if(this.t>0)if(e==0)i=this[0]%t;else for(var o=this.t-1;o>=0;--o)i=(e*i+this[o])%t;return i}function Ai(t){var e=t.isEven();if(this.isEven()&&e||t.signum()==0)return s.ZERO;for(var i=t.clone(),o=this.clone(),c=R(1),l=R(0),x=R(0),p=R(1);i.signum()!=0;){for(;i.isEven();)i.rShiftTo(1,i),e?((!c.isEven()||!l.isEven())&&(c.addTo(this,c),l.subTo(t,l)),c.rShiftTo(1,c)):l.isEven()||l.subTo(t,l),l.rShiftTo(1,l);for(;o.isEven();)o.rShiftTo(1,o),e?((!x.isEven()||!p.isEven())&&(x.addTo(this,x),p.subTo(t,p)),x.rShiftTo(1,x)):p.isEven()||p.subTo(t,p),p.rShiftTo(1,p);i.compareTo(o)>=0?(i.subTo(o,i),e&&c.subTo(x,c),l.subTo(p,l)):(o.subTo(i,o),e&&x.subTo(c,x),p.subTo(l,p))}if(o.compareTo(s.ONE)!=0)return s.ZERO;if(p.compareTo(t)>=0)return p.subtract(t);if(p.signum()<0)p.addTo(t,p);else return p;return p.signum()<0?p.add(t):p}var P=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],Ri=(1<<26)/P[P.length-1];function Pi(t){var e,i=this.abs();if(i.t==1&&i[0]<=P[P.length-1]){for(e=0;e<P.length;++e)if(i[0]==P[e])return!0;return!1}if(i.isEven())return!1;for(e=1;e<P.length;){for(var o=P[e],c=e+1;c<P.length&&o<Ri;)o*=P[c++];for(o=i.modInt(o);e<c;)if(o%P[e++]==0)return!1}return i.millerRabin(t)}function Ci(t){var e=this.subtract(s.ONE),i=e.getLowestSetBit();if(i<=0)return!1;var o=e.shiftRight(i);t=t+1>>1,t>P.length&&(t=P.length);for(var c=a(),l=0;l<t;++l){c.fromInt(P[Math.floor(Math.random()*P.length)]);var x=c.modPow(o,this);if(x.compareTo(s.ONE)!=0&&x.compareTo(e)!=0){for(var p=1;p++<i&&x.compareTo(e)!=0;)if(x=x.modPowInt(2,this),x.compareTo(s.ONE)==0)return!1;if(x.compareTo(e)!=0)return!1}}return!0}s.prototype.chunkSize=Me,s.prototype.toRadix=He,s.prototype.fromRadix=Ve,s.prototype.fromNumber=Le,s.prototype.bitwiseTo=Ze,s.prototype.changeBit=ni,s.prototype.addTo=fi,s.prototype.dMultiply=di,s.prototype.dAddOffset=gi,s.prototype.multiplyLowerTo=bi,s.prototype.multiplyUpperTo=Ti,s.prototype.modInt=Ei,s.prototype.millerRabin=Ci,s.prototype.clone=Ae,s.prototype.intValue=Re,s.prototype.byteValue=Pe,s.prototype.shortValue=Ce,s.prototype.signum=Oe,s.prototype.toByteArray=Ne,s.prototype.equals=ze,s.prototype.min=je,s.prototype.max=ke,s.prototype.and=$e,s.prototype.or=_e,s.prototype.xor=Ge,s.prototype.andNot=Ye,s.prototype.not=Ke,s.prototype.shiftLeft=Xe,s.prototype.shiftRight=We,s.prototype.getLowestSetBit=Je,s.prototype.bitCount=ei,s.prototype.testBit=ii,s.prototype.setBit=ri,s.prototype.clearBit=si,s.prototype.flipBit=oi,s.prototype.add=hi,s.prototype.subtract=ui,s.prototype.multiply=ci,s.prototype.divide=ai,s.prototype.remainder=xi,s.prototype.divideAndRemainder=pi,s.prototype.modPow=Ii,s.prototype.modInverse=Ai,s.prototype.pow=vi,s.prototype.gcd=qi,s.prototype.isProbablePrime=Pi,s.prototype.square=li,s.prototype.Barrett=it;var mt,O,I;function Mi(t){O[I++]^=t&255,O[I++]^=t>>8&255,O[I++]^=t>>16&255,O[I++]^=t>>24&255,I>=qt&&(I-=qt)}function Ht(){Mi(new Date().getTime())}if(O==null){O=new Array,I=0;var z;if(typeof window<"u"&&window.crypto){if(window.crypto.getRandomValues){var Vt=new Uint8Array(32);for(window.crypto.getRandomValues(Vt),z=0;z<32;++z)O[I++]=Vt[z]}else if(navigator.appName=="Netscape"&&navigator.appVersion<"5"){var Lt=window.crypto.random(32);for(z=0;z<Lt.length;++z)O[I++]=Lt.charCodeAt(z)&255}}for(;I<qt;)z=Math.floor(65536*Math.random()),O[I++]=z>>>8,O[I++]=z&255;I=0,Ht()}function Oi(){if(mt==null){for(Ht(),mt=Ni(),mt.init(O),I=0;I<O.length;++I)O[I]=0;I=0}return mt.next()}function Hi(t){var e;for(e=0;e<t.length;++e)t[e]=Oi()}function Nt(){}Nt.prototype.nextBytes=Hi;function It(){this.i=0,this.j=0,this.S=new Array}function Vi(t){var e,i,o;for(e=0;e<256;++e)this.S[e]=e;for(i=0,e=0;e<256;++e)i=i+this.S[e]+t[e%t.length]&255,o=this.S[e],this.S[e]=this.S[i],this.S[i]=o;this.i=0,this.j=0}function Li(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]}It.prototype.init=Vi,It.prototype.next=Li;function Ni(){return new It}var qt=256;r.exports={default:s,BigInteger:s,SecureRandom:Nt}}).call(zi)})(Yt);var St=Yt.exports;const{BigInteger:ht}=St;function ki(r){let n=r.toString(16);if(n[0]!=="-")n.length%2===1?n="0"+n:n.match(/^[0-7]/)||(n="00"+n);else{n=n.substr(1);let f=n.length;f%2===1?f+=1:n.match(/^[0-7]/)||(f+=2);let h="";for(let u=0;u<f;u++)h+="f";h=new ht(h,16),n=h.xor(r).add(ht.ONE),n=n.toString(16).replace(/^-/,"")}return n}class Kt{constructor(){this.tlv=null,this.t="00",this.l="00",this.v=""}getEncodedHex(){return this.tlv||(this.v=this.getValue(),this.l=this.getLength(),this.tlv=this.t+this.l+this.v),this.tlv}getLength(){const n=this.v.length/2;let f=n.toString(16);return f.length%2===1&&(f="0"+f),n<128?f:(128+f.length/2).toString(16)+f}getValue(){return""}}class zt extends Kt{constructor(n){super(),this.t="02",n&&(this.v=ki(n))}getValue(){return this.v}}class Zi extends Kt{constructor(n){super(),this.t="30",this.asn1Array=n}getValue(){return this.v=this.asn1Array.map(n=>n.getEncodedHex()).join(""),this.v}}function Xt(r,n){return+r[n+2]<8?1:+r.substr(n+2,2)&127+1}function jt(r,n){const f=Xt(r,n),h=r.substr(n+2,f*2);return h?(+h[0]<8?new ht(h,16):new ht(h.substr(2),16)).intValue():-1}function At(r,n){const f=Xt(r,n);return n+(f+1)*2}var Ui={encodeDer(r,n){const f=new zt(r),h=new zt(n);return new Zi([f,h]).getEncodedHex()},decodeDer(r){const n=At(r,0),f=At(r,n),h=jt(r,n),u=r.substr(f,h*2),s=f+u.length,a=At(r,s),T=jt(r,s),d=r.substr(a,T*2),B=new ht(u,16),g=new ht(d,16);return{r:B,s:g}}};const{BigInteger:C}=St,kt=new C("2"),Zt=new C("3");class K{constructor(n,f){this.x=f,this.q=n}equals(n){return n===this?!0:this.q.equals(n.q)&&this.x.equals(n.x)}toBigInteger(){return this.x}negate(){return new K(this.q,this.x.negate().mod(this.q))}add(n){return new K(this.q,this.x.add(n.toBigInteger()).mod(this.q))}subtract(n){return new K(this.q,this.x.subtract(n.toBigInteger()).mod(this.q))}multiply(n){return new K(this.q,this.x.multiply(n.toBigInteger()).mod(this.q))}divide(n){return new K(this.q,this.x.multiply(n.toBigInteger().modInverse(this.q)).mod(this.q))}square(){return new K(this.q,this.x.square().mod(this.q))}}class W{constructor(n,f,h,u){this.curve=n,this.x=f,this.y=h,this.z=u??C.ONE,this.zinv=null}getX(){return this.zinv===null&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))}getY(){return this.zinv===null&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))}equals(n){return n===this?!0:this.isInfinity()?n.isInfinity():n.isInfinity()?this.isInfinity():n.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(n.z)).mod(this.curve.q).equals(C.ZERO)?n.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(n.z)).mod(this.curve.q).equals(C.ZERO):!1}isInfinity(){return this.x===null&&this.y===null?!0:this.z.equals(C.ZERO)&&!this.y.toBigInteger().equals(C.ZERO)}negate(){return new W(this.curve,this.x,this.y.negate(),this.z)}add(n){if(this.isInfinity())return n;if(n.isInfinity())return this;const f=this.x.toBigInteger(),h=this.y.toBigInteger(),u=this.z,s=n.x.toBigInteger(),a=n.y.toBigInteger(),T=n.z,d=this.curve.q,B=f.multiply(T).mod(d),g=s.multiply(u).mod(d),m=B.subtract(g),v=h.multiply(T).mod(d),w=a.multiply(u).mod(d),y=v.subtract(w);if(C.ZERO.equals(m))return C.ZERO.equals(y)?this.twice():this.curve.infinity;const S=B.add(g),E=u.multiply(T).mod(d),A=m.square().mod(d),M=m.multiply(A).mod(d),$=E.multiply(y.square()).subtract(S.multiply(A)).mod(d),R=m.multiply($).mod(d),Q=y.multiply(A.multiply(B).subtract($)).subtract(v.multiply(M)).mod(d),J=M.multiply(E).mod(d);return new W(this.curve,this.curve.fromBigInteger(R),this.curve.fromBigInteger(Q),J)}twice(){if(this.isInfinity())return this;if(!this.y.toBigInteger().signum())return this.curve.infinity;const n=this.x.toBigInteger(),f=this.y.toBigInteger(),h=this.z,u=this.curve.q,s=this.curve.a.toBigInteger(),a=n.square().multiply(Zt).add(s.multiply(h.square())).mod(u),T=f.shiftLeft(1).multiply(h).mod(u),d=f.square().mod(u),B=d.multiply(n).multiply(h).mod(u),g=T.square().mod(u),m=a.square().subtract(B.shiftLeft(3)).mod(u),v=T.multiply(m).mod(u),w=a.multiply(B.shiftLeft(2).subtract(m)).subtract(g.shiftLeft(1).multiply(d)).mod(u),y=T.multiply(g).mod(u);return new W(this.curve,this.curve.fromBigInteger(v),this.curve.fromBigInteger(w),y)}multiply(n){if(this.isInfinity())return this;if(!n.signum())return this.curve.infinity;const f=n.multiply(Zt),h=this.negate();let u=this;for(let s=f.bitLength()-2;s>0;s--){u=u.twice();const a=f.testBit(s),T=n.testBit(s);a!==T&&(u=u.add(a?this:h))}return u}}let $i=class{constructor(n,f,h){this.q=n,this.a=this.fromBigInteger(f),this.b=this.fromBigInteger(h),this.infinity=new W(this,null,null)}equals(n){return n===this?!0:this.q.equals(n.q)&&this.a.equals(n.a)&&this.b.equals(n.b)}fromBigInteger(n){return new K(this.q,n)}decodePointHex(n){switch(parseInt(n.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:const f=this.fromBigInteger(new C(n.substr(2),16));let h=this.fromBigInteger(f.multiply(f.square()).add(f.multiply(this.a)).add(this.b).toBigInteger().modPow(this.q.divide(new C("4")).add(C.ONE),this.q));return h.toBigInteger().mod(kt).equals(new C(n.substr(0,2),16).subtract(kt))||(h=h.negate()),new W(this,f,h);case 4:case 6:case 7:const u=(n.length-2)/2,s=n.substr(2,u),a=n.substr(u+2,u);return new W(this,this.fromBigInteger(new C(s,16)),this.fromBigInteger(new C(a,16)));default:return null}}};var _i={ECPointFp:W,ECCurveFp:$i};const{BigInteger:U,SecureRandom:Gi}=St,{ECCurveFp:Yi}=_i,Ki=new Gi,{curve:ft,G:Xi,n:Ut}=Wt();function Wi(){return ft}function Wt(){const r=new U("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFF",16),n=new U("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF00000000FFFFFFFFFFFFFFFC",16),f=new U("28E9FA9E9D9F5E344D5A9E4BCF6509A7F39789F515AB8F92DDBCBD414D940E93",16),h=new Yi(r,n,f),u="32C4AE2C1F1981195F9904466A39C9948FE30BBFF2660BE1715A4589334C74C7",s="BC3736A2F4F6779C59BDCEE36B692153D0A9877CC62A474002DF32E52139F0A0",a=h.decodePointHex("04"+u+s),T=new U("FFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFF7203DF6B21C6052B53BBF40939D54123",16);return{curve:h,G:a,n:T}}function Qi(r,n,f){const u=(r?new U(r,n,f):new U(Ut.bitLength(),Ki)).mod(Ut.subtract(U.ONE)).add(U.ONE),s=lt(u.toString(16),64),a=Xi.multiply(u),T=lt(a.getX().toBigInteger().toString(16),64),d=lt(a.getY().toBigInteger().toString(16),64),B="04"+T+d;return{privateKey:s,publicKey:B}}function Ji(r){if(r.length!==130)throw new Error("Invalid public key to compress");const n=(r.length-2)/2,f=r.substr(2,n),h=new U(r.substr(n+2,n),16);let u="03";return h.mod(new U("2")).equals(U.ZERO)&&(u="02"),u+f}function tn(r){r=unescape(encodeURIComponent(r));const n=r.length,f=[];for(let u=0;u<n;u++)f[u>>>2]|=(r.charCodeAt(u)&255)<<24-u%4*8;const h=[];for(let u=0;u<n;u++){const s=f[u>>>2]>>>24-u%4*8&255;h.push((s>>>4).toString(16)),h.push((s&15).toString(16))}return h.join("")}function lt(r,n){return r.length>=n?r:new Array(n-r.length+1).join("0")+r}function en(r){return r.map(n=>(n=n.toString(16),n.length===1?"0"+n:n)).join("")}function nn(r){const n=[];let f=0;for(let h=0;h<r.length*2;h+=2)n[h>>>3]|=parseInt(r[f],10)<<24-h%8*4,f++;try{const h=[];for(let u=0;u<r.length;u++){const s=n[u>>>2]>>>24-u%4*8&255;h.push(String.fromCharCode(s))}return decodeURIComponent(escape(h.join("")))}catch{throw new Error("Malformed UTF-8 data")}}function rn(r){const n=[];let f=r.length;f%2!==0&&(r=lt(r,f+1)),f=r.length;for(let h=0;h<f;h+=2)n.push(parseInt(r.substr(h,2),16));return n}function sn(r){const n=ft.decodePointHex(r);if(!n)return!1;const f=n.getX();return n.getY().square().equals(f.multiply(f.square()).add(f.multiply(ft.a)).add(ft.b))}function on(r,n){const f=ft.decodePointHex(r);if(!f)return!1;const h=ft.decodePointHex(n);return h?f.equals(h):!1}var fn={getGlobalCurve:Wi,generateEcparam:Wt,generateKeyPairHex:Qi,compressPublicKeyHex:Ji,utf8ToHex:tn,leftPad:lt,arrayToHex:en,arrayToUtf8:nn,hexToArray:rn,verifyPublicKey:sn,comparePublicKeyHex:on};const Z=new Uint32Array(68),Rt=new Uint32Array(64);function N(r,n){const f=n&31;return r<<f|r>>>32-f}function $t(r,n){const f=[];for(let h=r.length-1;h>=0;h--)f[h]=(r[h]^n[h])&255;return f}function hn(r){return r^N(r,9)^N(r,17)}function un(r){return r^N(r,15)^N(r,23)}function Bt(r){let n=r.length*8,f=n%512;f=f>=448?512-f%448-1:448-f-1;const h=new Array((f-7)/8),u=new Array(8);for(let g=0,m=h.length;g<m;g++)h[g]=0;for(let g=0,m=u.length;g<m;g++)u[g]=0;n=n.toString(2);for(let g=7;g>=0;g--)if(n.length>8){const m=n.length-8;u[g]=parseInt(n.substr(m),2),n=n.substr(0,m)}else n.length>0&&(u[g]=parseInt(n,2),n="");const s=new Uint8Array([...r,128,...h,...u]),a=new DataView(s.buffer,0),T=s.length/64,d=new Uint32Array([1937774191,1226093241,388252375,3666478592,2842636476,372324522,3817729613,2969243214]);for(let g=0;g<T;g++){Z.fill(0),Rt.fill(0);const m=16*g;for(let F=0;F<16;F++)Z[F]=a.getUint32((m+F)*4,!1);for(let F=16;F<68;F++)Z[F]=un(Z[F-16]^Z[F-9]^N(Z[F-3],15))^N(Z[F-13],7)^Z[F-6];for(let F=0;F<64;F++)Rt[F]=Z[F]^Z[F+4];const v=2043430169,w=2055708042;let y=d[0],S=d[1],E=d[2],A=d[3],M=d[4],$=d[5],R=d[6],Q=d[7],J,xt,pt,dt,gt;for(let F=0;F<64;F++)gt=F>=0&&F<=15?v:w,J=N(N(y,12)+M+N(gt,F),7),xt=J^N(y,12),pt=(F>=0&&F<=15?y^S^E:y&S|y&E|S&E)+A+xt+Rt[F],dt=(F>=0&&F<=15?M^$^R:M&$|~M&R)+Q+J+Z[F],A=E,E=N(S,9),S=y,y=pt,Q=R,R=N($,19),$=M,M=hn(dt);d[0]^=y,d[1]^=S,d[2]^=E,d[3]^=A,d[4]^=M,d[5]^=$,d[6]^=R,d[7]^=Q}const B=[];for(let g=0,m=d.length;g<m;g++){const v=d[g];B.push((v&4278190080)>>>24,(v&16711680)>>>16,(v&65280)>>>8,v&255)}return B}const at=64,Qt=new Uint8Array(at),Jt=new Uint8Array(at);for(let r=0;r<at;r++)Qt[r]=54,Jt[r]=92;function cn(r,n){for(n.length>at&&(n=Bt(n));n.length<at;)n.push(0);const f=$t(n,Qt),h=$t(n,Jt),u=Bt([...f,...r]);return Bt([...h,...u])}var te={sm3:Bt,hmac:cn};const{BigInteger:V}=St,{encodeDer:ln,decodeDer:an}=Ui,b=fn,ut=te.sm3,{G:rt,curve:ee,n:st}=b.generateEcparam(),ie=0;function xn(r,n,f=1){r=typeof r=="string"?b.hexToArray(b.utf8ToHex(r)):Array.prototype.slice.call(r),n=b.getGlobalCurve().decodePointHex(n);const h=b.generateKeyPairHex(),u=new V(h.privateKey,16);let s=h.publicKey;s.length>128&&(s=s.substr(s.length-128));const a=n.multiply(u),T=b.hexToArray(b.leftPad(a.getX().toBigInteger().toRadix(16),64)),d=b.hexToArray(b.leftPad(a.getY().toBigInteger().toRadix(16),64)),B=b.arrayToHex(ut([].concat(T,r,d)));let g=1,m=0,v=[];const w=[].concat(T,d),y=()=>{v=ut([...w,g>>24&255,g>>16&255,g>>8&255,g&255]),g++,m=0};y();for(let E=0,A=r.length;E<A;E++)m===v.length&&y(),r[E]^=v[m++]&255;const S=b.arrayToHex(r);return f===ie?s+S+B:s+B+S}function pn(r,n,f=1,{output:h="string"}={}){n=new V(n,16);let u=r.substr(128,64),s=r.substr(128+64);f===ie&&(u=r.substr(r.length-64),s=r.substr(128,r.length-128-64));const a=b.hexToArray(s),d=b.getGlobalCurve().decodePointHex("04"+r.substr(0,128)).multiply(n),B=b.hexToArray(b.leftPad(d.getX().toBigInteger().toRadix(16),64)),g=b.hexToArray(b.leftPad(d.getY().toBigInteger().toRadix(16),64));let m=1,v=0,w=[];const y=[].concat(B,g),S=()=>{w=ut([...y,m>>24&255,m>>16&255,m>>8&255,m&255]),m++,v=0};S();for(let A=0,M=a.length;A<M;A++)v===w.length&&S(),a[A]^=w[v++]&255;return b.arrayToHex(ut([].concat(B,a,g)))===u.toLowerCase()?h==="array"?a:b.arrayToUtf8(a):h==="array"?[]:""}function dn(r,n,{pointPool:f,der:h,hash:u,publicKey:s,userId:a}={}){let T=typeof r=="string"?b.utf8ToHex(r):b.arrayToHex(r);u&&(s=s||re(n),T=ne(T,s,a));const d=new V(n,16),B=new V(T,16);let g=null,m=null,v=null;do{do{let w;f&&f.length?w=f.pop():w=se(),g=w.k,m=B.add(w.x1).mod(st)}while(m.equals(V.ZERO)||m.add(g).equals(st));v=d.add(V.ONE).modInverse(st).multiply(g.subtract(m.multiply(d))).mod(st)}while(v.equals(V.ZERO));return h?ln(m,v):b.leftPad(m.toString(16),64)+b.leftPad(v.toString(16),64)}function gn(r,n,f,{der:h,hash:u,userId:s}={}){let a=typeof r=="string"?b.utf8ToHex(r):b.arrayToHex(r);u&&(a=ne(a,f,s));let T,d;if(h){const y=an(n);T=y.r,d=y.s}else T=new V(n.substring(0,64),16),d=new V(n.substring(64),16);const B=ee.decodePointHex(f),g=new V(a,16),m=T.add(d).mod(st);if(m.equals(V.ZERO))return!1;const v=rt.multiply(d).add(B.multiply(m)),w=g.add(v.getX().toBigInteger()).mod(st);return T.equals(w)}function ne(r,n,f="1234567812345678"){f=b.utf8ToHex(f);const h=b.leftPad(rt.curve.a.toBigInteger().toRadix(16),64),u=b.leftPad(rt.curve.b.toBigInteger().toRadix(16),64),s=b.leftPad(rt.getX().toBigInteger().toRadix(16),64),a=b.leftPad(rt.getY().toBigInteger().toRadix(16),64);let T,d;if(n.length===128)T=n.substr(0,64),d=n.substr(64,64);else{const v=rt.curve.decodePointHex(n);T=b.leftPad(v.getX().toBigInteger().toRadix(16),64),d=b.leftPad(v.getY().toBigInteger().toRadix(16),64)}const B=b.hexToArray(f+h+u+s+a+T+d),g=f.length*4;B.unshift(g&255),B.unshift(g>>8&255);const m=ut(B);return b.arrayToHex(ut(m.concat(b.hexToArray(r))))}function re(r){const n=rt.multiply(new V(r,16)),f=b.leftPad(n.getX().toBigInteger().toString(16),64),h=b.leftPad(n.getY().toBigInteger().toString(16),64);return"04"+f+h}function se(){const r=b.generateKeyPairHex(),n=ee.decodePointHex(r.publicKey);return r.k=new V(r.privateKey,16),r.x1=n.getX().toBigInteger(),r}var mn={generateKeyPairHex:b.generateKeyPairHex,compressPublicKeyHex:b.compressPublicKeyHex,comparePublicKeyHex:b.comparePublicKeyHex,doEncrypt:xn,doDecrypt:pn,doSignature:dn,doVerifySignature:gn,getPublicKeyFromPrivateKey:re,getPoint:se,verifyPublicKey:b.verifyPublicKey};const{sm3:yn,hmac:vn}=te;function bn(r,n){return r.length>=n?r:new Array(n-r.length+1).join("0")+r}function _t(r){return r.map(n=>(n=n.toString(16),n.length===1?"0"+n:n)).join("")}function Tn(r){const n=[];let f=r.length;f%2!==0&&(r=bn(r,f+1)),f=r.length;for(let h=0;h<f;h+=2)n.push(parseInt(r.substr(h,2),16));return n}function wn(r){const n=[];for(let f=0,h=r.length;f<h;f++){const u=r.codePointAt(f);if(u<=127)n.push(u);else if(u<=2047)n.push(192|u>>>6),n.push(128|u&63);else if(u<=55295||u>=57344&&u<=65535)n.push(224|u>>>12),n.push(128|u>>>6&63),n.push(128|u&63);else if(u>=65536&&u<=1114111)f++,n.push(240|u>>>18&28),n.push(128|u>>>12&63),n.push(128|u>>>6&63),n.push(128|u&63);else throw n.push(u),new Error("input is not supported")}return n}var Fn=function(r,n){if(r=typeof r=="string"?wn(r):Array.prototype.slice.call(r),n){if((n.mode||"hmac")!=="hmac")throw new Error("invalid mode");let h=n.key;if(!h)throw new Error("invalid key");return h=typeof h=="string"?Tn(h):Array.prototype.slice.call(h),_t(vn(r,h))}return _t(yn(r))};const Y=0,Bn=32,nt=16,bt=[214,144,233,254,204,225,61,183,22,182,20,194,40,251,44,5,43,103,154,118,42,190,4,195,170,68,19,38,73,134,6,153,156,66,80,244,145,239,152,122,51,84,11,67,237,207,172,98,228,179,28,169,201,8,232,149,128,223,148,250,117,143,63,166,71,7,167,252,243,115,23,186,131,89,60,25,230,133,79,168,104,107,129,178,113,100,218,139,248,235,15,75,112,86,157,53,30,36,14,94,99,88,209,162,37,34,124,59,1,33,120,135,212,0,70,87,159,211,39,82,76,54,2,231,160,196,200,158,234,191,138,210,64,199,56,181,163,247,242,206,249,97,21,161,224,174,93,164,155,52,26,85,173,147,50,48,245,140,177,227,29,246,226,46,130,102,202,96,192,41,35,171,13,83,78,111,213,219,55,69,222,253,142,47,3,255,106,114,109,108,91,81,141,27,175,146,187,221,188,127,17,217,92,65,31,16,90,216,10,193,49,136,165,205,123,189,45,116,208,18,184,229,180,176,137,105,151,74,12,150,119,126,101,185,241,9,197,110,198,132,24,240,125,236,58,220,77,32,121,238,95,62,215,203,57,72],Tt=[462357,472066609,943670861,1415275113,1886879365,2358483617,2830087869,3301692121,3773296373,4228057617,404694573,876298825,1347903077,1819507329,2291111581,2762715833,3234320085,3705924337,4177462797,337322537,808926789,1280531041,1752135293,2223739545,2695343797,3166948049,3638552301,4110090761,269950501,741554753,1213159005,1684763257];function Pt(r){const n=[];for(let f=0,h=r.length;f<h;f+=2)n.push(parseInt(r.substr(f,2),16));return n}function Sn(r){return r.map(n=>(n=n.toString(16),n.length===1?"0"+n:n)).join("")}function Dn(r){const n=[];for(let f=0,h=r.length;f<h;f++){const u=r.codePointAt(f);if(u<=127)n.push(u);else if(u<=2047)n.push(192|u>>>6),n.push(128|u&63);else if(u<=55295||u>=57344&&u<=65535)n.push(224|u>>>12),n.push(128|u>>>6&63),n.push(128|u&63);else if(u>=65536&&u<=1114111)f++,n.push(240|u>>>18&28),n.push(128|u>>>12&63),n.push(128|u>>>6&63),n.push(128|u&63);else throw n.push(u),new Error("input is not supported")}return n}function In(r){const n=[];for(let f=0,h=r.length;f<h;f++)r[f]>=240&&r[f]<=247?(n.push(String.fromCodePoint(((r[f]&7)<<18)+((r[f+1]&63)<<12)+((r[f+2]&63)<<6)+(r[f+3]&63))),f+=3):r[f]>=224&&r[f]<=239?(n.push(String.fromCodePoint(((r[f]&15)<<12)+((r[f+1]&63)<<6)+(r[f+2]&63))),f+=2):r[f]>=192&&r[f]<=223?(n.push(String.fromCodePoint(((r[f]&31)<<6)+(r[f+1]&63))),f++):n.push(String.fromCodePoint(r[f]));return n.join("")}function ot(r,n){const f=n&31;return r<<f|r>>>32-f}function X(r){return(bt[r>>>24&255]&255)<<24|(bt[r>>>16&255]&255)<<16|(bt[r>>>8&255]&255)<<8|bt[r&255]&255}function wt(r){return r^ot(r,2)^ot(r,10)^ot(r,18)^ot(r,24)}function Ft(r){return r^ot(r,13)^ot(r,23)}function qn(r,n,f){const h=new Array(4),u=new Array(4);for(let s=0;s<4;s++)u[0]=r[4*s]&255,u[1]=r[4*s+1]&255,u[2]=r[4*s+2]&255,u[3]=r[4*s+3]&255,h[s]=u[0]<<24|u[1]<<16|u[2]<<8|u[3];for(let s=0,a;s<32;s+=4)a=h[1]^h[2]^h[3]^f[s+0],h[0]^=wt(X(a)),a=h[2]^h[3]^h[0]^f[s+1],h[1]^=wt(X(a)),a=h[3]^h[0]^h[1]^f[s+2],h[2]^=wt(X(a)),a=h[0]^h[1]^h[2]^f[s+3],h[3]^=wt(X(a));for(let s=0;s<16;s+=4)n[s]=h[3-s/4]>>>24&255,n[s+1]=h[3-s/4]>>>16&255,n[s+2]=h[3-s/4]>>>8&255,n[s+3]=h[3-s/4]&255}function En(r,n,f){const h=new Array(4),u=new Array(4);for(let s=0;s<4;s++)u[0]=r[0+4*s]&255,u[1]=r[1+4*s]&255,u[2]=r[2+4*s]&255,u[3]=r[3+4*s]&255,h[s]=u[0]<<24|u[1]<<16|u[2]<<8|u[3];h[0]^=2746333894,h[1]^=1453994832,h[2]^=1736282519,h[3]^=2993693404;for(let s=0,a;s<32;s+=4)a=h[1]^h[2]^h[3]^Tt[s+0],n[s+0]=h[0]^=Ft(X(a)),a=h[2]^h[3]^h[0]^Tt[s+1],n[s+1]=h[1]^=Ft(X(a)),a=h[3]^h[0]^h[1]^Tt[s+2],n[s+2]=h[2]^=Ft(X(a)),a=h[0]^h[1]^h[2]^Tt[s+3],n[s+3]=h[3]^=Ft(X(a));if(f===Y)for(let s=0,a;s<16;s++)a=n[s],n[s]=n[31-s],n[31-s]=a}function Gt(r,n,f,{padding:h="pkcs#7",mode:u,iv:s=[],output:a="string"}={}){if(u==="cbc"&&(typeof s=="string"&&(s=Pt(s)),s.length!==128/8))throw new Error("iv is invalid");if(typeof n=="string"&&(n=Pt(n)),n.length!==128/8)throw new Error("key is invalid");if(typeof r=="string"?f!==Y?r=Dn(r):r=Pt(r):r=[...r],(h==="pkcs#5"||h==="pkcs#7")&&f!==Y){const v=nt-r.length%nt;for(let w=0;w<v;w++)r.push(v)}const T=new Array(Bn);En(n,T,f);const d=[];let B=s,g=r.length,m=0;for(;g>=nt;){const v=r.slice(m,m+16),w=new Array(16);if(u==="cbc")for(let y=0;y<nt;y++)f!==Y&&(v[y]^=B[y]);qn(v,w,T);for(let y=0;y<nt;y++)u==="cbc"&&f===Y&&(w[y]^=B[y]),d[m+y]=w[y];u==="cbc"&&(f!==Y?B=w:B=v),g-=nt,m+=nt}if((h==="pkcs#5"||h==="pkcs#7")&&f===Y){const v=d.length,w=d[v-1];for(let y=1;y<=w;y++)if(d[v-y]!==w)throw new Error("padding is invalid");d.splice(v-w,w)}return a!=="array"?f!==Y?Sn(d):In(d):d}var An={encrypt(r,n,f){return Gt(r,n,1,f)},decrypt(r,n,f){return Gt(r,n,0,f)}},Rn={sm2:mn,sm3:Fn,sm4:An};const Mn=ji(Rn);export{Mn as c};