Your IP : 216.73.216.52


Current Path : /snap/lxd/38768/share/lxd-ui/assets/
Upload File :
Current File : //snap/lxd/38768/share/lxd-ui/assets/certificate-DT5PfSbU.js

(function(){"use strict";var Ea=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function xa(a){return a&&a.__esModule&&Object.prototype.hasOwnProperty.call(a,"default")?a.default:a}function Sa(a){if(Object.prototype.hasOwnProperty.call(a,"__esModule"))return a;var e=a.default;if(typeof e=="function"){var i=function v(){var _=!1;try{_=this instanceof v}catch{}return _?Reflect.construct(e,arguments,this.constructor):e.apply(this,arguments)};i.prototype=e.prototype}else i={};return Object.defineProperty(i,"__esModule",{value:!0}),Object.keys(a).forEach(function(v){var _=Object.getOwnPropertyDescriptor(a,v);Object.defineProperty(i,v,_.get?_:{enumerable:!0,get:function(){return a[v]}})}),i}var Bt,Cr;function ue(){return Cr||(Cr=1,Bt={options:{usePureJavaScript:!1}}),Bt}var bt={exports:{}},_t,mr;function Ta(){if(mr)return _t;mr=1;var a={};_t=a;var e={};a.encode=function(v,_,S){if(typeof _!="string")throw new TypeError('"alphabet" must be a string.');if(S!==void 0&&typeof S!="number")throw new TypeError('"maxline" must be a number.');var h="";if(!(v instanceof Uint8Array))h=i(v,_);else{var t=0,C=_.length,l=_.charAt(0),x=[0];for(t=0;t<v.length;++t){for(var k=0,E=v[t];k<x.length;++k)E+=x[k]<<8,x[k]=E%C,E=E/C|0;for(;E>0;)x.push(E%C),E=E/C|0}for(t=0;v[t]===0&&t<v.length-1;++t)h+=l;for(t=x.length-1;t>=0;--t)h+=_[x[t]]}if(S){var u=new RegExp(".{1,"+S+"}","g");h=h.match(u).join(`\r
`)}return h},a.decode=function(v,_){if(typeof v!="string")throw new TypeError('"input" must be a string.');if(typeof _!="string")throw new TypeError('"alphabet" must be a string.');var S=e[_];if(!S){S=e[_]=[];for(var h=0;h<_.length;++h)S[_.charCodeAt(h)]=h}v=v.replace(/\s/g,"");for(var t=_.length,C=_.charAt(0),l=[0],h=0;h<v.length;h++){var x=S[v.charCodeAt(h)];if(x===void 0)return;for(var k=0,E=x;k<l.length;++k)E+=l[k]*t,l[k]=E&255,E>>=8;for(;E>0;)l.push(E&255),E>>=8}for(var u=0;v[u]===C&&u<v.length-1;++u)l.push(0);return typeof Buffer<"u"?Buffer.from(l.reverse()):new Uint8Array(l.reverse())};function i(v,_){var S=0,h=_.length,t=_.charAt(0),C=[0];for(S=0;S<v.length();++S){for(var l=0,x=v.at(S);l<C.length;++l)x+=C[l]<<8,C[l]=x%h,x=x/h|0;for(;x>0;)C.push(x%h),x=x/h|0}var k="";for(S=0;v.at(S)===0&&S<v.length()-1;++S)k+=t;for(S=C.length-1;S>=0;--S)k+=_[C[S]];return k}return _t}var Er;function de(){if(Er)return bt.exports;Er=1;var a=ue(),e=Ta(),i=bt.exports=a.util=a.util||{};(function(){if(typeof process<"u"&&process.nextTick&&!process.browser){i.nextTick=process.nextTick,typeof setImmediate=="function"?i.setImmediate=setImmediate:i.setImmediate=i.nextTick;return}if(typeof setImmediate=="function"){i.setImmediate=function(){return setImmediate.apply(void 0,arguments)},i.nextTick=function(n){return setImmediate(n)};return}if(i.setImmediate=function(n){setTimeout(n,0)},typeof window<"u"&&typeof window.postMessage=="function"){let n=function(r){if(r.source===window&&r.data===s){r.stopPropagation();var B=d.slice();d.length=0,B.forEach(function(D){D()})}};var s="forge.setImmediate",d=[];i.setImmediate=function(r){d.push(r),d.length===1&&window.postMessage(s,"*")},window.addEventListener("message",n,!0)}if(typeof MutationObserver<"u"){var p=Date.now(),I=!0,R=document.createElement("div"),d=[];new MutationObserver(function(){var r=d.slice();d.length=0,r.forEach(function(B){B()})}).observe(R,{attributes:!0});var c=i.setImmediate;i.setImmediate=function(r){Date.now()-p>15?(p=Date.now(),c(r)):(d.push(r),d.length===1&&R.setAttribute("a",I=!I))}}i.nextTick=i.setImmediate})(),i.isNodejs=typeof process<"u"&&process.versions&&process.versions.node,i.globalScope=(function(){return i.isNodejs?Ea:typeof self>"u"?window:self})(),i.isArray=Array.isArray||function(s){return Object.prototype.toString.call(s)==="[object Array]"},i.isArrayBuffer=function(s){return typeof ArrayBuffer<"u"&&s instanceof ArrayBuffer},i.isArrayBufferView=function(s){return s&&i.isArrayBuffer(s.buffer)&&s.byteLength!==void 0};function v(s){if(!(s===8||s===16||s===24||s===32))throw new Error("Only 8, 16, 24, or 32 bits supported: "+s)}i.ByteBuffer=_;function _(s){if(this.data="",this.read=0,typeof s=="string")this.data=s;else if(i.isArrayBuffer(s)||i.isArrayBufferView(s))if(typeof Buffer<"u"&&s instanceof Buffer)this.data=s.toString("binary");else{var d=new Uint8Array(s);try{this.data=String.fromCharCode.apply(null,d)}catch{for(var p=0;p<d.length;++p)this.putByte(d[p])}}else(s instanceof _||typeof s=="object"&&typeof s.data=="string"&&typeof s.read=="number")&&(this.data=s.data,this.read=s.read);this._constructedStringLength=0}i.ByteStringBuffer=_;var S=4096;i.ByteStringBuffer.prototype._optimizeConstructedString=function(s){this._constructedStringLength+=s,this._constructedStringLength>S&&(this.data.substr(0,1),this._constructedStringLength=0)},i.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},i.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},i.ByteStringBuffer.prototype.putByte=function(s){return this.putBytes(String.fromCharCode(s))},i.ByteStringBuffer.prototype.fillWithByte=function(s,d){s=String.fromCharCode(s);for(var p=this.data;d>0;)d&1&&(p+=s),d>>>=1,d>0&&(s+=s);return this.data=p,this._optimizeConstructedString(d),this},i.ByteStringBuffer.prototype.putBytes=function(s){return this.data+=s,this._optimizeConstructedString(s.length),this},i.ByteStringBuffer.prototype.putString=function(s){return this.putBytes(i.encodeUtf8(s))},i.ByteStringBuffer.prototype.putInt16=function(s){return this.putBytes(String.fromCharCode(s>>8&255)+String.fromCharCode(s&255))},i.ByteStringBuffer.prototype.putInt24=function(s){return this.putBytes(String.fromCharCode(s>>16&255)+String.fromCharCode(s>>8&255)+String.fromCharCode(s&255))},i.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))},i.ByteStringBuffer.prototype.putInt16Le=function(s){return this.putBytes(String.fromCharCode(s&255)+String.fromCharCode(s>>8&255))},i.ByteStringBuffer.prototype.putInt24Le=function(s){return this.putBytes(String.fromCharCode(s&255)+String.fromCharCode(s>>8&255)+String.fromCharCode(s>>16&255))},i.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))},i.ByteStringBuffer.prototype.putInt=function(s,d){v(d);var p="";do d-=8,p+=String.fromCharCode(s>>d&255);while(d>0);return this.putBytes(p)},i.ByteStringBuffer.prototype.putSignedInt=function(s,d){return s<0&&(s+=2<<d-1),this.putInt(s,d)},i.ByteStringBuffer.prototype.putBuffer=function(s){return this.putBytes(s.getBytes())},i.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)},i.ByteStringBuffer.prototype.getInt16=function(){var s=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,s},i.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},i.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},i.ByteStringBuffer.prototype.getInt16Le=function(){var s=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,s},i.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},i.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},i.ByteStringBuffer.prototype.getInt=function(s){v(s);var d=0;do d=(d<<8)+this.data.charCodeAt(this.read++),s-=8;while(s>0);return d},i.ByteStringBuffer.prototype.getSignedInt=function(s){var d=this.getInt(s),p=2<<s-2;return d>=p&&(d-=p<<1),d},i.ByteStringBuffer.prototype.getBytes=function(s){var d;return s?(s=Math.min(this.length(),s),d=this.data.slice(this.read,this.read+s),this.read+=s):s===0?d="":(d=this.read===0?this.data:this.data.slice(this.read),this.clear()),d},i.ByteStringBuffer.prototype.bytes=function(s){return typeof s>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+s)},i.ByteStringBuffer.prototype.at=function(s){return this.data.charCodeAt(this.read+s)},i.ByteStringBuffer.prototype.setAt=function(s,d){return this.data=this.data.substr(0,this.read+s)+String.fromCharCode(d)+this.data.substr(this.read+s+1),this},i.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},i.ByteStringBuffer.prototype.copy=function(){var s=i.createBuffer(this.data);return s.read=this.read,s},i.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},i.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},i.ByteStringBuffer.prototype.truncate=function(s){var d=Math.max(0,this.length()-s);return this.data=this.data.substr(this.read,d),this.read=0,this},i.ByteStringBuffer.prototype.toHex=function(){for(var s="",d=this.read;d<this.data.length;++d){var p=this.data.charCodeAt(d);p<16&&(s+="0"),s+=p.toString(16)}return s},i.ByteStringBuffer.prototype.toString=function(){return i.decodeUtf8(this.bytes())};function h(s,d){d=d||{},this.read=d.readOffset||0,this.growSize=d.growSize||1024;var p=i.isArrayBuffer(s),I=i.isArrayBufferView(s);if(p||I){p?this.data=new DataView(s):this.data=new DataView(s.buffer,s.byteOffset,s.byteLength),this.write="writeOffset"in d?d.writeOffset:this.data.byteLength;return}this.data=new DataView(new ArrayBuffer(0)),this.write=0,s!=null&&this.putBytes(s),"writeOffset"in d&&(this.write=d.writeOffset)}i.DataBuffer=h,i.DataBuffer.prototype.length=function(){return this.write-this.read},i.DataBuffer.prototype.isEmpty=function(){return this.length()<=0},i.DataBuffer.prototype.accommodate=function(s,d){if(this.length()>=s)return this;d=Math.max(d||this.growSize,s);var p=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),I=new Uint8Array(this.length()+d);return I.set(p),this.data=new DataView(I.buffer),this},i.DataBuffer.prototype.putByte=function(s){return this.accommodate(1),this.data.setUint8(this.write++,s),this},i.DataBuffer.prototype.fillWithByte=function(s,d){this.accommodate(d);for(var p=0;p<d;++p)this.data.setUint8(s);return this},i.DataBuffer.prototype.putBytes=function(s,d){if(i.isArrayBufferView(s)){var p=new Uint8Array(s.buffer,s.byteOffset,s.byteLength),I=p.byteLength-p.byteOffset;this.accommodate(I);var R=new Uint8Array(this.data.buffer,this.write);return R.set(p),this.write+=I,this}if(i.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 i.DataBuffer||typeof s=="object"&&typeof s.read=="number"&&typeof s.write=="number"&&i.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 i.ByteStringBuffer&&(s=s.data,d="binary"),d=d||"binary",typeof s=="string"){var c;if(d==="hex")return this.accommodate(Math.ceil(s.length/2)),c=new Uint8Array(this.data.buffer,this.write),this.write+=i.binary.hex.decode(s,c,this.write),this;if(d==="base64")return this.accommodate(Math.ceil(s.length/4)*3),c=new Uint8Array(this.data.buffer,this.write),this.write+=i.binary.base64.decode(s,c,this.write),this;if(d==="utf8"&&(s=i.encodeUtf8(s),d="binary"),d==="binary"||d==="raw")return this.accommodate(s.length),c=new Uint8Array(this.data.buffer,this.write),this.write+=i.binary.raw.decode(c),this;if(d==="utf16")return this.accommodate(s.length*2),c=new Uint16Array(this.data.buffer,this.write),this.write+=i.text.utf16.encode(c),this;throw new Error("Invalid encoding: "+d)}throw Error("Invalid parameter: "+s)},i.DataBuffer.prototype.putBuffer=function(s){return this.putBytes(s),s.clear(),this},i.DataBuffer.prototype.putString=function(s){return this.putBytes(s,"utf16")},i.DataBuffer.prototype.putInt16=function(s){return this.accommodate(2),this.data.setInt16(this.write,s),this.write+=2,this},i.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},i.DataBuffer.prototype.putInt32=function(s){return this.accommodate(4),this.data.setInt32(this.write,s),this.write+=4,this},i.DataBuffer.prototype.putInt16Le=function(s){return this.accommodate(2),this.data.setInt16(this.write,s,!0),this.write+=2,this},i.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},i.DataBuffer.prototype.putInt32Le=function(s){return this.accommodate(4),this.data.setInt32(this.write,s,!0),this.write+=4,this},i.DataBuffer.prototype.putInt=function(s,d){v(d),this.accommodate(d/8);do d-=8,this.data.setInt8(this.write++,s>>d&255);while(d>0);return this},i.DataBuffer.prototype.putSignedInt=function(s,d){return v(d),this.accommodate(d/8),s<0&&(s+=2<<d-1),this.putInt(s,d)},i.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)},i.DataBuffer.prototype.getInt16=function(){var s=this.data.getInt16(this.read);return this.read+=2,s},i.DataBuffer.prototype.getInt24=function(){var s=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,s},i.DataBuffer.prototype.getInt32=function(){var s=this.data.getInt32(this.read);return this.read+=4,s},i.DataBuffer.prototype.getInt16Le=function(){var s=this.data.getInt16(this.read,!0);return this.read+=2,s},i.DataBuffer.prototype.getInt24Le=function(){var s=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,s},i.DataBuffer.prototype.getInt32Le=function(){var s=this.data.getInt32(this.read,!0);return this.read+=4,s},i.DataBuffer.prototype.getInt=function(s){v(s);var d=0;do d=(d<<8)+this.data.getInt8(this.read++),s-=8;while(s>0);return d},i.DataBuffer.prototype.getSignedInt=function(s){var d=this.getInt(s),p=2<<s-2;return d>=p&&(d-=p<<1),d},i.DataBuffer.prototype.getBytes=function(s){var d;return s?(s=Math.min(this.length(),s),d=this.data.slice(this.read,this.read+s),this.read+=s):s===0?d="":(d=this.read===0?this.data:this.data.slice(this.read),this.clear()),d},i.DataBuffer.prototype.bytes=function(s){return typeof s>"u"?this.data.slice(this.read):this.data.slice(this.read,this.read+s)},i.DataBuffer.prototype.at=function(s){return this.data.getUint8(this.read+s)},i.DataBuffer.prototype.setAt=function(s,d){return this.data.setUint8(s,d),this},i.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},i.DataBuffer.prototype.copy=function(){return new i.DataBuffer(this)},i.DataBuffer.prototype.compact=function(){if(this.read>0){var s=new Uint8Array(this.data.buffer,this.read),d=new Uint8Array(s.byteLength);d.set(s),this.data=new DataView(d),this.write-=this.read,this.read=0}return this},i.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},i.DataBuffer.prototype.truncate=function(s){return this.write=Math.max(0,this.length()-s),this.read=Math.min(this.read,this.write),this},i.DataBuffer.prototype.toHex=function(){for(var s="",d=this.read;d<this.data.byteLength;++d){var p=this.data.getUint8(d);p<16&&(s+="0"),s+=p.toString(16)}return s},i.DataBuffer.prototype.toString=function(s){var d=new Uint8Array(this.data,this.read,this.length());if(s=s||"utf8",s==="binary"||s==="raw")return i.binary.raw.encode(d);if(s==="hex")return i.binary.hex.encode(d);if(s==="base64")return i.binary.base64.encode(d);if(s==="utf8")return i.text.utf8.decode(d);if(s==="utf16")return i.text.utf16.decode(d);throw new Error("Invalid encoding: "+s)},i.createBuffer=function(s,d){return d=d||"raw",s!==void 0&&d==="utf8"&&(s=i.encodeUtf8(s)),new i.ByteBuffer(s)},i.fillString=function(s,d){for(var p="";d>0;)d&1&&(p+=s),d>>>=1,d>0&&(s+=s);return p},i.xorBytes=function(s,d,p){for(var I="",R="",c="",n=0,r=0;p>0;--p,++n)R=s.charCodeAt(n)^d.charCodeAt(n),r>=10&&(I+=c,c="",r=0),c+=String.fromCharCode(R),++r;return I+=c,I},i.hexToBytes=function(s){var d="",p=0;for(s.length&!0&&(p=1,d+=String.fromCharCode(parseInt(s[0],16)));p<s.length;p+=2)d+=String.fromCharCode(parseInt(s.substr(p,2),16));return d},i.bytesToHex=function(s){return i.createBuffer(s).toHex()},i.int32ToBytes=function(s){return String.fromCharCode(s>>24&255)+String.fromCharCode(s>>16&255)+String.fromCharCode(s>>8&255)+String.fromCharCode(s&255)};var t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",C=[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],l="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";i.encode64=function(s,d){for(var p="",I="",R,c,n,r=0;r<s.length;)R=s.charCodeAt(r++),c=s.charCodeAt(r++),n=s.charCodeAt(r++),p+=t.charAt(R>>2),p+=t.charAt((R&3)<<4|c>>4),isNaN(c)?p+="==":(p+=t.charAt((c&15)<<2|n>>6),p+=isNaN(n)?"=":t.charAt(n&63)),d&&p.length>d&&(I+=p.substr(0,d)+`\r
`,p=p.substr(d));return I+=p,I},i.decode64=function(s){s=s.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var d="",p,I,R,c,n=0;n<s.length;)p=C[s.charCodeAt(n++)-43],I=C[s.charCodeAt(n++)-43],R=C[s.charCodeAt(n++)-43],c=C[s.charCodeAt(n++)-43],d+=String.fromCharCode(p<<2|I>>4),R!==64&&(d+=String.fromCharCode((I&15)<<4|R>>2),c!==64&&(d+=String.fromCharCode((R&3)<<6|c)));return d},i.encodeUtf8=function(s){return unescape(encodeURIComponent(s))},i.decodeUtf8=function(s){return decodeURIComponent(escape(s))},i.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:e.encode,decode:e.decode}},i.binary.raw.encode=function(s){return String.fromCharCode.apply(null,s)},i.binary.raw.decode=function(s,d,p){var I=d;I||(I=new Uint8Array(s.length)),p=p||0;for(var R=p,c=0;c<s.length;++c)I[R++]=s.charCodeAt(c);return d?R-p:I},i.binary.hex.encode=i.bytesToHex,i.binary.hex.decode=function(s,d,p){var I=d;I||(I=new Uint8Array(Math.ceil(s.length/2))),p=p||0;var R=0,c=p;for(s.length&1&&(R=1,I[c++]=parseInt(s[0],16));R<s.length;R+=2)I[c++]=parseInt(s.substr(R,2),16);return d?c-p:I},i.binary.base64.encode=function(s,d){for(var p="",I="",R,c,n,r=0;r<s.byteLength;)R=s[r++],c=s[r++],n=s[r++],p+=t.charAt(R>>2),p+=t.charAt((R&3)<<4|c>>4),isNaN(c)?p+="==":(p+=t.charAt((c&15)<<2|n>>6),p+=isNaN(n)?"=":t.charAt(n&63)),d&&p.length>d&&(I+=p.substr(0,d)+`\r
`,p=p.substr(d));return I+=p,I},i.binary.base64.decode=function(s,d,p){var I=d;I||(I=new Uint8Array(Math.ceil(s.length/4)*3)),s=s.replace(/[^A-Za-z0-9\+\/\=]/g,""),p=p||0;for(var R,c,n,r,B=0,D=p;B<s.length;)R=C[s.charCodeAt(B++)-43],c=C[s.charCodeAt(B++)-43],n=C[s.charCodeAt(B++)-43],r=C[s.charCodeAt(B++)-43],I[D++]=R<<2|c>>4,n!==64&&(I[D++]=(c&15)<<4|n>>2,r!==64&&(I[D++]=(n&3)<<6|r));return d?D-p:I.subarray(0,D)},i.binary.base58.encode=function(s,d){return i.binary.baseN.encode(s,l,d)},i.binary.base58.decode=function(s,d){return i.binary.baseN.decode(s,l,d)},i.text={utf8:{},utf16:{}},i.text.utf8.encode=function(s,d,p){s=i.encodeUtf8(s);var I=d;I||(I=new Uint8Array(s.length)),p=p||0;for(var R=p,c=0;c<s.length;++c)I[R++]=s.charCodeAt(c);return d?R-p:I},i.text.utf8.decode=function(s){return i.decodeUtf8(String.fromCharCode.apply(null,s))},i.text.utf16.encode=function(s,d,p){var I=d;I||(I=new Uint8Array(s.length*2));var R=new Uint16Array(I.buffer);p=p||0;for(var c=p,n=p,r=0;r<s.length;++r)R[n++]=s.charCodeAt(r),c+=2;return d?c-p:I},i.text.utf16.decode=function(s){return String.fromCharCode.apply(null,new Uint16Array(s.buffer))},i.deflate=function(s,d,p){if(d=i.decode64(s.deflate(i.encode64(d)).rval),p){var I=2,R=d.charCodeAt(1);R&32&&(I=6),d=d.substring(I,d.length-4)}return d},i.inflate=function(s,d,p){var I=s.inflate(i.encode64(d)).rval;return I===null?null:i.decode64(I)};var x=function(s,d,p){if(!s)throw new Error("WebStorage not available.");var I;if(p===null?I=s.removeItem(d):(p=i.encode64(JSON.stringify(p)),I=s.setItem(d,p)),typeof I<"u"&&I.rval!==!0){var R=new Error(I.error.message);throw R.id=I.error.id,R.name=I.error.name,R}},k=function(s,d){if(!s)throw new Error("WebStorage not available.");var p=s.getItem(d);if(s.init)if(p.rval===null){if(p.error){var I=new Error(p.error.message);throw I.id=p.error.id,I.name=p.error.name,I}p=null}else p=p.rval;return p!==null&&(p=JSON.parse(i.decode64(p))),p},E=function(s,d,p,I){var R=k(s,d);R===null&&(R={}),R[p]=I,x(s,d,R)},u=function(s,d,p){var I=k(s,d);return I!==null&&(I=p in I?I[p]:null),I},y=function(s,d,p){var I=k(s,d);if(I!==null&&p in I){delete I[p];var R=!0;for(var c in I){R=!1;break}R&&(I=null),x(s,d,I)}},m=function(s,d){x(s,d,null)},g=function(s,d,p){var I=null;typeof p>"u"&&(p=["web","flash"]);var R,c=!1,n=null;for(var r in p){R=p[r];try{if(R==="flash"||R==="both"){if(d[0]===null)throw new Error("Flash local storage not available.");I=s.apply(this,d),c=R==="flash"}(R==="web"||R==="both")&&(d[0]=localStorage,I=s.apply(this,d),c=!0)}catch(B){n=B}if(c)break}if(!c)throw n;return I};return i.setItem=function(s,d,p,I,R){g(E,arguments,R)},i.getItem=function(s,d,p,I){return g(u,arguments,I)},i.removeItem=function(s,d,p,I){g(y,arguments,I)},i.clearItems=function(s,d,p){g(m,arguments,p)},i.isEmpty=function(s){for(var d in s)if(s.hasOwnProperty(d))return!1;return!0},i.format=function(s){for(var d=/%./g,p,I,R=0,c=[],n=0;p=d.exec(s);){I=s.substring(n,d.lastIndex-2),I.length>0&&c.push(I),n=d.lastIndex;var r=p[0][1];switch(r){case"s":case"o":R<arguments.length?c.push(arguments[R+++1]):c.push("<?>");break;case"%":c.push("%");break;default:c.push("<%"+r+"?>")}}return c.push(s.substring(n)),c.join("")},i.formatNumber=function(s,d,p,I){var R=s,c=isNaN(d=Math.abs(d))?2:d,n=p===void 0?",":p,r=I===void 0?".":I,B=R<0?"-":"",D=parseInt(R=Math.abs(+R||0).toFixed(c),10)+"",V=D.length>3?D.length%3:0;return B+(V?D.substr(0,V)+r:"")+D.substr(V).replace(/(\d{3})(?=\d)/g,"$1"+r)+(c?n+Math.abs(R-D).toFixed(c).slice(2):"")},i.formatSize=function(s){return s>=1073741824?s=i.formatNumber(s/1073741824,2,".","")+" GiB":s>=1048576?s=i.formatNumber(s/1048576,2,".","")+" MiB":s>=1024?s=i.formatNumber(s/1024,0)+" KiB":s=i.formatNumber(s,0)+" bytes",s},i.bytesFromIP=function(s){return s.indexOf(".")!==-1?i.bytesFromIPv4(s):s.indexOf(":")!==-1?i.bytesFromIPv6(s):null},i.bytesFromIPv4=function(s){if(s=s.split("."),s.length!==4)return null;for(var d=i.createBuffer(),p=0;p<s.length;++p){var I=parseInt(s[p],10);if(isNaN(I))return null;d.putByte(I)}return d.getBytes()},i.bytesFromIPv6=function(s){var d=0;s=s.split(":").filter(function(n){return n.length===0&&++d,!0});for(var p=(8-s.length+d)*2,I=i.createBuffer(),R=0;R<8;++R){if(!s[R]||s[R].length===0){I.fillWithByte(0,p),p=0;continue}var c=i.hexToBytes(s[R]);c.length<2&&I.putByte(0),I.putBytes(c)}return I.getBytes()},i.bytesToIP=function(s){return s.length===4?i.bytesToIPv4(s):s.length===16?i.bytesToIPv6(s):null},i.bytesToIPv4=function(s){if(s.length!==4)return null;for(var d=[],p=0;p<s.length;++p)d.push(s.charCodeAt(p));return d.join(".")},i.bytesToIPv6=function(s){if(s.length!==16)return null;for(var d=[],p=[],I=0,R=0;R<s.length;R+=2){for(var c=i.bytesToHex(s[R]+s[R+1]);c[0]==="0"&&c!=="0";)c=c.substr(1);if(c==="0"){var n=p[p.length-1],r=d.length;!n||r!==n.end+1?p.push({start:r,end:r}):(n.end=r,n.end-n.start>p[I].end-p[I].start&&(I=p.length-1))}d.push(c)}if(p.length>0){var B=p[I];B.end-B.start>0&&(d.splice(B.start,B.end-B.start+1,""),B.start===0&&d.unshift(""),B.end===7&&d.push(""))}return d.join(":")},i.estimateCores=function(s,d){if(typeof s=="function"&&(d=s,s={}),s=s||{},"cores"in i&&!s.update)return d(null,i.cores);if(typeof navigator<"u"&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return i.cores=navigator.hardwareConcurrency,d(null,i.cores);if(typeof Worker>"u")return i.cores=1,d(null,i.cores);if(typeof Blob>"u")return i.cores=2,d(null,i.cores);var p=URL.createObjectURL(new Blob(["(",(function(){self.addEventListener("message",function(n){var r=Date.now(),B=r+4;self.postMessage({st:r,et:B})})}).toString(),")()"],{type:"application/javascript"}));I([],5,16);function I(n,r,B){if(r===0){var D=Math.floor(n.reduce(function(V,L){return V+L},0)/n.length);return i.cores=Math.max(1,D),URL.revokeObjectURL(p),d(null,i.cores)}R(B,function(V,L){n.push(c(B,L)),I(n,r-1,B)})}function R(n,r){for(var B=[],D=[],V=0;V<n;++V){var L=new Worker(p);L.addEventListener("message",function(O){if(D.push(O.data),D.length===n){for(var q=0;q<n;++q)B[q].terminate();r(null,D)}}),B.push(L)}for(var V=0;V<n;++V)B[V].postMessage(V)}function c(n,r){for(var B=[],D=0;D<n;++D)for(var V=r[D],L=B[D]=[],O=0;O<n;++O)if(D!==O){var q=r[O];(V.st>q.st&&V.st<q.et||q.st>V.st&&q.st<V.et)&&L.push(O)}return B.reduce(function(M,H){return Math.max(M,H.length)},0)}},bt.exports}var Nt,xr;function Rt(){if(xr)return Nt;xr=1;var a=ue();de(),Nt=a.cipher=a.cipher||{},a.cipher.algorithms=a.cipher.algorithms||{},a.cipher.createCipher=function(i,v){var _=i;if(typeof _=="string"&&(_=a.cipher.getAlgorithm(_),_&&(_=_())),!_)throw new Error("Unsupported algorithm: "+i);return new a.cipher.BlockCipher({algorithm:_,key:v,decrypt:!1})},a.cipher.createDecipher=function(i,v){var _=i;if(typeof _=="string"&&(_=a.cipher.getAlgorithm(_),_&&(_=_())),!_)throw new Error("Unsupported algorithm: "+i);return new a.cipher.BlockCipher({algorithm:_,key:v,decrypt:!0})},a.cipher.registerAlgorithm=function(i,v){i=i.toUpperCase(),a.cipher.algorithms[i]=v},a.cipher.getAlgorithm=function(i){return i=i.toUpperCase(),i in a.cipher.algorithms?a.cipher.algorithms[i]:null};var e=a.cipher.BlockCipher=function(i){this.algorithm=i.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=i.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=i.decrypt,this.algorithm.initialize(i)};return e.prototype.start=function(i){i=i||{};var v={};for(var _ in i)v[_]=i[_];v.decrypt=this._decrypt,this._finish=!1,this._input=a.util.createBuffer(),this.output=i.output||a.util.createBuffer(),this.mode.start(v)},e.prototype.update=function(i){for(i&&this._input.putBuffer(i);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},e.prototype.finish=function(i){i&&(this.mode.name==="ECB"||this.mode.name==="CBC")&&(this.mode.pad=function(_){return i(this.blockSize,_,!1)},this.mode.unpad=function(_){return i(this.blockSize,_,!0)});var v={};return v.decrypt=this._decrypt,v.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,v)||(this._finish=!0,this.update(),this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,v))||this.mode.afterFinish&&!this.mode.afterFinish(this.output,v))},Nt}var wt={exports:{}},Sr;function Tr(){if(Sr)return wt.exports;Sr=1;var a=ue();de(),a.cipher=a.cipher||{};var e=wt.exports=a.cipher.modes=a.cipher.modes||{};e.ecb=function(S){S=S||{},this.name="ECB",this.cipher=S.cipher,this.blockSize=S.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},e.ecb.prototype.start=function(S){},e.ecb.prototype.encrypt=function(S,h,t){if(S.length()<this.blockSize&&!(t&&S.length()>0))return!0;for(var C=0;C<this._ints;++C)this._inBlock[C]=S.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var C=0;C<this._ints;++C)h.putInt32(this._outBlock[C])},e.ecb.prototype.decrypt=function(S,h,t){if(S.length()<this.blockSize&&!(t&&S.length()>0))return!0;for(var C=0;C<this._ints;++C)this._inBlock[C]=S.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var C=0;C<this._ints;++C)h.putInt32(this._outBlock[C])},e.ecb.prototype.pad=function(S,h){var t=S.length()===this.blockSize?this.blockSize:this.blockSize-S.length();return S.fillWithByte(t,t),!0},e.ecb.prototype.unpad=function(S,h){if(h.overflow>0)return!1;var t=S.length(),C=S.at(t-1);return C>this.blockSize<<2?!1:(S.truncate(C),!0)},e.cbc=function(S){S=S||{},this.name="CBC",this.cipher=S.cipher,this.blockSize=S.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},e.cbc.prototype.start=function(S){if(S.iv===null){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else if("iv"in S)this._iv=i(S.iv,this.blockSize),this._prev=this._iv.slice(0);else throw new Error("Invalid IV parameter.")},e.cbc.prototype.encrypt=function(S,h,t){if(S.length()<this.blockSize&&!(t&&S.length()>0))return!0;for(var C=0;C<this._ints;++C)this._inBlock[C]=this._prev[C]^S.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(var C=0;C<this._ints;++C)h.putInt32(this._outBlock[C]);this._prev=this._outBlock},e.cbc.prototype.decrypt=function(S,h,t){if(S.length()<this.blockSize&&!(t&&S.length()>0))return!0;for(var C=0;C<this._ints;++C)this._inBlock[C]=S.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(var C=0;C<this._ints;++C)h.putInt32(this._prev[C]^this._outBlock[C]);this._prev=this._inBlock.slice(0)},e.cbc.prototype.pad=function(S,h){var t=S.length()===this.blockSize?this.blockSize:this.blockSize-S.length();return S.fillWithByte(t,t),!0},e.cbc.prototype.unpad=function(S,h){if(h.overflow>0)return!1;var t=S.length(),C=S.at(t-1);return C>this.blockSize<<2?!1:(S.truncate(C),!0)},e.cfb=function(S){S=S||{},this.name="CFB",this.cipher=S.cipher,this.blockSize=S.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=a.util.createBuffer(),this._partialBytes=0},e.cfb.prototype.start=function(S){if(!("iv"in S))throw new Error("Invalid IV parameter.");this._iv=i(S.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},e.cfb.prototype.encrypt=function(S,h,t){var C=S.length();if(C===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&C>=this.blockSize){for(var l=0;l<this._ints;++l)this._inBlock[l]=S.getInt32()^this._outBlock[l],h.putInt32(this._inBlock[l]);return}var x=(this.blockSize-C)%this.blockSize;x>0&&(x=this.blockSize-x),this._partialOutput.clear();for(var l=0;l<this._ints;++l)this._partialBlock[l]=S.getInt32()^this._outBlock[l],this._partialOutput.putInt32(this._partialBlock[l]);if(x>0)S.read-=this.blockSize;else for(var l=0;l<this._ints;++l)this._inBlock[l]=this._partialBlock[l];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),x>0&&!t)return h.putBytes(this._partialOutput.getBytes(x-this._partialBytes)),this._partialBytes=x,!0;h.putBytes(this._partialOutput.getBytes(C-this._partialBytes)),this._partialBytes=0},e.cfb.prototype.decrypt=function(S,h,t){var C=S.length();if(C===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&C>=this.blockSize){for(var l=0;l<this._ints;++l)this._inBlock[l]=S.getInt32(),h.putInt32(this._inBlock[l]^this._outBlock[l]);return}var x=(this.blockSize-C)%this.blockSize;x>0&&(x=this.blockSize-x),this._partialOutput.clear();for(var l=0;l<this._ints;++l)this._partialBlock[l]=S.getInt32(),this._partialOutput.putInt32(this._partialBlock[l]^this._outBlock[l]);if(x>0)S.read-=this.blockSize;else for(var l=0;l<this._ints;++l)this._inBlock[l]=this._partialBlock[l];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),x>0&&!t)return h.putBytes(this._partialOutput.getBytes(x-this._partialBytes)),this._partialBytes=x,!0;h.putBytes(this._partialOutput.getBytes(C-this._partialBytes)),this._partialBytes=0},e.ofb=function(S){S=S||{},this.name="OFB",this.cipher=S.cipher,this.blockSize=S.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=a.util.createBuffer(),this._partialBytes=0},e.ofb.prototype.start=function(S){if(!("iv"in S))throw new Error("Invalid IV parameter.");this._iv=i(S.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},e.ofb.prototype.encrypt=function(S,h,t){var C=S.length();if(S.length()===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&C>=this.blockSize){for(var l=0;l<this._ints;++l)h.putInt32(S.getInt32()^this._outBlock[l]),this._inBlock[l]=this._outBlock[l];return}var x=(this.blockSize-C)%this.blockSize;x>0&&(x=this.blockSize-x),this._partialOutput.clear();for(var l=0;l<this._ints;++l)this._partialOutput.putInt32(S.getInt32()^this._outBlock[l]);if(x>0)S.read-=this.blockSize;else for(var l=0;l<this._ints;++l)this._inBlock[l]=this._outBlock[l];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),x>0&&!t)return h.putBytes(this._partialOutput.getBytes(x-this._partialBytes)),this._partialBytes=x,!0;h.putBytes(this._partialOutput.getBytes(C-this._partialBytes)),this._partialBytes=0},e.ofb.prototype.decrypt=e.ofb.prototype.encrypt,e.ctr=function(S){S=S||{},this.name="CTR",this.cipher=S.cipher,this.blockSize=S.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=a.util.createBuffer(),this._partialBytes=0},e.ctr.prototype.start=function(S){if(!("iv"in S))throw new Error("Invalid IV parameter.");this._iv=i(S.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},e.ctr.prototype.encrypt=function(S,h,t){var C=S.length();if(C===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&C>=this.blockSize)for(var l=0;l<this._ints;++l)h.putInt32(S.getInt32()^this._outBlock[l]);else{var x=(this.blockSize-C)%this.blockSize;x>0&&(x=this.blockSize-x),this._partialOutput.clear();for(var l=0;l<this._ints;++l)this._partialOutput.putInt32(S.getInt32()^this._outBlock[l]);if(x>0&&(S.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),x>0&&!t)return h.putBytes(this._partialOutput.getBytes(x-this._partialBytes)),this._partialBytes=x,!0;h.putBytes(this._partialOutput.getBytes(C-this._partialBytes)),this._partialBytes=0}v(this._inBlock)},e.ctr.prototype.decrypt=e.ctr.prototype.encrypt,e.gcm=function(S){S=S||{},this.name="GCM",this.cipher=S.cipher,this.blockSize=S.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=a.util.createBuffer(),this._partialBytes=0,this._R=3774873600},e.gcm.prototype.start=function(S){if(!("iv"in S))throw new Error("Invalid IV parameter.");var h=a.util.createBuffer(S.iv);this._cipherLength=0;var t;if("additionalData"in S?t=a.util.createBuffer(S.additionalData):t=a.util.createBuffer(),"tagLength"in S?this._tagLength=S.tagLength:this._tagLength=128,this._tag=null,S.decrypt&&(this._tag=a.util.createBuffer(S.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 C=h.length();if(C===12)this._j0=[h.getInt32(),h.getInt32(),h.getInt32(),1];else{for(this._j0=[0,0,0,0];h.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[h.getInt32(),h.getInt32(),h.getInt32(),h.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(_(C*8)))}this._inBlock=this._j0.slice(0),v(this._inBlock),this._partialBytes=0,t=a.util.createBuffer(t),this._aDataLength=_(t.length()*8);var l=t.length()%this.blockSize;for(l&&t.fillWithByte(0,this.blockSize-l),this._s=[0,0,0,0];t.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[t.getInt32(),t.getInt32(),t.getInt32(),t.getInt32()])},e.gcm.prototype.encrypt=function(S,h,t){var C=S.length();if(C===0)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),this._partialBytes===0&&C>=this.blockSize){for(var l=0;l<this._ints;++l)h.putInt32(this._outBlock[l]^=S.getInt32());this._cipherLength+=this.blockSize}else{var x=(this.blockSize-C)%this.blockSize;x>0&&(x=this.blockSize-x),this._partialOutput.clear();for(var l=0;l<this._ints;++l)this._partialOutput.putInt32(S.getInt32()^this._outBlock[l]);if(x<=0||t){if(t){var k=C%this.blockSize;this._cipherLength+=k,this._partialOutput.truncate(this.blockSize-k)}else this._cipherLength+=this.blockSize;for(var l=0;l<this._ints;++l)this._outBlock[l]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),x>0&&!t)return S.read-=this.blockSize,h.putBytes(this._partialOutput.getBytes(x-this._partialBytes)),this._partialBytes=x,!0;h.putBytes(this._partialOutput.getBytes(C-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),v(this._inBlock)},e.gcm.prototype.decrypt=function(S,h,t){var C=S.length();if(C<this.blockSize&&!(t&&C>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),v(this._inBlock),this._hashBlock[0]=S.getInt32(),this._hashBlock[1]=S.getInt32(),this._hashBlock[2]=S.getInt32(),this._hashBlock[3]=S.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var l=0;l<this._ints;++l)h.putInt32(this._outBlock[l]^this._hashBlock[l]);C<this.blockSize?this._cipherLength+=C%this.blockSize:this._cipherLength+=this.blockSize},e.gcm.prototype.afterFinish=function(S,h){var t=!0;h.decrypt&&h.overflow&&S.truncate(this.blockSize-h.overflow),this.tag=a.util.createBuffer();var C=this._aDataLength.concat(_(this._cipherLength*8));this._s=this.ghash(this._hashSubkey,this._s,C);var l=[];this.cipher.encrypt(this._j0,l);for(var x=0;x<this._ints;++x)this.tag.putInt32(this._s[x]^l[x]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),h.decrypt&&this.tag.bytes()!==this._tag&&(t=!1),t},e.gcm.prototype.multiply=function(S,h){for(var t=[0,0,0,0],C=h.slice(0),l=0;l<128;++l){var x=S[l/32|0]&1<<31-l%32;x&&(t[0]^=C[0],t[1]^=C[1],t[2]^=C[2],t[3]^=C[3]),this.pow(C,C)}return t},e.gcm.prototype.pow=function(S,h){for(var t=S[3]&1,C=3;C>0;--C)h[C]=S[C]>>>1|(S[C-1]&1)<<31;h[0]=S[0]>>>1,t&&(h[0]^=this._R)},e.gcm.prototype.tableMultiply=function(S){for(var h=[0,0,0,0],t=0;t<32;++t){var C=t/8|0,l=S[C]>>>(7-t%8)*4&15,x=this._m[t][l];h[0]^=x[0],h[1]^=x[1],h[2]^=x[2],h[3]^=x[3]}return h},e.gcm.prototype.ghash=function(S,h,t){return h[0]^=t[0],h[1]^=t[1],h[2]^=t[2],h[3]^=t[3],this.tableMultiply(h)},e.gcm.prototype.generateHashTable=function(S,h){for(var t=8/h,C=4*t,l=16*t,x=new Array(l),k=0;k<l;++k){var E=[0,0,0,0],u=k/C|0,y=(C-1-k%C)*h;E[u]=1<<h-1<<y,x[k]=this.generateSubHashTable(this.multiply(E,S),h)}return x},e.gcm.prototype.generateSubHashTable=function(S,h){var t=1<<h,C=t>>>1,l=new Array(t);l[C]=S.slice(0);for(var x=C>>>1;x>0;)this.pow(l[2*x],l[x]=[]),x>>=1;for(x=2;x<C;){for(var k=1;k<x;++k){var E=l[x],u=l[k];l[x+k]=[E[0]^u[0],E[1]^u[1],E[2]^u[2],E[3]^u[3]]}x*=2}for(l[0]=[0,0,0,0],x=C+1;x<t;++x){var y=l[x^C];l[x]=[S[0]^y[0],S[1]^y[1],S[2]^y[2],S[3]^y[3]]}return l};function i(S,h){if(typeof S=="string"&&(S=a.util.createBuffer(S)),a.util.isArray(S)&&S.length>4){var t=S;S=a.util.createBuffer();for(var C=0;C<t.length;++C)S.putByte(t[C])}if(S.length()<h)throw new Error("Invalid IV length; got "+S.length()+" bytes and expected "+h+" bytes.");if(!a.util.isArray(S)){for(var l=[],x=h/4,C=0;C<x;++C)l.push(S.getInt32());S=l}return S}function v(S){S[S.length-1]=S[S.length-1]+1&4294967295}function _(S){return[S/4294967296|0,S&4294967295]}return wt.exports}var Lt,Ir;function ot(){if(Ir)return Lt;Ir=1;var a=ue();Rt(),Tr(),de(),Lt=a.aes=a.aes||{},a.aes.startEncrypting=function(u,y,m,g){var s=E({key:u,output:m,decrypt:!1,mode:g});return s.start(y),s},a.aes.createEncryptionCipher=function(u,y){return E({key:u,output:null,decrypt:!1,mode:y})},a.aes.startDecrypting=function(u,y,m,g){var s=E({key:u,output:m,decrypt:!0,mode:g});return s.start(y),s},a.aes.createDecryptionCipher=function(u,y){return E({key:u,output:null,decrypt:!0,mode:y})},a.aes.Algorithm=function(u,y){i||l();var m=this;m.name=u,m.mode=new y({blockSize:16,cipher:{encrypt:function(g,s){return k(m._w,g,s,!1)},decrypt:function(g,s){return k(m._w,g,s,!0)}}}),m._init=!1},a.aes.Algorithm.prototype.initialize=function(u){if(!this._init){var y=u.key,m;if(typeof y=="string"&&(y.length===16||y.length===24||y.length===32))y=a.util.createBuffer(y);else if(a.util.isArray(y)&&(y.length===16||y.length===24||y.length===32)){m=y,y=a.util.createBuffer();for(var g=0;g<m.length;++g)y.putByte(m[g])}if(!a.util.isArray(y)){m=y,y=[];var s=m.length();if(s===16||s===24||s===32){s=s>>>2;for(var g=0;g<s;++g)y.push(m.getInt32())}}if(!a.util.isArray(y)||!(y.length===4||y.length===6||y.length===8))throw new Error("Invalid key parameter.");var d=this.mode.name,p=["CFB","OFB","CTR","GCM"].indexOf(d)!==-1;this._w=x(y,u.decrypt&&!p),this._init=!0}},a.aes._expandKey=function(u,y){return i||l(),x(u,y)},a.aes._updateBlock=k,e("AES-ECB",a.cipher.modes.ecb),e("AES-CBC",a.cipher.modes.cbc),e("AES-CFB",a.cipher.modes.cfb),e("AES-OFB",a.cipher.modes.ofb),e("AES-CTR",a.cipher.modes.ctr),e("AES-GCM",a.cipher.modes.gcm);function e(u,y){var m=function(){return new a.aes.Algorithm(u,y)};a.cipher.registerAlgorithm(u,m)}var i=!1,v=4,_,S,h,t,C;function l(){i=!0,h=[0,1,2,4,8,16,32,64,128,27,54];for(var u=new Array(256),y=0;y<128;++y)u[y]=y<<1,u[y+128]=y+128<<1^283;_=new Array(256),S=new Array(256),t=new Array(4),C=new Array(4);for(var y=0;y<4;++y)t[y]=new Array(256),C[y]=new Array(256);for(var m=0,g=0,s,d,p,I,R,c,n,y=0;y<256;++y){I=g^g<<1^g<<2^g<<3^g<<4,I=I>>8^I&255^99,_[m]=I,S[I]=m,R=u[I],s=u[m],d=u[s],p=u[d],c=R<<24^I<<16^I<<8^(I^R),n=(s^d^p)<<24^(m^p)<<16^(m^d^p)<<8^(m^s^p);for(var r=0;r<4;++r)t[r][m]=c,C[r][I]=n,c=c<<24|c>>>8,n=n<<24|n>>>8;m===0?m=g=1:(m=s^u[u[u[s^p]]],g^=u[u[g]])}}function x(u,y){for(var m=u.slice(0),g,s=1,d=m.length,p=d+6+1,I=v*p,R=d;R<I;++R)g=m[R-1],R%d===0?(g=_[g>>>16&255]<<24^_[g>>>8&255]<<16^_[g&255]<<8^_[g>>>24]^h[s]<<24,s++):d>6&&R%d===4&&(g=_[g>>>24]<<24^_[g>>>16&255]<<16^_[g>>>8&255]<<8^_[g&255]),m[R]=m[R-d]^g;if(y){var c,n=C[0],r=C[1],B=C[2],D=C[3],V=m.slice(0);I=m.length;for(var R=0,L=I-v;R<I;R+=v,L-=v)if(R===0||R===I-v)V[R]=m[L],V[R+1]=m[L+3],V[R+2]=m[L+2],V[R+3]=m[L+1];else for(var O=0;O<v;++O)c=m[L+O],V[R+(3&-O)]=n[_[c>>>24]]^r[_[c>>>16&255]]^B[_[c>>>8&255]]^D[_[c&255]];m=V}return m}function k(u,y,m,g){var s=u.length/4-1,d,p,I,R,c;g?(d=C[0],p=C[1],I=C[2],R=C[3],c=S):(d=t[0],p=t[1],I=t[2],R=t[3],c=_);var n,r,B,D,V,L,O;n=y[0]^u[0],r=y[g?3:1]^u[1],B=y[2]^u[2],D=y[g?1:3]^u[3];for(var q=3,M=1;M<s;++M)V=d[n>>>24]^p[r>>>16&255]^I[B>>>8&255]^R[D&255]^u[++q],L=d[r>>>24]^p[B>>>16&255]^I[D>>>8&255]^R[n&255]^u[++q],O=d[B>>>24]^p[D>>>16&255]^I[n>>>8&255]^R[r&255]^u[++q],D=d[D>>>24]^p[n>>>16&255]^I[r>>>8&255]^R[B&255]^u[++q],n=V,r=L,B=O;m[0]=c[n>>>24]<<24^c[r>>>16&255]<<16^c[B>>>8&255]<<8^c[D&255]^u[++q],m[g?3:1]=c[r>>>24]<<24^c[B>>>16&255]<<16^c[D>>>8&255]<<8^c[n&255]^u[++q],m[2]=c[B>>>24]<<24^c[D>>>16&255]<<16^c[n>>>8&255]<<8^c[r&255]^u[++q],m[g?1:3]=c[D>>>24]<<24^c[n>>>16&255]<<16^c[r>>>8&255]<<8^c[B&255]^u[++q]}function E(u){u=u||{};var y=(u.mode||"CBC").toUpperCase(),m="AES-"+y,g;u.decrypt?g=a.cipher.createDecipher(m,u.key):g=a.cipher.createCipher(m,u.key);var s=g.start;return g.start=function(d,p){var I=null;p instanceof a.util.ByteBuffer&&(I=p,p={}),p=p||{},p.output=I,p.iv=d,s.call(g,p)},g}return Lt}var Dt={exports:{}},kt={exports:{}},Ut={exports:{}},Ar;function ut(){if(Ar)return Ut.exports;Ar=1;var a=ue();a.pki=a.pki||{};var e=Ut.exports=a.pki.oids=a.oids=a.oids||{};function i(_,S){e[_]=S,e[S]=_}function v(_,S){e[_]=S}return i("1.2.840.113549.1.1.1","rsaEncryption"),i("1.2.840.113549.1.1.4","md5WithRSAEncryption"),i("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),i("1.2.840.113549.1.1.7","RSAES-OAEP"),i("1.2.840.113549.1.1.8","mgf1"),i("1.2.840.113549.1.1.9","pSpecified"),i("1.2.840.113549.1.1.10","RSASSA-PSS"),i("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),i("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),i("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),i("1.3.101.112","EdDSA25519"),i("1.2.840.10040.4.3","dsa-with-sha1"),i("1.3.14.3.2.7","desCBC"),i("1.3.14.3.2.26","sha1"),i("1.3.14.3.2.29","sha1WithRSASignature"),i("2.16.840.1.101.3.4.2.1","sha256"),i("2.16.840.1.101.3.4.2.2","sha384"),i("2.16.840.1.101.3.4.2.3","sha512"),i("2.16.840.1.101.3.4.2.4","sha224"),i("2.16.840.1.101.3.4.2.5","sha512-224"),i("2.16.840.1.101.3.4.2.6","sha512-256"),i("1.2.840.113549.2.2","md2"),i("1.2.840.113549.2.5","md5"),i("1.2.840.113549.1.7.1","data"),i("1.2.840.113549.1.7.2","signedData"),i("1.2.840.113549.1.7.3","envelopedData"),i("1.2.840.113549.1.7.4","signedAndEnvelopedData"),i("1.2.840.113549.1.7.5","digestedData"),i("1.2.840.113549.1.7.6","encryptedData"),i("1.2.840.113549.1.9.1","emailAddress"),i("1.2.840.113549.1.9.2","unstructuredName"),i("1.2.840.113549.1.9.3","contentType"),i("1.2.840.113549.1.9.4","messageDigest"),i("1.2.840.113549.1.9.5","signingTime"),i("1.2.840.113549.1.9.6","counterSignature"),i("1.2.840.113549.1.9.7","challengePassword"),i("1.2.840.113549.1.9.8","unstructuredAddress"),i("1.2.840.113549.1.9.14","extensionRequest"),i("1.2.840.113549.1.9.20","friendlyName"),i("1.2.840.113549.1.9.21","localKeyId"),i("1.2.840.113549.1.9.22.1","x509Certificate"),i("1.2.840.113549.1.12.10.1.1","keyBag"),i("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),i("1.2.840.113549.1.12.10.1.3","certBag"),i("1.2.840.113549.1.12.10.1.4","crlBag"),i("1.2.840.113549.1.12.10.1.5","secretBag"),i("1.2.840.113549.1.12.10.1.6","safeContentsBag"),i("1.2.840.113549.1.5.13","pkcs5PBES2"),i("1.2.840.113549.1.5.12","pkcs5PBKDF2"),i("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),i("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),i("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),i("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),i("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),i("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),i("1.2.840.113549.2.7","hmacWithSHA1"),i("1.2.840.113549.2.8","hmacWithSHA224"),i("1.2.840.113549.2.9","hmacWithSHA256"),i("1.2.840.113549.2.10","hmacWithSHA384"),i("1.2.840.113549.2.11","hmacWithSHA512"),i("1.2.840.113549.3.7","des-EDE3-CBC"),i("2.16.840.1.101.3.4.1.2","aes128-CBC"),i("2.16.840.1.101.3.4.1.22","aes192-CBC"),i("2.16.840.1.101.3.4.1.42","aes256-CBC"),i("2.5.4.3","commonName"),i("2.5.4.4","surname"),i("2.5.4.5","serialNumber"),i("2.5.4.6","countryName"),i("2.5.4.7","localityName"),i("2.5.4.8","stateOrProvinceName"),i("2.5.4.9","streetAddress"),i("2.5.4.10","organizationName"),i("2.5.4.11","organizationalUnitName"),i("2.5.4.12","title"),i("2.5.4.13","description"),i("2.5.4.15","businessCategory"),i("2.5.4.17","postalCode"),i("2.5.4.42","givenName"),i("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),i("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),i("2.16.840.1.113730.1.1","nsCertType"),i("2.16.840.1.113730.1.13","nsComment"),v("2.5.29.1","authorityKeyIdentifier"),v("2.5.29.2","keyAttributes"),v("2.5.29.3","certificatePolicies"),v("2.5.29.4","keyUsageRestriction"),v("2.5.29.5","policyMapping"),v("2.5.29.6","subtreesConstraint"),v("2.5.29.7","subjectAltName"),v("2.5.29.8","issuerAltName"),v("2.5.29.9","subjectDirectoryAttributes"),v("2.5.29.10","basicConstraints"),v("2.5.29.11","nameConstraints"),v("2.5.29.12","policyConstraints"),v("2.5.29.13","basicConstraints"),i("2.5.29.14","subjectKeyIdentifier"),i("2.5.29.15","keyUsage"),v("2.5.29.16","privateKeyUsagePeriod"),i("2.5.29.17","subjectAltName"),i("2.5.29.18","issuerAltName"),i("2.5.29.19","basicConstraints"),v("2.5.29.20","cRLNumber"),v("2.5.29.21","cRLReason"),v("2.5.29.22","expirationDate"),v("2.5.29.23","instructionCode"),v("2.5.29.24","invalidityDate"),v("2.5.29.25","cRLDistributionPoints"),v("2.5.29.26","issuingDistributionPoint"),v("2.5.29.27","deltaCRLIndicator"),v("2.5.29.28","issuingDistributionPoint"),v("2.5.29.29","certificateIssuer"),v("2.5.29.30","nameConstraints"),i("2.5.29.31","cRLDistributionPoints"),i("2.5.29.32","certificatePolicies"),v("2.5.29.33","policyMappings"),v("2.5.29.34","policyConstraints"),i("2.5.29.35","authorityKeyIdentifier"),v("2.5.29.36","policyConstraints"),i("2.5.29.37","extKeyUsage"),v("2.5.29.46","freshestCRL"),v("2.5.29.54","inhibitAnyPolicy"),i("1.3.6.1.4.1.11129.2.4.2","timestampList"),i("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),i("1.3.6.1.5.5.7.3.1","serverAuth"),i("1.3.6.1.5.5.7.3.2","clientAuth"),i("1.3.6.1.5.5.7.3.3","codeSigning"),i("1.3.6.1.5.5.7.3.4","emailProtection"),i("1.3.6.1.5.5.7.3.8","timeStamping"),Ut.exports}var Br;function et(){if(Br)return kt.exports;Br=1;var a=ue();de(),ut();var e=kt.exports=a.asn1=a.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(h,t,C,l,x){if(a.util.isArray(l)){for(var k=[],E=0;E<l.length;++E)l[E]!==void 0&&k.push(l[E]);l=k}var u={tagClass:h,type:t,constructed:C,composed:C||a.util.isArray(l),value:l};return x&&"bitStringContents"in x&&(u.bitStringContents=x.bitStringContents,u.original=e.copy(u)),u},e.copy=function(h,t){var C;if(a.util.isArray(h)){C=[];for(var l=0;l<h.length;++l)C.push(e.copy(h[l],t));return C}return typeof h=="string"?h:(C={tagClass:h.tagClass,type:h.type,constructed:h.constructed,composed:h.composed,value:e.copy(h.value,t)},t&&!t.excludeBitStringContents&&(C.bitStringContents=h.bitStringContents),C)},e.equals=function(h,t,C){if(a.util.isArray(h)){if(!a.util.isArray(t)||h.length!==t.length)return!1;for(var l=0;l<h.length;++l)if(!e.equals(h[l],t[l]))return!1;return!0}if(typeof h!=typeof t)return!1;if(typeof h=="string")return h===t;var x=h.tagClass===t.tagClass&&h.type===t.type&&h.constructed===t.constructed&&h.composed===t.composed&&e.equals(h.value,t.value);return C&&C.includeBitStringContents&&(x=x&&h.bitStringContents===t.bitStringContents),x},e.getBerValueLength=function(h){var t=h.getByte();if(t!==128){var C,l=t&128;return l?C=h.getInt((t&127)<<3):C=t,C}};function i(h,t,C){if(C>t){var l=new Error("Too few bytes to parse DER.");throw l.available=h.length(),l.remaining=t,l.requested=C,l}}var v=function(h,t){var C=h.getByte();if(t--,C!==128){var l,x=C&128;if(!x)l=C;else{var k=C&127;i(h,t,k),l=h.getInt(k<<3)}if(l<0)throw new Error("Negative length: "+l);return l}};e.fromDer=function(h,t){t===void 0&&(t={strict:!0,parseAllBytes:!0,decodeBitStrings:!0}),typeof t=="boolean"&&(t={strict:t,parseAllBytes:!0,decodeBitStrings:!0}),"strict"in t||(t.strict=!0),"parseAllBytes"in t||(t.parseAllBytes=!0),"decodeBitStrings"in t||(t.decodeBitStrings=!0),"maxDepth"in t||(t.maxDepth=e.maxDepth),typeof h=="string"&&(h=a.util.createBuffer(h));var C=h.length(),l=_(h,h.length(),0,t);if(t.parseAllBytes&&h.length()!==0){var x=new Error("Unparsed DER bytes remain after ASN.1 parsing.");throw x.byteCount=C,x.remaining=h.length(),x}return l};function _(h,t,C,l){if(C>=l.maxDepth)throw new Error("ASN.1 parsing error: Max depth exceeded.");var x;i(h,t,2);var k=h.getByte();t--;var E=k&192,u=k&31;x=h.length();var y=v(h,t);if(t-=x-h.length(),y!==void 0&&y>t){if(l.strict){var m=new Error("Too few bytes to read ASN.1 value.");throw m.available=h.length(),m.remaining=t,m.requested=y,m}y=t}var g,s,d=(k&32)===32;if(d)if(g=[],y===void 0)for(;;){if(i(h,t,2),h.bytes(2)==="\0\0"){h.getBytes(2),t-=2;break}x=h.length(),g.push(_(h,t,C+1,l)),t-=x-h.length()}else for(;y>0;)x=h.length(),g.push(_(h,y,C+1,l)),t-=x-h.length(),y-=x-h.length();if(g===void 0&&E===e.Class.UNIVERSAL&&u===e.Type.BITSTRING&&(s=h.bytes(y)),g===void 0&&l.decodeBitStrings&&E===e.Class.UNIVERSAL&&u===e.Type.BITSTRING&&y>1){var p=h.read,I=t,R=0;if(u===e.Type.BITSTRING&&(i(h,t,1),R=h.getByte(),t--),R===0)try{x=h.length();var c={strict:!0,decodeBitStrings:!0},n=_(h,t,C+1,c),r=x-h.length();t-=r,u==e.Type.BITSTRING&&r++;var B=n.tagClass;r===y&&(B===e.Class.UNIVERSAL||B===e.Class.CONTEXT_SPECIFIC)&&(g=[n])}catch{}g===void 0&&(h.read=p,t=I)}if(g===void 0){if(y===void 0){if(l.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");y=t}if(u===e.Type.BMPSTRING)for(g="";y>0;y-=2)i(h,t,2),g+=String.fromCharCode(h.getInt16()),t-=2;else g=h.getBytes(y),t-=y}var D=s===void 0?null:{bitStringContents:s};return e.create(E,u,d,g,D)}e.toDer=function(h){var t=a.util.createBuffer(),C=h.tagClass|h.type,l=a.util.createBuffer(),x=!1;if("bitStringContents"in h&&(x=!0,h.original&&(x=e.equals(h,h.original))),x)l.putBytes(h.bitStringContents);else if(h.composed){h.constructed?C|=32:l.putByte(0);for(var k=0;k<h.value.length;++k)h.value[k]!==void 0&&l.putBuffer(e.toDer(h.value[k]))}else if(h.type===e.Type.BMPSTRING)for(var k=0;k<h.value.length;++k)l.putInt16(h.value.charCodeAt(k));else h.type===e.Type.INTEGER&&h.value.length>1&&(h.value.charCodeAt(0)===0&&(h.value.charCodeAt(1)&128)===0||h.value.charCodeAt(0)===255&&(h.value.charCodeAt(1)&128)===128)?l.putBytes(h.value.substr(1)):l.putBytes(h.value);if(t.putByte(C),l.length()<=127)t.putByte(l.length()&127);else{var E=l.length(),u="";do u+=String.fromCharCode(E&255),E=E>>>8;while(E>0);t.putByte(u.length|128);for(var k=u.length-1;k>=0;--k)t.putByte(u.charCodeAt(k))}return t.putBuffer(l),t},e.oidToDer=function(h){var t=h.split("."),C=a.util.createBuffer();C.putByte(40*parseInt(t[0],10)+parseInt(t[1],10));for(var l,x,k,E,u=2;u<t.length;++u){if(l=!0,x=[],k=parseInt(t[u],10),k>4294967295)throw new Error("OID value too large; max is 32-bits.");do E=k&127,k=k>>>7,l||(E|=128),x.push(E),l=!1;while(k>0);for(var y=x.length-1;y>=0;--y)C.putByte(x[y])}return C},e.derToOid=function(h){var t;typeof h=="string"&&(h=a.util.createBuffer(h));var C=h.getByte();t=Math.floor(C/40)+"."+C%40;for(var l=0;h.length()>0;){if(l>70368744177663)throw new Error("OID value too large; max is 53-bits.");C=h.getByte(),l=l*128,C&128?l+=C&127:(t+="."+(l+C),l=0)}return t},e.utcTimeToDate=function(h){var t=new Date,C=parseInt(h.substr(0,2),10);C=C>=50?1900+C:2e3+C;var l=parseInt(h.substr(2,2),10)-1,x=parseInt(h.substr(4,2),10),k=parseInt(h.substr(6,2),10),E=parseInt(h.substr(8,2),10),u=0;if(h.length>11){var y=h.charAt(10),m=10;y!=="+"&&y!=="-"&&(u=parseInt(h.substr(10,2),10),m+=2)}if(t.setUTCFullYear(C,l,x),t.setUTCHours(k,E,u,0),m&&(y=h.charAt(m),y==="+"||y==="-")){var g=parseInt(h.substr(m+1,2),10),s=parseInt(h.substr(m+4,2),10),d=g*60+s;d*=6e4,y==="+"?t.setTime(+t-d):t.setTime(+t+d)}return t},e.generalizedTimeToDate=function(h){var t=new Date,C=parseInt(h.substr(0,4),10),l=parseInt(h.substr(4,2),10)-1,x=parseInt(h.substr(6,2),10),k=parseInt(h.substr(8,2),10),E=parseInt(h.substr(10,2),10),u=parseInt(h.substr(12,2),10),y=0,m=0,g=!1;h.charAt(h.length-1)==="Z"&&(g=!0);var s=h.length-5,d=h.charAt(s);if(d==="+"||d==="-"){var p=parseInt(h.substr(s+1,2),10),I=parseInt(h.substr(s+4,2),10);m=p*60+I,m*=6e4,d==="+"&&(m*=-1),g=!0}return h.charAt(14)==="."&&(y=parseFloat(h.substr(14),10)*1e3),g?(t.setUTCFullYear(C,l,x),t.setUTCHours(k,E,u,y),t.setTime(+t+m)):(t.setFullYear(C,l,x),t.setHours(k,E,u,y)),t},e.dateToUtcTime=function(h){if(typeof h=="string")return h;var t="",C=[];C.push((""+h.getUTCFullYear()).substr(2)),C.push(""+(h.getUTCMonth()+1)),C.push(""+h.getUTCDate()),C.push(""+h.getUTCHours()),C.push(""+h.getUTCMinutes()),C.push(""+h.getUTCSeconds());for(var l=0;l<C.length;++l)C[l].length<2&&(t+="0"),t+=C[l];return t+="Z",t},e.dateToGeneralizedTime=function(h){if(typeof h=="string")return h;var t="",C=[];C.push(""+h.getUTCFullYear()),C.push(""+(h.getUTCMonth()+1)),C.push(""+h.getUTCDate()),C.push(""+h.getUTCHours()),C.push(""+h.getUTCMinutes()),C.push(""+h.getUTCSeconds());for(var l=0;l<C.length;++l)C[l].length<2&&(t+="0"),t+=C[l];return t+="Z",t},e.integerToDer=function(h){var t=a.util.createBuffer();if(h>=-128&&h<128)return t.putSignedInt(h,8);if(h>=-32768&&h<32768)return t.putSignedInt(h,16);if(h>=-8388608&&h<8388608)return t.putSignedInt(h,24);if(h>=-2147483648&&h<2147483648)return t.putSignedInt(h,32);var C=new Error("Integer too large; max is 32-bits.");throw C.integer=h,C},e.derToInteger=function(h){typeof h=="string"&&(h=a.util.createBuffer(h));var t=h.length()*8;if(t>32)throw new Error("Integer too large; max is 32-bits.");return h.getSignedInt(t)},e.validate=function(h,t,C,l){var x=!1;if((h.tagClass===t.tagClass||typeof t.tagClass>"u")&&(h.type===t.type||typeof t.type>"u"))if(h.constructed===t.constructed||typeof t.constructed>"u"){if(x=!0,t.value&&a.util.isArray(t.value))for(var k=0,E=0;x&&E<t.value.length;++E){var u=t.value[E];x=!!u.optional;var y=h.value[k];if(!y){u.optional||(x=!1,l&&l.push("["+t.name+'] Missing required element. Expected tag class "'+u.tagClass+'", type "'+u.type+'"'));continue}var m=typeof u.tagClass<"u"&&typeof u.type<"u";if(m&&(y.tagClass!==u.tagClass||y.type!==u.type))if(u.optional){x=!0;continue}else{x=!1,l&&l.push("["+t.name+"] Tag mismatch. Expected ("+u.tagClass+","+u.type+"), got ("+y.tagClass+","+y.type+")");break}var g=e.validate(y,u,C,l);if(g)++k,x=!0;else if(u.optional)x=!0;else{x=!1;break}}if(x&&C&&(t.capture&&(C[t.capture]=h.value),t.captureAsn1&&(C[t.captureAsn1]=h),t.captureBitStringContents&&"bitStringContents"in h&&(C[t.captureBitStringContents]=h.bitStringContents),t.captureBitStringValue&&"bitStringContents"in h))if(h.bitStringContents.length<2)C[t.captureBitStringValue]="";else{var s=h.bitStringContents.charCodeAt(0);if(s!==0)throw new Error("captureBitStringValue only supported for zero unused bits");C[t.captureBitStringValue]=h.bitStringContents.slice(1)}}else l&&l.push("["+t.name+'] Expected constructed "'+t.constructed+'", got "'+h.constructed+'"');else l&&(h.tagClass!==t.tagClass&&l.push("["+t.name+'] Expected tag class "'+t.tagClass+'", got "'+h.tagClass+'"'),h.type!==t.type&&l.push("["+t.name+'] Expected type "'+t.type+'", got "'+h.type+'"'));return x};var S=/[^\\u0000-\\u00ff]/;return e.prettyPrint=function(h,t,C){var l="";t=t||0,C=C||2,t>0&&(l+=`
`);for(var x="",k=0;k<t*C;++k)x+=" ";switch(l+=x+"Tag: ",h.tagClass){case e.Class.UNIVERSAL:l+="Universal:";break;case e.Class.APPLICATION:l+="Application:";break;case e.Class.CONTEXT_SPECIFIC:l+="Context-Specific:";break;case e.Class.PRIVATE:l+="Private:";break}if(h.tagClass===e.Class.UNIVERSAL)switch(l+=h.type,h.type){case e.Type.NONE:l+=" (None)";break;case e.Type.BOOLEAN:l+=" (Boolean)";break;case e.Type.INTEGER:l+=" (Integer)";break;case e.Type.BITSTRING:l+=" (Bit string)";break;case e.Type.OCTETSTRING:l+=" (Octet string)";break;case e.Type.NULL:l+=" (Null)";break;case e.Type.OID:l+=" (Object Identifier)";break;case e.Type.ODESC:l+=" (Object Descriptor)";break;case e.Type.EXTERNAL:l+=" (External or Instance of)";break;case e.Type.REAL:l+=" (Real)";break;case e.Type.ENUMERATED:l+=" (Enumerated)";break;case e.Type.EMBEDDED:l+=" (Embedded PDV)";break;case e.Type.UTF8:l+=" (UTF8)";break;case e.Type.ROID:l+=" (Relative Object Identifier)";break;case e.Type.SEQUENCE:l+=" (Sequence)";break;case e.Type.SET:l+=" (Set)";break;case e.Type.PRINTABLESTRING:l+=" (Printable String)";break;case e.Type.IA5String:l+=" (IA5String (ASCII))";break;case e.Type.UTCTIME:l+=" (UTC time)";break;case e.Type.GENERALIZEDTIME:l+=" (Generalized time)";break;case e.Type.BMPSTRING:l+=" (BMP String)";break}else l+=h.type;if(l+=`
`,l+=x+"Constructed: "+h.constructed+`
`,h.composed){for(var E=0,u="",k=0;k<h.value.length;++k)h.value[k]!==void 0&&(E+=1,u+=e.prettyPrint(h.value[k],t+1,C),k+1<h.value.length&&(u+=","));l+=x+"Sub values: "+E+u}else{if(l+=x+"Value: ",h.type===e.Type.OID){var y=e.derToOid(h.value);l+=y,a.pki&&a.pki.oids&&y in a.pki.oids&&(l+=" ("+a.pki.oids[y]+") ")}if(h.type===e.Type.INTEGER)try{l+=e.derToInteger(h.value)}catch{l+="0x"+a.util.bytesToHex(h.value)}else if(h.type===e.Type.BITSTRING){if(h.value.length>1?l+="0x"+a.util.bytesToHex(h.value.slice(1)):l+="(none)",h.value.length>0){var m=h.value.charCodeAt(0);m==1?l+=" (1 unused bit shown)":m>1&&(l+=" ("+m+" unused bits shown)")}}else if(h.type===e.Type.OCTETSTRING)S.test(h.value)||(l+="("+h.value+") "),l+="0x"+a.util.bytesToHex(h.value);else if(h.type===e.Type.UTF8)try{l+=a.util.decodeUtf8(h.value)}catch(g){if(g.message==="URI malformed")l+="0x"+a.util.bytesToHex(h.value)+" (malformed UTF8)";else throw g}else h.type===e.Type.PRINTABLESTRING||h.type===e.Type.IA5String?l+=h.value:S.test(h.value)?l+="0x"+a.util.bytesToHex(h.value):h.value.length===0?l+="[null]":l+=h.value}return l},kt.exports}var Pt={exports:{}},Vt,br;function rt(){if(br)return Vt;br=1;var a=ue();return Vt=a.md=a.md||{},a.md.algorithms=a.md.algorithms||{},Vt}var _r;function pt(){if(_r)return Pt.exports;_r=1;var a=ue();rt(),de();var e=Pt.exports=a.hmac=a.hmac||{};return e.create=function(){var i=null,v=null,_=null,S=null,h={};return h.start=function(t,C){if(t!==null)if(typeof t=="string")if(t=t.toLowerCase(),t in a.md.algorithms)v=a.md.algorithms[t].create();else throw new Error('Unknown hash algorithm "'+t+'"');else v=t;if(C===null)C=i;else{if(typeof C=="string")C=a.util.createBuffer(C);else if(a.util.isArray(C)){var l=C;C=a.util.createBuffer();for(var x=0;x<l.length;++x)C.putByte(l[x])}var k=C.length();k>v.blockLength&&(v.start(),v.update(C.bytes()),C=v.digest()),_=a.util.createBuffer(),S=a.util.createBuffer(),k=C.length();for(var x=0;x<k;++x){var l=C.at(x);_.putByte(54^l),S.putByte(92^l)}if(k<v.blockLength)for(var l=v.blockLength-k,x=0;x<l;++x)_.putByte(54),S.putByte(92);i=C,_=_.bytes(),S=S.bytes()}v.start(),v.update(_)},h.update=function(t){v.update(t)},h.getMac=function(){var t=v.digest().bytes();return v.start(),v.update(S),v.update(t),v.digest()},h.digest=h.getMac,h},Pt.exports}var Ot={exports:{}},Nr;function Kt(){if(Nr)return Ot.exports;Nr=1;var a=ue();rt(),de();var e=Ot.exports=a.md5=a.md5||{};a.md.md5=a.md.algorithms.md5=e,e.create=function(){h||t();var l=null,x=a.util.createBuffer(),k=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 u=E.messageLengthSize/4,y=0;y<u;++y)E.fullMessageLength.push(0);return x=a.util.createBuffer(),l={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878},E},E.start(),E.update=function(u,y){y==="utf8"&&(u=a.util.encodeUtf8(u));var m=u.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 x.putBytes(u),C(l,k,x),(x.read>2048||x.length()===0)&&x.compact(),E},E.digest=function(){var u=a.util.createBuffer();u.putBytes(x.bytes());var y=E.fullMessageLength[E.fullMessageLength.length-1]+E.messageLengthSize,m=y&E.blockLength-1;u.putBytes(i.substr(0,E.blockLength-m));for(var g,s=0,d=E.fullMessageLength.length-1;d>=0;--d)g=E.fullMessageLength[d]*8+s,s=g/4294967296>>>0,u.putInt32Le(g>>>0);var p={h0:l.h0,h1:l.h1,h2:l.h2,h3:l.h3};C(p,k,u);var I=a.util.createBuffer();return I.putInt32Le(p.h0),I.putInt32Le(p.h1),I.putInt32Le(p.h2),I.putInt32Le(p.h3),I},E};var i=null,v=null,_=null,S=null,h=!1;function t(){i="€",i+=a.util.fillString("\0",64),v=[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],_=[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],S=new Array(64);for(var l=0;l<64;++l)S[l]=Math.floor(Math.abs(Math.sin(l+1))*4294967296);h=!0}function C(l,x,k){for(var E,u,y,m,g,s,d,p,I=k.length();I>=64;){for(u=l.h0,y=l.h1,m=l.h2,g=l.h3,p=0;p<16;++p)x[p]=k.getInt32Le(),s=g^y&(m^g),E=u+s+S[p]+x[p],d=_[p],u=g,g=m,m=y,y+=E<<d|E>>>32-d;for(;p<32;++p)s=m^g&(y^m),E=u+s+S[p]+x[v[p]],d=_[p],u=g,g=m,m=y,y+=E<<d|E>>>32-d;for(;p<48;++p)s=y^m^g,E=u+s+S[p]+x[v[p]],d=_[p],u=g,g=m,m=y,y+=E<<d|E>>>32-d;for(;p<64;++p)s=m^(y|~g),E=u+s+S[p]+x[v[p]],d=_[p],u=g,g=m,m=y,y+=E<<d|E>>>32-d;l.h0=l.h0+u|0,l.h1=l.h1+y|0,l.h2=l.h2+m|0,l.h3=l.h3+g|0,I-=64}}return Ot.exports}var Ft={exports:{}},Rr;function lt(){if(Rr)return Ft.exports;Rr=1;var a=ue();de();var e=Ft.exports=a.pem=a.pem||{};e.encode=function(_,S){S=S||{};var h="-----BEGIN "+_.type+`-----\r
`,t;if(_.procType&&(t={name:"Proc-Type",values:[String(_.procType.version),_.procType.type]},h+=i(t)),_.contentDomain&&(t={name:"Content-Domain",values:[_.contentDomain]},h+=i(t)),_.dekInfo&&(t={name:"DEK-Info",values:[_.dekInfo.algorithm]},_.dekInfo.parameters&&t.values.push(_.dekInfo.parameters),h+=i(t)),_.headers)for(var C=0;C<_.headers.length;++C)h+=i(_.headers[C]);return _.procType&&(h+=`\r
`),h+=a.util.encode64(_.body,S.maxline||64)+`\r
`,h+="-----END "+_.type+`-----\r
`,h},e.decode=function(_){for(var S=[],h=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,t=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,C=/\r?\n/,l;l=h.exec(_),!!l;){var x=l[1];x==="NEW CERTIFICATE REQUEST"&&(x="CERTIFICATE REQUEST");var k={type:x,procType:null,contentDomain:null,dekInfo:null,headers:[],body:a.util.decode64(l[3])};if(S.push(k),!!l[2]){for(var E=l[2].split(C),u=0;l&&u<E.length;){for(var y=E[u].replace(/\s+$/,""),m=u+1;m<E.length;++m){var g=E[m];if(!/\s/.test(g[0]))break;y+=g,u=m}if(l=y.match(t),l){for(var s={name:l[1],values:[]},d=l[2].split(","),p=0;p<d.length;++p)s.values.push(v(d[p]));if(k.procType)if(!k.contentDomain&&s.name==="Content-Domain")k.contentDomain=d[0]||"";else if(!k.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.');k.dekInfo={algorithm:d[0],parameters:d[1]||null}}else k.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.');k.procType={version:d[0],type:d[1]}}}++u}if(k.procType==="ENCRYPTED"&&!k.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(S.length===0)throw new Error("Invalid PEM formatted message.");return S};function i(_){for(var S=_.name+": ",h=[],t=function(E,u){return" "+u},C=0;C<_.values.length;++C)h.push(_.values[C].replace(/^(\S+\r\n)/,t));S+=h.join(",")+`\r
`;for(var l=0,x=-1,C=0;C<S.length;++C,++l)if(l>65&&x!==-1){var k=S[x];k===","?(++x,S=S.substr(0,x)+`\r
 `+S.substr(x)):S=S.substr(0,x)+`\r
