MCPcopy Index your code
hub / github.com/ChinaSiro/claude-code-sourcemap / Pg_

Function Pg_

package/cli.js:861–861  ·  view source on GitHub ↗
(q,K,_)

Source from the content-addressed store, hash-verified

859`,_};WO4.decode=function(q){var K=[],_=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,z=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,Y=/\r?\n/,$;while(!0){if($=_.exec(q),!$)break;var A=$[1];if(A==="NEW CERTIFICATE REQUEST")A="CERTIFICATE REQUEST";var O={type:A,procType:null,contentDomain:null,dekInfo:null,headers:[],body:Rv8.util.decode64($[3])};if(K.push(O),!$[2])continue;var w=$[2].split(Y),j=0;while($&&j<w.length){var H=w[j].replace(/\s+$/,"");for(var J=j+1;J<w.length;++J){var M=w[J];if(!/\s/.test(M[0]))break;H+=M,j=J}if($=H.match(z),$){var X={name:$[1],values:[]},P=$[2].split(",");for(var W=0;W<P.length;++W)X.values.push(jB_(P[W]));if(!O.procType){if(X.name!=="Proc-Type")throw Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');else if(X.values.length!==2)throw Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');O.procType={version:P[0],type:P[1]}}else if(!O.contentDomain&&X.name==="Content-Domain")O.contentDomain=P[0]||"";else if(!O.dekInfo&&X.name==="DEK-Info"){if(X.values.length===0)throw Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');O.dekInfo={algorithm:P[0],parameters:P[1]||null}}else O.headers.push(X)}++j}if(O.procType==="ENCRYPTED"&&!O.dekInfo)throw Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}if(K.length===0)throw Error("Invalid PEM formatted message.");return K};function Lv8(q){var K=q.name+": ",_=[],z=function(w,j){return" "+j};for(var Y=0;Y<q.values.length;++Y)_.push(q.values[Y].replace(/^(\S+\r\n)/,z));K+=_.join(",")+`\r
860`;var $=0,A=-1;for(var Y=0;Y<K.length;++Y,++$)if($>65&&A!==-1){var O=K[A];if(O===",")++A,K=K.substr(0,A)+`\r
861 `+K.substr(A);else K=K.substr(0,A)+`\r
862`+O+K.substr(A+1);$=Y-A-1,A=-1,++Y}else if(K[Y]===" "||K[Y]==="\t"||K[Y]===",")A=Y;return K}function jB_(q){return q.replace(/^\s+/,"")}});var Ei6=m((_lA,ZO4)=>{var Cj=E_();Gv8();$b1();_$();ZO4.exports=Cj.des=Cj.des||{};Cj.des.startEncrypting=function(q,K,_,z){var Y=hv8({key:q,output:_,decrypt:!1,mode:z||(K===null?"ECB":"CBC")});return Y.start(K),Y};Cj.des.createEncryptionCipher=function(q,K){return hv8({key:q,output:null,decrypt:!1,mode:K})};Cj.des.startDecrypting=function(q,K,_,z){var Y=hv8({key:q,output:_,decrypt:!0,mode:z||(K===null?"ECB":"CBC")});return Y.start(K),Y};Cj.des.createDecryptionCipher=function(q,K){return hv8({key:q,output:null,decrypt:!0,mode:K})};Cj.des.Algorithm=function(q,K){var _=this;_.name=q,_.mode=new K({blockSize:8,cipher:{encrypt:function(z,Y){return fO4(_._keys,z,Y,!1)},decrypt:function(z,Y){return fO4(_._keys,z,Y,!0)}}}),_._init=!1};Cj.des.Algorithm.prototype.initialize=function(q){if(this._init)return;var K=Cj.util.createBuffer(q.key);if(this.name.indexOf("3DES")===0){if(K.length()!==24)throw Error("Invalid Triple-DES key size: "+K.length()*8)}this._keys=ZB_(K),this._init=!0};mF("DES-ECB",Cj.cipher.modes.ecb);mF("DES-CBC",Cj.cipher.modes.cbc);mF("DES-CFB",Cj.cipher.modes.cfb);mF("DES-OFB",Cj.cipher.modes.ofb);mF("DES-CTR",Cj.cipher.modes.ctr);mF("3DES-ECB",Cj.cipher.modes.ecb);mF("3DES-CBC",Cj.cipher.modes.cbc);mF("3DES-CFB",Cj.cipher.modes.cfb);mF("3DES-OFB",Cj.cipher.modes.ofb);mF("3DES-CTR",Cj.cipher.modes.ctr);function mF(q,K){var _=function(){return new Cj.des.Algorithm(q,K)};Cj.cipher.registerAlgorithm(q,_)}var HB_=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],JB_=[-2146402272,-2147450880,32768,1081376,1048576,32,-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,-2146402272,1081344],MB_=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],XB_=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],PB_=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],WB_=[536870928,541065216,16384,541081616,541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],DB_=[2097152,69206018,67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],fB_=[268439616,4096,262144,268701760,268435456,268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696];function ZB_(q){var K=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],_=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],z=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],Y=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],$=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],A=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],O=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],w=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],j=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],H=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],J=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],M=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],X=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],P=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],W=q.length()>8?3:1,D=[],f=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],G=0,Z;for(var T=0;T<W;T++){var v=q.getInt32(),V=q.getInt32();Z=(v>>>4^V)&252645135,V^=Z,v^=Z<<4,Z=(V>>>-16^v)&65535,v^=Z,V^=Z<<-16,Z=(v>>>2^V)&858993459,V^=Z,v^=Z<<2,Z=(V>>>-16^v)&65535,v^=Z,V^=Z<<-16,Z=(v>>>1^V)&1431655765,V^=Z,v^=Z<<1,Z=(V>>>8^v)&16711935,v^=Z,V^=Z<<8,Z=(v>>>1^V)&1431655765,V^=Z,v^=Z<<1,Z=v<<8|V>>>20&240,v=V<<24|V<<8&16711680|V>>>8&65280|V>>>24&240,V=Z;for(var E=0;E<f.length;++E){if(f[E])v=v<<2|v>>>26,V=V<<2|V>>>26;else v=v<<1|v>>>27,V=V<<1|V>>>27;v&=-15,V&=-15;var S=K[v>>>28]|_[v>>>24&15]|z[v>>>20&15]|Y[v>>>16&15]|$[v>>>12&15]|A[v>>>8&15]|O[v>>>4&15],R=w[V>>>28]|j[V>>>24&15]|H[V>>>20&15]|J[V>>>16&15]|M[V>>>12&15]|X[V>>>8&15]|P[V>>>4&15];Z=(R>>>16^S)&65535,D[G++]=S^Z,D[G++]=R^Z<<16}}return D}function fO4(q,K,_,z){var Y=q.length===32?3:9,$;if(Y===3)$=z?[30,-2,-2]:[0,32,2];else $=z?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var A,O=K[0],w=K[1];A=(O>>>4^w)&252645135,w^=A,O^=A<<4,A=(O>>>16^w)&65535,w^=A,O^=A<<16,A=(w>>>2^O)&858993459,O^=A,w^=A<<2,A=(w>>>8^O)&16711935,O^=A,w^=A<<8,A=(O>>>1^w)&1431655765,w^=A,O^=A<<1,O=O<<1|O>>>31,w=w<<1|w>>>31;for(var j=0;j<Y;j+=3){var H=$[j+1],J=$[j+2];for(var M=$[j];M!=H;M+=J){var X=w^q[M],P=(w>>>4|w<<28)^q[M+1];A=O,O=w,w=A^(JB_[X>>>24&63]|XB_[X>>>16&63]|WB_[X>>>8&63]|fB_[X&63]|HB_[P>>>24&63]|MB_[P>>>16&63]|PB_[P>>>8&63]|DB_[P&63])}A=O,O=w,w=A}O=O>>>1|O<<31,w=w>>>1|w<<31,A=(O>>>1^w)&1431655765,w^=A,O^=A<<1,A=(w>>>8^O)&16711935,O^=A,w^=A<<8,A=(w>>>2^O)&858993459,O^=A,w^=A<<2,A=(O>>>16^w)&65535,w^=A,O^=A<<16,A=(O>>>4^w)&252645135,w^=A,O^=A<<4,_[0]=O,_[1]=w}function hv8(q){q=q||{};var K=(q.mode||"CBC").toUpperCase(),_="DES-"+K,z;if(q.decrypt)z=Cj.cipher.createDecipher(_,q.key);else z=Cj.cipher.createCipher(_,q.key);var Y=z.start;return z.start=function($,A){var O=null;if(A instanceof Cj.util.ByteBuffer)O=A,A={};A=A||{},A.output=O,A.iv=$,Y.call(z,A)},z}});var Sv8=m((zlA,GO4)=>{var xv=E_();Yk6();IF();_$();var GB_=xv.pkcs5=xv.pkcs5||{},$r;if(xv.util.isNodejs&&!xv.options.usePureJavaScript)$r=U6("crypto");GO4.exports=xv.pbkdf2=GB_.pbkdf2=function(q,K,_,z,Y,$){if(typeof Y==="function")$=Y,Y=null;if(xv.util.isNodejs&&!xv.options.usePureJavaScript&&$r.pbkdf2&&(Y===null||typeof Y!=="object")&&($r.pbkdf2Sync.length>4||(!Y||Y==="sha1"))){if(typeof Y!=="string")Y="sha1";if(q=Buffer.from(q,"binary"),K=Buffer.from(K,"binary"),!$){if($r.pbkdf2Sync.length===4)return $r.pbkdf2Sync(q,K,_,z).toString("binary");return $r.pbkdf2Sync(q,K,_,z,Y).toString("binary")}if($r.pbkdf2Sync.length===4)return $r.pbkdf2(q,K,_,z,function(Z,T){if(Z)return $(Z);$(null,T.toString("binary"))});return $r.pbkdf2(q,K,_,z,Y,function(Z,T){if(Z)return $(Z);$(null,T.toString("binary"))})}if(typeof Y>"u"||Y===null)Y="sha1";if(typeof Y==="string"){if(!(Y in xv.md.algorithms))throw Error("Unknown hash algorithm: "+Y);Y=xv.md[Y].create()}var A=Y.digestLength;if(z>4294967295*A){var O=Error("Derived key is too long.");if($)return $(O);throw O}var w=Math.ceil(z/A),j=z-(w-1)*A,H=xv.hmac.create();H.start(Y,q);var J="",M,X,P;if(!$){for(var W=1;W<=w;++W){H.start(null,null),H.update(K),H.update(xv.util.int32ToBytes(W)),M=P=H.digest().getBytes();for(var D=2;D<=_;++D)H.start(null,null),H.update(P),X=H.digest().getBytes(),M=xv.util.xorBytes(M,X,A),P=X;J+=W<w?M:M.substr(0,j)}return J}var W=1,D;function f(){if(W>w)return $(null,J);H.start(null,null),H.update(K),H.update(xv.util.int32ToBytes(W)),M=P=H.digest().getBytes(),D=2,G()}function G(){if(D<=_)return H.start(null,null),H.update(P),X=H.digest().getBytes(),M=xv.util.xorBytes(M,X,A),P=X,++D,xv.util.setImmediate(G);J+=W<w?M:M.substr(0,j),++W,f()}f()}});var Mb1=m((YlA,NO4)=>{var pF=E_();IF();_$();var vO4=NO4.exports=pF.sha256=pF.sha256||{};pF.md.sha256=pF.md.algorithms.sha256=vO4;vO4.create=function(){if(!kO4)TB_();var q=null,K=pF.util.createBuffer(),_=Array(64),z={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8};return z.start=function(){z.messageLength=0,z.fullMessageLength=z.messageLength64=[];var Y=z.messageLengthSize/4;for(var $=0;$<Y;++$)z.fullMessageLength.push(0);return K=pF.util.createBuffer(),q={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},z},z.start(),z.update=function(Y,$){if($==="utf8")Y=pF.util.encodeUtf8(Y);var A=Y.length;z.messageLength+=A,A=[A/4294967296>>>0,A>>>0];for(var O=z.fullMessageLength.length-1;O>=0;--O)z.fullMessageLength[O]+=A[1],A[1]=A[0]+(z.fullMessageLength[O]/4294967296>>>0),z.fullMessageLength[O]=z.fullMessageLength[O]>>>0,A[0]=A[1]/4294967296>>>0;if(K.putBytes(Y),TO4(q,_,K),K.read>2048||K.length()===0)K.compact();return z},z.digest=function(){var Y=pF.util.createBuffer();Y.putBytes(K.bytes());var $=z.fullMessageLength[z.fullMessageLength.length-1]+z.messageLengthSize,A=$&z.blockLength-1;Y.putBytes(Jb1.substr(0,z.blockLength-A));var O,w,j=z.fullMessageLength[0]*8;for(var H=0;H<z.fullMessageLength.length-1;++H)O=z.fullMessageLength[H+1]*8,w=O/4294967296>>>0,j+=w,Y.putInt32(j>>>0),j=O>>>0;Y.putInt32(j);var J={h0:q.h0,h1:q.h1,h2:q.h2,h3:q.h3,h4:q.h4,h5:q.h5,h6:q.h6,h7:q.h7};TO4(J,_,Y);var M=pF.util.createBuffer();return M.putInt32(J.h0),M.putInt32(J.h1),M.putInt32(J.h2),M.putInt32(J.h3),M.putInt32(J.h4),M.putInt32(J.h5),M.putInt32(J.h6),M.putInt32(J.h7),M},z};var Jb1=null,kO4=!1,VO4=null;function TB_(){Jb1=String.fromCharCode(128),Jb1+=pF.util.fillString(String.fromCharCode(0),64),VO4=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,2361852424,2428436474,2756734187,3204031479,3329325298],kO4=!0}function TO4(q,K,_){var z,Y,$,A,O,w,j,H,J,M,X,P,W,D,f,G=_.length();while(G>=64){for(j=0;j<16;++j)K[j]=_.getInt32();for(;j<64;++j)z=K[j-2],z=(z>>>17|z<<15)^(z>>>19|z<<13)^z>>>10,Y=K[j-15],Y=(Y>>>7|Y<<25)^(Y>>>18|Y<<14)^Y>>>3,K[j]=z+K[j-7]+Y+K[j-16]|0;H=q.h0,J=q.h1,M=q.h2,X=q.h3,P=q.h4,W=q.h5,D=q.h6,f=q.h7;for(j=0;j<64;++j)A=(P>>>6|P<<26)^(P>>>11|P<<21)^(P>>>25|P<<7),O=D^P&(W^D),$=(H>>>2|H<<30)^(H>>>13|H<<19)^(H>>>22|H<<10),w=H&J|M&(H^J),z=f+A+O+VO4[j]+K[j],Y=$+w,f=D,D=W,W=P,P=X+z>>>0,X=M,M=J,J=H,H=z+Y>>>0;q.h0=q.h0+H|0,q.h1=q.h1+J|0,q.h2=q.h2+M|0,q.h3=q.h3+X|0,q.h4=q.h4+P|0,q.h5=q.h5+W|0,q.h6=q.h6+D|0,q.h7=q.h7+f|0,G-=64}}});var Xb1=m(($lA,yO4)=>{var BF=E_();_$();var Cv8=null;if(BF.util.isNodejs&&!BF.options.usePureJavaScript&&!process.versions["node-webkit"])Cv8=U6("crypto");var vB_=yO4.exports=BF.prng=BF.prng||{};vB_.create=function(q){var K={plugin:q,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},_=q.md,z=Array(32);for(var Y=0;Y<32;++Y)z[Y]=_.create();K.pools=z,K.pool=0,K.generate=function(j,H){if(!H)return K.generateSync(j);var J=K.plugin.cipher,M=K.plugin.increment,X=K.plugin.formatKey,P=K.plugin.formatSeed,W=BF.util.createBuffer();K.key=null,D();function D(f){if(f)return H(f);if(W.length()>=j)return H(null,W.getBytes(j));if(K.generated>1048575)K.key=null;if(K.key===null)return BF.util.nextTick(function(){$(D)});var G=J(K.key,K.seed);K.generated+=G.length,W.putBytes(G),K.key=X(J(K.key,M(K.seed))),K.seed=P(J(K.key,K.seed)),BF.util.setImmediate(D)}},K.generateSync=function(j){var H=K.plugin.cipher,J=K.plugin.increment,M=K.plugin.formatKey,X=K.plugin.formatSeed;K.key=null;var P=BF.util.createBuffer();while(P.length()<j){if(K.generated>1048575)K.key=null;if(K.key===null)A();var W=H(K.key,K.seed);K.generated+=W.length,P.putBytes(W),K.key=M(H(K.key,J(K.seed))),K.seed=X(H(K.key,K.seed))}return P.getBytes(j)};function $(j){if(K.pools[0].messageLength>=32)return O(),j();var H=32-K.pools[0].messageLength<<5;K.seedFile(H,function(J,M){if(J)return j(J);K.collect(M),O(),j()})}function A(){if(K.pools[0].messageLength>=32)return O();var j=32-K.pools[0].messageLength<<5;K.collect(K.seedFileSync(j)),O()}function O(){K.reseeds=K.reseeds===4294967295?0:K.reseeds+1;var j=K.plugin.md.create();j.update(K.keyBytes);var H=1;for(var J=0;J<32;++J){if(K.reseeds%H===0)j.update(K.pools[J].digest().getBytes()),K.pools[J].start();H=H<<1}K.keyBytes=j.digest().getBytes(),j.start(),j.update(K.keyBytes);var M=j.digest().getBytes();K.key=K.plugin.formatKey(K.keyBytes),K.seed=K.plugin.formatSeed(M),K.generated=0}function w(j){var H=null,J=BF.util.globalScope,M=J.crypto||J.msCrypto;if(M&&M.getRandomValues)H=function(v){return M.getRandomValues(v)};var X=BF.util.createBuffer();if(H)while(X.length()<j){var P=Math.max(1,Math.min(j-X.length(),65536)/4),W=new Uint32Array(Math.floor(P));try{H(W);for(var D=0;D<W.length;++D)X.putInt32(W[D])}catch(v){if(!(typeof QuotaExceededError<"u"&&v instanceof QuotaExceededError))throw v}}if(X.length()<j){var f,G,Z,T=Math.floor(Math.random()*65536);while(X.length()<j){G=16807*(T&65535),f=16807*(T>>16),G+=(f&32767)<<16,G+=f>>15,G=(G&2147483647)+(G>>31),T=G&4294967295;for(var D=0;D<3;++D)Z=T>>>(D<<3),Z^=Math.floor(Math.random()*256),X.putByte(Z&255)}}return X.getBytes(j)}if(Cv8)K.seedFile=function(j,H){Cv8.randomBytes(j,function(J,M){if(J)return H(J);H(null,M.toString())})},K.seedFileSync=function(j){return Cv8.randomBytes(j).toString()};else K.seedFile=function(j,H){try{H(null,w(j))}catch(J){H(J)}},K.seedFileSync=w;return K.collect=function(j){var H=j.length;for(var J=0;J<H;++J)K.pools[K.pool].update(j.substr(J,1)),K.pool=K.pool===31?0:K.pool+1},K.collectInt=function(j,H){var J="";for(var M=0;M<H;M+=8)J+=String.fromCharCode(j>>M&255);K.collect(J)},K.registerWorker=function(j){if(j===self)K.seedFile=function(J,M){function X(P){var W=P.data;if(W.forge&&W.forge.prng)self.removeEventListener("message",X),M(W.forge.prng.err,W.forge.prng.bytes)}self.addEventListener("message",X),self.postMessage({forge:{prng:{needed:J}}})};else{var H=function(J){var M=J.data;if(M.forge&&M.forge.prng)K.seedFile(M.forge.prng.needed,function(X,P){j.postMessage({forge:{prng:{err:X,bytes:P}}})})};j.addEventListener("message",H)}},K}});var WC=m((AlA,Pb1)=>{var AD=E_();h76();Mb1();Xb1();_$();(function(){if(AD.random&&AD.random.getBytes){Pb1.exports=AD.random;return}(function(q){var K={},_=[,,,,],z=AD.util.createBuffer();K.formatKey=function(J){var M=AD.util.createBuffer(J);return J=[,,,,],J[0]=M.getInt32(),J[1]=M.getInt32(),J[2]=M.getInt32(),J[3]=M.getInt32(),AD.aes._expandKey(J,!1)},K.formatSeed=function(J){var M=AD.util.createBuffer(J);return J=[,,,,],J[0]=M.getInt32(),J[1]=M.getInt32(),J[2]=M.getInt32(),J[3]=M.getInt32(),J},K.cipher=function(J,M){return AD.aes._updateBlock(J,M,_,!1),z.putInt32(_[0]),z.putInt32(_[1]),z.putInt32(_[2]),z.putInt32(_[3]),z.getBytes()},K.increment=function(J){return++J[3],J},K.md=AD.md.sha256;function Y(){var J=AD.prng.create(K);return J.getBytes=function(M,X){return J.generate(M,X)},J.getBytesSync=function(M){return J.generate(M)},J}var $=Y(),A=null,O=AD.util.globalScope,w=O.crypto||O.msCrypto;if(w&&w.getRandomValues)A=function(J){return w.getRandomValues(J)};if(AD.options.usePureJavaScript||!AD.util.isNodejs&&!A){if(typeof window>"u"||window.document===void 0);if($.collectInt(+new Date,32),typeof navigator<"u"){var j="";for(var H in navigator)try{if(typeof navigator[H]=="string")j+=navigator[H]}catch(J){}$.collect(j),j=null}if(q)q().mousemove(function(J){$.collectInt(J.clientX,16),$.collectInt(J.clientY,16)}),q().keypress(function(J){$.collectInt(J.charCode,8)})}if(!AD.random)AD.random=$;else for(var H in $)AD.random[H]=$[H];AD.random.createInstance=Y,Pb1.exports=AD.random})(typeof jQuery<"u"?jQuery:null)})()});var Db1=m((OlA,RO4)=>{var _N=E_();_$();var Wb1=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],EO4=[1,2,3,5],kB_=function(q,K){return q<<K&65535|(q&65535)>>16-K},VB_=function(q,K){return(q&65535)>>K|q<<16-K&65535};RO4.exports=_N.rc2=_N.rc2||{};_N.rc2.expandKey=function(q,K){if(typeof q==="string")q=_N.util.createBuffer(q);K=K||128;var _=q,z=q.length(),Y=K,$=Math.ceil(Y/8),A=255>>(Y&7),O;for(O=z;O<128;O++)_.putByte(Wb1[_.at(O-1)+_.at(O-z)&255]);_.setAt(128-$,Wb1[_.at(128-$)&A]);for(O=127-$;O>=0;O--)_.setAt(O,Wb1[_.at(O+1)^_.at(O+$)]);return _};var LO4=function(q,K,_){var z=!1,Y=null,$=null,A=null,O,w,j,H,J=[];q=_N.rc2.expandKey(q,K);for(j=0;j<64;j++)J.push(q.getInt16Le());if(_)O=function(P){for(j=0;j<4;j++)P[j]+=J[H]+(P[(j+3)%4]&P[(j+2)%4])+(~P[(j+3)%4]&P[(j+1)%4]),P[j]=kB_(P[j],EO4[j]),H++},w=function(P){for(j=0;j<4;j++)P[j]+=J[P[(j+3)%4]&63]};else O=function(P){for(j=3;j>=0;j--)P[j]=VB_(P[j],EO4[j]),P[j]-=J[H]+(P[(j+3)%4]&P[(j+2)%4])+(~P[(j+3)%4]&P[(j+1)%4]),H--},w=function(P){for(j=3;j>=0;j--)P[j]-=J[P[(j+3)%4]&63]};var M=function(P){var W=[];for(j=0;j<4;j++){var D=Y.getInt16Le();if(A!==null)if(_)D^=A.getInt16Le();else A.putInt16Le(D);W.push(D&65535)}H=_?0:63;for(var f=0;f<P.length;f++)for(var G=0;G<P[f][0];G++)P[f][1](W);for(j=0;j<4;j++){if(A!==null)if(_)A.putInt16Le(W[j]);else W[j]^=A.getInt16Le();$.putInt16Le(W[j])}},X=null;return X={start:function(P,W){if(P){if(typeof P==="string")P=_N.util.createBuffer(P)}z=!1,Y=_N.util.createBuffer(),$=W||new _N.util.createBuffer,A=P,X.output=$},update:function(P){if(!z)Y.putBuffer(P);while(Y.length()>=8)M([[5,O],[1,w],[6,O],[1,w],[5,O]])},finish:function(P){var W=!0;if(_)if(P)W=P(8,Y,!_);else{var D=Y.length()===8?8:8-Y.length();Y.fillWithByte(D,D)}if(W)z=!0,X.update();if(!_){if(W=Y.length()===0,W)if(P)W=P(8,$,!_);else{var f=$.length(),G=$.at(f-1);if(G>f)W=!1;else $.truncate(G)}}return W}},X};_N.rc2.startEncrypting=function(q,K,_){var z=_N.rc2.createEncryptionCipher(q,128);return z.start(K,_),z};_N.rc2.createEncryptionCipher=function(q,K){return LO4(q,K,!0)};_N.rc2.startDecrypting=function(q,K,_){var z=_N.rc2.createDecryptionCipher(q,128);return z.start(K,_),z};_N.rc2.createDecryptionCipher=function(q,K){return LO4(q,K,!1)}});var Ri6=m((wlA,mO4)=>{var fb1=E_();mO4.exports=fb1.jsbn=fb1.jsbn||{};var Ar,NB_=244837814094590,hO4=(NB_&16777215)==15715070;function m7(q,K,_){if(this.data=[],q!=null)if(typeof q=="number")this.fromNumber(q,K,_);else if(K==null&&typeof q!="string")this.fromString(q,256);else this.fromString(q,K)}fb1.jsbn.BigInteger=m7;function z$(){return new m7(null)}function yB_(q,K,_,z,Y,$){while(--$>=0){var A=K*this.data[q++]+_.data[z]+Y;Y=Math.floor(A/67108864),_.data[z++]=A&67108863}return Y}function EB_(q,K,_,z,Y,$){var A=K&32767,O=K>>15;while(--$>=0){var w=this.data[q]&32767,j=this.data[q++]>>15,H=O*w+j*A;w=A*w+((H&32767)<<15)+_.data[z]+(Y&1073741823),Y=(w>>>30)+(H>>>15)+O*j+(Y>>>30),_.data[z++]=w&1073741823}return Y}function SO4(q,K,_,z,Y,$){var A=K&16383,O=K>>14;while(--$>=0){var w=this.data[q]&16383,j=this.data[q++]>>14,H=O*w+j*A;w=A*w+((H&16383)<<14)+_.data[z]+Y,Y=(w>>28)+(H>>14)+O*j,_.data[z++]=w&268435455}return Y}if(typeof navigator>"u")m7.prototype.am=SO4,Ar=28;else if(hO4&&navigator.appName=="Microsoft Internet Explorer")m7.prototype.am=EB_,Ar=30;else if(hO4&&navigator.appName!="Netscape")m7.prototype.am=yB_,Ar=26;else m7.prototype.am=SO4,Ar=28;m7.prototype.DB=Ar;m7.prototype.DM=(1<<Ar)-1;m7.prototype.DV=1<<Ar;var Zb1=52;m7.prototype.FV=Math.pow(2,Zb1);m7.prototype.F1=Zb1-Ar;m7.prototype.F2=2*Ar-Zb1;var LB_="0123456789abcdefghijklmnopqrstuvwxyz",bv8=[],Ak6,DC;Ak6=48;for(DC=0;DC<=9;++DC)bv8[Ak6++]=DC;Ak6=97;for(DC=10;DC<36;++DC)bv8[Ak6++]=DC;Ak6=65;for(DC=10;DC<36;++DC)bv8[Ak6++]=DC;function CO4(q){return LB_.charAt(q)}function bO4(q,K){var _=bv8[q.charCodeAt(K)];return _==null?-1:_}function RB_(q){for(var K=this.t-1;K>=0;--K)q.data[K]=this.data[K];q.t=this.t,q.s=this.s}function hB_(q){if(this.t=1,this.s=q<0?-1:0,q>0)this.data[0]=q;else if(q<-1)this.data[0]=q+this.DV;else this.t=0}function C76(q){var K=z$();return K.fromInt(q),K}function SB_(q,K){var _;if(K==16)_=4;else if(K==8)_=3;else if(K==256)_=8;else if(K==2)_=1;else if(K==32)_=5;else if(K==4)_=2;else{this.fromRadix(q,K);return}this.t=0,this.s=0;var z=q.length,Y=!1,$=0;while(--z>=0){var A=_==8?q[z]&255:bO4(q,z);if(A<0){if(q.charAt(z)=="-")Y=!0;continue}if(Y=!1,$==0)this.data[this.t++]=A;else if($+_>this.DB)this.data[this.t-1]|=(A&(1<<this.DB-$)-1)<<$,this.data[this.t++]=A>>this.DB-$;else this.data[this.t-1]|=A<<$;if($+=_,$>=this.DB)$-=this.DB}if(_==8&&(q[0]&128)!=0){if(this.s=-1,$>0)this.data[this.t-1]|=(1<<this.DB-$)-1<<$}if(this.clamp(),Y)m7.ZERO.subTo(this,this)}function CB_(){var q=this.s&this.DM;while(this.t>0&&this.data[this.t-1]==q)--this.t}function bB_(q){if(this.s<0)return"-"+this.negate().toString(q);var K;if(q==16)K=4;else if(q==8)K=3;else if(q==2)K=1;else if(q==32)K=5;else if(q==4)K=2;else return this.toRadix(q);var _=(1<<K)-1,z,Y=!1,$="",A=this.t,O=this.DB-A*this.DB%K;if(A-- >0){if(O<this.DB&&(z=this.data[A]>>O)>0)Y=!0,$=CO4(z);while(A>=0){if(O<K)z=(this.data[A]&(1<<O)-1)<<K-O,z|=this.data[--A]>>(O+=this.DB-K);else if(z=this.data[A]>>(O-=K)&_,O<=0)O+=this.DB,--A;if(z>0)Y=!0;if(Y)$+=CO4(z)}}return Y?$:"0"}function xB_(){var q=z$();return m7.ZERO.subTo(this,q),q}function IB_(){return this.s<0?this.negate():this}function uB_(q){var K=this.s-q.s;if(K!=0)return K;var _=this.t;if(K=_-q.t,K!=0)return this.s<0?-K:K;while(--_>=0)if((K=this.data[_]-q.data[_])!=0)return K;return 0}function xv8(q){var K=1,_;if((_=q>>>16)!=0)q=_,K+=16;if((_=q>>8)!=0)q=_,K+=8;if((_=q>>4)!=0)q=_,K+=4;if((_=q>>2)!=0)q=_,K+=2;if((_=q>>1)!=0)q=_,K+=1;return K}function mB_(){if(this.t<=0)return 0;return this.DB*(this.t-1)+xv8(this.data[this.t-1]^this.s&this.DM)}function pB_(q,K){var _;for(_=this.t-1;_>=0;--_)K.data[_+q]=this.data[_];for(_=q-1;_>=0;--_)K.data[_]=0;K.t=this.t+q,K.s=this.s}function BB_(q,K){for(var _=q;_<this.t;++_)K.data[_-q]=this.data[_];K.t=Math.max(this.t-q,0),K.s=this.s}function gB_(q,K){var _=q%this.DB,z=this.DB-_,Y=(1<<z)-1,$=Math.floor(q/this.DB),A=this.s<<_&this.DM,O;for(O=this.t-1;O>=0;--O)K.data[O+$+1]=this.data[O]>>z|A,A=(this.data[O]&Y)<<_;for(O=$-1;O>=0;--O)K.data[O]=0;K.data[$]=A,K.t=this.t+$+1,K.s=this.s,K.clamp()}function FB_(q,K){K.s=this.s;var _=Math.floor(q/this.DB);if(_>=this.t){K.t=0;return}var z=q%this.DB,Y=this.DB-z,$=(1<<z)-1;K.data[0]=this.data[_]>>z;for(var A=_+1;A<this.t;++A)K.data[A-_-1]|=(this.data[A]&$)<<Y,K.data[A-_]=this.data[A]>>z;if(z>0)K.data[this.t-_-1]|=(this.s&$)<<Y;K.t=this.t-_,K.clamp()}function UB_(q,K){var _=0,z=0,Y=Math.min(q.t,this.t);while(_<Y)z+=this.data[_]-q.data[_],K.data[_++]=z&this.DM,z>>=this.DB;if(q.t<this.t){z-=q.s;while(_<this.t)z+=this.data[_],K.data[_++]=z&this.DM,z>>=this.DB;z+=this.s}else{z+=this.s;while(_<q.t)z-=q.data[_],K.data[_++]=z&this.DM,z>>=this.DB;z-=q.s}if(K.s=z<0?-1:0,z<-1)K.data[_++]=this.DV+z;else if(z>0)K.data[_++]=z;K.t=_,K.clamp()}function QB_(q,K){var _=this.abs(),z=q.abs(),Y=_.t;K.t=Y+z.t;while(--Y>=0)K.data[Y]=0;for(Y=0;Y<z.t;++Y)K.data[Y+_.t]=_.am(0,z.data[Y],K,Y,0,_.t);if(K.s=0,K.clamp(),this.s!=q.s)m7.ZERO.subTo(K,K)}function dB_(q){var K=this.abs(),_=q.t=2*K.t;while(--_>=0)q.data[_]=0;for(_=0;_<K.t-1;++_){var z=K.am(_,K.data[_],q,2*_,0,1);if((q.data[_+K.t]+=K.am(_+1,2*K.data[_],q,2*_+1,z,K.t-_-1))>=K.DV)q.data[_+K.t]-=K.DV,q.data[_+K.t+1]=1}if(q.t>0)q.data[q.t-1]+=K.am(_,K.data[_],q,2*_,0,1);q.s=0,q.clamp()}function cB_(q,K,_){var z=q.abs();if(z.t<=0)return;var Y=this.abs();if(Y.t<z.t){if(K!=null)K.fromInt(0);if(_!=null)this.copyTo(_);return}if(_==null)_=z$();var $=z$(),A=this.s,O=q.s,w=this.DB-xv8(z.data[z.t-1]);if(w>0)z.lShiftTo(w,$),Y.lShiftTo(w,_);else z.copyTo($),Y.copyTo(_);var j=$.t,H=$.data[j-1];if(H==0)return;var J=H*(1<<this.F1)+(j>1?$.data[j-2]>>this.F2:0),M=this.FV/J,X=(1<<this.F1)/J,P=1<<this.F2,W=_.t,D=W-j,f=K==null?z$():K;if($.dlShiftTo(D,f),_.compareTo(f)>=0)_.data[_.t++]=1,_.subTo(f,_);m7.ONE.dlShiftTo(j,f),f.subTo($,$);while($.t<j)$.data[$.t++]=0;while(--D>=0){var G=_.data[--W]==H?this.DM:Math.floor(_.data[W]*M+(_.data[W-1]+P)*X);if((_.data[W]+=$.am(0,G,_,D,0,j))<G){$.dlShiftTo(D,f),_.subTo(f,_);while(_.data[W]<--G)_.subTo(f,_)}}if(K!=null){if(_.drShiftTo(j,K),A!=O)m7.ZERO.subTo(K,K)}if(_.t=j,_.clamp(),w>0)_.rShiftTo(w,_);if(A<0)m7.ZERO.subTo(_,_)}function lB_(q){var K=z$();if(this.abs().divRemTo(q,null,K),this.s<0&&K.compareTo(m7.ZERO)>0)q.subTo(K,K);return K}function MO6(q){this.m=q}function nB_(q){if(q.s<0||q.compareTo(this.m)>=0)return q.mod(this.m);else return q}function iB_(q){return q}function rB_(q){q.divRemTo(this.m,null,q)}function oB_(q,K,_){q.multiplyTo(K,_),this.reduce(_)}function aB_(q,K){q.squareTo(K),this.reduce(K)}MO6.prototype.convert=nB_;MO6.prototype.revert=iB_;MO6.prototype.reduce=rB_;MO6.prototype.mulTo=oB_;MO6.prototype.sqrTo=aB_;function sB_(){if(this.t<1)return 0;var q=this.data[0];if((q&1)==0)return 0;var K=q&3;return K=K*(2-(q&15)*K)&15,K=K*(2-(q&255)*K)&255,K=K*(2-((q&65535)*K&65535))&65535,K=K*(2-q*K%this.DV)%this.DV,K>0?this.DV-K:-K}function XO6(q){this.m=q,this.mp=q.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<q.DB-15)-1,this.mt2=2*q.t}function tB_(q){var K=z$();if(q.abs().dlShiftTo(this.m.t,K),K.divRemTo(this.m,null,K),q.s<0&&K.compareTo(m7.ZERO)>0)this.m.subTo(K,K);return K}function eB_(q){var K=z$();return q.copyTo(K),this.reduce(K),K}function qg_(q){while(q.t<=this.mt2)q.data[q.t++]=0;for(var K=0;K<this.m.t;++K){var _=q.data[K]&32767,z=_*this.mpl+((_*this.mph+(q.data[K]>>15)*this.mpl&this.um)<<15)&q.DM;_=K+this.m.t,q.data[_]+=this.m.am(0,z,q,K,0,this.m.t);while(q.data[_]>=q.DV)q.data[_]-=q.DV,q.data[++_]++}if(q.clamp(),q.drShiftTo(this.m.t,q),q.compareTo(this.m)>=0)q.subTo(this.m,q)}function Kg_(q,K){q.squareTo(K),this.reduce(K)}function _g_(q,K,_){q.multiplyTo(K,_),this.reduce(_)}XO6.prototype.convert=tB_;XO6.prototype.revert=eB_;XO6.prototype.reduce=qg_;XO6.prototype.mulTo=_g_;XO6.prototype.sqrTo=Kg_;function zg_(){return(this.t>0?this.data[0]&1:this.s)==0}function Yg_(q,K){if(q>4294967295||q<1)return m7.ONE;var _=z$(),z=z$(),Y=K.convert(this),$=xv8(q)-1;Y.copyTo(_);while(--$>=0)if(K.sqrTo(_,z),(q&1<<$)>0)K.mulTo(z,Y,_);else{var A=_;_=z,z=A}return K.revert(_)}function $g_(q,K){var _;if(q<256||K.isEven())_=new MO6(K);else _=new XO6(K);return this.exp(q,_)}m7.prototype.copyTo=RB_;m7.prototype.fromInt=hB_;m7.prototype.fromString=SB_;m7.prototype.clamp=CB_;m7.prototype.dlShiftTo=pB_;m7.prototype.drShiftTo=BB_;m7.prototype.lShiftTo=gB_;m7.prototype.rShiftTo=FB_;m7.prototype.subTo=UB_;m7.prototype.multiplyTo=QB_;m7.prototype.squareTo=dB_;m7.prototype.divRemTo=cB_;m7.prototype.invDigit=sB_;m7.prototype.isEven=zg_;m7.prototype.exp=Yg_;m7.prototype.toString=bB_;m7.prototype.negate=xB_;m7.prototype.abs=IB_;m7.prototype.compareTo=uB_;m7.prototype.bitLength=mB_;m7.prototype.mod=lB_;m7.prototype.modPowInt=$g_;m7.ZERO=C76(0);m7.ONE=C76(1);function Ag_(){var q=z$();return this.copyTo(q),q}function Og_(){if(this.s<0){if(this.t==1)return this.data[0]-this.DV;else if(this.t==0)return-1}else if(this.t==1)return this.data[0];else if(this.t==0)return 0;return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]}function wg_(){return this.t==0?this.s:this.data[0]<<24>>24}function jg_(){return this.t==0?this.s:this.data[0]<<16>>16}function Hg_(q){return Math.floor(Math.LN2*this.DB/Math.log(q))}function Jg_(){if(this.s<0)return-1;else if(this.t<=0||this.t==1&&this.data[0]<=0)return 0;else return 1}function Mg_(q){if(q==null)q=10;if(this.signum()==0||q<2||q>36)return"0";var K=this.chunkSize(q),_=Math.pow(q,K),z=C76(_),Y=z$(),$=z$(),A="";this.divRemTo(z,Y,$);while(Y.signum()>0)A=(_+$.intValue()).toString(q).substr(1)+A,Y.divRemTo(z,Y,$);return $.intValue().toString(q)+A}function Xg_(q,K){if(this.fromInt(0),K==null)K=10;var _=this.chunkSize(K),z=Math.pow(K,_),Y=!1,$=0,A=0;for(var O=0;O<q.length;++O){var w=bO4(q,O);if(w<0){if(q.charAt(O)=="-"&&this.signum()==0)Y=!0;continue}if(A=K*A+w,++$>=_)this.dMultiply(z),this.dAddOffset(A,0),$=0,A=0}if($>0)this.dMultiply(Math.pow(K,$)),this.dAddOffset(A,0);if(Y)m7.ZERO.subTo(this,this)}function Pg_(q,K,_){if(typeof K=="number")if(q<2)this.fromInt(1);else{if(this.fromNumber(q,_),!this.testBit(q-1))this.bitwiseTo(m7.ONE.shiftLeft(q-1),Gb1,this);if(this.isEven())this.dAddOffset(1,0);while(!this.isProbablePrime(K))if(this.dAddOffset(2,0),this.bitLength()>q)this.subTo(m7.ONE.shiftLeft(q-1),this)}else{var z=[],Y=q&7;if(z.length=(q>>3)+1,K.nextBytes(z),Y>0)z[0]&=(1<<Y)-1;else z[0]=0;this.fromString(z,256)}}function Wg_(){var q=this.t,K=[];K[0]=this.s;var _=this.DB-q*this.DB%8,z,Y=0;if(q-- >0){if(_<this.DB&&(z=this.data[q]>>_)!=(this.s&this.DM)>>_)K[Y++]=z|this.s<<this.DB-_;while(q>=0){if(_<8)z=(this.data[q]&(1<<_)-1)<<8-_,z|=this.data[--q]>>(_+=this.DB-8);else if(z=this.data[q]>>(_-=8)&255,_<=0)_+=this.DB,--q;if((z&128)!=0)z|=-256;if(Y==0&&(this.s&128)!=(z&128))++Y;if(Y>0||z!=this.s)K[Y++]=z}}return K}function Dg_(q){return this.compareTo(q)==0}function fg_(q){return this.compareTo(q)<0?this:q}function Zg_(q){return this.compareTo(q)>0?this:q}function Gg_(q,K,_){var z,Y,$=Math.min(q.t,this.t);for(z=0;z<$;++z)_.data[z]=K(this.data[z],q.data[z]);if(q.t<this.t){Y=q.s&this.DM;for(z=$;z<this.t;++z)_.data[z]=K(this.data[z],Y);_.t=this.t}else{Y=this.s&this.DM;for(z=$;z<q.t;++z)_.data[z]=K(Y,q.data[z]);_.t=q.t}_.s=K(this.s,q.s),_.clamp()}function Tg_(q,K){return q&K}function vg_(q){var K=z$();return this.bitwiseTo(q,Tg_,K),K}function Gb1(q,K){return q|K}function kg_(q){var K=z$();return this.bitwiseTo(q,Gb1,K),K}function xO4(q,K){return q^K}function Vg_(q){var K=z$();return this.bitwiseTo(q,xO4,K),K}function IO4(q,K){return q&~K}function Ng_(q){var K=z$();return this.bitwiseTo(q,IO4,K),K}function yg_(){var q=z$();for(var K=0;K<this.t;++K)q.data[K]=this.DM&~this.data[K];return q.t=this.t,q.s=~this.s,q}function Eg_(q){var K=z$();if(q<0)this.rShiftTo(-q,K);else this.lShiftTo(q,K);return K}function Lg_(q){var K=z$();if(q<0)this.lShiftTo(-q,K);else this.rShiftTo(q,K);return K}function Rg_(q){if(q==0)return-1;var K=0;if((q&65535)==0)q>>=16,K+=16;if((q&255)==0)q>>=8,K+=8;if((q&15)==0)q>>=4,K+=4;if((q&3)==0)q>>=2,K+=2;if((q&1)==0)++K;return K}function hg_(){for(var q=0;q<this.t;++q)if(this.data[q]!=0)return q*this.DB+Rg_(this.data[q]);if(this.s<0)return this.t*this.DB;return-1}function Sg_(q){var K=0;while(q!=0)q&=q-1,++K;return K}function Cg_(){var q=0,K=this.s&this.DM;for(var _=0;_<this.t;++_)q+=Sg_(this.data[_]^K);return q}function bg_(q){var K=Math.floor(q/this.DB);if(K>=this.t)return this.s!=0;return(this.data[K]&1<<q%this.DB)!=0}function xg_(q,K){var _=m7.ONE.shiftLeft(q);return this.bitwiseTo(_,K,_),_}function Ig_(q){return this.changeBit(q,Gb1)}function ug_(q){return this.changeBit(q,IO4)}function mg_(q){return this.changeBit(q,xO4)}function pg_(q,K){var _=0,z=0,Y=Math.min(q.t,this.t);while(_<Y)z+=this.data[_]+q.data[_],K.data[_++]=z&this.DM,z>>=this.DB;if(q.t<this.t){z+=q.s;while(_<this.t)z+=this.data[_],K.data[_++]=z&this.DM,z>>=this.DB;z+=this.s}else{z+=this.s;while(_<q.t)z+=q.data[_],K.data[_++]=z&this.DM,z>>=this.DB;z+=q.s}if(K.s=z<0?-1:0,z>0)K.data[_++]=z;else if(z<-1)K.data[_++]=this.DV+z;K.t=_,K.clamp()}function Bg_(q){var K=z$();return this.addTo(q,K),K}function gg_(q){var K=z$();return this.subTo(q,K),K}function Fg_(q){var K=z$();return this.multiplyTo(q,K),K}function Ug_(q){var K=z$();return this.divRemTo(q,K,null),K}function Qg_(q){var K=z$();return this.divRemTo(q,null,K),K}function dg_(q){var K=z$(),_=z$();return this.divRemTo(q,K,_),[K,_]}function cg_(q){this.data[this.t]=this.am(0,q-1,this,0,0,this.t),++this.t,this.clamp()}function lg_(q,K){if(q==0)return;while(this.t<=K)this.data[this.t++]=0;this.data[K]+=q;while(this.data[K]>=this.DV){if(this.data[K]-=this.DV,++K>=this.t)this.data[this.t++]=0;++this.data[K]}}function Li6(){}function uO4(q){return q}function ng_(q,K,_){q.multiplyTo(K,_)}function ig_(q,K){q.squareTo(K)}Li6.prototype.convert=uO4;Li6.prototype.revert=uO4;Li6.prototype.mulTo=ng_;Li6.prototype.sqrTo=ig_;function rg_(q){return this.exp(q,new Li6)}function og_(q,K,_){var z=Math.min(this.t+q.t,K);_.s=0,_.t=z;while(z>0)_.data[--z]=0;var Y;for(Y=_.t-this.t;z<Y;++z)_.data[z+this.t]=this.am(0,q.data[z],_,z,0,this.t);for(Y=Math.min(q.t,K);z<Y;++z)this.am(0,q.data[z],_,z,0,K-z);_.clamp()}function ag_(q,K,_){--K;var z=_.t=this.t+q.t-K;_.s=0;while(--z>=0)_.data[z]=0;for(z=Math.max(K-this.t,0);z<q.t;++z)_.data[this.t+z-K]=this.am(K-z,q.data[z],_,0,0,this.t+z-K);_.clamp(),_.drShiftTo(1,_)}function Ok6(q){this.r2=z$(),this.q3=z$(),m7.ONE.dlShiftTo(2*q.t,this.r2),this.mu=this.r2.divide(q),this.m=q}function sg_(q){if(q.s<0||q.t>2*this.m.t)return q.mod(this.m);else if(q.compareTo(this.m)<0)return q;else{var K=z$();return q.copyTo(K),this.reduce(K),K}}function tg_(q){return q}function eg_(q){if(q.drShiftTo(this.m.t-1,this.r2),q.t>this.m.t+1)q.t=this.m.t+1,q.clamp();this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);while(q.compareTo(this.r2)<0)q.dAddOffset(1,this.m.t+1);q.subTo(this.r2,q);while(q.compareTo(this.m)>=0)q.subTo(this.m,q)}function qF_(q,K){q.squareTo(K),this.reduce(K)}function KF_(q,K,_){q.multiplyTo(K,_),this.reduce(_)}Ok6.prototype.convert=sg_;Ok6.prototype.revert=tg_;Ok6.prototype.reduce=eg_;Ok6.prototype.mulTo=KF_;Ok6.prototype.sqrTo=qF_;function _F_(q,K){var _=q.bitLength(),z,Y=C76(1),$;if(_<=0)return Y;else if(_<18)z=1;else if(_<48)z=3;else if(_<144)z=4;else if(_<768)z=5;else z=6;if(_<8)$=new MO6(K);else if(K.isEven())$=new Ok6(K);else $=new XO6(K);var A=[],O=3,w=z-1,j=(1<<z)-1;if(A[1]=$.convert(this),z>1){var H=z$();$.sqrTo(A[1],H);while(O<=j)A[O]=z$(),$.mulTo(H,A[O-2],A[O]),O+=2}var J=q.t-1,M,X=!0,P=z$(),W;_=xv8(q.data[J])-1;while(J>=0){if(_>=w)M=q.data[J]>>_-w&j;else if(M=(q.data[J]&(1<<_+1)-1)<<w-_,J>0)M|=q.data[J-1]>>this.DB+_-w;O=z;while((M&1)==0)M>>=1,--O;if((_-=O)<0)_+=this.DB,--J;if(X)A[M].copyTo(Y),X=!1;else{while(O>1)$.sqrTo(Y,P),$.sqrTo(P,Y),O-=2;if(O>0)$.sqrTo(Y,P);else W=Y,Y=P,P=W;$.mulTo(P,A[M],Y)}while(J>=0&&(q.data[J]&1<<_)==0)if($.sqrTo(Y,P),W=Y,Y=P,P=W,--_<0)_=this.DB-1,--J}return $.revert(Y)}function zF_(q){var K=this.s<0?this.negate():this.clone(),_=q.s<0?q.negate():q.clone();if(K.compareTo(_)<0){var z=K;K=_,_=z}var Y=K.getLowestSetBit(),$=_.getLowestSetBit();if($<0)return K;if(Y<$)$=Y;if($>0)K.rShiftTo($,K),_.rShiftTo($,_);while(K.signum()>0){if((Y=K.getLowestSetBit())>0)K.rShiftTo(Y,K);if((Y=_.getLowestSetBit())>0)_.rShiftTo(Y,_);if(K.compareTo(_)>=0)K.subTo(_,K),K.rShiftTo(1,K);else _.subTo(K,_),_.rShiftTo(1,_)}if($>0)_.lShiftTo($,_);return _}function YF_(q){if(q<=0)return 0;var K=this.DV%q,_=this.s<0?q-1:0;if(this.t>0)if(K==0)_=this.data[0]%q;else for(var z=this.t-1;z>=0;--z)_=(K*_+this.data[z])%q;return _}function $F_(q){var K=q.isEven();if(this.isEven()&&K||q.signum()==0)return m7.ZERO;var _=q.clone(),z=this.clone(),Y=C76(1),$=C76(0),A=C76(0),O=C76(1);while(_.signum()!=0){while(_.isEven()){if(_.rShiftTo(1,_),K){if(!Y.isEven()||!$.isEven())Y.addTo(this,Y),$.subTo(q,$);Y.rShiftTo(1,Y)}else if(!$.isEven())$.subTo(q,$);$.rShiftTo(1,$)}while(z.isEven()){if(z.rShiftTo(1,z),K){if(!A.isEven()||!O.isEven())A.addTo(this,A),O.subTo(q,O);A.rShiftTo(1,A)}else if(!O.isEven())O.subTo(q,O);O.rShiftTo(1,O)}if(_.compareTo(z)>=0){if(_.subTo(z,_),K)Y.subTo(A,Y);$.subTo(O,$)}else{if(z.subTo(_,z),K)A.subTo(Y,A);O.subTo($,O)}}if(z.compareTo(m7.ONE)!=0)return m7.ZERO;if(O.compareTo(q)>=0)return O.subtract(q);if(O.signum()<0)O.addTo(q,O);else return O;if(O.signum()<0)return O.add(q);else return O}var uu=[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],AF_=67108864/uu[uu.length-1];function OF_(q){var K,_=this.abs();if(_.t==1&&_.data[0]<=uu[uu.length-1]){for(K=0;K<uu.length;++K)if(_.data[0]==uu[K])return!0;return!1}if(_.isEven())return!1;K=1;while(K<uu.length){var z=uu[K],Y=K+1;while(Y<uu.length&&z<AF_)z*=uu[Y++];z=_.modInt(z);while(K<Y)if(z%uu[K++]==0)return!1}return _.millerRabin(q)}function wF_(q){var K=this.subtract(m7.ONE),_=K.getLowestSetBit();if(_<=0)return!1;var z=K.shiftRight(_),Y=jF_(),$;for(var A=0;A<q;++A){do $=new m7(this.bitLength(),Y);while($.compareTo(m7.ONE)<=0||$.compareTo(K)>=0);var O=$.modPow(z,this);if(O.compareTo(m7.ONE)!=0&&O.compareTo(K)!=0){var w=1;while(w++<_&&O.compareTo(K)!=0)if(O=O.modPowInt(2,this),O.compareTo(m7.ONE)==0)return!1;if(O.compareTo(K)!=0)return!1}}return!0}function jF_(){return{nextBytes:function(q){for(var K=0;K<q.length;++K)q[K]=Math.floor(Math.random()*256)}}}m7.prototype.chunkSize=Hg_;m7.prototype.toRadix=Mg_;m7.prototype.fromRadix=Xg_;m7.prototype.fromNumber=Pg_;m7.prototype.bitwiseTo=Gg_;m7.prototype.changeBit=xg_;m7.prototype.addTo=pg_;m7.prototype.dMultiply=cg_;m7.prototype.dAddOffset=lg_;m7.prototype.multiplyLowerTo=og_;m7.prototype.multiplyUpperTo=ag_;m7.prototype.modInt=YF_;m7.prototype.millerRabin=wF_;m7.prototype.clone=Ag_;m7.prototype.intValue=Og_;m7.prototype.byteValue=wg_;m7.prototype.shortValue=jg_;m7.prototype.signum=Jg_;m7.prototype.toByteArray=Wg_;m7.prototype.equals=Dg_;m7.prototype.min=fg_;m7.prototype.max=Zg_;m7.prototype.and=vg_;m7.prototype.or=kg_;m7.prototype.xor=Vg_;m7.prototype.andNot=Ng_;m7.prototype.not=yg_;m7.prototype.shiftLeft=Eg_;m7.prototype.shiftRight=Lg_;m7.prototype.getLowestSetBit=hg_;m7.prototype.bitCount=Cg_;m7.prototype.testBit=bg_;m7.prototype.setBit=Ig_;m7.prototype.clearBit=ug_;m7.prototype.flipBit=mg_;m7.prototype.add=Bg_;m7.prototype.subtract=gg_;m7.prototype.multiply=Fg_;m7.prototype.divide=Ug_;m7.prototype.remainder=Qg_;m7.prototype.divideAndRemainder=dg_;m7.prototype.modPow=_F_;m7.prototype.modInverse=$F_;m7.prototype.pow=rg_;m7.prototype.gcd=zF_;m7.prototype.isProbablePrime=OF_});var wk6=m((jlA,FO4)=>{var gF=E_();IF();_$();var BO4=FO4.exports=gF.sha1=gF.sha1||{};gF.md.sha1=gF.md.algorithms.sha1=BO4;BO4.create=function(){if(!gO4)HF_();var q=null,K=gF.util.createBuffer(),_=Array(80),z={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8};return z.start=function(){z.messageLength=0,z.fullMessageLength=z.messageLength64=[];var Y=z.messageLengthSize/4;for(var $=0;$<Y;++$)z.fullMessageLength.push(0);return K=gF.util.createBuffer(),q={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},z},z.start(),z.update=function(Y,$){if($==="utf8")Y=gF.util.encodeUtf8(Y);var A=Y.length;z.messageLength+=A,A=[A/4294967296>>>0,A>>>0];for(var O=z.fullMessageLength.length-1;O>=0;--O)z.fullMessageLength[O]+=A[1],A[1]=A[0]+(z.fullMessageLength[O]/4294967296>>>0),z.fullMessageLength[O]=z.fullMessageLength[O]>>>0,A[0]=A[1]/4294967296>>>0;if(K.putBytes(Y),pO4(q,_,K),K.read>2048||K.length()===0)K.compact();return z},z.digest=function(){var Y=gF.util.createBuffer();Y.putBytes(K.bytes());var $=z.fullMessageLength[z.fullMessageLength.length-1]+z.messageLengthSize,A=$&z.blockLength-1;Y.putBytes(Tb1.substr(0,z.blockLength-A));var O,w,j=z.fullMessageLength[0]*8;for(var H=0;H<z.fullMessageLength.length-1;++H)O=z.fullMessageLength[H+1]*8,w=O/4294967296>>>0,j+=w,Y.putInt32(j>>>0),j=O>>>0;Y.putInt32(j);var J={h0:q.h0,h1:q.h1,h2:q.h2,h3:q.h3,h4:q.h4};pO4(J,_,Y);var M=gF.util.createBuffer();return M.putInt32(J.h0),M.putInt32(J.h1),M.putInt32(J.h2),M.putInt32(J.h3),M.putInt32(J.h4),M},z};var Tb1=null,gO4=!1;function HF_(){Tb1=String.fromCharCode(128),Tb1+=gF.util.fillString(String.fromCharCode(0),64),gO4=!0}function pO4(q,K,_){var z,Y,$,A,O,w,j,H,J=_.length();while(J>=64){Y=q.h0,$=q.h1,A=q.h2,O=q.h3,w=q.h4;for(H=0;H<16;++H)z=_.getInt32(),K[H]=z,j=O^$&(A^O),z=(Y<<5|Y>>>27)+j+w+1518500249+z,w=O,O=A,A=($<<30|$>>>2)>>>0,$=Y,Y=z;for(;H<20;++H)z=K[H-3]^K[H-8]^K[H-14]^K[H-16],z=z<<1|z>>>31,K[H]=z,j=O^$&(A^O),z=(Y<<5|Y>>>27)+j+w+1518500249+z,w=O,O=A,A=($<<30|$>>>2)>>>0,$=Y,Y=z;for(;H<32;++H)z=K[H-3]^K[H-8]^K[H-14]^K[H-16],z=z<<1|z>>>31,K[H]=z,j=$^A^O,z=(Y<<5|Y>>>27)+j+w+1859775393+z,w=O,O=A,A=($<<30|$>>>2)>>>0,$=Y,Y=z;for(;H<40;++H)z=K[H-6]^K[H-16]^K[H-28]^K[H-32],z=z<<2|z>>>30,K[H]=z,j=$^A^O,z=(Y<<5|Y>>>27)+j+w+1859775393+z,w=O,O=A,A=($<<30|$>>>2)>>>0,$=Y,Y=z;for(;H<60;++H)z=K[H-6]^K[H-16]^K[H-28]^K[H-32],z=z<<2|z>>>30,K[H]=z,j=$&A|O&($^A),z=(Y<<5|Y>>>27)+j+w+2400959708+z,w=O,O=A,A=($<<30|$>>>2)>>>0,$=Y,Y=z;for(;H<80;++H)z=K[H-6]^K[H-16]^K[H-28]^K[H-32],z=z<<2|z>>>30,K[H]=z,j=$^A^O,z=(Y<<5|Y>>>27)+j+w+3395469782+z,w=O,O=A,A=($<<30|$>>>2)>>>0,$=Y,Y=z;q.h0=q.h0+Y|0,q.h1=q.h1+$|0,q.h2=q.h2+A|0,q.h3=q.h3+O|0,q.h4=q.h4+w|0,J-=64}}});var vb1=m((HlA,QO4)=>{var FF=E_();_$();WC();wk6();var UO4=QO4.exports=FF.pkcs1=FF.pkcs1||{};UO4.encode_rsa_oaep=function(q,K,_){var z,Y,$,A;if(typeof _==="string")z=_,Y=arguments[3]||void 0,$=arguments[4]||void 0;else if(_){if(z=_.label||void 0,Y=_.seed||void 0,$=_.md||void 0,_.mgf1&&_.mgf1.md)A=_.mgf1.md}if(!$)$=FF.md.sha1.create();else $.start();if(!A)A=$;var O=Math.ceil(q.n.bitLength()/8),w=O-2*$.digestLength-2;if(K.length>w){var j=Error("RSAES-OAEP input message length is too long.");throw j.length=K.length,j.maxLength=w,j}if(!z)z="";$.update(z,"raw");var H=$.digest(),J="",M=w-K.length;for(var X=0;X<M;X++)J+="\x00";var P=H.getBytes()+J+"\x01"+K;if(!Y)Y=FF.random.getBytes($.digestLength);else if(Y.length!==$.digestLength){var j=Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.");throw j.seedLength=Y.length,j.digestLength=$.digestLength,j}var W=Iv8(Y,O-$.digestLength-1,A),D=FF.util.xorBytes(P,W,P.length),f=Iv8(D,$.digestLength,A),G=FF.util.xorBytes(Y,f,Y.length);return"\x00"+G+D};UO4.decode_rsa_oaep=function(q,K,_){var z,Y,$;if(typeof _==="string")z=_,Y=arguments[3]||void 0;else if(_){if(z=_.label||void 0,Y=_.md||void 0,_.mgf1&&_.mgf1.md)$=_.mgf1.md}var A=Math.ceil(q.n.bitLength()/8);if(K.length!==A){var D=Error("RSAES-OAEP encoded message length is invalid.");throw D.length=K.length,D.expectedLength=A,D}if(Y===void 0)Y=FF.md.sha1.create();else Y.start();if(!$)$=Y;if(A<2*Y.digestLength+2)throw Error("RSAES-OAEP key is too short for the hash function.");if(!z)z="";Y.update(z,"raw");var O=Y.digest().getBytes(),w=K.charAt(0),j=K.substring(1,Y.digestLength+1),H=K.substring(1+Y.digestLength),J=Iv8(H,Y.digestLength,$),M=FF.util.xorBytes(j,J,j.length),X=Iv8(M,A-Y.digestLength-1,$),P=FF.util.xorBytes(H,X,H.length),W=P.substring(0,Y.digestLength),D=w!=="\x00";for(var f=0;f<Y.digestLength;++f)D|=O.charAt(f)!==W.charAt(f);var G=1,Z=Y.digestLength;for(var T=Y.digestLength;T<P.length;T++){var v=P.charCodeAt(T),V=v&1^1,E=G?65534:0;D|=v&E,G=G&V,Z+=G}if(D||P.charCodeAt(Z)!==1)throw Error("Invalid RSAES-OAEP padding.");return P.substring(Z+1)};function Iv8(q,K,_){if(!_)_=FF.md.sha1.create();var z="",Y=Math.ceil(K/_.digestLength);for(var $=0;$<Y;++$){var A=String.fromCharCode($>>24&255,$>>16&255,$>>8&255,$&255);_.start(),_.update(q+A),z+=_.digest().getBytes()}return z.substring(0,K)}});var Vb1=m((JlA,kb1)=>{var b76=E_();_$();Ri6();WC();(function(){if(b76.prime){kb1.exports=b76.prime;return}var q=kb1.exports=b76.prime=b76.prime||{},K=b76.jsbn.BigInteger,_=[6,4,2,4,2,4,6,2],z=new K(null);z.fromInt(30);var Y=function(J,M){return J|M};q.generateProbablePrime=function(J,M,X){if(typeof M==="function")X=M,M={};M=M||{};var P=M.algorithm||"PRIMEINC";if(typeof P==="string")P={name:P};P.options=P.options||{};var W=M.prng||b76.random,D={nextBytes:function(f){var G=W.getBytesSync(f.length);for(var Z=0;Z<f.length;++Z)f[Z]=G.charCodeAt(Z)}};if(P.name==="PRIMEINC")return $(J,D,P.options,X);throw Error("Invalid prime generation algorithm: "+P.name)};function $(J,M,X,P){if("workers"in X)return w(J,M,X,P);return A(J,M,X,P)}function A(J,M,X,P){var W=j(J,M),D=0,f=H(W.bitLength());if("millerRabinTests"in X)f=X.millerRabinTests;var G=10;if("maxBlockTime"in X)G=X.maxBlockTime;O(W,J,M,D,f,G,P)}function O(J,M,X,P,W,D,f){var G=+new Date;do{if(J.bitLength()>M)J=j(M,X);if(J.isProbablePrime(W))return f(null,J);J.dAddOffset(_[P++%8],0)}while(D<0||+new Date-G<D);b76.util.setImmediate(function(){O(J,M,X,P,W,D,f)})}function w(J,M,X,P){if(typeof Worker>"u")return A(J,M,X,P);var W=j(J,M),D=X.workers,f=X.workLoad||100,G=f*30/8,Z=X.workerScript||"forge/prime.worker.js";if(D===-1)return b76.util.estimateCores(function(v,V){if(v)V=2;D=V-1,T()});T();function T(){D=Math.max(1,D);var v=[];for(var V=0;V<D;++V)v[V]=new Worker(Z);var E=D;for(var V=0;V<D;++V)v[V].addEventListener("message",R);var S=!1;function R(x){if(S)return;--E;var I=x.data;if(I.found){for(var B=0;B<v.length;++B)v[B].terminate();return S=!0,P(null,new K(I.prime,16))}if(W.bitLength()>J)W=j(J,M);var p=W.toString(16);x.target.postMessage({hex:p,workLoad:f}),W.dAddOffset(G,0)}}}function j(J,M){var X=new K(J,M),P=J-1;if(!X.testBit(P))X.bitwiseTo(K.ONE.shiftLeft(P),Y,X);return X.dAddOffset(31-X.mod(z).byteValue(),0),X}function H(J){if(J<=100)return 27;if(J<=150)return 18;if(J<=200)return 15;if(J<=250)return 12;if(J<=300)return 9;if(J<=350)return 8;if(J<=400)return 7;if(J<=500)return 6;if(J<=600)return 5;if(J<=800)return 4;if(J<=1250)return 3;return 2}})()});var hi6=m((MlA,oO4)=>{var f5=E_();Iu();Ri6();S76();vb1();Vb1();WC();_$();if(typeof jY>"u")jY=f5.jsbn.BigInteger;var jY,Nb1=f5.util.isNodejs?U6("crypto"):null,y1=f5.asn1,fC=f5.util;f5.pki=f5.pki||{};oO4.exports=f5.pki.rsa=f5.rsa=f5.rsa||{};var x9=f5.pki,JF_=[6,4,2,4,2,4,6,2],MF_={name:"PrivateKeyInfo",tagClass:y1.Class.UNIVERSAL,type:y1.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:y1.Class.UNIVERSAL,type:y1.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:y1.Class.UNIVERSAL,type:y1.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:y1.Class.UNIVERSAL,type:y1.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:y1.Class.UNIVERSAL,type:y1.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},XF_={name:"RSAPrivateKey",tagClass:y1.Class.UNIVERSAL,type:y1.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:y1.Class.UNIVERSAL,type:y1.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:y1.Class.UNIVERSAL,type:y1.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:y1.Class.UNIVERSAL,type:y1.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:y1.Class.UNIVERSAL,type:y1.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:y1.Class.UNIVERSAL,type:y1.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:y1.Class.UNIVERSAL,type:y1.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:y1.Class.UNIVERSAL,type:y1.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:y1.Class.UNIVERSAL,type:y1.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:y1.Class.UNIVERSAL,type:y1.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},PF_={name:"RSAPublicKey",tagClass:y1.Class.UNIVERSAL,type:y1.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:y1.Class.UNIVERSAL,type:y1.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:y1.Class.UNIVERSAL,type:y1.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},WF_=f5.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:y1.Class.UNIVERSAL,type:y1.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:y1.Class.UNIVERSAL,type:y1.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:y1.Class.UNIVERSAL,type:y1.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:y1.Class.UNIVERSAL,type:y1.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:y1.Class.UNIVERSAL,type:y1.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},DF_={name:"DigestInfo",tagClass:y1.Class.UNIVERSAL,type:y1.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm",tagClass:y1.Class.UNIVERSAL,type:y1.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm.algorithmIdentifier",tagClass:y1.Class.UNIVERSAL,type:y1.Type.OID,constructed:!1,capture:"algorithmIdentifier"},{name:"DigestInfo.DigestAlgorithm.parameters",tagClass:y1.Class.UNIVERSAL,type:y1.Type.NULL,capture:"parameters",optional:!0,constructed:!1}]},{name:"DigestInfo.digest",tagClass:y1.Class.UNIVERSAL,type:y1.Type.OCTETSTRING,constructed:!1,capture:"digest"}]},fF_=function(q){var K;if(q.algorithm in x9.oids)K=x9.oids[q.algorithm];else{var _=Error("Unknown message digest algorithm.");throw _.algorithm=q.algorithm,_}var z=y1.oidToDer(K).getBytes(),Y=y1.create(y1.Class.UNIVERSAL,y1.Type.SEQUENCE,!0,[]),$=y1.create(y1.Class.UNIVERSAL,y1.Type.SEQUENCE,!0,[]);$.value.push(y1.create(y1.Class.UNIVERSAL,y1.Type.OID,!1,z)),$.value.push(y1.create(y1.Class.UNIVERSAL,y1.Type.NULL,!1,""));var A=y1.create(y1.Class.UNIVERSAL,y1.Type.OCTETSTRING,!1,q.digest().getBytes());return Y.value.push($),Y.value.push(A),y1.toDer(Y).getBytes()},iO4=function(q,K,_){if(_)return q.modPow(K.e,K.n);if(!K.p||!K.q)return q.modPow(K.d,K.n);if(!K.dP)K.dP=K.d.mod(K.p.subtract(jY.ONE));if(!K.dQ)K.dQ=K.d.mod(K.q.subtract(jY.ONE));if(!K.qInv)K.qInv=K.q.modInverse(K.p);var z;do z=new jY(f5.util.bytesToHex(f5.random.getBytes(K.n.bitLength()/8)),16);while(z.compareTo(K.n)>=0||!z.gcd(K.n).equals(jY.ONE));q=q.multiply(z.modPow(K.e,K.n)).mod(K.n);var Y=q.mod(K.p).modPow(K.dP,K.p),$=q.mod(K.q).modPow(K.dQ,K.q);while(Y.compareTo($)<0)Y=Y.add(K.p);var A=Y.subtract($).multiply(K.qInv).mod(K.p).multiply(K.q).add($);return A=A.multiply(z.modInverse(K.n)).mod(K.n),A};x9.rsa.encrypt=function(q,K,_){var z=_,Y,$=Math.ceil(K.n.bitLength()/8);if(_!==!1&&_!==!0)z=_===2,Y=rO4(q,K,_);else Y=f5.util.createBuffer(),Y.putBytes(q);var A=new jY(Y.toHex(),16),O=iO4(A,K,z),w=O.toString(16),j=f5.util.createBuffer(),H=$-Math.ceil(w.length/2);while(H>0)j.putByte(0),--H;return j.putBytes(f5.util.hexToBytes(w)),j.getBytes()};x9.rsa.decrypt=function(q,K,_,z){var Y=Math.ceil(K.n.bitLength()/8);if(q.length!==Y){var $=Error("Encrypted message length is invalid.");throw $.length=q.length,$.expected=Y,$}var A=new jY(f5.util.createBuffer(q).toHex(),16);if(A.compareTo(K.n)>=0)throw Error("Encrypted message is invalid.");var O=iO4(A,K,_),w=O.toString(16),j=f5.util.createBuffer(),H=Y-Math.ceil(w.length/2);while(H>0)j.putByte(0),--H;if(j.putBytes(f5.util.hexToBytes(w)),z!==!1)return uv8(j.getBytes(),K,_);return j.getBytes()};x9.rsa.createKeyPairGenerationState=function(q,K,_){if(typeof q==="string")q=parseInt(q,10);q=q||2048,_=_||{};var z=_.prng||f5.random,Y={nextBytes:function(O){var w=z.getBytesSync(O.length);for(var j=0;j<O.length;++j)O[j]=w.charCodeAt(j)}},$=_.algorithm||"PRIMEINC",A;if($==="PRIMEINC")A={algorithm:$,state:0,bits:q,rng:Y,eInt:K||65537,e:new jY(null),p:null,q:null,qBits:q>>1,pBits:q-(q>>1),pqState:0,num:null,keys:null},A.e.fromInt(A.eInt);else throw Error("Invalid key generation algorithm: "+$);return A};x9.rsa.stepKeyPairGenerationState=function(q,K){if(!("algorithm"in q))q.algorithm="PRIMEINC";var _=new jY(null);_.fromInt(30);var z=0,Y=function(J,M){return J|M},$=+new Date,A,O=0;while(q.keys===null&&(K<=0||O<K)){if(q.state===0){var w=q.p===null?q.pBits:q.qBits,j=w-1;if(q.pqState===0){if(q.num=new jY(w,q.rng),!q.num.testBit(j))q.num.bitwiseTo(jY.ONE.shiftLeft(j),Y,q.num);q.num.dAddOffset(31-q.num.mod(_).byteValue(),0),z=0,++q.pqState}else if(q.pqState===1)if(q.num.bitLength()>w)q.pqState=0;else if(q.num.isProbablePrime(GF_(q.num.bitLength())))++q.pqState;else q.num.dAddOffset(JF_[z++%8],0);else if(q.pqState===2)q.pqState=q.num.subtract(jY.ONE).gcd(q.e).compareTo(jY.ONE)===0?3:0;else if(q.pqState===3){if(q.pqState=0,q.p===null)q.p=q.num;else q.q=q.num;if(q.p!==null&&q.q!==null)++q.state;q.num=null}}else if(q.state===1){if(q.p.compareTo(q.q)<0)q.num=q.p,q.p=q.q,q.q=q.num;++q.state}else if(q.state===2)q.p1=q.p.subtract(jY.ONE),q.q1=q.q.subtract(jY.ONE),q.phi=q.p1.multiply(q.q1),++q.state;else if(q.state===3)if(q.phi.gcd(q.e).compareTo(jY.ONE)===0)++q.state;else q.p=null,q.q=null,q.state=0;else if(q.state===4)if(q.n=q.p.multiply(q.q),q.n.bitLength()===q.bits)++q.state;else q.q=null,q.state=0;else if(q.state===5){var H=q.e.modInverse(q.phi);q.keys={privateKey:x9.rsa.setPrivateKey(q.n,q.e,H,q.p,q.q,H.mod(q.p1),H.mod(q.q1),q.q.modInverse(q.p)),publicKey:x9.rsa.setPublicKey(q.n,q.e)}}A=+new Date,O+=A-$,$=A}return q.keys!==null};x9.rsa.generateKeyPair=function(q,K,_,z){if(arguments.length===1){if(typeof q==="object")_=q,q=void 0;else if(typeof q==="function")z=q,q=void 0}else if(arguments.length===2)if(typeof q==="number"){if(typeof K==="function")z=K,K=void 0;else if(typeof K!=="number")_=K,K=void 0}else _=q,z=K,q=void 0,K=void 0;else if(arguments.length===3)if(typeof K==="number"){if(typeof _==="function")z=_,_=void 0}else z=_,_=K,K=void 0;if(_=_||{},q===void 0)q=_.bits||2048;if(K===void 0)K=_.e||65537;if(!f5.options.usePureJavaScript&&!_.prng&&q>=256&&q<=16384&&(K===65537||K===3)){if(z){if(dO4("generateKeyPair"))return Nb1.generateKeyPair("rsa",{modulusLength:q,publicExponent:K,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(O,w,j){if(O)return z(O);z(null,{privateKey:x9.privateKeyFromPem(j),publicKey:x9.publicKeyFromPem(w)})});if(cO4("generateKey")&&cO4("exportKey"))return fC.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:q,publicExponent:nO4(K),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(O){return fC.globalScope.crypto.subtle.exportKey("pkcs8",O.privateKey)}).then(void 0,function(O){z(O)}).then(function(O){if(O){var w=x9.privateKeyFromAsn1(y1.fromDer(f5.util.createBuffer(O)));z(null,{privateKey:w,publicKey:x9.setRsaPublicKey(w.n,w.e)})}});if(lO4("generateKey")&&lO4("exportKey")){var Y=fC.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:q,publicExponent:nO4(K),hash:{name:"SHA-256"}},!0,["sign","verify"]);Y.oncomplete=function(O){var w=O.target.result,j=fC.globalScope.msCrypto.subtle.exportKey("pkcs8",w.privateKey);j.oncomplete=function(H){var J=H.target.result,M=x9.privateKeyFromAsn1(y1.fromDer(f5.util.createBuffer(J)));z(null,{privateKey:M,publicKey:x9.setRsaPublicKey(M.n,M.e)})},j.onerror=function(H){z(H)}},Y.onerror=function(O){z(O)};return}}else if(dO4("generateKeyPairSync")){var $=Nb1.generateKeyPairSync("rsa",{modulusLength:q,publicExponent:K,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:x9.privateKeyFromPem($.privateKey),publicKey:x9.publicKeyFromPem($.publicKey)}}}var A=x9.rsa.createKeyPairGenerationState(q,K,_);if(!z)return x9.rsa.stepKeyPairGenerationState(A,0),A.keys;ZF_(A,_,z)};x9.setRsaPublicKey=x9.rsa.setPublicKey=function(q,K){var _={n:q,e:K};return _.encrypt=function(z,Y,$){if(typeof Y==="string")Y=Y.toUpperCase();else if(Y===void 0)Y="RSAES-PKCS1-V1_5";if(Y==="RSAES-PKCS1-V1_5")Y={encode:function(O,w,j){return rO4(O,w,2).getBytes()}};else if(Y==="RSA-OAEP"||Y==="RSAES-OAEP")Y={encode:function(O,w){return f5.pkcs1.encode_rsa_oaep(w,O,$)}};else if(["RAW","NONE","NULL",null].indexOf(Y)!==-1)Y={encode:function(O){return O}};else if(typeof Y==="string")throw Error('Unsupported encryption scheme: "'+Y+'".');var A=Y.encode(z,_,!0);return x9.rsa.encrypt(A,_,!0)},_.verify=function(z,Y,$,A){if(typeof $==="string")$=$.toUpperCase();else if($===void 0)$="RSASSA-PKCS1-V1_5";if(A===void 0)A={_parseAllDigestBytes:!0};if(!("_parseAllDigestBytes"in A))A._parseAllDigestBytes=!0;if($==="RSASSA-PKCS1-V1_5")$={verify:function(w,j){j=uv8(j,_,!0);var H=y1.fromDer(j,{parseAllBytes:A._parseAllDigestBytes}),J={},M=[];if(!y1.validate(H,DF_,J,M)){var X=Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.");throw X.errors=M,X}var P=y1.derToOid(J.algorithmIdentifier);if(!(P===f5.oids.md2||P===f5.oids.md5||P===f5.oids.sha1||P===f5.oids.sha224||P===f5.oids.sha256||P===f5.oids.sha384||P===f5.oids.sha512||P===f5.oids["sha512-224"]||P===f5.oids["sha512-256"])){var X=Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.");throw X.oid=P,X}if(P===f5.oids.md2||P===f5.oids.md5){if(!("parameters"in J))throw Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value. Missing algorithm identifier NULL parameters.")}return w===J.digest}};else if($==="NONE"||$==="NULL"||$===null)$={verify:function(w,j){return j=uv8(j,_,!0),w===j}};var O=x9.rsa.decrypt(Y,_,!0,!1);return $.verify(z,O,_.n.bitLength())},_};x9.setRsaPrivateKey=x9.rsa.setPrivateKey=function(q,K,_,z,Y,$,A,O){var w={n:q,e:K,d:_,p:z,q:Y,dP:$,dQ:A,qInv:O};return w.decrypt=function(j,H,J){if(typeof H==="string")H=H.toUpperCase();else if(H===void 0)H="RSAES-PKCS1-V1_5";var M=x9.rsa.decrypt(j,w,!1,!1);if(H==="RSAES-PKCS1-V1_5")H={decode:uv8};else if(H==="RSA-OAEP"||H==="RSAES-OAEP")H={decode:function(X,P){return f5.pkcs1.decode_rsa_oaep(P,X,J)}};else if(["RAW","NONE","NULL",null].indexOf(H)!==-1)H={decode:function(X){return X}};else throw Error('Unsupported encryption scheme: "'+H+'".');return H.decode(M,w,!1)},w.sign=function(j,H){var J=!1;if(typeof H==="string")H=H.toUpperCase();if(H===void 0||H==="RSASSA-PKCS1-V1_5")H={encode:fF_},J=1;else if(H==="NONE"||H==="NULL"||H===null)H={encode:function(){return j}},J=1;var M=H.encode(j,w.n.bitLength());return x9.rsa.encrypt(M,w,J)},w};x9.wrapRsaPrivateKey=function(q){return y1.create(y1.Class.UNIVERSAL,y1.Type.SEQUENCE,!0,[y1.create(y1.Class.UNIVERSAL,y1.Type.INTEGER,!1,y1.integerToDer(0).getBytes()),y1.create(y1.Class.UNIVERSAL,y1.Type.SEQUENCE,!0,[y1.create(y1.Class.UNIVERSAL,y1.Type.OID,!1,y1.oidToDer(x9.oids.rsaEncryption).getBytes()),y1.create(y1.Class.UNIVERSAL,y1.Type.NULL,!1,"")]),y1.create(y1.Class.UNIVERSAL,y1.Type.OCTETSTRING,!1,y1.toDer(q).getBytes())])};x9.privateKeyFromAsn1=function(q){var K={},_=[];if(y1.validate(q,MF_,K,_))q=y1.fromDer(f5.util.createBuffer(K.privateKey));if(K={},_=[],!y1.validate(q,XF_,K,_)){var z=Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw z.errors=_,z}var Y,$,A,O,w,j,H,J;return Y=f5.util.createBuffer(K.privateKeyModulus).toHex(),$=f5.util.createBuffer(K.privateKeyPublicExponent).toHex(),A=f5.util.createBuffer(K.privateKeyPrivateExponent).toHex(),O=f5.util.createBuffer(K.privateKeyPrime1).toHex(),w=f5.util.createBuffer(K.privateKeyPrime2).toHex(),j=f5.util.createBuffer(K.privateKeyExponent1).toHex(),H=f5.util.createBuffer(K.privateKeyExponent2).toHex(),J=f5.util.createBuffer(K.privateKeyCoefficient).toHex(),x9.setRsaPrivateKey(new jY(Y,16),new jY($,16),new jY(A,16),new jY(O,16),new jY(w,16),new jY(j,16),new jY(H,16),new jY(J,16))};x9.privateKeyToAsn1=x9.privateKeyToRSAPrivateKey=function(q){return y1.create(y1.Class.UNIVERSAL,y1.Type.SEQUENCE,!0,[y1.create(y1.Class.UNIVERSAL,y1.Type.INTEGER,!1,y1.integerToDer(0).getBytes()),y1.create(y1.Class.UNIVERSAL,y1.Type.INTEGER,!1,UF(q.n)),y1.create(y1.Class.UNIVERSAL,y1.Type.INTEGER,!1,UF(q.e)),y1.create(y1.Class.UNIVERSAL,y1.Type.INTEGER,!1,UF(q.d)),y1.create(y1.Class.UNIVERSAL,y1.Type.INTEGER,!1,UF(q.p)),y1.create(y1.Class.UNIVERSAL,y1.Type.INTEGER,!1,UF(q.q)),y1.create(y1.Class.UNIVERSAL,y1.Type.INTEGER,!1,UF(q.dP)),y1.create(y1.Class.UNIVERSAL,y1.Type.INTEGER,!1,UF(q.dQ)),y1.create(y1.Class.UNIVERSAL,y1.Type.INTEGER,!1,UF(q.qInv))])};x9.publicKeyFromAsn1=function(q){var K={},_=[];if(y1.validate(q,WF_,K,_)){var z=y1.derToOid(K.publicKeyOid);if(z!==x9.oids.rsaEncryption){var Y=Error("Cannot read public key. Unknown OID.");throw Y.oid=z,Y}q=K.rsaPublicKey}if(_=[],!y1.validate(q,PF_,K,_)){var Y=Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw Y.errors=_,Y}var $=f5.util.createBuffer(K.publicKeyModulus).toHex(),A=f5.util.createBuffer(K.publicKeyExponent).toHex();return x9.setRsaPublicKey(new jY($,16),new jY(A,16))};x9.publicKeyToAsn1=x9.publicKeyToSubjectPublicKeyInfo=function(q){return y1.create(y1.Class.UNIVERSAL,y1.Type.SEQUENCE,!0,[y1.create(y1.Class.UNIVERSAL,y1.Type.SEQUENCE,!0,[y1.create(y1.Class.UNIVERSAL,y1.Type.OID,!1,y1.oidToDer(x9.oids.rsaEncryption).getBytes()),y1.create(y1.Class.UNIVERSAL,y1.Type.NULL,!1,"")]),y1.create(y1.Class.UNIVERSAL,y1.Type.BITSTRING,!1,[x9.publicKeyToRSAPublicKey(q)])])};x9.publicKeyToRSAPublicKey=function(q){return y1.create(y1.Class.UNIVERSAL,y1.Type.SEQUENCE,!0,[y1.create(y1.Class.UNIVERSAL,y1.Type.INTEGER,!1,UF(q.n)),y1.create(y1.Class.UNIVERSAL,y1.Type.INTEGER,!1,UF(q.e))])};function rO4(q,K,_){var z=f5.util.createBuffer(),Y=Math.ceil(K.n.bitLength()/8);if(q.length>Y-11){var $=Error("Message is too long for PKCS#1 v1.5 padding.");throw $.length=q.length,$.max=Y-11,$}z.putByte(0),z.putByte(_);var A=Y-3-q.length,O;if(_===0||_===1){O=_===0?0:255;for(var w=0;w<A;++w)z.putByte(O)}else while(A>0){var j=0,H=f5.random.getBytes(A);for(var w=0;w<A;++w)if(O=H.charCodeAt(w),O===0)++j;else z.putByte(O);A=j}return z.putByte(0),z.putBytes(q),z}function uv8(q,K,_,z){var Y=Math.ceil(K.n.bitLength()/8),$=f5.util.createBuffer(q),A=$.getByte(),O=$.getByte();if(A!==0||_&&O!==0&&O!==1||!_&&O!=2||_&&O===0&&typeof z>"u")throw Error("Encryption block is invalid.");var w=0;if(O===0){w=Y-3-z;for(var j=0;j<w;++j)if($.getByte()!==0)throw Error("Encryption block is invalid.")}else if(O===1){w=0;while($.length()>1){if($.getByte()!==255){--$.read;break}++w}}else if(O===2){w=0;while($.length()>1){if($.getByte()===0){--$.read;break}++w}}var H=$.getByte();if(H!==0||w!==Y-3-$.length())throw Error("Encryption block is invalid.");return $.getBytes()}function ZF_(q,K,_){if(typeof K==="function")_=K,K={};K=K||{};var z={algorithm:{name:K.algorithm||"PRIMEINC",options:{workers:K.workers||2,workLoad:K.workLoad||100,workerScript:K.workerScript}}};if("prng"in K)z.prng=K.prng;Y();function Y(){$(q.pBits,function(O,w){if(O)return _(O);if(q.p=w,q.q!==null)return A(O,q.q);$(q.qBits,A)})}function $(O,w){f5.prime.generateProbablePrime(O,z,w)}function A(O,w){if(O)return _(O);if(q.q=w,q.p.compareTo(q.q)<0){var j=q.p;q.p=q.q,q.q=j}if(q.p.subtract(jY.ONE).gcd(q.e).compareTo(jY.ONE)!==0){q.p=null,Y();return}if(q.q.subtract(jY.ONE).gcd(q.e).compareTo(jY.ONE)!==0){q.q=null,$(q.qBits,A);return}if(q.p1=q.p.subtract(jY.ONE),q.q1=q.q.subtract(jY.ONE),q.phi=q.p1.multiply(q.q1),q.phi.gcd(q.e).compareTo(jY.ONE)!==0){q.p=q.q=null,Y();return}if(q.n=q.p.multiply(q.q),q.n.bitLength()!==q.bits){q.q=null,$(q.qBits,A);return}var H=q.e.modInverse(q.phi);q.keys={privateKey:x9.rsa.setPrivateKey(q.n,q.e,H,q.p,q.q,H.mod(q.p1),H.mod(q.q1),q.q.modInverse(q.p)),publicKey:x9.rsa.setPublicKey(q.n,q.e)},_(null,q.keys)}}function UF(q){var K=q.toString(16);if(K[0]>="8")K="00"+K;var _=f5.util.hexToBytes(K);if(_.length>1&&(_.charCodeAt(0)===0&&(_.charCodeAt(1)&128)===0||_.charCodeAt(0)===255&&(_.charCodeAt(1)&128)===128))return _.substr(1);return _}function GF_(q){if(q<=100)return 27;if(q<=150)return 18;if(q<=200)return 15;if(q<=250)return 12;if(q<=300)return 9;if(q<=350)return 8;if(q<=400)return 7;if(q<=500)return 6;if(q<=600)return 5;if(q<=800)return 4;if(q<=1250)return 3;return 2}function dO4(q){return f5.util.isNodejs&&typeof Nb1[q]==="function"}function cO4(q){return typeof fC.globalScope<"u"&&typeof fC.globalScope.crypto==="object"&&typeof fC.globalScope.crypto.subtle==="object"&&typeof fC.globalScope.crypto.subtle[q]==="function"}function lO4(q){return typeof fC.globalScope<"u"&&typeof fC.globalScope.msCrypto==="object"&&typeof fC.globalScope.msCrypto.subtle==="object"&&typeof fC.globalScope.msCrypto.subtle[q]==="function"}function nO4(q){var K=f5.util.hexToBytes(q.toString(16)),_=new Uint8Array(K.length);for(var z=0;z<K.length;++z)_[z]=K.charCodeAt(z);return _}});var Eb1=m((XlA,eO4)=>{var u4=E_();h76();Iu();Ei6();IF();S76();Sv8();JO6();WC();Db1();hi6();_$();if(typeof yb1>"u")yb1=u4.jsbn.BigInteger;var yb1,K7=u4.asn1,P_=u4.pki=u4.pki||{};eO4.exports=P_.pbe=u4.pbe=u4.pbe||{};var PO6=P_.oids,TF_={name:"EncryptedPrivateKeyInfo",tagClass:K7.Class.UNIVERSAL,type:K7.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:K7.Class.UNIVERSAL,type:K7.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:K7.Class.UNIVERSAL,type:K7.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:K7.Class.UNIVERSAL,type:K7.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:K7.Class.UNIVERSAL,type:K7.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},vF_={name:"PBES2Algorithms",tagClass:K7.Class.UNIVERSAL,type:K7.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:K7.Class.UNIVERSAL,type:K7.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:K7.Class.UNIVERSAL,type:K7.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:K7.Class.UNIVERSAL,type:K7.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:K7.Class.UNIVERSAL,type:K7.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:K7.Class.UNIVERSAL,type:K7.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:K7.Class.UNIVERSAL,type:K7.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:K7.Class.UNIVERSAL,type:K7.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:K7.Class.UNIVERSAL,type:K7.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:K7.Class.UNIVERSAL,type:K7.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:K7.Class.UNIVERSAL,type:K7.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:K7.Class.UNIVERSAL,type:K7.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},kF_={name:"pkcs-12PbeParams",tagClass:K7.Class.UNIVERSAL,type:K7.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:K7.Class.UNIVERSAL,type:K7.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:K7.Class.UNIVERSAL,type:K7.Type.INTEGER,constructed:!1,capture:"iterations"}]};P_.encryptPrivateKeyInfo=function(q,K,_){_=_||{},_.saltSize=_.saltSize||8,_.count=_.count||2048,_.algorithm=_.algorithm||"aes128",_.prfAlgorithm=_.prfAlgorithm||"sha1";var z=u4.random.getBytesSync(_.saltSize),Y=_.count,$=K7.integerToDer(Y),A,O,w;if(_.algorithm.indexOf("aes")===0||_.algorithm==="des"){var j,H,J;switch(_.algorithm){case"aes128":A=16,j=16,H=PO6["aes128-CBC"],J=u4.aes.createEncryptionCipher;break;case"aes192":A=24,j=16,H=PO6["aes192-CBC"],J=u4.aes.createEncryptionCipher;break;case"aes256":A=32,j=16,H=PO6["aes256-CBC"],J=u4.aes.createEncryptionCipher;break;case"des":A=8,j=8,H=PO6.desCBC,J=u4.des.createEncryptionCipher;break;default:var M=Error("Cannot encrypt private key. Unknown encryption algorithm.");throw M.algorithm=_.algorithm,M}var X="hmacWith"+_.prfAlgorithm.toUpperCase(),P=tO4(X),W=u4.pkcs5.pbkdf2(K,z,Y,A,P),D=u4.random.getBytesSync(j),f=J(W);f.start(D),f.update(K7.toDer(q)),f.finish(),w=f.output.getBytes();var G=VF_(z,$,A,X);O=K7.create(K7.Class.UNIVERSAL,K7.Type.SEQUENCE,!0,[K7.create(K7.Class.UNIVERSAL,K7.Type.OID,!1,K7.oidToDer(PO6.pkcs5PBES2).getBytes()),K7.create(K7.Class.UNIVERSAL,K7.Type.SEQUENCE,!0,[K7.create(K7.Class.UNIVERSAL,K7.Type.SEQUENCE,!0,[K7.create(K7.Class.UNIVERSAL,K7.Type.OID,!1,K7.oidToDer(PO6.pkcs5PBKDF2).getBytes()),G]),K7.create(K7.Class.UNIVERSAL,K7.Type.SEQUENCE,!0,[K7.create(K7.Class.UNIVERSAL,K7.Type.OID,!1,K7.oidToDer(H).getBytes()),K7.create(K7.Class.UNIVERSAL,K7.Type.OCTETSTRING,!1,D)])])])}else if(_.algorithm==="3des"){A=24;var Z=new u4.util.ByteBuffer(z),W=P_.pbe.generatePkcs12Key(K,Z,1,Y,A),D=P_.pbe.generatePkcs12Key(K,Z,2,Y,A),f=u4.des.createEncryptionCipher(W);f.start(D),f.update(K7.toDer(q)),f.finish(),w=f.output.getBytes(),O=K7.create(K7.Class.UNIVERSAL,K7.Type.SEQUENCE,!0,[K7.create(K7.Class.UNIVERSAL,K7.Type.OID,!1,K7.oidToDer(PO6["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),K7.create(K7.Class.UNIVERSAL,K7.Type.SEQUENCE,!0,[K7.create(K7.Class.UNIVERSAL,K7.Type.OCTETSTRING,!1,z),K7.create(K7.Class.UNIVERSAL,K7.Type.INTEGER,!1,$.getBytes())])])}else{var M=Error("Cannot encrypt private key. Unknown encryption algorithm.");throw M.algorithm=_.algorithm,M}var T=K7.create(K7.Class.UNIVERSAL,K7.Type.SEQUENCE,!0,[O,K7.create(K7.Class.UNIVERSAL,K7.Type.OCTETSTRING,!1,w)]);return T};P_.decryptPrivateKeyInfo=function(q,K){var _=null,z={},Y=[];if(!K7.validate(q,TF_,z,Y)){var $=Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw $.errors=Y,$}var A=K7.derToOid(z.encryptionOid),O=P_.pbe.getCipher(A,z.encryptionParams,K),w=u4.util.createBuffer(z.encryptedData);if(O.update(w),O.finish())_=K7.fromDer(O.output);return _};P_.encryptedPrivateKeyToPem=function(q,K){var _={type:"ENCRYPTED PRIVATE KEY",body:K7.toDer(q).getBytes()};return u4.pem.encode(_,{maxline:K})};P_.encryptedPrivateKeyFromPem=function(q){var K=u4.pem.decode(q)[0];if(K.type!=="ENCRYPTED PRIVATE KEY"){var _=Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw _.headerType=K.type,_}if(K.procType&&K.procType.type==="ENCRYPTED")throw Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return K7.fromDer(K.body)};P_.encryptRsaPrivateKey=function(q,K,_){if(_=_||{},!_.legacy){var z=P_.wrapRsaPrivateKey(P_.privateKeyToAsn1(q));return z=P_.encryptPrivateKeyInfo(z,K,_),P_.encryptedPrivateKeyToPem(z)}var Y,$,A,O;switch(_.algorithm){case"aes128":Y="AES-128-CBC",A=16,$=u4.random.getBytesSync(16),O=u4.aes.createEncryptionCipher;break;case"aes192":Y="AES-192-CBC",A=24,$=u4.random.getBytesSync(16),O=u4.aes.createEncryptionCipher;break;case"aes256":Y="AES-256-CBC",A=32,$=u4.random.getBytesSync(16),O=u4.aes.createEncryptionCipher;break;case"3des":Y="DES-EDE3-CBC",A=24,$=u4.random.getBytesSync(8),O=u4.des.createEncryptionCipher;break;case"des":Y="DES-CBC",A=8,$=u4.random.getBytesSync(8),O=u4.des.createEncryptionCipher;break;default:var w=Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+_.algorithm+'".');throw w.algorithm=_.algorithm,w}var j=u4.pbe.opensslDeriveBytes(K,$.substr(0,8),A),H=O(j);H.start($),H.update(K7.toDer(P_.privateKeyToAsn1(q))),H.finish();var J={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:Y,parameters:u4.util.bytesToHex($).toUpperCase()},body:H.output.getBytes()};return u4.pem.encode(J)};P_.decryptRsaPrivateKey=function(q,K){var _=null,z=u4.pem.decode(q)[0];if(z.type!=="ENCRYPTED PRIVATE KEY"&&z.type!=="PRIVATE KEY"&&z.type!=="RSA PRIVATE KEY"){var Y=Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".');throw Y.headerType=Y,Y}if(z.procType&&z.procType.type==="ENCRYPTED"){var $,A;switch(z.dekInfo.algorithm){case"DES-CBC":$=8,A=u4.des.createDecryptionCipher;break;case"DES-EDE3-CBC":$=24,A=u4.des.createDecryptionCipher;break;case"AES-128-CBC":$=16,A=u4.aes.createDecryptionCipher;break;case"AES-192-CBC":$=24,A=u4.aes.createDecryptionCipher;break;case"AES-256-CBC":$=32,A=u4.aes.createDecryptionCipher;break;case"RC2-40-CBC":$=5,A=function(J){return u4.rc2.createDecryptionCipher(J,40)};break;case"RC2-64-CBC":$=8,A=function(J){return u4.rc2.createDecryptionCipher(J,64)};break;case"RC2-128-CBC":$=16,A=function(J){return u4.rc2.createDecryptionCipher(J,128)};break;default:var Y=Error('Could not decrypt private key; unsupported encryption algorithm "'+z.dekInfo.algorithm+'".');throw Y.algorithm=z.dekInfo.algorithm,Y}var O=u4.util.hexToBytes(z.dekInfo.parameters),w=u4.pbe.opensslDeriveBytes(K,O.substr(0,8),$),j=A(w);if(j.start(O),j.update(u4.util.createBuffer(z.body)),j.finish())_=j.output.getBytes();else return _}else _=z.body;if(z.type==="ENCRYPTED PRIVATE KEY")_=P_.decryptPrivateKeyInfo(K7.fromDer(_),K);else _=K7.fromDer(_);if(_!==null)_=P_.privateKeyFromAsn1(_);return _};P_.pbe.generatePkcs12Key=function(q,K,_,z,Y,$){var A,O;if(typeof $>"u"||$===null){if(!("sha1"in u4.md))throw Error('"sha1" hash algorithm unavailable.');$=u4.md.sha1.create()}var{digestLength:w,blockLength:j}=$,H=new u4.util.ByteBuffer,J=new u4.util.ByteBuffer;if(q!==null&&q!==void 0){for(O=0;O<q.length;O++)J.putInt16(q.charCodeAt(O));J.putInt16(0)}var M=J.length(),X=K.length(),P=new u4.util.ByteBuffer;P.fillWithByte(_,j);var W=j*Math.ceil(X/j),D=new u4.util.ByteBuffer;for(O=0;O<W;O++)D.putByte(K.at(O%X));var f=j*Math.ceil(M/j),G=new u4.util.ByteBuffer;for(O=0;O<f;O++)G.putByte(J.at(O%M));var Z=D;Z.putBuffer(G);var T=Math.ceil(Y/w);for(var v=1;v<=T;v++){var V=new u4.util.ByteBuffer;V.putBytes(P.bytes()),V.putBytes(Z.bytes());for(var E=0;E<z;E++)$.start(),$.update(V.getBytes()),V=$.digest();var S=new u4.util.ByteBuffer;for(O=0;O<j;O++)S.putByte(V.at(O%w));var R=Math.ceil(X/j)+Math.ceil(M/j),x=new u4.util.ByteBuffer;for(A=0;A<R;A++){var I=new u4.util.ByteBuffer(Z.getBytes(j)),B=511;for(O=S.length()-1;O>=0;O--)B=B>>8,B+=S.at(O)+I.at(O),I.setAt(O,B&255);x.putBuffer(I)}Z=x,H.putBuffer(V)}return H.truncate(H.length()-Y),H};P_.pbe.getCipher=function(q,K,_){switch(q){case P_.oids.pkcs5PBES2:return P_.pbe.getCipherForPBES2(q,K,_);case P_.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case P_.oids["pbewithSHAAnd40BitRC2-CBC"]:return P_.pbe.getCipherForPKCS12PBE(q,K,_);default:var z=Error("Cannot read encrypted PBE data block. Unsupported OID.");throw z.oid=q,z.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],z}};P_.pbe.getCipherForPBES2=function(q,K,_){var z={},Y=[];if(!K7.validate(K,vF_,z,Y)){var $=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw $.errors=Y,$}if(q=K7.derToOid(z.kdfOid),q!==P_.oids.pkcs5PBKDF2){var $=Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw $.oid=q,$.supportedOids=["pkcs5PBKDF2"],$}if(q=K7.derToOid(z.encOid),q!==P_.oids["aes128-CBC"]&&q!==P_.oids["aes192-CBC"]&&q!==P_.oids["aes256-CBC"]&&q!==P_.oids["des-EDE3-CBC"]&&q!==P_.oids.desCBC){var $=Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw $.oid=q,$.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],$}var A=z.kdfSalt,O=u4.util.createBuffer(z.kdfIterationCount);O=O.getInt(O.length()<<3);var w,j;switch(P_.oids[q]){case"aes128-CBC":w=16,j=u4.aes.createDecryptionCipher;break;case"aes192-CBC":w=24,j=u4.aes.createDecryptionCipher;break;case"aes256-CBC":w=32,j=u4.aes.createDecryptionCipher;break;case"des-EDE3-CBC":w=24,j=u4.des.createDecryptionCipher;break;case"desCBC":w=8,j=u4.des.createDecryptionCipher;break}var H=sO4(z.prfOid),J=u4.pkcs5.pbkdf2(_,A,O,w,H),M=z.encIv,X=j(J);return X.start(M),X};P_.pbe.getCipherForPKCS12PBE=function(q,K,_){var z={},Y=[];if(!K7.validate(K,kF_,z,Y)){var $=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw $.errors=Y,$}var A=u4.util.createBuffer(z.salt),O=u4.util.createBuffer(z.iterations);O=O.getInt(O.length()<<3);var w,j,H;switch(q){case P_.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:w=24,j=8,H=u4.des.startDecrypting;break;case P_.oids["pbewithSHAAnd40BitRC2-CBC"]:w=5,j=8,H=function(W,D){var f=u4.rc2.createDecryptionCipher(W,40);return f.start(D,null),f};break;default:var $=Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw $.oid=q,$}var J=sO4(z.prfOid),M=P_.pbe.generatePkcs12Key(_,A,1,O,w,J);J.start();var X=P_.pbe.generatePkcs12Key(_,A,2,O,j,J);return H(M,X)};P_.pbe.opensslDeriveBytes=function(q,K,_,z){if(typeof z>"u"||z===null){if(!("md5"in u4.md))throw Error('"md5" hash algorithm unavailable.');z=u4.md.md5.create()}if(K===null)K="";var Y=[aO4(z,q+K)];for(var $=16,A=1;$<_;++A,$+=16)Y.push(aO4(z,Y[A-1]+q+K));return Y.join("").substr(0,_)};function aO4(q,K){return q.start().update(K).digest().getBytes()}function sO4(q){var K;if(!q)K="hmacWithSHA1";else if(K=P_.oids[K7.derToOid(q)],!K){var _=Error("Unsupported PRF OID.");throw _.oid=q,_.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],_}return tO4(K)}function tO4(q){var K=u4.md;switch(q){case"hmacWithSHA224":K=u4.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":q=q.substr(8).toLowerCase();break;default:var _=Error("Unsupported PRF algorithm.");throw _.algorithm=q,_.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],_}if(!K||!(q in K))throw Error("Unknown hash algorithm: "+q);return K[q].create()}function VF_(q,K,_,z){var Y=K7.create(K7.Class.UNIVERSAL,K7.Type.SEQUENCE,!0,[K7.create(K7.Class.UNIVERSAL,K7.Type.OCTETSTRING,!1,q),K7.create(K7.Class.UNIVERSAL,K7.Type.INTEGER,!1,K.getBytes())]);if(z!=="hmacWithSHA1")Y.value.push(K7.create(K7.Class.UNIVERSAL,K7.Type.INTEGER,!1,u4.util.hexToBytes(_.toString(16))),K7.create(K7.Class.UNIVERSAL,K7.Type.SEQUENCE,!0,[K7.create(K7.Class.UNIVERSAL,K7.Type.OID,!1,K7.oidToDer(P_.oids[z]).getBytes()),K7.create(K7.Class.UNIVERSAL,K7.Type.NULL,!1,"")]));return Y}});var Lb1=m((PlA,_w4)=>{var jk6=E_();Iu();_$();var y4=jk6.asn1,Hk6=_w4.exports=jk6.pkcs7asn1=jk6.pkcs7asn1||{};jk6.pkcs7=jk6.pkcs7||{};jk6.pkcs7.asn1=Hk6;var qw4={name:"ContentInfo",tagClass:y4.Class.UNIVERSAL,type:y4.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:y4.Class.UNIVERSAL,type:y4.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:y4.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};Hk6.contentInfoValidator=qw4;var Kw4={name:"EncryptedContentInfo",tagClass:y4.Class.UNIVERSAL,type:y4.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:y4.Class.UNIVERSAL,type:y4.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:y4.Class.UNIVERSAL,type:y4.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:y4.Class.UNIVERSAL,type:y4.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:y4.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:y4.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};Hk6.envelopedDataValidator={name:"EnvelopedData",tagClass:y4.Class.UNIVERSAL,type:y4.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:y4.Class.UNIVERSAL,type:y4.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:y4.Class.UNIVERSAL,type:y4.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(Kw4)};Hk6.encryptedDataValidator={name:"EncryptedData",tagClass:y4.Class.UNIVERSAL,type:y4.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:y4.Class.UNIVERSAL,type:y4.Type.INTEGER,constructed:!1,capture:"version"}].concat(Kw4)};var NF_={name:"SignerInfo",tagClass:y4.Class.UNIVERSAL,type:y4.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:y4.Class.UNIVERSAL,type:y4.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:y4.Class.UNIVERSAL,type:y4.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:y4.Class.UNIVERSAL,type:y4.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:y4.Class.UNIVERSAL,type:y4.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:y4.Class.UNIVERSAL,type:y4.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:y4.Class.UNIVERSAL,type:y4.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:y4.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:y4.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:y4.Class.UNIVERSAL,type:y4.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:y4.Class.UNIVERSAL,type:y4.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:y4.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};Hk6.signedDataValidator={name:"SignedData",tagClass:y4.Class.UNIVERSAL,type:y4.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:y4.Class.UNIVERSAL,type:y4.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:y4.Class.UNIVERSAL,type:y4.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},qw4,{name:"SignedData.Certificates",tagClass:y4.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:y4.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:y4.Class.UNIVERSAL,type:y4.Type.SET,capture:"signerInfos",optional:!0,value:[NF_]}]};Hk6.recipientInfoValidator={name:"RecipientInfo",tagClass:y4.Class.UNIVERSAL,type:y4.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:y4.Class.UNIVERSAL,type:y4.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:y4.Class.UNIVERSAL,type:y4.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:y4.Class.UNIVERSAL,type:y4.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:y4.Class.UNIVERSAL,type:y4.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:y4.Class.UNIVERSAL,type:y4.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:y4.Class.UNIVERSAL,type:y4.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:y4.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter",optional:!0}]},{name:"RecipientInfo.encryptedKey",tagClass:y4.Class.UNIVERSAL,type:y4.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}});var Rb1=m((WlA,zw4)=>{var WO6=E_();_$();WO6.mgf=WO6.mgf||{};var yF_=zw4.exports=WO6.mgf.mgf1=WO6.mgf1=WO6.mgf1||{};yF_.create=function(q){var K={generate:function(_,z){var Y=new WO6.util.ByteBuffer,$=Math.ceil(z/q.digestLength);for(var A=0;A<$;A++){var O=new WO6.util.ByteBuffer;O.putInt32(A),q.start(),q.update(_+O.getBytes()),Y.putBuffer(q.digest())}return Y.truncate(Y.length()-z),Y.getBytes()}};return K}});var $w4=m((DlA,Yw4)=>{var mv8=E_();Rb1();Yw4.exports=mv8.mgf=mv8.mgf||{};mv8.mgf.mgf1=mv8.mgf1});var pv8=m((flA,Aw4)=>{var DO6=E_();WC();_$();var EF_=Aw4.exports=DO6.pss=DO6.pss||{};EF_.create=function(q){if(arguments.length===3)q={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]};var{md:K,mgf:_}=q,z=K.digestLength,Y=q.salt||null;if(typeof Y==="string")Y=DO6.util.createBuffer(Y);var $;if("saltLength"in q)$=q.saltLength;else if(Y!==null)$=Y.length();else throw Error("Salt length not specified or specific salt not given.");if(Y!==null&&Y.length()!==$)throw Error("Given salt length does not match length of given salt.");var A=q.prng||DO6.random,O={};return O.encode=function(w,j){var H,J=j-1,M=Math.ceil(J/8),X=w.digest().getBytes();if(M<z+$+2)throw Error("Message is too long to encrypt.");var P;if(Y===null)P=A.getBytesSync($);else P=Y.bytes();var W=new DO6.util.ByteBuffer;W.fillWithByte(0,8),W.putBytes(X),W.putBytes(P),K.start(),K.update(W.getBytes());var D=K.digest().getBytes(),f=new DO6.util.ByteBuffer;f.fillWithByte(0,M-$-z-2),f.putByte(1),f.putBytes(P);var G=f.getBytes(),Z=M-z-1,T=_.generate(D,Z),v="";for(H=0;H<Z;H++)v+=String.fromCharCode(G.charCodeAt(H)^T.charCodeAt(H));var V=65280>>8*M-J&255;return v=String.fromCharCode(v.charCodeAt(0)&~V)+v.substr(1),v+D+String.fromCharCode(188)},O.verify=function(w,j,H){var J,M=H-1,X=Math.ceil(M/8);if(j=j.substr(-X),X<z+$+2)throw Error("Inconsistent parameters to PSS signature verification.");if(j.charCodeAt(X-1)!==188)throw Error("Encoded message does not end in 0xBC.");var P=X-z-1,W=j.substr(0,P),D=j.substr(P,z),f=65280>>8*X-M&255;if((W.charCodeAt(0)&f)!==0)throw Error("Bits beyond keysize not zero as expected.");var G=_.generate(D,P),Z="";for(J=0;J<P;J++)Z+=String.fromCharCode(W.charCodeAt(J)^G.charCodeAt(J));Z=String.fromCharCode(Z.charCodeAt(0)&~f)+Z.substr(1);var T=X-z-$-2;for(J=0;J<T;J++)if(Z.charCodeAt(J)!==0)throw Error("Leftmost octets not zero as expected");if(Z.charCodeAt(T)!==1)throw Error("Inconsistent PSS signature, 0x01 marker not found");var v=Z.substr(-$),V=new DO6.util.ByteBuffer;V.fillWithByte(0,8),V.putBytes(w),V.putBytes(v),K.start(),K.update(V.getBytes());var E=K.digest().getBytes();return D===E},O}});var Fv8=m((ZlA,Jw4)=>{var Z5=E_();h76();Iu();Ei6();IF();$w4();S76();JO6();pv8();hi6();_$();var z8=Z5.asn1,uq=Jw4.exports=Z5.pki=Z5.pki||{},pY=uq.oids,fJ={};fJ.CN=pY.commonName;fJ.commonName="CN";fJ.C=pY.countryName;fJ.countryName="C";fJ.L=pY.localityName;fJ.localityName="L";fJ.ST=pY.stateOrProvinceName;fJ.stateOrProvinceName="ST";fJ.O=pY.organizationName;fJ.organizationName="O";fJ.OU=pY.organizationalUnitName;fJ.organizationalUnitName="OU";fJ.E=pY.emailAddress;fJ.emailAddress="E";var ww4=Z5.pki.rsa.publicKeyValidator,LF_={name:"Certificate",tagClass:z8.Class.UNIVERSAL,type:z8.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:z8.Class.UNIVERSAL,type:z8.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:z8.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:z8.Class.UNIVERSAL,type:z8.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:z8.Class.UNIVERSAL,type:z8.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:z8.Class.UNIVERSAL,type:z8.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:z8.Class.UNIVERSAL,type:z8.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:z8.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:z8.Class.UNIVERSAL,type:z8.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:z8.Class.UNIVERSAL,type:z8.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:z8.Class.UNIVERSAL,type:z8.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:z8.Class.UNIVERSAL,type:z8.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:z8.Class.UNIVERSAL,type:z8.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:z8.Class.UNIVERSAL,type:z8.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:z8.Class.UNIVERSAL,type:z8.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},ww4,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:z8.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:z8.Class.UNIVERSAL,type:z8.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:z8.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:z8.Class.UNIVERSAL,type:z8.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:z8.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:z8.Class.UNIVERSAL,type:z8.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:z8.Class.UNIVERSAL,type:z8.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:z8.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:z8.Class.UNIVERSAL,type:z8.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},RF_={name:"rsapss",tagClass:z8.Class.UNIVERSAL,type:z8.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:z8.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:z8.Class.UNIVERSAL,type:z8.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:z8.Class.UNIVERSAL,type:z8.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:z8.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:z8.Class.UNIVERSAL,type:z8.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:z8.Class.UNIVERSAL,type:z8.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:z8.Class.UNIVERSAL,type:z8.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:z8.Class.UNIVERSAL,type:z8.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:z8.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:z8.Class.UNIVERSAL,type:z8.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:z8.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:z8.Class.UNIVERSAL,type:z8.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},hF_={name:"CertificationRequestInfo",tagClass:z8.Class.UNIVERSAL,type:z8.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:z8.Class.UNIVERSAL,type:z8.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:z8.Class.UNIVERSAL,type:z8.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},ww4,{name:"CertificationRequestInfo.attributes",tagClass:z8.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:z8.Class.UNIVERSAL,type:z8.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:z8.Class.UNIVERSAL,type:z8.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:z8.Class.UNIVERSAL,type:z8.Type.SET,constructed:!0}]}]}]},SF_={name:"CertificationRequest",tagClass:z8.Class.UNIVERSAL,type:z8.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[hF_,{name:"CertificationRequest.signatureAlgorithm",tagClass:z8.Class.UNIVERSAL,type:z8.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:z8.Class.UNIVERSAL,type:z8.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:z8.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:z8.Class.UNIVERSAL,type:z8.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};uq.RDNAttributesAsArray=function(q,K){var _=[],z,Y,$;for(var A=0;A<q.value.length;++A){z=q.value[A];for(var O=0;O<z.value.length;++O){if($={},Y=z.value[O],$.type=z8.derToOid(Y.value[0].value),$.value=Y.value[1].value,$.valueTagClass=Y.value[1].type,$.type in pY){if($.name=pY[$.type],$.name in fJ)$.shortName=fJ[$.name]}if(K)K.update($.type),K.update($.value);_.push($)}}return _};uq.CRIAttributesAsArray=function(q){var K=[];for(var _=0;_<q.length;++_){var z=q[_],Y=z8.derToOid(z.value[0].value),$=z.value[1].value;for(var A=0;A<$.length;++A){var O={};if(O.type=Y,O.value=$[A].value,O.valueTagClass=$[A].type,O.type in pY){if(O.name=pY[O.type],O.name in fJ)O.shortName=fJ[O.name]}if(O.type===pY.extensionRequest){O.extensions=[];for(var w=0;w<O.value.length;++w)O.extensions.push(uq.certificateExtensionFromAsn1(O.value[w]))}K.push(O)}}return K};function x76(q,K){if(typeof K==="string")K={shortName:K};var _=null,z;for(var Y=0;_===null&&Y<q.attributes.length;++Y)if(z=q.attributes[Y],K.type&&K.type===z.type)_=z;else if(K.name&&K.name===z.name)_=z;else if(K.shortName&&K.shortName===z.shortName)_=z;return _}var Bv8=function(q,K,_){var z={};if(q!==pY["RSASSA-PSS"])return z;if(_)z={hash:{algorithmOid:pY.sha1},mgf:{algorithmOid:pY.mgf1,hash:{algorithmOid:pY.sha1}},saltLength:20};var Y={},$=[];if(!z8.validate(K,RF_,Y,$)){var A=Error("Cannot read RSASSA-PSS parameter block.");throw A.errors=$,A}if(Y.hashOid!==void 0)z.hash=z.hash||{},z.hash.algorithmOid=z8.derToOid(Y.hashOid);if(Y.maskGenOid!==void 0)z.mgf=z.mgf||{},z.mgf.algorithmOid=z8.derToOid(Y.maskGenOid),z.mgf.hash=z.mgf.hash||{},z.mgf.hash.algorithmOid=z8.derToOid(Y.maskGenHashOid);if(Y.saltLength!==void 0)z.saltLength=Y.saltLength.charCodeAt(0);return z},gv8=function(q){switch(pY[q.signatureOid]){case"sha1WithRSAEncryption":case"sha1WithRSASignature":return Z5.md.sha1.create();case"md5WithRSAEncryption":return Z5.md.md5.create();case"sha256WithRSAEncryption":return Z5.md.sha256.create();case"sha384WithRSAEncryption":return Z5.md.sha384.create();case"sha512WithRSAEncryption":return Z5.md.sha512.create();case"RSASSA-PSS":return Z5.md.sha256.create();default:var K=Error("Could not compute "+q.type+" digest. Unknown signature OID.");throw K.signatureOid=q.signatureOid,K}},jw4=function(q){var K=q.certificate,_;switch(K.signatureOid){case pY.sha1WithRSAEncryption:case pY.sha1WithRSASignature:break;case pY["RSASSA-PSS"]:var z,Y;if(z=pY[K.signatureParameters.mgf.hash.algorithmOid],z===void 0||Z5.md[z]===void 0){var $=Error("Unsupported MGF hash function.");throw $.oid=K.signatureParameters.mgf.hash.algorithmOid,$.name=z,$}if(Y=pY[K.signatureParameters.mgf.algorithmOid],Y===void 0||Z5.mgf[Y]===void 0){var $=Error("Unsupported MGF function.");throw $.oid=K.signatureParameters.mgf.algorithmOid,$.name=Y,$}if(Y=Z5.mgf[Y].create(Z5.md[z].create()),z=pY[K.signatureParameters.hash.algorithmOid],z===void 0||Z5.md[z]===void 0){var $=Error("Unsupported RSASSA-PSS hash function.");throw $.oid=K.signatureParameters.hash.algorithmOid,$.name=z,$}_=Z5.pss.create(Z5.md[z].create(),Y,K.signatureParameters.saltLength);break}return K.publicKey.verify(q.md.digest().getBytes(),q.signature,_)};uq.certificateFromPem=function(q,K,_){var z=Z5.pem.decode(q)[0];if(z.type!=="CERTIFICATE"&&z.type!=="X509 CERTIFICATE"&&z.type!=="TRUSTED CERTIFICATE"){var Y=Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw Y.headerType=z.type,Y}if(z.procType&&z.procType.type==="ENCRYPTED")throw Error("Could not convert certificate from PEM; PEM is encrypted.");var $=z8.fromDer(z.body,_);return uq.certificateFromAsn1($,K)};uq.certificateToPem=function(q,K){var _={type:"CERTIFICATE",body:z8.toDer(uq.certificateToAsn1(q)).getBytes()};return Z5.pem.encode(_,{maxline:K})};uq.publicKeyFromPem=function(q){var K=Z5.pem.decode(q)[0];if(K.type!=="PUBLIC KEY"&&K.type!=="RSA PUBLIC KEY"){var _=Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');throw _.headerType=K.type,_}if(K.procType&&K.procType.type==="ENCRYPTED")throw Error("Could not convert public key from PEM; PEM is encrypted.");var z=z8.fromDer(K.body);return uq.publicKeyFromAsn1(z)};uq.publicKeyToPem=function(q,K){var _={type:"PUBLIC KEY",body:z8.toDer(uq.publicKeyToAsn1(q)).getBytes()};return Z5.pem.encode(_,{maxline:K})};uq.publicKeyToRSAPublicKeyPem=function(q,K){var _={type:"RSA PUBLIC KEY",body:z8.toDer(uq.publicKeyToRSAPublicKey(q)).getBytes()};return Z5.pem.encode(_,{maxline:K})};uq.getPublicKeyFingerprint=function(q,K){K=K||{};var _=K.md||Z5.md.sha1.create(),z=K.type||"RSAPublicKey",Y;switch(z){case"RSAPublicKey":Y=z8.toDer(uq.publicKeyToRSAPublicKey(q)).getBytes();break;case"SubjectPublicKeyInfo":Y=z8.toDer(uq.publicKeyToAsn1(q)).getBytes();break;default:throw Error('Unknown fingerprint type "'+K.type+'".')}_.start(),_.update(Y);var $=_.digest();if(K.encoding==="hex"){var A=$.toHex();if(K.delimiter)return A.match(/.{2}/g).join(K.delimiter);return A}else if(K.encoding==="binary")return $.getBytes();else if(K.encoding)throw Error('Unknown encoding "'+K.encoding+'".');return $};uq.certificationRequestFromPem=function(q,K,_){var z=Z5.pem.decode(q)[0];if(z.type!=="CERTIFICATE REQUEST"){var Y=Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw Y.headerType=z.type,Y}if(z.procType&&z.procType.type==="ENCRYPTED")throw Error("Could not convert certification request from PEM; PEM is encrypted.");var $=z8.fromDer(z.body,_);return uq.certificationRequestFromAsn1($,K)};uq.certificationRequestToPem=function(q,K){var _={type:"CERTIFICATE REQUEST",body:z8.toDer(uq.certificationRequestToAsn1(q)).getBytes()};return Z5.pem.encode(_,{maxline:K})};uq.createCertificate=function(){var q={};return q.version=2,q.serialNumber="00",q.signatureOid=null,q.signature=null,q.siginfo={},q.siginfo.algorithmOid=null,q.validity={},q.validity.notBefore=new Date,q.validity.notAfter=new Date,q.issuer={},q.issuer.getField=function(K){return x76(q.issuer,K)},q.issuer.addField=function(K){ZC([K]),q.issuer.attributes.push(K)},q.issuer.attributes=[],q.issuer.hash=null,q.subject={},q.subject.getField=function(K){return x76(q.subject,K)},q.subject.addField=function(K){ZC([K]),q.subject.attributes.push(K)},q.subject.attributes=[],q.subject.hash=null,q.extensions=[],q.publicKey=null,q.md=null,q.setSubject=function(K,_){if(ZC(K),q.subject.attributes=K,delete q.subject.uniqueId,_)q.subject.uniqueId=_;q.subject.hash=null},q.setIssuer=function(K,_){if(ZC(K),q.issuer.attributes=K,delete q.issuer.uniqueId,_)q.issuer.uniqueId=_;q.issuer.hash=null},q.setExtensions=function(K){for(var _=0;_<K.length;++_)Hw4(K[_],{cert:q});q.extensions=K},q.getExtension=function(K){if(typeof K==="string")K={name:K};var _=null,z;for(var Y=0;_===null&&Y<q.extensions.length;++Y)if(z=q.extensions[Y],K.id&&z.id===K.id)_=z;else if(K.name&&z.name===K.name)_=z;return _},q.sign=function(K,_){q.md=_||Z5.md.sha1.create();var z=pY[q.md.algorithm+"WithRSAEncryption"];if(!z){var Y=Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw Y.algorithm=q.md.algorithm,Y}q.signatureOid=q.siginfo.algorithmOid=z,q.tbsCertificate=uq.getTBSCertificate(q);var $=z8.toDer(q.tbsCertificate);q.md.update($.getBytes()),q.signature=K.sign(q.md)},q.verify=function(K){var _=!1;if(!q.issued(K)){var z=K.issuer,Y=q.subject,$=Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.");throw $.expectedIssuer=Y.attributes,$.actualIssuer=z.attributes,$}var A=K.md;if(A===null){A=gv8({signatureOid:K.signatureOid,type:"certificate"});var O=K.tbsCertificate||uq.getTBSCertificate(K),w=z8.toDer(O);A.update(w.getBytes())}if(A!==null)_=jw4({certificate:q,md:A,signature:K.signature});return _},q.isIssuer=function(K){var _=!1,z=q.issuer,Y=K.subject;if(z.hash&&Y.hash)_=z.hash===Y.hash;else if(z.attributes.length===Y.attributes.length){_=!0;var $,A;for(var O=0;_&&O<z.attributes.length;++O)if($=z.attributes[O],A=Y.attributes[O],$.type!==A.type||$.value!==A.value)_=!1}return _},q.issued=function(K){return K.isIssuer(q)},q.generateSubjectKeyIdentifier=function(){return uq.getPublicKeyFingerprint(q.publicKey,{type:"RSAPublicKey"})},q.verifySubjectKeyIdentifier=function(){var K=pY.subjectKeyIdentifier;for(var _=0;_<q.extensions.length;++_){var z=q.extensions[_];if(z.id===K){var Y=q.generateSubjectKeyIdentifier().getBytes();return Z5.util.hexToBytes(z.subjectKeyIdentifier)===Y}}return!1},q};uq.certificateFromAsn1=function(q,K){var _={},z=[];if(!z8.validate(q,LF_,_,z)){var Y=Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.");throw Y.errors=z,Y}var $=z8.derToOid(_.publicKeyOid);if($!==uq.oids.rsaEncryption)throw Error("Cannot read public key. OID is not RSA.");var A=uq.createCertificate();A.version=_.certVersion?_.certVersion.charCodeAt(0):0;var O=Z5.util.createBuffer(_.certSerialNumber);A.serialNumber=O.toHex(),A.signatureOid=Z5.asn1.derToOid(_.certSignatureOid),A.signatureParameters=Bv8(A.signatureOid,_.certSignatureParams,!0),A.siginfo.algorithmOid=Z5.asn1.derToOid(_.certinfoSignatureOid),A.siginfo.parameters=Bv8(A.siginfo.algorithmOid,_.certinfoSignatureParams,!1),A.signature=_.certSignature;var w=[];if(_.certValidity1UTCTime!==void 0)w.push(z8.utcTimeToDate(_.certValidity1UTCTime));if(_.certValidity2GeneralizedTime!==void 0)w.push(z8.generalizedTimeToDate(_.certValidity2GeneralizedTime));if(_.certValidity3UTCTime!==void 0)w.push(z8.utcTimeToDate(_.certValidity3UTCTime));if(_.certValidity4GeneralizedTime!==void 0)w.push(z8.generalizedTimeToDate(_.certValidity4GeneralizedTime));if(w.length>2)throw Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(w.length<2)throw Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(A.validity.notBefore=w[0],A.validity.notAfter=w[1],A.tbsCertificate=_.tbsCertificate,K){A.md=gv8({signatureOid:A.signatureOid,type:"certificate"});var j=z8.toDer(A.tbsCertificate);A.md.update(j.getBytes())}var H=Z5.md.sha1.create(),J=z8.toDer(_.certIssuer);if(H.update(J.getBytes()),A.issuer.getField=function(P){return x76(A.issuer,P)},A.issuer.addField=function(P){ZC([P]),A.issuer.attributes.push(P)},A.issuer.attributes=uq.RDNAttributesAsArray(_.certIssuer),_.certIssuerUniqueId)A.issuer.uniqueId=_.certIssuerUniqueId;A.issuer.hash=H.digest().toHex();var M=Z5.md.sha1.create(),X=z8.toDer(_.certSubject);if(M.update(X.getBytes()),A.subject.getField=function(P){return x76(A.subject,P)},A.subject.addField=function(P){ZC([P]),A.subject.attributes.push(P)},A.subject.attributes=uq.RDNAttributesAsArray(_.certSubject),_.certSubjectUniqueId)A.subject.uniqueId=_.certSubjectUniqueId;if(A.subject.hash=M.digest().toHex(),_.certExtensions)A.extensions=uq.certificateExtensionsFromAsn1(_.certExtensions);else A.extensions=[];return A.publicKey=uq.publicKeyFromAsn1(_.subjectPublicKeyInfo),A};uq.certificateExtensionsFromAsn1=function(q){var K=[];for(var _=0;_<q.value.length;++_){var z=q.value[_];for(var Y=0;Y<z.value.length;++Y)K.push(uq.certificateExtensionFromAsn1(z.value[Y]))}return K};uq.certificateExtensionFromAsn1=function(q){var K={};if(K.id=z8.derToOid(q.value[0].value),K.critical=!1,q.value[1].type===z8.Type.BOOLEAN)K.critical=q.value[1].value.charCodeAt(0)!==0,K.value=q.value[2].value;else K.value=q.value[1].value;if(K.id in pY){if(K.name=pY[K.id],K.name==="keyUsage"){var _=z8.fromDer(K.value),z=0,Y=0;if(_.value.length>1)z=_.value.charCodeAt(1),Y=_.value.length>2?_.value.charCodeAt(2):0;K.digitalSignature=(z&128)===128,K.nonRepudiation=(z&64)===64,K.keyEncipherment=(z&32)===32,K.dataEncipherment=(z&16)===16,K.keyAgreement=(z&8)===8,K.keyCertSign=(z&4)===4,K.cRLSign=(z&2)===2,K.encipherOnly=(z&1)===1,K.decipherOnly=(Y&128)===128}else if(K.name==="basicConstraints"){var _=z8.fromDer(K.value);if(_.value.length>0&&_.value[0].type===z8.Type.BOOLEAN)K.cA=_.value[0].value.charCodeAt(0)!==0;else K.cA=!1;var $=null;if(_.value.length>0&&_.value[0].type===z8.Type.INTEGER)$=_.value[0].value;else if(_.value.length>1)$=_.value[1].value;if($!==null)K.pathLenConstraint=z8.derToInteger($)}else if(K.name==="extKeyUsage"){var _=z8.fromDer(K.value);for(var A=0;A<_.value.length;++A){var O=z8.derToOid(_.value[A].value);if(O in pY)K[pY[O]]=!0;else K[O]=!0}}else if(K.name==="nsCertType"){var _=z8.fromDer(K.value),z=0;if(_.value.length>1)z=_.value.charCodeAt(1);K.client=(z&128)===128,K.server=(z&64)===64,K.email=(z&32)===32,K.objsign=(z&16)===16,K.reserved=(z&8)===8,K.sslCA=(z&4)===4,K.emailCA=(z&2)===2,K.objCA=(z&1)===1}else if(K.name==="subjectAltName"||K.name==="issuerAltName"){K.altNames=[];var w,_=z8.fromDer(K.value);for(var j=0;j<_.value.length;++j){w=_.value[j];var H={type:w.type,value:w.value};switch(K.altNames.push(H),w.type){case 1:case 2:case 6:break;case 7:H.ip=Z5.util.bytesToIP(w.value);break;case 8:H.oid=z8.derToOid(w.value);break;default:}}}else if(K.name==="subjectKeyIdentifier"){var _=z8.fromDer(K.value);K.subjectKeyIdentifier=Z5.util.bytesToHex(_.value)}}return K};uq.certificationRequestFromAsn1=function(q,K){var _={},z=[];if(!z8.validate(q,SF_,_,z)){var Y=Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.");throw Y.errors=z,Y}var $=z8.derToOid(_.publicKeyOid);if($!==uq.oids.rsaEncryption)throw Error("Cannot read public key. OID is not RSA.");var A=uq.createCertificationRequest();if(A.version=_.csrVersion?_.csrVersion.charCodeAt(0):0,A.signatureOid=Z5.asn1.derToOid(_.csrSignatureOid),A.signatureParameters=Bv8(A.signatureOid,_.csrSignatureParams,!0),A.siginfo.algorithmOid=Z5.asn1.derToOid(_.csrSignatureOid),A.siginfo.parameters=Bv8(A.siginfo.algorithmOid,_.csrSignatureParams,!1),A.signature=_.csrSignature,A.certificationRequestInfo=_.certificationRequestInfo,K){A.md=gv8({signatureOid:A.signatureOid,type:"certification request"});var O=z8.toDer(A.certificationRequestInfo);A.md.update(O.getBytes())}var w=Z5.md.sha1.create();return A.subject.getField=function(j){return x76(A.subject,j)},A.subject.addField=function(j){ZC([j]),A.subject.attributes.push(j)},A.subject.attributes=uq.RDNAttributesAsArray(_.certificationRequestInfoSubject,w),A.subject.hash=w.digest().toHex(),A.publicKey=uq.publicKeyFromAsn1(_.subjectPublicKeyInfo),A.getAttribute=function(j){return x76(A,j)},A.addAttribute=function(j){ZC([j]),A.attributes.push(j)},A.attributes=uq.CRIAttributesAsArray(_.certificationRequestInfoAttributes||[]),A};uq.createCertificationRequest=function(){var q={};return q.version=0,q.signatureOid=null,q.signature=null,q.siginfo={},q.siginfo.algorithmOid=null,q.subject={},q.subject.getField=function(K){return x76(q.subject,K)},q.subject.addField=function(K){ZC([K]),q.subject.attributes.push(K)},q.subject.attributes=[],q.subject.hash=null,q.publicKey=null,q.attributes=[],q.getAttribute=function(K){return x76(q,K)},q.addAttribute=function(K){ZC([K]),q.attributes.push(K)},q.md=null,q.setSubject=function(K){ZC(K),q.subject.attributes=K,q.subject.hash=null},q.setAttributes=function(K){ZC(K),q.attributes=K},q.sign=function(K,_){q.md=_||Z5.md.sha1.create();var z=pY[q.md.algorithm+"WithRSAEncryption"];if(!z){var Y=Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw Y.algorithm=q.md.algorithm,Y}q.signatureOid=q.siginfo.algorithmOid=z,q.certificationRequestInfo=uq.getCertificationRequestInfo(q);var $=z8.toDer(q.certificationRequestInfo);q.md.update($.getBytes()),q.signature=K.sign(q.md)},q.verify=function(){var K=!1,_=q.md;if(_===null){_=gv8({signatureOid:q.signatureOid,type:"certification request"});var z=q.certificationRequestInfo||uq.getCertificationRequestInfo(q),Y=z8.toDer(z);_.update(Y.getBytes())}if(_!==null)K=jw4({certificate:q,md:_,signature:q.signature});return K},q};function Jk6(q){var K=z8.create(z8.Class.UNIVERSAL,z8.Type.SEQUENCE,!0,[]),_,z,Y=q.attributes;for(var $=0;$<Y.length;++$){_=Y[$];var A=_.value,O=z8.Type.PRINTABLESTRING;if("valueTagClass"in _){if(O=_.valueTagClass,O===z8.Type.UTF8)A=Z5.util.encodeUtf8(A)}z=z8.create(z8.Class.UNIVERSAL,z8.Type.SET,!0,[z8.create(z8.Class.UNIVERSAL,z8.Type.SEQUENCE,!0,[z8.create(z8.Class.UNIVERSAL,z8.Type.OID,!1,z8.oidToDer(_.type).getBytes()),z8.create(z8.Class.UNIVERSAL,O,!1,A)])]),K.value.push(z)}return K}function ZC(q){var K;for(var _=0;_<q.length;++_){if(K=q[_],typeof K.name>"u"){if(K.type&&K.type in uq.oids)K.name=uq.oids[K.type];else if(K.shortName&&K.shortName in fJ)K.name=uq.oids[fJ[K.shortName]]}if(typeof K.type>"u")if(K.name&&K.name in uq.oids)K.type=uq.oids[K.name];else{var z=Error("Attribute type not specified.");throw z.attribute=K,z}if(typeof K.shortName>"u"){if(K.name&&K.name in fJ)K.shortName=fJ[K.name]}if(K.type===pY.extensionRequest){if(K.valueConstructed=!0,K.valueTagClass=z8.Type.SEQUENCE,!K.value&&K.extensions){K.value=[];for(var Y=0;Y<K.extensions.length;++Y)K.value.push(uq.certificateExtensionToAsn1(Hw4(K.extensions[Y])))}}if(typeof K.value>"u"){var z=Error("Attribute value not specified.");throw z.attribute=K,z}}}function Hw4(q,K){if(K=K||{},typeof q.name>"u"){if(q.id&&q.id in uq.oids)q.name=uq.oids[q.id]}if(typeof q.id>"u")if(q.name&&q.name in uq.oids)q.id=uq.oids[q.name];else{var _=Error("Extension ID not specified.");throw _.extension=q,_}if(typeof q.value<"u")return q;if(q.name==="keyUsage"){var z=0,Y=0,$=0;if(q.digitalSignature)Y|=128,z=7;if(q.nonRepudiation)Y|=64,z=6;if(q.keyEncipherment)Y|=32,z=5;if(q.dataEncipherment)Y|=16,z=4;if(q.keyAgreement)Y|=8,z=3;if(q.keyCertSign)Y|=4,z=2;if(q.cRLSign)Y|=2,z=1;if(q.encipherOnly)Y|=1,z=0;if(q.decipherOnly)$|=128,z=7;var A=String.fromCharCode(z);if($!==0)A+=String.fromCharCode(Y)+String.fromCharCode($);else if(Y!==0)A+=String.fromCharCode(Y);q.value=z8.create(z8.Class.UNIVERSAL,z8.Type.BITSTRING,!1,A)}else if(q.name==="basicConstraints"){if(q.value=z8.create(z8.Class.UNIVERSAL,z8.Type.SEQUENCE,!0,[]),q.cA)q.value.value.push(z8.create(z8.Class.UNIVERSAL,z8.Type.BOOLEAN,!1,String.fromCharCode(255)));if("pathLenConstraint"in q)q.value.value.push(z8.create(z8.Class.UNIVERSAL,z8.Type.INTEGER,!1,z8.integerToDer(q.pathLenConstraint).getBytes()))}else if(q.name==="extKeyUsage"){q.value=z8.create(z8.Class.UNIVERSAL,z8.Type.SEQUENCE,!0,[]);var O=q.value.value;for(var w in q){if(q[w]!==!0)continue;if(w in pY)O.push(z8.create(z8.Class.UNIVERSAL,z8.Type.OID,!1,z8.oidToDer(pY[w]).getBytes()));else if(w.indexOf(".")!==-1)O.push(z8.create(z8.Class.UNIVERSAL,z8.Type.OID,!1,z8.oidToDer(w).getBytes()))}}else if(q.name==="nsCertType"){var z=0,Y=0;if(q.client)Y|=128,z=7;if(q.server)Y|=64,z=6;if(q.email)Y|=32,z=5;if(q.objsign)Y|=16,z=4;if(q.reserved)Y|=8,z=3;if(q.sslCA)Y|=4,z=2;if(q.emailCA)Y|=2,z=1;if(q.objCA)Y|=1,z=0;var A=String.fromCharCode(z);if(Y!==0)A+=String.fromCharCode(Y);q.value=z8.create(z8.Class.UNIVERSAL,z8.Type.BITSTRING,!1,A)}else if(q.name==="subjectAltName"||q.name==="issuerAltName"){q.value=z8.create(z8.Class.UNIVERSAL,z8.Type.SEQUENCE,!0,[]);var j;for(var H=0;H<q.altNames.length;++H){j=q.altNames[H];var A=j.value;if(j.type===7&&j.ip){if(A=Z5.util.bytesFromIP(j.ip),A===null){var _=Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw _.extension=q,_}}else if(j.type===8)if(j.oid)A=z8.oidToDer(z8.oidToDer(j.oid));else A=z8.oidToDer(A);q.value.value.push(z8.create(z8.Class.CONTEXT_SPECIFIC,j.type,!1,A))}}else if(q.name==="nsComment"&&K.cert){if(!/^[\x00-\x7F]*$/.test(q.comment)||q.comment.length<1||q.comment.length>128)throw Error('Invalid "nsComment" content.');q.value=z8.create(z8.Class.UNIVERSAL,z8.Type.IA5STRING,!1,q.comment)}else if(q.name==="subjectKeyIdentifier"&&K.cert){var J=K.cert.generateSubjectKeyIdentifier();q.subjectKeyIdentifier=J.toHex(),q.value=z8.create(z8.Class.UNIVERSAL,z8.Type.OCTETSTRING,!1,J.getBytes())}else if(q.name==="authorityKeyIdentifier"&&K.cert){q.value=z8.create(z8.Class.UNIVERSAL,z8.Type.SEQUENCE,!0,[]);var O=q.value.value;if(q.keyIdentifier){var M=q.keyIdentifier===!0?K.cert.generateSubjectKeyIdentifier().getBytes():q.keyIdentifier;O.push(z8.create(z8.Class.CONTEXT_SPECIFIC,0,!1,M))}if(q.authorityCertIssuer){var X=[z8.create(z8.Class.CONTEXT_SPECIFIC,4,!0,[Jk6(q.authorityCertIssuer===!0?K.cert.issuer:q.authorityCertIssuer)])];O.push(z8.create(z8.Class.CONTEXT_SPECIFIC,1,!0,X))}if(q.serialNumber){var P=Z5.util.hexToBytes(q.serialNumber===!0?K.cert.serialNumber:q.serialNumber);O.push(z8.create(z8.Class.CONTEXT_SPECIFIC,2,!1,P))}}else if(q.name==="cRLDistributionPoints"){q.value=z8.create(z8.Class.UNIVERSAL,z8.Type.SEQUENCE,!0,[]);var O=q.value.value,W=z8.create(z8.Class.UNIVERSAL,z8.Type.SEQUENCE,!0,[]),D=z8.create(z8.Class.CONTEXT_SPECIFIC,0,!0,[]),j;for(var H=0;H<q.altNames.length;++H){j=q.altNames[H];var A=j.value;if(j.type===7&&j.ip){if(A=Z5.util.bytesFromIP(j.ip),A===null){var _=Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw _.extension=q,_}}else if(j.type===8)if(j.oid)A=z8.oidToDer(z8.oidToDer(j.oid));else A=z8.oidToDer(A);D.value.push(z8.create(z8.Class.CONTEXT_SPECIFIC,j.type,!1,A))}W.value.push(z8.create(z8.Class.CONTEXT_SPECIFIC,0,!0,[D])),O.push(W)}if(typeof q.value>"u"){var _=Error("Extension value not specified.");throw _.extension=q,_}return q}function hb1(q,K){switch(q){case pY["RSASSA-PSS"]:var _=[];if(K.hash.algorithmOid!==void 0)_.push(z8.create(z8.Class.CONTEXT_SPECIFIC,0,!0,[z8.create(z8.Class.UNIVERSAL,z8.Type.SEQUENCE,!0,[z8.create(z8.Class.UNIVERSAL,z8.Type.OID,!1,z8.oidToDer(K.hash.algorithmOid).getBytes()),z8.create(z8.Class.UNIVERSAL,z8.Type.NULL,!1,"")])]));if(K.mgf.algorithmOid!==void 0)_.push(z8.create(z8.Class.CONTEXT_SPECIFIC,1,!0,[z8.create(z8.Class.UNIVERSAL,z8.Type.SEQUENCE,!0,[z8.create(z8.Class.UNIVERSAL,z8.Type.OID,!1,z8.oidToDer(K.mgf.algorithmOid).getBytes()),z8.create(z8.Class.UNIVERSAL,z8.Type.SEQUENCE,!0,[z8.create(z8.Class.UNIVERSAL,z8.Type.OID,!1,z8.oidToDer(K.mgf.hash.algorithmOid).getBytes()),z8.create(z8.Class.UNIVERSAL,z8.Type.NULL,!1,"")])])]));if(K.saltLength!==void 0)_.push(z8.create(z8.Class.CONTEXT_SPECIFIC,2,!0,[z8.create(z8.Class.UNIVERSAL,z8.Type.INTEGER,!1,z8.integerToDer(K.saltLength).getBytes())]));return z8.create(z8.Class.UNIVERSAL,z8.Type.SEQUENCE,!0,_);default:return z8.create(z8.Class.UNIVERSAL,z8.Type.NULL,!1,"")}}function CF_(q){var K=z8.create(z8.Class.CONTEXT_SPECIFIC,0,!0,[]);if(q.attributes.length===0)return K;var _=q.attributes;for(var z=0;z<_.length;++z){var Y=_[z],$=Y.value,A=z8.Type.UTF8;if("valueTagClass"in Y)A=Y.valueTagClass;if(A===z8.Type.UTF8)$=Z5.util.encodeUtf8($);var O=!1;if("valueConstructed"in Y)O=Y.valueConstructed;var w=z8.create(z8.Class.UNIVERSAL,z8.Type.SEQUENCE,!0,[z8.create(z8.Class.UNIVERSAL,z8.Type.OID,!1,z8.oidToDer(Y.type).getBytes()),z8.create(z8.Class.UNIVERSAL,z8.Type.SET,!0,[z8.create(z8.Class.UNIVERSAL,A,O,$)])]);K.value.push(w)}return K}var bF_=new Date("1950-01-01T00:00:00Z"),xF_=new Date("2050-01-01T00:00:00Z");function Ow4(q){if(q>=bF_&&q<xF_)return z8.create(z8.Class.UNIVERSAL,z8.Type.UTCTIME,!1,z8.dateToUtcTime(q));else return z8.create(z8.Class.UNIVERSAL,z8.Type.GENERALIZEDTIME,!1,z8.dateToGeneralizedTime(q))}uq.getTBSCertificate=function(q){var K=Ow4(q.validity.notBefore),_=Ow4(q.validity.notAfter),z=z8.create(z8.Class.UNIVERSAL,z8.Type.SEQUENCE,!0,[z8.create(z8.Class.CONTEXT_SPECIFIC,0,!0,[z8.create(z8.Class.UNIVERSAL,z8.Type.INTEGER,!1,z8.integerToDer(q.version).getBytes())]),z8.create(z8.Class.UNIVERSAL,z8.Type.INTEGER,!1,Z5.util.hexToBytes(q.serialNumber)),z8.create(z8.Class.UNIVERSAL,z8.Type.SEQUENCE,!0,[z8.create(z8.Class.UNIVERSAL,z8.Type.OID,!1,z8.oidToDer(q.siginfo.algorithmOid).getBytes()),hb1(q.siginfo.algorithmOid,q.siginfo.parameters)]),Jk6(q.issuer),z8.create(z8.Class.UNIVERSAL,z8.Type.SEQUENCE,!0,[K,_]),Jk6(q.subject),uq.publicKeyToAsn1(q.publicKey)]);if(q.issuer.uniqueId)z.value.push(z8.create(z8.Class.CONTEXT_SPECIFIC,1,!0,[z8.create(z8.Class.UNIVERSAL,z8.Type.BITSTRING,!1,String.fromCharCode(0)+q.issuer.uniqueId)]));if(q.subject.uniqueId)z.value.push(z8.create(z8.Class.CONTEXT_SPECIFIC,2,!0,[z8.create(z8.Class.UNIVERSAL,z8.Type.BITSTRING,!1,String.fromCharCode(0)+q.subject.uniqueId)]));if(q.extensions.length>0)z.value.push(uq.certificateExtensionsToAsn1(q.extensions));return z};uq.getCertificationRequestInfo=function(q){var K=z8.create(z8.Class.UNIVERSAL,z8.Type.SEQUENCE,!0,[z8.create(z8.Class.UNIVERSAL,z8.Type.INTEGER,!1,z8.integerToDer(q.version).getBytes()),Jk6(q.subject),uq.publicKeyToAsn1(q.publicKey),CF_(q)]);return K};uq.distinguishedNameToAsn1=function(q){return Jk6(q)};uq.certificateToAsn1=function(q){var K=q.tbsCertificate||uq.getTBSCertificate(q);return z8.create(z8.Class.UNIVERSAL,z8.Type.SEQUENCE,!0,[K,z8.create(z8.Class.UNIVERSAL,z8.Type.SEQUENCE,!0,[z8.create(z8.Class.UNIVERSAL,z8.Type.OID,!1,z8.oidToDer(q.signatureOid).getBytes()),hb1(q.signatureOid,q.signatureParameters)]),z8.create(z8.Class.UNIVERSAL,z8.Type.BITSTRING,!1,String.fromCharCode(0)+q.signature)])};uq.certificateExtensionsToAsn1=function(q){var K=z8.create(z8.Class.CONTEXT_SPECIFIC,3,!0,[]),_=z8.create(z8.Class.UNIVERSAL,z8.Type.SEQUENCE,!0,[]);K.value.push(_);for(var z=0;z<q.length;++z)_.value.push(uq.certificateExtensionToAsn1(q[z]));return K};uq.certificateExtensionToAsn1=function(q){var K=z8.create(z8.Class.UNIVERSAL,z8.Type.SEQUENCE,!0,[]);if(K.value.push(z8.create(z8.Class.UNIVERSAL,z8.Type.OID,!1,z8.oidToDer(q.id).getBytes())),q.critical)K.value.push(z8.create(z8.Class.UNIVERSAL,z8.Type.BOOLEAN,!1,String.fromCharCode(255)));var _=q.value;if(typeof q.value!=="string")_=z8.toDer(_).getBytes();return K.value.push(z8.create(z8.Class.UNIVERSAL,z8.Type.OCTETSTRING,!1,_)),K};uq.certificationRequestToAsn1=function(q){var K=q.certificationRequestInfo||uq.getCertificationRequestInfo(q);return z8.create(z8.Class.UNIVERSAL,z8.Type.SEQUENCE,!0,[K,z8.create(z8.Class.UNIVERSAL,z8.Type.SEQUENCE,!0,[z8.create(z8.Class.UNIVERSAL,z8.Type.OID,!1,z8.oidToDer(q.signatureOid).getBytes()),hb1(q.signatureOid,q.signatureParameters)]),z8.create(z8.Class.UNIVERSAL,z8.Type.BITSTRING,!1,String.fromCharCode(0)+q.signature)])};uq.createCaStore=function(q){var K={certs:{}};K.getIssuer=function(A){var O=_(A.issuer);return O},K.addCertificate=function(A){if(typeof A==="string")A=Z5.pki.certificateFromPem(A);if(z(A.subject),!K.hasCertificate(A))if(A.subject.hash in K.certs){var O=K.certs[A.subject.hash];if(!Z5.util.isArray(O))O=[O];O.push(A),K.certs[A.subject.hash]=O}else K.certs[A.subject.hash]=A},K.hasCertificate=function(A){if(typeof A==="string")A=Z5.pki.certificateFromPem(A);var O=_(A.subject);if(!O)return!1;if(!Z5.util.isArray(O))O=[O];var w=z8.toDer(uq.certificateToAsn1(A)).getBytes();for(var j=0;j<O.length;++j){var H=z8.toDer(uq.certificateToAsn1(O[j])).getBytes();if(w===H)return!0}return!1},K.listAllCertificates=function(){var A=[];for(var O in K.certs)if(K.certs.hasOwnProperty(O)){var w=K.certs[O];if(!Z5.util.isArray(w))A.push(w);else for(var j=0;j<w.length;++j)A.push(w[j])}return A},K.removeCertificate=function(A){var O;if(typeof A==="string")A=Z5.pki.certificateFromPem(A);if(z(A.subject),!K.hasCertificate(A))return null;var w=_(A.subject);if(!Z5.util.isArray(w))return O=K.certs[A.subject.hash],delete K.certs[A.subject.hash],O;var j=z8.toDer(uq.certificateToAsn1(A)).getBytes();for(var H=0;H<w.length;++H){var J=z8.toDer(uq.certificateToAsn1(w[H])).getBytes();if(j===J)O=w[H],w.splice(H,1)}if(w.length===0)delete K.certs[A.subject.hash];return O};function _(A){return z(A),K.certs[A.hash]||null}function z(A){if(!A.hash){var O=Z5.md.sha1.create();A.attributes=uq.RDNAttributesAsArray(Jk6(A),O),A.hash=O.digest().toHex()}}if(q)for(var Y=0;Y<q.length;++Y){var $=q[Y];K.addCertificate($)}return K};uq.certificateError={bad_certificate:"forge.pki.BadCertificate",unsupported_certificate:"forge.pki.UnsupportedCertificate",certificate_revoked:"forge.pki.CertificateRevoked",certificate_expired:"forge.pki.CertificateExpired",certificate_unknown:"forge.pki.CertificateUnknown",unknown_ca:"forge.pki.UnknownCertificateAuthority"};uq.verifyCertificateChain=function(q,K,_){if(typeof _==="function")_={verify:_};_=_||{},K=K.slice(0);var z=K.slice(0),Y=_.validityCheckDate;if(typeof Y>"u")Y=new Date;var $=!0,A=null,O=0;do{var w=K.shift(),j=null,H=!1;if(Y){if(Y<w.validity.notBefore||Y>w.validity.notAfter)A={message:"Certificate is not valid yet or has expired.",error:uq.certificateError.certificate_expired,notBefore:w.validity.notBefore,notAfter:w.validity.notAfter,now:Y}}if(A===null){if(j=K[0]||q.getIssuer(w),j===null){if(w.isIssuer(w))H=!0,j=w}if(j){var J=j;if(!Z5.util.isArray(J))J=[J];var M=!1;while(!M&&J.length>0){j=J.shift();try{M=j.verify(w)}catch(v){}}if(!M)A={message:"Certificate signature is invalid.",error:uq.certificateError.bad_certificate}}if(A===null&&(!j||H)&&!q.hasCertificate(w))A={message:"Certificate is not trusted.",error:uq.certificateError.unknown_ca}}if(A===null&&j&&!w.isIssuer(j))A={message:"Certificate issuer is invalid.",error:uq.certificateError.bad_certificate};if(A===null){var X={keyUsage:!0,basicConstraints:!0};for(var P=0;A===null&&P<w.extensions.length;++P){var W=w.extensions[P];if(W.critical&&!(W.name in X))A={message:"Certificate has an unsupported critical extension.",error:uq.certificateError.unsupported_certificate}}}if(A===null&&(!$||K.length===0&&(!j||H))){var D=w.getExtension("basicConstraints"),f=w.getExtension("keyUsage");if(f!==null){if(!f.keyCertSign||D===null)A={message:"Certificate keyUsage or basicConstraints conflict or indicate that the certificate is not a CA. If the certificate is the only one in the chain or isn't the first then the certificate must be a valid CA.",error:uq.certificateError.bad_certificate}}if(A===null&&D!==null&&!D.cA)A={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:uq.certificateError.bad_certificate};if(A===null&&f!==null&&"pathLenConstraint"in D){var G=O-1;if(G>D.pathLenConstraint)A={message:"Certificate basicConstraints pathLenConstraint violated.",error:uq.certificateError.bad_certificate}}}var Z=A===null?!0:A.error,T=_.verify?_.verify(Z,O,z):Z;if(T===!0)A=null;else{if(Z===!0)A={message:"The application rejected the certificate.",error:uq.certificateError.bad_certificate};if(T||T===0){if(typeof T==="object"&&!Z5.util.isArray(T)){if(T.message)A.message=T.message;if(T.error)A.error=T.error}else if(typeof T==="string")A.error=T}throw A}$=!1,++O}while(K.length>0);return!0}});var Cb1=m((GlA,Xw4)=>{var sw=E_();Iu();Yk6();S76();Lb1();Eb1();WC();hi6();wk6();_$();Fv8();var{asn1:x8,pki:Nz}=sw,Ci6=Xw4.exports=sw.pkcs12=sw.pkcs12||{},Mw4={name:"ContentInfo",tagClass:x8.Class.UNIVERSAL,type:x8.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:x8.Class.UNIVERSAL,type:x8.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:x8.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},IF_={name:"PFX",tagClass:x8.Class.UNIVERSAL,type:x8.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:x8.Class.UNIVERSAL,type:x8.Type.INTEGER,constructed:!1,capture:"version"},Mw4,{name:"PFX.macData",tagClass:x8.Class.UNIVERSAL,type:x8.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:x8.Class.UNIVERSAL,type:x8.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:x8.Class.UNIVERSAL,type:x8.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:x8.Class.UNIVERSAL,type:x8.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",optional:!0,tagClass:x8.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:x8.Class.UNIVERSAL,type:x8.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:x8.Class.UNIVERSAL,type:x8.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:x8.Class.UNIVERSAL,type:x8.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},uF_={name:"SafeBag",tagClass:x8.Class.UNIVERSAL,type:x8.Type.SEQUENCE,constructed:!0,value:[{name:"SafeBag.bagId",tagClass:x8.Class.UNIVERSAL,type:x8.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:x8.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:x8.Class.UNIVERSAL,type:x8.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},mF_={name:"Attribute",tagClass:x8.Class.UNIVERSAL,type:x8.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:x8.Class.UNIVERSAL,type:x8.Type.OID,constructed:!1,capture:"oid"},{name:"Attribute.attrValues",tagClass:x8.Class.UNIVERSAL,type:x8.Type.SET,constructed:!0,capture:"values"}]},pF_={name:"CertBag",tagClass:x8.Class.UNIVERSAL,type:x8.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:x8.Class.UNIVERSAL,type:x8.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:x8.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:x8.Class.UNIVERSAL,type:x8.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};function Si6(q,K,_,z){var Y=[];for(var $=0;$<q.length;$++)for(var A=0;A<q[$].safeBags.length;A++){var O=q[$].safeBags[A];if(z!==void 0&&O.type!==z)continue;if(K===null){Y.push(O);continue}if(O.attributes[K]!==void 0&&O.attributes[K].indexOf(_)>=0)Y.push(O)}return Y}Ci6.pkcs12FromAsn1=function(q,K,_){if(typeof K==="string")_=K,K=!0;else if(K===void 0)K=!0;var z={},Y=[];if(!x8.validate(q,IF_,z,Y)){var $=Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX.");throw $.errors=$,$}var A={version:z.version.charCodeAt(0),safeContents:[],getBags:function(D){var f={},G;if("localKeyId"in D)G=D.localKeyId;else if("localKeyIdHex"in D)G=sw.util.hexToBytes(D.localKeyIdHex);if(G===void 0&&!("friendlyName"in D)&&"bagType"in D)f[D.bagType]=Si6(A.safeContents,null,null,D.bagType);if(G!==void 0)f.localKeyId=Si6(A.safeContents,"localKeyId",G,D.bagType);if("friendlyName"in D)f.friendlyName=Si6(A.safeContents,"friendlyName",D.friendlyName,D.bagType);return f},getBagsByFriendlyName:function(D,f){return Si6(A.safeContents,"friendlyName",D,f)},getBagsByLocalKeyId:function(D,f){return Si6(A.safeContents,"localKeyId",D,f)}};if(z.version.charCodeAt(0)!==3){var $=Error("PKCS#12 PFX of version other than 3 not supported.");throw $.version=z.version.charCodeAt(0),$}if(x8.derToOid(z.contentType)!==Nz.oids.data){var $=Error("Only PKCS#12 PFX in password integrity mode supported.");throw $.oid=x8.derToOid(z.contentType),$}var O=z.content.value[0];if(O.tagClass!==x8.Class.UNIVERSAL||O.type!==x8.Type.OCTETSTRING)throw Error("PKCS#12 authSafe content data is not an OCTET STRING.");if(O=Sb1(O),z.mac){var w=null,j=0,H=x8.derToOid(z.macAlgorithm);switch(H){case Nz.oids.sha1:w=sw.md.sha1.create(),j=20;break;case Nz.oids.sha256:w=sw.md.sha256.create(),j=32;break;case Nz.oids.sha384:w=sw.md.sha384.create(),j=48;break;case Nz.oids.sha512:w=sw.md.sha512.create(),j=64;break;case Nz.oids.md5:w=sw.md.md5.create(),j=16;break}if(w===null)throw Error("PKCS#12 uses unsupported MAC algorithm: "+H);var J=new sw.util.ByteBuffer(z.macSalt),M="macIterations"in z?parseInt(sw.util.bytesToHex(z.macIterations),16):1,X=Ci6.generateKey(_,J,3,M,j,w),P=sw.hmac.create();P.start(w,X),P.update(O.value);var W=P.getMac();if(W.getBytes()!==z.macDigest)throw Error("PKCS#12 MAC could not be verified. Invalid password?")}else if(Array.isArray(q.value)&&q.value.length>2)throw Error("Invalid PKCS#12. macData field present but MAC was not validated.");return BF_(A,O.value,K,_),A};function Sb1(q){if(q.composed||q.constructed){var K=sw.util.createBuffer();for(var _=0;_<q.value.length;++_)K.putBytes(q.value[_].value);q.composed=q.constructed=!1,q.value=K.getBytes()}return q}function BF_(q,K,_,z){if(K=x8.fromDer(K,_),K.tagClass!==x8.Class.UNIVERSAL||K.type!==x8.Type.SEQUENCE||K.constructed!==!0)throw Error("PKCS#12 AuthenticatedSafe expected to be a SEQUENCE OF ContentInfo");for(var Y=0;Y<K.value.length;Y++){var $=K.value[Y],A={},O=[];if(!x8.validate($,Mw4,A,O)){var w=Error("Cannot read ContentInfo.");throw w.errors=O,w}var j={encrypted:!1},H=null,J=A.content.value[0];switch(x8.derToOid(A.contentType)){case Nz.oids.data:if(J.tagClass!==x8.Class.UNIVERSAL||J.type!==x8.Type.OCTETSTRING)throw Error("PKCS#12 SafeContents Data is not an OCTET STRING.");H=Sb1(J).value;break;case Nz.oids.encryptedData:H=gF_(J,z),j.encrypted=!0;break;default:var w=Error("Unsupported PKCS#12 contentType.");throw w.contentType=x8.derToOid(A.contentType),w}j.safeBags=FF_(H,_,z),q.safeContents.push(j)}}function gF_(q,K){var _={},z=[];if(!x8.validate(q,sw.pkcs7.asn1.encryptedDataValidator,_,z)){var Y=Error("Cannot read EncryptedContentInfo.");throw Y.errors=z,Y}var $=x8.derToOid(_.contentType);if($!==Nz.oids.data){var Y=Error("PKCS#12 EncryptedContentInfo ContentType is not Data.");throw Y.oid=$,Y}$=x8.derToOid(_.encAlgorithm);var A=Nz.pbe.getCipher($,_.encParameter,K),O=Sb1(_.encryptedContentAsn1),w=sw.util.createBuffer(O.value);if(A.update(w),!A.finish())throw Error("Failed to decrypt PKCS#12 SafeContents.");return A.output.getBytes()}function FF_(q,K,_){if(!K&&q.length===0)return[];if(q=x8.fromDer(q,K),q.tagClass!==x8.Class.UNIVERSAL||q.type!==x8.Type.SEQUENCE||q.constructed!==!0)throw Error("PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.");var z=[];for(var Y=0;Y<q.value.length;Y++){var $=q.value[Y],A={},O=[];if(!x8.validate($,uF_,A,O)){var w=Error("Cannot read SafeBag.");throw w.errors=O,w}var j={type:x8.derToOid(A.bagId),attributes:UF_(A.bagAttributes)};z.push(j);var H,J,M=A.bagValue.value[0];switch(j.type){case Nz.oids.pkcs8ShroudedKeyBag:if(M=Nz.decryptPrivateKeyInfo(M,_),M===null)throw Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case Nz.oids.keyBag:try{j.key=Nz.privateKeyFromAsn1(M)}catch(P){j.key=null,j.asn1=M}continue;case Nz.oids.certBag:H=pF_,J=function(){if(x8.derToOid(A.certId)!==Nz.oids.x509Certificate){var P=Error("Unsupported certificate type, only X.509 supported.");throw P.oid=x8.derToOid(A.certId),P}var W=x8.fromDer(A.cert,K);try{j.cert=Nz.certificateFromAsn1(W,!0)}catch(D){j.cert=null,j.asn1=W}};break;default:var w=Error("Unsupported PKCS#12 SafeBag type.");throw w.oid=j.type,w}if(H!==void 0&&!x8.validate(M,H,A,O)){var w=Error("Cannot read PKCS#12 "+H.name);throw w.errors=O,w}J()}return z}function UF_(q){var K={};if(q!==void 0)for(var _=0;_<q.length;++_){var z={},Y=[];if(!x8.validate(q[_],mF_,z,Y)){var $=Error("Cannot read PKCS#12 BagAttribute.");throw $.errors=Y,$}var A=x8.derToOid(z.oid);if(Nz.oids[A]===void 0)continue;K[Nz.oids[A]]=[];for(var O=0;O<z.values.length;++O)K[Nz.oids[A]].push(z.values[O].value)}return K}Ci6.toPkcs12Asn1=function(q,K,_,z){if(z=z||{},z.saltSize=z.saltSize||8,z.count=z.count||2048,z.algorithm=z.algorithm||z.encAlgorithm||"aes128",!("useMac"in z))z.useMac=!0;if(!("localKeyId"in z))z.localKeyId=null;if(!("generateLocalKeyId"in z))z.generateLocalKeyId=!0;var Y=z.localKeyId,$;if(Y!==null)Y=sw.util.hexToBytes(Y);else if(z.generateLocalKeyId)if(K){var A=sw.util.isArray(K)?K[0]:K;if(typeof A==="string")A=Nz.certificateFromPem(A);var O=sw.md.sha1.create();O.update(x8.toDer(Nz.certificateToAsn1(A)).getBytes()),Y=O.digest().getBytes()}else Y=sw.random.getBytes(20);var w=[];if(Y!==null)w.push(x8.create(x8.Class.UNIVERSAL,x8.Type.SEQUENCE,!0,[x8.create(x8.Class.UNIVERSAL,x8.Type.OID,!1,x8.oidToDer(Nz.oids.localKeyId).getBytes()),x8.create(x8.Class.UNIVERSAL,x8.Type.SET,!0,[x8.create(x8.Class.UNIVERSAL,x8.Type.OCTETSTRING,!1,Y)])]));if("friendlyName"in z)w.push(x8.create(x8.Class.UNIVERSAL,x8.Type.SEQUENCE,!0,[x8.create(x8.Class.UNIVERSAL,x8.Type.OID,!1,x8.oidToDer(Nz.oids.friendlyName).getBytes()),x8.create(x8.Class.UNIVERSAL,x8.Type.SET,!0,[x8.create(x8.Class.UNIVERSAL,x8.Type.BMPSTRING,!1,z.friendlyName)])]));if(w.length>0)$=x8.create(x8.Class.UNIVERSAL,x8.Type.SET,!0,w);var j=[],H=[];if(K!==null)if(sw.util.isArray(K))H=K;else H=[K];var J=[];for(var M=0;M<H.length;++M){if(K=H[M],typeof K==="string")K=Nz.certificateFromPem(K);var X=M===0?$:void 0,P=Nz.certificateToAsn1(K),W=x8.create(x8.Class.UNIVERSAL,x8.Type.SEQUENCE,!0,[x8.create(x8.Class.UNIVERSAL,x8.Type.OID,!1,x8.oidToDer(Nz.oids.certBag).getBytes()),x8.create(x8.Class.CONTEXT_SPECIFIC,0,!0,[x8.create(x8.Class.UNIVERSAL,x8.Type.SEQUENCE,!0,[x8.create(x8.Class.UNIVERSAL,x8.Type.OID,!1,x8.oidToDer(Nz.oids.x509Certificate).getBytes()),x8.create(x8.Class.CONTEXT_SPECIFIC,0,!0,[x8.create(x8.Class.UNIVERSAL,x8.Type.OCTETSTRING,!1,x8.toDer(P).getBytes())])])]),X]);J.push(W)}if(J.length>0){var D=x8.create(x8.Class.UNIVERSAL,x8.Type.SEQUENCE,!0,J),f=x8.create(x8.Class.UNIVERSAL,x8.Type.SEQUENCE,!0,[x8.create(x8.Class.UNIVERSAL,x8.Type.OID,!1,x8.oidToDer(Nz.oids.data).getBytes()),x8.create(x8.Class.CONTEXT_SPECIFIC,0,!0,[x8.create(x8.Class.UNIVERSAL,x8.Type.OCTETSTRING,!1,x8.toDer(D).getBytes())])]);j.push(f)}var G=null;if(q!==null){var Z=Nz.wrapRsaPrivateKey(Nz.privateKeyToAsn1(q));if(_===null)G=x8.create(x8.Class.UNIVERSAL,x8.Type.SEQUENCE,!0,[x8.create(x8.Class.UNIVERSAL,x8.Type.OID,!1,x8.oidToDer(Nz.oids.keyBag).getBytes()),x8.create(x8.Class.CONTEXT_SPECIFIC,0,!0,[Z]),$]);else G=x8.create(x8.Class.UNIVERSAL,x8.Type.SEQUENCE,!0,[x8.create(x8.Class.UNIVERSAL,x8.Type.OID,!1,x8.oidToDer(Nz.oids.pkcs8ShroudedKeyBag).getBytes()),x8.create(x8.Class.CONTEXT_SPECIFIC,0,!0,[Nz.encryptPrivateKeyInfo(Z,_,z)]),$]);var T=x8.create(x8.Class.UNIVERSAL,x8.Type.SEQUENCE,!0,[G]),v=x8.create(x8.Class.UNIVERSAL,x8.Type.SEQUENCE,!0,[x8.create(x8.Class.UNIVERSAL,x8.Type.OID,!1,x8.oidToDer(Nz.oids.data).getBytes()),x8.create(x8.Class.CONTEXT_SPECIFIC,0,!0,[x8.create(x8.Class.UNIVERSAL,x8.Type.OCTETSTRING,!1,x8.toDer(T).getBytes())])]);j.push(v)}var V=x8.create(x8.Class.UNIVERSAL,x8.Type.SEQUENCE,!0,j),E;if(z.useMac){var O=sw.md.sha1.create(),S=new sw.util.ByteBuffer(sw.random.getBytes(z.saltSize)),R=z.count,q=Ci6.generateKey(_,S,3,R,20),x=sw.hmac.create();x.start(O,q),x.update(x8.toDer(V).getBytes());var I=x.getMac();E=x8.create(x8.Class.UNIVERSAL,x8.Type.SEQUENCE,!0,[x8.create(x8.Class.UNIVERSAL,x8.Type.SEQUENCE,!0,[x8.create(x8.Class.UNIVERSAL,x8.Type.SEQUENCE,!0,[x8.create(x8.Class.UNIVERSAL,x8.Type.OID,!1,x8.oidToDer(Nz.oids.sha1).getBytes()),x8.create(x8.Class.UNIVERSAL,x8.Type.NULL,!1,"")]),x8.create(x8.Class.UNIVERSAL,x8.Type.OCTETSTRING,!1,I.getBytes())]),x8.create(x8.Class.UNIVERSAL,x8.Type.OCTETSTRING,!1,S.getBytes()),x8.create(x8.Class.UNIVERSAL,x8.Type.INTEGER,!1,x8.integerToDer(R).getBytes())])}return x8.create(x8.Class.UNIVERSAL,x8.Type.SEQUENCE,!0,[x8.create(x8.Class.UNIVERSAL,x8.Type.INTEGER,!1,x8.integerToDer(3).getBytes()),x8.create(x8.Class.UNIVERSAL,x8.Type.SEQUENCE,!0,[x8.create(x8.Class.UNIVERSAL,x8.Type.OID,!1,x8.oidToDer(Nz.oids.data).getBytes()),x8.create(x8.Class.CONTEXT_SPECIFIC,0,!0,[x8.create(x8.Class.UNIVERSAL,x8.Type.OCTETSTRING,!1,x8.toDer(V).getBytes())])]),E])};Ci6.generateKey=sw.pbe.generatePkcs12Key});var xb1=m((TlA,Pw4)=>{var I76=E_();Iu();S76();Eb1();JO6();Sv8();Cb1();pv8();hi6();_$();Fv8();var bb1=I76.asn1,Mk6=Pw4.exports=I76.pki=I76.pki||{};Mk6.pemToDer=function(q){var K=I76.pem.decode(q)[0];if(K.procType&&K.procType.type==="ENCRYPTED")throw Error("Could not convert PEM to DER; PEM is encrypted.");return I76.util.createBuffer(K.body)};Mk6.privateKeyFromPem=function(q){var K=I76.pem.decode(q)[0];if(K.type!=="PRIVATE KEY"&&K.type!=="RSA PRIVATE KEY"){var _=Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw _.headerType=K.type,_}if(K.procType&&K.procType.type==="ENCRYPTED")throw Error("Could not convert private key from PEM; PEM is encrypted.");var z=bb1.fromDer(K.body);return Mk6.privateKeyFromAsn1(z)};Mk6.privateKeyToPem=function(q,K){var _={type:"RSA PRIVATE KEY",body:bb1.toDer(Mk6.privateKeyToAsn1(q)).getBytes()};return I76.pem.encode(_,{maxline:K})};Mk6.privateKeyInfoToPem=function(q,K){var _={type:"PRIVATE KEY",body:bb1.toDer(q).getBytes()};return I76.pem.encode(_,{maxline:K})}});var gb1=m((vlA,kw4)=>{var p7=E_();Iu();Yk6();Ev8();JO6();xb1();WC();wk6();_$();var dv8=function(q,K,_,z){var Y=p7.util.createBuffer(),$=q.length>>1,A=$+(q.length&1),O=q.substr(0,A),w=q.substr($,A),j=p7.util.createBuffer(),H=p7.hmac.create();_=K+_;var J=Math.ceil(z/16),M=Math.ceil(z/20);H.start("MD5",O);var X=p7.util.createBuffer();j.putBytes(_);for(var P=0;P<J;++P)H.start(null,null),H.update(j.getBytes()),j.putBuffer(H.digest()),H.start(null,null),H.update(j.bytes()+_),X.putBuffer(H.digest());H.start("SHA1",w);var W=p7.util.createBuffer();j.clear(),j.putBytes(_);for(var P=0;P<M;++P)H.start(null,null),H.update(j.getBytes()),j.putBuffer(H.digest()),H.start(null,null),H.update(j.bytes()+_),W.putBuffer(H.digest());return Y.putBytes(p7.util.xorBytes(X.getBytes(),W.getBytes(),z)),Y},QF_=function(q,K,_){var z=p7.hmac.create();z.start("SHA1",q);var Y=p7.util.createBuffer();return Y.putInt32(K[0]),Y.putInt32(K[1]),Y.putByte(_.type),Y.putByte(_.version.major),Y.putByte(_.version.minor),Y.putInt16(_.length),Y.putBytes(_.fragment.bytes()),z.update(Y.getBytes()),z.digest().getBytes()},dF_=function(q,K,_){var z=!1;try{var Y=q.deflate(K.fragment.getBytes());K.fragment=p7.util.createBuffer(Y),K.length=Y.length,z=!0}catch($){}return z},cF_=function(q,K,_){var z=!1;try{var Y=q.inflate(K.fragment.getBytes());K.fragment=p7.util.createBuffer(Y),K.length=Y.length,z=!0}catch($){}return z},ZL=function(q,K){var _=0;switch(K){case 1:_=q.getByte();break;case 2:_=q.getInt16();break;case 3:_=q.getInt24();break;case 4:_=q.getInt32();break}return p7.util.createBuffer(q.getBytes(_))},GC=function(q,K,_){q.putInt(_.length(),K<<3),q.putBuffer(_)},O8={};O8.Versions={TLS_1_0:{major:3,minor:1},TLS_1_1:{major:3,minor:2},TLS_1_2:{major:3,minor:3}};O8.SupportedVersions=[O8.Versions.TLS_1_1,O8.Versions.TLS_1_0];O8.Version=O8.SupportedVersions[0];O8.MaxFragment=15360;O8.ConnectionEnd={server:0,client:1};O8.PRFAlgorithm={tls_prf_sha256:0};O8.BulkCipherAlgorithm={none:null,rc4:0,des3:1,aes:2};O8.CipherType={stream:0,block:1,aead:2};O8.MACAlgorithm={none:null,hmac_md5:0,hmac_sha1:1,hmac_sha256:2,hmac_sha384:3,hmac_sha512:4};O8.CompressionMethod={none:0,deflate:1};O8.ContentType={change_cipher_spec:20,alert:21,handshake:22,application_data:23,heartbeat:24};O8.HandshakeType={hello_request:0,client_hello:1,server_hello:2,certificate:11,server_key_exchange:12,certificate_request:13,server_hello_done:14,certificate_verify:15,client_key_exchange:16,finished:20};O8.Alert={};O8.Alert.Level={warning:1,fatal:2};O8.Alert.Description={close_notify:0,unexpected_message:10,bad_record_mac:20,decryption_failed:21,record_overflow:22,decompression_failure:30,handshake_failure:40,bad_certificate:42,unsupported_certificate:43,certificate_revoked:44,certificate_expired:45,certificate_unknown:46,illegal_parameter:47,unknown_ca:48,access_denied:49,decode_error:50,decrypt_error:51,export_restriction:60,protocol_version:70,insufficient_security:71,internal_error:80,user_canceled:90,no_renegotiation:100};O8.HeartbeatMessageType={heartbeat_request:1,heartbeat_response:2};O8.CipherSuites={};O8.getCipherSuite=function(q){var K=null;for(var _ in O8.CipherSuites){var z=O8.CipherSuites[_];if(z.id[0]===q.charCodeAt(0)&&z.id[1]===q.charCodeAt(1)){K=z;break}}return K};O8.handleUnexpected=function(q,K){var _=!q.open&&q.entity===O8.ConnectionEnd.client;if(!_)q.error(q,{message:"Unexpected message. Received TLS record out of order.",send:!0,alert:{level:O8.Alert.Level.fatal,description:O8.Alert.Description.unexpected_message}})};O8.handleHelloRequest=function(q,K,_){if(!q.handshaking&&q.handshakes>0)O8.queue(q,O8.createAlert(q,{level:O8.Alert.Level.warning,description:O8.Alert.Description.no_renegotiation})),O8.flush(q);q.process()};O8.parseHelloMessage=function(q,K,_){var z=null,Y=q.entity===O8.ConnectionEnd.client;if(_<38)q.error(q,{message:Y?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:O8.Alert.Level.fatal,description:O8.Alert.Description.illegal_parameter}});else{var $=K.fragment,A=$.length();if(z={version:{major:$.getByte(),minor:$.getByte()},random:p7.util.createBuffer($.getBytes(32)),session_id:ZL($,1),extensions:[]},Y)z.cipher_suite=$.getBytes(2),z.compression_method=$.getByte();else z.cipher_suites=ZL($,2),z.compression_methods=ZL($,1);if(A=_-(A-$.length()),A>0){var O=ZL($,2);while(O.length()>0)z.extensions.push({type:[O.getByte(),O.getByte()],data:ZL(O,2)});if(!Y)for(var w=0;w<z.extensions.length;++w){var j=z.extensions[w];if(j.type[0]===0&&j.type[1]===0){var H=ZL(j.data,2);while(H.length()>0){var J=H.getByte();if(J!==0)break;q.session.extensions.server_name.serverNameList.push(ZL(H,2).getBytes())}}}}if(q.session.version){if(z.version.major!==q.session.version.major||z.version.minor!==q.session.version.minor)return q.error(q,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:O8.Alert.Level.fatal,description:O8.Alert.Description.protocol_version}})}if(Y)q.session.cipherSuite=O8.getCipherSuite(z.cipher_suite);else{var M=p7.util.createBuffer(z.cipher_suites.bytes());while(M.length()>0)if(q.session.cipherSuite=O8.getCipherSuite(M.getBytes(2)),q.session.cipherSuite!==null)break}if(q.session.cipherSuite===null)return q.error(q,{message:"No cipher suites in common.",send:!0,alert:{level:O8.Alert.Level.fatal,description:O8.Alert.Description.handshake_failure},cipherSuite:p7.util.bytesToHex(z.cipher_suite)});if(Y)q.session.compressionMethod=z.compression_method;else q.session.compressionMethod=O8.CompressionMethod.none}return z};O8.createSecurityParameters=function(q,K){var _=q.entity===O8.ConnectionEnd.client,z=K.random.bytes(),Y=_?q.session.sp.client_random:z,$=_?z:O8.createRandom().getBytes();q.session.sp={entity:q.entity,prf_algorithm:O8.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:q.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:Y,server_random:$}};O8.handleServerHello=function(q,K,_){var z=O8.parseHelloMessage(q,K,_);if(q.fail)return;if(z.version.minor<=q.version.minor)q.version.minor=z.version.minor;else return q.error(q,{message:"Incompatible TLS version.",send:!0,alert:{level:O8.Alert.Level.fatal,description:O8.Alert.Description.protocol_version}});q.session.version=q.version;var Y=z.session_id.bytes();if(Y.length>0&&Y===q.session.id)q.expect=fw4,q.session.resuming=!0,q.session.sp.server_random=z.random.bytes();else q.expect=nF_,q.session.resuming=!1,O8.createSecurityParameters(q,z);q.session.id=Y,q.process()};O8.handleClientHello=function(q,K,_){var z=O8.parseHelloMessage(q,K,_);if(q.fail)return;var Y=z.session_id.bytes(),$=null;if(q.sessionCache){if($=q.sessionCache.getSession(Y),$===null)Y="";else if($.version.major!==z.version.major||$.version.minor>z.version.minor)$=null,Y=""}if(Y.length===0)Y=p7.random.getBytes(32);if(q.session.id=Y,q.session.clientHelloVersion=z.version,q.session.sp={},$)q.version=q.session.version=$.version,q.session.sp=$.sp;else{var A;for(var O=1;O<O8.SupportedVersions.length;++O)if(A=O8.SupportedVersions[O],A.minor<=z.version.minor)break;q.version={major:A.major,minor:A.minor},q.session.version=q.version}if($!==null)q.expect=pb1,q.session.resuming=!0,q.session.sp.client_random=z.random.bytes();else q.expect=q.verifyClient!==!1?eF_:mb1,q.session.resuming=!1,O8.createSecurityParameters(q,z);if(q.open=!0,O8.queue(q,O8.createRecord(q,{type:O8.ContentType.handshake,data:O8.createServerHello(q)})),q.session.resuming)O8.queue(q,O8.createRecord(q,{type:O8.ContentType.change_cipher_spec,data:O8.createChangeCipherSpec()})),q.state.pending=O8.createConnectionState(q),q.state.current.write=q.state.pending.write,O8.queue(q,O8.createRecord(q,{type:O8.ContentType.handshake,data:O8.createFinished(q)}));else if(O8.queue(q,O8.createRecord(q,{type:O8.ContentType.handshake,data:O8.createCertificate(q)})),!q.fail){if(O8.queue(q,O8.createRecord(q,{type:O8.ContentType.handshake,data:O8.createServerKeyExchange(q)})),q.verifyClient!==!1)O8.queue(q,O8.createRecord(q,{type:O8.ContentType.handshake,data:O8.createCertificateRequest(q)}));O8.queue(q,O8.createRecord(q,{type:O8.ContentType.handshake,data:O8.createServerHelloDone(q)}))}O8.flush(q),q.process()};O8.handleCertificate=function(q,K,_){if(_<3)return q.error(q,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:O8.Alert.Level.fatal,description:O8.Alert.Description.illegal_parameter}});var z=K.fragment,Y={certificate_list:ZL(z,3)},$,A,O=[];try{while(Y.certificate_list.length()>0)$=ZL(Y.certificate_list,3),A=p7.asn1.fromDer($),$=p7.pki.certificateFromAsn1(A,!0),O.push($)}catch(j){return q.error(q,{message:"Could not parse certificate list.",cause:j,send:!0,alert:{level:O8.Alert.Level.fatal,description:O8.Alert.Description.bad_certificate}})}var w=q.entity===O8.ConnectionEnd.client;if((w||q.verifyClient===!0)&&O.length===0)q.error(q,{message:w?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:O8.Alert.Level.fatal,description:O8.Alert.Description.illegal_parameter}});else if(O.length===0)q.expect=w?Ww4:mb1;else{if(w)q.session.serverCertificate=O[0];else q.session.clientCertificate=O[0];if(O8.verifyCertificateChain(q,O))q.expect=w?Ww4:mb1}q.process()};O8.handleServerKeyExchange=function(q,K,_){if(_>0)return q.error(q,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:O8.Alert.Level.fatal,description:O8.Alert.Description.unsupported_certificate}});q.expect=iF_,q.process()};O8.handleClientKeyExchange=function(q,K,_){if(_<48)return q.error(q,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:O8.Alert.Level.fatal,description:O8.Alert.Description.unsupported_certificate}});var z=K.fragment,Y={enc_pre_master_secret:ZL(z,2).getBytes()},$=null;if(q.getPrivateKey)try{$=q.getPrivateKey(q,q.session.serverCertificate),$=p7.pki.privateKeyFromPem($)}catch(w){q.error(q,{message:"Could not get private key.",cause:w,send:!0,alert:{level:O8.Alert.Level.fatal,description:O8.Alert.Description.internal_error}})}if($===null)return q.error(q,{message:"No private key set.",send:!0,alert:{level:O8.Alert.Level.fatal,description:O8.Alert.Description.internal_error}});try{var A=q.session.sp;A.pre_master_secret=$.decrypt(Y.enc_pre_master_secret);var O=q.session.clientHelloVersion;if(O.major!==A.pre_master_secret.charCodeAt(0)||O.minor!==A.pre_master_secret.charCodeAt(1))throw Error("TLS version rollback attack detected.")}catch(w){A.pre_master_secret=p7.random.getBytes(48)}if(q.expect=pb1,q.session.clientCertificate!==null)q.expect=qU_;q.process()};O8.handleCertificateRequest=function(q,K,_){if(_<3)return q.error(q,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:O8.Alert.Level.fatal,description:O8.Alert.Description.illegal_parameter}});var z=K.fragment,Y={certificate_types:ZL(z,1),certificate_authorities:ZL(z,2)};q.session.certificateRequest=Y,q.expect=rF_,q.process()};O8.handleCertificateVerify=function(q,K,_){if(_<2)return q.error(q,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:O8.Alert.Level.fatal,description:O8.Alert.Description.illegal_parameter}});var z=K.fragment;z.read-=4;var Y=z.bytes();z.read+=4;var $={signature:ZL(z,2).getBytes()},A=p7.util.createBuffer();A.putBuffer(q.session.md5.digest()),A.putBuffer(q.session.sha1.digest()),A=A.getBytes();try{var O=q.session.clientCertificate;if(!O.publicKey.verify(A,$.signature,"NONE"))throw Error("CertificateVerify signature does not match.");q.session.md5.update(Y),q.session.sha1.update(Y)}catch(w){return q.error(q,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:O8.Alert.Level.fatal,description:O8.Alert.Description.handshake_failure}})}q.expect=pb1,q.process()};O8.handleServerHelloDone=function(q,K,_){if(_>0)return q.error(q,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:O8.Alert.Level.fatal,description:O8.Alert.Description.record_overflow}});if(q.serverCertificate===null){var z={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:O8.Alert.Level.fatal,description:O8.Alert.Description.insufficient_security}},Y=0,$=q.verify(q,z.alert.description,Y,[]);if($!==!0){if($||$===0){if(typeof $==="object"&&!p7.util.isArray($)){if($.message)z.message=$.message;if($.alert)z.alert.description=$.alert}else if(typeof $==="number")z.alert.description=$}return q.error(q,z)}}if(q.session.certificateRequest!==null)K=O8.createRecord(q,{type:O8.ContentType.handshake,data:O8.createCertificate(q)}),O8.queue(q,K);K=O8.createRecord(q,{type:O8.ContentType.handshake,data:O8.createClientKeyExchange(q)}),O8.queue(q,K),q.expect=sF_;var A=function(O,w){if(O.session.certificateRequest!==null&&O.session.clientCertificate!==null)O8.queue(O,O8.createRecord(O,{type:O8.ContentType.handshake,data:O8.createCertificateVerify(O,w)}));O8.queue(O,O8.createRecord(O,{type:O8.ContentType.change_cipher_spec,data:O8.createChangeCipherSpec()})),O.state.pending=O8.createConnectionState(O),O.state.current.write=O.state.pending.write,O8.queue(O,O8.createRecord(O,{type:O8.ContentType.handshake,data:O8.createFinished(O)})),O.expect=fw4,O8.flush(O),O.process()};if(q.session.certificateRequest===null||q.session.clientCertificate===null)return A(q,null);O8.getClientSignature(q,A)};O8.handleChangeCipherSpec=function(q,K){if(K.fragment.getByte()!==1)return q.error(q,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:O8.Alert.Level.fatal,description:O8.Alert.Description.illegal_parameter}});var _=q.entity===O8.ConnectionEnd.client;if(q.session.resuming&&_||!q.session.resuming&&!_)q.state.pending=O8.createConnectionState(q);if(q.state.current.read=q.state.pending.read,!q.session.resuming&&_||q.session.resuming&&!_)q.state.pending=null;q.expect=_?oF_:KU_,q.process()};O8.handleFinished=function(q,K,_){var z=K.fragment;z.read-=4;var Y=z.bytes();z.read+=4;var $=K.fragment.getBytes();z=p7.util.createBuffer(),z.putBuffer(q.session.md5.digest()),z.putBuffer(q.session.sha1.digest());var A=q.entity===O8.ConnectionEnd.client,O=A?"server finished":"client finished",w=q.session.sp,j=12,H=dv8;if(z=H(w.master_secret,O,z.getBytes(),j),z.getBytes()!==$)return q.error(q,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:O8.Alert.Level.fatal,description:O8.Alert.Description.decrypt_error}});if(q.session.md5.update(Y),q.session.sha1.update(Y),q.session.resuming&&A||!q.session.resuming&&!A)O8.queue(q,O8.createRecord(q,{type:O8.ContentType.change_cipher_spec,data:O8.createChangeCipherSpec()})),q.state.current.write=q.state.pending.write,q.state.pending=null,O8.queue(q,O8.createRecord(q,{type:O8.ContentType.handshake,data:O8.createFinished(q)}));q.expect=A?aF_:_U_,q.handshaking=!1,++q.handshakes,q.peerCertificate=A?q.session.serverCertificate:q.session.clientCertificate,O8.flush(q),q.isConnected=!0,q.connected(q),q.process()};O8.handleAlert=function(q,K){var _=K.fragment,z={level:_.getByte(),description:_.getByte()},Y;switch(z.description){case O8.Alert.Description.close_notify:Y="Connection closed.";break;case O8.Alert.Description.unexpected_message:Y="Unexpected message.";break;case O8.Alert.Description.bad_record_mac:Y="Bad record MAC.";break;case O8.Alert.Description.decryption_failed:Y="Decryption failed.";break;case O8.Alert.Description.record_overflow:Y="Record overflow.";break;case O8.Alert.Description.decompression_failure:Y="Decompression failed.";break;case O8.Alert.Description.handshake_failure:Y="Handshake failure.";break;case O8.Alert.Description.bad_certificate:Y="Bad certificate.";break;case O8.Alert.Description.unsupported_certificate:Y="Unsupported certificate.";break;case O8.Alert.Description.certificate_revoked:Y="Certificate revoked.";break;case O8.Alert.Description.certificate_expired:Y="Certificate expired.";break;case O8.Alert.Description.certificate_unknown:Y="Certificate unknown.";break;case O8.Alert.Description.illegal_parameter:Y="Illegal parameter.";break;case O8.Alert.Description.unknown_ca:Y="Unknown certificate authority.";break;case O8.Alert.Description.access_denied:Y="Access denied.";break;case O8.Alert.Description.decode_error:Y="Decode error.";break;case O8.Alert.Description.decrypt_error:Y="Decrypt error.";break;case O8.Alert.Description.export_restriction:Y="Export restriction.";break;case O8.Alert.Description.protocol_version:Y="Unsupported protocol version.";break;case O8.Alert.Description.insufficient_security:Y="Insufficient security.";break;case O8.Alert.Description.internal_error:Y="Internal error.";break;case O8.Alert.Description.user_canceled:Y="User canceled.";break;case O8.Alert.Description.no_renegotiation:Y="Renegotiation not supported.";break;default:Y="Unknown error.";break}if(z.description===O8.Alert.Description.close_notify)return q.close();q.error(q,{message:Y,send:!1,origin:q.entity===O8.ConnectionEnd.client?"server":"client",alert:z}),q.process()};O8.handleHandshake=function(q,K){var _=K.fragment,z=_.getByte(),Y=_.getInt24();if(Y>_.length())return q.fragmented=K,K.fragment=p7.util.createBuffer(),_.read-=4,q.process();q.fragmented=null,_.read-=4;var $=_.bytes(Y+4);if(_.read+=4,z in Qv8[q.entity][q.expect]){if(q.entity===O8.ConnectionEnd.server&&!q.open&&!q.fail)q.handshaking=!0,q.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:p7.md.md5.create(),sha1:p7.md.sha1.create()};if(z!==O8.HandshakeType.hello_request&&z!==O8.HandshakeType.certificate_verify&&z!==O8.HandshakeType.finished)q.session.md5.update($),q.session.sha1.update($);Qv8[q.entity][q.expect][z](q,K,Y)}else O8.handleUnexpected(q,K)};O8.handleApplicationData=function(q,K){q.data.putBuffer(K.fragment),q.dataReady(q),q.process()};O8.handleHeartbeat=function(q,K){var _=K.fragment,z=_.getByte(),Y=_.getInt16(),$=_.getBytes(Y);if(z===O8.HeartbeatMessageType.heartbeat_request){if(q.handshaking||Y>$.length)return q.process();O8.queue(q,O8.createRecord(q,{type:O8.ContentType.heartbeat,data:O8.createHeartbeat(O8.HeartbeatMessageType.heartbeat_response,$)})),O8.flush(q)}else if(z===O8.HeartbeatMessageType.heartbeat_response){if($!==q.expectedHeartbeatPayload)return q.process();if(q.heartbeatReceived)q.heartbeatReceived(q,p7.util.createBuffer($))}q.process()};var lF_=0,nF_=1,Ww4=2,iF_=3,rF_=4,fw4=5,oF_=6,aF_=7,sF_=8,tF_=0,eF_=1,mb1=2,qU_=3,pb1=4,KU_=5,_U_=6,Y8=O8.handleUnexpected,Zw4=O8.handleChangeCipherSpec,_0=O8.handleAlert,Iv=O8.handleHandshake,Gw4=O8.handleApplicationData,z0=O8.handleHeartbeat,Bb1=[];Bb1[O8.ConnectionEnd.client]=[[Y8,_0,Iv,Y8,z0],[Y8,_0,Iv,Y8,z0],[Y8,_0,Iv,Y8,z0],[Y8,_0,Iv,Y8,z0],[Y8,_0,Iv,Y8,z0],[Zw4,_0,Y8,Y8,z0],[Y8,_0,Iv,Y8,z0],[Y8,_0,Iv,Gw4,z0],[Y8,_0,Iv,Y8,z0]];Bb1[O8.ConnectionEnd.server]=[[Y8,_0,Iv,Y8,z0],[Y8,_0,Iv,Y8,z0],[Y8,_0,Iv,Y8,z0],[Y8,_0,Iv,Y8,z0],[Zw4,_0,Y8,Y8,z0],[Y8,_0,Iv,Y8,z0],[Y8,_0,Iv,Gw4,z0],[Y8,_0,Iv,Y8,z0]];var{handleHelloRequest:u76,handleServerHello:zU_,handleCertificate:Tw4,handleServerKeyExchange:Dw4,handleCertificateRequest:Ib1,handleServerHelloDone:Uv8,handleFinished:vw4}=O8,Qv8=[];Qv8[O8.ConnectionEnd.client]=[[Y8,Y8,zU_,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8],[u76,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Tw4,Dw4,Ib1,Uv8,Y8,Y8,Y8,Y8,Y8,Y8],[u76,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Dw4,Ib1,Uv8,Y8,Y8,Y8,Y8,Y8,Y8],[u76,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Ib1,Uv8,Y8,Y8,Y8,Y8,Y8,Y8],[u76,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Uv8,Y8,Y8,Y8,Y8,Y8,Y8],[u76,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8],[u76,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,vw4],[u76,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8],[u76,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8]];var{handleClientHello:YU_,handleClientKeyExchange:$U_,handleCertificateVerify:AU_}=O8;Qv8[O8.ConnectionEnd.server]=[[Y8,YU_,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8],[Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Tw4,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8],[Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,$U_,Y8,Y8,Y8,Y8],[Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,AU_,Y8,Y8,Y8,Y8,Y8],[Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8],[Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,vw4],[Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8],[Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8,Y8]];O8.generateKeys=function(q,K){var _=dv8,z=K.client_random+K.server_random;if(!q.session.resuming)K.master_secret=_(K.pre_master_secret,"master secret",z,48).bytes(),K.pre_master_secret=null;z=K.server_random+K.client_random;var Y=2*K.mac_key_length+2*K.enc_key_length,$=q.version.major===O8.Versions.TLS_1_0.major&&q.version.minor===O8.Versions.TLS_1_0.minor;if($)Y+=2*K.fixed_iv_length;var A=_(K.master_secret,"key expansion",z,Y),O={client_write_MAC_key:A.getBytes(K.mac_key_length),server_write_MAC_key:A.getBytes(K.mac_key_length),client_write_key:A.getBytes(K.enc_key_length),server_write_key:A.getBytes(K.enc_key_length)};if($)O.client_write_IV=A.getBytes(K.fixed_iv_length),O.server_write_IV=A.getBytes(K.fixed_iv_length);return O};O8.createConnectionState=function(q){var K=q.entity===O8.ConnectionEnd.client,_=function(){var $={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(A){return!0},compressionState:null,compressFunction:function(A){return!0},updateSequenceNumber:function(){if($.sequenceNumber[1]===4294967295)$.sequenceNumber[1]=0,++$.sequenceNumber[0];else++$.sequenceNumber[1]}};return $},z={read:_(),write:_()};if(z.read.update=function($,A){if(!z.read.cipherFunction(A,z.read))$.error($,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:O8.Alert.Level.fatal,description:O8.Alert.Description.bad_record_mac}});else if(!z.read.compressFunction($,A,z.read))$.error($,{message:"Could not decompress record.",send:!0,alert:{level:O8.Alert.Level.fatal,description:O8.Alert.Description.decompression_failure}});return!$.fail},z.write.update=function($,A){if(!z.write.compressFunction($,A,z.write))$.error($,{message:"Could not compress record.",send:!1,alert:{level:O8.Alert.Level.fatal,description:O8.Alert.Description.internal_error}});else if(!z.write.cipherFunction(A,z.write))$.error($,{message:"Could not encrypt record.",send:!1,alert:{level:O8.Alert.Level.fatal,description:O8.Alert.Description.internal_error}});return!$.fail},q.session){var Y=q.session.sp;switch(q.session.cipherSuite.initSecurityParameters(Y),Y.keys=O8.generateKeys(q,Y),z.read.macKey=K?Y.keys.server_write_MAC_key:Y.keys.client_write_MAC_key,z.write.macKey=K?Y.keys.client_write_MAC_key:Y.keys.server_write_MAC_key,q.session.cipherSuite.initConnectionState(z,q,Y),Y.compression_algorithm){case O8.CompressionMethod.none:break;case O8.CompressionMethod.deflate:z.read.compressFunction=cF_,z.write.compressFunction=dF_;break;default:throw Error("Unsupported compression algorithm.")}}return z};O8.createRandom=function(){var q=new Date,K=+q+q.getTimezoneOffset()*60000,_=p7.util.createBuffer();return _.putInt32(K),_.putBytes(p7.random.getBytes(28)),_};O8.createRecord=function(q,K){if(!K.data)return null;var _={type:K.type,version:{major:q.version.major,minor:q.version.minor},length:K.data.length(),fragment:K.data};return _};O8.createAlert=function(q,K){var _=p7.util.createBuffer();return _.putByte(K.level),_.putByte(K.description),O8.createRecord(q,{type:O8.ContentType.alert,data:_})};O8.createClientHello=function(q){q.session.clientHelloVersion={major:q.version.major,minor:q.version.minor};var K=p7.util.createBuffer();for(var _=0;_<q.cipherSuites.length;++_){var z=q.cipherSuites[_];K.putByte(z.id[0]),K.putByte(z.id[1])}var Y=K.length(),$=p7.util.createBuffer();$.putByte(O8.CompressionMethod.none);var A=$.length(),O=p7.util.createBuffer();if(q.virtualHost){var w=p7.util.createBuffer();w.putByte(0),w.putByte(0);var j=p7.util.createBuffer();j.putByte(0),GC(j,2,p7.util.createBuffer(q.virtualHost));var H=p7.util.createBuffer();GC(H,2,j),GC(w,2,H),O.putBuffer(w)}var J=O.length();if(J>0)J+=2;var M=q.session.id,X=M.length+1+2+4+28+2+Y+1+A+J,P=p7.util.createBuffer();if(P.putByte(O8.HandshakeType.client_hello),P.putInt24(X),P.putByte(q.version.major),P.putByte(q.version.minor),P.putBytes(q.session.sp.client_random),GC(P,1,p7.util.createBuffer(M)),GC(P,2,K),GC(P,1,$),J>0)GC(P,2,O);return P};O8.createServerHello=function(q){var K=q.session.id,_=K.length+1+2+4+28+2+1,z=p7.util.createBuffer();return z.putByte(O8.HandshakeType.server_hello),z.putInt24(_),z.putByte(q.version.major),z.putByte(q.version.minor),z.putBytes(q.session.sp.server_random),GC(z,1,p7.util.createBuffer(K)),z.putByte(q.session.cipherSuite.id[0]),z.putByte(q.session.cipherSuite.id[1]),z.putByte(q.session.compressionMethod),z};O8.createCertificate=function(q){var K=q.entity===O8.ConnectionEnd.client,_=null;if(q.getCertificate){var z;if(K)z=q.session.certificateRequest;else z=q.session.extensions.server_name.serverNameList;_=q.getCertificate(q,z)}var Y=p7.util.createBuffer();if(_!==null)try{if(!p7.util.isArray(_))_=[_];var $=null;for(var A=0;A<_.length;++A){var O=p7.pem.decode(_[A])[0];if(O.type!=="CERTIFICATE"&&O.type!=="X509 CERTIFICATE"&&O.type!=="TRUSTED CERTIFICATE"){var w=Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw w.headerType=O.type,w}if(O.procType&&O.procType.type==="ENCRYPTED")throw Error("Could not convert certificate from PEM; PEM is encrypted.");var j=p7.util.createBuffer(O.body);if($===null)$=p7.asn1.fromDer(j.bytes(),!1);var H=p7.util.createBuffer();GC(H,3,j),Y.putBuffer(H)}if(_=p7.pki.certificateFromAsn1($),K)q.session.clientCertificate=_;else q.session.serverCertificate=_}catch(X){return q.error(q,{message:"Could not send certificate list.",cause:X,send:!0,alert:{level:O8.Alert.Level.fatal,description:O8.Alert.Description.bad_certificate}})}var J=3+Y.length(),M=p7.util.createBuffer();return M.putByte(O8.HandshakeType.certificate),M.putInt24(J),GC(M,3,Y),M};O8.createClientKeyExchange=function(q){var K=p7.util.createBuffer();K.putByte(q.session.clientHelloVersion.major),K.putByte(q.session.clientHelloVersion.minor),K.putBytes(p7.random.getBytes(46));var _=q.session.sp;_.pre_master_secret=K.getBytes();var z=q.session.serverCertificate.publicKey;K=z.encrypt(_.pre_master_secret);var Y=K.length+2,$=p7.util.createBuffer();return $.putByte(O8.HandshakeType.client_key_exchange),$.putInt24(Y),$.putInt16(K.length),$.putBytes(K),$};O8.createServerKeyExchange=function(q){var K=0,_=p7.util.createBuffer();if(K>0)_.putByte(O8.HandshakeType.server_key_exchange),_.putInt24(K);return _};O8.getClientSignature=function(q,K){var _=p7.util.createBuffer();_.putBuffer(q.session.md5.digest()),_.putBuffer(q.session.sha1.digest()),_=_.getBytes(),q.getSignature=q.getSignature||function(z,Y,$){var A=null;if(z.getPrivateKey)try{A=z.getPrivateKey(z,z.session.clientCertificate),A=p7.pki.privateKeyFromPem(A)}catch(O){z.error(z,{message:"Could not get private key.",cause:O,send:!0,alert:{level:O8.Alert.Level.fatal,description:O8.Alert.Description.internal_error}})}if(A===null)z.error(z,{message:"No private key set.",send:!0,alert:{level:O8.Alert.Level.fatal,description:O8.Alert.Description.internal_error}});else Y=A.sign(Y,null);$(z,Y)},q.getSignature(q,_,K)};O8.createCertificateVerify=function(q,K){var _=K.length+2,z=p7.util.createBuffer();return z.putByte(O8.HandshakeType.certificate_verify),z.putInt24(_),z.putInt16(K.length),z.putBytes(K),z};O8.createCertificateRequest=function(q){var K=p7.util.createBuffer();K.putByte(1);var _=p7.util.createBuffer();for(var z in q.caStore.certs){var Y=q.caStore.certs[z],$=p7.pki.distinguishedNameToAsn1(Y.subject),A=p7.asn1.toDer($);_.putInt16(A.length()),_.putBuffer(A)}var O=1+K.length()+2+_.length(),w=p7.util.createBuffer();return w.putByte(O8.HandshakeType.certificate_request),w.putInt24(O),GC(w,1,K),GC(w,2,_),w};O8.createServerHelloDone=function(q){var K=p7.util.createBuffer();return K.putByte(O8.HandshakeType.server_hello_done),K.putInt24(0),K};O8.createChangeCipherSpec=function(){var q=p7.util.createBuffer();return q.putByte(1),q};O8.createFinished=function(q){var K=p7.util.createBuffer();K.putBuffer(q.session.md5.digest()),K.putBuffer(q.session.sha1.digest());var _=q.entity===O8.ConnectionEnd.client,z=q.session.sp,Y=12,$=dv8,A=_?"client finished":"server finished";K=$(z.master_secret,A,K.getBytes(),Y);var O=p7.util.createBuffer();return O.putByte(O8.HandshakeType.finished),O.putInt24(K.length()),O.putBuffer(K),O};O8.createHeartbeat=function(q,K,_){if(typeof _>"u")_=K.length;var z=p7.util.createBuffer();z.putByte(q),z.putInt16(_),z.putBytes(K);var Y=z.length(),$=Math.max(16,Y-_-3);return z.putBytes(p7.random.getBytes($)),z};O8.queue=function(q,K){if(!K)return;if(K.fragment.length()===0){if(K.type===O8.ContentType.handshake||K.type===O8.ContentType.alert||K.type===O8.ContentType.change_cipher_spec)return}if(K.type===O8.ContentType.handshake){var _=K.fragment.bytes();q.session.md5.update(_),q.session.sha1.update(_),_=null}var z;if(K.fragment.length()<=O8.MaxFragment)z=[K];else{z=[];var Y=K.fragment.bytes();while(Y.length>O8.MaxFragment)z.push(O8.createRecord(q,{type:K.type,data:p7.util.createBuffer(Y.slice(0,O8.MaxFragment))})),Y=Y.slice(O8.MaxFragment);if(Y.length>0)z.push(O8.createRecord(q,{type:K.type,data:p7.util.createBuffer(Y)}))}for(var $=0;$<z.length&&!q.fail;++$){var A=z[$],O=q.state.current.write;if(O.update(q,A))q.records.push(A)}};O8.flush=function(q){for(var K=0;K<q.records.length;++K){var _=q.records[K];q.tlsData.putByte(_.type),q.tlsData.putByte(_.version.major),q.tlsData.putByte(_.version.minor),q.tlsData.putInt16(_.fragment.length()),q.tlsData.putBuffer(q.records[K].fragment)}return q.records=[],q.tlsDataReady(q)};var ub1=function(q){switch(q){case!0:return!0;case p7.pki.certificateError.bad_certificate:return O8.Alert.Description.bad_certificate;case p7.pki.certificateError.unsupported_certificate:return O8.Alert.Description.unsupported_certificate;case p7.pki.certificateError.certificate_revoked:return O8.Alert.Description.certificate_revoked;case p7.pki.certificateError.certificate_expired:return O8.Alert.Description.certificate_expired;case p7.pki.certificateError.certificate_unknown:return O8.Alert.Description.certificate_unknown;case p7.pki.certificateError.unknown_ca:return O8.Alert.Description.unknown_ca;default:return O8.Alert.Description.bad_certificate}},OU_=function(q){switch(q){case!0:return!0;case O8.Alert.Description.bad_certificate:return p7.pki.certificateError.bad_certificate;case O8.Alert.Description.unsupported_certificate:return p7.pki.certificateError.unsupported_certificate;case O8.Alert.Description.certificate_revoked:return p7.pki.certificateError.certificate_revoked;case O8.Alert.Description.certificate_expired:return p7.pki.certificateError.certificate_expired;case O8.Alert.Description.certificate_unknown:return p7.pki.certificateError.certificate_unknown;case O8.Alert.Description.unknown_ca:return p7.pki.certificateError.unknown_ca;default:return p7.pki.certificateError.bad_certificate}};O8.verifyCertificateChain=function(q,K){try{var _={};for(var z in q.verifyOptions)_[z]=q.verifyOptions[z];_.verify=function($,A,O){var w=ub1($),j=q.verify(q,$,A,O);if(j!==!0){if(typeof j==="object"&&!p7.util.isArray(j)){var H=Error("The application rejected the certificate.");if(H.send=!0,H.alert={level:O8.Alert.Level.fatal,description:O8.Alert.Description.bad_certificate},j.message)H.message=j.message;if(j.alert)H.alert.description=j.alert;throw H}if(j!==$)j=OU_(j)}return j},p7.pki.verifyCertificateChain(q.caStore,K,_)}catch($){var Y=$;if(typeof Y!=="object"||p7.util.isArray(Y))Y={send:!0,alert:{level:O8.Alert.Level.fatal,description:ub1($)}};if(!("send"in Y))Y.send=!0;if(!("alert"in Y))Y.alert={level:O8.Alert.Level.fatal,description:ub1(Y.error)};q.error(q,Y)}return!q.fail};O8.createSessionCache=function(q,K){var _=null;if(q&&q.getSession&&q.setSession&&q.order)_=q;else{_={},_.cache=q||{},_.capacity=Math.max(K||100,1),_.order=[];for(var z in q)if(_.order.length<=K)_.order.push(z);else delete q[z];_.getSession=function(Y){var $=null,A=null;if(Y)A=p7.util.bytesToHex(Y);else if(_.order.length>0)A=_.order[0];if(A!==null&&A in _.cache){$=_.cache[A],delete _.cache[A];for(var O in _.order)if(_.order[O]===A){_.order.splice(O,1);break}}return $},_.setSession=function(Y,$){if(_.order.length===_.capacity){var A=_.order.shift();delete _.cache[A]}var A=p7.util.bytesToHex(Y);_.order.push(A),_.cache[A]=$}}return _};O8.createConnection=function(q){var K=null;if(q.caStore)if(p7.util.isArray(q.caStore))K=p7.pki.createCaStore(q.caStore);else K=q.caStore;else K=p7.pki.createCaStore();var _=q.cipherSuites||null;if(_===null){_=[];for(var z in O8.CipherSuites)_.push(O8.CipherSuites[z])}var Y=q.server?O8.ConnectionEnd.server:O8.ConnectionEnd.client,$=q.sessionCache?O8.createSessionCache(q.sessionCache):null,A={version:{major:O8.Version.major,minor:O8.Version.minor},entity:Y,sessionId:q.sessionId,caStore:K,sessionCache:$,cipherSuites:_,connected:q.connected,virtualHost:q.virtualHost||null,verifyClient:q.verifyClient||!1,verify:q.verify||function(H,J,M,X){return J},verifyOptions:q.verifyOptions||{},getCertificate:q.getCertificate||null,getPrivateKey:q.getPrivateKey||null,getSignature:q.getSignature||null,input:p7.util.createBuffer(),tlsData:p7.util.createBuffer(),data:p7.util.createBuffer(),tlsDataReady:q.tlsDataReady,dataReady:q.dataReady,heartbeatReceived:q.heartbeatReceived,closed:q.closed,error:function(H,J){if(J.origin=J.origin||(H.entity===O8.ConnectionEnd.client?"client":"server"),J.send)O8.queue(H,O8.createAlert(H,J.alert)),O8.flush(H);var M=J.fatal!==!1;if(M)H.fail=!0;if(q.error(H,J),M)H.close(!1)},deflate:q.deflate||null,inflate:q.inflate||null};A.reset=function(H){A.version={major:O8.Version.major,minor:O8.Version.minor},A.record=null,A.session=null,A.peerCertificate=null,A.state={pending:null,current:null},A.expect=A.entity===O8.ConnectionEnd.client?lF_:tF_,A.fragmented=null,A.records=[],A.open=!1,A.handshakes=0,A.handshaking=!1,A.isConnected=!1,A.fail=!(H||typeof H>"u"),A.input.clear(),A.tlsData.clear(),A.data.clear(),A.state.current=O8.createConnectionState(A)},A.reset();var O=function(H,J){var M=J.type-O8.ContentType.change_cipher_spec,X=Bb1[H.entity][H.expect];if(M in X)X[M](H,J);else O8.handleUnexpected(H,J)},w=function(H){var J=0,M=H.input,X=M.length();if(X<5)J=5-X;else{H.record={type:M.getByte(),version:{major:M.getByte(),minor:M.getByte()},length:M.getInt16(),fragment:p7.util.createBuffer(),ready:!1};var P=H.record.version.major===H.version.major;if(P&&H.session&&H.session.version)P=H.record.version.minor===H.version.minor;if(!P)H.error(H,{message:"Incompatible TLS version.",send:!0,alert:{level:O8.Alert.Level.fatal,description:O8.Alert.Description.protocol_version}})}return J},j=function(H){var J=0,M=H.input,X=M.length();if(X<H.record.length)J=H.record.length-X;else{H.record.fragment.putBytes(M.getBytes(H.record.length)),M.compact();var P=H.state.current.read;if(P.update(H,H.record)){if(H.fragmented!==null)if(H.fragmented.type===H.record.type)H.fragmented.fragment.putBuffer(H.record.fragment),H.record=H.fragmented;else H.error(H,{message:"Invalid fragmented record.",send:!0,alert:{level:O8.Alert.Level.fatal,description:O8.Alert.Description.unexpected_message}});H.record.ready=!0}}return J};return A.handshake=function(H){if(A.entity!==O8.ConnectionEnd.client)A.error(A,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(A.handshaking)A.error(A,{message:"Handshake already in progress.",fatal:!1});else{if(A.fail&&!A.open&&A.handshakes===0)A.fail=!1;A.handshaking=!0,H=H||"";var J=null;if(H.length>0){if(A.sessionCache)J=A.sessionCache.getSession(H);if(J===null)H=""}if(H.length===0&&A.sessionCache){if(J=A.sessionCache.getSession(),J!==null)H=J.id}if(A.session={id:H,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:p7.md.md5.create(),sha1:p7.md.sha1.create()},J)A.version=J.version,A.session.sp=J.sp;A.session.sp.client_random=O8.createRandom().getBytes(),A.open=!0,O8.queue(A,O8.createRecord(A,{type:O8.ContentType.handshake,data:O8.createClientHello(A)})),O8.flush(A)}},A.process=function(H){var J=0;if(H)A.input.putBytes(H);if(!A.fail){if(A.record!==null&&A.record.ready&&A.record.fragment.isEmpty())A.record=null;if(A.record===null)J=w(A);if(!A.fail&&A.record!==null&&!A.record.ready)J=j(A);if(!A.fail&&A.record!==null&&A.record.ready)O(A,A.record)}return J},A.prepare=function(H){return O8.queue(A,O8.createRecord(A,{type:O8.ContentType.application_data,data:p7.util.createBuffer(H)})),O8.flush(A)},A.prepareHeartbeatRequest=function(H,J){if(H instanceof p7.util.ByteBuffer)H=H.bytes();if(typeof J>"u")J=H.length;return A.expectedHeartbeatPayload=H,O8.queue(A,O8.createRecord(A,{type:O8.ContentType.heartbeat,data:O8.createHeartbeat(O8.HeartbeatMessageType.heartbeat_request,H,J)})),O8.flush(A)},A.close=function(H){if(!A.fail&&A.sessionCache&&A.session){var J={id:A.session.id,version:A.session.version,sp:A.session.sp};J.sp.keys=null,A.sessionCache.setSession(J.id,J)}if(A.open){if(A.open=!1,A.input.clear(),A.isConnected||A.handshaking)A.isConnected=A.handshaking=!1,O8.queue(A,O8.createAlert(A,{level:O8.Alert.Level.warning,description:O8.Alert.Description.close_notify})),O8.flush(A);A.closed(A)}A.reset(H)},A};kw4.exports=p7.tls=p7.tls||{};for(bi6 in O8)if(typeof O8[bi6]!=="function")p7.tls[bi6]=O8[bi6];var bi6;p7.tls.prf_tls1=dv8;p7.tls.hmac_sha1=QF_;p7.tls.createSessionCache=O8.createSessionCache;p7.tls.createConnection=O8.createConnection});var yw4=m((klA,Nw4)=>{var m76=E_();h76();gb1();var TC=Nw4.exports=m76.tls;TC.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(q){q.bulk_cipher_algorithm=TC.BulkCipherAlgorithm.aes,q.cipher_type=TC.CipherType.block,q.enc_key_length=16,q.block_length=16,q.fixed_iv_length=16,q.record_iv_length=16,q.mac_algorithm=TC.MACAlgorithm.hmac_sha1,q.mac_length=20,q.mac_key_length=20},initConnectionState:Vw4};TC.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(q){q.bulk_cipher_algorithm=TC.BulkCipherAlgorithm.aes,q.cipher_type=TC.CipherType.block,q.enc_key_length=32,q.block_length=16,q.fixed_iv_length=16,q.record_iv_length=16,q.mac_algorithm=TC.MACAlgorithm.hmac_sha1,q.mac_length=20,q.mac_key_length=20},initConnectionState:Vw4};function Vw4(q,K,_){var z=K.entity===m76.tls.ConnectionEnd.client;q.read.cipherState={init:!1,cipher:m76.cipher.createDecipher("AES-CBC",z?_.keys.server_write_key:_.keys.client_write_key),iv:z?_.keys.server_write_IV:_.keys.client_write_IV},q.write.cipherState={init:!1,cipher:m76.cipher.createCipher("AES-CBC",z?_.keys.client_write_key:_.keys.server_write_key),iv:z?_.keys.client_write_IV:_.keys.server_write_IV},q.read.cipherFunction=JU_,q.write.cipherFunction=wU_,q.read.macLength=q.write.macLength=_.mac_length,q.read.macFunction=q.write.macFunction=TC.hmac_sha1}function wU_(q,K){var _=!1,z=K.macFunction(K.macKey,K.sequenceNumber,q);q.fragment.putBytes(z),K.updateSequenceNumber();var Y;if(q.version.minor===TC.Versions.TLS_1_0.minor)Y=K.cipherState.init?null:K.cipherState.iv;else Y=m76.random.getBytesSync(16);K.cipherState.init=!0;var $=K.cipherState.cipher;if($.start({iv:Y}),q.version.minor>=TC.Versions.TLS_1_1.minor)$.output.putBytes(Y);if($.update(q.fragment),$.finish(jU_))q.fragment=$.output,q.length=q.fragment.length(),_=!0;return _}function jU_(q,K,_){if(!_){var z=q-K.length()%q;K.fillWithByte(z-1,z)}return!0}function HU_(q,K,_){var z=!0;if(_){var Y=K.length(),$=K.last();for(var A=Y-1-$;A<Y-1;++A)z=z&&K.at(A)==$;if(z)K.truncate($+1)}return z}function JU_(q,K){var _=!1,z;if(q.version.minor===TC.Versions.TLS_1_0.minor)z=K.cipherState.init?null:K.cipherState.iv;else z=q.fragment.getBytes(16);K.cipherState.init=!0;var Y=K.cipherState.cipher;Y.start({iv:z}),Y.update(q.fragment),_=Y.finish(HU_);var $=K.macLength,A=m76.random.getBytesSync($),O=Y.output.length();if(O>=$)q.fragment=Y.output.getBytes(O-$),A=Y.output.getBytes($);else q.fragment=Y.output.getBytes();q.fragment=m76.util.createBuffer(q.fragment),q.length=q.fragment.length();var w=K.macFunction(K.macKey,K.sequenceNumber,q);return K.updateSequenceNumber(),_=MU_(K.macKey,A,w)&&_,_}function MU_(q,K,_){var z=m76.hmac.create();return z.start("SHA1",q),z.update(K),K=z.digest().getBytes(),z.start(null,null),z.update(_),_=z.digest().getBytes(),K===_}});var Qb1=m((VlA,hw4)=>{var x2=E_();IF();_$();var xi6=hw4.exports=x2.sha512=x2.sha512||{};x2.md.sha512=x2.md.algorithms.sha512=xi6;var Lw4=x2.sha384=x2.sha512.sha384=x2.sha512.sha384||{};Lw4.create=function(){return xi6.create("SHA-384")};x2.md.sha384=x2.md.algorithms.sha384=Lw4;x2.sha512.sha256=x2.sha512.sha256||{create:function(){return xi6.create("SHA-512/256")}};x2.md["sha512/256"]=x2.md.algorithms["sha512/256"]=x2.sha512.sha256;x2.sha512.sha224=x2.sha512.sha224||{create:function(){return xi6.create("SHA-512/224")}};x2.md["sha512/224"]=x2.md.algorithms["sha512/224"]=x2.sha512.sha224;xi6.create=function(q){if(!Rw4)XU_();if(typeof q>"u")q="SHA-512";if(!(q in fO6))throw Error("Invalid SHA-512 algorithm: "+q);var K=fO6[q],_=null,z=x2.util.createBuffer(),Y=Array(80);for(var $=0;$<80;++$)Y[$]=[,,];var A=64;switch(q){case"SHA-384":A=48;break;case"SHA-512/256":A=32;break;case"SHA-512/224":A=28;break}var O={algorithm:q.replace("-","").toLowerCase(),blockLength:128,digestLength:A,messageLength:0,fullMessageLength:null,messageLengthSize:16};return O.start=function(){O.messageLength=0,O.fullMessageLength=O.messageLength128=[];var w=O.messageLengthSize/4;for(var j=0;j<w;++j)O.fullMessageLength.push(0);z=x2.util.createBuffer(),_=Array(K.length);for(var j=0;j<K.length;++j)_[j]=K[j].slice(0);return O},O.start(),O.update=function(w,j){if(j==="utf8")w=x2.util.encodeUtf8(w);var H=w.length;O.messageLength+=H,H=[H/4294967296>>>0,H>>>0];for(var J=O.fullMessageLength.length-1;J>=0;--J)O.fullMessageLength[J]+=H[1],H[1]=H[0]+(O.fullMessageLength[J]/4294967296>>>0),O.fullMessageLength[J]=O.fullMessageLength[J]>>>0,H[0]=H[1]/4294967296>>>0;if(z.putBytes(w),Ew4(_,Y,z),z.read>2048||z.length()===0)z.compact();return O},O.digest=function(){var w=x2.util.createBuffer();w.putBytes(z.bytes());var j=O.fullMessageLength[O.fullMessageLength.length-1]+O.messageLengthSize,H=j&O.blockLength-1;w.putBytes(Fb1.substr(0,O.blockLength-H));var J,M,X=O.fullMessageLength[0]*8;for(var P=0;P<O.fullMessageLength.length-1;++P)J=O.fullMessageLength[P+1]*8,M=J/4294967296>>>0,X+=M,w.putInt32(X>>>0),X=J>>>0;w.putInt32(X);var W=Array(_.length);for(var P=0;P<_.length;++P)W[P]=_[P].slice(0);Ew4(W,Y,w);var D=x2.util.createBuffer(),f;if(q==="SHA-512")f=W.length;else if(q==="SHA-384")f=W.length-2;else f=W.length-4;for(var P=0;P<f;++P)if(D.putInt32(W[P][0]),P!==f-1||q!=="SHA-512/224")D.putInt32(W[P][1]);return D},O};var Fb1=null,Rw4=!1,Ub1=null,fO6=null;function XU_(){Fb1=String.fromCharCode(128),Fb1+=x2.util.fillString(String.fromCharCode(0),128),Ub1=[[1116352408,3609767458],[1899447441,602891725],[3049323471,3964484399],[3921009573,2173295548],[961987163,4081628472],[1508970993,3053834265],[2453635748,2937671579],[2870763221,3664609560],[3624381080,2734883394],[310598401,1164996542],[607225278,1323610764],[1426881987,3590304994],[1925078388,4068182383],[2162078206,991336113],[2614888103,633803317],[3248222580,3479774868],[3835390401,2666613458],[4022224774,944711139],[264347078,2341262773],[604807628,2007800933],[770255983,1495990901],[1249150122,1856431235],[1555081692,3175218132],[1996064986,2198950837],[2554220882,3999719339],[2821834349,766784016],[2952996808,2566594879],[3210313671,3203337956],[3336571891,1034457026],[3584528711,2466948901],[113926993,3758326383],[338241895,168717936],[666307205,1188179964],[773529912,1546045734],[1294757372,1522805485],[1396182291,2643833823],[1695183700,2343527390],[1986661051,1014477480],[2177026350,1206759142],[2456956037,344077627],[2730485921,1290863460],[2820302411,3158454273],[3259730800,3505952657],[3345764771,106217008],[3516065817,3606008344],[3600352804,1432725776],[4094571909,1467031594],[275423344,851169720],[430227734,3100823752],[506948616,1363258195],[659060556,3750685593],[883997877,3785050280],[958139571,3318307427],[1322822218,3812723403],[1537002063,2003034995],[1747873779,3602036899],[1955562222,1575990012],[2024104815,1125592928],[2227730452,2716904306],[2361852424,442776044],[2428436474,593698344],[2756734187,3733110249],[3204031479,2999351573],[3329325298,3815920427],[3391569614,3928383900],[3515267271,566280711],[3940187606,3454069534],[4118630271,4000239992],[116418474,1914138554],[174292421,2731055270],[289380356,3203993006],[460393269,320620315],[685471733,587496836],[852142971,1086792851],[1017036298,365543100],[1126000580,2618297676],[1288033470,3409855158],[1501505948,4234509866],[1607167915,987167468],[1816402316,1246189591]],fO6={},fO6["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],fO6["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],fO6["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],fO6["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],Rw4=!0}function Ew4(q,K,_){var z,Y,$,A,O,w,j,H,J,M,X,P,W,D,f,G,Z,T,v,V,E,S,R,x,I,B,p,C,g,F,U,c,K6,t,q6,e=_.length();while(e>=128){for(g=0;g<16;++g)K[g][0]=_.getInt32()>>>0,K[g][1]=_.getInt32()>>>0;for(;g<80;++g)c=K[g-2],F=c[0],U=c[1],z=((F>>>19|U<<13)^(U>>>29|F<<3)^F>>>6)>>>0,Y=((F<<13|U>>>19)^(U<<3|F>>>29)^(F<<26|U>>>6))>>>0,t=K[g-15],F=t[0],U=t[1],$=((F>>>1|U<<31)^(F>>>8|U<<24)^F>>>7)>>>0,A=((F<<31|U>>>1)^(F<<24|U>>>8)^(F<<25|U>>>7))>>>0,K6=K[g-7],q6=K[g-16],U=Y+K6[1]+A+q6[1],K[g][0]=z+K6[0]+$+q6[0]+(U/4294967296>>>0)>>>0,K[g][1]=U>>>0;W=q[0][0],D=q[0][1],f=q[1][0],G=q[1][1],Z=q[2][0],T=q[2][1],v=q[3][0],V=q[3][1],E=q[4][0],S=q[4][1],R=q[5][0],x=q[5][1],I=q[6][0],B=q[6][1],p=q[7][0],C=q[7][1];for(g=0;g<80;++g)j=((E>>>14|S<<18)^(E>>>18|S<<14)^(S>>>9|E<<23))>>>0,H=((E<<18|S>>>14)^(E<<14|S>>>18)^(S<<23|E>>>9))>>>0,J=(I^E&(R^I))>>>0,M=(B^S&(x^B))>>>0,O=((W>>>28|D<<4)^(D>>>2|W<<30)^(D>>>7|W<<25))>>>0,w=((W<<4|D>>>28)^(D<<30|W>>>2)^(D<<25|W>>>7))>>>0,X=(W&f|Z&(W^f))>>>0,P=(D&G|T&(D^G))>>>0,U=C+H+M+Ub1[g][1]+K[g][1],z=p+j+J+Ub1[g][0]+K[g][0]+(U/4294967296>>>0)>>>0,Y=U>>>0,U=w+P,$=O+X+(U/4294967296>>>0)>>>0,A=U>>>0,p=I,C=B,I=R,B=x,R=E,x=S,U=V+Y,E=v+z+(U/4294967296>>>0)>>>0,S=U>>>0,v=Z,V=T,Z=f,T=G,f=W,G=D,U=Y+A,W=z+$+(U/4294967296>>>0)>>>0,D=U>>>0;U=q[0][1]+D,q[0][0]=q[0][0]+W+(U/4294967296>>>0)>>>0,q[0][1]=U>>>0,U=q[1][1]+G,q[1][0]=q[1][0]+f+(U/4294967296>>>0)>>>0,q[1][1]=U>>>0,U=q[2][1]+T,q[2][0]=q[2][0]+Z+(U/4294967296>>>0)>>>0,q[2][1]=U>>>0,U=q[3][1]+V,q[3][0]=q[3][0]+v+(U/4294967296>>>0)>>>0,q[3][1]=U>>>0,U=q[4][1]+S,q[4][0]=q[4][0]+E+(U/4294967296>>>0)>>>0,q[4][1]=U>>>0,U=q[5][1]+x,q[5][0]=q[5][0]+R+(U/4294967296>>>0)>>>0,q[5][1]=U>>>0,U=q[6][1]+B,q[6][0]=q[6][0]+I+(U/4294967296>>>0)>>>0,q[6][1]=U>>>0,U=q[7][1]+C,q[7][0]=q[7][0]+p+(U/4294967296>>>0)>>>0,q[7][1]=U>>>0,e-=128}}});var Sw4=m((WU_)=>{var PU_=E_();Iu();var OD=PU_.asn1;WU_.privateKeyValidator={name:"PrivateKeyInfo",tagClass:OD.Class.UNIVERSAL,type:OD.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:OD.Class.UNIVERSAL,type:OD.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:OD.Class.UNIVERSAL,type:OD.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:OD.Class.UNIVERSAL,type:OD.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:OD.Class.UNIVERSAL,type:OD.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]};WU_.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:OD.Class.UNIVERSAL,type:OD.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:OD.Class.UNIVERSAL,type:OD.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:OD.Class.UNIVERSAL,type:OD.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{tagClass:OD.Class.UNIVERSAL,type:OD.Type.BITSTRING,constructed:!1,composed:!0,captureBitStringValue:"ed25519PublicKey"}]}});var Qw4=m((ylA,Uw4)=>{var Y0=E_();Ri6();WC();Qb1();_$();var uw4=Sw4(),ZU_=uw4.publicKeyValidator,GU_=uw4.privateKeyValidator;if(typeof lb1>"u")lb1=Y0.jsbn.BigInteger;var lb1,nb1=Y0.util.ByteBuffer,zN=typeof Buffer>"u"?Uint8Array:Buffer;Y0.pki=Y0.pki||{};Uw4.exports=Y0.pki.ed25519=Y0.ed25519=Y0.ed25519||{};var yz=Y0.ed25519;yz.constants={};yz.constants.PUBLIC_KEY_BYTE_LENGTH=32;yz.constants.PRIVATE_KEY_BYTE_LENGTH=64;yz.constants.SEED_BYTE_LENGTH=32;yz.constants.SIGN_BYTE_LENGTH=64;yz.constants.HASH_BYTE_LENGTH=64;yz.generateKeyPair=function(q){q=q||{};var K=q.seed;if(K===void 0)K=Y0.random.getBytesSync(yz.constants.SEED_BYTE_LENGTH);else if(typeof K==="string"){if(K.length!==yz.constants.SEED_BYTE_LENGTH)throw TypeError('"seed" must be '+yz.constants.SEED_BYTE_LENGTH+" bytes in length.")}else if(!(K instanceof Uint8Array))throw TypeError('"seed" must be a node.js Buffer, Uint8Array, or a binary string.');K=Or({message:K,encoding:"binary"});var _=new zN(yz.constants.PUBLIC_KEY_BYTE_LENGTH),z=new zN(yz.constants.PRIVATE_KEY_BYTE_LENGTH);for(var Y=0;Y<32;++Y)z[Y]=K[Y];return VU_(_,z),{publicKey:_,privateKey:z}};yz.privateKeyFromAsn1=function(q){var K={},_=[],z=Y0.asn1.validate(q,GU_,K,_);if(!z){var Y=Error("Invalid Key.");throw Y.errors=_,Y}var $=Y0.asn1.derToOid(K.privateKeyOid),A=Y0.oids.EdDSA25519;if($!==A)throw Error('Invalid OID "'+$+'"; OID must be "'+A+'".');var O=K.privateKey,w=Or({message:Y0.asn1.fromDer(O).value,encoding:"binary"});return{privateKeyBytes:w}};yz.publicKeyFromAsn1=function(q){var K={},_=[],z=Y0.asn1.validate(q,ZU_,K,_);if(!z){var Y=Error("Invalid Key.");throw Y.errors=_,Y}var $=Y0.asn1.derToOid(K.publicKeyOid),A=Y0.oids.EdDSA25519;if($!==A)throw Error('Invalid OID "'+$+'"; OID must be "'+A+'".');var O=K.ed25519PublicKey;if(O.length!==yz.constants.PUBLIC_KEY_BYTE_LENGTH)throw Error("Key length is invalid.");return Or({message:O,encoding:"binary"})};yz.publicKeyFromPrivateKey=function(q){q=q||{};var K=Or({message:q.privateKey,encoding:"binary"});if(K.length!==yz.constants.PRIVATE_KEY_BYTE_LENGTH)throw TypeError('"options.privateKey" must have a byte length of '+yz.constants.PRIVATE_KEY_BYTE_LENGTH);var _=new zN(yz.constants.PUBLIC_KEY_BYTE_LENGTH);for(var z=0;z<_.length;++z)_[z]=K[32+z];return _};yz.sign=function(q){q=q||{};var K=Or(q),_=Or({message:q.privateKey,encoding:"binary"});if(_.length===yz.constants.SEED_BYTE_LENGTH){var z=yz.generateKeyPair({seed:_});_=z.privateKey}else if(_.length!==yz.constants.PRIVATE_KEY_BYTE_LENGTH)throw TypeError('"options.privateKey" must have a byte length of '+yz.constants.SEED_BYTE_LENGTH+" or "+yz.constants.PRIVATE_KEY_BYTE_LENGTH);var Y=new zN(yz.constants.SIGN_BYTE_LENGTH+K.length);NU_(Y,K,K.length,_);var $=new zN(yz.constants.SIGN_BYTE_LENGTH);for(var A=0;A<$.length;++A)$[A]=Y[A];return $};yz.verify=function(q){q=q||{};var K=Or(q);if(q.signature===void 0)throw TypeError('"options.signature" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a binary string.');var _=Or({message:q.signature,encoding:"binary"});if(_.length!==yz.constants.SIGN_BYTE_LENGTH)throw TypeError('"options.signature" must have a byte length of '+yz.constants.SIGN_BYTE_LENGTH);var z=Or({message:q.publicKey,encoding:"binary"});if(z.length!==yz.constants.PUBLIC_KEY_BYTE_LENGTH)throw TypeError('"options.publicKey" must have a byte length of '+yz.constants.PUBLIC_KEY_BYTE_LENGTH);var Y=new zN(yz.constants.SIGN_BYTE_LENGTH+K.length),$=new zN(yz.constants.SIGN_BYTE_LENGTH+K.length),A;for(A=0;A<yz.constants.SIGN_BYTE_LENGTH;++A)Y[A]=_[A];for(A=0;A<K.length;++A)Y[A+yz.constants.SIGN_BYTE_LENGTH]=K[A];return yU_($,Y,Y.length,z)>=0};function Or(q){var K=q.message;if(K instanceof Uint8Array||K instanceof zN)return K;var _=q.encoding;if(K===void 0)if(q.md)K=q.md.digest().getBytes(),_="binary";else throw TypeError('"options.message" or "options.md" not specified.');if(typeof K==="string"&&!_)throw TypeError('"options.encoding" must be "binary" or "utf8".');if(typeof K==="string"){if(typeof Buffer<"u")return Buffer.from(K,_);K=new nb1(K,_)}else if(!(K instanceof nb1))throw TypeError('"options.message" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a string with "options.encoding" specifying its encoding.');var z=new zN(K.length());for(var Y=0;Y<z.length;++Y)z[Y]=K.at(Y);return z}var ib1=$3(),cv8=$3([1]),TU_=$3([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),vU_=$3([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),Cw4=$3([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),bw4=$3([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),db1=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]),kU_=$3([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function Ii6(q,K){var _=Y0.md.sha512.create(),z=new nb1(q);_.update(z.getBytes(K),"binary");var Y=_.digest().getBytes();if(typeof Buffer<"u")return Buffer.from(Y,"binary");var $=new zN(yz.constants.HASH_BYTE_LENGTH);for(var A=0;A<64;++A)$[A]=Y.charCodeAt(A);return $}function VU_(q,K){var _=[$3(),$3(),$3(),$3()],z,Y=Ii6(K,32);Y[0]&=248,Y[31]&=127,Y[31]|=64,sb1(_,Y),ab1(q,_);for(z=0;z<32;++z)K[z+32]=q[z];return 0}function NU_(q,K,_,z){var Y,$,A=new Float64Array(64),O=[$3(),$3(),$3(),$3()],w=Ii6(z,32);w[0]&=248,w[31]&=127,w[31]|=64;var j=_+64;for(Y=0;Y<_;++Y)q[64+Y]=K[Y];for(Y=0;Y<32;++Y)q[32+Y]=w[32+Y];var H=Ii6(q.subarray(32),_+32);rb1(H),sb1(O,H),ab1(q,O);for(Y=32;Y<64;++Y)q[Y]=z[Y];var J=Ii6(q,_+64);rb1(J);for(Y=32;Y<64;++Y)A[Y]=0;for(Y=0;Y<32;++Y)A[Y]=H[Y];for(Y=0;Y<32;++Y)for($=0;$<32;$++)A[Y+$]+=J[Y]*w[$];return mw4(q.subarray(32),A),j}function yU_(q,K,_,z){var Y,$,A=new zN(32),O=[$3(),$3(),$3(),$3()],w=[$3(),$3(),$3(),$3()];if($=-1,_<64)return-1;if(EU_(w,z))return-1;for(Y=0;Y<_;++Y)q[Y]=K[Y];for(Y=0;Y<32;++Y)q[Y+32]=z[Y];var j=Ii6(q,_);if(rb1(j),gw4(O,w,j),sb1(w,K.subarray(32)),ob1(O,w),ab1(A,O),_-=64,pw4(K,0,A,0)){for(Y=0;Y<_;++Y)q[Y]=0;return-1}for(Y=0;Y<_;++Y)q[Y]=K[Y+64];return $=_,$}function mw4(q,K){var _,z,Y,$;for(z=63;z>=32;--z){_=0;for(Y=z-32,$=z-12;Y<$;++Y)K[Y]+=_-16*K[z]*db1[Y-(z-32)],_=K[Y]+128>>8,K[Y]-=_*256;K[Y]+=_,K[z]=0}_=0;for(Y=0;Y<32;++Y)K[Y]+=_-(K[31]>>4)*db1[Y],_=K[Y]>>8,K[Y]&=255;for(Y=0;Y<32;++Y)K[Y]-=_*db1[Y];for(z=0;z<32;++z)K[z+1]+=K[z]>>8,q[z]=K[z]&255}function rb1(q){var K=new Float64Array(64);for(var _=0;_<64;++_)K[_]=q[_],q[_]=0;mw4(q,K)}function ob1(q,K){var _=$3(),z=$3(),Y=$3(),$=$3(),A=$3(),O=$3(),w=$3(),j=$3(),H=$3();Pk6(_,q[1],q[0]),Pk6(H,K[1],K[0]),Pw(_,_,H),Xk6(z,q[0],q[1]),Xk6(H,K[0],K[1]),Pw(z,z,H),Pw(Y,q[3],K[3]),Pw(Y,Y,vU_),Pw($,q[2],K[2]),Xk6($,$,$),Pk6(A,z,_),Pk6(O,$,Y),Xk6(w,$,Y),Xk6(j,z,_),Pw(q[0],A,O),Pw(q[1],j,w),Pw(q[2],w,O),Pw(q[3],A,j)}function xw4(q,K,_){for(var z=0;z<4;++z)Fw4(q[z],K[z],_)}function ab1(q,K){var _=$3(),z=$3(),Y=$3();SU_(Y,K[2]),Pw(_,K[0],Y),Pw(z,K[1],Y),lv8(q,z),q[31]^=Bw4(_)<<7}function lv8(q,K){var _,z,Y,$=$3(),A=$3();for(_=0;_<16;++_)A[_]=K[_];cb1(A),cb1(A),cb1(A);for(z=0;z<2;++z){$[0]=A[0]-65517;for(_=1;_<15;++_)$[_]=A[_]-65535-($[_-1]>>16&1),$[_-1]&=65535;$[15]=A[15]-32767-($[14]>>16&1),Y=$[15]>>16&1,$[14]&=65535,Fw4(A,$,1-Y)}for(_=0;_<16;_++)q[2*_]=A[_]&255,q[2*_+1]=A[_]>>8}function EU_(q,K){var _=$3(),z=$3(),Y=$3(),$=$3(),A=$3(),O=$3(),w=$3();if(p76(q[2],cv8),LU_(q[1],K),ZO6(Y,q[1]),Pw($,Y,TU_),Pk6(Y,Y,q[2]),Xk6($,q[2],$),ZO6(A,$),ZO6(O,A),Pw(w,O,A),Pw(_,w,Y),Pw(_,_,$),RU_(_,_),Pw(_,_,Y),Pw(_,_,$),Pw(_,_,$),Pw(q[0],_,$),ZO6(z,q[0]),Pw(z,z,$),Iw4(z,Y))Pw(q[0],q[0],kU_);if(ZO6(z,q[0]),Pw(z,z,$),Iw4(z,Y))return-1;if(Bw4(q[0])===K[31]>>7)Pk6(q[0],ib1,q[0]);return Pw(q[3],q[0],q[1]),0}function LU_(q,K){var _;for(_=0;_<16;++_)q[_]=K[2*_]+(K[2*_+1]<<8);q[15]&=32767}function RU_(q,K){var _=$3(),z;for(z=0;z<16;++z)_[z]=K[z];for(z=250;z>=0;--z)if(ZO6(_,_),z!==1)Pw(_,_,K);for(z=0;z<16;++z)q[z]=_[z]}function Iw4(q,K){var _=new zN(32),z=new zN(32);return lv8(_,q),lv8(z,K),pw4(_,0,z,0)}function pw4(q,K,_,z){return hU_(q,K,_,z,32)}function hU_(q,K,_,z,Y){var $,A=0;for($=0;$<Y;++$)A|=q[K+$]^_[z+$];return(1&A-1>>>8)-1}function Bw4(q){var K=new zN(32);return lv8(K,q),K[0]&1}function gw4(q,K,_){var z,Y;p76(q[0],ib1),p76(q[1],cv8),p76(q[2],cv8),p76(q[3],ib1);for(Y=255;Y>=0;--Y)z=_[Y/8|0]>>(Y&7)&1,xw4(q,K,z),ob1(K,q),ob1(q,q),xw4(q,K,z)}function sb1(q,K){var _=[$3(),$3(),$3(),$3()];p76(_[0],Cw4),p76(_[1],bw4),p76(_[2],cv8),Pw(_[3],Cw4,bw4),gw4(q,_,K)}function p76(q,K){var _;for(_=0;_<16;_++)q[_]=K[_]|0}function SU_(q,K){var _=$3(),z;for(z=0;z<16;++z)_[z]=K[z];for(z=253;z>=0;--z)if(ZO6(_,_),z!==2&&z!==4)Pw(_,_,K);for(z=0;z<16;++z)q[z]=_[z]}function cb1(q){var K,_,z=1;for(K=0;K<16;++K)_=q[K]+z+65535,z=Math.floor(_/65536),q[K]=_-z*65536;q[0]+=z-1+37*(z-1)}function Fw4(q,K,_){var z,Y=~(_-1);for(var $=0;$<16;++$)z=Y&(q[$]^K[$]),q[$]^=z,K[$]^=z}function $3(q){var K,_=new Float64Array(16);if(q)for(K=0;K<q.length;++K)_[K]=q[K];return _}function Xk6(q,K,_){for(var z=0;z<16;++z)q[z]=K[z]+_[z]}function Pk6(q,K,_){for(var z=0;z<16;++z)q[z]=K[z]-_[z]}function ZO6(q,K){Pw(q,K,K)}function Pw(q,K,_){var z,Y,$=0,A=0,O=0,w=0,j=0,H=0,J=0,M=0,X=0,P=0,W=0,D=0,f=0,G=0,Z=0,T=0,v=0,V=0,E=0,S=0,R=0,x=0,I=0,B=0,p=0,C=0,g=0,F=0,U=0,c=0,K6=0,t=_[0],q6=_[1],e=_[2],i=_[3],$6=_[4],M6=_[5],j6=_[6],G6=_[7],w6=_[8],o=_[9],s=_[10],a=_[11],n=_[12],l=_[13],A6=_[14],J6=_[15];z=K[0],$+=z*t,A+=z*q6,O+=z*e,w+=z*i,j+=z*$6,H+=z*M6,J+=z*j6,M+=z*G6,X+=z*w6,P+=z*o,W+=z*s,D+=z*a,f+=z*n,G+=z*l,Z+=z*A6,T+=z*J6,z=K[1],A+=z*t,O+=z*q6,w+=z*e,j+=z*i,H+=z*$6,J+=z*M6,M+=z*j6,X+=z*G6,P+=z*w6,W+=z*o,D+=z*s,f+=z*a,G+=z*n,Z+=z*l,T+=z*A6,v+=z*J6,z=K[2],O+=z*t,w+=z*q6,j+=z*e,H+=z*i,J+=z*$6,M+=z*M6,X+=z*j6,P+=z*G6,W+=z*w6,D+=z*o,f+=z*s,G+=z*a,Z+=z*n,T+=z*l,v+=z*A6,V+=z*J6,z=K[3],w+=z*t,j+=z*q6,H+=z*e,J+=z*i,M+=z*$6,X+=z*M6,P+=z*j6,W+=z*G6,D+=z*w6,f+=z*o,G+=z*s,Z+=z*a,T+=z*n,v+=z*l,V+=z*A6,E+=z*J6,z=K[4],j+=z*t,H+=z*q6,J+=z*e,M+=z*i,X+=z*$6,P+=z*M6,W+=z*j6,D+=z*G6,f+=z*w6,G+=z*o,Z+=z*s,T+=z*a,v+=z*n,V+=z*l,E+=z*A6,S+=z*J6,z=K[5],H+=z*t,J+=z*q6,M+=z*e,X+=z*i,P+=z*$6,W+=z*M6,D+=z*j6,f+=z*G6,G+=z*w6,Z+=z*o,T+=z*s,v+=z*a,V+=z*n,E+=z*l,S+=z*A6,R+=z*J6,z=K[6],J+=z*t,M+=z*q6,X+=z*e,P+=z*i,W+=z*$6,D+=z*M6,f+=z*j6,G+=z*G6,Z+=z*w6,T+=z*o,v+=z*s,V+=z*a,E+=z*n,S+=z*l,R+=z*A6,x+=z*J6,z=K[7],M+=z*t,X+=z*q6,P+=z*e,W+=z*i,D+=z*$6,f+=z*M6,G+=z*j6,Z+=z*G6,T+=z*w6,v+=z*o,V+=z*s,E+=z*a,S+=z*n,R+=z*l,x+=z*A6,I+=z*J6,z=K[8],X+=z*t,P+=z*q6,W+=z*e,D+=z*i,f+=z*$6,G+=z*M6,Z+=z*j6,T+=z*G6,v+=z*w6,V+=z*o,E+=z*s,S+=z*a,R+=z*n,x+=z*l,I+=z*A6,B+=z*J6,z=K[9],P+=z*t,W+=z*q6,D+=z*e,f+=z*i,G+=z*$6,Z+=z*M6,T+=z*j6,v+=z*G6,V+=z*w6,E+=z*o,S+=z*s,R+=z*a,x+=z*n,I+=z*l,B+=z*A6,p+=z*J6,z=K[10],W+=z*t,D+=z*q6,f+=z*e,G+=z*i,Z+=z*$6,T+=z*M6,v+=z*j6,V+=z*G6,E+=z*w6,S+=z*o,R+=z*s,x+=z*a,I+=z*n,B+=z*l,p+=z*A6,C+=z*J6,z=K[11],D+=z*t,f+=z*q6,G+=z*e,Z+=z*i,T+=z*$6,v+=z*M6,V+=z*j6,E+=z*G6,S+=z*w6,R+=z*o,x+=z*s,I+=z*a,B+=z*n,p+=z*l,C+=z*A6,g+=z*J6,z=K[12],f+=z*t,G+=z*q6,Z+=z*e,T+=z*i,v+=z*$6,V+=z*M6,E+=z*j6,S+=z*G6,R+=z*w6,x+=z*o,I+=z*s,B+=z*a,p+=z*n,C+=z*l,g+=z*A6,F+=z*J6,z=K[13],G+=z*t,Z+=z*q6,T+=z*e,v+=z*i,V+=z*$6,E+=z*M6,S+=z*j6,R+=z*G6,x+=z*w6,I+=z*o,B+=z*s,p+=z*a,C+=z*n,g+=z*l,F+=z*A6,U+=z*J6,z=K[14],Z+=z*t,T+=z*q6,v+=z*e,V+=z*i,E+=z*$6,S+=z*M6,R+=z*j6,x+=z*G6,I+=z*w6,B+=z*o,p+=z*s,C+=z*a,g+=z*n,F+=z*l,U+=z*A6,c+=z*J6,z=K[15],T+=z*t,v+=z*q6,V+=z*e,E+=z*i,S+=z*$6,R+=z*M6,x+=z*j6,I+=z*G6,B+=z*w6,p+=z*o,C+=z*s,g+=z*a,F+=z*n,U+=z*l,c+=z*A6,K6+=z*J6,$+=38*v,A+=38*V,O+=38*E,w+=38*S,j+=38*R,H+=38*x,J+=38*I,M+=38*B,X+=38*p,P+=38*C,W+=38*g,D+=38*F,f+=38*U,G+=38*c,Z+=38*K6,Y=1,z=$+Y+65535,Y=Math.floor(z/65536),$=z-Y*65536,z=A+Y+65535,Y=Math.floor(z/65536),A=z-Y*65536,z=O+Y+65535,Y=Math.floor(z/65536),O=z-Y*65536,z=w+Y+65535,Y=Math.floor(z/65536),w=z-Y*65536,z=j+Y+65535,Y=Math.floor(z/65536),j=z-Y*65536,z=H+Y+65535,Y=Math.floor(z/65536),H=z-Y*65536,z=J+Y+65535,Y=Math.floor(z/65536),J=z-Y*65536,z=M+Y+65535,Y=Math.floor(z/65536),M=z-Y*65536,z=X+Y+65535,Y=Math.floor(z/65536),X=z-Y*65536,z=P+Y+65535,Y=Math.floor(z/65536),P=z-Y*65536,z=W+Y+65535,Y=Math.floor(z/65536),W=z-Y*65536,z=D+Y+65535,Y=Math.floor(z/65536),D=z-Y*65536,z=f+Y+65535,Y=Math.floor(z/65536),f=z-Y*65536,z=G+Y+65535,Y=Math.floor(z/65536),G=z-Y*65536,z=Z+Y+65535,Y=Math.floor(z/65536),Z=z-Y*65536,z=T+Y+65535,Y=Math.floor(z/65536),T=z-Y*65536,$+=Y-1+37*(Y-1),Y=1,z=$+Y+65535,Y=Math.floor(z/65536),$=z-Y*65536,z=A+Y+65535,Y=Math.floor(z/65536),A=z-Y*65536,z=O+Y+65535,Y=Math.floor(z/65536),O=z-Y*65536,z=w+Y+65535,Y=Math.floor(z/65536),w=z-Y*65536,z=j+Y+65535,Y=Math.floor(z/65536),j=z-Y*65536,z=H+Y+65535,Y=Math.floor(z/65536),H=z-Y*65536,z=J+Y+65535,Y=Math.floor(z/65536),J=z-Y*65536,z=M+Y+65535,Y=Math.floor(z/65536),M=z-Y*65536,z=X+Y+65535,Y=Math.floor(z/65536),X=z-Y*65536,z=P+Y+65535,Y=Math.floor(z/65536),P=z-Y*65536,z=W+Y+65535,Y=Math.floor(z/65536),W=z-Y*65536,z=D+Y+65535,Y=Math.floor(z/65536),D=z-Y*65536,z=f+Y+65535,Y=Math.floor(z/65536),f=z-Y*65536,z=G+Y+65535,Y=Math.floor(z/65536),G=z-Y*65536,z=Z+Y+65535,Y=Math.floor(z/65536),Z=z-Y*65536,z=T+Y+65535,Y=Math.floor(z/65536),T=z-Y*65536,$+=Y-1+37*(Y-1),q[0]=$,q[1]=A,q[2]=O,q[3]=w,q[4]=j,q[5]=H,q[6]=J,q[7]=M,q[8]=X,q[9]=P,q[10]=W,q[11]=D,q[12]=f,q[13]=G,q[14]=Z,q[15]=T}});var nw4=m((ElA,lw4)=>{var GL=E_();_$();WC();Ri6();lw4.exports=GL.kem=GL.kem||{};var dw4=GL.jsbn.BigInteger;GL.kem.rsa={};GL.kem.rsa.create=function(q,K){K=K||{};var _=K.prng||GL.random,z={};return z.encrypt=function(Y,$){var A=Math.ceil(Y.n.bitLength()/8),O;do O=new dw4(GL.util.bytesToHex(_.getBytesSync(A)),16).mod(Y.n);while(O.compareTo(dw4.ONE)<=0);O=GL.util.hexToBytes(O.toString(16));var w=A-O.length;if(w>0)O=GL.util.fillString(String.fromCharCode(0),w)+O;var j=Y.encrypt(O,"NONE"),H=q.generate(O,$);return{encapsulation:j,key:H}},z.decrypt=function(Y,$,A){var O=Y.decrypt($,"NONE");return q.generate(O,A)},z};GL.kem.kdf1=function(q,K){cw4(this,q,0,K||q.digestLength)};GL.kem.kdf2=function(q,K){cw4(this,q,1,K||q.digestLength)};function cw4(q,K,_,z){q.generate=function(Y,$){var A=new GL.util.ByteBuffer,O=Math.ceil($/z)+_,w=new GL.util.ByteBuffer;for(var j=_;j<O;++j){w.putInt32(j),K.start(),K.update(Y+w.getBytes());var H=K.digest();A.putBytes(H.getBytes(z))}return A.truncate(A.length()-$),A.getBytes()}}});var rw4=m((LlA,iw4)=>{var rz=E_();_$();iw4.exports=rz.log=rz.log||{};rz.log.levels=["none","error","warning","info","debug","verbose","max"];var rv8={},tb1=[],ui6=null;rz.log.LEVEL_LOCKED=2;rz.log.NO_LEVEL_CHECK=4;rz.log.INTERPOLATE=8;for(vC=0;vC<rz.log.levels.length;++vC)nv8=rz.log.levels[vC],rv8[nv8]={index:vC,name:nv8.toUpperCase()};var nv8,vC;rz.log.logMessage=function(q){var K=rv8[q.level].index;for(var _=0;_<tb1.length;++_){var z=tb1[_];if(z.flags&rz.log.NO_LEVEL_CHECK)z.f(q);else{var Y=rv8[z.level].index;if(K<=Y)z.f(z,q)}}};rz.log.prepareStandard=function(q){if(!("standard"in q))q.standard=rv8[q.level].name+" ["+q.category+"] "+q.message};rz.log.prepareFull=function(q){if(!("full"in q)){var K=[q.message];K=K.concat([]),q.full=rz.util.format.apply(this,K)}};rz.log.prepareStandardFull=function(q){if(!("standardFull"in q))rz.log.prepareStandard(q),q.standardFull=q.standard};iv8=["error","warning","info","debug","verbose"];for(vC=0;vC<iv8.length;++vC)(function(K){rz.log[K]=function(_,z){var Y=Array.prototype.slice.call(arguments).slice(2),$={timestamp:new Date,level:K,category:_,message:z,arguments:Y};rz.log.logMessage($)}})(iv8[vC]);var iv8,vC;rz.log.makeLogger=function(q){var K={flags:0,f:q};return rz.log.setLevel(K,"none"),K};rz.log.setLevel=function(q,K){var _=!1;if(q&&!(q.flags&rz.log.LEVEL_LOCKED))for(var z=0;z<rz.log.levels.length;++z){var Y=rz.log.levels[z];if(K==Y){q.level=K,_=!0;break}}return _};rz.log.lock=function(q,K){if(typeof K>"u"||K)q.flags|=rz.log.LEVEL_LOCKED;else q.flags&=~rz.log.LEVEL_LOCKED};rz.log.addLogger=function(q){tb1.push(q)};if(typeof console<"u"&&"log"in console){if(console.error&&console.warn&&console.info&&console.debug)eb1={error:console.error,warning:console.warn,info:console.info,debug:console.debug,verbose:console.debug},Dk6=function(q,K){rz.log.prepareStandard(K);var _=eb1[K.level],z=[K.standard];z=z.concat(K.arguments.slice()),_.apply(console,z)},GO6=rz.log.makeLogger(Dk6);else Dk6=function(K,_){rz.log.prepareStandardFull(_),console.log(_.standardFull)},GO6=rz.log.makeLogger(Dk6);rz.log.setLevel(GO6,"debug"),rz.log.addLogger(GO6),ui6=GO6}else console={log:function(){}};var GO6,eb1,Dk6;if(ui6!==null&&typeof window<"u"&&window.location){if(Wk6=new URL(window.location.href).searchParams,Wk6.has("console.level"))rz.log.setLevel(ui6,Wk6.get("console.level").slice(-1)[0]);if(Wk6.has("console.lock")){if(qx1=Wk6.get("console.lock").slice(-1)[0],qx1=="true")rz.log.lock(ui6)}}var Wk6,qx1;rz.log.consoleLogger=ui6});var aw4=m((RlA,ow4)=>{ow4.exports=IF();Ev8();wk6();Mb1();Qb1()});var ew4=m((hlA,tw4)=>{var j4=E_();h76();Iu();Ei6();S76();JO6();Lb1();WC();_$();Fv8();var i8=j4.asn1,uv=tw4.exports=j4.pkcs7=j4.pkcs7||{};uv.messageFromPem=function(q){var K=j4.pem.decode(q)[0];if(K.type!=="PKCS7"){var _=Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw _.headerType=K.type,_}if(K.procType&&K.procType.type==="ENCRYPTED")throw Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var z=i8.fromDer(K.body);return uv.messageFromAsn1(z)};uv.messageToPem=function(q,K){var _={type:"PKCS7",body:i8.toDer(q.toAsn1()).getBytes()};return j4.pem.encode(_,{maxline:K})};uv.messageFromAsn1=function(q){var K={},_=[];if(!i8.validate(q,uv.asn1.contentInfoValidator,K,_)){var z=Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw z.errors=_,z}var Y=i8.derToOid(K.contentType),$;switch(Y){case j4.pki.oids.envelopedData:$=uv.createEnvelopedData();break;case j4.pki.oids.encryptedData:$=uv.createEncryptedData();break;case j4.pki.oids.signedData:$=uv.createSignedData();break;default:throw Error("Cannot read PKCS#7 message. ContentType with OID "+Y+" is not (yet) supported.")}return $.fromAsn1(K.content.value[0]),$};uv.createSignedData=function(){var q=null;return q={type:j4.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(z){if(_x1(q,z,uv.asn1.signedDataValidator),q.certificates=[],q.crls=[],q.digestAlgorithmIdentifiers=[],q.contentInfo=null,q.signerInfos=[],q.rawCapture.certificates){var Y=q.rawCapture.certificates.value;for(var $=0;$<Y.length;++$)q.certificates.push(j4.pki.certificateFromAsn1(Y[$]))}},toAsn1:function(){if(!q.contentInfo)q.sign();var z=[];for(var Y=0;Y<q.certificates.length;++Y)z.push(j4.pki.certificateToAsn1(q.certificates[Y]));var $=[],A=i8.create(i8.Class.CONTEXT_SPECIFIC,0,!0,[i8.create(i8.Class.UNIVERSAL,i8.Type.SEQUENCE,!0,[i8.create(i8.Class.UNIVERSAL,i8.Type.INTEGER,!1,i8.integerToDer(q.version).getBytes()),i8.create(i8.Class.UNIVERSAL,i8.Type.SET,!0,q.digestAlgorithmIdentifiers),q.contentInfo])]);if(z.length>0)A.value[0].value.push(i8.create(i8.Class.CONTEXT_SPECIFIC,0,!0,z));if($.length>0)A.value[0].value.push(i8.create(i8.Class.CONTEXT_SPECIFIC,1,!0,$));return A.value[0].value.push(i8.create(i8.Class.UNIVERSAL,i8.Type.SET,!0,q.signerInfos)),i8.create(i8.Class.UNIVERSAL,i8.Type.SEQUENCE,!0,[i8.create(i8.Class.UNIVERSAL,i8.Type.OID,!1,i8.oidToDer(q.type).getBytes()),A])},addSigner:function(z){var{issuer:Y,serialNumber:$}=z;if(z.certificate){var A=z.certificate;if(typeof A==="string")A=j4.pki.certificateFromPem(A);Y=A.issuer.attributes,$=A.serialNumber}var O=z.key;if(!O)throw Error("Could not add PKCS#7 signer; no private key specified.");if(typeof O==="string")O=j4.pki.privateKeyFromPem(O);var w=z.digestAlgorithm||j4.pki.oids.sha1;switch(w){case j4.pki.oids.sha1:case j4.pki.oids.sha256:case j4.pki.oids.sha384:case j4.pki.oids.sha512:case j4.pki.oids.md5:break;default:throw Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+w)}var j=z.authenticatedAttributes||[];if(j.length>0){var H=!1,J=!1;for(var M=0;M<j.length;++M){var X=j[M];if(!H&&X.type===j4.pki.oids.contentType){if(H=!0,J)break;continue}if(!J&&X.type===j4.pki.oids.messageDigest){if(J=!0,H)break;continue}}if(!H||!J)throw Error("Invalid signer.authenticatedAttributes. If signer.authenticatedAttributes is specified, then it must contain at least two attributes, PKCS #9 content-type and PKCS #9 message-digest.")}q.signers.push({key:O,version:1,issuer:Y,serialNumber:$,digestAlgorithm:w,signatureAlgorithm:j4.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:j,unauthenticatedAttributes:[]})},sign:function(z){if(z=z||{},typeof q.content!=="object"||q.contentInfo===null){if(q.contentInfo=i8.create(i8.Class.UNIVERSAL,i8.Type.SEQUENCE,!0,[i8.create(i8.Class.UNIVERSAL,i8.Type.OID,!1,i8.oidToDer(j4.pki.oids.data).getBytes())]),"content"in q){var Y;if(q.content instanceof j4.util.ByteBuffer)Y=q.content.bytes();else if(typeof q.content==="string")Y=j4.util.encodeUtf8(q.content);if(z.detached)q.detachedContent=i8.create(i8.Class.UNIVERSAL,i8.Type.OCTETSTRING,!1,Y);else q.contentInfo.value.push(i8.create(i8.Class.CONTEXT_SPECIFIC,0,!0,[i8.create(i8.Class.UNIVERSAL,i8.Type.OCTETSTRING,!1,Y)]))}}if(q.signers.length===0)return;var $=K();_($)},verify:function(){throw Error("PKCS#7 signature verification not yet implemented.")},addCertificate:function(z){if(typeof z==="string")z=j4.pki.certificateFromPem(z);q.certificates.push(z)},addCertificateRevokationList:function(z){throw Error("PKCS#7 CRL support not yet implemented.")}},q;function K(){var z={};for(var Y=0;Y<q.signers.length;++Y){var $=q.signers[Y],A=$.digestAlgorithm;if(!(A in z))z[A]=j4.md[j4.pki.oids[A]].create();if($.authenticatedAttributes.length===0)$.md=z[A];else $.md=j4.md[j4.pki.oids[A]].create()}q.digestAlgorithmIdentifiers=[];for(var A in z)q.digestAlgorithmIdentifiers.push(i8.create(i8.Class.UNIVERSAL,i8.Type.SEQUENCE,!0,[i8.create(i8.Class.UNIVERSAL,i8.Type.OID,!1,i8.oidToDer(A).getBytes()),i8.create(i8.Class.UNIVERSAL,i8.Type.NULL,!1,"")]));return z}function _(z){var Y;if(q.detachedContent)Y=q.detachedContent;else Y=q.contentInfo.value[1],Y=Y.value[0];if(!Y)throw Error("Could not sign PKCS#7 message; there is no content to sign.");var $=i8.derToOid(q.contentInfo.value[0].value),A=i8.toDer(Y);A.getByte(),i8.getBerValueLength(A),A=A.getBytes();for(var O in z)z[O].start().update(A);var w=new Date;for(var j=0;j<q.signers.length;++j){var H=q.signers[j];if(H.authenticatedAttributes.length===0){if($!==j4.pki.oids.data)throw Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.")}else{H.authenticatedAttributesAsn1=i8.create(i8.Class.CONTEXT_SPECIFIC,0,!0,[]);var J=i8.create(i8.Class.UNIVERSAL,i8.Type.SET,!0,[]);for(var M=0;M<H.authenticatedAttributes.length;++M){var X=H.authenticatedAttributes[M];if(X.type===j4.pki.oids.messageDigest)X.value=z[H.digestAlgorithm].digest();else if(X.type===j4.pki.oids.signingTime){if(!X.value)X.value=w}J.value.push(Kx1(X)),H.authenticatedAttributesAsn1.value.push(Kx1(X))}A=i8.toDer(J).getBytes(),H.md.start().update(A)}H.signature=H.key.sign(H.md,"RSASSA-PKCS1-V1_5")}q.signerInfos=mU_(q.signers)}};uv.createEncryptedData=function(){var q=null;return q={type:j4.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:j4.pki.oids["aes256-CBC"]},fromAsn1:function(K){_x1(q,K,uv.asn1.encryptedDataValidator)},decrypt:function(K){if(K!==void 0)q.encryptedContent.key=K;sw4(q)}},q};uv.createEnvelopedData=function(){var q=null;return q={type:j4.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:j4.pki.oids["aes256-CBC"]},fromAsn1:function(K){var _=_x1(q,K,uv.asn1.envelopedDataValidator);q.recipients=xU_(_.recipientInfos.value)},toAsn1:function(){return i8.create(i8.Class.UNIVERSAL,i8.Type.SEQUENCE,!0,[i8.create(i8.Class.UNIVERSAL,i8.Type.OID,!1,i8.oidToDer(q.type).getBytes()),i8.create(i8.Class.CONTEXT_SPECIFIC,0,!0,[i8.create(i8.Class.UNIVERSAL,i8.Type.SEQUENCE,!0,[i8.create(i8.Class.UNIVERSAL,i8.Type.INTEGER,!1,i8.integerToDer(q.version).getBytes()),i8.create(i8.Class.UNIVERSAL,i8.Type.SET,!0,IU_(q.recipients)),i8.create(i8.Class.UNIVERSAL,i8.Type.SEQUENCE,!0,pU_(q.encryptedContent))])])])},findRecipient:function(K){var _=K.issuer.attributes;for(var z=0;z<q.recipients.length;++z){var Y=q.recipients[z],$=Y.issuer;if(Y.serialNumber!==K.serialNumber)continue;if($.length!==_.length)continue;var A=!0;for(var O=0;O<_.length;++O)if($[O].type!==_[O].type||$[O].value!==_[O].value){A=!1;break}if(A)return Y}return null},decrypt:function(K,_){if(q.encryptedContent.key===void 0&&K!==void 0&&_!==void 0)switch(K.encryptedContent.algorithm){case j4.pki.oids.rsaEncryption:case j4.pki.oids.desCBC:var z=_.decrypt(K.encryptedContent.content);q.encryptedContent.key=j4.util.createBuffer(z);break;default:throw Error("Unsupported asymmetric cipher, OID "+K.encryptedContent.algorithm)}sw4(q)},addRecipient:function(K){q.recipients.push({version:0,issuer:K.issuer.attributes,serialNumber:K.serialNumber,encryptedContent:{algorithm:j4.pki.oids.rsaEncryption,key:K.publicKey}})},encrypt:function(K,_){if(q.encryptedContent.content===void 0){_=_||q.encryptedContent.algorithm,K=K||q.encryptedContent.key;var z,Y,$;switch(_){case j4.pki.oids["aes128-CBC"]:z=16,Y=16,$=j4.aes.createEncryptionCipher;break;case j4.pki.oids["aes192-CBC"]:z=24,Y=16,$=j4.aes.createEncryptionCipher;break;case j4.pki.oids["aes256-CBC"]:z=32,Y=16,$=j4.aes.createEncryptionCipher;break;case j4.pki.oids["des-EDE3-CBC"]:z=24,Y=8,$=j4.des.createEncryptionCipher;break;default:throw Error("Unsupported symmetric cipher, OID "+_)}if(K===void 0)K=j4.util.createBuffer(j4.random.getBytes(z));else if(K.length()!=z)throw Error("Symmetric key has wrong length; got "+K.length()+" bytes, expected "+z+".");q.encryptedContent.algorithm=_,q.encryptedContent.key=K,q.encryptedContent.parameter=j4.util.createBuffer(j4.random.getBytes(Y));var A=$(K);if(A.start(q.encryptedContent.parameter.copy()),A.update(q.content),!A.finish())throw Error("Symmetric encryption failed.");q.encryptedContent.content=A.output}for(var O=0;O<q.recipients.length;++O){var w=q.recipients[O];if(w.encryptedContent.content!==void 0)continue;switch(w.encryptedContent.algorithm){case j4.pki.oids.rsaEncryption:w.encryptedContent.content=w.encryptedContent.key.encrypt(q.encryptedContent.key.data);break;default:throw Error("Unsupported asymmetric cipher, OID "+w.encryptedContent.algorithm)}}}},q};function CU_(q){var K={},_=[];if(!i8.validate(q,uv.asn1.recipientInfoValidator,K,_)){var z=Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw z.errors=_,z}return{version:K.version.charCodeAt(0),issuer:j4.pki.RDNAttributesAsArray(K.issuer),serialNumber:j4.util.createBuffer(K.serial).toHex(),encryptedContent:{algorithm:i8.derToOid(K.encAlgorithm),parameter:K.encParameter?K.encParameter.value:void 0,content:K.encKey}}}function bU_(q){return i8.create(i8.Class.UNIVERSAL,i8.Type.SEQUENCE,!0,[i8.create(i8.Class.UNIVERSAL,i8.Type.INTEGER,!1,i8.integerToDer(q.version).getBytes()),i8.create(i8.Class.UNIVERSAL,i8.Type.SEQUENCE,!0,[j4.pki.distinguishedNameToAsn1({attributes:q.issuer}),i8.create(i8.Class.UNIVERSAL,i8.Type.INTEGER,!1,j4.util.hexToBytes(q.serialNumber))]),i8.create(i8.Class.UNIVERSAL,i8.Type.SEQUENCE,!0,[i8.create(i8.Class.UNIVERSAL,i8.Type.OID,!1,i8.oidToDer(q.encryptedContent.algorithm).getBytes()),i8.create(i8.Class.UNIVERSAL,i8.Type.NULL,!1,"")]),i8.create(i8.Class.UNIVERSAL,i8.Type.OCTETSTRING,!1,q.encryptedContent.content)])}function xU_(q){var K=[];for(var _=0;_<q.length;++_)K.push(CU_(q[_]));return K}function IU_(q){var K=[];for(var _=0;_<q.length;++_)K.push(bU_(q[_]));return K}function uU_(q){var K=i8.create(i8.Class.UNIVERSAL,i8.Type.SEQUENCE,!0,[i8.create(i8.Class.UNIVERSAL,i8.Type.INTEGER,!1,i8.integerToDer(q.version).getBytes()),i8.create(i8.Class.UNIVERSAL,i8.Type.SEQUENCE,!0,[j4.pki.distinguishedNameToAsn1({attributes:q.issuer}),i8.create(i8.Class.UNIVERSAL,i8.Type.INTEGER,!1,j4.util.hexToBytes(q.serialNumber))]),i8.create(i8.Class.UNIVERSAL,i8.Type.SEQUENCE,!0,[i8.create(i8.Class.UNIVERSAL,i8.Type.OID,!1,i8.oidToDer(q.digestAlgorithm).getBytes()),i8.create(i8.Class.UNIVERSAL,i8.Type.NULL,!1,"")])]);if(q.authenticatedAttributesAsn1)K.value.push(q.authenticatedAttributesAsn1);if(K.value.push(i8.create(i8.Class.UNIVERSAL,i8.Type.SEQUENCE,!0,[i8.create(i8.Class.UNIVERSAL,i8.Type.OID,!1,i8.oidToDer(q.signatureAlgorithm).getBytes()),i8.create(i8.Class.UNIVERSAL,i8.Type.NULL,!1,"")])),K.value.push(i8.create(i8.Class.UNIVERSAL,i8.Type.OCTETSTRING,!1,q.signature)),q.unauthenticatedAttributes.length>0){var _=i8.create(i8.Class.CONTEXT_SPECIFIC,1,!0,[]);for(var z=0;z<q.unauthenticatedAttributes.length;++z){var Y=q.unauthenticatedAttributes[z];_.values.push(Kx1(Y))}K.value.push(_)}return K}function mU_(q){var K=[];for(var _=0;_<q.length;++_)K.push(uU_(q[_]));return K}function Kx1(q){var K;if(q.type===j4.pki.oids.contentType)K=i8.create(i8.Class.UNIVERSAL,i8.Type.OID,!1,i8.oidToDer(q.value).getBytes());else if(q.type===j4.pki.oids.messageDigest)K=i8.create(i8.Class.UNIVERSAL,i8.Type.OCTETSTRING,!1,q.value.bytes());else if(q.type===j4.pki.oids.signingTime){var _=new Date("1950-01-01T00:00:00Z"),z=new Date("2050-01-01T00:00:00Z"),Y=q.value;if(typeof Y==="string"){var $=Date.parse(Y);if(!isNaN($))Y=new Date($);else if(Y.length===13)Y=i8.utcTimeToDate(Y);else Y=i8.generalizedTimeToDate(Y)}if(Y>=_&&Y<z)K=i8.create(i8.Class.UNIVERSAL,i8.Type.UTCTIME,!1,i8.dateToUtcTime(Y));else K=i8.create(i8.Class.UNIVERSAL,i8.Type.GENERALIZEDTIME,!1,i8.dateToGeneralizedTime(Y))}return i8.create(i8.Class.UNIVERSAL,i8.Type.SEQUENCE,!0,[i8.create(i8.Class.UNIVERSAL,i8.Type.OID,!1,i8.oidToDer(q.type).getBytes()),i8.create(i8.Class.UNIVERSAL,i8.Type.SET,!0,[K])])}function pU_(q){return[i8.create(i8.Class.UNIVERSAL,i8.Type.OID,!1,i8.oidToDer(j4.pki.oids.data).getBytes()),i8.create(i8.Class.UNIVERSAL,i8.Type.SEQUENCE,!0,[i8.create(i8.Class.UNIVERSAL,i8.Type.OID,!1,i8.oidToDer(q.algorithm).getBytes()),!q.parameter?void 0:i8.create(i8.Class.UNIVERSAL,i8.Type.OCTETSTRING,!1,q.parameter.getBytes())]),i8.create(i8.Class.CONTEXT_SPECIFIC,0,!0,[i8.create(i8.Class.UNIVERSAL,i8.Type.OCTETSTRING,!1,q.content.getBytes())])]}function _x1(q,K,_){var z={},Y=[];if(!i8.validate(K,_,z,Y)){var $=Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw $.errors=$,$}var A=i8.derToOid(z.contentType);if(A!==j4.pki.oids.data)throw Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(z.encryptedContent){var O="";if(j4.util.isArray(z.encryptedContent))for(var w=0;w<z.encryptedContent.length;++w){if(z.encryptedContent[w].type!==i8.Type.OCTETSTRING)throw Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");O+=z.encryptedContent[w].value}else O=z.encryptedContent;q.encryptedContent={algorithm:i8.derToOid(z.encAlgorithm),parameter:j4.util.createBuffer(z.encParameter.value),content:j4.util.createBuffer(O)}}if(z.content){var O="";if(j4.util.isArray(z.content))for(var w=0;w<z.content.length;++w){if(z.content[w].type!==i8.Type.OCTETSTRING)throw Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");O+=z.content[w].value}else O=z.content;q.content=j4.util.createBuffer(O)}return q.version=z.version.charCodeAt(0),q.rawCapture=z,z}function sw4(q){if(q.encryptedContent.key===void 0)throw Error("Symmetric key not available.");if(q.content===void 0){var K;switch(q.encryptedContent.algorithm){case j4.pki.oids["aes128-CBC"]:case j4.pki.oids["aes192-CBC"]:case j4.pki.oids["aes256-CBC"]:K=j4.aes.createDecryptionCipher(q.encryptedContent.key);break;case j4.pki.oids.desCBC:case j4.pki.oids["des-EDE3-CBC"]:K=j4.des.createDecryptionCipher(q.encryptedContent.key);break;default:throw Error("Unsupported symmetric cipher, OID "+q.encryptedContent.algorithm)}if(K.start(q.encryptedContent.parameter),K.update(q.encryptedContent.content),!K.finish())throw Error("Symmetric decryption failed.");q.content=K.output}}});var K24=m((SlA,q24)=>{var TX=E_();h76();Yk6();Ev8();wk6();_$();var av8=q24.exports=TX.ssh=TX.ssh||{};av8.privateKeyToPutty=function(q,K,_){_=_||"",K=K||"";var z="ssh-rsa",Y=K===""?"none":"aes256-cbc",$="PuTTY-User-Key-File-2: "+z+`\r
863`;$+="Encryption: "+Y+`\r
864`,$+="Comment: "+_+`\r

Callers

nothing calls this directly

Calls 2

fromNumberMethod · 0.45
fromStringMethod · 0.45

Tested by

no test coverage detected