/*! for license information please see jsencrypt.min.js.license.txt */ !function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e():"function"==typeof define&&define.amd?define([],e):"object"==typeof exports?exports.jsencrypt=e():t.jsencrypt=e()}(window,(()=>(()=>{var t={155:t=>{var e,i,r=t.exports={};function n(){throw new error("settimeout has not been defined")}function s(){throw new error("cleartimeout has not been defined")}function o(t){if(e===settimeout)return settimeout(t,0);if((e===n||!e)&&settimeout)return e=settimeout,settimeout(t,0);try{return e(t,0)}catch(i){try{return e.call(null,t,0)}catch(i){return e.call(this,t,0)}}}!function(){try{e="function"==typeof settimeout?settimeout:n}catch(t){e=n}try{i="function"==typeof cleartimeout?cleartimeout:s}catch(t){i=s}}();var h,a=[],u=!1,c=-1;function f(){u&&h&&(u=!1,h.length?a=h.concat(a):c=-1,a.length&&l())}function l(){if(!u){var t=o(f);u=!0;for(var e=a.length;e;){for(h=a,a=[];++c1)for(var i=1;i{for(var r in e)i.o(e,r)&&!i.o(t,r)&&object.defineproperty(t,r,{enumerable:!0,get:e[r]})},i.o=(t,e)=>object.prototype.hasownproperty.call(t,e);var r={};return(()=>{"use strict";i.d(r,{default:()=>ct});var t="0123456789abcdefghijklmnopqrstuvwxyz";function e(e){return t.charat(e)}function n(t,e){return t&e}function s(t,e){return t|e}function o(t,e){return t^e}function h(t,e){return t&~e}function a(t){if(0==t)return-1;var e=0;return 0==(65535&t)&&(t>>=16,e+=16),0==(255&t)&&(t>>=8,e+=8),0==(15&t)&&(t>>=4,e+=4),0==(3&t)&&(t>>=2,e+=2),0==(1&t)&&++e,e}function u(t){for(var e=0;0!=t;)t&=t-1,++e;return e}var c,f="abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789+/",l="=";function p(t){var e,i,r="";for(e=0;e+3<=t.length;e+=3)i=parseint(t.substring(e,e+3),16),r+=f.charat(i>>6)+f.charat(63&i);for(e+1==t.length?(i=parseint(t.substring(e,e+1),16),r+=f.charat(i<<2)):e+2==t.length&&(i=parseint(t.substring(e,e+2),16),r+=f.charat(i>>2)+f.charat((3&i)<<4));(3&r.length)>0;)r+=l;return r}function g(t){var i,r="",n=0,s=0;for(i=0;i>2),s=3&o,n=1):1==n?(r+=e(s<<2|o>>4),s=15&o,n=2):2==n?(r+=e(s),r+=e(o>>2),s=3&o,n=3):(r+=e(s<<2|o>>4),r+=e(15&o),n=0))}return 1==n&&(r+=e(s<<2)),r}var d,v={decode:function(t){var e;if(void 0===d){var i="= \f\n\r\t \u2028\u2029";for(d=object.create(null),e=0;e<64;++e)d["abcdefghijklmnopqrstuvwxyzabcdefghijklmnopqrstuvwxyz0123456789+/".charat(e)]=e;for(d["-"]=62,d._=63,e=0;e=4?(r[r.length]=n>>16,r[r.length]=n>>8&255,r[r.length]=255&n,n=0,s=0):n<<=6}}switch(s){case 1:throw new error("base64 encoding incomplete: at least 2 bits missing");case 2:r[r.length]=n>>10;break;case 3:r[r.length]=n>>16,r[r.length]=n>>8&255}return r},re:/-----begin [^-]+-----([a-za-z0-9+\/=\s]+)-----end [^-]+-----|begin-base64[^\n]+\n([a-za-z0-9+\/=\s]+)====/,unarmor:function(t){var e=v.re.exec(t);if(e)if(e[1])t=e[1];else{if(!e[2])throw new error("regexp out of sync");t=e[2]}return v.decode(t)}},m=1e13,y=function(){function t(t){this.buf=[+t||0]}return t.prototype.muladd=function(t,e){var i,r,n=this.buf,s=n.length;for(i=0;i0&&(n[i]=e)},t.prototype.sub=function(t){var e,i,r=this.buf,n=r.length;for(e=0;e=0;--r)i+=(m+e[r]).tostring().substring(1);return i},t.prototype.valueof=function(){for(var t=this.buf,e=0,i=t.length-1;i>=0;--i)e=e*m+t[i];return e},t.prototype.simplify=function(){var t=this.buf;return 1==t.length?t[0]:this},t}(),b="…",t=/^(\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/,s=/^(\d\d\d\d)(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])([01]\d|2[0-3])(?:([0-5]\d)(?:([0-5]\d)(?:[.,](\d{1,3}))?)?)?(z|[-+](?:[0]\d|1[0-2])([0-5]\d)?)?$/;function e(t,e){return t.length>e&&(t=t.substring(0,e)+b),t}var w,d=function(){function t(e,i){this.hexdigits="0123456789abcdef",e instanceof t?(this.enc=e.enc,this.pos=e.pos):(this.enc=e,this.pos=i)}return t.prototype.get=function(t){if(void 0===t&&(t=this.pos++),t>=this.enc.length)throw new error("requesting byte offset ".concat(t," on a stream of length ").concat(this.enc.length));return"string"==typeof this.enc?this.enc.charcodeat(t):this.enc[t]},t.prototype.hexbyte=function(t){return this.hexdigits.charat(t>>4&15)+this.hexdigits.charat(15&t)},t.prototype.hexdump=function(t,e,i){for(var r="",n=t;n176)return!1}return!0},t.prototype.parsestringiso=function(t,e){for(var i="",r=t;r191&&n<224?string.fromcharcode((31&n)<<6|63&this.get(r++)):string.fromcharcode((15&n)<<12|(63&this.get(r++))<<6|63&this.get(r++))}return i},t.prototype.parsestringbmp=function(t,e){for(var i,r,n="",s=t;s127,s=n?255:0,o="";r==s&&++t4){for(o=r,i<<=3;0==(128&(+o^s));)o=+o<<1,--i;o="("+i+" bit)\n"}n&&(r-=256);for(var h=new y(r),a=t+1;a=a;--u)s+=h>>u&1?"1":"0";if(s.length>i)return n+e(s,i)}return n+s},t.prototype.parseoctetstring=function(t,e,i){if(this.isascii(t,e))return e(this.parsestringiso(t,e),i);var r=e-t,n="("+r+" byte)\n";r>(i/=2)&&(e=t+i);for(var s=t;si&&(n+=b),n},t.prototype.parseoid=function(t,e,i){for(var r="",n=new y,s=0,o=t;oi)return e(r,i);n=new y,s=0}}return s>0&&(r+=".incomplete"),r},t}(),x=function(){function t(t,e,i,r,n){if(!(r instanceof r))throw new error("invalid tag value.");this.stream=t,this.header=e,this.length=i,this.tag=r,this.sub=n}return t.prototype.typename=function(){switch(this.tag.tagclass){case 0:switch(this.tag.tagnumber){case 0:return"eoc";case 1:return"boolean";case 2:return"integer";case 3:return"bit_string";case 4:return"octet_string";case 5:return"null";case 6:return"object_identifier";case 7:return"objectdescriptor";case 8:return"external";case 9:return"real";case 10:return"enumerated";case 11:return"embedded_pdv";case 12:return"utf8string";case 16:return"sequence";case 17:return"set";case 18:return"numericstring";case 19:return"printablestring";case 20:return"teletexstring";case 21:return"videotexstring";case 22:return"ia5string";case 23:return"utctime";case 24:return"generalizedtime";case 25:return"graphicstring";case 26:return"visiblestring";case 27:return"generalstring";case 28:return"universalstring";case 30:return"bmpstring"}return"universal_"+this.tag.tagnumber.tostring();case 1:return"application_"+this.tag.tagnumber.tostring();case 2:return"["+this.tag.tagnumber.tostring()+"]";case 3:return"private_"+this.tag.tagnumber.tostring()}},t.prototype.content=function(t){if(void 0===this.tag)return null;void 0===t&&(t=1/0);var e=this.poscontent(),i=math.abs(this.length);if(!this.tag.isuniversal())return null!==this.sub?"("+this.sub.length+" elem)":this.stream.parseoctetstring(e,e+i,t);switch(this.tag.tagnumber){case 1:return 0===this.stream.get(e)?"false":"true";case 2:return this.stream.parseinteger(e,e+i);case 3:return this.sub?"("+this.sub.length+" elem)":this.stream.parsebitstring(e,e+i,t);case 4:return this.sub?"("+this.sub.length+" elem)":this.stream.parseoctetstring(e,e+i,t);case 6:return this.stream.parseoid(e,e+i,t);case 16:case 17:return null!==this.sub?"("+this.sub.length+" elem)":"(no elem)";case 12:return e(this.stream.parsestringutf(e,e+i),t);case 18:case 19:case 20:case 21:case 22:case 26:return e(this.stream.parsestringiso(e,e+i),t);case 30:return e(this.stream.parsestringbmp(e,e+i),t);case 23:case 24:return this.stream.parsetime(e,e+i,23==this.tag.tagnumber)}return null},t.prototype.tostring=function(){return this.typename()+"@"+this.stream.pos+"[header:"+this.header+",length:"+this.length+",sub:"+(null===this.sub?"null":this.sub.length)+"]"},t.prototype.toprettystring=function(t){void 0===t&&(t="");var e=t+this.typename()+" @"+this.stream.pos;if(this.length>=0&&(e+="+"),e+=this.length,this.tag.tagconstructed?e+=" (constructed)":!this.tag.isuniversal()||3!=this.tag.tagnumber&&4!=this.tag.tagnumber||null===this.sub||(e+=" (encapsulates)"),e+="\n",null!==this.sub){t+=" ";for(var i=0,r=this.sub.length;i6)throw new error("length over 48 bits not supported at position "+(t.pos-1));if(0===i)return null;e=0;for(var r=0;r>6,this.tagconstructed=0!=(32&e),this.tagnumber=31&e,31==this.tagnumber){var i=new y;do{e=t.get(),i.muladd(128,127&e)}while(128&e);this.tagnumber=i.simplify()}}return t.prototype.isuniversal=function(){return 0===this.tagclass},t.prototype.iseoc=function(){return 0===this.tagclass&&0===this.tagnumber},t}(),b=[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],o=(1<<26)/b[b.length-1],a=function(){function t(t,e,i){null!=t&&("number"==typeof t?this.fromnumber(t,e,i):null==e&&"string"!=typeof t?this.fromstring(t,256):this.fromstring(t,e))}return t.prototype.tostring=function(t){if(this.s<0)return"-"+this.negate().tostring(t);var i;if(16==t)i=4;else if(8==t)i=3;else if(2==t)i=1;else if(32==t)i=5;else{if(4!=t)return this.toradix(t);i=2}var r,n=(1<0)for(a>a)>0&&(s=!0,o=e(r));h>=0;)a>(a+=this.db-i)):(r=this[h]>>(a-=i)&n,a<=0&&(a+=this.db,--h)),r>0&&(s=!0),s&&(o+=e(r));return s?o:"0"},t.prototype.negate=function(){var e=m();return t.zero.subto(this,e),e},t.prototype.abs=function(){return this.s<0?this.negate():this},t.prototype.compareto=function(t){var e=this.s-t.s;if(0!=e)return e;var i=this.t;if(0!=(e=i-t.t))return this.s<0?-e:e;for(;--i>=0;)if(0!=(e=this[i]-t[i]))return e;return 0},t.prototype.bitlength=function(){return this.t<=0?0:this.db*(this.t-1)+k(this[this.t-1]^this.s&this.dm)},t.prototype.mod=function(e){var i=m();return this.abs().divremto(e,null,i),this.s<0&&i.compareto(t.zero)>0&&e.subto(i,i),i},t.prototype.modpowint=function(t,e){var i;return i=t<256||e.iseven()?new i(e):new n(e),this.exp(t,i)},t.prototype.clone=function(){var t=m();return this.copyto(t),t},t.prototype.intvalue=function(){if(this.s<0){if(1==this.t)return this[0]-this.dv;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.db)-1)<>24},t.prototype.shortvalue=function(){return 0==this.t?this.s:this[0]<<16>>16},t.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},t.prototype.tobytearray=function(){var t=this.t,e=[];e[0]=this.s;var i,r=this.db-t*this.db%8,n=0;if(t-- >0)for(r>r)!=(this.s&this.dm)>>r&&(e[n++]=i|this.s<=0;)r<8?(i=(this[t]&(1<>(r+=this.db-8)):(i=this[t]>>(r-=8)&255,r<=0&&(r+=this.db,--t)),0!=(128&i)&&(i|=-256),0==n&&(128&this.s)!=(128&i)&&++n,(n>0||i!=this.s)&&(e[n++]=i);return e},t.prototype.equals=function(t){return 0==this.compareto(t)},t.prototype.min=function(t){return this.compareto(t)<0?this:t},t.prototype.max=function(t){return this.compareto(t)>0?this:t},t.prototype.and=function(t){var e=m();return this.bitwiseto(t,n,e),e},t.prototype.or=function(t){var e=m();return this.bitwiseto(t,s,e),e},t.prototype.xor=function(t){var e=m();return this.bitwiseto(t,o,e),e},t.prototype.andnot=function(t){var e=m();return this.bitwiseto(t,h,e),e},t.prototype.not=function(){for(var t=m(),e=0;e=this.t?0!=this.s:0!=(this[e]&1<1){var c=m();for(r.sqrto(o[1],c);h<=u;)o[h]=m(),r.multo(c,o[h-2],o[h]),h+=2}var f,l,p=t.t-1,g=!0,d=m();for(n=k(t[p])-1;p>=0;){for(n>=a?f=t[p]>>n-a&u:(f=(t[p]&(1<0&&(f|=t[p-1]>>this.db+n-a)),h=i;0==(1&f);)f>>=1,--h;if((n-=h)<0&&(n+=this.db,--p),g)o[f].copyto(s),g=!1;else{for(;h>1;)r.sqrto(s,d),r.sqrto(d,s),h-=2;h>0?r.sqrto(s,d):(l=s,s=d,d=l),r.multo(d,o[f],s)}for(;p>=0&&0==(t[p]&1<=0?(r.subto(n,r),i&&s.subto(h,s),o.subto(a,o)):(n.subto(r,n),i&&h.subto(s,h),a.subto(o,a))}return 0!=n.compareto(t.one)?t.zero:a.compareto(e)>=0?a.subtract(e):a.signum()<0?(a.addto(e,a),a.signum()<0?a.add(e):a):a},t.prototype.pow=function(t){return this.exp(t,new v)},t.prototype.gcd=function(t){var e=this.s<0?this.negate():this.clone(),i=t.s<0?t.negate():t.clone();if(e.compareto(i)<0){var r=e;e=i,i=r}var n=e.getlowestsetbit(),s=i.getlowestsetbit();if(s<0)return e;for(n0&&(e.rshiftto(s,e),i.rshiftto(s,i));e.signum()>0;)(n=e.getlowestsetbit())>0&&e.rshiftto(n,e),(n=i.getlowestsetbit())>0&&i.rshiftto(n,i),e.compareto(i)>=0?(e.subto(i,e),e.rshiftto(1,e)):(i.subto(e,i),i.rshiftto(1,i));return s>0&&i.lshiftto(s,i),i},t.prototype.isprobableprime=function(t){var e,i=this.abs();if(1==i.t&&i[0]<=b[b.length-1]){for(e=0;e=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s},t.prototype.fromint=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},t.prototype.fromstring=function(e,i){var r;if(16==i)r=4;else if(8==i)r=3;else if(256==i)r=8;else if(2==i)r=1;else if(32==i)r=5;else{if(4!=i)return void this.fromradix(e,i);r=2}this.t=0,this.s=0;for(var n=e.length,s=!1,o=0;--n>=0;){var h=8==r?255&+e[n]:f(e,n);h<0?"-"==e.charat(n)&&(s=!0):(s=!1,0==o?this[this.t++]=h:o+r>this.db?(this[this.t-1]|=(h&(1<>this.db-o):this[this.t-1]|=h<=this.db&&(o-=this.db))}8==r&&0!=(128&+e[0])&&(this.s=-1,o>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==t;)--this.t},t.prototype.dlshiftto=function(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},t.prototype.drshiftto=function(t,e){for(var i=t;i=0;--h)e[h+s+1]=this[h]>>r|o,o=(this[h]&n)<=0;--h)e[h]=0;e[s]=o,e.t=this.t+s+1,e.s=this.s,e.clamp()},t.prototype.rshiftto=function(t,e){e.s=this.s;var i=math.floor(t/this.db);if(i>=this.t)e.t=0;else{var r=t%this.db,n=this.db-r,s=(1<>r;for(var o=i+1;o>r;r>0&&(e[this.t-i-1]|=(this.s&s)<>=this.db;if(t.t>=this.db;r+=this.s}else{for(r+=this.s;i>=this.db;r-=t.s}e.s=r<0?-1:0,r<-1?e[i++]=this.dv+r:r>0&&(e[i++]=r),e.t=i,e.clamp()},t.prototype.multiplyto=function(e,i){var r=this.abs(),n=e.abs(),s=r.t;for(i.t=s+n.t;--s>=0;)i[s]=0;for(s=0;s=0;)t[i]=0;for(i=0;i=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()},t.prototype.divremto=function(e,i,r){var n=e.abs();if(!(n.t<=0)){var s=this.abs();if(s.t0?(n.lshiftto(u,o),s.lshiftto(u,r)):(n.copyto(o),s.copyto(r));var c=o.t,f=o[c-1];if(0!=f){var l=f*(1<1?o[c-2]>>this.f2:0),p=this.fv/l,g=(1<=0&&(r[r.t++]=1,r.subto(y,r)),t.one.dlshiftto(c,y),y.subto(o,o);o.t=0;){var b=r[--v]==f?this.dm:math.floor(r[v]*p+(r[v-1]+d)*g);if((r[v]+=o.am(0,b,r,m,0,c))0&&r.rshiftto(u,r),h<0&&t.zero.subto(r,r)}}},t.prototype.invdigit=function(){if(this.t<1)return 0;var t=this[0];if(0==(1&t))return 0;var e=3&t;return(e=(e=(e=(e=e*(2-(15&t)*e)&15)*(2-(255&t)*e)&255)*(2-((65535&t)*e&65535))&65535)*(2-t*e%this.dv)%this.dv)>0?this.dv-e:-e},t.prototype.iseven=function(){return 0==(this.t>0?1&this[0]:this.s)},t.prototype.exp=function(e,i){if(e>4294967295||e<1)return t.one;var r=m(),n=m(),s=i.convert(this),o=k(e)-1;for(s.copyto(r);--o>=0;)if(i.sqrto(r,n),(e&1<0)i.multo(n,s,r);else{var h=r;r=n,n=h}return i.revert(r)},t.prototype.chunksize=function(t){return math.floor(math.ln2*this.db/math.log(t))},t.prototype.toradix=function(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var e=this.chunksize(t),i=math.pow(t,e),r=u(i),n=m(),s=m(),o="";for(this.divremto(r,n,s);n.signum()>0;)o=(i+s.intvalue()).tostring(t).substr(1)+o,n.divremto(r,n,s);return s.intvalue().tostring(t)+o},t.prototype.fromradix=function(e,i){this.fromint(0),null==i&&(i=10);for(var r=this.chunksize(i),n=math.pow(i,r),s=!1,o=0,h=0,a=0;a=r&&(this.dmultiply(n),this.daddoffset(h,0),o=0,h=0))}o>0&&(this.dmultiply(math.pow(i,o)),this.daddoffset(h,0)),s&&t.zero.subto(this,this)},t.prototype.fromnumber=function(e,i,r){if("number"==typeof i)if(e<2)this.fromint(1);else for(this.fromnumber(e,r),this.testbit(e-1)||this.bitwiseto(t.one.shiftleft(e-1),s,this),this.iseven()&&this.daddoffset(1,0);!this.isprobableprime(i);)this.daddoffset(2,0),this.bitlength()>e&&this.subto(t.one.shiftleft(e-1),this);else{var n=[],o=7&e;n.length=1+(e>>3),i.nextbytes(n),o>0?n[0]&=(1<>=this.db;if(t.t>=this.db;r+=this.s}else{for(r+=this.s;i>=this.db;r+=t.s}e.s=r<0?-1:0,r>0?e[i++]=r:r<-1&&(e[i++]=this.dv+r),e.t=i,e.clamp()},t.prototype.dmultiply=function(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},t.prototype.daddoffset=function(t,e){if(0!=t){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]}},t.prototype.multiplylowerto=function(t,e,i){var r=math.min(this.t+t.t,e);for(i.s=0,i.t=r;r>0;)i[--r]=0;for(var n=i.t-this.t;r=0;)i[r]=0;for(r=math.max(e-this.t,0);r0)if(0==e)i=this[0]%t;else for(var r=this.t-1;r>=0;--r)i=(e*i+this[r])%t;return i},t.prototype.millerrabin=function(e){var i=this.subtract(t.one),r=i.getlowestsetbit();if(r<=0)return!1;var n=i.shiftright(r);(e=e+1>>1)>b.length&&(e=b.length);for(var s=m(),o=0;o0&&(i.rshiftto(o,i),r.rshiftto(o,r));var h=function(){(s=i.getlowestsetbit())>0&&i.rshiftto(s,i),(s=r.getlowestsetbit())>0&&r.rshiftto(s,r),i.compareto(r)>=0?(i.subto(r,i),i.rshiftto(1,i)):(r.subto(i,r),r.rshiftto(1,r)),i.signum()>0?settimeout(h,0):(o>0&&r.lshiftto(o,r),settimeout((function(){e(r)}),0))};settimeout(h,10)}},t.prototype.fromnumberasync=function(e,i,r,n){if("number"==typeof i)if(e<2)this.fromint(1);else{this.fromnumber(e,r),this.testbit(e-1)||this.bitwiseto(t.one.shiftleft(e-1),s,this),this.iseven()&&this.daddoffset(1,0);var o=this,h=function(){o.daddoffset(2,0),o.bitlength()>e&&o.subto(t.one.shiftleft(e-1),o),o.isprobableprime(i)?settimeout((function(){n()}),0):settimeout(h,0)};settimeout(h,0)}else{var a=[],u=7&e;a.length=1+(e>>3),i.nextbytes(a),u>0?a[0]&=(1<=0?t.mod(this.m):t},t.prototype.revert=function(t){return t},t.prototype.reduce=function(t){t.divremto(this.m,null,t)},t.prototype.multo=function(t,e,i){t.multiplyto(e,i),this.reduce(i)},t.prototype.sqrto=function(t,e){t.squareto(e),this.reduce(e)},t}(),n=function(){function t(t){this.m=t,this.mp=t.invdigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<0&&this.m.subto(e,e),e},t.prototype.revert=function(t){var e=m();return t.copyto(e),this.reduce(e),e},t.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e>15)*this.mpl&this.um)<<15)&t.dm;for(t[i=e+this.m.t]+=this.m.am(0,r,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)},t.prototype.multo=function(t,e,i){t.multiplyto(e,i),this.reduce(i)},t.prototype.sqrto=function(t,e){t.squareto(e),this.reduce(e)},t}(),p=function(){function t(t){this.m=t,this.r2=m(),this.q3=m(),a.one.dlshiftto(2*t.t,this.r2),this.mu=this.r2.divide(t)}return t.prototype.convert=function(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=m();return t.copyto(e),this.reduce(e),e},t.prototype.revert=function(t){return t},t.prototype.reduce=function(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)},t.prototype.multo=function(t,e,i){t.multiplyto(e,i),this.reduce(i)},t.prototype.sqrto=function(t,e){t.squareto(e),this.reduce(e)},t}();function m(){return new a(null)}function l(t,e){return new a(t,e)}var j="undefined"!=typeof navigator;j&&"microsoft internet explorer"==navigator.appname?(a.prototype.am=function(t,e,i,r,n,s){for(var o=32767&e,h=e>>15;--s>=0;){var a=32767&this[t],u=this[t++]>>15,c=h*a+u*o;n=((a=o*a+((32767&c)<<15)+i[r]+(1073741823&n))>>>30)+(c>>>15)+h*u+(n>>>30),i[r++]=1073741823&a}return n},w=30):j&&"netscape"!=navigator.appname?(a.prototype.am=function(t,e,i,r,n,s){for(;--s>=0;){var o=e*this[t++]+i[r]+n;n=math.floor(o/67108864),i[r++]=67108863&o}return n},w=26):(a.prototype.am=function(t,e,i,r,n,s){for(var o=16383&e,h=e>>14;--s>=0;){var a=16383&this[t],u=this[t++]>>14,c=h*a+u*o;n=((a=o*a+((16383&c)<<14)+i[r]+n)>>28)+(c>>14)+h*u,i[r++]=268435455&a}return n},w=28),a.prototype.db=w,a.prototype.dm=(1<>>16)&&(t=e,i+=16),0!=(e=t>>8)&&(t=e,i+=8),0!=(e=t>>4)&&(t=e,i+=4),0!=(e=t>>2)&&(t=e,i+=2),0!=(e=t>>1)&&(t=e,i+=1),i}a.zero=u(0),a.one=u(1);var k,_,z=function(){function t(){this.i=0,this.j=0,this.s=[]}return t.prototype.init=function(t){var e,i,r;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,r=this.s[e],this.s[e]=this.s[i],this.s[i]=r;this.i=0,this.j=0},t.prototype.next=function(){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]},t}(),z=256,g=null;if(null==g){g=[],_=0;var $=void 0;if("undefined"!=typeof window&&window.crypto&&window.crypto.getrandomvalues){var y=new uint32array(256);for(window.crypto.getrandomvalues(y),$=0;$=256||_>=z)window.removeeventlistener?window.removeeventlistener("mousemove",x,!1):window.detachevent&&window.detachevent("onmousemove",x);else try{var e=t.x+t.y;g[_++]=255&e,j+=1}catch(t){}};"undefined"!=typeof window&&(window.addeventlistener?window.addeventlistener("mousemove",x,!1):window.attachevent&&window.attachevent("onmousemove",x))}function q(){if(null==k){for(k=new z;_0&&e.length>0?(this.n=l(t,16),this.e=parseint(e,16)):console.error("invalid rsa public key")},t.prototype.encrypt=function(t){var e=this.n.bitlength()+7>>3,i=function(t,e){if(e=0&&e>0;){var n=t.charcodeat(r--);n<128?i[--e]=n:n>127&&n<2048?(i[--e]=63&n|128,i[--e]=n>>6|192):(i[--e]=63&n|128,i[--e]=n>>6&63|128,i[--e]=n>>12|224)}i[--e]=0;for(var s=new w,o=[];e>2;){for(o[0]=0;0==o[0];)s.nextbytes(o);i[--e]=o[0]}return i[--e]=2,i[--e]=0,new a(i)}(t,e);if(null==i)return null;var r=this.dopublic(i);if(null==r)return null;for(var n=r.tostring(16),s=n.length,o=0;o<2*e-s;o++)n="0"+n;return n},t.prototype.setprivate=function(t,e,i){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=l(t,16),this.e=parseint(e,16),this.d=l(i,16)):console.error("invalid rsa private key")},t.prototype.setprivateex=function(t,e,i,r,n,s,o,h){null!=t&&null!=e&&t.length>0&&e.length>0?(this.n=l(t,16),this.e=parseint(e,16),this.d=l(i,16),this.p=l(r,16),this.q=l(n,16),this.dmp1=l(s,16),this.dmq1=l(o,16),this.coeff=l(h,16)):console.error("invalid rsa private key")},t.prototype.generate=function(t,e){var i=new w,r=t>>1;this.e=parseint(e,16);for(var n=new a(e,16);;){for(;this.p=new a(t-r,1,i),0!=this.p.subtract(a.one).gcd(n).compareto(a.one)||!this.p.isprobableprime(10););for(;this.q=new a(r,1,i),0!=this.q.subtract(a.one).gcd(n).compareto(a.one)||!this.q.isprobableprime(10););if(this.p.compareto(this.q)<=0){var s=this.p;this.p=this.q,this.q=s}var o=this.p.subtract(a.one),h=this.q.subtract(a.one),a=o.multiply(h);if(0==a.gcd(n).compareto(a.one)){this.n=this.p.multiply(this.q),this.d=n.modinverse(a),this.dmp1=this.d.mod(o),this.dmq1=this.d.mod(h),this.coeff=this.q.modinverse(this.p);break}}},t.prototype.decrypt=function(t){var e=l(t,16),i=this.doprivate(e);return null==i?null:function(t,e){for(var i=t.tobytearray(),r=0;r=i.length)return null;for(var n="";++r191&&s<224?(n+=string.fromcharcode((31&s)<<6|63&i[r+1]),++r):(n+=string.fromcharcode((15&s)<<12|(63&i[r+1])<<6|63&i[r+2]),r+=2)}return n}(i,this.n.bitlength()+7>>3)},t.prototype.generateasync=function(t,e,i){var r=new w,n=t>>1;this.e=parseint(e,16);var s=new a(e,16),o=this,h=function(){var e=function(){if(o.p.compareto(o.q)<=0){var t=o.p;o.p=o.q,o.q=t}var e=o.p.subtract(a.one),r=o.q.subtract(a.one),n=e.multiply(r);0==n.gcd(s).compareto(a.one)?(o.n=o.p.multiply(o.q),o.d=s.modinverse(n),o.dmp1=o.d.mod(e),o.dmq1=o.d.mod(r),o.coeff=o.q.modinverse(o.p),settimeout((function(){i()}),0)):settimeout(h,0)},a=function(){o.q=m(),o.q.fromnumberasync(n,1,r,(function(){o.q.subtract(a.one).gcda(s,(function(t){0==t.compareto(a.one)&&o.q.isprobableprime(10)?settimeout(e,0):settimeout(a,0)}))}))},u=function(){o.p=m(),o.p.fromnumberasync(t-n,1,r,(function(){o.p.subtract(a.one).gcda(s,(function(t){0==t.compareto(a.one)&&o.p.isprobableprime(10)?settimeout(a,0):settimeout(u,0)}))}))};settimeout(u,0)};settimeout(h,0)},t.prototype.sign=function(t,e,i){var r=function(t,e){if(e15)throw"asn.1 length too long to represent by 8x: n = "+t.tostring(16);return(128+i).tostring(16)+e},this.getencodedhex=function(){return(null==this.htlv||this.ismodified)&&(this.hv=this.getfreshvaluehex(),this.hl=this.getlengthhexfromvalue(),this.htlv=this.ht+this.hl+this.hv,this.ismodified=!1),this.htlv},this.getvaluehex=function(){return this.getencodedhex(),this.hv},this.getfreshvaluehex=function(){return""}},rt.asn1.derabstractstring=function(t){rt.asn1.derabstractstring.superclass.constructor.call(this),this.getstring=function(){return this.s},this.setstring=function(t){this.htlv=null,this.ismodified=!0,this.s=t,this.hv=stohex(this.s)},this.setstringhex=function(t){this.htlv=null,this.ismodified=!0,this.s=null,this.hv=t},this.getfreshvaluehex=function(){return this.hv},void 0!==t&&("string"==typeof t?this.setstring(t):void 0!==t.str?this.setstring(t.str):void 0!==t.hex&&this.setstringhex(t.hex))},it.lang.extend(rt.asn1.derabstractstring,rt.asn1.asn1object),rt.asn1.derabstracttime=function(t){rt.asn1.derabstracttime.superclass.constructor.call(this),this.localdatetoutc=function(t){return utc=t.gettime()+6e4*t.gettimezoneoffset(),new date(utc)},this.formatdate=function(t,e,i){var r=this.zeropadding,n=this.localdatetoutc(t),s=string(n.getfullyear());"utc"==e&&(s=s.substr(2,2));var o=s+r(string(n.getmonth()+1),2)+r(string(n.getdate()),2)+r(string(n.gethours()),2)+r(string(n.getminutes()),2)+r(string(n.getseconds()),2);if(!0===i){var h=n.getmilliseconds();if(0!=h){var a=r(string(h),3);o=o+"."+(a=a.replace(/[0]+$/,""))}}return o+"z"},this.zeropadding=function(t,e){return t.length>=e?t:new array(e-t.length+1).join("0")+t},this.getstring=function(){return this.s},this.setstring=function(t){this.htlv=null,this.ismodified=!0,this.s=t,this.hv=stohex(t)},this.setbydatevalue=function(t,e,i,r,n,s){var o=new date(date.utc(t,e-1,i,r,n,s,0));this.setbydate(o)},this.getfreshvaluehex=function(){return this.hv}},it.lang.extend(rt.asn1.derabstracttime,rt.asn1.asn1object),rt.asn1.derabstractstructured=function(t){rt.asn1.derabstractstring.superclass.constructor.call(this),this.setbyasn1objectarray=function(t){this.htlv=null,this.ismodified=!0,this.asn1array=t},this.appendasn1object=function(t){this.htlv=null,this.ismodified=!0,this.asn1array.push(t)},this.asn1array=new array,void 0!==t&&void 0!==t.array&&(this.asn1array=t.array)},it.lang.extend(rt.asn1.derabstractstructured,rt.asn1.asn1object),rt.asn1.derboolean=function(){rt.asn1.derboolean.superclass.constructor.call(this),this.ht="01",this.htlv="0101ff"},it.lang.extend(rt.asn1.derboolean,rt.asn1.asn1object),rt.asn1.derinteger=function(t){rt.asn1.derinteger.superclass.constructor.call(this),this.ht="02",this.setbybiginteger=function(t){this.htlv=null,this.ismodified=!0,this.hv=rt.asn1.asn1util.biginttomintwoscomplementshex(t)},this.setbyinteger=function(t){var e=new a(string(t),10);this.setbybiginteger(e)},this.setvaluehex=function(t){this.hv=t},this.getfreshvaluehex=function(){return this.hv},void 0!==t&&(void 0!==t.bigint?this.setbybiginteger(t.bigint):void 0!==t.int?this.setbyinteger(t.int):"number"==typeof t?this.setbyinteger(t):void 0!==t.hex&&this.setvaluehex(t.hex))},it.lang.extend(rt.asn1.derinteger,rt.asn1.asn1object),rt.asn1.derbitstring=function(t){if(void 0!==t&&void 0!==t.obj){var e=rt.asn1.asn1util.newobject(t.obj);t.hex="00"+e.getencodedhex()}rt.asn1.derbitstring.superclass.constructor.call(this),this.ht="03",this.sethexvalueincludingunusedbits=function(t){this.htlv=null,this.ismodified=!0,this.hv=t},this.setunusedbitsandhexvalue=function(t,e){if(t<0||7=2?(n[n.length]=s,s=0,o=0):s<<=4}}if(o)throw new error("hex encoding incomplete: 4 bits missing");return n}(t):v.unarmor(t),n=x.decode(r);if(3===n.sub.length&&(n=n.sub[2].sub[0]),9===n.sub.length){e=n.sub[1].gethexstringvalue(),this.n=l(e,16),i=n.sub[2].gethexstringvalue(),this.e=parseint(i,16);var s=n.sub[3].gethexstringvalue();this.d=l(s,16);var o=n.sub[4].gethexstringvalue();this.p=l(o,16);var h=n.sub[5].gethexstringvalue();this.q=l(h,16);var a=n.sub[6].gethexstringvalue();this.dmp1=l(a,16);var u=n.sub[7].gethexstringvalue();this.dmq1=l(u,16);var f=n.sub[8].gethexstringvalue();this.coeff=l(f,16)}else{if(2!==n.sub.length)return!1;if(n.sub[0].sub){var l=n.sub[1].sub[0];e=l.sub[0].gethexstringvalue(),this.n=l(e,16),i=l.sub[1].gethexstringvalue(),this.e=parseint(i,16)}else e=n.sub[0].gethexstringvalue(),this.n=l(e,16),i=n.sub[1].gethexstringvalue(),this.e=parseint(i,16)}return!0}catch(t){return!1}},e.prototype.getprivatebasekey=function(){var t={array:[new rt.asn1.derinteger({int:0}),new rt.asn1.derinteger({bigint:this.n}),new rt.asn1.derinteger({int:this.e}),new rt.asn1.derinteger({bigint:this.d}),new rt.asn1.derinteger({bigint:this.p}),new rt.asn1.derinteger({bigint:this.q}),new rt.asn1.derinteger({bigint:this.dmp1}),new rt.asn1.derinteger({bigint:this.dmq1}),new rt.asn1.derinteger({bigint:this.coeff})]};return new rt.asn1.dersequence(t).getencodedhex()},e.prototype.getprivatebasekeyb64=function(){return p(this.getprivatebasekey())},e.prototype.getpublicbasekey=function(){var t=new rt.asn1.dersequence({array:[new rt.asn1.derobjectidentifier({oid:"1.2.840.113549.1.1.1"}),new rt.asn1.dernull]}),e=new rt.asn1.dersequence({array:[new rt.asn1.derinteger({bigint:this.n}),new rt.asn1.derinteger({int:this.e})]}),i=new rt.asn1.derbitstring({hex:"00"+e.getencodedhex()});return new rt.asn1.dersequence({array:[t,i]}).getencodedhex()},e.prototype.getpublicbasekeyb64=function(){return p(this.getpublicbasekey())},e.wordwrap=function(t,e){if(!t)return t;var i="(.{1,"+(e=e||64)+"})( +|$\n?)|(.{1,"+e+"})";return t.match(regexp(i,"g")).join("\n")},e.prototype.getprivatekey=function(){var t="-----begin rsa private key-----\n";return(t+=e.wordwrap(this.getprivatebasekeyb64())+"\n")+"-----end rsa private key-----"},e.prototype.getpublickey=function(){var t="-----begin public key-----\n";return(t+=e.wordwrap(this.getpublicbasekeyb64())+"\n")+"-----end public key-----"},e.haspublickeyproperty=function(t){return(t=t||{}).hasownproperty("n")&&t.hasownproperty("e")},e.hasprivatekeyproperty=function(t){return(t=t||{}).hasownproperty("n")&&t.hasownproperty("e")&&t.hasownproperty("d")&&t.hasownproperty("p")&&t.hasownproperty("q")&&t.hasownproperty("dmp1")&&t.hasownproperty("dmq1")&&t.hasownproperty("coeff")},e.prototype.parsepropertiesfrom=function(t){this.n=t.n,this.e=t.e,t.hasownproperty("d")&&(this.d=t.d,this.p=t.p,this.q=t.q,this.dmp1=t.dmp1,this.dmq1=t.dmq1,this.coeff=t.coeff)},e}(tt),at=i(155),ut=void 0!==at?null===(st=at.env)||void 0===st?void 0:"3.3.2":void 0;const ct=function(){function t(t){void 0===t&&(t={}),t=t||{},this.default_key_size=t.default_key_size?parseint(t.default_key_size,10):1024,this.default_public_exponent=t.default_public_exponent||"010001",this.log=t.log||!1,this.key=null}return t.prototype.setkey=function(t){this.log&&this.key&&console.warn("a key was already set, overriding existing."),this.key=new ht(t)},t.prototype.setprivatekey=function(t){this.setkey(t)},t.prototype.setpublickey=function(t){this.setkey(t)},t.prototype.decrypt=function(t){try{return this.getkey().decrypt(g(t))}catch(t){return!1}},t.prototype.encrypt=function(t){try{return p(this.getkey().encrypt(t))}catch(t){return!1}},t.prototype.sign=function(t,e,i){try{return p(this.getkey().sign(t,e,i))}catch(t){return!1}},t.prototype.verify=function(t,e,i){try{return this.getkey().verify(t,g(e),i)}catch(t){return!1}},t.prototype.getkey=function(t){if(!this.key){if(this.key=new ht,t&&"[object function]"==={}.tostring.call(t))return void this.key.generateasync(this.default_key_size,this.default_public_exponent,t);this.key.generate(this.default_key_size,this.default_public_exponent)}return this.key},t.prototype.getprivatekey=function(){return this.getkey().getprivatekey()},t.prototype.getprivatekeyb64=function(){return this.getkey().getprivatebasekeyb64()},t.prototype.getpublickey=function(){return this.getkey().getpublickey()},t.prototype.getpublickeyb64=function(){return this.getkey().getpublicbasekeyb64()},t.version=ut,t}()})(),r.default})()));