CyberChef/modules/PublicKey.js

2 lines
718 KiB
JavaScript
Executable File
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*! For license information please see PublicKey.js.LICENSE.txt */
(()=>{var t={25704:(t,e)=>{"use strict";e.byteLength=function(t){var e=o(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,s=o(t),a=s[0],u=s[1],c=new i(function(t,e,r){return 3*(e+r)/4-r}(0,a,u)),l=0,h=u>0?a-4:a;for(r=0;r<h;r+=4)e=n[t.charCodeAt(r)]<<18|n[t.charCodeAt(r+1)]<<12|n[t.charCodeAt(r+2)]<<6|n[t.charCodeAt(r+3)],c[l++]=e>>16&255,c[l++]=e>>8&255,c[l++]=255&e;return 2===u&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,c[l++]=255&e),1===u&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,c[l++]=e>>8&255,c[l++]=255&e),c},e.fromByteArray=function(t){for(var e,n=t.length,i=n%3,s=[],a=16383,o=0,c=n-i;o<c;o+=a)s.push(u(t,o,o+a>c?c:o+a));return 1===i?(e=t[n-1],s.push(r[e>>2]+r[e<<4&63]+"==")):2===i&&(e=(t[n-2]<<8)+t[n-1],s.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"=")),s.join("")};for(var r=[],n=[],i="undefined"!=typeof Uint8Array?Uint8Array:Array,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",a=0;a<64;++a)r[a]=s[a],n[s.charCodeAt(a)]=a;function o(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var r=t.indexOf("=");return-1===r&&(r=e),[r,r===e?0:4-r%4]}function u(t,e,n){for(var i,s,a=[],o=e;o<n;o+=3)i=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(255&t[o+2]),a.push(r[(s=i)>>18&63]+r[s>>12&63]+r[s>>6&63]+r[63&s]);return a.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},33296:(t,e,r)=>{"use strict";const n=r(25704),i=r(24404),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=u,e.INSPECT_MAX_BYTES=50;const a=2147483647;function o(t){if(t>a)throw new RangeError('The value "'+t+'" is invalid for option "size"');const e=new Uint8Array(t);return Object.setPrototypeOf(e,u.prototype),e}function u(t,e,r){if("number"==typeof t){if("string"==typeof e)throw new TypeError('The "string" argument must be of type string. Received type number');return h(t)}return c(t,e,r)}function c(t,e,r){if("string"==typeof t)return function(t,e){if("string"==typeof e&&""!==e||(e="utf8"),!u.isEncoding(e))throw new TypeError("Unknown encoding: "+e);const r=0|g(t,e);let n=o(r);const i=n.write(t,e);return i!==r&&(n=n.slice(0,i)),n}(t,e);if(ArrayBuffer.isView(t))return function(t){if(Y(t,Uint8Array)){const e=new Uint8Array(t);return p(e.buffer,e.byteOffset,e.byteLength)}return f(t)}(t);if(null==t)throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t);if(Y(t,ArrayBuffer)||t&&Y(t.buffer,ArrayBuffer))return p(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(Y(t,SharedArrayBuffer)||t&&Y(t.buffer,SharedArrayBuffer)))return p(t,e,r);if("number"==typeof t)throw new TypeError('The "value" argument must not be of type number. Received type number');const n=t.valueOf&&t.valueOf();if(null!=n&&n!==t)return u.from(n,e,r);const i=function(t){if(u.isBuffer(t)){const e=0|d(t.length),r=o(e);return 0===r.length||t.copy(r,0,0,e),r}return void 0!==t.length?"number"!=typeof t.length||Q(t.length)?o(0):f(t):"Buffer"===t.type&&Array.isArray(t.data)?f(t.data):void 0}(t);if(i)return i;if("undefined"!=typeof Symbol&&null!=Symbol.toPrimitive&&"function"==typeof t[Symbol.toPrimitive])return u.from(t[Symbol.toPrimitive]("string"),e,r);throw new TypeError("The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type "+typeof t)}function l(t){if("number"!=typeof t)throw new TypeError('"size" argument must be of type number');if(t<0)throw new RangeError('The value "'+t+'" is invalid for option "size"')}function h(t){return l(t),o(t<0?0:0|d(t))}function f(t){const e=t.length<0?0:0|d(t.length),r=o(e);for(let n=0;n<e;n+=1)r[n]=255&t[n];return r}function p(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(n,u.prototype),n}function d(t){if(t>=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|t}function g(t,e){if(u.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||Y(t,ArrayBuffer))return t.byteLength;if("string"!=typeof t)throw new TypeError('The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type '+typeof t);const r=t.length,n=arguments.length>2&&!0===arguments[2];if(!n&&0===r)return 0;let i=!1;for(;;)switch(e){case"ascii":case"latin1":case"binary":return r;case"utf8":case"utf-8":return z(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return W(t).length;default:if(i)return n?-1:z(t).length;e=(""+e).toLowerCase(),i=!0}}function y(t,e,r){let n=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===r||r>this.length)&&(r=this.length),r<=0)return"";if((r>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return R(this,e,r);case"utf8":case"utf-8":return B(this,e,r);case"ascii":return T(this,e,r);case"latin1":case"binary":return F(this,e,r);case"base64":return x(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return N(this,e,r);default:if(n)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),n=!0}}function v(t,e,r){const n=t[e];t[e]=t[r],t[r]=n}function m(t,e,r,n,i){if(0===t.length)return-1;if("string"==typeof r?(n=r,r=0):r>2147483647?r=2147483647:r<-2147483648&&(r=-2147483648),Q(r=+r)&&(r=i?0:t.length-1),r<0&&(r=t.length+r),r>=t.length){if(i)return-1;r=t.length-1}else if(r<0){if(!i)return-1;r=0}if("string"==typeof e&&(e=u.from(e,n)),u.isBuffer(e))return 0===e.length?-1:E(t,e,r,n,i);if("number"==typeof e)return e&=255,"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,r):Uint8Array.prototype.lastIndexOf.call(t,e,r):E(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function E(t,e,r,n,i){let s,a=1,o=t.length,u=e.length;if(void 0!==n&&("ucs2"===(n=String(n).toLowerCase())||"ucs-2"===n||"utf16le"===n||"utf-16le"===n)){if(t.length<2||e.length<2)return-1;a=2,o/=2,u/=2,r/=2}function c(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){let n=-1;for(s=r;s<o;s++)if(c(t,s)===c(e,-1===n?0:s-n)){if(-1===n&&(n=s),s-n+1===u)return n*a}else-1!==n&&(s-=s-n),n=-1}else for(r+u>o&&(r=o-u),s=r;s>=0;s--){let r=!0;for(let n=0;n<u;n++)if(c(t,s+n)!==c(e,n)){r=!1;break}if(r)return s}return-1}function S(t,e,r,n){r=Number(r)||0;const i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;const s=e.length;let a;for(n>s/2&&(n=s/2),a=0;a<n;++a){const n=parseInt(e.substr(2*a,2),16);if(Q(n))return a;t[r+a]=n}return a}function b(t,e,r,n){return $(z(e,t.length-r),t,r,n)}function C(t,e,r,n){return $(function(t){const e=[];for(let r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function A(t,e,r,n){return $(W(e),t,r,n)}function w(t,e,r,n){return $(function(t,e){let r,n,i;const s=[];for(let a=0;a<t.length&&!((e-=2)<0);++a)r=t.charCodeAt(a),n=r>>8,i=r%256,s.push(i),s.push(n);return s}(e,t.length-r),t,r,n)}function x(t,e,r){return 0===e&&r===t.length?n.fromByteArray(t):n.fromByteArray(t.slice(e,r))}function B(t,e,r){r=Math.min(t.length,r);const n=[];let i=e;for(;i<r;){const e=t[i];let s=null,a=e>239?4:e>223?3:e>191?2:1;if(i+a<=r){let r,n,o,u;switch(a){case 1:e<128&&(s=e);break;case 2:r=t[i+1],128==(192&r)&&(u=(31&e)<<6|63&r,u>127&&(s=u));break;case 3:r=t[i+1],n=t[i+2],128==(192&r)&&128==(192&n)&&(u=(15&e)<<12|(63&r)<<6|63&n,u>2047&&(u<55296||u>57343)&&(s=u));break;case 4:r=t[i+1],n=t[i+2],o=t[i+3],128==(192&r)&&128==(192&n)&&128==(192&o)&&(u=(15&e)<<18|(63&r)<<12|(63&n)<<6|63&o,u>65535&&u<1114112&&(s=u))}}null===s?(s=65533,a=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),i+=a}return function(t){const e=t.length;if(e<=I)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=I));return r}(n)}u.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),u.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}}),u.poolSize=8192,u.from=function(t,e,r){return c(t,e,r)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.alloc=function(t,e,r){return function(t,e,r){return l(t),t<=0?o(t):void 0!==e?"string"==typeof r?o(t).fill(e,r):o(t).fill(e):o(t)}(t,e,r)},u.allocUnsafe=function(t){return h(t)},u.allocUnsafeSlow=function(t){return h(t)},u.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==u.prototype},u.compare=function(t,e){if(Y(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),Y(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let r=t.length,n=e.length;for(let i=0,s=Math.min(r,n);i<s;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},u.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);let r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;const n=u.allocUnsafe(e);let i=0;for(r=0;r<t.length;++r){let e=t[r];if(Y(e,Uint8Array))i+e.length>n.length?(u.isBuffer(e)||(e=u.from(e)),e.copy(n,i)):Uint8Array.prototype.set.call(n,e,i);else{if(!u.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(n,i)}i+=e.length}return n},u.byteLength=g,u.prototype._isBuffer=!0,u.prototype.swap16=function(){const t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(let e=0;e<t;e+=2)v(this,e,e+1);return this},u.prototype.swap32=function(){const t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)v(this,e,e+3),v(this,e+1,e+2);return this},u.prototype.swap64=function(){const t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)v(this,e,e+7),v(this,e+1,e+6),v(this,e+2,e+5),v(this,e+3,e+4);return this},u.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?B(this,0,t):y.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){let t="";const r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},s&&(u.prototype[s]=u.prototype.inspect),u.prototype.compare=function(t,e,r,n,i){if(Y(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),!u.isBuffer(t))throw new TypeError('The "target" argument must be one of type Buffer or Uint8Array. Received type '+typeof t);if(void 0===e&&(e=0),void 0===r&&(r=t?t.length:0),void 0===n&&(n=0),void 0===i&&(i=this.length),e<0||r>t.length||n<0||i>this.length)throw new RangeError("out of range index");if(n>=i&&e>=r)return 0;if(n>=i)return-1;if(e>=r)return 1;if(this===t)return 0;let s=(i>>>=0)-(n>>>=0),a=(r>>>=0)-(e>>>=0);const o=Math.min(s,a),c=this.slice(n,i),l=t.slice(e,r);for(let t=0;t<o;++t)if(c[t]!==l[t]){s=c[t],a=l[t];break}return s<a?-1:a<s?1:0},u.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},u.prototype.indexOf=function(t,e,r){return m(this,t,e,r,!0)},u.prototype.lastIndexOf=function(t,e,r){return m(this,t,e,r,!1)},u.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let s=!1;for(;;)switch(n){case"hex":return S(this,t,e,r);case"utf8":case"utf-8":return b(this,t,e,r);case"ascii":case"latin1":case"binary":return C(this,t,e,r);case"base64":return A(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return w(this,t,e,r);default:if(s)throw new TypeError("Unknown encoding: "+n);n=(""+n).toLowerCase(),s=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};const I=4096;function T(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function F(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function R(t,e,r){const n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=e;n<r;++n)i+=X[t[n]];return i}function N(t,e,r){const n=t.slice(e,r);let i="";for(let t=0;t<n.length-1;t+=2)i+=String.fromCharCode(n[t]+256*n[t+1]);return i}function D(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function P(t,e,r,n,i,s){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<s)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function k(t,e,r,n,i){j(e,n,i,t,r,7);let s=Number(e&BigInt(4294967295));t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s,s>>=8,t[r++]=s;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[r++]=a,a>>=8,t[r++]=a,a>>=8,t[r++]=a,a>>=8,t[r++]=a,r}function L(t,e,r,n,i){j(e,n,i,t,r,7);let s=Number(e&BigInt(4294967295));t[r+7]=s,s>>=8,t[r+6]=s,s>>=8,t[r+5]=s,s>>=8,t[r+4]=s;let a=Number(e>>BigInt(32)&BigInt(4294967295));return t[r+3]=a,a>>=8,t[r+2]=a,a>>=8,t[r+1]=a,a>>=8,t[r]=a,r+8}function O(t,e,r,n,i,s){if(r+n>t.length)throw new RangeError("Index out of range");if(r<0)throw new RangeError("Index out of range")}function _(t,e,r,n,s){return e=+e,r>>>=0,s||O(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function U(t,e,r,n,s){return e=+e,r>>>=0,s||O(t,0,r,8),i.write(t,e,r,n,52,8),r+8}u.prototype.slice=function(t,e){const r=this.length;(t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t);const n=this.subarray(t,e);return Object.setPrototypeOf(n,u.prototype),n},u.prototype.readUintLE=u.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||D(t,e,this.length);let n=this[t],i=1,s=0;for(;++s<e&&(i*=256);)n+=this[t+s]*i;return n},u.prototype.readUintBE=u.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||D(t,e,this.length);let n=this[t+--e],i=1;for(;e>0&&(i*=256);)n+=this[t+--e]*i;return n},u.prototype.readUint8=u.prototype.readUInt8=function(t,e){return t>>>=0,e||D(t,1,this.length),this[t]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,e){return t>>>=0,e||D(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,e){return t>>>=0,e||D(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(t,e){return t>>>=0,e||D(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUint32BE=u.prototype.readUInt32BE=function(t,e){return t>>>=0,e||D(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readBigUInt64LE=J((function(t){M(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||q(t,this.length-8);const n=e+256*this[++t]+65536*this[++t]+this[++t]*2**24,i=this[++t]+256*this[++t]+65536*this[++t]+r*2**24;return BigInt(n)+(BigInt(i)<<BigInt(32))})),u.prototype.readBigUInt64BE=J((function(t){M(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||q(t,this.length-8);const n=e*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+r;return(BigInt(n)<<BigInt(32))+BigInt(i)})),u.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||D(t,e,this.length);let n=this[t],i=1,s=0;for(;++s<e&&(i*=256);)n+=this[t+s]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||D(t,e,this.length);let n=e,i=1,s=this[t+--n];for(;n>0&&(i*=256);)s+=this[t+--n]*i;return i*=128,s>=i&&(s-=Math.pow(2,8*e)),s},u.prototype.readInt8=function(t,e){return t>>>=0,e||D(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){t>>>=0,e||D(t,2,this.length);const r=this[t]|this[t+1]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt16BE=function(t,e){t>>>=0,e||D(t,2,this.length);const r=this[t+1]|this[t]<<8;return 32768&r?4294901760|r:r},u.prototype.readInt32LE=function(t,e){return t>>>=0,e||D(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return t>>>=0,e||D(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readBigInt64LE=J((function(t){M(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||q(t,this.length-8);const n=this[t+4]+256*this[t+5]+65536*this[t+6]+(r<<24);return(BigInt(n)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)})),u.prototype.readBigInt64BE=J((function(t){M(t>>>=0,"offset");const e=this[t],r=this[t+7];void 0!==e&&void 0!==r||q(t,this.length-8);const n=(e<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(n)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+r)})),u.prototype.readFloatLE=function(t,e){return t>>>=0,e||D(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return t>>>=0,e||D(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return t>>>=0,e||D(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return t>>>=0,e||D(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUintLE=u.prototype.writeUIntLE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||P(this,t,e,r,Math.pow(2,8*r)-1,0);let i=1,s=0;for(this[e]=255&t;++s<r&&(i*=256);)this[e+s]=t/i&255;return e+r},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||P(this,t,e,r,Math.pow(2,8*r)-1,0);let i=r-1,s=1;for(this[e+i]=255&t;--i>=0&&(s*=256);)this[e+i]=t/s&255;return e+r},u.prototype.writeUint8=u.prototype.writeUInt8=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,1,255,0),this[e]=255&t,e+1},u.prototype.writeUint16LE=u.prototype.writeUInt16LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,65535,0),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeUint16BE=u.prototype.writeUInt16BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,65535,0),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeUint32LE=u.prototype.writeUInt32LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,4,4294967295,0),this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t,e+4},u.prototype.writeUint32BE=u.prototype.writeUInt32BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,4,4294967295,0),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeBigUInt64LE=J((function(t,e=0){return k(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeBigUInt64BE=J((function(t,e=0){return L(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeIntLE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);P(this,t,e,r,n-1,-n)}let i=0,s=1,a=0;for(this[e]=255&t;++i<r&&(s*=256);)t<0&&0===a&&0!==this[e+i-1]&&(a=1),this[e+i]=(t/s>>0)-a&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);P(this,t,e,r,n-1,-n)}let i=r-1,s=1,a=0;for(this[e+i]=255&t;--i>=0&&(s*=256);)t<0&&0===a&&0!==this[e+i+1]&&(a=1),this[e+i]=(t/s>>0)-a&255;return e+r},u.prototype.writeInt8=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,1,127,-128),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,32767,-32768),this[e]=255&t,this[e+1]=t>>>8,e+2},u.prototype.writeInt16BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,2,32767,-32768),this[e]=t>>>8,this[e+1]=255&t,e+2},u.prototype.writeInt32LE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,4,2147483647,-2147483648),this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24,e+4},u.prototype.writeInt32BE=function(t,e,r){return t=+t,e>>>=0,r||P(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t,e+4},u.prototype.writeBigInt64LE=J((function(t,e=0){return k(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeBigInt64BE=J((function(t,e=0){return L(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeFloatLE=function(t,e,r){return _(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return _(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return U(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return U(this,t,e,!1,r)},u.prototype.copy=function(t,e,r,n){if(!u.isBuffer(t))throw new TypeError("argument should be a Buffer");if(r||(r=0),n||0===n||(n=this.length),e>=t.length&&(e=t.length),e||(e=0),n>0&&n<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);const i=n-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,n):Uint8Array.prototype.set.call(t,this.subarray(r,n),e),i},u.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){const e=t.charCodeAt(0);("utf8"===n&&e<128||"latin1"===n)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;let i;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i<r;++i)this[i]=t;else{const s=u.isBuffer(t)?t:u.from(t,n),a=s.length;if(0===a)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<r-e;++i)this[i+e]=s[i%a]}return this};const V={};function H(t,e,r){V[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function K(t){let e="",r=t.length;const n="-"===t[0]?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function j(t,e,r,n,i,s){if(t>r||t<e){const n="bigint"==typeof e?"n":"";let i;throw i=s>3?0===e||e===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(s+1)}${n}`:`>= -(2${n} ** ${8*(s+1)-1}${n}) and < 2 ** ${8*(s+1)-1}${n}`:`>= ${e}${n} and <= ${r}${n}`,new V.ERR_OUT_OF_RANGE("value",i,t)}!function(t,e,r){M(e,"offset"),void 0!==t[e]&&void 0!==t[e+r]||q(e,t.length-(r+1))}(n,i,s)}function M(t,e){if("number"!=typeof t)throw new V.ERR_INVALID_ARG_TYPE(e,"number",t)}function q(t,e,r){if(Math.floor(t)!==t)throw M(t,r),new V.ERR_OUT_OF_RANGE(r||"offset","an integer",t);if(e<0)throw new V.ERR_BUFFER_OUT_OF_BOUNDS;throw new V.ERR_OUT_OF_RANGE(r||"offset",`>= ${r?1:0} and <= ${e}`,t)}H("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),H("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),H("ERR_OUT_OF_RANGE",(function(t,e,r){let n=`The value of "${t}" is out of range.`,i=r;return Number.isInteger(r)&&Math.abs(r)>2**32?i=K(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=K(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n}),RangeError);const G=/[^+/0-9A-Za-z-_]/g;function z(t,e){let r;e=e||1/0;const n=t.length;let i=null;const s=[];for(let a=0;a<n;++a){if(r=t.charCodeAt(a),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function W(t){return n.toByteArray(function(t){if((t=(t=t.split("=")[0]).trim().replace(G,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function $(t,e,r,n){let i;for(i=0;i<n&&!(i+r>=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function Y(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function Q(t){return t!=t}const X=function(){const t="0123456789abcdef",e=new Array(256);for(let r=0;r<16;++r){const n=16*r;for(let i=0;i<16;++i)e[n+i]=t[r]+t[i]}return e}();function J(t){return"undefined"==typeof BigInt?Z:t}function Z(){throw new Error("BigInt not supported")}},24404:(t,e)=>{e.read=function(t,e,r,n,i){var s,a,o=8*i-n-1,u=(1<<o)-1,c=u>>1,l=-7,h=r?i-1:0,f=r?-1:1,p=t[e+h];for(h+=f,s=p&(1<<-l)-1,p>>=-l,l+=o;l>0;s=256*s+t[e+h],h+=f,l-=8);for(a=s&(1<<-l)-1,s>>=-l,l+=n;l>0;a=256*a+t[e+h],h+=f,l-=8);if(0===s)s=1-c;else{if(s===u)return a?NaN:1/0*(p?-1:1);a+=Math.pow(2,n),s-=c}return(p?-1:1)*a*Math.pow(2,s-n)},e.write=function(t,e,r,n,i,s){var a,o,u,c=8*s-i-1,l=(1<<c)-1,h=l>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:s-1,d=n?1:-1,g=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,a=l):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+h>=1?f/u:f*Math.pow(2,1-h))*u>=2&&(a++,u/=2),a+h>=l?(o=0,a=l):a+h>=1?(o=(e*u-1)*Math.pow(2,i),a+=h):(o=e*Math.pow(2,h-1)*Math.pow(2,i),a=0));i>=8;t[r+p]=255&o,p+=d,o/=256,i-=8);for(a=a<<i|o,c+=i;c>0;t[r+p]=255&a,p+=d,a/=256,c-=8);t[r+p-d]|=128*g}},6180:(t,e,r)=>{var n=r(91080);function i(t,e){n.cipher.registerAlgorithm(t,(function(){return new n.aes.Algorithm(t,e)}))}r(67844),r(16656),r(18736),t.exports=n.aes=n.aes||{},n.aes.startEncrypting=function(t,e,r,n){var i=g({key:t,output:r,decrypt:!1,mode:n});return i.start(e),i},n.aes.createEncryptionCipher=function(t,e){return g({key:t,output:null,decrypt:!1,mode:e})},n.aes.startDecrypting=function(t,e,r,n){var i=g({key:t,output:r,decrypt:!0,mode:n});return i.start(e),i},n.aes.createDecryptionCipher=function(t,e){return g({key:t,output:null,decrypt:!0,mode:e})},n.aes.Algorithm=function(t,e){l||f();var r=this;r.name=t,r.mode=new e({blockSize:16,cipher:{encrypt:function(t,e){return d(r._w,t,e,!1)},decrypt:function(t,e){return d(r._w,t,e,!0)}}}),r._init=!1},n.aes.Algorithm.prototype.initialize=function(t){if(!this._init){var e,r=t.key;if("string"!=typeof r||16!==r.length&&24!==r.length&&32!==r.length){if(n.util.isArray(r)&&(16===r.length||24===r.length||32===r.length)){e=r,r=n.util.createBuffer();for(var i=0;i<e.length;++i)r.putByte(e[i])}}else r=n.util.createBuffer(r);if(!n.util.isArray(r)){e=r,r=[];var s=e.length();if(16===s||24===s||32===s)for(s>>>=2,i=0;i<s;++i)r.push(e.getInt32())}if(!n.util.isArray(r)||4!==r.length&&6!==r.length&&8!==r.length)throw new Error("Invalid key parameter.");var a=this.mode.name,o=-1!==["CFB","OFB","CTR","GCM"].indexOf(a);this._w=p(r,t.decrypt&&!o),this._init=!0}},n.aes._expandKey=function(t,e){return l||f(),p(t,e)},n.aes._updateBlock=d,i("AES-ECB",n.cipher.modes.ecb),i("AES-CBC",n.cipher.modes.cbc),i("AES-CFB",n.cipher.modes.cfb),i("AES-OFB",n.cipher.modes.ofb),i("AES-CTR",n.cipher.modes.ctr),i("AES-GCM",n.cipher.modes.gcm);var s,a,o,u,c,l=!1,h=4;function f(){l=!0,o=[0,1,2,4,8,16,32,64,128,27,54];for(var t=new Array(256),e=0;e<128;++e)t[e]=e<<1,t[e+128]=e+128<<1^283;for(s=new Array(256),a=new Array(256),u=new Array(4),c=new Array(4),e=0;e<4;++e)u[e]=new Array(256),c[e]=new Array(256);var r,n,i,h,f,p,d,g=0,y=0;for(e=0;e<256;++e){h=(h=y^y<<1^y<<2^y<<3^y<<4)>>8^255&h^99,s[g]=h,a[h]=g,p=(f=t[h])<<24^h<<16^h<<8^h^f,d=((r=t[g])^(n=t[r])^(i=t[n]))<<24^(g^i)<<16^(g^n^i)<<8^g^r^i;for(var v=0;v<4;++v)u[v][g]=p,c[v][h]=d,p=p<<24|p>>>8,d=d<<24|d>>>8;0===g?g=y=1:(g=r^t[t[t[r^i]]],y^=t[t[y]])}}function p(t,e){for(var r,n=t.slice(0),i=1,a=n.length,u=h*(a+6+1),l=a;l<u;++l)r=n[l-1],l%a==0?(r=s[r>>>16&255]<<24^s[r>>>8&255]<<16^s[255&r]<<8^s[r>>>24]^o[i]<<24,i++):a>6&&l%a==4&&(r=s[r>>>24]<<24^s[r>>>16&255]<<16^s[r>>>8&255]<<8^s[255&r]),n[l]=n[l-a]^r;if(e){for(var f,p=c[0],d=c[1],g=c[2],y=c[3],v=n.slice(0),m=(l=0,(u=n.length)-h);l<u;l+=h,m-=h)if(0===l||l===u-h)v[l]=n[m],v[l+1]=n[m+3],v[l+2]=n[m+2],v[l+3]=n[m+1];else for(var E=0;E<h;++E)f=n[m+E],v[l+(3&-E)]=p[s[f>>>24]]^d[s[f>>>16&255]]^g[s[f>>>8&255]]^y[s[255&f]];n=v}return n}function d(t,e,r,n){var i,o,l,h,f,p,d,g,y,v,m,E,S=t.length/4-1;n?(i=c[0],o=c[1],l=c[2],h=c[3],f=a):(i=u[0],o=u[1],l=u[2],h=u[3],f=s),p=e[0]^t[0],d=e[n?3:1]^t[1],g=e[2]^t[2],y=e[n?1:3]^t[3];for(var b=3,C=1;C<S;++C)v=i[p>>>24]^o[d>>>16&255]^l[g>>>8&255]^h[255&y]^t[++b],m=i[d>>>24]^o[g>>>16&255]^l[y>>>8&255]^h[255&p]^t[++b],E=i[g>>>24]^o[y>>>16&255]^l[p>>>8&255]^h[255&d]^t[++b],y=i[y>>>24]^o[p>>>16&255]^l[d>>>8&255]^h[255&g]^t[++b],p=v,d=m,g=E;r[0]=f[p>>>24]<<24^f[d>>>16&255]<<16^f[g>>>8&255]<<8^f[255&y]^t[++b],r[n?3:1]=f[d>>>24]<<24^f[g>>>16&255]<<16^f[y>>>8&255]<<8^f[255&p]^t[++b],r[2]=f[g>>>24]<<24^f[y>>>16&255]<<16^f[p>>>8&255]<<8^f[255&d]^t[++b],r[n?1:3]=f[y>>>24]<<24^f[p>>>16&255]<<16^f[d>>>8&255]<<8^f[255&g]^t[++b]}function g(t){var e,r="AES-"+((t=t||{}).mode||"CBC").toUpperCase(),i=(e=t.decrypt?n.cipher.createDecipher(r,t.key):n.cipher.createCipher(r,t.key)).start;return e.start=function(t,r){var s=null;r instanceof n.util.ByteBuffer&&(s=r,r={}),(r=r||{}).output=s,r.iv=t,i.call(e,r)},e}},68776:(t,e,r)=>{var n=r(91080);r(6180),r(95720);var i=t.exports=n.tls;function s(t,e,r){var s=e.entity===n.tls.ConnectionEnd.client;t.read.cipherState={init:!1,cipher:n.cipher.createDecipher("AES-CBC",s?r.keys.server_write_key:r.keys.client_write_key),iv:s?r.keys.server_write_IV:r.keys.client_write_IV},t.write.cipherState={init:!1,cipher:n.cipher.createCipher("AES-CBC",s?r.keys.client_write_key:r.keys.server_write_key),iv:s?r.keys.client_write_IV:r.keys.server_write_IV},t.read.cipherFunction=c,t.write.cipherFunction=a,t.read.macLength=t.write.macLength=r.mac_length,t.read.macFunction=t.write.macFunction=i.hmac_sha1}function a(t,e){var r,s=!1,a=e.macFunction(e.macKey,e.sequenceNumber,t);t.fragment.putBytes(a),e.updateSequenceNumber(),r=t.version.minor===i.Versions.TLS_1_0.minor?e.cipherState.init?null:e.cipherState.iv:n.random.getBytesSync(16),e.cipherState.init=!0;var u=e.cipherState.cipher;return u.start({iv:r}),t.version.minor>=i.Versions.TLS_1_1.minor&&u.output.putBytes(r),u.update(t.fragment),u.finish(o)&&(t.fragment=u.output,t.length=t.fragment.length(),s=!0),s}function o(t,e,r){if(!r){var n=t-e.length()%t;e.fillWithByte(n-1,n)}return!0}function u(t,e,r){var n=!0;if(r){for(var i=e.length(),s=e.last(),a=i-1-s;a<i-1;++a)n=n&&e.at(a)==s;n&&e.truncate(s+1)}return n}function c(t,e){var r,s=!1;r=t.version.minor===i.Versions.TLS_1_0.minor?e.cipherState.init?null:e.cipherState.iv:t.fragment.getBytes(16),e.cipherState.init=!0;var a=e.cipherState.cipher;a.start({iv:r}),a.update(t.fragment),s=a.finish(u);var o=e.macLength,c=n.random.getBytesSync(o),l=a.output.length();l>=o?(t.fragment=a.output.getBytes(l-o),c=a.output.getBytes(o)):t.fragment=a.output.getBytes(),t.fragment=n.util.createBuffer(t.fragment),t.length=t.fragment.length();var h=e.macFunction(e.macKey,e.sequenceNumber,t);return e.updateSequenceNumber(),s=function(t,e,r){var i=n.hmac.create();return i.start("SHA1",t),i.update(e),e=i.digest().getBytes(),i.start(null,null),i.update(r),e===(r=i.digest().getBytes())}(e.macKey,c,h)&&s,s}i.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(t){t.bulk_cipher_algorithm=i.BulkCipherAlgorithm.aes,t.cipher_type=i.CipherType.block,t.enc_key_length=16,t.block_length=16,t.fixed_iv_length=16,t.record_iv_length=16,t.mac_algorithm=i.MACAlgorithm.hmac_sha1,t.mac_length=20,t.mac_key_length=20},initConnectionState:s},i.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(t){t.bulk_cipher_algorithm=i.BulkCipherAlgorithm.aes,t.cipher_type=i.CipherType.block,t.enc_key_length=32,t.block_length=16,t.fixed_iv_length=16,t.record_iv_length=16,t.mac_algorithm=i.MACAlgorithm.hmac_sha1,t.mac_length=20,t.mac_key_length=20},initConnectionState:s}},49196:(t,e,r)=>{var n=r(91080);r(4e4);var i=n.asn1;e.privateKeyValidator={name:"PrivateKeyInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",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:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},e.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",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:"publicKeyOid"}]},{tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,composed:!0,captureBitStringValue:"ed25519PublicKey"}]}},4e4:(t,e,r)=>{var n=r(91080);r(18736),r(91752);var i=t.exports=n.asn1=n.asn1||{};function s(t,e,r){if(r>e){var n=new Error("Too few bytes to parse DER.");throw n.available=t.length(),n.remaining=e,n.requested=r,n}}function a(t,e,r,n){var o;s(t,e,2);var u=t.getByte();e--;var c=192&u,l=31&u;o=t.length();var h,f,p=function(t,e){var r=t.getByte();if(e--,128!==r){var n;if(128&r){var i=127&r;s(t,e,i),n=t.getInt(i<<3)}else n=r;if(n<0)throw new Error("Negative length: "+n);return n}}(t,e);if(e-=o-t.length(),void 0!==p&&p>e){if(n.strict){var d=new Error("Too few bytes to read ASN.1 value.");throw d.available=t.length(),d.remaining=e,d.requested=p,d}p=e}var g=32==(32&u);if(g)if(h=[],void 0===p)for(;;){if(s(t,e,2),t.bytes(2)===String.fromCharCode(0,0)){t.getBytes(2),e-=2;break}o=t.length(),h.push(a(t,e,r+1,n)),e-=o-t.length()}else for(;p>0;)o=t.length(),h.push(a(t,p,r+1,n)),e-=o-t.length(),p-=o-t.length();if(void 0===h&&c===i.Class.UNIVERSAL&&l===i.Type.BITSTRING&&(f=t.bytes(p)),void 0===h&&n.decodeBitStrings&&c===i.Class.UNIVERSAL&&l===i.Type.BITSTRING&&p>1){var y=t.read,v=e,m=0;if(l===i.Type.BITSTRING&&(s(t,e,1),m=t.getByte(),e--),0===m)try{o=t.length();var E=a(t,e,r+1,{strict:!0,decodeBitStrings:!0}),S=o-t.length();e-=S,l==i.Type.BITSTRING&&S++;var b=E.tagClass;S!==p||b!==i.Class.UNIVERSAL&&b!==i.Class.CONTEXT_SPECIFIC||(h=[E])}catch(t){}void 0===h&&(t.read=y,e=v)}if(void 0===h){if(void 0===p){if(n.strict)throw new Error("Non-constructed ASN.1 object of indefinite length.");p=e}if(l===i.Type.BMPSTRING)for(h="";p>0;p-=2)s(t,e,2),h+=String.fromCharCode(t.getInt16()),e-=2;else h=t.getBytes(p),e-=p}var C=void 0===f?null:{bitStringContents:f};return i.create(c,l,g,h,C)}i.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192},i.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},i.create=function(t,e,r,s,a){if(n.util.isArray(s)){for(var o=[],u=0;u<s.length;++u)void 0!==s[u]&&o.push(s[u]);s=o}var c={tagClass:t,type:e,constructed:r,composed:r||n.util.isArray(s),value:s};return a&&"bitStringContents"in a&&(c.bitStringContents=a.bitStringContents,c.original=i.copy(c)),c},i.copy=function(t,e){var r;if(n.util.isArray(t)){r=[];for(var s=0;s<t.length;++s)r.push(i.copy(t[s],e));return r}return"string"==typeof t?t:(r={tagClass:t.tagClass,type:t.type,constructed:t.constructed,composed:t.composed,value:i.copy(t.value,e)},e&&!e.excludeBitStringContents&&(r.bitStringContents=t.bitStringContents),r)},i.equals=function(t,e,r){if(n.util.isArray(t)){if(!n.util.isArray(e))return!1;if(t.length!==e.length)return!1;for(var s=0;s<t.length;++s)if(!i.equals(t[s],e[s]))return!1;return!0}if(typeof t!=typeof e)return!1;if("string"==typeof t)return t===e;var a=t.tagClass===e.tagClass&&t.type===e.type&&t.constructed===e.constructed&&t.composed===e.composed&&i.equals(t.value,e.value);return r&&r.includeBitStringContents&&(a=a&&t.bitStringContents===e.bitStringContents),a},i.getBerValueLength=function(t){var e=t.getByte();if(128!==e)return 128&e?t.getInt((127&e)<<3):e},i.fromDer=function(t,e){void 0===e&&(e={strict:!0,parseAllBytes:!0,decodeBitStrings:!0}),"boolean"==typeof e&&(e={strict:e,parseAllBytes:!0,decodeBitStrings:!0}),"strict"in e||(e.strict=!0),"parseAllBytes"in e||(e.parseAllBytes=!0),"decodeBitStrings"in e||(e.decodeBitStrings=!0),"string"==typeof t&&(t=n.util.createBuffer(t));var r=t.length(),i=a(t,t.length(),0,e);if(e.parseAllBytes&&0!==t.length()){var s=new Error("Unparsed DER bytes remain after ASN.1 parsing.");throw s.byteCount=r,s.remaining=t.length(),s}return i},i.toDer=function(t){var e=n.util.createBuffer(),r=t.tagClass|t.type,s=n.util.createBuffer(),a=!1;if("bitStringContents"in t&&(a=!0,t.original&&(a=i.equals(t,t.original))),a)s.putBytes(t.bitStringContents);else if(t.composed){t.constructed?r|=32:s.putByte(0);for(var o=0;o<t.value.length;++o)void 0!==t.value[o]&&s.putBuffer(i.toDer(t.value[o]))}else if(t.type===i.Type.BMPSTRING)for(o=0;o<t.value.length;++o)s.putInt16(t.value.charCodeAt(o));else t.type===i.Type.INTEGER&&t.value.length>1&&(0===t.value.charCodeAt(0)&&0==(128&t.value.charCodeAt(1))||255===t.value.charCodeAt(0)&&128==(128&t.value.charCodeAt(1)))?s.putBytes(t.value.substr(1)):s.putBytes(t.value);if(e.putByte(r),s.length()<=127)e.putByte(127&s.length());else{var u=s.length(),c="";do{c+=String.fromCharCode(255&u),u>>>=8}while(u>0);for(e.putByte(128|c.length),o=c.length-1;o>=0;--o)e.putByte(c.charCodeAt(o))}return e.putBuffer(s),e},i.oidToDer=function(t){var e,r,i,s,a=t.split("."),o=n.util.createBuffer();o.putByte(40*parseInt(a[0],10)+parseInt(a[1],10));for(var u=2;u<a.length;++u){e=!0,r=[],i=parseInt(a[u],10);do{s=127&i,i>>>=7,e||(s|=128),r.push(s),e=!1}while(i>0);for(var c=r.length-1;c>=0;--c)o.putByte(r[c])}return o},i.derToOid=function(t){var e;"string"==typeof t&&(t=n.util.createBuffer(t));var r=t.getByte();e=Math.floor(r/40)+"."+r%40;for(var i=0;t.length()>0;)i<<=7,128&(r=t.getByte())?i+=127&r:(e+="."+(i+r),i=0);return e},i.utcTimeToDate=function(t){var e=new Date,r=parseInt(t.substr(0,2),10);r=r>=50?1900+r:2e3+r;var n=parseInt(t.substr(2,2),10)-1,i=parseInt(t.substr(4,2),10),s=parseInt(t.substr(6,2),10),a=parseInt(t.substr(8,2),10),o=0;if(t.length>11){var u=t.charAt(10),c=10;"+"!==u&&"-"!==u&&(o=parseInt(t.substr(10,2),10),c+=2)}if(e.setUTCFullYear(r,n,i),e.setUTCHours(s,a,o,0),c&&("+"===(u=t.charAt(c))||"-"===u)){var l=60*parseInt(t.substr(c+1,2),10)+parseInt(t.substr(c+4,2),10);l*=6e4,"+"===u?e.setTime(+e-l):e.setTime(+e+l)}return e},i.generalizedTimeToDate=function(t){var e=new Date,r=parseInt(t.substr(0,4),10),n=parseInt(t.substr(4,2),10)-1,i=parseInt(t.substr(6,2),10),s=parseInt(t.substr(8,2),10),a=parseInt(t.substr(10,2),10),o=parseInt(t.substr(12,2),10),u=0,c=0,l=!1;"Z"===t.charAt(t.length-1)&&(l=!0);var h=t.length-5,f=t.charAt(h);return"+"!==f&&"-"!==f||(c=60*parseInt(t.substr(h+1,2),10)+parseInt(t.substr(h+4,2),10),c*=6e4,"+"===f&&(c*=-1),l=!0),"."===t.charAt(14)&&(u=1e3*parseFloat(t.substr(14),10)),l?(e.setUTCFullYear(r,n,i),e.setUTCHours(s,a,o,u),e.setTime(+e+c)):(e.setFullYear(r,n,i),e.setHours(s,a,o,u)),e},i.dateToUtcTime=function(t){if("string"==typeof t)return t;var e="",r=[];r.push((""+t.getUTCFullYear()).substr(2)),r.push(""+(t.getUTCMonth()+1)),r.push(""+t.getUTCDate()),r.push(""+t.getUTCHours()),r.push(""+t.getUTCMinutes()),r.push(""+t.getUTCSeconds());for(var n=0;n<r.length;++n)r[n].length<2&&(e+="0"),e+=r[n];return e+"Z"},i.dateToGeneralizedTime=function(t){if("string"==typeof t)return t;var e="",r=[];r.push(""+t.getUTCFullYear()),r.push(""+(t.getUTCMonth()+1)),r.push(""+t.getUTCDate()),r.push(""+t.getUTCHours()),r.push(""+t.getUTCMinutes()),r.push(""+t.getUTCSeconds());for(var n=0;n<r.length;++n)r[n].length<2&&(e+="0"),e+=r[n];return e+"Z"},i.integerToDer=function(t){var e=n.util.createBuffer();if(t>=-128&&t<128)return e.putSignedInt(t,8);if(t>=-32768&&t<32768)return e.putSignedInt(t,16);if(t>=-8388608&&t<8388608)return e.putSignedInt(t,24);if(t>=-2147483648&&t<2147483648)return e.putSignedInt(t,32);var r=new Error("Integer too large; max is 32-bits.");throw r.integer=t,r},i.derToInteger=function(t){"string"==typeof t&&(t=n.util.createBuffer(t));var e=8*t.length();if(e>32)throw new Error("Integer too large; max is 32-bits.");return t.getSignedInt(e)},i.validate=function(t,e,r,s){var a=!1;if(t.tagClass!==e.tagClass&&void 0!==e.tagClass||t.type!==e.type&&void 0!==e.type)s&&(t.tagClass!==e.tagClass&&s.push("["+e.name+'] Expected tag class "'+e.tagClass+'", got "'+t.tagClass+'"'),t.type!==e.type&&s.push("["+e.name+'] Expected type "'+e.type+'", got "'+t.type+'"'));else if(t.constructed===e.constructed||void 0===e.constructed){if(a=!0,e.value&&n.util.isArray(e.value))for(var o=0,u=0;a&&u<e.value.length;++u)a=e.value[u].optional||!1,t.value[o]&&((a=i.validate(t.value[o],e.value[u],r,s))?++o:e.value[u].optional&&(a=!0)),!a&&s&&s.push("["+e.name+'] Tag class "'+e.tagClass+'", type "'+e.type+'" expected value length "'+e.value.length+'", got "'+t.value.length+'"');if(a&&r&&(e.capture&&(r[e.capture]=t.value),e.captureAsn1&&(r[e.captureAsn1]=t),e.captureBitStringContents&&"bitStringContents"in t&&(r[e.captureBitStringContents]=t.bitStringContents),e.captureBitStringValue&&"bitStringContents"in t))if(t.bitStringContents.length<2)r[e.captureBitStringValue]="";else{if(0!==t.bitStringContents.charCodeAt(0))throw new Error("captureBitStringValue only supported for zero unused bits");r[e.captureBitStringValue]=t.bitStringContents.slice(1)}}else s&&s.push("["+e.name+'] Expected constructed "'+e.constructed+'", got "'+t.constructed+'"');return a};var o=/[^\\u0000-\\u00ff]/;i.prettyPrint=function(t,e,r){var s="";r=r||2,(e=e||0)>0&&(s+="\n");for(var a="",u=0;u<e*r;++u)a+=" ";switch(s+=a+"Tag: ",t.tagClass){case i.Class.UNIVERSAL:s+="Universal:";break;case i.Class.APPLICATION:s+="Application:";break;case i.Class.CONTEXT_SPECIFIC:s+="Context-Specific:";break;case i.Class.PRIVATE:s+="Private:"}if(t.tagClass===i.Class.UNIVERSAL)switch(s+=t.type,t.type){case i.Type.NONE:s+=" (None)";break;case i.Type.BOOLEAN:s+=" (Boolean)";break;case i.Type.INTEGER:s+=" (Integer)";break;case i.Type.BITSTRING:s+=" (Bit string)";break;case i.Type.OCTETSTRING:s+=" (Octet string)";break;case i.Type.NULL:s+=" (Null)";break;case i.Type.OID:s+=" (Object Identifier)";break;case i.Type.ODESC:s+=" (Object Descriptor)";break;case i.Type.EXTERNAL:s+=" (External or Instance of)";break;case i.Type.REAL:s+=" (Real)";break;case i.Type.ENUMERATED:s+=" (Enumerated)";break;case i.Type.EMBEDDED:s+=" (Embedded PDV)";break;case i.Type.UTF8:s+=" (UTF8)";break;case i.Type.ROID:s+=" (Relative Object Identifier)";break;case i.Type.SEQUENCE:s+=" (Sequence)";break;case i.Type.SET:s+=" (Set)";break;case i.Type.PRINTABLESTRING:s+=" (Printable String)";break;case i.Type.IA5String:s+=" (IA5String (ASCII))";break;case i.Type.UTCTIME:s+=" (UTC time)";break;case i.Type.GENERALIZEDTIME:s+=" (Generalized time)";break;case i.Type.BMPSTRING:s+=" (BMP String)"}else s+=t.type;if(s+="\n",s+=a+"Constructed: "+t.constructed+"\n",t.composed){var c=0,l="";for(u=0;u<t.value.length;++u)void 0!==t.value[u]&&(c+=1,l+=i.prettyPrint(t.value[u],e+1,r),u+1<t.value.length&&(l+=","));s+=a+"Sub values: "+c+l}else{if(s+=a+"Value: ",t.type===i.Type.OID){var h=i.derToOid(t.value);s+=h,n.pki&&n.pki.oids&&h in n.pki.oids&&(s+=" ("+n.pki.oids[h]+") ")}if(t.type===i.Type.INTEGER)try{s+=i.derToInteger(t.value)}catch(e){s+="0x"+n.util.bytesToHex(t.value)}else if(t.type===i.Type.BITSTRING){if(t.value.length>1?s+="0x"+n.util.bytesToHex(t.value.slice(1)):s+="(none)",t.value.length>0){var f=t.value.charCodeAt(0);1==f?s+=" (1 unused bit shown)":f>1&&(s+=" ("+f+" unused bits shown)")}}else if(t.type===i.Type.OCTETSTRING)o.test(t.value)||(s+="("+t.value+") "),s+="0x"+n.util.bytesToHex(t.value);else if(t.type===i.Type.UTF8)try{s+=n.util.decodeUtf8(t.value)}catch(e){if("URI malformed"!==e.message)throw e;s+="0x"+n.util.bytesToHex(t.value)+" (malformed UTF8)"}else t.type===i.Type.PRINTABLESTRING||t.type===i.Type.IA5String?s+=t.value:o.test(t.value)?s+="0x"+n.util.bytesToHex(t.value):0===t.value.length?s+="[null]":s+=t.value}return s}},584:(t,e,r)=>{var n=r(19024).Buffer,i={};t.exports=i;var s={};i.encode=function(t,e,r){if("string"!=typeof e)throw new TypeError('"alphabet" must be a string.');if(void 0!==r&&"number"!=typeof r)throw new TypeError('"maxline" must be a number.');var n="";if(t instanceof Uint8Array){var i=0,s=e.length,a=e.charAt(0),o=[0];for(i=0;i<t.length;++i){for(var u=0,c=t[i];u<o.length;++u)c+=o[u]<<8,o[u]=c%s,c=c/s|0;for(;c>0;)o.push(c%s),c=c/s|0}for(i=0;0===t[i]&&i<t.length-1;++i)n+=a;for(i=o.length-1;i>=0;--i)n+=e[o[i]]}else n=function(t,e){var r=0,n=e.length,i=e.charAt(0),s=[0];for(r=0;r<t.length();++r){for(var a=0,o=t.at(r);a<s.length;++a)o+=s[a]<<8,s[a]=o%n,o=o/n|0;for(;o>0;)s.push(o%n),o=o/n|0}var u="";for(r=0;0===t.at(r)&&r<t.length()-1;++r)u+=i;for(r=s.length-1;r>=0;--r)u+=e[s[r]];return u}(t,e);if(r){var l=new RegExp(".{1,"+r+"}","g");n=n.match(l).join("\r\n")}return n},i.decode=function(t,e){if("string"!=typeof t)throw new TypeError('"input" must be a string.');if("string"!=typeof e)throw new TypeError('"alphabet" must be a string.');var r=s[e];if(!r){r=s[e]=[];for(var i=0;i<e.length;++i)r[e.charCodeAt(i)]=i}t=t.replace(/\s/g,"");var a=e.length,o=e.charAt(0),u=[0];for(i=0;i<t.length;i++){var c=r[t.charCodeAt(i)];if(void 0===c)return;for(var l=0,h=c;l<u.length;++l)h+=u[l]*a,u[l]=255&h,h>>=8;for(;h>0;)u.push(255&h),h>>=8}for(var f=0;t[f]===o&&f<t.length-1;++f)u.push(0);return void 0!==n?n.from(u.reverse()):new Uint8Array(u.reverse())}},67844:(t,e,r)=>{var n=r(91080);r(18736),t.exports=n.cipher=n.cipher||{},n.cipher.algorithms=n.cipher.algorithms||{},n.cipher.createCipher=function(t,e){var r=t;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+t);return new n.cipher.BlockCipher({algorithm:r,key:e,decrypt:!1})},n.cipher.createDecipher=function(t,e){var r=t;if("string"==typeof r&&(r=n.cipher.getAlgorithm(r))&&(r=r()),!r)throw new Error("Unsupported algorithm: "+t);return new n.cipher.BlockCipher({algorithm:r,key:e,decrypt:!0})},n.cipher.registerAlgorithm=function(t,e){t=t.toUpperCase(),n.cipher.algorithms[t]=e},n.cipher.getAlgorithm=function(t){return(t=t.toUpperCase())in n.cipher.algorithms?n.cipher.algorithms[t]:null};var i=n.cipher.BlockCipher=function(t){this.algorithm=t.algorithm,this.mode=this.algorithm.mode,this.blockSize=this.mode.blockSize,this._finish=!1,this._input=null,this.output=null,this._op=t.decrypt?this.mode.decrypt:this.mode.encrypt,this._decrypt=t.decrypt,this.algorithm.initialize(t)};i.prototype.start=function(t){t=t||{};var e={};for(var r in t)e[r]=t[r];e.decrypt=this._decrypt,this._finish=!1,this._input=n.util.createBuffer(),this.output=t.output||n.util.createBuffer(),this.mode.start(e)},i.prototype.update=function(t){for(t&&this._input.putBuffer(t);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()},i.prototype.finish=function(t){!t||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(e){return t(this.blockSize,e,!1)},this.mode.unpad=function(e){return t(this.blockSize,e,!0)});var e={};return e.decrypt=this._decrypt,e.overflow=this._input.length()%this.blockSize,!(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,e)||(this._finish=!0,this.update(),this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,e)||this.mode.afterFinish&&!this.mode.afterFinish(this.output,e)))}},16656:(t,e,r)=>{var n=r(91080);r(18736),n.cipher=n.cipher||{};var i=t.exports=n.cipher.modes=n.cipher.modes||{};function s(t,e){if("string"==typeof t&&(t=n.util.createBuffer(t)),n.util.isArray(t)&&t.length>4){var r=t;t=n.util.createBuffer();for(var i=0;i<r.length;++i)t.putByte(r[i])}if(t.length()<e)throw new Error("Invalid IV length; got "+t.length()+" bytes and expected "+e+" bytes.");if(!n.util.isArray(t)){var s=[],a=e/4;for(i=0;i<a;++i)s.push(t.getInt32());t=s}return t}function a(t){t[t.length-1]=t[t.length-1]+1&4294967295}function o(t){return[t/4294967296|0,4294967295&t]}i.ecb=function(t){t=t||{},this.name="ECB",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},i.ecb.prototype.start=function(t){},i.ecb.prototype.encrypt=function(t,e,r){if(t.length()<this.blockSize&&!(r&&t.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=t.getInt32();for(this.cipher.encrypt(this._inBlock,this._outBlock),n=0;n<this._ints;++n)e.putInt32(this._outBlock[n])},i.ecb.prototype.decrypt=function(t,e,r){if(t.length()<this.blockSize&&!(r&&t.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=t.getInt32();for(this.cipher.decrypt(this._inBlock,this._outBlock),n=0;n<this._ints;++n)e.putInt32(this._outBlock[n])},i.ecb.prototype.pad=function(t,e){var r=t.length()===this.blockSize?this.blockSize:this.blockSize-t.length();return t.fillWithByte(r,r),!0},i.ecb.prototype.unpad=function(t,e){if(e.overflow>0)return!1;var r=t.length(),n=t.at(r-1);return!(n>this.blockSize<<2||(t.truncate(n),0))},i.cbc=function(t){t=t||{},this.name="CBC",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints)},i.cbc.prototype.start=function(t){if(null===t.iv){if(!this._prev)throw new Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else{if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=s(t.iv,this.blockSize),this._prev=this._iv.slice(0)}},i.cbc.prototype.encrypt=function(t,e,r){if(t.length()<this.blockSize&&!(r&&t.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=this._prev[n]^t.getInt32();for(this.cipher.encrypt(this._inBlock,this._outBlock),n=0;n<this._ints;++n)e.putInt32(this._outBlock[n]);this._prev=this._outBlock},i.cbc.prototype.decrypt=function(t,e,r){if(t.length()<this.blockSize&&!(r&&t.length()>0))return!0;for(var n=0;n<this._ints;++n)this._inBlock[n]=t.getInt32();for(this.cipher.decrypt(this._inBlock,this._outBlock),n=0;n<this._ints;++n)e.putInt32(this._prev[n]^this._outBlock[n]);this._prev=this._inBlock.slice(0)},i.cbc.prototype.pad=function(t,e){var r=t.length()===this.blockSize?this.blockSize:this.blockSize-t.length();return t.fillWithByte(r,r),!0},i.cbc.prototype.unpad=function(t,e){if(e.overflow>0)return!1;var r=t.length(),n=t.at(r-1);return!(n>this.blockSize<<2||(t.truncate(n),0))},i.cfb=function(t){t=t||{},this.name="CFB",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.cfb.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=s(t.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.cfb.prototype.encrypt=function(t,e,r){var n=t.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)this._inBlock[i]=t.getInt32()^this._outBlock[i],e.putInt32(this._inBlock[i]);else{var s=(this.blockSize-n)%this.blockSize;for(s>0&&(s=this.blockSize-s),this._partialOutput.clear(),i=0;i<this._ints;++i)this._partialBlock[i]=t.getInt32()^this._outBlock[i],this._partialOutput.putInt32(this._partialBlock[i]);if(s>0)t.read-=this.blockSize;else for(i=0;i<this._ints;++i)this._inBlock[i]=this._partialBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return e.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.cfb.prototype.decrypt=function(t,e,r){var n=t.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)this._inBlock[i]=t.getInt32(),e.putInt32(this._inBlock[i]^this._outBlock[i]);else{var s=(this.blockSize-n)%this.blockSize;for(s>0&&(s=this.blockSize-s),this._partialOutput.clear(),i=0;i<this._ints;++i)this._partialBlock[i]=t.getInt32(),this._partialOutput.putInt32(this._partialBlock[i]^this._outBlock[i]);if(s>0)t.read-=this.blockSize;else for(i=0;i<this._ints;++i)this._inBlock[i]=this._partialBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return e.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.ofb=function(t){t=t||{},this.name="OFB",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.ofb.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=s(t.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ofb.prototype.encrypt=function(t,e,r){var n=t.length();if(0===t.length())return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)e.putInt32(t.getInt32()^this._outBlock[i]),this._inBlock[i]=this._outBlock[i];else{var s=(this.blockSize-n)%this.blockSize;for(s>0&&(s=this.blockSize-s),this._partialOutput.clear(),i=0;i<this._ints;++i)this._partialOutput.putInt32(t.getInt32()^this._outBlock[i]);if(s>0)t.read-=this.blockSize;else for(i=0;i<this._ints;++i)this._inBlock[i]=this._outBlock[i];if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return e.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}},i.ofb.prototype.decrypt=i.ofb.prototype.encrypt,i.ctr=function(t){t=t||{},this.name="CTR",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=null,this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0},i.ctr.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");this._iv=s(t.iv,this.blockSize),this._inBlock=this._iv.slice(0),this._partialBytes=0},i.ctr.prototype.encrypt=function(t,e,r){var n=t.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize)for(var i=0;i<this._ints;++i)e.putInt32(t.getInt32()^this._outBlock[i]);else{var s=(this.blockSize-n)%this.blockSize;for(s>0&&(s=this.blockSize-s),this._partialOutput.clear(),i=0;i<this._ints;++i)this._partialOutput.putInt32(t.getInt32()^this._outBlock[i]);if(s>0&&(t.read-=this.blockSize),this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return e.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}a(this._inBlock)},i.ctr.prototype.decrypt=i.ctr.prototype.encrypt,i.gcm=function(t){t=t||{},this.name="GCM",this.cipher=t.cipher,this.blockSize=t.blockSize||16,this._ints=this.blockSize/4,this._inBlock=new Array(this._ints),this._outBlock=new Array(this._ints),this._partialOutput=n.util.createBuffer(),this._partialBytes=0,this._R=3774873600},i.gcm.prototype.start=function(t){if(!("iv"in t))throw new Error("Invalid IV parameter.");var e,r=n.util.createBuffer(t.iv);if(this._cipherLength=0,e="additionalData"in t?n.util.createBuffer(t.additionalData):n.util.createBuffer(),this._tagLength="tagLength"in t?t.tagLength:128,this._tag=null,t.decrypt&&(this._tag=n.util.createBuffer(t.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 i=r.length();if(12===i)this._j0=[r.getInt32(),r.getInt32(),r.getInt32(),1];else{for(this._j0=[0,0,0,0];r.length()>0;)this._j0=this.ghash(this._hashSubkey,this._j0,[r.getInt32(),r.getInt32(),r.getInt32(),r.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(o(8*i)))}this._inBlock=this._j0.slice(0),a(this._inBlock),this._partialBytes=0,e=n.util.createBuffer(e),this._aDataLength=o(8*e.length());var s=e.length()%this.blockSize;for(s&&e.fillWithByte(0,this.blockSize-s),this._s=[0,0,0,0];e.length()>0;)this._s=this.ghash(this._hashSubkey,this._s,[e.getInt32(),e.getInt32(),e.getInt32(),e.getInt32()])},i.gcm.prototype.encrypt=function(t,e,r){var n=t.length();if(0===n)return!0;if(this.cipher.encrypt(this._inBlock,this._outBlock),0===this._partialBytes&&n>=this.blockSize){for(var i=0;i<this._ints;++i)e.putInt32(this._outBlock[i]^=t.getInt32());this._cipherLength+=this.blockSize}else{var s=(this.blockSize-n)%this.blockSize;for(s>0&&(s=this.blockSize-s),this._partialOutput.clear(),i=0;i<this._ints;++i)this._partialOutput.putInt32(t.getInt32()^this._outBlock[i]);if(s<=0||r){if(r){var o=n%this.blockSize;this._cipherLength+=o,this._partialOutput.truncate(this.blockSize-o)}else this._cipherLength+=this.blockSize;for(i=0;i<this._ints;++i)this._outBlock[i]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}if(this._partialBytes>0&&this._partialOutput.getBytes(this._partialBytes),s>0&&!r)return t.read-=this.blockSize,e.putBytes(this._partialOutput.getBytes(s-this._partialBytes)),this._partialBytes=s,!0;e.putBytes(this._partialOutput.getBytes(n-this._partialBytes)),this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock),a(this._inBlock)},i.gcm.prototype.decrypt=function(t,e,r){var n=t.length();if(n<this.blockSize&&!(r&&n>0))return!0;this.cipher.encrypt(this._inBlock,this._outBlock),a(this._inBlock),this._hashBlock[0]=t.getInt32(),this._hashBlock[1]=t.getInt32(),this._hashBlock[2]=t.getInt32(),this._hashBlock[3]=t.getInt32(),this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(var i=0;i<this._ints;++i)e.putInt32(this._outBlock[i]^this._hashBlock[i]);n<this.blockSize?this._cipherLength+=n%this.blockSize:this._cipherLength+=this.blockSize},i.gcm.prototype.afterFinish=function(t,e){var r=!0;e.decrypt&&e.overflow&&t.truncate(this.blockSize-e.overflow),this.tag=n.util.createBuffer();var i=this._aDataLength.concat(o(8*this._cipherLength));this._s=this.ghash(this._hashSubkey,this._s,i);var s=[];this.cipher.encrypt(this._j0,s);for(var a=0;a<this._ints;++a)this.tag.putInt32(this._s[a]^s[a]);return this.tag.truncate(this.tag.length()%(this._tagLength/8)),e.decrypt&&this.tag.bytes()!==this._tag&&(r=!1),r},i.gcm.prototype.multiply=function(t,e){for(var r=[0,0,0,0],n=e.slice(0),i=0;i<128;++i)t[i/32|0]&1<<31-i%32&&(r[0]^=n[0],r[1]^=n[1],r[2]^=n[2],r[3]^=n[3]),this.pow(n,n);return r},i.gcm.prototype.pow=function(t,e){for(var r=1&t[3],n=3;n>0;--n)e[n]=t[n]>>>1|(1&t[n-1])<<31;e[0]=t[0]>>>1,r&&(e[0]^=this._R)},i.gcm.prototype.tableMultiply=function(t){for(var e=[0,0,0,0],r=0;r<32;++r){var n=t[r/8|0]>>>4*(7-r%8)&15,i=this._m[r][n];e[0]^=i[0],e[1]^=i[1],e[2]^=i[2],e[3]^=i[3]}return e},i.gcm.prototype.ghash=function(t,e,r){return e[0]^=r[0],e[1]^=r[1],e[2]^=r[2],e[3]^=r[3],this.tableMultiply(e)},i.gcm.prototype.generateHashTable=function(t,e){for(var r=8/e,n=4*r,i=16*r,s=new Array(i),a=0;a<i;++a){var o=[0,0,0,0],u=(n-1-a%n)*e;o[a/n|0]=1<<e-1<<u,s[a]=this.generateSubHashTable(this.multiply(o,t),e)}return s},i.gcm.prototype.generateSubHashTable=function(t,e){var r=1<<e,n=r>>>1,i=new Array(r);i[n]=t.slice(0);for(var s=n>>>1;s>0;)this.pow(i[2*s],i[s]=[]),s>>=1;for(s=2;s<n;){for(var a=1;a<s;++a){var o=i[s],u=i[a];i[s+a]=[o[0]^u[0],o[1]^u[1],o[2]^u[2],o[3]^u[3]]}s*=2}for(i[0]=[0,0,0,0],s=n+1;s<r;++s){var c=i[s^n];i[s]=[t[0]^c[0],t[1]^c[1],t[2]^c[2],t[3]^c[3]]}return i}},3044:(t,e,r)=>{var n=r(91080);function i(t,e){n.cipher.registerAlgorithm(t,(function(){return new n.des.Algorithm(t,e)}))}r(67844),r(16656),r(18736),t.exports=n.des=n.des||{},n.des.startEncrypting=function(t,e,r,n){var i=d({key:t,output:r,decrypt:!1,mode:n||(null===e?"ECB":"CBC")});return i.start(e),i},n.des.createEncryptionCipher=function(t,e){return d({key:t,output:null,decrypt:!1,mode:e})},n.des.startDecrypting=function(t,e,r,n){var i=d({key:t,output:r,decrypt:!0,mode:n||(null===e?"ECB":"CBC")});return i.start(e),i},n.des.createDecryptionCipher=function(t,e){return d({key:t,output:null,decrypt:!0,mode:e})},n.des.Algorithm=function(t,e){var r=this;r.name=t,r.mode=new e({blockSize:8,cipher:{encrypt:function(t,e){return p(r._keys,t,e,!1)},decrypt:function(t,e){return p(r._keys,t,e,!0)}}}),r._init=!1},n.des.Algorithm.prototype.initialize=function(t){if(!this._init){var e=n.util.createBuffer(t.key);if(0===this.name.indexOf("3DES")&&24!==e.length())throw new Error("Invalid Triple-DES key size: "+8*e.length());this._keys=function(t){for(var e,r=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],n=[0,1,1048576,1048577,67108864,67108865,68157440,68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],i=[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],a=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],o=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],u=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],c=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],l=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],h=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],f=[0,32,0,32,1048576,1048608,1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],p=[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],g=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],y=t.length()>8?3:1,v=[],m=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],E=0,S=0;S<y;S++){var b=t.getInt32(),C=t.getInt32();b^=(e=252645135&(b>>>4^C))<<4,b^=e=65535&((C^=e)>>>-16^b),b^=(e=858993459&(b>>>2^(C^=e<<-16)))<<2,b^=e=65535&((C^=e)>>>-16^b),b^=(e=1431655765&(b>>>1^(C^=e<<-16)))<<1,b^=e=16711935&((C^=e)>>>8^b),e=(b^=(e=1431655765&(b>>>1^(C^=e<<8)))<<1)<<8|(C^=e)>>>20&240,b=C<<24|C<<8&16711680|C>>>8&65280|C>>>24&240,C=e;for(var A=0;A<m.length;++A){m[A]?(b=b<<2|b>>>26,C=C<<2|C>>>26):(b=b<<1|b>>>27,C=C<<1|C>>>27);var w=r[(b&=-15)>>>28]|n[b>>>24&15]|i[b>>>20&15]|s[b>>>16&15]|a[b>>>12&15]|o[b>>>8&15]|u[b>>>4&15],x=c[(C&=-15)>>>28]|l[C>>>24&15]|h[C>>>20&15]|f[C>>>16&15]|p[C>>>12&15]|d[C>>>8&15]|g[C>>>4&15];e=65535&(x>>>16^w),v[E++]=w^e,v[E++]=x^e<<16}}return v}(e),this._init=!0}},i("DES-ECB",n.cipher.modes.ecb),i("DES-CBC",n.cipher.modes.cbc),i("DES-CFB",n.cipher.modes.cfb),i("DES-OFB",n.cipher.modes.ofb),i("DES-CTR",n.cipher.modes.ctr),i("3DES-ECB",n.cipher.modes.ecb),i("3DES-CBC",n.cipher.modes.cbc),i("3DES-CFB",n.cipher.modes.cfb),i("3DES-OFB",n.cipher.modes.ofb),i("3DES-CTR",n.cipher.modes.ctr);var s=[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],a=[-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],o=[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],u=[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],c=[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],l=[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],h=[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],f=[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 p(t,e,r,n){var i,p,d=32===t.length?3:9;i=3===d?n?[30,-2,-2]:[0,32,2]:n?[94,62,-2,32,64,2,30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var g=e[0],y=e[1];g^=(p=252645135&(g>>>4^y))<<4,g^=(p=65535&(g>>>16^(y^=p)))<<16,g^=p=858993459&((y^=p)>>>2^g),g^=p=16711935&((y^=p<<2)>>>8^g),g=(g^=(p=1431655765&(g>>>1^(y^=p<<8)))<<1)<<1|g>>>31,y=(y^=p)<<1|y>>>31;for(var v=0;v<d;v+=3){for(var m=i[v+1],E=i[v+2],S=i[v];S!=m;S+=E){var b=y^t[S],C=(y>>>4|y<<28)^t[S+1];p=g,g=y,y=p^(a[b>>>24&63]|u[b>>>16&63]|l[b>>>8&63]|f[63&b]|s[C>>>24&63]|o[C>>>16&63]|c[C>>>8&63]|h[63&C])}p=g,g=y,y=p}y=y>>>1|y<<31,y^=p=1431655765&((g=g>>>1|g<<31)>>>1^y),y^=(p=16711935&(y>>>8^(g^=p<<1)))<<8,y^=(p=858993459&(y>>>2^(g^=p)))<<2,y^=p=65535&((g^=p)>>>16^y),y^=p=252645135&((g^=p<<16)>>>4^y),g^=p<<4,r[0]=g,r[1]=y}function d(t){var e,r="DES-"+((t=t||{}).mode||"CBC").toUpperCase(),i=(e=t.decrypt?n.cipher.createDecipher(r,t.key):n.cipher.createCipher(r,t.key)).start;return e.start=function(t,r){var s=null;r instanceof n.util.ByteBuffer&&(s=r,r={}),(r=r||{}).output=s,r.iv=t,i.call(e,r)},e}},18272:(t,e,r)=>{var n=r(19024).Buffer,i=r(91080);r(26056),r(90400),r(74756),r(18736);var s=r(49196),a=s.publicKeyValidator,o=s.privateKeyValidator;if(void 0===u)var u=i.jsbn.BigInteger;var c=i.util.ByteBuffer,l=void 0===n?Uint8Array:n;i.pki=i.pki||{},t.exports=i.pki.ed25519=i.ed25519=i.ed25519||{};var h=i.ed25519;function f(t){var e=t.message;if(e instanceof Uint8Array||e instanceof l)return e;var r=t.encoding;if(void 0===e){if(!t.md)throw new TypeError('"options.message" or "options.md" not specified.');e=t.md.digest().getBytes(),r="binary"}if("string"==typeof e&&!r)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if("string"==typeof e){if(void 0!==n)return n.from(e,r);e=new c(e,r)}else if(!(e instanceof c))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 i=new l(e.length()),s=0;s<i.length;++s)i[s]=e.at(s);return i}h.constants={},h.constants.PUBLIC_KEY_BYTE_LENGTH=32,h.constants.PRIVATE_KEY_BYTE_LENGTH=64,h.constants.SEED_BYTE_LENGTH=32,h.constants.SIGN_BYTE_LENGTH=64,h.constants.HASH_BYTE_LENGTH=64,h.generateKeyPair=function(t){var e=(t=t||{}).seed;if(void 0===e)e=i.random.getBytesSync(h.constants.SEED_BYTE_LENGTH);else if("string"==typeof e){if(e.length!==h.constants.SEED_BYTE_LENGTH)throw new TypeError('"seed" must be '+h.constants.SEED_BYTE_LENGTH+" bytes in length.")}else if(!(e instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, Uint8Array, or a binary string.');e=f({message:e,encoding:"binary"});for(var r=new l(h.constants.PUBLIC_KEY_BYTE_LENGTH),n=new l(h.constants.PRIVATE_KEY_BYTE_LENGTH),s=0;s<32;++s)n[s]=e[s];return function(t,e){var r,n=[O(),O(),O(),O()],i=b(e,32);for(i[0]&=248,i[31]&=127,i[31]|=64,D(n,i),B(t,n),r=0;r<32;++r)e[r+32]=t[r]}(r,n),{publicKey:r,privateKey:n}},h.privateKeyFromAsn1=function(t){var e={},r=[];if(!i.asn1.validate(t,o,e,r)){var n=new Error("Invalid Key.");throw n.errors=r,n}var s=i.asn1.derToOid(e.privateKeyOid),a=i.oids.EdDSA25519;if(s!==a)throw new Error('Invalid OID "'+s+'"; OID must be "'+a+'".');var u=e.privateKey;return{privateKeyBytes:f({message:i.asn1.fromDer(u).value,encoding:"binary"})}},h.publicKeyFromAsn1=function(t){var e={},r=[];if(!i.asn1.validate(t,a,e,r)){var n=new Error("Invalid Key.");throw n.errors=r,n}var s=i.asn1.derToOid(e.publicKeyOid),o=i.oids.EdDSA25519;if(s!==o)throw new Error('Invalid OID "'+s+'"; OID must be "'+o+'".');var u=e.ed25519PublicKey;if(u.length!==h.constants.PUBLIC_KEY_BYTE_LENGTH)throw new Error("Key length is invalid.");return f({message:u,encoding:"binary"})},h.publicKeyFromPrivateKey=function(t){var e=f({message:(t=t||{}).privateKey,encoding:"binary"});if(e.length!==h.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+h.constants.PRIVATE_KEY_BYTE_LENGTH);for(var r=new l(h.constants.PUBLIC_KEY_BYTE_LENGTH),n=0;n<r.length;++n)r[n]=e[32+n];return r},h.sign=function(t){var e=f(t=t||{}),r=f({message:t.privateKey,encoding:"binary"});if(r.length===h.constants.SEED_BYTE_LENGTH)r=h.generateKeyPair({seed:r}).privateKey;else if(r.length!==h.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+h.constants.SEED_BYTE_LENGTH+" or "+h.constants.PRIVATE_KEY_BYTE_LENGTH);var n=new l(h.constants.SIGN_BYTE_LENGTH+e.length);!function(t,e,r,n){var i,s,a=new Float64Array(64),o=[O(),O(),O(),O()],u=b(n,32);u[0]&=248,u[31]&=127,u[31]|=64;for(i=0;i<r;++i)t[64+i]=e[i];for(i=0;i<32;++i)t[32+i]=u[32+i];var c=b(t.subarray(32),r+32);for(A(c),D(o,c),B(t,o),i=32;i<64;++i)t[i]=n[i];var l=b(t,r+64);for(A(l),i=32;i<64;++i)a[i]=0;for(i=0;i<32;++i)a[i]=c[i];for(i=0;i<32;++i)for(s=0;s<32;s++)a[i+s]+=l[i]*u[s];C(t.subarray(32),a)}(n,e,e.length,r);for(var i=new l(h.constants.SIGN_BYTE_LENGTH),s=0;s<i.length;++s)i[s]=n[s];return i},h.verify=function(t){var e=f(t=t||{});if(void 0===t.signature)throw new TypeError('"options.signature" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a binary string.');var r=f({message:t.signature,encoding:"binary"});if(r.length!==h.constants.SIGN_BYTE_LENGTH)throw new TypeError('"options.signature" must have a byte length of '+h.constants.SIGN_BYTE_LENGTH);var n=f({message:t.publicKey,encoding:"binary"});if(n.length!==h.constants.PUBLIC_KEY_BYTE_LENGTH)throw new TypeError('"options.publicKey" must have a byte length of '+h.constants.PUBLIC_KEY_BYTE_LENGTH);var i,s=new l(h.constants.SIGN_BYTE_LENGTH+e.length),a=new l(h.constants.SIGN_BYTE_LENGTH+e.length);for(i=0;i<h.constants.SIGN_BYTE_LENGTH;++i)s[i]=r[i];for(i=0;i<e.length;++i)s[i+h.constants.SIGN_BYTE_LENGTH]=e[i];return function(t,e,r,n){var i,s=new l(32),a=[O(),O(),O(),O()],o=[O(),O(),O(),O()];if(r<64)return-1;if(function(t,e){var r=O(),n=O(),i=O(),s=O(),a=O(),o=O(),u=O();return P(t[2],d),function(t,e){var r;for(r=0;r<16;++r)t[r]=e[2*r]+(e[2*r+1]<<8);t[15]&=32767}(t[1],e),V(i,t[1]),H(s,i,g),U(i,i,t[2]),_(s,t[2],s),V(a,s),V(o,a),H(u,o,a),H(r,u,i),H(r,r,s),function(t,e){var r,n=O();for(r=0;r<16;++r)n[r]=e[r];for(r=250;r>=0;--r)V(n,n),1!==r&&H(n,n,e);for(r=0;r<16;++r)t[r]=n[r]}(r,r),H(r,r,i),H(r,r,s),H(r,r,s),H(t[0],r,s),V(n,t[0]),H(n,n,s),T(n,i)&&H(t[0],t[0],S),V(n,t[0]),H(n,n,s),T(n,i)?-1:(R(t[0])===e[31]>>7&&U(t[0],p,t[0]),H(t[3],t[0],t[1]),0)}(o,n))return-1;for(i=0;i<r;++i)t[i]=e[i];for(i=0;i<32;++i)t[i+32]=n[i];var u=b(t,r);if(A(u),N(a,o,u),D(o,e.subarray(32)),w(a,o),B(s,a),r-=64,F(e,0,s,0)){for(i=0;i<r;++i)t[i]=0;return-1}for(i=0;i<r;++i)t[i]=e[i+64];return r}(a,s,s.length,n)>=0};var p=O(),d=O([1]),g=O([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),y=O([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),v=O([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),m=O([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214]),E=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]),S=O([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);function b(t,e){var r=i.md.sha512.create(),s=new c(t);r.update(s.getBytes(e),"binary");var a=r.digest().getBytes();if(void 0!==n)return n.from(a,"binary");for(var o=new l(h.constants.HASH_BYTE_LENGTH),u=0;u<64;++u)o[u]=a.charCodeAt(u);return o}function C(t,e){var r,n,i,s;for(n=63;n>=32;--n){for(r=0,i=n-32,s=n-12;i<s;++i)e[i]+=r-16*e[n]*E[i-(n-32)],r=e[i]+128>>8,e[i]-=256*r;e[i]+=r,e[n]=0}for(r=0,i=0;i<32;++i)e[i]+=r-(e[31]>>4)*E[i],r=e[i]>>8,e[i]&=255;for(i=0;i<32;++i)e[i]-=r*E[i];for(n=0;n<32;++n)e[n+1]+=e[n]>>8,t[n]=255&e[n]}function A(t){for(var e=new Float64Array(64),r=0;r<64;++r)e[r]=t[r],t[r]=0;C(t,e)}function w(t,e){var r=O(),n=O(),i=O(),s=O(),a=O(),o=O(),u=O(),c=O(),l=O();U(r,t[1],t[0]),U(l,e[1],e[0]),H(r,r,l),_(n,t[0],t[1]),_(l,e[0],e[1]),H(n,n,l),H(i,t[3],e[3]),H(i,i,y),H(s,t[2],e[2]),_(s,s,s),U(a,n,r),U(o,s,i),_(u,s,i),_(c,n,r),H(t[0],a,o),H(t[1],c,u),H(t[2],u,o),H(t[3],a,c)}function x(t,e,r){for(var n=0;n<4;++n)L(t[n],e[n],r)}function B(t,e){var r=O(),n=O(),i=O();!function(t,e){var r,n=O();for(r=0;r<16;++r)n[r]=e[r];for(r=253;r>=0;--r)V(n,n),2!==r&&4!==r&&H(n,n,e);for(r=0;r<16;++r)t[r]=n[r]}(i,e[2]),H(r,e[0],i),H(n,e[1],i),I(t,n),t[31]^=R(r)<<7}function I(t,e){var r,n,i,s=O(),a=O();for(r=0;r<16;++r)a[r]=e[r];for(k(a),k(a),k(a),n=0;n<2;++n){for(s[0]=a[0]-65517,r=1;r<15;++r)s[r]=a[r]-65535-(s[r-1]>>16&1),s[r-1]&=65535;s[15]=a[15]-32767-(s[14]>>16&1),i=s[15]>>16&1,s[14]&=65535,L(a,s,1-i)}for(r=0;r<16;r++)t[2*r]=255&a[r],t[2*r+1]=a[r]>>8}function T(t,e){var r=new l(32),n=new l(32);return I(r,t),I(n,e),F(r,0,n,0)}function F(t,e,r,n){return function(t,e,r,n,i){var s,a=0;for(s=0;s<32;++s)a|=t[e+s]^r[n+s];return(1&a-1>>>8)-1}(t,e,r,n)}function R(t){var e=new l(32);return I(e,t),1&e[0]}function N(t,e,r){var n,i;for(P(t[0],p),P(t[1],d),P(t[2],d),P(t[3],p),i=255;i>=0;--i)x(t,e,n=r[i/8|0]>>(7&i)&1),w(e,t),w(t,t),x(t,e,n)}function D(t,e){var r=[O(),O(),O(),O()];P(r[0],v),P(r[1],m),P(r[2],d),H(r[3],v,m),N(t,r,e)}function P(t,e){var r;for(r=0;r<16;r++)t[r]=0|e[r]}function k(t){var e,r,n=1;for(e=0;e<16;++e)r=t[e]+n+65535,n=Math.floor(r/65536),t[e]=r-65536*n;t[0]+=n-1+37*(n-1)}function L(t,e,r){for(var n,i=~(r-1),s=0;s<16;++s)n=i&(t[s]^e[s]),t[s]^=n,e[s]^=n}function O(t){var e,r=new Float64Array(16);if(t)for(e=0;e<t.length;++e)r[e]=t[e];return r}function _(t,e,r){for(var n=0;n<16;++n)t[n]=e[n]+r[n]}function U(t,e,r){for(var n=0;n<16;++n)t[n]=e[n]-r[n]}function V(t,e){H(t,e,e)}function H(t,e,r){var n,i,s=0,a=0,o=0,u=0,c=0,l=0,h=0,f=0,p=0,d=0,g=0,y=0,v=0,m=0,E=0,S=0,b=0,C=0,A=0,w=0,x=0,B=0,I=0,T=0,F=0,R=0,N=0,D=0,P=0,k=0,L=0,O=r[0],_=r[1],U=r[2],V=r[3],H=r[4],K=r[5],j=r[6],M=r[7],q=r[8],G=r[9],z=r[10],W=r[11],$=r[12],Y=r[13],Q=r[14],X=r[15];s+=(n=e[0])*O,a+=n*_,o+=n*U,u+=n*V,c+=n*H,l+=n*K,h+=n*j,f+=n*M,p+=n*q,d+=n*G,g+=n*z,y+=n*W,v+=n*$,m+=n*Y,E+=n*Q,S+=n*X,a+=(n=e[1])*O,o+=n*_,u+=n*U,c+=n*V,l+=n*H,h+=n*K,f+=n*j,p+=n*M,d+=n*q,g+=n*G,y+=n*z,v+=n*W,m+=n*$,E+=n*Y,S+=n*Q,b+=n*X,o+=(n=e[2])*O,u+=n*_,c+=n*U,l+=n*V,h+=n*H,f+=n*K,p+=n*j,d+=n*M,g+=n*q,y+=n*G,v+=n*z,m+=n*W,E+=n*$,S+=n*Y,b+=n*Q,C+=n*X,u+=(n=e[3])*O,c+=n*_,l+=n*U,h+=n*V,f+=n*H,p+=n*K,d+=n*j,g+=n*M,y+=n*q,v+=n*G,m+=n*z,E+=n*W,S+=n*$,b+=n*Y,C+=n*Q,A+=n*X,c+=(n=e[4])*O,l+=n*_,h+=n*U,f+=n*V,p+=n*H,d+=n*K,g+=n*j,y+=n*M,v+=n*q,m+=n*G,E+=n*z,S+=n*W,b+=n*$,C+=n*Y,A+=n*Q,w+=n*X,l+=(n=e[5])*O,h+=n*_,f+=n*U,p+=n*V,d+=n*H,g+=n*K,y+=n*j,v+=n*M,m+=n*q,E+=n*G,S+=n*z,b+=n*W,C+=n*$,A+=n*Y,w+=n*Q,x+=n*X,h+=(n=e[6])*O,f+=n*_,p+=n*U,d+=n*V,g+=n*H,y+=n*K,v+=n*j,m+=n*M,E+=n*q,S+=n*G,b+=n*z,C+=n*W,A+=n*$,w+=n*Y,x+=n*Q,B+=n*X,f+=(n=e[7])*O,p+=n*_,d+=n*U,g+=n*V,y+=n*H,v+=n*K,m+=n*j,E+=n*M,S+=n*q,b+=n*G,C+=n*z,A+=n*W,w+=n*$,x+=n*Y,B+=n*Q,I+=n*X,p+=(n=e[8])*O,d+=n*_,g+=n*U,y+=n*V,v+=n*H,m+=n*K,E+=n*j,S+=n*M,b+=n*q,C+=n*G,A+=n*z,w+=n*W,x+=n*$,B+=n*Y,I+=n*Q,T+=n*X,d+=(n=e[9])*O,g+=n*_,y+=n*U,v+=n*V,m+=n*H,E+=n*K,S+=n*j,b+=n*M,C+=n*q,A+=n*G,w+=n*z,x+=n*W,B+=n*$,I+=n*Y,T+=n*Q,F+=n*X,g+=(n=e[10])*O,y+=n*_,v+=n*U,m+=n*V,E+=n*H,S+=n*K,b+=n*j,C+=n*M,A+=n*q,w+=n*G,x+=n*z,B+=n*W,I+=n*$,T+=n*Y,F+=n*Q,R+=n*X,y+=(n=e[11])*O,v+=n*_,m+=n*U,E+=n*V,S+=n*H,b+=n*K,C+=n*j,A+=n*M,w+=n*q,x+=n*G,B+=n*z,I+=n*W,T+=n*$,F+=n*Y,R+=n*Q,N+=n*X,v+=(n=e[12])*O,m+=n*_,E+=n*U,S+=n*V,b+=n*H,C+=n*K,A+=n*j,w+=n*M,x+=n*q,B+=n*G,I+=n*z,T+=n*W,F+=n*$,R+=n*Y,N+=n*Q,D+=n*X,m+=(n=e[13])*O,E+=n*_,S+=n*U,b+=n*V,C+=n*H,A+=n*K,w+=n*j,x+=n*M,B+=n*q,I+=n*G,T+=n*z,F+=n*W,R+=n*$,N+=n*Y,D+=n*Q,P+=n*X,E+=(n=e[14])*O,S+=n*_,b+=n*U,C+=n*V,A+=n*H,w+=n*K,x+=n*j,B+=n*M,I+=n*q,T+=n*G,F+=n*z,R+=n*W,N+=n*$,D+=n*Y,P+=n*Q,k+=n*X,S+=(n=e[15])*O,a+=38*(C+=n*U),o+=38*(A+=n*V),u+=38*(w+=n*H),c+=38*(x+=n*K),l+=38*(B+=n*j),h+=38*(I+=n*M),f+=38*(T+=n*q),p+=38*(F+=n*G),d+=38*(R+=n*z),g+=38*(N+=n*W),y+=38*(D+=n*$),v+=38*(P+=n*Y),m+=38*(k+=n*Q),E+=38*(L+=n*X),s=(n=(s+=38*(b+=n*_))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),a=(n=a+i+65535)-65536*(i=Math.floor(n/65536)),o=(n=o+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),l=(n=l+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+i+65535)-65536*(i=Math.floor(n/65536)),f=(n=f+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),v=(n=v+i+65535)-65536*(i=Math.floor(n/65536)),m=(n=m+i+65535)-65536*(i=Math.floor(n/65536)),E=(n=E+i+65535)-65536*(i=Math.floor(n/65536)),S=(n=S+i+65535)-65536*(i=Math.floor(n/65536)),s=(n=(s+=i-1+37*(i-1))+(i=1)+65535)-65536*(i=Math.floor(n/65536)),a=(n=a+i+65535)-65536*(i=Math.floor(n/65536)),o=(n=o+i+65535)-65536*(i=Math.floor(n/65536)),u=(n=u+i+65535)-65536*(i=Math.floor(n/65536)),c=(n=c+i+65535)-65536*(i=Math.floor(n/65536)),l=(n=l+i+65535)-65536*(i=Math.floor(n/65536)),h=(n=h+i+65535)-65536*(i=Math.floor(n/65536)),f=(n=f+i+65535)-65536*(i=Math.floor(n/65536)),p=(n=p+i+65535)-65536*(i=Math.floor(n/65536)),d=(n=d+i+65535)-65536*(i=Math.floor(n/65536)),g=(n=g+i+65535)-65536*(i=Math.floor(n/65536)),y=(n=y+i+65535)-65536*(i=Math.floor(n/65536)),v=(n=v+i+65535)-65536*(i=Math.floor(n/65536)),m=(n=m+i+65535)-65536*(i=Math.floor(n/65536)),E=(n=E+i+65535)-65536*(i=Math.floor(n/65536)),S=(n=S+i+65535)-65536*(i=Math.floor(n/65536)),s+=i-1+37*(i-1),t[0]=s,t[1]=a,t[2]=o,t[3]=u,t[4]=c,t[5]=l,t[6]=h,t[7]=f,t[8]=p,t[9]=d,t[10]=g,t[11]=y,t[12]=v,t[13]=m,t[14]=E,t[15]=S}},91080:t=>{t.exports={options:{usePureJavaScript:!1}}},43472:(t,e,r)=>{var n=r(91080);r(48724),r(18736),(t.exports=n.hmac=n.hmac||{}).create=function(){var t=null,e=null,r=null,i=null,s={start:function(s,a){if(null!==s)if("string"==typeof s){if(!((s=s.toLowerCase())in n.md.algorithms))throw new Error('Unknown hash algorithm "'+s+'"');e=n.md.algorithms[s].create()}else e=s;if(null===a)a=t;else{if("string"==typeof a)a=n.util.createBuffer(a);else if(n.util.isArray(a)){var o=a;a=n.util.createBuffer();for(var u=0;u<o.length;++u)a.putByte(o[u])}var c=a.length();for(c>e.blockLength&&(e.start(),e.update(a.bytes()),a=e.digest()),r=n.util.createBuffer(),i=n.util.createBuffer(),c=a.length(),u=0;u<c;++u)o=a.at(u),r.putByte(54^o),i.putByte(92^o);if(c<e.blockLength)for(o=e.blockLength-c,u=0;u<o;++u)r.putByte(54),i.putByte(92);t=a,r=r.bytes(),i=i.bytes()}e.start(),e.update(r)},update:function(t){e.update(t)},getMac:function(){var t=e.digest().bytes();return e.start(),e.update(i),e.update(t),e.digest()}};return s.digest=s.getMac,s}},68212:(t,e,r)=>{t.exports=r(91080),r(6180),r(68776),r(4e4),r(67844),r(3044),r(18272),r(43472),r(49348),r(21200),r(15416),r(36620),r(71256),r(96964),r(29948),r(45644),r(1376),r(75300),r(88200),r(80408),r(4124),r(90400),r(42196),r(89573),r(95720),r(18736)},26056:(t,e,r)=>{var n,i=r(91080);function s(t,e,r){this.data=[],null!=t&&("number"==typeof t?this.fromNumber(t,e,r):null==e&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,e))}function a(){return new s(null)}function o(t,e,r,n,i,s){for(var a=16383&e,o=e>>14;--s>=0;){var u=16383&this.data[t],c=this.data[t++]>>14,l=o*u+c*a;i=((u=a*u+((16383&l)<<14)+r.data[n]+i)>>28)+(l>>14)+o*c,r.data[n++]=268435455&u}return i}t.exports=i.jsbn=i.jsbn||{},i.jsbn.BigInteger=s,"undefined"==typeof navigator?(s.prototype.am=o,n=28):"Microsoft Internet Explorer"==navigator.appName?(s.prototype.am=function(t,e,r,n,i,s){for(var a=32767&e,o=e>>15;--s>=0;){var u=32767&this.data[t],c=this.data[t++]>>15,l=o*u+c*a;i=((u=a*u+((32767&l)<<15)+r.data[n]+(1073741823&i))>>>30)+(l>>>15)+o*c+(i>>>30),r.data[n++]=1073741823&u}return i},n=30):"Netscape"!=navigator.appName?(s.prototype.am=function(t,e,r,n,i,s){for(;--s>=0;){var a=e*this.data[t++]+r.data[n]+i;i=Math.floor(a/67108864),r.data[n++]=67108863&a}return i},n=26):(s.prototype.am=o,n=28),s.prototype.DB=n,s.prototype.DM=(1<<n)-1,s.prototype.DV=1<<n,s.prototype.FV=Math.pow(2,52),s.prototype.F1=52-n,s.prototype.F2=2*n-52;var u,c,l=new Array;for(u="0".charCodeAt(0),c=0;c<=9;++c)l[u++]=c;for(u="a".charCodeAt(0),c=10;c<36;++c)l[u++]=c;for(u="A".charCodeAt(0),c=10;c<36;++c)l[u++]=c;function h(t){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(t)}function f(t,e){var r=l[t.charCodeAt(e)];return null==r?-1:r}function p(t){var e=a();return e.fromInt(t),e}function d(t){var e,r=1;return 0!=(e=t>>>16)&&(t=e,r+=16),0!=(e=t>>8)&&(t=e,r+=8),0!=(e=t>>4)&&(t=e,r+=4),0!=(e=t>>2)&&(t=e,r+=2),0!=(e=t>>1)&&(t=e,r+=1),r}function g(t){this.m=t}function y(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}function v(t,e){return t&e}function m(t,e){return t|e}function E(t,e){return t^e}function S(t,e){return t&~e}function b(t){if(0==t)return-1;var e=0;return 0==(65535&t)&&(t>>=16,e+=16),0==(255&t)&&(t>>=8,e+=8),0==(15&t)&&(t>>=4,e+=4),0==(3&t)&&(t>>=2,e+=2),0==(1&t)&&++e,e}function C(t){for(var e=0;0!=t;)t&=t-1,++e;return e}function A(){}function w(t){return t}function x(t){this.r2=a(),this.q3=a(),s.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}g.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},g.prototype.revert=function(t){return t},g.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},g.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},g.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},y.prototype.convert=function(t){var e=a();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(s.ZERO)>0&&this.m.subTo(e,e),e},y.prototype.revert=function(t){var e=a();return t.copyTo(e),this.reduce(e),e},y.prototype.reduce=function(t){for(;t.t<=this.mt2;)t.data[t.t++]=0;for(var e=0;e<this.m.t;++e){var r=32767&t.data[e],n=r*this.mpl+((r*this.mph+(t.data[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(r=e+this.m.t,t.data[r]+=this.m.am(0,n,t,e,0,this.m.t);t.data[r]>=t.DV;)t.data[r]-=t.DV,t.data[++r]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},y.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},y.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},s.prototype.copyTo=function(t){for(var e=this.t-1;e>=0;--e)t.data[e]=this.data[e];t.t=this.t,t.s=this.s},s.prototype.fromInt=function(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},s.prototype.fromString=function(t,e){var r;if(16==e)r=4;else if(8==e)r=3;else if(256==e)r=8;else if(2==e)r=1;else if(32==e)r=5;else{if(4!=e)return void this.fromRadix(t,e);r=2}this.t=0,this.s=0;for(var n=t.length,i=!1,a=0;--n>=0;){var o=8==r?255&t[n]:f(t,n);o<0?"-"==t.charAt(n)&&(i=!0):(i=!1,0==a?this.data[this.t++]=o:a+r>this.DB?(this.data[this.t-1]|=(o&(1<<this.DB-a)-1)<<a,this.data[this.t++]=o>>this.DB-a):this.data[this.t-1]|=o<<a,(a+=r)>=this.DB&&(a-=this.DB))}8==r&&0!=(128&t[0])&&(this.s=-1,a>0&&(this.data[this.t-1]|=(1<<this.DB-a)-1<<a)),this.clamp(),i&&s.ZERO.subTo(this,this)},s.prototype.clamp=function(){for(var t=this.s&this.DM;this.t>0&&this.data[this.t-1]==t;)--this.t},s.prototype.dlShiftTo=function(t,e){var r;for(r=this.t-1;r>=0;--r)e.data[r+t]=this.data[r];for(r=t-1;r>=0;--r)e.data[r]=0;e.t=this.t+t,e.s=this.s},s.prototype.drShiftTo=function(t,e){for(var r=t;r<this.t;++r)e.data[r-t]=this.data[r];e.t=Math.max(this.t-t,0),e.s=this.s},s.prototype.lShiftTo=function(t,e){var r,n=t%this.DB,i=this.DB-n,s=(1<<i)-1,a=Math.floor(t/this.DB),o=this.s<<n&this.DM;for(r=this.t-1;r>=0;--r)e.data[r+a+1]=this.data[r]>>i|o,o=(this.data[r]&s)<<n;for(r=a-1;r>=0;--r)e.data[r]=0;e.data[a]=o,e.t=this.t+a+1,e.s=this.s,e.clamp()},s.prototype.rShiftTo=function(t,e){e.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t)e.t=0;else{var n=t%this.DB,i=this.DB-n,s=(1<<n)-1;e.data[0]=this.data[r]>>n;for(var a=r+1;a<this.t;++a)e.data[a-r-1]|=(this.data[a]&s)<<i,e.data[a-r]=this.data[a]>>n;n>0&&(e.data[this.t-r-1]|=(this.s&s)<<i),e.t=this.t-r,e.clamp()}},s.prototype.subTo=function(t,e){for(var r=0,n=0,i=Math.min(t.t,this.t);r<i;)n+=this.data[r]-t.data[r],e.data[r++]=n&this.DM,n>>=this.DB;if(t.t<this.t){for(n-=t.s;r<this.t;)n+=this.data[r],e.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<t.t;)n-=t.data[r],e.data[r++]=n&this.DM,n>>=this.DB;n-=t.s}e.s=n<0?-1:0,n<-1?e.data[r++]=this.DV+n:n>0&&(e.data[r++]=n),e.t=r,e.clamp()},s.prototype.multiplyTo=function(t,e){var r=this.abs(),n=t.abs(),i=r.t;for(e.t=i+n.t;--i>=0;)e.data[i]=0;for(i=0;i<n.t;++i)e.data[i+r.t]=r.am(0,n.data[i],e,i,0,r.t);e.s=0,e.clamp(),this.s!=t.s&&s.ZERO.subTo(e,e)},s.prototype.squareTo=function(t){for(var e=this.abs(),r=t.t=2*e.t;--r>=0;)t.data[r]=0;for(r=0;r<e.t-1;++r){var n=e.am(r,e.data[r],t,2*r,0,1);(t.data[r+e.t]+=e.am(r+1,2*e.data[r],t,2*r+1,n,e.t-r-1))>=e.DV&&(t.data[r+e.t]-=e.DV,t.data[r+e.t+1]=1)}t.t>0&&(t.data[t.t-1]+=e.am(r,e.data[r],t,2*r,0,1)),t.s=0,t.clamp()},s.prototype.divRemTo=function(t,e,r){var n=t.abs();if(!(n.t<=0)){var i=this.abs();if(i.t<n.t)return null!=e&&e.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=a());var o=a(),u=this.s,c=t.s,l=this.DB-d(n.data[n.t-1]);l>0?(n.lShiftTo(l,o),i.lShiftTo(l,r)):(n.copyTo(o),i.copyTo(r));var h=o.t,f=o.data[h-1];if(0!=f){var p=f*(1<<this.F1)+(h>1?o.data[h-2]>>this.F2:0),g=this.FV/p,y=(1<<this.F1)/p,v=1<<this.F2,m=r.t,E=m-h,S=null==e?a():e;for(o.dlShiftTo(E,S),r.compareTo(S)>=0&&(r.data[r.t++]=1,r.subTo(S,r)),s.ONE.dlShiftTo(h,S),S.subTo(o,o);o.t<h;)o.data[o.t++]=0;for(;--E>=0;){var b=r.data[--m]==f?this.DM:Math.floor(r.data[m]*g+(r.data[m-1]+v)*y);if((r.data[m]+=o.am(0,b,r,E,0,h))<b)for(o.dlShiftTo(E,S),r.subTo(S,r);r.data[m]<--b;)r.subTo(S,r)}null!=e&&(r.drShiftTo(h,e),u!=c&&s.ZERO.subTo(e,e)),r.t=h,r.clamp(),l>0&&r.rShiftTo(l,r),u<0&&s.ZERO.subTo(r,r)}}},s.prototype.invDigit=function(){if(this.t<1)return 0;var t=this.data[0];if(0==(1&t))return 0;var e=3&t;return(e=(e=(e=(e=e*(2-(15&t)*e)&15)*(2-(255&t)*e)&255)*(2-((65535&t)*e&65535))&65535)*(2-t*e%this.DV)%this.DV)>0?this.DV-e:-e},s.prototype.isEven=function(){return 0==(this.t>0?1&this.data[0]:this.s)},s.prototype.exp=function(t,e){if(t>4294967295||t<1)return s.ONE;var r=a(),n=a(),i=e.convert(this),o=d(t)-1;for(i.copyTo(r);--o>=0;)if(e.sqrTo(r,n),(t&1<<o)>0)e.mulTo(n,i,r);else{var u=r;r=n,n=u}return e.revert(r)},s.prototype.toString=function(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var r,n=(1<<e)-1,i=!1,s="",a=this.t,o=this.DB-a*this.DB%e;if(a-- >0)for(o<this.DB&&(r=this.data[a]>>o)>0&&(i=!0,s=h(r));a>=0;)o<e?(r=(this.data[a]&(1<<o)-1)<<e-o,r|=this.data[--a]>>(o+=this.DB-e)):(r=this.data[a]>>(o-=e)&n,o<=0&&(o+=this.DB,--a)),r>0&&(i=!0),i&&(s+=h(r));return i?s:"0"},s.prototype.negate=function(){var t=a();return s.ZERO.subTo(this,t),t},s.prototype.abs=function(){return this.s<0?this.negate():this},s.prototype.compareTo=function(t){var e=this.s-t.s;if(0!=e)return e;var r=this.t;if(0!=(e=r-t.t))return this.s<0?-e:e;for(;--r>=0;)if(0!=(e=this.data[r]-t.data[r]))return e;return 0},s.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+d(this.data[this.t-1]^this.s&this.DM)},s.prototype.mod=function(t){var e=a();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(s.ZERO)>0&&t.subTo(e,e),e},s.prototype.modPowInt=function(t,e){var r;return r=t<256||e.isEven()?new g(e):new y(e),this.exp(t,r)},s.ZERO=p(0),s.ONE=p(1),A.prototype.convert=w,A.prototype.revert=w,A.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r)},A.prototype.sqrTo=function(t,e){t.squareTo(e)},x.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=a();return t.copyTo(e),this.reduce(e),e},x.prototype.revert=function(t){return t},x.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},x.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},x.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)};var B=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509],I=(1<<26)/B[B.length-1];s.prototype.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},s.prototype.toRadix=function(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var e=this.chunkSize(t),r=Math.pow(t,e),n=p(r),i=a(),s=a(),o="";for(this.divRemTo(n,i,s);i.signum()>0;)o=(r+s.intValue()).toString(t).substr(1)+o,i.divRemTo(n,i,s);return s.intValue().toString(t)+o},s.prototype.fromRadix=function(t,e){this.fromInt(0),null==e&&(e=10);for(var r=this.chunkSize(e),n=Math.pow(e,r),i=!1,a=0,o=0,u=0;u<t.length;++u){var c=f(t,u);c<0?"-"==t.charAt(u)&&0==this.signum()&&(i=!0):(o=e*o+c,++a>=r&&(this.dMultiply(n),this.dAddOffset(o,0),a=0,o=0))}a>0&&(this.dMultiply(Math.pow(e,a)),this.dAddOffset(o,0)),i&&s.ZERO.subTo(this,this)},s.prototype.fromNumber=function(t,e,r){if("number"==typeof e)if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(s.ONE.shiftLeft(t-1),m,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(s.ONE.shiftLeft(t-1),this);else{var n=new Array,i=7&t;n.length=1+(t>>3),e.nextBytes(n),i>0?n[0]&=(1<<i)-1:n[0]=0,this.fromString(n,256)}},s.prototype.bitwiseTo=function(t,e,r){var n,i,s=Math.min(t.t,this.t);for(n=0;n<s;++n)r.data[n]=e(this.data[n],t.data[n]);if(t.t<this.t){for(i=t.s&this.DM,n=s;n<this.t;++n)r.data[n]=e(this.data[n],i);r.t=this.t}else{for(i=this.s&this.DM,n=s;n<t.t;++n)r.data[n]=e(i,t.data[n]);r.t=t.t}r.s=e(this.s,t.s),r.clamp()},s.prototype.changeBit=function(t,e){var r=s.ONE.shiftLeft(t);return this.bitwiseTo(r,e,r),r},s.prototype.addTo=function(t,e){for(var r=0,n=0,i=Math.min(t.t,this.t);r<i;)n+=this.data[r]+t.data[r],e.data[r++]=n&this.DM,n>>=this.DB;if(t.t<this.t){for(n+=t.s;r<this.t;)n+=this.data[r],e.data[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<t.t;)n+=t.data[r],e.data[r++]=n&this.DM,n>>=this.DB;n+=t.s}e.s=n<0?-1:0,n>0?e.data[r++]=n:n<-1&&(e.data[r++]=this.DV+n),e.t=r,e.clamp()},s.prototype.dMultiply=function(t){this.data[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},s.prototype.dAddOffset=function(t,e){if(0!=t){for(;this.t<=e;)this.data[this.t++]=0;for(this.data[e]+=t;this.data[e]>=this.DV;)this.data[e]-=this.DV,++e>=this.t&&(this.data[this.t++]=0),++this.data[e]}},s.prototype.multiplyLowerTo=function(t,e,r){var n,i=Math.min(this.t+t.t,e);for(r.s=0,r.t=i;i>0;)r.data[--i]=0;for(n=r.t-this.t;i<n;++i)r.data[i+this.t]=this.am(0,t.data[i],r,i,0,this.t);for(n=Math.min(t.t,e);i<n;++i)this.am(0,t.data[i],r,i,0,e-i);r.clamp()},s.prototype.multiplyUpperTo=function(t,e,r){--e;var n=r.t=this.t+t.t-e;for(r.s=0;--n>=0;)r.data[n]=0;for(n=Math.max(e-this.t,0);n<t.t;++n)r.data[this.t+n-e]=this.am(e-n,t.data[n],r,0,0,this.t+n-e);r.clamp(),r.drShiftTo(1,r)},s.prototype.modInt=function(t){if(t<=0)return 0;var e=this.DV%t,r=this.s<0?t-1:0;if(this.t>0)if(0==e)r=this.data[0]%t;else for(var n=this.t-1;n>=0;--n)r=(e*r+this.data[n])%t;return r},s.prototype.millerRabin=function(t){var e=this.subtract(s.ONE),r=e.getLowestSetBit();if(r<=0)return!1;for(var n,i=e.shiftRight(r),a={nextBytes:function(t){for(var e=0;e<t.length;++e)t[e]=Math.floor(256*Math.random())}},o=0;o<t;++o){do{n=new s(this.bitLength(),a)}while(n.compareTo(s.ONE)<=0||n.compareTo(e)>=0);var u=n.modPow(i,this);if(0!=u.compareTo(s.ONE)&&0!=u.compareTo(e)){for(var c=1;c++<r&&0!=u.compareTo(e);)if(0==(u=u.modPowInt(2,this)).compareTo(s.ONE))return!1;if(0!=u.compareTo(e))return!1}}return!0},s.prototype.clone=function(){var t=a();return this.copyTo(t),t},s.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]},s.prototype.byteValue=function(){return 0==this.t?this.s:this.data[0]<<24>>24},s.prototype.shortValue=function(){return 0==this.t?this.s:this.data[0]<<16>>16},s.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this.data[0]<=0?0:1},s.prototype.toByteArray=function(){var t=this.t,e=new Array;e[0]=this.s;var r,n=this.DB-t*this.DB%8,i=0;if(t-- >0)for(n<this.DB&&(r=this.data[t]>>n)!=(this.s&this.DM)>>n&&(e[i++]=r|this.s<<this.DB-n);t>=0;)n<8?(r=(this.data[t]&(1<<n)-1)<<8-n,r|=this.data[--t]>>(n+=this.DB-8)):(r=this.data[t]>>(n-=8)&255,n<=0&&(n+=this.DB,--t)),0!=(128&r)&&(r|=-256),0==i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(e[i++]=r);return e},s.prototype.equals=function(t){return 0==this.compareTo(t)},s.prototype.min=function(t){return this.compareTo(t)<0?this:t},s.prototype.max=function(t){return this.compareTo(t)>0?this:t},s.prototype.and=function(t){var e=a();return this.bitwiseTo(t,v,e),e},s.prototype.or=function(t){var e=a();return this.bitwiseTo(t,m,e),e},s.prototype.xor=function(t){var e=a();return this.bitwiseTo(t,E,e),e},s.prototype.andNot=function(t){var e=a();return this.bitwiseTo(t,S,e),e},s.prototype.not=function(){for(var t=a(),e=0;e<this.t;++e)t.data[e]=this.DM&~this.data[e];return t.t=this.t,t.s=~this.s,t},s.prototype.shiftLeft=function(t){var e=a();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e},s.prototype.shiftRight=function(t){var e=a();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e},s.prototype.getLowestSetBit=function(){for(var t=0;t<this.t;++t)if(0!=this.data[t])return t*this.DB+b(this.data[t]);return this.s<0?this.t*this.DB:-1},s.prototype.bitCount=function(){for(var t=0,e=this.s&this.DM,r=0;r<this.t;++r)t+=C(this.data[r]^e);return t},s.prototype.testBit=function(t){var e=Math.floor(t/this.DB);return e>=this.t?0!=this.s:0!=(this.data[e]&1<<t%this.DB)},s.prototype.setBit=function(t){return this.changeBit(t,m)},s.prototype.clearBit=function(t){return this.changeBit(t,S)},s.prototype.flipBit=function(t){return this.changeBit(t,E)},s.prototype.add=function(t){var e=a();return this.addTo(t,e),e},s.prototype.subtract=function(t){var e=a();return this.subTo(t,e),e},s.prototype.multiply=function(t){var e=a();return this.multiplyTo(t,e),e},s.prototype.divide=function(t){var e=a();return this.divRemTo(t,e,null),e},s.prototype.remainder=function(t){var e=a();return this.divRemTo(t,null,e),e},s.prototype.divideAndRemainder=function(t){var e=a(),r=a();return this.divRemTo(t,e,r),new Array(e,r)},s.prototype.modPow=function(t,e){var r,n,i=t.bitLength(),s=p(1);if(i<=0)return s;r=i<18?1:i<48?3:i<144?4:i<768?5:6,n=i<8?new g(e):e.isEven()?new x(e):new y(e);var o=new Array,u=3,c=r-1,l=(1<<r)-1;if(o[1]=n.convert(this),r>1){var h=a();for(n.sqrTo(o[1],h);u<=l;)o[u]=a(),n.mulTo(h,o[u-2],o[u]),u+=2}var f,v,m=t.t-1,E=!0,S=a();for(i=d(t.data[m])-1;m>=0;){for(i>=c?f=t.data[m]>>i-c&l:(f=(t.data[m]&(1<<i+1)-1)<<c-i,m>0&&(f|=t.data[m-1]>>this.DB+i-c)),u=r;0==(1&f);)f>>=1,--u;if((i-=u)<0&&(i+=this.DB,--m),E)o[f].copyTo(s),E=!1;else{for(;u>1;)n.sqrTo(s,S),n.sqrTo(S,s),u-=2;u>0?n.sqrTo(s,S):(v=s,s=S,S=v),n.mulTo(S,o[f],s)}for(;m>=0&&0==(t.data[m]&1<<i);)n.sqrTo(s,S),v=s,s=S,S=v,--i<0&&(i=this.DB-1,--m)}return n.revert(s)},s.prototype.modInverse=function(t){var e=t.isEven();if(this.isEven()&&e||0==t.signum())return s.ZERO;for(var r=t.clone(),n=this.clone(),i=p(1),a=p(0),o=p(0),u=p(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),e?(i.isEven()&&a.isEven()||(i.addTo(this,i),a.subTo(t,a)),i.rShiftTo(1,i)):a.isEven()||a.subTo(t,a),a.rShiftTo(1,a);for(;n.isEven();)n.rShiftTo(1,n),e?(o.isEven()&&u.isEven()||(o.addTo(this,o),u.subTo(t,u)),o.rShiftTo(1,o)):u.isEven()||u.subTo(t,u),u.rShiftTo(1,u);r.compareTo(n)>=0?(r.subTo(n,r),e&&i.subTo(o,i),a.subTo(u,a)):(n.subTo(r,n),e&&o.subTo(i,o),u.subTo(a,u))}return 0!=n.compareTo(s.ONE)?s.ZERO:u.compareTo(t)>=0?u.subtract(t):u.signum()<0?(u.addTo(t,u),u.signum()<0?u.add(t):u):u},s.prototype.pow=function(t){return this.exp(t,new A)},s.prototype.gcd=function(t){var e=this.s<0?this.negate():this.clone(),r=t.s<0?t.negate():t.clone();if(e.compareTo(r)<0){var n=e;e=r,r=n}var i=e.getLowestSetBit(),s=r.getLowestSetBit();if(s<0)return e;for(i<s&&(s=i),s>0&&(e.rShiftTo(s,e),r.rShiftTo(s,r));e.signum()>0;)(i=e.getLowestSetBit())>0&&e.rShiftTo(i,e),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),e.compareTo(r)>=0?(e.subTo(r,e),e.rShiftTo(1,e)):(r.subTo(e,r),r.rShiftTo(1,r));return s>0&&r.lShiftTo(s,r),r},s.prototype.isProbablePrime=function(t){var e,r=this.abs();if(1==r.t&&r.data[0]<=B[B.length-1]){for(e=0;e<B.length;++e)if(r.data[0]==B[e])return!0;return!1}if(r.isEven())return!1;for(e=1;e<B.length;){for(var n=B[e],i=e+1;i<B.length&&n<I;)n*=B[i++];for(n=r.modInt(n);e<i;)if(n%B[e++]==0)return!1}return r.millerRabin(t)}},49348:(t,e,r)=>{var n=r(91080);r(18736),r(90400),r(26056),t.exports=n.kem=n.kem||{};var i=n.jsbn.BigInteger;function s(t,e,r,i){t.generate=function(t,s){for(var a=new n.util.ByteBuffer,o=Math.ceil(s/i)+r,u=new n.util.ByteBuffer,c=r;c<o;++c){u.putInt32(c),e.start(),e.update(t+u.getBytes());var l=e.digest();a.putBytes(l.getBytes(i))}return a.truncate(a.length()-s),a.getBytes()}}n.kem.rsa={},n.kem.rsa.create=function(t,e){var r=(e=e||{}).prng||n.random;return{encrypt:function(e,s){var a,o=Math.ceil(e.n.bitLength()/8);do{a=new i(n.util.bytesToHex(r.getBytesSync(o)),16).mod(e.n)}while(a.compareTo(i.ONE)<=0);var u=o-(a=n.util.hexToBytes(a.toString(16))).length;return u>0&&(a=n.util.fillString(String.fromCharCode(0),u)+a),{encapsulation:e.encrypt(a,"NONE"),key:t.generate(a,s)}},decrypt:function(e,r,n){var i=e.decrypt(r,"NONE");return t.generate(i,n)}}},n.kem.kdf1=function(t,e){s(this,t,0,e||t.digestLength)},n.kem.kdf2=function(t,e){s(this,t,1,e||t.digestLength)}},21200:(t,e,r)=>{var n=r(91080);r(18736),t.exports=n.log=n.log||{},n.log.levels=["none","error","warning","info","debug","verbose","max"];var i={},s=[],a=null;n.log.LEVEL_LOCKED=2,n.log.NO_LEVEL_CHECK=4,n.log.INTERPOLATE=8;for(var o=0;o<n.log.levels.length;++o){var u=n.log.levels[o];i[u]={index:o,name:u.toUpperCase()}}n.log.logMessage=function(t){for(var e=i[t.level].index,r=0;r<s.length;++r){var a=s[r];a.flags&n.log.NO_LEVEL_CHECK?a.f(t):e<=i[a.level].index&&a.f(a,t)}},n.log.prepareStandard=function(t){"standard"in t||(t.standard=i[t.level].name+" ["+t.category+"] "+t.message)},n.log.prepareFull=function(t){if(!("full"in t)){var e=[t.message];e=e.concat([]||0),t.full=n.util.format.apply(this,e)}},n.log.prepareStandardFull=function(t){"standardFull"in t||(n.log.prepareStandard(t),t.standardFull=t.standard)};var c=["error","warning","info","debug","verbose"];for(o=0;o<c.length;++o)!function(t){n.log[t]=function(e,r){var i=Array.prototype.slice.call(arguments).slice(2),s={timestamp:new Date,level:t,category:e,message:r,arguments:i};n.log.logMessage(s)}}(c[o]);if(n.log.makeLogger=function(t){var e={flags:0,f:t};return n.log.setLevel(e,"none"),e},n.log.setLevel=function(t,e){var r=!1;if(t&&!(t.flags&n.log.LEVEL_LOCKED))for(var i=0;i<n.log.levels.length;++i)if(e==n.log.levels[i]){t.level=e,r=!0;break}return r},n.log.lock=function(t,e){void 0===e||e?t.flags|=n.log.LEVEL_LOCKED:t.flags&=~n.log.LEVEL_LOCKED},n.log.addLogger=function(t){s.push(t)},"undefined"!=typeof console&&"log"in console){var l;if(console.error&&console.warn&&console.info&&console.debug){var h={error:console.error,warning:console.warn,info:console.info,debug:console.debug,verbose:console.debug},f=function(t,e){n.log.prepareStandard(e);var r=h[e.level],i=[e.standard];i=i.concat(e.arguments.slice()),r.apply(console,i)};l=n.log.makeLogger(f)}else f=function(t,e){n.log.prepareStandardFull(e),console.log(e.standardFull)},l=n.log.makeLogger(f);n.log.setLevel(l,"debug"),n.log.addLogger(l),a=l}else console={log:function(){}};if(null!==a&&"undefined"!=typeof window&&window.location){var p=new URL(window.location.href).searchParams;p.has("console.level")&&n.log.setLevel(a,p.get("console.level").slice(-1)[0]),p.has("console.lock")&&"true"==p.get("console.lock").slice(-1)[0]&&n.log.lock(a)}n.log.consoleLogger=a},15416:(t,e,r)=>{t.exports=r(48724),r(79576),r(95668),r(91716),r(74756)},48724:(t,e,r)=>{var n=r(91080);t.exports=n.md=n.md||{},n.md.algorithms=n.md.algorithms||{}},79576:(t,e,r)=>{var n=r(91080);r(48724),r(18736);var i=t.exports=n.md5=n.md5||{};n.md.md5=n.md.algorithms.md5=i,i.create=function(){c||function(){s=String.fromCharCode(128),s+=n.util.fillString(String.fromCharCode(0),64),a=[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],o=[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],u=new Array(64);for(var t=0;t<64;++t)u[t]=Math.floor(4294967296*Math.abs(Math.sin(t+1)));c=!0}();var t=null,e=n.util.createBuffer(),r=new Array(16),i={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){i.messageLength=0,i.fullMessageLength=i.messageLength64=[];for(var r=i.messageLengthSize/4,s=0;s<r;++s)i.fullMessageLength.push(0);return e=n.util.createBuffer(),t={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878},i}};return i.start(),i.update=function(s,a){"utf8"===a&&(s=n.util.encodeUtf8(s));var o=s.length;i.messageLength+=o,o=[o/4294967296>>>0,o>>>0];for(var u=i.fullMessageLength.length-1;u>=0;--u)i.fullMessageLength[u]+=o[1],o[1]=o[0]+(i.fullMessageLength[u]/4294967296>>>0),i.fullMessageLength[u]=i.fullMessageLength[u]>>>0,o[0]=o[1]/4294967296>>>0;return e.putBytes(s),l(t,r,e),(e.read>2048||0===e.length())&&e.compact(),i},i.digest=function(){var a=n.util.createBuffer();a.putBytes(e.bytes());var o=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize&i.blockLength-1;a.putBytes(s.substr(0,i.blockLength-o));for(var u,c=0,h=i.fullMessageLength.length-1;h>=0;--h)c=(u=8*i.fullMessageLength[h]+c)/4294967296>>>0,a.putInt32Le(u>>>0);var f={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3};l(f,r,a);var p=n.util.createBuffer();return p.putInt32Le(f.h0),p.putInt32Le(f.h1),p.putInt32Le(f.h2),p.putInt32Le(f.h3),p},i};var s=null,a=null,o=null,u=null,c=!1;function l(t,e,r){for(var n,i,s,c,l,h,f,p=r.length();p>=64;){for(i=t.h0,s=t.h1,c=t.h2,l=t.h3,f=0;f<16;++f)e[f]=r.getInt32Le(),n=i+(l^s&(c^l))+u[f]+e[f],i=l,l=c,c=s,s+=n<<(h=o[f])|n>>>32-h;for(;f<32;++f)n=i+(c^l&(s^c))+u[f]+e[a[f]],i=l,l=c,c=s,s+=n<<(h=o[f])|n>>>32-h;for(;f<48;++f)n=i+(s^c^l)+u[f]+e[a[f]],i=l,l=c,c=s,s+=n<<(h=o[f])|n>>>32-h;for(;f<64;++f)n=i+(c^(s|~l))+u[f]+e[a[f]],i=l,l=c,c=s,s+=n<<(h=o[f])|n>>>32-h;t.h0=t.h0+i|0,t.h1=t.h1+s|0,t.h2=t.h2+c|0,t.h3=t.h3+l|0,p-=64}}},54755:(t,e,r)=>{var n=r(91080);r(36620),t.exports=n.mgf=n.mgf||{},n.mgf.mgf1=n.mgf1},36620:(t,e,r)=>{var n=r(91080);r(18736),n.mgf=n.mgf||{},(t.exports=n.mgf.mgf1=n.mgf1=n.mgf1||{}).create=function(t){return{generate:function(e,r){for(var i=new n.util.ByteBuffer,s=Math.ceil(r/t.digestLength),a=0;a<s;a++){var o=new n.util.ByteBuffer;o.putInt32(a),t.start(),t.update(e+o.getBytes()),i.putBuffer(t.digest())}return i.truncate(i.length()-r),i.getBytes()}}}},91752:(t,e,r)=>{var n=r(91080);n.pki=n.pki||{};var i=t.exports=n.pki.oids=n.oids=n.oids||{};function s(t,e){i[t]=e,i[e]=t}function a(t,e){i[t]=e}s("1.2.840.113549.1.1.1","rsaEncryption"),s("1.2.840.113549.1.1.4","md5WithRSAEncryption"),s("1.2.840.113549.1.1.5","sha1WithRSAEncryption"),s("1.2.840.113549.1.1.7","RSAES-OAEP"),s("1.2.840.113549.1.1.8","mgf1"),s("1.2.840.113549.1.1.9","pSpecified"),s("1.2.840.113549.1.1.10","RSASSA-PSS"),s("1.2.840.113549.1.1.11","sha256WithRSAEncryption"),s("1.2.840.113549.1.1.12","sha384WithRSAEncryption"),s("1.2.840.113549.1.1.13","sha512WithRSAEncryption"),s("1.3.101.112","EdDSA25519"),s("1.2.840.10040.4.3","dsa-with-sha1"),s("1.3.14.3.2.7","desCBC"),s("1.3.14.3.2.26","sha1"),s("1.3.14.3.2.29","sha1WithRSASignature"),s("2.16.840.1.101.3.4.2.1","sha256"),s("2.16.840.1.101.3.4.2.2","sha384"),s("2.16.840.1.101.3.4.2.3","sha512"),s("2.16.840.1.101.3.4.2.4","sha224"),s("2.16.840.1.101.3.4.2.5","sha512-224"),s("2.16.840.1.101.3.4.2.6","sha512-256"),s("1.2.840.113549.2.2","md2"),s("1.2.840.113549.2.5","md5"),s("1.2.840.113549.1.7.1","data"),s("1.2.840.113549.1.7.2","signedData"),s("1.2.840.113549.1.7.3","envelopedData"),s("1.2.840.113549.1.7.4","signedAndEnvelopedData"),s("1.2.840.113549.1.7.5","digestedData"),s("1.2.840.113549.1.7.6","encryptedData"),s("1.2.840.113549.1.9.1","emailAddress"),s("1.2.840.113549.1.9.2","unstructuredName"),s("1.2.840.113549.1.9.3","contentType"),s("1.2.840.113549.1.9.4","messageDigest"),s("1.2.840.113549.1.9.5","signingTime"),s("1.2.840.113549.1.9.6","counterSignature"),s("1.2.840.113549.1.9.7","challengePassword"),s("1.2.840.113549.1.9.8","unstructuredAddress"),s("1.2.840.113549.1.9.14","extensionRequest"),s("1.2.840.113549.1.9.20","friendlyName"),s("1.2.840.113549.1.9.21","localKeyId"),s("1.2.840.113549.1.9.22.1","x509Certificate"),s("1.2.840.113549.1.12.10.1.1","keyBag"),s("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag"),s("1.2.840.113549.1.12.10.1.3","certBag"),s("1.2.840.113549.1.12.10.1.4","crlBag"),s("1.2.840.113549.1.12.10.1.5","secretBag"),s("1.2.840.113549.1.12.10.1.6","safeContentsBag"),s("1.2.840.113549.1.5.13","pkcs5PBES2"),s("1.2.840.113549.1.5.12","pkcs5PBKDF2"),s("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4"),s("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4"),s("1.2.840.113549.1.12.1.3","pbeWithSHAAnd3-KeyTripleDES-CBC"),s("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC"),s("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC"),s("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC"),s("1.2.840.113549.2.7","hmacWithSHA1"),s("1.2.840.113549.2.8","hmacWithSHA224"),s("1.2.840.113549.2.9","hmacWithSHA256"),s("1.2.840.113549.2.10","hmacWithSHA384"),s("1.2.840.113549.2.11","hmacWithSHA512"),s("1.2.840.113549.3.7","des-EDE3-CBC"),s("2.16.840.1.101.3.4.1.2","aes128-CBC"),s("2.16.840.1.101.3.4.1.22","aes192-CBC"),s("2.16.840.1.101.3.4.1.42","aes256-CBC"),s("2.5.4.3","commonName"),s("2.5.4.4","surname"),s("2.5.4.5","serialNumber"),s("2.5.4.6","countryName"),s("2.5.4.7","localityName"),s("2.5.4.8","stateOrProvinceName"),s("2.5.4.9","streetAddress"),s("2.5.4.10","organizationName"),s("2.5.4.11","organizationalUnitName"),s("2.5.4.12","title"),s("2.5.4.13","description"),s("2.5.4.15","businessCategory"),s("2.5.4.17","postalCode"),s("2.5.4.42","givenName"),s("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName"),s("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName"),s("2.16.840.1.113730.1.1","nsCertType"),s("2.16.840.1.113730.1.13","nsComment"),a("2.5.29.1","authorityKeyIdentifier"),a("2.5.29.2","keyAttributes"),a("2.5.29.3","certificatePolicies"),a("2.5.29.4","keyUsageRestriction"),a("2.5.29.5","policyMapping"),a("2.5.29.6","subtreesConstraint"),a("2.5.29.7","subjectAltName"),a("2.5.29.8","issuerAltName"),a("2.5.29.9","subjectDirectoryAttributes"),a("2.5.29.10","basicConstraints"),a("2.5.29.11","nameConstraints"),a("2.5.29.12","policyConstraints"),a("2.5.29.13","basicConstraints"),s("2.5.29.14","subjectKeyIdentifier"),s("2.5.29.15","keyUsage"),a("2.5.29.16","privateKeyUsagePeriod"),s("2.5.29.17","subjectAltName"),s("2.5.29.18","issuerAltName"),s("2.5.29.19","basicConstraints"),a("2.5.29.20","cRLNumber"),a("2.5.29.21","cRLReason"),a("2.5.29.22","expirationDate"),a("2.5.29.23","instructionCode"),a("2.5.29.24","invalidityDate"),a("2.5.29.25","cRLDistributionPoints"),a("2.5.29.26","issuingDistributionPoint"),a("2.5.29.27","deltaCRLIndicator"),a("2.5.29.28","issuingDistributionPoint"),a("2.5.29.29","certificateIssuer"),a("2.5.29.30","nameConstraints"),s("2.5.29.31","cRLDistributionPoints"),s("2.5.29.32","certificatePolicies"),a("2.5.29.33","policyMappings"),a("2.5.29.34","policyConstraints"),s("2.5.29.35","authorityKeyIdentifier"),a("2.5.29.36","policyConstraints"),s("2.5.29.37","extKeyUsage"),a("2.5.29.46","freshestCRL"),a("2.5.29.54","inhibitAnyPolicy"),s("1.3.6.1.4.1.11129.2.4.2","timestampList"),s("1.3.6.1.5.5.7.1.1","authorityInfoAccess"),s("1.3.6.1.5.5.7.3.1","serverAuth"),s("1.3.6.1.5.5.7.3.2","clientAuth"),s("1.3.6.1.5.5.7.3.3","codeSigning"),s("1.3.6.1.5.5.7.3.4","emailProtection"),s("1.3.6.1.5.5.7.3.8","timeStamping")},62467:(t,e,r)=>{var n=r(91080);if(r(6180),r(4e4),r(3044),r(48724),r(91752),r(71256),r(96964),r(90400),r(42196),r(71532),r(18736),void 0===i)var i=n.jsbn.BigInteger;var s=n.asn1,a=n.pki=n.pki||{};t.exports=a.pbe=n.pbe=n.pbe||{};var o=a.oids,u={name:"EncryptedPrivateKeyInfo",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},c={name:"PBES2Algorithms",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:s.Class.UNIVERSAL,type:s.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},l={name:"pkcs-12PbeParams",tagClass:s.Class.UNIVERSAL,type:s.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:s.Class.UNIVERSAL,type:s.Type.OCTETSTRING,constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:s.Class.UNIVERSAL,type:s.Type.INTEGER,constructed:!1,capture:"iterations"}]};function h(t,e){return t.start().update(e).digest().getBytes()}function f(t){var e;if(t){if(!(e=a.oids[s.derToOid(t)])){var r=new Error("Unsupported PRF OID.");throw r.oid=t,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}}else e="hmacWithSHA1";return p(e)}function p(t){var e=n.md;switch(t){case"hmacWithSHA224":e=n.md.sha512;case"hmacWithSHA1":case"hmacWithSHA256":case"hmacWithSHA384":case"hmacWithSHA512":t=t.substr(8).toLowerCase();break;default:var r=new Error("Unsupported PRF algorithm.");throw r.algorithm=t,r.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],r}if(!e||!(t in e))throw new Error("Unknown hash algorithm: "+t);return e[t].create()}a.encryptPrivateKeyInfo=function(t,e,r){(r=r||{}).saltSize=r.saltSize||8,r.count=r.count||2048,r.algorithm=r.algorithm||"aes128",r.prfAlgorithm=r.prfAlgorithm||"sha1";var i,u,c,l=n.random.getBytesSync(r.saltSize),h=r.count,f=s.integerToDer(h);if(0===r.algorithm.indexOf("aes")||"des"===r.algorithm){var d,g,y;switch(r.algorithm){case"aes128":i=16,d=16,g=o["aes128-CBC"],y=n.aes.createEncryptionCipher;break;case"aes192":i=24,d=16,g=o["aes192-CBC"],y=n.aes.createEncryptionCipher;break;case"aes256":i=32,d=16,g=o["aes256-CBC"],y=n.aes.createEncryptionCipher;break;case"des":i=8,d=8,g=o.desCBC,y=n.des.createEncryptionCipher;break;default:throw(C=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=r.algorithm,C}var v="hmacWith"+r.prfAlgorithm.toUpperCase(),m=p(v),E=n.pkcs5.pbkdf2(e,l,h,i,m),S=n.random.getBytesSync(d);(A=y(E)).start(S),A.update(s.toDer(t)),A.finish(),c=A.output.getBytes();var b=function(t,e,r,i){var o=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,t),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,e.getBytes())]);return"hmacWithSHA1"!==i&&o.value.push(s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,n.util.hexToBytes(r.toString(16))),s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(a.oids[i]).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.NULL,!1,"")])),o}(l,f,i,v);u=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(o.pkcs5PBES2).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(o.pkcs5PBKDF2).getBytes()),b]),s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(g).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,S)])])])}else{var C;if("3des"!==r.algorithm)throw(C=new Error("Cannot encrypt private key. Unknown encryption algorithm.")).algorithm=r.algorithm,C;i=24;var A,w=new n.util.ByteBuffer(l);E=a.pbe.generatePkcs12Key(e,w,1,h,i),S=a.pbe.generatePkcs12Key(e,w,2,h,i),(A=n.des.createEncryptionCipher(E)).start(S),A.update(s.toDer(t)),A.finish(),c=A.output.getBytes(),u=s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OID,!1,s.oidToDer(o["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,l),s.create(s.Class.UNIVERSAL,s.Type.INTEGER,!1,f.getBytes())])])}return s.create(s.Class.UNIVERSAL,s.Type.SEQUENCE,!0,[u,s.create(s.Class.UNIVERSAL,s.Type.OCTETSTRING,!1,c)])},a.decryptPrivateKeyInfo=function(t,e){var r=null,i={},o=[];if(!s.validate(t,u,i,o)){var c=new Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");throw c.errors=o,c}var l=s.derToOid(i.encryptionOid),h=a.pbe.getCipher(l,i.encryptionParams,e),f=n.util.createBuffer(i.encryptedData);return h.update(f),h.finish()&&(r=s.fromDer(h.output)),r},a.encryptedPrivateKeyToPem=function(t,e){var r={type:"ENCRYPTED PRIVATE KEY",body:s.toDer(t).getBytes()};return n.pem.encode(r,{maxline:e})},a.encryptedPrivateKeyFromPem=function(t){var e=n.pem.decode(t)[0];if("ENCRYPTED PRIVATE KEY"!==e.type){var r=new Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');throw r.headerType=e.type,r}if(e.procType&&"ENCRYPTED"===e.procType.type)throw new Error("Could not convert encrypted private key from PEM; PEM is encrypted.");return s.fromDer(e.body)},a.encryptRsaPrivateKey=function(t,e,r){if(!(r=r||{}).legacy){var i=a.wrapRsaPrivateKey(a.privateKeyToAsn1(t));return i=a.encryptPrivateKeyInfo(i,e,r),a.encryptedPrivateKeyToPem(i)}var o,u,c,l;switch(r.algorithm){case"aes128":o="AES-128-CBC",c=16,u=n.random.getBytesSync(16),l=n.aes.createEncryptionCipher;break;case"aes192":o="AES-192-CBC",c=24,u=n.random.getBytesSync(16),l=n.aes.createEncryptionCipher;break;case"aes256":o="AES-256-CBC",c=32,u=n.random.getBytesSync(16),l=n.aes.createEncryptionCipher;break;case"3des":o="DES-EDE3-CBC",c=24,u=n.random.getBytesSync(8),l=n.des.createEncryptionCipher;break;case"des":o="DES-CBC",c=8,u=n.random.getBytesSync(8),l=n.des.createEncryptionCipher;break;default:var h=new Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+r.algorithm+'".');throw h.algorithm=r.algorithm,h}var f=l(n.pbe.opensslDeriveBytes(e,u.substr(0,8),c));f.start(u),f.update(s.toDer(a.privateKeyToAsn1(t))),f.finish();var p={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},dekInfo:{algorithm:o,parameters:n.util.bytesToHex(u).toUpperCase()},body:f.output.getBytes()};return n.pem.encode(p)},a.decryptRsaPrivateKey=function(t,e){var r=null,i=n.pem.decode(t)[0];if("ENCRYPTED PRIVATE KEY"!==i.type&&"PRIVATE KEY"!==i.type&&"RSA PRIVATE KEY"!==i.type)throw(c=new Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".')).headerType=c,c;if(i.procType&&"ENCRYPTED"===i.procType.type){var o,u;switch(i.dekInfo.algorithm){case"DES-CBC":o=8,u=n.des.createDecryptionCipher;break;case"DES-EDE3-CBC":o=24,u=n.des.createDecryptionCipher;break;case"AES-128-CBC":o=16,u=n.aes.createDecryptionCipher;break;case"AES-192-CBC":o=24,u=n.aes.createDecryptionCipher;break;case"AES-256-CBC":o=32,u=n.aes.createDecryptionCipher;break;case"RC2-40-CBC":o=5,u=function(t){return n.rc2.createDecryptionCipher(t,40)};break;case"RC2-64-CBC":o=8,u=function(t){return n.rc2.createDecryptionCipher(t,64)};break;case"RC2-128-CBC":o=16,u=function(t){return n.rc2.createDecryptionCipher(t,128)};break;default:var c;throw(c=new Error('Could not decrypt private key; unsupported encryption algorithm "'+i.dekInfo.algorithm+'".')).algorithm=i.dekInfo.algorithm,c}var l=n.util.hexToBytes(i.dekInfo.parameters),h=u(n.pbe.opensslDeriveBytes(e,l.substr(0,8),o));if(h.start(l),h.update(n.util.createBuffer(i.body)),!h.finish())return r;r=h.output.getBytes()}else r=i.body;return null!==(r="ENCRYPTED PRIVATE KEY"===i.type?a.decryptPrivateKeyInfo(s.fromDer(r),e):s.fromDer(r))&&(r=a.privateKeyFromAsn1(r)),r},a.pbe.generatePkcs12Key=function(t,e,r,i,s,a){var o,u;if(null==a){if(!("sha1"in n.md))throw new Error('"sha1" hash algorithm unavailable.');a=n.md.sha1.create()}var c=a.digestLength,l=a.blockLength,h=new n.util.ByteBuffer,f=new n.util.ByteBuffer;if(null!=t){for(u=0;u<t.length;u++)f.putInt16(t.charCodeAt(u));f.putInt16(0)}var p=f.length(),d=e.length(),g=new n.util.ByteBuffer;g.fillWithByte(r,l);var y=l*Math.ceil(d/l),v=new n.util.ByteBuffer;for(u=0;u<y;u++)v.putByte(e.at(u%d));var m=l*Math.ceil(p/l),E=new n.util.ByteBuffer;for(u=0;u<m;u++)E.putByte(f.at(u%p));var S=v;S.putBuffer(E);for(var b=Math.ceil(s/c),C=1;C<=b;C++){var A=new n.util.ByteBuffer;A.putBytes(g.bytes()),A.putBytes(S.bytes());for(var w=0;w<i;w++)a.start(),a.update(A.getBytes()),A=a.digest();var x=new n.util.ByteBuffer;for(u=0;u<l;u++)x.putByte(A.at(u%c));var B=Math.ceil(d/l)+Math.ceil(p/l),I=new n.util.ByteBuffer;for(o=0;o<B;o++){var T=new n.util.ByteBuffer(S.getBytes(l)),F=511;for(u=x.length()-1;u>=0;u--)F>>=8,F+=x.at(u)+T.at(u),T.setAt(u,255&F);I.putBuffer(T)}S=I,h.putBuffer(A)}return h.truncate(h.length()-s),h},a.pbe.getCipher=function(t,e,r){switch(t){case a.oids.pkcs5PBES2:return a.pbe.getCipherForPBES2(t,e,r);case a.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case a.oids["pbewithSHAAnd40BitRC2-CBC"]:return a.pbe.getCipherForPKCS12PBE(t,e,r);default:var n=new Error("Cannot read encrypted PBE data block. Unsupported OID.");throw n.oid=t,n.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],n}},a.pbe.getCipherForPBES2=function(t,e,r){var i,o={},u=[];if(!s.validate(e,c,o,u))throw(i=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=u,i;if((t=s.derToOid(o.kdfOid))!==a.oids.pkcs5PBKDF2)throw(i=new Error("Cannot read encrypted private key. Unsupported key derivation function OID.")).oid=t,i.supportedOids=["pkcs5PBKDF2"],i;if((t=s.derToOid(o.encOid))!==a.oids["aes128-CBC"]&&t!==a.oids["aes192-CBC"]&&t!==a.oids["aes256-CBC"]&&t!==a.oids["des-EDE3-CBC"]&&t!==a.oids.desCBC)throw(i=new Error("Cannot read encrypted private key. Unsupported encryption scheme OID.")).oid=t,i.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],i;var l,h,p=o.kdfSalt,d=n.util.createBuffer(o.kdfIterationCount);switch(d=d.getInt(d.length()<<3),a.oids[t]){case"aes128-CBC":l=16,h=n.aes.createDecryptionCipher;break;case"aes192-CBC":l=24,h=n.aes.createDecryptionCipher;break;case"aes256-CBC":l=32,h=n.aes.createDecryptionCipher;break;case"des-EDE3-CBC":l=24,h=n.des.createDecryptionCipher;break;case"desCBC":l=8,h=n.des.createDecryptionCipher}var g=f(o.prfOid),y=n.pkcs5.pbkdf2(r,p,d,l,g),v=o.encIv,m=h(y);return m.start(v),m},a.pbe.getCipherForPKCS12PBE=function(t,e,r){var i={},o=[];if(!s.validate(e,l,i,o))throw(g=new Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.")).errors=o,g;var u,c,h,p=n.util.createBuffer(i.salt),d=n.util.createBuffer(i.iterations);switch(d=d.getInt(d.length()<<3),t){case a.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:u=24,c=8,h=n.des.startDecrypting;break;case a.oids["pbewithSHAAnd40BitRC2-CBC"]:u=5,c=8,h=function(t,e){var r=n.rc2.createDecryptionCipher(t,40);return r.start(e,null),r};break;default:var g;throw(g=new Error("Cannot read PKCS #12 PBE data block. Unsupported OID.")).oid=t,g}var y=f(i.prfOid),v=a.pbe.generatePkcs12Key(r,p,1,d,u,y);return y.start(),h(v,a.pbe.generatePkcs12Key(r,p,2,d,c,y))},a.pbe.opensslDeriveBytes=function(t,e,r,i){if(null==i){if(!("md5"in n.md))throw new Error('"md5" hash algorithm unavailable.');i=n.md.md5.create()}null===e&&(e="");for(var s=[h(i,t+e)],a=16,o=1;a<r;++o,a+=16)s.push(h(i,s[o-1]+t+e));return s.join("").substr(0,r)}},71256:(t,e,r)=>{var n=r(19024).Buffer,i=r(91080);r(43472),r(48724),r(18736);var s,a=i.pkcs5=i.pkcs5||{};i.util.isNodejs&&!i.options.usePureJavaScript&&(s=r(39116)),t.exports=i.pbkdf2=a.pbkdf2=function(t,e,r,a,o,u){if("function"==typeof o&&(u=o,o=null),i.util.isNodejs&&!i.options.usePureJavaScript&&s.pbkdf2&&(null===o||"object"!=typeof o)&&(s.pbkdf2Sync.length>4||!o||"sha1"===o))return"string"!=typeof o&&(o="sha1"),t=n.from(t,"binary"),e=n.from(e,"binary"),u?4===s.pbkdf2Sync.length?s.pbkdf2(t,e,r,a,(function(t,e){if(t)return u(t);u(null,e.toString("binary"))})):s.pbkdf2(t,e,r,a,o,(function(t,e){if(t)return u(t);u(null,e.toString("binary"))})):4===s.pbkdf2Sync.length?s.pbkdf2Sync(t,e,r,a).toString("binary"):s.pbkdf2Sync(t,e,r,a,o).toString("binary");if(null==o&&(o="sha1"),"string"==typeof o){if(!(o in i.md.algorithms))throw new Error("Unknown hash algorithm: "+o);o=i.md[o].create()}var c=o.digestLength;if(a>4294967295*c){var l=new Error("Derived key is too long.");if(u)return u(l);throw l}var h=Math.ceil(a/c),f=a-(h-1)*c,p=i.hmac.create();p.start(o,t);var d,g,y,v="";if(!u){for(var m=1;m<=h;++m){p.start(null,null),p.update(e),p.update(i.util.int32ToBytes(m)),d=y=p.digest().getBytes();for(var E=2;E<=r;++E)p.start(null,null),p.update(y),g=p.digest().getBytes(),d=i.util.xorBytes(d,g,c),y=g;v+=m<h?d:d.substr(0,f)}return v}function S(){if(m>h)return u(null,v);p.start(null,null),p.update(e),p.update(i.util.int32ToBytes(m)),d=y=p.digest().getBytes(),E=2,b()}function b(){if(E<=r)return p.start(null,null),p.update(y),g=p.digest().getBytes(),d=i.util.xorBytes(d,g,c),y=g,++E,i.util.setImmediate(b);v+=m<h?d:d.substr(0,f),++m,S()}m=1,S()}},96964:(t,e,r)=>{var n=r(91080);r(18736);var i=t.exports=n.pem=n.pem||{};function s(t){for(var e=t.name+": ",r=[],n=function(t,e){return" "+e},i=0;i<t.values.length;++i)r.push(t.values[i].replace(/^(\S+\r\n)/,n));e+=r.join(",")+"\r\n";var s=0,a=-1;for(i=0;i<e.length;++i,++s)if(s>65&&-1!==a){var o=e[a];","===o?(++a,e=e.substr(0,a)+"\r\n "+e.substr(a)):e=e.substr(0,a)+"\r\n"+o+e.substr(a+1),s=i-a-1,a=-1,++i}else" "!==e[i]&&"\t"!==e[i]&&","!==e[i]||(a=i);return e}function a(t){return t.replace(/^\s+/,"")}i.encode=function(t,e){e=e||{};var r,i="-----BEGIN "+t.type+"-----\r\n";if(t.procType&&(i+=s(r={name:"Proc-Type",values:[String(t.procType.version),t.procType.type]})),t.contentDomain&&(i+=s(r={name:"Content-Domain",values:[t.contentDomain]})),t.dekInfo&&(r={name:"DEK-Info",values:[t.dekInfo.algorithm]},t.dekInfo.parameters&&r.values.push(t.dekInfo.parameters),i+=s(r)),t.headers)for(var a=0;a<t.headers.length;++a)i+=s(t.headers[a]);return t.procType&&(i+="\r\n"),(i+=n.util.encode64(t.body,e.maxline||64)+"\r\n")+"-----END "+t.type+"-----\r\n"},i.decode=function(t){for(var e,r=[],i=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,s=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,o=/\r?\n/;e=i.exec(t);){var u=e[1];"NEW CERTIFICATE REQUEST"===u&&(u="CERTIFICATE REQUEST");var c={type:u,procType:null,contentDomain:null,dekInfo:null,headers:[],body:n.util.decode64(e[3])};if(r.push(c),e[2]){for(var l=e[2].split(o),h=0;e&&h<l.length;){for(var f=l[h].replace(/\s+$/,""),p=h+1;p<l.length;++p){var d=l[p];if(!/\s/.test(d[0]))break;f+=d,h=p}if(e=f.match(s)){for(var g={name:e[1],values:[]},y=e[2].split(","),v=0;v<y.length;++v)g.values.push(a(y[v]));if(c.procType)if(c.contentDomain||"Content-Domain"!==g.name)if(c.dekInfo||"DEK-Info"!==g.name)c.headers.push(g);else{if(0===g.values.length)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');c.dekInfo={algorithm:y[0],parameters:y[1]||null}}else c.contentDomain=y[0]||"";else{if("Proc-Type"!==g.name)throw new Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(2!==g.values.length)throw new Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');c.procType={version:y[0],type:y[1]}}}++h}if("ENCRYPTED"===c.procType&&!c.dekInfo)throw new Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".')}}if(0===r.length)throw new Error("Invalid PEM formatted message.");return r}},29948:(t,e,r)=>{var n=r(91080);r(18736),r(90400),r(95668);var i=t.exports=n.pkcs1=n.pkcs1||{};function s(t,e,r){r||(r=n.md.sha1.create());for(var i="",s=Math.ceil(e/r.digestLength),a=0;a<s;++a){var o=String.fromCharCode(a>>24&255,a>>16&255,a>>8&255,255&a);r.start(),r.update(t+o),i+=r.digest().getBytes()}return i.substring(0,e)}i.encode_rsa_oaep=function(t,e,r){var i,a,o,u;"string"==typeof r?(i=r,a=arguments[3]||void 0,o=arguments[4]||void 0):r&&(i=r.label||void 0,a=r.seed||void 0,o=r.md||void 0,r.mgf1&&r.mgf1.md&&(u=r.mgf1.md)),o?o.start():o=n.md.sha1.create(),u||(u=o);var c=Math.ceil(t.n.bitLength()/8),l=c-2*o.digestLength-2;if(e.length>l)throw(y=new Error("RSAES-OAEP input message length is too long.")).length=e.length,y.maxLength=l,y;i||(i=""),o.update(i,"raw");for(var h=o.digest(),f="",p=l-e.length,d=0;d<p;d++)f+="\0";var g=h.getBytes()+f+""+e;if(a){if(a.length!==o.digestLength){var y;throw(y=new Error("Invalid RSAES-OAEP seed. The seed length must match the digest length.")).seedLength=a.length,y.digestLength=o.digestLength,y}}else a=n.random.getBytes(o.digestLength);var v=s(a,c-o.digestLength-1,u),m=n.util.xorBytes(g,v,g.length),E=s(m,o.digestLength,u);return"\0"+n.util.xorBytes(a,E,a.length)+m},i.decode_rsa_oaep=function(t,e,r){var i,a,o;"string"==typeof r?(i=r,a=arguments[3]||void 0):r&&(i=r.label||void 0,a=r.md||void 0,r.mgf1&&r.mgf1.md&&(o=r.mgf1.md));var u=Math.ceil(t.n.bitLength()/8);if(e.length!==u)throw(v=new Error("RSAES-OAEP encoded message length is invalid.")).length=e.length,v.expectedLength=u,v;if(void 0===a?a=n.md.sha1.create():a.start(),o||(o=a),u<2*a.digestLength+2)throw new Error("RSAES-OAEP key is too short for the hash function.");i||(i=""),a.update(i,"raw");for(var c=a.digest().getBytes(),l=e.charAt(0),h=e.substring(1,a.digestLength+1),f=e.substring(1+a.digestLength),p=s(f,a.digestLength,o),d=s(n.util.xorBytes(h,p,h.length),u-a.digestLength-1,o),g=n.util.xorBytes(f,d,f.length),y=g.substring(0,a.digestLength),v="\0"!==l,m=0;m<a.digestLength;++m)v|=c.charAt(m)!==y.charAt(m);for(var E=1,S=a.digestLength,b=a.digestLength;b<g.length;b++){var C=g.charCodeAt(b);v|=C&(E?65534:0),S+=E&=1&C^1}if(v||1!==g.charCodeAt(S))throw new Error("Invalid RSAES-OAEP padding.");return g.substring(S+1)}},45644:(t,e,r)=>{var n=r(91080);r(4e4),r(43472),r(91752),r(56920),r(62467),r(90400),r(71532),r(95668),r(18736),r(92556);var i=n.asn1,s=n.pki,a=t.exports=n.pkcs12=n.pkcs12||{},o={name:"ContentInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:i.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},u={name:"PFX",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},o,{name:"PFX.macData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",tagClass:i.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},c={name:"SafeBag",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SafeBag.bagId",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:i.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},l={name:"Attribute",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"oid"},{name:"Attribute.attrValues",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0,capture:"values"}]},h={name:"CertBag",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:i.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:i.Class.UNIVERSAL,type:i.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};function f(t,e,r,n){for(var i=[],s=0;s<t.length;s++)for(var a=0;a<t[s].safeBags.length;a++){var o=t[s].safeBags[a];void 0!==n&&o.type!==n||(null!==e?void 0!==o.attributes[e]&&o.attributes[e].indexOf(r)>=0&&i.push(o):i.push(o))}return i}function p(t){if(t.composed||t.constructed){for(var e=n.util.createBuffer(),r=0;r<t.value.length;++r)e.putBytes(t.value[r].value);t.composed=t.constructed=!1,t.value=e.getBytes()}return t}function d(t,e){var r={},a=[];if(!i.validate(t,n.pkcs7.asn1.encryptedDataValidator,r,a))throw(o=new Error("Cannot read EncryptedContentInfo.")).errors=a,o;var o,u=i.derToOid(r.contentType);if(u!==s.oids.data)throw(o=new Error("PKCS#12 EncryptedContentInfo ContentType is not Data.")).oid=u,o;u=i.derToOid(r.encAlgorithm);var c=s.pbe.getCipher(u,r.encParameter,e),l=p(r.encryptedContentAsn1),h=n.util.createBuffer(l.value);if(c.update(h),!c.finish())throw new Error("Failed to decrypt PKCS#12 SafeContents.");return c.output.getBytes()}function g(t,e,r){if(!e&&0===t.length)return[];if((t=i.fromDer(t,e)).tagClass!==i.Class.UNIVERSAL||t.type!==i.Type.SEQUENCE||!0!==t.constructed)throw new Error("PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.");for(var n=[],a=0;a<t.value.length;a++){var o=t.value[a],u={},l=[];if(!i.validate(o,c,u,l))throw(v=new Error("Cannot read SafeBag.")).errors=l,v;var f,p,d={type:i.derToOid(u.bagId),attributes:y(u.bagAttributes)};n.push(d);var g=u.bagValue.value[0];switch(d.type){case s.oids.pkcs8ShroudedKeyBag:if(null===(g=s.decryptPrivateKeyInfo(g,r)))throw new Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case s.oids.keyBag:try{d.key=s.privateKeyFromAsn1(g)}catch(t){d.key=null,d.asn1=g}continue;case s.oids.certBag:f=h,p=function(){if(i.derToOid(u.certId)!==s.oids.x509Certificate){var t=new Error("Unsupported certificate type, only X.509 supported.");throw t.oid=i.derToOid(u.certId),t}var r=i.fromDer(u.cert,e);try{d.cert=s.certificateFromAsn1(r,!0)}catch(t){d.cert=null,d.asn1=r}};break;default:var v;throw(v=new Error("Unsupported PKCS#12 SafeBag type.")).oid=d.type,v}if(void 0!==f&&!i.validate(g,f,u,l))throw(v=new Error("Cannot read PKCS#12 "+f.name)).errors=l,v;p()}return n}function y(t){var e={};if(void 0!==t)for(var r=0;r<t.length;++r){var n={},a=[];if(!i.validate(t[r],l,n,a)){var o=new Error("Cannot read PKCS#12 BagAttribute.");throw o.errors=a,o}var u=i.derToOid(n.oid);if(void 0!==s.oids[u]){e[s.oids[u]]=[];for(var c=0;c<n.values.length;++c)e[s.oids[u]].push(n.values[c].value)}}return e}a.pkcs12FromAsn1=function(t,e,r){"string"==typeof e?(r=e,e=!0):void 0===e&&(e=!0);var c={};if(!i.validate(t,u,c,[]))throw(l=new Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX.")).errors=l,l;var l,h={version:c.version.charCodeAt(0),safeContents:[],getBags:function(t){var e,r={};return"localKeyId"in t?e=t.localKeyId:"localKeyIdHex"in t&&(e=n.util.hexToBytes(t.localKeyIdHex)),void 0===e&&!("friendlyName"in t)&&"bagType"in t&&(r[t.bagType]=f(h.safeContents,null,null,t.bagType)),void 0!==e&&(r.localKeyId=f(h.safeContents,"localKeyId",e,t.bagType)),"friendlyName"in t&&(r.friendlyName=f(h.safeContents,"friendlyName",t.friendlyName,t.bagType)),r},getBagsByFriendlyName:function(t,e){return f(h.safeContents,"friendlyName",t,e)},getBagsByLocalKeyId:function(t,e){return f(h.safeContents,"localKeyId",t,e)}};if(3!==c.version.charCodeAt(0))throw(l=new Error("PKCS#12 PFX of version other than 3 not supported.")).version=c.version.charCodeAt(0),l;if(i.derToOid(c.contentType)!==s.oids.data)throw(l=new Error("Only PKCS#12 PFX in password integrity mode supported.")).oid=i.derToOid(c.contentType),l;var y=c.content.value[0];if(y.tagClass!==i.Class.UNIVERSAL||y.type!==i.Type.OCTETSTRING)throw new Error("PKCS#12 authSafe content data is not an OCTET STRING.");if(y=p(y),c.mac){var v=null,m=0,E=i.derToOid(c.macAlgorithm);switch(E){case s.oids.sha1:v=n.md.sha1.create(),m=20;break;case s.oids.sha256:v=n.md.sha256.create(),m=32;break;case s.oids.sha384:v=n.md.sha384.create(),m=48;break;case s.oids.sha512:v=n.md.sha512.create(),m=64;break;case s.oids.md5:v=n.md.md5.create(),m=16}if(null===v)throw new Error("PKCS#12 uses unsupported MAC algorithm: "+E);var S=new n.util.ByteBuffer(c.macSalt),b="macIterations"in c?parseInt(n.util.bytesToHex(c.macIterations),16):1,C=a.generateKey(r,S,3,b,m,v),A=n.hmac.create();if(A.start(v,C),A.update(y.value),A.getMac().getBytes()!==c.macDigest)throw new Error("PKCS#12 MAC could not be verified. Invalid password?")}return function(t,e,r,n){if((e=i.fromDer(e,r)).tagClass!==i.Class.UNIVERSAL||e.type!==i.Type.SEQUENCE||!0!==e.constructed)throw new Error("PKCS#12 AuthenticatedSafe expected to be a SEQUENCE OF ContentInfo");for(var a=0;a<e.value.length;a++){var u=e.value[a],c={},l=[];if(!i.validate(u,o,c,l))throw(v=new Error("Cannot read ContentInfo.")).errors=l,v;var h={encrypted:!1},f=null,y=c.content.value[0];switch(i.derToOid(c.contentType)){case s.oids.data:if(y.tagClass!==i.Class.UNIVERSAL||y.type!==i.Type.OCTETSTRING)throw new Error("PKCS#12 SafeContents Data is not an OCTET STRING.");f=p(y).value;break;case s.oids.encryptedData:f=d(y,n),h.encrypted=!0;break;default:var v;throw(v=new Error("Unsupported PKCS#12 contentType.")).contentType=i.derToOid(c.contentType),v}h.safeBags=g(f,r,n),t.safeContents.push(h)}}(h,y.value,e,r),h},a.toPkcs12Asn1=function(t,e,r,o){(o=o||{}).saltSize=o.saltSize||8,o.count=o.count||2048,o.algorithm=o.algorithm||o.encAlgorithm||"aes128","useMac"in o||(o.useMac=!0),"localKeyId"in o||(o.localKeyId=null),"generateLocalKeyId"in o||(o.generateLocalKeyId=!0);var u,c=o.localKeyId;if(null!==c)c=n.util.hexToBytes(c);else if(o.generateLocalKeyId)if(e){var l=n.util.isArray(e)?e[0]:e;"string"==typeof l&&(l=s.certificateFromPem(l)),(I=n.md.sha1.create()).update(i.toDer(s.certificateToAsn1(l)).getBytes()),c=I.digest().getBytes()}else c=n.random.getBytes(20);var h=[];null!==c&&h.push(i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(s.oids.localKeyId).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SET,!0,[i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,c)])])),"friendlyName"in o&&h.push(i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(s.oids.friendlyName).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SET,!0,[i.create(i.Class.UNIVERSAL,i.Type.BMPSTRING,!1,o.friendlyName)])])),h.length>0&&(u=i.create(i.Class.UNIVERSAL,i.Type.SET,!0,h));var f=[],p=[];null!==e&&(p=n.util.isArray(e)?e:[e]);for(var d=[],g=0;g<p.length;++g){"string"==typeof(e=p[g])&&(e=s.certificateFromPem(e));var y=0===g?u:void 0,v=s.certificateToAsn1(e),m=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(s.oids.certBag).getBytes()),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(s.oids.x509Certificate).getBytes()),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,i.toDer(v).getBytes())])])]),y]);d.push(m)}if(d.length>0){var E=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,d),S=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(s.oids.data).getBytes()),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,i.toDer(E).getBytes())])]);f.push(S)}var b=null;if(null!==t){var C=s.wrapRsaPrivateKey(s.privateKeyToAsn1(t));b=null===r?i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(s.oids.keyBag).getBytes()),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[C]),u]):i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(s.oids.pkcs8ShroudedKeyBag).getBytes()),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[s.encryptPrivateKeyInfo(C,r,o)]),u]);var A=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[b]),w=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(s.oids.data).getBytes()),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,i.toDer(A).getBytes())])]);f.push(w)}var x,B=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,f);if(o.useMac){var I=n.md.sha1.create(),T=new n.util.ByteBuffer(n.random.getBytes(o.saltSize)),F=o.count,R=(t=a.generateKey(r,T,3,F,20),n.hmac.create());R.start(I,t),R.update(i.toDer(B).getBytes());var N=R.getMac();x=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.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(s.oids.sha1).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")]),i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,N.getBytes())]),i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,T.getBytes()),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(F).getBytes())])}return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(3).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(s.oids.data).getBytes()),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,i.toDer(B).getBytes())])]),x])},a.generateKey=n.pbe.generatePkcs12Key},1376:(t,e,r)=>{var n=r(91080);r(6180),r(4e4),r(3044),r(91752),r(96964),r(56920),r(90400),r(18736),r(92556);var i=n.asn1,s=t.exports=n.pkcs7=n.pkcs7||{};function a(t){var e={},r=[];if(!i.validate(t,s.asn1.recipientInfoValidator,e,r)){var a=new Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo.");throw a.errors=r,a}return{version:e.version.charCodeAt(0),issuer:n.pki.RDNAttributesAsArray(e.issuer),serialNumber:n.util.createBuffer(e.serial).toHex(),encryptedContent:{algorithm:i.derToOid(e.encAlgorithm),parameter:e.encParameter?e.encParameter.value:void 0,content:e.encKey}}}function o(t){for(var e,r=[],s=0;s<t.length;++s)r.push((e=t[s],i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.version).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[n.pki.distinguishedNameToAsn1({attributes:e.issuer}),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,n.util.hexToBytes(e.serialNumber))]),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.encryptedContent.algorithm).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")]),i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,e.encryptedContent.content)])));return r}function u(t){var e=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(t.version).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[n.pki.distinguishedNameToAsn1({attributes:t.issuer}),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,n.util.hexToBytes(t.serialNumber))]),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.digestAlgorithm).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")])]);if(t.authenticatedAttributesAsn1&&e.value.push(t.authenticatedAttributesAsn1),e.value.push(i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.signatureAlgorithm).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")])),e.value.push(i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,t.signature)),t.unauthenticatedAttributes.length>0){for(var r=i.create(i.Class.CONTEXT_SPECIFIC,1,!0,[]),s=0;s<t.unauthenticatedAttributes.length;++s){var a=t.unauthenticatedAttributes[s];r.values.push(c(a))}e.value.push(r)}return e}function c(t){var e;if(t.type===n.pki.oids.contentType)e=i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.value).getBytes());else if(t.type===n.pki.oids.messageDigest)e=i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,t.value.bytes());else if(t.type===n.pki.oids.signingTime){var r=new Date("1950-01-01T00:00:00Z"),s=new Date("2050-01-01T00:00:00Z"),a=t.value;if("string"==typeof a){var o=Date.parse(a);a=isNaN(o)?13===a.length?i.utcTimeToDate(a):i.generalizedTimeToDate(a):new Date(o)}e=a>=r&&a<s?i.create(i.Class.UNIVERSAL,i.Type.UTCTIME,!1,i.dateToUtcTime(a)):i.create(i.Class.UNIVERSAL,i.Type.GENERALIZEDTIME,!1,i.dateToGeneralizedTime(a))}return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.type).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SET,!0,[e])])}function l(t,e,r){var s={};if(!i.validate(e,r,s,[])){var a=new Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message.");throw a.errors=a,a}if(i.derToOid(s.contentType)!==n.pki.oids.data)throw new Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(s.encryptedContent){var o="";if(n.util.isArray(s.encryptedContent))for(var u=0;u<s.encryptedContent.length;++u){if(s.encryptedContent[u].type!==i.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");o+=s.encryptedContent[u].value}else o=s.encryptedContent;t.encryptedContent={algorithm:i.derToOid(s.encAlgorithm),parameter:n.util.createBuffer(s.encParameter.value),content:n.util.createBuffer(o)}}if(s.content){if(o="",n.util.isArray(s.content))for(u=0;u<s.content.length;++u){if(s.content[u].type!==i.Type.OCTETSTRING)throw new Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");o+=s.content[u].value}else o=s.content;t.content=n.util.createBuffer(o)}return t.version=s.version.charCodeAt(0),t.rawCapture=s,s}function h(t){if(void 0===t.encryptedContent.key)throw new Error("Symmetric key not available.");if(void 0===t.content){var e;switch(t.encryptedContent.algorithm){case n.pki.oids["aes128-CBC"]:case n.pki.oids["aes192-CBC"]:case n.pki.oids["aes256-CBC"]:e=n.aes.createDecryptionCipher(t.encryptedContent.key);break;case n.pki.oids.desCBC:case n.pki.oids["des-EDE3-CBC"]:e=n.des.createDecryptionCipher(t.encryptedContent.key);break;default:throw new Error("Unsupported symmetric cipher, OID "+t.encryptedContent.algorithm)}if(e.start(t.encryptedContent.parameter),e.update(t.encryptedContent.content),!e.finish())throw new Error("Symmetric decryption failed.");t.content=e.output}}s.messageFromPem=function(t){var e=n.pem.decode(t)[0];if("PKCS7"!==e.type){var r=new Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');throw r.headerType=e.type,r}if(e.procType&&"ENCRYPTED"===e.procType.type)throw new Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");var a=i.fromDer(e.body);return s.messageFromAsn1(a)},s.messageToPem=function(t,e){var r={type:"PKCS7",body:i.toDer(t.toAsn1()).getBytes()};return n.pem.encode(r,{maxline:e})},s.messageFromAsn1=function(t){var e={},r=[];if(!i.validate(t,s.asn1.contentInfoValidator,e,r)){var a=new Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo.");throw a.errors=r,a}var o,u=i.derToOid(e.contentType);switch(u){case n.pki.oids.envelopedData:o=s.createEnvelopedData();break;case n.pki.oids.encryptedData:o=s.createEncryptedData();break;case n.pki.oids.signedData:o=s.createSignedData();break;default:throw new Error("Cannot read PKCS#7 message. ContentType with OID "+u+" is not (yet) supported.")}return o.fromAsn1(e.content.value[0]),o},s.createSignedData=function(){var t=null;return t={type:n.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(e){if(l(t,e,s.asn1.signedDataValidator),t.certificates=[],t.crls=[],t.digestAlgorithmIdentifiers=[],t.contentInfo=null,t.signerInfos=[],t.rawCapture.certificates)for(var r=t.rawCapture.certificates.value,i=0;i<r.length;++i)t.certificates.push(n.pki.certificateFromAsn1(r[i]))},toAsn1:function(){t.contentInfo||t.sign();for(var e=[],r=0;r<t.certificates.length;++r)e.push(n.pki.certificateToAsn1(t.certificates[r]));var s=[],a=i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(t.version).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SET,!0,t.digestAlgorithmIdentifiers),t.contentInfo])]);return e.length>0&&a.value[0].value.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!0,e)),s.length>0&&a.value[0].value.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,s)),a.value[0].value.push(i.create(i.Class.UNIVERSAL,i.Type.SET,!0,t.signerInfos)),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.type).getBytes()),a])},addSigner:function(e){var r=e.issuer,i=e.serialNumber;if(e.certificate){var s=e.certificate;"string"==typeof s&&(s=n.pki.certificateFromPem(s)),r=s.issuer.attributes,i=s.serialNumber}var a=e.key;if(!a)throw new Error("Could not add PKCS#7 signer; no private key specified.");"string"==typeof a&&(a=n.pki.privateKeyFromPem(a));var o=e.digestAlgorithm||n.pki.oids.sha1;switch(o){case n.pki.oids.sha1:case n.pki.oids.sha256:case n.pki.oids.sha384:case n.pki.oids.sha512:case n.pki.oids.md5:break;default:throw new Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+o)}var u=e.authenticatedAttributes||[];if(u.length>0){for(var c=!1,l=!1,h=0;h<u.length;++h){var f=u[h];if(c||f.type!==n.pki.oids.contentType){if(l||f.type!==n.pki.oids.messageDigest);else if(l=!0,c)break}else if(c=!0,l)break}if(!c||!l)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.")}t.signers.push({key:a,version:1,issuer:r,serialNumber:i,digestAlgorithm:o,signatureAlgorithm:n.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:u,unauthenticatedAttributes:[]})},sign:function(e){var r;e=e||{},("object"!=typeof t.content||null===t.contentInfo)&&(t.contentInfo=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(n.pki.oids.data).getBytes())]),"content"in t&&(t.content instanceof n.util.ByteBuffer?r=t.content.bytes():"string"==typeof t.content&&(r=n.util.encodeUtf8(t.content)),e.detached?t.detachedContent=i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,r):t.contentInfo.value.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,r)])))),0!==t.signers.length&&function(e){var r;if(!(r=t.detachedContent?t.detachedContent:(r=t.contentInfo.value[1]).value[0]))throw new Error("Could not sign PKCS#7 message; there is no content to sign.");var s=i.derToOid(t.contentInfo.value[0].value),a=i.toDer(r);for(var o in a.getByte(),i.getBerValueLength(a),a=a.getBytes(),e)e[o].start().update(a);for(var l=new Date,h=0;h<t.signers.length;++h){var f=t.signers[h];if(0===f.authenticatedAttributes.length){if(s!==n.pki.oids.data)throw new Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.")}else{f.authenticatedAttributesAsn1=i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[]);for(var p=i.create(i.Class.UNIVERSAL,i.Type.SET,!0,[]),d=0;d<f.authenticatedAttributes.length;++d){var g=f.authenticatedAttributes[d];g.type===n.pki.oids.messageDigest?g.value=e[f.digestAlgorithm].digest():g.type===n.pki.oids.signingTime&&(g.value||(g.value=l)),p.value.push(c(g)),f.authenticatedAttributesAsn1.value.push(c(g))}a=i.toDer(p).getBytes(),f.md.start().update(a)}f.signature=f.key.sign(f.md,"RSASSA-PKCS1-V1_5")}t.signerInfos=function(t){for(var e=[],r=0;r<t.length;++r)e.push(u(t[r]));return e}(t.signers)}(function(){for(var e={},r=0;r<t.signers.length;++r){var s=t.signers[r];(a=s.digestAlgorithm)in e||(e[a]=n.md[n.pki.oids[a]].create()),0===s.authenticatedAttributes.length?s.md=e[a]:s.md=n.md[n.pki.oids[a]].create()}for(var a in t.digestAlgorithmIdentifiers=[],e)t.digestAlgorithmIdentifiers.push(i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(a).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")]));return e}())},verify:function(){throw new Error("PKCS#7 signature verification not yet implemented.")},addCertificate:function(e){"string"==typeof e&&(e=n.pki.certificateFromPem(e)),t.certificates.push(e)},addCertificateRevokationList:function(t){throw new Error("PKCS#7 CRL support not yet implemented.")}}},s.createEncryptedData=function(){var t=null;return t={type:n.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:n.pki.oids["aes256-CBC"]},fromAsn1:function(e){l(t,e,s.asn1.encryptedDataValidator)},decrypt:function(e){void 0!==e&&(t.encryptedContent.key=e),h(t)}}},s.createEnvelopedData=function(){var t=null;return t={type:n.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:n.pki.oids["aes256-CBC"]},fromAsn1:function(e){var r=l(t,e,s.asn1.envelopedDataValidator);t.recipients=function(t){for(var e=[],r=0;r<t.length;++r)e.push(a(t[r]));return e}(r.recipientInfos.value)},toAsn1:function(){return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.type).getBytes()),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(t.version).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SET,!0,o(t.recipients)),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,(e=t.encryptedContent,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(n.pki.oids.data).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.algorithm).getBytes()),e.parameter?i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,e.parameter.getBytes()):void 0]),i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,e.content.getBytes())])]))])])]);var e},findRecipient:function(e){for(var r=e.issuer.attributes,n=0;n<t.recipients.length;++n){var i=t.recipients[n],s=i.issuer;if(i.serialNumber===e.serialNumber&&s.length===r.length){for(var a=!0,o=0;o<r.length;++o)if(s[o].type!==r[o].type||s[o].value!==r[o].value){a=!1;break}if(a)return i}}return null},decrypt:function(e,r){if(void 0===t.encryptedContent.key&&void 0!==e&&void 0!==r)switch(e.encryptedContent.algorithm){case n.pki.oids.rsaEncryption:case n.pki.oids.desCBC:var i=r.decrypt(e.encryptedContent.content);t.encryptedContent.key=n.util.createBuffer(i);break;default:throw new Error("Unsupported asymmetric cipher, OID "+e.encryptedContent.algorithm)}h(t)},addRecipient:function(e){t.recipients.push({version:0,issuer:e.issuer.attributes,serialNumber:e.serialNumber,encryptedContent:{algorithm:n.pki.oids.rsaEncryption,key:e.publicKey}})},encrypt:function(e,r){if(void 0===t.encryptedContent.content){var i,s,a;switch(r=r||t.encryptedContent.algorithm,e=e||t.encryptedContent.key,r){case n.pki.oids["aes128-CBC"]:i=16,s=16,a=n.aes.createEncryptionCipher;break;case n.pki.oids["aes192-CBC"]:i=24,s=16,a=n.aes.createEncryptionCipher;break;case n.pki.oids["aes256-CBC"]:i=32,s=16,a=n.aes.createEncryptionCipher;break;case n.pki.oids["des-EDE3-CBC"]:i=24,s=8,a=n.des.createEncryptionCipher;break;default:throw new Error("Unsupported symmetric cipher, OID "+r)}if(void 0===e)e=n.util.createBuffer(n.random.getBytes(i));else if(e.length()!=i)throw new Error("Symmetric key has wrong length; got "+e.length()+" bytes, expected "+i+".");t.encryptedContent.algorithm=r,t.encryptedContent.key=e,t.encryptedContent.parameter=n.util.createBuffer(n.random.getBytes(s));var o=a(e);if(o.start(t.encryptedContent.parameter.copy()),o.update(t.content),!o.finish())throw new Error("Symmetric encryption failed.");t.encryptedContent.content=o.output}for(var u=0;u<t.recipients.length;++u){var c=t.recipients[u];if(void 0===c.encryptedContent.content){if(c.encryptedContent.algorithm!==n.pki.oids.rsaEncryption)throw new Error("Unsupported asymmetric cipher, OID "+c.encryptedContent.algorithm);c.encryptedContent.content=c.encryptedContent.key.encrypt(t.encryptedContent.key.data)}}}}}},56920:(t,e,r)=>{var n=r(91080);r(4e4),r(18736);var i=n.asn1,s=t.exports=n.pkcs7asn1=n.pkcs7asn1||{};n.pkcs7=n.pkcs7||{},n.pkcs7.asn1=s;var a={name:"ContentInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"contentType"},{name:"ContentInfo.content",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};s.contentInfoValidator=a;var o={name:"EncryptedContentInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:i.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};s.envelopedDataValidator={name:"EnvelopedData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(o)},s.encryptedDataValidator={name:"EncryptedData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"}].concat(o)};var u={name:"SignerInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",tagClass:i.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]};s.signedDataValidator={name:"SignedData",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},a,{name:"SignedData.Certificates",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,capture:"signerInfos",optional:!0,value:[u]}]},s.recipientInfoValidator={name:"RecipientInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:i.Class.UNIVERSAL,constructed:!1,captureAsn1:"encParameter",optional:!0}]},{name:"RecipientInfo.encryptedKey",tagClass:i.Class.UNIVERSAL,type:i.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}},75300:(t,e,r)=>{var n=r(91080);r(4e4),r(91752),r(62467),r(96964),r(71256),r(45644),r(4124),r(71532),r(18736),r(92556);var i=n.asn1,s=t.exports=n.pki=n.pki||{};s.pemToDer=function(t){var e=n.pem.decode(t)[0];if(e.procType&&"ENCRYPTED"===e.procType.type)throw new Error("Could not convert PEM to DER; PEM is encrypted.");return n.util.createBuffer(e.body)},s.privateKeyFromPem=function(t){var e=n.pem.decode(t)[0];if("PRIVATE KEY"!==e.type&&"RSA PRIVATE KEY"!==e.type){var r=new Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');throw r.headerType=e.type,r}if(e.procType&&"ENCRYPTED"===e.procType.type)throw new Error("Could not convert private key from PEM; PEM is encrypted.");var a=i.fromDer(e.body);return s.privateKeyFromAsn1(a)},s.privateKeyToPem=function(t,e){var r={type:"RSA PRIVATE KEY",body:i.toDer(s.privateKeyToAsn1(t)).getBytes()};return n.pem.encode(r,{maxline:e})},s.privateKeyInfoToPem=function(t,e){var r={type:"PRIVATE KEY",body:i.toDer(t).getBytes()};return n.pem.encode(r,{maxline:e})}},88200:(t,e,r)=>{var n=r(91080);r(18736),r(26056),r(90400),function(){if(n.prime)t.exports=n.prime;else{var e=t.exports=n.prime=n.prime||{},r=n.jsbn.BigInteger,i=[6,4,2,4,2,4,6,2],s=new r(null);s.fromInt(30);var a=function(t,e){return t|e};e.generateProbablePrime=function(t,e,i){"function"==typeof e&&(i=e,e={});var s=(e=e||{}).algorithm||"PRIMEINC";"string"==typeof s&&(s={name:s}),s.options=s.options||{};var a=e.prng||n.random,u={nextBytes:function(t){for(var e=a.getBytesSync(t.length),r=0;r<t.length;++r)t[r]=e.charCodeAt(r)}};if("PRIMEINC"===s.name)return function(t,e,i,s){return"workers"in i?function(t,e,i,s){if("undefined"==typeof Worker)return o(t,e,i,s);var a=c(t,e),u=i.workers,l=i.workLoad||100,h=30*l/8,f=i.workerScript||"forge/prime.worker.js";if(-1===u)return n.util.estimateCores((function(t,e){t&&(e=2),u=e-1,p()}));function p(){u=Math.max(1,u);for(var n=[],i=0;i<u;++i)n[i]=new Worker(f);for(i=0;i<u;++i)n[i].addEventListener("message",p);var o=!1;function p(i){if(!o){var u=i.data;if(u.found){for(var f=0;f<n.length;++f)n[f].terminate();return o=!0,s(null,new r(u.prime,16))}a.bitLength()>t&&(a=c(t,e));var p=a.toString(16);i.target.postMessage({hex:p,workLoad:l}),a.dAddOffset(h,0)}}}p()}(t,e,i,s):o(t,e,i,s)}(t,u,s.options,i);throw new Error("Invalid prime generation algorithm: "+s.name)}}function o(t,e,r,n){var i=c(t,e),s=function(t){return t<=100?27:t<=150?18:t<=200?15:t<=250?12:t<=300?9:t<=350?8:t<=400?7:t<=500?6:t<=600?5:t<=800?4:t<=1250?3:2}(i.bitLength());"millerRabinTests"in r&&(s=r.millerRabinTests);var a=10;"maxBlockTime"in r&&(a=r.maxBlockTime),u(i,t,e,0,s,a,n)}function u(t,e,r,s,a,o,l){var h=+new Date;do{if(t.bitLength()>e&&(t=c(e,r)),t.isProbablePrime(a))return l(null,t);t.dAddOffset(i[s++%8],0)}while(o<0||+new Date-h<o);n.util.setImmediate((function(){u(t,e,r,s,a,o,l)}))}function c(t,e){var n=new r(t,e),i=t-1;return n.testBit(i)||n.bitwiseTo(r.ONE.shiftLeft(i),a,n),n.dAddOffset(31-n.mod(s).byteValue(),0),n}}()},80408:(t,e,r)=>{var n=r(80628),i=r(91080);r(18736);var s=null;!i.util.isNodejs||i.options.usePureJavaScript||n.versions["node-webkit"]||(s=r(39116)),(t.exports=i.prng=i.prng||{}).create=function(t){for(var e={plugin:t,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""},r=t.md,n=new Array(32),a=0;a<32;++a)n[a]=r.create();function o(){if(e.pools[0].messageLength>=32)return u();var t=32-e.pools[0].messageLength<<5;e.collect(e.seedFileSync(t)),u()}function u(){e.reseeds=4294967295===e.reseeds?0:e.reseeds+1;var t=e.plugin.md.create();t.update(e.keyBytes);for(var r=1,n=0;n<32;++n)e.reseeds%r==0&&(t.update(e.pools[n].digest().getBytes()),e.pools[n].start()),r<<=1;e.keyBytes=t.digest().getBytes(),t.start(),t.update(e.keyBytes);var i=t.digest().getBytes();e.key=e.plugin.formatKey(e.keyBytes),e.seed=e.plugin.formatSeed(i),e.generated=0}function c(t){var e=null,r=i.util.globalScope,n=r.crypto||r.msCrypto;n&&n.getRandomValues&&(e=function(t){return n.getRandomValues(t)});var s=i.util.createBuffer();if(e)for(;s.length()<t;){var a=Math.max(1,Math.min(t-s.length(),65536)/4),o=new Uint32Array(Math.floor(a));try{e(o);for(var u=0;u<o.length;++u)s.putInt32(o[u])}catch(t){if(!("undefined"!=typeof QuotaExceededError&&t instanceof QuotaExceededError))throw t}}if(s.length()<t)for(var c,l,h,f=Math.floor(65536*Math.random());s.length()<t;)for(l=16807*(65535&f),l+=(32767&(c=16807*(f>>16)))<<16,f=4294967295&(l=(2147483647&(l+=c>>15))+(l>>31)),u=0;u<3;++u)h=f>>>(u<<3),h^=Math.floor(256*Math.random()),s.putByte(255&h);return s.getBytes(t)}return e.pools=n,e.pool=0,e.generate=function(t,r){if(!r)return e.generateSync(t);var n=e.plugin.cipher,s=e.plugin.increment,a=e.plugin.formatKey,o=e.plugin.formatSeed,c=i.util.createBuffer();e.key=null,function l(h){if(h)return r(h);if(c.length()>=t)return r(null,c.getBytes(t));if(e.generated>1048575&&(e.key=null),null===e.key)return i.util.nextTick((function(){!function(t){if(e.pools[0].messageLength>=32)return u(),t();var r=32-e.pools[0].messageLength<<5;e.seedFile(r,(function(r,n){if(r)return t(r);e.collect(n),u(),t()}))}(l)}));var f=n(e.key,e.seed);e.generated+=f.length,c.putBytes(f),e.key=a(n(e.key,s(e.seed))),e.seed=o(n(e.key,e.seed)),i.util.setImmediate(l)}()},e.generateSync=function(t){var r=e.plugin.cipher,n=e.plugin.increment,s=e.plugin.formatKey,a=e.plugin.formatSeed;e.key=null;for(var u=i.util.createBuffer();u.length()<t;){e.generated>1048575&&(e.key=null),null===e.key&&o();var c=r(e.key,e.seed);e.generated+=c.length,u.putBytes(c),e.key=s(r(e.key,n(e.seed))),e.seed=a(r(e.key,e.seed))}return u.getBytes(t)},s?(e.seedFile=function(t,e){s.randomBytes(t,(function(t,r){if(t)return e(t);e(null,r.toString())}))},e.seedFileSync=function(t){return s.randomBytes(t).toString()}):(e.seedFile=function(t,e){try{e(null,c(t))}catch(t){e(t)}},e.seedFileSync=c),e.collect=function(t){for(var r=t.length,n=0;n<r;++n)e.pools[e.pool].update(t.substr(n,1)),e.pool=31===e.pool?0:e.pool+1},e.collectInt=function(t,r){for(var n="",i=0;i<r;i+=8)n+=String.fromCharCode(t>>i&255);e.collect(n)},e.registerWorker=function(t){t===self?e.seedFile=function(t,e){self.addEventListener("message",(function t(r){var n=r.data;n.forge&&n.forge.prng&&(self.removeEventListener("message",t),e(n.forge.prng.err,n.forge.prng.bytes))})),self.postMessage({forge:{prng:{needed:t}}})}:t.addEventListener("message",(function(r){var n=r.data;n.forge&&n.forge.prng&&e.seedFile(n.forge.prng.needed,(function(e,r){t.postMessage({forge:{prng:{err:e,bytes:r}}})}))}))},e}},4124:(t,e,r)=>{var n=r(91080);r(90400),r(18736),(t.exports=n.pss=n.pss||{}).create=function(t){3===arguments.length&&(t={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var e,r=t.md,i=t.mgf,s=r.digestLength,a=t.salt||null;if("string"==typeof a&&(a=n.util.createBuffer(a)),"saltLength"in t)e=t.saltLength;else{if(null===a)throw new Error("Salt length not specified or specific salt not given.");e=a.length()}if(null!==a&&a.length()!==e)throw new Error("Given salt length does not match length of given salt.");var o=t.prng||n.random;return{encode:function(t,u){var c,l,h=u-1,f=Math.ceil(h/8),p=t.digest().getBytes();if(f<s+e+2)throw new Error("Message is too long to encrypt.");l=null===a?o.getBytesSync(e):a.bytes();var d=new n.util.ByteBuffer;d.fillWithByte(0,8),d.putBytes(p),d.putBytes(l),r.start(),r.update(d.getBytes());var g=r.digest().getBytes(),y=new n.util.ByteBuffer;y.fillWithByte(0,f-e-s-2),y.putByte(1),y.putBytes(l);var v=y.getBytes(),m=f-s-1,E=i.generate(g,m),S="";for(c=0;c<m;c++)S+=String.fromCharCode(v.charCodeAt(c)^E.charCodeAt(c));var b=65280>>8*f-h&255;return(S=String.fromCharCode(S.charCodeAt(0)&~b)+S.substr(1))+g+String.fromCharCode(188)},verify:function(t,a,o){var u,c=o-1,l=Math.ceil(c/8);if(a=a.substr(-l),l<s+e+2)throw new Error("Inconsistent parameters to PSS signature verification.");if(188!==a.charCodeAt(l-1))throw new Error("Encoded message does not end in 0xBC.");var h=l-s-1,f=a.substr(0,h),p=a.substr(h,s),d=65280>>8*l-c&255;if(0!=(f.charCodeAt(0)&d))throw new Error("Bits beyond keysize not zero as expected.");var g=i.generate(p,h),y="";for(u=0;u<h;u++)y+=String.fromCharCode(f.charCodeAt(u)^g.charCodeAt(u));y=String.fromCharCode(y.charCodeAt(0)&~d)+y.substr(1);var v=l-s-e-2;for(u=0;u<v;u++)if(0!==y.charCodeAt(u))throw new Error("Leftmost octets not zero as expected");if(1!==y.charCodeAt(v))throw new Error("Inconsistent PSS signature, 0x01 marker not found");var m=y.substr(-e),E=new n.util.ByteBuffer;return E.fillWithByte(0,8),E.putBytes(t),E.putBytes(m),r.start(),r.update(E.getBytes()),p===r.digest().getBytes()}}}},90400:(t,e,r)=>{var n=r(91080);r(6180),r(91716),r(80408),r(18736),n.random&&n.random.getBytes?t.exports=n.random:function(e){var r={},i=new Array(4),s=n.util.createBuffer();function a(){var t=n.prng.create(r);return t.getBytes=function(e,r){return t.generate(e,r)},t.getBytesSync=function(e){return t.generate(e)},t}r.formatKey=function(t){var e=n.util.createBuffer(t);return(t=new Array(4))[0]=e.getInt32(),t[1]=e.getInt32(),t[2]=e.getInt32(),t[3]=e.getInt32(),n.aes._expandKey(t,!1)},r.formatSeed=function(t){var e=n.util.createBuffer(t);return(t=new Array(4))[0]=e.getInt32(),t[1]=e.getInt32(),t[2]=e.getInt32(),t[3]=e.getInt32(),t},r.cipher=function(t,e){return n.aes._updateBlock(t,e,i,!1),s.putInt32(i[0]),s.putInt32(i[1]),s.putInt32(i[2]),s.putInt32(i[3]),s.getBytes()},r.increment=function(t){return++t[3],t},r.md=n.md.sha256;var o=a(),u=null,c=n.util.globalScope,l=c.crypto||c.msCrypto;if(l&&l.getRandomValues&&(u=function(t){return l.getRandomValues(t)}),(n.options.usePureJavaScript||!n.util.isNodejs&&!u)&&("undefined"==typeof window||window.document,o.collectInt(+new Date,32),"undefined"!=typeof navigator)){var h="";for(var f in navigator)try{"string"==typeof navigator[f]&&(h+=navigator[f])}catch(t){}o.collect(h),h=null}if(n.random)for(var f in o)n.random[f]=o[f];else n.random=o;n.random.createInstance=a,t.exports=n.random}()},42196:(t,e,r)=>{var n=r(91080);r(18736);var i=[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],s=[1,2,3,5],a=function(t,e){return t<<e&65535|(65535&t)>>16-e},o=function(t,e){return(65535&t)>>e|t<<16-e&65535};t.exports=n.rc2=n.rc2||{},n.rc2.expandKey=function(t,e){"string"==typeof t&&(t=n.util.createBuffer(t)),e=e||128;var r,s=t,a=t.length(),o=e,u=Math.ceil(o/8),c=255>>(7&o);for(r=a;r<128;r++)s.putByte(i[s.at(r-1)+s.at(r-a)&255]);for(s.setAt(128-u,i[s.at(128-u)&c]),r=127-u;r>=0;r--)s.setAt(r,i[s.at(r+1)^s.at(r+u)]);return s};var u=function(t,e,r){var i,u,c,l,h=!1,f=null,p=null,d=null,g=[];for(t=n.rc2.expandKey(t,e),c=0;c<64;c++)g.push(t.getInt16Le());r?(i=function(t){for(c=0;c<4;c++)t[c]+=g[l]+(t[(c+3)%4]&t[(c+2)%4])+(~t[(c+3)%4]&t[(c+1)%4]),t[c]=a(t[c],s[c]),l++},u=function(t){for(c=0;c<4;c++)t[c]+=g[63&t[(c+3)%4]]}):(i=function(t){for(c=3;c>=0;c--)t[c]=o(t[c],s[c]),t[c]-=g[l]+(t[(c+3)%4]&t[(c+2)%4])+(~t[(c+3)%4]&t[(c+1)%4]),l--},u=function(t){for(c=3;c>=0;c--)t[c]-=g[63&t[(c+3)%4]]});var y=function(t){var e=[];for(c=0;c<4;c++){var n=f.getInt16Le();null!==d&&(r?n^=d.getInt16Le():d.putInt16Le(n)),e.push(65535&n)}l=r?0:63;for(var i=0;i<t.length;i++)for(var s=0;s<t[i][0];s++)t[i][1](e);for(c=0;c<4;c++)null!==d&&(r?d.putInt16Le(e[c]):e[c]^=d.getInt16Le()),p.putInt16Le(e[c])},v=null;return v={start:function(t,e){t&&"string"==typeof t&&(t=n.util.createBuffer(t)),h=!1,f=n.util.createBuffer(),p=e||new n.util.createBuffer,d=t,v.output=p},update:function(t){for(h||f.putBuffer(t);f.length()>=8;)y([[5,i],[1,u],[6,i],[1,u],[5,i]])},finish:function(t){var e=!0;if(r)if(t)e=t(8,f,!r);else{var n=8===f.length()?8:8-f.length();f.fillWithByte(n,n)}if(e&&(h=!0,v.update()),!r&&(e=0===f.length()))if(t)e=t(8,p,!r);else{var i=p.length(),s=p.at(i-1);s>i?e=!1:p.truncate(s)}return e}}};n.rc2.startEncrypting=function(t,e,r){var i=n.rc2.createEncryptionCipher(t,128);return i.start(e,r),i},n.rc2.createEncryptionCipher=function(t,e){return u(t,e,!0)},n.rc2.startDecrypting=function(t,e,r){var i=n.rc2.createDecryptionCipher(t,128);return i.start(e,r),i},n.rc2.createDecryptionCipher=function(t,e){return u(t,e,!1)}},71532:(t,e,r)=>{var n=r(91080);if(r(4e4),r(26056),r(91752),r(29948),r(88200),r(90400),r(18736),void 0===i)var i=n.jsbn.BigInteger;var s=n.util.isNodejs?r(39116):null,a=n.asn1,o=n.util;n.pki=n.pki||{},t.exports=n.pki.rsa=n.rsa=n.rsa||{};var u=n.pki,c=[6,4,2,4,2,4,6,2],l={name:"PrivateKeyInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},h={name:"RSAPrivateKey",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},f={name:"RSAPublicKey",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:a.Class.UNIVERSAL,type:a.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},p=n.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:a.Class.UNIVERSAL,type:a.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},d={name:"DigestInfo",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm",tagClass:a.Class.UNIVERSAL,type:a.Type.SEQUENCE,constructed:!0,value:[{name:"DigestInfo.DigestAlgorithm.algorithmIdentifier",tagClass:a.Class.UNIVERSAL,type:a.Type.OID,constructed:!1,capture:"algorithmIdentifier"},{name:"DigestInfo.DigestAlgorithm.parameters",tagClass:a.Class.UNIVERSAL,type:a.Type.NULL,capture:"parameters",optional:!0,constructed:!1}]},{name:"DigestInfo.digest",tagClass:a.Class.UNIVERSAL,type:a.Type.OCTETSTRING,constructed:!1,capture:"digest"}]},g=function(t){var e;if(!(t.algorithm in u.oids)){var r=new Error("Unknown message digest algorithm.");throw r.algorithm=t.algorithm,r}e=u.oids[t.algorithm];var n=a.oidToDer(e).getBytes(),i=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[]),s=a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[]);s.value.push(a.create(a.Class.UNIVERSAL,a.Type.OID,!1,n)),s.value.push(a.create(a.Class.UNIVERSAL,a.Type.NULL,!1,""));var o=a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,t.digest().getBytes());return i.value.push(s),i.value.push(o),a.toDer(i).getBytes()},y=function(t,e,r){if(r)return t.modPow(e.e,e.n);if(!e.p||!e.q)return t.modPow(e.d,e.n);var s;e.dP||(e.dP=e.d.mod(e.p.subtract(i.ONE))),e.dQ||(e.dQ=e.d.mod(e.q.subtract(i.ONE))),e.qInv||(e.qInv=e.q.modInverse(e.p));do{s=new i(n.util.bytesToHex(n.random.getBytes(e.n.bitLength()/8)),16)}while(s.compareTo(e.n)>=0||!s.gcd(e.n).equals(i.ONE));for(var a=(t=t.multiply(s.modPow(e.e,e.n)).mod(e.n)).mod(e.p).modPow(e.dP,e.p),o=t.mod(e.q).modPow(e.dQ,e.q);a.compareTo(o)<0;)a=a.add(e.p);var u=a.subtract(o).multiply(e.qInv).mod(e.p).multiply(e.q).add(o);return u.multiply(s.modInverse(e.n)).mod(e.n)};function v(t,e,r){var i=n.util.createBuffer(),s=Math.ceil(e.n.bitLength()/8);if(t.length>s-11){var a=new Error("Message is too long for PKCS#1 v1.5 padding.");throw a.length=t.length,a.max=s-11,a}i.putByte(0),i.putByte(r);var o,u=s-3-t.length;if(0===r||1===r){o=0===r?0:255;for(var c=0;c<u;++c)i.putByte(o)}else for(;u>0;){var l=0,h=n.random.getBytes(u);for(c=0;c<u;++c)0===(o=h.charCodeAt(c))?++l:i.putByte(o);u=l}return i.putByte(0),i.putBytes(t),i}function m(t,e,r,i){var s=Math.ceil(e.n.bitLength()/8),a=n.util.createBuffer(t),o=a.getByte(),u=a.getByte();if(0!==o||r&&0!==u&&1!==u||!r&&2!=u||r&&0===u&&void 0===i)throw new Error("Encryption block is invalid.");var c=0;if(0===u){c=s-3-i;for(var l=0;l<c;++l)if(0!==a.getByte())throw new Error("Encryption block is invalid.")}else if(1===u)for(c=0;a.length()>1;){if(255!==a.getByte()){--a.read;break}++c}else if(2===u)for(c=0;a.length()>1;){if(0===a.getByte()){--a.read;break}++c}if(0!==a.getByte()||c!==s-3-a.length())throw new Error("Encryption block is invalid.");return a.getBytes()}function E(t){var e=t.toString(16);e[0]>="8"&&(e="00"+e);var r=n.util.hexToBytes(e);return r.length>1&&(0===r.charCodeAt(0)&&0==(128&r.charCodeAt(1))||255===r.charCodeAt(0)&&128==(128&r.charCodeAt(1)))?r.substr(1):r}function S(t){return t<=100?27:t<=150?18:t<=200?15:t<=250?12:t<=300?9:t<=350?8:t<=400?7:t<=500?6:t<=600?5:t<=800?4:t<=1250?3:2}function b(t){return n.util.isNodejs&&"function"==typeof s[t]}function C(t){return void 0!==o.globalScope&&"object"==typeof o.globalScope.crypto&&"object"==typeof o.globalScope.crypto.subtle&&"function"==typeof o.globalScope.crypto.subtle[t]}function A(t){return void 0!==o.globalScope&&"object"==typeof o.globalScope.msCrypto&&"object"==typeof o.globalScope.msCrypto.subtle&&"function"==typeof o.globalScope.msCrypto.subtle[t]}function w(t){for(var e=n.util.hexToBytes(t.toString(16)),r=new Uint8Array(e.length),i=0;i<e.length;++i)r[i]=e.charCodeAt(i);return r}u.rsa.encrypt=function(t,e,r){var s,a=r,o=Math.ceil(e.n.bitLength()/8);!1!==r&&!0!==r?(a=2===r,s=v(t,e,r)):(s=n.util.createBuffer()).putBytes(t);for(var u=new i(s.toHex(),16),c=y(u,e,a).toString(16),l=n.util.createBuffer(),h=o-Math.ceil(c.length/2);h>0;)l.putByte(0),--h;return l.putBytes(n.util.hexToBytes(c)),l.getBytes()},u.rsa.decrypt=function(t,e,r,s){var a=Math.ceil(e.n.bitLength()/8);if(t.length!==a){var o=new Error("Encrypted message length is invalid.");throw o.length=t.length,o.expected=a,o}var u=new i(n.util.createBuffer(t).toHex(),16);if(u.compareTo(e.n)>=0)throw new Error("Encrypted message is invalid.");for(var c=y(u,e,r).toString(16),l=n.util.createBuffer(),h=a-Math.ceil(c.length/2);h>0;)l.putByte(0),--h;return l.putBytes(n.util.hexToBytes(c)),!1!==s?m(l.getBytes(),e,r):l.getBytes()},u.rsa.createKeyPairGenerationState=function(t,e,r){"string"==typeof t&&(t=parseInt(t,10)),t=t||2048;var s,a=(r=r||{}).prng||n.random,o={nextBytes:function(t){for(var e=a.getBytesSync(t.length),r=0;r<t.length;++r)t[r]=e.charCodeAt(r)}},u=r.algorithm||"PRIMEINC";if("PRIMEINC"!==u)throw new Error("Invalid key generation algorithm: "+u);return(s={algorithm:u,state:0,bits:t,rng:o,eInt:e||65537,e:new i(null),p:null,q:null,qBits:t>>1,pBits:t-(t>>1),pqState:0,num:null,keys:null}).e.fromInt(s.eInt),s},u.rsa.stepKeyPairGenerationState=function(t,e){"algorithm"in t||(t.algorithm="PRIMEINC");var r=new i(null);r.fromInt(30);for(var n,s=0,a=function(t,e){return t|e},o=+new Date,l=0;null===t.keys&&(e<=0||l<e);){if(0===t.state){var h=null===t.p?t.pBits:t.qBits,f=h-1;0===t.pqState?(t.num=new i(h,t.rng),t.num.testBit(f)||t.num.bitwiseTo(i.ONE.shiftLeft(f),a,t.num),t.num.dAddOffset(31-t.num.mod(r).byteValue(),0),s=0,++t.pqState):1===t.pqState?t.num.bitLength()>h?t.pqState=0:t.num.isProbablePrime(S(t.num.bitLength()))?++t.pqState:t.num.dAddOffset(c[s++%8],0):2===t.pqState?t.pqState=0===t.num.subtract(i.ONE).gcd(t.e).compareTo(i.ONE)?3:0:3===t.pqState&&(t.pqState=0,null===t.p?t.p=t.num:t.q=t.num,null!==t.p&&null!==t.q&&++t.state,t.num=null)}else if(1===t.state)t.p.compareTo(t.q)<0&&(t.num=t.p,t.p=t.q,t.q=t.num),++t.state;else if(2===t.state)t.p1=t.p.subtract(i.ONE),t.q1=t.q.subtract(i.ONE),t.phi=t.p1.multiply(t.q1),++t.state;else if(3===t.state)0===t.phi.gcd(t.e).compareTo(i.ONE)?++t.state:(t.p=null,t.q=null,t.state=0);else if(4===t.state)t.n=t.p.multiply(t.q),t.n.bitLength()===t.bits?++t.state:(t.q=null,t.state=0);else if(5===t.state){var p=t.e.modInverse(t.phi);t.keys={privateKey:u.rsa.setPrivateKey(t.n,t.e,p,t.p,t.q,p.mod(t.p1),p.mod(t.q1),t.q.modInverse(t.p)),publicKey:u.rsa.setPublicKey(t.n,t.e)}}l+=(n=+new Date)-o,o=n}return null!==t.keys},u.rsa.generateKeyPair=function(t,e,r,c){if(1===arguments.length?"object"==typeof t?(r=t,t=void 0):"function"==typeof t&&(c=t,t=void 0):2===arguments.length?"number"==typeof t?"function"==typeof e?(c=e,e=void 0):"number"!=typeof e&&(r=e,e=void 0):(r=t,c=e,t=void 0,e=void 0):3===arguments.length&&("number"==typeof e?"function"==typeof r&&(c=r,r=void 0):(c=r,r=e,e=void 0)),r=r||{},void 0===t&&(t=r.bits||2048),void 0===e&&(e=r.e||65537),!n.options.usePureJavaScript&&!r.prng&&t>=256&&t<=16384&&(65537===e||3===e))if(c){if(b("generateKeyPair"))return s.generateKeyPair("rsa",{modulusLength:t,publicExponent:e,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},(function(t,e,r){if(t)return c(t);c(null,{privateKey:u.privateKeyFromPem(r),publicKey:u.publicKeyFromPem(e)})}));if(C("generateKey")&&C("exportKey"))return o.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:t,publicExponent:w(e),hash:{name:"SHA-256"}},!0,["sign","verify"]).then((function(t){return o.globalScope.crypto.subtle.exportKey("pkcs8",t.privateKey)})).then(void 0,(function(t){c(t)})).then((function(t){if(t){var e=u.privateKeyFromAsn1(a.fromDer(n.util.createBuffer(t)));c(null,{privateKey:e,publicKey:u.setRsaPublicKey(e.n,e.e)})}}));if(A("generateKey")&&A("exportKey")){var l=o.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:t,publicExponent:w(e),hash:{name:"SHA-256"}},!0,["sign","verify"]);return l.oncomplete=function(t){var e=t.target.result,r=o.globalScope.msCrypto.subtle.exportKey("pkcs8",e.privateKey);r.oncomplete=function(t){var e=t.target.result,r=u.privateKeyFromAsn1(a.fromDer(n.util.createBuffer(e)));c(null,{privateKey:r,publicKey:u.setRsaPublicKey(r.n,r.e)})},r.onerror=function(t){c(t)}},void(l.onerror=function(t){c(t)})}}else if(b("generateKeyPairSync")){var h=s.generateKeyPairSync("rsa",{modulusLength:t,publicExponent:e,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}});return{privateKey:u.privateKeyFromPem(h.privateKey),publicKey:u.publicKeyFromPem(h.publicKey)}}var f=u.rsa.createKeyPairGenerationState(t,e,r);if(!c)return u.rsa.stepKeyPairGenerationState(f,0),f.keys;!function(t,e,r){"function"==typeof e&&(r=e,e={});var s={algorithm:{name:(e=e||{}).algorithm||"PRIMEINC",options:{workers:e.workers||2,workLoad:e.workLoad||100,workerScript:e.workerScript}}};function a(){o(t.pBits,(function(e,n){return e?r(e):(t.p=n,null!==t.q?c(e,t.q):void o(t.qBits,c))}))}function o(t,e){n.prime.generateProbablePrime(t,s,e)}function c(e,n){if(e)return r(e);if(t.q=n,t.p.compareTo(t.q)<0){var s=t.p;t.p=t.q,t.q=s}if(0!==t.p.subtract(i.ONE).gcd(t.e).compareTo(i.ONE))return t.p=null,void a();if(0!==t.q.subtract(i.ONE).gcd(t.e).compareTo(i.ONE))return t.q=null,void o(t.qBits,c);if(t.p1=t.p.subtract(i.ONE),t.q1=t.q.subtract(i.ONE),t.phi=t.p1.multiply(t.q1),0!==t.phi.gcd(t.e).compareTo(i.ONE))return t.p=t.q=null,void a();if(t.n=t.p.multiply(t.q),t.n.bitLength()!==t.bits)return t.q=null,void o(t.qBits,c);var l=t.e.modInverse(t.phi);t.keys={privateKey:u.rsa.setPrivateKey(t.n,t.e,l,t.p,t.q,l.mod(t.p1),l.mod(t.q1),t.q.modInverse(t.p)),publicKey:u.rsa.setPublicKey(t.n,t.e)},r(null,t.keys)}"prng"in e&&(s.prng=e.prng),a()}(f,r,c)},u.setRsaPublicKey=u.rsa.setPublicKey=function(t,e){var r={n:t,e,encrypt:function(t,e,i){if("string"==typeof e?e=e.toUpperCase():void 0===e&&(e="RSAES-PKCS1-V1_5"),"RSAES-PKCS1-V1_5"===e)e={encode:function(t,e,r){return v(t,e,2).getBytes()}};else if("RSA-OAEP"===e||"RSAES-OAEP"===e)e={encode:function(t,e){return n.pkcs1.encode_rsa_oaep(e,t,i)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(e))e={encode:function(t){return t}};else if("string"==typeof e)throw new Error('Unsupported encryption scheme: "'+e+'".');var s=e.encode(t,r,!0);return u.rsa.encrypt(s,r,!0)},verify:function(t,e,i,s){"string"==typeof i?i=i.toUpperCase():void 0===i&&(i="RSASSA-PKCS1-V1_5"),void 0===s&&(s={_parseAllDigestBytes:!0}),"_parseAllDigestBytes"in s||(s._parseAllDigestBytes=!0),"RSASSA-PKCS1-V1_5"===i?i={verify:function(t,e){e=m(e,r,!0);var i=a.fromDer(e,{parseAllBytes:s._parseAllDigestBytes}),o={},u=[];if(!a.validate(i,d,o,u))throw(c=new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value.")).errors=u,c;var c,l=a.derToOid(o.algorithmIdentifier);if(l!==n.oids.md2&&l!==n.oids.md5&&l!==n.oids.sha1&&l!==n.oids.sha224&&l!==n.oids.sha256&&l!==n.oids.sha384&&l!==n.oids.sha512&&l!==n.oids["sha512-224"]&&l!==n.oids["sha512-256"])throw(c=new Error("Unknown RSASSA-PKCS1-v1_5 DigestAlgorithm identifier.")).oid=l,c;if((l===n.oids.md2||l===n.oids.md5)&&!("parameters"in o))throw new Error("ASN.1 object does not contain a valid RSASSA-PKCS1-v1_5 DigestInfo value. Missing algorithm identifer NULL parameters.");return t===o.digest}}:"NONE"!==i&&"NULL"!==i&&null!==i||(i={verify:function(t,e){return t===m(e,r,!0)}});var o=u.rsa.decrypt(e,r,!0,!1);return i.verify(t,o,r.n.bitLength())}};return r},u.setRsaPrivateKey=u.rsa.setPrivateKey=function(t,e,r,i,s,a,o,c){var l={n:t,e,d:r,p:i,q:s,dP:a,dQ:o,qInv:c,decrypt:function(t,e,r){"string"==typeof e?e=e.toUpperCase():void 0===e&&(e="RSAES-PKCS1-V1_5");var i=u.rsa.decrypt(t,l,!1,!1);if("RSAES-PKCS1-V1_5"===e)e={decode:m};else if("RSA-OAEP"===e||"RSAES-OAEP"===e)e={decode:function(t,e){return n.pkcs1.decode_rsa_oaep(e,t,r)}};else{if(-1===["RAW","NONE","NULL",null].indexOf(e))throw new Error('Unsupported encryption scheme: "'+e+'".');e={decode:function(t){return t}}}return e.decode(i,l,!1)},sign:function(t,e){var r=!1;"string"==typeof e&&(e=e.toUpperCase()),void 0===e||"RSASSA-PKCS1-V1_5"===e?(e={encode:g},r=1):"NONE"!==e&&"NULL"!==e&&null!==e||(e={encode:function(){return t}},r=1);var n=e.encode(t,l.n.bitLength());return u.rsa.encrypt(n,l,r)}};return l},u.wrapRsaPrivateKey=function(t){return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,a.integerToDer(0).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(u.oids.rsaEncryption).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.NULL,!1,"")]),a.create(a.Class.UNIVERSAL,a.Type.OCTETSTRING,!1,a.toDer(t).getBytes())])},u.privateKeyFromAsn1=function(t){var e,r,s,o,c,f,p,d,g={},y=[];if(a.validate(t,l,g,y)&&(t=a.fromDer(n.util.createBuffer(g.privateKey))),g={},y=[],!a.validate(t,h,g,y)){var v=new Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey.");throw v.errors=y,v}return e=n.util.createBuffer(g.privateKeyModulus).toHex(),r=n.util.createBuffer(g.privateKeyPublicExponent).toHex(),s=n.util.createBuffer(g.privateKeyPrivateExponent).toHex(),o=n.util.createBuffer(g.privateKeyPrime1).toHex(),c=n.util.createBuffer(g.privateKeyPrime2).toHex(),f=n.util.createBuffer(g.privateKeyExponent1).toHex(),p=n.util.createBuffer(g.privateKeyExponent2).toHex(),d=n.util.createBuffer(g.privateKeyCoefficient).toHex(),u.setRsaPrivateKey(new i(e,16),new i(r,16),new i(s,16),new i(o,16),new i(c,16),new i(f,16),new i(p,16),new i(d,16))},u.privateKeyToAsn1=u.privateKeyToRSAPrivateKey=function(t){return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,a.integerToDer(0).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,E(t.n)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,E(t.e)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,E(t.d)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,E(t.p)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,E(t.q)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,E(t.dP)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,E(t.dQ)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,E(t.qInv))])},u.publicKeyFromAsn1=function(t){var e={},r=[];if(a.validate(t,p,e,r)){var s,o=a.derToOid(e.publicKeyOid);if(o!==u.oids.rsaEncryption)throw(s=new Error("Cannot read public key. Unknown OID.")).oid=o,s;t=e.rsaPublicKey}if(r=[],!a.validate(t,f,e,r))throw(s=new Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey.")).errors=r,s;var c=n.util.createBuffer(e.publicKeyModulus).toHex(),l=n.util.createBuffer(e.publicKeyExponent).toHex();return u.setRsaPublicKey(new i(c,16),new i(l,16))},u.publicKeyToAsn1=u.publicKeyToSubjectPublicKeyInfo=function(t){return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.OID,!1,a.oidToDer(u.oids.rsaEncryption).getBytes()),a.create(a.Class.UNIVERSAL,a.Type.NULL,!1,"")]),a.create(a.Class.UNIVERSAL,a.Type.BITSTRING,!1,[u.publicKeyToRSAPublicKey(t)])])},u.publicKeyToRSAPublicKey=function(t){return a.create(a.Class.UNIVERSAL,a.Type.SEQUENCE,!0,[a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,E(t.n)),a.create(a.Class.UNIVERSAL,a.Type.INTEGER,!1,E(t.e))])}},95668:(t,e,r)=>{var n=r(91080);r(48724),r(18736);var i=t.exports=n.sha1=n.sha1||{};n.md.sha1=n.md.algorithms.sha1=i,i.create=function(){a||(s=String.fromCharCode(128),s+=n.util.fillString(String.fromCharCode(0),64),a=!0);var t=null,e=n.util.createBuffer(),r=new Array(80),i={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){i.messageLength=0,i.fullMessageLength=i.messageLength64=[];for(var r=i.messageLengthSize/4,s=0;s<r;++s)i.fullMessageLength.push(0);return e=n.util.createBuffer(),t={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520},i}};return i.start(),i.update=function(s,a){"utf8"===a&&(s=n.util.encodeUtf8(s));var u=s.length;i.messageLength+=u,u=[u/4294967296>>>0,u>>>0];for(var c=i.fullMessageLength.length-1;c>=0;--c)i.fullMessageLength[c]+=u[1],u[1]=u[0]+(i.fullMessageLength[c]/4294967296>>>0),i.fullMessageLength[c]=i.fullMessageLength[c]>>>0,u[0]=u[1]/4294967296>>>0;return e.putBytes(s),o(t,r,e),(e.read>2048||0===e.length())&&e.compact(),i},i.digest=function(){var a=n.util.createBuffer();a.putBytes(e.bytes());var u,c=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize&i.blockLength-1;a.putBytes(s.substr(0,i.blockLength-c));for(var l=8*i.fullMessageLength[0],h=0;h<i.fullMessageLength.length-1;++h)l+=(u=8*i.fullMessageLength[h+1])/4294967296>>>0,a.putInt32(l>>>0),l=u>>>0;a.putInt32(l);var f={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3,h4:t.h4};o(f,r,a);var p=n.util.createBuffer();return p.putInt32(f.h0),p.putInt32(f.h1),p.putInt32(f.h2),p.putInt32(f.h3),p.putInt32(f.h4),p},i};var s=null,a=!1;function o(t,e,r){for(var n,i,s,a,o,u,c,l=r.length();l>=64;){for(i=t.h0,s=t.h1,a=t.h2,o=t.h3,u=t.h4,c=0;c<16;++c)n=r.getInt32(),e[c]=n,n=(i<<5|i>>>27)+(o^s&(a^o))+u+1518500249+n,u=o,o=a,a=(s<<30|s>>>2)>>>0,s=i,i=n;for(;c<20;++c)n=(n=e[c-3]^e[c-8]^e[c-14]^e[c-16])<<1|n>>>31,e[c]=n,n=(i<<5|i>>>27)+(o^s&(a^o))+u+1518500249+n,u=o,o=a,a=(s<<30|s>>>2)>>>0,s=i,i=n;for(;c<32;++c)n=(n=e[c-3]^e[c-8]^e[c-14]^e[c-16])<<1|n>>>31,e[c]=n,n=(i<<5|i>>>27)+(s^a^o)+u+1859775393+n,u=o,o=a,a=(s<<30|s>>>2)>>>0,s=i,i=n;for(;c<40;++c)n=(n=e[c-6]^e[c-16]^e[c-28]^e[c-32])<<2|n>>>30,e[c]=n,n=(i<<5|i>>>27)+(s^a^o)+u+1859775393+n,u=o,o=a,a=(s<<30|s>>>2)>>>0,s=i,i=n;for(;c<60;++c)n=(n=e[c-6]^e[c-16]^e[c-28]^e[c-32])<<2|n>>>30,e[c]=n,n=(i<<5|i>>>27)+(s&a|o&(s^a))+u+2400959708+n,u=o,o=a,a=(s<<30|s>>>2)>>>0,s=i,i=n;for(;c<80;++c)n=(n=e[c-6]^e[c-16]^e[c-28]^e[c-32])<<2|n>>>30,e[c]=n,n=(i<<5|i>>>27)+(s^a^o)+u+3395469782+n,u=o,o=a,a=(s<<30|s>>>2)>>>0,s=i,i=n;t.h0=t.h0+i|0,t.h1=t.h1+s|0,t.h2=t.h2+a|0,t.h3=t.h3+o|0,t.h4=t.h4+u|0,l-=64}}},91716:(t,e,r)=>{var n=r(91080);r(48724),r(18736);var i=t.exports=n.sha256=n.sha256||{};n.md.sha256=n.md.algorithms.sha256=i,i.create=function(){a||(s=String.fromCharCode(128),s+=n.util.fillString(String.fromCharCode(0),64),o=[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],a=!0);var t=null,e=n.util.createBuffer(),r=new Array(64),i={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){i.messageLength=0,i.fullMessageLength=i.messageLength64=[];for(var r=i.messageLengthSize/4,s=0;s<r;++s)i.fullMessageLength.push(0);return e=n.util.createBuffer(),t={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225},i}};return i.start(),i.update=function(s,a){"utf8"===a&&(s=n.util.encodeUtf8(s));var o=s.length;i.messageLength+=o,o=[o/4294967296>>>0,o>>>0];for(var c=i.fullMessageLength.length-1;c>=0;--c)i.fullMessageLength[c]+=o[1],o[1]=o[0]+(i.fullMessageLength[c]/4294967296>>>0),i.fullMessageLength[c]=i.fullMessageLength[c]>>>0,o[0]=o[1]/4294967296>>>0;return e.putBytes(s),u(t,r,e),(e.read>2048||0===e.length())&&e.compact(),i},i.digest=function(){var a=n.util.createBuffer();a.putBytes(e.bytes());var o,c=i.fullMessageLength[i.fullMessageLength.length-1]+i.messageLengthSize&i.blockLength-1;a.putBytes(s.substr(0,i.blockLength-c));for(var l=8*i.fullMessageLength[0],h=0;h<i.fullMessageLength.length-1;++h)l+=(o=8*i.fullMessageLength[h+1])/4294967296>>>0,a.putInt32(l>>>0),l=o>>>0;a.putInt32(l);var f={h0:t.h0,h1:t.h1,h2:t.h2,h3:t.h3,h4:t.h4,h5:t.h5,h6:t.h6,h7:t.h7};u(f,r,a);var p=n.util.createBuffer();return p.putInt32(f.h0),p.putInt32(f.h1),p.putInt32(f.h2),p.putInt32(f.h3),p.putInt32(f.h4),p.putInt32(f.h5),p.putInt32(f.h6),p.putInt32(f.h7),p},i};var s=null,a=!1,o=null;function u(t,e,r){for(var n,i,s,a,u,c,l,h,f,p,d,g,y,v=r.length();v>=64;){for(u=0;u<16;++u)e[u]=r.getInt32();for(;u<64;++u)n=((n=e[u-2])>>>17|n<<15)^(n>>>19|n<<13)^n>>>10,i=((i=e[u-15])>>>7|i<<25)^(i>>>18|i<<14)^i>>>3,e[u]=n+e[u-7]+i+e[u-16]|0;for(c=t.h0,l=t.h1,h=t.h2,f=t.h3,p=t.h4,d=t.h5,g=t.h6,y=t.h7,u=0;u<64;++u)s=(c>>>2|c<<30)^(c>>>13|c<<19)^(c>>>22|c<<10),a=c&l|h&(c^l),n=y+((p>>>6|p<<26)^(p>>>11|p<<21)^(p>>>25|p<<7))+(g^p&(d^g))+o[u]+e[u],y=g,g=d,d=p,p=f+n>>>0,f=h,h=l,l=c,c=n+(i=s+a)>>>0;t.h0=t.h0+c|0,t.h1=t.h1+l|0,t.h2=t.h2+h|0,t.h3=t.h3+f|0,t.h4=t.h4+p|0,t.h5=t.h5+d|0,t.h6=t.h6+g|0,t.h7=t.h7+y|0,v-=64}}},74756:(t,e,r)=>{var n=r(91080);r(48724),r(18736);var i=t.exports=n.sha512=n.sha512||{};n.md.sha512=n.md.algorithms.sha512=i;var s=n.sha384=n.sha512.sha384=n.sha512.sha384||{};s.create=function(){return i.create("SHA-384")},n.md.sha384=n.md.algorithms.sha384=s,n.sha512.sha256=n.sha512.sha256||{create:function(){return i.create("SHA-512/256")}},n.md["sha512/256"]=n.md.algorithms["sha512/256"]=n.sha512.sha256,n.sha512.sha224=n.sha512.sha224||{create:function(){return i.create("SHA-512/224")}},n.md["sha512/224"]=n.md.algorithms["sha512/224"]=n.sha512.sha224,i.create=function(t){if(o||(a=String.fromCharCode(128),a+=n.util.fillString(String.fromCharCode(0),128),u=[[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]],(c={})["SHA-512"]=[[1779033703,4089235720],[3144134277,2227873595],[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],c["SHA-384"]=[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],c["SHA-512/256"]=[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,746961066],[246885852,2177182882]],c["SHA-512/224"]=[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]],o=!0),void 0===t&&(t="SHA-512"),!(t in c))throw new Error("Invalid SHA-512 algorithm: "+t);for(var e=c[t],r=null,i=n.util.createBuffer(),s=new Array(80),h=0;h<80;++h)s[h]=new Array(2);var f=64;switch(t){case"SHA-384":f=48;break;case"SHA-512/256":f=32;break;case"SHA-512/224":f=28}var p={algorithm:t.replace("-","").toLowerCase(),blockLength:128,digestLength:f,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){p.messageLength=0,p.fullMessageLength=p.messageLength128=[];for(var t=p.messageLengthSize/4,s=0;s<t;++s)p.fullMessageLength.push(0);for(i=n.util.createBuffer(),r=new Array(e.length),s=0;s<e.length;++s)r[s]=e[s].slice(0);return p}};return p.start(),p.update=function(t,e){"utf8"===e&&(t=n.util.encodeUtf8(t));var a=t.length;p.messageLength+=a,a=[a/4294967296>>>0,a>>>0];for(var o=p.fullMessageLength.length-1;o>=0;--o)p.fullMessageLength[o]+=a[1],a[1]=a[0]+(p.fullMessageLength[o]/4294967296>>>0),p.fullMessageLength[o]=p.fullMessageLength[o]>>>0,a[0]=a[1]/4294967296>>>0;return i.putBytes(t),l(r,s,i),(i.read>2048||0===i.length())&&i.compact(),p},p.digest=function(){var e=n.util.createBuffer();e.putBytes(i.bytes());var o,u=p.fullMessageLength[p.fullMessageLength.length-1]+p.messageLengthSize&p.blockLength-1;e.putBytes(a.substr(0,p.blockLength-u));for(var c=8*p.fullMessageLength[0],h=0;h<p.fullMessageLength.length-1;++h)c+=(o=8*p.fullMessageLength[h+1])/4294967296>>>0,e.putInt32(c>>>0),c=o>>>0;e.putInt32(c);var f=new Array(r.length);for(h=0;h<r.length;++h)f[h]=r[h].slice(0);l(f,s,e);var d,g=n.util.createBuffer();for(d="SHA-512"===t?f.length:"SHA-384"===t?f.length-2:f.length-4,h=0;h<d;++h)g.putInt32(f[h][0]),h===d-1&&"SHA-512/224"===t||g.putInt32(f[h][1]);return g},p};var a=null,o=!1,u=null,c=null;function l(t,e,r){for(var n,i,s,a,o,c,l,h,f,p,d,g,y,v,m,E,S,b,C,A,w,x,B,I,T,F,R,N,D,P,k,L,O,_=r.length();_>=128;){for(R=0;R<16;++R)e[R][0]=r.getInt32()>>>0,e[R][1]=r.getInt32()>>>0;for(;R<80;++R)n=(((N=(P=e[R-2])[0])>>>19|(D=P[1])<<13)^(D>>>29|N<<3)^N>>>6)>>>0,i=((N<<13|D>>>19)^(D<<3|N>>>29)^(N<<26|D>>>6))>>>0,s=(((N=(L=e[R-15])[0])>>>1|(D=L[1])<<31)^(N>>>8|D<<24)^N>>>7)>>>0,a=((N<<31|D>>>1)^(N<<24|D>>>8)^(N<<25|D>>>7))>>>0,k=e[R-7],O=e[R-16],D=i+k[1]+a+O[1],e[R][0]=n+k[0]+s+O[0]+(D/4294967296>>>0)>>>0,e[R][1]=D>>>0;for(d=t[0][0],g=t[0][1],y=t[1][0],v=t[1][1],m=t[2][0],E=t[2][1],S=t[3][0],b=t[3][1],C=t[4][0],A=t[4][1],w=t[5][0],x=t[5][1],B=t[6][0],I=t[6][1],T=t[7][0],F=t[7][1],R=0;R<80;++R)l=((C>>>14|A<<18)^(C>>>18|A<<14)^(A>>>9|C<<23))>>>0,h=(B^C&(w^B))>>>0,o=((d>>>28|g<<4)^(g>>>2|d<<30)^(g>>>7|d<<25))>>>0,c=((d<<4|g>>>28)^(g<<30|d>>>2)^(g<<25|d>>>7))>>>0,f=(d&y|m&(d^y))>>>0,p=(g&v|E&(g^v))>>>0,D=F+(((C<<18|A>>>14)^(C<<14|A>>>18)^(A<<23|C>>>9))>>>0)+((I^A&(x^I))>>>0)+u[R][1]+e[R][1],n=T+l+h+u[R][0]+e[R][0]+(D/4294967296>>>0)>>>0,i=D>>>0,s=o+f+((D=c+p)/4294967296>>>0)>>>0,a=D>>>0,T=B,F=I,B=w,I=x,w=C,x=A,C=S+n+((D=b+i)/4294967296>>>0)>>>0,A=D>>>0,S=m,b=E,m=y,E=v,y=d,v=g,d=n+s+((D=i+a)/4294967296>>>0)>>>0,g=D>>>0;D=t[0][1]+g,t[0][0]=t[0][0]+d+(D/4294967296>>>0)>>>0,t[0][1]=D>>>0,D=t[1][1]+v,t[1][0]=t[1][0]+y+(D/4294967296>>>0)>>>0,t[1][1]=D>>>0,D=t[2][1]+E,t[2][0]=t[2][0]+m+(D/4294967296>>>0)>>>0,t[2][1]=D>>>0,D=t[3][1]+b,t[3][0]=t[3][0]+S+(D/4294967296>>>0)>>>0,t[3][1]=D>>>0,D=t[4][1]+A,t[4][0]=t[4][0]+C+(D/4294967296>>>0)>>>0,t[4][1]=D>>>0,D=t[5][1]+x,t[5][0]=t[5][0]+w+(D/4294967296>>>0)>>>0,t[5][1]=D>>>0,D=t[6][1]+I,t[6][0]=t[6][0]+B+(D/4294967296>>>0)>>>0,t[6][1]=D>>>0,D=t[7][1]+F,t[7][0]=t[7][0]+T+(D/4294967296>>>0)>>>0,t[7][1]=D>>>0,_-=128}}},89573:(t,e,r)=>{var n=r(91080);r(6180),r(43472),r(79576),r(95668),r(18736);var i=t.exports=n.ssh=n.ssh||{};function s(t,e){var r=e.toString(16);r[0]>="8"&&(r="00"+r);var i=n.util.hexToBytes(r);t.putInt32(i.length),t.putBytes(i)}function a(t,e){t.putInt32(e.length),t.putString(e)}function o(){for(var t=n.md.sha1.create(),e=arguments.length,r=0;r<e;++r)t.update(arguments[r]);return t.digest()}i.privateKeyToPutty=function(t,e,r){var i="ssh-rsa",u=""===(e=e||"")?"none":"aes256-cbc",c="PuTTY-User-Key-File-2: "+i+"\r\n";c+="Encryption: "+u+"\r\n",c+="Comment: "+(r=r||"")+"\r\n";var l=n.util.createBuffer();a(l,i),s(l,t.e),s(l,t.n);var h=n.util.encode64(l.bytes(),64),f=Math.floor(h.length/66)+1;c+="Public-Lines: "+f+"\r\n",c+=h;var p,d=n.util.createBuffer();if(s(d,t.d),s(d,t.p),s(d,t.q),s(d,t.qInv),e){var g=d.length()+16-1;g-=g%16;var y=o(d.bytes());y.truncate(y.length()-g+d.length()),d.putBuffer(y);var v=n.util.createBuffer();v.putBuffer(o("\0\0\0\0",e)),v.putBuffer(o("\0\0\0",e));var m=n.aes.createEncryptionCipher(v.truncate(8),"CBC");m.start(n.util.createBuffer().fillWithByte(0,16)),m.update(d.copy()),m.finish();var E=m.output;E.truncate(16),p=n.util.encode64(E.bytes(),64)}else p=n.util.encode64(d.bytes(),64);c+="\r\nPrivate-Lines: "+(f=Math.floor(p.length/66)+1)+"\r\n",c+=p;var S=o("putty-private-key-file-mac-key",e),b=n.util.createBuffer();a(b,i),a(b,u),a(b,r),b.putInt32(l.length()),b.putBuffer(l),b.putInt32(d.length()),b.putBuffer(d);var C=n.hmac.create();return C.start("sha1",S),C.update(b.bytes()),c+"\r\nPrivate-MAC: "+C.digest().toHex()+"\r\n"},i.publicKeyToOpenSSH=function(t,e){var r="ssh-rsa";e=e||"";var i=n.util.createBuffer();return a(i,r),s(i,t.e),s(i,t.n),r+" "+n.util.encode64(i.bytes())+" "+e},i.privateKeyToOpenSSH=function(t,e){return e?n.pki.encryptRsaPrivateKey(t,e,{legacy:!0,algorithm:"aes128"}):n.pki.privateKeyToPem(t)},i.getPublicKeyFingerprint=function(t,e){var r=(e=e||{}).md||n.md.md5.create(),i=n.util.createBuffer();a(i,"ssh-rsa"),s(i,t.e),s(i,t.n),r.start(),r.update(i.getBytes());var o=r.digest();if("hex"===e.encoding){var u=o.toHex();return e.delimiter?u.match(/.{2}/g).join(e.delimiter):u}if("binary"===e.encoding)return o.getBytes();if(e.encoding)throw new Error('Unknown encoding "'+e.encoding+'".');return o}},95720:(t,e,r)=>{var n=r(91080);r(4e4),r(43472),r(79576),r(96964),r(75300),r(90400),r(95668),r(18736);var i=function(t,e,r,i){var s=n.util.createBuffer(),a=t.length>>1,o=a+(1&t.length),u=t.substr(0,o),c=t.substr(a,o),l=n.util.createBuffer(),h=n.hmac.create();r=e+r;var f=Math.ceil(i/16),p=Math.ceil(i/20);h.start("MD5",u);var d=n.util.createBuffer();l.putBytes(r);for(var g=0;g<f;++g)h.start(null,null),h.update(l.getBytes()),l.putBuffer(h.digest()),h.start(null,null),h.update(l.bytes()+r),d.putBuffer(h.digest());h.start("SHA1",c);var y=n.util.createBuffer();for(l.clear(),l.putBytes(r),g=0;g<p;++g)h.start(null,null),h.update(l.getBytes()),l.putBuffer(h.digest()),h.start(null,null),h.update(l.bytes()+r),y.putBuffer(h.digest());return s.putBytes(n.util.xorBytes(d.getBytes(),y.getBytes(),i)),s},s=function(t,e,r){var i=!1;try{var s=t.deflate(e.fragment.getBytes());e.fragment=n.util.createBuffer(s),e.length=s.length,i=!0}catch(t){}return i},a=function(t,e,r){var i=!1;try{var s=t.inflate(e.fragment.getBytes());e.fragment=n.util.createBuffer(s),e.length=s.length,i=!0}catch(t){}return i},o=function(t,e){var r=0;switch(e){case 1:r=t.getByte();break;case 2:r=t.getInt16();break;case 3:r=t.getInt24();break;case 4:r=t.getInt32()}return n.util.createBuffer(t.getBytes(r))},u=function(t,e,r){t.putInt(r.length(),e<<3),t.putBuffer(r)},c={Versions:{TLS_1_0:{major:3,minor:1},TLS_1_1:{major:3,minor:2},TLS_1_2:{major:3,minor:3}}};c.SupportedVersions=[c.Versions.TLS_1_1,c.Versions.TLS_1_0],c.Version=c.SupportedVersions[0],c.MaxFragment=15360,c.ConnectionEnd={server:0,client:1},c.PRFAlgorithm={tls_prf_sha256:0},c.BulkCipherAlgorithm={none:null,rc4:0,des3:1,aes:2},c.CipherType={stream:0,block:1,aead:2},c.MACAlgorithm={none:null,hmac_md5:0,hmac_sha1:1,hmac_sha256:2,hmac_sha384:3,hmac_sha512:4},c.CompressionMethod={none:0,deflate:1},c.ContentType={change_cipher_spec:20,alert:21,handshake:22,application_data:23,heartbeat:24},c.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},c.Alert={},c.Alert.Level={warning:1,fatal:2},c.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},c.HeartbeatMessageType={heartbeat_request:1,heartbeat_response:2},c.CipherSuites={},c.getCipherSuite=function(t){var e=null;for(var r in c.CipherSuites){var n=c.CipherSuites[r];if(n.id[0]===t.charCodeAt(0)&&n.id[1]===t.charCodeAt(1)){e=n;break}}return e},c.handleUnexpected=function(t,e){!t.open&&t.entity===c.ConnectionEnd.client||t.error(t,{message:"Unexpected message. Received TLS record out of order.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.unexpected_message}})},c.handleHelloRequest=function(t,e,r){!t.handshaking&&t.handshakes>0&&(c.queue(t,c.createAlert(t,{level:c.Alert.Level.warning,description:c.Alert.Description.no_renegotiation})),c.flush(t)),t.process()},c.parseHelloMessage=function(t,e,r){var i=null,s=t.entity===c.ConnectionEnd.client;if(r<38)t.error(t,{message:s?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.illegal_parameter}});else{var a=e.fragment,u=a.length();if(i={version:{major:a.getByte(),minor:a.getByte()},random:n.util.createBuffer(a.getBytes(32)),session_id:o(a,1),extensions:[]},s?(i.cipher_suite=a.getBytes(2),i.compression_method=a.getByte()):(i.cipher_suites=o(a,2),i.compression_methods=o(a,1)),(u=r-(u-a.length()))>0){for(var l=o(a,2);l.length()>0;)i.extensions.push({type:[l.getByte(),l.getByte()],data:o(l,2)});if(!s)for(var h=0;h<i.extensions.length;++h){var f=i.extensions[h];if(0===f.type[0]&&0===f.type[1])for(var p=o(f.data,2);p.length()>0&&0===p.getByte();)t.session.extensions.server_name.serverNameList.push(o(p,2).getBytes())}}if(t.session.version&&(i.version.major!==t.session.version.major||i.version.minor!==t.session.version.minor))return t.error(t,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.protocol_version}});if(s)t.session.cipherSuite=c.getCipherSuite(i.cipher_suite);else for(var d=n.util.createBuffer(i.cipher_suites.bytes());d.length()>0&&(t.session.cipherSuite=c.getCipherSuite(d.getBytes(2)),null===t.session.cipherSuite););if(null===t.session.cipherSuite)return t.error(t,{message:"No cipher suites in common.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.handshake_failure},cipherSuite:n.util.bytesToHex(i.cipher_suite)});t.session.compressionMethod=s?i.compression_method:c.CompressionMethod.none}return i},c.createSecurityParameters=function(t,e){var r=t.entity===c.ConnectionEnd.client,n=e.random.bytes(),i=r?t.session.sp.client_random:n,s=r?n:c.createRandom().getBytes();t.session.sp={entity:t.entity,prf_algorithm:c.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:t.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:i,server_random:s}},c.handleServerHello=function(t,e,r){var n=c.parseHelloMessage(t,e,r);if(!t.fail){if(!(n.version.minor<=t.version.minor))return t.error(t,{message:"Incompatible TLS version.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.protocol_version}});t.version.minor=n.version.minor,t.session.version=t.version;var i=n.session_id.bytes();i.length>0&&i===t.session.id?(t.expect=d,t.session.resuming=!0,t.session.sp.server_random=n.random.bytes()):(t.expect=l,t.session.resuming=!1,c.createSecurityParameters(t,n)),t.session.id=i,t.process()}},c.handleClientHello=function(t,e,r){var i=c.parseHelloMessage(t,e,r);if(!t.fail){var s=i.session_id.bytes(),a=null;if(t.sessionCache&&(null===(a=t.sessionCache.getSession(s))?s="":(a.version.major!==i.version.major||a.version.minor>i.version.minor)&&(a=null,s="")),0===s.length&&(s=n.random.getBytes(32)),t.session.id=s,t.session.clientHelloVersion=i.version,t.session.sp={},a)t.version=t.session.version=a.version,t.session.sp=a.sp;else{for(var o,u=1;u<c.SupportedVersions.length&&!((o=c.SupportedVersions[u]).minor<=i.version.minor);++u);t.version={major:o.major,minor:o.minor},t.session.version=t.version}null!==a?(t.expect=b,t.session.resuming=!0,t.session.sp.client_random=i.random.bytes()):(t.expect=!1!==t.verifyClient?m:E,t.session.resuming=!1,c.createSecurityParameters(t,i)),t.open=!0,c.queue(t,c.createRecord(t,{type:c.ContentType.handshake,data:c.createServerHello(t)})),t.session.resuming?(c.queue(t,c.createRecord(t,{type:c.ContentType.change_cipher_spec,data:c.createChangeCipherSpec()})),t.state.pending=c.createConnectionState(t),t.state.current.write=t.state.pending.write,c.queue(t,c.createRecord(t,{type:c.ContentType.handshake,data:c.createFinished(t)}))):(c.queue(t,c.createRecord(t,{type:c.ContentType.handshake,data:c.createCertificate(t)})),t.fail||(c.queue(t,c.createRecord(t,{type:c.ContentType.handshake,data:c.createServerKeyExchange(t)})),!1!==t.verifyClient&&c.queue(t,c.createRecord(t,{type:c.ContentType.handshake,data:c.createCertificateRequest(t)})),c.queue(t,c.createRecord(t,{type:c.ContentType.handshake,data:c.createServerHelloDone(t)})))),c.flush(t),t.process()}},c.handleCertificate=function(t,e,r){if(r<3)return t.error(t,{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.illegal_parameter}});var i,s,a=e.fragment,u={certificate_list:o(a,3)},l=[];try{for(;u.certificate_list.length()>0;)i=o(u.certificate_list,3),s=n.asn1.fromDer(i),i=n.pki.certificateFromAsn1(s,!0),l.push(i)}catch(e){return t.error(t,{message:"Could not parse certificate list.",cause:e,send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.bad_certificate}})}var f=t.entity===c.ConnectionEnd.client;!f&&!0!==t.verifyClient||0!==l.length?0===l.length?t.expect=f?h:E:(f?t.session.serverCertificate=l[0]:t.session.clientCertificate=l[0],c.verifyCertificateChain(t,l)&&(t.expect=f?h:E)):t.error(t,{message:f?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.illegal_parameter}}),t.process()},c.handleServerKeyExchange=function(t,e,r){if(r>0)return t.error(t,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.unsupported_certificate}});t.expect=f,t.process()},c.handleClientKeyExchange=function(t,e,r){if(r<48)return t.error(t,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.unsupported_certificate}});var i=e.fragment,s={enc_pre_master_secret:o(i,2).getBytes()},a=null;if(t.getPrivateKey)try{a=t.getPrivateKey(t,t.session.serverCertificate),a=n.pki.privateKeyFromPem(a)}catch(e){t.error(t,{message:"Could not get private key.",cause:e,send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.internal_error}})}if(null===a)return t.error(t,{message:"No private key set.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.internal_error}});try{var u=t.session.sp;u.pre_master_secret=a.decrypt(s.enc_pre_master_secret);var l=t.session.clientHelloVersion;if(l.major!==u.pre_master_secret.charCodeAt(0)||l.minor!==u.pre_master_secret.charCodeAt(1))throw new Error("TLS version rollback attack detected.")}catch(t){u.pre_master_secret=n.random.getBytes(48)}t.expect=b,null!==t.session.clientCertificate&&(t.expect=S),t.process()},c.handleCertificateRequest=function(t,e,r){if(r<3)return t.error(t,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.illegal_parameter}});var n=e.fragment,i={certificate_types:o(n,1),certificate_authorities:o(n,2)};t.session.certificateRequest=i,t.expect=p,t.process()},c.handleCertificateVerify=function(t,e,r){if(r<2)return t.error(t,{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.illegal_parameter}});var i=e.fragment;i.read-=4;var s=i.bytes();i.read+=4;var a={signature:o(i,2).getBytes()},u=n.util.createBuffer();u.putBuffer(t.session.md5.digest()),u.putBuffer(t.session.sha1.digest()),u=u.getBytes();try{if(!t.session.clientCertificate.publicKey.verify(u,a.signature,"NONE"))throw new Error("CertificateVerify signature does not match.");t.session.md5.update(s),t.session.sha1.update(s)}catch(e){return t.error(t,{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.handshake_failure}})}t.expect=b,t.process()},c.handleServerHelloDone=function(t,e,r){if(r>0)return t.error(t,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.record_overflow}});if(null===t.serverCertificate){var i={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.insufficient_security}},s=t.verify(t,i.alert.description,0,[]);if(!0!==s)return(s||0===s)&&("object"!=typeof s||n.util.isArray(s)?"number"==typeof s&&(i.alert.description=s):(s.message&&(i.message=s.message),s.alert&&(i.alert.description=s.alert))),t.error(t,i)}null!==t.session.certificateRequest&&(e=c.createRecord(t,{type:c.ContentType.handshake,data:c.createCertificate(t)}),c.queue(t,e)),e=c.createRecord(t,{type:c.ContentType.handshake,data:c.createClientKeyExchange(t)}),c.queue(t,e),t.expect=v;var a=function(t,e){null!==t.session.certificateRequest&&null!==t.session.clientCertificate&&c.queue(t,c.createRecord(t,{type:c.ContentType.handshake,data:c.createCertificateVerify(t,e)})),c.queue(t,c.createRecord(t,{type:c.ContentType.change_cipher_spec,data:c.createChangeCipherSpec()})),t.state.pending=c.createConnectionState(t),t.state.current.write=t.state.pending.write,c.queue(t,c.createRecord(t,{type:c.ContentType.handshake,data:c.createFinished(t)})),t.expect=d,c.flush(t),t.process()};if(null===t.session.certificateRequest||null===t.session.clientCertificate)return a(t,null);c.getClientSignature(t,a)},c.handleChangeCipherSpec=function(t,e){if(1!==e.fragment.getByte())return t.error(t,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.illegal_parameter}});var r=t.entity===c.ConnectionEnd.client;(t.session.resuming&&r||!t.session.resuming&&!r)&&(t.state.pending=c.createConnectionState(t)),t.state.current.read=t.state.pending.read,(!t.session.resuming&&r||t.session.resuming&&!r)&&(t.state.pending=null),t.expect=r?g:C,t.process()},c.handleFinished=function(t,e,r){var s=e.fragment;s.read-=4;var a=s.bytes();s.read+=4;var o=e.fragment.getBytes();(s=n.util.createBuffer()).putBuffer(t.session.md5.digest()),s.putBuffer(t.session.sha1.digest());var u=t.entity===c.ConnectionEnd.client,l=u?"server finished":"client finished",h=t.session.sp;if((s=i(h.master_secret,l,s.getBytes(),12)).getBytes()!==o)return t.error(t,{message:"Invalid verify_data in Finished message.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.decrypt_error}});t.session.md5.update(a),t.session.sha1.update(a),(t.session.resuming&&u||!t.session.resuming&&!u)&&(c.queue(t,c.createRecord(t,{type:c.ContentType.change_cipher_spec,data:c.createChangeCipherSpec()})),t.state.current.write=t.state.pending.write,t.state.pending=null,c.queue(t,c.createRecord(t,{type:c.ContentType.handshake,data:c.createFinished(t)}))),t.expect=u?y:A,t.handshaking=!1,++t.handshakes,t.peerCertificate=u?t.session.serverCertificate:t.session.clientCertificate,c.flush(t),t.isConnected=!0,t.connected(t),t.process()},c.handleAlert=function(t,e){var r,n=e.fragment,i={level:n.getByte(),description:n.getByte()};switch(i.description){case c.Alert.Description.close_notify:r="Connection closed.";break;case c.Alert.Description.unexpected_message:r="Unexpected message.";break;case c.Alert.Description.bad_record_mac:r="Bad record MAC.";break;case c.Alert.Description.decryption_failed:r="Decryption failed.";break;case c.Alert.Description.record_overflow:r="Record overflow.";break;case c.Alert.Description.decompression_failure:r="Decompression failed.";break;case c.Alert.Description.handshake_failure:r="Handshake failure.";break;case c.Alert.Description.bad_certificate:r="Bad certificate.";break;case c.Alert.Description.unsupported_certificate:r="Unsupported certificate.";break;case c.Alert.Description.certificate_revoked:r="Certificate revoked.";break;case c.Alert.Description.certificate_expired:r="Certificate expired.";break;case c.Alert.Description.certificate_unknown:r="Certificate unknown.";break;case c.Alert.Description.illegal_parameter:r="Illegal parameter.";break;case c.Alert.Description.unknown_ca:r="Unknown certificate authority.";break;case c.Alert.Description.access_denied:r="Access denied.";break;case c.Alert.Description.decode_error:r="Decode error.";break;case c.Alert.Description.decrypt_error:r="Decrypt error.";break;case c.Alert.Description.export_restriction:r="Export restriction.";break;case c.Alert.Description.protocol_version:r="Unsupported protocol version.";break;case c.Alert.Description.insufficient_security:r="Insufficient security.";break;case c.Alert.Description.internal_error:r="Internal error.";break;case c.Alert.Description.user_canceled:r="User canceled.";break;case c.Alert.Description.no_renegotiation:r="Renegotiation not supported.";break;default:r="Unknown error."}if(i.description===c.Alert.Description.close_notify)return t.close();t.error(t,{message:r,send:!1,origin:t.entity===c.ConnectionEnd.client?"server":"client",alert:i}),t.process()},c.handleHandshake=function(t,e){var r=e.fragment,i=r.getByte(),s=r.getInt24();if(s>r.length())return t.fragmented=e,e.fragment=n.util.createBuffer(),r.read-=4,t.process();t.fragmented=null,r.read-=4;var a=r.bytes(s+4);r.read+=4,i in U[t.entity][t.expect]?(t.entity!==c.ConnectionEnd.server||t.open||t.fail||(t.handshaking=!0,t.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,md5:n.md.md5.create(),sha1:n.md.sha1.create()}),i!==c.HandshakeType.hello_request&&i!==c.HandshakeType.certificate_verify&&i!==c.HandshakeType.finished&&(t.session.md5.update(a),t.session.sha1.update(a)),U[t.entity][t.expect][i](t,e,s)):c.handleUnexpected(t,e)},c.handleApplicationData=function(t,e){t.data.putBuffer(e.fragment),t.dataReady(t),t.process()},c.handleHeartbeat=function(t,e){var r=e.fragment,i=r.getByte(),s=r.getInt16(),a=r.getBytes(s);if(i===c.HeartbeatMessageType.heartbeat_request){if(t.handshaking||s>a.length)return t.process();c.queue(t,c.createRecord(t,{type:c.ContentType.heartbeat,data:c.createHeartbeat(c.HeartbeatMessageType.heartbeat_response,a)})),c.flush(t)}else if(i===c.HeartbeatMessageType.heartbeat_response){if(a!==t.expectedHeartbeatPayload)return t.process();t.heartbeatReceived&&t.heartbeatReceived(t,n.util.createBuffer(a))}t.process()};var l=1,h=2,f=3,p=4,d=5,g=6,y=7,v=8,m=1,E=2,S=3,b=4,C=5,A=6,w=c.handleUnexpected,x=c.handleChangeCipherSpec,B=c.handleAlert,I=c.handleHandshake,T=c.handleApplicationData,F=c.handleHeartbeat,R=[];R[c.ConnectionEnd.client]=[[w,B,I,w,F],[w,B,I,w,F],[w,B,I,w,F],[w,B,I,w,F],[w,B,I,w,F],[x,B,w,w,F],[w,B,I,w,F],[w,B,I,T,F],[w,B,I,w,F]],R[c.ConnectionEnd.server]=[[w,B,I,w,F],[w,B,I,w,F],[w,B,I,w,F],[w,B,I,w,F],[x,B,w,w,F],[w,B,I,w,F],[w,B,I,T,F],[w,B,I,w,F]];var N=c.handleHelloRequest,D=c.handleServerHello,P=c.handleCertificate,k=c.handleServerKeyExchange,L=c.handleCertificateRequest,O=c.handleServerHelloDone,_=c.handleFinished,U=[];U[c.ConnectionEnd.client]=[[w,w,D,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w],[N,w,w,w,w,w,w,w,w,w,w,P,k,L,O,w,w,w,w,w,w],[N,w,w,w,w,w,w,w,w,w,w,w,k,L,O,w,w,w,w,w,w],[N,w,w,w,w,w,w,w,w,w,w,w,w,L,O,w,w,w,w,w,w],[N,w,w,w,w,w,w,w,w,w,w,w,w,w,O,w,w,w,w,w,w],[N,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w],[N,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,_],[N,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w],[N,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w]];var V=c.handleClientHello,H=c.handleClientKeyExchange,K=c.handleCertificateVerify;U[c.ConnectionEnd.server]=[[w,V,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w],[w,w,w,w,w,w,w,w,w,w,w,P,w,w,w,w,w,w,w,w,w],[w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,H,w,w,w,w],[w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,K,w,w,w,w,w],[w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w],[w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,_],[w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w],[w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w,w]],c.generateKeys=function(t,e){var r=i,n=e.client_random+e.server_random;t.session.resuming||(e.master_secret=r(e.pre_master_secret,"master secret",n,48).bytes(),e.pre_master_secret=null),n=e.server_random+e.client_random;var s=2*e.mac_key_length+2*e.enc_key_length,a=t.version.major===c.Versions.TLS_1_0.major&&t.version.minor===c.Versions.TLS_1_0.minor;a&&(s+=2*e.fixed_iv_length);var o=r(e.master_secret,"key expansion",n,s),u={client_write_MAC_key:o.getBytes(e.mac_key_length),server_write_MAC_key:o.getBytes(e.mac_key_length),client_write_key:o.getBytes(e.enc_key_length),server_write_key:o.getBytes(e.enc_key_length)};return a&&(u.client_write_IV=o.getBytes(e.fixed_iv_length),u.server_write_IV=o.getBytes(e.fixed_iv_length)),u},c.createConnectionState=function(t){var e=t.entity===c.ConnectionEnd.client,r=function(){var t={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(t){return!0},compressionState:null,compressFunction:function(t){return!0},updateSequenceNumber:function(){4294967295===t.sequenceNumber[1]?(t.sequenceNumber[1]=0,++t.sequenceNumber[0]):++t.sequenceNumber[1]}};return t},n={read:r(),write:r()};if(n.read.update=function(t,e){return n.read.cipherFunction(e,n.read)?n.read.compressFunction(t,e,n.read)||t.error(t,{message:"Could not decompress record.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.decompression_failure}}):t.error(t,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.bad_record_mac}}),!t.fail},n.write.update=function(t,e){return n.write.compressFunction(t,e,n.write)?n.write.cipherFunction(e,n.write)||t.error(t,{message:"Could not encrypt record.",send:!1,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.internal_error}}):t.error(t,{message:"Could not compress record.",send:!1,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.internal_error}}),!t.fail},t.session){var i=t.session.sp;switch(t.session.cipherSuite.initSecurityParameters(i),i.keys=c.generateKeys(t,i),n.read.macKey=e?i.keys.server_write_MAC_key:i.keys.client_write_MAC_key,n.write.macKey=e?i.keys.client_write_MAC_key:i.keys.server_write_MAC_key,t.session.cipherSuite.initConnectionState(n,t,i),i.compression_algorithm){case c.CompressionMethod.none:break;case c.CompressionMethod.deflate:n.read.compressFunction=a,n.write.compressFunction=s;break;default:throw new Error("Unsupported compression algorithm.")}}return n},c.createRandom=function(){var t=new Date,e=+t+6e4*t.getTimezoneOffset(),r=n.util.createBuffer();return r.putInt32(e),r.putBytes(n.random.getBytes(28)),r},c.createRecord=function(t,e){return e.data?{type:e.type,version:{major:t.version.major,minor:t.version.minor},length:e.data.length(),fragment:e.data}:null},c.createAlert=function(t,e){var r=n.util.createBuffer();return r.putByte(e.level),r.putByte(e.description),c.createRecord(t,{type:c.ContentType.alert,data:r})},c.createClientHello=function(t){t.session.clientHelloVersion={major:t.version.major,minor:t.version.minor};for(var e=n.util.createBuffer(),r=0;r<t.cipherSuites.length;++r){var i=t.cipherSuites[r];e.putByte(i.id[0]),e.putByte(i.id[1])}var s=e.length(),a=n.util.createBuffer();a.putByte(c.CompressionMethod.none);var o=a.length(),l=n.util.createBuffer();if(t.virtualHost){var h=n.util.createBuffer();h.putByte(0),h.putByte(0);var f=n.util.createBuffer();f.putByte(0),u(f,2,n.util.createBuffer(t.virtualHost));var p=n.util.createBuffer();u(p,2,f),u(h,2,p),l.putBuffer(h)}var d=l.length();d>0&&(d+=2);var g=t.session.id,y=g.length+1+2+4+28+2+s+1+o+d,v=n.util.createBuffer();return v.putByte(c.HandshakeType.client_hello),v.putInt24(y),v.putByte(t.version.major),v.putByte(t.version.minor),v.putBytes(t.session.sp.client_random),u(v,1,n.util.createBuffer(g)),u(v,2,e),u(v,1,a),d>0&&u(v,2,l),v},c.createServerHello=function(t){var e=t.session.id,r=e.length+1+2+4+28+2+1,i=n.util.createBuffer();return i.putByte(c.HandshakeType.server_hello),i.putInt24(r),i.putByte(t.version.major),i.putByte(t.version.minor),i.putBytes(t.session.sp.server_random),u(i,1,n.util.createBuffer(e)),i.putByte(t.session.cipherSuite.id[0]),i.putByte(t.session.cipherSuite.id[1]),i.putByte(t.session.compressionMethod),i},c.createCertificate=function(t){var e,r=t.entity===c.ConnectionEnd.client,i=null;t.getCertificate&&(e=r?t.session.certificateRequest:t.session.extensions.server_name.serverNameList,i=t.getCertificate(t,e));var s=n.util.createBuffer();if(null!==i)try{n.util.isArray(i)||(i=[i]);for(var a=null,o=0;o<i.length;++o){var l=n.pem.decode(i[o])[0];if("CERTIFICATE"!==l.type&&"X509 CERTIFICATE"!==l.type&&"TRUSTED CERTIFICATE"!==l.type){var h=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw h.headerType=l.type,h}if(l.procType&&"ENCRYPTED"===l.procType.type)throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var f=n.util.createBuffer(l.body);null===a&&(a=n.asn1.fromDer(f.bytes(),!1));var p=n.util.createBuffer();u(p,3,f),s.putBuffer(p)}i=n.pki.certificateFromAsn1(a),r?t.session.clientCertificate=i:t.session.serverCertificate=i}catch(e){return t.error(t,{message:"Could not send certificate list.",cause:e,send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.bad_certificate}})}var d=3+s.length(),g=n.util.createBuffer();return g.putByte(c.HandshakeType.certificate),g.putInt24(d),u(g,3,s),g},c.createClientKeyExchange=function(t){var e=n.util.createBuffer();e.putByte(t.session.clientHelloVersion.major),e.putByte(t.session.clientHelloVersion.minor),e.putBytes(n.random.getBytes(46));var r=t.session.sp;r.pre_master_secret=e.getBytes();var i=(e=t.session.serverCertificate.publicKey.encrypt(r.pre_master_secret)).length+2,s=n.util.createBuffer();return s.putByte(c.HandshakeType.client_key_exchange),s.putInt24(i),s.putInt16(e.length),s.putBytes(e),s},c.createServerKeyExchange=function(t){return n.util.createBuffer()},c.getClientSignature=function(t,e){var r=n.util.createBuffer();r.putBuffer(t.session.md5.digest()),r.putBuffer(t.session.sha1.digest()),r=r.getBytes(),t.getSignature=t.getSignature||function(t,e,r){var i=null;if(t.getPrivateKey)try{i=t.getPrivateKey(t,t.session.clientCertificate),i=n.pki.privateKeyFromPem(i)}catch(e){t.error(t,{message:"Could not get private key.",cause:e,send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.internal_error}})}null===i?t.error(t,{message:"No private key set.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.internal_error}}):e=i.sign(e,null),r(t,e)},t.getSignature(t,r,e)},c.createCertificateVerify=function(t,e){var r=e.length+2,i=n.util.createBuffer();return i.putByte(c.HandshakeType.certificate_verify),i.putInt24(r),i.putInt16(e.length),i.putBytes(e),i},c.createCertificateRequest=function(t){var e=n.util.createBuffer();e.putByte(1);var r=n.util.createBuffer();for(var i in t.caStore.certs){var s=t.caStore.certs[i],a=n.pki.distinguishedNameToAsn1(s.subject),o=n.asn1.toDer(a);r.putInt16(o.length()),r.putBuffer(o)}var l=1+e.length()+2+r.length(),h=n.util.createBuffer();return h.putByte(c.HandshakeType.certificate_request),h.putInt24(l),u(h,1,e),u(h,2,r),h},c.createServerHelloDone=function(t){var e=n.util.createBuffer();return e.putByte(c.HandshakeType.server_hello_done),e.putInt24(0),e},c.createChangeCipherSpec=function(){var t=n.util.createBuffer();return t.putByte(1),t},c.createFinished=function(t){var e=n.util.createBuffer();e.putBuffer(t.session.md5.digest()),e.putBuffer(t.session.sha1.digest());var r=t.entity===c.ConnectionEnd.client,s=t.session.sp,a=r?"client finished":"server finished";e=i(s.master_secret,a,e.getBytes(),12);var o=n.util.createBuffer();return o.putByte(c.HandshakeType.finished),o.putInt24(e.length()),o.putBuffer(e),o},c.createHeartbeat=function(t,e,r){void 0===r&&(r=e.length);var i=n.util.createBuffer();i.putByte(t),i.putInt16(r),i.putBytes(e);var s=i.length(),a=Math.max(16,s-r-3);return i.putBytes(n.random.getBytes(a)),i},c.queue=function(t,e){if(e&&(0!==e.fragment.length()||e.type!==c.ContentType.handshake&&e.type!==c.ContentType.alert&&e.type!==c.ContentType.change_cipher_spec)){if(e.type===c.ContentType.handshake){var r=e.fragment.bytes();t.session.md5.update(r),t.session.sha1.update(r),r=null}var i;if(e.fragment.length()<=c.MaxFragment)i=[e];else{i=[];for(var s=e.fragment.bytes();s.length>c.MaxFragment;)i.push(c.createRecord(t,{type:e.type,data:n.util.createBuffer(s.slice(0,c.MaxFragment))})),s=s.slice(c.MaxFragment);s.length>0&&i.push(c.createRecord(t,{type:e.type,data:n.util.createBuffer(s)}))}for(var a=0;a<i.length&&!t.fail;++a){var o=i[a];t.state.current.write.update(t,o)&&t.records.push(o)}}},c.flush=function(t){for(var e=0;e<t.records.length;++e){var r=t.records[e];t.tlsData.putByte(r.type),t.tlsData.putByte(r.version.major),t.tlsData.putByte(r.version.minor),t.tlsData.putInt16(r.fragment.length()),t.tlsData.putBuffer(t.records[e].fragment)}return t.records=[],t.tlsDataReady(t)};var j=function(t){switch(t){case!0:return!0;case n.pki.certificateError.bad_certificate:return c.Alert.Description.bad_certificate;case n.pki.certificateError.unsupported_certificate:return c.Alert.Description.unsupported_certificate;case n.pki.certificateError.certificate_revoked:return c.Alert.Description.certificate_revoked;case n.pki.certificateError.certificate_expired:return c.Alert.Description.certificate_expired;case n.pki.certificateError.certificate_unknown:return c.Alert.Description.certificate_unknown;case n.pki.certificateError.unknown_ca:return c.Alert.Description.unknown_ca;default:return c.Alert.Description.bad_certificate}};for(var M in c.verifyCertificateChain=function(t,e){try{var r={};for(var i in t.verifyOptions)r[i]=t.verifyOptions[i];r.verify=function(e,r,i){j(e);var s=t.verify(t,e,r,i);if(!0!==s){if("object"==typeof s&&!n.util.isArray(s)){var a=new Error("The application rejected the certificate.");throw a.send=!0,a.alert={level:c.Alert.Level.fatal,description:c.Alert.Description.bad_certificate},s.message&&(a.message=s.message),s.alert&&(a.alert.description=s.alert),a}s!==e&&(s=function(t){switch(t){case!0:return!0;case c.Alert.Description.bad_certificate:return n.pki.certificateError.bad_certificate;case c.Alert.Description.unsupported_certificate:return n.pki.certificateError.unsupported_certificate;case c.Alert.Description.certificate_revoked:return n.pki.certificateError.certificate_revoked;case c.Alert.Description.certificate_expired:return n.pki.certificateError.certificate_expired;case c.Alert.Description.certificate_unknown:return n.pki.certificateError.certificate_unknown;case c.Alert.Description.unknown_ca:return n.pki.certificateError.unknown_ca;default:return n.pki.certificateError.bad_certificate}}(s))}return s},n.pki.verifyCertificateChain(t.caStore,e,r)}catch(e){var s=e;("object"!=typeof s||n.util.isArray(s))&&(s={send:!0,alert:{level:c.Alert.Level.fatal,description:j(e)}}),"send"in s||(s.send=!0),"alert"in s||(s.alert={level:c.Alert.Level.fatal,description:j(s.error)}),t.error(t,s)}return!t.fail},c.createSessionCache=function(t,e){var r=null;if(t&&t.getSession&&t.setSession&&t.order)r=t;else{for(var i in(r={}).cache=t||{},r.capacity=Math.max(e||100,1),r.order=[],t)r.order.length<=e?r.order.push(i):delete t[i];r.getSession=function(t){var e=null,i=null;if(t?i=n.util.bytesToHex(t):r.order.length>0&&(i=r.order[0]),null!==i&&i in r.cache)for(var s in e=r.cache[i],delete r.cache[i],r.order)if(r.order[s]===i){r.order.splice(s,1);break}return e},r.setSession=function(t,e){if(r.order.length===r.capacity){var i=r.order.shift();delete r.cache[i]}i=n.util.bytesToHex(t),r.order.push(i),r.cache[i]=e}}return r},c.createConnection=function(t){var e;e=t.caStore?n.util.isArray(t.caStore)?n.pki.createCaStore(t.caStore):t.caStore:n.pki.createCaStore();var r=t.cipherSuites||null;if(null===r)for(var i in r=[],c.CipherSuites)r.push(c.CipherSuites[i]);var s=t.server?c.ConnectionEnd.server:c.ConnectionEnd.client,a=t.sessionCache?c.createSessionCache(t.sessionCache):null,o={version:{major:c.Version.major,minor:c.Version.minor},entity:s,sessionId:t.sessionId,caStore:e,sessionCache:a,cipherSuites:r,connected:t.connected,virtualHost:t.virtualHost||null,verifyClient:t.verifyClient||!1,verify:t.verify||function(t,e,r,n){return e},verifyOptions:t.verifyOptions||{},getCertificate:t.getCertificate||null,getPrivateKey:t.getPrivateKey||null,getSignature:t.getSignature||null,input:n.util.createBuffer(),tlsData:n.util.createBuffer(),data:n.util.createBuffer(),tlsDataReady:t.tlsDataReady,dataReady:t.dataReady,heartbeatReceived:t.heartbeatReceived,closed:t.closed,error:function(e,r){r.origin=r.origin||(e.entity===c.ConnectionEnd.client?"client":"server"),r.send&&(c.queue(e,c.createAlert(e,r.alert)),c.flush(e));var n=!1!==r.fatal;n&&(e.fail=!0),t.error(e,r),n&&e.close(!1)},deflate:t.deflate||null,inflate:t.inflate||null,reset:function(t){o.version={major:c.Version.major,minor:c.Version.minor},o.record=null,o.session=null,o.peerCertificate=null,o.state={pending:null,current:null},o.expect=(o.entity,c.ConnectionEnd.client,0),o.fragmented=null,o.records=[],o.open=!1,o.handshakes=0,o.handshaking=!1,o.isConnected=!1,o.fail=!(t||void 0===t),o.input.clear(),o.tlsData.clear(),o.data.clear(),o.state.current=c.createConnectionState(o)}};return o.reset(),o.handshake=function(t){if(o.entity!==c.ConnectionEnd.client)o.error(o,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(o.handshaking)o.error(o,{message:"Handshake already in progress.",fatal:!1});else{o.fail&&!o.open&&0===o.handshakes&&(o.fail=!1),o.handshaking=!0;var e=null;(t=t||"").length>0&&(o.sessionCache&&(e=o.sessionCache.getSession(t)),null===e&&(t="")),0===t.length&&o.sessionCache&&null!==(e=o.sessionCache.getSession())&&(t=e.id),o.session={id:t,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:n.md.md5.create(),sha1:n.md.sha1.create()},e&&(o.version=e.version,o.session.sp=e.sp),o.session.sp.client_random=c.createRandom().getBytes(),o.open=!0,c.queue(o,c.createRecord(o,{type:c.ContentType.handshake,data:c.createClientHello(o)})),c.flush(o)}},o.process=function(t){var e=0;return t&&o.input.putBytes(t),o.fail||(null!==o.record&&o.record.ready&&o.record.fragment.isEmpty()&&(o.record=null),null===o.record&&(e=function(t){var e=0,r=t.input,i=r.length();if(i<5)e=5-i;else{t.record={type:r.getByte(),version:{major:r.getByte(),minor:r.getByte()},length:r.getInt16(),fragment:n.util.createBuffer(),ready:!1};var s=t.record.version.major===t.version.major;s&&t.session&&t.session.version&&(s=t.record.version.minor===t.version.minor),s||t.error(t,{message:"Incompatible TLS version.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.protocol_version}})}return e}(o)),o.fail||null===o.record||o.record.ready||(e=function(t){var e=0,r=t.input,n=r.length();return n<t.record.length?e=t.record.length-n:(t.record.fragment.putBytes(r.getBytes(t.record.length)),r.compact(),t.state.current.read.update(t,t.record)&&(null!==t.fragmented&&(t.fragmented.type===t.record.type?(t.fragmented.fragment.putBuffer(t.record.fragment),t.record=t.fragmented):t.error(t,{message:"Invalid fragmented record.",send:!0,alert:{level:c.Alert.Level.fatal,description:c.Alert.Description.unexpected_message}})),t.record.ready=!0)),e}(o)),!o.fail&&null!==o.record&&o.record.ready&&function(t,e){var r=e.type-c.ContentType.change_cipher_spec,n=R[t.entity][t.expect];r in n?n[r](t,e):c.handleUnexpected(t,e)}(o,o.record)),e},o.prepare=function(t){return c.queue(o,c.createRecord(o,{type:c.ContentType.application_data,data:n.util.createBuffer(t)})),c.flush(o)},o.prepareHeartbeatRequest=function(t,e){return t instanceof n.util.ByteBuffer&&(t=t.bytes()),void 0===e&&(e=t.length),o.expectedHeartbeatPayload=t,c.queue(o,c.createRecord(o,{type:c.ContentType.heartbeat,data:c.createHeartbeat(c.HeartbeatMessageType.heartbeat_request,t,e)})),c.flush(o)},o.close=function(t){if(!o.fail&&o.sessionCache&&o.session){var e={id:o.session.id,version:o.session.version,sp:o.session.sp};e.sp.keys=null,o.sessionCache.setSession(e.id,e)}o.open&&(o.open=!1,o.input.clear(),(o.isConnected||o.handshaking)&&(o.isConnected=o.handshaking=!1,c.queue(o,c.createAlert(o,{level:c.Alert.Level.warning,description:c.Alert.Description.close_notify})),c.flush(o)),o.closed(o)),o.reset(t)},o},t.exports=n.tls=n.tls||{},c)"function"!=typeof c[M]&&(n.tls[M]=c[M]);n.tls.prf_tls1=i,n.tls.hmac_sha1=function(t,e,r){var i=n.hmac.create();i.start("SHA1",t);var s=n.util.createBuffer();return s.putInt32(e[0]),s.putInt32(e[1]),s.putByte(r.type),s.putByte(r.version.major),s.putByte(r.version.minor),s.putInt16(r.length),s.putBytes(r.fragment.bytes()),i.update(s.getBytes()),i.digest().getBytes()},n.tls.createSessionCache=c.createSessionCache,n.tls.createConnection=c.createConnection},18736:(t,e,r)=>{var n=r(80628),i=r(19024).Buffer,s=r(91080),a=r(584),o=t.exports=s.util=s.util||{};function u(t){if(8!==t&&16!==t&&24!==t&&32!==t)throw new Error("Only 8, 16, 24, or 32 bits supported: "+t)}function c(t){if(this.data="",this.read=0,"string"==typeof t)this.data=t;else if(o.isArrayBuffer(t)||o.isArrayBufferView(t))if(void 0!==i&&t instanceof i)this.data=t.toString("binary");else{var e=new Uint8Array(t);try{this.data=String.fromCharCode.apply(null,e)}catch(t){for(var r=0;r<e.length;++r)this.putByte(e[r])}}else(t instanceof c||"object"==typeof t&&"string"==typeof t.data&&"number"==typeof t.read)&&(this.data=t.data,this.read=t.read);this._constructedStringLength=0}!function(){if(void 0!==n&&n.nextTick,"function"==typeof setImmediate)return o.setImmediate=function(){return setImmediate.apply(void 0,arguments)},void(o.nextTick=function(t){return setImmediate(t)});if(o.setImmediate=function(t){setTimeout(t,0)},"undefined"!=typeof window&&"function"==typeof window.postMessage){var t="forge.setImmediate",e=[];o.setImmediate=function(r){e.push(r),1===e.length&&window.postMessage(t,"*")},window.addEventListener("message",(function(r){if(r.source===window&&r.data===t){r.stopPropagation();var n=e.slice();e.length=0,n.forEach((function(t){t()}))}}),!0)}if("undefined"!=typeof MutationObserver){var r=Date.now(),i=!0,s=document.createElement("div");e=[],new MutationObserver((function(){var t=e.slice();e.length=0,t.forEach((function(t){t()}))})).observe(s,{attributes:!0});var a=o.setImmediate;o.setImmediate=function(t){Date.now()-r>15?(r=Date.now(),a(t)):(e.push(t),1===e.length&&s.setAttribute("a",i=!i))}}o.nextTick=o.setImmediate}(),o.isNodejs=void 0!==n&&n.versions&&n.versions.node,o.globalScope=o.isNodejs?r.g:"undefined"==typeof self?window:self,o.isArray=Array.isArray||function(t){return"[object Array]"===Object.prototype.toString.call(t)},o.isArrayBuffer=function(t){return"undefined"!=typeof ArrayBuffer&&t instanceof ArrayBuffer},o.isArrayBufferView=function(t){return t&&o.isArrayBuffer(t.buffer)&&void 0!==t.byteLength},o.ByteBuffer=c,o.ByteStringBuffer=c,o.ByteStringBuffer.prototype._optimizeConstructedString=function(t){this._constructedStringLength+=t,this._constructedStringLength>4096&&(this.data.substr(0,1),this._constructedStringLength=0)},o.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read},o.ByteStringBuffer.prototype.isEmpty=function(){return this.length()<=0},o.ByteStringBuffer.prototype.putByte=function(t){return this.putBytes(String.fromCharCode(t))},o.ByteStringBuffer.prototype.fillWithByte=function(t,e){t=String.fromCharCode(t);for(var r=this.data;e>0;)1&e&&(r+=t),(e>>>=1)>0&&(t+=t);return this.data=r,this._optimizeConstructedString(e),this},o.ByteStringBuffer.prototype.putBytes=function(t){return this.data+=t,this._optimizeConstructedString(t.length),this},o.ByteStringBuffer.prototype.putString=function(t){return this.putBytes(o.encodeUtf8(t))},o.ByteStringBuffer.prototype.putInt16=function(t){return this.putBytes(String.fromCharCode(t>>8&255)+String.fromCharCode(255&t))},o.ByteStringBuffer.prototype.putInt24=function(t){return this.putBytes(String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(255&t))},o.ByteStringBuffer.prototype.putInt32=function(t){return this.putBytes(String.fromCharCode(t>>24&255)+String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(255&t))},o.ByteStringBuffer.prototype.putInt16Le=function(t){return this.putBytes(String.fromCharCode(255&t)+String.fromCharCode(t>>8&255))},o.ByteStringBuffer.prototype.putInt24Le=function(t){return this.putBytes(String.fromCharCode(255&t)+String.fromCharCode(t>>8&255)+String.fromCharCode(t>>16&255))},o.ByteStringBuffer.prototype.putInt32Le=function(t){return this.putBytes(String.fromCharCode(255&t)+String.fromCharCode(t>>8&255)+String.fromCharCode(t>>16&255)+String.fromCharCode(t>>24&255))},o.ByteStringBuffer.prototype.putInt=function(t,e){u(e);var r="";do{e-=8,r+=String.fromCharCode(t>>e&255)}while(e>0);return this.putBytes(r)},o.ByteStringBuffer.prototype.putSignedInt=function(t,e){return t<0&&(t+=2<<e-1),this.putInt(t,e)},o.ByteStringBuffer.prototype.putBuffer=function(t){return this.putBytes(t.getBytes())},o.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)},o.ByteStringBuffer.prototype.getInt16=function(){var t=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);return this.read+=2,t},o.ByteStringBuffer.prototype.getInt24=function(){var t=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);return this.read+=3,t},o.ByteStringBuffer.prototype.getInt32=function(){var t=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,t},o.ByteStringBuffer.prototype.getInt16Le=function(){var t=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;return this.read+=2,t},o.ByteStringBuffer.prototype.getInt24Le=function(){var t=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;return this.read+=3,t},o.ByteStringBuffer.prototype.getInt32Le=function(){var t=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,t},o.ByteStringBuffer.prototype.getInt=function(t){u(t);var e=0;do{e=(e<<8)+this.data.charCodeAt(this.read++),t-=8}while(t>0);return e},o.ByteStringBuffer.prototype.getSignedInt=function(t){var e=this.getInt(t),r=2<<t-2;return e>=r&&(e-=r<<1),e},o.ByteStringBuffer.prototype.getBytes=function(t){var e;return t?(t=Math.min(this.length(),t),e=this.data.slice(this.read,this.read+t),this.read+=t):0===t?e="":(e=0===this.read?this.data:this.data.slice(this.read),this.clear()),e},o.ByteStringBuffer.prototype.bytes=function(t){return void 0===t?this.data.slice(this.read):this.data.slice(this.read,this.read+t)},o.ByteStringBuffer.prototype.at=function(t){return this.data.charCodeAt(this.read+t)},o.ByteStringBuffer.prototype.setAt=function(t,e){return this.data=this.data.substr(0,this.read+t)+String.fromCharCode(e)+this.data.substr(this.read+t+1),this},o.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-1)},o.ByteStringBuffer.prototype.copy=function(){var t=o.createBuffer(this.data);return t.read=this.read,t},o.ByteStringBuffer.prototype.compact=function(){return this.read>0&&(this.data=this.data.slice(this.read),this.read=0),this},o.ByteStringBuffer.prototype.clear=function(){return this.data="",this.read=0,this},o.ByteStringBuffer.prototype.truncate=function(t){var e=Math.max(0,this.length()-t);return this.data=this.data.substr(this.read,e),this.read=0,this},o.ByteStringBuffer.prototype.toHex=function(){for(var t="",e=this.read;e<this.data.length;++e){var r=this.data.charCodeAt(e);r<16&&(t+="0"),t+=r.toString(16)}return t},o.ByteStringBuffer.prototype.toString=function(){return o.decodeUtf8(this.bytes())},o.DataBuffer=function(t,e){e=e||{},this.read=e.readOffset||0,this.growSize=e.growSize||1024;var r=o.isArrayBuffer(t),n=o.isArrayBufferView(t);if(r||n)return this.data=r?new DataView(t):new DataView(t.buffer,t.byteOffset,t.byteLength),void(this.write="writeOffset"in e?e.writeOffset:this.data.byteLength);this.data=new DataView(new ArrayBuffer(0)),this.write=0,null!=t&&this.putBytes(t),"writeOffset"in e&&(this.write=e.writeOffset)},o.DataBuffer.prototype.length=function(){return this.write-this.read},o.DataBuffer.prototype.isEmpty=function(){return this.length()<=0},o.DataBuffer.prototype.accommodate=function(t,e){if(this.length()>=t)return this;e=Math.max(e||this.growSize,t);var r=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength),n=new Uint8Array(this.length()+e);return n.set(r),this.data=new DataView(n.buffer),this},o.DataBuffer.prototype.putByte=function(t){return this.accommodate(1),this.data.setUint8(this.write++,t),this},o.DataBuffer.prototype.fillWithByte=function(t,e){this.accommodate(e);for(var r=0;r<e;++r)this.data.setUint8(t);return this},o.DataBuffer.prototype.putBytes=function(t,e){if(o.isArrayBufferView(t)){var r=(n=new Uint8Array(t.buffer,t.byteOffset,t.byteLength)).byteLength-n.byteOffset;return this.accommodate(r),new Uint8Array(this.data.buffer,this.write).set(n),this.write+=r,this}if(o.isArrayBuffer(t)){var n=new Uint8Array(t);return this.accommodate(n.byteLength),new Uint8Array(this.data.buffer).set(n,this.write),this.write+=n.byteLength,this}if(t instanceof o.DataBuffer||"object"==typeof t&&"number"==typeof t.read&&"number"==typeof t.write&&o.isArrayBufferView(t.data))return n=new Uint8Array(t.data.byteLength,t.read,t.length()),this.accommodate(n.byteLength),new Uint8Array(t.data.byteLength,this.write).set(n),this.write+=n.byteLength,this;if(t instanceof o.ByteStringBuffer&&(t=t.data,e="binary"),e=e||"binary","string"==typeof t){var i;if("hex"===e)return this.accommodate(Math.ceil(t.length/2)),i=new Uint8Array(this.data.buffer,this.write),this.write+=o.binary.hex.decode(t,i,this.write),this;if("base64"===e)return this.accommodate(3*Math.ceil(t.length/4)),i=new Uint8Array(this.data.buffer,this.write),this.write+=o.binary.base64.decode(t,i,this.write),this;if("utf8"===e&&(t=o.encodeUtf8(t),e="binary"),"binary"===e||"raw"===e)return this.accommodate(t.length),i=new Uint8Array(this.data.buffer,this.write),this.write+=o.binary.raw.decode(i),this;if("utf16"===e)return this.accommodate(2*t.length),i=new Uint16Array(this.data.buffer,this.write),this.write+=o.text.utf16.encode(i),this;throw new Error("Invalid encoding: "+e)}throw Error("Invalid parameter: "+t)},o.DataBuffer.prototype.putBuffer=function(t){return this.putBytes(t),t.clear(),this},o.DataBuffer.prototype.putString=function(t){return this.putBytes(t,"utf16")},o.DataBuffer.prototype.putInt16=function(t){return this.accommodate(2),this.data.setInt16(this.write,t),this.write+=2,this},o.DataBuffer.prototype.putInt24=function(t){return this.accommodate(3),this.data.setInt16(this.write,t>>8&65535),this.data.setInt8(this.write,t>>16&255),this.write+=3,this},o.DataBuffer.prototype.putInt32=function(t){return this.accommodate(4),this.data.setInt32(this.write,t),this.write+=4,this},o.DataBuffer.prototype.putInt16Le=function(t){return this.accommodate(2),this.data.setInt16(this.write,t,!0),this.write+=2,this},o.DataBuffer.prototype.putInt24Le=function(t){return this.accommodate(3),this.data.setInt8(this.write,t>>16&255),this.data.setInt16(this.write,t>>8&65535,!0),this.write+=3,this},o.DataBuffer.prototype.putInt32Le=function(t){return this.accommodate(4),this.data.setInt32(this.write,t,!0),this.write+=4,this},o.DataBuffer.prototype.putInt=function(t,e){u(e),this.accommodate(e/8);do{e-=8,this.data.setInt8(this.write++,t>>e&255)}while(e>0);return this},o.DataBuffer.prototype.putSignedInt=function(t,e){return u(e),this.accommodate(e/8),t<0&&(t+=2<<e-1),this.putInt(t,e)},o.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)},o.DataBuffer.prototype.getInt16=function(){var t=this.data.getInt16(this.read);return this.read+=2,t},o.DataBuffer.prototype.getInt24=function(){var t=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);return this.read+=3,t},o.DataBuffer.prototype.getInt32=function(){var t=this.data.getInt32(this.read);return this.read+=4,t},o.DataBuffer.prototype.getInt16Le=function(){var t=this.data.getInt16(this.read,!0);return this.read+=2,t},o.DataBuffer.prototype.getInt24Le=function(){var t=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;return this.read+=3,t},o.DataBuffer.prototype.getInt32Le=function(){var t=this.data.getInt32(this.read,!0);return this.read+=4,t},o.DataBuffer.prototype.getInt=function(t){u(t);var e=0;do{e=(e<<8)+this.data.getInt8(this.read++),t-=8}while(t>0);return e},o.DataBuffer.prototype.getSignedInt=function(t){var e=this.getInt(t),r=2<<t-2;return e>=r&&(e-=r<<1),e},o.DataBuffer.prototype.getBytes=function(t){var e;return t?(t=Math.min(this.length(),t),e=this.data.slice(this.read,this.read+t),this.read+=t):0===t?e="":(e=0===this.read?this.data:this.data.slice(this.read),this.clear()),e},o.DataBuffer.prototype.bytes=function(t){return void 0===t?this.data.slice(this.read):this.data.slice(this.read,this.read+t)},o.DataBuffer.prototype.at=function(t){return this.data.getUint8(this.read+t)},o.DataBuffer.prototype.setAt=function(t,e){return this.data.setUint8(t,e),this},o.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)},o.DataBuffer.prototype.copy=function(){return new o.DataBuffer(this)},o.DataBuffer.prototype.compact=function(){if(this.read>0){var t=new Uint8Array(this.data.buffer,this.read),e=new Uint8Array(t.byteLength);e.set(t),this.data=new DataView(e),this.write-=this.read,this.read=0}return this},o.DataBuffer.prototype.clear=function(){return this.data=new DataView(new ArrayBuffer(0)),this.read=this.write=0,this},o.DataBuffer.prototype.truncate=function(t){return this.write=Math.max(0,this.length()-t),this.read=Math.min(this.read,this.write),this},o.DataBuffer.prototype.toHex=function(){for(var t="",e=this.read;e<this.data.byteLength;++e){var r=this.data.getUint8(e);r<16&&(t+="0"),t+=r.toString(16)}return t},o.DataBuffer.prototype.toString=function(t){var e=new Uint8Array(this.data,this.read,this.length());if("binary"===(t=t||"utf8")||"raw"===t)return o.binary.raw.encode(e);if("hex"===t)return o.binary.hex.encode(e);if("base64"===t)return o.binary.base64.encode(e);if("utf8"===t)return o.text.utf8.decode(e);if("utf16"===t)return o.text.utf16.decode(e);throw new Error("Invalid encoding: "+t)},o.createBuffer=function(t,e){return e=e||"raw",void 0!==t&&"utf8"===e&&(t=o.encodeUtf8(t)),new o.ByteBuffer(t)},o.fillString=function(t,e){for(var r="";e>0;)1&e&&(r+=t),(e>>>=1)>0&&(t+=t);return r},o.xorBytes=function(t,e,r){for(var n="",i="",s="",a=0,o=0;r>0;--r,++a)i=t.charCodeAt(a)^e.charCodeAt(a),o>=10&&(n+=s,s="",o=0),s+=String.fromCharCode(i),++o;return n+s},o.hexToBytes=function(t){var e="",r=0;for(!0&t.length&&(r=1,e+=String.fromCharCode(parseInt(t[0],16)));r<t.length;r+=2)e+=String.fromCharCode(parseInt(t.substr(r,2),16));return e},o.bytesToHex=function(t){return o.createBuffer(t).toHex()},o.int32ToBytes=function(t){return String.fromCharCode(t>>24&255)+String.fromCharCode(t>>16&255)+String.fromCharCode(t>>8&255)+String.fromCharCode(255&t)};var l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",h=[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],f="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";o.encode64=function(t,e){for(var r,n,i,s="",a="",o=0;o<t.length;)r=t.charCodeAt(o++),n=t.charCodeAt(o++),i=t.charCodeAt(o++),s+=l.charAt(r>>2),s+=l.charAt((3&r)<<4|n>>4),isNaN(n)?s+="==":(s+=l.charAt((15&n)<<2|i>>6),s+=isNaN(i)?"=":l.charAt(63&i)),e&&s.length>e&&(a+=s.substr(0,e)+"\r\n",s=s.substr(e));return a+s},o.decode64=function(t){t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var e,r,n,i,s="",a=0;a<t.length;)e=h[t.charCodeAt(a++)-43],r=h[t.charCodeAt(a++)-43],n=h[t.charCodeAt(a++)-43],i=h[t.charCodeAt(a++)-43],s+=String.fromCharCode(e<<2|r>>4),64!==n&&(s+=String.fromCharCode((15&r)<<4|n>>2),64!==i&&(s+=String.fromCharCode((3&n)<<6|i)));return s},o.encodeUtf8=function(t){return unescape(encodeURIComponent(t))},o.decodeUtf8=function(t){return decodeURIComponent(escape(t))},o.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:a.encode,decode:a.decode}},o.binary.raw.encode=function(t){return String.fromCharCode.apply(null,t)},o.binary.raw.decode=function(t,e,r){var n=e;n||(n=new Uint8Array(t.length));for(var i=r=r||0,s=0;s<t.length;++s)n[i++]=t.charCodeAt(s);return e?i-r:n},o.binary.hex.encode=o.bytesToHex,o.binary.hex.decode=function(t,e,r){var n=e;n||(n=new Uint8Array(Math.ceil(t.length/2)));var i=0,s=r=r||0;for(1&t.length&&(i=1,n[s++]=parseInt(t[0],16));i<t.length;i+=2)n[s++]=parseInt(t.substr(i,2),16);return e?s-r:n},o.binary.base64.encode=function(t,e){for(var r,n,i,s="",a="",o=0;o<t.byteLength;)r=t[o++],n=t[o++],i=t[o++],s+=l.charAt(r>>2),s+=l.charAt((3&r)<<4|n>>4),isNaN(n)?s+="==":(s+=l.charAt((15&n)<<2|i>>6),s+=isNaN(i)?"=":l.charAt(63&i)),e&&s.length>e&&(a+=s.substr(0,e)+"\r\n",s=s.substr(e));return a+s},o.binary.base64.decode=function(t,e,r){var n,i,s,a,o=e;o||(o=new Uint8Array(3*Math.ceil(t.length/4))),t=t.replace(/[^A-Za-z0-9\+\/\=]/g,"");for(var u=0,c=r=r||0;u<t.length;)n=h[t.charCodeAt(u++)-43],i=h[t.charCodeAt(u++)-43],s=h[t.charCodeAt(u++)-43],a=h[t.charCodeAt(u++)-43],o[c++]=n<<2|i>>4,64!==s&&(o[c++]=(15&i)<<4|s>>2,64!==a&&(o[c++]=(3&s)<<6|a));return e?c-r:o.subarray(0,c)},o.binary.base58.encode=function(t,e){return o.binary.baseN.encode(t,f,e)},o.binary.base58.decode=function(t,e){return o.binary.baseN.decode(t,f,e)},o.text={utf8:{},utf16:{}},o.text.utf8.encode=function(t,e,r){t=o.encodeUtf8(t);var n=e;n||(n=new Uint8Array(t.length));for(var i=r=r||0,s=0;s<t.length;++s)n[i++]=t.charCodeAt(s);return e?i-r:n},o.text.utf8.decode=function(t){return o.decodeUtf8(String.fromCharCode.apply(null,t))},o.text.utf16.encode=function(t,e,r){var n=e;n||(n=new Uint8Array(2*t.length));for(var i=new Uint16Array(n.buffer),s=r=r||0,a=r,o=0;o<t.length;++o)i[a++]=t.charCodeAt(o),s+=2;return e?s-r:n},o.text.utf16.decode=function(t){return String.fromCharCode.apply(null,new Uint16Array(t.buffer))},o.deflate=function(t,e,r){if(e=o.decode64(t.deflate(o.encode64(e)).rval),r){var n=2;32&e.charCodeAt(1)&&(n=6),e=e.substring(n,e.length-4)}return e},o.inflate=function(t,e,r){var n=t.inflate(o.encode64(e)).rval;return null===n?null:o.decode64(n)};var p=function(t,e,r){if(!t)throw new Error("WebStorage not available.");var n;if(null===r?n=t.removeItem(e):(r=o.encode64(JSON.stringify(r)),n=t.setItem(e,r)),void 0!==n&&!0!==n.rval){var i=new Error(n.error.message);throw i.id=n.error.id,i.name=n.error.name,i}},d=function(t,e){if(!t)throw new Error("WebStorage not available.");var r=t.getItem(e);if(t.init)if(null===r.rval){if(r.error){var n=new Error(r.error.message);throw n.id=r.error.id,n.name=r.error.name,n}r=null}else r=r.rval;return null!==r&&(r=JSON.parse(o.decode64(r))),r},g=function(t,e,r,n){var i=d(t,e);null===i&&(i={}),i[r]=n,p(t,e,i)},y=function(t,e,r){var n=d(t,e);return null!==n&&(n=r in n?n[r]:null),n},v=function(t,e,r){var n=d(t,e);if(null!==n&&r in n){delete n[r];var i=!0;for(var s in n){i=!1;break}i&&(n=null),p(t,e,n)}},m=function(t,e){p(t,e,null)},E=function(t,e,r){var n,i=null;void 0===r&&(r=["web","flash"]);var s=!1,a=null;for(var o in r){n=r[o];try{if("flash"===n||"both"===n){if(null===e[0])throw new Error("Flash local storage not available.");i=t.apply(this,e),s="flash"===n}"web"!==n&&"both"!==n||(e[0]=localStorage,i=t.apply(this,e),s=!0)}catch(t){a=t}if(s)break}if(!s)throw a;return i};o.setItem=function(t,e,r,n,i){E(g,arguments,i)},o.getItem=function(t,e,r,n){return E(y,arguments,n)},o.removeItem=function(t,e,r,n){E(v,arguments,n)},o.clearItems=function(t,e,r){E(m,arguments,r)},o.isEmpty=function(t){for(var e in t)if(t.hasOwnProperty(e))return!1;return!0},o.format=function(t){for(var e,r,n=/%./g,i=0,s=[],a=0;e=n.exec(t);){(r=t.substring(a,n.lastIndex-2)).length>0&&s.push(r),a=n.lastIndex;var o=e[0][1];switch(o){case"s":case"o":i<arguments.length?s.push(arguments[1+i++]):s.push("<?>");break;case"%":s.push("%");break;default:s.push("<%"+o+"?>")}}return s.push(t.substring(a)),s.join("")},o.formatNumber=function(t,e,r,n){var i=t,s=isNaN(e=Math.abs(e))?2:e,a=void 0===r?",":r,o=void 0===n?".":n,u=i<0?"-":"",c=parseInt(i=Math.abs(+i||0).toFixed(s),10)+"",l=c.length>3?c.length%3:0;return u+(l?c.substr(0,l)+o:"")+c.substr(l).replace(/(\d{3})(?=\d)/g,"$1"+o)+(s?a+Math.abs(i-c).toFixed(s).slice(2):"")},o.formatSize=function(t){return t>=1073741824?o.formatNumber(t/1073741824,2,".","")+" GiB":t>=1048576?o.formatNumber(t/1048576,2,".","")+" MiB":t>=1024?o.formatNumber(t/1024,0)+" KiB":o.formatNumber(t,0)+" bytes"},o.bytesFromIP=function(t){return-1!==t.indexOf(".")?o.bytesFromIPv4(t):-1!==t.indexOf(":")?o.bytesFromIPv6(t):null},o.bytesFromIPv4=function(t){if(4!==(t=t.split(".")).length)return null;for(var e=o.createBuffer(),r=0;r<t.length;++r){var n=parseInt(t[r],10);if(isNaN(n))return null;e.putByte(n)}return e.getBytes()},o.bytesFromIPv6=function(t){for(var e=0,r=2*(8-(t=t.split(":").filter((function(t){return 0===t.length&&++e,!0}))).length+e),n=o.createBuffer(),i=0;i<8;++i)if(t[i]&&0!==t[i].length){var s=o.hexToBytes(t[i]);s.length<2&&n.putByte(0),n.putBytes(s)}else n.fillWithByte(0,r),r=0;return n.getBytes()},o.bytesToIP=function(t){return 4===t.length?o.bytesToIPv4(t):16===t.length?o.bytesToIPv6(t):null},o.bytesToIPv4=function(t){if(4!==t.length)return null;for(var e=[],r=0;r<t.length;++r)e.push(t.charCodeAt(r));return e.join(".")},o.bytesToIPv6=function(t){if(16!==t.length)return null;for(var e=[],r=[],n=0,i=0;i<t.length;i+=2){for(var s=o.bytesToHex(t[i]+t[i+1]);"0"===s[0]&&"0"!==s;)s=s.substr(1);if("0"===s){var a=r[r.length-1],u=e.length;a&&u===a.end+1?(a.end=u,a.end-a.start>r[n].end-r[n].start&&(n=r.length-1)):r.push({start:u,end:u})}e.push(s)}if(r.length>0){var c=r[n];c.end-c.start>0&&(e.splice(c.start,c.end-c.start+1,""),0===c.start&&e.unshift(""),7===c.end&&e.push(""))}return e.join(":")},o.estimateCores=function(t,e){if("function"==typeof t&&(e=t,t={}),t=t||{},"cores"in o&&!t.update)return e(null,o.cores);if("undefined"!=typeof navigator&&"hardwareConcurrency"in navigator&&navigator.hardwareConcurrency>0)return o.cores=navigator.hardwareConcurrency,e(null,o.cores);if("undefined"==typeof Worker)return o.cores=1,e(null,o.cores);if("undefined"==typeof Blob)return o.cores=2,e(null,o.cores);var r=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",(function(t){for(var e=Date.now(),r=e+4;Date.now()<r;);self.postMessage({st:e,et:r})}))}.toString(),")()"],{type:"application/javascript"}));!function t(n,i,s){if(0===i){var a=Math.floor(n.reduce((function(t,e){return t+e}),0)/n.length);return o.cores=Math.max(1,a),URL.revokeObjectURL(r),e(null,o.cores)}!function(t,e){for(var n=[],i=[],s=0;s<t;++s){var a=new Worker(r);a.addEventListener("message",(function(r){if(i.push(r.data),i.length===t){for(var s=0;s<t;++s)n[s].terminate();e(0,i)}})),n.push(a)}for(s=0;s<t;++s)n[s].postMessage(s)}(s,(function(e,r){n.push(function(t,e){for(var r=[],n=0;n<t;++n)for(var i=e[n],s=r[n]=[],a=0;a<t;++a)if(n!==a){var o=e[a];(i.st>o.st&&i.st<o.et||o.st>i.st&&o.st<i.et)&&s.push(a)}return r.reduce((function(t,e){return Math.max(t,e.length)}),0)}(s,r)),t(n,i-1,s)}))}([],5,16)}},92556:(t,e,r)=>{var n=r(91080);r(6180),r(4e4),r(3044),r(48724),r(54755),r(91752),r(96964),r(4124),r(71532),r(18736);var i=n.asn1,s=t.exports=n.pki=n.pki||{},a=s.oids,o={};o.CN=a.commonName,o.commonName="CN",o.C=a.countryName,o.countryName="C",o.L=a.localityName,o.localityName="L",o.ST=a.stateOrProvinceName,o.stateOrProvinceName="ST",o.O=a.organizationName,o.organizationName="O",o.OU=a.organizationalUnitName,o.organizationalUnitName="OU",o.E=a.emailAddress,o.emailAddress="E";var u=n.pki.rsa.publicKeyValidator,c={name:"Certificate",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:i.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:i.Class.UNIVERSAL,type:i.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:i.Class.UNIVERSAL,type:i.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:i.Class.UNIVERSAL,type:i.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:i.Class.UNIVERSAL,type:i.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},u,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:i.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",tagClass:i.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:i.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},l={name:"rsapss",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:i.Class.UNIVERSAL,type:i.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:i.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:i.Class.UNIVERSAL,type:i.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:i.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:i.Class.UNIVERSAL,type:i.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:i.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",tagClass:i.Class.UNIVERSAL,type:i.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},h={name:"CertificationRequestInfo",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:i.Class.UNIVERSAL,type:i.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},u,{name:"CertificationRequestInfo.attributes",tagClass:i.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",tagClass:i.Class.UNIVERSAL,type:i.Type.SET,constructed:!0}]}]}]},f={name:"CertificationRequest",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[h,{name:"CertificationRequest.signatureAlgorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:i.Class.UNIVERSAL,type:i.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:i.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:i.Class.UNIVERSAL,type:i.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};function p(t,e){"string"==typeof e&&(e={shortName:e});for(var r,n=null,i=0;null===n&&i<t.attributes.length;++i)r=t.attributes[i],(e.type&&e.type===r.type||e.name&&e.name===r.name||e.shortName&&e.shortName===r.shortName)&&(n=r);return n}s.RDNAttributesAsArray=function(t,e){for(var r,n,s,u=[],c=0;c<t.value.length;++c){r=t.value[c];for(var l=0;l<r.value.length;++l)s={},n=r.value[l],s.type=i.derToOid(n.value[0].value),s.value=n.value[1].value,s.valueTagClass=n.value[1].type,s.type in a&&(s.name=a[s.type],s.name in o&&(s.shortName=o[s.name])),e&&(e.update(s.type),e.update(s.value)),u.push(s)}return u},s.CRIAttributesAsArray=function(t){for(var e=[],r=0;r<t.length;++r)for(var n=t[r],u=i.derToOid(n.value[0].value),c=n.value[1].value,l=0;l<c.length;++l){var h={};if(h.type=u,h.value=c[l].value,h.valueTagClass=c[l].type,h.type in a&&(h.name=a[h.type],h.name in o&&(h.shortName=o[h.name])),h.type===a.extensionRequest){h.extensions=[];for(var f=0;f<h.value.length;++f)h.extensions.push(s.certificateExtensionFromAsn1(h.value[f]))}e.push(h)}return e};var d=function(t,e,r){var n={};if(t!==a["RSASSA-PSS"])return n;r&&(n={hash:{algorithmOid:a.sha1},mgf:{algorithmOid:a.mgf1,hash:{algorithmOid:a.sha1}},saltLength:20});var s={},o=[];if(!i.validate(e,l,s,o)){var u=new Error("Cannot read RSASSA-PSS parameter block.");throw u.errors=o,u}return void 0!==s.hashOid&&(n.hash=n.hash||{},n.hash.algorithmOid=i.derToOid(s.hashOid)),void 0!==s.maskGenOid&&(n.mgf=n.mgf||{},n.mgf.algorithmOid=i.derToOid(s.maskGenOid),n.mgf.hash=n.mgf.hash||{},n.mgf.hash.algorithmOid=i.derToOid(s.maskGenHashOid)),void 0!==s.saltLength&&(n.saltLength=s.saltLength.charCodeAt(0)),n},g=function(t){switch(a[t.signatureOid]){case"sha1WithRSAEncryption":case"sha1WithRSASignature":return n.md.sha1.create();case"md5WithRSAEncryption":return n.md.md5.create();case"sha256WithRSAEncryption":case"RSASSA-PSS":return n.md.sha256.create();case"sha384WithRSAEncryption":return n.md.sha384.create();case"sha512WithRSAEncryption":return n.md.sha512.create();default:var e=new Error("Could not compute "+t.type+" digest. Unknown signature OID.");throw e.signatureOid=t.signatureOid,e}},y=function(t){var e,r=t.certificate;switch(r.signatureOid){case a.sha1WithRSAEncryption:case a.sha1WithRSASignature:break;case a["RSASSA-PSS"]:var i,s,o;if(void 0===(i=a[r.signatureParameters.mgf.hash.algorithmOid])||void 0===n.md[i])throw(o=new Error("Unsupported MGF hash function.")).oid=r.signatureParameters.mgf.hash.algorithmOid,o.name=i,o;if(void 0===(s=a[r.signatureParameters.mgf.algorithmOid])||void 0===n.mgf[s])throw(o=new Error("Unsupported MGF function.")).oid=r.signatureParameters.mgf.algorithmOid,o.name=s,o;if(s=n.mgf[s].create(n.md[i].create()),void 0===(i=a[r.signatureParameters.hash.algorithmOid])||void 0===n.md[i])throw(o=new Error("Unsupported RSASSA-PSS hash function.")).oid=r.signatureParameters.hash.algorithmOid,o.name=i,o;e=n.pss.create(n.md[i].create(),s,r.signatureParameters.saltLength)}return r.publicKey.verify(t.md.digest().getBytes(),t.signature,e)};function v(t){for(var e,r,s=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),a=t.attributes,o=0;o<a.length;++o){var u=(e=a[o]).value,c=i.Type.PRINTABLESTRING;"valueTagClass"in e&&(c=e.valueTagClass)===i.Type.UTF8&&(u=n.util.encodeUtf8(u)),r=i.create(i.Class.UNIVERSAL,i.Type.SET,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.type).getBytes()),i.create(i.Class.UNIVERSAL,c,!1,u)])]),s.value.push(r)}return s}function m(t){for(var e,r=0;r<t.length;++r){if(void 0===(e=t[r]).name&&(e.type&&e.type in s.oids?e.name=s.oids[e.type]:e.shortName&&e.shortName in o&&(e.name=s.oids[o[e.shortName]])),void 0===e.type){if(!e.name||!(e.name in s.oids))throw(u=new Error("Attribute type not specified.")).attribute=e,u;e.type=s.oids[e.name]}if(void 0===e.shortName&&e.name&&e.name in o&&(e.shortName=o[e.name]),e.type===a.extensionRequest&&(e.valueConstructed=!0,e.valueTagClass=i.Type.SEQUENCE,!e.value&&e.extensions)){e.value=[];for(var n=0;n<e.extensions.length;++n)e.value.push(s.certificateExtensionToAsn1(E(e.extensions[n])))}var u;if(void 0===e.value)throw(u=new Error("Attribute value not specified.")).attribute=e,u}}function E(t,e){if(e=e||{},void 0===t.name&&t.id&&t.id in s.oids&&(t.name=s.oids[t.id]),void 0===t.id){if(!t.name||!(t.name in s.oids))throw(b=new Error("Extension ID not specified.")).extension=t,b;t.id=s.oids[t.name]}if(void 0!==t.value)return t;if("keyUsage"===t.name){var r=0,o=0,u=0;t.digitalSignature&&(o|=128,r=7),t.nonRepudiation&&(o|=64,r=6),t.keyEncipherment&&(o|=32,r=5),t.dataEncipherment&&(o|=16,r=4),t.keyAgreement&&(o|=8,r=3),t.keyCertSign&&(o|=4,r=2),t.cRLSign&&(o|=2,r=1),t.encipherOnly&&(o|=1,r=0),t.decipherOnly&&(u|=128,r=7);var c=String.fromCharCode(r);0!==u?c+=String.fromCharCode(o)+String.fromCharCode(u):0!==o&&(c+=String.fromCharCode(o)),t.value=i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,c)}else if("basicConstraints"===t.name)t.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),t.cA&&t.value.value.push(i.create(i.Class.UNIVERSAL,i.Type.BOOLEAN,!1,String.fromCharCode(255))),"pathLenConstraint"in t&&t.value.value.push(i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(t.pathLenConstraint).getBytes()));else if("extKeyUsage"===t.name){t.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);var l=t.value.value;for(var h in t)!0===t[h]&&(h in a?l.push(i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(a[h]).getBytes())):-1!==h.indexOf(".")&&l.push(i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(h).getBytes())))}else if("nsCertType"===t.name)r=0,o=0,t.client&&(o|=128,r=7),t.server&&(o|=64,r=6),t.email&&(o|=32,r=5),t.objsign&&(o|=16,r=4),t.reserved&&(o|=8,r=3),t.sslCA&&(o|=4,r=2),t.emailCA&&(o|=2,r=1),t.objCA&&(o|=1,r=0),c=String.fromCharCode(r),0!==o&&(c+=String.fromCharCode(o)),t.value=i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,c);else if("subjectAltName"===t.name||"issuerAltName"===t.name){t.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);for(var f=0;f<t.altNames.length;++f){if(c=(m=t.altNames[f]).value,7===m.type&&m.ip){if(null===(c=n.util.bytesFromIP(m.ip)))throw(b=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.')).extension=t,b}else 8===m.type&&(c=m.oid?i.oidToDer(i.oidToDer(m.oid)):i.oidToDer(c));t.value.value.push(i.create(i.Class.CONTEXT_SPECIFIC,m.type,!1,c))}}else if("nsComment"===t.name&&e.cert){if(!/^[\x00-\x7F]*$/.test(t.comment)||t.comment.length<1||t.comment.length>128)throw new Error('Invalid "nsComment" content.');t.value=i.create(i.Class.UNIVERSAL,i.Type.IA5STRING,!1,t.comment)}else if("subjectKeyIdentifier"===t.name&&e.cert){var p=e.cert.generateSubjectKeyIdentifier();t.subjectKeyIdentifier=p.toHex(),t.value=i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,p.getBytes())}else if("authorityKeyIdentifier"===t.name&&e.cert){if(t.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),l=t.value.value,t.keyIdentifier){var d=!0===t.keyIdentifier?e.cert.generateSubjectKeyIdentifier().getBytes():t.keyIdentifier;l.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!1,d))}if(t.authorityCertIssuer){var g=[i.create(i.Class.CONTEXT_SPECIFIC,4,!0,[v(!0===t.authorityCertIssuer?e.cert.issuer:t.authorityCertIssuer)])];l.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,g))}if(t.serialNumber){var y=n.util.hexToBytes(!0===t.serialNumber?e.cert.serialNumber:t.serialNumber);l.push(i.create(i.Class.CONTEXT_SPECIFIC,2,!1,y))}}else if("cRLDistributionPoints"===t.name){t.value=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),l=t.value.value;var m,E=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]),S=i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[]);for(f=0;f<t.altNames.length;++f){if(c=(m=t.altNames[f]).value,7===m.type&&m.ip){if(null===(c=n.util.bytesFromIP(m.ip)))throw(b=new Error('Extension "ip" value is not a valid IPv4 or IPv6 address.')).extension=t,b}else 8===m.type&&(c=m.oid?i.oidToDer(i.oidToDer(m.oid)):i.oidToDer(c));S.value.push(i.create(i.Class.CONTEXT_SPECIFIC,m.type,!1,c))}E.value.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[S])),l.push(E)}var b;if(void 0===t.value)throw(b=new Error("Extension value not specified.")).extension=t,b;return t}function S(t,e){if(t===a["RSASSA-PSS"]){var r=[];return void 0!==e.hash.algorithmOid&&r.push(i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.hash.algorithmOid).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")])])),void 0!==e.mgf.algorithmOid&&r.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,[i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.mgf.algorithmOid).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(e.mgf.hash.algorithmOid).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")])])])),void 0!==e.saltLength&&r.push(i.create(i.Class.CONTEXT_SPECIFIC,2,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(e.saltLength).getBytes())])),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,r)}return i.create(i.Class.UNIVERSAL,i.Type.NULL,!1,"")}function b(t){var e=i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[]);if(0===t.attributes.length)return e;for(var r=t.attributes,s=0;s<r.length;++s){var a=r[s],o=a.value,u=i.Type.UTF8;"valueTagClass"in a&&(u=a.valueTagClass),u===i.Type.UTF8&&(o=n.util.encodeUtf8(o));var c=!1;"valueConstructed"in a&&(c=a.valueConstructed);var l=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(a.type).getBytes()),i.create(i.Class.UNIVERSAL,i.Type.SET,!0,[i.create(i.Class.UNIVERSAL,u,c,o)])]);e.value.push(l)}return e}s.certificateFromPem=function(t,e,r){var a=n.pem.decode(t)[0];if("CERTIFICATE"!==a.type&&"X509 CERTIFICATE"!==a.type&&"TRUSTED CERTIFICATE"!==a.type){var o=new Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');throw o.headerType=a.type,o}if(a.procType&&"ENCRYPTED"===a.procType.type)throw new Error("Could not convert certificate from PEM; PEM is encrypted.");var u=i.fromDer(a.body,r);return s.certificateFromAsn1(u,e)},s.certificateToPem=function(t,e){var r={type:"CERTIFICATE",body:i.toDer(s.certificateToAsn1(t)).getBytes()};return n.pem.encode(r,{maxline:e})},s.publicKeyFromPem=function(t){var e=n.pem.decode(t)[0];if("PUBLIC KEY"!==e.type&&"RSA PUBLIC KEY"!==e.type){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=e.type,r}if(e.procType&&"ENCRYPTED"===e.procType.type)throw new Error("Could not convert public key from PEM; PEM is encrypted.");var a=i.fromDer(e.body);return s.publicKeyFromAsn1(a)},s.publicKeyToPem=function(t,e){var r={type:"PUBLIC KEY",body:i.toDer(s.publicKeyToAsn1(t)).getBytes()};return n.pem.encode(r,{maxline:e})},s.publicKeyToRSAPublicKeyPem=function(t,e){var r={type:"RSA PUBLIC KEY",body:i.toDer(s.publicKeyToRSAPublicKey(t)).getBytes()};return n.pem.encode(r,{maxline:e})},s.getPublicKeyFingerprint=function(t,e){var r,a=(e=e||{}).md||n.md.sha1.create();switch(e.type||"RSAPublicKey"){case"RSAPublicKey":r=i.toDer(s.publicKeyToRSAPublicKey(t)).getBytes();break;case"SubjectPublicKeyInfo":r=i.toDer(s.publicKeyToAsn1(t)).getBytes();break;default:throw new Error('Unknown fingerprint type "'+e.type+'".')}a.start(),a.update(r);var o=a.digest();if("hex"===e.encoding){var u=o.toHex();return e.delimiter?u.match(/.{2}/g).join(e.delimiter):u}if("binary"===e.encoding)return o.getBytes();if(e.encoding)throw new Error('Unknown encoding "'+e.encoding+'".');return o},s.certificationRequestFromPem=function(t,e,r){var a=n.pem.decode(t)[0];if("CERTIFICATE REQUEST"!==a.type){var o=new Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".');throw o.headerType=a.type,o}if(a.procType&&"ENCRYPTED"===a.procType.type)throw new Error("Could not convert certification request from PEM; PEM is encrypted.");var u=i.fromDer(a.body,r);return s.certificationRequestFromAsn1(u,e)},s.certificationRequestToPem=function(t,e){var r={type:"CERTIFICATE REQUEST",body:i.toDer(s.certificationRequestToAsn1(t)).getBytes()};return n.pem.encode(r,{maxline:e})},s.createCertificate=function(){var t={version:2,serialNumber:"00",signatureOid:null,signature:null,siginfo:{}};return t.siginfo.algorithmOid=null,t.validity={},t.validity.notBefore=new Date,t.validity.notAfter=new Date,t.issuer={},t.issuer.getField=function(e){return p(t.issuer,e)},t.issuer.addField=function(e){m([e]),t.issuer.attributes.push(e)},t.issuer.attributes=[],t.issuer.hash=null,t.subject={},t.subject.getField=function(e){return p(t.subject,e)},t.subject.addField=function(e){m([e]),t.subject.attributes.push(e)},t.subject.attributes=[],t.subject.hash=null,t.extensions=[],t.publicKey=null,t.md=null,t.setSubject=function(e,r){m(e),t.subject.attributes=e,delete t.subject.uniqueId,r&&(t.subject.uniqueId=r),t.subject.hash=null},t.setIssuer=function(e,r){m(e),t.issuer.attributes=e,delete t.issuer.uniqueId,r&&(t.issuer.uniqueId=r),t.issuer.hash=null},t.setExtensions=function(e){for(var r=0;r<e.length;++r)E(e[r],{cert:t});t.extensions=e},t.getExtension=function(e){"string"==typeof e&&(e={name:e});for(var r,n=null,i=0;null===n&&i<t.extensions.length;++i)r=t.extensions[i],(e.id&&r.id===e.id||e.name&&r.name===e.name)&&(n=r);return n},t.sign=function(e,r){t.md=r||n.md.sha1.create();var o=a[t.md.algorithm+"WithRSAEncryption"];if(!o){var u=new Error("Could not compute certificate digest. Unknown message digest algorithm OID.");throw u.algorithm=t.md.algorithm,u}t.signatureOid=t.siginfo.algorithmOid=o,t.tbsCertificate=s.getTBSCertificate(t);var c=i.toDer(t.tbsCertificate);t.md.update(c.getBytes()),t.signature=e.sign(t.md)},t.verify=function(e){var r=!1;if(!t.issued(e)){var n=e.issuer,a=t.subject,o=new Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.");throw o.expectedIssuer=a.attributes,o.actualIssuer=n.attributes,o}var u=e.md;if(null===u){u=g({signatureOid:e.signatureOid,type:"certificate"});var c=e.tbsCertificate||s.getTBSCertificate(e),l=i.toDer(c);u.update(l.getBytes())}return null!==u&&(r=y({certificate:t,md:u,signature:e.signature})),r},t.isIssuer=function(e){var r=!1,n=t.issuer,i=e.subject;if(n.hash&&i.hash)r=n.hash===i.hash;else if(n.attributes.length===i.attributes.length){var s,a;r=!0;for(var o=0;r&&o<n.attributes.length;++o)s=n.attributes[o],a=i.attributes[o],s.type===a.type&&s.value===a.value||(r=!1)}return r},t.issued=function(e){return e.isIssuer(t)},t.generateSubjectKeyIdentifier=function(){return s.getPublicKeyFingerprint(t.publicKey,{type:"RSAPublicKey"})},t.verifySubjectKeyIdentifier=function(){for(var e=a.subjectKeyIdentifier,r=0;r<t.extensions.length;++r){var i=t.extensions[r];if(i.id===e){var s=t.generateSubjectKeyIdentifier().getBytes();return n.util.hexToBytes(i.subjectKeyIdentifier)===s}}return!1},t},s.certificateFromAsn1=function(t,e){var r={},a=[];if(!i.validate(t,c,r,a)){var o=new Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate.");throw o.errors=a,o}if(i.derToOid(r.publicKeyOid)!==s.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var u=s.createCertificate();u.version=r.certVersion?r.certVersion.charCodeAt(0):0;var l=n.util.createBuffer(r.certSerialNumber);u.serialNumber=l.toHex(),u.signatureOid=n.asn1.derToOid(r.certSignatureOid),u.signatureParameters=d(u.signatureOid,r.certSignatureParams,!0),u.siginfo.algorithmOid=n.asn1.derToOid(r.certinfoSignatureOid),u.siginfo.parameters=d(u.siginfo.algorithmOid,r.certinfoSignatureParams,!1),u.signature=r.certSignature;var h=[];if(void 0!==r.certValidity1UTCTime&&h.push(i.utcTimeToDate(r.certValidity1UTCTime)),void 0!==r.certValidity2GeneralizedTime&&h.push(i.generalizedTimeToDate(r.certValidity2GeneralizedTime)),void 0!==r.certValidity3UTCTime&&h.push(i.utcTimeToDate(r.certValidity3UTCTime)),void 0!==r.certValidity4GeneralizedTime&&h.push(i.generalizedTimeToDate(r.certValidity4GeneralizedTime)),h.length>2)throw new Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(h.length<2)throw new Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");if(u.validity.notBefore=h[0],u.validity.notAfter=h[1],u.tbsCertificate=r.tbsCertificate,e){u.md=g({signatureOid:u.signatureOid,type:"certificate"});var f=i.toDer(u.tbsCertificate);u.md.update(f.getBytes())}var y=n.md.sha1.create(),v=i.toDer(r.certIssuer);y.update(v.getBytes()),u.issuer.getField=function(t){return p(u.issuer,t)},u.issuer.addField=function(t){m([t]),u.issuer.attributes.push(t)},u.issuer.attributes=s.RDNAttributesAsArray(r.certIssuer),r.certIssuerUniqueId&&(u.issuer.uniqueId=r.certIssuerUniqueId),u.issuer.hash=y.digest().toHex();var E=n.md.sha1.create(),S=i.toDer(r.certSubject);return E.update(S.getBytes()),u.subject.getField=function(t){return p(u.subject,t)},u.subject.addField=function(t){m([t]),u.subject.attributes.push(t)},u.subject.attributes=s.RDNAttributesAsArray(r.certSubject),r.certSubjectUniqueId&&(u.subject.uniqueId=r.certSubjectUniqueId),u.subject.hash=E.digest().toHex(),r.certExtensions?u.extensions=s.certificateExtensionsFromAsn1(r.certExtensions):u.extensions=[],u.publicKey=s.publicKeyFromAsn1(r.subjectPublicKeyInfo),u},s.certificateExtensionsFromAsn1=function(t){for(var e=[],r=0;r<t.value.length;++r)for(var n=t.value[r],i=0;i<n.value.length;++i)e.push(s.certificateExtensionFromAsn1(n.value[i]));return e},s.certificateExtensionFromAsn1=function(t){var e={};if(e.id=i.derToOid(t.value[0].value),e.critical=!1,t.value[1].type===i.Type.BOOLEAN?(e.critical=0!==t.value[1].value.charCodeAt(0),e.value=t.value[2].value):e.value=t.value[1].value,e.id in a)if(e.name=a[e.id],"keyUsage"===e.name){var r=0,s=0;(u=i.fromDer(e.value)).value.length>1&&(r=u.value.charCodeAt(1),s=u.value.length>2?u.value.charCodeAt(2):0),e.digitalSignature=128==(128&r),e.nonRepudiation=64==(64&r),e.keyEncipherment=32==(32&r),e.dataEncipherment=16==(16&r),e.keyAgreement=8==(8&r),e.keyCertSign=4==(4&r),e.cRLSign=2==(2&r),e.encipherOnly=1==(1&r),e.decipherOnly=128==(128&s)}else if("basicConstraints"===e.name){(u=i.fromDer(e.value)).value.length>0&&u.value[0].type===i.Type.BOOLEAN?e.cA=0!==u.value[0].value.charCodeAt(0):e.cA=!1;var o=null;u.value.length>0&&u.value[0].type===i.Type.INTEGER?o=u.value[0].value:u.value.length>1&&(o=u.value[1].value),null!==o&&(e.pathLenConstraint=i.derToInteger(o))}else if("extKeyUsage"===e.name)for(var u=i.fromDer(e.value),c=0;c<u.value.length;++c){var l=i.derToOid(u.value[c].value);l in a?e[a[l]]=!0:e[l]=!0}else if("nsCertType"===e.name)r=0,(u=i.fromDer(e.value)).value.length>1&&(r=u.value.charCodeAt(1)),e.client=128==(128&r),e.server=64==(64&r),e.email=32==(32&r),e.objsign=16==(16&r),e.reserved=8==(8&r),e.sslCA=4==(4&r),e.emailCA=2==(2&r),e.objCA=1==(1&r);else if("subjectAltName"===e.name||"issuerAltName"===e.name){var h;e.altNames=[],u=i.fromDer(e.value);for(var f=0;f<u.value.length;++f){var p={type:(h=u.value[f]).type,value:h.value};switch(e.altNames.push(p),h.type){case 1:case 2:case 6:break;case 7:p.ip=n.util.bytesToIP(h.value);break;case 8:p.oid=i.derToOid(h.value)}}}else"subjectKeyIdentifier"===e.name&&(u=i.fromDer(e.value),e.subjectKeyIdentifier=n.util.bytesToHex(u.value));return e},s.certificationRequestFromAsn1=function(t,e){var r={},a=[];if(!i.validate(t,f,r,a)){var o=new Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest.");throw o.errors=a,o}if(i.derToOid(r.publicKeyOid)!==s.oids.rsaEncryption)throw new Error("Cannot read public key. OID is not RSA.");var u=s.createCertificationRequest();if(u.version=r.csrVersion?r.csrVersion.charCodeAt(0):0,u.signatureOid=n.asn1.derToOid(r.csrSignatureOid),u.signatureParameters=d(u.signatureOid,r.csrSignatureParams,!0),u.siginfo.algorithmOid=n.asn1.derToOid(r.csrSignatureOid),u.siginfo.parameters=d(u.siginfo.algorithmOid,r.csrSignatureParams,!1),u.signature=r.csrSignature,u.certificationRequestInfo=r.certificationRequestInfo,e){u.md=g({signatureOid:u.signatureOid,type:"certification request"});var c=i.toDer(u.certificationRequestInfo);u.md.update(c.getBytes())}var l=n.md.sha1.create();return u.subject.getField=function(t){return p(u.subject,t)},u.subject.addField=function(t){m([t]),u.subject.attributes.push(t)},u.subject.attributes=s.RDNAttributesAsArray(r.certificationRequestInfoSubject,l),u.subject.hash=l.digest().toHex(),u.publicKey=s.publicKeyFromAsn1(r.subjectPublicKeyInfo),u.getAttribute=function(t){return p(u,t)},u.addAttribute=function(t){m([t]),u.attributes.push(t)},u.attributes=s.CRIAttributesAsArray(r.certificationRequestInfoAttributes||[]),u},s.createCertificationRequest=function(){var t={version:0,signatureOid:null,signature:null,siginfo:{}};return t.siginfo.algorithmOid=null,t.subject={},t.subject.getField=function(e){return p(t.subject,e)},t.subject.addField=function(e){m([e]),t.subject.attributes.push(e)},t.subject.attributes=[],t.subject.hash=null,t.publicKey=null,t.attributes=[],t.getAttribute=function(e){return p(t,e)},t.addAttribute=function(e){m([e]),t.attributes.push(e)},t.md=null,t.setSubject=function(e){m(e),t.subject.attributes=e,t.subject.hash=null},t.setAttributes=function(e){m(e),t.attributes=e},t.sign=function(e,r){t.md=r||n.md.sha1.create();var o=a[t.md.algorithm+"WithRSAEncryption"];if(!o){var u=new Error("Could not compute certification request digest. Unknown message digest algorithm OID.");throw u.algorithm=t.md.algorithm,u}t.signatureOid=t.siginfo.algorithmOid=o,t.certificationRequestInfo=s.getCertificationRequestInfo(t);var c=i.toDer(t.certificationRequestInfo);t.md.update(c.getBytes()),t.signature=e.sign(t.md)},t.verify=function(){var e=!1,r=t.md;if(null===r){r=g({signatureOid:t.signatureOid,type:"certification request"});var n=t.certificationRequestInfo||s.getCertificationRequestInfo(t),a=i.toDer(n);r.update(a.getBytes())}return null!==r&&(e=y({certificate:t,md:r,signature:t.signature})),e},t};var C=new Date("1950-01-01T00:00:00Z"),A=new Date("2050-01-01T00:00:00Z");function w(t){return t>=C&&t<A?i.create(i.Class.UNIVERSAL,i.Type.UTCTIME,!1,i.dateToUtcTime(t)):i.create(i.Class.UNIVERSAL,i.Type.GENERALIZEDTIME,!1,i.dateToGeneralizedTime(t))}s.getTBSCertificate=function(t){var e=w(t.validity.notBefore),r=w(t.validity.notAfter),a=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.CONTEXT_SPECIFIC,0,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(t.version).getBytes())]),i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,n.util.hexToBytes(t.serialNumber)),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.siginfo.algorithmOid).getBytes()),S(t.siginfo.algorithmOid,t.siginfo.parameters)]),v(t.issuer),i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[e,r]),v(t.subject),s.publicKeyToAsn1(t.publicKey)]);return t.issuer.uniqueId&&a.value.push(i.create(i.Class.CONTEXT_SPECIFIC,1,!0,[i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+t.issuer.uniqueId)])),t.subject.uniqueId&&a.value.push(i.create(i.Class.CONTEXT_SPECIFIC,2,!0,[i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+t.subject.uniqueId)])),t.extensions.length>0&&a.value.push(s.certificateExtensionsToAsn1(t.extensions)),a},s.getCertificationRequestInfo=function(t){return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.INTEGER,!1,i.integerToDer(t.version).getBytes()),v(t.subject),s.publicKeyToAsn1(t.publicKey),b(t)])},s.distinguishedNameToAsn1=function(t){return v(t)},s.certificateToAsn1=function(t){var e=t.tbsCertificate||s.getTBSCertificate(t);return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[e,i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.signatureOid).getBytes()),S(t.signatureOid,t.signatureParameters)]),i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+t.signature)])},s.certificateExtensionsToAsn1=function(t){var e=i.create(i.Class.CONTEXT_SPECIFIC,3,!0,[]),r=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);e.value.push(r);for(var n=0;n<t.length;++n)r.value.push(s.certificateExtensionToAsn1(t[n]));return e},s.certificateExtensionToAsn1=function(t){var e=i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[]);e.value.push(i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.id).getBytes())),t.critical&&e.value.push(i.create(i.Class.UNIVERSAL,i.Type.BOOLEAN,!1,String.fromCharCode(255)));var r=t.value;return"string"!=typeof t.value&&(r=i.toDer(r).getBytes()),e.value.push(i.create(i.Class.UNIVERSAL,i.Type.OCTETSTRING,!1,r)),e},s.certificationRequestToAsn1=function(t){var e=t.certificationRequestInfo||s.getCertificationRequestInfo(t);return i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[e,i.create(i.Class.UNIVERSAL,i.Type.SEQUENCE,!0,[i.create(i.Class.UNIVERSAL,i.Type.OID,!1,i.oidToDer(t.signatureOid).getBytes()),S(t.signatureOid,t.signatureParameters)]),i.create(i.Class.UNIVERSAL,i.Type.BITSTRING,!1,String.fromCharCode(0)+t.signature)])},s.createCaStore=function(t){var e={certs:{}};function r(t){return a(t),e.certs[t.hash]||null}function a(t){if(!t.hash){var e=n.md.sha1.create();t.attributes=s.RDNAttributesAsArray(v(t),e),t.hash=e.digest().toHex()}}if(e.getIssuer=function(t){return r(t.issuer)},e.addCertificate=function(t){if("string"==typeof t&&(t=n.pki.certificateFromPem(t)),a(t.subject),!e.hasCertificate(t))if(t.subject.hash in e.certs){var r=e.certs[t.subject.hash];n.util.isArray(r)||(r=[r]),r.push(t),e.certs[t.subject.hash]=r}else e.certs[t.subject.hash]=t},e.hasCertificate=function(t){"string"==typeof t&&(t=n.pki.certificateFromPem(t));var e=r(t.subject);if(!e)return!1;n.util.isArray(e)||(e=[e]);for(var a=i.toDer(s.certificateToAsn1(t)).getBytes(),o=0;o<e.length;++o)if(a===i.toDer(s.certificateToAsn1(e[o])).getBytes())return!0;return!1},e.listAllCertificates=function(){var t=[];for(var r in e.certs)if(e.certs.hasOwnProperty(r)){var i=e.certs[r];if(n.util.isArray(i))for(var s=0;s<i.length;++s)t.push(i[s]);else t.push(i)}return t},e.removeCertificate=function(t){var o;if("string"==typeof t&&(t=n.pki.certificateFromPem(t)),a(t.subject),!e.hasCertificate(t))return null;var u=r(t.subject);if(!n.util.isArray(u))return o=e.certs[t.subject.hash],delete e.certs[t.subject.hash],o;for(var c=i.toDer(s.certificateToAsn1(t)).getBytes(),l=0;l<u.length;++l)c===i.toDer(s.certificateToAsn1(u[l])).getBytes()&&(o=u[l],u.splice(l,1));return 0===u.length&&delete e.certs[t.subject.hash],o},t)for(var o=0;o<t.length;++o){var u=t[o];e.addCertificate(u)}return e},s.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"},s.verifyCertificateChain=function(t,e,r){"function"==typeof r&&(r={verify:r}),r=r||{};var i=(e=e.slice(0)).slice(0),a=r.validityCheckDate;void 0===a&&(a=new Date);var o=!0,u=null,c=0;do{var l=e.shift(),h=null,f=!1;if(a&&(a<l.validity.notBefore||a>l.validity.notAfter)&&(u={message:"Certificate is not valid yet or has expired.",error:s.certificateError.certificate_expired,notBefore:l.validity.notBefore,notAfter:l.validity.notAfter,now:a}),null===u){if(null===(h=e[0]||t.getIssuer(l))&&l.isIssuer(l)&&(f=!0,h=l),h){var p=h;n.util.isArray(p)||(p=[p]);for(var d=!1;!d&&p.length>0;){h=p.shift();try{d=h.verify(l)}catch(t){}}d||(u={message:"Certificate signature is invalid.",error:s.certificateError.bad_certificate})}null!==u||h&&!f||t.hasCertificate(l)||(u={message:"Certificate is not trusted.",error:s.certificateError.unknown_ca})}if(null===u&&h&&!l.isIssuer(h)&&(u={message:"Certificate issuer is invalid.",error:s.certificateError.bad_certificate}),null===u)for(var g={keyUsage:!0,basicConstraints:!0},y=0;null===u&&y<l.extensions.length;++y){var v=l.extensions[y];v.critical&&!(v.name in g)&&(u={message:"Certificate has an unsupported critical extension.",error:s.certificateError.unsupported_certificate})}if(null===u&&(!o||0===e.length&&(!h||f))){var m=l.getExtension("basicConstraints"),E=l.getExtension("keyUsage");null!==E&&(E.keyCertSign&&null!==m||(u={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:s.certificateError.bad_certificate})),null!==u||null===m||m.cA||(u={message:"Certificate basicConstraints indicates the certificate is not a CA.",error:s.certificateError.bad_certificate}),null===u&&null!==E&&"pathLenConstraint"in m&&c-1>m.pathLenConstraint&&(u={message:"Certificate basicConstraints pathLenConstraint violated.",error:s.certificateError.bad_certificate})}var S=null===u||u.error,b=r.verify?r.verify(S,c,i):S;if(!0!==b)throw!0===S&&(u={message:"The application rejected the certificate.",error:s.certificateError.bad_certificate}),(b||0===b)&&("object"!=typeof b||n.util.isArray(b)?"string"==typeof b&&(u.error=b):(b.message&&(u.message=b.message),b.error&&(u.error=b.error))),u;u=null,o=!1,++c}while(e.length>0);return!0}},72216:(t,e,r)=>{var n,i,s,a,o,u,c,l,h,f,p,d=r(33296).Buffer,g={userAgent:!1},y={},v=v||(n=Math,s=(i={}).lib={},a=s.Base=function(){function t(){}return{extend:function(e){t.prototype=this;var r=new t;return e&&r.mixIn(e),r.hasOwnProperty("init")||(r.init=function(){r.$super.init.apply(this,arguments)}),r.init.prototype=r,r.$super=this,r},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),o=s.WordArray=a.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:4*t.length},toString:function(t){return(t||c).stringify(this)},concat:function(t){var e=this.words,r=t.words,n=this.sigBytes,i=t.sigBytes;if(this.clamp(),n%4)for(var s=0;s<i;s++){var a=r[s>>>2]>>>24-s%4*8&255;e[n+s>>>2]|=a<<24-(n+s)%4*8}else for(s=0;s<i;s+=4)e[n+s>>>2]=r[s>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,e=this.sigBytes;t[e>>>2]&=4294967295<<32-e%4*8,t.length=n.ceil(e/4)},clone:function(){var t=a.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],r=0;r<t;r+=4)e.push(4294967296*n.random()|0);return new o.init(e,t)}}),u=i.enc={},c=u.Hex={stringify:function(t){for(var e=t.words,r=t.sigBytes,n=[],i=0;i<r;i++){var s=e[i>>>2]>>>24-i%4*8&255;n.push((s>>>4).toString(16)),n.push((15&s).toString(16))}return n.join("")},parse:function(t){for(var e=t.length,r=[],n=0;n<e;n+=2)r[n>>>3]|=parseInt(t.substr(n,2),16)<<24-n%8*4;return new o.init(r,e/2)}},l=u.Latin1={stringify:function(t){for(var e=t.words,r=t.sigBytes,n=[],i=0;i<r;i++){var s=e[i>>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(s))}return n.join("")},parse:function(t){for(var e=t.length,r=[],n=0;n<e;n++)r[n>>>2]|=(255&t.charCodeAt(n))<<24-n%4*8;return new o.init(r,e)}},h=u.Utf8={stringify:function(t){try{return decodeURIComponent(escape(l.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return l.parse(unescape(encodeURIComponent(t)))}},f=s.BufferedBlockAlgorithm=a.extend({reset:function(){this._data=new o.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=h.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(t){var e=this._data,r=e.words,i=e.sigBytes,s=this.blockSize,a=i/(4*s),u=(a=t?n.ceil(a):n.max((0|a)-this._minBufferSize,0))*s,c=n.min(4*u,i);if(u){for(var l=0;l<u;l+=s)this._doProcessBlock(r,l);var h=r.splice(0,u);e.sigBytes-=c}return new o.init(h,c)},clone:function(){var t=a.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),s.Hasher=f.extend({cfg:a.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){f.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,r){return new t.init(r).finalize(e)}},_createHmacHelper:function(t){return function(e,r){return new p.HMAC.init(t,r).finalize(e)}}}),p=i.algo={},i);!function(t){var e,r=(e=v).lib,n=r.Base,i=r.WordArray;(e=e.x64={}).Word=n.extend({init:function(t,e){this.high=t,this.low=e}}),e.WordArray=n.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:8*t.length},toX32:function(){for(var t=this.words,e=t.length,r=[],n=0;n<e;n++){var s=t[n];r.push(s.high),r.push(s.low)}return i.create(r,this.sigBytes)},clone:function(){for(var t=n.clone.call(this),e=t.words=this.words.slice(0),r=e.length,i=0;i<r;i++)e[i]=e[i].clone();return t}})}(),v.lib.Cipher||function(t){var e=(p=v).lib,r=e.Base,n=e.WordArray,i=e.BufferedBlockAlgorithm,s=p.enc.Base64,a=p.algo.EvpKDF,o=e.Cipher=i.extend({cfg:r.extend(),createEncryptor:function(t,e){return this.create(this._ENC_XFORM_MODE,t,e)},createDecryptor:function(t,e){return this.create(this._DEC_XFORM_MODE,t,e)},init:function(t,e,r){this.cfg=this.cfg.extend(r),this._xformMode=t,this._key=e,this.reset()},reset:function(){i.reset.call(this),this._doReset()},process:function(t){return this._append(t),this._process()},finalize:function(t){return t&&this._append(t),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(t){return{encrypt:function(e,r,n){return("string"==typeof r?d:f).encrypt(t,e,r,n)},decrypt:function(e,r,n){return("string"==typeof r?d:f).decrypt(t,e,r,n)}}}});e.StreamCipher=o.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var u=p.mode={},c=function(t,e,r){var n=this._iv;n?this._iv=void 0:n=this._prevBlock;for(var i=0;i<r;i++)t[e+i]^=n[i]},l=(e.BlockCipherMode=r.extend({createEncryptor:function(t,e){return this.Encryptor.create(t,e)},createDecryptor:function(t,e){return this.Decryptor.create(t,e)},init:function(t,e){this._cipher=t,this._iv=e}})).extend();l.Encryptor=l.extend({processBlock:function(t,e){var r=this._cipher,n=r.blockSize;c.call(this,t,e,n),r.encryptBlock(t,e),this._prevBlock=t.slice(e,e+n)}}),l.Decryptor=l.extend({processBlock:function(t,e){var r=this._cipher,n=r.blockSize,i=t.slice(e,e+n);r.decryptBlock(t,e),c.call(this,t,e,n),this._prevBlock=i}}),u=u.CBC=l,l=(p.pad={}).Pkcs7={pad:function(t,e){for(var r,i=(r=(r=4*e)-t.sigBytes%r)<<24|r<<16|r<<8|r,s=[],a=0;a<r;a+=4)s.push(i);r=n.create(s,r),t.concat(r)},unpad:function(t){t.sigBytes-=255&t.words[t.sigBytes-1>>>2]}},e.BlockCipher=o.extend({cfg:o.cfg.extend({mode:u,padding:l}),reset:function(){o.reset.call(this);var t=(e=this.cfg).iv,e=e.mode;if(this._xformMode==this._ENC_XFORM_MODE)var r=e.createEncryptor;else r=e.createDecryptor,this._minBufferSize=1;this._mode=r.call(e,this,t&&t.words)},_doProcessBlock:function(t,e){this._mode.processBlock(t,e)},_doFinalize:function(){var t=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){t.pad(this._data,this.blockSize);var e=this._process(!0)}else e=this._process(!0),t.unpad(e);return e},blockSize:4});var h=e.CipherParams=r.extend({init:function(t){this.mixIn(t)},toString:function(t){return(t||this.formatter).stringify(this)}}),f=(u=(p.format={}).OpenSSL={stringify:function(t){var e=t.ciphertext;return((t=t.salt)?n.create([1398893684,1701076831]).concat(t).concat(e):e).toString(s)},parse:function(t){var e=(t=s.parse(t)).words;if(1398893684==e[0]&&1701076831==e[1]){var r=n.create(e.slice(2,4));e.splice(0,4),t.sigBytes-=16}return h.create({ciphertext:t,salt:r})}},e.SerializableCipher=r.extend({cfg:r.extend({format:u}),encrypt:function(t,e,r,n){n=this.cfg.extend(n);var i=t.createEncryptor(r,n);return e=i.finalize(e),i=i.cfg,h.create({ciphertext:e,key:r,iv:i.iv,algorithm:t,mode:i.mode,padding:i.padding,blockSize:t.blockSize,formatter:n.format})},decrypt:function(t,e,r,n){return n=this.cfg.extend(n),e=this._parse(e,n.format),t.createDecryptor(r,n).finalize(e.ciphertext)},_parse:function(t,e){return"string"==typeof t?e.parse(t,this):t}})),p=(p.kdf={}).OpenSSL={execute:function(t,e,r,i){return i||(i=n.random(8)),t=a.create({keySize:e+r}).compute(t,i),r=n.create(t.words.slice(e),4*r),t.sigBytes=4*e,h.create({key:t,iv:r,salt:i})}},d=e.PasswordBasedCipher=f.extend({cfg:f.cfg.extend({kdf:p}),encrypt:function(t,e,r,n){return r=(n=this.cfg.extend(n)).kdf.execute(r,t.keySize,t.ivSize),n.iv=r.iv,(t=f.encrypt.call(this,t,e,r.key,n)).mixIn(r),t},decrypt:function(t,e,r,n){return n=this.cfg.extend(n),e=this._parse(e,n.format),r=n.kdf.execute(r,t.keySize,t.ivSize,e.salt),n.iv=r.iv,f.decrypt.call(this,t,e,r.key,n)}})}(),function(){for(var t=v,e=t.lib.BlockCipher,r=t.algo,n=[],i=[],s=[],a=[],o=[],u=[],c=[],l=[],h=[],f=[],p=[],d=0;256>d;d++)p[d]=128>d?d<<1:d<<1^283;var g=0,y=0;for(d=0;256>d;d++){var m=(m=y^y<<1^y<<2^y<<3^y<<4)>>>8^255&m^99;n[g]=m,i[m]=g;var E=p[g],S=p[E],b=p[S],C=257*p[m]^16843008*m;s[g]=C<<24|C>>>8,a[g]=C<<16|C>>>16,o[g]=C<<8|C>>>24,u[g]=C,C=16843009*b^65537*S^257*E^16843008*g,c[m]=C<<24|C>>>8,l[m]=C<<16|C>>>16,h[m]=C<<8|C>>>24,f[m]=C,g?(g=E^p[p[p[b^E]]],y^=p[p[y]]):g=y=1}var A=[0,1,2,4,8,16,32,64,128,27,54];r=r.AES=e.extend({_doReset:function(){for(var t=(r=this._key).words,e=r.sigBytes/4,r=4*((this._nRounds=e+6)+1),i=this._keySchedule=[],s=0;s<r;s++)if(s<e)i[s]=t[s];else{var a=i[s-1];s%e?6<e&&4==s%e&&(a=n[a>>>24]<<24|n[a>>>16&255]<<16|n[a>>>8&255]<<8|n[255&a]):(a=n[(a=a<<8|a>>>24)>>>24]<<24|n[a>>>16&255]<<16|n[a>>>8&255]<<8|n[255&a],a^=A[s/e|0]<<24),i[s]=i[s-e]^a}for(t=this._invKeySchedule=[],e=0;e<r;e++)s=r-e,a=e%4?i[s]:i[s-4],t[e]=4>e||4>=s?a:c[n[a>>>24]]^l[n[a>>>16&255]]^h[n[a>>>8&255]]^f[n[255&a]]},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._keySchedule,s,a,o,u,n)},decryptBlock:function(t,e){var r=t[e+1];t[e+1]=t[e+3],t[e+3]=r,this._doCryptBlock(t,e,this._invKeySchedule,c,l,h,f,i),r=t[e+1],t[e+1]=t[e+3],t[e+3]=r},_doCryptBlock:function(t,e,r,n,i,s,a,o){for(var u=this._nRounds,c=t[e]^r[0],l=t[e+1]^r[1],h=t[e+2]^r[2],f=t[e+3]^r[3],p=4,d=1;d<u;d++){var g=n[c>>>24]^i[l>>>16&255]^s[h>>>8&255]^a[255&f]^r[p++],y=n[l>>>24]^i[h>>>16&255]^s[f>>>8&255]^a[255&c]^r[p++],v=n[h>>>24]^i[f>>>16&255]^s[c>>>8&255]^a[255&l]^r[p++];f=n[f>>>24]^i[c>>>16&255]^s[l>>>8&255]^a[255&h]^r[p++],c=g,l=y,h=v}g=(o[c>>>24]<<24|o[l>>>16&255]<<16|o[h>>>8&255]<<8|o[255&f])^r[p++],y=(o[l>>>24]<<24|o[h>>>16&255]<<16|o[f>>>8&255]<<8|o[255&c])^r[p++],v=(o[h>>>24]<<24|o[f>>>16&255]<<16|o[c>>>8&255]<<8|o[255&l])^r[p++],f=(o[f>>>24]<<24|o[c>>>16&255]<<16|o[l>>>8&255]<<8|o[255&h])^r[p++],t[e]=g,t[e+1]=y,t[e+2]=v,t[e+3]=f},keySize:8}),t.AES=e._createHelper(r)}(),function(){function t(t,e){var r=(this._lBlock>>>t^this._rBlock)&e;this._rBlock^=r,this._lBlock^=r<<t}function e(t,e){var r=(this._rBlock>>>t^this._lBlock)&e;this._lBlock^=r,this._rBlock^=r<<t}var r=v,n=(i=r.lib).WordArray,i=i.BlockCipher,s=r.algo,a=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],o=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],u=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],c=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],l=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],h=s.DES=i.extend({_doReset:function(){for(var t=this._key.words,e=[],r=0;56>r;r++){var n=a[r]-1;e[r]=t[n>>>5]>>>31-n%32&1}for(t=this._subKeys=[],n=0;16>n;n++){var i=t[n]=[],s=u[n];for(r=0;24>r;r++)i[r/6|0]|=e[(o[r]-1+s)%28]<<31-r%6,i[4+(r/6|0)]|=e[28+(o[r+24]-1+s)%28]<<31-r%6;for(i[0]=i[0]<<1|i[0]>>>31,r=1;7>r;r++)i[r]>>>=4*(r-1)+3;i[7]=i[7]<<5|i[7]>>>27}for(e=this._invSubKeys=[],r=0;16>r;r++)e[r]=t[15-r]},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._subKeys)},decryptBlock:function(t,e){this._doCryptBlock(t,e,this._invSubKeys)},_doCryptBlock:function(r,n,i){this._lBlock=r[n],this._rBlock=r[n+1],t.call(this,4,252645135),t.call(this,16,65535),e.call(this,2,858993459),e.call(this,8,16711935),t.call(this,1,1431655765);for(var s=0;16>s;s++){for(var a=i[s],o=this._lBlock,u=this._rBlock,h=0,f=0;8>f;f++)h|=c[f][((u^a[f])&l[f])>>>0];this._lBlock=u,this._rBlock=o^h}i=this._lBlock,this._lBlock=this._rBlock,this._rBlock=i,t.call(this,1,1431655765),e.call(this,8,16711935),e.call(this,2,858993459),t.call(this,16,65535),t.call(this,4,252645135),r[n]=this._lBlock,r[n+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});r.DES=i._createHelper(h),s=s.TripleDES=i.extend({_doReset:function(){var t=this._key.words;this._des1=h.createEncryptor(n.create(t.slice(0,2))),this._des2=h.createEncryptor(n.create(t.slice(2,4))),this._des3=h.createEncryptor(n.create(t.slice(4,6)))},encryptBlock:function(t,e){this._des1.encryptBlock(t,e),this._des2.decryptBlock(t,e),this._des3.encryptBlock(t,e)},decryptBlock:function(t,e){this._des3.decryptBlock(t,e),this._des2.encryptBlock(t,e),this._des1.decryptBlock(t,e)},keySize:6,ivSize:2,blockSize:2}),r.TripleDES=i._createHelper(s)}(),function(){var t=v,e=t.lib.WordArray;t.enc.Base64={stringify:function(t){var e=t.words,r=t.sigBytes,n=this._map;t.clamp(),t=[];for(var i=0;i<r;i+=3)for(var s=(e[i>>>2]>>>24-i%4*8&255)<<16|(e[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|e[i+2>>>2]>>>24-(i+2)%4*8&255,a=0;4>a&&i+.75*a<r;a++)t.push(n.charAt(s>>>6*(3-a)&63));if(e=n.charAt(64))for(;t.length%4;)t.push(e);return t.join("")},parse:function(t){var r=t.length,n=this._map;(i=n.charAt(64))&&-1!=(i=t.indexOf(i))&&(r=i);for(var i=[],s=0,a=0;a<r;a++)if(a%4){var o=n.indexOf(t.charAt(a-1))<<a%4*2,u=n.indexOf(t.charAt(a))>>>6-a%4*2;i[s>>>2]|=(o|u)<<24-s%4*8,s++}return e.create(i,s)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),function(t){function e(t,e,r,n,i,s,a){return((t=t+(e&r|~e&n)+i+a)<<s|t>>>32-s)+e}function r(t,e,r,n,i,s,a){return((t=t+(e&n|r&~n)+i+a)<<s|t>>>32-s)+e}function n(t,e,r,n,i,s,a){return((t=t+(e^r^n)+i+a)<<s|t>>>32-s)+e}function i(t,e,r,n,i,s,a){return((t=t+(r^(e|~n))+i+a)<<s|t>>>32-s)+e}for(var s=v,a=(u=s.lib).WordArray,o=u.Hasher,u=s.algo,c=[],l=0;64>l;l++)c[l]=4294967296*t.abs(t.sin(l+1))|0;u=u.MD5=o.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(t,s){for(var a=0;16>a;a++){var o=t[u=s+a];t[u]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}a=this._hash.words;var u=t[s+0],l=(o=t[s+1],t[s+2]),h=t[s+3],f=t[s+4],p=t[s+5],d=t[s+6],g=t[s+7],y=t[s+8],v=t[s+9],m=t[s+10],E=t[s+11],S=t[s+12],b=t[s+13],C=t[s+14],A=t[s+15],w=e(w=a[0],I=a[1],B=a[2],x=a[3],u,7,c[0]),x=e(x,w,I,B,o,12,c[1]),B=e(B,x,w,I,l,17,c[2]),I=e(I,B,x,w,h,22,c[3]);w=e(w,I,B,x,f,7,c[4]),x=e(x,w,I,B,p,12,c[5]),B=e(B,x,w,I,d,17,c[6]),I=e(I,B,x,w,g,22,c[7]),w=e(w,I,B,x,y,7,c[8]),x=e(x,w,I,B,v,12,c[9]),B=e(B,x,w,I,m,17,c[10]),I=e(I,B,x,w,E,22,c[11]),w=e(w,I,B,x,S,7,c[12]),x=e(x,w,I,B,b,12,c[13]),B=e(B,x,w,I,C,17,c[14]),w=r(w,I=e(I,B,x,w,A,22,c[15]),B,x,o,5,c[16]),x=r(x,w,I,B,d,9,c[17]),B=r(B,x,w,I,E,14,c[18]),I=r(I,B,x,w,u,20,c[19]),w=r(w,I,B,x,p,5,c[20]),x=r(x,w,I,B,m,9,c[21]),B=r(B,x,w,I,A,14,c[22]),I=r(I,B,x,w,f,20,c[23]),w=r(w,I,B,x,v,5,c[24]),x=r(x,w,I,B,C,9,c[25]),B=r(B,x,w,I,h,14,c[26]),I=r(I,B,x,w,y,20,c[27]),w=r(w,I,B,x,b,5,c[28]),x=r(x,w,I,B,l,9,c[29]),B=r(B,x,w,I,g,14,c[30]),w=n(w,I=r(I,B,x,w,S,20,c[31]),B,x,p,4,c[32]),x=n(x,w,I,B,y,11,c[33]),B=n(B,x,w,I,E,16,c[34]),I=n(I,B,x,w,C,23,c[35]),w=n(w,I,B,x,o,4,c[36]),x=n(x,w,I,B,f,11,c[37]),B=n(B,x,w,I,g,16,c[38]),I=n(I,B,x,w,m,23,c[39]),w=n(w,I,B,x,b,4,c[40]),x=n(x,w,I,B,u,11,c[41]),B=n(B,x,w,I,h,16,c[42]),I=n(I,B,x,w,d,23,c[43]),w=n(w,I,B,x,v,4,c[44]),x=n(x,w,I,B,S,11,c[45]),B=n(B,x,w,I,A,16,c[46]),w=i(w,I=n(I,B,x,w,l,23,c[47]),B,x,u,6,c[48]),x=i(x,w,I,B,g,10,c[49]),B=i(B,x,w,I,C,15,c[50]),I=i(I,B,x,w,p,21,c[51]),w=i(w,I,B,x,S,6,c[52]),x=i(x,w,I,B,h,10,c[53]),B=i(B,x,w,I,m,15,c[54]),I=i(I,B,x,w,o,21,c[55]),w=i(w,I,B,x,y,6,c[56]),x=i(x,w,I,B,A,10,c[57]),B=i(B,x,w,I,d,15,c[58]),I=i(I,B,x,w,b,21,c[59]),w=i(w,I,B,x,f,6,c[60]),x=i(x,w,I,B,E,10,c[61]),B=i(B,x,w,I,l,15,c[62]),I=i(I,B,x,w,v,21,c[63]),a[0]=a[0]+w|0,a[1]=a[1]+I|0,a[2]=a[2]+B|0,a[3]=a[3]+x|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;r[i>>>5]|=128<<24-i%32;var s=t.floor(n/4294967296);for(r[15+(i+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),r[14+(i+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),e.sigBytes=4*(r.length+1),this._process(),r=(e=this._hash).words,n=0;4>n;n++)i=r[n],r[n]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8);return e},clone:function(){var t=o.clone.call(this);return t._hash=this._hash.clone(),t}}),s.MD5=o._createHelper(u),s.HmacMD5=o._createHmacHelper(u)}(Math),function(){var t=v,e=(i=t.lib).WordArray,r=i.Hasher,n=[],i=t.algo.SHA1=r.extend({_doReset:function(){this._hash=new e.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var r=this._hash.words,i=r[0],s=r[1],a=r[2],o=r[3],u=r[4],c=0;80>c;c++){if(16>c)n[c]=0|t[e+c];else{var l=n[c-3]^n[c-8]^n[c-14]^n[c-16];n[c]=l<<1|l>>>31}l=(i<<5|i>>>27)+u+n[c],l=20>c?l+(1518500249+(s&a|~s&o)):40>c?l+(1859775393+(s^a^o)):60>c?l+((s&a|s&o|a&o)-1894007588):l+((s^a^o)-899497514),u=o,o=a,a=s<<30|s>>>2,s=i,i=l}r[0]=r[0]+i|0,r[1]=r[1]+s|0,r[2]=r[2]+a|0,r[3]=r[3]+o|0,r[4]=r[4]+u|0},_doFinalize:function(){var t=this._data,e=t.words,r=8*this._nDataBytes,n=8*t.sigBytes;return e[n>>>5]|=128<<24-n%32,e[14+(n+64>>>9<<4)]=Math.floor(r/4294967296),e[15+(n+64>>>9<<4)]=r,t.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t}});t.SHA1=r._createHelper(i),t.HmacSHA1=r._createHmacHelper(i)}(),function(t){for(var e=v,r=(i=e.lib).WordArray,n=i.Hasher,i=e.algo,s=[],a=[],o=function(t){return 4294967296*(t-(0|t))|0},u=2,c=0;64>c;){var l;t:{l=u;for(var h=t.sqrt(l),f=2;f<=h;f++)if(!(l%f)){l=!1;break t}l=!0}l&&(8>c&&(s[c]=o(t.pow(u,.5))),a[c]=o(t.pow(u,1/3)),c++),u++}var p=[];i=i.SHA256=n.extend({_doReset:function(){this._hash=new r.init(s.slice(0))},_doProcessBlock:function(t,e){for(var r=this._hash.words,n=r[0],i=r[1],s=r[2],o=r[3],u=r[4],c=r[5],l=r[6],h=r[7],f=0;64>f;f++){if(16>f)p[f]=0|t[e+f];else{var d=p[f-15],g=p[f-2];p[f]=((d<<25|d>>>7)^(d<<14|d>>>18)^d>>>3)+p[f-7]+((g<<15|g>>>17)^(g<<13|g>>>19)^g>>>10)+p[f-16]}d=h+((u<<26|u>>>6)^(u<<21|u>>>11)^(u<<7|u>>>25))+(u&c^~u&l)+a[f]+p[f],g=((n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22))+(n&i^n&s^i&s),h=l,l=c,c=u,u=o+d|0,o=s,s=i,i=n,n=d+g|0}r[0]=r[0]+n|0,r[1]=r[1]+i|0,r[2]=r[2]+s|0,r[3]=r[3]+o|0,r[4]=r[4]+u|0,r[5]=r[5]+c|0,r[6]=r[6]+l|0,r[7]=r[7]+h|0},_doFinalize:function(){var e=this._data,r=e.words,n=8*this._nDataBytes,i=8*e.sigBytes;return r[i>>>5]|=128<<24-i%32,r[14+(i+64>>>9<<4)]=t.floor(n/4294967296),r[15+(i+64>>>9<<4)]=n,e.sigBytes=4*r.length,this._process(),this._hash},clone:function(){var t=n.clone.call(this);return t._hash=this._hash.clone(),t}}),e.SHA256=n._createHelper(i),e.HmacSHA256=n._createHmacHelper(i)}(Math),function(){var t=v,e=t.lib.WordArray,r=(n=t.algo).SHA256,n=n.SHA224=r.extend({_doReset:function(){this._hash=new e.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var t=r._doFinalize.call(this);return t.sigBytes-=4,t}});t.SHA224=r._createHelper(n),t.HmacSHA224=r._createHmacHelper(n)}(),function(){function t(){return n.create.apply(n,arguments)}for(var e=v,r=e.lib.Hasher,n=(s=e.x64).Word,i=s.WordArray,s=e.algo,a=[t(1116352408,3609767458),t(1899447441,602891725),t(3049323471,3964484399),t(3921009573,2173295548),t(961987163,4081628472),t(1508970993,3053834265),t(2453635748,2937671579),t(2870763221,3664609560),t(3624381080,2734883394),t(310598401,1164996542),t(607225278,1323610764),t(1426881987,3590304994),t(1925078388,4068182383),t(2162078206,991336113),t(2614888103,633803317),t(3248222580,3479774868),t(3835390401,2666613458),t(4022224774,944711139),t(264347078,2341262773),t(604807628,2007800933),t(770255983,1495990901),t(1249150122,1856431235),t(1555081692,3175218132),t(1996064986,2198950837),t(2554220882,3999719339),t(2821834349,766784016),t(2952996808,2566594879),t(3210313671,3203337956),t(3336571891,1034457026),t(3584528711,2466948901),t(113926993,3758326383),t(338241895,168717936),t(666307205,1188179964),t(773529912,1546045734),t(1294757372,1522805485),t(1396182291,2643833823),t(1695183700,2343527390),t(1986661051,1014477480),t(2177026350,1206759142),t(2456956037,344077627),t(2730485921,1290863460),t(2820302411,3158454273),t(3259730800,3505952657),t(3345764771,106217008),t(3516065817,3606008344),t(3600352804,1432725776),t(4094571909,1467031594),t(275423344,851169720),t(430227734,3100823752),t(506948616,1363258195),t(659060556,3750685593),t(883997877,3785050280),t(958139571,3318307427),t(1322822218,3812723403),t(1537002063,2003034995),t(1747873779,3602036899),t(1955562222,1575990012),t(2024104815,1125592928),t(2227730452,2716904306),t(2361852424,442776044),t(2428436474,593698344),t(2756734187,3733110249),t(3204031479,2999351573),t(3329325298,3815920427),t(3391569614,3928383900),t(3515267271,566280711),t(3940187606,3454069534),t(4118630271,4000239992),t(116418474,1914138554),t(174292421,2731055270),t(289380356,3203993006),t(460393269,320620315),t(685471733,587496836),t(852142971,1086792851),t(1017036298,365543100),t(1126000580,2618297676),t(1288033470,3409855158),t(1501505948,4234509866),t(1607167915,987167468),t(1816402316,1246189591)],o=[],u=0;80>u;u++)o[u]=t();s=s.SHA512=r.extend({_doReset:function(){this._hash=new i.init([new n.init(1779033703,4089235720),new n.init(3144134277,2227873595),new n.init(1013904242,4271175723),new n.init(2773480762,1595750129),new n.init(1359893119,2917565137),new n.init(2600822924,725511199),new n.init(528734635,4215389547),new n.init(1541459225,327033209)])},_doProcessBlock:function(t,e){for(var r=(h=this._hash.words)[0],n=h[1],i=h[2],s=h[3],u=h[4],c=h[5],l=h[6],h=h[7],f=r.high,p=r.low,d=n.high,g=n.low,y=i.high,v=i.low,m=s.high,E=s.low,S=u.high,b=u.low,C=c.high,A=c.low,w=l.high,x=l.low,B=h.high,I=h.low,T=f,F=p,R=d,N=g,D=y,P=v,k=m,L=E,O=S,_=b,U=C,V=A,H=w,K=x,j=B,M=I,q=0;80>q;q++){var G=o[q];if(16>q)var z=G.high=0|t[e+2*q],W=G.low=0|t[e+2*q+1];else{z=((W=(z=o[q-15]).high)>>>1|($=z.low)<<31)^(W>>>8|$<<24)^W>>>7;var $=($>>>1|W<<31)^($>>>8|W<<24)^($>>>7|W<<25),Y=((W=(Y=o[q-2]).high)>>>19|(Q=Y.low)<<13)^(W<<3|Q>>>29)^W>>>6,Q=(Q>>>19|W<<13)^(Q<<3|W>>>29)^(Q>>>6|W<<26),X=(W=o[q-7]).high,J=(Z=o[q-16]).high,Z=Z.low;z=(z=(z=z+X+((W=$+W.low)>>>0<$>>>0?1:0))+Y+((W+=Q)>>>0<Q>>>0?1:0))+J+((W+=Z)>>>0<Z>>>0?1:0),G.high=z,G.low=W}X=O&U^~O&H,Z=_&V^~_&K,G=T&R^T&D^R&D;var tt=F&N^F&P^N&P,et=($=(T>>>28|F<<4)^(T<<30|F>>>2)^(T<<25|F>>>7),Y=(F>>>28|T<<4)^(F<<30|T>>>2)^(F<<25|T>>>7),(Q=a[q]).high),rt=Q.low;J=j+((O>>>14|_<<18)^(O>>>18|_<<14)^(O<<23|_>>>9))+((Q=M+((_>>>14|O<<18)^(_>>>18|O<<14)^(_<<23|O>>>9)))>>>0<M>>>0?1:0),j=H,M=K,H=U,K=V,U=O,V=_,O=k+(J=(J=(J=J+X+((Q+=Z)>>>0<Z>>>0?1:0))+et+((Q+=rt)>>>0<rt>>>0?1:0))+z+((Q+=W)>>>0<W>>>0?1:0))+((_=L+Q|0)>>>0<L>>>0?1:0)|0,k=D,L=P,D=R,P=N,R=T,N=F,T=J+(G=$+G+((W=Y+tt)>>>0<Y>>>0?1:0))+((F=Q+W|0)>>>0<Q>>>0?1:0)|0}p=r.low=p+F,r.high=f+T+(p>>>0<F>>>0?1:0),g=n.low=g+N,n.high=d+R+(g>>>0<N>>>0?1:0),v=i.low=v+P,i.high=y+D+(v>>>0<P>>>0?1:0),E=s.low=E+L,s.high=m+k+(E>>>0<L>>>0?1:0),b=u.low=b+_,u.high=S+O+(b>>>0<_>>>0?1:0),A=c.low=A+V,c.high=C+U+(A>>>0<V>>>0?1:0),x=l.low=x+K,l.high=w+H+(x>>>0<K>>>0?1:0),I=h.low=I+M,h.high=B+j+(I>>>0<M>>>0?1:0)},_doFinalize:function(){var t=this._data,e=t.words,r=8*this._nDataBytes,n=8*t.sigBytes;return e[n>>>5]|=128<<24-n%32,e[30+(n+128>>>10<<5)]=Math.floor(r/4294967296),e[31+(n+128>>>10<<5)]=r,t.sigBytes=4*e.length,this._process(),this._hash.toX32()},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t},blockSize:32}),e.SHA512=r._createHelper(s),e.HmacSHA512=r._createHmacHelper(s)}(),function(){var t=v,e=(i=t.x64).Word,r=i.WordArray,n=(i=t.algo).SHA512,i=i.SHA384=n.extend({_doReset:function(){this._hash=new r.init([new e.init(3418070365,3238371032),new e.init(1654270250,914150663),new e.init(2438529370,812702999),new e.init(355462360,4144912697),new e.init(1731405415,4290775857),new e.init(2394180231,1750603025),new e.init(3675008525,1694076839),new e.init(1203062813,3204075428)])},_doFinalize:function(){var t=n._doFinalize.call(this);return t.sigBytes-=16,t}});t.SHA384=n._createHelper(i),t.HmacSHA384=n._createHmacHelper(i)}(),function(){var t=v,e=(n=t.lib).WordArray,r=n.Hasher,n=t.algo,i=e.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),s=e.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),a=e.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),o=e.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),u=e.create([0,1518500249,1859775393,2400959708,2840853838]),c=e.create([1352829926,1548603684,1836072691,2053994217,0]);n=n.RIPEMD160=r.extend({_doReset:function(){this._hash=e.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var r=0;16>r;r++){var n=t[b=e+r];t[b]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8)}var l,h,f,p,d,g,y,v,m,E,S,b=this._hash.words,C=(n=u.words,c.words),A=i.words,w=s.words,x=a.words,B=o.words;for(g=l=b[0],y=h=b[1],v=f=b[2],m=p=b[3],E=d=b[4],r=0;80>r;r+=1)S=l+t[e+A[r]]|0,S=16>r?S+((h^f^p)+n[0]):32>r?S+((h&f|~h&p)+n[1]):48>r?S+(((h|~f)^p)+n[2]):64>r?S+((h&p|f&~p)+n[3]):S+((h^(f|~p))+n[4]),S=(S=(S|=0)<<x[r]|S>>>32-x[r])+d|0,l=d,d=p,p=f<<10|f>>>22,f=h,h=S,S=g+t[e+w[r]]|0,S=16>r?S+((y^(v|~m))+C[0]):32>r?S+((y&m|v&~m)+C[1]):48>r?S+(((y|~v)^m)+C[2]):64>r?S+((y&v|~y&m)+C[3]):S+((y^v^m)+C[4]),S=(S=(S|=0)<<B[r]|S>>>32-B[r])+E|0,g=E,E=m,m=v<<10|v>>>22,v=y,y=S;S=b[1]+f+m|0,b[1]=b[2]+p+E|0,b[2]=b[3]+d+g|0,b[3]=b[4]+l+y|0,b[4]=b[0]+h+v|0,b[0]=S},_doFinalize:function(){var t=this._data,e=t.words,r=8*this._nDataBytes,n=8*t.sigBytes;for(e[n>>>5]|=128<<24-n%32,e[14+(n+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),t.sigBytes=4*(e.length+1),this._process(),e=(t=this._hash).words,r=0;5>r;r++)n=e[r],e[r]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8);return t},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t}}),t.RIPEMD160=r._createHelper(n),t.HmacRIPEMD160=r._createHmacHelper(n)}(Math),function(){var t=v,e=t.enc.Utf8;t.algo.HMAC=t.lib.Base.extend({init:function(t,r){t=this._hasher=new t.init,"string"==typeof r&&(r=e.parse(r));var n=t.blockSize,i=4*n;r.sigBytes>i&&(r=t.finalize(r)),r.clamp();for(var s=this._oKey=r.clone(),a=this._iKey=r.clone(),o=s.words,u=a.words,c=0;c<n;c++)o[c]^=1549556828,u[c]^=909522486;s.sigBytes=a.sigBytes=i,this.reset()},reset:function(){var t=this._hasher;t.reset(),t.update(this._iKey)},update:function(t){return this._hasher.update(t),this},finalize:function(t){var e=this._hasher;return t=e.finalize(t),e.reset(),e.finalize(this._oKey.clone().concat(t))}})}(),function(){var t,e=v,r=(t=e.lib).Base,n=t.WordArray,i=(t=e.algo).HMAC,s=t.PBKDF2=r.extend({cfg:r.extend({keySize:4,hasher:t.SHA1,iterations:1}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){var r=this.cfg,s=i.create(r.hasher,t),a=n.create(),o=n.create([1]),u=a.words,c=o.words,l=r.keySize;for(r=r.iterations;u.length<l;){var h=s.update(e).finalize(o);s.reset();for(var f=h.words,p=f.length,d=h,g=1;g<r;g++){d=s.finalize(d),s.reset();for(var y=d.words,v=0;v<p;v++)f[v]^=y[v]}a.concat(h),c[0]++}return a.sigBytes=4*l,a}});e.PBKDF2=function(t,e,r){return s.create(r).compute(t,e)}}();var m,E="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",S="=";function b(t){var e,r,n="";for(e=0;e+3<=t.length;e+=3)r=parseInt(t.substring(e,e+3),16),n+=E.charAt(r>>6)+E.charAt(63&r);if(e+1==t.length?(r=parseInt(t.substring(e,e+1),16),n+=E.charAt(r<<2)):e+2==t.length&&(r=parseInt(t.substring(e,e+2),16),n+=E.charAt(r>>2)+E.charAt((3&r)<<4)),S)for(;(3&n.length)>0;)n+=S;return n}function C(t){var e,r,n,i="",s=0;for(e=0;e<t.length&&t.charAt(e)!=S;++e)(n=E.indexOf(t.charAt(e)))<0||(0==s?(i+=F(n>>2),r=3&n,s=1):1==s?(i+=F(r<<2|n>>4),r=15&n,s=2):2==s?(i+=F(r),i+=F(n>>2),r=3&n,s=3):(i+=F(r<<2|n>>4),i+=F(15&n),s=0));return 1==s&&(i+=F(r<<2)),i}function A(t,e,r){null!=t&&("number"==typeof t?this.fromNumber(t,e,r):null==e&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,e))}function w(){return new A(null)}"Microsoft Internet Explorer"==g.appName?(A.prototype.am=function(t,e,r,n,i,s){for(var a=32767&e,o=e>>15;--s>=0;){var u=32767&this[t],c=this[t++]>>15,l=o*u+c*a;i=((u=a*u+((32767&l)<<15)+r[n]+(1073741823&i))>>>30)+(l>>>15)+o*c+(i>>>30),r[n++]=1073741823&u}return i},m=30):"Netscape"!=g.appName?(A.prototype.am=function(t,e,r,n,i,s){for(;--s>=0;){var a=e*this[t++]+r[n]+i;i=Math.floor(a/67108864),r[n++]=67108863&a}return i},m=26):(A.prototype.am=function(t,e,r,n,i,s){for(var a=16383&e,o=e>>14;--s>=0;){var u=16383&this[t],c=this[t++]>>14,l=o*u+c*a;i=((u=a*u+((16383&l)<<14)+r[n]+i)>>28)+(l>>14)+o*c,r[n++]=268435455&u}return i},m=28),A.prototype.DB=m,A.prototype.DM=(1<<m)-1,A.prototype.DV=1<<m,A.prototype.FV=Math.pow(2,52),A.prototype.F1=52-m,A.prototype.F2=2*m-52;var x,B,I="0123456789abcdefghijklmnopqrstuvwxyz",T=new Array;for(x="0".charCodeAt(0),B=0;B<=9;++B)T[x++]=B;for(x="a".charCodeAt(0),B=10;B<36;++B)T[x++]=B;for(x="A".charCodeAt(0),B=10;B<36;++B)T[x++]=B;function F(t){return I.charAt(t)}function R(t,e){var r=T[t.charCodeAt(e)];return null==r?-1:r}function N(t){var e=w();return e.fromInt(t),e}function D(t){var e,r=1;return 0!=(e=t>>>16)&&(t=e,r+=16),0!=(e=t>>8)&&(t=e,r+=8),0!=(e=t>>4)&&(t=e,r+=4),0!=(e=t>>2)&&(t=e,r+=2),0!=(e=t>>1)&&(t=e,r+=1),r}function P(t){this.m=t}function k(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}function L(t,e){return t&e}function O(t,e){return t|e}function _(t,e){return t^e}function U(t,e){return t&~e}function V(t){if(0==t)return-1;var e=0;return 0==(65535&t)&&(t>>=16,e+=16),0==(255&t)&&(t>>=8,e+=8),0==(15&t)&&(t>>=4,e+=4),0==(3&t)&&(t>>=2,e+=2),0==(1&t)&&++e,e}function H(t){for(var e=0;0!=t;)t&=t-1,++e;return e}function K(){}function j(t){return t}function M(t){this.r2=w(),this.q3=w(),A.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}P.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},P.prototype.revert=function(t){return t},P.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},P.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},P.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},k.prototype.convert=function(t){var e=w();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(A.ZERO)>0&&this.m.subTo(e,e),e},k.prototype.revert=function(t){var e=w();return t.copyTo(e),this.reduce(e),e},k.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e<this.m.t;++e){var r=32767&t[e],n=r*this.mpl+((r*this.mph+(t[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(t[r=e+this.m.t]+=this.m.am(0,n,t,e,0,this.m.t);t[r]>=t.DV;)t[r]-=t.DV,t[++r]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},k.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},k.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},A.prototype.copyTo=function(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s},A.prototype.fromInt=function(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0},A.prototype.fromString=function(t,e){var r;if(16==e)r=4;else if(8==e)r=3;else if(256==e)r=8;else if(2==e)r=1;else if(32==e)r=5;else{if(4!=e)return void this.fromRadix(t,e);r=2}this.t=0,this.s=0;for(var n=t.length,i=!1,s=0;--n>=0;){var a=8==r?255&t[n]:R(t,n);a<0?"-"==t.charAt(n)&&(i=!0):(i=!1,0==s?this[this.t++]=a:s+r>this.DB?(this[this.t-1]|=(a&(1<<this.DB-s)-1)<<s,this[this.t++]=a>>this.DB-s):this[this.t-1]|=a<<s,(s+=r)>=this.DB&&(s-=this.DB))}8==r&&0!=(128&t[0])&&(this.s=-1,s>0&&(this[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),i&&A.ZERO.subTo(this,this)},A.prototype.clamp=function(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t},A.prototype.dlShiftTo=function(t,e){var r;for(r=this.t-1;r>=0;--r)e[r+t]=this[r];for(r=t-1;r>=0;--r)e[r]=0;e.t=this.t+t,e.s=this.s},A.prototype.drShiftTo=function(t,e){for(var r=t;r<this.t;++r)e[r-t]=this[r];e.t=Math.max(this.t-t,0),e.s=this.s},A.prototype.lShiftTo=function(t,e){var r,n=t%this.DB,i=this.DB-n,s=(1<<i)-1,a=Math.floor(t/this.DB),o=this.s<<n&this.DM;for(r=this.t-1;r>=0;--r)e[r+a+1]=this[r]>>i|o,o=(this[r]&s)<<n;for(r=a-1;r>=0;--r)e[r]=0;e[a]=o,e.t=this.t+a+1,e.s=this.s,e.clamp()},A.prototype.rShiftTo=function(t,e){e.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t)e.t=0;else{var n=t%this.DB,i=this.DB-n,s=(1<<n)-1;e[0]=this[r]>>n;for(var a=r+1;a<this.t;++a)e[a-r-1]|=(this[a]&s)<<i,e[a-r]=this[a]>>n;n>0&&(e[this.t-r-1]|=(this.s&s)<<i),e.t=this.t-r,e.clamp()}},A.prototype.subTo=function(t,e){for(var r=0,n=0,i=Math.min(t.t,this.t);r<i;)n+=this[r]-t[r],e[r++]=n&this.DM,n>>=this.DB;if(t.t<this.t){for(n-=t.s;r<this.t;)n+=this[r],e[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<t.t;)n-=t[r],e[r++]=n&this.DM,n>>=this.DB;n-=t.s}e.s=n<0?-1:0,n<-1?e[r++]=this.DV+n:n>0&&(e[r++]=n),e.t=r,e.clamp()},A.prototype.multiplyTo=function(t,e){var r=this.abs(),n=t.abs(),i=r.t;for(e.t=i+n.t;--i>=0;)e[i]=0;for(i=0;i<n.t;++i)e[i+r.t]=r.am(0,n[i],e,i,0,r.t);e.s=0,e.clamp(),this.s!=t.s&&A.ZERO.subTo(e,e)},A.prototype.squareTo=function(t){for(var e=this.abs(),r=t.t=2*e.t;--r>=0;)t[r]=0;for(r=0;r<e.t-1;++r){var n=e.am(r,e[r],t,2*r,0,1);(t[r+e.t]+=e.am(r+1,2*e[r],t,2*r+1,n,e.t-r-1))>=e.DV&&(t[r+e.t]-=e.DV,t[r+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(r,e[r],t,2*r,0,1)),t.s=0,t.clamp()},A.prototype.divRemTo=function(t,e,r){var n=t.abs();if(!(n.t<=0)){var i=this.abs();if(i.t<n.t)return null!=e&&e.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=w());var s=w(),a=this.s,o=t.s,u=this.DB-D(n[n.t-1]);u>0?(n.lShiftTo(u,s),i.lShiftTo(u,r)):(n.copyTo(s),i.copyTo(r));var c=s.t,l=s[c-1];if(0!=l){var h=l*(1<<this.F1)+(c>1?s[c-2]>>this.F2:0),f=this.FV/h,p=(1<<this.F1)/h,d=1<<this.F2,g=r.t,y=g-c,v=null==e?w():e;for(s.dlShiftTo(y,v),r.compareTo(v)>=0&&(r[r.t++]=1,r.subTo(v,r)),A.ONE.dlShiftTo(c,v),v.subTo(s,s);s.t<c;)s[s.t++]=0;for(;--y>=0;){var m=r[--g]==l?this.DM:Math.floor(r[g]*f+(r[g-1]+d)*p);if((r[g]+=s.am(0,m,r,y,0,c))<m)for(s.dlShiftTo(y,v),r.subTo(v,r);r[g]<--m;)r.subTo(v,r)}null!=e&&(r.drShiftTo(c,e),a!=o&&A.ZERO.subTo(e,e)),r.t=c,r.clamp(),u>0&&r.rShiftTo(u,r),a<0&&A.ZERO.subTo(r,r)}}},A.prototype.invDigit=function(){if(this.t<1)return 0;var t=this[0];if(0==(1&t))return 0;var e=3&t;return(e=(e=(e=(e=e*(2-(15&t)*e)&15)*(2-(255&t)*e)&255)*(2-((65535&t)*e&65535))&65535)*(2-t*e%this.DV)%this.DV)>0?this.DV-e:-e},A.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},A.prototype.exp=function(t,e){if(t>4294967295||t<1)return A.ONE;var r=w(),n=w(),i=e.convert(this),s=D(t)-1;for(i.copyTo(r);--s>=0;)if(e.sqrTo(r,n),(t&1<<s)>0)e.mulTo(n,i,r);else{var a=r;r=n,n=a}return e.revert(r)},A.prototype.toString=function(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var r,n=(1<<e)-1,i=!1,s="",a=this.t,o=this.DB-a*this.DB%e;if(a-- >0)for(o<this.DB&&(r=this[a]>>o)>0&&(i=!0,s=F(r));a>=0;)o<e?(r=(this[a]&(1<<o)-1)<<e-o,r|=this[--a]>>(o+=this.DB-e)):(r=this[a]>>(o-=e)&n,o<=0&&(o+=this.DB,--a)),r>0&&(i=!0),i&&(s+=F(r));return i?s:"0"},A.prototype.negate=function(){var t=w();return A.ZERO.subTo(this,t),t},A.prototype.abs=function(){return this.s<0?this.negate():this},A.prototype.compareTo=function(t){var e=this.s-t.s;if(0!=e)return e;var r=this.t;if(0!=(e=r-t.t))return this.s<0?-e:e;for(;--r>=0;)if(0!=(e=this[r]-t[r]))return e;return 0},A.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+D(this[this.t-1]^this.s&this.DM)},A.prototype.mod=function(t){var e=w();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(A.ZERO)>0&&t.subTo(e,e),e},A.prototype.modPowInt=function(t,e){var r;return r=t<256||e.isEven()?new P(e):new k(e),this.exp(t,r)},A.ZERO=N(0),A.ONE=N(1),K.prototype.convert=j,K.prototype.revert=j,K.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r)},K.prototype.sqrTo=function(t,e){t.squareTo(e)},M.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=w();return t.copyTo(e),this.reduce(e),e},M.prototype.revert=function(t){return t},M.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},M.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},M.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)};var q=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],G=(1<<26)/q[q.length-1];function z(){this.i=0,this.j=0,this.S=new Array}A.prototype.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},A.prototype.toRadix=function(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var e=this.chunkSize(t),r=Math.pow(t,e),n=N(r),i=w(),s=w(),a="";for(this.divRemTo(n,i,s);i.signum()>0;)a=(r+s.intValue()).toString(t).substr(1)+a,i.divRemTo(n,i,s);return s.intValue().toString(t)+a},A.prototype.fromRadix=function(t,e){this.fromInt(0),null==e&&(e=10);for(var r=this.chunkSize(e),n=Math.pow(e,r),i=!1,s=0,a=0,o=0;o<t.length;++o){var u=R(t,o);u<0?"-"==t.charAt(o)&&0==this.signum()&&(i=!0):(a=e*a+u,++s>=r&&(this.dMultiply(n),this.dAddOffset(a,0),s=0,a=0))}s>0&&(this.dMultiply(Math.pow(e,s)),this.dAddOffset(a,0)),i&&A.ZERO.subTo(this,this)},A.prototype.fromNumber=function(t,e,r){if("number"==typeof e)if(t<2)this.fromInt(1);else for(this.fromNumber(t,r),this.testBit(t-1)||this.bitwiseTo(A.ONE.shiftLeft(t-1),O,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(A.ONE.shiftLeft(t-1),this);else{var n=new Array,i=7&t;n.length=1+(t>>3),e.nextBytes(n),i>0?n[0]&=(1<<i)-1:n[0]=0,this.fromString(n,256)}},A.prototype.bitwiseTo=function(t,e,r){var n,i,s=Math.min(t.t,this.t);for(n=0;n<s;++n)r[n]=e(this[n],t[n]);if(t.t<this.t){for(i=t.s&this.DM,n=s;n<this.t;++n)r[n]=e(this[n],i);r.t=this.t}else{for(i=this.s&this.DM,n=s;n<t.t;++n)r[n]=e(i,t[n]);r.t=t.t}r.s=e(this.s,t.s),r.clamp()},A.prototype.changeBit=function(t,e){var r=A.ONE.shiftLeft(t);return this.bitwiseTo(r,e,r),r},A.prototype.addTo=function(t,e){for(var r=0,n=0,i=Math.min(t.t,this.t);r<i;)n+=this[r]+t[r],e[r++]=n&this.DM,n>>=this.DB;if(t.t<this.t){for(n+=t.s;r<this.t;)n+=this[r],e[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<t.t;)n+=t[r],e[r++]=n&this.DM,n>>=this.DB;n+=t.s}e.s=n<0?-1:0,n>0?e[r++]=n:n<-1&&(e[r++]=this.DV+n),e.t=r,e.clamp()},A.prototype.dMultiply=function(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},A.prototype.dAddOffset=function(t,e){if(0!=t){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}},A.prototype.multiplyLowerTo=function(t,e,r){var n,i=Math.min(this.t+t.t,e);for(r.s=0,r.t=i;i>0;)r[--i]=0;for(n=r.t-this.t;i<n;++i)r[i+this.t]=this.am(0,t[i],r,i,0,this.t);for(n=Math.min(t.t,e);i<n;++i)this.am(0,t[i],r,i,0,e-i);r.clamp()},A.prototype.multiplyUpperTo=function(t,e,r){--e;var n=r.t=this.t+t.t-e;for(r.s=0;--n>=0;)r[n]=0;for(n=Math.max(e-this.t,0);n<t.t;++n)r[this.t+n-e]=this.am(e-n,t[n],r,0,0,this.t+n-e);r.clamp(),r.drShiftTo(1,r)},A.prototype.modInt=function(t){if(t<=0)return 0;var e=this.DV%t,r=this.s<0?t-1:0;if(this.t>0)if(0==e)r=this[0]%t;else for(var n=this.t-1;n>=0;--n)r=(e*r+this[n])%t;return r},A.prototype.millerRabin=function(t){var e=this.subtract(A.ONE),r=e.getLowestSetBit();if(r<=0)return!1;var n=e.shiftRight(r);(t=t+1>>1)>q.length&&(t=q.length);for(var i=w(),s=0;s<t;++s){i.fromInt(q[Math.floor(Math.random()*q.length)]);var a=i.modPow(n,this);if(0!=a.compareTo(A.ONE)&&0!=a.compareTo(e)){for(var o=1;o++<r&&0!=a.compareTo(e);)if(0==(a=a.modPowInt(2,this)).compareTo(A.ONE))return!1;if(0!=a.compareTo(e))return!1}}return!0},A.prototype.clone=function(){var t=w();return this.copyTo(t),t},A.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},A.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},A.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},A.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},A.prototype.toByteArray=function(){var t=this.t,e=new Array;e[0]=this.s;var r,n=this.DB-t*this.DB%8,i=0;if(t-- >0)for(n<this.DB&&(r=this[t]>>n)!=(this.s&this.DM)>>n&&(e[i++]=r|this.s<<this.DB-n);t>=0;)n<8?(r=(this[t]&(1<<n)-1)<<8-n,r|=this[--t]>>(n+=this.DB-8)):(r=this[t]>>(n-=8)&255,n<=0&&(n+=this.DB,--t)),0!=(128&r)&&(r|=-256),0==i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(e[i++]=r);return e},A.prototype.equals=function(t){return 0==this.compareTo(t)},A.prototype.min=function(t){return this.compareTo(t)<0?this:t},A.prototype.max=function(t){return this.compareTo(t)>0?this:t},A.prototype.and=function(t){var e=w();return this.bitwiseTo(t,L,e),e},A.prototype.or=function(t){var e=w();return this.bitwiseTo(t,O,e),e},A.prototype.xor=function(t){var e=w();return this.bitwiseTo(t,_,e),e},A.prototype.andNot=function(t){var e=w();return this.bitwiseTo(t,U,e),e},A.prototype.not=function(){for(var t=w(),e=0;e<this.t;++e)t[e]=this.DM&~this[e];return t.t=this.t,t.s=~this.s,t},A.prototype.shiftLeft=function(t){var e=w();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e},A.prototype.shiftRight=function(t){var e=w();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e},A.prototype.getLowestSetBit=function(){for(var t=0;t<this.t;++t)if(0!=this[t])return t*this.DB+V(this[t]);return this.s<0?this.t*this.DB:-1},A.prototype.bitCount=function(){for(var t=0,e=this.s&this.DM,r=0;r<this.t;++r)t+=H(this[r]^e);return t},A.prototype.testBit=function(t){var e=Math.floor(t/this.DB);return e>=this.t?0!=this.s:0!=(this[e]&1<<t%this.DB)},A.prototype.setBit=function(t){return this.changeBit(t,O)},A.prototype.clearBit=function(t){return this.changeBit(t,U)},A.prototype.flipBit=function(t){return this.changeBit(t,_)},A.prototype.add=function(t){var e=w();return this.addTo(t,e),e},A.prototype.subtract=function(t){var e=w();return this.subTo(t,e),e},A.prototype.multiply=function(t){var e=w();return this.multiplyTo(t,e),e},A.prototype.divide=function(t){var e=w();return this.divRemTo(t,e,null),e},A.prototype.remainder=function(t){var e=w();return this.divRemTo(t,null,e),e},A.prototype.divideAndRemainder=function(t){var e=w(),r=w();return this.divRemTo(t,e,r),new Array(e,r)},A.prototype.modPow=function(t,e){var r,n,i=t.bitLength(),s=N(1);if(i<=0)return s;r=i<18?1:i<48?3:i<144?4:i<768?5:6,n=i<8?new P(e):e.isEven()?new M(e):new k(e);var a=new Array,o=3,u=r-1,c=(1<<r)-1;if(a[1]=n.convert(this),r>1){var l=w();for(n.sqrTo(a[1],l);o<=c;)a[o]=w(),n.mulTo(l,a[o-2],a[o]),o+=2}var h,f,p=t.t-1,d=!0,g=w();for(i=D(t[p])-1;p>=0;){for(i>=u?h=t[p]>>i-u&c:(h=(t[p]&(1<<i+1)-1)<<u-i,p>0&&(h|=t[p-1]>>this.DB+i-u)),o=r;0==(1&h);)h>>=1,--o;if((i-=o)<0&&(i+=this.DB,--p),d)a[h].copyTo(s),d=!1;else{for(;o>1;)n.sqrTo(s,g),n.sqrTo(g,s),o-=2;o>0?n.sqrTo(s,g):(f=s,s=g,g=f),n.mulTo(g,a[h],s)}for(;p>=0&&0==(t[p]&1<<i);)n.sqrTo(s,g),f=s,s=g,g=f,--i<0&&(i=this.DB-1,--p)}return n.revert(s)},A.prototype.modInverse=function(t){var e=t.isEven();if(this.isEven()&&e||0==t.signum())return A.ZERO;for(var r=t.clone(),n=this.clone(),i=N(1),s=N(0),a=N(0),o=N(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),e?(i.isEven()&&s.isEven()||(i.addTo(this,i),s.subTo(t,s)),i.rShiftTo(1,i)):s.isEven()||s.subTo(t,s),s.rShiftTo(1,s);for(;n.isEven();)n.rShiftTo(1,n),e?(a.isEven()&&o.isEven()||(a.addTo(this,a),o.subTo(t,o)),a.rShiftTo(1,a)):o.isEven()||o.subTo(t,o),o.rShiftTo(1,o);r.compareTo(n)>=0?(r.subTo(n,r),e&&i.subTo(a,i),s.subTo(o,s)):(n.subTo(r,n),e&&a.subTo(i,a),o.subTo(s,o))}return 0!=n.compareTo(A.ONE)?A.ZERO:o.compareTo(t)>=0?o.subtract(t):o.signum()<0?(o.addTo(t,o),o.signum()<0?o.add(t):o):o},A.prototype.pow=function(t){return this.exp(t,new K)},A.prototype.gcd=function(t){var e=this.s<0?this.negate():this.clone(),r=t.s<0?t.negate():t.clone();if(e.compareTo(r)<0){var n=e;e=r,r=n}var i=e.getLowestSetBit(),s=r.getLowestSetBit();if(s<0)return e;for(i<s&&(s=i),s>0&&(e.rShiftTo(s,e),r.rShiftTo(s,r));e.signum()>0;)(i=e.getLowestSetBit())>0&&e.rShiftTo(i,e),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),e.compareTo(r)>=0?(e.subTo(r,e),e.rShiftTo(1,e)):(r.subTo(e,r),r.rShiftTo(1,r));return s>0&&r.lShiftTo(s,r),r},A.prototype.isProbablePrime=function(t){var e,r=this.abs();if(1==r.t&&r[0]<=q[q.length-1]){for(e=0;e<q.length;++e)if(r[0]==q[e])return!0;return!1}if(r.isEven())return!1;for(e=1;e<q.length;){for(var n=q[e],i=e+1;i<q.length&&n<G;)n*=q[i++];for(n=r.modInt(n);e<i;)if(n%q[e++]==0)return!1}return r.millerRabin(t)},A.prototype.square=function(){var t=w();return this.squareTo(t),t},z.prototype.init=function(t){var e,r,n;for(e=0;e<256;++e)this.S[e]=e;for(r=0,e=0;e<256;++e)r=r+this.S[e]+t[e%t.length]&255,n=this.S[e],this.S[e]=this.S[r],this.S[r]=n;this.i=0,this.j=0},z.prototype.next=function(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]};var W,$,Y,Q=256;function X(){!function(t){$[Y++]^=255&t,$[Y++]^=t>>8&255,$[Y++]^=t>>16&255,$[Y++]^=t>>24&255,Y>=Q&&(Y-=Q)}((new Date).getTime())}if(null==$){var J;if($=new Array,Y=0,void 0!==y&&(void 0!==y.crypto||void 0!==y.msCrypto)){var Z=y.crypto||y.msCrypto;if(Z.getRandomValues){var tt=new Uint8Array(32);for(Z.getRandomValues(tt),J=0;J<32;++J)$[Y++]=tt[J]}else if("Netscape"==g.appName&&g.appVersion<"5"){var et=y.crypto.random(32);for(J=0;J<et.length;++J)$[Y++]=255&et.charCodeAt(J)}}for(;Y<Q;)J=Math.floor(65536*Math.random()),$[Y++]=J>>>8,$[Y++]=255&J;Y=0,X()}function rt(){if(null==W){for(X(),(W=new z).init($),Y=0;Y<$.length;++Y)$[Y]=0;Y=0}return W.next()}function nt(){}function it(t,e){return new A(t,e)}function st(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}function at(t,e){this.x=e,this.q=t}function ot(t,e,r,n){this.curve=t,this.x=e,this.y=r,this.z=null==n?A.ONE:n,this.zinv=null}function ut(t,e,r){this.q=t,this.a=this.fromBigInteger(e),this.b=this.fromBigInteger(r),this.infinity=new ot(this,null,null)}nt.prototype.nextBytes=function(t){var e;for(e=0;e<t.length;++e)t[e]=rt()},st.prototype.doPublic=function(t){return t.modPowInt(this.e,this.n)},st.prototype.setPublic=function(t,e){if(this.isPublic=!0,this.isPrivate=!1,"string"!=typeof t)this.n=t,this.e=e;else{if(!(null!=t&&null!=e&&t.length>0&&e.length>0))throw"Invalid RSA public key";this.n=it(t,16),this.e=parseInt(e,16)}},st.prototype.type="RSA",st.prototype.doPrivate=function(t){if(null==this.p||null==this.q)return t.modPow(this.d,this.n);for(var e=t.mod(this.p).modPow(this.dmp1,this.p),r=t.mod(this.q).modPow(this.dmq1,this.q);e.compareTo(r)<0;)e=e.add(this.p);return e.subtract(r).multiply(this.coeff).mod(this.p).multiply(this.q).add(r)},st.prototype.setPrivate=function(t,e,r){if(this.isPrivate=!0,"string"!=typeof t)this.n=t,this.e=e,this.d=r;else{if(!(null!=t&&null!=e&&t.length>0&&e.length>0))throw"Invalid RSA private key";this.n=it(t,16),this.e=parseInt(e,16),this.d=it(r,16)}},st.prototype.setPrivateEx=function(t,e,r,n,i,s,a,o){if(this.isPrivate=!0,this.isPublic=!1,null==t)throw"RSASetPrivateEx N == null";if(null==e)throw"RSASetPrivateEx E == null";if(0==t.length)throw"RSASetPrivateEx N.length == 0";if(0==e.length)throw"RSASetPrivateEx E.length == 0";if(!(null!=t&&null!=e&&t.length>0&&e.length>0))throw"Invalid RSA private key in RSASetPrivateEx";this.n=it(t,16),this.e=parseInt(e,16),this.d=it(r,16),this.p=it(n,16),this.q=it(i,16),this.dmp1=it(s,16),this.dmq1=it(a,16),this.coeff=it(o,16)},st.prototype.generate=function(t,e){var r=new nt,n=t>>1;this.e=parseInt(e,16);for(var i=new A(e,16),s=t/2-100,a=A.ONE.shiftLeft(s);;){for(;this.p=new A(t-n,1,r),0!=this.p.subtract(A.ONE).gcd(i).compareTo(A.ONE)||!this.p.isProbablePrime(10););for(;this.q=new A(n,1,r),0!=this.q.subtract(A.ONE).gcd(i).compareTo(A.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var o=this.p;this.p=this.q,this.q=o}var u=this.q.subtract(this.p).abs();if(!(u.bitLength()<s||u.compareTo(a)<=0)){var c=this.p.subtract(A.ONE),l=this.q.subtract(A.ONE),h=c.multiply(l);if(0==h.gcd(i).compareTo(A.ONE)&&(this.n=this.p.multiply(this.q),this.n.bitLength()==t)){this.d=i.modInverse(h),this.dmp1=this.d.mod(c),this.dmq1=this.d.mod(l),this.coeff=this.q.modInverse(this.p);break}}}this.isPrivate=!0},at.prototype.equals=function(t){return t==this||this.q.equals(t.q)&&this.x.equals(t.x)},at.prototype.toBigInteger=function(){return this.x},at.prototype.negate=function(){return new at(this.q,this.x.negate().mod(this.q))},at.prototype.add=function(t){return new at(this.q,this.x.add(t.toBigInteger()).mod(this.q))},at.prototype.subtract=function(t){return new at(this.q,this.x.subtract(t.toBigInteger()).mod(this.q))},at.prototype.multiply=function(t){return new at(this.q,this.x.multiply(t.toBigInteger()).mod(this.q))},at.prototype.square=function(){return new at(this.q,this.x.square().mod(this.q))},at.prototype.divide=function(t){return new at(this.q,this.x.multiply(t.toBigInteger().modInverse(this.q)).mod(this.q))},at.prototype.sqrt=function(){return new at(this.q,this.x.sqrt().mod(this.q))},ot.prototype.getX=function(){return null==this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))},ot.prototype.getY=function(){return null==this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))},ot.prototype.equals=function(t){return t==this||(this.isInfinity()?t.isInfinity():t.isInfinity()?this.isInfinity():!!t.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(t.z)).mod(this.curve.q).equals(A.ZERO)&&t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.q).equals(A.ZERO))},ot.prototype.isInfinity=function(){return null==this.x&&null==this.y||this.z.equals(A.ZERO)&&!this.y.toBigInteger().equals(A.ZERO)},ot.prototype.negate=function(){return new ot(this.curve,this.x,this.y.negate(),this.z)},ot.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(t.z)).mod(this.curve.q),r=t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.q);if(A.ZERO.equals(r))return A.ZERO.equals(e)?this.twice():this.curve.getInfinity();var n=new A("3"),i=this.x.toBigInteger(),s=this.y.toBigInteger(),a=(t.x.toBigInteger(),t.y.toBigInteger(),r.square()),o=a.multiply(r),u=i.multiply(a),c=e.square().multiply(this.z),l=c.subtract(u.shiftLeft(1)).multiply(t.z).subtract(o).multiply(r).mod(this.curve.q),h=u.multiply(n).multiply(e).subtract(s.multiply(o)).subtract(c.multiply(e)).multiply(t.z).add(e.multiply(o)).mod(this.curve.q),f=o.multiply(this.z).multiply(t.z).mod(this.curve.q);return new ot(this.curve,this.curve.fromBigInteger(l),this.curve.fromBigInteger(h),f)},ot.prototype.twice=function(){if(this.isInfinity())return this;if(0==this.y.toBigInteger().signum())return this.curve.getInfinity();var t=new A("3"),e=this.x.toBigInteger(),r=this.y.toBigInteger(),n=r.multiply(this.z),i=n.multiply(r).mod(this.curve.q),s=this.curve.a.toBigInteger(),a=e.square().multiply(t);A.ZERO.equals(s)||(a=a.add(this.z.square().multiply(s)));var o=(a=a.mod(this.curve.q)).square().subtract(e.shiftLeft(3).multiply(i)).shiftLeft(1).multiply(n).mod(this.curve.q),u=a.multiply(t).multiply(e).subtract(i.shiftLeft(1)).shiftLeft(2).multiply(i).subtract(a.square().multiply(a)).mod(this.curve.q),c=n.square().multiply(n).shiftLeft(3).mod(this.curve.q);return new ot(this.curve,this.curve.fromBigInteger(o),this.curve.fromBigInteger(u),c)},ot.prototype.multiply=function(t){if(this.isInfinity())return this;if(0==t.signum())return this.curve.getInfinity();var e,r=t,n=r.multiply(new A("3")),i=this.negate(),s=this,a=this.curve.q.subtract(t),o=a.multiply(new A("3")),u=new ot(this.curve,this.x,this.y),c=u.negate();for(e=n.bitLength()-2;e>0;--e){s=s.twice();var l=n.testBit(e);l!=r.testBit(e)&&(s=s.add(l?this:i))}for(e=o.bitLength()-2;e>0;--e){u=u.twice();var h=o.testBit(e);h!=a.testBit(e)&&(u=u.add(h?u:c))}return s},ot.prototype.multiplyTwo=function(t,e,r){var n;n=t.bitLength()>r.bitLength()?t.bitLength()-1:r.bitLength()-1;for(var i=this.curve.getInfinity(),s=this.add(e);n>=0;)i=i.twice(),t.testBit(n)?i=r.testBit(n)?i.add(s):i.add(this):r.testBit(n)&&(i=i.add(e)),--n;return i},ut.prototype.getQ=function(){return this.q},ut.prototype.getA=function(){return this.a},ut.prototype.getB=function(){return this.b},ut.prototype.equals=function(t){return t==this||this.q.equals(t.q)&&this.a.equals(t.a)&&this.b.equals(t.b)},ut.prototype.getInfinity=function(){return this.infinity},ut.prototype.fromBigInteger=function(t){return new at(this.q,t)},ut.prototype.decodePointHex=function(t){switch(parseInt(t.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:var e=t.substr(0,2),r=(t.substr(2),this.fromBigInteger(new A(o,16))),n=this.getA(),i=this.getB(),s=r.square().add(n).multiply(r).add(i).sqrt();return"03"==e&&(s=s.negate()),new ot(this,r,s);case 4:case 6:case 7:var a=(t.length-2)/2,o=t.substr(2,a),u=t.substr(a+2,a);return new ot(this,this.fromBigInteger(new A(o,16)),this.fromBigInteger(new A(u,16)));default:return null}},at.prototype.getByteLength=function(){return Math.floor((this.toBigInteger().bitLength()+7)/8)},ot.prototype.getEncoded=function(t){var e=function(t,e){var r=t.toByteArrayUnsigned();if(e<r.length)r=r.slice(r.length-e);else for(;e>r.length;)r.unshift(0);return r},r=this.getX().toBigInteger(),n=this.getY().toBigInteger(),i=e(r,32);return t?n.isEven()?i.unshift(2):i.unshift(3):(i.unshift(4),i=i.concat(e(n,32))),i},ot.decodeFrom=function(t,e){e[0];var r=e.length-1,n=e.slice(1,1+r/2),i=e.slice(1+r/2,1+r);n.unshift(0),i.unshift(0);var s=new A(n),a=new A(i);return new ot(t,t.fromBigInteger(s),t.fromBigInteger(a))},ot.decodeFromHex=function(t,e){e.substr(0,2);var r=e.length-2,n=e.substr(2,r/2),i=e.substr(2+r/2,r/2),s=new A(n,16),a=new A(i,16);return new ot(t,t.fromBigInteger(s),t.fromBigInteger(a))},ot.prototype.add2D=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;if(this.x.equals(t.x))return this.y.equals(t.y)?this.twice():this.curve.getInfinity();var e=t.x.subtract(this.x),r=t.y.subtract(this.y).divide(e),n=r.square().subtract(this.x).subtract(t.x),i=r.multiply(this.x.subtract(n)).subtract(this.y);return new ot(this.curve,n,i)},ot.prototype.twice2D=function(){if(this.isInfinity())return this;if(0==this.y.toBigInteger().signum())return this.curve.getInfinity();var t=this.curve.fromBigInteger(A.valueOf(2)),e=this.curve.fromBigInteger(A.valueOf(3)),r=this.x.square().multiply(e).add(this.curve.a).divide(this.y.multiply(t)),n=r.square().subtract(this.x.multiply(t)),i=r.multiply(this.x.subtract(n)).subtract(this.y);return new ot(this.curve,n,i)},ot.prototype.multiply2D=function(t){if(this.isInfinity())return this;if(0==t.signum())return this.curve.getInfinity();var e,r=t,n=r.multiply(new A("3")),i=this.negate(),s=this;for(e=n.bitLength()-2;e>0;--e){s=s.twice();var a=n.testBit(e);a!=r.testBit(e)&&(s=s.add2D(a?this:i))}return s},ot.prototype.isOnCurve=function(){var t=this.getX().toBigInteger(),e=this.getY().toBigInteger(),r=this.curve.getA().toBigInteger(),n=this.curve.getB().toBigInteger(),i=this.curve.getQ(),s=e.multiply(e).mod(i),a=t.multiply(t).multiply(t).add(r.multiply(t)).add(n).mod(i);return s.equals(a)},ot.prototype.toString=function(){return"("+this.getX().toBigInteger().toString()+","+this.getY().toBigInteger().toString()+")"},ot.prototype.validate=function(){var t=this.curve.getQ();if(this.isInfinity())throw new Error("Point is at infinity.");var e=this.getX().toBigInteger(),r=this.getY().toBigInteger();if(e.compareTo(A.ONE)<0||e.compareTo(t.subtract(A.ONE))>0)throw new Error("x coordinate out of bounds");if(r.compareTo(A.ONE)<0||r.compareTo(t.subtract(A.ONE))>0)throw new Error("y coordinate out of bounds");if(!this.isOnCurve())throw new Error("Point is not on the curve.");if(this.multiply(t).isInfinity())throw new Error("Point is not a scalar multiple of G.");return!0};var ct=function(){var t=new RegExp('(?:false|true|null|[\\{\\}\\[\\]]|(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)|(?:"(?:[^\\0-\\x08\\x0a-\\x1f"\\\\]|\\\\(?:["/\\\\bfnrt]|u[0-9A-Fa-f]{4}))*"))',"g"),e=new RegExp("\\\\(?:([^u])|u(.{4}))","g"),r={'"':'"',"/":"/","\\":"\\",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"};function n(t,e,n){return e?r[e]:String.fromCharCode(parseInt(n,16))}var i=new String(""),s=Object.hasOwnProperty;return function(r,a){var o,u,c=r.match(t),l=c[0],h=!1;"{"===l?o={}:"["===l?o=[]:(o=[],h=!0);for(var f=[o],p=1-h,d=c.length;p<d;++p){var g;switch((l=c[p]).charCodeAt(0)){default:(g=f[0])[u||g.length]=+l,u=void 0;break;case 34:if(-1!==(l=l.substring(1,l.length-1)).indexOf("\\")&&(l=l.replace(e,n)),g=f[0],!u){if(!(g instanceof Array)){u=l||i;break}u=g.length}g[u]=l,u=void 0;break;case 91:g=f[0],f.unshift(g[u||g.length]=[]),u=void 0;break;case 93:case 125:f.shift();break;case 102:(g=f[0])[u||g.length]=!1,u=void 0;break;case 110:(g=f[0])[u||g.length]=null,u=void 0;break;case 116:(g=f[0])[u||g.length]=!0,u=void 0;break;case 123:g=f[0],f.unshift(g[u||g.length]={}),u=void 0}}if(h){if(1!==f.length)throw new Error;o=o[0]}else if(f.length)throw new Error;if(a){var y=function(t,e){var r=t[e];if(r&&"object"==typeof r){var n=null;for(var i in r)if(s.call(r,i)&&r!==t){var o=y(r,i);void 0!==o?r[i]=o:(n||(n=[]),n.push(i))}if(n)for(var u=n.length;--u>=0;)delete r[n[u]]}return a.call(t,e,r)};o=y({"":o},"")}return o}}();void 0!==lt&&lt||(lt={}),void 0!==lt.asn1&&lt.asn1||(lt.asn1={}),lt.asn1.ASN1Util=new function(){this.integerToByteHex=function(t){var e=t.toString(16);return e.length%2==1&&(e="0"+e),e},this.bigIntToMinTwosComplementsHex=function(t){return Mt(t)},this.getPEMStringFromHex=function(t,e){return xt(t,e)},this.newObject=function(t){var e=lt.asn1,r=e.ASN1Object,n=e.DERBoolean,i=e.DERInteger,s=e.DERBitString,a=e.DEROctetString,o=e.DERNull,u=e.DERObjectIdentifier,c=e.DEREnumerated,l=e.DERUTF8String,h=e.DERNumericString,f=e.DERPrintableString,p=e.DERTeletexString,d=e.DERIA5String,g=e.DERUTCTime,y=e.DERGeneralizedTime,v=e.DERVisibleString,m=e.DERBMPString,E=e.DERSequence,S=e.DERSet,b=e.DERTaggedObject,C=e.ASN1Util.newObject;if(t instanceof e.ASN1Object)return t;var A=Object.keys(t);if(1!=A.length)throw new Error("key of param shall be only one.");var w=A[0];if(-1==":asn1:bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:visstr:bmpstr:seq:set:tag:".indexOf(":"+w+":"))throw new Error("undefined key: "+w);if("bool"==w)return new n(t[w]);if("int"==w)return new i(t[w]);if("bitstr"==w)return new s(t[w]);if("octstr"==w)return new a(t[w]);if("null"==w)return new o(t[w]);if("oid"==w)return new u(t[w]);if("enum"==w)return new c(t[w]);if("utf8str"==w)return new l(t[w]);if("numstr"==w)return new h(t[w]);if("prnstr"==w)return new f(t[w]);if("telstr"==w)return new p(t[w]);if("ia5str"==w)return new d(t[w]);if("utctime"==w)return new g(t[w]);if("gentime"==w)return new y(t[w]);if("visstr"==w)return new v(t[w]);if("bmpstr"==w)return new m(t[w]);if("asn1"==w)return new r(t[w]);if("seq"==w){for(var x=t[w],B=[],I=0;I<x.length;I++){var T=C(x[I]);B.push(T)}return new E({array:B})}if("set"==w){for(x=t[w],B=[],I=0;I<x.length;I++)T=C(x[I]),B.push(T);return new S({array:B})}if("tag"==w){var F=t[w];if("[object Array]"===Object.prototype.toString.call(F)&&3==F.length){var R=C(F[2]);return new b({tag:F[0],explicit:F[1],obj:R})}return new b(F)}},this.jsonToASN1HEX=function(t){return this.newObject(t).tohex()}},lt.asn1.ASN1Util.oidHexToInt=function(t){for(var e="",r=parseInt(t.substr(0,2),16),n=(e=Math.floor(r/40)+"."+r%40,""),i=2;i<t.length;i+=2){var s=("00000000"+parseInt(t.substr(i,2),16).toString(2)).slice(-8);n+=s.substr(1,7),"0"==s.substr(0,1)&&(e=e+"."+new A(n,2).toString(10),n="")}return e},lt.asn1.ASN1Util.oidIntToHex=function(t){var e=function(t){var e=t.toString(16);return 1==e.length&&(e="0"+e),e},r=function(t){var r="",n=new A(t,10).toString(2),i=7-n.length%7;7==i&&(i=0);for(var s="",a=0;a<i;a++)s+="0";for(n=s+n,a=0;a<n.length-1;a+=7){var o=n.substr(a,7);a!=n.length-7&&(o="1"+o),r+=e(parseInt(o,2))}return r};if(!t.match(/^[0-9.]+$/))throw"malformed oid string: "+t;var n="",i=t.split("."),s=40*parseInt(i[0])+parseInt(i[1]);n+=e(s),i.splice(0,2);for(var a=0;a<i.length;a++)n+=r(i[a]);return n},lt.asn1.ASN1Object=function(t){this.params=null,this.getLengthHexFromValue=function(){if(void 0===this.hV||null==this.hV)throw new Error("this.hV is null or undefined");if(this.hV.length%2==1)throw new Error("value hex must be even length: n=0,v="+this.hV);var t=this.hV.length/2,e=t.toString(16);if(e.length%2==1&&(e="0"+e),t<128)return e;var r=e.length/2;if(r>15)throw new Error("ASN.1 length too long to represent by 8x: n = "+t.toString(16));return(128+r).toString(16)+e},this.tohex=function(){return(null==this.hTLV||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getEncodedHex=function(){return this.tohex()},this.getValueHex=function(){return this.tohex(),this.hV},this.getFreshValueHex=function(){return""},this.setByParam=function(t){this.params=t},null!=t&&null!=t.tlv&&(this.hTLV=t.tlv,this.isModified=!1)},lt.asn1.DERAbstractString=function(t){lt.asn1.DERAbstractString.superclass.constructor.call(this),this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=St(this.s).toLowerCase()},this.setStringHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&("string"==typeof t?this.setString(t):void 0!==t.str?this.setString(t.str):void 0!==t.hex&&this.setStringHex(t.hex))},Wt(lt.asn1.DERAbstractString,lt.asn1.ASN1Object),lt.asn1.DERAbstractTime=function(t){lt.asn1.DERAbstractTime.superclass.constructor.call(this),this.localDateToUTC=function(t){var e=t.getTime()+6e4*t.getTimezoneOffset();return new Date(e)},this.formatDate=function(t,e,r){var n=this.zeroPadding,i=this.localDateToUTC(t),s=String(i.getFullYear());"utc"==e&&(s=s.substr(2,2));var a=s+n(String(i.getMonth()+1),2)+n(String(i.getDate()),2)+n(String(i.getHours()),2)+n(String(i.getMinutes()),2)+n(String(i.getSeconds()),2);if(!0===r){var o=i.getMilliseconds();if(0!=o){var u=n(String(o),3);a=a+"."+(u=u.replace(/[0]+$/,""))}}return a+"Z"},this.zeroPadding=function(t,e){return t.length>=e?t:new Array(e-t.length+1).join("0")+t},this.setByParam=function(t){this.hV=null,this.hTLV=null,this.params=t},this.getString=function(){},this.setString=function(t){this.hTLV=null,this.isModified=!0,null==this.params&&(this.params={}),this.params.str=t},this.setByDate=function(t){this.hTLV=null,this.isModified=!0,null==this.params&&(this.params={}),this.params.date=t},this.setByDateValue=function(t,e,r,n,i,s){var a=new Date(Date.UTC(t,e-1,r,n,i,s,0));this.setByDate(a)},this.getFreshValueHex=function(){return this.hV}},Wt(lt.asn1.DERAbstractTime,lt.asn1.ASN1Object),lt.asn1.DERAbstractStructured=function(t){lt.asn1.DERAbstractString.superclass.constructor.call(this),this.setByASN1ObjectArray=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array=t},this.appendASN1Object=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array.push(t)},this.asn1Array=new Array,void 0!==t&&void 0!==t.array&&(this.asn1Array=t.array)},Wt(lt.asn1.DERAbstractStructured,lt.asn1.ASN1Object),lt.asn1.DERBoolean=function(t){lt.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV=0==t?"010100":"0101ff"},Wt(lt.asn1.DERBoolean,lt.asn1.ASN1Object),lt.asn1.DERInteger=function(t){lt.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.params=null;var e=Mt;this.setByBigInteger=function(t){this.isModified=!0,this.params={bigint:t}},this.setByInteger=function(t){this.isModified=!0,this.params=t},this.setValueHex=function(t){this.isModified=!0,this.params={hex:t}},this.getFreshValueHex=function(){var t=this.params,r=null;if(null==t)throw new Error("value not set");if("object"==typeof t&&null!=t.hex)return this.hV=t.hex,this.hV;if("number"==typeof t)r=new A(String(t),10);else if(null!=t.int)r=new A(String(t.int),10);else{if(null==t.bigint)throw new Error("wrong parameter");r=t.bigint}return this.hV=e(r),this.hV},null!=t&&(this.params=t)},Wt(lt.asn1.DERInteger,lt.asn1.ASN1Object),lt.asn1.DERBitString=function(t){if(void 0!==t&&void 0!==t.obj){var e=lt.asn1.ASN1Util.newObject(t.obj);t.hex="00"+e.tohex()}lt.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(t){this.hTLV=null,this.isModified=!0,this.hV=t},this.setUnusedBitsAndHexValue=function(t,e){if(t<0||7<t)throw"unused bits shall be from 0 to 7: u = "+t;var r="0"+t;this.hTLV=null,this.isModified=!0,this.hV=r+e},this.setByBinaryString=function(t){var e=8-(t=t.replace(/0+$/,"")).length%8;8==e&&(e=0),t+="0000000".substr(0,e);for(var r="",n=0;n<t.length-1;n+=8){var i=t.substr(n,8),s=parseInt(i,2).toString(16);1==s.length&&(s="0"+s),r+=s}this.hTLV=null,this.isModified=!0,this.hV="0"+e+r},this.setByBooleanArray=function(t){for(var e="",r=0;r<t.length;r++)1==t[r]?e+="1":e+="0";this.setByBinaryString(e)},this.newFalseArray=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=!1;return e},this.getFreshValueHex=function(){return this.hV},void 0!==t&&("string"==typeof t&&t.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(t):void 0!==t.hex?this.setHexValueIncludingUnusedBits(t.hex):void 0!==t.bin?this.setByBinaryString(t.bin):void 0!==t.array&&this.setByBooleanArray(t.array))},Wt(lt.asn1.DERBitString,lt.asn1.ASN1Object),lt.asn1.DEROctetString=function(t){if(void 0!==t&&void 0!==t.obj){var e=lt.asn1.ASN1Util.newObject(t.obj);t.hex=e.tohex()}lt.asn1.DEROctetString.superclass.constructor.call(this,t),this.hT="04"},Wt(lt.asn1.DEROctetString,lt.asn1.DERAbstractString),lt.asn1.DERNull=function(){lt.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},Wt(lt.asn1.DERNull,lt.asn1.ASN1Object),lt.asn1.DERObjectIdentifier=function(t){lt.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.setValueOidString=function(t){var e=function(t){var e=function(t){var e=t.toString(16);return 1==e.length&&(e="0"+e),e},r=function(t){var r="",n=parseInt(t,10).toString(2),i=7-n.length%7;7==i&&(i=0);for(var s="",a=0;a<i;a++)s+="0";for(n=s+n,a=0;a<n.length-1;a+=7){var o=n.substr(a,7);a!=n.length-7&&(o="1"+o),r+=e(parseInt(o,2))}return r};try{if(!t.match(/^[0-9.]+$/))return null;var n="",i=t.split("."),s=40*parseInt(i[0],10)+parseInt(i[1],10);n+=e(s),i.splice(0,2);for(var a=0;a<i.length;a++)n+=r(i[a]);return n}catch(t){return null}}(t);if(null==e)throw new Error("malformed oid string: "+t);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.setValueName=function(t){var e=lt.asn1.x509.OID.name2oid(t);if(""===e)throw new Error("DERObjectIdentifier oidName undefined: "+t);this.setValueOidString(e)},this.setValueNameOrOid=function(t){t.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(t):this.setValueName(t)},this.getFreshValueHex=function(){return this.hV},this.setByParam=function(t){"string"==typeof t?this.setValueNameOrOid(t):void 0!==t.oid?this.setValueNameOrOid(t.oid):void 0!==t.name?this.setValueNameOrOid(t.name):void 0!==t.hex&&this.setValueHex(t.hex)},void 0!==t&&this.setByParam(t)},Wt(lt.asn1.DERObjectIdentifier,lt.asn1.ASN1Object),lt.asn1.DEREnumerated=function(t){lt.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=Mt(t)},this.setByInteger=function(t){var e=new A(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.int?this.setByInteger(t.int):"number"==typeof t?this.setByInteger(t):void 0!==t.hex&&this.setValueHex(t.hex))},Wt(lt.asn1.DEREnumerated,lt.asn1.ASN1Object),lt.asn1.DERUTF8String=function(t){lt.asn1.DERUTF8String.superclass.constructor.call(this,t),this.hT="0c"},Wt(lt.asn1.DERUTF8String,lt.asn1.DERAbstractString),lt.asn1.DERNumericString=function(t){lt.asn1.DERNumericString.superclass.constructor.call(this,t),this.hT="12"},Wt(lt.asn1.DERNumericString,lt.asn1.DERAbstractString),lt.asn1.DERPrintableString=function(t){lt.asn1.DERPrintableString.superclass.constructor.call(this,t),this.hT="13"},Wt(lt.asn1.DERPrintableString,lt.asn1.DERAbstractString),lt.asn1.DERTeletexString=function(t){lt.asn1.DERTeletexString.superclass.constructor.call(this,t),this.hT="14"},Wt(lt.asn1.DERTeletexString,lt.asn1.DERAbstractString),lt.asn1.DERIA5String=function(t){lt.asn1.DERIA5String.superclass.constructor.call(this,t),this.hT="16"},Wt(lt.asn1.DERIA5String,lt.asn1.DERAbstractString),lt.asn1.DERVisibleString=function(t){lt.asn1.DERIA5String.superclass.constructor.call(this,t),this.hT="1a"},Wt(lt.asn1.DERVisibleString,lt.asn1.DERAbstractString),lt.asn1.DERBMPString=function(t){lt.asn1.DERBMPString.superclass.constructor.call(this,t),this.hT="1e"},Wt(lt.asn1.DERBMPString,lt.asn1.DERAbstractString),lt.asn1.DERUTCTime=function(t){lt.asn1.DERUTCTime.superclass.constructor.call(this,t),this.hT="17",this.params=void 0,this.getFreshValueHex=function(){var t=this.params;if(null==this.params&&(t={date:new Date}),"string"==typeof t){if(!t.match(/^[0-9]{12}Z$/)&&!t.match(/^[0-9]{12}\.[0-9]+Z$/))throw new Error("malformed string for UTCTime: "+t);this.hV=gt(t)}else if(null!=t.str)this.hV=gt(t.str);else if(null==t.date&&1==t.millis){var e=new Date;this.hV=gt(this.formatDate(e,"utc",!0))}else if(null!=t.date&&t.date instanceof Date){var r=!0===t.millis;this.hV=gt(this.formatDate(t.date,"utc",r))}else t instanceof Date&&(this.hV=gt(this.formatDate(t,"utc")));if(null==this.hV)throw new Error("parameter not specified properly for UTCTime");return this.hV},null!=t&&this.setByParam(t)},Wt(lt.asn1.DERUTCTime,lt.asn1.DERAbstractTime),lt.asn1.DERGeneralizedTime=function(t){lt.asn1.DERGeneralizedTime.superclass.constructor.call(this,t),this.hT="18",this.params=t,this.getFreshValueHex=function(){var t=this.params;if(null==this.params&&(t={date:new Date}),"string"==typeof t){if(!t.match(/^[0-9]{14}Z$/)&&!t.match(/^[0-9]{14}\.[0-9]+Z$/))throw new Error("malformed string for GeneralizedTime: "+t);this.hV=gt(t)}else if(null!=t.str)this.hV=gt(t.str);else if(null==t.date&&1==t.millis){var e=new Date;this.hV=gt(this.formatDate(e,"gen",!0))}else if(null!=t.date&&t.date instanceof Date){var r=!0===t.millis;this.hV=gt(this.formatDate(t.date,"gen",r))}else t instanceof Date&&(this.hV=gt(this.formatDate(t,"gen")));if(null==this.hV)throw new Error("parameter not specified properly for GeneralizedTime");return this.hV},null!=t&&this.setByParam(t)},Wt(lt.asn1.DERGeneralizedTime,lt.asn1.DERAbstractTime),lt.asn1.DERSequence=function(t){lt.asn1.DERSequence.superclass.constructor.call(this,t),this.hT="30",this.getFreshValueHex=function(){for(var t="",e=0;e<this.asn1Array.length;e++)t+=this.asn1Array[e].tohex();return this.hV=t,this.hV}},Wt(lt.asn1.DERSequence,lt.asn1.DERAbstractStructured),lt.asn1.DERSet=function(t){lt.asn1.DERSet.superclass.constructor.call(this,t),this.hT="31",this.sortFlag=!0,this.getFreshValueHex=function(){for(var t=new Array,e=0;e<this.asn1Array.length;e++){var r=this.asn1Array[e];t.push(r.tohex())}return 1==this.sortFlag&&t.sort(),this.hV=t.join(""),this.hV},void 0!==t&&void 0!==t.sortflag&&0==t.sortflag&&(this.sortFlag=!1)},Wt(lt.asn1.DERSet,lt.asn1.DERAbstractStructured),lt.asn1.DERTaggedObject=function(t){lt.asn1.DERTaggedObject.superclass.constructor.call(this);var e=lt.asn1,r=pt,n=r.getV,i=(r.isASN1HEX,e.ASN1Util.newObject);this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.params={tag:"a0",explicit:!0},this.setASN1Object=function(t,e,r){this.params={tag:e,explicit:t,obj:r}},this.getFreshValueHex=function(){var t=this.params;if(null==t.explicit&&(t.explicit=!0),null!=t.tage&&(t.tag=t.tage,t.explicit=!0),null!=t.tagi&&(t.tag=t.tagi,t.explicit=!1),null!=t.str)this.hV=St(t.str);else if(null!=t.hex)this.hV=t.hex;else{if(null==t.obj)throw new Error("str, hex nor obj not specified");var r;t.obj instanceof e.ASN1Object?r=t.obj.tohex():"object"==typeof t.obj&&(r=i(t.obj).tohex()),t.explicit?this.hV=r:this.hV=n(r,0)}return null==t.tag&&(t.tag="a0"),this.hT=t.tag,this.hTLV=null,this.isModified=!0,this.hV},this.setByParam=function(t){this.params=t},void 0!==t&&this.setByParam(t)},Wt(lt.asn1.DERTaggedObject,lt.asn1.ASN1Object);var lt,ht,ft,pt=new function(){};function dt(t){for(var e="",r=0;r<t.length;r++){var n=t[r].toString(16);1==n.length&&(n="0"+n),e+=n}return e}function gt(t){return dt(function(t){for(var e=new Array,r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}(t))}function yt(t){return(t=(t=t.replace(/\=/g,"")).replace(/\+/g,"-")).replace(/\//g,"_")}function vt(t){return t.length%4==2?t+="==":t.length%4==3&&(t+="="),(t=t.replace(/-/g,"+")).replace(/_/g,"/")}function mt(t){return t.length%2==1&&(t="0"+t),yt(b(t))}function Et(t){return C(vt(t))}function St(t){return Tt(_t(t)).toLowerCase()}function bt(t){try{return decodeURIComponent(Ft(t))}catch(t){return null}}function Ct(t){return bt(function(t){for(var e=t.match(/.{1,2}/g),r=[],n=0;n<e.length;n++){var i=parseInt(e[n],16);161<=i&&i<=191?(r.push("c2"),r.push(e[n])):192<=i&&i<=255?(r.push("c3"),r.push((i-64).toString(16))):r.push(e[n])}return r.join("")}(t))}function At(t){for(var e="",r=0;r<t.length-1;r+=2)e+=String.fromCharCode(parseInt(t.substr(r,2),16));return e}function wt(t){for(var e="",r=0;r<t.length;r++)e+=("0"+t.charCodeAt(r).toString(16)).slice(-2);return e}function xt(t,e){return"-----BEGIN "+e+"-----\r\n"+function(t,e){return(t=t.replace(new RegExp("(.{"+e+"})","g"),"$1\r\n")).replace(/\s+$/,"")}(function(t){return b(t)}(t),64)+"\r\n-----END "+e+"-----\r\n"}function Bt(t,e){if(-1==t.indexOf("-----BEGIN "))throw new Error("can't find PEM header");return function(t){return C(t.replace(/[^0-9A-Za-z\/+=]*/g,""))}(t=void 0!==e?(t=t.replace(new RegExp("^[^]*-----BEGIN "+e+"-----"),"")).replace(new RegExp("-----END "+e+"-----[^]*$"),""):(t=t.replace(/^[^]*-----BEGIN [^-]+-----/,"")).replace(/-----END [^-]+-----[^]*$/,""))}function It(t){return Math.round(function(t){var e,r,n,i,s,a,o,u,c,l;if(l=(t=function(t){return t.match(/^[0-9]{12}Z$/)||t.match(/^[0-9]{12}[.][0-9]*Z$/)?t.match(/^[0-4]/)?"20"+t:"19"+t:t}(t)).match(/^(\d{4})(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(|\.\d+)Z$/))return e=parseInt(l[1]),r=parseInt(l[2])-1,n=parseInt(l[3]),i=parseInt(l[4]),s=parseInt(l[5]),a=parseInt(l[6]),o=0,""!==(u=l[7])&&(c=(u.substr(1)+"00").substr(0,3),o=parseInt(c)),Date.UTC(e,r,n,i,s,a,o);throw new Error("unsupported zulu format: "+t)}(t)/1e3)}function Tt(t){return t.replace(/%/g,"")}function Ft(t){return t.replace(/(..)/g,"%$1")}function Rt(t){var e="malformed IPv6 address";if(!t.match(/^[0-9A-Fa-f:]+$/))throw e;var r=(t=t.toLowerCase()).split(":").length-1;if(r<2)throw e;var n=":".repeat(7-r+2),i=(t=t.replace("::",n)).split(":");if(8!=i.length)throw e;for(var s=0;s<8;s++)i[s]=("0000"+i[s]).slice(-4);return i.join("")}function Nt(t){if(!t.match(/^[0-9A-Fa-f]{32}$/))throw new Error("malformed IPv6 address: "+t);var e=(t=t.toLowerCase()).match(/.{1,4}/g);e=e.map((function(t){return t.replace(/^0+/,"")})),e=e.map((function(t){return""==t?"0":t}));var r=(t=":"+e.join(":")+":").match(/:(0:){2,}/g);if(null==r)return t.slice(1,-1);var n=r.sort().slice(-1)[0];return"::"!=(t=t.replace(n.substr(0,n.length-1),":")).substr(0,2)&&(t=t.substr(1)),"::"!=t.substr(-2,2)&&(t=t.substr(0,t.length-1)),t}function Dt(t){var e=new Error("malformed hex value");if(!t.match(/^([0-9A-Fa-f][0-9A-Fa-f]){1,}$/))throw e;if(8==t.length)try{return parseInt(t.substr(0,2),16)+"."+parseInt(t.substr(2,2),16)+"."+parseInt(t.substr(4,2),16)+"."+parseInt(t.substr(6,2),16)}catch(t){throw e}else{if(16!=t.length){if(32==t.length)return Nt(t);if(64==t.length){try{return Nt(t.substr(0,32))+"/"+Pt(t.substr(32))}catch(t){throw e}return}return t}try{return Dt(t.substr(0,8))+"/"+Pt(t.substr(8))}catch(t){throw e}}}function Pt(t){var e,r=new Error("malformed mask");try{e=new A(t,16).toString(2)}catch(t){throw r}if(!e.match(/^1*0*$/))throw r;return e.replace(/0+$/,"").length}function kt(t){var e=new Error("malformed IP address");if(!(t=t.toLowerCase(t)).match(/^[0-9a-f.:/]+$/))throw e;if(!t.match(/^[0-9.]+$/)){var r;if(t.match(/^[0-9.]+\/[0-9]+$/))return kt((r=t.split("/"))[0])+Lt(parseInt(r[1]),32);if(t.match(/^[0-9a-f:]+$/)&&-1!==t.indexOf(":"))return Rt(t);if(t.match(/^[0-9a-f:]+\/[0-9]+$/)&&-1!==t.indexOf(":"))return Rt((r=t.split("/"))[0])+Lt(parseInt(r[1]),128);throw e}var n=t.split(".");if(4!==n.length)throw e;var i="";try{for(var s=0;s<4;s++)i+=("0"+parseInt(n[s]).toString(16)).slice(-2);return i}catch(t){throw e}}function Lt(t,e){return 32==e&&0==t?"00000000":128==e&&0==t?"00000000000000000000000000000000":new A(Array(t+1).join("1")+Array(e-t+1).join("0"),2).toString(16)}function Ot(t){var e=t.match(/.{4}/g).map((function(t){var e=parseInt(t.substr(0,2),16),r=parseInt(t.substr(2),16);if(0==e&r<128)return String.fromCharCode(r);if(e<8){var n=128|63&r;return bt((192|(7&e)<<3|(192&r)>>6).toString(16)+n.toString(16))}n=128|(15&e)<<2|(192&r)>>6;var i=128|63&r;return bt((224|(240&e)>>4).toString(16)+n.toString(16)+i.toString(16))}));return e.join("")}function _t(t){for(var e=encodeURIComponent(t),r="",n=0;n<e.length;n++)"%"==e[n]?(r+=e.substr(n,3),n+=2):r=r+"%"+gt(e[n]);return r}function Ut(t){return!(t.length%2!=0||!t.match(/^[0-9a-f]+$/)&&!t.match(/^[0-9A-F]+$/))}function Vt(t){return!!t.match(/^[0-9A-Za-z-_.]+$/)}function Ht(t){return t.length%2==1?"0"+t:t.substr(0,1)>"7"?"00"+t:t}function Kt(t){if(!Ut(t))return null;try{var e=[],r=t.substr(0,2),n=parseInt(r,16);e[0]=new String(Math.floor(n/40)),e[1]=new String(n%40);for(var i=t.substr(2),s=[],a=0;a<i.length/2;a++)s.push(parseInt(i.substr(2*a,2),16));var o=[],u="";for(a=0;a<s.length;a++)128&s[a]?u+=qt((127&s[a]).toString(2),7):(u+=qt((127&s[a]).toString(2),7),o.push(new String(parseInt(u,2))),u="");var c=e.join(".");return o.length>0&&(c=c+"."+o.join(".")),c}catch(t){return null}}function jt(t){return Mt(new A(String(t),10))}function Mt(t){var e=t.toString(16);if("-"!=e.substr(0,1))return e.length%2==1?e="0"+e:e.match(/^[0-7]/)||(e="00"+e),e;var r=e.substr(1).length;r%2==1?r+=1:e.match(/^[0-7]/)||(r+=2);for(var n="",i=0;i<r;i++)n+="f";return new A(n,16).xor(t).add(A.ONE).toString(16).replace(/^-/,"")}pt.getLblen=function(t,e){if("8"!=t.substr(e+2,1))return 1;var r=parseInt(t.substr(e+3,1));return 0==r?-1:0<r&&r<10?r+1:-2},pt.getL=function(t,e){var r=pt.getLblen(t,e);return r<1?"":t.substr(e+2,2*r)},pt.getVblen=function(t,e){var r;return""==(r=pt.getL(t,e))?-1:("8"===r.substr(0,1)?new A(r.substr(2),16):new A(r,16)).intValue()},pt.getVidx=function(t,e){var r=pt.getLblen(t,e);return r<0?r:e+2*(r+1)},pt.getV=function(t,e){var r=pt.getVidx(t,e),n=pt.getVblen(t,e);return t.substr(r,2*n)},pt.getTLV=function(t,e){return t.substr(e,2)+pt.getL(t,e)+pt.getV(t,e)},pt.getTLVblen=function(t,e){return 2+2*pt.getLblen(t,e)+2*pt.getVblen(t,e)},pt.getNextSiblingIdx=function(t,e){return pt.getVidx(t,e)+2*pt.getVblen(t,e)},pt.getChildIdx=function(t,e){var r,n,i,s=pt,a=[];r=s.getVidx(t,e),n=2*s.getVblen(t,e),"03"==t.substr(e,2)&&(r+=2,n-=2),i=0;for(var o=r;i<=n;){var u=s.getTLVblen(t,o);if((i+=u)<=n&&a.push(o),o+=u,i>=n)break}return a},pt.getNthChildIdx=function(t,e,r){return pt.getChildIdx(t,e)[r]},pt.getIdxbyList=function(t,e,r,n){var i,s,a=pt;return 0==r.length?void 0!==n&&t.substr(e,2)!==n?-1:e:(i=r.shift())>=(s=a.getChildIdx(t,e)).length?-1:a.getIdxbyList(t,s[i],r,n)},pt.getIdxbyListEx=function(t,e,r,n){var i,s,a=pt;if(0==r.length)return void 0!==n&&t.substr(e,2)!==n?-1:e;i=r.shift(),s=a.getChildIdx(t,e);for(var o=0,u=0;u<s.length;u++){var c=t.substr(s[u],2);if("number"==typeof i&&!a.isContextTag(c)&&o==i||"string"==typeof i&&a.isContextTag(c,i))return a.getIdxbyListEx(t,s[u],r,n);a.isContextTag(c)||o++}return-1},pt.getTLVbyList=function(t,e,r,n){var i=pt,s=i.getIdxbyList(t,e,r,n);return-1==s||s>=t.length?null:i.getTLV(t,s)},pt.getTLVbyListEx=function(t,e,r,n){var i=pt,s=i.getIdxbyListEx(t,e,r,n);return-1==s?null:i.getTLV(t,s)},pt.getVbyList=function(t,e,r,n,i){var s,a,o=pt;return-1==(s=o.getIdxbyList(t,e,r,n))||s>=t.length?null:(a=o.getV(t,s),!0===i&&(a=a.substr(2)),a)},pt.getVbyListEx=function(t,e,r,n,i){var s,a,o=pt;return-1==(s=o.getIdxbyListEx(t,e,r,n))?null:(a=o.getV(t,s),"03"==t.substr(s,2)&&!1!==i&&(a=a.substr(2)),a)},pt.getInt=function(t,e,r){null==r&&(r=-1);try{var n=t.substr(e,2);if("02"!=n&&"03"!=n)return r;var i=pt.getV(t,e);return"02"==n?parseInt(i,16):function(t){if(t.length%2!=0)return-1;if(null==(t=t.toLowerCase()).match(/^[0-9a-f]+$/))return-1;try{var e=t.substr(0,2);if("00"==e)return parseInt(t.substr(2),16);var r=parseInt(e,16);if(r>7)return-1;var n=t.substr(2),i=parseInt(n,16).toString(2);"0"==i&&(i="00000000"),i=i.slice(0,0-r);var s=parseInt(i,2);return NaN==s?-1:s}catch(t){return-1}}(i)}catch(t){return r}},pt.getOID=function(t,e,r){null==r&&(r=null);try{return"06"!=t.substr(e,2)?r:Kt(pt.getV(t,e))}catch(t){return r}},pt.getOIDName=function(t,e,r){null==r&&(r=null);try{var n=pt.getOID(t,e,r);if(n==r)return r;var i=lt.asn1.x509.OID.oid2name(n);return""==i?n:i}catch(t){return r}},pt.getString=function(t,e,r){null==r&&(r=null);try{return At(pt.getV(t,e))}catch(t){return r}},pt.hextooidstr=function(t){var e=function(t,e){return t.length>=e?t:new Array(e-t.length+1).join("0")+t},r=[],n=t.substr(0,2),i=parseInt(n,16);r[0]=new String(Math.floor(i/40)),r[1]=new String(i%40);for(var s=t.substr(2),a=[],o=0;o<s.length/2;o++)a.push(parseInt(s.substr(2*o,2),16));var u=[],c="";for(o=0;o<a.length;o++)128&a[o]?c+=e((127&a[o]).toString(2),7):(c+=e((127&a[o]).toString(2),7),u.push(new String(parseInt(c,2))),c="");var l=r.join(".");return u.length>0&&(l=l+"."+u.join(".")),l},pt.dump=function(t,e,r,n){var i=pt,s=i.getV,a=i.dump,o=i.getChildIdx,u=t;t instanceof lt.asn1.ASN1Object&&(u=t.tohex());var c=function(t,e){return t.length<=2*e?t:t.substr(0,e)+"..(total "+t.length/2+"bytes).."+t.substr(t.length-e,e)};void 0===e&&(e={ommit_long_octet:32}),void 0===r&&(r=0),void 0===n&&(n="");var l,h=e.ommit_long_octet;if("01"==(l=u.substr(r,2)))return"00"==(f=s(u,r))?n+"BOOLEAN FALSE\n":n+"BOOLEAN TRUE\n";if("02"==l)return n+"INTEGER "+c(f=s(u,r),h)+"\n";if("03"==l){var f=s(u,r);return i.isASN1HEX(f.substr(2))?(b=n+"BITSTRING, encapsulates\n")+a(f.substr(2),e,0,n+" "):n+"BITSTRING "+c(f,h)+"\n"}if("04"==l)return f=s(u,r),i.isASN1HEX(f)?(b=n+"OCTETSTRING, encapsulates\n")+a(f,e,0,n+" "):n+"OCTETSTRING "+c(f,h)+"\n";if("05"==l)return n+"NULL\n";if("06"==l){var p=s(u,r),d=lt.asn1.ASN1Util.oidHexToInt(p),g=lt.asn1.x509.OID.oid2name(d),y=d.replace(/\./g," ");return""!=g?n+"ObjectIdentifier "+g+" ("+y+")\n":n+"ObjectIdentifier ("+y+")\n"}if("0a"==l)return n+"ENUMERATED "+parseInt(s(u,r))+"\n";if("0c"==l)return n+"UTF8String '"+bt(s(u,r))+"'\n";if("13"==l)return n+"PrintableString '"+bt(s(u,r))+"'\n";if("14"==l)return n+"TeletexString '"+bt(s(u,r))+"'\n";if("16"==l)return n+"IA5String '"+bt(s(u,r))+"'\n";if("17"==l)return n+"UTCTime "+bt(s(u,r))+"\n";if("18"==l)return n+"GeneralizedTime "+bt(s(u,r))+"\n";if("1a"==l)return n+"VisualString '"+bt(s(u,r))+"'\n";if("1e"==l)return n+"BMPString '"+Ot(s(u,r))+"'\n";if("30"==l){if("3000"==u.substr(r,4))return n+"SEQUENCE {}\n";b=n+"SEQUENCE\n";var v=e;if((2==(S=o(u,r)).length||3==S.length)&&"06"==u.substr(S[0],2)&&"04"==u.substr(S[S.length-1],2)){g=i.oidname(s(u,S[0]));var m=JSON.parse(JSON.stringify(e));m.x509ExtName=g,v=m}for(var E=0;E<S.length;E++)b+=a(u,v,S[E],n+" ");return b}if("31"==l){b=n+"SET\n";var S=o(u,r);for(E=0;E<S.length;E++)b+=a(u,e,S[E],n+" ");return b}if(0!=(128&(l=parseInt(l,16)))){var b,C=31&l;if(0!=(32&l)){for(b=n+"["+C+"]\n",S=o(u,r),E=0;E<S.length;E++)b+=a(u,e,S[E],n+" ");return b}return f=s(u,r),pt.isASN1HEX(f)?(b=n+"["+C+"]\n")+a(f,e,0,n+" "):(("68747470"==f.substr(0,8)||"subjectAltName"===e.x509ExtName&&2==C)&&(f=bt(f)),n+"["+C+"] "+f+"\n")}return n+"UNKNOWN("+l+") "+s(u,r)+"\n"},pt.parse=function(t){var e=pt,r=e.parse,n=e.isASN1HEX,i=e.getV,s=e.getTLV,a=e.getChildIdx,o=lt.asn1,u=o.ASN1Util.oidHexToInt,c=o.x509.OID.oid2name,l=bt,h=Ot,f=Ct,p={"0c":"utf8str",12:"numstr",13:"prnstr",14:"telstr",16:"ia5str",17:"utctime",18:"gentime","1a":"visstr","1e":"bmpstr",30:"seq",31:"set"},d=t.substr(0,2),g={},y=i(t,0);if("01"==d)return"0101ff"==t?{bool:!0}:{bool:!1};if("02"==d)return{int:{hex:y}};if("03"==d)try{if("00"!=y.substr(0,2))throw"not encap";var v=y.substr(2);if(!n(v))throw"not encap";return{bitstr:{obj:r(v)}}}catch(t){var m=null;return y.length<=10&&(m=function(t){if("string"!=typeof t)return null;if(t.length%2!=0)return null;if(!t.match(/^[0-9a-f]+$/))return null;try{var e=parseInt(t.substr(0,2),16);if(e<0||7<e)return null;for(var r=t.substr(2),n="",i=0;i<r.length;i+=2){var s=r.substr(i,2),a=parseInt(s,16).toString(2);n+=a=("0000000"+a).slice(-8)}return n.substr(0,n.length-e)}catch(t){return null}}(y)),null==m?{bitstr:{hex:y}}:{bitstr:{bin:m}}}else if("04"==d)try{if(!n(y))throw"not encap";return{octstr:{obj:r(y)}}}catch(t){return{octstr:{hex:y}}}else{if("05"==d)return{null:""};if("06"==d){var E=u(y),S=c(E);return""==S?{oid:E}:{oid:S}}if("0a"==d)return y.length>4?{enum:{hex:y}}:{enum:parseInt(y,16)};if("30"==d||"31"==d)return g[p[d]]=function(t){for(var e=[],n=a(t,0),i=0;i<n.length;i++){var o=n[i],u=s(t,o),c=r(u);e.push(c)}return e}(t),g;if("14"==d){var b=f(y);return g[p[d]]={str:b},g}if("1e"==d)return b=h(y),g[p[d]]={str:b},g;if(-1!=":0c:12:13:16:17:18:1a:".indexOf(d))return b=l(y),g[p[d]]={str:b},g;if(d.match(/^8[0-9]$/))return null==(b=l(y))|""==b||null!=b.match(/[\x00-\x1F\x7F-\x9F]/)||null!=b.match(/[\u0000-\u001F\u0080\u009F]/)?{tag:{tag:d,explicit:!1,hex:y}}:{tag:{tag:d,explicit:!1,str:b}};if(!d.match(/^a[0-9]$/)){var C=new lt.asn1.ASN1Object;return C.hV=y,{asn1:{tlv:d+C.getLengthHexFromValue()+y}}}try{if(!n(y))throw new Error("not encap");return{tag:{tag:d,explicit:!0,obj:r(y)}}}catch(t){return{tag:{tag:d,explicit:!0,hex:y}}}}},pt.isContextTag=function(t,e){var r,n;t=t.toLowerCase();try{r=parseInt(t,16)}catch(t){return-1}if(void 0===e)return 128==(192&r);try{return null!=e.match(/^\[[0-9]+\]$/)&&!((n=parseInt(e.substr(1,e.length-1),10))>31)&&128==(192&r)&&(31&r)==n}catch(t){return!1}},pt.isASN1HEX=function(t){var e=pt;if(t.length%2==1)return!1;var r=e.getVblen(t,0),n=t.substr(0,2),i=e.getL(t,0);return t.length-n.length-i.length==2*r},pt.checkStrictDER=function(t,e,r,n,i){var s=pt;if(void 0===r){if("string"!=typeof t)throw new Error("not hex string");if(t=t.toLowerCase(),!lt.lang.String.isHex(t))throw new Error("not hex string");r=t.length,i=(n=t.length/2)<128?1:Math.ceil(n.toString(16))+1}if(s.getL(t,e).length>2*i)throw new Error("L of TLV too long: idx="+e);var a=s.getVblen(t,e);if(a>n)throw new Error("value of L too long than hex: idx="+e);var o=s.getTLV(t,e),u=o.length-2-s.getL(t,e).length;if(u!==2*a)throw new Error("V string length and L's value not the same:"+u+"/"+2*a);if(0===e&&t.length!=o.length)throw new Error("total length and TLV length unmatch:"+t.length+"!="+o.length);var c=t.substr(e,2);if("02"===c){var l=s.getVidx(t,e);if("00"==t.substr(l,2)&&t.charCodeAt(l+2)<56)throw new Error("not least zeros for DER INTEGER")}if(32&parseInt(c,16)){for(var h=s.getVblen(t,e),f=0,p=s.getChildIdx(t,e),d=0;d<p.length;d++)f+=s.getTLV(t,p[d]).length,s.checkStrictDER(t,p[d],r,n,i);if(2*h!=f)throw new Error("sum of children's TLV length and L unmatch: "+2*h+"!="+f)}},pt.oidname=function(t){var e=lt.asn1;lt.lang.String.isHex(t)&&(t=e.ASN1Util.oidHexToInt(t));var r=e.x509.OID.oid2name(t);return""===r&&(r=t),r},void 0!==lt&&lt||(lt={}),void 0!==lt.asn1&&lt.asn1||(lt.asn1={}),void 0!==lt.asn1.x509&&lt.asn1.x509||(lt.asn1.x509={}),lt.asn1.x509.Certificate=function(t){lt.asn1.x509.Certificate.superclass.constructor.call(this);var e=lt.asn1,r=e.DERBitString,n=e.DERSequence,i=e.x509,s=i.TBSCertificate,a=i.AlgorithmIdentifier;this.params=void 0,this.setByParam=function(t){this.params=t},this.sign=function(){var t=this.params,e=t.sigalg;null!=t.sigalg.name&&(e=t.sigalg.name);var r=t.tbsobj.tohex(),n=new lt.crypto.Signature({alg:e});n.init(t.cakey),n.updateHex(r),t.sighex=n.sign()},this.getPEM=function(){return xt(this.tohex(),"CERTIFICATE")},this.tohex=function(){var t=this.params;if(null!=t.tbsobj&&null!=t.tbsobj||(t.tbsobj=new s(t)),null==t.sighex&&null!=t.cakey&&this.sign(),null==t.sighex)throw new Error("sighex or cakey parameter not defined");var e=[];return e.push(t.tbsobj),e.push(new a({name:t.sigalg})),e.push(new r({hex:"00"+t.sighex})),new n({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&(this.params=t)},Wt(lt.asn1.x509.Certificate,lt.asn1.ASN1Object),lt.asn1.x509.TBSCertificate=function(t){lt.asn1.x509.TBSCertificate.superclass.constructor.call(this);var e=lt.asn1,r=e.x509,n=e.DERTaggedObject,i=e.DERInteger,s=e.DERSequence,a=r.AlgorithmIdentifier,o=r.Time,u=r.X500Name,c=r.Extensions,l=r.SubjectPublicKeyInfo;this.params=null,this.setByParam=function(t){this.params=t},this.tohex=function(){var t=[],e=this.params;if(null!=e.version||1!=e.version){var r=2;null!=e.version&&(r=e.version-1);var h=new n({obj:new i({int:r})});t.push(h)}return t.push(new i(e.serial)),t.push(new a({name:e.sigalg})),t.push(new u(e.issuer)),t.push(new s({array:[new o(e.notbefore),new o(e.notafter)]})),t.push(new u(e.subject)),t.push(new l($t.getKey(e.sbjpubkey))),void 0!==e.ext&&e.ext.length>0&&t.push(new n({tag:"a3",obj:new c(e.ext)})),new lt.asn1.DERSequence({array:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},Wt(lt.asn1.x509.TBSCertificate,lt.asn1.ASN1Object),lt.asn1.x509.Extensions=function(t){lt.asn1.x509.Extensions.superclass.constructor.call(this);var e=lt.asn1,r=e.DERSequence,n=e.x509;this.aParam=[],this.setByParam=function(t){this.aParam=t},this.tohex=function(){for(var t=[],e=0;e<this.aParam.length;e++){var i=this.aParam[e],s=i.extname,a=null;if(null!=i.extn)a=new n.PrivateExtension(i);else if("subjectKeyIdentifier"==s)a=new n.SubjectKeyIdentifier(i);else if("keyUsage"==s)a=new n.KeyUsage(i);else if("subjectAltName"==s)a=new n.SubjectAltName(i);else if("issuerAltName"==s)a=new n.IssuerAltName(i);else if("basicConstraints"==s)a=new n.BasicConstraints(i);else if("nameConstraints"==s)a=new n.NameConstraints(i);else if("cRLDistributionPoints"==s)a=new n.CRLDistributionPoints(i);else if("certificatePolicies"==s)a=new n.CertificatePolicies(i);else if("policyMappings"==s)a=new n.PolicyMappings(i);else if("policyConstraints"==s)a=new n.PolicyConstraints(i);else if("inhibitAnyPolicy"==s)a=new n.InhibitAnyPolicy(i);else if("authorityKeyIdentifier"==s)a=new n.AuthorityKeyIdentifier(i);else if("extKeyUsage"==s)a=new n.ExtKeyUsage(i);else if("authorityInfoAccess"==s)a=new n.AuthorityInfoAccess(i);else if("cRLNumber"==s)a=new n.CRLNumber(i);else if("cRLReason"==s)a=new n.CRLReason(i);else if("ocspNonce"==s)a=new n.OCSPNonce(i);else if("ocspNoCheck"==s)a=new n.OCSPNoCheck(i);else if("adobeTimeStamp"==s)a=new n.AdobeTimeStamp(i);else{if("subjectDirectoryAttributes"!=s)throw new Error("extension not supported:"+JSON.stringify(i));a=new n.SubjectDirectoryAttributes(i)}null!=a&&t.push(a)}return new r({array:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Wt(lt.asn1.x509.Extensions,lt.asn1.ASN1Object),lt.asn1.x509.Extension=function(t){lt.asn1.x509.Extension.superclass.constructor.call(this);var e=lt.asn1,r=e.DERObjectIdentifier,n=e.DEROctetString,i=(e.DERBitString,e.DERBoolean),s=e.DERSequence;this.tohex=function(){var t=new r({oid:this.oid}),e=new n({hex:this.getExtnValueHex()}),a=new Array;return a.push(t),this.critical&&a.push(new i),a.push(e),new s({array:a}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.critical=!1,void 0!==t&&void 0!==t.critical&&(this.critical=t.critical)},Wt(lt.asn1.x509.Extension,lt.asn1.ASN1Object),lt.asn1.x509.KeyUsage=function(t){lt.asn1.x509.KeyUsage.superclass.constructor.call(this,t);var e=Error,r={digitalSignature:0,nonRepudiation:1,keyEncipherment:2,dataEncipherment:3,keyAgreement:4,keyCertSign:5,cRLSign:6,encipherOnly:7,decipherOnly:8};this.getExtnValueHex=function(){var t=this.getBinValue();return this.asn1ExtnValue=new lt.asn1.DERBitString({bin:t}),this.asn1ExtnValue.tohex()},this.getBinValue=function(){var t=this.params;if("object"!=typeof t||"object"!=typeof t.names&&"string"!=typeof t.bin)throw new e("parameter not yet set");if(null!=t.names)return Gt(t.names,r);if(null!=t.bin)return t.bin;throw new e("parameter not set properly")},this.oid="2.5.29.15",void 0!==t&&(this.params=t)},Wt(lt.asn1.x509.KeyUsage,lt.asn1.x509.Extension),lt.asn1.x509.BasicConstraints=function(t){lt.asn1.x509.BasicConstraints.superclass.constructor.call(this,t);var e=lt.asn1,r=e.DERBoolean,n=e.DERInteger,i=e.DERSequence;this.getExtnValueHex=function(){var t=new Array;this.cA&&t.push(new r),this.pathLen>-1&&t.push(new n({int:this.pathLen}));var e=new i({array:t});return this.asn1ExtnValue=e,this.asn1ExtnValue.tohex()},this.oid="2.5.29.19",this.cA=!1,this.pathLen=-1,void 0!==t&&(void 0!==t.cA&&(this.cA=t.cA),void 0!==t.pathLen&&(this.pathLen=t.pathLen))},Wt(lt.asn1.x509.BasicConstraints,lt.asn1.x509.Extension),lt.asn1.x509.CRLDistributionPoints=function(t){lt.asn1.x509.CRLDistributionPoints.superclass.constructor.call(this,t);var e=lt.asn1,r=e.x509;this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.setByDPArray=function(t){for(var n=[],i=0;i<t.length;i++)if(t[i]instanceof lt.asn1.ASN1Object)n.push(t[i]);else{var s=new r.DistributionPoint(t[i]);n.push(s)}this.asn1ExtnValue=new e.DERSequence({array:n})},this.setByOneURI=function(t){var e=new r.DistributionPoint({fulluri:t});this.setByDPArray([e])},this.oid="2.5.29.31",void 0!==t&&(void 0!==t.array?this.setByDPArray(t.array):void 0!==t.uri&&this.setByOneURI(t.uri))},Wt(lt.asn1.x509.CRLDistributionPoints,lt.asn1.x509.Extension),lt.asn1.x509.DistributionPoint=function(t){lt.asn1.x509.DistributionPoint.superclass.constructor.call(this);var e=lt.asn1,r=e.x509.DistributionPointName;this.tohex=function(){var t=new e.DERSequence;if(null!=this.asn1DP){var r=new e.DERTaggedObject({explicit:!0,tag:"a0",obj:this.asn1DP});t.appendASN1Object(r)}return this.hTLV=t.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&(void 0!==t.dpobj?this.asn1DP=t.dpobj:void 0!==t.dpname?this.asn1DP=new r(t.dpname):void 0!==t.fulluri&&(this.asn1DP=new r({full:[{uri:t.fulluri}]})))},Wt(lt.asn1.x509.DistributionPoint,lt.asn1.ASN1Object),lt.asn1.x509.DistributionPointName=function(t){lt.asn1.x509.DistributionPointName.superclass.constructor.call(this);var e=lt.asn1,r=e.DERTaggedObject;if(this.tohex=function(){if("full"!=this.type)throw new Error("currently type shall be 'full': "+this.type);return this.asn1Obj=new r({explicit:!1,tag:this.tag,obj:this.asn1V}),this.hTLV=this.asn1Obj.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==t)if(e.x509.GeneralNames.prototype.isPrototypeOf(t))this.type="full",this.tag="a0",this.asn1V=t;else{if(void 0===t.full)throw new Error("This class supports GeneralNames only as argument");this.type="full",this.tag="a0",this.asn1V=new e.x509.GeneralNames(t.full)}},Wt(lt.asn1.x509.DistributionPointName,lt.asn1.ASN1Object),lt.asn1.x509.CertificatePolicies=function(t){lt.asn1.x509.CertificatePolicies.superclass.constructor.call(this,t);var e=lt.asn1,r=e.x509,n=e.DERSequence,i=r.PolicyInformation;this.params=null,this.getExtnValueHex=function(){for(var t=[],e=0;e<this.params.array.length;e++)t.push(new i(this.params.array[e]));var r=new n({array:t});return this.asn1ExtnValue=r,this.asn1ExtnValue.tohex()},this.oid="2.5.29.32",void 0!==t&&(this.params=t)},Wt(lt.asn1.x509.CertificatePolicies,lt.asn1.x509.Extension),lt.asn1.x509.PolicyInformation=function(t){lt.asn1.x509.PolicyInformation.superclass.constructor.call(this,t);var e=lt.asn1,r=e.DERSequence,n=e.DERObjectIdentifier,i=e.x509.PolicyQualifierInfo;this.params=null,this.tohex=function(){if(void 0===this.params.policyoid&&void 0===this.params.array)throw new Error("parameter oid and array missing");var t=[new n(this.params.policyoid)];if(void 0!==this.params.array){for(var e=[],s=0;s<this.params.array.length;s++)e.push(new i(this.params.array[s]));e.length>0&&t.push(new r({array:e}))}return new r({array:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&(this.params=t)},Wt(lt.asn1.x509.PolicyInformation,lt.asn1.ASN1Object),lt.asn1.x509.PolicyQualifierInfo=function(t){lt.asn1.x509.PolicyQualifierInfo.superclass.constructor.call(this,t);var e=lt.asn1,r=e.DERSequence,n=e.DERIA5String,i=e.DERObjectIdentifier,s=e.x509.UserNotice;this.params=null,this.tohex=function(){return void 0!==this.params.cps?new r({array:[new i({oid:"1.3.6.1.5.5.7.2.1"}),new n({str:this.params.cps})]}).tohex():null!=this.params.unotice?new r({array:[new i({oid:"1.3.6.1.5.5.7.2.2"}),new s(this.params.unotice)]}).tohex():void 0},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&(this.params=t)},Wt(lt.asn1.x509.PolicyQualifierInfo,lt.asn1.ASN1Object),lt.asn1.x509.UserNotice=function(t){lt.asn1.x509.UserNotice.superclass.constructor.call(this,t);var e=lt.asn1.DERSequence,r=(lt.asn1.DERInteger,lt.asn1.x509.DisplayText),n=lt.asn1.x509.NoticeReference;this.params=null,this.tohex=function(){var t=[];return void 0!==this.params.noticeref&&t.push(new n(this.params.noticeref)),void 0!==this.params.exptext&&t.push(new r(this.params.exptext)),new e({array:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&(this.params=t)},Wt(lt.asn1.x509.UserNotice,lt.asn1.ASN1Object),lt.asn1.x509.NoticeReference=function(t){lt.asn1.x509.NoticeReference.superclass.constructor.call(this,t);var e=lt.asn1.DERSequence,r=lt.asn1.DERInteger,n=lt.asn1.x509.DisplayText;this.params=null,this.tohex=function(){var t=[];if(void 0!==this.params.org&&t.push(new n(this.params.org)),void 0!==this.params.noticenum){for(var i=[],s=this.params.noticenum,a=0;a<s.length;a++)i.push(new r(s[a]));t.push(new e({array:i}))}if(0==t.length)throw new Error("parameter is empty");return new e({array:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&(this.params=t)},Wt(lt.asn1.x509.NoticeReference,lt.asn1.ASN1Object),lt.asn1.x509.DisplayText=function(t){lt.asn1.x509.DisplayText.superclass.constructor.call(this,t),this.hT="0c",void 0!==t&&("ia5"===t.type?this.hT="16":"vis"===t.type?this.hT="1a":"bmp"===t.type&&(this.hT="1e"))},Wt(lt.asn1.x509.DisplayText,lt.asn1.DERAbstractString),lt.asn1.x509.PolicyMappings=function(t){lt.asn1.x509.PolicyMappings.superclass.constructor.call(this,t);var e=lt.asn1,r=(e.x509,e.ASN1Util.newObject);this.params=null,this.getExtnValueHex=function(){for(var t=this.params,e=[],n=0;n<t.array.length;n++){var i=t.array[n];e.push({seq:[{oid:i[0]},{oid:i[1]}]})}return this.asn1ExtnValue=r({seq:e}),this.asn1ExtnValue.tohex()},this.oid="2.5.29.33",void 0!==t&&(this.params=t)},Wt(lt.asn1.x509.PolicyMappings,lt.asn1.x509.Extension),lt.asn1.x509.PolicyConstraints=function(t){lt.asn1.x509.PolicyConstraints.superclass.constructor.call(this,t);var e=lt.asn1,r=(e.x509,e.ASN1Util.newObject);this.params=null,this.getExtnValueHex=function(){var t=this.params,e=[];return null!=t.reqexp&&e.push({tag:{tagi:"80",obj:{int:t.reqexp}}}),null!=t.inhibit&&e.push({tag:{tagi:"81",obj:{int:t.inhibit}}}),this.asn1ExtnValue=r({seq:e}),this.asn1ExtnValue.tohex()},this.oid="2.5.29.36",void 0!==t&&(this.params=t)},Wt(lt.asn1.x509.PolicyConstraints,lt.asn1.x509.Extension),lt.asn1.x509.InhibitAnyPolicy=function(t){lt.asn1.x509.InhibitAnyPolicy.superclass.constructor.call(this,t);var e=lt.asn1,r=(e.x509,e.ASN1Util.newObject);this.params=null,this.getExtnValueHex=function(){return this.asn1ExtnValue=r({int:this.params.skip}),this.asn1ExtnValue.tohex()},this.oid="2.5.29.54",void 0!==t&&(this.params=t)},Wt(lt.asn1.x509.InhibitAnyPolicy,lt.asn1.x509.Extension),lt.asn1.x509.NameConstraints=function(t){lt.asn1.x509.NameConstraints.superclass.constructor.call(this,t);var e=lt.asn1,r=e.x509,n=e.ASN1Util.newObject,i=r.GeneralSubtree;this.params=null,this.getExtnValueHex=function(){var t=this.params,e=[];if(null!=t.permit&&null!=t.permit.length){for(var r=[],s=0;s<t.permit.length;s++)r.push(new i(t.permit[s]));e.push({tag:{tagi:"a0",obj:{seq:r}}})}if(null!=t.exclude&&null!=t.exclude.length){var a=[];for(s=0;s<t.exclude.length;s++)a.push(new i(t.exclude[s]));e.push({tag:{tagi:"a1",obj:{seq:a}}})}return this.asn1ExtnValue=n({seq:e}),this.asn1ExtnValue.tohex()},this.oid="2.5.29.30",void 0!==t&&(this.params=t)},Wt(lt.asn1.x509.NameConstraints,lt.asn1.x509.Extension),lt.asn1.x509.GeneralSubtree=function(t){lt.asn1.x509.GeneralSubtree.superclass.constructor.call(this);var e=lt.asn1,r=e.x509.GeneralName,n=e.ASN1Util.newObject;this.params=null,this.setByParam=function(t){this.params=t},this.tohex=function(){var t=this.params,e=[new r(t)];return null!=t.min&&e.push({tag:{tagi:"80",obj:{int:t.min}}}),null!=t.max&&e.push({tag:{tagi:"81",obj:{int:t.max}}}),n({seq:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},Wt(lt.asn1.x509.GeneralSubtree,lt.asn1.ASN1Object),lt.asn1.x509.ExtKeyUsage=function(t){lt.asn1.x509.ExtKeyUsage.superclass.constructor.call(this,t);var e=lt.asn1;this.setPurposeArray=function(t){this.asn1ExtnValue=new e.DERSequence;for(var r=0;r<t.length;r++){var n=new e.DERObjectIdentifier(t[r]);this.asn1ExtnValue.appendASN1Object(n)}},this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.oid="2.5.29.37",void 0!==t&&void 0!==t.array&&this.setPurposeArray(t.array)},Wt(lt.asn1.x509.ExtKeyUsage,lt.asn1.x509.Extension),lt.asn1.x509.AuthorityKeyIdentifier=function(t){lt.asn1.x509.AuthorityKeyIdentifier.superclass.constructor.call(this,t);var e=lt,r=e.asn1,n=r.DERTaggedObject,i=r.x509.GeneralNames;e.crypto.Util.isKey,this.asn1KID=null,this.asn1CertIssuer=null,this.asn1CertSN=null,this.getExtnValueHex=function(){var t=new Array;this.asn1KID&&t.push(new n({explicit:!1,tag:"80",obj:this.asn1KID})),this.asn1CertIssuer&&t.push(new n({explicit:!1,tag:"a1",obj:new i([{dn:this.asn1CertIssuer}])})),this.asn1CertSN&&t.push(new n({explicit:!1,tag:"82",obj:this.asn1CertSN}));var e=new r.DERSequence({array:t});return this.asn1ExtnValue=e,this.asn1ExtnValue.tohex()},this.setKIDByParam=function(t){if(void 0!==t.str||void 0!==t.hex)this.asn1KID=new lt.asn1.DEROctetString(t);else if("object"==typeof t&&lt.crypto.Util.isKey(t)||"string"==typeof t&&-1!=t.indexOf("BEGIN ")){var e=t;"string"==typeof t&&(e=$t.getKey(t));var r=$t.getKeyID(e);this.asn1KID=new lt.asn1.DEROctetString({hex:r})}},this.setCertIssuerByParam=function(t){void 0!==t.str||void 0!==t.ldapstr||void 0!==t.hex||void 0!==t.certsubject||void 0!==t.certissuer?this.asn1CertIssuer=new lt.asn1.x509.X500Name(t):"string"==typeof t&&-1!=t.indexOf("BEGIN ")&&-1!=t.indexOf("CERTIFICATE")&&(this.asn1CertIssuer=new lt.asn1.x509.X500Name({certissuer:t}))},this.setCertSNByParam=function(t){if(void 0!==t.str||void 0!==t.bigint||void 0!==t.hex)this.asn1CertSN=new lt.asn1.DERInteger(t);else if("string"==typeof t&&-1!=t.indexOf("BEGIN ")&&t.indexOf("CERTIFICATE")){var e=new Jt;e.readCertPEM(t);var r=e.getSerialNumberHex();this.asn1CertSN=new lt.asn1.DERInteger({hex:r})}},this.oid="2.5.29.35",void 0!==t&&(void 0!==t.kid&&this.setKIDByParam(t.kid),void 0!==t.issuer&&this.setCertIssuerByParam(t.issuer),void 0!==t.sn&&this.setCertSNByParam(t.sn),void 0!==t.issuersn&&"string"==typeof t.issuersn&&-1!=t.issuersn.indexOf("BEGIN ")&&t.issuersn.indexOf("CERTIFICATE")&&(this.setCertSNByParam(t.issuersn),this.setCertIssuerByParam(t.issuersn)))},Wt(lt.asn1.x509.AuthorityKeyIdentifier,lt.asn1.x509.Extension),lt.asn1.x509.SubjectKeyIdentifier=function(t){lt.asn1.x509.SubjectKeyIdentifier.superclass.constructor.call(this,t);var e=lt.asn1.DEROctetString;this.asn1KID=null,this.getExtnValueHex=function(){return this.asn1ExtnValue=this.asn1KID,this.asn1ExtnValue.tohex()},this.setKIDByParam=function(t){if(void 0!==t.str||void 0!==t.hex)this.asn1KID=new e(t);else if("object"==typeof t&&lt.crypto.Util.isKey(t)||"string"==typeof t&&-1!=t.indexOf("BEGIN")){var r=t;"string"==typeof t&&(r=$t.getKey(t));var n=$t.getKeyID(r);this.asn1KID=new lt.asn1.DEROctetString({hex:n})}},this.oid="2.5.29.14",void 0!==t&&void 0!==t.kid&&this.setKIDByParam(t.kid)},Wt(lt.asn1.x509.SubjectKeyIdentifier,lt.asn1.x509.Extension),lt.asn1.x509.AuthorityInfoAccess=function(t){lt.asn1.x509.AuthorityInfoAccess.superclass.constructor.call(this,t),this.setAccessDescriptionArray=function(t){for(var e=new Array,r=lt.asn1,n=r.DERSequence,i=r.DERObjectIdentifier,s=r.x509.GeneralName,a=0;a<t.length;a++){var o,u=t[a];if(void 0!==u.ocsp)o=new n({array:[new i({oid:"1.3.6.1.5.5.7.48.1"}),new s({uri:u.ocsp})]});else{if(void 0===u.caissuer)throw new Error("unknown AccessMethod parameter: "+JSON.stringify(u));o=new n({array:[new i({oid:"1.3.6.1.5.5.7.48.2"}),new s({uri:u.caissuer})]})}e.push(o)}this.asn1ExtnValue=new n({array:e})},this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.oid="1.3.6.1.5.5.7.1.1",void 0!==t&&void 0!==t.array&&this.setAccessDescriptionArray(t.array)},Wt(lt.asn1.x509.AuthorityInfoAccess,lt.asn1.x509.Extension),lt.asn1.x509.SubjectAltName=function(t){lt.asn1.x509.SubjectAltName.superclass.constructor.call(this,t),this.setNameArray=function(t){this.asn1ExtnValue=new lt.asn1.x509.GeneralNames(t)},this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.oid="2.5.29.17",void 0!==t&&void 0!==t.array&&this.setNameArray(t.array)},Wt(lt.asn1.x509.SubjectAltName,lt.asn1.x509.Extension),lt.asn1.x509.IssuerAltName=function(t){lt.asn1.x509.IssuerAltName.superclass.constructor.call(this,t),this.setNameArray=function(t){this.asn1ExtnValue=new lt.asn1.x509.GeneralNames(t)},this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.oid="2.5.29.18",void 0!==t&&void 0!==t.array&&this.setNameArray(t.array)},Wt(lt.asn1.x509.IssuerAltName,lt.asn1.x509.Extension),lt.asn1.x509.SubjectDirectoryAttributes=function(t){lt.asn1.x509.SubjectDirectoryAttributes.superclass.constructor.call(this,t);var e=lt.asn1,r=e.DERSequence,n=e.ASN1Util.newObject,i=e.x509.OID.name2oid;this.params=null,this.getExtnValueHex=function(){for(var t=[],e=0;e<this.params.array.length;e++){var s=this.params.array[e];if(null==s.attr||null==s.array){var a={seq:[{oid:"1.2.3.4"},{set:[{utf8str:"DE"}]}]};if("dateOfBirth"==s.attr)a.seq[0].oid=i(s.attr),a.seq[1].set[0]={gentime:s.str};else if("placeOfBirth"==s.attr)a.seq[0].oid=i(s.attr),a.seq[1].set[0]={utf8str:s.str};else if("gender"==s.attr)a.seq[0].oid=i(s.attr),a.seq[1].set[0]={prnstr:s.str};else if("countryOfCitizenship"==s.attr)a.seq[0].oid=i(s.attr),a.seq[1].set[0]={prnstr:s.str};else{if("countryOfResidence"!=s.attr)throw new Error("unsupported attribute: "+s.attr);a.seq[0].oid=i(s.attr),a.seq[1].set[0]={prnstr:s.str}}t.push(new n(a))}else{var o={seq:[{oid:s.attr},{set:s.array}]};t.push(n(o))}}var u=new r({array:t});return this.asn1ExtnValue=u,this.asn1ExtnValue.tohex()},this.oid="2.5.29.9",void 0!==t&&(this.params=t)},Wt(lt.asn1.x509.SubjectDirectoryAttributes,lt.asn1.x509.Extension),lt.asn1.x509.PrivateExtension=function(t){lt.asn1.x509.PrivateExtension.superclass.constructor.call(this,t);var e=lt,r=e.lang.String.isHex,n=e.asn1,i=n.x509.OID.name2oid,s=n.ASN1Util.newObject;this.params=null,this.setByParam=function(t){this.oid=i(t.extname),this.params=t},this.getExtnValueHex=function(){if(null==this.params.extname||null==this.params.extn)throw new Error("extname or extnhex not specified");var t=this.params.extn;if("string"==typeof t&&r(t))return t;if("object"==typeof t)try{return s(t).tohex()}catch(t){}throw new Error("unsupported extn value")},null!=t&&this.setByParam(t)},Wt(lt.asn1.x509.PrivateExtension,lt.asn1.x509.Extension),lt.asn1.x509.CRL=function(t){lt.asn1.x509.CRL.superclass.constructor.call(this);var e=lt.asn1,r=e.DERSequence,n=e.DERBitString,i=e.x509,s=i.AlgorithmIdentifier,a=i.TBSCertList;this.params=void 0,this.setByParam=function(t){this.params=t},this.sign=function(){var t=new a(this.params).tohex(),e=new lt.crypto.Signature({alg:this.params.sigalg});e.init(this.params.cakey),e.updateHex(t);var r=e.sign();this.params.sighex=r},this.getPEM=function(){return xt(this.tohex(),"X509 CRL")},this.tohex=function(){var t=this.params;if(null==t.tbsobj&&(t.tbsobj=new a(t)),null==t.sighex&&null!=t.cakey&&this.sign(),null==t.sighex)throw new Error("sighex or cakey parameter not defined");var e=[];return e.push(t.tbsobj),e.push(new s({name:t.sigalg})),e.push(new n({hex:"00"+t.sighex})),new r({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&(this.params=t)},Wt(lt.asn1.x509.CRL,lt.asn1.ASN1Object),lt.asn1.x509.TBSCertList=function(t){lt.asn1.x509.TBSCertList.superclass.constructor.call(this);var e=lt.asn1,r=e.DERInteger,n=e.DERSequence,i=e.DERTaggedObject,s=(e.DERObjectIdentifier,e.x509),a=s.AlgorithmIdentifier,o=s.Time,u=s.Extensions,c=s.X500Name;this.params=null,this.setByParam=function(t){this.params=t},this.getRevCertSequence=function(){for(var t=[],e=this.params.revcert,i=0;i<e.length;i++){var s=[new r(e[i].sn),new o(e[i].date)];null!=e[i].ext&&s.push(new u(e[i].ext)),t.push(new n({array:s}))}return new n({array:t})},this.tohex=function(){var t=[],e=this.params;if(null!=e.version){var s=e.version-1,l=new r({int:s});t.push(l)}if(t.push(new a({name:e.sigalg})),t.push(new c(e.issuer)),t.push(new o(e.thisupdate)),null!=e.nextupdate&&t.push(new o(e.nextupdate)),null!=e.revcert&&t.push(this.getRevCertSequence()),null!=e.ext){var h=new u(e.ext);t.push(new i({tag:"a0",explicit:!0,obj:h}))}return new n({array:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},Wt(lt.asn1.x509.TBSCertList,lt.asn1.ASN1Object),lt.asn1.x509.CRLEntry=function(t){lt.asn1.x509.CRLEntry.superclass.constructor.call(this);var e=lt.asn1;this.setCertSerial=function(t){this.sn=new e.DERInteger(t)},this.setRevocationDate=function(t){this.time=new e.x509.Time(t)},this.tohex=function(){var t=new e.DERSequence({array:[this.sn,this.time]});return this.TLV=t.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&(void 0!==t.time&&this.setRevocationDate(t.time),void 0!==t.sn&&this.setCertSerial(t.sn))},Wt(lt.asn1.x509.CRLEntry,lt.asn1.ASN1Object),lt.asn1.x509.CRLNumber=function(t){lt.asn1.x509.CRLNumber.superclass.constructor.call(this,t),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new lt.asn1.DERInteger(this.params.num),this.asn1ExtnValue.tohex()},this.oid="2.5.29.20",null!=t&&(this.params=t)},Wt(lt.asn1.x509.CRLNumber,lt.asn1.x509.Extension),lt.asn1.x509.CRLReason=function(t){lt.asn1.x509.CRLReason.superclass.constructor.call(this,t),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new lt.asn1.DEREnumerated(this.params.code),this.asn1ExtnValue.tohex()},this.oid="2.5.29.21",null!=t&&(this.params=t)},Wt(lt.asn1.x509.CRLReason,lt.asn1.x509.Extension),lt.asn1.x509.OCSPNonce=function(t){lt.asn1.x509.OCSPNonce.superclass.constructor.call(this,t),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new lt.asn1.DEROctetString(this.params),this.asn1ExtnValue.tohex()},this.oid="1.3.6.1.5.5.7.48.1.2",null!=t&&(this.params=t)},Wt(lt.asn1.x509.OCSPNonce,lt.asn1.x509.Extension),lt.asn1.x509.OCSPNoCheck=function(t){lt.asn1.x509.OCSPNoCheck.superclass.constructor.call(this,t),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new lt.asn1.DERNull,this.asn1ExtnValue.tohex()},this.oid="1.3.6.1.5.5.7.48.1.5",null!=t&&(this.params=t)},Wt(lt.asn1.x509.OCSPNoCheck,lt.asn1.x509.Extension),lt.asn1.x509.AdobeTimeStamp=function(t){lt.asn1.x509.AdobeTimeStamp.superclass.constructor.call(this,t);var e=lt.asn1,r=e.DERInteger,n=e.DERBoolean,i=e.DERSequence,s=e.x509.GeneralName;this.params=null,this.getExtnValueHex=function(){var t=this.params,e=[new r(1)];return e.push(new s({uri:t.uri})),null!=t.reqauth&&e.push(new n(t.reqauth)),this.asn1ExtnValue=new i({array:e}),this.asn1ExtnValue.tohex()},this.oid="1.2.840.113583.1.1.9.1",void 0!==t&&this.setByParam(t)},Wt(lt.asn1.x509.AdobeTimeStamp,lt.asn1.x509.Extension),lt.asn1.x509.X500Name=function(t){lt.asn1.x509.X500Name.superclass.constructor.call(this),this.asn1Array=[],this.paramArray=[],this.sRule="utf8";var e=lt.asn1,r=e.x509,n=r.RDN;this.setByString=function(t,e){void 0!==e&&(this.sRule=e);var r=t.split("/");r.shift();for(var i=[],s=0;s<r.length;s++)if(r[s].match(/^[^=]+=.+$/))i.push(r[s]);else{var a=i.length-1;i[a]=i[a]+"/"+r[s]}for(s=0;s<i.length;s++)this.asn1Array.push(new n({str:i[s],rule:this.sRule}))},this.setByLdapString=function(t,e){void 0!==e&&(this.sRule=e);var n=r.X500Name.ldapToCompat(t);this.setByString(n,e)},this.setByObject=function(t,e){for(var r in void 0!==e&&(this.sRule=e),t)if(t.hasOwnProperty(r)){var i=new n({str:r+"="+t[r],rule:this.sRule});this.asn1Array?this.asn1Array.push(i):this.asn1Array=[i]}},this.setByParam=function(t){var e;void 0!==t.rule&&(this.sRule=t.rule),void 0!==t.array?this.paramArray=t.array:void 0!==t.str?this.setByString(t.str):void 0!==t.ldapstr?this.setByLdapString(t.ldapstr):void 0!==t.hex?this.hTLV=t.hex:void 0!==t.certissuer?((e=new Jt).readCertPEM(t.certissuer),this.hTLV=e.getIssuerHex()):void 0!==t.certsubject?((e=new Jt).readCertPEM(t.certsubject),this.hTLV=e.getSubjectHex()):"object"==typeof t&&void 0===t.certsubject&&void 0===t.certissuer&&this.setByObject(t)},this.tohex=function(){if("string"==typeof this.hTLV)return this.hTLV;if(0==this.asn1Array.length&&this.paramArray.length>0)for(var t=0;t<this.paramArray.length;t++){var r={array:this.paramArray[t]};"utf8"!=this.sRule&&(r.rule=this.sRule);var i=new n(r);this.asn1Array.push(i)}var s=new e.DERSequence({array:this.asn1Array});return this.hTLV=s.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},Wt(lt.asn1.x509.X500Name,lt.asn1.ASN1Object),lt.asn1.x509.X500Name.compatToLDAP=function(t){if("/"!==t.substr(0,1))throw"malformed input";var e=(t=t.substr(1)).split("/");return e.reverse(),e=e.map((function(t){return t.replace(/,/,"\\,")})),e.join(",")},lt.asn1.x509.X500Name.onelineToLDAP=function(t){return lt.asn1.x509.X500Name.compatToLDAP(t)},lt.asn1.x509.X500Name.ldapToCompat=function(t){for(var e=t.split(","),r=!1,n=[],i=0;e.length>0;i++){var s=e.shift();if(!0===r){var a=(n.pop()+","+s).replace(/\\,/g,",");n.push(a),r=!1}else n.push(s);"\\"===s.substr(-1,1)&&(r=!0)}return n=n.map((function(t){return t.replace("/","\\/")})),n.reverse(),"/"+n.join("/")},lt.asn1.x509.X500Name.ldapToOneline=function(t){return lt.asn1.x509.X500Name.ldapToCompat(t)},lt.asn1.x509.RDN=function(t){lt.asn1.x509.RDN.superclass.constructor.call(this),this.asn1Array=[],this.paramArray=[],this.sRule="utf8";var e=lt.asn1.x509.AttributeTypeAndValue;this.setByParam=function(t){void 0!==t.rule&&(this.sRule=t.rule),void 0!==t.str&&this.addByMultiValuedString(t.str),void 0!==t.array&&(this.paramArray=t.array)},this.addByString=function(t){this.asn1Array.push(new lt.asn1.x509.AttributeTypeAndValue({str:t,rule:this.sRule}))},this.addByMultiValuedString=function(t){for(var e=lt.asn1.x509.RDN.parseString(t),r=0;r<e.length;r++)this.addByString(e[r])},this.tohex=function(){if(0==this.asn1Array.length&&this.paramArray.length>0)for(var t=0;t<this.paramArray.length;t++){var r=this.paramArray[t];void 0!==r.rule&&"utf8"!=this.sRule&&(r.rule=this.sRule);var n=new e(r);this.asn1Array.push(n)}var i=new lt.asn1.DERSet({array:this.asn1Array});return this.TLV=i.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},Wt(lt.asn1.x509.RDN,lt.asn1.ASN1Object),lt.asn1.x509.RDN.parseString=function(t){for(var e=t.split(/\+/),r=!1,n=[],i=0;e.length>0;i++){var s=e.shift();if(!0===r){var a=(n.pop()+"+"+s).replace(/\\\+/g,"+");n.push(a),r=!1}else n.push(s);"\\"===s.substr(-1,1)&&(r=!0)}var o=!1,u=[];for(i=0;n.length>0;i++){if(s=n.shift(),!0===o){var c=u.pop();s.match(/"$/)?(a=(c+"+"+s).replace(/^([^=]+)="(.*)"$/,"$1=$2"),u.push(a),o=!1):u.push(c+"+"+s)}else u.push(s);s.match(/^[^=]+="/)&&(o=!0)}return u},lt.asn1.x509.AttributeTypeAndValue=function(t){lt.asn1.x509.AttributeTypeAndValue.superclass.constructor.call(this),this.sRule="utf8",this.sType=null,this.sValue=null,this.dsType=null;var e=lt,r=e.asn1,n=r.DERSequence,i=r.DERUTF8String,s=r.DERPrintableString,a=r.DERTeletexString,o=r.DERIA5String,u=r.DERVisibleString,c=r.DERBMPString,l=e.lang.String.isMail,h=e.lang.String.isPrintable;this.setByParam=function(t){if(void 0!==t.rule&&(this.sRule=t.rule),void 0!==t.ds&&(this.dsType=t.ds),void 0===t.value&&void 0!==t.str){var e=t.str.match(/^([^=]+)=(.+)$/);if(!e)throw new Error("malformed attrTypeAndValueStr: "+attrTypeAndValueStr);this.sType=e[1],this.sValue=e[2]}else this.sType=t.type,this.sValue=t.value},this.setByString=function(t,e){void 0!==e&&(this.sRule=e);var r=t.match(/^([^=]+)=(.+)$/);if(!r)throw new Error("malformed attrTypeAndValueStr: "+attrTypeAndValueStr);this.setByAttrTypeAndValueStr(r[1],r[2])},this._getDsType=function(){var t=this.sType,e=this.sValue,r=this.sRule;return"prn"===r?"CN"==t&&l(e)?"ia5":h(e)?"prn":"utf8":"utf8"===r?"CN"==t&&l(e)?"ia5":"C"==t?"prn":"utf8":"utf8"},this.setByAttrTypeAndValueStr=function(t,e,r){void 0!==r&&(this.sRule=r),this.sType=t,this.sValue=e},this.getValueObj=function(t,e){if("utf8"==t)return new i({str:e});if("prn"==t)return new s({str:e});if("tel"==t)return new a({str:e});if("ia5"==t)return new o({str:e});if("vis"==t)return new u({str:e});if("bmp"==t)return new c({str:e});throw new Error("unsupported directory string type: type="+t+" value="+e)},this.tohex=function(){null==this.dsType&&(this.dsType=this._getDsType());var t=lt.asn1.x509.OID.atype2obj(this.sType),e=this.getValueObj(this.dsType,this.sValue),r=new n({array:[t,e]});return this.TLV=r.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},Wt(lt.asn1.x509.AttributeTypeAndValue,lt.asn1.ASN1Object),lt.asn1.x509.SubjectPublicKeyInfo=function(t){lt.asn1.x509.SubjectPublicKeyInfo.superclass.constructor.call(this);var e=lt,r=e.asn1,n=r.DERInteger,i=r.DERBitString,s=r.DERObjectIdentifier,a=r.DERSequence,o=r.ASN1Util.newObject,u=r.x509.AlgorithmIdentifier,c=e.crypto;c.ECDSA,c.DSA,this.getASN1Object=function(){if(null==this.asn1AlgId||null==this.asn1SubjPKey)throw"algId and/or subjPubKey not set";return new a({array:[this.asn1AlgId,this.asn1SubjPKey]})},this.tohex=function(){var t=this.getASN1Object();return this.hTLV=t.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},this.setPubKey=function(t){try{if(t instanceof st){var e=o({seq:[{int:{bigint:t.n}},{int:{int:t.e}}]}).tohex();this.asn1AlgId=new u({name:"rsaEncryption"}),this.asn1SubjPKey=new i({hex:"00"+e})}}catch(t){}try{if(t instanceof lt.crypto.ECDSA){var r=new s({name:t.curveName});this.asn1AlgId=new u({name:"ecPublicKey",asn1params:r}),this.asn1SubjPKey=new i({hex:"00"+t.pubKeyHex})}}catch(t){}try{if(t instanceof lt.crypto.DSA){r=new o({seq:[{int:{bigint:t.p}},{int:{bigint:t.q}},{int:{bigint:t.g}}]}),this.asn1AlgId=new u({name:"dsa",asn1params:r});var a=new n({bigint:t.y});this.asn1SubjPKey=new i({hex:"00"+a.tohex()})}}catch(t){}},void 0!==t&&this.setPubKey(t)},Wt(lt.asn1.x509.SubjectPublicKeyInfo,lt.asn1.ASN1Object),lt.asn1.x509.Time=function(t){lt.asn1.x509.Time.superclass.constructor.call(this);var e=lt.asn1,r=e.DERUTCTime,n=e.DERGeneralizedTime;this.params=null,this.type=null,this.setTimeParams=function(t){this.timeParams=t},this.setByParam=function(t){this.params=t},this.getType=function(t){return t.match(/^[0-9]{12}Z$/)?"utc":t.match(/^[0-9]{14}Z$/)?"gen":t.match(/^[0-9]{12}\.[0-9]+Z$/)?"utc":t.match(/^[0-9]{14}\.[0-9]+Z$/)?"gen":null},this.tohex=function(){var t=this.params,e=null;if("string"==typeof t&&(t={str:t}),null==t||!t.str||null!=t.type&&null!=t.type||(t.type=this.getType(t.str)),null!=t&&t.str?("utc"==t.type&&(e=new r(t.str)),"gen"==t.type&&(e=new n(t.str))):e="gen"==this.type?new n:new r,null==e)throw new Error("wrong setting for Time");return this.TLV=e.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},lt.asn1.x509.Time_bak=function(t){lt.asn1.x509.Time_bak.superclass.constructor.call(this);var e=lt.asn1,r=e.DERUTCTime,n=e.DERGeneralizedTime;this.setTimeParams=function(t){this.timeParams=t},this.tohex=function(){var t=null;return t=null!=this.timeParams?"utc"==this.type?new r(this.timeParams):new n(this.timeParams):"utc"==this.type?new r:new n,this.TLV=t.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},this.type="utc",void 0!==t&&(void 0!==t.type?this.type=t.type:void 0!==t.str&&(t.str.match(/^[0-9]{12}Z$/)&&(this.type="utc"),t.str.match(/^[0-9]{14}Z$/)&&(this.type="gen")),this.timeParams=t)},Wt(lt.asn1.x509.Time,lt.asn1.ASN1Object),lt.asn1.x509.AlgorithmIdentifier=function(t){lt.asn1.x509.AlgorithmIdentifier.superclass.constructor.call(this),this.nameAlg=null,this.asn1Alg=null,this.asn1Params=null,this.paramEmpty=!1;var e=lt.asn1,r=e.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV;if(this.tohex=function(){if(null===this.nameAlg&&null===this.asn1Alg)throw new Error("algorithm not specified");if(null!==this.nameAlg){var t=null;for(var n in r)n===this.nameAlg&&(t=r[n]);if(null!==t)return this.hTLV=t,this.hTLV}null!==this.nameAlg&&null===this.asn1Alg&&(this.asn1Alg=e.x509.OID.name2obj(this.nameAlg));var i=[this.asn1Alg];null!==this.asn1Params&&i.push(this.asn1Params);var s=new e.DERSequence({array:i});return this.hTLV=s.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&(void 0!==t.name&&(this.nameAlg=t.name),void 0!==t.asn1params&&(this.asn1Params=t.asn1params),void 0!==t.paramempty&&(this.paramEmpty=t.paramempty)),null===this.asn1Params&&!1===this.paramEmpty&&null!==this.nameAlg){void 0!==this.nameAlg.name&&(this.nameAlg=this.nameAlg.name);var n=this.nameAlg.toLowerCase();"withdsa"!==n.substr(-7,7)&&"withecdsa"!==n.substr(-9,9)&&(this.asn1Params=new e.DERNull)}},Wt(lt.asn1.x509.AlgorithmIdentifier,lt.asn1.ASN1Object),lt.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV={SHAwithRSAandMGF1:"300d06092a864886f70d01010a3000",SHA256withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040201a11a301806092a864886f70d010108300b0609608648016503040201a203020120",SHA384withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040202a11a301806092a864886f70d010108300b0609608648016503040202a203020130",SHA512withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040203a11a301806092a864886f70d010108300b0609608648016503040203a203020140"},lt.asn1.x509.GeneralName=function(t){lt.asn1.x509.GeneralName.superclass.constructor.call(this);var e=lt.asn1,r=e.x509,n=r.X500Name,i=r.OtherName,s=e.DERIA5String,a=(e.DERPrintableString,e.DEROctetString),o=e.DERTaggedObject,u=e.ASN1Object,c=Error;this.params=null,this.setByParam=function(t){this.params=t},this.tohex=function(){var t,e,r=this.params,l=!1;if(void 0!==r.other)t="a0",e=new i(r.other);else if(void 0!==r.rfc822)t="81",e=new s({str:r.rfc822});else if(void 0!==r.dns)t="82",e=new s({str:r.dns});else if(void 0!==r.dn)t="a4",l=!0,e="string"==typeof r.dn?new n({str:r.dn}):r.dn instanceof lt.asn1.x509.X500Name?r.dn:new n(r.dn);else if(void 0!==r.ldapdn)t="a4",l=!0,e=new n({ldapstr:r.ldapdn});else if(void 0!==r.certissuer||void 0!==r.certsubj){var h,f;t="a4",l=!0;var p=null;if(void 0!==r.certsubj?(h=!1,f=r.certsubj):(h=!0,f=r.certissuer),f.match(/^[0-9A-Fa-f]+$/),-1!=f.indexOf("-----BEGIN ")&&(p=Bt(f)),null==p)throw new Error("certsubj/certissuer not cert");var d,g=new Jt;g.hex=p,d=h?g.getIssuerHex():g.getSubjectHex(),(e=new u).hTLV=d}else if(void 0!==r.uri)t="86",e=new s({str:r.uri});else{if(void 0===r.ip)throw new c("improper params");var y;t="87";var v=r.ip;try{if(v.match(/^[0-9a-f]+$/)){var m=v.length;if(8!=m&&16!=m&&32!=m&&64!=m)throw"err";y=v}else y=kt(v)}catch(t){throw new c("malformed IP address: "+r.ip+":"+t.message)}e=new a({hex:y})}return new o({tag:t,explicit:l,obj:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},Wt(lt.asn1.x509.GeneralName,lt.asn1.ASN1Object),lt.asn1.x509.GeneralNames=function(t){lt.asn1.x509.GeneralNames.superclass.constructor.call(this);var e=lt.asn1;this.setByParamArray=function(t){for(var r=0;r<t.length;r++){var n=new e.x509.GeneralName(t[r]);this.asn1Array.push(n)}},this.tohex=function(){return new e.DERSequence({array:this.asn1Array}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.asn1Array=new Array,void 0!==t&&this.setByParamArray(t)},Wt(lt.asn1.x509.GeneralNames,lt.asn1.ASN1Object),lt.asn1.x509.OtherName=function(t){lt.asn1.x509.OtherName.superclass.constructor.call(this);var e=lt.asn1,r=e.DERObjectIdentifier,n=e.DERSequence,i=e.ASN1Util.newObject;this.params=null,this.setByParam=function(t){this.params=t},this.tohex=function(){var t=this.params;if(null==t.oid||null==t.value)throw new Error("oid or value not specified");var e=new r({oid:t.oid}),s=i({tag:{tag:"a0",explicit:!0,obj:t.value}});return new n({array:[e,s]}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},Wt(lt.asn1.x509.OtherName,lt.asn1.ASN1Object),lt.asn1.x509.OID=new function(){var t=lt.asn1.DERObjectIdentifier;this.name2oidList={"aes128-CBC":"2.16.840.1.101.3.4.1.2","aes256-CBC":"2.16.840.1.101.3.4.1.42",sha1:"1.3.14.3.2.26",sha256:"2.16.840.1.101.3.4.2.1",sha384:"2.16.840.1.101.3.4.2.2",sha512:"2.16.840.1.101.3.4.2.3",sha224:"2.16.840.1.101.3.4.2.4",md5:"1.2.840.113549.2.5",md2:"1.3.14.7.2.2.1",ripemd160:"1.3.36.3.2.1",hmacWithSHA1:"1.2.840.113549.2.7",hmacWithSHA224:"1.2.840.113549.2.8",hmacWithSHA256:"1.2.840.113549.2.9",hmacWithSHA384:"1.2.840.113549.2.10",hmacWithSHA512:"1.2.840.113549.2.11",MD2withRSA:"1.2.840.113549.1.1.2",MD4withRSA:"1.2.840.113549.1.1.3",MD5withRSA:"1.2.840.113549.1.1.4",SHA1withRSA:"1.2.840.113549.1.1.5","pkcs1-MGF":"1.2.840.113549.1.1.8",rsaPSS:"1.2.840.113549.1.1.10",SHA224withRSA:"1.2.840.113549.1.1.14",SHA256withRSA:"1.2.840.113549.1.1.11",SHA384withRSA:"1.2.840.113549.1.1.12",SHA512withRSA:"1.2.840.113549.1.1.13",SHA1withECDSA:"1.2.840.10045.4.1",SHA224withECDSA:"1.2.840.10045.4.3.1",SHA256withECDSA:"1.2.840.10045.4.3.2",SHA384withECDSA:"1.2.840.10045.4.3.3",SHA512withECDSA:"1.2.840.10045.4.3.4",dsa:"1.2.840.10040.4.1",SHA1withDSA:"1.2.840.10040.4.3",SHA224withDSA:"2.16.840.1.101.3.4.3.1",SHA256withDSA:"2.16.840.1.101.3.4.3.2",rsaEncryption:"1.2.840.113549.1.1.1",commonName:"2.5.4.3",countryName:"2.5.4.6",localityName:"2.5.4.7",stateOrProvinceName:"2.5.4.8",streetAddress:"2.5.4.9",organizationName:"2.5.4.10",organizationalUnitName:"2.5.4.11",domainComponent:"0.9.2342.19200300.100.1.25",userId:"0.9.2342.19200300.100.1.1",surname:"2.5.4.4",givenName:"2.5.4.42",title:"2.5.4.12",distinguishedName:"2.5.4.49",emailAddress:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3",subjectDirectoryAttributes:"2.5.29.9",subjectKeyIdentifier:"2.5.29.14",keyUsage:"2.5.29.15",subjectAltName:"2.5.29.17",issuerAltName:"2.5.29.18",basicConstraints:"2.5.29.19",cRLNumber:"2.5.29.20",cRLReason:"2.5.29.21",nameConstraints:"2.5.29.30",cRLDistributionPoints:"2.5.29.31",certificatePolicies:"2.5.29.32",anyPolicy:"2.5.29.32.0",policyMappings:"2.5.29.33",authorityKeyIdentifier:"2.5.29.35",policyConstraints:"2.5.29.36",extKeyUsage:"2.5.29.37",inhibitAnyPolicy:"2.5.29.54",authorityInfoAccess:"1.3.6.1.5.5.7.1.1",ocsp:"1.3.6.1.5.5.7.48.1",ocspBasic:"1.3.6.1.5.5.7.48.1.1",ocspNonce:"1.3.6.1.5.5.7.48.1.2",ocspNoCheck:"1.3.6.1.5.5.7.48.1.5",caIssuers:"1.3.6.1.5.5.7.48.2",anyExtendedKeyUsage:"2.5.29.37.0",serverAuth:"1.3.6.1.5.5.7.3.1",clientAuth:"1.3.6.1.5.5.7.3.2",codeSigning:"1.3.6.1.5.5.7.3.3",emailProtection:"1.3.6.1.5.5.7.3.4",timeStamping:"1.3.6.1.5.5.7.3.8",ocspSigning:"1.3.6.1.5.5.7.3.9",smtpUTF8Mailbox:"1.3.6.1.5.5.7.8.9",dateOfBirth:"1.3.6.1.5.5.7.9.1",placeOfBirth:"1.3.6.1.5.5.7.9.2",gender:"1.3.6.1.5.5.7.9.3",countryOfCitizenship:"1.3.6.1.5.5.7.9.4",countryOfResidence:"1.3.6.1.5.5.7.9.5",ecPublicKey:"1.2.840.10045.2.1","P-256":"1.2.840.10045.3.1.7",secp256r1:"1.2.840.10045.3.1.7",secp256k1:"1.3.132.0.10",secp384r1:"1.3.132.0.34",secp521r1:"1.3.132.0.35",pkcs5PBES2:"1.2.840.113549.1.5.13",pkcs5PBKDF2:"1.2.840.113549.1.5.12","des-EDE3-CBC":"1.2.840.113549.3.7",data:"1.2.840.113549.1.7.1","signed-data":"1.2.840.113549.1.7.2","enveloped-data":"1.2.840.113549.1.7.3","digested-data":"1.2.840.113549.1.7.5","encrypted-data":"1.2.840.113549.1.7.6","authenticated-data":"1.2.840.113549.1.9.16.1.2",tstinfo:"1.2.840.113549.1.9.16.1.4",signingCertificate:"1.2.840.113549.1.9.16.2.12",timeStampToken:"1.2.840.113549.1.9.16.2.14",signaturePolicyIdentifier:"1.2.840.113549.1.9.16.2.15",etsArchiveTimeStamp:"1.2.840.113549.1.9.16.2.27",signingCertificateV2:"1.2.840.113549.1.9.16.2.47",etsArchiveTimeStampV2:"1.2.840.113549.1.9.16.2.48",extensionRequest:"1.2.840.113549.1.9.14",contentType:"1.2.840.113549.1.9.3",messageDigest:"1.2.840.113549.1.9.4",signingTime:"1.2.840.113549.1.9.5",counterSignature:"1.2.840.113549.1.9.6",archiveTimeStampV3:"0.4.0.1733.2.4",pdfRevocationInfoArchival:"1.2.840.113583.1.1.8",adobeTimeStamp:"1.2.840.113583.1.1.9.1",smimeMailboxLegacy:"2.23.140.1.5.1.1",smimeMailboxMulti:"2.23.140.1.5.1.2",smimeMailboxStrict:"2.23.140.1.5.1.3",smimeOrganizationLegacy:"2.23.140.1.5.2.1",smimeOrganizationMulti:"2.23.140.1.5.2.2",smimeOrganizationStrict:"2.23.140.1.5.2.3",smimeSponsorLegacy:"2.23.140.1.5.3.1",smimeSponsorMulti:"2.23.140.1.5.3.2",smimeSponsorStrict:"2.23.140.1.5.3.3",smimeIndividualLegacy:"2.23.140.1.5.4.1",smimeIndividualMulti:"2.23.140.1.5.4.2",smimeIndividualStrict:"2.23.140.1.5.4.3"},this.atype2oidList={CN:"2.5.4.3",L:"2.5.4.7",ST:"2.5.4.8",O:"2.5.4.10",OU:"2.5.4.11",C:"2.5.4.6",STREET:"2.5.4.9",DC:"0.9.2342.19200300.100.1.25",UID:"0.9.2342.19200300.100.1.1",SN:"2.5.4.4",T:"2.5.4.12",GN:"2.5.4.42",DN:"2.5.4.49",E:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",serialNumber:"2.5.4.5",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3"},this.objCache={},this.name2obj=function(e){if(void 0!==this.objCache[e])return this.objCache[e];if(void 0===this.name2oidList[e])throw"Name of ObjectIdentifier not defined: "+e;var r=this.name2oidList[e],n=new t({oid:r});return this.objCache[e]=n,n},this.atype2obj=function(e){if(void 0!==this.objCache[e])return this.objCache[e];var r;if(e.match(/^\d+\.\d+\.[0-9.]+$/))r=e;else if(void 0!==this.atype2oidList[e])r=this.atype2oidList[e];else{if(void 0===this.name2oidList[e])throw new Error("AttributeType name undefined: "+e);r=this.name2oidList[e]}var n=new t({oid:r});return this.objCache[e]=n,n},this.registerOIDs=function(t){if(this.checkOIDs(t))for(var e in t)this.name2oidList[e]=t[e]},this.checkOIDs=function(t){try{var e=Object.keys(t);return 0!=e.length&&(e.map((function(t,e,r){if(!this[t].match(/^[0-2]\.[0-9.]+$/))throw new Error("value is not OID")}),t),!0)}catch(t){return!1}}},lt.asn1.x509.OID.oid2name=function(t){var e=lt.asn1.x509.OID.name2oidList;for(var r in e)if(e[r]==t)return r;return""},lt.asn1.x509.OID.oid2atype=function(t){var e=lt.asn1.x509.OID.atype2oidList;for(var r in e)if(e[r]==t)return r;return t},lt.asn1.x509.OID.name2oid=function(t){if(t.match(/^[0-9.]+$/))return t;var e=lt.asn1.x509.OID.name2oidList;return void 0===e[t]?"":e[t]},lt.asn1.x509.X509Util={},lt.asn1.x509.X509Util.newCertPEM=function(t){var e=lt.asn1.x509;return e.TBSCertificate,new(0,e.Certificate)(t).getPEM()},void 0!==lt&&lt||(lt={}),void 0!==lt.asn1&&lt.asn1||(lt.asn1={}),void 0!==lt.asn1.cms&&lt.asn1.cms||(lt.asn1.cms={}),lt.asn1.cms.Attribute=function(t){var e=Error,r=lt.asn1,n=r.DERSequence,i=r.DERSet,s=r.DERObjectIdentifier;this.params=null,this.typeOid=null,this.setByParam=function(t){this.params=t},this.getValueArray=function(){throw new e("not yet implemented abstract")},this.tohex=function(){var t=new s({oid:this.typeOid}),e=new i({array:this.getValueArray()});return new n({array:[t,e]}).tohex()},this.getEncodedHex=function(){return this.tohex()}},Wt(lt.asn1.cms.Attribute,lt.asn1.ASN1Object),lt.asn1.cms.ContentType=function(t){var e=lt.asn1;e.cms.ContentType.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.3",this.getValueArray=function(){return[new e.DERObjectIdentifier(this.params.type)]},null!=t&&this.setByParam(t)},Wt(lt.asn1.cms.ContentType,lt.asn1.cms.Attribute),lt.asn1.cms.MessageDigest=function(t){var e=lt.asn1,r=e.DEROctetString;e.cms.MessageDigest.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.4",this.getValueArray=function(){return[new r(this.params)]},null!=t&&this.setByParam(t)},Wt(lt.asn1.cms.MessageDigest,lt.asn1.cms.Attribute),lt.asn1.cms.SigningTime=function(t){var e=lt.asn1;e.cms.SigningTime.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.5",this.getValueArray=function(){return[new e.x509.Time(this.params)]},null!=t&&this.setByParam(t)},Wt(lt.asn1.cms.SigningTime,lt.asn1.cms.Attribute),lt.asn1.cms.SigningCertificate=function(t){var e=Error,r=lt,n=r.asn1,i=n.DERSequence,s=n.cms,a=s.ESSCertID;r.crypto,s.SigningCertificate.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.12",this.getValueArray=function(){if(null==this.params||null==this.params||null==this.params.array)throw new e("parameter 'array' not specified");for(var r=this.params.array,n=[],s=0;s<r.length;s++){var o=r[s];0!=t.hasis||"string"!=typeof o||-1==o.indexOf("-----BEGIN")&&!pt.isASN1HEX(o)||(o={cert:o}),0!=o.hasis&&0==t.hasis&&(o.hasis=!1),n.push(new a(o))}var u=new i({array:n});return[new i({array:[u]})]},null!=t&&this.setByParam(t)},Wt(lt.asn1.cms.SigningCertificate,lt.asn1.cms.Attribute),lt.asn1.cms.ESSCertID=function(t){lt.asn1.cms.ESSCertID.superclass.constructor.call(this);var e=Error,r=lt,n=r.asn1,i=n.DEROctetString,s=n.DERSequence,a=n.cms.IssuerSerial;this.params=null,this.getCertHash=function(t,n){if(null!=t.hash)return t.hash;if("string"==typeof t&&-1==t.indexOf("-----BEGIN")&&!pt.isASN1HEX(t))return t;var i,s,a;if("string"==typeof t)i=t;else{if(null==t.cert)throw new e("hash nor cert unspecified");i=t.cert}if(s=-1!=i.indexOf("-----BEGIN")?Bt(i):i,"string"==typeof t&&(-1!=t.indexOf("-----BEGIN")?s=Bt(t):pt.isASN1HEX(t)&&(s=t)),null!=t.alg)a=t.alg;else{if(null==n)throw new e("hash alg unspecified");a=n}return r.crypto.Util.hashHex(s,a)},this.tohex=function(){var t=this.params,e=this.getCertHash(t,"sha1"),r=[];return r.push(new i({hex:e})),("string"==typeof t&&-1!=t.indexOf("-----BEGIN")||null!=t.cert&&0!=t.hasis||null!=t.issuer&&null!=t.serial)&&r.push(new a(t)),new s({array:r}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Wt(lt.asn1.cms.ESSCertID,lt.asn1.ASN1Object),lt.asn1.cms.SigningCertificateV2=function(t){var e=Error,r=lt,n=r.asn1,i=n.DERSequence,s=(n.x509,n.cms),a=s.ESSCertIDv2;r.crypto,s.SigningCertificateV2.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.47",this.getValueArray=function(){if(null==this.params||null==this.params||null==this.params.array)throw new e("parameter 'array' not specified");for(var r=this.params.array,n=[],s=0;s<r.length;s++){var o=r[s];null==t.alg&&0!=t.hasis||"string"!=typeof o||-1==o.indexOf("-----BEGIN")&&!pt.isASN1HEX(o)||(o={cert:o}),null==o.alg&&null!=t.alg&&(o.alg=t.alg),0!=o.hasis&&0==t.hasis&&(o.hasis=!1),n.push(new a(o))}var u=new i({array:n});return[new i({array:[u]})]},null!=t&&this.setByParam(t)},Wt(lt.asn1.cms.SigningCertificateV2,lt.asn1.cms.Attribute),lt.asn1.cms.ESSCertIDv2=function(t){lt.asn1.cms.ESSCertIDv2.superclass.constructor.call(this),Error;var e=lt.asn1,r=e.DEROctetString,n=e.DERSequence,i=e.cms.IssuerSerial,s=e.x509.AlgorithmIdentifier;this.params=null,this.tohex=function(){var t=this.params,e=this.getCertHash(t,"sha256"),a=[];return null!=t.alg&&"sha256"!=t.alg&&a.push(new s({name:t.alg})),a.push(new r({hex:e})),("string"==typeof t&&-1!=t.indexOf("-----BEGIN")||null!=t.cert&&0!=t.hasis||null!=t.issuer&&null!=t.serial)&&a.push(new i(t)),new n({array:a}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Wt(lt.asn1.cms.ESSCertIDv2,lt.asn1.cms.ESSCertID),lt.asn1.cms.IssuerSerial=function(t){var e=Error,r=lt.asn1,n=r.DERInteger,i=r.DERSequence,s=r.cms,a=r.x509.GeneralNames,o=Jt;s.IssuerSerial.superclass.constructor.call(this),this.setByParam=function(t){this.params=t},this.tohex=function(){var t,r,s=this.params;if("string"==typeof s&&-1!=s.indexOf("-----BEGIN")||null!=s.cert){var u;u=null!=s.cert?s.cert:s;var c=new o;c.readCertPEM(u),t=c.getIssuer(),r={hex:c.getSerialNumberHex()}}else{if(null==s.issuer||!s.serial)throw new e("cert or issuer and serial parameter not specified");t=s.issuer,r=s.serial}var l=new a([{dn:t}]),h=new n(r);return new i({array:[l,h]}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Wt(lt.asn1.cms.IssuerSerial,lt.asn1.ASN1Object),lt.asn1.cms.SignerIdentifier=function(t){var e=lt.asn1,r=(e.DERInteger,e.DERSequence,e.cms),n=r.IssuerAndSerialNumber,i=r.SubjectKeyIdentifier;e.x509.X500Name,Error,r.SignerIdentifier.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params;if("isssn"==t.type)return new n(t).tohex();if("skid"==t.type)return new i(t).tohex();throw new Error("wrong property for isssn or skid")},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Wt(lt.asn1.cms.SignerIdentifier,lt.asn1.ASN1Object),lt.asn1.cms.IssuerAndSerialNumber=function(t){var e=lt.asn1,r=e.DERInteger,n=e.DERSequence,i=e.cms,s=e.x509.X500Name,a=Jt,o=Error;i.IssuerAndSerialNumber.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t,e,i=this.params;if("string"==typeof i&&-1!=i.indexOf("-----BEGIN")||null!=i.cert){var u;u=null!=i.cert?i.cert:i;var c=new a;c.readCertPEM(u),t=c.getIssuer(),e={hex:c.getSerialNumberHex()}}else{if(null==i.issuer||!i.serial)throw new o("cert or issuer and serial parameter not specified");t=i.issuer,e=i.serial}var l=new s(t),h=new r(e);return new n({array:[l,h]}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(t){this.params=t},null!=t&&this.setByParam(t)},Wt(lt.asn1.cms.IssuerAndSerialNumber,lt.asn1.ASN1Object),lt.asn1.cms.SubjectKeyIdentifier=function(t){var e=lt.asn1,r=(e.DERInteger,e.DERSequence,e.ASN1Util.newObject),n=e.cms,i=(n.IssuerAndSerialName,n.SubjectKeyIdentifier,e.x509.X500Name,Jt),s=Error;n.SubjectKeyIdentifier.superclass.constructor.call(this),this.tohex=function(){var t,e=this.params;if(null==e.cert&&null==e.skid)throw new s("property cert nor skid undefined");return null!=e.cert?t=new i(e.cert).getExtSubjectKeyIdentifier().kid.hex:null!=e.skid&&(t=e.skid),r({tag:{tage:"a0",obj:{octstr:{hex:t}}}}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Wt(lt.asn1.cms.SubjectKeyIdentifier,lt.asn1.ASN1Object),lt.asn1.cms.AttributeList=function(t){var e=Error,r=lt.asn1,n=r.DERSet,i=r.cms;i.AttributeList.superclass.constructor.call(this),this.params=null,this.hTLV=null,this.setByParam=function(t){this.params=t},this.tohex=function(){var t=this.params;if(null!=this.hTLV)return this.hTLV;var r=!0;null!=t.sortflag&&(r=t.sortflag);for(var s=t.array,a=[],o=0;o<s.length;o++){var u=s[o],c=u.attr;if("contentType"==c)a.push(new i.ContentType(u));else if("messageDigest"==c)a.push(new i.MessageDigest(u));else if("signingTime"==c)a.push(new i.SigningTime(u));else if("signingCertificate"==c)a.push(new i.SigningCertificate(u));else if("signingCertificateV2"==c)a.push(new i.SigningCertificateV2(u));else if("signaturePolicyIdentifier"==c)a.push(new lt.asn1.cades.SignaturePolicyIdentifier(u));else{if("signatureTimeStamp"!=c&&"timeStampToken"!=c)throw new e("unknown attr: "+c);a.push(new lt.asn1.cades.SignatureTimeStamp(u))}}var l=new n({array:a,sortflag:r});return this.hTLV=l.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Wt(lt.asn1.cms.AttributeList,lt.asn1.ASN1Object),lt.asn1.cms.SignerInfo=function(t){var e=Error,r=lt,n=r.asn1,i=n.DERInteger,s=n.DEROctetString,a=n.DERSequence,o=n.DERTaggedObject,u=n.cms,c=u.SignerIdentifier,l=u.AttributeList,h=(u.ContentType,u.EncapsulatedContentInfo,u.MessageDigest,u.SignedData,n.x509.AlgorithmIdentifier),f=r.crypto,p=$t;u.SignerInfo.superclass.constructor.call(this),this.params=null,this.sign=function(){var t=this.params,e=t.sigalg,r=new l(t.sattrs).tohex(),n=p.getKey(t.signkey),i=new f.Signature({alg:e});i.init(n),i.updateHex(r);var s=i.sign();t.sighex=s},this.tohex=function(){var t=this.params,r=[];if(r.push(new i({int:t.version})),r.push(new c(t.id)),r.push(new h({name:t.hashalg})),null!=t.sattrs){var n=new l(t.sattrs);try{r.push(new o({tag:"a0",explicit:!1,obj:n}))}catch(t){throw new e("si sattr error: "+t)}}if(null!=t.sigalgfield?r.push(new h({name:t.sigalgfield})):r.push(new h({name:t.sigalg})),null==t.sighex&&null!=t.signkey&&this.sign(),r.push(new s({hex:t.sighex})),null!=t.uattrs){n=new l(t.uattrs);try{r.push(new o({tag:"a1",explicit:!1,obj:n}))}catch(t){throw new e("si uattr error: "+t)}}return new a({array:r}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Wt(lt.asn1.cms.SignerInfo,lt.asn1.ASN1Object),lt.asn1.cms.EncapsulatedContentInfo=function(t){var e=lt.asn1,r=e.DERTaggedObject,n=e.DERSequence,i=e.DERObjectIdentifier,s=e.DEROctetString;e.cms.EncapsulatedContentInfo.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params,e=[];if(e.push(new i(t.type)),null!=t.content&&(null!=t.content.hex||null!=t.content.str)&&1!=t.isDetached){var a=new s(t.content),o=new r({tag:"a0",explicit:!0,obj:a});e.push(o)}return new n({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(t){this.params=t},null!=t&&this.setByParam(t)},Wt(lt.asn1.cms.EncapsulatedContentInfo,lt.asn1.ASN1Object),lt.asn1.cms.ContentInfo=function(t){var e=lt.asn1,r=e.DERTaggedObject,n=e.DERSequence,i=e.DERObjectIdentifier;e.x509.OID.name2obj,lt.asn1.cms.ContentInfo.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params,e=[];e.push(new i(t.type));var s=new r({tag:"a0",explicit:!0,obj:t.obj});return e.push(s),new n({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(t){this.params=t},null!=t&&this.setByParam(t)},Wt(lt.asn1.cms.ContentInfo,lt.asn1.ASN1Object),lt.asn1.cms.SignedData=function(t){Error;var e=lt.asn1,r=(e.ASN1Object,e.DERInteger),n=e.DERSet,i=e.DERSequence,s=(e.DERTaggedObject,e.cms),a=s.EncapsulatedContentInfo,o=s.SignerInfo,u=s.ContentInfo,c=s.CertificateSet,l=s.RevocationInfoChoices,h=e.x509.AlgorithmIdentifier;lt.asn1.cms.SignedData.superclass.constructor.call(this),this.params=null,this.checkAndFixParam=function(){var t=this.params;this._setDigestAlgs(t),this._setContentTypeByEContent(t),this._setMessageDigestByEContent(t),this._setSignerInfoVersion(t),this._setSignedDataVersion(t)},this._setDigestAlgs=function(t){for(var e={},r=t.sinfos,n=0;n<r.length;n++)e[r[n].hashalg]=1;t.hashalgs=Object.keys(e).sort()},this._setContentTypeByEContent=function(t){for(var e=t.econtent.type,r=t.sinfos,n=0;n<r.length;n++){var i=r[n];this._getAttrParamByName(i,"contentType").type=e}},this._setMessageDigestByEContent=function(t){var e=t.econtent,r=(t.econtent.type,e.content.hex);null==r&&"data"==e.type&&null!=e.content.str&&(r=wt(e.content.str));for(var n=t.sinfos,i=0;i<n.length;i++){var s=n[i],a=s.hashalg,o=this._getAttrParamByName(s,"messageDigest"),u=lt.crypto.Util.hashHex(r,a);o.hex=u}},this._getAttrParamByName=function(t,e){for(var r=t.sattrs.array,n=0;n<r.length;n++)if(r[n].attr==e)return r[n]},this._setSignerInfoVersion=function(t){for(var e=t.sinfos,r=0;r<e.length;r++){var n=e[r],i=1;"skid"==n.id.type&&(i=3),n.version=i}},this._setSignedDataVersion=function(t){var e=this._getSignedDataVersion(t);t.version=e},this._getSignedDataVersion=function(t){if(null!=t.revinfos)for(var e=t.revinfos,r=0;r<e.length;r++)if(null!=e[r].ocsp)return 5;var n=t.sinfos;for(r=0;r<n.length;r++)if(3==t.sinfos[r].version)return 3;return"data"!=t.econtent.type?3:1},this.tohex=function(){var t=this.params;null!=this.getEncodedHexPrepare&&this.getEncodedHexPrepare(),1!=t.fixed&&this.checkAndFixParam();var e=[];e.push(new r({int:t.version}));for(var s=[],u=0;u<t.hashalgs.length;u++){var f=t.hashalgs[u];s.push(new h({name:f}))}e.push(new n({array:s})),e.push(new a(t.econtent)),null!=t.certs&&e.push(new c(t.certs)),null!=t.revinfos&&e.push(new l(t.revinfos));var p=[];for(u=0;u<t.sinfos.length;u++){var d=t.sinfos[u];p.push(new o(d))}return e.push(new n({array:p})),new i({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.getContentInfo=function(){return new u({type:"signed-data",obj:this})},this.getContentInfoEncodedHex=function(){return this.getContentInfo().tohex()},null!=t&&this.setByParam(t)},Wt(lt.asn1.cms.SignedData,lt.asn1.ASN1Object),lt.asn1.cms.CertificateSet=function(t){lt.asn1.cms.CertificateSet.superclass.constructor.call(this);var e=Error,r=lt.asn1,n=r.DERTaggedObject,i=r.DERSet,s=r.ASN1Object;this.params=null,this.tohex=function(){var t,r=this.params,a=[];if(r instanceof Array)t=r;else{if(null==r.array)throw new e("cert array not specified");t=r.array}for(var o=0;o<t.length;o++){var u=Bt(t[o]),c=new s;c.hTLV=u,a.push(c)}var l={array:a};0==r.sortflag&&(l.sortflag=!1);var h=new i(l);return new n({tag:"a0",explicit:!1,obj:h}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Wt(lt.asn1.cms.CertificateSet,lt.asn1.ASN1Object),lt.asn1.cms.RevocationInfoChoices=function(t){lt.asn1.cms.RevocationInfoChoices.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params;if(!t instanceof Array)throw new Error("params is not array");for(var e=[],r=0;r<t.length;r++)e.push(new lt.asn1.cms.RevocationInfoChoice(t[r]));return lt.asn1.ASN1Util.newObject({tag:{tagi:"a1",obj:{set:e}}}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Wt(lt.asn1.cms.RevocationInfoChoices,lt.asn1.ASN1Object),lt.asn1.cms.RevocationInfoChoice=function(t){lt.asn1.cms.RevocationInfoChoice.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params;if(null!=t.crl&&"string"==typeof t.crl){var e=t.crl;return-1!=t.crl.indexOf("-----BEGIN")&&(e=Bt(t.crl)),e}if(null!=t.ocsp)return lt.asn1.ASN1Util.newObject({tag:{tagi:"a1",obj:new lt.asn1.cms.OtherRevocationFormat(t)}}).tohex();throw new Error("property crl or ocsp undefined")},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Wt(lt.asn1.cms.RevocationInfoChoice,lt.asn1.ASN1Object),lt.asn1.cms.OtherRevocationFormat=function(t){lt.asn1.cms.OtherRevocationFormat.superclass.constructor.call(this);var e=Error,r=lt,n=r.asn1.ASN1Util.newObject,i=r.lang.String.isHex;this.params=null,this.tohex=function(){var t=this.params;if(null==t.ocsp)throw new e("property ocsp not specified");if(!i(t.ocsp)||!pt.isASN1HEX(t.ocsp))throw new e("ocsp value not ASN.1 hex string");return n({seq:[{oid:"1.3.6.1.5.5.7.16.2"},{asn1:{tlv:t.ocsp}}]}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Wt(lt.asn1.cms.OtherRevocationFormat,lt.asn1.ASN1Object),lt.asn1.cms.CMSUtil=new function(){},lt.asn1.cms.CMSUtil.newSignedData=function(t){return new lt.asn1.cms.SignedData(t)},lt.asn1.cms.CMSUtil.verifySignedData=function(t){var e=lt,r=e.asn1,n=r.cms,i=(n.SignerInfo,n.SignedData,n.SigningTime,n.SigningCertificate,n.SigningCertificateV2,r.cades.SignaturePolicyIdentifier,e.lang.String.isHex),s=pt,a=s.getVbyList,o=s.getTLVbyList,u=s.getIdxbyList,c=s.getChildIdx,l=s.getTLV,h=s.oidname,f=e.crypto.Util.hashHex;void 0===t.cms&&i(t.cms);var p=t.cms,d=function(t,e){var r=e.idx;e.signerid_issuer1=o(t,r,[1,0],"30"),e.signerid_serial1=a(t,r,[1,1],"02"),e.hashalg=h(a(t,r,[2,0],"06"));var n=u(t,r,[3],"a0");e.idxSignedAttrs=n,g(t,e,n);var i=c(t,r).length;if(i<6)throw"malformed SignerInfo";e.sigalg=h(a(t,r,[i-2,0],"06")),e.sigval=a(t,r,[i-1],"04")},g=function(t,e,r){var n=c(t,r);e.signedAttrIdxList=n;for(var i=0;i<n.length;i++){var s,o=n[i],u=a(t,o,[0],"06");"2a864886f70d010905"===u?(s=bt(a(t,o,[1,0])),e.saSigningTime=s):"2a864886f70d010904"===u&&(s=a(t,o,[1,0],"04"),e.saMessageDigest=s)}},y=function(t,e,r,n){r.verifyDetail={};var i=r.verifyDetail,s=e.parse.econtent,a=r.hashalg,o=r.saMessageDigest;i.validMessageDigest=!1,f(s,a)===o&&(i.validMessageDigest=!0),function(t,e,r,n){var i,s=e.parse.certsIdx;if(void 0===e.certs){i=[],e.certkeys=[];for(var a=c(t,s),o=0;o<a.length;o++){var u=l(t,a[o]),h=new Jt;h.readCertHex(u),i[o]=h,e.certkeys[o]=h.getPublicKey()}e.certs=i}else i=e.certs;for(e.cccc=i.length,e.cccci=a.length,o=0;o<i.length;o++){var f=h.getIssuerHex(),p=h.getSerialNumberHex();r.signerid_issuer1===f&&r.signerid_serial1===p&&(r.certkey_idx=o)}}(t,e,r),i.validSignatureValue=!1;var u=r.sigalg,h="31"+l(t,r.idxSignedAttrs).substr(2);r.signedattrshex=h;var p=e.certs[r.certkey_idx].getPublicKey(),d=new lt.crypto.Signature({alg:u});d.init(p),d.updateHex(h);var g=d.verify(r.sigval);i.validSignatureValue_isValid=g,!0===g&&(i.validSignatureValue=!0),r.isValid=!1,i.validMessageDigest&&i.validSignatureValue&&(r.isValid=!0)},v={isValid:!1,parse:{}};return function(t,e){if("2a864886f70d010702"!==a(t,0,[0],"06"))return e;e.cmsType="signedData",e.econtent=a(t,0,[1,0,2,1,0]),function(t,e){for(var r,n=3;n<6;n++)if(void 0!==(r=u(t,0,[1,0,n]))){var i=t.substr(r,2);"a0"===i&&(e.certsIdx=r),"a1"===i&&(e.revinfosIdx=r),"31"===i&&(e.signerinfosIdx=r)}}(t,e),e.signerInfos=[],function(t,e){var r=e.signerinfosIdx;if(void 0!==r){var n=c(t,r);e.signerInfoIdxList=n;for(var i=0;i<n.length;i++){var s={idx:n[i]};d(t,s),e.signerInfos.push(s)}}}(t,e)}(p,v.parse),function(t,e){for(var r=e.parse.signerInfos,n=r.length,i=!0,s=0;s<n;s++){var a=r[s];y(t,e,a),a.isValid||(i=!1)}e.isValid=i}(p,v),v},lt.asn1.cms.CMSParser=function(){var t=Error,e=Jt,r=new e,n=pt,i=n.getV,s=n.getTLV,a=(n.getIdxbyList,n.getTLVbyList),o=n.getTLVbyListEx,u=n.getVbyList,c=n.getVbyListEx,l=n.getChildIdx;this.getCMSSignedData=function(t){var e=a(t,0,[1,0]);return this.getSignedData(e)},this.getSignedData=function(t){var e=l(t,0),r={},n=i(t,e[0]),a=parseInt(n,16);r.version=a;var u=s(t,e[1]);r.hashalgs=this.getHashAlgArray(u);var c=s(t,e[2]);r.econtent=this.getEContent(c);var h=o(t,0,["[0]"]);null!=h&&(r.certs=this.getCertificateSet(h)),o(t,0,["[1]"]);var f=o(t,0,[3]);return r.sinfos=this.getSignerInfos(f),r},this.getHashAlgArray=function(t){for(var r=l(t,0),n=new e,i=[],a=0;a<r.length;a++){var o=s(t,r[a]),u=n.getAlgorithmIdentifierName(o);i.push(u)}return i},this.getEContent=function(t){var e={},r=u(t,0,[0]),n=u(t,0,[1,0]);return e.type=lt.asn1.x509.OID.oid2name(pt.hextooidstr(r)),e.content={hex:n},e},this.getSignerInfos=function(t){for(var e=[],r=l(t,0),n=0;n<r.length;n++){var i=s(t,r[n]),a=this.getSignerInfo(i);e.push(a)}return e},this.getSignerInfo=function(t){var e={},i=l(t,0),a=n.getInt(t,i[0],-1);-1!=a&&(e.version=a);var u=s(t,i[1]),h=this.getIssuerAndSerialNumber(u);e.id=h;var f=s(t,i[2]),p=r.getAlgorithmIdentifierName(f);e.hashalg=p;var d=o(t,0,["[0]"]);if(null!=d){var g=this.getAttributeList(d);e.sattrs=g}var y=o(t,0,[3]),v=r.getAlgorithmIdentifierName(y);e.sigalg=v;var m=c(t,0,[4]);e.sighex=m;var E=o(t,0,["[1]"]);if(null!=E){var S=this.getAttributeList(E);e.uattrs=S}return e},this.getSignerIdentifier=function(t){if("30"==t.substr(0,2))return this.getIssuerAndSerialNumber(t);throw new Error("SKID of signerIdentifier not supported")},this.getIssuerAndSerialNumber=function(t){var e={type:"isssn"},n=l(t,0),a=s(t,n[0]);e.issuer=r.getX500Name(a);var o=i(t,n[1]);return e.serial={hex:o},e},this.getAttributeList=function(t){for(var e=[],r=l(t,0),n=0;n<r.length;n++){var i=s(t,r[n]),a=this.getAttribute(i);e.push(a)}return{array:e}},this.getAttribute=function(t){var e={},r=l(t,0),i=n.getOID(t,r[0]),a=lt.asn1.x509.OID.oid2name(i);e.attr=a;var o=s(t,r[1]),u=l(o,0);if(1==u.length)e.valhex=s(o,u[0]);else{for(var c=[],h=0;h<u.length;h++)c.push(s(o,u[h]));e.valhex=c}return"contentType"==a?this.setContentType(e):"messageDigest"==a?this.setMessageDigest(e):"signingTime"==a?this.setSigningTime(e):"signingCertificate"==a?this.setSigningCertificate(e):"signingCertificateV2"==a?this.setSigningCertificateV2(e):"signaturePolicyIdentifier"==a&&this.setSignaturePolicyIdentifier(e),e},this.setContentType=function(t){var e=n.getOIDName(t.valhex,0,null);null!=e&&(t.type=e,delete t.valhex)},this.setSigningTime=function(t){var e=bt(i(t.valhex,0));t.str=e,delete t.valhex},this.setMessageDigest=function(t){var e=i(t.valhex,0);t.hex=e,delete t.valhex},this.setSigningCertificate=function(t){var e=l(t.valhex,0);if(e.length>0){for(var r=s(t.valhex,e[0]),n=l(r,0),i=[],a=0;a<n.length;a++){var o=s(r,n[a]),u=this.getESSCertID(o);i.push(u)}t.array=i}if(e.length>1){var c=s(t.valhex,e[1]);t.polhex=c}delete t.valhex},this.setSignaturePolicyIdentifier=function(t){var r=l(t.valhex,0);if(r.length>0){var a=n.getOID(t.valhex,r[0]);t.oid=a}if(r.length>1){var o=new e,u=l(t.valhex,r[1]),c=s(t.valhex,u[0]),h=o.getAlgorithmIdentifierName(c);t.alg=h;var f=i(t.valhex,u[1]);t.hash=f}delete t.valhex},this.setSigningCertificateV2=function(t){var e=l(t.valhex,0);if(e.length>0){for(var r=s(t.valhex,e[0]),n=l(r,0),i=[],a=0;a<n.length;a++){var o=s(r,n[a]),u=this.getESSCertIDv2(o);i.push(u)}t.array=i}if(e.length>1){var c=s(t.valhex,e[1]);t.polhex=c}delete t.valhex},this.getESSCertID=function(t){var e={},r=l(t,0);if(r.length>0){var n=i(t,r[0]);e.hash=n}if(r.length>1){var a=s(t,r[1]),o=this.getIssuerSerial(a);null!=o.serial&&(e.serial=o.serial),null!=o.issuer&&(e.issuer=o.issuer)}return e},this.getESSCertIDv2=function(e){var n={},a=l(e,0);if(a.length<1||3<a.length)throw new t("wrong number of elements");var o=0;if("30"==e.substr(a[0],2)){var u=s(e,a[0]);n.alg=r.getAlgorithmIdentifierName(u),o++}else n.alg="sha256";var c=i(e,a[o]);if(n.hash=c,a.length>o+1){var h=s(e,a[o+1]),f=this.getIssuerSerial(h);n.issuer=f.issuer,n.serial=f.serial}return n},this.getIssuerSerial=function(t){var e={},n=l(t,0),a=s(t,n[0]),o=r.getGeneralNames(a)[0].dn;e.issuer=o;var u=i(t,n[1]);return e.serial={hex:u},e},this.getCertificateSet=function(t){for(var e=l(t,0),r=[],n=0;n<e.length;n++){var i=s(t,e[n]);if("30"==i.substr(0,2)){var a=xt(i,"CERTIFICATE");r.push(a)}}return{array:r,sortflag:!1}}},void 0!==lt&&lt||(lt={}),void 0!==lt.asn1&&lt.asn1||(lt.asn1={}),void 0!==lt.asn1.tsp&&lt.asn1.tsp||(lt.asn1.tsp={}),lt.asn1.tsp.TimeStampToken=function(t){var e=lt.asn1.tsp;e.TimeStampToken.superclass.constructor.call(this),this.params=null,this.getEncodedHexPrepare=function(){var t=new e.TSTInfo(this.params.econtent.content);this.params.econtent.content.hex=t.tohex()},null!=t&&this.setByParam(t)},Wt(lt.asn1.tsp.TimeStampToken,lt.asn1.cms.SignedData),lt.asn1.tsp.TSTInfo=function(t){Error;var e=lt.asn1,r=e.DERSequence,n=e.DERInteger,i=e.DERBoolean,s=e.DERGeneralizedTime,a=e.DERObjectIdentifier,o=e.DERTaggedObject,u=e.tsp,c=u.MessageImprint,l=u.Accuracy,h=(e.x509.X500Name,e.x509.GeneralName);if(u.TSTInfo.superclass.constructor.call(this),this.dVersion=new n({int:1}),this.dPolicy=null,this.dMessageImprint=null,this.dSerial=null,this.dGenTime=null,this.dAccuracy=null,this.dOrdering=null,this.dNonce=null,this.dTsa=null,this.tohex=function(){var t=[this.dVersion];if(null==this.dPolicy)throw new Error("policy shall be specified.");if(t.push(this.dPolicy),null==this.dMessageImprint)throw new Error("messageImprint shall be specified.");if(t.push(this.dMessageImprint),null==this.dSerial)throw new Error("serialNumber shall be specified.");if(t.push(this.dSerial),null==this.dGenTime)throw new Error("genTime shall be specified.");t.push(this.dGenTime),null!=this.dAccuracy&&t.push(this.dAccuracy),null!=this.dOrdering&&t.push(this.dOrdering),null!=this.dNonce&&t.push(this.dNonce),null!=this.dTsa&&t.push(this.dTsa);var e=new r({array:t});return this.hTLV=e.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==t){if("string"==typeof t.policy){if(!t.policy.match(/^[0-9.]+$/))throw"policy shall be oid like 0.1.4.134";this.dPolicy=new a({oid:t.policy})}void 0!==t.messageImprint&&(this.dMessageImprint=new c(t.messageImprint)),void 0!==t.serial&&(this.dSerial=new n(t.serial)),void 0!==t.genTime&&(this.dGenTime=new s(t.genTime)),void 0!==t.accuracy&&(this.dAccuracy=new l(t.accuracy)),void 0!==t.ordering&&1==t.ordering&&(this.dOrdering=new i),void 0!==t.nonce&&(this.dNonce=new n(t.nonce)),void 0!==t.tsa&&(this.dTsa=new o({tag:"a0",explicit:!0,obj:new h({dn:t.tsa})}))}},Wt(lt.asn1.tsp.TSTInfo,lt.asn1.ASN1Object),lt.asn1.tsp.Accuracy=function(t){var e=lt.asn1,r=e.ASN1Util.newObject;e.tsp.Accuracy.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params,e=[];return null!=t.seconds&&"number"==typeof t.seconds&&e.push({int:t.seconds}),null!=t.millis&&"number"==typeof t.millis&&e.push({tag:{tagi:"80",obj:{int:t.millis}}}),null!=t.micros&&"number"==typeof t.micros&&e.push({tag:{tagi:"81",obj:{int:t.micros}}}),r({seq:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Wt(lt.asn1.tsp.Accuracy,lt.asn1.ASN1Object),lt.asn1.tsp.MessageImprint=function(t){var e=lt.asn1,r=e.DERSequence,n=e.DEROctetString,i=e.x509.AlgorithmIdentifier;e.tsp.MessageImprint.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params,e=new i({name:t.alg}),s=new n({hex:t.hash});return new r({array:[e,s]}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},Wt(lt.asn1.tsp.MessageImprint,lt.asn1.ASN1Object),lt.asn1.tsp.TimeStampReq=function(t){var e=lt.asn1,r=e.DERSequence,n=e.DERInteger,i=e.DERBoolean,s=(e.ASN1Object,e.DERObjectIdentifier),a=e.tsp,o=a.MessageImprint;a.TimeStampReq.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params,e=[];return e.push(new n({int:1})),t.messageImprint instanceof lt.asn1.ASN1Object?e.push(t.messageImprint):e.push(new o(t.messageImprint)),null!=t.policy&&e.push(new s(t.policy)),null!=t.nonce&&e.push(new n(t.nonce)),1==t.certreq&&e.push(new i),new r({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Wt(lt.asn1.tsp.TimeStampReq,lt.asn1.ASN1Object),lt.asn1.tsp.TimeStampResp=function(t){var e=lt.asn1,r=e.DERSequence,n=(e.ASN1Object,e.tsp),i=n.PKIStatusInfo;n.TimeStampResp.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params,s=[];if(null!=t.econtent||null!=t.tst)if(null!=t.statusinfo?s.push(new i(t.statusinfo)):s.push(new i("granted")),null!=t.econtent)s.push(new n.TimeStampToken(t).getContentInfo());else{if(!(t.tst instanceof e.ASN1Object))throw new Error("improper member tst value");s.push(t.tst)}else{if(null==t.statusinfo)throw new Error("parameter for token nor statusinfo not specified");s.push(new i(t.statusinfo))}return new r({array:s}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Wt(lt.asn1.tsp.TimeStampResp,lt.asn1.ASN1Object),lt.asn1.tsp.PKIStatusInfo=function(t){var e=Error,r=lt.asn1,n=r.DERSequence,i=r.tsp,s=i.PKIStatus,a=i.PKIFreeText,o=i.PKIFailureInfo;i.PKIStatusInfo.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params,r=[];if("string"==typeof t)r.push(new s(t));else{if(null==t.status)throw new e("property 'status' unspecified");r.push(new s(t.status)),null!=t.statusstr&&r.push(new a(t.statusstr)),null!=t.failinfo&&r.push(new o(t.failinfo))}return new n({array:r}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Wt(lt.asn1.tsp.PKIStatusInfo,lt.asn1.ASN1Object),lt.asn1.tsp.PKIStatus=function(t){var e=Error,r=lt.asn1,n=r.DERInteger;r.tsp.PKIStatus.superclass.constructor.call(this);var i={granted:0,grantedWithMods:1,rejection:2,waiting:3,revocationWarning:4,revocationNotification:5};this.params=null,this.tohex=function(){var t,r=this.params;if("string"==typeof r)try{t=i[r]}catch(t){throw new e("undefined name: "+r)}else{if("number"!=typeof r)throw new e("unsupported params");t=r}return new n({int:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Wt(lt.asn1.tsp.PKIStatus,lt.asn1.ASN1Object),lt.asn1.tsp.PKIFreeText=function(t){var e=Error,r=lt.asn1,n=r.DERSequence,i=r.DERUTF8String;r.tsp.PKIFreeText.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params;if(!t instanceof Array)throw new e("wrong params: not array");for(var r=[],s=0;s<t.length;s++)r.push(new i({str:t[s]}));return new n({array:r}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Wt(lt.asn1.tsp.PKIFreeText,lt.asn1.ASN1Object),lt.asn1.tsp.PKIFailureInfo=function(t){var e=Error,r=lt.asn1,n=r.DERBitString,i=r.tsp.PKIFailureInfo,s={badAlg:0,badRequest:2,badDataFormat:5,timeNotAvailable:14,unacceptedPolicy:15,unacceptedExtension:16,addInfoNotAvailable:17,systemFailure:25};i.superclass.constructor.call(this),this.params=null,this.getBinValue=function(){var t=this.params,r=0;if("number"==typeof t&&0<=t&&t<=25){for(var n=(r|=1<<t).toString(2),i="",a=n.length-1;a>=0;a--)i+=n[a];return i}if("string"==typeof t&&null!=s[t])return Gt([t],s);if("object"==typeof t&&null!=t.length)return Gt(t,s);throw new e("wrong params")},this.tohex=function(){this.params;var t=this.getBinValue();return new n({bin:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Wt(lt.asn1.tsp.PKIFailureInfo,lt.asn1.ASN1Object),lt.asn1.tsp.AbstractTSAAdapter=function(t){this.getTSTHex=function(t,e){throw"not implemented yet"}},lt.asn1.tsp.SimpleTSAAdapter=function(t){var e=lt,r=e.asn1.tsp,n=e.crypto.Util.hashHex;r.SimpleTSAAdapter.superclass.constructor.call(this),this.params=null,this.serial=0,this.getTSTHex=function(t,e){var i=n(t,e);this.params.econtent.content.messageImprint={alg:e,hash:i},this.params.econtent.content.serial={int:this.serial++};var s=Math.floor(1e9*Math.random());return this.params.econtent.content.nonce={int:s},new r.TimeStampToken(this.params).getContentInfoEncodedHex()},void 0!==t&&(this.params=t)},Wt(lt.asn1.tsp.SimpleTSAAdapter,lt.asn1.tsp.AbstractTSAAdapter),lt.asn1.tsp.FixedTSAAdapter=function(t){var e=lt,r=e.asn1.tsp,n=e.crypto.Util.hashHex;r.FixedTSAAdapter.superclass.constructor.call(this),this.params=null,this.getTSTHex=function(t,e){var i=n(t,e);return this.params.econtent.content.messageImprint={alg:e,hash:i},new r.TimeStampToken(this.params).getContentInfoEncodedHex()},void 0!==t&&(this.params=t)},Wt(lt.asn1.tsp.FixedTSAAdapter,lt.asn1.tsp.AbstractTSAAdapter),lt.asn1.tsp.TSPUtil=new function(){},lt.asn1.tsp.TSPUtil.newTimeStampToken=function(t){return new lt.asn1.tsp.TimeStampToken(t)},lt.asn1.tsp.TSPUtil.parseTimeStampReq=function(t){return(new lt.asn1.tsp.TSPParser).getTimeStampReq(t)},lt.asn1.tsp.TSPUtil.parseMessageImprint=function(t){return(new lt.asn1.tsp.TSPParser).getMessageImprint(t)},lt.asn1.tsp.TSPParser=function(){Error;var t=new Jt,e=pt,r=e.getV,n=e.getTLV,i=e.getIdxbyList,s=(e.getTLVbyListEx,e.getChildIdx),a=["granted","grantedWithMods","rejection","waiting","revocationWarning","revocationNotification"],o={0:"badAlg",2:"badRequest",5:"badDataFormat",14:"timeNotAvailable",15:"unacceptedPolicy",16:"unacceptedExtension",17:"addInfoNotAvailable",25:"systemFailure"};this.getResponse=function(t){var e=s(t,0);if(1==e.length)return this.getPKIStatusInfo(n(t,e[0]));if(e.length>1){var r=this.getPKIStatusInfo(n(t,e[0])),i=n(t,e[1]),a=this.getToken(i);return a.statusinfo=r,a}},this.getToken=function(t){var e=(new lt.asn1.cms.CMSParser).getCMSSignedData(t);return this.setTSTInfo(e),e},this.setTSTInfo=function(t){var e=t.econtent;if("tstinfo"==e.type){var r=e.content.hex,n=this.getTSTInfo(r);e.content=n}},this.getTSTInfo=function(e){var i={},a=s(e,0),o=r(e,a[1]);i.policy=Kt(o);var u=n(e,a[2]);i.messageImprint=this.getMessageImprint(u);var c=r(e,a[3]);i.serial={hex:c};var l=r(e,a[4]);i.genTime={str:bt(l)};var h=0;if(a.length>5&&"30"==e.substr(a[5],2)){var f=n(e,a[5]);i.accuracy=this.getAccuracy(f),h++}if(a.length>5+h&&"01"==e.substr(a[5+h],2)&&("ff"==r(e,a[5+h])&&(i.ordering=!0),h++),a.length>5+h&&"02"==e.substr(a[5+h],2)){var p=r(e,a[5+h]);i.nonce={hex:p},h++}if(a.length>5+h&&"a0"==e.substr(a[5+h],2)){var d=n(e,a[5+h]);d="30"+d.substr(2),pGeneralNames=t.getGeneralNames(d);var g=pGeneralNames[0].dn;i.tsa=g,h++}if(a.length>5+h&&"a1"==e.substr(a[5+h],2)){var y=n(e,a[5+h]);y="30"+y.substr(2);var v=t.getExtParamArray(y);i.ext=v,h++}return i},this.getAccuracy=function(t){for(var e={},n=s(t,0),i=0;i<n.length;i++){var a=t.substr(n[i],2),o=r(t,n[i]),u=parseInt(o,16);"02"==a?e.seconds=u:"80"==a?e.millis=u:"81"==a&&(e.micros=u)}return e},this.getMessageImprint=function(t){if("30"!=t.substr(0,2))throw new Error("head of messageImprint hex shall be x30");var n={},a=(s(t,0),i(t,0,[0,0])),o=r(t,a),u=e.hextooidstr(o),c=lt.asn1.x509.OID.oid2name(u);if(""==c)throw new Error("hashAlg name undefined: "+u);var l=c,h=i(t,0,[1]);return n.alg=l,n.hash=r(t,h),n},this.getPKIStatusInfo=function(t){var e={},i=s(t,0),o=0;try{var u=r(t,i[0]),c=parseInt(u,16);e.status=a[c]}catch(t){}if(i.length>1&&"30"==t.substr(i[1],2)){var l=n(t,i[1]);e.statusstr=this.getPKIFreeText(l),o++}if(i.length>o&&"03"==t.substr(i[1+o],2)){var h=n(t,i[1+o]);e.failinfo=this.getPKIFailureInfo(h)}return e},this.getPKIFreeText=function(t){for(var r=[],n=s(t,0),i=0;i<n.length;i++)r.push(e.getString(t,n[i]));return r},this.getPKIFailureInfo=function(t){var r=e.getInt(t,0);return null!=o[r]?o[r]:r},this.getTimeStampReq=function(t){var i={certreq:!1},a=s(t,0);if(a.length<2)throw new Error("TimeStampReq must have at least 2 items");var o=n(t,a[1]);i.messageImprint=lt.asn1.tsp.TSPUtil.parseMessageImprint(o);for(var u=2;u<a.length;u++){var c=a[u],l=t.substr(c,2);if("06"==l){var h=r(t,c);i.policy=e.hextooidstr(h)}"02"==l&&(i.nonce=r(t,c)),"01"==l&&(i.certreq=!0)}return i}},void 0!==lt&&lt||(lt={}),void 0!==lt.asn1&&lt.asn1||(lt.asn1={}),void 0!==lt.asn1.cades&&lt.asn1.cades||(lt.asn1.cades={}),lt.asn1.cades.SignaturePolicyIdentifier=function(t){var e=lt.asn1.cades,r=e.SignaturePolicyId;e.SignaturePolicyIdentifier.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.15",this.params=null,this.getValueArray=function(){return[new r(this.params)]},this.setByParam=function(t){this.params=t},null!=t&&this.setByParam(t)},Wt(lt.asn1.cades.SignaturePolicyIdentifier,lt.asn1.cms.Attribute),lt.asn1.cades.SignaturePolicyId=function(t){var e=lt.asn1,r=e.DERSequence,n=e.DERObjectIdentifier,i=(e.x509.AlgorithmIdentifier,e.cades),s=i.SignaturePolicyId,a=i.OtherHashAlgAndValue;s.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params,e=[];return e.push(new n(t.oid)),e.push(new a(t)),new r({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(t){this.params=t},null!=t&&this.setByParam(t)},Wt(lt.asn1.cades.SignaturePolicyId,lt.asn1.ASN1Object),lt.asn1.cades.OtherHashAlgAndValue=function(t){var e=Error,r=lt.asn1,n=r.DERSequence,i=r.DEROctetString,s=r.x509.AlgorithmIdentifier;r.cades.OtherHashAlgAndValue.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params;if(null==t.alg)throw new e("property 'alg' not specified");if(null==t.hash&&null==t.cert)throw new e("property 'hash' nor 'cert' not specified");var r=null;if(null!=t.hash)r=t.hash;else if(null!=t.cert){if("string"!=typeof t.cert)throw new e("cert not string");var a=t.cert;-1!=t.cert.indexOf("-----BEGIN")&&(a=Bt(t.cert)),r=lt.crypto.Util.hashHex(a,t.alg)}var o=[];return o.push(new s({name:t.alg})),o.push(new i({hex:r})),new n({array:o}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Wt(lt.asn1.cades.OtherHashAlgAndValue,lt.asn1.ASN1Object),lt.asn1.cades.OtherHashValue=function(t){lt.asn1.cades.OtherHashValue.superclass.constructor.call(this);var e=Error,r=lt,n=(r.lang.String.isHex,r.asn1.DEROctetString);r.crypto.Util.hashHex,this.params=null,this.tohex=function(){var t=this.params;if(null==t.hash&&null==t.cert)throw new e("hash or cert not specified");var r=null;if(null!=t.hash)r=t.hash;else if(null!=t.cert){if("string"!=typeof t.cert)throw new e("cert not string");var i=t.cert;-1!=t.cert.indexOf("-----BEGIN")&&(i=Bt(t.cert)),r=lt.crypto.Util.hashHex(i,"sha1")}return new n({hex:r}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Wt(lt.asn1.cades.OtherHashValue,lt.asn1.ASN1Object),lt.asn1.cades.SignatureTimeStamp=function(t){var e=Error,r=lt,n=r.lang.String.isHex,i=r.asn1,s=i.ASN1Object;i.x509,i.cades.SignatureTimeStamp.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.14",this.params=null,this.getValueArray=function(){var t=this.params;if(null!=t.tst){if(n(t.tst))return(r=new s).hTLV=t.tst,[r];if(t.tst instanceof s)return[t.tst];throw new e("params.tst has wrong value")}if(null!=t.res){var r,i=t.res;if(i instanceof s&&(i=i.tohex()),"string"!=typeof i||!n(i))throw new e("params.res has wrong value");return pt.getTLVbyList(i,0,[1]),(r=new s).hTLV=t.tst,[r]}},null!=t&&this.setByParam(t)},Wt(lt.asn1.cades.SignatureTimeStamp,lt.asn1.cms.Attribute),lt.asn1.cades.CompleteCertificateRefs=function(t){var e=Error,r=lt,n=r.asn1,i=n.DERSequence,s=n.cades,a=s.OtherCertID,o=r.lang.String.isHex;s.CompleteCertificateRefs.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.21",this.params=null,this.getValueArray=function(){for(var t=this.params,r=[],n=0;n<t.array.length;n++){var s=t.array[n];if("string"==typeof s)if(-1!=s.indexOf("-----BEGIN"))s={cert:s};else{if(!o(s))throw new e("unsupported value: "+s);s={hash:s}}null!=t.alg&&null==s.alg&&(s.alg=t.alg),null!=t.hasis&&null==s.hasis&&(s.hasis=t.hasis);var u=new a(s);r.push(u)}return[new i({array:r})]},null!=t&&this.setByParam(t)},Wt(lt.asn1.cades.CompleteCertificateRefs,lt.asn1.cms.Attribute),lt.asn1.cades.OtherCertID=function(t){var e=lt.asn1,r=e.DERSequence,n=e.cms.IssuerSerial,i=e.cades,s=i.OtherHashValue,a=i.OtherHashAlgAndValue;i.OtherCertID.superclass.constructor.call(this),this.params=t,this.tohex=function(){var t=this.params;"string"==typeof t&&(-1!=t.indexOf("-----BEGIN")?t={cert:t}:_isHex(t)&&(t={hash:t}));var e,i=[];if(e=null!=t.alg?new a(t):new s(t),i.push(e),null!=t.cert&&1==t.hasis||null!=t.issuer&&null!=t.serial){var o=new n(t);i.push(o)}return new r({array:i}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Wt(lt.asn1.cades.OtherCertID,lt.asn1.ASN1Object),lt.asn1.cades.OtherHash=function(t){Error;var e=lt,r=e.asn1,n=(r.cms,r.cades),i=n.OtherHashAlgAndValue,s=n.OtherHashValue,a=(e.crypto.Util.hashHex,e.lang.String.isHex);n.OtherHash.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params;return"string"==typeof t&&(-1!=t.indexOf("-----BEGIN")?t={cert:t}:a(t)&&(t={hash:t})),(null!=t.alg?new i(t):new s(t)).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Wt(lt.asn1.cades.OtherHash,lt.asn1.ASN1Object),lt.asn1.cades.CAdESUtil=new function(){},lt.asn1.cades.CAdESUtil.parseSignedDataForAddingUnsigned=function(t){return(new lt.asn1.cms.CMSParser).getCMSSignedData(t)},lt.asn1.cades.CAdESUtil.parseSignerInfoForAddingUnsigned=function(t,e,r){var n=pt,i=n.getChildIdx,s=n.getTLV,a=n.getV,o=lt.asn1,u=o.ASN1Object,c=o.cms,l=c.AttributeList,h=c.SignerInfo,f={},p=i(t,e);if(6!=p.length)throw"not supported items for SignerInfo (!=6)";var d=p.shift();f.version=s(t,d);var g=p.shift();f.si=s(t,g);var y=p.shift();f.digalg=s(t,y);var v=p.shift();f.sattrs=s(t,v);var m=p.shift();f.sigalg=s(t,m);var E=p.shift();f.sig=s(t,E),f.sigval=a(t,E);var S=null;return f.obj=new h,(S=new u).hTLV=f.version,f.obj.dCMSVersion=S,(S=new u).hTLV=f.si,f.obj.dSignerIdentifier=S,(S=new u).hTLV=f.digalg,f.obj.dDigestAlgorithm=S,(S=new u).hTLV=f.sattrs,f.obj.dSignedAttrs=S,(S=new u).hTLV=f.sigalg,f.obj.dSigAlg=S,(S=new u).hTLV=f.sig,f.obj.dSig=S,f.obj.dUnsignedAttrs=new l,f},void 0!==lt.asn1.csr&&lt.asn1.csr||(lt.asn1.csr={}),lt.asn1.csr.CertificationRequest=function(t){var e=lt.asn1,r=e.DERBitString,n=e.DERSequence,i=e.csr,s=(e.x509,i.CertificationRequestInfo);i.CertificationRequest.superclass.constructor.call(this),this.setByParam=function(t){this.params=t},this.sign=function(){var t=new s(this.params).tohex(),e=new lt.crypto.Signature({alg:this.params.sigalg});e.init(this.params.sbjprvkey),e.updateHex(t);var r=e.sign();this.params.sighex=r},this.getPEM=function(){return xt(this.tohex(),"CERTIFICATE REQUEST")},this.tohex=function(){var t=this.params,e=new lt.asn1.csr.CertificationRequestInfo(this.params),i=new lt.asn1.x509.AlgorithmIdentifier({name:t.sigalg});if(null==t.sighex&&null!=t.sbjprvkey&&this.sign(),null==t.sighex)throw new Error("sighex or sbjprvkey parameter not defined");var s=new r({hex:"00"+t.sighex});return new n({array:[e,i,s]}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},Wt(lt.asn1.csr.CertificationRequest,lt.asn1.ASN1Object),lt.asn1.csr.CertificationRequestInfo=function(t){var e=lt.asn1,r=(e.DERBitString,e.DERSequence),n=e.DERInteger,i=e.DERUTF8String,s=e.DERTaggedObject,a=e.ASN1Util.newObject,o=e.csr,u=e.x509,c=u.X500Name,l=u.Extensions,h=u.SubjectPublicKeyInfo;o.AttributeList,o.CertificationRequestInfo.superclass.constructor.call(this),this.params=null,this.setByParam=function(t){null!=t&&(this.params=t)},this.tohex=function(){var t=this.params,e=[];if(e.push(new n({int:0})),e.push(new c(t.subject)),e.push(new h($t.getKey(t.sbjpubkey))),null!=t.attrs){var o=function(t){for(var e=Error,r=lt.asn1.x509.Extensions,n=[],i=0;i<t.length;i++){var s=t[i],a=s.attr;if("extensionRequest"==a){var o={seq:[{oid:"1.2.840.113549.1.9.14"},{set:[new r(s.ext)]}]};n.push(o)}else if("unstructuredName"==a)o={seq:[{oid:"1.2.840.113549.1.9.2"},{set:s.names}]},n.push(o);else{if("challengePassword"!=a)throw new e("unknown CSR attribute");o={seq:[{oid:"1.2.840.113549.1.9.7"},{set:[{utf8str:s.password}]}]},n.push(o)}}return{set:n}}(t.attrs),u=a({tag:{tage:"a0",obj:o}});e.push(u)}else if(null!=t.extreq){var f=new l(t.extreq);u=a({tag:{tage:"a0",obj:{seq:[{oid:"1.2.840.113549.1.9.14"},{set:[f]}]}}}),e.push(u)}else e.push(new s({tag:"a0",explicit:!1,obj:new i({str:""})}));return new r({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Wt(lt.asn1.csr.CertificationRequestInfo,lt.asn1.ASN1Object),lt.asn1.csr.AttributeList=function(t){},Wt(lt.asn1.csr.AttributeList,lt.asn1.ASN1Object),lt.asn1.csr.CSRUtil=new function(){},lt.asn1.csr.CSRUtil.newCSRPEM=function(t){return new lt.asn1.csr.CertificationRequest(t).getPEM()},lt.asn1.csr.CSRUtil.getParam=function(t,e){var r=pt,n=r.getV,i=r.getIdxbyList,s=r.getTLVbyList,a=r.getTLVbyListEx,o=r.getVbyListEx,u={};if(-1==t.indexOf("-----BEGIN CERTIFICATE REQUEST"))throw new Error("argument is not PEM file");var c=Bt(t,"CERTIFICATE REQUEST");e&&(u.tbs=s(c,0,[0]));try{var l=a(c,0,[0,1]);if("3000"==l)u.subject={};else{var h=new Jt;u.subject=h.getX500Name(l)}}catch(t){}var f=a(c,0,[0,2]),p=$t.getKey(f,null,"pkcs8pub");u.sbjpubkey=$t.getPEM(p,"PKCS8PUB");var d=function(t){var e=i(t,0,[0,3,0,0],"06");return"2a864886f70d01090e"!=n(t,e)?null:s(t,0,[0,3,0,1,0],"30")}(c);h=new Jt,null!=d&&(u.extreq=h.getExtParamArray(d));try{var g=a(c,0,[1],"30");h=new Jt,u.sigalg=h.getAlgorithmIdentifierName(g)}catch(t){}try{var y=o(c,0,[2]);u.sighex=y}catch(t){}return u},lt.asn1.csr.CSRUtil.verifySignature=function(t){try{var e=null;if("string"==typeof t&&-1!=t.indexOf("-----BEGIN CERTIFICATE REQUEST")?e=lt.asn1.csr.CSRUtil.getParam(t,!0):"object"==typeof t&&null!=t.sbjpubkey&&null!=t.sigalg&&null!=t.sighex&&null!=t.tbs&&(e=t),null==e)return!1;var r=new lt.crypto.Signature({alg:e.sigalg});return r.init(e.sbjpubkey),r.updateHex(e.tbs),r.verify(e.sighex)}catch(t){return alert(t),!1}},void 0!==lt&&lt||(lt={}),void 0!==lt.asn1&&lt.asn1||(lt.asn1={}),void 0!==lt.asn1.ocsp&&lt.asn1.ocsp||(lt.asn1.ocsp={}),lt.asn1.ocsp.DEFAULT_HASH="sha1",lt.asn1.ocsp.OCSPResponse=function(t){lt.asn1.ocsp.OCSPResponse.superclass.constructor.call(this),lt.asn1.DEREnumerated;var e=lt.asn1.ASN1Util.newObject,r=lt.asn1.ocsp.ResponseBytes,n=["successful","malformedRequest","internalError","tryLater","_not_used_","sigRequired","unauthorized"];this.params=null,this._getStatusCode=function(){var t=this.params.resstatus;return"number"==typeof t?t:"string"!=typeof t?-1:n.indexOf(t)},this.setByParam=function(t){this.params=t},this.tohex=function(){var t=this.params,n=this._getStatusCode();if(-1==n)throw new Error("responseStatus not supported: "+t.resstatus);if(0!=n)return e({seq:[{enum:{int:n}}]}).tohex();var i=new r(t);return e({seq:[{enum:{int:0}},{tag:{tag:"a0",explicit:!0,obj:i}}]}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},Wt(lt.asn1.ocsp.OCSPResponse,lt.asn1.ASN1Object),lt.asn1.ocsp.ResponseBytes=function(t){lt.asn1.ocsp.ResponseBytes.superclass.constructor.call(this);var e=lt.asn1,r=e.DERSequence,n=e.DERObjectIdentifier,i=e.DEROctetString,s=e.ocsp.BasicOCSPResponse;this.params=null,this.setByParam=function(t){this.params=t},this.tohex=function(){var t=this.params;if("ocspBasic"!=t.restype)throw new Error("not supported responseType: "+t.restype);var e=new s(t),a=[];return a.push(new n({name:"ocspBasic"})),a.push(new i({hex:e.tohex()})),new r({array:a}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},Wt(lt.asn1.ocsp.ResponseBytes,lt.asn1.ASN1Object),lt.asn1.ocsp.BasicOCSPResponse=function(t){lt.asn1.ocsp.BasicOCSPResponse.superclass.constructor.call(this);var e=Error,r=lt.asn1,n=r.ASN1Object,i=r.DERSequence,s=(r.DERGeneralizedTime,r.DERTaggedObject),a=r.DERBitString,o=(r.x509.Extensions,r.x509.AlgorithmIdentifier),u=r.ocsp;u.ResponderID,_SingleResponseList=u.SingleResponseList,_ResponseData=u.ResponseData,this.params=null,this.setByParam=function(t){this.params=t},this.sign=function(){var t=this.params,e=t.tbsresp.tohex(),r=new lt.crypto.Signature({alg:t.sigalg});r.init(t.reskey),r.updateHex(e),t.sighex=r.sign()},this.tohex=function(){var t=this.params;null==t.tbsresp&&(t.tbsresp=new _ResponseData(t)),null==t.sighex&&null!=t.reskey&&this.sign();var r=[];if(r.push(t.tbsresp),r.push(new o({name:t.sigalg})),r.push(new a({hex:"00"+t.sighex})),null!=t.certs&&null!=t.certs.length){for(var u=[],c=0;c<t.certs.length;c++){var l=t.certs[c],h=null;if(pt.isASN1HEX(l))h=l;else{if(!l.match(/-----BEGIN/))throw new e("certs["+c+"] not hex or PEM");h=Bt(l)}u.push(new n({tlv:h}))}var f=new i({array:u});r.push(new s({tag:"a0",explicit:!0,obj:f}))}return new i({array:r}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},Wt(lt.asn1.ocsp.BasicOCSPResponse,lt.asn1.ASN1Object),lt.asn1.ocsp.ResponseData=function(t){lt.asn1.ocsp.ResponseData.superclass.constructor.call(this);var e=Error,r=lt.asn1,n=r.DERSequence,i=r.DERGeneralizedTime,s=r.DERTaggedObject,a=r.x509.Extensions,o=r.ocsp,u=o.ResponderID;_SingleResponseList=o.SingleResponseList,this.params=null,this.tohex=function(){var t=this.params;null!=t.respid&&new e("respid not specified"),null!=t.prodat&&new e("prodat not specified"),null!=t.array&&new e("array not specified");var r=[];if(r.push(new u(t.respid)),r.push(new i(t.prodat)),r.push(new _SingleResponseList(t.array)),null!=t.ext){var o=new a(t.ext);r.push(new s({tag:"a1",explicit:!0,obj:o}))}return new n({array:r}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(t){this.params=t},void 0!==t&&this.setByParam(t)},Wt(lt.asn1.ocsp.ResponseData,lt.asn1.ASN1Object),lt.asn1.ocsp.ResponderID=function(t){lt.asn1.ocsp.ResponderID.superclass.constructor.call(this);var e=lt,r=e.asn1,n=r.ASN1Util.newObject,i=r.x509.X500Name,s=e.lang.String.isHex,a=Error;this.params=null,this.tohex=function(){var t=this.params;if(null!=t.key){var e,r=null;if("string"==typeof t.key?(s(t.key)&&(r=t.key),t.key.match(/-----BEGIN CERTIFICATE/)&&null!=(e=new Jt(t.key).getExtSubjectKeyIdentifier())&&(r=e.kid.hex)):t.key instanceof Jt&&null!=(e=t.key.getExtSubjectKeyIdentifier())&&(r=e.kid.hex),null==r)throw new a("wrong key member value");return n({tag:{tag:"a2",explicit:!0,obj:{octstr:{hex:r}}}}).tohex()}if(null!=t.name){var o=null;if("string"==typeof t.name&&t.name.match(/-----BEGIN CERTIFICATE/)?o=new Jt(t.name).getSubject():t.name instanceof Jt?o=t.name.getSubject():"object"!=typeof t.name||null==t.name.array&&null==t.name.str||(o=t.name),null==o)throw new a("wrong name member value");return n({tag:{tag:"a1",explicit:!0,obj:new i(o)}}).tohex()}throw new a("key or name not specified")},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(t){this.params=t},void 0!==t&&this.setByParam(t)},Wt(lt.asn1.ocsp.ResponderID,lt.asn1.ASN1Object),lt.asn1.ocsp.SingleResponseList=function(t){lt.asn1.ocsp.SingleResponseList.superclass.constructor.call(this);var e=lt.asn1,r=e.DERSequence,n=e.ocsp.SingleResponse;this.params=null,this.tohex=function(){var t=this.params;if("object"!=typeof t||null==t.length)throw new Error("params not specified properly");for(var e=[],i=0;i<t.length;i++)e.push(new n(t[i]));return new r({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(t){this.params=t},void 0!==t&&this.setByParam(t)},Wt(lt.asn1.ocsp.SingleResponseList,lt.asn1.ASN1Object),lt.asn1.ocsp.SingleResponse=function(t){var e=Error,r=lt.asn1,n=r.DERSequence,i=r.DERGeneralizedTime,s=r.DERTaggedObject,a=r.ocsp,o=a.CertID,u=a.CertStatus,c=r.x509.Extensions;a.SingleResponse.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params,r=[];if(null==t.certid)throw new e("certid unspecified");if(null==t.status)throw new e("status unspecified");if(null==t.thisupdate)throw new e("thisupdate unspecified");if(r.push(new o(t.certid)),r.push(new u(t.status)),r.push(new i(t.thisupdate)),null!=t.nextupdate){var a=new i(t.nextupdate);r.push(new s({tag:"a0",explicit:!0,obj:a}))}if(null!=t.ext){var l=new c(t.ext);r.push(new s({tag:"a1",explicit:!0,obj:l}))}return new n({array:r}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(t){this.params=t},void 0!==t&&this.setByParam(t)},Wt(lt.asn1.ocsp.SingleResponse,lt.asn1.ASN1Object),lt.asn1.ocsp.CertID=function(t){var e=lt,r=e.asn1,n=r.DEROctetString,i=r.DERInteger,s=r.DERSequence,a=r.x509.AlgorithmIdentifier,o=r.ocsp,u=(o.DEFAULT_HASH,e.crypto.Util.hashHex),c=Jt,l=pt.getVbyList;o.CertID.superclass.constructor.call(this),this.DEFAULT_HASH="sha1",this.params=null,this.setByValue=function(t,e,r,n){null==n&&(n=this.DEFAULT_HASH),this.params={alg:n,issname:t,isskey:e,sbjsn:r}},this.setByCert=function(t,e,r){null==r&&(r=this.DEFAULT_HASH),this.params={alg:r,issuerCert:t,subjectCert:e}},this.getParamByCerts=function(t,e,r){null==r&&(r=this.DEFAULT_HASH);var n=new c(t),i=new c(e),s=u(n.getSubjectHex(),r),a=n.getPublicKeyHex();return{alg:r,issname:s,isskey:u(l(a,0,[1],"03",!0),r),sbjsn:i.getSerialNumberHex()}},this.tohex=function(){if("object"!=typeof this.params)throw new Error("params not set");var t,e,r,o,u=this.params;if(o=null==u.alg?this.DEFAULT_HASH:u.alg,null!=u.issuerCert&&null!=u.subjectCert){var c=this.getParamByCerts(u.issuerCert,u.subjectCert,o);t=c.issname,e=c.isskey,r=c.sbjsn}else{if(null==u.issname||null==u.isskey||null==u.sbjsn)throw new Error("required param members not defined");t=u.issname,e=u.isskey,r=u.sbjsn}var l=new a({name:o}),h=new n({hex:t}),f=new n({hex:e}),p=new i({hex:r}),d=new s({array:[l,h,f,p]});return this.hTLV=d.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},Wt(lt.asn1.ocsp.CertID,lt.asn1.ASN1Object),lt.asn1.ocsp.CertStatus=function(t){lt.asn1.ocsp.CertStatus.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params;if("good"==t.status)return"8000";if("unknown"==t.status)return"8200";if("revoked"==t.status){var e=[{gentime:{str:t.time}}];null!=t.reason&&e.push({tag:{tag:"a0",explicit:!0,obj:{enum:{int:t.reason}}}});var r={tag:"a1",explicit:!1,obj:{seq:e}};return lt.asn1.ASN1Util.newObject({tag:r}).tohex()}throw new Error("bad status")},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(t){this.params=t},void 0!==t&&this.setByParam(t)},Wt(lt.asn1.ocsp.CertStatus,lt.asn1.ASN1Object),lt.asn1.ocsp.Request=function(t){var e=lt.asn1,r=e.DERSequence,n=e.ocsp;if(n.Request.superclass.constructor.call(this),this.dReqCert=null,this.dExt=null,this.tohex=function(){var t=[];if(null===this.dReqCert)throw"reqCert not set";t.push(this.dReqCert);var e=new r({array:t});return this.hTLV=e.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==t){var i=new n.CertID(t);this.dReqCert=i}},Wt(lt.asn1.ocsp.Request,lt.asn1.ASN1Object),lt.asn1.ocsp.TBSRequest=function(t){var e=lt.asn1,r=e.DERSequence,n=e.ocsp;n.TBSRequest.superclass.constructor.call(this),this.version=0,this.dRequestorName=null,this.dRequestList=[],this.dRequestExt=null,this.setRequestListByParam=function(t){for(var e=[],r=0;r<t.length;r++){var i=new n.Request(t[0]);e.push(i)}this.dRequestList=e},this.tohex=function(){var t=[];if(0!==this.version)throw"not supported version: "+this.version;if(null!==this.dRequestorName)throw"requestorName not supported";var e=new r({array:this.dRequestList});if(t.push(e),null!==this.dRequestExt)throw"requestExtensions not supported";var n=new r({array:t});return this.hTLV=n.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&void 0!==t.reqList&&this.setRequestListByParam(t.reqList)},Wt(lt.asn1.ocsp.TBSRequest,lt.asn1.ASN1Object),lt.asn1.ocsp.OCSPRequest=function(t){var e=lt.asn1,r=e.DERSequence,n=e.ocsp;if(n.OCSPRequest.superclass.constructor.call(this),this.dTbsRequest=null,this.dOptionalSignature=null,this.tohex=function(){var t=[];if(null===this.dTbsRequest)throw"tbsRequest not set";if(t.push(this.dTbsRequest),null!==this.dOptionalSignature)throw"optionalSignature not supported";var e=new r({array:t});return this.hTLV=e.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&void 0!==t.reqList){var i=new n.TBSRequest(t);this.dTbsRequest=i}},Wt(lt.asn1.ocsp.OCSPRequest,lt.asn1.ASN1Object),lt.asn1.ocsp.OCSPUtil={},lt.asn1.ocsp.OCSPUtil.getRequestHex=function(t,e,r){var n=lt.asn1.ocsp;void 0===r&&(r=n.DEFAULT_HASH);var i={alg:r,issuerCert:t,subjectCert:e};return new n.OCSPRequest({reqList:[i]}).tohex()},lt.asn1.ocsp.OCSPUtil.getOCSPResponseInfo=function(t){var e=pt,r=e.getVbyList,n=e.getVbyListEx,i=e.getIdxbyList,s=(e.getIdxbyListEx,e.getV),a={};try{var o=n(t,0,[0],"0a");a.responseStatus=parseInt(o,16)}catch(t){}if(0!==a.responseStatus)return a;try{var u=i(t,0,[1,0,1,0,0,2,0,1]);"80"===t.substr(u,2)?a.certStatus="good":"a1"===t.substr(u,2)?(a.certStatus="revoked",a.revocationTime=bt(r(t,u,[0]))):"82"===t.substr(u,2)&&(a.certStatus="unknown")}catch(t){}try{var c=i(t,0,[1,0,1,0,0,2,0,2]);a.thisUpdate=bt(s(t,c))}catch(t){}try{var l=i(t,0,[1,0,1,0,0,2,0,3]);"a0"===t.substr(l,2)&&(a.nextUpdate=bt(r(t,l,[0])))}catch(t){}return a},lt.asn1.ocsp.OCSPParser=function(){var t=Error,e=Jt,r=new e,n=pt,i=n.getV,s=n.getTLV,a=n.getIdxbyList,o=n.getVbyList,u=n.getTLVbyList,c=n.getVbyListEx,l=n.getTLVbyListEx,h=n.getChildIdx;this.getOCSPRequest=function(e){var r=h(e,0);if(1!=r.length&&2!=r.length)throw new t("wrong number elements: "+r.length);return this.getTBSRequest(s(e,r[0]))},this.getTBSRequest=function(t){var e={},n=l(t,0,[0],"30");e.array=this.getRequestList(n);var i=l(t,0,["[2]",0],"30");return null!=i&&(e.ext=r.getExtParamArray(i)),e},this.getRequestList=function(t){for(var e=[],r=h(t,0),n=0;n<r.length;n++)t=s(t,r[n]),e.push(this.getRequest(t));return e},this.getRequest=function(e){var n=h(e,0);if(1!=n.length&&2!=n.length)throw new t("wrong number elements: "+n.length);var i=this.getCertID(s(e,n[0]));if(2==n.length){var o=a(e,0,[1,0]);i.ext=r.getExtParamArray(s(e,o))}return i},this.getCertID=function(r){var n=h(r,0);if(4!=n.length)throw new t("wrong number elements: "+n.length);var a=new e,o={};return o.alg=a.getAlgorithmIdentifierName(s(r,n[0])),o.issname=i(r,n[1]),o.isskey=i(r,n[2]),o.sbjsn=i(r,n[3]),o},this.getOCSPResponse=function(t){var e,r=h(t,0),n=i(t,r[0]),s=parseInt(n);if(1==r.length)return{resstatus:s};var a=u(t,0,[1,0]);return(e=this.getResponseBytes(a)).resstatus=s,e},this.getResponseBytes=function(t){var e,r=h(t,0),n=u(t,0,[1,0]);e=this.getBasicOCSPResponse(n);var s=i(t,r[0]);return e.restype=lt.asn1.x509.OID.oid2name(Kt(s)),e},this.getBasicOCSPResponse=function(t){var e,r=h(t,0);e=this.getResponseData(s(t,r[0]));var n=new Jt;e.alg=n.getAlgorithmIdentifierName(s(t,r[1]));var a=i(t,r[2]);e.sighex=a.substr(2);var o=c(t,0,["[0]"]);if(null!=o){for(var u=h(o,0),l=[],f=0;f<u.length;f++){var p=s(o,u[f]);l.push(p)}e.certs=l}return e},this.getResponseData=function(t){var e=h(t,0),r=e.length,n={},a=0;"a0"==t.substr(e[0],2)&&a++,n.respid=this.getResponderID(s(t,e[a++]));var o=i(t,e[a++]);if(n.prodat=bt(o),n.array=this.getSingleResponseList(s(t,e[a++])),"a1"==t.substr(e[r-1],2)){var c=u(t,e[r-1],[0]),l=new Jt;n.ext=l.getExtParamArray(c)}return n},this.getResponderID=function(t){var e={};if("a2"==t.substr(0,2)){var r=o(t,0,[0]);e.key=r}if("a1"==t.substr(0,2)){var n=u(t,0,[0]),i=new Jt;e.name=i.getX500Name(n)}return e},this.getSingleResponseList=function(t){for(var e=h(t,0),r=[],n=0;n<e.length;n++){var i=this.getSingleResponse(s(t,e[n]));r.push(i)}return r},this.getSingleResponse=function(t){var e=h(t,0),r={},n=this.getCertID(s(t,e[0]));r.certid=n;var a=this.getCertStatus(s(t,e[1]));if(r.status=a,"18"==t.substr(e[2],2)){var c=i(t,e[2]);r.thisupdate=bt(c)}for(var l=3;l<e.length;l++){if("a0"==t.substr(e[l],2)){var f=o(t,e[l],[0],"18");r.nextupdate=bt(f)}if("a1"==t.substr(e[l],2)){var p=new Jt,d=u(t,0,[l,0]);r.ext=p.getExtParamArray(d)}}return r},this.getCertStatus=function(t){var e={};if("8000"==t)return{status:"good"};if("8200"==t)return{status:"unknown"};if("a1"==t.substr(0,2)){e.status="revoked";var r=bt(o(t,0,[0]));e.time=r}return e}},void 0!==lt&&lt||(lt={}),void 0!==lt.lang&&lt.lang||(lt.lang={}),lt.lang.String=function(){},"function"==typeof d?(ht=function(t){return yt(d.from(t,"utf8").toString("base64"))},ft=function(t){return d.from(vt(t),"base64").toString("utf8")}):(ht=function(t){return mt(Tt(_t(t)))},ft=function(t){return decodeURIComponent(Ft(Et(t)))}),lt.lang.String.isInteger=function(t){return!!t.match(/^[0-9]+$/)||!!t.match(/^-[0-9]+$/)},lt.lang.String.isHex=function(t){return Ut(t)},lt.lang.String.isBase64=function(t){return!(!(t=t.replace(/\s+/g,"")).match(/^[0-9A-Za-z+\/]+={0,3}$/)||t.length%4!=0)},lt.lang.String.isBase64URL=function(t){return!t.match(/[+/=]/)&&(t=vt(t),lt.lang.String.isBase64(t))},lt.lang.String.isIntegerArray=function(t){return!!(t=t.replace(/\s+/g,"")).match(/^\[[0-9,]+\]$/)},lt.lang.String.isPrintable=function(t){return null!==t.match(/^[0-9A-Za-z '()+,-./:=?]*$/)},lt.lang.String.isIA5=function(t){return null!==t.match(/^[\x20-\x21\x23-\x7f]*$/)},lt.lang.String.isMail=function(t){return null!==t.match(/^[A-Za-z0-9]{1}[A-Za-z0-9_.-]*@{1}[A-Za-z0-9_.-]{1,}\.[A-Za-z0-9]{1,}$/)};var qt=function(t,e,r){return null==r&&(r="0"),t.length>=e?t:new Array(e-t.length+1).join(r)+t};function Gt(t,e){for(var r=0,n=0;n<t.length;n++)r|=1<<e[t[n]];var i=r.toString(2),s="";for(n=i.length-1;n>=0;n--)s+=i[n];return s}function zt(t,e,r){if("object"==typeof t){e=String(e).split(".");for(var n=0;n<e.length&&t;n++){var i=e[n];i.match(/^[0-9]+$/)&&(i=parseInt(i)),t=t[i]}return t||!1===t?t:r}}function Wt(t,e){var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t,t.superclass=e.prototype,e.prototype.constructor==Object.prototype.constructor&&(e.prototype.constructor=e)}void 0!==lt&&lt||(lt={}),void 0!==lt.crypto&&lt.crypto||(lt.crypto={}),lt.crypto.Util=new function(){this.DIGESTINFOHEAD={sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",ripemd160:"3021300906052b2403020105000414"},this.DEFAULTPROVIDER={md5:"cryptojs",sha1:"cryptojs",sha224:"cryptojs",sha256:"cryptojs",sha384:"cryptojs",sha512:"cryptojs",ripemd160:"cryptojs",hmacmd5:"cryptojs",hmacsha1:"cryptojs",hmacsha224:"cryptojs",hmacsha256:"cryptojs",hmacsha384:"cryptojs",hmacsha512:"cryptojs",hmacripemd160:"cryptojs",MD5withRSA:"cryptojs/jsrsa",SHA1withRSA:"cryptojs/jsrsa",SHA224withRSA:"cryptojs/jsrsa",SHA256withRSA:"cryptojs/jsrsa",SHA384withRSA:"cryptojs/jsrsa",SHA512withRSA:"cryptojs/jsrsa",RIPEMD160withRSA:"cryptojs/jsrsa",MD5withECDSA:"cryptojs/jsrsa",SHA1withECDSA:"cryptojs/jsrsa",SHA224withECDSA:"cryptojs/jsrsa",SHA256withECDSA:"cryptojs/jsrsa",SHA384withECDSA:"cryptojs/jsrsa",SHA512withECDSA:"cryptojs/jsrsa",RIPEMD160withECDSA:"cryptojs/jsrsa",SHA1withDSA:"cryptojs/jsrsa",SHA224withDSA:"cryptojs/jsrsa",SHA256withDSA:"cryptojs/jsrsa",MD5withRSAandMGF1:"cryptojs/jsrsa",SHAwithRSAandMGF1:"cryptojs/jsrsa",SHA1withRSAandMGF1:"cryptojs/jsrsa",SHA224withRSAandMGF1:"cryptojs/jsrsa",SHA256withRSAandMGF1:"cryptojs/jsrsa",SHA384withRSAandMGF1:"cryptojs/jsrsa",SHA512withRSAandMGF1:"cryptojs/jsrsa",RIPEMD160withRSAandMGF1:"cryptojs/jsrsa"},this.CRYPTOJSMESSAGEDIGESTNAME={md5:v.algo.MD5,sha1:v.algo.SHA1,sha224:v.algo.SHA224,sha256:v.algo.SHA256,sha384:v.algo.SHA384,sha512:v.algo.SHA512,ripemd160:v.algo.RIPEMD160},this.getDigestInfoHex=function(t,e){if(void 0===this.DIGESTINFOHEAD[e])throw"alg not supported in Util.DIGESTINFOHEAD: "+e;return this.DIGESTINFOHEAD[e]+t},this.getPaddedDigestInfoHex=function(t,e,r){var n=this.getDigestInfoHex(t,e),i=r/4;if(n.length+22>i)throw"key is too short for SigAlg: keylen="+r+","+e;for(var s="00"+n,a="",o=i-4-s.length,u=0;u<o;u+=2)a+="ff";return"0001"+a+s},this.hashString=function(t,e){return new lt.crypto.MessageDigest({alg:e}).digestString(t)},this.hashHex=function(t,e){return new lt.crypto.MessageDigest({alg:e}).digestHex(t)},this.sha1=function(t){return this.hashString(t,"sha1")},this.sha256=function(t){return this.hashString(t,"sha256")},this.sha256Hex=function(t){return this.hashHex(t,"sha256")},this.sha512=function(t){return this.hashString(t,"sha512")},this.sha512Hex=function(t){return this.hashHex(t,"sha512")},this.isKey=function(t){return t instanceof st||t instanceof lt.crypto.DSA||t instanceof lt.crypto.ECDSA}},lt.crypto.Util.md5=function(t){return new lt.crypto.MessageDigest({alg:"md5",prov:"cryptojs"}).digestString(t)},lt.crypto.Util.ripemd160=function(t){return new lt.crypto.MessageDigest({alg:"ripemd160",prov:"cryptojs"}).digestString(t)},lt.crypto.Util.SECURERANDOMGEN=new nt,lt.crypto.Util.getRandomHexOfNbytes=function(t){var e=new Array(t);return lt.crypto.Util.SECURERANDOMGEN.nextBytes(e),dt(e)},lt.crypto.Util.getRandomBigIntegerOfNbytes=function(t){return new A(lt.crypto.Util.getRandomHexOfNbytes(t),16)},lt.crypto.Util.getRandomHexOfNbits=function(t){var e=t%8,r=new Array((t-e)/8+1);return lt.crypto.Util.SECURERANDOMGEN.nextBytes(r),r[0]=(255<<e&255^255)&r[0],dt(r)},lt.crypto.Util.getRandomBigIntegerOfNbits=function(t){return new A(lt.crypto.Util.getRandomHexOfNbits(t),16)},lt.crypto.Util.getRandomBigIntegerZeroToMax=function(t){for(var e=t.bitLength();;){var r=lt.crypto.Util.getRandomBigIntegerOfNbits(e);if(-1!=t.compareTo(r))return r}},lt.crypto.Util.getRandomBigIntegerMinToMax=function(t,e){var r=t.compareTo(e);if(1==r)throw"biMin is greater than biMax";if(0==r)return t;var n=e.subtract(t);return lt.crypto.Util.getRandomBigIntegerZeroToMax(n).add(t)},lt.crypto.MessageDigest=function(t){this.setAlgAndProvider=function(t,e){if(null!==(t=lt.crypto.MessageDigest.getCanonicalAlgName(t))&&void 0===e&&(e=lt.crypto.Util.DEFAULTPROVIDER[t]),-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(t)&&"cryptojs"==e){try{this.md=lt.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[t].create()}catch(e){throw"setAlgAndProvider hash alg set fail alg="+t+"/"+e}this.updateString=function(t){this.md.update(t)},this.updateHex=function(t){var e=v.enc.Hex.parse(t);this.md.update(e)},this.digest=function(){return this.md.finalize().toString(v.enc.Hex)},this.digestString=function(t){return this.updateString(t),this.digest()},this.digestHex=function(t){return this.updateHex(t),this.digest()}}if(-1!=":sha256:".indexOf(t)&&"sjcl"==e){try{this.md=new sjcl.hash.sha256}catch(e){throw"setAlgAndProvider hash alg set fail alg="+t+"/"+e}this.updateString=function(t){this.md.update(t)},this.updateHex=function(t){var e=sjcl.codec.hex.toBits(t);this.md.update(e)},this.digest=function(){var t=this.md.finalize();return sjcl.codec.hex.fromBits(t)},this.digestString=function(t){return this.updateString(t),this.digest()},this.digestHex=function(t){return this.updateHex(t),this.digest()}}},this.updateString=function(t){throw"updateString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.updateHex=function(t){throw"updateHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digest=function(){throw"digest() not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestString=function(t){throw"digestString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestHex=function(t){throw"digestHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},void 0!==t&&void 0!==t.alg&&(this.algName=t.alg,void 0===t.prov&&(this.provName=lt.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName))},lt.crypto.MessageDigest.getCanonicalAlgName=function(t){return"string"==typeof t&&(t=(t=t.toLowerCase()).replace(/-/,"")),t},lt.crypto.MessageDigest.getHashLength=function(t){var e=lt.crypto.MessageDigest,r=e.getCanonicalAlgName(t);if(void 0===e.HASHLENGTH[r])throw"not supported algorithm: "+t;return e.HASHLENGTH[r]},lt.crypto.MessageDigest.HASHLENGTH={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,ripemd160:20},lt.crypto.Mac=function(t){this.setAlgAndProvider=function(t,e){if(null==(t=t.toLowerCase())&&(t="hmacsha1"),"hmac"!=(t=t.toLowerCase()).substr(0,4))throw"setAlgAndProvider unsupported HMAC alg: "+t;void 0===e&&(e=lt.crypto.Util.DEFAULTPROVIDER[t]),this.algProv=t+"/"+e;var r=t.substr(4);if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(r)&&"cryptojs"==e){try{var n=lt.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[r];this.mac=v.algo.HMAC.create(n,this.pass)}catch(t){throw"setAlgAndProvider hash alg set fail hashAlg="+r+"/"+t}this.updateString=function(t){this.mac.update(t)},this.updateHex=function(t){var e=v.enc.Hex.parse(t);this.mac.update(e)},this.doFinal=function(){return this.mac.finalize().toString(v.enc.Hex)},this.doFinalString=function(t){return this.updateString(t),this.doFinal()},this.doFinalHex=function(t){return this.updateHex(t),this.doFinal()}}},this.updateString=function(t){throw"updateString(str) not supported for this alg/prov: "+this.algProv},this.updateHex=function(t){throw"updateHex(hex) not supported for this alg/prov: "+this.algProv},this.doFinal=function(){throw"digest() not supported for this alg/prov: "+this.algProv},this.doFinalString=function(t){throw"digestString(str) not supported for this alg/prov: "+this.algProv},this.doFinalHex=function(t){throw"digestHex(hex) not supported for this alg/prov: "+this.algProv},this.setPassword=function(t){if("string"==typeof t){var e=t;return t.length%2!=1&&t.match(/^[0-9A-Fa-f]+$/)||(e=wt(t)),void(this.pass=v.enc.Hex.parse(e))}if("object"!=typeof t)throw"KJUR.crypto.Mac unsupported password type: "+t;if(e=null,void 0!==t.hex){if(t.hex.length%2!=0||!t.hex.match(/^[0-9A-Fa-f]+$/))throw"Mac: wrong hex password: "+t.hex;e=t.hex}if(void 0!==t.utf8&&(e=St(t.utf8)),void 0!==t.rstr&&(e=wt(t.rstr)),void 0!==t.b64&&(e=C(t.b64)),void 0!==t.b64u&&(e=Et(t.b64u)),null==e)throw"KJUR.crypto.Mac unsupported password type: "+t;this.pass=v.enc.Hex.parse(e)},void 0!==t&&(void 0!==t.pass&&this.setPassword(t.pass),void 0!==t.alg&&(this.algName=t.alg,void 0===t.prov&&(this.provName=lt.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName)))},lt.crypto.Signature=function(t){var e=null;if(this._setAlgNames=function(){var t=this.algName.match(/^(.+)with(.+)$/);t&&(this.mdAlgName=t[1].toLowerCase(),this.pubkeyAlgName=t[2].toLowerCase(),"rsaandmgf1"==this.pubkeyAlgName&&"sha"==this.mdAlgName&&(this.mdAlgName="sha1"))},this._zeroPaddingOfSignature=function(t,e){for(var r="",n=e/4-t.length,i=0;i<n;i++)r+="0";return r+t},this.setAlgAndProvider=function(t,e){if(this._setAlgNames(),"cryptojs/jsrsa"!=e)throw new Error("provider not supported: "+e);if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(this.mdAlgName)){try{this.md=new lt.crypto.MessageDigest({alg:this.mdAlgName})}catch(t){throw new Error("setAlgAndProvider hash alg set fail alg="+this.mdAlgName+"/"+t)}this.init=function(t,e){var r=null;try{r=void 0===e?$t.getKey(t):$t.getKey(t,e)}catch(t){throw"init failed:"+t}if(!0===r.isPrivate)this.prvKey=r,this.state="SIGN";else{if(!0!==r.isPublic)throw"init failed.:"+r;this.pubKey=r,this.state="VERIFY"}},this.updateString=function(t){this.md.updateString(t)},this.updateHex=function(t){this.md.updateHex(t)},this.sign=function(){if(this.sHashHex=this.md.digest(),void 0===this.prvKey&&void 0!==this.ecprvhex&&void 0!==this.eccurvename&&void 0!==lt.crypto.ECDSA&&(this.prvKey=new lt.crypto.ECDSA({curve:this.eccurvename,prv:this.ecprvhex})),this.prvKey instanceof st&&"rsaandmgf1"===this.pubkeyAlgName)this.hSign=this.prvKey.signWithMessageHashPSS(this.sHashHex,this.mdAlgName,this.pssSaltLen);else if(this.prvKey instanceof st&&"rsa"===this.pubkeyAlgName)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex,this.mdAlgName);else if(this.prvKey instanceof lt.crypto.ECDSA)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex);else{if(!(this.prvKey instanceof lt.crypto.DSA))throw"Signature: unsupported private key alg: "+this.pubkeyAlgName;this.hSign=this.prvKey.signWithMessageHash(this.sHashHex)}return this.hSign},this.signString=function(t){return this.updateString(t),this.sign()},this.signHex=function(t){return this.updateHex(t),this.sign()},this.verify=function(t){if(this.sHashHex=this.md.digest(),void 0===this.pubKey&&void 0!==this.ecpubhex&&void 0!==this.eccurvename&&void 0!==lt.crypto.ECDSA&&(this.pubKey=new lt.crypto.ECDSA({curve:this.eccurvename,pub:this.ecpubhex})),this.pubKey instanceof st&&"rsaandmgf1"===this.pubkeyAlgName)return this.pubKey.verifyWithMessageHashPSS(this.sHashHex,t,this.mdAlgName,this.pssSaltLen);if(this.pubKey instanceof st&&"rsa"===this.pubkeyAlgName)return this.pubKey.verifyWithMessageHash(this.sHashHex,t);if(void 0!==lt.crypto.ECDSA&&this.pubKey instanceof lt.crypto.ECDSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,t);if(void 0!==lt.crypto.DSA&&this.pubKey instanceof lt.crypto.DSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,t);throw"Signature: unsupported public key alg: "+this.pubkeyAlgName}}},this.init=function(t,e){throw"init(key, pass) not supported for this alg:prov="+this.algProvName},this.updateString=function(t){throw"updateString(str) not supported for this alg:prov="+this.algProvName},this.updateHex=function(t){throw"updateHex(hex) not supported for this alg:prov="+this.algProvName},this.sign=function(){throw"sign() not supported for this alg:prov="+this.algProvName},this.signString=function(t){throw"digestString(str) not supported for this alg:prov="+this.algProvName},this.signHex=function(t){throw"digestHex(hex) not supported for this alg:prov="+this.algProvName},this.verify=function(t){throw"verify(hSigVal) not supported for this alg:prov="+this.algProvName},this.initParams=t,void 0!==t&&(void 0!==t.alg&&(this.algName=t.alg,void 0===t.prov?this.provName=lt.crypto.Util.DEFAULTPROVIDER[this.algName]:this.provName=t.prov,this.algProvName=this.algName+":"+this.provName,this.setAlgAndProvider(this.algName,this.provName),this._setAlgNames()),void 0!==t.psssaltlen&&(this.pssSaltLen=t.psssaltlen),void 0!==t.prvkeypem)){if(void 0!==t.prvkeypas)throw"both prvkeypem and prvkeypas parameters not supported";try{e=$t.getKey(t.prvkeypem),this.init(e)}catch(t){throw"fatal error to load pem private key: "+t}}},lt.crypto.Cipher=function(t){},lt.crypto.Cipher.encrypt=function(t,e,r,n){if(null!=zt(n,"enclag")&&(r=n.encalg),"string"==typeof r&&"-CBC"==r.substr(-4)){var i=e,s=t;null!=zt(n,"key")&&(i=n.key),null!=zt(n,"enc")&&(hEnc=n.enc);var a,o=v.enc.Hex.parse(i),u=v.enc.Hex.parse(s),c=v.enc.Hex.parse(n.iv);if("des-EDE3-CBC"==r)a=v.TripleDES.encrypt(u,o,{iv:c});else{if("aes128-CBC"!=r&&"aes256-CBC"!=r)throw new Error("unsupported algorithm: "+r);a=v.AES.encrypt(u,o,{iv:c})}return a+""}throw new Error("Cipher.encrypt: unsupported key or algorithm")},lt.crypto.Cipher.decrypt=function(t,e,r,n){if(null!=zt(n,"enclag")&&(r=n.encalg),"string"==typeof r&&"-CBC"==r.substr(-4)){var i=e,s=t;null!=zt(n,"key")&&(i=n.key),null!=zt(n,"enc")&&(s=n.enc);var a,o=v.enc.Hex.parse(i),u=v.enc.Hex.parse(s),c=v.enc.Hex.parse(n.iv);if("des-EDE3-CBC"==r)a=v.TripleDES.decrypt({ciphertext:u},o,{iv:c});else{if("aes128-CBC"!=r&&"aes256-CBC"!=r)throw new Error("unsupported algorithm: "+r);a=v.AES.decrypt({ciphertext:u},o,{iv:c})}return v.enc.Hex.stringify(a)}throw new Error("Cipher.decrypt: unsupported key or algorithm")},lt.crypto.OID=new function(){this.oidhex2name={"2a864886f70d010101":"rsaEncryption","2a8648ce3d0201":"ecPublicKey","2a8648ce380401":"dsa","2a8648ce3d030107":"secp256r1","2b8104001f":"secp192k1","2b81040021":"secp224r1","2b8104000a":"secp256k1","2b81040022":"secp384r1","2b81040023":"secp521r1","2a8648ce380403":"SHA1withDSA","608648016503040301":"SHA224withDSA","608648016503040302":"SHA256withDSA"}},void 0!==lt&&lt||(lt={}),void 0!==lt.crypto&&lt.crypto||(lt.crypto={}),lt.crypto.ECDSA=function(t){var e=Error,r=A,n=ot,i=lt.crypto.ECDSA,s=lt.crypto.ECParameterDB,a=i.getName,o=pt,u=o.getVbyListEx,c=o.isASN1HEX,l=new nt;this.type="EC",this.isPrivate=!1,this.isPublic=!1,this.getBigRandom=function(t){return new r(t.bitLength(),l).mod(t.subtract(r.ONE)).add(r.ONE)},this.setNamedCurve=function(t){this.ecparams=s.getByName(t),this.prvKeyHex=null,this.pubKeyHex=null,this.curveName=t},this.setPrivateKeyHex=function(t){this.isPrivate=!0,this.prvKeyHex=t},this.setPublicKeyHex=function(t){this.isPublic=!0,this.pubKeyHex=t},this.getPublicKeyXYHex=function(){var t=this.pubKeyHex;if("04"!==t.substr(0,2))throw"this method supports uncompressed format(04) only";var e=this.ecparams.keycharlen;if(t.length!==2+2*e)throw"malformed public key hex length";var r={};return r.x=t.substr(2,e),r.y=t.substr(2+e),r},this.getShortNISTPCurveName=function(){var t=this.curveName;return"secp256r1"===t||"NIST P-256"===t||"P-256"===t||"prime256v1"===t?"P-256":"secp384r1"===t||"NIST P-384"===t||"P-384"===t?"P-384":"secp521r1"===t||"NIST P-521"===t||"P-521"===t?"P-521":null},this.generateKeyPairHex=function(){var t=this.ecparams.n,e=this.getBigRandom(t),r=this.ecparams.keycharlen,n=("0000000000"+e.toString(16)).slice(-r);return this.setPrivateKeyHex(n),{ecprvhex:n,ecpubhex:this.generatePublicKeyHex()}},this.generatePublicKeyHex=function(){var t=new r(this.prvKeyHex,16),e=this.ecparams.G.multiply(t),n=e.getX().toBigInteger(),i=e.getY().toBigInteger(),s=this.ecparams.keycharlen,a="04"+("0000000000"+n.toString(16)).slice(-s)+("0000000000"+i.toString(16)).slice(-s);return this.setPublicKeyHex(a),a},this.signWithMessageHash=function(t){return this.signHex(t,this.prvKeyHex)},this.signHex=function(t,e){var n=new r(e,16),s=this.ecparams.n,a=new r(t.substring(0,this.ecparams.keycharlen),16);do{var o=this.getBigRandom(s),u=this.ecparams.G.multiply(o).getX().toBigInteger().mod(s)}while(u.compareTo(r.ZERO)<=0);var c=o.modInverse(s).multiply(a.add(n.multiply(u))).mod(s);return i.biRSSigToASN1Sig(u,c)},this.sign=function(t,e){var n=e,i=this.ecparams.n,s=r.fromByteArrayUnsigned(t);do{var a=this.getBigRandom(i),o=this.ecparams.G.multiply(a).getX().toBigInteger().mod(i)}while(o.compareTo(A.ZERO)<=0);var u=a.modInverse(i).multiply(s.add(n.multiply(o))).mod(i);return this.serializeSig(o,u)},this.verifyWithMessageHash=function(t,e){return this.verifyHex(t,e,this.pubKeyHex)},this.verifyHex=function(t,e,s){try{var a,o,u=i.parseSigHex(e);a=u.r,o=u.s;var c=n.decodeFromHex(this.ecparams.curve,s),l=new r(t.substring(0,this.ecparams.keycharlen),16);return this.verifyRaw(l,a,o,c)}catch(t){return!1}},this.verify=function(t,e,i){var s,a,o;if(Bitcoin.Util.isArray(e)){var u=this.parseSig(e);s=u.r,a=u.s}else{if("object"!=typeof e||!e.r||!e.s)throw"Invalid value for signature";s=e.r,a=e.s}if(i instanceof ot)o=i;else{if(!Bitcoin.Util.isArray(i))throw"Invalid format for pubkey value, must be byte array or ECPointFp";o=n.decodeFrom(this.ecparams.curve,i)}var c=r.fromByteArrayUnsigned(t);return this.verifyRaw(c,s,a,o)},this.verifyRaw=function(t,e,n,i){var s=this.ecparams.n,a=this.ecparams.G;if(e.compareTo(r.ONE)<0||e.compareTo(s)>=0)return!1;if(n.compareTo(r.ONE)<0||n.compareTo(s)>=0)return!1;var o=n.modInverse(s),u=t.multiply(o).mod(s),c=e.multiply(o).mod(s);return a.multiply(u).add(i.multiply(c)).getX().toBigInteger().mod(s).equals(e)},this.serializeSig=function(t,e){var r=t.toByteArraySigned(),n=e.toByteArraySigned(),i=[];return i.push(2),i.push(r.length),(i=i.concat(r)).push(2),i.push(n.length),(i=i.concat(n)).unshift(i.length),i.unshift(48),i},this.parseSig=function(t){var e;if(48!=t[0])throw new Error("Signature not a valid DERSequence");if(2!=t[e=2])throw new Error("First element in signature must be a DERInteger");var n=t.slice(e+2,e+2+t[e+1]);if(2!=t[e+=2+t[e+1]])throw new Error("Second element in signature must be a DERInteger");var i=t.slice(e+2,e+2+t[e+1]);return e+=2+t[e+1],{r:r.fromByteArrayUnsigned(n),s:r.fromByteArrayUnsigned(i)}},this.parseSigCompact=function(t){if(65!==t.length)throw"Signature has the wrong length";var e=t[0]-27;if(e<0||e>7)throw"Invalid signature type";var n=this.ecparams.n;return{r:r.fromByteArrayUnsigned(t.slice(1,33)).mod(n),s:r.fromByteArrayUnsigned(t.slice(33,65)).mod(n),i:e}},this.readPKCS5PrvKeyHex=function(t){if(!1===c(t))throw new Error("not ASN.1 hex string");var e,r,n;try{e=u(t,0,["[0]",0],"06"),r=u(t,0,[1],"04");try{n=u(t,0,["[1]",0],"03")}catch(t){}}catch(t){throw new Error("malformed PKCS#1/5 plain ECC private key")}if(this.curveName=a(e),void 0===this.curveName)throw"unsupported curve name";this.setNamedCurve(this.curveName),this.setPublicKeyHex(n),this.setPrivateKeyHex(r),this.isPublic=!1},this.readPKCS8PrvKeyHex=function(t){if(!1===c(t))throw new e("not ASN.1 hex string");var r,n,i;try{u(t,0,[1,0],"06"),r=u(t,0,[1,1],"06"),n=u(t,0,[2,0,1],"04");try{i=u(t,0,[2,0,"[1]",0],"03")}catch(t){}}catch(t){throw new e("malformed PKCS#8 plain ECC private key")}if(this.curveName=a(r),void 0===this.curveName)throw new e("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(i),this.setPrivateKeyHex(n),this.isPublic=!1},this.readPKCS8PubKeyHex=function(t){if(!1===c(t))throw new e("not ASN.1 hex string");var r,n;try{u(t,0,[0,0],"06"),r=u(t,0,[0,1],"06"),n=u(t,0,[1],"03")}catch(t){throw new e("malformed PKCS#8 ECC public key")}if(this.curveName=a(r),null===this.curveName)throw new e("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(n)},this.readCertPubKeyHex=function(t,r){if(!1===c(t))throw new e("not ASN.1 hex string");var n,i;try{n=u(t,0,[0,5,0,1],"06"),i=u(t,0,[0,5,1],"03")}catch(t){throw new e("malformed X.509 certificate ECC public key")}if(this.curveName=a(n),null===this.curveName)throw new e("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(i)},void 0!==t&&void 0!==t.curve&&(this.curveName=t.curve),void 0===this.curveName&&(this.curveName="secp256r1"),this.setNamedCurve(this.curveName),void 0!==t&&(void 0!==t.prv&&this.setPrivateKeyHex(t.prv),void 0!==t.pub&&this.setPublicKeyHex(t.pub))},lt.crypto.ECDSA.parseSigHex=function(t){var e=lt.crypto.ECDSA.parseSigHexInHexRS(t);return{r:new A(e.r,16),s:new A(e.s,16)}},lt.crypto.ECDSA.parseSigHexInHexRS=function(t){var e=pt,r=e.getChildIdx,n=e.getV;if(e.checkStrictDER(t,0),"30"!=t.substr(0,2))throw new Error("signature is not a ASN.1 sequence");var i=r(t,0);if(2!=i.length)throw new Error("signature shall have two elements");var s=i[0],a=i[1];if("02"!=t.substr(s,2))throw new Error("1st item not ASN.1 integer");if("02"!=t.substr(a,2))throw new Error("2nd item not ASN.1 integer");return{r:n(t,s),s:n(t,a)}},lt.crypto.ECDSA.asn1SigToConcatSig=function(t){var e=lt.crypto.ECDSA.parseSigHexInHexRS(t),r=e.r,n=e.s;if(r.length>=130&&r.length<=134){if(r.length%2!=0)throw Error("unknown ECDSA sig r length error");if(n.length%2!=0)throw Error("unknown ECDSA sig s length error");"00"==r.substr(0,2)&&(r=r.substr(2)),"00"==n.substr(0,2)&&(n=n.substr(2));var i=Math.max(r.length,n.length);return(r=("000000"+r).slice(-i))+("000000"+n).slice(-i)}if("00"==r.substr(0,2)&&r.length%32==2&&(r=r.substr(2)),"00"==n.substr(0,2)&&n.length%32==2&&(n=n.substr(2)),r.length%32==30&&(r="00"+r),n.length%32==30&&(n="00"+n),r.length%32!=0)throw Error("unknown ECDSA sig r length error");if(n.length%32!=0)throw Error("unknown ECDSA sig s length error");return r+n},lt.crypto.ECDSA.concatSigToASN1Sig=function(t){if(t.length%4!=0)throw Error("unknown ECDSA concatinated r-s sig length error");var e=t.substr(0,t.length/2),r=t.substr(t.length/2);return lt.crypto.ECDSA.hexRSSigToASN1Sig(e,r)},lt.crypto.ECDSA.hexRSSigToASN1Sig=function(t,e){var r=new A(t,16),n=new A(e,16);return lt.crypto.ECDSA.biRSSigToASN1Sig(r,n)},lt.crypto.ECDSA.biRSSigToASN1Sig=function(t,e){var r=lt.asn1,n=new r.DERInteger({bigint:t}),i=new r.DERInteger({bigint:e});return new r.DERSequence({array:[n,i]}).tohex()},lt.crypto.ECDSA.getName=function(t){return"2b8104001f"===t?"secp192k1":"2a8648ce3d030107"===t?"secp256r1":"2b8104000a"===t?"secp256k1":"2b81040021"===t?"secp224r1":"2b81040022"===t?"secp384r1":"2b81040023"===t?"secp521r1":-1!=="|secp256r1|NIST P-256|P-256|prime256v1|".indexOf(t)?"secp256r1":-1!=="|secp256k1|".indexOf(t)?"secp256k1":-1!=="|secp224r1|NIST P-224|P-224|".indexOf(t)?"secp224r1":-1!=="|secp384r1|NIST P-384|P-384|".indexOf(t)?"secp384r1":-1!=="|secp521r1|NIST P-521|P-521|".indexOf(t)?"secp521r1":null},void 0!==lt&&lt||(lt={}),void 0!==lt.crypto&&lt.crypto||(lt.crypto={}),lt.crypto.ECParameterDB=new function(){var t={},e={};function r(t){return new A(t,16)}this.getByName=function(r){var n=r;if(void 0!==e[n]&&(n=e[r]),void 0!==t[n])return t[n];throw"unregistered EC curve name: "+n},this.regist=function(n,i,s,a,o,u,c,l,h,f,p,d){t[n]={};var g=r(s),y=r(a),v=r(o),m=r(u),E=r(c),S=new ut(g,y,v),b=S.decodePointHex("04"+l+h);t[n].name=n,t[n].keylen=i,t[n].keycharlen=2*Math.ceil(i/8),t[n].curve=S,t[n].G=b,t[n].n=m,t[n].h=E,t[n].oid=p,t[n].info=d;for(var C=0;C<f.length;C++)e[f[C]]=n}},lt.crypto.ECParameterDB.regist("secp128r1",128,"FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFF","FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFC","E87579C11079F43DD824993C2CEE5ED3","FFFFFFFE0000000075A30D1B9038A115","1","161FF7528B899B2D0C28607CA52C5B86","CF5AC8395BAFEB13C02DA292DDED7A83",[],"","secp128r1 : SECG curve over a 128 bit prime field"),lt.crypto.ECParameterDB.regist("secp160k1",160,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73","0","7","0100000000000000000001B8FA16DFAB9ACA16B6B3","1","3B4C382CE37AA192A4019E763036F4F5DD4D7EBB","938CF935318FDCED6BC28286531733C3F03C4FEE",[],"","secp160k1 : SECG curve over a 160 bit prime field"),lt.crypto.ECParameterDB.regist("secp160r1",160,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC","1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45","0100000000000000000001F4C8F927AED3CA752257","1","4A96B5688EF573284664698968C38BB913CBFC82","23A628553168947D59DCC912042351377AC5FB32",[],"","secp160r1 : SECG curve over a 160 bit prime field"),lt.crypto.ECParameterDB.regist("secp192k1",192,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFEE37","0","3","FFFFFFFFFFFFFFFFFFFFFFFE26F2FC170F69466A74DEFD8D","1","DB4FF10EC057E9AE26B07D0280B7F4341DA5D1B1EAE06C7D","9B2F2F6D9C5628A7844163D015BE86344082AA88D95E2F9D",[]),lt.crypto.ECParameterDB.regist("secp192r1",192,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC","64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1","FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831","1","188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012","07192B95FFC8DA78631011ED6B24CDD573F977A11E794811",[]),lt.crypto.ECParameterDB.regist("secp224r1",224,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE","B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4","FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D","1","B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21","BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34",[]),lt.crypto.ECParameterDB.regist("secp256k1",256,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F","0","7","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141","1","79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798","483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8",[]),lt.crypto.ECParameterDB.regist("secp256r1",256,"FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF","FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC","5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B","FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551","1","6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296","4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5",["NIST P-256","P-256","prime256v1"]),lt.crypto.ECParameterDB.regist("secp384r1",384,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC","B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973","1","AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F25DBF55296C3A545E3872760AB7","3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f",["NIST P-384","P-384"]),lt.crypto.ECParameterDB.regist("secp521r1",521,"1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF","1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC","051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00","1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409","1","00C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5BD66","011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650",["NIST P-521","P-521"]),void 0!==lt&&lt||(lt={}),void 0!==lt.crypto&&lt.crypto||(lt.crypto={}),lt.crypto.DSA=function(){var t=pt,e=(t.getVbyList,t.getVbyListEx),r=t.isASN1HEX,n=A;this.p=null,this.q=null,this.g=null,this.y=null,this.x=null,this.type="DSA",this.isPrivate=!1,this.isPublic=!1,this.setPrivate=function(t,e,r,n,i){this.isPrivate=!0,this.p=t,this.q=e,this.g=r,this.y=n,this.x=i},this.setPrivateHex=function(t,e,r,n,i){var s,a,o,u,c;s=new A(t,16),a=new A(e,16),o=new A(r,16),u="string"==typeof n&&n.length>1?new A(n,16):null,c=new A(i,16),this.setPrivate(s,a,o,u,c)},this.setPublic=function(t,e,r,n){this.isPublic=!0,this.p=t,this.q=e,this.g=r,this.y=n,this.x=null},this.setPublicHex=function(t,e,r,n){var i,s,a,o;i=new A(t,16),s=new A(e,16),a=new A(r,16),o=new A(n,16),this.setPublic(i,s,a,o)},this.signWithMessageHash=function(t){var e=this.p,r=this.q,n=this.g,i=(this.y,this.x),s=lt.crypto.Util.getRandomBigIntegerMinToMax(A.ONE.add(A.ONE),r.subtract(A.ONE)),a=new A(t.substr(0,r.bitLength()/4),16),o=n.modPow(s,e).mod(r),u=s.modInverse(r).multiply(a.add(i.multiply(o))).mod(r);return lt.asn1.ASN1Util.jsonToASN1HEX({seq:[{int:{bigint:o}},{int:{bigint:u}}]})},this.verifyWithMessageHash=function(t,e){var r=this.p,n=this.q,i=this.g,s=this.y,a=this.parseASN1Signature(e),o=a[0],u=a[1],c=new A(t.substr(0,n.bitLength()/4),16);if(A.ZERO.compareTo(o)>0||o.compareTo(n)>0)throw"invalid DSA signature";if(A.ZERO.compareTo(u)>=0||u.compareTo(n)>0)throw"invalid DSA signature";var l=u.modInverse(n),h=c.multiply(l).mod(n),f=o.multiply(l).mod(n);return 0==i.modPow(h,r).multiply(s.modPow(f,r)).mod(r).mod(n).compareTo(o)},this.parseASN1Signature=function(t){try{return[new n(e(t,0,[0],"02"),16),new n(e(t,0,[1],"02"),16)]}catch(t){throw new Error("malformed ASN.1 DSA signature")}},this.readPKCS5PrvKeyHex=function(t){var n,i,s,a,o;if(!1===r(t))throw new Error("not ASN.1 hex string");try{n=e(t,0,[1],"02"),i=e(t,0,[2],"02"),s=e(t,0,[3],"02"),a=e(t,0,[4],"02"),o=e(t,0,[5],"02")}catch(t){throw new Error("malformed PKCS#1/5 plain DSA private key")}this.setPrivateHex(n,i,s,a,o)},this.readPKCS8PrvKeyHex=function(t){var n,i,s,a;if(!1===r(t))throw new Error("not ASN.1 hex string");try{n=e(t,0,[1,1,0],"02"),i=e(t,0,[1,1,1],"02"),s=e(t,0,[1,1,2],"02"),a=e(t,0,[2,0],"02")}catch(t){throw new Error("malformed PKCS#8 plain DSA private key")}this.setPrivateHex(n,i,s,null,a)},this.readPKCS8PubKeyHex=function(t){var n,i,s,a;if(!1===r(t))throw new Error("not ASN.1 hex string");try{n=e(t,0,[0,1,0],"02"),i=e(t,0,[0,1,1],"02"),s=e(t,0,[0,1,2],"02"),a=e(t,0,[1,0],"02")}catch(t){throw new Error("malformed PKCS#8 DSA public key")}this.setPublicHex(n,i,s,a)},this.readCertPubKeyHex=function(t,n){var i,s,a,o;if(!1===r(t))throw new Error("not ASN.1 hex string");try{i=e(t,0,[0,5,0,1,0],"02"),s=e(t,0,[0,5,0,1,1],"02"),a=e(t,0,[0,5,0,1,2],"02"),o=e(t,0,[0,5,1,0],"02")}catch(t){throw new Error("malformed X.509 certificate DSA public key")}this.setPublicHex(i,s,a,o)}};var $t=function(){var t=function(t,r,n){return e(v.AES,t,r,n)},e=function(t,e,r,n){var i=v.enc.Hex.parse(e),s=v.enc.Hex.parse(r),a=v.enc.Hex.parse(n),o={};o.key=s,o.iv=a,o.ciphertext=i;var u=t.decrypt(o,s,{iv:a});return v.enc.Hex.stringify(u)},r=function(t,e,r){return n(v.AES,t,e,r)},n=function(t,e,r,n){var i=v.enc.Hex.parse(e),s=v.enc.Hex.parse(r),a=v.enc.Hex.parse(n),o=t.encrypt(i,s,{iv:a}),u=v.enc.Hex.parse(o.toString());return v.enc.Base64.stringify(u)},i={"AES-256-CBC":{proc:t,eproc:r,keylen:32,ivlen:16},"AES-192-CBC":{proc:t,eproc:r,keylen:24,ivlen:16},"AES-128-CBC":{proc:t,eproc:r,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:function(t,r,n){return e(v.TripleDES,t,r,n)},eproc:function(t,e,r){return n(v.TripleDES,t,e,r)},keylen:24,ivlen:8},"DES-CBC":{proc:function(t,r,n){return e(v.DES,t,r,n)},eproc:function(t,e,r){return n(v.DES,t,e,r)},keylen:8,ivlen:8}},s=function(t){var e={},r=t.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"));r&&(e.cipher=r[1],e.ivsalt=r[2]);var n=t.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"));n&&(e.type=n[1]);var i=-1,s=0;-1!=t.indexOf("\r\n\r\n")&&(i=t.indexOf("\r\n\r\n"),s=2),-1!=t.indexOf("\n\n")&&(i=t.indexOf("\n\n"),s=1);var a=t.indexOf("-----END");if(-1!=i&&-1!=a){var o=t.substring(i+2*s,a-s);o=o.replace(/\s+/g,""),e.data=o}return e},a=function(t,e,r){for(var n=r.substring(0,16),s=v.enc.Hex.parse(n),a=v.enc.Utf8.parse(e),o=i[t].keylen+i[t].ivlen,u="",c=null;;){var l=v.algo.MD5.create();if(null!=c&&l.update(c),l.update(a),l.update(s),c=l.finalize(),(u+=v.enc.Hex.stringify(c)).length>=2*o)break}var h={};return h.keyhex=u.substr(0,2*i[t].keylen),h.ivhex=u.substr(2*i[t].keylen,2*i[t].ivlen),h},o=function(t,e,r,n){var s=v.enc.Base64.parse(t),a=v.enc.Hex.stringify(s);return(0,i[e].proc)(a,r,n)};return{version:"1.0.0",parsePKCS5PEM:function(t){return s(t)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(t,e,r){return a(t,e,r)},decryptKeyB64:function(t,e,r,n){return o(t,e,r,n)},getDecryptedKeyHex:function(t,e){var r=s(t),n=(r.type,r.cipher),i=r.ivsalt,u=r.data,c=a(n,e,i).keyhex;return o(u,n,c,i)},getEncryptedPKCS5PEMFromPrvKeyHex:function(t,e,r,n,s){var o="";if(void 0!==n&&null!=n||(n="AES-256-CBC"),void 0===i[n])throw new Error("KEYUTIL unsupported algorithm: "+n);if(void 0===s||null==s){var u=function(t){var e=v.lib.WordArray.random(t);return v.enc.Hex.stringify(e)}(i[n].ivlen);s=u.toUpperCase()}var c=function(t,e,r,n){return(0,i[e].eproc)(t,r,n)}(e,n,a(n,r,s).keyhex,s);return o="-----BEGIN "+t+" PRIVATE KEY-----\r\n",o+="Proc-Type: 4,ENCRYPTED\r\n",o+="DEK-Info: "+n+","+s+"\r\n",o+="\r\n",(o+=c.replace(/(.{64})/g,"$1\r\n"))+"\r\n-----END "+t+" PRIVATE KEY-----\r\n"},getEncryptedPKCS8PEM:function(t,e,r){return xt(this.getEncryptedPKCS8Hex(t,e,r),"ENCRYPTED PRIVATE KEY")},getEncryptedPKCS8Hex:function(t,e,r){var n;(n=null==r||null==r?{}:JSON.parse(JSON.stringify(r))).plain=t,this.initPBES2Param(n),this.encryptPBES2Param(n,e);var i=this.generatePBES2ASN1Param(n);return lt.asn1.ASN1Util.newObject(i).tohex()},initPBES2Param:function(t){var e;null==zt(t,"encalg")&&(t.encalg="aes256-CBC"),null==zt(t,"iter")&&(t.iter=2048),null==zt(t,"prf")&&(t.prf="hmacWithSHA256"),null==zt(t,"salt")&&(t.salt=v.enc.Hex.stringify(v.lib.WordArray.random(8))),null==zt(t,"enciv")&&("des-EDE3-CBC"==t.encalg&&(e=8),"aes128-CBC"==t.encalg&&(e=16),"aes256-CBC"==t.encalg&&(e=16),t.enciv=v.enc.Hex.stringify(v.lib.WordArray.random(e)))},encryptPBES2Param:function(t,e){var r=$t.getDKFromPBES2Param(t,e);try{var n=lt.crypto.Cipher.encrypt(t.plain,r,t.encalg,{iv:t.enciv})}catch(e){throw new Error("encrypt error: "+t.plain+" "+r+" "+t.encalg+" "+t.enciv)}t.enc=n},generatePBES2ASN1Param:function(t){var e={seq:[{seq:[{oid:"pkcs5PBES2"},{seq:[{seq:[{oid:"pkcs5PBKDF2"},{seq:[{octstr:{hex:t.salt}},{int:{hex:jt(t.iter)}}]}]},{seq:[{oid:t.encalg},{octstr:{hex:t.enciv}}]}]}]},{octstr:{hex:t.enc}}]};return"hmacWithSHA1"!=t.prf&&e.seq[0].seq[1].seq[0].seq[1].seq.push({seq:[{oid:t.prf},{null:""}]}),e},parseHexOfEncryptedPKCS8:function(t){var e=pt,r=e.getChildIdx,n=e.getV,i={},s=r(t,0);if(2!=s.length)throw new Error("malformed format: SEQUENCE(0).items != 2: "+s.length);i.ciphertext=n(t,s[1]);var a=r(t,s[0]);if(2!=a.length)throw new Error("malformed format: SEQUENCE(0.0).items != 2: "+a.length);if("2a864886f70d01050d"!=n(t,a[0]))throw new Error("this only supports pkcs5PBES2");var o=r(t,a[1]);if(2!=a.length)throw new Error("malformed format: SEQUENCE(0.0.1).items != 2: "+o.length);var u=r(t,o[1]);if(2!=u.length)throw new Error("malformed format: SEQUENCE(0.0.1.1).items != 2: "+u.length);if("2a864886f70d0307"!=n(t,u[0]))throw"this only supports TripleDES";i.encryptionSchemeAlg="TripleDES",i.encryptionSchemeIV=n(t,u[1]);var c=r(t,o[0]);if(2!=c.length)throw new Error("malformed format: SEQUENCE(0.0.1.0).items != 2: "+c.length);if("2a864886f70d01050c"!=n(t,c[0]))throw new Error("this only supports pkcs5PBKDF2");var l=r(t,c[1]);if(l.length<2)throw new Error("malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+l.length);i.pbkdf2Salt=n(t,l[0]);var h=n(t,l[1]);try{i.pbkdf2Iter=parseInt(h,16)}catch(t){throw new Error("malformed format pbkdf2Iter: "+h)}return i},getPBKDF2KeyHexFromParam:function(t,e){var r=v.enc.Hex.parse(t.pbkdf2Salt),n=t.pbkdf2Iter,i=v.PBKDF2(e,r,{keySize:6,iterations:n});return v.enc.Hex.stringify(i)},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(t,e){var r=Bt(t,"ENCRYPTED PRIVATE KEY"),n=this.parseHexOfEncryptedPKCS8(r),i=$t.getPBKDF2KeyHexFromParam(n,e),s={};s.ciphertext=v.enc.Hex.parse(n.ciphertext);var a=v.enc.Hex.parse(i),o=v.enc.Hex.parse(n.encryptionSchemeIV),u=v.TripleDES.decrypt(s,a,{iv:o});return v.enc.Hex.stringify(u)},parsePBES2:function(t){var e=pt.parse(t);if("pkcs5PBES2"!=zt(e,"seq.0.seq.0.oid")||"pkcs5PBKDF2"!=zt(e,"seq.0.seq.1.seq.0.seq.0.oid"))throw new Error("not pkcs5PBES2 and pkcs5PBKDF2 used");var r=zt(e,"seq.0.seq.1.seq.0.seq.1.seq");if(null==r)throw new Error("PBKDF2 parameter not found");var n=zt(r,"0.octstr.hex"),i=zt(r,"1.int.hex"),s=zt(r,"2.seq.0.oid","hmacWithSHA1"),a=-1;try{a=parseInt(i,16)}catch(t){throw new Error("iter not proper value")}var o=zt(e,"seq.0.seq.1.seq.1.seq.0.oid"),u=zt(e,"seq.0.seq.1.seq.1.seq.1.octstr.hex"),c=zt(e,"seq.1.octstr.hex");if(null==o||null==u||null==c)throw new Error("encalg, enciv or enc is undefined");return{salt:n,iter:a,prf:s,encalg:o,enciv:u,enc:c}},getDKFromPBES2Param:function(t,e){var r={hmacWithSHA1:v.algo.SHA1,hmacWithSHA224:v.algo.SHA224,hmacWithSHA256:v.algo.SHA256,hmacWithSHA384:v.algo.SHA384,hmacWithSHA512:v.algo.SHA512}[t.prf];if(null==r)throw new Error("unsupported prf");var n={"des-EDE3-CBC":6,"aes128-CBC":4,"aes256-CBC":8}[t.encalg];if(null==n)throw new Error("unsupported encalg");var i=v.enc.Hex.parse(t.salt),s=t.iter;try{var a=v.PBKDF2(e,i,{keySize:n,iterations:s,hasher:r});return v.enc.Hex.stringify(a)}catch(r){throw new Error("PBKDF2 error: "+r+" "+JSON.stringify(t)+" "+e)}},getPlainHexFromEncryptedPKCS8PEM:function(t,e){if(-1==t.indexOf("BEGIN ENCRYPTED PRIVATE KEY"))throw new Error("not Encrypted PKCS#8 PEM string");var r,n=Bt(t);try{r=$t.parsePBES2(n)}catch(t){throw new Error("malformed PBES2 format: "+t.message)}var i=$t.getDKFromPBES2Param(r,e);return lt.crypto.Cipher.decrypt(r.enc,i,r.encalg,{iv:r.enciv})},getKeyFromEncryptedPKCS8PEM:function(t,e){var r=this.getPlainHexFromEncryptedPKCS8PEM(t,e);return this.getKeyFromPlainPrivatePKCS8Hex(r)},parsePlainPrivatePKCS8Hex:function(t){var e=pt,r=e.getChildIdx,n=e.getV,i={algparam:null};if("30"!=t.substr(0,2))throw new Error("malformed plain PKCS8 private key(code:001)");var s=r(t,0);if(s.length<3)throw new Error("malformed plain PKCS8 private key(code:002)");if("30"!=t.substr(s[1],2))throw new Error("malformed PKCS8 private key(code:003)");var a=r(t,s[1]);if(2!=a.length)throw new Error("malformed PKCS8 private key(code:004)");if("06"!=t.substr(a[0],2))throw new Error("malformed PKCS8 private key(code:005)");if(i.algoid=n(t,a[0]),"06"==t.substr(a[1],2)&&(i.algparam=n(t,a[1])),"04"!=t.substr(s[2],2))throw new Error("malformed PKCS8 private key(code:006)");return i.keyidx=e.getVidx(t,s[2]),i},getKeyFromPlainPrivatePKCS8PEM:function(t){var e=Bt(t,"PRIVATE KEY");return this.getKeyFromPlainPrivatePKCS8Hex(e)},getKeyFromPlainPrivatePKCS8Hex:function(t){var e,r=this.parsePlainPrivatePKCS8Hex(t);if("2a864886f70d010101"==r.algoid)e=new st;else if("2a8648ce380401"==r.algoid)e=new lt.crypto.DSA;else{if("2a8648ce3d0201"!=r.algoid)throw new Error("unsupported private key algorithm");e=new lt.crypto.ECDSA}return e.readPKCS8PrvKeyHex(t),e},_getKeyFromPublicPKCS8Hex:function(t){var e,r=pt.getVbyList(t,0,[0,0],"06");if("2a864886f70d010101"===r)e=new st;else if("2a8648ce380401"===r)e=new lt.crypto.DSA;else{if("2a8648ce3d0201"!==r)throw new Error("unsupported PKCS#8 public key hex");e=new lt.crypto.ECDSA}return e.readPKCS8PubKeyHex(t),e},parsePublicRawRSAKeyHex:function(t){var e=pt,r=e.getChildIdx,n=e.getV,i={};if("30"!=t.substr(0,2))throw new Error("malformed RSA key(code:001)");var s=r(t,0);if(2!=s.length)throw new Error("malformed RSA key(code:002)");if("02"!=t.substr(s[0],2))throw new Error("malformed RSA key(code:003)");if(i.n=n(t,s[0]),"02"!=t.substr(s[1],2))throw new Error("malformed RSA key(code:004)");return i.e=n(t,s[1]),i},parsePublicPKCS8Hex:function(t){var e=pt,r=e.getChildIdx,n=e.getV,i={algparam:null},s=r(t,0);if(2!=s.length)throw new Error("outer DERSequence shall have 2 elements: "+s.length);var a=s[0];if("30"!=t.substr(a,2))throw new Error("malformed PKCS8 public key(code:001)");var o=r(t,a);if(2!=o.length)throw new Error("malformed PKCS8 public key(code:002)");if("06"!=t.substr(o[0],2))throw new Error("malformed PKCS8 public key(code:003)");if(i.algoid=n(t,o[0]),"06"==t.substr(o[1],2)?i.algparam=n(t,o[1]):"30"==t.substr(o[1],2)&&(i.algparam={},i.algparam.p=e.getVbyList(t,o[1],[0],"02"),i.algparam.q=e.getVbyList(t,o[1],[1],"02"),i.algparam.g=e.getVbyList(t,o[1],[2],"02")),"03"!=t.substr(s[1],2))throw new Error("malformed PKCS8 public key(code:004)");return i.key=n(t,s[1]).substr(2),i}}}();function Yt(t,e){for(var r="",n=e/4-t.length,i=0;i<n;i++)r+="0";return r+t}function Qt(t,e,r){for(var n="",i=0;n.length<e;)n+=At(r(wt(t+String.fromCharCode.apply(String,[(4278190080&i)>>24,(16711680&i)>>16,(65280&i)>>8,255&i])))),i+=1;return n}function Xt(t){for(var e in lt.crypto.Util.DIGESTINFOHEAD){var r=lt.crypto.Util.DIGESTINFOHEAD[e],n=r.length;if(t.substring(0,n)==r)return[e,t.substring(n)]}return[]}function Jt(t){var e,r=pt,n=r.getChildIdx,i=r.getV,s=(r.dump,r.parse),a=r.getTLV,o=r.getVbyList,u=r.getVbyListEx,c=r.getTLVbyList,l=r.getTLVbyListEx,h=r.getIdxbyList,f=r.getIdxbyListEx,p=r.getVidx,d=r.getInt,g=r.oidname,y=r.hextooidstr,v=Bt,m=Error;try{e=lt.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV}catch(t){}this.HEX2STAG={"0c":"utf8",13:"prn",16:"ia5","1a":"vis","1e":"bmp"},this.hex=null,this.version=0,this.foffset=0,this.aExtInfo=null,this.getVersion=function(){if(null===this.hex||0!==this.version)return this.version;var t=c(this.hex,0,[0,0]);if("a0"==t.substr(0,2)){var e=c(t,0,[0]),r=d(e,0);if(r<0||2<r)throw new Error("malformed version field");return this.version=r+1,this.version}return this.version=1,this.foffset=-1,1},this.getSerialNumberHex=function(){return u(this.hex,0,[0,0],"02")},this.getSignatureAlgorithmField=function(){var t=l(this.hex,0,[0,1]);return this.getAlgorithmIdentifierName(t)},this.getAlgorithmIdentifierName=function(t){for(var r in e)if(t===e[r])return r;return g(u(t,0,[0],"06"))},this.getIssuer=function(t,e){return this.getX500Name(this.getIssuerHex(),t,e)},this.getIssuerHex=function(){return c(this.hex,0,[0,3+this.foffset],"30")},this.getIssuerString=function(){return this.getIssuer().str},this.getSubject=function(t,e){return this.getX500Name(this.getSubjectHex(),t,e)},this.getSubjectHex=function(){return c(this.hex,0,[0,5+this.foffset],"30")},this.getSubjectString=function(){return this.getSubject().str},this.getNotBefore=function(){var t=o(this.hex,0,[0,4+this.foffset,0]);return t=t.replace(/(..)/g,"%$1"),decodeURIComponent(t)},this.getNotAfter=function(){var t=o(this.hex,0,[0,4+this.foffset,1]);return t=t.replace(/(..)/g,"%$1"),decodeURIComponent(t)},this.getPublicKeyHex=function(){return this.getSPKI()},this.getSPKI=function(){return c(this.hex,0,[0,6+this.foffset],"30")},this.getSPKIValue=function(){var t=this.getSPKI();return null==t?null:o(t,0,[1],"03",!0)},this.getPublicKeyIdx=function(){return h(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyContentIdx=function(){var t=this.getPublicKeyIdx();return h(this.hex,t,[1,0],"30")},this.getPublicKey=function(){return $t.getKey(this.getPublicKeyHex(),null,"pkcs8pub")},this.getSignatureAlgorithmName=function(){var t=c(this.hex,0,[1],"30");return this.getAlgorithmIdentifierName(t)},this.getSignatureValueHex=function(){return o(this.hex,0,[2],"03",!0)},this.verifySignature=function(t){var e=this.getSignatureAlgorithmField(),r=this.getSignatureValueHex(),n=c(this.hex,0,[0],"30"),i=new lt.crypto.Signature({alg:e});return i.init(t),i.updateHex(n),i.verify(r)},this.parseExt=function(t){var e,s,a;if(void 0===t){if(a=this.hex,3!==this.version)return-1;e=h(a,0,[0,7,0],"30"),s=n(a,e)}else{a=Bt(t);var u=h(a,0,[0,3,0,0],"06");if("2a864886f70d01090e"!=i(a,u))return void(this.aExtInfo=new Array);e=h(a,0,[0,3,0,1,0],"30"),s=n(a,e),this.hex=a}this.aExtInfo=new Array;for(var c=0;c<s.length;c++){var l={critical:!1},f=0;3===n(a,s[c]).length&&(l.critical=!0,f=1),l.oid=r.hextooidstr(o(a,s[c],[0],"06"));var d=h(a,s[c],[1+f]);l.vidx=p(a,d),this.aExtInfo.push(l)}},this.getExtInfo=function(t){var e=this.aExtInfo,r=t;if(t.match(/^[0-9.]+$/)||(r=lt.asn1.x509.OID.name2oid(t)),""!==r)for(var n=0;n<e.length;n++)if(e[n].oid===r)return e[n]},this.getCriticalExtV=function(t,e,r){if(null!=e)return[e,r];var n=this.getExtInfo(t);return null==n?[null,null]:[a(this.hex,n.vidx),n.critical]},this.getExtBasicConstraints=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("basicConstraints");if(void 0===r)return;t=a(this.hex,r.vidx),e=r.critical}var n={extname:"basicConstraints"};if(e&&(n.critical=!0),"3000"===t)return n;if("30030101ff"===t)return n.cA=!0,n;if("30060101ff02"===t.substr(0,12)){var s=i(t,10),o=parseInt(s,16);return n.cA=!0,n.pathLen=o,n}throw new Error("hExtV parse error: "+t)},this.getExtNameConstraints=function(t,e){var r=this.getCriticalExtV("nameConstraints",t,e);if(t=r[0],e=r[1],null!=t){var i={extname:"nameConstraints"};e&&(i.critical=!0);for(var s=n(t,0),o=0;o<s.length;o++){for(var u=[],c=n(t,s[o]),l=0;l<c.length;l++){var h=a(t,c[l]),f=this.getGeneralSubtree(h);u.push(f)}var p=t.substr(s[o],2);"a0"==p?i.permit=u:"a1"==p&&(i.exclude=u)}return i}},this.getGeneralSubtree=function(t){var e=n(t,0),r=e.length;if(r<1||2<r)throw new Error("wrong num elements");for(var s=this.getGeneralName(a(t,e[0])),o=1;o<r;o++){var u=t.substr(e[o],2),c=i(t,e[o]),l=parseInt(c,16);"80"==u&&(s.min=l),"81"==u&&(s.max=l)}return s},this.getExtKeyUsage=function(t,e){var r=this.getCriticalExtV("keyUsage",t,e);if(t=r[0],e=r[1],null!=t){var n={extname:"keyUsage"};return e&&(n.critical=!0),n.names=this.getExtKeyUsageString(t).split(","),n}},this.getExtKeyUsageBin=function(t){if(void 0===t){var e=this.getExtInfo("keyUsage");if(void 0===e)return"";t=a(this.hex,e.vidx)}if(8!=t.length&&10!=t.length)throw new Error("malformed key usage value: "+t);var r="000000000000000"+parseInt(t.substr(6),16).toString(2);return 8==t.length&&(r=r.slice(-8)),10==t.length&&(r=r.slice(-16)),""==(r=r.replace(/0+$/,""))&&(r="0"),r},this.getExtKeyUsageString=function(t){for(var e=this.getExtKeyUsageBin(t),r=new Array,n=0;n<e.length;n++)"1"==e.substr(n,1)&&r.push(Jt.KEYUSAGE_NAME[n]);return r.join(",")},this.getExtSubjectKeyIdentifier=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("subjectKeyIdentifier");if(void 0===r)return;t=a(this.hex,r.vidx),e=r.critical}var n={extname:"subjectKeyIdentifier"};e&&(n.critical=!0);var s=i(t,0);return n.kid={hex:s},n},this.getExtAuthorityKeyIdentifier=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("authorityKeyIdentifier");if(void 0===r)return;t=a(this.hex,r.vidx),e=r.critical}var s={extname:"authorityKeyIdentifier"};e&&(s.critical=!0);for(var o=n(t,0),u=0;u<o.length;u++){var c=t.substr(o[u],2);if("80"===c&&(s.kid={hex:i(t,o[u])}),"a1"===c){var l=a(t,o[u]),h=this.getGeneralNames(l);s.issuer=h[0].dn}"82"===c&&(s.sn={hex:i(t,o[u])})}return s},this.getExtExtKeyUsage=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("extKeyUsage");if(void 0===r)return;t=a(this.hex,r.vidx),e=r.critical}var s={extname:"extKeyUsage",array:[]};e&&(s.critical=!0);for(var o=n(t,0),u=0;u<o.length;u++)s.array.push(g(i(t,o[u])));return s},this.getExtExtKeyUsageName=function(){var t=this.getExtInfo("extKeyUsage");if(void 0===t)return t;var e=new Array,r=a(this.hex,t.vidx);if(""===r)return e;for(var s=n(r,0),o=0;o<s.length;o++)e.push(g(i(r,s[o])));return e},this.getExtSubjectAltName=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("subjectAltName");if(void 0===r)return;t=a(this.hex,r.vidx),e=r.critical}var n={extname:"subjectAltName",array:[]};return e&&(n.critical=!0),n.array=this.getGeneralNames(t),n},this.getExtIssuerAltName=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("issuerAltName");if(void 0===r)return;t=a(this.hex,r.vidx),e=r.critical}var n={extname:"issuerAltName",array:[]};return e&&(n.critical=!0),n.array=this.getGeneralNames(t),n},this.getGeneralNames=function(t){for(var e=n(t,0),r=[],i=0;i<e.length;i++){var s=this.getGeneralName(a(t,e[i]));void 0!==s&&r.push(s)}return r},this.getGeneralName=function(t){var e=t.substr(0,2),r=i(t,0),n=At(r);return"81"==e?{rfc822:n}:"82"==e?{dns:n}:"86"==e?{uri:n}:"87"==e?{ip:Dt(r)}:"a4"==e?{dn:this.getX500Name(r)}:"a0"==e?{other:this.getOtherName(t)}:void 0},this.getExtSubjectAltName2=function(){var t,e,r,s=this.getExtInfo("subjectAltName");if(void 0===s)return s;for(var o=new Array,u=a(this.hex,s.vidx),c=n(u,0),l=0;l<c.length;l++)r=u.substr(c[l],2),t=i(u,c[l]),"81"===r&&(e=bt(t),o.push(["MAIL",e])),"82"===r&&(e=bt(t),o.push(["DNS",e])),"84"===r&&(e=Jt.hex2dn(t,0),o.push(["DN",e])),"86"===r&&(e=bt(t),o.push(["URI",e])),"87"===r&&(e=Dt(t),o.push(["IP",e]));return o},this.getExtCRLDistributionPoints=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("cRLDistributionPoints");if(void 0===r)return;t=a(this.hex,r.vidx),e=r.critical}var i={extname:"cRLDistributionPoints",array:[]};e&&(i.critical=!0);for(var s=n(t,0),o=0;o<s.length;o++){var u=a(t,s[o]);i.array.push(this.getDistributionPoint(u))}return i},this.getDistributionPoint=function(t){for(var e={},r=n(t,0),i=0;i<r.length;i++){var s=t.substr(r[i],2),o=a(t,r[i]);"a0"==s&&(e.dpname=this.getDistributionPointName(o))}return e},this.getDistributionPointName=function(t){for(var e={},r=n(t,0),i=0;i<r.length;i++){var s=t.substr(r[i],2),o=a(t,r[i]);"a0"==s&&(e.full=this.getGeneralNames(o))}return e},this.getExtCRLDistributionPointsURI=function(){var t=this.getExtCRLDistributionPoints();if(null==t)return t;for(var e=t.array,r=[],n=0;n<e.length;n++)try{null!=e[n].dpname.full[0].uri&&r.push(e[n].dpname.full[0].uri)}catch(t){}return r},this.getExtAIAInfo=function(){var t=this.getExtInfo("authorityInfoAccess");if(void 0===t)return t;for(var e={ocsp:[],caissuer:[]},r=n(this.hex,t.vidx),i=0;i<r.length;i++){var s=o(this.hex,r[i],[0],"06"),a=o(this.hex,r[i],[1],"86");"2b06010505073001"===s&&e.ocsp.push(bt(a)),"2b06010505073002"===s&&e.caissuer.push(bt(a))}return e},this.getExtAuthorityInfoAccess=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("authorityInfoAccess");if(void 0===r)return;t=a(this.hex,r.vidx),e=r.critical}var i={extname:"authorityInfoAccess",array:[]};e&&(i.critical=!0);for(var s=n(t,0),c=0;c<s.length;c++){var l=u(t,s[c],[0],"06"),h=bt(o(t,s[c],[1],"86"));if("2b06010505073001"==l)i.array.push({ocsp:h});else{if("2b06010505073002"!=l)throw new Error("unknown method: "+l);i.array.push({caissuer:h})}}return i},this.getExtCertificatePolicies=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("certificatePolicies");if(void 0===r)return;t=a(this.hex,r.vidx),e=r.critical}var i={extname:"certificatePolicies",array:[]};e&&(i.critical=!0);for(var s=n(t,0),o=0;o<s.length;o++){var u=a(t,s[o]),c=this.getPolicyInformation(u);i.array.push(c)}return i},this.getPolicyInformation=function(t){var e={},r=o(t,0,[0],"06");e.policyoid=g(r);var i=f(t,0,[1],"30");if(-1!=i){e.array=[];for(var s=n(t,i),u=0;u<s.length;u++){var c=a(t,s[u]),l=this.getPolicyQualifierInfo(c);e.array.push(l)}}return e},this.getOtherName=function(t){var e={},r=n(t,0),i=o(t,r[0],[],"06"),a=o(t,r[1],[]);return e.oid=g(i),e.value=s(a),e},this.getPolicyQualifierInfo=function(t){var e={},r=o(t,0,[0],"06");if("2b06010505070201"===r){var n=u(t,0,[1],"16");e.cps=At(n)}else if("2b06010505070202"===r){var i=c(t,0,[1],"30");e.unotice=this.getUserNotice(i)}return e},this.getUserNotice=function(t){var e=null;try{return e=r.parse(t),this._asn1ToUnotice(e)}catch(t){return}},this._asn1ToUnotice=function(t){try{for(var e={},r=zt(t,"seq"),n=0;n<r.length;n++){var i=this._asn1ToNoticeRef(r[n]);null!=i&&(e.noticeref=i);var s=this.asn1ToDisplayText(r[n]);null!=s&&(e.exptext=s)}return Object.keys(e).length>0?e:void 0}catch(t){return}},this._asn1ToNoticeRef=function(t){try{for(var e={},r=zt(t,"seq"),n=0;n<r.length;n++){var i=this._asn1ToNoticeNum(r[n]);null!=i&&(e.noticenum=i);var s=this.asn1ToDisplayText(r[n]);null!=s&&(e.org=s)}return Object.keys(e).length>0?e:void 0}catch(t){return}},this._asn1ToNoticeNum=function(t){try{for(var e=zt(t,"seq"),r=[],n=0;n<e.length;n++){var i=e[n];r.push(parseInt(zt(i,"int.hex"),16))}return r}catch(t){return}},this.getDisplayText=function(t){var e={};return e.type={"0c":"utf8",16:"ia5","1a":"vis","1e":"bmp"}[t.substr(0,2)],e.str=At(i(t,0)),e},this.asn1ToDisplayText=function(t){return null!=t.utf8str?{type:"utf8",str:t.utf8str.str}:null!=t.ia5str?{type:"ia5",str:t.ia5str.str}:null!=t.visstr?{type:"vis",str:t.visstr.str}:null!=t.bmpstr?{type:"bmp",str:t.bmpstr.str}:null!=t.prnstr?{type:"prn",str:t.prnstr.str}:void 0},this.getExtPolicyMappings=function(t,e){var r=this.getCriticalExtV("policyMappings",t,e);if(t=r[0],e=r[1],null!=t){var n={extname:"policyMappings"};e&&(n.critical=!0);try{for(var i=s(t).seq,a=[],o=0;o<i.length;o++){var u=i[o].seq;a.push([u[0].oid,u[1].oid])}n.array=a}catch(t){throw new m("malformed policyMappings")}return n}},this.getExtPolicyConstraints=function(t,e){var r=this.getCriticalExtV("policyConstraints",t,e);if(t=r[0],e=r[1],null!=t){var n={extname:"policyConstraints"};e&&(n.critical=!0);var i=s(t);try{for(var a=i.seq,o=0;o<a.length;o++){var u=a[o].tag;0==u.explicit&&("80"==u.tag&&(n.reqexp=parseInt(u.hex,16)),"81"==u.tag&&(n.inhibit=parseInt(u.hex,16)))}}catch(t){return new m("malformed policyConstraints value")}return n}},this.getExtInhibitAnyPolicy=function(t,e){var r=this.getCriticalExtV("inhibitAnyPolicy",t,e);if(t=r[0],e=r[1],null!=t){var n={extname:"inhibitAnyPolicy"};e&&(n.critical=!0);var i=d(t,0);return-1==i?new m("wrong value"):(n.skip=i,n)}},this.getExtCRLNumber=function(t,e){var r={extname:"cRLNumber"};if(e&&(r.critical=!0),"02"==t.substr(0,2))return r.num={hex:i(t,0)},r;throw new m("hExtV parse error: "+t)},this.getExtCRLReason=function(t,e){var r={extname:"cRLReason"};if(e&&(r.critical=!0),"0a"==t.substr(0,2))return r.code=parseInt(i(t,0),16),r;throw new Error("hExtV parse error: "+t)},this.getExtOcspNonce=function(t,e){var r={extname:"ocspNonce"};e&&(r.critical=!0);var n=i(t,0);return r.hex=n,r},this.getExtOcspNoCheck=function(t,e){var r={extname:"ocspNoCheck"};return e&&(r.critical=!0),r},this.getExtAdobeTimeStamp=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("adobeTimeStamp");if(void 0===r)return;t=a(this.hex,r.vidx),e=r.critical}var i={extname:"adobeTimeStamp"};e&&(i.critical=!0);var s=n(t,0);if(s.length>1){var o=a(t,s[1]),u=this.getGeneralName(o);null!=u.uri&&(i.uri=u.uri)}if(s.length>2){var c=a(t,s[2]);"0101ff"==c&&(i.reqauth=!0),"010100"==c&&(i.reqauth=!1)}return i},this.getExtSubjectDirectoryAttributes=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("subjectDirectoryAttributes");if(void 0===r)return;t=a(this.hex,r.vidx),e=r.critical}var n={extname:"subjectDirectoryAttributes"};e&&(n.critical=!0);try{for(var i=s(t),o=[],u=0;u<i.seq.length;u++){var c=i.seq[u],l=zt(c,"seq.0.oid"),h=zt(c,"seq.1.set");if(null==l||null==h)throw"error";o.push({attr:l,array:h})}return n.array=o,n}catch(t){throw new Error("malformed subjectDirectoryAttributes extension value")}};var E=function(t){var e={};try{var r=t.seq[0].oid,n=lt.asn1.x509.OID.name2oid(r);e.type=lt.asn1.x509.OID.oid2atype(n);var i=t.seq[1];if(null!=i.utf8str)e.ds="utf8",e.value=i.utf8str.str;else if(null!=i.numstr)e.ds="num",e.value=i.numstr.str;else if(null!=i.telstr)e.ds="tel",e.value=i.telstr.str;else if(null!=i.prnstr)e.ds="prn",e.value=i.prnstr.str;else if(null!=i.ia5str)e.ds="ia5",e.value=i.ia5str.str;else if(null!=i.visstr)e.ds="vis",e.value=i.visstr.str;else{if(null==i.bmpstr)throw"error";e.ds="bmp",e.value=i.bmpstr.str}return e}catch(t){throw new Erorr("improper ASN.1 parsed AttrTypeAndValue")}},S=function(t){try{return t.set.map((function(t){return E(t)}))}catch(t){throw new Error("improper ASN.1 parsed RDN: "+t)}};this.getX500NameRule=function(t){for(var e=null,r=[],n=0;n<t.length;n++)for(var i=t[n],s=0;s<i.length;s++)r.push(i[s]);for(n=0;n<r.length;n++){var a=r[n],o=a.ds,u=a.value,c=a.type;if("prn"!=o&&"utf8"!=o&&"ia5"!=o)return"mixed";if("ia5"==o){if("CN"!=c)return"mixed";if(lt.lang.String.isMail(u))continue;return"mixed"}if("C"==c){if("prn"==o)continue;return"mixed"}if(null==e)e=o;else if(e!==o)return"mixed"}return null==e?"prn":e},this.getAttrTypeAndValue=function(t){var e=s(t);return E(e)},this.getRDN=function(t){var e=s(t);return S(e)},this.getX500NameArray=function(t){return function(t){try{return t.seq.map((function(t){return S(t)}))}catch(t){throw new Error("improper ASN.1 parsed X500Name: "+t)}}(s(t))},this.getX500Name=function(t,e,r){var n=this.getX500NameArray(t),i={str:this.dnarraytostr(n)};return i.array=n,1==r&&(i.hex=t),1==e&&(i.canon=this.c14nRDNArray(n)),i},this.readCertPEM=function(t){this.readCertHex(v(t))},this.readCertHex=function(t){this.hex=t,this.getVersion();try{h(this.hex,0,[0,7],"a3"),this.parseExt()}catch(t){}},this.getParam=function(t){var e={};return null==t&&(t={}),e.version=this.getVersion(),e.serial={hex:this.getSerialNumberHex()},e.sigalg=this.getSignatureAlgorithmField(),e.issuer=this.getIssuer(t.dncanon,t.dnhex),e.notbefore=this.getNotBefore(),e.notafter=this.getNotAfter(),e.subject=this.getSubject(t.dncanon,t.dnhex),e.sbjpubkey=xt(this.getPublicKeyHex(),"PUBLIC KEY"),null!=this.aExtInfo&&this.aExtInfo.length>0&&(e.ext=this.getExtParamArray()),e.sighex=this.getSignatureValueHex(),1==t.tbshex&&(e.tbshex=c(this.hex,0,[0])),1==t.nodnarray&&(delete e.issuer.array,delete e.subject.array),e},this.getExtParamArray=function(t){null==t&&-1!=f(this.hex,0,[0,"[3]"])&&(t=l(this.hex,0,[0,"[3]",0],"30"));for(var e=[],r=n(t,0),i=0;i<r.length;i++){var s=a(t,r[i]),o=this.getExtParam(s);null!=o&&e.push(o)}return e},this.getExtParam=function(t){var e=n(t,0).length;if(2!=e&&3!=e)throw new Error("wrong number elements in Extension: "+e+" "+t);var r=y(o(t,0,[0],"06")),i=!1;3==e&&"0101ff"==c(t,0,[1])&&(i=!0);var a=c(t,0,[e-1,0]),u=void 0;if("2.5.29.14"==r?u=this.getExtSubjectKeyIdentifier(a,i):"2.5.29.15"==r?u=this.getExtKeyUsage(a,i):"2.5.29.17"==r?u=this.getExtSubjectAltName(a,i):"2.5.29.18"==r?u=this.getExtIssuerAltName(a,i):"2.5.29.19"==r?u=this.getExtBasicConstraints(a,i):"2.5.29.30"==r?u=this.getExtNameConstraints(a,i):"2.5.29.31"==r?u=this.getExtCRLDistributionPoints(a,i):"2.5.29.32"==r?u=this.getExtCertificatePolicies(a,i):"2.5.29.33"==r?u=this.getExtPolicyMappings(a,i):"2.5.29.35"==r?u=this.getExtAuthorityKeyIdentifier(a,i):"2.5.29.36"==r?u=this.getExtPolicyConstraints(a,i):"2.5.29.37"==r?u=this.getExtExtKeyUsage(a,i):"2.5.29.54"==r?u=this.getExtInhibitAnyPolicy(a,i):"1.3.6.1.5.5.7.1.1"==r?u=this.getExtAuthorityInfoAccess(a,i):"2.5.29.20"==r?u=this.getExtCRLNumber(a,i):"2.5.29.21"==r?u=this.getExtCRLReason(a,i):"2.5.29.9"==r?u=this.getExtSubjectDirectoryAttributes(a,i):"1.3.6.1.5.5.7.48.1.2"==r?u=this.getExtOcspNonce(a,i):"1.3.6.1.5.5.7.48.1.5"==r?u=this.getExtOcspNoCheck(a,i):"1.2.840.113583.1.1.9.1"==r?u=this.getExtAdobeTimeStamp(a,i):null!=Jt.EXT_PARSER[r]&&(u=Jt.EXT_PARSER[r](r,i,a)),null!=u)return u;var l={extname:r,extn:a};try{l.extn=s(a)}catch(t){}return i&&(l.critical=!0),l},this.findExt=function(t,e){for(var r=0;r<t.length;r++)if(t[r].extname==e)return t[r];return null},this.updateExtCDPFullURI=function(t,e){var r=this.findExt(t,"cRLDistributionPoints");if(null!=r&&null!=r.array)for(var n=r.array,i=0;i<n.length;i++)if(null!=n[i].dpname&&null!=n[i].dpname.full)for(var s=n[i].dpname.full,a=0;a<s.length;a++){var o=s[i];null!=o.uri&&(o.uri=e)}},this.updateExtAIAOCSP=function(t,e){var r=this.findExt(t,"authorityInfoAccess");if(null!=r&&null!=r.array)for(var n=r.array,i=0;i<n.length;i++)null!=n[i].ocsp&&(n[i].ocsp=e)},this.updateExtAIACAIssuer=function(t,e){var r=this.findExt(t,"authorityInfoAccess");if(null!=r&&null!=r.array)for(var n=r.array,i=0;i<n.length;i++)null!=n[i].caissuer&&(n[i].caissuer=e)},this.dnarraytostr=function(t){return"/"+t.map((function(t){return function(t){return t.map((function(t){return function(t){return t.type+"="+t.value}(t).replace(/\+/,"\\+")})).join("+")}(t).replace(/\//,"\\/")})).join("/")},this.setCanonicalizedDN=function(t){var e;if(null!=t.str&&null==t.array){var r=new lt.asn1.x509.X500Name({str:t.str}).tohex();e=this.getX500NameArray(r)}else e=t.array;null==t.canon&&(t.canon=this.c14nRDNArray(e))},this.c14nRDNArray=function(t){for(var e=[],r=0;r<t.length;r++){for(var n=t[r],i=[],s=0;s<n.length;s++){var a=n[s],o=a.value;o=(o=(o=(o=o.replace(/^\s*/,"")).replace(/\s*$/,"")).replace(/\s+/g," ")).toLowerCase(),i.push(a.type.toLowerCase()+"="+o)}e.push(i.join("+"))}return"/"+e.join("/")},this.getInfo=function(){var t,e,r,n=function(t){for(var e="",r=" ",n="\n",i=t.array,s=0;s<i.length;s++){var a=i[s];null!=a.dn&&(e+=r+"dn: "+a.dn.str+n),null!=a.ip&&(e+=r+"ip: "+a.ip+n),null!=a.rfc822&&(e+=r+"rfc822: "+a.rfc822+n),null!=a.dns&&(e+=r+"dns: "+a.dns+n),null!=a.uri&&(e+=r+"uri: "+a.uri+n),null!=a.other&&(e+=r+"other: "+a.other.oid+"="+JSON.stringify(a.other.value).replace(/\"/g,"")+n)}return e.replace(/\n$/,"")},i=function(t){for(var e="",r=t.array,n=0;n<r.length;n++){var i=r[n];if(e+=" policy oid: "+i.policyoid+"\n",void 0!==i.array)for(var s=0;s<i.array.length;s++){var a=i.array[s];void 0!==a.cps&&(e+=" cps: "+a.cps+"\n")}}return e},s=function(t){for(var e="",r=t.array,n=0;n<r.length;n++){var i=r[n];try{void 0!==i.dpname.full[0].uri&&(e+=" "+i.dpname.full[0].uri+"\n")}catch(t){}try{void 0!==i.dname.full[0].dn.hex&&(e+=" "+Jt.hex2dn(i.dpname.full[0].dn.hex)+"\n")}catch(t){}}return e},a=function(t){for(var e="",r=t.array,n=0;n<r.length;n++){var i=r[n];void 0!==i.caissuer&&(e+=" caissuer: "+i.caissuer+"\n"),void 0!==i.ocsp&&(e+=" ocsp: "+i.ocsp+"\n")}return e};if(t="Basic Fields\n",t+=" serial number: "+this.getSerialNumberHex()+"\n",t+=" signature algorithm: "+this.getSignatureAlgorithmField()+"\n",t+=" issuer: "+this.getIssuerString()+"\n",t+=" notBefore: "+this.getNotBefore()+"\n",t+=" notAfter: "+this.getNotAfter()+"\n",t+=" subject: "+this.getSubjectString()+"\n",t+=" subject public key info: \n",t+=" key algorithm: "+(e=this.getPublicKey()).type+"\n","RSA"===e.type&&(t+=" n="+Ht(e.n.toString(16)).substr(0,16)+"...\n",t+=" e="+Ht(e.e.toString(16))+"\n"),null!=(r=this.aExtInfo)){t+="X509v3 Extensions:\n";for(var o=0;o<r.length;o++){var u=r[o],c=lt.asn1.x509.OID.oid2name(u.oid);""===c&&(c=u.oid);var l="";if(!0===u.critical&&(l="CRITICAL"),t+=" "+c+" "+l+":\n","basicConstraints"===c){var h=this.getExtBasicConstraints();void 0===h.cA?t+=" {}\n":(t+=" cA=true",void 0!==h.pathLen&&(t+=", pathLen="+h.pathLen),t+="\n")}else{var f;if("policyMappings"==c)t+=" "+this.getExtPolicyMappings().array.map((function(t){var e=t;return e[0]+":"+e[1]})).join(", ")+"\n";else if("policyConstraints"==c)t+=" ",null!=(f=this.getExtPolicyConstraints()).reqexp&&(t+=" reqexp="+f.reqexp),null!=f.inhibit&&(t+=" inhibit="+f.inhibit),t+="\n";else if("inhibitAnyPolicy"==c)t+=" skip="+(f=this.getExtInhibitAnyPolicy()).skip+"\n";else if("keyUsage"==c)t+=" "+this.getExtKeyUsageString()+"\n";else if("subjectKeyIdentifier"==c)t+=" "+this.getExtSubjectKeyIdentifier().kid.hex+"\n";else if("authorityKeyIdentifier"==c){var p=this.getExtAuthorityKeyIdentifier();void 0!==p.kid&&(t+=" kid="+p.kid.hex+"\n")}else"extKeyUsage"==c?t+=" "+this.getExtExtKeyUsage().array.join(", ")+"\n":"subjectAltName"==c?t+=n(this.getExtSubjectAltName())+"\n":"cRLDistributionPoints"==c?t+=s(this.getExtCRLDistributionPoints()):"authorityInfoAccess"==c?t+=a(this.getExtAuthorityInfoAccess()):"certificatePolicies"==c&&(t+=i(this.getExtCertificatePolicies()))}}}return(t+="signature algorithm: "+this.getSignatureAlgorithmName()+"\n")+"signature: "+this.getSignatureValueHex().substr(0,16)+"...\n"},"string"==typeof t&&(-1!=t.indexOf("-----BEGIN")?this.readCertPEM(t):lt.lang.String.isHex(t)&&this.readCertHex(t))}$t.getKey=function(t,e,r){var n,i=(v=pt).getChildIdx,s=(v.getV,v.getVbyList),a=lt.crypto,o=a.ECDSA,u=a.DSA,c=st,l=Bt,h=$t;if(void 0!==c&&t instanceof c)return t;if(void 0!==o&&t instanceof o)return t;if(void 0!==u&&t instanceof u)return t;if(void 0!==t.curve&&void 0!==t.xy&&void 0===t.d)return new o({pub:t.xy,curve:t.curve});if(void 0!==t.curve&&void 0!==t.d)return new o({prv:t.d,curve:t.curve});if(void 0===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0===t.d)return(F=new c).setPublic(t.n,t.e),F;if(void 0===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d&&void 0!==t.p&&void 0!==t.q&&void 0!==t.dp&&void 0!==t.dq&&void 0!==t.co&&void 0===t.qi)return(F=new c).setPrivateEx(t.n,t.e,t.d,t.p,t.q,t.dp,t.dq,t.co),F;if(void 0===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d&&void 0===t.p)return(F=new c).setPrivate(t.n,t.e,t.d),F;if(void 0!==t.p&&void 0!==t.q&&void 0!==t.g&&void 0!==t.y&&void 0===t.x)return(F=new u).setPublic(t.p,t.q,t.g,t.y),F;if(void 0!==t.p&&void 0!==t.q&&void 0!==t.g&&void 0!==t.y&&void 0!==t.x)return(F=new u).setPrivate(t.p,t.q,t.g,t.y,t.x),F;if("RSA"===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0===t.d)return(F=new c).setPublic(Et(t.n),Et(t.e)),F;if("RSA"===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d&&void 0!==t.p&&void 0!==t.q&&void 0!==t.dp&&void 0!==t.dq&&void 0!==t.qi)return(F=new c).setPrivateEx(Et(t.n),Et(t.e),Et(t.d),Et(t.p),Et(t.q),Et(t.dp),Et(t.dq),Et(t.qi)),F;if("RSA"===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d)return(F=new c).setPrivate(Et(t.n),Et(t.e),Et(t.d)),F;if("EC"===t.kty&&void 0!==t.crv&&void 0!==t.x&&void 0!==t.y&&void 0===t.d){var f=(T=new o({curve:t.crv})).ecparams.keycharlen,p="04"+("0000000000"+Et(t.x)).slice(-f)+("0000000000"+Et(t.y)).slice(-f);return T.setPublicKeyHex(p),T}if("EC"===t.kty&&void 0!==t.crv&&void 0!==t.x&&void 0!==t.y&&void 0!==t.d){f=(T=new o({curve:t.crv})).ecparams.keycharlen,p="04"+("0000000000"+Et(t.x)).slice(-f)+("0000000000"+Et(t.y)).slice(-f);var d=("0000000000"+Et(t.d)).slice(-f);return T.setPublicKeyHex(p),T.setPrivateKeyHex(d),T}if("pkcs5prv"===r){var g,y=t,v=pt;if(9===(g=i(y,0)).length)(F=new c).readPKCS5PrvKeyHex(y);else if(6===g.length)(F=new u).readPKCS5PrvKeyHex(y);else{if(!(g.length>2&&"04"===y.substr(g[1],2)))throw new Error("unsupported PKCS#1/5 hexadecimal key");(F=new o).readPKCS5PrvKeyHex(y)}return F}if("pkcs8prv"===r)return h.getKeyFromPlainPrivatePKCS8Hex(t);if("pkcs8pub"===r)return h._getKeyFromPublicPKCS8Hex(t);if("x509pub"===r)return Jt.getPublicKeyFromCertHex(t);if(-1!=t.indexOf("-END CERTIFICATE-",0)||-1!=t.indexOf("-END X509 CERTIFICATE-",0)||-1!=t.indexOf("-END TRUSTED CERTIFICATE-",0))return Jt.getPublicKeyFromCertPEM(t);if(-1!=t.indexOf("-END PUBLIC KEY-")){var m=Bt(t,"PUBLIC KEY");return h._getKeyFromPublicPKCS8Hex(m)}if(-1!=t.indexOf("-END RSA PRIVATE KEY-")&&-1==t.indexOf("4,ENCRYPTED")){var E=l(t,"RSA PRIVATE KEY");return h.getKey(E,null,"pkcs5prv")}if(-1!=t.indexOf("-END DSA PRIVATE KEY-")&&-1==t.indexOf("4,ENCRYPTED")){var S=s(n=l(t,"DSA PRIVATE KEY"),0,[1],"02"),b=s(n,0,[2],"02"),C=s(n,0,[3],"02"),w=s(n,0,[4],"02"),x=s(n,0,[5],"02");return(F=new u).setPrivate(new A(S,16),new A(b,16),new A(C,16),new A(w,16),new A(x,16)),F}if(-1!=t.indexOf("-END EC PRIVATE KEY-")&&-1==t.indexOf("4,ENCRYPTED"))return E=l(t,"EC PRIVATE KEY"),h.getKey(E,null,"pkcs5prv");if(-1!=t.indexOf("-END PRIVATE KEY-"))return h.getKeyFromPlainPrivatePKCS8PEM(t);if(-1!=t.indexOf("-END RSA PRIVATE KEY-")&&-1!=t.indexOf("4,ENCRYPTED")){var B=h.getDecryptedKeyHex(t,e),I=new st;return I.readPKCS5PrvKeyHex(B),I}if(-1!=t.indexOf("-END EC PRIVATE KEY-")&&-1!=t.indexOf("4,ENCRYPTED")){var T,F=s(n=h.getDecryptedKeyHex(t,e),0,[1],"04"),R=s(n,0,[2,0],"06"),N=s(n,0,[3,0],"03").substr(2);if(void 0===lt.crypto.OID.oidhex2name[R])throw new Error("undefined OID(hex) in KJUR.crypto.OID: "+R);return(T=new o({curve:lt.crypto.OID.oidhex2name[R]})).setPublicKeyHex(N),T.setPrivateKeyHex(F),T.isPublic=!1,T}if(-1!=t.indexOf("-END DSA PRIVATE KEY-")&&-1!=t.indexOf("4,ENCRYPTED"))return S=s(n=h.getDecryptedKeyHex(t,e),0,[1],"02"),b=s(n,0,[2],"02"),C=s(n,0,[3],"02"),w=s(n,0,[4],"02"),x=s(n,0,[5],"02"),(F=new u).setPrivate(new A(S,16),new A(b,16),new A(C,16),new A(w,16),new A(x,16)),F;if(-1!=t.indexOf("-END ENCRYPTED PRIVATE KEY-"))return h.getKeyFromEncryptedPKCS8PEM(t,e);throw new Error("not supported argument")},$t.generateKeypair=function(t,e){if("RSA"==t){var r=e;(a=new st).generate(r,"10001"),a.isPrivate=!0,a.isPublic=!0;var n=new st,i=a.n.toString(16),s=a.e.toString(16);return n.setPublic(i,s),n.isPrivate=!1,n.isPublic=!0,(o={}).prvKeyObj=a,o.pubKeyObj=n,o}if("EC"==t){var a,o,u=e,c=new lt.crypto.ECDSA({curve:u}).generateKeyPairHex();return(a=new lt.crypto.ECDSA({curve:u})).setPublicKeyHex(c.ecpubhex),a.setPrivateKeyHex(c.ecprvhex),a.isPrivate=!0,a.isPublic=!1,(n=new lt.crypto.ECDSA({curve:u})).setPublicKeyHex(c.ecpubhex),n.isPrivate=!1,n.isPublic=!0,(o={}).prvKeyObj=a,o.pubKeyObj=n,o}throw new Error("unknown algorithm: "+t)},$t.getPEM=function(t,e,r,n,i,s){var a=lt,o=a.asn1,u=o.DERObjectIdentifier,c=o.DERInteger,l=o.ASN1Util.newObject,h=o.x509.SubjectPublicKeyInfo,f=a.crypto,p=f.DSA,d=f.ECDSA,g=st;function y(t){return l({seq:[{int:0},{int:{bigint:t.n}},{int:t.e},{int:{bigint:t.d}},{int:{bigint:t.p}},{int:{bigint:t.q}},{int:{bigint:t.dmp1}},{int:{bigint:t.dmq1}},{int:{bigint:t.coeff}}]})}function v(t){return l({seq:[{int:1},{octstr:{hex:t.prvKeyHex}},{tag:["a0",!0,{oid:{name:t.curveName}}]},{tag:["a1",!0,{bitstr:{hex:"00"+t.pubKeyHex}}]}]})}function m(t){return l({seq:[{int:0},{int:{bigint:t.p}},{int:{bigint:t.q}},{int:{bigint:t.g}},{int:{bigint:t.y}},{int:{bigint:t.x}}]})}if((void 0!==g&&t instanceof g||void 0!==p&&t instanceof p||void 0!==d&&t instanceof d)&&1==t.isPublic&&(void 0===e||"PKCS8PUB"==e))return xt(C=new h(t).tohex(),"PUBLIC KEY");if("PKCS1PRV"==e&&void 0!==g&&t instanceof g&&(void 0===r||null==r)&&1==t.isPrivate)return xt(C=y(t).tohex(),"RSA PRIVATE KEY");if("PKCS1PRV"==e&&void 0!==d&&t instanceof d&&(void 0===r||null==r)&&1==t.isPrivate){var E=new u({name:t.curveName}).tohex(),S=v(t).tohex(),b="";return(b+=xt(E,"EC PARAMETERS"))+xt(S,"EC PRIVATE KEY")}if("PKCS1PRV"==e&&void 0!==p&&t instanceof p&&(void 0===r||null==r)&&1==t.isPrivate)return xt(C=m(t).tohex(),"DSA PRIVATE KEY");if("PKCS5PRV"==e&&void 0!==g&&t instanceof g&&void 0!==r&&null!=r&&1==t.isPrivate){var C=y(t).tohex();return void 0===n&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",C,r,n,s)}if("PKCS5PRV"==e&&void 0!==d&&t instanceof d&&void 0!==r&&null!=r&&1==t.isPrivate)return C=v(t).tohex(),void 0===n&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",C,r,n,s);if("PKCS5PRV"==e&&void 0!==p&&t instanceof p&&void 0!==r&&null!=r&&1==t.isPrivate)return C=m(t).tohex(),void 0===n&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",C,r,n,s);var A=function(t,e){if("string"==typeof e)return $t.getEncryptedPKCS8PEM(t,e);if("object"==typeof e&&null!=zt(e,"passcode")){var r=JSON.parse(JSON.stringify(e)),n=r.passcode;return delete r.passcode,$t.getEncryptedPKCS8PEM(t,n,r)}};if("PKCS8PRV"==e&&null!=g&&t instanceof g&&1==t.isPrivate){var w=y(t).tohex();return C=l({seq:[{int:0},{seq:[{oid:{name:"rsaEncryption"}},{null:!0}]},{octstr:{hex:w}}]}).tohex(),void 0===r||null==r?xt(C,"PRIVATE KEY"):A(C,r)}if("PKCS8PRV"==e&&void 0!==d&&t instanceof d&&1==t.isPrivate){var x={seq:[{int:1},{octstr:{hex:t.prvKeyHex}}]};return"string"==typeof t.pubKeyHex&&x.seq.push({tag:["a1",!0,{bitstr:{hex:"00"+t.pubKeyHex}}]}),w=new l(x).tohex(),C=l({seq:[{int:0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:t.curveName}}]},{octstr:{hex:w}}]}).tohex(),void 0===r||null==r?xt(C,"PRIVATE KEY"):A(C,r)}if("PKCS8PRV"==e&&void 0!==p&&t instanceof p&&1==t.isPrivate)return w=new c({bigint:t.x}).tohex(),C=l({seq:[{int:0},{seq:[{oid:{name:"dsa"}},{seq:[{int:{bigint:t.p}},{int:{bigint:t.q}},{int:{bigint:t.g}}]}]},{octstr:{hex:w}}]}).tohex(),void 0===r||null==r?xt(C,"PRIVATE KEY"):A(C,r);throw new Error("unsupported object nor format")},$t.getKeyFromCSRPEM=function(t){var e=Bt(t,"CERTIFICATE REQUEST");return $t.getKeyFromCSRHex(e)},$t.getKeyFromCSRHex=function(t){var e=$t.parseCSRHex(t);return $t.getKey(e.p8pubkeyhex,null,"pkcs8pub")},$t.parseCSRHex=function(t){var e=pt,r=e.getChildIdx,n=e.getTLV,i={},s=t;if("30"!=s.substr(0,2))throw new Error("malformed CSR(code:001)");var a=r(s,0);if(a.length<1)throw new Error("malformed CSR(code:002)");if("30"!=s.substr(a[0],2))throw new Error("malformed CSR(code:003)");var o=r(s,a[0]);if(o.length<3)throw new Error("malformed CSR(code:004)");return i.p8pubkeyhex=n(s,o[2]),i},$t.getKeyID=function(t){var e=$t,r=pt;"string"==typeof t&&-1!=t.indexOf("BEGIN ")&&(t=e.getKey(t));var n=Bt(e.getPEM(t)),i=r.getIdxbyList(n,0,[1]),s=r.getV(n,i).substring(2);return lt.crypto.Util.hashHex(s,"sha1")},$t.getJWK=function(t,e,r,n,i){var s,a,o={},u=lt.crypto.Util.hashHex;if("string"==typeof t)s=$t.getKey(t),-1!=t.indexOf("CERTIFICATE")&&(a=Bt(t));else{if("object"!=typeof t)throw new Error("unsupported keyinfo type");t instanceof Jt?(s=t.getPublicKey(),a=t.hex):s=t}if(s instanceof st&&s.isPrivate)o.kty="RSA",o.n=mt(s.n.toString(16)),o.e=mt(s.e.toString(16)),o.d=mt(s.d.toString(16)),o.p=mt(s.p.toString(16)),o.q=mt(s.q.toString(16)),o.dp=mt(s.dmp1.toString(16)),o.dq=mt(s.dmq1.toString(16)),o.qi=mt(s.coeff.toString(16));else if(s instanceof st&&s.isPublic)o.kty="RSA",o.n=mt(s.n.toString(16)),o.e=mt(s.e.toString(16));else if(s instanceof lt.crypto.ECDSA&&s.isPrivate){if("P-256"!==(l=s.getShortNISTPCurveName())&&"P-384"!==l&&"P-521"!==l)throw new Error("unsupported curve name for JWT: "+l);var c=s.getPublicKeyXYHex();o.kty="EC",o.crv=l,o.x=mt(c.x),o.y=mt(c.y),o.d=mt(s.prvKeyHex)}else if(s instanceof lt.crypto.ECDSA&&s.isPublic){var l;if("P-256"!==(l=s.getShortNISTPCurveName())&&"P-384"!==l&&"P-521"!==l)throw new Error("unsupported curve name for JWT: "+l);c=s.getPublicKeyXYHex(),o.kty="EC",o.crv=l,o.x=mt(c.x),o.y=mt(c.y)}if(null==o.kty)throw new Error("unsupported keyinfo");return s.isPrivate||1==e||(o.kid=lt.jws.JWS.getJWKthumbprint(o)),null!=a&&1!=r&&(o.x5c=[b(a)]),null!=a&&1!=n&&(o.x5t=yt(b(u(a,"sha1")))),null!=a&&1!=i&&(o["x5t#S256"]=yt(b(u(a,"sha256")))),o},$t.getJWKFromKey=function(t){return $t.getJWK(t,!0,!0,!0,!0)},st.getPosArrayOfChildrenFromHex=function(t){return pt.getChildIdx(t,0)},st.getHexValueArrayOfChildrenFromHex=function(t){var e,r=pt.getV,n=r(t,(e=st.getPosArrayOfChildrenFromHex(t))[0]),i=r(t,e[1]),s=r(t,e[2]),a=r(t,e[3]),o=r(t,e[4]),u=r(t,e[5]),c=r(t,e[6]),l=r(t,e[7]),h=r(t,e[8]);return(e=new Array).push(n,i,s,a,o,u,c,l,h),e},st.prototype.readPrivateKeyFromPEMString=function(t){var e=Bt(t),r=st.getHexValueArrayOfChildrenFromHex(e);this.setPrivateEx(r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8])},st.prototype.readPKCS5PrvKeyHex=function(t){var e=st.getHexValueArrayOfChildrenFromHex(t);this.setPrivateEx(e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},st.prototype.readPKCS8PrvKeyHex=function(t){var e,r,n,i,s,a,o,u,c=pt,l=c.getVbyListEx;if(!1===c.isASN1HEX(t))throw new Error("not ASN.1 hex string");try{e=l(t,0,[2,0,1],"02"),r=l(t,0,[2,0,2],"02"),n=l(t,0,[2,0,3],"02"),i=l(t,0,[2,0,4],"02"),s=l(t,0,[2,0,5],"02"),a=l(t,0,[2,0,6],"02"),o=l(t,0,[2,0,7],"02"),u=l(t,0,[2,0,8],"02")}catch(t){throw new Error("malformed PKCS#8 plain RSA private key")}this.setPrivateEx(e,r,n,i,s,a,o,u)},st.prototype.readPKCS5PubKeyHex=function(t){var e=pt,r=e.getV;if(!1===e.isASN1HEX(t))throw new Error("keyHex is not ASN.1 hex string");var n=e.getChildIdx(t,0);if(2!==n.length||"02"!==t.substr(n[0],2)||"02"!==t.substr(n[1],2))throw new Error("wrong hex for PKCS#5 public key");var i=r(t,n[0]),s=r(t,n[1]);this.setPublic(i,s)},st.prototype.readPKCS8PubKeyHex=function(t){var e=pt;if(!1===e.isASN1HEX(t))throw new Error("not ASN.1 hex string");if("06092a864886f70d010101"!==e.getTLVbyListEx(t,0,[0,0]))throw new Error("not PKCS8 RSA public key");var r=e.getTLVbyListEx(t,0,[1,0]);this.readPKCS5PubKeyHex(r)},st.prototype.readCertPubKeyHex=function(t,e){var r,n;(r=new Jt).readCertHex(t),n=r.getPublicKeyHex(),this.readPKCS8PubKeyHex(n)},st.prototype.sign=function(t,e){var r=function(t){return lt.crypto.Util.hashString(t,e)}(t);return this.signWithMessageHash(r,e)},st.prototype.signWithMessageHash=function(t,e){var r=it(lt.crypto.Util.getPaddedDigestInfoHex(t,e,this.n.bitLength()),16);return Yt(this.doPrivate(r).toString(16),this.n.bitLength())},st.prototype.signPSS=function(t,e,r){var n,i=(n=wt(t),lt.crypto.Util.hashHex(n,e));return void 0===r&&(r=-1),this.signWithMessageHashPSS(i,e,r)},st.prototype.signWithMessageHashPSS=function(t,e,r){var n,i=At(t),s=i.length,a=this.n.bitLength()-1,o=Math.ceil(a/8),u=function(t){return lt.crypto.Util.hashHex(t,e)};if(-1===r||void 0===r)r=s;else if(-2===r)r=o-s-2;else if(r<-2)throw new Error("invalid salt length");if(o<s+r+2)throw new Error("data too long");var c="";r>0&&(c=new Array(r),(new nt).nextBytes(c),c=String.fromCharCode.apply(String,c));var l=At(u(wt("\0\0\0\0\0\0\0\0"+i+c))),h=[];for(n=0;n<o-r-s-2;n+=1)h[n]=0;var f=String.fromCharCode.apply(String,h)+""+c,p=Qt(l,f.length,u),d=[];for(n=0;n<f.length;n+=1)d[n]=f.charCodeAt(n)^p.charCodeAt(n);var g=65280>>8*o-a&255;for(d[0]&=~g,n=0;n<s;n++)d.push(l.charCodeAt(n));return d.push(188),Yt(this.doPrivate(new A(d)).toString(16),this.n.bitLength())},st.prototype.verify=function(t,e){if(null==(e=e.toLowerCase()).match(/^[0-9a-f]+$/))return!1;var r=it(e,16),n=this.n.bitLength();if(r.bitLength()>n)return!1;var i=this.doPublic(r).toString(16);if(i.length+3!=n/4)return!1;var s=Xt(i.replace(/^1f+00/,""));if(0==s.length)return!1;var a=s[0],o=s[1],u=function(t){return lt.crypto.Util.hashString(t,a)}(t);return o==u},st.prototype.verifyWithMessageHash=function(t,e){if(e.length!=Math.ceil(this.n.bitLength()/4))return!1;var r=it(e,16);if(r.bitLength()>this.n.bitLength())return 0;var n=Xt(this.doPublic(r).toString(16).replace(/^1f+00/,""));return 0!=n.length&&(n[0],n[1]==t)},st.prototype.verifyPSS=function(t,e,r,n){var i,s=(i=wt(t),lt.crypto.Util.hashHex(i,r));return void 0===n&&(n=-1),this.verifyWithMessageHashPSS(s,e,r,n)},st.prototype.verifyWithMessageHashPSS=function(t,e,r,n){if(e.length!=Math.ceil(this.n.bitLength()/4))return!1;var i,s=new A(e,16),a=function(t){return lt.crypto.Util.hashHex(t,r)},o=At(t),u=o.length,c=this.n.bitLength()-1,l=Math.ceil(c/8);if(-1===n||void 0===n)n=u;else if(-2===n)n=l-u-2;else if(n<-2)throw new Error("invalid salt length");if(l<u+n+2)throw new Error("data too long");var h=this.doPublic(s).toByteArray();for(i=0;i<h.length;i+=1)h[i]&=255;for(;h.length<l;)h.unshift(0);if(188!==h[l-1])throw new Error("encoded message does not end in 0xbc");var f=(h=String.fromCharCode.apply(String,h)).substr(0,l-u-1),p=h.substr(f.length,u),d=65280>>8*l-c&255;if(0!=(f.charCodeAt(0)&d))throw new Error("bits beyond keysize not zero");var g=Qt(p,f.length,a),y=[];for(i=0;i<f.length;i+=1)y[i]=f.charCodeAt(i)^g.charCodeAt(i);y[0]&=~d;var v=l-u-n-2;for(i=0;i<v;i+=1)if(0!==y[i])throw new Error("leftmost octets not zero");if(1!==y[v])throw new Error("0x01 marker not found");return p===At(a(wt("\0\0\0\0\0\0\0\0"+o+String.fromCharCode.apply(String,y.slice(-n)))))},st.SALT_LEN_HLEN=-1,st.SALT_LEN_MAX=-2,st.SALT_LEN_RECOVER=-2,Jt.EXT_PARSER={},Jt.registExtParser=function(t,e){Jt.EXT_PARSER[t]=e},Jt.hex2dn=function(t,e){void 0===e&&(e=0);var r=new Jt;return pt.getTLV(t,e),r.getX500Name(t).str},Jt.hex2rdn=function(t,e){if(void 0===e&&(e=0),"31"!==t.substr(e,2))throw new Error("malformed RDN");for(var r=new Array,n=pt.getChildIdx(t,e),i=0;i<n.length;i++)r.push(Jt.hex2attrTypeValue(t,n[i]));return r=r.map((function(t){return t.replace("+","\\+")})),r.join("+")},Jt.hex2attrTypeValue=function(t,e){var r=pt,n=r.getV;if(void 0===e&&(e=0),"30"!==t.substr(e,2))throw new Error("malformed attribute type and value");var i=r.getChildIdx(t,e);2!==i.length||t.substr(i[0],2);var s=n(t,i[0]),a=lt.asn1.ASN1Util.oidHexToInt(s);return lt.asn1.x509.OID.oid2atype(a)+"="+At(n(t,i[1]))},Jt.getPublicKeyFromCertHex=function(t){var e=new Jt;return e.readCertHex(t),e.getPublicKey()},Jt.getPublicKeyFromCertPEM=function(t){var e=new Jt;return e.readCertPEM(t),e.getPublicKey()},Jt.getPublicKeyInfoPropOfCertPEM=function(t){var e,r,n=pt.getVbyList,i={algparam:null};return(e=new Jt).readCertPEM(t),r=e.getPublicKeyHex(),i.keyhex=n(r,0,[1],"03").substr(2),i.algoid=n(r,0,[0,0],"06"),"2a8648ce3d0201"===i.algoid&&(i.algparam=n(r,0,[0,1],"06")),i},Jt.KEYUSAGE_NAME=["digitalSignature","nonRepudiation","keyEncipherment","dataEncipherment","keyAgreement","keyCertSign","cRLSign","encipherOnly","decipherOnly"],void 0!==lt&&lt||(lt={}),void 0!==lt.jws&&lt.jws||(lt.jws={}),lt.jws.JWS=function(){var t=lt.jws.JWS.isSafeJSONString;this.parseJWS=function(e,r){if(void 0===this.parsedJWS||!r&&void 0===this.parsedJWS.sigvalH){var n=e.match(/^([^.]+)\.([^.]+)\.([^.]+)$/);if(null==n)throw"JWS signature is not a form of 'Head.Payload.SigValue'.";var i=n[1],s=n[2],a=n[3],o=i+"."+s;if(this.parsedJWS={},this.parsedJWS.headB64U=i,this.parsedJWS.payloadB64U=s,this.parsedJWS.sigvalB64U=a,this.parsedJWS.si=o,!r){var u=Et(a),c=it(u,16);this.parsedJWS.sigvalH=u,this.parsedJWS.sigvalBI=c}var l=ft(i),h=ft(s);if(this.parsedJWS.headS=l,this.parsedJWS.payloadS=h,!t(l,this.parsedJWS,"headP"))throw"malformed JSON string for JWS Head: "+l}}},lt.jws.JWS.sign=function(t,e,r,n,i){var s,a,o,u=lt,c=u.jws.JWS,l=c.readSafeJSONString,h=c.isSafeJSONString,f=u.crypto,p=(f.ECDSA,f.Mac),d=f.Signature,g=JSON;if("string"!=typeof e&&"object"!=typeof e)throw"spHeader must be JSON string or object: "+e;if("object"==typeof e&&(a=e,s=g.stringify(a)),"string"==typeof e){if(!h(s=e))throw"JWS Head is not safe JSON string: "+s;a=l(s)}if(o=r,"object"==typeof r&&(o=g.stringify(r)),""!=t&&null!=t||void 0===a.alg||(t=a.alg),""!=t&&null!=t&&void 0===a.alg&&(a.alg=t,s=g.stringify(a)),t!==a.alg)throw"alg and sHeader.alg doesn't match: "+t+"!="+a.alg;var y=null;if(void 0===c.jwsalg2sigalg[t])throw"unsupported alg name: "+t;y=c.jwsalg2sigalg[t];var v=ht(s)+"."+ht(o),m="";if("Hmac"==y.substr(0,4)){if(void 0===n)throw"mac key shall be specified for HS* alg";var E=new p({alg:y,prov:"cryptojs",pass:n});E.updateString(v),m=E.doFinal()}else if(-1!=y.indexOf("withECDSA")){(b=new d({alg:y})).init(n,i),b.updateString(v);var S=b.sign();m=lt.crypto.ECDSA.asn1SigToConcatSig(S)}else{var b;"none"!=y&&((b=new d({alg:y})).init(n,i),b.updateString(v),m=b.sign())}return v+"."+mt(m)},lt.jws.JWS.verify=function(t,e,r){var n,i=lt,s=i.jws.JWS,a=s.readSafeJSONString,o=i.crypto,u=o.ECDSA,c=o.Mac,l=o.Signature;if(n=st,!Vt(t))return!1;var h=t.split(".");if(3!==h.length)return!1;var f,p=h[0]+"."+h[1],d=Et(h[2]),g=a(ft(h[0])),y=null;if(void 0===g.alg)throw"algorithm not specified in header";if(f=(y=g.alg).substr(0,2),null!=r&&"[object Array]"===Object.prototype.toString.call(r)&&r.length>0&&-1==(":"+r.join(":")+":").indexOf(":"+y+":"))throw"algorithm '"+y+"' not accepted in the list";if("none"!=y&&null===e)throw"key shall be specified to verify.";if("string"==typeof e&&-1!=e.indexOf("-----BEGIN ")&&(e=$t.getKey(e)),!("RS"!=f&&"PS"!=f||e instanceof n))throw"key shall be a RSAKey obj for RS* and PS* algs";if("ES"==f&&!(e instanceof u))throw"key shall be a ECDSA obj for ES* algs";var v=null;if(void 0===s.jwsalg2sigalg[g.alg])throw"unsupported alg name: "+y;if("none"==(v=s.jwsalg2sigalg[y]))throw"not supported";if("Hmac"==v.substr(0,4)){if(void 0===e)throw"hexadecimal key shall be specified for HMAC";var m=new c({alg:v,pass:e});return m.updateString(p),d==m.doFinal()}if(-1!=v.indexOf("withECDSA")){var E,S=null;try{S=u.concatSigToASN1Sig(d)}catch(t){return!1}return(E=new l({alg:v})).init(e),E.updateString(p),E.verify(S)}return(E=new l({alg:v})).init(e),E.updateString(p),E.verify(d)},lt.jws.JWS.parse=function(t){var e,r,n,i=t.split("."),s={};if(2!=i.length&&3!=i.length)throw"malformed sJWS: wrong number of '.' splitted elements";return e=i[0],r=i[1],3==i.length&&(n=i[2]),s.headerObj=lt.jws.JWS.readSafeJSONString(ft(e)),s.payloadObj=lt.jws.JWS.readSafeJSONString(ft(r)),s.headerPP=JSON.stringify(s.headerObj,null," "),null==s.payloadObj?s.payloadPP=ft(r):s.payloadPP=JSON.stringify(s.payloadObj,null," "),void 0!==n&&(s.sigHex=Et(n)),s},lt.jws.JWS.verifyJWT=function(t,e,r){var n=lt.jws,i=n.JWS,s=i.readSafeJSONString,a=i.inArray,o=i.includedArray;if(!Vt(t))return!1;var u=t.split(".");if(3!=u.length)return!1;var c=u[0],l=u[1],h=(Et(u[2]),s(ft(c))),f=s(ft(l));if(void 0===h.alg)return!1;if(void 0===r.alg)throw"acceptField.alg shall be specified";if(!a(h.alg,r.alg))return!1;if(void 0!==f.iss&&"object"==typeof r.iss&&!a(f.iss,r.iss))return!1;if(void 0!==f.sub&&"object"==typeof r.sub&&!a(f.sub,r.sub))return!1;if(void 0!==f.aud&&"object"==typeof r.aud)if("string"==typeof f.aud){if(!a(f.aud,r.aud))return!1}else if("object"==typeof f.aud&&!o(f.aud,r.aud))return!1;var p=n.IntDate.getNow();return void 0!==r.verifyAt&&"number"==typeof r.verifyAt&&(p=r.verifyAt),void 0!==r.gracePeriod&&"number"==typeof r.gracePeriod||(r.gracePeriod=0),!(void 0!==f.exp&&"number"==typeof f.exp&&f.exp+r.gracePeriod<p||void 0!==f.nbf&&"number"==typeof f.nbf&&p<f.nbf-r.gracePeriod||void 0!==f.iat&&"number"==typeof f.iat&&p<f.iat-r.gracePeriod||void 0!==f.jti&&void 0!==r.jti&&f.jti!==r.jti||!i.verify(t,e,r.alg))},lt.jws.JWS.includedArray=function(t,e){var r=lt.jws.JWS.inArray;if(null===t)return!1;if("object"!=typeof t)return!1;if("number"!=typeof t.length)return!1;for(var n=0;n<t.length;n++)if(!r(t[n],e))return!1;return!0},lt.jws.JWS.inArray=function(t,e){if(null===e)return!1;if("object"!=typeof e)return!1;if("number"!=typeof e.length)return!1;for(var r=0;r<e.length;r++)if(e[r]==t)return!0;return!1},lt.jws.JWS.jwsalg2sigalg={HS256:"HmacSHA256",HS384:"HmacSHA384",HS512:"HmacSHA512",RS256:"SHA256withRSA",RS384:"SHA384withRSA",RS512:"SHA512withRSA",ES256:"SHA256withECDSA",ES384:"SHA384withECDSA",ES512:"SHA512withECDSA",PS256:"SHA256withRSAandMGF1",PS384:"SHA384withRSAandMGF1",PS512:"SHA512withRSAandMGF1",none:"none"},lt.jws.JWS.isSafeJSONString=function(t,e,r){var n=null;try{return"object"!=typeof(n=ct(t))||n.constructor===Array?0:(e&&(e[r]=n),1)}catch(t){return 0}},lt.jws.JWS.readSafeJSONString=function(t){var e=null;try{return"object"!=typeof(e=ct(t))||e.constructor===Array?null:e}catch(t){return null}},lt.jws.JWS.getEncodedSignatureValueFromJWS=function(t){var e=t.match(/^[^.]+\.[^.]+\.([^.]+)$/);if(null==e)throw"JWS signature is not a form of 'Head.Payload.SigValue'.";return e[1]},lt.jws.JWS.getJWKthumbprint=function(t){if("RSA"!==t.kty&&"EC"!==t.kty&&"oct"!==t.kty)throw"unsupported algorithm for JWK Thumprint";var e="{";if("RSA"===t.kty){if("string"!=typeof t.n||"string"!=typeof t.e)throw"wrong n and e value for RSA key";e+='"e":"'+t.e+'",',e+='"kty":"'+t.kty+'",',e+='"n":"'+t.n+'"}'}else if("EC"===t.kty){if("string"!=typeof t.crv||"string"!=typeof t.x||"string"!=typeof t.y)throw"wrong crv, x and y value for EC key";e+='"crv":"'+t.crv+'",',e+='"kty":"'+t.kty+'",',e+='"x":"'+t.x+'",',e+='"y":"'+t.y+'"}'}else if("oct"===t.kty){if("string"!=typeof t.k)throw"wrong k value for oct(symmetric) key";e+='"kty":"'+t.kty+'",',e+='"k":"'+t.k+'"}'}var r=wt(e);return mt(lt.crypto.Util.hashHex(r,"sha256"))},lt.jws.IntDate={},lt.jws.IntDate.get=function(t){var e=lt.jws.IntDate,r=e.getNow,n=e.getZulu;if("now"==t)return r();if("now + 1hour"==t)return r()+3600;if("now + 1day"==t)return r()+86400;if("now + 1month"==t)return r()+2592e3;if("now + 1year"==t)return r()+31536e3;if(t.match(/Z$/))return n(t);if(t.match(/^[0-9]+$/))return parseInt(t);throw"unsupported format: "+t},lt.jws.IntDate.getZulu=function(t){return It(t)},lt.jws.IntDate.getNow=function(){return~~(new Date/1e3)},lt.jws.IntDate.intDate2UTCString=function(t){return new Date(1e3*t).toUTCString()},lt.jws.IntDate.intDate2Zulu=function(t){var e=new Date(1e3*t);return("0000"+e.getUTCFullYear()).slice(-4)+("00"+(e.getUTCMonth()+1)).slice(-2)+("00"+e.getUTCDate()).slice(-2)+("00"+e.getUTCHours()).slice(-2)+("00"+e.getUTCMinutes()).slice(-2)+("00"+e.getUTCSeconds()).slice(-2)+"Z"},void 0!==lt&&lt||(lt={}),void 0!==lt.jws&&lt.jws||(lt.jws={}),lt.jws.JWSJS=function(){var t=lt.jws.JWS,e=t.readSafeJSONString;this.aHeader=[],this.sPayload="",this.aSignature=[],this.init=function(){this.aHeader=[],this.sPayload=void 0,this.aSignature=[]},this.initWithJWS=function(t){this.init();var e=t.split(".");if(3!=e.length)throw"malformed input JWS";this.aHeader.push(e[0]),this.sPayload=e[1],this.aSignature.push(e[2])},this.addSignature=function(t,e,r,n){if(void 0===this.sPayload||null===this.sPayload)throw"there's no JSON-JS signature to add.";var i=this.aHeader.length;if(this.aHeader.length!=this.aSignature.length)throw"aHeader.length != aSignature.length";try{var s=lt.jws.JWS.sign(t,e,this.sPayload,r,n).split(".");s[0],s[2],this.aHeader.push(s[0]),this.aSignature.push(s[2])}catch(t){throw this.aHeader.length>i&&this.aHeader.pop(),this.aSignature.length>i&&this.aSignature.pop(),"addSignature failed: "+t}},this.verifyAll=function(t){if(this.aHeader.length!==t.length||this.aSignature.length!==t.length)return!1;for(var e=0;e<t.length;e++){var r=t[e];if(2!==r.length)return!1;if(!1===this.verifyNth(e,r[0],r[1]))return!1}return!0},this.verifyNth=function(e,r,n){if(this.aHeader.length<=e||this.aSignature.length<=e)return!1;var i=this.aHeader[e],s=this.aSignature[e],a=i+"."+this.sPayload+"."+s,o=!1;try{o=t.verify(a,r,n)}catch(t){return!1}return o},this.readJWSJS=function(t){if("string"==typeof t){var r=e(t);if(null==r)throw"argument is not safe JSON object string";this.aHeader=r.headers,this.sPayload=r.payload,this.aSignature=r.signatures}else try{if(!(t.headers.length>0))throw"malformed header";if(this.aHeader=t.headers,"string"!=typeof t.payload)throw"malformed signatures";if(this.sPayload=t.payload,!(t.signatures.length>0))throw"malformed signatures";this.aSignature=t.signatures}catch(t){throw"malformed JWS-JS JSON object: "+t}},this.getJSON=function(){return{headers:this.aHeader,payload:this.sPayload,signatures:this.aSignature}},this.isEmpty=function(){return 0==this.aHeader.length?1:0}},e.kb=A,e.Ks=st,lt.crypto.ECDSA,lt.crypto.DSA,lt.crypto.Signature,lt.crypto.MessageDigest,lt.crypto.Mac,e.AD=$t,e.g5=pt,e.EF=Jt,e.lK=lt,lt.crypto,lt.asn1,lt.jws,lt.lang},56220:function(t,e,r){var n,i;!function(s,a){"use strict";n=function(){var t=function(){},e="undefined",r=typeof window!==e&&typeof window.navigator!==e&&/Trident\/|MSIE /.test(window.navigator.userAgent),n=["trace","debug","info","warn","error"],i={},s=null;function a(t,e){var r=t[e];if("function"==typeof r.bind)return r.bind(t);try{return Function.prototype.bind.call(r,t)}catch(e){return function(){return Function.prototype.apply.apply(r,[t,arguments])}}}function o(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function u(){for(var r=this.getLevel(),i=0;i<n.length;i++){var s=n[i];this[s]=i<r?t:this.methodFactory(s,r,this.name)}if(this.log=this.debug,typeof console===e&&r<this.levels.SILENT)return"No console available for logging"}function c(t){return function(){typeof console!==e&&(u.call(this),this[t].apply(this,arguments))}}function l(n,i,s){return function(n){return"debug"===n&&(n="log"),typeof console!==e&&("trace"===n&&r?o:void 0!==console[n]?a(console,n):void 0!==console.log?a(console,"log"):t)}(n)||c.apply(this,arguments)}function h(t,r){var a,o,c,h=this,f="loglevel";function p(){var t;if(typeof window!==e&&f){try{t=window.localStorage[f]}catch(t){}if(typeof t===e)try{var r=window.document.cookie,n=encodeURIComponent(f),i=r.indexOf(n+"=");-1!==i&&(t=/^([^;]+)/.exec(r.slice(i+n.length+1))[1])}catch(t){}return void 0===h.levels[t]&&(t=void 0),t}}function d(t){var e=t;if("string"==typeof e&&void 0!==h.levels[e.toUpperCase()]&&(e=h.levels[e.toUpperCase()]),"number"==typeof e&&e>=0&&e<=h.levels.SILENT)return e;throw new TypeError("log.setLevel() called with invalid level: "+t)}"string"==typeof t?f+=":"+t:"symbol"==typeof t&&(f=void 0),h.name=t,h.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},h.methodFactory=r||l,h.getLevel=function(){return null!=c?c:null!=o?o:a},h.setLevel=function(t,r){return c=d(t),!1!==r&&function(t){var r=(n[t]||"silent").toUpperCase();if(typeof window!==e&&f){try{return void(window.localStorage[f]=r)}catch(t){}try{window.document.cookie=encodeURIComponent(f)+"="+r+";"}catch(t){}}}(c),u.call(h)},h.setDefaultLevel=function(t){o=d(t),p()||h.setLevel(t,!1)},h.resetLevel=function(){c=null,function(){if(typeof window!==e&&f){try{window.localStorage.removeItem(f)}catch(t){}try{window.document.cookie=encodeURIComponent(f)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(t){}}}(),u.call(h)},h.enableAll=function(t){h.setLevel(h.levels.TRACE,t)},h.disableAll=function(t){h.setLevel(h.levels.SILENT,t)},h.rebuild=function(){if(s!==h&&(a=d(s.getLevel())),u.call(h),s===h)for(var t in i)i[t].rebuild()},a=d(s?s.getLevel():"WARN");var g=p();null!=g&&(c=d(g)),u.call(h)}(s=new h).getLogger=function(t){if("symbol"!=typeof t&&"string"!=typeof t||""===t)throw new TypeError("You must supply a name when creating a logger.");var e=i[t];return e||(e=i[t]=new h(t,s.methodFactory)),e};var f=typeof window!==e?window.log:void 0;return s.noConflict=function(){return typeof window!==e&&window.log===s&&(window.log=f),s},s.getLoggers=function(){return i},s.default=s,s},void 0===(i=n.call(e,r,e,t))||(t.exports=i)}()},26512:t=>{var e,r,n=t.exports={};function i(){throw new Error("setTimeout has not been defined")}function s(){throw new Error("clearTimeout has not been defined")}function a(t){if(e===setTimeout)return setTimeout(t,0);if((e===i||!e)&&setTimeout)return e=setTimeout,setTimeout(t,0);try{return e(t,0)}catch(r){try{return e.call(null,t,0)}catch(r){return e.call(this,t,0)}}}!function(){try{e="function"==typeof setTimeout?setTimeout:i}catch(t){e=i}try{r="function"==typeof clearTimeout?clearTimeout:s}catch(t){r=s}}();var o,u=[],c=!1,l=-1;function h(){c&&o&&(c=!1,o.length?u=o.concat(u):l=-1,u.length&&f())}function f(){if(!c){var t=a(h);c=!0;for(var e=u.length;e;){for(o=u,u=[];++l<e;)o&&o[l].run();l=-1,e=u.length}o=null,c=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{return r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function d(){}n.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];u.push(new p(t,e)),1!==u.length||c||a(f)},p.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=d,n.addListener=d,n.once=d,n.off=d,n.removeListener=d,n.removeAllListeners=d,n.emit=d,n.prependListener=d,n.prependOnceListener=d,n.listeners=function(t){return[]},n.binding=function(t){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(t){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},43688:(t,e)=>{!function(t){var e,r,n,i=String.fromCharCode;function s(t){for(var e,r,n=[],i=0,s=t.length;i<s;)(e=t.charCodeAt(i++))>=55296&&e<=56319&&i<s?56320==(64512&(r=t.charCodeAt(i++)))?n.push(((1023&e)<<10)+(1023&r)+65536):(n.push(e),i--):n.push(e);return n}function a(t){if(t>=55296&&t<=57343)throw Error("Lone surrogate U+"+t.toString(16).toUpperCase()+" is not a scalar value")}function o(t,e){return i(t>>e&63|128)}function u(t){if(0==(4294967168&t))return i(t);var e="";return 0==(4294965248&t)?e=i(t>>6&31|192):0==(4294901760&t)?(a(t),e=i(t>>12&15|224),e+=o(t,6)):0==(4292870144&t)&&(e=i(t>>18&7|240),e+=o(t,12),e+=o(t,6)),e+i(63&t|128)}function c(){if(n>=r)throw Error("Invalid byte index");var t=255&e[n];if(n++,128==(192&t))return 63&t;throw Error("Invalid continuation byte")}function l(){var t,i;if(n>r)throw Error("Invalid byte index");if(n==r)return!1;if(t=255&e[n],n++,0==(128&t))return t;if(192==(224&t)){if((i=(31&t)<<6|c())>=128)return i;throw Error("Invalid continuation byte")}if(224==(240&t)){if((i=(15&t)<<12|c()<<6|c())>=2048)return a(i),i;throw Error("Invalid continuation byte")}if(240==(248&t)&&(i=(7&t)<<18|c()<<12|c()<<6|c())>=65536&&i<=1114111)return i;throw Error("Invalid UTF-8 detected")}t.version="3.0.0",t.encode=function(t){for(var e=s(t),r=e.length,n=-1,i="";++n<r;)i+=u(e[n]);return i},t.decode=function(t){e=s(t),r=e.length,n=0;for(var a,o=[];!1!==(a=l());)o.push(a);return function(t){for(var e,r=t.length,n=-1,s="";++n<r;)(e=t[n])>65535&&(s+=i((e-=65536)>>>10&1023|55296),e=56320|1023&e),s+=i(e);return s}(o)}}(e)},19024:()=>{},39116:()=>{},80628:()=>{},6636:(t,e,r)=>{var n=r(59848).default;function i(){"use strict";t.exports=i=function(){return r},t.exports.__esModule=!0,t.exports.default=t.exports;var e,r={},s=Object.prototype,a=s.hasOwnProperty,o=Object.defineProperty||function(t,e,r){t[e]=r.value},u="function"==typeof Symbol?Symbol:{},c=u.iterator||"@@iterator",l=u.asyncIterator||"@@asyncIterator",h=u.toStringTag||"@@toStringTag";function f(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{f({},"")}catch(e){f=function(t,e,r){return t[e]=r}}function p(t,e,r,n){var i=e&&e.prototype instanceof S?e:S,s=Object.create(i.prototype),a=new P(n||[]);return o(s,"_invoke",{value:F(t,r,a)}),s}function d(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}r.wrap=p;var g="suspendedStart",y="suspendedYield",v="executing",m="completed",E={};function S(){}function b(){}function C(){}var A={};f(A,c,(function(){return this}));var w=Object.getPrototypeOf,x=w&&w(w(k([])));x&&x!==s&&a.call(x,c)&&(A=x);var B=C.prototype=S.prototype=Object.create(A);function I(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function T(t,e){function r(i,s,o,u){var c=d(t[i],t,s);if("throw"!==c.type){var l=c.arg,h=l.value;return h&&"object"==n(h)&&a.call(h,"__await")?e.resolve(h.__await).then((function(t){r("next",t,o,u)}),(function(t){r("throw",t,o,u)})):e.resolve(h).then((function(t){l.value=t,o(l)}),(function(t){return r("throw",t,o,u)}))}u(c.arg)}var i;o(this,"_invoke",{value:function(t,n){function s(){return new e((function(e,i){r(t,n,e,i)}))}return i=i?i.then(s,s):s()}})}function F(t,r,n){var i=g;return function(s,a){if(i===v)throw new Error("Generator is already running");if(i===m){if("throw"===s)throw a;return{value:e,done:!0}}for(n.method=s,n.arg=a;;){var o=n.delegate;if(o){var u=R(o,n);if(u){if(u===E)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===g)throw i=m,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=v;var c=d(t,r,n);if("normal"===c.type){if(i=n.done?m:y,c.arg===E)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(i=m,n.method="throw",n.arg=c.arg)}}}function R(t,r){var n=r.method,i=t.iterator[n];if(i===e)return r.delegate=null,"throw"===n&&t.iterator.return&&(r.method="return",r.arg=e,R(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),E;var s=d(i,t.iterator,r.arg);if("throw"===s.type)return r.method="throw",r.arg=s.arg,r.delegate=null,E;var a=s.arg;return a?a.done?(r[t.resultName]=a.value,r.next=t.nextLoc,"return"!==r.method&&(r.method="next",r.arg=e),r.delegate=null,E):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,E)}function N(t){var e={tryLoc:t[0]};1 in t&&(e.catchLoc=t[1]),2 in t&&(e.finallyLoc=t[2],e.afterLoc=t[3]),this.tryEntries.push(e)}function D(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function P(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(N,this),this.reset(!0)}function k(t){if(t||""===t){var r=t[c];if(r)return r.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var i=-1,s=function r(){for(;++i<t.length;)if(a.call(t,i))return r.value=t[i],r.done=!1,r;return r.value=e,r.done=!0,r};return s.next=s}}throw new TypeError(n(t)+" is not iterable")}return b.prototype=C,o(B,"constructor",{value:C,configurable:!0}),o(C,"constructor",{value:b,configurable:!0}),b.displayName=f(C,h,"GeneratorFunction"),r.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===b||"GeneratorFunction"===(e.displayName||e.name))},r.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,C):(t.__proto__=C,f(t,h,"GeneratorFunction")),t.prototype=Object.create(B),t},r.awrap=function(t){return{__await:t}},I(T.prototype),f(T.prototype,l,(function(){return this})),r.AsyncIterator=T,r.async=function(t,e,n,i,s){void 0===s&&(s=Promise);var a=new T(p(t,e,n,i),s);return r.isGeneratorFunction(e)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},I(B),f(B,h,"Generator"),f(B,c,(function(){return this})),f(B,"toString",(function(){return"[object Generator]"})),r.keys=function(t){var e=Object(t),r=[];for(var n in e)r.push(n);return r.reverse(),function t(){for(;r.length;){var n=r.pop();if(n in e)return t.value=n,t.done=!1,t}return t.done=!0,t}},r.values=k,P.prototype={constructor:P,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=e,this.done=!1,this.delegate=null,this.method="next",this.arg=e,this.tryEntries.forEach(D),!t)for(var r in this)"t"===r.charAt(0)&&a.call(this,r)&&!isNaN(+r.slice(1))&&(this[r]=e)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var r=this;function n(n,i){return o.type="throw",o.arg=t,r.next=n,i&&(r.method="next",r.arg=e),!!i}for(var i=this.tryEntries.length-1;i>=0;--i){var s=this.tryEntries[i],o=s.completion;if("root"===s.tryLoc)return n("end");if(s.tryLoc<=this.prev){var u=a.call(s,"catchLoc"),c=a.call(s,"finallyLoc");if(u&&c){if(this.prev<s.catchLoc)return n(s.catchLoc,!0);if(this.prev<s.finallyLoc)return n(s.finallyLoc)}else if(u){if(this.prev<s.catchLoc)return n(s.catchLoc,!0)}else{if(!c)throw new Error("try statement without catch or finally");if(this.prev<s.finallyLoc)return n(s.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&a.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var s=i?i.completion:{};return s.type=t,s.arg=e,i?(this.method="next",this.next=i.finallyLoc,E):this.complete(s)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),E},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),D(r),E}},catch:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.tryLoc===t){var n=r.completion;if("throw"===n.type){var i=n.arg;D(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:k(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),E}},r}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports},59848:t=>{function e(r){return t.exports=e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},t.exports.__esModule=!0,t.exports.default=t.exports,e(r)}t.exports=e,t.exports.__esModule=!0,t.exports.default=t.exports},33248:(t,e,r)=>{var n=r(6636)();t.exports=n;try{regeneratorRuntime=n}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}}},e={};function r(n){var i=e[n];if(void 0!==i)return i.exports;var s=e[n]={exports:{}};return t[n].call(s.exports,s,s.exports,r),s.exports}r.n=t=>{var e=t&&t.__esModule?()=>t.default:()=>t;return r.d(e,{a:e}),e},r.d=(t,e)=>{for(var n in e)r.o(e,n)&&!r.o(t,n)&&Object.defineProperty(t,n,{enumerable:!0,get:e[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(t){if("object"==typeof window)return window}}(),r.o=(t,e)=>Object.prototype.hasOwnProperty.call(t,e),(()=>{"use strict";function t(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function e(t){return e="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},e(t)}function n(t){var r=function(t,r){if("object"!=e(t)||!t)return t;var n=t[Symbol.toPrimitive];if(void 0!==n){var i=n.call(t,"string");if("object"!=e(i))return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==e(r)?r:String(r)}function i(t,e){for(var r=0;r<e.length;r++){var i=e[r];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,n(i.key),i)}}function s(t,e,r){return e&&i(t.prototype,e),r&&i(t,r),Object.defineProperty(t,"prototype",{writable:!1}),t}function a(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function o(t,r){if(r&&("object"===e(r)||"function"==typeof r))return r;if(void 0!==r)throw new TypeError("Derived constructors may only return object or undefined");return a(t)}function u(t){return u=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},u(t)}function c(t,e){return c=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},c(t,e)}function l(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&c(t,e)}var h=r(72216);function f(t,e,r,n,i,s,a){try{var o=t[s](a),u=o.value}catch(t){return void r(t)}o.done?e(u):Promise.resolve(u).then(n,i)}function p(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var s=t.apply(e,r);function a(t){f(s,n,i,a,o,"next",t)}function o(t){f(s,n,i,a,o,"throw",t)}a(void 0)}))}}var d=r(33248),g=r.n(d);function y(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function v(t,e){if(t){if("string"==typeof t)return y(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?y(t,e):void 0}}function m(t){return function(t){if(Array.isArray(t))return y(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||v(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var E=r(56220),S=r.n(E),b=r(43688),C=r.n(b);function A(t,e,r){return e=u(e),o(t,w()?Reflect.construct(e,r||[],u(t).constructor):e.apply(t,r))}function w(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(w=function(){return!!t})()}const x=function(e){function r(){var e;t(this,r);for(var n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];return(e=A(this,r,[].concat(i))).type="OperationError",Error.captureStackTrace&&Error.captureStackTrace(a(e),r),e}return l(r,e),s(r)}(function(t){function e(){var e=Reflect.construct(t,Array.from(arguments));return Object.setPrototypeOf(e,Object.getPrototypeOf(this)),e}return e.prototype=Object.create(t.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t,e}(Error));function B(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"A-Za-z0-9+/=";if(!t)return"";if("string"==typeof t&&(t=U.strToArrayBuffer(t)),t instanceof ArrayBuffer&&(t=new Uint8Array(t)),64!==(e=U.expandAlphRange(e).join("")).length&&65!==e.length)throw new x(`Invalid Base64 alphabet length (${e.length}): ${e}`);for(var r,n,i,s,a,o,u,c="",l=0;l<t.length;)s=(r=t[l++])>>2,a=(3&r)<<4|(n=t[l++])>>4,o=(15&n)<<2|(i=t[l++])>>6,u=63&i,isNaN(n)?o=u=64:isNaN(i)&&(u=64),c+=e.charAt(s)+e.charAt(a)+e.charAt(o)+e.charAt(u);return c}function I(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"A-Za-z0-9+/=",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"string",n=!(arguments.length>3&&void 0!==arguments[3])||arguments[3],i=arguments.length>4&&void 0!==arguments[4]&&arguments[4];if(!t)return"string"===r?"":[];if(e=e||"A-Za-z0-9+/=",64!==(e=U.expandAlphRange(e).join("")).length&&65!==e.length)throw new x(`Error: Base64 alphabet should be 64 characters long, or 65 with a padding character. Found ${e.length}: ${e}`);if(n){var s=new RegExp("[^"+e.replace(/[[\]\\\-^$]/g,"\\$&")+"]","g");t=t.replace(s,"")}if(i){if(t.length%4==1)throw new x(`Error: Invalid Base64 input length (${t.length}). Cannot be 4n+1, even without padding chars.`);if(65===e.length){var a=e.charAt(64),o=t.indexOf(a);if(o>=0){if(o<t.length-2||t.charAt(t.length-1)!==a)throw new x(`Error: Base64 padding character (${a}) not used in the correct place.`);if(t.length%4!=0)throw new x("Error: Base64 not padded to a multiple of 4.")}}}for(var u,c,l,h,f,p,d,g=[],y=0;y<t.length;){if(h=e.indexOf(t.charAt(y++)||null),f=e.indexOf(t.charAt(y++)||null),p=e.indexOf(t.charAt(y++)||null),d=e.indexOf(t.charAt(y++)||null),i&&(h<0||f<0||p<0||d<0))throw new x("Error: Base64 input contains non-alphabet char(s)");c=(15&f)<<4|p>>2,l=(3&p)<<6|d,(u=h<<2|f>>4)>=0&&u<256&&g.push(u),c>=0&&c<256&&64!==p&&g.push(c),l>=0&&l<256&&64!==d&&g.push(l)}return"string"===r?U.byteArrayToUtf8(g):g}function T(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" ",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!t)return"";t instanceof ArrayBuffer&&(t=new Uint8Array(t));for(var s="",a="0x"===e||"\\x"===e,o=0;o<t.length;o++){var u=t[o].toString(16).padStart(r,"0");s+=a?e+u:u+e,n&&(s+=n),o!==t.length-1&&(o+1)%i==0&&(s+="\n")}var c=n.length+(a?0:e.length);return c?s.slice(0,-c):s}function F(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Auto",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2;if(r<1||Math.round(r)!==r)throw new x("Byte length must be a positive integer");if("None"!==e){var n="Auto"===e?/[^a-f\d]|0x/gi:U.regexRep(e);t=t.split(n)}else t=[t];for(var i=[],s=0;s<t.length;s++)for(var a=0;a<t[s].length;a+=r)i.push(parseInt(t[s].substr(a,r),16));return i}function R(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Auto";e=U.charRep(e);var r=[],n=t.split(e);""===n[n.length-1]&&(n=n.slice(0,n.length-1));for(var i=0;i<n.length;i++)r[i]=parseInt(n[i],10);return r}function N(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Space",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:8;if(r<1||Math.round(r)!==r)throw new x("Byte length must be a positive integer");var n=U.regexRep(e);t=t.replace(n,"");for(var i=[],s=0;s<t.length;s+=r)i.push(parseInt(t.substr(s,r),2));return i}["Auto"].concat(["Space","Percent","Comma","Semi-colon","Colon","Line feed","CRLF","0x","0x with comma","\\x","None"]);var D=r(33296).Buffer,P=r(26512),k=function(){function e(){t(this,e)}var r;return s(e,null,[{key:"chr",value:function(t){if(t>65535){t-=65536;var e=String.fromCharCode(t>>>10&1023|55296);return t=56320|1023&t,e+String.fromCharCode(t)}return String.fromCharCode(t)}},{key:"ord",value:function(t){if(2===t.length){var e=t.charCodeAt(0),r=t.charCodeAt(1);if(e>=55296&&e<56320&&r>=56320&&r<57344)return 1024*(e-55296)+r-56320+65536}return t.charCodeAt(0)}},{key:"padBytesRight",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=new Array(e);return n.fill(r),m(t).forEach((function(t,e){n[e]=t})),n}},{key:"truncate",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"...";return t.length>e&&(t=t.slice(0,e-r.length)+r),t}},{key:"hex",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return(t="string"==typeof t?e.ord(t):t).toString(16).padStart(r,"0")}},{key:"bin",value:function(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return(t="string"==typeof t?e.ord(t):t).toString(2).padStart(r,"0")}},{key:"printable",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return arguments.length>2&&void 0!==arguments[2]&&arguments[2]?t.replace(/[^\x20-\x7f]/g,"."):(t=t.replace(/[\0-\x08\x0B-\x0C\x0E-\x1F\x7F-\x9F\xAD\u0378\u0379\u037F-\u0383\u038B\u038D\u03A2\u0528-\u0530\u0557\u0558\u0560\u0588\u058B-\u058E\u0590\u05C8-\u05CF\u05EB-\u05EF\u05F5-\u0605\u061C\u061D\u06DD\u070E\u070F\u074B\u074C\u07B2-\u07BF\u07FB-\u07FF\u082E\u082F\u083F\u085C\u085D\u085F-\u089F\u08A1\u08AD-\u08E3\u08FF\u0978\u0980\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA\u09BB\u09C5\u09C6\u09C9\u09CA\u09CF-\u09D6\u09D8-\u09DB\u09DE\u09E4\u09E5\u09FC-\u0A00\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A\u0A3B\u0A3D\u0A43-\u0A46\u0A49\u0A4A\u0A4E-\u0A50\u0A52-\u0A58\u0A5D\u0A5F-\u0A65\u0A76-\u0A80\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA\u0ABB\u0AC6\u0ACA\u0ACE\u0ACF\u0AD1-\u0ADF\u0AE4\u0AE5\u0AF2-\u0B00\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A\u0B3B\u0B45\u0B46\u0B49\u0B4A\u0B4E-\u0B55\u0B58-\u0B5B\u0B5E\u0B64\u0B65\u0B78-\u0B81\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BBD\u0BC3-\u0BC5\u0BC9\u0BCE\u0BCF\u0BD1-\u0BD6\u0BD8-\u0BE5\u0BFB-\u0C00\u0C04\u0C0D\u0C11\u0C29\u0C34\u0C3A-\u0C3C\u0C45\u0C49\u0C4E-\u0C54\u0C57\u0C5A-\u0C5F\u0C64\u0C65\u0C70-\u0C77\u0C80\u0C81\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA\u0CBB\u0CC5\u0CC9\u0CCE-\u0CD4\u0CD7-\u0CDD\u0CDF\u0CE4\u0CE5\u0CF0\u0CF3-\u0D01\u0D04\u0D0D\u0D11\u0D3B\u0D3C\u0D45\u0D49\u0D4F-\u0D56\u0D58-\u0D5F\u0D64\u0D65\u0D76-\u0D78\u0D80\u0D81\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0DC9\u0DCB-\u0DCE\u0DD5\u0DD7\u0DE0-\u0DF1\u0DF5-\u0E00\u0E3B-\u0E3E\u0E5C-\u0E80\u0E83\u0E85\u0E86\u0E89\u0E8B\u0E8C\u0E8E-\u0E93\u0E98\u0EA0\u0EA4\u0EA6\u0EA8\u0EA9\u0EAC\u0EBA\u0EBE\u0EBF\u0EC5\u0EC7\u0ECE\u0ECF\u0EDA\u0EDB\u0EE0-\u0EFF\u0F48\u0F6D-\u0F70\u0F98\u0FBD\u0FCD\u0FDB-\u0FFF\u10C6\u10C8-\u10CC\u10CE\u10CF\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B\u135C\u137D-\u137F\u139A-\u139F\u13F5-\u13FF\u169D-\u169F\u16F1-\u16FF\u170D\u1715-\u171F\u1737-\u173F\u1754-\u175F\u176D\u1771\u1774-\u177F\u17DE\u17DF\u17EA-\u17EF\u17FA-\u17FF\u180F\u181A-\u181F\u1878-\u187F\u18AB-\u18AF\u18F6-\u18FF\u191D-\u191F\u192C-\u192F\u193C-\u193F\u1941-\u1943\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19CF\u19DB-\u19DD\u1A1C\u1A1D\u1A5F\u1A7D\u1A7E\u1A8A-\u1A8F\u1A9A-\u1A9F\u1AAE-\u1AFF\u1B4C-\u1B4F\u1B7D-\u1B7F\u1BF4-\u1BFB\u1C38-\u1C3A\u1C4A-\u1C4C\u1C80-\u1CBF\u1CC8-\u1CCF\u1CF7-\u1CFF\u1DE7-\u1DFB\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FC5\u1FD4\u1FD5\u1FDC\u1FF0\u1FF1\u1FF5\u1FFF\u200B-\u200F\u202A-\u202E\u2060-\u206F\u2072\u2073\u208F\u209D-\u209F\u20BB-\u20CF\u20F1-\u20FF\u218A-\u218F\u23F4-\u23FF\u2427-\u243F\u244B-\u245F\u2700\u2B4D-\u2B4F\u2B5A-\u2BFF\u2C2F\u2C5F\u2CF4-\u2CF8\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D71-\u2D7E\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF\u2E3C-\u2E7F\u2E9A\u2EF4-\u2EFF\u2FD6-\u2FEF\u2FFC-\u2FFF\u3040\u3097\u3098\u3100-\u3104\u312E-\u3130\u318F\u31BB-\u31BF\u31E4-\u31EF\u321F\u32FF\u4DB6-\u4DBF\u9FCD-\u9FFF\uA48D-\uA48F\uA4C7-\uA4CF\uA62C-\uA63F\uA698-\uA69E\uA6F8-\uA6FF\uA78F\uA794-\uA79F\uA7AB-\uA7F7\uA82C-\uA82F\uA83A-\uA83F\uA878-\uA87F\uA8C5-\uA8CD\uA8DA-\uA8DF\uA8FC-\uA8FF\uA954-\uA95E\uA97D-\uA97F\uA9CE\uA9DA-\uA9DD\uA9E0-\uA9FF\uAA37-\uAA3F\uAA4E\uAA4F\uAA5A\uAA5B\uAA7C-\uAA7F\uAAC3-\uAADA\uAAF7-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F-\uABBF\uABEE\uABEF\uABFA-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uD7FF\uE000-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBC2-\uFBD2\uFD40-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFE\uFDFF\uFE1A-\uFE1F\uFE27-\uFE2F\uFE53\uFE67\uFE6C-\uFE6F\uFE75\uFEFD-\uFF00\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFDF\uFFE7\uFFEF-\uFFFB\uFFFE\uFFFF]/g,"."),e||(t=t.replace(/[\x09-\x10\u2028\u2029]/g,".")),t)}},{key:"escapeWhitespace",value:function(t){return t.replace(/[\x09-\x10]/g,(function(t){return String.fromCharCode(57344+t.charCodeAt(0))}))}},{key:"parseEscapedChars",value:function(t){return t.replace(/\\([abfnrtv'"]|[0-3][0-7]{2}|[0-7]{1,2}|x[\da-fA-F]{2}|u[\da-fA-F]{4}|u\{[\da-fA-F]{1,6}\}|\\)/g,(function(t,e){switch(e[0]){case"\\":return"\\";case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":return String.fromCharCode(parseInt(e,8));case"a":return String.fromCharCode(7);case"b":return"\b";case"t":return"\t";case"n":return"\n";case"v":return"\v";case"f":return"\f";case"r":return"\r";case'"':return'"';case"'":return"'";case"x":return String.fromCharCode(parseInt(e.substr(1),16));case"u":return"{"===e[1]?String.fromCodePoint(parseInt(e.slice(2,-1),16)):String.fromCharCode(parseInt(e.substr(1),16))}}))}},{key:"escapeRegex",value:function(t){return t.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}},{key:"expandAlphRange",value:function(t){for(var r=[],n=0;n<t.length;n++)if(n<t.length-2&&"-"===t[n+1]&&"\\"!==t[n]){for(var i=e.ord(t[n]),s=e.ord(t[n+2]),a=i;a<=s;a++)r.push(e.chr(a));n+=2}else n<t.length-2&&"\\"===t[n]&&"-"===t[n+1]?(r.push("-"),n++):r.push(t[n]);return r}},{key:"convertToByteArray",value:function(t,r){switch(r.toLowerCase()){case"binary":return N(t);case"hex":return F(t);case"decimal":return R(t);case"base64":return I(t,null,"byteArray");case"utf8":return e.strToUtf8ByteArray(t);default:return e.strToByteArray(t)}}},{key:"convertToByteString",value:function(t,r){switch(r.toLowerCase()){case"binary":return e.byteArrayToChars(N(t));case"hex":return e.byteArrayToChars(F(t));case"decimal":return e.byteArrayToChars(R(t));case"base64":return e.byteArrayToChars(I(t,null,"byteArray"));case"utf8":return C().encode(t);default:return t}}},{key:"byteArrayToInt",value:function(t,e){var r=0;if("big"===e)for(var n=0;n<t.length;n++)r=256*r+t[n];else for(var i=t.length-1;i>=0;i--)r=256*r+t[i];return r}},{key:"intToByteArray",value:function(t,e,r){var n=new Array(e);if("little"===r)for(var i=0;i<e;i++)n[i]=255&t,t>>>=8;else for(var s=e-1;s>=0;s--)n[s]=255&t,t>>>=8;return n}},{key:"strToArrayBuffer",value:function(t){if(S().debug(`Converting string[${null==t?void 0:t.length}] to array buffer`),!t)return new ArrayBuffer;for(var r,n=new Uint8Array(t.length),i=t.length;i--;)if(r=t.charCodeAt(i),n[i]=r,r>255)return e.strToUtf8ArrayBuffer(t);return n.buffer}},{key:"strToUtf8ArrayBuffer",value:function(t){if(S().debug(`Converting string[${null==t?void 0:t.length}] to UTF8 array buffer`),!t)return new ArrayBuffer;var e=new TextEncoder("utf-8").encode(t);return t.length!==e.length&&(_()&&self&&"function"==typeof self.setOption?self.setOption("attemptHighlight",!1):O()&&(window.app.options.attemptHighlight=!1)),e.buffer}},{key:"strToByteArray",value:function(t){if(S().debug(`Converting string[${null==t?void 0:t.length}] to byte array`),!t)return[];for(var r,n=new Array(t.length),i=t.length;i--;)if(r=t.charCodeAt(i),n[i]=r,r>255)return e.strToUtf8ByteArray(t);return n}},{key:"strToUtf8ByteArray",value:function(t){if(S().debug(`Converting string[${null==t?void 0:t.length}] to UTF8 byte array`),!t)return[];var r=C().encode(t);return t.length!==r.length&&(_()?self.setOption("attemptHighlight",!1):O()&&(window.app.options.attemptHighlight=!1)),e.strToByteArray(r)}},{key:"strToCharcode",value:function(t){if(S().debug(`Converting string[${null==t?void 0:t.length}] to charcode`),!t)return[];for(var r=[],n=0;n<t.length;n++){var i=t.charCodeAt(n);if(n<t.length-1&&i>=55296&&i<56320){var s=t[n+1].charCodeAt(0);s>=56320&&s<57344&&(i=e.ord(t[n]+t[++n]))}r.push(i)}return r}},{key:"byteArrayToUtf8",value:function(t){var r;if(S().debug(`Converting byte array[${null===(r=t)||void 0===r?void 0:r.length}] to UTF8`),!t||!t.length)return"";t instanceof Uint8Array||(t=new Uint8Array(t));try{var n=new TextDecoder("utf-8",{fatal:!0}).decode(t);return n.length!==t.length&&(_()?self.setOption("attemptHighlight",!1):O()&&(window.app.options.attemptHighlight=!1)),n}catch(r){return e.byteArrayToChars(t)}}},{key:"byteArrayToChars",value:function(t){if(S().debug(`Converting byte array[${null==t?void 0:t.length}] to chars`),!t||!t.length)return"";for(var e="",r=0;r<t.length;r+=2e4)e+=String.fromCharCode.apply(String,m(t.slice(r,r+2e4)));return e}},{key:"arrayBufferToStr",value:function(t){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1];if(S().debug(`Converting array buffer[${null==t?void 0:t.byteLength}] to str`),!t||!t.byteLength)return"";var n=new Uint8Array(t);return r?e.byteArrayToUtf8(n):e.byteArrayToChars(n)}},{key:"calculateShannonEntropy",value:function(t){t instanceof ArrayBuffer&&(t=new Uint8Array(t));var e,r=[],n=new Array(256).fill(0);for(e=0;e<t.length;e++)n[t[e]]++;for(e=0;e<n.length;e++)n[e]>0&&r.push(n[e]/t.length);var i,s=0;for(e=0;e<r.length;e++)s+=(i=r[e])*Math.log(i)/Math.log(2);return-s}},{key:"parseCSV",value:function(t){var e,r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[","],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:["\n","\r"],s=!1,a=!1,o="",u=[],c=[];t.length&&"\ufeff"===t[0]&&(t=t.substr(1));for(var l=0;l<t.length;l++)e=t[l],r=t[l+1]||"",s?(o+=e,s=!1):'"'!==e||a?'"'===e&&a?'"'===r?s=!0:a=!1:!a&&n.indexOf(e)>=0?(u.push(o),o=""):!a&&i.indexOf(e)>=0?(u.push(o),o="",c.push(u),u=[],i.indexOf(r)>=0&&r!==e&&l++):o+=e:a=!0;return u.length&&(u.push(o),c.push(u)),c}},{key:"stripHtmlTags",value:function(t){function e(t,r){var n=r.replace(t,"");return n.length===r.length?n:e(t,n)}return arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&(t=e(/<script[^>]*>(\s|\S)*?<\/script[^>]*>/gi,t),t=e(/<style[^>]*>(\s|\S)*?<\/style[^>]*>/gi,t)),e(/<[^>]+>/g,t)}},{key:"escapeHtml",value:function(t){var e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;","\0":""};return t?t.replace(/[&<>"'`\u0000]/g,(function(t){return e[t]})):t}},{key:"unescapeHtml",value:function(t){var e={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#x27;":"'","&#x2F;":"/","&#x60;":"`","":"\0"};return t.replace(/(&#?x?[a-z0-9]{2,4};|\ue000)/gi,(function(t){return e[t]||t}))}},{key:"toTitleCase",value:function(t){return t.replace(/\w\S*/g,(function(t){return t.charAt(0).toUpperCase()+t.substr(1).toLowerCase()}))}},{key:"encodeURIFragment",value:function(t){var e={"%2D":"-","%2E":".","%5F":"_","%7E":"~","%21":"!","%24":"$","%27":"'","%28":"(","%29":")","%2A":"*","%2C":",","%3B":";","%3A":":","%40":"@","%2F":"/","%3F":"?"};return(t=encodeURIComponent(t)).replace(/%[0-9A-F]{2}/g,(function(t){return e[t]||t}))}},{key:"generatePrettyRecipe",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r="",n="",i="",s="",a="";return t.forEach((function(t){n=t.op.replace(/ /g,"_"),i=JSON.stringify(t.args).slice(1,-1).replace(/'/g,"\\'").replace(/"((?:[^"\\]|\\.)*)"/g,"'$1'").replace(/\\"/g,'"'),s=t.disabled?"/disabled":"",a=t.breakpoint?"/breakpoint":"",r+=`${n}(${i}${s}${a})`,e&&(r+="\n")})),r}},{key:"parseRecipeConfig",value:function(t){if(0===(t=t.trim()).length)return[];if("["===t[0])return JSON.parse(t);var e,r;t=t.replace(/\n/g,"");for(var n=/([^(]+)\(((?:'[^'\\]*(?:\\.[^'\\]*)*'|[^)/'])*)(\/[^)]+)?\)/g,i=[];e=n.exec(t);){r="["+(r=e[2].replace(/"/g,'\\"').replace(/(^|,|{|:)'/g,'$1"').replace(/([^\\]|(?:\\\\)+)'(,|:|}|$)/g,'$1"$2').replace(/\\'/g,"'"))+"]";var s={op:e[1].replace(/_/g," "),args:JSON.parse(r)};e[3]&&e[3].indexOf("disabled")>0&&(s.disabled=!0),e[3]&&e[3].indexOf("breakpoint")>0&&(s.breakpoint=!0),i.push(s)}return i}},{key:"displayFilesAsHTML",value:(r=p(g().mark((function t(r){var n,i,s,a,o;return g().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=function(t){return`<div class='card' style='white-space: normal;'>\n <div class='card-header'>\n <h6 class="mb-0">\n ${e.escapeHtml(t.name)}\n </h6>\n </div>\n </div>`},i=function(t,r){if(r.startsWith("image")){var n="data:";return n+=r+";","<img style='max-width: 100%;' src='"+(n+="base64,"+B(t))+"'>"}return`<pre>${e.escapeHtml(e.arrayBufferToStr(t.buffer))}</pre>`},s=function(){var t=p(g().mark((function t(r,n){var s,a,o,u;return g().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.readFile(r);case 2:return s=t.sent,a=new Blob([s],{type:r.type||"octet/stream"}),o=URL.createObjectURL(a),u=`<div class='card' style='white-space: normal;'>\n <div class='card-header' id='heading${n}'>\n <h6 class='mb-0'>\n <a class='collapsed'\n data-toggle='collapse'\n href='#collapse${n}'\n aria-expanded='false'\n aria-controls='collapse${n}'\n title="Show/hide contents of '${e.escapeHtml(r.name)}'">\n ${e.escapeHtml(r.name)}</a>\n <span class='float-right' style="margin-top: -3px">\n ${r.size.toLocaleString()} bytes\n <a title="Download ${e.escapeHtml(r.name)}"\n href="${o}"\n download="${e.escapeHtml(r.name)}"\n data-toggle="tooltip">\n <i class="material-icons" style="vertical-align: bottom">save</i>\n </a>\n <a title="Move to input"\n href="#"\n blob-url="${o}"\n file-name="${e.escapeHtml(r.name)}"\n class="extract-file"\n data-toggle="tooltip">\n <i class="material-icons" style="vertical-align: bottom">open_in_browser</i>\n </a>\n </span>\n </h6>\n </div>\n <div id='collapse${n}' class='collapse' aria-labelledby='heading${n}' data-parent="#files">\n <div class='card-body'>\n ${i(s,r.type)}\n </div>\n </div>\n </div>`,t.abrupt("return",u);case 7:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),a=`<div style='padding: 5px; white-space: normal;'>\n ${r.length} file(s) found\n </div><div id="files" style="padding: 20px">`,o=0;case 5:if(!(o<r.length)){t.next=17;break}if(!r[o].name.endsWith("/")){t.next=10;break}a+=n(r[o]),t.next=14;break;case 10:return t.t0=a,t.next=13,s(r[o],o);case 13:a=t.t0+=t.sent;case 14:o++,t.next=5;break;case 17:return t.abrupt("return",a+="</div>");case 18:case"end":return t.stop()}}),t)}))),function(t){return r.apply(this,arguments)})},{key:"parseURIParams",value:function(t){if(""===t)return{};"?"!==t[0]&&"#"!==t[0]||(t=t.substr(1));for(var e=t.split("&"),r={},n=0;n<e.length;n++){var i=e[n].split("=");2!==i.length?r[e[n]]=!0:r[i[0]]=decodeURIComponent(i[1].replace(/\+/g," "))}return r}},{key:"readFile",value:function(t){return L()?D.from(t).buffer:new Promise((function(e,r){var n=new FileReader,i=new Uint8Array(t.size),s=0,a=10485760,o=function(){if(s>=t.size)e(i);else{var r=t.slice(s,s+a);n.readAsArrayBuffer(r)}};n.onload=function(t){i.set(new Uint8Array(n.result),s),s+=a,o()},n.onerror=function(t){r(n.error.message)},o()}))}},{key:"readFileSync",value:function(t){if(!L())throw new TypeError("Browser environment cannot support readFileSync");return Uint8Array.from(t.data).buffer}},{key:"mod",value:function(t,e){return(t%e+e)%e}},{key:"gcd",value:function(t,r){return r?e.gcd(r,t%r):t}},{key:"modInv",value:function(t,e){t%=e;for(var r=1;r<e;r++)if(t*r%26==1)return r}},{key:"charRep",value:function(t){return{Space:" ",Percent:"%",Comma:",","Semi-colon":";",Colon:":",Tab:"\t","Line feed":"\n",CRLF:"\r\n","Forward slash":"/",Backslash:"\\","0x":"0x","\\x":"\\x","Nothing (separate chars)":"",None:""}[t]}},{key:"regexRep",value:function(t){return{Space:/\s+/g,Percent:/%/g,Comma:/,/g,"Semi-colon":/;/g,Colon:/:/g,"Line feed":/\n/g,CRLF:/\r\n/g,"Forward slash":/\//g,Backslash:/\\/g,"0x with comma":/,?0x/g,"0x":/0x/g,"\\x":/\\x/g,None:/\s+/g}[t]}},{key:"chunked",value:g().mark((function t(e,r){var n,i,s,a;return g().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=e[Symbol.iterator]();case 1:i=[],s=0;case 4:if(!(s<r)){t.next=12;break}if(!(a=n.next()).done){t.next=8;break}return t.abrupt("break",12);case 8:i.push(a.value);case 9:s++,t.next=4;break;case 12:if(!i.length){t.next=17;break}return t.next=15,i;case 15:t.next=18;break;case 17:return t.abrupt("return");case 18:t.next=1;break;case 20:case"end":return t.stop()}}),t)}))}]),e}();function L(){return void 0!==P&&null!=P.versions&&null!=P.versions.node}function O(){return"object"==typeof window}function _(){return"function"==typeof importScripts}const U=k;function V(t,e,r){return e=u(e),o(t,H()?Reflect.construct(e,r||[],u(t).constructor):e.apply(t,r))}function H(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(H=function(){return!!t})()}Array.prototype.unique=function(){for(var t={},e=[],r=0,n=this.length;r<n;r++)Object.prototype.hasOwnProperty.call(t,this[r])||(e.push(this[r]),t[this[r]]=1);return e},Array.prototype.max=function(){return Math.max.apply(null,this)},Array.prototype.min=function(){return Math.min.apply(null,this)},Array.prototype.sum=function(){return this.reduce((function(t,e){return t+e}),0)},Array.prototype.equals=function(t){if(!t)return!1;var e=this.length;if(e!==t.length)return!1;for(;e--;)if(this[e]!==t[e])return!1;return!0},String.prototype.count=function(t){return this.split(t).length-1},String.prototype.padStart||(String.prototype.padStart=function(t,e){return t>>=0,e=String(void 0!==e?e:" "),this.length>t?String(this):((t-=this.length)>e.length&&(e+=e.repeat(t/e.length)),e.slice(0,t)+String(this))}),String.prototype.padEnd||(String.prototype.padEnd=function(t,e){return t>>=0,e=String(void 0!==e?e:" "),this.length>t?String(this):((t-=this.length)>e.length&&(e+=e.repeat(t/e.length)),String(this)+e.slice(0,t))});const K=function(e){function r(){var e;t(this,r);for(var n=arguments.length,i=new Array(n),s=0;s<n;s++)i[s]=arguments[s];return(e=V(this,r,[].concat(i))).type="DishError",Error.captureStackTrace&&Error.captureStackTrace(a(e),r),e}return l(r,e),s(r)}(function(t){function e(){var e=Reflect.construct(t,Array.from(arguments));return Object.setPrototypeOf(e,Object.getPrototypeOf(this)),e}return e.prototype=Object.create(t.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t,e}(Error));var j=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,M=Math.ceil,q=Math.floor,G="[BigNumber Error] ",z=G+"Number primitive has more than 15 significant digits: ",W=1e14,$=14,Y=9007199254740991,Q=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],X=1e7,J=1e9;function Z(t){var e=0|t;return t>0||t===e?e:e-1}function tt(t){for(var e,r,n=1,i=t.length,s=t[0]+"";n<i;){for(e=t[n++]+"",r=$-e.length;r--;e="0"+e);s+=e}for(i=s.length;48===s.charCodeAt(--i););return s.slice(0,i+1||1)}function et(t,e){var r,n,i=t.c,s=e.c,a=t.s,o=e.s,u=t.e,c=e.e;if(!a||!o)return null;if(r=i&&!i[0],n=s&&!s[0],r||n)return r?n?0:-o:a;if(a!=o)return a;if(r=a<0,n=u==c,!i||!s)return n?0:!i^r?1:-1;if(!n)return u>c^r?1:-1;for(o=(u=i.length)<(c=s.length)?u:c,a=0;a<o;a++)if(i[a]!=s[a])return i[a]>s[a]^r?1:-1;return u==c?0:u>c^r?1:-1}function rt(t,e,r,n){if(t<e||t>r||t!==q(t))throw Error(G+(n||"Argument")+("number"==typeof t?t<e||t>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function nt(t){var e=t.c.length-1;return Z(t.e/$)==e&&t.c[e]%2!=0}function it(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function st(t,e,r){var n,i;if(e<0){for(i=r+".";++e;i+=r);t=i+t}else if(++e>(n=t.length)){for(i=r,e-=n;--e;i+=r);t+=i}else e<n&&(t=t.slice(0,e)+"."+t.slice(e));return t}var at=function t(e){var r,n,i,s,a,o,u,c,l,h,f=B.prototype={constructor:B,toString:null,valueOf:null},p=new B(1),d=20,g=4,y=-7,v=21,m=-1e7,E=1e7,S=!1,b=1,C=0,A={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},w="0123456789abcdefghijklmnopqrstuvwxyz",x=!0;function B(t,e){var r,s,a,o,u,c,l,h,f=this;if(!(f instanceof B))return new B(t,e);if(null==e){if(t&&!0===t._isBigNumber)return f.s=t.s,void(!t.c||t.e>E?f.c=f.e=null:t.e<m?f.c=[f.e=0]:(f.e=t.e,f.c=t.c.slice()));if((c="number"==typeof t)&&0*t==0){if(f.s=1/t<0?(t=-t,-1):1,t===~~t){for(o=0,u=t;u>=10;u/=10,o++);return void(o>E?f.c=f.e=null:(f.e=o,f.c=[t]))}h=String(t)}else{if(!j.test(h=String(t)))return i(f,h,c);f.s=45==h.charCodeAt(0)?(h=h.slice(1),-1):1}(o=h.indexOf("."))>-1&&(h=h.replace(".","")),(u=h.search(/e/i))>0?(o<0&&(o=u),o+=+h.slice(u+1),h=h.substring(0,u)):o<0&&(o=h.length)}else{if(rt(e,2,w.length,"Base"),10==e&&x)return R(f=new B(t),d+f.e+1,g);if(h=String(t),c="number"==typeof t){if(0*t!=0)return i(f,h,c,e);if(f.s=1/t<0?(h=h.slice(1),-1):1,B.DEBUG&&h.replace(/^0\.0*|\./,"").length>15)throw Error(z+t)}else f.s=45===h.charCodeAt(0)?(h=h.slice(1),-1):1;for(r=w.slice(0,e),o=u=0,l=h.length;u<l;u++)if(r.indexOf(s=h.charAt(u))<0){if("."==s){if(u>o){o=l;continue}}else if(!a&&(h==h.toUpperCase()&&(h=h.toLowerCase())||h==h.toLowerCase()&&(h=h.toUpperCase()))){a=!0,u=-1,o=0;continue}return i(f,String(t),c,e)}c=!1,(o=(h=n(h,e,10,f.s)).indexOf("."))>-1?h=h.replace(".",""):o=h.length}for(u=0;48===h.charCodeAt(u);u++);for(l=h.length;48===h.charCodeAt(--l););if(h=h.slice(u,++l)){if(l-=u,c&&B.DEBUG&&l>15&&(t>Y||t!==q(t)))throw Error(z+f.s*t);if((o=o-u-1)>E)f.c=f.e=null;else if(o<m)f.c=[f.e=0];else{if(f.e=o,f.c=[],u=(o+1)%$,o<0&&(u+=$),u<l){for(u&&f.c.push(+h.slice(0,u)),l-=$;u<l;)f.c.push(+h.slice(u,u+=$));u=$-(h=h.slice(u)).length}else u-=l;for(;u--;h+="0");f.c.push(+h)}}else f.c=[f.e=0]}function I(t,e,r,n){var i,s,a,o,u;if(null==r?r=g:rt(r,0,8),!t.c)return t.toString();if(i=t.c[0],a=t.e,null==e)u=tt(t.c),u=1==n||2==n&&(a<=y||a>=v)?it(u,a):st(u,a,"0");else if(s=(t=R(new B(t),e,r)).e,o=(u=tt(t.c)).length,1==n||2==n&&(e<=s||s<=y)){for(;o<e;u+="0",o++);u=it(u,s)}else if(e-=a,u=st(u,s,"0"),s+1>o){if(--e>0)for(u+=".";e--;u+="0");}else if((e+=s-o)>0)for(s+1==o&&(u+=".");e--;u+="0");return t.s<0&&i?"-"+u:u}function T(t,e){for(var r,n,i=1,s=new B(t[0]);i<t.length;i++)(!(n=new B(t[i])).s||(r=et(s,n))===e||0===r&&s.s===e)&&(s=n);return s}function F(t,e,r){for(var n=1,i=e.length;!e[--i];e.pop());for(i=e[0];i>=10;i/=10,n++);return(r=n+r*$-1)>E?t.c=t.e=null:r<m?t.c=[t.e=0]:(t.e=r,t.c=e),t}function R(t,e,r,n){var i,s,a,o,u,c,l,h=t.c,f=Q;if(h){t:{for(i=1,o=h[0];o>=10;o/=10,i++);if((s=e-i)<0)s+=$,a=e,u=h[c=0],l=q(u/f[i-a-1]%10);else if((c=M((s+1)/$))>=h.length){if(!n)break t;for(;h.length<=c;h.push(0));u=l=0,i=1,a=(s%=$)-$+1}else{for(u=o=h[c],i=1;o>=10;o/=10,i++);l=(a=(s%=$)-$+i)<0?0:q(u/f[i-a-1]%10)}if(n=n||e<0||null!=h[c+1]||(a<0?u:u%f[i-a-1]),n=r<4?(l||n)&&(0==r||r==(t.s<0?3:2)):l>5||5==l&&(4==r||n||6==r&&(s>0?a>0?u/f[i-a]:0:h[c-1])%10&1||r==(t.s<0?8:7)),e<1||!h[0])return h.length=0,n?(e-=t.e+1,h[0]=f[($-e%$)%$],t.e=-e||0):h[0]=t.e=0,t;if(0==s?(h.length=c,o=1,c--):(h.length=c+1,o=f[$-s],h[c]=a>0?q(u/f[i-a]%f[a])*o:0),n)for(;;){if(0==c){for(s=1,a=h[0];a>=10;a/=10,s++);for(a=h[0]+=o,o=1;a>=10;a/=10,o++);s!=o&&(t.e++,h[0]==W&&(h[0]=1));break}if(h[c]+=o,h[c]!=W)break;h[c--]=0,o=1}for(s=h.length;0===h[--s];h.pop());}t.e>E?t.c=t.e=null:t.e<m&&(t.c=[t.e=0])}return t}function N(t){var e,r=t.e;return null===r?t.toString():(e=tt(t.c),e=r<=y||r>=v?it(e,r):st(e,r,"0"),t.s<0?"-"+e:e)}return B.clone=t,B.ROUND_UP=0,B.ROUND_DOWN=1,B.ROUND_CEIL=2,B.ROUND_FLOOR=3,B.ROUND_HALF_UP=4,B.ROUND_HALF_DOWN=5,B.ROUND_HALF_EVEN=6,B.ROUND_HALF_CEIL=7,B.ROUND_HALF_FLOOR=8,B.EUCLID=9,B.config=B.set=function(t){var e,r;if(null!=t){if("object"!=typeof t)throw Error(G+"Object expected: "+t);if(t.hasOwnProperty(e="DECIMAL_PLACES")&&(rt(r=t[e],0,J,e),d=r),t.hasOwnProperty(e="ROUNDING_MODE")&&(rt(r=t[e],0,8,e),g=r),t.hasOwnProperty(e="EXPONENTIAL_AT")&&((r=t[e])&&r.pop?(rt(r[0],-J,0,e),rt(r[1],0,J,e),y=r[0],v=r[1]):(rt(r,-J,J,e),y=-(v=r<0?-r:r))),t.hasOwnProperty(e="RANGE"))if((r=t[e])&&r.pop)rt(r[0],-J,-1,e),rt(r[1],1,J,e),m=r[0],E=r[1];else{if(rt(r,-J,J,e),!r)throw Error(G+e+" cannot be zero: "+r);m=-(E=r<0?-r:r)}if(t.hasOwnProperty(e="CRYPTO")){if((r=t[e])!==!!r)throw Error(G+e+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw S=!r,Error(G+"crypto unavailable");S=r}else S=r}if(t.hasOwnProperty(e="MODULO_MODE")&&(rt(r=t[e],0,9,e),b=r),t.hasOwnProperty(e="POW_PRECISION")&&(rt(r=t[e],0,J,e),C=r),t.hasOwnProperty(e="FORMAT")){if("object"!=typeof(r=t[e]))throw Error(G+e+" not an object: "+r);A=r}if(t.hasOwnProperty(e="ALPHABET")){if("string"!=typeof(r=t[e])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(G+e+" invalid: "+r);x="0123456789"==r.slice(0,10),w=r}}return{DECIMAL_PLACES:d,ROUNDING_MODE:g,EXPONENTIAL_AT:[y,v],RANGE:[m,E],CRYPTO:S,MODULO_MODE:b,POW_PRECISION:C,FORMAT:A,ALPHABET:w}},B.isBigNumber=function(t){if(!t||!0!==t._isBigNumber)return!1;if(!B.DEBUG)return!0;var e,r,n=t.c,i=t.e,s=t.s;t:if("[object Array]"=={}.toString.call(n)){if((1===s||-1===s)&&i>=-J&&i<=J&&i===q(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break t}if((e=(i+1)%$)<1&&(e+=$),String(n[0]).length==e){for(e=0;e<n.length;e++)if((r=n[e])<0||r>=W||r!==q(r))break t;if(0!==r)return!0}}}else if(null===n&&null===i&&(null===s||1===s||-1===s))return!0;throw Error(G+"Invalid BigNumber: "+t)},B.maximum=B.max=function(){return T(arguments,-1)},B.minimum=B.min=function(){return T(arguments,1)},B.random=(s=9007199254740992,a=Math.random()*s&2097151?function(){return q(Math.random()*s)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(t){var e,r,n,i,s,o=0,u=[],c=new B(p);if(null==t?t=d:rt(t,0,J),i=M(t/$),S)if(crypto.getRandomValues){for(e=crypto.getRandomValues(new Uint32Array(i*=2));o<i;)(s=131072*e[o]+(e[o+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),e[o]=r[0],e[o+1]=r[1]):(u.push(s%1e14),o+=2);o=i/2}else{if(!crypto.randomBytes)throw S=!1,Error(G+"crypto unavailable");for(e=crypto.randomBytes(i*=7);o<i;)(s=281474976710656*(31&e[o])+1099511627776*e[o+1]+4294967296*e[o+2]+16777216*e[o+3]+(e[o+4]<<16)+(e[o+5]<<8)+e[o+6])>=9e15?crypto.randomBytes(7).copy(e,o):(u.push(s%1e14),o+=7);o=i/7}if(!S)for(;o<i;)(s=a())<9e15&&(u[o++]=s%1e14);for(i=u[--o],t%=$,i&&t&&(s=Q[$-t],u[o]=q(i/s)*s);0===u[o];u.pop(),o--);if(o<0)u=[n=0];else{for(n=-1;0===u[0];u.splice(0,1),n-=$);for(o=1,s=u[0];s>=10;s/=10,o++);o<$&&(n-=$-o)}return c.e=n,c.c=u,c}),B.sum=function(){for(var t=1,e=arguments,r=new B(e[0]);t<e.length;)r=r.plus(e[t++]);return r},n=function(){var t="0123456789";function e(t,e,r,n){for(var i,s,a=[0],o=0,u=t.length;o<u;){for(s=a.length;s--;a[s]*=e);for(a[0]+=n.indexOf(t.charAt(o++)),i=0;i<a.length;i++)a[i]>r-1&&(null==a[i+1]&&(a[i+1]=0),a[i+1]+=a[i]/r|0,a[i]%=r)}return a.reverse()}return function(n,i,s,a,o){var u,c,l,h,f,p,y,v,m=n.indexOf("."),E=d,S=g;for(m>=0&&(h=C,C=0,n=n.replace(".",""),p=(v=new B(i)).pow(n.length-m),C=h,v.c=e(st(tt(p.c),p.e,"0"),10,s,t),v.e=v.c.length),l=h=(y=e(n,i,s,o?(u=w,t):(u=t,w))).length;0==y[--h];y.pop());if(!y[0])return u.charAt(0);if(m<0?--l:(p.c=y,p.e=l,p.s=a,y=(p=r(p,v,E,S,s)).c,f=p.r,l=p.e),m=y[c=l+E+1],h=s/2,f=f||c<0||null!=y[c+1],f=S<4?(null!=m||f)&&(0==S||S==(p.s<0?3:2)):m>h||m==h&&(4==S||f||6==S&&1&y[c-1]||S==(p.s<0?8:7)),c<1||!y[0])n=f?st(u.charAt(1),-E,u.charAt(0)):u.charAt(0);else{if(y.length=c,f)for(--s;++y[--c]>s;)y[c]=0,c||(++l,y=[1].concat(y));for(h=y.length;!y[--h];);for(m=0,n="";m<=h;n+=u.charAt(y[m++]));n=st(n,l,u.charAt(0))}return n}}(),r=function(){function t(t,e,r){var n,i,s,a,o=0,u=t.length,c=e%X,l=e/X|0;for(t=t.slice();u--;)o=((i=c*(s=t[u]%X)+(n=l*s+(a=t[u]/X|0)*c)%X*X+o)/r|0)+(n/X|0)+l*a,t[u]=i%r;return o&&(t=[o].concat(t)),t}function e(t,e,r,n){var i,s;if(r!=n)s=r>n?1:-1;else for(i=s=0;i<r;i++)if(t[i]!=e[i]){s=t[i]>e[i]?1:-1;break}return s}function r(t,e,r,n){for(var i=0;r--;)t[r]-=i,i=t[r]<e[r]?1:0,t[r]=i*n+t[r]-e[r];for(;!t[0]&&t.length>1;t.splice(0,1));}return function(n,i,s,a,o){var u,c,l,h,f,p,d,g,y,v,m,E,S,b,C,A,w,x=n.s==i.s?1:-1,I=n.c,T=i.c;if(!(I&&I[0]&&T&&T[0]))return new B(n.s&&i.s&&(I?!T||I[0]!=T[0]:T)?I&&0==I[0]||!T?0*x:x/0:NaN);for(y=(g=new B(x)).c=[],x=s+(c=n.e-i.e)+1,o||(o=W,c=Z(n.e/$)-Z(i.e/$),x=x/$|0),l=0;T[l]==(I[l]||0);l++);if(T[l]>(I[l]||0)&&c--,x<0)y.push(1),h=!0;else{for(b=I.length,A=T.length,l=0,x+=2,(f=q(o/(T[0]+1)))>1&&(T=t(T,f,o),I=t(I,f,o),A=T.length,b=I.length),S=A,m=(v=I.slice(0,A)).length;m<A;v[m++]=0);w=T.slice(),w=[0].concat(w),C=T[0],T[1]>=o/2&&C++;do{if(f=0,(u=e(T,v,A,m))<0){if(E=v[0],A!=m&&(E=E*o+(v[1]||0)),(f=q(E/C))>1)for(f>=o&&(f=o-1),d=(p=t(T,f,o)).length,m=v.length;1==e(p,v,d,m);)f--,r(p,A<d?w:T,d,o),d=p.length,u=1;else 0==f&&(u=f=1),d=(p=T.slice()).length;if(d<m&&(p=[0].concat(p)),r(v,p,m,o),m=v.length,-1==u)for(;e(T,v,A,m)<1;)f++,r(v,A<m?w:T,m,o),m=v.length}else 0===u&&(f++,v=[0]);y[l++]=f,v[0]?v[m++]=I[S]||0:(v=[I[S]],m=1)}while((S++<b||null!=v[0])&&x--);h=null!=v[0],y[0]||y.splice(0,1)}if(o==W){for(l=1,x=y[0];x>=10;x/=10,l++);R(g,s+(g.e=l+c*$-1)+1,a,h)}else g.e=c,g.r=+h;return g}}(),o=/^(-?)0([xbo])(?=\w[\w.]*$)/i,u=/^([^.]+)\.$/,c=/^\.([^.]+)$/,l=/^-?(Infinity|NaN)$/,h=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(t,e,r,n){var i,s=r?e:e.replace(h,"");if(l.test(s))t.s=isNaN(s)?null:s<0?-1:1;else{if(!r&&(s=s.replace(o,(function(t,e,r){return i="x"==(r=r.toLowerCase())?16:"b"==r?2:8,n&&n!=i?t:e})),n&&(i=n,s=s.replace(u,"$1").replace(c,"0.$1")),e!=s))return new B(s,i);if(B.DEBUG)throw Error(G+"Not a"+(n?" base "+n:"")+" number: "+e);t.s=null}t.c=t.e=null},f.absoluteValue=f.abs=function(){var t=new B(this);return t.s<0&&(t.s=1),t},f.comparedTo=function(t,e){return et(this,new B(t,e))},f.decimalPlaces=f.dp=function(t,e){var r,n,i,s=this;if(null!=t)return rt(t,0,J),null==e?e=g:rt(e,0,8),R(new B(s),t+s.e+1,e);if(!(r=s.c))return null;if(n=((i=r.length-1)-Z(this.e/$))*$,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},f.dividedBy=f.div=function(t,e){return r(this,new B(t,e),d,g)},f.dividedToIntegerBy=f.idiv=function(t,e){return r(this,new B(t,e),0,1)},f.exponentiatedBy=f.pow=function(t,e){var r,n,i,s,a,o,u,c,l=this;if((t=new B(t)).c&&!t.isInteger())throw Error(G+"Exponent not an integer: "+N(t));if(null!=e&&(e=new B(e)),a=t.e>14,!l.c||!l.c[0]||1==l.c[0]&&!l.e&&1==l.c.length||!t.c||!t.c[0])return c=new B(Math.pow(+N(l),a?t.s*(2-nt(t)):+N(t))),e?c.mod(e):c;if(o=t.s<0,e){if(e.c?!e.c[0]:!e.s)return new B(NaN);(n=!o&&l.isInteger()&&e.isInteger())&&(l=l.mod(e))}else{if(t.e>9&&(l.e>0||l.e<-1||(0==l.e?l.c[0]>1||a&&l.c[1]>=24e7:l.c[0]<8e13||a&&l.c[0]<=9999975e7)))return s=l.s<0&&nt(t)?-0:0,l.e>-1&&(s=1/s),new B(o?1/s:s);C&&(s=M(C/$+2))}for(a?(r=new B(.5),o&&(t.s=1),u=nt(t)):u=(i=Math.abs(+N(t)))%2,c=new B(p);;){if(u){if(!(c=c.times(l)).c)break;s?c.c.length>s&&(c.c.length=s):n&&(c=c.mod(e))}if(i){if(0===(i=q(i/2)))break;u=i%2}else if(R(t=t.times(r),t.e+1,1),t.e>14)u=nt(t);else{if(0==(i=+N(t)))break;u=i%2}l=l.times(l),s?l.c&&l.c.length>s&&(l.c.length=s):n&&(l=l.mod(e))}return n?c:(o&&(c=p.div(c)),e?c.mod(e):s?R(c,C,g,void 0):c)},f.integerValue=function(t){var e=new B(this);return null==t?t=g:rt(t,0,8),R(e,e.e+1,t)},f.isEqualTo=f.eq=function(t,e){return 0===et(this,new B(t,e))},f.isFinite=function(){return!!this.c},f.isGreaterThan=f.gt=function(t,e){return et(this,new B(t,e))>0},f.isGreaterThanOrEqualTo=f.gte=function(t,e){return 1===(e=et(this,new B(t,e)))||0===e},f.isInteger=function(){return!!this.c&&Z(this.e/$)>this.c.length-2},f.isLessThan=f.lt=function(t,e){return et(this,new B(t,e))<0},f.isLessThanOrEqualTo=f.lte=function(t,e){return-1===(e=et(this,new B(t,e)))||0===e},f.isNaN=function(){return!this.s},f.isNegative=function(){return this.s<0},f.isPositive=function(){return this.s>0},f.isZero=function(){return!!this.c&&0==this.c[0]},f.minus=function(t,e){var r,n,i,s,a=this,o=a.s;if(e=(t=new B(t,e)).s,!o||!e)return new B(NaN);if(o!=e)return t.s=-e,a.plus(t);var u=a.e/$,c=t.e/$,l=a.c,h=t.c;if(!u||!c){if(!l||!h)return l?(t.s=-e,t):new B(h?a:NaN);if(!l[0]||!h[0])return h[0]?(t.s=-e,t):new B(l[0]?a:3==g?-0:0)}if(u=Z(u),c=Z(c),l=l.slice(),o=u-c){for((s=o<0)?(o=-o,i=l):(c=u,i=h),i.reverse(),e=o;e--;i.push(0));i.reverse()}else for(n=(s=(o=l.length)<(e=h.length))?o:e,o=e=0;e<n;e++)if(l[e]!=h[e]){s=l[e]<h[e];break}if(s&&(i=l,l=h,h=i,t.s=-t.s),(e=(n=h.length)-(r=l.length))>0)for(;e--;l[r++]=0);for(e=W-1;n>o;){if(l[--n]<h[n]){for(r=n;r&&!l[--r];l[r]=e);--l[r],l[n]+=W}l[n]-=h[n]}for(;0==l[0];l.splice(0,1),--c);return l[0]?F(t,l,c):(t.s=3==g?-1:1,t.c=[t.e=0],t)},f.modulo=f.mod=function(t,e){var n,i,s=this;return t=new B(t,e),!s.c||!t.s||t.c&&!t.c[0]?new B(NaN):!t.c||s.c&&!s.c[0]?new B(s):(9==b?(i=t.s,t.s=1,n=r(s,t,0,3),t.s=i,n.s*=i):n=r(s,t,0,b),(t=s.minus(n.times(t))).c[0]||1!=b||(t.s=s.s),t)},f.multipliedBy=f.times=function(t,e){var r,n,i,s,a,o,u,c,l,h,f,p,d,g,y,v=this,m=v.c,E=(t=new B(t,e)).c;if(!(m&&E&&m[0]&&E[0]))return!v.s||!t.s||m&&!m[0]&&!E||E&&!E[0]&&!m?t.c=t.e=t.s=null:(t.s*=v.s,m&&E?(t.c=[0],t.e=0):t.c=t.e=null),t;for(n=Z(v.e/$)+Z(t.e/$),t.s*=v.s,(u=m.length)<(h=E.length)&&(d=m,m=E,E=d,i=u,u=h,h=i),i=u+h,d=[];i--;d.push(0));for(g=W,y=X,i=h;--i>=0;){for(r=0,f=E[i]%y,p=E[i]/y|0,s=i+(a=u);s>i;)r=((c=f*(c=m[--a]%y)+(o=p*c+(l=m[a]/y|0)*f)%y*y+d[s]+r)/g|0)+(o/y|0)+p*l,d[s--]=c%g;d[s]=r}return r?++n:d.splice(0,1),F(t,d,n)},f.negated=function(){var t=new B(this);return t.s=-t.s||null,t},f.plus=function(t,e){var r,n=this,i=n.s;if(e=(t=new B(t,e)).s,!i||!e)return new B(NaN);if(i!=e)return t.s=-e,n.minus(t);var s=n.e/$,a=t.e/$,o=n.c,u=t.c;if(!s||!a){if(!o||!u)return new B(i/0);if(!o[0]||!u[0])return u[0]?t:new B(o[0]?n:0*i)}if(s=Z(s),a=Z(a),o=o.slice(),i=s-a){for(i>0?(a=s,r=u):(i=-i,r=o),r.reverse();i--;r.push(0));r.reverse()}for((i=o.length)-(e=u.length)<0&&(r=u,u=o,o=r,e=i),i=0;e;)i=(o[--e]=o[e]+u[e]+i)/W|0,o[e]=W===o[e]?0:o[e]%W;return i&&(o=[i].concat(o),++a),F(t,o,a)},f.precision=f.sd=function(t,e){var r,n,i,s=this;if(null!=t&&t!==!!t)return rt(t,1,J),null==e?e=g:rt(e,0,8),R(new B(s),t,e);if(!(r=s.c))return null;if(n=(i=r.length-1)*$+1,i=r[i]){for(;i%10==0;i/=10,n--);for(i=r[0];i>=10;i/=10,n++);}return t&&s.e+1>n&&(n=s.e+1),n},f.shiftedBy=function(t){return rt(t,-9007199254740991,Y),this.times("1e"+t)},f.squareRoot=f.sqrt=function(){var t,e,n,i,s,a=this,o=a.c,u=a.s,c=a.e,l=d+4,h=new B("0.5");if(1!==u||!o||!o[0])return new B(!u||u<0&&(!o||o[0])?NaN:o?a:1/0);if(0==(u=Math.sqrt(+N(a)))||u==1/0?(((e=tt(o)).length+c)%2==0&&(e+="0"),u=Math.sqrt(+e),c=Z((c+1)/2)-(c<0||c%2),n=new B(e=u==1/0?"5e"+c:(e=u.toExponential()).slice(0,e.indexOf("e")+1)+c)):n=new B(u+""),n.c[0])for((u=(c=n.e)+l)<3&&(u=0);;)if(s=n,n=h.times(s.plus(r(a,s,l,1))),tt(s.c).slice(0,u)===(e=tt(n.c)).slice(0,u)){if(n.e<c&&--u,"9999"!=(e=e.slice(u-3,u+1))&&(i||"4999"!=e)){+e&&(+e.slice(1)||"5"!=e.charAt(0))||(R(n,n.e+d+2,1),t=!n.times(n).eq(a));break}if(!i&&(R(s,s.e+d+2,0),s.times(s).eq(a))){n=s;break}l+=4,u+=4,i=1}return R(n,n.e+d+1,g,t)},f.toExponential=function(t,e){return null!=t&&(rt(t,0,J),t++),I(this,t,e,1)},f.toFixed=function(t,e){return null!=t&&(rt(t,0,J),t=t+this.e+1),I(this,t,e)},f.toFormat=function(t,e,r){var n,i=this;if(null==r)null!=t&&e&&"object"==typeof e?(r=e,e=null):t&&"object"==typeof t?(r=t,t=e=null):r=A;else if("object"!=typeof r)throw Error(G+"Argument not an object: "+r);if(n=i.toFixed(t,e),i.c){var s,a=n.split("."),o=+r.groupSize,u=+r.secondaryGroupSize,c=r.groupSeparator||"",l=a[0],h=a[1],f=i.s<0,p=f?l.slice(1):l,d=p.length;if(u&&(s=o,o=u,u=s,d-=s),o>0&&d>0){for(s=d%o||o,l=p.substr(0,s);s<d;s+=o)l+=c+p.substr(s,o);u>0&&(l+=c+p.slice(s)),f&&(l="-"+l)}n=h?l+(r.decimalSeparator||"")+((u=+r.fractionGroupSize)?h.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):h):l}return(r.prefix||"")+n+(r.suffix||"")},f.toFraction=function(t){var e,n,i,s,a,o,u,c,l,h,f,d,y=this,v=y.c;if(null!=t&&(!(u=new B(t)).isInteger()&&(u.c||1!==u.s)||u.lt(p)))throw Error(G+"Argument "+(u.isInteger()?"out of range: ":"not an integer: ")+N(u));if(!v)return new B(y);for(e=new B(p),l=n=new B(p),i=c=new B(p),d=tt(v),a=e.e=d.length-y.e-1,e.c[0]=Q[(o=a%$)<0?$+o:o],t=!t||u.comparedTo(e)>0?a>0?e:l:u,o=E,E=1/0,u=new B(d),c.c[0]=0;h=r(u,e,0,1),1!=(s=n.plus(h.times(i))).comparedTo(t);)n=i,i=s,l=c.plus(h.times(s=l)),c=s,e=u.minus(h.times(s=e)),u=s;return s=r(t.minus(n),i,0,1),c=c.plus(s.times(l)),n=n.plus(s.times(i)),c.s=l.s=y.s,f=r(l,i,a*=2,g).minus(y).abs().comparedTo(r(c,n,a,g).minus(y).abs())<1?[l,i]:[c,n],E=o,f},f.toNumber=function(){return+N(this)},f.toPrecision=function(t,e){return null!=t&&rt(t,1,J),I(this,t,e,2)},f.toString=function(t){var e,r=this,i=r.s,s=r.e;return null===s?i?(e="Infinity",i<0&&(e="-"+e)):e="NaN":(null==t?e=s<=y||s>=v?it(tt(r.c),s):st(tt(r.c),s,"0"):10===t&&x?e=st(tt((r=R(new B(r),d+s+1,g)).c),r.e,"0"):(rt(t,2,w.length,"Base"),e=n(st(tt(r.c),s,"0"),10,t,i,!0)),i<0&&r.c[0]&&(e="-"+e)),e},f.valueOf=f.toJSON=function(){return N(this)},f._isBigNumber=!0,f[Symbol.toStringTag]="BigNumber",f[Symbol.for("nodejs.util.inspect.custom")]=f.valueOf,null!=e&&B.set(e),B}();const ot=at;function ut(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var r=null==t?null:"undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(null!=r){var n,i,s,a,o=[],u=!0,c=!1;try{if(s=(r=r.call(t)).next,0===e){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=s.call(r)).done)&&(o.push(n.value),o.length!==e);u=!0);}catch(t){c=!0,i=t}finally{try{if(!u&&null!=r.return&&(a=r.return(),Object(a)!==a))return}finally{if(c)throw i}}return o}}(t,e)||v(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var ct=function(){function e(r){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:0,i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;t(this,e),this.bytes=r,this.length=this.bytes.length,this.position=n,this.bitPos=i}return s(e,[{key:"clone",value:function(){return new e(this.bytes,this.position,this.bitPos)}},{key:"getBytes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(!(this.position>this.length)){var e=null!==t?this.position+t:this.length,r=this.bytes.slice(this.position,e);return this.position=e,this.bitPos=0,r}}},{key:"readString",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1;if(!(this.position>this.length)){-1===t&&(t=this.length-this.position);for(var e="",r=this.position;r<this.position+t;r++){var n=this.bytes[r];if(0===n)break;e+=String.fromCharCode(n)}return this.position+=t,this.bitPos=0,e}}},{key:"readInt",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"be";if(!(this.position>this.length)){var r=0;if("be"===e)for(var n=this.position;n<this.position+t;n++)r<<=8,r|=this.bytes[n];else for(var i=this.position+t-1;i>=this.position;i--)r<<=8,r|=this.bytes[i];return this.position+=t,this.bitPos=0,r}}},{key:"readBits",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"be";if(!(this.position>this.length)){var r,n=0,i=0;for(n=this.bytes[this.position++]&(r=this.bitPos,"be"===e?(1<<8-r)-1:256-(1<<r)),"be"!==e&&(n>>>=this.bitPos),i=8-this.bitPos,this.bitPos=0;i<t;)"be"===e?n=n<<i|this.bytes[this.position++]:n|=this.bytes[this.position++]<<i,i+=8;if(i>t){var s=i-t;"be"===e?n>>>=s:n&=(1<<t)-1,i-=s,this.position--,this.bitPos=8-s}return n}}},{key:"continueUntil",value:function(t){if(!(this.position>this.length))if(this.bitPos=0,"number"!=typeof t){var e=t.length,r=t[e-1];this.position=e;for(var n,i=function(t,e){var r=new Array;return t.forEach((function(t,n){r[t]=e-n})),r}(t,e);this.position<this.length;){for(;this.position<this.length&&this.bytes[this.position++]!==r;);n=!0;for(var s=e-1;s>=0;s--)if(this.bytes[this.position-e+s]!==t[s]){n=!1,this.position+=i[t[s]];break}if(n){this.position-=e;break}}}else for(;++this.position<this.length&&this.bytes[this.position]!==t;);}},{key:"consumeWhile",value:function(t){for(;this.position<this.length&&this.bytes[this.position]===t;)this.position++;this.bitPos=0}},{key:"consumeIf",value:function(t){this.bytes[this.position]===t&&(this.position++,this.bitPos=0)}},{key:"moveForwardsBy",value:function(t){var e=this.position+t;if(e<0||e>this.length)throw new Error("Cannot move to position "+e+" in stream. Out of bounds.");this.position=e,this.bitPos=0}},{key:"moveBackwardsBy",value:function(t){var e=this.position-t;if(e<0||e>this.length)throw new Error("Cannot move to position "+e+" in stream. Out of bounds.");this.position=e,this.bitPos=0}},{key:"moveBackwardsByBits",value:function(t){if(t<=this.bitPos)this.bitPos-=t;else for(this.bitPos>0&&(t-=this.bitPos,this.bitPos=0);t>0;)this.moveBackwardsBy(1),this.bitPos=8,this.moveBackwardsByBits(t),t-=8}},{key:"moveTo",value:function(t){if(t<0||t>this.length)throw new Error("Cannot move to position "+t+" in stream. Out of bounds.");this.position=t,this.bitPos=0}},{key:"hasMore",value:function(){return this.position<this.length}},{key:"carve",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.position;return this.bitPos>0&&e++,this.bytes.slice(t,e)}}]),e}();function lt(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return ht(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ht(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,o=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){o=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(o)throw s}}}}function ht(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var ft={Images:[{name:"Joint Photographic Experts Group image",extension:"jpg,jpeg,jpe,thm,mpo",mime:"image/jpeg",description:"",signature:{0:255,1:216,2:255,3:[192,196,219,221,224,225,226,227,228,229,231,232,234,235,236,237,238,254]},extractor:function(t,e){for(var r=new ct(t.slice(e));r.hasMore();){var n=r.getBytes(2);if(255!==n[0])throw new Error(`Invalid marker while parsing JPEG at pos ${r.position}: ${n}`);var i=0;switch(n[1]){case 216:case 1:break;case 217:return r.carve();case 192:case 193:case 194:case 195:case 196:case 197:case 198:case 199:case 200:case 201:case 202:case 203:case 204:case 205:case 206:case 207:case 219:case 222:case 224:case 225:case 226:case 227:case 228:case 229:case 230:case 231:case 232:case 233:case 234:case 235:case 236:case 237:case 238:case 239:case 254:i=r.readInt(2,"be"),r.position+=i-2;break;case 223:r.position++;break;case 220:case 221:r.position+=2;break;case 218:i=r.readInt(2,"be"),r.position+=i-2,r.continueUntil(255);break;default:r.continueUntil(255)}}throw new Error("Unable to parse JPEG successfully")}},{name:"Graphics Interchange Format image",extension:"gif",mime:"image/gif",description:"",signature:{0:71,1:73,2:70,3:56,4:[55,57],5:97},extractor:function(t,e){var r=new ct(t.slice(e));for(r.continueUntil([33,255]),r.continueUntil([33,249]),r.moveForwardsBy(2);r.hasMore();){for(r.moveForwardsBy(r.readInt(1)+1),r.moveForwardsBy(11);!Array.from(r.getBytes(2)).equals([33,249])&&(r.moveBackwardsBy(2),r.moveForwardsBy(r.readInt(1)),r.readInt(1));)r.moveBackwardsBy(1);if(59===r.readInt(1))break;r.moveForwardsBy(1)}return r.carve()}},{name:"Portable Network Graphics image",extension:"png",mime:"image/png",description:"",signature:{0:137,1:80,2:78,3:71,4:13,5:10,6:26,7:10},extractor:function(t,e){var r=new ct(t.slice(e));r.moveForwardsBy(8);for(var n=0,i="";"IEND"!==i;)n=r.readInt(4,"be"),i=r.readString(4),r.moveForwardsBy(n+4);return r.carve()}},{name:"WEBP Image",extension:"webp",mime:"image/webp",description:"",signature:{8:87,9:69,10:66,11:80},extractor:function(t,e){var r=new ct(t.slice(e));r.moveForwardsBy(4);var n=r.readInt(4,"le");return r.moveForwardsBy(n),r.carve()}},{name:"High Efficiency Image File Format",extension:"heic,heif",mime:"image/heif",description:"",signature:{0:0,1:0,2:0,3:[36,24],4:102,5:116,6:121,7:112,8:104,9:101,10:105,11:99},extractor:null},{name:"Camera Image File Format",extension:"crw",mime:"image/x-canon-crw",description:"",signature:{6:72,7:69,8:65,9:80,10:67,11:67,12:68,13:82},extractor:null},{name:"Canon CR2 raw image",extension:"cr2",mime:"image/x-canon-cr2",description:"",signature:[{0:73,1:73,2:42,3:0,8:67,9:82},{0:77,1:77,2:0,3:42,8:67,9:82}],extractor:null},{name:"Tagged Image File Format image",extension:"tif",mime:"image/tiff",description:"",signature:[{0:73,1:73,2:42,3:0},{0:77,1:77,2:0,3:42}],extractor:null},{name:"Bitmap image",extension:"bmp",mime:"image/bmp",description:"",signature:{0:66,1:77,7:0,9:0,14:[12,40,56,64,108,124],15:0,16:0,17:0},extractor:function(t,e){var r=new ct(t.slice(e));r.moveForwardsBy(2);var n=r.readInt(4,"le");return r.moveForwardsBy(n-6),r.carve()}},{name:"JPEG Extended Range image",extension:"jxr",mime:"image/vnd.ms-photo",description:"",signature:{0:73,1:73,2:188},extractor:null},{name:"Photoshop image",extension:"psd",mime:"image/vnd.adobe.photoshop",description:"",signature:{0:56,1:66,2:80,3:83,4:0,5:1,6:0,7:0,8:0,9:0,10:0,11:0},extractor:null},{name:"Photoshop Large Document",extension:"psb",mime:"application/x-photoshop",description:"",signature:{0:56,1:66,2:80,3:83,4:0,5:2,6:0,7:0,8:0,9:0,10:0,11:0,12:0},extractor:null},{name:"Paint Shop Pro image",extension:"psp",mime:"image/psp",description:"",signature:[{0:80,1:97,2:105,3:110,4:116,5:32,6:83,7:104,8:111,9:112,10:32,11:80,12:114,13:111,14:32,15:73,16:109},{0:126,1:66,2:75,3:0}],extractor:null},{name:"The GIMP image",extension:"xcf",mime:"image/x-xcf",description:"",signature:{0:103,1:105,2:109,3:112,4:32,5:120,6:99,7:102,8:32,9:[102,118],10:[105,48],11:[108,48],12:[101,49,50,51]},extractor:null},{name:"Icon image",extension:"ico",mime:"image/x-icon",description:"",signature:{0:0,1:0,2:1,3:0,4:[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21],5:0,6:[16,32,48,64,128],7:[16,32,48,64,128],9:0,10:[0,1]},extractor:function(t,e){var r=new ct(t.slice(e));r.moveTo(4);var n=r.readInt(2,"le");r.moveForwardsBy(8+16*(n-1));var i=r.readInt(4,"le"),s=r.readInt(4,"le");return r.moveTo(s+i),r.carve()}},{name:"Radiance High Dynamic Range image",extension:"hdr",mime:"image/vnd.radiance",description:"",signature:{0:35,1:63,2:82,3:65,4:68,5:73,6:65,7:78,8:67,9:69,10:10},extractor:null},{name:"Sony ARW image",extension:"arw",mime:"image/x-raw",description:"",signature:{0:5,1:0,2:0,3:0,4:65,5:87,6:49,7:46},extractor:null},{name:"Fujifilm Raw Image",extension:"raf",mime:"image/x-raw",description:"",signature:{0:70,1:85,2:74,3:73,4:70,5:73,6:76,7:77,8:67,9:67,10:68,11:45,12:82,13:65,14:87},extractor:null},{name:"Minolta RAW image",extension:"mrw",mime:"image/x-raw",description:"",signature:{0:0,1:77,2:82,3:77},extractor:null},{name:"Adobe Bridge Thumbnail Cache",extension:"bct",mime:"application/octet-stream",description:"",signature:{0:108,1:110,2:98,3:116,4:2,5:0,6:0,7:0},extractor:null},{name:"Microsoft Document Imaging",extension:"mdi",mime:"image/vnd.ms-modi",description:"",signature:{0:69,1:80,2:42,3:0},extractor:null},{name:"Joint Photographic Experts Group image (under Base64)",extension:"B64",mime:"application/octet-stream",description:"",signature:{0:47,1:57,2:106,3:47,4:52},extractor:null},{name:"Portable Network Graphics image (under Base64)",extension:"B64",mime:"application/octet-stream",description:"",signature:{0:105,1:86,2:66,3:79,4:82,5:119,6:48},extractor:null},{name:"AutoCAD Drawing",extension:"dwg,123d",mime:"application/acad",description:"",signature:{0:65,1:67,2:49,3:48,4:[48,49],5:[48,49,50,51,52,53],6:0},extractor:null},{name:"AutoCAD Drawing",extension:"dwg,dwt",mime:"application/acad",description:"",signature:[{0:65,1:67,2:49,3:48,4:49,5:56,6:0},{0:65,1:67,2:49,3:48,4:50,5:52,6:0},{0:65,1:67,2:49,3:48,4:50,5:55,6:0}],extractor:null},{name:"Targa Image",extension:"tga",mime:"image/x-targa",description:"",signature:[{0:84,1:82,2:85,3:69,4:86,5:73,6:83,7:73,8:79,9:78,10:45,11:88,12:70,13:73,14:76,15:69,16:46}],extractor:function(t,e){var r=new ct(t);r.moveTo(e-8);var n=r.readInt(4,"le"),i=r.readInt(4,"le");function s(t,e){for(var n=0;n<t;n++){r.moveBackwardsBy(1);var i=r.readInt(e,"le")-1;if(r.moveBackwardsBy(e),i===n)break}}return r.moveBackwardsBy(8),n||i?n?(s(65535,2),r.moveBackwardsBy(n)):i&&(s(4294967295,4),r.moveBackwardsBy(6),r.moveBackwardsBy(i)):(function(){r.moveBackwardsBy(5);for(var t=0;t<1048576&&r.readInt(2,"le")*r.readInt(2,"le")*r.readInt(1)/8!=t-1;t++)r.moveBackwardsBy(6)}(),r.moveBackwardsBy(17)),r.carve(r.position,e+18)}}],Video:[{name:"Matroska Multimedia Container",extension:"mkv",mime:"video/x-matroska",description:"",signature:{31:109,32:97,33:116,34:114,35:111,36:115,37:107,38:97},extractor:null},{name:"WEBM video",extension:"webm",mime:"video/webm",description:"",signature:{0:26,1:69,2:223,3:163},extractor:null},{name:"Flash MP4 video",extension:"f4v",mime:"video/mp4",description:"",signature:{4:102,5:116,6:121,7:112,8:[102,70],9:52,10:[118,86],11:32},extractor:null},{name:"MPEG-4 video",extension:"mp4",mime:"video/mp4",description:"",signature:[{0:0,1:0,2:0,3:[24,32],4:102,5:116,6:121,7:112},{0:51,1:103,2:112,3:53},{0:0,1:0,2:0,3:28,4:102,5:116,6:121,7:112,8:109,9:112,10:52,11:50,16:109,17:112,18:52,19:49,20:109,21:112,22:52,23:50,24:105,25:115,26:111,27:109}],extractor:null},{name:"M4V video",extension:"m4v",mime:"video/x-m4v",description:"",signature:{0:0,1:0,2:0,3:28,4:102,5:116,6:121,7:112,8:77,9:52,10:86},extractor:null},{name:"Quicktime video",extension:"mov",mime:"video/quicktime",description:"",signature:{0:0,1:0,2:0,3:20,4:102,5:116,6:121,7:112},extractor:null},{name:"Audio Video Interleave",extension:"avi",mime:"video/x-msvideo",description:"",signature:{0:82,1:73,2:70,3:70,8:65,9:86,10:73},extractor:null},{name:"Windows Media Video",extension:"wmv",mime:"video/x-ms-wmv",description:"",signature:{0:48,1:38,2:178,3:117,4:142,5:102,6:207,7:17,8:166,9:217},extractor:null},{name:"MPEG video",extension:"mpg",mime:"video/mpeg",description:"",signature:{0:0,1:0,2:1,3:186},extractor:null},{name:"Flash Video",extension:"flv",mime:"video/x-flv",description:"",signature:{0:70,1:76,2:86,3:1},extractor:function(t,e){var r=new ct(t.slice(e));r.moveForwardsBy(5);var n=r.readInt(4,"be");r.moveForwardsBy(n-9);for(var i=-11;r.hasMore();){var s=r.readInt(4,"be"),a=r.readInt(1);if([8,9,18].indexOf(a)<0){r.moveBackwardsBy(1);break}if(s!==i+11){r.moveBackwardsBy(i+11+5);break}i=r.readInt(3,"be"),r.moveForwardsBy(7+i)}return r.carve()}},{name:"OGG Video",extension:"ogv,ogm,opus,ogx",mime:"video/ogg",description:"",signature:[{0:79,1:103,2:103,3:83,4:0,5:2,28:1,29:118,30:105,31:100,32:101,33:111},{0:79,1:103,2:103,3:83,4:0,5:2,28:128,29:116,30:104,31:101,32:111,33:114,34:97},{0:79,1:103,2:103,3:83,4:0,5:2,28:102,29:105,30:115,31:104,32:101,33:97,34:100}],extractor:null}],Audio:[{name:"Waveform Audio",extension:"wav",mime:"audio/x-wav",description:"",signature:{0:82,1:73,2:70,3:70,8:87,9:65,10:86,11:69},extractor:function(t,e){var r=new ct(t.slice(e));return r.moveTo(4),r.moveTo(r.readInt(4,"le")+8),r.carve()}},{name:"OGG audio",extension:"ogg",mime:"audio/ogg",description:"",signature:{0:79,1:103,2:103,3:83},extractor:null},{name:"Musical Instrument Digital Interface audio",extension:"midi",mime:"audio/midi",description:"",signature:{0:77,1:84,2:104,3:100},extractor:null},{name:"MPEG-3 audio",extension:"mp3",mime:"audio/mpeg",description:"",signature:[{0:73,1:68,2:51},{0:255,1:251}],extractor:function(t,e){var r=new ct(t.slice(e)),n=["free",32e3,4e4,48e3,56e3,64e3,8e4,96e3,112e3,128e3,16e4,192e3,224e3,256e3,32e4,"bad"],i=[44100,48e3,32e3,"reserved"];if(r.getBytes(3).toString()===[73,68,51].toString()){r.moveTo(6);var s=r.readInt(1)<<21|r.readInt(1)<<14|r.readInt(1)<<7|r.readInt(1);r.moveForwardsBy(s)}else r.moveTo(0);for(;r.hasMore();){if(r.getBytes(3)===[84,65,71].toString()){r.moveForwardsBy(125);break}if(r.getBytes(2).toString()!==[255,251].toString()){r.moveBackwardsBy(2);break}var a=r.readInt(1),o=n[a>>4],u=i[(15&a)>>2],c=(2&a)>>1;if("free"===o||"bad"===o||"reserved"===u){r.moveBackwardsBy(1);break}var l=Math.floor(144*o/u+c);if(r.position+l>r.length){r.moveTo(r.length);break}r.moveForwardsBy(l-3)}return r.carve()}},{name:"MPEG-4 Part 14 audio",extension:"m4a",mime:"audio/m4a",description:"",signature:[{4:102,5:116,6:121,7:112,8:77,9:52,10:65},{0:77,1:52,2:65,3:32}],extractor:null},{name:"Free Lossless Audio Codec",extension:"flac",mime:"audio/x-flac",description:"",signature:{0:102,1:76,2:97,3:67},extractor:null},{name:"Adaptive Multi-Rate audio codec",extension:"amr",mime:"audio/amr",description:"",signature:{0:35,1:33,2:65,3:77,4:82,5:10},extractor:null},{name:"Audacity",extension:"au",mime:"audio/x-au",description:"",signature:{0:100,1:110,2:115,3:46,24:65,25:117,26:100,27:97,28:99,29:105,30:116,31:121,32:66,33:108,34:111,35:99,36:107,37:70,38:105,39:108,40:101},extractor:null},{name:"Audacity Block",extension:"auf",mime:"application/octet-stream",description:"",signature:{0:65,1:117,2:100,3:97,4:99,5:105,6:116,7:121,8:66,9:108,10:111,11:99,12:107,13:70,14:105,15:108,16:101},extractor:null},{name:"Audio Interchange File",extension:"aif",mime:"audio/x-aiff",description:"",signature:{0:70,1:79,2:82,3:77,8:65,9:73,10:70,11:70},extractor:null},{name:"Audio Interchange File (compressed)",extension:"aifc",mime:"audio/x-aifc",description:"",signature:{0:70,1:79,2:82,3:77,8:65,9:73,10:70,11:67},extractor:null}],Documents:[{name:"Portable Document Format",extension:"pdf",mime:"application/pdf",description:"",signature:{0:37,1:80,2:68,3:70},extractor:function(t,e){var r=new ct(t.slice(e));return r.continueUntil([37,37,69,79,70]),r.moveForwardsBy(5),r.consumeIf(13),r.consumeIf(10),r.carve()}},{name:"Portable Document Format (under Base64)",extension:"B64",mime:"application/octet-stream",description:"",signature:{0:65,1:74,2:86,3:66,4:69,5:82,6:105},extractor:null},{name:"Adobe PostScript",extension:"ps,eps,ai,pfa",mime:"application/postscript",description:"",signature:{0:37,1:33,2:80,3:83,4:45,5:65,6:100,7:111,8:98,9:101},extractor:null},{name:"PostScript",extension:"ps",mime:"application/postscript",description:"",signature:{0:37,1:33},extractor:null},{name:"Encapsulated PostScript",extension:"eps,ai",mime:"application/eps",description:"",signature:{0:197,1:208,2:211,3:198},extractor:null},{name:"Rich Text Format",extension:"rtf",mime:"application/rtf",description:"",signature:{0:123,1:92,2:114,3:116},extractor:function(t,e){var r=new ct(t.slice(e)),n=0;if(123!==r.readInt(1))throw new Error("Not a valid RTF file");for(n++;n>0&&r.hasMore();)switch(r.readInt(1)){case 123:n++;break;case 125:n--;break;case 92:r.consumeIf(92),r.position++}return r.carve()}},{name:"Microsoft Office document/OLE2",extension:"ole2,doc,xls,dot,ppt,xla,ppa,pps,pot,msi,sdw,db,vsd,msg",mime:"application/msword,application/vnd.ms-excel,application/vnd.ms-powerpoint",description:"Microsoft Office documents",signature:{0:208,1:207,2:17,3:224,4:161,5:177,6:26,7:225},extractor:null},{name:"Microsoft Office document/OLE2 (under Base64)",extension:"B64",mime:"application/octet-stream",description:"",signature:{0:48,1:77,2:56,3:82,4:52,5:75,6:71,7:120},extractor:null},{name:"Microsoft Office 2007+ document",extension:"docx,xlsx,pptx",mime:"application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.openxmlformats-officedocument.presentationml.presentation",description:"",signature:{38:95,39:84,40:121,41:112,42:101,43:115,44:93,45:46,46:120,47:109,48:108},extractor:pt},{name:"Microsoft Access database",extension:"mdb,mda,mde,mdt,fdb,psa",mime:"application/msaccess",description:"",signature:{0:0,1:1,2:0,3:0,4:83,5:116,6:97,7:110,8:100,9:97,10:114,11:100,12:32,13:74,14:101,15:116},extractor:null},{name:"Microsoft Access 2007+ database",extension:"accdb,accde,accda,accdu",mime:"application/msaccess",description:"",signature:{0:0,1:1,2:0,3:0,4:83,5:116,6:97,7:110,8:100,9:97,10:114,11:100,12:32,13:65,14:67,15:69,16:32},extractor:null},{name:"Microsoft OneNote document",extension:"one",mime:"application/onenote",description:"",signature:{0:228,1:82,2:92,3:123,4:140,5:216,6:167,7:77,8:174,9:177,10:83,11:120,12:208,13:41,14:150,15:211},extractor:null},{name:"Outlook Express database",extension:"dbx",mime:"application/octet-stream",description:"",signature:{0:207,1:173,2:18,3:254,4:[48,197,198,199],11:17},extractor:null},{name:"Personal Storage Table (Outlook)",extension:"pst,ost,fdb,pab",mime:"application/octet-stream",description:"",signature:{0:33,1:66,2:68,3:78},extractor:null},{name:"Microsoft Exchange Database",extension:"edb",mime:"application/octet-stream",description:"",signature:{4:239,5:205,6:171,7:137,8:[32,35],9:6,10:0,11:0,12:[0,1],13:0,14:0,15:0},extractor:null},{name:"WordPerfect document",extension:"wpd,wp,wp5,wp6,wpp,bk!,wcm",mime:"application/wordperfect",description:"",signature:{0:255,1:87,2:80,3:67,7:[0,1,2],8:1,9:10},extractor:null},{name:"EPUB e-book",extension:"epub",mime:"application/epub+zip",description:"",signature:{0:80,1:75,2:3,3:4,30:109,31:105,32:109,33:101,34:116,35:121,36:112,37:101,38:97,39:112,40:112,41:108,42:105,43:99,44:97,45:116,46:105,47:111,48:110,49:47,50:101,51:112,52:117,53:98,54:43,55:122,56:105,57:112},extractor:pt}],Applications:[{name:"Windows Portable Executable",extension:"exe,dll,drv,vxd,sys,ocx,vbx,com,fon,scr",mime:"application/vnd.microsoft.portable-executable",description:"",signature:{0:77,1:90,3:[0,1,2],5:[0,1,2]},extractor:function(t,e){var r=new ct(t.slice(e));r.moveTo(60);var n=r.readInt(4,"le");r.moveTo(n),r.moveForwardsBy(6);var i=r.readInt(2,"le");r.moveForwardsBy(16);var s=523===r.readInt(2,"le")?112:96;r.moveForwardsBy(s-2),r.moveForwardsBy(32);var a=r.readInt(4,"le"),o=r.readInt(4,"le");if(a>0)return r.moveTo(a+o),r.carve();r.moveForwardsBy(88),r.moveForwardsBy(40*(i-1)),r.moveForwardsBy(16);var u=r.readInt(4,"le"),c=r.readInt(4,"le");return r.moveTo(c+u),r.carve()}},{name:"Executable and Linkable Format",extension:"elf,bin,axf,o,prx,so",mime:"application/x-executable",description:"Executable and Linkable Format file. No standard file extension.",signature:{0:127,1:69,2:76,3:70},extractor:function(t,e){var r=new ct(t.slice(e));r.moveForwardsBy(4);var n=1===r.readInt(1),i=1===r.readInt(1)?"le":"be";r.moveForwardsBy(n?26:34);var s=n?r.readInt(4,i):r.readInt(8,i);r.moveForwardsBy(10);var a=r.readInt(2,i),o=r.readInt(2,i);return r.moveTo(s),r.moveForwardsBy(a*o),r.carve()}},{name:"MacOS Mach-O object",extension:"dylib",mime:"application/octet-stream",description:"",signature:[{0:202,1:254,2:186,3:190,4:0,5:0,6:0,7:[1,2,3]},{0:206,1:250,2:237,3:254,4:7,5:0,6:0,7:0,8:[1,2,3]}],extractor:dt},{name:"MacOS Mach-O 64-bit object",extension:"dylib",mime:"application/octet-stream",description:"",signature:{0:207,1:250,2:237,3:254},extractor:dt},{name:"Adobe Flash",extension:"swf",mime:"application/x-shockwave-flash",description:"",signature:{0:[67,70],1:87,2:83},extractor:null},{name:"Java Class",extension:"class",mime:"application/java-vm",description:"",signature:{0:202,1:254,2:186,3:190},extractor:null},{name:"Dalvik Executable",extension:"dex",mime:"application/octet-stream",description:"Dalvik Executable as used by Android",signature:{0:100,1:101,2:120,3:10,4:48,5:51,6:53,7:0},extractor:null},{name:"Google Chrome Extension",extension:"crx",mime:"application/crx",description:"Google Chrome extension or packaged app",signature:{0:67,1:114,2:50,3:52},extractor:null}],Archives:[{name:"PKZIP archive",extension:"zip",mime:"application/zip",description:"",signature:{0:80,1:75,2:[3,5,7],3:[4,6,8]},extractor:pt},{name:"PKZIP archive (under Base64)",extension:"B64",mime:"application/octet-stream",description:"",signature:{0:85,1:69,2:115,3:68,4:66,5:66},extractor:null},{name:"TAR archive",extension:"tar",mime:"application/x-tar",description:"",signature:{257:117,258:115,259:116,260:97,261:114},extractor:function(t,e){for(var r=new ct(t.slice(e)),n=function(){if(r.moveForwardsBy(257),r.getBytes(5).join("")!==[117,115,116,97,114].join(""))return r.moveBackwardsBy(262),1;r.moveBackwardsBy(138);var t=0;r.getBytes(11).forEach((function(e,r){t+=(e-48).toString()})),t=512*Math.ceil(parseInt(t,8)/512),r.moveForwardsBy(t+377)};r.hasMore()&&!n(););return r.consumeWhile(0),r.carve()}},{name:"Roshal Archive",extension:"rar",mime:"application/x-rar-compressed",description:"",signature:{0:82,1:97,2:114,3:33,4:26,5:7,6:[0,1]},extractor:null},{name:"Gzip",extension:"gz",mime:"application/gzip",description:"",signature:{0:31,1:139,2:8},extractor:function(t,e){var r=new ct(t.slice(e));r.moveForwardsBy(3);var n=r.readInt(1);if(r.moveForwardsBy(4),r.readInt(1),r.moveForwardsBy(1),4&n){var i=r.readInt(2,"le");r.moveForwardsby(i)}return 8&n&&(r.continueUntil(0),r.moveForwardsBy(1)),16&n&&(r.continueUntil(0),r.moveForwardsBy(1)),2&n&&r.moveForwardsBy(2),St(r),r.moveForwardsBy(8),r.carve()}},{name:"Bzip2",extension:"bz2",mime:"application/x-bzip2",description:"",signature:{0:66,1:90,2:104},extractor:function(t,e){for(var r=new ct(t.slice(e)),n=[[119,36,83,133,9],[238,72,167,10,18],[220,145,78,20,36],[185,34,156,40,72],[114,69,56,80,144],[187,146,41,194,132],[93,201,20,225,66],[46,228,138,112,161],[23,114,69,56,80]],i=0;i<n.length&&(r.continueUntil(n[i]),r.getBytes(5).join("")!==n[i].join(""));i++)r.moveTo(0);return r.moveForwardsBy(4),r.carve()}},{name:"7zip",extension:"7z",mime:"application/x-7z-compressed",description:"",signature:{0:55,1:122,2:188,3:175,4:39,5:28},extractor:null},{name:"Zlib Deflate",extension:"zlib",mime:"application/x-deflate",description:"",signature:{0:120,1:[1,156,218,94]},extractor:function(t,e){var r=new ct(t.slice(e));return r.moveForwardsBy(1),32&r.readInt(1)&&r.moveForwardsBy(4),St(r),r.moveForwardsBy(4),r.carve()}},{name:"xz compression",extension:"xz",mime:"application/x-xz",description:"",signature:{0:253,1:55,2:122,3:88,4:90,5:0},extractor:function(t,e){var r=new ct(t.slice(e));return r.continueUntil([0,0,0,0,4,89,90]),r.moveForwardsBy(7),r.carve()}},{name:"Tarball",extension:"tar.z",mime:"application/x-gtar",description:"",signature:{0:31,1:[157,160]},extractor:null},{name:"ISO disk image",extension:"iso",mime:"application/octet-stream",description:"ISO 9660 CD/DVD image file",signature:[{32769:67,32770:68,32771:48,32772:48,32773:49},{34817:67,34818:68,34819:48,34820:48,34821:49},{36865:67,36866:68,36867:48,36868:48,36869:49}],extractor:null},{name:"Virtual Machine Disk",extension:"vmdk",mime:"application/vmdk,application/x-virtualbox-vmdk",description:"",signature:{0:75,1:68,2:77,3:86,5:0,6:0,7:0},extractor:null},{name:"Virtual Hard Drive",extension:"vhd",mime:"application/x-vhd",description:"",signature:{0:99,1:111,2:110,3:101,4:99,5:116,6:105,7:120},extractor:null},{name:"Macintosh disk image",extension:"dmf,dmg",mime:"application/octet-stream",description:"",signature:{0:120,1:1,2:115,3:13,4:98,5:98,6:96,7:96},extractor:null},{name:"ARJ Archive",extension:"arj",mime:"application/x-arj-compressed",description:"",signature:{0:96,1:234,8:[0,16,20],9:0,10:2},extractor:null},{name:"WinAce Archive",extension:"ace",mime:"application/x-ace-compressed",description:"",signature:{7:42,8:42,9:65,10:67,11:69,12:42,13:42},extractor:null},{name:"Macintosh BinHex Encoded File",extension:"hqx",mime:"application/mac-binhex",description:"",signature:{11:109,12:117,13:115,14:116,15:32,16:98,17:101,18:32,19:99,20:111,21:110,22:118,23:101,24:114,25:116,26:101,27:100,28:32,29:119,30:105,31:116,32:104,33:32,34:66,35:105,36:110,37:72,38:101,39:120},extractor:null},{name:"ALZip Archive",extension:"alz",mime:"application/octet-stream",description:"",signature:{0:65,1:76,2:90,3:1,4:10,5:0,6:0,7:0},extractor:null},{name:"KGB Compressed Archive",extension:"kgb",mime:"application/x-kgb-compressed",description:"",signature:{0:75,1:71,2:66,3:95,4:97,5:114,6:99,7:104,8:32,9:45},extractor:null},{name:"Microsoft Cabinet",extension:"cab",mime:"vnd.ms-cab-compressed",description:"",signature:{0:77,1:83,2:67,3:70,4:0,5:0,6:0,7:0},extractor:null},{name:"Jar Archive",extension:"jar",mime:"application/java-archive",description:"",signature:{0:95,1:39,2:168,3:137},extractor:null},{name:"Jar Archive",extension:"jar",mime:"application/java-archive",description:"",signature:{0:80,1:75,2:3,3:4,4:20,5:0,6:8,7:0,8:8,9:0},extractor:pt},{name:"lzop compressed",extension:"lzop,lzo",mime:"application/x-lzop",description:"",signature:{0:137,1:76,2:90,3:79,4:0,5:13,6:10,7:26},extractor:function(t,e){var r=new ct(t.slice(e)),n=0,i=0;r.moveForwardsBy(9);var s=r.readInt(2,"be");r.moveForwardsBy(6);var a=r.readInt(4,"be");2048&s&&r.moveForwardsBy(4),2&a&&n++,512&a&&n++,1&a&&i++,256&a&&i++,r.moveForwardsBy(8),s>=2368&&r.moveForwardsBy(4);var o=r.readInt(1,"be");if(r.moveForwardsBy(o),64&a){var u=r.readInt(4,"be");r.moveForwardsBy(u)}for(r.moveForwardsBy(4);r.hasMore();){var c=r.readInt(4,"be");if(0===c)break;var l=r.readInt(4,"be"),h=c===l?i:i+n;r.moveForwardsBy(l+4*h)}return r.carve()}},{name:"Linux deb package",extension:"deb",mime:"application/vnd.debian.binary-package",description:"",signature:{0:33,1:60,2:97,3:114,4:99,5:104,6:62},extractor:function(t,e){var r=new ct(t.slice(e));for(r.moveForwardsBy(8);r.hasMore();){r.moveForwardsBy(48);var n,i="",s=lt(r.getBytes(10));try{for(s.s();!(n=s.n()).done;){var a=n.value;i+=String.fromCharCode(a)}}catch(t){s.e(t)}finally{s.f()}i=parseInt(i.trim(),10),r.moveForwardsBy(2),r.moveForwardsBy(i)}return r.carve()}},{name:"Apple Disk Image",extension:"dmg",mime:"application/x-apple-diskimage",description:"",signature:{0:120,1:1,2:115,3:13,4:98,5:98,6:96},extractor:null}],Miscellaneous:[{name:"UTF-8 text",extension:"txt",mime:"text/plain",description:"UTF-8 encoded Unicode byte order mark, commonly but not exclusively seen in text files.",signature:{0:239,1:187,2:191},extractor:null},{name:"UTF-32 LE text",extension:"utf32le",mime:"charset/utf32le",description:"Little-endian UTF-32 encoded Unicode byte order mark.",signature:{0:255,1:254,2:0,3:0},extractor:null},{name:"UTF-16 LE text",extension:"utf16le",mime:"charset/utf16le",description:"Little-endian UTF-16 encoded Unicode byte order mark.",signature:{0:255,1:254},extractor:null},{name:"Web Open Font Format",extension:"woff",mime:"application/font-woff",description:"",signature:{0:119,1:79,2:70,3:70,4:0,5:1,6:0,7:0},extractor:null},{name:"Web Open Font Format 2",extension:"woff2",mime:"application/font-woff",description:"",signature:{0:119,1:79,2:70,3:50,4:0,5:1,6:0,7:0},extractor:null},{name:"Embedded OpenType font",extension:"eot",mime:"application/octet-stream",description:"",signature:[{8:2,9:0,10:1,34:76,35:80},{8:1,9:0,10:0,34:76,35:80},{8:2,9:0,10:2,34:76,35:80}],extractor:null},{name:"TrueType Font",extension:"ttf",mime:"application/font-sfnt",description:"",signature:{0:0,1:1,2:0,3:0,4:0},extractor:null},{name:"OpenType Font",extension:"otf",mime:"application/font-sfnt",description:"",signature:{0:79,1:84,2:84,3:79,4:0},extractor:null},{name:"SQLite",extension:"sqlite",mime:"application/x-sqlite3",description:"",signature:{0:83,1:81,2:76,3:105},extractor:function(t,e){var r=new ct(t.slice(e));r.moveTo(16);var n=r.readInt(2);r.moveTo(28);var i=r.readInt(4);return r.moveTo(n*i),r.carve()}},{name:"BitTorrent link",extension:"torrent",mime:"application/x-bittorrent",description:"",signature:[{0:100,1:56,2:58,3:97,4:110,5:110,6:111,7:117,8:110,9:99,10:101,11:35,12:35,13:58},{0:100,1:52,2:58,3:105,4:110,5:102,6:111,7:100,8:[52,53,54],9:58}],extractor:null},{name:"Cryptocurrency wallet",extension:"wallet",mime:"application/octet-stream",description:"",signature:{0:0,1:0,2:0,3:0,4:1,5:0,6:0,7:0,8:0,9:0,10:0,11:0,12:98,13:49,14:5,15:0},extractor:null},{name:"Registry fragment",extension:"hbin",mime:"application/octet-stream",description:"",signature:{0:104,1:98,2:105,3:110,4:0},extractor:null},{name:"Registry script",extension:"rgs",mime:"application/octet-stream",description:"",signature:{0:72,1:75,2:67,3:82,4:13,5:10,6:92,7:123},extractor:null},{name:"WinNT Registry Hive",extension:"registry",mime:"application/octet-stream",description:"",signature:{0:114,1:101,2:103,3:102},extractor:null},{name:"Windows Event Log",extension:"evt",mime:"application/octet-stream",description:"",signature:{0:48,1:0,2:0,3:0,4:76,5:102,6:76,7:101},extractor:function(t,e){var r=new ct(t.slice(e));r.moveTo(20);var n=r.readInt(4,"le");r.moveTo(n);var i=r.readInt(4,"le");return r.moveForwardsBy(i-4),r.carve()}},{name:"Windows Event Log",extension:"evtx",mime:"application/octet-stream",description:"",signature:{0:69,1:108,2:102,3:70,4:105,5:108,6:101},extractor:function(t,e){var r=new ct(t.slice(e));r.moveTo(40);var n=r.readInt(4,"le")-44;for(r.moveForwardsBy(n);r.hasMore()&&r.getBytes(7).join("")===[69,108,102,67,104,110,107].join("");)r.moveForwardsBy(65529);return r.consumeWhile(0),r.carve()}},{name:"Windows Pagedump",extension:"dmp",mime:"application/octet-stream",description:"",signature:{0:80,1:65,2:71,3:69,4:68,5:85,6:[77,54],7:[80,52]},extractor:function(t,e){var r=new ct(t.slice(e));return r.moveTo(112),r.moveTo(4096*(r.readInt(4,"le")+1)),r.carve()}},{name:"Windows Prefetch",extension:"pf",mime:"application/x-pf",description:"",signature:{0:[17,23,26],1:0,2:0,3:0,4:83,5:67,6:67,7:65},extractor:function(t,e){var r=new ct(t.slice(e));return r.moveTo(12),r.moveTo(r.readInt(4,"be")),r.carve()}},{name:"Windows Prefetch (Win 10)",extension:"pf",mime:"application/x-pf",description:"",signature:{0:77,1:65,2:77,3:4,7:0},extractor:function(t,e){var r=new ct(t.slice(e));return r.moveTo(r.readInt(4,"be")),r.carve()}},{name:"PList (XML)",extension:"plist",mime:"application/xml",description:"",signature:{39:60,40:33,41:68,42:79,43:67,44:84,45:89,46:80,47:69,48:32,49:112,50:108,51:105,52:115,53:116},extractor:function(t,e){var r=new ct(t.slice(e)),n=0;for(r.continueUntil([60,112,108,105,115,116]),r.moveForwardsBy(6),n++;n>0&&r.hasMore();)60===r.readInt(1)&&(r.getBytes(5).join("")===[112,108,105,115,116].join("")?n++:r.moveBackwardsBy(5),r.getBytes(7).join("")===[47,112,108,105,115,116,62].join("")?n--:r.moveBackwardsBy(7));return r.consumeIf(10),r.carve()}},{name:"PList (binary)",extension:"bplist,plist,ipmeta,abcdp,mdbackup,mdinfo,strings,nib,ichat,qtz,webbookmark,webhistory",mime:"application/x-plist",description:"",signature:{0:98,1:112,2:108,3:105,4:115,5:116,6:48,7:48},extractor:null},{name:"MacOS X Keychain",extension:"keychain",mime:"application/octet-stream",description:"",signature:{0:107,1:121,2:99,3:104,4:0,5:1},extractor:function(t,e){var r=new ct(t.slice(e));return r.moveTo(20),r.moveForwardsBy(r.readInt(4)),r.carve()}},{name:"TCP Packet",extension:"tcp",mime:"application/tcp",description:"",signature:{12:8,13:0,14:69,15:0,21:0,22:function(t){return t>=1&&t<=128},23:6},extractor:null},{name:"UDP Packet",extension:"udp",mime:"application/udp",description:"",signature:{12:8,13:0,14:69,15:0,16:[0,1,2,3,4,5],22:function(t){return t>=1&&t<=128},23:17},extractor:null},{name:"Compiled HTML",extension:"chm,chw,chi",mime:"application/vnd.ms-htmlhelp",description:"",signature:{0:73,1:84,2:83,3:70,4:3,5:0,6:0,7:0},extractor:null},{name:"Windows Password",extension:"pwl",mime:"application/octet-stream",description:"",signature:{0:227,1:130,2:133,3:150},extractor:null},{name:"Bitlocker recovery key",extension:"bitlocker",mime:"application/octet-stream",description:"",signature:{0:255,1:254,2:66,3:0,4:105,5:0,6:116,7:0,8:76,9:0,10:111,11:0,12:99,13:0,14:107,15:0,16:101,17:0,18:114,19:0,20:32,21:0},extractor:null},{name:"Certificate",extension:"cer,cat,p7b,p7c,p7m,p7s,swz,rsa,crl,crt,der",mime:"application/pkix-cert",description:"",signature:{0:48,1:130,4:[6,10,48]},extractor:null},{name:"Certificate",extension:"cat,swz,p7m",mime:"application/vnd.ms-pki.seccat",description:"",signature:{0:48,1:131,2:function(t){return 0!==t},5:6,6:9},extractor:null},{name:"PGP pubring",extension:"pkr,gpg",mime:"application/pgp-keys",description:"",signature:{0:153,1:1,2:[13,162],3:4},extractor:null},{name:"PGP secring",extension:"skr",mime:"application/pgp-keys",description:"",signature:[{0:149,1:1,2:207,3:4},{0:149,1:3,2:198,3:4},{0:149,1:5,2:134,3:4}],extractor:null},{name:"PGP Safe",extension:"pgd",mime:"application/pgp-keys",description:"",signature:{0:80,1:71,2:80,3:100,4:77,5:65,6:73,7:78,8:96,9:1,10:0},extractor:null},{name:"Task Scheduler",extension:"job",mime:"application/octet-stream",description:"",signature:{0:[0,1,2,3],1:[5,6],2:1,3:0,20:70,21:0},extractor:null},{name:"Windows Shortcut",extension:"lnk",mime:"application/x-ms-shortcut",description:"",signature:{0:76,1:0,2:0,3:0,4:1,5:20,6:2,7:0,8:0,9:0,10:0,11:0,12:192,13:0,14:0,15:0,16:0,17:0,18:0,19:70},extractor:function(t,e){var r=new ct(t.slice(e));return r.moveTo(52),r.moveTo(r.readInt(4,"le")),r.carve()}},{name:"Bash",extension:"bash",mime:"application/bash",description:"",signature:{0:35,1:33,2:47,3:98,4:105,5:110,6:47,7:98,8:97,9:115,10:104},extractor:null},{name:"Shell",extension:"sh",mime:"application/sh",description:"",signature:{0:35,1:33,2:47,3:98,4:105,5:110,6:47,7:115,8:104},extractor:null},{name:"Python",extension:"py,pyc,pyd,pyo,pyw,pyz",mime:"application/python",description:"",signature:{0:35,1:33,2:47,3:117,4:115,5:114,6:47,7:98,8:105,9:110,10:47,11:112,12:121,13:116,14:104,15:111,16:110,17:[50,51,10,13]},extractor:null},{name:"Ruby",extension:"rb",mime:"application/ruby",description:"",signature:{0:35,1:33,2:47,3:117,4:115,5:114,6:47,7:98,8:105,9:110,10:47,11:114,12:117,13:98,14:121},extractor:null},{name:"perl",extension:"pl,pm,t,pod",mime:"application/perl",description:"",signature:{0:35,1:33,2:47,3:117,4:115,5:114,6:47,7:98,8:105,9:110,10:47,11:112,12:101,13:114,14:108},extractor:null},{name:"php",extension:"php,phtml,php3,php4,php5,php7,phps,php-s,pht,phar",mime:"application/php",description:"",signature:{0:60,1:63,2:112,3:104,4:112},extractor:null},{name:"Smile",extension:"sml",mime:"\tapplication/x-jackson-smile",description:"",signature:{0:58,1:41,2:10},extractor:null},{name:"Lua Bytecode",extension:"luac",mime:"application/x-lua",description:"",signature:{0:27,1:76,2:117,3:97},extractor:null},{name:"WebAssembly binary",extension:"wasm",mime:"application/octet-stream",description:"",signature:{0:0,1:97,2:115,3:109},extractor:null}]};function pt(t,e){var r=new ct(t.slice(e));r.continueUntil([80,75,5,6]),r.moveForwardsBy(20);var n=r.readInt(2,"le");return r.moveForwardsBy(n),r.carve()}function dt(t,e){var r="207250237254",n=new ct(t.slice(e)),i=n.getBytes(4).join("");return n.moveTo(function(t,e,r){var n=28;e&&(n+=4),t.moveTo(16);var i=t.readInt(4,r);return function(t,e,r,n){for(var i=0,s=0;s<n;s++){t.moveTo(e);var a=t.readInt(4,r);25===a?(t.moveTo(e+48),i+=t.readInt(8,r),t.moveTo(e+4),e+=t.readInt(4,r)):1===a&&(t.moveTo(e+36),i+=t.readInt(4,r),t.moveTo(e+4),e+=t.readInt(4,r))}return i}(t,n,r,i)}(n,function(t){return t===r||"254237250207"===t}(i),function(t){return"206250237254"===t||t===r}(i)?"le":"be")),n.carve()}for(var gt=new Array(288),yt=0;yt<gt.length;yt++)gt[yt]=yt<=143?8:yt<=255?9:yt<=279?7:8;var vt=wt(gt),mt=wt(new Array(30).fill(5)),Et=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];function St(t){for(var e=0;!e;){e=t.readBits(1,"le");var r=t.readBits(2,"le");if(0===r){t.moveForwardsBy(1);var n=t.readInt(2,"le");t.moveForwardsBy(2+n)}else if(1===r)At(t,vt,mt);else{if(2!==r)throw new Error(`Invalid block type while parsing DEFLATE stream at pos ${t.position}`);for(var i=t.readBits(5,"le")+257,s=t.readBits(5,"le")+1,a=t.readBits(4,"le")+4,o=new Uint8Array(Et.length),u=0;u<a;u++)o[Et[u]]=t.readBits(3,"le");for(var c=wt(o),l=new Uint8Array(i+s),h=void 0,f=void 0,p=void 0,d=0;d<i+s;)switch(h=xt(t,c)){case 16:for(f=3+t.readBits(2,"le");f--;)l[d++]=p;break;case 17:for(f=3+t.readBits(3,"le");f--;)l[d++]=0;p=0;break;case 18:for(f=11+t.readBits(7,"le");f--;)l[d++]=0;p=0;break;default:l[d++]=h,p=h}At(t,wt(l.subarray(0,i)),wt(l.subarray(i)))}}t.bitPos>0&&t.moveForwardsBy(1)}var bt=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0],Ct=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13];function At(t,e,r){for(var n,i=0;(n=xt(t,e))&&256!==n;){if(++i>1e4)throw new Error("Caught in probable infinite loop while parsing Huffman Block");n<256||(t.readBits(bt[n-257],"le"),n=xt(t,r),t.readBits(Ct[n],"le"))}}function wt(t){for(var e=Math.max.apply(Math,t),r=Math.min.apply(Math,t),n=1<<e,i=new Uint32Array(n),s=1,a=0,o=2;s<=e;){for(var u=0;u<t.length;u++)if(t[u]===s){var c=void 0,l=void 0,h=void 0;for(c=0,l=a,h=0;h<s;h++)c=c<<1|1&l,l>>=1;for(var f=s<<16|u,p=c;p<n;p+=o)i[p]=f;a++}s++,a<<=1,o<<=1}return[i,e,r]}function xt(t,e){var r=ut(e,2),n=r[0],i=r[1],s=n[t.readBits(i,"le")&(1<<i)-1],a=s>>>16;if(a>i)throw new Error(`Invalid Huffman Code length while parsing DEFLATE block at pos ${t.position}: ${a}`);return t.moveBackwardsByBits(i-a),65535&s}function Bt(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(t.length){for(var n=0;n<t.length;n++)if(It(t[n],e,r))return!0;return!1}return It(t,e,r)}function It(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;for(var n in t){var i=parseInt(n,10)+r;switch(typeof t[n]){case"number":if(e[i]!==t[n])return!1;break;case"object":if(t[n].indexOf(e[i])<0)return!1;break;case"function":if(!t[n](e[i]))return!1;break;default:throw new Error(`Unrecognised signature type at offset ${n}`)}}return!0}const Tt=function(){function e(){t(this,e)}return s(e,null,[{key:"checkForValue",value:function(t){if(void 0===t)throw new Error("only use translation methods with .bind")}},{key:"toArrayBuffer",value:function(){throw new Error("toArrayBuffer has not been implemented")}},{key:"fromArrayBuffer",value:function(){throw new Error("fromArrayBuffer has not been implemented")}}]),e}();function Ft(t,e,r){return e=u(e),o(t,Rt()?Reflect.construct(e,r||[],u(t).constructor):e.apply(t,r))}function Rt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Rt=function(){return!!t})()}const Nt=function(e){function r(){return t(this,r),Ft(this,r,arguments)}return l(r,e),s(r,null,[{key:"toArrayBuffer",value:function(){r.checkForValue(this.value),this.value=new Uint8Array(this.value).buffer}},{key:"fromArrayBuffer",value:function(){r.checkForValue(this.value),this.value=Array.prototype.slice.call(new Uint8Array(this.value))}}]),r}(Tt);function Dt(t,e,r){return e=u(e),o(t,Pt()?Reflect.construct(e,r||[],u(t).constructor):e.apply(t,r))}function Pt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Pt=function(){return!!t})()}const kt=function(e){function r(){return t(this,r),Dt(this,r,arguments)}return l(r,e),s(r,null,[{key:"toArrayBuffer",value:function(){r.checkForValue(this.value),this.value=ot.isBigNumber(this.value)?U.strToArrayBuffer(this.value.toFixed()):new ArrayBuffer}},{key:"fromArrayBuffer",value:function(){r.checkForValue(this.value);try{this.value=new ot(U.arrayBufferToStr(this.value))}catch(t){this.value=new ot(NaN)}}}]),r}(Tt);function Lt(t,e,r){return e=u(e),o(t,Ot()?Reflect.construct(e,r||[],u(t).constructor):e.apply(t,r))}function Ot(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ot=function(){return!!t})()}const _t=function(e){function r(){return t(this,r),Lt(this,r,arguments)}return l(r,e),s(r,null,[{key:"toArrayBuffer",value:function(){var t=this;if(r.checkForValue(this.value),!L())return new Promise((function(e,r){U.readFile(t.value).then((function(e){return t.value=e.buffer})).then(e).catch(r)}));this.value=U.readFileSync(this.value)}},{key:"fromArrayBuffer",value:function(){r.checkForValue(this.value),this.value=new File(this.value,"unknown")}}]),r}(Tt);function Ut(t,e,r){return e=u(e),o(t,Vt()?Reflect.construct(e,r||[],u(t).constructor):e.apply(t,r))}function Vt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Vt=function(){return!!t})()}const Ht=function(e){function r(){return t(this,r),Ut(this,r,arguments)}return l(r,e),s(r,null,[{key:"toArrayBuffer",value:function(){r.checkForValue(this.value),this.value=this.value?U.strToArrayBuffer(this.value):new ArrayBuffer}},{key:"fromArrayBuffer",value:function(){r.checkForValue(this.value),this.value=this.value?U.arrayBufferToStr(this.value):""}}]),r}(Tt);function Kt(t,e,r){return e=u(e),o(t,jt()?Reflect.construct(e,r||[],u(t).constructor):e.apply(t,r))}function jt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(jt=function(){return!!t})()}const Mt=function(e){function r(){return t(this,r),Kt(this,r,arguments)}return l(r,e),s(r,null,[{key:"toArrayBuffer",value:function(){r.checkForValue(this.value),this.value=this.value?U.strToArrayBuffer(U.unescapeHtml(U.stripHtmlTags(this.value,!0))):new ArrayBuffer}}]),r}(Ht);function qt(t,e,r){return e=u(e),o(t,Gt()?Reflect.construct(e,r||[],u(t).constructor):e.apply(t,r))}function Gt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Gt=function(){return!!t})()}const zt=function(e){function r(){return t(this,r),qt(this,r,arguments)}return l(r,e),s(r,null,[{key:"toArrayBuffer",value:function(){r.checkForValue(this.value),this.value=void 0!==this.value?U.strToArrayBuffer(JSON.stringify(this.value,null,4)):new ArrayBuffer}},{key:"fromArrayBuffer",value:function(){r.checkForValue(this.value),this.value=JSON.parse(U.arrayBufferToStr(this.value))}}]),r}(Tt);function Wt(t,e,r){return e=u(e),o(t,$t()?Reflect.construct(e,r||[],u(t).constructor):e.apply(t,r))}function $t(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return($t=function(){return!!t})()}const Yt=function(e){function r(){return t(this,r),Wt(this,r,arguments)}var n,i;return l(r,e),s(r,null,[{key:"toArrayBuffer",value:(i=p(g().mark((function t(){return g().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r.checkForValue(this.value),!L()){t.next=5;break}this.value=this.value.map((function(t){return Uint8Array.from(t.data)})),t.next=8;break;case 5:return t.next=7,r.concatenateTypedArraysWithTypedElements.apply(r,m(this.value));case 7:this.value=t.sent;case 8:case"end":return t.stop()}}),t,this)}))),function(){return i.apply(this,arguments)})},{key:"fromArrayBuffer",value:function(){r.checkForValue(this.value),this.value=[new File(this.value,"unknown")]}},{key:"concatenateTypedArraysWithTypedElements",value:(n=p(g().mark((function t(){var e,r,n,i,s,a,o,u,c,l,h,f,p,d=arguments;return g().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(e=0,r=d.length,n=new Array(r),i=0;i<r;i++)n[i]=d[i];for(s=0,a=n;s<a.length;s++)o=a[s],e+=o.size;u=new Uint8Array(e),c=0,l=0,h=n;case 6:if(!(l<h.length)){t.next=16;break}return f=h[l],t.next=10,U.readFile(f);case 10:p=t.sent,u.set(p,c),c+=p.length;case 13:l++,t.next=6;break;case 16:return t.abrupt("return",u);case 17:case"end":return t.stop()}}),t)}))),function(){return n.apply(this,arguments)})},{key:"concatenateTypedArrays",value:function(){for(var t=0,e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];for(var i=0,s=r;i<s.length;i++)t+=s[i].length;for(var a=new Uint8Array(t),o=0,u=0,c=r;u<c.length;u++){var l=c[u];a.set(l,o),o+=l.length}return a}}]),r}(Tt);function Qt(t,e,r){return e=u(e),o(t,Xt()?Reflect.construct(e,r||[],u(t).constructor):e.apply(t,r))}function Xt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Xt=function(){return!!t})()}const Jt=function(e){function r(){return t(this,r),Qt(this,r,arguments)}return l(r,e),s(r,null,[{key:"toArrayBuffer",value:function(){r.checkForValue(this.value),this.value="number"==typeof this.value?U.strToArrayBuffer(this.value.toString()):new ArrayBuffer}},{key:"fromArrayBuffer",value:function(){r.checkForValue(this.value),this.value=this.value?parseFloat(U.arrayBufferToStr(this.value)):0}}]),r}(Tt);var Zt=function(){function e(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t(this,e),this.value=new ArrayBuffer(0),this.type=e.ARRAY_BUFFER,r&&Object.prototype.hasOwnProperty.call(r,"value")&&Object.prototype.hasOwnProperty.call(r,"type"))this.set(r.value,r.type);else if(r&&null!==n)this.set(r,n);else if(r){var i=e.typeEnum(r.constructor.name);this.set(r,i)}}var r;return s(e,[{key:"get",value:function(t){var r=this;return"string"==typeof t&&(t=e.typeEnum(t)),this.type!==t?L()?(this._translate(t),this.value):new Promise((function(e,n){r._translate(t).then((function(){e(r.value)})).catch(n)})):this.value}},{key:"set",value:function(t,r){if("string"==typeof r&&(r=e.typeEnum(r)),S().debug("Dish type: "+e.enumLookup(r)),this.value=t,this.type=r,!this.valid()){var n=U.truncate(JSON.stringify(this.value),25);throw new K(`Data is not a valid ${e.enumLookup(r)}: ${n}`)}}},{key:"presentAs",value:function(t){return this.clone().get(t)}},{key:"detectDishType",value:function(){var t=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Object.keys(ft);if(t instanceof ArrayBuffer&&(t=new Uint8Array(t)),!(t&&t.length>1))return[];var r=[],n={};for(var i in ft)e.includes(i)&&(n[i]=ft[i]);for(var s in n)n[s].forEach((function(e){Bt(e.signature,t)&&r.push(e)}));return r}(new Uint8Array(this.value.slice(0,2048)));return t.length&&t[0].mime&&"text/plain"===t[0].mime?t[0].mime:null}},{key:"getTitle",value:(r=p(g().mark((function t(r){var n,i;return g().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n="",t.t0=this.type,t.next=t.t0===e.FILE?4:t.t0===e.LIST_FILE?6:t.t0===e.JSON?8:t.t0===e.NUMBER||t.t0===e.BIG_NUMBER?10:t.t0===e.ARRAY_BUFFER||t.t0===e.BYTE_ARRAY?12:15;break;case 4:return n=this.value.name,t.abrupt("break",26);case 6:return n=`${this.value.length} file(s)`,t.abrupt("break",26);case 8:return n="application/json",t.abrupt("break",26);case 10:return n=this.value.toString(),t.abrupt("break",26);case 12:if(null===(n=this.detectDishType())){t.next=15;break}return t.abrupt("break",26);case 15:return t.prev=15,(i=this.clone()).value=i.value.slice(0,256),t.next=20,i.get(e.STRING);case 20:n=t.sent,t.next=26;break;case 23:t.prev=23,t.t1=t.catch(15),S().error(`${e.enumLookup(this.type)} cannot be sliced. ${t.t1}`);case 26:return t.abrupt("return",n.slice(0,r));case 27:case"end":return t.stop()}}),t,this,[[15,23]])}))),function(t){return r.apply(this,arguments)})},{key:"valid",value:function(){switch(this.type){case e.BYTE_ARRAY:if(!(this.value instanceof Uint8Array||this.value instanceof Array))return!1;for(var t=0;t<this.value.length;t++)if("number"!=typeof this.value[t]||this.value[t]<0||this.value[t]>255)return!1;return!0;case e.STRING:case e.HTML:return"string"==typeof this.value;case e.NUMBER:return"number"==typeof this.value;case e.ARRAY_BUFFER:return this.value instanceof ArrayBuffer;case e.BIG_NUMBER:if(ot.isBigNumber(this.value))return!0;if(Object.keys(this.value).sort().equals(["c","e","s"])){var r=new ot;return r.c=this.value.c,r.e=this.value.e,r.s=this.value.s,this.value=r,!0}return!1;case e.JSON:return!0;case e.FILE:return this.value instanceof File;case e.LIST_FILE:return this.value instanceof Array&&this.value.reduce((function(t,e){return t&&e instanceof File}),!0);default:return!1}}},{key:"size",get:function(){switch(this.type){case e.BYTE_ARRAY:case e.STRING:case e.HTML:return this.value.length;case e.NUMBER:case e.BIG_NUMBER:return this.value.toString().length;case e.ARRAY_BUFFER:return this.value.byteLength;case e.JSON:return JSON.stringify(this.value).length;case e.FILE:return this.value.size;case e.LIST_FILE:return this.value.reduce((function(t,e){return t+e.size}),0);default:return-1}}},{key:"clone",value:function(){var t=new e;switch(this.type){case e.STRING:case e.HTML:case e.NUMBER:case e.BIG_NUMBER:t.set(this.value,this.type);break;case e.BYTE_ARRAY:case e.JSON:t.set(JSON.parse(JSON.stringify(this.value)),this.type);break;case e.ARRAY_BUFFER:t.set(this.value.slice(0),this.type);break;case e.FILE:t.set(new File([this.value],this.value.name,{type:this.value.type,lastModified:this.value.lastModified}),this.type);break;case e.LIST_FILE:t.set(this.value.map((function(t){return new File([t],t.name,{type:t.type,lastModified:t.lastModified})})),this.type);break;default:throw new K("Cannot clone Dish, unknown type")}return t}},{key:"_translate",value:function(t){var r=this;if(S().debug(`Translating Dish from ${e.enumLookup(this.type)} to ${e.enumLookup(t)}`),!L())return new Promise((function(n,i){r._toArrayBuffer().then((function(){return r.type=e.ARRAY_BUFFER})).then((function(){r._fromArrayBuffer(t),n()})).catch(i)}));this._toArrayBuffer(),this.type=e.ARRAY_BUFFER,this._fromArrayBuffer(t)}},{key:"_toArrayBuffer",value:function(){var t=this,r={browser:{[e.STRING]:function(){return Promise.resolve(Ht.toArrayBuffer.bind(t)())},[e.NUMBER]:function(){return Promise.resolve(Jt.toArrayBuffer.bind(t)())},[e.HTML]:function(){return Promise.resolve(Mt.toArrayBuffer.bind(t)())},[e.ARRAY_BUFFER]:function(){return Promise.resolve()},[e.BIG_NUMBER]:function(){return Promise.resolve(kt.toArrayBuffer.bind(t)())},[e.JSON]:function(){return Promise.resolve(zt.toArrayBuffer.bind(t)())},[e.FILE]:function(){return _t.toArrayBuffer.bind(t)()},[e.LIST_FILE]:function(){return Promise.resolve(Yt.toArrayBuffer.bind(t)())},[e.BYTE_ARRAY]:function(){return Promise.resolve(Nt.toArrayBuffer.bind(t)())}},node:{[e.STRING]:function(){return Ht.toArrayBuffer.bind(t)()},[e.NUMBER]:function(){return Jt.toArrayBuffer.bind(t)()},[e.HTML]:function(){return Mt.toArrayBuffer.bind(t)()},[e.ARRAY_BUFFER]:function(){},[e.BIG_NUMBER]:function(){return kt.toArrayBuffer.bind(t)()},[e.JSON]:function(){return zt.toArrayBuffer.bind(t)()},[e.FILE]:function(){return _t.toArrayBuffer.bind(t)()},[e.LIST_FILE]:function(){return Yt.toArrayBuffer.bind(t)()},[e.BYTE_ARRAY]:function(){return Nt.toArrayBuffer.bind(t)()}}};try{return r[L()?"node":"browser"][this.type]()}catch(t){throw new K(`Error translating from ${e.enumLookup(this.type)} to ArrayBuffer: ${t}`)}}},{key:"_fromArrayBuffer",value:function(t){var r=this,n={[e.STRING]:function(){return Ht.fromArrayBuffer.bind(r)()},[e.NUMBER]:function(){return Jt.fromArrayBuffer.bind(r)()},[e.HTML]:function(){return Mt.fromArrayBuffer.bind(r)()},[e.ARRAY_BUFFER]:function(){},[e.BIG_NUMBER]:function(){return kt.fromArrayBuffer.bind(r)()},[e.JSON]:function(){return zt.fromArrayBuffer.bind(r)()},[e.FILE]:function(){return _t.fromArrayBuffer.bind(r)()},[e.LIST_FILE]:function(){return Yt.fromArrayBuffer.bind(r)()},[e.BYTE_ARRAY]:function(){return Nt.fromArrayBuffer.bind(r)()}};try{n[t](),this.type=t}catch(r){throw new K(`Error translating from ArrayBuffer to ${e.enumLookup(t)}: ${r}`)}}}],[{key:"typeEnum",value:function(t){switch(t.toLowerCase()){case"bytearray":case"byte array":return e.BYTE_ARRAY;case"string":return e.STRING;case"number":return e.NUMBER;case"html":return e.HTML;case"arraybuffer":case"array buffer":return e.ARRAY_BUFFER;case"bignumber":case"big number":return e.BIG_NUMBER;case"json":case"object":return e.JSON;case"file":return e.FILE;case"list<file>":return e.LIST_FILE;default:throw new K("Invalid data type string. No matching enum.")}}},{key:"enumLookup",value:function(t){switch(t){case e.BYTE_ARRAY:return"byteArray";case e.STRING:return"string";case e.NUMBER:return"number";case e.HTML:return"html";case e.ARRAY_BUFFER:return"ArrayBuffer";case e.BIG_NUMBER:return"BigNumber";case e.JSON:return"JSON";case e.FILE:return"File";case e.LIST_FILE:return"List<File>";default:throw new K("Invalid data type enum. No matching type.")}}}]),e}();Zt.BYTE_ARRAY=0,Zt.STRING=1,Zt.NUMBER=2,Zt.HTML=3,Zt.ARRAY_BUFFER=4,Zt.BIG_NUMBER=5,Zt.JSON=6,Zt.FILE=7,Zt.LIST_FILE=8;const te=Zt,ee=function(){function e(r){t(this,e),this.name="",this.type="",this._value=null,this.disabled=!1,this.hint="",this.rows=0,this.toggleValues=[],this.target=null,this.defaultIndex=0,this.maxLength=null,this.min=null,this.max=null,this.step=1,r&&this._parseConfig(r)}return s(e,[{key:"_parseConfig",value:function(t){this.name=t.name,this.type=t.type,this.defaultValue=t.value,this.disabled=!!t.disabled,this.hint=t.hint||!1,this.rows=t.rows||!1,this.toggleValues=t.toggleValues,this.target=void 0!==t.target?t.target:null,this.defaultIndex=void 0!==t.defaultIndex?t.defaultIndex:0,this.maxLength=t.maxLength||null,this.min=t.min,this.max=t.max,this.step=t.step}},{key:"config",get:function(){return this._value}},{key:"value",get:function(){return this._value},set:function(t){this._value=e.prepare(t,this.type)}}],[{key:"prepare",value:function(t,e){var r;switch(e){case"binaryString":case"binaryShortString":case"editableOption":case"editableOptionShort":return U.parseEscapedChars(t);case"byteArray":return"string"==typeof t?F(t=t.replace(/\s+/g,"")):t;case"number":if(null===t)return t;if(r=parseFloat(t),isNaN(r))throw"Invalid ingredient value. Not a number: "+U.truncate(t.toString(),10);return r;default:return t}}}]),e}();var re=function(){function e(){t(this,e),this._inputType=-1,this._outputType=-1,this._presentType=-1,this._breakpoint=!1,this._disabled=!1,this._flowControl=!1,this._manualBake=!1,this._ingList=[],this.name="",this.module="",this.description="",this.infoURL=null}return s(e,[{key:"run",value:function(t,e){return t}},{key:"highlight",value:function(t,e){return!1}},{key:"highlightReverse",value:function(t,e){return!1}},{key:"present",value:function(t,e){return t}},{key:"inputType",get:function(){return te.enumLookup(this._inputType)},set:function(t){this._inputType=te.typeEnum(t)}},{key:"outputType",get:function(){return te.enumLookup(this._outputType)},set:function(t){this._outputType=te.typeEnum(t),this._presentType<0&&(this._presentType=this._outputType)}},{key:"presentType",get:function(){return te.enumLookup(this._presentType)},set:function(t){this._presentType=te.typeEnum(t)}},{key:"args",get:function(){return this._ingList.map((function(t){var e={name:t.name,type:t.type,value:t.defaultValue};return t.toggleValues&&(e.toggleValues=t.toggleValues),t.hint&&(e.hint=t.hint),t.rows&&(e.rows=t.rows),t.disabled&&(e.disabled=t.disabled),t.target&&(e.target=t.target),t.defaultIndex&&(e.defaultIndex=t.defaultIndex),t.maxLength&&(e.maxLength=t.maxLength),"number"==typeof t.min&&(e.min=t.min),"number"==typeof t.max&&(e.max=t.max),t.step&&(e.step=t.step),e}))},set:function(t){var e=this;t.forEach((function(t){var r=new ee(t);e.addIngredient(r)}))}},{key:"config",get:function(){return{op:this.name,args:this._ingList.map((function(t){return t.config}))}}},{key:"addIngredient",value:function(t){this._ingList.push(t)}},{key:"ingValues",get:function(){return this._ingList.map((function(t){return t.value}))},set:function(t){var e=this;t.forEach((function(t,r){e._ingList[r].value=t}))}},{key:"breakpoint",get:function(){return this._breakpoint},set:function(t){this._breakpoint=!!t}},{key:"disabled",get:function(){return this._disabled},set:function(t){this._disabled=!!t}},{key:"flowControl",get:function(){return this._flowControl},set:function(t){this._flowControl=!!t}},{key:"manualBake",get:function(){return this._manualBake},set:function(t){this._manualBake=!!t}}]),e}();const ne=re;function ie(t,e,r){return e=u(e),o(t,se()?Reflect.construct(e,r||[],u(t).constructor):e.apply(t,r))}function se(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(se=function(){return!!t})()}const ae=function(e){function r(){var e;return t(this,r),(e=ie(this,r)).name="Hex to Object Identifier",e.module="PublicKey",e.description="Converts a hexadecimal string into an object identifier (OID).",e.infoURL="https://wikipedia.org/wiki/Object_identifier",e.inputType="string",e.outputType="string",e.args=[],e}return l(r,e),s(r,[{key:"run",value:function(t,e){return h.lK.asn1.ASN1Util.oidHexToInt(t.replace(/\s/g,""))}}]),r}(ne);function oe(t,e,r){return e=u(e),o(t,ue()?Reflect.construct(e,r||[],u(t).constructor):e.apply(t,r))}function ue(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ue=function(){return!!t})()}const ce=function(e){function r(){var e;return t(this,r),(e=oe(this,r)).name="Hex to PEM",e.module="PublicKey",e.description="Converts a hexadecimal DER (Distinguished Encoding Rules) string into PEM (Privacy Enhanced Mail) format.",e.infoURL="https://wikipedia.org/wiki/Privacy-Enhanced_Mail",e.inputType="string",e.outputType="string",e.args=[{name:"Header string",type:"string",value:"CERTIFICATE"}],e}return l(r,e),s(r,[{key:"run",value:function(t,e){return h.lK.asn1.ASN1Util.getPEMStringFromHex(t.replace(/\s/g,""),e[0])}}]),r}(ne);function le(t,e,r){return e=u(e),o(t,he()?Reflect.construct(e,r||[],u(t).constructor):e.apply(t,r))}function he(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(he=function(){return!!t})()}var fe=function(e){function r(){var e;return t(this,r),(e=le(this,r)).name="JWK to PEM",e.module="PublicKey",e.description="Converts Keys in JSON Web Key format to PEM format (PKCS#8).",e.infoURL="https://datatracker.ietf.org/doc/html/rfc7517",e.inputType="string",e.outputType="string",e.args=[],e.checks=[{pattern:'"kty":\\s*"(EC|RSA)"',flags:"gm",args:[]}],e}return l(r,e),s(r,[{key:"run",value:function(t,e){var r=JSON.parse(t),n=[];if(Array.isArray(r))n=r;else if(Array.isArray(r.keys))n=r.keys;else{if("object"!=typeof r)throw new x("Input is not a JSON Web Key");n.push(r)}for(var i="",s=0;s<n.length;s++){var a=n[s];if("string"!=typeof a.kty)throw new x("Invalid JWK format");if(-1==="|RSA|EC|".indexOf(a.kty))throw new x(`Unsupported JWK key type '${r.kty}'`);var o=h.AD.getKey(a);i+=o.isPrivate?h.AD.getPEM(o,"PKCS8PRV"):h.AD.getPEM(o)}return i}}]),r}(ne);const pe=fe;function de(t,e,r){return e=u(e),o(t,ge()?Reflect.construct(e,r||[],u(t).constructor):e.apply(t,r))}function ge(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(ge=function(){return!!t})()}const ye=function(e){function r(){var e;return t(this,r),(e=de(this,r)).name="Object Identifier to Hex",e.module="PublicKey",e.description="Converts an object identifier (OID) into a hexadecimal string.",e.infoURL="https://wikipedia.org/wiki/Object_identifier",e.inputType="string",e.outputType="string",e.args=[],e}return l(r,e),s(r,[{key:"run",value:function(t,e){return h.lK.asn1.ASN1Util.oidIntToHex(t)}}]),r}(ne);function ve(t,e,r){return e=u(e),o(t,me()?Reflect.construct(e,r||[],u(t).constructor):e.apply(t,r))}function me(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(me=function(){return!!t})()}var Ee=function(e){function r(){var e;return t(this,r),(e=ve(this,r)).name="PEM to JWK",e.module="PublicKey",e.description="Converts Keys in PEM format to a JSON Web Key format.",e.infoURL="https://datatracker.ietf.org/doc/html/rfc7517",e.inputType="string",e.outputType="string",e.args=[],e.checks=[{pattern:"-----BEGIN ((RSA |EC )?(PRIVATE|PUBLIC) KEY|CERTIFICATE)-----",args:[]}],e}return l(r,e),s(r,[{key:"run",value:function(t,e){for(var r,n="",i=/-----BEGIN ([A-Z][A-Z ]+[A-Z])-----/g;null!==(r=i.exec(t));){var s=r.index+r[0].length,a=t.substring(r.index,s),o=`-----END ${r[1]}-----`,u=t.indexOf(o,s);if(-1===u)throw new x(`PEM footer '${o}' not found`);var c=t.substring(r.index,u+o.length);if(-1!==r[1].indexOf("KEY")){if("-----BEGIN RSA PUBLIC KEY-----"===a)throw new x("Unsupported RSA public key format. Only PKCS#8 is supported.");var l=h.AD.getKey(c);if("DSA"===l.type)throw new x("DSA keys are not supported for JWK");var f=h.AD.getJWKFromKey(l);n.length>0&&(n+="\n"),n+=JSON.stringify(f)}else{if("CERTIFICATE"!==r[1])throw new x(`Unsupported PEM type '${r[1]}'`);var p=new h.EF;p.readCertPEM(c);var d=p.getPublicKey(),g=h.AD.getJWKFromKey(d);n.length>0&&(n+="\n"),n+=JSON.stringify(g)}}return n}}]),r}(ne);const Se=Ee;function be(t,e,r){return e=u(e),o(t,Ce()?Reflect.construct(e,r||[],u(t).constructor):e.apply(t,r))}function Ce(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ce=function(){return!!t})()}const Ae=function(e){function r(){var e;return t(this,r),(e=be(this,r)).name="Parse ASN.1 hex string",e.module="PublicKey",e.description="Abstract Syntax Notation One (ASN.1) is a standard and notation that describes rules and structures for representing, encoding, transmitting, and decoding data in telecommunications and computer networking.<br><br>This operation parses arbitrary ASN.1 data (encoded as an hex string: use the 'To Hex' operation if necessary) and presents the resulting tree.",e.infoURL="https://wikipedia.org/wiki/Abstract_Syntax_Notation_One",e.inputType="string",e.outputType="string",e.args=[{name:"Starting index",type:"number",value:0},{name:"Truncate octet strings longer than",type:"number",value:32}],e}return l(r,e),s(r,[{key:"run",value:function(t,e){var r=ut(e,2),n=r[0],i=r[1];return h.g5.dump(t.replace(/\s/g,"").toLowerCase(),{ommit_long_octet:i},n)}}]),r}(ne);var we=r(68212),xe=r.n(we);function Be(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=function(t,e){if(t){if("string"==typeof t)return Ie(t,e);var r=Object.prototype.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?Ie(t,e):void 0}}(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,i=function(){};return{s:i,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:i}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var s,a=!0,o=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){o=!0,s=t},f:function(){try{a||null==r.return||r.return()}finally{if(o)throw s}}}}function Ie(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function Te(t,e,r){return e=u(e),o(t,Fe()?Reflect.construct(e,r||[],u(t).constructor):e.apply(t,r))}function Fe(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Fe=function(){return!!t})()}function Re(t){for(var e=[],r=t;""!==r;r=r.substring(48))e.push(r.substring(0,48));return e.join("\n ")}function Ne(t){var e=[];return e.push(`CA = ${t.cA}`),void 0!==t.pathLenConstraint&&e.push(`PathLenConstraint = ${t.pathLenConstraint}`),e}function De(t){var e=[];return t.digitalSignature&&e.push("Digital signature"),t.nonRepudiation&&e.push("Non-repudiation"),t.keyEncipherment&&e.push("Key encipherment"),t.dataEncipherment&&e.push("Data encipherment"),t.keyAgreement&&e.push("Key agreement"),t.keyCertSign&&e.push("Key certificate signing"),t.cRLSign&&e.push("CRL signing"),t.encipherOnly&&e.push("Encipher only"),t.decipherOnly&&e.push("Decipher only"),0===e.length&&e.push("(none)"),e}function Pe(t){var e=[];return t.serverAuth&&e.push("TLS Web Server Authentication"),t.clientAuth&&e.push("TLS Web Client Authentication"),t.codeSigning&&e.push("Code signing"),t.emailProtection&&e.push("E-mail Protection (S/MIME)"),t.timeStamping&&e.push("Trusted Timestamping"),t.msCodeInd&&e.push("Microsoft Individual Code Signing"),t.msCodeCom&&e.push("Microsoft Commercial Code Signing"),t.msCTLSign&&e.push("Microsoft Trust List Signing"),t.msSGC&&e.push("Microsoft Server Gated Crypto"),t.msEFS&&e.push("Microsoft Encrypted File System"),t.nsSGC&&e.push("Netscape Server Gated Crypto"),0===e.length&&e.push("(none)"),e}function ke(t,e){var r=" ".repeat(t);return r+e.join("\n"+r)+"\n"}function Le(t){return t.substring(0,t.length-1)}const Oe=function(e){function r(){var e;return t(this,r),(e=Te(this,r)).name="Parse CSR",e.module="PublicKey",e.description="Parse Certificate Signing Request (CSR) for an X.509 certificate",e.infoURL="https://wikipedia.org/wiki/Certificate_signing_request",e.inputType="string",e.outputType="string",e.args=[{name:"Input format",type:"option",value:["PEM"]},{name:"Key type",type:"option",value:["RSA"]},{name:"Strict ASN.1 value lengths",type:"boolean",value:!0}],e.checks=[{pattern:"^-+BEGIN CERTIFICATE REQUEST-+\\r?\\n[\\da-z+/\\n\\r]+-+END CERTIFICATE REQUEST-+\\r?\\n?$",flags:"i",args:["PEM"]}],e}return l(r,e),s(r,[{key:"run",value:function(t,e){if(!t.length)return"No input";var r=xe().pki.certificationRequestFromPem(t,e[1]);return`Version: ${1+r.version} (0x${U.hex(r.version)})\nSubject${function(t){var e,r="\n",n=Be(t.attributes);try{for(n.s();!(e=n.n()).done;){var i=e.value;r+=` ${i.shortName} = ${i.value}\n`}}catch(t){n.e(t)}finally{n.f()}return Le(r)}(r.subject)}\nSubject Alternative Names${function(t){var e,r="\n",n=Be(t.attributes);try{for(n.s();!(e=n.n()).done;){var i,s=Be(e.value.extensions);try{for(s.s();!(i=s.n()).done;){var a=i.value;if("subjectAltName"===a.name){var o,u=[],c=Be(a.altNames);try{for(c.s();!(o=c.n()).done;){var l=o.value;switch(l.type){case 1:u.push(`EMAIL: ${l.value}`);break;case 2:u.push(`DNS: ${l.value}`);break;case 6:u.push(`URI: ${l.value}`);break;case 7:u.push(`IP: ${l.ip}`);break;default:u.push(`(unable to format type ${l.type} name)\n`)}}}catch(t){c.e(t)}finally{c.f()}r+=ke(2,u)}}}catch(t){s.e(t)}finally{s.f()}}}catch(t){n.e(t)}finally{n.f()}return Le(r)}(r)}\nPublic Key\n Algorithm: RSA\n Length: ${r.publicKey.n.bitLength()} bits\n Modulus: ${Re(Le(r.publicKey.n.toString(16).replace(/(..)/g,"$&:")))}\n Exponent: ${r.publicKey.e} (0x${U.hex(r.publicKey.e)})\nSignature\n Algorithm: ${xe().pki.oids[r.signatureOid]}\n Signature: ${Re(U.strToByteArray(r.signature).map((function(t){return U.hex(t)})).join(":"))}\nExtensions${function(t){var e,r="\n",n=Be(t.attributes);try{for(n.s();!(e=n.n()).done;){var i,s=Be(e.value.extensions);try{for(s.s();!(i=s.n()).done;){var a=i.value;if("subjectAltName"!==a.name){r+=` ${a.name}${a.critical?" CRITICAL":""}:\n`;var o=[];switch(a.name){case"basicConstraints":o=Ne(a);break;case"keyUsage":o=De(a);break;case"extKeyUsage":o=Pe(a);break;default:o=["(unable to format extension)"]}r+=ke(4,o)}}}catch(t){s.e(t)}finally{s.f()}}}catch(t){n.e(t)}finally{n.f()}return Le(r)}(r)}`}}]),r}(ne);function _e(t,e){for(var r="",n=t.array.reduce((function(t,e){return e[0].type.length>t?e[0].type.length:t}),0),i=0;i<t.array.length;i++)if(t.array[i].length){var s=t.array[i][0].type,a=t.array[i][0].value,o=`${s.padEnd(n," ")} = ${a}\n`;r+=o.padStart(e+o.length," ")}return r.slice(0,-1)}function Ue(t,e,r){t=T(F(t),":"),e*=3;for(var n="",i=0;i<t.length;i+=e){var s=t.slice(i,i+e)+"\n";n+=0===i?s:s.padStart(r+s.length," ")}return n.slice(0,n.length-1)}function Ve(t,e,r){return e=u(e),o(t,He()?Reflect.construct(e,r||[],u(t).constructor):e.apply(t,r))}function He(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(He=function(){return!!t})()}var Ke=function(e){function r(){var e;return t(this,r),(e=Ve(this,r)).name="Parse X.509 certificate",e.module="PublicKey",e.description="X.509 is an ITU-T standard for a public key infrastructure (PKI) and Privilege Management Infrastructure (PMI). It is commonly involved with SSL/TLS security.<br><br>This operation displays the contents of a certificate in a human readable format, similar to the openssl command line tool.<br><br>Tags: X509, server hello, handshake",e.infoURL="https://wikipedia.org/wiki/X.509",e.inputType="string",e.outputType="string",e.args=[{name:"Input format",type:"option",value:["PEM","DER Hex","Base64","Raw"]}],e.checks=[{pattern:"^-+BEGIN CERTIFICATE-+\\r?\\n[\\da-z+/\\n\\r]+-+END CERTIFICATE-+\\r?\\n?$",flags:"i",args:["PEM"]}],e}return l(r,e),s(r,[{key:"run",value:function(t,e){if(!t.length)return"No input";var r=new h.EF,n=e[0],i=!1;try{switch(n){case"DER Hex":t=t.replace(/\s/g,"").toLowerCase(),r.readCertHex(t);break;case"PEM":r.readCertPEM(t);break;case"Base64":r.readCertHex(T(I(t,null,"byteArray"),""));break;case"Raw":r.readCertHex(T(U.strToArrayBuffer(t),""));break;default:i=!0}}catch(t){throw"Certificate load error (non-certificate input?)"}if(i)throw"Undefined input format";var s,a=r.getSerialNumberHex(),o=r.getIssuer(),u=r.getSubject(),c=r.getPublicKey(),l=[],f=r.getSignatureValueHex(),p="",d="";l.push({key:"Algorithm",value:c.type}),"EC"===c.type?(l.push({key:"Curve Name",value:c.curveName}),l.push({key:"Length",value:(new h.kb(c.pubKeyHex,16).bitLength()-3)/2+" bits"}),l.push({key:"pub",value:Ue(c.pubKeyHex,16,18)})):"DSA"===c.type?(l.push({key:"pub",value:Ue(c.y.toString(16),16,18)}),l.push({key:"P",value:Ue(c.p.toString(16),16,18)}),l.push({key:"Q",value:Ue(c.q.toString(16),16,18)}),l.push({key:"G",value:Ue(c.g.toString(16),16,18)})):c.e?(l.push({key:"Length",value:c.n.bitLength()+" bits"}),l.push({key:"Modulus",value:Ue(c.n.toString(16),16,18)}),l.push({key:"Exponent",value:c.e+" (0x"+c.e.toString(16)+")"})):l.push({key:"Error",value:"Unknown Public Key type"});for(var g=0;g<l.length;g++)p+=` ${l[g].key}:${(l[g].value+"\n").padStart(18-(l[g].key.length+3)+l[g].value.length+1," ")}`;var y=!1;try{y=0===h.g5.dump(f).indexOf("SEQUENCE")}catch(t){}s=y?` r: ${Ue(h.g5.getV(f,4),16,18)}\n s: ${Ue(h.g5.getV(f,48),16,18)}`:` Signature: ${Ue(f,16,18)}`;try{d=r.getInfo().split("X509v3 Extensions:\n")[1].split("signature")[0]}catch(t){}var v=_e(o,2),m=je(r.getNotBefore()),E=je(r.getNotAfter()),S=_e(u,2);return`Version: ${r.version} (0x${U.hex(r.version-1)})\nSerial number: ${new h.kb(a,16).toString()} (0x${a})\nAlgorithm ID: ${r.getSignatureAlgorithmField()}\nValidity\n Not Before: ${m} (dd-mm-yyyy hh:mm:ss) (${r.getNotBefore()})\n Not After: ${E} (dd-mm-yyyy hh:mm:ss) (${r.getNotAfter()})\nIssuer\n${v}\nSubject\n${S}\nPublic Key\n${p.slice(0,-1)}\nCertificate Signature\n Algorithm: ${r.getSignatureAlgorithmName()}\n${s}\n\nExtensions\n${d}`}}]),r}(ne);function je(t){return 13===t.length&&(t=(t[0]<"5"?"20":"19")+t),t[6]+t[7]+"/"+t[4]+t[5]+"/"+t[0]+t[1]+t[2]+t[3]+" "+t[8]+t[9]+":"+t[10]+t[11]+":"+t[12]+t[13]}const Me=Ke;function qe(t,e,r){return e=u(e),o(t,Ge()?Reflect.construct(e,r||[],u(t).constructor):e.apply(t,r))}function Ge(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ge=function(){return!!t})()}const ze=function(e){function r(){var e;return t(this,r),(e=qe(this,r)).name="Public Key from Certificate",e.module="PublicKey",e.description="Extracts the Public Key from a Certificate.",e.infoURL="https://en.wikipedia.org/wiki/X.509",e.inputType="string",e.outputType="string",e.args=[],e.checks=[],e}return l(r,e),s(r,[{key:"run",value:function(t,e){for(var r,n="",i=/-----BEGIN CERTIFICATE-----/g;null!==(r=i.exec(t));){var s=r.index+r[0].length,a="-----END CERTIFICATE-----",o=t.indexOf(a,s);if(-1===o)throw new x(`PEM footer '${a}' not found`);var u=t.substring(r.index,o+25),c=new h.EF;c.readCertPEM(u);var l=void 0;try{l=c.getPublicKey()}catch(t){throw new x("Unsupported public key type")}n+=h.AD.getPEM(l)}return n}}]),r}(ne);function We(t,e,r){return e=u(e),o(t,$e()?Reflect.construct(e,r||[],u(t).constructor):e.apply(t,r))}function $e(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return($e=function(){return!!t})()}const Ye=function(e){function r(){var e;return t(this,r),(e=We(this,r)).name="Public Key from Private Key",e.module="PublicKey",e.description="Extracts the Public Key from a Private Key.",e.infoURL="https://en.wikipedia.org/wiki/PKCS_8",e.inputType="string",e.outputType="string",e.args=[],e.checks=[],e}return l(r,e),s(r,[{key:"run",value:function(t,e){for(var r,n="",i=/-----BEGIN ((RSA |EC |DSA )?PRIVATE KEY)-----/g;null!==(r=i.exec(t));){var s=r.index+r[0].length,a=`-----END ${r[1]}-----`,o=t.indexOf(a,s);if(-1===o)throw new x(`PEM footer '${a}' not found`);var u=t.substring(r.index,o+a.length),c=void 0;try{c=h.AD.getKey(u)}catch(t){throw new x(`Unsupported key type: ${t}`)}var l=void 0;if(c.type&&"EC"===c.type)(l=new h.lK.crypto.ECDSA({curve:c.curve})).setPublicKeyHex(c.generatePublicKeyHex());else if(c.type&&"DSA"===c.type){if(!c.y)throw new x("DSA Private Key in PKCS#8 is not supported");(l=new h.lK.crypto.DSA).setPublic(c.p,c.q,c.g,c.y)}else{if(!c.n||!c.e)throw new x("Unsupported key type");(l=new h.Ks).setPublic(c.n,c.e)}n+=h.AD.getPEM(l)}return n}}]),r}(ne);("undefined"==typeof self?{}:self.OpModules||{}).PublicKey={"Hex to Object Identifier":ae,"Hex to PEM":ce,"JWK to PEM":pe,"Object Identifier to Hex":ye,"PEM to JWK":Se,"Parse ASN.1 hex string":Ae,"Parse CSR":Oe,"Parse X.509 certificate":Me,"Public Key from Certificate":ze,"Public Key from Private Key":Ye}})()})();