text: /*! For license information please see PublicKey.js.LICENSE.txt */
  (()=>{var t={59591:(t,e,r)=>{var n=r(50008).default;function i(){"use strict";t.exports=i=function(){return e},t.exports.__esModule=!0,t.exports.default=t.exports;var e={},r=Object.prototype,s=r.hasOwnProperty,a="function"==typeof Symbol?Symbol:{},o=a.iterator||"@@iterator",u=a.asyncIterator||"@@asyncIterator",c=a.toStringTag||"@@toStringTag";function h(t,e,r){return Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}),t[e]}try{h({},"")}catch(t){h=function(t,e,r){return t[e]=r}}function l(t,e,r,n){var i=e&&e.prototype instanceof g?e:g,s=Object.create(i.prototype),a=new B(n||[]);return s._invoke=function(t,e,r){var n="suspendedStart";return function(i,s){if("executing"===n)throw new Error("Generator is already running");if("completed"===n){if("throw"===i)throw s;return{value:void 0,done:!0}}for(r.method=i,r.arg=s;;){var a=r.delegate;if(a){var o=S(a,r);if(o){if(o===p)continue;return o}}if("next"===r.method)r.sent=r._sent=r.arg;else if("throw"===r.method){if("suspendedStart"===n)throw n="completed",r.arg;r.dispatchException(r.arg)}else"return"===r.method&&r.abrupt("return",r.arg);n="executing";var u=f(t,e,r);if("normal"===u.type){if(n=r.done?"completed":"suspendedYield",u.arg===p)continue;return{value:u.arg,done:r.done}}"throw"===u.type&&(n="completed",r.method="throw",r.arg=u.arg)}}}(t,r,a),s}function f(t,e,r){try{return{type:"normal",arg:t.call(e,r)}}catch(t){return{type:"throw",arg:t}}}e.wrap=l;var p={};function g(){}function d(){}function m(){}var v={};h(v,o,(function(){return this}));var y=Object.getPrototypeOf,x=y&&y(y(I([])));x&&x!==r&&s.call(x,o)&&(v=x);var w=m.prototype=g.prototype=Object.create(v);function b(t){["next","throw","return"].forEach((function(e){h(t,e,(function(t){return this._invoke(e,t)}))}))}function E(t,e){function r(i,a,o,u){var c=f(t[i],t,a);if("throw"!==c.type){var h=c.arg,l=h.value;return l&&"object"==n(l)&&s.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;this._invoke=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 S(t,e){var r=t.iterator[e.method];if(void 0===r){if(e.delegate=null,"throw"===e.method){if(t.iterator.return&&(e.method="return",e.arg=void 0,S(t,e),"throw"===e.method))return p;e.method="throw",e.arg=new TypeError("The iterator does not provide a 'throw' method")}return p}var n=f(r,t.iterator,e.arg);if("throw"===n.type)return e.method="throw",e.arg=n.arg,e.delegate=null,p;var i=n.arg;return i?i.done?(e[t.resultName]=i.value,e.next=t.nextLoc,"return"!==e.method&&(e.method="next",e.arg=void 0),e.delegate=null,p):i:(e.method="throw",e.arg=new TypeError("iterator result is not an object"),e.delegate=null,p)}function F(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 A(t){var e=t.completion||{};e.type="normal",delete e.arg,t.completion=e}function B(t){this.tryEntries=[{tryLoc:"root"}],t.forEach(F,this),this.reset(!0)}function I(t){if(t){var e=t[o];if(e)return e.call(t);if("function"==typeof t.next)return t;if(!isNaN(t.length)){var r=-1,n=function e(){for(;++r<t.length;)if(s.call(t,r))return e.value=t[r],e.done=!1,e;return e.value=void 0,e.done=!0,e};return n.next=n}}return{next:D}}function D(){return{value:void 0,done:!0}}return d.prototype=m,h(w,"constructor",m),h(m,"constructor",d),d.displayName=h(m,c,"GeneratorFunction"),e.isGeneratorFunction=function(t){var e="function"==typeof t&&t.constructor;return!!e&&(e===d||"GeneratorFunction"===(e.displayName||e.name))},e.mark=function(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,m):(t.__proto__=m,h(t,c,"GeneratorFunction")),t.prototype=Object.create(w),t},e.awrap=function(t){return{__await:t}},b(E.prototype),h(E.prototype,u,(function(){return this})),e.AsyncIterator=E,e.async=function(t,r,n,i,s){void 0===s&&(s=Promise);var a=new E(l(t,r,n,i),s);return e.isGeneratorFunction(r)?a:a.next().then((function(t){return t.done?t.value:a.next()}))},b(w),h(w,c,"Generator"),h(w,o,(function(){return this})),h(w,"toString",(function(){return"[object Generator]"})),e.keys=function(t){var e=[];for(var r in t)e.push(r);return e.reverse(),function r(){for(;e.length;){var n=e.pop();if(n in t)return r.value=n,r.done=!1,r}return r.done=!0,r}},e.values=I,B.prototype={constructor:B,reset:function(t){if(this.prev=0,this.next=0,this.sent=this._sent=void 0,this.done=!1,this.delegate=null,this.method="next",this.arg=void 0,this.tryEntries.forEach(A),!t)for(var e in this)"t"===e.charAt(0)&&s.call(this,e)&&!isNaN(+e.slice(1))&&(this[e]=void 0)},stop:function(){this.done=!0;var t=this.tryEntries[0].completion;if("throw"===t.type)throw t.arg;return this.rval},dispatchException:function(t){if(this.done)throw t;var e=this;function r(r,n){return a.type="throw",a.arg=t,e.next=r,n&&(e.method="next",e.arg=void 0),!!n}for(var n=this.tryEntries.length-1;n>=0;--n){var i=this.tryEntries[n],a=i.completion;if("root"===i.tryLoc)return r("end");if(i.tryLoc<=this.prev){var o=s.call(i,"catchLoc"),u=s.call(i,"finallyLoc");if(o&&u){if(this.prev<i.catchLoc)return r(i.catchLoc,!0);if(this.prev<i.finallyLoc)return r(i.finallyLoc)}else if(o){if(this.prev<i.catchLoc)return r(i.catchLoc,!0)}else{if(!u)throw new Error("try statement without catch or finally");if(this.prev<i.finallyLoc)return r(i.finallyLoc)}}}},abrupt:function(t,e){for(var r=this.tryEntries.length-1;r>=0;--r){var n=this.tryEntries[r];if(n.tryLoc<=this.prev&&s.call(n,"finallyLoc")&&this.prev<n.finallyLoc){var i=n;break}}i&&("break"===t||"continue"===t)&&i.tryLoc<=e&&e<=i.finallyLoc&&(i=null);var a=i?i.completion:{};return a.type=t,a.arg=e,i?(this.method="next",this.next=i.finallyLoc,p):this.complete(a)},complete:function(t,e){if("throw"===t.type)throw t.arg;return"break"===t.type||"continue"===t.type?this.next=t.arg:"return"===t.type?(this.rval=this.arg=t.arg,this.method="return",this.next="end"):"normal"===t.type&&e&&(this.next=e),p},finish:function(t){for(var e=this.tryEntries.length-1;e>=0;--e){var r=this.tryEntries[e];if(r.finallyLoc===t)return this.complete(r.completion,r.afterLoc),A(r),p}},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;A(r)}return i}}throw new Error("illegal catch attempt")},delegateYield:function(t,e,r){return this.delegate={iterator:I(t),resultName:e,nextLoc:r},"next"===this.method&&(this.arg=void 0),p}},e}t.exports=i,t.exports.__esModule=!0,t.exports.default=t.exports},50008: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},87757:(t,e,r)=>{var n=r(59591)();t.exports=n;try{regeneratorRuntime=n}catch(t){"object"==typeof globalThis?globalThis.regeneratorRuntime=n:Function("r","regeneratorRuntime = r")(n)}},79742:(t,e)=>{"use strict";e.byteLength=function(t){var e=u(t),r=e[0],n=e[1];return 3*(r+n)/4-n},e.toByteArray=function(t){var e,r,s=u(t),a=s[0],o=s[1],c=new i(function(t,e,r){return 3*(e+r)/4-r}(0,a,o)),h=0,l=o>0?a-4:a;for(r=0;r<l;r+=4)e=n[t.charCodeAt(r)]<<18|n[t.charCodeAt(r+1)]<<12|n[t.charCodeAt(r+2)]<<6|n[t.charCodeAt(r+3)],c[h++]=e>>16&255,c[h++]=e>>8&255,c[h++]=255&e;return 2===o&&(e=n[t.charCodeAt(r)]<<2|n[t.charCodeAt(r+1)]>>4,c[h++]=255&e),1===o&&(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,u=n-i;o<u;o+=a)s.push(c(t,o,o+a>u?u: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,o=s.length;a<o;++a)r[a]=s[a],n[s.charCodeAt(a)]=a;function u(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 c(t,e,n){for(var i,s,a=[],o=e;o<n;o+=3)i=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(255&t[o+2]),a.push(r[(s=i)>>18&63]+r[s>>12&63]+r[s>>6&63]+r[63&s]);return a.join("")}n["-".charCodeAt(0)]=62,n["_".charCodeAt(0)]=63},44431:function(t,e,r){var n;!function(i){"use strict";var s,a=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,o=Math.ceil,u=Math.floor,c="[BigNumber Error] ",h=c+"Number primitive has more than 15 significant digits: ",l=1e14,f=14,p=9007199254740991,g=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],d=1e7,m=1e9;function v(t){var e=0|t;return t>0||t===e?e:e-1}function y(t){for(var e,r,n=1,i=t.length,s=t[0]+"";n<i;){for(e=t[n++]+"",r=f-e.length;r--;e="0"+e);s+=e}for(i=s.length;48===s.charCodeAt(--i););return s.slice(0,i+1||1)}function x(t,e){var r,n,i=t.c,s=e.c,a=t.s,o=e.s,u=t.e,c=e.e;if(!a||!o)return null;if(r=i&&!i[0],n=s&&!s[0],r||n)return r?n?0:-o:a;if(a!=o)return a;if(r=a<0,n=u==c,!i||!s)return n?0:!i^r?1:-1;if(!n)return u>c^r?1:-1;for(o=(u=i.length)<(c=s.length)?u:c,a=0;a<o;a++)if(i[a]!=s[a])return i[a]>s[a]^r?1:-1;return u==c?0:u>c^r?1:-1}function w(t,e,r,n){if(t<e||t>r||t!==u(t))throw Error(c+(n||"Argument")+("number"==typeof t?t<e||t>r?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function b(t){var e=t.c.length-1;return v(t.e/f)==e&&t.c[e]%2!=0}function E(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function S(t,e,r){var n,i;if(e<0){for(i=r+".";++e;i+=r);t=i+t}else if(++e>(n=t.length)){for(i=r,e-=n;--e;i+=r);t+=i}else e<n&&(t=t.slice(0,e)+"."+t.slice(e));return t}s=function t(e){var r,n,i,s,F,A,B,I,D,C,R=q.prototype={constructor:q,toString:null,valueOf:null},P=new q(1),T=20,N=4,O=-7,k=21,H=-1e7,j=1e7,L=!1,V=1,_=0,U={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},M="0123456789abcdefghijklmnopqrstuvwxyz",K=!0;function q(t,e){var r,s,o,c,l,g,d,m,v=this;if(!(v instanceof q))return new q(t,e);if(null==e){if(t&&!0===t._isBigNumber)return v.s=t.s,void(!t.c||t.e>j?v.c=v.e=null:t.e<H?v.c=[v.e=0]:(v.e=t.e,v.c=t.c.slice()));if((g="number"==typeof t)&&0*t==0){if(v.s=1/t<0?(t=-t,-1):1,t===~~t){for(c=0,l=t;l>=10;l/=10,c++);return void(c>j?v.c=v.e=null:(v.e=c,v.c=[t]))}m=String(t)}else{if(!a.test(m=String(t)))return i(v,m,g);v.s=45==m.charCodeAt(0)?(m=m.slice(1),-1):1}(c=m.indexOf("."))>-1&&(m=m.replace(".","")),(l=m.search(/e/i))>0?(c<0&&(c=l),c+=+m.slice(l+1),m=m.substring(0,l)):c<0&&(c=m.length)}else{if(w(e,2,M.length,"Base"),10==e&&K)return W(v=new q(t),T+v.e+1,N);if(m=String(t),g="number"==typeof t){if(0*t!=0)return i(v,m,g,e);if(v.s=1/t<0?(m=m.slice(1),-1):1,q.DEBUG&&m.replace(/^0\.0*|\./,"").length>15)throw Error(h+t)}else v.s=45===m.charCodeAt(0)?(m=m.slice(1),-1):1;for(r=M.slice(0,e),c=l=0,d=m.length;l<d;l++)if(r.indexOf(s=m.charAt(l))<0){if("."==s){if(l>c){c=d;continue}}else if(!o&&(m==m.toUpperCase()&&(m=m.toLowerCase())||m==m.toLowerCase()&&(m=m.toUpperCase()))){o=!0,l=-1,c=0;continue}return i(v,String(t),g,e)}g=!1,(c=(m=n(m,e,10,v.s)).indexOf("."))>-1?m=m.replace(".",""):c=m.length}for(l=0;48===m.charCodeAt(l);l++);for(d=m.length;48===m.charCodeAt(--d););if(m=m.slice(l,++d)){if(d-=l,g&&q.DEBUG&&d>15&&(t>p||t!==u(t)))throw Error(h+v.s*t);if((c=c-l-1)>j)v.c=v.e=null;else if(c<H)v.c=[v.e=0];else{if(v.e=c,v.c=[],l=(c+1)%f,c<0&&(l+=f),l<d){for(l&&v.c.push(+m.slice(0,l)),d-=f;l<d;)v.c.push(+m.slice(l,l+=f));l=f-(m=m.slice(l)).length}else l-=d;for(;l--;m+="0");v.c.push(+m)}}else v.c=[v.e=0]}function G(t,e,r,n){var i,s,a,o,u;if(null==r?r=N:w(r,0,8),!t.c)return t.toString();if(i=t.c[0],a=t.e,null==e)u=y(t.c),u=1==n||2==n&&(a<=O||a>=k)?E(u,a):S(u,a,"0");else if(s=(t=W(new q(t),e,r)).e,o=(u=y(t.c)).length,1==n||2==n&&(e<=s||s<=O)){for(;o<e;u+="0",o++);u=E(u,s)}else if(e-=a,u=S(u,s,"0"),s+1>o){if(--e>0)for(u+=".";e--;u+="0");}else if((e+=s-o)>0)for(s+1==o&&(u+=".");e--;u+="0");return t.s<0&&i?"-"+u:u}function $(t,e){for(var r,n=1,i=new q(t[0]);n<t.length;n++){if(!(r=new q(t[n])).s){i=r;break}e.call(i,r)&&(i=r)}return i}function z(t,e,r){for(var n=1,i=e.length;!e[--i];e.pop());for(i=e[0];i>=10;i/=10,n++);return(r=n+r*f-1)>j?t.c=t.e=null:r<H?t.c=[t.e=0]:(t.e=r,t.c=e),t}function W(t,e,r,n){var i,s,a,c,h,p,d,m=t.c,v=g;if(m){t:{for(i=1,c=m[0];c>=10;c/=10,i++);if((s=e-i)<0)s+=f,a=e,d=(h=m[p=0])/v[i-a-1]%10|0;else if((p=o((s+1)/f))>=m.length){if(!n)break t;for(;m.length<=p;m.push(0));h=d=0,i=1,a=(s%=f)-f+1}else{for(h=c=m[p],i=1;c>=10;c/=10,i++);d=(a=(s%=f)-f+i)<0?0:h/v[i-a-1]%10|0}if(n=n||e<0||null!=m[p+1]||(a<0?h:h%v[i-a-1]),n=r<4?(d||n)&&(0==r||r==(t.s<0?3:2)):d>5||5==d&&(4==r||n||6==r&&(s>0?a>0?h/v[i-a]:0:m[p-1])%10&1||r==(t.s<0?8:7)),e<1||!m[0])return m.length=0,n?(e-=t.e+1,m[0]=v[(f-e%f)%f],t.e=-e||0):m[0]=t.e=0,t;if(0==s?(m.length=p,c=1,p--):(m.length=p+1,c=v[f-s],m[p]=a>0?u(h/v[i-a]%v[a])*c:0),n)for(;;){if(0==p){for(s=1,a=m[0];a>=10;a/=10,s++);for(a=m[0]+=c,c=1;a>=10;a/=10,c++);s!=c&&(t.e++,m[0]==l&&(m[0]=1));break}if(m[p]+=c,m[p]!=l)break;m[p--]=0,c=1}for(s=m.length;0===m[--s];m.pop());}t.e>j?t.c=t.e=null:t.e<H&&(t.c=[t.e=0])}return t}function J(t){var e,r=t.e;return null===r?t.toString():(e=y(t.c),e=r<=O||r>=k?E(e,r):S(e,r,"0"),t.s<0?"-"+e:e)}return q.clone=t,q.ROUND_UP=0,q.ROUND_DOWN=1,q.ROUND_CEIL=2,q.ROUND_FLOOR=3,q.ROUND_HALF_UP=4,q.ROUND_HALF_DOWN=5,q.ROUND_HALF_EVEN=6,q.ROUND_HALF_CEIL=7,q.ROUND_HALF_FLOOR=8,q.EUCLID=9,q.config=q.set=function(t){var e,r;if(null!=t){if("object"!=typeof t)throw Error(c+"Object expected: "+t);if(t.hasOwnProperty(e="DECIMAL_PLACES")&&(w(r=t[e],0,m,e),T=r),t.hasOwnProperty(e="ROUNDING_MODE")&&(w(r=t[e],0,8,e),N=r),t.hasOwnProperty(e="EXPONENTIAL_AT")&&((r=t[e])&&r.pop?(w(r[0],-m,0,e),w(r[1],0,m,e),O=r[0],k=r[1]):(w(r,-m,m,e),O=-(k=r<0?-r:r))),t.hasOwnProperty(e="RANGE"))if((r=t[e])&&r.pop)w(r[0],-m,-1,e),w(r[1],1,m,e),H=r[0],j=r[1];else{if(w(r,-m,m,e),!r)throw Error(c+e+" cannot be zero: "+r);H=-(j=r<0?-r:r)}if(t.hasOwnProperty(e="CRYPTO")){if((r=t[e])!==!!r)throw Error(c+e+" not true or false: "+r);if(r){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw L=!r,Error(c+"crypto unavailable");L=r}else L=r}if(t.hasOwnProperty(e="MODULO_MODE")&&(w(r=t[e],0,9,e),V=r),t.hasOwnProperty(e="POW_PRECISION")&&(w(r=t[e],0,m,e),_=r),t.hasOwnProperty(e="FORMAT")){if("object"!=typeof(r=t[e]))throw Error(c+e+" not an object: "+r);U=r}if(t.hasOwnProperty(e="ALPHABET")){if("string"!=typeof(r=t[e])||/^.?$|[+\-.\s]|(.).*\1/.test(r))throw Error(c+e+" invalid: "+r);K="0123456789"==r.slice(0,10),M=r}}return{DECIMAL_PLACES:T,ROUNDING_MODE:N,EXPONENTIAL_AT:[O,k],RANGE:[H,j],CRYPTO:L,MODULO_MODE:V,POW_PRECISION:_,FORMAT:U,ALPHABET:M}},q.isBigNumber=function(t){if(!t||!0!==t._isBigNumber)return!1;if(!q.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>=-m&&i<=m&&i===u(i)){if(0===n[0]){if(0===i&&1===n.length)return!0;break t}if((e=(i+1)%f)<1&&(e+=f),String(n[0]).length==e){for(e=0;e<n.length;e++)if((r=n[e])<0||r>=l||r!==u(r))break t;if(0!==r)return!0}}}else if(null===n&&null===i&&(null===s||1===s||-1===s))return!0;throw Error(c+"Invalid BigNumber: "+t)},q.maximum=q.max=function(){return $(arguments,R.lt)},q.minimum=q.min=function(){return $(arguments,R.gt)},q.random=(s=9007199254740992,F=Math.random()*s&2097151?function(){return u(Math.random()*s)}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(t){var e,r,n,i,s,a=0,h=[],l=new q(P);if(null==t?t=T:w(t,0,m),i=o(t/f),L)if(crypto.getRandomValues){for(e=crypto.getRandomValues(new Uint32Array(i*=2));a<i;)(s=131072*e[a]+(e[a+1]>>>11))>=9e15?(r=crypto.getRandomValues(new Uint32Array(2)),e[a]=r[0],e[a+1]=r[1]):(h.push(s%1e14),a+=2);a=i/2}else{if(!crypto.randomBytes)throw L=!1,Error(c+"crypto unavailable");for(e=crypto.randomBytes(i*=7);a<i;)(s=281474976710656*(31&e[a])+1099511627776*e[a+1]+4294967296*e[a+2]+16777216*e[a+3]+(e[a+4]<<16)+(e[a+5]<<8)+e[a+6])>=9e15?crypto.randomBytes(7).copy(e,a):(h.push(s%1e14),a+=7);a=i/7}if(!L)for(;a<i;)(s=F())<9e15&&(h[a++]=s%1e14);for(i=h[--a],t%=f,i&&t&&(s=g[f-t],h[a]=u(i/s)*s);0===h[a];h.pop(),a--);if(a<0)h=[n=0];else{for(n=-1;0===h[0];h.splice(0,1),n-=f);for(a=1,s=h[0];s>=10;s/=10,a++);a<f&&(n-=f-a)}return l.e=n,l.c=h,l}),q.sum=function(){for(var t=1,e=arguments,r=new q(e[0]);t<e.length;)r=r.plus(e[t++]);return r},n=function(){var t="0123456789";function e(t,e,r,n){for(var i,s,a=[0],o=0,u=t.length;o<u;){for(s=a.length;s--;a[s]*=e);for(a[0]+=n.indexOf(t.charAt(o++)),i=0;i<a.length;i++)a[i]>r-1&&(null==a[i+1]&&(a[i+1]=0),a[i+1]+=a[i]/r|0,a[i]%=r)}return a.reverse()}return function(n,i,s,a,o){var u,c,h,l,f,p,g,d,m=n.indexOf("."),v=T,x=N;for(m>=0&&(l=_,_=0,n=n.replace(".",""),p=(d=new q(i)).pow(n.length-m),_=l,d.c=e(S(y(p.c),p.e,"0"),10,s,t),d.e=d.c.length),h=l=(g=e(n,i,s,o?(u=M,t):(u=t,M))).length;0==g[--l];g.pop());if(!g[0])return u.charAt(0);if(m<0?--h:(p.c=g,p.e=h,p.s=a,g=(p=r(p,d,v,x,s)).c,f=p.r,h=p.e),m=g[c=h+v+1],l=s/2,f=f||c<0||null!=g[c+1],f=x<4?(null!=m||f)&&(0==x||x==(p.s<0?3:2)):m>l||m==l&&(4==x||f||6==x&&1&g[c-1]||x==(p.s<0?8:7)),c<1||!g[0])n=f?S(u.charAt(1),-v,u.charAt(0)):u.charAt(0);else{if(g.length=c,f)for(--s;++g[--c]>s;)g[c]=0,c||(++h,g=[1].concat(g));for(l=g.length;!g[--l];);for(m=0,n="";m<=l;n+=u.charAt(g[m++]));n=S(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%d,h=e/d|0;for(t=t.slice();u--;)o=((i=c*(s=t[u]%d)+(n=h*s+(a=t[u]/d|0)*c)%d*d+o)/r|0)+(n/d|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;i<r;i++)if(t[i]!=e[i]){s=t[i]>e[i]?1:-1;break}return s}function r(t,e,r,n){for(var i=0;r--;)t[r]-=i,i=t[r]<e[r]?1:0,t[r]=i*n+t[r]-e[r];for(;!t[0]&&t.length>1;t.splice(0,1));}return function(n,i,s,a,o){var c,h,p,g,d,m,y,x,w,b,E,S,F,A,B,I,D,C=n.s==i.s?1:-1,R=n.c,P=i.c;if(!(R&&R[0]&&P&&P[0]))return new q(n.s&&i.s&&(R?!P||R[0]!=P[0]:P)?R&&0==R[0]||!P?0*C:C/0:NaN);for(w=(x=new q(C)).c=[],C=s+(h=n.e-i.e)+1,o||(o=l,h=v(n.e/f)-v(i.e/f),C=C/f|0),p=0;P[p]==(R[p]||0);p++);if(P[p]>(R[p]||0)&&h--,C<0)w.push(1),g=!0;else{for(A=R.length,I=P.length,p=0,C+=2,(d=u(o/(P[0]+1)))>1&&(P=t(P,d,o),R=t(R,d,o),I=P.length,A=R.length),F=I,E=(b=R.slice(0,I)).length;E<I;b[E++]=0);D=P.slice(),D=[0].concat(D),B=P[0],P[1]>=o/2&&B++;do{if(d=0,(c=e(P,b,I,E))<0){if(S=b[0],I!=E&&(S=S*o+(b[1]||0)),(d=u(S/B))>1)for(d>=o&&(d=o-1),y=(m=t(P,d,o)).length,E=b.length;1==e(m,b,y,E);)d--,r(m,I<y?D:P,y,o),y=m.length,c=1;else 0==d&&(c=d=1),y=(m=P.slice()).length;if(y<E&&(m=[0].concat(m)),r(b,m,E,o),E=b.length,-1==c)for(;e(P,b,I,E)<1;)d++,r(b,I<E?D:P,E,o),E=b.length}else 0===c&&(d++,b=[0]);w[p++]=d,b[0]?b[E++]=R[F]||0:(b=[R[F]],E=1)}while((F++<A||null!=b[0])&&C--);g=null!=b[0],w[0]||w.splice(0,1)}if(o==l){for(p=1,C=w[0];C>=10;C/=10,p++);W(x,s+(x.e=p+h*f-1)+1,a,g)}else x.e=h,x.r=+g;return x}}(),A=/^(-?)0([xbo])(?=\w[\w.]*$)/i,B=/^([^.]+)\.$/,I=/^\.([^.]+)$/,D=/^-?(Infinity|NaN)$/,C=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(t,e,r,n){var i,s=r?e:e.replace(C,"");if(D.test(s))t.s=isNaN(s)?null:s<0?-1:1;else{if(!r&&(s=s.replace(A,(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(B,"$1").replace(I,"0.$1")),e!=s))return new q(s,i);if(q.DEBUG)throw Error(c+"Not a"+(n?" base "+n:"")+" number: "+e);t.s=null}t.c=t.e=null},R.absoluteValue=R.abs=function(){var t=new q(this);return t.s<0&&(t.s=1),t},R.comparedTo=function(t,e){return x(this,new q(t,e))},R.decimalPlaces=R.dp=function(t,e){var r,n,i,s=this;if(null!=t)return w(t,0,m),null==e?e=N:w(e,0,8),W(new q(s),t+s.e+1,e);if(!(r=s.c))return null;if(n=((i=r.length-1)-v(this.e/f))*f,i=r[i])for(;i%10==0;i/=10,n--);return n<0&&(n=0),n},R.dividedBy=R.div=function(t,e){return r(this,new q(t,e),T,N)},R.dividedToIntegerBy=R.idiv=function(t,e){return r(this,new q(t,e),0,1)},R.exponentiatedBy=R.pow=function(t,e){var r,n,i,s,a,h,l,p,g=this;if((t=new q(t)).c&&!t.isInteger())throw Error(c+"Exponent not an integer: "+J(t));if(null!=e&&(e=new q(e)),a=t.e>14,!g.c||!g.c[0]||1==g.c[0]&&!g.e&&1==g.c.length||!t.c||!t.c[0])return p=new q(Math.pow(+J(g),a?2-b(t):+J(t))),e?p.mod(e):p;if(h=t.s<0,e){if(e.c?!e.c[0]:!e.s)return new q(NaN);(n=!h&&g.isInteger()&&e.isInteger())&&(g=g.mod(e))}else{if(t.e>9&&(g.e>0||g.e<-1||(0==g.e?g.c[0]>1||a&&g.c[1]>=24e7:g.c[0]<8e13||a&&g.c[0]<=9999975e7)))return s=g.s<0&&b(t)?-0:0,g.e>-1&&(s=1/s),new q(h?1/s:s);_&&(s=o(_/f+2))}for(a?(r=new q(.5),h&&(t.s=1),l=b(t)):l=(i=Math.abs(+J(t)))%2,p=new q(P);;){if(l){if(!(p=p.times(g)).c)break;s?p.c.length>s&&(p.c.length=s):n&&(p=p.mod(e))}if(i){if(0===(i=u(i/2)))break;l=i%2}else if(W(t=t.times(r),t.e+1,1),t.e>14)l=b(t);else{if(0==(i=+J(t)))break;l=i%2}g=g.times(g),s?g.c&&g.c.length>s&&(g.c.length=s):n&&(g=g.mod(e))}return n?p:(h&&(p=P.div(p)),e?p.mod(e):s?W(p,_,N,void 0):p)},R.integerValue=function(t){var e=new q(this);return null==t?t=N:w(t,0,8),W(e,e.e+1,t)},R.isEqualTo=R.eq=function(t,e){return 0===x(this,new q(t,e))},R.isFinite=function(){return!!this.c},R.isGreaterThan=R.gt=function(t,e){return x(this,new q(t,e))>0},R.isGreaterThanOrEqualTo=R.gte=function(t,e){return 1===(e=x(this,new q(t,e)))||0===e},R.isInteger=function(){return!!this.c&&v(this.e/f)>this.c.length-2},R.isLessThan=R.lt=function(t,e){return x(this,new q(t,e))<0},R.isLessThanOrEqualTo=R.lte=function(t,e){return-1===(e=x(this,new q(t,e)))||0===e},R.isNaN=function(){return!this.s},R.isNegative=function(){return this.s<0},R.isPositive=function(){return this.s>0},R.isZero=function(){return!!this.c&&0==this.c[0]},R.minus=function(t,e){var r,n,i,s,a=this,o=a.s;if(e=(t=new q(t,e)).s,!o||!e)return new q(NaN);if(o!=e)return t.s=-e,a.plus(t);var u=a.e/f,c=t.e/f,h=a.c,p=t.c;if(!u||!c){if(!h||!p)return h?(t.s=-e,t):new q(p?a:NaN);if(!h[0]||!p[0])return p[0]?(t.s=-e,t):new q(h[0]?a:3==N?-0:0)}if(u=v(u),c=v(c),h=h.slice(),o=u-c){for((s=o<0)?(o=-o,i=h):(c=u,i=p),i.reverse(),e=o;e--;i.push(0));i.reverse()}else for(n=(s=(o=h.length)<(e=p.length))?o:e,o=e=0;e<n;e++)if(h[e]!=p[e]){s=h[e]<p[e];break}if(s&&(i=h,h=p,p=i,t.s=-t.s),(e=(n=p.length)-(r=h.length))>0)for(;e--;h[r++]=0);for(e=l-1;n>o;){if(h[--n]<p[n]){for(r=n;r&&!h[--r];h[r]=e);--h[r],h[n]+=l}h[n]-=p[n]}for(;0==h[0];h.splice(0,1),--c);return h[0]?z(t,h,c):(t.s=3==N?-1:1,t.c=[t.e=0],t)},R.modulo=R.mod=function(t,e){var n,i,s=this;return t=new q(t,e),!s.c||!t.s||t.c&&!t.c[0]?new q(NaN):!t.c||s.c&&!s.c[0]?new q(s):(9==V?(i=t.s,t.s=1,n=r(s,t,0,3),t.s=i,n.s*=i):n=r(s,t,0,V),(t=s.minus(n.times(t))).c[0]||1!=V||(t.s=s.s),t)},R.multipliedBy=R.times=function(t,e){var r,n,i,s,a,o,u,c,h,p,g,m,y,x,w,b=this,E=b.c,S=(t=new q(t,e)).c;if(!(E&&S&&E[0]&&S[0]))return!b.s||!t.s||E&&!E[0]&&!S||S&&!S[0]&&!E?t.c=t.e=t.s=null:(t.s*=b.s,E&&S?(t.c=[0],t.e=0):t.c=t.e=null),t;for(n=v(b.e/f)+v(t.e/f),t.s*=b.s,(u=E.length)<(p=S.length)&&(y=E,E=S,S=y,i=u,u=p,p=i),i=u+p,y=[];i--;y.push(0));for(x=l,w=d,i=p;--i>=0;){for(r=0,g=S[i]%w,m=S[i]/w|0,s=i+(a=u);s>i;)r=((c=g*(c=E[--a]%w)+(o=m*c+(h=E[a]/w|0)*g)%w*w+y[s]+r)/x|0)+(o/w|0)+m*h,y[s--]=c%x;y[s]=r}return r?++n:y.splice(0,1),z(t,y,n)},R.negated=function(){var t=new q(this);return t.s=-t.s||null,t},R.plus=function(t,e){var r,n=this,i=n.s;if(e=(t=new q(t,e)).s,!i||!e)return new q(NaN);if(i!=e)return t.s=-e,n.minus(t);var s=n.e/f,a=t.e/f,o=n.c,u=t.c;if(!s||!a){if(!o||!u)return new q(i/0);if(!o[0]||!u[0])return u[0]?t:new q(o[0]?n:0*i)}if(s=v(s),a=v(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)/l|0,o[e]=l===o[e]?0:o[e]%l;return i&&(o=[i].concat(o),++a),z(t,o,a)},R.precision=R.sd=function(t,e){var r,n,i,s=this;if(null!=t&&t!==!!t)return w(t,1,m),null==e?e=N:w(e,0,8),W(new q(s),t,e);if(!(r=s.c))return null;if(n=(i=r.length-1)*f+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},R.shiftedBy=function(t){return w(t,-9007199254740991,p),this.times("1e"+t)},R.squareRoot=R.sqrt=function(){var t,e,n,i,s,a=this,o=a.c,u=a.s,c=a.e,h=T+4,l=new q("0.5");if(1!==u||!o||!o[0])return new q(!u||u<0&&(!o||o[0])?NaN:o?a:1/0);if(0==(u=Math.sqrt(+J(a)))||u==1/0?(((e=y(o)).length+c)%2==0&&(e+="0"),u=Math.sqrt(+e),c=v((c+1)/2)-(c<0||c%2),n=new q(e=u==1/0?"5e"+c:(e=u.toExponential()).slice(0,e.indexOf("e")+1)+c)):n=new q(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))),y(s.c).slice(0,u)===(e=y(n.c)).slice(0,u)){if(n.e<c&&--u,"9999"!=(e=e.slice(u-3,u+1))&&(i||"4999"!=e)){+e&&(+e.slice(1)||"5"!=e.charAt(0))||(W(n,n.e+T+2,1),t=!n.times(n).eq(a));break}if(!i&&(W(s,s.e+T+2,0),s.times(s).eq(a))){n=s;break}h+=4,u+=4,i=1}return W(n,n.e+T+1,N,t)},R.toExponential=function(t,e){return null!=t&&(w(t,0,m),t++),G(this,t,e,1)},R.toFixed=function(t,e){return null!=t&&(w(t,0,m),t=t+this.e+1),G(this,t,e)},R.toFormat=function(t,e,r){var n,i=this;if(null==r)null!=t&&e&&"object"==typeof e?(r=e,e=null):t&&"object"==typeof t?(r=t,t=e=null):r=U;else if("object"!=typeof r)throw Error(c+"Argument not an object: "+r);if(n=i.toFixed(t,e),i.c){var s,a=n.split("."),o=+r.groupSize,u=+r.secondaryGroupSize,h=r.groupSeparator||"",l=a[0],f=a[1],p=i.s<0,g=p?l.slice(1):l,d=g.length;if(u&&(s=o,o=u,u=s,d-=s),o>0&&d>0){for(s=d%o||o,l=g.substr(0,s);s<d;s+=o)l+=h+g.substr(s,o);u>0&&(l+=h+g.slice(s)),p&&(l="-"+l)}n=f?l+(r.decimalSeparator||"")+((u=+r.fractionGroupSize)?f.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+(r.fractionGroupSeparator||"")):f):l}return(r.prefix||"")+n+(r.suffix||"")},R.toFraction=function(t){var e,n,i,s,a,o,u,h,l,p,d,m,v=this,x=v.c;if(null!=t&&(!(u=new q(t)).isInteger()&&(u.c||1!==u.s)||u.lt(P)))throw Error(c+"Argument "+(u.isInteger()?"out of range: ":"not an integer: ")+J(u));if(!x)return new q(v);for(e=new q(P),l=n=new q(P),i=h=new q(P),m=y(x),a=e.e=m.length-v.e-1,e.c[0]=g[(o=a%f)<0?f+o:o],t=!t||u.comparedTo(e)>0?a>0?e:l:u,o=j,j=1/0,u=new q(m),h.c[0]=0;p=r(u,e,0,1),1!=(s=n.plus(p.times(i))).comparedTo(t);)n=i,i=s,l=h.plus(p.times(s=l)),h=s,e=u.minus(p.times(s=e)),u=s;return s=r(t.minus(n),i,0,1),h=h.plus(s.times(l)),n=n.plus(s.times(i)),h.s=l.s=v.s,d=r(l,i,a*=2,N).minus(v).abs().comparedTo(r(h,n,a,N).minus(v).abs())<1?[l,i]:[h,n],j=o,d},R.toNumber=function(){return+J(this)},R.toPrecision=function(t,e){return null!=t&&w(t,1,m),G(this,t,e,2)},R.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<=O||s>=k?E(y(r.c),s):S(y(r.c),s,"0"):10===t&&K?e=S(y((r=W(new q(r),T+s+1,N)).c),r.e,"0"):(w(t,2,M.length,"Base"),e=n(S(y(r.c),s,"0"),10,t,i,!0)),i<0&&r.c[0]&&(e="-"+e)),e},R.valueOf=R.toJSON=function(){return J(this)},R._isBigNumber=!0,null!=e&&q.set(e),q}(),s.default=s.BigNumber=s,void 0===(n=function(){return s}.call(e,r,e,t))||(t.exports=n)}()},48764:(t,e,r)=>{"use strict";const n=r(79742),i=r(80645),s="function"==typeof Symbol&&"function"==typeof Symbol.for?Symbol.for("nodejs.util.inspect.custom"):null;e.Buffer=u,e.SlowBuffer=function(t){return+t!=t&&(t=0),u.alloc(+t)},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<e;n+=1)r[n]=255&t[n];return r}function p(t,e,r){if(e<0||t.byteLength<e)throw new RangeError('"offset" is outside of buffer bounds');if(t.byteLength<e+(r||0))throw new RangeError('"length" is outside of buffer bounds');let n;return n=void 0===e&&void 0===r?new Uint8Array(t):void 0===r?new Uint8Array(t,e):new Uint8Array(t,e,r),Object.setPrototypeOf(n,u.prototype),n}function g(t){if(t>=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 R(this,e,r);case"utf8":case"utf-8":return B(this,e,r);case"ascii":return D(this,e,r);case"latin1":case"binary":return C(this,e,r);case"base64":return A(this,e,r);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return P(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;s<o;s++)if(c(t,s)===c(e,-1===n?0:s-n)){if(-1===n&&(n=s),s-n+1===u)return n*a}else-1!==n&&(s-=s-n),n=-1}else for(r+u>o&&(r=o-u),s=r;s>=0;s--){let r=!0;for(let n=0;n<u;n++)if(c(t,s+n)!==c(e,n)){r=!1;break}if(r)return s}return-1}function w(t,e,r,n){r=Number(r)||0;const i=t.length-r;n?(n=Number(n))>i&&(n=i):n=i;const s=e.length;let a;for(n>s/2&&(n=s/2),a=0;a<n;++a){const n=parseInt(e.substr(2*a,2),16);if(Y(n))return a;t[r+a]=n}return a}function b(t,e,r,n){return W($(e,t.length-r),t,r,n)}function E(t,e,r,n){return W(function(t){const e=[];for(let r=0;r<t.length;++r)e.push(255&t.charCodeAt(r));return e}(e),t,r,n)}function S(t,e,r,n){return W(z(e),t,r,n)}function F(t,e,r,n){return W(function(t,e){let r,n,i;const s=[];for(let a=0;a<t.length&&!((e-=2)<0);++a)r=t.charCodeAt(a),n=r>>8,i=r%256,s.push(i),s.push(n);return s}(e,t.length-r),t,r,n)}function 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(;i<r;){const e=t[i];let s=null,a=e>239?4:e>223?3:e>191?2:1;if(i+a<=r){let r,n,o,u;switch(a){case 1:e<128&&(s=e);break;case 2:r=t[i+1],128==(192&r)&&(u=(31&e)<<6|63&r,u>127&&(s=u));break;case 3:r=t[i+1],n=t[i+2],128==(192&r)&&128==(192&n)&&(u=(15&e)<<12|(63&r)<<6|63&n,u>2047&&(u<55296||u>57343)&&(s=u));break;case 4:r=t[i+1],n=t[i+2],o=t[i+3],128==(192&r)&&128==(192&n)&&128==(192&o)&&(u=(15&e)<<18|(63&r)<<12|(63&n)<<6|63&o,u>65535&&u<1114112&&(s=u))}}null===s?(s=65533,a=1):s>65535&&(s-=65536,n.push(s>>>10&1023|55296),s=56320|1023&s),n.push(s),i+=a}return function(t){const e=t.length;if(e<=I)return String.fromCharCode.apply(String,t);let r="",n=0;for(;n<e;)r+=String.fromCharCode.apply(String,t.slice(n,n+=I));return r}(n)}e.kMaxLength=a,u.TYPED_ARRAY_SUPPORT=function(){try{const t=new Uint8Array(1),e={foo:function(){return 42}};return Object.setPrototypeOf(e,Uint8Array.prototype),Object.setPrototypeOf(t,e),42===t.foo()}catch(t){return!1}}(),u.TYPED_ARRAY_SUPPORT||"undefined"==typeof console||"function"!=typeof console.error||console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support."),Object.defineProperty(u.prototype,"parent",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.buffer}}),Object.defineProperty(u.prototype,"offset",{enumerable:!0,get:function(){if(u.isBuffer(this))return this.byteOffset}}),u.poolSize=8192,u.from=function(t,e,r){return c(t,e,r)},Object.setPrototypeOf(u.prototype,Uint8Array.prototype),Object.setPrototypeOf(u,Uint8Array),u.alloc=function(t,e,r){return function(t,e,r){return h(t),t<=0?o(t):void 0!==e?"string"==typeof r?o(t).fill(e,r):o(t).fill(e):o(t)}(t,e,r)},u.allocUnsafe=function(t){return l(t)},u.allocUnsafeSlow=function(t){return l(t)},u.isBuffer=function(t){return null!=t&&!0===t._isBuffer&&t!==u.prototype},u.compare=function(t,e){if(J(t,Uint8Array)&&(t=u.from(t,t.offset,t.byteLength)),J(e,Uint8Array)&&(e=u.from(e,e.offset,e.byteLength)),!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError('The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array');if(t===e)return 0;let r=t.length,n=e.length;for(let i=0,s=Math.min(r,n);i<s;++i)if(t[i]!==e[i]){r=t[i],n=e[i];break}return r<n?-1:n<r?1:0},u.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(t,e){if(!Array.isArray(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);let r;if(void 0===e)for(e=0,r=0;r<t.length;++r)e+=t[r].length;const n=u.allocUnsafe(e);let i=0;for(r=0;r<t.length;++r){let e=t[r];if(J(e,Uint8Array))i+e.length>n.length?(u.isBuffer(e)||(e=u.from(e)),e.copy(n,i)):Uint8Array.prototype.set.call(n,e,i);else{if(!u.isBuffer(e))throw new TypeError('"list" argument must be an Array of Buffers');e.copy(n,i)}i+=e.length}return n},u.byteLength=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;e<t;e+=2)v(this,e,e+1);return this},u.prototype.swap32=function(){const t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(let e=0;e<t;e+=4)v(this,e,e+3),v(this,e+1,e+2);return this},u.prototype.swap64=function(){const t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(let e=0;e<t;e+=8)v(this,e,e+7),v(this,e+1,e+6),v(this,e+2,e+5),v(this,e+3,e+4);return this},u.prototype.toString=function(){const t=this.length;return 0===t?"":0===arguments.length?B(this,0,t):m.apply(this,arguments)},u.prototype.toLocaleString=u.prototype.toString,u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){let t="";const r=e.INSPECT_MAX_BYTES;return t=this.toString("hex",0,r).replace(/(.{2})/g,"$1 ").trim(),this.length>r&&(t+=" ... "),"<Buffer "+t+">"},s&&(u.prototype[s]=u.prototype.inspect),u.prototype.compare=function(t,e,r,n,i){if(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<o;++t)if(c[t]!==h[t]){s=c[t],a=h[t];break}return s<a?-1:a<s?1:0},u.prototype.includes=function(t,e,r){return-1!==this.indexOf(t,e,r)},u.prototype.indexOf=function(t,e,r){return y(this,t,e,r,!0)},u.prototype.lastIndexOf=function(t,e,r){return y(this,t,e,r,!1)},u.prototype.write=function(t,e,r,n){if(void 0===e)n="utf8",r=this.length,e=0;else if(void 0===r&&"string"==typeof e)n=e,r=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e>>>=0,isFinite(r)?(r>>>=0,void 0===n&&(n="utf8")):(n=r,r=void 0)}const i=this.length-e;if((void 0===r||r>i)&&(r=i),t.length>0&&(r<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");n||(n="utf8");let s=!1;for(;;)switch(n){case"hex":return 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 D(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(127&t[i]);return n}function C(t,e,r){let n="";r=Math.min(t.length,r);for(let i=e;i<r;++i)n+=String.fromCharCode(t[i]);return n}function R(t,e,r){const n=t.length;(!e||e<0)&&(e=0),(!r||r<0||r>n)&&(r=n);let i="";for(let n=e;n<r;++n)i+=X[t[n]];return i}function P(t,e,r){const n=t.slice(e,r);let i="";for(let t=0;t<n.length-1;t+=2)i+=String.fromCharCode(n[t]+256*n[t+1]);return i}function T(t,e,r){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>r)throw new RangeError("Trying to access beyond buffer length")}function N(t,e,r,n,i,s){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<s)throw new RangeError('"value" argument is out of bounds');if(r+n>t.length)throw new RangeError("Index out of range")}function 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<t&&(e=t);const n=this.subarray(t,e);return Object.setPrototypeOf(n,u.prototype),n},u.prototype.readUintLE=u.prototype.readUIntLE=function(t,e,r){t>>>=0,e>>>=0,r||T(t,e,this.length);let n=this[t],i=1,s=0;for(;++s<e&&(i*=256);)n+=this[t+s]*i;return n},u.prototype.readUintBE=u.prototype.readUIntBE=function(t,e,r){t>>>=0,e>>>=0,r||T(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||T(t,1,this.length),this[t]},u.prototype.readUint16LE=u.prototype.readUInt16LE=function(t,e){return t>>>=0,e||T(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUint16BE=u.prototype.readUInt16BE=function(t,e){return t>>>=0,e||T(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUint32LE=u.prototype.readUInt32LE=function(t,e){return t>>>=0,e||T(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||T(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)<<BigInt(32))})),u.prototype.readBigUInt64BE=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*2**24+65536*this[++t]+256*this[++t]+this[++t],i=this[++t]*2**24+65536*this[++t]+256*this[++t]+r;return(BigInt(n)<<BigInt(32))+BigInt(i)})),u.prototype.readIntLE=function(t,e,r){t>>>=0,e>>>=0,r||T(t,e,this.length);let n=this[t],i=1,s=0;for(;++s<e&&(i*=256);)n+=this[t+s]*i;return i*=128,n>=i&&(n-=Math.pow(2,8*e)),n},u.prototype.readIntBE=function(t,e,r){t>>>=0,e>>>=0,r||T(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||T(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){t>>>=0,e||T(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||T(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||T(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||T(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)<<BigInt(32))+BigInt(e+256*this[++t]+65536*this[++t]+this[++t]*2**24)})),u.prototype.readBigInt64BE=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<<24)+65536*this[++t]+256*this[++t]+this[++t];return(BigInt(n)<<BigInt(32))+BigInt(this[++t]*2**24+65536*this[++t]+256*this[++t]+r)})),u.prototype.readFloatLE=function(t,e){return t>>>=0,e||T(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return t>>>=0,e||T(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return t>>>=0,e||T(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return t>>>=0,e||T(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<r&&(i*=256);)this[e+s]=t/i&255;return e+r},u.prototype.writeUintBE=u.prototype.writeUIntBE=function(t,e,r,n){t=+t,e>>>=0,r>>>=0,n||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<r&&(s*=256);)t<0&&0===a&&0!==this[e+i-1]&&(a=1),this[e+i]=(t/s>>0)-a&255;return e+r},u.prototype.writeIntBE=function(t,e,r,n){if(t=+t,e>>>=0,!n){const n=Math.pow(2,8*r-1);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<r&&(n=r),n===r)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(r<0||r>=this.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("sourceEnd out of bounds");n>this.length&&(n=this.length),t.length-e<n-r&&(n=t.length-e+r);const i=n-r;return this===t&&"function"==typeof Uint8Array.prototype.copyWithin?this.copyWithin(e,r,n):Uint8Array.prototype.set.call(t,this.subarray(r,n),e),i},u.prototype.fill=function(t,e,r,n){if("string"==typeof t){if("string"==typeof e?(n=e,e=0,r=this.length):"string"==typeof r&&(n=r,r=this.length),void 0!==n&&"string"!=typeof n)throw new TypeError("encoding must be a string");if("string"==typeof n&&!u.isEncoding(n))throw new TypeError("Unknown encoding: "+n);if(1===t.length){const e=t.charCodeAt(0);("utf8"===n&&e<128||"latin1"===n)&&(t=e)}}else"number"==typeof t?t&=255:"boolean"==typeof t&&(t=Number(t));if(e<0||this.length<e||this.length<r)throw new RangeError("Out of range index");if(r<=e)return this;let i;if(e>>>=0,r=void 0===r?this.length:r>>>0,t||(t=0),"number"==typeof t)for(i=e;i<r;++i)this[i]=t;else{const s=u.isBuffer(t)?t:u.from(t,n),a=s.length;if(0===a)throw new TypeError('The value "'+t+'" is invalid for argument "value"');for(i=0;i<r-e;++i)this[i+e]=s[i%a]}return this};const V={};function _(t,e,r){V[t]=class extends r{constructor(){super(),Object.defineProperty(this,"message",{value:e.apply(this,arguments),writable:!0,configurable:!0}),this.name=`${this.name} [${t}]`,this.stack,delete this.name}get code(){return t}set code(t){Object.defineProperty(this,"code",{configurable:!0,enumerable:!0,value:t,writable:!0})}toString(){return`${this.name} [${t}]: ${this.message}`}}}function U(t){let e="",r=t.length;const n="-"===t[0]?1:0;for(;r>=n+4;r-=3)e=`_${t.slice(r-3,r)}${e}`;return`${t.slice(0,r)}${e}`}function M(t,e,r,n,i,s){if(t>r||t<e){const n="bigint"==typeof e?"n":"";let i;throw i=s>3?0===e||e===BigInt(0)?`>= 0${n} and < 2${n} ** ${8*(s+1)}${n}`:`>= -(2${n} ** ${8*(s+1)-1}${n}) and < 2 ** ${8*(s+1)-1}${n}`:`>= ${e}${n} and <= ${r}${n}`,new V.ERR_OUT_OF_RANGE("value",i,t)}!function(t,e,r){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;a<n;++a){if(r=t.charCodeAt(a),r>55295&&r<57344){if(!i){if(r>56319){(e-=3)>-1&&s.push(239,191,189);continue}if(a+1===n){(e-=3)>-1&&s.push(239,191,189);continue}i=r;continue}if(r<56320){(e-=3)>-1&&s.push(239,191,189),i=r;continue}r=65536+(i-55296<<10|r-56320)}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,r<128){if((e-=1)<0)break;s.push(r)}else if(r<2048){if((e-=2)<0)break;s.push(r>>6|192,63&r|128)}else if(r<65536){if((e-=3)<0)break;s.push(r>>12|224,r>>6&63|128,63&r|128)}else{if(!(r<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;s.push(r>>18|240,r>>12&63|128,r>>6&63|128,63&r|128)}}return s}function 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<n&&!(i+r>=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")}},80645:(t,e)=>{e.read=function(t,e,r,n,i){var s,a,o=8*i-n-1,u=(1<<o)-1,c=u>>1,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<<c)-1,l=h>>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<<i|o,c+=i;c>0;t[r+p]=255&a,p+=g,a/=256,c-=8);t[r+p-g]|=128*d}},31166:(t,e,r)=>{var n,i,s,a,o,u,c,h,l,f,p,g=r(48764).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<i;s++){var a=r[s>>>2]>>>24-s%4*8&255;e[n+s>>>2]|=a<<24-(n+s)%4*8}else for(s=0;s<i;s+=4)e[n+s>>>2]=r[s>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,e=this.sigBytes;t[e>>>2]&=4294967295<<32-e%4*8,t.length=n.ceil(e/4)},clone:function(){var t=a.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],r=0;r<t;r+=4)e.push(4294967296*n.random()|0);return new o.init(e,t)}}),u=i.enc={},c=u.Hex={stringify:function(t){for(var e=t.words,r=t.sigBytes,n=[],i=0;i<r;i++){var s=e[i>>>2]>>>24-i%4*8&255;n.push((s>>>4).toString(16)),n.push((15&s).toString(16))}return n.join("")},parse:function(t){for(var e=t.length,r=[],n=0;n<e;n+=2)r[n>>>3]|=parseInt(t.substr(n,2),16)<<24-n%8*4;return new o.init(r,e/2)}},h=u.Latin1={stringify:function(t){for(var e=t.words,r=t.sigBytes,n=[],i=0;i<r;i++){var s=e[i>>>2]>>>24-i%4*8&255;n.push(String.fromCharCode(s))}return n.join("")},parse:function(t){for(var e=t.length,r=[],n=0;n<e;n++)r[n>>>2]|=(255&t.charCodeAt(n))<<24-n%4*8;return new o.init(r,e)}},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<u;h+=s)this._doProcessBlock(r,h);var l=r.splice(0,u);e.sigBytes-=c}return new o.init(l,c)},clone:function(){var t=a.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),s.Hasher=f.extend({cfg:a.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){f.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,r){return new t.init(r).finalize(e)}},_createHmacHelper:function(t){return function(e,r){return new p.HMAC.init(t,r).finalize(e)}}}),p=i.algo={},i);!function(t){var e,r=(e=v).lib,n=r.Base,i=r.WordArray;(e=e.x64={}).Word=n.extend({init:function(t,e){this.high=t,this.low=e}}),e.WordArray=n.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:8*t.length},toX32:function(){for(var t=this.words,e=t.length,r=[],n=0;n<e;n++){var s=t[n];r.push(s.high),r.push(s.low)}return i.create(r,this.sigBytes)},clone:function(){for(var t=n.clone.call(this),e=t.words=this.words.slice(0),r=e.length,i=0;i<r;i++)e[i]=e[i].clone();return t}})}(),v.lib.Cipher||function(t){var e=(p=v).lib,r=e.Base,n=e.WordArray,i=e.BufferedBlockAlgorithm,s=p.enc.Base64,a=p.algo.EvpKDF,o=e.Cipher=i.extend({cfg:r.extend(),createEncryptor:function(t,e){return this.create(this._ENC_XFORM_MODE,t,e)},createDecryptor:function(t,e){return this.create(this._DEC_XFORM_MODE,t,e)},init:function(t,e,r){this.cfg=this.cfg.extend(r),this._xformMode=t,this._key=e,this.reset()},reset:function(){i.reset.call(this),this._doReset()},process:function(t){return this._append(t),this._process()},finalize:function(t){return t&&this._append(t),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(t){return{encrypt:function(e,r,n){return("string"==typeof r?g:f).encrypt(t,e,r,n)},decrypt:function(e,r,n){return("string"==typeof r?g:f).decrypt(t,e,r,n)}}}});e.StreamCipher=o.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var u=p.mode={},c=function(t,e,r){var n=this._iv;n?this._iv=void 0:n=this._prevBlock;for(var i=0;i<r;i++)t[e+i]^=n[i]},h=(e.BlockCipherMode=r.extend({createEncryptor:function(t,e){return this.Encryptor.create(t,e)},createDecryptor:function(t,e){return this.Decryptor.create(t,e)},init:function(t,e){this._cipher=t,this._iv=e}})).extend();h.Encryptor=h.extend({processBlock:function(t,e){var r=this._cipher,n=r.blockSize;c.call(this,t,e,n),r.encryptBlock(t,e),this._prevBlock=t.slice(e,e+n)}}),h.Decryptor=h.extend({processBlock:function(t,e){var r=this._cipher,n=r.blockSize,i=t.slice(e,e+n);r.decryptBlock(t,e),c.call(this,t,e,n),this._prevBlock=i}}),u=u.CBC=h,h=(p.pad={}).Pkcs7={pad:function(t,e){for(var r,i=(r=(r=4*e)-t.sigBytes%r)<<24|r<<16|r<<8|r,s=[],a=0;a<r;a+=4)s.push(i);r=n.create(s,r),t.concat(r)},unpad:function(t){t.sigBytes-=255&t.words[t.sigBytes-1>>>2]}},e.BlockCipher=o.extend({cfg:o.cfg.extend({mode:u,padding: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<r;s++)if(s<e)i[s]=t[s];else{var a=i[s-1];s%e?6<e&&4==s%e&&(a=n[a>>>24]<<24|n[a>>>16&255]<<16|n[a>>>8&255]<<8|n[255&a]):(a=n[(a=a<<8|a>>>24)>>>24]<<24|n[a>>>16&255]<<16|n[a>>>8&255]<<8|n[255&a],a^=S[s/e|0]<<24),i[s]=i[s-e]^a}for(t=this._invKeySchedule=[],e=0;e<r;e++)s=r-e,a=e%4?i[s]:i[s-4],t[e]=4>e||4>=s?a:c[n[a>>>24]]^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<u;g++){var d=n[c>>>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}function e(t,e){var r=(this._rBlock>>>t^this._lBlock)&e;this._lBlock^=r,this._rBlock^=r<<t}var r=v,n=(i=r.lib).WordArray,i=i.BlockCipher,s=r.algo,a=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],o=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],u=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],c=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],h=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],l=s.DES=i.extend({_doReset:function(){for(var t=this._key.words,e=[],r=0;56>r;r++){var n=a[r]-1;e[r]=t[n>>>5]>>>31-n%32&1}for(t=this._subKeys=[],n=0;16>n;n++){var i=t[n]=[],s=u[n];for(r=0;24>r;r++)i[r/6|0]|=e[(o[r]-1+s)%28]<<31-r%6,i[4+(r/6|0)]|=e[28+(o[r+24]-1+s)%28]<<31-r%6;for(i[0]=i[0]<<1|i[0]>>>31,r=1;7>r;r++)i[r]>>>=4*(r-1)+3;i[7]=i[7]<<5|i[7]>>>27}for(e=this._invSubKeys=[],r=0;16>r;r++)e[r]=t[15-r]},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._subKeys)},decryptBlock:function(t,e){this._doCryptBlock(t,e,this._invSubKeys)},_doCryptBlock:function(r,n,i){this._lBlock=r[n],this._rBlock=r[n+1],t.call(this,4,252645135),t.call(this,16,65535),e.call(this,2,858993459),e.call(this,8,16711935),t.call(this,1,1431655765);for(var s=0;16>s;s++){for(var a=i[s],o=this._lBlock,u=this._rBlock,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<r;i+=3)for(var s=(e[i>>>2]>>>24-i%4*8&255)<<16|(e[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|e[i+2>>>2]>>>24-(i+2)%4*8&255,a=0;4>a&&i+.75*a<r;a++)t.push(n.charAt(s>>>6*(3-a)&63));if(e=n.charAt(64))for(;t.length%4;)t.push(e);return t.join("")},parse:function(t){var r=t.length,n=this._map;(i=n.charAt(64))&&-1!=(i=t.indexOf(i))&&(r=i);for(var i=[],s=0,a=0;a<r;a++)if(a%4){var o=n.indexOf(t.charAt(a-1))<<a%4*2,u=n.indexOf(t.charAt(a))>>>6-a%4*2;i[s>>>2]|=(o|u)<<24-s%4*8,s++}return e.create(i,s)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),function(t){function e(t,e,r,n,i,s,a){return((t=t+(e&r|~e&n)+i+a)<<s|t>>>32-s)+e}function r(t,e,r,n,i,s,a){return((t=t+(e&n|r&~n)+i+a)<<s|t>>>32-s)+e}function n(t,e,r,n,i,s,a){return((t=t+(e^r^n)+i+a)<<s|t>>>32-s)+e}function i(t,e,r,n,i,s,a){return((t=t+(r^(e|~n))+i+a)<<s|t>>>32-s)+e}for(var s=v,a=(u=s.lib).WordArray,o=u.Hasher,u=s.algo,c=[],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,D=f,C=p,R=g,P=d,T=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<W>>>0?1:0))+J+((z+=Y)>>>0<Y>>>0?1:0))+Z+((z+=Q)>>>0<Q>>>0?1:0),G.high=$,G.low=z}X=H&L^~H&_,Q=j&V^~j&U,G=D&R^D&T^R&T;var tt=C&P^C&N^P&N,et=(W=(D>>>28|C<<4)^(D<<30|C>>>2)^(D<<25|C>>>7),J=(C>>>28|D<<4)^(C<<30|D>>>2)^(C<<25|D>>>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<K>>>0?1:0),M=_,K=U,_=L,U=V,L=H,V=j,H=O+(Z=(Z=(Z=Z+X+((Y+=Q)>>>0<Q>>>0?1:0))+et+((Y+=rt)>>>0<rt>>>0?1:0))+$+((Y+=z)>>>0<z>>>0?1:0))+((j=k+Y|0)>>>0<k>>>0?1:0)|0,O=T,k=N,T=R,N=P,R=D,P=C,D=Z+(G=W+G+((z=J+tt)>>>0<J>>>0?1:0))+((C=Y+z|0)>>>0<Y>>>0?1:0)|0}p=r.low=p+C,r.high=f+D+(p>>>0<C>>>0?1:0),d=n.low=d+P,n.high=g+R+(d>>>0<P>>>0?1:0),v=i.low=v+N,i.high=m+T+(v>>>0<N>>>0?1:0),x=s.low=x+k,s.high=y+O+(x>>>0<k>>>0?1:0),b=u.low=b+j,u.high=w+H+(b>>>0<j>>>0?1:0),S=c.low=S+V,c.high=E+L+(S>>>0<V>>>0?1:0),A=h.low=A+U,h.high=F+_+(A>>>0<U>>>0?1:0),I=l.low=I+K,l.high=B+M+(I>>>0<K>>>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)<<A[r]|w>>>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)<<B[r]|w>>>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<n;c++)o[c]^=1549556828,u[c]^=909522486;s.sigBytes=a.sigBytes=i,this.reset()},reset:function(){var t=this._hasher;t.reset(),t.update(this._iKey)},update:function(t){return this._hasher.update(t),this},finalize:function(t){var e=this._hasher;return t=e.finalize(t),e.reset(),e.finalize(this._oKey.clone().concat(t))}})}(),function(){var t,e=v,r=(t=e.lib).Base,n=t.WordArray,i=(t=e.algo).HMAC,s=t.PBKDF2=r.extend({cfg:r.extend({keySize:4,hasher:t.SHA1,iterations:1}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){var r=this.cfg,s=i.create(r.hasher,t),a=n.create(),o=n.create([1]),u=a.words,c=o.words,h=r.keySize;for(r=r.iterations;u.length<h;){var l=s.update(e).finalize(o);s.reset();for(var f=l.words,p=f.length,g=l,d=1;d<r;d++){g=s.finalize(g),s.reset();for(var m=g.words,v=0;v<p;v++)f[v]^=m[v]}a.concat(l),c[0]++}return a.sigBytes=4*h,a}});e.PBKDF2=function(t,e,r){return s.create(r).compute(t,e)}}();var y,x="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";function w(t){var e,r,n="";for(e=0;e+3<=t.length;e+=3)r=parseInt(t.substring(e,e+3),16),n+=x.charAt(r>>6)+x.charAt(63&r);for(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));(3&n.length)>0;)n+="=";return n}function b(t){var e,r,n,i="",s=0;for(e=0;e<t.length&&"="!=t.charAt(e);++e)(n=x.indexOf(t.charAt(e)))<0||(0==s?(i+=I(n>>2),r=3&n,s=1):1==s?(i+=I(r<<2|n>>4),r=15&n,s=2):2==s?(i+=I(r),i+=I(n>>2),r=3&n,s=3):(i+=I(r<<2|n>>4),i+=I(15&n),s=0));return 1==s&&(i+=I(r<<2)),i}function E(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 S(){return new E(null)}"Microsoft Internet Explorer"==d.appName?(E.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?(E.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):(E.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),E.prototype.DB=y,E.prototype.DM=(1<<y)-1,E.prototype.DV=1<<y,E.prototype.FV=Math.pow(2,52),E.prototype.F1=52-y,E.prototype.F2=2*y-52;var F,A,B=new Array;for(F="0".charCodeAt(0),A=0;A<=9;++A)B[F++]=A;for(F="a".charCodeAt(0),A=10;A<36;++A)B[F++]=A;for(F="A".charCodeAt(0),A=10;A<36;++A)B[F++]=A;function I(t){return"0123456789abcdefghijklmnopqrstuvwxyz".charAt(t)}function D(t,e){var r=B[t.charCodeAt(e)];return null==r?-1:r}function C(t){var e=S();return e.fromInt(t),e}function R(t){var e,r=1;return 0!=(e=t>>>16)&&(t=e,r+=16),0!=(e=t>>8)&&(t=e,r+=8),0!=(e=t>>4)&&(t=e,r+=4),0!=(e=t>>2)&&(t=e,r+=2),0!=(e=t>>1)&&(t=e,r+=1),r}function P(t){this.m=t}function T(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}function N(t,e){return t&e}function O(t,e){return t|e}function k(t,e){return t^e}function H(t,e){return t&~e}function j(t){if(0==t)return-1;var e=0;return 0==(65535&t)&&(t>>=16,e+=16),0==(255&t)&&(t>>=8,e+=8),0==(15&t)&&(t>>=4,e+=4),0==(3&t)&&(t>>=2,e+=2),0==(1&t)&&++e,e}function L(t){for(var e=0;0!=t;)t&=t-1,++e;return e}function V(){}function _(t){return t}function U(t){this.r2=S(),this.q3=S(),E.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}P.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},P.prototype.revert=function(t){return t},P.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},P.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},P.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},T.prototype.convert=function(t){var e=S();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(E.ZERO)>0&&this.m.subTo(e,e),e},T.prototype.revert=function(t){var e=S();return t.copyTo(e),this.reduce(e),e},T.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e<this.m.t;++e){var r=32767&t[e],n=r*this.mpl+((r*this.mph+(t[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(t[r=e+this.m.t]+=this.m.am(0,n,t,e,0,this.m.t);t[r]>=t.DV;)t[r]-=t.DV,t[++r]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},T.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},T.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},E.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},E.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},E.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]:D(t,n);a<0?"-"==t.charAt(n)&&(i=!0):(i=!1,0==s?this[this.t++]=a:s+r>this.DB?(this[this.t-1]|=(a&(1<<this.DB-s)-1)<<s,this[this.t++]=a>>this.DB-s):this[this.t-1]|=a<<s,(s+=r)>=this.DB&&(s-=this.DB))}8==r&&0!=(128&t[0])&&(this.s=-1,s>0&&(this[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),i&&E.ZERO.subTo(this,this)},E.prototype.clamp=function(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t},E.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},E.prototype.drShiftTo=function(t,e){for(var r=t;r<this.t;++r)e[r-t]=this[r];e.t=Math.max(this.t-t,0),e.s=this.s},E.prototype.lShiftTo=function(t,e){var r,n=t%this.DB,i=this.DB-n,s=(1<<i)-1,a=Math.floor(t/this.DB),o=this.s<<n&this.DM;for(r=this.t-1;r>=0;--r)e[r+a+1]=this[r]>>i|o,o=(this[r]&s)<<n;for(r=a-1;r>=0;--r)e[r]=0;e[a]=o,e.t=this.t+a+1,e.s=this.s,e.clamp()},E.prototype.rShiftTo=function(t,e){e.s=this.s;var r=Math.floor(t/this.DB);if(r>=this.t)e.t=0;else{var n=t%this.DB,i=this.DB-n,s=(1<<n)-1;e[0]=this[r]>>n;for(var a=r+1;a<this.t;++a)e[a-r-1]|=(this[a]&s)<<i,e[a-r]=this[a]>>n;n>0&&(e[this.t-r-1]|=(this.s&s)<<i),e.t=this.t-r,e.clamp()}},E.prototype.subTo=function(t,e){for(var r=0,n=0,i=Math.min(t.t,this.t);r<i;)n+=this[r]-t[r],e[r++]=n&this.DM,n>>=this.DB;if(t.t<this.t){for(n-=t.s;r<this.t;)n+=this[r],e[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<t.t;)n-=t[r],e[r++]=n&this.DM,n>>=this.DB;n-=t.s}e.s=n<0?-1:0,n<-1?e[r++]=this.DV+n:n>0&&(e[r++]=n),e.t=r,e.clamp()},E.prototype.multiplyTo=function(t,e){var r=this.abs(),n=t.abs(),i=r.t;for(e.t=i+n.t;--i>=0;)e[i]=0;for(i=0;i<n.t;++i)e[i+r.t]=r.am(0,n[i],e,i,0,r.t);e.s=0,e.clamp(),this.s!=t.s&&E.ZERO.subTo(e,e)},E.prototype.squareTo=function(t){for(var e=this.abs(),r=t.t=2*e.t;--r>=0;)t[r]=0;for(r=0;r<e.t-1;++r){var n=e.am(r,e[r],t,2*r,0,1);(t[r+e.t]+=e.am(r+1,2*e[r],t,2*r+1,n,e.t-r-1))>=e.DV&&(t[r+e.t]-=e.DV,t[r+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(r,e[r],t,2*r,0,1)),t.s=0,t.clamp()},E.prototype.divRemTo=function(t,e,r){var n=t.abs();if(!(n.t<=0)){var i=this.abs();if(i.t<n.t)return null!=e&&e.fromInt(0),void(null!=r&&this.copyTo(r));null==r&&(r=S());var s=S(),a=this.s,o=t.s,u=this.DB-R(n[n.t-1]);u>0?(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<<this.F1)+(c>1?s[c-2]>>this.F2:0),f=this.FV/l,p=(1<<this.F1)/l,g=1<<this.F2,d=r.t,m=d-c,v=null==e?S():e;for(s.dlShiftTo(m,v),r.compareTo(v)>=0&&(r[r.t++]=1,r.subTo(v,r)),E.ONE.dlShiftTo(c,v),v.subTo(s,s);s.t<c;)s[s.t++]=0;for(;--m>=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))<y)for(s.dlShiftTo(m,v),r.subTo(v,r);r[d]<--y;)r.subTo(v,r)}null!=e&&(r.drShiftTo(c,e),a!=o&&E.ZERO.subTo(e,e)),r.t=c,r.clamp(),u>0&&r.rShiftTo(u,r),a<0&&E.ZERO.subTo(r,r)}}},E.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},E.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},E.prototype.exp=function(t,e){if(t>4294967295||t<1)return E.ONE;var r=S(),n=S(),i=e.convert(this),s=R(t)-1;for(i.copyTo(r);--s>=0;)if(e.sqrTo(r,n),(t&1<<s)>0)e.mulTo(n,i,r);else{var a=r;r=n,n=a}return e.revert(r)},E.prototype.toString=function(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var r,n=(1<<e)-1,i=!1,s="",a=this.t,o=this.DB-a*this.DB%e;if(a-- >0)for(o<this.DB&&(r=this[a]>>o)>0&&(i=!0,s=I(r));a>=0;)o<e?(r=(this[a]&(1<<o)-1)<<e-o,r|=this[--a]>>(o+=this.DB-e)):(r=this[a]>>(o-=e)&n,o<=0&&(o+=this.DB,--a)),r>0&&(i=!0),i&&(s+=I(r));return i?s:"0"},E.prototype.negate=function(){var t=S();return E.ZERO.subTo(this,t),t},E.prototype.abs=function(){return this.s<0?this.negate():this},E.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},E.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+R(this[this.t-1]^this.s&this.DM)},E.prototype.mod=function(t){var e=S();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(E.ZERO)>0&&t.subTo(e,e),e},E.prototype.modPowInt=function(t,e){var r;return r=t<256||e.isEven()?new P(e):new T(e),this.exp(t,r)},E.ZERO=C(0),E.ONE=C(1),V.prototype.convert=_,V.prototype.revert=_,V.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r)},V.prototype.sqrTo=function(t,e){t.squareTo(e)},U.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=S();return t.copyTo(e),this.reduce(e),e},U.prototype.revert=function(t){return t},U.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)},U.prototype.mulTo=function(t,e,r){t.multiplyTo(e,r),this.reduce(r)},U.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)};var M,K,q,G=[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],$=(1<<26)/G[G.length-1];function z(){this.i=0,this.j=0,this.S=new Array}function W(){!function(t){K[q++]^=255&t,K[q++]^=t>>8&255,K[q++]^=t>>16&255,K[q++]^=t>>24&255,q>=256&&(q-=256)}((new Date).getTime())}if(E.prototype.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},E.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=C(r),i=S(),s=S(),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},E.prototype.fromRadix=function(t,e){this.fromInt(0),null==e&&(e=10);for(var r=this.chunkSize(e),n=Math.pow(e,r),i=!1,s=0,a=0,o=0;o<t.length;++o){var u=D(t,o);u<0?"-"==t.charAt(o)&&0==this.signum()&&(i=!0):(a=e*a+u,++s>=r&&(this.dMultiply(n),this.dAddOffset(a,0),s=0,a=0))}s>0&&(this.dMultiply(Math.pow(e,s)),this.dAddOffset(a,0)),i&&E.ZERO.subTo(this,this)},E.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(E.ONE.shiftLeft(t-1),O,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(E.ONE.shiftLeft(t-1),this);else{var n=new Array,i=7&t;n.length=1+(t>>3),e.nextBytes(n),i>0?n[0]&=(1<<i)-1:n[0]=0,this.fromString(n,256)}},E.prototype.bitwiseTo=function(t,e,r){var n,i,s=Math.min(t.t,this.t);for(n=0;n<s;++n)r[n]=e(this[n],t[n]);if(t.t<this.t){for(i=t.s&this.DM,n=s;n<this.t;++n)r[n]=e(this[n],i);r.t=this.t}else{for(i=this.s&this.DM,n=s;n<t.t;++n)r[n]=e(i,t[n]);r.t=t.t}r.s=e(this.s,t.s),r.clamp()},E.prototype.changeBit=function(t,e){var r=E.ONE.shiftLeft(t);return this.bitwiseTo(r,e,r),r},E.prototype.addTo=function(t,e){for(var r=0,n=0,i=Math.min(t.t,this.t);r<i;)n+=this[r]+t[r],e[r++]=n&this.DM,n>>=this.DB;if(t.t<this.t){for(n+=t.s;r<this.t;)n+=this[r],e[r++]=n&this.DM,n>>=this.DB;n+=this.s}else{for(n+=this.s;r<t.t;)n+=t[r],e[r++]=n&this.DM,n>>=this.DB;n+=t.s}e.s=n<0?-1:0,n>0?e[r++]=n:n<-1&&(e[r++]=this.DV+n),e.t=r,e.clamp()},E.prototype.dMultiply=function(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},E.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]}},E.prototype.multiplyLowerTo=function(t,e,r){var n,i=Math.min(this.t+t.t,e);for(r.s=0,r.t=i;i>0;)r[--i]=0;for(n=r.t-this.t;i<n;++i)r[i+this.t]=this.am(0,t[i],r,i,0,this.t);for(n=Math.min(t.t,e);i<n;++i)this.am(0,t[i],r,i,0,e-i);r.clamp()},E.prototype.multiplyUpperTo=function(t,e,r){--e;var n=r.t=this.t+t.t-e;for(r.s=0;--n>=0;)r[n]=0;for(n=Math.max(e-this.t,0);n<t.t;++n)r[this.t+n-e]=this.am(e-n,t[n],r,0,0,this.t+n-e);r.clamp(),r.drShiftTo(1,r)},E.prototype.modInt=function(t){if(t<=0)return 0;var e=this.DV%t,r=this.s<0?t-1:0;if(this.t>0)if(0==e)r=this[0]%t;else for(var n=this.t-1;n>=0;--n)r=(e*r+this[n])%t;return r},E.prototype.millerRabin=function(t){var e=this.subtract(E.ONE),r=e.getLowestSetBit();if(r<=0)return!1;var n=e.shiftRight(r);(t=t+1>>1)>G.length&&(t=G.length);for(var i=S(),s=0;s<t;++s){i.fromInt(G[Math.floor(Math.random()*G.length)]);var a=i.modPow(n,this);if(0!=a.compareTo(E.ONE)&&0!=a.compareTo(e)){for(var o=1;o++<r&&0!=a.compareTo(e);)if(0==(a=a.modPowInt(2,this)).compareTo(E.ONE))return!1;if(0!=a.compareTo(e))return!1}}return!0},E.prototype.clone=function(){var t=S();return this.copyTo(t),t},E.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},E.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},E.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},E.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},E.prototype.toByteArray=function(){var t=this.t,e=new Array;e[0]=this.s;var r,n=this.DB-t*this.DB%8,i=0;if(t-- >0)for(n<this.DB&&(r=this[t]>>n)!=(this.s&this.DM)>>n&&(e[i++]=r|this.s<<this.DB-n);t>=0;)n<8?(r=(this[t]&(1<<n)-1)<<8-n,r|=this[--t]>>(n+=this.DB-8)):(r=this[t]>>(n-=8)&255,n<=0&&(n+=this.DB,--t)),0!=(128&r)&&(r|=-256),0==i&&(128&this.s)!=(128&r)&&++i,(i>0||r!=this.s)&&(e[i++]=r);return e},E.prototype.equals=function(t){return 0==this.compareTo(t)},E.prototype.min=function(t){return this.compareTo(t)<0?this:t},E.prototype.max=function(t){return this.compareTo(t)>0?this:t},E.prototype.and=function(t){var e=S();return this.bitwiseTo(t,N,e),e},E.prototype.or=function(t){var e=S();return this.bitwiseTo(t,O,e),e},E.prototype.xor=function(t){var e=S();return this.bitwiseTo(t,k,e),e},E.prototype.andNot=function(t){var e=S();return this.bitwiseTo(t,H,e),e},E.prototype.not=function(){for(var t=S(),e=0;e<this.t;++e)t[e]=this.DM&~this[e];return t.t=this.t,t.s=~this.s,t},E.prototype.shiftLeft=function(t){var e=S();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e},E.prototype.shiftRight=function(t){var e=S();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e},E.prototype.getLowestSetBit=function(){for(var t=0;t<this.t;++t)if(0!=this[t])return t*this.DB+j(this[t]);return this.s<0?this.t*this.DB:-1},E.prototype.bitCount=function(){for(var t=0,e=this.s&this.DM,r=0;r<this.t;++r)t+=L(this[r]^e);return t},E.prototype.testBit=function(t){var e=Math.floor(t/this.DB);return e>=this.t?0!=this.s:0!=(this[e]&1<<t%this.DB)},E.prototype.setBit=function(t){return this.changeBit(t,O)},E.prototype.clearBit=function(t){return this.changeBit(t,H)},E.prototype.flipBit=function(t){return this.changeBit(t,k)},E.prototype.add=function(t){var e=S();return this.addTo(t,e),e},E.prototype.subtract=function(t){var e=S();return this.subTo(t,e),e},E.prototype.multiply=function(t){var e=S();return this.multiplyTo(t,e),e},E.prototype.divide=function(t){var e=S();return this.divRemTo(t,e,null),e},E.prototype.remainder=function(t){var e=S();return this.divRemTo(t,null,e),e},E.prototype.divideAndRemainder=function(t){var e=S(),r=S();return this.divRemTo(t,e,r),new Array(e,r)},E.prototype.modPow=function(t,e){var r,n,i=t.bitLength(),s=C(1);if(i<=0)return s;r=i<18?1:i<48?3:i<144?4:i<768?5:6,n=i<8?new P(e):e.isEven()?new U(e):new T(e);var a=new Array,o=3,u=r-1,c=(1<<r)-1;if(a[1]=n.convert(this),r>1){var h=S();for(n.sqrTo(a[1],h);o<=c;)a[o]=S(),n.mulTo(h,a[o-2],a[o]),o+=2}var l,f,p=t.t-1,g=!0,d=S();for(i=R(t[p])-1;p>=0;){for(i>=u?l=t[p]>>i-u&c:(l=(t[p]&(1<<i+1)-1)<<u-i,p>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<<i);)n.sqrTo(s,d),f=s,s=d,d=f,--i<0&&(i=this.DB-1,--p)}return n.revert(s)},E.prototype.modInverse=function(t){var e=t.isEven();if(this.isEven()&&e||0==t.signum())return E.ZERO;for(var r=t.clone(),n=this.clone(),i=C(1),s=C(0),a=C(0),o=C(1);0!=r.signum();){for(;r.isEven();)r.rShiftTo(1,r),e?(i.isEven()&&s.isEven()||(i.addTo(this,i),s.subTo(t,s)),i.rShiftTo(1,i)):s.isEven()||s.subTo(t,s),s.rShiftTo(1,s);for(;n.isEven();)n.rShiftTo(1,n),e?(a.isEven()&&o.isEven()||(a.addTo(this,a),o.subTo(t,o)),a.rShiftTo(1,a)):o.isEven()||o.subTo(t,o),o.rShiftTo(1,o);r.compareTo(n)>=0?(r.subTo(n,r),e&&i.subTo(a,i),s.subTo(o,s)):(n.subTo(r,n),e&&a.subTo(i,a),o.subTo(s,o))}return 0!=n.compareTo(E.ONE)?E.ZERO:o.compareTo(t)>=0?o.subtract(t):o.signum()<0?(o.addTo(t,o),o.signum()<0?o.add(t):o):o},E.prototype.pow=function(t){return this.exp(t,new V)},E.prototype.gcd=function(t){var e=this.s<0?this.negate():this.clone(),r=t.s<0?t.negate():t.clone();if(e.compareTo(r)<0){var n=e;e=r,r=n}var i=e.getLowestSetBit(),s=r.getLowestSetBit();if(s<0)return e;for(i<s&&(s=i),s>0&&(e.rShiftTo(s,e),r.rShiftTo(s,r));e.signum()>0;)(i=e.getLowestSetBit())>0&&e.rShiftTo(i,e),(i=r.getLowestSetBit())>0&&r.rShiftTo(i,r),e.compareTo(r)>=0?(e.subTo(r,e),e.rShiftTo(1,e)):(r.subTo(e,r),r.rShiftTo(1,r));return s>0&&r.lShiftTo(s,r),r},E.prototype.isProbablePrime=function(t){var e,r=this.abs();if(1==r.t&&r[0]<=G[G.length-1]){for(e=0;e<G.length;++e)if(r[0]==G[e])return!0;return!1}if(r.isEven())return!1;for(e=1;e<G.length;){for(var n=G[e],i=e+1;i<G.length&&n<$;)n*=G[i++];for(n=r.modInt(n);e<i;)if(n%G[e++]==0)return!1}return r.millerRabin(t)},E.prototype.square=function(){var t=S();return this.squareTo(t),t},z.prototype.init=function(t){var e,r,n;for(e=0;e<256;++e)this.S[e]=e;for(r=0,e=0;e<256;++e)r=r+this.S[e]+t[e%t.length]&255,n=this.S[e],this.S[e]=this.S[r],this.S[r]=n;this.i=0,this.j=0},z.prototype.next=function(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]},null==K){var J;if(K=new Array,q=0,void 0!==m&&(void 0!==m.crypto||void 0!==m.msCrypto)){var Y=m.crypto||m.msCrypto;if(Y.getRandomValues){var X=new Uint8Array(32);for(Y.getRandomValues(X),J=0;J<32;++J)K[q++]=X[J]}else if("Netscape"==d.appName&&d.appVersion<"5"){var Z=m.crypto.random(32);for(J=0;J<Z.length;++J)K[q++]=255&Z.charCodeAt(J)}}for(;q<256;)J=Math.floor(65536*Math.random()),K[q++]=J>>>8,K[q++]=255&J;q=0,W()}function Q(){if(null==M){for(W(),(M=new z).init(K),q=0;q<K.length;++q)K[q]=0;q=0}return M.next()}function tt(){}function et(t,e){return new E(t,e)}function rt(t,e,r){for(var n="",i=0;n.length<e;)n+=r(String.fromCharCode.apply(String,t.concat([(4278190080&i)>>24,(16711680&i)>>16,(65280&i)>>8,255&i]))),i+=1;return n}function nt(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}function it(t,e,r){for(var n="",i=0;n.length<e;)n+=r(t+String.fromCharCode.apply(String,[(4278190080&i)>>24,(16711680&i)>>16,(65280&i)>>8,255&i])),i+=1;return n}function st(t,e){this.x=e,this.q=t}function at(t,e,r,n){this.curve=t,this.x=e,this.y=r,this.z=null==n?E.ONE:n,this.zinv=null}function ot(t,e,r){this.q=t,this.a=this.fromBigInteger(e),this.b=this.fromBigInteger(r),this.infinity=new at(this,null,null)}tt.prototype.nextBytes=function(t){var e;for(e=0;e<t.length;++e)t[e]=Q()},nt.prototype.doPublic=function(t){return t.modPowInt(this.e,this.n)},nt.prototype.setPublic=function(t,e){if(this.isPublic=!0,this.isPrivate=!1,"string"!=typeof t)this.n=t,this.e=e;else{if(!(null!=t&&null!=e&&t.length>0&&e.length>0))throw"Invalid RSA public key";this.n=et(t,16),this.e=parseInt(e,16)}},nt.prototype.encrypt=function(t){var e=function(t,e){if(e<t.length+11)throw"Message too long for RSA";for(var r=new Array,n=t.length-1;n>=0&&e>0;){var i=t.charCodeAt(n--);i<128?r[--e]=i:i>127&&i<2048?(r[--e]=63&i|128,r[--e]=i>>6|192):(r[--e]=63&i|128,r[--e]=i>>6&63|128,r[--e]=i>>12|224)}r[--e]=0;for(var s=new tt,a=new Array;e>2;){for(a[0]=0;0==a[0];)s.nextBytes(a);r[--e]=a[0]}return r[--e]=2,r[--e]=0,new E(r)}(t,this.n.bitLength()+7>>3);if(null==e)return null;var r=this.doPublic(e);if(null==r)return null;var n=r.toString(16);return 0==(1&n.length)?n:"0"+n},nt.prototype.encryptOAEP=function(t,e,r){var n=function(t,e,r,n){var i=ct.crypto.MessageDigest,s=ct.crypto.Util,a=null;if(r||(r="sha1"),"string"==typeof r&&(a=i.getCanonicalAlgName(r),n=i.getHashLength(a),r=function(t){return Et(s.hashHex(St(t),a))}),t.length+2*n+2>e)throw"Message too long for RSA";var o,u="";for(o=0;o<e-t.length-2*n-2;o+=1)u+="\0";var c=r("")+u+""+t,h=new Array(n);(new tt).nextBytes(h);var l=rt(h,c.length,r),f=[];for(o=0;o<c.length;o+=1)f[o]=c.charCodeAt(o)^l.charCodeAt(o);var p=rt(f,h.length,r),g=[0];for(o=0;o<h.length;o+=1)g[o+1]=h[o]^p.charCodeAt(o);return new E(g.concat(f))}(t,this.n.bitLength()+7>>3,e,r);if(null==n)return null;var i=this.doPublic(n);if(null==i)return null;var s=i.toString(16);return 0==(1&s.length)?s:"0"+s},nt.prototype.type="RSA",nt.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)},nt.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=et(t,16),this.e=parseInt(e,16),this.d=et(r,16)}},nt.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=et(t,16),this.e=parseInt(e,16),this.d=et(r,16),this.p=et(n,16),this.q=et(i,16),this.dmp1=et(s,16),this.dmq1=et(a,16),this.coeff=et(o,16)},nt.prototype.generate=function(t,e){var r=new tt,n=t>>1;this.e=parseInt(e,16);for(var i=new E(e,16),s=t/2-100,a=E.ONE.shiftLeft(s);;){for(;this.p=new E(t-n,1,r),0!=this.p.subtract(E.ONE).gcd(i).compareTo(E.ONE)||!this.p.isProbablePrime(10););for(;this.q=new E(n,1,r),0!=this.q.subtract(E.ONE).gcd(i).compareTo(E.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var o=this.p;this.p=this.q,this.q=o}var u=this.q.subtract(this.p).abs();if(!(u.bitLength()<s||u.compareTo(a)<=0)){var c=this.p.subtract(E.ONE),h=this.q.subtract(E.ONE),l=c.multiply(h);if(0==l.gcd(i).compareTo(E.ONE)&&(this.n=this.p.multiply(this.q),this.n.bitLength()==t)){this.d=i.modInverse(l),this.dmp1=this.d.mod(c),this.dmq1=this.d.mod(h),this.coeff=this.q.modInverse(this.p);break}}}this.isPrivate=!0},nt.prototype.decrypt=function(t){if(t.length!=Math.ceil(this.n.bitLength()/4))throw new Error("wrong ctext length");var e=et(t,16),r=this.doPrivate(e);return null==r?null:function(t,e){for(var r=t.toByteArray(),n=0;n<r.length&&0==r[n];)++n;if(r.length-n!=e-1||2!=r[n])return null;for(++n;0!=r[n];)if(++n>=r.length)return null;for(var i="";++n<r.length;){var s=255&r[n];s<128?i+=String.fromCharCode(s):s>191&&s<224?(i+=String.fromCharCode((31&s)<<6|63&r[n+1]),++n):(i+=String.fromCharCode((15&s)<<12|(63&r[n+1])<<6|63&r[n+2]),n+=2)}return i}(r,this.n.bitLength()+7>>3)},nt.prototype.decryptOAEP=function(t,e,r){if(t.length!=Math.ceil(this.n.bitLength()/4))throw new Error("wrong ctext length");var n=et(t,16),i=this.doPrivate(n);return null==i?null:function(t,e,r,n){var i=ct.crypto.MessageDigest,s=ct.crypto.Util,a=null;for(r||(r="sha1"),"string"==typeof r&&(a=i.getCanonicalAlgName(r),n=i.getHashLength(a),r=function(t){return Et(s.hashHex(St(t),a))}),t=t.toByteArray(),o=0;o<t.length;o+=1)t[o]&=255;for(;t.length<e;)t.unshift(0);if((t=String.fromCharCode.apply(String,t)).length<2*n+2)throw"Cipher too short";var o,u=t.substr(1,n),c=t.substr(n+1),h=it(c,n,r),l=[];for(o=0;o<u.length;o+=1)l[o]=u.charCodeAt(o)^h.charCodeAt(o);var f=it(String.fromCharCode.apply(String,l),t.length-n,r),p=[];for(o=0;o<c.length;o+=1)p[o]=c.charCodeAt(o)^f.charCodeAt(o);if((p=String.fromCharCode.apply(String,p)).substr(0,n)!==r(""))throw"Hash mismatch";var g=(p=p.substr(n)).indexOf("");if((-1!=g?p.substr(0,g).lastIndexOf("\0"):-1)+1!=g)throw"Malformed data";return p.substr(g+1)}(i,this.n.bitLength()+7>>3,e,r)},st.prototype.equals=function(t){return t==this||this.q.equals(t.q)&&this.x.equals(t.x)},st.prototype.toBigInteger=function(){return this.x},st.prototype.negate=function(){return new st(this.q,this.x.negate().mod(this.q))},st.prototype.add=function(t){return new st(this.q,this.x.add(t.toBigInteger()).mod(this.q))},st.prototype.subtract=function(t){return new st(this.q,this.x.subtract(t.toBigInteger()).mod(this.q))},st.prototype.multiply=function(t){return new st(this.q,this.x.multiply(t.toBigInteger()).mod(this.q))},st.prototype.square=function(){return new st(this.q,this.x.square().mod(this.q))},st.prototype.divide=function(t){return new st(this.q,this.x.multiply(t.toBigInteger().modInverse(this.q)).mod(this.q))},st.prototype.sqrt=function(){return new st(this.q,this.x.sqrt().mod(this.q))},at.prototype.getX=function(){return null==this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))},at.prototype.getY=function(){return null==this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))},at.prototype.equals=function(t){return t==this||(this.isInfinity()?t.isInfinity():t.isInfinity()?this.isInfinity():!!t.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(t.z)).mod(this.curve.q).equals(E.ZERO)&&t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.q).equals(E.ZERO))},at.prototype.isInfinity=function(){return null==this.x&&null==this.y||this.z.equals(E.ZERO)&&!this.y.toBigInteger().equals(E.ZERO)},at.prototype.negate=function(){return new at(this.curve,this.x,this.y.negate(),this.z)},at.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(t.z)).mod(this.curve.q),r=t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.q);if(E.ZERO.equals(r))return E.ZERO.equals(e)?this.twice():this.curve.getInfinity();var n=new E("3"),i=this.x.toBigInteger(),s=this.y.toBigInteger(),a=(t.x.toBigInteger(),t.y.toBigInteger(),r.square()),o=a.multiply(r),u=i.multiply(a),c=e.square().multiply(this.z),h=c.subtract(u.shiftLeft(1)).multiply(t.z).subtract(o).multiply(r).mod(this.curve.q),l=u.multiply(n).multiply(e).subtract(s.multiply(o)).subtract(c.multiply(e)).multiply(t.z).add(e.multiply(o)).mod(this.curve.q),f=o.multiply(this.z).multiply(t.z).mod(this.curve.q);return new at(this.curve,this.curve.fromBigInteger(h),this.curve.fromBigInteger(l),f)},at.prototype.twice=function(){if(this.isInfinity())return this;if(0==this.y.toBigInteger().signum())return this.curve.getInfinity();var t=new E("3"),e=this.x.toBigInteger(),r=this.y.toBigInteger(),n=r.multiply(this.z),i=n.multiply(r).mod(this.curve.q),s=this.curve.a.toBigInteger(),a=e.square().multiply(t);E.ZERO.equals(s)||(a=a.add(this.z.square().multiply(s)));var o=(a=a.mod(this.curve.q)).square().subtract(e.shiftLeft(3).multiply(i)).shiftLeft(1).multiply(n).mod(this.curve.q),u=a.multiply(t).multiply(e).subtract(i.shiftLeft(1)).shiftLeft(2).multiply(i).subtract(a.square().multiply(a)).mod(this.curve.q),c=n.square().multiply(n).shiftLeft(3).mod(this.curve.q);return new at(this.curve,this.curve.fromBigInteger(o),this.curve.fromBigInteger(u),c)},at.prototype.multiply=function(t){if(this.isInfinity())return this;if(0==t.signum())return this.curve.getInfinity();var e,r=t,n=r.multiply(new E("3")),i=this.negate(),s=this,a=this.curve.q.subtract(t),o=a.multiply(new E("3")),u=new at(this.curve,this.x,this.y),c=u.negate();for(e=n.bitLength()-2;e>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},at.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},ot.prototype.getQ=function(){return this.q},ot.prototype.getA=function(){return this.a},ot.prototype.getB=function(){return this.b},ot.prototype.equals=function(t){return t==this||this.q.equals(t.q)&&this.a.equals(t.a)&&this.b.equals(t.b)},ot.prototype.getInfinity=function(){return this.infinity},ot.prototype.fromBigInteger=function(t){return new st(this.q,t)},ot.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 E(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 at(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 at(this,this.fromBigInteger(new E(o,16)),this.fromBigInteger(new E(u,16)));default:return null}},st.prototype.getByteLength=function(){return Math.floor((this.toBigInteger().bitLength()+7)/8)},at.prototype.getEncoded=function(t){var e=function(t,e){var r=t.toByteArrayUnsigned();if(e<r.length)r=r.slice(r.length-e);else for(;e>r.length;)r.unshift(0);return r},r=this.getX().toBigInteger(),n=this.getY().toBigInteger(),i=e(r,32);return t?n.isEven()?i.unshift(2):i.unshift(3):(i.unshift(4),i=i.concat(e(n,32))),i},at.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 E(n),a=new E(i);return new at(t,t.fromBigInteger(s),t.fromBigInteger(a))},at.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 E(n,16),a=new E(i,16);return new at(t,t.fromBigInteger(s),t.fromBigInteger(a))},at.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 at(this.curve,n,i)},at.prototype.twice2D=function(){if(this.isInfinity())return this;if(0==this.y.toBigInteger().signum())return this.curve.getInfinity();var t=this.curve.fromBigInteger(E.valueOf(2)),e=this.curve.fromBigInteger(E.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 at(this.curve,n,i)},at.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 E("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},at.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)},at.prototype.toString=function(){return"("+this.getX().toBigInteger().toString()+","+this.getY().toBigInteger().toString()+")"},at.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(E.ONE)<0||e.compareTo(t.subtract(E.ONE))>0)throw new Error("x coordinate out of bounds");if(r.compareTo(E.ONE)<0||r.compareTo(t.subtract(E.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 ut=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<g;++p){var d;switch((h=c[p]).charCodeAt(0)){default:(d=f[0])[u||d.length]=+h,u=void 0;break;case 34:if(-1!==(h=h.substring(1,h.length-1)).indexOf("\\")&&(h=h.replace(e,n)),d=f[0],!u){if(!(d instanceof Array)){u=h||i;break}u=d.length}d[u]=h,u=void 0;break;case 91:d=f[0],f.unshift(d[u||d.length]=[]),u=void 0;break;case 93:case 125:f.shift();break;case 102:(d=f[0])[u||d.length]=!1,u=void 0;break;case 110:(d=f[0])[u||d.length]=null,u=void 0;break;case 116:(d=f[0])[u||d.length]=!0,u=void 0;break;case 123:d=f[0],f.unshift(d[u||d.length]={}),u=void 0}}if(l){if(1!==f.length)throw new Error;o=o[0]}else if(f.length)throw new Error;if(a){var m=function(t,e){var r=t[e];if(r&&"object"==typeof r){var n=null;for(var i in r)if(s.call(r,i)&&r!==t){var o=m(r,i);void 0!==o?r[i]=o:(n||(n=[]),n.push(i))}if(n)for(var u=n.length;--u>=0;)delete r[n[u]]}return a.call(t,e,r)};o=m({"":o},"")}return o}}();void 0!==ct&&ct||(ct={}),void 0!==ct.asn1&&ct.asn1||(ct.asn1={}),ct.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){var e=t.toString(16);if("-"!=e.substr(0,1))e.length%2==1?e="0"+e:e.match(/^[0-7]/)||(e="00"+e);else{var r=e.substr(1).length;r%2==1?r+=1:e.match(/^[0-7]/)||(r+=2);for(var n="",i=0;i<r;i++)n+="f";e=new E(n,16).xor(t).add(E.ONE).toString(16).replace(/^-/,"")}return e},this.getPEMStringFromHex=function(t,e){return At(t,e)},this.newObject=function(t){var e=ct.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;I<A.length;I++){var D=E(A[I]);B.push(D)}return new x({array:B})}if("set"==F){for(A=t[F],B=[],I=0;I<A.length;I++)D=E(A[I]),B.push(D);return new w({array:B})}if("tag"==F){var C=t[F];if("[object Array]"===Object.prototype.toString.call(C)&&3==C.length){var R=E(C[2]);return new b({tag:C[0],explicit:C[1],obj:R})}return new b(C)}},this.jsonToASN1HEX=function(t){return this.newObject(t).tohex()}},ct.asn1.ASN1Util.oidHexToInt=function(t){for(var e="",r=parseInt(t.substr(0,2),16),n=(e=Math.floor(r/40)+"."+r%40,""),i=2;i<t.length;i+=2){var s=("00000000"+parseInt(t.substr(i,2),16).toString(2)).slice(-8);n+=s.substr(1,7),"0"==s.substr(0,1)&&(e=e+"."+new E(n,2).toString(10),n="")}return e},ct.asn1.ASN1Util.oidIntToHex=function(t){var e=function(t){var e=t.toString(16);return 1==e.length&&(e="0"+e),e},r=function(t){var r="",n=new E(t,10).toString(2),i=7-n.length%7;7==i&&(i=0);for(var s="",a=0;a<i;a++)s+="0";for(n=s+n,a=0;a<n.length-1;a+=7){var o=n.substr(a,7);a!=n.length-7&&(o="1"+o),r+=e(parseInt(o,2))}return r};if(!t.match(/^[0-9.]+$/))throw"malformed oid string: "+t;var n="",i=t.split("."),s=40*parseInt(i[0])+parseInt(i[1]);n+=e(s),i.splice(0,2);for(var a=0;a<i.length;a++)n+=r(i[a]);return n},ct.asn1.ASN1Object=function(t){this.params=null,this.getLengthHexFromValue=function(){if(void 0===this.hV||null==this.hV)throw new Error("this.hV is null or undefined");if(this.hV.length%2==1)throw new Error("value hex must be even length: n="+"".length+",v="+this.hV);var t=this.hV.length/2,e=t.toString(16);if(e.length%2==1&&(e="0"+e),t<128)return e;var r=e.length/2;if(r>15)throw new Error("ASN.1 length too long to represent by 8x: n = "+t.toString(16));return(128+r).toString(16)+e},this.tohex=function(){return(null==this.hTLV||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getEncodedHex=function(){return this.tohex()},this.getValueHex=function(){return this.tohex(),this.hV},this.getFreshValueHex=function(){return""},this.setByParam=function(t){this.params=t},null!=t&&null!=t.tlv&&(this.hTLV=t.tlv,this.isModified=!1)},ct.asn1.DERAbstractString=function(t){ct.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=xt(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))},Kt(ct.asn1.DERAbstractString,ct.asn1.ASN1Object),ct.asn1.DERAbstractTime=function(t){ct.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}},Kt(ct.asn1.DERAbstractTime,ct.asn1.ASN1Object),ct.asn1.DERAbstractStructured=function(t){ct.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)},Kt(ct.asn1.DERAbstractStructured,ct.asn1.ASN1Object),ct.asn1.DERBoolean=function(t){ct.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV=0==t?"010100":"0101ff"},Kt(ct.asn1.DERBoolean,ct.asn1.ASN1Object),ct.asn1.DERInteger=function(t){ct.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=ct.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var e=new E(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.bigint?this.setByBigInteger(t.bigint):void 0!==t.int?this.setByInteger(t.int):"number"==typeof t?this.setByInteger(t):void 0!==t.hex&&this.setValueHex(t.hex))},Kt(ct.asn1.DERInteger,ct.asn1.ASN1Object),ct.asn1.DERBitString=function(t){if(void 0!==t&&void 0!==t.obj){var e=ct.asn1.ASN1Util.newObject(t.obj);t.hex="00"+e.tohex()}ct.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(t){this.hTLV=null,this.isModified=!0,this.hV=t},this.setUnusedBitsAndHexValue=function(t,e){if(t<0||7<t)throw"unused bits shall be from 0 to 7: u = "+t;var r="0"+t;this.hTLV=null,this.isModified=!0,this.hV=r+e},this.setByBinaryString=function(t){var e=8-(t=t.replace(/0+$/,"")).length%8;8==e&&(e=0),t+="0000000".substr(0,e);for(var r="",n=0;n<t.length-1;n+=8){var i=t.substr(n,8),s=parseInt(i,2).toString(16);1==s.length&&(s="0"+s),r+=s}this.hTLV=null,this.isModified=!0,this.hV="0"+e+r},this.setByBooleanArray=function(t){for(var e="",r=0;r<t.length;r++)1==t[r]?e+="1":e+="0";this.setByBinaryString(e)},this.newFalseArray=function(t){for(var e=new Array(t),r=0;r<t;r++)e[r]=!1;return e},this.getFreshValueHex=function(){return this.hV},void 0!==t&&("string"==typeof t&&t.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(t):void 0!==t.hex?this.setHexValueIncludingUnusedBits(t.hex):void 0!==t.bin?this.setByBinaryString(t.bin):void 0!==t.array&&this.setByBooleanArray(t.array))},Kt(ct.asn1.DERBitString,ct.asn1.ASN1Object),ct.asn1.DEROctetString=function(t){if(void 0!==t&&void 0!==t.obj){var e=ct.asn1.ASN1Util.newObject(t.obj);t.hex=e.tohex()}ct.asn1.DEROctetString.superclass.constructor.call(this,t),this.hT="04"},Kt(ct.asn1.DEROctetString,ct.asn1.DERAbstractString),ct.asn1.DERNull=function(){ct.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},Kt(ct.asn1.DERNull,ct.asn1.ASN1Object),ct.asn1.DERObjectIdentifier=function(t){ct.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.setValueOidString=function(t){var e=function(t){var e=function(t){var e=t.toString(16);return 1==e.length&&(e="0"+e),e},r=function(t){var r="",n=parseInt(t,10).toString(2),i=7-n.length%7;7==i&&(i=0);for(var s="",a=0;a<i;a++)s+="0";for(n=s+n,a=0;a<n.length-1;a+=7){var o=n.substr(a,7);a!=n.length-7&&(o="1"+o),r+=e(parseInt(o,2))}return r};try{if(!t.match(/^[0-9.]+$/))return null;var n="",i=t.split("."),s=40*parseInt(i[0],10)+parseInt(i[1],10);n+=e(s),i.splice(0,2);for(var a=0;a<i.length;a++)n+=r(i[a]);return n}catch(t){return null}}(t);if(null==e)throw new Error("malformed oid string: "+t);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=e},this.setValueName=function(t){var e=ct.asn1.x509.OID.name2oid(t);if(""===e)throw new Error("DERObjectIdentifier oidName undefined: "+t);this.setValueOidString(e)},this.setValueNameOrOid=function(t){t.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(t):this.setValueName(t)},this.getFreshValueHex=function(){return this.hV},this.setByParam=function(t){"string"==typeof t?this.setValueNameOrOid(t):void 0!==t.oid?this.setValueNameOrOid(t.oid):void 0!==t.name?this.setValueNameOrOid(t.name):void 0!==t.hex&&this.setValueHex(t.hex)},void 0!==t&&this.setByParam(t)},Kt(ct.asn1.DERObjectIdentifier,ct.asn1.ASN1Object),ct.asn1.DEREnumerated=function(t){ct.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=ct.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var e=new E(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.int?this.setByInteger(t.int):"number"==typeof t?this.setByInteger(t):void 0!==t.hex&&this.setValueHex(t.hex))},Kt(ct.asn1.DEREnumerated,ct.asn1.ASN1Object),ct.asn1.DERUTF8String=function(t){ct.asn1.DERUTF8String.superclass.constructor.call(this,t),this.hT="0c"},Kt(ct.asn1.DERUTF8String,ct.asn1.DERAbstractString),ct.asn1.DERNumericString=function(t){ct.asn1.DERNumericString.superclass.constructor.call(this,t),this.hT="12"},Kt(ct.asn1.DERNumericString,ct.asn1.DERAbstractString),ct.asn1.DERPrintableString=function(t){ct.asn1.DERPrintableString.superclass.constructor.call(this,t),this.hT="13"},Kt(ct.asn1.DERPrintableString,ct.asn1.DERAbstractString),ct.asn1.DERTeletexString=function(t){ct.asn1.DERTeletexString.superclass.constructor.call(this,t),this.hT="14"},Kt(ct.asn1.DERTeletexString,ct.asn1.DERAbstractString),ct.asn1.DERIA5String=function(t){ct.asn1.DERIA5String.superclass.constructor.call(this,t),this.hT="16"},Kt(ct.asn1.DERIA5String,ct.asn1.DERAbstractString),ct.asn1.DERVisibleString=function(t){ct.asn1.DERIA5String.superclass.constructor.call(this,t),this.hT="1a"},Kt(ct.asn1.DERVisibleString,ct.asn1.DERAbstractString),ct.asn1.DERBMPString=function(t){ct.asn1.DERBMPString.superclass.constructor.call(this,t),this.hT="1e"},Kt(ct.asn1.DERBMPString,ct.asn1.DERAbstractString),ct.asn1.DERUTCTime=function(t){ct.asn1.DERUTCTime.superclass.constructor.call(this,t),this.hT="17",this.params=void 0,this.getFreshValueHex=function(){var t=this.params;if(null==this.params&&(t={date:new Date}),"string"==typeof t){if(!t.match(/^[0-9]{12}Z$/)&&!t.match(/^[0-9]{12}\.[0-9]+Z$/))throw new Error("malformed string for UTCTime: "+t);this.hV=gt(t)}else if(null!=t.str)this.hV=gt(t.str);else if(null==t.date&&1==t.millis){var e=new Date;this.hV=gt(this.formatDate(e,"utc",!0))}else if(null!=t.date&&t.date instanceof Date){var r=!0===t.millis;this.hV=gt(this.formatDate(t.date,"utc",r))}else t instanceof Date&&(this.hV=gt(this.formatDate(t,"utc")));if(null==this.hV)throw new Error("parameter not specified properly for UTCTime");return this.hV},null!=t&&this.setByParam(t)},Kt(ct.asn1.DERUTCTime,ct.asn1.DERAbstractTime),ct.asn1.DERGeneralizedTime=function(t){ct.asn1.DERGeneralizedTime.superclass.constructor.call(this,t),this.hT="18",this.params=t,this.getFreshValueHex=function(){var t=this.params;if(null==this.params&&(t={date:new Date}),"string"==typeof t){if(!t.match(/^[0-9]{14}Z$/)&&!t.match(/^[0-9]{14}\.[0-9]+Z$/))throw new Error("malformed string for GeneralizedTime: "+t);this.hV=gt(t)}else if(null!=t.str)this.hV=gt(t.str);else if(null==t.date&&1==t.millis){var e=new Date;this.hV=gt(this.formatDate(e,"gen",!0))}else if(null!=t.date&&t.date instanceof Date){var r=!0===t.millis;this.hV=gt(this.formatDate(t.date,"gen",r))}else t instanceof Date&&(this.hV=gt(this.formatDate(t,"gen")));if(null==this.hV)throw new Error("parameter not specified properly for GeneralizedTime");return this.hV},null!=t&&this.setByParam(t)},Kt(ct.asn1.DERGeneralizedTime,ct.asn1.DERAbstractTime),ct.asn1.DERSequence=function(t){ct.asn1.DERSequence.superclass.constructor.call(this,t),this.hT="30",this.getFreshValueHex=function(){for(var t="",e=0;e<this.asn1Array.length;e++)t+=this.asn1Array[e].tohex();return this.hV=t,this.hV}},Kt(ct.asn1.DERSequence,ct.asn1.DERAbstractStructured),ct.asn1.DERSet=function(t){ct.asn1.DERSet.superclass.constructor.call(this,t),this.hT="31",this.sortFlag=!0,this.getFreshValueHex=function(){for(var t=new Array,e=0;e<this.asn1Array.length;e++){var r=this.asn1Array[e];t.push(r.tohex())}return 1==this.sortFlag&&t.sort(),this.hV=t.join(""),this.hV},void 0!==t&&void 0!==t.sortflag&&0==t.sortflag&&(this.sortFlag=!1)},Kt(ct.asn1.DERSet,ct.asn1.DERAbstractStructured),ct.asn1.DERTaggedObject=function(t){ct.asn1.DERTaggedObject.superclass.constructor.call(this);var e=ct.asn1,r=ft,n=r.getV,i=(r.isASN1HEX,e.ASN1Util.newObject);this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.params={tag:"a0",explicit:!0},this.setASN1Object=function(t,e,r){this.params={tag:e,explicit:t,obj:r}},this.getFreshValueHex=function(){var t=this.params;if(null==t.explicit&&(t.explicit=!0),null!=t.tage&&(t.tag=t.tage,t.explicit=!0),null!=t.tagi&&(t.tag=t.tagi,t.explicit=!1),null!=t.str)this.hV=xt(t.str);else if(null!=t.hex)this.hV=t.hex;else{if(null==t.obj)throw new Error("str, hex nor obj not specified");var r;t.obj instanceof e.ASN1Object?r=t.obj.tohex():"object"==typeof t.obj&&(r=i(t.obj).tohex()),t.explicit?this.hV=r:this.hV=n(r,0)}return null==t.tag&&(t.tag="a0"),this.hT=t.tag,this.hTLV=null,this.isModified=!0,this.hV},this.setByParam=function(t){this.params=t},void 0!==t&&this.setByParam(t)},Kt(ct.asn1.DERTaggedObject,ct.asn1.ASN1Object);var ct,ht,lt,ft=new function(){};function pt(t){for(var e="",r=0;r<t.length;r++){var n=t[r].toString(16);1==n.length&&(n="0"+n),e+=n}return e}function gt(t){return pt(function(t){for(var e=new Array,r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}(t))}function dt(t){return(t=(t=t.replace(/\=/g,"")).replace(/\+/g,"-")).replace(/\//g,"_")}function mt(t){return t.length%4==2?t+="==":t.length%4==3&&(t+="="),(t=t.replace(/-/g,"+")).replace(/_/g,"/")}function vt(t){return t.length%2==1&&(t="0"+t),dt(w(t))}function yt(t){return b(mt(t))}function xt(t){return Dt(jt(t)).toLowerCase()}function wt(t){try{return decodeURIComponent(Ct(t))}catch(t){return null}}function bt(t){return wt(function(t){for(var e=t.match(/.{1,2}/g),r=[],n=0;n<e.length;n++){var i=parseInt(e[n],16);161<=i&&i<=191?(r.push("c2"),r.push(e[n])):192<=i&&i<=255?(r.push("c3"),r.push((i-64).toString(16))):r.push(e[n])}return r.join("")}(t))}function Et(t){for(var e="",r=0;r<t.length-1;r+=2)e+=String.fromCharCode(parseInt(t.substr(r,2),16));return e}function St(t){for(var e="",r=0;r<t.length;r++)e+=("0"+t.charCodeAt(r).toString(16)).slice(-2);return e}function Ft(t){var e=function(t){return w(t)}(t).replace(/(.{64})/g,"$1\r\n");return e.replace(/\r\n$/,"")}function At(t,e){return"-----BEGIN "+e+"-----\r\n"+Ft(t)+"\r\n-----END "+e+"-----\r\n"}function Bt(t,e){if(-1==t.indexOf("-----BEGIN "))throw"can't find PEM header: "+e;return function(t){return b(t.replace(/[^0-9A-Za-z\/+=]*/g,""))}(t=void 0!==e?(t=t.replace(new RegExp("^[^]*-----BEGIN "+e+"-----"),"")).replace(new RegExp("-----END "+e+"-----[^]*$"),""):(t=t.replace(/^[^]*-----BEGIN [^-]+-----/,"")).replace(/-----END [^-]+-----[^]*$/,""))}function It(t){return Math.round(function(t){var e,r,n,i,s,a,o,u,c,h,l;if(l=t.match(/^(\d{2}|\d{4})(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(|\.\d+)Z$/))return u=l[1],e=parseInt(u),2===u.length&&(50<=e&&e<100?e=1900+e:0<=e&&e<50&&(e=2e3+e)),r=parseInt(l[2])-1,n=parseInt(l[3]),i=parseInt(l[4]),s=parseInt(l[5]),a=parseInt(l[6]),o=0,""!==(c=l[7])&&(h=(c.substr(1)+"00").substr(0,3),o=parseInt(h)),Date.UTC(e,r,n,i,s,a,o);throw new Error("unsupported zulu format: "+t)}(t)/1e3)}function Dt(t){return t.replace(/%/g,"")}function Ct(t){return t.replace(/(..)/g,"%$1")}function Rt(t){var e="malformed IPv6 address";if(!t.match(/^[0-9A-Fa-f:]+$/))throw e;var r=(t=t.toLowerCase()).split(":").length-1;if(r<2)throw e;var n=":".repeat(7-r+2),i=(t=t.replace("::",n)).split(":");if(8!=i.length)throw e;for(var s=0;s<8;s++)i[s]=("0000"+i[s]).slice(-4);return i.join("")}function Pt(t){if(!t.match(/^[0-9A-Fa-f]{32}$/))throw new Error("malformed IPv6 address: "+t);var e=(t=t.toLowerCase()).match(/.{1,4}/g);e=e.map((function(t){return t.replace(/^0+/,"")})),e=e.map((function(t){return""==t?"0":t}));var r=(t=":"+e.join(":")+":").match(/:(0:){2,}/g);if(null==r)return t.slice(1,-1);var n=r.sort().slice(-1)[0];return"::"!=(t=t.replace(n.substr(0,n.length-1),":")).substr(0,2)&&(t=t.substr(1)),"::"!=t.substr(-2,2)&&(t=t.substr(0,t.length-1)),t}function Tt(t){var e=new Error("malformed hex value");if(!t.match(/^([0-9A-Fa-f][0-9A-Fa-f]){1,}$/))throw e;if(8==t.length)try{return parseInt(t.substr(0,2),16)+"."+parseInt(t.substr(2,2),16)+"."+parseInt(t.substr(4,2),16)+"."+parseInt(t.substr(6,2),16)}catch(t){throw e}else{if(16!=t.length){if(32==t.length)return Pt(t);if(64==t.length){try{return Pt(t.substr(0,32))+"/"+Nt(t.substr(32))}catch(t){throw e}return}return t}try{return Tt(t.substr(0,8))+"/"+Nt(t.substr(8))}catch(t){throw e}}}function Nt(t){var e,r=new Error("malformed mask");try{e=new E(t,16).toString(2)}catch(t){throw r}if(!e.match(/^1*0*$/))throw r;return e.replace(/0+$/,"").length}function Ot(t){var e=new Error("malformed IP address");if(!(t=t.toLowerCase(t)).match(/^[0-9a-f.:/]+$/))throw e;if(!t.match(/^[0-9.]+$/)){var r;if(t.match(/^[0-9.]+\/[0-9]+$/))return Ot((r=t.split("/"))[0])+kt(parseInt(r[1]),32);if(t.match(/^[0-9a-f:]+$/)&&-1!==t.indexOf(":"))return Rt(t);if(t.match(/^[0-9a-f:]+\/[0-9]+$/)&&-1!==t.indexOf(":"))return Rt((r=t.split("/"))[0])+kt(parseInt(r[1]),128);throw e}var n=t.split(".");if(4!==n.length)throw e;var i="";try{for(var s=0;s<4;s++)i+=("0"+parseInt(n[s]).toString(16)).slice(-2);return i}catch(t){throw e}}function kt(t,e){return 32==e&&0==t?"00000000":128==e&&0==t?"00000000000000000000000000000000":new E(Array(t+1).join("1")+Array(e-t+1).join("0"),2).toString(16)}function Ht(t){var e=t.match(/.{4}/g).map((function(t){var e=parseInt(t.substr(0,2),16),r=parseInt(t.substr(2),16);if(0==e&r<128)return String.fromCharCode(r);if(e<8){var n=128|63&r;return wt((192|(7&e)<<3|(192&r)>>6).toString(16)+n.toString(16))}n=128|(15&e)<<2|(192&r)>>6;var i=128|63&r;return wt((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<e.length;n++)"%"==e[n]?(r+=e.substr(n,3),n+=2):r=r+"%"+gt(e[n]);return r}function Lt(t){return!(t.length%2!=0||!t.match(/^[0-9a-f]+$/)&&!t.match(/^[0-9A-F]+$/))}function Vt(t){return t.length%2==1?"0"+t:t.substr(0,1)>"7"?"00"+t:t}function _t(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;a<i.length/2;a++)s.push(parseInt(i.substr(2*a,2),16));var o=[],u="";for(a=0;a<s.length;a++)128&s[a]?u+=Ut((127&s[a]).toString(2),7):(u+=Ut((127&s[a]).toString(2),7),o.push(new String(parseInt(u,2))),u="");var c=e.join(".");return o.length>0&&(c=c+"."+o.join(".")),c}catch(t){return null}}ft.getLblen=function(t,e){if("8"!=t.substr(e+2,1))return 1;var r=parseInt(t.substr(e+3,1));return 0==r?-1:0<r&&r<10?r+1:-2},ft.getL=function(t,e){var r=ft.getLblen(t,e);return r<1?"":t.substr(e+2,2*r)},ft.getVblen=function(t,e){var r;return""==(r=ft.getL(t,e))?-1:("8"===r.substr(0,1)?new E(r.substr(2),16):new E(r,16)).intValue()},ft.getVidx=function(t,e){var r=ft.getLblen(t,e);return r<0?r:e+2*(r+1)},ft.getV=function(t,e){var r=ft.getVidx(t,e),n=ft.getVblen(t,e);return t.substr(r,2*n)},ft.getTLV=function(t,e){return t.substr(e,2)+ft.getL(t,e)+ft.getV(t,e)},ft.getTLVblen=function(t,e){return 2+2*ft.getLblen(t,e)+2*ft.getVblen(t,e)},ft.getNextSiblingIdx=function(t,e){return ft.getVidx(t,e)+2*ft.getVblen(t,e)},ft.getChildIdx=function(t,e){var r,n,i,s=ft,a=[];r=s.getVidx(t,e),n=2*s.getVblen(t,e),"03"==t.substr(e,2)&&(r+=2,n-=2),i=0;for(var o=r;i<=n;){var u=s.getTLVblen(t,o);if((i+=u)<=n&&a.push(o),o+=u,i>=n)break}return a},ft.getNthChildIdx=function(t,e,r){return ft.getChildIdx(t,e)[r]},ft.getIdxbyList=function(t,e,r,n){var i,s,a=ft;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)},ft.getIdxbyListEx=function(t,e,r,n){var i,s,a=ft;if(0==r.length)return void 0!==n&&t.substr(e,2)!==n?-1:e;i=r.shift(),s=a.getChildIdx(t,e);for(var o=0,u=0;u<s.length;u++){var c=t.substr(s[u],2);if("number"==typeof i&&!a.isContextTag(c)&&o==i||"string"==typeof i&&a.isContextTag(c,i))return a.getIdxbyListEx(t,s[u],r,n);a.isContextTag(c)||o++}return-1},ft.getTLVbyList=function(t,e,r,n){var i=ft,s=i.getIdxbyList(t,e,r,n);return-1==s||s>=t.length?null:i.getTLV(t,s)},ft.getTLVbyListEx=function(t,e,r,n){var i=ft,s=i.getIdxbyListEx(t,e,r,n);return-1==s?null:i.getTLV(t,s)},ft.getVbyList=function(t,e,r,n,i){var s,a,o=ft;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)},ft.getVbyListEx=function(t,e,r,n,i){var s,a,o=ft;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)},ft.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=ft.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}},ft.getOID=function(t,e,r){null==r&&(r=null);try{return"06"!=t.substr(e,2)?r:_t(ft.getV(t,e))}catch(t){return r}},ft.getOIDName=function(t,e,r){null==r&&(r=null);try{var n=ft.getOID(t,e,r);if(n==r)return r;var i=ct.asn1.x509.OID.oid2name(n);return""==i?n:i}catch(t){return r}},ft.getString=function(t,e,r){null==r&&(r=null);try{return Et(ft.getV(t,e))}catch(t){return r}},ft.hextooidstr=function(t){var e=function(t,e){return t.length>=e?t:new Array(e-t.length+1).join("0")+t},r=[],n=t.substr(0,2),i=parseInt(n,16);r[0]=new String(Math.floor(i/40)),r[1]=new String(i%40);for(var s=t.substr(2),a=[],o=0;o<s.length/2;o++)a.push(parseInt(s.substr(2*o,2),16));var u=[],c="";for(o=0;o<a.length;o++)128&a[o]?c+=e((127&a[o]).toString(2),7):(c+=e((127&a[o]).toString(2),7),u.push(new String(parseInt(c,2))),c="");var h=r.join(".");return u.length>0&&(h=h+"."+u.join(".")),h},ft.dump=function(t,e,r,n){var i=ft,s=i.getV,a=i.dump,o=i.getChildIdx,u=t;t instanceof ct.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=ct.asn1.ASN1Util.oidHexToInt(p),d=ct.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 '"+wt(s(u,r))+"'\n";if("13"==h)return n+"PrintableString '"+wt(s(u,r))+"'\n";if("14"==h)return n+"TeletexString '"+wt(s(u,r))+"'\n";if("16"==h)return n+"IA5String '"+wt(s(u,r))+"'\n";if("17"==h)return n+"UTCTime "+wt(s(u,r))+"\n";if("18"==h)return n+"GeneralizedTime "+wt(s(u,r))+"\n";if("1a"==h)return n+"VisualString '"+wt(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;x<w.length;x++)b+=a(u,v,w[x],n+"  ");return b}if("31"==h){b=n+"SET\n";var w=o(u,r);for(x=0;x<w.length;x++)b+=a(u,e,w[x],n+"  ");return b}if(0!=(128&(h=parseInt(h,16)))){var b,E=31&h;if(0!=(32&h)){for(b=n+"["+E+"]\n",w=o(u,r),x=0;x<w.length;x++)b+=a(u,e,w[x],n+"  ");return b}return f=s(u,r),ft.isASN1HEX(f)?(b=n+"["+E+"]\n")+a(f,e,0,n+"  "):(("68747470"==f.substr(0,8)||"subjectAltName"===e.x509ExtName&&2==E)&&(f=wt(f)),n+"["+E+"] "+f+"\n")}return n+"UNKNOWN("+h+") "+s(u,r)+"\n"},ft.parse=function(t){var e=ft,r=e.parse,n=e.isASN1HEX,i=e.getV,s=e.getTLV,a=e.getChildIdx,o=ct.asn1,u=o.ASN1Util.oidHexToInt,c=o.x509.OID.oid2name,h=wt,l=Ht,f=bt,p={"0c":"utf8str",12:"numstr",13:"prnstr",14:"telstr",16:"ia5str",17:"utctime",18:"gentime","1a":"visstr","1e":"bmpstr",30:"seq",31:"set"},g=t.substr(0,2),d={},m=i(t,0);if("01"==g)return"0101ff"==t?{bool:!0}:{bool:!1};if("02"==g)return{int:{hex:m}};if("03"==g)try{if("00"!=m.substr(0,2))throw"not encap";var v=m.substr(2);if(!n(v))throw"not encap";return{bitstr:{obj:r(v)}}}catch(t){var y=null;return m.length<=10&&(y=function(t){if("string"!=typeof t)return null;if(t.length%2!=0)return null;if(!t.match(/^[0-9a-f]+$/))return null;try{var e=parseInt(t.substr(0,2),16);if(e<0||7<e)return null;for(var r=t.substr(2),n="",i=0;i<r.length;i+=2){var s=r.substr(i,2),a=parseInt(s,16).toString(2);n+=a=("0000000"+a).slice(-8)}return n.substr(0,n.length-e)}catch(t){return null}}(m)),null==y?{bitstr:{hex:m}}:{bitstr:{bin:y}}}else if("04"==g)try{if(!n(m))throw"not encap";return{octstr:{obj:r(m)}}}catch(t){return{octstr:{hex:m}}}else{if("05"==g)return{null:""};if("06"==g){var x=u(m),w=c(x);return""==w?{oid:x}:{oid:w}}if("0a"==g)return m.length>4?{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;i<n.length;i++){var o=n[i],u=s(t,o),c=r(u);e.push(c)}return e}(t),d;if("14"==g){var b=f(m);return d[p[g]]={str:b},d}if("1e"==g)return b=l(m),d[p[g]]={str:b},d;if(-1!=":0c:12:13:16:17:18:1a:".indexOf(g))return b=h(m),d[p[g]]={str:b},d;if(g.match(/^8[0-9]$/))return null==(b=h(m))|""==b||null!=b.match(/[\x00-\x1F\x7F-\x9F]/)||null!=b.match(/[\u0000-\u001F\u0080–\u009F]/)?{tag:{tag:g,explicit:!1,hex:m}}:{tag:{tag:g,explicit:!1,str:b}};if(!g.match(/^a[0-9]$/)){var E=new ct.asn1.ASN1Object;return E.hV=m,{asn1:{tlv:g+E.getLengthHexFromValue()+m}}}try{if(!n(m))throw new Error("not encap");return{tag:{tag:g,explicit:!0,obj:r(m)}}}catch(t){return{tag:{tag:g,explicit:!0,hex:m}}}}},ft.isContextTag=function(t,e){var r,n;t=t.toLowerCase();try{r=parseInt(t,16)}catch(t){return-1}if(void 0===e)return 128==(192&r);try{return null!=e.match(/^\[[0-9]+\]$/)&&!((n=parseInt(e.substr(1,e.length-1),10))>31)&&128==(192&r)&&(31&r)==n}catch(t){return!1}},ft.isASN1HEX=function(t){var e=ft;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},ft.checkStrictDER=function(t,e,r,n,i){var s=ft;if(void 0===r){if("string"!=typeof t)throw new Error("not hex string");if(t=t.toLowerCase(),!ct.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;g<p.length;g++)f+=s.getTLV(t,p[g]).length,s.checkStrictDER(t,p[g],r,n,i);if(2*l!=f)throw new Error("sum of children's TLV length and L unmatch: "+2*l+"!="+f)}},ft.oidname=function(t){var e=ct.asn1;ct.lang.String.isHex(t)&&(t=e.ASN1Util.oidHexToInt(t));var r=e.x509.OID.oid2name(t);return""===r&&(r=t),r},void 0!==ct&&ct||(ct={}),void 0!==ct.asn1&&ct.asn1||(ct.asn1={}),void 0!==ct.asn1.x509&&ct.asn1.x509||(ct.asn1.x509={}),ct.asn1.x509.Certificate=function(t){ct.asn1.x509.Certificate.superclass.constructor.call(this);var e=ct.asn1,r=e.DERBitString,n=e.DERSequence,i=e.x509,s=i.TBSCertificate,a=i.AlgorithmIdentifier;this.params=void 0,this.setByParam=function(t){this.params=t},this.sign=function(){var t=this.params,e=t.sigalg;null!=t.sigalg.name&&(e=t.sigalg.name);var r=t.tbsobj.tohex(),n=new ct.crypto.Signature({alg:e});n.init(t.cakey),n.updateHex(r),t.sighex=n.sign()},this.getPEM=function(){return At(this.tohex(),"CERTIFICATE")},this.tohex=function(){var t=this.params;if(null!=t.tbsobj&&null!=t.tbsobj||(t.tbsobj=new s(t)),null==t.sighex&&null!=t.cakey&&this.sign(),null==t.sighex)throw new Error("sighex or cakey parameter not defined");var e=[];return e.push(t.tbsobj),e.push(new a({name:t.sigalg})),e.push(new r({hex:"00"+t.sighex})),new n({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&(this.params=t)},Kt(ct.asn1.x509.Certificate,ct.asn1.ASN1Object),ct.asn1.x509.TBSCertificate=function(t){ct.asn1.x509.TBSCertificate.superclass.constructor.call(this);var e=ct.asn1,r=e.x509,n=e.DERTaggedObject,i=e.DERInteger,s=e.DERSequence,a=r.AlgorithmIdentifier,o=r.Time,u=r.X500Name,c=r.Extensions,h=r.SubjectPublicKeyInfo;this.params=null,this.setByParam=function(t){this.params=t},this.tohex=function(){var t=[],e=this.params;if(null!=e.version||1!=e.version){var r=2;null!=e.version&&(r=e.version-1);var l=new n({obj:new i({int:r})});t.push(l)}return t.push(new i(e.serial)),t.push(new a({name:e.sigalg})),t.push(new u(e.issuer)),t.push(new s({array:[new o(e.notbefore),new o(e.notafter)]})),t.push(new u(e.subject)),t.push(new h(qt.getKey(e.sbjpubkey))),void 0!==e.ext&&e.ext.length>0&&t.push(new n({tag:"a3",obj:new c(e.ext)})),new ct.asn1.DERSequence({array:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},Kt(ct.asn1.x509.TBSCertificate,ct.asn1.ASN1Object),ct.asn1.x509.Extensions=function(t){ct.asn1.x509.Extensions.superclass.constructor.call(this);var e=ct.asn1,r=e.DERSequence,n=e.x509;this.aParam=[],this.setByParam=function(t){this.aParam=t},this.tohex=function(){for(var t=[],e=0;e<this.aParam.length;e++){var i=this.aParam[e],s=i.extname,a=null;if(null!=i.extn)a=new n.PrivateExtension(i);else if("subjectKeyIdentifier"==s)a=new n.SubjectKeyIdentifier(i);else if("keyUsage"==s)a=new n.KeyUsage(i);else if("subjectAltName"==s)a=new n.SubjectAltName(i);else if("issuerAltName"==s)a=new n.IssuerAltName(i);else if("basicConstraints"==s)a=new n.BasicConstraints(i);else if("nameConstraints"==s)a=new n.NameConstraints(i);else if("cRLDistributionPoints"==s)a=new n.CRLDistributionPoints(i);else if("certificatePolicies"==s)a=new n.CertificatePolicies(i);else if("authorityKeyIdentifier"==s)a=new n.AuthorityKeyIdentifier(i);else if("extKeyUsage"==s)a=new n.ExtKeyUsage(i);else if("authorityInfoAccess"==s)a=new n.AuthorityInfoAccess(i);else if("cRLNumber"==s)a=new n.CRLNumber(i);else if("cRLReason"==s)a=new n.CRLReason(i);else if("ocspNonce"==s)a=new n.OCSPNonce(i);else if("ocspNoCheck"==s)a=new n.OCSPNoCheck(i);else if("adobeTimeStamp"==s)a=new n.AdobeTimeStamp(i);else{if("subjectDirectoryAttributes"!=s)throw new Error("extension not supported:"+JSON.stringify(i));a=new n.SubjectDirectoryAttributes(i)}null!=a&&t.push(a)}return new r({array:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Kt(ct.asn1.x509.Extensions,ct.asn1.ASN1Object),ct.asn1.x509.Extension=function(t){ct.asn1.x509.Extension.superclass.constructor.call(this);var e=ct.asn1,r=e.DERObjectIdentifier,n=e.DEROctetString,i=(e.DERBitString,e.DERBoolean),s=e.DERSequence;this.tohex=function(){var t=new r({oid:this.oid}),e=new n({hex:this.getExtnValueHex()}),a=new Array;return a.push(t),this.critical&&a.push(new i),a.push(e),new s({array:a}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.critical=!1,void 0!==t&&void 0!==t.critical&&(this.critical=t.critical)},Kt(ct.asn1.x509.Extension,ct.asn1.ASN1Object),ct.asn1.x509.KeyUsage=function(t){ct.asn1.x509.KeyUsage.superclass.constructor.call(this,t);var e=Error,r={digitalSignature:0,nonRepudiation:1,keyEncipherment:2,dataEncipherment:3,keyAgreement:4,keyCertSign:5,cRLSign:6,encipherOnly:7,decipherOnly:8};this.getExtnValueHex=function(){var t=this.getBinValue();return this.asn1ExtnValue=new ct.asn1.DERBitString({bin:t}),this.asn1ExtnValue.tohex()},this.getBinValue=function(){var t=this.params;if("object"!=typeof t||"object"!=typeof t.names&&"string"!=typeof t.bin)throw new e("parameter not yet set");if(null!=t.names)return Mt(t.names,r);if(null!=t.bin)return t.bin;throw new e("parameter not set properly")},this.oid="2.5.29.15",void 0!==t&&(this.params=t)},Kt(ct.asn1.x509.KeyUsage,ct.asn1.x509.Extension),ct.asn1.x509.BasicConstraints=function(t){ct.asn1.x509.BasicConstraints.superclass.constructor.call(this,t);var e=ct.asn1,r=e.DERBoolean,n=e.DERInteger,i=e.DERSequence;this.getExtnValueHex=function(){var t=new Array;this.cA&&t.push(new r),this.pathLen>-1&&t.push(new n({int:this.pathLen}));var e=new i({array:t});return this.asn1ExtnValue=e,this.asn1ExtnValue.tohex()},this.oid="2.5.29.19",this.cA=!1,this.pathLen=-1,void 0!==t&&(void 0!==t.cA&&(this.cA=t.cA),void 0!==t.pathLen&&(this.pathLen=t.pathLen))},Kt(ct.asn1.x509.BasicConstraints,ct.asn1.x509.Extension),ct.asn1.x509.CRLDistributionPoints=function(t){ct.asn1.x509.CRLDistributionPoints.superclass.constructor.call(this,t);var e=ct.asn1,r=e.x509;this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.setByDPArray=function(t){for(var n=[],i=0;i<t.length;i++)if(t[i]instanceof ct.asn1.ASN1Object)n.push(t[i]);else{var s=new r.DistributionPoint(t[i]);n.push(s)}this.asn1ExtnValue=new e.DERSequence({array:n})},this.setByOneURI=function(t){var e=new r.DistributionPoint({fulluri:t});this.setByDPArray([e])},this.oid="2.5.29.31",void 0!==t&&(void 0!==t.array?this.setByDPArray(t.array):void 0!==t.uri&&this.setByOneURI(t.uri))},Kt(ct.asn1.x509.CRLDistributionPoints,ct.asn1.x509.Extension),ct.asn1.x509.DistributionPoint=function(t){ct.asn1.x509.DistributionPoint.superclass.constructor.call(this);var e=ct.asn1,r=e.x509.DistributionPointName;this.tohex=function(){var t=new e.DERSequence;if(null!=this.asn1DP){var r=new e.DERTaggedObject({explicit:!0,tag:"a0",obj:this.asn1DP});t.appendASN1Object(r)}return this.hTLV=t.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&(void 0!==t.dpobj?this.asn1DP=t.dpobj:void 0!==t.dpname?this.asn1DP=new r(t.dpname):void 0!==t.fulluri&&(this.asn1DP=new r({full:[{uri:t.fulluri}]})))},Kt(ct.asn1.x509.DistributionPoint,ct.asn1.ASN1Object),ct.asn1.x509.DistributionPointName=function(t){ct.asn1.x509.DistributionPointName.superclass.constructor.call(this);var e=ct.asn1,r=e.DERTaggedObject;if(this.tohex=function(){if("full"!=this.type)throw new Error("currently type shall be 'full': "+this.type);return this.asn1Obj=new r({explicit:!1,tag:this.tag,obj:this.asn1V}),this.hTLV=this.asn1Obj.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==t)if(e.x509.GeneralNames.prototype.isPrototypeOf(t))this.type="full",this.tag="a0",this.asn1V=t;else{if(void 0===t.full)throw new Error("This class supports GeneralNames only as argument");this.type="full",this.tag="a0",this.asn1V=new e.x509.GeneralNames(t.full)}},Kt(ct.asn1.x509.DistributionPointName,ct.asn1.ASN1Object),ct.asn1.x509.CertificatePolicies=function(t){ct.asn1.x509.CertificatePolicies.superclass.constructor.call(this,t);var e=ct.asn1,r=e.x509,n=e.DERSequence,i=r.PolicyInformation;this.params=null,this.getExtnValueHex=function(){for(var t=[],e=0;e<this.params.array.length;e++)t.push(new i(this.params.array[e]));var r=new n({array:t});return this.asn1ExtnValue=r,this.asn1ExtnValue.tohex()},this.oid="2.5.29.32",void 0!==t&&(this.params=t)},Kt(ct.asn1.x509.CertificatePolicies,ct.asn1.x509.Extension),ct.asn1.x509.PolicyInformation=function(t){ct.asn1.x509.PolicyInformation.superclass.constructor.call(this,t);var e=ct.asn1,r=e.DERSequence,n=e.DERObjectIdentifier,i=e.x509.PolicyQualifierInfo;this.params=null,this.tohex=function(){if(void 0===this.params.policyoid&&void 0===this.params.array)throw new Error("parameter oid and array missing");var t=[new n(this.params.policyoid)];if(void 0!==this.params.array){for(var e=[],s=0;s<this.params.array.length;s++)e.push(new i(this.params.array[s]));e.length>0&&t.push(new r({array:e}))}return new r({array:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&(this.params=t)},Kt(ct.asn1.x509.PolicyInformation,ct.asn1.ASN1Object),ct.asn1.x509.PolicyQualifierInfo=function(t){ct.asn1.x509.PolicyQualifierInfo.superclass.constructor.call(this,t);var e=ct.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)},Kt(ct.asn1.x509.PolicyQualifierInfo,ct.asn1.ASN1Object),ct.asn1.x509.UserNotice=function(t){ct.asn1.x509.UserNotice.superclass.constructor.call(this,t);var e=ct.asn1.DERSequence,r=(ct.asn1.DERInteger,ct.asn1.x509.DisplayText),n=ct.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)},Kt(ct.asn1.x509.UserNotice,ct.asn1.ASN1Object),ct.asn1.x509.NoticeReference=function(t){ct.asn1.x509.NoticeReference.superclass.constructor.call(this,t);var e=ct.asn1.DERSequence,r=ct.asn1.DERInteger,n=ct.asn1.x509.DisplayText;this.params=null,this.tohex=function(){var t=[];if(void 0!==this.params.org&&t.push(new n(this.params.org)),void 0!==this.params.noticenum){for(var i=[],s=this.params.noticenum,a=0;a<s.length;a++)i.push(new r(s[a]));t.push(new e({array:i}))}if(0==t.length)throw new Error("parameter is empty");return new e({array:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&(this.params=t)},Kt(ct.asn1.x509.NoticeReference,ct.asn1.ASN1Object),ct.asn1.x509.DisplayText=function(t){ct.asn1.x509.DisplayText.superclass.constructor.call(this,t),this.hT="0c",void 0!==t&&("ia5"===t.type?this.hT="16":"vis"===t.type?this.hT="1a":"bmp"===t.type&&(this.hT="1e"))},Kt(ct.asn1.x509.DisplayText,ct.asn1.DERAbstractString),ct.asn1.x509.NameConstraints=function(t){ct.asn1.x509.NameConstraints.superclass.constructor.call(this,t);var e=ct.asn1,r=e.x509,n=e.ASN1Util.newObject,i=r.GeneralSubtree;this.params=null,this.getExtnValueHex=function(){var t=this.params,e=[];if(null!=t.permit&&null!=t.permit.length){for(var r=[],s=0;s<t.permit.length;s++)r.push(new i(t.permit[s]));e.push({tag:{tagi:"a0",obj:{seq:r}}})}if(null!=t.exclude&&null!=t.exclude.length){var a=[];for(s=0;s<t.exclude.length;s++)a.push(new i(t.exclude[s]));e.push({tag:{tagi:"a1",obj:{seq:a}}})}return this.asn1ExtnValue=n({seq:e}),this.asn1ExtnValue.tohex()},this.oid="2.5.29.30",void 0!==t&&(this.params=t)},Kt(ct.asn1.x509.NameConstraints,ct.asn1.x509.Extension),ct.asn1.x509.GeneralSubtree=function(t){ct.asn1.x509.GeneralSubtree.superclass.constructor.call(this);var e=ct.asn1,r=e.x509.GeneralName,n=e.ASN1Util.newObject;this.params=null,this.setByParam=function(t){this.params=t},this.tohex=function(){var t=this.params,e=[new r(t)];return null!=t.min&&e.push({tag:{tagi:"80",obj:{int:t.min}}}),null!=t.max&&e.push({tag:{tagi:"81",obj:{int:t.max}}}),n({seq:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},Kt(ct.asn1.x509.GeneralSubtree,ct.asn1.ASN1Object),ct.asn1.x509.ExtKeyUsage=function(t){ct.asn1.x509.ExtKeyUsage.superclass.constructor.call(this,t);var e=ct.asn1;this.setPurposeArray=function(t){this.asn1ExtnValue=new e.DERSequence;for(var r=0;r<t.length;r++){var n=new e.DERObjectIdentifier(t[r]);this.asn1ExtnValue.appendASN1Object(n)}},this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.oid="2.5.29.37",void 0!==t&&void 0!==t.array&&this.setPurposeArray(t.array)},Kt(ct.asn1.x509.ExtKeyUsage,ct.asn1.x509.Extension),ct.asn1.x509.AuthorityKeyIdentifier=function(t){ct.asn1.x509.AuthorityKeyIdentifier.superclass.constructor.call(this,t);var e=ct,r=e.asn1,n=r.DERTaggedObject,i=r.x509.GeneralNames;e.crypto.Util.isKey,this.asn1KID=null,this.asn1CertIssuer=null,this.asn1CertSN=null,this.getExtnValueHex=function(){var t=new Array;this.asn1KID&&t.push(new n({explicit:!1,tag:"80",obj:this.asn1KID})),this.asn1CertIssuer&&t.push(new n({explicit:!1,tag:"a1",obj:new i([{dn:this.asn1CertIssuer}])})),this.asn1CertSN&&t.push(new n({explicit:!1,tag:"82",obj:this.asn1CertSN}));var e=new r.DERSequence({array:t});return this.asn1ExtnValue=e,this.asn1ExtnValue.tohex()},this.setKIDByParam=function(t){if(void 0!==t.str||void 0!==t.hex)this.asn1KID=new ct.asn1.DEROctetString(t);else if("object"==typeof t&&ct.crypto.Util.isKey(t)||"string"==typeof t&&-1!=t.indexOf("BEGIN ")){var e=t;"string"==typeof t&&(e=qt.getKey(t));var r=qt.getKeyID(e);this.asn1KID=new ct.asn1.DEROctetString({hex:r})}},this.setCertIssuerByParam=function(t){void 0!==t.str||void 0!==t.ldapstr||void 0!==t.hex||void 0!==t.certsubject||void 0!==t.certissuer?this.asn1CertIssuer=new ct.asn1.x509.X500Name(t):"string"==typeof t&&-1!=t.indexOf("BEGIN ")&&-1!=t.indexOf("CERTIFICATE")&&(this.asn1CertIssuer=new ct.asn1.x509.X500Name({certissuer:t}))},this.setCertSNByParam=function(t){if(void 0!==t.str||void 0!==t.bigint||void 0!==t.hex)this.asn1CertSN=new ct.asn1.DERInteger(t);else if("string"==typeof t&&-1!=t.indexOf("BEGIN ")&&t.indexOf("CERTIFICATE")){var e=new Wt;e.readCertPEM(t);var r=e.getSerialNumberHex();this.asn1CertSN=new ct.asn1.DERInteger({hex:r})}},this.oid="2.5.29.35",void 0!==t&&(void 0!==t.kid&&this.setKIDByParam(t.kid),void 0!==t.issuer&&this.setCertIssuerByParam(t.issuer),void 0!==t.sn&&this.setCertSNByParam(t.sn),void 0!==t.issuersn&&"string"==typeof t.issuersn&&-1!=t.issuersn.indexOf("BEGIN ")&&t.issuersn.indexOf("CERTIFICATE")&&(this.setCertSNByParam(t.issuersn),this.setCertIssuerByParam(t.issuersn)))},Kt(ct.asn1.x509.AuthorityKeyIdentifier,ct.asn1.x509.Extension),ct.asn1.x509.SubjectKeyIdentifier=function(t){ct.asn1.x509.SubjectKeyIdentifier.superclass.constructor.call(this,t);var e=ct.asn1.DEROctetString;this.asn1KID=null,this.getExtnValueHex=function(){return this.asn1ExtnValue=this.asn1KID,this.asn1ExtnValue.tohex()},this.setKIDByParam=function(t){if(void 0!==t.str||void 0!==t.hex)this.asn1KID=new e(t);else if("object"==typeof t&&ct.crypto.Util.isKey(t)||"string"==typeof t&&-1!=t.indexOf("BEGIN")){var r=t;"string"==typeof t&&(r=qt.getKey(t));var n=qt.getKeyID(r);this.asn1KID=new ct.asn1.DEROctetString({hex:n})}},this.oid="2.5.29.14",void 0!==t&&void 0!==t.kid&&this.setKIDByParam(t.kid)},Kt(ct.asn1.x509.SubjectKeyIdentifier,ct.asn1.x509.Extension),ct.asn1.x509.AuthorityInfoAccess=function(t){ct.asn1.x509.AuthorityInfoAccess.superclass.constructor.call(this,t),this.setAccessDescriptionArray=function(t){for(var e=new Array,r=ct.asn1,n=r.DERSequence,i=r.DERObjectIdentifier,s=r.x509.GeneralName,a=0;a<t.length;a++){var o,u=t[a];if(void 0!==u.ocsp)o=new n({array:[new i({oid:"1.3.6.1.5.5.7.48.1"}),new s({uri:u.ocsp})]});else{if(void 0===u.caissuer)throw new Error("unknown AccessMethod parameter: "+JSON.stringify(u));o=new n({array:[new i({oid:"1.3.6.1.5.5.7.48.2"}),new s({uri:u.caissuer})]})}e.push(o)}this.asn1ExtnValue=new n({array:e})},this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.oid="1.3.6.1.5.5.7.1.1",void 0!==t&&void 0!==t.array&&this.setAccessDescriptionArray(t.array)},Kt(ct.asn1.x509.AuthorityInfoAccess,ct.asn1.x509.Extension),ct.asn1.x509.SubjectAltName=function(t){ct.asn1.x509.SubjectAltName.superclass.constructor.call(this,t),this.setNameArray=function(t){this.asn1ExtnValue=new ct.asn1.x509.GeneralNames(t)},this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.oid="2.5.29.17",void 0!==t&&void 0!==t.array&&this.setNameArray(t.array)},Kt(ct.asn1.x509.SubjectAltName,ct.asn1.x509.Extension),ct.asn1.x509.IssuerAltName=function(t){ct.asn1.x509.IssuerAltName.superclass.constructor.call(this,t),this.setNameArray=function(t){this.asn1ExtnValue=new ct.asn1.x509.GeneralNames(t)},this.getExtnValueHex=function(){return this.asn1ExtnValue.tohex()},this.oid="2.5.29.18",void 0!==t&&void 0!==t.array&&this.setNameArray(t.array)},Kt(ct.asn1.x509.IssuerAltName,ct.asn1.x509.Extension),ct.asn1.x509.SubjectDirectoryAttributes=function(t){ct.asn1.x509.SubjectDirectoryAttributes.superclass.constructor.call(this,t);var e=ct.asn1,r=e.DERSequence,n=e.ASN1Util.newObject,i=e.x509.OID.name2oid;this.params=null,this.getExtnValueHex=function(){for(var t=[],e=0;e<this.params.array.length;e++){var s=this.params.array[e],a={seq:[{oid:"1.2.3.4"},{set:[{utf8str:"DE"}]}]};if("dateOfBirth"==s.attr)a.seq[0].oid=i(s.attr),a.seq[1].set[0]={gentime:s.str};else if("placeOfBirth"==s.attr)a.seq[0].oid=i(s.attr),a.seq[1].set[0]={utf8str:s.str};else if("gender"==s.attr)a.seq[0].oid=i(s.attr),a.seq[1].set[0]={prnstr:s.str};else if("countryOfCitizenship"==s.attr)a.seq[0].oid=i(s.attr),a.seq[1].set[0]={prnstr:s.str};else{if("countryOfResidence"!=s.attr)throw new Error("unsupported attribute: "+s.attr);a.seq[0].oid=i(s.attr),a.seq[1].set[0]={prnstr:s.str}}t.push(new n(a))}var o=new r({array:t});return this.asn1ExtnValue=o,this.asn1ExtnValue.tohex()},this.oid="2.5.29.9",void 0!==t&&(this.params=t)},Kt(ct.asn1.x509.SubjectDirectoryAttributes,ct.asn1.x509.Extension),ct.asn1.x509.PrivateExtension=function(t){ct.asn1.x509.PrivateExtension.superclass.constructor.call(this,t);var e=ct,r=e.lang.String.isHex,n=e.asn1,i=n.x509.OID.name2oid,s=n.ASN1Util.newObject;this.params=null,this.setByParam=function(t){this.oid=i(t.extname),this.params=t},this.getExtnValueHex=function(){if(null==this.params.extname||null==this.params.extn)throw new Error("extname or extnhex not specified");var t=this.params.extn;if("string"==typeof t&&r(t))return t;if("object"==typeof t)try{return s(t).tohex()}catch(t){}throw new Error("unsupported extn value")},null!=t&&this.setByParam(t)},Kt(ct.asn1.x509.PrivateExtension,ct.asn1.x509.Extension),ct.asn1.x509.CRL=function(t){ct.asn1.x509.CRL.superclass.constructor.call(this);var e=ct.asn1,r=e.DERSequence,n=e.DERBitString,i=e.x509,s=i.AlgorithmIdentifier,a=i.TBSCertList;this.params=void 0,this.setByParam=function(t){this.params=t},this.sign=function(){var t=new a(this.params).tohex(),e=new ct.crypto.Signature({alg:this.params.sigalg});e.init(this.params.cakey),e.updateHex(t);var r=e.sign();this.params.sighex=r},this.getPEM=function(){return At(this.tohex(),"X509 CRL")},this.tohex=function(){var t=this.params;if(null==t.tbsobj&&(t.tbsobj=new a(t)),null==t.sighex&&null!=t.cakey&&this.sign(),null==t.sighex)throw new Error("sighex or cakey parameter not defined");var e=[];return e.push(t.tbsobj),e.push(new s({name:t.sigalg})),e.push(new n({hex:"00"+t.sighex})),new r({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&(this.params=t)},Kt(ct.asn1.x509.CRL,ct.asn1.ASN1Object),ct.asn1.x509.TBSCertList=function(t){ct.asn1.x509.TBSCertList.superclass.constructor.call(this);var e=ct.asn1,r=e.DERInteger,n=e.DERSequence,i=e.DERTaggedObject,s=(e.DERObjectIdentifier,e.x509),a=s.AlgorithmIdentifier,o=s.Time,u=s.Extensions,c=s.X500Name;this.params=null,this.setByParam=function(t){this.params=t},this.getRevCertSequence=function(){for(var t=[],e=this.params.revcert,i=0;i<e.length;i++){var s=[new r(e[i].sn),new o(e[i].date)];null!=e[i].ext&&s.push(new u(e[i].ext)),t.push(new n({array:s}))}return new n({array:t})},this.tohex=function(){var t=[],e=this.params;if(null!=e.version){var s=e.version-1,h=new r({int:s});t.push(h)}if(t.push(new a({name:e.sigalg})),t.push(new c(e.issuer)),t.push(new o(e.thisupdate)),null!=e.nextupdate&&t.push(new o(e.nextupdate)),null!=e.revcert&&t.push(this.getRevCertSequence()),null!=e.ext){var l=new u(e.ext);t.push(new i({tag:"a0",explicit:!0,obj:l}))}return new n({array:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},Kt(ct.asn1.x509.TBSCertList,ct.asn1.ASN1Object),ct.asn1.x509.CRLEntry=function(t){ct.asn1.x509.CRLEntry.superclass.constructor.call(this);var e=ct.asn1;this.setCertSerial=function(t){this.sn=new e.DERInteger(t)},this.setRevocationDate=function(t){this.time=new e.x509.Time(t)},this.tohex=function(){var t=new e.DERSequence({array:[this.sn,this.time]});return this.TLV=t.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&(void 0!==t.time&&this.setRevocationDate(t.time),void 0!==t.sn&&this.setCertSerial(t.sn))},Kt(ct.asn1.x509.CRLEntry,ct.asn1.ASN1Object),ct.asn1.x509.CRLNumber=function(t){ct.asn1.x509.CRLNumber.superclass.constructor.call(this,t),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new ct.asn1.DERInteger(this.params.num),this.asn1ExtnValue.tohex()},this.oid="2.5.29.20",null!=t&&(this.params=t)},Kt(ct.asn1.x509.CRLNumber,ct.asn1.x509.Extension),ct.asn1.x509.CRLReason=function(t){ct.asn1.x509.CRLReason.superclass.constructor.call(this,t),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new ct.asn1.DEREnumerated(this.params.code),this.asn1ExtnValue.tohex()},this.oid="2.5.29.21",null!=t&&(this.params=t)},Kt(ct.asn1.x509.CRLReason,ct.asn1.x509.Extension),ct.asn1.x509.OCSPNonce=function(t){ct.asn1.x509.OCSPNonce.superclass.constructor.call(this,t),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new ct.asn1.DEROctetString(this.params),this.asn1ExtnValue.tohex()},this.oid="1.3.6.1.5.5.7.48.1.2",null!=t&&(this.params=t)},Kt(ct.asn1.x509.OCSPNonce,ct.asn1.x509.Extension),ct.asn1.x509.OCSPNoCheck=function(t){ct.asn1.x509.OCSPNoCheck.superclass.constructor.call(this,t),this.params=void 0,this.getExtnValueHex=function(){return this.asn1ExtnValue=new ct.asn1.DERNull,this.asn1ExtnValue.tohex()},this.oid="1.3.6.1.5.5.7.48.1.5",null!=t&&(this.params=t)},Kt(ct.asn1.x509.OCSPNoCheck,ct.asn1.x509.Extension),ct.asn1.x509.AdobeTimeStamp=function(t){ct.asn1.x509.AdobeTimeStamp.superclass.constructor.call(this,t);var e=ct.asn1,r=e.DERInteger,n=e.DERBoolean,i=e.DERSequence,s=e.x509.GeneralName;this.params=null,this.getExtnValueHex=function(){var t=this.params,e=[new r(1)];return e.push(new s({uri:t.uri})),null!=t.reqauth&&e.push(new n(t.reqauth)),this.asn1ExtnValue=new i({array:e}),this.asn1ExtnValue.tohex()},this.oid="1.2.840.113583.1.1.9.1",void 0!==t&&this.setByParam(t)},Kt(ct.asn1.x509.AdobeTimeStamp,ct.asn1.x509.Extension),ct.asn1.x509.X500Name=function(t){ct.asn1.x509.X500Name.superclass.constructor.call(this),this.asn1Array=[],this.paramArray=[],this.sRule="utf8";var e=ct.asn1,r=e.x509,n=r.RDN;this.setByString=function(t,e){void 0!==e&&(this.sRule=e);var r=t.split("/");r.shift();for(var i=[],s=0;s<r.length;s++)if(r[s].match(/^[^=]+=.+$/))i.push(r[s]);else{var a=i.length-1;i[a]=i[a]+"/"+r[s]}for(s=0;s<i.length;s++)this.asn1Array.push(new n({str:i[s],rule:this.sRule}))},this.setByLdapString=function(t,e){void 0!==e&&(this.sRule=e);var n=r.X500Name.ldapToCompat(t);this.setByString(n,e)},this.setByObject=function(t,e){for(var r in void 0!==e&&(this.sRule=e),t)if(t.hasOwnProperty(r)){var i=new n({str:r+"="+t[r],rule:this.sRule});this.asn1Array?this.asn1Array.push(i):this.asn1Array=[i]}},this.setByParam=function(t){var e;void 0!==t.rule&&(this.sRule=t.rule),void 0!==t.array?this.paramArray=t.array:void 0!==t.str?this.setByString(t.str):void 0!==t.ldapstr?this.setByLdapString(t.ldapstr):void 0!==t.hex?this.hTLV=t.hex:void 0!==t.certissuer?((e=new Wt).readCertPEM(t.certissuer),this.hTLV=e.getIssuerHex()):void 0!==t.certsubject?((e=new Wt).readCertPEM(t.certsubject),this.hTLV=e.getSubjectHex()):"object"==typeof t&&void 0===t.certsubject&&void 0===t.certissuer&&this.setByObject(t)},this.tohex=function(){if("string"==typeof this.hTLV)return this.hTLV;if(0==this.asn1Array.length&&this.paramArray.length>0)for(var t=0;t<this.paramArray.length;t++){var r={array:this.paramArray[t]};"utf8"!=this.sRule&&(r.rule=this.sRule);var i=new n(r);this.asn1Array.push(i)}var s=new e.DERSequence({array:this.asn1Array});return this.hTLV=s.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},Kt(ct.asn1.x509.X500Name,ct.asn1.ASN1Object),ct.asn1.x509.X500Name.compatToLDAP=function(t){if("/"!==t.substr(0,1))throw"malformed input";var e=(t=t.substr(1)).split("/");return e.reverse(),e=e.map((function(t){return t.replace(/,/,"\\,")})),e.join(",")},ct.asn1.x509.X500Name.onelineToLDAP=function(t){return ct.asn1.x509.X500Name.compatToLDAP(t)},ct.asn1.x509.X500Name.ldapToCompat=function(t){for(var e=t.split(","),r=!1,n=[],i=0;e.length>0;i++){var s=e.shift();if(!0===r){var a=(n.pop()+","+s).replace(/\\,/g,",");n.push(a),r=!1}else n.push(s);"\\"===s.substr(-1,1)&&(r=!0)}return n=n.map((function(t){return t.replace("/","\\/")})),n.reverse(),"/"+n.join("/")},ct.asn1.x509.X500Name.ldapToOneline=function(t){return ct.asn1.x509.X500Name.ldapToCompat(t)},ct.asn1.x509.RDN=function(t){ct.asn1.x509.RDN.superclass.constructor.call(this),this.asn1Array=[],this.paramArray=[],this.sRule="utf8";var e=ct.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 ct.asn1.x509.AttributeTypeAndValue({str:t,rule:this.sRule}))},this.addByMultiValuedString=function(t){for(var e=ct.asn1.x509.RDN.parseString(t),r=0;r<e.length;r++)this.addByString(e[r])},this.tohex=function(){if(0==this.asn1Array.length&&this.paramArray.length>0)for(var t=0;t<this.paramArray.length;t++){var r=this.paramArray[t];void 0!==r.rule&&"utf8"!=this.sRule&&(r.rule=this.sRule);var n=new e(r);this.asn1Array.push(n)}var i=new ct.asn1.DERSet({array:this.asn1Array});return this.TLV=i.tohex(),this.TLV},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},Kt(ct.asn1.x509.RDN,ct.asn1.ASN1Object),ct.asn1.x509.RDN.parseString=function(t){for(var e=t.split(/\+/),r=!1,n=[],i=0;e.length>0;i++){var s=e.shift();if(!0===r){var a=(n.pop()+"+"+s).replace(/\\\+/g,"+");n.push(a),r=!1}else n.push(s);"\\"===s.substr(-1,1)&&(r=!0)}var o=!1,u=[];for(i=0;n.length>0;i++){if(s=n.shift(),!0===o){var c=u.pop();s.match(/"$/)?(a=(c+"+"+s).replace(/^([^=]+)="(.*)"$/,"$1=$2"),u.push(a),o=!1):u.push(c+"+"+s)}else u.push(s);s.match(/^[^=]+="/)&&(o=!0)}return u},ct.asn1.x509.AttributeTypeAndValue=function(t){ct.asn1.x509.AttributeTypeAndValue.superclass.constructor.call(this),this.sRule="utf8",this.sType=null,this.sValue=null,this.dsType=null;var e=ct,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=ct.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)},Kt(ct.asn1.x509.AttributeTypeAndValue,ct.asn1.ASN1Object),ct.asn1.x509.SubjectPublicKeyInfo=function(t){ct.asn1.x509.SubjectPublicKeyInfo.superclass.constructor.call(this);var e=ct,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 nt){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 ct.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 ct.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)},Kt(ct.asn1.x509.SubjectPublicKeyInfo,ct.asn1.ASN1Object),ct.asn1.x509.Time=function(t){ct.asn1.x509.Time.superclass.constructor.call(this);var e=ct.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)},ct.asn1.x509.Time_bak=function(t){ct.asn1.x509.Time_bak.superclass.constructor.call(this);var e=ct.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)},Kt(ct.asn1.x509.Time,ct.asn1.ASN1Object),ct.asn1.x509.AlgorithmIdentifier=function(t){ct.asn1.x509.AlgorithmIdentifier.superclass.constructor.call(this),this.nameAlg=null,this.asn1Alg=null,this.asn1Params=null,this.paramEmpty=!1;var e=ct.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)}},Kt(ct.asn1.x509.AlgorithmIdentifier,ct.asn1.ASN1Object),ct.asn1.x509.AlgorithmIdentifier.PSSNAME2ASN1TLV={SHAwithRSAandMGF1:"300d06092a864886f70d01010a3000",SHA256withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040201a11a301806092a864886f70d010108300b0609608648016503040201a203020120",SHA384withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040202a11a301806092a864886f70d010108300b0609608648016503040202a203020130",SHA512withRSAandMGF1:"303d06092a864886f70d01010a3030a00d300b0609608648016503040203a11a301806092a864886f70d010108300b0609608648016503040203a203020140"},ct.asn1.x509.GeneralName=function(t){ct.asn1.x509.GeneralName.superclass.constructor.call(this);var e=ct.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 ct.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 Wt;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)},Kt(ct.asn1.x509.GeneralName,ct.asn1.ASN1Object),ct.asn1.x509.GeneralNames=function(t){ct.asn1.x509.GeneralNames.superclass.constructor.call(this);var e=ct.asn1;this.setByParamArray=function(t){for(var r=0;r<t.length;r++){var n=new e.x509.GeneralName(t[r]);this.asn1Array.push(n)}},this.tohex=function(){return new e.DERSequence({array:this.asn1Array}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.asn1Array=new Array,void 0!==t&&this.setByParamArray(t)},Kt(ct.asn1.x509.GeneralNames,ct.asn1.ASN1Object),ct.asn1.x509.OtherName=function(t){ct.asn1.x509.OtherName.superclass.constructor.call(this);var e=ct.asn1,r=e.DERObjectIdentifier,n=e.DERSequence,i=e.ASN1Util.newObject;this.params=null,this.setByParam=function(t){this.params=t},this.tohex=function(){var t=this.params;if(null==t.oid||null==t.value)throw new Error("oid or value not specified");var e=new r({oid:t.oid}),s=i({tag:{tag:"a0",explicit:!0,obj:t.value}});return new n({array:[e,s]}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},Kt(ct.asn1.x509.OtherName,ct.asn1.ASN1Object),ct.asn1.x509.OID=new function(){var t=ct.asn1.DERObjectIdentifier;this.name2oidList={sha1:"1.3.14.3.2.26",sha256:"2.16.840.1.101.3.4.2.1",sha384:"2.16.840.1.101.3.4.2.2",sha512:"2.16.840.1.101.3.4.2.3",sha224:"2.16.840.1.101.3.4.2.4",md5:"1.2.840.113549.2.5",md2:"1.3.14.7.2.2.1",ripemd160:"1.3.36.3.2.1",MD2withRSA:"1.2.840.113549.1.1.2",MD4withRSA:"1.2.840.113549.1.1.3",MD5withRSA:"1.2.840.113549.1.1.4",SHA1withRSA:"1.2.840.113549.1.1.5","pkcs1-MGF":"1.2.840.113549.1.1.8",rsaPSS:"1.2.840.113549.1.1.10",SHA224withRSA:"1.2.840.113549.1.1.14",SHA256withRSA:"1.2.840.113549.1.1.11",SHA384withRSA:"1.2.840.113549.1.1.12",SHA512withRSA:"1.2.840.113549.1.1.13",SHA1withECDSA:"1.2.840.10045.4.1",SHA224withECDSA:"1.2.840.10045.4.3.1",SHA256withECDSA:"1.2.840.10045.4.3.2",SHA384withECDSA:"1.2.840.10045.4.3.3",SHA512withECDSA:"1.2.840.10045.4.3.4",dsa:"1.2.840.10040.4.1",SHA1withDSA:"1.2.840.10040.4.3",SHA224withDSA:"2.16.840.1.101.3.4.3.1",SHA256withDSA:"2.16.840.1.101.3.4.3.2",rsaEncryption:"1.2.840.113549.1.1.1",commonName:"2.5.4.3",countryName:"2.5.4.6",localityName:"2.5.4.7",stateOrProvinceName:"2.5.4.8",streetAddress:"2.5.4.9",organizationName:"2.5.4.10",organizationalUnitName:"2.5.4.11",domainComponent:"0.9.2342.19200300.100.1.25",userId:"0.9.2342.19200300.100.1.1",surname:"2.5.4.4",givenName:"2.5.4.42",title:"2.5.4.12",distinguishedName:"2.5.4.49",emailAddress:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3",subjectDirectoryAttributes:"2.5.29.9",subjectKeyIdentifier:"2.5.29.14",keyUsage:"2.5.29.15",subjectAltName:"2.5.29.17",issuerAltName:"2.5.29.18",basicConstraints:"2.5.29.19",cRLNumber:"2.5.29.20",cRLReason:"2.5.29.21",nameConstraints:"2.5.29.30",cRLDistributionPoints:"2.5.29.31",certificatePolicies:"2.5.29.32",anyPolicy:"2.5.29.32.0",authorityKeyIdentifier:"2.5.29.35",policyConstraints:"2.5.29.36",extKeyUsage:"2.5.29.37",authorityInfoAccess:"1.3.6.1.5.5.7.1.1",ocsp:"1.3.6.1.5.5.7.48.1",ocspBasic:"1.3.6.1.5.5.7.48.1.1",ocspNonce:"1.3.6.1.5.5.7.48.1.2",ocspNoCheck:"1.3.6.1.5.5.7.48.1.5",caIssuers:"1.3.6.1.5.5.7.48.2",anyExtendedKeyUsage:"2.5.29.37.0",serverAuth:"1.3.6.1.5.5.7.3.1",clientAuth:"1.3.6.1.5.5.7.3.2",codeSigning:"1.3.6.1.5.5.7.3.3",emailProtection:"1.3.6.1.5.5.7.3.4",timeStamping:"1.3.6.1.5.5.7.3.8",ocspSigning:"1.3.6.1.5.5.7.3.9",dateOfBirth:"1.3.6.1.5.5.7.9.1",placeOfBirth:"1.3.6.1.5.5.7.9.2",gender:"1.3.6.1.5.5.7.9.3",countryOfCitizenship:"1.3.6.1.5.5.7.9.4",countryOfResidence:"1.3.6.1.5.5.7.9.5",ecPublicKey:"1.2.840.10045.2.1","P-256":"1.2.840.10045.3.1.7",secp256r1:"1.2.840.10045.3.1.7",secp256k1:"1.3.132.0.10",secp384r1:"1.3.132.0.34",secp521r1:"1.3.132.0.35",pkcs5PBES2:"1.2.840.113549.1.5.13",pkcs5PBKDF2:"1.2.840.113549.1.5.12","des-EDE3-CBC":"1.2.840.113549.3.7",data:"1.2.840.113549.1.7.1","signed-data":"1.2.840.113549.1.7.2","enveloped-data":"1.2.840.113549.1.7.3","digested-data":"1.2.840.113549.1.7.5","encrypted-data":"1.2.840.113549.1.7.6","authenticated-data":"1.2.840.113549.1.9.16.1.2",tstinfo:"1.2.840.113549.1.9.16.1.4",signingCertificate:"1.2.840.113549.1.9.16.2.12",timeStampToken:"1.2.840.113549.1.9.16.2.14",signaturePolicyIdentifier:"1.2.840.113549.1.9.16.2.15",etsArchiveTimeStamp:"1.2.840.113549.1.9.16.2.27",signingCertificateV2:"1.2.840.113549.1.9.16.2.47",etsArchiveTimeStampV2:"1.2.840.113549.1.9.16.2.48",extensionRequest:"1.2.840.113549.1.9.14",contentType:"1.2.840.113549.1.9.3",messageDigest:"1.2.840.113549.1.9.4",signingTime:"1.2.840.113549.1.9.5",counterSignature:"1.2.840.113549.1.9.6",archiveTimeStampV3:"0.4.0.1733.2.4",pdfRevocationInfoArchival:"1.2.840.113583.1.1.8",adobeTimeStamp:"1.2.840.113583.1.1.9.1"},this.atype2oidList={CN:"2.5.4.3",L:"2.5.4.7",ST:"2.5.4.8",O:"2.5.4.10",OU:"2.5.4.11",C:"2.5.4.6",STREET:"2.5.4.9",DC:"0.9.2342.19200300.100.1.25",UID:"0.9.2342.19200300.100.1.1",SN:"2.5.4.4",T:"2.5.4.12",DN:"2.5.4.49",E:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",serialNumber:"2.5.4.5",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3"},this.objCache={},this.name2obj=function(e){if(void 0!==this.objCache[e])return this.objCache[e];if(void 0===this.name2oidList[e])throw"Name of ObjectIdentifier not defined: "+e;var r=this.name2oidList[e],n=new t({oid:r});return this.objCache[e]=n,n},this.atype2obj=function(e){if(void 0!==this.objCache[e])return this.objCache[e];var r;if(e.match(/^\d+\.\d+\.[0-9.]+$/))r=e;else if(void 0!==this.atype2oidList[e])r=this.atype2oidList[e];else{if(void 0===this.name2oidList[e])throw new Error("AttributeType name undefined: "+e);r=this.name2oidList[e]}var n=new t({oid:r});return this.objCache[e]=n,n},this.registerOIDs=function(t){if(this.checkOIDs(t))for(var e in t)this.name2oidList[e]=t[e]},this.checkOIDs=function(t){try{var e=Object.keys(t);return 0!=e.length&&(e.map((function(t,e,r){if(!this[t].match(/^[0-2]\.[0-9.]+$/))throw new Error("value is not OID")}),t),!0)}catch(t){return!1}}},ct.asn1.x509.OID.oid2name=function(t){var e=ct.asn1.x509.OID.name2oidList;for(var r in e)if(e[r]==t)return r;return""},ct.asn1.x509.OID.oid2atype=function(t){var e=ct.asn1.x509.OID.atype2oidList;for(var r in e)if(e[r]==t)return r;return t},ct.asn1.x509.OID.name2oid=function(t){if(t.match(/^[0-9.]+$/))return t;var e=ct.asn1.x509.OID.name2oidList;return void 0===e[t]?"":e[t]},ct.asn1.x509.X509Util={},ct.asn1.x509.X509Util.newCertPEM=function(t){var e=ct.asn1.x509;return e.TBSCertificate,new(0,e.Certificate)(t).getPEM()},void 0!==ct&&ct||(ct={}),void 0!==ct.asn1&&ct.asn1||(ct.asn1={}),void 0!==ct.asn1.cms&&ct.asn1.cms||(ct.asn1.cms={}),ct.asn1.cms.Attribute=function(t){var e=Error,r=ct.asn1,n=r.DERSequence,i=r.DERSet,s=r.DERObjectIdentifier;this.params=null,this.typeOid=null,this.setByParam=function(t){this.params=t},this.getValueArray=function(){throw new e("not yet implemented abstract")},this.tohex=function(){var t=new s({oid:this.typeOid}),e=new i({array:this.getValueArray()});return new n({array:[t,e]}).tohex()},this.getEncodedHex=function(){return this.tohex()}},Kt(ct.asn1.cms.Attribute,ct.asn1.ASN1Object),ct.asn1.cms.ContentType=function(t){var e=ct.asn1;e.cms.ContentType.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.3",this.getValueArray=function(){return[new e.DERObjectIdentifier(this.params.type)]},null!=t&&this.setByParam(t)},Kt(ct.asn1.cms.ContentType,ct.asn1.cms.Attribute),ct.asn1.cms.MessageDigest=function(t){var e=ct.asn1,r=e.DEROctetString;e.cms.MessageDigest.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.4",this.getValueArray=function(){return[new r(this.params)]},null!=t&&this.setByParam(t)},Kt(ct.asn1.cms.MessageDigest,ct.asn1.cms.Attribute),ct.asn1.cms.SigningTime=function(t){var e=ct.asn1;e.cms.SigningTime.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.5",this.getValueArray=function(){return[new e.x509.Time(this.params)]},null!=t&&this.setByParam(t)},Kt(ct.asn1.cms.SigningTime,ct.asn1.cms.Attribute),ct.asn1.cms.SigningCertificate=function(t){var e=Error,r=ct,n=r.asn1,i=n.DERSequence,s=n.cms,a=s.ESSCertID;r.crypto,s.SigningCertificate.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.12",this.getValueArray=function(){if(null==this.params||null==this.params||null==this.params.array)throw new e("parameter 'array' not specified");for(var r=this.params.array,n=[],s=0;s<r.length;s++){var o=r[s];0!=t.hasis||"string"!=typeof o||-1==o.indexOf("-----BEGIN")&&!ft.isASN1HEX(o)||(o={cert:o}),0!=o.hasis&&0==t.hasis&&(o.hasis=!1),n.push(new a(o))}var u=new i({array:n});return[new i({array:[u]})]},null!=t&&this.setByParam(t)},Kt(ct.asn1.cms.SigningCertificate,ct.asn1.cms.Attribute),ct.asn1.cms.ESSCertID=function(t){ct.asn1.cms.ESSCertID.superclass.constructor.call(this);var e=Error,r=ct,n=r.asn1,i=n.DEROctetString,s=n.DERSequence,a=n.cms.IssuerSerial;this.params=null,this.getCertHash=function(t,n){if(null!=t.hash)return t.hash;if("string"==typeof t&&-1==t.indexOf("-----BEGIN")&&!ft.isASN1HEX(t))return t;var i,s,a;if("string"==typeof t)i=t;else{if(null==t.cert)throw new e("hash nor cert unspecified");i=t.cert}if(s=-1!=i.indexOf("-----BEGIN")?Bt(i):i,"string"==typeof t&&(-1!=t.indexOf("-----BEGIN")?s=Bt(t):ft.isASN1HEX(t)&&(s=t)),null!=t.alg)a=t.alg;else{if(null==n)throw new e("hash alg unspecified");a=n}return r.crypto.Util.hashHex(s,a)},this.tohex=function(){var t=this.params,e=this.getCertHash(t,"sha1"),r=[];return r.push(new i({hex:e})),("string"==typeof t&&-1!=t.indexOf("-----BEGIN")||null!=t.cert&&0!=t.hasis||null!=t.issuer&&null!=t.serial)&&r.push(new a(t)),new s({array:r}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Kt(ct.asn1.cms.ESSCertID,ct.asn1.ASN1Object),ct.asn1.cms.SigningCertificateV2=function(t){var e=Error,r=ct,n=r.asn1,i=n.DERSequence,s=(n.x509,n.cms),a=s.ESSCertIDv2;r.crypto,s.SigningCertificateV2.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.47",this.getValueArray=function(){if(null==this.params||null==this.params||null==this.params.array)throw new e("parameter 'array' not specified");for(var r=this.params.array,n=[],s=0;s<r.length;s++){var o=r[s];null==t.alg&&0!=t.hasis||"string"!=typeof o||-1==o.indexOf("-----BEGIN")&&!ft.isASN1HEX(o)||(o={cert:o}),null==o.alg&&null!=t.alg&&(o.alg=t.alg),0!=o.hasis&&0==t.hasis&&(o.hasis=!1),n.push(new a(o))}var u=new i({array:n});return[new i({array:[u]})]},null!=t&&this.setByParam(t)},Kt(ct.asn1.cms.SigningCertificateV2,ct.asn1.cms.Attribute),ct.asn1.cms.ESSCertIDv2=function(t){ct.asn1.cms.ESSCertIDv2.superclass.constructor.call(this),Error;var e=ct.asn1,r=e.DEROctetString,n=e.DERSequence,i=e.cms.IssuerSerial,s=e.x509.AlgorithmIdentifier;this.params=null,this.tohex=function(){var t=this.params,e=this.getCertHash(t,"sha256"),a=[];return null!=t.alg&&"sha256"!=t.alg&&a.push(new s({name:t.alg})),a.push(new r({hex:e})),("string"==typeof t&&-1!=t.indexOf("-----BEGIN")||null!=t.cert&&0!=t.hasis||null!=t.issuer&&null!=t.serial)&&a.push(new i(t)),new n({array:a}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Kt(ct.asn1.cms.ESSCertIDv2,ct.asn1.cms.ESSCertID),ct.asn1.cms.IssuerSerial=function(t){var e=Error,r=ct.asn1,n=r.DERInteger,i=r.DERSequence,s=r.cms,a=r.x509.GeneralNames,o=Wt;s.IssuerSerial.superclass.constructor.call(this),this.setByParam=function(t){this.params=t},this.tohex=function(){var t,r,s=this.params;if("string"==typeof s&&-1!=s.indexOf("-----BEGIN")||null!=s.cert){var u;u=null!=s.cert?s.cert:s;var c=new o;c.readCertPEM(u),t=c.getIssuer(),r={hex:c.getSerialNumberHex()}}else{if(null==s.issuer||!s.serial)throw new e("cert or issuer and serial parameter not specified");t=s.issuer,r=s.serial}var h=new a([{dn:t}]),l=new n(r);return new i({array:[h,l]}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Kt(ct.asn1.cms.IssuerSerial,ct.asn1.ASN1Object),ct.asn1.cms.SignerIdentifier=function(t){var e=ct.asn1,r=(e.DERInteger,e.DERSequence,e.cms),n=r.IssuerAndSerialNumber,i=r.SubjectKeyIdentifier;e.x509.X500Name,Error,r.SignerIdentifier.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params;if("isssn"==t.type)return new n(t).tohex();if("skid"==t.type)return new i(t).tohex();throw new Error("wrong property for isssn or skid")},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Kt(ct.asn1.cms.SignerIdentifier,ct.asn1.ASN1Object),ct.asn1.cms.IssuerAndSerialNumber=function(t){var e=ct.asn1,r=e.DERInteger,n=e.DERSequence,i=e.cms,s=e.x509.X500Name,a=Wt,o=Error;i.IssuerAndSerialNumber.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t,e,i=this.params;if("string"==typeof i&&-1!=i.indexOf("-----BEGIN")||null!=i.cert){var u;u=null!=i.cert?i.cert:i;var c=new a;c.readCertPEM(u),t=c.getIssuer(),e={hex:c.getSerialNumberHex()}}else{if(null==i.issuer||!i.serial)throw new o("cert or issuer and serial parameter not specified");t=i.issuer,e=i.serial}var h=new s(t),l=new r(e);return new n({array:[h,l]}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(t){this.params=t},null!=t&&this.setByParam(t)},Kt(ct.asn1.cms.IssuerAndSerialNumber,ct.asn1.ASN1Object),ct.asn1.cms.SubjectKeyIdentifier=function(t){var e=ct.asn1,r=(e.DERInteger,e.DERSequence,e.ASN1Util.newObject),n=e.cms,i=(n.IssuerAndSerialName,n.SubjectKeyIdentifier,e.x509.X500Name,Wt),s=Error;n.SubjectKeyIdentifier.superclass.constructor.call(this),this.tohex=function(){var t,e=this.params;if(null==e.cert&&null==e.skid)throw new s("property cert nor skid undefined");return null!=e.cert?t=new i(e.cert).getExtSubjectKeyIdentifier().kid.hex:null!=e.skid&&(t=e.skid),r({tag:{tage:"a0",obj:{octstr:{hex:t}}}}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Kt(ct.asn1.cms.SubjectKeyIdentifier,ct.asn1.ASN1Object),ct.asn1.cms.AttributeList=function(t){var e=Error,r=ct.asn1,n=r.DERSet,i=r.cms;i.AttributeList.superclass.constructor.call(this),this.params=null,this.hTLV=null,this.setByParam=function(t){this.params=t},this.tohex=function(){var t=this.params;if(null!=this.hTLV)return this.hTLV;var r=!0;null!=t.sortflag&&(r=t.sortflag);for(var s=t.array,a=[],o=0;o<s.length;o++){var u=s[o],c=u.attr;if("contentType"==c)a.push(new i.ContentType(u));else if("messageDigest"==c)a.push(new i.MessageDigest(u));else if("signingTime"==c)a.push(new i.SigningTime(u));else if("signingCertificate"==c)a.push(new i.SigningCertificate(u));else if("signingCertificateV2"==c)a.push(new i.SigningCertificateV2(u));else if("signaturePolicyIdentifier"==c)a.push(new ct.asn1.cades.SignaturePolicyIdentifier(u));else{if("signatureTimeStamp"!=c&&"timeStampToken"!=c)throw new e("unknown attr: "+c);a.push(new ct.asn1.cades.SignatureTimeStamp(u))}}var h=new n({array:a,sortflag:r});return this.hTLV=h.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Kt(ct.asn1.cms.AttributeList,ct.asn1.ASN1Object),ct.asn1.cms.SignerInfo=function(t){var e=Error,r=ct,n=r.asn1,i=n.DERInteger,s=n.DEROctetString,a=n.DERSequence,o=n.DERTaggedObject,u=n.cms,c=u.SignerIdentifier,h=u.AttributeList,l=(u.ContentType,u.EncapsulatedContentInfo,u.MessageDigest,u.SignedData,n.x509.AlgorithmIdentifier),f=r.crypto,p=qt;u.SignerInfo.superclass.constructor.call(this),this.params=null,this.sign=function(){var t=this.params,e=t.sigalg,r=new h(t.sattrs).tohex(),n=p.getKey(t.signkey),i=new f.Signature({alg:e});i.init(n),i.updateHex(r);var s=i.sign();t.sighex=s},this.tohex=function(){var t=this.params,r=[];if(r.push(new i({int:t.version})),r.push(new c(t.id)),r.push(new l({name:t.hashalg})),null!=t.sattrs){var n=new h(t.sattrs);try{r.push(new o({tag:"a0",explicit:!1,obj:n}))}catch(t){throw new e("si sattr error: "+t)}}if(null!=t.sigalgfield?r.push(new l({name:t.sigalgfield})):r.push(new l({name:t.sigalg})),null==t.sighex&&null!=t.signkey&&this.sign(),r.push(new s({hex:t.sighex})),null!=t.uattrs){n=new h(t.uattrs);try{r.push(new o({tag:"a1",explicit:!1,obj:n}))}catch(t){throw new e("si uattr error: "+t)}}return new a({array:r}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Kt(ct.asn1.cms.SignerInfo,ct.asn1.ASN1Object),ct.asn1.cms.EncapsulatedContentInfo=function(t){var e=ct.asn1,r=e.DERTaggedObject,n=e.DERSequence,i=e.DERObjectIdentifier,s=e.DEROctetString;e.cms.EncapsulatedContentInfo.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params,e=[];if(e.push(new i(t.type)),null!=t.content&&(null!=t.content.hex||null!=t.content.str)&&1!=t.isDetached){var a=new s(t.content),o=new r({tag:"a0",explicit:!0,obj:a});e.push(o)}return new n({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(t){this.params=t},null!=t&&this.setByParam(t)},Kt(ct.asn1.cms.EncapsulatedContentInfo,ct.asn1.ASN1Object),ct.asn1.cms.ContentInfo=function(t){var e=ct.asn1,r=e.DERTaggedObject,n=e.DERSequence,i=e.DERObjectIdentifier;e.x509.OID.name2obj,ct.asn1.cms.ContentInfo.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params,e=[];e.push(new i(t.type));var s=new r({tag:"a0",explicit:!0,obj:t.obj});return e.push(s),new n({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(t){this.params=t},null!=t&&this.setByParam(t)},Kt(ct.asn1.cms.ContentInfo,ct.asn1.ASN1Object),ct.asn1.cms.SignedData=function(t){Error;var e=ct.asn1,r=(e.ASN1Object,e.DERInteger),n=e.DERSet,i=e.DERSequence,s=(e.DERTaggedObject,e.cms),a=s.EncapsulatedContentInfo,o=s.SignerInfo,u=s.ContentInfo,c=s.CertificateSet,h=s.RevocationInfoChoices,l=e.x509.AlgorithmIdentifier;ct.asn1.cms.SignedData.superclass.constructor.call(this),this.params=null,this.checkAndFixParam=function(){var t=this.params;this._setDigestAlgs(t),this._setContentTypeByEContent(t),this._setMessageDigestByEContent(t),this._setSignerInfoVersion(t),this._setSignedDataVersion(t)},this._setDigestAlgs=function(t){for(var e={},r=t.sinfos,n=0;n<r.length;n++)e[r[n].hashalg]=1;t.hashalgs=Object.keys(e).sort()},this._setContentTypeByEContent=function(t){for(var e=t.econtent.type,r=t.sinfos,n=0;n<r.length;n++){var i=r[n];this._getAttrParamByName(i,"contentType").type=e}},this._setMessageDigestByEContent=function(t){var e=t.econtent,r=(t.econtent.type,e.content.hex);null==r&&"data"==e.type&&null!=e.content.str&&(r=St(e.content.str));for(var n=t.sinfos,i=0;i<n.length;i++){var s=n[i],a=s.hashalg,o=this._getAttrParamByName(s,"messageDigest"),u=ct.crypto.Util.hashHex(r,a);o.hex=u}},this._getAttrParamByName=function(t,e){for(var r=t.sattrs.array,n=0;n<r.length;n++)if(r[n].attr==e)return r[n]},this._setSignerInfoVersion=function(t){for(var e=t.sinfos,r=0;r<e.length;r++){var n=e[r],i=1;"skid"==n.id.type&&(i=3),n.version=i}},this._setSignedDataVersion=function(t){var e=this._getSignedDataVersion(t);t.version=e},this._getSignedDataVersion=function(t){if(null!=t.revinfos)for(var e=t.revinfos,r=0;r<e.length;r++)if(null!=e[r].ocsp)return 5;var n=t.sinfos;for(r=0;r<n.length;r++)if(3==t.sinfos[r].version)return 3;return"data"!=t.econtent.type?3:1},this.tohex=function(){var t=this.params;null!=this.getEncodedHexPrepare&&this.getEncodedHexPrepare(),1!=t.fixed&&this.checkAndFixParam();var e=[];e.push(new r({int:t.version}));for(var s=[],u=0;u<t.hashalgs.length;u++){var f=t.hashalgs[u];s.push(new l({name:f}))}e.push(new n({array:s})),e.push(new a(t.econtent)),null!=t.certs&&e.push(new c(t.certs)),null!=t.revinfos&&e.push(new h(t.revinfos));var p=[];for(u=0;u<t.sinfos.length;u++){var g=t.sinfos[u];p.push(new o(g))}return e.push(new n({array:p})),new i({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.getContentInfo=function(){return new u({type:"signed-data",obj:this})},this.getContentInfoEncodedHex=function(){return this.getContentInfo().tohex()},null!=t&&this.setByParam(t)},Kt(ct.asn1.cms.SignedData,ct.asn1.ASN1Object),ct.asn1.cms.CertificateSet=function(t){ct.asn1.cms.CertificateSet.superclass.constructor.call(this);var e=Error,r=ct.asn1,n=r.DERTaggedObject,i=r.DERSet,s=r.ASN1Object;this.params=null,this.tohex=function(){var t,r=this.params,a=[];if(r instanceof Array)t=r;else{if(null==r.array)throw new e("cert array not specified");t=r.array}for(var o=0;o<t.length;o++){var u=Bt(t[o]),c=new s;c.hTLV=u,a.push(c)}var h={array:a};0==r.sortflag&&(h.sortflag=!1);var l=new i(h);return new n({tag:"a0",explicit:!1,obj:l}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Kt(ct.asn1.cms.CertificateSet,ct.asn1.ASN1Object),ct.asn1.cms.RevocationInfoChoices=function(t){ct.asn1.cms.RevocationInfoChoices.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params;if(!t instanceof Array)throw new Error("params is not array");for(var e=[],r=0;r<t.length;r++)e.push(new ct.asn1.cms.RevocationInfoChoice(t[r]));return ct.asn1.ASN1Util.newObject({tag:{tagi:"a1",obj:{set:e}}}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Kt(ct.asn1.cms.RevocationInfoChoices,ct.asn1.ASN1Object),ct.asn1.cms.RevocationInfoChoice=function(t){ct.asn1.cms.RevocationInfoChoice.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params;if(null!=t.crl&&"string"==typeof t.crl){var e=t.crl;return-1!=t.crl.indexOf("-----BEGIN")&&(e=Bt(t.crl)),e}if(null!=t.ocsp)return ct.asn1.ASN1Util.newObject({tag:{tagi:"a1",obj:new ct.asn1.cms.OtherRevocationFormat(t)}}).tohex();throw new Error("property crl or ocsp undefined")},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Kt(ct.asn1.cms.RevocationInfoChoice,ct.asn1.ASN1Object),ct.asn1.cms.OtherRevocationFormat=function(t){ct.asn1.cms.OtherRevocationFormat.superclass.constructor.call(this);var e=Error,r=ct,n=r.asn1.ASN1Util.newObject,i=r.lang.String.isHex;this.params=null,this.tohex=function(){var t=this.params;if(null==t.ocsp)throw new e("property ocsp not specified");if(!i(t.ocsp)||!ft.isASN1HEX(t.ocsp))throw new e("ocsp value not ASN.1 hex string");return n({seq:[{oid:"1.3.6.1.5.5.7.16.2"},{asn1:{tlv:t.ocsp}}]}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Kt(ct.asn1.cms.OtherRevocationFormat,ct.asn1.ASN1Object),ct.asn1.cms.CMSUtil=new function(){},ct.asn1.cms.CMSUtil.newSignedData=function(t){return new ct.asn1.cms.SignedData(t)},ct.asn1.cms.CMSUtil.verifySignedData=function(t){var e=ct,r=e.asn1,n=r.cms,i=(n.SignerInfo,n.SignedData,n.SigningTime,n.SigningCertificate,n.SigningCertificateV2,r.cades.SignaturePolicyIdentifier,e.lang.String.isHex),s=ft,a=s.getVbyList,o=s.getTLVbyList,u=s.getIdxbyList,c=s.getChildIdx,h=s.getTLV,l=s.oidname,f=e.crypto.Util.hashHex;void 0===t.cms&&i(t.cms);var p=t.cms,g=function(t,e){var r=e.idx;e.signerid_issuer1=o(t,r,[1,0],"30"),e.signerid_serial1=a(t,r,[1,1],"02"),e.hashalg=l(a(t,r,[2,0],"06"));var n=u(t,r,[3],"a0");e.idxSignedAttrs=n,d(t,e,n);var i=c(t,r).length;if(i<6)throw"malformed SignerInfo";e.sigalg=l(a(t,r,[i-2,0],"06")),e.sigval=a(t,r,[i-1],"04")},d=function(t,e,r){var n=c(t,r);e.signedAttrIdxList=n;for(var i=0;i<n.length;i++){var s,o=n[i],u=a(t,o,[0],"06");"2a864886f70d010905"===u?(s=wt(a(t,o,[1,0])),e.saSigningTime=s):"2a864886f70d010904"===u&&(s=a(t,o,[1,0],"04"),e.saMessageDigest=s)}},m=function(t,e,r,n){r.verifyDetail={};var i=r.verifyDetail,s=e.parse.econtent,a=r.hashalg,o=r.saMessageDigest;i.validMessageDigest=!1,f(s,a)===o&&(i.validMessageDigest=!0),function(t,e,r,n){var i,s=e.parse.certsIdx;if(void 0===e.certs){i=[],e.certkeys=[];for(var a=c(t,s),o=0;o<a.length;o++){var u=h(t,a[o]),l=new Wt;l.readCertHex(u),i[o]=l,e.certkeys[o]=l.getPublicKey()}e.certs=i}else i=e.certs;for(e.cccc=i.length,e.cccci=a.length,o=0;o<i.length;o++){var f=l.getIssuerHex(),p=l.getSerialNumberHex();r.signerid_issuer1===f&&r.signerid_serial1===p&&(r.certkey_idx=o)}}(t,e,r),i.validSignatureValue=!1;var u=r.sigalg,l="31"+h(t,r.idxSignedAttrs).substr(2);r.signedattrshex=l;var p=e.certs[r.certkey_idx].getPublicKey(),g=new ct.crypto.Signature({alg:u});g.init(p),g.updateHex(l);var d=g.verify(r.sigval);i.validSignatureValue_isValid=d,!0===d&&(i.validSignatureValue=!0),r.isValid=!1,i.validMessageDigest&&i.validSignatureValue&&(r.isValid=!0)},v={isValid:!1,parse:{}};return function(t,e){if("2a864886f70d010702"!==a(t,0,[0],"06"))return e;e.cmsType="signedData",e.econtent=a(t,0,[1,0,2,1,0]),function(t,e){for(var r,n=3;n<6;n++)if(void 0!==(r=u(t,0,[1,0,n]))){var i=t.substr(r,2);"a0"===i&&(e.certsIdx=r),"a1"===i&&(e.revinfosIdx=r),"31"===i&&(e.signerinfosIdx=r)}}(t,e),e.signerInfos=[],function(t,e){var r=e.signerinfosIdx;if(void 0!==r){var n=c(t,r);e.signerInfoIdxList=n;for(var i=0;i<n.length;i++){var s={idx:n[i]};g(t,s),e.signerInfos.push(s)}}}(t,e)}(p,v.parse),function(t,e){for(var r=e.parse.signerInfos,n=r.length,i=!0,s=0;s<n;s++){var a=r[s];m(t,e,a),a.isValid||(i=!1)}e.isValid=i}(p,v),v},ct.asn1.cms.CMSParser=function(){var t=Error,e=Wt,r=new e,n=ft,i=n.getV,s=n.getTLV,a=(n.getIdxbyList,n.getTLVbyList),o=n.getTLVbyListEx,u=n.getVbyList,c=n.getVbyListEx,h=n.getChildIdx;this.getCMSSignedData=function(t){var e=a(t,0,[1,0]);return this.getSignedData(e)},this.getSignedData=function(t){var e=h(t,0),r={},n=i(t,e[0]),a=parseInt(n,16);r.version=a;var u=s(t,e[1]);r.hashalgs=this.getHashAlgArray(u);var c=s(t,e[2]);r.econtent=this.getEContent(c);var l=o(t,0,["[0]"]);null!=l&&(r.certs=this.getCertificateSet(l)),o(t,0,["[1]"]);var f=o(t,0,[3]);return r.sinfos=this.getSignerInfos(f),r},this.getHashAlgArray=function(t){for(var r=h(t,0),n=new e,i=[],a=0;a<r.length;a++){var o=s(t,r[a]),u=n.getAlgorithmIdentifierName(o);i.push(u)}return i},this.getEContent=function(t){var e={},r=u(t,0,[0]),n=u(t,0,[1,0]);return e.type=ct.asn1.x509.OID.oid2name(ft.hextooidstr(r)),e.content={hex:n},e},this.getSignerInfos=function(t){for(var e=[],r=h(t,0),n=0;n<r.length;n++){var i=s(t,r[n]),a=this.getSignerInfo(i);e.push(a)}return e},this.getSignerInfo=function(t){var e={},i=h(t,0),a=n.getInt(t,i[0],-1);-1!=a&&(e.version=a);var u=s(t,i[1]),l=this.getIssuerAndSerialNumber(u);e.id=l;var f=s(t,i[2]),p=r.getAlgorithmIdentifierName(f);e.hashalg=p;var g=o(t,0,["[0]"]);if(null!=g){var d=this.getAttributeList(g);e.sattrs=d}var m=o(t,0,[3]),v=r.getAlgorithmIdentifierName(m);e.sigalg=v;var y=c(t,0,[4]);e.sighex=y;var x=o(t,0,["[1]"]);if(null!=x){var w=this.getAttributeList(x);e.uattrs=w}return e},this.getSignerIdentifier=function(t){if("30"==t.substr(0,2))return this.getIssuerAndSerialNumber(t);throw new Error("SKID of signerIdentifier not supported")},this.getIssuerAndSerialNumber=function(t){var e={type:"isssn"},n=h(t,0),a=s(t,n[0]);e.issuer=r.getX500Name(a);var o=i(t,n[1]);return e.serial={hex:o},e},this.getAttributeList=function(t){for(var e=[],r=h(t,0),n=0;n<r.length;n++){var i=s(t,r[n]),a=this.getAttribute(i);e.push(a)}return{array:e}},this.getAttribute=function(t){var e={},r=h(t,0),i=n.getOID(t,r[0]),a=ct.asn1.x509.OID.oid2name(i);e.attr=a;var o=s(t,r[1]),u=h(o,0);if(1==u.length)e.valhex=s(o,u[0]);else{for(var c=[],l=0;l<u.length;l++)c.push(s(o,u[l]));e.valhex=c}return"contentType"==a?this.setContentType(e):"messageDigest"==a?this.setMessageDigest(e):"signingTime"==a?this.setSigningTime(e):"signingCertificate"==a?this.setSigningCertificate(e):"signingCertificateV2"==a?this.setSigningCertificateV2(e):"signaturePolicyIdentifier"==a&&this.setSignaturePolicyIdentifier(e),e},this.setContentType=function(t){var e=n.getOIDName(t.valhex,0,null);null!=e&&(t.type=e,delete t.valhex)},this.setSigningTime=function(t){var e=wt(i(t.valhex,0));t.str=e,delete t.valhex},this.setMessageDigest=function(t){var e=i(t.valhex,0);t.hex=e,delete t.valhex},this.setSigningCertificate=function(t){var e=h(t.valhex,0);if(e.length>0){for(var r=s(t.valhex,e[0]),n=h(r,0),i=[],a=0;a<n.length;a++){var o=s(r,n[a]),u=this.getESSCertID(o);i.push(u)}t.array=i}if(e.length>1){var c=s(t.valhex,e[1]);t.polhex=c}delete t.valhex},this.setSignaturePolicyIdentifier=function(t){var r=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;a<n.length;a++){var o=s(r,n[a]),u=this.getESSCertIDv2(o);i.push(u)}t.array=i}if(e.length>1){var c=s(t.valhex,e[1]);t.polhex=c}delete t.valhex},this.getESSCertID=function(t){var e={},r=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||3<a.length)throw new t("wrong number of elements");var o=0;if("30"==e.substr(a[0],2)){var u=s(e,a[0]);n.alg=r.getAlgorithmIdentifierName(u),o++}else n.alg="sha256";var c=i(e,a[o]);if(n.hash=c,a.length>o+1){var 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<e.length;n++){var i=s(t,e[n]);if("30"==i.substr(0,2)){var a=At(i,"CERTIFICATE");r.push(a)}}return{array:r,sortflag:!1}}},void 0!==ct&&ct||(ct={}),void 0!==ct.asn1&&ct.asn1||(ct.asn1={}),void 0!==ct.asn1.tsp&&ct.asn1.tsp||(ct.asn1.tsp={}),ct.asn1.tsp.TimeStampToken=function(t){var e=ct.asn1.tsp;e.TimeStampToken.superclass.constructor.call(this),this.params=null,this.getEncodedHexPrepare=function(){var t=new e.TSTInfo(this.params.econtent.content);this.params.econtent.content.hex=t.tohex()},null!=t&&this.setByParam(t)},Kt(ct.asn1.tsp.TimeStampToken,ct.asn1.cms.SignedData),ct.asn1.tsp.TSTInfo=function(t){Error;var e=ct.asn1,r=e.DERSequence,n=e.DERInteger,i=e.DERBoolean,s=e.DERGeneralizedTime,a=e.DERObjectIdentifier,o=e.DERTaggedObject,u=e.tsp,c=u.MessageImprint,h=u.Accuracy,l=(e.x509.X500Name,e.x509.GeneralName);if(u.TSTInfo.superclass.constructor.call(this),this.dVersion=new n({int:1}),this.dPolicy=null,this.dMessageImprint=null,this.dSerial=null,this.dGenTime=null,this.dAccuracy=null,this.dOrdering=null,this.dNonce=null,this.dTsa=null,this.tohex=function(){var t=[this.dVersion];if(null==this.dPolicy)throw new Error("policy shall be specified.");if(t.push(this.dPolicy),null==this.dMessageImprint)throw new Error("messageImprint shall be specified.");if(t.push(this.dMessageImprint),null==this.dSerial)throw new Error("serialNumber shall be specified.");if(t.push(this.dSerial),null==this.dGenTime)throw new Error("genTime shall be specified.");t.push(this.dGenTime),null!=this.dAccuracy&&t.push(this.dAccuracy),null!=this.dOrdering&&t.push(this.dOrdering),null!=this.dNonce&&t.push(this.dNonce),null!=this.dTsa&&t.push(this.dTsa);var e=new r({array:t});return this.hTLV=e.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==t){if("string"==typeof t.policy){if(!t.policy.match(/^[0-9.]+$/))throw"policy shall be oid like 0.1.4.134";this.dPolicy=new a({oid:t.policy})}void 0!==t.messageImprint&&(this.dMessageImprint=new c(t.messageImprint)),void 0!==t.serial&&(this.dSerial=new n(t.serial)),void 0!==t.genTime&&(this.dGenTime=new s(t.genTime)),void 0!==t.accuracy&&(this.dAccuracy=new h(t.accuracy)),void 0!==t.ordering&&1==t.ordering&&(this.dOrdering=new i),void 0!==t.nonce&&(this.dNonce=new n(t.nonce)),void 0!==t.tsa&&(this.dTsa=new o({tag:"a0",explicit:!0,obj:new l({dn:t.tsa})}))}},Kt(ct.asn1.tsp.TSTInfo,ct.asn1.ASN1Object),ct.asn1.tsp.Accuracy=function(t){var e=ct.asn1,r=e.ASN1Util.newObject;e.tsp.Accuracy.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params,e=[];return null!=t.seconds&&"number"==typeof t.seconds&&e.push({int:t.seconds}),null!=t.millis&&"number"==typeof t.millis&&e.push({tag:{tagi:"80",obj:{int:t.millis}}}),null!=t.micros&&"number"==typeof t.micros&&e.push({tag:{tagi:"81",obj:{int:t.micros}}}),r({seq:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Kt(ct.asn1.tsp.Accuracy,ct.asn1.ASN1Object),ct.asn1.tsp.MessageImprint=function(t){var e=ct.asn1,r=e.DERSequence,n=e.DEROctetString,i=e.x509.AlgorithmIdentifier;e.tsp.MessageImprint.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params,e=new i({name:t.alg}),s=new n({hex:t.hash});return new r({array:[e,s]}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},Kt(ct.asn1.tsp.MessageImprint,ct.asn1.ASN1Object),ct.asn1.tsp.TimeStampReq=function(t){var e=ct.asn1,r=e.DERSequence,n=e.DERInteger,i=e.DERBoolean,s=(e.ASN1Object,e.DERObjectIdentifier),a=e.tsp,o=a.MessageImprint;a.TimeStampReq.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params,e=[];return e.push(new n({int:1})),t.messageImprint instanceof ct.asn1.ASN1Object?e.push(t.messageImprint):e.push(new o(t.messageImprint)),null!=t.policy&&e.push(new s(t.policy)),null!=t.nonce&&e.push(new n(t.nonce)),1==t.certreq&&e.push(new i),new r({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Kt(ct.asn1.tsp.TimeStampReq,ct.asn1.ASN1Object),ct.asn1.tsp.TimeStampResp=function(t){var e=ct.asn1,r=e.DERSequence,n=(e.ASN1Object,e.tsp),i=n.PKIStatusInfo;n.TimeStampResp.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params,s=[];if(null!=t.econtent||null!=t.tst)if(null!=t.statusinfo?s.push(new i(t.statusinfo)):s.push(new i("granted")),null!=t.econtent)s.push(new n.TimeStampToken(t).getContentInfo());else{if(!(t.tst instanceof e.ASN1Object))throw new Error("improper member tst value");s.push(t.tst)}else{if(null==t.statusinfo)throw new Error("parameter for token nor statusinfo not specified");s.push(new i(t.statusinfo))}return new r({array:s}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Kt(ct.asn1.tsp.TimeStampResp,ct.asn1.ASN1Object),ct.asn1.tsp.PKIStatusInfo=function(t){var e=Error,r=ct.asn1,n=r.DERSequence,i=r.tsp,s=i.PKIStatus,a=i.PKIFreeText,o=i.PKIFailureInfo;i.PKIStatusInfo.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params,r=[];if("string"==typeof t)r.push(new s(t));else{if(null==t.status)throw new e("property 'status' unspecified");r.push(new s(t.status)),null!=t.statusstr&&r.push(new a(t.statusstr)),null!=t.failinfo&&r.push(new o(t.failinfo))}return new n({array:r}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Kt(ct.asn1.tsp.PKIStatusInfo,ct.asn1.ASN1Object),ct.asn1.tsp.PKIStatus=function(t){var e=Error,r=ct.asn1,n=r.DERInteger;r.tsp.PKIStatus.superclass.constructor.call(this);var i={granted:0,grantedWithMods:1,rejection:2,waiting:3,revocationWarning:4,revocationNotification:5};this.params=null,this.tohex=function(){var t,r=this.params;if("string"==typeof r)try{t=i[r]}catch(t){throw new e("undefined name: "+r)}else{if("number"!=typeof r)throw new e("unsupported params");t=r}return new n({int:t}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Kt(ct.asn1.tsp.PKIStatus,ct.asn1.ASN1Object),ct.asn1.tsp.PKIFreeText=function(t){var e=Error,r=ct.asn1,n=r.DERSequence,i=r.DERUTF8String;r.tsp.PKIFreeText.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params;if(!t instanceof Array)throw new e("wrong params: not array");for(var r=[],s=0;s<t.length;s++)r.push(new i({str:t[s]}));return new n({array:r}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Kt(ct.asn1.tsp.PKIFreeText,ct.asn1.ASN1Object),ct.asn1.tsp.PKIFailureInfo=function(t){var e=Error,r=ct.asn1,n=r.DERBitString,i=r.tsp.PKIFailureInfo,s={badAlg:0,badRequest:2,badDataFormat:5,timeNotAvailable:14,unacceptedPolicy:15,unacceptedExtension:16,addInfoNotAvailable:17,systemFailure:25};i.superclass.constructor.call(this),this.params=null,this.getBinValue=function(){var t=this.params,r=0;if("number"==typeof t&&0<=t&&t<=25){for(var n=(r|=1<<t).toString(2),i="",a=n.length-1;a>=0;a--)i+=n[a];return i}if("string"==typeof t&&null!=s[t])return Mt([t],s);if("object"==typeof t&&null!=t.length)return Mt(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)},Kt(ct.asn1.tsp.PKIFailureInfo,ct.asn1.ASN1Object),ct.asn1.tsp.AbstractTSAAdapter=function(t){this.getTSTHex=function(t,e){throw"not implemented yet"}},ct.asn1.tsp.SimpleTSAAdapter=function(t){var e=ct,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)},Kt(ct.asn1.tsp.SimpleTSAAdapter,ct.asn1.tsp.AbstractTSAAdapter),ct.asn1.tsp.FixedTSAAdapter=function(t){var e=ct,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)},Kt(ct.asn1.tsp.FixedTSAAdapter,ct.asn1.tsp.AbstractTSAAdapter),ct.asn1.tsp.TSPUtil=new function(){},ct.asn1.tsp.TSPUtil.newTimeStampToken=function(t){return new ct.asn1.tsp.TimeStampToken(t)},ct.asn1.tsp.TSPUtil.parseTimeStampReq=function(t){return(new ct.asn1.tsp.TSPParser).getTimeStampReq(t)},ct.asn1.tsp.TSPUtil.parseMessageImprint=function(t){return(new ct.asn1.tsp.TSPParser).getMessageImprint(t)},ct.asn1.tsp.TSPParser=function(){Error;var t=new Wt,e=ft,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 ct.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=_t(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:wt(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;i<n.length;i++){var a=t.substr(n[i],2),o=r(t,n[i]),u=parseInt(o,16);"02"==a?e.seconds=u:"80"==a?e.millis=u:"81"==a&&(e.micros=u)}return e},this.getMessageImprint=function(t){if("30"!=t.substr(0,2))throw new Error("head of messageImprint hex shall be x30");var n={},a=(s(t,0),i(t,0,[0,0])),o=r(t,a),u=e.hextooidstr(o),c=ct.asn1.x509.OID.oid2name(u);if(""==c)throw new Error("hashAlg name undefined: "+u);var h=c,l=i(t,0,[1]);return n.alg=h,n.hash=r(t,l),n},this.getPKIStatusInfo=function(t){var e={},i=s(t,0),o=0;try{var u=r(t,i[0]),c=parseInt(u,16);e.status=a[c]}catch(t){}if(i.length>1&&"30"==t.substr(i[1],2)){var 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<n.length;i++)r.push(e.getString(t,n[i]));return r},this.getPKIFailureInfo=function(t){var r=e.getInt(t,0);return null!=o[r]?o[r]:r},this.getTimeStampReq=function(t){var i={certreq:!1},a=s(t,0);if(a.length<2)throw new Error("TimeStampReq must have at least 2 items");var o=n(t,a[1]);i.messageImprint=ct.asn1.tsp.TSPUtil.parseMessageImprint(o);for(var u=2;u<a.length;u++){var c=a[u],h=t.substr(c,2);if("06"==h){var l=r(t,c);i.policy=e.hextooidstr(l)}"02"==h&&(i.nonce=r(t,c)),"01"==h&&(i.certreq=!0)}return i}},void 0!==ct&&ct||(ct={}),void 0!==ct.asn1&&ct.asn1||(ct.asn1={}),void 0!==ct.asn1.cades&&ct.asn1.cades||(ct.asn1.cades={}),ct.asn1.cades.SignaturePolicyIdentifier=function(t){var e=ct.asn1.cades,r=e.SignaturePolicyId;e.SignaturePolicyIdentifier.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.15",this.params=null,this.getValueArray=function(){return[new r(this.params)]},this.setByParam=function(t){this.params=t},null!=t&&this.setByParam(t)},Kt(ct.asn1.cades.SignaturePolicyIdentifier,ct.asn1.cms.Attribute),ct.asn1.cades.SignaturePolicyId=function(t){var e=ct.asn1,r=e.DERSequence,n=e.DERObjectIdentifier,i=(e.x509.AlgorithmIdentifier,e.cades),s=i.SignaturePolicyId,a=i.OtherHashAlgAndValue;s.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params,e=[];return e.push(new n(t.oid)),e.push(new a(t)),new r({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(t){this.params=t},null!=t&&this.setByParam(t)},Kt(ct.asn1.cades.SignaturePolicyId,ct.asn1.ASN1Object),ct.asn1.cades.OtherHashAlgAndValue=function(t){var e=Error,r=ct.asn1,n=r.DERSequence,i=r.DEROctetString,s=r.x509.AlgorithmIdentifier;r.cades.OtherHashAlgAndValue.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params;if(null==t.alg)throw new e("property 'alg' not specified");if(null==t.hash&&null==t.cert)throw new e("property 'hash' nor 'cert' not specified");var r=null;if(null!=t.hash)r=t.hash;else if(null!=t.cert){if("string"!=typeof t.cert)throw new e("cert not string");var a=t.cert;-1!=t.cert.indexOf("-----BEGIN")&&(a=Bt(t.cert)),r=ct.crypto.Util.hashHex(a,t.alg)}var o=[];return o.push(new s({name:t.alg})),o.push(new i({hex:r})),new n({array:o}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Kt(ct.asn1.cades.OtherHashAlgAndValue,ct.asn1.ASN1Object),ct.asn1.cades.OtherHashValue=function(t){ct.asn1.cades.OtherHashValue.superclass.constructor.call(this);var e=Error,r=ct,n=(r.lang.String.isHex,r.asn1.DEROctetString);r.crypto.Util.hashHex,this.params=null,this.tohex=function(){var t=this.params;if(null==t.hash&&null==t.cert)throw new e("hash or cert not specified");var r=null;if(null!=t.hash)r=t.hash;else if(null!=t.cert){if("string"!=typeof t.cert)throw new e("cert not string");var i=t.cert;-1!=t.cert.indexOf("-----BEGIN")&&(i=Bt(t.cert)),r=ct.crypto.Util.hashHex(i,"sha1")}return new n({hex:r}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Kt(ct.asn1.cades.OtherHashValue,ct.asn1.ASN1Object),ct.asn1.cades.SignatureTimeStamp=function(t){var e=Error,r=ct,n=r.lang.String.isHex,i=r.asn1,s=i.ASN1Object;i.x509,i.cades.SignatureTimeStamp.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.14",this.params=null,this.getValueArray=function(){var t=this.params;if(null!=t.tst){if(n(t.tst))return(r=new s).hTLV=t.tst,[r];if(t.tst instanceof s)return[t.tst];throw new e("params.tst has wrong value")}if(null!=t.res){var r,i=t.res;if(i instanceof s&&(i=i.tohex()),"string"!=typeof i||!n(i))throw new e("params.res has wrong value");return ft.getTLVbyList(i,0,[1]),(r=new s).hTLV=t.tst,[r]}},null!=t&&this.setByParam(t)},Kt(ct.asn1.cades.SignatureTimeStamp,ct.asn1.cms.Attribute),ct.asn1.cades.CompleteCertificateRefs=function(t){var e=Error,r=ct,n=r.asn1,i=n.DERSequence,s=n.cades,a=s.OtherCertID,o=r.lang.String.isHex;s.CompleteCertificateRefs.superclass.constructor.call(this),this.typeOid="1.2.840.113549.1.9.16.2.21",this.params=null,this.getValueArray=function(){for(var t=this.params,r=[],n=0;n<t.array.length;n++){var s=t.array[n];if("string"==typeof s)if(-1!=s.indexOf("-----BEGIN"))s={cert:s};else{if(!o(s))throw new e("unsupported value: "+s);s={hash:s}}null!=t.alg&&null==s.alg&&(s.alg=t.alg),null!=t.hasis&&null==s.hasis&&(s.hasis=t.hasis);var u=new a(s);r.push(u)}return[new i({array:r})]},null!=t&&this.setByParam(t)},Kt(ct.asn1.cades.CompleteCertificateRefs,ct.asn1.cms.Attribute),ct.asn1.cades.OtherCertID=function(t){var e=ct.asn1,r=e.DERSequence,n=e.cms.IssuerSerial,i=e.cades,s=i.OtherHashValue,a=i.OtherHashAlgAndValue;i.OtherCertID.superclass.constructor.call(this),this.params=t,this.tohex=function(){var t=this.params;"string"==typeof t&&(-1!=t.indexOf("-----BEGIN")?t={cert:t}:_isHex(t)&&(t={hash:t}));var e,i=[];if(e=null!=t.alg?new a(t):new s(t),i.push(e),null!=t.cert&&1==t.hasis||null!=t.issuer&&null!=t.serial){var o=new n(t);i.push(o)}return new r({array:i}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Kt(ct.asn1.cades.OtherCertID,ct.asn1.ASN1Object),ct.asn1.cades.OtherHash=function(t){Error;var e=ct,r=e.asn1,n=(r.cms,r.cades),i=n.OtherHashAlgAndValue,s=n.OtherHashValue,a=(e.crypto.Util.hashHex,e.lang.String.isHex);n.OtherHash.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params;return"string"==typeof t&&(-1!=t.indexOf("-----BEGIN")?t={cert:t}:a(t)&&(t={hash:t})),(null!=t.alg?new i(t):new s(t)).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Kt(ct.asn1.cades.OtherHash,ct.asn1.ASN1Object),ct.asn1.cades.CAdESUtil=new function(){},ct.asn1.cades.CAdESUtil.parseSignedDataForAddingUnsigned=function(t){return(new ct.asn1.cms.CMSParser).getCMSSignedData(t)},ct.asn1.cades.CAdESUtil.parseSignerInfoForAddingUnsigned=function(t,e,r){var n=ft,i=n.getChildIdx,s=n.getTLV,a=n.getV,o=ct.asn1,u=o.ASN1Object,c=o.cms,h=c.AttributeList,l=c.SignerInfo,f={},p=i(t,e);if(6!=p.length)throw"not supported items for SignerInfo (!=6)";var g=p.shift();f.version=s(t,g);var d=p.shift();f.si=s(t,d);var m=p.shift();f.digalg=s(t,m);var v=p.shift();f.sattrs=s(t,v);var y=p.shift();f.sigalg=s(t,y);var x=p.shift();f.sig=s(t,x),f.sigval=a(t,x);var w=null;return f.obj=new l,(w=new u).hTLV=f.version,f.obj.dCMSVersion=w,(w=new u).hTLV=f.si,f.obj.dSignerIdentifier=w,(w=new u).hTLV=f.digalg,f.obj.dDigestAlgorithm=w,(w=new u).hTLV=f.sattrs,f.obj.dSignedAttrs=w,(w=new u).hTLV=f.sigalg,f.obj.dSigAlg=w,(w=new u).hTLV=f.sig,f.obj.dSig=w,f.obj.dUnsignedAttrs=new h,f},void 0!==ct.asn1.csr&&ct.asn1.csr||(ct.asn1.csr={}),ct.asn1.csr.CertificationRequest=function(t){var e=ct.asn1,r=e.DERBitString,n=e.DERSequence,i=e.csr,s=(e.x509,i.CertificationRequestInfo);i.CertificationRequest.superclass.constructor.call(this),this.setByParam=function(t){this.params=t},this.sign=function(){var t=new s(this.params).tohex(),e=new ct.crypto.Signature({alg:this.params.sigalg});e.init(this.params.sbjprvkey),e.updateHex(t);var r=e.sign();this.params.sighex=r},this.getPEM=function(){return At(this.tohex(),"CERTIFICATE REQUEST")},this.tohex=function(){var t=this.params,e=new ct.asn1.csr.CertificationRequestInfo(this.params),i=new ct.asn1.x509.AlgorithmIdentifier({name:t.sigalg});if(null==t.sighex&&null!=t.sbjprvkey&&this.sign(),null==t.sighex)throw new Error("sighex or sbjprvkey parameter not defined");var s=new r({hex:"00"+t.sighex});return new n({array:[e,i,s]}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},Kt(ct.asn1.csr.CertificationRequest,ct.asn1.ASN1Object),ct.asn1.csr.CertificationRequestInfo=function(t){var e=ct.asn1,r=(e.DERBitString,e.DERSequence),n=e.DERInteger,i=e.DERUTF8String,s=e.DERTaggedObject,a=e.ASN1Util.newObject,o=e.csr,u=e.x509,c=u.X500Name,h=u.Extensions,l=u.SubjectPublicKeyInfo;o.CertificationRequestInfo.superclass.constructor.call(this),this.params=null,this.setByParam=function(t){null!=t&&(this.params=t)},this.tohex=function(){var t=this.params,e=[];if(e.push(new n({int:0})),e.push(new c(t.subject)),e.push(new l(qt.getKey(t.sbjpubkey))),null!=t.extreq){var o=new h(t.extreq),u=a({tag:{tag:"a0",explict:!0,obj:{seq:[{oid:"1.2.840.113549.1.9.14"},{set:[o]}]}}});e.push(u)}else e.push(new s({tag:"a0",explicit:!1,obj:new i({str:""})}));return new r({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},null!=t&&this.setByParam(t)},Kt(ct.asn1.csr.CertificationRequestInfo,ct.asn1.ASN1Object),ct.asn1.csr.CSRUtil=new function(){},ct.asn1.csr.CSRUtil.newCSRPEM=function(t){return new ct.asn1.csr.CertificationRequest(t).getPEM()},ct.asn1.csr.CSRUtil.getParam=function(t){var e=ft,r=e.getV,n=e.getIdxbyList,i=e.getTLVbyList,s=e.getTLVbyListEx,a=e.getVbyListEx,o={};if(-1==t.indexOf("-----BEGIN CERTIFICATE REQUEST"))throw new Error("argument is not PEM file");var u=Bt(t,"CERTIFICATE REQUEST");try{var c=s(u,0,[0,1]);if("3000"==c)o.subject={};else{var h=new Wt;o.subject=h.getX500Name(c)}}catch(t){}var l=s(u,0,[0,2]),f=qt.getKey(l,null,"pkcs8pub");o.sbjpubkey=qt.getPEM(f,"PKCS8PUB");var p=function(t){var e=n(t,0,[0,3,0,0],"06");return"2a864886f70d01090e"!=r(t,e)?null:i(t,0,[0,3,0,1,0],"30")}(u);h=new Wt,null!=p&&(o.extreq=h.getExtParamArray(p));try{var g=s(u,0,[1],"30");h=new Wt,o.sigalg=h.getAlgorithmIdentifierName(g)}catch(t){}try{var d=a(u,0,[2]);o.sighex=d}catch(t){}return o},void 0!==ct&&ct||(ct={}),void 0!==ct.asn1&&ct.asn1||(ct.asn1={}),void 0!==ct.asn1.ocsp&&ct.asn1.ocsp||(ct.asn1.ocsp={}),ct.asn1.ocsp.DEFAULT_HASH="sha1",ct.asn1.ocsp.OCSPResponse=function(t){ct.asn1.ocsp.OCSPResponse.superclass.constructor.call(this),ct.asn1.DEREnumerated;var e=ct.asn1.ASN1Util.newObject,r=ct.asn1.ocsp.ResponseBytes,n=["successful","malformedRequest","internalError","tryLater","_not_used_","sigRequired","unauthorized"];this.params=null,this._getStatusCode=function(){var t=this.params.resstatus;return"number"==typeof t?t:"string"!=typeof t?-1:n.indexOf(t)},this.setByParam=function(t){this.params=t},this.tohex=function(){var t=this.params,n=this._getStatusCode();if(-1==n)throw new Error("responseStatus not supported: "+t.resstatus);if(0!=n)return e({seq:[{enum:{int:n}}]}).tohex();var i=new r(t);return e({seq:[{enum:{int:0}},{tag:{tag:"a0",explicit:!0,obj:i}}]}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},Kt(ct.asn1.ocsp.OCSPResponse,ct.asn1.ASN1Object),ct.asn1.ocsp.ResponseBytes=function(t){ct.asn1.ocsp.ResponseBytes.superclass.constructor.call(this);var e=ct.asn1,r=e.DERSequence,n=e.DERObjectIdentifier,i=e.DEROctetString,s=e.ocsp.BasicOCSPResponse;this.params=null,this.setByParam=function(t){this.params=t},this.tohex=function(){var t=this.params;if("ocspBasic"!=t.restype)throw new Error("not supported responseType: "+t.restype);var e=new s(t),a=[];return a.push(new n({name:"ocspBasic"})),a.push(new i({hex:e.tohex()})),new r({array:a}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},Kt(ct.asn1.ocsp.ResponseBytes,ct.asn1.ASN1Object),ct.asn1.ocsp.BasicOCSPResponse=function(t){ct.asn1.ocsp.BasicOCSPResponse.superclass.constructor.call(this);var e=Error,r=ct.asn1,n=r.ASN1Object,i=r.DERSequence,s=(r.DERGeneralizedTime,r.DERTaggedObject),a=r.DERBitString,o=(r.x509.Extensions,r.x509.AlgorithmIdentifier),u=r.ocsp;u.ResponderID,_SingleResponseList=u.SingleResponseList,_ResponseData=u.ResponseData,this.params=null,this.setByParam=function(t){this.params=t},this.sign=function(){var t=this.params,e=t.tbsresp.tohex(),r=new ct.crypto.Signature({alg:t.sigalg});r.init(t.reskey),r.updateHex(e),t.sighex=r.sign()},this.tohex=function(){var t=this.params;null==t.tbsresp&&(t.tbsresp=new _ResponseData(t)),null==t.sighex&&null!=t.reskey&&this.sign();var r=[];if(r.push(t.tbsresp),r.push(new o({name:t.sigalg})),r.push(new a({hex:"00"+t.sighex})),null!=t.certs&&null!=t.certs.length){for(var u=[],c=0;c<t.certs.length;c++){var h=t.certs[c],l=null;if(ft.isASN1HEX(h))l=h;else{if(!h.match(/-----BEGIN/))throw new e("certs["+c+"] not hex or PEM");l=Bt(h)}u.push(new n({tlv:l}))}var f=new i({array:u});r.push(new s({tag:"a0",explicit:!0,obj:f}))}return new i({array:r}).tohex()},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},Kt(ct.asn1.ocsp.BasicOCSPResponse,ct.asn1.ASN1Object),ct.asn1.ocsp.ResponseData=function(t){ct.asn1.ocsp.ResponseData.superclass.constructor.call(this);var e=Error,r=ct.asn1,n=r.DERSequence,i=r.DERGeneralizedTime,s=r.DERTaggedObject,a=r.x509.Extensions,o=r.ocsp,u=o.ResponderID;_SingleResponseList=o.SingleResponseList,this.params=null,this.tohex=function(){var t=this.params;null!=t.respid&&new e("respid not specified"),null!=t.prodat&&new e("prodat not specified"),null!=t.array&&new e("array not specified");var r=[];if(r.push(new u(t.respid)),r.push(new i(t.prodat)),r.push(new _SingleResponseList(t.array)),null!=t.ext){var o=new a(t.ext);r.push(new s({tag:"a1",explicit:!0,obj:o}))}return new n({array:r}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(t){this.params=t},void 0!==t&&this.setByParam(t)},Kt(ct.asn1.ocsp.ResponseData,ct.asn1.ASN1Object),ct.asn1.ocsp.ResponderID=function(t){ct.asn1.ocsp.ResponderID.superclass.constructor.call(this);var e=ct,r=e.asn1,n=r.ASN1Util.newObject,i=r.x509.X500Name,s=e.lang.String.isHex,a=Error;this.params=null,this.tohex=function(){var t=this.params;if(null!=t.key){var e,r=null;if("string"==typeof t.key?(s(t.key)&&(r=t.key),t.key.match(/-----BEGIN CERTIFICATE/)&&null!=(e=new Wt(t.key).getExtSubjectKeyIdentifier())&&(r=e.kid.hex)):t.key instanceof Wt&&null!=(e=t.key.getExtSubjectKeyIdentifier())&&(r=e.kid.hex),null==r)throw new a("wrong key member value");return n({tag:{tag:"a2",explicit:!0,obj:{octstr:{hex:r}}}}).tohex()}if(null!=t.name){var o=null;if("string"==typeof t.name&&t.name.match(/-----BEGIN CERTIFICATE/)?o=new Wt(t.name).getSubject():t.name instanceof Wt?o=t.name.getSubject():"object"!=typeof t.name||null==t.name.array&&null==t.name.str||(o=t.name),null==o)throw new a("wrong name member value");return n({tag:{tag:"a1",explicit:!0,obj:new i(o)}}).tohex()}throw new a("key or name not specified")},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(t){this.params=t},void 0!==t&&this.setByParam(t)},Kt(ct.asn1.ocsp.ResponderID,ct.asn1.ASN1Object),ct.asn1.ocsp.SingleResponseList=function(t){ct.asn1.ocsp.SingleResponseList.superclass.constructor.call(this);var e=ct.asn1,r=e.DERSequence,n=e.ocsp.SingleResponse;this.params=null,this.tohex=function(){var t=this.params;if("object"!=typeof t||null==t.length)throw new Error("params not specified properly");for(var e=[],i=0;i<t.length;i++)e.push(new n(t[i]));return new r({array:e}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(t){this.params=t},void 0!==t&&this.setByParam(t)},Kt(ct.asn1.ocsp.SingleResponseList,ct.asn1.ASN1Object),ct.asn1.ocsp.SingleResponse=function(t){var e=Error,r=ct.asn1,n=r.DERSequence,i=r.DERGeneralizedTime,s=r.DERTaggedObject,a=r.ocsp,o=a.CertID,u=a.CertStatus,c=r.x509.Extensions;a.SingleResponse.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params,r=[];if(null==t.certid)throw new e("certid unspecified");if(null==t.status)throw new e("status unspecified");if(null==t.thisupdate)throw new e("thisupdate unspecified");if(r.push(new o(t.certid)),r.push(new u(t.status)),r.push(new i(t.thisupdate)),null!=t.nextupdate){var a=new i(t.nextupdate);r.push(new s({tag:"a0",explicit:!0,obj:a}))}if(null!=t.ext){var h=new c(t.ext);r.push(new s({tag:"a1",explicit:!0,obj:h}))}return new n({array:r}).tohex()},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(t){this.params=t},void 0!==t&&this.setByParam(t)},Kt(ct.asn1.ocsp.SingleResponse,ct.asn1.ASN1Object),ct.asn1.ocsp.CertID=function(t){var e=ct,r=e.asn1,n=r.DEROctetString,i=r.DERInteger,s=r.DERSequence,a=r.x509.AlgorithmIdentifier,o=r.ocsp,u=(o.DEFAULT_HASH,e.crypto.Util.hashHex),c=Wt,h=ft.getVbyList;o.CertID.superclass.constructor.call(this),this.DEFAULT_HASH="sha1",this.params=null,this.setByValue=function(t,e,r,n){null==n&&(n=this.DEFAULT_HASH),this.params={alg:n,issname:t,isskey:e,sbjsn:r}},this.setByCert=function(t,e,r){null==r&&(r=this.DEFAULT_HASH),this.params={alg:r,issuerCert:t,subjectCert:e}},this.getParamByCerts=function(t,e,r){null==r&&(r=this.DEFAULT_HASH);var n=new c(t),i=new c(e),s=u(n.getSubjectHex(),r),a=n.getPublicKeyHex();return{alg:r,issname:s,isskey:u(h(a,0,[1],"03",!0),r),sbjsn:i.getSerialNumberHex()}},this.tohex=function(){if("object"!=typeof this.params)throw new Error("params not set");var t,e,r,o,u=this.params;if(o=null==u.alg?this.DEFAULT_HASH:u.alg,null!=u.issuerCert&&null!=u.subjectCert){var c=this.getParamByCerts(u.issuerCert,u.subjectCert,o);t=c.issname,e=c.isskey,r=c.sbjsn}else{if(null==u.issname||null==u.isskey||null==u.sbjsn)throw new Error("required param members not defined");t=u.issname,e=u.isskey,r=u.sbjsn}var h=new a({name:o}),l=new n({hex:t}),f=new n({hex:e}),p=new i({hex:r}),g=new s({array:[h,l,f,p]});return this.hTLV=g.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&this.setByParam(t)},Kt(ct.asn1.ocsp.CertID,ct.asn1.ASN1Object),ct.asn1.ocsp.CertStatus=function(t){ct.asn1.ocsp.CertStatus.superclass.constructor.call(this),this.params=null,this.tohex=function(){var t=this.params;if("good"==t.status)return"8000";if("unknown"==t.status)return"8200";if("revoked"==t.status){var e=[{gentime:{str:t.time}}];null!=t.reason&&e.push({tag:{tag:"a0",explicit:!0,obj:{enum:{int:t.reason}}}});var r={tag:"a1",explicit:!1,obj:{seq:e}};return ct.asn1.ASN1Util.newObject({tag:r}).tohex()}throw new Error("bad status")},this.getEncodedHex=function(){return this.tohex()},this.setByParam=function(t){this.params=t},void 0!==t&&this.setByParam(t)},Kt(ct.asn1.ocsp.CertStatus,ct.asn1.ASN1Object),ct.asn1.ocsp.Request=function(t){var e=ct.asn1,r=e.DERSequence,n=e.ocsp;if(n.Request.superclass.constructor.call(this),this.dReqCert=null,this.dExt=null,this.tohex=function(){var t=[];if(null===this.dReqCert)throw"reqCert not set";t.push(this.dReqCert);var e=new r({array:t});return this.hTLV=e.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==t){var i=new n.CertID(t);this.dReqCert=i}},Kt(ct.asn1.ocsp.Request,ct.asn1.ASN1Object),ct.asn1.ocsp.TBSRequest=function(t){var e=ct.asn1,r=e.DERSequence,n=e.ocsp;n.TBSRequest.superclass.constructor.call(this),this.version=0,this.dRequestorName=null,this.dRequestList=[],this.dRequestExt=null,this.setRequestListByParam=function(t){for(var e=[],r=0;r<t.length;r++){var i=new n.Request(t[0]);e.push(i)}this.dRequestList=e},this.tohex=function(){var t=[];if(0!==this.version)throw"not supported version: "+this.version;if(null!==this.dRequestorName)throw"requestorName not supported";var e=new r({array:this.dRequestList});if(t.push(e),null!==this.dRequestExt)throw"requestExtensions not supported";var n=new r({array:t});return this.hTLV=n.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&void 0!==t.reqList&&this.setRequestListByParam(t.reqList)},Kt(ct.asn1.ocsp.TBSRequest,ct.asn1.ASN1Object),ct.asn1.ocsp.OCSPRequest=function(t){var e=ct.asn1,r=e.DERSequence,n=e.ocsp;if(n.OCSPRequest.superclass.constructor.call(this),this.dTbsRequest=null,this.dOptionalSignature=null,this.tohex=function(){var t=[];if(null===this.dTbsRequest)throw"tbsRequest not set";if(t.push(this.dTbsRequest),null!==this.dOptionalSignature)throw"optionalSignature not supported";var e=new r({array:t});return this.hTLV=e.tohex(),this.hTLV},this.getEncodedHex=function(){return this.tohex()},void 0!==t&&void 0!==t.reqList){var i=new n.TBSRequest(t);this.dTbsRequest=i}},Kt(ct.asn1.ocsp.OCSPRequest,ct.asn1.ASN1Object),ct.asn1.ocsp.OCSPUtil={},ct.asn1.ocsp.OCSPUtil.getRequestHex=function(t,e,r){var n=ct.asn1.ocsp;void 0===r&&(r=n.DEFAULT_HASH);var i={alg:r,issuerCert:t,subjectCert:e};return new n.OCSPRequest({reqList:[i]}).tohex()},ct.asn1.ocsp.OCSPUtil.getOCSPResponseInfo=function(t){var e=ft,r=e.getVbyList,n=e.getVbyListEx,i=e.getIdxbyList,s=(e.getIdxbyListEx,e.getV),a={};try{var o=n(t,0,[0],"0a");a.responseStatus=parseInt(o,16)}catch(t){}if(0!==a.responseStatus)return a;try{var u=i(t,0,[1,0,1,0,0,2,0,1]);"80"===t.substr(u,2)?a.certStatus="good":"a1"===t.substr(u,2)?(a.certStatus="revoked",a.revocationTime=wt(r(t,u,[0]))):"82"===t.substr(u,2)&&(a.certStatus="unknown")}catch(t){}try{var c=i(t,0,[1,0,1,0,0,2,0,2]);a.thisUpdate=wt(s(t,c))}catch(t){}try{var h=i(t,0,[1,0,1,0,0,2,0,3]);"a0"===t.substr(h,2)&&(a.nextUpdate=wt(r(t,h,[0])))}catch(t){}return a},ct.asn1.ocsp.OCSPParser=function(){var t=Error,e=Wt,r=new e,n=ft,i=n.getV,s=n.getTLV,a=n.getIdxbyList,o=n.getVbyList,u=n.getTLVbyList,c=n.getVbyListEx,h=n.getTLVbyListEx,l=n.getChildIdx;this.getOCSPRequest=function(e){var r=l(e,0);if(1!=r.length&&2!=r.length)throw new t("wrong number elements: "+r.length);return this.getTBSRequest(s(e,r[0]))},this.getTBSRequest=function(t){var e={},n=h(t,0,[0],"30");e.array=this.getRequestList(n);var i=h(t,0,["[2]",0],"30");return null!=i&&(e.ext=r.getExtParamArray(i)),e},this.getRequestList=function(t){for(var e=[],r=l(t,0),n=0;n<r.length;n++)t=s(t,r[n]),e.push(this.getRequest(t));return e},this.getRequest=function(e){var n=l(e,0);if(1!=n.length&&2!=n.length)throw new t("wrong number elements: "+n.length);var i=this.getCertID(s(e,n[0]));if(2==n.length){var o=a(e,0,[1,0]);i.ext=r.getExtParamArray(s(e,o))}return i},this.getCertID=function(r){var n=l(r,0);if(4!=n.length)throw new t("wrong number elements: "+n.length);var a=new e,o={};return o.alg=a.getAlgorithmIdentifierName(s(r,n[0])),o.issname=i(r,n[1]),o.isskey=i(r,n[2]),o.sbjsn=i(r,n[3]),o},this.getOCSPResponse=function(t){var e,r=l(t,0),n=i(t,r[0]),s=parseInt(n);if(1==r.length)return{resstatus:s};var a=u(t,0,[1,0]);return(e=this.getResponseBytes(a)).resstatus=s,e},this.getResponseBytes=function(t){var e,r=l(t,0),n=u(t,0,[1,0]);e=this.getBasicOCSPResponse(n);var s=i(t,r[0]);return e.restype=ct.asn1.x509.OID.oid2name(_t(s)),e},this.getBasicOCSPResponse=function(t){var e,r=l(t,0);e=this.getResponseData(s(t,r[0]));var n=new Wt;e.alg=n.getAlgorithmIdentifierName(s(t,r[1]));var a=i(t,r[2]);e.sighex=a.substr(2);var o=c(t,0,["[0]"]);if(null!=o){for(var u=l(o,0),h=[],f=0;f<u.length;f++){var p=s(o,u[f]);h.push(p)}e.certs=h}return e},this.getResponseData=function(t){var e=l(t,0),r=e.length,n={},a=0;"a0"==t.substr(e[0],2)&&a++,n.respid=this.getResponderID(s(t,e[a++]));var o=i(t,e[a++]);if(n.prodat=wt(o),n.array=this.getSingleResponseList(s(t,e[a++])),"a1"==t.substr(e[r-1],2)){var c=u(t,e[r-1],[0]),h=new Wt;n.ext=h.getExtParamArray(c)}return n},this.getResponderID=function(t){var e={};if("a2"==t.substr(0,2)){var r=o(t,0,[0]);e.key=r}if("a1"==t.substr(0,2)){var n=u(t,0,[0]),i=new Wt;e.name=i.getX500Name(n)}return e},this.getSingleResponseList=function(t){for(var e=l(t,0),r=[],n=0;n<e.length;n++){var i=this.getSingleResponse(s(t,e[n]));r.push(i)}return r},this.getSingleResponse=function(t){var e=l(t,0),r={},n=this.getCertID(s(t,e[0]));r.certid=n;var a=this.getCertStatus(s(t,e[1]));if(r.status=a,"18"==t.substr(e[2],2)){var c=i(t,e[2]);r.thisupdate=wt(c)}for(var h=3;h<e.length;h++){if("a0"==t.substr(e[h],2)){var f=o(t,e[h],[0],"18");r.nextupdate=wt(f)}if("a1"==t.substr(e[h],2)){var p=new Wt,g=u(t,0,[h,0]);r.ext=p.getExtParamArray(g)}}return r},this.getCertStatus=function(t){var e={};if("8000"==t)return{status:"good"};if("8200"==t)return{status:"unknown"};if("a1"==t.substr(0,2)){e.status="revoked";var r=wt(o(t,0,[0]));e.time=r}return e}},void 0!==ct&&ct||(ct={}),void 0!==ct.lang&&ct.lang||(ct.lang={}),ct.lang.String=function(){},"function"==typeof g?(ht=function(t){return dt(g.from(t,"utf8").toString("base64"))},lt=function(t){return g.from(mt(t),"base64").toString("utf8")}):(ht=function(t){return vt(Dt(jt(t)))},lt=function(t){return decodeURIComponent(Ct(yt(t)))}),ct.lang.String.isInteger=function(t){return!!t.match(/^[0-9]+$/)||!!t.match(/^-[0-9]+$/)},ct.lang.String.isHex=function(t){return Lt(t)},ct.lang.String.isBase64=function(t){return!(!(t=t.replace(/\s+/g,"")).match(/^[0-9A-Za-z+\/]+={0,3}$/)||t.length%4!=0)},ct.lang.String.isBase64URL=function(t){return!t.match(/[+/=]/)&&(t=mt(t),ct.lang.String.isBase64(t))},ct.lang.String.isIntegerArray=function(t){return!!(t=t.replace(/\s+/g,"")).match(/^\[[0-9,]+\]$/)},ct.lang.String.isPrintable=function(t){return null!==t.match(/^[0-9A-Za-z '()+,-./:=?]*$/)},ct.lang.String.isIA5=function(t){return null!==t.match(/^[\x20-\x21\x23-\x7f]*$/)},ct.lang.String.isMail=function(t){return null!==t.match(/^[A-Za-z0-9]{1}[A-Za-z0-9_.-]*@{1}[A-Za-z0-9_.-]{1,}\.[A-Za-z0-9]{1,}$/)};var Ut=function(t,e,r){return null==r&&(r="0"),t.length>=e?t:new Array(e-t.length+1).join(r)+t};function Mt(t,e){for(var r=0,n=0;n<t.length;n++)r|=1<<e[t[n]];var i=r.toString(2),s="";for(n=i.length-1;n>=0;n--)s+=i[n];return s}function Kt(t,e){var r=function(){};r.prototype=e.prototype,t.prototype=new r,t.prototype.constructor=t,t.superclass=e.prototype,e.prototype.constructor==Object.prototype.constructor&&(e.prototype.constructor=e)}void 0!==ct&&ct||(ct={}),void 0!==ct.crypto&&ct.crypto||(ct.crypto={}),ct.crypto.Util=new function(){this.DIGESTINFOHEAD={sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",ripemd160:"3021300906052b2403020105000414"},this.DEFAULTPROVIDER={md5:"cryptojs",sha1:"cryptojs",sha224:"cryptojs",sha256:"cryptojs",sha384:"cryptojs",sha512:"cryptojs",ripemd160:"cryptojs",hmacmd5:"cryptojs",hmacsha1:"cryptojs",hmacsha224:"cryptojs",hmacsha256:"cryptojs",hmacsha384:"cryptojs",hmacsha512:"cryptojs",hmacripemd160:"cryptojs",MD5withRSA:"cryptojs/jsrsa",SHA1withRSA:"cryptojs/jsrsa",SHA224withRSA:"cryptojs/jsrsa",SHA256withRSA:"cryptojs/jsrsa",SHA384withRSA:"cryptojs/jsrsa",SHA512withRSA:"cryptojs/jsrsa",RIPEMD160withRSA:"cryptojs/jsrsa",MD5withECDSA:"cryptojs/jsrsa",SHA1withECDSA:"cryptojs/jsrsa",SHA224withECDSA:"cryptojs/jsrsa",SHA256withECDSA:"cryptojs/jsrsa",SHA384withECDSA:"cryptojs/jsrsa",SHA512withECDSA:"cryptojs/jsrsa",RIPEMD160withECDSA:"cryptojs/jsrsa",SHA1withDSA:"cryptojs/jsrsa",SHA224withDSA:"cryptojs/jsrsa",SHA256withDSA:"cryptojs/jsrsa",MD5withRSAandMGF1:"cryptojs/jsrsa",SHAwithRSAandMGF1:"cryptojs/jsrsa",SHA1withRSAandMGF1:"cryptojs/jsrsa",SHA224withRSAandMGF1:"cryptojs/jsrsa",SHA256withRSAandMGF1:"cryptojs/jsrsa",SHA384withRSAandMGF1:"cryptojs/jsrsa",SHA512withRSAandMGF1:"cryptojs/jsrsa",RIPEMD160withRSAandMGF1:"cryptojs/jsrsa"},this.CRYPTOJSMESSAGEDIGESTNAME={md5:v.algo.MD5,sha1:v.algo.SHA1,sha224:v.algo.SHA224,sha256:v.algo.SHA256,sha384:v.algo.SHA384,sha512:v.algo.SHA512,ripemd160:v.algo.RIPEMD160},this.getDigestInfoHex=function(t,e){if(void 0===this.DIGESTINFOHEAD[e])throw"alg not supported in Util.DIGESTINFOHEAD: "+e;return this.DIGESTINFOHEAD[e]+t},this.getPaddedDigestInfoHex=function(t,e,r){var n=this.getDigestInfoHex(t,e),i=r/4;if(n.length+22>i)throw"key is too short for SigAlg: keylen="+r+","+e;for(var s="0001",a="00"+n,o="",u=i-s.length-a.length,c=0;c<u;c+=2)o+="ff";return s+o+a},this.hashString=function(t,e){return new ct.crypto.MessageDigest({alg:e}).digestString(t)},this.hashHex=function(t,e){return new ct.crypto.MessageDigest({alg:e}).digestHex(t)},this.sha1=function(t){return this.hashString(t,"sha1")},this.sha256=function(t){return this.hashString(t,"sha256")},this.sha256Hex=function(t){return this.hashHex(t,"sha256")},this.sha512=function(t){return this.hashString(t,"sha512")},this.sha512Hex=function(t){return this.hashHex(t,"sha512")},this.isKey=function(t){return t instanceof nt||t instanceof ct.crypto.DSA||t instanceof ct.crypto.ECDSA}},ct.crypto.Util.md5=function(t){return new ct.crypto.MessageDigest({alg:"md5",prov:"cryptojs"}).digestString(t)},ct.crypto.Util.ripemd160=function(t){return new ct.crypto.MessageDigest({alg:"ripemd160",prov:"cryptojs"}).digestString(t)},ct.crypto.Util.SECURERANDOMGEN=new tt,ct.crypto.Util.getRandomHexOfNbytes=function(t){var e=new Array(t);return ct.crypto.Util.SECURERANDOMGEN.nextBytes(e),pt(e)},ct.crypto.Util.getRandomBigIntegerOfNbytes=function(t){return new E(ct.crypto.Util.getRandomHexOfNbytes(t),16)},ct.crypto.Util.getRandomHexOfNbits=function(t){var e=t%8,r=new Array((t-e)/8+1);return ct.crypto.Util.SECURERANDOMGEN.nextBytes(r),r[0]=(255<<e&255^255)&r[0],pt(r)},ct.crypto.Util.getRandomBigIntegerOfNbits=function(t){return new E(ct.crypto.Util.getRandomHexOfNbits(t),16)},ct.crypto.Util.getRandomBigIntegerZeroToMax=function(t){for(var e=t.bitLength();;){var r=ct.crypto.Util.getRandomBigIntegerOfNbits(e);if(-1!=t.compareTo(r))return r}},ct.crypto.Util.getRandomBigIntegerMinToMax=function(t,e){var r=t.compareTo(e);if(1==r)throw"biMin is greater than biMax";if(0==r)return t;var n=e.subtract(t);return ct.crypto.Util.getRandomBigIntegerZeroToMax(n).add(t)},ct.crypto.MessageDigest=function(t){this.setAlgAndProvider=function(t,e){if(null!==(t=ct.crypto.MessageDigest.getCanonicalAlgName(t))&&void 0===e&&(e=ct.crypto.Util.DEFAULTPROVIDER[t]),-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(t)&&"cryptojs"==e){try{this.md=ct.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[t].create()}catch(e){throw"setAlgAndProvider hash alg set fail alg="+t+"/"+e}this.updateString=function(t){this.md.update(t)},this.updateHex=function(t){var e=v.enc.Hex.parse(t);this.md.update(e)},this.digest=function(){return this.md.finalize().toString(v.enc.Hex)},this.digestString=function(t){return this.updateString(t),this.digest()},this.digestHex=function(t){return this.updateHex(t),this.digest()}}if(-1!=":sha256:".indexOf(t)&&"sjcl"==e){try{this.md=new sjcl.hash.sha256}catch(e){throw"setAlgAndProvider hash alg set fail alg="+t+"/"+e}this.updateString=function(t){this.md.update(t)},this.updateHex=function(t){var e=sjcl.codec.hex.toBits(t);this.md.update(e)},this.digest=function(){var t=this.md.finalize();return sjcl.codec.hex.fromBits(t)},this.digestString=function(t){return this.updateString(t),this.digest()},this.digestHex=function(t){return this.updateHex(t),this.digest()}}},this.updateString=function(t){throw"updateString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.updateHex=function(t){throw"updateHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digest=function(){throw"digest() not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestString=function(t){throw"digestString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestHex=function(t){throw"digestHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},void 0!==t&&void 0!==t.alg&&(this.algName=t.alg,void 0===t.prov&&(this.provName=ct.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName))},ct.crypto.MessageDigest.getCanonicalAlgName=function(t){return"string"==typeof t&&(t=(t=t.toLowerCase()).replace(/-/,"")),t},ct.crypto.MessageDigest.getHashLength=function(t){var e=ct.crypto.MessageDigest,r=e.getCanonicalAlgName(t);if(void 0===e.HASHLENGTH[r])throw"not supported algorithm: "+t;return e.HASHLENGTH[r]},ct.crypto.MessageDigest.HASHLENGTH={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,ripemd160:20},ct.crypto.Mac=function(t){this.setAlgAndProvider=function(t,e){if(null==(t=t.toLowerCase())&&(t="hmacsha1"),"hmac"!=(t=t.toLowerCase()).substr(0,4))throw"setAlgAndProvider unsupported HMAC alg: "+t;void 0===e&&(e=ct.crypto.Util.DEFAULTPROVIDER[t]),this.algProv=t+"/"+e;var r=t.substr(4);if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(r)&&"cryptojs"==e){try{var n=ct.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[r];this.mac=v.algo.HMAC.create(n,this.pass)}catch(t){throw"setAlgAndProvider hash alg set fail hashAlg="+r+"/"+t}this.updateString=function(t){this.mac.update(t)},this.updateHex=function(t){var e=v.enc.Hex.parse(t);this.mac.update(e)},this.doFinal=function(){return this.mac.finalize().toString(v.enc.Hex)},this.doFinalString=function(t){return this.updateString(t),this.doFinal()},this.doFinalHex=function(t){return this.updateHex(t),this.doFinal()}}},this.updateString=function(t){throw"updateString(str) not supported for this alg/prov: "+this.algProv},this.updateHex=function(t){throw"updateHex(hex) not supported for this alg/prov: "+this.algProv},this.doFinal=function(){throw"digest() not supported for this alg/prov: "+this.algProv},this.doFinalString=function(t){throw"digestString(str) not supported for this alg/prov: "+this.algProv},this.doFinalHex=function(t){throw"digestHex(hex) not supported for this alg/prov: "+this.algProv},this.setPassword=function(t){if("string"==typeof t){var e=t;return t.length%2!=1&&t.match(/^[0-9A-Fa-f]+$/)||(e=St(t)),void(this.pass=v.enc.Hex.parse(e))}if("object"!=typeof t)throw"KJUR.crypto.Mac unsupported password type: "+t;if(e=null,void 0!==t.hex){if(t.hex.length%2!=0||!t.hex.match(/^[0-9A-Fa-f]+$/))throw"Mac: wrong hex password: "+t.hex;e=t.hex}if(void 0!==t.utf8&&(e=xt(t.utf8)),void 0!==t.rstr&&(e=St(t.rstr)),void 0!==t.b64&&(e=b(t.b64)),void 0!==t.b64u&&(e=yt(t.b64u)),null==e)throw"KJUR.crypto.Mac unsupported password type: "+t;this.pass=v.enc.Hex.parse(e)},void 0!==t&&(void 0!==t.pass&&this.setPassword(t.pass),void 0!==t.alg&&(this.algName=t.alg,void 0===t.prov&&(this.provName=ct.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName)))},ct.crypto.Signature=function(t){var e=null;if(this._setAlgNames=function(){var t=this.algName.match(/^(.+)with(.+)$/);t&&(this.mdAlgName=t[1].toLowerCase(),this.pubkeyAlgName=t[2].toLowerCase(),"rsaandmgf1"==this.pubkeyAlgName&&"sha"==this.mdAlgName&&(this.mdAlgName="sha1"))},this._zeroPaddingOfSignature=function(t,e){for(var r="",n=e/4-t.length,i=0;i<n;i++)r+="0";return r+t},this.setAlgAndProvider=function(t,e){if(this._setAlgNames(),"cryptojs/jsrsa"!=e)throw new Error("provider not supported: "+e);if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(this.mdAlgName)){try{this.md=new ct.crypto.MessageDigest({alg:this.mdAlgName})}catch(t){throw new Error("setAlgAndProvider hash alg set fail alg="+this.mdAlgName+"/"+t)}this.init=function(t,e){var r=null;try{r=void 0===e?qt.getKey(t):qt.getKey(t,e)}catch(t){throw"init failed:"+t}if(!0===r.isPrivate)this.prvKey=r,this.state="SIGN";else{if(!0!==r.isPublic)throw"init failed.:"+r;this.pubKey=r,this.state="VERIFY"}},this.updateString=function(t){this.md.updateString(t)},this.updateHex=function(t){this.md.updateHex(t)},this.sign=function(){if(this.sHashHex=this.md.digest(),void 0===this.prvKey&&void 0!==this.ecprvhex&&void 0!==this.eccurvename&&void 0!==ct.crypto.ECDSA&&(this.prvKey=new ct.crypto.ECDSA({curve:this.eccurvename,prv:this.ecprvhex})),this.prvKey instanceof nt&&"rsaandmgf1"===this.pubkeyAlgName)this.hSign=this.prvKey.signWithMessageHashPSS(this.sHashHex,this.mdAlgName,this.pssSaltLen);else if(this.prvKey instanceof nt&&"rsa"===this.pubkeyAlgName)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex,this.mdAlgName);else if(this.prvKey instanceof ct.crypto.ECDSA)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex);else{if(!(this.prvKey instanceof ct.crypto.DSA))throw"Signature: unsupported private key alg: "+this.pubkeyAlgName;this.hSign=this.prvKey.signWithMessageHash(this.sHashHex)}return this.hSign},this.signString=function(t){return this.updateString(t),this.sign()},this.signHex=function(t){return this.updateHex(t),this.sign()},this.verify=function(t){if(this.sHashHex=this.md.digest(),void 0===this.pubKey&&void 0!==this.ecpubhex&&void 0!==this.eccurvename&&void 0!==ct.crypto.ECDSA&&(this.pubKey=new ct.crypto.ECDSA({curve:this.eccurvename,pub:this.ecpubhex})),this.pubKey instanceof nt&&"rsaandmgf1"===this.pubkeyAlgName)return this.pubKey.verifyWithMessageHashPSS(this.sHashHex,t,this.mdAlgName,this.pssSaltLen);if(this.pubKey instanceof nt&&"rsa"===this.pubkeyAlgName)return this.pubKey.verifyWithMessageHash(this.sHashHex,t);if(void 0!==ct.crypto.ECDSA&&this.pubKey instanceof ct.crypto.ECDSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,t);if(void 0!==ct.crypto.DSA&&this.pubKey instanceof ct.crypto.DSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,t);throw"Signature: unsupported public key alg: "+this.pubkeyAlgName}}},this.init=function(t,e){throw"init(key, pass) not supported for this alg:prov="+this.algProvName},this.updateString=function(t){throw"updateString(str) not supported for this alg:prov="+this.algProvName},this.updateHex=function(t){throw"updateHex(hex) not supported for this alg:prov="+this.algProvName},this.sign=function(){throw"sign() not supported for this alg:prov="+this.algProvName},this.signString=function(t){throw"digestString(str) not supported for this alg:prov="+this.algProvName},this.signHex=function(t){throw"digestHex(hex) not supported for this alg:prov="+this.algProvName},this.verify=function(t){throw"verify(hSigVal) not supported for this alg:prov="+this.algProvName},this.initParams=t,void 0!==t&&(void 0!==t.alg&&(this.algName=t.alg,void 0===t.prov?this.provName=ct.crypto.Util.DEFAULTPROVIDER[this.algName]:this.provName=t.prov,this.algProvName=this.algName+":"+this.provName,this.setAlgAndProvider(this.algName,this.provName),this._setAlgNames()),void 0!==t.psssaltlen&&(this.pssSaltLen=t.psssaltlen),void 0!==t.prvkeypem)){if(void 0!==t.prvkeypas)throw"both prvkeypem and prvkeypas parameters not supported";try{e=qt.getKey(t.prvkeypem),this.init(e)}catch(t){throw"fatal error to load pem private key: "+t}}},ct.crypto.Cipher=function(t){},ct.crypto.Cipher.encrypt=function(t,e,r){if(e instanceof nt&&e.isPublic){var n=ct.crypto.Cipher.getAlgByKeyAndName(e,r);if("RSA"===n)return e.encrypt(t);if("RSAOAEP"===n)return e.encryptOAEP(t,"sha1");var i=n.match(/^RSAOAEP(\d+)$/);if(null!==i)return e.encryptOAEP(t,"sha"+i[1]);throw"Cipher.encrypt: unsupported algorithm for RSAKey: "+r}throw"Cipher.encrypt: unsupported key or algorithm"},ct.crypto.Cipher.decrypt=function(t,e,r){if(e instanceof nt&&e.isPrivate){var n=ct.crypto.Cipher.getAlgByKeyAndName(e,r);if("RSA"===n)return e.decrypt(t);if("RSAOAEP"===n)return e.decryptOAEP(t,"sha1");var i=n.match(/^RSAOAEP(\d+)$/);if(null!==i)return e.decryptOAEP(t,"sha"+i[1]);throw"Cipher.decrypt: unsupported algorithm for RSAKey: "+r}throw"Cipher.decrypt: unsupported key or algorithm"},ct.crypto.Cipher.getAlgByKeyAndName=function(t,e){if(t instanceof nt){if(-1!=":RSA:RSAOAEP:RSAOAEP224:RSAOAEP256:RSAOAEP384:RSAOAEP512:".indexOf(e))return e;if(null==e)return"RSA";throw"getAlgByKeyAndName: not supported algorithm name for RSAKey: "+e}throw"getAlgByKeyAndName: not supported algorithm name: "+e},ct.crypto.OID=new function(){this.oidhex2name={"2a864886f70d010101":"rsaEncryption","2a8648ce3d0201":"ecPublicKey","2a8648ce380401":"dsa","2a8648ce3d030107":"secp256r1","2b8104001f":"secp192k1","2b81040021":"secp224r1","2b8104000a":"secp256k1","2b81040022":"secp384r1","2b81040023":"secp521r1","2a8648ce380403":"SHA1withDSA","608648016503040301":"SHA224withDSA","608648016503040302":"SHA256withDSA"}},void 0!==ct&&ct||(ct={}),void 0!==ct.crypto&&ct.crypto||(ct.crypto={}),ct.crypto.ECDSA=function(t){var e=Error,r=E,n=at,i=ct.crypto.ECDSA,s=ct.crypto.ECParameterDB,a=i.getName,o=ft,u=o.getVbyListEx,c=o.isASN1HEX,h=new tt;this.type="EC",this.isPrivate=!1,this.isPublic=!1,this.getBigRandom=function(t){return new r(t.bitLength(),h).mod(t.subtract(r.ONE)).add(r.ONE)},this.setNamedCurve=function(t){this.ecparams=s.getByName(t),this.prvKeyHex=null,this.pubKeyHex=null,this.curveName=t},this.setPrivateKeyHex=function(t){this.isPrivate=!0,this.prvKeyHex=t},this.setPublicKeyHex=function(t){this.isPublic=!0,this.pubKeyHex=t},this.getPublicKeyXYHex=function(){var t=this.pubKeyHex;if("04"!==t.substr(0,2))throw"this method supports uncompressed format(04) only";var e=this.ecparams.keycharlen;if(t.length!==2+2*e)throw"malformed public key hex length";var r={};return r.x=t.substr(2,e),r.y=t.substr(2+e),r},this.getShortNISTPCurveName=function(){var t=this.curveName;return"secp256r1"===t||"NIST P-256"===t||"P-256"===t||"prime256v1"===t?"P-256":"secp384r1"===t||"NIST P-384"===t||"P-384"===t?"P-384":"secp521r1"===t||"NIST P-521"===t||"P-521"===t?"P-521":null},this.generateKeyPairHex=function(){var t=this.ecparams.n,e=this.getBigRandom(t),r=this.ecparams.keycharlen,n=("0000000000"+e.toString(16)).slice(-r);return this.setPrivateKeyHex(n),{ecprvhex:n,ecpubhex:this.generatePublicKeyHex()}},this.generatePublicKeyHex=function(){var t=new r(this.prvKeyHex,16),e=this.ecparams.G.multiply(t),n=e.getX().toBigInteger(),i=e.getY().toBigInteger(),s=this.ecparams.keycharlen,a="04"+("0000000000"+n.toString(16)).slice(-s)+("0000000000"+i.toString(16)).slice(-s);return this.setPublicKeyHex(a),a},this.signWithMessageHash=function(t){return this.signHex(t,this.prvKeyHex)},this.signHex=function(t,e){var n=new r(e,16),s=this.ecparams.n,a=new r(t.substring(0,this.ecparams.keycharlen),16);do{var o=this.getBigRandom(s),u=this.ecparams.G.multiply(o).getX().toBigInteger().mod(s)}while(u.compareTo(r.ZERO)<=0);var c=o.modInverse(s).multiply(a.add(n.multiply(u))).mod(s);return i.biRSSigToASN1Sig(u,c)},this.sign=function(t,e){var n=e,i=this.ecparams.n,s=r.fromByteArrayUnsigned(t);do{var a=this.getBigRandom(i),o=this.ecparams.G.multiply(a).getX().toBigInteger().mod(i)}while(o.compareTo(E.ZERO)<=0);var u=a.modInverse(i).multiply(s.add(n.multiply(o))).mod(i);return this.serializeSig(o,u)},this.verifyWithMessageHash=function(t,e){return this.verifyHex(t,e,this.pubKeyHex)},this.verifyHex=function(t,e,s){try{var a,o,u=i.parseSigHex(e);a=u.r,o=u.s;var c=n.decodeFromHex(this.ecparams.curve,s),h=new r(t.substring(0,this.ecparams.keycharlen),16);return this.verifyRaw(h,a,o,c)}catch(t){return!1}},this.verify=function(t,e,i){var s,a,o;if(Bitcoin.Util.isArray(e)){var u=this.parseSig(e);s=u.r,a=u.s}else{if("object"!=typeof e||!e.r||!e.s)throw"Invalid value for signature";s=e.r,a=e.s}if(i instanceof at)o=i;else{if(!Bitcoin.Util.isArray(i))throw"Invalid format for pubkey value, must be byte array or ECPointFp";o=n.decodeFrom(this.ecparams.curve,i)}var c=r.fromByteArrayUnsigned(t);return this.verifyRaw(c,s,a,o)},this.verifyRaw=function(t,e,n,i){var s=this.ecparams.n,a=this.ecparams.G;if(e.compareTo(r.ONE)<0||e.compareTo(s)>=0)return!1;if(n.compareTo(r.ONE)<0||n.compareTo(s)>=0)return!1;var o=n.modInverse(s),u=t.multiply(o).mod(s),c=e.multiply(o).mod(s);return a.multiply(u).add(i.multiply(c)).getX().toBigInteger().mod(s).equals(e)},this.serializeSig=function(t,e){var r=t.toByteArraySigned(),n=e.toByteArraySigned(),i=[];return i.push(2),i.push(r.length),(i=i.concat(r)).push(2),i.push(n.length),(i=i.concat(n)).unshift(i.length),i.unshift(48),i},this.parseSig=function(t){var e;if(48!=t[0])throw new Error("Signature not a valid DERSequence");if(2!=t[e=2])throw new Error("First element in signature must be a DERInteger");var n=t.slice(e+2,e+2+t[e+1]);if(2!=t[e+=2+t[e+1]])throw new Error("Second element in signature must be a DERInteger");var i=t.slice(e+2,e+2+t[e+1]);return e+=2+t[e+1],{r:r.fromByteArrayUnsigned(n),s:r.fromByteArrayUnsigned(i)}},this.parseSigCompact=function(t){if(65!==t.length)throw"Signature has the wrong length";var e=t[0]-27;if(e<0||e>7)throw"Invalid signature type";var n=this.ecparams.n;return{r:r.fromByteArrayUnsigned(t.slice(1,33)).mod(n),s:r.fromByteArrayUnsigned(t.slice(33,65)).mod(n),i:e}},this.readPKCS5PrvKeyHex=function(t){if(!1===c(t))throw new Error("not ASN.1 hex string");var e,r,n;try{e=u(t,0,["[0]",0],"06"),r=u(t,0,[1],"04");try{n=u(t,0,["[1]",0],"03")}catch(t){}}catch(t){throw new Error("malformed PKCS#1/5 plain ECC private key")}if(this.curveName=a(e),void 0===this.curveName)throw"unsupported curve name";this.setNamedCurve(this.curveName),this.setPublicKeyHex(n),this.setPrivateKeyHex(r),this.isPublic=!1},this.readPKCS8PrvKeyHex=function(t){if(!1===c(t))throw new e("not ASN.1 hex string");var r,n,i;try{u(t,0,[1,0],"06"),r=u(t,0,[1,1],"06"),n=u(t,0,[2,0,1],"04");try{i=u(t,0,[2,0,"[1]",0],"03")}catch(t){}}catch(t){throw new e("malformed PKCS#8 plain ECC private key")}if(this.curveName=a(r),void 0===this.curveName)throw new e("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(i),this.setPrivateKeyHex(n),this.isPublic=!1},this.readPKCS8PubKeyHex=function(t){if(!1===c(t))throw new e("not ASN.1 hex string");var r,n;try{u(t,0,[0,0],"06"),r=u(t,0,[0,1],"06"),n=u(t,0,[1],"03")}catch(t){throw new e("malformed PKCS#8 ECC public key")}if(this.curveName=a(r),null===this.curveName)throw new e("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(n)},this.readCertPubKeyHex=function(t,r){if(!1===c(t))throw new e("not ASN.1 hex string");var n,i;try{n=u(t,0,[0,5,0,1],"06"),i=u(t,0,[0,5,1],"03")}catch(t){throw new e("malformed X.509 certificate ECC public key")}if(this.curveName=a(n),null===this.curveName)throw new e("unsupported curve name");this.setNamedCurve(this.curveName),this.setPublicKeyHex(i)},void 0!==t&&void 0!==t.curve&&(this.curveName=t.curve),void 0===this.curveName&&(this.curveName="secp256r1"),this.setNamedCurve(this.curveName),void 0!==t&&(void 0!==t.prv&&this.setPrivateKeyHex(t.prv),void 0!==t.pub&&this.setPublicKeyHex(t.pub))},ct.crypto.ECDSA.parseSigHex=function(t){var e=ct.crypto.ECDSA.parseSigHexInHexRS(t);return{r:new E(e.r,16),s:new E(e.s,16)}},ct.crypto.ECDSA.parseSigHexInHexRS=function(t){var e=ft,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)}},ct.crypto.ECDSA.asn1SigToConcatSig=function(t){var e=ct.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},ct.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 ct.crypto.ECDSA.hexRSSigToASN1Sig(e,r)},ct.crypto.ECDSA.hexRSSigToASN1Sig=function(t,e){var r=new E(t,16),n=new E(e,16);return ct.crypto.ECDSA.biRSSigToASN1Sig(r,n)},ct.crypto.ECDSA.biRSSigToASN1Sig=function(t,e){var r=ct.asn1,n=new r.DERInteger({bigint:t}),i=new r.DERInteger({bigint:e});return new r.DERSequence({array:[n,i]}).tohex()},ct.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!==ct&&ct||(ct={}),void 0!==ct.crypto&&ct.crypto||(ct.crypto={}),ct.crypto.ECParameterDB=new function(){var t={},e={};function r(t){return new E(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 ot(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;E<f.length;E++)e[f[E]]=n}},ct.crypto.ECParameterDB.regist("secp128r1",128,"FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFF","FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFC","E87579C11079F43DD824993C2CEE5ED3","FFFFFFFE0000000075A30D1B9038A115","1","161FF7528B899B2D0C28607CA52C5B86","CF5AC8395BAFEB13C02DA292DDED7A83",[],"","secp128r1 : SECG curve over a 128 bit prime field"),ct.crypto.ECParameterDB.regist("secp160k1",160,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73","0","7","0100000000000000000001B8FA16DFAB9ACA16B6B3","1","3B4C382CE37AA192A4019E763036F4F5DD4D7EBB","938CF935318FDCED6BC28286531733C3F03C4FEE",[],"","secp160k1 : SECG curve over a 160 bit prime field"),ct.crypto.ECParameterDB.regist("secp160r1",160,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC","1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45","0100000000000000000001F4C8F927AED3CA752257","1","4A96B5688EF573284664698968C38BB913CBFC82","23A628553168947D59DCC912042351377AC5FB32",[],"","secp160r1 : SECG curve over a 160 bit prime field"),ct.crypto.ECParameterDB.regist("secp192k1",192,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFEE37","0","3","FFFFFFFFFFFFFFFFFFFFFFFE26F2FC170F69466A74DEFD8D","1","DB4FF10EC057E9AE26B07D0280B7F4341DA5D1B1EAE06C7D","9B2F2F6D9C5628A7844163D015BE86344082AA88D95E2F9D",[]),ct.crypto.ECParameterDB.regist("secp192r1",192,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC","64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1","FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831","1","188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012","07192B95FFC8DA78631011ED6B24CDD573F977A11E794811",[]),ct.crypto.ECParameterDB.regist("secp224r1",224,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE","B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4","FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D","1","B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21","BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34",[]),ct.crypto.ECParameterDB.regist("secp256k1",256,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F","0","7","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141","1","79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798","483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8",[]),ct.crypto.ECParameterDB.regist("secp256r1",256,"FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF","FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC","5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B","FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551","1","6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296","4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5",["NIST P-256","P-256","prime256v1"]),ct.crypto.ECParameterDB.regist("secp384r1",384,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC","B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973","1","AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F25DBF55296C3A545E3872760AB7","3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f",["NIST P-384","P-384"]),ct.crypto.ECParameterDB.regist("secp521r1",521,"1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF","1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC","051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00","1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409","1","00C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5BD66","011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650",["NIST P-521","P-521"]),void 0!==ct&&ct||(ct={}),void 0!==ct.crypto&&ct.crypto||(ct.crypto={}),ct.crypto.DSA=function(){var t=ft,e=(t.getVbyList,t.getVbyListEx),r=t.isASN1HEX,n=E;this.p=null,this.q=null,this.g=null,this.y=null,this.x=null,this.type="DSA",this.isPrivate=!1,this.isPublic=!1,this.setPrivate=function(t,e,r,n,i){this.isPrivate=!0,this.p=t,this.q=e,this.g=r,this.y=n,this.x=i},this.setPrivateHex=function(t,e,r,n,i){var s,a,o,u,c;s=new E(t,16),a=new E(e,16),o=new E(r,16),u="string"==typeof n&&n.length>1?new E(n,16):null,c=new E(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 E(t,16),s=new E(e,16),a=new E(r,16),o=new E(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=ct.crypto.Util.getRandomBigIntegerMinToMax(E.ONE.add(E.ONE),r.subtract(E.ONE)),a=new E(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 ct.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 E(t.substr(0,n.bitLength()/4),16);if(E.ZERO.compareTo(o)>0||o.compareTo(n)>0)throw"invalid DSA signature";if(E.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 qt=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"},parseHexOfEncryptedPKCS8:function(t){var e=ft,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=qt.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)},getKeyFromEncryptedPKCS8PEM:function(t,e){var r=this._getPlainPKCS8HexFromEncryptedPKCS8PEM(t,e);return this.getKeyFromPlainPrivatePKCS8Hex(r)},parsePlainPrivatePKCS8Hex:function(t){var e=ft,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 nt;else if("2a8648ce380401"==r.algoid)e=new ct.crypto.DSA;else{if("2a8648ce3d0201"!=r.algoid)throw new Error("unsupported private key algorithm");e=new ct.crypto.ECDSA}return e.readPKCS8PrvKeyHex(t),e},_getKeyFromPublicPKCS8Hex:function(t){var e,r=ft.getVbyList(t,0,[0,0],"06");if("2a864886f70d010101"===r)e=new nt;else if("2a8648ce380401"===r)e=new ct.crypto.DSA;else{if("2a8648ce3d0201"!==r)throw new Error("unsupported PKCS#8 public key hex");e=new ct.crypto.ECDSA}return e.readPKCS8PubKeyHex(t),e},parsePublicRawRSAKeyHex:function(t){var e=ft,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=ft,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 Gt(t,e){for(var r="",n=e/4-t.length,i=0;i<n;i++)r+="0";return r+t}function $t(t,e,r){for(var n="",i=0;n.length<e;)n+=Et(r(St(t+String.fromCharCode.apply(String,[(4278190080&i)>>24,(16711680&i)>>16,(65280&i)>>8,255&i])))),i+=1;return n}function zt(t){for(var e in ct.crypto.Util.DIGESTINFOHEAD){var r=ct.crypto.Util.DIGESTINFOHEAD[e],n=r.length;if(t.substring(0,n)==r)return[e,t.substring(n)]}return[]}function Wt(t){var e,r=ft,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;try{e=ct.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||2<r)throw new Error("malformed version field");return this.version=r+1,this.version}return this.version=1,this.foffset=-1,1},this.getSerialNumberHex=function(){return u(this.hex,0,[0,0],"02")},this.getSignatureAlgorithmField=function(){var t=h(this.hex,0,[0,1]);return this.getAlgorithmIdentifierName(t)},this.getAlgorithmIdentifierName=function(t){for(var r in e)if(t===e[r])return r;return d(u(t,0,[0],"06"))},this.getIssuer=function(){return this.getX500Name(this.getIssuerHex())},this.getIssuerHex=function(){return c(this.hex,0,[0,3+this.foffset],"30")},this.getIssuerString=function(){return this.getIssuer().str},this.getSubject=function(){return this.getX500Name(this.getSubjectHex())},this.getSubjectHex=function(){return c(this.hex,0,[0,5+this.foffset],"30")},this.getSubjectString=function(){return this.getSubject().str},this.getNotBefore=function(){var t=o(this.hex,0,[0,4+this.foffset,0]);return t=t.replace(/(..)/g,"%$1"),decodeURIComponent(t)},this.getNotAfter=function(){var t=o(this.hex,0,[0,4+this.foffset,1]);return t=t.replace(/(..)/g,"%$1"),decodeURIComponent(t)},this.getPublicKeyHex=function(){return this.getSPKI()},this.getSPKI=function(){return c(this.hex,0,[0,6+this.foffset],"30")},this.getSPKIValue=function(){var t=this.getSPKI();return null==t?null:o(t,0,[1],"03",!0)},this.getPublicKeyIdx=function(){return l(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyContentIdx=function(){var t=this.getPublicKeyIdx();return l(this.hex,t,[1,0],"30")},this.getPublicKey=function(){return qt.getKey(this.getPublicKeyHex(),null,"pkcs8pub")},this.getSignatureAlgorithmName=function(){var t=c(this.hex,0,[1],"30");return this.getAlgorithmIdentifierName(t)},this.getSignatureValueHex=function(){return o(this.hex,0,[2],"03",!0)},this.verifySignature=function(t){var e=this.getSignatureAlgorithmField(),r=this.getSignatureValueHex(),n=c(this.hex,0,[0],"30"),i=new ct.crypto.Signature({alg:e});return i.init(t),i.updateHex(n),i.verify(r)},this.parseExt=function(t){var e,s,a;if(void 0===t){if(a=this.hex,3!==this.version)return-1;e=l(a,0,[0,7,0],"30"),s=n(a,e)}else{a=Bt(t);var u=l(a,0,[0,3,0,0],"06");if("2a864886f70d01090e"!=i(a,u))return void(this.aExtInfo=new Array);e=l(a,0,[0,3,0,1,0],"30"),s=n(a,e),this.hex=a}this.aExtInfo=new Array;for(var c=0;c<s.length;c++){var h={critical:!1},f=0;3===n(a,s[c]).length&&(h.critical=!0,f=1),h.oid=r.hextooidstr(o(a,s[c],[0],"06"));var g=l(a,s[c],[1+f]);h.vidx=p(a,g),this.aExtInfo.push(h)}},this.getExtInfo=function(t){var e=this.aExtInfo,r=t;if(t.match(/^[0-9.]+$/)||(r=ct.asn1.x509.OID.name2oid(t)),""!==r)for(var n=0;n<e.length;n++)if(e[n].oid===r)return e[n]},this.getExtBasicConstraints=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("basicConstraints");if(void 0===r)return;t=a(this.hex,r.vidx),e=r.critical}var n={extname:"basicConstraints"};if(e&&(n.critical=!0),"3000"===t)return n;if("30030101ff"===t)return n.cA=!0,n;if("30060101ff02"===t.substr(0,12)){var s=i(t,10),o=parseInt(s,16);return n.cA=!0,n.pathLen=o,n}throw new Error("hExtV parse error: "+t)},this.getExtNameConstraints=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("nameConstraints");if(void 0===r)return;t=a(this.hex,r.vidx),e=r.critical}var i={extname:"nameConstraints"};e&&(i.critical=!0);for(var s=n(t,0),o=0;o<s.length;o++){for(var u=[],c=n(t,s[o]),h=0;h<c.length;h++){var l=a(t,c[h]),f=this.getGeneralSubtree(l);u.push(f)}var p=t.substr(s[o],2);"a0"==p?i.permit=u:"a1"==p&&(i.exclude=u)}return i},this.getGeneralSubtree=function(t){var e=n(t,0),r=e.length;if(r<1||2<r)throw new Error("wrong num elements");for(var s=this.getGeneralName(a(t,e[0])),o=1;o<r;o++){var u=t.substr(e[o],2),c=i(t,e[o]),h=parseInt(c,16);"80"==u&&(s.min=h),"81"==u&&(s.max=h)}return s},this.getExtKeyUsage=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("keyUsage");if(void 0===r)return;t=a(this.hex,r.vidx),e=r.critical}var n={extname:"keyUsage"};return e&&(n.critical=!0),n.names=this.getExtKeyUsageString(t).split(","),n},this.getExtKeyUsageBin=function(t){if(void 0===t){var e=this.getExtInfo("keyUsage");if(void 0===e)return"";t=a(this.hex,e.vidx)}if(8!=t.length&&10!=t.length)throw new Error("malformed key usage value: "+t);var r="000000000000000"+parseInt(t.substr(6),16).toString(2);return 8==t.length&&(r=r.slice(-8)),10==t.length&&(r=r.slice(-16)),""==(r=r.replace(/0+$/,""))&&(r="0"),r},this.getExtKeyUsageString=function(t){for(var e=this.getExtKeyUsageBin(t),r=new Array,n=0;n<e.length;n++)"1"==e.substr(n,1)&&r.push(Wt.KEYUSAGE_NAME[n]);return r.join(",")},this.getExtSubjectKeyIdentifier=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("subjectKeyIdentifier");if(void 0===r)return;t=a(this.hex,r.vidx),e=r.critical}var n={extname:"subjectKeyIdentifier"};e&&(n.critical=!0);var s=i(t,0);return n.kid={hex:s},n},this.getExtAuthorityKeyIdentifier=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("authorityKeyIdentifier");if(void 0===r)return;t=a(this.hex,r.vidx),e=r.critical}var s={extname:"authorityKeyIdentifier"};e&&(s.critical=!0);for(var o=n(t,0),u=0;u<o.length;u++){var c=t.substr(o[u],2);if("80"===c&&(s.kid={hex:i(t,o[u])}),"a1"===c){var h=a(t,o[u]),l=this.getGeneralNames(h);s.issuer=l[0].dn}"82"===c&&(s.sn={hex:i(t,o[u])})}return s},this.getExtExtKeyUsage=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("extKeyUsage");if(void 0===r)return;t=a(this.hex,r.vidx),e=r.critical}var s={extname:"extKeyUsage",array:[]};e&&(s.critical=!0);for(var o=n(t,0),u=0;u<o.length;u++)s.array.push(d(i(t,o[u])));return s},this.getExtExtKeyUsageName=function(){var t=this.getExtInfo("extKeyUsage");if(void 0===t)return t;var e=new Array,r=a(this.hex,t.vidx);if(""===r)return e;for(var s=n(r,0),o=0;o<s.length;o++)e.push(d(i(r,s[o])));return e},this.getExtSubjectAltName=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("subjectAltName");if(void 0===r)return;t=a(this.hex,r.vidx),e=r.critical}var n={extname:"subjectAltName",array:[]};return e&&(n.critical=!0),n.array=this.getGeneralNames(t),n},this.getExtIssuerAltName=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("issuerAltName");if(void 0===r)return;t=a(this.hex,r.vidx),e=r.critical}var n={extname:"issuerAltName",array:[]};return e&&(n.critical=!0),n.array=this.getGeneralNames(t),n},this.getGeneralNames=function(t){for(var e=n(t,0),r=[],i=0;i<e.length;i++){var s=this.getGeneralName(a(t,e[i]));void 0!==s&&r.push(s)}return r},this.getGeneralName=function(t){var e=t.substr(0,2),r=i(t,0),n=Et(r);return"81"==e?{rfc822:n}:"82"==e?{dns:n}:"86"==e?{uri:n}:"87"==e?{ip:Tt(r)}:"a4"==e?{dn:this.getX500Name(r)}:"a0"==e?{other:this.getOtherName(t)}:void 0},this.getExtSubjectAltName2=function(){var t,e,r,s=this.getExtInfo("subjectAltName");if(void 0===s)return s;for(var o=new Array,u=a(this.hex,s.vidx),c=n(u,0),h=0;h<c.length;h++)r=u.substr(c[h],2),t=i(u,c[h]),"81"===r&&(e=wt(t),o.push(["MAIL",e])),"82"===r&&(e=wt(t),o.push(["DNS",e])),"84"===r&&(e=Wt.hex2dn(t,0),o.push(["DN",e])),"86"===r&&(e=wt(t),o.push(["URI",e])),"87"===r&&(e=Tt(t),o.push(["IP",e]));return o},this.getExtCRLDistributionPoints=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("cRLDistributionPoints");if(void 0===r)return;t=a(this.hex,r.vidx),e=r.critical}var i={extname:"cRLDistributionPoints",array:[]};e&&(i.critical=!0);for(var s=n(t,0),o=0;o<s.length;o++){var u=a(t,s[o]);i.array.push(this.getDistributionPoint(u))}return i},this.getDistributionPoint=function(t){for(var e={},r=n(t,0),i=0;i<r.length;i++){var s=t.substr(r[i],2),o=a(t,r[i]);"a0"==s&&(e.dpname=this.getDistributionPointName(o))}return e},this.getDistributionPointName=function(t){for(var e={},r=n(t,0),i=0;i<r.length;i++){var s=t.substr(r[i],2),o=a(t,r[i]);"a0"==s&&(e.full=this.getGeneralNames(o))}return e},this.getExtCRLDistributionPointsURI=function(){var t=this.getExtCRLDistributionPoints();if(null==t)return t;for(var e=t.array,r=[],n=0;n<e.length;n++)try{null!=e[n].dpname.full[0].uri&&r.push(e[n].dpname.full[0].uri)}catch(t){}return r},this.getExtAIAInfo=function(){var t=this.getExtInfo("authorityInfoAccess");if(void 0===t)return t;for(var e={ocsp:[],caissuer:[]},r=n(this.hex,t.vidx),i=0;i<r.length;i++){var s=o(this.hex,r[i],[0],"06"),a=o(this.hex,r[i],[1],"86");"2b06010505073001"===s&&e.ocsp.push(wt(a)),"2b06010505073002"===s&&e.caissuer.push(wt(a))}return e},this.getExtAuthorityInfoAccess=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("authorityInfoAccess");if(void 0===r)return;t=a(this.hex,r.vidx),e=r.critical}var i={extname:"authorityInfoAccess",array:[]};e&&(i.critical=!0);for(var s=n(t,0),c=0;c<s.length;c++){var h=u(t,s[c],[0],"06"),l=wt(o(t,s[c],[1],"86"));if("2b06010505073001"==h)i.array.push({ocsp:l});else{if("2b06010505073002"!=h)throw new Error("unknown method: "+h);i.array.push({caissuer:l})}}return i},this.getExtCertificatePolicies=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("certificatePolicies");if(void 0===r)return;t=a(this.hex,r.vidx),e=r.critical}var i={extname:"certificatePolicies",array:[]};e&&(i.critical=!0);for(var s=n(t,0),o=0;o<s.length;o++){var u=a(t,s[o]),c=this.getPolicyInformation(u);i.array.push(c)}return i},this.getPolicyInformation=function(t){var e={},r=o(t,0,[0],"06");e.policyoid=d(r);var i=f(t,0,[1],"30");if(-1!=i){e.array=[];for(var s=n(t,i),u=0;u<s.length;u++){var c=a(t,s[u]),h=this.getPolicyQualifierInfo(c);e.array.push(h)}}return e},this.getOtherName=function(t){var e={},r=n(t,0),i=o(t,r[0],[],"06"),a=o(t,r[1],[]);return e.oid=ct.asn1.ASN1Util.oidHexToInt(i),e.obj=s(a),e},this.getPolicyQualifierInfo=function(t){var e={},r=o(t,0,[0],"06");if("2b06010505070201"===r){var n=u(t,0,[1],"16");e.cps=Et(n)}else if("2b06010505070202"===r){var i=c(t,0,[1],"30");e.unotice=this.getUserNotice(i)}return e},this.getUserNotice=function(t){for(var e={},r=n(t,0),i=0;i<r.length;i++){var s=a(t,r[i]);"30"!=s.substr(0,2)&&(e.exptext=this.getDisplayText(s))}return e},this.getDisplayText=function(t){var e={};return e.type={"0c":"utf8",16:"ia5","1a":"vis","1e":"bmp"}[t.substr(0,2)],e.str=Et(i(t,0)),e},this.getExtCRLNumber=function(t,e){var r={extname:"cRLNumber"};if(e&&(r.critical=!0),"02"==t.substr(0,2))return r.num={hex:i(t,0)},r;throw new Error("hExtV parse error: "+t)},this.getExtCRLReason=function(t,e){var r={extname:"cRLReason"};if(e&&(r.critical=!0),"0a"==t.substr(0,2))return r.code=parseInt(i(t,0),16),r;throw new Error("hExtV parse error: "+t)},this.getExtOcspNonce=function(t,e){var r={extname:"ocspNonce"};e&&(r.critical=!0);var n=i(t,0);return r.hex=n,r},this.getExtOcspNoCheck=function(t,e){var r={extname:"ocspNoCheck"};return e&&(r.critical=!0),r},this.getExtAdobeTimeStamp=function(t,e){if(void 0===t&&void 0===e){var r=this.getExtInfo("adobeTimeStamp");if(void 0===r)return;t=a(this.hex,r.vidx),e=r.critical}var i={extname:"adobeTimeStamp"};e&&(i.critical=!0);var s=n(t,0);if(s.length>1){var o=a(t,s[1]),u=this.getGeneralName(o);null!=u.uri&&(i.uri=u.uri)}if(s.length>2){var c=a(t,s[2]);"0101ff"==c&&(i.reqauth=!0),"010100"==c&&(i.reqauth=!1)}return i};var y=function(t){var e={};try{var r=t.seq[0].oid,n=ct.asn1.x509.OID.name2oid(r);e.type=ct.asn1.x509.OID.oid2atype(n);var i=t.seq[1];if(null!=i.utf8str)e.ds="utf8",e.value=i.utf8str.str;else if(null!=i.numstr)e.ds="num",e.value=i.numstr.str;else if(null!=i.telstr)e.ds="tel",e.value=i.telstr.str;else if(null!=i.prnstr)e.ds="prn",e.value=i.prnstr.str;else if(null!=i.ia5str)e.ds="ia5",e.value=i.ia5str.str;else if(null!=i.visstr)e.ds="vis",e.value=i.visstr.str;else{if(null==i.bmpstr)throw"error";e.ds="bmp",e.value=i.bmpstr.str}return e}catch(t){throw new Erorr("improper ASN.1 parsed AttrTypeAndValue")}},x=function(t){try{return t.set.map((function(t){return y(t)}))}catch(t){throw new Error("improper ASN.1 parsed RDN: "+t)}};this.getX500NameRule=function(t){for(var e=null,r=[],n=0;n<t.length;n++)for(var i=t[n],s=0;s<i.length;s++)r.push(i[s]);for(n=0;n<r.length;n++){var a=r[n],o=a.ds,u=a.value,c=a.type;if("prn"!=o&&"utf8"!=o&&"ia5"!=o)return"mixed";if("ia5"==o){if("CN"!=c)return"mixed";if(ct.lang.String.isMail(u))continue;return"mixed"}if("C"==c){if("prn"==o)continue;return"mixed"}if(null==e)e=o;else if(e!==o)return"mixed"}return null==e?"prn":e},this.getAttrTypeAndValue=function(t){var e=s(t);return y(e)},this.getRDN=function(t){var e=s(t);return x(e)},this.getX500NameArray=function(t){return function(t){try{return t.seq.map((function(t){return x(t)}))}catch(t){throw new Error("improper ASN.1 parsed X500Name: "+t)}}(s(t))},this.getX500Name=function(t){var e=this.getX500NameArray(t);return{array:e,str:this.dnarraytostr(e)}},this.readCertPEM=function(t){this.readCertHex(v(t))},this.readCertHex=function(t){this.hex=t,this.getVersion();try{l(this.hex,0,[0,7],"a3"),this.parseExt()}catch(t){}},this.getParam=function(t){var e={};return e.version=this.getVersion(),e.serial={hex:this.getSerialNumberHex()},e.sigalg=this.getSignatureAlgorithmField(),e.issuer=this.getIssuer(),e.notbefore=this.getNotBefore(),e.notafter=this.getNotAfter(),e.subject=this.getSubject(),e.sbjpubkey=At(this.getPublicKeyHex(),"PUBLIC KEY"),this.aExtInfo.length>0&&(e.ext=this.getExtParamArray()),e.sighex=this.getSignatureValueHex(),"object"==typeof t&&(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;i<r.length;i++){var s=a(t,r[i]),o=this.getExtParam(s);null!=o&&e.push(o)}return e},this.getExtParam=function(t){var e=n(t,0).length;if(2!=e&&3!=e)throw new Error("wrong number elements in Extension: "+e+" "+t);var r=m(o(t,0,[0],"06")),i=!1;3==e&&"0101ff"==c(t,0,[1])&&(i=!0);var s=c(t,0,[e-1,0]),a=void 0;if("2.5.29.14"==r?a=this.getExtSubjectKeyIdentifier(s,i):"2.5.29.15"==r?a=this.getExtKeyUsage(s,i):"2.5.29.17"==r?a=this.getExtSubjectAltName(s,i):"2.5.29.18"==r?a=this.getExtIssuerAltName(s,i):"2.5.29.19"==r?a=this.getExtBasicConstraints(s,i):"2.5.29.30"==r?a=this.getExtNameConstraints(s,i):"2.5.29.31"==r?a=this.getExtCRLDistributionPoints(s,i):"2.5.29.32"==r?a=this.getExtCertificatePolicies(s,i):"2.5.29.35"==r?a=this.getExtAuthorityKeyIdentifier(s,i):"2.5.29.37"==r?a=this.getExtExtKeyUsage(s,i):"1.3.6.1.5.5.7.1.1"==r?a=this.getExtAuthorityInfoAccess(s,i):"2.5.29.20"==r?a=this.getExtCRLNumber(s,i):"2.5.29.21"==r?a=this.getExtCRLReason(s,i):"1.3.6.1.5.5.7.48.1.2"==r?a=this.getExtOcspNonce(s,i):"1.3.6.1.5.5.7.48.1.5"==r?a=this.getExtOcspNoCheck(s,i):"1.2.840.113583.1.1.9.1"==r&&(a=this.getExtAdobeTimeStamp(s,i)),null!=a)return a;var u={extname:r,extn:s};return i&&(u.critical=!0),u},this.findExt=function(t,e){for(var r=0;r<t.length;r++)if(t[r].extname==e)return t[r];return null},this.updateExtCDPFullURI=function(t,e){var r=this.findExt(t,"cRLDistributionPoints");if(null!=r&&null!=r.array)for(var n=r.array,i=0;i<n.length;i++)if(null!=n[i].dpname&&null!=n[i].dpname.full)for(var s=n[i].dpname.full,a=0;a<s.length;a++){var o=s[i];null!=o.uri&&(o.uri=e)}},this.updateExtAIAOCSP=function(t,e){var r=this.findExt(t,"authorityInfoAccess");if(null!=r&&null!=r.array)for(var n=r.array,i=0;i<n.length;i++)null!=n[i].ocsp&&(n[i].ocsp=e)},this.updateExtAIACAIssuer=function(t,e){var r=this.findExt(t,"authorityInfoAccess");if(null!=r&&null!=r.array)for(var n=r.array,i=0;i<n.length;i++)null!=n[i].caissuer&&(n[i].caissuer=e)},this.dnarraytostr=function(t){return"/"+t.map((function(t){return function(t){return t.map((function(t){return function(t){return t.type+"="+t.value}(t).replace(/\+/,"\\+")})).join("+")}(t).replace(/\//,"\\/")})).join("/")},this.getInfo=function(){var t,e,r,n,i=function(t){for(var e="",r=t.array,n=0;n<r.length;n++){var i=r[n];if(e+="    policy oid: "+i.policyoid+"\n",void 0!==i.array)for(var s=0;s<i.array.length;s++){var a=i.array[s];void 0!==a.cps&&(e+="    cps: "+a.cps+"\n")}}return e},s=function(t){for(var e="",r=t.array,n=0;n<r.length;n++){var i=r[n];try{void 0!==i.dpname.full[0].uri&&(e+="    "+i.dpname.full[0].uri+"\n")}catch(t){}try{void 0!==i.dname.full[0].dn.hex&&(e+="    "+Wt.hex2dn(i.dpname.full[0].dn.hex)+"\n")}catch(t){}}return e},a=function(t){for(var e="",r=t.array,n=0;n<r.length;n++){var i=r[n];void 0!==i.caissuer&&(e+="    caissuer: "+i.caissuer+"\n"),void 0!==i.ocsp&&(e+="    ocsp: "+i.ocsp+"\n")}return e};if(t="Basic Fields\n",t+="  serial number: "+this.getSerialNumberHex()+"\n",t+="  signature algorithm: "+this.getSignatureAlgorithmField()+"\n",t+="  issuer: "+this.getIssuerString()+"\n",t+="  notBefore: "+this.getNotBefore()+"\n",t+="  notAfter: "+this.getNotAfter()+"\n",t+="  subject: "+this.getSubjectString()+"\n",t+="  subject public key info: \n",t+="    key algorithm: "+(e=this.getPublicKey()).type+"\n","RSA"===e.type&&(t+="    n="+Vt(e.n.toString(16)).substr(0,16)+"...\n",t+="    e="+Vt(e.e.toString(16))+"\n"),null!=(r=this.aExtInfo)){t+="X509v3 Extensions:\n";for(var o=0;o<r.length;o++){var u=r[o],c=ct.asn1.x509.OID.oid2name(u.oid);""===c&&(c=u.oid);var h="";if(!0===u.critical&&(h="CRITICAL"),t+="  "+c+" "+h+":\n","basicConstraints"===c){var l=this.getExtBasicConstraints();void 0===l.cA?t+="    {}\n":(t+="    cA=true",void 0!==l.pathLen&&(t+=", pathLen="+l.pathLen),t+="\n")}else if("keyUsage"===c)t+="    "+this.getExtKeyUsageString()+"\n";else if("subjectKeyIdentifier"===c)t+="    "+this.getExtSubjectKeyIdentifier().kid.hex+"\n";else if("authorityKeyIdentifier"===c){var f=this.getExtAuthorityKeyIdentifier();void 0!==f.kid&&(t+="    kid="+f.kid.hex+"\n")}else"extKeyUsage"===c?t+="    "+this.getExtExtKeyUsage().array.join(", ")+"\n":"subjectAltName"===c?t+="    "+(n=this.getExtSubjectAltName(),JSON.stringify(n.array).replace(/[\[\]\{\}\"]/g,"")+"\n"):"cRLDistributionPoints"===c?t+=s(this.getExtCRLDistributionPoints()):"authorityInfoAccess"===c?t+=a(this.getExtAuthorityInfoAccess()):"certificatePolicies"===c&&(t+=i(this.getExtCertificatePolicies()))}}return(t+="signature algorithm: "+this.getSignatureAlgorithmName()+"\n")+"signature: "+this.getSignatureValueHex().substr(0,16)+"...\n"},"string"==typeof t&&(-1!=t.indexOf("-----BEGIN")?this.readCertPEM(t):ct.lang.String.isHex(t)&&this.readCertHex(t))}qt.getKey=function(t,e,r){var n,i=(v=ft).getChildIdx,s=(v.getV,v.getVbyList),a=ct.crypto,o=a.ECDSA,u=a.DSA,c=nt,h=Bt,l=qt;if(void 0!==c&&t instanceof c)return t;if(void 0!==o&&t instanceof o)return t;if(void 0!==u&&t instanceof u)return t;if(void 0!==t.curve&&void 0!==t.xy&&void 0===t.d)return new o({pub:t.xy,curve:t.curve});if(void 0!==t.curve&&void 0!==t.d)return new o({prv:t.d,curve:t.curve});if(void 0===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0===t.d)return(C=new c).setPublic(t.n,t.e),C;if(void 0===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d&&void 0!==t.p&&void 0!==t.q&&void 0!==t.dp&&void 0!==t.dq&&void 0!==t.co&&void 0===t.qi)return(C=new c).setPrivateEx(t.n,t.e,t.d,t.p,t.q,t.dp,t.dq,t.co),C;if(void 0===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d&&void 0===t.p)return(C=new c).setPrivate(t.n,t.e,t.d),C;if(void 0!==t.p&&void 0!==t.q&&void 0!==t.g&&void 0!==t.y&&void 0===t.x)return(C=new u).setPublic(t.p,t.q,t.g,t.y),C;if(void 0!==t.p&&void 0!==t.q&&void 0!==t.g&&void 0!==t.y&&void 0!==t.x)return(C=new u).setPrivate(t.p,t.q,t.g,t.y,t.x),C;if("RSA"===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0===t.d)return(C=new c).setPublic(yt(t.n),yt(t.e)),C;if("RSA"===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d&&void 0!==t.p&&void 0!==t.q&&void 0!==t.dp&&void 0!==t.dq&&void 0!==t.qi)return(C=new c).setPrivateEx(yt(t.n),yt(t.e),yt(t.d),yt(t.p),yt(t.q),yt(t.dp),yt(t.dq),yt(t.qi)),C;if("RSA"===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d)return(C=new c).setPrivate(yt(t.n),yt(t.e),yt(t.d)),C;if("EC"===t.kty&&void 0!==t.crv&&void 0!==t.x&&void 0!==t.y&&void 0===t.d){var f=(D=new o({curve:t.crv})).ecparams.keycharlen,p="04"+("0000000000"+yt(t.x)).slice(-f)+("0000000000"+yt(t.y)).slice(-f);return D.setPublicKeyHex(p),D}if("EC"===t.kty&&void 0!==t.crv&&void 0!==t.x&&void 0!==t.y&&void 0!==t.d){f=(D=new o({curve:t.crv})).ecparams.keycharlen,p="04"+("0000000000"+yt(t.x)).slice(-f)+("0000000000"+yt(t.y)).slice(-f);var g=("0000000000"+yt(t.d)).slice(-f);return D.setPublicKeyHex(p),D.setPrivateKeyHex(g),D}if("pkcs5prv"===r){var d,m=t,v=ft;if(9===(d=i(m,0)).length)(C=new c).readPKCS5PrvKeyHex(m);else if(6===d.length)(C=new u).readPKCS5PrvKeyHex(m);else{if(!(d.length>2&&"04"===m.substr(d[1],2)))throw new Error("unsupported PKCS#1/5 hexadecimal key");(C=new o).readPKCS5PrvKeyHex(m)}return C}if("pkcs8prv"===r)return l.getKeyFromPlainPrivatePKCS8Hex(t);if("pkcs8pub"===r)return l._getKeyFromPublicPKCS8Hex(t);if("x509pub"===r)return Wt.getPublicKeyFromCertHex(t);if(-1!=t.indexOf("-END CERTIFICATE-",0)||-1!=t.indexOf("-END X509 CERTIFICATE-",0)||-1!=t.indexOf("-END TRUSTED CERTIFICATE-",0))return Wt.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"),S=s(n,0,[3],"02"),F=s(n,0,[4],"02"),A=s(n,0,[5],"02");return(C=new u).setPrivate(new E(w,16),new E(b,16),new E(S,16),new E(F,16),new E(A,16)),C}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 nt;return I.readPKCS5PrvKeyHex(B),I}if(-1!=t.indexOf("-END EC PRIVATE KEY-")&&-1!=t.indexOf("4,ENCRYPTED")){var D,C=s(n=l.getDecryptedKeyHex(t,e),0,[1],"04"),R=s(n,0,[2,0],"06"),P=s(n,0,[3,0],"03").substr(2);if(void 0===ct.crypto.OID.oidhex2name[R])throw new Error("undefined OID(hex) in KJUR.crypto.OID: "+R);return(D=new o({curve:ct.crypto.OID.oidhex2name[R]})).setPublicKeyHex(P),D.setPrivateKeyHex(C),D.isPublic=!1,D}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"),S=s(n,0,[3],"02"),F=s(n,0,[4],"02"),A=s(n,0,[5],"02"),(C=new u).setPrivate(new E(w,16),new E(b,16),new E(S,16),new E(F,16),new E(A,16)),C;if(-1!=t.indexOf("-END ENCRYPTED PRIVATE KEY-"))return l.getKeyFromEncryptedPKCS8PEM(t,e);throw new Error("not supported argument")},qt.generateKeypair=function(t,e){if("RSA"==t){var r=e;(a=new nt).generate(r,"10001"),a.isPrivate=!0,a.isPublic=!0;var n=new nt,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 ct.crypto.ECDSA({curve:u}).generateKeyPairHex();return(a=new ct.crypto.ECDSA({curve:u})).setPublicKeyHex(c.ecpubhex),a.setPrivateKeyHex(c.ecprvhex),a.isPrivate=!0,a.isPublic=!1,(n=new ct.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)},qt.getPEM=function(t,e,r,n,i,s){var a=ct,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=nt;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 y(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 x(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(S=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(S=m(t).tohex(),"RSA PRIVATE KEY");if("PKCS1PRV"==e&&void 0!==g&&t instanceof g&&(void 0===r||null==r)&&1==t.isPrivate){var w=new u({name:t.curveName}).tohex(),b=y(t).tohex(),E="";return(E+=At(w,"EC PARAMETERS"))+At(b,"EC PRIVATE KEY")}if("PKCS1PRV"==e&&void 0!==p&&t instanceof p&&(void 0===r||null==r)&&1==t.isPrivate)return At(S=x(t).tohex(),"DSA PRIVATE KEY");if("PKCS5PRV"==e&&void 0!==d&&t instanceof d&&void 0!==r&&null!=r&&1==t.isPrivate){var S=m(t).tohex();return void 0===n&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",S,r,n,s)}if("PKCS5PRV"==e&&void 0!==g&&t instanceof g&&void 0!==r&&null!=r&&1==t.isPrivate)return S=y(t).tohex(),void 0===n&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",S,r,n,s);if("PKCS5PRV"==e&&void 0!==p&&t instanceof p&&void 0!==r&&null!=r&&1==t.isPrivate)return S=x(t).tohex(),void 0===n&&(n="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",S,r,n,s);var F=function(t,e){var r=A(t,e);return new h({seq:[{seq:[{oid:{name:"pkcs5PBES2"}},{seq:[{seq:[{oid:{name:"pkcs5PBKDF2"}},{seq:[{octstr:{hex:r.pbkdf2Salt}},{int:r.pbkdf2Iter}]}]},{seq:[{oid:{name:"des-EDE3-CBC"}},{octstr:{hex:r.encryptionSchemeIV}}]}]}]},{octstr:{hex:r.ciphertext}}]}).tohex()},A=function(t,e){var r=v.lib.WordArray.random(8),n=v.lib.WordArray.random(8),i=v.PBKDF2(e,r,{keySize:6,iterations:100}),s=v.enc.Hex.parse(t),a=v.TripleDES.encrypt(s,i,{iv:n})+"",o={};return o.ciphertext=a,o.pbkdf2Salt=v.enc.Hex.stringify(r),o.pbkdf2Iter=100,o.encryptionSchemeAlg="DES-EDE3-CBC",o.encryptionSchemeIV=v.enc.Hex.stringify(n),o};if("PKCS8PRV"==e&&null!=d&&t instanceof d&&1==t.isPrivate){var B=m(t).tohex();return S=h({seq:[{int:0},{seq:[{oid:{name:"rsaEncryption"}},{null:!0}]},{octstr:{hex:B}}]}).tohex(),void 0===r||null==r?At(S,"PRIVATE KEY"):At(b=F(S,r),"ENCRYPTED PRIVATE KEY")}if("PKCS8PRV"==e&&void 0!==g&&t instanceof g&&1==t.isPrivate){var I={seq:[{int:1},{octstr:{hex:t.prvKeyHex}}]};return"string"==typeof t.pubKeyHex&&I.seq.push({tag:["a1",!0,{bitstr:{hex:"00"+t.pubKeyHex}}]}),B=new h(I).tohex(),S=h({seq:[{int:0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:t.curveName}}]},{octstr:{hex:B}}]}).tohex(),void 0===r||null==r?At(S,"PRIVATE KEY"):At(b=F(S,r),"ENCRYPTED PRIVATE KEY")}if("PKCS8PRV"==e&&void 0!==p&&t instanceof p&&1==t.isPrivate)return B=new c({bigint:t.x}).tohex(),S=h({seq:[{int:0},{seq:[{oid:{name:"dsa"}},{seq:[{int:{bigint:t.p}},{int:{bigint:t.q}},{int:{bigint:t.g}}]}]},{octstr:{hex:B}}]}).tohex(),void 0===r||null==r?At(S,"PRIVATE KEY"):At(b=F(S,r),"ENCRYPTED PRIVATE KEY");throw new Error("unsupported object nor format")},qt.getKeyFromCSRPEM=function(t){var e=Bt(t,"CERTIFICATE REQUEST");return qt.getKeyFromCSRHex(e)},qt.getKeyFromCSRHex=function(t){var e=qt.parseCSRHex(t);return qt.getKey(e.p8pubkeyhex,null,"pkcs8pub")},qt.parseCSRHex=function(t){var e=ft,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},qt.getKeyID=function(t){var e=qt,r=ft;"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 ct.crypto.Util.hashHex(s,"sha1")},qt.getJWK=function(t,e,r,n,i){var s,a,o={},u=ct.crypto.Util.hashHex;if("string"==typeof t)s=qt.getKey(t),-1!=t.indexOf("CERTIFICATE")&&(a=Bt(t));else{if("object"!=typeof t)throw new Error("unsupported keyinfo type");t instanceof Wt?(s=t.getPublicKey(),a=t.hex):s=t}if(s instanceof nt&&s.isPrivate)o.kty="RSA",o.n=vt(s.n.toString(16)),o.e=vt(s.e.toString(16)),o.d=vt(s.d.toString(16)),o.p=vt(s.p.toString(16)),o.q=vt(s.q.toString(16)),o.dp=vt(s.dmp1.toString(16)),o.dq=vt(s.dmq1.toString(16)),o.qi=vt(s.coeff.toString(16));else if(s instanceof nt&&s.isPublic)o.kty="RSA",o.n=vt(s.n.toString(16)),o.e=vt(s.e.toString(16));else if(s instanceof ct.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=vt(c.x),o.y=vt(c.y),o.d=vt(s.prvKeyHex)}else if(s instanceof ct.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=vt(c.x),o.y=vt(c.y)}if(null==o.kty)throw new Error("unsupported keyinfo");return s.isPrivate||1==e||(o.kid=ct.jws.JWS.getJWKthumbprint(o)),null!=a&&1!=r&&(o.x5c=[w(a)]),null!=a&&1!=n&&(o.x5t=dt(w(u(a,"sha1")))),null!=a&&1!=i&&(o["x5t#S256"]=dt(w(u(a,"sha256")))),o},qt.getJWKFromKey=function(t){return qt.getJWK(t,!0,!0,!0,!0)},nt.getPosArrayOfChildrenFromHex=function(t){return ft.getChildIdx(t,0)},nt.getHexValueArrayOfChildrenFromHex=function(t){var e,r=ft.getV,n=r(t,(e=nt.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},nt.prototype.readPrivateKeyFromPEMString=function(t){var e=Bt(t),r=nt.getHexValueArrayOfChildrenFromHex(e);this.setPrivateEx(r[1],r[2],r[3],r[4],r[5],r[6],r[7],r[8])},nt.prototype.readPKCS5PrvKeyHex=function(t){var e=nt.getHexValueArrayOfChildrenFromHex(t);this.setPrivateEx(e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},nt.prototype.readPKCS8PrvKeyHex=function(t){var e,r,n,i,s,a,o,u,c=ft,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)},nt.prototype.readPKCS5PubKeyHex=function(t){var e=ft,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)},nt.prototype.readPKCS8PubKeyHex=function(t){var e=ft;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)},nt.prototype.readCertPubKeyHex=function(t,e){var r,n;(r=new Wt).readCertHex(t),n=r.getPublicKeyHex(),this.readPKCS8PubKeyHex(n)},nt.prototype.sign=function(t,e){var r=function(t){return ct.crypto.Util.hashString(t,e)}(t);return this.signWithMessageHash(r,e)},nt.prototype.signWithMessageHash=function(t,e){var r=et(ct.crypto.Util.getPaddedDigestInfoHex(t,e,this.n.bitLength()),16);return Gt(this.doPrivate(r).toString(16),this.n.bitLength())},nt.prototype.signPSS=function(t,e,r){var n,i=(n=St(t),ct.crypto.Util.hashHex(n,e));return void 0===r&&(r=-1),this.signWithMessageHashPSS(i,e,r)},nt.prototype.signWithMessageHashPSS=function(t,e,r){var n,i=Et(t),s=i.length,a=this.n.bitLength()-1,o=Math.ceil(a/8),u=function(t){return ct.crypto.Util.hashHex(t,e)};if(-1===r||void 0===r)r=s;else if(-2===r)r=o-s-2;else if(r<-2)throw new Error("invalid salt length");if(o<s+r+2)throw new Error("data too long");var c="";r>0&&(c=new Array(r),(new tt).nextBytes(c),c=String.fromCharCode.apply(String,c));var h=Et(u(St("\0\0\0\0\0\0\0\0"+i+c))),l=[];for(n=0;n<o-r-s-2;n+=1)l[n]=0;var f=String.fromCharCode.apply(String,l)+""+c,p=$t(h,f.length,u),g=[];for(n=0;n<f.length;n+=1)g[n]=f.charCodeAt(n)^p.charCodeAt(n);var d=65280>>8*o-a&255;for(g[0]&=~d,n=0;n<s;n++)g.push(h.charCodeAt(n));return g.push(188),Gt(this.doPrivate(new E(g)).toString(16),this.n.bitLength())},nt.prototype.verify=function(t,e){if(null==(e=e.toLowerCase()).match(/^[0-9a-f]+$/))return!1;var r=et(e,16),n=this.n.bitLength();if(r.bitLength()>n)return!1;var i=this.doPublic(r).toString(16);if(i.length+3!=n/4)return!1;var s=zt(i.replace(/^1f+00/,""));if(0==s.length)return!1;var a=s[0],o=s[1],u=function(t){return ct.crypto.Util.hashString(t,a)}(t);return o==u},nt.prototype.verifyWithMessageHash=function(t,e){if(e.length!=Math.ceil(this.n.bitLength()/4))return!1;var r=et(e,16);if(r.bitLength()>this.n.bitLength())return 0;var n=zt(this.doPublic(r).toString(16).replace(/^1f+00/,""));return 0!=n.length&&(n[0],n[1]==t)},nt.prototype.verifyPSS=function(t,e,r,n){var i,s=(i=St(t),ct.crypto.Util.hashHex(i,r));return void 0===n&&(n=-1),this.verifyWithMessageHashPSS(s,e,r,n)},nt.prototype.verifyWithMessageHashPSS=function(t,e,r,n){if(e.length!=Math.ceil(this.n.bitLength()/4))return!1;var i,s=new E(e,16),a=function(t){return ct.crypto.Util.hashHex(t,r)},o=Et(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<u+n+2)throw new Error("data too long");var l=this.doPublic(s).toByteArray();for(i=0;i<l.length;i+=1)l[i]&=255;for(;l.length<h;)l.unshift(0);if(188!==l[h-1])throw new Error("encoded message does not end in 0xbc");var f=(l=String.fromCharCode.apply(String,l)).substr(0,h-u-1),p=l.substr(f.length,u),g=65280>>8*h-c&255;if(0!=(f.charCodeAt(0)&g))throw new Error("bits beyond keysize not zero");var d=$t(p,f.length,a),m=[];for(i=0;i<f.length;i+=1)m[i]=f.charCodeAt(i)^d.charCodeAt(i);m[0]&=~g;var v=h-u-n-2;for(i=0;i<v;i+=1)if(0!==m[i])throw new Error("leftmost octets not zero");if(1!==m[v])throw new Error("0x01 marker not found");return p===Et(a(St("\0\0\0\0\0\0\0\0"+o+String.fromCharCode.apply(String,m.slice(-n)))))},nt.SALT_LEN_HLEN=-1,nt.SALT_LEN_MAX=-2,nt.SALT_LEN_RECOVER=-2,Wt.hex2dn=function(t,e){void 0===e&&(e=0);var r=new Wt;return ft.getTLV(t,e),r.getX500Name(t).str},Wt.hex2rdn=function(t,e){if(void 0===e&&(e=0),"31"!==t.substr(e,2))throw new Error("malformed RDN");for(var r=new Array,n=ft.getChildIdx(t,e),i=0;i<n.length;i++)r.push(Wt.hex2attrTypeValue(t,n[i]));return r=r.map((function(t){return t.replace("+","\\+")})),r.join("+")},Wt.hex2attrTypeValue=function(t,e){var r=ft,n=r.getV;if(void 0===e&&(e=0),"30"!==t.substr(e,2))throw new Error("malformed attribute type and value");var i=r.getChildIdx(t,e);2!==i.length||t.substr(i[0],2);var s=n(t,i[0]),a=ct.asn1.ASN1Util.oidHexToInt(s);return ct.asn1.x509.OID.oid2atype(a)+"="+Et(n(t,i[1]))},Wt.getPublicKeyFromCertHex=function(t){var e=new Wt;return e.readCertHex(t),e.getPublicKey()},Wt.getPublicKeyFromCertPEM=function(t){var e=new Wt;return e.readCertPEM(t),e.getPublicKey()},Wt.getPublicKeyInfoPropOfCertPEM=function(t){var e,r,n=ft.getVbyList,i={algparam:null};return(e=new Wt).readCertPEM(t),r=e.getPublicKeyHex(),i.keyhex=n(r,0,[1],"03").substr(2),i.algoid=n(r,0,[0,0],"06"),"2a8648ce3d0201"===i.algoid&&(i.algparam=n(r,0,[0,1],"06")),i},Wt.KEYUSAGE_NAME=["digitalSignature","nonRepudiation","keyEncipherment","dataEncipherment","keyAgreement","keyCertSign","cRLSign","encipherOnly","decipherOnly"],void 0!==ct&&ct||(ct={}),void 0!==ct.jws&&ct.jws||(ct.jws={}),ct.jws.JWS=function(){var t=ct.jws.JWS.isSafeJSONString;this.parseJWS=function(e,r){if(void 0===this.parsedJWS||!r&&void 0===this.parsedJWS.sigvalH){var n=e.match(/^([^.]+)\.([^.]+)\.([^.]+)$/);if(null==n)throw"JWS signature is not a form of 'Head.Payload.SigValue'.";var i=n[1],s=n[2],a=n[3],o=i+"."+s;if(this.parsedJWS={},this.parsedJWS.headB64U=i,this.parsedJWS.payloadB64U=s,this.parsedJWS.sigvalB64U=a,this.parsedJWS.si=o,!r){var u=yt(a),c=et(u,16);this.parsedJWS.sigvalH=u,this.parsedJWS.sigvalBI=c}var h=lt(i),l=lt(s);if(this.parsedJWS.headS=h,this.parsedJWS.payloadS=l,!t(h,this.parsedJWS,"headP"))throw"malformed JSON string for JWS Head: "+h}}},ct.jws.JWS.sign=function(t,e,r,n,i){var s,a,o,u=ct,c=u.jws.JWS,h=c.readSafeJSONString,l=c.isSafeJSONString,f=u.crypto,p=(f.ECDSA,f.Mac),g=f.Signature,d=JSON;if("string"!=typeof e&&"object"!=typeof e)throw"spHeader must be JSON string or object: "+e;if("object"==typeof e&&(a=e,s=d.stringify(a)),"string"==typeof e){if(!l(s=e))throw"JWS Head is not safe JSON string: "+s;a=h(s)}if(o=r,"object"==typeof r&&(o=d.stringify(r)),""!=t&&null!=t||void 0===a.alg||(t=a.alg),""!=t&&null!=t&&void 0===a.alg&&(a.alg=t,s=d.stringify(a)),t!==a.alg)throw"alg and sHeader.alg doesn't match: "+t+"!="+a.alg;var m=null;if(void 0===c.jwsalg2sigalg[t])throw"unsupported alg name: "+t;m=c.jwsalg2sigalg[t];var v=ht(s)+"."+ht(o),y="";if("Hmac"==m.substr(0,4)){if(void 0===n)throw"mac key shall be specified for HS* alg";var x=new p({alg:m,prov:"cryptojs",pass:n});x.updateString(v),y=x.doFinal()}else if(-1!=m.indexOf("withECDSA")){(b=new g({alg:m})).init(n,i),b.updateString(v);var w=b.sign();y=ct.crypto.ECDSA.asn1SigToConcatSig(w)}else{var b;"none"!=m&&((b=new g({alg:m})).init(n,i),b.updateString(v),y=b.sign())}return v+"."+vt(y)},ct.jws.JWS.verify=function(t,e,r){var n,i=ct,s=i.jws.JWS,a=s.readSafeJSONString,o=i.crypto,u=o.ECDSA,c=o.Mac,h=o.Signature;n=nt;var l=t.split(".");if(3!==l.length)return!1;var f,p=l[0]+"."+l[1],g=yt(l[2]),d=a(lt(l[0])),m=null;if(void 0===d.alg)throw"algorithm not specified in header";if(f=(m=d.alg).substr(0,2),null!=r&&"[object Array]"===Object.prototype.toString.call(r)&&r.length>0&&-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=qt.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)},ct.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=ct.jws.JWS.readSafeJSONString(lt(e)),s.payloadObj=ct.jws.JWS.readSafeJSONString(lt(r)),s.headerPP=JSON.stringify(s.headerObj,null,"  "),null==s.payloadObj?s.payloadPP=lt(r):s.payloadPP=JSON.stringify(s.payloadObj,null,"  "),void 0!==n&&(s.sigHex=yt(n)),s},ct.jws.JWS.verifyJWT=function(t,e,r){var n=ct.jws,i=n.JWS,s=i.readSafeJSONString,a=i.inArray,o=i.includedArray,u=t.split("."),c=u[0],h=u[1],l=(yt(u[2]),s(lt(c))),f=s(lt(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.gracePeriod<p||void 0!==f.nbf&&"number"==typeof f.nbf&&p<f.nbf-r.gracePeriod||void 0!==f.iat&&"number"==typeof f.iat&&p<f.iat-r.gracePeriod||void 0!==f.jti&&void 0!==r.jti&&f.jti!==r.jti||!i.verify(t,e,r.alg))},ct.jws.JWS.includedArray=function(t,e){var r=ct.jws.JWS.inArray;if(null===t)return!1;if("object"!=typeof t)return!1;if("number"!=typeof t.length)return!1;for(var n=0;n<t.length;n++)if(!r(t[n],e))return!1;return!0},ct.jws.JWS.inArray=function(t,e){if(null===e)return!1;if("object"!=typeof e)return!1;if("number"!=typeof e.length)return!1;for(var r=0;r<e.length;r++)if(e[r]==t)return!0;return!1},ct.jws.JWS.jwsalg2sigalg={HS256:"HmacSHA256",HS384:"HmacSHA384",HS512:"HmacSHA512",RS256:"SHA256withRSA",RS384:"SHA384withRSA",RS512:"SHA512withRSA",ES256:"SHA256withECDSA",ES384:"SHA384withECDSA",ES512:"SHA512withECDSA",PS256:"SHA256withRSAandMGF1",PS384:"SHA384withRSAandMGF1",PS512:"SHA512withRSAandMGF1",none:"none"},ct.jws.JWS.isSafeJSONString=function(t,e,r){var n=null;try{return"object"!=typeof(n=ut(t))||n.constructor===Array?0:(e&&(e[r]=n),1)}catch(t){return 0}},ct.jws.JWS.readSafeJSONString=function(t){var e=null;try{return"object"!=typeof(e=ut(t))||e.constructor===Array?null:e}catch(t){return null}},ct.jws.JWS.getEncodedSignatureValueFromJWS=function(t){var e=t.match(/^[^.]+\.[^.]+\.([^.]+)$/);if(null==e)throw"JWS signature is not a form of 'Head.Payload.SigValue'.";return e[1]},ct.jws.JWS.getJWKthumbprint=function(t){if("RSA"!==t.kty&&"EC"!==t.kty&&"oct"!==t.kty)throw"unsupported algorithm for JWK Thumprint";var e="{";if("RSA"===t.kty){if("string"!=typeof t.n||"string"!=typeof t.e)throw"wrong n and e value for RSA key";e+='"e":"'+t.e+'",',e+='"kty":"'+t.kty+'",',e+='"n":"'+t.n+'"}'}else if("EC"===t.kty){if("string"!=typeof t.crv||"string"!=typeof t.x||"string"!=typeof t.y)throw"wrong crv, x and y value for EC key";e+='"crv":"'+t.crv+'",',e+='"kty":"'+t.kty+'",',e+='"x":"'+t.x+'",',e+='"y":"'+t.y+'"}'}else if("oct"===t.kty){if("string"!=typeof t.k)throw"wrong k value for oct(symmetric) key";e+='"kty":"'+t.kty+'",',e+='"k":"'+t.k+'"}'}var r=St(e);return vt(ct.crypto.Util.hashHex(r,"sha256"))},ct.jws.IntDate={},ct.jws.IntDate.get=function(t){var e=ct.jws.IntDate,r=e.getNow,n=e.getZulu;if("now"==t)return r();if("now + 1hour"==t)return r()+3600;if("now + 1day"==t)return r()+86400;if("now + 1month"==t)return r()+2592e3;if("now + 1year"==t)return r()+31536e3;if(t.match(/Z$/))return n(t);if(t.match(/^[0-9]+$/))return parseInt(t);throw"unsupported format: "+t},ct.jws.IntDate.getZulu=function(t){return It(t)},ct.jws.IntDate.getNow=function(){return~~(new Date/1e3)},ct.jws.IntDate.intDate2UTCString=function(t){return new Date(1e3*t).toUTCString()},ct.jws.IntDate.intDate2Zulu=function(t){var e=new Date(1e3*t);return("0000"+e.getUTCFullYear()).slice(-4)+("00"+(e.getUTCMonth()+1)).slice(-2)+("00"+e.getUTCDate()).slice(-2)+("00"+e.getUTCHours()).slice(-2)+("00"+e.getUTCMinutes()).slice(-2)+("00"+e.getUTCSeconds()).slice(-2)+"Z"},void 0!==ct&&ct||(ct={}),void 0!==ct.jws&&ct.jws||(ct.jws={}),ct.jws.JWSJS=function(){var t=ct.jws.JWS,e=t.readSafeJSONString;this.aHeader=[],this.sPayload="",this.aSignature=[],this.init=function(){this.aHeader=[],this.sPayload=void 0,this.aSignature=[]},this.initWithJWS=function(t){this.init();var e=t.split(".");if(3!=e.length)throw"malformed input JWS";this.aHeader.push(e[0]),this.sPayload=e[1],this.aSignature.push(e[2])},this.addSignature=function(t,e,r,n){if(void 0===this.sPayload||null===this.sPayload)throw"there's no JSON-JS signature to add.";var i=this.aHeader.length;if(this.aHeader.length!=this.aSignature.length)throw"aHeader.length != aSignature.length";try{var s=ct.jws.JWS.sign(t,e,this.sPayload,r,n).split(".");s[0],s[2],this.aHeader.push(s[0]),this.aSignature.push(s[2])}catch(t){throw this.aHeader.length>i&&this.aHeader.pop(),this.aSignature.length>i&&this.aSignature.pop(),"addSignature failed: "+t}},this.verifyAll=function(t){if(this.aHeader.length!==t.length||this.aSignature.length!==t.length)return!1;for(var e=0;e<t.length;e++){var r=t[e];if(2!==r.length)return!1;if(!1===this.verifyNth(e,r[0],r[1]))return!1}return!0},this.verifyNth=function(e,r,n){if(this.aHeader.length<=e||this.aSignature.length<=e)return!1;var i=this.aHeader[e],s=this.aSignature[e],a=i+"."+this.sPayload+"."+s,o=!1;try{o=t.verify(a,r,n)}catch(t){return!1}return o},this.readJWSJS=function(t){if("string"==typeof t){var r=e(t);if(null==r)throw"argument is not safe JSON object string";this.aHeader=r.headers,this.sPayload=r.payload,this.aSignature=r.signatures}else try{if(!(t.headers.length>0))throw"malformed header";if(this.aHeader=t.headers,"string"!=typeof t.payload)throw"malformed signatures";if(this.sPayload=t.payload,!(t.signatures.length>0))throw"malformed signatures";this.aSignature=t.signatures}catch(t){throw"malformed JWS-JS JSON object: "+t}},this.getJSON=function(){return{headers:this.aHeader,payload:this.sPayload,signatures:this.aSignature}},this.isEmpty=function(){return 0==this.aHeader.length?1:0}},e.Jh=E,ct.crypto.ECDSA,ct.crypto.DSA,ct.crypto.Signature,ct.crypto.MessageDigest,ct.crypto.Mac,ct.crypto.Cipher,e.Xb=ft,e.sO=Wt,e.fs=ct,ct.crypto,ct.asn1,ct.jws,ct.lang},2043: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"];function i(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 s(){console.log&&(console.log.apply?console.log.apply(console,arguments):Function.prototype.apply.apply(console.log,[console,arguments])),console.trace&&console.trace()}function a(n){return"debug"===n&&(n="log"),typeof console!==e&&("trace"===n&&r?s:void 0!==console[n]?i(console,n):void 0!==console.log?i(console,"log"):t)}function o(e,r){for(var i=0;i<n.length;i++){var s=n[i];this[s]=i<e?t:this.methodFactory(s,e,r)}this.log=this.debug}function u(t,r,n){return function(){typeof console!==e&&(o.call(this,r,n),this[t].apply(this,arguments))}}function c(t,e,r){return a(t)||u.apply(this,arguments)}function h(t,r,i){var s,a=this;r=null==r?"WARN":r;var u="loglevel";function h(){var t;if(typeof window!==e&&u){try{t=window.localStorage[u]}catch(t){}if(typeof t===e)try{var r=window.document.cookie,n=r.indexOf(encodeURIComponent(u)+"=");-1!==n&&(t=/^([^;]+)/.exec(r.slice(n))[1])}catch(t){}return void 0===a.levels[t]&&(t=void 0),t}}"string"==typeof t?u+=":"+t:"symbol"==typeof t&&(u=void 0),a.name=t,a.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},a.methodFactory=i||c,a.getLevel=function(){return s},a.setLevel=function(r,i){if("string"==typeof r&&void 0!==a.levels[r.toUpperCase()]&&(r=a.levels[r.toUpperCase()]),!("number"==typeof r&&r>=0&&r<=a.levels.SILENT))throw"log.setLevel() called with invalid level: "+r;if(s=r,!1!==i&&function(t){var r=(n[t]||"silent").toUpperCase();if(typeof window!==e&&u){try{return void(window.localStorage[u]=r)}catch(t){}try{window.document.cookie=encodeURIComponent(u)+"="+r+";"}catch(t){}}}(r),o.call(a,r,t),typeof console===e&&r<a.levels.SILENT)return"No console available for logging"},a.setDefaultLevel=function(t){r=t,h()||a.setLevel(t,!1)},a.resetLevel=function(){a.setLevel(r,!1),function(){if(typeof window!==e&&u){try{return void window.localStorage.removeItem(u)}catch(t){}try{window.document.cookie=encodeURIComponent(u)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch(t){}}}()},a.enableAll=function(t){a.setLevel(a.levels.TRACE,t)},a.disableAll=function(t){a.setLevel(a.levels.SILENT,t)};var l=h();null==l&&(l=r),a.setLevel(l,!1)}var l=new h,f={};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=f[t];return e||(e=f[t]=new h(t,l.getLevel(),l.methodFactory)),e};var p=typeof window!==e?window.log:void 0;return l.noConflict=function(){return typeof window!==e&&window.log===l&&(window.log=p),l},l.getLoggers=function(){return f},l.default=l,l},void 0===(i=n.call(e,r,e,t))||(t.exports=i)}()},34155: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=[];++h<e;)o&&o[h].run();h=-1,e=u.length}o=null,c=!1,function(t){if(r===clearTimeout)return clearTimeout(t);if((r===s||!r)&&clearTimeout)return r=clearTimeout,clearTimeout(t);try{r(t)}catch(e){try{return r.call(null,t)}catch(e){return r.call(this,t)}}}(t)}}function p(t,e){this.fun=t,this.array=e}function g(){}n.nextTick=function(t){var e=new Array(arguments.length-1);if(arguments.length>1)for(var r=1;r<arguments.length;r++)e[r-1]=arguments[r];u.push(new p(t,e)),1!==u.length||c||a(f)},p.prototype.run=function(){this.fun.apply(null,this.array)},n.title="browser",n.browser=!0,n.env={},n.argv=[],n.version="",n.versions={},n.on=g,n.addListener=g,n.once=g,n.off=g,n.removeListener=g,n.removeAllListeners=g,n.emit=g,n.prependListener=g,n.prependOnceListener=g,n.listeners=function(t){return[]},n.binding=function(t){throw new Error("process.binding is not supported")},n.cwd=function(){return"/"},n.chdir=function(t){throw new Error("process.chdir is not supported")},n.umask=function(){return 0}},57458:(t,e)=>{!function(t){var e,r,n,i=String.fromCharCode;function s(t){for(var e,r,n=[],i=0,s=t.length;i<s;)(e=t.charCodeAt(i++))>=55296&&e<=56319&&i<s?56320==(64512&(r=t.charCodeAt(i++)))?n.push(((1023&e)<<10)+(1023&r)+65536):(n.push(e),i--):n.push(e);return n}function a(t){if(t>=55296&&t<=57343)throw Error("Lone surrogate U+"+t.toString(16).toUpperCase()+" is not a scalar value")}function o(t,e){return i(t>>e&63|128)}function u(t){if(0==(4294967168&t))return i(t);var e="";return 0==(4294965248&t)?e=i(t>>6&31|192):0==(4294901760&t)?(a(t),e=i(t>>12&15|224),e+=o(t,6)):0==(4292870144&t)&&(e=i(t>>18&7|240),e+=o(t,12),e+=o(t,6)),e+i(63&t|128)}function c(){if(n>=r)throw Error("Invalid byte index");var t=255&e[n];if(n++,128==(192&t))return 63&t;throw Error("Invalid continuation byte")}function 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="";++n<r;)i+=u(e[n]);return i},t.decode=function(t){e=s(t),r=e.length,n=0;for(var a,o=[];!1!==(a=h());)o.push(a);return function(t){for(var e,r=t.length,n=-1,s="";++n<r;)(e=t[n])>65535&&(s+=i((e-=65536)>>>10&1023|55296),e=56320|1023&e),s+=i(e);return s}(o)}}(e)}},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,e){for(var r=0;r<e.length;r++){var n=e[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}function n(t,r,n){return r&&e(t.prototype,r),n&&e(t,n),Object.defineProperty(t,"prototype",{writable:!1}),t}function i(t,e){return i=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,e){return t.__proto__=e,t},i(t,e)}function s(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),Object.defineProperty(t,"prototype",{writable:!1}),e&&i(t,e)}function a(t){return a="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},a(t)}function o(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function u(t,e){if(e&&("object"===a(e)||"function"==typeof e))return e;if(void 0!==e)throw new TypeError("Derived constructors may only return object or undefined");return o(t)}function c(t){return c=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(t){return t.__proto__||Object.getPrototypeOf(t)},c(t)}var h=r(31166);function l(t,e,r,n,i,s,a){try{var o=t[s](a),u=o.value}catch(t){return void r(t)}o.done?e(u):Promise.resolve(u).then(n,i)}function f(t){return function(){var e=this,r=arguments;return new Promise((function(n,i){var s=t.apply(e,r);function a(t){l(s,n,i,a,o,"next",t)}function o(t){l(s,n,i,a,o,"throw",t)}a(void 0)}))}}var p=r(87757),g=r.n(p);function d(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}function m(t,e){if(t){if("string"==typeof t)return d(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)?d(t,e):void 0}}function v(t){return function(t){if(Array.isArray(t))return d(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||m(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}var y=r(57458),x=r.n(y);const w=function(e){s(h,e);var r,i,a=(r=h,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=c(r);if(i){var n=c(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return u(this,t)});function h(){var e;t(this,h);for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return(e=a.call.apply(a,[this].concat(n))).type="OperationError",Error.captureStackTrace&&Error.captureStackTrace(o(e),h),e}return n(h)}(function(t){function e(){var e=Reflect.construct(t,Array.from(arguments));return Object.setPrototypeOf(e,Object.getPrototypeOf(this)),e}return e.prototype=Object.create(t.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t,e}(Error));function b(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"A-Za-z0-9+/=";if(!t)return"";if(t instanceof ArrayBuffer&&(t=new Uint8Array(t)),"string"==typeof t&&(t=N.strToByteArray(t)),64!==(e=N.expandAlphRange(e).join("")).length&&65!==e.length)throw new w(`Invalid Base64 alphabet length (${e.length}): ${e}`);for(var r,n,i,s,a,o,u,c="",h=0;h<t.length;)s=(r=t[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 E(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=N.expandAlphRange(e).join("")).length&&65!==e.length)throw new w(`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 w(`Error: Invalid Base64 input length (${t.length}). Cannot be 4n+1, even without padding chars.`);if(65===e.length){var a=e.charAt(64),o=t.indexOf(a);if(o>=0){if(o<t.length-2||t.charAt(t.length-1)!==a)throw new w(`Error: Base64 padding character (${a}) not used in the correct place.`);if(t.length%4!=0)throw new w("Error: Base64 not padded to a multiple of 4.")}}}for(var u,c,h,l,f,p,g,d=[],m=0;m<t.length;){if(l=e.indexOf(t.charAt(m++)||null),f=e.indexOf(t.charAt(m++)||null),p=e.indexOf(t.charAt(m++)||null),g=e.indexOf(t.charAt(m++)||null),i&&(l<0||f<0||p<0||g<0))throw new w("Error: Base64 input contains non-alphabet char(s)");c=(15&f)<<4|p>>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?N.byteArrayToUtf8(d):d}function S(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" ",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2,n=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"",i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:0;if(!t)return"";t instanceof ArrayBuffer&&(t=new Uint8Array(t));for(var s="",a="0x"===e||"\\x"===e,o=0;o<t.length;o++){var u=t[o].toString(16).padStart(r,"0");s+=a?e+u:u+e,n&&(s+=n),o!==t.length-1&&(o+1)%i==0&&(s+="\n")}var c=n.length+(a?0:e.length);return c?s.slice(0,-c):s}function F(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Auto",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2;if(r<1||Math.round(r)!==r)throw new w("Byte length must be a positive integer");if("None"!==e){var n="Auto"===e?/[^a-f\d]|(0x)/gi:N.regexRep(e);t=t.replace(n,"")}for(var i=[],s=0;s<t.length;s+=r)i.push(parseInt(t.substr(s,r),16));return i}function A(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Auto";e=N.charRep(e);var r=[],n=t.split(e);""===n[n.length-1]&&(n=n.slice(0,n.length-1));for(var i=0;i<n.length;i++)r[i]=parseInt(n[i],10);return r}function B(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Space",r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:8;if(r<1||Math.round(r)!==r)throw new w("Byte length must be a positive integer");var n=N.regexRep(e);t=t.replace(n,"");for(var i=[],s=0;s<t.length;s+=r)i.push(parseInt(t.substr(s,r),2));return i}["Auto"].concat(["Space","Percent","Comma","Semi-colon","Colon","Line feed","CRLF","0x","0x with comma","\\x","None"]);var I=r(48764).Buffer,D=r(34155),C=function(){function e(){t(this,e)}var r;return n(e,null,[{key:"chr",value:function(t){if(t>65535){t-=65536;var e=String.fromCharCode(t>>>10&1023|55296);return t=56320|1023&t,e+String.fromCharCode(t)}return String.fromCharCode(t)}},{key:"ord",value:function(t){if(2===t.length){var e=t.charCodeAt(0),r=t.charCodeAt(1);if(e>=55296&&e<56320&&r>=56320&&r<57344)return 1024*(e-55296)+r-56320+65536}return t.charCodeAt(0)}},{key:"padBytesRight",value:function(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,n=new Array(e);return n.fill(r),v(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 r=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n=arguments.length>2&&void 0!==arguments[2]&&arguments[2];if(P()&&window.app&&!window.app.options.treatAsUtf8&&(t=e.byteArrayToChars(e.strToByteArray(t))),n)return t.replace(/[^\x20-\x7f]/g,".");var i=/[\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,s=/[\x09-\x10\x0D\u2028\u2029]/g;return t=t.replace(i,"."),r||(t=t.replace(s,".")),t}},{key:"parseEscapedChars",value:function(t){return t.replace(/\\([bfnrtv'"]|[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"b":return"\b";case"t":return"\t";case"n":return"\n";case"v":return"\v";case"f":return"\f";case"r":return"\r";case'"':return'"';case"'":return"'";case"x":return String.fromCharCode(parseInt(e.substr(1),16));case"u":return"{"===e[1]?String.fromCodePoint(parseInt(e.slice(2,-1),16)):String.fromCharCode(parseInt(e.substr(1),16))}}))}},{key:"escapeRegex",value:function(t){return t.replace(/([.*+?^=!:${}()|[\]/\\])/g,"\\$1")}},{key:"expandAlphRange",value:function(t){for(var r=[],n=0;n<t.length;n++)if(n<t.length-2&&"-"===t[n+1]&&"\\"!==t[n]){for(var i=e.ord(t[n]),s=e.ord(t[n+2]),a=i;a<=s;a++)r.push(e.chr(a));n+=2}else n<t.length-2&&"\\"===t[n]&&"-"===t[n+1]?(r.push("-"),n++):r.push(t[n]);return r}},{key:"convertToByteArray",value:function(t,r){switch(r.toLowerCase()){case"binary":return B(t);case"hex":return F(t);case"decimal":return A(t);case"base64":return E(t,null,"byteArray");case"utf8":return e.strToUtf8ByteArray(t);default:return e.strToByteArray(t)}}},{key:"convertToByteString",value:function(t,r){switch(r.toLowerCase()){case"binary":return e.byteArrayToChars(B(t));case"hex":return e.byteArrayToChars(F(t));case"decimal":return e.byteArrayToChars(A(t));case"base64":return e.byteArrayToChars(E(t,null,"byteArray"));case"utf8":return x().encode(t);default:return t}}},{key:"strToArrayBuffer",value:function(t){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){var r=x().encode(t);return t.length!==r.length&&(T()?self.setOption("attemptHighlight",!1):P()&&(window.app.options.attemptHighlight=!1)),e.strToArrayBuffer(r)}},{key:"strToByteArray",value:function(t){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){var r=x().encode(t);return t.length!==r.length&&(T()?self.setOption("attemptHighlight",!1):P()&&(window.app.options.attemptHighlight=!1)),e.strToByteArray(r)}},{key:"strToCharcode",value:function(t){for(var r=[],n=0;n<t.length;n++){var i=t.charCodeAt(n);if(n<t.length-1&&i>=55296&&i<56320){var s=t[n+1].charCodeAt(0);s>=56320&&s<57344&&(i=e.ord(t[n]+t[++n]))}r.push(i)}return r}},{key:"byteArrayToUtf8",value:function(t){var r=e.byteArrayToChars(t);try{var n=x().decode(r);return r.length!==n.length&&(T()?self.setOption("attemptHighlight",!1):P()&&(window.app.options.attemptHighlight=!1)),n}catch(t){return r}}},{key:"byteArrayToChars",value:function(t){if(!t)return"";for(var e="",r=0;r<t.length;)e+=String.fromCharCode(t[r++]);return e}},{key:"arrayBufferToStr",value:function(t){var r=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],n=new Uint8Array(t);return r?e.byteArrayToUtf8(n):e.byteArrayToChars(n)}},{key:"calculateShannonEntropy",value:function(t){t instanceof ArrayBuffer&&(t=new Uint8Array(t));var e,r=[],n=new Array(256).fill(0);for(e=0;e<t.length;e++)n[t[e]]++;for(e=0;e<n.length;e++)n[e]>0&&r.push(n[e]/t.length);var i,s=0;for(e=0;e<r.length;e++)s+=(i=r[e])*Math.log(i)/Math.log(2);return-s}},{key:"parseCSV",value:function(t){var e,r,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[","],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:["\n","\r"],s=!1,a=!1,o="",u=[],c=[];t.length&&"\ufeff"===t[0]&&(t=t.substr(1));for(var h=0;h<t.length;h++)e=t[h],r=t[h+1]||"",s?(o+=e,s=!1):'"'!==e||a?'"'===e&&a?'"'===r?s=!0:a=!1:!a&&n.indexOf(e)>=0?(u.push(o),o=""):!a&&i.indexOf(e)>=0?(u.push(o),o="",c.push(u),u=[],i.indexOf(r)>=0&&r!==e&&h++):o+=e:a=!0;return u.length&&(u.push(o),c.push(u)),c}},{key:"stripHtmlTags",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1];function r(t,e){var n=e.replace(t,"");return n.length===e.length?n:r(t,n)}return e&&(t=r(/<script[^>]*>.*?<\/script[^>]*>/gi,t),t=r(/<style[^>]*>.*?<\/style[^>]*>/gi,t)),t.replace(/<[^>]+>/g,"")}},{key:"escapeHtml",value:function(t){var e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"};return t.replace(/[&<>"'`]/g,(function(t){return e[t]}))}},{key:"unescapeHtml",value:function(t){var e={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#x27;":"'","&#x2F;":"/","&#x60;":"`"};return t.replace(/&#?x?[a-z0-9]{2,4};/gi,(function(t){return e[t]||t}))}},{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=f(g().mark((function t(r){var n,i,s,a,o;return g().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=function(t){return`<div class='card' style='white-space: normal;'>\n                    <div class='card-header'>\n                        <h6 class="mb-0">\n                            ${e.escapeHtml(t.name)}\n                        </h6>\n                    </div>\n                </div>`},i=function(t,r){if(r.startsWith("image")){var n="data:";return n+=r+";","<img style='max-width: 100%;' src='"+(n+="base64,"+b(t))+"'>"}return`<pre>${e.escapeHtml(e.arrayBufferToStr(t.buffer))}</pre>`},s=function(){var t=f(g().mark((function t(r,n){var s,a,o,u;return g().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.next=2,e.readFile(r);case 2:return s=t.sent,a=new Blob([s],{type:r.type||"octet/stream"}),o=URL.createObjectURL(a),u=`<div class='card' style='white-space: normal;'>\n                    <div class='card-header' id='heading${n}'>\n                        <h6 class='mb-0'>\n                            <a class='collapsed'\n                                data-toggle='collapse'\n                                href='#collapse${n}'\n                                aria-expanded='false'\n                                aria-controls='collapse${n}'\n                                title="Show/hide contents of '${e.escapeHtml(r.name)}'">\n                                ${e.escapeHtml(r.name)}</a>\n                            <span class='float-right' style="margin-top: -3px">\n                                ${r.size.toLocaleString()} bytes\n                                <a title="Download ${e.escapeHtml(r.name)}"\n                                    href="${o}"\n                                    download="${e.escapeHtml(r.name)}"\n                                    data-toggle="tooltip">\n                                    <i class="material-icons" style="vertical-align: bottom">save</i>\n                                </a>\n                                <a title="Move to input"\n                                    href="#"\n                                    blob-url="${o}"\n                                    file-name="${e.escapeHtml(r.name)}"\n                                    class="extract-file"\n                                    data-toggle="tooltip">\n                                    <i class="material-icons" style="vertical-align: bottom">open_in_browser</i>\n                                </a>\n                            </span>\n                        </h6>\n                    </div>\n                    <div id='collapse${n}' class='collapse' aria-labelledby='heading${n}' data-parent="#files">\n                        <div class='card-body'>\n                            ${i(s,r.type)}\n                        </div>\n                    </div>\n                </div>`,t.abrupt("return",u);case 7:case"end":return t.stop()}}),t)})));return function(e,r){return t.apply(this,arguments)}}(),a=`<div style='padding: 5px; white-space: normal;'>\n                ${r.length} file(s) found\n            </div><div id="files" style="padding: 20px">`,o=0;case 5:if(!(o<r.length)){t.next=17;break}if(!r[o].name.endsWith("/")){t.next=10;break}a+=n(r[o]),t.next=14;break;case 10:return t.t0=a,t.next=13,s(r[o],o);case 13:a=t.t0+=t.sent;case 14:o++,t.next=5;break;case 17:return t.abrupt("return",a+="</div>");case 18:case"end":return t.stop()}}),t)}))),function(t){return r.apply(this,arguments)})},{key:"parseURIParams",value:function(t){if(""===t)return{};"?"!==t[0]&&"#"!==t[0]||(t=t.substr(1));for(var e=t.split("&"),r={},n=0;n<e.length;n++){var i=e[n].split("=");2!==i.length?r[e[n]]=!0:r[i[0]]=decodeURIComponent(i[1].replace(/\+/g," "))}return r}},{key:"readFile",value:function(t){return R()?I.from(t).buffer:new Promise((function(e,r){var n=new FileReader,i=new Uint8Array(t.size),s=0,a=10485760,o=function(){if(s>=t.size)e(i);else{var r=t.slice(s,s+a);n.readAsArrayBuffer(r)}};n.onload=function(t){i.set(new Uint8Array(n.result),s),s+=a,o()},n.onerror=function(t){r(n.error.message)},o()}))}},{key:"readFileSync",value:function(t){if(!R())throw new TypeError("Browser environment cannot support readFileSync");return Uint8Array.from(t.data).buffer}},{key:"mod",value:function(t,e){return(t%e+e)%e}},{key:"gcd",value:function(t,r){return r?e.gcd(r,t%r):t}},{key:"modInv",value:function(t,e){t%=e;for(var r=1;r<e;r++)if(t*r%26==1)return r}},{key:"charRep",value:function(t){return{Space:" ",Percent:"%",Comma:",","Semi-colon":";",Colon:":",Tab:"\t","Line feed":"\n",CRLF:"\r\n","Forward slash":"/",Backslash:"\\","0x":"0x","\\x":"\\x","Nothing (separate chars)":"",None:""}[t]}},{key:"regexRep",value:function(t){return{Space:/\s+/g,Percent:/%/g,Comma:/,/g,"Semi-colon":/;/g,Colon:/:/g,"Line feed":/\n/g,CRLF:/\r\n/g,"Forward slash":/\//g,Backslash:/\\/g,"0x with comma":/,?0x/g,"0x":/0x/g,"\\x":/\\x/g,None:/\s+/g}[t]}},{key:"chunked",value:g().mark((function t(e,r){var n,i,s,a;return g().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n=e[Symbol.iterator]();case 1:i=[],s=0;case 4:if(!(s<r)){t.next=12;break}if(!(a=n.next()).done){t.next=8;break}return t.abrupt("break",12);case 8:i.push(a.value);case 9:s++,t.next=4;break;case 12:if(!i.length){t.next=17;break}return t.next=15,i;case 15:t.next=18;break;case 17:return t.abrupt("return");case 18:t.next=1;break;case 20:case"end":return t.stop()}}),t)}))}]),e}();function R(){return void 0!==D&&null!=D.versions&&null!=D.versions.node}function P(){return"object"==typeof window}function T(){return"function"==typeof importScripts}const N=C;Array.prototype.unique=function(){for(var t={},e=[],r=0,n=this.length;r<n;r++)Object.prototype.hasOwnProperty.call(t,this[r])||(e.push(this[r]),t[this[r]]=1);return e},Array.prototype.max=function(){return Math.max.apply(null,this)},Array.prototype.min=function(){return Math.min.apply(null,this)},Array.prototype.sum=function(){return this.reduce((function(t,e){return t+e}),0)},Array.prototype.equals=function(t){if(!t)return!1;var e=this.length;if(e!==t.length)return!1;for(;e--;)if(this[e]!==t[e])return!1;return!0},String.prototype.count=function(t){return this.split(t).length-1},String.prototype.padStart||(String.prototype.padStart=function(t,e){return t>>=0,e=String(void 0!==e?e:" "),this.length>t?String(this):((t-=this.length)>e.length&&(e+=e.repeat(t/e.length)),e.slice(0,t)+String(this))}),String.prototype.padEnd||(String.prototype.padEnd=function(t,e){return t>>=0,e=String(void 0!==e?e:" "),this.length>t?String(this):((t-=this.length)>e.length&&(e+=e.repeat(t/e.length)),String(this)+e.slice(0,t))});const O=function(e){s(h,e);var r,i,a=(r=h,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=c(r);if(i){var n=c(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return u(this,t)});function h(){var e;t(this,h);for(var r=arguments.length,n=new Array(r),i=0;i<r;i++)n[i]=arguments[i];return(e=a.call.apply(a,[this].concat(n))).type="DishError",Error.captureStackTrace&&Error.captureStackTrace(o(e),h),e}return n(h)}(function(t){function e(){var e=Reflect.construct(t,Array.from(arguments));return Object.setPrototypeOf(e,Object.getPrototypeOf(this)),e}return e.prototype=Object.create(t.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t,e}(Error));var k=r(44431),H=r.n(k);function j(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=!0,o=!1;try{for(r=r.call(t);!(a=(n=r.next()).done)&&(s.push(n.value),!e||s.length!==e);a=!0);}catch(t){o=!0,i=t}finally{try{a||null==r.return||r.return()}finally{if(o)throw i}}return s}}(t,e)||m(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 L=function(){function e(r){t(this,e),this.bytes=r,this.length=this.bytes.length,this.position=0,this.bitPos=0}return n(e,[{key:"getBytes",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;if(!(this.position>this.length)){var e=null!==t?this.position+t:this.length,r=this.bytes.slice(this.position,e);return this.position=e,this.bitPos=0,r}}},{key:"readString",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:-1;if(!(this.position>this.length)){-1===t&&(t=this.length-this.position);for(var e="",r=this.position;r<this.position+t;r++){var n=this.bytes[r];if(0===n)break;e+=String.fromCharCode(n)}return this.position+=t,this.bitPos=0,e}}},{key:"readInt",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"be";if(!(this.position>this.length)){var r=0;if("be"===e)for(var n=this.position;n<this.position+t;n++)r<<=8,r|=this.bytes[n];else for(var i=this.position+t-1;i>=this.position;i--)r<<=8,r|=this.bytes[i];return this.position+=t,this.bitPos=0,r}}},{key:"readBits",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"be";if(!(this.position>this.length)){var r=0,n=0;for(r=this.bytes[this.position++]&s(this.bitPos),"be"!==e&&(r>>>=this.bitPos),n=8-this.bitPos,this.bitPos=0;n<t;)"be"===e?r=r<<n|this.bytes[this.position++]:r|=this.bytes[this.position++]<<n,n+=8;if(n>t){var i=n-t;"be"===e?r>>>=i:r&=(1<<t)-1,n-=i,this.position--,this.bitPos=8-i}return r}function s(t){return"be"===e?(1<<8-t)-1:256-(1<<t)}}},{key:"continueUntil",value:function(t){if(!(this.position>this.length))if(this.bitPos=0,"number"!=typeof t){var e=t.length,r=t[e-1];this.position=e;for(var n,i=function(t,e){var r=new Array;return t.forEach((function(t,n){r[t]=e-n})),r}(t,e);this.position<this.length;){for(;this.position<this.length&&this.bytes[this.position++]!==r;);n=!0;for(var s=e-1;s>=0;s--)if(this.bytes[this.position-e+s]!==t[s]){n=!1,this.position+=i[t[s]];break}if(n){this.position-=e;break}}}else for(;++this.position<this.length&&this.bytes[this.position]!==t;);}},{key:"consumeWhile",value:function(t){for(;this.position<this.length&&this.bytes[this.position]===t;)this.position++;this.bitPos=0}},{key:"consumeIf",value:function(t){this.bytes[this.position]===t&&(this.position++,this.bitPos=0)}},{key:"moveForwardsBy",value:function(t){var e=this.position+t;if(e<0||e>this.length)throw new Error("Cannot move to position "+e+" in stream. Out of bounds.");this.position=e,this.bitPos=0}},{key:"moveBackwardsBy",value:function(t){var e=this.position-t;if(e<0||e>this.length)throw new Error("Cannot move to position "+e+" in stream. Out of bounds.");this.position=e,this.bitPos=0}},{key:"moveBackwardsByBits",value:function(t){if(t<=this.bitPos)this.bitPos-=t;else for(this.bitPos>0&&(t-=this.bitPos,this.bitPos=0);t>0;)this.moveBackwardsBy(1),this.bitPos=8,this.moveBackwardsByBits(t),t-=8}},{key:"moveTo",value:function(t){if(t<0||t>this.length)throw new Error("Cannot move to position "+t+" in stream. Out of bounds.");this.position=t,this.bitPos=0}},{key:"hasMore",value:function(){return this.position<this.length}},{key:"carve",value:function(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:0,e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:this.position;return this.bitPos>0&&e++,this.bytes.slice(t,e)}}]),e}();function V(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 _(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)?_(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 _(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=new Array(e);r<e;r++)n[r]=t[r];return n}var U={Images:[{name:"Joint Photographic Experts Group image",extension:"jpg,jpeg,jpe,thm,mpo",mime:"image/jpeg",description:"",signature:{0:255,1:216,2:255,3:[192,196,219,221,224,225,226,227,228,229,231,232,234,235,236,237,238,254]},extractor:function(t,e){for(var r=new L(t.slice(e));r.hasMore();){var n=r.getBytes(2);if(255!==n[0])throw new Error(`Invalid marker while parsing JPEG at pos ${r.position}: ${n}`);var i=0;switch(n[1]){case 216:case 1:break;case 217:return r.carve();case 192:case 193:case 194:case 195:case 196:case 197:case 198:case 199:case 200:case 201:case 202:case 203:case 204:case 205:case 206:case 207:case 219:case 222:case 224:case 225:case 226:case 227:case 228:case 229:case 230:case 231:case 232:case 233:case 234:case 235:case 236:case 237:case 238:case 239:case 254:i=r.readInt(2,"be"),r.position+=i-2;break;case 223:r.position++;break;case 220:case 221:r.position+=2;break;case 218:i=r.readInt(2,"be"),r.position+=i-2,r.continueUntil(255);break;default:r.continueUntil(255)}}throw new Error("Unable to parse JPEG successfully")}},{name:"Graphics Interchange Format image",extension:"gif",mime:"image/gif",description:"",signature:{0:71,1:73,2:70,3:56,4:[55,57],5:97},extractor:function(t,e){var r=new L(t.slice(e));for(r.continueUntil([33,255]),r.continueUntil([33,249]),r.moveForwardsBy(2);r.hasMore();){for(r.moveForwardsBy(r.readInt(1)+1),r.moveForwardsBy(11);r.getBytes(2)!==[33,249]&&(r.moveBackwardsBy(2),r.moveForwardsBy(r.readInt(1)),r.readInt(1));)r.moveBackwardsBy(1);if(59===r.readInt(1))break;r.moveForwardsBy(1)}return r.carve()}},{name:"Portable Network Graphics image",extension:"png",mime:"image/png",description:"",signature:{0:137,1:80,2:78,3:71,4:13,5:10,6:26,7:10},extractor:function(t,e){var r=new L(t.slice(e));r.moveForwardsBy(8);for(var n=0,i="";"IEND"!==i;)n=r.readInt(4,"be"),i=r.readString(4),r.moveForwardsBy(n+4);return r.carve()}},{name:"WEBP Image",extension:"webp",mime:"image/webp",description:"",signature:{8:87,9:69,10:66,11:80},extractor:null},{name:"Camera Image File Format",extension:"crw",mime:"image/x-canon-crw",description:"",signature:{6:72,7:69,8:65,9:80,10:67,11:67,12:68,13:82},extractor:null},{name:"Canon CR2 raw image",extension:"cr2",mime:"image/x-canon-cr2",description:"",signature:[{0:73,1:73,2:42,3:0,8:67,9:82},{0:77,1:77,2:0,3:42,8:67,9:82}],extractor:null},{name:"Tagged Image File Format image",extension:"tif",mime:"image/tiff",description:"",signature:[{0:73,1:73,2:42,3:0},{0:77,1:77,2:0,3:42}],extractor:null},{name:"Bitmap image",extension:"bmp",mime:"image/bmp",description:"",signature:{0:66,1:77,7:0,9:0,14:[12,40,56,64,108,124],15:0,16:0,17:0},extractor:function(t,e){var r=new L(t.slice(e));r.moveForwardsBy(2);var n=r.readInt(4,"le");return r.moveForwardsBy(n-6),r.carve()}},{name:"JPEG Extended Range image",extension:"jxr",mime:"image/vnd.ms-photo",description:"",signature:{0:73,1:73,2:188},extractor:null},{name:"Photoshop image",extension:"psd",mime:"image/vnd.adobe.photoshop",description:"",signature:{0:56,1:66,2:80,3:83,4:0,5:1,6:0,7:0,8:0,9:0,10:0,11:0},extractor:null},{name:"Photoshop Large Document",extension:"psb",mime:"application/x-photoshop",description:"",signature:{0:56,1:66,2:80,3:83,4:0,5:2,6:0,7:0,8:0,9:0,10:0,11:0,12:0},extractor:null},{name:"Paint Shop Pro image",extension:"psp",mime:"image/psp",description:"",signature:[{0:80,1:97,2:105,3:110,4:116,5:32,6:83,7:104,8:111,9:112,10:32,11:80,12:114,13:111,14:32,15:73,16:109},{0:126,1:66,2:75,3:0}],extractor:null},{name:"The GIMP image",extension:"xcf",mime:"image/x-xcf",description:"",signature:{0:103,1:105,2:109,3:112,4:32,5:120,6:99,7:102,8:32,9:[102,118],10:[105,48],11:[108,48],12:[101,49,50,51]},extractor:null},{name:"Icon image",extension:"ico",mime:"image/x-icon",description:"",signature:{0:0,1:0,2:1,3:0,4:[1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21],5:0,6:[16,32,48,64,128],7:[16,32,48,64,128],9:0,10:[0,1]},extractor:function(t,e){var r=new L(t.slice(e));r.moveTo(4);var n=r.readInt(2,"le");r.moveForwardsBy(8+16*(n-1));var i=r.readInt(4,"le"),s=r.readInt(4,"le");return r.moveTo(s+i),r.carve()}},{name:"Radiance High Dynamic Range image",extension:"hdr",mime:"image/vnd.radiance",description:"",signature:{0:35,1:63,2:82,3:65,4:68,5:73,6:65,7:78,8:67,9:69,10:10},extractor:null},{name:"Sony ARW image",extension:"arw",mime:"image/x-raw",description:"",signature:{0:5,1:0,2:0,3:0,4:65,5:87,6:49,7:46},extractor:null},{name:"Fujifilm Raw Image",extension:"raf",mime:"image/x-raw",description:"",signature:{0:70,1:85,2:74,3:73,4:70,5:73,6:76,7:77,8:67,9:67,10:68,11:45,12:82,13:65,14:87},extractor:null},{name:"Minolta RAW image",extension:"mrw",mime:"image/x-raw",description:"",signature:{0:0,1:77,2:82,3:77},extractor:null},{name:"Adobe Bridge Thumbnail Cache",extension:"bct",mime:"application/octet-stream",description:"",signature:{0:108,1:110,2:98,3:116,4:2,5:0,6:0,7:0},extractor:null},{name:"Microsoft Document Imaging",extension:"mdi",mime:"image/vnd.ms-modi",description:"",signature:{0:69,1:80,2:42,3:0},extractor:null},{name:"Joint Photographic Experts Group image (under Base64)",extension:"B64",mime:"application/octet-stream",description:"",signature:{0:47,1:57,2:106,3:47,4:52},extractor:null},{name:"Portable Network Graphics image (under Base64)",extension:"B64",mime:"application/octet-stream",description:"",signature:{0:105,1:86,2:66,3:79,4:82,5:119,6:48},extractor:null},{name:"AutoCAD Drawing",extension:"dwg,123d",mime:"application/acad",description:"",signature:{0:65,1:67,2:49,3:48,4:[48,49],5:[48,49,50,51,52,53],6:0},extractor:null},{name:"AutoCAD Drawing",extension:"dwg,dwt",mime:"application/acad",description:"",signature:[{0:65,1:67,2:49,3:48,4:49,5:56,6:0},{0:65,1:67,2:49,3:48,4:50,5:52,6:0},{0:65,1:67,2:49,3:48,4:50,5:55,6:0}],extractor:null},{name:"Targa Image",extension:"tga",mime:"image/x-targa",description:"",signature:[{0:84,1:82,2:85,3:69,4:86,5:73,6:83,7:73,8:79,9:78,10:45,11:88,12:70,13:73,14:76,15:69,16:46}],extractor:function(t,e){var r=new L(t);r.moveTo(e-8);var n=r.readInt(4,"le"),i=r.readInt(4,"le");function s(t,e){for(var n=0;n<t;n++){r.moveBackwardsBy(1);var i=r.readInt(e,"le")-1;if(r.moveBackwardsBy(e),i===n)break}}return r.moveBackwardsBy(8),n||i?n?(s(65535,2),r.moveBackwardsBy(n)):i&&(s(4294967295,4),r.moveBackwardsBy(6),r.moveBackwardsBy(i)):(function(){r.moveBackwardsBy(5);for(var t=0;t<1048576&&r.readInt(2,"le")*r.readInt(2,"le")*r.readInt(1)/8!=t-1;t++)r.moveBackwardsBy(6)}(),r.moveBackwardsBy(17)),r.carve(r.position,e+18)}}],Video:[{name:"Matroska Multimedia Container",extension:"mkv",mime:"video/x-matroska",description:"",signature:{31:109,32:97,33:116,34:114,35:111,36:115,37:107,38:97},extractor:null},{name:"WEBM video",extension:"webm",mime:"video/webm",description:"",signature:{0:26,1:69,2:223,3:163},extractor:null},{name:"Flash MP4 video",extension:"f4v",mime:"video/mp4",description:"",signature:{4:102,5:116,6:121,7:112,8:[102,70],9:52,10:[118,86],11:32},extractor:null},{name:"MPEG-4 video",extension:"mp4",mime:"video/mp4",description:"",signature:[{0:0,1:0,2:0,3:[24,32],4:102,5:116,6:121,7:112},{0:51,1:103,2:112,3:53},{0:0,1:0,2:0,3:28,4:102,5:116,6:121,7:112,8:109,9:112,10:52,11:50,16:109,17:112,18:52,19:49,20:109,21:112,22:52,23:50,24:105,25:115,26:111,27:109}],extractor:null},{name:"M4V video",extension:"m4v",mime:"video/x-m4v",description:"",signature:{0:0,1:0,2:0,3:28,4:102,5:116,6:121,7:112,8:77,9:52,10:86},extractor:null},{name:"Quicktime video",extension:"mov",mime:"video/quicktime",description:"",signature:{0:0,1:0,2:0,3:20,4:102,5:116,6:121,7:112},extractor:null},{name:"Audio Video Interleave",extension:"avi",mime:"video/x-msvideo",description:"",signature:{0:82,1:73,2:70,3:70,8:65,9:86,10:73},extractor:null},{name:"Windows Media Video",extension:"wmv",mime:"video/x-ms-wmv",description:"",signature:{0:48,1:38,2:178,3:117,4:142,5:102,6:207,7:17,8:166,9:217},extractor:null},{name:"MPEG video",extension:"mpg",mime:"video/mpeg",description:"",signature:{0:0,1:0,2:1,3:186},extractor:null},{name:"Flash Video",extension:"flv",mime:"video/x-flv",description:"",signature:{0:70,1:76,2:86,3:1},extractor:function(t,e){var r=new L(t.slice(e));r.moveForwardsBy(5);var n=r.readInt(4,"be");r.moveForwardsBy(n-9);for(var i=-11;r.hasMore();){var s=r.readInt(4,"be"),a=r.readInt(1);if([8,9,18].indexOf(a)<0){r.moveBackwardsBy(1);break}if(s!==i+11){r.moveBackwardsBy(i+11+5);break}i=r.readInt(3,"be"),r.moveForwardsBy(7+i)}return r.carve()}},{name:"OGG Video",extension:"ogv,ogm,opus,ogx",mime:"video/ogg",description:"",signature:[{0:79,1:103,2:103,3:83,4:0,5:2,28:1,29:118,30:105,31:100,32:101,33:111},{0:79,1:103,2:103,3:83,4:0,5:2,28:128,29:116,30:104,31:101,32:111,33:114,34:97},{0:79,1:103,2:103,3:83,4:0,5:2,28:102,29:105,30:115,31:104,32:101,33:97,34:100}],extractor:null}],Audio:[{name:"Waveform Audio",extension:"wav",mime:"audio/x-wav",description:"",signature:{0:82,1:73,2:70,3:70,8:87,9:65,10:86,11:69},extractor:function(t,e){var r=new L(t.slice(e));return r.moveTo(4),r.moveTo(r.readInt(4,"le")+8),r.carve()}},{name:"OGG audio",extension:"ogg",mime:"audio/ogg",description:"",signature:{0:79,1:103,2:103,3:83},extractor:null},{name:"Musical Instrument Digital Interface audio",extension:"midi",mime:"audio/midi",description:"",signature:{0:77,1:84,2:104,3:100},extractor:null},{name:"MPEG-3 audio",extension:"mp3",mime:"audio/mpeg",description:"",signature:[{0:73,1:68,2:51},{0:255,1:251}],extractor:function(t,e){var r=new L(t.slice(e)),n=["free",32e3,4e4,48e3,56e3,64e3,8e4,96e3,112e3,128e3,16e4,192e3,224e3,256e3,32e4,"bad"],i=[44100,48e3,32e3,"reserved"];if(r.getBytes(3).toString()===[73,68,51].toString()){r.moveTo(6);var s=r.readInt(1)<<21|r.readInt(1)<<14|r.readInt(1)<<7|r.readInt(1);r.moveForwardsBy(s)}else r.moveTo(0);for(;r.hasMore();){if(r.getBytes(3)===[84,65,71].toString()){r.moveForwardsBy(125);break}if(r.getBytes(2).toString()!==[255,251].toString()){r.moveBackwardsBy(2);break}var a=r.readInt(1),o=n[a>>4],u=i[(15&a)>>2],c=(2&a)>>1;if("free"===o||"bad"===o||"reserved"===u){r.moveBackwardsBy(1);break}var 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 L(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 L(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:M},{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:M}],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 L(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 L(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:K},{name:"MacOS Mach-O 64-bit object",extension:"dylib",mime:"application/octet-stream",description:"",signature:{0:207,1:250,2:237,3:254},extractor:K},{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:M},{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 L(t.slice(e));r.hasMore();){if(r.moveForwardsBy(257),r.getBytes(5).join("")!==[117,115,116,97,114].join("")){r.moveBackwardsBy(262);break}r.moveBackwardsBy(138);var n=0;r.getBytes(11).forEach((function(t,e){n+=(t-48).toString()})),n=512*Math.ceil(parseInt(n,8)/512),r.moveForwardsBy(n+377)}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 L(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),J(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 L(t.slice(e)),n=[[119,36,83,133,9],[238,72,167,10,18],[220,145,78,20,36],[185,34,156,40,72],[114,69,56,80,144],[187,146,41,194,132],[93,201,20,225,66],[46,228,138,112,161],[23,114,69,56,80]],i=0;i<n.length&&(r.continueUntil(n[i]),r.getBytes(5).join("")!==n[i].join(""));i++)r.moveTo(0);return r.moveForwardsBy(4),r.carve()}},{name:"7zip",extension:"7z",mime:"application/x-7z-compressed",description:"",signature:{0:55,1:122,2:188,3:175,4:39,5:28},extractor:null},{name:"Zlib Deflate",extension:"zlib",mime:"application/x-deflate",description:"",signature:{0:120,1:[1,156,218,94]},extractor:function(t,e){var r=new L(t.slice(e));return r.moveForwardsBy(1),32&r.readInt(1)&&r.moveForwardsBy(4),J(r),r.moveForwardsBy(4),r.carve()}},{name:"xz compression",extension:"xz",mime:"application/x-xz",description:"",signature:{0:253,1:55,2:122,3:88,4:90,5:0},extractor:function(t,e){var r=new L(t.slice(e));return r.continueUntil([0,0,0,0,4,89,90]),r.moveForwardsBy(7),r.carve()}},{name:"Tarball",extension:"tar.z",mime:"application/x-gtar",description:"",signature:{0:31,1:[157,160]},extractor:null},{name:"ISO disk image",extension:"iso",mime:"application/octet-stream",description:"ISO 9660 CD/DVD image file",signature:[{32769:67,32770:68,32771:48,32772:48,32773:49},{34817:67,34818:68,34819:48,34820:48,34821:49},{36865:67,36866:68,36867:48,36868:48,36869:49}],extractor:null},{name:"Virtual Machine Disk",extension:"vmdk",mime:"application/vmdk,application/x-virtualbox-vmdk",description:"",signature:{0:75,1:68,2:77,3:86,5:0,6:0,7:0},extractor:null},{name:"Virtual Hard Drive",extension:"vhd",mime:"application/x-vhd",description:"",signature:{0:99,1:111,2:110,3:101,4:99,5:116,6:105,7:120},extractor:null},{name:"Macintosh disk image",extension:"dmf,dmg",mime:"application/octet-stream",description:"",signature:{0:120,1:1,2:115,3:13,4:98,5:98,6:96,7:96},extractor:null},{name:"ARJ Archive",extension:"arj",mime:"application/x-arj-compressed",description:"",signature:{0:96,1:234,8:[0,16,20],9:0,10:2},extractor:null},{name:"WinAce Archive",extension:"ace",mime:"application/x-ace-compressed",description:"",signature:{7:42,8:42,9:65,10:67,11:69,12:42,13:42},extractor:null},{name:"Macintosh BinHex Encoded File",extension:"hqx",mime:"application/mac-binhex",description:"",signature:{11:109,12:117,13:115,14:116,15:32,16:98,17:101,18:32,19:99,20:111,21:110,22:118,23:101,24:114,25:116,26:101,27:100,28:32,29:119,30:105,31:116,32:104,33:32,34:66,35:105,36:110,37:72,38:101,39:120},extractor:null},{name:"ALZip Archive",extension:"alz",mime:"application/octet-stream",description:"",signature:{0:65,1:76,2:90,3:1,4:10,5:0,6:0,7:0},extractor:null},{name:"KGB Compressed Archive",extension:"kgb",mime:"application/x-kgb-compressed",description:"",signature:{0:75,1:71,2:66,3:95,4:97,5:114,6:99,7:104,8:32,9:45},extractor:null},{name:"Microsoft Cabinet",extension:"cab",mime:"vnd.ms-cab-compressed",description:"",signature:{0:77,1:83,2:67,3:70,4:0,5:0,6:0,7:0},extractor:null},{name:"Jar Archive",extension:"jar",mime:"application/java-archive",description:"",signature:{0:95,1:39,2:168,3:137},extractor:null},{name:"Jar Archive",extension:"jar",mime:"application/java-archive",description:"",signature:{0:80,1:75,2:3,3:4,4:20,5:0,6:8,7:0,8:8,9:0},extractor:M},{name:"lzop compressed",extension:"lzop,lzo",mime:"application/x-lzop",description:"",signature:{0:137,1:76,2:90,3:79,4:0,5:13,6:10,7:26},extractor:function(t,e){var r=new L(t.slice(e)),n=0,i=0;r.moveForwardsBy(9);var s=r.readInt(2,"be");r.moveForwardsBy(6);var a=r.readInt(4,"be");2048&s&&r.moveForwardsBy(4),2&a&&n++,512&a&&n++,1&a&&i++,256&a&&i++,r.moveForwardsBy(8),s>=2368&&r.moveForwardsBy(4);var o=r.readInt(1,"be");if(r.moveForwardsBy(o),64&a){var u=r.readInt(4,"be");r.moveForwardsBy(u)}for(r.moveForwardsBy(4);r.hasMore();){var c=r.readInt(4,"be");if(0===c)break;var 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 L(t.slice(e));for(r.moveForwardsBy(8);r.hasMore();){r.moveForwardsBy(48);var n,i="",s=V(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 L(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 L(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 L(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 L(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 L(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 L(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 L(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 L(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 L(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 M(t,e){var r=new L(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 K(t,e){var r="207250237254",n=new L(t.slice(e)),i=n.getBytes(4).join("");return n.moveTo(function(t,e,r){var n=28;e&&(n+=4),t.moveTo(16);var i=t.readInt(4,r);return function(t,e,r,n){for(var i=0,s=0;s<n;s++){t.moveTo(e);var a=t.readInt(4,r);25===a?(t.moveTo(e+48),i+=t.readInt(8,r),t.moveTo(e+4),e+=t.readInt(4,r)):1===a&&(t.moveTo(e+36),i+=t.readInt(4,r),t.moveTo(e+4),e+=t.readInt(4,r))}return i}(t,n,r,i)}(n,function(t){return t===r||"254237250207"===t}(i),function(t){return"206250237254"===t||t===r}(i)?"le":"be")),n.carve()}for(var q=new Array(288),G=0;G<q.length;G++)q[G]=G<=143?8:G<=255?9:G<=279?7:8;var $=Q(q),z=Q(new Array(30).fill(5)),W=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];function J(t){for(var e=0;!e;){e=t.readBits(1,"le");var r=t.readBits(2,"le");if(0===r){t.moveForwardsBy(1);var n=t.readInt(2,"le");t.moveForwardsBy(2+n)}else if(1===r)Z(t,$,z);else{if(2!==r)throw new Error(`Invalid block type while parsing DEFLATE stream at pos ${t.position}`);for(var i=t.readBits(5,"le")+257,s=t.readBits(5,"le")+1,a=t.readBits(4,"le")+4,o=new Uint8Array(W.length),u=0;u<a;u++)o[W[u]]=t.readBits(3,"le");for(var c=Q(o),h=new Uint8Array(i+s),l=void 0,f=void 0,p=void 0,g=0;g<i+s;)switch(l=tt(t,c)){case 16:for(f=3+t.readBits(2,"le");f--;)h[g++]=p;break;case 17:for(f=3+t.readBits(3,"le");f--;)h[g++]=0;p=0;break;case 18:for(f=11+t.readBits(7,"le");f--;)h[g++]=0;p=0;break;default:h[g++]=l,p=l}Z(t,Q(h.subarray(0,i)),Q(h.subarray(i)))}}t.bitPos>0&&t.moveForwardsBy(1)}var Y=[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],X=[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 Z(t,e,r){for(var n,i=0;(n=tt(t,e))&&256!==n;){if(++i>1e4)throw new Error("Caught in probable infinite loop while parsing Huffman Block");n<256||(t.readBits(Y[n-257],"le"),n=tt(t,r),t.readBits(X[n],"le"))}}function Q(t){for(var e=Math.max.apply(Math,t),r=Math.min.apply(Math,t),n=1<<e,i=new Uint32Array(n),s=1,a=0,o=2;s<=e;){for(var u=0;u<t.length;u++)if(t[u]===s){var c=void 0,h=void 0,l=void 0;for(c=0,h=a,l=0;l<s;l++)c=c<<1|1&h,h>>=1;for(var f=s<<16|u,p=c;p<n;p+=o)i[p]=f;a++}s++,a<<=1,o<<=1}return[i,e,r]}function tt(t,e){var r=j(e,2),n=r[0],i=r[1],s=n[t.readBits(i,"le")&(1<<i)-1],a=s>>>16;if(a>i)throw new Error(`Invalid Huffman Code length while parsing DEFLATE block at pos ${t.position}: ${a}`);return t.moveBackwardsByBits(i-a),65535&s}function et(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;if(t.length){for(var n=0;n<t.length;n++)if(rt(t[n],e,r))return!0;return!1}return rt(t,e,r)}function rt(t,e){var r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0;for(var n in t){var i=parseInt(n,10)+r;switch(typeof t[n]){case"number":if(e[i]!==t[n])return!1;break;case"object":if(t[n].indexOf(e[i])<0)return!1;break;case"function":if(!t[n](e[i]))return!1;break;default:throw new Error(`Unrecognised signature type at offset ${n}`)}}return!0}var nt=r(2043),it=r.n(nt);const st=function(){function e(){t(this,e)}return n(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}();const at=function(e){s(o,e);var r,i,a=(r=o,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=c(r);if(i){var n=c(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return u(this,t)});function o(){return t(this,o),a.apply(this,arguments)}return n(o,null,[{key:"toArrayBuffer",value:function(){o.checkForValue(this.value),this.value=new Uint8Array(this.value).buffer}},{key:"fromArrayBuffer",value:function(){o.checkForValue(this.value),this.value=Array.prototype.slice.call(new Uint8Array(this.value))}}]),o}(st);const ot=function(e){s(o,e);var r,i,a=(r=o,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=c(r);if(i){var n=c(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return u(this,t)});function o(){return t(this,o),a.apply(this,arguments)}return n(o,null,[{key:"toArrayBuffer",value:function(){o.checkForValue(this.value),this.value=H().isBigNumber(this.value)?N.strToArrayBuffer(this.value.toFixed()):new ArrayBuffer}},{key:"fromArrayBuffer",value:function(t){o.checkForValue(this.value);try{this.value=new(H())(N.arrayBufferToStr(this.value,!t))}catch(t){this.value=new(H())(NaN)}}}]),o}(st);const ut=function(e){s(o,e);var r,i,a=(r=o,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=c(r);if(i){var n=c(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return u(this,t)});function o(){return t(this,o),a.apply(this,arguments)}return n(o,null,[{key:"toArrayBuffer",value:function(){var t=this;if(o.checkForValue(this.value),!R())return new Promise((function(e,r){N.readFile(t.value).then((function(e){return t.value=e.buffer})).then(e).catch(r)}));this.value=N.readFileSync(this.value)}},{key:"fromArrayBuffer",value:function(){o.checkForValue(this.value),this.value=new File(this.value,"unknown")}}]),o}(st);const ct=function(e){s(o,e);var r,i,a=(r=o,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=c(r);if(i){var n=c(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return u(this,t)});function o(){return t(this,o),a.apply(this,arguments)}return n(o,null,[{key:"toArrayBuffer",value:function(){o.checkForValue(this.value),this.value=this.value?N.strToArrayBuffer(this.value):new ArrayBuffer}},{key:"fromArrayBuffer",value:function(t){o.checkForValue(this.value),this.value=this.value?N.arrayBufferToStr(this.value,!t):""}}]),o}(st);const ht=function(e){s(o,e);var r,i,a=(r=o,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=c(r);if(i){var n=c(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return u(this,t)});function o(){return t(this,o),a.apply(this,arguments)}return n(o,null,[{key:"toArrayBuffer",value:function(){o.checkForValue(this.value),this.value=this.value?N.strToArrayBuffer(N.unescapeHtml(N.stripHtmlTags(this.value,!0))):new ArrayBuffer}}]),o}(ct);const lt=function(e){s(o,e);var r,i,a=(r=o,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=c(r);if(i){var n=c(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return u(this,t)});function o(){return t(this,o),a.apply(this,arguments)}return n(o,null,[{key:"toArrayBuffer",value:function(){o.checkForValue(this.value),this.value=void 0!==this.value?N.strToArrayBuffer(JSON.stringify(this.value,null,4)):new ArrayBuffer}},{key:"fromArrayBuffer",value:function(t){o.checkForValue(this.value),this.value=JSON.parse(N.arrayBufferToStr(this.value,!t))}}]),o}(st);const ft=function(e){s(l,e);var r,i,a,o,h=(a=l,o=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=c(a);if(o){var r=c(this).constructor;t=Reflect.construct(e,arguments,r)}else t=e.apply(this,arguments);return u(this,t)});function l(){return t(this,l),h.apply(this,arguments)}return n(l,null,[{key:"toArrayBuffer",value:(i=f(g().mark((function t(){return g().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(l.checkForValue(this.value),!R()){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,l.concatenateTypedArraysWithTypedElements.apply(l,v(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(){l.checkForValue(this.value),this.value=[new File(this.value,"unknown")]}},{key:"concatenateTypedArraysWithTypedElements",value:(r=f(g().mark((function t(){var e,r,n,i,s,a,o,u,c,h,l,f,p,d=arguments;return g().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:for(e=0,r=d.length,n=new Array(r),i=0;i<r;i++)n[i]=d[i];for(s=0,a=n;s<a.length;s++)o=a[s],e+=o.size;u=new Uint8Array(e),c=0,h=0,l=n;case 6:if(!(h<l.length)){t.next=16;break}return f=l[h],t.next=10,N.readFile(f);case 10:p=t.sent,u.set(p,c),c+=p.length;case 13:h++,t.next=6;break;case 16:return t.abrupt("return",u);case 17:case"end":return t.stop()}}),t)}))),function(){return r.apply(this,arguments)})},{key:"concatenateTypedArrays",value:function(){for(var t=0,e=arguments.length,r=new Array(e),n=0;n<e;n++)r[n]=arguments[n];for(var i=0,s=r;i<s.length;i++){var a=s[i];t+=a.length}for(var o=new Uint8Array(t),u=0,c=0,h=r;c<h.length;c++){var l=h[c];o.set(l,u),u+=l.length}return o}}]),l}(st);const pt=function(e){s(o,e);var r,i,a=(r=o,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=c(r);if(i){var n=c(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return u(this,t)});function o(){return t(this,o),a.apply(this,arguments)}return n(o,null,[{key:"toArrayBuffer",value:function(){o.checkForValue(this.value),this.value="number"==typeof this.value?N.strToArrayBuffer(this.value.toString()):new ArrayBuffer}},{key:"fromArrayBuffer",value:function(t){o.checkForValue(this.value),this.value=this.value?parseFloat(N.arrayBufferToStr(this.value,!t)):0}}]),o}(st);var gt=function(){function e(){var r=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null,n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;if(t(this,e),this.value=new ArrayBuffer(0),this.type=e.ARRAY_BUFFER,r&&Object.prototype.hasOwnProperty.call(r,"value")&&Object.prototype.hasOwnProperty.call(r,"type"))this.set(r.value,r.type);else if(r&&null!==n)this.set(r,n);else if(r){var i=e.typeEnum(r.constructor.name);this.set(r,i)}}var r;return n(e,[{key:"get",value:function(t){var r=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];return"string"==typeof t&&(t=e.typeEnum(t)),this.type!==t?R()?(this._translate(t,n),this.value):new Promise((function(e,i){r._translate(t,n).then((function(){e(r.value)})).catch(i)})):this.value}},{key:"set",value:function(t,r){if("string"==typeof r&&(r=e.typeEnum(r)),it().debug("Dish type: "+e.enumLookup(r)),this.value=t,this.type=r,!this.valid()){var n=N.truncate(JSON.stringify(this.value),25);throw new O(`Data is not a valid ${e.enumLookup(r)}: ${n}`)}}},{key:"presentAs",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],r=this.clone();return r.get(t,e)}},{key:"detectDishType",value:function(){var t=function(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:Object.keys(U);if(t instanceof ArrayBuffer&&(t=new Uint8Array(t)),!(t&&t.length>1))return[];var r=[],n={};for(var i in U)e.includes(i)&&(n[i]=U[i]);for(var s in n){n[s].forEach((function(e){et(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=f(g().mark((function t(r){var n,i;return g().wrap((function(t){for(;;)switch(t.prev=t.next){case 0:n="",t.t0=this.type,t.next=t.t0===e.FILE?4:t.t0===e.LIST_FILE?6:t.t0===e.JSON?8:t.t0===e.NUMBER||t.t0===e.BIG_NUMBER?10:t.t0===e.ARRAY_BUFFER||t.t0===e.BYTE_ARRAY?12:15;break;case 4:return n=this.value.name,t.abrupt("break",26);case 6:return n=`${this.value.length} file(s)`,t.abrupt("break",26);case 8:return n="application/json",t.abrupt("break",26);case 10:return n=this.value.toString(),t.abrupt("break",26);case 12:if(null===(n=this.detectDishType())){t.next=15;break}return t.abrupt("break",26);case 15:return t.prev=15,(i=this.clone()).value=i.value.slice(0,256),t.next=20,i.get(e.STRING);case 20:n=t.sent,t.next=26;break;case 23:t.prev=23,t.t1=t.catch(15),it().error(`${e.enumLookup(this.type)} cannot be sliced. ${t.t1}`);case 26:return t.abrupt("return",n.slice(0,r));case 27:case"end":return t.stop()}}),t,this,[[15,23]])}))),function(t){return r.apply(this,arguments)})},{key:"valid",value:function(){switch(this.type){case e.BYTE_ARRAY:if(!(this.value instanceof Uint8Array||this.value instanceof Array))return!1;for(var t=0;t<this.value.length;t++)if("number"!=typeof this.value[t]||this.value[t]<0||this.value[t]>255)return!1;return!0;case e.STRING:case e.HTML:return"string"==typeof this.value;case e.NUMBER:return"number"==typeof this.value;case e.ARRAY_BUFFER:return this.value instanceof ArrayBuffer;case e.BIG_NUMBER:if(H().isBigNumber(this.value))return!0;if(Object.keys(this.value).sort().equals(["c","e","s"])){var r=new(H());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 O("Cannot clone Dish, unknown type")}return t}},{key:"_translate",value:function(t){var r=this,n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];if(it().debug(`Translating Dish from ${e.enumLookup(this.type)} to ${e.enumLookup(t)}`),!R())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,n)}},{key:"_toArrayBuffer",value:function(){var t=this,r={browser:{[e.STRING]:function(){return Promise.resolve(ct.toArrayBuffer.bind(t)())},[e.NUMBER]:function(){return Promise.resolve(pt.toArrayBuffer.bind(t)())},[e.HTML]:function(){return Promise.resolve(ht.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(lt.toArrayBuffer.bind(t)())},[e.FILE]:function(){return ut.toArrayBuffer.bind(t)()},[e.LIST_FILE]:function(){return Promise.resolve(ft.toArrayBuffer.bind(t)())},[e.BYTE_ARRAY]:function(){return Promise.resolve(at.toArrayBuffer.bind(t)())}},node:{[e.STRING]:function(){return ct.toArrayBuffer.bind(t)()},[e.NUMBER]:function(){return pt.toArrayBuffer.bind(t)()},[e.HTML]:function(){return ht.toArrayBuffer.bind(t)()},[e.ARRAY_BUFFER]:function(){},[e.BIG_NUMBER]:function(){return ot.toArrayBuffer.bind(t)()},[e.JSON]:function(){return lt.toArrayBuffer.bind(t)()},[e.FILE]:function(){return ut.toArrayBuffer.bind(t)()},[e.LIST_FILE]:function(){return ft.toArrayBuffer.bind(t)()},[e.BYTE_ARRAY]:function(){return at.toArrayBuffer.bind(t)()}}};try{return r[R()?"node":"browser"][this.type]()}catch(t){throw new O(`Error translating from ${e.enumLookup(this.type)} to ArrayBuffer: ${t}`)}}},{key:"_fromArrayBuffer",value:function(t,r){var n=this,i={[e.STRING]:function(){return ct.fromArrayBuffer.bind(n)(r)},[e.NUMBER]:function(){return pt.fromArrayBuffer.bind(n)(r)},[e.HTML]:function(){return ht.fromArrayBuffer.bind(n)(r)},[e.ARRAY_BUFFER]:function(){},[e.BIG_NUMBER]:function(){return ot.fromArrayBuffer.bind(n)(r)},[e.JSON]:function(){return lt.fromArrayBuffer.bind(n)(r)},[e.FILE]:function(){return ut.fromArrayBuffer.bind(n)()},[e.LIST_FILE]:function(){return ft.fromArrayBuffer.bind(n)()},[e.BYTE_ARRAY]:function(){return at.fromArrayBuffer.bind(n)()}};try{i[t](),this.type=t}catch(r){throw new O(`Error translating from ArrayBuffer to ${e.enumLookup(t)}: ${r}`)}}}],[{key:"typeEnum",value:function(t){switch(t.toLowerCase()){case"bytearray":case"byte array":return e.BYTE_ARRAY;case"string":return e.STRING;case"number":return e.NUMBER;case"html":return e.HTML;case"arraybuffer":case"array buffer":return e.ARRAY_BUFFER;case"bignumber":case"big number":return e.BIG_NUMBER;case"json":case"object":return e.JSON;case"file":return e.FILE;case"list<file>":return e.LIST_FILE;default:throw new O("Invalid data type string. No matching enum.")}}},{key:"enumLookup",value:function(t){switch(t){case e.BYTE_ARRAY:return"byteArray";case e.STRING:return"string";case e.NUMBER:return"number";case e.HTML:return"html";case e.ARRAY_BUFFER:return"ArrayBuffer";case e.BIG_NUMBER:return"BigNumber";case e.JSON:return"JSON";case e.FILE:return"File";case e.LIST_FILE:return"List<File>";default:throw new O("Invalid data type enum. No matching type.")}}}]),e}();gt.BYTE_ARRAY=0,gt.STRING=1,gt.NUMBER=2,gt.HTML=3,gt.ARRAY_BUFFER=4,gt.BIG_NUMBER=5,gt.JSON=6,gt.FILE=7,gt.LIST_FILE=8;const dt=gt,mt=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.min=null,this.max=null,this.step=1,r&&this._parseConfig(r)}return n(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.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 N.parseEscapedChars(t);case"byteArray":return"string"==typeof t?F(t=t.replace(/\s+/g,"")):t;case"number":if(null===t)return t;if(r=parseFloat(t),isNaN(r))throw"Invalid ingredient value. Not a number: "+N.truncate(t.toString(),10);return r;default:return t}}}]),e}();var vt=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 n(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 dt.enumLookup(this._inputType)},set:function(t){this._inputType=dt.typeEnum(t)}},{key:"outputType",get:function(){return dt.enumLookup(this._outputType)},set:function(t){this._outputType=dt.typeEnum(t),this._presentType<0&&(this._presentType=this._outputType)}},{key:"presentType",get:function(){return dt.enumLookup(this._presentType)},set:function(t){this._presentType=dt.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),"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 mt(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 yt=vt;const xt=function(e){s(o,e);var r,i,a=(r=o,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=c(r);if(i){var n=c(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return u(this,t)});function o(){var e;return t(this,o),(e=a.call(this)).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 n(o,[{key:"run",value:function(t,e){return h.fs.asn1.ASN1Util.oidHexToInt(t.replace(/\s/g,""))}}]),o}(yt);const wt=function(e){s(o,e);var r,i,a=(r=o,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=c(r);if(i){var n=c(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return u(this,t)});function o(){var e;return t(this,o),(e=a.call(this)).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 n(o,[{key:"run",value:function(t,e){return h.fs.asn1.ASN1Util.getPEMStringFromHex(t.replace(/\s/g,""),e[0])}}]),o}(yt);const bt=function(e){s(o,e);var r,i,a=(r=o,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=c(r);if(i){var n=c(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return u(this,t)});function o(){var e;return t(this,o),(e=a.call(this)).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 n(o,[{key:"run",value:function(t,e){return h.fs.asn1.ASN1Util.oidIntToHex(t)}}]),o}(yt);const Et=function(e){s(o,e);var r,i,a=(r=o,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=c(r);if(i){var n=c(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return u(this,t)});function o(){var e;return t(this,o),(e=a.call(this)).name="Parse ASN.1 hex string",e.module="PublicKey",e.description="Abstract Syntax Notation One (ASN.1) is a standard and notation that describes rules and structures for representing, encoding, transmitting, and decoding data in telecommunications and computer networking.<br><br>This operation parses arbitrary ASN.1 data 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 n(o,[{key:"run",value:function(t,e){var r=j(e,2),n=r[0],i=r[1];return h.Xb.dump(t.replace(/\s/g,""),{ommitLongOctet:i},n)}}]),o}(yt);function St(t,e){for(var r="",n=t.array.reduce((function(t,e){return e[0].type.length>t?e[0].type.length:t}),0),i=0;i<t.array.length;i++)if(t.array[i].length){var s=t.array[i][0].type,a=t.array[i][0].value,o=`${s.padEnd(n," ")} = ${a}\n`;r+=o.padStart(e+o.length," ")}return r.slice(0,-1)}function Ft(t,e,r){t=S(F(t),":"),e*=3;for(var n="",i=0;i<t.length;i+=e){var s=t.slice(i,i+e)+"\n";n+=0===i?s:s.padStart(r+s.length," ")}return n.slice(0,n.length-1)}var At=function(e){s(o,e);var r,i,a=(r=o,i=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}(),function(){var t,e=c(r);if(i){var n=c(this).constructor;t=Reflect.construct(e,arguments,n)}else t=e.apply(this,arguments);return u(this,t)});function o(){var e;return t(this,o),(e=a.call(this)).name="Parse X.509 certificate",e.module="PublicKey",e.description="X.509 is an ITU-T standard for a public key infrastructure (PKI) and Privilege Management Infrastructure (PMI). It is commonly involved with SSL/TLS security.<br><br>This operation displays the contents of a certificate in a human readable format, similar to the openssl command line tool.<br><br>Tags: X509, server hello, handshake",e.infoURL="https://wikipedia.org/wiki/X.509",e.inputType="string",e.outputType="string",e.args=[{name:"Input format",type:"option",value:["PEM","DER Hex","Base64","Raw"]}],e.checks=[{pattern:"^-+BEGIN CERTIFICATE-+\\r?\\n[\\da-z+/\\n\\r]+-+END CERTIFICATE-+\\r?\\n?$",flags:"i",args:["PEM"]}],e}return n(o,[{key:"run",value:function(t,e){if(!t.length)return"No input";var r=new h.sO;switch(e[0]){case"DER Hex":t=t.replace(/\s/g,""),r.readCertHex(t);break;case"PEM":r.readCertPEM(t);break;case"Base64":r.readCertHex(S(E(t,null,"byteArray"),""));break;case"Raw":r.readCertHex(S(N.strToByteArray(t),""));break;default:throw"Undefined input format"}var n,i=r.getSerialNumberHex(),s=r.getIssuer(),a=r.getSubject(),o=r.getPublicKey(),u=[],c=r.getSignatureValueHex(),l="",f="";u.push({key:"Algorithm",value:o.type}),"EC"===o.type?(u.push({key:"Curve Name",value:o.curveName}),u.push({key:"Length",value:(new h.Jh(o.pubKeyHex,16).bitLength()-3)/2+" bits"}),u.push({key:"pub",value:Ft(o.pubKeyHex,16,18)})):"DSA"===o.type?(u.push({key:"pub",value:Ft(o.y.toString(16),16,18)}),u.push({key:"P",value:Ft(o.p.toString(16),16,18)}),u.push({key:"Q",value:Ft(o.q.toString(16),16,18)}),u.push({key:"G",value:Ft(o.g.toString(16),16,18)})):o.e?(u.push({key:"Length",value:o.n.bitLength()+" bits"}),u.push({key:"Modulus",value:Ft(o.n.toString(16),16,18)}),u.push({key:"Exponent",value:o.e+" (0x"+o.e.toString(16)+")"})):u.push({key:"Error",value:"Unknown Public Key type"});for(var p=0;p<u.length;p++)l+=`  ${u[p].key}:${(u[p].value+"\n").padStart(18-(u[p].key.length+3)+u[p].value.length+1," ")}`;var g=!1;try{g=0===h.Xb.dump(c).indexOf("SEQUENCE")}catch(t){}n=g?`  r:              ${Ft(h.Xb.getV(c,4),16,18)}\n  s:              ${Ft(h.Xb.getV(c,48),16,18)}`:`  Signature:      ${Ft(c,16,18)}`;try{f=r.getInfo().split("X509v3 Extensions:\n")[1].split("signature")[0]}catch(t){}var d=St(s,2),m=Bt(r.getNotBefore()),v=Bt(r.getNotAfter()),y=St(a,2);return`Version:          ${r.version} (0x${N.hex(r.version-1)})\nSerial number:    ${new h.Jh(i,16).toString()} (0x${i})\nAlgorithm ID:     ${r.getSignatureAlgorithmField()}\nValidity\n  Not Before:     ${m} (dd-mm-yyyy hh:mm:ss) (${r.getNotBefore()})\n  Not After:      ${v} (dd-mm-yyyy hh:mm:ss) (${r.getNotAfter()})\nIssuer\n${d}\nSubject\n${y}\nPublic Key\n${l.slice(0,-1)}\nCertificate Signature\n  Algorithm:      ${r.getSignatureAlgorithmName()}\n${n}\n\nExtensions\n${f}`}}]),o}(yt);function Bt(t){return 13===t.length&&(t=(t[0]<"5"?"20":"19")+t),t[6]+t[7]+"/"+t[4]+t[5]+"/"+t[0]+t[1]+t[2]+t[3]+" "+t[8]+t[9]+":"+t[10]+t[11]+":"+t[12]+t[13]}const It=At;("undefined"==typeof self?{}:self.OpModules||{}).PublicKey={"Hex to Object Identifier":xt,"Hex to PEM":wt,"Object Identifier to Hex":bt,"Parse ASN.1 hex string":Et,"Parse X.509 certificate":It}})()})();