/*! 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)),h=0,l=u>0?a-4:a;for(r=0;r>16&255,c[h++]=e>>8&255,c[h++]=255&e;return 2===u&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,c[h++]=255&e),1===u&&(e=n[t.charCodeAt(r)]<<10|n[t.charCodeAt(r+1)]<<4|n[t.charCodeAt(r+2)]>>2,c[h++]=e>>8&255,c[h++]=255&e),c},e.fromByteArray=function(t){for(var e,n=t.length,i=n%3,s=[],a=16383,o=0,c=n-i;oc?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>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 l(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|d(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(J(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(J(t,ArrayBuffer)||t&&J(t.buffer,ArrayBuffer))return p(t,e,r);if("undefined"!=typeof SharedArrayBuffer&&(J(t,SharedArrayBuffer)||t&&J(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|g(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||Y(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 h(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 l(t){return h(t),o(t<0?0:0|g(t))}function f(t){const e=t.length<0?0:0|g(t.length),r=o(e);for(let n=0;n=a)throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a.toString(16)+" bytes");return 0|t}function d(t,e){if(u.isBuffer(t))return t.length;if(ArrayBuffer.isView(t)||J(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 $(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*r;case"hex":return r>>>1;case"base64":return z(t).length;default:if(i)return n?-1:$(t).length;e=(""+e).toLowerCase(),i=!0}}function m(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 P(this,e,r);case"utf8":case"utf-8":return B(this,e,r);case"ascii":return C(this,e,r);case"latin1":case"binary":return D(this,e,r);case"base64":return A(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return T(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 y(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),Y(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:x(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):x(t,[e],r,n,i);throw new TypeError("val must be string, number or Buffer")}function x(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;so&&(r=o-u),s=r;s>=0;s--){let r=!0;for(let n=0;ni&&(n=i):n=i;const s=e.length;let a;for(n>s/2&&(n=s/2),a=0;a>8,i=r%256,s.push(i),s.push(n);return s}(e,t.length-r),t,r,n)}function A(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(;i239?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(;nn.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=d,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;er&&(t+=" ... "),""},s&&(u.prototype[s]=u.prototype.inspect),u.prototype.compare=function(t,e,r,n,i){if(J(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),h=t.slice(e,r);for(let t=0;t>>=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 w(this,t,e,r);case"utf8":case"utf-8":return b(this,t,e,r);case"ascii":case"latin1":case"binary":return E(this,t,e,r);case"base64":return S(this,t,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return F(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 C(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;in)&&(r=n);let i="";for(let n=e;nr)throw new RangeError("Trying to access beyond buffer length")}function N(t,e,r,n,i,s){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||et.length)throw new RangeError("Index out of range")}function O(t,e,r,n,i){M(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 k(t,e,r,n,i){M(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 H(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 j(t,e,r,n,s){return e=+e,r>>>=0,s||H(t,0,r,4),i.write(t,e,r,n,23,4),r+4}function L(t,e,r,n,s){return e=+e,r>>>=0,s||H(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>>=0,e>>>=0,r||R(t,e,this.length);let n=this[t],i=1,s=0;for(;++s>>=0,e>>>=0,r||R(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||R(t,1,this.length),this[t]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,e){return t>>>=0,e||R(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,e){return t>>>=0,e||R(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(t,e){return t>>>=0,e||R(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||R(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readBigUInt64LE=Z((function(t){K(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)<>>=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)<>>=0,e>>>=0,r||R(t,e,this.length);let n=this[t],i=1,s=0;for(;++s=i&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||R(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||R(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){t>>>=0,e||R(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||R(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||R(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||R(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readBigInt64LE=Z((function(t){K(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)<>>=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)<>>=0,e||R(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return t>>>=0,e||R(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return t>>>=0,e||R(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return t>>>=0,e||R(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||N(this,t,e,r,Math.pow(2,8*r)-1,0);let i=1,s=0;for(this[e]=255&t;++s>>=0,r>>>=0,n||N(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||N(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||N(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||N(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||N(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||N(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=Z((function(t,e=0){return O(this,t,e,BigInt(0),BigInt("0xffffffffffffffff"))})),u.prototype.writeBigUInt64BE=Z((function(t,e=0){return k(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);N(this,t,e,r,n-1,-n)}let i=0,s=1,a=0;for(this[e]=255&t;++i>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);N(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||N(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||N(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||N(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||N(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||N(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=Z((function(t,e=0){return O(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeBigInt64BE=Z((function(t,e=0){return k(this,t,e,-BigInt("0x8000000000000000"),BigInt("0x7fffffffffffffff"))})),u.prototype.writeFloatLE=function(t,e,r){return j(this,t,e,!0,r)},u.prototype.writeFloatBE=function(t,e,r){return j(this,t,e,!1,r)},u.prototype.writeDoubleLE=function(t,e,r){return L(this,t,e,!0,r)},u.prototype.writeDoubleBE=function(t,e,r){return L(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=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>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function M(t,e,r,n,i,s){if(t>r||t3?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){K(e,"offset"),void 0!==t[e]&&void 0!==t[e+r]||q(e,t.length-(r+1))}(n,i,s)}function K(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 K(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)}_("ERR_BUFFER_OUT_OF_BOUNDS",(function(t){return t?`${t} is outside of buffer bounds`:"Attempt to access memory outside buffer bounds"}),RangeError),_("ERR_INVALID_ARG_TYPE",(function(t,e){return`The "${t}" argument must be of type number. Received type ${typeof e}`}),TypeError),_("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=U(String(r)):"bigint"==typeof r&&(i=String(r),(r>BigInt(2)**BigInt(32)||r<-(BigInt(2)**BigInt(32)))&&(i=U(i)),i+="n"),n+=` It must be ${e}. Received ${i}`,n}),RangeError);const G=/[^+/0-9A-Za-z-_]/g;function $(t,e){let r;e=e||1/0;const n=t.length;let i=null;const s=[];for(let a=0;a55295&&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 z(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 W(t,e,r,n){let i;for(i=0;i=e.length||i>=t.length);++i)e[i+r]=t[i];return i}function J(t,e){return t instanceof e||null!=t&&null!=t.constructor&&null!=t.constructor.name&&t.constructor.name===e.name}function Y(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 Z(t){return"undefined"==typeof BigInt?Q:t}function Q(){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<>1,h=-7,l=r?i-1:0,f=r?-1:1,p=t[e+l];for(l+=f,s=p&(1<<-h)-1,p>>=-h,h+=o;h>0;s=256*s+t[e+l],l+=f,h-=8);for(a=s&(1<<-h)-1,s>>=-h,h+=n;h>0;a=256*a+t[e+l],l+=f,h-=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,h=(1<>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,p=n?0:s-1,g=n?1:-1,d=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=h):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+l>=1?f/u:f*Math.pow(2,1-l))*u>=2&&(a++,u/=2),a+l>=h?(o=0,a=h):a+l>=1?(o=(e*u-1)*Math.pow(2,i),a+=l):(o=e*Math.pow(2,l-1)*Math.pow(2,i),a=0));i>=8;t[r+p]=255&o,p+=g,o/=256,i-=8);for(a=a<0;t[r+p]=255&a,p+=g,a/=256,c-=8);t[r+p-g]|=128*d}},72216:(t,e,r)=>{var n,i,s,a,o,u,c,h,l,f,p,g=r(33296).Buffer,d={userAgent:!1},m={},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>>2]>>>24-s%4*8&255;e[n+s>>>2]|=a<<24-(n+s)%4*8}else for(s=0;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>>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>>3]|=parseInt(t.substr(n,2),16)<<24-n%8*4;return new o.init(r,e/2)}},h=u.Latin1={stringify:function(t){for(var e=t.words,r=t.sigBytes,n=[],i=0;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>>2]|=(255&t.charCodeAt(n))<<24-n%4*8;return new o.init(r,e)}},l=u.Utf8={stringify:function(t){try{return decodeURIComponent(escape(h.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return h.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=l.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 h=0;h>>2]}},e.BlockCipher=o.extend({cfg:o.cfg.extend({mode:u,padding:h}),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 l=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 l.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,l.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,l.create({key:t,iv:r,salt:i})}},g=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=[],h=[],l=[],f=[],p=[],g=0;256>g;g++)p[g]=128>g?g<<1:g<<1^283;var d=0,m=0;for(g=0;256>g;g++){var y=(y=m^m<<1^m<<2^m<<3^m<<4)>>>8^255&y^99;n[d]=y,i[y]=d;var x=p[d],w=p[x],b=p[w],E=257*p[y]^16843008*y;s[d]=E<<24|E>>>8,a[d]=E<<16|E>>>16,o[d]=E<<8|E>>>24,u[d]=E,E=16843009*b^65537*w^257*x^16843008*d,c[y]=E<<24|E>>>8,h[y]=E<<16|E>>>16,l[y]=E<<8|E>>>24,f[y]=E,d?(d=x^p[p[p[b^x]]],m^=p[p[m]]):d=m=1}var S=[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>>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^=S[s/e|0]<<24),i[s]=i[s-e]^a}for(t=this._invKeySchedule=[],e=0;ee||4>=s?a:c[n[a>>>24]]^h[n[a>>>16&255]]^l[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,h,l,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],h=t[e+1]^r[1],l=t[e+2]^r[2],f=t[e+3]^r[3],p=4,g=1;g>>24]^i[h>>>16&255]^s[l>>>8&255]^a[255&f]^r[p++],m=n[h>>>24]^i[l>>>16&255]^s[f>>>8&255]^a[255&c]^r[p++],v=n[l>>>24]^i[f>>>16&255]^s[c>>>8&255]^a[255&h]^r[p++];f=n[f>>>24]^i[c>>>16&255]^s[h>>>8&255]^a[255&l]^r[p++],c=d,h=m,l=v}d=(o[c>>>24]<<24|o[h>>>16&255]<<16|o[l>>>8&255]<<8|o[255&f])^r[p++],m=(o[h>>>24]<<24|o[l>>>16&255]<<16|o[f>>>8&255]<<8|o[255&c])^r[p++],v=(o[l>>>24]<<24|o[f>>>16&255]<<16|o[c>>>8&255]<<8|o[255&h])^r[p++],f=(o[f>>>24]<<24|o[c>>>16&255]<<16|o[h>>>8&255]<<8|o[255&l])^r[p++],t[e]=d,t[e+1]=m,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^this._lBlock)&e;this._lBlock^=r,this._rBlock^=r<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,l=0,f=0;8>f;f++)l|=c[f][((u^a[f])&h[f])>>>0];this._lBlock=u,this._rBlock=o^l}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(l),s=s.TripleDES=i.extend({_doReset:function(){var t=this._key.words;this._des1=l.createEncryptor(n.create(t.slice(0,2))),this._des2=l.createEncryptor(n.create(t.slice(2,4))),this._des3=l.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>>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>>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>>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)<>>32-s)+e}function r(t,e,r,n,i,s,a){return((t=t+(e&n|r&~n)+i+a)<>>32-s)+e}function n(t,e,r,n,i,s,a){return((t=t+(e^r^n)+i+a)<>>32-s)+e}function i(t,e,r,n,i,s,a){return((t=t+(r^(e|~n))+i+a)<>>32-s)+e}for(var s=v,a=(u=s.lib).WordArray,o=u.Hasher,u=s.algo,c=[],h=0;64>h;h++)c[h]=4294967296*t.abs(t.sin(h+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],h=(o=t[s+1],t[s+2]),l=t[s+3],f=t[s+4],p=t[s+5],g=t[s+6],d=t[s+7],m=t[s+8],v=t[s+9],y=t[s+10],x=t[s+11],w=t[s+12],b=t[s+13],E=t[s+14],S=t[s+15],F=e(F=a[0],I=a[1],B=a[2],A=a[3],u,7,c[0]),A=e(A,F,I,B,o,12,c[1]),B=e(B,A,F,I,h,17,c[2]),I=e(I,B,A,F,l,22,c[3]);F=e(F,I,B,A,f,7,c[4]),A=e(A,F,I,B,p,12,c[5]),B=e(B,A,F,I,g,17,c[6]),I=e(I,B,A,F,d,22,c[7]),F=e(F,I,B,A,m,7,c[8]),A=e(A,F,I,B,v,12,c[9]),B=e(B,A,F,I,y,17,c[10]),I=e(I,B,A,F,x,22,c[11]),F=e(F,I,B,A,w,7,c[12]),A=e(A,F,I,B,b,12,c[13]),B=e(B,A,F,I,E,17,c[14]),F=r(F,I=e(I,B,A,F,S,22,c[15]),B,A,o,5,c[16]),A=r(A,F,I,B,g,9,c[17]),B=r(B,A,F,I,x,14,c[18]),I=r(I,B,A,F,u,20,c[19]),F=r(F,I,B,A,p,5,c[20]),A=r(A,F,I,B,y,9,c[21]),B=r(B,A,F,I,S,14,c[22]),I=r(I,B,A,F,f,20,c[23]),F=r(F,I,B,A,v,5,c[24]),A=r(A,F,I,B,E,9,c[25]),B=r(B,A,F,I,l,14,c[26]),I=r(I,B,A,F,m,20,c[27]),F=r(F,I,B,A,b,5,c[28]),A=r(A,F,I,B,h,9,c[29]),B=r(B,A,F,I,d,14,c[30]),F=n(F,I=r(I,B,A,F,w,20,c[31]),B,A,p,4,c[32]),A=n(A,F,I,B,m,11,c[33]),B=n(B,A,F,I,x,16,c[34]),I=n(I,B,A,F,E,23,c[35]),F=n(F,I,B,A,o,4,c[36]),A=n(A,F,I,B,f,11,c[37]),B=n(B,A,F,I,d,16,c[38]),I=n(I,B,A,F,y,23,c[39]),F=n(F,I,B,A,b,4,c[40]),A=n(A,F,I,B,u,11,c[41]),B=n(B,A,F,I,l,16,c[42]),I=n(I,B,A,F,g,23,c[43]),F=n(F,I,B,A,v,4,c[44]),A=n(A,F,I,B,w,11,c[45]),B=n(B,A,F,I,S,16,c[46]),F=i(F,I=n(I,B,A,F,h,23,c[47]),B,A,u,6,c[48]),A=i(A,F,I,B,d,10,c[49]),B=i(B,A,F,I,E,15,c[50]),I=i(I,B,A,F,p,21,c[51]),F=i(F,I,B,A,w,6,c[52]),A=i(A,F,I,B,l,10,c[53]),B=i(B,A,F,I,y,15,c[54]),I=i(I,B,A,F,o,21,c[55]),F=i(F,I,B,A,m,6,c[56]),A=i(A,F,I,B,S,10,c[57]),B=i(B,A,F,I,g,15,c[58]),I=i(I,B,A,F,b,21,c[59]),F=i(F,I,B,A,f,6,c[60]),A=i(A,F,I,B,x,10,c[61]),B=i(B,A,F,I,h,15,c[62]),I=i(I,B,A,F,v,21,c[63]),a[0]=a[0]+F|0,a[1]=a[1]+I|0,a[2]=a[2]+B|0,a[3]=a[3]+A|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 h=n[c-3]^n[c-8]^n[c-14]^n[c-16];n[c]=h<<1|h>>>31}h=(i<<5|i>>>27)+u+n[c],h=20>c?h+(1518500249+(s&a|~s&o)):40>c?h+(1859775393+(s^a^o)):60>c?h+((s&a|s&o|a&o)-1894007588):h+((s^a^o)-899497514),u=o,o=a,a=s<<30|s>>>2,s=i,i=h}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 h;t:{h=u;for(var l=t.sqrt(h),f=2;f<=l;f++)if(!(h%f)){h=!1;break t}h=!0}h&&(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],h=r[6],l=r[7],f=0;64>f;f++){if(16>f)p[f]=0|t[e+f];else{var g=p[f-15],d=p[f-2];p[f]=((g<<25|g>>>7)^(g<<14|g>>>18)^g>>>3)+p[f-7]+((d<<15|d>>>17)^(d<<13|d>>>19)^d>>>10)+p[f-16]}g=l+((u<<26|u>>>6)^(u<<21|u>>>11)^(u<<7|u>>>25))+(u&c^~u&h)+a[f]+p[f],d=((n<<30|n>>>2)^(n<<19|n>>>13)^(n<<10|n>>>22))+(n&i^n&s^i&s),l=h,h=c,c=u,u=o+g|0,o=s,s=i,i=n,n=g+d|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]+h|0,r[7]=r[7]+l|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=(l=this._hash.words)[0],n=l[1],i=l[2],s=l[3],u=l[4],c=l[5],h=l[6],l=l[7],f=r.high,p=r.low,g=n.high,d=n.low,m=i.high,v=i.low,y=s.high,x=s.low,w=u.high,b=u.low,E=c.high,S=c.low,F=h.high,A=h.low,B=l.high,I=l.low,C=f,D=p,P=g,T=d,R=m,N=v,O=y,k=x,H=w,j=b,L=E,V=S,_=F,U=A,M=B,K=I,q=0;80>q;q++){var G=o[q];if(16>q)var $=G.high=0|t[e+2*q],z=G.low=0|t[e+2*q+1];else{$=((z=($=o[q-15]).high)>>>1|(W=$.low)<<31)^(z>>>8|W<<24)^z>>>7;var W=(W>>>1|z<<31)^(W>>>8|z<<24)^(W>>>7|z<<25),J=((z=(J=o[q-2]).high)>>>19|(Y=J.low)<<13)^(z<<3|Y>>>29)^z>>>6,Y=(Y>>>19|z<<13)^(Y<<3|z>>>29)^(Y>>>6|z<<26),X=(z=o[q-7]).high,Z=(Q=o[q-16]).high,Q=Q.low;$=($=($=$+X+((z=W+z.low)>>>0>>0?1:0))+J+((z+=Y)>>>0>>0?1:0))+Z+((z+=Q)>>>0>>0?1:0),G.high=$,G.low=z}X=H&L^~H&_,Q=j&V^~j&U,G=C&P^C&R^P&R;var tt=D&T^D&N^T&N,et=(W=(C>>>28|D<<4)^(C<<30|D>>>2)^(C<<25|D>>>7),J=(D>>>28|C<<4)^(D<<30|C>>>2)^(D<<25|C>>>7),(Y=a[q]).high),rt=Y.low;Z=M+((H>>>14|j<<18)^(H>>>18|j<<14)^(H<<23|j>>>9))+((Y=K+((j>>>14|H<<18)^(j>>>18|H<<14)^(j<<23|H>>>9)))>>>0>>0?1:0),M=_,K=U,_=L,U=V,L=H,V=j,H=O+(Z=(Z=(Z=Z+X+((Y+=Q)>>>0>>0?1:0))+et+((Y+=rt)>>>0>>0?1:0))+$+((Y+=z)>>>0>>0?1:0))+((j=k+Y|0)>>>0>>0?1:0)|0,O=R,k=N,R=P,N=T,P=C,T=D,C=Z+(G=W+G+((z=J+tt)>>>0>>0?1:0))+((D=Y+z|0)>>>0>>0?1:0)|0}p=r.low=p+D,r.high=f+C+(p>>>0>>0?1:0),d=n.low=d+T,n.high=g+P+(d>>>0>>0?1:0),v=i.low=v+N,i.high=m+R+(v>>>0>>0?1:0),x=s.low=x+k,s.high=y+O+(x>>>0>>0?1:0),b=u.low=b+j,u.high=w+H+(b>>>0>>0?1:0),S=c.low=S+V,c.high=E+L+(S>>>0>>0?1:0),A=h.low=A+U,h.high=F+_+(A>>>0>>0?1:0),I=l.low=I+K,l.high=B+M+(I>>>0>>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 h,l,f,p,g,d,m,v,y,x,w,b=this._hash.words,E=(n=u.words,c.words),S=i.words,F=s.words,A=a.words,B=o.words;for(d=h=b[0],m=l=b[1],v=f=b[2],y=p=b[3],x=g=b[4],r=0;80>r;r+=1)w=h+t[e+S[r]]|0,w=16>r?w+((l^f^p)+n[0]):32>r?w+((l&f|~l&p)+n[1]):48>r?w+(((l|~f)^p)+n[2]):64>r?w+((l&p|f&~p)+n[3]):w+((l^(f|~p))+n[4]),w=(w=(w|=0)<>>32-A[r])+g|0,h=g,g=p,p=f<<10|f>>>22,f=l,l=w,w=d+t[e+F[r]]|0,w=16>r?w+((m^(v|~y))+E[0]):32>r?w+((m&y|v&~y)+E[1]):48>r?w+(((m|~v)^y)+E[2]):64>r?w+((m&v|~m&y)+E[3]):w+((m^v^y)+E[4]),w=(w=(w|=0)<>>32-B[r])+x|0,d=x,x=y,y=v<<10|v>>>22,v=m,m=w;w=b[1]+f+y|0,b[1]=b[2]+p+x|0,b[2]=b[3]+g+d|0,b[3]=b[4]+h+m|0,b[4]=b[0]+l+v|0,b[0]=w},_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>6)+x.charAt(63&r);if(e+1==t.length?(r=parseInt(t.substring(e,e+1),16),n+=x.charAt(r<<2)):e+2==t.length&&(r=parseInt(t.substring(e,e+2),16),n+=x.charAt(r>>2)+x.charAt((3&r)<<4)),w)for(;(3&n.length)>0;)n+=w;return n}function E(t){var e,r,n,i="",s=0;for(e=0;e>2),r=3&n,s=1):1==s?(i+=D(r<<2|n>>4),r=15&n,s=2):2==s?(i+=D(r),i+=D(n>>2),r=3&n,s=3):(i+=D(r<<2|n>>4),i+=D(15&n),s=0));return 1==s&&(i+=D(r<<2)),i}function S(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 F(){return new S(null)}"Microsoft Internet Explorer"==d.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[t],c=this[t++]>>15,h=o*u+c*a;i=((u=a*u+((32767&h)<<15)+r[n]+(1073741823&i))>>>30)+(h>>>15)+o*c+(i>>>30),r[n++]=1073741823&u}return i},y=30):"Netscape"!=d.appName?(S.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},y=26):(S.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,h=o*u+c*a;i=((u=a*u+((16383&h)<<14)+r[n]+i)>>28)+(h>>14)+o*c,r[n++]=268435455&u}return i},y=28),S.prototype.DB=y,S.prototype.DM=(1<>>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 N(t){this.m=t}function O(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<>=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 _(t){for(var e=0;0!=t;)t&=t-1,++e;return e}function U(){}function M(t){return t}function K(t){this.r2=F(),this.q3=F(),S.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}N.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},N.prototype.revert=function(t){return t},N.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},N.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},N.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},O.prototype.convert=function(t){var e=F();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},O.prototype.revert=function(t){var e=F();return t.copyTo(e),this.reduce(e),e},O.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e>15)*this.mpl&this.um)<<15)&t.DM;for(t[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)},O.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},O.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[e]=this[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[0]=t:t<-1?this[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,s=0;--n>=0;){var a=8==r?255&t[n]:P(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):this[this.t-1]|=a<=this.DB&&(s-=this.DB))}8==r&&0!=(128&t[0])&&(this.s=-1,s>0&&(this[this.t-1]|=(1<0&&this[this.t-1]==t;)--this.t},S.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},S.prototype.drShiftTo=function(t,e){for(var r=t;r=0;--r)e[r+a+1]=this[r]>>i|o,o=(this[r]&s)<=0;--r)e[r]=0;e[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;for(var a=r+1;a>n;n>0&&(e[this.t-r-1]|=(this.s&s)<>=this.DB;if(t.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=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()},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[i]=0;for(i=0;i=0;)t[r]=0;for(r=0;r=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()},S.prototype.divRemTo=function(t,e,r){var n=t.abs();if(!(n.t<=0)){var i=this.abs();if(i.t0?(n.lShiftTo(u,s),i.lShiftTo(u,r)):(n.copyTo(s),i.copyTo(r));var c=s.t,h=s[c-1];if(0!=h){var l=h*(1<1?s[c-2]>>this.F2:0),f=this.FV/l,p=(1<=0&&(r[r.t++]=1,r.subTo(v,r)),S.ONE.dlShiftTo(c,v),v.subTo(s,s);s.t=0;){var y=r[--d]==h?this.DM:Math.floor(r[d]*f+(r[d-1]+g)*p);if((r[d]+=s.am(0,y,r,m,0,c))0&&r.rShiftTo(u,r),a<0&&S.ZERO.subTo(r,r)}}},S.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},S.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},S.prototype.exp=function(t,e){if(t>4294967295||t<1)return S.ONE;var r=F(),n=F(),i=e.convert(this),s=R(t)-1;for(i.copyTo(r);--s>=0;)if(e.sqrTo(r,n),(t&1<0)e.mulTo(n,i,r);else{var a=r;r=n,n=a}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<0)for(o>o)>0&&(i=!0,s=D(r));a>=0;)o>(o+=this.DB-e)):(r=this[a]>>(o-=e)&n,o<=0&&(o+=this.DB,--a)),r>0&&(i=!0),i&&(s+=D(r));return i?s:"0"},S.prototype.negate=function(){var t=F();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[r]-t[r]))return e;return 0},S.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+R(this[this.t-1]^this.s&this.DM)},S.prototype.mod=function(t){var e=F();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 N(e):new O(e),this.exp(t,r)},S.ZERO=T(0),S.ONE=T(1),U.prototype.convert=M,U.prototype.revert=M,U.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r)},U.prototype.sqrTo=function(t,e){t.squareTo(e)},K.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=F();return t.copyTo(e),this.reduce(e),e},K.prototype.revert=function(t){return t},K.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)},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)};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 $(){this.i=0,this.j=0,this.S=new Array}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=T(r),i=F(),s=F(),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},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,s=0,a=0,o=0;o=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&&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),H,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<>=this.DB;if(t.t>=this.DB;n+=this.s}else{for(n+=this.s;r>=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()},S.prototype.dMultiply=function(t){this[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[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[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[--i]=0;for(n=r.t-this.t;i=0;)r[n]=0;for(n=Math.max(e-this.t,0);n0)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},S.prototype.millerRabin=function(t){var e=this.subtract(S.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=F(),s=0;s>24},S.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},S.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[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>n)!=(this.s&this.DM)>>n&&(e[i++]=r|this.s<=0;)n<8?(r=(this[t]&(1<>(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},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=F();return this.bitwiseTo(t,k,e),e},S.prototype.or=function(t){var e=F();return this.bitwiseTo(t,H,e),e},S.prototype.xor=function(t){var e=F();return this.bitwiseTo(t,j,e),e},S.prototype.andNot=function(t){var e=F();return this.bitwiseTo(t,L,e),e},S.prototype.not=function(){for(var t=F(),e=0;e=this.t?0!=this.s:0!=(this[e]&1<1){var h=F();for(n.sqrTo(a[1],h);o<=c;)a[o]=F(),n.mulTo(h,a[o-2],a[o]),o+=2}var l,f,p=t.t-1,g=!0,d=F();for(i=R(t[p])-1;p>=0;){for(i>=u?l=t[p]>>i-u&c:(l=(t[p]&(1<0&&(l|=t[p-1]>>this.DB+i-u)),o=r;0==(1&l);)l>>=1,--o;if((i-=o)<0&&(i+=this.DB,--p),g)a[l].copyTo(s),g=!1;else{for(;o>1;)n.sqrTo(s,d),n.sqrTo(d,s),o-=2;o>0?n.sqrTo(s,d):(f=s,s=d,d=f),n.mulTo(d,a[l],s)}for(;p>=0&&0==(t[p]&1<=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(S.ONE)?S.ZERO:o.compareTo(t)>=0?o.subtract(t):o.signum()<0?(o.addTo(t,o),o.signum()<0?o.add(t):o):o},S.prototype.pow=function(t){return this.exp(t,new U)},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(i0&&(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[0]<=q[q.length-1]){for(e=0;e>8&255,W[J++]^=t>>16&255,W[J++]^=t>>24&255,J>=Y&&(J-=Y)}((new Date).getTime())}if(null==W){var Z;if(W=new Array,J=0,void 0!==m&&(void 0!==m.crypto||void 0!==m.msCrypto)){var Q=m.crypto||m.msCrypto;if(Q.getRandomValues){var tt=new Uint8Array(32);for(Q.getRandomValues(tt),Z=0;Z<32;++Z)W[J++]=tt[Z]}else if("Netscape"==d.appName&&d.appVersion<"5"){var et=m.crypto.random(32);for(Z=0;Z>>8,W[J++]=255&Z;J=0,X()}function rt(){if(null==z){for(X(),(z=new $).init(W),J=0;J0&&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 S(e,16),s=t/2-100,a=S.ONE.shiftLeft(s);;){for(;this.p=new S(t-n,1,r),0!=this.p.subtract(S.ONE).gcd(i).compareTo(S.ONE)||!this.p.isProbablePrime(10););for(;this.q=new S(n,1,r),0!=this.q.subtract(S.ONE).gcd(i).compareTo(S.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()0;--e){s=s.twice();var h=n.testBit(e);h!=r.testBit(e)&&(s=s.add(h?this:i))}for(e=o.bitLength()-2;e>0;--e){u=u.twice();var l=o.testBit(e);l!=a.testBit(e)&&(u=u.add(l?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 S(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 S(o,16)),this.fromBigInteger(new S(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(er.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 S(n),a=new S(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 S(n,16),a=new S(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(S.valueOf(2)),e=this.curve.fromBigInteger(S.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 S("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(S.ONE)<0||e.compareTo(t.subtract(S.ONE))>0)throw new Error("x coordinate out of bounds");if(r.compareTo(S.ONE)<0||r.compareTo(t.subtract(S.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),h=c[0],l=!1;"{"===h?o={}:"["===h?o=[]:(o=[],l=!0);for(var f=[o],p=1-l,g=c.length;p=0;)delete r[n[u]]}return a.call(t,e,r)};o=m({"":o},"")}return o}}();void 0!==ht&&ht||(ht={}),void 0!==ht.asn1&&ht.asn1||(ht.asn1={}),ht.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 Kt(t)},this.getPEMStringFromHex=function(t,e){return At(t,e)},this.newObject=function(t){var e=ht.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,h=e.DERUTF8String,l=e.DERNumericString,f=e.DERPrintableString,p=e.DERTeletexString,g=e.DERIA5String,d=e.DERUTCTime,m=e.DERGeneralizedTime,v=e.DERVisibleString,y=e.DERBMPString,x=e.DERSequence,w=e.DERSet,b=e.DERTaggedObject,E=e.ASN1Util.newObject;if(t instanceof e.ASN1Object)return t;var S=Object.keys(t);if(1!=S.length)throw new Error("key of param shall be only one.");var F=S[0];if(-1==":asn1:bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:visstr:bmpstr:seq:set:tag:".indexOf(":"+F+":"))throw new Error("undefined key: "+F);if("bool"==F)return new n(t[F]);if("int"==F)return new i(t[F]);if("bitstr"==F)return new s(t[F]);if("octstr"==F)return new a(t[F]);if("null"==F)return new o(t[F]);if("oid"==F)return new u(t[F]);if("enum"==F)return new c(t[F]);if("utf8str"==F)return new h(t[F]);if("numstr"==F)return new l(t[F]);if("prnstr"==F)return new f(t[F]);if("telstr"==F)return new p(t[F]);if("ia5str"==F)return new g(t[F]);if("utctime"==F)return new d(t[F]);if("gentime"==F)return new m(t[F]);if("visstr"==F)return new v(t[F]);if("bmpstr"==F)return new y(t[F]);if("asn1"==F)return new r(t[F]);if("seq"==F){for(var A=t[F],B=[],I=0;I15)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)},ht.asn1.DERAbstractString=function(t){ht.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=wt(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))},zt(ht.asn1.DERAbstractString,ht.asn1.ASN1Object),ht.asn1.DERAbstractTime=function(t){ht.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}},zt(ht.asn1.DERAbstractTime,ht.asn1.ASN1Object),ht.asn1.DERAbstractStructured=function(t){ht.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)},zt(ht.asn1.DERAbstractStructured,ht.asn1.ASN1Object),ht.asn1.DERBoolean=function(t){ht.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV=0==t?"010100":"0101ff"},zt(ht.asn1.DERBoolean,ht.asn1.ASN1Object),ht.asn1.DERInteger=function(t){ht.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.params=null;var e=Kt;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 S(String(t),10);else if(null!=t.int)r=new S(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)},zt(ht.asn1.DERInteger,ht.asn1.ASN1Object),ht.asn1.DERBitString=function(t){if(void 0!==t&&void 0!==t.obj){var e=ht.asn1.ASN1Util.newObject(t.obj);t.hex="00"+e.tohex()}ht.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>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 jt(t){for(var e=encodeURIComponent(t),r="",n=0;n"7"?"00"+t:t}function Ut(t){if(!Lt(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;a0&&(c=c+"."+o.join(".")),c}catch(t){return null}}function Mt(t){return Kt(new S(String(t),10))}function Kt(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=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=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:Ut(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=ht.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 St(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;o0&&(h=h+"."+u.join(".")),h},pt.dump=function(t,e,r,n){var i=pt,s=i.getV,a=i.dump,o=i.getChildIdx,u=t;t instanceof ht.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 h,l=e.ommit_long_octet;if("01"==(h=u.substr(r,2)))return"00"==(f=s(u,r))?n+"BOOLEAN FALSE\n":n+"BOOLEAN TRUE\n";if("02"==h)return n+"INTEGER "+c(f=s(u,r),l)+"\n";if("03"==h){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,l)+"\n"}if("04"==h)return f=s(u,r),i.isASN1HEX(f)?(b=n+"OCTETSTRING, encapsulates\n")+a(f,e,0,n+" "):n+"OCTETSTRING "+c(f,l)+"\n";if("05"==h)return n+"NULL\n";if("06"==h){var p=s(u,r),g=ht.asn1.ASN1Util.oidHexToInt(p),d=ht.asn1.x509.OID.oid2name(g),m=g.replace(/\./g," ");return""!=d?n+"ObjectIdentifier "+d+" ("+m+")\n":n+"ObjectIdentifier ("+m+")\n"}if("0a"==h)return n+"ENUMERATED "+parseInt(s(u,r))+"\n";if("0c"==h)return n+"UTF8String '"+bt(s(u,r))+"'\n";if("13"==h)return n+"PrintableString '"+bt(s(u,r))+"'\n";if("14"==h)return n+"TeletexString '"+bt(s(u,r))+"'\n";if("16"==h)return n+"IA5String '"+bt(s(u,r))+"'\n";if("17"==h)return n+"UTCTime "+bt(s(u,r))+"\n";if("18"==h)return n+"GeneralizedTime "+bt(s(u,r))+"\n";if("1a"==h)return n+"VisualString '"+bt(s(u,r))+"'\n";if("1e"==h)return n+"BMPString '"+Ht(s(u,r))+"'\n";if("30"==h){if("3000"==u.substr(r,4))return n+"SEQUENCE {}\n";b=n+"SEQUENCE\n";var v=e;if((2==(w=o(u,r)).length||3==w.length)&&"06"==u.substr(w[0],2)&&"04"==u.substr(w[w.length-1],2)){d=i.oidname(s(u,w[0]));var y=JSON.parse(JSON.stringify(e));y.x509ExtName=d,v=y}for(var x=0;x4?{enum:{hex:m}}:{enum:parseInt(m,16)};if("30"==g||"31"==g)return d[p[g]]=function(t){for(var e=[],n=a(t,0),i=0;i31)&&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(),!ht.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 h=s.getVidx(t,e);if("00"==t.substr(h,2)&&t.charCodeAt(h+2)<56)throw new Error("not least zeros for DER INTEGER")}if(32&parseInt(c,16)){for(var l=s.getVblen(t,e),f=0,p=s.getChildIdx(t,e),g=0;g0&&t.push(new n({tag:"a3",obj:new c(e.ext)})),new ht.asn1.DERSequence({array:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},zt(ht.asn1.x509.TBSCertificate,ht.asn1.ASN1Object),ht.asn1.x509.Extensions=function(t){ht.asn1.x509.Extensions.superclass.constructor.call(this);var e=ht.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-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))},zt(ht.asn1.x509.BasicConstraints,ht.asn1.x509.Extension),ht.asn1.x509.CRLDistributionPoints=function(t){ht.asn1.x509.CRLDistributionPoints.superclass.constructor.call(this,t);var e=ht.asn1,r=e.x509;this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.setByDPArray=function(t){for(var n=[],i=0;i0&&t.push(new r({array:e}))}return new r({array:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&(this.params=t)},zt(ht.asn1.x509.PolicyInformation,ht.asn1.ASN1Object),ht.asn1.x509.PolicyQualifierInfo=function(t){ht.asn1.x509.PolicyQualifierInfo.superclass.constructor.call(this,t);var e=ht.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)},zt(ht.asn1.x509.PolicyQualifierInfo,ht.asn1.ASN1Object),ht.asn1.x509.UserNotice=function(t){ht.asn1.x509.UserNotice.superclass.constructor.call(this,t);var e=ht.asn1.DERSequence,r=(ht.asn1.DERInteger,ht.asn1.x509.DisplayText),n=ht.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)},zt(ht.asn1.x509.UserNotice,ht.asn1.ASN1Object),ht.asn1.x509.NoticeReference=function(t){ht.asn1.x509.NoticeReference.superclass.constructor.call(this,t);var e=ht.asn1.DERSequence,r=ht.asn1.DERInteger,n=ht.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;a0)for(var t=0;t0;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("/")},ht.asn1.x509.X500Name.ldapToOneline=function(t){return ht.asn1.x509.X500Name.ldapToCompat(t)},ht.asn1.x509.RDN=function(t){ht.asn1.x509.RDN.superclass.constructor.call(this),this.asn1Array=[],this.paramArray=[],this.sRule="utf8";var e=ht.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 ht.asn1.x509.AttributeTypeAndValue({str:t,rule:this.sRule}))},this.addByMultiValuedString=function(t){for(var e=ht.asn1.x509.RDN.parseString(t),r=0;r0)for(var t=0;t0;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},ht.asn1.x509.AttributeTypeAndValue=function(t){ht.asn1.x509.AttributeTypeAndValue.superclass.constructor.call(this),this.sRule="utf8",this.sType=null,this.sValue=null,this.dsType=null;var e=ht,r=e.asn1,n=r.DERSequence,i=r.DERUTF8String,s=r.DERPrintableString,a=r.DERTeletexString,o=r.DERIA5String,u=r.DERVisibleString,c=r.DERBMPString,h=e.lang.String.isMail,l=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&&h(e)?"ia5":l(e)?"prn":"utf8":"utf8"===r?"CN"==t&&h(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=ht.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)},zt(ht.asn1.x509.AttributeTypeAndValue,ht.asn1.ASN1Object),ht.asn1.x509.SubjectPublicKeyInfo=function(t){ht.asn1.x509.SubjectPublicKeyInfo.superclass.constructor.call(this);var e=ht,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 ht.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 ht.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)},zt(ht.asn1.x509.SubjectPublicKeyInfo,ht.asn1.ASN1Object),ht.asn1.x509.Time=function(t){ht.asn1.x509.Time.superclass.constructor.call(this);var e=ht.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)},ht.asn1.x509.Time_bak=function(t){ht.asn1.x509.Time_bak.superclass.constructor.call(this);var e=ht.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)},zt(ht.asn1.x509.Time,ht.asn1.ASN1Object),ht.asn1.x509.AlgorithmIdentifier=function(t){ht.asn1.x509.AlgorithmIdentifier.superclass.constructor.call(this),this.nameAlg=null,this.asn1Alg=null,this.asn1Params=null,this.paramEmpty=!1;var e=ht.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)}},zt(ht.asn1.x509.AlgorithmIdentifier,ht.asn1.ASN1Object),ht.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV={SHAwithRSAandMGF1:"300d06092a864886f70d01010a3000",SHA256withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040201a11a301806092a864886f70d010108300b0609608648016503040201a203020120",SHA384withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040202a11a301806092a864886f70d010108300b0609608648016503040202a203020130",SHA512withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040203a11a301806092a864886f70d010108300b0609608648016503040203a203020140"},ht.asn1.x509.GeneralName=function(t){ht.asn1.x509.GeneralName.superclass.constructor.call(this);var e=ht.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,h=!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",h=!0,e="string"==typeof r.dn?new n({str:r.dn}):r.dn instanceof ht.asn1.x509.X500Name?r.dn:new n(r.dn);else if(void 0!==r.ldapdn)t="a4",h=!0,e=new n({ldapstr:r.ldapdn});else if(void 0!==r.certissuer||void 0!==r.certsubj){var l,f;t="a4",h=!0;var p=null;if(void 0!==r.certsubj?(l=!1,f=r.certsubj):(l=!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 g,d=new Zt;d.hex=p,g=l?d.getIssuerHex():d.getSubjectHex(),(e=new u).hTLV=g}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 m;t="87";var v=r.ip;try{if(v.match(/^[0-9a-f]+$/)){var y=v.length;if(8!=y&&16!=y&&32!=y&&64!=y)throw"err";m=v}else m=Ot(v)}catch(t){throw new c("malformed IP address: "+r.ip+":"+t.message)}e=new a({hex:m})}return new o({tag:t,explicit:h,obj:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},zt(ht.asn1.x509.GeneralName,ht.asn1.ASN1Object),ht.asn1.x509.GeneralNames=function(t){ht.asn1.x509.GeneralNames.superclass.constructor.call(this);var e=ht.asn1;this.setByParamArray=function(t){for(var r=0;r0){for(var r=s(t.valhex,e[0]),n=h(r,0),i=[],a=0;a1){var c=s(t.valhex,e[1]);t.polhex=c}delete t.valhex},this.setSignaturePolicyIdentifier=function(t){var r=h(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=h(t.valhex,r[1]),c=s(t.valhex,u[0]),l=o.getAlgorithmIdentifierName(c);t.alg=l;var f=i(t.valhex,u[1]);t.hash=f}delete t.valhex},this.setSigningCertificateV2=function(t){var e=h(t.valhex,0);if(e.length>0){for(var r=s(t.valhex,e[0]),n=h(r,0),i=[],a=0;a1){var c=s(t.valhex,e[1]);t.polhex=c}delete t.valhex},this.getESSCertID=function(t){var e={},r=h(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=h(e,0);if(a.length<1||3o+1){var l=s(e,a[o+1]),f=this.getIssuerSerial(l);n.issuer=f.issuer,n.serial=f.serial}return n},this.getIssuerSerial=function(t){var e={},n=h(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=h(t,0),r=[],n=0;n=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)},zt(ht.asn1.tsp.PKIFailureInfo,ht.asn1.ASN1Object),ht.asn1.tsp.AbstractTSAAdapter=function(t){this.getTSTHex=function(t,e){throw"not implemented yet"}},ht.asn1.tsp.SimpleTSAAdapter=function(t){var e=ht,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)},zt(ht.asn1.tsp.SimpleTSAAdapter,ht.asn1.tsp.AbstractTSAAdapter),ht.asn1.tsp.FixedTSAAdapter=function(t){var e=ht,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)},zt(ht.asn1.tsp.FixedTSAAdapter,ht.asn1.tsp.AbstractTSAAdapter),ht.asn1.tsp.TSPUtil=new function(){},ht.asn1.tsp.TSPUtil.newTimeStampToken=function(t){return new ht.asn1.tsp.TimeStampToken(t)},ht.asn1.tsp.TSPUtil.parseTimeStampReq=function(t){return(new ht.asn1.tsp.TSPParser).getTimeStampReq(t)},ht.asn1.tsp.TSPUtil.parseMessageImprint=function(t){return(new ht.asn1.tsp.TSPParser).getMessageImprint(t)},ht.asn1.tsp.TSPParser=function(){Error;var t=new Zt,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 ht.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=Ut(o);var u=n(e,a[2]);i.messageImprint=this.getMessageImprint(u);var c=r(e,a[3]);i.serial={hex:c};var h=r(e,a[4]);i.genTime={str:bt(h)};var l=0;if(a.length>5&&"30"==e.substr(a[5],2)){var f=n(e,a[5]);i.accuracy=this.getAccuracy(f),l++}if(a.length>5+l&&"01"==e.substr(a[5+l],2)&&("ff"==r(e,a[5+l])&&(i.ordering=!0),l++),a.length>5+l&&"02"==e.substr(a[5+l],2)){var p=r(e,a[5+l]);i.nonce={hex:p},l++}if(a.length>5+l&&"a0"==e.substr(a[5+l],2)){var g=n(e,a[5+l]);g="30"+g.substr(2),pGeneralNames=t.getGeneralNames(g);var d=pGeneralNames[0].dn;i.tsa=d,l++}if(a.length>5+l&&"a1"==e.substr(a[5+l],2)){var m=n(e,a[5+l]);m="30"+m.substr(2);var v=t.getExtParamArray(m);i.ext=v,l++}return i},this.getAccuracy=function(t){for(var e={},n=s(t,0),i=0;i1&&"30"==t.substr(i[1],2)){var h=n(t,i[1]);e.statusstr=this.getPKIFreeText(h),o++}if(i.length>o&&"03"==t.substr(i[1+o],2)){var l=n(t,i[1+o]);e.failinfo=this.getPKIFailureInfo(l)}return e},this.getPKIFreeText=function(t){for(var r=[],n=s(t,0),i=0;i=e?t:new Array(e-t.length+1).join(r)+t};function Gt(t,e){for(var r=0,n=0;n=0;n--)s+=i[n];return s}function $t(t,e,r){if("object"==typeof t){e=String(e).split(".");for(var n=0;ni)throw"key is too short for SigAlg: keylen="+r+","+e;for(var s="00"+n,a="",o=i-4-s.length,u=0;u=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))},ht.crypto.ECDSA.parseSigHex=function(t){var e=ht.crypto.ECDSA.parseSigHexInHexRS(t);return{r:new S(e.r,16),s:new S(e.s,16)}},ht.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)}},ht.crypto.ECDSA.asn1SigToConcatSig=function(t){var e=ht.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},ht.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 ht.crypto.ECDSA.hexRSSigToASN1Sig(e,r)},ht.crypto.ECDSA.hexRSSigToASN1Sig=function(t,e){var r=new S(t,16),n=new S(e,16);return ht.crypto.ECDSA.biRSSigToASN1Sig(r,n)},ht.crypto.ECDSA.biRSSigToASN1Sig=function(t,e){var r=ht.asn1,n=new r.DERInteger({bigint:t}),i=new r.DERInteger({bigint:e});return new r.DERSequence({array:[n,i]}).tohex()},ht.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!==ht&&ht||(ht={}),void 0!==ht.crypto&&ht.crypto||(ht.crypto={}),ht.crypto.ECParameterDB=new function(){var t={},e={};function r(t){return new S(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,h,l,f,p,g){t[n]={};var d=r(s),m=r(a),v=r(o),y=r(u),x=r(c),w=new ut(d,m,v),b=w.decodePointHex("04"+h+l);t[n].name=n,t[n].keylen=i,t[n].keycharlen=2*Math.ceil(i/8),t[n].curve=w,t[n].G=b,t[n].n=y,t[n].h=x,t[n].oid=p,t[n].info=g;for(var E=0;E1?new S(n,16):null,c=new S(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 S(t,16),s=new S(e,16),a=new S(r,16),o=new S(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=ht.crypto.Util.getRandomBigIntegerMinToMax(S.ONE.add(S.ONE),r.subtract(S.ONE)),a=new S(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 ht.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 S(t.substr(0,n.bitLength()/4),16);if(S.ZERO.compareTo(o)>0||o.compareTo(n)>0)throw"invalid DSA signature";if(S.ZERO.compareTo(u)>=0||u.compareTo(n)>0)throw"invalid DSA signature";var h=u.modInverse(n),l=c.multiply(h).mod(n),f=o.multiply(h).mod(n);return 0==i.modPow(l,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 Wt=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 h=v.algo.MD5.create();if(null!=c&&h.update(c),h.update(a),h.update(s),c=h.finalize(),(u+=v.enc.Hex.stringify(c)).length>=2*o)break}var l={};return l.keyhex=u.substr(0,2*i[t].keylen),l.ivhex=u.substr(2*i[t].keylen,2*i[t].ivlen),l},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 At(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 ht.asn1.ASN1Util.newObject(i).tohex()},initPBES2Param:function(t){var e;null==$t(t,"encalg")&&(t.encalg="aes256-CBC"),null==$t(t,"iter")&&(t.iter=2048),null==$t(t,"prf")&&(t.prf="hmacWithSHA256"),null==$t(t,"salt")&&(t.salt=v.enc.Hex.stringify(v.lib.WordArray.random(8))),null==$t(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=Wt.getDKFromPBES2Param(t,e);try{var n=ht.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:Mt(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 h=r(t,c[1]);if(h.length<2)throw new Error("malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+h.length);i.pbkdf2Salt=n(t,h[0]);var l=n(t,h[1]);try{i.pbkdf2Iter=parseInt(l,16)}catch(t){throw new Error("malformed format pbkdf2Iter: "+l)}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=Wt.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"!=$t(e,"seq.0.seq.0.oid")||"pkcs5PBKDF2"!=$t(e,"seq.0.seq.1.seq.0.seq.0.oid"))throw new Error("not pkcs5PBES2 and pkcs5PBKDF2 used");var r=$t(e,"seq.0.seq.1.seq.0.seq.1.seq");if(null==r)throw new Error("PBKDF2 parameter not found");var n=$t(r,"0.octstr.hex"),i=$t(r,"1.int.hex"),s=$t(r,"2.seq.0.oid","hmacWithSHA1"),a=-1;try{a=parseInt(i,16)}catch(t){throw new Error("iter not proper value")}var o=$t(e,"seq.0.seq.1.seq.1.seq.0.oid"),u=$t(e,"seq.0.seq.1.seq.1.seq.1.octstr.hex"),c=$t(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=Wt.parsePBES2(n)}catch(t){throw new Error("malformed PBES2 format: "+t.message)}var i=Wt.getDKFromPBES2Param(r,e);return ht.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 ht.crypto.DSA;else{if("2a8648ce3d0201"!=r.algoid)throw new Error("unsupported private key algorithm");e=new ht.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 ht.crypto.DSA;else{if("2a8648ce3d0201"!==r)throw new Error("unsupported PKCS#8 public key hex");e=new ht.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 Jt(t,e){for(var r="",n=e/4-t.length,i=0;i>24,(16711680&i)>>16,(65280&i)>>8,255&i])))),i+=1;return n}function Xt(t){for(var e in ht.crypto.Util.DIGESTINFOHEAD){var r=ht.crypto.Util.DIGESTINFOHEAD[e],n=r.length;if(t.substring(0,n)==r)return[e,t.substring(n)]}return[]}function Zt(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,h=r.getTLVbyListEx,l=r.getIdxbyList,f=r.getIdxbyListEx,p=r.getVidx,g=r.getInt,d=r.oidname,m=r.hextooidstr,v=Bt,y=Error;try{e=ht.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=g(e,0);if(r<0||20?e:void 0}catch(t){return}},this._asn1ToNoticeRef=function(t){try{for(var e={},r=$t(t,"seq"),n=0;n0?e:void 0}catch(t){return}},this._asn1ToNoticeNum=function(t){try{for(var e=$t(t,"seq"),r=[],n=0;n1){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;u0&&(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=h(this.hex,0,[0,"[3]",0],"30"));for(var e=[],r=n(t,0),i=0;i2&&"04"===m.substr(d[1],2)))throw new Error("unsupported PKCS#1/5 hexadecimal key");(D=new o).readPKCS5PrvKeyHex(m)}return D}if("pkcs8prv"===r)return l.getKeyFromPlainPrivatePKCS8Hex(t);if("pkcs8pub"===r)return l._getKeyFromPublicPKCS8Hex(t);if("x509pub"===r)return Zt.getPublicKeyFromCertHex(t);if(-1!=t.indexOf("-END CERTIFICATE-",0)||-1!=t.indexOf("-END X509 CERTIFICATE-",0)||-1!=t.indexOf("-END TRUSTED CERTIFICATE-",0))return Zt.getPublicKeyFromCertPEM(t);if(-1!=t.indexOf("-END PUBLIC KEY-")){var y=Bt(t,"PUBLIC KEY");return l._getKeyFromPublicPKCS8Hex(y)}if(-1!=t.indexOf("-END RSA PRIVATE KEY-")&&-1==t.indexOf("4,ENCRYPTED")){var x=h(t,"RSA PRIVATE KEY");return l.getKey(x,null,"pkcs5prv")}if(-1!=t.indexOf("-END DSA PRIVATE KEY-")&&-1==t.indexOf("4,ENCRYPTED")){var w=s(n=h(t,"DSA PRIVATE KEY"),0,[1],"02"),b=s(n,0,[2],"02"),E=s(n,0,[3],"02"),F=s(n,0,[4],"02"),A=s(n,0,[5],"02");return(D=new u).setPrivate(new S(w,16),new S(b,16),new S(E,16),new S(F,16),new S(A,16)),D}if(-1!=t.indexOf("-END EC PRIVATE KEY-")&&-1==t.indexOf("4,ENCRYPTED"))return x=h(t,"EC PRIVATE KEY"),l.getKey(x,null,"pkcs5prv");if(-1!=t.indexOf("-END PRIVATE KEY-"))return l.getKeyFromPlainPrivatePKCS8PEM(t);if(-1!=t.indexOf("-END RSA PRIVATE KEY-")&&-1!=t.indexOf("4,ENCRYPTED")){var B=l.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 C,D=s(n=l.getDecryptedKeyHex(t,e),0,[1],"04"),P=s(n,0,[2,0],"06"),T=s(n,0,[3,0],"03").substr(2);if(void 0===ht.crypto.OID.oidhex2name[P])throw new Error("undefined OID(hex) in KJUR.crypto.OID: "+P);return(C=new o({curve:ht.crypto.OID.oidhex2name[P]})).setPublicKeyHex(T),C.setPrivateKeyHex(D),C.isPublic=!1,C}if(-1!=t.indexOf("-END DSA PRIVATE KEY-")&&-1!=t.indexOf("4,ENCRYPTED"))return w=s(n=l.getDecryptedKeyHex(t,e),0,[1],"02"),b=s(n,0,[2],"02"),E=s(n,0,[3],"02"),F=s(n,0,[4],"02"),A=s(n,0,[5],"02"),(D=new u).setPrivate(new S(w,16),new S(b,16),new S(E,16),new S(F,16),new S(A,16)),D;if(-1!=t.indexOf("-END ENCRYPTED PRIVATE KEY-"))return l.getKeyFromEncryptedPKCS8PEM(t,e);throw new Error("not supported argument")},Wt.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 ht.crypto.ECDSA({curve:u}).generateKeyPairHex();return(a=new ht.crypto.ECDSA({curve:u})).setPublicKeyHex(c.ecpubhex),a.setPrivateKeyHex(c.ecprvhex),a.isPrivate=!0,a.isPublic=!1,(n=new ht.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)},Wt.getPEM=function(t,e,r,n,i,s){var a=ht,o=a.asn1,u=o.DERObjectIdentifier,c=o.DERInteger,h=o.ASN1Util.newObject,l=o.x509.SubjectPublicKeyInfo,f=a.crypto,p=f.DSA,g=f.ECDSA,d=st;function m(t){return h({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 h({seq:[{int:1},{octstr:{hex:t.prvKeyHex}},{tag:["a0",!0,{oid:{name:t.curveName}}]},{tag:["a1",!0,{bitstr:{hex:"00"+t.pubKeyHex}}]}]})}function y(t){return h({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!==d&&t instanceof d||void 0!==p&&t instanceof p||void 0!==g&&t instanceof g)&&1==t.isPublic&&(void 0===e||"PKCS8PUB"==e))return At(E=new l(t).tohex(),"PUBLIC KEY");if("PKCS1PRV"==e&&void 0!==d&&t instanceof d&&(void 0===r||null==r)&&1==t.isPrivate)return At(E=m(t).tohex(),"RSA PRIVATE KEY");if("PKCS1PRV"==e&&void 0!==g&&t instanceof g&&(void 0===r||null==r)&&1==t.isPrivate){var x=new u({name:t.curveName}).tohex(),w=v(t).tohex(),b="";return(b+=At(x,"EC PARAMETERS"))+At(w,"EC PRIVATE KEY")}if("PKCS1PRV"==e&&void 0!==p&&t instanceof p&&(void 0===r||null==r)&&1==t.isPrivate)return At(E=y(t).tohex(),"DSA PRIVATE KEY");if("PKCS5PRV"==e&&void 0!==d&&t instanceof d&&void 0!==r&&null!=r&&1==t.isPrivate){var E=m(t).tohex();return void 0===n&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",E,r,n,s)}if("PKCS5PRV"==e&&void 0!==g&&t instanceof g&&void 0!==r&&null!=r&&1==t.isPrivate)return E=v(t).tohex(),void 0===n&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",E,r,n,s);if("PKCS5PRV"==e&&void 0!==p&&t instanceof p&&void 0!==r&&null!=r&&1==t.isPrivate)return E=y(t).tohex(),void 0===n&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",E,r,n,s);var S=function(t,e){if("string"==typeof e)return Wt.getEncryptedPKCS8PEM(t,e);if("object"==typeof e&&null!=$t(e,"passcode")){var r=JSON.parse(JSON.stringify(e)),n=r.passcode;return delete r.passcode,Wt.getEncryptedPKCS8PEM(t,n,r)}};if("PKCS8PRV"==e&&null!=d&&t instanceof d&&1==t.isPrivate){var F=m(t).tohex();return E=h({seq:[{int:0},{seq:[{oid:{name:"rsaEncryption"}},{null:!0}]},{octstr:{hex:F}}]}).tohex(),void 0===r||null==r?At(E,"PRIVATE KEY"):S(E,r)}if("PKCS8PRV"==e&&void 0!==g&&t instanceof g&&1==t.isPrivate){var A={seq:[{int:1},{octstr:{hex:t.prvKeyHex}}]};return"string"==typeof t.pubKeyHex&&A.seq.push({tag:["a1",!0,{bitstr:{hex:"00"+t.pubKeyHex}}]}),F=new h(A).tohex(),E=h({seq:[{int:0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:t.curveName}}]},{octstr:{hex:F}}]}).tohex(),void 0===r||null==r?At(E,"PRIVATE KEY"):S(E,r)}if("PKCS8PRV"==e&&void 0!==p&&t instanceof p&&1==t.isPrivate)return F=new c({bigint:t.x}).tohex(),E=h({seq:[{int:0},{seq:[{oid:{name:"dsa"}},{seq:[{int:{bigint:t.p}},{int:{bigint:t.q}},{int:{bigint:t.g}}]}]},{octstr:{hex:F}}]}).tohex(),void 0===r||null==r?At(E,"PRIVATE KEY"):S(E,r);throw new Error("unsupported object nor format")},Wt.getKeyFromCSRPEM=function(t){var e=Bt(t,"CERTIFICATE REQUEST");return Wt.getKeyFromCSRHex(e)},Wt.getKeyFromCSRHex=function(t){var e=Wt.parseCSRHex(t);return Wt.getKey(e.p8pubkeyhex,null,"pkcs8pub")},Wt.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},Wt.getKeyID=function(t){var e=Wt,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 ht.crypto.Util.hashHex(s,"sha1")},Wt.getJWK=function(t,e,r,n,i){var s,a,o={},u=ht.crypto.Util.hashHex;if("string"==typeof t)s=Wt.getKey(t),-1!=t.indexOf("CERTIFICATE")&&(a=Bt(t));else{if("object"!=typeof t)throw new Error("unsupported keyinfo type");t instanceof Zt?(s=t.getPublicKey(),a=t.hex):s=t}if(s instanceof st&&s.isPrivate)o.kty="RSA",o.n=yt(s.n.toString(16)),o.e=yt(s.e.toString(16)),o.d=yt(s.d.toString(16)),o.p=yt(s.p.toString(16)),o.q=yt(s.q.toString(16)),o.dp=yt(s.dmp1.toString(16)),o.dq=yt(s.dmq1.toString(16)),o.qi=yt(s.coeff.toString(16));else if(s instanceof st&&s.isPublic)o.kty="RSA",o.n=yt(s.n.toString(16)),o.e=yt(s.e.toString(16));else if(s instanceof ht.crypto.ECDSA&&s.isPrivate){if("P-256"!==(h=s.getShortNISTPCurveName())&&"P-384"!==h&&"P-521"!==h)throw new Error("unsupported curve name for JWT: "+h);var c=s.getPublicKeyXYHex();o.kty="EC",o.crv=h,o.x=yt(c.x),o.y=yt(c.y),o.d=yt(s.prvKeyHex)}else if(s instanceof ht.crypto.ECDSA&&s.isPublic){var h;if("P-256"!==(h=s.getShortNISTPCurveName())&&"P-384"!==h&&"P-521"!==h)throw new Error("unsupported curve name for JWT: "+h);c=s.getPublicKeyXYHex(),o.kty="EC",o.crv=h,o.x=yt(c.x),o.y=yt(c.y)}if(null==o.kty)throw new Error("unsupported keyinfo");return s.isPrivate||1==e||(o.kid=ht.jws.JWS.getJWKthumbprint(o)),null!=a&&1!=r&&(o.x5c=[b(a)]),null!=a&&1!=n&&(o.x5t=mt(b(u(a,"sha1")))),null!=a&&1!=i&&(o["x5t#S256"]=mt(b(u(a,"sha256")))),o},Wt.getJWKFromKey=function(t){return Wt.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]),h=r(t,e[7]),l=r(t,e[8]);return(e=new Array).push(n,i,s,a,o,u,c,h,l),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,h=c.getVbyListEx;if(!1===c.isASN1HEX(t))throw new Error("not ASN.1 hex string");try{e=h(t,0,[2,0,1],"02"),r=h(t,0,[2,0,2],"02"),n=h(t,0,[2,0,3],"02"),i=h(t,0,[2,0,4],"02"),s=h(t,0,[2,0,5],"02"),a=h(t,0,[2,0,6],"02"),o=h(t,0,[2,0,7],"02"),u=h(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 Zt).readCertHex(t),n=r.getPublicKeyHex(),this.readPKCS8PubKeyHex(n)},st.prototype.sign=function(t,e){var r=function(t){return ht.crypto.Util.hashString(t,e)}(t);return this.signWithMessageHash(r,e)},st.prototype.signWithMessageHash=function(t,e){var r=it(ht.crypto.Util.getPaddedDigestInfoHex(t,e,this.n.bitLength()),16);return Jt(this.doPrivate(r).toString(16),this.n.bitLength())},st.prototype.signPSS=function(t,e,r){var n,i=(n=Ft(t),ht.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=St(t),s=i.length,a=this.n.bitLength()-1,o=Math.ceil(a/8),u=function(t){return ht.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(o0&&(c=new Array(r),(new nt).nextBytes(c),c=String.fromCharCode.apply(String,c));var h=St(u(Ft("\0\0\0\0\0\0\0\0"+i+c))),l=[];for(n=0;n>8*o-a&255;for(g[0]&=~d,n=0;nn)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 ht.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=Ft(t),ht.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 S(e,16),a=function(t){return ht.crypto.Util.hashHex(t,r)},o=St(t),u=o.length,c=this.n.bitLength()-1,h=Math.ceil(c/8);if(-1===n||void 0===n)n=u;else if(-2===n)n=h-u-2;else if(n<-2)throw new Error("invalid salt length");if(h>8*h-c&255;if(0!=(f.charCodeAt(0)&g))throw new Error("bits beyond keysize not zero");var d=Yt(p,f.length,a),m=[];for(i=0;i0&&-1==(":"+r.join(":")+":").indexOf(":"+m+":"))throw"algorithm '"+m+"' not accepted in the list";if("none"!=m&&null===e)throw"key shall be specified to verify.";if("string"==typeof e&&-1!=e.indexOf("-----BEGIN ")&&(e=Wt.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[d.alg])throw"unsupported alg name: "+m;if("none"==(v=s.jwsalg2sigalg[m]))throw"not supported";if("Hmac"==v.substr(0,4)){if(void 0===e)throw"hexadecimal key shall be specified for HMAC";var y=new c({alg:v,pass:e});return y.updateString(p),g==y.doFinal()}if(-1!=v.indexOf("withECDSA")){var x,w=null;try{w=u.concatSigToASN1Sig(g)}catch(t){return!1}return(x=new h({alg:v})).init(e),x.updateString(p),x.verify(w)}return(x=new h({alg:v})).init(e),x.updateString(p),x.verify(g)},ht.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=ht.jws.JWS.readSafeJSONString(ft(e)),s.payloadObj=ht.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=xt(n)),s},ht.jws.JWS.verifyJWT=function(t,e,r){var n=ht.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],h=u[1],l=(xt(u[2]),s(ft(c))),f=s(ft(h));if(void 0===l.alg)return!1;if(void 0===r.alg)throw"acceptField.alg shall be specified";if(!a(l.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.gracePeriodi&&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;e0))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=S,ht.crypto.ECDSA,ht.crypto.DSA,ht.crypto.Signature,ht.crypto.MessageDigest,ht.crypto.Mac,e.g5=pt,e.EF=Zt,e.lK=ht,ht.crypto,ht.asn1,ht.jws,ht.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=0&&e<=l.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),l.name=t,l.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},l.methodFactory=r||h,l.getLevel=function(){return null!=c?c:null!=o?o:a},l.setLevel=function(t,r){return c=g(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(l)},l.setDefaultLevel=function(t){o=g(t),p()||l.setLevel(t,!1)},l.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(l)},l.enableAll=function(t){l.setLevel(l.levels.TRACE,t)},l.disableAll=function(t){l.setLevel(l.levels.SILENT,t)},l.rebuild=function(){if(s!==l&&(a=g(s.getLevel())),u.call(l),s===l)for(var t in i)i[t].rebuild()},a=g(s?s.getLevel():"WARN");var d=p();null!=d&&(c=g(d)),u.call(l)}(s=new l).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 l(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,h=-1;function l(){c&&o&&(c=!1,o.length?u=o.concat(u):h=-1,u.length&&f())}function f(){if(!c){var t=a(l);c=!0;for(var e=u.length;e;){for(o=u,u=[];++h1)for(var r=1;r{!function(t){var e,r,n,i=String.fromCharCode;function s(t){for(var e,r,n=[],i=0,s=t.length;i=55296&&e<=56319&&i=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 h(){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="";++n65535&&(s+=i((e-=65536)>>>10&1023|55296),e=56320|1023&e),s+=i(e);return s}(o)}}(e)},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",h=u.asyncIterator||"@@asyncIterator",l=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 w?e:w,s=Object.create(i.prototype),a=new N(n||[]);return o(s,"_invoke",{value:D(t,r,a)}),s}function g(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}r.wrap=p;var d="suspendedStart",m="suspendedYield",v="executing",y="completed",x={};function w(){}function b(){}function E(){}var S={};f(S,c,(function(){return this}));var F=Object.getPrototypeOf,A=F&&F(F(O([])));A&&A!==s&&a.call(A,c)&&(S=A);var B=E.prototype=w.prototype=Object.create(S);function I(t){["next","throw","return"].forEach((function(e){f(t,e,(function(t){return this._invoke(e,t)}))}))}function C(t,e){function r(i,s,o,u){var c=g(t[i],t,s);if("throw"!==c.type){var h=c.arg,l=h.value;return l&&"object"==n(l)&&a.call(l,"__await")?e.resolve(l.__await).then((function(t){r("next",t,o,u)}),(function(t){r("throw",t,o,u)})):e.resolve(l).then((function(t){h.value=t,o(h)}),(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 D(t,r,n){var i=d;return function(s,a){if(i===v)throw new Error("Generator is already running");if(i===y){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=P(o,n);if(u){if(u===x)continue;return u}}if("next"===n.method)n.sent=n._sent=n.arg;else if("throw"===n.method){if(i===d)throw i=y,n.arg;n.dispatchException(n.arg)}else"return"===n.method&&n.abrupt("return",n.arg);i=v;var c=g(t,r,n);if("normal"===c.type){if(i=n.done?y:m,c.arg===x)continue;return{value:c.arg,done:n.done}}"throw"===c.type&&(i=y,n.method="throw",n.arg=c.arg)}}}function P(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,P(t,r),"throw"===r.method)||"return"!==n&&(r.method="throw",r.arg=new TypeError("The iterator does not provide a '"+n+"' method")),x;var s=g(i,t.iterator,r.arg);if("throw"===s.type)return r.method="throw",r.arg=s.arg,r.delegate=null,x;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,x):a:(r.method="throw",r.arg=new TypeError("iterator result is not an object"),r.delegate=null,x)}function T(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 R(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function N(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(T,this),this.reset(!0)}function O(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=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=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&a.call(n,"finallyLoc")&&this.prev=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),R(r),x}},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;R(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,r,n){return this.delegate={iterator:O(t),resultName:r,nextLoc:n},"next"===this.method&&(this.arg=e),x}},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;rt.length)&&(e=t.length);for(var r=0,n=new Array(e);r1&&void 0!==arguments[1]?arguments[1]:"A-Za-z0-9+/=";if(!t)return"";if("string"==typeof t&&(t=L.strToArrayBuffer(t)),t instanceof ArrayBuffer&&(t=new Uint8Array(t)),64!==(e=L.expandAlphRange(e).join("")).length&&65!==e.length)throw new A(`Invalid Base64 alphabet length (${e.length}): ${e}`);for(var r,n,i,s,a,o,u,c="",h=0;h>2,a=(3&r)<<4|(n=t[h++])>>4,o=(15&n)<<2|(i=t[h++])>>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=L.expandAlphRange(e).join("")).length&&65!==e.length)throw new A(`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 A(`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>2,h=(3&p)<<6|g,(u=l<<2|f>>4)>=0&&u<256&&d.push(u),c>=0&&c<256&&64!==p&&d.push(c),h>=0&&h<256&&64!==g&&d.push(h)}return"string"===r?L.byteArrayToUtf8(d):d}function C(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;o1&&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 A("Byte length must be a positive integer");if("None"!==e){var n="Auto"===e?/[^a-f\d]|0x/gi:L.regexRep(e);t=t.split(n)}else t=[t];for(var i=[],s=0;s1&&void 0!==arguments[1]?arguments[1]:"Auto";e=L.charRep(e);var r=[],n=t.split(e);""===n[n.length-1]&&(n=n.slice(0,n.length-1));for(var i=0;i1&&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 A("Byte length must be a positive integer");var n=L.regexRep(e);t=t.replace(n,"");for(var i=[],s=0;s65535){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),y(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=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>>=8;else for(var s=e-1;s>=0;s--)n[s]=255&t,t>>>=8;return n}},{key:"strToArrayBuffer",value:function(t){if(w().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(w().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&&(j()&&self&&"function"==typeof self.setOption?self.setOption("attemptHighlight",!1):H()&&(window.app.options.attemptHighlight=!1)),e.buffer}},{key:"strToByteArray",value:function(t){if(w().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(w().debug(`Converting string[${null==t?void 0:t.length}] to UTF8 byte array`),!t)return[];var r=E().encode(t);return t.length!==r.length&&(j()?self.setOption("attemptHighlight",!1):H()&&(window.app.options.attemptHighlight=!1)),e.strToByteArray(r)}},{key:"strToCharcode",value:function(t){if(w().debug(`Converting string[${null==t?void 0:t.length}] to charcode`),!t)return[];for(var r=[],n=0;n=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(w().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&&(j()?self.setOption("attemptHighlight",!1):H()&&(window.app.options.attemptHighlight=!1)),n}catch(r){return e.byteArrayToChars(t)}}},{key:"byteArrayToChars",value:function(t){if(w().debug(`Converting byte array[${null==t?void 0:t.length}] to chars`),!t||!t.length)return"";for(var e="",r=0;r1&&void 0!==arguments[1])||arguments[1];if(w().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;e0&&r.push(n[e]/t.length);var i,s=0;for(e=0;e1&&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 h=0;h=0?(u.push(o),o=""):!a&&i.indexOf(e)>=0?(u.push(o),o="",c.push(u),u=[],i.indexOf(r)>=0&&r!==e&&h++):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(/]*>(\s|\S)*?<\/script[^>]*>/gi,t),t=e(/]*>(\s|\S)*?<\/style[^>]*>/gi,t)),e(/<[^>]+>/g,t)}},{key:"escapeHtml",value:function(t){var e={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`","\0":""};return t?t.replace(/[&<>"'`\u0000]/g,(function(t){return e[t]})):t}},{key:"unescapeHtml",value:function(t){var e={"&":"&","<":"<",">":">",""":'"',"'":"'","/":"/","`":"`","":"\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(d().mark((function t(r){var n,i,s,a,o;return d().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=function(t){return`
\n
\n
\n ${e.escapeHtml(t.name)}\n
\n
\n
`},i=function(t,r){if(r.startsWith("image")){var n="data:";return n+=r+";",""}return`
${e.escapeHtml(e.arrayBufferToStr(t.buffer))}
`},s=function(){var t=p(d().mark((function t(r,n){var s,a,o,u;return d().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=`
\n
\n
\n \n \n ${r.size.toLocaleString()} bytes\n \n save\n \n \n open_in_browser\n \n \n
\n
\n
\n
\n ${i(s,r.type)}\n
\n
\n
`,t.abrupt("return",u);case 7:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),a=`
\n ${r.length} file(s) found\n
`,o=0;case 5:if(!(o=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(!k())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>=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 U=function(e){function r(){var e;t(this,r);for(var n=arguments.length,i=new Array(n),s=0;s0||t===e?e:e-1}function tt(t){for(var e,r,n=1,i=t.length,s=t[0]+"";nc^r?1:-1;for(o=(u=i.length)<(c=s.length)?u:c,a=0;as[a]^r?1:-1;return u==c?0:u>c^r?1:-1}function rt(t,e,r,n){if(tr||t!==q(t))throw Error(G+(n||"Argument")+("number"==typeof t?tr?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function nt(t){var e=t.c.length-1;return Q(t.e/W)==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 ex?f.c=f.e=null:t.e=10;u/=10,o++);return void(o>x?f.c=f.e=null:(f.e=o,f.c=[t]))}l=String(t)}else{if(!M.test(l=String(t)))return i(f,l,c);f.s=45==l.charCodeAt(0)?(l=l.slice(1),-1):1}(o=l.indexOf("."))>-1&&(l=l.replace(".","")),(u=l.search(/e/i))>0?(o<0&&(o=u),o+=+l.slice(u+1),l=l.substring(0,u)):o<0&&(o=l.length)}else{if(rt(e,2,F.length,"Base"),10==e&&A)return P(f=new B(t),g+f.e+1,d);if(l=String(t),c="number"==typeof t){if(0*t!=0)return i(f,l,c,e);if(f.s=1/t<0?(l=l.slice(1),-1):1,B.DEBUG&&l.replace(/^0\.0*|\./,"").length>15)throw Error($+t)}else f.s=45===l.charCodeAt(0)?(l=l.slice(1),-1):1;for(r=F.slice(0,e),o=u=0,h=l.length;uo){o=h;continue}}else if(!a&&(l==l.toUpperCase()&&(l=l.toLowerCase())||l==l.toLowerCase()&&(l=l.toUpperCase()))){a=!0,u=-1,o=0;continue}return i(f,String(t),c,e)}c=!1,(o=(l=n(l,e,10,f.s)).indexOf("."))>-1?l=l.replace(".",""):o=l.length}for(u=0;48===l.charCodeAt(u);u++);for(h=l.length;48===l.charCodeAt(--h););if(l=l.slice(u,++h)){if(h-=u,c&&B.DEBUG&&h>15&&(t>J||t!==q(t)))throw Error($+f.s*t);if((o=o-u-1)>x)f.c=f.e=null;else if(o=v)?it(u,a):st(u,a,"0");else if(s=(t=P(new B(t),e,r)).e,o=(u=tt(t.c)).length,1==n||2==n&&(e<=s||s<=m)){for(;oo){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 C(t,e){for(var r,n,i=1,s=new B(t[0]);i=10;i/=10,n++);return(r=n+r*W-1)>x?t.c=t.e=null:r=10;o/=10,i++);if((s=e-i)<0)s+=W,a=e,u=l[c=0],h=q(u/f[i-a-1]%10);else if((c=K((s+1)/W))>=l.length){if(!n)break t;for(;l.length<=c;l.push(0));u=h=0,i=1,a=(s%=W)-W+1}else{for(u=o=l[c],i=1;o>=10;o/=10,i++);h=(a=(s%=W)-W+i)<0?0:q(u/f[i-a-1]%10)}if(n=n||e<0||null!=l[c+1]||(a<0?u:u%f[i-a-1]),n=r<4?(h||n)&&(0==r||r==(t.s<0?3:2)):h>5||5==h&&(4==r||n||6==r&&(s>0?a>0?u/f[i-a]:0:l[c-1])%10&1||r==(t.s<0?8:7)),e<1||!l[0])return l.length=0,n?(e-=t.e+1,l[0]=f[(W-e%W)%W],t.e=-e||0):l[0]=t.e=0,t;if(0==s?(l.length=c,o=1,c--):(l.length=c+1,o=f[W-s],l[c]=a>0?q(u/f[i-a]%f[a])*o:0),n)for(;;){if(0==c){for(s=1,a=l[0];a>=10;a/=10,s++);for(a=l[0]+=o,o=1;a>=10;a/=10,o++);s!=o&&(t.e++,l[0]==z&&(l[0]=1));break}if(l[c]+=o,l[c]!=z)break;l[c--]=0,o=1}for(s=l.length;0===l[--s];l.pop());}t.e>x?t.c=t.e=null:t.e=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,Z,e),g=r),t.hasOwnProperty(e="ROUNDING_MODE")&&(rt(r=t[e],0,8,e),d=r),t.hasOwnProperty(e="EXPONENTIAL_AT")&&((r=t[e])&&r.pop?(rt(r[0],-Z,0,e),rt(r[1],0,Z,e),m=r[0],v=r[1]):(rt(r,-Z,Z,e),m=-(v=r<0?-r:r))),t.hasOwnProperty(e="RANGE"))if((r=t[e])&&r.pop)rt(r[0],-Z,-1,e),rt(r[1],1,Z,e),y=r[0],x=r[1];else{if(rt(r,-Z,Z,e),!r)throw Error(G+e+" cannot be zero: "+r);y=-(x=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 w=!r,Error(G+"crypto unavailable");w=r}else w=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,Z,e),E=r),t.hasOwnProperty(e="FORMAT")){if("object"!=typeof(r=t[e]))throw Error(G+e+" not an object: "+r);S=r}if(t.hasOwnProperty(e="ALPHABET")){if("string"!=typeof(r=t[e])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(G+e+" invalid: "+r);A="0123456789"==r.slice(0,10),F=r}}return{DECIMAL_PLACES:g,ROUNDING_MODE:d,EXPONENTIAL_AT:[m,v],RANGE:[y,x],CRYPTO:w,MODULO_MODE:b,POW_PRECISION:E,FORMAT:S,ALPHABET:F}},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>=-Z&&i<=Z&&i===q(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break t}if((e=(i+1)%W)<1&&(e+=W),String(n[0]).length==e){for(e=0;e=z||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 C(arguments,-1)},B.minimum=B.min=function(){return C(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=g:rt(t,0,Z),i=K(t/W),w)if(crypto.getRandomValues){for(e=crypto.getRandomValues(new Uint32Array(i*=2));o>>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 w=!1,Error(G+"crypto unavailable");for(e=crypto.randomBytes(i*=7);o=9e15?crypto.randomBytes(7).copy(e,o):(u.push(s%1e14),o+=7);o=i/7}if(!w)for(;o=10;s/=10,o++);or-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,h,l,f,p,m,v,y=n.indexOf("."),x=g,w=d;for(y>=0&&(l=E,E=0,n=n.replace(".",""),p=(v=new B(i)).pow(n.length-y),E=l,v.c=e(st(tt(p.c),p.e,"0"),10,s,t),v.e=v.c.length),h=l=(m=e(n,i,s,o?(u=F,t):(u=t,F))).length;0==m[--l];m.pop());if(!m[0])return u.charAt(0);if(y<0?--h:(p.c=m,p.e=h,p.s=a,m=(p=r(p,v,x,w,s)).c,f=p.r,h=p.e),y=m[c=h+x+1],l=s/2,f=f||c<0||null!=m[c+1],f=w<4?(null!=y||f)&&(0==w||w==(p.s<0?3:2)):y>l||y==l&&(4==w||f||6==w&&1&m[c-1]||w==(p.s<0?8:7)),c<1||!m[0])n=f?st(u.charAt(1),-x,u.charAt(0)):u.charAt(0);else{if(m.length=c,f)for(--s;++m[--c]>s;)m[c]=0,c||(++h,m=[1].concat(m));for(l=m.length;!m[--l];);for(y=0,n="";y<=l;n+=u.charAt(m[y++]));n=st(n,h,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,h=e/X|0;for(t=t.slice();u--;)o=((i=c*(s=t[u]%X)+(n=h*s+(a=t[u]/X|0)*c)%X*X+o)/r|0)+(n/X|0)+h*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;ie[i]?1:-1;break}return s}function r(t,e,r,n){for(var i=0;r--;)t[r]-=i,i=t[r]1;t.splice(0,1));}return function(n,i,s,a,o){var u,c,h,l,f,p,g,d,m,v,y,x,w,b,E,S,F,A=n.s==i.s?1:-1,I=n.c,C=i.c;if(!(I&&I[0]&&C&&C[0]))return new B(n.s&&i.s&&(I?!C||I[0]!=C[0]:C)?I&&0==I[0]||!C?0*A:A/0:NaN);for(m=(d=new B(A)).c=[],A=s+(c=n.e-i.e)+1,o||(o=z,c=Q(n.e/W)-Q(i.e/W),A=A/W|0),h=0;C[h]==(I[h]||0);h++);if(C[h]>(I[h]||0)&&c--,A<0)m.push(1),l=!0;else{for(b=I.length,S=C.length,h=0,A+=2,(f=q(o/(C[0]+1)))>1&&(C=t(C,f,o),I=t(I,f,o),S=C.length,b=I.length),w=S,y=(v=I.slice(0,S)).length;y=o/2&&E++;do{if(f=0,(u=e(C,v,S,y))<0){if(x=v[0],S!=y&&(x=x*o+(v[1]||0)),(f=q(x/E))>1)for(f>=o&&(f=o-1),g=(p=t(C,f,o)).length,y=v.length;1==e(p,v,g,y);)f--,r(p,S=10;A/=10,h++);P(d,s+(d.e=h+c*W-1)+1,a,l)}else d.e=c,d.r=+l;return d}}(),o=/^(-?)0([xbo])(?=\w[\w.]*$)/i,u=/^([^.]+)\.$/,c=/^\.([^.]+)$/,h=/^-?(Infinity|NaN)$/,l=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(t,e,r,n){var i,s=r?e:e.replace(l,"");if(h.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,Z),null==e?e=d:rt(e,0,8),P(new B(s),t+s.e+1,e);if(!(r=s.c))return null;if(n=((i=r.length-1)-Q(this.e/W))*W,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),g,d)},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,h=this;if((t=new B(t)).c&&!t.isInteger())throw Error(G+"Exponent not an integer: "+T(t));if(null!=e&&(e=new B(e)),a=t.e>14,!h.c||!h.c[0]||1==h.c[0]&&!h.e&&1==h.c.length||!t.c||!t.c[0])return c=new B(Math.pow(+T(h),a?t.s*(2-nt(t)):+T(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&&h.isInteger()&&e.isInteger())&&(h=h.mod(e))}else{if(t.e>9&&(h.e>0||h.e<-1||(0==h.e?h.c[0]>1||a&&h.c[1]>=24e7:h.c[0]<8e13||a&&h.c[0]<=9999975e7)))return s=h.s<0&&nt(t)?-0:0,h.e>-1&&(s=1/s),new B(o?1/s:s);E&&(s=K(E/W+2))}for(a?(r=new B(.5),o&&(t.s=1),u=nt(t)):u=(i=Math.abs(+T(t)))%2,c=new B(p);;){if(u){if(!(c=c.times(h)).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(P(t=t.times(r),t.e+1,1),t.e>14)u=nt(t);else{if(0==(i=+T(t)))break;u=i%2}h=h.times(h),s?h.c&&h.c.length>s&&(h.c.length=s):n&&(h=h.mod(e))}return n?c:(o&&(c=p.div(c)),e?c.mod(e):s?P(c,E,d,void 0):c)},f.integerValue=function(t){var e=new B(this);return null==t?t=d:rt(t,0,8),P(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&&Q(this.e/W)>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/W,c=t.e/W,h=a.c,l=t.c;if(!u||!c){if(!h||!l)return h?(t.s=-e,t):new B(l?a:NaN);if(!h[0]||!l[0])return l[0]?(t.s=-e,t):new B(h[0]?a:3==d?-0:0)}if(u=Q(u),c=Q(c),h=h.slice(),o=u-c){for((s=o<0)?(o=-o,i=h):(c=u,i=l),i.reverse(),e=o;e--;i.push(0));i.reverse()}else for(n=(s=(o=h.length)<(e=l.length))?o:e,o=e=0;e0)for(;e--;h[r++]=0);for(e=z-1;n>o;){if(h[--n]=0;){for(r=0,f=x[i]%m,p=x[i]/m|0,s=i+(a=u);s>i;)r=((c=f*(c=y[--a]%m)+(o=p*c+(h=y[a]/m|0)*f)%m*m+g[s]+r)/d|0)+(o/m|0)+p*h,g[s--]=c%d;g[s]=r}return r?++n:g.splice(0,1),D(t,g,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/W,a=t.e/W,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=Q(s),a=Q(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)/z|0,o[e]=z===o[e]?0:o[e]%z;return i&&(o=[i].concat(o),++a),D(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,Z),null==e?e=d:rt(e,0,8),P(new B(s),t,e);if(!(r=s.c))return null;if(n=(i=r.length-1)*W+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,J),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,h=g+4,l=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(+T(a)))||u==1/0?(((e=tt(o)).length+c)%2==0&&(e+="0"),u=Math.sqrt(+e),c=Q((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)+h)<3&&(u=0);;)if(s=n,n=l.times(s.plus(r(a,s,h,1))),tt(s.c).slice(0,u)===(e=tt(n.c)).slice(0,u)){if(n.e0&&g>0){for(s=g%o||o,h=p.substr(0,s);s0&&(h+=c+p.slice(s)),f&&(h="-"+h)}n=l?h+(r.decimalSeparator||"")+((u=+r.fractionGroupSize)?l.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):l):h}return(r.prefix||"")+n+(r.suffix||"")},f.toFraction=function(t){var e,n,i,s,a,o,u,c,h,l,f,g,m=this,v=m.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: ")+T(u));if(!v)return new B(m);for(e=new B(p),h=n=new B(p),i=c=new B(p),g=tt(v),a=e.e=g.length-m.e-1,e.c[0]=Y[(o=a%W)<0?W+o:o],t=!t||u.comparedTo(e)>0?a>0?e:h:u,o=x,x=1/0,u=new B(g),c.c[0]=0;l=r(u,e,0,1),1!=(s=n.plus(l.times(i))).comparedTo(t);)n=i,i=s,h=c.plus(l.times(s=h)),c=s,e=u.minus(l.times(s=e)),u=s;return s=r(t.minus(n),i,0,1),c=c.plus(s.times(h)),n=n.plus(s.times(i)),c.s=h.s=m.s,f=r(h,i,a*=2,d).minus(m).abs().comparedTo(r(c,n,a,d).minus(m).abs())<1?[h,i]:[c,n],x=o,f},f.toNumber=function(){return+T(this)},f.toPrecision=function(t,e){return null!=t&&rt(t,1,Z),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<=m||s>=v?it(tt(r.c),s):st(tt(r.c),s,"0"):10===t&&A?e=st(tt((r=P(new B(r),g+s+1,d)).c),r.e,"0"):(rt(t,2,F.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 T(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;r1&&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;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<>>=this.bitPos),i=8-this.bitPos,this.bitPos=0;it){var s=i-t;"be"===e?n>>>=s:n&=(1<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=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.positionthis.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.position0&&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 ht(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 lt(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)?lt(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 lt(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r>4],u=i[(15&a)>>2],c=(2&a)>>1;if("free"===o||"bad"===o||"reserved"===u){r.moveBackwardsBy(1);break}var h=Math.floor(144*o/u+c);if(r.position+h>r.length){r.moveTo(r.length);break}r.moveForwardsBy(h-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:gt},{name:"MacOS Mach-O 64-bit object",extension:"dylib",mime:"application/octet-stream",description:"",signature:{0:207,1:250,2:237,3:254},extractor:gt},{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),wt(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=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 h=r.readInt(4,"be"),l=c===h?i:i+n;r.moveForwardsBy(h+4*l)}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=ht(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 gt(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;s0&&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],Et=[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 St(t,e,r){for(var n,i=0;(n=At(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=At(t,r),t.readBits(Et[n],"le"))}}function Ft(t){for(var e=Math.max.apply(Math,t),r=Math.min.apply(Math,t),n=1<>=1;for(var f=s<<16|u,p=c;p>>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;n2&&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 Ct=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 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 Tt=function(e){function r(){return t(this,r),Dt(this,r,arguments)}return h(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}(Ct);function Rt(t,e,r){return e=u(e),o(t,Nt()?Reflect.construct(e,r||[],u(t).constructor):e.apply(t,r))}function Nt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Nt=function(){return!!t})()}const Ot=function(e){function r(){return t(this,r),Rt(this,r,arguments)}return h(r,e),s(r,null,[{key:"toArrayBuffer",value:function(){r.checkForValue(this.value),this.value=ot.isBigNumber(this.value)?L.strToArrayBuffer(this.value.toFixed()):new ArrayBuffer}},{key:"fromArrayBuffer",value:function(){r.checkForValue(this.value);try{this.value=new ot(L.arrayBufferToStr(this.value))}catch(t){this.value=new ot(NaN)}}}]),r}(Ct);function kt(t,e,r){return e=u(e),o(t,Ht()?Reflect.construct(e,r||[],u(t).constructor):e.apply(t,r))}function Ht(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Ht=function(){return!!t})()}const jt=function(e){function r(){return t(this,r),kt(this,r,arguments)}return h(r,e),s(r,null,[{key:"toArrayBuffer",value:function(){var t=this;if(r.checkForValue(this.value),!k())return new Promise((function(e,r){L.readFile(t.value).then((function(e){return t.value=e.buffer})).then(e).catch(r)}));this.value=L.readFileSync(this.value)}},{key:"fromArrayBuffer",value:function(){r.checkForValue(this.value),this.value=new File(this.value,"unknown")}}]),r}(Ct);function Lt(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 _t=function(e){function r(){return t(this,r),Lt(this,r,arguments)}return h(r,e),s(r,null,[{key:"toArrayBuffer",value:function(){r.checkForValue(this.value),this.value=this.value?L.strToArrayBuffer(this.value):new ArrayBuffer}},{key:"fromArrayBuffer",value:function(){r.checkForValue(this.value),this.value=this.value?L.arrayBufferToStr(this.value):""}}]),r}(Ct);function Ut(t,e,r){return e=u(e),o(t,Mt()?Reflect.construct(e,r||[],u(t).constructor):e.apply(t,r))}function Mt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Mt=function(){return!!t})()}const Kt=function(e){function r(){return t(this,r),Ut(this,r,arguments)}return h(r,e),s(r,null,[{key:"toArrayBuffer",value:function(){r.checkForValue(this.value),this.value=this.value?L.strToArrayBuffer(L.unescapeHtml(L.stripHtmlTags(this.value,!0))):new ArrayBuffer}}]),r}(_t);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 $t=function(e){function r(){return t(this,r),qt(this,r,arguments)}return h(r,e),s(r,null,[{key:"toArrayBuffer",value:function(){r.checkForValue(this.value),this.value=void 0!==this.value?L.strToArrayBuffer(JSON.stringify(this.value,null,4)):new ArrayBuffer}},{key:"fromArrayBuffer",value:function(){r.checkForValue(this.value),this.value=JSON.parse(L.arrayBufferToStr(this.value))}}]),r}(Ct);function zt(t,e,r){return e=u(e),o(t,Wt()?Reflect.construct(e,r||[],u(t).constructor):e.apply(t,r))}function Wt(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(Wt=function(){return!!t})()}const Jt=function(e){function r(){return t(this,r),zt(this,r,arguments)}var n,i;return h(r,e),s(r,null,[{key:"toArrayBuffer",value:(i=p(d().mark((function t(){return d().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(r.checkForValue(this.value),!k()){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,y(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(d().mark((function t(){var e,r,n,i,s,a,o,u,c,h,l,f,p,g=arguments;return d().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(e=0,r=g.length,n=new Array(r),i=0;i0&&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?k()?(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)),w().debug("Dish type: "+e.enumLookup(r)),this.value=t,this.type=r,!this.valid()){var n=L.truncate(JSON.stringify(this.value),25);throw new U(`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(d().mark((function t(r){var n,i;return d().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),w().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;t255)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 U("Cannot clone Dish, unknown type")}return t}},{key:"_translate",value:function(t){var r=this;if(w().debug(`Translating Dish from ${e.enumLookup(this.type)} to ${e.enumLookup(t)}`),!k())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(_t.toArrayBuffer.bind(t)())},[e.NUMBER]:function(){return Promise.resolve(Zt.toArrayBuffer.bind(t)())},[e.HTML]:function(){return Promise.resolve(Kt.toArrayBuffer.bind(t)())},[e.ARRAY_BUFFER]:function(){return Promise.resolve()},[e.BIG_NUMBER]:function(){return Promise.resolve(Ot.toArrayBuffer.bind(t)())},[e.JSON]:function(){return Promise.resolve($t.toArrayBuffer.bind(t)())},[e.FILE]:function(){return jt.toArrayBuffer.bind(t)()},[e.LIST_FILE]:function(){return Promise.resolve(Jt.toArrayBuffer.bind(t)())},[e.BYTE_ARRAY]:function(){return Promise.resolve(Tt.toArrayBuffer.bind(t)())}},node:{[e.STRING]:function(){return _t.toArrayBuffer.bind(t)()},[e.NUMBER]:function(){return Zt.toArrayBuffer.bind(t)()},[e.HTML]:function(){return Kt.toArrayBuffer.bind(t)()},[e.ARRAY_BUFFER]:function(){},[e.BIG_NUMBER]:function(){return Ot.toArrayBuffer.bind(t)()},[e.JSON]:function(){return $t.toArrayBuffer.bind(t)()},[e.FILE]:function(){return jt.toArrayBuffer.bind(t)()},[e.LIST_FILE]:function(){return Jt.toArrayBuffer.bind(t)()},[e.BYTE_ARRAY]:function(){return Tt.toArrayBuffer.bind(t)()}}};try{return r[k()?"node":"browser"][this.type]()}catch(t){throw new U(`Error translating from ${e.enumLookup(this.type)} to ArrayBuffer: ${t}`)}}},{key:"_fromArrayBuffer",value:function(t){var r=this,n={[e.STRING]:function(){return _t.fromArrayBuffer.bind(r)()},[e.NUMBER]:function(){return Zt.fromArrayBuffer.bind(r)()},[e.HTML]:function(){return Kt.fromArrayBuffer.bind(r)()},[e.ARRAY_BUFFER]:function(){},[e.BIG_NUMBER]:function(){return Ot.fromArrayBuffer.bind(r)()},[e.JSON]:function(){return $t.fromArrayBuffer.bind(r)()},[e.FILE]:function(){return jt.fromArrayBuffer.bind(r)()},[e.LIST_FILE]:function(){return Jt.fromArrayBuffer.bind(r)()},[e.BYTE_ARRAY]:function(){return Tt.fromArrayBuffer.bind(r)()}};try{n[t](),this.type=t}catch(r){throw new U(`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":return e.LIST_FILE;default:throw new U("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";default:throw new U("Invalid data type enum. No matching type.")}}}]),e}();Qt.BYTE_ARRAY=0,Qt.STRING=1,Qt.NUMBER=2,Qt.HTML=3,Qt.ARRAY_BUFFER=4,Qt.BIG_NUMBER=5,Qt.JSON=6,Qt.FILE=7,Qt.LIST_FILE=8;const te=Qt,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 L.parseEscapedChars(t);case"byteArray":return"string"==typeof t?D(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: "+L.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 h(r,e),s(r,[{key:"run",value:function(t,e){return l.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 h(r,e),s(r,[{key:"run",value:function(t,e){return l.lK.asn1.ASN1Util.getPEMStringFromHex(t.replace(/\s/g,""),e[0])}}]),r}(ne);function he(t,e,r){return e=u(e),o(t,le()?Reflect.construct(e,r||[],u(t).constructor):e.apply(t,r))}function le(){try{var t=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){})))}catch(t){}return(le=function(){return!!t})()}const fe=function(e){function r(){var e;return t(this,r),(e=he(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 h(r,e),s(r,[{key:"run",value:function(t,e){return l.lK.asn1.ASN1Util.oidIntToHex(t)}}]),r}(ne);function pe(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 de=function(e){function r(){var e;return t(this,r),(e=pe(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.

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 h(r,e),s(r,[{key:"run",value:function(t,e){var r=ut(e,2),n=r[0],i=r[1];return l.g5.dump(t.replace(/\s/g,"").toLowerCase(),{ommit_long_octet:i},n)}}]),r}(ne);function me(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