@limrun/ui 0.9.0-rc.8 → 0.13.3-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +25 -8
- package/dist/app-store-relay/index.cjs +9 -0
- package/dist/app-store-relay/index.d.ts +102 -0
- package/dist/app-store-relay/index.js +430 -0
- package/dist/app-store-relay/react.cjs +1 -0
- package/dist/app-store-relay/react.d.ts +15 -0
- package/dist/app-store-relay/react.js +65 -0
- package/dist/browser-storage-BJ__DGJ6.mjs +202 -0
- package/dist/browser-storage-C1jQLXat.js +1 -0
- package/dist/client-Bk1N3XIF.mjs +228 -0
- package/dist/client-CnbCWvCs.js +1 -0
- package/dist/components/device-install/index.d.ts +1 -2
- package/dist/core/device-install/apple/provisioning.d.ts +55 -4
- package/dist/core/device-install/operations/limbuild-client.d.ts +15 -1
- package/dist/core/device-install/storage/browser-storage.d.ts +9 -5
- package/dist/core/device-install/types.d.ts +4 -1
- package/dist/device-build/index.cjs +1 -0
- package/dist/device-build/index.d.ts +4 -0
- package/dist/device-build/index.js +84 -0
- package/dist/device-build/react.cjs +1 -0
- package/dist/device-build/react.d.ts +20 -0
- package/dist/device-build/react.js +66 -0
- package/dist/device-build/signing.d.ts +20 -0
- package/dist/device-install/index.cjs +1 -1
- package/dist/device-install/index.d.ts +18 -3
- package/dist/device-install/index.js +570 -76
- package/dist/device-install/react.cjs +1 -1
- package/dist/device-install/react.d.ts +23 -1
- package/dist/device-install/react.js +93 -2
- package/dist/hooks/index.d.ts +1 -1
- package/dist/index-BXg7HdIs.mjs +11547 -0
- package/dist/index-CMeQfhYy.js +22 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +502 -495
- package/dist/limbuild-client-CFJhYsRx.mjs +79 -0
- package/dist/limbuild-client-C_CMNLYV.js +1 -0
- package/dist/provisioning-CdseoMJQ.mjs +239 -0
- package/dist/provisioning-D2ZZQeyX.js +1 -0
- package/package.json +21 -1
- package/src/app-store-relay/index.test.ts +74 -0
- package/src/app-store-relay/index.ts +447 -0
- package/src/app-store-relay/react.ts +125 -0
- package/src/components/device-install/index.ts +1 -2
- package/src/core/device-install/apple/provisioning.test.ts +84 -0
- package/src/core/device-install/apple/provisioning.ts +91 -7
- package/src/core/device-install/operations/limbuild-client.ts +32 -2
- package/src/core/device-install/storage/browser-storage.ts +29 -14
- package/src/core/device-install/types.ts +5 -1
- package/src/device-build/index.ts +42 -0
- package/src/device-build/react.ts +128 -0
- package/src/device-build/signing.ts +94 -0
- package/src/device-install/index.ts +49 -3
- package/src/device-install/react.ts +180 -1
- package/src/hooks/index.ts +1 -1
- package/src/index.ts +1 -4
- package/vite.config.ts +4 -0
- package/dist/components/device-install/device-install-dialog.d.ts +0 -5
- package/dist/device-install-dialog-DGn2ZdBB.js +0 -2
- package/dist/device-install-dialog-DgWsZF6o.mjs +0 -443
- package/dist/device-install-dialog.css +0 -1
- package/dist/hooks/use-device-install.d.ts +0 -73
- package/dist/use-device-install-ByUSmeYz.js +0 -31
- package/dist/use-device-install-Y42p84we.mjs +0 -13624
- package/src/components/device-install/device-install-dialog.css +0 -325
- package/src/components/device-install/device-install-dialog.tsx +0 -495
- package/src/hooks/use-device-install.ts +0 -1219
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";var sn=Object.defineProperty,on=(t,e)=>{for(var r in e)sn(t,r,{get:e[r],enumerable:!0})},Et=self.crypto,wt={};on(wt,{Hash:()=>Br,bigintFromBytes:()=>Rt,bitLength:()=>ba,byteLength:()=>Ta,bytesFromBigint:()=>Qe,concatBytes:()=>je,constantTimeCompare:()=>Ia,fromHex:()=>Ar,hash:()=>Me,hashInterleave:()=>Ba,modPow:()=>gt,randomBytes:()=>br,toHex:()=>ct,xorBytes:()=>Aa});function ba(t){return t.toString(2).length}function Ta(t){return(ba(t)+7)/8|0}function Rt(t){let e=0n;for(let r of t.values())e=(e<<8n)+BigInt(r);return e}function Qe(t){let e=new Uint8Array(Ta(t));for(let r=e.length-1;t>0;r--,t>>=8n)e[r]=Number(t&0xffn);return e}function br(t){if(t<1)throw new RangeError("numBytes must be >= 1");let e=new Uint8Array(t);return Et.getRandomValues(e),e}function Tr(t,e){if(e<1n)throw new RangeError("n must be > 0");let r=t%e;return r<0n?r+e:r}function fn(t,e){if(t<1n||e<1n)throw new RangeError("a and b must be > 0");let r=0n,d=1n,T=1n,x=0n;for(;t!==0n;){let l=e/t,a=e%t,y=r-T*l,u=d-x*l;e=t,t=a,r=T,d=x,T=y,x=u}return{g:e,x:r,y:d}}function un(t,e){let r=fn(Tr(t,e),e);if(r.g!==1n)throw new RangeError;return Tr(r.x,e)}function gt(t,e,r){if(r<1n)throw new RangeError("n must be > 0");if(r===1n)return 0n;if(t=Tr(t,r),e<0n)return un(gt(t,e>=0?e:-e,r),r);let d=1n;for(;e>0;)e%2n===1n&&(d=d*t%r),e=e/2n,t=t**2n%r;return d}function je(...t){let e=0;for(let T of t)e+=T.byteLength;let r=new Uint8Array(e),d=0;for(let T of t)r.set(T,d),d+=T.byteLength;return r}function Aa(t,e){if(t.length!==e.length)throw new Error("xorBytes: buffers must be same length");let r=t.length,d=new Uint8Array(r);for(let T=0;T<r;T++)d[T]=t[T]^e[T];return d}function ct(t){return[...t].map(e=>e.toString(16).padStart(2,"0")).join("")}function Ar(t){return Uint8Array.from(t.match(/.{2}/g)?.map(e=>parseInt(e,16))??[])}function Ia(t,e){if(t.length!==e.length)return!1;let r=t.length,d=0;for(let T=0;T<r;T++)d|=t[T]^e[T];return d===0}var Br=(t=>(t[t.SHA1=3]="SHA1",t[t.SHA256=5]="SHA256",t[t.SHA384=6]="SHA384",t[t.SHA512=7]="SHA512",t))(Br||{});function Me(t,e){switch(t){case 3:return Et.subtle.digest("SHA-1",e);case 5:return Et.subtle.digest("SHA-256",e);case 6:return Et.subtle.digest("SHA-384",e);case 7:return Et.subtle.digest("SHA-512",e)}}async function Ba(t,e){let r=new Uint8Array(e,0,e.byteLength);for(var d=0;d<r.length;d++)if(r[d]!==0){(e.byteLength-d)%2===1&&d++,r=new Uint8Array(e,d,e.byteLength-d);break}let T=r.length/2,x=new Uint8Array(T),l=new Uint8Array(T);for(let S=0;S<r.length;S++)x[S]=r[S*2],l[S]=r[S*2+1];let a=new Uint8Array(await Me(t,x)),y=new Uint8Array(await Me(t,l)),u=new Uint8Array(a.byteLength*2);for(let S=0;S<a.byteLength;S++)u[S*2]=a[S],u[S*2+1]=y[S];return u}var _a=(t=>(t[t.RFC2945=0]="RFC2945",t[t.SRPTools=1]="SRPTools",t[t.GoSRP=2]="GoSRP",t[t.GSA=3]="GSA",t))(_a||{}),ln=new Map([[1024,{g:2n,N:0xeeaf0ab9adb38dd69c33f80afa8fc5e86072618775ff3c0b9ea2314c9c256576d674df7496ea81d3383b4813d692c6e0e0d5d8e250b98be48e495c1d6089dad15dc7d7b46154d6b6ce8ef4ad69b15d4982559b297bcf1885c529f566660e57ec68edbc3c05726cc02fd4cbf4976eaa9afd5138fe8376435b9fc61d2fc0eb06e3n,n:128}],[1536,{g:2n,N:0x9def3cafb939277ab1f12a8617a47bbbdba51df499ac4c80beeea9614b19cc4d5f4f5f556e27cbde51c6a94be4607a291558903ba0d0f84380b655bb9a22e8dcdf028a7cec67f0d08134b1c8b97989149b609e0be3bab63d47548381dbc5b1fc764e3f4b53dd9da1158bfd3e2b9c8cf56edf019539349627db2fd53d24b7c48665772e437d6c7f8ce442734af7ccb7ae837c264ae3a9beb87f8a2fe9b8b5292e5a021fff5e91479e8ce7a28c2442c6f315180f93499a234dcf76e3fed135f9bbn,n:192}],[2048,{g:2n,N:0xac6bdb41324a9a9bf166de5e1389582faf72b6651987ee07fc3192943db56050a37329cbb4a099ed8193e0757767a13dd52312ab4b03310dcd7f48a9da04fd50e8083969edb767b0cf6095179a163ab3661a05fbd5faaae82918a9962f0b93b855f97993ec975eeaa80d740adbf4ff747359d041d5c33ea71d281e446b14773bca97b43a23fb801676bd207a436c6481f1d2b9078717461a5b9d32e688f87748544523b524b0d57d5ea77a2775d2ecfa032cfbdbf52fb3786160279004e57ae6af874e7303ce53299ccc041c7bc308d82a5698f3a8d0c38271ae35f8e9dbfbb694b5c803d89f7ae435de236d525f54759b65e372fcd68ef20fa7111f9e4aff73n,n:256}],[3072,{g:5n,N:0xffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a93ad2caffffffffffffffffn,n:384}],[4096,{g:5n,N:0xffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c934063199ffffffffffffffffn,n:512}],[6144,{g:5n,N:0xffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dcc4024ffffffffffffffffn,n:768}],[8192,{g:19n,N:0xffffffffffffffffc90fdaa22168c234c4c6628b80dc1cd129024e088a67cc74020bbea63b139b22514a08798e3404ddef9519b3cd3a431b302b0a6df25f14374fe1356d6d51c245e485b576625e7ec6f44c42e9a637ed6b0bff5cb6f406b7edee386bfb5a899fa5ae9f24117c4b1fe649286651ece45b3dc2007cb8a163bf0598da48361c55d39a69163fa8fd24cf5f83655d23dca3ad961c62f356208552bb9ed529077096966d670c354e4abc9804f1746c08ca18217c32905e462e36ce3be39e772c180e86039b2783a2ec07a28fb5c55df06f4c52c9de2bcbf6955817183995497cea956ae515d2261898fa051015728e5a8aaac42dad33170d04507a33a85521abdf1cba64ecfb850458dbef0a8aea71575d060c7db3970f85a6e1e4c7abf5ae8cdb0933d71e8c94e04a25619dcee3d2261ad2ee6bf12ffa06d98a0864d87602733ec86a64521f2b18177b200cbbe117577a615d6c770988c0bad946e208e24fa074e5ab3143db5bfce0fd108e4b82d120a92108011a723c12a787e6d788719a10bdba5b2699c327186af4e23c1a946834b6150bda2583e9ca2ad44ce8dbbbc2db04de8ef92e8efc141fbecaa6287c59474e6bc05d99b2964fa090c3a2233ba186515be7ed1f612970cee2d7afb81bdd762170481cd0069127d5b05aa993b4ea988d8fddc186ffb7dc90a6c08f4df435c93402849236c3fab4d27c7026c1d4dcb2602646dec9751e763dba37bdf8ff9406ad9e530ee5db382f413001aeb06a53ed9027d831179727b0865a8918da3edbebcf9b14ed44ce6cbaced4bb1bdb7f1447e6cc254b332051512bd7af426fb8f401378cd2bf5983ca01c64b92ecf032ea15d1721d03f482d7ce6e74fef6d55e702f46980c82b5a84031900b1c9e59e7c97fbec7e8f323a97a7e36cc88be0f1d45b7ff585ac54bd407b22b4154aacc8f6d7ebf48e1d814cc5ed20f8037e0a79715eef29be32806a1d58bb7c5da76f550aa3d8a1fbff0eb19ccb1a313d55cda56c9ec2ef29632387fe8d76e3c0468043e8f663f4860ee12bf2d5b0b7474d6e694f91e6dbe115974a3926f12fee5e438777cb6a932df8cd8bec4d073b931ba3bc832b68d9dd300741fa7bf8afc47ed2576f6936ba424663aab639c5ae4f5683423b4742bf1c978238f16cbe39d652de3fdb8befc848ad922222e04a4037c0713eb57a81a23f0c73473fc646cea306b4bcbc8862f8385ddfa9d4b7fa2c087e879683303ed5bdd3a062b3cf5b3a278a66d2a13f83f44f82ddf310ee074ab6a364597e899a0255dc164f31cc50846851df9ab48195ded7ea1b1d510bd7ee74d73faf36bc31ecfa268359046f4eb879f924009438b481c6cd7889a002ed5ee382bc9190da6fc026e479558e4475677e9aa9e3050e2765694dfc81f56e880b96e7160c980dd98edd3dfffffffffffffffffn,n:1024}]]);function cn(t=0){t===0&&(t=2048);let e=ln.get(t);if(!e)throw new Error(`Invalid prime field size ${t}`);return e}function Nt(t,e){let r=Qe(t);if(r.length>=e)return r;let d=e-r.length,T=new Uint8Array(e);for(let x=0;x<d;x++)T[x]=0;return T.set(r,d),T}var dn=class{constructor(t,e,r=0){this.m=t,this.h=e,this.pf=cn(r)}pf;async hashInt(t){return Rt(new Uint8Array(await Me(this.h,t)))}async verifier(t,e,r){let d=this.m===2?new Uint8Array(await Me(this.h,t)):t,T=this.m===2?new Uint8Array(await Me(this.h,e)):e,x=this.pf;r||(r=br(x.n));let l=this.m===2?await this.hashInt(je(d,T,r)):await this.hashInt(je(r,new Uint8Array(await Me(this.h,je(d,new Uint8Array([58]),T))))),a=gt(x.g,l,x.N);return new hn({i:d,s:r,v:Qe(a),h:this.h,pf:x})}async newClient(t,e,r){let d=this.pf;return r||(r=Rt(br(d.n))),new pn({s:this,i:this.m===2?new Uint8Array(await Me(this.h,t)):t,p:this.m===2?new Uint8Array(await Me(this.h,e)):e,a:r,A:gt(d.g,r,d.N),k:await this.hashInt(je(Qe(d.N),Nt(d.g,Number(d.n))))})}},hn=class{i;s;v;h;pf;constructor(t){this.i=t.i,this.s=t.s,this.v=t.v,this.h=t.h,this.pf=t.pf}encode(){let t=ct(this.i),e=[this.pf.n.toString(10),this.pf.N.toString(16),this.pf.g.toString(16),this.h.toString(10),t,ct(this.s),ct(this.v)].join(":");return[t,e]}},pn=class{s;i;p;a;A;k;_K;_M;get K(){return this._K}get M(){return this._M}constructor(t){this.s=t.s,this.i=t.i,this.p=t.p,this.a=t.a,this.A=t.A,this.k=t.k,this._K=new Uint8Array,this._M=new Uint8Array}credentials(){return[ct(this.i),ct(Qe(this.A))].join(":")}parseServerCredentials(t){let e=t.split(":");if(!e[0]||!e[1])throw new Error("Invalid server public key");let r=Ar(e[0]),d=Ar(e[1]);return[r,d]}async generate(t,e){let r=Rt(e),d=this.s.pf;if(r%d.N===0n)throw new Error("Invalid server public key");let T=await this.s.hashInt(je(Nt(this.A,d.n),Nt(r,d.n)));if(T===0n)throw new Error("Invalid server public key");let x=this.s.m===2?await this.s.hashInt(je(this.i,this.p,t)):await this.s.hashInt(je(t,new Uint8Array(await Me(this.s.h,je(this.s.m==3?new Uint8Array([]):this.i,new Uint8Array([58]),this.p))))),l=gt(d.g,x,d.N)*this.k,a=r-l,y=this.a+T*x,u=gt(a,y,d.N);return this._K=this.s.m===0?new Uint8Array(await Ba(this.s.h,Qe(u))):new Uint8Array(await Me(this.s.h,Qe(u))),this.s.m===2?this._M=new Uint8Array(await Me(this.s.h,je(this._K,Qe(this.A),Qe(r),this.i,t,Qe(d.N),Qe(d.g)))):this._M=new Uint8Array(await Me(this.s.h,je(Aa(new Uint8Array(await Me(this.s.h,Qe(d.N))),new Uint8Array(await Me(this.s.h,this.s.m==3?Nt(d.g,d.n):Qe(d.g)))),new Uint8Array(await Me(this.s.h,this.i)),t,Qe(this.A),Qe(r),this._K))),ct(this._M)}async generateM2(){if(!this.M)throw new Error("M not generated");return new Uint8Array(await Me(this.s.h,je(Qe(this.A),this._M,this._K)))}async serverOk(t){let e=new TextEncoder,r=e.encode(ct(new Uint8Array(await Me(this.s.h,je(this._K,this.M))))),d=e.encode(t);return Ia(r,d)}};const Na=new dn(_a.GSA,Br.SHA256,2048);class vn{constructor(e){this.accountName=e}srpClient;async init(){if(this.srpClient)throw new Error("SRP client is already initialized.");return this.srpClient=await Na.newClient(Ir(this.accountName),new Uint8Array),{accountName:this.accountName,protocols:["s2k","s2k_fo"],a:Pt(wt.bytesFromBigint(this.srpClient.A))}}async complete(e,r){if(!this.srpClient)throw new Error("SRP client is not initialized.");if(r.protocol!=="s2k"&&r.protocol!=="s2k_fo")throw new Error(`Unsupported Apple SRP protocol ${r.protocol}.`);const d=Ur(r.salt),T=Ur(r.b),x=await yn(r.protocol,e,d,r.iteration);this.srpClient.p=x,await this.srpClient.generate(d,T);const l=await this.srpClient.generateM2();return{accountName:this.accountName,c:r.c,m1:Pt(this.srpClient._M),m2:Pt(l)}}}async function yn(t,e,r,d){let T=new Uint8Array(await wt.hash(Na.h,Vt(Ir(e))));t==="s2k_fo"&&(T=Ir(wt.toHex(T)));const x=await crypto.subtle.importKey("raw",Vt(T),{name:"PBKDF2"},!1,["deriveBits"]),l=await crypto.subtle.deriveBits({name:"PBKDF2",hash:{name:"SHA-256"},iterations:d,salt:Vt(r)},x,256);return new Uint8Array(l)}function Ir(t){return new TextEncoder().encode(t)}function Pt(t){let e="";for(const r of t)e+=String.fromCharCode(r);return btoa(e)}function Ur(t){const e=atob(t),r=new Uint8Array(e.length);for(let d=0;d<e.length;d+=1)r[d]=e.charCodeAt(d);return r}function Vt(t){const e=new Uint8Array(t.byteLength);return e.set(t),e.buffer}var gn=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function mn(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function Cn(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var e=t.default;if(typeof e=="function"){var r=function d(){var T=!1;try{T=this instanceof d}catch{}return T?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};r.prototype=e.prototype}else r={};return Object.defineProperty(r,"__esModule",{value:!0}),Object.keys(t).forEach(function(d){var T=Object.getOwnPropertyDescriptor(t,d);Object.defineProperty(r,d,T.get?T:{enumerable:!0,get:function(){return t[d]}})}),r}var Ot,Dr;function fe(){return Dr||(Dr=1,Ot={options:{usePureJavaScript:!1}}),Ot}var Kt={exports:{}},Ft,Pr;function En(){if(Pr)return Ft;Pr=1;var t={};Ft=t;var e={};t.encode=function(d,T,x){if(typeof T!="string")throw new TypeError('"alphabet" must be a string.');if(x!==void 0&&typeof x!="number")throw new TypeError('"maxline" must be a number.');var l="";if(!(d instanceof Uint8Array))l=r(d,T);else{var a=0,y=T.length,u=T.charAt(0),S=[0];for(a=0;a<d.length;++a){for(var U=0,E=d[a];U<S.length;++U)E+=S[U]<<8,S[U]=E%y,E=E/y|0;for(;E>0;)S.push(E%y),E=E/y|0}for(a=0;d[a]===0&&a<d.length-1;++a)l+=u;for(a=S.length-1;a>=0;--a)l+=T[S[a]]}if(x){var f=new RegExp(".{1,"+x+"}","g");l=l.match(f).join(`\r
|
|
2
|
+
`)}return l},t.decode=function(d,T){if(typeof d!="string")throw new TypeError('"input" must be a string.');if(typeof T!="string")throw new TypeError('"alphabet" must be a string.');var x=e[T];if(!x){x=e[T]=[];for(var l=0;l<T.length;++l)x[T.charCodeAt(l)]=l}d=d.replace(/\s/g,"");for(var a=T.length,y=T.charAt(0),u=[0],l=0;l<d.length;l++){var S=x[d.charCodeAt(l)];if(S===void 0)return;for(var U=0,E=S;U<u.length;++U)E+=u[U]*a,u[U]=E&255,E>>=8;for(;E>0;)u.push(E&255),E>>=8}for(var f=0;d[f]===y&&f<d.length-1;++f)u.push(0);return typeof Buffer<"u"?Buffer.from(u.reverse()):new Uint8Array(u.reverse())};function r(d,T){var x=0,l=T.length,a=T.charAt(0),y=[0];for(x=0;x<d.length();++x){for(var u=0,S=d.at(x);u<y.length;++u)S+=y[u]<<8,y[u]=S%l,S=S/l|0;for(;S>0;)y.push(S%l),S=S/l|0}var U="";for(x=0;d.at(x)===0&&x<d.length()-1;++x)U+=a;for(x=y.length-1;x>=0;--x)U+=T[y[x]];return U}return Ft}var Vr;function de(){if(Vr)return Kt.exports;Vr=1;var t=fe(),e=En(),r=Kt.exports=t.util=t.util||{};(function(){if(typeof process<"u"&&process.nextTick&&!process.browser){r.nextTick=process.nextTick,typeof setImmediate=="function"?r.setImmediate=setImmediate:r.setImmediate=r.nextTick;return}if(typeof setImmediate=="function"){r.setImmediate=function(){return setImmediate.apply(void 0,arguments)},r.nextTick=function(i){return setImmediate(i)};return}if(r.setImmediate=function(i){setTimeout(i,0)},typeof window<"u"&&typeof window.postMessage=="function"){let i=function(n){if(n.source===window&&n.data===s){n.stopPropagation();var I=h.slice();h.length=0,I.forEach(function(k){k()})}};var s="forge.setImmediate",h=[];r.setImmediate=function(n){h.push(n),h.length===1&&window.postMessage(s,"*")},window.addEventListener("message",i,!0)}if(typeof MutationObserver<"u"){var p=Date.now(),A=!0,R=document.createElement("div"),h=[];new MutationObserver(function(){var n=h.slice();h.length=0,n.forEach(function(I){I()})}).observe(R,{attributes:!0});var c=r.setImmediate;r.setImmediate=function(n){Date.now()-p>15?(p=Date.now(),c(n)):(h.push(n),h.length===1&&R.setAttribute("a",A=!A))}}r.nextTick=r.setImmediate})(),r.isNodejs=typeof process<"u"&&process.versions&&process.versions.node,r.globalScope=(function(){return r.isNodejs?gn:typeof self>"u"?window:self})(),r.isArray=Array.isArray||function(s){return Object.prototype.toString.call(s)==="[object Array]"},r.isArrayBuffer=function(s){return typeof ArrayBuffer<"u"&&s instanceof ArrayBuffer},r.isArrayBufferView=function(s){return s&&r.isArrayBuffer(s.buffer)&&s.byteLength!==void 0};function d(s){if(!(s===8||s===16||s===24||s===32))throw new Error("Only 8, 16, 24, or 32 bits supported: "+s)}r.ByteBuffer=T;function T(s){if(this.data="",this.read=0,typeof s=="string")this.data=s;else if(r.isArrayBuffer(s)||r.isArrayBufferView(s))if(typeof Buffer<"u"&&s instanceof Buffer)this.data=s.toString("binary");else{var h=new Uint8Array(s);try{this.data=String.fromCharCode.apply(null,h)}catch{for(var p=0;p<h.length;++p)this.putByte(h[p])}}else(s instanceof T||typeof s=="object"&&typeof s.data=="string"&&typeof s.read=="number")&&(this.data=s.data,this.read=s.read);this._constructedStringLength=0}r.ByteStringBuffer=T;var x=4096;r.ByteStringBuffer.prototype._optimizeConstructedString=function(s){this._constructedStringLength+=s,this._constructedStringLength>x&&(this.data.substr(0,1),this._constructedStringLength=0)},r.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},r.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},r.ByteStringBuffer.prototype.putByte=function(s){return this.putBytes(String.fromCharCode(s))},r.ByteStringBuffer.prototype.fillWithByte=function(s,h){s=String.fromCharCode(s);for(var p=this.data;h>0;)h&1&&(p+=s),h>>>=1,h>0&&(s+=s);return this.data=p,this._optimizeConstructedString(h),this},r.ByteStringBuffer.prototype.putBytes=function(s){return this.data+=s,this._optimizeConstructedString(s.length),this},r.ByteStringBuffer.prototype.putString=function(s){return this.putBytes(r.encodeUtf8(s))},r.ByteStringBuffer.prototype.putInt16=function(s){return this.putBytes(String.fromCharCode(s>>8&255)+String.fromCharCode(s&255))},r.ByteStringBuffer.prototype.putInt24=function(s){return this.putBytes(String.fromCharCode(s>>16&255)+String.fromCharCode(s>>8&255)+String.fromCharCode(s&255))},r.ByteStringBuffer.prototype.putInt32=function(s){return this.putBytes(String.fromCharCode(s>>24&255)+String.fromCharCode(s>>16&255)+String.fromCharCode(s>>8&255)+String.fromCharCode(s&255))},r.ByteStringBuffer.prototype.putInt16Le=function(s){return this.putBytes(String.fromCharCode(s&255)+String.fromCharCode(s>>8&255))},r.ByteStringBuffer.prototype.putInt24Le=function(s){return this.putBytes(String.fromCharCode(s&255)+String.fromCharCode(s>>8&255)+String.fromCharCode(s>>16&255))},r.ByteStringBuffer.prototype.putInt32Le=function(s){return this.putBytes(String.fromCharCode(s&255)+String.fromCharCode(s>>8&255)+String.fromCharCode(s>>16&255)+String.fromCharCode(s>>24&255))},r.ByteStringBuffer.prototype.putInt=function(s,h){d(h);var p="";do h-=8,p+=String.fromCharCode(s>>h&255);while(h>0);return this.putBytes(p)},r.ByteStringBuffer.prototype.putSignedInt=function(s,h){return s<0&&(s+=2<<h-1),this.putInt(s,h)},r.ByteStringBuffer.prototype.putBuffer=function(s){return this.putBytes(s.getBytes())},r.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)},r.ByteStringBuffer.prototype.getInt16=function(){var s=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,s},r.ByteStringBuffer.prototype.getInt24=function(){var s=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,s},r.ByteStringBuffer.prototype.getInt32=function(){var s=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+3);return this.read+=4,s},r.ByteStringBuffer.prototype.getInt16Le=function(){var s=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,s},r.ByteStringBuffer.prototype.getInt24Le=function(){var s=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,s},r.ByteStringBuffer.prototype.getInt32Le=function(){var s=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16^this.data.charCodeAt(this.read+3)<<24;return this.read+=4,s},r.ByteStringBuffer.prototype.getInt=function(s){d(s);var h=0;do h=(h<<8)+this.data.charCodeAt(this.read++),s-=8;while(s>0);return h},r.ByteStringBuffer.prototype.getSignedInt=function(s){var h=this.getInt(s),p=2<<s-2;return h>=p&&(h-=p<<1),h},r.ByteStringBuffer.prototype.getBytes=function(s){var h;return s?(s=Math.min(this.length(),s),h=this.data.slice(this.read,this.read+s),this.read+=s):s===0?h="":(h=this.read===0?this.data:this.data.slice(this.read),this.clear()),h},r.ByteStringBuffer.prototype.bytes=function(s){return typeof s>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+s)},r.ByteStringBuffer.prototype.at=function(s){return this.data.charCodeAt(this.read+s)},r.ByteStringBuffer.prototype.setAt=function(s,h){return this.data=this.data.substr(0,this.read+s)+String.fromCharCode(h)+this.data.substr(this.read+s+1),this},r.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},r.ByteStringBuffer.prototype.copy=function(){var s=r.createBuffer(this.data);return s.read=this.read,s},r.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},r.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},r.ByteStringBuffer.prototype.truncate=function(s){var h=Math.max(0,this.length()-s);return this.data=this.data.substr(this.read,h),this.read=0,this},r.ByteStringBuffer.prototype.toHex=function(){for(var s="",h=this.read;h<this.data.length;++h){var p=this.data.charCodeAt(h);p<16&&(s+="0"),s+=p.toString(16)}return s},r.ByteStringBuffer.prototype.toString=function(){return r.decodeUtf8(this.bytes())};function l(s,h){h=h||{},this.read=h.readOffset||0,this.growSize=h.growSize||1024;var p=r.isArrayBuffer(s),A=r.isArrayBufferView(s);if(p||A){p?this.data=new DataView(s):this.data=new DataView(s.buffer,s.byteOffset,s.byteLength),this.write="writeOffset"in h?h.writeOffset:this.data.byteLength;return}this.data=new DataView(new ArrayBuffer(0)),this.write=0,s!=null&&this.putBytes(s),"writeOffset"in h&&(this.write=h.writeOffset)}r.DataBuffer=l,r.DataBuffer.prototype.length=function(){return this.write-this.read},r.DataBuffer.prototype.isEmpty=function(){return this.length()<=0},r.DataBuffer.prototype.accommodate=function(s,h){if(this.length()>=s)return this;h=Math.max(h||this.growSize,s);var p=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),A=new Uint8Array(this.length()+h);return A.set(p),this.data=new DataView(A.buffer),this},r.DataBuffer.prototype.putByte=function(s){return this.accommodate(1),this.data.setUint8(this.write++,s),this},r.DataBuffer.prototype.fillWithByte=function(s,h){this.accommodate(h);for(var p=0;p<h;++p)this.data.setUint8(s);return this},r.DataBuffer.prototype.putBytes=function(s,h){if(r.isArrayBufferView(s)){var p=new Uint8Array(s.buffer,s.byteOffset,s.byteLength),A=p.byteLength-p.byteOffset;this.accommodate(A);var R=new Uint8Array(this.data.buffer,this.write);return R.set(p),this.write+=A,this}if(r.isArrayBuffer(s)){var p=new Uint8Array(s);this.accommodate(p.byteLength);var R=new Uint8Array(this.data.buffer);return R.set(p,this.write),this.write+=p.byteLength,this}if(s instanceof r.DataBuffer||typeof s=="object"&&typeof s.read=="number"&&typeof s.write=="number"&&r.isArrayBufferView(s.data)){var p=new Uint8Array(s.data.byteLength,s.read,s.length());this.accommodate(p.byteLength);var R=new Uint8Array(s.data.byteLength,this.write);return R.set(p),this.write+=p.byteLength,this}if(s instanceof r.ByteStringBuffer&&(s=s.data,h="binary"),h=h||"binary",typeof s=="string"){var c;if(h==="hex")return this.accommodate(Math.ceil(s.length/2)),c=new Uint8Array(this.data.buffer,this.write),this.write+=r.binary.hex.decode(s,c,this.write),this;if(h==="base64")return this.accommodate(Math.ceil(s.length/4)*3),c=new Uint8Array(this.data.buffer,this.write),this.write+=r.binary.base64.decode(s,c,this.write),this;if(h==="utf8"&&(s=r.encodeUtf8(s),h="binary"),h==="binary"||h==="raw")return this.accommodate(s.length),c=new Uint8Array(this.data.buffer,this.write),this.write+=r.binary.raw.decode(c),this;if(h==="utf16")return this.accommodate(s.length*2),c=new Uint16Array(this.data.buffer,this.write),this.write+=r.text.utf16.encode(c),this;throw new Error("Invalid encoding: "+h)}throw Error("Invalid parameter: "+s)},r.DataBuffer.prototype.putBuffer=function(s){return this.putBytes(s),s.clear(),this},r.DataBuffer.prototype.putString=function(s){return this.putBytes(s,"utf16")},r.DataBuffer.prototype.putInt16=function(s){return this.accommodate(2),this.data.setInt16(this.write,s),this.write+=2,this},r.DataBuffer.prototype.putInt24=function(s){return this.accommodate(3),this.data.setInt16(this.write,s>>8&65535),this.data.setInt8(this.write,s>>16&255),this.write+=3,this},r.DataBuffer.prototype.putInt32=function(s){return this.accommodate(4),this.data.setInt32(this.write,s),this.write+=4,this},r.DataBuffer.prototype.putInt16Le=function(s){return this.accommodate(2),this.data.setInt16(this.write,s,!0),this.write+=2,this},r.DataBuffer.prototype.putInt24Le=function(s){return this.accommodate(3),this.data.setInt8(this.write,s>>16&255),this.data.setInt16(this.write,s>>8&65535,!0),this.write+=3,this},r.DataBuffer.prototype.putInt32Le=function(s){return this.accommodate(4),this.data.setInt32(this.write,s,!0),this.write+=4,this},r.DataBuffer.prototype.putInt=function(s,h){d(h),this.accommodate(h/8);do h-=8,this.data.setInt8(this.write++,s>>h&255);while(h>0);return this},r.DataBuffer.prototype.putSignedInt=function(s,h){return d(h),this.accommodate(h/8),s<0&&(s+=2<<h-1),this.putInt(s,h)},r.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)},r.DataBuffer.prototype.getInt16=function(){var s=this.data.getInt16(this.read);return this.read+=2,s},r.DataBuffer.prototype.getInt24=function(){var s=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,s},r.DataBuffer.prototype.getInt32=function(){var s=this.data.getInt32(this.read);return this.read+=4,s},r.DataBuffer.prototype.getInt16Le=function(){var s=this.data.getInt16(this.read,!0);return this.read+=2,s},r.DataBuffer.prototype.getInt24Le=function(){var s=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,s},r.DataBuffer.prototype.getInt32Le=function(){var s=this.data.getInt32(this.read,!0);return this.read+=4,s},r.DataBuffer.prototype.getInt=function(s){d(s);var h=0;do h=(h<<8)+this.data.getInt8(this.read++),s-=8;while(s>0);return h},r.DataBuffer.prototype.getSignedInt=function(s){var h=this.getInt(s),p=2<<s-2;return h>=p&&(h-=p<<1),h},r.DataBuffer.prototype.getBytes=function(s){var h;return s?(s=Math.min(this.length(),s),h=this.data.slice(this.read,this.read+s),this.read+=s):s===0?h="":(h=this.read===0?this.data:this.data.slice(this.read),this.clear()),h},r.DataBuffer.prototype.bytes=function(s){return typeof s>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+s)},r.DataBuffer.prototype.at=function(s){return this.data.getUint8(this.read+s)},r.DataBuffer.prototype.setAt=function(s,h){return this.data.setUint8(s,h),this},r.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},r.DataBuffer.prototype.copy=function(){return new r.DataBuffer(this)},r.DataBuffer.prototype.compact=function(){if(this.read>0){var s=new Uint8Array(this.data.buffer,this.read),h=new Uint8Array(s.byteLength);h.set(s),this.data=new DataView(h),this.write-=this.read,this.read=0}return this},r.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},r.DataBuffer.prototype.truncate=function(s){return this.write=Math.max(0,this.length()-s),this.read=Math.min(this.read,this.write),this},r.DataBuffer.prototype.toHex=function(){for(var s="",h=this.read;h<this.data.byteLength;++h){var p=this.data.getUint8(h);p<16&&(s+="0"),s+=p.toString(16)}return s},r.DataBuffer.prototype.toString=function(s){var h=new Uint8Array(this.data,this.read,this.length());if(s=s||"utf8",s==="binary"||s==="raw")return r.binary.raw.encode(h);if(s==="hex")return r.binary.hex.encode(h);if(s==="base64")return r.binary.base64.encode(h);if(s==="utf8")return r.text.utf8.decode(h);if(s==="utf16")return r.text.utf16.decode(h);throw new Error("Invalid encoding: "+s)},r.createBuffer=function(s,h){return h=h||"raw",s!==void 0&&h==="utf8"&&(s=r.encodeUtf8(s)),new r.ByteBuffer(s)},r.fillString=function(s,h){for(var p="";h>0;)h&1&&(p+=s),h>>>=1,h>0&&(s+=s);return p},r.xorBytes=function(s,h,p){for(var A="",R="",c="",i=0,n=0;p>0;--p,++i)R=s.charCodeAt(i)^h.charCodeAt(i),n>=10&&(A+=c,c="",n=0),c+=String.fromCharCode(R),++n;return A+=c,A},r.hexToBytes=function(s){var h="",p=0;for(s.length&!0&&(p=1,h+=String.fromCharCode(parseInt(s[0],16)));p<s.length;p+=2)h+=String.fromCharCode(parseInt(s.substr(p,2),16));return h},r.bytesToHex=function(s){return r.createBuffer(s).toHex()},r.int32ToBytes=function(s){return String.fromCharCode(s>>24&255)+String.fromCharCode(s>>16&255)+String.fromCharCode(s>>8&255)+String.fromCharCode(s&255)};var a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",y=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51],u="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";r.encode64=function(s,h){for(var p="",A="",R,c,i,n=0;n<s.length;)R=s.charCodeAt(n++),c=s.charCodeAt(n++),i=s.charCodeAt(n++),p+=a.charAt(R>>2),p+=a.charAt((R&3)<<4|c>>4),isNaN(c)?p+="==":(p+=a.charAt((c&15)<<2|i>>6),p+=isNaN(i)?"=":a.charAt(i&63)),h&&p.length>h&&(A+=p.substr(0,h)+`\r
|
|
3
|
+
`,p=p.substr(h));return A+=p,A},r.decode64=function(s){s=s.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var h="",p,A,R,c,i=0;i<s.length;)p=y[s.charCodeAt(i++)-43],A=y[s.charCodeAt(i++)-43],R=y[s.charCodeAt(i++)-43],c=y[s.charCodeAt(i++)-43],h+=String.fromCharCode(p<<2|A>>4),R!==64&&(h+=String.fromCharCode((A&15)<<4|R>>2),c!==64&&(h+=String.fromCharCode((R&3)<<6|c)));return h},r.encodeUtf8=function(s){return unescape(encodeURIComponent(s))},r.decodeUtf8=function(s){return decodeURIComponent(escape(s))},r.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:e.encode,decode:e.decode}},r.binary.raw.encode=function(s){return String.fromCharCode.apply(null,s)},r.binary.raw.decode=function(s,h,p){var A=h;A||(A=new Uint8Array(s.length)),p=p||0;for(var R=p,c=0;c<s.length;++c)A[R++]=s.charCodeAt(c);return h?R-p:A},r.binary.hex.encode=r.bytesToHex,r.binary.hex.decode=function(s,h,p){var A=h;A||(A=new Uint8Array(Math.ceil(s.length/2))),p=p||0;var R=0,c=p;for(s.length&1&&(R=1,A[c++]=parseInt(s[0],16));R<s.length;R+=2)A[c++]=parseInt(s.substr(R,2),16);return h?c-p:A},r.binary.base64.encode=function(s,h){for(var p="",A="",R,c,i,n=0;n<s.byteLength;)R=s[n++],c=s[n++],i=s[n++],p+=a.charAt(R>>2),p+=a.charAt((R&3)<<4|c>>4),isNaN(c)?p+="==":(p+=a.charAt((c&15)<<2|i>>6),p+=isNaN(i)?"=":a.charAt(i&63)),h&&p.length>h&&(A+=p.substr(0,h)+`\r
|
|
4
|
+
`,p=p.substr(h));return A+=p,A},r.binary.base64.decode=function(s,h,p){var A=h;A||(A=new Uint8Array(Math.ceil(s.length/4)*3)),s=s.replace(/[^A-Za-z0-9\+\/\=]/g,""),p=p||0;for(var R,c,i,n,I=0,k=p;I<s.length;)R=y[s.charCodeAt(I++)-43],c=y[s.charCodeAt(I++)-43],i=y[s.charCodeAt(I++)-43],n=y[s.charCodeAt(I++)-43],A[k++]=R<<2|c>>4,i!==64&&(A[k++]=(c&15)<<4|i>>2,n!==64&&(A[k++]=(i&3)<<6|n));return h?k-p:A.subarray(0,k)},r.binary.base58.encode=function(s,h){return r.binary.baseN.encode(s,u,h)},r.binary.base58.decode=function(s,h){return r.binary.baseN.decode(s,u,h)},r.text={utf8:{},utf16:{}},r.text.utf8.encode=function(s,h,p){s=r.encodeUtf8(s);var A=h;A||(A=new Uint8Array(s.length)),p=p||0;for(var R=p,c=0;c<s.length;++c)A[R++]=s.charCodeAt(c);return h?R-p:A},r.text.utf8.decode=function(s){return r.decodeUtf8(String.fromCharCode.apply(null,s))},r.text.utf16.encode=function(s,h,p){var A=h;A||(A=new Uint8Array(s.length*2));var R=new Uint16Array(A.buffer);p=p||0;for(var c=p,i=p,n=0;n<s.length;++n)R[i++]=s.charCodeAt(n),c+=2;return h?c-p:A},r.text.utf16.decode=function(s){return String.fromCharCode.apply(null,new Uint16Array(s.buffer))},r.deflate=function(s,h,p){if(h=r.decode64(s.deflate(r.encode64(h)).rval),p){var A=2,R=h.charCodeAt(1);R&32&&(A=6),h=h.substring(A,h.length-4)}return h},r.inflate=function(s,h,p){var A=s.inflate(r.encode64(h)).rval;return A===null?null:r.decode64(A)};var S=function(s,h,p){if(!s)throw new Error("WebStorage not available.");var A;if(p===null?A=s.removeItem(h):(p=r.encode64(JSON.stringify(p)),A=s.setItem(h,p)),typeof A<"u"&&A.rval!==!0){var R=new Error(A.error.message);throw R.id=A.error.id,R.name=A.error.name,R}},U=function(s,h){if(!s)throw new Error("WebStorage not available.");var p=s.getItem(h);if(s.init)if(p.rval===null){if(p.error){var A=new Error(p.error.message);throw A.id=p.error.id,A.name=p.error.name,A}p=null}else p=p.rval;return p!==null&&(p=JSON.parse(r.decode64(p))),p},E=function(s,h,p,A){var R=U(s,h);R===null&&(R={}),R[p]=A,S(s,h,R)},f=function(s,h,p){var A=U(s,h);return A!==null&&(A=p in A?A[p]:null),A},v=function(s,h,p){var A=U(s,h);if(A!==null&&p in A){delete A[p];var R=!0;for(var c in A){R=!1;break}R&&(A=null),S(s,h,A)}},m=function(s,h){S(s,h,null)},g=function(s,h,p){var A=null;typeof p>"u"&&(p=["web","flash"]);var R,c=!1,i=null;for(var n in p){R=p[n];try{if(R==="flash"||R==="both"){if(h[0]===null)throw new Error("Flash local storage not available.");A=s.apply(this,h),c=R==="flash"}(R==="web"||R==="both")&&(h[0]=localStorage,A=s.apply(this,h),c=!0)}catch(I){i=I}if(c)break}if(!c)throw i;return A};return r.setItem=function(s,h,p,A,R){g(E,arguments,R)},r.getItem=function(s,h,p,A){return g(f,arguments,A)},r.removeItem=function(s,h,p,A){g(v,arguments,A)},r.clearItems=function(s,h,p){g(m,arguments,p)},r.isEmpty=function(s){for(var h in s)if(s.hasOwnProperty(h))return!1;return!0},r.format=function(s){for(var h=/%./g,p,A,R=0,c=[],i=0;p=h.exec(s);){A=s.substring(i,h.lastIndex-2),A.length>0&&c.push(A),i=h.lastIndex;var n=p[0][1];switch(n){case"s":case"o":R<arguments.length?c.push(arguments[R+++1]):c.push("<?>");break;case"%":c.push("%");break;default:c.push("<%"+n+"?>")}}return c.push(s.substring(i)),c.join("")},r.formatNumber=function(s,h,p,A){var R=s,c=isNaN(h=Math.abs(h))?2:h,i=p===void 0?",":p,n=A===void 0?".":A,I=R<0?"-":"",k=parseInt(R=Math.abs(+R||0).toFixed(c),10)+"",O=k.length>3?k.length%3:0;return I+(O?k.substr(0,O)+n:"")+k.substr(O).replace(/(\d{3})(?=\d)/g,"$1"+n)+(c?i+Math.abs(R-k).toFixed(c).slice(2):"")},r.formatSize=function(s){return s>=1073741824?s=r.formatNumber(s/1073741824,2,".","")+" GiB":s>=1048576?s=r.formatNumber(s/1048576,2,".","")+" MiB":s>=1024?s=r.formatNumber(s/1024,0)+" KiB":s=r.formatNumber(s,0)+" bytes",s},r.bytesFromIP=function(s){return s.indexOf(".")!==-1?r.bytesFromIPv4(s):s.indexOf(":")!==-1?r.bytesFromIPv6(s):null},r.bytesFromIPv4=function(s){if(s=s.split("."),s.length!==4)return null;for(var h=r.createBuffer(),p=0;p<s.length;++p){var A=parseInt(s[p],10);if(isNaN(A))return null;h.putByte(A)}return h.getBytes()},r.bytesFromIPv6=function(s){var h=0;s=s.split(":").filter(function(i){return i.length===0&&++h,!0});for(var p=(8-s.length+h)*2,A=r.createBuffer(),R=0;R<8;++R){if(!s[R]||s[R].length===0){A.fillWithByte(0,p),p=0;continue}var c=r.hexToBytes(s[R]);c.length<2&&A.putByte(0),A.putBytes(c)}return A.getBytes()},r.bytesToIP=function(s){return s.length===4?r.bytesToIPv4(s):s.length===16?r.bytesToIPv6(s):null},r.bytesToIPv4=function(s){if(s.length!==4)return null;for(var h=[],p=0;p<s.length;++p)h.push(s.charCodeAt(p));return h.join(".")},r.bytesToIPv6=function(s){if(s.length!==16)return null;for(var h=[],p=[],A=0,R=0;R<s.length;R+=2){for(var c=r.bytesToHex(s[R]+s[R+1]);c[0]==="0"&&c!=="0";)c=c.substr(1);if(c==="0"){var i=p[p.length-1],n=h.length;!i||n!==i.end+1?p.push({start:n,end:n}):(i.end=n,i.end-i.start>p[A].end-p[A].start&&(A=p.length-1))}h.push(c)}if(p.length>0){var I=p[A];I.end-I.start>0&&(h.splice(I.start,I.end-I.start+1,""),I.start===0&&h.unshift(""),I.end===7&&h.push(""))}return h.join(":")},r.estimateCores=function(s,h){if(typeof s=="function"&&(h=s,s={}),s=s||{},"cores"in r&&!s.update)return h(null,r.cores);if(typeof navigator<"u"&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return r.cores=navigator.hardwareConcurrency,h(null,r.cores);if(typeof Worker>"u")return r.cores=1,h(null,r.cores);if(typeof Blob>"u")return r.cores=2,h(null,r.cores);var p=URL.createObjectURL(new Blob(["(",(function(){self.addEventListener("message",function(i){var n=Date.now(),I=n+4;self.postMessage({st:n,et:I})})}).toString(),")()"],{type:"application/javascript"}));A([],5,16);function A(i,n,I){if(n===0){var k=Math.floor(i.reduce(function(O,P){return O+P},0)/i.length);return r.cores=Math.max(1,k),URL.revokeObjectURL(p),h(null,r.cores)}R(I,function(O,P){i.push(c(I,P)),A(i,n-1,I)})}function R(i,n){for(var I=[],k=[],O=0;O<i;++O){var P=new Worker(p);P.addEventListener("message",function(K){if(k.push(K.data),k.length===i){for(var q=0;q<i;++q)I[q].terminate();n(null,k)}}),I.push(P)}for(var O=0;O<i;++O)I[O].postMessage(O)}function c(i,n){for(var I=[],k=0;k<i;++k)for(var O=n[k],P=I[k]=[],K=0;K<i;++K)if(k!==K){var q=n[K];(O.st>q.st&&O.st<q.et||q.st>O.st&&q.st<O.et)&&P.push(K)}return I.reduce(function(M,G){return Math.max(M,G.length)},0)}},Kt.exports}var Mt,Or;function _r(){if(Or)return Mt;Or=1;var t=fe();de(),Mt=t.cipher=t.cipher||{},t.cipher.algorithms=t.cipher.algorithms||{},t.cipher.createCipher=function(r,d){var T=r;if(typeof T=="string"&&(T=t.cipher.getAlgorithm(T),T&&(T=T())),!T)throw new Error("Unsupported algorithm: "+r);return new t.cipher.BlockCipher({algorithm:T,key:d,decrypt:!1})},t.cipher.createDecipher=function(r,d){var T=r;if(typeof T=="string"&&(T=t.cipher.getAlgorithm(T),T&&(T=T())),!T)throw new Error("Unsupported algorithm: "+r);return new t.cipher.BlockCipher({algorithm:T,key:d,decrypt:!0})},t.cipher.registerAlgorithm=function(r,d){r=r.toUpperCase(),t.cipher.algorithms[r]=d},t.cipher.getAlgorithm=function(r){return r=r.toUpperCase(),r in t.cipher.algorithms?t.cipher.algorithms[r]:null};var e=t.cipher.BlockCipher=function(r){this.algorithm=r.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=r.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=r.decrypt,this.algorithm.initialize(r)};return e.prototype.start=function(r){r=r||{};var d={};for(var T in r)d[T]=r[T];d.decrypt=this._decrypt,this._finish=!1,this._input=t.util.createBuffer(),this.output=r.output||t.util.createBuffer(),this.mode.start(d)},e.prototype.update=function(r){for(r&&this._input.putBuffer(r);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},e.prototype.finish=function(r){r&&(this.mode.name==="ECB"||this.mode.name==="CBC")&&(this.mode.pad=function(T){return r(this.blockSize,T,!1)},this.mode.unpad=function(T){return r(this.blockSize,T,!0)});var d={};return d.decrypt=this._decrypt,d.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,d)||(this._finish=!0,this.update(),this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,d))||this.mode.afterFinish&&!this.mode.afterFinish(this.output,d))},Mt}var qt={exports:{}},Kr;function wa(){if(Kr)return qt.exports;Kr=1;var t=fe();de(),t.cipher=t.cipher||{};var e=qt.exports=t.cipher.modes=t.cipher.modes||{};e.ecb=function(x){x=x||{},this.name="ECB",this.cipher=x.cipher,this.blockSize=x.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},e.ecb.prototype.start=function(x){},e.ecb.prototype.encrypt=function(x,l,a){if(x.length()<this.blockSize&&!(a&&x.length()>0))return!0;for(var y=0;y<this._ints;++y)this._inBlock[y]=x.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var y=0;y<this._ints;++y)l.putInt32(this._outBlock[y])},e.ecb.prototype.decrypt=function(x,l,a){if(x.length()<this.blockSize&&!(a&&x.length()>0))return!0;for(var y=0;y<this._ints;++y)this._inBlock[y]=x.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var y=0;y<this._ints;++y)l.putInt32(this._outBlock[y])},e.ecb.prototype.pad=function(x,l){var a=x.length()===this.blockSize?this.blockSize:this.blockSize-x.length();return x.fillWithByte(a,a),!0},e.ecb.prototype.unpad=function(x,l){if(l.overflow>0)return!1;var a=x.length(),y=x.at(a-1);return y>this.blockSize<<2?!1:(x.truncate(y),!0)},e.cbc=function(x){x=x||{},this.name="CBC",this.cipher=x.cipher,this.blockSize=x.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},e.cbc.prototype.start=function(x){if(x.iv===null){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else if("iv"in x)this._iv=r(x.iv,this.blockSize),this._prev=this._iv.slice(0);else throw new Error("Invalid IV parameter.")},e.cbc.prototype.encrypt=function(x,l,a){if(x.length()<this.blockSize&&!(a&&x.length()>0))return!0;for(var y=0;y<this._ints;++y)this._inBlock[y]=this._prev[y]^x.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var y=0;y<this._ints;++y)l.putInt32(this._outBlock[y]);this._prev=this._outBlock},e.cbc.prototype.decrypt=function(x,l,a){if(x.length()<this.blockSize&&!(a&&x.length()>0))return!0;for(var y=0;y<this._ints;++y)this._inBlock[y]=x.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var y=0;y<this._ints;++y)l.putInt32(this._prev[y]^this._outBlock[y]);this._prev=this._inBlock.slice(0)},e.cbc.prototype.pad=function(x,l){var a=x.length()===this.blockSize?this.blockSize:this.blockSize-x.length();return x.fillWithByte(a,a),!0},e.cbc.prototype.unpad=function(x,l){if(l.overflow>0)return!1;var a=x.length(),y=x.at(a-1);return y>this.blockSize<<2?!1:(x.truncate(y),!0)},e.cfb=function(x){x=x||{},this.name="CFB",this.cipher=x.cipher,this.blockSize=x.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=t.util.createBuffer(),this._partialBytes=0},e.cfb.prototype.start=function(x){if(!("iv"in x))throw new Error("Invalid IV parameter.");this._iv=r(x.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},e.cfb.prototype.encrypt=function(x,l,a){var y=x.length();if(y===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&y>=this.blockSize){for(var u=0;u<this._ints;++u)this._inBlock[u]=x.getInt32()^this._outBlock[u],l.putInt32(this._inBlock[u]);return}var S=(this.blockSize-y)%this.blockSize;S>0&&(S=this.blockSize-S),this._partialOutput.clear();for(var u=0;u<this._ints;++u)this._partialBlock[u]=x.getInt32()^this._outBlock[u],this._partialOutput.putInt32(this._partialBlock[u]);if(S>0)x.read-=this.blockSize;else for(var u=0;u<this._ints;++u)this._inBlock[u]=this._partialBlock[u];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),S>0&&!a)return l.putBytes(this._partialOutput.getBytes(S-this._partialBytes)),this._partialBytes=S,!0;l.putBytes(this._partialOutput.getBytes(y-this._partialBytes)),this._partialBytes=0},e.cfb.prototype.decrypt=function(x,l,a){var y=x.length();if(y===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&y>=this.blockSize){for(var u=0;u<this._ints;++u)this._inBlock[u]=x.getInt32(),l.putInt32(this._inBlock[u]^this._outBlock[u]);return}var S=(this.blockSize-y)%this.blockSize;S>0&&(S=this.blockSize-S),this._partialOutput.clear();for(var u=0;u<this._ints;++u)this._partialBlock[u]=x.getInt32(),this._partialOutput.putInt32(this._partialBlock[u]^this._outBlock[u]);if(S>0)x.read-=this.blockSize;else for(var u=0;u<this._ints;++u)this._inBlock[u]=this._partialBlock[u];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),S>0&&!a)return l.putBytes(this._partialOutput.getBytes(S-this._partialBytes)),this._partialBytes=S,!0;l.putBytes(this._partialOutput.getBytes(y-this._partialBytes)),this._partialBytes=0},e.ofb=function(x){x=x||{},this.name="OFB",this.cipher=x.cipher,this.blockSize=x.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=t.util.createBuffer(),this._partialBytes=0},e.ofb.prototype.start=function(x){if(!("iv"in x))throw new Error("Invalid IV parameter.");this._iv=r(x.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},e.ofb.prototype.encrypt=function(x,l,a){var y=x.length();if(x.length()===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&y>=this.blockSize){for(var u=0;u<this._ints;++u)l.putInt32(x.getInt32()^this._outBlock[u]),this._inBlock[u]=this._outBlock[u];return}var S=(this.blockSize-y)%this.blockSize;S>0&&(S=this.blockSize-S),this._partialOutput.clear();for(var u=0;u<this._ints;++u)this._partialOutput.putInt32(x.getInt32()^this._outBlock[u]);if(S>0)x.read-=this.blockSize;else for(var u=0;u<this._ints;++u)this._inBlock[u]=this._outBlock[u];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),S>0&&!a)return l.putBytes(this._partialOutput.getBytes(S-this._partialBytes)),this._partialBytes=S,!0;l.putBytes(this._partialOutput.getBytes(y-this._partialBytes)),this._partialBytes=0},e.ofb.prototype.decrypt=e.ofb.prototype.encrypt,e.ctr=function(x){x=x||{},this.name="CTR",this.cipher=x.cipher,this.blockSize=x.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=t.util.createBuffer(),this._partialBytes=0},e.ctr.prototype.start=function(x){if(!("iv"in x))throw new Error("Invalid IV parameter.");this._iv=r(x.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},e.ctr.prototype.encrypt=function(x,l,a){var y=x.length();if(y===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&y>=this.blockSize)for(var u=0;u<this._ints;++u)l.putInt32(x.getInt32()^this._outBlock[u]);else{var S=(this.blockSize-y)%this.blockSize;S>0&&(S=this.blockSize-S),this._partialOutput.clear();for(var u=0;u<this._ints;++u)this._partialOutput.putInt32(x.getInt32()^this._outBlock[u]);if(S>0&&(x.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),S>0&&!a)return l.putBytes(this._partialOutput.getBytes(S-this._partialBytes)),this._partialBytes=S,!0;l.putBytes(this._partialOutput.getBytes(y-this._partialBytes)),this._partialBytes=0}d(this._inBlock)},e.ctr.prototype.decrypt=e.ctr.prototype.encrypt,e.gcm=function(x){x=x||{},this.name="GCM",this.cipher=x.cipher,this.blockSize=x.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=t.util.createBuffer(),this._partialBytes=0,this._R=3774873600},e.gcm.prototype.start=function(x){if(!("iv"in x))throw new Error("Invalid IV parameter.");var l=t.util.createBuffer(x.iv);this._cipherLength=0;var a;if("additionalData"in x?a=t.util.createBuffer(x.additionalData):a=t.util.createBuffer(),"tagLength"in x?this._tagLength=x.tagLength:this._tagLength=128,this._tag=null,x.decrypt&&(this._tag=t.util.createBuffer(x.tag).getBytes(),this._tag.length!==this._tagLength/8))throw new Error("Authentication tag does not match tag length.");this._hashBlock=new Array(this._ints),this.tag=null,this._hashSubkey=new Array(this._ints),this.cipher.encrypt([0,0,0,0],this._hashSubkey),this.componentBits=4,this._m=this.generateHashTable(this._hashSubkey,this.componentBits);var y=l.length();if(y===12)this._j0=[l.getInt32(),l.getInt32(),l.getInt32(),1];else{for(this._j0=[0,0,0,0];l.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[l.getInt32(),l.getInt32(),l.getInt32(),l.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(T(y*8)))}this._inBlock=this._j0.slice(0),d(this._inBlock),this._partialBytes=0,a=t.util.createBuffer(a),this._aDataLength=T(a.length()*8);var u=a.length()%this.blockSize;for(u&&a.fillWithByte(0,this.blockSize-u),this._s=[0,0,0,0];a.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[a.getInt32(),a.getInt32(),a.getInt32(),a.getInt32()])},e.gcm.prototype.encrypt=function(x,l,a){var y=x.length();if(y===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&y>=this.blockSize){for(var u=0;u<this._ints;++u)l.putInt32(this._outBlock[u]^=x.getInt32());this._cipherLength+=this.blockSize}else{var S=(this.blockSize-y)%this.blockSize;S>0&&(S=this.blockSize-S),this._partialOutput.clear();for(var u=0;u<this._ints;++u)this._partialOutput.putInt32(x.getInt32()^this._outBlock[u]);if(S<=0||a){if(a){var U=y%this.blockSize;this._cipherLength+=U,this._partialOutput.truncate(this.blockSize-U)}else this._cipherLength+=this.blockSize;for(var u=0;u<this._ints;++u)this._outBlock[u]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),S>0&&!a)return x.read-=this.blockSize,l.putBytes(this._partialOutput.getBytes(S-this._partialBytes)),this._partialBytes=S,!0;l.putBytes(this._partialOutput.getBytes(y-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),d(this._inBlock)},e.gcm.prototype.decrypt=function(x,l,a){var y=x.length();if(y<this.blockSize&&!(a&&y>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),d(this._inBlock),this._hashBlock[0]=x.getInt32(),this._hashBlock[1]=x.getInt32(),this._hashBlock[2]=x.getInt32(),this._hashBlock[3]=x.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var u=0;u<this._ints;++u)l.putInt32(this._outBlock[u]^this._hashBlock[u]);y<this.blockSize?this._cipherLength+=y%this.blockSize:this._cipherLength+=this.blockSize},e.gcm.prototype.afterFinish=function(x,l){var a=!0;l.decrypt&&l.overflow&&x.truncate(this.blockSize-l.overflow),this.tag=t.util.createBuffer();var y=this._aDataLength.concat(T(this._cipherLength*8));this._s=this.ghash(this._hashSubkey,this._s,y);var u=[];this.cipher.encrypt(this._j0,u);for(var S=0;S<this._ints;++S)this.tag.putInt32(this._s[S]^u[S]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),l.decrypt&&this.tag.bytes()!==this._tag&&(a=!1),a},e.gcm.prototype.multiply=function(x,l){for(var a=[0,0,0,0],y=l.slice(0),u=0;u<128;++u){var S=x[u/32|0]&1<<31-u%32;S&&(a[0]^=y[0],a[1]^=y[1],a[2]^=y[2],a[3]^=y[3]),this.pow(y,y)}return a},e.gcm.prototype.pow=function(x,l){for(var a=x[3]&1,y=3;y>0;--y)l[y]=x[y]>>>1|(x[y-1]&1)<<31;l[0]=x[0]>>>1,a&&(l[0]^=this._R)},e.gcm.prototype.tableMultiply=function(x){for(var l=[0,0,0,0],a=0;a<32;++a){var y=a/8|0,u=x[y]>>>(7-a%8)*4&15,S=this._m[a][u];l[0]^=S[0],l[1]^=S[1],l[2]^=S[2],l[3]^=S[3]}return l},e.gcm.prototype.ghash=function(x,l,a){return l[0]^=a[0],l[1]^=a[1],l[2]^=a[2],l[3]^=a[3],this.tableMultiply(l)},e.gcm.prototype.generateHashTable=function(x,l){for(var a=8/l,y=4*a,u=16*a,S=new Array(u),U=0;U<u;++U){var E=[0,0,0,0],f=U/y|0,v=(y-1-U%y)*l;E[f]=1<<l-1<<v,S[U]=this.generateSubHashTable(this.multiply(E,x),l)}return S},e.gcm.prototype.generateSubHashTable=function(x,l){var a=1<<l,y=a>>>1,u=new Array(a);u[y]=x.slice(0);for(var S=y>>>1;S>0;)this.pow(u[2*S],u[S]=[]),S>>=1;for(S=2;S<y;){for(var U=1;U<S;++U){var E=u[S],f=u[U];u[S+U]=[E[0]^f[0],E[1]^f[1],E[2]^f[2],E[3]^f[3]]}S*=2}for(u[0]=[0,0,0,0],S=y+1;S<a;++S){var v=u[S^y];u[S]=[x[0]^v[0],x[1]^v[1],x[2]^v[2],x[3]^v[3]]}return u};function r(x,l){if(typeof x=="string"&&(x=t.util.createBuffer(x)),t.util.isArray(x)&&x.length>4){var a=x;x=t.util.createBuffer();for(var y=0;y<a.length;++y)x.putByte(a[y])}if(x.length()<l)throw new Error("Invalid IV length; got "+x.length()+" bytes and expected "+l+" bytes.");if(!t.util.isArray(x)){for(var u=[],S=l/4,y=0;y<S;++y)u.push(x.getInt32());x=u}return x}function d(x){x[x.length-1]=x[x.length-1]+1&4294967295}function T(x){return[x/4294967296|0,x&4294967295]}return qt.exports}var Ht,Fr;function ht(){if(Fr)return Ht;Fr=1;var t=fe();_r(),wa(),de(),Ht=t.aes=t.aes||{},t.aes.startEncrypting=function(f,v,m,g){var s=E({key:f,output:m,decrypt:!1,mode:g});return s.start(v),s},t.aes.createEncryptionCipher=function(f,v){return E({key:f,output:null,decrypt:!1,mode:v})},t.aes.startDecrypting=function(f,v,m,g){var s=E({key:f,output:m,decrypt:!0,mode:g});return s.start(v),s},t.aes.createDecryptionCipher=function(f,v){return E({key:f,output:null,decrypt:!0,mode:v})},t.aes.Algorithm=function(f,v){r||u();var m=this;m.name=f,m.mode=new v({blockSize:16,cipher:{encrypt:function(g,s){return U(m._w,g,s,!1)},decrypt:function(g,s){return U(m._w,g,s,!0)}}}),m._init=!1},t.aes.Algorithm.prototype.initialize=function(f){if(!this._init){var v=f.key,m;if(typeof v=="string"&&(v.length===16||v.length===24||v.length===32))v=t.util.createBuffer(v);else if(t.util.isArray(v)&&(v.length===16||v.length===24||v.length===32)){m=v,v=t.util.createBuffer();for(var g=0;g<m.length;++g)v.putByte(m[g])}if(!t.util.isArray(v)){m=v,v=[];var s=m.length();if(s===16||s===24||s===32){s=s>>>2;for(var g=0;g<s;++g)v.push(m.getInt32())}}if(!t.util.isArray(v)||!(v.length===4||v.length===6||v.length===8))throw new Error("Invalid key parameter.");var h=this.mode.name,p=["CFB","OFB","CTR","GCM"].indexOf(h)!==-1;this._w=S(v,f.decrypt&&!p),this._init=!0}},t.aes._expandKey=function(f,v){return r||u(),S(f,v)},t.aes._updateBlock=U,e("AES-ECB",t.cipher.modes.ecb),e("AES-CBC",t.cipher.modes.cbc),e("AES-CFB",t.cipher.modes.cfb),e("AES-OFB",t.cipher.modes.ofb),e("AES-CTR",t.cipher.modes.ctr),e("AES-GCM",t.cipher.modes.gcm);function e(f,v){var m=function(){return new t.aes.Algorithm(f,v)};t.cipher.registerAlgorithm(f,m)}var r=!1,d=4,T,x,l,a,y;function u(){r=!0,l=[0,1,2,4,8,16,32,64,128,27,54];for(var f=new Array(256),v=0;v<128;++v)f[v]=v<<1,f[v+128]=v+128<<1^283;T=new Array(256),x=new Array(256),a=new Array(4),y=new Array(4);for(var v=0;v<4;++v)a[v]=new Array(256),y[v]=new Array(256);for(var m=0,g=0,s,h,p,A,R,c,i,v=0;v<256;++v){A=g^g<<1^g<<2^g<<3^g<<4,A=A>>8^A&255^99,T[m]=A,x[A]=m,R=f[A],s=f[m],h=f[s],p=f[h],c=R<<24^A<<16^A<<8^(A^R),i=(s^h^p)<<24^(m^p)<<16^(m^h^p)<<8^(m^s^p);for(var n=0;n<4;++n)a[n][m]=c,y[n][A]=i,c=c<<24|c>>>8,i=i<<24|i>>>8;m===0?m=g=1:(m=s^f[f[f[s^p]]],g^=f[f[g]])}}function S(f,v){for(var m=f.slice(0),g,s=1,h=m.length,p=h+6+1,A=d*p,R=h;R<A;++R)g=m[R-1],R%h===0?(g=T[g>>>16&255]<<24^T[g>>>8&255]<<16^T[g&255]<<8^T[g>>>24]^l[s]<<24,s++):h>6&&R%h===4&&(g=T[g>>>24]<<24^T[g>>>16&255]<<16^T[g>>>8&255]<<8^T[g&255]),m[R]=m[R-h]^g;if(v){var c,i=y[0],n=y[1],I=y[2],k=y[3],O=m.slice(0);A=m.length;for(var R=0,P=A-d;R<A;R+=d,P-=d)if(R===0||R===A-d)O[R]=m[P],O[R+1]=m[P+3],O[R+2]=m[P+2],O[R+3]=m[P+1];else for(var K=0;K<d;++K)c=m[P+K],O[R+(3&-K)]=i[T[c>>>24]]^n[T[c>>>16&255]]^I[T[c>>>8&255]]^k[T[c&255]];m=O}return m}function U(f,v,m,g){var s=f.length/4-1,h,p,A,R,c;g?(h=y[0],p=y[1],A=y[2],R=y[3],c=x):(h=a[0],p=a[1],A=a[2],R=a[3],c=T);var i,n,I,k,O,P,K;i=v[0]^f[0],n=v[g?3:1]^f[1],I=v[2]^f[2],k=v[g?1:3]^f[3];for(var q=3,M=1;M<s;++M)O=h[i>>>24]^p[n>>>16&255]^A[I>>>8&255]^R[k&255]^f[++q],P=h[n>>>24]^p[I>>>16&255]^A[k>>>8&255]^R[i&255]^f[++q],K=h[I>>>24]^p[k>>>16&255]^A[i>>>8&255]^R[n&255]^f[++q],k=h[k>>>24]^p[i>>>16&255]^A[n>>>8&255]^R[I&255]^f[++q],i=O,n=P,I=K;m[0]=c[i>>>24]<<24^c[n>>>16&255]<<16^c[I>>>8&255]<<8^c[k&255]^f[++q],m[g?3:1]=c[n>>>24]<<24^c[I>>>16&255]<<16^c[k>>>8&255]<<8^c[i&255]^f[++q],m[2]=c[I>>>24]<<24^c[k>>>16&255]<<16^c[i>>>8&255]<<8^c[n&255]^f[++q],m[g?1:3]=c[k>>>24]<<24^c[i>>>16&255]<<16^c[n>>>8&255]<<8^c[I&255]^f[++q]}function E(f){f=f||{};var v=(f.mode||"CBC").toUpperCase(),m="AES-"+v,g;f.decrypt?g=t.cipher.createDecipher(m,f.key):g=t.cipher.createCipher(m,f.key);var s=g.start;return g.start=function(h,p){var A=null;p instanceof t.util.ByteBuffer&&(A=p,p={}),p=p||{},p.output=A,p.iv=h,s.call(g,p)},g}return Ht}var Gt={exports:{}},Qt={exports:{}},zt={exports:{}},Mr;function pt(){if(Mr)return zt.exports;Mr=1;var t=fe();t.pki=t.pki||{};var e=zt.exports=t.pki.oids=t.oids=t.oids||{};function r(T,x){e[T]=x,e[x]=T}function d(T,x){e[T]=x}return r("1.2.840.113549.1.1.1","rsaEncryption"),r("1.2.840.113549.1.1.4","md5WithRSAEncryption"),r("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),r("1.2.840.113549.1.1.7","RSAES-OAEP"),r("1.2.840.113549.1.1.8","mgf1"),r("1.2.840.113549.1.1.9","pSpecified"),r("1.2.840.113549.1.1.10","RSASSA-PSS"),r("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),r("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),r("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),r("1.3.101.112","EdDSA25519"),r("1.2.840.10040.4.3","dsa-with-sha1"),r("1.3.14.3.2.7","desCBC"),r("1.3.14.3.2.26","sha1"),r("1.3.14.3.2.29","sha1WithRSASignature"),r("2.16.840.1.101.3.4.2.1","sha256"),r("2.16.840.1.101.3.4.2.2","sha384"),r("2.16.840.1.101.3.4.2.3","sha512"),r("2.16.840.1.101.3.4.2.4","sha224"),r("2.16.840.1.101.3.4.2.5","sha512-224"),r("2.16.840.1.101.3.4.2.6","sha512-256"),r("1.2.840.113549.2.2","md2"),r("1.2.840.113549.2.5","md5"),r("1.2.840.113549.1.7.1","data"),r("1.2.840.113549.1.7.2","signedData"),r("1.2.840.113549.1.7.3","envelopedData"),r("1.2.840.113549.1.7.4","signedAndEnvelopedData"),r("1.2.840.113549.1.7.5","digestedData"),r("1.2.840.113549.1.7.6","encryptedData"),r("1.2.840.113549.1.9.1","emailAddress"),r("1.2.840.113549.1.9.2","unstructuredName"),r("1.2.840.113549.1.9.3","contentType"),r("1.2.840.113549.1.9.4","messageDigest"),r("1.2.840.113549.1.9.5","signingTime"),r("1.2.840.113549.1.9.6","counterSignature"),r("1.2.840.113549.1.9.7","challengePassword"),r("1.2.840.113549.1.9.8","unstructuredAddress"),r("1.2.840.113549.1.9.14","extensionRequest"),r("1.2.840.113549.1.9.20","friendlyName"),r("1.2.840.113549.1.9.21","localKeyId"),r("1.2.840.113549.1.9.22.1","x509Certificate"),r("1.2.840.113549.1.12.10.1.1","keyBag"),r("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),r("1.2.840.113549.1.12.10.1.3","certBag"),r("1.2.840.113549.1.12.10.1.4","crlBag"),r("1.2.840.113549.1.12.10.1.5","secretBag"),r("1.2.840.113549.1.12.10.1.6","safeContentsBag"),r("1.2.840.113549.1.5.13","pkcs5PBES2"),r("1.2.840.113549.1.5.12","pkcs5PBKDF2"),r("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),r("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),r("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),r("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),r("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),r("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),r("1.2.840.113549.2.7","hmacWithSHA1"),r("1.2.840.113549.2.8","hmacWithSHA224"),r("1.2.840.113549.2.9","hmacWithSHA256"),r("1.2.840.113549.2.10","hmacWithSHA384"),r("1.2.840.113549.2.11","hmacWithSHA512"),r("1.2.840.113549.3.7","des-EDE3-CBC"),r("2.16.840.1.101.3.4.1.2","aes128-CBC"),r("2.16.840.1.101.3.4.1.22","aes192-CBC"),r("2.16.840.1.101.3.4.1.42","aes256-CBC"),r("2.5.4.3","commonName"),r("2.5.4.4","surname"),r("2.5.4.5","serialNumber"),r("2.5.4.6","countryName"),r("2.5.4.7","localityName"),r("2.5.4.8","stateOrProvinceName"),r("2.5.4.9","streetAddress"),r("2.5.4.10","organizationName"),r("2.5.4.11","organizationalUnitName"),r("2.5.4.12","title"),r("2.5.4.13","description"),r("2.5.4.15","businessCategory"),r("2.5.4.17","postalCode"),r("2.5.4.42","givenName"),r("2.5.4.65","pseudonym"),r("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),r("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),r("2.16.840.1.113730.1.1","nsCertType"),r("2.16.840.1.113730.1.13","nsComment"),d("2.5.29.1","authorityKeyIdentifier"),d("2.5.29.2","keyAttributes"),d("2.5.29.3","certificatePolicies"),d("2.5.29.4","keyUsageRestriction"),d("2.5.29.5","policyMapping"),d("2.5.29.6","subtreesConstraint"),d("2.5.29.7","subjectAltName"),d("2.5.29.8","issuerAltName"),d("2.5.29.9","subjectDirectoryAttributes"),d("2.5.29.10","basicConstraints"),d("2.5.29.11","nameConstraints"),d("2.5.29.12","policyConstraints"),d("2.5.29.13","basicConstraints"),r("2.5.29.14","subjectKeyIdentifier"),r("2.5.29.15","keyUsage"),d("2.5.29.16","privateKeyUsagePeriod"),r("2.5.29.17","subjectAltName"),r("2.5.29.18","issuerAltName"),r("2.5.29.19","basicConstraints"),d("2.5.29.20","cRLNumber"),d("2.5.29.21","cRLReason"),d("2.5.29.22","expirationDate"),d("2.5.29.23","instructionCode"),d("2.5.29.24","invalidityDate"),d("2.5.29.25","cRLDistributionPoints"),d("2.5.29.26","issuingDistributionPoint"),d("2.5.29.27","deltaCRLIndicator"),d("2.5.29.28","issuingDistributionPoint"),d("2.5.29.29","certificateIssuer"),d("2.5.29.30","nameConstraints"),r("2.5.29.31","cRLDistributionPoints"),r("2.5.29.32","certificatePolicies"),d("2.5.29.33","policyMappings"),d("2.5.29.34","policyConstraints"),r("2.5.29.35","authorityKeyIdentifier"),d("2.5.29.36","policyConstraints"),r("2.5.29.37","extKeyUsage"),d("2.5.29.46","freshestCRL"),d("2.5.29.54","inhibitAnyPolicy"),r("1.3.6.1.4.1.11129.2.4.2","timestampList"),r("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),r("1.3.6.1.5.5.7.3.1","serverAuth"),r("1.3.6.1.5.5.7.3.2","clientAuth"),r("1.3.6.1.5.5.7.3.3","codeSigning"),r("1.3.6.1.5.5.7.3.4","emailProtection"),r("1.3.6.1.5.5.7.3.8","timeStamping"),zt.exports}var qr;function it(){if(qr)return Qt.exports;qr=1;var t=fe();de(),pt();var e=Qt.exports=t.asn1=t.asn1||{};e.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},e.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,BMPSTRING:30},e.maxDepth=256,e.create=function(l,a,y,u,S){if(t.util.isArray(u)){for(var U=[],E=0;E<u.length;++E)u[E]!==void 0&&U.push(u[E]);u=U}var f={tagClass:l,type:a,constructed:y,composed:y||t.util.isArray(u),value:u};return S&&"bitStringContents"in S&&(f.bitStringContents=S.bitStringContents,f.original=e.copy(f)),f},e.copy=function(l,a){var y;if(t.util.isArray(l)){y=[];for(var u=0;u<l.length;++u)y.push(e.copy(l[u],a));return y}return typeof l=="string"?l:(y={tagClass:l.tagClass,type:l.type,constructed:l.constructed,composed:l.composed,value:e.copy(l.value,a)},a&&!a.excludeBitStringContents&&(y.bitStringContents=l.bitStringContents),y)},e.equals=function(l,a,y){if(t.util.isArray(l)){if(!t.util.isArray(a)||l.length!==a.length)return!1;for(var u=0;u<l.length;++u)if(!e.equals(l[u],a[u]))return!1;return!0}if(typeof l!=typeof a)return!1;if(typeof l=="string")return l===a;var S=l.tagClass===a.tagClass&&l.type===a.type&&l.constructed===a.constructed&&l.composed===a.composed&&e.equals(l.value,a.value);return y&&y.includeBitStringContents&&(S=S&&l.bitStringContents===a.bitStringContents),S},e.getBerValueLength=function(l){var a=l.getByte();if(a!==128){var y,u=a&128;return u?y=l.getInt((a&127)<<3):y=a,y}};function r(l,a,y){if(y>a){var u=new Error("Too few bytes to parse DER.");throw u.available=l.length(),u.remaining=a,u.requested=y,u}}var d=function(l,a){var y=l.getByte();if(a--,y!==128){var u,S=y&128;if(!S)u=y;else{var U=y&127;r(l,a,U),u=l.getInt(U<<3)}if(u<0)throw new Error("Negative length: "+u);return u}};e.fromDer=function(l,a){a===void 0&&(a={strict:!0,parseAllBytes:!0,decodeBitStrings:!0}),typeof a=="boolean"&&(a={strict:a,parseAllBytes:!0,decodeBitStrings:!0}),"strict"in a||(a.strict=!0),"parseAllBytes"in a||(a.parseAllBytes=!0),"decodeBitStrings"in a||(a.decodeBitStrings=!0),"maxDepth"in a||(a.maxDepth=e.maxDepth),typeof l=="string"&&(l=t.util.createBuffer(l));var y=l.length(),u=T(l,l.length(),0,a);if(a.parseAllBytes&&l.length()!==0){var S=new Error("Unparsed DER bytes remain after ASN.1 parsing.");throw S.byteCount=y,S.remaining=l.length(),S}return u};function T(l,a,y,u){if(y>=u.maxDepth)throw new Error("ASN.1 parsing error: Max depth exceeded.");var S;r(l,a,2);var U=l.getByte();a--;var E=U&192,f=U&31;S=l.length();var v=d(l,a);if(a-=S-l.length(),v!==void 0&&v>a){if(u.strict){var m=new Error("Too few bytes to read ASN.1 value.");throw m.available=l.length(),m.remaining=a,m.requested=v,m}v=a}var g,s,h=(U&32)===32;if(h)if(g=[],v===void 0)for(;;){if(r(l,a,2),l.bytes(2)==="\0\0"){l.getBytes(2),a-=2;break}S=l.length(),g.push(T(l,a,y+1,u)),a-=S-l.length()}else for(;v>0;)S=l.length(),g.push(T(l,v,y+1,u)),a-=S-l.length(),v-=S-l.length();if(g===void 0&&E===e.Class.UNIVERSAL&&f===e.Type.BITSTRING&&(s=l.bytes(v)),g===void 0&&u.decodeBitStrings&&E===e.Class.UNIVERSAL&&f===e.Type.BITSTRING&&v>1){var p=l.read,A=a,R=0;if(f===e.Type.BITSTRING&&(r(l,a,1),R=l.getByte(),a--),R===0)try{S=l.length();var c={strict:!0,decodeBitStrings:!0},i=T(l,a,y+1,c),n=S-l.length();a-=n,f==e.Type.BITSTRING&&n++;var I=i.tagClass;n===v&&(I===e.Class.UNIVERSAL||I===e.Class.CONTEXT_SPECIFIC)&&(g=[i])}catch{}g===void 0&&(l.read=p,a=A)}if(g===void 0){if(v===void 0){if(u.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");v=a}if(f===e.Type.BMPSTRING)for(g="";v>0;v-=2)r(l,a,2),g+=String.fromCharCode(l.getInt16()),a-=2;else g=l.getBytes(v),a-=v}var k=s===void 0?null:{bitStringContents:s};return e.create(E,f,h,g,k)}e.toDer=function(l){var a=t.util.createBuffer(),y=l.tagClass|l.type,u=t.util.createBuffer(),S=!1;if("bitStringContents"in l&&(S=!0,l.original&&(S=e.equals(l,l.original))),S)u.putBytes(l.bitStringContents);else if(l.composed){l.constructed?y|=32:u.putByte(0);for(var U=0;U<l.value.length;++U)l.value[U]!==void 0&&u.putBuffer(e.toDer(l.value[U]))}else if(l.type===e.Type.BMPSTRING)for(var U=0;U<l.value.length;++U)u.putInt16(l.value.charCodeAt(U));else l.type===e.Type.INTEGER&&l.value.length>1&&(l.value.charCodeAt(0)===0&&(l.value.charCodeAt(1)&128)===0||l.value.charCodeAt(0)===255&&(l.value.charCodeAt(1)&128)===128)?u.putBytes(l.value.substr(1)):u.putBytes(l.value);if(a.putByte(y),u.length()<=127)a.putByte(u.length()&127);else{var E=u.length(),f="";do f+=String.fromCharCode(E&255),E=E>>>8;while(E>0);a.putByte(f.length|128);for(var U=f.length-1;U>=0;--U)a.putByte(f.charCodeAt(U))}return a.putBuffer(u),a},e.oidToDer=function(l){var a=l.split("."),y=t.util.createBuffer();y.putByte(40*parseInt(a[0],10)+parseInt(a[1],10));for(var u,S,U,E,f=2;f<a.length;++f){if(u=!0,S=[],U=parseInt(a[f],10),U>4294967295)throw new Error("OID value too large; max is 32-bits.");do E=U&127,U=U>>>7,u||(E|=128),S.push(E),u=!1;while(U>0);for(var v=S.length-1;v>=0;--v)y.putByte(S[v])}return y},e.derToOid=function(l){var a;typeof l=="string"&&(l=t.util.createBuffer(l));var y=l.getByte();a=Math.floor(y/40)+"."+y%40;for(var u=0;l.length()>0;){if(u>70368744177663)throw new Error("OID value too large; max is 53-bits.");y=l.getByte(),u=u*128,y&128?u+=y&127:(a+="."+(u+y),u=0)}return a},e.utcTimeToDate=function(l){var a=new Date,y=parseInt(l.substr(0,2),10);y=y>=50?1900+y:2e3+y;var u=parseInt(l.substr(2,2),10)-1,S=parseInt(l.substr(4,2),10),U=parseInt(l.substr(6,2),10),E=parseInt(l.substr(8,2),10),f=0;if(l.length>11){var v=l.charAt(10),m=10;v!=="+"&&v!=="-"&&(f=parseInt(l.substr(10,2),10),m+=2)}if(a.setUTCFullYear(y,u,S),a.setUTCHours(U,E,f,0),m&&(v=l.charAt(m),v==="+"||v==="-")){var g=parseInt(l.substr(m+1,2),10),s=parseInt(l.substr(m+4,2),10),h=g*60+s;h*=6e4,v==="+"?a.setTime(+a-h):a.setTime(+a+h)}return a},e.generalizedTimeToDate=function(l){var a=new Date,y=parseInt(l.substr(0,4),10),u=parseInt(l.substr(4,2),10)-1,S=parseInt(l.substr(6,2),10),U=parseInt(l.substr(8,2),10),E=parseInt(l.substr(10,2),10),f=parseInt(l.substr(12,2),10),v=0,m=0,g=!1;l.charAt(l.length-1)==="Z"&&(g=!0);var s=l.length-5,h=l.charAt(s);if(h==="+"||h==="-"){var p=parseInt(l.substr(s+1,2),10),A=parseInt(l.substr(s+4,2),10);m=p*60+A,m*=6e4,h==="+"&&(m*=-1),g=!0}return l.charAt(14)==="."&&(v=parseFloat(l.substr(14),10)*1e3),g?(a.setUTCFullYear(y,u,S),a.setUTCHours(U,E,f,v),a.setTime(+a+m)):(a.setFullYear(y,u,S),a.setHours(U,E,f,v)),a},e.dateToUtcTime=function(l){if(typeof l=="string")return l;var a="",y=[];y.push((""+l.getUTCFullYear()).substr(2)),y.push(""+(l.getUTCMonth()+1)),y.push(""+l.getUTCDate()),y.push(""+l.getUTCHours()),y.push(""+l.getUTCMinutes()),y.push(""+l.getUTCSeconds());for(var u=0;u<y.length;++u)y[u].length<2&&(a+="0"),a+=y[u];return a+="Z",a},e.dateToGeneralizedTime=function(l){if(typeof l=="string")return l;var a="",y=[];y.push(""+l.getUTCFullYear()),y.push(""+(l.getUTCMonth()+1)),y.push(""+l.getUTCDate()),y.push(""+l.getUTCHours()),y.push(""+l.getUTCMinutes()),y.push(""+l.getUTCSeconds());for(var u=0;u<y.length;++u)y[u].length<2&&(a+="0"),a+=y[u];return a+="Z",a},e.integerToDer=function(l){var a=t.util.createBuffer();if(l>=-128&&l<128)return a.putSignedInt(l,8);if(l>=-32768&&l<32768)return a.putSignedInt(l,16);if(l>=-8388608&&l<8388608)return a.putSignedInt(l,24);if(l>=-2147483648&&l<2147483648)return a.putSignedInt(l,32);var y=new Error("Integer too large; max is 32-bits.");throw y.integer=l,y},e.derToInteger=function(l){typeof l=="string"&&(l=t.util.createBuffer(l));var a=l.length()*8;if(a>32)throw new Error("Integer too large; max is 32-bits.");return l.getSignedInt(a)},e.validate=function(l,a,y,u){var S=!1;if((l.tagClass===a.tagClass||typeof a.tagClass>"u")&&(l.type===a.type||typeof a.type>"u"))if(l.constructed===a.constructed||typeof a.constructed>"u"){if(S=!0,a.value&&t.util.isArray(a.value))for(var U=0,E=0;S&&E<a.value.length;++E){var f=a.value[E];S=!!f.optional;var v=l.value[U];if(!v){f.optional||(S=!1,u&&u.push("["+a.name+'] Missing required element. Expected tag class "'+f.tagClass+'", type "'+f.type+'"'));continue}var m=typeof f.tagClass<"u"&&typeof f.type<"u";if(m&&(v.tagClass!==f.tagClass||v.type!==f.type))if(f.optional){S=!0;continue}else{S=!1,u&&u.push("["+a.name+"] Tag mismatch. Expected ("+f.tagClass+","+f.type+"), got ("+v.tagClass+","+v.type+")");break}var g=e.validate(v,f,y,u);if(g)++U,S=!0;else if(f.optional)S=!0;else{S=!1;break}}if(S&&y&&(a.capture&&(y[a.capture]=l.value),a.captureAsn1&&(y[a.captureAsn1]=l),a.captureBitStringContents&&"bitStringContents"in l&&(y[a.captureBitStringContents]=l.bitStringContents),a.captureBitStringValue&&"bitStringContents"in l))if(l.bitStringContents.length<2)y[a.captureBitStringValue]="";else{var s=l.bitStringContents.charCodeAt(0);if(s!==0)throw new Error("captureBitStringValue only supported for zero unused bits");y[a.captureBitStringValue]=l.bitStringContents.slice(1)}}else u&&u.push("["+a.name+'] Expected constructed "'+a.constructed+'", got "'+l.constructed+'"');else u&&(l.tagClass!==a.tagClass&&u.push("["+a.name+'] Expected tag class "'+a.tagClass+'", got "'+l.tagClass+'"'),l.type!==a.type&&u.push("["+a.name+'] Expected type "'+a.type+'", got "'+l.type+'"'));return S};var x=/[^\\u0000-\\u00ff]/;return e.prettyPrint=function(l,a,y){var u="";a=a||0,y=y||2,a>0&&(u+=`
|
|
5
|
+
`);for(var S="",U=0;U<a*y;++U)S+=" ";switch(u+=S+"Tag: ",l.tagClass){case e.Class.UNIVERSAL:u+="Universal:";break;case e.Class.APPLICATION:u+="Application:";break;case e.Class.CONTEXT_SPECIFIC:u+="Context-Specific:";break;case e.Class.PRIVATE:u+="Private:";break}if(l.tagClass===e.Class.UNIVERSAL)switch(u+=l.type,l.type){case e.Type.NONE:u+=" (None)";break;case e.Type.BOOLEAN:u+=" (Boolean)";break;case e.Type.INTEGER:u+=" (Integer)";break;case e.Type.BITSTRING:u+=" (Bit string)";break;case e.Type.OCTETSTRING:u+=" (Octet string)";break;case e.Type.NULL:u+=" (Null)";break;case e.Type.OID:u+=" (Object Identifier)";break;case e.Type.ODESC:u+=" (Object Descriptor)";break;case e.Type.EXTERNAL:u+=" (External or Instance of)";break;case e.Type.REAL:u+=" (Real)";break;case e.Type.ENUMERATED:u+=" (Enumerated)";break;case e.Type.EMBEDDED:u+=" (Embedded PDV)";break;case e.Type.UTF8:u+=" (UTF8)";break;case e.Type.ROID:u+=" (Relative Object Identifier)";break;case e.Type.SEQUENCE:u+=" (Sequence)";break;case e.Type.SET:u+=" (Set)";break;case e.Type.PRINTABLESTRING:u+=" (Printable String)";break;case e.Type.IA5String:u+=" (IA5String (ASCII))";break;case e.Type.UTCTIME:u+=" (UTC time)";break;case e.Type.GENERALIZEDTIME:u+=" (Generalized time)";break;case e.Type.BMPSTRING:u+=" (BMP String)";break}else u+=l.type;if(u+=`
|
|
6
|
+
`,u+=S+"Constructed: "+l.constructed+`
|
|
7
|
+
`,l.composed){for(var E=0,f="",U=0;U<l.value.length;++U)l.value[U]!==void 0&&(E+=1,f+=e.prettyPrint(l.value[U],a+1,y),U+1<l.value.length&&(f+=","));u+=S+"Sub values: "+E+f}else{if(u+=S+"Value: ",l.type===e.Type.OID){var v=e.derToOid(l.value);u+=v,t.pki&&t.pki.oids&&v in t.pki.oids&&(u+=" ("+t.pki.oids[v]+") ")}if(l.type===e.Type.INTEGER)try{u+=e.derToInteger(l.value)}catch{u+="0x"+t.util.bytesToHex(l.value)}else if(l.type===e.Type.BITSTRING){if(l.value.length>1?u+="0x"+t.util.bytesToHex(l.value.slice(1)):u+="(none)",l.value.length>0){var m=l.value.charCodeAt(0);m==1?u+=" (1 unused bit shown)":m>1&&(u+=" ("+m+" unused bits shown)")}}else if(l.type===e.Type.OCTETSTRING)x.test(l.value)||(u+="("+l.value+") "),u+="0x"+t.util.bytesToHex(l.value);else if(l.type===e.Type.UTF8)try{u+=t.util.decodeUtf8(l.value)}catch(g){if(g.message==="URI malformed")u+="0x"+t.util.bytesToHex(l.value)+" (malformed UTF8)";else throw g}else l.type===e.Type.PRINTABLESTRING||l.type===e.Type.IA5String?u+=l.value:x.test(l.value)?u+="0x"+t.util.bytesToHex(l.value):l.value.length===0?u+="[null]":u+=l.value}return u},Qt.exports}var Yt={exports:{}},Xt,Hr;function ft(){if(Hr)return Xt;Hr=1;var t=fe();return Xt=t.md=t.md||{},t.md.algorithms=t.md.algorithms||{},Xt}var Gr;function xt(){if(Gr)return Yt.exports;Gr=1;var t=fe();ft(),de();var e=Yt.exports=t.hmac=t.hmac||{};return e.create=function(){var r=null,d=null,T=null,x=null,l={};return l.start=function(a,y){if(a!==null)if(typeof a=="string")if(a=a.toLowerCase(),a in t.md.algorithms)d=t.md.algorithms[a].create();else throw new Error('Unknown hash algorithm "'+a+'"');else d=a;if(y===null)y=r;else{if(typeof y=="string")y=t.util.createBuffer(y);else if(t.util.isArray(y)){var u=y;y=t.util.createBuffer();for(var S=0;S<u.length;++S)y.putByte(u[S])}var U=y.length();U>d.blockLength&&(d.start(),d.update(y.bytes()),y=d.digest()),T=t.util.createBuffer(),x=t.util.createBuffer(),U=y.length();for(var S=0;S<U;++S){var u=y.at(S);T.putByte(54^u),x.putByte(92^u)}if(U<d.blockLength)for(var u=d.blockLength-U,S=0;S<u;++S)T.putByte(54),x.putByte(92);r=y,T=T.bytes(),x=x.bytes()}d.start(),d.update(T)},l.update=function(a){d.update(a)},l.getMac=function(){var a=d.digest().bytes();return d.start(),d.update(x),d.update(a),d.digest()},l.digest=l.getMac,l},Yt.exports}var Wt={exports:{}},Qr;function Nr(){if(Qr)return Wt.exports;Qr=1;var t=fe();ft(),de();var e=Wt.exports=t.md5=t.md5||{};t.md.md5=t.md.algorithms.md5=e,e.create=function(){l||a();var u=null,S=t.util.createBuffer(),U=new Array(16),E={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8};return E.start=function(){E.messageLength=0,E.fullMessageLength=E.messageLength64=[];for(var f=E.messageLengthSize/4,v=0;v<f;++v)E.fullMessageLength.push(0);return S=t.util.createBuffer(),u={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878},E},E.start(),E.update=function(f,v){v==="utf8"&&(f=t.util.encodeUtf8(f));var m=f.length;E.messageLength+=m,m=[m/4294967296>>>0,m>>>0];for(var g=E.fullMessageLength.length-1;g>=0;--g)E.fullMessageLength[g]+=m[1],m[1]=m[0]+(E.fullMessageLength[g]/4294967296>>>0),E.fullMessageLength[g]=E.fullMessageLength[g]>>>0,m[0]=m[1]/4294967296>>>0;return S.putBytes(f),y(u,U,S),(S.read>2048||S.length()===0)&&S.compact(),E},E.digest=function(){var f=t.util.createBuffer();f.putBytes(S.bytes());var v=E.fullMessageLength[E.fullMessageLength.length-1]+E.messageLengthSize,m=v&E.blockLength-1;f.putBytes(r.substr(0,E.blockLength-m));for(var g,s=0,h=E.fullMessageLength.length-1;h>=0;--h)g=E.fullMessageLength[h]*8+s,s=g/4294967296>>>0,f.putInt32Le(g>>>0);var p={h0:u.h0,h1:u.h1,h2:u.h2,h3:u.h3};y(p,U,f);var A=t.util.createBuffer();return A.putInt32Le(p.h0),A.putInt32Le(p.h1),A.putInt32Le(p.h2),A.putInt32Le(p.h3),A},E};var r=null,d=null,T=null,x=null,l=!1;function a(){r="",r+=t.util.fillString("\0",64),d=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,2,9],T=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21],x=new Array(64);for(var u=0;u<64;++u)x[u]=Math.floor(Math.abs(Math.sin(u+1))*4294967296);l=!0}function y(u,S,U){for(var E,f,v,m,g,s,h,p,A=U.length();A>=64;){for(f=u.h0,v=u.h1,m=u.h2,g=u.h3,p=0;p<16;++p)S[p]=U.getInt32Le(),s=g^v&(m^g),E=f+s+x[p]+S[p],h=T[p],f=g,g=m,m=v,v+=E<<h|E>>>32-h;for(;p<32;++p)s=m^g&(v^m),E=f+s+x[p]+S[d[p]],h=T[p],f=g,g=m,m=v,v+=E<<h|E>>>32-h;for(;p<48;++p)s=v^m^g,E=f+s+x[p]+S[d[p]],h=T[p],f=g,g=m,m=v,v+=E<<h|E>>>32-h;for(;p<64;++p)s=m^(v|~g),E=f+s+x[p]+S[d[p]],h=T[p],f=g,g=m,m=v,v+=E<<h|E>>>32-h;u.h0=u.h0+f|0,u.h1=u.h1+v|0,u.h2=u.h2+m|0,u.h3=u.h3+g|0,A-=64}}return Wt.exports}var jt={exports:{}},zr;function mt(){if(zr)return jt.exports;zr=1;var t=fe();de();var e=jt.exports=t.pem=t.pem||{};e.encode=function(T,x){x=x||{};var l="-----BEGIN "+T.type+`-----\r
|
|
8
|
+
`,a;if(T.procType&&(a={name:"Proc-Type",values:[String(T.procType.version),T.procType.type]},l+=r(a)),T.contentDomain&&(a={name:"Content-Domain",values:[T.contentDomain]},l+=r(a)),T.dekInfo&&(a={name:"DEK-Info",values:[T.dekInfo.algorithm]},T.dekInfo.parameters&&a.values.push(T.dekInfo.parameters),l+=r(a)),T.headers)for(var y=0;y<T.headers.length;++y)l+=r(T.headers[y]);return T.procType&&(l+=`\r
|
|
9
|
+
`),l+=t.util.encode64(T.body,x.maxline||64)+`\r
|
|
10
|
+
`,l+="-----END "+T.type+`-----\r
|
|
11
|
+
`,l},e.decode=function(T){for(var x=[],l=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,a=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,y=/\r?\n/,u;u=l.exec(T),!!u;){var S=u[1];S==="NEW CERTIFICATE REQUEST"&&(S="CERTIFICATE REQUEST");var U={type:S,procType:null,contentDomain:null,dekInfo:null,headers:[],body:t.util.decode64(u[3])};if(x.push(U),!!u[2]){for(var E=u[2].split(y),f=0;u&&f<E.length;){for(var v=E[f].replace(/\s+$/,""),m=f+1;m<E.length;++m){var g=E[m];if(!/\s/.test(g[0]))break;v+=g,f=m}if(u=v.match(a),u){for(var s={name:u[1],values:[]},h=u[2].split(","),p=0;p<h.length;++p)s.values.push(d(h[p]));if(U.procType)if(!U.contentDomain&&s.name==="Content-Domain")U.contentDomain=h[0]||"";else if(!U.dekInfo&&s.name==="DEK-Info"){if(s.values.length===0)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');U.dekInfo={algorithm:h[0],parameters:h[1]||null}}else U.headers.push(s);else{if(s.name!=="Proc-Type")throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(s.values.length!==2)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');U.procType={version:h[0],type:h[1]}}}++f}if(U.procType==="ENCRYPTED"&&!U.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(x.length===0)throw new Error("Invalid PEM formatted message.");return x};function r(T){for(var x=T.name+": ",l=[],a=function(E,f){return" "+f},y=0;y<T.values.length;++y)l.push(T.values[y].replace(/^(\S+\r\n)/,a));x+=l.join(",")+`\r
|
|
12
|
+
`;for(var u=0,S=-1,y=0;y<x.length;++y,++u)if(u>65&&S!==-1){var U=x[S];U===","?(++S,x=x.substr(0,S)+`\r
|
|
13
|
+
`+x.substr(S)):x=x.substr(0,S)+`\r
|
|
14
|
+
`+U+x.substr(S+1),u=y-S-1,S=-1,++y}else(x[y]===" "||x[y]===" "||x[y]===",")&&(S=y);return x}function d(T){return T.replace(/^\s+/,"")}return jt.exports}var Zt={exports:{}},$t,Yr;function Lt(){if(Yr)return $t;Yr=1;var t=fe();_r(),wa(),de(),$t=t.des=t.des||{},t.des.startEncrypting=function(f,v,m,g){var s=E({key:f,output:m,decrypt:!1,mode:g||(v===null?"ECB":"CBC")});return s.start(v),s},t.des.createEncryptionCipher=function(f,v){return E({key:f,output:null,decrypt:!1,mode:v})},t.des.startDecrypting=function(f,v,m,g){var s=E({key:f,output:m,decrypt:!0,mode:g||(v===null?"ECB":"CBC")});return s.start(v),s},t.des.createDecryptionCipher=function(f,v){return E({key:f,output:null,decrypt:!0,mode:v})},t.des.Algorithm=function(f,v){var m=this;m.name=f,m.mode=new v({blockSize:8,cipher:{encrypt:function(g,s){return U(m._keys,g,s,!1)},decrypt:function(g,s){return U(m._keys,g,s,!0)}}}),m._init=!1},t.des.Algorithm.prototype.initialize=function(f){if(!this._init){var v=t.util.createBuffer(f.key);if(this.name.indexOf("3DES")===0&&v.length()!==24)throw new Error("Invalid Triple-DES key size: "+v.length()*8);this._keys=S(v),this._init=!0}},e("DES-ECB",t.cipher.modes.ecb),e("DES-CBC",t.cipher.modes.cbc),e("DES-CFB",t.cipher.modes.cfb),e("DES-OFB",t.cipher.modes.ofb),e("DES-CTR",t.cipher.modes.ctr),e("3DES-ECB",t.cipher.modes.ecb),e("3DES-CBC",t.cipher.modes.cbc),e("3DES-CFB",t.cipher.modes.cfb),e("3DES-OFB",t.cipher.modes.ofb),e("3DES-CTR",t.cipher.modes.ctr);function e(f,v){var m=function(){return new t.des.Algorithm(f,v)};t.cipher.registerAlgorithm(f,m)}var r=[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],d=[-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],T=[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],x=[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],l=[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],a=[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],y=[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],u=[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 S(f){for(var v=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],m=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],g=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],s=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],h=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],p=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],A=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],R=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],c=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],i=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],n=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],I=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],k=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],O=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],P=f.length()>8?3:1,K=[],q=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],M=0,G,Y=0;Y<P;Y++){var W=f.getInt32(),ee=f.getInt32();G=(W>>>4^ee)&252645135,ee^=G,W^=G<<4,G=(ee>>>-16^W)&65535,W^=G,ee^=G<<-16,G=(W>>>2^ee)&858993459,ee^=G,W^=G<<2,G=(ee>>>-16^W)&65535,W^=G,ee^=G<<-16,G=(W>>>1^ee)&1431655765,ee^=G,W^=G<<1,G=(ee>>>8^W)&16711935,W^=G,ee^=G<<8,G=(W>>>1^ee)&1431655765,ee^=G,W^=G<<1,G=W<<8|ee>>>20&240,W=ee<<24|ee<<8&16711680|ee>>>8&65280|ee>>>24&240,ee=G;for(var ne=0;ne<q.length;++ne){q[ne]?(W=W<<2|W>>>26,ee=ee<<2|ee>>>26):(W=W<<1|W>>>27,ee=ee<<1|ee>>>27),W&=-15,ee&=-15;var ie=v[W>>>28]|m[W>>>24&15]|g[W>>>20&15]|s[W>>>16&15]|h[W>>>12&15]|p[W>>>8&15]|A[W>>>4&15],ce=R[ee>>>28]|c[ee>>>24&15]|i[ee>>>20&15]|n[ee>>>16&15]|I[ee>>>12&15]|k[ee>>>8&15]|O[ee>>>4&15];G=(ce>>>16^ie)&65535,K[M++]=ie^G,K[M++]=ce^G<<16}}return K}function U(f,v,m,g){var s=f.length===32?3:9,h;s===3?h=g?[30,-2,-2]:[0,32,2]:h=g?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var p,A=v[0],R=v[1];p=(A>>>4^R)&252645135,R^=p,A^=p<<4,p=(A>>>16^R)&65535,R^=p,A^=p<<16,p=(R>>>2^A)&858993459,A^=p,R^=p<<2,p=(R>>>8^A)&16711935,A^=p,R^=p<<8,p=(A>>>1^R)&1431655765,R^=p,A^=p<<1,A=A<<1|A>>>31,R=R<<1|R>>>31;for(var c=0;c<s;c+=3){for(var i=h[c+1],n=h[c+2],I=h[c];I!=i;I+=n){var k=R^f[I],O=(R>>>4|R<<28)^f[I+1];p=A,A=R,R=p^(d[k>>>24&63]|x[k>>>16&63]|a[k>>>8&63]|u[k&63]|r[O>>>24&63]|T[O>>>16&63]|l[O>>>8&63]|y[O&63])}p=A,A=R,R=p}A=A>>>1|A<<31,R=R>>>1|R<<31,p=(A>>>1^R)&1431655765,R^=p,A^=p<<1,p=(R>>>8^A)&16711935,A^=p,R^=p<<8,p=(R>>>2^A)&858993459,A^=p,R^=p<<2,p=(A>>>16^R)&65535,R^=p,A^=p<<16,p=(A>>>4^R)&252645135,R^=p,A^=p<<4,m[0]=A,m[1]=R}function E(f){f=f||{};var v=(f.mode||"CBC").toUpperCase(),m="DES-"+v,g;f.decrypt?g=t.cipher.createDecipher(m,f.key):g=t.cipher.createCipher(m,f.key);var s=g.start;return g.start=function(h,p){var A=null;p instanceof t.util.ByteBuffer&&(A=p,p={}),p=p||{},p.output=A,p.iv=h,s.call(g,p)},g}return $t}const xn={},Sn=Object.freeze(Object.defineProperty({__proto__:null,default:xn},Symbol.toStringTag,{value:"Module"})),wr=Cn(Sn);var Jt,Xr;function Rr(){if(Xr)return Jt;Xr=1;var t=fe();xt(),ft(),de();var e=t.pkcs5=t.pkcs5||{},r;return t.util.isNodejs&&!t.options.usePureJavaScript&&(r=wr),Jt=t.pbkdf2=e.pbkdf2=function(d,T,x,l,a,y){if(typeof a=="function"&&(y=a,a=null),t.util.isNodejs&&!t.options.usePureJavaScript&&r.pbkdf2&&(a===null||typeof a!="object")&&(r.pbkdf2Sync.length>4||!a||a==="sha1"))return typeof a!="string"&&(a="sha1"),d=Buffer.from(d,"binary"),T=Buffer.from(T,"binary"),y?r.pbkdf2Sync.length===4?r.pbkdf2(d,T,x,l,function(c,i){if(c)return y(c);y(null,i.toString("binary"))}):r.pbkdf2(d,T,x,l,a,function(c,i){if(c)return y(c);y(null,i.toString("binary"))}):r.pbkdf2Sync.length===4?r.pbkdf2Sync(d,T,x,l).toString("binary"):r.pbkdf2Sync(d,T,x,l,a).toString("binary");if((typeof a>"u"||a===null)&&(a="sha1"),typeof a=="string"){if(!(a in t.md.algorithms))throw new Error("Unknown hash algorithm: "+a);a=t.md[a].create()}var u=a.digestLength;if(l>4294967295*u){var S=new Error("Derived key is too long.");if(y)return y(S);throw S}var U=Math.ceil(l/u),E=l-(U-1)*u,f=t.hmac.create();f.start(a,d);var v="",m,g,s;if(!y){for(var h=1;h<=U;++h){f.start(null,null),f.update(T),f.update(t.util.int32ToBytes(h)),m=s=f.digest().getBytes();for(var p=2;p<=x;++p)f.start(null,null),f.update(s),g=f.digest().getBytes(),m=t.util.xorBytes(m,g,u),s=g;v+=h<U?m:m.substr(0,E)}return v}var h=1,p;function A(){if(h>U)return y(null,v);f.start(null,null),f.update(T),f.update(t.util.int32ToBytes(h)),m=s=f.digest().getBytes(),p=2,R()}function R(){if(p<=x)return f.start(null,null),f.update(s),g=f.digest().getBytes(),m=t.util.xorBytes(m,g,u),s=g,++p,t.util.setImmediate(R);v+=h<U?m:m.substr(0,E),++h,A()}A()},Jt}var It={exports:{}},er={exports:{}},Wr;function Ra(){if(Wr)return er.exports;Wr=1;var t=fe();ft(),de();var e=er.exports=t.sha256=t.sha256||{};t.md.sha256=t.md.algorithms.sha256=e,e.create=function(){d||x();var a=null,y=t.util.createBuffer(),u=new Array(64),S={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8};return S.start=function(){S.messageLength=0,S.fullMessageLength=S.messageLength64=[];for(var U=S.messageLengthSize/4,E=0;E<U;++E)S.fullMessageLength.push(0);return y=t.util.createBuffer(),a={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},S},S.start(),S.update=function(U,E){E==="utf8"&&(U=t.util.encodeUtf8(U));var f=U.length;S.messageLength+=f,f=[f/4294967296>>>0,f>>>0];for(var v=S.fullMessageLength.length-1;v>=0;--v)S.fullMessageLength[v]+=f[1],f[1]=f[0]+(S.fullMessageLength[v]/4294967296>>>0),S.fullMessageLength[v]=S.fullMessageLength[v]>>>0,f[0]=f[1]/4294967296>>>0;return y.putBytes(U),l(a,u,y),(y.read>2048||y.length()===0)&&y.compact(),S},S.digest=function(){var U=t.util.createBuffer();U.putBytes(y.bytes());var E=S.fullMessageLength[S.fullMessageLength.length-1]+S.messageLengthSize,f=E&S.blockLength-1;U.putBytes(r.substr(0,S.blockLength-f));for(var v,m,g=S.fullMessageLength[0]*8,s=0;s<S.fullMessageLength.length-1;++s)v=S.fullMessageLength[s+1]*8,m=v/4294967296>>>0,g+=m,U.putInt32(g>>>0),g=v>>>0;U.putInt32(g);var h={h0:a.h0,h1:a.h1,h2:a.h2,h3:a.h3,h4:a.h4,h5:a.h5,h6:a.h6,h7:a.h7};l(h,u,U);var p=t.util.createBuffer();return p.putInt32(h.h0),p.putInt32(h.h1),p.putInt32(h.h2),p.putInt32(h.h3),p.putInt32(h.h4),p.putInt32(h.h5),p.putInt32(h.h6),p.putInt32(h.h7),p},S};var r=null,d=!1,T=null;function x(){r="",r+=t.util.fillString("\0",64),T=[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],d=!0}function l(a,y,u){for(var S,U,E,f,v,m,g,s,h,p,A,R,c,i,n,I=u.length();I>=64;){for(g=0;g<16;++g)y[g]=u.getInt32();for(;g<64;++g)S=y[g-2],S=(S>>>17|S<<15)^(S>>>19|S<<13)^S>>>10,U=y[g-15],U=(U>>>7|U<<25)^(U>>>18|U<<14)^U>>>3,y[g]=S+y[g-7]+U+y[g-16]|0;for(s=a.h0,h=a.h1,p=a.h2,A=a.h3,R=a.h4,c=a.h5,i=a.h6,n=a.h7,g=0;g<64;++g)f=(R>>>6|R<<26)^(R>>>11|R<<21)^(R>>>25|R<<7),v=i^R&(c^i),E=(s>>>2|s<<30)^(s>>>13|s<<19)^(s>>>22|s<<10),m=s&h|p&(s^h),S=n+f+v+T[g]+y[g],U=E+m,n=i,i=c,c=R,R=A+S>>>0,A=p,p=h,h=s,s=S+U>>>0;a.h0=a.h0+s|0,a.h1=a.h1+h|0,a.h2=a.h2+p|0,a.h3=a.h3+A|0,a.h4=a.h4+R|0,a.h5=a.h5+c|0,a.h6=a.h6+i|0,a.h7=a.h7+n|0,I-=64}}return er.exports}var tr={exports:{}},jr;function La(){if(jr)return tr.exports;jr=1;var t=fe();de();var e=null;t.util.isNodejs&&!t.options.usePureJavaScript&&!process.versions["node-webkit"]&&(e=wr);var r=tr.exports=t.prng=t.prng||{};return r.create=function(d){for(var T={plugin:d,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},x=d.md,l=new Array(32),a=0;a<32;++a)l[a]=x.create();T.pools=l,T.pool=0,T.generate=function(E,f){if(!f)return T.generateSync(E);var v=T.plugin.cipher,m=T.plugin.increment,g=T.plugin.formatKey,s=T.plugin.formatSeed,h=t.util.createBuffer();T.key=null,p();function p(A){if(A)return f(A);if(h.length()>=E)return f(null,h.getBytes(E));if(T.generated>1048575&&(T.key=null),T.key===null)return t.util.nextTick(function(){y(p)});var R=v(T.key,T.seed);T.generated+=R.length,h.putBytes(R),T.key=g(v(T.key,m(T.seed))),T.seed=s(v(T.key,T.seed)),t.util.setImmediate(p)}},T.generateSync=function(E){var f=T.plugin.cipher,v=T.plugin.increment,m=T.plugin.formatKey,g=T.plugin.formatSeed;T.key=null;for(var s=t.util.createBuffer();s.length()<E;){T.generated>1048575&&(T.key=null),T.key===null&&u();var h=f(T.key,T.seed);T.generated+=h.length,s.putBytes(h),T.key=m(f(T.key,v(T.seed))),T.seed=g(f(T.key,T.seed))}return s.getBytes(E)};function y(E){if(T.pools[0].messageLength>=32)return S(),E();var f=32-T.pools[0].messageLength<<5;T.seedFile(f,function(v,m){if(v)return E(v);T.collect(m),S(),E()})}function u(){if(T.pools[0].messageLength>=32)return S();var E=32-T.pools[0].messageLength<<5;T.collect(T.seedFileSync(E)),S()}function S(){T.reseeds=T.reseeds===4294967295?0:T.reseeds+1;var E=T.plugin.md.create();E.update(T.keyBytes);for(var f=1,v=0;v<32;++v)T.reseeds%f===0&&(E.update(T.pools[v].digest().getBytes()),T.pools[v].start()),f=f<<1;T.keyBytes=E.digest().getBytes(),E.start(),E.update(T.keyBytes);var m=E.digest().getBytes();T.key=T.plugin.formatKey(T.keyBytes),T.seed=T.plugin.formatSeed(m),T.generated=0}function U(E){var f=null,v=t.util.globalScope,m=v.crypto||v.msCrypto;m&&m.getRandomValues&&(f=function(n){return m.getRandomValues(n)});var g=t.util.createBuffer();if(f)for(;g.length()<E;){var s=Math.max(1,Math.min(E-g.length(),65536)/4),h=new Uint32Array(Math.floor(s));try{f(h);for(var p=0;p<h.length;++p)g.putInt32(h[p])}catch(n){if(!(typeof QuotaExceededError<"u"&&n instanceof QuotaExceededError))throw n}}if(g.length()<E)for(var A,R,c,i=Math.floor(Math.random()*65536);g.length()<E;){R=16807*(i&65535),A=16807*(i>>16),R+=(A&32767)<<16,R+=A>>15,R=(R&2147483647)+(R>>31),i=R&4294967295;for(var p=0;p<3;++p)c=i>>>(p<<3),c^=Math.floor(Math.random()*256),g.putByte(c&255)}return g.getBytes(E)}return e?(T.seedFile=function(E,f){e.randomBytes(E,function(v,m){if(v)return f(v);f(null,m.toString())})},T.seedFileSync=function(E){return e.randomBytes(E).toString()}):(T.seedFile=function(E,f){try{f(null,U(E))}catch(v){f(v)}},T.seedFileSync=U),T.collect=function(E){for(var f=E.length,v=0;v<f;++v)T.pools[T.pool].update(E.substr(v,1)),T.pool=T.pool===31?0:T.pool+1},T.collectInt=function(E,f){for(var v="",m=0;m<f;m+=8)v+=String.fromCharCode(E>>m&255);T.collect(v)},T.registerWorker=function(E){if(E===self)T.seedFile=function(v,m){function g(s){var h=s.data;h.forge&&h.forge.prng&&(self.removeEventListener("message",g),m(h.forge.prng.err,h.forge.prng.bytes))}self.addEventListener("message",g),self.postMessage({forge:{prng:{needed:v}}})};else{var f=function(v){var m=v.data;m.forge&&m.forge.prng&&T.seedFile(m.forge.prng.needed,function(g,s){E.postMessage({forge:{prng:{err:g,bytes:s}}})})};E.addEventListener("message",f)}},T},tr.exports}var Zr;function at(){if(Zr)return It.exports;Zr=1;var t=fe();return ht(),Ra(),La(),de(),(function(){if(t.random&&t.random.getBytes){It.exports=t.random;return}(function(e){var r={},d=new Array(4),T=t.util.createBuffer();r.formatKey=function(E){var f=t.util.createBuffer(E);return E=new Array(4),E[0]=f.getInt32(),E[1]=f.getInt32(),E[2]=f.getInt32(),E[3]=f.getInt32(),t.aes._expandKey(E,!1)},r.formatSeed=function(E){var f=t.util.createBuffer(E);return E=new Array(4),E[0]=f.getInt32(),E[1]=f.getInt32(),E[2]=f.getInt32(),E[3]=f.getInt32(),E},r.cipher=function(E,f){return t.aes._updateBlock(E,f,d,!1),T.putInt32(d[0]),T.putInt32(d[1]),T.putInt32(d[2]),T.putInt32(d[3]),T.getBytes()},r.increment=function(E){return++E[3],E},r.md=t.md.sha256;function x(){var E=t.prng.create(r);return E.getBytes=function(f,v){return E.generate(f,v)},E.getBytesSync=function(f){return E.generate(f)},E}var l=x(),a=null,y=t.util.globalScope,u=y.crypto||y.msCrypto;if(u&&u.getRandomValues&&(a=function(E){return u.getRandomValues(E)}),t.options.usePureJavaScript||!t.util.isNodejs&&!a){if(l.collectInt(+new Date,32),typeof navigator<"u"){var S="";for(var U in navigator)try{typeof navigator[U]=="string"&&(S+=navigator[U])}catch{}l.collect(S),S=null}e&&(e().mousemove(function(E){l.collectInt(E.clientX,16),l.collectInt(E.clientY,16)}),e().keypress(function(E){l.collectInt(E.charCode,8)}))}if(!t.random)t.random=l;else for(var U in l)t.random[U]=l[U];t.random.createInstance=x,It.exports=t.random})(typeof jQuery<"u"?jQuery:null)})(),It.exports}var rr,$r;function ka(){if($r)return rr;$r=1;var t=fe();de();var e=[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],r=[1,2,3,5],d=function(l,a){return l<<a&65535|(l&65535)>>16-a},T=function(l,a){return(l&65535)>>a|l<<16-a&65535};rr=t.rc2=t.rc2||{},t.rc2.expandKey=function(l,a){typeof l=="string"&&(l=t.util.createBuffer(l)),a=a||128;var y=l,u=l.length(),S=a,U=Math.ceil(S/8),E=255>>(S&7),f;for(f=u;f<128;f++)y.putByte(e[y.at(f-1)+y.at(f-u)&255]);for(y.setAt(128-U,e[y.at(128-U)&E]),f=127-U;f>=0;f--)y.setAt(f,e[y.at(f+1)^y.at(f+U)]);return y};var x=function(l,a,y){var u=!1,S=null,U=null,E=null,f,v,m,g,s=[];for(l=t.rc2.expandKey(l,a),m=0;m<64;m++)s.push(l.getInt16Le());y?(f=function(A){for(m=0;m<4;m++)A[m]+=s[g]+(A[(m+3)%4]&A[(m+2)%4])+(~A[(m+3)%4]&A[(m+1)%4]),A[m]=d(A[m],r[m]),g++},v=function(A){for(m=0;m<4;m++)A[m]+=s[A[(m+3)%4]&63]}):(f=function(A){for(m=3;m>=0;m--)A[m]=T(A[m],r[m]),A[m]-=s[g]+(A[(m+3)%4]&A[(m+2)%4])+(~A[(m+3)%4]&A[(m+1)%4]),g--},v=function(A){for(m=3;m>=0;m--)A[m]-=s[A[(m+3)%4]&63]});var h=function(A){var R=[];for(m=0;m<4;m++){var c=S.getInt16Le();E!==null&&(y?c^=E.getInt16Le():E.putInt16Le(c)),R.push(c&65535)}g=y?0:63;for(var i=0;i<A.length;i++)for(var n=0;n<A[i][0];n++)A[i][1](R);for(m=0;m<4;m++)E!==null&&(y?E.putInt16Le(R[m]):R[m]^=E.getInt16Le()),U.putInt16Le(R[m])},p=null;return p={start:function(A,R){A&&typeof A=="string"&&(A=t.util.createBuffer(A)),u=!1,S=t.util.createBuffer(),U=R||new t.util.createBuffer,E=A,p.output=U},update:function(A){for(u||S.putBuffer(A);S.length()>=8;)h([[5,f],[1,v],[6,f],[1,v],[5,f]])},finish:function(A){var R=!0;if(y)if(A)R=A(8,S,!y);else{var c=S.length()===8?8:8-S.length();S.fillWithByte(c,c)}if(R&&(u=!0,p.update()),!y&&(R=S.length()===0,R))if(A)R=A(8,U,!y);else{var i=U.length(),n=U.at(i-1);n>i?R=!1:U.truncate(n)}return R}},p};return t.rc2.startEncrypting=function(l,a,y){var u=t.rc2.createEncryptionCipher(l,128);return u.start(a,y),u},t.rc2.createEncryptionCipher=function(l,a){return x(l,a,!0)},t.rc2.startDecrypting=function(l,a,y){var u=t.rc2.createDecryptionCipher(l,128);return u.start(a,y),u},t.rc2.createDecryptionCipher=function(l,a){return x(l,a,!1)},rr}var ar,Jr;function kt(){if(Jr)return ar;Jr=1;var t=fe();ar=t.jsbn=t.jsbn||{};var e;function r(b,B,D){this.data=[],b!=null&&(typeof b=="number"?this.fromNumber(b,B,D):B==null&&typeof b!="string"?this.fromString(b,256):this.fromString(b,B))}t.jsbn.BigInteger=r;function d(){return new r(null)}function T(b,B,D,F,z,X){for(;--X>=0;){var re=B*this.data[b++]+D.data[F]+z;z=Math.floor(re/67108864),D.data[F++]=re&67108863}return z}function x(b,B,D,F,z,X){for(var re=B&32767,J=B>>15;--X>=0;){var he=this.data[b]&32767,Fe=this.data[b++]>>15,$e=J*he+Fe*re;he=re*he+(($e&32767)<<15)+D.data[F]+(z&1073741823),z=(he>>>30)+($e>>>15)+J*Fe+(z>>>30),D.data[F++]=he&1073741823}return z}function l(b,B,D,F,z,X){for(var re=B&16383,J=B>>14;--X>=0;){var he=this.data[b]&16383,Fe=this.data[b++]>>14,$e=J*he+Fe*re;he=re*he+(($e&16383)<<14)+D.data[F]+z,z=(he>>28)+($e>>14)+J*Fe,D.data[F++]=he&268435455}return z}typeof navigator>"u"?(r.prototype.am=l,e=28):navigator.appName=="Microsoft Internet Explorer"?(r.prototype.am=x,e=30):navigator.appName!="Netscape"?(r.prototype.am=T,e=26):(r.prototype.am=l,e=28),r.prototype.DB=e,r.prototype.DM=(1<<e)-1,r.prototype.DV=1<<e;var a=52;r.prototype.FV=Math.pow(2,a),r.prototype.F1=a-e,r.prototype.F2=2*e-a;var y="0123456789abcdefghijklmnopqrstuvwxyz",u=new Array,S,U;for(S=48,U=0;U<=9;++U)u[S++]=U;for(S=97,U=10;U<36;++U)u[S++]=U;for(S=65,U=10;U<36;++U)u[S++]=U;function E(b){return y.charAt(b)}function f(b,B){var D=u[b.charCodeAt(B)];return D??-1}function v(b){for(var B=this.t-1;B>=0;--B)b.data[B]=this.data[B];b.t=this.t,b.s=this.s}function m(b){this.t=1,this.s=b<0?-1:0,b>0?this.data[0]=b:b<-1?this.data[0]=b+this.DV:this.t=0}function g(b){var B=d();return B.fromInt(b),B}function s(b,B){var D;if(B==16)D=4;else if(B==8)D=3;else if(B==256)D=8;else if(B==2)D=1;else if(B==32)D=5;else if(B==4)D=2;else{this.fromRadix(b,B);return}this.t=0,this.s=0;for(var F=b.length,z=!1,X=0;--F>=0;){var re=D==8?b[F]&255:f(b,F);if(re<0){b.charAt(F)=="-"&&(z=!0);continue}z=!1,X==0?this.data[this.t++]=re:X+D>this.DB?(this.data[this.t-1]|=(re&(1<<this.DB-X)-1)<<X,this.data[this.t++]=re>>this.DB-X):this.data[this.t-1]|=re<<X,X+=D,X>=this.DB&&(X-=this.DB)}D==8&&(b[0]&128)!=0&&(this.s=-1,X>0&&(this.data[this.t-1]|=(1<<this.DB-X)-1<<X)),this.clamp(),z&&r.ZERO.subTo(this,this)}function h(){for(var b=this.s&this.DM;this.t>0&&this.data[this.t-1]==b;)--this.t}function p(b){if(this.s<0)return"-"+this.negate().toString(b);var B;if(b==16)B=4;else if(b==8)B=3;else if(b==2)B=1;else if(b==32)B=5;else if(b==4)B=2;else return this.toRadix(b);var D=(1<<B)-1,F,z=!1,X="",re=this.t,J=this.DB-re*this.DB%B;if(re-- >0)for(J<this.DB&&(F=this.data[re]>>J)>0&&(z=!0,X=E(F));re>=0;)J<B?(F=(this.data[re]&(1<<J)-1)<<B-J,F|=this.data[--re]>>(J+=this.DB-B)):(F=this.data[re]>>(J-=B)&D,J<=0&&(J+=this.DB,--re)),F>0&&(z=!0),z&&(X+=E(F));return z?X:"0"}function A(){var b=d();return r.ZERO.subTo(this,b),b}function R(){return this.s<0?this.negate():this}function c(b){var B=this.s-b.s;if(B!=0)return B;var D=this.t;if(B=D-b.t,B!=0)return this.s<0?-B:B;for(;--D>=0;)if((B=this.data[D]-b.data[D])!=0)return B;return 0}function i(b){var B=1,D;return(D=b>>>16)!=0&&(b=D,B+=16),(D=b>>8)!=0&&(b=D,B+=8),(D=b>>4)!=0&&(b=D,B+=4),(D=b>>2)!=0&&(b=D,B+=2),(D=b>>1)!=0&&(b=D,B+=1),B}function n(){return this.t<=0?0:this.DB*(this.t-1)+i(this.data[this.t-1]^this.s&this.DM)}function I(b,B){var D;for(D=this.t-1;D>=0;--D)B.data[D+b]=this.data[D];for(D=b-1;D>=0;--D)B.data[D]=0;B.t=this.t+b,B.s=this.s}function k(b,B){for(var D=b;D<this.t;++D)B.data[D-b]=this.data[D];B.t=Math.max(this.t-b,0),B.s=this.s}function O(b,B){var D=b%this.DB,F=this.DB-D,z=(1<<F)-1,X=Math.floor(b/this.DB),re=this.s<<D&this.DM,J;for(J=this.t-1;J>=0;--J)B.data[J+X+1]=this.data[J]>>F|re,re=(this.data[J]&z)<<D;for(J=X-1;J>=0;--J)B.data[J]=0;B.data[X]=re,B.t=this.t+X+1,B.s=this.s,B.clamp()}function P(b,B){B.s=this.s;var D=Math.floor(b/this.DB);if(D>=this.t){B.t=0;return}var F=b%this.DB,z=this.DB-F,X=(1<<F)-1;B.data[0]=this.data[D]>>F;for(var re=D+1;re<this.t;++re)B.data[re-D-1]|=(this.data[re]&X)<<z,B.data[re-D]=this.data[re]>>F;F>0&&(B.data[this.t-D-1]|=(this.s&X)<<z),B.t=this.t-D,B.clamp()}function K(b,B){for(var D=0,F=0,z=Math.min(b.t,this.t);D<z;)F+=this.data[D]-b.data[D],B.data[D++]=F&this.DM,F>>=this.DB;if(b.t<this.t){for(F-=b.s;D<this.t;)F+=this.data[D],B.data[D++]=F&this.DM,F>>=this.DB;F+=this.s}else{for(F+=this.s;D<b.t;)F-=b.data[D],B.data[D++]=F&this.DM,F>>=this.DB;F-=b.s}B.s=F<0?-1:0,F<-1?B.data[D++]=this.DV+F:F>0&&(B.data[D++]=F),B.t=D,B.clamp()}function q(b,B){var D=this.abs(),F=b.abs(),z=D.t;for(B.t=z+F.t;--z>=0;)B.data[z]=0;for(z=0;z<F.t;++z)B.data[z+D.t]=D.am(0,F.data[z],B,z,0,D.t);B.s=0,B.clamp(),this.s!=b.s&&r.ZERO.subTo(B,B)}function M(b){for(var B=this.abs(),D=b.t=2*B.t;--D>=0;)b.data[D]=0;for(D=0;D<B.t-1;++D){var F=B.am(D,B.data[D],b,2*D,0,1);(b.data[D+B.t]+=B.am(D+1,2*B.data[D],b,2*D+1,F,B.t-D-1))>=B.DV&&(b.data[D+B.t]-=B.DV,b.data[D+B.t+1]=1)}b.t>0&&(b.data[b.t-1]+=B.am(D,B.data[D],b,2*D,0,1)),b.s=0,b.clamp()}function G(b,B,D){var F=b.abs();if(!(F.t<=0)){var z=this.abs();if(z.t<F.t){B?.fromInt(0),D!=null&&this.copyTo(D);return}D==null&&(D=d());var X=d(),re=this.s,J=b.s,he=this.DB-i(F.data[F.t-1]);he>0?(F.lShiftTo(he,X),z.lShiftTo(he,D)):(F.copyTo(X),z.copyTo(D));var Fe=X.t,$e=X.data[Fe-1];if($e!=0){var We=$e*(1<<this.F1)+(Fe>1?X.data[Fe-2]>>this.F2:0),ot=this.FV/We,Tt=(1<<this.F1)/We,tt=1<<this.F2,rt=D.t,At=rt-Fe,lt=B??d();for(X.dlShiftTo(At,lt),D.compareTo(lt)>=0&&(D.data[D.t++]=1,D.subTo(lt,D)),r.ONE.dlShiftTo(Fe,lt),lt.subTo(X,X);X.t<Fe;)X.data[X.t++]=0;for(;--At>=0;){var Dt=D.data[--rt]==$e?this.DM:Math.floor(D.data[rt]*ot+(D.data[rt-1]+tt)*Tt);if((D.data[rt]+=X.am(0,Dt,D,At,0,Fe))<Dt)for(X.dlShiftTo(At,lt),D.subTo(lt,D);D.data[rt]<--Dt;)D.subTo(lt,D)}B!=null&&(D.drShiftTo(Fe,B),re!=J&&r.ZERO.subTo(B,B)),D.t=Fe,D.clamp(),he>0&&D.rShiftTo(he,D),re<0&&r.ZERO.subTo(D,D)}}}function Y(b){var B=d();return this.abs().divRemTo(b,null,B),this.s<0&&B.compareTo(r.ZERO)>0&&b.subTo(B,B),B}function W(b){this.m=b}function ee(b){return b.s<0||b.compareTo(this.m)>=0?b.mod(this.m):b}function ne(b){return b}function ie(b){b.divRemTo(this.m,null,b)}function ce(b,B,D){b.multiplyTo(B,D),this.reduce(D)}function ve(b,B){b.squareTo(B),this.reduce(B)}W.prototype.convert=ee,W.prototype.revert=ne,W.prototype.reduce=ie,W.prototype.mulTo=ce,W.prototype.sqrTo=ve;function ue(){if(this.t<1)return 0;var b=this.data[0];if((b&1)==0)return 0;var B=b&3;return B=B*(2-(b&15)*B)&15,B=B*(2-(b&255)*B)&255,B=B*(2-((b&65535)*B&65535))&65535,B=B*(2-b*B%this.DV)%this.DV,B>0?this.DV-B:-B}function j(b){this.m=b,this.mp=b.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<b.DB-15)-1,this.mt2=2*b.t}function Z(b){var B=d();return b.abs().dlShiftTo(this.m.t,B),B.divRemTo(this.m,null,B),b.s<0&&B.compareTo(r.ZERO)>0&&this.m.subTo(B,B),B}function ze(b){var B=d();return b.copyTo(B),this.reduce(B),B}function qe(b){for(;b.t<=this.mt2;)b.data[b.t++]=0;for(var B=0;B<this.m.t;++B){var D=b.data[B]&32767,F=D*this.mpl+((D*this.mph+(b.data[B]>>15)*this.mpl&this.um)<<15)&b.DM;for(D=B+this.m.t,b.data[D]+=this.m.am(0,F,b,B,0,this.m.t);b.data[D]>=b.DV;)b.data[D]-=b.DV,b.data[++D]++}b.clamp(),b.drShiftTo(this.m.t,b),b.compareTo(this.m)>=0&&b.subTo(this.m,b)}function C(b,B){b.squareTo(B),this.reduce(B)}function L(b,B,D){b.multiplyTo(B,D),this.reduce(D)}j.prototype.convert=Z,j.prototype.revert=ze,j.prototype.reduce=qe,j.prototype.mulTo=L,j.prototype.sqrTo=C;function w(){return(this.t>0?this.data[0]&1:this.s)==0}function N(b,B){if(b>4294967295||b<1)return r.ONE;var D=d(),F=d(),z=B.convert(this),X=i(b)-1;for(z.copyTo(D);--X>=0;)if(B.sqrTo(D,F),(b&1<<X)>0)B.mulTo(F,z,D);else{var re=D;D=F,F=re}return B.revert(D)}function o(b,B){var D;return b<256||B.isEven()?D=new W(B):D=new j(B),this.exp(b,D)}r.prototype.copyTo=v,r.prototype.fromInt=m,r.prototype.fromString=s,r.prototype.clamp=h,r.prototype.dlShiftTo=I,r.prototype.drShiftTo=k,r.prototype.lShiftTo=O,r.prototype.rShiftTo=P,r.prototype.subTo=K,r.prototype.multiplyTo=q,r.prototype.squareTo=M,r.prototype.divRemTo=G,r.prototype.invDigit=ue,r.prototype.isEven=w,r.prototype.exp=N,r.prototype.toString=p,r.prototype.negate=A,r.prototype.abs=R,r.prototype.compareTo=c,r.prototype.bitLength=n,r.prototype.mod=Y,r.prototype.modPowInt=o,r.ZERO=g(0),r.ONE=g(1);function _(){var b=d();return this.copyTo(b),b}function V(){if(this.s<0){if(this.t==1)return this.data[0]-this.DV;if(this.t==0)return-1}else{if(this.t==1)return this.data[0];if(this.t==0)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]}function H(){return this.t==0?this.s:this.data[0]<<24>>24}function ae(){return this.t==0?this.s:this.data[0]<<16>>16}function te(b){return Math.floor(Math.LN2*this.DB/Math.log(b))}function Q(){return this.s<0?-1:this.t<=0||this.t==1&&this.data[0]<=0?0:1}function $(b){if(b==null&&(b=10),this.signum()==0||b<2||b>36)return"0";var B=this.chunkSize(b),D=Math.pow(b,B),F=g(D),z=d(),X=d(),re="";for(this.divRemTo(F,z,X);z.signum()>0;)re=(D+X.intValue()).toString(b).substr(1)+re,z.divRemTo(F,z,X);return X.intValue().toString(b)+re}function se(b,B){this.fromInt(0),B==null&&(B=10);for(var D=this.chunkSize(B),F=Math.pow(B,D),z=!1,X=0,re=0,J=0;J<b.length;++J){var he=f(b,J);if(he<0){b.charAt(J)=="-"&&this.signum()==0&&(z=!0);continue}re=B*re+he,++X>=D&&(this.dMultiply(F),this.dAddOffset(re,0),X=0,re=0)}X>0&&(this.dMultiply(Math.pow(B,X)),this.dAddOffset(re,0)),z&&r.ZERO.subTo(this,this)}function le(b,B,D){if(typeof B=="number")if(b<2)this.fromInt(1);else for(this.fromNumber(b,D),this.testBit(b-1)||this.bitwiseTo(r.ONE.shiftLeft(b-1),pe,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(B);)this.dAddOffset(2,0),this.bitLength()>b&&this.subTo(r.ONE.shiftLeft(b-1),this);else{var F=new Array,z=b&7;F.length=(b>>3)+1,B.nextBytes(F),z>0?F[0]&=(1<<z)-1:F[0]=0,this.fromString(F,256)}}function oe(){var b=this.t,B=new Array;B[0]=this.s;var D=this.DB-b*this.DB%8,F,z=0;if(b-- >0)for(D<this.DB&&(F=this.data[b]>>D)!=(this.s&this.DM)>>D&&(B[z++]=F|this.s<<this.DB-D);b>=0;)D<8?(F=(this.data[b]&(1<<D)-1)<<8-D,F|=this.data[--b]>>(D+=this.DB-8)):(F=this.data[b]>>(D-=8)&255,D<=0&&(D+=this.DB,--b)),(F&128)!=0&&(F|=-256),z==0&&(this.s&128)!=(F&128)&&++z,(z>0||F!=this.s)&&(B[z++]=F);return B}function Ce(b){return this.compareTo(b)==0}function Se(b){return this.compareTo(b)<0?this:b}function xe(b){return this.compareTo(b)>0?this:b}function Ee(b,B,D){var F,z,X=Math.min(b.t,this.t);for(F=0;F<X;++F)D.data[F]=B(this.data[F],b.data[F]);if(b.t<this.t){for(z=b.s&this.DM,F=X;F<this.t;++F)D.data[F]=B(this.data[F],z);D.t=this.t}else{for(z=this.s&this.DM,F=X;F<b.t;++F)D.data[F]=B(z,b.data[F]);D.t=b.t}D.s=B(this.s,b.s),D.clamp()}function ge(b,B){return b&B}function ye(b){var B=d();return this.bitwiseTo(b,ge,B),B}function pe(b,B){return b|B}function Te(b){var B=d();return this.bitwiseTo(b,pe,B),B}function Ae(b,B){return b^B}function He(b){var B=d();return this.bitwiseTo(b,Ae,B),B}function Ge(b,B){return b&~B}function Ye(b){var B=d();return this.bitwiseTo(b,Ge,B),B}function Xe(){for(var b=d(),B=0;B<this.t;++B)b.data[B]=this.DM&~this.data[B];return b.t=this.t,b.s=~this.s,b}function Ze(b){var B=d();return b<0?this.rShiftTo(-b,B):this.lShiftTo(b,B),B}function Je(b){var B=d();return b<0?this.lShiftTo(-b,B):this.rShiftTo(b,B),B}function nt(b){if(b==0)return-1;var B=0;return(b&65535)==0&&(b>>=16,B+=16),(b&255)==0&&(b>>=8,B+=8),(b&15)==0&&(b>>=4,B+=4),(b&3)==0&&(b>>=2,B+=2),(b&1)==0&&++B,B}function st(){for(var b=0;b<this.t;++b)if(this.data[b]!=0)return b*this.DB+nt(this.data[b]);return this.s<0?this.t*this.DB:-1}function ut(b){for(var B=0;b!=0;)b&=b-1,++B;return B}function dt(){for(var b=0,B=this.s&this.DM,D=0;D<this.t;++D)b+=ut(this.data[D]^B);return b}function vt(b){var B=Math.floor(b/this.DB);return B>=this.t?this.s!=0:(this.data[B]&1<<b%this.DB)!=0}function Ct(b,B){var D=r.ONE.shiftLeft(b);return this.bitwiseTo(D,B,D),D}function bt(b){return this.changeBit(b,pe)}function Ie(b){return this.changeBit(b,Ge)}function Be(b){return this.changeBit(b,Ae)}function _e(b,B){for(var D=0,F=0,z=Math.min(b.t,this.t);D<z;)F+=this.data[D]+b.data[D],B.data[D++]=F&this.DM,F>>=this.DB;if(b.t<this.t){for(F+=b.s;D<this.t;)F+=this.data[D],B.data[D++]=F&this.DM,F>>=this.DB;F+=this.s}else{for(F+=this.s;D<b.t;)F+=b.data[D],B.data[D++]=F&this.DM,F>>=this.DB;F+=b.s}B.s=F<0?-1:0,F>0?B.data[D++]=F:F<-1&&(B.data[D++]=this.DV+F),B.t=D,B.clamp()}function Ne(b){var B=d();return this.addTo(b,B),B}function we(b){var B=d();return this.subTo(b,B),B}function Re(b){var B=d();return this.multiplyTo(b,B),B}function Le(){var b=d();return this.squareTo(b),b}function ke(b){var B=d();return this.divRemTo(b,B,null),B}function Ue(b){var B=d();return this.divRemTo(b,null,B),B}function De(b){var B=d(),D=d();return this.divRemTo(b,B,D),new Array(B,D)}function Pe(b){this.data[this.t]=this.am(0,b-1,this,0,0,this.t),++this.t,this.clamp()}function Ve(b,B){if(b!=0){for(;this.t<=B;)this.data[this.t++]=0;for(this.data[B]+=b;this.data[B]>=this.DV;)this.data[B]-=this.DV,++B>=this.t&&(this.data[this.t++]=0),++this.data[B]}}function me(){}function be(b){return b}function Oe(b,B,D){b.multiplyTo(B,D)}function Ke(b,B){b.squareTo(B)}me.prototype.convert=be,me.prototype.revert=be,me.prototype.mulTo=Oe,me.prototype.sqrTo=Ke;function Ha(b){return this.exp(b,new me)}function Ga(b,B,D){var F=Math.min(this.t+b.t,B);for(D.s=0,D.t=F;F>0;)D.data[--F]=0;var z;for(z=D.t-this.t;F<z;++F)D.data[F+this.t]=this.am(0,b.data[F],D,F,0,this.t);for(z=Math.min(b.t,B);F<z;++F)this.am(0,b.data[F],D,F,0,B-F);D.clamp()}function Qa(b,B,D){--B;var F=D.t=this.t+b.t-B;for(D.s=0;--F>=0;)D.data[F]=0;for(F=Math.max(B-this.t,0);F<b.t;++F)D.data[this.t+F-B]=this.am(B-F,b.data[F],D,0,0,this.t+F-B);D.clamp(),D.drShiftTo(1,D)}function yt(b){this.r2=d(),this.q3=d(),r.ONE.dlShiftTo(2*b.t,this.r2),this.mu=this.r2.divide(b),this.m=b}function za(b){if(b.s<0||b.t>2*this.m.t)return b.mod(this.m);if(b.compareTo(this.m)<0)return b;var B=d();return b.copyTo(B),this.reduce(B),B}function Ya(b){return b}function Xa(b){for(b.drShiftTo(this.m.t-1,this.r2),b.t>this.m.t+1&&(b.t=this.m.t+1,b.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);b.compareTo(this.r2)<0;)b.dAddOffset(1,this.m.t+1);for(b.subTo(this.r2,b);b.compareTo(this.m)>=0;)b.subTo(this.m,b)}function Wa(b,B){b.squareTo(B),this.reduce(B)}function ja(b,B,D){b.multiplyTo(B,D),this.reduce(D)}yt.prototype.convert=za,yt.prototype.revert=Ya,yt.prototype.reduce=Xa,yt.prototype.mulTo=ja,yt.prototype.sqrTo=Wa;function Za(b,B){var D=b.bitLength(),F,z=g(1),X;if(D<=0)return z;D<18?F=1:D<48?F=3:D<144?F=4:D<768?F=5:F=6,D<8?X=new W(B):B.isEven()?X=new yt(B):X=new j(B);var re=new Array,J=3,he=F-1,Fe=(1<<F)-1;if(re[1]=X.convert(this),F>1){var $e=d();for(X.sqrTo(re[1],$e);J<=Fe;)re[J]=d(),X.mulTo($e,re[J-2],re[J]),J+=2}var We=b.t-1,ot,Tt=!0,tt=d(),rt;for(D=i(b.data[We])-1;We>=0;){for(D>=he?ot=b.data[We]>>D-he&Fe:(ot=(b.data[We]&(1<<D+1)-1)<<he-D,We>0&&(ot|=b.data[We-1]>>this.DB+D-he)),J=F;(ot&1)==0;)ot>>=1,--J;if((D-=J)<0&&(D+=this.DB,--We),Tt)re[ot].copyTo(z),Tt=!1;else{for(;J>1;)X.sqrTo(z,tt),X.sqrTo(tt,z),J-=2;J>0?X.sqrTo(z,tt):(rt=z,z=tt,tt=rt),X.mulTo(tt,re[ot],z)}for(;We>=0&&(b.data[We]&1<<D)==0;)X.sqrTo(z,tt),rt=z,z=tt,tt=rt,--D<0&&(D=this.DB-1,--We)}return X.revert(z)}function $a(b){var B=this.s<0?this.negate():this.clone(),D=b.s<0?b.negate():b.clone();if(B.compareTo(D)<0){var F=B;B=D,D=F}var z=B.getLowestSetBit(),X=D.getLowestSetBit();if(X<0)return B;for(z<X&&(X=z),X>0&&(B.rShiftTo(X,B),D.rShiftTo(X,D));B.signum()>0;)(z=B.getLowestSetBit())>0&&B.rShiftTo(z,B),(z=D.getLowestSetBit())>0&&D.rShiftTo(z,D),B.compareTo(D)>=0?(B.subTo(D,B),B.rShiftTo(1,B)):(D.subTo(B,D),D.rShiftTo(1,D));return X>0&&D.lShiftTo(X,D),D}function Ja(b){if(b<=0)return 0;var B=this.DV%b,D=this.s<0?b-1:0;if(this.t>0)if(B==0)D=this.data[0]%b;else for(var F=this.t-1;F>=0;--F)D=(B*D+this.data[F])%b;return D}function en(b){if(this.signum()==0)return r.ZERO;var B=b.isEven();if(this.isEven()&&B||b.signum()==0)return r.ZERO;for(var D=b.clone(),F=this.clone(),z=g(1),X=g(0),re=g(0),J=g(1);D.signum()!=0;){for(;D.isEven();)D.rShiftTo(1,D),B?((!z.isEven()||!X.isEven())&&(z.addTo(this,z),X.subTo(b,X)),z.rShiftTo(1,z)):X.isEven()||X.subTo(b,X),X.rShiftTo(1,X);for(;F.isEven();)F.rShiftTo(1,F),B?((!re.isEven()||!J.isEven())&&(re.addTo(this,re),J.subTo(b,J)),re.rShiftTo(1,re)):J.isEven()||J.subTo(b,J),J.rShiftTo(1,J);D.compareTo(F)>=0?(D.subTo(F,D),B&&z.subTo(re,z),X.subTo(J,X)):(F.subTo(D,F),B&&re.subTo(z,re),J.subTo(X,J))}if(F.compareTo(r.ONE)!=0)return r.ZERO;if(J.compareTo(b)>=0)return J.subtract(b);if(J.signum()<0)J.addTo(b,J);else return J;return J.signum()<0?J.add(b):J}var et=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],tn=(1<<26)/et[et.length-1];function rn(b){var B,D=this.abs();if(D.t==1&&D.data[0]<=et[et.length-1]){for(B=0;B<et.length;++B)if(D.data[0]==et[B])return!0;return!1}if(D.isEven())return!1;for(B=1;B<et.length;){for(var F=et[B],z=B+1;z<et.length&&F<tn;)F*=et[z++];for(F=D.modInt(F);B<z;)if(F%et[B++]==0)return!1}return D.millerRabin(b)}function an(b){var B=this.subtract(r.ONE),D=B.getLowestSetBit();if(D<=0)return!1;for(var F=B.shiftRight(D),z=nn(),X,re=0;re<b;++re){do X=new r(this.bitLength(),z);while(X.compareTo(r.ONE)<=0||X.compareTo(B)>=0);var J=X.modPow(F,this);if(J.compareTo(r.ONE)!=0&&J.compareTo(B)!=0){for(var he=1;he++<D&&J.compareTo(B)!=0;)if(J=J.modPowInt(2,this),J.compareTo(r.ONE)==0)return!1;if(J.compareTo(B)!=0)return!1}}return!0}function nn(){return{nextBytes:function(b){for(var B=0;B<b.length;++B)b[B]=Math.floor(Math.random()*256)}}}return r.prototype.chunkSize=te,r.prototype.toRadix=$,r.prototype.fromRadix=se,r.prototype.fromNumber=le,r.prototype.bitwiseTo=Ee,r.prototype.changeBit=Ct,r.prototype.addTo=_e,r.prototype.dMultiply=Pe,r.prototype.dAddOffset=Ve,r.prototype.multiplyLowerTo=Ga,r.prototype.multiplyUpperTo=Qa,r.prototype.modInt=Ja,r.prototype.millerRabin=an,r.prototype.clone=_,r.prototype.intValue=V,r.prototype.byteValue=H,r.prototype.shortValue=ae,r.prototype.signum=Q,r.prototype.toByteArray=oe,r.prototype.equals=Ce,r.prototype.min=Se,r.prototype.max=xe,r.prototype.and=ye,r.prototype.or=Te,r.prototype.xor=He,r.prototype.andNot=Ye,r.prototype.not=Xe,r.prototype.shiftLeft=Ze,r.prototype.shiftRight=Je,r.prototype.getLowestSetBit=st,r.prototype.bitCount=dt,r.prototype.testBit=vt,r.prototype.setBit=bt,r.prototype.clearBit=Ie,r.prototype.flipBit=Be,r.prototype.add=Ne,r.prototype.subtract=we,r.prototype.multiply=Re,r.prototype.divide=ke,r.prototype.remainder=Ue,r.prototype.divideAndRemainder=De,r.prototype.modPow=Za,r.prototype.modInverse=en,r.prototype.pow=Ha,r.prototype.gcd=$a,r.prototype.isProbablePrime=rn,r.prototype.square=Le,ar}var nr={exports:{}},ir={exports:{}},ea;function St(){if(ea)return ir.exports;ea=1;var t=fe();ft(),de();var e=ir.exports=t.sha1=t.sha1||{};t.md.sha1=t.md.algorithms.sha1=e,e.create=function(){d||T();var l=null,a=t.util.createBuffer(),y=new Array(80),u={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8};return u.start=function(){u.messageLength=0,u.fullMessageLength=u.messageLength64=[];for(var S=u.messageLengthSize/4,U=0;U<S;++U)u.fullMessageLength.push(0);return a=t.util.createBuffer(),l={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},u},u.start(),u.update=function(S,U){U==="utf8"&&(S=t.util.encodeUtf8(S));var E=S.length;u.messageLength+=E,E=[E/4294967296>>>0,E>>>0];for(var f=u.fullMessageLength.length-1;f>=0;--f)u.fullMessageLength[f]+=E[1],E[1]=E[0]+(u.fullMessageLength[f]/4294967296>>>0),u.fullMessageLength[f]=u.fullMessageLength[f]>>>0,E[0]=E[1]/4294967296>>>0;return a.putBytes(S),x(l,y,a),(a.read>2048||a.length()===0)&&a.compact(),u},u.digest=function(){var S=t.util.createBuffer();S.putBytes(a.bytes());var U=u.fullMessageLength[u.fullMessageLength.length-1]+u.messageLengthSize,E=U&u.blockLength-1;S.putBytes(r.substr(0,u.blockLength-E));for(var f,v,m=u.fullMessageLength[0]*8,g=0;g<u.fullMessageLength.length-1;++g)f=u.fullMessageLength[g+1]*8,v=f/4294967296>>>0,m+=v,S.putInt32(m>>>0),m=f>>>0;S.putInt32(m);var s={h0:l.h0,h1:l.h1,h2:l.h2,h3:l.h3,h4:l.h4};x(s,y,S);var h=t.util.createBuffer();return h.putInt32(s.h0),h.putInt32(s.h1),h.putInt32(s.h2),h.putInt32(s.h3),h.putInt32(s.h4),h},u};var r=null,d=!1;function T(){r="",r+=t.util.fillString("\0",64),d=!0}function x(l,a,y){for(var u,S,U,E,f,v,m,g,s=y.length();s>=64;){for(S=l.h0,U=l.h1,E=l.h2,f=l.h3,v=l.h4,g=0;g<16;++g)u=y.getInt32(),a[g]=u,m=f^U&(E^f),u=(S<<5|S>>>27)+m+v+1518500249+u,v=f,f=E,E=(U<<30|U>>>2)>>>0,U=S,S=u;for(;g<20;++g)u=a[g-3]^a[g-8]^a[g-14]^a[g-16],u=u<<1|u>>>31,a[g]=u,m=f^U&(E^f),u=(S<<5|S>>>27)+m+v+1518500249+u,v=f,f=E,E=(U<<30|U>>>2)>>>0,U=S,S=u;for(;g<32;++g)u=a[g-3]^a[g-8]^a[g-14]^a[g-16],u=u<<1|u>>>31,a[g]=u,m=U^E^f,u=(S<<5|S>>>27)+m+v+1859775393+u,v=f,f=E,E=(U<<30|U>>>2)>>>0,U=S,S=u;for(;g<40;++g)u=a[g-6]^a[g-16]^a[g-28]^a[g-32],u=u<<2|u>>>30,a[g]=u,m=U^E^f,u=(S<<5|S>>>27)+m+v+1859775393+u,v=f,f=E,E=(U<<30|U>>>2)>>>0,U=S,S=u;for(;g<60;++g)u=a[g-6]^a[g-16]^a[g-28]^a[g-32],u=u<<2|u>>>30,a[g]=u,m=U&E|f&(U^E),u=(S<<5|S>>>27)+m+v+2400959708+u,v=f,f=E,E=(U<<30|U>>>2)>>>0,U=S,S=u;for(;g<80;++g)u=a[g-6]^a[g-16]^a[g-28]^a[g-32],u=u<<2|u>>>30,a[g]=u,m=U^E^f,u=(S<<5|S>>>27)+m+v+3395469782+u,v=f,f=E,E=(U<<30|U>>>2)>>>0,U=S,S=u;l.h0=l.h0+S|0,l.h1=l.h1+U|0,l.h2=l.h2+E|0,l.h3=l.h3+f|0,l.h4=l.h4+v|0,s-=64}}return ir.exports}var ta;function Ua(){if(ta)return nr.exports;ta=1;var t=fe();de(),at(),St();var e=nr.exports=t.pkcs1=t.pkcs1||{};e.encode_rsa_oaep=function(d,T,x){var l,a,y,u;typeof x=="string"?(l=x,a=arguments[3]||void 0,y=arguments[4]||void 0):x&&(l=x.label||void 0,a=x.seed||void 0,y=x.md||void 0,x.mgf1&&x.mgf1.md&&(u=x.mgf1.md)),y?y.start():y=t.md.sha1.create(),u||(u=y);var S=Math.ceil(d.n.bitLength()/8),U=S-2*y.digestLength-2;if(T.length>U){var E=new Error("RSAES-OAEP input message length is too long.");throw E.length=T.length,E.maxLength=U,E}l||(l=""),y.update(l,"raw");for(var f=y.digest(),v="",m=U-T.length,g=0;g<m;g++)v+="\0";var s=f.getBytes()+v+""+T;if(!a)a=t.random.getBytes(y.digestLength);else if(a.length!==y.digestLength){var E=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.");throw E.seedLength=a.length,E.digestLength=y.digestLength,E}var h=r(a,S-y.digestLength-1,u),p=t.util.xorBytes(s,h,s.length),A=r(p,y.digestLength,u),R=t.util.xorBytes(a,A,a.length);return"\0"+R+p},e.decode_rsa_oaep=function(d,T,x){var l,a,y;typeof x=="string"?(l=x,a=arguments[3]||void 0):x&&(l=x.label||void 0,a=x.md||void 0,x.mgf1&&x.mgf1.md&&(y=x.mgf1.md));var u=Math.ceil(d.n.bitLength()/8);if(T.length!==u){var p=new Error("RSAES-OAEP encoded message length is invalid.");throw p.length=T.length,p.expectedLength=u,p}if(a===void 0?a=t.md.sha1.create():a.start(),y||(y=a),u<2*a.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");l||(l=""),a.update(l,"raw");for(var S=a.digest().getBytes(),U=T.charAt(0),E=T.substring(1,a.digestLength+1),f=T.substring(1+a.digestLength),v=r(f,a.digestLength,y),m=t.util.xorBytes(E,v,E.length),g=r(m,u-a.digestLength-1,y),s=t.util.xorBytes(f,g,f.length),h=s.substring(0,a.digestLength),p=U!=="\0",A=0;A<a.digestLength;++A)p|=S.charAt(A)!==h.charAt(A);for(var R=1,c=a.digestLength,i=a.digestLength;i<s.length;i++){var n=s.charCodeAt(i),I=n&1^1,k=R?65534:0;p|=n&k,R=R&I,c+=R}if(p||s.charCodeAt(c)!==1)throw new Error("Invalid RSAES-OAEP padding.");return s.substring(c+1)};function r(d,T,x){x||(x=t.md.sha1.create());for(var l="",a=Math.ceil(T/x.digestLength),y=0;y<a;++y){var u=String.fromCharCode(y>>24&255,y>>16&255,y>>8&255,y&255);x.start(),x.update(d+u),l+=x.digest().getBytes()}return l.substring(0,T)}return nr.exports}var Bt={exports:{}},ra;function Da(){if(ra)return Bt.exports;ra=1;var t=fe();return de(),kt(),at(),(function(){if(t.prime){Bt.exports=t.prime;return}var e=Bt.exports=t.prime=t.prime||{},r=t.jsbn.BigInteger,d=[6,4,2,4,2,4,6,2],T=new r(null);T.fromInt(30);var x=function(E,f){return E|f};e.generateProbablePrime=function(E,f,v){typeof f=="function"&&(v=f,f={}),f=f||{};var m=f.algorithm||"PRIMEINC";typeof m=="string"&&(m={name:m}),m.options=m.options||{};var g=f.prng||t.random,s={nextBytes:function(h){for(var p=g.getBytesSync(h.length),A=0;A<h.length;++A)h[A]=p.charCodeAt(A)}};if(m.name==="PRIMEINC")return l(E,s,m.options,v);throw new Error("Invalid prime generation algorithm: "+m.name)};function l(E,f,v,m){return"workers"in v?u(E,f,v,m):a(E,f,v,m)}function a(E,f,v,m){var g=S(E,f),s=0,h=U(g.bitLength());"millerRabinTests"in v&&(h=v.millerRabinTests);var p=10;"maxBlockTime"in v&&(p=v.maxBlockTime),y(g,E,f,s,h,p,m)}function y(E,f,v,m,g,s,h){var p=+new Date;do{if(E.bitLength()>f&&(E=S(f,v)),E.isProbablePrime(g))return h(null,E);E.dAddOffset(d[m++%8],0)}while(s<0||+new Date-p<s);t.util.setImmediate(function(){y(E,f,v,m,g,s,h)})}function u(E,f,v,m){if(typeof Worker>"u")return a(E,f,v,m);var g=S(E,f),s=v.workers,h=v.workLoad||100,p=h*30/8,A=v.workerScript||"forge/prime.worker.js";if(s===-1)return t.util.estimateCores(function(c,i){c&&(i=2),s=i-1,R()});R();function R(){s=Math.max(1,s);for(var c=[],i=0;i<s;++i)c[i]=new Worker(A);for(var i=0;i<s;++i)c[i].addEventListener("message",I);var n=!1;function I(k){if(!n){var O=k.data;if(O.found){for(var P=0;P<c.length;++P)c[P].terminate();return n=!0,m(null,new r(O.prime,16))}g.bitLength()>E&&(g=S(E,f));var K=g.toString(16);k.target.postMessage({hex:K,workLoad:h}),g.dAddOffset(p,0)}}}}function S(E,f){var v=new r(E,f),m=E-1;return v.testBit(m)||v.bitwiseTo(r.ONE.shiftLeft(m),x,v),v.dAddOffset(31-v.mod(T).byteValue(),0),v}function U(E){return E<=100?27:E<=150?18:E<=200?15:E<=250?12:E<=300?9:E<=350?8:E<=400?7:E<=500?6:E<=600?5:E<=800?4:E<=1250?3:2}})(),Bt.exports}var sr,aa;function Ut(){if(aa)return sr;aa=1;var t=fe();if(it(),kt(),pt(),Ua(),Da(),at(),de(),typeof e>"u")var e=t.jsbn.BigInteger;var r=t.util.isNodejs?wr:null,d=t.asn1,T=t.util;t.pki=t.pki||{},sr=t.pki.rsa=t.rsa=t.rsa||{};var x=t.pki,l=[6,4,2,4,2,4,6,2],a={name:"PrivateKeyInfo",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:d.Class.UNIVERSAL,type:d.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:d.Class.UNIVERSAL,type:d.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},y={name:"RSAPrivateKey",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},u={name:"RSAPublicKey",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:d.Class.UNIVERSAL,type:d.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},S=t.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:d.Class.UNIVERSAL,type:d.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:d.Class.UNIVERSAL,type:d.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},U={name:"DigestInfo",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm",tagClass:d.Class.UNIVERSAL,type:d.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm.algorithmIdentifier",tagClass:d.Class.UNIVERSAL,type:d.Type.OID,constructed:!1,capture:"algorithmIdentifier"},{name:"DigestInfo.DigestAlgorithm.parameters",tagClass:d.Class.UNIVERSAL,type:d.Type.NULL,capture:"parameters",optional:!0,constructed:!1}]},{name:"DigestInfo.digest",tagClass:d.Class.UNIVERSAL,type:d.Type.OCTETSTRING,constructed:!1,capture:"digest"}]},E=function(i){var n;if(i.algorithm in x.oids)n=x.oids[i.algorithm];else{var I=new Error("Unknown message digest algorithm.");throw I.algorithm=i.algorithm,I}var k=d.oidToDer(n).getBytes(),O=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[]),P=d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[]);P.value.push(d.create(d.Class.UNIVERSAL,d.Type.OID,!1,k)),P.value.push(d.create(d.Class.UNIVERSAL,d.Type.NULL,!1,""));var K=d.create(d.Class.UNIVERSAL,d.Type.OCTETSTRING,!1,i.digest().getBytes());return O.value.push(P),O.value.push(K),d.toDer(O).getBytes()},f=function(i,n,I){if(I)return i.modPow(n.e,n.n);if(!n.p||!n.q)return i.modPow(n.d,n.n);n.dP||(n.dP=n.d.mod(n.p.subtract(e.ONE))),n.dQ||(n.dQ=n.d.mod(n.q.subtract(e.ONE))),n.qInv||(n.qInv=n.q.modInverse(n.p));var k;do k=new e(t.util.bytesToHex(t.random.getBytes(n.n.bitLength()/8)),16);while(k.compareTo(n.n)>=0||!k.gcd(n.n).equals(e.ONE));i=i.multiply(k.modPow(n.e,n.n)).mod(n.n);for(var O=i.mod(n.p).modPow(n.dP,n.p),P=i.mod(n.q).modPow(n.dQ,n.q);O.compareTo(P)<0;)O=O.add(n.p);var K=O.subtract(P).multiply(n.qInv).mod(n.p).multiply(n.q).add(P);return K=K.multiply(k.modInverse(n.n)).mod(n.n),K};x.rsa.encrypt=function(i,n,I){var k=I,O,P=Math.ceil(n.n.bitLength()/8);I!==!1&&I!==!0?(k=I===2,O=v(i,n,I)):(O=t.util.createBuffer(),O.putBytes(i));for(var K=new e(O.toHex(),16),q=f(K,n,k),M=q.toString(16),G=t.util.createBuffer(),Y=P-Math.ceil(M.length/2);Y>0;)G.putByte(0),--Y;return G.putBytes(t.util.hexToBytes(M)),G.getBytes()},x.rsa.decrypt=function(i,n,I,k){var O=Math.ceil(n.n.bitLength()/8);if(i.length!==O){var P=new Error("Encrypted message length is invalid.");throw P.length=i.length,P.expected=O,P}var K=new e(t.util.createBuffer(i).toHex(),16);if(K.compareTo(n.n)>=0)throw new Error("Encrypted message is invalid.");for(var q=f(K,n,I),M=q.toString(16),G=t.util.createBuffer(),Y=O-Math.ceil(M.length/2);Y>0;)G.putByte(0),--Y;return G.putBytes(t.util.hexToBytes(M)),k!==!1?m(G.getBytes(),n,I):G.getBytes()},x.rsa.createKeyPairGenerationState=function(i,n,I){typeof i=="string"&&(i=parseInt(i,10)),i=i||2048,I=I||{};var k=I.prng||t.random,O={nextBytes:function(q){for(var M=k.getBytesSync(q.length),G=0;G<q.length;++G)q[G]=M.charCodeAt(G)}},P=I.algorithm||"PRIMEINC",K;if(P==="PRIMEINC")K={algorithm:P,state:0,bits:i,rng:O,eInt:n||65537,e:new e(null),p:null,q:null,qBits:i>>1,pBits:i-(i>>1),pqState:0,num:null,keys:null},K.e.fromInt(K.eInt);else throw new Error("Invalid key generation algorithm: "+P);return K},x.rsa.stepKeyPairGenerationState=function(i,n){"algorithm"in i||(i.algorithm="PRIMEINC");var I=new e(null);I.fromInt(30);for(var k=0,O=function(W,ee){return W|ee},P=+new Date,K,q=0;i.keys===null&&(n<=0||q<n);){if(i.state===0){var M=i.p===null?i.pBits:i.qBits,G=M-1;i.pqState===0?(i.num=new e(M,i.rng),i.num.testBit(G)||i.num.bitwiseTo(e.ONE.shiftLeft(G),O,i.num),i.num.dAddOffset(31-i.num.mod(I).byteValue(),0),k=0,++i.pqState):i.pqState===1?i.num.bitLength()>M?i.pqState=0:i.num.isProbablePrime(h(i.num.bitLength()))?++i.pqState:i.num.dAddOffset(l[k++%8],0):i.pqState===2?i.pqState=i.num.subtract(e.ONE).gcd(i.e).compareTo(e.ONE)===0?3:0:i.pqState===3&&(i.pqState=0,i.p===null?i.p=i.num:i.q=i.num,i.p!==null&&i.q!==null&&++i.state,i.num=null)}else if(i.state===1)i.p.compareTo(i.q)<0&&(i.num=i.p,i.p=i.q,i.q=i.num),++i.state;else if(i.state===2)i.p1=i.p.subtract(e.ONE),i.q1=i.q.subtract(e.ONE),i.phi=i.p1.multiply(i.q1),++i.state;else if(i.state===3)i.phi.gcd(i.e).compareTo(e.ONE)===0?++i.state:(i.p=null,i.q=null,i.state=0);else if(i.state===4)i.n=i.p.multiply(i.q),i.n.bitLength()===i.bits?++i.state:(i.q=null,i.state=0);else if(i.state===5){var Y=i.e.modInverse(i.phi);i.keys={privateKey:x.rsa.setPrivateKey(i.n,i.e,Y,i.p,i.q,Y.mod(i.p1),Y.mod(i.q1),i.q.modInverse(i.p)),publicKey:x.rsa.setPublicKey(i.n,i.e)}}K=+new Date,q+=K-P,P=K}return i.keys!==null},x.rsa.generateKeyPair=function(i,n,I,k){if(arguments.length===1?typeof i=="object"?(I=i,i=void 0):typeof i=="function"&&(k=i,i=void 0):arguments.length===2?typeof i=="number"?typeof n=="function"?(k=n,n=void 0):typeof n!="number"&&(I=n,n=void 0):(I=i,k=n,i=void 0,n=void 0):arguments.length===3&&(typeof n=="number"?typeof I=="function"&&(k=I,I=void 0):(k=I,I=n,n=void 0)),I=I||{},i===void 0&&(i=I.bits||2048),n===void 0&&(n=I.e||65537),!t.options.usePureJavaScript&&!I.prng&&i>=256&&i<=16384&&(n===65537||n===3)){if(k){if(p("generateKeyPair"))return r.generateKeyPair("rsa",{modulusLength:i,publicExponent:n,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(q,M,G){if(q)return k(q);k(null,{privateKey:x.privateKeyFromPem(G),publicKey:x.publicKeyFromPem(M)})});if(A("generateKey")&&A("exportKey"))return T.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:i,publicExponent:c(n),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(q){return T.globalScope.crypto.subtle.exportKey("pkcs8",q.privateKey)}).then(void 0,function(q){k(q)}).then(function(q){if(q){var M=x.privateKeyFromAsn1(d.fromDer(t.util.createBuffer(q)));k(null,{privateKey:M,publicKey:x.setRsaPublicKey(M.n,M.e)})}});if(R("generateKey")&&R("exportKey")){var O=T.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:i,publicExponent:c(n),hash:{name:"SHA-256"}},!0,["sign","verify"]);O.oncomplete=function(q){var M=q.target.result,G=T.globalScope.msCrypto.subtle.exportKey("pkcs8",M.privateKey);G.oncomplete=function(Y){var W=Y.target.result,ee=x.privateKeyFromAsn1(d.fromDer(t.util.createBuffer(W)));k(null,{privateKey:ee,publicKey:x.setRsaPublicKey(ee.n,ee.e)})},G.onerror=function(Y){k(Y)}},O.onerror=function(q){k(q)};return}}else if(p("generateKeyPairSync")){var P=r.generateKeyPairSync("rsa",{modulusLength:i,publicExponent:n,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:x.privateKeyFromPem(P.privateKey),publicKey:x.publicKeyFromPem(P.publicKey)}}}var K=x.rsa.createKeyPairGenerationState(i,n,I);if(!k)return x.rsa.stepKeyPairGenerationState(K,0),K.keys;g(K,I,k)},x.setRsaPublicKey=x.rsa.setPublicKey=function(i,n){var I={n:i,e:n};return I.encrypt=function(k,O,P){if(typeof O=="string"?O=O.toUpperCase():O===void 0&&(O="RSAES-PKCS1-V1_5"),O==="RSAES-PKCS1-V1_5")O={encode:function(q,M,G){return v(q,M,2).getBytes()}};else if(O==="RSA-OAEP"||O==="RSAES-OAEP")O={encode:function(q,M){return t.pkcs1.encode_rsa_oaep(M,q,P)}};else if(["RAW","NONE","NULL",null].indexOf(O)!==-1)O={encode:function(q){return q}};else if(typeof O=="string")throw new Error('Unsupported encryption scheme: "'+O+'".');var K=O.encode(k,I,!0);return x.rsa.encrypt(K,I,!0)},I.verify=function(k,O,P,K){typeof P=="string"?P=P.toUpperCase():P===void 0&&(P="RSASSA-PKCS1-V1_5"),K===void 0&&(K={_parseAllDigestBytes:!0,_skipPaddingChecks:!1}),"_parseAllDigestBytes"in K||(K._parseAllDigestBytes=!0),"_skipPaddingChecks"in K||(K._skipPaddingChecks=!1),P==="RSASSA-PKCS1-V1_5"?P={verify:function(M,G){G=m(G,I,!0,void 0,K);var Y=d.fromDer(G,{parseAllBytes:K._parseAllDigestBytes}),W={},ee=[];if(!d.validate(Y,U,W,ee)||Y.value.length!==2){var ne=new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.");throw ne.errors=ee,ne}var ie=d.derToOid(W.algorithmIdentifier);if(!(ie===t.oids.md2||ie===t.oids.md5||ie===t.oids.sha1||ie===t.oids.sha224||ie===t.oids.sha256||ie===t.oids.sha384||ie===t.oids.sha512||ie===t.oids["sha512-224"]||ie===t.oids["sha512-256"])){var ne=new Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.");throw ne.oid=ie,ne}if((ie===t.oids.md2||ie===t.oids.md5)&&!("parameters"in W))throw new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value. Missing algorithm identifier NULL parameters.");return M===W.digest}}:(P==="NONE"||P==="NULL"||P===null)&&(P={verify:function(M,G){return G=m(G,I,!0,void 0,K),M===G}});var q=x.rsa.decrypt(O,I,!0,!1);return P.verify(k,q,I.n.bitLength())},I},x.setRsaPrivateKey=x.rsa.setPrivateKey=function(i,n,I,k,O,P,K,q){var M={n:i,e:n,d:I,p:k,q:O,dP:P,dQ:K,qInv:q};return M.decrypt=function(G,Y,W){typeof Y=="string"?Y=Y.toUpperCase():Y===void 0&&(Y="RSAES-PKCS1-V1_5");var ee=x.rsa.decrypt(G,M,!1,!1);if(Y==="RSAES-PKCS1-V1_5")Y={decode:m};else if(Y==="RSA-OAEP"||Y==="RSAES-OAEP")Y={decode:function(ne,ie){return t.pkcs1.decode_rsa_oaep(ie,ne,W)}};else if(["RAW","NONE","NULL",null].indexOf(Y)!==-1)Y={decode:function(ne){return ne}};else throw new Error('Unsupported encryption scheme: "'+Y+'".');return Y.decode(ee,M,!1)},M.sign=function(G,Y){var W=!1;typeof Y=="string"&&(Y=Y.toUpperCase()),Y===void 0||Y==="RSASSA-PKCS1-V1_5"?(Y={encode:E},W=1):(Y==="NONE"||Y==="NULL"||Y===null)&&(Y={encode:function(){return G}},W=1);var ee=Y.encode(G,M.n.bitLength());return x.rsa.encrypt(ee,M,W)},M},x.wrapRsaPrivateKey=function(i){return d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,d.integerToDer(0).getBytes()),d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.OID,!1,d.oidToDer(x.oids.rsaEncryption).getBytes()),d.create(d.Class.UNIVERSAL,d.Type.NULL,!1,"")]),d.create(d.Class.UNIVERSAL,d.Type.OCTETSTRING,!1,d.toDer(i).getBytes())])},x.privateKeyFromAsn1=function(i){var n={},I=[];if(d.validate(i,a,n,I)&&(i=d.fromDer(t.util.createBuffer(n.privateKey))),n={},I=[],!d.validate(i,y,n,I)){var k=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw k.errors=I,k}var O,P,K,q,M,G,Y,W;return O=t.util.createBuffer(n.privateKeyModulus).toHex(),P=t.util.createBuffer(n.privateKeyPublicExponent).toHex(),K=t.util.createBuffer(n.privateKeyPrivateExponent).toHex(),q=t.util.createBuffer(n.privateKeyPrime1).toHex(),M=t.util.createBuffer(n.privateKeyPrime2).toHex(),G=t.util.createBuffer(n.privateKeyExponent1).toHex(),Y=t.util.createBuffer(n.privateKeyExponent2).toHex(),W=t.util.createBuffer(n.privateKeyCoefficient).toHex(),x.setRsaPrivateKey(new e(O,16),new e(P,16),new e(K,16),new e(q,16),new e(M,16),new e(G,16),new e(Y,16),new e(W,16))},x.privateKeyToAsn1=x.privateKeyToRSAPrivateKey=function(i){return d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,d.integerToDer(0).getBytes()),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,s(i.n)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,s(i.e)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,s(i.d)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,s(i.p)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,s(i.q)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,s(i.dP)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,s(i.dQ)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,s(i.qInv))])},x.publicKeyFromAsn1=function(i){var n={},I=[];if(d.validate(i,S,n,I)){var k=d.derToOid(n.publicKeyOid);if(k!==x.oids.rsaEncryption){var O=new Error("Cannot read public key. Unknown OID.");throw O.oid=k,O}i=n.rsaPublicKey}if(I=[],!d.validate(i,u,n,I)){var O=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw O.errors=I,O}var P=t.util.createBuffer(n.publicKeyModulus).toHex(),K=t.util.createBuffer(n.publicKeyExponent).toHex();return x.setRsaPublicKey(new e(P,16),new e(K,16))},x.publicKeyToAsn1=x.publicKeyToSubjectPublicKeyInfo=function(i){return d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.OID,!1,d.oidToDer(x.oids.rsaEncryption).getBytes()),d.create(d.Class.UNIVERSAL,d.Type.NULL,!1,"")]),d.create(d.Class.UNIVERSAL,d.Type.BITSTRING,!1,[x.publicKeyToRSAPublicKey(i)])])},x.publicKeyToRSAPublicKey=function(i){return d.create(d.Class.UNIVERSAL,d.Type.SEQUENCE,!0,[d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,s(i.n)),d.create(d.Class.UNIVERSAL,d.Type.INTEGER,!1,s(i.e))])};function v(i,n,I){var k=t.util.createBuffer(),O=Math.ceil(n.n.bitLength()/8);if(i.length>O-11){var P=new Error("Message is too long for PKCS#1 v1.5 padding.");throw P.length=i.length,P.max=O-11,P}k.putByte(0),k.putByte(I);var K=O-3-i.length,q;if(I===0||I===1){q=I===0?0:255;for(var M=0;M<K;++M)k.putByte(q)}else for(;K>0;){for(var G=0,Y=t.random.getBytes(K),M=0;M<K;++M)q=Y.charCodeAt(M),q===0?++G:k.putByte(q);K=G}return k.putByte(0),k.putBytes(i),k}function m(i,n,I,k,O){var P=Math.ceil(n.n.bitLength()/8),K=t.util.createBuffer(i),q=K.getByte(),M=K.getByte();if(q!==0||I&&M!==0&&M!==1||!I&&M!==2||I&&M===0&&typeof k>"u")throw new Error("Encryption block is invalid.");var G=0;if(M===0){G=P-3-k;for(var Y=0;Y<G;++Y)if(K.getByte()!==0)throw new Error("Encryption block is invalid.")}else if(M===1){for(G=0;K.length()>1;){if(K.getByte()!==255){--K.read;break}++G}if(G<8&&!(O&&O._skipPaddingChecks))throw new Error("Encryption block is invalid.")}else if(M===2){for(G=0;K.length()>1;){if(K.getByte()===0){--K.read;break}++G}if(G<8&&!(O&&O._skipPaddingChecks))throw new Error("Encryption block is invalid.")}var W=K.getByte();if(W!==0||G!==P-3-K.length())throw new Error("Encryption block is invalid.");return K.getBytes()}function g(i,n,I){typeof n=="function"&&(I=n,n={}),n=n||{};var k={algorithm:{name:n.algorithm||"PRIMEINC",options:{workers:n.workers||2,workLoad:n.workLoad||100,workerScript:n.workerScript}}};"prng"in n&&(k.prng=n.prng),O();function O(){P(i.pBits,function(q,M){if(q)return I(q);if(i.p=M,i.q!==null)return K(q,i.q);P(i.qBits,K)})}function P(q,M){t.prime.generateProbablePrime(q,k,M)}function K(q,M){if(q)return I(q);if(i.q=M,i.p.compareTo(i.q)<0){var G=i.p;i.p=i.q,i.q=G}if(i.p.subtract(e.ONE).gcd(i.e).compareTo(e.ONE)!==0){i.p=null,O();return}if(i.q.subtract(e.ONE).gcd(i.e).compareTo(e.ONE)!==0){i.q=null,P(i.qBits,K);return}if(i.p1=i.p.subtract(e.ONE),i.q1=i.q.subtract(e.ONE),i.phi=i.p1.multiply(i.q1),i.phi.gcd(i.e).compareTo(e.ONE)!==0){i.p=i.q=null,O();return}if(i.n=i.p.multiply(i.q),i.n.bitLength()!==i.bits){i.q=null,P(i.qBits,K);return}var Y=i.e.modInverse(i.phi);i.keys={privateKey:x.rsa.setPrivateKey(i.n,i.e,Y,i.p,i.q,Y.mod(i.p1),Y.mod(i.q1),i.q.modInverse(i.p)),publicKey:x.rsa.setPublicKey(i.n,i.e)},I(null,i.keys)}}function s(i){var n=i.toString(16);n[0]>="8"&&(n="00"+n);var I=t.util.hexToBytes(n);return I.length>1&&(I.charCodeAt(0)===0&&(I.charCodeAt(1)&128)===0||I.charCodeAt(0)===255&&(I.charCodeAt(1)&128)===128)?I.substr(1):I}function h(i){return i<=100?27:i<=150?18:i<=200?15:i<=250?12:i<=300?9:i<=350?8:i<=400?7:i<=500?6:i<=600?5:i<=800?4:i<=1250?3:2}function p(i){return t.util.isNodejs&&typeof r[i]=="function"}function A(i){return typeof T.globalScope<"u"&&typeof T.globalScope.crypto=="object"&&typeof T.globalScope.crypto.subtle=="object"&&typeof T.globalScope.crypto.subtle[i]=="function"}function R(i){return typeof T.globalScope<"u"&&typeof T.globalScope.msCrypto=="object"&&typeof T.globalScope.msCrypto.subtle=="object"&&typeof T.globalScope.msCrypto.subtle[i]=="function"}function c(i){for(var n=t.util.hexToBytes(i.toString(16)),I=new Uint8Array(n.length),k=0;k<n.length;++k)I[k]=n.charCodeAt(k);return I}return sr}var or,na;function Pa(){if(na)return or;na=1;var t=fe();if(ht(),it(),Lt(),ft(),pt(),Rr(),mt(),at(),ka(),Ut(),de(),typeof e>"u")var e=t.jsbn.BigInteger;var r=t.asn1,d=t.pki=t.pki||{};or=d.pbe=t.pbe=t.pbe||{};var T=d.oids,x={name:"EncryptedPrivateKeyInfo",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:r.Class.UNIVERSAL,type:r.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:r.Class.UNIVERSAL,type:r.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},l={name:"PBES2Algorithms",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:r.Class.UNIVERSAL,type:r.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:r.Class.UNIVERSAL,type:r.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:r.Class.UNIVERSAL,type:r.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:r.Class.UNIVERSAL,type:r.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:r.Class.UNIVERSAL,type:r.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:r.Class.UNIVERSAL,type:r.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:r.Class.UNIVERSAL,type:r.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},a={name:"pkcs-12PbeParams",tagClass:r.Class.UNIVERSAL,type:r.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:r.Class.UNIVERSAL,type:r.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:r.Class.UNIVERSAL,type:r.Type.INTEGER,constructed:!1,capture:"iterations"}]};d.encryptPrivateKeyInfo=function(E,f,v){v=v||{},v.saltSize=v.saltSize||8,v.count=v.count||2048,v.algorithm=v.algorithm||"aes128",v.prfAlgorithm=v.prfAlgorithm||"sha1";var m=t.random.getBytesSync(v.saltSize),g=v.count,s=r.integerToDer(g),h,p,A;if(v.algorithm.indexOf("aes")===0||v.algorithm==="des"){var R,c,i;switch(v.algorithm){case"aes128":h=16,R=16,c=T["aes128-CBC"],i=t.aes.createEncryptionCipher;break;case"aes192":h=24,R=16,c=T["aes192-CBC"],i=t.aes.createEncryptionCipher;break;case"aes256":h=32,R=16,c=T["aes256-CBC"],i=t.aes.createEncryptionCipher;break;case"des":h=8,R=8,c=T.desCBC,i=t.des.createEncryptionCipher;break;default:var n=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw n.algorithm=v.algorithm,n}var I="hmacWith"+v.prfAlgorithm.toUpperCase(),k=S(I),O=t.pkcs5.pbkdf2(f,m,g,h,k),P=t.random.getBytesSync(R),K=i(O);K.start(P),K.update(r.toDer(E)),K.finish(),A=K.output.getBytes();var q=U(m,s,h,I);p=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(T.pkcs5PBES2).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(T.pkcs5PBKDF2).getBytes()),q]),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(c).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,P)])])])}else if(v.algorithm==="3des"){h=24;var M=new t.util.ByteBuffer(m),O=d.pbe.generatePkcs12Key(f,M,1,g,h),P=d.pbe.generatePkcs12Key(f,M,2,g,h),K=t.des.createEncryptionCipher(O);K.start(P),K.update(r.toDer(E)),K.finish(),A=K.output.getBytes(),p=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(T["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,m),r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,s.getBytes())])])}else{var n=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw n.algorithm=v.algorithm,n}var G=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[p,r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,A)]);return G},d.decryptPrivateKeyInfo=function(E,f){var v=null,m={},g=[];if(!r.validate(E,x,m,g)){var s=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=g,s}var h=r.derToOid(m.encryptionOid),p=d.pbe.getCipher(h,m.encryptionParams,f),A=t.util.createBuffer(m.encryptedData);return p.update(A),p.finish()&&(v=r.fromDer(p.output)),v},d.encryptedPrivateKeyToPem=function(E,f){var v={type:"ENCRYPTED PRIVATE KEY",body:r.toDer(E).getBytes()};return t.pem.encode(v,{maxline:f})},d.encryptedPrivateKeyFromPem=function(E){var f=t.pem.decode(E)[0];if(f.type!=="ENCRYPTED PRIVATE KEY"){var v=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw v.headerType=f.type,v}if(f.procType&&f.procType.type==="ENCRYPTED")throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return r.fromDer(f.body)},d.encryptRsaPrivateKey=function(E,f,v){if(v=v||{},!v.legacy){var m=d.wrapRsaPrivateKey(d.privateKeyToAsn1(E));return m=d.encryptPrivateKeyInfo(m,f,v),d.encryptedPrivateKeyToPem(m)}var g,s,h,p;switch(v.algorithm){case"aes128":g="AES-128-CBC",h=16,s=t.random.getBytesSync(16),p=t.aes.createEncryptionCipher;break;case"aes192":g="AES-192-CBC",h=24,s=t.random.getBytesSync(16),p=t.aes.createEncryptionCipher;break;case"aes256":g="AES-256-CBC",h=32,s=t.random.getBytesSync(16),p=t.aes.createEncryptionCipher;break;case"3des":g="DES-EDE3-CBC",h=24,s=t.random.getBytesSync(8),p=t.des.createEncryptionCipher;break;case"des":g="DES-CBC",h=8,s=t.random.getBytesSync(8),p=t.des.createEncryptionCipher;break;default:var A=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+v.algorithm+'".');throw A.algorithm=v.algorithm,A}var R=t.pbe.opensslDeriveBytes(f,s.substr(0,8),h),c=p(R);c.start(s),c.update(r.toDer(d.privateKeyToAsn1(E))),c.finish();var i={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:g,parameters:t.util.bytesToHex(s).toUpperCase()},body:c.output.getBytes()};return t.pem.encode(i)},d.decryptRsaPrivateKey=function(E,f){var v=null,m=t.pem.decode(E)[0];if(m.type!=="ENCRYPTED PRIVATE KEY"&&m.type!=="PRIVATE KEY"&&m.type!=="RSA PRIVATE KEY"){var g=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".');throw g.headerType=g,g}if(m.procType&&m.procType.type==="ENCRYPTED"){var s,h;switch(m.dekInfo.algorithm){case"DES-CBC":s=8,h=t.des.createDecryptionCipher;break;case"DES-EDE3-CBC":s=24,h=t.des.createDecryptionCipher;break;case"AES-128-CBC":s=16,h=t.aes.createDecryptionCipher;break;case"AES-192-CBC":s=24,h=t.aes.createDecryptionCipher;break;case"AES-256-CBC":s=32,h=t.aes.createDecryptionCipher;break;case"RC2-40-CBC":s=5,h=function(i){return t.rc2.createDecryptionCipher(i,40)};break;case"RC2-64-CBC":s=8,h=function(i){return t.rc2.createDecryptionCipher(i,64)};break;case"RC2-128-CBC":s=16,h=function(i){return t.rc2.createDecryptionCipher(i,128)};break;default:var g=new Error('Could not decrypt private key; unsupported encryption algorithm "'+m.dekInfo.algorithm+'".');throw g.algorithm=m.dekInfo.algorithm,g}var p=t.util.hexToBytes(m.dekInfo.parameters),A=t.pbe.opensslDeriveBytes(f,p.substr(0,8),s),R=h(A);if(R.start(p),R.update(t.util.createBuffer(m.body)),R.finish())v=R.output.getBytes();else return v}else v=m.body;return m.type==="ENCRYPTED PRIVATE KEY"?v=d.decryptPrivateKeyInfo(r.fromDer(v),f):v=r.fromDer(v),v!==null&&(v=d.privateKeyFromAsn1(v)),v},d.pbe.generatePkcs12Key=function(E,f,v,m,g,s){var h,p;if(typeof s>"u"||s===null){if(!("sha1"in t.md))throw new Error('"sha1" hash algorithm unavailable.');s=t.md.sha1.create()}var A=s.digestLength,R=s.blockLength,c=new t.util.ByteBuffer,i=new t.util.ByteBuffer;if(E!=null){for(p=0;p<E.length;p++)i.putInt16(E.charCodeAt(p));i.putInt16(0)}var n=i.length(),I=f.length(),k=new t.util.ByteBuffer;k.fillWithByte(v,R);var O=R*Math.ceil(I/R),P=new t.util.ByteBuffer;for(p=0;p<O;p++)P.putByte(f.at(p%I));var K=R*Math.ceil(n/R),q=new t.util.ByteBuffer;for(p=0;p<K;p++)q.putByte(i.at(p%n));var M=P;M.putBuffer(q);for(var G=Math.ceil(g/A),Y=1;Y<=G;Y++){var W=new t.util.ByteBuffer;W.putBytes(k.bytes()),W.putBytes(M.bytes());for(var ee=0;ee<m;ee++)s.start(),s.update(W.getBytes()),W=s.digest();var ne=new t.util.ByteBuffer;for(p=0;p<R;p++)ne.putByte(W.at(p%A));var ie=Math.ceil(I/R)+Math.ceil(n/R),ce=new t.util.ByteBuffer;for(h=0;h<ie;h++){var ve=new t.util.ByteBuffer(M.getBytes(R)),ue=511;for(p=ne.length()-1;p>=0;p--)ue=ue>>8,ue+=ne.at(p)+ve.at(p),ve.setAt(p,ue&255);ce.putBuffer(ve)}M=ce,c.putBuffer(W)}return c.truncate(c.length()-g),c},d.pbe.getCipher=function(E,f,v){switch(E){case d.oids.pkcs5PBES2:return d.pbe.getCipherForPBES2(E,f,v);case d.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case d.oids["pbewithSHAAnd40BitRC2-CBC"]:return d.pbe.getCipherForPKCS12PBE(E,f,v);default:var m=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw m.oid=E,m.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],m}},d.pbe.getCipherForPBES2=function(E,f,v){var m={},g=[];if(!r.validate(f,l,m,g)){var s=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=g,s}if(E=r.derToOid(m.kdfOid),E!==d.oids.pkcs5PBKDF2){var s=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.");throw s.oid=E,s.supportedOids=["pkcs5PBKDF2"],s}if(E=r.derToOid(m.encOid),E!==d.oids["aes128-CBC"]&&E!==d.oids["aes192-CBC"]&&E!==d.oids["aes256-CBC"]&&E!==d.oids["des-EDE3-CBC"]&&E!==d.oids.desCBC){var s=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.");throw s.oid=E,s.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],s}var h=m.kdfSalt,p=t.util.createBuffer(m.kdfIterationCount);p=p.getInt(p.length()<<3);var A,R;switch(d.oids[E]){case"aes128-CBC":A=16,R=t.aes.createDecryptionCipher;break;case"aes192-CBC":A=24,R=t.aes.createDecryptionCipher;break;case"aes256-CBC":A=32,R=t.aes.createDecryptionCipher;break;case"des-EDE3-CBC":A=24,R=t.des.createDecryptionCipher;break;case"desCBC":A=8,R=t.des.createDecryptionCipher;break}var c=u(m.prfOid),i=t.pkcs5.pbkdf2(v,h,p,A,c),n=m.encIv,I=R(i);return I.start(n),I},d.pbe.getCipherForPKCS12PBE=function(E,f,v){var m={},g=[];if(!r.validate(f,a,m,g)){var s=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw s.errors=g,s}var h=t.util.createBuffer(m.salt),p=t.util.createBuffer(m.iterations);p=p.getInt(p.length()<<3);var A,R,c;switch(E){case d.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:A=24,R=8,c=t.des.startDecrypting;break;case d.oids["pbewithSHAAnd40BitRC2-CBC"]:A=5,R=8,c=function(O,P){var K=t.rc2.createDecryptionCipher(O,40);return K.start(P,null),K};break;default:var s=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw s.oid=E,s}var i=u(m.prfOid),n=d.pbe.generatePkcs12Key(v,h,1,p,A,i);i.start();var I=d.pbe.generatePkcs12Key(v,h,2,p,R,i);return c(n,I)},d.pbe.opensslDeriveBytes=function(E,f,v,m){if(typeof m>"u"||m===null){if(!("md5"in t.md))throw new Error('"md5" hash algorithm unavailable.');m=t.md.md5.create()}f===null&&(f="");for(var g=[y(m,E+f)],s=16,h=1;s<v;++h,s+=16)g.push(y(m,g[h-1]+E+f));return g.join("").substr(0,v)};function y(E,f){return E.start().update(f).digest().getBytes()}function u(E){var f;if(!E)f="hmacWithSHA1";else if(f=d.oids[r.derToOid(E)],!f){var v=new Error("Unsupported PRF OID.");throw v.oid=E,v.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],v}return S(f)}function S(E){var f=t.md;switch(E){case"hmacWithSHA224":f=t.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":E=E.substr(8).toLowerCase();break;default:var v=new Error("Unsupported PRF algorithm.");throw v.algorithm=E,v.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],v}if(!f||!(E in f))throw new Error("Unknown hash algorithm: "+E);return f[E].create()}function U(E,f,v,m){var g=r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OCTETSTRING,!1,E),r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,f.getBytes())]);return m!=="hmacWithSHA1"&&g.value.push(r.create(r.Class.UNIVERSAL,r.Type.INTEGER,!1,t.util.hexToBytes(v.toString(16))),r.create(r.Class.UNIVERSAL,r.Type.SEQUENCE,!0,[r.create(r.Class.UNIVERSAL,r.Type.OID,!1,r.oidToDer(d.oids[m]).getBytes()),r.create(r.Class.UNIVERSAL,r.Type.NULL,!1,"")])),g}return or}var fr={exports:{}},ur={exports:{}},ia;function Va(){if(ia)return ur.exports;ia=1;var t=fe();it(),de();var e=t.asn1,r=ur.exports=t.pkcs7asn1=t.pkcs7asn1||{};t.pkcs7=t.pkcs7||{},t.pkcs7.asn1=r;var d={name:"ContentInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};r.contentInfoValidator=d;var T={name:"EncryptedContentInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:e.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};r.envelopedDataValidator={name:"EnvelopedData",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(T)},r.encryptedDataValidator={name:"EncryptedData",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"}].concat(T)};var x={name:"SignerInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:e.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:e.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};return r.signedDataValidator={name:"SignedData",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},d,{name:"SignedData.Certificates",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:e.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,capture:"signerInfos",optional:!0,value:[x]}]},r.recipientInfoValidator={name:"RecipientInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:e.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter",optional:!0}]},{name:"RecipientInfo.encryptedKey",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]},ur.exports}var lr={exports:{}},cr={exports:{}},sa;function Oa(){if(sa)return cr.exports;sa=1;var t=fe();de(),t.mgf=t.mgf||{};var e=cr.exports=t.mgf.mgf1=t.mgf1=t.mgf1||{};return e.create=function(r){var d={generate:function(T,x){for(var l=new t.util.ByteBuffer,a=Math.ceil(x/r.digestLength),y=0;y<a;y++){var u=new t.util.ByteBuffer;u.putInt32(y),r.start(),r.update(T+u.getBytes()),l.putBuffer(r.digest())}return l.truncate(l.length()-x),l.getBytes()}};return d},cr.exports}var dr,oa;function bn(){if(oa)return dr;oa=1;var t=fe();return Oa(),dr=t.mgf=t.mgf||{},t.mgf.mgf1=t.mgf1,dr}var hr={exports:{}},fa;function Lr(){if(fa)return hr.exports;fa=1;var t=fe();at(),de();var e=hr.exports=t.pss=t.pss||{};return e.create=function(r){arguments.length===3&&(r={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var d=r.md,T=r.mgf,x=d.digestLength,l=r.salt||null;typeof l=="string"&&(l=t.util.createBuffer(l));var a;if("saltLength"in r)a=r.saltLength;else if(l!==null)a=l.length();else throw new Error("Salt length not specified or specific salt not given.");if(l!==null&&l.length()!==a)throw new Error("Given salt length does not match length of given salt.");var y=r.prng||t.random,u={};return u.encode=function(S,U){var E,f=U-1,v=Math.ceil(f/8),m=S.digest().getBytes();if(v<x+a+2)throw new Error("Message is too long to encrypt.");var g;l===null?g=y.getBytesSync(a):g=l.bytes();var s=new t.util.ByteBuffer;s.fillWithByte(0,8),s.putBytes(m),s.putBytes(g),d.start(),d.update(s.getBytes());var h=d.digest().getBytes(),p=new t.util.ByteBuffer;p.fillWithByte(0,v-a-x-2),p.putByte(1),p.putBytes(g);var A=p.getBytes(),R=v-x-1,c=T.generate(h,R),i="";for(E=0;E<R;E++)i+=String.fromCharCode(A.charCodeAt(E)^c.charCodeAt(E));var n=65280>>8*v-f&255;return i=String.fromCharCode(i.charCodeAt(0)&~n)+i.substr(1),i+h+"¼"},u.verify=function(S,U,E){var f,v=E-1,m=Math.ceil(v/8);if(U=U.substr(-m),m<x+a+2)throw new Error("Inconsistent parameters to PSS signature verification.");if(U.charCodeAt(m-1)!==188)throw new Error("Encoded message does not end in 0xBC.");var g=m-x-1,s=U.substr(0,g),h=U.substr(g,x),p=65280>>8*m-v&255;if((s.charCodeAt(0)&p)!==0)throw new Error("Bits beyond keysize not zero as expected.");var A=T.generate(h,g),R="";for(f=0;f<g;f++)R+=String.fromCharCode(s.charCodeAt(f)^A.charCodeAt(f));R=String.fromCharCode(R.charCodeAt(0)&~p)+R.substr(1);var c=m-x-a-2;for(f=0;f<c;f++)if(R.charCodeAt(f)!==0)throw new Error("Leftmost octets not zero as expected");if(R.charCodeAt(c)!==1)throw new Error("Inconsistent PSS signature, 0x01 marker not found");var i=R.substr(-a),n=new t.util.ByteBuffer;n.fillWithByte(0,8),n.putBytes(S),n.putBytes(i),d.start(),d.update(n.getBytes());var I=d.digest().getBytes();return h===I},u},hr.exports}var ua;function kr(){if(ua)return lr.exports;ua=1;var t=fe();ht(),it(),Lt(),ft(),bn(),pt(),mt(),Lr(),Ut(),de();var e=t.asn1,r=lr.exports=t.pki=t.pki||{},d=r.oids,T={};T.CN=d.commonName,T.commonName="CN",T.C=d.countryName,T.countryName="C",T.L=d.localityName,T.localityName="L",T.ST=d.stateOrProvinceName,T.stateOrProvinceName="ST",T.O=d.organizationName,T.organizationName="O",T.OU=d.organizationalUnitName,T.organizationalUnitName="OU",T.E=d.emailAddress,T.emailAddress="E";var x=t.pki.rsa.publicKeyValidator,l={name:"Certificate",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:e.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:e.Class.UNIVERSAL,type:e.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:e.Class.UNIVERSAL,type:e.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:e.Class.UNIVERSAL,type:e.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:e.Class.UNIVERSAL,type:e.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},x,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:e.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:e.Class.UNIVERSAL,type:e.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:e.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:e.Class.UNIVERSAL,type:e.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:e.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:e.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:e.Class.UNIVERSAL,type:e.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},a={name:"rsapss",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:e.Class.UNIVERSAL,type:e.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:e.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:e.Class.UNIVERSAL,type:e.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:e.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:e.Class.UNIVERSAL,type:e.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:e.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:e.Class.UNIVERSAL,type:e.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},y={name:"CertificationRequestInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},x,{name:"CertificationRequestInfo.attributes",tagClass:e.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,constructed:!0}]}]}]},u={name:"CertificationRequest",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[y,{name:"CertificationRequest.signatureAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:e.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:e.Class.UNIVERSAL,type:e.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};r.RDNAttributesAsArray=function(c,i){for(var n=[],I,k,O,P=0;P<c.value.length;++P){I=c.value[P];for(var K=0;K<I.value.length;++K)O={},k=I.value[K],O.type=e.derToOid(k.value[0].value),O.value=k.value[1].value,O.valueTagClass=k.value[1].type,O.type in d&&(O.name=d[O.type],O.name in T&&(O.shortName=T[O.name])),i&&(i.update(O.type),i.update(O.value)),n.push(O)}return n},r.CRIAttributesAsArray=function(c){for(var i=[],n=0;n<c.length;++n)for(var I=c[n],k=e.derToOid(I.value[0].value),O=I.value[1].value,P=0;P<O.length;++P){var K={};if(K.type=k,K.value=O[P].value,K.valueTagClass=O[P].type,K.type in d&&(K.name=d[K.type],K.name in T&&(K.shortName=T[K.name])),K.type===d.extensionRequest){K.extensions=[];for(var q=0;q<K.value.length;++q)K.extensions.push(r.certificateExtensionFromAsn1(K.value[q]))}i.push(K)}return i};function S(c,i){typeof i=="string"&&(i={shortName:i});for(var n=null,I,k=0;n===null&&k<c.attributes.length;++k)I=c.attributes[k],(i.type&&i.type===I.type||i.name&&i.name===I.name||i.shortName&&i.shortName===I.shortName)&&(n=I);return n}var U=function(c,i,n){var I={};if(c!==d["RSASSA-PSS"])return I;n&&(I={hash:{algorithmOid:d.sha1},mgf:{algorithmOid:d.mgf1,hash:{algorithmOid:d.sha1}},saltLength:20});var k={},O=[];if(!e.validate(i,a,k,O)){var P=new Error("Cannot read RSASSA-PSS parameter block.");throw P.errors=O,P}return k.hashOid!==void 0&&(I.hash=I.hash||{},I.hash.algorithmOid=e.derToOid(k.hashOid)),k.maskGenOid!==void 0&&(I.mgf=I.mgf||{},I.mgf.algorithmOid=e.derToOid(k.maskGenOid),I.mgf.hash=I.mgf.hash||{},I.mgf.hash.algorithmOid=e.derToOid(k.maskGenHashOid)),k.saltLength!==void 0&&(I.saltLength=k.saltLength.charCodeAt(0)),I},E=function(c){switch(d[c.signatureOid]){case"sha1WithRSAEncryption":case"sha1WithRSASignature":return t.md.sha1.create();case"md5WithRSAEncryption":return t.md.md5.create();case"sha256WithRSAEncryption":return t.md.sha256.create();case"sha384WithRSAEncryption":return t.md.sha384.create();case"sha512WithRSAEncryption":return t.md.sha512.create();case"RSASSA-PSS":return t.md.sha256.create();default:var i=new Error("Could not compute "+c.type+" digest. Unknown signature OID.");throw i.signatureOid=c.signatureOid,i}},f=function(c){var i=c.certificate,n;switch(i.signatureOid){case d.sha1WithRSAEncryption:case d.sha1WithRSASignature:break;case d["RSASSA-PSS"]:var I,k;if(I=d[i.signatureParameters.mgf.hash.algorithmOid],I===void 0||t.md[I]===void 0){var O=new Error("Unsupported MGF hash function.");throw O.oid=i.signatureParameters.mgf.hash.algorithmOid,O.name=I,O}if(k=d[i.signatureParameters.mgf.algorithmOid],k===void 0||t.mgf[k]===void 0){var O=new Error("Unsupported MGF function.");throw O.oid=i.signatureParameters.mgf.algorithmOid,O.name=k,O}if(k=t.mgf[k].create(t.md[I].create()),I=d[i.signatureParameters.hash.algorithmOid],I===void 0||t.md[I]===void 0){var O=new Error("Unsupported RSASSA-PSS hash function.");throw O.oid=i.signatureParameters.hash.algorithmOid,O.name=I,O}n=t.pss.create(t.md[I].create(),k,i.signatureParameters.saltLength);break}return i.publicKey.verify(c.md.digest().getBytes(),c.signature,n)};r.certificateFromPem=function(c,i,n){var I=t.pem.decode(c)[0];if(I.type!=="CERTIFICATE"&&I.type!=="X509 CERTIFICATE"&&I.type!=="TRUSTED CERTIFICATE"){var k=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw k.headerType=I.type,k}if(I.procType&&I.procType.type==="ENCRYPTED")throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var O=e.fromDer(I.body,n);return r.certificateFromAsn1(O,i)},r.certificateToPem=function(c,i){var n={type:"CERTIFICATE",body:e.toDer(r.certificateToAsn1(c)).getBytes()};return t.pem.encode(n,{maxline:i})},r.publicKeyFromPem=function(c){var i=t.pem.decode(c)[0];if(i.type!=="PUBLIC KEY"&&i.type!=="RSA PUBLIC KEY"){var n=new Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');throw n.headerType=i.type,n}if(i.procType&&i.procType.type==="ENCRYPTED")throw new Error("Could not convert public key from PEM; PEM is encrypted.");var I=e.fromDer(i.body);return r.publicKeyFromAsn1(I)},r.publicKeyToPem=function(c,i){var n={type:"PUBLIC KEY",body:e.toDer(r.publicKeyToAsn1(c)).getBytes()};return t.pem.encode(n,{maxline:i})},r.publicKeyToRSAPublicKeyPem=function(c,i){var n={type:"RSA PUBLIC KEY",body:e.toDer(r.publicKeyToRSAPublicKey(c)).getBytes()};return t.pem.encode(n,{maxline:i})},r.getPublicKeyFingerprint=function(c,i){i=i||{};var n=i.md||t.md.sha1.create(),I=i.type||"RSAPublicKey",k;switch(I){case"RSAPublicKey":k=e.toDer(r.publicKeyToRSAPublicKey(c)).getBytes();break;case"SubjectPublicKeyInfo":k=e.toDer(r.publicKeyToAsn1(c)).getBytes();break;default:throw new Error('Unknown fingerprint type "'+i.type+'".')}n.start(),n.update(k);var O=n.digest();if(i.encoding==="hex"){var P=O.toHex();return i.delimiter?P.match(/.{2}/g).join(i.delimiter):P}else{if(i.encoding==="binary")return O.getBytes();if(i.encoding)throw new Error('Unknown encoding "'+i.encoding+'".')}return O},r.certificationRequestFromPem=function(c,i,n){var I=t.pem.decode(c)[0];if(I.type!=="CERTIFICATE REQUEST"){var k=new Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw k.headerType=I.type,k}if(I.procType&&I.procType.type==="ENCRYPTED")throw new Error("Could not convert certification request from PEM; PEM is encrypted.");var O=e.fromDer(I.body,n);return r.certificationRequestFromAsn1(O,i)},r.certificationRequestToPem=function(c,i){var n={type:"CERTIFICATE REQUEST",body:e.toDer(r.certificationRequestToAsn1(c)).getBytes()};return t.pem.encode(n,{maxline:i})},r.createCertificate=function(){var c={};return c.version=2,c.serialNumber="00",c.signatureOid=null,c.signature=null,c.siginfo={},c.siginfo.algorithmOid=null,c.validity={},c.validity.notBefore=new Date,c.validity.notAfter=new Date,c.issuer={},c.issuer.getField=function(i){return S(c.issuer,i)},c.issuer.addField=function(i){m([i]),c.issuer.attributes.push(i)},c.issuer.attributes=[],c.issuer.hash=null,c.subject={},c.subject.getField=function(i){return S(c.subject,i)},c.subject.addField=function(i){m([i]),c.subject.attributes.push(i)},c.subject.attributes=[],c.subject.hash=null,c.extensions=[],c.publicKey=null,c.md=null,c.setSubject=function(i,n){m(i),c.subject.attributes=i,delete c.subject.uniqueId,n&&(c.subject.uniqueId=n),c.subject.hash=null},c.setIssuer=function(i,n){m(i),c.issuer.attributes=i,delete c.issuer.uniqueId,n&&(c.issuer.uniqueId=n),c.issuer.hash=null},c.setExtensions=function(i){for(var n=0;n<i.length;++n)g(i[n],{cert:c});c.extensions=i},c.getExtension=function(i){typeof i=="string"&&(i={name:i});for(var n=null,I,k=0;n===null&&k<c.extensions.length;++k)I=c.extensions[k],(i.id&&I.id===i.id||i.name&&I.name===i.name)&&(n=I);return n},c.sign=function(i,n){c.md=n||t.md.sha1.create();var I=d[c.md.algorithm+"WithRSAEncryption"];if(!I){var k=new Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw k.algorithm=c.md.algorithm,k}c.signatureOid=c.siginfo.algorithmOid=I,c.tbsCertificate=r.getTBSCertificate(c);var O=e.toDer(c.tbsCertificate);c.md.update(O.getBytes()),c.signature=i.sign(c.md)},c.verify=function(i){var n=!1;if(!c.issued(i)){var I=i.issuer,k=c.subject,O=new Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.");throw O.expectedIssuer=k.attributes,O.actualIssuer=I.attributes,O}var P=i.md;if(P===null){P=E({signatureOid:i.signatureOid,type:"certificate"});var K=i.tbsCertificate||r.getTBSCertificate(i),q=e.toDer(K);P.update(q.getBytes())}return P!==null&&(n=f({certificate:c,md:P,signature:i.signature})),n},c.isIssuer=function(i){var n=!1,I=c.issuer,k=i.subject;if(I.hash&&k.hash)n=I.hash===k.hash;else if(I.attributes.length===k.attributes.length){n=!0;for(var O,P,K=0;n&&K<I.attributes.length;++K)O=I.attributes[K],P=k.attributes[K],(O.type!==P.type||O.value!==P.value)&&(n=!1)}return n},c.issued=function(i){return i.isIssuer(c)},c.generateSubjectKeyIdentifier=function(){return r.getPublicKeyFingerprint(c.publicKey,{type:"RSAPublicKey"})},c.verifySubjectKeyIdentifier=function(){for(var i=d.subjectKeyIdentifier,n=0;n<c.extensions.length;++n){var I=c.extensions[n];if(I.id===i){var k=c.generateSubjectKeyIdentifier().getBytes();return t.util.hexToBytes(I.subjectKeyIdentifier)===k}}return!1},c},r.certificateFromAsn1=function(c,i){var n={},I=[];if(!e.validate(c,l,n,I)){var k=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.");throw k.errors=I,k}var O=e.derToOid(n.publicKeyOid);if(O!==r.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var P=r.createCertificate();P.version=n.certVersion?n.certVersion.charCodeAt(0):0;var K=t.util.createBuffer(n.certSerialNumber);P.serialNumber=K.toHex(),P.signatureOid=t.asn1.derToOid(n.certSignatureOid),P.signatureParameters=U(P.signatureOid,n.certSignatureParams,!0),P.siginfo.algorithmOid=t.asn1.derToOid(n.certinfoSignatureOid),P.siginfo.parameters=U(P.siginfo.algorithmOid,n.certinfoSignatureParams,!1),P.signature=n.certSignature;var q=[];if(n.certValidity1UTCTime!==void 0&&q.push(e.utcTimeToDate(n.certValidity1UTCTime)),n.certValidity2GeneralizedTime!==void 0&&q.push(e.generalizedTimeToDate(n.certValidity2GeneralizedTime)),n.certValidity3UTCTime!==void 0&&q.push(e.utcTimeToDate(n.certValidity3UTCTime)),n.certValidity4GeneralizedTime!==void 0&&q.push(e.generalizedTimeToDate(n.certValidity4GeneralizedTime)),q.length>2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(q.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(P.validity.notBefore=q[0],P.validity.notAfter=q[1],P.tbsCertificate=n.tbsCertificate,i){P.md=E({signatureOid:P.signatureOid,type:"certificate"});var M=e.toDer(P.tbsCertificate);P.md.update(M.getBytes())}var G=t.md.sha1.create(),Y=e.toDer(n.certIssuer);G.update(Y.getBytes()),P.issuer.getField=function(ne){return S(P.issuer,ne)},P.issuer.addField=function(ne){m([ne]),P.issuer.attributes.push(ne)},P.issuer.attributes=r.RDNAttributesAsArray(n.certIssuer),n.certIssuerUniqueId&&(P.issuer.uniqueId=n.certIssuerUniqueId),P.issuer.hash=G.digest().toHex();var W=t.md.sha1.create(),ee=e.toDer(n.certSubject);return W.update(ee.getBytes()),P.subject.getField=function(ne){return S(P.subject,ne)},P.subject.addField=function(ne){m([ne]),P.subject.attributes.push(ne)},P.subject.attributes=r.RDNAttributesAsArray(n.certSubject),n.certSubjectUniqueId&&(P.subject.uniqueId=n.certSubjectUniqueId),P.subject.hash=W.digest().toHex(),n.certExtensions?P.extensions=r.certificateExtensionsFromAsn1(n.certExtensions):P.extensions=[],P.publicKey=r.publicKeyFromAsn1(n.subjectPublicKeyInfo),P},r.certificateExtensionsFromAsn1=function(c){for(var i=[],n=0;n<c.value.length;++n)for(var I=c.value[n],k=0;k<I.value.length;++k)i.push(r.certificateExtensionFromAsn1(I.value[k]));return i},r.certificateExtensionFromAsn1=function(c){var i={};if(i.id=e.derToOid(c.value[0].value),i.critical=!1,c.value[1].type===e.Type.BOOLEAN?(i.critical=c.value[1].value.charCodeAt(0)!==0,i.value=c.value[2].value):i.value=c.value[1].value,i.id in d){if(i.name=d[i.id],i.name==="keyUsage"){var n=e.fromDer(i.value),I=0,k=0;n.value.length>1&&(I=n.value.charCodeAt(1),k=n.value.length>2?n.value.charCodeAt(2):0),i.digitalSignature=(I&128)===128,i.nonRepudiation=(I&64)===64,i.keyEncipherment=(I&32)===32,i.dataEncipherment=(I&16)===16,i.keyAgreement=(I&8)===8,i.keyCertSign=(I&4)===4,i.cRLSign=(I&2)===2,i.encipherOnly=(I&1)===1,i.decipherOnly=(k&128)===128}else if(i.name==="basicConstraints"){var n=e.fromDer(i.value);n.value.length>0&&n.value[0].type===e.Type.BOOLEAN?i.cA=n.value[0].value.charCodeAt(0)!==0:i.cA=!1;var O=null;n.value.length>0&&n.value[0].type===e.Type.INTEGER?O=n.value[0].value:n.value.length>1&&(O=n.value[1].value),O!==null&&(i.pathLenConstraint=e.derToInteger(O))}else if(i.name==="extKeyUsage")for(var n=e.fromDer(i.value),P=0;P<n.value.length;++P){var K=e.derToOid(n.value[P].value);K in d?i[d[K]]=!0:i[K]=!0}else if(i.name==="nsCertType"){var n=e.fromDer(i.value),I=0;n.value.length>1&&(I=n.value.charCodeAt(1)),i.client=(I&128)===128,i.server=(I&64)===64,i.email=(I&32)===32,i.objsign=(I&16)===16,i.reserved=(I&8)===8,i.sslCA=(I&4)===4,i.emailCA=(I&2)===2,i.objCA=(I&1)===1}else if(i.name==="subjectAltName"||i.name==="issuerAltName"){i.altNames=[];for(var q,n=e.fromDer(i.value),M=0;M<n.value.length;++M){q=n.value[M];var G={type:q.type,value:q.value};switch(i.altNames.push(G),q.type){case 1:case 2:case 6:break;case 7:G.ip=t.util.bytesToIP(q.value);break;case 8:G.oid=e.derToOid(q.value);break}}}else if(i.name==="subjectKeyIdentifier"){var n=e.fromDer(i.value);i.subjectKeyIdentifier=t.util.bytesToHex(n.value)}}return i},r.certificationRequestFromAsn1=function(c,i){var n={},I=[];if(!e.validate(c,u,n,I)){var k=new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.");throw k.errors=I,k}var O=e.derToOid(n.publicKeyOid);if(O!==r.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var P=r.createCertificationRequest();if(P.version=n.csrVersion?n.csrVersion.charCodeAt(0):0,P.signatureOid=t.asn1.derToOid(n.csrSignatureOid),P.signatureParameters=U(P.signatureOid,n.csrSignatureParams,!0),P.siginfo.algorithmOid=t.asn1.derToOid(n.csrSignatureOid),P.siginfo.parameters=U(P.siginfo.algorithmOid,n.csrSignatureParams,!1),P.signature=n.csrSignature,P.certificationRequestInfo=n.certificationRequestInfo,i){P.md=E({signatureOid:P.signatureOid,type:"certification request"});var K=e.toDer(P.certificationRequestInfo);P.md.update(K.getBytes())}var q=t.md.sha1.create();return P.subject.getField=function(M){return S(P.subject,M)},P.subject.addField=function(M){m([M]),P.subject.attributes.push(M)},P.subject.attributes=r.RDNAttributesAsArray(n.certificationRequestInfoSubject,q),P.subject.hash=q.digest().toHex(),P.publicKey=r.publicKeyFromAsn1(n.subjectPublicKeyInfo),P.getAttribute=function(M){return S(P,M)},P.addAttribute=function(M){m([M]),P.attributes.push(M)},P.attributes=r.CRIAttributesAsArray(n.certificationRequestInfoAttributes||[]),P},r.createCertificationRequest=function(){var c={};return c.version=0,c.signatureOid=null,c.signature=null,c.siginfo={},c.siginfo.algorithmOid=null,c.subject={},c.subject.getField=function(i){return S(c.subject,i)},c.subject.addField=function(i){m([i]),c.subject.attributes.push(i)},c.subject.attributes=[],c.subject.hash=null,c.publicKey=null,c.attributes=[],c.getAttribute=function(i){return S(c,i)},c.addAttribute=function(i){m([i]),c.attributes.push(i)},c.md=null,c.setSubject=function(i){m(i),c.subject.attributes=i,c.subject.hash=null},c.setAttributes=function(i){m(i),c.attributes=i},c.sign=function(i,n){c.md=n||t.md.sha1.create();var I=d[c.md.algorithm+"WithRSAEncryption"];if(!I){var k=new Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw k.algorithm=c.md.algorithm,k}c.signatureOid=c.siginfo.algorithmOid=I,c.certificationRequestInfo=r.getCertificationRequestInfo(c);var O=e.toDer(c.certificationRequestInfo);c.md.update(O.getBytes()),c.signature=i.sign(c.md)},c.verify=function(){var i=!1,n=c.md;if(n===null){n=E({signatureOid:c.signatureOid,type:"certification request"});var I=c.certificationRequestInfo||r.getCertificationRequestInfo(c),k=e.toDer(I);n.update(k.getBytes())}return n!==null&&(i=f({certificate:c,md:n,signature:c.signature})),i},c};function v(c){for(var i=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]),n,I,k=c.attributes,O=0;O<k.length;++O){n=k[O];var P=n.value,K=e.Type.PRINTABLESTRING;"valueTagClass"in n&&(K=n.valueTagClass,K===e.Type.UTF8&&(P=t.util.encodeUtf8(P))),I=e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(n.type).getBytes()),e.create(e.Class.UNIVERSAL,K,!1,P)])]),i.value.push(I)}return i}function m(c){for(var i,n=0;n<c.length;++n){if(i=c[n],typeof i.name>"u"&&(i.type&&i.type in r.oids?i.name=r.oids[i.type]:i.shortName&&i.shortName in T&&(i.name=r.oids[T[i.shortName]])),typeof i.type>"u")if(i.name&&i.name in r.oids)i.type=r.oids[i.name];else{var I=new Error("Attribute type not specified.");throw I.attribute=i,I}if(typeof i.shortName>"u"&&i.name&&i.name in T&&(i.shortName=T[i.name]),i.type===d.extensionRequest&&(i.valueConstructed=!0,i.valueTagClass=e.Type.SEQUENCE,!i.value&&i.extensions)){i.value=[];for(var k=0;k<i.extensions.length;++k)i.value.push(r.certificateExtensionToAsn1(g(i.extensions[k])))}if(typeof i.value>"u"){var I=new Error("Attribute value not specified.");throw I.attribute=i,I}}}function g(c,i){if(i=i||{},typeof c.name>"u"&&c.id&&c.id in r.oids&&(c.name=r.oids[c.id]),typeof c.id>"u")if(c.name&&c.name in r.oids)c.id=r.oids[c.name];else{var n=new Error("Extension ID not specified.");throw n.extension=c,n}if(typeof c.value<"u")return c;if(c.name==="keyUsage"){var I=0,k=0,O=0;c.digitalSignature&&(k|=128,I=7),c.nonRepudiation&&(k|=64,I=6),c.keyEncipherment&&(k|=32,I=5),c.dataEncipherment&&(k|=16,I=4),c.keyAgreement&&(k|=8,I=3),c.keyCertSign&&(k|=4,I=2),c.cRLSign&&(k|=2,I=1),c.encipherOnly&&(k|=1,I=0),c.decipherOnly&&(O|=128,I=7);var P=String.fromCharCode(I);O!==0?P+=String.fromCharCode(k)+String.fromCharCode(O):k!==0&&(P+=String.fromCharCode(k)),c.value=e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,P)}else if(c.name==="basicConstraints")c.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]),c.cA&&c.value.value.push(e.create(e.Class.UNIVERSAL,e.Type.BOOLEAN,!1,"ÿ")),"pathLenConstraint"in c&&c.value.value.push(e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(c.pathLenConstraint).getBytes()));else if(c.name==="extKeyUsage"){c.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);var K=c.value.value;for(var q in c)c[q]===!0&&(q in d?K.push(e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(d[q]).getBytes())):q.indexOf(".")!==-1&&K.push(e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(q).getBytes())))}else if(c.name==="nsCertType"){var I=0,k=0;c.client&&(k|=128,I=7),c.server&&(k|=64,I=6),c.email&&(k|=32,I=5),c.objsign&&(k|=16,I=4),c.reserved&&(k|=8,I=3),c.sslCA&&(k|=4,I=2),c.emailCA&&(k|=2,I=1),c.objCA&&(k|=1,I=0);var P=String.fromCharCode(I);k!==0&&(P+=String.fromCharCode(k)),c.value=e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,P)}else if(c.name==="subjectAltName"||c.name==="issuerAltName"){c.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);for(var M,G=0;G<c.altNames.length;++G){M=c.altNames[G];var P=M.value;if(M.type===7&&M.ip){if(P=t.util.bytesFromIP(M.ip),P===null){var n=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw n.extension=c,n}}else M.type===8&&(M.oid?P=e.oidToDer(e.oidToDer(M.oid)):P=e.oidToDer(P));c.value.value.push(e.create(e.Class.CONTEXT_SPECIFIC,M.type,!1,P))}}else if(c.name==="nsComment"&&i.cert){if(!/^[\x00-\x7F]*$/.test(c.comment)||c.comment.length<1||c.comment.length>128)throw new Error('Invalid "nsComment" content.');c.value=e.create(e.Class.UNIVERSAL,e.Type.IA5STRING,!1,c.comment)}else if(c.name==="subjectKeyIdentifier"&&i.cert){var Y=i.cert.generateSubjectKeyIdentifier();c.subjectKeyIdentifier=Y.toHex(),c.value=e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,Y.getBytes())}else if(c.name==="authorityKeyIdentifier"&&i.cert){c.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);var K=c.value.value;if(c.keyIdentifier){var W=c.keyIdentifier===!0?i.cert.generateSubjectKeyIdentifier().getBytes():c.keyIdentifier;K.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!1,W))}if(c.authorityCertIssuer){var ee=[e.create(e.Class.CONTEXT_SPECIFIC,4,!0,[v(c.authorityCertIssuer===!0?i.cert.issuer:c.authorityCertIssuer)])];K.push(e.create(e.Class.CONTEXT_SPECIFIC,1,!0,ee))}if(c.serialNumber){var ne=t.util.hexToBytes(c.serialNumber===!0?i.cert.serialNumber:c.serialNumber);K.push(e.create(e.Class.CONTEXT_SPECIFIC,2,!1,ne))}}else if(c.name==="cRLDistributionPoints"){c.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);for(var K=c.value.value,ie=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]),ce=e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[]),M,G=0;G<c.altNames.length;++G){M=c.altNames[G];var P=M.value;if(M.type===7&&M.ip){if(P=t.util.bytesFromIP(M.ip),P===null){var n=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw n.extension=c,n}}else M.type===8&&(M.oid?P=e.oidToDer(e.oidToDer(M.oid)):P=e.oidToDer(P));ce.value.push(e.create(e.Class.CONTEXT_SPECIFIC,M.type,!1,P))}ie.value.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[ce])),K.push(ie)}if(typeof c.value>"u"){var n=new Error("Extension value not specified.");throw n.extension=c,n}return c}function s(c,i){switch(c){case d["RSASSA-PSS"]:var n=[];return i.hash.algorithmOid!==void 0&&n.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(i.hash.algorithmOid).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")])])),i.mgf.algorithmOid!==void 0&&n.push(e.create(e.Class.CONTEXT_SPECIFIC,1,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(i.mgf.algorithmOid).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(i.mgf.hash.algorithmOid).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")])])])),i.saltLength!==void 0&&n.push(e.create(e.Class.CONTEXT_SPECIFIC,2,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(i.saltLength).getBytes())])),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,n);default:return e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")}}function h(c){var i=e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[]);if(c.attributes.length===0)return i;for(var n=c.attributes,I=0;I<n.length;++I){var k=n[I],O=k.value,P=e.Type.UTF8;"valueTagClass"in k&&(P=k.valueTagClass),P===e.Type.UTF8&&(O=t.util.encodeUtf8(O));var K=!1;"valueConstructed"in k&&(K=k.valueConstructed);var q=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(k.type).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[e.create(e.Class.UNIVERSAL,P,K,O)])]);i.value.push(q)}return i}var p=new Date("1950-01-01T00:00:00Z"),A=new Date("2050-01-01T00:00:00Z");function R(c){return c>=p&&c<A?e.create(e.Class.UNIVERSAL,e.Type.UTCTIME,!1,e.dateToUtcTime(c)):e.create(e.Class.UNIVERSAL,e.Type.GENERALIZEDTIME,!1,e.dateToGeneralizedTime(c))}return r.getTBSCertificate=function(c){var i=R(c.validity.notBefore),n=R(c.validity.notAfter),I=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(c.version).getBytes())]),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,t.util.hexToBytes(c.serialNumber)),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(c.siginfo.algorithmOid).getBytes()),s(c.siginfo.algorithmOid,c.siginfo.parameters)]),v(c.issuer),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[i,n]),v(c.subject),r.publicKeyToAsn1(c.publicKey)]);return c.issuer.uniqueId&&I.value.push(e.create(e.Class.CONTEXT_SPECIFIC,1,!0,[e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,"\0"+c.issuer.uniqueId)])),c.subject.uniqueId&&I.value.push(e.create(e.Class.CONTEXT_SPECIFIC,2,!0,[e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,"\0"+c.subject.uniqueId)])),c.extensions.length>0&&I.value.push(r.certificateExtensionsToAsn1(c.extensions)),I},r.getCertificationRequestInfo=function(c){var i=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(c.version).getBytes()),v(c.subject),r.publicKeyToAsn1(c.publicKey),h(c)]);return i},r.distinguishedNameToAsn1=function(c){return v(c)},r.certificateToAsn1=function(c){var i=c.tbsCertificate||r.getTBSCertificate(c);return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[i,e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(c.signatureOid).getBytes()),s(c.signatureOid,c.signatureParameters)]),e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,"\0"+c.signature)])},r.certificateExtensionsToAsn1=function(c){var i=e.create(e.Class.CONTEXT_SPECIFIC,3,!0,[]),n=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);i.value.push(n);for(var I=0;I<c.length;++I)n.value.push(r.certificateExtensionToAsn1(c[I]));return i},r.certificateExtensionToAsn1=function(c){var i=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);i.value.push(e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(c.id).getBytes())),c.critical&&i.value.push(e.create(e.Class.UNIVERSAL,e.Type.BOOLEAN,!1,"ÿ"));var n=c.value;return typeof c.value!="string"&&(n=e.toDer(n).getBytes()),i.value.push(e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,n)),i},r.certificationRequestToAsn1=function(c){var i=c.certificationRequestInfo||r.getCertificationRequestInfo(c);return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[i,e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(c.signatureOid).getBytes()),s(c.signatureOid,c.signatureParameters)]),e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,"\0"+c.signature)])},r.createCaStore=function(c){var i={certs:{}};i.getIssuer=function(P){var K=n(P.issuer);return K},i.addCertificate=function(P){if(typeof P=="string"&&(P=t.pki.certificateFromPem(P)),I(P.subject),!i.hasCertificate(P))if(P.subject.hash in i.certs){var K=i.certs[P.subject.hash];t.util.isArray(K)||(K=[K]),K.push(P),i.certs[P.subject.hash]=K}else i.certs[P.subject.hash]=P},i.hasCertificate=function(P){typeof P=="string"&&(P=t.pki.certificateFromPem(P));var K=n(P.subject);if(!K)return!1;t.util.isArray(K)||(K=[K]);for(var q=e.toDer(r.certificateToAsn1(P)).getBytes(),M=0;M<K.length;++M){var G=e.toDer(r.certificateToAsn1(K[M])).getBytes();if(q===G)return!0}return!1},i.listAllCertificates=function(){var P=[];for(var K in i.certs)if(i.certs.hasOwnProperty(K)){var q=i.certs[K];if(!t.util.isArray(q))P.push(q);else for(var M=0;M<q.length;++M)P.push(q[M])}return P},i.removeCertificate=function(P){var K;if(typeof P=="string"&&(P=t.pki.certificateFromPem(P)),I(P.subject),!i.hasCertificate(P))return null;var q=n(P.subject);if(!t.util.isArray(q))return K=i.certs[P.subject.hash],delete i.certs[P.subject.hash],K;for(var M=e.toDer(r.certificateToAsn1(P)).getBytes(),G=0;G<q.length;++G){var Y=e.toDer(r.certificateToAsn1(q[G])).getBytes();M===Y&&(K=q[G],q.splice(G,1))}return q.length===0&&delete i.certs[P.subject.hash],K};function n(P){return I(P),i.certs[P.hash]||null}function I(P){if(!P.hash){var K=t.md.sha1.create();P.attributes=r.RDNAttributesAsArray(v(P),K),P.hash=K.digest().toHex()}}if(c)for(var k=0;k<c.length;++k){var O=c[k];i.addCertificate(O)}return i},r.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"},r.verifyCertificateChain=function(c,i,n){typeof n=="function"&&(n={verify:n}),n=n||{},i=i.slice(0);var I=i.slice(0),k=n.validityCheckDate;typeof k>"u"&&(k=new Date);var O=!0,P=null,K=0;do{var q=i.shift(),M=null,G=!1;if(k&&(k<q.validity.notBefore||k>q.validity.notAfter)&&(P={message:"Certificate is not valid yet or has expired.",error:r.certificateError.certificate_expired,notBefore:q.validity.notBefore,notAfter:q.validity.notAfter,now:k}),P===null){if(M=i[0]||c.getIssuer(q),M===null&&q.isIssuer(q)&&(G=!0,M=q),M){var Y=M;t.util.isArray(Y)||(Y=[Y]);for(var W=!1;!W&&Y.length>0;){M=Y.shift();try{W=M.verify(q)}catch{}}W||(P={message:"Certificate signature is invalid.",error:r.certificateError.bad_certificate})}P===null&&(!M||G)&&!c.hasCertificate(q)&&(P={message:"Certificate is not trusted.",error:r.certificateError.unknown_ca})}if(P===null&&M&&!q.isIssuer(M)&&(P={message:"Certificate issuer is invalid.",error:r.certificateError.bad_certificate}),P===null)for(var ee={keyUsage:!0,basicConstraints:!0},ne=0;P===null&&ne<q.extensions.length;++ne){var ie=q.extensions[ne];ie.critical&&!(ie.name in ee)&&(P={message:"Certificate has an unsupported critical extension.",error:r.certificateError.unsupported_certificate})}if(P===null&&(!O||i.length===0&&(!M||G))){var ce=q.getExtension("basicConstraints"),ve=q.getExtension("keyUsage");if(ve!==null&&(!ve.keyCertSign||ce===null)&&(P={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:r.certificateError.bad_certificate}),P===null&&ce===null&&(P={message:"Certificate is missing basicConstraints extension and cannot be used as a CA.",error:r.certificateError.bad_certificate}),P===null&&ce!==null&&!ce.cA&&(P={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:r.certificateError.bad_certificate}),P===null&&ve!==null&&"pathLenConstraint"in ce){var ue=K-1;ue>ce.pathLenConstraint&&(P={message:"Certificate basicConstraints pathLenConstraint violated.",error:r.certificateError.bad_certificate})}}var j=P===null?!0:P.error,Z=n.verify?n.verify(j,K,I):j;if(Z===!0)P=null;else throw j===!0&&(P={message:"The application rejected the certificate.",error:r.certificateError.bad_certificate}),(Z||Z===0)&&(typeof Z=="object"&&!t.util.isArray(Z)?(Z.message&&(P.message=Z.message),Z.error&&(P.error=Z.error)):typeof Z=="string"&&(P.error=Z)),P;O=!1,++K}while(i.length>0);return!0},lr.exports}var la;function Ka(){if(la)return fr.exports;la=1;var t=fe();it(),xt(),pt(),Va(),Pa(),at(),Ut(),St(),de(),kr();var e=t.asn1,r=t.pki,d=fr.exports=t.pkcs12=t.pkcs12||{},T={name:"ContentInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:e.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},x={name:"PFX",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"version"},T,{name:"PFX.macData",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",optional:!0,tagClass:e.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},l={name:"SafeBag",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"SafeBag.bagId",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:e.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},a={name:"Attribute",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"oid"},{name:"Attribute.attrValues",tagClass:e.Class.UNIVERSAL,type:e.Type.SET,constructed:!0,capture:"values"}]},y={name:"CertBag",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:e.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:e.Class.UNIVERSAL,type:e.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};function u(m,g,s,h){for(var p=[],A=0;A<m.length;A++)for(var R=0;R<m[A].safeBags.length;R++){var c=m[A].safeBags[R];if(!(h!==void 0&&c.type!==h)){if(g===null){p.push(c);continue}c.attributes[g]!==void 0&&c.attributes[g].indexOf(s)>=0&&p.push(c)}}return p}d.pkcs12FromAsn1=function(m,g,s){typeof g=="string"?(s=g,g=!0):g===void 0&&(g=!0);var h={},p=[];if(!e.validate(m,x,h,p)){var A=new Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX.");throw A.errors=A,A}var R={version:h.version.charCodeAt(0),safeContents:[],getBags:function(M){var G={},Y;return"localKeyId"in M?Y=M.localKeyId:"localKeyIdHex"in M&&(Y=t.util.hexToBytes(M.localKeyIdHex)),Y===void 0&&!("friendlyName"in M)&&"bagType"in M&&(G[M.bagType]=u(R.safeContents,null,null,M.bagType)),Y!==void 0&&(G.localKeyId=u(R.safeContents,"localKeyId",Y,M.bagType)),"friendlyName"in M&&(G.friendlyName=u(R.safeContents,"friendlyName",M.friendlyName,M.bagType)),G},getBagsByFriendlyName:function(M,G){return u(R.safeContents,"friendlyName",M,G)},getBagsByLocalKeyId:function(M,G){return u(R.safeContents,"localKeyId",M,G)}};if(h.version.charCodeAt(0)!==3){var A=new Error("PKCS#12 PFX of version other than 3 not supported.");throw A.version=h.version.charCodeAt(0),A}if(e.derToOid(h.contentType)!==r.oids.data){var A=new Error("Only PKCS#12 PFX in password integrity mode supported.");throw A.oid=e.derToOid(h.contentType),A}var c=h.content.value[0];if(c.tagClass!==e.Class.UNIVERSAL||c.type!==e.Type.OCTETSTRING)throw new Error("PKCS#12 authSafe content data is not an OCTET STRING.");if(c=S(c),h.mac){var i=null,n=0,I=e.derToOid(h.macAlgorithm);switch(I){case r.oids.sha1:i=t.md.sha1.create(),n=20;break;case r.oids.sha256:i=t.md.sha256.create(),n=32;break;case r.oids.sha384:i=t.md.sha384.create(),n=48;break;case r.oids.sha512:i=t.md.sha512.create(),n=64;break;case r.oids.md5:i=t.md.md5.create(),n=16;break}if(i===null)throw new Error("PKCS#12 uses unsupported MAC algorithm: "+I);var k=new t.util.ByteBuffer(h.macSalt),O="macIterations"in h?parseInt(t.util.bytesToHex(h.macIterations),16):1,P=d.generateKey(s,k,3,O,n,i),K=t.hmac.create();K.start(i,P),K.update(c.value);var q=K.getMac();if(q.getBytes()!==h.macDigest)throw new Error("PKCS#12 MAC could not be verified. Invalid password?")}else if(Array.isArray(m.value)&&m.value.length>2)throw new Error("Invalid PKCS#12. macData field present but MAC was not validated.");return U(R,c.value,g,s),R};function S(m){if(m.composed||m.constructed){for(var g=t.util.createBuffer(),s=0;s<m.value.length;++s)g.putBytes(m.value[s].value);m.composed=m.constructed=!1,m.value=g.getBytes()}return m}function U(m,g,s,h){if(g=e.fromDer(g,s),g.tagClass!==e.Class.UNIVERSAL||g.type!==e.Type.SEQUENCE||g.constructed!==!0)throw new Error("PKCS#12 AuthenticatedSafe expected to be a SEQUENCE OF ContentInfo");for(var p=0;p<g.value.length;p++){var A=g.value[p],R={},c=[];if(!e.validate(A,T,R,c)){var i=new Error("Cannot read ContentInfo.");throw i.errors=c,i}var n={encrypted:!1},I=null,k=R.content.value[0];switch(e.derToOid(R.contentType)){case r.oids.data:if(k.tagClass!==e.Class.UNIVERSAL||k.type!==e.Type.OCTETSTRING)throw new Error("PKCS#12 SafeContents Data is not an OCTET STRING.");I=S(k).value;break;case r.oids.encryptedData:I=E(k,h),n.encrypted=!0;break;default:var i=new Error("Unsupported PKCS#12 contentType.");throw i.contentType=e.derToOid(R.contentType),i}n.safeBags=f(I,s,h),m.safeContents.push(n)}}function E(m,g){var s={},h=[];if(!e.validate(m,t.pkcs7.asn1.encryptedDataValidator,s,h)){var p=new Error("Cannot read EncryptedContentInfo.");throw p.errors=h,p}var A=e.derToOid(s.contentType);if(A!==r.oids.data){var p=new Error("PKCS#12 EncryptedContentInfo ContentType is not Data.");throw p.oid=A,p}A=e.derToOid(s.encAlgorithm);var R=r.pbe.getCipher(A,s.encParameter,g),c=S(s.encryptedContentAsn1),i=t.util.createBuffer(c.value);if(R.update(i),!R.finish())throw new Error("Failed to decrypt PKCS#12 SafeContents.");return R.output.getBytes()}function f(m,g,s){if(!g&&m.length===0)return[];if(m=e.fromDer(m,g),m.tagClass!==e.Class.UNIVERSAL||m.type!==e.Type.SEQUENCE||m.constructed!==!0)throw new Error("PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.");for(var h=[],p=0;p<m.value.length;p++){var A=m.value[p],R={},c=[];if(!e.validate(A,l,R,c)){var i=new Error("Cannot read SafeBag.");throw i.errors=c,i}var n={type:e.derToOid(R.bagId),attributes:v(R.bagAttributes)};h.push(n);var I,k,O=R.bagValue.value[0];switch(n.type){case r.oids.pkcs8ShroudedKeyBag:if(O=r.decryptPrivateKeyInfo(O,s),O===null)throw new Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case r.oids.keyBag:try{n.key=r.privateKeyFromAsn1(O)}catch{n.key=null,n.asn1=O}continue;case r.oids.certBag:I=y,k=function(){if(e.derToOid(R.certId)!==r.oids.x509Certificate){var K=new Error("Unsupported certificate type, only X.509 supported.");throw K.oid=e.derToOid(R.certId),K}var q=e.fromDer(R.cert,g);try{n.cert=r.certificateFromAsn1(q,!0)}catch{n.cert=null,n.asn1=q}};break;default:var i=new Error("Unsupported PKCS#12 SafeBag type.");throw i.oid=n.type,i}if(I!==void 0&&!e.validate(O,I,R,c)){var i=new Error("Cannot read PKCS#12 "+I.name);throw i.errors=c,i}k()}return h}function v(m){var g={};if(m!==void 0)for(var s=0;s<m.length;++s){var h={},p=[];if(!e.validate(m[s],a,h,p)){var A=new Error("Cannot read PKCS#12 BagAttribute.");throw A.errors=p,A}var R=e.derToOid(h.oid);if(r.oids[R]!==void 0){g[r.oids[R]]=[];for(var c=0;c<h.values.length;++c)g[r.oids[R]].push(h.values[c].value)}}return g}return d.toPkcs12Asn1=function(m,g,s,h){h=h||{},h.saltSize=h.saltSize||8,h.count=h.count||2048,h.algorithm=h.algorithm||h.encAlgorithm||"aes128","useMac"in h||(h.useMac=!0),"localKeyId"in h||(h.localKeyId=null),"generateLocalKeyId"in h||(h.generateLocalKeyId=!0);var p=h.localKeyId,A;if(p!==null)p=t.util.hexToBytes(p);else if(h.generateLocalKeyId)if(g){var R=t.util.isArray(g)?g[0]:g;typeof R=="string"&&(R=r.certificateFromPem(R));var c=t.md.sha1.create();c.update(e.toDer(r.certificateToAsn1(R)).getBytes()),p=c.digest().getBytes()}else p=t.random.getBytes(20);var i=[];p!==null&&i.push(e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(r.oids.localKeyId).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,p)])])),"friendlyName"in h&&i.push(e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(r.oids.friendlyName).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[e.create(e.Class.UNIVERSAL,e.Type.BMPSTRING,!1,h.friendlyName)])])),i.length>0&&(A=e.create(e.Class.UNIVERSAL,e.Type.SET,!0,i));var n=[],I=[];g!==null&&(t.util.isArray(g)?I=g:I=[g]);for(var k=[],O=0;O<I.length;++O){g=I[O],typeof g=="string"&&(g=r.certificateFromPem(g));var P=O===0?A:void 0,K=r.certificateToAsn1(g),q=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(r.oids.certBag).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(r.oids.x509Certificate).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,e.toDer(K).getBytes())])])]),P]);k.push(q)}if(k.length>0){var M=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,k),G=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(r.oids.data).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,e.toDer(M).getBytes())])]);n.push(G)}var Y=null;if(m!==null){var W=r.wrapRsaPrivateKey(r.privateKeyToAsn1(m));s===null?Y=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(r.oids.keyBag).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[W]),A]):Y=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(r.oids.pkcs8ShroudedKeyBag).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[r.encryptPrivateKeyInfo(W,s,h)]),A]);var ee=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[Y]),ne=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(r.oids.data).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,e.toDer(ee).getBytes())])]);n.push(ne)}var ie=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,n),ce;if(h.useMac){var c=t.md.sha1.create(),ve=new t.util.ByteBuffer(t.random.getBytes(h.saltSize)),ue=h.count,m=d.generateKey(s,ve,3,ue,20),j=t.hmac.create();j.start(c,m),j.update(e.toDer(ie).getBytes());var Z=j.getMac();ce=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(r.oids.sha1).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")]),e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,Z.getBytes())]),e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,ve.getBytes()),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(ue).getBytes())])}return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(3).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(r.oids.data).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,e.toDer(ie).getBytes())])]),ce])},d.generateKey=t.pbe.generatePkcs12Key,fr.exports}var ca;function Fa(){if(ca)return Zt.exports;ca=1;var t=fe();it(),pt(),Pa(),mt(),Rr(),Ka(),Lr(),Ut(),de(),kr();var e=t.asn1,r=Zt.exports=t.pki=t.pki||{};return r.pemToDer=function(d){var T=t.pem.decode(d)[0];if(T.procType&&T.procType.type==="ENCRYPTED")throw new Error("Could not convert PEM to DER; PEM is encrypted.");return t.util.createBuffer(T.body)},r.privateKeyFromPem=function(d){var T=t.pem.decode(d)[0];if(T.type!=="PRIVATE KEY"&&T.type!=="RSA PRIVATE KEY"){var x=new Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw x.headerType=T.type,x}if(T.procType&&T.procType.type==="ENCRYPTED")throw new Error("Could not convert private key from PEM; PEM is encrypted.");var l=e.fromDer(T.body);return r.privateKeyFromAsn1(l)},r.privateKeyToPem=function(d,T){var x={type:"RSA PRIVATE KEY",body:e.toDer(r.privateKeyToAsn1(d)).getBytes()};return t.pem.encode(x,{maxline:T})},r.privateKeyInfoToPem=function(d,T){var x={type:"PRIVATE KEY",body:e.toDer(d).getBytes()};return t.pem.encode(x,{maxline:T})},Zt.exports}var pr,da;function Ma(){if(da)return pr;da=1;var t=fe();it(),xt(),Nr(),mt(),Fa(),at(),St(),de();var e=function(C,L,w,N){var o=t.util.createBuffer(),_=C.length>>1,V=_+(C.length&1),H=C.substr(0,V),ae=C.substr(_,V),te=t.util.createBuffer(),Q=t.hmac.create();w=L+w;var $=Math.ceil(N/16),se=Math.ceil(N/20);Q.start("MD5",H);var le=t.util.createBuffer();te.putBytes(w);for(var oe=0;oe<$;++oe)Q.start(null,null),Q.update(te.getBytes()),te.putBuffer(Q.digest()),Q.start(null,null),Q.update(te.bytes()+w),le.putBuffer(Q.digest());Q.start("SHA1",ae);var Ce=t.util.createBuffer();te.clear(),te.putBytes(w);for(var oe=0;oe<se;++oe)Q.start(null,null),Q.update(te.getBytes()),te.putBuffer(Q.digest()),Q.start(null,null),Q.update(te.bytes()+w),Ce.putBuffer(Q.digest());return o.putBytes(t.util.xorBytes(le.getBytes(),Ce.getBytes(),N)),o},r=function(C,L,w){var N=t.hmac.create();N.start("SHA1",C);var o=t.util.createBuffer();return o.putInt32(L[0]),o.putInt32(L[1]),o.putByte(w.type),o.putByte(w.version.major),o.putByte(w.version.minor),o.putInt16(w.length),o.putBytes(w.fragment.bytes()),N.update(o.getBytes()),N.digest().getBytes()},d=function(C,L,w){var N=!1;try{var o=C.deflate(L.fragment.getBytes());L.fragment=t.util.createBuffer(o),L.length=o.length,N=!0}catch{}return N},T=function(C,L,w){var N=!1;try{var o=C.inflate(L.fragment.getBytes());L.fragment=t.util.createBuffer(o),L.length=o.length,N=!0}catch{}return N},x=function(C,L){var w=0;switch(L){case 1:w=C.getByte();break;case 2:w=C.getInt16();break;case 3:w=C.getInt24();break;case 4:w=C.getInt32();break}return t.util.createBuffer(C.getBytes(w))},l=function(C,L,w){C.putInt(w.length(),L<<3),C.putBuffer(w)},a={};a.Versions={TLS_1_0:{major:3,minor:1},TLS_1_1:{major:3,minor:2},TLS_1_2:{major:3,minor:3}},a.SupportedVersions=[a.Versions.TLS_1_1,a.Versions.TLS_1_0],a.Version=a.SupportedVersions[0],a.MaxFragment=15360,a.ConnectionEnd={server:0,client:1},a.PRFAlgorithm={tls_prf_sha256:0},a.BulkCipherAlgorithm={none:null,rc4:0,des3:1,aes:2},a.CipherType={stream:0,block:1,aead:2},a.MACAlgorithm={none:null,hmac_md5:0,hmac_sha1:1,hmac_sha256:2,hmac_sha384:3,hmac_sha512:4},a.CompressionMethod={none:0,deflate:1},a.ContentType={change_cipher_spec:20,alert:21,handshake:22,application_data:23,heartbeat:24},a.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},a.Alert={},a.Alert.Level={warning:1,fatal:2},a.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},a.HeartbeatMessageType={heartbeat_request:1,heartbeat_response:2},a.CipherSuites={},a.getCipherSuite=function(C){var L=null;for(var w in a.CipherSuites){var N=a.CipherSuites[w];if(N.id[0]===C.charCodeAt(0)&&N.id[1]===C.charCodeAt(1)){L=N;break}}return L},a.handleUnexpected=function(C,L){var w=!C.open&&C.entity===a.ConnectionEnd.client;w||C.error(C,{message:"Unexpected message. Received TLS record out of order.",send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.unexpected_message}})},a.handleHelloRequest=function(C,L,w){!C.handshaking&&C.handshakes>0&&(a.queue(C,a.createAlert(C,{level:a.Alert.Level.warning,description:a.Alert.Description.no_renegotiation})),a.flush(C)),C.process()},a.parseHelloMessage=function(C,L,w){var N=null,o=C.entity===a.ConnectionEnd.client;if(w<38)C.error(C,{message:o?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.illegal_parameter}});else{var _=L.fragment,V=_.length();if(N={version:{major:_.getByte(),minor:_.getByte()},random:t.util.createBuffer(_.getBytes(32)),session_id:x(_,1),extensions:[]},o?(N.cipher_suite=_.getBytes(2),N.compression_method=_.getByte()):(N.cipher_suites=x(_,2),N.compression_methods=x(_,1)),V=w-(V-_.length()),V>0){for(var H=x(_,2);H.length()>0;)N.extensions.push({type:[H.getByte(),H.getByte()],data:x(H,2)});if(!o)for(var ae=0;ae<N.extensions.length;++ae){var te=N.extensions[ae];if(te.type[0]===0&&te.type[1]===0)for(var Q=x(te.data,2);Q.length()>0;){var $=Q.getByte();if($!==0)break;C.session.extensions.server_name.serverNameList.push(x(Q,2).getBytes())}}}if(C.session.version&&(N.version.major!==C.session.version.major||N.version.minor!==C.session.version.minor))return C.error(C,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.protocol_version}});if(o)C.session.cipherSuite=a.getCipherSuite(N.cipher_suite);else for(var se=t.util.createBuffer(N.cipher_suites.bytes());se.length()>0&&(C.session.cipherSuite=a.getCipherSuite(se.getBytes(2)),C.session.cipherSuite===null););if(C.session.cipherSuite===null)return C.error(C,{message:"No cipher suites in common.",send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.handshake_failure},cipherSuite:t.util.bytesToHex(N.cipher_suite)});o?C.session.compressionMethod=N.compression_method:C.session.compressionMethod=a.CompressionMethod.none}return N},a.createSecurityParameters=function(C,L){var w=C.entity===a.ConnectionEnd.client,N=L.random.bytes(),o=w?C.session.sp.client_random:N,_=w?N:a.createRandom().getBytes();C.session.sp={entity:C.entity,prf_algorithm:a.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:C.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:o,server_random:_}},a.handleServerHello=function(C,L,w){var N=a.parseHelloMessage(C,L,w);if(!C.fail){if(N.version.minor<=C.version.minor)C.version.minor=N.version.minor;else return C.error(C,{message:"Incompatible TLS version.",send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.protocol_version}});C.session.version=C.version;var o=N.session_id.bytes();o.length>0&&o===C.session.id?(C.expect=f,C.session.resuming=!0,C.session.sp.server_random=N.random.bytes()):(C.expect=u,C.session.resuming=!1,a.createSecurityParameters(C,N)),C.session.id=o,C.process()}},a.handleClientHello=function(C,L,w){var N=a.parseHelloMessage(C,L,w);if(!C.fail){var o=N.session_id.bytes(),_=null;if(C.sessionCache&&(_=C.sessionCache.getSession(o),_===null?o="":(_.version.major!==N.version.major||_.version.minor>N.version.minor)&&(_=null,o="")),o.length===0&&(o=t.random.getBytes(32)),C.session.id=o,C.session.clientHelloVersion=N.version,C.session.sp={},_)C.version=C.session.version=_.version,C.session.sp=_.sp;else{for(var V,H=1;H<a.SupportedVersions.length&&(V=a.SupportedVersions[H],!(V.minor<=N.version.minor));++H);C.version={major:V.major,minor:V.minor},C.session.version=C.version}_!==null?(C.expect=R,C.session.resuming=!0,C.session.sp.client_random=N.random.bytes()):(C.expect=C.verifyClient!==!1?h:p,C.session.resuming=!1,a.createSecurityParameters(C,N)),C.open=!0,a.queue(C,a.createRecord(C,{type:a.ContentType.handshake,data:a.createServerHello(C)})),C.session.resuming?(a.queue(C,a.createRecord(C,{type:a.ContentType.change_cipher_spec,data:a.createChangeCipherSpec()})),C.state.pending=a.createConnectionState(C),C.state.current.write=C.state.pending.write,a.queue(C,a.createRecord(C,{type:a.ContentType.handshake,data:a.createFinished(C)}))):(a.queue(C,a.createRecord(C,{type:a.ContentType.handshake,data:a.createCertificate(C)})),C.fail||(a.queue(C,a.createRecord(C,{type:a.ContentType.handshake,data:a.createServerKeyExchange(C)})),C.verifyClient!==!1&&a.queue(C,a.createRecord(C,{type:a.ContentType.handshake,data:a.createCertificateRequest(C)})),a.queue(C,a.createRecord(C,{type:a.ContentType.handshake,data:a.createServerHelloDone(C)})))),a.flush(C),C.process()}},a.handleCertificate=function(C,L,w){if(w<3)return C.error(C,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.illegal_parameter}});var N=L.fragment,o={certificate_list:x(N,3)},_,V,H=[];try{for(;o.certificate_list.length()>0;)_=x(o.certificate_list,3),V=t.asn1.fromDer(_),_=t.pki.certificateFromAsn1(V,!0),H.push(_)}catch(te){return C.error(C,{message:"Could not parse certificate list.",cause:te,send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.bad_certificate}})}var ae=C.entity===a.ConnectionEnd.client;(ae||C.verifyClient===!0)&&H.length===0?C.error(C,{message:ae?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.illegal_parameter}}):H.length===0?C.expect=ae?S:p:(ae?C.session.serverCertificate=H[0]:C.session.clientCertificate=H[0],a.verifyCertificateChain(C,H)&&(C.expect=ae?S:p)),C.process()},a.handleServerKeyExchange=function(C,L,w){if(w>0)return C.error(C,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.unsupported_certificate}});C.expect=U,C.process()},a.handleClientKeyExchange=function(C,L,w){if(w<48)return C.error(C,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.unsupported_certificate}});var N=L.fragment,o={enc_pre_master_secret:x(N,2).getBytes()},_=null;if(C.getPrivateKey)try{_=C.getPrivateKey(C,C.session.serverCertificate),_=t.pki.privateKeyFromPem(_)}catch(ae){C.error(C,{message:"Could not get private key.",cause:ae,send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.internal_error}})}if(_===null)return C.error(C,{message:"No private key set.",send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.internal_error}});try{var V=C.session.sp;V.pre_master_secret=_.decrypt(o.enc_pre_master_secret);var H=C.session.clientHelloVersion;if(H.major!==V.pre_master_secret.charCodeAt(0)||H.minor!==V.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch{V.pre_master_secret=t.random.getBytes(48)}C.expect=R,C.session.clientCertificate!==null&&(C.expect=A),C.process()},a.handleCertificateRequest=function(C,L,w){if(w<3)return C.error(C,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.illegal_parameter}});var N=L.fragment,o={certificate_types:x(N,1),certificate_authorities:x(N,2)};C.session.certificateRequest=o,C.expect=E,C.process()},a.handleCertificateVerify=function(C,L,w){if(w<2)return C.error(C,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.illegal_parameter}});var N=L.fragment;N.read-=4;var o=N.bytes();N.read+=4;var _={signature:x(N,2).getBytes()},V=t.util.createBuffer();V.putBuffer(C.session.md5.digest()),V.putBuffer(C.session.sha1.digest()),V=V.getBytes();try{var H=C.session.clientCertificate;if(!H.publicKey.verify(V,_.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");C.session.md5.update(o),C.session.sha1.update(o)}catch{return C.error(C,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.handshake_failure}})}C.expect=R,C.process()},a.handleServerHelloDone=function(C,L,w){if(w>0)return C.error(C,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.record_overflow}});if(C.serverCertificate===null){var N={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.insufficient_security}},o=0,_=C.verify(C,N.alert.description,o,[]);if(_!==!0)return(_||_===0)&&(typeof _=="object"&&!t.util.isArray(_)?(_.message&&(N.message=_.message),_.alert&&(N.alert.description=_.alert)):typeof _=="number"&&(N.alert.description=_)),C.error(C,N)}C.session.certificateRequest!==null&&(L=a.createRecord(C,{type:a.ContentType.handshake,data:a.createCertificate(C)}),a.queue(C,L)),L=a.createRecord(C,{type:a.ContentType.handshake,data:a.createClientKeyExchange(C)}),a.queue(C,L),C.expect=g;var V=function(H,ae){H.session.certificateRequest!==null&&H.session.clientCertificate!==null&&a.queue(H,a.createRecord(H,{type:a.ContentType.handshake,data:a.createCertificateVerify(H,ae)})),a.queue(H,a.createRecord(H,{type:a.ContentType.change_cipher_spec,data:a.createChangeCipherSpec()})),H.state.pending=a.createConnectionState(H),H.state.current.write=H.state.pending.write,a.queue(H,a.createRecord(H,{type:a.ContentType.handshake,data:a.createFinished(H)})),H.expect=f,a.flush(H),H.process()};if(C.session.certificateRequest===null||C.session.clientCertificate===null)return V(C,null);a.getClientSignature(C,V)},a.handleChangeCipherSpec=function(C,L){if(L.fragment.getByte()!==1)return C.error(C,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.illegal_parameter}});var w=C.entity===a.ConnectionEnd.client;(C.session.resuming&&w||!C.session.resuming&&!w)&&(C.state.pending=a.createConnectionState(C)),C.state.current.read=C.state.pending.read,(!C.session.resuming&&w||C.session.resuming&&!w)&&(C.state.pending=null),C.expect=w?v:c,C.process()},a.handleFinished=function(C,L,w){var N=L.fragment;N.read-=4;var o=N.bytes();N.read+=4;var _=L.fragment.getBytes();N=t.util.createBuffer(),N.putBuffer(C.session.md5.digest()),N.putBuffer(C.session.sha1.digest());var V=C.entity===a.ConnectionEnd.client,H=V?"server finished":"client finished",ae=C.session.sp,te=12,Q=e;if(N=Q(ae.master_secret,H,N.getBytes(),te),N.getBytes()!==_)return C.error(C,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.decrypt_error}});C.session.md5.update(o),C.session.sha1.update(o),(C.session.resuming&&V||!C.session.resuming&&!V)&&(a.queue(C,a.createRecord(C,{type:a.ContentType.change_cipher_spec,data:a.createChangeCipherSpec()})),C.state.current.write=C.state.pending.write,C.state.pending=null,a.queue(C,a.createRecord(C,{type:a.ContentType.handshake,data:a.createFinished(C)}))),C.expect=V?m:i,C.handshaking=!1,++C.handshakes,C.peerCertificate=V?C.session.serverCertificate:C.session.clientCertificate,a.flush(C),C.isConnected=!0,C.connected(C),C.process()},a.handleAlert=function(C,L){var w=L.fragment,N={level:w.getByte(),description:w.getByte()},o;switch(N.description){case a.Alert.Description.close_notify:o="Connection closed.";break;case a.Alert.Description.unexpected_message:o="Unexpected message.";break;case a.Alert.Description.bad_record_mac:o="Bad record MAC.";break;case a.Alert.Description.decryption_failed:o="Decryption failed.";break;case a.Alert.Description.record_overflow:o="Record overflow.";break;case a.Alert.Description.decompression_failure:o="Decompression failed.";break;case a.Alert.Description.handshake_failure:o="Handshake failure.";break;case a.Alert.Description.bad_certificate:o="Bad certificate.";break;case a.Alert.Description.unsupported_certificate:o="Unsupported certificate.";break;case a.Alert.Description.certificate_revoked:o="Certificate revoked.";break;case a.Alert.Description.certificate_expired:o="Certificate expired.";break;case a.Alert.Description.certificate_unknown:o="Certificate unknown.";break;case a.Alert.Description.illegal_parameter:o="Illegal parameter.";break;case a.Alert.Description.unknown_ca:o="Unknown certificate authority.";break;case a.Alert.Description.access_denied:o="Access denied.";break;case a.Alert.Description.decode_error:o="Decode error.";break;case a.Alert.Description.decrypt_error:o="Decrypt error.";break;case a.Alert.Description.export_restriction:o="Export restriction.";break;case a.Alert.Description.protocol_version:o="Unsupported protocol version.";break;case a.Alert.Description.insufficient_security:o="Insufficient security.";break;case a.Alert.Description.internal_error:o="Internal error.";break;case a.Alert.Description.user_canceled:o="User canceled.";break;case a.Alert.Description.no_renegotiation:o="Renegotiation not supported.";break;default:o="Unknown error.";break}if(N.description===a.Alert.Description.close_notify)return C.close();C.error(C,{message:o,send:!1,origin:C.entity===a.ConnectionEnd.client?"server":"client",alert:N}),C.process()},a.handleHandshake=function(C,L){var w=L.fragment,N=w.getByte(),o=w.getInt24();if(o>w.length())return C.fragmented=L,L.fragment=t.util.createBuffer(),w.read-=4,C.process();C.fragmented=null,w.read-=4;var _=w.bytes(o+4);w.read+=4,N in ce[C.entity][C.expect]?(C.entity===a.ConnectionEnd.server&&!C.open&&!C.fail&&(C.handshaking=!0,C.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:t.md.md5.create(),sha1:t.md.sha1.create()}),N!==a.HandshakeType.hello_request&&N!==a.HandshakeType.certificate_verify&&N!==a.HandshakeType.finished&&(C.session.md5.update(_),C.session.sha1.update(_)),ce[C.entity][C.expect][N](C,L,o)):a.handleUnexpected(C,L)},a.handleApplicationData=function(C,L){C.data.putBuffer(L.fragment),C.dataReady(C),C.process()},a.handleHeartbeat=function(C,L){var w=L.fragment,N=w.getByte(),o=w.getInt16(),_=w.getBytes(o);if(N===a.HeartbeatMessageType.heartbeat_request){if(C.handshaking||o>_.length)return C.process();a.queue(C,a.createRecord(C,{type:a.ContentType.heartbeat,data:a.createHeartbeat(a.HeartbeatMessageType.heartbeat_response,_)})),a.flush(C)}else if(N===a.HeartbeatMessageType.heartbeat_response){if(_!==C.expectedHeartbeatPayload)return C.process();C.heartbeatReceived&&C.heartbeatReceived(C,t.util.createBuffer(_))}C.process()};var y=0,u=1,S=2,U=3,E=4,f=5,v=6,m=7,g=8,s=0,h=1,p=2,A=3,R=4,c=5,i=6,n=a.handleUnexpected,I=a.handleChangeCipherSpec,k=a.handleAlert,O=a.handleHandshake,P=a.handleApplicationData,K=a.handleHeartbeat,q=[];q[a.ConnectionEnd.client]=[[n,k,O,n,K],[n,k,O,n,K],[n,k,O,n,K],[n,k,O,n,K],[n,k,O,n,K],[I,k,n,n,K],[n,k,O,n,K],[n,k,O,P,K],[n,k,O,n,K]],q[a.ConnectionEnd.server]=[[n,k,O,n,K],[n,k,O,n,K],[n,k,O,n,K],[n,k,O,n,K],[I,k,n,n,K],[n,k,O,n,K],[n,k,O,P,K],[n,k,O,n,K]];var M=a.handleHelloRequest,G=a.handleServerHello,Y=a.handleCertificate,W=a.handleServerKeyExchange,ee=a.handleCertificateRequest,ne=a.handleServerHelloDone,ie=a.handleFinished,ce=[];ce[a.ConnectionEnd.client]=[[n,n,G,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n],[M,n,n,n,n,n,n,n,n,n,n,Y,W,ee,ne,n,n,n,n,n,n],[M,n,n,n,n,n,n,n,n,n,n,n,W,ee,ne,n,n,n,n,n,n],[M,n,n,n,n,n,n,n,n,n,n,n,n,ee,ne,n,n,n,n,n,n],[M,n,n,n,n,n,n,n,n,n,n,n,n,n,ne,n,n,n,n,n,n],[M,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n],[M,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,ie],[M,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n],[M,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n]];var ve=a.handleClientHello,ue=a.handleClientKeyExchange,j=a.handleCertificateVerify;ce[a.ConnectionEnd.server]=[[n,ve,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n],[n,n,n,n,n,n,n,n,n,n,n,Y,n,n,n,n,n,n,n,n,n],[n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,ue,n,n,n,n],[n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,j,n,n,n,n,n],[n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n],[n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,ie],[n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n],[n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n]],a.generateKeys=function(C,L){var w=e,N=L.client_random+L.server_random;C.session.resuming||(L.master_secret=w(L.pre_master_secret,"master secret",N,48).bytes(),L.pre_master_secret=null),N=L.server_random+L.client_random;var o=2*L.mac_key_length+2*L.enc_key_length,_=C.version.major===a.Versions.TLS_1_0.major&&C.version.minor===a.Versions.TLS_1_0.minor;_&&(o+=2*L.fixed_iv_length);var V=w(L.master_secret,"key expansion",N,o),H={client_write_MAC_key:V.getBytes(L.mac_key_length),server_write_MAC_key:V.getBytes(L.mac_key_length),client_write_key:V.getBytes(L.enc_key_length),server_write_key:V.getBytes(L.enc_key_length)};return _&&(H.client_write_IV=V.getBytes(L.fixed_iv_length),H.server_write_IV=V.getBytes(L.fixed_iv_length)),H},a.createConnectionState=function(C){var L=C.entity===a.ConnectionEnd.client,w=function(){var _={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(V){return!0},compressionState:null,compressFunction:function(V){return!0},updateSequenceNumber:function(){_.sequenceNumber[1]===4294967295?(_.sequenceNumber[1]=0,++_.sequenceNumber[0]):++_.sequenceNumber[1]}};return _},N={read:w(),write:w()};if(N.read.update=function(_,V){return N.read.cipherFunction(V,N.read)?N.read.compressFunction(_,V,N.read)||_.error(_,{message:"Could not decompress record.",send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.decompression_failure}}):_.error(_,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.bad_record_mac}}),!_.fail},N.write.update=function(_,V){return N.write.compressFunction(_,V,N.write)?N.write.cipherFunction(V,N.write)||_.error(_,{message:"Could not encrypt record.",send:!1,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.internal_error}}):_.error(_,{message:"Could not compress record.",send:!1,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.internal_error}}),!_.fail},C.session){var o=C.session.sp;switch(C.session.cipherSuite.initSecurityParameters(o),o.keys=a.generateKeys(C,o),N.read.macKey=L?o.keys.server_write_MAC_key:o.keys.client_write_MAC_key,N.write.macKey=L?o.keys.client_write_MAC_key:o.keys.server_write_MAC_key,C.session.cipherSuite.initConnectionState(N,C,o),o.compression_algorithm){case a.CompressionMethod.none:break;case a.CompressionMethod.deflate:N.read.compressFunction=T,N.write.compressFunction=d;break;default:throw new Error("Unsupported compression algorithm.")}}return N},a.createRandom=function(){var C=new Date,L=+C+C.getTimezoneOffset()*6e4,w=t.util.createBuffer();return w.putInt32(L),w.putBytes(t.random.getBytes(28)),w},a.createRecord=function(C,L){if(!L.data)return null;var w={type:L.type,version:{major:C.version.major,minor:C.version.minor},length:L.data.length(),fragment:L.data};return w},a.createAlert=function(C,L){var w=t.util.createBuffer();return w.putByte(L.level),w.putByte(L.description),a.createRecord(C,{type:a.ContentType.alert,data:w})},a.createClientHello=function(C){C.session.clientHelloVersion={major:C.version.major,minor:C.version.minor};for(var L=t.util.createBuffer(),w=0;w<C.cipherSuites.length;++w){var N=C.cipherSuites[w];L.putByte(N.id[0]),L.putByte(N.id[1])}var o=L.length(),_=t.util.createBuffer();_.putByte(a.CompressionMethod.none);var V=_.length(),H=t.util.createBuffer();if(C.virtualHost){var ae=t.util.createBuffer();ae.putByte(0),ae.putByte(0);var te=t.util.createBuffer();te.putByte(0),l(te,2,t.util.createBuffer(C.virtualHost));var Q=t.util.createBuffer();l(Q,2,te),l(ae,2,Q),H.putBuffer(ae)}var $=H.length();$>0&&($+=2);var se=C.session.id,le=se.length+1+2+4+28+2+o+1+V+$,oe=t.util.createBuffer();return oe.putByte(a.HandshakeType.client_hello),oe.putInt24(le),oe.putByte(C.version.major),oe.putByte(C.version.minor),oe.putBytes(C.session.sp.client_random),l(oe,1,t.util.createBuffer(se)),l(oe,2,L),l(oe,1,_),$>0&&l(oe,2,H),oe},a.createServerHello=function(C){var L=C.session.id,w=L.length+1+2+4+28+2+1,N=t.util.createBuffer();return N.putByte(a.HandshakeType.server_hello),N.putInt24(w),N.putByte(C.version.major),N.putByte(C.version.minor),N.putBytes(C.session.sp.server_random),l(N,1,t.util.createBuffer(L)),N.putByte(C.session.cipherSuite.id[0]),N.putByte(C.session.cipherSuite.id[1]),N.putByte(C.session.compressionMethod),N},a.createCertificate=function(C){var L=C.entity===a.ConnectionEnd.client,w=null;if(C.getCertificate){var N;L?N=C.session.certificateRequest:N=C.session.extensions.server_name.serverNameList,w=C.getCertificate(C,N)}var o=t.util.createBuffer();if(w!==null)try{t.util.isArray(w)||(w=[w]);for(var _=null,V=0;V<w.length;++V){var H=t.pem.decode(w[V])[0];if(H.type!=="CERTIFICATE"&&H.type!=="X509 CERTIFICATE"&&H.type!=="TRUSTED CERTIFICATE"){var ae=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw ae.headerType=H.type,ae}if(H.procType&&H.procType.type==="ENCRYPTED")throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var te=t.util.createBuffer(H.body);_===null&&(_=t.asn1.fromDer(te.bytes(),!1));var Q=t.util.createBuffer();l(Q,3,te),o.putBuffer(Q)}w=t.pki.certificateFromAsn1(_),L?C.session.clientCertificate=w:C.session.serverCertificate=w}catch(le){return C.error(C,{message:"Could not send certificate list.",cause:le,send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.bad_certificate}})}var $=3+o.length(),se=t.util.createBuffer();return se.putByte(a.HandshakeType.certificate),se.putInt24($),l(se,3,o),se},a.createClientKeyExchange=function(C){var L=t.util.createBuffer();L.putByte(C.session.clientHelloVersion.major),L.putByte(C.session.clientHelloVersion.minor),L.putBytes(t.random.getBytes(46));var w=C.session.sp;w.pre_master_secret=L.getBytes();var N=C.session.serverCertificate.publicKey;L=N.encrypt(w.pre_master_secret);var o=L.length+2,_=t.util.createBuffer();return _.putByte(a.HandshakeType.client_key_exchange),_.putInt24(o),_.putInt16(L.length),_.putBytes(L),_},a.createServerKeyExchange=function(C){var L=t.util.createBuffer();return L},a.getClientSignature=function(C,L){var w=t.util.createBuffer();w.putBuffer(C.session.md5.digest()),w.putBuffer(C.session.sha1.digest()),w=w.getBytes(),C.getSignature=C.getSignature||function(N,o,_){var V=null;if(N.getPrivateKey)try{V=N.getPrivateKey(N,N.session.clientCertificate),V=t.pki.privateKeyFromPem(V)}catch(H){N.error(N,{message:"Could not get private key.",cause:H,send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.internal_error}})}V===null?N.error(N,{message:"No private key set.",send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.internal_error}}):o=V.sign(o,null),_(N,o)},C.getSignature(C,w,L)},a.createCertificateVerify=function(C,L){var w=L.length+2,N=t.util.createBuffer();return N.putByte(a.HandshakeType.certificate_verify),N.putInt24(w),N.putInt16(L.length),N.putBytes(L),N},a.createCertificateRequest=function(C){var L=t.util.createBuffer();L.putByte(1);var w=t.util.createBuffer();for(var N in C.caStore.certs){var o=C.caStore.certs[N],_=t.pki.distinguishedNameToAsn1(o.subject),V=t.asn1.toDer(_);w.putInt16(V.length()),w.putBuffer(V)}var H=1+L.length()+2+w.length(),ae=t.util.createBuffer();return ae.putByte(a.HandshakeType.certificate_request),ae.putInt24(H),l(ae,1,L),l(ae,2,w),ae},a.createServerHelloDone=function(C){var L=t.util.createBuffer();return L.putByte(a.HandshakeType.server_hello_done),L.putInt24(0),L},a.createChangeCipherSpec=function(){var C=t.util.createBuffer();return C.putByte(1),C},a.createFinished=function(C){var L=t.util.createBuffer();L.putBuffer(C.session.md5.digest()),L.putBuffer(C.session.sha1.digest());var w=C.entity===a.ConnectionEnd.client,N=C.session.sp,o=12,_=e,V=w?"client finished":"server finished";L=_(N.master_secret,V,L.getBytes(),o);var H=t.util.createBuffer();return H.putByte(a.HandshakeType.finished),H.putInt24(L.length()),H.putBuffer(L),H},a.createHeartbeat=function(C,L,w){typeof w>"u"&&(w=L.length);var N=t.util.createBuffer();N.putByte(C),N.putInt16(w),N.putBytes(L);var o=N.length(),_=Math.max(16,o-w-3);return N.putBytes(t.random.getBytes(_)),N},a.queue=function(C,L){if(L&&!(L.fragment.length()===0&&(L.type===a.ContentType.handshake||L.type===a.ContentType.alert||L.type===a.ContentType.change_cipher_spec))){if(L.type===a.ContentType.handshake){var w=L.fragment.bytes();C.session.md5.update(w),C.session.sha1.update(w),w=null}var N;if(L.fragment.length()<=a.MaxFragment)N=[L];else{N=[];for(var o=L.fragment.bytes();o.length>a.MaxFragment;)N.push(a.createRecord(C,{type:L.type,data:t.util.createBuffer(o.slice(0,a.MaxFragment))})),o=o.slice(a.MaxFragment);o.length>0&&N.push(a.createRecord(C,{type:L.type,data:t.util.createBuffer(o)}))}for(var _=0;_<N.length&&!C.fail;++_){var V=N[_],H=C.state.current.write;H.update(C,V)&&C.records.push(V)}}},a.flush=function(C){for(var L=0;L<C.records.length;++L){var w=C.records[L];C.tlsData.putByte(w.type),C.tlsData.putByte(w.version.major),C.tlsData.putByte(w.version.minor),C.tlsData.putInt16(w.fragment.length()),C.tlsData.putBuffer(C.records[L].fragment)}return C.records=[],C.tlsDataReady(C)};var Z=function(C){switch(C){case!0:return!0;case t.pki.certificateError.bad_certificate:return a.Alert.Description.bad_certificate;case t.pki.certificateError.unsupported_certificate:return a.Alert.Description.unsupported_certificate;case t.pki.certificateError.certificate_revoked:return a.Alert.Description.certificate_revoked;case t.pki.certificateError.certificate_expired:return a.Alert.Description.certificate_expired;case t.pki.certificateError.certificate_unknown:return a.Alert.Description.certificate_unknown;case t.pki.certificateError.unknown_ca:return a.Alert.Description.unknown_ca;default:return a.Alert.Description.bad_certificate}},ze=function(C){switch(C){case!0:return!0;case a.Alert.Description.bad_certificate:return t.pki.certificateError.bad_certificate;case a.Alert.Description.unsupported_certificate:return t.pki.certificateError.unsupported_certificate;case a.Alert.Description.certificate_revoked:return t.pki.certificateError.certificate_revoked;case a.Alert.Description.certificate_expired:return t.pki.certificateError.certificate_expired;case a.Alert.Description.certificate_unknown:return t.pki.certificateError.certificate_unknown;case a.Alert.Description.unknown_ca:return t.pki.certificateError.unknown_ca;default:return t.pki.certificateError.bad_certificate}};a.verifyCertificateChain=function(C,L){try{var w={};for(var N in C.verifyOptions)w[N]=C.verifyOptions[N];w.verify=function(_,V,H){var ae=Z(_),te=C.verify(C,_,V,H);if(te!==!0){if(typeof te=="object"&&!t.util.isArray(te)){var Q=new Error("The application rejected the certificate.");throw Q.send=!0,Q.alert={level:a.Alert.Level.fatal,description:a.Alert.Description.bad_certificate},te.message&&(Q.message=te.message),te.alert&&(Q.alert.description=te.alert),Q}te!==_&&(te=ze(te))}return te},t.pki.verifyCertificateChain(C.caStore,L,w)}catch(_){var o=_;(typeof o!="object"||t.util.isArray(o))&&(o={send:!0,alert:{level:a.Alert.Level.fatal,description:Z(_)}}),"send"in o||(o.send=!0),"alert"in o||(o.alert={level:a.Alert.Level.fatal,description:Z(o.error)}),C.error(C,o)}return!C.fail},a.createSessionCache=function(C,L){var w=null;if(C&&C.getSession&&C.setSession&&C.order)w=C;else{w={},w.cache=C||{},w.capacity=Math.max(L||100,1),w.order=[];for(var N in C)w.order.length<=L?w.order.push(N):delete C[N];w.getSession=function(o){var _=null,V=null;if(o?V=t.util.bytesToHex(o):w.order.length>0&&(V=w.order[0]),V!==null&&V in w.cache){_=w.cache[V],delete w.cache[V];for(var H in w.order)if(w.order[H]===V){w.order.splice(H,1);break}}return _},w.setSession=function(o,_){if(w.order.length===w.capacity){var V=w.order.shift();delete w.cache[V]}var V=t.util.bytesToHex(o);w.order.push(V),w.cache[V]=_}}return w},a.createConnection=function(C){var L=null;C.caStore?t.util.isArray(C.caStore)?L=t.pki.createCaStore(C.caStore):L=C.caStore:L=t.pki.createCaStore();var w=C.cipherSuites||null;if(w===null){w=[];for(var N in a.CipherSuites)w.push(a.CipherSuites[N])}var o=C.server?a.ConnectionEnd.server:a.ConnectionEnd.client,_=C.sessionCache?a.createSessionCache(C.sessionCache):null,V={version:{major:a.Version.major,minor:a.Version.minor},entity:o,sessionId:C.sessionId,caStore:L,sessionCache:_,cipherSuites:w,connected:C.connected,virtualHost:C.virtualHost||null,verifyClient:C.verifyClient||!1,verify:C.verify||function(Q,$,se,le){return $},verifyOptions:C.verifyOptions||{},getCertificate:C.getCertificate||null,getPrivateKey:C.getPrivateKey||null,getSignature:C.getSignature||null,input:t.util.createBuffer(),tlsData:t.util.createBuffer(),data:t.util.createBuffer(),tlsDataReady:C.tlsDataReady,dataReady:C.dataReady,heartbeatReceived:C.heartbeatReceived,closed:C.closed,error:function(Q,$){$.origin=$.origin||(Q.entity===a.ConnectionEnd.client?"client":"server"),$.send&&(a.queue(Q,a.createAlert(Q,$.alert)),a.flush(Q));var se=$.fatal!==!1;se&&(Q.fail=!0),C.error(Q,$),se&&Q.close(!1)},deflate:C.deflate||null,inflate:C.inflate||null};V.reset=function(Q){V.version={major:a.Version.major,minor:a.Version.minor},V.record=null,V.session=null,V.peerCertificate=null,V.state={pending:null,current:null},V.expect=V.entity===a.ConnectionEnd.client?y:s,V.fragmented=null,V.records=[],V.open=!1,V.handshakes=0,V.handshaking=!1,V.isConnected=!1,V.fail=!(Q||typeof Q>"u"),V.input.clear(),V.tlsData.clear(),V.data.clear(),V.state.current=a.createConnectionState(V)},V.reset();var H=function(Q,$){var se=$.type-a.ContentType.change_cipher_spec,le=q[Q.entity][Q.expect];se in le?le[se](Q,$):a.handleUnexpected(Q,$)},ae=function(Q){var $=0,se=Q.input,le=se.length();if(le<5)$=5-le;else{Q.record={type:se.getByte(),version:{major:se.getByte(),minor:se.getByte()},length:se.getInt16(),fragment:t.util.createBuffer(),ready:!1};var oe=Q.record.version.major===Q.version.major;oe&&Q.session&&Q.session.version&&(oe=Q.record.version.minor===Q.version.minor),oe||Q.error(Q,{message:"Incompatible TLS version.",send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.protocol_version}})}return $},te=function(Q){var $=0,se=Q.input,le=se.length();if(le<Q.record.length)$=Q.record.length-le;else{Q.record.fragment.putBytes(se.getBytes(Q.record.length)),se.compact();var oe=Q.state.current.read;oe.update(Q,Q.record)&&(Q.fragmented!==null&&(Q.fragmented.type===Q.record.type?(Q.fragmented.fragment.putBuffer(Q.record.fragment),Q.record=Q.fragmented):Q.error(Q,{message:"Invalid fragmented record.",send:!0,alert:{level:a.Alert.Level.fatal,description:a.Alert.Description.unexpected_message}})),Q.record.ready=!0)}return $};return V.handshake=function(Q){if(V.entity!==a.ConnectionEnd.client)V.error(V,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(V.handshaking)V.error(V,{message:"Handshake already in progress.",fatal:!1});else{V.fail&&!V.open&&V.handshakes===0&&(V.fail=!1),V.handshaking=!0,Q=Q||"";var $=null;Q.length>0&&(V.sessionCache&&($=V.sessionCache.getSession(Q)),$===null&&(Q="")),Q.length===0&&V.sessionCache&&($=V.sessionCache.getSession(),$!==null&&(Q=$.id)),V.session={id:Q,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:t.md.md5.create(),sha1:t.md.sha1.create()},$&&(V.version=$.version,V.session.sp=$.sp),V.session.sp.client_random=a.createRandom().getBytes(),V.open=!0,a.queue(V,a.createRecord(V,{type:a.ContentType.handshake,data:a.createClientHello(V)})),a.flush(V)}},V.process=function(Q){var $=0;return Q&&V.input.putBytes(Q),V.fail||(V.record!==null&&V.record.ready&&V.record.fragment.isEmpty()&&(V.record=null),V.record===null&&($=ae(V)),!V.fail&&V.record!==null&&!V.record.ready&&($=te(V)),!V.fail&&V.record!==null&&V.record.ready&&H(V,V.record)),$},V.prepare=function(Q){return a.queue(V,a.createRecord(V,{type:a.ContentType.application_data,data:t.util.createBuffer(Q)})),a.flush(V)},V.prepareHeartbeatRequest=function(Q,$){return Q instanceof t.util.ByteBuffer&&(Q=Q.bytes()),typeof $>"u"&&($=Q.length),V.expectedHeartbeatPayload=Q,a.queue(V,a.createRecord(V,{type:a.ContentType.heartbeat,data:a.createHeartbeat(a.HeartbeatMessageType.heartbeat_request,Q,$)})),a.flush(V)},V.close=function(Q){if(!V.fail&&V.sessionCache&&V.session){var $={id:V.session.id,version:V.session.version,sp:V.session.sp};$.sp.keys=null,V.sessionCache.setSession($.id,$)}V.open&&(V.open=!1,V.input.clear(),(V.isConnected||V.handshaking)&&(V.isConnected=V.handshaking=!1,a.queue(V,a.createAlert(V,{level:a.Alert.Level.warning,description:a.Alert.Description.close_notify})),a.flush(V)),V.closed(V)),V.reset(Q)},V},pr=t.tls=t.tls||{};for(var qe in a)typeof a[qe]!="function"&&(t.tls[qe]=a[qe]);return t.tls.prf_tls1=e,t.tls.hmac_sha1=r,t.tls.createSessionCache=a.createSessionCache,t.tls.createConnection=a.createConnection,pr}var ha;function Tn(){if(ha)return Gt.exports;ha=1;var t=fe();ht(),Ma();var e=Gt.exports=t.tls;e.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(y){y.bulk_cipher_algorithm=e.BulkCipherAlgorithm.aes,y.cipher_type=e.CipherType.block,y.enc_key_length=16,y.block_length=16,y.fixed_iv_length=16,y.record_iv_length=16,y.mac_algorithm=e.MACAlgorithm.hmac_sha1,y.mac_length=20,y.mac_key_length=20},initConnectionState:r},e.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(y){y.bulk_cipher_algorithm=e.BulkCipherAlgorithm.aes,y.cipher_type=e.CipherType.block,y.enc_key_length=32,y.block_length=16,y.fixed_iv_length=16,y.record_iv_length=16,y.mac_algorithm=e.MACAlgorithm.hmac_sha1,y.mac_length=20,y.mac_key_length=20},initConnectionState:r};function r(y,u,S){var U=u.entity===t.tls.ConnectionEnd.client;y.read.cipherState={init:!1,cipher:t.cipher.createDecipher("AES-CBC",U?S.keys.server_write_key:S.keys.client_write_key),iv:U?S.keys.server_write_IV:S.keys.client_write_IV},y.write.cipherState={init:!1,cipher:t.cipher.createCipher("AES-CBC",U?S.keys.client_write_key:S.keys.server_write_key),iv:U?S.keys.client_write_IV:S.keys.server_write_IV},y.read.cipherFunction=l,y.write.cipherFunction=d,y.read.macLength=y.write.macLength=S.mac_length,y.read.macFunction=y.write.macFunction=e.hmac_sha1}function d(y,u){var S=!1,U=u.macFunction(u.macKey,u.sequenceNumber,y);y.fragment.putBytes(U),u.updateSequenceNumber();var E;y.version.minor===e.Versions.TLS_1_0.minor?E=u.cipherState.init?null:u.cipherState.iv:E=t.random.getBytesSync(16),u.cipherState.init=!0;var f=u.cipherState.cipher;return f.start({iv:E}),y.version.minor>=e.Versions.TLS_1_1.minor&&f.output.putBytes(E),f.update(y.fragment),f.finish(T)&&(y.fragment=f.output,y.length=y.fragment.length(),S=!0),S}function T(y,u,S){if(!S){var U=y-u.length()%y;u.fillWithByte(U-1,U)}return!0}function x(y,u,S){var U=!0;if(S){for(var E=u.length(),f=u.last(),v=E-1-f;v<E-1;++v)U=U&&u.at(v)==f;U&&u.truncate(f+1)}return U}function l(y,u){var S=!1,U;y.version.minor===e.Versions.TLS_1_0.minor?U=u.cipherState.init?null:u.cipherState.iv:U=y.fragment.getBytes(16),u.cipherState.init=!0;var E=u.cipherState.cipher;E.start({iv:U}),E.update(y.fragment),S=E.finish(x);var f=u.macLength,v=t.random.getBytesSync(f),m=E.output.length();m>=f?(y.fragment=E.output.getBytes(m-f),v=E.output.getBytes(f)):y.fragment=E.output.getBytes(),y.fragment=t.util.createBuffer(y.fragment),y.length=y.fragment.length();var g=u.macFunction(u.macKey,u.sequenceNumber,y);return u.updateSequenceNumber(),S=a(u.macKey,v,g)&&S,S}function a(y,u,S){var U=t.hmac.create();return U.start("SHA1",y),U.update(u),u=U.digest().getBytes(),U.start(null,null),U.update(S),S=U.digest().getBytes(),u===S}return Gt.exports}var vr={exports:{}},pa;function qa(){if(pa)return vr.exports;pa=1;var t=fe();ft(),de();var e=vr.exports=t.sha512=t.sha512||{};t.md.sha512=t.md.algorithms.sha512=e;var r=t.sha384=t.sha512.sha384=t.sha512.sha384||{};r.create=function(){return e.create("SHA-384")},t.md.sha384=t.md.algorithms.sha384=r,t.sha512.sha256=t.sha512.sha256||{create:function(){return e.create("SHA-512/256")}},t.md["sha512/256"]=t.md.algorithms["sha512/256"]=t.sha512.sha256,t.sha512.sha224=t.sha512.sha224||{create:function(){return e.create("SHA-512/224")}},t.md["sha512/224"]=t.md.algorithms["sha512/224"]=t.sha512.sha224,e.create=function(u){if(T||a(),typeof u>"u"&&(u="SHA-512"),!(u in l))throw new Error("Invalid SHA-512 algorithm: "+u);for(var S=l[u],U=null,E=t.util.createBuffer(),f=new Array(80),v=0;v<80;++v)f[v]=new Array(2);var m=64;switch(u){case"SHA-384":m=48;break;case"SHA-512/256":m=32;break;case"SHA-512/224":m=28;break}var g={algorithm:u.replace("-","").toLowerCase(),blockLength:128,digestLength:m,messageLength:0,fullMessageLength:null,messageLengthSize:16};return g.start=function(){g.messageLength=0,g.fullMessageLength=g.messageLength128=[];for(var s=g.messageLengthSize/4,h=0;h<s;++h)g.fullMessageLength.push(0);E=t.util.createBuffer(),U=new Array(S.length);for(var h=0;h<S.length;++h)U[h]=S[h].slice(0);return g},g.start(),g.update=function(s,h){h==="utf8"&&(s=t.util.encodeUtf8(s));var p=s.length;g.messageLength+=p,p=[p/4294967296>>>0,p>>>0];for(var A=g.fullMessageLength.length-1;A>=0;--A)g.fullMessageLength[A]+=p[1],p[1]=p[0]+(g.fullMessageLength[A]/4294967296>>>0),g.fullMessageLength[A]=g.fullMessageLength[A]>>>0,p[0]=p[1]/4294967296>>>0;return E.putBytes(s),y(U,f,E),(E.read>2048||E.length()===0)&&E.compact(),g},g.digest=function(){var s=t.util.createBuffer();s.putBytes(E.bytes());var h=g.fullMessageLength[g.fullMessageLength.length-1]+g.messageLengthSize,p=h&g.blockLength-1;s.putBytes(d.substr(0,g.blockLength-p));for(var A,R,c=g.fullMessageLength[0]*8,i=0;i<g.fullMessageLength.length-1;++i)A=g.fullMessageLength[i+1]*8,R=A/4294967296>>>0,c+=R,s.putInt32(c>>>0),c=A>>>0;s.putInt32(c);for(var n=new Array(U.length),i=0;i<U.length;++i)n[i]=U[i].slice(0);y(n,f,s);var I=t.util.createBuffer(),k;u==="SHA-512"?k=n.length:u==="SHA-384"?k=n.length-2:k=n.length-4;for(var i=0;i<k;++i)I.putInt32(n[i][0]),(i!==k-1||u!=="SHA-512/224")&&I.putInt32(n[i][1]);return I},g};var d=null,T=!1,x=null,l=null;function a(){d="",d+=t.util.fillString("\0",128),x=[[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]],l={},l["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],l["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],l["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],l["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],T=!0}function y(u,S,U){for(var E,f,v,m,g,s,h,p,A,R,c,i,n,I,k,O,P,K,q,M,G,Y,W,ee,ne,ie,ce,ve,ue,j,Z,ze,qe,C,L,w=U.length();w>=128;){for(ue=0;ue<16;++ue)S[ue][0]=U.getInt32()>>>0,S[ue][1]=U.getInt32()>>>0;for(;ue<80;++ue)ze=S[ue-2],j=ze[0],Z=ze[1],E=((j>>>19|Z<<13)^(Z>>>29|j<<3)^j>>>6)>>>0,f=((j<<13|Z>>>19)^(Z<<3|j>>>29)^(j<<26|Z>>>6))>>>0,C=S[ue-15],j=C[0],Z=C[1],v=((j>>>1|Z<<31)^(j>>>8|Z<<24)^j>>>7)>>>0,m=((j<<31|Z>>>1)^(j<<24|Z>>>8)^(j<<25|Z>>>7))>>>0,qe=S[ue-7],L=S[ue-16],Z=f+qe[1]+m+L[1],S[ue][0]=E+qe[0]+v+L[0]+(Z/4294967296>>>0)>>>0,S[ue][1]=Z>>>0;for(n=u[0][0],I=u[0][1],k=u[1][0],O=u[1][1],P=u[2][0],K=u[2][1],q=u[3][0],M=u[3][1],G=u[4][0],Y=u[4][1],W=u[5][0],ee=u[5][1],ne=u[6][0],ie=u[6][1],ce=u[7][0],ve=u[7][1],ue=0;ue<80;++ue)h=((G>>>14|Y<<18)^(G>>>18|Y<<14)^(Y>>>9|G<<23))>>>0,p=((G<<18|Y>>>14)^(G<<14|Y>>>18)^(Y<<23|G>>>9))>>>0,A=(ne^G&(W^ne))>>>0,R=(ie^Y&(ee^ie))>>>0,g=((n>>>28|I<<4)^(I>>>2|n<<30)^(I>>>7|n<<25))>>>0,s=((n<<4|I>>>28)^(I<<30|n>>>2)^(I<<25|n>>>7))>>>0,c=(n&k|P&(n^k))>>>0,i=(I&O|K&(I^O))>>>0,Z=ve+p+R+x[ue][1]+S[ue][1],E=ce+h+A+x[ue][0]+S[ue][0]+(Z/4294967296>>>0)>>>0,f=Z>>>0,Z=s+i,v=g+c+(Z/4294967296>>>0)>>>0,m=Z>>>0,ce=ne,ve=ie,ne=W,ie=ee,W=G,ee=Y,Z=M+f,G=q+E+(Z/4294967296>>>0)>>>0,Y=Z>>>0,q=P,M=K,P=k,K=O,k=n,O=I,Z=f+m,n=E+v+(Z/4294967296>>>0)>>>0,I=Z>>>0;Z=u[0][1]+I,u[0][0]=u[0][0]+n+(Z/4294967296>>>0)>>>0,u[0][1]=Z>>>0,Z=u[1][1]+O,u[1][0]=u[1][0]+k+(Z/4294967296>>>0)>>>0,u[1][1]=Z>>>0,Z=u[2][1]+K,u[2][0]=u[2][0]+P+(Z/4294967296>>>0)>>>0,u[2][1]=Z>>>0,Z=u[3][1]+M,u[3][0]=u[3][0]+q+(Z/4294967296>>>0)>>>0,u[3][1]=Z>>>0,Z=u[4][1]+Y,u[4][0]=u[4][0]+G+(Z/4294967296>>>0)>>>0,u[4][1]=Z>>>0,Z=u[5][1]+ee,u[5][0]=u[5][0]+W+(Z/4294967296>>>0)>>>0,u[5][1]=Z>>>0,Z=u[6][1]+ie,u[6][0]=u[6][0]+ne+(Z/4294967296>>>0)>>>0,u[6][1]=Z>>>0,Z=u[7][1]+ve,u[7][0]=u[7][0]+ce+(Z/4294967296>>>0)>>>0,u[7][1]=Z>>>0,w-=128}}return vr.exports}var _t={},va;function An(){if(va)return _t;va=1;var t=fe();it();var e=t.asn1;return _t.privateKeyValidator={name:"PrivateKeyInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:e.Class.UNIVERSAL,type:e.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},_t.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:e.Class.UNIVERSAL,type:e.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{tagClass:e.Class.UNIVERSAL,type:e.Type.BITSTRING,constructed:!1,composed:!0,captureBitStringValue:"ed25519PublicKey"}]},_t}var yr,ya;function In(){if(ya)return yr;ya=1;var t=fe();kt(),at(),qa(),de();var e=An(),r=e.publicKeyValidator,d=e.privateKeyValidator;if(typeof T>"u")var T=t.jsbn.BigInteger;var x=t.util.ByteBuffer,l=typeof Buffer>"u"?Uint8Array:Buffer;t.pki=t.pki||{},yr=t.pki.ed25519=t.ed25519=t.ed25519||{};var a=t.ed25519;a.constants={},a.constants.PUBLIC_KEY_BYTE_LENGTH=32,a.constants.PRIVATE_KEY_BYTE_LENGTH=64,a.constants.SEED_BYTE_LENGTH=32,a.constants.SIGN_BYTE_LENGTH=64,a.constants.HASH_BYTE_LENGTH=64,a.generateKeyPair=function(L){L=L||{};var w=L.seed;if(w===void 0)w=t.random.getBytesSync(a.constants.SEED_BYTE_LENGTH);else if(typeof w=="string"){if(w.length!==a.constants.SEED_BYTE_LENGTH)throw new TypeError('"seed" must be '+a.constants.SEED_BYTE_LENGTH+" bytes in length.")}else if(!(w instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, Uint8Array, or a binary string.');w=y({message:w,encoding:"binary"});for(var N=new l(a.constants.PUBLIC_KEY_BYTE_LENGTH),o=new l(a.constants.PRIVATE_KEY_BYTE_LENGTH),_=0;_<32;++_)o[_]=w[_];return h(N,o),{publicKey:N,privateKey:o}},a.privateKeyFromAsn1=function(L){var w={},N=[],o=t.asn1.validate(L,d,w,N);if(!o){var _=new Error("Invalid Key.");throw _.errors=N,_}var V=t.asn1.derToOid(w.privateKeyOid),H=t.oids.EdDSA25519;if(V!==H)throw new Error('Invalid OID "'+V+'"; OID must be "'+H+'".');var ae=w.privateKey,te=y({message:t.asn1.fromDer(ae).value,encoding:"binary"});return{privateKeyBytes:te}},a.publicKeyFromAsn1=function(L){var w={},N=[],o=t.asn1.validate(L,r,w,N);if(!o){var _=new Error("Invalid Key.");throw _.errors=N,_}var V=t.asn1.derToOid(w.publicKeyOid),H=t.oids.EdDSA25519;if(V!==H)throw new Error('Invalid OID "'+V+'"; OID must be "'+H+'".');var ae=w.ed25519PublicKey;if(ae.length!==a.constants.PUBLIC_KEY_BYTE_LENGTH)throw new Error("Key length is invalid.");return y({message:ae,encoding:"binary"})},a.publicKeyFromPrivateKey=function(L){L=L||{};var w=y({message:L.privateKey,encoding:"binary"});if(w.length!==a.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+a.constants.PRIVATE_KEY_BYTE_LENGTH);for(var N=new l(a.constants.PUBLIC_KEY_BYTE_LENGTH),o=0;o<N.length;++o)N[o]=w[32+o];return N},a.sign=function(L){L=L||{};var w=y(L),N=y({message:L.privateKey,encoding:"binary"});if(N.length===a.constants.SEED_BYTE_LENGTH){var o=a.generateKeyPair({seed:N});N=o.privateKey}else if(N.length!==a.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+a.constants.SEED_BYTE_LENGTH+" or "+a.constants.PRIVATE_KEY_BYTE_LENGTH);var _=new l(a.constants.SIGN_BYTE_LENGTH+w.length);p(_,w,w.length,N);for(var V=new l(a.constants.SIGN_BYTE_LENGTH),H=0;H<V.length;++H)V[H]=_[H];return V},a.verify=function(L){L=L||{};var w=y(L);if(L.signature===void 0)throw new TypeError('"options.signature" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a binary string.');var N=y({message:L.signature,encoding:"binary"});if(N.length!==a.constants.SIGN_BYTE_LENGTH)throw new TypeError('"options.signature" must have a byte length of '+a.constants.SIGN_BYTE_LENGTH);var o=y({message:L.publicKey,encoding:"binary"});if(o.length!==a.constants.PUBLIC_KEY_BYTE_LENGTH)throw new TypeError('"options.publicKey" must have a byte length of '+a.constants.PUBLIC_KEY_BYTE_LENGTH);var _=new l(a.constants.SIGN_BYTE_LENGTH+w.length),V=new l(a.constants.SIGN_BYTE_LENGTH+w.length),H;for(H=0;H<a.constants.SIGN_BYTE_LENGTH;++H)_[H]=N[H];for(H=0;H<w.length;++H)_[H+a.constants.SIGN_BYTE_LENGTH]=w[H];return A(V,_,_.length,o)>=0};function y(L){var w=L.message;if(w instanceof Uint8Array||w instanceof l)return w;var N=L.encoding;if(w===void 0)if(L.md)w=L.md.digest().getBytes(),N="binary";else throw new TypeError('"options.message" or "options.md" not specified.');if(typeof w=="string"&&!N)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if(typeof w=="string"){if(typeof Buffer<"u")return Buffer.from(w,N);w=new x(w,N)}else if(!(w instanceof x))throw new TypeError('"options.message" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a string with "options.encoding" specifying its encoding.');for(var o=new l(w.length()),_=0;_<o.length;++_)o[_]=w.at(_);return o}var u=j(),S=j([1]),U=j([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),E=j([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),f=j([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),v=j([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),m=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]),g=j([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function s(L,w){var N=t.md.sha512.create(),o=new x(L);N.update(o.getBytes(w),"binary");var _=N.digest().getBytes();if(typeof Buffer<"u")return Buffer.from(_,"binary");for(var V=new l(a.constants.HASH_BYTE_LENGTH),H=0;H<64;++H)V[H]=_.charCodeAt(H);return V}function h(L,w){var N=[j(),j(),j(),j()],o,_=s(w,32);for(_[0]&=248,_[31]&=127,_[31]|=64,ne(N,_),k(L,N),o=0;o<32;++o)w[o+32]=L[o];return 0}function p(L,w,N,o){var _,V,H=new Float64Array(64),ae=[j(),j(),j(),j()],te=s(o,32);te[0]&=248,te[31]&=127,te[31]|=64;var Q=N+64;for(_=0;_<N;++_)L[64+_]=w[_];for(_=0;_<32;++_)L[32+_]=te[32+_];var $=s(L.subarray(32),N+32);for(i($),ne(ae,$),k(L,ae),_=32;_<64;++_)L[_]=o[_];var se=s(L,N+64);for(i(se),_=32;_<64;++_)H[_]=0;for(_=0;_<32;++_)H[_]=$[_];for(_=0;_<32;++_)for(V=0;V<32;V++)H[_+V]+=se[_]*te[V];return c(L.subarray(32),H),Q}function A(L,w,N,o){var _,V,H=new l(32),ae=[j(),j(),j(),j()],te=[j(),j(),j(),j()];if(V=-1,N<64||P(te,o)||!R(w,32))return-1;for(_=0;_<N;++_)L[_]=w[_];for(_=0;_<32;++_)L[_+32]=o[_];var Q=s(L,N);if(i(Q),ee(ae,te,Q),ne(te,w.subarray(32)),n(ae,te),k(H,ae),N-=64,G(w,0,H,0)){for(_=0;_<N;++_)L[_]=0;return-1}for(_=0;_<N;++_)L[_]=w[_+64];return V=N,V}function R(L,w){var N;for(N=31;N>=0;--N){if(L[w+N]<m[N])return!0;if(L[w+N]>m[N])return!1}return!1}function c(L,w){var N,o,_,V;for(o=63;o>=32;--o){for(N=0,_=o-32,V=o-12;_<V;++_)w[_]+=N-16*w[o]*m[_-(o-32)],N=w[_]+128>>8,w[_]-=N*256;w[_]+=N,w[o]=0}for(N=0,_=0;_<32;++_)w[_]+=N-(w[31]>>4)*m[_],N=w[_]>>8,w[_]&=255;for(_=0;_<32;++_)w[_]-=N*m[_];for(o=0;o<32;++o)w[o+1]+=w[o]>>8,L[o]=w[o]&255}function i(L){for(var w=new Float64Array(64),N=0;N<64;++N)w[N]=L[N],L[N]=0;c(L,w)}function n(L,w){var N=j(),o=j(),_=j(),V=j(),H=j(),ae=j(),te=j(),Q=j(),$=j();ze(N,L[1],L[0]),ze($,w[1],w[0]),C(N,N,$),Z(o,L[0],L[1]),Z($,w[0],w[1]),C(o,o,$),C(_,L[3],w[3]),C(_,_,E),C(V,L[2],w[2]),Z(V,V,V),ze(H,o,N),ze(ae,V,_),Z(te,V,_),Z(Q,o,N),C(L[0],H,ae),C(L[1],Q,te),C(L[2],te,ae),C(L[3],H,Q)}function I(L,w,N){for(var o=0;o<4;++o)ue(L[o],w[o],N)}function k(L,w){var N=j(),o=j(),_=j();ce(_,w[2]),C(N,w[0],_),C(o,w[1],_),O(L,o),L[31]^=W(N)<<7}function O(L,w){var N,o,_,V=j(),H=j();for(N=0;N<16;++N)H[N]=w[N];for(ve(H),ve(H),ve(H),o=0;o<2;++o){for(V[0]=H[0]-65517,N=1;N<15;++N)V[N]=H[N]-65535-(V[N-1]>>16&1),V[N-1]&=65535;V[15]=H[15]-32767-(V[14]>>16&1),_=V[15]>>16&1,V[14]&=65535,ue(H,V,1-_)}for(N=0;N<16;N++)L[2*N]=H[N]&255,L[2*N+1]=H[N]>>8}function P(L,w){var N=j(),o=j(),_=j(),V=j(),H=j(),ae=j(),te=j();return ie(L[2],S),K(L[1],w),qe(_,L[1]),C(V,_,U),ze(_,_,L[2]),Z(V,L[2],V),qe(H,V),qe(ae,H),C(te,ae,H),C(N,te,_),C(N,N,V),q(N,N),C(N,N,_),C(N,N,V),C(N,N,V),C(L[0],N,V),qe(o,L[0]),C(o,o,V),M(o,_)&&C(L[0],L[0],g),qe(o,L[0]),C(o,o,V),M(o,_)?-1:(W(L[0])===w[31]>>7&&ze(L[0],u,L[0]),C(L[3],L[0],L[1]),0)}function K(L,w){var N;for(N=0;N<16;++N)L[N]=w[2*N]+(w[2*N+1]<<8);L[15]&=32767}function q(L,w){var N=j(),o;for(o=0;o<16;++o)N[o]=w[o];for(o=250;o>=0;--o)qe(N,N),o!==1&&C(N,N,w);for(o=0;o<16;++o)L[o]=N[o]}function M(L,w){var N=new l(32),o=new l(32);return O(N,L),O(o,w),G(N,0,o,0)}function G(L,w,N,o){return Y(L,w,N,o,32)}function Y(L,w,N,o,_){var V,H=0;for(V=0;V<_;++V)H|=L[w+V]^N[o+V];return(1&H-1>>>8)-1}function W(L){var w=new l(32);return O(w,L),w[0]&1}function ee(L,w,N){var o,_;for(ie(L[0],u),ie(L[1],S),ie(L[2],S),ie(L[3],u),_=255;_>=0;--_)o=N[_/8|0]>>(_&7)&1,I(L,w,o),n(w,L),n(L,L),I(L,w,o)}function ne(L,w){var N=[j(),j(),j(),j()];ie(N[0],f),ie(N[1],v),ie(N[2],S),C(N[3],f,v),ee(L,N,w)}function ie(L,w){var N;for(N=0;N<16;N++)L[N]=w[N]|0}function ce(L,w){var N=j(),o;for(o=0;o<16;++o)N[o]=w[o];for(o=253;o>=0;--o)qe(N,N),o!==2&&o!==4&&C(N,N,w);for(o=0;o<16;++o)L[o]=N[o]}function ve(L){var w,N,o=1;for(w=0;w<16;++w)N=L[w]+o+65535,o=Math.floor(N/65536),L[w]=N-o*65536;L[0]+=o-1+37*(o-1)}function ue(L,w,N){for(var o,_=~(N-1),V=0;V<16;++V)o=_&(L[V]^w[V]),L[V]^=o,w[V]^=o}function j(L){var w,N=new Float64Array(16);if(L)for(w=0;w<L.length;++w)N[w]=L[w];return N}function Z(L,w,N){for(var o=0;o<16;++o)L[o]=w[o]+N[o]}function ze(L,w,N){for(var o=0;o<16;++o)L[o]=w[o]-N[o]}function qe(L,w){C(L,w,w)}function C(L,w,N){var o,_,V=0,H=0,ae=0,te=0,Q=0,$=0,se=0,le=0,oe=0,Ce=0,Se=0,xe=0,Ee=0,ge=0,ye=0,pe=0,Te=0,Ae=0,He=0,Ge=0,Ye=0,Xe=0,Ze=0,Je=0,nt=0,st=0,ut=0,dt=0,vt=0,Ct=0,bt=0,Ie=N[0],Be=N[1],_e=N[2],Ne=N[3],we=N[4],Re=N[5],Le=N[6],ke=N[7],Ue=N[8],De=N[9],Pe=N[10],Ve=N[11],me=N[12],be=N[13],Oe=N[14],Ke=N[15];o=w[0],V+=o*Ie,H+=o*Be,ae+=o*_e,te+=o*Ne,Q+=o*we,$+=o*Re,se+=o*Le,le+=o*ke,oe+=o*Ue,Ce+=o*De,Se+=o*Pe,xe+=o*Ve,Ee+=o*me,ge+=o*be,ye+=o*Oe,pe+=o*Ke,o=w[1],H+=o*Ie,ae+=o*Be,te+=o*_e,Q+=o*Ne,$+=o*we,se+=o*Re,le+=o*Le,oe+=o*ke,Ce+=o*Ue,Se+=o*De,xe+=o*Pe,Ee+=o*Ve,ge+=o*me,ye+=o*be,pe+=o*Oe,Te+=o*Ke,o=w[2],ae+=o*Ie,te+=o*Be,Q+=o*_e,$+=o*Ne,se+=o*we,le+=o*Re,oe+=o*Le,Ce+=o*ke,Se+=o*Ue,xe+=o*De,Ee+=o*Pe,ge+=o*Ve,ye+=o*me,pe+=o*be,Te+=o*Oe,Ae+=o*Ke,o=w[3],te+=o*Ie,Q+=o*Be,$+=o*_e,se+=o*Ne,le+=o*we,oe+=o*Re,Ce+=o*Le,Se+=o*ke,xe+=o*Ue,Ee+=o*De,ge+=o*Pe,ye+=o*Ve,pe+=o*me,Te+=o*be,Ae+=o*Oe,He+=o*Ke,o=w[4],Q+=o*Ie,$+=o*Be,se+=o*_e,le+=o*Ne,oe+=o*we,Ce+=o*Re,Se+=o*Le,xe+=o*ke,Ee+=o*Ue,ge+=o*De,ye+=o*Pe,pe+=o*Ve,Te+=o*me,Ae+=o*be,He+=o*Oe,Ge+=o*Ke,o=w[5],$+=o*Ie,se+=o*Be,le+=o*_e,oe+=o*Ne,Ce+=o*we,Se+=o*Re,xe+=o*Le,Ee+=o*ke,ge+=o*Ue,ye+=o*De,pe+=o*Pe,Te+=o*Ve,Ae+=o*me,He+=o*be,Ge+=o*Oe,Ye+=o*Ke,o=w[6],se+=o*Ie,le+=o*Be,oe+=o*_e,Ce+=o*Ne,Se+=o*we,xe+=o*Re,Ee+=o*Le,ge+=o*ke,ye+=o*Ue,pe+=o*De,Te+=o*Pe,Ae+=o*Ve,He+=o*me,Ge+=o*be,Ye+=o*Oe,Xe+=o*Ke,o=w[7],le+=o*Ie,oe+=o*Be,Ce+=o*_e,Se+=o*Ne,xe+=o*we,Ee+=o*Re,ge+=o*Le,ye+=o*ke,pe+=o*Ue,Te+=o*De,Ae+=o*Pe,He+=o*Ve,Ge+=o*me,Ye+=o*be,Xe+=o*Oe,Ze+=o*Ke,o=w[8],oe+=o*Ie,Ce+=o*Be,Se+=o*_e,xe+=o*Ne,Ee+=o*we,ge+=o*Re,ye+=o*Le,pe+=o*ke,Te+=o*Ue,Ae+=o*De,He+=o*Pe,Ge+=o*Ve,Ye+=o*me,Xe+=o*be,Ze+=o*Oe,Je+=o*Ke,o=w[9],Ce+=o*Ie,Se+=o*Be,xe+=o*_e,Ee+=o*Ne,ge+=o*we,ye+=o*Re,pe+=o*Le,Te+=o*ke,Ae+=o*Ue,He+=o*De,Ge+=o*Pe,Ye+=o*Ve,Xe+=o*me,Ze+=o*be,Je+=o*Oe,nt+=o*Ke,o=w[10],Se+=o*Ie,xe+=o*Be,Ee+=o*_e,ge+=o*Ne,ye+=o*we,pe+=o*Re,Te+=o*Le,Ae+=o*ke,He+=o*Ue,Ge+=o*De,Ye+=o*Pe,Xe+=o*Ve,Ze+=o*me,Je+=o*be,nt+=o*Oe,st+=o*Ke,o=w[11],xe+=o*Ie,Ee+=o*Be,ge+=o*_e,ye+=o*Ne,pe+=o*we,Te+=o*Re,Ae+=o*Le,He+=o*ke,Ge+=o*Ue,Ye+=o*De,Xe+=o*Pe,Ze+=o*Ve,Je+=o*me,nt+=o*be,st+=o*Oe,ut+=o*Ke,o=w[12],Ee+=o*Ie,ge+=o*Be,ye+=o*_e,pe+=o*Ne,Te+=o*we,Ae+=o*Re,He+=o*Le,Ge+=o*ke,Ye+=o*Ue,Xe+=o*De,Ze+=o*Pe,Je+=o*Ve,nt+=o*me,st+=o*be,ut+=o*Oe,dt+=o*Ke,o=w[13],ge+=o*Ie,ye+=o*Be,pe+=o*_e,Te+=o*Ne,Ae+=o*we,He+=o*Re,Ge+=o*Le,Ye+=o*ke,Xe+=o*Ue,Ze+=o*De,Je+=o*Pe,nt+=o*Ve,st+=o*me,ut+=o*be,dt+=o*Oe,vt+=o*Ke,o=w[14],ye+=o*Ie,pe+=o*Be,Te+=o*_e,Ae+=o*Ne,He+=o*we,Ge+=o*Re,Ye+=o*Le,Xe+=o*ke,Ze+=o*Ue,Je+=o*De,nt+=o*Pe,st+=o*Ve,ut+=o*me,dt+=o*be,vt+=o*Oe,Ct+=o*Ke,o=w[15],pe+=o*Ie,Te+=o*Be,Ae+=o*_e,He+=o*Ne,Ge+=o*we,Ye+=o*Re,Xe+=o*Le,Ze+=o*ke,Je+=o*Ue,nt+=o*De,st+=o*Pe,ut+=o*Ve,dt+=o*me,vt+=o*be,Ct+=o*Oe,bt+=o*Ke,V+=38*Te,H+=38*Ae,ae+=38*He,te+=38*Ge,Q+=38*Ye,$+=38*Xe,se+=38*Ze,le+=38*Je,oe+=38*nt,Ce+=38*st,Se+=38*ut,xe+=38*dt,Ee+=38*vt,ge+=38*Ct,ye+=38*bt,_=1,o=V+_+65535,_=Math.floor(o/65536),V=o-_*65536,o=H+_+65535,_=Math.floor(o/65536),H=o-_*65536,o=ae+_+65535,_=Math.floor(o/65536),ae=o-_*65536,o=te+_+65535,_=Math.floor(o/65536),te=o-_*65536,o=Q+_+65535,_=Math.floor(o/65536),Q=o-_*65536,o=$+_+65535,_=Math.floor(o/65536),$=o-_*65536,o=se+_+65535,_=Math.floor(o/65536),se=o-_*65536,o=le+_+65535,_=Math.floor(o/65536),le=o-_*65536,o=oe+_+65535,_=Math.floor(o/65536),oe=o-_*65536,o=Ce+_+65535,_=Math.floor(o/65536),Ce=o-_*65536,o=Se+_+65535,_=Math.floor(o/65536),Se=o-_*65536,o=xe+_+65535,_=Math.floor(o/65536),xe=o-_*65536,o=Ee+_+65535,_=Math.floor(o/65536),Ee=o-_*65536,o=ge+_+65535,_=Math.floor(o/65536),ge=o-_*65536,o=ye+_+65535,_=Math.floor(o/65536),ye=o-_*65536,o=pe+_+65535,_=Math.floor(o/65536),pe=o-_*65536,V+=_-1+37*(_-1),_=1,o=V+_+65535,_=Math.floor(o/65536),V=o-_*65536,o=H+_+65535,_=Math.floor(o/65536),H=o-_*65536,o=ae+_+65535,_=Math.floor(o/65536),ae=o-_*65536,o=te+_+65535,_=Math.floor(o/65536),te=o-_*65536,o=Q+_+65535,_=Math.floor(o/65536),Q=o-_*65536,o=$+_+65535,_=Math.floor(o/65536),$=o-_*65536,o=se+_+65535,_=Math.floor(o/65536),se=o-_*65536,o=le+_+65535,_=Math.floor(o/65536),le=o-_*65536,o=oe+_+65535,_=Math.floor(o/65536),oe=o-_*65536,o=Ce+_+65535,_=Math.floor(o/65536),Ce=o-_*65536,o=Se+_+65535,_=Math.floor(o/65536),Se=o-_*65536,o=xe+_+65535,_=Math.floor(o/65536),xe=o-_*65536,o=Ee+_+65535,_=Math.floor(o/65536),Ee=o-_*65536,o=ge+_+65535,_=Math.floor(o/65536),ge=o-_*65536,o=ye+_+65535,_=Math.floor(o/65536),ye=o-_*65536,o=pe+_+65535,_=Math.floor(o/65536),pe=o-_*65536,V+=_-1+37*(_-1),L[0]=V,L[1]=H,L[2]=ae,L[3]=te,L[4]=Q,L[5]=$,L[6]=se,L[7]=le,L[8]=oe,L[9]=Ce,L[10]=Se,L[11]=xe,L[12]=Ee,L[13]=ge,L[14]=ye,L[15]=pe}return yr}var gr,ga;function Bn(){if(ga)return gr;ga=1;var t=fe();de(),at(),kt(),gr=t.kem=t.kem||{};var e=t.jsbn.BigInteger;t.kem.rsa={},t.kem.rsa.create=function(d,T){T=T||{};var x=T.prng||t.random,l={};return l.encrypt=function(a,y){var u=Math.ceil(a.n.bitLength()/8),S;do S=new e(t.util.bytesToHex(x.getBytesSync(u)),16).mod(a.n);while(S.compareTo(e.ONE)<=0);S=t.util.hexToBytes(S.toString(16));var U=u-S.length;U>0&&(S=t.util.fillString("\0",U)+S);var E=a.encrypt(S,"NONE"),f=d.generate(S,y);return{encapsulation:E,key:f}},l.decrypt=function(a,y,u){var S=a.decrypt(y,"NONE");return d.generate(S,u)},l},t.kem.kdf1=function(d,T){r(this,d,0,T||d.digestLength)},t.kem.kdf2=function(d,T){r(this,d,1,T||d.digestLength)};function r(d,T,x,l){d.generate=function(a,y){for(var u=new t.util.ByteBuffer,S=Math.ceil(y/l)+x,U=new t.util.ByteBuffer,E=x;E<S;++E){U.putInt32(E),T.start(),T.update(a+U.getBytes());var f=T.digest();u.putBytes(f.getBytes(l))}return u.truncate(u.length()-y),u.getBytes()}}return gr}var mr,ma;function _n(){if(ma)return mr;ma=1;var t=fe();de(),mr=t.log=t.log||{},t.log.levels=["none","error","warning","info","debug","verbose","max"];var e={},r=[],d=null;t.log.LEVEL_LOCKED=2,t.log.NO_LEVEL_CHECK=4,t.log.INTERPOLATE=8;for(var T=0;T<t.log.levels.length;++T){var x=t.log.levels[T];e[x]={index:T,name:x.toUpperCase()}}t.log.logMessage=function(E){for(var f=e[E.level].index,v=0;v<r.length;++v){var m=r[v];if(m.flags&t.log.NO_LEVEL_CHECK)m.f(E);else{var g=e[m.level].index;f<=g&&m.f(m,E)}}},t.log.prepareStandard=function(E){"standard"in E||(E.standard=e[E.level].name+" ["+E.category+"] "+E.message)},t.log.prepareFull=function(E){if(!("full"in E)){var f=[E.message];f=f.concat([]),E.full=t.util.format.apply(this,f)}},t.log.prepareStandardFull=function(E){"standardFull"in E||(t.log.prepareStandard(E),E.standardFull=E.standard)};for(var l=["error","warning","info","debug","verbose"],T=0;T<l.length;++T)(function(f){t.log[f]=function(v,m){var g=Array.prototype.slice.call(arguments).slice(2),s={timestamp:new Date,level:f,category:v,message:m,arguments:g};t.log.logMessage(s)}})(l[T]);if(t.log.makeLogger=function(E){var f={flags:0,f:E};return t.log.setLevel(f,"none"),f},t.log.setLevel=function(E,f){var v=!1;if(E&&!(E.flags&t.log.LEVEL_LOCKED))for(var m=0;m<t.log.levels.length;++m){var g=t.log.levels[m];if(f==g){E.level=f,v=!0;break}}return v},t.log.lock=function(E,f){typeof f>"u"||f?E.flags|=t.log.LEVEL_LOCKED:E.flags&=~t.log.LEVEL_LOCKED},t.log.addLogger=function(E){r.push(E)},typeof console<"u"&&"log"in console){var a;if(console.error&&console.warn&&console.info&&console.debug){var y={error:console.error,warning:console.warn,info:console.info,debug:console.debug,verbose:console.debug},u=function(E,f){t.log.prepareStandard(f);var v=y[f.level],m=[f.standard];m=m.concat(f.arguments.slice()),v.apply(console,m)};a=t.log.makeLogger(u)}else{var u=function(f,v){t.log.prepareStandardFull(v),console.log(v.standardFull)};a=t.log.makeLogger(u)}t.log.setLevel(a,"debug"),t.log.addLogger(a),d=a}else console={log:function(){}};if(d!==null&&typeof window<"u"&&window.location){var S=new URL(window.location.href).searchParams;if(S.has("console.level")&&t.log.setLevel(d,S.get("console.level").slice(-1)[0]),S.has("console.lock")){var U=S.get("console.lock").slice(-1)[0];U=="true"&&t.log.lock(d)}}return t.log.consoleLogger=d,mr}var Cr,Ca;function Nn(){return Ca||(Ca=1,Cr=ft(),Nr(),St(),Ra(),qa()),Cr}var Er={exports:{}},Ea;function wn(){if(Ea)return Er.exports;Ea=1;var t=fe();ht(),it(),Lt(),pt(),mt(),Va(),at(),de(),kr();var e=t.asn1,r=Er.exports=t.pkcs7=t.pkcs7||{};r.messageFromPem=function(f){var v=t.pem.decode(f)[0];if(v.type!=="PKCS7"){var m=new Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw m.headerType=v.type,m}if(v.procType&&v.procType.type==="ENCRYPTED")throw new Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var g=e.fromDer(v.body);return r.messageFromAsn1(g)},r.messageToPem=function(f,v){var m={type:"PKCS7",body:e.toDer(f.toAsn1()).getBytes()};return t.pem.encode(m,{maxline:v})},r.messageFromAsn1=function(f){var v={},m=[];if(!e.validate(f,r.asn1.contentInfoValidator,v,m)){var g=new Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw g.errors=m,g}var s=e.derToOid(v.contentType),h;switch(s){case t.pki.oids.envelopedData:h=r.createEnvelopedData();break;case t.pki.oids.encryptedData:h=r.createEncryptedData();break;case t.pki.oids.signedData:h=r.createSignedData();break;default:throw new Error("Cannot read PKCS#7 message. ContentType with OID "+s+" is not (yet) supported.")}return h.fromAsn1(v.content.value[0]),h},r.createSignedData=function(){var f=null;return f={type:t.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(g){if(U(f,g,r.asn1.signedDataValidator),f.certificates=[],f.crls=[],f.digestAlgorithmIdentifiers=[],f.contentInfo=null,f.signerInfos=[],f.rawCapture.certificates)for(var s=f.rawCapture.certificates.value,h=0;h<s.length;++h)f.certificates.push(t.pki.certificateFromAsn1(s[h]))},toAsn1:function(){f.contentInfo||f.sign();for(var g=[],s=0;s<f.certificates.length;++s)g.push(t.pki.certificateToAsn1(f.certificates[s]));var h=[],p=e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(f.version).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,f.digestAlgorithmIdentifiers),f.contentInfo])]);return g.length>0&&p.value[0].value.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!0,g)),h.length>0&&p.value[0].value.push(e.create(e.Class.CONTEXT_SPECIFIC,1,!0,h)),p.value[0].value.push(e.create(e.Class.UNIVERSAL,e.Type.SET,!0,f.signerInfos)),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(f.type).getBytes()),p])},addSigner:function(g){var s=g.issuer,h=g.serialNumber;if(g.certificate){var p=g.certificate;typeof p=="string"&&(p=t.pki.certificateFromPem(p)),s=p.issuer.attributes,h=p.serialNumber}var A=g.key;if(!A)throw new Error("Could not add PKCS#7 signer; no private key specified.");typeof A=="string"&&(A=t.pki.privateKeyFromPem(A));var R=g.digestAlgorithm||t.pki.oids.sha1;switch(R){case t.pki.oids.sha1:case t.pki.oids.sha256:case t.pki.oids.sha384:case t.pki.oids.sha512:case t.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+R)}var c=g.authenticatedAttributes||[];if(c.length>0){for(var i=!1,n=!1,I=0;I<c.length;++I){var k=c[I];if(!i&&k.type===t.pki.oids.contentType){if(i=!0,n)break;continue}if(!n&&k.type===t.pki.oids.messageDigest){if(n=!0,i)break;continue}}if(!i||!n)throw new 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.")}f.signers.push({key:A,version:1,issuer:s,serialNumber:h,digestAlgorithm:R,signatureAlgorithm:t.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:c,unauthenticatedAttributes:[]})},sign:function(g){if(g=g||{},(typeof f.content!="object"||f.contentInfo===null)&&(f.contentInfo=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.pki.oids.data).getBytes())]),"content"in f)){var s;f.content instanceof t.util.ByteBuffer?s=f.content.bytes():typeof f.content=="string"&&(s=t.util.encodeUtf8(f.content)),g.detached?f.detachedContent=e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,s):f.contentInfo.value.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,s)]))}if(f.signers.length!==0){var h=v();m(h)}},verify:function(){throw new Error("PKCS#7 signature verification not yet implemented.")},addCertificate:function(g){typeof g=="string"&&(g=t.pki.certificateFromPem(g)),f.certificates.push(g)},addCertificateRevokationList:function(g){throw new Error("PKCS#7 CRL support not yet implemented.")}},f;function v(){for(var g={},s=0;s<f.signers.length;++s){var h=f.signers[s],p=h.digestAlgorithm;p in g||(g[p]=t.md[t.pki.oids[p]].create()),h.authenticatedAttributes.length===0?h.md=g[p]:h.md=t.md[t.pki.oids[p]].create()}f.digestAlgorithmIdentifiers=[];for(var p in g)f.digestAlgorithmIdentifiers.push(e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(p).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")]));return g}function m(g){var s;if(f.detachedContent?s=f.detachedContent:(s=f.contentInfo.value[1],s=s.value[0]),!s)throw new Error("Could not sign PKCS#7 message; there is no content to sign.");var h=e.derToOid(f.contentInfo.value[0].value),p=e.toDer(s);p.getByte(),e.getBerValueLength(p),p=p.getBytes();for(var A in g)g[A].start().update(p);for(var R=new Date,c=0;c<f.signers.length;++c){var i=f.signers[c];if(i.authenticatedAttributes.length===0){if(h!==t.pki.oids.data)throw new Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.")}else{i.authenticatedAttributesAsn1=e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var n=e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[]),I=0;I<i.authenticatedAttributes.length;++I){var k=i.authenticatedAttributes[I];k.type===t.pki.oids.messageDigest?k.value=g[i.digestAlgorithm].digest():k.type===t.pki.oids.signingTime&&(k.value||(k.value=R)),n.value.push(u(k)),i.authenticatedAttributesAsn1.value.push(u(k))}p=e.toDer(n).getBytes(),i.md.start().update(p)}i.signature=i.key.sign(i.md,"RSASSA-PKCS1-V1_5")}f.signerInfos=y(f.signers)}},r.createEncryptedData=function(){var f=null;return f={type:t.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:t.pki.oids["aes256-CBC"]},fromAsn1:function(v){U(f,v,r.asn1.encryptedDataValidator)},decrypt:function(v){v!==void 0&&(f.encryptedContent.key=v),E(f)}},f},r.createEnvelopedData=function(){var f=null;return f={type:t.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:t.pki.oids["aes256-CBC"]},fromAsn1:function(v){var m=U(f,v,r.asn1.envelopedDataValidator);f.recipients=x(m.recipientInfos.value)},toAsn1:function(){return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(f.type).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(f.version).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,l(f.recipients)),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,S(f.encryptedContent))])])])},findRecipient:function(v){for(var m=v.issuer.attributes,g=0;g<f.recipients.length;++g){var s=f.recipients[g],h=s.issuer;if(s.serialNumber===v.serialNumber&&h.length===m.length){for(var p=!0,A=0;A<m.length;++A)if(h[A].type!==m[A].type||h[A].value!==m[A].value){p=!1;break}if(p)return s}}return null},decrypt:function(v,m){if(f.encryptedContent.key===void 0&&v!==void 0&&m!==void 0)switch(v.encryptedContent.algorithm){case t.pki.oids.rsaEncryption:case t.pki.oids.desCBC:var g=m.decrypt(v.encryptedContent.content);f.encryptedContent.key=t.util.createBuffer(g);break;default:throw new Error("Unsupported asymmetric cipher, OID "+v.encryptedContent.algorithm)}E(f)},addRecipient:function(v){f.recipients.push({version:0,issuer:v.issuer.attributes,serialNumber:v.serialNumber,encryptedContent:{algorithm:t.pki.oids.rsaEncryption,key:v.publicKey}})},encrypt:function(v,m){if(f.encryptedContent.content===void 0){m=m||f.encryptedContent.algorithm,v=v||f.encryptedContent.key;var g,s,h;switch(m){case t.pki.oids["aes128-CBC"]:g=16,s=16,h=t.aes.createEncryptionCipher;break;case t.pki.oids["aes192-CBC"]:g=24,s=16,h=t.aes.createEncryptionCipher;break;case t.pki.oids["aes256-CBC"]:g=32,s=16,h=t.aes.createEncryptionCipher;break;case t.pki.oids["des-EDE3-CBC"]:g=24,s=8,h=t.des.createEncryptionCipher;break;default:throw new Error("Unsupported symmetric cipher, OID "+m)}if(v===void 0)v=t.util.createBuffer(t.random.getBytes(g));else if(v.length()!=g)throw new Error("Symmetric key has wrong length; got "+v.length()+" bytes, expected "+g+".");f.encryptedContent.algorithm=m,f.encryptedContent.key=v,f.encryptedContent.parameter=t.util.createBuffer(t.random.getBytes(s));var p=h(v);if(p.start(f.encryptedContent.parameter.copy()),p.update(f.content),!p.finish())throw new Error("Symmetric encryption failed.");f.encryptedContent.content=p.output}for(var A=0;A<f.recipients.length;++A){var R=f.recipients[A];if(R.encryptedContent.content===void 0)switch(R.encryptedContent.algorithm){case t.pki.oids.rsaEncryption:R.encryptedContent.content=R.encryptedContent.key.encrypt(f.encryptedContent.key.data);break;default:throw new Error("Unsupported asymmetric cipher, OID "+R.encryptedContent.algorithm)}}}},f};function d(f){var v={},m=[];if(!e.validate(f,r.asn1.recipientInfoValidator,v,m)){var g=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw g.errors=m,g}return{version:v.version.charCodeAt(0),issuer:t.pki.RDNAttributesAsArray(v.issuer),serialNumber:t.util.createBuffer(v.serial).toHex(),encryptedContent:{algorithm:e.derToOid(v.encAlgorithm),parameter:v.encParameter?v.encParameter.value:void 0,content:v.encKey}}}function T(f){return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(f.version).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[t.pki.distinguishedNameToAsn1({attributes:f.issuer}),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,t.util.hexToBytes(f.serialNumber))]),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(f.encryptedContent.algorithm).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")]),e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,f.encryptedContent.content)])}function x(f){for(var v=[],m=0;m<f.length;++m)v.push(d(f[m]));return v}function l(f){for(var v=[],m=0;m<f.length;++m)v.push(T(f[m]));return v}function a(f){var v=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(f.version).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[t.pki.distinguishedNameToAsn1({attributes:f.issuer}),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,t.util.hexToBytes(f.serialNumber))]),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(f.digestAlgorithm).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")])]);if(f.authenticatedAttributesAsn1&&v.value.push(f.authenticatedAttributesAsn1),v.value.push(e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(f.signatureAlgorithm).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")])),v.value.push(e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,f.signature)),f.unauthenticatedAttributes.length>0){for(var m=e.create(e.Class.CONTEXT_SPECIFIC,1,!0,[]),g=0;g<f.unauthenticatedAttributes.length;++g){var s=f.unauthenticatedAttributes[g];m.values.push(u(s))}v.value.push(m)}return v}function y(f){for(var v=[],m=0;m<f.length;++m)v.push(a(f[m]));return v}function u(f){var v;if(f.type===t.pki.oids.contentType)v=e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(f.value).getBytes());else if(f.type===t.pki.oids.messageDigest)v=e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,f.value.bytes());else if(f.type===t.pki.oids.signingTime){var m=new Date("1950-01-01T00:00:00Z"),g=new Date("2050-01-01T00:00:00Z"),s=f.value;if(typeof s=="string"){var h=Date.parse(s);isNaN(h)?s.length===13?s=e.utcTimeToDate(s):s=e.generalizedTimeToDate(s):s=new Date(h)}s>=m&&s<g?v=e.create(e.Class.UNIVERSAL,e.Type.UTCTIME,!1,e.dateToUtcTime(s)):v=e.create(e.Class.UNIVERSAL,e.Type.GENERALIZEDTIME,!1,e.dateToGeneralizedTime(s))}return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(f.type).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[v])])}function S(f){return[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(t.pki.oids.data).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(f.algorithm).getBytes()),f.parameter?e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,f.parameter.getBytes()):void 0]),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,f.content.getBytes())])]}function U(f,v,m){var g={},s=[];if(!e.validate(v,m,g,s)){var h=new Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw h.errors=h,h}var p=e.derToOid(g.contentType);if(p!==t.pki.oids.data)throw new Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(g.encryptedContent){var A="";if(t.util.isArray(g.encryptedContent))for(var R=0;R<g.encryptedContent.length;++R){if(g.encryptedContent[R].type!==e.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");A+=g.encryptedContent[R].value}else A=g.encryptedContent;f.encryptedContent={algorithm:e.derToOid(g.encAlgorithm),parameter:t.util.createBuffer(g.encParameter.value),content:t.util.createBuffer(A)}}if(g.content){var A="";if(t.util.isArray(g.content))for(var R=0;R<g.content.length;++R){if(g.content[R].type!==e.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");A+=g.content[R].value}else A=g.content;f.content=t.util.createBuffer(A)}return f.version=g.version.charCodeAt(0),f.rawCapture=g,g}function E(f){if(f.encryptedContent.key===void 0)throw new Error("Symmetric key not available.");if(f.content===void 0){var v;switch(f.encryptedContent.algorithm){case t.pki.oids["aes128-CBC"]:case t.pki.oids["aes192-CBC"]:case t.pki.oids["aes256-CBC"]:v=t.aes.createDecryptionCipher(f.encryptedContent.key);break;case t.pki.oids.desCBC:case t.pki.oids["des-EDE3-CBC"]:v=t.des.createDecryptionCipher(f.encryptedContent.key);break;default:throw new Error("Unsupported symmetric cipher, OID "+f.encryptedContent.algorithm)}if(v.start(f.encryptedContent.parameter),v.update(f.encryptedContent.content),!v.finish())throw new Error("Symmetric decryption failed.");f.content=v.output}}return Er.exports}var xr={exports:{}},xa;function Rn(){if(xa)return xr.exports;xa=1;var t=fe();ht(),xt(),Nr(),St(),de();var e=xr.exports=t.ssh=t.ssh||{};e.privateKeyToPutty=function(x,l,a){a=a||"",l=l||"";var y="ssh-rsa",u=l===""?"none":"aes256-cbc",S="PuTTY-User-Key-File-2: "+y+`\r
|
|
15
|
+
`;S+="Encryption: "+u+`\r
|
|
16
|
+
`,S+="Comment: "+a+`\r
|
|
17
|
+
`;var U=t.util.createBuffer();d(U,y),r(U,x.e),r(U,x.n);var E=t.util.encode64(U.bytes(),64),f=Math.floor(E.length/66)+1;S+="Public-Lines: "+f+`\r
|
|
18
|
+
`,S+=E;var v=t.util.createBuffer();r(v,x.d),r(v,x.p),r(v,x.q),r(v,x.qInv);var m;if(!l)m=t.util.encode64(v.bytes(),64);else{var g=v.length()+16-1;g-=g%16;var s=T(v.bytes());s.truncate(s.length()-g+v.length()),v.putBuffer(s);var h=t.util.createBuffer();h.putBuffer(T("\0\0\0\0",l)),h.putBuffer(T("\0\0\0",l));var p=t.aes.createEncryptionCipher(h.truncate(8),"CBC");p.start(t.util.createBuffer().fillWithByte(0,16)),p.update(v.copy()),p.finish();var A=p.output;A.truncate(16),m=t.util.encode64(A.bytes(),64)}f=Math.floor(m.length/66)+1,S+=`\r
|
|
19
|
+
Private-Lines: `+f+`\r
|
|
20
|
+
`,S+=m;var R=T("putty-private-key-file-mac-key",l),c=t.util.createBuffer();d(c,y),d(c,u),d(c,a),c.putInt32(U.length()),c.putBuffer(U),c.putInt32(v.length()),c.putBuffer(v);var i=t.hmac.create();return i.start("sha1",R),i.update(c.bytes()),S+=`\r
|
|
21
|
+
Private-MAC: `+i.digest().toHex()+`\r
|
|
22
|
+
`,S},e.publicKeyToOpenSSH=function(x,l){var a="ssh-rsa";l=l||"";var y=t.util.createBuffer();return d(y,a),r(y,x.e),r(y,x.n),a+" "+t.util.encode64(y.bytes())+" "+l},e.privateKeyToOpenSSH=function(x,l){return l?t.pki.encryptRsaPrivateKey(x,l,{legacy:!0,algorithm:"aes128"}):t.pki.privateKeyToPem(x)},e.getPublicKeyFingerprint=function(x,l){l=l||{};var a=l.md||t.md.md5.create(),y="ssh-rsa",u=t.util.createBuffer();d(u,y),r(u,x.e),r(u,x.n),a.start(),a.update(u.getBytes());var S=a.digest();if(l.encoding==="hex"){var U=S.toHex();return l.delimiter?U.match(/.{2}/g).join(l.delimiter):U}else{if(l.encoding==="binary")return S.getBytes();if(l.encoding)throw new Error('Unknown encoding "'+l.encoding+'".')}return S};function r(x,l){var a=l.toString(16);a[0]>="8"&&(a="00"+a);var y=t.util.hexToBytes(a);x.putInt32(y.length),x.putBytes(y)}function d(x,l){x.putInt32(l.length),x.putString(l)}function T(){for(var x=t.md.sha1.create(),l=arguments.length,a=0;a<l;++a)x.update(arguments[a]);return x.digest()}return xr.exports}var Sr,Sa;function Ln(){return Sa||(Sa=1,Sr=fe(),ht(),Tn(),it(),_r(),Lt(),In(),xt(),Bn(),_n(),Nn(),Oa(),Rr(),mt(),Ua(),Ka(),wn(),Fa(),Da(),La(),Lr(),at(),ka(),Rn(),Ma(),de()),Sr}var kn=Ln();const Un=mn(kn);exports.AppleGsaSrpClient=vn;exports.forge=Un;
|