`+k+S.substr(x+1),l=C-x-1,x=-1,++C}else(S[C]===" "||S[C]==="	"||S[C]===",")&&(x=C);return S}function v(_){return _.replace(/^\s+/,"")}return Ft.exports}var Mt={exports:{}},qt,wr;function gt(){if(wr)return qt;wr=1;var a=ue();Rt(),Tr(),de(),qt=a.des=a.des||{},a.des.startEncrypting=function(u,y,m,g){var s=E({key:u,output:m,decrypt:!1,mode:g||(y===null?"ECB":"CBC")});return s.start(y),s},a.des.createEncryptionCipher=function(u,y){return E({key:u,output:null,decrypt:!1,mode:y})},a.des.startDecrypting=function(u,y,m,g){var s=E({key:u,output:m,decrypt:!0,mode:g||(y===null?"ECB":"CBC")});return s.start(y),s},a.des.createDecryptionCipher=function(u,y){return E({key:u,output:null,decrypt:!0,mode:y})},a.des.Algorithm=function(u,y){var m=this;m.name=u,m.mode=new y({blockSize:8,cipher:{encrypt:function(g,s){return k(m._keys,g,s,!1)},decrypt:function(g,s){return k(m._keys,g,s,!0)}}}),m._init=!1},a.des.Algorithm.prototype.initialize=function(u){if(!this._init){var y=a.util.createBuffer(u.key);if(this.name.indexOf("3DES")===0&&y.length()!==24)throw new Error("Invalid Triple-DES key size: "+y.length()*8);this._keys=x(y),this._init=!0}},e("DES-ECB",a.cipher.modes.ecb),e("DES-CBC",a.cipher.modes.cbc),e("DES-CFB",a.cipher.modes.cfb),e("DES-OFB",a.cipher.modes.ofb),e("DES-CTR",a.cipher.modes.ctr),e("3DES-ECB",a.cipher.modes.ecb),e("3DES-CBC",a.cipher.modes.cbc),e("3DES-CFB",a.cipher.modes.cfb),e("3DES-OFB",a.cipher.modes.ofb),e("3DES-CTR",a.cipher.modes.ctr);function e(u,y){var m=function(){return new a.des.Algorithm(u,y)};a.cipher.registerAlgorithm(u,m)}var i=[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],v=[-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],_=[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],S=[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],h=[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],t=[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],C=[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],l=[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 x(u){for(var y=[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],d=[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],I=[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],n=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],r=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],B=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],D=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],V=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],L=u.length()>8?3:1,O=[],q=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],M=0,H,Y=0;Y<L;Y++){var W=u.getInt32(),$=u.getInt32();H=(W>>>4^$)&252645135,$^=H,W^=H<<4,H=($>>>-16^W)&65535,W^=H,$^=H<<-16,H=(W>>>2^$)&858993459,$^=H,W^=H<<2,H=($>>>-16^W)&65535,W^=H,$^=H<<-16,H=(W>>>1^$)&1431655765,$^=H,W^=H<<1,H=($>>>8^W)&16711935,W^=H,$^=H<<8,H=(W>>>1^$)&1431655765,$^=H,W^=H<<1,H=W<<8|$>>>20&240,W=$<<24|$<<8&16711680|$>>>8&65280|$>>>24&240,$=H;for(var ie=0;ie<q.length;++ie){q[ie]?(W=W<<2|W>>>26,$=$<<2|$>>>26):(W=W<<1|W>>>27,$=$<<1|$>>>27),W&=-15,$&=-15;var se=y[W>>>28]|m[W>>>24&15]|g[W>>>20&15]|s[W>>>16&15]|d[W>>>12&15]|p[W>>>8&15]|I[W>>>4&15],he=R[$>>>28]|c[$>>>24&15]|n[$>>>20&15]|r[$>>>16&15]|B[$>>>12&15]|D[$>>>8&15]|V[$>>>4&15];H=(he>>>16^se)&65535,O[M++]=se^H,O[M++]=he^H<<16}}return O}function k(u,y,m,g){var s=u.length===32?3:9,d;s===3?d=g?[30,-2,-2]:[0,32,2]:d=g?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var p,I=y[0],R=y[1];p=(I>>>4^R)&252645135,R^=p,I^=p<<4,p=(I>>>16^R)&65535,R^=p,I^=p<<16,p=(R>>>2^I)&858993459,I^=p,R^=p<<2,p=(R>>>8^I)&16711935,I^=p,R^=p<<8,p=(I>>>1^R)&1431655765,R^=p,I^=p<<1,I=I<<1|I>>>31,R=R<<1|R>>>31;for(var c=0;c<s;c+=3){for(var n=d[c+1],r=d[c+2],B=d[c];B!=n;B+=r){var D=R^u[B],V=(R>>>4|R<<28)^u[B+1];p=I,I=R,R=p^(v[D>>>24&63]|S[D>>>16&63]|t[D>>>8&63]|l[D&63]|i[V>>>24&63]|_[V>>>16&63]|h[V>>>8&63]|C[V&63])}p=I,I=R,R=p}I=I>>>1|I<<31,R=R>>>1|R<<31,p=(I>>>1^R)&1431655765,R^=p,I^=p<<1,p=(R>>>8^I)&16711935,I^=p,R^=p<<8,p=(R>>>2^I)&858993459,I^=p,R^=p<<2,p=(I>>>16^R)&65535,R^=p,I^=p<<16,p=(I>>>4^R)&252645135,R^=p,I^=p<<4,m[0]=I,m[1]=R}function E(u){u=u||{};var y=(u.mode||"CBC").toUpperCase(),m="DES-"+y,g;u.decrypt?g=a.cipher.createDecipher(m,u.key):g=a.cipher.createCipher(m,u.key);var s=g.start;return g.start=function(d,p){var I=null;p instanceof a.util.ByteBuffer&&(I=p,p={}),p=p||{},p.output=I,p.iv=d,s.call(g,p)},g}return qt}var Ia={},Aa=Object.freeze({__proto__:null,default:Ia}),Ht=Sa(Aa),Gt,Lr;function Qt(){if(Lr)return Gt;Lr=1;var a=ue();pt(),rt(),de();var e=a.pkcs5=a.pkcs5||{},i;return a.util.isNodejs&&!a.options.usePureJavaScript&&(i=Ht),Gt=a.pbkdf2=e.pbkdf2=function(v,_,S,h,t,C){if(typeof t=="function"&&(C=t,t=null),a.util.isNodejs&&!a.options.usePureJavaScript&&i.pbkdf2&&(t===null||typeof t!="object")&&(i.pbkdf2Sync.length>4||!t||t==="sha1"))return typeof t!="string"&&(t="sha1"),v=Buffer.from(v,"binary"),_=Buffer.from(_,"binary"),C?i.pbkdf2Sync.length===4?i.pbkdf2(v,_,S,h,function(c,n){if(c)return C(c);C(null,n.toString("binary"))}):i.pbkdf2(v,_,S,h,t,function(c,n){if(c)return C(c);C(null,n.toString("binary"))}):i.pbkdf2Sync.length===4?i.pbkdf2Sync(v,_,S,h).toString("binary"):i.pbkdf2Sync(v,_,S,h,t).toString("binary");if((typeof t>"u"||t===null)&&(t="sha1"),typeof t=="string"){if(!(t in a.md.algorithms))throw new Error("Unknown hash algorithm: "+t);t=a.md[t].create()}var l=t.digestLength;if(h>4294967295*l){var x=new Error("Derived key is too long.");if(C)return C(x);throw x}var k=Math.ceil(h/l),E=h-(k-1)*l,u=a.hmac.create();u.start(t,v);var y="",m,g,s;if(!C){for(var d=1;d<=k;++d){u.start(null,null),u.update(_),u.update(a.util.int32ToBytes(d)),m=s=u.digest().getBytes();for(var p=2;p<=S;++p)u.start(null,null),u.update(s),g=u.digest().getBytes(),m=a.util.xorBytes(m,g,l),s=g;y+=d<k?m:m.substr(0,E)}return y}var d=1,p;function I(){if(d>k)return C(null,y);u.start(null,null),u.update(_),u.update(a.util.int32ToBytes(d)),m=s=u.digest().getBytes(),p=2,R()}function R(){if(p<=S)return u.start(null,null),u.update(s),g=u.digest().getBytes(),m=a.util.xorBytes(m,g,l),s=g,++p,a.util.setImmediate(R);y+=d<k?m:m.substr(0,E),++d,I()}I()},Gt}var Ct={exports:{}},zt={exports:{}},Dr;function kr(){if(Dr)return zt.exports;Dr=1;var a=ue();rt(),de();var e=zt.exports=a.sha256=a.sha256||{};a.md.sha256=a.md.algorithms.sha256=e,e.create=function(){v||S();var t=null,C=a.util.createBuffer(),l=new Array(64),x={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8};return x.start=function(){x.messageLength=0,x.fullMessageLength=x.messageLength64=[];for(var k=x.messageLengthSize/4,E=0;E<k;++E)x.fullMessageLength.push(0);return C=a.util.createBuffer(),t={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},x},x.start(),x.update=function(k,E){E==="utf8"&&(k=a.util.encodeUtf8(k));var u=k.length;x.messageLength+=u,u=[u/4294967296>>>0,u>>>0];for(var y=x.fullMessageLength.length-1;y>=0;--y)x.fullMessageLength[y]+=u[1],u[1]=u[0]+(x.fullMessageLength[y]/4294967296>>>0),x.fullMessageLength[y]=x.fullMessageLength[y]>>>0,u[0]=u[1]/4294967296>>>0;return C.putBytes(k),h(t,l,C),(C.read>2048||C.length()===0)&&C.compact(),x},x.digest=function(){var k=a.util.createBuffer();k.putBytes(C.bytes());var E=x.fullMessageLength[x.fullMessageLength.length-1]+x.messageLengthSize,u=E&x.blockLength-1;k.putBytes(i.substr(0,x.blockLength-u));for(var y,m,g=x.fullMessageLength[0]*8,s=0;s<x.fullMessageLength.length-1;++s)y=x.fullMessageLength[s+1]*8,m=y/4294967296>>>0,g+=m,k.putInt32(g>>>0),g=y>>>0;k.putInt32(g);var d={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3,h4:t.h4,h5:t.h5,h6:t.h6,h7:t.h7};h(d,l,k);var p=a.util.createBuffer();return p.putInt32(d.h0),p.putInt32(d.h1),p.putInt32(d.h2),p.putInt32(d.h3),p.putInt32(d.h4),p.putInt32(d.h5),p.putInt32(d.h6),p.putInt32(d.h7),p},x};var i=null,v=!1,_=null;function S(){i="€",i+=a.util.fillString("\0",64),_=[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],v=!0}function h(t,C,l){for(var x,k,E,u,y,m,g,s,d,p,I,R,c,n,r,B=l.length();B>=64;){for(g=0;g<16;++g)C[g]=l.getInt32();for(;g<64;++g)x=C[g-2],x=(x>>>17|x<<15)^(x>>>19|x<<13)^x>>>10,k=C[g-15],k=(k>>>7|k<<25)^(k>>>18|k<<14)^k>>>3,C[g]=x+C[g-7]+k+C[g-16]|0;for(s=t.h0,d=t.h1,p=t.h2,I=t.h3,R=t.h4,c=t.h5,n=t.h6,r=t.h7,g=0;g<64;++g)u=(R>>>6|R<<26)^(R>>>11|R<<21)^(R>>>25|R<<7),y=n^R&(c^n),E=(s>>>2|s<<30)^(s>>>13|s<<19)^(s>>>22|s<<10),m=s&d|p&(s^d),x=r+u+y+_[g]+C[g],k=E+m,r=n,n=c,c=R,R=I+x>>>0,I=p,p=d,d=s,s=x+k>>>0;t.h0=t.h0+s|0,t.h1=t.h1+d|0,t.h2=t.h2+p|0,t.h3=t.h3+I|0,t.h4=t.h4+R|0,t.h5=t.h5+c|0,t.h6=t.h6+n|0,t.h7=t.h7+r|0,B-=64}}return zt.exports}var Yt={exports:{}},Ur;function Pr(){if(Ur)return Yt.exports;Ur=1;var a=ue();de();var e=null;a.util.isNodejs&&!a.options.usePureJavaScript&&!process.versions["node-webkit"]&&(e=Ht);var i=Yt.exports=a.prng=a.prng||{};return i.create=function(v){for(var _={plugin:v,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},S=v.md,h=new Array(32),t=0;t<32;++t)h[t]=S.create();_.pools=h,_.pool=0,_.generate=function(E,u){if(!u)return _.generateSync(E);var y=_.plugin.cipher,m=_.plugin.increment,g=_.plugin.formatKey,s=_.plugin.formatSeed,d=a.util.createBuffer();_.key=null,p();function p(I){if(I)return u(I);if(d.length()>=E)return u(null,d.getBytes(E));if(_.generated>1048575&&(_.key=null),_.key===null)return a.util.nextTick(function(){C(p)});var R=y(_.key,_.seed);_.generated+=R.length,d.putBytes(R),_.key=g(y(_.key,m(_.seed))),_.seed=s(y(_.key,_.seed)),a.util.setImmediate(p)}},_.generateSync=function(E){var u=_.plugin.cipher,y=_.plugin.increment,m=_.plugin.formatKey,g=_.plugin.formatSeed;_.key=null;for(var s=a.util.createBuffer();s.length()<E;){_.generated>1048575&&(_.key=null),_.key===null&&l();var d=u(_.key,_.seed);_.generated+=d.length,s.putBytes(d),_.key=m(u(_.key,y(_.seed))),_.seed=g(u(_.key,_.seed))}return s.getBytes(E)};function C(E){if(_.pools[0].messageLength>=32)return x(),E();var u=32-_.pools[0].messageLength<<5;_.seedFile(u,function(y,m){if(y)return E(y);_.collect(m),x(),E()})}function l(){if(_.pools[0].messageLength>=32)return x();var E=32-_.pools[0].messageLength<<5;_.collect(_.seedFileSync(E)),x()}function x(){_.reseeds=_.reseeds===4294967295?0:_.reseeds+1;var E=_.plugin.md.create();E.update(_.keyBytes);for(var u=1,y=0;y<32;++y)_.reseeds%u===0&&(E.update(_.pools[y].digest().getBytes()),_.pools[y].start()),u=u<<1;_.keyBytes=E.digest().getBytes(),E.start(),E.update(_.keyBytes);var m=E.digest().getBytes();_.key=_.plugin.formatKey(_.keyBytes),_.seed=_.plugin.formatSeed(m),_.generated=0}function k(E){var u=null,y=a.util.globalScope,m=y.crypto||y.msCrypto;m&&m.getRandomValues&&(u=function(r){return m.getRandomValues(r)});var g=a.util.createBuffer();if(u)for(;g.length()<E;){var s=Math.max(1,Math.min(E-g.length(),65536)/4),d=new Uint32Array(Math.floor(s));try{u(d);for(var p=0;p<d.length;++p)g.putInt32(d[p])}catch(r){if(!(typeof QuotaExceededError<"u"&&r instanceof QuotaExceededError))throw r}}if(g.length()<E)for(var I,R,c,n=Math.floor(Math.random()*65536);g.length()<E;){R=16807*(n&65535),I=16807*(n>>16),R+=(I&32767)<<16,R+=I>>15,R=(R&2147483647)+(R>>31),n=R&4294967295;for(var p=0;p<3;++p)c=n>>>(p<<3),c^=Math.floor(Math.random()*256),g.putByte(c&255)}return g.getBytes(E)}return e?(_.seedFile=function(E,u){e.randomBytes(E,function(y,m){if(y)return u(y);u(null,m.toString())})},_.seedFileSync=function(E){return e.randomBytes(E).toString()}):(_.seedFile=function(E,u){try{u(null,k(E))}catch(y){u(y)}},_.seedFileSync=k),_.collect=function(E){for(var u=E.length,y=0;y<u;++y)_.pools[_.pool].update(E.substr(y,1)),_.pool=_.pool===31?0:_.pool+1},_.collectInt=function(E,u){for(var y="",m=0;m<u;m+=8)y+=String.fromCharCode(E>>m&255);_.collect(y)},_.registerWorker=function(E){if(E===self)_.seedFile=function(y,m){function g(s){var d=s.data;d.forge&&d.forge.prng&&(self.removeEventListener("message",g),m(d.forge.prng.err,d.forge.prng.bytes))}self.addEventListener("message",g),self.postMessage({forge:{prng:{needed:y}}})};else{var u=function(y){var m=y.data;m.forge&&m.forge.prng&&_.seedFile(m.forge.prng.needed,function(g,s){E.postMessage({forge:{prng:{err:g,bytes:s}}})})};E.addEventListener("message",u)}},_},Yt.exports}var Vr;function We(){if(Vr)return Ct.exports;Vr=1;var a=ue();return ot(),kr(),Pr(),de(),(function(){if(a.random&&a.random.getBytes){Ct.exports=a.random;return}(function(e){var i={},v=new Array(4),_=a.util.createBuffer();i.formatKey=function(E){var u=a.util.createBuffer(E);return E=new Array(4),E[0]=u.getInt32(),E[1]=u.getInt32(),E[2]=u.getInt32(),E[3]=u.getInt32(),a.aes._expandKey(E,!1)},i.formatSeed=function(E){var u=a.util.createBuffer(E);return E=new Array(4),E[0]=u.getInt32(),E[1]=u.getInt32(),E[2]=u.getInt32(),E[3]=u.getInt32(),E},i.cipher=function(E,u){return a.aes._updateBlock(E,u,v,!1),_.putInt32(v[0]),_.putInt32(v[1]),_.putInt32(v[2]),_.putInt32(v[3]),_.getBytes()},i.increment=function(E){return++E[3],E},i.md=a.md.sha256;function S(){var E=a.prng.create(i);return E.getBytes=function(u,y){return E.generate(u,y)},E.getBytesSync=function(u){return E.generate(u)},E}var h=S(),t=null,C=a.util.globalScope,l=C.crypto||C.msCrypto;if(l&&l.getRandomValues&&(t=function(E){return l.getRandomValues(E)}),a.options.usePureJavaScript||!a.util.isNodejs&&!t){if(h.collectInt(+new Date,32),typeof navigator<"u"){var x="";for(var k in navigator)try{typeof navigator[k]=="string"&&(x+=navigator[k])}catch{}h.collect(x),x=null}e&&(e().mousemove(function(E){h.collectInt(E.clientX,16),h.collectInt(E.clientY,16)}),e().keypress(function(E){h.collectInt(E.charCode,8)}))}if(!a.random)a.random=h;else for(var k in h)a.random[k]=h[k];a.random.createInstance=S,Ct.exports=a.random})(typeof jQuery<"u"?jQuery:null)})(),Ct.exports}var Xt,Or;function Kr(){if(Or)return Xt;Or=1;var a=ue();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],i=[1,2,3,5],v=function(h,t){return h<<t&65535|(h&65535)>>16-t},_=function(h,t){return(h&65535)>>t|h<<16-t&65535};Xt=a.rc2=a.rc2||{},a.rc2.expandKey=function(h,t){typeof h=="string"&&(h=a.util.createBuffer(h)),t=t||128;var C=h,l=h.length(),x=t,k=Math.ceil(x/8),E=255>>(x&7),u;for(u=l;u<128;u++)C.putByte(e[C.at(u-1)+C.at(u-l)&255]);for(C.setAt(128-k,e[C.at(128-k)&E]),u=127-k;u>=0;u--)C.setAt(u,e[C.at(u+1)^C.at(u+k)]);return C};var S=function(h,t,C){var l=!1,x=null,k=null,E=null,u,y,m,g,s=[];for(h=a.rc2.expandKey(h,t),m=0;m<64;m++)s.push(h.getInt16Le());C?(u=function(I){for(m=0;m<4;m++)I[m]+=s[g]+(I[(m+3)%4]&I[(m+2)%4])+(~I[(m+3)%4]&I[(m+1)%4]),I[m]=v(I[m],i[m]),g++},y=function(I){for(m=0;m<4;m++)I[m]+=s[I[(m+3)%4]&63]}):(u=function(I){for(m=3;m>=0;m--)I[m]=_(I[m],i[m]),I[m]-=s[g]+(I[(m+3)%4]&I[(m+2)%4])+(~I[(m+3)%4]&I[(m+1)%4]),g--},y=function(I){for(m=3;m>=0;m--)I[m]-=s[I[(m+3)%4]&63]});var d=function(I){var R=[];for(m=0;m<4;m++){var c=x.getInt16Le();E!==null&&(C?c^=E.getInt16Le():E.putInt16Le(c)),R.push(c&65535)}g=C?0:63;for(var n=0;n<I.length;n++)for(var r=0;r<I[n][0];r++)I[n][1](R);for(m=0;m<4;m++)E!==null&&(C?E.putInt16Le(R[m]):R[m]^=E.getInt16Le()),k.putInt16Le(R[m])},p=null;return p={start:function(I,R){I&&typeof I=="string"&&(I=a.util.createBuffer(I)),l=!1,x=a.util.createBuffer(),k=R||new a.util.createBuffer,E=I,p.output=k},update:function(I){for(l||x.putBuffer(I);x.length()>=8;)d([[5,u],[1,y],[6,u],[1,y],[5,u]])},finish:function(I){var R=!0;if(C)if(I)R=I(8,x,!C);else{var c=x.length()===8?8:8-x.length();x.fillWithByte(c,c)}if(R&&(l=!0,p.update()),!C&&(R=x.length()===0,R))if(I)R=I(8,k,!C);else{var n=k.length(),r=k.at(n-1);r>n?R=!1:k.truncate(r)}return R}},p};return a.rc2.startEncrypting=function(h,t,C){var l=a.rc2.createEncryptionCipher(h,128);return l.start(t,C),l},a.rc2.createEncryptionCipher=function(h,t){return S(h,t,!0)},a.rc2.startDecrypting=function(h,t,C){var l=a.rc2.createDecryptionCipher(h,128);return l.start(t,C),l},a.rc2.createDecryptionCipher=function(h,t){return S(h,t,!1)},Xt}var Wt,Fr;function mt(){if(Fr)return Wt;Fr=1;var a=ue();Wt=a.jsbn=a.jsbn||{};var e;function i(T,b,U){this.data=[],T!=null&&(typeof T=="number"?this.fromNumber(T,b,U):b==null&&typeof T!="string"?this.fromString(T,256):this.fromString(T,b))}a.jsbn.BigInteger=i;function v(){return new i(null)}function _(T,b,U,F,Q,X){for(;--X>=0;){var re=b*this.data[T++]+U.data[F]+Q;Q=Math.floor(re/67108864),U.data[F++]=re&67108863}return Q}function S(T,b,U,F,Q,X){for(var re=b&32767,J=b>>15;--X>=0;){var pe=this.data[T]&32767,Ke=this.data[T++]>>15,Xe=J*pe+Ke*re;pe=re*pe+((Xe&32767)<<15)+U.data[F]+(Q&1073741823),Q=(pe>>>30)+(Xe>>>15)+J*Ke+(Q>>>30),U.data[F++]=pe&1073741823}return Q}function h(T,b,U,F,Q,X){for(var re=b&16383,J=b>>14;--X>=0;){var pe=this.data[T]&16383,Ke=this.data[T++]>>14,Xe=J*pe+Ke*re;pe=re*pe+((Xe&16383)<<14)+U.data[F]+Q,Q=(pe>>28)+(Xe>>14)+J*Ke,U.data[F++]=pe&268435455}return Q}typeof navigator>"u"?(i.prototype.am=h,e=28):navigator.appName=="Microsoft Internet Explorer"?(i.prototype.am=S,e=30):navigator.appName!="Netscape"?(i.prototype.am=_,e=26):(i.prototype.am=h,e=28),i.prototype.DB=e,i.prototype.DM=(1<<e)-1,i.prototype.DV=1<<e;var t=52;i.prototype.FV=Math.pow(2,t),i.prototype.F1=t-e,i.prototype.F2=2*e-t;var C="0123456789abcdefghijklmnopqrstuvwxyz",l=new Array,x,k;for(x=48,k=0;k<=9;++k)l[x++]=k;for(x=97,k=10;k<36;++k)l[x++]=k;for(x=65,k=10;k<36;++k)l[x++]=k;function E(T){return C.charAt(T)}function u(T,b){var U=l[T.charCodeAt(b)];return U??-1}function y(T){for(var b=this.t-1;b>=0;--b)T.data[b]=this.data[b];T.t=this.t,T.s=this.s}function m(T){this.t=1,this.s=T<0?-1:0,T>0?this.data[0]=T:T<-1?this.data[0]=T+this.DV:this.t=0}function g(T){var b=v();return b.fromInt(T),b}function s(T,b){var U;if(b==16)U=4;else if(b==8)U=3;else if(b==256)U=8;else if(b==2)U=1;else if(b==32)U=5;else if(b==4)U=2;else{this.fromRadix(T,b);return}this.t=0,this.s=0;for(var F=T.length,Q=!1,X=0;--F>=0;){var re=U==8?T[F]&255:u(T,F);if(re<0){T.charAt(F)=="-"&&(Q=!0);continue}Q=!1,X==0?this.data[this.t++]=re:X+U>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+=U,X>=this.DB&&(X-=this.DB)}U==8&&(T[0]&128)!=0&&(this.s=-1,X>0&&(this.data[this.t-1]|=(1<<this.DB-X)-1<<X)),this.clamp(),Q&&i.ZERO.subTo(this,this)}function d(){for(var T=this.s&this.DM;this.t>0&&this.data[this.t-1]==T;)--this.t}function p(T){if(this.s<0)return"-"+this.negate().toString(T);var b;if(T==16)b=4;else if(T==8)b=3;else if(T==2)b=1;else if(T==32)b=5;else if(T==4)b=2;else return this.toRadix(T);var U=(1<<b)-1,F,Q=!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&&(Q=!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)&U,J<=0&&(J+=this.DB,--re)),F>0&&(Q=!0),Q&&(X+=E(F));return Q?X:"0"}function I(){var T=v();return i.ZERO.subTo(this,T),T}function R(){return this.s<0?this.negate():this}function c(T){var b=this.s-T.s;if(b!=0)return b;var U=this.t;if(b=U-T.t,b!=0)return this.s<0?-b:b;for(;--U>=0;)if((b=this.data[U]-T.data[U])!=0)return b;return 0}function n(T){var b=1,U;return(U=T>>>16)!=0&&(T=U,b+=16),(U=T>>8)!=0&&(T=U,b+=8),(U=T>>4)!=0&&(T=U,b+=4),(U=T>>2)!=0&&(T=U,b+=2),(U=T>>1)!=0&&(T=U,b+=1),b}function r(){return this.t<=0?0:this.DB*(this.t-1)+n(this.data[this.t-1]^this.s&this.DM)}function B(T,b){var U;for(U=this.t-1;U>=0;--U)b.data[U+T]=this.data[U];for(U=T-1;U>=0;--U)b.data[U]=0;b.t=this.t+T,b.s=this.s}function D(T,b){for(var U=T;U<this.t;++U)b.data[U-T]=this.data[U];b.t=Math.max(this.t-T,0),b.s=this.s}function V(T,b){var U=T%this.DB,F=this.DB-U,Q=(1<<F)-1,X=Math.floor(T/this.DB),re=this.s<<U&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]&Q)<<U;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 L(T,b){b.s=this.s;var U=Math.floor(T/this.DB);if(U>=this.t){b.t=0;return}var F=T%this.DB,Q=this.DB-F,X=(1<<F)-1;b.data[0]=this.data[U]>>F;for(var re=U+1;re<this.t;++re)b.data[re-U-1]|=(this.data[re]&X)<<Q,b.data[re-U]=this.data[re]>>F;F>0&&(b.data[this.t-U-1]|=(this.s&X)<<Q),b.t=this.t-U,b.clamp()}function O(T,b){for(var U=0,F=0,Q=Math.min(T.t,this.t);U<Q;)F+=this.data[U]-T.data[U],b.data[U++]=F&this.DM,F>>=this.DB;if(T.t<this.t){for(F-=T.s;U<this.t;)F+=this.data[U],b.data[U++]=F&this.DM,F>>=this.DB;F+=this.s}else{for(F+=this.s;U<T.t;)F-=T.data[U],b.data[U++]=F&this.DM,F>>=this.DB;F-=T.s}b.s=F<0?-1:0,F<-1?b.data[U++]=this.DV+F:F>0&&(b.data[U++]=F),b.t=U,b.clamp()}function q(T,b){var U=this.abs(),F=T.abs(),Q=U.t;for(b.t=Q+F.t;--Q>=0;)b.data[Q]=0;for(Q=0;Q<F.t;++Q)b.data[Q+U.t]=U.am(0,F.data[Q],b,Q,0,U.t);b.s=0,b.clamp(),this.s!=T.s&&i.ZERO.subTo(b,b)}function M(T){for(var b=this.abs(),U=T.t=2*b.t;--U>=0;)T.data[U]=0;for(U=0;U<b.t-1;++U){var F=b.am(U,b.data[U],T,2*U,0,1);(T.data[U+b.t]+=b.am(U+1,2*b.data[U],T,2*U+1,F,b.t-U-1))>=b.DV&&(T.data[U+b.t]-=b.DV,T.data[U+b.t+1]=1)}T.t>0&&(T.data[T.t-1]+=b.am(U,b.data[U],T,2*U,0,1)),T.s=0,T.clamp()}function H(T,b,U){var F=T.abs();if(!(F.t<=0)){var Q=this.abs();if(Q.t<F.t){b?.fromInt(0),U!=null&&this.copyTo(U);return}U==null&&(U=v());var X=v(),re=this.s,J=T.s,pe=this.DB-n(F.data[F.t-1]);pe>0?(F.lShiftTo(pe,X),Q.lShiftTo(pe,U)):(F.copyTo(X),Q.copyTo(U));var Ke=X.t,Xe=X.data[Ke-1];if(Xe!=0){var ze=Xe*(1<<this.F1)+(Ke>1?X.data[Ke-2]>>this.F2:0),it=this.FV/ze,It=(1<<this.F1)/ze,$e=1<<this.F2,Je=U.t,At=Je-Ke,st=b??v();for(X.dlShiftTo(At,st),U.compareTo(st)>=0&&(U.data[U.t++]=1,U.subTo(st,U)),i.ONE.dlShiftTo(Ke,st),st.subTo(X,X);X.t<Ke;)X.data[X.t++]=0;for(;--At>=0;){var gr=U.data[--Je]==Xe?this.DM:Math.floor(U.data[Je]*it+(U.data[Je-1]+$e)*It);if((U.data[Je]+=X.am(0,gr,U,At,0,Ke))<gr)for(X.dlShiftTo(At,st),U.subTo(st,U);U.data[Je]<--gr;)U.subTo(st,U)}b!=null&&(U.drShiftTo(Ke,b),re!=J&&i.ZERO.subTo(b,b)),U.t=Ke,U.clamp(),pe>0&&U.rShiftTo(pe,U),re<0&&i.ZERO.subTo(U,U)}}}function Y(T){var b=v();return this.abs().divRemTo(T,null,b),this.s<0&&b.compareTo(i.ZERO)>0&&T.subTo(b,b),b}function W(T){this.m=T}function $(T){return T.s<0||T.compareTo(this.m)>=0?T.mod(this.m):T}function ie(T){return T}function se(T){T.divRemTo(this.m,null,T)}function he(T,b,U){T.multiplyTo(b,U),this.reduce(U)}function ge(T,b){T.squareTo(b),this.reduce(b)}W.prototype.convert=$,W.prototype.revert=ie,W.prototype.reduce=se,W.prototype.mulTo=he,W.prototype.sqrTo=ge;function j(){if(this.t<1)return 0;var T=this.data[0];if((T&1)==0)return 0;var b=T&3;return b=b*(2-(T&15)*b)&15,b=b*(2-(T&255)*b)&255,b=b*(2-((T&65535)*b&65535))&65535,b=b*(2-T*b%this.DV)%this.DV,b>0?this.DV-b:-b}function fe(T){this.m=T,this.mp=T.invDigit(),this.mpl=this.mp&32767,this.mph=this.mp>>15,this.um=(1<<T.DB-15)-1,this.mt2=2*T.t}function Z(T){var b=v();return T.abs().dlShiftTo(this.m.t,b),b.divRemTo(this.m,null,b),T.s<0&&b.compareTo(i.ZERO)>0&&this.m.subTo(b,b),b}function qe(T){var b=v();return T.copyTo(b),this.reduce(b),b}function le(T){for(;T.t<=this.mt2;)T.data[T.t++]=0;for(var b=0;b<this.m.t;++b){var U=T.data[b]&32767,F=U*this.mpl+((U*this.mph+(T.data[b]>>15)*this.mpl&this.um)<<15)&T.DM;for(U=b+this.m.t,T.data[U]+=this.m.am(0,F,T,b,0,this.m.t);T.data[U]>=T.DV;)T.data[U]-=T.DV,T.data[++U]++}T.clamp(),T.drShiftTo(this.m.t,T),T.compareTo(this.m)>=0&&T.subTo(this.m,T)}function f(T,b){T.squareTo(b),this.reduce(b)}function w(T,b,U){T.multiplyTo(b,U),this.reduce(U)}fe.prototype.convert=Z,fe.prototype.revert=qe,fe.prototype.reduce=le,fe.prototype.mulTo=w,fe.prototype.sqrTo=f;function N(){return(this.t>0?this.data[0]&1:this.s)==0}function o(T,b){if(T>4294967295||T<1)return i.ONE;var U=v(),F=v(),Q=b.convert(this),X=n(T)-1;for(Q.copyTo(U);--X>=0;)if(b.sqrTo(U,F),(T&1<<X)>0)b.mulTo(F,Q,U);else{var re=U;U=F,F=re}return b.revert(U)}function A(T,b){var U;return T<256||b.isEven()?U=new W(b):U=new fe(b),this.exp(T,U)}i.prototype.copyTo=y,i.prototype.fromInt=m,i.prototype.fromString=s,i.prototype.clamp=d,i.prototype.dlShiftTo=B,i.prototype.drShiftTo=D,i.prototype.lShiftTo=V,i.prototype.rShiftTo=L,i.prototype.subTo=O,i.prototype.multiplyTo=q,i.prototype.squareTo=M,i.prototype.divRemTo=H,i.prototype.invDigit=j,i.prototype.isEven=N,i.prototype.exp=o,i.prototype.toString=p,i.prototype.negate=I,i.prototype.abs=R,i.prototype.compareTo=c,i.prototype.bitLength=r,i.prototype.mod=Y,i.prototype.modPowInt=A,i.ZERO=g(0),i.ONE=g(1);function K(){var T=v();return this.copyTo(T),T}function P(){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 z(){return this.t==0?this.s:this.data[0]<<24>>24}function ee(){return this.t==0?this.s:this.data[0]<<16>>16}function ae(T){return Math.floor(Math.LN2*this.DB/Math.log(T))}function G(){return this.s<0?-1:this.t<=0||this.t==1&&this.data[0]<=0?0:1}function te(T){if(T==null&&(T=10),this.signum()==0||T<2||T>36)return"0";var b=this.chunkSize(T),U=Math.pow(T,b),F=g(U),Q=v(),X=v(),re="";for(this.divRemTo(F,Q,X);Q.signum()>0;)re=(U+X.intValue()).toString(T).substr(1)+re,Q.divRemTo(F,Q,X);return X.intValue().toString(T)+re}function ne(T,b){this.fromInt(0),b==null&&(b=10);for(var U=this.chunkSize(b),F=Math.pow(b,U),Q=!1,X=0,re=0,J=0;J<T.length;++J){var pe=u(T,J);if(pe<0){T.charAt(J)=="-"&&this.signum()==0&&(Q=!0);continue}re=b*re+pe,++X>=U&&(this.dMultiply(F),this.dAddOffset(re,0),X=0,re=0)}X>0&&(this.dMultiply(Math.pow(b,X)),this.dAddOffset(re,0)),Q&&i.ZERO.subTo(this,this)}function ce(T,b,U){if(typeof b=="number")if(T<2)this.fromInt(1);else for(this.fromNumber(T,U),this.testBit(T-1)||this.bitwiseTo(i.ONE.shiftLeft(T-1),Te,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(b);)this.dAddOffset(2,0),this.bitLength()>T&&this.subTo(i.ONE.shiftLeft(T-1),this);else{var F=new Array,Q=T&7;F.length=(T>>3)+1,b.nextBytes(F),Q>0?F[0]&=(1<<Q)-1:F[0]=0,this.fromString(F,256)}}function oe(){var T=this.t,b=new Array;b[0]=this.s;var U=this.DB-T*this.DB%8,F,Q=0;if(T-- >0)for(U<this.DB&&(F=this.data[T]>>U)!=(this.s&this.DM)>>U&&(b[Q++]=F|this.s<<this.DB-U);T>=0;)U<8?(F=(this.data[T]&(1<<U)-1)<<8-U,F|=this.data[--T]>>(U+=this.DB-8)):(F=this.data[T]>>(U-=8)&255,U<=0&&(U+=this.DB,--T)),(F&128)!=0&&(F|=-256),Q==0&&(this.s&128)!=(F&128)&&++Q,(Q>0||F!=this.s)&&(b[Q++]=F);return b}function Ce(T){return this.compareTo(T)==0}function Se(T){return this.compareTo(T)<0?this:T}function xe(T){return this.compareTo(T)>0?this:T}function me(T,b,U){var F,Q,X=Math.min(T.t,this.t);for(F=0;F<X;++F)U.data[F]=b(this.data[F],T.data[F]);if(T.t<this.t){for(Q=T.s&this.DM,F=X;F<this.t;++F)U.data[F]=b(this.data[F],Q);U.t=this.t}else{for(Q=this.s&this.DM,F=X;F<T.t;++F)U.data[F]=b(Q,T.data[F]);U.t=T.t}U.s=b(this.s,T.s),U.clamp()}function ve(T,b){return T&b}function ye(T){var b=v();return this.bitwiseTo(T,ve,b),b}function Te(T,b){return T|b}function Fe(T){var b=v();return this.bitwiseTo(T,Te,b),b}function Me(T,b){return T^b}function He(T){var b=v();return this.bitwiseTo(T,Me,b),b}function Ge(T,b){return T&~b}function Qe(T){var b=v();return this.bitwiseTo(T,Ge,b),b}function Ye(){for(var T=v(),b=0;b<this.t;++b)T.data[b]=this.DM&~this.data[b];return T.t=this.t,T.s=~this.s,T}function je(T){var b=v();return T<0?this.rShiftTo(-T,b):this.lShiftTo(T,b),b}function tt(T){var b=v();return T<0?this.lShiftTo(-T,b):this.rShiftTo(T,b),b}function at(T){if(T==0)return-1;var b=0;return(T&65535)==0&&(T>>=16,b+=16),(T&255)==0&&(T>>=8,b+=8),(T&15)==0&&(T>>=4,b+=4),(T&3)==0&&(T>>=2,b+=2),(T&1)==0&&++b,b}function nt(){for(var T=0;T<this.t;++T)if(this.data[T]!=0)return T*this.DB+at(this.data[T]);return this.s<0?this.t*this.DB:-1}function ft(T){for(var b=0;T!=0;)T&=T-1,++b;return b}function ht(){for(var T=0,b=this.s&this.DM,U=0;U<this.t;++U)T+=ft(this.data[U]^b);return T}function yt(T){var b=Math.floor(T/this.DB);return b>=this.t?this.s!=0:(this.data[b]&1<<T%this.DB)!=0}function Tt(T,b){var U=i.ONE.shiftLeft(T);return this.bitwiseTo(U,b,U),U}function Ae(T){return this.changeBit(T,Te)}function Be(T){return this.changeBit(T,Ge)}function be(T){return this.changeBit(T,Me)}function _e(T,b){for(var U=0,F=0,Q=Math.min(T.t,this.t);U<Q;)F+=this.data[U]+T.data[U],b.data[U++]=F&this.DM,F>>=this.DB;if(T.t<this.t){for(F+=T.s;U<this.t;)F+=this.data[U],b.data[U++]=F&this.DM,F>>=this.DB;F+=this.s}else{for(F+=this.s;U<T.t;)F+=T.data[U],b.data[U++]=F&this.DM,F>>=this.DB;F+=T.s}b.s=F<0?-1:0,F>0?b.data[U++]=F:F<-1&&(b.data[U++]=this.DV+F),b.t=U,b.clamp()}function Ne(T){var b=v();return this.addTo(T,b),b}function Re(T){var b=v();return this.subTo(T,b),b}function we(T){var b=v();return this.multiplyTo(T,b),b}function Le(T){var b=v();return this.divRemTo(T,b,null),b}function De(T){var b=v();return this.divRemTo(T,null,b),b}function ke(T){var b=v(),U=v();return this.divRemTo(T,b,U),new Array(b,U)}function Ue(T){this.data[this.t]=this.am(0,T-1,this,0,0,this.t),++this.t,this.clamp()}function Pe(T,b){if(T!=0){for(;this.t<=b;)this.data[this.t++]=0;for(this.data[b]+=T;this.data[b]>=this.DV;)this.data[b]-=this.DV,++b>=this.t&&(this.data[this.t++]=0),++this.data[b]}}function Ee(){}function Ie(T){return T}function Ve(T,b,U){T.multiplyTo(b,U)}function Oe(T,b){T.squareTo(b)}Ee.prototype.convert=Ie,Ee.prototype.revert=Ie,Ee.prototype.mulTo=Ve,Ee.prototype.sqrTo=Oe;function Ka(T){return this.exp(T,new Ee)}function Fa(T,b,U){var F=Math.min(this.t+T.t,b);for(U.s=0,U.t=F;F>0;)U.data[--F]=0;var Q;for(Q=U.t-this.t;F<Q;++F)U.data[F+this.t]=this.am(0,T.data[F],U,F,0,this.t);for(Q=Math.min(T.t,b);F<Q;++F)this.am(0,T.data[F],U,F,0,b-F);U.clamp()}function Ma(T,b,U){--b;var F=U.t=this.t+T.t-b;for(U.s=0;--F>=0;)U.data[F]=0;for(F=Math.max(b-this.t,0);F<T.t;++F)U.data[this.t+F-b]=this.am(b-F,T.data[F],U,0,0,this.t+F-b);U.clamp(),U.drShiftTo(1,U)}function dt(T){this.r2=v(),this.q3=v(),i.ONE.dlShiftTo(2*T.t,this.r2),this.mu=this.r2.divide(T),this.m=T}function qa(T){if(T.s<0||T.t>2*this.m.t)return T.mod(this.m);if(T.compareTo(this.m)<0)return T;var b=v();return T.copyTo(b),this.reduce(b),b}function Ha(T){return T}function Ga(T){for(T.drShiftTo(this.m.t-1,this.r2),T.t>this.m.t+1&&(T.t=this.m.t+1,T.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);T.compareTo(this.r2)<0;)T.dAddOffset(1,this.m.t+1);for(T.subTo(this.r2,T);T.compareTo(this.m)>=0;)T.subTo(this.m,T)}function Qa(T,b){T.squareTo(b),this.reduce(b)}function za(T,b,U){T.multiplyTo(b,U),this.reduce(U)}dt.prototype.convert=qa,dt.prototype.revert=Ha,dt.prototype.reduce=Ga,dt.prototype.mulTo=za,dt.prototype.sqrTo=Qa;function Ya(T,b){var U=T.bitLength(),F,Q=g(1),X;if(U<=0)return Q;U<18?F=1:U<48?F=3:U<144?F=4:U<768?F=5:F=6,U<8?X=new W(b):b.isEven()?X=new dt(b):X=new fe(b);var re=new Array,J=3,pe=F-1,Ke=(1<<F)-1;if(re[1]=X.convert(this),F>1){var Xe=v();for(X.sqrTo(re[1],Xe);J<=Ke;)re[J]=v(),X.mulTo(Xe,re[J-2],re[J]),J+=2}var ze=T.t-1,it,It=!0,$e=v(),Je;for(U=n(T.data[ze])-1;ze>=0;){for(U>=pe?it=T.data[ze]>>U-pe&Ke:(it=(T.data[ze]&(1<<U+1)-1)<<pe-U,ze>0&&(it|=T.data[ze-1]>>this.DB+U-pe)),J=F;(it&1)==0;)it>>=1,--J;if((U-=J)<0&&(U+=this.DB,--ze),It)re[it].copyTo(Q),It=!1;else{for(;J>1;)X.sqrTo(Q,$e),X.sqrTo($e,Q),J-=2;J>0?X.sqrTo(Q,$e):(Je=Q,Q=$e,$e=Je),X.mulTo($e,re[it],Q)}for(;ze>=0&&(T.data[ze]&1<<U)==0;)X.sqrTo(Q,$e),Je=Q,Q=$e,$e=Je,--U<0&&(U=this.DB-1,--ze)}return X.revert(Q)}function Xa(T){var b=this.s<0?this.negate():this.clone(),U=T.s<0?T.negate():T.clone();if(b.compareTo(U)<0){var F=b;b=U,U=F}var Q=b.getLowestSetBit(),X=U.getLowestSetBit();if(X<0)return b;for(Q<X&&(X=Q),X>0&&(b.rShiftTo(X,b),U.rShiftTo(X,U));b.signum()>0;)(Q=b.getLowestSetBit())>0&&b.rShiftTo(Q,b),(Q=U.getLowestSetBit())>0&&U.rShiftTo(Q,U),b.compareTo(U)>=0?(b.subTo(U,b),b.rShiftTo(1,b)):(U.subTo(b,U),U.rShiftTo(1,U));return X>0&&U.lShiftTo(X,U),U}function Wa(T){if(T<=0)return 0;var b=this.DV%T,U=this.s<0?T-1:0;if(this.t>0)if(b==0)U=this.data[0]%T;else for(var F=this.t-1;F>=0;--F)U=(b*U+this.data[F])%T;return U}function ja(T){var b=T.isEven();if(this.isEven()&&b||T.signum()==0)return i.ZERO;for(var U=T.clone(),F=this.clone(),Q=g(1),X=g(0),re=g(0),J=g(1);U.signum()!=0;){for(;U.isEven();)U.rShiftTo(1,U),b?((!Q.isEven()||!X.isEven())&&(Q.addTo(this,Q),X.subTo(T,X)),Q.rShiftTo(1,Q)):X.isEven()||X.subTo(T,X),X.rShiftTo(1,X);for(;F.isEven();)F.rShiftTo(1,F),b?((!re.isEven()||!J.isEven())&&(re.addTo(this,re),J.subTo(T,J)),re.rShiftTo(1,re)):J.isEven()||J.subTo(T,J),J.rShiftTo(1,J);U.compareTo(F)>=0?(U.subTo(F,U),b&&Q.subTo(re,Q),X.subTo(J,X)):(F.subTo(U,F),b&&re.subTo(Q,re),J.subTo(X,J))}if(F.compareTo(i.ONE)!=0)return i.ZERO;if(J.compareTo(T)>=0)return J.subtract(T);if(J.signum()<0)J.addTo(T,J);else return J;return J.signum()<0?J.add(T):J}var Ze=[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],Za=(1<<26)/Ze[Ze.length-1];function $a(T){var b,U=this.abs();if(U.t==1&&U.data[0]<=Ze[Ze.length-1]){for(b=0;b<Ze.length;++b)if(U.data[0]==Ze[b])return!0;return!1}if(U.isEven())return!1;for(b=1;b<Ze.length;){for(var F=Ze[b],Q=b+1;Q<Ze.length&&F<Za;)F*=Ze[Q++];for(F=U.modInt(F);b<Q;)if(F%Ze[b++]==0)return!1}return U.millerRabin(T)}function Ja(T){var b=this.subtract(i.ONE),U=b.getLowestSetBit();if(U<=0)return!1;for(var F=b.shiftRight(U),Q=ei(),X,re=0;re<T;++re){do X=new i(this.bitLength(),Q);while(X.compareTo(i.ONE)<=0||X.compareTo(b)>=0);var J=X.modPow(F,this);if(J.compareTo(i.ONE)!=0&&J.compareTo(b)!=0){for(var pe=1;pe++<U&&J.compareTo(b)!=0;)if(J=J.modPowInt(2,this),J.compareTo(i.ONE)==0)return!1;if(J.compareTo(b)!=0)return!1}}return!0}function ei(){return{nextBytes:function(T){for(var b=0;b<T.length;++b)T[b]=Math.floor(Math.random()*256)}}}return i.prototype.chunkSize=ae,i.prototype.toRadix=te,i.prototype.fromRadix=ne,i.prototype.fromNumber=ce,i.prototype.bitwiseTo=me,i.prototype.changeBit=Tt,i.prototype.addTo=_e,i.prototype.dMultiply=Ue,i.prototype.dAddOffset=Pe,i.prototype.multiplyLowerTo=Fa,i.prototype.multiplyUpperTo=Ma,i.prototype.modInt=Wa,i.prototype.millerRabin=Ja,i.prototype.clone=K,i.prototype.intValue=P,i.prototype.byteValue=z,i.prototype.shortValue=ee,i.prototype.signum=G,i.prototype.toByteArray=oe,i.prototype.equals=Ce,i.prototype.min=Se,i.prototype.max=xe,i.prototype.and=ye,i.prototype.or=Fe,i.prototype.xor=He,i.prototype.andNot=Qe,i.prototype.not=Ye,i.prototype.shiftLeft=je,i.prototype.shiftRight=tt,i.prototype.getLowestSetBit=nt,i.prototype.bitCount=ht,i.prototype.testBit=yt,i.prototype.setBit=Ae,i.prototype.clearBit=Be,i.prototype.flipBit=be,i.prototype.add=Ne,i.prototype.subtract=Re,i.prototype.multiply=we,i.prototype.divide=Le,i.prototype.remainder=De,i.prototype.divideAndRemainder=ke,i.prototype.modPow=Ya,i.prototype.modInverse=ja,i.prototype.pow=Ka,i.prototype.gcd=Xa,i.prototype.isProbablePrime=$a,Wt}var jt={exports:{}},Zt={exports:{}},Mr;function vt(){if(Mr)return Zt.exports;Mr=1;var a=ue();rt(),de();var e=Zt.exports=a.sha1=a.sha1||{};a.md.sha1=a.md.algorithms.sha1=e,e.create=function(){v||_();var h=null,t=a.util.createBuffer(),C=new Array(80),l={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8};return l.start=function(){l.messageLength=0,l.fullMessageLength=l.messageLength64=[];for(var x=l.messageLengthSize/4,k=0;k<x;++k)l.fullMessageLength.push(0);return t=a.util.createBuffer(),h={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},l},l.start(),l.update=function(x,k){k==="utf8"&&(x=a.util.encodeUtf8(x));var E=x.length;l.messageLength+=E,E=[E/4294967296>>>0,E>>>0];for(var u=l.fullMessageLength.length-1;u>=0;--u)l.fullMessageLength[u]+=E[1],E[1]=E[0]+(l.fullMessageLength[u]/4294967296>>>0),l.fullMessageLength[u]=l.fullMessageLength[u]>>>0,E[0]=E[1]/4294967296>>>0;return t.putBytes(x),S(h,C,t),(t.read>2048||t.length()===0)&&t.compact(),l},l.digest=function(){var x=a.util.createBuffer();x.putBytes(t.bytes());var k=l.fullMessageLength[l.fullMessageLength.length-1]+l.messageLengthSize,E=k&l.blockLength-1;x.putBytes(i.substr(0,l.blockLength-E));for(var u,y,m=l.fullMessageLength[0]*8,g=0;g<l.fullMessageLength.length-1;++g)u=l.fullMessageLength[g+1]*8,y=u/4294967296>>>0,m+=y,x.putInt32(m>>>0),m=u>>>0;x.putInt32(m);var s={h0:h.h0,h1:h.h1,h2:h.h2,h3:h.h3,h4:h.h4};S(s,C,x);var d=a.util.createBuffer();return d.putInt32(s.h0),d.putInt32(s.h1),d.putInt32(s.h2),d.putInt32(s.h3),d.putInt32(s.h4),d},l};var i=null,v=!1;function _(){i="€",i+=a.util.fillString("\0",64),v=!0}function S(h,t,C){for(var l,x,k,E,u,y,m,g,s=C.length();s>=64;){for(x=h.h0,k=h.h1,E=h.h2,u=h.h3,y=h.h4,g=0;g<16;++g)l=C.getInt32(),t[g]=l,m=u^k&(E^u),l=(x<<5|x>>>27)+m+y+1518500249+l,y=u,u=E,E=(k<<30|k>>>2)>>>0,k=x,x=l;for(;g<20;++g)l=t[g-3]^t[g-8]^t[g-14]^t[g-16],l=l<<1|l>>>31,t[g]=l,m=u^k&(E^u),l=(x<<5|x>>>27)+m+y+1518500249+l,y=u,u=E,E=(k<<30|k>>>2)>>>0,k=x,x=l;for(;g<32;++g)l=t[g-3]^t[g-8]^t[g-14]^t[g-16],l=l<<1|l>>>31,t[g]=l,m=k^E^u,l=(x<<5|x>>>27)+m+y+1859775393+l,y=u,u=E,E=(k<<30|k>>>2)>>>0,k=x,x=l;for(;g<40;++g)l=t[g-6]^t[g-16]^t[g-28]^t[g-32],l=l<<2|l>>>30,t[g]=l,m=k^E^u,l=(x<<5|x>>>27)+m+y+1859775393+l,y=u,u=E,E=(k<<30|k>>>2)>>>0,k=x,x=l;for(;g<60;++g)l=t[g-6]^t[g-16]^t[g-28]^t[g-32],l=l<<2|l>>>30,t[g]=l,m=k&E|u&(k^E),l=(x<<5|x>>>27)+m+y+2400959708+l,y=u,u=E,E=(k<<30|k>>>2)>>>0,k=x,x=l;for(;g<80;++g)l=t[g-6]^t[g-16]^t[g-28]^t[g-32],l=l<<2|l>>>30,t[g]=l,m=k^E^u,l=(x<<5|x>>>27)+m+y+3395469782+l,y=u,u=E,E=(k<<30|k>>>2)>>>0,k=x,x=l;h.h0=h.h0+x|0,h.h1=h.h1+k|0,h.h2=h.h2+E|0,h.h3=h.h3+u|0,h.h4=h.h4+y|0,s-=64}}return Zt.exports}var qr;function Hr(){if(qr)return jt.exports;qr=1;var a=ue();de(),We(),vt();var e=jt.exports=a.pkcs1=a.pkcs1||{};e.encode_rsa_oaep=function(v,_,S){var h,t,C,l;typeof S=="string"?(h=S,t=arguments[3]||void 0,C=arguments[4]||void 0):S&&(h=S.label||void 0,t=S.seed||void 0,C=S.md||void 0,S.mgf1&&S.mgf1.md&&(l=S.mgf1.md)),C?C.start():C=a.md.sha1.create(),l||(l=C);var x=Math.ceil(v.n.bitLength()/8),k=x-2*C.digestLength-2;if(_.length>k){var E=new Error("RSAES-OAEP input message length is too long.");throw E.length=_.length,E.maxLength=k,E}h||(h=""),C.update(h,"raw");for(var u=C.digest(),y="",m=k-_.length,g=0;g<m;g++)y+="\0";var s=u.getBytes()+y+""+_;if(!t)t=a.random.getBytes(C.digestLength);else if(t.length!==C.digestLength){var E=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.");throw E.seedLength=t.length,E.digestLength=C.digestLength,E}var d=i(t,x-C.digestLength-1,l),p=a.util.xorBytes(s,d,s.length),I=i(p,C.digestLength,l),R=a.util.xorBytes(t,I,t.length);return"\0"+R+p},e.decode_rsa_oaep=function(v,_,S){var h,t,C;typeof S=="string"?(h=S,t=arguments[3]||void 0):S&&(h=S.label||void 0,t=S.md||void 0,S.mgf1&&S.mgf1.md&&(C=S.mgf1.md));var l=Math.ceil(v.n.bitLength()/8);if(_.length!==l){var p=new Error("RSAES-OAEP encoded message length is invalid.");throw p.length=_.length,p.expectedLength=l,p}if(t===void 0?t=a.md.sha1.create():t.start(),C||(C=t),l<2*t.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");h||(h=""),t.update(h,"raw");for(var x=t.digest().getBytes(),k=_.charAt(0),E=_.substring(1,t.digestLength+1),u=_.substring(1+t.digestLength),y=i(u,t.digestLength,C),m=a.util.xorBytes(E,y,E.length),g=i(m,l-t.digestLength-1,C),s=a.util.xorBytes(u,g,u.length),d=s.substring(0,t.digestLength),p=k!=="\0",I=0;I<t.digestLength;++I)p|=x.charAt(I)!==d.charAt(I);for(var R=1,c=t.digestLength,n=t.digestLength;n<s.length;n++){var r=s.charCodeAt(n),B=r&1^1,D=R?65534:0;p|=r&D,R=R&B,c+=R}if(p||s.charCodeAt(c)!==1)throw new Error("Invalid RSAES-OAEP padding.");return s.substring(c+1)};function i(v,_,S){S||(S=a.md.sha1.create());for(var h="",t=Math.ceil(_/S.digestLength),C=0;C<t;++C){var l=String.fromCharCode(C>>24&255,C>>16&255,C>>8&255,C&255);S.start(),S.update(v+l),h+=S.digest().getBytes()}return h.substring(0,_)}return jt.exports}var Et={exports:{}},Gr;function Qr(){if(Gr)return Et.exports;Gr=1;var a=ue();return de(),mt(),We(),(function(){if(a.prime){Et.exports=a.prime;return}var e=Et.exports=a.prime=a.prime||{},i=a.jsbn.BigInteger,v=[6,4,2,4,2,4,6,2],_=new i(null);_.fromInt(30);var S=function(E,u){return E|u};e.generateProbablePrime=function(E,u,y){typeof u=="function"&&(y=u,u={}),u=u||{};var m=u.algorithm||"PRIMEINC";typeof m=="string"&&(m={name:m}),m.options=m.options||{};var g=u.prng||a.random,s={nextBytes:function(d){for(var p=g.getBytesSync(d.length),I=0;I<d.length;++I)d[I]=p.charCodeAt(I)}};if(m.name==="PRIMEINC")return h(E,s,m.options,y);throw new Error("Invalid prime generation algorithm: "+m.name)};function h(E,u,y,m){return"workers"in y?l(E,u,y,m):t(E,u,y,m)}function t(E,u,y,m){var g=x(E,u),s=0,d=k(g.bitLength());"millerRabinTests"in y&&(d=y.millerRabinTests);var p=10;"maxBlockTime"in y&&(p=y.maxBlockTime),C(g,E,u,s,d,p,m)}function C(E,u,y,m,g,s,d){var p=+new Date;do{if(E.bitLength()>u&&(E=x(u,y)),E.isProbablePrime(g))return d(null,E);E.dAddOffset(v[m++%8],0)}while(s<0||+new Date-p<s);a.util.setImmediate(function(){C(E,u,y,m,g,s,d)})}function l(E,u,y,m){if(typeof Worker>"u")return t(E,u,y,m);var g=x(E,u),s=y.workers,d=y.workLoad||100,p=d*30/8,I=y.workerScript||"forge/prime.worker.js";if(s===-1)return a.util.estimateCores(function(c,n){c&&(n=2),s=n-1,R()});R();function R(){s=Math.max(1,s);for(var c=[],n=0;n<s;++n)c[n]=new Worker(I);for(var n=0;n<s;++n)c[n].addEventListener("message",B);var r=!1;function B(D){if(!r){var V=D.data;if(V.found){for(var L=0;L<c.length;++L)c[L].terminate();return r=!0,m(null,new i(V.prime,16))}g.bitLength()>E&&(g=x(E,u));var O=g.toString(16);D.target.postMessage({hex:O,workLoad:d}),g.dAddOffset(p,0)}}}}function x(E,u){var y=new i(E,u),m=E-1;return y.testBit(m)||y.bitwiseTo(i.ONE.shiftLeft(m),S,y),y.dAddOffset(31-y.mod(_).byteValue(),0),y}function k(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}})(),Et.exports}var $t,zr;function xt(){if(zr)return $t;zr=1;var a=ue();if(et(),mt(),ut(),Hr(),Qr(),We(),de(),typeof e>"u")var e=a.jsbn.BigInteger;var i=a.util.isNodejs?Ht:null,v=a.asn1,_=a.util;a.pki=a.pki||{},$t=a.pki.rsa=a.rsa=a.rsa||{};var S=a.pki,h=[6,4,2,4,2,4,6,2],t={name:"PrivateKeyInfo",tagClass:v.Class.UNIVERSAL,type:v.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:v.Class.UNIVERSAL,type:v.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:v.Class.UNIVERSAL,type:v.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:v.Class.UNIVERSAL,type:v.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:v.Class.UNIVERSAL,type:v.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},C={name:"RSAPrivateKey",tagClass:v.Class.UNIVERSAL,type:v.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:v.Class.UNIVERSAL,type:v.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:v.Class.UNIVERSAL,type:v.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:v.Class.UNIVERSAL,type:v.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:v.Class.UNIVERSAL,type:v.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:v.Class.UNIVERSAL,type:v.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:v.Class.UNIVERSAL,type:v.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:v.Class.UNIVERSAL,type:v.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:v.Class.UNIVERSAL,type:v.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:v.Class.UNIVERSAL,type:v.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},l={name:"RSAPublicKey",tagClass:v.Class.UNIVERSAL,type:v.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:v.Class.UNIVERSAL,type:v.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:v.Class.UNIVERSAL,type:v.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},x=a.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:v.Class.UNIVERSAL,type:v.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:v.Class.UNIVERSAL,type:v.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:v.Class.UNIVERSAL,type:v.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:v.Class.UNIVERSAL,type:v.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:v.Class.UNIVERSAL,type:v.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},k={name:"DigestInfo",tagClass:v.Class.UNIVERSAL,type:v.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm",tagClass:v.Class.UNIVERSAL,type:v.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm.algorithmIdentifier",tagClass:v.Class.UNIVERSAL,type:v.Type.OID,constructed:!1,capture:"algorithmIdentifier"},{name:"DigestInfo.DigestAlgorithm.parameters",tagClass:v.Class.UNIVERSAL,type:v.Type.NULL,capture:"parameters",optional:!0,constructed:!1}]},{name:"DigestInfo.digest",tagClass:v.Class.UNIVERSAL,type:v.Type.OCTETSTRING,constructed:!1,capture:"digest"}]},E=function(n){var r;if(n.algorithm in S.oids)r=S.oids[n.algorithm];else{var B=new Error("Unknown message digest algorithm.");throw B.algorithm=n.algorithm,B}var D=v.oidToDer(r).getBytes(),V=v.create(v.Class.UNIVERSAL,v.Type.SEQUENCE,!0,[]),L=v.create(v.Class.UNIVERSAL,v.Type.SEQUENCE,!0,[]);L.value.push(v.create(v.Class.UNIVERSAL,v.Type.OID,!1,D)),L.value.push(v.create(v.Class.UNIVERSAL,v.Type.NULL,!1,""));var O=v.create(v.Class.UNIVERSAL,v.Type.OCTETSTRING,!1,n.digest().getBytes());return V.value.push(L),V.value.push(O),v.toDer(V).getBytes()},u=function(n,r,B){if(B)return n.modPow(r.e,r.n);if(!r.p||!r.q)return n.modPow(r.d,r.n);r.dP||(r.dP=r.d.mod(r.p.subtract(e.ONE))),r.dQ||(r.dQ=r.d.mod(r.q.subtract(e.ONE))),r.qInv||(r.qInv=r.q.modInverse(r.p));var D;do D=new e(a.util.bytesToHex(a.random.getBytes(r.n.bitLength()/8)),16);while(D.compareTo(r.n)>=0||!D.gcd(r.n).equals(e.ONE));n=n.multiply(D.modPow(r.e,r.n)).mod(r.n);for(var V=n.mod(r.p).modPow(r.dP,r.p),L=n.mod(r.q).modPow(r.dQ,r.q);V.compareTo(L)<0;)V=V.add(r.p);var O=V.subtract(L).multiply(r.qInv).mod(r.p).multiply(r.q).add(L);return O=O.multiply(D.modInverse(r.n)).mod(r.n),O};S.rsa.encrypt=function(n,r,B){var D=B,V,L=Math.ceil(r.n.bitLength()/8);B!==!1&&B!==!0?(D=B===2,V=y(n,r,B)):(V=a.util.createBuffer(),V.putBytes(n));for(var O=new e(V.toHex(),16),q=u(O,r,D),M=q.toString(16),H=a.util.createBuffer(),Y=L-Math.ceil(M.length/2);Y>0;)H.putByte(0),--Y;return H.putBytes(a.util.hexToBytes(M)),H.getBytes()},S.rsa.decrypt=function(n,r,B,D){var V=Math.ceil(r.n.bitLength()/8);if(n.length!==V){var L=new Error("Encrypted message length is invalid.");throw L.length=n.length,L.expected=V,L}var O=new e(a.util.createBuffer(n).toHex(),16);if(O.compareTo(r.n)>=0)throw new Error("Encrypted message is invalid.");for(var q=u(O,r,B),M=q.toString(16),H=a.util.createBuffer(),Y=V-Math.ceil(M.length/2);Y>0;)H.putByte(0),--Y;return H.putBytes(a.util.hexToBytes(M)),D!==!1?m(H.getBytes(),r,B):H.getBytes()},S.rsa.createKeyPairGenerationState=function(n,r,B){typeof n=="string"&&(n=parseInt(n,10)),n=n||2048,B=B||{};var D=B.prng||a.random,V={nextBytes:function(q){for(var M=D.getBytesSync(q.length),H=0;H<q.length;++H)q[H]=M.charCodeAt(H)}},L=B.algorithm||"PRIMEINC",O;if(L==="PRIMEINC")O={algorithm:L,state:0,bits:n,rng:V,eInt:r||65537,e:new e(null),p:null,q:null,qBits:n>>1,pBits:n-(n>>1),pqState:0,num:null,keys:null},O.e.fromInt(O.eInt);else throw new Error("Invalid key generation algorithm: "+L);return O},S.rsa.stepKeyPairGenerationState=function(n,r){"algorithm"in n||(n.algorithm="PRIMEINC");var B=new e(null);B.fromInt(30);for(var D=0,V=function(W,$){return W|$},L=+new Date,O,q=0;n.keys===null&&(r<=0||q<r);){if(n.state===0){var M=n.p===null?n.pBits:n.qBits,H=M-1;n.pqState===0?(n.num=new e(M,n.rng),n.num.testBit(H)||n.num.bitwiseTo(e.ONE.shiftLeft(H),V,n.num),n.num.dAddOffset(31-n.num.mod(B).byteValue(),0),D=0,++n.pqState):n.pqState===1?n.num.bitLength()>M?n.pqState=0:n.num.isProbablePrime(d(n.num.bitLength()))?++n.pqState:n.num.dAddOffset(h[D++%8],0):n.pqState===2?n.pqState=n.num.subtract(e.ONE).gcd(n.e).compareTo(e.ONE)===0?3:0:n.pqState===3&&(n.pqState=0,n.p===null?n.p=n.num:n.q=n.num,n.p!==null&&n.q!==null&&++n.state,n.num=null)}else if(n.state===1)n.p.compareTo(n.q)<0&&(n.num=n.p,n.p=n.q,n.q=n.num),++n.state;else if(n.state===2)n.p1=n.p.subtract(e.ONE),n.q1=n.q.subtract(e.ONE),n.phi=n.p1.multiply(n.q1),++n.state;else if(n.state===3)n.phi.gcd(n.e).compareTo(e.ONE)===0?++n.state:(n.p=null,n.q=null,n.state=0);else if(n.state===4)n.n=n.p.multiply(n.q),n.n.bitLength()===n.bits?++n.state:(n.q=null,n.state=0);else if(n.state===5){var Y=n.e.modInverse(n.phi);n.keys={privateKey:S.rsa.setPrivateKey(n.n,n.e,Y,n.p,n.q,Y.mod(n.p1),Y.mod(n.q1),n.q.modInverse(n.p)),publicKey:S.rsa.setPublicKey(n.n,n.e)}}O=+new Date,q+=O-L,L=O}return n.keys!==null},S.rsa.generateKeyPair=function(n,r,B,D){if(arguments.length===1?typeof n=="object"?(B=n,n=void 0):typeof n=="function"&&(D=n,n=void 0):arguments.length===2?typeof n=="number"?typeof r=="function"?(D=r,r=void 0):typeof r!="number"&&(B=r,r=void 0):(B=n,D=r,n=void 0,r=void 0):arguments.length===3&&(typeof r=="number"?typeof B=="function"&&(D=B,B=void 0):(D=B,B=r,r=void 0)),B=B||{},n===void 0&&(n=B.bits||2048),r===void 0&&(r=B.e||65537),!a.options.usePureJavaScript&&!B.prng&&n>=256&&n<=16384&&(r===65537||r===3)){if(D){if(p("generateKeyPair"))return i.generateKeyPair("rsa",{modulusLength:n,publicExponent:r,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(q,M,H){if(q)return D(q);D(null,{privateKey:S.privateKeyFromPem(H),publicKey:S.publicKeyFromPem(M)})});if(I("generateKey")&&I("exportKey"))return _.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:n,publicExponent:c(r),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(q){return _.globalScope.crypto.subtle.exportKey("pkcs8",q.privateKey)}).then(void 0,function(q){D(q)}).then(function(q){if(q){var M=S.privateKeyFromAsn1(v.fromDer(a.util.createBuffer(q)));D(null,{privateKey:M,publicKey:S.setRsaPublicKey(M.n,M.e)})}});if(R("generateKey")&&R("exportKey")){var V=_.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:n,publicExponent:c(r),hash:{name:"SHA-256"}},!0,["sign","verify"]);V.oncomplete=function(q){var M=q.target.result,H=_.globalScope.msCrypto.subtle.exportKey("pkcs8",M.privateKey);H.oncomplete=function(Y){var W=Y.target.result,$=S.privateKeyFromAsn1(v.fromDer(a.util.createBuffer(W)));D(null,{privateKey:$,publicKey:S.setRsaPublicKey($.n,$.e)})},H.onerror=function(Y){D(Y)}},V.onerror=function(q){D(q)};return}}else if(p("generateKeyPairSync")){var L=i.generateKeyPairSync("rsa",{modulusLength:n,publicExponent:r,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:S.privateKeyFromPem(L.privateKey),publicKey:S.publicKeyFromPem(L.publicKey)}}}var O=S.rsa.createKeyPairGenerationState(n,r,B);if(!D)return S.rsa.stepKeyPairGenerationState(O,0),O.keys;g(O,B,D)},S.setRsaPublicKey=S.rsa.setPublicKey=function(n,r){var B={n,e:r};return B.encrypt=function(D,V,L){if(typeof V=="string"?V=V.toUpperCase():V===void 0&&(V="RSAES-PKCS1-V1_5"),V==="RSAES-PKCS1-V1_5")V={encode:function(q,M,H){return y(q,M,2).getBytes()}};else if(V==="RSA-OAEP"||V==="RSAES-OAEP")V={encode:function(q,M){return a.pkcs1.encode_rsa_oaep(M,q,L)}};else if(["RAW","NONE","NULL",null].indexOf(V)!==-1)V={encode:function(q){return q}};else if(typeof V=="string")throw new Error('Unsupported encryption scheme: "'+V+'".');var O=V.encode(D,B,!0);return S.rsa.encrypt(O,B,!0)},B.verify=function(D,V,L,O){typeof L=="string"?L=L.toUpperCase():L===void 0&&(L="RSASSA-PKCS1-V1_5"),O===void 0&&(O={_parseAllDigestBytes:!0}),"_parseAllDigestBytes"in O||(O._parseAllDigestBytes=!0),L==="RSASSA-PKCS1-V1_5"?L={verify:function(M,H){H=m(H,B,!0);var Y=v.fromDer(H,{parseAllBytes:O._parseAllDigestBytes}),W={},$=[];if(!v.validate(Y,k,W,$)){var ie=new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.");throw ie.errors=$,ie}var se=v.derToOid(W.algorithmIdentifier);if(!(se===a.oids.md2||se===a.oids.md5||se===a.oids.sha1||se===a.oids.sha224||se===a.oids.sha256||se===a.oids.sha384||se===a.oids.sha512||se===a.oids["sha512-224"]||se===a.oids["sha512-256"])){var ie=new Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.");throw ie.oid=se,ie}if((se===a.oids.md2||se===a.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}}:(L==="NONE"||L==="NULL"||L===null)&&(L={verify:function(M,H){return H=m(H,B,!0),M===H}});var q=S.rsa.decrypt(V,B,!0,!1);return L.verify(D,q,B.n.bitLength())},B},S.setRsaPrivateKey=S.rsa.setPrivateKey=function(n,r,B,D,V,L,O,q){var M={n,e:r,d:B,p:D,q:V,dP:L,dQ:O,qInv:q};return M.decrypt=function(H,Y,W){typeof Y=="string"?Y=Y.toUpperCase():Y===void 0&&(Y="RSAES-PKCS1-V1_5");var $=S.rsa.decrypt(H,M,!1,!1);if(Y==="RSAES-PKCS1-V1_5")Y={decode:m};else if(Y==="RSA-OAEP"||Y==="RSAES-OAEP")Y={decode:function(ie,se){return a.pkcs1.decode_rsa_oaep(se,ie,W)}};else if(["RAW","NONE","NULL",null].indexOf(Y)!==-1)Y={decode:function(ie){return ie}};else throw new Error('Unsupported encryption scheme: "'+Y+'".');return Y.decode($,M,!1)},M.sign=function(H,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 H}},W=1);var $=Y.encode(H,M.n.bitLength());return S.rsa.encrypt($,M,W)},M},S.wrapRsaPrivateKey=function(n){return v.create(v.Class.UNIVERSAL,v.Type.SEQUENCE,!0,[v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,v.integerToDer(0).getBytes()),v.create(v.Class.UNIVERSAL,v.Type.SEQUENCE,!0,[v.create(v.Class.UNIVERSAL,v.Type.OID,!1,v.oidToDer(S.oids.rsaEncryption).getBytes()),v.create(v.Class.UNIVERSAL,v.Type.NULL,!1,"")]),v.create(v.Class.UNIVERSAL,v.Type.OCTETSTRING,!1,v.toDer(n).getBytes())])},S.privateKeyFromAsn1=function(n){var r={},B=[];if(v.validate(n,t,r,B)&&(n=v.fromDer(a.util.createBuffer(r.privateKey))),r={},B=[],!v.validate(n,C,r,B)){var D=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw D.errors=B,D}var V,L,O,q,M,H,Y,W;return V=a.util.createBuffer(r.privateKeyModulus).toHex(),L=a.util.createBuffer(r.privateKeyPublicExponent).toHex(),O=a.util.createBuffer(r.privateKeyPrivateExponent).toHex(),q=a.util.createBuffer(r.privateKeyPrime1).toHex(),M=a.util.createBuffer(r.privateKeyPrime2).toHex(),H=a.util.createBuffer(r.privateKeyExponent1).toHex(),Y=a.util.createBuffer(r.privateKeyExponent2).toHex(),W=a.util.createBuffer(r.privateKeyCoefficient).toHex(),S.setRsaPrivateKey(new e(V,16),new e(L,16),new e(O,16),new e(q,16),new e(M,16),new e(H,16),new e(Y,16),new e(W,16))},S.privateKeyToAsn1=S.privateKeyToRSAPrivateKey=function(n){return v.create(v.Class.UNIVERSAL,v.Type.SEQUENCE,!0,[v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,v.integerToDer(0).getBytes()),v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,s(n.n)),v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,s(n.e)),v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,s(n.d)),v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,s(n.p)),v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,s(n.q)),v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,s(n.dP)),v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,s(n.dQ)),v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,s(n.qInv))])},S.publicKeyFromAsn1=function(n){var r={},B=[];if(v.validate(n,x,r,B)){var D=v.derToOid(r.publicKeyOid);if(D!==S.oids.rsaEncryption){var V=new Error("Cannot read public key. Unknown OID.");throw V.oid=D,V}n=r.rsaPublicKey}if(B=[],!v.validate(n,l,r,B)){var V=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.");throw V.errors=B,V}var L=a.util.createBuffer(r.publicKeyModulus).toHex(),O=a.util.createBuffer(r.publicKeyExponent).toHex();return S.setRsaPublicKey(new e(L,16),new e(O,16))},S.publicKeyToAsn1=S.publicKeyToSubjectPublicKeyInfo=function(n){return v.create(v.Class.UNIVERSAL,v.Type.SEQUENCE,!0,[v.create(v.Class.UNIVERSAL,v.Type.SEQUENCE,!0,[v.create(v.Class.UNIVERSAL,v.Type.OID,!1,v.oidToDer(S.oids.rsaEncryption).getBytes()),v.create(v.Class.UNIVERSAL,v.Type.NULL,!1,"")]),v.create(v.Class.UNIVERSAL,v.Type.BITSTRING,!1,[S.publicKeyToRSAPublicKey(n)])])},S.publicKeyToRSAPublicKey=function(n){return v.create(v.Class.UNIVERSAL,v.Type.SEQUENCE,!0,[v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,s(n.n)),v.create(v.Class.UNIVERSAL,v.Type.INTEGER,!1,s(n.e))])};function y(n,r,B){var D=a.util.createBuffer(),V=Math.ceil(r.n.bitLength()/8);if(n.length>V-11){var L=new Error("Message is too long for PKCS#1 v1.5 padding.");throw L.length=n.length,L.max=V-11,L}D.putByte(0),D.putByte(B);var O=V-3-n.length,q;if(B===0||B===1){q=B===0?0:255;for(var M=0;M<O;++M)D.putByte(q)}else for(;O>0;){for(var H=0,Y=a.random.getBytes(O),M=0;M<O;++M)q=Y.charCodeAt(M),q===0?++H:D.putByte(q);O=H}return D.putByte(0),D.putBytes(n),D}function m(n,r,B,D){var V=Math.ceil(r.n.bitLength()/8),L=a.util.createBuffer(n),O=L.getByte(),q=L.getByte();if(O!==0||B&&q!==0&&q!==1||!B&&q!=2||B&&q===0&&typeof D>"u")throw new Error("Encryption block is invalid.");var M=0;if(q===0){M=V-3-D;for(var H=0;H<M;++H)if(L.getByte()!==0)throw new Error("Encryption block is invalid.")}else if(q===1)for(M=0;L.length()>1;){if(L.getByte()!==255){--L.read;break}++M}else if(q===2)for(M=0;L.length()>1;){if(L.getByte()===0){--L.read;break}++M}var Y=L.getByte();if(Y!==0||M!==V-3-L.length())throw new Error("Encryption block is invalid.");return L.getBytes()}function g(n,r,B){typeof r=="function"&&(B=r,r={}),r=r||{};var D={algorithm:{name:r.algorithm||"PRIMEINC",options:{workers:r.workers||2,workLoad:r.workLoad||100,workerScript:r.workerScript}}};"prng"in r&&(D.prng=r.prng),V();function V(){L(n.pBits,function(q,M){if(q)return B(q);if(n.p=M,n.q!==null)return O(q,n.q);L(n.qBits,O)})}function L(q,M){a.prime.generateProbablePrime(q,D,M)}function O(q,M){if(q)return B(q);if(n.q=M,n.p.compareTo(n.q)<0){var H=n.p;n.p=n.q,n.q=H}if(n.p.subtract(e.ONE).gcd(n.e).compareTo(e.ONE)!==0){n.p=null,V();return}if(n.q.subtract(e.ONE).gcd(n.e).compareTo(e.ONE)!==0){n.q=null,L(n.qBits,O);return}if(n.p1=n.p.subtract(e.ONE),n.q1=n.q.subtract(e.ONE),n.phi=n.p1.multiply(n.q1),n.phi.gcd(n.e).compareTo(e.ONE)!==0){n.p=n.q=null,V();return}if(n.n=n.p.multiply(n.q),n.n.bitLength()!==n.bits){n.q=null,L(n.qBits,O);return}var Y=n.e.modInverse(n.phi);n.keys={privateKey:S.rsa.setPrivateKey(n.n,n.e,Y,n.p,n.q,Y.mod(n.p1),Y.mod(n.q1),n.q.modInverse(n.p)),publicKey:S.rsa.setPublicKey(n.n,n.e)},B(null,n.keys)}}function s(n){var r=n.toString(16);r[0]>="8"&&(r="00"+r);var B=a.util.hexToBytes(r);return B.length>1&&(B.charCodeAt(0)===0&&(B.charCodeAt(1)&128)===0||B.charCodeAt(0)===255&&(B.charCodeAt(1)&128)===128)?B.substr(1):B}function d(n){return n<=100?27:n<=150?18:n<=200?15:n<=250?12:n<=300?9:n<=350?8:n<=400?7:n<=500?6:n<=600?5:n<=800?4:n<=1250?3:2}function p(n){return a.util.isNodejs&&typeof i[n]=="function"}function I(n){return typeof _.globalScope<"u"&&typeof _.globalScope.crypto=="object"&&typeof _.globalScope.crypto.subtle=="object"&&typeof _.globalScope.crypto.subtle[n]=="function"}function R(n){return typeof _.globalScope<"u"&&typeof _.globalScope.msCrypto=="object"&&typeof _.globalScope.msCrypto.subtle=="object"&&typeof _.globalScope.msCrypto.subtle[n]=="function"}function c(n){for(var r=a.util.hexToBytes(n.toString(16)),B=new Uint8Array(r.length),D=0;D<r.length;++D)B[D]=r.charCodeAt(D);return B}return $t}var Jt,Yr;function Xr(){if(Yr)return Jt;Yr=1;var a=ue();if(ot(),et(),gt(),rt(),ut(),Qt(),lt(),We(),Kr(),xt(),de(),typeof e>"u")var e=a.jsbn.BigInteger;var i=a.asn1,v=a.pki=a.pki||{};Jt=v.pbe=a.pbe=a.pbe||{};var _=v.oids,S={name:"EncryptedPrivateKeyInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},h={name:"PBES2Algorithms",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},t={name:"pkcs-12PbeParams",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"iterations"}]};v.encryptPrivateKeyInfo=function(E,u,y){y=y||{},y.saltSize=y.saltSize||8,y.count=y.count||2048,y.algorithm=y.algorithm||"aes128",y.prfAlgorithm=y.prfAlgorithm||"sha1";var m=a.random.getBytesSync(y.saltSize),g=y.count,s=i.integerToDer(g),d,p,I;if(y.algorithm.indexOf("aes")===0||y.algorithm==="des"){var R,c,n;switch(y.algorithm){case"aes128":d=16,R=16,c=_["aes128-CBC"],n=a.aes.createEncryptionCipher;break;case"aes192":d=24,R=16,c=_["aes192-CBC"],n=a.aes.createEncryptionCipher;break;case"aes256":d=32,R=16,c=_["aes256-CBC"],n=a.aes.createEncryptionCipher;break;case"des":d=8,R=8,c=_.desCBC,n=a.des.createEncryptionCipher;break;default:var r=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw r.algorithm=y.algorithm,r}var B="hmacWith"+y.prfAlgorithm.toUpperCase(),D=x(B),V=a.pkcs5.pbkdf2(u,m,g,d,D),L=a.random.getBytesSync(R),O=n(V);O.start(L),O.update(i.toDer(E)),O.finish(),I=O.output.getBytes();var q=k(m,s,d,B);p=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(_.pkcs5PBES2).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(_.pkcs5PBKDF2).getBytes()),q]),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(c).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,L)])])])}else if(y.algorithm==="3des"){d=24;var M=new a.util.ByteBuffer(m),V=v.pbe.generatePkcs12Key(u,M,1,g,d),L=v.pbe.generatePkcs12Key(u,M,2,g,d),O=a.des.createEncryptionCipher(V);O.start(L),O.update(i.toDer(E)),O.finish(),I=O.output.getBytes(),p=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(_["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,m),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,s.getBytes())])])}else{var r=new Error("Cannot encrypt private key. Unknown encryption algorithm.");throw r.algorithm=y.algorithm,r}var H=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[p,i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,I)]);return H},v.decryptPrivateKeyInfo=function(E,u){var y=null,m={},g=[];if(!i.validate(E,S,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 d=i.derToOid(m.encryptionOid),p=v.pbe.getCipher(d,m.encryptionParams,u),I=a.util.createBuffer(m.encryptedData);return p.update(I),p.finish()&&(y=i.fromDer(p.output)),y},v.encryptedPrivateKeyToPem=function(E,u){var y={type:"ENCRYPTED PRIVATE KEY",body:i.toDer(E).getBytes()};return a.pem.encode(y,{maxline:u})},v.encryptedPrivateKeyFromPem=function(E){var u=a.pem.decode(E)[0];if(u.type!=="ENCRYPTED PRIVATE KEY"){var y=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw y.headerType=u.type,y}if(u.procType&&u.procType.type==="ENCRYPTED")throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return i.fromDer(u.body)},v.encryptRsaPrivateKey=function(E,u,y){if(y=y||{},!y.legacy){var m=v.wrapRsaPrivateKey(v.privateKeyToAsn1(E));return m=v.encryptPrivateKeyInfo(m,u,y),v.encryptedPrivateKeyToPem(m)}var g,s,d,p;switch(y.algorithm){case"aes128":g="AES-128-CBC",d=16,s=a.random.getBytesSync(16),p=a.aes.createEncryptionCipher;break;case"aes192":g="AES-192-CBC",d=24,s=a.random.getBytesSync(16),p=a.aes.createEncryptionCipher;break;case"aes256":g="AES-256-CBC",d=32,s=a.random.getBytesSync(16),p=a.aes.createEncryptionCipher;break;case"3des":g="DES-EDE3-CBC",d=24,s=a.random.getBytesSync(8),p=a.des.createEncryptionCipher;break;case"des":g="DES-CBC",d=8,s=a.random.getBytesSync(8),p=a.des.createEncryptionCipher;break;default:var I=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+y.algorithm+'".');throw I.algorithm=y.algorithm,I}var R=a.pbe.opensslDeriveBytes(u,s.substr(0,8),d),c=p(R);c.start(s),c.update(i.toDer(v.privateKeyToAsn1(E))),c.finish();var n={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:g,parameters:a.util.bytesToHex(s).toUpperCase()},body:c.output.getBytes()};return a.pem.encode(n)},v.decryptRsaPrivateKey=function(E,u){var y=null,m=a.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,d;switch(m.dekInfo.algorithm){case"DES-CBC":s=8,d=a.des.createDecryptionCipher;break;case"DES-EDE3-CBC":s=24,d=a.des.createDecryptionCipher;break;case"AES-128-CBC":s=16,d=a.aes.createDecryptionCipher;break;case"AES-192-CBC":s=24,d=a.aes.createDecryptionCipher;break;case"AES-256-CBC":s=32,d=a.aes.createDecryptionCipher;break;case"RC2-40-CBC":s=5,d=function(n){return a.rc2.createDecryptionCipher(n,40)};break;case"RC2-64-CBC":s=8,d=function(n){return a.rc2.createDecryptionCipher(n,64)};break;case"RC2-128-CBC":s=16,d=function(n){return a.rc2.createDecryptionCipher(n,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=a.util.hexToBytes(m.dekInfo.parameters),I=a.pbe.opensslDeriveBytes(u,p.substr(0,8),s),R=d(I);if(R.start(p),R.update(a.util.createBuffer(m.body)),R.finish())y=R.output.getBytes();else return y}else y=m.body;return m.type==="ENCRYPTED PRIVATE KEY"?y=v.decryptPrivateKeyInfo(i.fromDer(y),u):y=i.fromDer(y),y!==null&&(y=v.privateKeyFromAsn1(y)),y},v.pbe.generatePkcs12Key=function(E,u,y,m,g,s){var d,p;if(typeof s>"u"||s===null){if(!("sha1"in a.md))throw new Error('"sha1" hash algorithm unavailable.');s=a.md.sha1.create()}var I=s.digestLength,R=s.blockLength,c=new a.util.ByteBuffer,n=new a.util.ByteBuffer;if(E!=null){for(p=0;p<E.length;p++)n.putInt16(E.charCodeAt(p));n.putInt16(0)}var r=n.length(),B=u.length(),D=new a.util.ByteBuffer;D.fillWithByte(y,R);var V=R*Math.ceil(B/R),L=new a.util.ByteBuffer;for(p=0;p<V;p++)L.putByte(u.at(p%B));var O=R*Math.ceil(r/R),q=new a.util.ByteBuffer;for(p=0;p<O;p++)q.putByte(n.at(p%r));var M=L;M.putBuffer(q);for(var H=Math.ceil(g/I),Y=1;Y<=H;Y++){var W=new a.util.ByteBuffer;W.putBytes(D.bytes()),W.putBytes(M.bytes());for(var $=0;$<m;$++)s.start(),s.update(W.getBytes()),W=s.digest();var ie=new a.util.ByteBuffer;for(p=0;p<R;p++)ie.putByte(W.at(p%I));var se=Math.ceil(B/R)+Math.ceil(r/R),he=new a.util.ByteBuffer;for(d=0;d<se;d++){var ge=new a.util.ByteBuffer(M.getBytes(R)),j=511;for(p=ie.length()-1;p>=0;p--)j=j>>8,j+=ie.at(p)+ge.at(p),ge.setAt(p,j&255);he.putBuffer(ge)}M=he,c.putBuffer(W)}return c.truncate(c.length()-g),c},v.pbe.getCipher=function(E,u,y){switch(E){case v.oids.pkcs5PBES2:return v.pbe.getCipherForPBES2(E,u,y);case v.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case v.oids["pbewithSHAAnd40BitRC2-CBC"]:return v.pbe.getCipherForPKCS12PBE(E,u,y);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}},v.pbe.getCipherForPBES2=function(E,u,y){var m={},g=[];if(!i.validate(u,h,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=i.derToOid(m.kdfOid),E!==v.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=i.derToOid(m.encOid),E!==v.oids["aes128-CBC"]&&E!==v.oids["aes192-CBC"]&&E!==v.oids["aes256-CBC"]&&E!==v.oids["des-EDE3-CBC"]&&E!==v.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 d=m.kdfSalt,p=a.util.createBuffer(m.kdfIterationCount);p=p.getInt(p.length()<<3);var I,R;switch(v.oids[E]){case"aes128-CBC":I=16,R=a.aes.createDecryptionCipher;break;case"aes192-CBC":I=24,R=a.aes.createDecryptionCipher;break;case"aes256-CBC":I=32,R=a.aes.createDecryptionCipher;break;case"des-EDE3-CBC":I=24,R=a.des.createDecryptionCipher;break;case"desCBC":I=8,R=a.des.createDecryptionCipher;break}var c=l(m.prfOid),n=a.pkcs5.pbkdf2(y,d,p,I,c),r=m.encIv,B=R(n);return B.start(r),B},v.pbe.getCipherForPKCS12PBE=function(E,u,y){var m={},g=[];if(!i.validate(u,t,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 d=a.util.createBuffer(m.salt),p=a.util.createBuffer(m.iterations);p=p.getInt(p.length()<<3);var I,R,c;switch(E){case v.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:I=24,R=8,c=a.des.startDecrypting;break;case v.oids["pbewithSHAAnd40BitRC2-CBC"]:I=5,R=8,c=function(V,L){var O=a.rc2.createDecryptionCipher(V,40);return O.start(L,null),O};break;default:var s=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.");throw s.oid=E,s}var n=l(m.prfOid),r=v.pbe.generatePkcs12Key(y,d,1,p,I,n);n.start();var B=v.pbe.generatePkcs12Key(y,d,2,p,R,n);return c(r,B)},v.pbe.opensslDeriveBytes=function(E,u,y,m){if(typeof m>"u"||m===null){if(!("md5"in a.md))throw new Error('"md5" hash algorithm unavailable.');m=a.md.md5.create()}u===null&&(u="");for(var g=[C(m,E+u)],s=16,d=1;s<y;++d,s+=16)g.push(C(m,g[d-1]+E+u));return g.join("").substr(0,y)};function C(E,u){return E.start().update(u).digest().getBytes()}function l(E){var u;if(!E)u="hmacWithSHA1";else if(u=v.oids[i.derToOid(E)],!u){var y=new Error("Unsupported PRF OID.");throw y.oid=E,y.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],y}return x(u)}function x(E){var u=a.md;switch(E){case"hmacWithSHA224":u=a.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":E=E.substr(8).toLowerCase();break;default:var y=new Error("Unsupported PRF algorithm.");throw y.algorithm=E,y.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],y}if(!u||!(E in u))throw new Error("Unknown hash algorithm: "+E);return u[E].create()}function k(E,u,y,m){var g=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,E),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,u.getBytes())]);return m!=="hmacWithSHA1"&&g.value.push(i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,a.util.hexToBytes(y.toString(16))),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(v.oids[m]).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")])),g}return Jt}var er={exports:{}},tr={exports:{}},Wr;function jr(){if(Wr)return tr.exports;Wr=1;var a=ue();et(),de();var e=a.asn1,i=tr.exports=a.pkcs7asn1=a.pkcs7asn1||{};a.pkcs7=a.pkcs7||{},a.pkcs7.asn1=i;var v={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"}]};i.contentInfoValidator=v;var _={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"}]};i.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(_)},i.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(_)};var S={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 i.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"},v,{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:[S]}]},i.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"}]},tr.exports}var rr={exports:{}},ar={exports:{}},Zr;function $r(){if(Zr)return ar.exports;Zr=1;var a=ue();de(),a.mgf=a.mgf||{};var e=ar.exports=a.mgf.mgf1=a.mgf1=a.mgf1||{};return e.create=function(i){var v={generate:function(_,S){for(var h=new a.util.ByteBuffer,t=Math.ceil(S/i.digestLength),C=0;C<t;C++){var l=new a.util.ByteBuffer;l.putInt32(C),i.start(),i.update(_+l.getBytes()),h.putBuffer(i.digest())}return h.truncate(h.length()-S),h.getBytes()}};return v},ar.exports}var ir,Jr;function Ba(){if(Jr)return ir;Jr=1;var a=ue();return $r(),ir=a.mgf=a.mgf||{},a.mgf.mgf1=a.mgf1,ir}var nr={exports:{}},ea;function sr(){if(ea)return nr.exports;ea=1;var a=ue();We(),de();var e=nr.exports=a.pss=a.pss||{};return e.create=function(i){arguments.length===3&&(i={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var v=i.md,_=i.mgf,S=v.digestLength,h=i.salt||null;typeof h=="string"&&(h=a.util.createBuffer(h));var t;if("saltLength"in i)t=i.saltLength;else if(h!==null)t=h.length();else throw new Error("Salt length not specified or specific salt not given.");if(h!==null&&h.length()!==t)throw new Error("Given salt length does not match length of given salt.");var C=i.prng||a.random,l={};return l.encode=function(x,k){var E,u=k-1,y=Math.ceil(u/8),m=x.digest().getBytes();if(y<S+t+2)throw new Error("Message is too long to encrypt.");var g;h===null?g=C.getBytesSync(t):g=h.bytes();var s=new a.util.ByteBuffer;s.fillWithByte(0,8),s.putBytes(m),s.putBytes(g),v.start(),v.update(s.getBytes());var d=v.digest().getBytes(),p=new a.util.ByteBuffer;p.fillWithByte(0,y-t-S-2),p.putByte(1),p.putBytes(g);var I=p.getBytes(),R=y-S-1,c=_.generate(d,R),n="";for(E=0;E<R;E++)n+=String.fromCharCode(I.charCodeAt(E)^c.charCodeAt(E));var r=65280>>8*y-u&255;return n=String.fromCharCode(n.charCodeAt(0)&~r)+n.substr(1),n+d+"¼"},l.verify=function(x,k,E){var u,y=E-1,m=Math.ceil(y/8);if(k=k.substr(-m),m<S+t+2)throw new Error("Inconsistent parameters to PSS signature verification.");if(k.charCodeAt(m-1)!==188)throw new Error("Encoded message does not end in 0xBC.");var g=m-S-1,s=k.substr(0,g),d=k.substr(g,S),p=65280>>8*m-y&255;if((s.charCodeAt(0)&p)!==0)throw new Error("Bits beyond keysize not zero as expected.");var I=_.generate(d,g),R="";for(u=0;u<g;u++)R+=String.fromCharCode(s.charCodeAt(u)^I.charCodeAt(u));R=String.fromCharCode(R.charCodeAt(0)&~p)+R.substr(1);var c=m-S-t-2;for(u=0;u<c;u++)if(R.charCodeAt(u)!==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 n=R.substr(-t),r=new a.util.ByteBuffer;r.fillWithByte(0,8),r.putBytes(x),r.putBytes(n),v.start(),v.update(r.getBytes());var B=v.digest().getBytes();return d===B},l},nr.exports}var ta;function or(){if(ta)return rr.exports;ta=1;var a=ue();ot(),et(),gt(),rt(),Ba(),ut(),lt(),sr(),xt(),de();var e=a.asn1,i=rr.exports=a.pki=a.pki||{},v=i.oids,_={};_.CN=v.commonName,_.commonName="CN",_.C=v.countryName,_.countryName="C",_.L=v.localityName,_.localityName="L",_.ST=v.stateOrProvinceName,_.stateOrProvinceName="ST",_.O=v.organizationName,_.organizationName="O",_.OU=v.organizationalUnitName,_.organizationalUnitName="OU",_.E=v.emailAddress,_.emailAddress="E";var S=a.pki.rsa.publicKeyValidator,h={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"},S,{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"}]},t={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"}]}]},C={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"},S,{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}]}]}]},l={name:"CertificationRequest",tagClass:e.Class.UNIVERSAL,type:e.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[C,{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"}]};i.RDNAttributesAsArray=function(c,n){for(var r=[],B,D,V,L=0;L<c.value.length;++L){B=c.value[L];for(var O=0;O<B.value.length;++O)V={},D=B.value[O],V.type=e.derToOid(D.value[0].value),V.value=D.value[1].value,V.valueTagClass=D.value[1].type,V.type in v&&(V.name=v[V.type],V.name in _&&(V.shortName=_[V.name])),n&&(n.update(V.type),n.update(V.value)),r.push(V)}return r},i.CRIAttributesAsArray=function(c){for(var n=[],r=0;r<c.length;++r)for(var B=c[r],D=e.derToOid(B.value[0].value),V=B.value[1].value,L=0;L<V.length;++L){var O={};if(O.type=D,O.value=V[L].value,O.valueTagClass=V[L].type,O.type in v&&(O.name=v[O.type],O.name in _&&(O.shortName=_[O.name])),O.type===v.extensionRequest){O.extensions=[];for(var q=0;q<O.value.length;++q)O.extensions.push(i.certificateExtensionFromAsn1(O.value[q]))}n.push(O)}return n};function x(c,n){typeof n=="string"&&(n={shortName:n});for(var r=null,B,D=0;r===null&&D<c.attributes.length;++D)B=c.attributes[D],(n.type&&n.type===B.type||n.name&&n.name===B.name||n.shortName&&n.shortName===B.shortName)&&(r=B);return r}var k=function(c,n,r){var B={};if(c!==v["RSASSA-PSS"])return B;r&&(B={hash:{algorithmOid:v.sha1},mgf:{algorithmOid:v.mgf1,hash:{algorithmOid:v.sha1}},saltLength:20});var D={},V=[];if(!e.validate(n,t,D,V)){var L=new Error("Cannot read RSASSA-PSS parameter block.");throw L.errors=V,L}return D.hashOid!==void 0&&(B.hash=B.hash||{},B.hash.algorithmOid=e.derToOid(D.hashOid)),D.maskGenOid!==void 0&&(B.mgf=B.mgf||{},B.mgf.algorithmOid=e.derToOid(D.maskGenOid),B.mgf.hash=B.mgf.hash||{},B.mgf.hash.algorithmOid=e.derToOid(D.maskGenHashOid)),D.saltLength!==void 0&&(B.saltLength=D.saltLength.charCodeAt(0)),B},E=function(c){switch(v[c.signatureOid]){case"sha1WithRSAEncryption":case"sha1WithRSASignature":return a.md.sha1.create();case"md5WithRSAEncryption":return a.md.md5.create();case"sha256WithRSAEncryption":return a.md.sha256.create();case"sha384WithRSAEncryption":return a.md.sha384.create();case"sha512WithRSAEncryption":return a.md.sha512.create();case"RSASSA-PSS":return a.md.sha256.create();default:var n=new Error("Could not compute "+c.type+" digest. Unknown signature OID.");throw n.signatureOid=c.signatureOid,n}},u=function(c){var n=c.certificate,r;switch(n.signatureOid){case v.sha1WithRSAEncryption:case v.sha1WithRSASignature:break;case v["RSASSA-PSS"]:var B,D;if(B=v[n.signatureParameters.mgf.hash.algorithmOid],B===void 0||a.md[B]===void 0){var V=new Error("Unsupported MGF hash function.");throw V.oid=n.signatureParameters.mgf.hash.algorithmOid,V.name=B,V}if(D=v[n.signatureParameters.mgf.algorithmOid],D===void 0||a.mgf[D]===void 0){var V=new Error("Unsupported MGF function.");throw V.oid=n.signatureParameters.mgf.algorithmOid,V.name=D,V}if(D=a.mgf[D].create(a.md[B].create()),B=v[n.signatureParameters.hash.algorithmOid],B===void 0||a.md[B]===void 0){var V=new Error("Unsupported RSASSA-PSS hash function.");throw V.oid=n.signatureParameters.hash.algorithmOid,V.name=B,V}r=a.pss.create(a.md[B].create(),D,n.signatureParameters.saltLength);break}return n.publicKey.verify(c.md.digest().getBytes(),c.signature,r)};i.certificateFromPem=function(c,n,r){var B=a.pem.decode(c)[0];if(B.type!=="CERTIFICATE"&&B.type!=="X509 CERTIFICATE"&&B.type!=="TRUSTED CERTIFICATE"){var D=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw D.headerType=B.type,D}if(B.procType&&B.procType.type==="ENCRYPTED")throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var V=e.fromDer(B.body,r);return i.certificateFromAsn1(V,n)},i.certificateToPem=function(c,n){var r={type:"CERTIFICATE",body:e.toDer(i.certificateToAsn1(c)).getBytes()};return a.pem.encode(r,{maxline:n})},i.publicKeyFromPem=function(c){var n=a.pem.decode(c)[0];if(n.type!=="PUBLIC KEY"&&n.type!=="RSA PUBLIC KEY"){var r=new Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');throw r.headerType=n.type,r}if(n.procType&&n.procType.type==="ENCRYPTED")throw new Error("Could not convert public key from PEM; PEM is encrypted.");var B=e.fromDer(n.body);return i.publicKeyFromAsn1(B)},i.publicKeyToPem=function(c,n){var r={type:"PUBLIC KEY",body:e.toDer(i.publicKeyToAsn1(c)).getBytes()};return a.pem.encode(r,{maxline:n})},i.publicKeyToRSAPublicKeyPem=function(c,n){var r={type:"RSA PUBLIC KEY",body:e.toDer(i.publicKeyToRSAPublicKey(c)).getBytes()};return a.pem.encode(r,{maxline:n})},i.getPublicKeyFingerprint=function(c,n){n=n||{};var r=n.md||a.md.sha1.create(),B=n.type||"RSAPublicKey",D;switch(B){case"RSAPublicKey":D=e.toDer(i.publicKeyToRSAPublicKey(c)).getBytes();break;case"SubjectPublicKeyInfo":D=e.toDer(i.publicKeyToAsn1(c)).getBytes();break;default:throw new Error('Unknown fingerprint type "'+n.type+'".')}r.start(),r.update(D);var V=r.digest();if(n.encoding==="hex"){var L=V.toHex();return n.delimiter?L.match(/.{2}/g).join(n.delimiter):L}else{if(n.encoding==="binary")return V.getBytes();if(n.encoding)throw new Error('Unknown encoding "'+n.encoding+'".')}return V},i.certificationRequestFromPem=function(c,n,r){var B=a.pem.decode(c)[0];if(B.type!=="CERTIFICATE REQUEST"){var D=new Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw D.headerType=B.type,D}if(B.procType&&B.procType.type==="ENCRYPTED")throw new Error("Could not convert certification request from PEM; PEM is encrypted.");var V=e.fromDer(B.body,r);return i.certificationRequestFromAsn1(V,n)},i.certificationRequestToPem=function(c,n){var r={type:"CERTIFICATE REQUEST",body:e.toDer(i.certificationRequestToAsn1(c)).getBytes()};return a.pem.encode(r,{maxline:n})},i.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(n){return x(c.issuer,n)},c.issuer.addField=function(n){m([n]),c.issuer.attributes.push(n)},c.issuer.attributes=[],c.issuer.hash=null,c.subject={},c.subject.getField=function(n){return x(c.subject,n)},c.subject.addField=function(n){m([n]),c.subject.attributes.push(n)},c.subject.attributes=[],c.subject.hash=null,c.extensions=[],c.publicKey=null,c.md=null,c.setSubject=function(n,r){m(n),c.subject.attributes=n,delete c.subject.uniqueId,r&&(c.subject.uniqueId=r),c.subject.hash=null},c.setIssuer=function(n,r){m(n),c.issuer.attributes=n,delete c.issuer.uniqueId,r&&(c.issuer.uniqueId=r),c.issuer.hash=null},c.setExtensions=function(n){for(var r=0;r<n.length;++r)g(n[r],{cert:c});c.extensions=n},c.getExtension=function(n){typeof n=="string"&&(n={name:n});for(var r=null,B,D=0;r===null&&D<c.extensions.length;++D)B=c.extensions[D],(n.id&&B.id===n.id||n.name&&B.name===n.name)&&(r=B);return r},c.sign=function(n,r){c.md=r||a.md.sha1.create();var B=v[c.md.algorithm+"WithRSAEncryption"];if(!B){var D=new Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw D.algorithm=c.md.algorithm,D}c.signatureOid=c.siginfo.algorithmOid=B,c.tbsCertificate=i.getTBSCertificate(c);var V=e.toDer(c.tbsCertificate);c.md.update(V.getBytes()),c.signature=n.sign(c.md)},c.verify=function(n){var r=!1;if(!c.issued(n)){var B=n.issuer,D=c.subject,V=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 V.expectedIssuer=D.attributes,V.actualIssuer=B.attributes,V}var L=n.md;if(L===null){L=E({signatureOid:n.signatureOid,type:"certificate"});var O=n.tbsCertificate||i.getTBSCertificate(n),q=e.toDer(O);L.update(q.getBytes())}return L!==null&&(r=u({certificate:c,md:L,signature:n.signature})),r},c.isIssuer=function(n){var r=!1,B=c.issuer,D=n.subject;if(B.hash&&D.hash)r=B.hash===D.hash;else if(B.attributes.length===D.attributes.length){r=!0;for(var V,L,O=0;r&&O<B.attributes.length;++O)V=B.attributes[O],L=D.attributes[O],(V.type!==L.type||V.value!==L.value)&&(r=!1)}return r},c.issued=function(n){return n.isIssuer(c)},c.generateSubjectKeyIdentifier=function(){return i.getPublicKeyFingerprint(c.publicKey,{type:"RSAPublicKey"})},c.verifySubjectKeyIdentifier=function(){for(var n=v.subjectKeyIdentifier,r=0;r<c.extensions.length;++r){var B=c.extensions[r];if(B.id===n){var D=c.generateSubjectKeyIdentifier().getBytes();return a.util.hexToBytes(B.subjectKeyIdentifier)===D}}return!1},c},i.certificateFromAsn1=function(c,n){var r={},B=[];if(!e.validate(c,h,r,B)){var D=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.");throw D.errors=B,D}var V=e.derToOid(r.publicKeyOid);if(V!==i.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var L=i.createCertificate();L.version=r.certVersion?r.certVersion.charCodeAt(0):0;var O=a.util.createBuffer(r.certSerialNumber);L.serialNumber=O.toHex(),L.signatureOid=a.asn1.derToOid(r.certSignatureOid),L.signatureParameters=k(L.signatureOid,r.certSignatureParams,!0),L.siginfo.algorithmOid=a.asn1.derToOid(r.certinfoSignatureOid),L.siginfo.parameters=k(L.siginfo.algorithmOid,r.certinfoSignatureParams,!1),L.signature=r.certSignature;var q=[];if(r.certValidity1UTCTime!==void 0&&q.push(e.utcTimeToDate(r.certValidity1UTCTime)),r.certValidity2GeneralizedTime!==void 0&&q.push(e.generalizedTimeToDate(r.certValidity2GeneralizedTime)),r.certValidity3UTCTime!==void 0&&q.push(e.utcTimeToDate(r.certValidity3UTCTime)),r.certValidity4GeneralizedTime!==void 0&&q.push(e.generalizedTimeToDate(r.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(L.validity.notBefore=q[0],L.validity.notAfter=q[1],L.tbsCertificate=r.tbsCertificate,n){L.md=E({signatureOid:L.signatureOid,type:"certificate"});var M=e.toDer(L.tbsCertificate);L.md.update(M.getBytes())}var H=a.md.sha1.create(),Y=e.toDer(r.certIssuer);H.update(Y.getBytes()),L.issuer.getField=function(ie){return x(L.issuer,ie)},L.issuer.addField=function(ie){m([ie]),L.issuer.attributes.push(ie)},L.issuer.attributes=i.RDNAttributesAsArray(r.certIssuer),r.certIssuerUniqueId&&(L.issuer.uniqueId=r.certIssuerUniqueId),L.issuer.hash=H.digest().toHex();var W=a.md.sha1.create(),$=e.toDer(r.certSubject);return W.update($.getBytes()),L.subject.getField=function(ie){return x(L.subject,ie)},L.subject.addField=function(ie){m([ie]),L.subject.attributes.push(ie)},L.subject.attributes=i.RDNAttributesAsArray(r.certSubject),r.certSubjectUniqueId&&(L.subject.uniqueId=r.certSubjectUniqueId),L.subject.hash=W.digest().toHex(),r.certExtensions?L.extensions=i.certificateExtensionsFromAsn1(r.certExtensions):L.extensions=[],L.publicKey=i.publicKeyFromAsn1(r.subjectPublicKeyInfo),L},i.certificateExtensionsFromAsn1=function(c){for(var n=[],r=0;r<c.value.length;++r)for(var B=c.value[r],D=0;D<B.value.length;++D)n.push(i.certificateExtensionFromAsn1(B.value[D]));return n},i.certificateExtensionFromAsn1=function(c){var n={};if(n.id=e.derToOid(c.value[0].value),n.critical=!1,c.value[1].type===e.Type.BOOLEAN?(n.critical=c.value[1].value.charCodeAt(0)!==0,n.value=c.value[2].value):n.value=c.value[1].value,n.id in v){if(n.name=v[n.id],n.name==="keyUsage"){var r=e.fromDer(n.value),B=0,D=0;r.value.length>1&&(B=r.value.charCodeAt(1),D=r.value.length>2?r.value.charCodeAt(2):0),n.digitalSignature=(B&128)===128,n.nonRepudiation=(B&64)===64,n.keyEncipherment=(B&32)===32,n.dataEncipherment=(B&16)===16,n.keyAgreement=(B&8)===8,n.keyCertSign=(B&4)===4,n.cRLSign=(B&2)===2,n.encipherOnly=(B&1)===1,n.decipherOnly=(D&128)===128}else if(n.name==="basicConstraints"){var r=e.fromDer(n.value);r.value.length>0&&r.value[0].type===e.Type.BOOLEAN?n.cA=r.value[0].value.charCodeAt(0)!==0:n.cA=!1;var V=null;r.value.length>0&&r.value[0].type===e.Type.INTEGER?V=r.value[0].value:r.value.length>1&&(V=r.value[1].value),V!==null&&(n.pathLenConstraint=e.derToInteger(V))}else if(n.name==="extKeyUsage")for(var r=e.fromDer(n.value),L=0;L<r.value.length;++L){var O=e.derToOid(r.value[L].value);O in v?n[v[O]]=!0:n[O]=!0}else if(n.name==="nsCertType"){var r=e.fromDer(n.value),B=0;r.value.length>1&&(B=r.value.charCodeAt(1)),n.client=(B&128)===128,n.server=(B&64)===64,n.email=(B&32)===32,n.objsign=(B&16)===16,n.reserved=(B&8)===8,n.sslCA=(B&4)===4,n.emailCA=(B&2)===2,n.objCA=(B&1)===1}else if(n.name==="subjectAltName"||n.name==="issuerAltName"){n.altNames=[];for(var q,r=e.fromDer(n.value),M=0;M<r.value.length;++M){q=r.value[M];var H={type:q.type,value:q.value};switch(n.altNames.push(H),q.type){case 1:case 2:case 6:break;case 7:H.ip=a.util.bytesToIP(q.value);break;case 8:H.oid=e.derToOid(q.value);break}}}else if(n.name==="subjectKeyIdentifier"){var r=e.fromDer(n.value);n.subjectKeyIdentifier=a.util.bytesToHex(r.value)}}return n},i.certificationRequestFromAsn1=function(c,n){var r={},B=[];if(!e.validate(c,l,r,B)){var D=new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.");throw D.errors=B,D}var V=e.derToOid(r.publicKeyOid);if(V!==i.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var L=i.createCertificationRequest();if(L.version=r.csrVersion?r.csrVersion.charCodeAt(0):0,L.signatureOid=a.asn1.derToOid(r.csrSignatureOid),L.signatureParameters=k(L.signatureOid,r.csrSignatureParams,!0),L.siginfo.algorithmOid=a.asn1.derToOid(r.csrSignatureOid),L.siginfo.parameters=k(L.siginfo.algorithmOid,r.csrSignatureParams,!1),L.signature=r.csrSignature,L.certificationRequestInfo=r.certificationRequestInfo,n){L.md=E({signatureOid:L.signatureOid,type:"certification request"});var O=e.toDer(L.certificationRequestInfo);L.md.update(O.getBytes())}var q=a.md.sha1.create();return L.subject.getField=function(M){return x(L.subject,M)},L.subject.addField=function(M){m([M]),L.subject.attributes.push(M)},L.subject.attributes=i.RDNAttributesAsArray(r.certificationRequestInfoSubject,q),L.subject.hash=q.digest().toHex(),L.publicKey=i.publicKeyFromAsn1(r.subjectPublicKeyInfo),L.getAttribute=function(M){return x(L,M)},L.addAttribute=function(M){m([M]),L.attributes.push(M)},L.attributes=i.CRIAttributesAsArray(r.certificationRequestInfoAttributes||[]),L},i.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(n){return x(c.subject,n)},c.subject.addField=function(n){m([n]),c.subject.attributes.push(n)},c.subject.attributes=[],c.subject.hash=null,c.publicKey=null,c.attributes=[],c.getAttribute=function(n){return x(c,n)},c.addAttribute=function(n){m([n]),c.attributes.push(n)},c.md=null,c.setSubject=function(n){m(n),c.subject.attributes=n,c.subject.hash=null},c.setAttributes=function(n){m(n),c.attributes=n},c.sign=function(n,r){c.md=r||a.md.sha1.create();var B=v[c.md.algorithm+"WithRSAEncryption"];if(!B){var D=new Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw D.algorithm=c.md.algorithm,D}c.signatureOid=c.siginfo.algorithmOid=B,c.certificationRequestInfo=i.getCertificationRequestInfo(c);var V=e.toDer(c.certificationRequestInfo);c.md.update(V.getBytes()),c.signature=n.sign(c.md)},c.verify=function(){var n=!1,r=c.md;if(r===null){r=E({signatureOid:c.signatureOid,type:"certification request"});var B=c.certificationRequestInfo||i.getCertificationRequestInfo(c),D=e.toDer(B);r.update(D.getBytes())}return r!==null&&(n=u({certificate:c,md:r,signature:c.signature})),n},c};function y(c){for(var n=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]),r,B,D=c.attributes,V=0;V<D.length;++V){r=D[V];var L=r.value,O=e.Type.PRINTABLESTRING;"valueTagClass"in r&&(O=r.valueTagClass,O===e.Type.UTF8&&(L=a.util.encodeUtf8(L))),B=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(r.type).getBytes()),e.create(e.Class.UNIVERSAL,O,!1,L)])]),n.value.push(B)}return n}function m(c){for(var n,r=0;r<c.length;++r){if(n=c[r],typeof n.name>"u"&&(n.type&&n.type in i.oids?n.name=i.oids[n.type]:n.shortName&&n.shortName in _&&(n.name=i.oids[_[n.shortName]])),typeof n.type>"u")if(n.name&&n.name in i.oids)n.type=i.oids[n.name];else{var B=new Error("Attribute type not specified.");throw B.attribute=n,B}if(typeof n.shortName>"u"&&n.name&&n.name in _&&(n.shortName=_[n.name]),n.type===v.extensionRequest&&(n.valueConstructed=!0,n.valueTagClass=e.Type.SEQUENCE,!n.value&&n.extensions)){n.value=[];for(var D=0;D<n.extensions.length;++D)n.value.push(i.certificateExtensionToAsn1(g(n.extensions[D])))}if(typeof n.value>"u"){var B=new Error("Attribute value not specified.");throw B.attribute=n,B}}}function g(c,n){if(n=n||{},typeof c.name>"u"&&c.id&&c.id in i.oids&&(c.name=i.oids[c.id]),typeof c.id>"u")if(c.name&&c.name in i.oids)c.id=i.oids[c.name];else{var r=new Error("Extension ID not specified.");throw r.extension=c,r}if(typeof c.value<"u")return c;if(c.name==="keyUsage"){var B=0,D=0,V=0;c.digitalSignature&&(D|=128,B=7),c.nonRepudiation&&(D|=64,B=6),c.keyEncipherment&&(D|=32,B=5),c.dataEncipherment&&(D|=16,B=4),c.keyAgreement&&(D|=8,B=3),c.keyCertSign&&(D|=4,B=2),c.cRLSign&&(D|=2,B=1),c.encipherOnly&&(D|=1,B=0),c.decipherOnly&&(V|=128,B=7);var L=String.fromCharCode(B);V!==0?L+=String.fromCharCode(D)+String.fromCharCode(V):D!==0&&(L+=String.fromCharCode(D)),c.value=e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,L)}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 O=c.value.value;for(var q in c)c[q]===!0&&(q in v?O.push(e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(v[q]).getBytes())):q.indexOf(".")!==-1&&O.push(e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(q).getBytes())))}else if(c.name==="nsCertType"){var B=0,D=0;c.client&&(D|=128,B=7),c.server&&(D|=64,B=6),c.email&&(D|=32,B=5),c.objsign&&(D|=16,B=4),c.reserved&&(D|=8,B=3),c.sslCA&&(D|=4,B=2),c.emailCA&&(D|=2,B=1),c.objCA&&(D|=1,B=0);var L=String.fromCharCode(B);D!==0&&(L+=String.fromCharCode(D)),c.value=e.create(e.Class.UNIVERSAL,e.Type.BITSTRING,!1,L)}else if(c.name==="subjectAltName"||c.name==="issuerAltName"){c.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);for(var M,H=0;H<c.altNames.length;++H){M=c.altNames[H];var L=M.value;if(M.type===7&&M.ip){if(L=a.util.bytesFromIP(M.ip),L===null){var r=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw r.extension=c,r}}else M.type===8&&(M.oid?L=e.oidToDer(e.oidToDer(M.oid)):L=e.oidToDer(L));c.value.value.push(e.create(e.Class.CONTEXT_SPECIFIC,M.type,!1,L))}}else if(c.name==="nsComment"&&n.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"&&n.cert){var Y=n.cert.generateSubjectKeyIdentifier();c.subjectKeyIdentifier=Y.toHex(),c.value=e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,Y.getBytes())}else if(c.name==="authorityKeyIdentifier"&&n.cert){c.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);var O=c.value.value;if(c.keyIdentifier){var W=c.keyIdentifier===!0?n.cert.generateSubjectKeyIdentifier().getBytes():c.keyIdentifier;O.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!1,W))}if(c.authorityCertIssuer){var $=[e.create(e.Class.CONTEXT_SPECIFIC,4,!0,[y(c.authorityCertIssuer===!0?n.cert.issuer:c.authorityCertIssuer)])];O.push(e.create(e.Class.CONTEXT_SPECIFIC,1,!0,$))}if(c.serialNumber){var ie=a.util.hexToBytes(c.serialNumber===!0?n.cert.serialNumber:c.serialNumber);O.push(e.create(e.Class.CONTEXT_SPECIFIC,2,!1,ie))}}else if(c.name==="cRLDistributionPoints"){c.value=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);for(var O=c.value.value,se=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]),he=e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[]),M,H=0;H<c.altNames.length;++H){M=c.altNames[H];var L=M.value;if(M.type===7&&M.ip){if(L=a.util.bytesFromIP(M.ip),L===null){var r=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.');throw r.extension=c,r}}else M.type===8&&(M.oid?L=e.oidToDer(e.oidToDer(M.oid)):L=e.oidToDer(L));he.value.push(e.create(e.Class.CONTEXT_SPECIFIC,M.type,!1,L))}se.value.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[he])),O.push(se)}if(typeof c.value>"u"){var r=new Error("Extension value not specified.");throw r.extension=c,r}return c}function s(c,n){if(c===v["RSASSA-PSS"]){var r=[];return n.hash.algorithmOid!==void 0&&r.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(n.hash.algorithmOid).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")])])),n.mgf.algorithmOid!==void 0&&r.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(n.mgf.algorithmOid).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(n.mgf.hash.algorithmOid).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")])])])),n.saltLength!==void 0&&r.push(e.create(e.Class.CONTEXT_SPECIFIC,2,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(n.saltLength).getBytes())])),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,r)}else return e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")}function d(c){var n=e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[]);if(c.attributes.length===0)return n;for(var r=c.attributes,B=0;B<r.length;++B){var D=r[B],V=D.value,L=e.Type.UTF8;"valueTagClass"in D&&(L=D.valueTagClass),L===e.Type.UTF8&&(V=a.util.encodeUtf8(V));var O=!1;"valueConstructed"in D&&(O=D.valueConstructed);var q=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(D.type).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[e.create(e.Class.UNIVERSAL,L,O,V)])]);n.value.push(q)}return n}var p=new Date("1950-01-01T00:00:00Z"),I=new Date("2050-01-01T00:00:00Z");function R(c){return c>=p&&c<I?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 i.getTBSCertificate=function(c){var n=R(c.validity.notBefore),r=R(c.validity.notAfter),B=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,a.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)]),y(c.issuer),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[n,r]),y(c.subject),i.publicKeyToAsn1(c.publicKey)]);return c.issuer.uniqueId&&B.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&&B.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&&B.value.push(i.certificateExtensionsToAsn1(c.extensions)),B},i.getCertificationRequestInfo=function(c){var n=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(c.version).getBytes()),y(c.subject),i.publicKeyToAsn1(c.publicKey),d(c)]);return n},i.distinguishedNameToAsn1=function(c){return y(c)},i.certificateToAsn1=function(c){var n=c.tbsCertificate||i.getTBSCertificate(c);return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[n,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)])},i.certificateExtensionsToAsn1=function(c){var n=e.create(e.Class.CONTEXT_SPECIFIC,3,!0,[]),r=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);n.value.push(r);for(var B=0;B<c.length;++B)r.value.push(i.certificateExtensionToAsn1(c[B]));return n},i.certificateExtensionToAsn1=function(c){var n=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[]);n.value.push(e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(c.id).getBytes())),c.critical&&n.value.push(e.create(e.Class.UNIVERSAL,e.Type.BOOLEAN,!1,"ÿ"));var r=c.value;return typeof c.value!="string"&&(r=e.toDer(r).getBytes()),n.value.push(e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,r)),n},i.certificationRequestToAsn1=function(c){var n=c.certificationRequestInfo||i.getCertificationRequestInfo(c);return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[n,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)])},i.createCaStore=function(c){var n={certs:{}};n.getIssuer=function(L){var O=r(L.issuer);return O},n.addCertificate=function(L){if(typeof L=="string"&&(L=a.pki.certificateFromPem(L)),B(L.subject),!n.hasCertificate(L))if(L.subject.hash in n.certs){var O=n.certs[L.subject.hash];a.util.isArray(O)||(O=[O]),O.push(L),n.certs[L.subject.hash]=O}else n.certs[L.subject.hash]=L},n.hasCertificate=function(L){typeof L=="string"&&(L=a.pki.certificateFromPem(L));var O=r(L.subject);if(!O)return!1;a.util.isArray(O)||(O=[O]);for(var q=e.toDer(i.certificateToAsn1(L)).getBytes(),M=0;M<O.length;++M){var H=e.toDer(i.certificateToAsn1(O[M])).getBytes();if(q===H)return!0}return!1},n.listAllCertificates=function(){var L=[];for(var O in n.certs)if(n.certs.hasOwnProperty(O)){var q=n.certs[O];if(!a.util.isArray(q))L.push(q);else for(var M=0;M<q.length;++M)L.push(q[M])}return L},n.removeCertificate=function(L){var O;if(typeof L=="string"&&(L=a.pki.certificateFromPem(L)),B(L.subject),!n.hasCertificate(L))return null;var q=r(L.subject);if(!a.util.isArray(q))return O=n.certs[L.subject.hash],delete n.certs[L.subject.hash],O;for(var M=e.toDer(i.certificateToAsn1(L)).getBytes(),H=0;H<q.length;++H){var Y=e.toDer(i.certificateToAsn1(q[H])).getBytes();M===Y&&(O=q[H],q.splice(H,1))}return q.length===0&&delete n.certs[L.subject.hash],O};function r(L){return B(L),n.certs[L.hash]||null}function B(L){if(!L.hash){var O=a.md.sha1.create();L.attributes=i.RDNAttributesAsArray(y(L),O),L.hash=O.digest().toHex()}}if(c)for(var D=0;D<c.length;++D){var V=c[D];n.addCertificate(V)}return n},i.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"},i.verifyCertificateChain=function(c,n,r){typeof r=="function"&&(r={verify:r}),r=r||{},n=n.slice(0);var B=n.slice(0),D=r.validityCheckDate;typeof D>"u"&&(D=new Date);var V=!0,L=null,O=0;do{var q=n.shift(),M=null,H=!1;if(D&&(D<q.validity.notBefore||D>q.validity.notAfter)&&(L={message:"Certificate is not valid yet or has expired.",error:i.certificateError.certificate_expired,notBefore:q.validity.notBefore,notAfter:q.validity.notAfter,now:D}),L===null){if(M=n[0]||c.getIssuer(q),M===null&&q.isIssuer(q)&&(H=!0,M=q),M){var Y=M;a.util.isArray(Y)||(Y=[Y]);for(var W=!1;!W&&Y.length>0;){M=Y.shift();try{W=M.verify(q)}catch{}}W||(L={message:"Certificate signature is invalid.",error:i.certificateError.bad_certificate})}L===null&&(!M||H)&&!c.hasCertificate(q)&&(L={message:"Certificate is not trusted.",error:i.certificateError.unknown_ca})}if(L===null&&M&&!q.isIssuer(M)&&(L={message:"Certificate issuer is invalid.",error:i.certificateError.bad_certificate}),L===null)for(var $={keyUsage:!0,basicConstraints:!0},ie=0;L===null&&ie<q.extensions.length;++ie){var se=q.extensions[ie];se.critical&&!(se.name in $)&&(L={message:"Certificate has an unsupported critical extension.",error:i.certificateError.unsupported_certificate})}if(L===null&&(!V||n.length===0&&(!M||H))){var he=q.getExtension("basicConstraints"),ge=q.getExtension("keyUsage");if(ge!==null&&(!ge.keyCertSign||he===null)&&(L={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:i.certificateError.bad_certificate}),L===null&&he!==null&&!he.cA&&(L={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:i.certificateError.bad_certificate}),L===null&&ge!==null&&"pathLenConstraint"in he){var j=O-1;j>he.pathLenConstraint&&(L={message:"Certificate basicConstraints pathLenConstraint violated.",error:i.certificateError.bad_certificate})}}var fe=L===null?!0:L.error,Z=r.verify?r.verify(fe,O,B):fe;if(Z===!0)L=null;else throw fe===!0&&(L={message:"The application rejected the certificate.",error:i.certificateError.bad_certificate}),(Z||Z===0)&&(typeof Z=="object"&&!a.util.isArray(Z)?(Z.message&&(L.message=Z.message),Z.error&&(L.error=Z.error)):typeof Z=="string"&&(L.error=Z)),L;V=!1,++O}while(n.length>0);return!0},rr.exports}var ra;function aa(){if(ra)return er.exports;ra=1;var a=ue();et(),pt(),ut(),jr(),Xr(),We(),xt(),vt(),de(),or();var e=a.asn1,i=a.pki,v=er.exports=a.pkcs12=a.pkcs12||{},_={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"}]},S={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"},_,{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"}]}]},h={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"}]},t={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"}]},C={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 l(m,g,s,d){for(var p=[],I=0;I<m.length;I++)for(var R=0;R<m[I].safeBags.length;R++){var c=m[I].safeBags[R];if(!(d!==void 0&&c.type!==d)){if(g===null){p.push(c);continue}c.attributes[g]!==void 0&&c.attributes[g].indexOf(s)>=0&&p.push(c)}}return p}v.pkcs12FromAsn1=function(m,g,s){typeof g=="string"?(s=g,g=!0):g===void 0&&(g=!0);var d={},p=[];if(!e.validate(m,S,d,p)){var I=new Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX.");throw I.errors=I,I}var R={version:d.version.charCodeAt(0),safeContents:[],getBags:function(M){var H={},Y;return"localKeyId"in M?Y=M.localKeyId:"localKeyIdHex"in M&&(Y=a.util.hexToBytes(M.localKeyIdHex)),Y===void 0&&!("friendlyName"in M)&&"bagType"in M&&(H[M.bagType]=l(R.safeContents,null,null,M.bagType)),Y!==void 0&&(H.localKeyId=l(R.safeContents,"localKeyId",Y,M.bagType)),"friendlyName"in M&&(H.friendlyName=l(R.safeContents,"friendlyName",M.friendlyName,M.bagType)),H},getBagsByFriendlyName:function(M,H){return l(R.safeContents,"friendlyName",M,H)},getBagsByLocalKeyId:function(M,H){return l(R.safeContents,"localKeyId",M,H)}};if(d.version.charCodeAt(0)!==3){var I=new Error("PKCS#12 PFX of version other than 3 not supported.");throw I.version=d.version.charCodeAt(0),I}if(e.derToOid(d.contentType)!==i.oids.data){var I=new Error("Only PKCS#12 PFX in password integrity mode supported.");throw I.oid=e.derToOid(d.contentType),I}var c=d.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=x(c),d.mac){var n=null,r=0,B=e.derToOid(d.macAlgorithm);switch(B){case i.oids.sha1:n=a.md.sha1.create(),r=20;break;case i.oids.sha256:n=a.md.sha256.create(),r=32;break;case i.oids.sha384:n=a.md.sha384.create(),r=48;break;case i.oids.sha512:n=a.md.sha512.create(),r=64;break;case i.oids.md5:n=a.md.md5.create(),r=16;break}if(n===null)throw new Error("PKCS#12 uses unsupported MAC algorithm: "+B);var D=new a.util.ByteBuffer(d.macSalt),V="macIterations"in d?parseInt(a.util.bytesToHex(d.macIterations),16):1,L=v.generateKey(s,D,3,V,r,n),O=a.hmac.create();O.start(n,L),O.update(c.value);var q=O.getMac();if(q.getBytes()!==d.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 k(R,c.value,g,s),R};function x(m){if(m.composed||m.constructed){for(var g=a.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 k(m,g,s,d){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 I=g.value[p],R={},c=[];if(!e.validate(I,_,R,c)){var n=new Error("Cannot read ContentInfo.");throw n.errors=c,n}var r={encrypted:!1},B=null,D=R.content.value[0];switch(e.derToOid(R.contentType)){case i.oids.data:if(D.tagClass!==e.Class.UNIVERSAL||D.type!==e.Type.OCTETSTRING)throw new Error("PKCS#12 SafeContents Data is not an OCTET STRING.");B=x(D).value;break;case i.oids.encryptedData:B=E(D,d),r.encrypted=!0;break;default:var n=new Error("Unsupported PKCS#12 contentType.");throw n.contentType=e.derToOid(R.contentType),n}r.safeBags=u(B,s,d),m.safeContents.push(r)}}function E(m,g){var s={},d=[];if(!e.validate(m,a.pkcs7.asn1.encryptedDataValidator,s,d)){var p=new Error("Cannot read EncryptedContentInfo.");throw p.errors=d,p}var I=e.derToOid(s.contentType);if(I!==i.oids.data){var p=new Error("PKCS#12 EncryptedContentInfo ContentType is not Data.");throw p.oid=I,p}I=e.derToOid(s.encAlgorithm);var R=i.pbe.getCipher(I,s.encParameter,g),c=x(s.encryptedContentAsn1),n=a.util.createBuffer(c.value);if(R.update(n),!R.finish())throw new Error("Failed to decrypt PKCS#12 SafeContents.");return R.output.getBytes()}function u(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 d=[],p=0;p<m.value.length;p++){var I=m.value[p],R={},c=[];if(!e.validate(I,h,R,c)){var n=new Error("Cannot read SafeBag.");throw n.errors=c,n}var r={type:e.derToOid(R.bagId),attributes:y(R.bagAttributes)};d.push(r);var B,D,V=R.bagValue.value[0];switch(r.type){case i.oids.pkcs8ShroudedKeyBag:if(V=i.decryptPrivateKeyInfo(V,s),V===null)throw new Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case i.oids.keyBag:try{r.key=i.privateKeyFromAsn1(V)}catch{r.key=null,r.asn1=V}continue;case i.oids.certBag:B=C,D=function(){if(e.derToOid(R.certId)!==i.oids.x509Certificate){var O=new Error("Unsupported certificate type, only X.509 supported.");throw O.oid=e.derToOid(R.certId),O}var q=e.fromDer(R.cert,g);try{r.cert=i.certificateFromAsn1(q,!0)}catch{r.cert=null,r.asn1=q}};break;default:var n=new Error("Unsupported PKCS#12 SafeBag type.");throw n.oid=r.type,n}if(B!==void 0&&!e.validate(V,B,R,c)){var n=new Error("Cannot read PKCS#12 "+B.name);throw n.errors=c,n}D()}return d}function y(m){var g={};if(m!==void 0)for(var s=0;s<m.length;++s){var d={},p=[];if(!e.validate(m[s],t,d,p)){var I=new Error("Cannot read PKCS#12 BagAttribute.");throw I.errors=p,I}var R=e.derToOid(d.oid);if(i.oids[R]!==void 0){g[i.oids[R]]=[];for(var c=0;c<d.values.length;++c)g[i.oids[R]].push(d.values[c].value)}}return g}return v.toPkcs12Asn1=function(m,g,s,d){d=d||{},d.saltSize=d.saltSize||8,d.count=d.count||2048,d.algorithm=d.algorithm||d.encAlgorithm||"aes128","useMac"in d||(d.useMac=!0),"localKeyId"in d||(d.localKeyId=null),"generateLocalKeyId"in d||(d.generateLocalKeyId=!0);var p=d.localKeyId,I;if(p!==null)p=a.util.hexToBytes(p);else if(d.generateLocalKeyId)if(g){var R=a.util.isArray(g)?g[0]:g;typeof R=="string"&&(R=i.certificateFromPem(R));var c=a.md.sha1.create();c.update(e.toDer(i.certificateToAsn1(R)).getBytes()),p=c.digest().getBytes()}else p=a.random.getBytes(20);var n=[];p!==null&&n.push(e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(i.oids.localKeyId).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,p)])])),"friendlyName"in d&&n.push(e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(i.oids.friendlyName).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[e.create(e.Class.UNIVERSAL,e.Type.BMPSTRING,!1,d.friendlyName)])])),n.length>0&&(I=e.create(e.Class.UNIVERSAL,e.Type.SET,!0,n));var r=[],B=[];g!==null&&(a.util.isArray(g)?B=g:B=[g]);for(var D=[],V=0;V<B.length;++V){g=B[V],typeof g=="string"&&(g=i.certificateFromPem(g));var L=V===0?I:void 0,O=i.certificateToAsn1(g),q=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(i.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(i.oids.x509Certificate).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,e.toDer(O).getBytes())])])]),L]);D.push(q)}if(D.length>0){var M=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,D),H=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(i.oids.data).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,e.toDer(M).getBytes())])]);r.push(H)}var Y=null;if(m!==null){var W=i.wrapRsaPrivateKey(i.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(i.oids.keyBag).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[W]),I]):Y=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(i.oids.pkcs8ShroudedKeyBag).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[i.encryptPrivateKeyInfo(W,s,d)]),I]);var $=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[Y]),ie=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(i.oids.data).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,e.toDer($).getBytes())])]);r.push(ie)}var se=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,r),he;if(d.useMac){var c=a.md.sha1.create(),ge=new a.util.ByteBuffer(a.random.getBytes(d.saltSize)),j=d.count,m=v.generateKey(s,ge,3,j,20),fe=a.hmac.create();fe.start(c,m),fe.update(e.toDer(se).getBytes());var Z=fe.getMac();he=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(i.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,ge.getBytes()),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(j).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(i.oids.data).getBytes()),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,e.toDer(se).getBytes())])]),he])},v.generateKey=a.pbe.generatePkcs12Key,er.exports}var ia;function na(){if(ia)return Mt.exports;ia=1;var a=ue();et(),ut(),Xr(),lt(),Qt(),aa(),sr(),xt(),de(),or();var e=a.asn1,i=Mt.exports=a.pki=a.pki||{};return i.pemToDer=function(v){var _=a.pem.decode(v)[0];if(_.procType&&_.procType.type==="ENCRYPTED")throw new Error("Could not convert PEM to DER; PEM is encrypted.");return a.util.createBuffer(_.body)},i.privateKeyFromPem=function(v){var _=a.pem.decode(v)[0];if(_.type!=="PRIVATE KEY"&&_.type!=="RSA PRIVATE KEY"){var S=new Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw S.headerType=_.type,S}if(_.procType&&_.procType.type==="ENCRYPTED")throw new Error("Could not convert private key from PEM; PEM is encrypted.");var h=e.fromDer(_.body);return i.privateKeyFromAsn1(h)},i.privateKeyToPem=function(v,_){var S={type:"RSA PRIVATE KEY",body:e.toDer(i.privateKeyToAsn1(v)).getBytes()};return a.pem.encode(S,{maxline:_})},i.privateKeyInfoToPem=function(v,_){var S={type:"PRIVATE KEY",body:e.toDer(v).getBytes()};return a.pem.encode(S,{maxline:_})},Mt.exports}var ur,sa;function oa(){if(sa)return ur;sa=1;var a=ue();et(),pt(),Kt(),lt(),na(),We(),vt(),de();var e=function(f,w,N,o){var A=a.util.createBuffer(),K=f.length>>1,P=K+(f.length&1),z=f.substr(0,P),ee=f.substr(K,P),ae=a.util.createBuffer(),G=a.hmac.create();N=w+N;var te=Math.ceil(o/16),ne=Math.ceil(o/20);G.start("MD5",z);var ce=a.util.createBuffer();ae.putBytes(N);for(var oe=0;oe<te;++oe)G.start(null,null),G.update(ae.getBytes()),ae.putBuffer(G.digest()),G.start(null,null),G.update(ae.bytes()+N),ce.putBuffer(G.digest());G.start("SHA1",ee);var Ce=a.util.createBuffer();ae.clear(),ae.putBytes(N);for(var oe=0;oe<ne;++oe)G.start(null,null),G.update(ae.getBytes()),ae.putBuffer(G.digest()),G.start(null,null),G.update(ae.bytes()+N),Ce.putBuffer(G.digest());return A.putBytes(a.util.xorBytes(ce.getBytes(),Ce.getBytes(),o)),A},i=function(f,w,N){var o=a.hmac.create();o.start("SHA1",f);var A=a.util.createBuffer();return A.putInt32(w[0]),A.putInt32(w[1]),A.putByte(N.type),A.putByte(N.version.major),A.putByte(N.version.minor),A.putInt16(N.length),A.putBytes(N.fragment.bytes()),o.update(A.getBytes()),o.digest().getBytes()},v=function(f,w,N){var o=!1;try{var A=f.deflate(w.fragment.getBytes());w.fragment=a.util.createBuffer(A),w.length=A.length,o=!0}catch{}return o},_=function(f,w,N){var o=!1;try{var A=f.inflate(w.fragment.getBytes());w.fragment=a.util.createBuffer(A),w.length=A.length,o=!0}catch{}return o},S=function(f,w){var N=0;switch(w){case 1:N=f.getByte();break;case 2:N=f.getInt16();break;case 3:N=f.getInt24();break;case 4:N=f.getInt32();break}return a.util.createBuffer(f.getBytes(N))},h=function(f,w,N){f.putInt(N.length(),w<<3),f.putBuffer(N)},t={};t.Versions={TLS_1_0:{major:3,minor:1},TLS_1_1:{major:3,minor:2},TLS_1_2:{major:3,minor:3}},t.SupportedVersions=[t.Versions.TLS_1_1,t.Versions.TLS_1_0],t.Version=t.SupportedVersions[0],t.MaxFragment=15360,t.ConnectionEnd={server:0,client:1},t.PRFAlgorithm={tls_prf_sha256:0},t.BulkCipherAlgorithm={none:null,rc4:0,des3:1,aes:2},t.CipherType={stream:0,block:1,aead:2},t.MACAlgorithm={none:null,hmac_md5:0,hmac_sha1:1,hmac_sha256:2,hmac_sha384:3,hmac_sha512:4},t.CompressionMethod={none:0,deflate:1},t.ContentType={change_cipher_spec:20,alert:21,handshake:22,application_data:23,heartbeat:24},t.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},t.Alert={},t.Alert.Level={warning:1,fatal:2},t.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},t.HeartbeatMessageType={heartbeat_request:1,heartbeat_response:2},t.CipherSuites={},t.getCipherSuite=function(f){var w=null;for(var N in t.CipherSuites){var o=t.CipherSuites[N];if(o.id[0]===f.charCodeAt(0)&&o.id[1]===f.charCodeAt(1)){w=o;break}}return w},t.handleUnexpected=function(f,w){var N=!f.open&&f.entity===t.ConnectionEnd.client;N||f.error(f,{message:"Unexpected message. Received TLS record out of order.",send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.unexpected_message}})},t.handleHelloRequest=function(f,w,N){!f.handshaking&&f.handshakes>0&&(t.queue(f,t.createAlert(f,{level:t.Alert.Level.warning,description:t.Alert.Description.no_renegotiation})),t.flush(f)),f.process()},t.parseHelloMessage=function(f,w,N){var o=null,A=f.entity===t.ConnectionEnd.client;if(N<38)f.error(f,{message:A?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.illegal_parameter}});else{var K=w.fragment,P=K.length();if(o={version:{major:K.getByte(),minor:K.getByte()},random:a.util.createBuffer(K.getBytes(32)),session_id:S(K,1),extensions:[]},A?(o.cipher_suite=K.getBytes(2),o.compression_method=K.getByte()):(o.cipher_suites=S(K,2),o.compression_methods=S(K,1)),P=N-(P-K.length()),P>0){for(var z=S(K,2);z.length()>0;)o.extensions.push({type:[z.getByte(),z.getByte()],data:S(z,2)});if(!A)for(var ee=0;ee<o.extensions.length;++ee){var ae=o.extensions[ee];if(ae.type[0]===0&&ae.type[1]===0)for(var G=S(ae.data,2);G.length()>0;){var te=G.getByte();if(te!==0)break;f.session.extensions.server_name.serverNameList.push(S(G,2).getBytes())}}}if(f.session.version&&(o.version.major!==f.session.version.major||o.version.minor!==f.session.version.minor))return f.error(f,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.protocol_version}});if(A)f.session.cipherSuite=t.getCipherSuite(o.cipher_suite);else for(var ne=a.util.createBuffer(o.cipher_suites.bytes());ne.length()>0&&(f.session.cipherSuite=t.getCipherSuite(ne.getBytes(2)),f.session.cipherSuite===null););if(f.session.cipherSuite===null)return f.error(f,{message:"No cipher suites in common.",send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.handshake_failure},cipherSuite:a.util.bytesToHex(o.cipher_suite)});A?f.session.compressionMethod=o.compression_method:f.session.compressionMethod=t.CompressionMethod.none}return o},t.createSecurityParameters=function(f,w){var N=f.entity===t.ConnectionEnd.client,o=w.random.bytes(),A=N?f.session.sp.client_random:o,K=N?o:t.createRandom().getBytes();f.session.sp={entity:f.entity,prf_algorithm:t.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:f.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:A,server_random:K}},t.handleServerHello=function(f,w,N){var o=t.parseHelloMessage(f,w,N);if(!f.fail){if(o.version.minor<=f.version.minor)f.version.minor=o.version.minor;else return f.error(f,{message:"Incompatible TLS version.",send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.protocol_version}});f.session.version=f.version;var A=o.session_id.bytes();A.length>0&&A===f.session.id?(f.expect=u,f.session.resuming=!0,f.session.sp.server_random=o.random.bytes()):(f.expect=l,f.session.resuming=!1,t.createSecurityParameters(f,o)),f.session.id=A,f.process()}},t.handleClientHello=function(f,w,N){var o=t.parseHelloMessage(f,w,N);if(!f.fail){var A=o.session_id.bytes(),K=null;if(f.sessionCache&&(K=f.sessionCache.getSession(A),K===null?A="":(K.version.major!==o.version.major||K.version.minor>o.version.minor)&&(K=null,A="")),A.length===0&&(A=a.random.getBytes(32)),f.session.id=A,f.session.clientHelloVersion=o.version,f.session.sp={},K)f.version=f.session.version=K.version,f.session.sp=K.sp;else{for(var P,z=1;z<t.SupportedVersions.length&&(P=t.SupportedVersions[z],!(P.minor<=o.version.minor));++z);f.version={major:P.major,minor:P.minor},f.session.version=f.version}K!==null?(f.expect=R,f.session.resuming=!0,f.session.sp.client_random=o.random.bytes()):(f.expect=f.verifyClient!==!1?d:p,f.session.resuming=!1,t.createSecurityParameters(f,o)),f.open=!0,t.queue(f,t.createRecord(f,{type:t.ContentType.handshake,data:t.createServerHello(f)})),f.session.resuming?(t.queue(f,t.createRecord(f,{type:t.ContentType.change_cipher_spec,data:t.createChangeCipherSpec()})),f.state.pending=t.createConnectionState(f),f.state.current.write=f.state.pending.write,t.queue(f,t.createRecord(f,{type:t.ContentType.handshake,data:t.createFinished(f)}))):(t.queue(f,t.createRecord(f,{type:t.ContentType.handshake,data:t.createCertificate(f)})),f.fail||(t.queue(f,t.createRecord(f,{type:t.ContentType.handshake,data:t.createServerKeyExchange(f)})),f.verifyClient!==!1&&t.queue(f,t.createRecord(f,{type:t.ContentType.handshake,data:t.createCertificateRequest(f)})),t.queue(f,t.createRecord(f,{type:t.ContentType.handshake,data:t.createServerHelloDone(f)})))),t.flush(f),f.process()}},t.handleCertificate=function(f,w,N){if(N<3)return f.error(f,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.illegal_parameter}});var o=w.fragment,A={certificate_list:S(o,3)},K,P,z=[];try{for(;A.certificate_list.length()>0;)K=S(A.certificate_list,3),P=a.asn1.fromDer(K),K=a.pki.certificateFromAsn1(P,!0),z.push(K)}catch(ae){return f.error(f,{message:"Could not parse certificate list.",cause:ae,send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.bad_certificate}})}var ee=f.entity===t.ConnectionEnd.client;(ee||f.verifyClient===!0)&&z.length===0?f.error(f,{message:ee?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.illegal_parameter}}):z.length===0?f.expect=ee?x:p:(ee?f.session.serverCertificate=z[0]:f.session.clientCertificate=z[0],t.verifyCertificateChain(f,z)&&(f.expect=ee?x:p)),f.process()},t.handleServerKeyExchange=function(f,w,N){if(N>0)return f.error(f,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.unsupported_certificate}});f.expect=k,f.process()},t.handleClientKeyExchange=function(f,w,N){if(N<48)return f.error(f,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.unsupported_certificate}});var o=w.fragment,A={enc_pre_master_secret:S(o,2).getBytes()},K=null;if(f.getPrivateKey)try{K=f.getPrivateKey(f,f.session.serverCertificate),K=a.pki.privateKeyFromPem(K)}catch(ee){f.error(f,{message:"Could not get private key.",cause:ee,send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.internal_error}})}if(K===null)return f.error(f,{message:"No private key set.",send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.internal_error}});try{var P=f.session.sp;P.pre_master_secret=K.decrypt(A.enc_pre_master_secret);var z=f.session.clientHelloVersion;if(z.major!==P.pre_master_secret.charCodeAt(0)||z.minor!==P.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch{P.pre_master_secret=a.random.getBytes(48)}f.expect=R,f.session.clientCertificate!==null&&(f.expect=I),f.process()},t.handleCertificateRequest=function(f,w,N){if(N<3)return f.error(f,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.illegal_parameter}});var o=w.fragment,A={certificate_types:S(o,1),certificate_authorities:S(o,2)};f.session.certificateRequest=A,f.expect=E,f.process()},t.handleCertificateVerify=function(f,w,N){if(N<2)return f.error(f,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.illegal_parameter}});var o=w.fragment;o.read-=4;var A=o.bytes();o.read+=4;var K={signature:S(o,2).getBytes()},P=a.util.createBuffer();P.putBuffer(f.session.md5.digest()),P.putBuffer(f.session.sha1.digest()),P=P.getBytes();try{var z=f.session.clientCertificate;if(!z.publicKey.verify(P,K.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");f.session.md5.update(A),f.session.sha1.update(A)}catch{return f.error(f,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.handshake_failure}})}f.expect=R,f.process()},t.handleServerHelloDone=function(f,w,N){if(N>0)return f.error(f,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.record_overflow}});if(f.serverCertificate===null){var o={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.insufficient_security}},A=0,K=f.verify(f,o.alert.description,A,[]);if(K!==!0)return(K||K===0)&&(typeof K=="object"&&!a.util.isArray(K)?(K.message&&(o.message=K.message),K.alert&&(o.alert.description=K.alert)):typeof K=="number"&&(o.alert.description=K)),f.error(f,o)}f.session.certificateRequest!==null&&(w=t.createRecord(f,{type:t.ContentType.handshake,data:t.createCertificate(f)}),t.queue(f,w)),w=t.createRecord(f,{type:t.ContentType.handshake,data:t.createClientKeyExchange(f)}),t.queue(f,w),f.expect=g;var P=function(z,ee){z.session.certificateRequest!==null&&z.session.clientCertificate!==null&&t.queue(z,t.createRecord(z,{type:t.ContentType.handshake,data:t.createCertificateVerify(z,ee)})),t.queue(z,t.createRecord(z,{type:t.ContentType.change_cipher_spec,data:t.createChangeCipherSpec()})),z.state.pending=t.createConnectionState(z),z.state.current.write=z.state.pending.write,t.queue(z,t.createRecord(z,{type:t.ContentType.handshake,data:t.createFinished(z)})),z.expect=u,t.flush(z),z.process()};if(f.session.certificateRequest===null||f.session.clientCertificate===null)return P(f,null);t.getClientSignature(f,P)},t.handleChangeCipherSpec=function(f,w){if(w.fragment.getByte()!==1)return f.error(f,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.illegal_parameter}});var N=f.entity===t.ConnectionEnd.client;(f.session.resuming&&N||!f.session.resuming&&!N)&&(f.state.pending=t.createConnectionState(f)),f.state.current.read=f.state.pending.read,(!f.session.resuming&&N||f.session.resuming&&!N)&&(f.state.pending=null),f.expect=N?y:c,f.process()},t.handleFinished=function(f,w,N){var o=w.fragment;o.read-=4;var A=o.bytes();o.read+=4;var K=w.fragment.getBytes();o=a.util.createBuffer(),o.putBuffer(f.session.md5.digest()),o.putBuffer(f.session.sha1.digest());var P=f.entity===t.ConnectionEnd.client,z=P?"server finished":"client finished",ee=f.session.sp,ae=12,G=e;if(o=G(ee.master_secret,z,o.getBytes(),ae),o.getBytes()!==K)return f.error(f,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.decrypt_error}});f.session.md5.update(A),f.session.sha1.update(A),(f.session.resuming&&P||!f.session.resuming&&!P)&&(t.queue(f,t.createRecord(f,{type:t.ContentType.change_cipher_spec,data:t.createChangeCipherSpec()})),f.state.current.write=f.state.pending.write,f.state.pending=null,t.queue(f,t.createRecord(f,{type:t.ContentType.handshake,data:t.createFinished(f)}))),f.expect=P?m:n,f.handshaking=!1,++f.handshakes,f.peerCertificate=P?f.session.serverCertificate:f.session.clientCertificate,t.flush(f),f.isConnected=!0,f.connected(f),f.process()},t.handleAlert=function(f,w){var N=w.fragment,o={level:N.getByte(),description:N.getByte()},A;switch(o.description){case t.Alert.Description.close_notify:A="Connection closed.";break;case t.Alert.Description.unexpected_message:A="Unexpected message.";break;case t.Alert.Description.bad_record_mac:A="Bad record MAC.";break;case t.Alert.Description.decryption_failed:A="Decryption failed.";break;case t.Alert.Description.record_overflow:A="Record overflow.";break;case t.Alert.Description.decompression_failure:A="Decompression failed.";break;case t.Alert.Description.handshake_failure:A="Handshake failure.";break;case t.Alert.Description.bad_certificate:A="Bad certificate.";break;case t.Alert.Description.unsupported_certificate:A="Unsupported certificate.";break;case t.Alert.Description.certificate_revoked:A="Certificate revoked.";break;case t.Alert.Description.certificate_expired:A="Certificate expired.";break;case t.Alert.Description.certificate_unknown:A="Certificate unknown.";break;case t.Alert.Description.illegal_parameter:A="Illegal parameter.";break;case t.Alert.Description.unknown_ca:A="Unknown certificate authority.";break;case t.Alert.Description.access_denied:A="Access denied.";break;case t.Alert.Description.decode_error:A="Decode error.";break;case t.Alert.Description.decrypt_error:A="Decrypt error.";break;case t.Alert.Description.export_restriction:A="Export restriction.";break;case t.Alert.Description.protocol_version:A="Unsupported protocol version.";break;case t.Alert.Description.insufficient_security:A="Insufficient security.";break;case t.Alert.Description.internal_error:A="Internal error.";break;case t.Alert.Description.user_canceled:A="User canceled.";break;case t.Alert.Description.no_renegotiation:A="Renegotiation not supported.";break;default:A="Unknown error.";break}if(o.description===t.Alert.Description.close_notify)return f.close();f.error(f,{message:A,send:!1,origin:f.entity===t.ConnectionEnd.client?"server":"client",alert:o}),f.process()},t.handleHandshake=function(f,w){var N=w.fragment,o=N.getByte(),A=N.getInt24();if(A>N.length())return f.fragmented=w,w.fragment=a.util.createBuffer(),N.read-=4,f.process();f.fragmented=null,N.read-=4;var K=N.bytes(A+4);N.read+=4,o in he[f.entity][f.expect]?(f.entity===t.ConnectionEnd.server&&!f.open&&!f.fail&&(f.handshaking=!0,f.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:a.md.md5.create(),sha1:a.md.sha1.create()}),o!==t.HandshakeType.hello_request&&o!==t.HandshakeType.certificate_verify&&o!==t.HandshakeType.finished&&(f.session.md5.update(K),f.session.sha1.update(K)),he[f.entity][f.expect][o](f,w,A)):t.handleUnexpected(f,w)},t.handleApplicationData=function(f,w){f.data.putBuffer(w.fragment),f.dataReady(f),f.process()},t.handleHeartbeat=function(f,w){var N=w.fragment,o=N.getByte(),A=N.getInt16(),K=N.getBytes(A);if(o===t.HeartbeatMessageType.heartbeat_request){if(f.handshaking||A>K.length)return f.process();t.queue(f,t.createRecord(f,{type:t.ContentType.heartbeat,data:t.createHeartbeat(t.HeartbeatMessageType.heartbeat_response,K)})),t.flush(f)}else if(o===t.HeartbeatMessageType.heartbeat_response){if(K!==f.expectedHeartbeatPayload)return f.process();f.heartbeatReceived&&f.heartbeatReceived(f,a.util.createBuffer(K))}f.process()};var C=0,l=1,x=2,k=3,E=4,u=5,y=6,m=7,g=8,s=0,d=1,p=2,I=3,R=4,c=5,n=6,r=t.handleUnexpected,B=t.handleChangeCipherSpec,D=t.handleAlert,V=t.handleHandshake,L=t.handleApplicationData,O=t.handleHeartbeat,q=[];q[t.ConnectionEnd.client]=[[r,D,V,r,O],[r,D,V,r,O],[r,D,V,r,O],[r,D,V,r,O],[r,D,V,r,O],[B,D,r,r,O],[r,D,V,r,O],[r,D,V,L,O],[r,D,V,r,O]],q[t.ConnectionEnd.server]=[[r,D,V,r,O],[r,D,V,r,O],[r,D,V,r,O],[r,D,V,r,O],[B,D,r,r,O],[r,D,V,r,O],[r,D,V,L,O],[r,D,V,r,O]];var M=t.handleHelloRequest,H=t.handleServerHello,Y=t.handleCertificate,W=t.handleServerKeyExchange,$=t.handleCertificateRequest,ie=t.handleServerHelloDone,se=t.handleFinished,he=[];he[t.ConnectionEnd.client]=[[r,r,H,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r],[M,r,r,r,r,r,r,r,r,r,r,Y,W,$,ie,r,r,r,r,r,r],[M,r,r,r,r,r,r,r,r,r,r,r,W,$,ie,r,r,r,r,r,r],[M,r,r,r,r,r,r,r,r,r,r,r,r,$,ie,r,r,r,r,r,r],[M,r,r,r,r,r,r,r,r,r,r,r,r,r,ie,r,r,r,r,r,r],[M,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r],[M,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,se],[M,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r],[M,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r]];var ge=t.handleClientHello,j=t.handleClientKeyExchange,fe=t.handleCertificateVerify;he[t.ConnectionEnd.server]=[[r,ge,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r],[r,r,r,r,r,r,r,r,r,r,r,Y,r,r,r,r,r,r,r,r,r],[r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,j,r,r,r,r],[r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,fe,r,r,r,r,r],[r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r],[r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,se],[r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r],[r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r,r]],t.generateKeys=function(f,w){var N=e,o=w.client_random+w.server_random;f.session.resuming||(w.master_secret=N(w.pre_master_secret,"master secret",o,48).bytes(),w.pre_master_secret=null),o=w.server_random+w.client_random;var A=2*w.mac_key_length+2*w.enc_key_length,K=f.version.major===t.Versions.TLS_1_0.major&&f.version.minor===t.Versions.TLS_1_0.minor;K&&(A+=2*w.fixed_iv_length);var P=N(w.master_secret,"key expansion",o,A),z={client_write_MAC_key:P.getBytes(w.mac_key_length),server_write_MAC_key:P.getBytes(w.mac_key_length),client_write_key:P.getBytes(w.enc_key_length),server_write_key:P.getBytes(w.enc_key_length)};return K&&(z.client_write_IV=P.getBytes(w.fixed_iv_length),z.server_write_IV=P.getBytes(w.fixed_iv_length)),z},t.createConnectionState=function(f){var w=f.entity===t.ConnectionEnd.client,N=function(){var K={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(P){return!0},compressionState:null,compressFunction:function(P){return!0},updateSequenceNumber:function(){K.sequenceNumber[1]===4294967295?(K.sequenceNumber[1]=0,++K.sequenceNumber[0]):++K.sequenceNumber[1]}};return K},o={read:N(),write:N()};if(o.read.update=function(K,P){return o.read.cipherFunction(P,o.read)?o.read.compressFunction(K,P,o.read)||K.error(K,{message:"Could not decompress record.",send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.decompression_failure}}):K.error(K,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.bad_record_mac}}),!K.fail},o.write.update=function(K,P){return o.write.compressFunction(K,P,o.write)?o.write.cipherFunction(P,o.write)||K.error(K,{message:"Could not encrypt record.",send:!1,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.internal_error}}):K.error(K,{message:"Could not compress record.",send:!1,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.internal_error}}),!K.fail},f.session){var A=f.session.sp;switch(f.session.cipherSuite.initSecurityParameters(A),A.keys=t.generateKeys(f,A),o.read.macKey=w?A.keys.server_write_MAC_key:A.keys.client_write_MAC_key,o.write.macKey=w?A.keys.client_write_MAC_key:A.keys.server_write_MAC_key,f.session.cipherSuite.initConnectionState(o,f,A),A.compression_algorithm){case t.CompressionMethod.none:break;case t.CompressionMethod.deflate:o.read.compressFunction=_,o.write.compressFunction=v;break;default:throw new Error("Unsupported compression algorithm.")}}return o},t.createRandom=function(){var f=new Date,w=+f+f.getTimezoneOffset()*6e4,N=a.util.createBuffer();return N.putInt32(w),N.putBytes(a.random.getBytes(28)),N},t.createRecord=function(f,w){if(!w.data)return null;var N={type:w.type,version:{major:f.version.major,minor:f.version.minor},length:w.data.length(),fragment:w.data};return N},t.createAlert=function(f,w){var N=a.util.createBuffer();return N.putByte(w.level),N.putByte(w.description),t.createRecord(f,{type:t.ContentType.alert,data:N})},t.createClientHello=function(f){f.session.clientHelloVersion={major:f.version.major,minor:f.version.minor};for(var w=a.util.createBuffer(),N=0;N<f.cipherSuites.length;++N){var o=f.cipherSuites[N];w.putByte(o.id[0]),w.putByte(o.id[1])}var A=w.length(),K=a.util.createBuffer();K.putByte(t.CompressionMethod.none);var P=K.length(),z=a.util.createBuffer();if(f.virtualHost){var ee=a.util.createBuffer();ee.putByte(0),ee.putByte(0);var ae=a.util.createBuffer();ae.putByte(0),h(ae,2,a.util.createBuffer(f.virtualHost));var G=a.util.createBuffer();h(G,2,ae),h(ee,2,G),z.putBuffer(ee)}var te=z.length();te>0&&(te+=2);var ne=f.session.id,ce=ne.length+1+2+4+28+2+A+1+P+te,oe=a.util.createBuffer();return oe.putByte(t.HandshakeType.client_hello),oe.putInt24(ce),oe.putByte(f.version.major),oe.putByte(f.version.minor),oe.putBytes(f.session.sp.client_random),h(oe,1,a.util.createBuffer(ne)),h(oe,2,w),h(oe,1,K),te>0&&h(oe,2,z),oe},t.createServerHello=function(f){var w=f.session.id,N=w.length+1+2+4+28+2+1,o=a.util.createBuffer();return o.putByte(t.HandshakeType.server_hello),o.putInt24(N),o.putByte(f.version.major),o.putByte(f.version.minor),o.putBytes(f.session.sp.server_random),h(o,1,a.util.createBuffer(w)),o.putByte(f.session.cipherSuite.id[0]),o.putByte(f.session.cipherSuite.id[1]),o.putByte(f.session.compressionMethod),o},t.createCertificate=function(f){var w=f.entity===t.ConnectionEnd.client,N=null;if(f.getCertificate){var o;w?o=f.session.certificateRequest:o=f.session.extensions.server_name.serverNameList,N=f.getCertificate(f,o)}var A=a.util.createBuffer();if(N!==null)try{a.util.isArray(N)||(N=[N]);for(var K=null,P=0;P<N.length;++P){var z=a.pem.decode(N[P])[0];if(z.type!=="CERTIFICATE"&&z.type!=="X509 CERTIFICATE"&&z.type!=="TRUSTED CERTIFICATE"){var ee=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw ee.headerType=z.type,ee}if(z.procType&&z.procType.type==="ENCRYPTED")throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var ae=a.util.createBuffer(z.body);K===null&&(K=a.asn1.fromDer(ae.bytes(),!1));var G=a.util.createBuffer();h(G,3,ae),A.putBuffer(G)}N=a.pki.certificateFromAsn1(K),w?f.session.clientCertificate=N:f.session.serverCertificate=N}catch(ce){return f.error(f,{message:"Could not send certificate list.",cause:ce,send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.bad_certificate}})}var te=3+A.length(),ne=a.util.createBuffer();return ne.putByte(t.HandshakeType.certificate),ne.putInt24(te),h(ne,3,A),ne},t.createClientKeyExchange=function(f){var w=a.util.createBuffer();w.putByte(f.session.clientHelloVersion.major),w.putByte(f.session.clientHelloVersion.minor),w.putBytes(a.random.getBytes(46));var N=f.session.sp;N.pre_master_secret=w.getBytes();var o=f.session.serverCertificate.publicKey;w=o.encrypt(N.pre_master_secret);var A=w.length+2,K=a.util.createBuffer();return K.putByte(t.HandshakeType.client_key_exchange),K.putInt24(A),K.putInt16(w.length),K.putBytes(w),K},t.createServerKeyExchange=function(f){var w=a.util.createBuffer();return w},t.getClientSignature=function(f,w){var N=a.util.createBuffer();N.putBuffer(f.session.md5.digest()),N.putBuffer(f.session.sha1.digest()),N=N.getBytes(),f.getSignature=f.getSignature||function(o,A,K){var P=null;if(o.getPrivateKey)try{P=o.getPrivateKey(o,o.session.clientCertificate),P=a.pki.privateKeyFromPem(P)}catch(z){o.error(o,{message:"Could not get private key.",cause:z,send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.internal_error}})}P===null?o.error(o,{message:"No private key set.",send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.internal_error}}):A=P.sign(A,null),K(o,A)},f.getSignature(f,N,w)},t.createCertificateVerify=function(f,w){var N=w.length+2,o=a.util.createBuffer();return o.putByte(t.HandshakeType.certificate_verify),o.putInt24(N),o.putInt16(w.length),o.putBytes(w),o},t.createCertificateRequest=function(f){var w=a.util.createBuffer();w.putByte(1);var N=a.util.createBuffer();for(var o in f.caStore.certs){var A=f.caStore.certs[o],K=a.pki.distinguishedNameToAsn1(A.subject),P=a.asn1.toDer(K);N.putInt16(P.length()),N.putBuffer(P)}var z=1+w.length()+2+N.length(),ee=a.util.createBuffer();return ee.putByte(t.HandshakeType.certificate_request),ee.putInt24(z),h(ee,1,w),h(ee,2,N),ee},t.createServerHelloDone=function(f){var w=a.util.createBuffer();return w.putByte(t.HandshakeType.server_hello_done),w.putInt24(0),w},t.createChangeCipherSpec=function(){var f=a.util.createBuffer();return f.putByte(1),f},t.createFinished=function(f){var w=a.util.createBuffer();w.putBuffer(f.session.md5.digest()),w.putBuffer(f.session.sha1.digest());var N=f.entity===t.ConnectionEnd.client,o=f.session.sp,A=12,K=e,P=N?"client finished":"server finished";w=K(o.master_secret,P,w.getBytes(),A);var z=a.util.createBuffer();return z.putByte(t.HandshakeType.finished),z.putInt24(w.length()),z.putBuffer(w),z},t.createHeartbeat=function(f,w,N){typeof N>"u"&&(N=w.length);var o=a.util.createBuffer();o.putByte(f),o.putInt16(N),o.putBytes(w);var A=o.length(),K=Math.max(16,A-N-3);return o.putBytes(a.random.getBytes(K)),o},t.queue=function(f,w){if(w&&!(w.fragment.length()===0&&(w.type===t.ContentType.handshake||w.type===t.ContentType.alert||w.type===t.ContentType.change_cipher_spec))){if(w.type===t.ContentType.handshake){var N=w.fragment.bytes();f.session.md5.update(N),f.session.sha1.update(N),N=null}var o;if(w.fragment.length()<=t.MaxFragment)o=[w];else{o=[];for(var A=w.fragment.bytes();A.length>t.MaxFragment;)o.push(t.createRecord(f,{type:w.type,data:a.util.createBuffer(A.slice(0,t.MaxFragment))})),A=A.slice(t.MaxFragment);A.length>0&&o.push(t.createRecord(f,{type:w.type,data:a.util.createBuffer(A)}))}for(var K=0;K<o.length&&!f.fail;++K){var P=o[K],z=f.state.current.write;z.update(f,P)&&f.records.push(P)}}},t.flush=function(f){for(var w=0;w<f.records.length;++w){var N=f.records[w];f.tlsData.putByte(N.type),f.tlsData.putByte(N.version.major),f.tlsData.putByte(N.version.minor),f.tlsData.putInt16(N.fragment.length()),f.tlsData.putBuffer(f.records[w].fragment)}return f.records=[],f.tlsDataReady(f)};var Z=function(f){switch(f){case!0:return!0;case a.pki.certificateError.bad_certificate:return t.Alert.Description.bad_certificate;case a.pki.certificateError.unsupported_certificate:return t.Alert.Description.unsupported_certificate;case a.pki.certificateError.certificate_revoked:return t.Alert.Description.certificate_revoked;case a.pki.certificateError.certificate_expired:return t.Alert.Description.certificate_expired;case a.pki.certificateError.certificate_unknown:return t.Alert.Description.certificate_unknown;case a.pki.certificateError.unknown_ca:return t.Alert.Description.unknown_ca;default:return t.Alert.Description.bad_certificate}},qe=function(f){switch(f){case!0:return!0;case t.Alert.Description.bad_certificate:return a.pki.certificateError.bad_certificate;case t.Alert.Description.unsupported_certificate:return a.pki.certificateError.unsupported_certificate;case t.Alert.Description.certificate_revoked:return a.pki.certificateError.certificate_revoked;case t.Alert.Description.certificate_expired:return a.pki.certificateError.certificate_expired;case t.Alert.Description.certificate_unknown:return a.pki.certificateError.certificate_unknown;case t.Alert.Description.unknown_ca:return a.pki.certificateError.unknown_ca;default:return a.pki.certificateError.bad_certificate}};t.verifyCertificateChain=function(f,w){try{var N={};for(var o in f.verifyOptions)N[o]=f.verifyOptions[o];N.verify=function(K,P,z){var ee=Z(K),ae=f.verify(f,K,P,z);if(ae!==!0){if(typeof ae=="object"&&!a.util.isArray(ae)){var G=new Error("The application rejected the certificate.");throw G.send=!0,G.alert={level:t.Alert.Level.fatal,description:t.Alert.Description.bad_certificate},ae.message&&(G.message=ae.message),ae.alert&&(G.alert.description=ae.alert),G}ae!==K&&(ae=qe(ae))}return ae},a.pki.verifyCertificateChain(f.caStore,w,N)}catch(K){var A=K;(typeof A!="object"||a.util.isArray(A))&&(A={send:!0,alert:{level:t.Alert.Level.fatal,description:Z(K)}}),"send"in A||(A.send=!0),"alert"in A||(A.alert={level:t.Alert.Level.fatal,description:Z(A.error)}),f.error(f,A)}return!f.fail},t.createSessionCache=function(f,w){var N=null;if(f&&f.getSession&&f.setSession&&f.order)N=f;else{N={},N.cache=f||{},N.capacity=Math.max(w||100,1),N.order=[];for(var o in f)N.order.length<=w?N.order.push(o):delete f[o];N.getSession=function(A){var K=null,P=null;if(A?P=a.util.bytesToHex(A):N.order.length>0&&(P=N.order[0]),P!==null&&P in N.cache){K=N.cache[P],delete N.cache[P];for(var z in N.order)if(N.order[z]===P){N.order.splice(z,1);break}}return K},N.setSession=function(A,K){if(N.order.length===N.capacity){var P=N.order.shift();delete N.cache[P]}var P=a.util.bytesToHex(A);N.order.push(P),N.cache[P]=K}}return N},t.createConnection=function(f){var w=null;f.caStore?a.util.isArray(f.caStore)?w=a.pki.createCaStore(f.caStore):w=f.caStore:w=a.pki.createCaStore();var N=f.cipherSuites||null;if(N===null){N=[];for(var o in t.CipherSuites)N.push(t.CipherSuites[o])}var A=f.server?t.ConnectionEnd.server:t.ConnectionEnd.client,K=f.sessionCache?t.createSessionCache(f.sessionCache):null,P={version:{major:t.Version.major,minor:t.Version.minor},entity:A,sessionId:f.sessionId,caStore:w,sessionCache:K,cipherSuites:N,connected:f.connected,virtualHost:f.virtualHost||null,verifyClient:f.verifyClient||!1,verify:f.verify||function(G,te,ne,ce){return te},verifyOptions:f.verifyOptions||{},getCertificate:f.getCertificate||null,getPrivateKey:f.getPrivateKey||null,getSignature:f.getSignature||null,input:a.util.createBuffer(),tlsData:a.util.createBuffer(),data:a.util.createBuffer(),tlsDataReady:f.tlsDataReady,dataReady:f.dataReady,heartbeatReceived:f.heartbeatReceived,closed:f.closed,error:function(G,te){te.origin=te.origin||(G.entity===t.ConnectionEnd.client?"client":"server"),te.send&&(t.queue(G,t.createAlert(G,te.alert)),t.flush(G));var ne=te.fatal!==!1;ne&&(G.fail=!0),f.error(G,te),ne&&G.close(!1)},deflate:f.deflate||null,inflate:f.inflate||null};P.reset=function(G){P.version={major:t.Version.major,minor:t.Version.minor},P.record=null,P.session=null,P.peerCertificate=null,P.state={pending:null,current:null},P.expect=P.entity===t.ConnectionEnd.client?C:s,P.fragmented=null,P.records=[],P.open=!1,P.handshakes=0,P.handshaking=!1,P.isConnected=!1,P.fail=!(G||typeof G>"u"),P.input.clear(),P.tlsData.clear(),P.data.clear(),P.state.current=t.createConnectionState(P)},P.reset();var z=function(G,te){var ne=te.type-t.ContentType.change_cipher_spec,ce=q[G.entity][G.expect];ne in ce?ce[ne](G,te):t.handleUnexpected(G,te)},ee=function(G){var te=0,ne=G.input,ce=ne.length();if(ce<5)te=5-ce;else{G.record={type:ne.getByte(),version:{major:ne.getByte(),minor:ne.getByte()},length:ne.getInt16(),fragment:a.util.createBuffer(),ready:!1};var oe=G.record.version.major===G.version.major;oe&&G.session&&G.session.version&&(oe=G.record.version.minor===G.version.minor),oe||G.error(G,{message:"Incompatible TLS version.",send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.protocol_version}})}return te},ae=function(G){var te=0,ne=G.input,ce=ne.length();if(ce<G.record.length)te=G.record.length-ce;else{G.record.fragment.putBytes(ne.getBytes(G.record.length)),ne.compact();var oe=G.state.current.read;oe.update(G,G.record)&&(G.fragmented!==null&&(G.fragmented.type===G.record.type?(G.fragmented.fragment.putBuffer(G.record.fragment),G.record=G.fragmented):G.error(G,{message:"Invalid fragmented record.",send:!0,alert:{level:t.Alert.Level.fatal,description:t.Alert.Description.unexpected_message}})),G.record.ready=!0)}return te};return P.handshake=function(G){if(P.entity!==t.ConnectionEnd.client)P.error(P,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(P.handshaking)P.error(P,{message:"Handshake already in progress.",fatal:!1});else{P.fail&&!P.open&&P.handshakes===0&&(P.fail=!1),P.handshaking=!0,G=G||"";var te=null;G.length>0&&(P.sessionCache&&(te=P.sessionCache.getSession(G)),te===null&&(G="")),G.length===0&&P.sessionCache&&(te=P.sessionCache.getSession(),te!==null&&(G=te.id)),P.session={id:G,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:a.md.md5.create(),sha1:a.md.sha1.create()},te&&(P.version=te.version,P.session.sp=te.sp),P.session.sp.client_random=t.createRandom().getBytes(),P.open=!0,t.queue(P,t.createRecord(P,{type:t.ContentType.handshake,data:t.createClientHello(P)})),t.flush(P)}},P.process=function(G){var te=0;return G&&P.input.putBytes(G),P.fail||(P.record!==null&&P.record.ready&&P.record.fragment.isEmpty()&&(P.record=null),P.record===null&&(te=ee(P)),!P.fail&&P.record!==null&&!P.record.ready&&(te=ae(P)),!P.fail&&P.record!==null&&P.record.ready&&z(P,P.record)),te},P.prepare=function(G){return t.queue(P,t.createRecord(P,{type:t.ContentType.application_data,data:a.util.createBuffer(G)})),t.flush(P)},P.prepareHeartbeatRequest=function(G,te){return G instanceof a.util.ByteBuffer&&(G=G.bytes()),typeof te>"u"&&(te=G.length),P.expectedHeartbeatPayload=G,t.queue(P,t.createRecord(P,{type:t.ContentType.heartbeat,data:t.createHeartbeat(t.HeartbeatMessageType.heartbeat_request,G,te)})),t.flush(P)},P.close=function(G){if(!P.fail&&P.sessionCache&&P.session){var te={id:P.session.id,version:P.session.version,sp:P.session.sp};te.sp.keys=null,P.sessionCache.setSession(te.id,te)}P.open&&(P.open=!1,P.input.clear(),(P.isConnected||P.handshaking)&&(P.isConnected=P.handshaking=!1,t.queue(P,t.createAlert(P,{level:t.Alert.Level.warning,description:t.Alert.Description.close_notify})),t.flush(P)),P.closed(P)),P.reset(G)},P},ur=a.tls=a.tls||{};for(var le in t)typeof t[le]!="function"&&(a.tls[le]=t[le]);return a.tls.prf_tls1=e,a.tls.hmac_sha1=i,a.tls.createSessionCache=t.createSessionCache,a.tls.createConnection=t.createConnection,ur}var ua;function ba(){if(ua)return Dt.exports;ua=1;var a=ue();ot(),oa();var e=Dt.exports=a.tls;e.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(C){C.bulk_cipher_algorithm=e.BulkCipherAlgorithm.aes,C.cipher_type=e.CipherType.block,C.enc_key_length=16,C.block_length=16,C.fixed_iv_length=16,C.record_iv_length=16,C.mac_algorithm=e.MACAlgorithm.hmac_sha1,C.mac_length=20,C.mac_key_length=20},initConnectionState:i},e.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(C){C.bulk_cipher_algorithm=e.BulkCipherAlgorithm.aes,C.cipher_type=e.CipherType.block,C.enc_key_length=32,C.block_length=16,C.fixed_iv_length=16,C.record_iv_length=16,C.mac_algorithm=e.MACAlgorithm.hmac_sha1,C.mac_length=20,C.mac_key_length=20},initConnectionState:i};function i(C,l,x){var k=l.entity===a.tls.ConnectionEnd.client;C.read.cipherState={init:!1,cipher:a.cipher.createDecipher("AES-CBC",k?x.keys.server_write_key:x.keys.client_write_key),iv:k?x.keys.server_write_IV:x.keys.client_write_IV},C.write.cipherState={init:!1,cipher:a.cipher.createCipher("AES-CBC",k?x.keys.client_write_key:x.keys.server_write_key),iv:k?x.keys.client_write_IV:x.keys.server_write_IV},C.read.cipherFunction=h,C.write.cipherFunction=v,C.read.macLength=C.write.macLength=x.mac_length,C.read.macFunction=C.write.macFunction=e.hmac_sha1}function v(C,l){var x=!1,k=l.macFunction(l.macKey,l.sequenceNumber,C);C.fragment.putBytes(k),l.updateSequenceNumber();var E;C.version.minor===e.Versions.TLS_1_0.minor?E=l.cipherState.init?null:l.cipherState.iv:E=a.random.getBytesSync(16),l.cipherState.init=!0;var u=l.cipherState.cipher;return u.start({iv:E}),C.version.minor>=e.Versions.TLS_1_1.minor&&u.output.putBytes(E),u.update(C.fragment),u.finish(_)&&(C.fragment=u.output,C.length=C.fragment.length(),x=!0),x}function _(C,l,x){if(!x){var k=C-l.length()%C;l.fillWithByte(k-1,k)}return!0}function S(C,l,x){var k=!0;if(x){for(var E=l.length(),u=l.last(),y=E-1-u;y<E-1;++y)k=k&&l.at(y)==u;k&&l.truncate(u+1)}return k}function h(C,l){var x=!1,k;C.version.minor===e.Versions.TLS_1_0.minor?k=l.cipherState.init?null:l.cipherState.iv:k=C.fragment.getBytes(16),l.cipherState.init=!0;var E=l.cipherState.cipher;E.start({iv:k}),E.update(C.fragment),x=E.finish(S);var u=l.macLength,y=a.random.getBytesSync(u),m=E.output.length();m>=u?(C.fragment=E.output.getBytes(m-u),y=E.output.getBytes(u)):C.fragment=E.output.getBytes(),C.fragment=a.util.createBuffer(C.fragment),C.length=C.fragment.length();var g=l.macFunction(l.macKey,l.sequenceNumber,C);return l.updateSequenceNumber(),x=t(l.macKey,y,g)&&x,x}function t(C,l,x){var k=a.hmac.create();return k.start("SHA1",C),k.update(l),l=k.digest().getBytes(),k.start(null,null),k.update(x),x=k.digest().getBytes(),l===x}return Dt.exports}var fr={exports:{}},fa;function la(){if(fa)return fr.exports;fa=1;var a=ue();rt(),de();var e=fr.exports=a.sha512=a.sha512||{};a.md.sha512=a.md.algorithms.sha512=e;var i=a.sha384=a.sha512.sha384=a.sha512.sha384||{};i.create=function(){return e.create("SHA-384")},a.md.sha384=a.md.algorithms.sha384=i,a.sha512.sha256=a.sha512.sha256||{create:function(){return e.create("SHA-512/256")}},a.md["sha512/256"]=a.md.algorithms["sha512/256"]=a.sha512.sha256,a.sha512.sha224=a.sha512.sha224||{create:function(){return e.create("SHA-512/224")}},a.md["sha512/224"]=a.md.algorithms["sha512/224"]=a.sha512.sha224,e.create=function(l){if(_||t(),typeof l>"u"&&(l="SHA-512"),!(l in h))throw new Error("Invalid SHA-512 algorithm: "+l);for(var x=h[l],k=null,E=a.util.createBuffer(),u=new Array(80),y=0;y<80;++y)u[y]=new Array(2);var m=64;switch(l){case"SHA-384":m=48;break;case"SHA-512/256":m=32;break;case"SHA-512/224":m=28;break}var g={algorithm:l.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,d=0;d<s;++d)g.fullMessageLength.push(0);E=a.util.createBuffer(),k=new Array(x.length);for(var d=0;d<x.length;++d)k[d]=x[d].slice(0);return g},g.start(),g.update=function(s,d){d==="utf8"&&(s=a.util.encodeUtf8(s));var p=s.length;g.messageLength+=p,p=[p/4294967296>>>0,p>>>0];for(var I=g.fullMessageLength.length-1;I>=0;--I)g.fullMessageLength[I]+=p[1],p[1]=p[0]+(g.fullMessageLength[I]/4294967296>>>0),g.fullMessageLength[I]=g.fullMessageLength[I]>>>0,p[0]=p[1]/4294967296>>>0;return E.putBytes(s),C(k,u,E),(E.read>2048||E.length()===0)&&E.compact(),g},g.digest=function(){var s=a.util.createBuffer();s.putBytes(E.bytes());var d=g.fullMessageLength[g.fullMessageLength.length-1]+g.messageLengthSize,p=d&g.blockLength-1;s.putBytes(v.substr(0,g.blockLength-p));for(var I,R,c=g.fullMessageLength[0]*8,n=0;n<g.fullMessageLength.length-1;++n)I=g.fullMessageLength[n+1]*8,R=I/4294967296>>>0,c+=R,s.putInt32(c>>>0),c=I>>>0;s.putInt32(c);for(var r=new Array(k.length),n=0;n<k.length;++n)r[n]=k[n].slice(0);C(r,u,s);var B=a.util.createBuffer(),D;l==="SHA-512"?D=r.length:l==="SHA-384"?D=r.length-2:D=r.length-4;for(var n=0;n<D;++n)B.putInt32(r[n][0]),(n!==D-1||l!=="SHA-512/224")&&B.putInt32(r[n][1]);return B},g};var v=null,_=!1,S=null,h=null;function t(){v="€",v+=a.util.fillString("\0",128),S=[[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]],h={},h["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],h["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],h["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],h["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],_=!0}function C(l,x,k){for(var E,u,y,m,g,s,d,p,I,R,c,n,r,B,D,V,L,O,q,M,H,Y,W,$,ie,se,he,ge,j,fe,Z,qe,le,f,w,N=k.length();N>=128;){for(j=0;j<16;++j)x[j][0]=k.getInt32()>>>0,x[j][1]=k.getInt32()>>>0;for(;j<80;++j)qe=x[j-2],fe=qe[0],Z=qe[1],E=((fe>>>19|Z<<13)^(Z>>>29|fe<<3)^fe>>>6)>>>0,u=((fe<<13|Z>>>19)^(Z<<3|fe>>>29)^(fe<<26|Z>>>6))>>>0,f=x[j-15],fe=f[0],Z=f[1],y=((fe>>>1|Z<<31)^(fe>>>8|Z<<24)^fe>>>7)>>>0,m=((fe<<31|Z>>>1)^(fe<<24|Z>>>8)^(fe<<25|Z>>>7))>>>0,le=x[j-7],w=x[j-16],Z=u+le[1]+m+w[1],x[j][0]=E+le[0]+y+w[0]+(Z/4294967296>>>0)>>>0,x[j][1]=Z>>>0;for(r=l[0][0],B=l[0][1],D=l[1][0],V=l[1][1],L=l[2][0],O=l[2][1],q=l[3][0],M=l[3][1],H=l[4][0],Y=l[4][1],W=l[5][0],$=l[5][1],ie=l[6][0],se=l[6][1],he=l[7][0],ge=l[7][1],j=0;j<80;++j)d=((H>>>14|Y<<18)^(H>>>18|Y<<14)^(Y>>>9|H<<23))>>>0,p=((H<<18|Y>>>14)^(H<<14|Y>>>18)^(Y<<23|H>>>9))>>>0,I=(ie^H&(W^ie))>>>0,R=(se^Y&($^se))>>>0,g=((r>>>28|B<<4)^(B>>>2|r<<30)^(B>>>7|r<<25))>>>0,s=((r<<4|B>>>28)^(B<<30|r>>>2)^(B<<25|r>>>7))>>>0,c=(r&D|L&(r^D))>>>0,n=(B&V|O&(B^V))>>>0,Z=ge+p+R+S[j][1]+x[j][1],E=he+d+I+S[j][0]+x[j][0]+(Z/4294967296>>>0)>>>0,u=Z>>>0,Z=s+n,y=g+c+(Z/4294967296>>>0)>>>0,m=Z>>>0,he=ie,ge=se,ie=W,se=$,W=H,$=Y,Z=M+u,H=q+E+(Z/4294967296>>>0)>>>0,Y=Z>>>0,q=L,M=O,L=D,O=V,D=r,V=B,Z=u+m,r=E+y+(Z/4294967296>>>0)>>>0,B=Z>>>0;Z=l[0][1]+B,l[0][0]=l[0][0]+r+(Z/4294967296>>>0)>>>0,l[0][1]=Z>>>0,Z=l[1][1]+V,l[1][0]=l[1][0]+D+(Z/4294967296>>>0)>>>0,l[1][1]=Z>>>0,Z=l[2][1]+O,l[2][0]=l[2][0]+L+(Z/4294967296>>>0)>>>0,l[2][1]=Z>>>0,Z=l[3][1]+M,l[3][0]=l[3][0]+q+(Z/4294967296>>>0)>>>0,l[3][1]=Z>>>0,Z=l[4][1]+Y,l[4][0]=l[4][0]+H+(Z/4294967296>>>0)>>>0,l[4][1]=Z>>>0,Z=l[5][1]+$,l[5][0]=l[5][0]+W+(Z/4294967296>>>0)>>>0,l[5][1]=Z>>>0,Z=l[6][1]+se,l[6][0]=l[6][0]+ie+(Z/4294967296>>>0)>>>0,l[6][1]=Z>>>0,Z=l[7][1]+ge,l[7][0]=l[7][0]+he+(Z/4294967296>>>0)>>>0,l[7][1]=Z>>>0,N-=128}}return fr.exports}var St={},ca;function _a(){if(ca)return St;ca=1;var a=ue();et();var e=a.asn1;return St.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"}]},St.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"}]},St}var lr,ha;function Na(){if(ha)return lr;ha=1;var a=ue();mt(),We(),la(),de();var e=_a(),i=e.publicKeyValidator,v=e.privateKeyValidator;if(typeof _>"u")var _=a.jsbn.BigInteger;var S=a.util.ByteBuffer,h=typeof Buffer>"u"?Uint8Array:Buffer;a.pki=a.pki||{},lr=a.pki.ed25519=a.ed25519=a.ed25519||{};var t=a.ed25519;t.constants={},t.constants.PUBLIC_KEY_BYTE_LENGTH=32,t.constants.PRIVATE_KEY_BYTE_LENGTH=64,t.constants.SEED_BYTE_LENGTH=32,t.constants.SIGN_BYTE_LENGTH=64,t.constants.HASH_BYTE_LENGTH=64,t.generateKeyPair=function(f){f=f||{};var w=f.seed;if(w===void 0)w=a.random.getBytesSync(t.constants.SEED_BYTE_LENGTH);else if(typeof w=="string"){if(w.length!==t.constants.SEED_BYTE_LENGTH)throw new TypeError('"seed" must be '+t.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=C({message:w,encoding:"binary"});for(var N=new h(t.constants.PUBLIC_KEY_BYTE_LENGTH),o=new h(t.constants.PRIVATE_KEY_BYTE_LENGTH),A=0;A<32;++A)o[A]=w[A];return d(N,o),{publicKey:N,privateKey:o}},t.privateKeyFromAsn1=function(f){var w={},N=[],o=a.asn1.validate(f,v,w,N);if(!o){var A=new Error("Invalid Key.");throw A.errors=N,A}var K=a.asn1.derToOid(w.privateKeyOid),P=a.oids.EdDSA25519;if(K!==P)throw new Error('Invalid OID "'+K+'"; OID must be "'+P+'".');var z=w.privateKey,ee=C({message:a.asn1.fromDer(z).value,encoding:"binary"});return{privateKeyBytes:ee}},t.publicKeyFromAsn1=function(f){var w={},N=[],o=a.asn1.validate(f,i,w,N);if(!o){var A=new Error("Invalid Key.");throw A.errors=N,A}var K=a.asn1.derToOid(w.publicKeyOid),P=a.oids.EdDSA25519;if(K!==P)throw new Error('Invalid OID "'+K+'"; OID must be "'+P+'".');var z=w.ed25519PublicKey;if(z.length!==t.constants.PUBLIC_KEY_BYTE_LENGTH)throw new Error("Key length is invalid.");return C({message:z,encoding:"binary"})},t.publicKeyFromPrivateKey=function(f){f=f||{};var w=C({message:f.privateKey,encoding:"binary"});if(w.length!==t.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+t.constants.PRIVATE_KEY_BYTE_LENGTH);for(var N=new h(t.constants.PUBLIC_KEY_BYTE_LENGTH),o=0;o<N.length;++o)N[o]=w[32+o];return N},t.sign=function(f){f=f||{};var w=C(f),N=C({message:f.privateKey,encoding:"binary"});if(N.length===t.constants.SEED_BYTE_LENGTH){var o=t.generateKeyPair({seed:N});N=o.privateKey}else if(N.length!==t.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+t.constants.SEED_BYTE_LENGTH+" or "+t.constants.PRIVATE_KEY_BYTE_LENGTH);var A=new h(t.constants.SIGN_BYTE_LENGTH+w.length);p(A,w,w.length,N);for(var K=new h(t.constants.SIGN_BYTE_LENGTH),P=0;P<K.length;++P)K[P]=A[P];return K},t.verify=function(f){f=f||{};var w=C(f);if(f.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=C({message:f.signature,encoding:"binary"});if(N.length!==t.constants.SIGN_BYTE_LENGTH)throw new TypeError('"options.signature" must have a byte length of '+t.constants.SIGN_BYTE_LENGTH);var o=C({message:f.publicKey,encoding:"binary"});if(o.length!==t.constants.PUBLIC_KEY_BYTE_LENGTH)throw new TypeError('"options.publicKey" must have a byte length of '+t.constants.PUBLIC_KEY_BYTE_LENGTH);var A=new h(t.constants.SIGN_BYTE_LENGTH+w.length),K=new h(t.constants.SIGN_BYTE_LENGTH+w.length),P;for(P=0;P<t.constants.SIGN_BYTE_LENGTH;++P)A[P]=N[P];for(P=0;P<w.length;++P)A[P+t.constants.SIGN_BYTE_LENGTH]=w[P];return I(K,A,A.length,o)>=0};function C(f){var w=f.message;if(w instanceof Uint8Array||w instanceof h)return w;var N=f.encoding;if(w===void 0)if(f.md)w=f.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 S(w,N)}else if(!(w instanceof S))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 h(w.length()),A=0;A<o.length;++A)o[A]=w.at(A);return o}var l=j(),x=j([1]),k=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]),u=j([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),y=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(f,w){var N=a.md.sha512.create(),o=new S(f);N.update(o.getBytes(w),"binary");var A=N.digest().getBytes();if(typeof Buffer<"u")return Buffer.from(A,"binary");for(var K=new h(t.constants.HASH_BYTE_LENGTH),P=0;P<64;++P)K[P]=A.charCodeAt(P);return K}function d(f,w){var N=[j(),j(),j(),j()],o,A=s(w,32);for(A[0]&=248,A[31]&=127,A[31]|=64,$(N,A),B(f,N),o=0;o<32;++o)w[o+32]=f[o];return 0}function p(f,w,N,o){var A,K,P=new Float64Array(64),z=[j(),j(),j(),j()],ee=s(o,32);ee[0]&=248,ee[31]&=127,ee[31]|=64;var ae=N+64;for(A=0;A<N;++A)f[64+A]=w[A];for(A=0;A<32;++A)f[32+A]=ee[32+A];var G=s(f.subarray(32),N+32);for(c(G),$(z,G),B(f,z),A=32;A<64;++A)f[A]=o[A];var te=s(f,N+64);for(c(te),A=32;A<64;++A)P[A]=0;for(A=0;A<32;++A)P[A]=G[A];for(A=0;A<32;++A)for(K=0;K<32;K++)P[A+K]+=te[A]*ee[K];return R(f.subarray(32),P),ae}function I(f,w,N,o){var A,K,P=new h(32),z=[j(),j(),j(),j()],ee=[j(),j(),j(),j()];if(K=-1,N<64||V(ee,o))return-1;for(A=0;A<N;++A)f[A]=w[A];for(A=0;A<32;++A)f[A+32]=o[A];var ae=s(f,N);if(c(ae),W(z,ee,ae),$(ee,w.subarray(32)),n(z,ee),B(P,z),N-=64,M(w,0,P,0)){for(A=0;A<N;++A)f[A]=0;return-1}for(A=0;A<N;++A)f[A]=w[A+64];return K=N,K}function R(f,w){var N,o,A,K;for(o=63;o>=32;--o){for(N=0,A=o-32,K=o-12;A<K;++A)w[A]+=N-16*w[o]*m[A-(o-32)],N=w[A]+128>>8,w[A]-=N*256;w[A]+=N,w[o]=0}for(N=0,A=0;A<32;++A)w[A]+=N-(w[31]>>4)*m[A],N=w[A]>>8,w[A]&=255;for(A=0;A<32;++A)w[A]-=N*m[A];for(o=0;o<32;++o)w[o+1]+=w[o]>>8,f[o]=w[o]&255}function c(f){for(var w=new Float64Array(64),N=0;N<64;++N)w[N]=f[N],f[N]=0;R(f,w)}function n(f,w){var N=j(),o=j(),A=j(),K=j(),P=j(),z=j(),ee=j(),ae=j(),G=j();Z(N,f[1],f[0]),Z(G,w[1],w[0]),le(N,N,G),fe(o,f[0],f[1]),fe(G,w[0],w[1]),le(o,o,G),le(A,f[3],w[3]),le(A,A,E),le(K,f[2],w[2]),fe(K,K,K),Z(P,o,N),Z(z,K,A),fe(ee,K,A),fe(ae,o,N),le(f[0],P,z),le(f[1],ae,ee),le(f[2],ee,z),le(f[3],P,ae)}function r(f,w,N){for(var o=0;o<4;++o)ge(f[o],w[o],N)}function B(f,w){var N=j(),o=j(),A=j();se(A,w[2]),le(N,w[0],A),le(o,w[1],A),D(f,o),f[31]^=Y(N)<<7}function D(f,w){var N,o,A,K=j(),P=j();for(N=0;N<16;++N)P[N]=w[N];for(he(P),he(P),he(P),o=0;o<2;++o){for(K[0]=P[0]-65517,N=1;N<15;++N)K[N]=P[N]-65535-(K[N-1]>>16&1),K[N-1]&=65535;K[15]=P[15]-32767-(K[14]>>16&1),A=K[15]>>16&1,K[14]&=65535,ge(P,K,1-A)}for(N=0;N<16;N++)f[2*N]=P[N]&255,f[2*N+1]=P[N]>>8}function V(f,w){var N=j(),o=j(),A=j(),K=j(),P=j(),z=j(),ee=j();return ie(f[2],x),L(f[1],w),qe(A,f[1]),le(K,A,k),Z(A,A,f[2]),fe(K,f[2],K),qe(P,K),qe(z,P),le(ee,z,P),le(N,ee,A),le(N,N,K),O(N,N),le(N,N,A),le(N,N,K),le(N,N,K),le(f[0],N,K),qe(o,f[0]),le(o,o,K),q(o,A)&&le(f[0],f[0],g),qe(o,f[0]),le(o,o,K),q(o,A)?-1:(Y(f[0])===w[31]>>7&&Z(f[0],l,f[0]),le(f[3],f[0],f[1]),0)}function L(f,w){var N;for(N=0;N<16;++N)f[N]=w[2*N]+(w[2*N+1]<<8);f[15]&=32767}function O(f,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&&le(N,N,w);for(o=0;o<16;++o)f[o]=N[o]}function q(f,w){var N=new h(32),o=new h(32);return D(N,f),D(o,w),M(N,0,o,0)}function M(f,w,N,o){return H(f,w,N,o,32)}function H(f,w,N,o,A){var K,P=0;for(K=0;K<A;++K)P|=f[w+K]^N[o+K];return(1&P-1>>>8)-1}function Y(f){var w=new h(32);return D(w,f),w[0]&1}function W(f,w,N){var o,A;for(ie(f[0],l),ie(f[1],x),ie(f[2],x),ie(f[3],l),A=255;A>=0;--A)o=N[A/8|0]>>(A&7)&1,r(f,w,o),n(w,f),n(f,f),r(f,w,o)}function $(f,w){var N=[j(),j(),j(),j()];ie(N[0],u),ie(N[1],y),ie(N[2],x),le(N[3],u,y),W(f,N,w)}function ie(f,w){var N;for(N=0;N<16;N++)f[N]=w[N]|0}function se(f,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&&le(N,N,w);for(o=0;o<16;++o)f[o]=N[o]}function he(f){var w,N,o=1;for(w=0;w<16;++w)N=f[w]+o+65535,o=Math.floor(N/65536),f[w]=N-o*65536;f[0]+=o-1+37*(o-1)}function ge(f,w,N){for(var o,A=~(N-1),K=0;K<16;++K)o=A&(f[K]^w[K]),f[K]^=o,w[K]^=o}function j(f){var w,N=new Float64Array(16);if(f)for(w=0;w<f.length;++w)N[w]=f[w];return N}function fe(f,w,N){for(var o=0;o<16;++o)f[o]=w[o]+N[o]}function Z(f,w,N){for(var o=0;o<16;++o)f[o]=w[o]-N[o]}function qe(f,w){le(f,w,w)}function le(f,w,N){var o,A,K=0,P=0,z=0,ee=0,ae=0,G=0,te=0,ne=0,ce=0,oe=0,Ce=0,Se=0,xe=0,me=0,ve=0,ye=0,Te=0,Fe=0,Me=0,He=0,Ge=0,Qe=0,Ye=0,je=0,tt=0,at=0,nt=0,ft=0,ht=0,yt=0,Tt=0,Ae=N[0],Be=N[1],be=N[2],_e=N[3],Ne=N[4],Re=N[5],we=N[6],Le=N[7],De=N[8],ke=N[9],Ue=N[10],Pe=N[11],Ee=N[12],Ie=N[13],Ve=N[14],Oe=N[15];o=w[0],K+=o*Ae,P+=o*Be,z+=o*be,ee+=o*_e,ae+=o*Ne,G+=o*Re,te+=o*we,ne+=o*Le,ce+=o*De,oe+=o*ke,Ce+=o*Ue,Se+=o*Pe,xe+=o*Ee,me+=o*Ie,ve+=o*Ve,ye+=o*Oe,o=w[1],P+=o*Ae,z+=o*Be,ee+=o*be,ae+=o*_e,G+=o*Ne,te+=o*Re,ne+=o*we,ce+=o*Le,oe+=o*De,Ce+=o*ke,Se+=o*Ue,xe+=o*Pe,me+=o*Ee,ve+=o*Ie,ye+=o*Ve,Te+=o*Oe,o=w[2],z+=o*Ae,ee+=o*Be,ae+=o*be,G+=o*_e,te+=o*Ne,ne+=o*Re,ce+=o*we,oe+=o*Le,Ce+=o*De,Se+=o*ke,xe+=o*Ue,me+=o*Pe,ve+=o*Ee,ye+=o*Ie,Te+=o*Ve,Fe+=o*Oe,o=w[3],ee+=o*Ae,ae+=o*Be,G+=o*be,te+=o*_e,ne+=o*Ne,ce+=o*Re,oe+=o*we,Ce+=o*Le,Se+=o*De,xe+=o*ke,me+=o*Ue,ve+=o*Pe,ye+=o*Ee,Te+=o*Ie,Fe+=o*Ve,Me+=o*Oe,o=w[4],ae+=o*Ae,G+=o*Be,te+=o*be,ne+=o*_e,ce+=o*Ne,oe+=o*Re,Ce+=o*we,Se+=o*Le,xe+=o*De,me+=o*ke,ve+=o*Ue,ye+=o*Pe,Te+=o*Ee,Fe+=o*Ie,Me+=o*Ve,He+=o*Oe,o=w[5],G+=o*Ae,te+=o*Be,ne+=o*be,ce+=o*_e,oe+=o*Ne,Ce+=o*Re,Se+=o*we,xe+=o*Le,me+=o*De,ve+=o*ke,ye+=o*Ue,Te+=o*Pe,Fe+=o*Ee,Me+=o*Ie,He+=o*Ve,Ge+=o*Oe,o=w[6],te+=o*Ae,ne+=o*Be,ce+=o*be,oe+=o*_e,Ce+=o*Ne,Se+=o*Re,xe+=o*we,me+=o*Le,ve+=o*De,ye+=o*ke,Te+=o*Ue,Fe+=o*Pe,Me+=o*Ee,He+=o*Ie,Ge+=o*Ve,Qe+=o*Oe,o=w[7],ne+=o*Ae,ce+=o*Be,oe+=o*be,Ce+=o*_e,Se+=o*Ne,xe+=o*Re,me+=o*we,ve+=o*Le,ye+=o*De,Te+=o*ke,Fe+=o*Ue,Me+=o*Pe,He+=o*Ee,Ge+=o*Ie,Qe+=o*Ve,Ye+=o*Oe,o=w[8],ce+=o*Ae,oe+=o*Be,Ce+=o*be,Se+=o*_e,xe+=o*Ne,me+=o*Re,ve+=o*we,ye+=o*Le,Te+=o*De,Fe+=o*ke,Me+=o*Ue,He+=o*Pe,Ge+=o*Ee,Qe+=o*Ie,Ye+=o*Ve,je+=o*Oe,o=w[9],oe+=o*Ae,Ce+=o*Be,Se+=o*be,xe+=o*_e,me+=o*Ne,ve+=o*Re,ye+=o*we,Te+=o*Le,Fe+=o*De,Me+=o*ke,He+=o*Ue,Ge+=o*Pe,Qe+=o*Ee,Ye+=o*Ie,je+=o*Ve,tt+=o*Oe,o=w[10],Ce+=o*Ae,Se+=o*Be,xe+=o*be,me+=o*_e,ve+=o*Ne,ye+=o*Re,Te+=o*we,Fe+=o*Le,Me+=o*De,He+=o*ke,Ge+=o*Ue,Qe+=o*Pe,Ye+=o*Ee,je+=o*Ie,tt+=o*Ve,at+=o*Oe,o=w[11],Se+=o*Ae,xe+=o*Be,me+=o*be,ve+=o*_e,ye+=o*Ne,Te+=o*Re,Fe+=o*we,Me+=o*Le,He+=o*De,Ge+=o*ke,Qe+=o*Ue,Ye+=o*Pe,je+=o*Ee,tt+=o*Ie,at+=o*Ve,nt+=o*Oe,o=w[12],xe+=o*Ae,me+=o*Be,ve+=o*be,ye+=o*_e,Te+=o*Ne,Fe+=o*Re,Me+=o*we,He+=o*Le,Ge+=o*De,Qe+=o*ke,Ye+=o*Ue,je+=o*Pe,tt+=o*Ee,at+=o*Ie,nt+=o*Ve,ft+=o*Oe,o=w[13],me+=o*Ae,ve+=o*Be,ye+=o*be,Te+=o*_e,Fe+=o*Ne,Me+=o*Re,He+=o*we,Ge+=o*Le,Qe+=o*De,Ye+=o*ke,je+=o*Ue,tt+=o*Pe,at+=o*Ee,nt+=o*Ie,ft+=o*Ve,ht+=o*Oe,o=w[14],ve+=o*Ae,ye+=o*Be,Te+=o*be,Fe+=o*_e,Me+=o*Ne,He+=o*Re,Ge+=o*we,Qe+=o*Le,Ye+=o*De,je+=o*ke,tt+=o*Ue,at+=o*Pe,nt+=o*Ee,ft+=o*Ie,ht+=o*Ve,yt+=o*Oe,o=w[15],ye+=o*Ae,Te+=o*Be,Fe+=o*be,Me+=o*_e,He+=o*Ne,Ge+=o*Re,Qe+=o*we,Ye+=o*Le,je+=o*De,tt+=o*ke,at+=o*Ue,nt+=o*Pe,ft+=o*Ee,ht+=o*Ie,yt+=o*Ve,Tt+=o*Oe,K+=38*Te,P+=38*Fe,z+=38*Me,ee+=38*He,ae+=38*Ge,G+=38*Qe,te+=38*Ye,ne+=38*je,ce+=38*tt,oe+=38*at,Ce+=38*nt,Se+=38*ft,xe+=38*ht,me+=38*yt,ve+=38*Tt,A=1,o=K+A+65535,A=Math.floor(o/65536),K=o-A*65536,o=P+A+65535,A=Math.floor(o/65536),P=o-A*65536,o=z+A+65535,A=Math.floor(o/65536),z=o-A*65536,o=ee+A+65535,A=Math.floor(o/65536),ee=o-A*65536,o=ae+A+65535,A=Math.floor(o/65536),ae=o-A*65536,o=G+A+65535,A=Math.floor(o/65536),G=o-A*65536,o=te+A+65535,A=Math.floor(o/65536),te=o-A*65536,o=ne+A+65535,A=Math.floor(o/65536),ne=o-A*65536,o=ce+A+65535,A=Math.floor(o/65536),ce=o-A*65536,o=oe+A+65535,A=Math.floor(o/65536),oe=o-A*65536,o=Ce+A+65535,A=Math.floor(o/65536),Ce=o-A*65536,o=Se+A+65535,A=Math.floor(o/65536),Se=o-A*65536,o=xe+A+65535,A=Math.floor(o/65536),xe=o-A*65536,o=me+A+65535,A=Math.floor(o/65536),me=o-A*65536,o=ve+A+65535,A=Math.floor(o/65536),ve=o-A*65536,o=ye+A+65535,A=Math.floor(o/65536),ye=o-A*65536,K+=A-1+37*(A-1),A=1,o=K+A+65535,A=Math.floor(o/65536),K=o-A*65536,o=P+A+65535,A=Math.floor(o/65536),P=o-A*65536,o=z+A+65535,A=Math.floor(o/65536),z=o-A*65536,o=ee+A+65535,A=Math.floor(o/65536),ee=o-A*65536,o=ae+A+65535,A=Math.floor(o/65536),ae=o-A*65536,o=G+A+65535,A=Math.floor(o/65536),G=o-A*65536,o=te+A+65535,A=Math.floor(o/65536),te=o-A*65536,o=ne+A+65535,A=Math.floor(o/65536),ne=o-A*65536,o=ce+A+65535,A=Math.floor(o/65536),ce=o-A*65536,o=oe+A+65535,A=Math.floor(o/65536),oe=o-A*65536,o=Ce+A+65535,A=Math.floor(o/65536),Ce=o-A*65536,o=Se+A+65535,A=Math.floor(o/65536),Se=o-A*65536,o=xe+A+65535,A=Math.floor(o/65536),xe=o-A*65536,o=me+A+65535,A=Math.floor(o/65536),me=o-A*65536,o=ve+A+65535,A=Math.floor(o/65536),ve=o-A*65536,o=ye+A+65535,A=Math.floor(o/65536),ye=o-A*65536,K+=A-1+37*(A-1),f[0]=K,f[1]=P,f[2]=z,f[3]=ee,f[4]=ae,f[5]=G,f[6]=te,f[7]=ne,f[8]=ce,f[9]=oe,f[10]=Ce,f[11]=Se,f[12]=xe,f[13]=me,f[14]=ve,f[15]=ye}return lr}var cr,da;function Ra(){if(da)return cr;da=1;var a=ue();de(),We(),mt(),cr=a.kem=a.kem||{};var e=a.jsbn.BigInteger;a.kem.rsa={},a.kem.rsa.create=function(v,_){_=_||{};var S=_.prng||a.random,h={};return h.encrypt=function(t,C){var l=Math.ceil(t.n.bitLength()/8),x;do x=new e(a.util.bytesToHex(S.getBytesSync(l)),16).mod(t.n);while(x.compareTo(e.ONE)<=0);x=a.util.hexToBytes(x.toString(16));var k=l-x.length;k>0&&(x=a.util.fillString("\0",k)+x);var E=t.encrypt(x,"NONE"),u=v.generate(x,C);return{encapsulation:E,key:u}},h.decrypt=function(t,C,l){var x=t.decrypt(C,"NONE");return v.generate(x,l)},h},a.kem.kdf1=function(v,_){i(this,v,0,_||v.digestLength)},a.kem.kdf2=function(v,_){i(this,v,1,_||v.digestLength)};function i(v,_,S,h){v.generate=function(t,C){for(var l=new a.util.ByteBuffer,x=Math.ceil(C/h)+S,k=new a.util.ByteBuffer,E=S;E<x;++E){k.putInt32(E),_.start(),_.update(t+k.getBytes());var u=_.digest();l.putBytes(u.getBytes(h))}return l.truncate(l.length()-C),l.getBytes()}}return cr}var hr,pa;function wa(){if(pa)return hr;pa=1;var a=ue();de(),hr=a.log=a.log||{},a.log.levels=["none","error","warning","info","debug","verbose","max"];var e={},i=[],v=null;a.log.LEVEL_LOCKED=2,a.log.NO_LEVEL_CHECK=4,a.log.INTERPOLATE=8;for(var _=0;_<a.log.levels.length;++_){var S=a.log.levels[_];e[S]={index:_,name:S.toUpperCase()}}a.log.logMessage=function(E){for(var u=e[E.level].index,y=0;y<i.length;++y){var m=i[y];if(m.flags&a.log.NO_LEVEL_CHECK)m.f(E);else{var g=e[m.level].index;u<=g&&m.f(m,E)}}},a.log.prepareStandard=function(E){"standard"in E||(E.standard=e[E.level].name+" ["+E.category+"] "+E.message)},a.log.prepareFull=function(E){if(!("full"in E)){var u=[E.message];u=u.concat([]),E.full=a.util.format.apply(this,u)}},a.log.prepareStandardFull=function(E){"standardFull"in E||(a.log.prepareStandard(E),E.standardFull=E.standard)};for(var h=["error","warning","info","debug","verbose"],_=0;_<h.length;++_)(function(u){a.log[u]=function(y,m){var g=Array.prototype.slice.call(arguments).slice(2),s={timestamp:new Date,level:u,category:y,message:m,arguments:g};a.log.logMessage(s)}})(h[_]);if(a.log.makeLogger=function(E){var u={flags:0,f:E};return a.log.setLevel(u,"none"),u},a.log.setLevel=function(E,u){var y=!1;if(E&&!(E.flags&a.log.LEVEL_LOCKED))for(var m=0;m<a.log.levels.length;++m){var g=a.log.levels[m];if(u==g){E.level=u,y=!0;break}}return y},a.log.lock=function(E,u){typeof u>"u"||u?E.flags|=a.log.LEVEL_LOCKED:E.flags&=~a.log.LEVEL_LOCKED},a.log.addLogger=function(E){i.push(E)},typeof console<"u"&&"log"in console){var t;if(console.error&&console.warn&&console.info&&console.debug){var C={error:console.error,warning:console.warn,info:console.info,debug:console.debug,verbose:console.debug},l=function(E,u){a.log.prepareStandard(u);var y=C[u.level],m=[u.standard];m=m.concat(u.arguments.slice()),y.apply(console,m)};t=a.log.makeLogger(l)}else{var l=function(u,y){a.log.prepareStandardFull(y),console.log(y.standardFull)};t=a.log.makeLogger(l)}a.log.setLevel(t,"debug"),a.log.addLogger(t),v=t}else console={log:function(){}};if(v!==null&&typeof window<"u"&&window.location){var x=new URL(window.location.href).searchParams;if(x.has("console.level")&&a.log.setLevel(v,x.get("console.level").slice(-1)[0]),x.has("console.lock")){var k=x.get("console.lock").slice(-1)[0];k=="true"&&a.log.lock(v)}}return a.log.consoleLogger=v,hr}var dr,va;function La(){return va||(va=1,dr=rt(),Kt(),vt(),kr(),la()),dr}var pr={exports:{}},ya;function Da(){if(ya)return pr.exports;ya=1;var a=ue();ot(),et(),gt(),ut(),lt(),jr(),We(),de(),or();var e=a.asn1,i=pr.exports=a.pkcs7=a.pkcs7||{};i.messageFromPem=function(u){var y=a.pem.decode(u)[0];if(y.type!=="PKCS7"){var m=new Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw m.headerType=y.type,m}if(y.procType&&y.procType.type==="ENCRYPTED")throw new Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var g=e.fromDer(y.body);return i.messageFromAsn1(g)},i.messageToPem=function(u,y){var m={type:"PKCS7",body:e.toDer(u.toAsn1()).getBytes()};return a.pem.encode(m,{maxline:y})},i.messageFromAsn1=function(u){var y={},m=[];if(!e.validate(u,i.asn1.contentInfoValidator,y,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(y.contentType),d;switch(s){case a.pki.oids.envelopedData:d=i.createEnvelopedData();break;case a.pki.oids.encryptedData:d=i.createEncryptedData();break;case a.pki.oids.signedData:d=i.createSignedData();break;default:throw new Error("Cannot read PKCS#7 message. ContentType with OID "+s+" is not (yet) supported.")}return d.fromAsn1(y.content.value[0]),d},i.createSignedData=function(){var u=null;return u={type:a.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(g){if(k(u,g,i.asn1.signedDataValidator),u.certificates=[],u.crls=[],u.digestAlgorithmIdentifiers=[],u.contentInfo=null,u.signerInfos=[],u.rawCapture.certificates)for(var s=u.rawCapture.certificates.value,d=0;d<s.length;++d)u.certificates.push(a.pki.certificateFromAsn1(s[d]))},toAsn1:function(){u.contentInfo||u.sign();for(var g=[],s=0;s<u.certificates.length;++s)g.push(a.pki.certificateToAsn1(u.certificates[s]));var d=[],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(u.version).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,u.digestAlgorithmIdentifiers),u.contentInfo])]);return g.length>0&&p.value[0].value.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!0,g)),d.length>0&&p.value[0].value.push(e.create(e.Class.CONTEXT_SPECIFIC,1,!0,d)),p.value[0].value.push(e.create(e.Class.UNIVERSAL,e.Type.SET,!0,u.signerInfos)),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(u.type).getBytes()),p])},addSigner:function(g){var s=g.issuer,d=g.serialNumber;if(g.certificate){var p=g.certificate;typeof p=="string"&&(p=a.pki.certificateFromPem(p)),s=p.issuer.attributes,d=p.serialNumber}var I=g.key;if(!I)throw new Error("Could not add PKCS#7 signer; no private key specified.");typeof I=="string"&&(I=a.pki.privateKeyFromPem(I));var R=g.digestAlgorithm||a.pki.oids.sha1;switch(R){case a.pki.oids.sha1:case a.pki.oids.sha256:case a.pki.oids.sha384:case a.pki.oids.sha512:case a.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 n=!1,r=!1,B=0;B<c.length;++B){var D=c[B];if(!n&&D.type===a.pki.oids.contentType){if(n=!0,r)break;continue}if(!r&&D.type===a.pki.oids.messageDigest){if(r=!0,n)break;continue}}if(!n||!r)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.")}u.signers.push({key:I,version:1,issuer:s,serialNumber:d,digestAlgorithm:R,signatureAlgorithm:a.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:c,unauthenticatedAttributes:[]})},sign:function(g){if(g=g||{},(typeof u.content!="object"||u.contentInfo===null)&&(u.contentInfo=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.pki.oids.data).getBytes())]),"content"in u)){var s;u.content instanceof a.util.ByteBuffer?s=u.content.bytes():typeof u.content=="string"&&(s=a.util.encodeUtf8(u.content)),g.detached?u.detachedContent=e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,s):u.contentInfo.value.push(e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,s)]))}if(u.signers.length!==0){var d=y();m(d)}},verify:function(){throw new Error("PKCS#7 signature verification not yet implemented.")},addCertificate:function(g){typeof g=="string"&&(g=a.pki.certificateFromPem(g)),u.certificates.push(g)},addCertificateRevokationList:function(g){throw new Error("PKCS#7 CRL support not yet implemented.")}},u;function y(){for(var g={},s=0;s<u.signers.length;++s){var d=u.signers[s],p=d.digestAlgorithm;p in g||(g[p]=a.md[a.pki.oids[p]].create()),d.authenticatedAttributes.length===0?d.md=g[p]:d.md=a.md[a.pki.oids[p]].create()}u.digestAlgorithmIdentifiers=[];for(var p in g)u.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(u.detachedContent?s=u.detachedContent:(s=u.contentInfo.value[1],s=s.value[0]),!s)throw new Error("Could not sign PKCS#7 message; there is no content to sign.");var d=e.derToOid(u.contentInfo.value[0].value),p=e.toDer(s);p.getByte(),e.getBerValueLength(p),p=p.getBytes();for(var I in g)g[I].start().update(p);for(var R=new Date,c=0;c<u.signers.length;++c){var n=u.signers[c];if(n.authenticatedAttributes.length===0){if(d!==a.pki.oids.data)throw new Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.")}else{n.authenticatedAttributesAsn1=e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var r=e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[]),B=0;B<n.authenticatedAttributes.length;++B){var D=n.authenticatedAttributes[B];D.type===a.pki.oids.messageDigest?D.value=g[n.digestAlgorithm].digest():D.type===a.pki.oids.signingTime&&(D.value||(D.value=R)),r.value.push(l(D)),n.authenticatedAttributesAsn1.value.push(l(D))}p=e.toDer(r).getBytes(),n.md.start().update(p)}n.signature=n.key.sign(n.md,"RSASSA-PKCS1-V1_5")}u.signerInfos=C(u.signers)}},i.createEncryptedData=function(){var u=null;return u={type:a.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:a.pki.oids["aes256-CBC"]},fromAsn1:function(y){k(u,y,i.asn1.encryptedDataValidator)},decrypt:function(y){y!==void 0&&(u.encryptedContent.key=y),E(u)}},u},i.createEnvelopedData=function(){var u=null;return u={type:a.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:a.pki.oids["aes256-CBC"]},fromAsn1:function(y){var m=k(u,y,i.asn1.envelopedDataValidator);u.recipients=S(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(u.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(u.version).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,h(u.recipients)),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,x(u.encryptedContent))])])])},findRecipient:function(y){for(var m=y.issuer.attributes,g=0;g<u.recipients.length;++g){var s=u.recipients[g],d=s.issuer;if(s.serialNumber===y.serialNumber&&d.length===m.length){for(var p=!0,I=0;I<m.length;++I)if(d[I].type!==m[I].type||d[I].value!==m[I].value){p=!1;break}if(p)return s}}return null},decrypt:function(y,m){if(u.encryptedContent.key===void 0&&y!==void 0&&m!==void 0)switch(y.encryptedContent.algorithm){case a.pki.oids.rsaEncryption:case a.pki.oids.desCBC:var g=m.decrypt(y.encryptedContent.content);u.encryptedContent.key=a.util.createBuffer(g);break;default:throw new Error("Unsupported asymmetric cipher, OID "+y.encryptedContent.algorithm)}E(u)},addRecipient:function(y){u.recipients.push({version:0,issuer:y.issuer.attributes,serialNumber:y.serialNumber,encryptedContent:{algorithm:a.pki.oids.rsaEncryption,key:y.publicKey}})},encrypt:function(y,m){if(u.encryptedContent.content===void 0){m=m||u.encryptedContent.algorithm,y=y||u.encryptedContent.key;var g,s,d;switch(m){case a.pki.oids["aes128-CBC"]:g=16,s=16,d=a.aes.createEncryptionCipher;break;case a.pki.oids["aes192-CBC"]:g=24,s=16,d=a.aes.createEncryptionCipher;break;case a.pki.oids["aes256-CBC"]:g=32,s=16,d=a.aes.createEncryptionCipher;break;case a.pki.oids["des-EDE3-CBC"]:g=24,s=8,d=a.des.createEncryptionCipher;break;default:throw new Error("Unsupported symmetric cipher, OID "+m)}if(y===void 0)y=a.util.createBuffer(a.random.getBytes(g));else if(y.length()!=g)throw new Error("Symmetric key has wrong length; got "+y.length()+" bytes, expected "+g+".");u.encryptedContent.algorithm=m,u.encryptedContent.key=y,u.encryptedContent.parameter=a.util.createBuffer(a.random.getBytes(s));var p=d(y);if(p.start(u.encryptedContent.parameter.copy()),p.update(u.content),!p.finish())throw new Error("Symmetric encryption failed.");u.encryptedContent.content=p.output}for(var I=0;I<u.recipients.length;++I){var R=u.recipients[I];if(R.encryptedContent.content===void 0)if(R.encryptedContent.algorithm===a.pki.oids.rsaEncryption)R.encryptedContent.content=R.encryptedContent.key.encrypt(u.encryptedContent.key.data);else throw new Error("Unsupported asymmetric cipher, OID "+R.encryptedContent.algorithm)}}},u};function v(u){var y={},m=[];if(!e.validate(u,i.asn1.recipientInfoValidator,y,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:y.version.charCodeAt(0),issuer:a.pki.RDNAttributesAsArray(y.issuer),serialNumber:a.util.createBuffer(y.serial).toHex(),encryptedContent:{algorithm:e.derToOid(y.encAlgorithm),parameter:y.encParameter?y.encParameter.value:void 0,content:y.encKey}}}function _(u){return e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(u.version).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[a.pki.distinguishedNameToAsn1({attributes:u.issuer}),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,a.util.hexToBytes(u.serialNumber))]),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(u.encryptedContent.algorithm).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")]),e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,u.encryptedContent.content)])}function S(u){for(var y=[],m=0;m<u.length;++m)y.push(v(u[m]));return y}function h(u){for(var y=[],m=0;m<u.length;++m)y.push(_(u[m]));return y}function t(u){var y=e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,e.integerToDer(u.version).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[a.pki.distinguishedNameToAsn1({attributes:u.issuer}),e.create(e.Class.UNIVERSAL,e.Type.INTEGER,!1,a.util.hexToBytes(u.serialNumber))]),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(u.digestAlgorithm).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")])]);if(u.authenticatedAttributesAsn1&&y.value.push(u.authenticatedAttributesAsn1),y.value.push(e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(u.signatureAlgorithm).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.NULL,!1,"")])),y.value.push(e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,u.signature)),u.unauthenticatedAttributes.length>0){for(var m=e.create(e.Class.CONTEXT_SPECIFIC,1,!0,[]),g=0;g<u.unauthenticatedAttributes.length;++g){var s=u.unauthenticatedAttributes[g];m.values.push(l(s))}y.value.push(m)}return y}function C(u){for(var y=[],m=0;m<u.length;++m)y.push(t(u[m]));return y}function l(u){var y;if(u.type===a.pki.oids.contentType)y=e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(u.value).getBytes());else if(u.type===a.pki.oids.messageDigest)y=e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,u.value.bytes());else if(u.type===a.pki.oids.signingTime){var m=new Date("1950-01-01T00:00:00Z"),g=new Date("2050-01-01T00:00:00Z"),s=u.value;if(typeof s=="string"){var d=Date.parse(s);isNaN(d)?s.length===13?s=e.utcTimeToDate(s):s=e.generalizedTimeToDate(s):s=new Date(d)}s>=m&&s<g?y=e.create(e.Class.UNIVERSAL,e.Type.UTCTIME,!1,e.dateToUtcTime(s)):y=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(u.type).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SET,!0,[y])])}function x(u){return[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(a.pki.oids.data).getBytes()),e.create(e.Class.UNIVERSAL,e.Type.SEQUENCE,!0,[e.create(e.Class.UNIVERSAL,e.Type.OID,!1,e.oidToDer(u.algorithm).getBytes()),u.parameter?e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,u.parameter.getBytes()):void 0]),e.create(e.Class.CONTEXT_SPECIFIC,0,!0,[e.create(e.Class.UNIVERSAL,e.Type.OCTETSTRING,!1,u.content.getBytes())])]}function k(u,y,m){var g={},s=[];if(!e.validate(y,m,g,s)){var d=new Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw d.errors=d,d}var p=e.derToOid(g.contentType);if(p!==a.pki.oids.data)throw new Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(g.encryptedContent){var I="";if(a.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.");I+=g.encryptedContent[R].value}else I=g.encryptedContent;u.encryptedContent={algorithm:e.derToOid(g.encAlgorithm),parameter:a.util.createBuffer(g.encParameter.value),content:a.util.createBuffer(I)}}if(g.content){var I="";if(a.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.");I+=g.content[R].value}else I=g.content;u.content=a.util.createBuffer(I)}return u.version=g.version.charCodeAt(0),u.rawCapture=g,g}function E(u){if(u.encryptedContent.key===void 0)throw new Error("Symmetric key not available.");if(u.content===void 0){var y;switch(u.encryptedContent.algorithm){case a.pki.oids["aes128-CBC"]:case a.pki.oids["aes192-CBC"]:case a.pki.oids["aes256-CBC"]:y=a.aes.createDecryptionCipher(u.encryptedContent.key);break;case a.pki.oids.desCBC:case a.pki.oids["des-EDE3-CBC"]:y=a.des.createDecryptionCipher(u.encryptedContent.key);break;default:throw new Error("Unsupported symmetric cipher, OID "+u.encryptedContent.algorithm)}if(y.start(u.encryptedContent.parameter),y.update(u.encryptedContent.content),!y.finish())throw new Error("Symmetric decryption failed.");u.content=y.output}}return pr.exports}var vr={exports:{}},ga;function ka(){if(ga)return vr.exports;ga=1;var a=ue();ot(),pt(),Kt(),vt(),de();var e=vr.exports=a.ssh=a.ssh||{};e.privateKeyToPutty=function(S,h,t){t=t||"",h=h||"";var C="ssh-rsa",l=h===""?"none":"aes256-cbc",x="PuTTY-User-Key-File-2: "+C+`\r
`;x+="Encryption: "+l+`\r
`,x+="Comment: "+t+`\r
`;var k=a.util.createBuffer();v(k,C),i(k,S.e),i(k,S.n);var E=a.util.encode64(k.bytes(),64),u=Math.floor(E.length/66)+1;x+="Public-Lines: "+u+`\r
`,x+=E;var y=a.util.createBuffer();i(y,S.d),i(y,S.p),i(y,S.q),i(y,S.qInv);var m;if(!h)m=a.util.encode64(y.bytes(),64);else{var g=y.length()+16-1;g-=g%16;var s=_(y.bytes());s.truncate(s.length()-g+y.length()),y.putBuffer(s);var d=a.util.createBuffer();d.putBuffer(_("\0\0\0\0",h)),d.putBuffer(_("\0\0\0",h));var p=a.aes.createEncryptionCipher(d.truncate(8),"CBC");p.start(a.util.createBuffer().fillWithByte(0,16)),p.update(y.copy()),p.finish();var I=p.output;I.truncate(16),m=a.util.encode64(I.bytes(),64)}u=Math.floor(m.length/66)+1,x+=`\r
Private-Lines: `+u+`\r
`,x+=m;var R=_("putty-private-key-file-mac-key",h),c=a.util.createBuffer();v(c,C),v(c,l),v(c,t),c.putInt32(k.length()),c.putBuffer(k),c.putInt32(y.length()),c.putBuffer(y);var n=a.hmac.create();return n.start("sha1",R),n.update(c.bytes()),x+=`\r
Private-MAC: `+n.digest().toHex()+`\r
`,x},e.publicKeyToOpenSSH=function(S,h){var t="ssh-rsa";h=h||"";var C=a.util.createBuffer();return v(C,t),i(C,S.e),i(C,S.n),t+" "+a.util.encode64(C.bytes())+" "+h},e.privateKeyToOpenSSH=function(S,h){return h?a.pki.encryptRsaPrivateKey(S,h,{legacy:!0,algorithm:"aes128"}):a.pki.privateKeyToPem(S)},e.getPublicKeyFingerprint=function(S,h){h=h||{};var t=h.md||a.md.md5.create(),C="ssh-rsa",l=a.util.createBuffer();v(l,C),i(l,S.e),i(l,S.n),t.start(),t.update(l.getBytes());var x=t.digest();if(h.encoding==="hex"){var k=x.toHex();return h.delimiter?k.match(/.{2}/g).join(h.delimiter):k}else{if(h.encoding==="binary")return x.getBytes();if(h.encoding)throw new Error('Unknown encoding "'+h.encoding+'".')}return x};function i(S,h){var t=h.toString(16);t[0]>="8"&&(t="00"+t);var C=a.util.hexToBytes(t);S.putInt32(C.length),S.putBytes(C)}function v(S,h){S.putInt32(h.length),S.putString(h)}function _(){for(var S=a.md.sha1.create(),h=arguments.length,t=0;t<h;++t)S.update(arguments[t]);return S.digest()}return vr.exports}var yr,Ca;function Ua(){return Ca||(Ca=1,yr=ue(),ot(),ba(),et(),Rt(),gt(),Na(),pt(),Ra(),wa(),La(),$r(),Qt(),lt(),Hr(),aa(),Da(),na(),Qr(),Pr(),sr(),We(),Kr(),ka(),oa(),de()),yr}var Pa=Ua(),ct=xa(Pa);self.onmessage=a=>{const e=Oa(a.data);self.postMessage(e)};const Va=a=>{const e=self.crypto,i=65536,v=new Uint8Array(a);for(let _=0;_<a;_+=i)e.getRandomValues(v.subarray(_,_+Math.min(a-_,i)));return v},ma=[{name:"organizationName",value:(a=>a.replace(/[^a-zA-Z0-9 '()+,-./:=?]/g,""))(`LXD UI ${location.hostname} (Browser Generated)`)}],Oa=a=>{const i=ct.pki.rsa.generateKeyPair(2048),v=ct.pki.createCertificate();v.publicKey=i.publicKey,v.serialNumber="01"+Va(20).toString().substring(0,30),v.validity.notBefore=new Date,v.validity.notAfter=new Date(Date.now()+1e3*60*60*24*1e3),v.setSubject(ma),v.setIssuer(ma),v.sign(i.privateKey);const _=ct.pki.certificateToPem(v),S=ct.pkcs12.toPkcs12Asn1(i.privateKey,[v],a,{algorithm:"3des",generateLocalKeyId:!0,friendlyName:"LXD-UI"}),h=ct.asn1.toDer(S).getBytes(),t=ct.util.encode64(h);return{crt:_,pfx:t}}})();