data-api.js-core 0.0.1-security → 7.1.1
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of data-api.js-core might be problematic. Click here for more details.
- package/build.js +54 -0
- package/dist/data-api.js +912 -0
- package/package.json +89 -3
- package/README.md +0 -5
package/dist/data-api.js
ADDED
@@ -0,0 +1,912 @@
|
|
1
|
+
/*
|
2
|
+
2013-2014 Enrico Marino / Jordan Harband
|
3
|
+
@license MIT
|
4
|
+
JSON v3.3.2 | https://bestiejs.github.io/json3 | Copyright 2012-2015, Kit Cambridge, Benjamin Tan | http://kit.mit-license.org UAParser.js v0.7.21
|
5
|
+
Lightweight JavaScript-based User-Agent string parser
|
6
|
+
https://github.com/faisalman/ua-parser-js
|
7
|
+
|
8
|
+
Copyright ? 2012-2019 Faisal Salman <f@faisalman.com>
|
9
|
+
Licensed under MIT License
|
10
|
+
*/
|
11
|
+
'use strict';(function(mb,C){"object"===typeof exports&&"undefined"!==typeof module?module.exports=C():"function"===typeof define&&define.amd?define(C):(mb="undefined"!==typeof globalThis?globalThis:mb||self,mb["data-api"]=mb["data-api"]||{},mb["data-api"].js=C())})(this,function(){function mb(g){if(g.__esModule)return g;var a=Object.defineProperty({},"__esModule",{value:!0});Object.keys(g).forEach(function(b){var c=Object.getOwnPropertyDescriptor(g,b);Object.defineProperty(a,b,c.get?c:{enumerable:!0,
|
12
|
+
get:function(){return g[b]}})});return a}function C(g){var a={exports:{}};return g(a,a.exports),a.exports}function $b(g,a){return function(){let b=this.traits(),c=this.properties?this.properties():{};return ia(b,"address."+g)||ia(b,g)||(a?ia(b,"address."+a):null)||(a?ia(b,a):null)||ia(c,"address."+g)||ia(c,g)||(a?ia(c,"address."+a):null)||(a?ia(c,a):null)}}function ac(g){var a=-1,b=null==g?0:g.length;for(this.clear();++a<b;){var c=g[a];this.set(c[0],c[1])}}function Kb(g){var a=-1,b=null==g?0:g.length;
|
13
|
+
for(this.clear();++a<b;){var c=g[a];this.set(c[0],c[1])}}function bc(g){var a=-1,b=null==g?0:g.length;for(this.clear();++a<b;){var c=g[a];this.set(c[0],c[1])}}function cc(g){this.size=(this.__data__=new kd(g)).size}function oa(g,a,b,c,d,e){var f,h=a&1,m=a&2,l=a&4;b&&(f=d?b(g,c,d,e):b(g));if(void 0!==f)return f;if(!Ra(g))return g;if(c=ya(g)){if(f=xk(g),!h)return yk(g,f)}else{var n=Cc(g),k="[object Function]"==n||"[object GeneratorFunction]"==n;if(ld(g))return zk(g,h);if("[object Object]"==n||"[object Arguments]"==
|
14
|
+
n||k&&!d){if(f=m||k?{}:Ak(g),!h)return m?Bk(g,Ck(f,g)):Dk(g,Ek(f,g))}else{if(!U[n])return d?g:{};f=Fk(g,n,h)}}e||(e=new Dc);if(d=e.get(g))return d;e.set(g,f);Gk(g)?g.forEach(function(c){f.add(oa(c,a,b,c,g,e))}):Hk(g)&&g.forEach(function(c,d){f.set(d,oa(c,a,b,d,g,e))});m=l?m?Ik:ve:m?md:sa;var r=c?void 0:m(g);mg(r||g,function(c,d){r&&(d=c,c=g[d]);nd(f,d,oa(c,a,b,d,g,e))});return f}function Jk(g,a,b){return g.replace(/\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^/]+)\/|[a-zA-Z_]\w*/g,function(c){return"("==c[c.length-
|
15
|
+
1]?b(c):~a.indexOf(c)?b(c):c})}function Kk(g){return function(a){return g+a}}function ng(g){switch({}.toString.call(g)){case "[object Object]":return Lk(g);case "[object Function]":return g;case "[object String]":if(/^ *\W+/.test(g))var a=new Function("_","return _ "+g);else{a=Function;var b=og(g);if(b.length){var c;for(c=0;c<b.length;c++){var d=b[c];var e="_."+d;e="('function' == typeof "+e+" ? "+e+"() : "+e+")";g=Mk(d,g,e)}}else g="_."+g;a=new a("_","return "+g)}return a;case "[object RegExp]":return Nk(g);
|
16
|
+
default:return pg(g)}}function pg(g){return function(a){return g===a}}function Nk(g){return function(a){return g.test(a)}}function Lk(g){var a={},b;for(b in g)a[b]="string"===typeof g[b]?pg(g[b]):ng(g[b]);return function(b){if("object"!==typeof b)return!1;for(var c in a)if(!(c in b&&a[c](b[c])))return!1;return!0}}function Mk(g,a,b){return a.replace(new RegExp("(\\.)?"+g,"g"),function(a,d){return d?a:b})}function we(g,a){void 0===a&&(a=!0);return"object"===ka(g)?Ok(g,a):"array"===ka(g)?Pk(g,a):g}function Ok(g,
|
17
|
+
a){!g.length||"number"!==typeof g.length||g.length-1 in g||(g.lengthNonArray=g.length,delete g.length);xe(g,function(b,c){od.is(c,a)?g[b]=od.parse(c):("object"===ka(c)||"array"===ka(c))&&we(c,a)});g.lengthNonArray&&(g.length=g.lengthNonArray,delete g.lengthNonArray);return g}function Pk(g,a){xe(g,function(b,c){"object"===ka(b)?we(b,a):od.is(b,a)&&(g[c]=od.parse(b))});return g}function B(g,a){a=a||{};"clone"in a||(a.clone=!0);a.clone&&(g=oa(g,5));"traverse"in a||(a.traverse=!0);g.timestamp="timestamp"in
|
18
|
+
g?pd(g.timestamp):new Date;a.traverse&&qg(g);this.opts=a;this.obj=g}function Sa(g,a){B.call(this,g,a)}function qd(g,a){B.call(this,g,a)}function Ec(g,a){B.call(this,g,a)}function dc(g,a){B.call(this,g,a)}function Fc(g,a){B.call(this,g,a)}function xb(g,a){B.call(this,g,a)}function rd(g,a){B.call(this,g,a)}function Qk(g){g=String(g);if(!(100<g.length)&&(g=/^(-?(?:\d+)?\.?\d+) *(milliseconds?|msecs?|ms|seconds?|secs?|s|minutes?|mins?|m|hours?|hrs?|h|days?|d|weeks?|w|years?|yrs?|y)?$/i.exec(g))){var a=
|
19
|
+
parseFloat(g[1]);switch((g[2]||"ms").toLowerCase()){case "years":case "year":case "yrs":case "yr":case "y":return 315576E5*a;case "weeks":case "week":case "w":return 6048E5*a;case "days":case "day":case "d":return 864E5*a;case "hours":case "hour":case "hrs":case "hr":case "h":return 36E5*a;case "minutes":case "minute":case "mins":case "min":case "m":return 6E4*a;case "seconds":case "second":case "secs":case "sec":case "s":return 1E3*a;case "milliseconds":case "millisecond":case "msecs":case "msec":case "ms":return a}}}
|
20
|
+
function sd(g,a,b,c){return Math.round(g/b)+" "+c+(a>=1.5*b?"s":"")}function rg(){try{var g=document.cookie}catch(d){return"undefined"!==typeof console&&"function"===typeof console.error&&console.error(d.stack||d),{}}var a={};g=g.split(/ *; */);if(""!=g[0])for(var b=0;b<g.length;++b){var c=g[b].split("=");a[sg(c[0])]=sg(c[1])}return a}function tg(g){try{return encodeURIComponent(g)}catch(a){ug("error `encode(%o)` - %o",g,a)}}function sg(g){try{return decodeURIComponent(g)}catch(a){ug("error `decode(%o)` - %o",
|
21
|
+
g,a)}}function yb(g){this.options(g)}function Rk(){}function Gc(g){this.options(g)}function td(){this.store={}}function ec(g){this.options(g)}function ta(g){this.options(g);this.initialize()}function Hc(g){this.defaults=Hc.defaults;this.debug=Sk;Lb.call(this,g)}function ud(g){var a=-1,b=null==g?0:g.length;for(this.__data__=new vd;++a<b;)this.add(g[a])}function fc(g,a,b,c,d){if(g===a)a=!0;else if(null==g||null==a||!nb(g)&&!nb(a))a=g!==g&&a!==a;else a:{var e=ya(g),f=ya(a),h=e?"[object Array]":Cc(g),
|
22
|
+
m=f?"[object Array]":Cc(a);h="[object Arguments]"==h?"[object Object]":h;m="[object Arguments]"==m?"[object Object]":m;var l="[object Object]"==h;f="[object Object]"==m;if((m=h==m)&&ld(g)){if(!ld(a)){a=!1;break a}e=!0;l=!1}if(m&&!l)d||(d=new Dc),a=e||vg(g)?wg(g,a,b,c,fc,d):Tk(g,a,h,b,c,fc,d);else{if(!(b&1)&&(e=l&&xg.call(g,"__wrapped__"),h=f&&xg.call(a,"__wrapped__"),e||h)){g=e?g.value():g;a=h?a.value():a;d||(d=new Dc);a=fc(g,a,b,c,d);break a}if(m)b:if(d||(d=new Dc),e=b&1,h=ve(g),f=h.length,m=ve(a).length,
|
23
|
+
f==m||e){for(m=f;m--;){var n=h[m];if(!(e?n in a:Uk.call(a,n))){a=!1;break b}}l=d.get(g);n=d.get(a);if(l&&n)a=l==a&&n==g;else{l=!0;d.set(g,a);d.set(a,g);for(var k=e;++m<f;){n=h[m];var r=g[n],x=a[n];if(c)var u=e?c(x,r,n,a,g,d):c(r,x,n,g,a,d);if(void 0===u?r!==x&&!fc(r,x,b,c,d):!u){l=!1;break}k||(k="constructor"==n)}l&&!k&&(b=g.constructor,c=a.constructor,b!=c&&"constructor"in g&&"constructor"in a&&!("function"==typeof b&&b instanceof b&&"function"==typeof c&&c instanceof c)&&(l=!1));d["delete"](g);
|
24
|
+
d["delete"](a);a=l}}else a=!1;else a=!1}}return a}function ye(g,a){if("function"!=typeof g||null!=a&&"function"!=typeof a)throw new TypeError("Expected a function");var b=function(){var c=arguments,d=a?a.apply(this,c):c[0],e=b.cache;if(e.has(d))return e.get(d);c=g.apply(this,c);b.cache=e.set(d,c)||e;return c};b.cache=new (ye.Cache||vd);return b}function yg(g){if("string"==typeof g)return g;if(ya(g))return ze(g,yg)+"";if(wd(g))return zg?zg.call(g):"";var a=g+"";return"0"==a&&1/g==-Vk?"-0":a}function Ae(g,
|
25
|
+
a){try{return decodeURIComponent(g.join(""))}catch(c){}if(1===g.length)return g;a=a||1;var b=g.slice(0,a);g=g.slice(a);return Array.prototype.concat.call([],Ae(b),Ae(g))}function Wk(g){switch(g.arrayFormat){case "index":return function(a,b,c){return null===b?[Ma(a,g),"[",c,"]"].join(""):[Ma(a,g),"[",Ma(c,g),"]=",Ma(b,g)].join("")};case "bracket":return function(a,b){return null===b?Ma(a,g):[Ma(a,g),"[]=",Ma(b,g)].join("")};default:return function(a,b){return null===b?Ma(a,g):[Ma(a,g),"=",Ma(b,g)].join("")}}}
|
26
|
+
function Xk(g){var a;switch(g.arrayFormat){case "index":return function(b,c,d){a=/\[(\d*)\]$/.exec(b);b=b.replace(/\[\d*\]$/,"");a?(void 0===d[b]&&(d[b]={}),d[b][a[1]]=c):d[b]=c};case "bracket":return function(b,c,d){a=/(\[\])$/.exec(b);b=b.replace(/\[\]$/,"");d[b]=a?void 0===d[b]?[c]:[].concat(d[b],c):c};default:return function(a,c,d){d[a]=void 0===d[a]?c:[].concat(d[a],c)}}}function Ma(g,a){return a.encode?a.strict?Yk(g):encodeURIComponent(g):g}function Ag(g){return Array.isArray(g)?g.sort():"object"===
|
27
|
+
typeof g?Ag(Object.keys(g)).sort(function(a,b){return Number(a)-Number(b)}).map(function(a){return g[a]}):g}function Bg(g){var a=g.indexOf("?");return-1===a?"":g.slice(a+1)}function Cg(g,a){a=Dg({arrayFormat:"none"},a);var b=Xk(a),c=Object.create(null);if("string"!==typeof g)return c;g=g.trim().replace(/^[?#&]/,"");if(!g)return c;g.split("&").forEach(function(a){var d=a.replace(/\+/g," ").split("=");a=d.shift();d=0<d.length?d.join("="):void 0;d=void 0===d?null:Eg(d);b(Eg(a),d,c)});return Object.keys(c).sort().reduce(function(a,
|
28
|
+
b){var d=c[b];d&&"object"===typeof d&&!Array.isArray(d)?a[b]=Ag(d):a[b]=d;return a},Object.create(null))}function Zk(){var g=za.get_raw("track_cookie");if(g)try{return window.JSON.parse(atob(decodeURIComponent(g.split("--")[0])))}catch(a){}}function $k(g,a){var b=al[a.split(/_|-|=/)[0]];return b?(Array.isArray(b)?b.forEach(b=>g[b]=a):g[b]=a,!0):!1}function bl(g,a){0<=a.indexOf("gclid=")&&a.split("|").forEach(function(a){var b=a.split("=")[0];a=a.split("=")[1];b&&a&&cl.includes(b)&&(g[b]=a)})}function dl(){var g=
|
29
|
+
Zk();if(g)return g.reduce(function(a,b){$k(a,b)||bl(a,b);return a},{})}function Fg(g,a,b,c,d){var e=-1,f=g.length;b||(b=el);for(d||(d=[]);++e<f;){var h=g[e];0<a&&b(h)?1<a?Fg(h,a-1,b,c,d):Be(d,h):c||(d[d.length]=h)}return d}function Gg(){if(!Hg)throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Hg(fl)}function xd(g){return"string"===typeof g&&gl.test(g)}function yd(g){var a=1<arguments.length&&void 0!==arguments[1]?arguments[1]:
|
30
|
+
0;a=(pa[g[a+0]]+pa[g[a+1]]+pa[g[a+2]]+pa[g[a+3]]+"-"+pa[g[a+4]]+pa[g[a+5]]+"-"+pa[g[a+6]]+pa[g[a+7]]+"-"+pa[g[a+8]]+pa[g[a+9]]+"-"+pa[g[a+10]]+pa[g[a+11]]+pa[g[a+12]]+pa[g[a+13]]+pa[g[a+14]]+pa[g[a+15]]).toLowerCase();if(!xd(a))throw TypeError("Stringified UUID is invalid");return a}function Ig(g){if(!xd(g))throw TypeError("Invalid UUID");var a,b=new Uint8Array(16);b[0]=(a=parseInt(g.slice(0,8),16))>>>24;b[1]=a>>>16&255;b[2]=a>>>8&255;b[3]=a&255;b[4]=(a=parseInt(g.slice(9,13),16))>>>8;b[5]=a&255;
|
31
|
+
b[6]=(a=parseInt(g.slice(14,18),16))>>>8;b[7]=a&255;b[8]=(a=parseInt(g.slice(19,23),16))>>>8;b[9]=a&255;b[10]=(a=parseInt(g.slice(24,36),16))/1099511627776&255;b[11]=a/4294967296&255;b[12]=a>>>24&255;b[13]=a>>>16&255;b[14]=a>>>8&255;b[15]=a&255;return b}function Jg(g,a,b){function c(c,e,f,g){if("string"===typeof c){var d=unescape(encodeURIComponent(c));c=[];for(var h=0;h<d.length;++h)c.push(d.charCodeAt(h))}"string"===typeof e&&(e=Ig(e));if(16!==e.length)throw TypeError("Namespace must be array-like (16 iterable integer values, 0-255)");
|
32
|
+
d=new Uint8Array(16+c.length);d.set(e);d.set(c,e.length);d=b(d);d[6]=d[6]&15|a;d[8]=d[8]&63|128;if(f){g=g||0;for(e=0;16>e;++e)f[g+e]=d[e];return f}return yd(d)}try{c.name=g}catch(d){}c.DNS="6ba7b810-9dad-11d1-80b4-00c04fd430c8";c.URL="6ba7b811-9dad-11d1-80b4-00c04fd430c8";return c}function zb(g,a){var b=(g&65535)+(a&65535);return(g>>16)+(a>>16)+(b>>16)<<16|b&65535}function ja(g,a,b,c,d,e){g=zb(zb(a,g),zb(c,e));return zb(g<<d|g>>>32-d,b)}function ua(g,a,b,c,d,e,f){return ja(a&b|~a&c,g,a,d,e,f)}function va(g,
|
33
|
+
a,b,c,d,e,f){return ja(a&c|b&~c,g,a,d,e,f)}function wa(g,a,b,c,d,e,f){return ja(b^(a|~c),g,a,d,e,f)}function Fa(g){this.defaults=Fa.defaults;this.debug=hl;Lb.call(this,g)}function J(){this._options({});this.Integrations={};this._integrations={};this._readied=!1;this._timeout=300;this._user=xa;this.log=Na("data-api.js");Mb(this);var g=this;this.on("initialize",function(a,b){b.initialPageview&&g.page();g._parseQuery(window.location.search)})}function Ce(g){switch(Kg(g)){case "object":var a={};for(b in g)Object.prototype.hasOwnProperty.call(g,
|
34
|
+
b)&&(a[b]=Ce(g[b]));return a;case "array":a=Array(g.length);var b=0;for(var c=g.length;b<c;b++)a[b]=Ce(g[b]);return a;case "regexp":return a=g.multiline?"m":"",a+=g.global?"g":"",a+=g.ignoreCase?"i":"",new RegExp(g.source,a);case "date":return new Date(g.getTime());default:return g}}function gc(g){var a=Array.prototype.slice.call(arguments,1),b=0;return g.replace(/%([a-z])/gi,function(c,d){return gc[d]?gc[d](a[b++]):c+d})}function il(g,a){g.addEventListener("load",function(b,c){a(null,c)},!1);g.addEventListener("error",
|
35
|
+
function(b){var c=Error('script error "'+g.src+'"');c.event=b;a(c)},!1)}function jl(g,a){g.attachEvent("onreadystatechange",function(b){/complete|loaded/.test(g.readyState)&&a(null,b)});g.attachEvent("onerror",function(b){var c=Error('failed to load the script "'+g.src+'"');c.event=b||window.event;a(c)})}function kl(g){return g.replace(ll,function(a,b){return b?" "+b:""})}function ml(g){return g.replace(nl,function(a,b,c){return b+" "+c.toLowerCase().split("").join(" ")})}function Lg(g,a){var b=arguments.length;
|
36
|
+
if(0==b){b=ob.length;for(var c={},d;0<=--b;)d=ob.key(b),c[d]=Mg(ob.getItem(d));return c}if(2<=b)return Ng(g,a);if(1==b){if(null==g)return ob.clear();if("string"==typeof g)return Mg(ob.getItem(g));if("object"==typeof g)return xe(g,Ng)}}function Ng(g,a){return null==a?ob.removeItem(g):ob.setItem(g,JSON.stringify(a))}function zd(g){try{ol(window.location,"protocol",{get:function(){return g}})}catch(a){Og=g}}function De(g){"?"===g.charAt(0)&&(g=g.substring(1));g=g.replace(/\?/g,"&");var a=pl(g),b={},
|
37
|
+
c;for(c in a)Pg.call(a,c)&&"utm_"===c.substr(0,4)&&(g=c.substr(4),"campaign"===g&&(g="name"),b[g]=a[c]);return b}function Nb(g,a,b,c){this.id=a;this.name=g;this.keys=b||{};this.originalEngine=this.engine=c||ql}function pb(){this.tasks={};this.nextId=1}function Ee(g,a){return function(){return g.apply(a,arguments)}}function Oa(g,a,b){"function"===typeof a&&(b=a);this.name=g;this.id=Ic();this.fn=b;this.maxItems=a.maxItems||Infinity;this.maxAttempts=a.maxAttempts||Infinity;this.backoff={MIN_RETRY_DELAY:a.minRetryDelay||
|
38
|
+
1E3,MAX_RETRY_DELAY:a.maxRetryDelay||3E4,FACTOR:a.backoffFactor||2,JITTER:a.backoffJitter||0};this.timeouts={ACK_TIMER:1E3,RECLAIM_TIMER:3E3,RECLAIM_TIMEOUT:1E4,RECLAIM_WAIT:500};this.keys={IN_PROGRESS:"inProgress",QUEUE:"queue",RECLAIM_START:"reclaimStart",RECLAIM_END:"reclaimEnd",ACK:"ack"};this._schedule=new hc;this._processId=0;this._store=new Fe(this.name,this.id,this.keys);this._store.set(this.keys.IN_PROGRESS,{});this._store.set(this.keys.QUEUE,[]);this._ack=Ee(this._ack,this);this._checkReclaim=
|
39
|
+
Ee(this._checkReclaim,this);this._processHead=Ee(this._processHead,this);this._running=!1}function ic(g,a){k.cipher.registerAlgorithm(g,function(){return new k.aes.Algorithm(g,a)})}function Qg(){Ge=!0;Rg=[0,1,2,4,8,16,32,64,128,27,54];for(var g=Array(256),a=0;128>a;++a)g[a]=a<<1,g[a+128]=a+128<<1^283;Aa=Array(256);He=Array(256);Ob=Array(4);Ya=Array(4);for(a=0;4>a;++a)Ob[a]=Array(256),Ya[a]=Array(256);var b=0,c=0;for(a=0;256>a;++a){var d=c^c<<1^c<<2^c<<3^c<<4;d=d>>8^d&255^99;Aa[b]=d;He[d]=b;var e=
|
40
|
+
g[d];var f=g[b];var h=g[f];var m=g[h];e^=e<<24^d<<16^d<<8^d;h=(f^h^m)<<24^(b^m)<<16^(b^h^m)<<8^b^f^m;for(var l=0;4>l;++l)Ob[l][b]=e,Ya[l][d]=h,e=e<<24|e>>>8,h=h<<24|h>>>8;0===b?b=c=1:(b=f^g[g[g[f^m]]],c^=g[g[c]])}}function Sg(g,a){g=g.slice(0);for(var b,c=1,d=g.length,e=jc*(d+6+1),f=d;f<e;++f)b=g[f-1],0===f%d?(b=Aa[b>>>16&255]<<24^Aa[b>>>8&255]<<16^Aa[b&255]<<8^Aa[b>>>24]^Rg[c]<<24,c++):6<d&&4===f%d&&(b=Aa[b>>>24]<<24^Aa[b>>>16&255]<<16^Aa[b>>>8&255]<<8^Aa[b&255]),g[f]=g[f-d]^b;if(a){b=Ya[0];c=Ya[1];
|
41
|
+
d=Ya[2];var h=Ya[3],m=g.slice(0);e=g.length;f=0;for(var l=e-jc;f<e;f+=jc,l-=jc)if(0===f||f===e-jc)m[f]=g[l],m[f+1]=g[l+3],m[f+2]=g[l+2],m[f+3]=g[l+1];else for(var n=0;n<jc;++n)a=g[l+n],m[f+(3&-n)]=b[Aa[a>>>24]]^c[Aa[a>>>16&255]]^d[Aa[a>>>8&255]]^h[Aa[a&255]];g=m}return g}function Ie(g,a,b,c){var d=g.length/4-1;if(c){var e=Ya[0];var f=Ya[1];var h=Ya[2];var m=Ya[3];var l=He}else e=Ob[0],f=Ob[1],h=Ob[2],m=Ob[3],l=Aa;var n=a[0]^g[0];var k=a[c?3:1]^g[1];var r=a[2]^g[2];a=a[c?1:3]^g[3];for(var x=3,u=1;u<
|
42
|
+
d;++u){var v=e[n>>>24]^f[k>>>16&255]^h[r>>>8&255]^m[a&255]^g[++x];var S=e[k>>>24]^f[r>>>16&255]^h[a>>>8&255]^m[n&255]^g[++x];var p=e[r>>>24]^f[a>>>16&255]^h[n>>>8&255]^m[k&255]^g[++x];a=e[a>>>24]^f[n>>>16&255]^h[k>>>8&255]^m[r&255]^g[++x];n=v;k=S;r=p}b[0]=l[n>>>24]<<24^l[k>>>16&255]<<16^l[r>>>8&255]<<8^l[a&255]^g[++x];b[c?3:1]=l[k>>>24]<<24^l[r>>>16&255]<<16^l[a>>>8&255]<<8^l[n&255]^g[++x];b[2]=l[r>>>24]<<24^l[a>>>16&255]<<16^l[n>>>8&255]<<8^l[k&255]^g[++x];b[c?1:3]=l[a>>>24]<<24^l[n>>>16&255]<<16^
|
43
|
+
l[k>>>8&255]<<8^l[r&255]^g[++x]}function Ad(g){g=g||{};var a="AES-"+(g.mode||"CBC").toUpperCase();var b=g.decrypt?k.cipher.createDecipher(a,g.key):k.cipher.createCipher(a,g.key);var c=b.start;b.start=function(a,e){var d=null;e instanceof k.util.ByteBuffer&&(d=e,e={});e=e||{};e.output=d;e.iv=a;c.call(b,e)};return b}function db(g,a){k.cipher.registerAlgorithm(g,function(){return new k.des.Algorithm(g,a)})}function Tg(g,a,b,c){var d=32===g.length?3:9;c=3===d?c?[30,-2,-2]:[0,32,2]:c?[94,62,-2,32,64,2,
|
44
|
+
30,-2,-2]:[0,32,2,62,30,-2,64,96,2];var e=a[0],f=a[1];a=(e>>>4^f)&252645135;f^=a;e^=a<<4;a=(e>>>16^f)&65535;f^=a;e^=a<<16;a=(f>>>2^e)&858993459;e^=a;f^=a<<2;a=(f>>>8^e)&16711935;e^=a;f^=a<<8;a=(e>>>1^f)&1431655765;f^=a;e^=a<<1;e=e<<1|e>>>31;f=f<<1|f>>>31;for(var h=0;h<d;h+=3){for(var m=c[h+1],l=c[h+2],n=c[h];n!=m;n+=l){var k=f^g[n],r=(f>>>4|f<<28)^g[n+1];a=e;e=f;f=a^(rl[k>>>24&63]|sl[k>>>16&63]|tl[k>>>8&63]|ul[k&63]|vl[r>>>24&63]|wl[r>>>16&63]|xl[r>>>8&63]|yl[r&63])}a=e;e=f;f=a}e=e>>>1|e<<31;f=f>>>
|
45
|
+
1|f<<31;a=(e>>>1^f)&1431655765;f^=a;e^=a<<1;a=(f>>>8^e)&16711935;e^=a;f^=a<<8;a=(f>>>2^e)&858993459;e^=a;f^=a<<2;a=(e>>>16^f)&65535;f^=a;e^=a<<16;a=(e>>>4^f)&252645135;b[0]=e^a<<4;b[1]=f^a}function Bd(g){g=g||{};var a="DES-"+(g.mode||"CBC").toUpperCase();var b=g.decrypt?k.cipher.createDecipher(a,g.key):k.cipher.createCipher(a,g.key);var c=b.start;b.start=function(a,e){var d=null;e instanceof k.util.ByteBuffer&&(d=e,e={});e=e||{};e.output=d;e.iv=a;c.call(b,e)};return b}function z(g,a,b){this.data=
|
46
|
+
[];null!=g&&("number"==typeof g?this.fromNumber(g,a,b):null==a&&"string"!=typeof g?this.fromString(g,256):this.fromString(g,a))}function H(){return new z(null)}function zl(g,a,b,c,d,e){for(;0<=--e;){var f=a*this.data[g++]+b.data[c]+d;d=Math.floor(f/67108864);b.data[c++]=f&67108863}return d}function Al(g,a,b,c,d,e){var f=a&32767;for(a>>=15;0<=--e;){var h=this.data[g]&32767,m=this.data[g++]>>15,l=a*h+m*f;h=f*h+((l&32767)<<15)+b.data[c]+(d&1073741823);d=(h>>>30)+(l>>>15)+a*m+(d>>>30);b.data[c++]=h&1073741823}return d}
|
47
|
+
function Ug(g,a,b,c,d,e){var f=a&16383;for(a>>=14;0<=--e;){var h=this.data[g]&16383,m=this.data[g++]>>14,l=a*h+m*f;h=f*h+((l&16383)<<14)+b.data[c]+d;d=(h>>28)+(l>>14)+a*m;b.data[c++]=h&268435455}return d}function Vg(g,a){g=Cd[g.charCodeAt(a)];return null==g?-1:g}function Ab(g){var a=H();a.fromInt(g);return a}function Dd(g){var a=1,b;0!=(b=g>>>16)&&(g=b,a+=16);0!=(b=g>>8)&&(g=b,a+=8);0!=(b=g>>4)&&(g=b,a+=4);0!=(b=g>>2)&&(g=b,a+=2);0!=g>>1&&(a+=1);return a}function Pb(g){this.m=g}function Qb(g){this.m=
|
48
|
+
g;this.mp=g.invDigit();this.mpl=this.mp&32767;this.mph=this.mp>>15;this.um=(1<<g.DB-15)-1;this.mt2=2*g.t}function Bl(g,a){return g&a}function Je(g,a){return g|a}function Wg(g,a){return g^a}function Xg(g,a){return g&~a}function Jc(){}function Yg(g){return g}function kc(g){this.r2=H();this.q3=H();z.ONE.dlShiftTo(2*g.t,this.r2);this.mu=this.r2.divide(g);this.m=g}function Cl(){return{nextBytes:function(g){for(var a=0;a<g.length;++a)g[a]=Math.floor(256*Math.random())}}}function Zg(g,a,b){var c=k.util.createBuffer();
|
49
|
+
a=Math.ceil(a.n.bitLength()/8);if(g.length>a-11)throw c=Error("Message is too long for PKCS#1 v1.5 padding."),c.length=g.length,c.max=a-11,c;c.putByte(0);c.putByte(b);a=a-3-g.length;if(0===b||1===b){b=0===b?0:255;for(var d=0;d<a;++d)c.putByte(b)}else for(;0<a;){var e=0,f=k.random.getBytes(a);for(d=0;d<a;++d)b=f.charCodeAt(d),0===b?++e:c.putByte(b);a=e}c.putByte(0);c.putBytes(g);return c}function Ed(g,a,b,c){a=Math.ceil(a.n.bitLength()/8);g=k.util.createBuffer(g);var d=g.getByte(),e=g.getByte();if(0!==
|
50
|
+
d||b&&0!==e&&1!==e||!b&&2!=e||b&&0===e&&"undefined"===typeof c)throw Error("Encryption block is invalid.");b=0;if(0===e)for(b=a-3-c,c=0;c<b;++c){if(0!==g.getByte())throw Error("Encryption block is invalid.");}else if(1===e)for(b=0;1<g.length();){if(255!==g.getByte()){--g.read;break}++b}else if(2===e)for(b=0;1<g.length();){if(0===g.getByte()){--g.read;break}++b}if(0!==g.getByte()||b!==a-3-g.length())throw Error("Encryption block is invalid.");return g.getBytes()}function Dl(g,a,b){function c(){d(g.pBits,
|
51
|
+
function(a,c){if(a)return b(a);g.p=c;if(null!==g.q)return e(a,g.q);d(g.qBits,e)})}function d(a,b){k.prime.generateProbablePrime(a,f,b)}function e(a,f){if(a)return b(a);g.q=f;0>g.p.compareTo(g.q)&&(a=g.p,g.p=g.q,g.q=a);0!==g.p.subtract(M.ONE).gcd(g.e).compareTo(M.ONE)?(g.p=null,c()):0!==g.q.subtract(M.ONE).gcd(g.e).compareTo(M.ONE)?(g.q=null,d(g.qBits,e)):(g.p1=g.p.subtract(M.ONE),g.q1=g.q.subtract(M.ONE),g.phi=g.p1.multiply(g.q1),0!==g.phi.gcd(g.e).compareTo(M.ONE)?(g.p=g.q=null,c()):(g.n=g.p.multiply(g.q),
|
52
|
+
g.n.bitLength()!==g.bits?(g.q=null,d(g.qBits,e)):(a=g.e.modInverse(g.phi),g.keys={privateKey:F.rsa.setPrivateKey(g.n,g.e,a,g.p,g.q,a.mod(g.p1),a.mod(g.q1),g.q.modInverse(g.p)),publicKey:F.rsa.setPublicKey(g.n,g.e)},b(null,g.keys))))}"function"===typeof a&&(b=a,a={});a=a||{};var f={algorithm:{name:a.algorithm||"PRIMEINC",options:{workers:a.workers||2,workLoad:a.workLoad||100,workerScript:a.workerScript}}};"prng"in a&&(f.prng=a.prng);c()}function eb(g){g=g.toString(16);"8"<=g[0]&&(g="00"+g);g=k.util.hexToBytes(g);
|
53
|
+
return 1<g.length&&(0===g.charCodeAt(0)&&0===(g.charCodeAt(1)&128)||255===g.charCodeAt(0)&&128===(g.charCodeAt(1)&128))?g.substr(1):g}function El(g){return 100>=g?27:150>=g?18:200>=g?15:250>=g?12:300>=g?9:350>=g?8:400>=g?7:500>=g?6:600>=g?5:800>=g?4:1250>=g?3:2}function $g(g){return"undefined"!==typeof Ta.globalScope&&"object"===typeof Ta.globalScope.crypto&&"object"===typeof Ta.globalScope.crypto.subtle&&"function"===typeof Ta.globalScope.crypto.subtle[g]}function ah(g){return"undefined"!==typeof Ta.globalScope&&
|
54
|
+
"object"===typeof Ta.globalScope.msCrypto&&"object"===typeof Ta.globalScope.msCrypto.subtle&&"function"===typeof Ta.globalScope.msCrypto.subtle[g]}function bh(g){g=k.util.hexToBytes(g.toString(16));for(var a=new Uint8Array(g.length),b=0;b<g.length;++b)a[b]=g.charCodeAt(b);return a}function ch(g,a){return g.start().update(a).digest().getBytes()}function dh(g){if(g){var a=G.oids[y.derToOid(g)];if(!a)throw a=Error("Unsupported PRF OID."),a.oid=g,a.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256",
|
55
|
+
"hmacWithSHA384","hmacWithSHA512"],a;}else a="hmacWithSHA1";return eh(a)}function eh(g){var a=k.md;switch(g){case "hmacWithSHA224":a=k.md.sha512;case "hmacWithSHA1":case "hmacWithSHA256":case "hmacWithSHA384":case "hmacWithSHA512":g=g.substr(8).toLowerCase();break;default:throw a=Error("Unsupported PRF algorithm."),a.algorithm=g,a.supported=["hmacWithSHA1","hmacWithSHA224","hmacWithSHA256","hmacWithSHA384","hmacWithSHA512"],a;}if(!(a&&g in a))throw Error("Unknown hash algorithm: "+g);return a[g].create()}
|
56
|
+
function qb(g){var a=g.message;if(a instanceof Uint8Array||a instanceof Ga)return a;var b=g.encoding;if(void 0===a)if(g.md)a=g.md.digest().getBytes(),b="binary";else throw new TypeError('"options.message" or "options.md" not specified.');if("string"===typeof a&&!b)throw new TypeError('"options.encoding" must be "binary" or "utf8".');if("string"===typeof a){if("undefined"!==typeof Buffer)return Buffer.from(a,b);a=new Ke(a,b)}else if(!(a instanceof Ke))throw new TypeError('"options.message" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a string with "options.encoding" specifying its encoding.');
|
57
|
+
g=new Ga(a.length());for(b=0;b<g.length;++b)g[b]=a.at(b);return g}function Kc(g,a){var b=k.md.sha512.create();g=new Ke(g);b.update(g.getBytes(a),"binary");a=b.digest().getBytes();if("undefined"!==typeof Buffer)return Buffer.from(a,"binary");b=new Ga(D.constants.HASH_BYTE_LENGTH);for(g=0;64>g;++g)b[g]=a.charCodeAt(g);return b}function fh(g,a){var b,c;for(b=63;32<=b;--b){var d=0;var e=b-32;for(c=b-12;e<c;++e)a[e]+=d-16*a[b]*Le[e-(b-32)],d=a[e]+128>>8,a[e]-=256*d;a[e]+=d;a[b]=0}for(e=d=0;32>e;++e)a[e]+=
|
58
|
+
d-(a[31]>>4)*Le[e],d=a[e]>>8,a[e]&=255;for(e=0;32>e;++e)a[e]-=d*Le[e];for(b=0;32>b;++b)a[b+1]+=a[b]>>8,g[b]=a[b]&255}function Me(g){for(var a=new Float64Array(64),b=0;64>b;++b)a[b]=g[b],g[b]=0;fh(g,a)}function Ne(g,a){var b=E(),c=E(),d=E(),e=E(),f=E(),h=E(),m=E(),l=E(),n=E();lc(b,g[1],g[0]);lc(n,a[1],a[0]);P(b,b,n);mc(c,g[0],g[1]);mc(n,a[0],a[1]);P(c,c,n);P(d,g[3],a[3]);P(d,d,Fl);P(e,g[2],a[2]);mc(e,e,e);lc(f,c,b);lc(h,e,d);mc(m,e,d);mc(l,c,b);P(g[0],f,h);P(g[1],l,m);P(g[2],m,h);P(g[3],f,l)}function Oe(g,
|
59
|
+
a){var b=E(),c=E(),d=E(),e=a[2],f=E(),h;for(h=0;16>h;++h)f[h]=e[h];for(h=253;0<=h;--h)P(f,f,f),2!==h&&4!==h&&P(f,f,e);for(h=0;16>h;++h)d[h]=f[h];P(b,a[0],d);P(c,a[1],d);Fd(g,c);g[31]^=gh(b)<<7}function Fd(g,a){var b,c=E(),d=E();for(b=0;16>b;++b)d[b]=a[b];Pe(d);Pe(d);Pe(d);for(a=0;2>a;++a){c[0]=d[0]-65517;for(b=1;15>b;++b)c[b]=d[b]-65535-(c[b-1]>>16&1),c[b-1]&=65535;c[15]=d[15]-32767-(c[14]>>16&1);b=c[15]>>16&1;c[14]&=65535;Qe(d,c,1-b)}for(b=0;16>b;b++)g[2*b]=d[b]&255,g[2*b+1]=d[b]>>8}function hh(g,
|
60
|
+
a){var b=new Ga(32),c=new Ga(32);Fd(b,g);Fd(c,a);return ih(b,0,c,0)}function ih(g,a,b,c){var d,e=0;for(d=0;32>d;++d)e|=g[a+d]^b[c+d];return(1&e-1>>>8)-1}function gh(g){var a=new Ga(32);Fd(a,g);return a[0]&1}function jh(g,a,b){var c;Bb(g[0],Re);Bb(g[1],Gd);Bb(g[2],Gd);Bb(g[3],Re);for(c=255;0<=c;--c){var d=b[c/8|0]>>(c&7)&1;for(var e=g,f=a,h=d,m=0;4>m;++m)Qe(e[m],f[m],h);Ne(a,g);Ne(g,g);e=g;f=a;for(h=0;4>h;++h)Qe(e[h],f[h],d)}}function Se(g,a){var b=[E(),E(),E(),E()];Bb(b[0],kh);Bb(b[1],lh);Bb(b[2],
|
61
|
+
Gd);P(b[3],kh,lh);jh(g,b,a)}function Bb(g,a){var b;for(b=0;16>b;b++)g[b]=a[b]|0}function Pe(g){var a,b=1;for(a=0;16>a;++a){var c=g[a]+b+65535;b=Math.floor(c/65536);g[a]=c-65536*b}g[0]+=b-1+37*(b-1)}function Qe(g,a,b){for(var c=~(b-1),d=0;16>d;++d)b=c&(g[d]^a[d]),g[d]^=b,a[d]^=b}function E(g){var a,b=new Float64Array(16);if(g)for(a=0;a<g.length;++a)b[a]=g[a];return b}function mc(g,a,b){for(var c=0;16>c;++c)g[c]=a[c]+b[c]}function lc(g,a,b){for(var c=0;16>c;++c)g[c]=a[c]-b[c]}function P(g,a,b){var c=
|
62
|
+
b[0],d=b[1],e=b[2],f=b[3],h=b[4],m=b[5],l=b[6],n=b[7],k=b[8],r=b[9],x=b[10],u=b[11],v=b[12],S=b[13],p=b[14],q=b[15];b=a[0];var R=b*c;var N=b*d;var ea=b*e;var O=b*f;var Q=b*h;var Ba=b*m;var t=b*l;var w=b*n;var y=b*k;var z=b*r;var B=b*x;var A=b*u;var T=b*v;var V=b*S;var W=b*p;var Y=b*q;b=a[1];N+=b*c;ea+=b*d;O+=b*e;Q+=b*f;Ba+=b*h;t+=b*m;w+=b*l;y+=b*n;z+=b*k;B+=b*r;A+=b*x;T+=b*u;V+=b*v;W+=b*S;Y+=b*p;var L=b*q;b=a[2];ea+=b*c;O+=b*d;Q+=b*e;Ba+=b*f;t+=b*h;w+=b*m;y+=b*l;z+=b*n;B+=b*k;A+=b*r;T+=b*x;V+=b*u;
|
63
|
+
W+=b*v;Y+=b*S;L+=b*p;var E=b*q;b=a[3];O+=b*c;Q+=b*d;Ba+=b*e;t+=b*f;w+=b*h;y+=b*m;z+=b*l;B+=b*n;A+=b*k;T+=b*r;V+=b*x;W+=b*u;Y+=b*v;L+=b*S;E+=b*p;var C=b*q;b=a[4];Q+=b*c;Ba+=b*d;t+=b*e;w+=b*f;y+=b*h;z+=b*m;B+=b*l;A+=b*n;T+=b*k;V+=b*r;W+=b*x;Y+=b*u;L+=b*v;E+=b*S;C+=b*p;var F=b*q;b=a[5];Ba+=b*c;t+=b*d;w+=b*e;y+=b*f;z+=b*h;B+=b*m;A+=b*l;T+=b*n;V+=b*k;W+=b*r;Y+=b*x;L+=b*u;E+=b*v;C+=b*S;F+=b*p;var G=b*q;b=a[6];t+=b*c;w+=b*d;y+=b*e;z+=b*f;B+=b*h;A+=b*m;T+=b*l;V+=b*n;W+=b*k;Y+=b*r;L+=b*x;E+=b*u;C+=b*v;F+=
|
64
|
+
b*S;G+=b*p;var I=b*q;b=a[7];w+=b*c;y+=b*d;z+=b*e;B+=b*f;A+=b*h;T+=b*m;V+=b*l;W+=b*n;Y+=b*k;L+=b*r;E+=b*x;C+=b*u;F+=b*v;G+=b*S;I+=b*p;var K=b*q;b=a[8];y+=b*c;z+=b*d;B+=b*e;A+=b*f;T+=b*h;V+=b*m;W+=b*l;Y+=b*n;L+=b*k;E+=b*r;C+=b*x;F+=b*u;G+=b*v;I+=b*S;K+=b*p;var J=b*q;b=a[9];z+=b*c;B+=b*d;A+=b*e;T+=b*f;V+=b*h;W+=b*m;Y+=b*l;L+=b*n;E+=b*k;C+=b*r;F+=b*x;G+=b*u;I+=b*v;K+=b*S;J+=b*p;var D=b*q;b=a[10];B+=b*c;A+=b*d;T+=b*e;V+=b*f;W+=b*h;Y+=b*m;L+=b*l;E+=b*n;C+=b*k;F+=b*r;G+=b*x;I+=b*u;K+=b*v;J+=b*S;D+=b*p;var H=
|
65
|
+
b*q;b=a[11];A+=b*c;T+=b*d;V+=b*e;W+=b*f;Y+=b*h;L+=b*m;E+=b*l;C+=b*n;F+=b*k;G+=b*r;I+=b*x;K+=b*u;J+=b*v;D+=b*S;H+=b*p;var M=b*q;b=a[12];T+=b*c;V+=b*d;W+=b*e;Y+=b*f;L+=b*h;E+=b*m;C+=b*l;F+=b*n;G+=b*k;I+=b*r;K+=b*x;J+=b*u;D+=b*v;H+=b*S;M+=b*p;var P=b*q;b=a[13];V+=b*c;W+=b*d;Y+=b*e;L+=b*f;E+=b*h;C+=b*m;F+=b*l;G+=b*n;I+=b*k;K+=b*r;J+=b*x;D+=b*u;H+=b*v;M+=b*S;P+=b*p;var mh=b*q;b=a[14];W+=b*c;Y+=b*d;L+=b*e;E+=b*f;C+=b*h;F+=b*m;G+=b*l;I+=b*n;K+=b*k;J+=b*r;D+=b*x;H+=b*u;M+=b*v;P+=b*S;mh+=b*p;var Gl=b*q;b=
|
66
|
+
a[15];Y+=b*c;N+=38*(E+b*e);ea+=38*(C+b*f);O+=38*(F+b*h);Q+=38*(G+b*m);Ba+=38*(I+b*l);t+=38*(K+b*n);w+=38*(J+b*k);y+=38*(D+b*r);z+=38*(H+b*x);B+=38*(M+b*u);A+=38*(P+b*v);T+=38*(mh+b*S);V+=38*(Gl+b*p);W+=38*b*q;b=R+38*(L+b*d)+1+65535;a=Math.floor(b/65536);R=b-65536*a;b=N+a+65535;a=Math.floor(b/65536);N=b-65536*a;b=ea+a+65535;a=Math.floor(b/65536);ea=b-65536*a;b=O+a+65535;a=Math.floor(b/65536);O=b-65536*a;b=Q+a+65535;a=Math.floor(b/65536);Q=b-65536*a;b=Ba+a+65535;a=Math.floor(b/65536);Ba=b-65536*a;b=
|
67
|
+
t+a+65535;a=Math.floor(b/65536);t=b-65536*a;b=w+a+65535;a=Math.floor(b/65536);w=b-65536*a;b=y+a+65535;a=Math.floor(b/65536);y=b-65536*a;b=z+a+65535;a=Math.floor(b/65536);z=b-65536*a;b=B+a+65535;a=Math.floor(b/65536);B=b-65536*a;b=A+a+65535;a=Math.floor(b/65536);A=b-65536*a;b=T+a+65535;a=Math.floor(b/65536);T=b-65536*a;b=V+a+65535;a=Math.floor(b/65536);V=b-65536*a;b=W+a+65535;a=Math.floor(b/65536);W=b-65536*a;b=Y+a+65535;a=Math.floor(b/65536);Y=b-65536*a;R+=a-1+37*(a-1);b=R+1+65535;a=Math.floor(b/
|
68
|
+
65536);R=b-65536*a;b=N+a+65535;a=Math.floor(b/65536);N=b-65536*a;b=ea+a+65535;a=Math.floor(b/65536);ea=b-65536*a;b=O+a+65535;a=Math.floor(b/65536);O=b-65536*a;b=Q+a+65535;a=Math.floor(b/65536);Q=b-65536*a;b=Ba+a+65535;a=Math.floor(b/65536);Ba=b-65536*a;b=t+a+65535;a=Math.floor(b/65536);t=b-65536*a;b=w+a+65535;a=Math.floor(b/65536);w=b-65536*a;b=y+a+65535;a=Math.floor(b/65536);y=b-65536*a;b=z+a+65535;a=Math.floor(b/65536);z=b-65536*a;b=B+a+65535;a=Math.floor(b/65536);B=b-65536*a;b=A+a+65535;a=Math.floor(b/
|
69
|
+
65536);A=b-65536*a;b=T+a+65535;a=Math.floor(b/65536);T=b-65536*a;b=V+a+65535;a=Math.floor(b/65536);V=b-65536*a;b=W+a+65535;a=Math.floor(b/65536);W=b-65536*a;b=Y+a+65535;a=Math.floor(b/65536);g[0]=R+(a-1+37*(a-1));g[1]=N;g[2]=ea;g[3]=O;g[4]=Q;g[5]=Ba;g[6]=t;g[7]=w;g[8]=y;g[9]=z;g[10]=B;g[11]=A;g[12]=T;g[13]=V;g[14]=W;g[15]=b-65536*a}function nh(g,a,b,c){g.generate=function(d,e){for(var f=new k.util.ByteBuffer,g=Math.ceil(e/c)+b,m=new k.util.ByteBuffer,l=b;l<g;++l){m.putInt32(l);a.start();a.update(d+
|
70
|
+
m.getBytes());var n=a.digest();f.putBytes(n.getBytes(c))}f.truncate(f.length()-e);return f.getBytes()}}var Ia="undefined"!==typeof globalThis?globalThis:"undefined"!==typeof window?window:"undefined"!==typeof global?global:"undefined"!==typeof self?self:{},ia=C(function(g){function a(a){return function(b,c,e,g){function f(){for(l in b){var a=h(l);if(0===c.indexOf(a)&&(a=c.substr(a.length),"."===a.charAt(0)||0===a.length)){c=a.substr(1);a=b[l];if(null==a){m=!0;return}if(!c.length){m=!0;return}b=a;
|
71
|
+
return}}l=void 0;m=!0}var h=g&&"function"===typeof g.normalizer?g.normalizer:d;c=h(c);for(var l,m=!1;!m;)f();if(l)return null==b?b:a(b,l,e)}}function b(a,b){a.hasOwnProperty(b)&&delete a[b];return a}function c(a,b,c){a.hasOwnProperty(b)&&(a[b]=c);return a}function d(a){return a.replace(/[^a-zA-Z0-9\.]+/g,"").toLowerCase()}g.exports=a(function(a,b){if(a.hasOwnProperty(b))return a[b]});g.exports.find=g.exports;g.exports.replace=function(b,d,g,m){a(c).call(this,b,d,g,m);return b};g.exports.del=function(c,
|
72
|
+
d,g){a(b).call(this,c,d,null,g);return c}}),Lc=function(g,a){return g===a||g!==g&&a!==a},Hd=function(g,a){for(var b=g.length;b--;)if(Lc(g[b][0],a))return b;return-1},Hl=Array.prototype.splice;ac.prototype.clear=function(){this.__data__=[];this.size=0};ac.prototype["delete"]=function(g){var a=this.__data__;g=Hd(a,g);if(0>g)return!1;g==a.length-1?a.pop():Hl.call(a,g,1);--this.size;return!0};ac.prototype.get=function(g){var a=this.__data__;g=Hd(a,g);return 0>g?void 0:a[g][1]};ac.prototype.has=function(g){return-1<
|
73
|
+
Hd(this.__data__,g)};ac.prototype.set=function(g,a){var b=this.__data__,c=Hd(b,g);0>c?(++this.size,b.push([g,a])):b[c][1]=a;return this};var kd=ac,oh="object"==typeof Ia&&Ia&&Ia.Object===Object&&Ia,Il="object"==typeof self&&self&&self.Object===Object&&self,fb=oh||Il||Function("return this")(),Ua=fb.Symbol,ph=Object.prototype,Jl=ph.hasOwnProperty,Kl=ph.toString,Mc=Ua?Ua.toStringTag:void 0,Ll=Object.prototype.toString,qh=Ua?Ua.toStringTag:void 0,Rb=function(g){if(null==g)g=void 0===g?"[object Undefined]":
|
74
|
+
"[object Null]";else if(qh&&qh in Object(g)){var a=Jl.call(g,Mc),b=g[Mc];try{g[Mc]=void 0;var c=!0}catch(e){}var d=Kl.call(g);c&&(a?g[Mc]=b:delete g[Mc]);g=d}else g=Ll.call(g);return g},Ra=function(g){var a=typeof g;return null!=g&&("object"==a||"function"==a)},rh=function(g){if(!Ra(g))return!1;g=Rb(g);return"[object Function]"==g||"[object GeneratorFunction]"==g||"[object AsyncFunction]"==g||"[object Proxy]"==g},Te=fb["__core-js_shared__"],sh=function(){var g=/[^.]+$/.exec(Te&&Te.keys&&Te.keys.IE_PROTO||
|
75
|
+
"");return g?"Symbol(src)_1."+g:""}(),Ml=Function.prototype.toString,Sb=function(g){if(null!=g){try{return Ml.call(g)}catch(a){}return g+""}return""},Nl=/^\[object .+?Constructor\]$/,Ol=RegExp("^"+Function.prototype.toString.call(Object.prototype.hasOwnProperty).replace(/[\\^$.*+?()[\]{}|]/g,"\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),Tb=function(g,a){g=null==g?void 0:g[a];return(!Ra(g)||sh&&sh in g?0:(rh(g)?Ol:Nl).test(Sb(g)))?g:void 0},Nc=Tb(fb,"Map"),
|
76
|
+
Oc=Tb(Object,"create"),Pl=Object.prototype.hasOwnProperty,Ql=Object.prototype.hasOwnProperty;Kb.prototype.clear=function(){this.__data__=Oc?Oc(null):{};this.size=0};Kb.prototype["delete"]=function(g){g=this.has(g)&&delete this.__data__[g];this.size-=g?1:0;return g};Kb.prototype.get=function(g){var a=this.__data__;return Oc?(g=a[g],"__lodash_hash_undefined__"===g?void 0:g):Pl.call(a,g)?a[g]:void 0};Kb.prototype.has=function(g){var a=this.__data__;return Oc?void 0!==a[g]:Ql.call(a,g)};Kb.prototype.set=
|
77
|
+
function(g,a){var b=this.__data__;this.size+=this.has(g)?0:1;b[g]=Oc&&void 0===a?"__lodash_hash_undefined__":a;return this};var Id=function(g,a){g=g.__data__;var b=typeof a;return("string"==b||"number"==b||"symbol"==b||"boolean"==b?"__proto__"!==a:null===a)?g["string"==typeof a?"string":"hash"]:g.map};bc.prototype.clear=function(){this.size=0;this.__data__={hash:new Kb,map:new (Nc||kd),string:new Kb}};bc.prototype["delete"]=function(g){g=Id(this,g)["delete"](g);this.size-=g?1:0;return g};bc.prototype.get=
|
78
|
+
function(g){return Id(this,g).get(g)};bc.prototype.has=function(g){return Id(this,g).has(g)};bc.prototype.set=function(g,a){var b=Id(this,g),c=b.size;b.set(g,a);this.size+=b.size==c?0:1;return this};var vd=bc;cc.prototype.clear=function(){this.__data__=new kd;this.size=0};cc.prototype["delete"]=function(g){var a=this.__data__;g=a["delete"](g);this.size=a.size;return g};cc.prototype.get=function(g){return this.__data__.get(g)};cc.prototype.has=function(g){return this.__data__.has(g)};cc.prototype.set=
|
79
|
+
function(g,a){var b=this.__data__;if(b instanceof kd){var c=b.__data__;if(!Nc||199>c.length)return c.push([g,a]),this.size=++b.size,this;b=this.__data__=new vd(c)}b.set(g,a);this.size=b.size;return this};var Dc=cc,mg=function(g,a){for(var b=-1,c=null==g?0:g.length;++b<c&&!1!==a(g[b],b,g););return g},Jd=function(){try{var g=Tb(Object,"defineProperty");g({},"",{});return g}catch(a){}}(),th=function(g,a,b){"__proto__"==a&&Jd?Jd(g,a,{configurable:!0,enumerable:!0,value:b,writable:!0}):g[a]=b},Rl=Object.prototype.hasOwnProperty,
|
80
|
+
nd=function(g,a,b){var c=g[a];Rl.call(g,a)&&Lc(c,b)&&(void 0!==b||a in g)||th(g,a,b)},Pc=function(g,a,b,c){var d=!b;b||(b={});for(var e=-1,f=a.length;++e<f;){var h=a[e],m=c?c(b[h],g[h],h,b,g):void 0;void 0===m&&(m=g[h]);d?th(b,h,m):nd(b,h,m)}return b},nb=function(g){return null!=g&&"object"==typeof g},uh=function(g){return nb(g)&&"[object Arguments]"==Rb(g)},vh=Object.prototype,Sl=vh.hasOwnProperty,Tl=vh.propertyIsEnumerable,Ue=uh(function(){return arguments}())?uh:function(g){return nb(g)&&Sl.call(g,
|
81
|
+
"callee")&&!Tl.call(g,"callee")},ya=Array.isArray,Ul=function(){return!1},ld=C(function(g,a){var b=(a=a&&!a.nodeType&&a)&&g&&!g.nodeType&&g;a=b&&b.exports===a?fb.Buffer:void 0;g.exports=(a?a.isBuffer:void 0)||Ul}),Vl=/^(?:0|[1-9]\d*)$/,Kd=function(g,a){var b=typeof g;a=null==a?9007199254740991:a;return!!a&&("number"==b||"symbol"!=b&&Vl.test(g))&&-1<g&&0==g%1&&g<a},Ve=function(g){return"number"==typeof g&&-1<g&&0==g%1&&9007199254740991>=g},Z={};Z["[object Float32Array]"]=Z["[object Float64Array]"]=
|
82
|
+
Z["[object Int8Array]"]=Z["[object Int16Array]"]=Z["[object Int32Array]"]=Z["[object Uint8Array]"]=Z["[object Uint8ClampedArray]"]=Z["[object Uint16Array]"]=Z["[object Uint32Array]"]=!0;Z["[object Arguments]"]=Z["[object Array]"]=Z["[object ArrayBuffer]"]=Z["[object Boolean]"]=Z["[object DataView]"]=Z["[object Date]"]=Z["[object Error]"]=Z["[object Function]"]=Z["[object Map]"]=Z["[object Number]"]=Z["[object Object]"]=Z["[object RegExp]"]=Z["[object Set]"]=Z["[object String]"]=Z["[object WeakMap]"]=
|
83
|
+
!1;var Wl=function(g){return nb(g)&&Ve(g.length)&&!!Z[Rb(g)]},We=function(g){return function(a){return g(a)}},nc=C(function(g,a){var b=a&&!a.nodeType&&a;b=(a=b&&g&&!g.nodeType&&g)&&a.exports===b&&oh.process;a:{try{var c=a&&a.require&&a.require("util").types;if(c){var d=c;break a}d=b&&b.binding&&b.binding("util");break a}catch(e){}d=void 0}g.exports=d}),wh=nc&&nc.isTypedArray,vg=wh?We(wh):Wl,Xl=Object.prototype.hasOwnProperty,xh=function(g,a){var b=ya(g),c=!b&&Ue(g),d=!b&&!c&&ld(g),e=!b&&!c&&!d&&vg(g);
|
84
|
+
if(b=b||c||d||e){c=g.length;for(var f=String,h=-1,m=Array(c);++h<c;)m[h]=f(h);c=m}else c=[];f=c.length;for(var l in g)!a&&!Xl.call(g,l)||b&&("length"==l||d&&("offset"==l||"parent"==l)||e&&("buffer"==l||"byteLength"==l||"byteOffset"==l)||Kd(l,f))||c.push(l);return c},Yl=Object.prototype,Ld=function(g){var a=g&&g.constructor;return g===("function"==typeof a&&a.prototype||Yl)},yh=function(g,a){return function(b){return g(a(b))}},Zl=yh(Object.keys,Object),$l=Object.prototype.hasOwnProperty,Ub=function(g){return null!=
|
85
|
+
g&&Ve(g.length)&&!rh(g)},sa=function(g){if(Ub(g))g=xh(g);else if(Ld(g)){var a=[],b;for(b in Object(g))$l.call(g,b)&&"constructor"!=b&&a.push(b);g=a}else g=Zl(g);return g},Ek=function(g,a){return g&&Pc(a,sa(a),g)},am=Object.prototype.hasOwnProperty,md=function(g){if(Ub(g))g=xh(g,!0);else if(Ra(g)){var a=Ld(g),b=[];for(c in g)("constructor"!=c||!a&&am.call(g,c))&&b.push(c);g=b}else{var c=[];if(null!=g)for(a in Object(g))c.push(a);g=c}return g},Ck=function(g,a){return g&&Pc(a,md(a),g)},zk=C(function(g,
|
86
|
+
a){var b=(a=a&&!a.nodeType&&a)&&g&&!g.nodeType&&g,c=(a=b&&b.exports===a?fb.Buffer:void 0)?a.allocUnsafe:void 0;g.exports=function(a,b){if(b)return a.slice();b=a.length;b=c?c(b):new a.constructor(b);a.copy(b);return b}}),yk=function(g,a){var b=-1,c=g.length;for(a||(a=Array(c));++b<c;)a[b]=g[b];return a},bm=function(g,a){for(var b=-1,c=null==g?0:g.length,d=0,e=[];++b<c;){var f=g[b];a(f,b,g)&&(e[d++]=f)}return e},zh=function(){return[]},cm=Object.prototype.propertyIsEnumerable,Ah=Object.getOwnPropertySymbols,
|
87
|
+
Xe=Ah?function(g){if(null==g)return[];g=Object(g);return bm(Ah(g),function(a){return cm.call(g,a)})}:zh,Dk=function(g,a){return Pc(g,Xe(g),a)},Be=function(g,a){for(var b=-1,c=a.length,d=g.length;++b<c;)g[d+b]=a[b];return g},Bh=yh(Object.getPrototypeOf,Object),Ch=Object.getOwnPropertySymbols?function(g){for(var a=[];g;)Be(a,Xe(g)),g=Bh(g);return a}:zh,Bk=function(g,a){return Pc(g,Ch(g),a)},Dh=function(g,a,b){a=a(g);return ya(g)?a:Be(a,b(g))},ve=function(g){return Dh(g,sa,Xe)},Ik=function(g){return Dh(g,
|
88
|
+
md,Ch)},Ye=Tb(fb,"DataView"),Ze=Tb(fb,"Promise"),$e=Tb(fb,"Set"),af=Tb(fb,"WeakMap"),dm=Sb(Ye),em=Sb(Nc),fm=Sb(Ze),gm=Sb($e),hm=Sb(af),Vb=Rb;if(Ye&&"[object DataView]"!=Vb(new Ye(new ArrayBuffer(1)))||Nc&&"[object Map]"!=Vb(new Nc)||Ze&&"[object Promise]"!=Vb(Ze.resolve())||$e&&"[object Set]"!=Vb(new $e)||af&&"[object WeakMap]"!=Vb(new af))Vb=function(g){var a=Rb(g);if(g=(g="[object Object]"==a?g.constructor:void 0)?Sb(g):"")switch(g){case dm:return"[object DataView]";case em:return"[object Map]";
|
89
|
+
case fm:return"[object Promise]";case gm:return"[object Set]";case hm:return"[object WeakMap]"}return a};var Cc=Vb,im=Object.prototype.hasOwnProperty,xk=function(g){var a=g.length,b=new g.constructor(a);a&&"string"==typeof g[0]&&im.call(g,"index")&&(b.index=g.index,b.input=g.input);return b},Md=fb.Uint8Array,bf=function(g){var a=new g.constructor(g.byteLength);(new Md(a)).set(new Md(g));return a},jm=/\w*$/,Eh=Ua?Ua.prototype:void 0,Fh=Eh?Eh.valueOf:void 0,Fk=function(g,a,b){var c=g.constructor;switch(a){case "[object ArrayBuffer]":return bf(g);
|
90
|
+
case "[object Boolean]":case "[object Date]":return new c(+g);case "[object DataView]":return a=b?bf(g.buffer):g.buffer,new g.constructor(a,g.byteOffset,g.byteLength);case "[object Float32Array]":case "[object Float64Array]":case "[object Int8Array]":case "[object Int16Array]":case "[object Int32Array]":case "[object Uint8Array]":case "[object Uint8ClampedArray]":case "[object Uint16Array]":case "[object Uint32Array]":return a=b?bf(g.buffer):g.buffer,new g.constructor(a,g.byteOffset,g.length);case "[object Map]":return new c;
|
91
|
+
case "[object Number]":case "[object String]":return new c(g);case "[object RegExp]":return a=new g.constructor(g.source,jm.exec(g)),a.lastIndex=g.lastIndex,a;case "[object Set]":return new c;case "[object Symbol]":return Fh?Object(Fh.call(g)):{}}},Gh=Object.create,km=function(){function g(){}return function(a){if(!Ra(a))return{};if(Gh)return Gh(a);g.prototype=a;a=new g;g.prototype=void 0;return a}}(),Ak=function(g){return"function"!=typeof g.constructor||Ld(g)?{}:km(Bh(g))},lm=function(g){return nb(g)&&
|
92
|
+
"[object Map]"==Cc(g)},Hh=nc&&nc.isMap,Hk=Hh?We(Hh):lm,mm=function(g){return nb(g)&&"[object Set]"==Cc(g)},Ih=nc&&nc.isSet,Gk=Ih?We(Ih):mm,U={};U["[object Arguments]"]=U["[object Array]"]=U["[object ArrayBuffer]"]=U["[object DataView]"]=U["[object Boolean]"]=U["[object Date]"]=U["[object Float32Array]"]=U["[object Float64Array]"]=U["[object Int8Array]"]=U["[object Int16Array]"]=U["[object Int32Array]"]=U["[object Map]"]=U["[object Number]"]=U["[object Object]"]=U["[object RegExp]"]=U["[object Set]"]=
|
93
|
+
U["[object String]"]=U["[object Symbol]"]=U["[object Uint8Array]"]=U["[object Uint8ClampedArray]"]=U["[object Uint16Array]"]=U["[object Uint32Array]"]=!0;U["[object Error]"]=U["[object Function]"]=U["[object WeakMap]"]=!1;let nm={Salesforce:!0};var Jh=Object.prototype,Kh=Jh.hasOwnProperty,Ca=Jh.toString;if("function"===typeof Symbol)var om=Symbol.prototype.valueOf;if("function"===typeof BigInt)var pm=BigInt.prototype.valueOf;var qm={"boolean":1,number:1,string:1,undefined:1},rm=/^([A-Za-z0-9+/]{4})*([A-Za-z0-9+/]{4}|[A-Za-z0-9+/]{3}=|[A-Za-z0-9+/]{2}==)$/,
|
94
|
+
sm=/^[A-Fa-f0-9]+$/,w={};w.a=w.type=function(g,a){return typeof g===a};w.defined=function(g){return"undefined"!==typeof g};w.empty=function(g){var a=Ca.call(g),b;if("[object Array]"===a||"[object Arguments]"===a||"[object String]"===a)return 0===g.length;if("[object Object]"===a){for(b in g)if(Kh.call(g,b))return!1;return!0}return!g};w.equal=function(g,a){if(g===a)return!0;var b=Ca.call(g);if(b!==Ca.call(a))return!1;if("[object Object]"===b){for(c in g)if(!(w.equal(g[c],a[c])&&c in a))return!1;for(c in a)if(!(w.equal(g[c],
|
95
|
+
a[c])&&c in g))return!1;return!0}if("[object Array]"===b){var c=g.length;if(c!==a.length)return!1;for(;c--;)if(!w.equal(g[c],a[c]))return!1;return!0}return"[object Function]"===b?g.prototype===a.prototype:"[object Date]"===b?g.getTime()===a.getTime():!1};w.hosted=function(g,a){var b=typeof a[g];return"object"===b?!!a[g]:!qm[b]};w.instance=w["instanceof"]=function(g,a){return g instanceof a};w.nil=w["null"]=function(g){return null===g};w.undef=w.undefined=function(g){return"undefined"===typeof g};
|
96
|
+
w.args=w.arguments=function(g){var a="[object Arguments]"===Ca.call(g);g=!w.array(g)&&w.arraylike(g)&&w.object(g)&&w.fn(g.callee);return a||g};w.array=Array.isArray||function(g){return"[object Array]"===Ca.call(g)};w.args.empty=function(g){return w.args(g)&&0===g.length};w.array.empty=function(g){return w.array(g)&&0===g.length};w.arraylike=function(g){return!!g&&!w.bool(g)&&Kh.call(g,"length")&&isFinite(g.length)&&w.number(g.length)&&0<=g.length};w.bool=w["boolean"]=function(g){return"[object Boolean]"===
|
97
|
+
Ca.call(g)};w["false"]=function(g){return w.bool(g)&&!1===!!Number(g)};w["true"]=function(g){return w.bool(g)&&!0===!!Number(g)};w.date=function(g){return"[object Date]"===Ca.call(g)};w.date.valid=function(g){return w.date(g)&&!isNaN(Number(g))};w.element=function(g){return void 0!==g&&"undefined"!==typeof HTMLElement&&g instanceof HTMLElement&&1===g.nodeType};w.error=function(g){return"[object Error]"===Ca.call(g)};w.fn=w["function"]=function(g){if("undefined"!==typeof window&&g===window.alert)return!0;
|
98
|
+
g=Ca.call(g);return"[object Function]"===g||"[object GeneratorFunction]"===g||"[object AsyncFunction]"===g};w.number=function(g){return"[object Number]"===Ca.call(g)};w.infinite=function(g){return Infinity===g||-Infinity===g};w.decimal=function(g){return w.number(g)&&g===g&&!w.infinite(g)&&0!==g%1};w.divisibleBy=function(g,a){var b=w.infinite(g),c=w.infinite(a),d=w.number(g)&&g===g&&w.number(a)&&a===a&&0!==a;return b||c||d&&0===g%a};w.integer=w["int"]=function(g){return w.number(g)&&g===g&&0===g%
|
99
|
+
1};w.maximum=function(g,a){if(g!==g)throw new TypeError("NaN is not a valid value");if(!w.arraylike(a))throw new TypeError("second argument must be array-like");for(var b=a.length;0<=--b;)if(g<a[b])return!1;return!0};w.minimum=function(g,a){if(g!==g)throw new TypeError("NaN is not a valid value");if(!w.arraylike(a))throw new TypeError("second argument must be array-like");for(var b=a.length;0<=--b;)if(g>a[b])return!1;return!0};w.nan=function(g){return!w.number(g)||g!==g};w.even=function(g){return w.infinite(g)||
|
100
|
+
w.number(g)&&g===g&&0===g%2};w.odd=function(g){return w.infinite(g)||w.number(g)&&g===g&&0!==g%2};w.ge=function(g,a){if(g!==g||a!==a)throw new TypeError("NaN is not a valid value");return!w.infinite(g)&&!w.infinite(a)&&g>=a};w.gt=function(g,a){if(g!==g||a!==a)throw new TypeError("NaN is not a valid value");return!w.infinite(g)&&!w.infinite(a)&&g>a};w.le=function(g,a){if(g!==g||a!==a)throw new TypeError("NaN is not a valid value");return!w.infinite(g)&&!w.infinite(a)&&g<=a};w.lt=function(g,a){if(g!==
|
101
|
+
g||a!==a)throw new TypeError("NaN is not a valid value");return!w.infinite(g)&&!w.infinite(a)&&g<a};w.within=function(g,a,b){if(g!==g||a!==a||b!==b)throw new TypeError("NaN is not a valid value");if(!w.number(g)||!w.number(a)||!w.number(b))throw new TypeError("all arguments must be numbers");return w.infinite(g)||w.infinite(a)||w.infinite(b)||g>=a&&g<=b};w.object=function(g){return"[object Object]"===Ca.call(g)};w.primitive=function(g){return g?"object"===typeof g||w.object(g)||w.fn(g)||w.array(g)?
|
102
|
+
!1:!0:!0};w.hash=function(g){return w.object(g)&&g.constructor===Object&&!g.nodeType&&!g.setInterval};w.regexp=function(g){return"[object RegExp]"===Ca.call(g)};w.string=function(g){return"[object String]"===Ca.call(g)};w.base64=function(g){return w.string(g)&&(!g.length||rm.test(g))};w.hex=function(g){return w.string(g)&&(!g.length||sm.test(g))};w.symbol=function(g){return"function"===typeof Symbol&&"[object Symbol]"===Ca.call(g)&&"symbol"===typeof om.call(g)};w.bigint=function(g){return"function"===
|
103
|
+
typeof BigInt&&"[object BigInt]"===Ca.call(g)&&"bigint"===typeof pm.call(g)};var Lh=/^(\d{4})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:([ T])(\d{2}):?(\d{2})(?::?(\d{2})(?:[,\.](\d{1,}))?)?(?:(Z)|([+\-])(\d{2})(?::?(\d{2}))?)?)?$/,Mh={parse:function(g){var a=[1,5,6,7,11,12],b=Lh.exec(g),c=0;if(!b)return new Date(g);g=0;for(var d;d=a[g];g++)b[d]=parseInt(b[d],10)||0;b[2]=parseInt(b[2],10)||1;b[3]=parseInt(b[3],10)||1;b[2]--;b[8]=b[8]?(b[8]+"00").substring(0,3):0;" "===b[4]?c=(new Date).getTimezoneOffset():"Z"!==
|
104
|
+
b[9]&&b[10]&&(c=60*b[11]+b[12],"+"===b[10]&&(c=0-c));a=Date.UTC(b[1],b[2],b[3],b[5],b[6]+c,b[7],b[8]);return new Date(a)},is:function(g,a){return a&&!1===/^\d{4}-\d{2}-\d{2}/.test(g)?!1:Lh.test(g)}},tm=/\d{13}/,Nh={is:function(g){return tm.test(g)},parse:function(g){g=parseInt(g,10);return new Date(g)}},um=/\d{10}/,Oh={is:function(g){return um.test(g)},parse:function(g){g=1E3*parseInt(g,10);return new Date(g)}},pd=function(g){if(w.date(g))return g;if(w.number(g)){var a=Date;return new a(315576E5>
|
105
|
+
g?1E3*g:g)}return Mh.is(g)?Mh.parse(g):Nh.is(g)?Nh.parse(g):Oh.is(g)?Oh.parse(g):new Date(g)},vm=Object.prototype.toString,ka=function(g){switch(vm.call(g)){case "[object Date]":return"date";case "[object RegExp]":return"regexp";case "[object Arguments]":return"arguments";case "[object Array]":return"array";case "[object Error]":return"error"}if(null===g)return"null";if(void 0===g)return"undefined";if(g!==g)return"nan";if(g&&1===g.nodeType)return"element";if(null!=g&&(g._isBuffer||g.constructor&&
|
106
|
+
"function"===typeof g.constructor.isBuffer&&g.constructor.isBuffer(g)))return"buffer";g=g.valueOf?g.valueOf():Object.prototype.valueOf.apply(g);return typeof g},wm=Object.prototype.toString,xm=/\b(Array|Date|Object|Math|JSON)\b/g,Ph=function(g,a){for(var b=g.replace(/\.\w+|\w+ *\(|"[^"]*"|'[^']*'|\/([^/]+)\//g,"").replace(xm,"").match(/[a-zA-Z_]\w*/g)||[],c=[],d=0;d<b.length;d++)~c.indexOf(b[d])||c.push(b[d]);a&&"string"==typeof a&&(a=Kk(a));return a?Jk(g,c,a):c};try{var og=Ph}catch(g){og=Ph}var ym=
|
107
|
+
function(g){switch(wm.call(g)){case "[object Function]":return"function";case "[object Date]":return"date";case "[object RegExp]":return"regexp";case "[object Arguments]":return"arguments";case "[object Array]":return"array";case "[object String]":return"string"}return null===g?"null":void 0===g?"undefined":g&&1===g.nodeType?"element":g===Object(g)?"object":typeof g},zm=Object.prototype.hasOwnProperty,xe=function(g,a,b){a=ng(a);b=b||this;switch(ym(g)){case "array":var c=a;for(a=0;a<g.length;++a)c.call(b,
|
108
|
+
g[a],a);break;case "object":if("number"==typeof g.length){c=a;for(a=0;a<g.length;++a)c.call(b,g[a],a);break}for(c in g)zm.call(g,c)&&a.call(b,c,g[c]);break;case "string":for(c=a,a=0;a<g.length;++a)c.call(b,g.charAt(a),a)}},Qh=/^(\d{4})(?:-?(\d{2})(?:-?(\d{2}))?)?(?:([ T])(\d{2}):?(\d{2})(?::?(\d{2})(?:[,\.](\d{1,}))?)?(?:(Z)|([+\-])(\d{2})(?::?(\d{2}))?)?)?$/,od={parse:function(g){var a=[1,5,6,7,11,12],b=Qh.exec(g),c=0;if(!b)return new Date(g);g=0;for(var d;d=a[g];g++)b[d]=parseInt(b[d],10)||0;b[2]=
|
109
|
+
parseInt(b[2],10)||1;b[3]=parseInt(b[3],10)||1;b[2]--;b[8]=b[8]?(b[8]+"00").substring(0,3):0;" "===b[4]?c=(new Date).getTimezoneOffset():"Z"!==b[9]&&b[10]&&(c=60*b[11]+b[12],"+"===b[10]&&(c=0-c));a=Date.UTC(b[1],b[2],b[3],b[5],b[6]+c,b[7],b[8]);return new Date(a)},is:function(g,a){return"string"!==typeof g||a&&!1===/^\d{4}-\d{2}-\d{2}/.test(g)?!1:Qh.test(g)}},qg=we;let ba=B.prototype;ba.proxy=function(g){let a=g.split(".");g=a.shift();g=this[g]||this.field(g);if(!g)return g;"function"===typeof g&&
|
110
|
+
(g=g.call(this)||{});if(0===a.length)return this.opts.clone?oa(g,5):g;g=ia(g,a.join("."));return this.opts.clone?oa(g,5):g};ba.field=function(g){g=this.obj[g];return this.opts.clone?oa(g,5):g};B.proxy=function(g){return function(){return this.proxy(g)}};B.field=function(g){return function(){return this.field(g)}};B.multi=function(g){return function(){var a=this.proxy(g+"s");if(Array.isArray(a))return a;(a=this.proxy(g))&&(a=[this.opts.clone?oa(a,5):a]);return a||[]}};B.one=function(g){return function(){var a=
|
111
|
+
this.proxy(g);if(a)return a;a=this.proxy(g+"s");if(Array.isArray(a))return a[0]}};ba.json=function(){let g=this.opts.clone?oa(this.obj,5):this.obj;this.type&&(g.type=this.type());return g};ba.options=function(g){var a=this.obj.options||this.obj.context||{};a=this.opts.clone?oa(a,5):a;if(!g)return a;if(this.enabled(g))return a=this.integrations(),a=a[g]||ia(a,g),"object"!==typeof a&&(a=ia(this.options(),g)),"object"===typeof a?a:{}};ba.context=ba.options;ba.enabled=function(g){var a=this.proxy("options.providers.all");
|
112
|
+
"boolean"!==typeof a&&(a=this.proxy("options.all"));"boolean"!==typeof a&&(a=this.proxy("integrations.all"));"boolean"!==typeof a&&(a=!0);a=a&&!nm[g];let b=this.integrations();b.providers&&b.providers.hasOwnProperty(g)&&(a=b.providers[g]);b.hasOwnProperty(g)&&(g=b[g],a="boolean"===typeof g?g:!0);return!!a};ba.integrations=function(){return this.obj.integrations||this.proxy("options.providers")||this.options()};ba.active=function(){let g=this.proxy("options.active");if(null===g||void 0===g)g=!0;return g};
|
113
|
+
ba.anonymousId=function(){return this.field("anonymousId")||this.field("sessionId")};ba.sessionId=ba.anonymousId;ba.groupId=B.proxy("options.groupId");ba.traits=function(g){let a=this.proxy("options.traits")||{};var b=this.userId();g=g||{};b&&(a.id=b);for(let c in g)b=null==this[c]?this.proxy("options.traits."+c):this[c](),null!=b&&(a[g[c]]=b,delete a[c]);return a};ba.library=function(){let g=this.proxy("options.library");return g?"string"===typeof g?{name:g,version:null}:g:{name:"unknown",version:null}};
|
114
|
+
ba.device=function(){let g=this.proxy("context.device");"object"!==typeof g&&(g={});let a=this.library().name;if(g.type)return g;-1<a.indexOf("ios")&&(g.type="ios");-1<a.indexOf("android")&&(g.type="android");return g};ba.userAgent=B.proxy("context.userAgent");ba.timezone=B.proxy("context.timezone");ba.timestamp=B.field("timestamp");ba.channel=B.field("channel");ba.ip=B.proxy("context.ip");ba.userId=B.field("userId");(function(g){g.zip=$b("postalCode","zip");g.country=$b("country");g.street=$b("street");
|
115
|
+
g.state=$b("state");g.city=$b("city");g.region=$b("region")})(ba);var rb=C(function(g){g.exports="function"===typeof Object.create?function(a,b){b&&(a.super_=b,a.prototype=Object.create(b.prototype,{constructor:{value:a,enumerable:!1,writable:!0,configurable:!0}}))}:function(a,b){if(b){a.super_=b;var c=function(){};c.prototype=b.prototype;a.prototype=new c;a.prototype.constructor=a}}});rb(Sa,B);Sa.prototype.action=function(){return"alias"};Sa.prototype.type=Sa.prototype.action;Sa.prototype.previousId=
|
116
|
+
function(){return this.field("previousId")||this.field("from")};Sa.prototype.from=Sa.prototype.previousId;Sa.prototype.userId=function(){return this.field("userId")||this.field("to")};Sa.prototype.to=Sa.prototype.userId;let Nd=/.+@.+\..+/;rb(qd,B);let Za=qd.prototype;Za.action=function(){return"group"};Za.type=Za.action;Za.groupId=B.field("groupId");Za.created=function(){var g=this.proxy("traits.createdAt")||this.proxy("traits.created")||this.proxy("properties.createdAt")||this.proxy("properties.created");
|
117
|
+
if(g)return pd(g)};Za.email=function(){var g=this.proxy("traits.email");if(g)return g;g=this.groupId();if(Nd.test(g))return g};Za.traits=function(g){var a=this.properties(),b=this.groupId();g=g||{};b&&(a.id=b);for(var c in g)b=null==this[c]?this.proxy("traits."+c):this[c](),null!=b&&(a[g[c]]=b,delete a[c]);return a};Za.name=B.proxy("traits.name");Za.industry=B.proxy("traits.industry");Za.employees=B.proxy("traits.employees");Za.properties=function(){return this.field("traits")||this.field("properties")||
|
118
|
+
{}};rb(Ec,B);let aa=Ec.prototype;aa.action=function(){return"identify"};aa.type=aa.action;aa.traits=function(g){let a=this.field("traits")||{};var b=this.userId();g=g||{};b&&(a.id=b);for(let c in g)b=null==this[c]?this.proxy("traits."+c):this[c](),null!=b&&(a[g[c]]=b,c!==g[c]&&delete a[c]);return a};aa.email=function(){var g=this.proxy("traits.email");if(g)return g;g=this.userId();if(Nd.test(g))return g};aa.created=function(){let g=this.proxy("traits.created")||this.proxy("traits.createdAt");if(g)return pd(g)};
|
119
|
+
aa.companyCreated=function(){let g=this.proxy("traits.company.created")||this.proxy("traits.company.createdAt");if(g)return pd(g)};aa.companyName=function(){return this.proxy("traits.company.name")};aa.name=function(){var g=this.proxy("traits.name");if("string"===typeof g)return g.trim();g=this.firstName();let a=this.lastName();if(g&&a)return(g+" "+a).trim()};aa.firstName=function(){var g=this.proxy("traits.firstName");if("string"===typeof g)return g.trim();g=this.proxy("traits.name");if("string"===
|
120
|
+
typeof g)return g.trim().split(" ")[0]};aa.lastName=function(){var g=this.proxy("traits.lastName");if("string"===typeof g)return g.trim();g=this.proxy("traits.name");if("string"===typeof g){var a=g.trim().indexOf(" ");if(-1!==a)return g.substr(a+1).trim()}};aa.uid=function(){return this.userId()||this.username()||this.email()};aa.description=function(){return this.proxy("traits.description")||this.proxy("traits.background")};aa.age=function(){let g=this.birthday(),a=ia(this.traits(),"age");if(null!=
|
121
|
+
a)return a;if(g instanceof Date)return(new Date).getFullYear()-g.getFullYear()};aa.avatar=function(){let g=this.traits();return ia(g,"avatar")||ia(g,"photoUrl")||ia(g,"avatarUrl")};aa.position=function(){let g=this.traits();return ia(g,"position")||ia(g,"jobTitle")};aa.username=B.proxy("traits.username");aa.website=B.one("traits.website");aa.websites=B.multi("traits.website");aa.phone=B.one("traits.phone");aa.phones=B.multi("traits.phone");aa.address=B.proxy("traits.address");aa.gender=B.proxy("traits.gender");
|
122
|
+
aa.birthday=B.proxy("traits.birthday");rb(dc,B);let K=dc.prototype;K.action=function(){return"track"};K.type=K.action;K.event=B.field("event");K.value=B.proxy("properties.value");K.category=B.proxy("properties.category");K.id=B.proxy("properties.id");K.productId=function(){return this.proxy("properties.product_id")||this.proxy("properties.productId")};K.promotionId=function(){return this.proxy("properties.promotion_id")||this.proxy("properties.promotionId")};K.cartId=function(){return this.proxy("properties.cart_id")||
|
123
|
+
this.proxy("properties.cartId")};K.checkoutId=function(){return this.proxy("properties.checkout_id")||this.proxy("properties.checkoutId")};K.paymentId=function(){return this.proxy("properties.payment_id")||this.proxy("properties.paymentId")};K.couponId=function(){return this.proxy("properties.coupon_id")||this.proxy("properties.couponId")};K.wishlistId=function(){return this.proxy("properties.wishlist_id")||this.proxy("properties.wishlistId")};K.reviewId=function(){return this.proxy("properties.review_id")||
|
124
|
+
this.proxy("properties.reviewId")};K.orderId=function(){return this.proxy("properties.id")||this.proxy("properties.order_id")||this.proxy("properties.orderId")};K.sku=B.proxy("properties.sku");K.tax=B.proxy("properties.tax");K.name=B.proxy("properties.name");K.price=B.proxy("properties.price");K.total=B.proxy("properties.total");K.repeat=B.proxy("properties.repeat");K.coupon=B.proxy("properties.coupon");K.shipping=B.proxy("properties.shipping");K.discount=B.proxy("properties.discount");K.shippingMethod=
|
125
|
+
function(){return this.proxy("properties.shipping_method")||this.proxy("properties.shippingMethod")};K.paymentMethod=function(){return this.proxy("properties.payment_method")||this.proxy("properties.paymentMethod")};K.description=B.proxy("properties.description");K.plan=B.proxy("properties.plan");K.subtotal=function(){var g=ia(this.properties(),"subtotal");let a=this.total()||this.revenue();if(g)return g;if(!a)return 0;this.total()&&((g=this.tax())&&(a-=g),(g=this.shipping())&&(a-=g),(g=this.discount())&&
|
126
|
+
(a+=g));return a};K.products=function(){var g=this.properties();g=ia(g,"products");return Array.isArray(g)?g:[]};K.quantity=function(){return(this.obj.properties||{}).quantity||1};K.currency=function(){return(this.obj.properties||{}).currency||"USD"};K.referrer=function(){return this.proxy("context.referrer.url")||this.proxy("context.page.referrer")||this.proxy("properties.referrer")};K.query=B.proxy("options.query");K.properties=function(g){let a=this.field("properties")||{};g=g||{};for(let b in g){let c=
|
127
|
+
null==this[b]?this.proxy("properties."+b):this[b]();null!=c&&(a[g[b]]=c,delete a[b])}return a};K.username=function(){return this.proxy("traits.username")||this.proxy("properties.username")||this.userId()||this.sessionId()};K.email=function(){var g=this.proxy("traits.email")||this.proxy("properties.email")||this.proxy("options.traits.email");if(g)return g;g=this.userId();if(Nd.test(g))return g};K.revenue=function(){var g=this.proxy("properties.revenue");let a=this.event(),b=/^[ _]?completed[ _]?order[ _]?|^[ _]?order[ _]?completed[ _]?$/i;
|
128
|
+
!g&&a&&a.match(b)&&(g=this.proxy("properties.total"));a:{if(g){if("number"===typeof g)break a;if("string"===typeof g&&(g=g.replace(/\$/g,""),g=parseFloat(g),!isNaN(g)))break a}g=void 0}return g};K.cents=function(){let g=this.revenue();return"number"!==typeof g?this.value()||0:100*g};K.identify=function(){let g=this.json();g.traits=this.traits();return new Ec(g,this.opts)};rb(Fc,B);let Ja=Fc.prototype;Ja.action=function(){return"page"};Ja.type=Ja.action;Ja.category=B.field("category");Ja.name=B.field("name");
|
129
|
+
Ja.title=B.proxy("properties.title");Ja.path=B.proxy("properties.path");Ja.url=B.proxy("properties.url");Ja.referrer=function(){return this.proxy("context.referrer.url")||this.proxy("context.page.referrer")||this.proxy("properties.referrer")};Ja.properties=function(g){let a=this.field("properties")||{};var b=this.category();let c=this.name();g=g||{};b&&(a.category=b);c&&(a.name=c);for(let c in g)b=null==this[c]?this.proxy("properties."+c):this[c](),null!=b&&(a[g[c]]=b,c!==g[c]&&delete a[c]);return a};
|
130
|
+
Ja.email=function(){var g=this.proxy("context.traits.email")||this.proxy("properties.email");if(g)return g;g=this.userId();if(Nd.test(g))return g};Ja.fullName=function(){let g=this.category(),a=this.name();return a&&g?g+" "+a:a};Ja.event=function(g){return g?"Viewed "+g+" Page":"Loaded a Page"};Ja.track=function(g){let a=this.json();a.event=this.event(g);a.timestamp=this.timestamp();a.properties=this.properties();return new dc(a,this.opts)};rb(xb,Fc);xb.prototype.action=function(){return"screen"};
|
131
|
+
xb.prototype.type=xb.prototype.action;xb.prototype.event=function(g){return g?"Viewed "+g+" Screen":"Loaded a Screen"};xb.prototype.track=function(g){let a=this.json();a.event=this.event(g);a.timestamp=this.timestamp();a.properties=this.properties();return new dc(a,this.opts)};rb(rd,B);rd.prototype.type=function(){return"delete"};var Am=Object.freeze({__proto__:null,"default":{...B,Alias:Sa,Group:qd,Identify:Ec,Track:dc,Page:Fc,Screen:xb,Delete:rd},Facade:B,Alias:Sa,Group:qd,Identify:Ec,Track:dc,
|
132
|
+
Page:Fc,Screen:xb,Delete:rd}),Od=C(function(g){function a(b){if(b){for(var c in a.prototype)b[c]=a.prototype[c];return b}}g.exports=a;a.prototype.on=a.prototype.addEventListener=function(a,c){this._callbacks=this._callbacks||{};(this._callbacks["$"+a]=this._callbacks["$"+a]||[]).push(c);return this};a.prototype.once=function(a,c){function b(){this.off(a,b);c.apply(this,arguments)}b.fn=c;this.on(a,b);return this};a.prototype.off=a.prototype.removeListener=a.prototype.removeAllListeners=a.prototype.removeEventListener=
|
133
|
+
function(a,c){this._callbacks=this._callbacks||{};if(0==arguments.length)return this._callbacks={},this;var b=this._callbacks["$"+a];if(!b)return this;if(1==arguments.length)return delete this._callbacks["$"+a],this;for(var e,f=0;f<b.length;f++)if(e=b[f],e===c||e.fn===c){b.splice(f,1);break}0===b.length&&delete this._callbacks["$"+a];return this};a.prototype.emit=function(a){this._callbacks=this._callbacks||{};for(var b=Array(arguments.length-1),d=this._callbacks["$"+a],e=1;e<arguments.length;e++)b[e-
|
134
|
+
1]=arguments[e];if(d){d=d.slice(0);e=0;for(var f=d.length;e<f;++e)d[e].apply(this,b)}return this};a.prototype.listeners=function(a){this._callbacks=this._callbacks||{};return this._callbacks["$"+a]||[]};a.prototype.hasListeners=function(a){return!!this.listeners(a).length}}),Bm=Object.prototype.toString,Cm=function(g){var a=typeof g;return"number"===a||"object"===a&&"[object Number]"===Bm.call(g)},cf=[function(g){return function(){return g.apply(this,arguments)}},function(g){return function(a){return g.apply(this,
|
135
|
+
arguments)}},function(g){return function(a,b){return g.apply(this,arguments)}},function(g){return function(a,b,c){return g.apply(this,arguments)}},function(g){return function(a,b,c,d){return g.apply(this,arguments)}},function(g){return function(a,b,c,d,e){return g.apply(this,arguments)}}],Dm=function(g,a){if("function"!==typeof a)throw new TypeError("Expected a function but got "+typeof a);g=Math.max(Cm(g)?g:0,0);if(!cf[g]){var b=g;var c=g;for(var d=[],e=1;e<=c;e+=1)d.push("arg"+e);c=d.join(", ");
|
136
|
+
c="".concat(" return function(",c,") {\n"," return func.apply(this, arguments);\n"," };");c=new Function("func",c);cf[b]=c}return cf[g](a)},Em=Object.prototype.toString,Fm=function(g){var a=typeof g;return"number"===a||"object"===a&&"[object Number]"===Em.call(g)},Rh=function(g,a){if(!Fm(g))throw new TypeError("Expected a number but received "+typeof g);if("function"!==typeof a)throw new TypeError("Expected a function but received "+typeof a);var b=0;return Dm(a.length,function(){b+=1;if(!(b<
|
137
|
+
g))return a.apply(this,arguments)})},Sh=[].slice,df=function(g,a){"string"==typeof a&&(a=g[a]);if("function"!=typeof a)throw Error("bind() requires a function");var b=Sh.call(arguments,2);return function(){return a.apply(g,b.concat(Sh.call(arguments)))}},Mb=function(g){for(var a in g)"function"===typeof g[a]&&(g[a]=df(g,g[a]));return g},Pd=Object.prototype.hasOwnProperty,Th=Object.prototype.toString,Uh=Object.defineProperty,Vh=Object.getOwnPropertyDescriptor,Wh=function(g){return"function"===typeof Array.isArray?
|
138
|
+
Array.isArray(g):"[object Array]"===Th.call(g)},Xh=function(g){if(!g||"[object Object]"!==Th.call(g))return!1;var a=Pd.call(g,"constructor"),b=g.constructor&&g.constructor.prototype&&Pd.call(g.constructor.prototype,"isPrototypeOf");if(g.constructor&&!a&&!b)return!1;for(var c in g);return"undefined"===typeof c||Pd.call(g,c)},Yh=function(g,a){Uh&&"__proto__"===a.name?Uh(g,a.name,{enumerable:!0,configurable:!0,value:a.newValue,writable:!0}):g[a.name]=a.newValue},Zh=function(g,a){if("__proto__"===a){if(!Pd.call(g,
|
139
|
+
a))return;if(Vh)return Vh(g,a).value}return g[a]},Qc=function a(){var b,c,d=arguments[0],e=1,f=arguments.length,h=!1;"boolean"===typeof d&&(h=d,d=arguments[1]||{},e=2);if(null==d||"object"!==typeof d&&"function"!==typeof d)d={};for(;e<f;++e){var m=arguments[e];if(null!=m)for(b in m){var l=Zh(d,b);var n=Zh(m,b);d!==n&&(h&&n&&(Xh(n)||(c=Wh(n)))?(c?(c=!1,l=l&&Wh(l)?l:[]):l=l&&Xh(l)?l:{},Yh(d,{name:b,newValue:a(h,l,n)})):"undefined"!==typeof n&&Yh(d,{name:b,newValue:n}))}}return d},Gm=function(a,b){b=
|
140
|
+
b||{};var c=typeof a;if("string"===c&&0<a.length)return Qk(a);if("number"===c&&isFinite(a))return b.long?(b=Math.abs(a),a=864E5<=b?sd(a,b,864E5,"day"):36E5<=b?sd(a,b,36E5,"hour"):6E4<=b?sd(a,b,6E4,"minute"):1E3<=b?sd(a,b,1E3,"second"):a+" ms"):(b=Math.abs(a),a=864E5<=b?Math.round(a/864E5)+"d":36E5<=b?Math.round(a/36E5)+"h":6E4<=b?Math.round(a/6E4)+"m":1E3<=b?Math.round(a/1E3)+"s":a+"ms"),a;throw Error("val is not a non-empty string or a valid number. val="+JSON.stringify(a));},Hm=function(a){function b(a){function d(...a){if(d.enabled){var c=
|
141
|
+
Number(new Date);d.diff=c-(e||c);d.prev=e;e=d.curr=c;a[0]=b.coerce(a[0]);"string"!==typeof a[0]&&a.unshift("%O");var f=0;a[0]=a[0].replace(/%([a-zA-Z%])/g,(c,e)=>{if("%%"===c)return"%";f++;e=b.formatters[e];"function"===typeof e&&(c=e.call(d,a[f]),a.splice(f,1),f--);return c});b.formatArgs.call(d,a);(d.log||b.log).apply(d,a)}}let e,m=null;d.namespace=a;d.useColors=b.useColors();d.color=b.selectColor(a);d.extend=c;d.destroy=b.destroy;Object.defineProperty(d,"enabled",{enumerable:!0,configurable:!1,
|
142
|
+
get:()=>null===m?b.enabled(a):m,set:a=>{m=a}});"function"===typeof b.init&&b.init(d);return d}function c(a,c){a=b(this.namespace+("undefined"===typeof c?":":c)+a);a.log=this.log;return a}function d(a){return a.toString().substring(2,a.toString().length-2).replace(/\.\*\?$/,"*")}b.debug=b;b.default=b;b.coerce=function(a){return a instanceof Error?a.stack||a.message:a};b.disable=function(){let a=[...b.names.map(d),...b.skips.map(d).map(a=>"-"+a)].join();b.enable("");return a};b.enable=function(a){b.save(a);
|
143
|
+
b.names=[];b.skips=[];let c,d=("string"===typeof a?a:"").split(/[\s,]+/),e=d.length;for(c=0;c<e;c++)d[c]&&(a=d[c].replace(/\*/g,".*?"),"-"===a[0]?b.skips.push(new RegExp("^"+a.substr(1)+"$")):b.names.push(new RegExp("^"+a+"$")))};b.enabled=function(a){if("*"===a[a.length-1])return!0;let c,d;c=0;for(d=b.skips.length;c<d;c++)if(b.skips[c].test(a))return!1;c=0;for(d=b.names.length;c<d;c++)if(b.names[c].test(a))return!0;return!1};b.humanize=Gm;b.destroy=function(){console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`.")};
|
144
|
+
Object.keys(a).forEach(c=>{b[c]=a[c]});b.names=[];b.skips=[];b.formatters={};b.selectColor=function(a){let c=0;for(let b=0;b<a.length;b++)c=(c<<5)-c+a.charCodeAt(b),c|=0;return b.colors[Math.abs(c)%b.colors.length]};b.enable(b.load());return b},Na=C(function(a,b){b.formatArgs=function(b){b[0]=(this.useColors?"%c":"")+this.namespace+(this.useColors?" %c":" ")+b[0]+(this.useColors?"%c ":" ")+"+"+a.exports.humanize(this.diff);if(this.useColors){var c="color: "+this.color;b.splice(1,0,c,"color: inherit");
|
145
|
+
var d=0,h=0;b[0].replace(/%[a-zA-Z%]/g,a=>{"%%"!==a&&(d++,"%c"===a&&(h=d))});b.splice(h,0,c)}};b.save=function(a){try{a?b.storage.setItem("debug",a):b.storage.removeItem("debug")}catch(e){}};b.load=function(){let a;try{a=b.storage.getItem("debug")}catch(e){}!a&&"undefined"!==typeof process&&"env"in process&&(a=process.env.DEBUG);return a};b.useColors=function(){return"undefined"!==typeof window&&window.process&&("renderer"===window.process.type||window.process.__nwjs)?!0:"undefined"!==typeof navigator&&
|
146
|
+
navigator.userAgent&&navigator.userAgent.toLowerCase().match(/(edge|trident)\/(\d+)/)?!1:"undefined"!==typeof document&&document.documentElement&&document.documentElement.style&&document.documentElement.style.WebkitAppearance||"undefined"!==typeof window&&window.console&&(window.console.firebug||window.console.exception&&window.console.table)||"undefined"!==typeof navigator&&navigator.userAgent&&navigator.userAgent.toLowerCase().match(/firefox\/(\d+)/)&&31<=parseInt(RegExp.$1,10)||"undefined"!==typeof navigator&&
|
147
|
+
navigator.userAgent&&navigator.userAgent.toLowerCase().match(/applewebkit\/(\d+)/)};a:{try{var c=localStorage;break a}catch(d){}c=void 0}b.storage=c;b.destroy=(()=>{let a=!1;return()=>{a||(a=!0,console.warn("Instance method `debug.destroy()` is deprecated and no longer does anything. It will be removed in the next major version of `debug`."))}})();b.colors="#0000CC #0000FF #0033CC #0033FF #0066CC #0066FF #0099CC #0099FF #00CC00 #00CC33 #00CC66 #00CC99 #00CCCC #00CCFF #3300CC #3300FF #3333CC #3333FF #3366CC #3366FF #3399CC #3399FF #33CC00 #33CC33 #33CC66 #33CC99 #33CCCC #33CCFF #6600CC #6600FF #6633CC #6633FF #66CC00 #66CC33 #9900CC #9900FF #9933CC #9933FF #99CC00 #99CC33 #CC0000 #CC0033 #CC0066 #CC0099 #CC00CC #CC00FF #CC3300 #CC3333 #CC3366 #CC3399 #CC33CC #CC33FF #CC6600 #CC6633 #CC9900 #CC9933 #CCCC00 #CCCC33 #FF0000 #FF0033 #FF0066 #FF0099 #FF00CC #FF00FF #FF3300 #FF3333 #FF3366 #FF3399 #FF33CC #FF33FF #FF6600 #FF6633 #FF9900 #FF9933 #FFCC00 #FFCC33".split(" ");
|
148
|
+
b.log=console.debug||console.log||(()=>{});a.exports=Hm(b);({formatters:c}=a.exports);c.j=function(a){try{return JSON.stringify(a)}catch(e){return"[UnexpectedJSONParseError]: "+e.message}}}),ug=Na("cookie"),Wb=function(a,b,c){switch(arguments.length){case 3:case 2:var d=c||{};var e=tg(a)+"="+tg(b);null==b&&(d.maxage=-1);d.maxage&&(d.expires=new Date(+new Date+d.maxage));d.path&&(e+="; path="+d.path);d.domain&&(e+="; domain="+d.domain);d.expires&&(e+="; expires="+d.expires.toUTCString());d.secure&&
|
149
|
+
(e+="; secure");document.cookie=e;break;case 1:return rg()[a];default:return rg()}},Qd=function(a){return a},Im=function(a,b,c){switch(c.length){case 0:return a.call(b);case 1:return a.call(b,c[0]);case 2:return a.call(b,c[0],c[1]);case 3:return a.call(b,c[0],c[1],c[2])}return a.apply(b,c)},$h=Math.max,ai=function(a,b,c){b=$h(void 0===b?a.length-1:b,0);return function(){for(var d=arguments,e=-1,f=$h(d.length-b,0),h=Array(f);++e<f;)h[e]=d[b+e];e=-1;for(f=Array(b+1);++e<b;)f[e]=d[e];f[b]=c(h);return Im(a,
|
150
|
+
this,f)}},Jm=function(a){return function(){return a}},Km=Date.now,bi=function(a){var b=0,c=0;return function(){var d=Km(),e=16-(d-c);c=d;if(0<e){if(800<=++b)return arguments[0]}else b=0;return a.apply(void 0,arguments)}}(Jd?function(a,b){return Jd(a,"toString",{configurable:!0,enumerable:!1,value:Jm(b),writable:!0})}:Qd),ci=function(a,b){return bi(ai(a,b,Qd),a+"")},di=function(a,b,c){if(!Ra(c))return!1;var d=typeof b;return("number"==d?Ub(c)&&Kd(b,c.length):"string"==d&&b in c)?Lc(c[b],a):!1},ei=
|
151
|
+
Object.prototype,Lm=ei.hasOwnProperty,Ka=ci(function(a,b){a=Object(a);var c=-1,d=b.length,e=2<d?b[2]:void 0;for(e&&di(b[0],b[1],e)&&(d=1);++c<d;){e=b[c];for(var f=md(e),h=-1,m=f.length;++h<m;){var l=f[h],n=a[l];if(void 0===n||Lc(n,ei[l])&&!Lm.call(a,l))a[l]=e[l]}}return a}),fi=C(function(a,b){b.parse=function(a){var b=document.createElement("a");b.href=a;a=b.href;var c=b.host||location.host;if("0"===b.port||""===b.port)a:switch(b.protocol){case "http:":var f=80;break a;case "https:":f=443;break a;
|
152
|
+
default:f=location.port}else f=b.port;return{href:a,host:c,port:f,hash:b.hash,hostname:b.hostname||location.hostname,pathname:"/"!=b.pathname.charAt(0)?"/"+b.pathname:b.pathname,protocol:b.protocol&&":"!=b.protocol?b.protocol:location.protocol,search:b.search,query:b.search.slice(1)}};b.isAbsolute=function(a){return 0==a.indexOf("//")||!!~a.indexOf("://")};b.isRelative=function(a){return!b.isAbsolute(a)};b.isCrossDomain=function(a){a=b.parse(a);var c=b.parse(window.location.href);return a.hostname!==
|
153
|
+
c.hostname||a.port!==c.port||a.protocol!==c.protocol}}),gi=C(function(a,b){function c(a){var c=b.cookie;a=b.levels(a);for(var d=0;d<a.length;++d){var e=a[d],l={domain:"."+e};c("__tld__",1,l);if(c("__tld__"))return c("__tld__",null,l),e}return""}var d=fi.parse;c.levels=function(a){a=d(a).hostname.split(".");var b=a[a.length-1],c=[];if(4===a.length&&b===parseInt(b,10)||1>=a.length)return c;for(b=a.length-2;0<=b;--b)c.push(a.slice(b).join("."));return c};c.cookie=Wb;b=a.exports=c}),Mm=Na("data-api.js:cookie");
|
154
|
+
yb.prototype.options=function(a){if(0===arguments.length)return this._options;a=a||{};var b="."+gi(window.location.href);"."===b&&(b=null);this._options=Ka(a,{maxage:31536E6,path:"/",domain:b});this.set("ajs:test",!0);this.get("ajs:test")||(Mm("fallback to domain=null"),this._options.domain=null);this.remove("ajs:test")};yb.prototype.set=function(a,b){try{return b=window.JSON.stringify(b),Wb(a,b,oa(this._options,5)),!0}catch(c){return!1}};yb.prototype.set_raw=function(a,b){try{return Wb(a,b,oa(this._options,
|
155
|
+
5)),!0}catch(c){return!1}};yb.prototype.get=function(a){try{var b=Wb(a);return b=b?window.JSON.parse(b):null}catch(c){return null}};yb.prototype.get_raw=function(a){try{var b=Wb(a);return b?b:null}catch(c){return null}};yb.prototype.remove=function(a){try{return Wb(a,null,oa(this._options,5)),!0}catch(b){return!1}};var za=Mb(new yb);za.Cookie=yb;var Rd=C(function(a,b){(function(){function c(a,b){function e(a,b){try{a()}catch(wq){b&&b()}}function h(a){if(null!=h[a])return h[a];if("bug-string-char-index"==
|
156
|
+
a)var c=!1;else if("json"==a)c=h("json-stringify")&&h("date-serialization")&&h("json-parse");else if("date-serialization"==a){if(c=h("json-stringify")&&w){var d=b.stringify;e(function(){c='"-271821-04-20T00:00:00.000Z"'==d(new k(-864E13))&&'"+275760-09-13T00:00:00.000Z"'==d(new k(864E13))&&'"-000001-01-01T00:00:00.000Z"'==d(new k(-621987552E5))&&'"1969-12-31T23:59:59.999Z"'==d(new k(-1))})}}else{var f;if("json-stringify"==a){d=b.stringify;var m="function"==typeof d;m&&((f=function(){return 1}).toJSON=
|
157
|
+
f,e(function(){m="0"===d(0)&&"0"===d(new l)&&'""'==d(new n)&&d(p)===t&&d(t)===t&&d()===t&&"1"===d(f)&&"[1]"==d([f])&&"[null]"==d([t])&&"null"==d(null)&&"[null,null,null]"==d([t,p,null])&&'{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}'==d({a:[f,!0,!1,null,"\x00\b\n\f\r\t"]})&&"1"===d(null,f)&&"[\n 1,\n 2\n]"==d([1,2],null,1)},function(){m=!1}));c=m}if("json-parse"==a){var u=b.parse,v;"function"==typeof u&&e(function(){0===u("0")&&!u(!1)&&(f=u('{"a":[1,true,false,null,"\\u0000\\b\\n\\f\\r\\t"]}'),
|
158
|
+
v=5==f.a.length&&1===f.a[0])&&(e(function(){v=!u('"\t"')}),v&&e(function(){v=1!==u("01")}),v&&e(function(){v=1!==u("1.")}))},function(){v=!1});c=v}}return h[a]=!!c}a||(a=f.Object());b||(b=f.Object());var l=a.Number||f.Number,n=a.String||f.String,m=a.Object||f.Object,k=a.Date||f.Date,r=a.SyntaxError||f.SyntaxError,X=a.TypeError||f.TypeError,x=a.Math||f.Math;a=a.JSON||f.JSON;"object"==typeof a&&a&&(b.stringify=a.stringify,b.parse=a.parse);m=m.prototype;var p=m.toString,q=m.hasOwnProperty,t,w=new k(-0xc782b5b800cec);
|
159
|
+
e(function(){w=-109252==w.getUTCFullYear()&&0===w.getUTCMonth()&&1===w.getUTCDate()&&10==w.getUTCHours()&&37==w.getUTCMinutes()&&6==w.getUTCSeconds()&&708==w.getUTCMilliseconds()});h["bug-string-char-index"]=h["date-serialization"]=h.json=h["json-stringify"]=h["json-parse"]=null;if(!h("json")){var y=h("bug-string-char-index"),z=function(a,b){var c=0,e,f;(e=function(){this.valueOf=0}).prototype.valueOf=0;var h=new e;for(f in h)q.call(h,f)&&c++;e=h=null;c?z=function(a,b){var c="[object Function]"==
|
160
|
+
p.call(a),d,e;for(d in a)c&&"prototype"==d||!q.call(a,d)||(e="constructor"===d)||b(d);(e||q.call(a,d="constructor"))&&b(d)}:(h="valueOf toString toLocaleString propertyIsEnumerable isPrototypeOf hasOwnProperty constructor".split(" "),z=function(a,b){var c="[object Function]"==p.call(a),e,f=!c&&"function"!=typeof a.constructor&&d[typeof a.hasOwnProperty]&&a.hasOwnProperty||q;for(e in a)c&&"prototype"==e||!f.call(a,e)||b(e);for(c=h.length;e=h[--c];)f.call(a,e)&&b(e)});return z(a,b)};if(!h("json-stringify")&&
|
161
|
+
!h("date-serialization")){var B={92:"\\\\",34:'\\"',8:"\\b",12:"\\f",10:"\\n",13:"\\r",9:"\\t"},A=function(a,b){return("000000"+(b||0)).slice(-a)},T=function(a){var b,c,d,e,f,h,l,m;if(w)var n=function(a){b=a.getUTCFullYear();c=a.getUTCMonth();d=a.getUTCDate();f=a.getUTCHours();h=a.getUTCMinutes();l=a.getUTCSeconds();m=a.getUTCMilliseconds()};else{var u=x.floor,k=[0,31,59,90,120,151,181,212,243,273,304,334],v=function(a,b){return k[b]+365*(a-1970)+u((a-1969+(b=+(1<b)))/4)-u((a-1901+b)/100)+u((a-1601+
|
162
|
+
b)/400)};n=function(a){d=u(a/864E5);for(b=u(d/365.2425)+1970-1;v(b+1,0)<=d;b++);for(c=u((d-v(b,0))/30.42);v(b,c+1)<=d;c++);d=1+d-v(b,c);e=(a%864E5+864E5)%864E5;f=u(e/36E5)%24;h=u(e/6E4)%60;l=u(e/1E3)%60;m=e%1E3}}T=function(a){a>-1/0&&a<1/0?(n(a),a=(0>=b||1E4<=b?(0>b?"-":"+")+A(6,0>b?-b:b):A(4,b))+"-"+A(2,c+1)+"-"+A(2,d)+"T"+A(2,f)+":"+A(2,h)+":"+A(2,l)+"."+A(3,m)+"Z",b=c=d=f=h=l=m=null):a=null;return a};return T(a)};if(h("json-stringify")&&!h("date-serialization")){var V=function(a){return T(this)},
|
163
|
+
W=b.stringify;b.stringify=function(a,b,c){var d=k.prototype.toJSON;k.prototype.toJSON=V;a=W(a,b,c);k.prototype.toJSON=d;return a}}else{var E=function(a){a=a.charCodeAt(0);var b=B[a];return b?b:"\\u00"+A(2,a.toString(16))},L=/[\x00-\x1f\x22\x5c]/g,C=function(a){L.lastIndex=0;return'"'+(L.test(a)?a.replace(L,E):a)+'"'},F=function(a,b,c,d,f,h,l){var m,n;e(function(){m=b[a]});"object"==typeof m&&m&&(m.getUTCFullYear&&"[object Date]"==p.call(m)&&m.toJSON===k.prototype.toJSON?m=T(m):"function"==typeof m.toJSON&&
|
164
|
+
(m=m.toJSON(a)));c&&(m=c.call(b,a,m));if(m==t)return m===t?m:"null";var u=typeof m;"object"==u&&(n=p.call(m));switch(n||u){case "boolean":case "[object Boolean]":return""+m;case "number":case "[object Number]":return m>-1/0&&m<1/0?""+m:"null";case "string":case "[object String]":return C(""+m)}if("object"==typeof m){for(u=l.length;u--;)if(l[u]===m)throw X();l.push(m);var v=[];var r=h;h+=f;if("[object Array]"==n){var R=0;for(u=m.length;R<u;R++)n=F(R,m,c,d,f,h,l),v.push(n===t?"null":n);u=v.length?f?
|
165
|
+
"[\n"+h+v.join(",\n"+h)+"\n"+r+"]":"["+v.join(",")+"]":"[]"}else z(d||m,function(a){var b=F(a,m,c,d,f,h,l);b!==t&&v.push(C(a)+":"+(f?" ":"")+b)}),u=v.length?f?"{\n"+h+v.join(",\n"+h)+"\n"+r+"}":"{"+v.join(",")+"}":"{}";l.pop();return u}};b.stringify=function(a,b,c){var e;if(d[typeof b]&&b){var f=p.call(b);if("[object Function]"==f)var h=b;else if("[object Array]"==f){var l={};for(var m=0,n=b.length,u;m<n;)if(u=b[m++],f=p.call(u),"[object String]"==f||"[object Number]"==f)l[u]=1}}if(c)if(f=p.call(c),
|
166
|
+
"[object Number]"==f){if(0<(c-=c%1))for(10<c&&(c=10),e="";e.length<c;)e+=" "}else"[object String]"==f&&(e=10>=c.length?c:c.slice(0,10));return F("",(u={},u[""]=a,u),h,l,e,"",[])}}}if(!h("json-parse")){var G=n.fromCharCode,K={92:"\\",34:'"',47:"/",98:"\b",116:"\t",110:"\n",102:"\f",114:"\r"},I,J,D=function(){I=J=null;throw r();},H=function(){for(var a=J,b=a.length,c,d,e,f,h;I<b;)switch(h=a.charCodeAt(I),h){case 9:case 10:case 13:case 32:I++;break;case 123:case 125:case 91:case 93:case 58:case 44:return c=
|
167
|
+
y?a.charAt(I):a[I],I++,c;case 34:c="@";for(I++;I<b;)if(h=a.charCodeAt(I),32>h)D();else if(92==h)switch(h=a.charCodeAt(++I),h){case 92:case 34:case 47:case 98:case 116:case 110:case 102:case 114:c+=K[h];I++;break;case 117:d=++I;for(e=I+4;I<e;I++)h=a.charCodeAt(I),48<=h&&57>=h||97<=h&&102>=h||65<=h&&70>=h||D();c+=G("0x"+a.slice(d,I));break;default:D()}else{if(34==h)break;h=a.charCodeAt(I);for(d=I;32<=h&&92!=h&&34!=h;)h=a.charCodeAt(++I);c+=a.slice(d,I)}if(34==a.charCodeAt(I))return I++,c;D();default:d=
|
168
|
+
I;45==h&&(f=!0,h=a.charCodeAt(++I));if(48<=h&&57>=h){for(48==h&&(h=a.charCodeAt(I+1),48<=h&&57>=h)&&D();I<b&&(h=a.charCodeAt(I),48<=h&&57>=h);I++);if(46==a.charCodeAt(I)){for(e=++I;e<b&&!(h=a.charCodeAt(e),48>h||57<h);e++);e==I&&D();I=e}h=a.charCodeAt(I);if(101==h||69==h){h=a.charCodeAt(++I);43!=h&&45!=h||I++;for(e=I;e<b&&!(h=a.charCodeAt(e),48>h||57<h);e++);e==I&&D();I=e}return+a.slice(d,I)}f&&D();c=a.slice(I,I+4);if("true"==c)return I+=4,!0;if("fals"==c&&101==a.charCodeAt(I+4))return I+=5,!1;if("null"==
|
169
|
+
c)return I+=4,null;D()}return"$"},M=function(a){var b;"$"==a&&D();if("string"==typeof a){if("@"==(y?a.charAt(0):a[0]))return a.slice(1);if("["==a){for(b=[];;){a=H();if("]"==a)break;if(c)","==a?(a=H(),"]"==a&&D()):D();else var c=!0;","==a&&D();b.push(M(a))}return b}if("{"==a){for(b={};;){a=H();if("}"==a)break;c?","==a?(a=H(),"}"==a&&D()):D():c=!0;","!=a&&"string"==typeof a&&"@"==(y?a.charAt(0):a[0])&&":"==H()||D();b[a.slice(1)]=M(H())}return b}D()}return a},P=function(a,b,c){c=U(a,b,c);c===t?delete a[b]:
|
170
|
+
a[b]=c},U=function(a,b,c){var d=a[b],e;if("object"==typeof d&&d)if("[object Array]"==p.call(d))for(e=d.length;e--;)P(p,z,d,e,c);else z(d,function(a){P(d,a,c)});return c.call(a,b,d)};b.parse=function(a,b){var c;I=0;J=""+a;a=M(H());"$"!=H()&&D();I=J=null;return b&&"[object Function]"==p.call(b)?U((c={},c[""]=a,c),"",b):a}}}b.runInContext=c;return b}var d={"function":!0,object:!0},e=d.object&&b&&!b.nodeType&&b,f=d[typeof window]&&window||this,h=e&&d.object&&a&&!a.nodeType&&"object"==typeof Ia&&Ia;!h||
|
171
|
+
h.global!==h&&h.window!==h&&h.self!==h||(f=h);if(e)c(f,e);else{var m=f.JSON,l=f.JSON3,n=!1,k=c(f,f.JSON3={noConflict:function(){n||(n=!0,f.JSON=m,f.JSON3=l,m=l=null);return k}});f.JSON={parse:k.parse,stringify:k.stringify}}}).call(Ia)}),hi=C(function(a){try{a.exports="undefined"!==typeof XMLHttpRequest&&"withCredentials"in new XMLHttpRequest}catch(b){a.exports=!1}}),ii=Na("jsonp"),Om=function(a,b,c){function d(){n.parentNode&&n.parentNode.removeChild(n);window[f]=Rk;l&&clearTimeout(l)}"function"==
|
172
|
+
typeof b&&(c=b,b={});b||(b={});var e=b.prefix||"__jp",f=b.name||e+Nm++;e=b.param||"callback";b=null!=b.timeout?b.timeout:6E4;var h=encodeURIComponent,m=document.getElementsByTagName("script")[0]||document.head,l;b&&(l=setTimeout(function(){d();c&&c(Error("Timeout"))},b));window[f]=function(a){ii("jsonp got",a);d();c&&c(null,a)};a+=(~a.indexOf("?")?"&":"?")+e+"="+h(f);a=a.replace("?&","?");ii('jsonp req "%s"',a);var n=document.createElement("script");n.src=a;m.parentNode.insertBefore(n,m);return function(){window[f]&&
|
173
|
+
d()}},Nm=0,ji=C(function(a,b){function c(a,b,c,d){3===arguments.length&&(d=c,c={});var e=new XMLHttpRequest;e.onerror=d;e.onreadystatechange=function(){if(4===e.readyState)return d(null,e)};e.open("POST",a,!0);for(var f in c)e.setRequestHeader(f,c[f]);e.send(Rd.stringify(b))}function d(a,c,d,l){3===arguments.length&&(l=d);var f=b.prefix,h=e(c);a+="?"+f+"="+h;Om(a,{param:b.callback},function(b,c){if(b)return l(b);l(null,{url:a,body:c})})}function e(a){var b=Rd.stringify(a);a="";var c,d=0;b=b.replace(/\r\n/g,
|
174
|
+
"\n");var e="";for(c=0;c<b.length;c++){var f=b.charCodeAt(c);128>f?e+=String.fromCharCode(f):(127<f&&2048>f?e+=String.fromCharCode(f>>6|192):(e+=String.fromCharCode(f>>12|224),e+=String.fromCharCode(f>>6&63|128)),e+=String.fromCharCode(f&63|128))}for(b=e;d<b.length;){var k=b.charCodeAt(d++);e=b.charCodeAt(d++);c=b.charCodeAt(d++);f=k>>2;k=(k&3)<<4|e>>4;var x=(e&15)<<2|c>>6;var u=c&63;isNaN(e)?x=u=64:isNaN(c)&&(u=64);a=a+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(f)+
|
175
|
+
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(k)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(x)+"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(u)}b=a.replace(/\+/g,"-").replace(/\//g,"_");return encodeURIComponent(b)}b=a.exports=hi?c:d;b.callback="callback";b.prefix="data";b.json=c;b.base64=d;b.type=hi?"xhr":"jsonp"}),Pm=Na("data-api.js:metrics");Gc.prototype.options=function(a){a=a||{};this.host=a.host||"api.segment.io/v1";
|
176
|
+
this.sampleRate=a.sampleRate||0;this.flushTimer=a.flushTimer||3E4;this.maxQueueSize=a.maxQueueSize||20;this.queue=[];if(0<this.sampleRate){var b=this;setInterval(function(){b._flush()},this.flushTimer)}};Gc.prototype.increment=function(a,b){Math.random()>this.sampleRate||this.queue.length>=this.maxQueueSize||(this.queue.push({type:"Counter",metric:a,value:1,tags:b}),0<a.indexOf("error")&&this._flush())};Gc.prototype._flush=function(){if(!(0>=this.queue.length)){var a={series:this.queue};this.queue=
|
177
|
+
[];"xhr"===ji.type&&ji("https://"+this.host+"/m",a,{"Content-Type":"text/plain"},function(b,c){Pm("sent %O, received %O",a,[b,c])})}};var Cb=Mb(new Gc);Cb.Metrics=Gc;var Qm=function(a){return function(b,c,d){var e=-1,f=Object(b);d=d(b);for(var h=d.length;h--;){var m=d[a?h:++e];if(!1===c(f[m],m,f))break}return b}}(),ef=function(a,b){return function(c,d){if(null==c)return c;if(!Ub(c))return a(c,d);for(var e=c.length,f=b?e:-1,h=Object(c);(b?f--:++f<e)&&!1!==d(h[f],f,h););return c}}(function(a,b){return a&&
|
178
|
+
Qm(a,b,sa)}),ki=function(a,b){return(ya(a)?mg:ef)(a,"function"==typeof b?b:Qd)},fa=function(a,b){return ki(b,a)},Sd=function(a,b,c){if("function"!==typeof a)throw new TypeError("Expected a function but received a "+typeof a);fa(function(c,e,f){b=a(b,c,e,f)},c);return b},Rm=Object.prototype.hasOwnProperty,ff=function(a){return ci(function(b,c){var d=-1,e=c.length,f=1<e?c[e-1]:void 0,h=2<e?c[2]:void 0;f=3<a.length&&"function"==typeof f?(e--,f):void 0;h&&di(c[0],c[1],h)&&(f=3>e?void 0:f,e=1);for(b=Object(b);++d<
|
179
|
+
e;)(h=c[d])&&a(b,h,d,f);return b})}(function(a,b){if(Ld(b)||Ub(b))Pc(b,sa(b),a);else for(var c in b)Rm.call(b,c)&&nd(a,c,b[c])}),Sm=Object.prototype.hasOwnProperty,li=Mb(new td);td.prototype.set=function(a,b){this.store[a]=oa(b,5);return!0};td.prototype.get=function(a){if(Sm.call(this.store,a))return oa(this.store[a],5)};td.prototype.remove=function(a){delete this.store[a];return!0};var Td=function(){var a={},b="undefined"!=typeof window?window:Ia,c=b.document;a.disabled=!1;a.version="1.3.20";a.set=
|
180
|
+
function(a,b){};a.get=function(a,b){};a.has=function(b){return void 0!==a.get(b)};a.remove=function(a){};a.clear=function(){};a.transact=function(b,c,d){null==d&&(d=c,c=null);null==c&&(c={});c=a.get(b,c);d(c);a.set(b,c)};a.getAll=function(){var b={};a.forEach(function(a,c){b[a]=c});return b};a.forEach=function(){};a.serialize=function(a){return Rd.stringify(a)};a.deserialize=function(a){if("string"==typeof a)try{return Rd.parse(a)}catch(X){return a||void 0}};try{var d="localStorage"in b&&b.localStorage}catch(n){d=
|
181
|
+
!1}if(d){var e=b.localStorage;a.set=function(b,c){if(void 0===c)return a.remove(b);e.setItem(b,a.serialize(c));return c};a.get=function(b,c){b=a.deserialize(e.getItem(b));return void 0===b?c:b};a.remove=function(a){e.removeItem(a)};a.clear=function(){e.clear()};a.forEach=function(b){for(var c=0;c<e.length;c++){var d=e.key(c);b(d,a.get(d))}}}else if(c&&c.documentElement.addBehavior){try{var f=new ActiveXObject("htmlfile");f.open();f.write('<script>document.w=window\x3c/script><iframe src="/favicon.ico"></iframe>');
|
182
|
+
f.close();var h=f.w.frames[0].document;e=h.createElement("div")}catch(n){e=c.createElement("div"),h=c.body}b=function(b){return function(){var c=Array.prototype.slice.call(arguments,0);c.unshift(e);h.appendChild(e);e.addBehavior("#default#userData");e.load("localStorage");c=b.apply(a,c);h.removeChild(e);return c}};var m=/[!"#$%&'()*+,/\\:;<=>?@[\]^`{|}~]/g,l=function(a){return a.replace(/^d/,"___$&").replace(m,"___")};a.set=b(function(b,c,d){c=l(c);if(void 0===d)return a.remove(c);b.setAttribute(c,
|
183
|
+
a.serialize(d));b.save("localStorage");return d});a.get=b(function(b,c,d){c=l(c);b=a.deserialize(b.getAttribute(c));return void 0===b?d:b});a.remove=b(function(a,b){b=l(b);a.removeAttribute(b);a.save("localStorage")});a.clear=b(function(a){var b=a.XMLDocument.documentElement.attributes;a.load("localStorage");for(var c=b.length-1;0<=c;c--)a.removeAttribute(b[c].name);a.save("localStorage")});a.forEach=b(function(b,c){for(var d=b.XMLDocument.documentElement.attributes,e=0,f;f=d[e];++e)c(f.name,a.deserialize(b.getAttribute(f.name)))})}try{a.set("__storejs__",
|
184
|
+
"__storejs__"),"__storejs__"!=a.get("__storejs__")&&(a.disabled=!0),a.remove("__storejs__")}catch(n){a.disabled=!0}a.enabled=!a.disabled;return a}();ec.prototype.options=function(a){if(0===arguments.length)return this._options;a=a||{};Ka(a,{enabled:!0});this.enabled=a.enabled&&Td.enabled;this._options=a};ec.prototype.set=function(a,b){return this.enabled?Td.set(a,b):!1};ec.prototype.get=function(a){return this.enabled?Td.get(a):null};ec.prototype.remove=function(a){return this.enabled?Td.remove(a):
|
185
|
+
!1};var gb=Mb(new ec);gb.Store=ec;var Tm=Na("dataApi:entity"),Lb=ta;ta.prototype.initialize=function(){za.set("dajs:cookies",!0);za.get("dajs:cookies")?(za.remove("dajs:cookies"),this._storage=za):gb.enabled?this._storage=gb:(Tm("warning using memory store both cookies and localStorage are disabled"),this._storage=li)};ta.prototype.storage=function(){return this._storage};ta.prototype.options=function(a){if(0===arguments.length)return this._options;this._options=Ka(a||{},this.defaults||{})};ta.prototype.id=
|
186
|
+
function(a){switch(arguments.length){case 0:return this._getId();case 1:return this._setId(a)}};ta.prototype._getId=function(){var a=this._options.persist?this.storage().get(this._options.cookie.key):this._id;return void 0===a?null:a};ta.prototype._setId=function(a){this._options.persist?this.storage().set(this._options.cookie.key,a):this._id=a};ta.prototype.properties=ta.prototype.traits=function(a){switch(arguments.length){case 0:return this._getTraits();case 1:return this._setTraits(a)}};ta.prototype._getTraits=
|
187
|
+
function(){var a=this._options.persist?gb.get(this._options.localStorage.key):this._traits;return a?qg(oa(a,5)):{}};ta.prototype._setTraits=function(a){a=a||{};this._options.persist?gb.set(this._options.localStorage.key,a):this._traits=a};ta.prototype.identify=function(a,b){b=b||{};var c=this.id();if(null===c||c===a)b=ff(this.traits(),b);a&&this.id(a);this.debug("identify %o, %o",a,b);this.traits(b);this.save()};ta.prototype.save=function(){if(!this._options.persist)return!1;za.set(this._options.cookie.key,
|
188
|
+
this.id());gb.set(this._options.localStorage.key,this.traits());return!0};ta.prototype.logout=function(){this.id(null);this.traits({});za.remove(this._options.cookie.key);gb.remove(this._options.localStorage.key)};ta.prototype.reset=function(){this.logout();this.options({})};ta.prototype.load=function(){this.id(za.get(this._options.cookie.key));this.traits(gb.get(this._options.localStorage.key))};var Sk=Na("dataApi:group");Hc.defaults={persist:!0,cookie:{key:"dajs_group_id"},localStorage:{key:"dajs_group_properties"}};
|
189
|
+
rb(Hc,Lb);var Db=Mb(new Hc);Db.Group=Hc;var Um=function(a){if(a.metaKey||a.altKey||a.ctrlKey||a.shiftKey)return!0;var b=a.which;a=a.button;return b||void 0===a?2===b?!0:!1:!a&1&&!a&2&&a&4};var gf=function(a){if("function"!==typeof a)throw new TypeError(a+" is not a function");return a};var mi=function(a){var b=document.createTextNode(""),c,d=0;(new a(function(){if(c){var a=c;c=null;"function"===typeof a?a():a.forEach(function(a){a()})}})).observe(b,{characterData:!0});return function(a){gf(a);c?"function"===
|
190
|
+
typeof c?c=[c,a]:c.push(a):(c=a,b.data=d=++d%2)}};var Rc=function(){if("undefined"!==typeof process&&process&&"function"===typeof process.nextTick)return process.nextTick;if("object"===typeof document&&document){if("function"===typeof MutationObserver)return mi(MutationObserver);if("function"===typeof WebKitMutationObserver)return mi(WebKitMutationObserver)}return"function"===typeof setImmediate?function(a){setImmediate(gf(a))}:"function"===typeof setTimeout?function(a){setTimeout(gf(a),0)}:null}(),
|
191
|
+
Vm=/\s/,Wm=function(a){for(var b=a.length;b--&&Vm.test(a.charAt(b)););return b},Xm=/^\s+/,wd=function(a){return"symbol"==typeof a||nb(a)&&"[object Symbol]"==Rb(a)},ni=0/0,Ym=/^[-+]0x[0-9a-f]+$/i,Zm=/^0b[01]+$/i,$m=/^0o[0-7]+$/i,an=parseInt,bn=function(a){if("number"==typeof a)return a;if(wd(a))return ni;Ra(a)&&(a="function"==typeof a.valueOf?a.valueOf():a,a=Ra(a)?a+"":a);if("string"!=typeof a)return 0===a?a:+a;a=a?a.slice(0,Wm(a)+1).replace(Xm,""):a;var b=Zm.test(a);return b||$m.test(a)?an(a.slice(2),
|
192
|
+
b?2:8):Ym.test(a)?ni:+a},oi=1/0,ze=function(a,b){for(var c=-1,d=null==a?0:a.length,e=Array(d);++c<d;)e[c]=b(a[c],c,a);return e},cn=function(a,b){return ze(b,function(b){return a[b]})},dn=Math.max,Sc=function(a,b,c,d){a=Ub(a)?a:null==a?[]:cn(a,sa(a));c&&!d?(c?(c=bn(c),c=c===oi||c===-oi?1.7976931348623157E308*(0>c?-1:1):c===c?c:0):c=0===c?c:0,d=c%1,c=c===c?d?c-d:c:0):c=0;d=a.length;0>c&&(c=dn(d+c,0));var e=a;if("string"==typeof e||!ya(e)&&nb(e)&&"[object String]"==Rb(e))b=c<=d&&-1<a.indexOf(b,c);else{if(d=
|
193
|
+
!!d){if(b===b)a:{--c;for(d=a.length;++c<d;)if(a[c]===b){b=c;break a}b=-1}else a:{b=a.length;for(c+=-1;++c<b;)if(d=a[c],d=d!==d){b=c;break a}b=-1}d=-1<b}b=d}return b};ud.prototype.add=ud.prototype.push=function(a){this.__data__.set(a,"__lodash_hash_undefined__");return this};ud.prototype.has=function(a){return this.__data__.has(a)};var en=function(a,b){for(var c=-1,d=null==a?0:a.length;++c<d;)if(b(a[c],c,a))return!0;return!1},wg=function(a,b,c,d,e,f){var h=c&1,m=a.length,l=b.length;if(m!=l&&!(h&&l>
|
194
|
+
m))return!1;l=f.get(a);var n=f.get(b);if(l&&n)return l==b&&n==a;l=-1;n=!0;var k=c&2?new ud:void 0;f.set(a,b);for(f.set(b,a);++l<m;){var r=a[l],x=b[l];if(d)var u=h?d(x,r,l,b,a,f):d(r,x,l,a,b,f);if(void 0!==u){if(u)continue;n=!1;break}if(k){if(!en(b,function(a,b){if(!k.has(b)&&(r===a||e(r,a,c,d,f)))return k.push(b)})){n=!1;break}}else if(r!==x&&!e(r,x,c,d,f)){n=!1;break}}f["delete"](a);f["delete"](b);return n},fn=function(a){var b=-1,c=Array(a.size);a.forEach(function(a,e){c[++b]=[e,a]});return c},
|
195
|
+
gn=function(a){var b=-1,c=Array(a.size);a.forEach(function(a){c[++b]=a});return c},pi=Ua?Ua.prototype:void 0,hf=pi?pi.valueOf:void 0,Tk=function(a,b,c,d,e,f,h){switch(c){case "[object DataView]":if(a.byteLength!=b.byteLength||a.byteOffset!=b.byteOffset)break;a=a.buffer;b=b.buffer;case "[object ArrayBuffer]":if(a.byteLength!=b.byteLength||!f(new Md(a),new Md(b)))break;return!0;case "[object Boolean]":case "[object Date]":case "[object Number]":return Lc(+a,+b);case "[object Error]":return a.name==
|
196
|
+
b.name&&a.message==b.message;case "[object RegExp]":case "[object String]":return a==b+"";case "[object Map]":var m=fn;case "[object Set]":m||(m=gn);if(a.size!=b.size&&!(d&1))break;if(c=h.get(a))return c==b;d|=2;h.set(a,b);b=wg(m(a),m(b),d,e,f,h);h["delete"](a);return b;case "[object Symbol]":if(hf)return hf.call(a)==hf.call(b)}return!1},Uk=Object.prototype.hasOwnProperty,xg=Object.prototype.hasOwnProperty,hn=function(a,b,c,d){var e=c.length,f=e,h=!d;if(null==a)return!f;for(a=Object(a);e--;){var m=
|
197
|
+
c[e];if(h&&m[2]?m[1]!==a[m[0]]:!(m[0]in a))return!1}for(;++e<f;){m=c[e];var l=m[0],n=a[l],k=m[1];if(h&&m[2]){if(void 0===n&&!(l in a))return!1}else{m=new Dc;if(d)var r=d(n,k,l,a,b,m);if(void 0===r?!fc(k,n,3,d,m):!r)return!1}}return!0},jn=function(a){for(var b=sa(a),c=b.length;c--;){var d=b[c],e=a[d];b[c]=[d,e,e===e&&!Ra(e)]}return b},qi=function(a,b){return function(c){return null==c?!1:c[a]===b&&(void 0!==b||a in Object(c))}},kn=function(a){var b=jn(a);return 1==b.length&&b[0][2]?qi(b[0][0],b[0][1]):
|
198
|
+
function(c){return c===a||hn(c,a,b)}},ln=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,mn=/^\w*$/,jf=function(a,b){if(ya(a))return!1;var c=typeof a;return"number"==c||"symbol"==c||"boolean"==c||null==a||wd(a)?!0:mn.test(a)||!ln.test(a)||null!=b&&a in Object(b)};ye.Cache=vd;var nn=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,on=/\\(\\)?/g,pn=function(a){a=ye(a,function(a){500===b.size&&b.clear();return a});var b=a.cache;return a}(function(a){var b=
|
199
|
+
[];46===a.charCodeAt(0)&&b.push("");a.replace(nn,function(a,d,e,f){b.push(e?f.replace(on,"$1"):d||a)});return b}),Vk=1/0,ri=Ua?Ua.prototype:void 0,zg=ri?ri.toString:void 0,Ud=function(a,b){return ya(a)?a:jf(a,b)?[a]:pn(null==a?"":yg(a))},qn=1/0,Tc=function(a){if("string"==typeof a||wd(a))return a;var b=a+"";return"0"==b&&1/a==-qn?"-0":b},kf=function(a,b){b=Ud(b,a);for(var c=0,d=b.length;null!=a&&c<d;)a=a[Tc(b[c++])];return c&&c==d?a:void 0},si=function(a,b){return null!=a&&b in Object(a)},ti=function(a,
|
200
|
+
b,c){b=Ud(b,a);for(var d=-1,e=b.length,f=!1;++d<e;){var h=Tc(b[d]);if(!(f=null!=a&&c(a,h)))break;a=a[h]}if(f||++d!=e)return f;e=null==a?0:a.length;return!!e&&Ve(e)&&Kd(h,e)&&(ya(a)||Ue(a))},rn=function(a,b){return jf(a)&&b===b&&!Ra(b)?qi(Tc(a),b):function(c){var d=null==c?void 0:kf(c,a);d=void 0===d?void 0:d;return void 0===d&&d===b?null!=c&&ti(c,a,si):fc(b,d,3)}},sn=function(a){return function(b){return null==b?void 0:b[a]}},tn=function(a){return function(b){return kf(b,a)}},ui=function(a){return"function"==
|
201
|
+
typeof a?a:null==a?Qd:"object"==typeof a?ya(a)?rn(a[0],a[1]):kn(a):jf(a)?sn(Tc(a)):tn(a)},un=function(a,b){var c=-1,d=Ub(a)?Array(a.length):[];ef(a,function(a,f,h){d[++c]=b(a,f,h)});return d},vn=function(a,b){return(ya(b)?ze:un)(b,ui(a))},vi=Na("data-api.js:normalize"),wi=Object.prototype.hasOwnProperty,xn=function(a,b){function c(a){var c;if(c=!Sc(b,a)&&"all"!==a.toLowerCase())a=a.toLowerCase(),c=!Sc(d,a);return!c}var d=vn(function(a){return a.toLowerCase()},b),e=a.options||{},f=e.integrations||
|
202
|
+
{},h=e.providers||{},m=e.context||{},l={};vi("<-",a);fa(function(a,b){c(b)&&(wi.call(f,b)||(f[b]=a),delete e[b])},e);delete e.providers;fa(function(a,b){c(b)&&"object"!==ka(f[b])&&(wi.call(f,b)&&"boolean"===typeof h[b]||(f[b]=a))},h);fa(function(a,b){Sc(wn,b)?l[b]=e[b]:m[b]=e[b]},e);delete a.options;l.integrations=f;l.context=m;l=Ka(l,a);vi("->",l);return l},wn=["integrations","anonymousId","timestamp","context"],xi=window.addEventListener?"addEventListener":"attachEvent",yn="addEventListener"!==
|
203
|
+
xi?"on":"",Vd=function(a){return a&&a.Math==Math&&a},la=Vd("object"==typeof globalThis&&globalThis)||Vd("object"==typeof window&&window)||Vd("object"==typeof self&&self)||Vd("object"==typeof Ia&&Ia)||Function("return this")(),hb=function(a){try{return!!a()}catch(b){return!0}},$a=!hb(function(){return 7!=Object.defineProperty({},1,{get:function(){return 7}})[1]}),yi={}.propertyIsEnumerable,zi=Object.getOwnPropertyDescriptor,Ai=zi&&!yi.call({1:2},1)?function(a){a=zi(this,a);return!!a&&a.enumerable}:
|
204
|
+
yi,oc=function(a,b){return{enumerable:!(a&1),configurable:!(a&2),writable:!(a&4),value:b}},zn={}.toString,Uc=function(a){return zn.call(a).slice(8,-1)},An="".split,pc=hb(function(){return!Object("z").propertyIsEnumerable(0)})?function(a){return"String"==Uc(a)?An.call(a,""):Object(a)}:Object,sb=function(a){if(void 0==a)throw TypeError("Can't call method on "+a);return a},ab=function(a){return"object"===typeof a?null!==a:"function"===typeof a},lf=function(a,b){if(!ab(a))return a;var c,d;if(b&&"function"==
|
205
|
+
typeof(c=a.toString)&&!ab(d=c.call(a))||"function"==typeof(c=a.valueOf)&&!ab(d=c.call(a))||!b&&"function"==typeof(c=a.toString)&&!ab(d=c.call(a)))return d;throw TypeError("Can't convert object to primitive value");},Bn={}.hasOwnProperty,da=function(a,b){return Bn.call(a,b)},Wd=la.document,Bi=ab(Wd)&&ab(Wd.createElement),Ci=!$a&&!hb(function(){return 7!=Object.defineProperty(Bi?Wd.createElement("div"):{},"a",{get:function(){return 7}}).a}),Di=Object.getOwnPropertyDescriptor,Ei=$a?Di:function(a,b){a=
|
206
|
+
pc(sb(a));b=lf(b,!0);if(Ci)try{return Di(a,b)}catch(c){}if(da(a,b))return oc(!Ai.call(a,b),a[b])},ib=function(a){if(!ab(a))throw TypeError(String(a)+" is not an object");return a},Fi=Object.defineProperty,qc={f:$a?Fi:function(a,b,c){ib(a);b=lf(b,!0);ib(c);if(Ci)try{return Fi(a,b,c)}catch(d){}if("get"in c||"set"in c)throw TypeError("Accessors not supported");"value"in c&&(a[b]=c.value);return a}},Eb=$a?function(a,b,c){return qc.f(a,b,oc(1,c))}:function(a,b,c){a[b]=c;return a},mf=function(a,b){try{Eb(la,
|
207
|
+
a,b)}catch(c){la[a]=b}return b},Vc=la["__core-js_shared__"]||mf("__core-js_shared__",{}),Cn=Function.toString;"function"!=typeof Vc.inspectSource&&(Vc.inspectSource=function(a){return Cn.call(a)});var Gi=Vc.inspectSource,Hi=la.WeakMap,Dn="function"===typeof Hi&&/native code/.test(Gi(Hi)),Ii=C(function(a){(a.exports=function(a,c){return Vc[a]||(Vc[a]=void 0!==c?c:{})})("versions",[]).push({version:"3.6.5",mode:"global",copyright:"\u00a9 2020 Denis Pushkarev (zloirock.ru)"})}),En=0,Fn=Math.random(),
|
208
|
+
Ji=function(a){return"Symbol("+String(void 0===a?"":a)+")_"+(++En+Fn).toString(36)},Ki=Ii("keys"),nf=function(a){return Ki[a]||(Ki[a]=Ji(a))},of={},Gn=la.WeakMap;if(Dn){var rc=new Gn,Hn=rc.get,In=rc.has,Jn=rc.set;var pf=function(a,b){Jn.call(rc,a,b);return b};var Xd=function(a){return Hn.call(rc,a)||{}};var qf=function(a){return In.call(rc,a)}}else{var Wc=nf("state");of[Wc]=!0;pf=function(a,b){Eb(a,Wc,b);return b};Xd=function(a){return da(a,Wc)?a[Wc]:{}};qf=function(a){return da(a,Wc)}}var bb={set:pf,
|
209
|
+
get:Xd,has:qf,enforce:function(a){return qf(a)?Xd(a):pf(a,{})},getterFor:function(a){return function(b){var c;if(!ab(b)||(c=Xd(b)).type!==a)throw TypeError("Incompatible receiver, "+a+" required");return c}}},tb=C(function(a){var b=bb.get,c=bb.enforce,d=String(String).split("String");(a.exports=function(a,b,h,m){var e=m?!!m.unsafe:!1,f=m?!!m.enumerable:!1;m=m?!!m.noTargetGet:!1;"function"==typeof h&&("string"!=typeof b||da(h,"name")||Eb(h,"name",b),c(h).source=d.join("string"==typeof b?b:""));a===
|
210
|
+
la?f?a[b]=h:mf(b,h):(e?!m&&a[b]&&(f=!0):delete a[b],f?a[b]=h:Eb(a,b,h))})(Function.prototype,"toString",function(){return"function"==typeof this&&b(this).source||Gi(this)})}),Li=function(a){return"function"==typeof a?a:void 0},Yd=function(a,b){return 2>arguments.length?Li(la[a])||Li(la[a]):la[a]&&la[a][b]||la[a]&&la[a][b]},Kn=Math.ceil,Ln=Math.floor,rf=function(a){return isNaN(a=+a)?0:(0<a?Ln:Kn)(a)},Mn=Math.min,sf=function(a){return 0<a?Mn(rf(a),9007199254740991):0},Nn=Math.max,On=Math.min,Mi=function(a){return function(b,
|
211
|
+
c,d){b=pc(sb(b));var e=sf(b.length);d=rf(d);d=0>d?Nn(d+e,0):On(d,e);if(a&&c!=c)for(;e>d;){if(c=b[d++],c!=c)return!0}else for(;e>d;d++)if((a||d in b)&&b[d]===c)return a||d||0;return!a&&-1}},Pn=Mi(!0),Qn=Mi(!1),Ni=function(a,b){a=pc(sb(a));var c=0,d=[],e;for(e in a)!da(of,e)&&da(a,e)&&d.push(e);for(;b.length>c;)da(a,e=b[c++])&&(~Qn(d,e)||d.push(e));return d},Zd="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" "),Rn=Zd.concat("length","prototype"),
|
212
|
+
Sn={f:Object.getOwnPropertyNames||function(a){return Ni(a,Rn)}},$d=Object.getOwnPropertySymbols,Tn=Yd("Reflect","ownKeys")||function(a){var b=Sn.f(ib(a));return $d?b.concat($d(a)):b},Un=/#|\.prototype\./,Xc=function(a,b){a=Vn[Wn(a)];return a==Xn?!0:a==Yn?!1:"function"==typeof b?hb(b):!!b},Wn=Xc.normalize=function(a){return String(a).replace(Un,".").toLowerCase()},Vn=Xc.data={},Yn=Xc.NATIVE="N",Xn=Xc.POLYFILL="P",sc=function(a,b){var c=a.target,d=a.global,e=a.stat,f,h;if(f=d?la:e?la[c]||mf(c,{}):(la[c]||
|
213
|
+
{}).prototype)for(h in b){var m=b[h];var l=a.noTargetGet?(l=Ei(f,h))&&l.value:f[h];var n=Xc(d?h:c+(e?".":"#")+h,a.forced);if(!n&&void 0!==l){if(typeof m===typeof l)continue;n=m;for(var k=l,r=Tn(k),x=qc.f,u=Ei,v=0;v<r.length;v++){var S=r[v];da(n,S)||x(n,S,u(k,S))}}(a.sham||l&&l.sham)&&Eb(m,"sham",!0);tb(f,h,m,a)}},Oi=!!Object.getOwnPropertySymbols&&!hb(function(){return!String(Symbol())}),Zn=Oi&&!Symbol.sham&&"symbol"==typeof Symbol.iterator,ae=Ii("wks"),Yc=la.Symbol,$n=Zn?Yc:Yc&&Yc.withoutSetter||
|
214
|
+
Ji,jb=function(a){da(ae,a)||(Oi&&da(Yc,a)?ae[a]=Yc[a]:ae[a]=$n("Symbol."+a));return ae[a]},be=Object.keys||function(a){return Ni(a,Zd)},Pi=$a?Object.defineProperties:function(a,b){ib(a);for(var c=be(b),d=c.length,e=0,f;d>e;)qc.f(a,f=c[e++],b[f]);return a},ao=Yd("document","documentElement"),Qi=nf("IE_PROTO"),tf=function(){},uf,ce=function(){try{uf=document.domain&&new ActiveXObject("htmlfile")}catch(b){}if(uf){var a=uf;a.write("<script>\x3c/script>");a.close();a=a.parentWindow.Object}else a=Bi?Wd.createElement("iframe"):
|
215
|
+
{},a.style.display="none",ao.appendChild(a),a.src="javascript:",a=a.contentWindow.document,a.open(),a.write("<script>document.F=Object\x3c/script>"),a.close(),a=a.F;ce=a;for(a=Zd.length;a--;)delete ce.prototype[Zd[a]];return ce()};of[Qi]=!0;var vf=Object.create||function(a,b){if(null!==a){tf.prototype=ib(a);var c=new tf;tf.prototype=null;c[Qi]=a}else c=ce();return void 0===b?c:Pi(c,b)},tc=jb("unscopables"),uc=Array.prototype;void 0==uc[tc]&&qc.f(uc,tc,{configurable:!0,value:vf(null)});var bo=Object.defineProperty,
|
216
|
+
wf={},Ri=function(a){throw a;},Si=function(a,b){if(da(wf,a))return wf[a];b||(b={});var c=[][a],d=da(b,"ACCESSORS")?b.ACCESSORS:!1,e=da(b,0)?b[0]:Ri,f=da(b,1)?b[1]:void 0;return wf[a]=!!c&&!hb(function(){if(d&&!$a)return!0;var a={length:-1};d?bo(a,1,{enumerable:!0,get:Ri}):a[1]=1;c.call(a,e,f)})},co=Si("indexOf",{ACCESSORS:!0,1:0});sc({target:"Array",proto:!0,forced:!co},{includes:function(a){return Pn(this,a,1<arguments.length?arguments[1]:void 0)}});uc[tc].includes=!0;var Ti=function(a){return function(b,
|
217
|
+
c){b=String(sb(b));c=rf(c);var d=b.length,e;if(0>c||c>=d)return a?"":void 0;var f=b.charCodeAt(c);return 55296>f||56319<f||c+1===d||56320>(e=b.charCodeAt(c+1))||57343<e?a?b.charAt(c):f:a?b.slice(c,c+2):(f-55296<<10)+(e-56320)+65536}},eo=Ti(!1),fo=Ti(!0),go=!hb(function(){function a(){}a.prototype.constructor=null;return Object.getPrototypeOf(new a)!==a.prototype}),Ui=nf("IE_PROTO"),ho=Object.prototype,de=go?Object.getPrototypeOf:function(a){a=Object(sb(a));return da(a,Ui)?a[Ui]:"function"==typeof a.constructor&&
|
218
|
+
a instanceof a.constructor?a.constructor.prototype:a instanceof Object?ho:null},Vi=jb("iterator"),Wi=!1,io=function(){return this},vc;if([].keys){var Xi=[].keys();if("next"in Xi){var Yi=de(de(Xi));Yi!==Object.prototype&&(vc=Yi)}else Wi=!0}void 0==vc&&(vc={});da(vc,Vi)||Eb(vc,Vi,io);var ee=vc,fe=Wi,jo=qc.f,Zi=jb("toStringTag"),ge=function(a,b,c){a&&!da(a=c?a:a.prototype,Zi)&&jo(a,Zi,{configurable:!0,value:b})},wc={},ko=function(){return this},$i=function(a,b,c){b+=" Iterator";a.prototype=vf(ee,{next:oc(1,
|
219
|
+
c)});ge(a,b,!1);wc[b]=ko;return a},aj=Object.setPrototypeOf||("__proto__"in{}?function(){var a=!1,b={};try{var c=Object.getOwnPropertyDescriptor(Object.prototype,"__proto__").set;c.call(b,[]);a=b instanceof Array}catch(d){}return function(b,e){ib(b);if(!ab(e)&&null!==e)throw TypeError("Can't set "+String(e)+" as a prototype");a?c.call(b,e):b.__proto__=e;return b}}():void 0),Zc=jb("iterator"),lo=function(){return this},bj=function(a,b,c,d,e,f,h){$i(c,b,d);d=function(a){if(a===e&&r)return r;if(!fe&&
|
220
|
+
a in n)return n[a];switch(a){case "keys":return function(){return new c(this,a)};case "values":return function(){return new c(this,a)};case "entries":return function(){return new c(this,a)}}return function(){return new c(this)}};var m=b+" Iterator",l=!1,n=a.prototype,k=n[Zc]||n["@@iterator"]||e&&n[e],r=!fe&&k||d(e),x="Array"==b?n.entries||k:k,u;x&&(a=de(x.call(new a)),ee!==Object.prototype&&a.next&&(de(a)!==ee&&(aj?aj(a,ee):"function"!=typeof a[Zc]&&Eb(a,Zc,lo)),ge(a,m,!0)));"values"==e&&k&&"values"!==
|
221
|
+
k.name&&(l=!0,r=function(){return k.call(this)});n[Zc]!==r&&Eb(n,Zc,r);wc[b]=r;if(e){var v={values:d("values"),keys:f?r:d("keys"),entries:d("entries")};if(h)for(u in v)!fe&&!l&&u in n||tb(n,u,v[u]);else sc({target:b,proto:!0,forced:fe||l},v)}return v},mo=bb.set,no=bb.getterFor("String Iterator");bj(String,"String",function(a){mo(this,{type:"String Iterator",string:String(a),index:0})},function(){var a=no(this),b=a.string,c=a.index;if(c>=b.length)return{value:void 0,done:!0};b=fo(b,c);a.index+=b.length;
|
222
|
+
return{value:b,done:!1}});var oo=jb("iterator"),xf=!hb(function(){var a=new URL("b?a=1&b=2&c=3","http://a"),b=a.searchParams,c="";a.pathname="c%20d";b.forEach(function(a,e){b["delete"]("b");c+=e+a});return!b.sort||"http://a/c%20d?a=1&c=3"!==a.href||"3"!==b.get("c")||"a=1"!==String(new URLSearchParams("?a=1"))||!b[oo]||"a"!==(new URL("https://a@b")).username||"b"!==(new URLSearchParams(new URLSearchParams("a=b"))).get("a")||"xn--e1aybc"!==(new URL("http://\u0442\u0435\u0441\u0442")).host||"#%D0%B1"!==
|
223
|
+
(new URL("http://a#\u0431")).hash||"a1c3"!==c||"x"!==(new URL("http://x",void 0)).host}),cj=function(a,b,c){if(!(a instanceof b))throw TypeError("Incorrect "+(c?c+" ":"")+"invocation");return a},xc=Object.assign,dj=Object.defineProperty,yf=!xc||hb(function(){if($a&&1!==xc({b:1},xc(dj({},"a",{enumerable:!0,get:function(){dj(this,"b",{value:3,enumerable:!1})}}),{b:2})).b)return!0;var a={},b={},c=Symbol();a[c]=7;"abcdefghijklmnopqrst".split("").forEach(function(a){b[a]=a});return 7!=xc({},a)[c]||"abcdefghijklmnopqrst"!=
|
224
|
+
be(xc({},b)).join("")})?function(a,b){for(var c=Object(sb(a)),d=arguments.length,e=1;d>e;)for(var f=pc(arguments[e++]),h=$d?be(f).concat($d(f)):be(f),m=h.length,l=0,n;m>l;)if(n=h[l++],!$a||Ai.call(f,n))c[n]=f[n];return c}:xc,ej=function(a){if("function"!=typeof a)throw TypeError(String(a)+" is not a function");return a},fj=function(a,b,c){ej(a);if(void 0===b)return a;switch(c){case 0:return function(){return a.call(b)};case 1:return function(c){return a.call(b,c)};case 2:return function(c,e){return a.call(b,
|
225
|
+
c,e)};case 3:return function(c,e,f){return a.call(b,c,e,f)}}return function(){return a.apply(b,arguments)}},po=jb("iterator"),qo=Array.prototype,gj=function(a,b,c){b=lf(b);b in a?qc.f(a,b,oc(0,c)):a[b]=c},ro=jb("toStringTag"),hj={};hj[ro]="z";var so="[object z]"===String(hj),to=jb("toStringTag"),uo="Arguments"==Uc(function(){return arguments}()),ij=so?Uc:function(a){var b;if(void 0===a)var c="Undefined";else{if(null===a)var d="Null";else{a:{var e=a=Object(a);try{d=e[to];break a}catch(f){}d=void 0}d=
|
226
|
+
"string"==typeof(c=d)?c:uo?Uc(a):"Object"==(b=Uc(a))&&"function"==typeof a.callee?"Arguments":b}c=d}return c},vo=jb("iterator"),zf=function(a){if(void 0!=a)return a[vo]||a["@@iterator"]||wc[ij(a)]},yc=function(a){var b=Object(sb(a)),c="function"==typeof this?this:Array,d=arguments.length,e=1<d?arguments[1]:void 0,f=void 0!==e,h=zf(b),m=0,l;f&&(e=fj(e,2<d?arguments[2]:void 0,2));if(void 0!=h&&(c!=Array||void 0===h||wc.Array!==h&&qo[po]!==h))for(b=h.call(b),d=b.next,c=new c;!(l=d.call(b)).done;m++){if(f){h=
|
227
|
+
b;var n=e;l=[l.value,m];try{var k=n(ib(l)[0],l[1])}catch(r){throw e=h["return"],void 0!==e&&ib(e.call(h)),r;}}else k=l.value;h=k;gj(c,m,h)}else for(k=sf(b.length),c=new c(k);k>m;m++)h=f?e(b[m],m):b[m],gj(c,m,h);c.length=m;return c},wo=/[^\0-\u007E]/,xo=/[.\u3002\uFF0E\uFF61]/g,zc=Math.floor,Af=String.fromCharCode,jj=function(a){return a+22+75*(26>a)},yo=function(a){for(var b=[],c=[],d=0,e=a.length;d<e;){var f=a.charCodeAt(d++);if(55296<=f&&56319>=f&&d<e){var h=a.charCodeAt(d++);56320==(h&64512)?c.push(((f&
|
228
|
+
1023)<<10)+(h&1023)+65536):(c.push(f),d--)}else c.push(f)}a=c;c=a.length;d=128;var m=0,l=72;for(e=0;e<a.length;e++){var n=a[e];128>n&&b.push(Af(n))}for((h=f=b.length)&&b.push("-");h<c;){var k=2147483647;for(e=0;e<a.length;e++)n=a[e],n>=d&&n<k&&(k=n);var r=h+1;if(k-d>zc((2147483647-m)/r))throw RangeError("Overflow: input needs wider integers to process");m+=(k-d)*r;d=k;for(e=0;e<a.length;e++){n=a[e];if(n<d&&2147483647<++m)throw RangeError("Overflow: input needs wider integers to process");if(n==d){var x=
|
229
|
+
m;for(n=36;;n+=36){k=n<=l?1:n>=l+26?26:n-l;if(x<k)break;x-=k;var u=36-k;b.push(Af(jj(k+x%u)));x=zc(x/u)}b.push(Af(jj(x)));l=r;n=0;m=h==f?zc(m/700):m>>1;for(m+=zc(m/l);455<m;n+=36)m=zc(m/35);l=zc(n+36*m/(m+38));m=0;++h}}++m;++d}return b.join("")},zo=bb.set,Ao=bb.getterFor("Array Iterator");bj(Array,"Array",function(a,b){zo(this,{type:"Array Iterator",target:pc(sb(a)),index:0,kind:b})},function(){var a=Ao(this),b=a.target,c=a.kind,d=a.index++;return!b||d>=b.length?(a.target=void 0,{value:void 0,done:!0}):
|
230
|
+
"keys"==c?{value:d,done:!1}:"values"==c?{value:b[d],done:!1}:{value:[d,b[d]],done:!1}},"values");wc.Arguments=wc.Array;uc[tc].keys=!0;uc[tc].values=!0;uc[tc].entries=!0;var kj=function(a){var b=zf(a);if("function"!=typeof b)throw TypeError(String(a)+" is not iterable");return ib(b.call(a))},lj=Yd("fetch"),Bf=Yd("Headers"),Bo=jb("iterator"),mj=bb.set,Pa=bb.getterFor("URLSearchParams"),Co=bb.getterFor("URLSearchParamsIterator"),Do=/\+/g,nj=Array(4),Eo=function(a){return nj[a-1]||(nj[a-1]=RegExp("((?:%[\\da-f]{2}){"+
|
231
|
+
a+"})","gi"))},Fo=function(a){try{return decodeURIComponent(a)}catch(b){return a}},oj=function(a){a=a.replace(Do," ");var b=4;try{return decodeURIComponent(a)}catch(c){for(;b;)a=a.replace(Eo(b--),Fo);return a}},pj=/[!'()~]|%20/g,Go={"!":"%21","'":"%27","(":"%28",")":"%29","~":"%7E","%20":"+"},qj=function(a){return Go[a]},rj=function(a,b){if(b){b=b.split("&");for(var c=0,d;c<b.length;)d=b[c++],d.length&&(d=d.split("="),a.push({key:oj(d.shift()),value:oj(d.join("="))}))}},Ho=function(a){this.entries.length=
|
232
|
+
0;rj(this.entries,a)},Ac=function(a,b){if(a<b)throw TypeError("Not enough arguments");},Cf=$i(function(a,b){mj(this,{type:"URLSearchParamsIterator",iterator:kj(Pa(a).entries),kind:b})},"Iterator",function(){var a=Co(this),b=a.kind;a=a.iterator.next();var c=a.value;a.done||(a.value="keys"===b?c.key:"values"===b?c.value:[c.key,c.value]);return a}),$c=function(){cj(this,$c,"URLSearchParams");var a=0<arguments.length?arguments[0]:void 0,b=[],c,d,e;mj(this,{type:"URLSearchParams",entries:b,updateURL:function(){},
|
233
|
+
updateSearchParams:Ho});if(void 0!==a)if(ab(a)){var f=zf(a);if("function"===typeof f)for(a=f.call(a),f=a.next;!(c=f.call(a)).done;){c=kj(ib(c.value));var h=c.next;if((d=h.call(c)).done||(e=h.call(c)).done||!h.call(c).done)throw TypeError("Expected sequence with length 2");b.push({key:d.value+"",value:e.value+""})}else for(c in a)da(a,c)&&b.push({key:c,value:a[c]+""})}else rj(b,"string"===typeof a?"?"===a.charAt(0)?a.slice(1):a:a+"")},he=$c.prototype;(function(a,b,c){for(var d in b)tb(a,d,b[d],c);
|
234
|
+
return a})(he,{append:function(a,b){Ac(arguments.length,2);var c=Pa(this);c.entries.push({key:a+"",value:b+""});c.updateURL()},"delete":function(a){Ac(arguments.length,1);for(var b=Pa(this),c=b.entries,d=a+"",e=0;e<c.length;)c[e].key===d?c.splice(e,1):e++;b.updateURL()},get:function(a){Ac(arguments.length,1);for(var b=Pa(this).entries,c=a+"",d=0;d<b.length;d++)if(b[d].key===c)return b[d].value;return null},getAll:function(a){Ac(arguments.length,1);for(var b=Pa(this).entries,c=a+"",d=[],e=0;e<b.length;e++)b[e].key===
|
235
|
+
c&&d.push(b[e].value);return d},has:function(a){Ac(arguments.length,1);for(var b=Pa(this).entries,c=a+"",d=0;d<b.length;)if(b[d++].key===c)return!0;return!1},set:function(a,b){Ac(arguments.length,1);for(var c=Pa(this),d=c.entries,e=!1,f=a+"",h=b+"",m=0,l;m<d.length;m++)l=d[m],l.key===f&&(e?d.splice(m--,1):(e=!0,l.value=h));e||d.push({key:f,value:h});c.updateURL()},sort:function(){var a=Pa(this),b=a.entries,c=b.slice(),d,e;for(e=b.length=0;e<c.length;e++){var f=c[e];for(d=0;d<e;d++)if(b[d].key>f.key){b.splice(d,
|
236
|
+
0,f);break}d===e&&b.push(f)}a.updateURL()},forEach:function(a){for(var b=Pa(this).entries,c=fj(a,1<arguments.length?arguments[1]:void 0,3),d=0,e;d<b.length;)e=b[d++],c(e.value,e.key,this)},keys:function(){return new Cf(this,"keys")},values:function(){return new Cf(this,"values")},entries:function(){return new Cf(this,"entries")}},{enumerable:!0});tb(he,Bo,he.entries);tb(he,"toString",function(){for(var a=Pa(this).entries,b=[],c=0,d;c<a.length;)d=a[c++],b.push(encodeURIComponent(d.key).replace(pj,
|
237
|
+
qj)+"="+encodeURIComponent(d.value).replace(pj,qj));return b.join("&")},{enumerable:!0});ge($c,"URLSearchParams");sc({global:!0,forced:!xf},{URLSearchParams:$c});xf||"function"!=typeof lj||"function"!=typeof Bf||sc({global:!0,enumerable:!0,forced:!0},{fetch:function(a){var b=[a];if(1<arguments.length){var c=arguments[1];if(ab(c)){var d=c.body;if("URLSearchParams"===ij(d)){var e=c.headers?new Bf(c.headers):new Bf;e.has("content-type")||e.set("content-type","application/x-www-form-urlencoded;charset=UTF-8");
|
238
|
+
c=vf(c,{body:oc(0,String(d)),headers:oc(0,e)})}}b.push(c)}return lj.apply(this,b)}});var ad=la.URL,Io=$c,Jo=bb.set,ca=bb.getterFor("URL"),Ko=Math.floor,sj=Math.pow,tj=/[A-Za-z]/,Lo=/[\d+-.A-Za-z]/,Df=/\d/,Mo=/^(0x|0X)/,No=/^[0-7]+$/,Oo=/^\d+$/,uj=/^[\dA-Fa-f]+$/,Po=/[\u0000\u0009\u000A\u000D #%/:?@[\\]]/,Qo=/[\u0000\u0009\u000A\u000D #/:?@[\\]]/,Ro=/^[\u0000-\u001F ]+|[\u0000-\u001F ]+$/g,So=/[\u0009\u000A\u000D]/g,Ef=function(a,b){var c;if("["==b.charAt(0)){if("]"!=b.charAt(b.length-1))return"Invalid host";
|
239
|
+
var d=To(b.slice(1,-1));if(!d)return"Invalid host"}else if(ma(a)){d=[];b=b.toLowerCase().replace(xo,".").split(".");for(c=0;c<b.length;c++){var e=b[c];d.push(wo.test(e)?"xn--"+yo(e):e)}b=d.join(".");if(Po.test(b))return"Invalid host";d=Uo(b);if(null===d)return"Invalid host"}else{if(Qo.test(b))return"Invalid host";d="";b=yc(b);for(c=0;c<b.length;c++)d+=Fb(b[c],ie)}a.host=d},Uo=function(a){var b=a.split("."),c;b.length&&""==b[b.length-1]&&b.pop();var d=b.length;if(4<d)return a;var e=[];for(c=0;c<d;c++){var f=
|
240
|
+
b[c];if(""==f)return a;var h=10;1<f.length&&"0"==f.charAt(0)&&(h=Mo.test(f)?16:8,f=f.slice(8==h?1:2));if(""===f)f=0;else{if(!(10==h?Oo:8==h?No:uj).test(f))return a;f=parseInt(f,h)}e.push(f)}for(c=0;c<d;c++)if(f=e[c],c==d-1){if(f>=sj(256,5-d))return null}else if(255<f)return null;a=e.pop();for(c=0;c<e.length;c++)a+=e[c]*sj(256,3-c);return a},To=function(a){var b=[0,0,0,0,0,0,0,0],c=0,d=null,e=0,f,h;var m=function(){return a.charAt(e)};if(":"==m()){if(":"!=a.charAt(1))return;e+=2;c++;d=c}for(;m();){if(8==
|
241
|
+
c)return;if(":"==m()){if(null!==d)return;e++;c++;d=c}else{for(f=h=0;4>h&&uj.test(m());)f=16*f+parseInt(m(),16),e++,h++;if("."==m()){if(0==h)return;e-=h;if(6<c)return;for(f=0;m();){h=null;if(0<f)if("."==m()&&4>f)e++;else return;if(!Df.test(m()))return;for(;Df.test(m());){var l=parseInt(m(),10);if(null===h)h=l;else{if(0==h)return;h=10*h+l}if(255<h)return;e++}b[c]=256*b[c]+h;f++;2!=f&&4!=f||c++}if(4!=f)return;break}else if(":"==m()){if(e++,!m())return}else if(m())return;b[c++]=f}}if(null!==d)for(m=c-
|
242
|
+
d,c=7;0!=c&&0<m;)f=b[c],b[c--]=b[d+m-1],b[d+--m]=f;else if(8!=c)return;return b},bd=function(a){var b,c;if("number"==typeof a){var d=[];for(b=0;4>b;b++)d.unshift(a%256),a=Ko(a/256);return d.join(".")}if("object"==typeof a){d="";b=null;var e=1;for(var f=null,h=0,m=0;8>m;m++)0!==a[m]?(h>e&&(b=f,e=h),f=null,h=0):(null===f&&(f=m),++h);h>e&&(b=f);e=b;for(b=0;8>b;b++)c&&0===a[b]||(c&&(c=!1),e===b?(d+=b?":":"::",c=!0):(d+=a[b].toString(16),7>b&&(d+=":")));return"["+d+"]"}return a},ie={},vj=yf({},ie,{" ":1,
|
243
|
+
'"':1,"<":1,">":1,"`":1}),wj=yf({},vj,{"#":1,"?":1,"{":1,"}":1}),Ff=yf({},wj,{"/":1,":":1,";":1,"=":1,"@":1,"[":1,"\\":1,"]":1,"^":1,"|":1}),Fb=function(a,b){var c=eo(a,0);return 32<c&&127>c&&!da(b,a)?a:encodeURIComponent(a)},je={ftp:21,file:null,http:80,https:443,ws:80,wss:443},ma=function(a){return da(je,a.scheme)},Gf=function(a){return!a.host||a.cannotBeABaseURL||"file"==a.scheme},cd=function(a,b){var c;return 2==a.length&&tj.test(a.charAt(0))&&(":"==(c=a.charAt(1))||!b&&"|"==c)},xj=function(a){var b;
|
244
|
+
return 1<a.length&&cd(a.slice(0,2))&&(2==a.length||"/"===(b=a.charAt(2))||"\\"===b||"?"===b||"#"===b)},yj=function(a){var b=a.path,c=b.length;!c||"file"==a.scheme&&1==c&&cd(b[0],!0)||b.pop()},Hf={},zj={},If={},Aj={},Bj={},Jf={},Cj={},Dj={},ke={},le={},Kf={},Lf={},Mf={},Nf={},Ej={},Of={},dd={},kb={},Fj={},Xb={},ub={},lb=function(a,b,c,d){var e=c||Hf,f=0,h="",m=!1,l=!1,n=!1;c||(a.scheme="",a.username="",a.password="",a.host=null,a.port=null,a.path=[],a.query=null,a.fragment=null,a.cannotBeABaseURL=
|
245
|
+
!1,b=b.replace(Ro,""));b=b.replace(So,"");for(b=yc(b);f<=b.length;){var k=b[f];switch(e){case Hf:if(k&&tj.test(k))h+=k.toLowerCase(),e=zj;else{if(c)return"Invalid scheme";e=If;continue}break;case zj:if(k&&(Lo.test(k)||"+"==k||"-"==k||"."==k))h+=k.toLowerCase();else if(":"==k){if(c&&(ma(a)!=da(je,h)||"file"==h&&(""!=a.username||""!=a.password||null!==a.port)||"file"==a.scheme&&!a.host))return;a.scheme=h;if(c){ma(a)&&je[a.scheme]==a.port&&(a.port=null);return}h="";"file"==a.scheme?e=Nf:ma(a)&&d&&d.scheme==
|
246
|
+
a.scheme?e=Aj:ma(a)?e=Dj:"/"==b[f+1]?(e=Bj,f++):(a.cannotBeABaseURL=!0,a.path.push(""),e=Fj)}else{if(c)return"Invalid scheme";h="";e=If;f=0;continue}break;case If:if(!d||d.cannotBeABaseURL&&"#"!=k)return"Invalid scheme";if(d.cannotBeABaseURL&&"#"==k){a.scheme=d.scheme;a.path=d.path.slice();a.query=d.query;a.fragment="";a.cannotBeABaseURL=!0;e=ub;break}e="file"==d.scheme?Nf:Jf;continue;case Aj:if("/"==k&&"/"==b[f+1])e=ke,f++;else{e=Jf;continue}break;case Bj:if("/"==k){e=le;break}else{e=kb;continue}case Jf:a.scheme=
|
247
|
+
d.scheme;if(void 0==k)a.username=d.username,a.password=d.password,a.host=d.host,a.port=d.port,a.path=d.path.slice(),a.query=d.query;else if("/"==k||"\\"==k&&ma(a))e=Cj;else if("?"==k)a.username=d.username,a.password=d.password,a.host=d.host,a.port=d.port,a.path=d.path.slice(),a.query="",e=Xb;else if("#"==k)a.username=d.username,a.password=d.password,a.host=d.host,a.port=d.port,a.path=d.path.slice(),a.query=d.query,a.fragment="",e=ub;else{a.username=d.username;a.password=d.password;a.host=d.host;a.port=
|
248
|
+
d.port;a.path=d.path.slice();a.path.pop();e=kb;continue}break;case Cj:if(!ma(a)||"/"!=k&&"\\"!=k)if("/"==k)e=le;else{a.username=d.username;a.password=d.password;a.host=d.host;a.port=d.port;e=kb;continue}else e=ke;break;case Dj:e=ke;if("/"!=k||"/"!=h.charAt(f+1))continue;f++;break;case ke:if("/"!=k&&"\\"!=k){e=le;continue}break;case le:if("@"==k){m&&(h="%40"+h);m=!0;h=yc(h);for(k=0;k<h.length;k++){var r=h[k];":"!=r||n?(r=Fb(r,Ff),n?a.password+=r:a.username+=r):n=!0}h=""}else if(void 0==k||"/"==k||
|
249
|
+
"?"==k||"#"==k||"\\"==k&&ma(a)){if(m&&""==h)return"Invalid authority";f-=yc(h).length+1;h="";e=Kf}else h+=k;break;case Kf:case Lf:if(c&&"file"==a.scheme){e=Of;continue}else if(":"!=k||l)if(void 0==k||"/"==k||"?"==k||"#"==k||"\\"==k&&ma(a)){if(ma(a)&&""==h)return"Invalid host";if(c&&""==h&&(""!=a.username||""!=a.password||null!==a.port))return;if(e=Ef(a,h))return e;h="";e=dd;if(c)return;continue}else"["==k?l=!0:"]"==k&&(l=!1),h+=k;else{if(""==h)return"Invalid host";if(e=Ef(a,h))return e;h="";e=Mf;
|
250
|
+
if(c==Lf)return}break;case Mf:if(Df.test(k))h+=k;else if(void 0==k||"/"==k||"?"==k||"#"==k||"\\"==k&&ma(a)||c){if(""!=h){e=parseInt(h,10);if(65535<e)return"Invalid port";a.port=ma(a)&&e===je[a.scheme]?null:e;h=""}if(c)return;e=dd;continue}else return"Invalid port";break;case Nf:a.scheme="file";if("/"==k||"\\"==k)e=Ej;else if(d&&"file"==d.scheme)if(void 0==k)a.host=d.host,a.path=d.path.slice(),a.query=d.query;else if("?"==k)a.host=d.host,a.path=d.path.slice(),a.query="",e=Xb;else if("#"==k)a.host=
|
251
|
+
d.host,a.path=d.path.slice(),a.query=d.query,a.fragment="",e=ub;else{xj(b.slice(f).join(""))||(a.host=d.host,a.path=d.path.slice(),yj(a));e=kb;continue}else{e=kb;continue}break;case Ej:if("/"==k||"\\"==k){e=Of;break}d&&"file"==d.scheme&&!xj(b.slice(f).join(""))&&(cd(d.path[0],!0)?a.path.push(d.path[0]):a.host=d.host);e=kb;continue;case Of:if(void 0==k||"/"==k||"\\"==k||"?"==k||"#"==k){if(!c&&cd(h))e=kb;else{if(""==h){if(a.host="",c)return}else{if(e=Ef(a,h))return e;"localhost"==a.host&&(a.host="");
|
252
|
+
if(c)return;h=""}e=dd}continue}else h+=k;break;case dd:if(ma(a)){if(e=kb,"/"!=k&&"\\"!=k)continue}else if(!c&&"?"==k)a.query="",e=Xb;else if(!c&&"#"==k)a.fragment="",e=ub;else if(void 0!=k&&(e=kb,"/"!=k))continue;break;case kb:if(void 0==k||"/"==k||"\\"==k&&ma(a)||!c&&("?"==k||"#"==k)){r=h;r=r.toLowerCase();".."===r||"%2e."===r||".%2e"===r||"%2e%2e"===r?(yj(a),"/"==k||"\\"==k&&ma(a)||a.path.push("")):"."===h||"%2e"===h.toLowerCase()?"/"==k||"\\"==k&&ma(a)||a.path.push(""):("file"==a.scheme&&!a.path.length&&
|
253
|
+
cd(h)&&(a.host&&(a.host=""),h=h.charAt(0)+":"),a.path.push(h));h="";if("file"==a.scheme&&(void 0==k||"?"==k||"#"==k))for(;1<a.path.length&&""===a.path[0];)a.path.shift();"?"==k?(a.query="",e=Xb):"#"==k&&(a.fragment="",e=ub)}else h+=Fb(k,wj);break;case Fj:"?"==k?(a.query="",e=Xb):"#"==k?(a.fragment="",e=ub):void 0!=k&&(a.path[0]+=Fb(k,ie));break;case Xb:c||"#"!=k?void 0!=k&&("'"==k&&ma(a)?a.query+="%27":a.query="#"==k?a.query+"%23":a.query+Fb(k,ie)):(a.fragment="",e=ub);break;case ub:void 0!=k&&(a.fragment+=
|
254
|
+
Fb(k,vj))}f++}},Yb=function(a){var b=cj(this,Yb,"URL"),c=1<arguments.length?arguments[1]:void 0,d=String(a),e=Jo(b,{type:"URL"});if(void 0!==c)if(c instanceof Yb)var f=ca(c);else if(c=lb(f={},String(c)))throw TypeError(c);if(c=lb(e,d,null,f))throw TypeError(c);var h=e.searchParams=new Io;d=Pa(h);d.updateSearchParams(e.query);d.updateURL=function(){e.query=String(h)||null};$a||(b.href=me.call(b),b.origin=Gj.call(b),b.protocol=Hj.call(b),b.username=Ij.call(b),b.password=Jj.call(b),b.host=Kj.call(b),
|
255
|
+
b.hostname=Lj.call(b),b.port=Mj.call(b),b.pathname=Nj.call(b),b.search=Oj.call(b),b.searchParams=Pj.call(b),b.hash=Qj.call(b))},Pf=Yb.prototype,me=function(){var a=ca(this),b=a.scheme,c=a.username,d=a.password,e=a.host,f=a.port,h=a.path,m=a.query,l=a.fragment,n=b+":";if(null!==e){n+="//";if(""!=a.username||""!=a.password)n+=c+(d?":"+d:"")+"@";n+=bd(e);null!==f&&(n+=":"+f)}else"file"==b&&(n+="//");n+=a.cannotBeABaseURL?h[0]:h.length?"/"+h.join("/"):"";null!==m&&(n+="?"+m);null!==l&&(n+="#"+l);return n},
|
256
|
+
Gj=function(){var a=ca(this),b=a.scheme,c=a.port;if("blob"==b)try{return(new URL(b.path[0])).origin}catch(d){return"null"}return"file"!=b&&ma(a)?b+"://"+bd(a.host)+(null!==c?":"+c:""):"null"},Hj=function(){return ca(this).scheme+":"},Ij=function(){return ca(this).username},Jj=function(){return ca(this).password},Kj=function(){var a=ca(this),b=a.host;a=a.port;return null===b?"":null===a?bd(b):bd(b)+":"+a},Lj=function(){var a=ca(this).host;return null===a?"":bd(a)},Mj=function(){var a=ca(this).port;
|
257
|
+
return null===a?"":String(a)},Nj=function(){var a=ca(this),b=a.path;return a.cannotBeABaseURL?b[0]:b.length?"/"+b.join("/"):""},Oj=function(){var a=ca(this).query;return a?"?"+a:""},Pj=function(){return ca(this).searchParams},Qj=function(){var a=ca(this).fragment;return a?"#"+a:""},Va=function(a,b){return{get:a,set:b,configurable:!0,enumerable:!0}};$a&&Pi(Pf,{href:Va(me,function(a){var b=ca(this);if(a=lb(b,String(a)))throw TypeError(a);Pa(b.searchParams).updateSearchParams(b.query)}),origin:Va(Gj),
|
258
|
+
protocol:Va(Hj,function(a){var b=ca(this);lb(b,String(a)+":",Hf)}),username:Va(Ij,function(a){var b=ca(this);a=yc(String(a));if(!Gf(b)){b.username="";for(var c=0;c<a.length;c++)b.username+=Fb(a[c],Ff)}}),password:Va(Jj,function(a){var b=ca(this);a=yc(String(a));if(!Gf(b)){b.password="";for(var c=0;c<a.length;c++)b.password+=Fb(a[c],Ff)}}),host:Va(Kj,function(a){var b=ca(this);b.cannotBeABaseURL||lb(b,String(a),Kf)}),hostname:Va(Lj,function(a){var b=ca(this);b.cannotBeABaseURL||lb(b,String(a),Lf)}),
|
259
|
+
port:Va(Mj,function(a){var b=ca(this);Gf(b)||(a=String(a),""==a?b.port=null:lb(b,a,Mf))}),pathname:Va(Nj,function(a){var b=ca(this);b.cannotBeABaseURL||(b.path=[],lb(b,a+"",dd))}),search:Va(Oj,function(a){var b=ca(this);a=String(a);""==a?b.query=null:("?"==a.charAt(0)&&(a=a.slice(1)),b.query="",lb(b,a,Xb));Pa(b.searchParams).updateSearchParams(b.query)}),searchParams:Va(Pj),hash:Va(Qj,function(a){var b=ca(this);a=String(a);""==a?b.fragment=null:("#"==a.charAt(0)&&(a=a.slice(1)),b.fragment="",lb(b,
|
260
|
+
a,ub))})});tb(Pf,"toJSON",function(){return me.call(this)},{enumerable:!0});tb(Pf,"toString",function(){return me.call(this)},{enumerable:!0});if(ad){var Rj=ad.createObjectURL,Sj=ad.revokeObjectURL;Rj&&tb(Yb,"createObjectURL",function(a){return Rj.apply(ad,arguments)});Sj&&tb(Yb,"revokeObjectURL",function(a){return Sj.apply(ad,arguments)})}ge(Yb,"URL");sc({global:!0,forced:!xf,sham:!$a},{URL:Yb});var Tj=function(a){return function(b,c,d,e){ej(c);b=Object(sb(b));var f=pc(b),h=sf(b.length),m=a?h-1:
|
261
|
+
0,l=a?-1:1;if(2>d)for(;;){if(m in f){e=f[m];m+=l;break}m+=l;if(a?0>m:h<=m)throw TypeError("Reduce of empty array with no initial value");}for(;a?0<=m:h>m;m+=l)m in f&&(e=c(e,f[m],m,b));return e}},Vo={left:Tj(!1),right:Tj(!0)}.left,Wo=function(a,b){var c=[][a];return!!c&&hb(function(){c.call(null,b||function(){throw 1;},1)})}("reduce"),Xo=Si("reduce",{1:0});sc({target:"Array",proto:!0,forced:!Wo||!Xo},{reduce:function(a){return Vo(this,a,arguments.length,1<arguments.length?arguments[1]:void 0)}});
|
262
|
+
for(var Uj=function(){for(var a=document.getElementsByTagName("link"),b=0,c;c=a[b];b++)if("canonical"===c.getAttribute("rel"))return c.getAttribute("href")},Yk=function(a){return encodeURIComponent(a).replace(/[!'()*]/g,function(a){return"%"+a.charCodeAt(0).toString(16).toUpperCase()})},Vj=Object.getOwnPropertySymbols,Yo=Object.prototype.hasOwnProperty,Zo=Object.prototype.propertyIsEnumerable,Dg=function(){try{if(!Object.assign)return!1;var a=new String("abc");a[5]="de";if("5"===Object.getOwnPropertyNames(a)[0])return!1;
|
263
|
+
var b={};for(a=0;10>a;a++)b["_"+String.fromCharCode(a)]=a;if("0123456789"!==Object.getOwnPropertyNames(b).map(function(a){return b[a]}).join(""))return!1;var c={};"abcdefghijklmnopqrst".split("").forEach(function(a){c[a]=a});return"abcdefghijklmnopqrst"!==Object.keys(Object.assign({},c)).join("")?!1:!0}catch(d){return!1}}()?Object.assign:function(a,b){if(null===a||void 0===a)throw new TypeError("Object.assign cannot be called with null or undefined");var c=Object(a);for(var d,e=1;e<arguments.length;e++){var f=
|
264
|
+
Object(arguments[e]);for(var h in f)Yo.call(f,h)&&(c[h]=f[h]);if(Vj){d=Vj(f);for(var m=0;m<d.length;m++)Zo.call(f,d[m])&&(c[d[m]]=f[d[m]])}}return c},Wj=/%[a-f0-9]{2}/gi,Xj=/(%[a-f0-9]{2})+/gi,Eg=function(a){if("string"!==typeof a)throw new TypeError("Expected `encodedURI` to be of type `string`, got `"+typeof a+"`");try{return a=a.replace(/\+/g," "),decodeURIComponent(a)}catch(h){for(var b={"%FE%FF":"\ufffd\ufffd","%FF%FE":"\ufffd\ufffd"},c=Xj.exec(a);c;){try{b[c[0]]=decodeURIComponent(c[0])}catch(m){var d=
|
265
|
+
c[0];try{var e=decodeURIComponent(d)}catch(l){e=d.match(Wj);for(var f=1;f<e.length;f++)d=Ae(e,f).join(""),e=d.match(Wj);e=d}e!==c[0]&&(b[c[0]]=e)}c=Xj.exec(a)}b["%C2"]="\ufffd";c=Object.keys(b);for(d=0;d<c.length;d++)e=c[d],a=a.replace(new RegExp(e,"g"),b[e]);return a}},$o={extract:Bg,parse:Cg,stringify:function(a,b){b=Dg({encode:!0,strict:!0,arrayFormat:"none"},b);!1===b.sort&&(b.sort=function(){});var c=Wk(b);return a?Object.keys(a).sort(b.sort).map(function(d){var e=a[d];if(void 0===e)return"";
|
266
|
+
if(null===e)return Ma(d,b);if(Array.isArray(e)){var f=[];e.slice().forEach(function(a){void 0!==a&&f.push(c(d,a,f.length))});return f.join("&")}return Ma(d,b)+"="+Ma(e,b)}).filter(function(a){return 0<a.length}).join("&"):""},parseUrl:function(a,b){return{url:a.split("?")[0]||"",query:Cg(Bg(a),b)}}},Yj=C(function(a,b){(function(c,d){var e={extend:function(a,b){var c={},d;for(d in a)c[d]=b[d]&&0===b[d].length%2?b[d].concat(a[d]):a[d];return c},has:function(a,b){return"string"===typeof a?-1!==b.toLowerCase().indexOf(a.toLowerCase()):
|
267
|
+
!1},lowerize:function(a){return a.toLowerCase()},major:function(a){return"string"===typeof a?a.replace(/[^\d\.]/g,"").split(".")[0]:d},trim:function(a){return a.replace(/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,"")}},f=function(a,b){for(var c=0,e,f,h,l,m,u;c<b.length&&!m;){var n=b[c],k=b[c+1];for(e=f=0;e<n.length&&!m;)if(m=n[e++].exec(a))for(h=0;h<k.length;h++)u=m[++f],l=k[h],"object"===typeof l&&0<l.length?2==l.length?this[l[0]]="function"==typeof l[1]?l[1].call(this,u):l[1]:3==l.length?this[l[0]]="function"!==
|
268
|
+
typeof l[1]||l[1].exec&&l[1].test?u?u.replace(l[1],l[2]):d:u?l[1].call(this,u,l[2]):d:4==l.length&&(this[l[0]]=u?l[3].call(this,u.replace(l[1],l[2])):d):this[l]=u?u:d;c+=2}},h=function(a,b){for(var c in b)if("object"===typeof b[c]&&0<b[c].length)for(var f=0;f<b[c].length;f++){if(e.has(b[c][f],a))return"?"===c?d:c}else if(e.has(b[c],a))return"?"===c?d:c;return a},m={ME:"4.90","NT 3.11":"NT3.51","NT 4.0":"NT4.0",2E3:"NT 5.0",XP:["NT 5.1","NT 5.2"],Vista:"NT 6.0",7:"NT 6.1",8:"NT 6.2","8.1":"NT 6.3",
|
269
|
+
10:["NT 6.4","NT 10.0"],RT:"ARM"},l={browser:[[/(opera\smini)\/([\w\.-]+)/i,/(opera\s[mobiletab]+).+version\/([\w\.-]+)/i,/(opera).+version\/([\w\.]+)/i,/(opera)[\/\s]+([\w\.]+)/i],["name","version"],[/(opios)[\/\s]+([\w\.]+)/i],[["name","Opera Mini"],"version"],[/\s(opr)\/([\w\.]+)/i],[["name","Opera"],"version"],[/(kindle)\/([\w\.]+)/i,/(lunascape|maxthon|netfront|jasmine|blazer)[\/\s]?([\w\.]*)/i,/(avant\s|iemobile|slim)(?:browser)?[\/\s]?([\w\.]*)/i,/(bidubrowser|baidubrowser)[\/\s]?([\w\.]+)/i,
|
270
|
+
/(?:ms|\()(ie)\s([\w\.]+)/i,/(rekonq)\/([\w\.]*)/i,/(chromium|flock|rockmelt|midori|epiphany|silk|skyfire|ovibrowser|bolt|iron|vivaldi|iridium|phantomjs|bowser|quark|qupzilla|falkon)\/([\w\.-]+)/i],["name","version"],[/(konqueror)\/([\w\.]+)/i],[["name","Konqueror"],"version"],[/(trident).+rv[:\s]([\w\.]+).+like\sgecko/i],[["name","IE"],"version"],[/(edge|edgios|edga|edg)\/((\d+)?[\w\.]+)/i],[["name","Edge"],"version"],[/(yabrowser)\/([\w\.]+)/i],[["name","Yandex"],"version"],[/(Avast)\/([\w\.]+)/i],
|
271
|
+
[["name","Avast Secure Browser"],"version"],[/(AVG)\/([\w\.]+)/i],[["name","AVG Secure Browser"],"version"],[/(puffin)\/([\w\.]+)/i],[["name","Puffin"],"version"],[/(focus)\/([\w\.]+)/i],[["name","Firefox Focus"],"version"],[/(opt)\/([\w\.]+)/i],[["name","Opera Touch"],"version"],[/((?:[\s\/])uc?\s?browser|(?:juc.+)ucweb)[\/\s]?([\w\.]+)/i],[["name","UCBrowser"],"version"],[/(comodo_dragon)\/([\w\.]+)/i],[["name",/_/g," "],"version"],[/(windowswechat qbcore)\/([\w\.]+)/i],[["name","WeChat(Win) Desktop"],
|
272
|
+
"version"],[/(micromessenger)\/([\w\.]+)/i],[["name","WeChat"],"version"],[/(brave)\/([\w\.]+)/i],[["name","Brave"],"version"],[/(qqbrowserlite)\/([\w\.]+)/i],["name","version"],[/(QQ)\/([\d\.]+)/i],["name","version"],[/m?(qqbrowser)[\/\s]?([\w\.]+)/i],["name","version"],[/(baiduboxapp)[\/\s]?([\w\.]+)/i],["name","version"],[/(2345Explorer)[\/\s]?([\w\.]+)/i],["name","version"],[/(MetaSr)[\/\s]?([\w\.]+)/i],["name"],[/(LBBROWSER)/i],["name"],[/xiaomi\/miuibrowser\/([\w\.]+)/i],["version",["name",
|
273
|
+
"MIUI Browser"]],[/;fbav\/([\w\.]+);/i],["version",["name","Facebook"]],[/safari\s(line)\/([\w\.]+)/i,/android.+(line)\/([\w\.]+)\/iab/i],["name","version"],[/headlesschrome(?:\/([\w\.]+)|\s)/i],["version",["name","Chrome Headless"]],[/\swv\).+(chrome)\/([\w\.]+)/i],[["name",/(.+)/,"$1 WebView"],"version"],[/((?:oculus|samsung)browser)\/([\w\.]+)/i],[["name",/(.+(?:g|us))(.+)/,"$1 $2"],"version"],[/android.+version\/([\w\.]+)\s+(?:mobile\s?safari|safari)*/i],["version",["name","Android Browser"]],
|
274
|
+
[/(sailfishbrowser)\/([\w\.]+)/i],[["name","Sailfish Browser"],"version"],[/(chrome|omniweb|arora|[tizenoka]{5}\s?browser)\/v?([\w\.]+)/i],["name","version"],[/(dolfin)\/([\w\.]+)/i],[["name","Dolphin"],"version"],[/(qihu|qhbrowser|qihoobrowser|360browser)/i],[["name","360 Browser"]],[/((?:android.+)crmo|crios)\/([\w\.]+)/i],[["name","Chrome"],"version"],[/(coast)\/([\w\.]+)/i],[["name","Opera Coast"],"version"],[/fxios\/([\w\.-]+)/i],["version",["name","Firefox"]],[/version\/([\w\.]+).+?mobile\/\w+\s(safari)/i],
|
275
|
+
["version",["name","Mobile Safari"]],[/version\/([\w\.]+).+?(mobile\s?safari|safari)/i],["version","name"],[/webkit.+?(gsa)\/([\w\.]+).+?(mobile\s?safari|safari)(\/[\w\.]+)/i],[["name","GSA"],"version"],[/webkit.+?(mobile\s?safari|safari)(\/[\w\.]+)/i],["name",["version",h,{"1.0":"/8","1.2":"/1","1.3":"/3","2.0":"/412","2.0.2":"/416","2.0.3":"/417","2.0.4":"/419","?":"/"}]],[/(webkit|khtml)\/([\w\.]+)/i],["name","version"],[/(navigator|netscape)\/([\w\.-]+)/i],[["name","Netscape"],"version"],[/(swiftfox)/i,
|
276
|
+
/(icedragon|iceweasel|camino|chimera|fennec|maemo\sbrowser|minimo|conkeror)[\/\s]?([\w\.\+]+)/i,/(firefox|seamonkey|k-meleon|icecat|iceape|firebird|phoenix|palemoon|basilisk|waterfox)\/([\w\.-]+)$/i,/(mozilla)\/([\w\.]+).+rv:.+gecko\/\d+/i,/(polaris|lynx|dillo|icab|doris|amaya|w3m|netsurf|sleipnir)[\/\s]?([\w\.]+)/i,/(links)\s\(([\w\.]+)/i,/(gobrowser)\/?([\w\.]*)/i,/(ice\s?browser)\/v?([\w\._]+)/i,/(mosaic)[\/\s]([\w\.]+)/i],["name","version"]],cpu:[[/(?:(amd|x(?:(?:86|64)[_-])?|wow|win)64)[;\)]/i],
|
277
|
+
[["architecture","amd64"]],[/(ia32(?=;))/i],[["architecture",e.lowerize]],[/((?:i[346]|x)86)[;\)]/i],[["architecture","ia32"]],[/windows\s(ce|mobile);\sppc;/i],[["architecture","arm"]],[/((?:ppc|powerpc)(?:64)?)(?:\smac|;|\))/i],[["architecture",/ower/,"",e.lowerize]],[/(sun4\w)[;\)]/i],[["architecture","sparc"]],[/((?:avr32|ia64(?=;))|68k(?=\))|arm(?:64|(?=v\d+[;l]))|(?=atmel\s)avr|(?:irix|mips|sparc)(?:64)?(?=;)|pa-risc)/i],[["architecture",e.lowerize]]],device:[[/\((ipad|playbook);[\w\s\),;-]+(rim|apple)/i],
|
278
|
+
["model","vendor",["type","tablet"]],[/applecoremedia\/[\w\.]+ \((ipad)/],["model",["vendor","Apple"],["type","tablet"]],[/(apple\s{0,1}tv)/i],[["model","Apple TV"],["vendor","Apple"],["type","smarttv"]],[/(archos)\s(gamepad2?)/i,/(hp).+(touchpad)/i,/(hp).+(tablet)/i,/(kindle)\/([\w\.]+)/i,/\s(nook)[\w\s]+build\/(\w+)/i,/(dell)\s(strea[kpr\s\d]*[\dko])/i],["vendor","model",["type","tablet"]],[/(kf[A-z]+)\sbuild\/.+silk\//i],["model",["vendor","Amazon"],["type","tablet"]],[/(sd|kf)[0349hijorstuw]+\sbuild\/.+silk\//i],
|
279
|
+
[["model",h,{"Fire Phone":["SD","KF"]}],["vendor","Amazon"],["type","mobile"]],[/android.+aft([bms])\sbuild/i],["model",["vendor","Amazon"],["type","smarttv"]],[/\((ip[honed|\s\w*]+);.+(apple)/i],["model","vendor",["type","mobile"]],[/\((ip[honed|\s\w*]+);/i],["model",["vendor","Apple"],["type","mobile"]],[/(blackberry)[\s-]?(\w+)/i,/(blackberry|benq|palm(?=\-)|sonyericsson|acer|asus|dell|meizu|motorola|polytron)[\s_-]?([\w-]*)/i,/(hp)\s([\w\s]+\w)/i,/(asus)-?(\w+)/i],["vendor","model",["type","mobile"]],
|
280
|
+
[/\(bb10;\s(\w+)/i],["model",["vendor","BlackBerry"],["type","mobile"]],[/android.+(transfo[prime\s]{4,10}\s\w+|eeepc|slider\s\w+|nexus 7|padfone|p00c)/i],["model",["vendor","Asus"],["type","tablet"]],[/(sony)\s(tablet\s[ps])\sbuild\//i,/(sony)?(?:sgp.+)\sbuild\//i],[["vendor","Sony"],["model","Xperia Tablet"],["type","tablet"]],[/android.+\s([c-g]\d{4}|so[-l]\w+)(?=\sbuild\/|\).+chrome\/(?![1-6]{0,1}\d\.))/i],["model",["vendor","Sony"],["type","mobile"]],[/\s(ouya)\s/i,/(nintendo)\s([wids3u]+)/i],
|
281
|
+
["vendor","model",["type","console"]],[/android.+;\s(shield)\sbuild/i],["model",["vendor","Nvidia"],["type","console"]],[/(playstation\s[34portablevi]+)/i],["model",["vendor","Sony"],["type","console"]],[/(sprint\s(\w+))/i],[["vendor",h,{HTC:"APA",Sprint:"Sprint"}],["model",h,{"Evo Shift 4G":"7373KT"}],["type","mobile"]],[/(htc)[;_\s-]+([\w\s]+(?=\)|\sbuild)|\w+)/i,/(zte)-(\w*)/i,/(alcatel|geeksphone|nexian|panasonic|(?=;\s)sony)[_\s-]?([\w-]*)/i],["vendor",["model",/_/g," "],["type","mobile"]],[/(nexus\s9)/i],
|
282
|
+
["model",["vendor","HTC"],["type","tablet"]],[/d\/huawei([\w\s-]+)[;\)]/i,/(nexus\s6p|vog-l29|ane-lx1|eml-l29)/i],["model",["vendor","Huawei"],["type","mobile"]],[/android.+(bah2?-a?[lw]\d{2})/i],["model",["vendor","Huawei"],["type","tablet"]],[/(microsoft);\s(lumia[\s\w]+)/i],["vendor","model",["type","mobile"]],[/[\s\(;](xbox(?:\sone)?)[\s\);]/i],["model",["vendor","Microsoft"],["type","console"]],[/(kin\.[onetw]{3})/i],[["model",/\./g," "],["vendor","Microsoft"],["type","mobile"]],[/\s(milestone|droid(?:[2-4x]|\s(?:bionic|x2|pro|razr))?:?(\s4g)?)[\w\s]+build\//i,
|
283
|
+
/mot[\s-]?(\w*)/i,/(XT\d{3,4}) build\//i,/(nexus\s6)/i],["model",["vendor","Motorola"],["type","mobile"]],[/android.+\s(mz60\d|xoom[\s2]{0,2})\sbuild\//i],["model",["vendor","Motorola"],["type","tablet"]],[/hbbtv\/\d+\.\d+\.\d+\s+\([\w\s]*;\s*(\w[^;]*);([^;]*)/i],[["vendor",e.trim],["model",e.trim],["type","smarttv"]],[/hbbtv.+maple;(\d+)/i],[["model",/^/,"SmartTV"],["vendor","Samsung"],["type","smarttv"]],[/\(dtv[\);].+(aquos)/i],["model",["vendor","Sharp"],["type","smarttv"]],[/android.+((sch-i[89]0\d|shw-m380s|gt-p\d{4}|gt-n\d+|sgh-t8[56]9|nexus 10))/i,
|
284
|
+
/((SM-T\w+))/i],[["vendor","Samsung"],"model",["type","tablet"]],[/smart-tv.+(samsung)/i],["vendor",["type","smarttv"],"model"],[/((s[cgp]h-\w+|gt-\w+|galaxy\snexus|sm-\w[\w\d]+))/i,/(sam[sung]*)[\s-]*(\w+-?[\w-]*)/i,/sec-((sgh\w+))/i],[["vendor","Samsung"],"model",["type","mobile"]],[/sie-(\w*)/i],["model",["vendor","Siemens"],["type","mobile"]],[/(maemo|nokia).*(n900|lumia\s\d+)/i,/(nokia)[\s_-]?([\w-]*)/i],[["vendor","Nokia"],"model",["type","mobile"]],[/android[x\d\.\s;]+\s([ab][1-7]\-?[0178a]\d\d?)/i],
|
285
|
+
["model",["vendor","Acer"],["type","tablet"]],[/android.+([vl]k\-?\d{3})\s+build/i],["model",["vendor","LG"],["type","tablet"]],[/android\s3\.[\s\w;-]{10}(lg?)-([06cv9]{3,4})/i],[["vendor","LG"],"model",["type","tablet"]],[/(lg) netcast\.tv/i],["vendor","model",["type","smarttv"]],[/(nexus\s[45])/i,/lg[e;\s\/-]+(\w*)/i,/android.+lg(\-?[\d\w]+)\s+build/i],["model",["vendor","LG"],["type","mobile"]],[/(lenovo)\s?(s(?:5000|6000)(?:[\w-]+)|tab(?:[\s\w]+))/i],["vendor","model",["type","tablet"]],[/android.+(ideatab[a-z0-9\-\s]+)/i],
|
286
|
+
["model",["vendor","Lenovo"],["type","tablet"]],[/(lenovo)[_\s-]?([\w-]+)/i],["vendor","model",["type","mobile"]],[/linux;.+((jolla));/i],["vendor","model",["type","mobile"]],[/((pebble))app\/[\d\.]+\s/i],["vendor","model",["type","wearable"]],[/android.+;\s(oppo)\s?([\w\s]+)\sbuild/i],["vendor","model",["type","mobile"]],[/crkey/i],[["model","Chromecast"],["vendor","Google"],["type","smarttv"]],[/android.+;\s(glass)\s\d/i],["model",["vendor","Google"],["type","wearable"]],[/android.+;\s(pixel c)[\s)]/i],
|
287
|
+
["model",["vendor","Google"],["type","tablet"]],[/android.+;\s(pixel( [23])?( xl)?)[\s)]/i],["model",["vendor","Google"],["type","mobile"]],[/android.+;\s(\w+)\s+build\/hm\1/i,/android.+(hm[\s\-_]*note?[\s_]*(?:\d\w)?)\s+build/i,/android.+(mi[\s\-_]*(?:a\d|one|one[\s_]plus|note lte)?[\s_]*(?:\d?\w?)[\s_]*(?:plus)?)\s+build/i,/android.+(redmi[\s\-_]*(?:note)?(?:[\s_]*[\w\s]+))\s+build/i],[["model",/_/g," "],["vendor","Xiaomi"],["type","mobile"]],[/android.+(mi[\s\-_]*(?:pad)(?:[\s_]*[\w\s]+))\s+build/i],
|
288
|
+
[["model",/_/g," "],["vendor","Xiaomi"],["type","tablet"]],[/android.+;\s(m[1-5]\snote)\sbuild/i],["model",["vendor","Meizu"],["type","mobile"]],[/(mz)-([\w-]{2,})/i],[["vendor","Meizu"],"model",["type","mobile"]],[/android.+a000(1)\s+build/i,/android.+oneplus\s(a\d{4})[\s)]/i],["model",["vendor","OnePlus"],["type","mobile"]],[/android.+[;\/]\s*(RCT[\d\w]+)\s+build/i],["model",["vendor","RCA"],["type","tablet"]],[/android.+[;\/\s]+(Venue[\d\s]{2,7})\s+build/i],["model",["vendor","Dell"],["type","tablet"]],
|
289
|
+
[/android.+[;\/]\s*(Q[T|M][\d\w]+)\s+build/i],["model",["vendor","Verizon"],["type","tablet"]],[/android.+[;\/]\s+(Barnes[&\s]+Noble\s+|BN[RT])(V?.*)\s+build/i],[["vendor","Barnes & Noble"],"model",["type","tablet"]],[/android.+[;\/]\s+(TM\d{3}.*\b)\s+build/i],["model",["vendor","NuVision"],["type","tablet"]],[/android.+;\s(k88)\sbuild/i],["model",["vendor","ZTE"],["type","tablet"]],[/android.+[;\/]\s*(gen\d{3})\s+build.*49h/i],["model",["vendor","Swiss"],["type","mobile"]],[/android.+[;\/]\s*(zur\d{3})\s+build/i],
|
290
|
+
["model",["vendor","Swiss"],["type","tablet"]],[/android.+[;\/]\s*((Zeki)?TB.*\b)\s+build/i],["model",["vendor","Zeki"],["type","tablet"]],[/(android).+[;\/]\s+([YR]\d{2})\s+build/i,/android.+[;\/]\s+(Dragon[\-\s]+Touch\s+|DT)(\w{5})\sbuild/i],[["vendor","Dragon Touch"],"model",["type","tablet"]],[/android.+[;\/]\s*(NS-?\w{0,9})\sbuild/i],["model",["vendor","Insignia"],["type","tablet"]],[/android.+[;\/]\s*((NX|Next)-?\w{0,9})\s+build/i],["model",["vendor","NextBook"],["type","tablet"]],[/android.+[;\/]\s*(Xtreme_)?(V(1[045]|2[015]|30|40|60|7[05]|90))\s+build/i],
|
291
|
+
[["vendor","Voice"],"model",["type","mobile"]],[/android.+[;\/]\s*(LVTEL\-)?(V1[12])\s+build/i],[["vendor","LvTel"],"model",["type","mobile"]],[/android.+;\s(PH-1)\s/i],["model",["vendor","Essential"],["type","mobile"]],[/android.+[;\/]\s*(V(100MD|700NA|7011|917G).*\b)\s+build/i],["model",["vendor","Envizen"],["type","tablet"]],[/android.+[;\/]\s*(Le[\s\-]+Pan)[\s\-]+(\w{1,9})\s+build/i],["vendor","model",["type","tablet"]],[/android.+[;\/]\s*(Trio[\s\-]*.*)\s+build/i],["model",["vendor","MachSpeed"],
|
292
|
+
["type","tablet"]],[/android.+[;\/]\s*(Trinity)[\-\s]*(T\d{3})\s+build/i],["vendor","model",["type","tablet"]],[/android.+[;\/]\s*TU_(1491)\s+build/i],["model",["vendor","Rotor"],["type","tablet"]],[/android.+(KS(.+))\s+build/i],["model",["vendor","Amazon"],["type","tablet"]],[/android.+(Gigaset)[\s\-]+(Q\w{1,9})\s+build/i],["vendor","model",["type","tablet"]],[/\s(tablet|tab)[;\/]/i,/\s(mobile)(?:[;\/]|\ssafari)/i],[["type",e.lowerize],"vendor","model"],[/[\s\/\(](smart-?tv)[;\)]/i],[["type","smarttv"]],
|
293
|
+
[/(android[\w\.\s\-]{0,9});.+build/i],["model",["vendor","Generic"]]],engine:[[/windows.+\sedge\/([\w\.]+)/i],["version",["name","EdgeHTML"]],[/webkit\/537\.36.+chrome\/(?!27)([\w\.]+)/i],["version",["name","Blink"]],[/(presto)\/([\w\.]+)/i,/(webkit|trident|netfront|netsurf|amaya|lynx|w3m|goanna)\/([\w\.]+)/i,/(khtml|tasman|links)[\/\s]\(?([\w\.]+)/i,/(icab)[\/\s]([23]\.[\d\.]+)/i],["name","version"],[/rv:([\w\.]{1,9}).+(gecko)/i],["version","name"]],os:[[/microsoft\s(windows)\s(vista|xp)/i],["name",
|
294
|
+
"version"],[/(windows)\snt\s6\.2;\s(arm)/i,/(windows\sphone(?:\sos)*)[\s\/]?([\d\.\s\w]*)/i,/(windows\smobile|windows)[\s\/]?([ntce\d\.\s]+\w)/i],["name",["version",h,m]],[/(win(?=3|9|n)|win\s9x\s)([nt\d\.]+)/i],[["name","Windows"],["version",h,m]],[/\((bb)(10);/i],[["name","BlackBerry"],"version"],[/(blackberry)\w*\/?([\w\.]*)/i,/(tizen|kaios)[\/\s]([\w\.]+)/i,/(android|webos|palm\sos|qnx|bada|rim\stablet\sos|meego|sailfish|contiki)[\/\s-]?([\w\.]*)/i],["name","version"],[/(symbian\s?os|symbos|s60(?=;))[\/\s-]?([\w\.]*)/i],
|
295
|
+
[["name","Symbian"],"version"],[/\((series40);/i],["name"],[/mozilla.+\(mobile;.+gecko.+firefox/i],[["name","Firefox OS"],"version"],[/(nintendo|playstation)\s([wids34portablevu]+)/i,/(mint)[\/\s\(]?(\w*)/i,/(mageia|vectorlinux)[;\s]/i,/(joli|[kxln]?ubuntu|debian|suse|opensuse|gentoo|(?=\s)arch|slackware|fedora|mandriva|centos|pclinuxos|redhat|zenwalk|linpus)[\/\s-]?(?!chrom)([\w\.-]*)/i,/(hurd|linux)\s?([\w\.]*)/i,/(gnu)\s?([\w\.]*)/i],["name","version"],[/(cros)\s[\w]+\s([\w\.]+\w)/i],[["name",
|
296
|
+
"Chromium OS"],"version"],[/(sunos)\s?([\w\.\d]*)/i],[["name","Solaris"],"version"],[/\s([frentopc-]{0,4}bsd|dragonfly)\s?([\w\.]*)/i],["name","version"],[/(haiku)\s(\w+)/i],["name","version"],[/cfnetwork\/.+darwin/i,/ip[honead]{2,4}(?:.*os\s([\w]+)\slike\smac|;\sopera)/i],[["version",/_/g,"."],["name","iOS"]],[/(mac\sos\sx)\s?([\w\s\.]*)/i,/(macintosh|mac(?=_powerpc)\s)/i],[["name","Mac OS"],["version",/_/g,"."]],[/((?:open)?solaris)[\/\s-]?([\w\.]*)/i,/(aix)\s((\d)(?=\.|\)|\s)[\w\.])*/i,/(plan\s9|minix|beos|os\/2|amigaos|morphos|risc\sos|openvms|fuchsia)/i,
|
297
|
+
/(unix)\s?([\w\.]*)/i],["name","version"]]},n=function(a,b){"object"===typeof a&&(b=a,a=d);if(!(this instanceof n))return(new n(a,b)).getResult();var h=a||(c&&c.navigator&&c.navigator.userAgent?c.navigator.userAgent:""),m=b?e.extend(l,b):l;this.getBrowser=function(){var a={name:d,version:d};f.call(a,h,m.browser);a.major=e.major(a.version);return a};this.getCPU=function(){var a={architecture:d};f.call(a,h,m.cpu);return a};this.getDevice=function(){var a={vendor:d,model:d,type:d};f.call(a,h,m.device);
|
298
|
+
return a};this.getEngine=function(){var a={name:d,version:d};f.call(a,h,m.engine);return a};this.getOS=function(){var a={name:d,version:d};f.call(a,h,m.os);return a};this.getResult=function(){return{ua:this.getUA(),browser:this.getBrowser(),engine:this.getEngine(),os:this.getOS(),device:this.getDevice(),cpu:this.getCPU()}};this.getUA=function(){return h};this.setUA=function(a){h=a;return this};return this};n.VERSION="0.7.21";n.BROWSER={NAME:"name",MAJOR:"major",VERSION:"version"};n.CPU={ARCHITECTURE:"architecture"};
|
299
|
+
n.DEVICE={MODEL:"model",VENDOR:"vendor",TYPE:"type",CONSOLE:"console",MOBILE:"mobile",SMARTTV:"smarttv",TABLET:"tablet",WEARABLE:"wearable",EMBEDDED:"embedded"};n.ENGINE={NAME:"name",VERSION:"version"};n.OS={NAME:"name",VERSION:"version"};a.exports&&(b=a.exports=n);b.UAParser=n;var k=c&&(c.jQuery||c.Zepto);if(k&&!k.ua){var r=new n;k.ua=r.getResult();k.ua.get=function(){return r.getUA()};k.ua.set=function(a){r.setUA(a);a=r.getResult();for(var b in a)k.ua[b]=a[b]}}})("object"===typeof window?window:
|
300
|
+
Ia)}),al={aud:"audience",c:"campaignChannel",cmtp:"campaigntype",cn:"campaignname",crcopy:"creativecopy",crcta:"creativecta",crim:"creativeimage",crtype:"creativetype",d:["detailChannel","channel"],dt:["deviceChannel","devicetype"],exp:"experiment",f:"forecastChannel",l:["locationChannel","locationcountry"],lang:"language",meta1:"meta1",meta2:"meta2",o:["offerChannel","offer"],p:["partnerChannel","partner"],pr:["productChannel","initiative"],route:"destinationurl",sq:"marinTag",subch:"subchannel",
|
301
|
+
subcmtp:"subcampaigntype",subp:"subpartner",tar:"targetingtype",tarpr:"targetproduct",u:"urlChannel"},cl="gclid pub kw kwid matchtype device".split(" "),vb={browserDefaults:function(){var a=Yj(window.navigator.userAgent);return{name:a.browser.name,version:a.browser.version,height:window.innerHeight,width:window.innerWidth}},campaignDefaults:function(){var a=$o.parse(window.document.location.search);return Ka({utmCampaign:a.utm_campaign,utmContent:a.utm_content,utmMedium:a.utm_medium,utmSource:a.utm_source,
|
302
|
+
utmTerm:a.utm_term},dl())},localeDefaults:function(){var a=window.navigator.language;return{countryCode:a.split("-")[1],language:a}},pageDefaults:function(){var a=(a=Uj())?fi.parse(a).pathname:window.location.pathname;var b=document.referrer,c=location.search,d=document.title;var e=location.search;var f=Uj();f?e=Sc(f,"?")?f:f+e:(e=window.location.href,f=e.indexOf("#"),e=-1===f?e:e.slice(0,f));return{path:a,referrer:b,search:c,title:d,url:e}},osDefaults:function(){var a=Yj(window.navigator.userAgent);
|
303
|
+
return{name:a.os.name,version:a.os.version}},referrerDefaults:function(){var a=document.referrer;try{var b=new URL(a);return{referrer:a,referrerHost:b.host,referrerPath:b.pathname,referrerSearch:b.search}}catch(c){return{referrer:a}}},subjectDefaults:function(){return{anonymousToken:za.get_raw("_savt")}}},ap=function(a,b,c){for(var d=-1,e=b.length,f={};++d<e;){var h=b[d],m=kf(a,h);if(c(m,h)){var l=f;h=Ud(h,a);if(Ra(l)){h=Ud(h,l);for(var n=-1,k=h.length,r=k-1;null!=l&&++n<k;){var x=Tc(h[n]),u=m;if("__proto__"===
|
304
|
+
x||"constructor"===x||"prototype"===x)break;if(n!=r){var v=l[x];u=void 0;void 0===u&&(u=Ra(v)?v:Kd(h[n+1])?[]:{})}nd(l,x,u);l=l[x]}}}}return f},bp=function(a,b){return ap(a,b,function(b,d){return null!=a&&ti(a,d,si)})},Zj=Ua?Ua.isConcatSpreadable:void 0,el=function(a){return ya(a)||Ue(a)||!!(Zj&&a&&a[Zj])},cp=function(a){return(null==a?0:a.length)?Fg(a,1):[]},dp=function(a){return bi(ai(a,void 0,cp),a+"")}(function(a,b){return null==a?{}:bp(a,b)}),ak=function(a){a=a||window.event;return a.preventDefault?
|
305
|
+
a.preventDefault():a.returnValue=!1},ep=C(function(a,b){b=a.exports=function(a){return a.replace(/^\s*|\s*$/g,"")};b.left=function(a){return a.replace(/^\s*/,"")};b.right=function(a){return a.replace(/\s*$/,"")}}),fp=Object.prototype.toString,gp=function(a){switch(fp.call(a)){case "[object Date]":return"date";case "[object RegExp]":return"regexp";case "[object Arguments]":return"arguments";case "[object Array]":return"array";case "[object Error]":return"error"}if(null===a)return"null";if(void 0===
|
306
|
+
a)return"undefined";if(a!==a)return"nan";if(a&&1===a.nodeType)return"element";a=a.valueOf?a.valueOf():Object.prototype.valueOf.apply(a);return typeof a},hp=/(\w+)\[(\d+)\]/,ne=function(a){try{return encodeURIComponent(a)}catch(b){return a}},Qf=function(a){try{return decodeURIComponent(a.replace(/\+/g," "))}catch(b){return a}},Rf={parse:function(a){if("string"!=typeof a)return{};a=ep(a);if(""==a)return{};"?"==a.charAt(0)&&(a=a.slice(1));var b={};a=a.split("&");for(var c=0;c<a.length;c++){var d=a[c].split("="),
|
307
|
+
e=Qf(d[0]);(e=hp.exec(e))?(b[e[1]]=b[e[1]]||[],b[e[1]][e[2]]=Qf(d[1])):b[d[0]]=null==d[1]?"":Qf(d[1])}return b},stringify:function(a){if(!a)return"";var b=[],c;for(c in a){var d=a[c];if("array"==gp(d))for(var e=0;e<d.length;++e)b.push(ne(c+"["+e+"]")+"="+ne(d[e]));else b.push(ne(c)+"="+ne(a[c]))}return b.join("&")}},Hg="undefined"!==typeof crypto&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto)||"undefined"!==typeof msCrypto&&"function"===typeof msCrypto.getRandomValues&&msCrypto.getRandomValues.bind(msCrypto),
|
308
|
+
fl=new Uint8Array(16),gl=/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i,pa=[],Sf=0;256>Sf;++Sf)pa.push((Sf+256).toString(16).substr(1));var bk,Tf,Uf=0,Vf=0,ip=Jg("v3",48,function(a){if("string"===typeof a){var b=unescape(encodeURIComponent(a));a=new Uint8Array(b.length);for(var c=0;c<b.length;++c)a[c]=b.charCodeAt(c)}b=a;if(0===b.length)b=[];else{c=8*b.length;for(var d=new Uint32Array((c+64>>>9<<4)+15),e=0;e<c;e+=8)d[e>>5]|=(b[e/
|
309
|
+
8]&255)<<e%32;b=d}a=8*a.length;b[a>>5]|=128<<a%32;b[(a+64>>>9<<4)+15-1]=a;a=1732584193;c=-271733879;d=-1732584194;e=271733878;for(var f=0;f<b.length;f+=16){var h=a,m=c,l=d,n=e;a=ua(a,c,d,e,b[f],7,-680876936);e=ua(e,a,c,d,b[f+1],12,-389564586);d=ua(d,e,a,c,b[f+2],17,606105819);c=ua(c,d,e,a,b[f+3],22,-1044525330);a=ua(a,c,d,e,b[f+4],7,-176418897);e=ua(e,a,c,d,b[f+5],12,1200080426);d=ua(d,e,a,c,b[f+6],17,-1473231341);c=ua(c,d,e,a,b[f+7],22,-45705983);a=ua(a,c,d,e,b[f+8],7,1770035416);e=ua(e,a,c,d,b[f+
|
310
|
+
9],12,-1958414417);d=ua(d,e,a,c,b[f+10],17,-42063);c=ua(c,d,e,a,b[f+11],22,-1990404162);a=ua(a,c,d,e,b[f+12],7,1804603682);e=ua(e,a,c,d,b[f+13],12,-40341101);d=ua(d,e,a,c,b[f+14],17,-1502002290);c=ua(c,d,e,a,b[f+15],22,1236535329);a=va(a,c,d,e,b[f+1],5,-165796510);e=va(e,a,c,d,b[f+6],9,-1069501632);d=va(d,e,a,c,b[f+11],14,643717713);c=va(c,d,e,a,b[f],20,-373897302);a=va(a,c,d,e,b[f+5],5,-701558691);e=va(e,a,c,d,b[f+10],9,38016083);d=va(d,e,a,c,b[f+15],14,-660478335);c=va(c,d,e,a,b[f+4],20,-405537848);
|
311
|
+
a=va(a,c,d,e,b[f+9],5,568446438);e=va(e,a,c,d,b[f+14],9,-1019803690);d=va(d,e,a,c,b[f+3],14,-187363961);c=va(c,d,e,a,b[f+8],20,1163531501);a=va(a,c,d,e,b[f+13],5,-1444681467);e=va(e,a,c,d,b[f+2],9,-51403784);d=va(d,e,a,c,b[f+7],14,1735328473);c=va(c,d,e,a,b[f+12],20,-1926607734);a=ja(c^d^e,a,c,b[f+5],4,-378558);e=ja(a^c^d,e,a,b[f+8],11,-2022574463);d=ja(e^a^c,d,e,b[f+11],16,1839030562);c=ja(d^e^a,c,d,b[f+14],23,-35309556);a=ja(c^d^e,a,c,b[f+1],4,-1530992060);e=ja(a^c^d,e,a,b[f+4],11,1272893353);d=
|
312
|
+
ja(e^a^c,d,e,b[f+7],16,-155497632);c=ja(d^e^a,c,d,b[f+10],23,-1094730640);a=ja(c^d^e,a,c,b[f+13],4,681279174);e=ja(a^c^d,e,a,b[f],11,-358537222);d=ja(e^a^c,d,e,b[f+3],16,-722521979);c=ja(d^e^a,c,d,b[f+6],23,76029189);a=ja(c^d^e,a,c,b[f+9],4,-640364487);e=ja(a^c^d,e,a,b[f+12],11,-421815835);d=ja(e^a^c,d,e,b[f+15],16,530742520);c=ja(d^e^a,c,d,b[f+2],23,-995338651);a=wa(a,c,d,e,b[f],6,-198630844);e=wa(e,a,c,d,b[f+7],10,1126891415);d=wa(d,e,a,c,b[f+14],15,-1416354905);c=wa(c,d,e,a,b[f+5],21,-57434055);
|
313
|
+
a=wa(a,c,d,e,b[f+12],6,1700485571);e=wa(e,a,c,d,b[f+3],10,-1894986606);d=wa(d,e,a,c,b[f+10],15,-1051523);c=wa(c,d,e,a,b[f+1],21,-2054922799);a=wa(a,c,d,e,b[f+8],6,1873313359);e=wa(e,a,c,d,b[f+15],10,-30611744);d=wa(d,e,a,c,b[f+6],15,-1560198380);c=wa(c,d,e,a,b[f+13],21,1309151649);a=wa(a,c,d,e,b[f+4],6,-145523070);e=wa(e,a,c,d,b[f+11],10,-1120210379);d=wa(d,e,a,c,b[f+2],15,718787259);c=wa(c,d,e,a,b[f+9],21,-343485551);a=zb(a,h);c=zb(c,m);d=zb(d,l);e=zb(e,n)}b=[a,c,d,e];a=[];c=32*b.length;for(d=0;d<
|
314
|
+
c;d+=8)e=b[d>>5]>>>d%32&255,e=parseInt("0123456789abcdef".charAt(e>>>4&15)+"0123456789abcdef".charAt(e&15),16),a.push(e);return a}),jp=Jg("v5",80,function(a){var b=[1518500249,1859775393,2400959708,3395469782],c=[1732584193,4023233417,2562383102,271733878,3285377520];if("string"===typeof a){var d=unescape(encodeURIComponent(a));a=[];for(var e=0;e<d.length;++e)a.push(d.charCodeAt(e))}else Array.isArray(a)||(a=Array.prototype.slice.call(a));a.push(128);d=Math.ceil((a.length/4+2)/16);e=Array(d);for(var f=
|
315
|
+
0;f<d;++f){for(var h=new Uint32Array(16),m=0;16>m;++m)h[m]=a[64*f+4*m]<<24|a[64*f+4*m+1]<<16|a[64*f+4*m+2]<<8|a[64*f+4*m+3];e[f]=h}e[d-1][14]=8*(a.length-1)/Math.pow(2,32);e[d-1][14]=Math.floor(e[d-1][14]);e[d-1][15]=8*(a.length-1)&4294967295;for(a=0;a<d;++a){f=new Uint32Array(80);for(h=0;16>h;++h)f[h]=e[a][h];for(h=16;80>h;++h)m=f[h-3]^f[h-8]^f[h-14]^f[h-16],f[h]=m<<1|m>>>31;h=c[0];m=c[1];for(var l=c[2],n=c[3],k=c[4],r=0;80>r;++r){var x=Math.floor(r/20),u=h<<5|h>>>27;a:{switch(x){case 0:var v=m&
|
316
|
+
l^~m&n;break a;case 1:v=m^l^n;break a;case 2:v=m&l^m&n^l&n;break a;case 3:v=m^l^n;break a}v=void 0}x=u+v+k+b[x]+f[r]>>>0;k=n;n=l;l=(m<<30|m>>>2)>>>0;m=h;h=x}c[0]=c[0]+h>>>0;c[1]=c[1]+m>>>0;c[2]=c[2]+l>>>0;c[3]=c[3]+n>>>0;c[4]=c[4]+k>>>0}return[c[0]>>24&255,c[0]>>16&255,c[0]>>8&255,c[0]&255,c[1]>>24&255,c[1]>>16&255,c[1]>>8&255,c[1]&255,c[2]>>24&255,c[2]>>16&255,c[2]>>8&255,c[2]&255,c[3]>>24&255,c[3]>>16&255,c[3]>>8&255,c[3]&255,c[4]>>24&255,c[4]>>16&255,c[4]>>8&255,c[4]&255]}),kp=Object.freeze({__proto__:null,
|
317
|
+
v1:function(a,b,c){c=b&&c||0;var d=b||Array(16);a=a||{};var e=a.node||bk,f=void 0!==a.clockseq?a.clockseq:Tf;if(null==e||null==f){var h=a.random||(a.rng||Gg)();null==e&&(e=bk=[h[0]|1,h[1],h[2],h[3],h[4],h[5]]);null==f&&(f=Tf=(h[6]<<8|h[7])&16383)}h=void 0!==a.msecs?a.msecs:Date.now();var m=void 0!==a.nsecs?a.nsecs:Vf+1,l=h-Uf+(m-Vf)/1E4;0>l&&void 0===a.clockseq&&(f=f+1&16383);(0>l||h>Uf)&&void 0===a.nsecs&&(m=0);if(1E4<=m)throw Error("uuid.v1(): Can't create more than 10M uuids/sec");Uf=h;Vf=m;Tf=
|
318
|
+
f;h+=122192928E5;a=(1E4*(h&268435455)+m)%4294967296;d[c++]=a>>>24&255;d[c++]=a>>>16&255;d[c++]=a>>>8&255;d[c++]=a&255;a=h/4294967296*1E4&268435455;d[c++]=a>>>8&255;d[c++]=a&255;d[c++]=a>>>24&15|16;d[c++]=a>>>16&255;d[c++]=f>>>8|128;d[c++]=f&255;for(f=0;6>f;++f)d[c+f]=e[f];return b||yd(d)},v3:ip,v4:function(a,b,c){a=a||{};a=a.random||(a.rng||Gg)();a[6]=a[6]&15|64;a[8]=a[8]&63|128;if(b){c=c||0;for(var d=0;16>d;++d)b[c+d]=a[d];return b}return yd(a)},v5:jp,NIL:"00000000-0000-0000-0000-000000000000",version:function(a){if(!xd(a))throw TypeError("Invalid UUID");
|
319
|
+
return parseInt(a.substr(14,1),16)},validate:xd,stringify:yd,parse:Ig}),oe=mb(kp),hl=Na("analytics:user");Fa.defaults={persist:!0,cookie:{key:"dajs_user_id",entityTypeKey:"da_js_user_type",oldKey:"dajs_user"},localStorage:{key:"dajs_user_traits"}};rb(Fa,Lb);Fa.prototype.id=function(a){return Lb.prototype.id.apply(this,arguments)};Fa.prototype.identify=function(a,b,c){c=c||{};var d=this.id(),e=this.entityType();if(null===d&&null===e||d===a&&e===b||d!==a&&"anonymous_visitor"===e&&"anonymous_visitor"!==
|
320
|
+
b)c=ff(this.traits(),c);if(a)(e===b&&a!=d||e!==b&&"anonymous_visitor"!==e)&&this.anonymousId(null),"anonymous_visitor"===b?this.anonymousId(a):this.id(a);else throw Error("entityId is required in User.prototype.identify");if(b)this.entityType(b);else throw Error("entityType is required in User.prototype.identify");this.debug("identify %o, %o, %o",a,b,c);this.traits(c);this.save()};Fa.prototype.entityType=function(a){switch(arguments.length){case 0:return this._getEntityType();case 1:return this._setEntityType(a)}};
|
321
|
+
Fa.prototype._getEntityType=function(){var a=this._options.persist?this.storage().get(this._options.cookie.entityTypeKey):this._entityType;return void 0===a?null:a};Fa.prototype._setEntityType=function(a){this._options.persist?this.storage().set(this._options.cookie.entityTypeKey,a):this._entityType=a};Fa.prototype.anonymousId=function(a){var b=this.storage();if(arguments.length)return b.set("dajs_anonymous_id",a),this;if(a=b.get("dajs_anonymous_id"))return a;a=za.get_raw("_savt")||oe.v4();b.set("dajs_anonymous_id",
|
322
|
+
a);return b.get("dajs_anonymous_id")};Fa.prototype.logout=function(){Lb.prototype.logout.call(this);this.anonymousId(null);this.entityType(null)};Fa.prototype.load=function(){this._loadOldCookie()||Lb.prototype.load.call(this)};Fa.prototype._loadOldCookie=function(){var a=za.get(this._options.cookie.oldKey);if(!a)return!1;this.id(a.id);this.traits(a.traits);za.remove(this._options.cookie.oldKey);return!0};var xa=Mb(new Fa);xa.User=Fa;var ed=mb(Am),lp=Ia.dataApi,mp=ed.Alias,np=ed.Group,op=ed.Identify,
|
323
|
+
pp=ed.Page,qp=ed.Track,ck=function(a,b,c,d){a[xi](yn+b,c,d||!1);return c};Od(J.prototype);J.prototype.use=function(a){a(this);return this};J.prototype.addIntegration=function(a){var b=a.prototype.name;if(!b)throw new TypeError("attempted to add an invalid integration");this.Integrations[b]=a;return this};J.prototype.init=J.prototype.initialize=function(a,b){a=a||{};b=b||{};this._options(b);this._readied=!1;var c=this;fa(function(b,d){c.Integrations[d]||delete a[d]},a);fa(function(a,d){if(!b.integrations||
|
324
|
+
!1!==b.integrations[d]&&(!1!==b.integrations.All||b.integrations[d])){var e=c.Integrations[d],f={};Qc(!0,f,a);e=new e(f);c.log("initialize %o - %o",d,a);c.add(e)}},a);var d=this._integrations;xa.load();Db.load();var e=sa(d).length,f=Rh(e,function(){c._readied=!0;c.emit("ready")});0>=e&&f();this.failedInitializations=[];fa(function(a){b.initialPageview&&!1===a.options.initialPageview&&(a.page=Rh(2,a.page));a.dataApi=c;a.once("ready",f);try{Cb.increment("dataApi_js.integration.invoke",{method:"initialize",
|
325
|
+
integration_name:a.name}),a.initialize()}catch(l){var d=a.name;Cb.increment("dataApi_js.integration.invoke.error",{method:"initialize",integration_name:a.name});c.failedInitializations.push(d);c.log("Error initializing %s integration: %o",d,l);a.ready()}},d);this.initialized=!0;this.emit("initialize",a,b);return this};J.prototype.setAnonymousId=function(a){this.user().anonymousId(a);return this};J.prototype.add=function(a){this._integrations[a.name]=a;return this};J.prototype.identify=function(a,
|
326
|
+
b,c,d,e){w.fn(d)&&(e=d,d=null);w.fn(c)&&(e=c,c=d=null);xa.identify(a,b,c);b=this.normalize({options:d,traits:xa.traits(),userId:xa.id(),entityType:xa.entityType()});this.options.integrations&&Ka(b.integrations,this.options.integrations);this._invoke("identify",new op(b));this.emit("identify",a,c,d);this._callback(e);return this};J.prototype.user=function(){return xa};J.prototype.group=function(a,b,c,d){if(!arguments.length)return Db;w.fn(c)&&(d=c,c=null);w.fn(b)&&(d=b,b=c=null);w.object(a)&&(c=b,
|
327
|
+
b=a,a=Db.id());Db.identify(a,b);var e=this.normalize({options:c,traits:Db.traits(),groupId:Db.id()});this.options.integrations&&Ka(e.integrations,this.options.integrations);this._invoke("group",new np(e));this.emit("group",a,b,c);this._callback(d);return this};J.prototype.track=function(a,b,c,d){w.fn(c)&&(d=c,c=null);w.fn(b)&&(d=b,b=c=null);var e=this.options.plan||{},f=e.track||{},h={},m=this.normalize({properties:b,options:c,event:a});(e=f[a])?(this.log("plan %o - %o",a,e),h=!1===e.enabled?{All:!1,
|
328
|
+
DataApi:!0}:e.integrations||{}):(f.__default||{enabled:!0}).enabled||(h={All:!1,DataApi:!0});Ka(m.integrations,this._mergeInitializeAndPlanIntegrations(h));this._invoke("track",new qp(m));this.emit("track",a,b,c);this._callback(d);return this};J.prototype.trackClick=J.prototype.trackLink=function(a,b,c){if(!a)return this;"element"===ka(a)&&(a=[a]);var d=this;fa(function(a){if("element"!==ka(a))throw new TypeError("Must pass HTMLElement to `dataApi.trackLink`.");ck(a,"click",function(e){var f=w.fn(b)?
|
329
|
+
b(a):b,m=w.fn(c)?c(a):c,l=a.getAttribute("href")||a.getAttributeNS("http://www.w3.org/1999/xlink","href")||a.getAttribute("xlink:href");d.track(f,m);l&&"_blank"!==a.target&&!Um(e)&&(ak(e),d._callback(function(){window.location.href=l}))})},a);return this};J.prototype.trackSubmit=J.prototype.trackForm=function(a,b,c){if(!a)return this;"element"===ka(a)&&(a=[a]);var d=this;fa(function(a){function e(e){ak(e);e=w.fn(b)?b(a):b;var f=w.fn(c)?c(a):c;d.track(e,f);d._callback(function(){a.submit()})}if("element"!==
|
330
|
+
ka(a))throw new TypeError("Must pass HTMLElement to `dataApi.trackForm`.");var h=window.jQuery||window.Zepto;h?h(a).submit(e):ck(a,"submit",e)},a);return this};J.prototype.page=function(a,b,c,d,e){w.fn(d)&&(e=d,d=null);w.fn(c)&&(e=c,d=c=null);w.fn(b)&&(e=b,d=c=b=null);"object"===ka(a)&&(d=b,c=a,b=a=null);"object"===ka(b)&&(d=c,c=b,b=null);"string"===ka(a)&&"string"!==ka(b)&&(b=a,a=null);c=oa(c,5)||{};b&&(c.name=b);a&&(c.category=a);var f=vb.pageDefaults();Ka(c,f);f=dp(c,sa(f));w.empty(f)||(d=d||{},
|
331
|
+
d.context=d.context||{},d.context.page=f);f=this.normalize({properties:c,category:a,options:d,name:b});this.options.integrations&&Ka(f.integrations,this.options.integrations);this._invoke("page",new pp(f));this.emit("page",a,b,c,d);this._callback(e);return this};J.prototype.pageview=function(a){var b={};a&&(b.path=a);this.page(b);return this};J.prototype.alias=function(a,b,c,d){w.fn(c)&&(d=c,c=null);w.fn(b)&&(d=b,b=c=null);w.object(b)&&(c=b,b=null);var e=this.normalize({options:c,previousId:b,userId:a});
|
332
|
+
this.options.integrations&&Ka(e.integrations,this.options.integrations);this._invoke("alias",new mp(e));this.emit("alias",a,b,c);this._callback(d);return this};J.prototype.ready=function(a){if(w.fn(a))if(this._readied)Rc(a);else this.once("ready",a);return this};J.prototype.timeout=function(a){this._timeout=a};J.prototype.debug=function(a){!arguments.length||a?Na.enable("dataApi:"+(a||"*")):Na.disable()};J.prototype._options=function(a){this.options=a=a||{};za.options(a.cookie);Cb.options(a.metrics);
|
333
|
+
gb.options(a.localStorage);xa.options(a.user);Db.options(a.group);return this};J.prototype._callback=function(a){w.fn(a)&&(this._timeout?setTimeout(a,this._timeout):Rc(a));return this};J.prototype._invoke=function(a,b){var c=this;Cb.increment("dataApi_js.invoke",{method:a});this.emit("invoke",b);var d=c.failedInitializations||[];fa(function(e,f){if(b.enabled(f))if(0<=d.indexOf(f))c.log("Skipping invokation of .%s method of %s integration. Integation failed to initialize properly.",a,f);else try{Cb.increment("dataApi_js.integration.invoke",
|
334
|
+
{method:a,integration_name:e.name}),e.invoke.call(e,a,b)}catch(h){Cb.increment("dataApi_js.integration.invoke.error",{method:a,integration_name:e.name}),c.log("Error invoking .%s method of %s integration: %o",a,f,h)}},this._integrations);return this};J.prototype.push=function(a){var b=a.shift();this[b]&&this[b].apply(this,a)};J.prototype.reset=function(){this.user().logout();this.group().logout()};J.prototype._parseQuery=function(a){function b(a,b){var c=a.length,d;return Sd(function(b,e,f){f.substr(0,
|
335
|
+
c)===a&&(d=f.substr(c),b[d]=e);return b},{},b)}a=Rf.parse(a);var c=b("dajs_trait_",a),d=b("dajs_prop_",a);a.dajs_uid&&this.identify(a.dajs_uid,c);a.dajs_event&&this.track(a.dajs_event,d);a.dajs_aid&&xa.anonymousId(a.dajs_aid);return this};J.prototype.normalize=function(a){a=xn(a,sa(this._integrations));a.anonymousId&&xa.anonymousId(a.anonymousId);a.anonymousId=xa.anonymousId();a.entityType||xa.entityType()||xa.entityType("anonymous_visitor");a.entityType=xa.entityType();a.entityId=xa.id();a.context.subject=
|
336
|
+
a.context.subject||{};Ka(a.context.subject,this._generateSubjectContext(a));var b=this._defaultContext();sa(b).forEach(function(c){a.context[c]=Ka(a.context[c]||{},b[c])});return a};J.prototype._defaultContext=function(){return{browser:vb.browserDefaults(),campaign:vb.campaignDefaults(),locale:vb.localeDefaults(),page:vb.pageDefaults(),os:vb.osDefaults(),referrer:vb.referrerDefaults(),subject:vb.subjectDefaults()}};J.prototype._messageProperty=function(a,b){if(a.traits)return a.traits[b];if(a.properties)return a.properties[b];
|
337
|
+
if(a.context&&a.context.traits)return a.context.traits[b]};J.prototype._generateSubjectContext=function(a){var b="employee"===a.entityType?a.userId:this._messageProperty(a,"employeeToken")||this._messageProperty(a,"employmentToken"),c="legal_entity"===a.entityType?a.userId:this._messageProperty(a,"legalEntityToken"),d="merchant"===a.entityType?a.userId:this._messageProperty(a,"merchantToken"),e="person"===a.entityType?a.userId:this._messageProperty(a,"personToken"),f="unit"===a.entityType?a.userId:
|
338
|
+
this._messageProperty(a,"unitToken");return{credentialToken:this._messageProperty(a,"credentialToken"),deviceCredentialToken:this._messageProperty(a,"deviceCredentialToken"),employmentToken:b,employmentCanAccessMobileRegister:this._messageProperty(a,"employmentCanAccessMobileRegister"),employmentCanAccessSharedRegister:this._messageProperty(a,"employmentCanAccessSharedRegister"),employmentIsOwner:this._messageProperty(a,"employmentIsOwner"),legalEntityToken:c,merchantToken:d,personToken:e,unitToken:f,
|
339
|
+
userToken:a.userId,accountCountryCode:this._messageProperty(a,"accountCountryCode"),registeredCountryCode:this._messageProperty(a,"registeredCountryCode")}};J.prototype._mergeInitializeAndPlanIntegrations=function(a){if(!this.options.integrations)return a;var b=Qc({},this.options.integrations),c;!1===a.All&&(b={All:!1});for(c in a)a.hasOwnProperty(c)&&!1!==this.options.integrations[c]&&(b[c]=a[c]);return b};J.prototype.noConflict=function(){window.dataApi=lp;return this};var rp=za;J.context=vb;J.cookie=
|
340
|
+
rp;J.memory=li;J.store=gb;J.metrics=Cb;var sp=Rf.parse,Wf={btid:"dataxu",urid:"millennial-media"};try{var Kg=ka}catch(a){Kg=ka}var tp=function(a,b){for(var c=-1,d=null==a?0:a.length;++c<d;)if(!b(a[c],c,a))return!1;return!0},up=function(a,b){var c=!0;ef(a,function(a,e,f){return c=!!b(a,e,f)});return c};gc.o=Ia.JSON&&"function"===typeof JSON.stringify?JSON.stringify:String;gc.s=String;gc.d=parseInt;var dk=function(a,b){return a.addEventListener?il(a,b):jl(a,b)},vp=function(a,b){if(!a)throw Error("Cant load nothing...");
|
341
|
+
w.string(a)&&(a={src:a});var c="https:"===document.location.protocol||"chrome-extension:"===document.location.protocol;a.src&&0===a.src.indexOf("//")&&(a.src=c?"https:"+a.src:"http:"+a.src);c&&a.https?a.src=a.https:!c&&a.http&&(a.src=a.http);var d=document.createElement("iframe");d.src=a.src;d.width=a.width||1;d.height=a.height||1;d.style.display="none";w.fn(b)&&dk(d,b);Rc(function(){var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(d,a)});return d},wp=function(a,b){if(!a)throw Error("Can't load nothing...");
|
342
|
+
"string"===ka(a)&&(a={src:a});var c="https:"===document.location.protocol||"chrome-extension:"===document.location.protocol;a.src&&0===a.src.indexOf("//")&&(a.src=(c?"https:":"http:")+a.src);c&&a.https?a.src=a.https:!c&&a.http&&(a.src=a.http);var d=document.createElement("script");d.type="text/javascript";d.async=!0;d.src=a.src;"function"===ka(b)&&dk(d,b);Rc(function(){var a=document.getElementsByTagName("script")[0];a.parentNode.insertBefore(d,a)});return d},ek=function(a){return xp.test(a)?a.toLowerCase():
|
343
|
+
yp.test(a)?(kl(a)||a).toLowerCase():zp.test(a)?ml(a).toLowerCase():a.toLowerCase()},xp=/\s/,yp=/(_|-|\.|:)/,zp=/([a-z][A-Z]|[A-Z][a-z])/,ll=/[\W_]+(.|$)/g,nl=/(.)([A-Z]+)/g,Ap=C(function(a,b){function c(a){if(w.array(a)){var b=d;a=(ya(a)?tp:up)(a,ui(b))?"mixed":"array"}else a=w.object(a)?"map":"unknown";return a}function d(a){return w.object(a)&&w.string(a.key)&&m.call(a,"value")?!0:!1}function e(a,b){b=b||function(){};var c=new Image;c.onerror=f(b,"failed to load pixel",c);c.onload=function(){b()};
|
344
|
+
c.src=a.src;c.width=1;c.height=1;return c}function f(a,b,c){return function(d){d=d||window.event;var e=Error(b);e.event=d;e.source=c;a(e)}}function h(a,b){return Sd(function(a,c,d){a[d]=c.replace(/\{\{ *(\w+) *\}\}/g,function(a,c){return b[c]});return a},{},a.attrs)}var m=Object.prototype.hasOwnProperty,l=function(){},n=window.onerror;Od(b);b.initialize=function(){Rc(this.ready)};b.loaded=function(){return!1};b.page=function(a){};b.track=function(a){};b.map=function(a,b){var d=ek(b),e=c(a);return"unknown"===
|
345
|
+
e?[]:Sd(function(a,b,c){if("map"===e){var f=c;var h=b}"array"===e&&(h=f=b);"mixed"===e&&(f=b.key,h=b.value);ek(f)===d&&a.push(h);return a},[],a)};b.invoke=function(a){if(this[a]){var b=Array.prototype.slice.call(arguments,1);if(!this._ready)return this.queue(a,b);this.debug("%s with %o",a,b);return this[a].apply(this,b)}};b.queue=function(a,b){this._queue.push({method:a,args:b})};b.flush=function(){this._ready=!0;var a=this;fa(function(b){a[b.method].apply(a,b.args)},this._queue);this._queue.length=
|
346
|
+
0};b.reset=function(){for(var a=0;a<this.globals.length;a++)window[this.globals[a]]=void 0;window.onerror=n;window.onload=null};b.load=function(a,b,c){"function"===typeof a&&(c=a,a=b=null);a&&"object"===typeof a&&(c=b,b=a,a=null);"function"===typeof b&&(c=b,b=null);a=a||"library";b=b||{};b=this.locals(b);var d=this.templates[a];if(!d)throw Error(gc('template "%s" not defined.',a));a=h(d,b);c=c||l;var f=this;switch(d.type){case "img":a.width=1;a.height=1;var m=e(a,c);break;case "script":m=wp(a,function(a){if(!a)return c();
|
347
|
+
f.debug('error loading "%s" error="%s"',f.name,a)});delete a.src;fa(function(a,b){m.setAttribute(b,a)},a);break;case "iframe":m=vp(a,c)}return m};b.locals=function(a){a=a||{};var b=Math.floor((new Date).getTime()/36E5);a.hasOwnProperty("cache")||(a.cache=b);fa(function(b,c){a.hasOwnProperty(c)||(a[c]=b)},this.options);return a};b.ready=function(){this.emit("ready")};b._wrapInitialize=function(){var a=this.initialize;this.initialize=function(){this.debug("initialize");this._initialized=!0;var b=a.apply(this,
|
348
|
+
arguments);this.emit("initialize");return b}};b._wrapPage=function(){var a=this.page,b=!1;this.page=function(){if(this._assumesPageview&&!b)b=!0;else return a.apply(this,arguments)}}}),Bp=function(a,b){if("string"!=typeof a)throw new TypeError("String expected");b||(b=document);var c=/<([\w:]+)/.exec(a);if(!c)return b.createTextNode(a);a=a.replace(/^\s+|\s+$/g,"");c=c[1];if("body"==c)return c=b.createElement("html"),c.innerHTML=a,c.removeChild(c.lastChild);c=ha[c]||ha._default;var d=c[0],e=c[1],f=
|
349
|
+
c[2];c=b.createElement("div");for(c.innerHTML=e+a+f;d--;)c=c.lastChild;if(c.firstChild==c.lastChild)return c.removeChild(c.firstChild);for(a=b.createDocumentFragment();c.firstChild;)a.appendChild(c.removeChild(c.firstChild));return a},fk=!1;if("undefined"!==typeof document){var Xf=document.createElement("div");Xf.innerHTML=' <link/><table></table><a href="/a">a</a><input type="checkbox"/>';fk=!Xf.getElementsByTagName("link").length;Xf=void 0}var ha={legend:[1,"<fieldset>","</fieldset>"],tr:[2,"<table><tbody>",
|
350
|
+
"</tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],_default:fk?[1,"X<div>","</div>"]:[0,"",""]};ha.td=ha.th=[3,"<table><tbody><tr>","</tr></tbody></table>"];ha.option=ha.optgroup=[1,'<select multiple="multiple">',"</select>"];ha.thead=ha.tbody=ha.colgroup=ha.caption=ha.tfoot=[1,"<table>","</table>"];ha.polyline=ha.ellipse=ha.polygon=ha.circle=ha.text=ha.line=ha.path=ha.rect=ha.g=[1,'<svg xmlns="http://www.w3.org/2000/svg" version="1.1">',"</svg>"];var Cp=C(function(a,
|
351
|
+
b){function c(a){a=a.replace(' src="',' data-src="');var b=Bp(a),c={};fa(function(b){var d="data-src"===b.name?"src":b.name;Sc(a,b.name+"=")&&(c[d]=b.value)},b.attributes);return{type:b.tagName.toLowerCase(),attrs:c}}Od(b);b.option=function(a,b){this.prototype.defaults[a]=b;return this};b.mapping=function(a){this.option(a,[]);this.prototype[a]=function(b){return this.map(this.options[a],b)};return this};b.global=function(a){this.prototype.globals.push(a);return this};b.assumesPageview=function(){this.prototype._assumesPageview=
|
352
|
+
!0;return this};b.readyOnLoad=function(){this.prototype._readyOnLoad=!0;return this};b.readyOnInitialize=function(){this.prototype._readyOnInitialize=!0;return this};b.tag=function(a,b){null==b&&(b=a,a="library");this.prototype.templates[a]=c(b);return this}}),Dp=function(a){function b(c){if(c&&c.addIntegration)return c.addIntegration(b);this.debug=Na("analytics:integration:"+a.toLowerCase().replace(/[^a-z0-9]+/g," ").replace(/^\s+|\s+$/g,"").replace(/\s+/g,"-"));var d={};Qc(!0,d,c);this.options=
|
353
|
+
Ka(d||{},this.defaults);this._queue=[];this.once("ready",df(this,this.flush));b.emit("construct",this);this.ready=df(this,this.ready);this._wrapInitialize();this._wrapPage()}b.prototype.defaults={};b.prototype.globals=[];b.prototype.templates={};b.prototype.name=a;Qc(b,Cp);Qc(b.prototype,Ap);return b},Mg=function(a){try{return JSON.parse(a)}catch(b){return a||void 0}};try{var ob=window.localStorage}catch(a){ob=null}Lg.supported=!!ob;var ol=Object.defineProperty,Ep=window.location.protocol,Og,fd=function(a){return 0===
|
354
|
+
arguments.length?Og||window.location.protocol:zd(a)};fd.http=function(){zd("http:")};fd.https=function(){zd("https:")};fd.reset=function(){zd(Ep)};var pl=Rf.parse,Pg=Object.prototype.hasOwnProperty,Fp={name:!0,term:!0,source:!0,medium:!0,content:!0};De.strict=function(a){return Sd(function(a,c,d){Pg.call(Fp,d)&&(a[d]=c);return a},{},De(a))};var Gp=oe.v4,Yf={_data:{},length:0,setItem:function(a,b){this._data[a]=b;this.length=sa(this._data).length;return b},getItem:function(a){return a in this._data?
|
355
|
+
this._data[a]:null},removeItem:function(a){a in this._data&&delete this._data[a];this.length=sa(this._data).length;return null},clear:function(){this._data={};this.length=0},key:function(a){return sa(this._data)[a]}};var Hp=function(){try{if(!window.localStorage)return!1;var a=Gp();window.localStorage.setItem(a,"test_value");var b=window.localStorage.getItem(a);window.localStorage.removeItem(a);return"test_value"===b}catch(c){return!1}}()?window.localStorage:Yf;var ql=Hp,gk=JSON;Nb.prototype.set=
|
356
|
+
function(a,b){var c=this._createValidKey(a);if(c)try{this.engine.setItem(c,gk.stringify(b))}catch(d){c=!1;if(d.code)switch(d.code){case 22:c=!0;break;case 1014:"NS_ERROR_DOM_QUOTA_REACHED"===d.name&&(c=!0)}else-2147024882===d.number&&(c=!0);c&&(this._swapEngine(),this.set(a,b))}};Nb.prototype.get=function(a){try{var b=this.engine.getItem(this._createValidKey(a));return null===b?null:gk.parse(b)}catch(c){return null}};Nb.prototype.getOriginalEngine=function(){return this.originalEngine};Nb.prototype.remove=
|
357
|
+
function(a){this.engine.removeItem(this._createValidKey(a))};Nb.prototype._createValidKey=function(a){var b=this.name,c=this.id;if(!sa(this.keys).length)return[b,c,a].join(".");var d;fa(function(e){e===a&&(d=[b,c,a].join("."))},this.keys);return d};Nb.prototype._swapEngine=function(){var a=this;fa(function(b){var c=a.get(b);Yf.setItem([a.name,a.id,b].join("."),c);a.remove(b)},this.keys);this.engine=Yf};var Fe=Nb,hk={setTimeout:function(a,b){return window.setTimeout(a,b)},clearTimeout:function(a){return window.clearTimeout(a)},
|
358
|
+
Date:window.Date},Bc=hk,pe={ASAP:1,RESCHEDULE:2,ABANDON:3};pb.prototype.now=function(){return+new Bc.Date};pb.prototype.run=function(a,b,c){var d=this.nextId++;this.tasks[d]=Bc.setTimeout(this._handle(d,a,b,c||pe.ASAP),b);return d};pb.prototype.cancel=function(a){this.tasks[a]&&(Bc.clearTimeout(this.tasks[a]),delete this.tasks[a])};pb.prototype.cancelAll=function(){ki(this.tasks,Bc.clearTimeout);this.tasks={}};pb.prototype._handle=function(a,b,c,d){var e=this,f=e.now();return function(){delete e.tasks[a];
|
359
|
+
if(d>=pe.RESCHEDULE&&f+2*c<e.now())d===pe.RESCHEDULE&&e.run(b,c,d);else return b()}};pb.setClock=function(a){Bc=a};pb.resetClock=function(){Bc=hk};pb.Modes=pe;var hc=pb,Ic=oe.v4,Ip=Na("localstorage-retry");Od(Oa.prototype);Oa.prototype.start=function(){this._running&&this.stop();this._running=!0;this._ack();this._checkReclaim();this._processHead()};Oa.prototype.stop=function(){this._schedule.cancelAll();this._running=!1};Oa.prototype.shouldRetry=function(a,b){return b>this.maxAttempts?!1:!0};Oa.prototype.getDelay=
|
360
|
+
function(a){a=this.backoff.MIN_RETRY_DELAY*Math.pow(this.backoff.FACTOR,a);if(this.backoff.JITTER){var b=Math.random(),c=Math.floor(b*this.backoff.JITTER*a);a=5>Math.floor(10*b)?a-c:a+c}return Number(Math.min(a,this.backoff.MAX_RETRY_DELAY).toPrecision(1))};Oa.prototype.addItem=function(a){this._enqueue({item:a,attemptNumber:0,time:this._schedule.now(),id:Ic()})};Oa.prototype.requeue=function(a,b,c,d){this.shouldRetry(a,b,c)?this._enqueue({item:a,attemptNumber:b,time:this._schedule.now()+this.getDelay(b),
|
361
|
+
id:d||Ic()}):this.emit("discard",a,b)};Oa.prototype._enqueue=function(a){var b=this._store.get(this.keys.QUEUE)||[];b=b.slice(-(this.maxItems-1));b.push(a);b=b.sort(function(a,b){return a.time-b.time});this._store.set(this.keys.QUEUE,b);this._running&&this._processHead()};Oa.prototype._processHead=function(){function a(a,d){h.push({item:a.item,done:function(e,f){var h=c.get(b.keys.IN_PROGRESS)||{};delete h[d];c.set(b.keys.IN_PROGRESS,h);b.emit("processed",e,f,a.item);e&&b.requeue(a.item,a.attemptNumber+
|
362
|
+
1,e,a.id)}})}var b=this,c=this._store;this._schedule.cancel(this._processId);for(var d=c.get(this.keys.QUEUE)||[],e=c.get(this.keys.IN_PROGRESS)||{},f=this._schedule.now(),h=[],m=Object.keys(e).length;d.length&&d[0].time<=f&&m++<b.maxItems;){var l=d.shift(),n=Ic();e[n]={item:l.item,attemptNumber:l.attemptNumber,time:b._schedule.now()};a(l,n)}c.set(this.keys.QUEUE,d);c.set(this.keys.IN_PROGRESS,e);fa(function(a){try{b.fn(a.item,a.done)}catch(r){Ip("Process function threw error: "+r)}},h);d=c.get(this.keys.QUEUE)||
|
363
|
+
[];this._schedule.cancel(this._processId);0<d.length&&(this._processId=this._schedule.run(this._processHead,d[0].time-f,hc.Modes.ASAP))};Oa.prototype._ack=function(){this._store.set(this.keys.ACK,this._schedule.now());this._store.set(this.keys.RECLAIM_START,null);this._store.set(this.keys.RECLAIM_END,null);this._schedule.run(this._ack,this.timeouts.ACK_TIMER,hc.Modes.ASAP)};Oa.prototype._checkReclaim=function(){function a(a){a.set(b.keys.RECLAIM_START,b.id);a.set(b.keys.ACK,b._schedule.now());b._schedule.run(function(){a.get(b.keys.RECLAIM_START)===
|
364
|
+
b.id&&(a.set(b.keys.RECLAIM_END,b.id),b._schedule.run(function(){a.get(b.keys.RECLAIM_END)===b.id&&a.get(b.keys.RECLAIM_START)===b.id&&b._reclaim(a.id)},b.timeouts.RECLAIM_WAIT,hc.Modes.ABANDON))},b.timeouts.RECLAIM_WAIT,hc.Modes.ABANDON)}var b=this;fa(function(c){c.id!==b.id&&(b._schedule.now()-c.get(b.keys.ACK)<b.timeouts.RECLAIM_TIMEOUT||a(c))},function(a){for(var c=[],e=b._store.getOriginalEngine(),f=0;f<e.length;f++){var h=e.key(f).split(".");3===h.length&&h[0]===a&&"ack"===h[2]&&c.push(new Fe(a,
|
365
|
+
h[1],b.keys))}return c}(this.name));this._schedule.run(this._checkReclaim,this.timeouts.RECLAIM_TIMER,hc.Modes.RESCHEDULE)};Oa.prototype._reclaim=function(a){var b=this;a=new Fe(this.name,a,this.keys);var c=this._store.get(this.keys.QUEUE)||[],d=a.get(this.keys.IN_PROGRESS)||{},e=a.get(this.keys.QUEUE)||[],f=[],h=function(a,d){fa(function(a){var e=a.id||Ic();0<=f.indexOf(e)?b.emit("duplication",a.item,a.attemptNumber):(c.push({item:a.item,attemptNumber:a.attemptNumber+d,time:b._schedule.now(),id:e}),
|
366
|
+
f.push(e))},a)};h(e,0);h(d,1);c=c.sort(function(a,b){return a.time-b.time});this._store.set(this.keys.QUEUE,c);a.remove(this.keys.IN_PROGRESS);a.remove(this.keys.QUEUE);a.remove(this.keys.RECLAIM_START);a.remove(this.keys.RECLAIM_END);a.remove(this.keys.ACK);this._processHead()};var k={options:{usePureJavaScript:!1}},ik={};var Jp=function(a,b,c){if("string"!==typeof b)throw new TypeError('"alphabet" must be a string.');if(void 0!==c&&"number"!==typeof c)throw new TypeError('"maxline" must be a number.');
|
367
|
+
var d="";if(a instanceof Uint8Array){var e,f=b.length,h=b.charAt(0),m=[0];for(e=0;e<a.length;++e){for(var l=0,k=a[e];l<m.length;++l)k+=m[l]<<8,m[l]=k%f,k=k/f|0;for(;0<k;)m.push(k%f),k=k/f|0}for(e=0;0===a[e]&&e<a.length-1;++e)d+=h;for(e=m.length-1;0<=e;--e)d+=b[m[e]]}else{h=b.length;e=b.charAt(0);f=[0];for(d=0;d<a.length();++d){m=0;for(l=a.at(d);m<f.length;++m)l+=f[m]<<8,f[m]=l%h,l=l/h|0;for(;0<l;)f.push(l%h),l=l/h|0}h="";for(d=0;0===a.at(d)&&d<a.length()-1;++d)h+=e;for(d=f.length-1;0<=d;--d)h+=b[f[d]];
|
368
|
+
d=h}c&&(d=d.match(new RegExp(".{1,"+c+"}","g")).join("\r\n"));return d};var Kp=function(a,b){if("string"!==typeof a)throw new TypeError('"input" must be a string.');if("string"!==typeof b)throw new TypeError('"alphabet" must be a string.');var c=ik[b];if(!c){c=ik[b]=[];for(var d=0;d<b.length;++d)c[b.charCodeAt(d)]=d}a=a.replace(/\s/g,"");var e=b.length;b=b.charAt(0);var f=[0];for(d=0;d<a.length;d++){var h=c[a.charCodeAt(d)];if(void 0===h)return;for(var m=0;m<f.length;++m)h+=f[m]*e,f[m]=h&255,h>>=
|
369
|
+
8;for(;0<h;)f.push(h&255),h>>=8}for(c=0;a[c]===b&&c<a.length-1;++c)f.push(0);return"undefined"!==typeof Buffer?Buffer.from(f.reverse()):new Uint8Array(f.reverse())};C(function(a){function b(a){if(8!==a&&16!==a&&24!==a&&32!==a)throw Error("Only 8, 16, 24, or 32 bits supported: "+a);}function c(a){this.data="";this.read=0;if("string"===typeof a)this.data=a;else if(d.isArrayBuffer(a)||d.isArrayBufferView(a))if("undefined"!==typeof Buffer&&a instanceof Buffer)this.data=a.toString("binary");else{a=new Uint8Array(a);
|
370
|
+
try{this.data=String.fromCharCode.apply(null,a)}catch(S){for(var b=0;b<a.length;++b)this.putByte(a[b])}}else if(a instanceof c||"object"===typeof a&&"string"===typeof a.data&&"number"===typeof a.read)this.data=a.data,this.read=a.read;this._constructedStringLength=0}var d=a.exports=k.util=k.util||{};(function(){if("undefined"!==typeof process&&process.nextTick&&!process.browser)d.nextTick=process.nextTick,d.setImmediate="function"===typeof setImmediate?setImmediate:d.nextTick;else if("function"===
|
371
|
+
typeof setImmediate)d.setImmediate=function(){return setImmediate.apply(void 0,arguments)},d.nextTick=function(a){return setImmediate(a)};else{d.setImmediate=function(a){setTimeout(a,0)};if("undefined"!==typeof window&&"function"===typeof window.postMessage){var a=[];d.setImmediate=function(b){a.push(b);1===a.length&&window.postMessage("forge.setImmediate","*")};window.addEventListener("message",function(b){b.source===window&&"forge.setImmediate"===b.data&&(b.stopPropagation(),b=a.slice(),a.length=
|
372
|
+
0,b.forEach(function(a){a()}))},!0)}if("undefined"!==typeof MutationObserver){var b=Date.now(),c=!0,e=document.createElement("div");a=[];(new MutationObserver(function(){var b=a.slice();a.length=0;b.forEach(function(a){a()})})).observe(e,{attributes:!0});var f=d.setImmediate;d.setImmediate=function(d){15<Date.now()-b?(b=Date.now(),f(d)):(a.push(d),1===a.length&&e.setAttribute("a",c=!c))}}d.nextTick=d.setImmediate}})();d.isNodejs="undefined"!==typeof process&&process.versions&&process.versions.node;
|
373
|
+
a=d.isNodejs?Ia:"undefined"===typeof self?window:self;d.globalScope=a;d.isArray=Array.isArray||function(a){return"[object Array]"===Object.prototype.toString.call(a)};d.isArrayBuffer=function(a){return"undefined"!==typeof ArrayBuffer&&a instanceof ArrayBuffer};d.isArrayBufferView=function(a){return a&&d.isArrayBuffer(a.buffer)&&void 0!==a.byteLength};d.ByteBuffer=c;d.ByteStringBuffer=c;d.ByteStringBuffer.prototype._optimizeConstructedString=function(a){this._constructedStringLength+=a;4096<this._constructedStringLength&&
|
374
|
+
(this.data.substr(0,1),this._constructedStringLength=0)};d.ByteStringBuffer.prototype.length=function(){return this.data.length-this.read};d.ByteStringBuffer.prototype.isEmpty=function(){return 0>=this.length()};d.ByteStringBuffer.prototype.putByte=function(a){return this.putBytes(String.fromCharCode(a))};d.ByteStringBuffer.prototype.fillWithByte=function(a,b){a=String.fromCharCode(a);for(var c=this.data;0<b;)b&1&&(c+=a),b>>>=1,0<b&&(a+=a);this.data=c;this._optimizeConstructedString(b);return this};
|
375
|
+
d.ByteStringBuffer.prototype.putBytes=function(a){this.data+=a;this._optimizeConstructedString(a.length);return this};d.ByteStringBuffer.prototype.putString=function(a){return this.putBytes(d.encodeUtf8(a))};d.ByteStringBuffer.prototype.putInt16=function(a){return this.putBytes(String.fromCharCode(a>>8&255)+String.fromCharCode(a&255))};d.ByteStringBuffer.prototype.putInt24=function(a){return this.putBytes(String.fromCharCode(a>>16&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a&255))};d.ByteStringBuffer.prototype.putInt32=
|
376
|
+
function(a){return this.putBytes(String.fromCharCode(a>>24&255)+String.fromCharCode(a>>16&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a&255))};d.ByteStringBuffer.prototype.putInt16Le=function(a){return this.putBytes(String.fromCharCode(a&255)+String.fromCharCode(a>>8&255))};d.ByteStringBuffer.prototype.putInt24Le=function(a){return this.putBytes(String.fromCharCode(a&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a>>16&255))};d.ByteStringBuffer.prototype.putInt32Le=function(a){return this.putBytes(String.fromCharCode(a&
|
377
|
+
255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a>>16&255)+String.fromCharCode(a>>24&255))};d.ByteStringBuffer.prototype.putInt=function(a,c){b(c);var d="";do c-=8,d+=String.fromCharCode(a>>c&255);while(0<c);return this.putBytes(d)};d.ByteStringBuffer.prototype.putSignedInt=function(a,b){0>a&&(a+=2<<b-1);return this.putInt(a,b)};d.ByteStringBuffer.prototype.putBuffer=function(a){return this.putBytes(a.getBytes())};d.ByteStringBuffer.prototype.getByte=function(){return this.data.charCodeAt(this.read++)};
|
378
|
+
d.ByteStringBuffer.prototype.getInt16=function(){var a=this.data.charCodeAt(this.read)<<8^this.data.charCodeAt(this.read+1);this.read+=2;return a};d.ByteStringBuffer.prototype.getInt24=function(){var a=this.data.charCodeAt(this.read)<<16^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2);this.read+=3;return a};d.ByteStringBuffer.prototype.getInt32=function(){var a=this.data.charCodeAt(this.read)<<24^this.data.charCodeAt(this.read+1)<<16^this.data.charCodeAt(this.read+2)<<8^this.data.charCodeAt(this.read+
|
379
|
+
3);this.read+=4;return a};d.ByteStringBuffer.prototype.getInt16Le=function(){var a=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8;this.read+=2;return a};d.ByteStringBuffer.prototype.getInt24Le=function(){var a=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+2)<<16;this.read+=3;return a};d.ByteStringBuffer.prototype.getInt32Le=function(){var a=this.data.charCodeAt(this.read)^this.data.charCodeAt(this.read+1)<<8^this.data.charCodeAt(this.read+
|
380
|
+
2)<<16^this.data.charCodeAt(this.read+3)<<24;this.read+=4;return a};d.ByteStringBuffer.prototype.getInt=function(a){b(a);var c=0;do c=(c<<8)+this.data.charCodeAt(this.read++),a-=8;while(0<a);return c};d.ByteStringBuffer.prototype.getSignedInt=function(a){var b=this.getInt(a);a=2<<a-2;b>=a&&(b-=a<<1);return b};d.ByteStringBuffer.prototype.getBytes=function(a){if(a){a=Math.min(this.length(),a);var b=this.data.slice(this.read,this.read+a);this.read+=a}else 0===a?b="":(b=0===this.read?this.data:this.data.slice(this.read),
|
381
|
+
this.clear());return b};d.ByteStringBuffer.prototype.bytes=function(a){return"undefined"===typeof a?this.data.slice(this.read):this.data.slice(this.read,this.read+a)};d.ByteStringBuffer.prototype.at=function(a){return this.data.charCodeAt(this.read+a)};d.ByteStringBuffer.prototype.setAt=function(a,b){this.data=this.data.substr(0,this.read+a)+String.fromCharCode(b)+this.data.substr(this.read+a+1);return this};d.ByteStringBuffer.prototype.last=function(){return this.data.charCodeAt(this.data.length-
|
382
|
+
1)};d.ByteStringBuffer.prototype.copy=function(){var a=d.createBuffer(this.data);a.read=this.read;return a};d.ByteStringBuffer.prototype.compact=function(){0<this.read&&(this.data=this.data.slice(this.read),this.read=0);return this};d.ByteStringBuffer.prototype.clear=function(){this.data="";this.read=0;return this};d.ByteStringBuffer.prototype.truncate=function(a){a=Math.max(0,this.length()-a);this.data=this.data.substr(this.read,a);this.read=0;return this};d.ByteStringBuffer.prototype.toHex=function(){for(var a=
|
383
|
+
"",b=this.read;b<this.data.length;++b){var c=this.data.charCodeAt(b);16>c&&(a+="0");a+=c.toString(16)}return a};d.ByteStringBuffer.prototype.toString=function(){return d.decodeUtf8(this.bytes())};d.DataBuffer=function(a,b){b=b||{};this.read=b.readOffset||0;this.growSize=b.growSize||1024;var c=d.isArrayBuffer(a),e=d.isArrayBufferView(a);c||e?(this.data=c?new DataView(a):new DataView(a.buffer,a.byteOffset,a.byteLength),this.write="writeOffset"in b?b.writeOffset:this.data.byteLength):(this.data=new DataView(new ArrayBuffer(0)),
|
384
|
+
this.write=0,null!==a&&void 0!==a&&this.putBytes(a),"writeOffset"in b&&(this.write=b.writeOffset))};d.DataBuffer.prototype.length=function(){return this.write-this.read};d.DataBuffer.prototype.isEmpty=function(){return 0>=this.length()};d.DataBuffer.prototype.accommodate=function(a,b){if(this.length()>=a)return this;b=Math.max(b||this.growSize,a);a=new Uint8Array(this.data.buffer,this.data.byteOffset,this.data.byteLength);b=new Uint8Array(this.length()+b);b.set(a);this.data=new DataView(b.buffer);
|
385
|
+
return this};d.DataBuffer.prototype.putByte=function(a){this.accommodate(1);this.data.setUint8(this.write++,a);return this};d.DataBuffer.prototype.fillWithByte=function(a,b){this.accommodate(b);for(var c=0;c<b;++c)this.data.setUint8(a);return this};d.DataBuffer.prototype.putBytes=function(a,b){if(d.isArrayBufferView(a)){b=new Uint8Array(a.buffer,a.byteOffset,a.byteLength);a=b.byteLength-b.byteOffset;this.accommodate(a);var c=new Uint8Array(this.data.buffer,this.write);c.set(b);this.write+=a;return this}if(d.isArrayBuffer(a))return b=
|
386
|
+
new Uint8Array(a),this.accommodate(b.byteLength),c=new Uint8Array(this.data.buffer),c.set(b,this.write),this.write+=b.byteLength,this;if(a instanceof d.DataBuffer||"object"===typeof a&&"number"===typeof a.read&&"number"===typeof a.write&&d.isArrayBufferView(a.data))return b=new Uint8Array(a.data.byteLength,a.read,a.length()),this.accommodate(b.byteLength),c=new Uint8Array(a.data.byteLength,this.write),c.set(b),this.write+=b.byteLength,this;a instanceof d.ByteStringBuffer&&(a=a.data,b="binary");b=
|
387
|
+
b||"binary";if("string"===typeof a){if("hex"===b)return this.accommodate(Math.ceil(a.length/2)),b=new Uint8Array(this.data.buffer,this.write),this.write+=d.binary.hex.decode(a,b,this.write),this;if("base64"===b)return this.accommodate(3*Math.ceil(a.length/4)),b=new Uint8Array(this.data.buffer,this.write),this.write+=d.binary.base64.decode(a,b,this.write),this;"utf8"===b&&(a=d.encodeUtf8(a),b="binary");if("binary"===b||"raw"===b)return this.accommodate(a.length),b=new Uint8Array(this.data.buffer,this.write),
|
388
|
+
this.write+=d.binary.raw.decode(b),this;if("utf16"===b)return this.accommodate(2*a.length),b=new Uint16Array(this.data.buffer,this.write),this.write+=d.text.utf16.encode(b),this;throw Error("Invalid encoding: "+b);}throw Error("Invalid parameter: "+a);};d.DataBuffer.prototype.putBuffer=function(a){this.putBytes(a);a.clear();return this};d.DataBuffer.prototype.putString=function(a){return this.putBytes(a,"utf16")};d.DataBuffer.prototype.putInt16=function(a){this.accommodate(2);this.data.setInt16(this.write,
|
389
|
+
a);this.write+=2;return this};d.DataBuffer.prototype.putInt24=function(a){this.accommodate(3);this.data.setInt16(this.write,a>>8&65535);this.data.setInt8(this.write,a>>16&255);this.write+=3;return this};d.DataBuffer.prototype.putInt32=function(a){this.accommodate(4);this.data.setInt32(this.write,a);this.write+=4;return this};d.DataBuffer.prototype.putInt16Le=function(a){this.accommodate(2);this.data.setInt16(this.write,a,!0);this.write+=2;return this};d.DataBuffer.prototype.putInt24Le=function(a){this.accommodate(3);
|
390
|
+
this.data.setInt8(this.write,a>>16&255);this.data.setInt16(this.write,a>>8&65535,!0);this.write+=3;return this};d.DataBuffer.prototype.putInt32Le=function(a){this.accommodate(4);this.data.setInt32(this.write,a,!0);this.write+=4;return this};d.DataBuffer.prototype.putInt=function(a,c){b(c);this.accommodate(c/8);do c-=8,this.data.setInt8(this.write++,a>>c&255);while(0<c);return this};d.DataBuffer.prototype.putSignedInt=function(a,c){b(c);this.accommodate(c/8);0>a&&(a+=2<<c-1);return this.putInt(a,c)};
|
391
|
+
d.DataBuffer.prototype.getByte=function(){return this.data.getInt8(this.read++)};d.DataBuffer.prototype.getInt16=function(){var a=this.data.getInt16(this.read);this.read+=2;return a};d.DataBuffer.prototype.getInt24=function(){var a=this.data.getInt16(this.read)<<8^this.data.getInt8(this.read+2);this.read+=3;return a};d.DataBuffer.prototype.getInt32=function(){var a=this.data.getInt32(this.read);this.read+=4;return a};d.DataBuffer.prototype.getInt16Le=function(){var a=this.data.getInt16(this.read,
|
392
|
+
!0);this.read+=2;return a};d.DataBuffer.prototype.getInt24Le=function(){var a=this.data.getInt8(this.read)^this.data.getInt16(this.read+1,!0)<<8;this.read+=3;return a};d.DataBuffer.prototype.getInt32Le=function(){var a=this.data.getInt32(this.read,!0);this.read+=4;return a};d.DataBuffer.prototype.getInt=function(a){b(a);var c=0;do c=(c<<8)+this.data.getInt8(this.read++),a-=8;while(0<a);return c};d.DataBuffer.prototype.getSignedInt=function(a){var b=this.getInt(a);a=2<<a-2;b>=a&&(b-=a<<1);return b};
|
393
|
+
d.DataBuffer.prototype.getBytes=function(a){if(a){a=Math.min(this.length(),a);var b=this.data.slice(this.read,this.read+a);this.read+=a}else 0===a?b="":(b=0===this.read?this.data:this.data.slice(this.read),this.clear());return b};d.DataBuffer.prototype.bytes=function(a){return"undefined"===typeof a?this.data.slice(this.read):this.data.slice(this.read,this.read+a)};d.DataBuffer.prototype.at=function(a){return this.data.getUint8(this.read+a)};d.DataBuffer.prototype.setAt=function(a,b){this.data.setUint8(a,
|
394
|
+
b);return this};d.DataBuffer.prototype.last=function(){return this.data.getUint8(this.write-1)};d.DataBuffer.prototype.copy=function(){return new d.DataBuffer(this)};d.DataBuffer.prototype.compact=function(){if(0<this.read){var a=new Uint8Array(this.data.buffer,this.read),b=new Uint8Array(a.byteLength);b.set(a);this.data=new DataView(b);this.write-=this.read;this.read=0}return this};d.DataBuffer.prototype.clear=function(){this.data=new DataView(new ArrayBuffer(0));this.read=this.write=0;return this};
|
395
|
+
d.DataBuffer.prototype.truncate=function(a){this.write=Math.max(0,this.length()-a);this.read=Math.min(this.read,this.write);return this};d.DataBuffer.prototype.toHex=function(){for(var a="",b=this.read;b<this.data.byteLength;++b){var c=this.data.getUint8(b);16>c&&(a+="0");a+=c.toString(16)}return a};d.DataBuffer.prototype.toString=function(a){var b=new Uint8Array(this.data,this.read,this.length());a=a||"utf8";if("binary"===a||"raw"===a)return d.binary.raw.encode(b);if("hex"===a)return d.binary.hex.encode(b);
|
396
|
+
if("base64"===a)return d.binary.base64.encode(b);if("utf8"===a)return d.text.utf8.decode(b);if("utf16"===a)return d.text.utf16.decode(b);throw Error("Invalid encoding: "+a);};d.createBuffer=function(a,b){void 0!==a&&"utf8"===(b||"raw")&&(a=d.encodeUtf8(a));return new d.ByteBuffer(a)};d.fillString=function(a,b){for(var c="";0<b;)b&1&&(c+=a),b>>>=1,0<b&&(a+=a);return c};d.xorBytes=function(a,b,c){for(var d="",e,f="",h=0,l=0;0<c;--c,++h)e=a.charCodeAt(h)^b.charCodeAt(h),10<=l&&(d+=f,f="",l=0),f+=String.fromCharCode(e),
|
397
|
+
++l;return d+f};d.hexToBytes=function(a){var b="",c=0;a.length&1&&(c=1,b+=String.fromCharCode(parseInt(a[0],16)));for(;c<a.length;c+=2)b+=String.fromCharCode(parseInt(a.substr(c,2),16));return b};d.bytesToHex=function(a){return d.createBuffer(a).toHex()};d.int32ToBytes=function(a){return String.fromCharCode(a>>24&255)+String.fromCharCode(a>>16&255)+String.fromCharCode(a>>8&255)+String.fromCharCode(a&255)};var e=[62,-1,-1,-1,63,52,53,54,55,56,57,58,59,60,61,-1,-1,-1,64,-1,-1,-1,0,1,2,3,4,5,6,7,8,9,
|
398
|
+
10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51];d.encode64=function(a,b){for(var c="",d="",e,f,h,l=0;l<a.length;)e=a.charCodeAt(l++),f=a.charCodeAt(l++),h=a.charCodeAt(l++),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(e>>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((e&3)<<4|f>>4),isNaN(f)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((f&
|
399
|
+
15)<<2|h>>6),c+=isNaN(h)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h&63)),b&&c.length>b&&(d+=c.substr(0,b)+"\r\n",c=c.substr(b));return d+c};d.decode64=function(a){a=a.replace(/[^A-Za-z0-9\+\/=]/g,"");for(var b="",c,d,f,h,l=0;l<a.length;)c=e[a.charCodeAt(l++)-43],d=e[a.charCodeAt(l++)-43],f=e[a.charCodeAt(l++)-43],h=e[a.charCodeAt(l++)-43],b+=String.fromCharCode(c<<2|d>>4),64!==f&&(b+=String.fromCharCode((d&15)<<4|f>>2),64!==h&&(b+=String.fromCharCode((f&3)<<6|
|
400
|
+
h)));return b};d.encodeUtf8=function(a){return unescape(encodeURIComponent(a))};d.decodeUtf8=function(a){return decodeURIComponent(escape(a))};d.binary={raw:{},hex:{},base64:{},base58:{},baseN:{encode:Jp,decode:Kp}};d.binary.raw.encode=function(a){return String.fromCharCode.apply(null,a)};d.binary.raw.decode=function(a,b,c){var d=b;d||(d=new Uint8Array(a.length));for(var e=c=c||0,f=0;f<a.length;++f)d[e++]=a.charCodeAt(f);return b?e-c:d};d.binary.hex.encode=d.bytesToHex;d.binary.hex.decode=function(a,
|
401
|
+
b,c){var d=b;d||(d=new Uint8Array(Math.ceil(a.length/2)));c=c||0;var e=0,f=c;a.length&1&&(e=1,d[f++]=parseInt(a[0],16));for(;e<a.length;e+=2)d[f++]=parseInt(a.substr(e,2),16);return b?f-c:d};d.binary.base64.encode=function(a,b){for(var c="",d="",e,f,h,l=0;l<a.byteLength;)e=a[l++],f=a[l++],h=a[l++],c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(e>>2),c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((e&3)<<4|f>>4),isNaN(f)?c+="==":(c+="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt((f&
|
402
|
+
15)<<2|h>>6),c+=isNaN(h)?"=":"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=".charAt(h&63)),b&&c.length>b&&(d+=c.substr(0,b)+"\r\n",c=c.substr(b));return d+c};d.binary.base64.decode=function(a,b,c){var d=b;d||(d=new Uint8Array(3*Math.ceil(a.length/4)));a=a.replace(/[^A-Za-z0-9\+\/=]/g,"");c=c||0;for(var f,h,l,m,k=0,n=c;k<a.length;)f=e[a.charCodeAt(k++)-43],h=e[a.charCodeAt(k++)-43],l=e[a.charCodeAt(k++)-43],m=e[a.charCodeAt(k++)-43],d[n++]=f<<2|h>>4,64!==l&&(d[n++]=(h&15)<<4|l>>
|
403
|
+
2,64!==m&&(d[n++]=(l&3)<<6|m));return b?n-c:d.subarray(0,n)};d.binary.base58.encode=function(a,b){return d.binary.baseN.encode(a,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",b)};d.binary.base58.decode=function(a,b){return d.binary.baseN.decode(a,"123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",b)};d.text={utf8:{},utf16:{}};d.text.utf8.encode=function(a,b,c){a=d.encodeUtf8(a);var e=b;e||(e=new Uint8Array(a.length));for(var f=c=c||0,h=0;h<a.length;++h)e[f++]=a.charCodeAt(h);
|
404
|
+
return b?f-c:e};d.text.utf8.decode=function(a){return d.decodeUtf8(String.fromCharCode.apply(null,a))};d.text.utf16.encode=function(a,b,c){var d=b;d||(d=new Uint8Array(2*a.length));for(var e=new Uint16Array(d.buffer),f=c=c||0,h=c,l=0;l<a.length;++l)e[h++]=a.charCodeAt(l),f+=2;return b?f-c:d};d.text.utf16.decode=function(a){return String.fromCharCode.apply(null,new Uint16Array(a.buffer))};d.deflate=function(a,b,c){b=d.decode64(a.deflate(d.encode64(b)).rval);c&&(a=2,b.charCodeAt(1)&32&&(a=6),b=b.substring(a,
|
405
|
+
b.length-4));return b};d.inflate=function(a,b,c){a=a.inflate(d.encode64(b)).rval;return null===a?null:d.decode64(a)};var f=function(a,b,c){if(!a)throw Error("WebStorage not available.");null===c?a=a.removeItem(b):(c=d.encode64(JSON.stringify(c)),a=a.setItem(b,c));if("undefined"!==typeof a&&!0!==a.rval)throw b=Error(a.error.message),b.id=a.error.id,b.name=a.error.name,b;},h=function(a,b){if(!a)throw Error("WebStorage not available.");b=a.getItem(b);if(a.init)if(null===b.rval){if(b.error)throw a=Error(b.error.message),
|
406
|
+
a.id=b.error.id,a.name=b.error.name,a;b=null}else b=b.rval;null!==b&&(b=JSON.parse(d.decode64(b)));return b},m=function(a,b,c,d){var e=h(a,b);null===e&&(e={});e[c]=d;f(a,b,e)},l=function(a,b,c){a=h(a,b);null!==a&&(a=c in a?a[c]:null);return a},n=function(a,b,c){var d=h(a,b);if(null!==d&&c in d){delete d[c];c=!0;for(var e in d){c=!1;break}c&&(d=null);f(a,b,d)}},X=function(a,b){f(a,b,null)},r=function(a,b,c){var d=null;"undefined"===typeof c&&(c=["web","flash"]);var e=!1,f=null,h;for(h in c){var l=
|
407
|
+
c[h];try{if("flash"===l||"both"===l){if(null===b[0])throw Error("Flash local storage not available.");d=a.apply(this,b);e="flash"===l}if("web"===l||"both"===l)b[0]=localStorage,d=a.apply(this,b),e=!0}catch(O){f=O}if(e)break}if(!e)throw f;return d};d.setItem=function(a,b,c,d,e){r(m,arguments,e)};d.getItem=function(a,b,c,d){return r(l,arguments,d)};d.removeItem=function(a,b,c,d){r(n,arguments,d)};d.clearItems=function(a,b,c){r(X,arguments,c)};d.parseUrl=function(a){var b=/^(https?):\/\/([^:&^\/]*):?(\d*)(.*)$/g;
|
408
|
+
b.lastIndex=0;b=b.exec(a);if(a=null===b?null:{full:a,scheme:b[1],host:b[2],port:b[3],path:b[4]})a.fullHost=a.host,a.port?80!==a.port&&"http"===a.scheme?a.fullHost+=":"+a.port:443!==a.port&&"https"===a.scheme&&(a.fullHost+=":"+a.port):"http"===a.scheme?a.port=80:"https"===a.scheme&&(a.port=443),a.full=a.scheme+"://"+a.fullHost;return a};var x=null;d.getQueryVariables=function(a){var b=function(a){var b={};a=a.split("&");for(var c=0;c<a.length;c++){var d=a[c].indexOf("=");if(0<d){var e=a[c].substring(0,
|
409
|
+
d);d=a[c].substring(d+1)}else e=a[c],d=null;e in b||(b[e]=[]);e in Object.prototype||null===d||b[e].push(unescape(d))}return b};"undefined"===typeof a?(null===x&&(x="undefined"!==typeof window&&window.location&&window.location.search?b(window.location.search.substring(1)):{}),a=x):a=b(a);return a};d.parseFragment=function(a){var b=a,c="",e=a.indexOf("?");0<e&&(b=a.substring(0,e),c=a.substring(e+1));a=b.split("/");0<a.length&&""===a[0]&&a.shift();e=""===c?{}:d.getQueryVariables(c);return{pathString:b,
|
410
|
+
queryString:c,path:a,query:e}};d.makeRequest=function(a){var b=d.parseFragment(a),c={path:b.pathString,query:b.queryString,getPath:function(a){return"undefined"===typeof a?b.path:b.path[a]},getQuery:function(a,c){"undefined"===typeof a?a=b.query:(a=b.query[a])&&"undefined"!==typeof c&&(a=a[c]);return a},getQueryLast:function(a,b){return(a=c.getQuery(a))?a[a.length-1]:b}};return c};d.makeLink=function(a,b,c){a=jQuery.isArray(a)?a.join("/"):a;b=jQuery.param(b||{});c=c||"";return a+(0<b.length?"?"+b:
|
411
|
+
"")+(0<c.length?"#"+c:"")};d.isEmpty=function(a){for(var b in a)if(a.hasOwnProperty(b))return!1;return!0};d.format=function(a){var b=/%./g,c,d,e=0,f=[];for(d=0;c=b.exec(a);)switch(d=a.substring(d,b.lastIndex-2),0<d.length&&f.push(d),d=b.lastIndex,c=c[0][1],c){case "s":case "o":e<arguments.length?f.push(arguments[e++ +1]):f.push("<?>");break;case "%":f.push("%");break;default:f.push("<%"+c+"?>")}f.push(a.substring(d));return f.join("")};d.formatNumber=function(a,b,c,d){var e=isNaN(b=Math.abs(b))?2:
|
412
|
+
b;b=void 0===c?",":c;d=void 0===d?".":d;c=0>a?"-":"";var f=parseInt(a=Math.abs(+a||0).toFixed(e),10)+"",h=3<f.length?f.length%3:0;return c+(h?f.substr(0,h)+d:"")+f.substr(h).replace(/(\d{3})(?=\d)/g,"$1"+d)+(e?b+Math.abs(a-f).toFixed(e).slice(2):"")};d.formatSize=function(a){return a=1073741824<=a?d.formatNumber(a/1073741824,2,".","")+" GiB":1048576<=a?d.formatNumber(a/1048576,2,".","")+" MiB":1024<=a?d.formatNumber(a/1024,0)+" KiB":d.formatNumber(a,0)+" bytes"};d.bytesFromIP=function(a){return-1!==
|
413
|
+
a.indexOf(".")?d.bytesFromIPv4(a):-1!==a.indexOf(":")?d.bytesFromIPv6(a):null};d.bytesFromIPv4=function(a){a=a.split(".");if(4!==a.length)return null;for(var b=d.createBuffer(),c=0;c<a.length;++c){var e=parseInt(a[c],10);if(isNaN(e))return null;b.putByte(e)}return b.getBytes()};d.bytesFromIPv6=function(a){var b=0;a=a.split(":").filter(function(a){0===a.length&&++b;return!0});for(var c=2*(8-a.length+b),e=d.createBuffer(),f=0;8>f;++f)if(a[f]&&0!==a[f].length){var h=d.hexToBytes(a[f]);2>h.length&&e.putByte(0);
|
414
|
+
e.putBytes(h)}else e.fillWithByte(0,c),c=0;return e.getBytes()};d.bytesToIP=function(a){return 4===a.length?d.bytesToIPv4(a):16===a.length?d.bytesToIPv6(a):null};d.bytesToIPv4=function(a){if(4!==a.length)return null;for(var b=[],c=0;c<a.length;++c)b.push(a.charCodeAt(c));return b.join(".")};d.bytesToIPv6=function(a){if(16!==a.length)return null;for(var b=[],c=[],e=0,f=0;f<a.length;f+=2){for(var h=d.bytesToHex(a[f]+a[f+1]);"0"===h[0]&&"0"!==h;)h=h.substr(1);if("0"===h){var l=c[c.length-1],m=b.length;
|
415
|
+
l&&m===l.end+1?(l.end=m,l.end-l.start>c[e].end-c[e].start&&(e=c.length-1)):c.push({start:m,end:m})}b.push(h)}0<c.length&&(a=c[e],0<a.end-a.start&&(b.splice(a.start,a.end-a.start+1,""),0===a.start&&b.unshift(""),7===a.end&&b.push("")));return b.join(":")};d.estimateCores=function(a,b){function c(a,l,m){if(0===l){var k=Math.floor(a.reduce(function(a,b){return a+b},0)/a.length);d.cores=Math.max(1,k);URL.revokeObjectURL(h);return b(null,d.cores)}e(m,function(b,d){a.push(f(m,d));c(a,l-1,m)})}function e(a,
|
416
|
+
b){for(var c=[],d=[],e=0;e<a;++e){var f=new Worker(h);f.addEventListener("message",function(e){d.push(e.data);if(d.length===a){for(e=0;e<a;++e)c[e].terminate();b(null,d)}});c.push(f)}for(e=0;e<a;++e)c[e].postMessage(e)}function f(a,b){for(var c=[],d=0;d<a;++d)for(var e=b[d],f=c[d]=[],h=0;h<a;++h)if(d!==h){var l=b[h];(e.st>l.st&&e.st<l.et||l.st>e.st&&l.st<e.et)&&f.push(h)}return c.reduce(function(a,b){return Math.max(a,b.length)},0)}"function"===typeof a&&(b=a,a={});a=a||{};if("cores"in d&&!a.update)return b(null,
|
417
|
+
d.cores);if("undefined"!==typeof navigator&&"hardwareConcurrency"in navigator&&0<navigator.hardwareConcurrency)return d.cores=navigator.hardwareConcurrency,b(null,d.cores);if("undefined"===typeof Worker)return d.cores=1,b(null,d.cores);if("undefined"===typeof Blob)return d.cores=2,b(null,d.cores);var h=URL.createObjectURL(new Blob(["(",function(){self.addEventListener("message",function(a){a=Date.now();self.postMessage({st:a,et:a+4})})}.toString(),")()"],{type:"application/javascript"}));c([],5,16)}});
|
418
|
+
k.cipher=k.cipher||{};k.cipher.algorithms=k.cipher.algorithms||{};k.cipher.createCipher=function(a,b){var c=a;"string"===typeof c&&(c=k.cipher.getAlgorithm(c))&&(c=c());if(!c)throw Error("Unsupported algorithm: "+a);return new k.cipher.BlockCipher({algorithm:c,key:b,decrypt:!1})};k.cipher.createDecipher=function(a,b){var c=a;"string"===typeof c&&(c=k.cipher.getAlgorithm(c))&&(c=c());if(!c)throw Error("Unsupported algorithm: "+a);return new k.cipher.BlockCipher({algorithm:c,key:b,decrypt:!0})};k.cipher.registerAlgorithm=
|
419
|
+
function(a,b){a=a.toUpperCase();k.cipher.algorithms[a]=b};k.cipher.getAlgorithm=function(a){a=a.toUpperCase();return a in k.cipher.algorithms?k.cipher.algorithms[a]:null};var Zf=k.cipher.BlockCipher=function(a){this.algorithm=a.algorithm;this.mode=this.algorithm.mode;this.blockSize=this.mode.blockSize;this._finish=!1;this.output=this._input=null;this._op=a.decrypt?this.mode.decrypt:this.mode.encrypt;this._decrypt=a.decrypt;this.algorithm.initialize(a)};Zf.prototype.start=function(a){a=a||{};var b=
|
420
|
+
{},c;for(c in a)b[c]=a[c];b.decrypt=this._decrypt;this._finish=!1;this._input=k.util.createBuffer();this.output=a.output||k.util.createBuffer();this.mode.start(b)};Zf.prototype.update=function(a){for(a&&this._input.putBuffer(a);!this._op.call(this.mode,this._input,this.output,this._finish)&&!this._finish;);this._input.compact()};Zf.prototype.finish=function(a){!a||"ECB"!==this.mode.name&&"CBC"!==this.mode.name||(this.mode.pad=function(b){return a(this.blockSize,b,!1)},this.mode.unpad=function(b){return a(this.blockSize,
|
421
|
+
b,!0)});var b={};b.decrypt=this._decrypt;b.overflow=this._input.length()%this.blockSize;if(!this._decrypt&&this.mode.pad&&!this.mode.pad(this._input,b))return!1;this._finish=!0;this.update();return this._decrypt&&this.mode.unpad&&!this.mode.unpad(this.output,b)||this.mode.afterFinish&&!this.mode.afterFinish(this.output,b)?!1:!0};C(function(a){function b(a,b){"string"===typeof a&&(a=k.util.createBuffer(a));if(k.util.isArray(a)&&4<a.length){var c=a;a=k.util.createBuffer();for(var d=0;d<c.length;++d)a.putByte(c[d])}if(a.length()<
|
422
|
+
b)throw Error("Invalid IV length; got "+a.length()+" bytes and expected "+b+" bytes.");if(!k.util.isArray(a)){c=[];b/=4;for(d=0;d<b;++d)c.push(a.getInt32());a=c}return a}function c(a){a[a.length-1]=a[a.length-1]+1&4294967295}function d(a){return[a/4294967296|0,a&4294967295]}k.cipher=k.cipher||{};a=a.exports=k.cipher.modes=k.cipher.modes||{};a.ecb=function(a){a=a||{};this.name="ECB";this.cipher=a.cipher;this.blockSize=a.blockSize||16;this._ints=this.blockSize/4;this._inBlock=Array(this._ints);this._outBlock=
|
423
|
+
Array(this._ints)};a.ecb.prototype.start=function(a){};a.ecb.prototype.encrypt=function(a,b,c){if(a.length()<this.blockSize&&!(c&&0<a.length()))return!0;for(c=0;c<this._ints;++c)this._inBlock[c]=a.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);for(c=0;c<this._ints;++c)b.putInt32(this._outBlock[c])};a.ecb.prototype.decrypt=function(a,b,c){if(a.length()<this.blockSize&&!(c&&0<a.length()))return!0;for(c=0;c<this._ints;++c)this._inBlock[c]=a.getInt32();this.cipher.decrypt(this._inBlock,
|
424
|
+
this._outBlock);for(c=0;c<this._ints;++c)b.putInt32(this._outBlock[c])};a.ecb.prototype.pad=function(a,b){b=a.length()===this.blockSize?this.blockSize:this.blockSize-a.length();a.fillWithByte(b,b);return!0};a.ecb.prototype.unpad=function(a,b){if(0<b.overflow)return!1;b=a.length();b=a.at(b-1);if(b>this.blockSize<<2)return!1;a.truncate(b);return!0};a.cbc=function(a){a=a||{};this.name="CBC";this.cipher=a.cipher;this.blockSize=a.blockSize||16;this._ints=this.blockSize/4;this._inBlock=Array(this._ints);
|
425
|
+
this._outBlock=Array(this._ints)};a.cbc.prototype.start=function(a){if(null===a.iv){if(!this._prev)throw Error("Invalid IV parameter.");this._iv=this._prev.slice(0)}else if("iv"in a)this._iv=b(a.iv,this.blockSize),this._prev=this._iv.slice(0);else throw Error("Invalid IV parameter.");};a.cbc.prototype.encrypt=function(a,b,c){if(a.length()<this.blockSize&&!(c&&0<a.length()))return!0;for(c=0;c<this._ints;++c)this._inBlock[c]=this._prev[c]^a.getInt32();this.cipher.encrypt(this._inBlock,this._outBlock);
|
426
|
+
for(c=0;c<this._ints;++c)b.putInt32(this._outBlock[c]);this._prev=this._outBlock};a.cbc.prototype.decrypt=function(a,b,c){if(a.length()<this.blockSize&&!(c&&0<a.length()))return!0;for(c=0;c<this._ints;++c)this._inBlock[c]=a.getInt32();this.cipher.decrypt(this._inBlock,this._outBlock);for(c=0;c<this._ints;++c)b.putInt32(this._prev[c]^this._outBlock[c]);this._prev=this._inBlock.slice(0)};a.cbc.prototype.pad=function(a,b){b=a.length()===this.blockSize?this.blockSize:this.blockSize-a.length();a.fillWithByte(b,
|
427
|
+
b);return!0};a.cbc.prototype.unpad=function(a,b){if(0<b.overflow)return!1;b=a.length();b=a.at(b-1);if(b>this.blockSize<<2)return!1;a.truncate(b);return!0};a.cfb=function(a){a=a||{};this.name="CFB";this.cipher=a.cipher;this.blockSize=a.blockSize||16;this._ints=this.blockSize/4;this._inBlock=null;this._outBlock=Array(this._ints);this._partialBlock=Array(this._ints);this._partialOutput=k.util.createBuffer();this._partialBytes=0};a.cfb.prototype.start=function(a){if(!("iv"in a))throw Error("Invalid IV parameter.");
|
428
|
+
this._iv=b(a.iv,this.blockSize);this._inBlock=this._iv.slice(0);this._partialBytes=0};a.cfb.prototype.encrypt=function(a,b,c){var d=a.length();if(0===d)return!0;this.cipher.encrypt(this._inBlock,this._outBlock);if(0===this._partialBytes&&d>=this.blockSize)for(var e=0;e<this._ints;++e)this._inBlock[e]=a.getInt32()^this._outBlock[e],b.putInt32(this._inBlock[e]);else{var f=(this.blockSize-d)%this.blockSize;0<f&&(f=this.blockSize-f);this._partialOutput.clear();for(e=0;e<this._ints;++e)this._partialBlock[e]=
|
429
|
+
a.getInt32()^this._outBlock[e],this._partialOutput.putInt32(this._partialBlock[e]);if(0<f)a.read-=this.blockSize;else for(e=0;e<this._ints;++e)this._inBlock[e]=this._partialBlock[e];0<this._partialBytes&&this._partialOutput.getBytes(this._partialBytes);if(0<f&&!c)return b.putBytes(this._partialOutput.getBytes(f-this._partialBytes)),this._partialBytes=f,!0;b.putBytes(this._partialOutput.getBytes(d-this._partialBytes));this._partialBytes=0}};a.cfb.prototype.decrypt=function(a,b,c){var d=a.length();
|
430
|
+
if(0===d)return!0;this.cipher.encrypt(this._inBlock,this._outBlock);if(0===this._partialBytes&&d>=this.blockSize)for(var e=0;e<this._ints;++e)this._inBlock[e]=a.getInt32(),b.putInt32(this._inBlock[e]^this._outBlock[e]);else{var f=(this.blockSize-d)%this.blockSize;0<f&&(f=this.blockSize-f);this._partialOutput.clear();for(e=0;e<this._ints;++e)this._partialBlock[e]=a.getInt32(),this._partialOutput.putInt32(this._partialBlock[e]^this._outBlock[e]);if(0<f)a.read-=this.blockSize;else for(e=0;e<this._ints;++e)this._inBlock[e]=
|
431
|
+
this._partialBlock[e];0<this._partialBytes&&this._partialOutput.getBytes(this._partialBytes);if(0<f&&!c)return b.putBytes(this._partialOutput.getBytes(f-this._partialBytes)),this._partialBytes=f,!0;b.putBytes(this._partialOutput.getBytes(d-this._partialBytes));this._partialBytes=0}};a.ofb=function(a){a=a||{};this.name="OFB";this.cipher=a.cipher;this.blockSize=a.blockSize||16;this._ints=this.blockSize/4;this._inBlock=null;this._outBlock=Array(this._ints);this._partialOutput=k.util.createBuffer();this._partialBytes=
|
432
|
+
0};a.ofb.prototype.start=function(a){if(!("iv"in a))throw Error("Invalid IV parameter.");this._iv=b(a.iv,this.blockSize);this._inBlock=this._iv.slice(0);this._partialBytes=0};a.ofb.prototype.encrypt=function(a,b,c){var d=a.length();if(0===a.length())return!0;this.cipher.encrypt(this._inBlock,this._outBlock);if(0===this._partialBytes&&d>=this.blockSize)for(var e=0;e<this._ints;++e)b.putInt32(a.getInt32()^this._outBlock[e]),this._inBlock[e]=this._outBlock[e];else{var f=(this.blockSize-d)%this.blockSize;
|
433
|
+
0<f&&(f=this.blockSize-f);this._partialOutput.clear();for(e=0;e<this._ints;++e)this._partialOutput.putInt32(a.getInt32()^this._outBlock[e]);if(0<f)a.read-=this.blockSize;else for(e=0;e<this._ints;++e)this._inBlock[e]=this._outBlock[e];0<this._partialBytes&&this._partialOutput.getBytes(this._partialBytes);if(0<f&&!c)return b.putBytes(this._partialOutput.getBytes(f-this._partialBytes)),this._partialBytes=f,!0;b.putBytes(this._partialOutput.getBytes(d-this._partialBytes));this._partialBytes=0}};a.ofb.prototype.decrypt=
|
434
|
+
a.ofb.prototype.encrypt;a.ctr=function(a){a=a||{};this.name="CTR";this.cipher=a.cipher;this.blockSize=a.blockSize||16;this._ints=this.blockSize/4;this._inBlock=null;this._outBlock=Array(this._ints);this._partialOutput=k.util.createBuffer();this._partialBytes=0};a.ctr.prototype.start=function(a){if(!("iv"in a))throw Error("Invalid IV parameter.");this._iv=b(a.iv,this.blockSize);this._inBlock=this._iv.slice(0);this._partialBytes=0};a.ctr.prototype.encrypt=function(a,b,d){var e=a.length();if(0===e)return!0;
|
435
|
+
this.cipher.encrypt(this._inBlock,this._outBlock);if(0===this._partialBytes&&e>=this.blockSize)for(var f=0;f<this._ints;++f)b.putInt32(a.getInt32()^this._outBlock[f]);else{var h=(this.blockSize-e)%this.blockSize;0<h&&(h=this.blockSize-h);this._partialOutput.clear();for(f=0;f<this._ints;++f)this._partialOutput.putInt32(a.getInt32()^this._outBlock[f]);0<h&&(a.read-=this.blockSize);0<this._partialBytes&&this._partialOutput.getBytes(this._partialBytes);if(0<h&&!d)return b.putBytes(this._partialOutput.getBytes(h-
|
436
|
+
this._partialBytes)),this._partialBytes=h,!0;b.putBytes(this._partialOutput.getBytes(e-this._partialBytes));this._partialBytes=0}c(this._inBlock)};a.ctr.prototype.decrypt=a.ctr.prototype.encrypt;a.gcm=function(a){a=a||{};this.name="GCM";this.cipher=a.cipher;this.blockSize=a.blockSize||16;this._ints=this.blockSize/4;this._inBlock=Array(this._ints);this._outBlock=Array(this._ints);this._partialOutput=k.util.createBuffer();this._partialBytes=0;this._R=3774873600};a.gcm.prototype.start=function(a){if(!("iv"in
|
437
|
+
a))throw Error("Invalid IV parameter.");var b=k.util.createBuffer(a.iv);this._cipherLength=0;var e="additionalData"in a?k.util.createBuffer(a.additionalData):k.util.createBuffer();this._tagLength="tagLength"in a?a.tagLength:128;this._tag=null;if(a.decrypt&&(this._tag=k.util.createBuffer(a.tag).getBytes(),this._tag.length!==this._tagLength/8))throw Error("Authentication tag does not match tag length.");this._hashBlock=Array(this._ints);this.tag=null;this._hashSubkey=Array(this._ints);this.cipher.encrypt([0,
|
438
|
+
0,0,0],this._hashSubkey);this.componentBits=4;this._m=this.generateHashTable(this._hashSubkey,this.componentBits);a=b.length();if(12===a)this._j0=[b.getInt32(),b.getInt32(),b.getInt32(),1];else{for(this._j0=[0,0,0,0];0<b.length();)this._j0=this.ghash(this._hashSubkey,this._j0,[b.getInt32(),b.getInt32(),b.getInt32(),b.getInt32()]);this._j0=this.ghash(this._hashSubkey,this._j0,[0,0].concat(d(8*a)))}this._inBlock=this._j0.slice(0);c(this._inBlock);this._partialBytes=0;e=k.util.createBuffer(e);this._aDataLength=
|
439
|
+
d(8*e.length());(b=e.length()%this.blockSize)&&e.fillWithByte(0,this.blockSize-b);for(this._s=[0,0,0,0];0<e.length();)this._s=this.ghash(this._hashSubkey,this._s,[e.getInt32(),e.getInt32(),e.getInt32(),e.getInt32()])};a.gcm.prototype.encrypt=function(a,b,d){var e=a.length();if(0===e)return!0;this.cipher.encrypt(this._inBlock,this._outBlock);if(0===this._partialBytes&&e>=this.blockSize){for(var f=0;f<this._ints;++f)b.putInt32(this._outBlock[f]^=a.getInt32());this._cipherLength+=this.blockSize}else{var h=
|
440
|
+
(this.blockSize-e)%this.blockSize;0<h&&(h=this.blockSize-h);this._partialOutput.clear();for(f=0;f<this._ints;++f)this._partialOutput.putInt32(a.getInt32()^this._outBlock[f]);if(0>=h||d){d?(f=e%this.blockSize,this._cipherLength+=f,this._partialOutput.truncate(this.blockSize-f)):this._cipherLength+=this.blockSize;for(f=0;f<this._ints;++f)this._outBlock[f]=this._partialOutput.getInt32();this._partialOutput.read-=this.blockSize}0<this._partialBytes&&this._partialOutput.getBytes(this._partialBytes);if(0<
|
441
|
+
h&&!d)return a.read-=this.blockSize,b.putBytes(this._partialOutput.getBytes(h-this._partialBytes)),this._partialBytes=h,!0;b.putBytes(this._partialOutput.getBytes(e-this._partialBytes));this._partialBytes=0}this._s=this.ghash(this._hashSubkey,this._s,this._outBlock);c(this._inBlock)};a.gcm.prototype.decrypt=function(a,b,d){var f=a.length();if(f<this.blockSize&&!(d&&0<f))return!0;this.cipher.encrypt(this._inBlock,this._outBlock);c(this._inBlock);this._hashBlock[0]=a.getInt32();this._hashBlock[1]=a.getInt32();
|
442
|
+
this._hashBlock[2]=a.getInt32();this._hashBlock[3]=a.getInt32();this._s=this.ghash(this._hashSubkey,this._s,this._hashBlock);for(a=0;a<this._ints;++a)b.putInt32(this._outBlock[a]^this._hashBlock[a]);this._cipherLength=f<this.blockSize?this._cipherLength+f%this.blockSize:this._cipherLength+this.blockSize};a.gcm.prototype.afterFinish=function(a,b){var c=!0;b.decrypt&&b.overflow&&a.truncate(this.blockSize-b.overflow);this.tag=k.util.createBuffer();a=this._aDataLength.concat(d(8*this._cipherLength));
|
443
|
+
this._s=this.ghash(this._hashSubkey,this._s,a);a=[];this.cipher.encrypt(this._j0,a);for(var f=0;f<this._ints;++f)this.tag.putInt32(this._s[f]^a[f]);this.tag.truncate(this.tag.length()%(this._tagLength/8));b.decrypt&&this.tag.bytes()!==this._tag&&(c=!1);return c};a.gcm.prototype.multiply=function(a,b){var c=[0,0,0,0];b=b.slice(0);for(var d=0;128>d;++d)a[d/32|0]&1<<31-d%32&&(c[0]^=b[0],c[1]^=b[1],c[2]^=b[2],c[3]^=b[3]),this.pow(b,b);return c};a.gcm.prototype.pow=function(a,b){for(var c=a[3]&1,d=3;0<
|
444
|
+
d;--d)b[d]=a[d]>>>1|(a[d-1]&1)<<31;b[0]=a[0]>>>1;c&&(b[0]^=this._R)};a.gcm.prototype.tableMultiply=function(a){for(var b=[0,0,0,0],c=0;32>c;++c){var d=this._m[c][a[c/8|0]>>>4*(7-c%8)&15];b[0]^=d[0];b[1]^=d[1];b[2]^=d[2];b[3]^=d[3]}return b};a.gcm.prototype.ghash=function(a,b,c){b[0]^=c[0];b[1]^=c[1];b[2]^=c[2];b[3]^=c[3];return this.tableMultiply(b)};a.gcm.prototype.generateHashTable=function(a,b){var c=8/b,d=4*c;c*=16;for(var e=Array(c),f=0;f<c;++f){var k=[0,0,0,0];k[f/d|0]=1<<b-1<<(d-1-f%d)*b;e[f]=
|
445
|
+
this.generateSubHashTable(this.multiply(k,a),b)}return e};a.gcm.prototype.generateSubHashTable=function(a,b){b=1<<b;var c=b>>>1,d=Array(b);d[c]=a.slice(0);for(var f=c>>>1;0<f;)this.pow(d[2*f],d[f]=[]),f>>=1;for(f=2;f<c;){for(var e=1;e<f;++e){var k=d[f],r=d[e];d[f+e]=[k[0]^r[0],k[1]^r[1],k[2]^r[2],k[3]^r[3]]}f*=2}d[0]=[0,0,0,0];for(f=c+1;f<b;++f)e=d[f^c],d[f]=[a[0]^e[0],a[1]^e[1],a[2]^e[2],a[3]^e[3]];return d}});k.aes=k.aes||{};k.aes.startEncrypting=function(a,b,c,d){a=Ad({key:a,output:c,decrypt:!1,
|
446
|
+
mode:d});a.start(b);return a};k.aes.createEncryptionCipher=function(a,b){return Ad({key:a,output:null,decrypt:!1,mode:b})};k.aes.startDecrypting=function(a,b,c,d){a=Ad({key:a,output:c,decrypt:!0,mode:d});a.start(b);return a};k.aes.createDecryptionCipher=function(a,b){return Ad({key:a,output:null,decrypt:!0,mode:b})};k.aes.Algorithm=function(a,b){Ge||Qg();var c=this;c.name=a;c.mode=new b({blockSize:16,cipher:{encrypt:function(a,b){return Ie(c._w,a,b,!1)},decrypt:function(a,b){return Ie(c._w,a,b,!0)}}});
|
447
|
+
c._init=!1};k.aes.Algorithm.prototype.initialize=function(a){if(!this._init){var b=a.key;if("string"===typeof b&&(16===b.length||24===b.length||32===b.length))b=k.util.createBuffer(b);else if(k.util.isArray(b)&&(16===b.length||24===b.length||32===b.length)){var c=b;b=k.util.createBuffer();for(var d=0;d<c.length;++d)b.putByte(c[d])}if(!k.util.isArray(b)){c=b;b=[];var e=c.length();if(16===e||24===e||32===e)for(e>>>=2,d=0;d<e;++d)b.push(c.getInt32())}if(!k.util.isArray(b)||4!==b.length&&6!==b.length&&
|
448
|
+
8!==b.length)throw Error("Invalid key parameter.");c=-1!==["CFB","OFB","CTR","GCM"].indexOf(this.mode.name);this._w=Sg(b,a.decrypt&&!c);this._init=!0}};k.aes._expandKey=function(a,b){Ge||Qg();return Sg(a,b)};k.aes._updateBlock=Ie;ic("AES-ECB",k.cipher.modes.ecb);ic("AES-CBC",k.cipher.modes.cbc);ic("AES-CFB",k.cipher.modes.cfb);ic("AES-OFB",k.cipher.modes.ofb);ic("AES-CTR",k.cipher.modes.ctr);ic("AES-GCM",k.cipher.modes.gcm);var Ge=!1,jc=4,Aa,He,Rg,Ob,Ya;C(function(a){function b(a,b){c[a]=b;c[b]=a}
|
449
|
+
k.pki=k.pki||{};var c=a.exports=k.pki.oids=k.oids=k.oids||{};b("1.2.840.113549.1.1.1","rsaEncryption");b("1.2.840.113549.1.1.4","md5WithRSAEncryption");b("1.2.840.113549.1.1.5","sha1WithRSAEncryption");b("1.2.840.113549.1.1.7","RSAES-OAEP");b("1.2.840.113549.1.1.8","mgf1");b("1.2.840.113549.1.1.9","pSpecified");b("1.2.840.113549.1.1.10","RSASSA-PSS");b("1.2.840.113549.1.1.11","sha256WithRSAEncryption");b("1.2.840.113549.1.1.12","sha384WithRSAEncryption");b("1.2.840.113549.1.1.13","sha512WithRSAEncryption");
|
450
|
+
b("1.3.101.112","EdDSA25519");b("1.2.840.10040.4.3","dsa-with-sha1");b("1.3.14.3.2.7","desCBC");b("1.3.14.3.2.26","sha1");b("2.16.840.1.101.3.4.2.1","sha256");b("2.16.840.1.101.3.4.2.2","sha384");b("2.16.840.1.101.3.4.2.3","sha512");b("1.2.840.113549.2.5","md5");b("1.2.840.113549.1.7.1","data");b("1.2.840.113549.1.7.2","signedData");b("1.2.840.113549.1.7.3","envelopedData");b("1.2.840.113549.1.7.4","signedAndEnvelopedData");b("1.2.840.113549.1.7.5","digestedData");b("1.2.840.113549.1.7.6","encryptedData");
|
451
|
+
b("1.2.840.113549.1.9.1","emailAddress");b("1.2.840.113549.1.9.2","unstructuredName");b("1.2.840.113549.1.9.3","contentType");b("1.2.840.113549.1.9.4","messageDigest");b("1.2.840.113549.1.9.5","signingTime");b("1.2.840.113549.1.9.6","counterSignature");b("1.2.840.113549.1.9.7","challengePassword");b("1.2.840.113549.1.9.8","unstructuredAddress");b("1.2.840.113549.1.9.14","extensionRequest");b("1.2.840.113549.1.9.20","friendlyName");b("1.2.840.113549.1.9.21","localKeyId");b("1.2.840.113549.1.9.22.1",
|
452
|
+
"x509Certificate");b("1.2.840.113549.1.12.10.1.1","keyBag");b("1.2.840.113549.1.12.10.1.2","pkcs8ShroudedKeyBag");b("1.2.840.113549.1.12.10.1.3","certBag");b("1.2.840.113549.1.12.10.1.4","crlBag");b("1.2.840.113549.1.12.10.1.5","secretBag");b("1.2.840.113549.1.12.10.1.6","safeContentsBag");b("1.2.840.113549.1.5.13","pkcs5PBES2");b("1.2.840.113549.1.5.12","pkcs5PBKDF2");b("1.2.840.113549.1.12.1.1","pbeWithSHAAnd128BitRC4");b("1.2.840.113549.1.12.1.2","pbeWithSHAAnd40BitRC4");b("1.2.840.113549.1.12.1.3",
|
453
|
+
"pbeWithSHAAnd3-KeyTripleDES-CBC");b("1.2.840.113549.1.12.1.4","pbeWithSHAAnd2-KeyTripleDES-CBC");b("1.2.840.113549.1.12.1.5","pbeWithSHAAnd128BitRC2-CBC");b("1.2.840.113549.1.12.1.6","pbewithSHAAnd40BitRC2-CBC");b("1.2.840.113549.2.7","hmacWithSHA1");b("1.2.840.113549.2.8","hmacWithSHA224");b("1.2.840.113549.2.9","hmacWithSHA256");b("1.2.840.113549.2.10","hmacWithSHA384");b("1.2.840.113549.2.11","hmacWithSHA512");b("1.2.840.113549.3.7","des-EDE3-CBC");b("2.16.840.1.101.3.4.1.2","aes128-CBC");b("2.16.840.1.101.3.4.1.22",
|
454
|
+
"aes192-CBC");b("2.16.840.1.101.3.4.1.42","aes256-CBC");b("2.5.4.3","commonName");b("2.5.4.5","serialName");b("2.5.4.6","countryName");b("2.5.4.7","localityName");b("2.5.4.8","stateOrProvinceName");b("2.5.4.9","streetAddress");b("2.5.4.10","organizationName");b("2.5.4.11","organizationalUnitName");b("2.5.4.13","description");b("2.5.4.15","businessCategory");b("2.5.4.17","postalCode");b("1.3.6.1.4.1.311.60.2.1.2","jurisdictionOfIncorporationStateOrProvinceName");b("1.3.6.1.4.1.311.60.2.1.3","jurisdictionOfIncorporationCountryName");
|
455
|
+
b("2.16.840.1.113730.1.1","nsCertType");b("2.16.840.1.113730.1.13","nsComment");c["2.5.29.1"]="authorityKeyIdentifier";c["2.5.29.2"]="keyAttributes";c["2.5.29.3"]="certificatePolicies";c["2.5.29.4"]="keyUsageRestriction";c["2.5.29.5"]="policyMapping";c["2.5.29.6"]="subtreesConstraint";c["2.5.29.7"]="subjectAltName";c["2.5.29.8"]="issuerAltName";c["2.5.29.9"]="subjectDirectoryAttributes";c["2.5.29.10"]="basicConstraints";c["2.5.29.11"]="nameConstraints";c["2.5.29.12"]="policyConstraints";c["2.5.29.13"]=
|
456
|
+
"basicConstraints";b("2.5.29.14","subjectKeyIdentifier");b("2.5.29.15","keyUsage");c["2.5.29.16"]="privateKeyUsagePeriod";b("2.5.29.17","subjectAltName");b("2.5.29.18","issuerAltName");b("2.5.29.19","basicConstraints");c["2.5.29.20"]="cRLNumber";c["2.5.29.21"]="cRLReason";c["2.5.29.22"]="expirationDate";c["2.5.29.23"]="instructionCode";c["2.5.29.24"]="invalidityDate";c["2.5.29.25"]="cRLDistributionPoints";c["2.5.29.26"]="issuingDistributionPoint";c["2.5.29.27"]="deltaCRLIndicator";c["2.5.29.28"]=
|
457
|
+
"issuingDistributionPoint";c["2.5.29.29"]="certificateIssuer";c["2.5.29.30"]="nameConstraints";b("2.5.29.31","cRLDistributionPoints");b("2.5.29.32","certificatePolicies");c["2.5.29.33"]="policyMappings";c["2.5.29.34"]="policyConstraints";b("2.5.29.35","authorityKeyIdentifier");c["2.5.29.36"]="policyConstraints";b("2.5.29.37","extKeyUsage");c["2.5.29.46"]="freshestCRL";c["2.5.29.54"]="inhibitAnyPolicy";b("1.3.6.1.4.1.11129.2.4.2","timestampList");b("1.3.6.1.5.5.7.1.1","authorityInfoAccess");b("1.3.6.1.5.5.7.3.1",
|
458
|
+
"serverAuth");b("1.3.6.1.5.5.7.3.2","clientAuth");b("1.3.6.1.5.5.7.3.3","codeSigning");b("1.3.6.1.5.5.7.3.4","emailProtection");b("1.3.6.1.5.5.7.3.8","timeStamping")});C(function(a){function b(a,b,c){if(c>b){var d=Error("Too few bytes to parse DER.");d.available=a.length();d.remaining=b;d.requested=c;throw d;}}function c(a,e,m,l){b(a,e,2);var f=a.getByte();e--;var h=f&192,k=f&31;var x=a.length();var u=e;var v=a.getByte();u--;if(128===v)u=void 0;else if(v&128?(v&=127,b(a,u,v),u=a.getInt(v<<3)):u=v,
|
459
|
+
0>u)throw Error("Negative length: "+u);e-=x-a.length();if(void 0!==u&&u>e){if(l.strict)throw m=Error("Too few bytes to read ASN.1 value."),m.available=a.length(),m.remaining=e,m.requested=u,m;u=e}var p;if(f=32===(f&32)){var q=[];if(void 0===u)for(;;){b(a,e,2);if(a.bytes(2)===String.fromCharCode(0,0)){a.getBytes(2);e-=2;break}x=a.length();q.push(c(a,e,m+1,l));e-=x-a.length()}else for(;0<u;)x=a.length(),q.push(c(a,u,m+1,l)),e-=x-a.length(),u-=x-a.length()}void 0===q&&h===d.Class.UNIVERSAL&&k===d.Type.BITSTRING&&
|
460
|
+
(p=a.bytes(u));if(void 0===q&&l.decodeBitStrings&&h===d.Class.UNIVERSAL&&k===d.Type.BITSTRING&&1<u){v=a.read;var Ha=e,R=0;k===d.Type.BITSTRING&&(b(a,e,1),R=a.getByte(),e--);if(0===R)try{x=a.length();var N=c(a,e,m+1,{verbose:l.verbose,strict:!0,decodeBitStrings:!0}),ea=x-a.length();e-=ea;k==d.Type.BITSTRING&&ea++;var O=N.tagClass;ea!==u||O!==d.Class.UNIVERSAL&&O!==d.Class.CONTEXT_SPECIFIC||(q=[N])}catch(Q){}void 0===q&&(a.read=v,e=Ha)}if(void 0===q){if(void 0===u){if(l.strict)throw Error("Non-constructed ASN.1 object of indefinite length.");
|
461
|
+
u=e}if(k===d.Type.BMPSTRING)for(q="";0<u;u-=2)b(a,e,2),q+=String.fromCharCode(a.getInt16()),e-=2;else q=a.getBytes(u)}return d.create(h,k,f,q,void 0===p?null:{bitStringContents:p})}var d=a.exports=k.asn1=k.asn1||{};d.Class={UNIVERSAL:0,APPLICATION:64,CONTEXT_SPECIFIC:128,PRIVATE:192};d.Type={NONE:0,BOOLEAN:1,INTEGER:2,BITSTRING:3,OCTETSTRING:4,NULL:5,OID:6,ODESC:7,EXTERNAL:8,REAL:9,ENUMERATED:10,EMBEDDED:11,UTF8:12,ROID:13,SEQUENCE:16,SET:17,PRINTABLESTRING:19,IA5STRING:22,UTCTIME:23,GENERALIZEDTIME:24,
|
462
|
+
BMPSTRING:30};d.create=function(a,b,c,e,n){if(k.util.isArray(e)){for(var f=[],h=0;h<e.length;++h)void 0!==e[h]&&f.push(e[h]);e=f}a={tagClass:a,type:b,constructed:c,composed:c||k.util.isArray(e),value:e};n&&"bitStringContents"in n&&(a.bitStringContents=n.bitStringContents,a.original=d.copy(a));return a};d.copy=function(a,b){if(k.util.isArray(a)){var c=[];for(var e=0;e<a.length;++e)c.push(d.copy(a[e],b));return c}if("string"===typeof a)return a;c={tagClass:a.tagClass,type:a.type,constructed:a.constructed,
|
463
|
+
composed:a.composed,value:d.copy(a.value,b)};b&&!b.excludeBitStringContents&&(c.bitStringContents=a.bitStringContents);return c};d.equals=function(a,b,c){if(k.util.isArray(a)){if(!k.util.isArray(b)||a.length!==b.length)return!1;for(c=0;c<a.length;++c)if(!d.equals(a[c],b[c]))return!1;return!0}if(typeof a!==typeof b)return!1;if("string"===typeof a)return a===b;var e=a.tagClass===b.tagClass&&a.type===b.type&&a.constructed===b.constructed&&a.composed===b.composed&&d.equals(a.value,b.value);c&&c.includeBitStringContents&&
|
464
|
+
(e=e&&a.bitStringContents===b.bitStringContents);return e};d.getBerValueLength=function(a){var b=a.getByte();if(128!==b)return b&128?a.getInt((b&127)<<3):b};d.fromDer=function(a,b){void 0===b&&(b={strict:!0,decodeBitStrings:!0});"boolean"===typeof b&&(b={strict:b,decodeBitStrings:!0});"strict"in b||(b.strict=!0);"decodeBitStrings"in b||(b.decodeBitStrings=!0);"string"===typeof a&&(a=k.util.createBuffer(a));return c(a,a.length(),0,b)};d.toDer=function(a){var b=k.util.createBuffer(),c=a.tagClass|a.type,
|
465
|
+
e=k.util.createBuffer(),f=!1;"bitStringContents"in a&&(f=!0,a.original&&(f=d.equals(a,a.original)));if(f)e.putBytes(a.bitStringContents);else if(a.composed)for(a.constructed?c|=32:e.putByte(0),f=0;f<a.value.length;++f)void 0!==a.value[f]&&e.putBuffer(d.toDer(a.value[f]));else if(a.type===d.Type.BMPSTRING)for(f=0;f<a.value.length;++f)e.putInt16(a.value.charCodeAt(f));else a.type===d.Type.INTEGER&&1<a.value.length&&(0===a.value.charCodeAt(0)&&0===(a.value.charCodeAt(1)&128)||255===a.value.charCodeAt(0)&&
|
466
|
+
128===(a.value.charCodeAt(1)&128))?e.putBytes(a.value.substr(1)):e.putBytes(a.value);b.putByte(c);if(127>=e.length())b.putByte(e.length()&127);else{c=e.length();a="";do a+=String.fromCharCode(c&255),c>>>=8;while(0<c);b.putByte(a.length|128);for(f=a.length-1;0<=f;--f)b.putByte(a.charCodeAt(f))}b.putBuffer(e);return b};d.oidToDer=function(a){a=a.split(".");var b=k.util.createBuffer();b.putByte(40*parseInt(a[0],10)+parseInt(a[1],10));for(var c,d,e,f,r=2;r<a.length;++r){c=!0;d=[];e=parseInt(a[r],10);
|
467
|
+
do f=e&127,e>>>=7,c||(f|=128),d.push(f),c=!1;while(0<e);for(c=d.length-1;0<=c;--c)b.putByte(d[c])}return b};d.derToOid=function(a){"string"===typeof a&&(a=k.util.createBuffer(a));var b=a.getByte();var c=Math.floor(b/40)+"."+b%40;for(var d=0;0<a.length();)b=a.getByte(),d<<=7,b&128?d+=b&127:(c+="."+(d+b),d=0);return c};d.utcTimeToDate=function(a){var b=new Date,c=parseInt(a.substr(0,2),10);c=50<=c?1900+c:2E3+c;var d=parseInt(a.substr(2,2),10)-1,e=parseInt(a.substr(4,2),10),f=parseInt(a.substr(6,2),
|
468
|
+
10),k=parseInt(a.substr(8,2),10),x=0;if(11<a.length){var u=a.charAt(10),v=10;"+"!==u&&"-"!==u&&(x=parseInt(a.substr(10,2),10),v+=2)}b.setUTCFullYear(c,d,e);b.setUTCHours(f,k,x,0);v&&(u=a.charAt(v),"+"===u||"-"===u)&&(c=parseInt(a.substr(v+1,2),10),a=parseInt(a.substr(v+4,2),10),a=6E4*(60*c+a),"+"===u?b.setTime(+b-a):b.setTime(+b+a));return b};d.generalizedTimeToDate=function(a){var b=new Date,c=parseInt(a.substr(0,4),10),d=parseInt(a.substr(4,2),10)-1,e=parseInt(a.substr(6,2),10),f=parseInt(a.substr(8,
|
469
|
+
2),10),k=parseInt(a.substr(10,2),10),x=parseInt(a.substr(12,2),10),u=0,v=0,p=!1;"Z"===a.charAt(a.length-1)&&(p=!0);var q=a.length-5,Ha=a.charAt(q);if("+"===Ha||"-"===Ha)v=parseInt(a.substr(q+1,2),10),q=parseInt(a.substr(q+4,2),10),v=6E4*(60*v+q),"+"===Ha&&(v*=-1),p=!0;"."===a.charAt(14)&&(u=1E3*parseFloat(a.substr(14),10));p?(b.setUTCFullYear(c,d,e),b.setUTCHours(f,k,x,u),b.setTime(+b+v)):(b.setFullYear(c,d,e),b.setHours(f,k,x,u));return b};d.dateToUtcTime=function(a){if("string"===typeof a)return a;
|
470
|
+
var b="",c=[];c.push((""+a.getUTCFullYear()).substr(2));c.push(""+(a.getUTCMonth()+1));c.push(""+a.getUTCDate());c.push(""+a.getUTCHours());c.push(""+a.getUTCMinutes());c.push(""+a.getUTCSeconds());for(a=0;a<c.length;++a)2>c[a].length&&(b+="0"),b+=c[a];return b+"Z"};d.dateToGeneralizedTime=function(a){if("string"===typeof a)return a;var b="",c=[];c.push(""+a.getUTCFullYear());c.push(""+(a.getUTCMonth()+1));c.push(""+a.getUTCDate());c.push(""+a.getUTCHours());c.push(""+a.getUTCMinutes());c.push(""+
|
471
|
+
a.getUTCSeconds());for(a=0;a<c.length;++a)2>c[a].length&&(b+="0"),b+=c[a];return b+"Z"};d.integerToDer=function(a){var b=k.util.createBuffer();if(-128<=a&&128>a)return b.putSignedInt(a,8);if(-32768<=a&&32768>a)return b.putSignedInt(a,16);if(-8388608<=a&&8388608>a)return b.putSignedInt(a,24);if(-2147483648<=a&&2147483648>a)return b.putSignedInt(a,32);b=Error("Integer too large; max is 32-bits.");b.integer=a;throw b;};d.derToInteger=function(a){"string"===typeof a&&(a=k.util.createBuffer(a));var b=
|
472
|
+
8*a.length();if(32<b)throw Error("Integer too large; max is 32-bits.");return a.getSignedInt(b)};d.validate=function(a,b,c,e){var f=!1;if(a.tagClass!==b.tagClass&&"undefined"!==typeof b.tagClass||a.type!==b.type&&"undefined"!==typeof b.type)e&&(a.tagClass!==b.tagClass&&e.push("["+b.name+'] Expected tag class "'+b.tagClass+'", got "'+a.tagClass+'"'),a.type!==b.type&&e.push("["+b.name+'] Expected type "'+b.type+'", got "'+a.type+'"'));else if(a.constructed===b.constructed||"undefined"===typeof b.constructed){f=
|
473
|
+
!0;if(b.value&&k.util.isArray(b.value))for(var h=0,l=0;f&&l<b.value.length;++l)f=b.value[l].optional||!1,a.value[h]&&((f=d.validate(a.value[h],b.value[l],c,e))?++h:b.value[l].optional&&(f=!0)),!f&&e&&e.push("["+b.name+'] Tag class "'+b.tagClass+'", type "'+b.type+'" expected value length "'+b.value.length+'", got "'+a.value.length+'"');if(f&&c&&(b.capture&&(c[b.capture]=a.value),b.captureAsn1&&(c[b.captureAsn1]=a),b.captureBitStringContents&&"bitStringContents"in a&&(c[b.captureBitStringContents]=
|
474
|
+
a.bitStringContents),b.captureBitStringValue&&"bitStringContents"in a))if(2>a.bitStringContents.length)c[b.captureBitStringValue]="";else{if(0!==a.bitStringContents.charCodeAt(0))throw Error("captureBitStringValue only supported for zero unused bits");c[b.captureBitStringValue]=a.bitStringContents.slice(1)}}else e&&e.push("["+b.name+'] Expected constructed "'+b.constructed+'", got "'+a.constructed+'"');return f};var e=/[^\\u0000-\\u00ff]/;d.prettyPrint=function(a,b,c){var f="";b=b||0;c=c||2;0<b&&
|
475
|
+
(f+="\n");for(var h="",m=0;m<b*c;++m)h+=" ";f+=h+"Tag: ";switch(a.tagClass){case d.Class.UNIVERSAL:f+="Universal:";break;case d.Class.APPLICATION:f+="Application:";break;case d.Class.CONTEXT_SPECIFIC:f+="Context-Specific:";break;case d.Class.PRIVATE:f+="Private:"}if(a.tagClass===d.Class.UNIVERSAL)switch(f+=a.type,a.type){case d.Type.NONE:f+=" (None)";break;case d.Type.BOOLEAN:f+=" (Boolean)";break;case d.Type.INTEGER:f+=" (Integer)";break;case d.Type.BITSTRING:f+=" (Bit string)";break;case d.Type.OCTETSTRING:f+=
|
476
|
+
" (Octet string)";break;case d.Type.NULL:f+=" (Null)";break;case d.Type.OID:f+=" (Object Identifier)";break;case d.Type.ODESC:f+=" (Object Descriptor)";break;case d.Type.EXTERNAL:f+=" (External or Instance of)";break;case d.Type.REAL:f+=" (Real)";break;case d.Type.ENUMERATED:f+=" (Enumerated)";break;case d.Type.EMBEDDED:f+=" (Embedded PDV)";break;case d.Type.UTF8:f+=" (UTF8)";break;case d.Type.ROID:f+=" (Relative Object Identifier)";break;case d.Type.SEQUENCE:f+=" (Sequence)";break;case d.Type.SET:f+=
|
477
|
+
" (Set)";break;case d.Type.PRINTABLESTRING:f+=" (Printable String)";break;case d.Type.IA5String:f+=" (IA5String (ASCII))";break;case d.Type.UTCTIME:f+=" (UTC time)";break;case d.Type.GENERALIZEDTIME:f+=" (Generalized time)";break;case d.Type.BMPSTRING:f+=" (BMP String)"}else f+=a.type;f=f+"\n"+(h+"Constructed: "+a.constructed+"\n");if(a.composed){var r=0,x="";for(m=0;m<a.value.length;++m)void 0!==a.value[m]&&(r+=1,x+=d.prettyPrint(a.value[m],b+1,c),m+1<a.value.length&&(x+=","));f+=h+"Sub values: "+
|
478
|
+
r+x}else if(f+=h+"Value: ",a.type===d.Type.OID&&(b=d.derToOid(a.value),f+=b,k.pki&&k.pki.oids&&b in k.pki.oids&&(f+=" ("+k.pki.oids[b]+") ")),a.type===d.Type.INTEGER)try{f+=d.derToInteger(a.value)}catch(u){f+="0x"+k.util.bytesToHex(a.value)}else a.type===d.Type.BITSTRING?(f=1<a.value.length?f+("0x"+k.util.bytesToHex(a.value.slice(1))):f+"(none)",0<a.value.length&&(a=a.value.charCodeAt(0),1==a?f+=" (1 unused bit shown)":1<a&&(f+=" ("+a+" unused bits shown)"))):a.type===d.Type.OCTETSTRING?(e.test(a.value)||
|
479
|
+
(f+="("+a.value+") "),f+="0x"+k.util.bytesToHex(a.value)):f=a.type===d.Type.UTF8?f+k.util.decodeUtf8(a.value):a.type===d.Type.PRINTABLESTRING||a.type===d.Type.IA5String?f+a.value:e.test(a.value)?f+("0x"+k.util.bytesToHex(a.value)):0===a.value.length?f+"[null]":f+a.value;return f}});k.md=k.md||{};k.md.algorithms=k.md.algorithms||{};C(function(a){(a.exports=k.hmac=k.hmac||{}).create=function(){var a=null,c=null,d=null,e={start:function(b,e){if(null!==b)if("string"===typeof b)if(b=b.toLowerCase(),b in
|
480
|
+
k.md.algorithms)a=k.md.algorithms[b].create();else throw Error('Unknown hash algorithm "'+b+'"');else a=b;if(null!==e){if("string"===typeof e)e=k.util.createBuffer(e);else if(k.util.isArray(e)){b=e;e=k.util.createBuffer();for(var f=0;f<b.length;++f)e.putByte(b[f])}var h=e.length();h>a.blockLength&&(a.start(),a.update(e.bytes()),e=a.digest());c=k.util.createBuffer();d=k.util.createBuffer();h=e.length();for(f=0;f<h;++f)b=e.at(f),c.putByte(54^b),d.putByte(92^b);if(h<a.blockLength)for(b=a.blockLength-
|
481
|
+
h,f=0;f<b;++f)c.putByte(54),d.putByte(92);c=c.bytes();d=d.bytes()}a.start();a.update(c)},update:function(b){a.update(b)},getMac:function(){var b=a.digest().bytes();a.start();a.update(d);a.update(b);return a.digest()}};e.digest=e.getMac;return e}});C(function(a){function b(){d=String.fromCharCode(128);d+=k.util.fillString(String.fromCharCode(0),64);e=[0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,1,6,11,0,5,10,15,4,9,14,3,8,13,2,7,12,5,8,11,14,1,4,7,10,13,0,3,6,9,12,15,2,0,7,14,5,12,3,10,1,8,15,6,13,4,11,
|
482
|
+
2,9];f=[7,12,17,22,7,12,17,22,7,12,17,22,7,12,17,22,5,9,14,20,5,9,14,20,5,9,14,20,5,9,14,20,4,11,16,23,4,11,16,23,4,11,16,23,4,11,16,23,6,10,15,21,6,10,15,21,6,10,15,21,6,10,15,21];h=Array(64);for(var a=0;64>a;++a)h[a]=Math.floor(4294967296*Math.abs(Math.sin(a+1)));m=!0}function c(a,b,c){for(var d,l,k,m,n,X,p,R=c.length();64<=R;){l=a.h0;k=a.h1;m=a.h2;n=a.h3;for(p=0;16>p;++p)b[p]=c.getInt32Le(),d=n^k&(m^n),d=l+d+h[p]+b[p],X=f[p],l=n,n=m,m=k,k+=d<<X|d>>>32-X;for(;32>p;++p)d=m^n&(k^m),d=l+d+h[p]+b[e[p]],
|
483
|
+
X=f[p],l=n,n=m,m=k,k+=d<<X|d>>>32-X;for(;48>p;++p)d=k^m^n,d=l+d+h[p]+b[e[p]],X=f[p],l=n,n=m,m=k,k+=d<<X|d>>>32-X;for(;64>p;++p)d=m^(k|~n),d=l+d+h[p]+b[e[p]],X=f[p],l=n,n=m,m=k,k+=d<<X|d>>>32-X;a.h0=a.h0+l|0;a.h1=a.h1+k|0;a.h2=a.h2+m|0;a.h3=a.h3+n|0;R-=64}}a=a.exports=k.md5=k.md5||{};k.md.md5=k.md.algorithms.md5=a;a.create=function(){m||b();var a=null,e=k.util.createBuffer(),f=Array(16),h={algorithm:"md5",blockLength:64,digestLength:16,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){h.messageLength=
|
484
|
+
0;h.fullMessageLength=h.messageLength64=[];for(var b=h.messageLengthSize/4,c=0;c<b;++c)h.fullMessageLength.push(0);e=k.util.createBuffer();a={h0:1732584193,h1:4023233417,h2:2562383102,h3:271733878};return h}};h.start();h.update=function(b,d){"utf8"===d&&(b=k.util.encodeUtf8(b));d=b.length;h.messageLength+=d;d=[d/4294967296>>>0,d>>>0];for(var l=h.fullMessageLength.length-1;0<=l;--l)h.fullMessageLength[l]+=d[1],d[1]=d[0]+(h.fullMessageLength[l]/4294967296>>>0),h.fullMessageLength[l]>>>=0,d[0]=d[1]/
|
485
|
+
4294967296>>>0;e.putBytes(b);c(a,f,e);(2048<e.read||0===e.length())&&e.compact();return h};h.digest=function(){var b=k.util.createBuffer();b.putBytes(e.bytes());b.putBytes(d.substr(0,h.blockLength-(h.fullMessageLength[h.fullMessageLength.length-1]+h.messageLengthSize&h.blockLength-1)));for(var l,m=0,n=h.fullMessageLength.length-1;0<=n;--n)l=8*h.fullMessageLength[n]+m,m=l/4294967296>>>0,b.putInt32Le(l>>>0);l={h0:a.h0,h1:a.h1,h2:a.h2,h3:a.h3};c(l,f,b);b=k.util.createBuffer();b.putInt32Le(l.h0);b.putInt32Le(l.h1);
|
486
|
+
b.putInt32Le(l.h2);b.putInt32Le(l.h3);return b};return h};var d=null,e=null,f=null,h=null,m=!1});C(function(a){function b(a){for(var b=a.name+": ",c=[],f=function(a,b){return" "+b},h=0;h<a.values.length;++h)c.push(a.values[h].replace(/^(\S+\r\n)/,f));b+=c.join(",")+"\r\n";c=0;a=-1;for(h=0;h<b.length;++h,++c)if(65<c&&-1!==a)c=b[a],","===c?(++a,b=b.substr(0,a)+"\r\n "+b.substr(a)):b=b.substr(0,a)+"\r\n"+c+b.substr(a+1),c=h-a-1,a=-1,++h;else if(" "===b[h]||"\t"===b[h]||","===b[h])a=h;return b}a=a.exports=
|
487
|
+
k.pem=k.pem||{};a.encode=function(a,d){d=d||{};var c="-----BEGIN "+a.type+"-----\r\n";if(a.procType){var f={name:"Proc-Type",values:[String(a.procType.version),a.procType.type]};c+=b(f)}a.contentDomain&&(f={name:"Content-Domain",values:[a.contentDomain]},c+=b(f));a.dekInfo&&(f={name:"DEK-Info",values:[a.dekInfo.algorithm]},a.dekInfo.parameters&&f.values.push(a.dekInfo.parameters),c+=b(f));if(a.headers)for(f=0;f<a.headers.length;++f)c+=b(a.headers[f]);a.procType&&(c+="\r\n");c+=k.util.encode64(a.body,
|
488
|
+
d.maxline||64)+"\r\n";return c+="-----END "+a.type+"-----\r\n"};a.decode=function(a){for(var b=[],c=/\s*-----BEGIN ([A-Z0-9- ]+)-----\r?\n?([\x21-\x7e\s]+?(?:\r?\n\r?\n))?([:A-Za-z0-9+\/=\s]+?)-----END \1-----/g,f=/([\x21-\x7e]+):\s*([\x21-\x7e\s^:]+)/,h=/\r?\n/,m;;){m=c.exec(a);if(!m)break;var l={type:m[1],procType:null,contentDomain:null,dekInfo:null,headers:[],body:k.util.decode64(m[3])};b.push(l);if(m[2]){for(var n=m[2].split(h),p=0;m&&p<n.length;){m=n[p].replace(/\s+$/,"");for(var r=p+1;r<n.length;++r){var x=
|
489
|
+
n[r];if(!/\s/.test(x[0]))break;m+=x;p=r}if(m=m.match(f)){r={name:m[1],values:[]};x=m[2].split(",");for(var u=0;u<x.length;++u)r.values.push(x[u].replace(/^\s+/,""));if(l.procType)if(l.contentDomain||"Content-Domain"!==r.name)if(l.dekInfo||"DEK-Info"!==r.name)l.headers.push(r);else{if(0===r.values.length)throw Error('Invalid PEM formatted message. The "DEK-Info" header must have at least one subfield.');l.dekInfo={algorithm:x[0],parameters:x[1]||null}}else l.contentDomain=x[0]||"";else{if("Proc-Type"!==
|
490
|
+
r.name)throw Error('Invalid PEM formatted message. The first encapsulated header must be "Proc-Type".');if(2!==r.values.length)throw Error('Invalid PEM formatted message. The "Proc-Type" header must have two subfields.');l.procType={version:x[0],type:x[1]}}}++p}if("ENCRYPTED"===l.procType&&!l.dekInfo)throw Error('Invalid PEM formatted message. The "DEK-Info" header must be present if "Proc-Type" is "ENCRYPTED".');}}if(0===b.length)throw Error("Invalid PEM formatted message.");return b}});k.des=k.des||
|
491
|
+
{};k.des.startEncrypting=function(a,b,c,d){a=Bd({key:a,output:c,decrypt:!1,mode:d||(null===b?"ECB":"CBC")});a.start(b);return a};k.des.createEncryptionCipher=function(a,b){return Bd({key:a,output:null,decrypt:!1,mode:b})};k.des.startDecrypting=function(a,b,c,d){a=Bd({key:a,output:c,decrypt:!0,mode:d||(null===b?"ECB":"CBC")});a.start(b);return a};k.des.createDecryptionCipher=function(a,b){return Bd({key:a,output:null,decrypt:!0,mode:b})};k.des.Algorithm=function(a,b){var c=this;c.name=a;c.mode=new b({blockSize:8,
|
492
|
+
cipher:{encrypt:function(a,b){return Tg(c._keys,a,b,!1)},decrypt:function(a,b){return Tg(c._keys,a,b,!0)}}});c._init=!1};k.des.Algorithm.prototype.initialize=function(a){if(!this._init){a=k.util.createBuffer(a.key);if(0===this.name.indexOf("3DES")&&24!==a.length())throw Error("Invalid Triple-DES key size: "+8*a.length());for(var b=[0,4,536870912,536870916,65536,65540,536936448,536936452,512,516,536871424,536871428,66048,66052,536936960,536936964],c=[0,1,1048576,1048577,67108864,67108865,68157440,
|
493
|
+
68157441,256,257,1048832,1048833,67109120,67109121,68157696,68157697],d=[0,8,2048,2056,16777216,16777224,16779264,16779272,0,8,2048,2056,16777216,16777224,16779264,16779272],e=[0,2097152,134217728,136314880,8192,2105344,134225920,136323072,131072,2228224,134348800,136445952,139264,2236416,134356992,136454144],f=[0,262144,16,262160,0,262144,16,262160,4096,266240,4112,266256,4096,266240,4112,266256],h=[0,1024,32,1056,0,1024,32,1056,33554432,33555456,33554464,33555488,33554432,33555456,33554464,33555488],
|
494
|
+
m=[0,268435456,524288,268959744,2,268435458,524290,268959746,0,268435456,524288,268959744,2,268435458,524290,268959746],l=[0,65536,2048,67584,536870912,536936448,536872960,536938496,131072,196608,133120,198656,537001984,537067520,537004032,537069568],n=[0,262144,0,262144,2,262146,2,262146,33554432,33816576,33554432,33816576,33554434,33816578,33554434,33816578],p=[0,268435456,8,268435464,0,268435456,8,268435464,1024,268436480,1032,268436488,1024,268436480,1032,268436488],r=[0,32,0,32,1048576,1048608,
|
495
|
+
1048576,1048608,8192,8224,8192,8224,1056768,1056800,1056768,1056800],x=[0,16777216,512,16777728,2097152,18874368,2097664,18874880,67108864,83886080,67109376,83886592,69206016,85983232,69206528,85983744],u=[0,4096,134217728,134221824,524288,528384,134742016,134746112,16,4112,134217744,134221840,524304,528400,134742032,134746128],v=[0,4,256,260,0,4,256,260,1,5,257,261,1,5,257,261],q=8<a.length()?3:1,t=[],Ha=[0,0,1,1,1,1,1,1,0,1,1,1,1,1,1,0],R=0,N,ea=0;ea<q;ea++){var O=a.getInt32(),Q=a.getInt32();N=
|
496
|
+
(O>>>4^Q)&252645135;Q^=N;O^=N<<4;N=(Q>>>-16^O)&65535;O^=N;Q^=N<<-16;N=(O>>>2^Q)&858993459;Q^=N;O^=N<<2;N=(Q>>>-16^O)&65535;O^=N;Q^=N<<-16;N=(O>>>1^Q)&1431655765;Q^=N;O^=N<<1;N=(Q>>>8^O)&16711935;O^=N;Q^=N<<8;N=(O>>>1^Q)&1431655765;Q^=N;O^=N<<1;N=O<<8|Q>>>20&240;O=Q<<24|Q<<8&16711680|Q>>>8&65280|Q>>>24&240;Q=N;for(var Ba=0;Ba<Ha.length;++Ba){Ha[Ba]?(O=O<<2|O>>>26,Q=Q<<2|Q>>>26):(O=O<<1|O>>>27,Q=Q<<1|Q>>>27);O&=-15;Q&=-15;var w=b[O>>>28]|c[O>>>24&15]|d[O>>>20&15]|e[O>>>16&15]|f[O>>>12&15]|h[O>>>8&15]|
|
497
|
+
m[O>>>4&15],y=l[Q>>>28]|n[Q>>>24&15]|p[Q>>>20&15]|r[Q>>>16&15]|x[Q>>>12&15]|u[Q>>>8&15]|v[Q>>>4&15];N=(y>>>16^w)&65535;t[R++]=w^N;t[R++]=y^N<<16}}this._keys=t;this._init=!0}};db("DES-ECB",k.cipher.modes.ecb);db("DES-CBC",k.cipher.modes.cbc);db("DES-CFB",k.cipher.modes.cfb);db("DES-OFB",k.cipher.modes.ofb);db("DES-CTR",k.cipher.modes.ctr);db("3DES-ECB",k.cipher.modes.ecb);db("3DES-CBC",k.cipher.modes.cbc);db("3DES-CFB",k.cipher.modes.cfb);db("3DES-OFB",k.cipher.modes.ofb);db("3DES-CTR",k.cipher.modes.ctr);
|
498
|
+
var vl=[16843776,0,65536,16843780,16842756,66564,4,65536,1024,16843776,16843780,1024,16778244,16842756,16777216,4,1028,16778240,16778240,66560,66560,16842752,16842752,16778244,65540,16777220,16777220,65540,0,1028,66564,16777216,65536,16843780,4,16842752,16843776,16777216,16777216,1024,16842756,65536,66560,16777220,1024,4,16778244,66564,16843780,65540,16842752,16778244,16777220,1028,66564,16843776,1028,16778240,16778240,0,65540,66560,0,16842756],rl=[-2146402272,-2147450880,32768,1081376,1048576,32,
|
499
|
+
-2146435040,-2147450848,-2147483616,-2146402272,-2146402304,-2147483648,-2147450880,1048576,32,-2146435040,1081344,1048608,-2147450848,0,-2147483648,32768,1081376,-2146435072,1048608,-2147483616,0,1081344,32800,-2146402304,-2146435072,32800,0,1081376,-2146435040,1048576,-2147450848,-2146435072,-2146402304,32768,-2146435072,-2147450880,32,-2146402272,1081376,32,32768,-2147483648,32800,-2146402304,1048576,-2147483616,1048608,-2147450848,-2147483616,1048608,1081344,0,-2147450880,32800,-2147483648,-2146435040,
|
500
|
+
-2146402272,1081344],wl=[520,134349312,0,134348808,134218240,0,131592,134218240,131080,134217736,134217736,131072,134349320,131080,134348800,520,134217728,8,134349312,512,131584,134348800,134348808,131592,134218248,131584,131072,134218248,8,134349320,512,134217728,134349312,134217728,131080,520,131072,134349312,134218240,0,512,131080,134349320,134218240,134217736,512,0,134348808,134218248,131072,134217728,134349320,8,131592,131584,134217736,134348800,134218248,520,134348800,131592,8,134348808,131584],
|
501
|
+
sl=[8396801,8321,8321,128,8396928,8388737,8388609,8193,0,8396800,8396800,8396929,129,0,8388736,8388609,1,8192,8388608,8396801,128,8388608,8193,8320,8388737,1,8320,8388736,8192,8396928,8396929,129,8388736,8388609,8396800,8396929,129,0,0,8396800,8320,8388736,8388737,1,8396801,8321,8321,128,8396929,129,1,8192,8388609,8193,8396928,8388737,8193,8320,8388608,8396801,128,8388608,8192,8396928],xl=[256,34078976,34078720,1107296512,524288,256,1073741824,34078720,1074266368,524288,33554688,1074266368,1107296512,
|
502
|
+
1107820544,524544,1073741824,33554432,1074266112,1074266112,0,1073742080,1107820800,1107820800,33554688,1107820544,1073742080,0,1107296256,34078976,33554432,1107296256,524544,524288,1107296512,256,33554432,1073741824,34078720,1107296512,1074266368,33554688,1073741824,1107820544,34078976,1074266368,256,33554432,1107820544,1107820800,524544,1107296256,1107820800,34078720,0,1074266112,1107296256,524544,33554688,1073742080,524288,0,1074266112,34078976,1073742080],tl=[536870928,541065216,16384,541081616,
|
503
|
+
541065216,16,541081616,4194304,536887296,4210704,4194304,536870928,4194320,536887296,536870912,16400,0,4194320,536887312,16384,4210688,536887312,16,541065232,541065232,0,4210704,541081600,16400,4210688,541081600,536870912,536887296,16,541065232,4210688,541081616,4194304,16400,536870928,4194304,536887296,536870912,16400,536870928,541081616,4210688,541065216,4210704,541081600,0,541065232,16,16384,541065216,4210704,16384,4194320,536887312,0,541081600,536870912,4194320,536887312],yl=[2097152,69206018,
|
504
|
+
67110914,0,2048,67110914,2099202,69208064,69208066,2097152,0,67108866,2,67108864,69206018,2050,67110912,2099202,2097154,67110912,67108866,69206016,69208064,2097154,69206016,2048,2050,69208066,2099200,2,67108864,2099200,67108864,2099200,2097152,67110914,67110914,69206018,69206018,2,2097154,67108864,67110912,2097152,69208064,2050,2099202,69208064,2050,67108866,69208066,69206016,2099200,0,2,69208066,0,2099202,69206016,2048,67108866,67110912,2048,2097154],ul=[268439616,4096,262144,268701760,268435456,
|
505
|
+
268439616,64,268435456,262208,268697600,268701760,266240,268701696,266304,4096,64,268697600,268435520,268439552,4160,266240,262208,268697664,268701696,4160,0,0,268697664,268435520,268439552,266304,262144,266304,262144,268701696,4096,64,268697664,4096,266304,268439552,64,268435520,268697600,268697664,268435456,262144,268439616,0,268701760,262208,268435520,268697600,268439552,268439616,0,268701760,266240,266240,4160,4160,262208,268435456,268701696],Lp=Object.freeze({__proto__:null,"default":{}}),$f=
|
506
|
+
mb(Lp),Mp=k.pkcs5=k.pkcs5||{},wb;k.util.isNodejs&&!k.options.usePureJavaScript&&(wb=$f);k.pbkdf2=Mp.pbkdf2=function(a,b,c,d,e,f){function h(){if(v>n)return f(null,x);r.start(null,null);r.update(b);r.update(k.util.int32ToBytes(v));q=u=r.digest().getBytes();t=2;m()}function m(){if(t<=c)return r.start(null,null),r.update(u),Ha=r.digest().getBytes(),q=k.util.xorBytes(q,Ha,l),u=Ha,++t,k.util.setImmediate(m);x+=v<n?q:q.substr(0,p);++v;h()}"function"===typeof e&&(f=e,e=null);if(k.util.isNodejs&&!k.options.usePureJavaScript&&
|
507
|
+
wb.pbkdf2&&(null===e||"object"!==typeof e)&&(4<wb.pbkdf2Sync.length||!e||"sha1"===e))return"string"!==typeof e&&(e="sha1"),a=Buffer.from(a,"binary"),b=Buffer.from(b,"binary"),f?4===wb.pbkdf2Sync.length?wb.pbkdf2(a,b,c,d,function(a,b){if(a)return f(a);f(null,b.toString("binary"))}):wb.pbkdf2(a,b,c,d,e,function(a,b){if(a)return f(a);f(null,b.toString("binary"))}):4===wb.pbkdf2Sync.length?wb.pbkdf2Sync(a,b,c,d).toString("binary"):wb.pbkdf2Sync(a,b,c,d,e).toString("binary");if("undefined"===typeof e||
|
508
|
+
null===e)e="sha1";if("string"===typeof e){if(!(e in k.md.algorithms))throw Error("Unknown hash algorithm: "+e);e=k.md[e].create()}var l=e.digestLength;if(d>4294967295*l){a=Error("Derived key is too long.");if(f)return f(a);throw a;}var n=Math.ceil(d/l),p=d-(n-1)*l,r=k.hmac.create();r.start(e,a);var x="",u;if(!f){for(var v=1;v<=n;++v){r.start(null,null);r.update(b);r.update(k.util.int32ToBytes(v));var q=u=r.digest().getBytes();for(var t=2;t<=c;++t){r.start(null,null);r.update(u);var Ha=r.digest().getBytes();
|
509
|
+
q=k.util.xorBytes(q,Ha,l);u=Ha}x+=v<n?q:q.substr(0,p)}return x}v=1;h()};C(function(a){function b(a,b,c){for(var d,f,h,k,m,u,v,p,q,t,R,N,ea,O=c.length();64<=O;){for(m=0;16>m;++m)b[m]=c.getInt32();for(;64>m;++m)d=b[m-2],d=(d>>>17|d<<15)^(d>>>19|d<<13)^d>>>10,f=b[m-15],f=(f>>>7|f<<25)^(f>>>18|f<<14)^f>>>3,b[m]=d+b[m-7]+f+b[m-16]|0;u=a.h0;v=a.h1;p=a.h2;q=a.h3;t=a.h4;R=a.h5;N=a.h6;ea=a.h7;for(m=0;64>m;++m)d=(t>>>6|t<<26)^(t>>>11|t<<21)^(t>>>25|t<<7),h=N^t&(R^N),f=(u>>>2|u<<30)^(u>>>13|u<<19)^(u>>>22|u<<
|
510
|
+
10),k=u&v|p&(u^v),d=ea+d+h+e[m]+b[m],f+=k,ea=N,N=R,R=t,t=q+d>>>0,q=p,p=v,v=u,u=d+f>>>0;a.h0=a.h0+u|0;a.h1=a.h1+v|0;a.h2=a.h2+p|0;a.h3=a.h3+q|0;a.h4=a.h4+t|0;a.h5=a.h5+R|0;a.h6=a.h6+N|0;a.h7=a.h7+ea|0;O-=64}}a=a.exports=k.sha256=k.sha256||{};k.md.sha256=k.md.algorithms.sha256=a;a.create=function(){d||(c=String.fromCharCode(128),c+=k.util.fillString(String.fromCharCode(0),64),e=[1116352408,1899447441,3049323471,3921009573,961987163,1508970993,2453635748,2870763221,3624381080,310598401,607225278,1426881987,
|
511
|
+
1925078388,2162078206,2614888103,3248222580,3835390401,4022224774,264347078,604807628,770255983,1249150122,1555081692,1996064986,2554220882,2821834349,2952996808,3210313671,3336571891,3584528711,113926993,338241895,666307205,773529912,1294757372,1396182291,1695183700,1986661051,2177026350,2456956037,2730485921,2820302411,3259730800,3345764771,3516065817,3600352804,4094571909,275423344,430227734,506948616,659060556,883997877,958139571,1322822218,1537002063,1747873779,1955562222,2024104815,2227730452,
|
512
|
+
2361852424,2428436474,2756734187,3204031479,3329325298],d=!0);var a=null,h=k.util.createBuffer(),m=Array(64),l={algorithm:"sha256",blockLength:64,digestLength:32,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){l.messageLength=0;l.fullMessageLength=l.messageLength64=[];for(var b=l.messageLengthSize/4,c=0;c<b;++c)l.fullMessageLength.push(0);h=k.util.createBuffer();a={h0:1779033703,h1:3144134277,h2:1013904242,h3:2773480762,h4:1359893119,h5:2600822924,h6:528734635,h7:1541459225};
|
513
|
+
return l}};l.start();l.update=function(c,d){"utf8"===d&&(c=k.util.encodeUtf8(c));d=c.length;l.messageLength+=d;d=[d/4294967296>>>0,d>>>0];for(var e=l.fullMessageLength.length-1;0<=e;--e)l.fullMessageLength[e]+=d[1],d[1]=d[0]+(l.fullMessageLength[e]/4294967296>>>0),l.fullMessageLength[e]>>>=0,d[0]=d[1]/4294967296>>>0;h.putBytes(c);b(a,m,h);(2048<h.read||0===h.length())&&h.compact();return l};l.digest=function(){var d=k.util.createBuffer();d.putBytes(h.bytes());d.putBytes(c.substr(0,l.blockLength-(l.fullMessageLength[l.fullMessageLength.length-
|
514
|
+
1]+l.messageLengthSize&l.blockLength-1)));for(var e,f,x=8*l.fullMessageLength[0],u=0;u<l.fullMessageLength.length-1;++u)e=8*l.fullMessageLength[u+1],f=e/4294967296>>>0,x+=f,d.putInt32(x>>>0),x=e>>>0;d.putInt32(x);e={h0:a.h0,h1:a.h1,h2:a.h2,h3:a.h3,h4:a.h4,h5:a.h5,h6:a.h6,h7:a.h7};b(e,m,d);d=k.util.createBuffer();d.putInt32(e.h0);d.putInt32(e.h1);d.putInt32(e.h2);d.putInt32(e.h3);d.putInt32(e.h4);d.putInt32(e.h5);d.putInt32(e.h6);d.putInt32(e.h7);return d};return l};var c=null,d=!1,e=null});C(function(a){var b=
|
515
|
+
null;!k.util.isNodejs||k.options.usePureJavaScript||process.versions["node-webkit"]||(b=$f);(a.exports=k.prng=k.prng||{}).create=function(a){function c(a){if(32<=h.pools[0].messageLength)return e(),a();h.seedFile(32-h.pools[0].messageLength<<5,function(b,c){if(b)return a(b);h.collect(c);e();a()})}function e(){h.reseeds=4294967295===h.reseeds?0:h.reseeds+1;var a=h.plugin.md.create();a.update(h.keyBytes);for(var b=1,c=0;32>c;++c)0===h.reseeds%b&&(a.update(h.pools[c].digest().getBytes()),h.pools[c].start()),
|
516
|
+
b<<=1;h.keyBytes=a.digest().getBytes();a.start();a.update(h.keyBytes);a=a.digest().getBytes();h.key=h.plugin.formatKey(h.keyBytes);h.seed=h.plugin.formatSeed(a);h.generated=0}function f(a){var b=null,c=k.util.globalScope,d=c.crypto||c.msCrypto;d&&d.getRandomValues&&(b=function(a){return d.getRandomValues(a)});c=k.util.createBuffer();if(b)for(;c.length()<a;){var e=Math.max(1,Math.min(a-c.length(),65536)/4),f=new Uint32Array(Math.floor(e));try{for(b(f),e=0;e<f.length;++e)c.putInt32(f[e])}catch(S){if(!("undefined"!==
|
517
|
+
typeof QuotaExceededError&&S instanceof QuotaExceededError))throw S;}}if(c.length()<a)for(b=Math.floor(65536*Math.random());c.length()<a;)for(e=16807*(b&65535),b=16807*(b>>16),e+=(b&32767)<<16,e+=b>>15,e=(e&2147483647)+(e>>31),b=e&4294967295,e=0;3>e;++e)f=b>>>(e<<3),f^=Math.floor(256*Math.random()),c.putByte(String.fromCharCode(f&255));return c.getBytes(a)}var h={plugin:a,key:null,seed:null,time:null,reseeds:0,generated:0,keyBytes:""};a=a.md;for(var m=Array(32),l=0;32>l;++l)m[l]=a.create();h.pools=
|
518
|
+
m;h.pool=0;h.generate=function(a,b){function d(r){if(r)return b(r);if(n.length()>=a)return b(null,n.getBytes(a));1048575<h.generated&&(h.key=null);if(null===h.key)return k.util.nextTick(function(){c(d)});r=e(h.key,h.seed);h.generated+=r.length;n.putBytes(r);h.key=l(e(h.key,f(h.seed)));h.seed=m(e(h.key,h.seed));k.util.setImmediate(d)}if(!b)return h.generateSync(a);var e=h.plugin.cipher,f=h.plugin.increment,l=h.plugin.formatKey,m=h.plugin.formatSeed,n=k.util.createBuffer();h.key=null;d()};h.generateSync=
|
519
|
+
function(a){var b=h.plugin.cipher,c=h.plugin.increment,d=h.plugin.formatKey,f=h.plugin.formatSeed;h.key=null;for(var l=k.util.createBuffer();l.length()<a;){1048575<h.generated&&(h.key=null);null===h.key&&(32<=h.pools[0].messageLength||h.collect(h.seedFileSync(32-h.pools[0].messageLength<<5)),e());var m=b(h.key,h.seed);h.generated+=m.length;l.putBytes(m);h.key=d(b(h.key,c(h.seed)));h.seed=f(b(h.key,h.seed))}return l.getBytes(a)};b?(h.seedFile=function(a,c){b.randomBytes(a,function(a,b){if(a)return c(a);
|
520
|
+
c(null,b.toString())})},h.seedFileSync=function(a){return b.randomBytes(a).toString()}):(h.seedFile=function(a,b){try{b(null,f(a))}catch(r){b(r)}},h.seedFileSync=f);h.collect=function(a){for(var b=a.length,c=0;c<b;++c)h.pools[h.pool].update(a.substr(c,1)),h.pool=31===h.pool?0:h.pool+1};h.collectInt=function(a,b){for(var c="",d=0;d<b;d+=8)c+=String.fromCharCode(a>>d&255);h.collect(c)};h.registerWorker=function(a){a===self?h.seedFile=function(a,b){function c(a){a=a.data;a.forge&&a.forge.prng&&(self.removeEventListener("message",
|
521
|
+
c),b(a.forge.prng.err,a.forge.prng.bytes))}self.addEventListener("message",c);self.postMessage({forge:{prng:{needed:a}}})}:a.addEventListener("message",function(b){b=b.data;b.forge&&b.forge.prng&&h.seedFile(b.forge.prng.needed,function(b,c){a.postMessage({forge:{prng:{err:b,bytes:c}}})})})};return h}});C(function(a){(function(){k.random&&k.random.getBytes?a.exports=k.random:function(b){function c(){var a=k.prng.create(d);a.getBytes=function(b,c){return a.generate(b,c)};a.getBytesSync=function(b){return a.generate(b)};
|
522
|
+
return a}var d={},e=Array(4),f=k.util.createBuffer();d.formatKey=function(a){var b=k.util.createBuffer(a);a=Array(4);a[0]=b.getInt32();a[1]=b.getInt32();a[2]=b.getInt32();a[3]=b.getInt32();return k.aes._expandKey(a,!1)};d.formatSeed=function(a){var b=k.util.createBuffer(a);a=Array(4);a[0]=b.getInt32();a[1]=b.getInt32();a[2]=b.getInt32();a[3]=b.getInt32();return a};d.cipher=function(a,b){k.aes._updateBlock(a,b,e,!1);f.putInt32(e[0]);f.putInt32(e[1]);f.putInt32(e[2]);f.putInt32(e[3]);return f.getBytes()};
|
523
|
+
d.increment=function(a){++a[3];return a};d.md=k.md.sha256;var h=c(),m=null,l=k.util.globalScope,n=l.crypto||l.msCrypto;n&&n.getRandomValues&&(m=function(a){return n.getRandomValues(a)});if(!k.util.isNodejs&&!m){h.collectInt(+new Date,32);if("undefined"!==typeof navigator){m="";for(var p in navigator)try{"string"==typeof navigator[p]&&(m+=navigator[p])}catch(r){}h.collect(m);m=null}b&&(b().mousemove(function(a){h.collectInt(a.clientX,16);h.collectInt(a.clientY,16)}),b().keypress(function(a){h.collectInt(a.charCode,
|
524
|
+
8)}))}if(k.random)for(p in h)k.random[p]=h[p];else k.random=h;k.random.createInstance=c;a.exports=k.random}("undefined"!==typeof jQuery?jQuery:null)})()});var ag=[217,120,249,196,25,221,181,237,40,233,253,121,74,160,216,157,198,126,55,131,43,118,83,142,98,76,100,136,68,139,251,162,23,154,89,245,135,179,79,19,97,69,109,141,9,129,125,50,189,143,64,235,134,183,123,11,240,149,33,34,92,107,78,130,84,214,101,147,206,96,178,28,115,86,192,20,167,140,241,220,18,117,202,31,59,190,228,209,66,61,212,48,163,60,
|
525
|
+
182,38,111,191,14,218,70,105,7,87,39,242,29,155,188,148,67,3,248,17,199,246,144,239,62,231,6,195,213,47,200,102,30,215,8,232,234,222,128,82,238,247,132,170,114,172,53,77,106,42,150,26,210,113,90,21,73,116,75,159,208,94,4,24,164,236,194,224,65,110,15,81,203,204,36,145,175,80,161,244,112,57,153,124,58,133,35,184,180,122,252,2,54,91,37,85,151,49,45,93,250,152,227,138,146,174,5,223,41,16,103,108,186,201,211,0,230,207,225,158,168,44,99,22,1,63,88,226,137,169,13,56,52,27,171,51,255,176,187,72,12,95,185,
|
526
|
+
177,205,46,197,243,219,71,229,165,156,119,10,166,32,104,254,127,193,173],jk=[1,2,3,5];k.rc2=k.rc2||{};k.rc2.expandKey=function(a,b){"string"===typeof a&&(a=k.util.createBuffer(a));b=b||128;var c=a;a=a.length();var d=b;b=Math.ceil(d/8);d=255>>(d&7);var e;for(e=a;128>e;e++)c.putByte(ag[c.at(e-1)+c.at(e-a)&255]);c.setAt(128-b,ag[c.at(128-b)&d]);for(e=127-b;0<=e;e--)c.setAt(e,ag[c.at(e+1)^c.at(e+b)]);return c};var kk=function(a,b,c){var d=!1,e=null,f=null,h=null,m,l,n=[];a=k.rc2.expandKey(a,b);for(m=
|
527
|
+
0;64>m;m++)n.push(a.getInt16Le());if(c){var p=function(a){for(m=0;4>m;m++){a[m]+=n[l]+(a[(m+3)%4]&a[(m+2)%4])+(~a[(m+3)%4]&a[(m+1)%4]);var b=a[m],c=jk[m];a[m]=b<<c&65535|(b&65535)>>16-c;l++}};var r=function(a){for(m=0;4>m;m++)a[m]+=n[a[(m+3)%4]&63]}}else p=function(a){for(m=3;0<=m;m--){var b=a[m],c=jk[m];a[m]=(b&65535)>>c|b<<16-c&65535;a[m]-=n[l]+(a[(m+3)%4]&a[(m+2)%4])+(~a[(m+3)%4]&a[(m+1)%4]);l--}},r=function(a){for(m=3;0<=m;m--)a[m]-=n[a[(m+3)%4]&63]};var x=null;return x={start:function(a,b){a&&
|
528
|
+
"string"===typeof a&&(a=k.util.createBuffer(a));d=!1;e=k.util.createBuffer();f=b||new k.util.createBuffer;h=a;x.output=f},update:function(a){for(d||e.putBuffer(a);8<=e.length();){a=[[5,p],[1,r],[6,p],[1,r],[5,p]];var b=[];for(m=0;4>m;m++){var k=e.getInt16Le();null!==h&&(c?k^=h.getInt16Le():h.putInt16Le(k));b.push(k&65535)}l=c?0:63;for(k=0;k<a.length;k++)for(var n=0;n<a[k][0];n++)a[k][1](b);for(m=0;4>m;m++)null!==h&&(c?h.putInt16Le(b[m]):b[m]^=h.getInt16Le()),f.putInt16Le(b[m])}},finish:function(a){var b=
|
529
|
+
!0;if(c)if(a)b=a(8,e,!c);else{var h=8===e.length()?8:8-e.length();e.fillWithByte(h,h)}b&&(d=!0,x.update());!c&&(b=0===e.length())&&(a?b=a(8,f,!c):(a=f.length(),h=f.at(a-1),h>a?b=!1:f.truncate(h)));return b}}};k.rc2.startEncrypting=function(a,b,c){a=k.rc2.createEncryptionCipher(a,128);a.start(b,c);return a};k.rc2.createEncryptionCipher=function(a,b){return kk(a,b,!0)};k.rc2.startDecrypting=function(a,b,c){a=k.rc2.createDecryptionCipher(a,128);a.start(b,c);return a};k.rc2.createDecryptionCipher=function(a,
|
530
|
+
b){return kk(a,b,!1)};k.jsbn=k.jsbn||{};k.jsbn.BigInteger=z;if("undefined"===typeof navigator){z.prototype.am=Ug;var Gb=28}else"Microsoft Internet Explorer"==navigator.appName?(z.prototype.am=Al,Gb=30):"Netscape"!=navigator.appName?(z.prototype.am=zl,Gb=26):(z.prototype.am=Ug,Gb=28);z.prototype.DB=Gb;z.prototype.DM=(1<<Gb)-1;z.prototype.DV=1<<Gb;z.prototype.FV=Math.pow(2,52);z.prototype.F1=52-Gb;z.prototype.F2=2*Gb-52;var Cd=[],Wa;var gd=48;for(Wa=0;9>=Wa;++Wa)Cd[gd++]=Wa;gd=97;for(Wa=10;36>Wa;++Wa)Cd[gd++]=
|
531
|
+
Wa;gd=65;for(Wa=10;36>Wa;++Wa)Cd[gd++]=Wa;Pb.prototype.convert=function(a){return 0>a.s||0<=a.compareTo(this.m)?a.mod(this.m):a};Pb.prototype.revert=function(a){return a};Pb.prototype.reduce=function(a){a.divRemTo(this.m,null,a)};Pb.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};Pb.prototype.sqrTo=function(a,b){a.squareTo(b);this.reduce(b)};Qb.prototype.convert=function(a){var b=H();a.abs().dlShiftTo(this.m.t,b);b.divRemTo(this.m,null,b);0>a.s&&0<b.compareTo(z.ZERO)&&this.m.subTo(b,
|
532
|
+
b);return b};Qb.prototype.revert=function(a){var b=H();a.copyTo(b);this.reduce(b);return b};Qb.prototype.reduce=function(a){for(;a.t<=this.mt2;)a.data[a.t++]=0;for(var b=0;b<this.m.t;++b){var c=a.data[b]&32767,d=c*this.mpl+((c*this.mph+(a.data[b]>>15)*this.mpl&this.um)<<15)&a.DM;c=b+this.m.t;for(a.data[c]+=this.m.am(0,d,a,b,0,this.m.t);a.data[c]>=a.DV;)a.data[c]-=a.DV,a.data[++c]++}a.clamp();a.drShiftTo(this.m.t,a);0<=a.compareTo(this.m)&&a.subTo(this.m,a)};Qb.prototype.mulTo=function(a,b,c){a.multiplyTo(b,
|
533
|
+
c);this.reduce(c)};Qb.prototype.sqrTo=function(a,b){a.squareTo(b);this.reduce(b)};z.prototype.copyTo=function(a){for(var b=this.t-1;0<=b;--b)a.data[b]=this.data[b];a.t=this.t;a.s=this.s};z.prototype.fromInt=function(a){this.t=1;this.s=0>a?-1:0;0<a?this.data[0]=a:-1>a?this.data[0]=a+this.DV:this.t=0};z.prototype.fromString=function(a,b){if(16==b)b=4;else if(8==b)b=3;else if(256==b)b=8;else if(2==b)b=1;else if(32==b)b=5;else if(4==b)b=2;else{this.fromRadix(a,b);return}this.s=this.t=0;for(var c=a.length,
|
534
|
+
d=!1,e=0;0<=--c;){var f=8==b?a[c]&255:Vg(a,c);0>f?"-"==a.charAt(c)&&(d=!0):(d=!1,0==e?this.data[this.t++]=f:e+b>this.DB?(this.data[this.t-1]|=(f&(1<<this.DB-e)-1)<<e,this.data[this.t++]=f>>this.DB-e):this.data[this.t-1]|=f<<e,e+=b,e>=this.DB&&(e-=this.DB))}8==b&&0!=(a[0]&128)&&(this.s=-1,0<e&&(this.data[this.t-1]|=(1<<this.DB-e)-1<<e));this.clamp();d&&z.ZERO.subTo(this,this)};z.prototype.clamp=function(){for(var a=this.s&this.DM;0<this.t&&this.data[this.t-1]==a;)--this.t};z.prototype.dlShiftTo=function(a,
|
535
|
+
b){var c;for(c=this.t-1;0<=c;--c)b.data[c+a]=this.data[c];for(c=a-1;0<=c;--c)b.data[c]=0;b.t=this.t+a;b.s=this.s};z.prototype.drShiftTo=function(a,b){for(var c=a;c<this.t;++c)b.data[c-a]=this.data[c];b.t=Math.max(this.t-a,0);b.s=this.s};z.prototype.lShiftTo=function(a,b){var c=a%this.DB,d=this.DB-c,e=(1<<d)-1;a=Math.floor(a/this.DB);var f=this.s<<c&this.DM,h;for(h=this.t-1;0<=h;--h)b.data[h+a+1]=this.data[h]>>d|f,f=(this.data[h]&e)<<c;for(h=a-1;0<=h;--h)b.data[h]=0;b.data[a]=f;b.t=this.t+a+1;b.s=
|
536
|
+
this.s;b.clamp()};z.prototype.rShiftTo=function(a,b){b.s=this.s;var c=Math.floor(a/this.DB);if(c>=this.t)b.t=0;else{a%=this.DB;var d=this.DB-a,e=(1<<a)-1;b.data[0]=this.data[c]>>a;for(var f=c+1;f<this.t;++f)b.data[f-c-1]|=(this.data[f]&e)<<d,b.data[f-c]=this.data[f]>>a;0<a&&(b.data[this.t-c-1]|=(this.s&e)<<d);b.t=this.t-c;b.clamp()}};z.prototype.subTo=function(a,b){for(var c=0,d=0,e=Math.min(a.t,this.t);c<e;)d+=this.data[c]-a.data[c],b.data[c++]=d&this.DM,d>>=this.DB;if(a.t<this.t){for(d-=a.s;c<this.t;)d+=
|
537
|
+
this.data[c],b.data[c++]=d&this.DM,d>>=this.DB;d+=this.s}else{for(d+=this.s;c<a.t;)d-=a.data[c],b.data[c++]=d&this.DM,d>>=this.DB;d-=a.s}b.s=0>d?-1:0;-1>d?b.data[c++]=this.DV+d:0<d&&(b.data[c++]=d);b.t=c;b.clamp()};z.prototype.multiplyTo=function(a,b){var c=this.abs(),d=a.abs(),e=c.t;for(b.t=e+d.t;0<=--e;)b.data[e]=0;for(e=0;e<d.t;++e)b.data[e+c.t]=c.am(0,d.data[e],b,e,0,c.t);b.s=0;b.clamp();this.s!=a.s&&z.ZERO.subTo(b,b)};z.prototype.squareTo=function(a){for(var b=this.abs(),c=a.t=2*b.t;0<=--c;)a.data[c]=
|
538
|
+
0;for(c=0;c<b.t-1;++c){var d=b.am(c,b.data[c],a,2*c,0,1);(a.data[c+b.t]+=b.am(c+1,2*b.data[c],a,2*c+1,d,b.t-c-1))>=b.DV&&(a.data[c+b.t]-=b.DV,a.data[c+b.t+1]=1)}0<a.t&&(a.data[a.t-1]+=b.am(c,b.data[c],a,2*c,0,1));a.s=0;a.clamp()};z.prototype.divRemTo=function(a,b,c){var d=a.abs();if(!(0>=d.t)){var e=this.abs();if(e.t<d.t)null!=b&&b.fromInt(0),null!=c&&this.copyTo(c);else{null==c&&(c=H());var f=H(),h=this.s;a=a.s;var k=this.DB-Dd(d.data[d.t-1]);0<k?(d.lShiftTo(k,f),e.lShiftTo(k,c)):(d.copyTo(f),e.copyTo(c));
|
539
|
+
d=f.t;e=f.data[d-1];if(0!=e){var l=e*(1<<this.F1)+(1<d?f.data[d-2]>>this.F2:0),n=this.FV/l;l=(1<<this.F1)/l;var p=1<<this.F2,r=c.t,x=r-d,q=null==b?H():b;f.dlShiftTo(x,q);0<=c.compareTo(q)&&(c.data[c.t++]=1,c.subTo(q,c));z.ONE.dlShiftTo(d,q);for(q.subTo(f,f);f.t<d;)f.data[f.t++]=0;for(;0<=--x;){var v=c.data[--r]==e?this.DM:Math.floor(c.data[r]*n+(c.data[r-1]+p)*l);if((c.data[r]+=f.am(0,v,c,x,0,d))<v)for(f.dlShiftTo(x,q),c.subTo(q,c);c.data[r]<--v;)c.subTo(q,c)}null!=b&&(c.drShiftTo(d,b),h!=a&&z.ZERO.subTo(b,
|
540
|
+
b));c.t=d;c.clamp();0<k&&c.rShiftTo(k,c);0>h&&z.ZERO.subTo(c,c)}}}};z.prototype.invDigit=function(){if(1>this.t)return 0;var a=this.data[0];if(0==(a&1))return 0;var b=a&3;b=b*(2-(a&15)*b)&15;b=b*(2-(a&255)*b)&255;b=b*(2-((a&65535)*b&65535))&65535;b=b*(2-a*b%this.DV)%this.DV;return 0<b?this.DV-b:-b};z.prototype.isEven=function(){return 0==(0<this.t?this.data[0]&1:this.s)};z.prototype.exp=function(a,b){if(4294967295<a||1>a)return z.ONE;var c=H(),d=H(),e=b.convert(this),f=Dd(a)-1;for(e.copyTo(c);0<=
|
541
|
+
--f;)if(b.sqrTo(c,d),0<(a&1<<f))b.mulTo(d,e,c);else{var h=c;c=d;d=h}return b.revert(c)};z.prototype.toString=function(a){if(0>this.s)return"-"+this.negate().toString(a);if(16==a)a=4;else if(8==a)a=3;else if(2==a)a=1;else if(32==a)a=5;else if(4==a)a=2;else return this.toRadix(a);var b=(1<<a)-1,c,d=!1,e="",f=this.t,h=this.DB-f*this.DB%a;if(0<f--)for(h<this.DB&&0<(c=this.data[f]>>h)&&(d=!0,e="0123456789abcdefghijklmnopqrstuvwxyz".charAt(c));0<=f;)h<a?(c=(this.data[f]&(1<<h)-1)<<a-h,c|=this.data[--f]>>
|
542
|
+
(h+=this.DB-a)):(c=this.data[f]>>(h-=a)&b,0>=h&&(h+=this.DB,--f)),0<c&&(d=!0),d&&(e+="0123456789abcdefghijklmnopqrstuvwxyz".charAt(c));return d?e:"0"};z.prototype.negate=function(){var a=H();z.ZERO.subTo(this,a);return a};z.prototype.abs=function(){return 0>this.s?this.negate():this};z.prototype.compareTo=function(a){var b=this.s-a.s;if(0!=b)return b;var c=this.t;b=c-a.t;if(0!=b)return 0>this.s?-b:b;for(;0<=--c;)if(0!=(b=this.data[c]-a.data[c]))return b;return 0};z.prototype.bitLength=function(){return 0>=
|
543
|
+
this.t?0:this.DB*(this.t-1)+Dd(this.data[this.t-1]^this.s&this.DM)};z.prototype.mod=function(a){var b=H();this.abs().divRemTo(a,null,b);0>this.s&&0<b.compareTo(z.ZERO)&&a.subTo(b,b);return b};z.prototype.modPowInt=function(a,b){b=256>a||b.isEven()?new Pb(b):new Qb(b);return this.exp(a,b)};z.ZERO=Ab(0);z.ONE=Ab(1);Jc.prototype.convert=Yg;Jc.prototype.revert=Yg;Jc.prototype.mulTo=function(a,b,c){a.multiplyTo(b,c)};Jc.prototype.sqrTo=function(a,b){a.squareTo(b)};kc.prototype.convert=function(a){if(0>
|
544
|
+
a.s||a.t>2*this.m.t)return a.mod(this.m);if(0>a.compareTo(this.m))return a;var b=H();a.copyTo(b);this.reduce(b);return b};kc.prototype.revert=function(a){return a};kc.prototype.reduce=function(a){a.drShiftTo(this.m.t-1,this.r2);a.t>this.m.t+1&&(a.t=this.m.t+1,a.clamp());this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3);for(this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);0>a.compareTo(this.r2);)a.dAddOffset(1,this.m.t+1);for(a.subTo(this.r2,a);0<=a.compareTo(this.m);)a.subTo(this.m,a)};kc.prototype.mulTo=
|
545
|
+
function(a,b,c){a.multiplyTo(b,c);this.reduce(c)};kc.prototype.sqrTo=function(a,b){a.squareTo(b);this.reduce(b)};var cb=[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],Np=67108864/cb[cb.length-
|
546
|
+
1];z.prototype.chunkSize=function(a){return Math.floor(Math.LN2*this.DB/Math.log(a))};z.prototype.toRadix=function(a){null==a&&(a=10);if(0==this.signum()||2>a||36<a)return"0";var b=this.chunkSize(a);b=Math.pow(a,b);var c=Ab(b),d=H(),e=H(),f="";for(this.divRemTo(c,d,e);0<d.signum();)f=(b+e.intValue()).toString(a).substr(1)+f,d.divRemTo(c,d,e);return e.intValue().toString(a)+f};z.prototype.fromRadix=function(a,b){this.fromInt(0);null==b&&(b=10);for(var c=this.chunkSize(b),d=Math.pow(b,c),e=!1,f=0,h=
|
547
|
+
0,k=0;k<a.length;++k){var l=Vg(a,k);0>l?"-"==a.charAt(k)&&0==this.signum()&&(e=!0):(h=b*h+l,++f>=c&&(this.dMultiply(d),this.dAddOffset(h,0),h=f=0))}0<f&&(this.dMultiply(Math.pow(b,f)),this.dAddOffset(h,0));e&&z.ZERO.subTo(this,this)};z.prototype.fromNumber=function(a,b,c){if("number"==typeof b)if(2>a)this.fromInt(1);else for(this.fromNumber(a,c),this.testBit(a-1)||this.bitwiseTo(z.ONE.shiftLeft(a-1),Je,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(b);)this.dAddOffset(2,0),this.bitLength()>
|
548
|
+
a&&this.subTo(z.ONE.shiftLeft(a-1),this);else{c=[];var d=a&7;c.length=(a>>3)+1;b.nextBytes(c);c[0]=0<d?c[0]&(1<<d)-1:0;this.fromString(c,256)}};z.prototype.bitwiseTo=function(a,b,c){var d,e=Math.min(a.t,this.t);for(d=0;d<e;++d)c.data[d]=b(this.data[d],a.data[d]);if(a.t<this.t){var f=a.s&this.DM;for(d=e;d<this.t;++d)c.data[d]=b(this.data[d],f);c.t=this.t}else{f=this.s&this.DM;for(d=e;d<a.t;++d)c.data[d]=b(f,a.data[d]);c.t=a.t}c.s=b(this.s,a.s);c.clamp()};z.prototype.changeBit=function(a,b){a=z.ONE.shiftLeft(a);
|
549
|
+
this.bitwiseTo(a,b,a);return a};z.prototype.addTo=function(a,b){for(var c=0,d=0,e=Math.min(a.t,this.t);c<e;)d+=this.data[c]+a.data[c],b.data[c++]=d&this.DM,d>>=this.DB;if(a.t<this.t){for(d+=a.s;c<this.t;)d+=this.data[c],b.data[c++]=d&this.DM,d>>=this.DB;d+=this.s}else{for(d+=this.s;c<a.t;)d+=a.data[c],b.data[c++]=d&this.DM,d>>=this.DB;d+=a.s}b.s=0>d?-1:0;0<d?b.data[c++]=d:-1>d&&(b.data[c++]=this.DV+d);b.t=c;b.clamp()};z.prototype.dMultiply=function(a){this.data[this.t]=this.am(0,a-1,this,0,0,this.t);
|
550
|
+
++this.t;this.clamp()};z.prototype.dAddOffset=function(a,b){if(0!=a){for(;this.t<=b;)this.data[this.t++]=0;for(this.data[b]+=a;this.data[b]>=this.DV;)this.data[b]-=this.DV,++b>=this.t&&(this.data[this.t++]=0),++this.data[b]}};z.prototype.multiplyLowerTo=function(a,b,c){var d=Math.min(this.t+a.t,b);c.s=0;for(c.t=d;0<d;)c.data[--d]=0;var e;for(e=c.t-this.t;d<e;++d)c.data[d+this.t]=this.am(0,a.data[d],c,d,0,this.t);for(e=Math.min(a.t,b);d<e;++d)this.am(0,a.data[d],c,d,0,b-d);c.clamp()};z.prototype.multiplyUpperTo=
|
551
|
+
function(a,b,c){--b;var d=c.t=this.t+a.t-b;for(c.s=0;0<=--d;)c.data[d]=0;for(d=Math.max(b-this.t,0);d<a.t;++d)c.data[this.t+d-b]=this.am(b-d,a.data[d],c,0,0,this.t+d-b);c.clamp();c.drShiftTo(1,c)};z.prototype.modInt=function(a){if(0>=a)return 0;var b=this.DV%a,c=0>this.s?a-1:0;if(0<this.t)if(0==b)c=this.data[0]%a;else for(var d=this.t-1;0<=d;--d)c=(b*c+this.data[d])%a;return c};z.prototype.millerRabin=function(a){var b=this.subtract(z.ONE),c=b.getLowestSetBit();if(0>=c)return!1;for(var d=b.shiftRight(c),
|
552
|
+
e=Cl(),f,h=0;h<a;++h){do f=new z(this.bitLength(),e);while(0>=f.compareTo(z.ONE)||0<=f.compareTo(b));f=f.modPow(d,this);if(0!=f.compareTo(z.ONE)&&0!=f.compareTo(b)){for(var k=1;k++<c&&0!=f.compareTo(b);)if(f=f.modPowInt(2,this),0==f.compareTo(z.ONE))return!1;if(0!=f.compareTo(b))return!1}}return!0};z.prototype.clone=function(){var a=H();this.copyTo(a);return a};z.prototype.intValue=function(){if(0>this.s){if(1==this.t)return this.data[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this.data[0];
|
553
|
+
if(0==this.t)return 0}return(this.data[1]&(1<<32-this.DB)-1)<<this.DB|this.data[0]};z.prototype.byteValue=function(){return 0==this.t?this.s:this.data[0]<<24>>24};z.prototype.shortValue=function(){return 0==this.t?this.s:this.data[0]<<16>>16};z.prototype.signum=function(){return 0>this.s?-1:0>=this.t||1==this.t&&0>=this.data[0]?0:1};z.prototype.toByteArray=function(){var a=this.t,b=[];b[0]=this.s;var c=this.DB-a*this.DB%8,d,e=0;if(0<a--)for(c<this.DB&&(d=this.data[a]>>c)!=(this.s&this.DM)>>c&&(b[e++]=
|
554
|
+
d|this.s<<this.DB-c);0<=a;)if(8>c?(d=(this.data[a]&(1<<c)-1)<<8-c,d|=this.data[--a]>>(c+=this.DB-8)):(d=this.data[a]>>(c-=8)&255,0>=c&&(c+=this.DB,--a)),0!=(d&128)&&(d|=-256),0==e&&(this.s&128)!=(d&128)&&++e,0<e||d!=this.s)b[e++]=d;return b};z.prototype.equals=function(a){return 0==this.compareTo(a)};z.prototype.min=function(a){return 0>this.compareTo(a)?this:a};z.prototype.max=function(a){return 0<this.compareTo(a)?this:a};z.prototype.and=function(a){var b=H();this.bitwiseTo(a,Bl,b);return b};z.prototype.or=
|
555
|
+
function(a){var b=H();this.bitwiseTo(a,Je,b);return b};z.prototype.xor=function(a){var b=H();this.bitwiseTo(a,Wg,b);return b};z.prototype.andNot=function(a){var b=H();this.bitwiseTo(a,Xg,b);return b};z.prototype.not=function(){for(var a=H(),b=0;b<this.t;++b)a.data[b]=this.DM&~this.data[b];a.t=this.t;a.s=~this.s;return a};z.prototype.shiftLeft=function(a){var b=H();0>a?this.rShiftTo(-a,b):this.lShiftTo(a,b);return b};z.prototype.shiftRight=function(a){var b=H();0>a?this.lShiftTo(-a,b):this.rShiftTo(a,
|
556
|
+
b);return b};z.prototype.getLowestSetBit=function(){for(var a=0;a<this.t;++a)if(0!=this.data[a]){var b=a*this.DB;a=this.data[a];if(0==a)a=-1;else{var c=0;0==(a&65535)&&(a>>=16,c+=16);0==(a&255)&&(a>>=8,c+=8);0==(a&15)&&(a>>=4,c+=4);0==(a&3)&&(a>>=2,c+=2);0==(a&1)&&++c;a=c}return b+a}return 0>this.s?this.t*this.DB:-1};z.prototype.bitCount=function(){for(var a=0,b=this.s&this.DM,c=0;c<this.t;++c){for(var d=this.data[c]^b,e=0;0!=d;)d&=d-1,++e;a+=e}return a};z.prototype.testBit=function(a){var b=Math.floor(a/
|
557
|
+
this.DB);return b>=this.t?0!=this.s:0!=(this.data[b]&1<<a%this.DB)};z.prototype.setBit=function(a){return this.changeBit(a,Je)};z.prototype.clearBit=function(a){return this.changeBit(a,Xg)};z.prototype.flipBit=function(a){return this.changeBit(a,Wg)};z.prototype.add=function(a){var b=H();this.addTo(a,b);return b};z.prototype.subtract=function(a){var b=H();this.subTo(a,b);return b};z.prototype.multiply=function(a){var b=H();this.multiplyTo(a,b);return b};z.prototype.divide=function(a){var b=H();this.divRemTo(a,
|
558
|
+
b,null);return b};z.prototype.remainder=function(a){var b=H();this.divRemTo(a,null,b);return b};z.prototype.divideAndRemainder=function(a){var b=H(),c=H();this.divRemTo(a,b,c);return[b,c]};z.prototype.modPow=function(a,b){var c=a.bitLength(),d=Ab(1);if(0>=c)return d;var e=18>c?1:48>c?3:144>c?4:768>c?5:6;b=8>c?new Pb(b):b.isEven()?new kc(b):new Qb(b);var f=[],h=3,k=e-1,l=(1<<e)-1;f[1]=b.convert(this);if(1<e)for(c=H(),b.sqrTo(f[1],c);h<=l;)f[h]=H(),b.mulTo(c,f[h-2],f[h]),h+=2;var n=a.t-1,p=!0,r=H();
|
559
|
+
for(c=Dd(a.data[n])-1;0<=n;){if(c>=k)var x=a.data[n]>>c-k&l;else x=(a.data[n]&(1<<c+1)-1)<<k-c,0<n&&(x|=a.data[n-1]>>this.DB+c-k);for(h=e;0==(x&1);)x>>=1,--h;0>(c-=h)&&(c+=this.DB,--n);if(p)f[x].copyTo(d),p=!1;else{for(;1<h;)b.sqrTo(d,r),b.sqrTo(r,d),h-=2;0<h?b.sqrTo(d,r):(h=d,d=r,r=h);b.mulTo(r,f[x],d)}for(;0<=n&&0==(a.data[n]&1<<c);)b.sqrTo(d,r),h=d,d=r,r=h,0>--c&&(c=this.DB-1,--n)}return b.revert(d)};z.prototype.modInverse=function(a){var b=a.isEven();if(this.isEven()&&b||0==a.signum())return z.ZERO;
|
560
|
+
for(var c=a.clone(),d=this.clone(),e=Ab(1),f=Ab(0),h=Ab(0),k=Ab(1);0!=c.signum();){for(;c.isEven();)c.rShiftTo(1,c),b?(e.isEven()&&f.isEven()||(e.addTo(this,e),f.subTo(a,f)),e.rShiftTo(1,e)):f.isEven()||f.subTo(a,f),f.rShiftTo(1,f);for(;d.isEven();)d.rShiftTo(1,d),b?(h.isEven()&&k.isEven()||(h.addTo(this,h),k.subTo(a,k)),h.rShiftTo(1,h)):k.isEven()||k.subTo(a,k),k.rShiftTo(1,k);0<=c.compareTo(d)?(c.subTo(d,c),b&&e.subTo(h,e),f.subTo(k,f)):(d.subTo(c,d),b&&h.subTo(e,h),k.subTo(f,k))}if(0!=d.compareTo(z.ONE))return z.ZERO;
|
561
|
+
if(0<=k.compareTo(a))return k.subtract(a);if(0>k.signum())k.addTo(a,k);else return k;return 0>k.signum()?k.add(a):k};z.prototype.pow=function(a){return this.exp(a,new Jc)};z.prototype.gcd=function(a){var b=0>this.s?this.negate():this.clone();a=0>a.s?a.negate():a.clone();if(0>b.compareTo(a)){var c=b;b=a;a=c}c=b.getLowestSetBit();var d=a.getLowestSetBit();if(0>d)return b;c<d&&(d=c);0<d&&(b.rShiftTo(d,b),a.rShiftTo(d,a));for(;0<b.signum();)0<(c=b.getLowestSetBit())&&b.rShiftTo(c,b),0<(c=a.getLowestSetBit())&&
|
562
|
+
a.rShiftTo(c,a),0<=b.compareTo(a)?(b.subTo(a,b),b.rShiftTo(1,b)):(a.subTo(b,a),a.rShiftTo(1,a));0<d&&a.lShiftTo(d,a);return a};z.prototype.isProbablePrime=function(a){var b,c=this.abs();if(1==c.t&&c.data[0]<=cb[cb.length-1]){for(b=0;b<cb.length;++b)if(c.data[0]==cb[b])return!0;return!1}if(c.isEven())return!1;for(b=1;b<cb.length;){for(var d=cb[b],e=b+1;e<cb.length&&d<Np;)d*=cb[e++];for(d=c.modInt(d);b<e;)if(0==d%cb[b++])return!1}return c.millerRabin(a)};C(function(a){function b(a,b,c){for(var d,e,
|
563
|
+
f,h,k,p,q,v,S=c.length();64<=S;){e=a.h0;f=a.h1;h=a.h2;k=a.h3;p=a.h4;for(v=0;16>v;++v)d=c.getInt32(),b[v]=d,q=k^f&(h^k),d=(e<<5|e>>>27)+q+p+1518500249+d,p=k,k=h,h=(f<<30|f>>>2)>>>0,f=e,e=d;for(;20>v;++v)d=b[v-3]^b[v-8]^b[v-14]^b[v-16],d=d<<1|d>>>31,b[v]=d,q=k^f&(h^k),d=(e<<5|e>>>27)+q+p+1518500249+d,p=k,k=h,h=(f<<30|f>>>2)>>>0,f=e,e=d;for(;32>v;++v)d=b[v-3]^b[v-8]^b[v-14]^b[v-16],d=d<<1|d>>>31,b[v]=d,q=f^h^k,d=(e<<5|e>>>27)+q+p+1859775393+d,p=k,k=h,h=(f<<30|f>>>2)>>>0,f=e,e=d;for(;40>v;++v)d=b[v-6]^
|
564
|
+
b[v-16]^b[v-28]^b[v-32],d=d<<2|d>>>30,b[v]=d,q=f^h^k,d=(e<<5|e>>>27)+q+p+1859775393+d,p=k,k=h,h=(f<<30|f>>>2)>>>0,f=e,e=d;for(;60>v;++v)d=b[v-6]^b[v-16]^b[v-28]^b[v-32],d=d<<2|d>>>30,b[v]=d,q=f&h|k&(f^h),d=(e<<5|e>>>27)+q+p+2400959708+d,p=k,k=h,h=(f<<30|f>>>2)>>>0,f=e,e=d;for(;80>v;++v)d=b[v-6]^b[v-16]^b[v-28]^b[v-32],d=d<<2|d>>>30,b[v]=d,q=f^h^k,d=(e<<5|e>>>27)+q+p+3395469782+d,p=k,k=h,h=(f<<30|f>>>2)>>>0,f=e,e=d;a.h0=a.h0+e|0;a.h1=a.h1+f|0;a.h2=a.h2+h|0;a.h3=a.h3+k|0;a.h4=a.h4+p|0;S-=64}}a=a.exports=
|
565
|
+
k.sha1=k.sha1||{};k.md.sha1=k.md.algorithms.sha1=a;a.create=function(){d||(c=String.fromCharCode(128),c+=k.util.fillString(String.fromCharCode(0),64),d=!0);var a=null,f=k.util.createBuffer(),h=Array(80),m={algorithm:"sha1",blockLength:64,digestLength:20,messageLength:0,fullMessageLength:null,messageLengthSize:8,start:function(){m.messageLength=0;m.fullMessageLength=m.messageLength64=[];for(var b=m.messageLengthSize/4,c=0;c<b;++c)m.fullMessageLength.push(0);f=k.util.createBuffer();a={h0:1732584193,
|
566
|
+
h1:4023233417,h2:2562383102,h3:271733878,h4:3285377520};return m}};m.start();m.update=function(c,d){"utf8"===d&&(c=k.util.encodeUtf8(c));d=c.length;m.messageLength+=d;d=[d/4294967296>>>0,d>>>0];for(var e=m.fullMessageLength.length-1;0<=e;--e)m.fullMessageLength[e]+=d[1],d[1]=d[0]+(m.fullMessageLength[e]/4294967296>>>0),m.fullMessageLength[e]>>>=0,d[0]=d[1]/4294967296>>>0;f.putBytes(c);b(a,h,f);(2048<f.read||0===f.length())&&f.compact();return m};m.digest=function(){var d=k.util.createBuffer();d.putBytes(f.bytes());
|
567
|
+
d.putBytes(c.substr(0,m.blockLength-(m.fullMessageLength[m.fullMessageLength.length-1]+m.messageLengthSize&m.blockLength-1)));for(var e,p,r=8*m.fullMessageLength[0],q=0;q<m.fullMessageLength.length-1;++q)e=8*m.fullMessageLength[q+1],p=e/4294967296>>>0,r+=p,d.putInt32(r>>>0),r=e>>>0;d.putInt32(r);e={h0:a.h0,h1:a.h1,h2:a.h2,h3:a.h3,h4:a.h4};b(e,h,d);d=k.util.createBuffer();d.putInt32(e.h0);d.putInt32(e.h1);d.putInt32(e.h2);d.putInt32(e.h3);d.putInt32(e.h4);return d};return m};var c=null,d=!1});C(function(a){function b(a,
|
568
|
+
b,e){e||(e=k.md.sha1.create());for(var c="",d=Math.ceil(b/e.digestLength),m=0;m<d;++m){var l=String.fromCharCode(m>>24&255,m>>16&255,m>>8&255,m&255);e.start();e.update(a+l);c+=e.digest().getBytes()}return c.substring(0,b)}a=a.exports=k.pkcs1=k.pkcs1||{};a.encode_rsa_oaep=function(a,d,e,f,h){if("string"===typeof e){var c=e;var l=f||void 0;var n=h||void 0}else if(e&&(c=e.label||void 0,l=e.seed||void 0,n=e.md||void 0,e.mgf1&&e.mgf1.md))var p=e.mgf1.md;n?n.start():n=k.md.sha1.create();p||(p=n);a=Math.ceil(a.n.bitLength()/
|
569
|
+
8);e=a-2*n.digestLength-2;if(d.length>e)throw p=Error("RSAES-OAEP input message length is too long."),p.length=d.length,p.maxLength=e,p;c||(c="");n.update(c,"raw");c=n.digest();f="";e-=d.length;for(h=0;h<e;h++)f+="\x00";d=c.getBytes()+f+"\u0001"+d;if(!l)l=k.random.getBytes(n.digestLength);else if(l.length!==n.digestLength)throw p=Error("Invalid RSAES-OAEP seed. The seed length must match the digest length."),p.seedLength=l.length,p.digestLength=n.digestLength,p;a=b(l,a-n.digestLength-1,p);d=k.util.xorBytes(d,
|
570
|
+
a,d.length);n=b(d,n.digestLength,p);return"\x00"+k.util.xorBytes(l,n,l.length)+d};a.decode_rsa_oaep=function(a,d,e,f){if("string"===typeof e){var c=e;var m=f||void 0}else if(e&&(c=e.label||void 0,m=e.md||void 0,e.mgf1&&e.mgf1.md))var l=e.mgf1.md;e=Math.ceil(a.n.bitLength()/8);if(d.length!==e)throw l=Error("RSAES-OAEP encoded message length is invalid."),l.length=d.length,l.expectedLength=e,l;void 0===m?m=k.md.sha1.create():m.start();l||(l=m);if(e<2*m.digestLength+2)throw Error("RSAES-OAEP key is too short for the hash function.");
|
571
|
+
c||(c="");m.update(c,"raw");c=m.digest().getBytes();a=d.charAt(0);f=d.substring(1,m.digestLength+1);d=d.substring(1+m.digestLength);var n=b(d,m.digestLength,l);f=k.util.xorBytes(f,n,f.length);l=b(f,e-m.digestLength-1,l);d=k.util.xorBytes(d,l,d.length);e=d.substring(0,m.digestLength);l="\x00"!==a;for(a=0;a<m.digestLength;++a)l|=c.charAt(a)!==e.charAt(a);c=1;for(m=a=m.digestLength;m<d.length;m++)e=d.charCodeAt(m),f=e&1^1,l|=e&(c?65534:0),c&=f,a+=c;if(l||1!==d.charCodeAt(a))throw Error("Invalid RSAES-OAEP padding.");
|
572
|
+
return d.substring(a+1)}});C(function(a){(function(){function b(a,b,d,f){return"workers"in d?e(a,b,d,f):c(a,b,d,f)}function c(a,b,c,e){var h=f(a,b);var k=h.bitLength();k=100>=k?27:150>=k?18:200>=k?15:250>=k?12:300>=k?9:350>=k?8:400>=k?7:500>=k?6:600>=k?5:800>=k?4:1250>=k?3:2;"millerRabinTests"in c&&(k=c.millerRabinTests);var l=10;"maxBlockTime"in c&&(l=c.maxBlockTime);d(h,a,b,0,k,l,e)}function d(a,b,c,e,h,m,n){var R=+new Date;do{a.bitLength()>b&&(a=f(b,c));if(a.isProbablePrime(h))return n(null,a);
|
573
|
+
a.dAddOffset(l[e++%8],0)}while(0>m||+new Date-R<m);k.util.setImmediate(function(){d(a,b,c,e,h,m,n)})}function e(a,b,d,e){function h(){function c(c){if(!k){var h=c.data;if(h.found){for(c=0;c<d.length;++c)d[c].terminate();k=!0;return e(null,new m(h.prime,16))}l.bitLength()>a&&(l=f(a,b));h=l.toString(16);c.target.postMessage({hex:h,workLoad:R});l.dAddOffset(r,0)}}n=Math.max(1,n);for(var d=[],h=0;h<n;++h)d[h]=new Worker(p);for(h=0;h<n;++h)d[h].addEventListener("message",c);var k=!1}if("undefined"===typeof Worker)return c(a,
|
574
|
+
b,d,e);var l=f(a,b),n=d.workers,R=d.workLoad||100,r=30*R/8,p=d.workerScript||"forge/prime.worker.js";if(-1===n)return k.util.estimateCores(function(a,b){a&&(b=2);n=b-1;h()});h()}function f(a,b){b=new m(a,b);--a;b.testBit(a)||b.bitwiseTo(m.ONE.shiftLeft(a),p,b);b.dAddOffset(31-b.mod(n).byteValue(),0);return b}if(k.prime)a.exports=k.prime;else{var h=a.exports=k.prime=k.prime||{},m=k.jsbn.BigInteger,l=[6,4,2,4,2,4,6,2],n=new m(null);n.fromInt(30);var p=function(a,b){return a|b};h.generateProbablePrime=
|
575
|
+
function(a,c,d){"function"===typeof c&&(d=c,c={});c=c||{};var e=c.algorithm||"PRIMEINC";"string"===typeof e&&(e={name:e});e.options=e.options||{};var f=c.prng||k.random;c={nextBytes:function(a){for(var b=f.getBytesSync(a.length),c=0;c<a.length;++c)a[c]=b.charCodeAt(c)}};if("PRIMEINC"===e.name)return b(a,c,e.options,d);throw Error("Invalid prime generation algorithm: "+e.name);}}})()});if("undefined"===typeof M)var M=k.jsbn.BigInteger;var qe=k.util.isNodejs?$f:null,t=k.asn1,Ta=k.util;k.pki=k.pki||
|
576
|
+
{};k.pki.rsa=k.rsa=k.rsa||{};var F=k.pki,Op=[6,4,2,4,2,4,6,2],Pp={name:"PrivateKeyInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:t.Class.UNIVERSAL,type:t.Type.OID,constructed:!1,capture:"privateKeyOid"}]},
|
577
|
+
{name:"PrivateKeyInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]},Qp={name:"RSAPrivateKey",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPrivateKey.version",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"RSAPrivateKey.modulus",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"privateKeyModulus"},{name:"RSAPrivateKey.publicExponent",tagClass:t.Class.UNIVERSAL,
|
578
|
+
type:t.Type.INTEGER,constructed:!1,capture:"privateKeyPublicExponent"},{name:"RSAPrivateKey.privateExponent",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"privateKeyPrivateExponent"},{name:"RSAPrivateKey.prime1",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"privateKeyPrime1"},{name:"RSAPrivateKey.prime2",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"privateKeyPrime2"},{name:"RSAPrivateKey.exponent1",tagClass:t.Class.UNIVERSAL,
|
579
|
+
type:t.Type.INTEGER,constructed:!1,capture:"privateKeyExponent1"},{name:"RSAPrivateKey.exponent2",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"privateKeyExponent2"},{name:"RSAPrivateKey.coefficient",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"privateKeyCoefficient"}]},Rp={name:"RSAPublicKey",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"RSAPublicKey.modulus",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,
|
580
|
+
capture:"publicKeyModulus"},{name:"RSAPublicKey.exponent",tagClass:t.Class.UNIVERSAL,type:t.Type.INTEGER,constructed:!1,capture:"publicKeyExponent"}]},Sp=k.pki.rsa.publicKeyValidator={name:"SubjectPublicKeyInfo",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:t.Class.UNIVERSAL,
|
581
|
+
type:t.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{name:"SubjectPublicKeyInfo.subjectPublicKey",tagClass:t.Class.UNIVERSAL,type:t.Type.BITSTRING,constructed:!1,value:[{name:"SubjectPublicKeyInfo.subjectPublicKey.RSAPublicKey",tagClass:t.Class.UNIVERSAL,type:t.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"rsaPublicKey"}]}]},Tp=function(a){if(a.algorithm in F.oids)var b=F.oids[a.algorithm];else throw b=Error("Unknown message digest algorithm."),b.algorithm=a.algorithm,b;var c=t.oidToDer(b).getBytes();
|
582
|
+
b=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]);var d=t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[]);d.value.push(t.create(t.Class.UNIVERSAL,t.Type.OID,!1,c));d.value.push(t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,""));a=t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,a.digest().getBytes());b.value.push(d);b.value.push(a);return t.toDer(b).getBytes()},lk=function(a,b,c){if(c)return a.modPow(b.e,b.n);if(!b.p||!b.q)return a.modPow(b.d,b.n);b.dP||(b.dP=b.d.mod(b.p.subtract(M.ONE)));b.dQ||(b.dQ=
|
583
|
+
b.d.mod(b.q.subtract(M.ONE)));b.qInv||(b.qInv=b.q.modInverse(b.p));do c=new M(k.util.bytesToHex(k.random.getBytes(b.n.bitLength()/8)),16);while(0<=c.compareTo(b.n)||!c.gcd(b.n).equals(M.ONE));a=a.multiply(c.modPow(b.e,b.n)).mod(b.n);var d=a.mod(b.p).modPow(b.dP,b.p);for(a=a.mod(b.q).modPow(b.dQ,b.q);0>d.compareTo(a);)d=d.add(b.p);a=d.subtract(a).multiply(b.qInv).mod(b.p).multiply(b.q).add(a);return a=a.multiply(c.modInverse(b.n)).mod(b.n)};F.rsa.encrypt=function(a,b,c){var d=c,e=Math.ceil(b.n.bitLength()/
|
584
|
+
8);!1!==c&&!0!==c?(d=2===c,c=Zg(a,b,c)):(c=k.util.createBuffer(),c.putBytes(a));a=new M(c.toHex(),16);b=lk(a,b,d).toString(16);d=k.util.createBuffer();for(e-=Math.ceil(b.length/2);0<e;)d.putByte(0),--e;d.putBytes(k.util.hexToBytes(b));return d.getBytes()};F.rsa.decrypt=function(a,b,c,d){var e=Math.ceil(b.n.bitLength()/8);if(a.length!==e)throw b=Error("Encrypted message length is invalid."),b.length=a.length,b.expected=e,b;a=new M(k.util.createBuffer(a).toHex(),16);if(0<=a.compareTo(b.n))throw Error("Encrypted message is invalid.");
|
585
|
+
a=lk(a,b,c).toString(16);var f=k.util.createBuffer();for(e-=Math.ceil(a.length/2);0<e;)f.putByte(0),--e;f.putBytes(k.util.hexToBytes(a));return!1!==d?Ed(f.getBytes(),b,c):f.getBytes()};F.rsa.createKeyPairGenerationState=function(a,b,c){"string"===typeof a&&(a=parseInt(a,10));a=a||2048;c=c||{};var d=c.prng||k.random,e={nextBytes:function(a){for(var b=d.getBytesSync(a.length),c=0;c<a.length;++c)a[c]=b.charCodeAt(c)}};c=c.algorithm||"PRIMEINC";if("PRIMEINC"===c)a={algorithm:c,state:0,bits:a,rng:e,eInt:b||
|
586
|
+
65537,e:new M(null),p:null,q:null,qBits:a>>1,pBits:a-(a>>1),pqState:0,num:null,keys:null},a.e.fromInt(a.eInt);else throw Error("Invalid key generation algorithm: "+c);return a};F.rsa.stepKeyPairGenerationState=function(a,b){"algorithm"in a||(a.algorithm="PRIMEINC");var c=new M(null);c.fromInt(30);for(var d=0,e=function(a,b){return a|b},f=+new Date,h,k=0;null===a.keys&&(0>=b||k<b);){if(0===a.state){h=null===a.p?a.pBits:a.qBits;var l=h-1;0===a.pqState?(a.num=new M(h,a.rng),a.num.testBit(l)||a.num.bitwiseTo(M.ONE.shiftLeft(l),
|
587
|
+
e,a.num),a.num.dAddOffset(31-a.num.mod(c).byteValue(),0),d=0,++a.pqState):1===a.pqState?a.num.bitLength()>h?a.pqState=0:a.num.isProbablePrime(El(a.num.bitLength()))?++a.pqState:a.num.dAddOffset(Op[d++%8],0):2===a.pqState?a.pqState=0===a.num.subtract(M.ONE).gcd(a.e).compareTo(M.ONE)?3:0:3===a.pqState&&(a.pqState=0,null===a.p?a.p=a.num:a.q=a.num,null!==a.p&&null!==a.q&&++a.state,a.num=null)}else 1===a.state?(0>a.p.compareTo(a.q)&&(a.num=a.p,a.p=a.q,a.q=a.num),++a.state):2===a.state?(a.p1=a.p.subtract(M.ONE),
|
588
|
+
a.q1=a.q.subtract(M.ONE),a.phi=a.p1.multiply(a.q1),++a.state):3===a.state?0===a.phi.gcd(a.e).compareTo(M.ONE)?++a.state:(a.p=null,a.q=null,a.state=0):4===a.state?(a.n=a.p.multiply(a.q),a.n.bitLength()===a.bits?++a.state:(a.q=null,a.state=0)):5===a.state&&(h=a.e.modInverse(a.phi),a.keys={privateKey:F.rsa.setPrivateKey(a.n,a.e,h,a.p,a.q,h.mod(a.p1),h.mod(a.q1),a.q.modInverse(a.p)),publicKey:F.rsa.setPublicKey(a.n,a.e)});h=+new Date;k+=h-f;f=h}return null!==a.keys};F.rsa.generateKeyPair=function(a,b,
|
589
|
+
c,d){1===arguments.length?"object"===typeof a?(c=a,a=void 0):"function"===typeof a&&(d=a,a=void 0):2===arguments.length?"number"===typeof a?"function"===typeof b?(d=b,b=void 0):"number"!==typeof b&&(c=b,b=void 0):(c=a,d=b,b=a=void 0):3===arguments.length&&("number"===typeof b?"function"===typeof c&&(d=c,c=void 0):(d=c,c=b,b=void 0));c=c||{};void 0===a&&(a=c.bits||2048);void 0===b&&(b=c.e||65537);if(!c.prng&&256<=a&&16384>=a&&(65537===b||3===b))if(d){if(k.util.isNodejs&&"function"===typeof qe.generateKeyPair)return qe.generateKeyPair("rsa",
|
590
|
+
{modulusLength:a,publicExponent:b,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}},function(a,b,c){if(a)return d(a);d(null,{privateKey:F.privateKeyFromPem(c),publicKey:F.publicKeyFromPem(b)})});if($g("generateKey")&&$g("exportKey"))return Ta.globalScope.crypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:a,publicExponent:bh(b),hash:{name:"SHA-256"}},!0,["sign","verify"]).then(function(a){return Ta.globalScope.crypto.subtle.exportKey("pkcs8",
|
591
|
+
a.privateKey)}).then(void 0,function(a){d(a)}).then(function(a){a&&(a=F.privateKeyFromAsn1(t.fromDer(k.util.createBuffer(a))),d(null,{privateKey:a,publicKey:F.setRsaPublicKey(a.n,a.e)}))});if(ah("generateKey")&&ah("exportKey")){var e=Ta.globalScope.msCrypto.subtle.generateKey({name:"RSASSA-PKCS1-v1_5",modulusLength:a,publicExponent:bh(b),hash:{name:"SHA-256"}},!0,["sign","verify"]);e.oncomplete=function(a){a=Ta.globalScope.msCrypto.subtle.exportKey("pkcs8",a.target.result.privateKey);a.oncomplete=
|
592
|
+
function(a){a=F.privateKeyFromAsn1(t.fromDer(k.util.createBuffer(a.target.result)));d(null,{privateKey:a,publicKey:F.setRsaPublicKey(a.n,a.e)})};a.onerror=function(a){d(a)}};e.onerror=function(a){d(a)};return}}else if(k.util.isNodejs&&"function"===typeof qe.generateKeyPairSync)return e=qe.generateKeyPairSync("rsa",{modulusLength:a,publicExponent:b,publicKeyEncoding:{type:"spki",format:"pem"},privateKeyEncoding:{type:"pkcs8",format:"pem"}}),{privateKey:F.privateKeyFromPem(e.privateKey),publicKey:F.publicKeyFromPem(e.publicKey)};
|
593
|
+
e=F.rsa.createKeyPairGenerationState(a,b,c);if(!d)return F.rsa.stepKeyPairGenerationState(e,0),e.keys;Dl(e,c,d)};F.setRsaPublicKey=F.rsa.setPublicKey=function(a,b){var c={n:a,e:b,encrypt:function(a,b,f){"string"===typeof b?b=b.toUpperCase():void 0===b&&(b="RSAES-PKCS1-V1_5");if("RSAES-PKCS1-V1_5"===b)b={encode:function(a,b,c){return Zg(a,b,2).getBytes()}};else if("RSA-OAEP"===b||"RSAES-OAEP"===b)b={encode:function(a,b){return k.pkcs1.encode_rsa_oaep(b,a,f)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(b))b=
|
594
|
+
{encode:function(a){return a}};else if("string"===typeof b)throw Error('Unsupported encryption scheme: "'+b+'".');a=b.encode(a,c,!0);return F.rsa.encrypt(a,c,!0)},verify:function(a,b,f){"string"===typeof f?f=f.toUpperCase():void 0===f&&(f="RSASSA-PKCS1-V1_5");if("RSASSA-PKCS1-V1_5"===f)f={verify:function(a,b){b=Ed(b,c,!0);b=t.fromDer(b);return a===b.value[1].value}};else if("NONE"===f||"NULL"===f||null===f)f={verify:function(a,b){b=Ed(b,c,!0);return a===b}};b=F.rsa.decrypt(b,c,!0,!1);return f.verify(a,
|
595
|
+
b,c.n.bitLength())}};return c};F.setRsaPrivateKey=F.rsa.setPrivateKey=function(a,b,c,d,e,f,h,m){var l={n:a,e:b,d:c,p:d,q:e,dP:f,dQ:h,qInv:m,decrypt:function(a,b,c){"string"===typeof b?b=b.toUpperCase():void 0===b&&(b="RSAES-PKCS1-V1_5");a=F.rsa.decrypt(a,l,!1,!1);if("RSAES-PKCS1-V1_5"===b)b={decode:Ed};else if("RSA-OAEP"===b||"RSAES-OAEP"===b)b={decode:function(a,b){return k.pkcs1.decode_rsa_oaep(b,a,c)}};else if(-1!==["RAW","NONE","NULL",null].indexOf(b))b={decode:function(a){return a}};else throw Error('Unsupported encryption scheme: "'+
|
596
|
+
b+'".');return b.decode(a,l,!1)},sign:function(a,b){var c=!1;"string"===typeof b&&(b=b.toUpperCase());if(void 0===b||"RSASSA-PKCS1-V1_5"===b)b={encode:Tp},c=1;else if("NONE"===b||"NULL"===b||null===b)b={encode:function(){return a}},c=1;b=b.encode(a,l.n.bitLength());return F.rsa.encrypt(b,l,c)}};return l};F.wrapRsaPrivateKey=function(a){return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(0).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,
|
597
|
+
!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(F.oids.rsaEncryption).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")]),t.create(t.Class.UNIVERSAL,t.Type.OCTETSTRING,!1,t.toDer(a).getBytes())])};F.privateKeyFromAsn1=function(a){var b={},c=[];t.validate(a,Pp,b,c)&&(a=t.fromDer(k.util.createBuffer(b.privateKey)));b={};c=[];if(!t.validate(a,Qp,b,c))throw b=Error("Cannot read private key. ASN.1 object does not contain an RSAPrivateKey."),b.errors=c,b;c=k.util.createBuffer(b.privateKeyModulus).toHex();
|
598
|
+
a=k.util.createBuffer(b.privateKeyPublicExponent).toHex();var d=k.util.createBuffer(b.privateKeyPrivateExponent).toHex();var e=k.util.createBuffer(b.privateKeyPrime1).toHex();var f=k.util.createBuffer(b.privateKeyPrime2).toHex();var h=k.util.createBuffer(b.privateKeyExponent1).toHex();var m=k.util.createBuffer(b.privateKeyExponent2).toHex();b=k.util.createBuffer(b.privateKeyCoefficient).toHex();return F.setRsaPrivateKey(new M(c,16),new M(a,16),new M(d,16),new M(e,16),new M(f,16),new M(h,16),new M(m,
|
599
|
+
16),new M(b,16))};F.privateKeyToAsn1=F.privateKeyToRSAPrivateKey=function(a){return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,t.integerToDer(0).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,eb(a.n)),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,eb(a.e)),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,eb(a.d)),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,eb(a.p)),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,eb(a.q)),t.create(t.Class.UNIVERSAL,
|
600
|
+
t.Type.INTEGER,!1,eb(a.dP)),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,eb(a.dQ)),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,eb(a.qInv))])};F.publicKeyFromAsn1=function(a){var b={},c=[];if(t.validate(a,Sp,b,c)){c=t.derToOid(b.publicKeyOid);if(c!==F.oids.rsaEncryption)throw b=Error("Cannot read public key. Unknown OID."),b.oid=c,b;a=b.rsaPublicKey}c=[];if(!t.validate(a,Rp,b,c))throw b=Error("Cannot read public key. ASN.1 object does not contain an RSAPublicKey."),b.errors=c,b;c=k.util.createBuffer(b.publicKeyModulus).toHex();
|
601
|
+
b=k.util.createBuffer(b.publicKeyExponent).toHex();return F.setRsaPublicKey(new M(c,16),new M(b,16))};F.publicKeyToAsn1=F.publicKeyToSubjectPublicKeyInfo=function(a){return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.OID,!1,t.oidToDer(F.oids.rsaEncryption).getBytes()),t.create(t.Class.UNIVERSAL,t.Type.NULL,!1,"")]),t.create(t.Class.UNIVERSAL,t.Type.BITSTRING,!1,[F.publicKeyToRSAPublicKey(a)])])};F.publicKeyToRSAPublicKey=
|
602
|
+
function(a){return t.create(t.Class.UNIVERSAL,t.Type.SEQUENCE,!0,[t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,eb(a.n)),t.create(t.Class.UNIVERSAL,t.Type.INTEGER,!1,eb(a.e))])};if("undefined"===typeof Up)var Up=k.jsbn.BigInteger;var y=k.asn1,G=k.pki=k.pki||{};G.pbe=k.pbe=k.pbe||{};var Zb=G.oids,Vp={name:"EncryptedPrivateKeyInfo",tagClass:y.Class.UNIVERSAL,type:y.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedPrivateKeyInfo.encryptionAlgorithm",tagClass:y.Class.UNIVERSAL,type:y.Type.SEQUENCE,
|
603
|
+
constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:y.Class.UNIVERSAL,type:y.Type.OID,constructed:!1,capture:"encryptionOid"},{name:"AlgorithmIdentifier.parameters",tagClass:y.Class.UNIVERSAL,type:y.Type.SEQUENCE,constructed:!0,captureAsn1:"encryptionParams"}]},{name:"EncryptedPrivateKeyInfo.encryptedData",tagClass:y.Class.UNIVERSAL,type:y.Type.OCTETSTRING,constructed:!1,capture:"encryptedData"}]},Wp={name:"PBES2Algorithms",tagClass:y.Class.UNIVERSAL,type:y.Type.SEQUENCE,constructed:!0,
|
604
|
+
value:[{name:"PBES2Algorithms.keyDerivationFunc",tagClass:y.Class.UNIVERSAL,type:y.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.keyDerivationFunc.oid",tagClass:y.Class.UNIVERSAL,type:y.Type.OID,constructed:!1,capture:"kdfOid"},{name:"PBES2Algorithms.params",tagClass:y.Class.UNIVERSAL,type:y.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.params.salt",tagClass:y.Class.UNIVERSAL,type:y.Type.OCTETSTRING,constructed:!1,capture:"kdfSalt"},{name:"PBES2Algorithms.params.iterationCount",
|
605
|
+
tagClass:y.Class.UNIVERSAL,type:y.Type.INTEGER,constructed:!1,capture:"kdfIterationCount"},{name:"PBES2Algorithms.params.keyLength",tagClass:y.Class.UNIVERSAL,type:y.Type.INTEGER,constructed:!1,optional:!0,capture:"keyLength"},{name:"PBES2Algorithms.params.prf",tagClass:y.Class.UNIVERSAL,type:y.Type.SEQUENCE,constructed:!0,optional:!0,value:[{name:"PBES2Algorithms.params.prf.algorithm",tagClass:y.Class.UNIVERSAL,type:y.Type.OID,constructed:!1,capture:"prfOid"}]}]}]},{name:"PBES2Algorithms.encryptionScheme",
|
606
|
+
tagClass:y.Class.UNIVERSAL,type:y.Type.SEQUENCE,constructed:!0,value:[{name:"PBES2Algorithms.encryptionScheme.oid",tagClass:y.Class.UNIVERSAL,type:y.Type.OID,constructed:!1,capture:"encOid"},{name:"PBES2Algorithms.encryptionScheme.iv",tagClass:y.Class.UNIVERSAL,type:y.Type.OCTETSTRING,constructed:!1,capture:"encIv"}]}]},Xp={name:"pkcs-12PbeParams",tagClass:y.Class.UNIVERSAL,type:y.Type.SEQUENCE,constructed:!0,value:[{name:"pkcs-12PbeParams.salt",tagClass:y.Class.UNIVERSAL,type:y.Type.OCTETSTRING,
|
607
|
+
constructed:!1,capture:"salt"},{name:"pkcs-12PbeParams.iterations",tagClass:y.Class.UNIVERSAL,type:y.Type.INTEGER,constructed:!1,capture:"iterations"}]};G.encryptPrivateKeyInfo=function(a,b,c){c=c||{};c.saltSize=c.saltSize||8;c.count=c.count||2048;c.algorithm=c.algorithm||"aes128";c.prfAlgorithm=c.prfAlgorithm||"sha1";var d=k.random.getBytesSync(c.saltSize),e=c.count,f=y.integerToDer(e),h;if(0===c.algorithm.indexOf("aes")||"des"===c.algorithm){switch(c.algorithm){case "aes128":var m=h=16;var l=Zb["aes128-CBC"];
|
608
|
+
var n=k.aes.createEncryptionCipher;break;case "aes192":h=24;m=16;l=Zb["aes192-CBC"];n=k.aes.createEncryptionCipher;break;case "aes256":h=32;m=16;l=Zb["aes256-CBC"];n=k.aes.createEncryptionCipher;break;case "des":m=h=8;l=Zb.desCBC;n=k.des.createEncryptionCipher;break;default:throw d=Error("Cannot encrypt private key. Unknown encryption algorithm."),d.algorithm=c.algorithm,d;}c="hmacWith"+c.prfAlgorithm.toUpperCase();var p=eh(c);p=k.pkcs5.pbkdf2(b,d,e,h,p);b=k.random.getBytesSync(m);e=n(p);e.start(b);
|
609
|
+
e.update(y.toDer(a));e.finish();a=e.output.getBytes();d=y.create(y.Class.UNIVERSAL,y.Type.SEQUENCE,!0,[y.create(y.Class.UNIVERSAL,y.Type.OCTETSTRING,!1,d),y.create(y.Class.UNIVERSAL,y.Type.INTEGER,!1,f.getBytes())]);"hmacWithSHA1"!==c&&d.value.push(y.create(y.Class.UNIVERSAL,y.Type.INTEGER,!1,k.util.hexToBytes(h.toString(16))),y.create(y.Class.UNIVERSAL,y.Type.SEQUENCE,!0,[y.create(y.Class.UNIVERSAL,y.Type.OID,!1,y.oidToDer(G.oids[c]).getBytes()),y.create(y.Class.UNIVERSAL,y.Type.NULL,!1,"")]));d=
|
610
|
+
y.create(y.Class.UNIVERSAL,y.Type.SEQUENCE,!0,[y.create(y.Class.UNIVERSAL,y.Type.OID,!1,y.oidToDer(Zb.pkcs5PBES2).getBytes()),y.create(y.Class.UNIVERSAL,y.Type.SEQUENCE,!0,[y.create(y.Class.UNIVERSAL,y.Type.SEQUENCE,!0,[y.create(y.Class.UNIVERSAL,y.Type.OID,!1,y.oidToDer(Zb.pkcs5PBKDF2).getBytes()),d]),y.create(y.Class.UNIVERSAL,y.Type.SEQUENCE,!0,[y.create(y.Class.UNIVERSAL,y.Type.OID,!1,y.oidToDer(l).getBytes()),y.create(y.Class.UNIVERSAL,y.Type.OCTETSTRING,!1,b)])])])}else if("3des"===c.algorithm)h=
|
611
|
+
24,l=new k.util.ByteBuffer(d),p=G.pbe.generatePkcs12Key(b,l,1,e,h),b=G.pbe.generatePkcs12Key(b,l,2,e,h),e=k.des.createEncryptionCipher(p),e.start(b),e.update(y.toDer(a)),e.finish(),a=e.output.getBytes(),d=y.create(y.Class.UNIVERSAL,y.Type.SEQUENCE,!0,[y.create(y.Class.UNIVERSAL,y.Type.OID,!1,y.oidToDer(Zb["pbeWithSHAAnd3-KeyTripleDES-CBC"]).getBytes()),y.create(y.Class.UNIVERSAL,y.Type.SEQUENCE,!0,[y.create(y.Class.UNIVERSAL,y.Type.OCTETSTRING,!1,d),y.create(y.Class.UNIVERSAL,y.Type.INTEGER,!1,f.getBytes())])]);
|
612
|
+
else throw d=Error("Cannot encrypt private key. Unknown encryption algorithm."),d.algorithm=c.algorithm,d;return y.create(y.Class.UNIVERSAL,y.Type.SEQUENCE,!0,[d,y.create(y.Class.UNIVERSAL,y.Type.OCTETSTRING,!1,a)])};G.decryptPrivateKeyInfo=function(a,b){var c=null,d={},e=[];if(!y.validate(a,Vp,d,e))throw c=Error("Cannot read encrypted private key. ASN.1 object is not a supported EncryptedPrivateKeyInfo."),c.errors=e,c;e=y.derToOid(d.encryptionOid);b=G.pbe.getCipher(e,d.encryptionParams,b);d=k.util.createBuffer(d.encryptedData);
|
613
|
+
b.update(d);b.finish()&&(c=y.fromDer(b.output));return c};G.encryptedPrivateKeyToPem=function(a,b){a={type:"ENCRYPTED PRIVATE KEY",body:y.toDer(a).getBytes()};return k.pem.encode(a,{maxline:b})};G.encryptedPrivateKeyFromPem=function(a){a=k.pem.decode(a)[0];if("ENCRYPTED PRIVATE KEY"!==a.type){var b=Error('Could not convert encrypted private key from PEM; PEM header type is "ENCRYPTED PRIVATE KEY".');b.headerType=a.type;throw b;}if(a.procType&&"ENCRYPTED"===a.procType.type)throw Error("Could not convert encrypted private key from PEM; PEM is encrypted.");
|
614
|
+
return y.fromDer(a.body)};G.encryptRsaPrivateKey=function(a,b,c){c=c||{};if(!c.legacy)return a=G.wrapRsaPrivateKey(G.privateKeyToAsn1(a)),a=G.encryptPrivateKeyInfo(a,b,c),G.encryptedPrivateKeyToPem(a);switch(c.algorithm){case "aes128":c="AES-128-CBC";var d=16;var e=k.random.getBytesSync(16);var f=k.aes.createEncryptionCipher;break;case "aes192":c="AES-192-CBC";d=24;e=k.random.getBytesSync(16);f=k.aes.createEncryptionCipher;break;case "aes256":c="AES-256-CBC";d=32;e=k.random.getBytesSync(16);f=k.aes.createEncryptionCipher;
|
615
|
+
break;case "3des":c="DES-EDE3-CBC";d=24;e=k.random.getBytesSync(8);f=k.des.createEncryptionCipher;break;case "des":c="DES-CBC";d=8;e=k.random.getBytesSync(8);f=k.des.createEncryptionCipher;break;default:throw a=Error('Could not encrypt RSA private key; unsupported encryption algorithm "'+c.algorithm+'".'),a.algorithm=c.algorithm,a;}b=k.pbe.opensslDeriveBytes(b,e.substr(0,8),d);b=f(b);b.start(e);b.update(y.toDer(G.privateKeyToAsn1(a)));b.finish();a={type:"RSA PRIVATE KEY",procType:{version:"4",type:"ENCRYPTED"},
|
616
|
+
dekInfo:{algorithm:c,parameters:k.util.bytesToHex(e).toUpperCase()},body:b.output.getBytes()};return k.pem.encode(a)};G.decryptRsaPrivateKey=function(a,b){var c=null;a=k.pem.decode(a)[0];if("ENCRYPTED PRIVATE KEY"!==a.type&&"PRIVATE KEY"!==a.type&&"RSA PRIVATE KEY"!==a.type)throw b=Error('Could not convert private key from PEM; PEM header type is not "ENCRYPTED PRIVATE KEY", "PRIVATE KEY", or "RSA PRIVATE KEY".'),b.headerType=b,b;if(a.procType&&"ENCRYPTED"===a.procType.type){switch(a.dekInfo.algorithm){case "DES-CBC":var d=
|
617
|
+
8;var e=k.des.createDecryptionCipher;break;case "DES-EDE3-CBC":d=24;e=k.des.createDecryptionCipher;break;case "AES-128-CBC":d=16;e=k.aes.createDecryptionCipher;break;case "AES-192-CBC":d=24;e=k.aes.createDecryptionCipher;break;case "AES-256-CBC":d=32;e=k.aes.createDecryptionCipher;break;case "RC2-40-CBC":d=5;e=function(a){return k.rc2.createDecryptionCipher(a,40)};break;case "RC2-64-CBC":d=8;e=function(a){return k.rc2.createDecryptionCipher(a,64)};break;case "RC2-128-CBC":d=16;e=function(a){return k.rc2.createDecryptionCipher(a,
|
618
|
+
128)};break;default:throw b=Error('Could not decrypt private key; unsupported encryption algorithm "'+a.dekInfo.algorithm+'".'),b.algorithm=a.dekInfo.algorithm,b;}var f=k.util.hexToBytes(a.dekInfo.parameters);d=k.pbe.opensslDeriveBytes(b,f.substr(0,8),d);e=e(d);e.start(f);e.update(k.util.createBuffer(a.body));if(e.finish())c=e.output.getBytes();else return c}else c=a.body;c="ENCRYPTED PRIVATE KEY"===a.type?G.decryptPrivateKeyInfo(y.fromDer(c),b):y.fromDer(c);null!==c&&(c=G.privateKeyFromAsn1(c));
|
619
|
+
return c};G.pbe.generatePkcs12Key=function(a,b,c,d,e,f){var h,m;if("undefined"===typeof f||null===f){if(!("sha1"in k.md))throw Error('"sha1" hash algorithm unavailable.');f=k.md.sha1.create()}var l=f.digestLength,n=f.blockLength,p=new k.util.ByteBuffer,r=new k.util.ByteBuffer;if(null!==a&&void 0!==a){for(m=0;m<a.length;m++)r.putInt16(a.charCodeAt(m));r.putInt16(0)}a=r.length();var q=b.length(),u=new k.util.ByteBuffer;u.fillWithByte(c,n);var v=n*Math.ceil(q/n);c=new k.util.ByteBuffer;for(m=0;m<v;m++)c.putByte(b.at(m%
|
620
|
+
q));v=n*Math.ceil(a/n);b=new k.util.ByteBuffer;for(m=0;m<v;m++)b.putByte(r.at(m%a));r=c;r.putBuffer(b);b=Math.ceil(e/l);for(c=1;c<=b;c++){v=new k.util.ByteBuffer;v.putBytes(u.bytes());v.putBytes(r.bytes());for(m=0;m<d;m++)f.start(),f.update(v.getBytes()),v=f.digest();var S=new k.util.ByteBuffer;for(m=0;m<n;m++)S.putByte(v.at(m%l));var t=Math.ceil(q/n)+Math.ceil(a/n),w=new k.util.ByteBuffer;for(h=0;h<t;h++){var R=new k.util.ByteBuffer(r.getBytes(n)),N=511;for(m=S.length()-1;0<=m;m--)N>>=8,N+=S.at(m)+
|
621
|
+
R.at(m),R.setAt(m,N&255);w.putBuffer(R)}r=w;p.putBuffer(v)}p.truncate(p.length()-e);return p};G.pbe.getCipher=function(a,b,c){switch(a){case G.oids.pkcs5PBES2:return G.pbe.getCipherForPBES2(a,b,c);case G.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:case G.oids["pbewithSHAAnd40BitRC2-CBC"]:return G.pbe.getCipherForPKCS12PBE(a,b,c);default:throw b=Error("Cannot read encrypted PBE data block. Unsupported OID."),b.oid=a,b.supportedOids=["pkcs5PBES2","pbeWithSHAAnd3-KeyTripleDES-CBC","pbewithSHAAnd40BitRC2-CBC"],
|
622
|
+
b;}};G.pbe.getCipherForPBES2=function(a,b,c){var d={};a=[];if(!y.validate(b,Wp,d,a)){var e=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo.");e.errors=a;throw e;}a=y.derToOid(d.kdfOid);if(a!==G.oids.pkcs5PBKDF2)throw e=Error("Cannot read encrypted private key. Unsupported key derivation function OID."),e.oid=a,e.supportedOids=["pkcs5PBKDF2"],e;a=y.derToOid(d.encOid);if(a!==G.oids["aes128-CBC"]&&a!==G.oids["aes192-CBC"]&&a!==
|
623
|
+
G.oids["aes256-CBC"]&&a!==G.oids["des-EDE3-CBC"]&&a!==G.oids.desCBC)throw e=Error("Cannot read encrypted private key. Unsupported encryption scheme OID."),e.oid=a,e.supportedOids=["aes128-CBC","aes192-CBC","aes256-CBC","des-EDE3-CBC","desCBC"],e;b=d.kdfSalt;var f=k.util.createBuffer(d.kdfIterationCount);f=f.getInt(f.length()<<3);switch(G.oids[a]){case "aes128-CBC":var h=16;e=k.aes.createDecryptionCipher;break;case "aes192-CBC":h=24;e=k.aes.createDecryptionCipher;break;case "aes256-CBC":h=32;e=k.aes.createDecryptionCipher;
|
624
|
+
break;case "des-EDE3-CBC":h=24;e=k.des.createDecryptionCipher;break;case "desCBC":h=8,e=k.des.createDecryptionCipher}a=dh(d.prfOid);c=k.pkcs5.pbkdf2(c,b,f,h,a);d=d.encIv;e=e(c);e.start(d);return e};G.pbe.getCipherForPKCS12PBE=function(a,b,c){var d={},e=[];if(!y.validate(b,Xp,d,e))throw c=Error("Cannot read password-based-encryption algorithm parameters. ASN.1 object is not a supported EncryptedPrivateKeyInfo."),c.errors=e,c;e=k.util.createBuffer(d.salt);b=k.util.createBuffer(d.iterations);b=b.getInt(b.length()<<
|
625
|
+
3);switch(a){case G.oids["pbeWithSHAAnd3-KeyTripleDES-CBC"]:var f=24;var h=8;a=k.des.startDecrypting;break;case G.oids["pbewithSHAAnd40BitRC2-CBC"]:f=5;h=8;a=function(a,b){a=k.rc2.createDecryptionCipher(a,40);a.start(b,null);return a};break;default:throw c=Error("Cannot read PKCS #12 PBE data block. Unsupported OID."),c.oid=a,c;}d=dh(d.prfOid);f=G.pbe.generatePkcs12Key(c,e,1,b,f,d);d.start();c=G.pbe.generatePkcs12Key(c,e,2,b,h,d);return a(f,c)};G.pbe.opensslDeriveBytes=function(a,b,c,d){if("undefined"===
|
626
|
+
typeof d||null===d){if(!("md5"in k.md))throw Error('"md5" hash algorithm unavailable.');d=k.md.md5.create()}null===b&&(b="");for(var e=[ch(d,a+b)],f=16,h=1;f<c;++h,f+=16)e.push(ch(d,e[h-1]+a+b));return e.join("").substr(0,c)};C(function(a){var b=k.asn1;a=a.exports=k.pkcs7asn1=k.pkcs7asn1||{};k.pkcs7=k.pkcs7||{};k.pkcs7.asn1=a;var c={name:"ContentInfo",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.ContentType",tagClass:b.Class.UNIVERSAL,type:b.Type.OID,constructed:!1,
|
627
|
+
capture:"contentType"},{name:"ContentInfo.content",tagClass:b.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,captureAsn1:"content"}]};a.contentInfoValidator=c;var d={name:"EncryptedContentInfo",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedContentInfo.contentType",tagClass:b.Class.UNIVERSAL,type:b.Type.OID,constructed:!1,capture:"contentType"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,
|
628
|
+
value:[{name:"EncryptedContentInfo.contentEncryptionAlgorithm.algorithm",tagClass:b.Class.UNIVERSAL,type:b.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"EncryptedContentInfo.contentEncryptionAlgorithm.parameter",tagClass:b.Class.UNIVERSAL,captureAsn1:"encParameter"}]},{name:"EncryptedContentInfo.encryptedContent",tagClass:b.Class.CONTEXT_SPECIFIC,type:0,capture:"encryptedContent",captureAsn1:"encryptedContentAsn1"}]};a.envelopedDataValidator={name:"EnvelopedData",tagClass:b.Class.UNIVERSAL,
|
629
|
+
type:b.Type.SEQUENCE,constructed:!0,value:[{name:"EnvelopedData.Version",tagClass:b.Class.UNIVERSAL,type:b.Type.INTEGER,constructed:!1,capture:"version"},{name:"EnvelopedData.RecipientInfos",tagClass:b.Class.UNIVERSAL,type:b.Type.SET,constructed:!0,captureAsn1:"recipientInfos"}].concat(d)};a.encryptedDataValidator={name:"EncryptedData",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,value:[{name:"EncryptedData.Version",tagClass:b.Class.UNIVERSAL,type:b.Type.INTEGER,constructed:!1,capture:"version"}].concat(d)};
|
630
|
+
a.signedDataValidator={name:"SignedData",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,value:[{name:"SignedData.Version",tagClass:b.Class.UNIVERSAL,type:b.Type.INTEGER,constructed:!1,capture:"version"},{name:"SignedData.DigestAlgorithms",tagClass:b.Class.UNIVERSAL,type:b.Type.SET,constructed:!0,captureAsn1:"digestAlgorithms"},c,{name:"SignedData.Certificates",tagClass:b.Class.CONTEXT_SPECIFIC,type:0,optional:!0,captureAsn1:"certificates"},{name:"SignedData.CertificateRevocationLists",
|
631
|
+
tagClass:b.Class.CONTEXT_SPECIFIC,type:1,optional:!0,captureAsn1:"crls"},{name:"SignedData.SignerInfos",tagClass:b.Class.UNIVERSAL,type:b.Type.SET,capture:"signerInfos",optional:!0,value:[{name:"SignerInfo",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.version",tagClass:b.Class.UNIVERSAL,type:b.Type.INTEGER,constructed:!1},{name:"SignerInfo.issuerAndSerialNumber",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.issuerAndSerialNumber.issuer",
|
632
|
+
tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"SignerInfo.issuerAndSerialNumber.serialNumber",tagClass:b.Class.UNIVERSAL,type:b.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"SignerInfo.digestAlgorithm",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,value:[{name:"SignerInfo.digestAlgorithm.algorithm",tagClass:b.Class.UNIVERSAL,type:b.Type.OID,constructed:!1,capture:"digestAlgorithm"},{name:"SignerInfo.digestAlgorithm.parameter",
|
633
|
+
tagClass:b.Class.UNIVERSAL,constructed:!1,captureAsn1:"digestParameter",optional:!0}]},{name:"SignerInfo.authenticatedAttributes",tagClass:b.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"authenticatedAttributes"},{name:"SignerInfo.digestEncryptionAlgorithm",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,capture:"signatureAlgorithm"},{name:"SignerInfo.encryptedDigest",tagClass:b.Class.UNIVERSAL,type:b.Type.OCTETSTRING,constructed:!1,capture:"signature"},{name:"SignerInfo.unauthenticatedAttributes",
|
634
|
+
tagClass:b.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,optional:!0,capture:"unauthenticatedAttributes"}]}]}]};a.recipientInfoValidator={name:"RecipientInfo",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.version",tagClass:b.Class.UNIVERSAL,type:b.Type.INTEGER,constructed:!1,capture:"version"},{name:"RecipientInfo.issuerAndSerial",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.issuerAndSerial.issuer",tagClass:b.Class.UNIVERSAL,
|
635
|
+
type:b.Type.SEQUENCE,constructed:!0,captureAsn1:"issuer"},{name:"RecipientInfo.issuerAndSerial.serialNumber",tagClass:b.Class.UNIVERSAL,type:b.Type.INTEGER,constructed:!1,capture:"serial"}]},{name:"RecipientInfo.keyEncryptionAlgorithm",tagClass:b.Class.UNIVERSAL,type:b.Type.SEQUENCE,constructed:!0,value:[{name:"RecipientInfo.keyEncryptionAlgorithm.algorithm",tagClass:b.Class.UNIVERSAL,type:b.Type.OID,constructed:!1,capture:"encAlgorithm"},{name:"RecipientInfo.keyEncryptionAlgorithm.parameter",tagClass:b.Class.UNIVERSAL,
|
636
|
+
constructed:!1,captureAsn1:"encParameter"}]},{name:"RecipientInfo.encryptedKey",tagClass:b.Class.UNIVERSAL,type:b.Type.OCTETSTRING,constructed:!1,capture:"encKey"}]}});C(function(a){k.mgf=k.mgf||{};(a.exports=k.mgf.mgf1=k.mgf1=k.mgf1||{}).create=function(a){return{generate:function(b,d){for(var c=new k.util.ByteBuffer,f=Math.ceil(d/a.digestLength),h=0;h<f;h++){var m=new k.util.ByteBuffer;m.putInt32(h);a.start();a.update(b+m.getBytes());c.putBuffer(a.digest())}c.truncate(c.length()-d);return c.getBytes()}}}});
|
637
|
+
k.mgf=k.mgf||{};k.mgf.mgf1=k.mgf1;C(function(a){(a.exports=k.pss=k.pss||{}).create=function(a){3===arguments.length&&(a={md:arguments[0],mgf:arguments[1],saltLength:arguments[2]});var b=a.md,d=a.mgf,e=b.digestLength,f=a.salt||null;"string"===typeof f&&(f=k.util.createBuffer(f));if("saltLength"in a)var h=a.saltLength;else if(null!==f)h=f.length();else throw Error("Salt length not specified or specific salt not given.");if(null!==f&&f.length()!==h)throw Error("Given salt length does not match length of given salt.");
|
638
|
+
var m=a.prng||k.random;return{encode:function(a,c){--c;var l=Math.ceil(c/8);a=a.digest().getBytes();if(l<e+h+2)throw Error("Message is too long to encrypt.");var n=null===f?m.getBytesSync(h):f.bytes();var p=new k.util.ByteBuffer;p.fillWithByte(0,8);p.putBytes(a);p.putBytes(n);b.start();b.update(p.getBytes());a=b.digest().getBytes();p=new k.util.ByteBuffer;p.fillWithByte(0,l-h-e-2);p.putByte(1);p.putBytes(n);var q=p.getBytes(),v=l-e-1,t=d.generate(a,v);n="";for(p=0;p<v;p++)n+=String.fromCharCode(q.charCodeAt(p)^
|
639
|
+
t.charCodeAt(p));c=65280>>8*l-c&255;n=String.fromCharCode(n.charCodeAt(0)&~c)+n.substr(1);return n+a+String.fromCharCode(188)},verify:function(a,c,f){var l=f-1;f=Math.ceil(l/8);c=c.substr(-f);if(f<e+h+2)throw Error("Inconsistent parameters to PSS signature verification.");if(188!==c.charCodeAt(f-1))throw Error("Encoded message does not end in 0xBC.");var m=f-e-1,n=c.substr(0,m);c=c.substr(m,e);var p=65280>>8*f-l&255;if(0!==(n.charCodeAt(0)&p))throw Error("Bits beyond keysize not zero as expected.");
|
640
|
+
var q=d.generate(c,m),X="";for(l=0;l<m;l++)X+=String.fromCharCode(n.charCodeAt(l)^q.charCodeAt(l));X=String.fromCharCode(X.charCodeAt(0)&~p)+X.substr(1);f=f-e-h-2;for(l=0;l<f;l++)if(0!==X.charCodeAt(l))throw Error("Leftmost octets not zero as expected");if(1!==X.charCodeAt(f))throw Error("Inconsistent PSS signature, 0x01 marker not found");f=X.substr(-h);m=new k.util.ByteBuffer;m.fillWithByte(0,8);m.putBytes(a);m.putBytes(f);b.start();b.update(m.getBytes());a=b.digest().getBytes();return c===a}}}});
|
641
|
+
C(function(a){function b(a,b){"string"===typeof b&&(b={shortName:b});for(var c=null,d,e=0;null===c&&e<a.attributes.length;++e)d=a.attributes[e],b.type&&b.type===d.type?c=d:b.name&&b.name===d.name?c=d:b.shortName&&b.shortName===d.shortName&&(c=d);return c}function c(a){var b=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);a=a.attributes;for(var c=0;c<a.length;++c){var d=a[c];var e=d.value,f=l.Type.PRINTABLESTRING;"valueTagClass"in d&&(f=d.valueTagClass,f===l.Type.UTF8&&(e=k.util.encodeUtf8(e)));
|
642
|
+
d=l.create(l.Class.UNIVERSAL,l.Type.SET,!0,[l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(d.type).getBytes()),l.create(l.Class.UNIVERSAL,f,!1,e)])]);b.value.push(d)}return b}function d(a){for(var b,c=0;c<a.length;++c){b=a[c];"undefined"===typeof b.name&&(b.type&&b.type in n.oids?b.name=n.oids[b.type]:b.shortName&&b.shortName in r&&(b.name=n.oids[r[b.shortName]]));if("undefined"===typeof b.type)if(b.name&&b.name in n.oids)b.type=n.oids[b.name];else throw a=
|
643
|
+
Error("Attribute type not specified."),a.attribute=b,a;"undefined"===typeof b.shortName&&b.name&&b.name in r&&(b.shortName=r[b.name]);if(b.type===p.extensionRequest&&(b.valueConstructed=!0,b.valueTagClass=l.Type.SEQUENCE,!b.value&&b.extensions)){b.value=[];for(var d=0;d<b.extensions.length;++d)b.value.push(n.certificateExtensionToAsn1(e(b.extensions[d])))}if("undefined"===typeof b.value)throw a=Error("Attribute value not specified."),a.attribute=b,a;}}function e(a,b){b=b||{};"undefined"===typeof a.name&&
|
644
|
+
a.id&&a.id in n.oids&&(a.name=n.oids[a.id]);if("undefined"===typeof a.id)if(a.name&&a.name in n.oids)a.id=n.oids[a.name];else{var d=Error("Extension ID not specified.");d.extension=a;throw d;}if("undefined"!==typeof a.value)return a;if("keyUsage"===a.name){var e=d=b=0;a.digitalSignature&&(d|=128,b=7);a.nonRepudiation&&(d|=64,b=6);a.keyEncipherment&&(d|=32,b=5);a.dataEncipherment&&(d|=16,b=4);a.keyAgreement&&(d|=8,b=3);a.keyCertSign&&(d|=4,b=2);a.cRLSign&&(d|=2,b=1);a.encipherOnly&&(d|=1,b=0);a.decipherOnly&&
|
645
|
+
(e|=128,b=7);b=String.fromCharCode(b);0!==e?b+=String.fromCharCode(d)+String.fromCharCode(e):0!==d&&(b+=String.fromCharCode(d));a.value=l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,b)}else if("basicConstraints"===a.name)a.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]),a.cA&&a.value.value.push(l.create(l.Class.UNIVERSAL,l.Type.BOOLEAN,!1,String.fromCharCode(255))),"pathLenConstraint"in a&&a.value.value.push(l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(a.pathLenConstraint).getBytes()));
|
646
|
+
else if("extKeyUsage"===a.name)for(e in a.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]),d=a.value.value,a)!0===a[e]&&(e in p?d.push(l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(p[e]).getBytes())):-1!==e.indexOf(".")&&d.push(l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(e).getBytes())));else if("nsCertType"===a.name)d=b=0,a.client&&(d|=128,b=7),a.server&&(d|=64,b=6),a.email&&(d|=32,b=5),a.objsign&&(d|=16,b=4),a.reserved&&(d|=8,b=3),a.sslCA&&(d|=4,b=2),a.emailCA&&(d|=2,b=1),a.objCA&&
|
647
|
+
(d|=1,b=0),b=String.fromCharCode(b),0!==d&&(b+=String.fromCharCode(d)),a.value=l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,b);else if("subjectAltName"===a.name||"issuerAltName"===a.name){a.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);for(var f=0;f<a.altNames.length;++f){e=a.altNames[f];b=e.value;if(7===e.type&&e.ip){if(b=k.util.bytesFromIP(e.ip),null===b)throw d=Error('Extension "ip" value is not a valid IPv4 or IPv6 address.'),d.extension=a,d;}else 8===e.type&&(b=e.oid?l.oidToDer(l.oidToDer(e.oid)):
|
648
|
+
l.oidToDer(b));a.value.value.push(l.create(l.Class.CONTEXT_SPECIFIC,e.type,!1,b))}}else if("nsComment"===a.name&&b.cert){if(!/^[\x00-\x7F]*$/.test(a.comment)||1>a.comment.length||128<a.comment.length)throw Error('Invalid "nsComment" content.');a.value=l.create(l.Class.UNIVERSAL,l.Type.IA5STRING,!1,a.comment)}else if("subjectKeyIdentifier"===a.name&&b.cert)d=b.cert.generateSubjectKeyIdentifier(),a.subjectKeyIdentifier=d.toHex(),a.value=l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,d.getBytes());
|
649
|
+
else if("authorityKeyIdentifier"===a.name&&b.cert)a.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]),d=a.value.value,a.keyIdentifier&&(e=!0===a.keyIdentifier?b.cert.generateSubjectKeyIdentifier().getBytes():a.keyIdentifier,d.push(l.create(l.Class.CONTEXT_SPECIFIC,0,!1,e))),a.authorityCertIssuer&&(e=[l.create(l.Class.CONTEXT_SPECIFIC,4,!0,[c(!0===a.authorityCertIssuer?b.cert.issuer:a.authorityCertIssuer)])],d.push(l.create(l.Class.CONTEXT_SPECIFIC,1,!0,e))),a.serialNumber&&(b=k.util.hexToBytes(!0===
|
650
|
+
a.serialNumber?b.cert.serialNumber:a.serialNumber),d.push(l.create(l.Class.CONTEXT_SPECIFIC,2,!1,b)));else if("cRLDistributionPoints"===a.name){a.value=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);d=a.value.value;var h=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]),m=l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[]);for(f=0;f<a.altNames.length;++f){e=a.altNames[f];b=e.value;if(7===e.type&&e.ip){if(b=k.util.bytesFromIP(e.ip),null===b)throw d=Error('Extension "ip" value is not a valid IPv4 or IPv6 address.'),
|
651
|
+
d.extension=a,d;}else 8===e.type&&(b=e.oid?l.oidToDer(l.oidToDer(e.oid)):l.oidToDer(b));m.value.push(l.create(l.Class.CONTEXT_SPECIFIC,e.type,!1,b))}h.value.push(l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[m]));d.push(h)}if("undefined"===typeof a.value)throw d=Error("Extension value not specified."),d.extension=a,d;return a}function f(a,b){switch(a){case p["RSASSA-PSS"]:return a=[],void 0!==b.hash.algorithmOid&&a.push(l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,
|
652
|
+
!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(b.hash.algorithmOid).getBytes()),l.create(l.Class.UNIVERSAL,l.Type.NULL,!1,"")])])),void 0!==b.mgf.algorithmOid&&a.push(l.create(l.Class.CONTEXT_SPECIFIC,1,!0,[l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(b.mgf.algorithmOid).getBytes()),l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(b.mgf.hash.algorithmOid).getBytes()),l.create(l.Class.UNIVERSAL,
|
653
|
+
l.Type.NULL,!1,"")])])])),void 0!==b.saltLength&&a.push(l.create(l.Class.CONTEXT_SPECIFIC,2,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(b.saltLength).getBytes())])),l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,a);default:return l.create(l.Class.UNIVERSAL,l.Type.NULL,!1,"")}}function h(a){var b=l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[]);if(0===a.attributes.length)return b;a=a.attributes;for(var c=0;c<a.length;++c){var d=a[c],e=d.value,f=l.Type.UTF8;"valueTagClass"in d&&(f=d.valueTagClass);
|
654
|
+
f===l.Type.UTF8&&(e=k.util.encodeUtf8(e));var h=!1;"valueConstructed"in d&&(h=d.valueConstructed);d=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(d.type).getBytes()),l.create(l.Class.UNIVERSAL,l.Type.SET,!0,[l.create(l.Class.UNIVERSAL,f,h,e)])]);b.value.push(d)}return b}function m(a){return a>=w&&a<y?l.create(l.Class.UNIVERSAL,l.Type.UTCTIME,!1,l.dateToUtcTime(a)):l.create(l.Class.UNIVERSAL,l.Type.GENERALIZEDTIME,!1,l.dateToGeneralizedTime(a))}
|
655
|
+
var l=k.asn1,n=a.exports=k.pki=k.pki||{},p=n.oids,r={};r.CN=p.commonName;r.commonName="CN";r.C=p.countryName;r.countryName="C";r.L=p.localityName;r.localityName="L";r.ST=p.stateOrProvinceName;r.stateOrProvinceName="ST";r.O=p.organizationName;r.organizationName="O";r.OU=p.organizationalUnitName;r.organizationalUnitName="OU";r.E=p.emailAddress;r.emailAddress="E";a=k.pki.rsa.publicKeyValidator;var q={name:"Certificate",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate",
|
656
|
+
tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"tbsCertificate",value:[{name:"Certificate.TBSCertificate.version",tagClass:l.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.version.integer",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"certVersion"}]},{name:"Certificate.TBSCertificate.serialNumber",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"certSerialNumber"},{name:"Certificate.TBSCertificate.signature",
|
657
|
+
tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.signature.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"certinfoSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:l.Class.UNIVERSAL,optional:!0,captureAsn1:"certinfoSignatureParams"}]},{name:"Certificate.TBSCertificate.issuer",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"certIssuer"},{name:"Certificate.TBSCertificate.validity",
|
658
|
+
tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.TBSCertificate.validity.notBefore (utc)",tagClass:l.Class.UNIVERSAL,type:l.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity1UTCTime"},{name:"Certificate.TBSCertificate.validity.notBefore (generalized)",tagClass:l.Class.UNIVERSAL,type:l.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity2GeneralizedTime"},{name:"Certificate.TBSCertificate.validity.notAfter (utc)",tagClass:l.Class.UNIVERSAL,
|
659
|
+
type:l.Type.UTCTIME,constructed:!1,optional:!0,capture:"certValidity3UTCTime"},{name:"Certificate.TBSCertificate.validity.notAfter (generalized)",tagClass:l.Class.UNIVERSAL,type:l.Type.GENERALIZEDTIME,constructed:!1,optional:!0,capture:"certValidity4GeneralizedTime"}]},{name:"Certificate.TBSCertificate.subject",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"certSubject"},a,{name:"Certificate.TBSCertificate.issuerUniqueID",tagClass:l.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,
|
660
|
+
optional:!0,value:[{name:"Certificate.TBSCertificate.issuerUniqueID.id",tagClass:l.Class.UNIVERSAL,type:l.Type.BITSTRING,constructed:!1,captureBitStringValue:"certIssuerUniqueId"}]},{name:"Certificate.TBSCertificate.subjectUniqueID",tagClass:l.Class.CONTEXT_SPECIFIC,type:2,constructed:!0,optional:!0,value:[{name:"Certificate.TBSCertificate.subjectUniqueID.id",tagClass:l.Class.UNIVERSAL,type:l.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSubjectUniqueId"}]},{name:"Certificate.TBSCertificate.extensions",
|
661
|
+
tagClass:l.Class.CONTEXT_SPECIFIC,type:3,constructed:!0,captureAsn1:"certExtensions",optional:!0}]},{name:"Certificate.signatureAlgorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"Certificate.signatureAlgorithm.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"certSignatureOid"},{name:"Certificate.TBSCertificate.signature.parameters",tagClass:l.Class.UNIVERSAL,optional:!0,captureAsn1:"certSignatureParams"}]},{name:"Certificate.signatureValue",
|
662
|
+
tagClass:l.Class.UNIVERSAL,type:l.Type.BITSTRING,constructed:!1,captureBitStringValue:"certSignature"}]},u={name:"rsapss",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.hashAlgorithm",tagClass:l.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier",tagClass:l.Class.UNIVERSAL,type:l.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.hashAlgorithm.AlgorithmIdentifier.algorithm",tagClass:l.Class.UNIVERSAL,
|
663
|
+
type:l.Type.OID,constructed:!1,capture:"hashOid"}]}]},{name:"rsapss.maskGenAlgorithm",tagClass:l.Class.CONTEXT_SPECIFIC,type:1,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier",tagClass:l.Class.UNIVERSAL,type:l.Class.SEQUENCE,constructed:!0,optional:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"maskGenOid"},{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params",tagClass:l.Class.UNIVERSAL,
|
664
|
+
type:l.Type.SEQUENCE,constructed:!0,value:[{name:"rsapss.maskGenAlgorithm.AlgorithmIdentifier.params.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"maskGenHashOid"}]}]}]},{name:"rsapss.saltLength",tagClass:l.Class.CONTEXT_SPECIFIC,type:2,optional:!0,value:[{name:"rsapss.saltLength.saltLength",tagClass:l.Class.UNIVERSAL,type:l.Class.INTEGER,constructed:!1,capture:"saltLength"}]},{name:"rsapss.trailerField",tagClass:l.Class.CONTEXT_SPECIFIC,type:3,optional:!0,value:[{name:"rsapss.trailer.trailer",
|
665
|
+
tagClass:l.Class.UNIVERSAL,type:l.Class.INTEGER,constructed:!1,capture:"trailer"}]}]},v={name:"CertificationRequest",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"csr",value:[{name:"CertificationRequestInfo",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfo",value:[{name:"CertificationRequestInfo.integer",tagClass:l.Class.UNIVERSAL,type:l.Type.INTEGER,constructed:!1,capture:"certificationRequestInfoVersion"},{name:"CertificationRequestInfo.subject",
|
666
|
+
tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,captureAsn1:"certificationRequestInfoSubject"},a,{name:"CertificationRequestInfo.attributes",tagClass:l.Class.CONTEXT_SPECIFIC,type:0,constructed:!0,optional:!0,capture:"certificationRequestInfoAttributes",value:[{name:"CertificationRequestInfo.attributes",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequestInfo.attributes.type",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1},{name:"CertificationRequestInfo.attributes.value",
|
667
|
+
tagClass:l.Class.UNIVERSAL,type:l.Type.SET,constructed:!0}]}]}]},{name:"CertificationRequest.signatureAlgorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.SEQUENCE,constructed:!0,value:[{name:"CertificationRequest.signatureAlgorithm.algorithm",tagClass:l.Class.UNIVERSAL,type:l.Type.OID,constructed:!1,capture:"csrSignatureOid"},{name:"CertificationRequest.signatureAlgorithm.parameters",tagClass:l.Class.UNIVERSAL,optional:!0,captureAsn1:"csrSignatureParams"}]},{name:"CertificationRequest.signature",tagClass:l.Class.UNIVERSAL,
|
668
|
+
type:l.Type.BITSTRING,constructed:!1,captureBitStringValue:"csrSignature"}]};n.RDNAttributesAsArray=function(a,b){for(var c=[],d,e,f,h=0;h<a.value.length;++h){d=a.value[h];for(var k=0;k<d.value.length;++k)f={},e=d.value[k],f.type=l.derToOid(e.value[0].value),f.value=e.value[1].value,f.valueTagClass=e.value[1].type,f.type in p&&(f.name=p[f.type],f.name in r&&(f.shortName=r[f.name])),b&&(b.update(f.type),b.update(f.value)),c.push(f)}return c};n.CRIAttributesAsArray=function(a){for(var b=[],c=0;c<a.length;++c){var d=
|
669
|
+
a[c],e=l.derToOid(d.value[0].value);d=d.value[1].value;for(var f=0;f<d.length;++f){var h={};h.type=e;h.value=d[f].value;h.valueTagClass=d[f].type;h.type in p&&(h.name=p[h.type],h.name in r&&(h.shortName=r[h.name]));if(h.type===p.extensionRequest){h.extensions=[];for(var k=0;k<h.value.length;++k)h.extensions.push(n.certificateExtensionFromAsn1(h.value[k]))}b.push(h)}}return b};var t=function(a,b,c){var d={};if(a!==p["RSASSA-PSS"])return d;c&&(d={hash:{algorithmOid:p.sha1},mgf:{algorithmOid:p.mgf1,
|
670
|
+
hash:{algorithmOid:p.sha1}},saltLength:20});c={};a=[];if(!l.validate(b,u,c,a))throw b=Error("Cannot read RSASSA-PSS parameter block."),b.errors=a,b;void 0!==c.hashOid&&(d.hash=d.hash||{},d.hash.algorithmOid=l.derToOid(c.hashOid));void 0!==c.maskGenOid&&(d.mgf=d.mgf||{},d.mgf.algorithmOid=l.derToOid(c.maskGenOid),d.mgf.hash=d.mgf.hash||{},d.mgf.hash.algorithmOid=l.derToOid(c.maskGenHashOid));void 0!==c.saltLength&&(d.saltLength=c.saltLength.charCodeAt(0));return d};n.certificateFromPem=function(a,
|
671
|
+
b,c){a=k.pem.decode(a)[0];if("CERTIFICATE"!==a.type&&"X509 CERTIFICATE"!==a.type&&"TRUSTED CERTIFICATE"!==a.type)throw b=Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".'),b.headerType=a.type,b;if(a.procType&&"ENCRYPTED"===a.procType.type)throw Error("Could not convert certificate from PEM; PEM is encrypted.");c=l.fromDer(a.body,c);return n.certificateFromAsn1(c,b)};n.certificateToPem=function(a,b){a={type:"CERTIFICATE",
|
672
|
+
body:l.toDer(n.certificateToAsn1(a)).getBytes()};return k.pem.encode(a,{maxline:b})};n.publicKeyFromPem=function(a){a=k.pem.decode(a)[0];if("PUBLIC KEY"!==a.type&&"RSA PUBLIC KEY"!==a.type){var b=Error('Could not convert public key from PEM; PEM header type is not "PUBLIC KEY" or "RSA PUBLIC KEY".');b.headerType=a.type;throw b;}if(a.procType&&"ENCRYPTED"===a.procType.type)throw Error("Could not convert public key from PEM; PEM is encrypted.");a=l.fromDer(a.body);return n.publicKeyFromAsn1(a)};n.publicKeyToPem=
|
673
|
+
function(a,b){a={type:"PUBLIC KEY",body:l.toDer(n.publicKeyToAsn1(a)).getBytes()};return k.pem.encode(a,{maxline:b})};n.publicKeyToRSAPublicKeyPem=function(a,b){a={type:"RSA PUBLIC KEY",body:l.toDer(n.publicKeyToRSAPublicKey(a)).getBytes()};return k.pem.encode(a,{maxline:b})};n.getPublicKeyFingerprint=function(a,b){b=b||{};var c=b.md||k.md.sha1.create();switch(b.type||"RSAPublicKey"){case "RSAPublicKey":a=l.toDer(n.publicKeyToRSAPublicKey(a)).getBytes();break;case "SubjectPublicKeyInfo":a=l.toDer(n.publicKeyToAsn1(a)).getBytes();
|
674
|
+
break;default:throw Error('Unknown fingerprint type "'+b.type+'".');}c.start();c.update(a);c=c.digest();if("hex"===b.encoding)return c=c.toHex(),b.delimiter?c.match(/.{2}/g).join(b.delimiter):c;if("binary"===b.encoding)return c.getBytes();if(b.encoding)throw Error('Unknown encoding "'+b.encoding+'".');return c};n.certificationRequestFromPem=function(a,b,c){a=k.pem.decode(a)[0];if("CERTIFICATE REQUEST"!==a.type)throw b=Error('Could not convert certification request from PEM; PEM header type is not "CERTIFICATE REQUEST".'),
|
675
|
+
b.headerType=a.type,b;if(a.procType&&"ENCRYPTED"===a.procType.type)throw Error("Could not convert certification request from PEM; PEM is encrypted.");c=l.fromDer(a.body,c);return n.certificationRequestFromAsn1(c,b)};n.certificationRequestToPem=function(a,b){a={type:"CERTIFICATE REQUEST",body:l.toDer(n.certificationRequestToAsn1(a)).getBytes()};return k.pem.encode(a,{maxline:b})};n.createCertificate=function(){var a={version:2,serialNumber:"00",signatureOid:null,signature:null,siginfo:{}};a.siginfo.algorithmOid=
|
676
|
+
null;a.validity={};a.validity.notBefore=new Date;a.validity.notAfter=new Date;a.issuer={};a.issuer.getField=function(c){return b(a.issuer,c)};a.issuer.addField=function(b){d([b]);a.issuer.attributes.push(b)};a.issuer.attributes=[];a.issuer.hash=null;a.subject={};a.subject.getField=function(c){return b(a.subject,c)};a.subject.addField=function(b){d([b]);a.subject.attributes.push(b)};a.subject.attributes=[];a.subject.hash=null;a.extensions=[];a.publicKey=null;a.md=null;a.setSubject=function(b,c){d(b);
|
677
|
+
a.subject.attributes=b;delete a.subject.uniqueId;c&&(a.subject.uniqueId=c);a.subject.hash=null};a.setIssuer=function(b,c){d(b);a.issuer.attributes=b;delete a.issuer.uniqueId;c&&(a.issuer.uniqueId=c);a.issuer.hash=null};a.setExtensions=function(b){for(var c=0;c<b.length;++c)e(b[c],{cert:a});a.extensions=b};a.getExtension=function(b){"string"===typeof b&&(b={name:b});for(var c=null,d,e=0;null===c&&e<a.extensions.length;++e)d=a.extensions[e],b.id&&d.id===b.id?c=d:b.name&&d.name===b.name&&(c=d);return c};
|
678
|
+
a.sign=function(b,c){a.md=c||k.md.sha1.create();c=p[a.md.algorithm+"WithRSAEncryption"];if(!c)throw b=Error("Could not compute certificate digest. Unknown message digest algorithm OID."),b.algorithm=a.md.algorithm,b;a.signatureOid=a.siginfo.algorithmOid=c;a.tbsCertificate=n.getTBSCertificate(a);c=l.toDer(a.tbsCertificate);a.md.update(c.getBytes());a.signature=b.sign(a.md)};a.verify=function(b){var c=!1;if(!a.issued(b)){c=a.subject;var d=Error("The parent certificate did not issue the given child certificate; the child certificate's issuer does not match the parent's subject.");
|
679
|
+
d.expectedIssuer=b.issuer.attributes;d.actualIssuer=c.attributes;throw d;}d=b.md;if(null===d){if(b.signatureOid in p)switch(p[b.signatureOid]){case "sha1WithRSAEncryption":d=k.md.sha1.create();break;case "md5WithRSAEncryption":d=k.md.md5.create();break;case "sha256WithRSAEncryption":d=k.md.sha256.create();break;case "sha384WithRSAEncryption":d=k.md.sha384.create();break;case "sha512WithRSAEncryption":d=k.md.sha512.create();break;case "RSASSA-PSS":d=k.md.sha256.create()}if(null===d)throw d=Error("Could not compute certificate digest. Unknown signature OID."),
|
680
|
+
d.signatureOid=b.signatureOid,d;var e=b.tbsCertificate||n.getTBSCertificate(b);e=l.toDer(e);d.update(e.getBytes())}if(null!==d){switch(b.signatureOid){case p.sha1WithRSAEncryption:var f=void 0;break;case p["RSASSA-PSS"]:c=p[b.signatureParameters.mgf.hash.algorithmOid];if(void 0===c||void 0===k.md[c])throw d=Error("Unsupported MGF hash function."),d.oid=b.signatureParameters.mgf.hash.algorithmOid,d.name=c,d;f=p[b.signatureParameters.mgf.algorithmOid];if(void 0===f||void 0===k.mgf[f])throw d=Error("Unsupported MGF function."),
|
681
|
+
d.oid=b.signatureParameters.mgf.algorithmOid,d.name=f,d;f=k.mgf[f].create(k.md[c].create());c=p[b.signatureParameters.hash.algorithmOid];if(void 0===c||void 0===k.md[c])throw{message:"Unsupported RSASSA-PSS hash function.",oid:b.signatureParameters.hash.algorithmOid,name:c};f=k.pss.create(k.md[c].create(),f,b.signatureParameters.saltLength)}c=a.publicKey.verify(d.digest().getBytes(),b.signature,f)}return c};a.isIssuer=function(b){var c=!1,d=a.issuer;b=b.subject;if(d.hash&&b.hash)c=d.hash===b.hash;
|
682
|
+
else if(d.attributes.length===b.attributes.length){c=!0;for(var e,f,h=0;c&&h<d.attributes.length;++h)if(e=d.attributes[h],f=b.attributes[h],e.type!==f.type||e.value!==f.value)c=!1}return c};a.issued=function(b){return b.isIssuer(a)};a.generateSubjectKeyIdentifier=function(){return n.getPublicKeyFingerprint(a.publicKey,{type:"RSAPublicKey"})};a.verifySubjectKeyIdentifier=function(){for(var b=p.subjectKeyIdentifier,c=0;c<a.extensions.length;++c){var d=a.extensions[c];if(d.id===b)return b=a.generateSubjectKeyIdentifier().getBytes(),
|
683
|
+
k.util.hexToBytes(d.subjectKeyIdentifier)===b}return!1};return a};n.certificateFromAsn1=function(a,c){var e={},f=[];if(!l.validate(a,q,e,f))throw e=Error("Cannot read X.509 certificate. ASN.1 object is not an X509v3 Certificate."),e.errors=f,e;f=l.derToOid(e.publicKeyOid);if(f!==n.oids.rsaEncryption)throw Error("Cannot read public key. OID is not RSA.");var h=n.createCertificate();h.version=e.certVersion?e.certVersion.charCodeAt(0):0;f=k.util.createBuffer(e.certSerialNumber);h.serialNumber=f.toHex();
|
684
|
+
h.signatureOid=k.asn1.derToOid(e.certSignatureOid);h.signatureParameters=t(h.signatureOid,e.certSignatureParams,!0);h.siginfo.algorithmOid=k.asn1.derToOid(e.certinfoSignatureOid);h.siginfo.parameters=t(h.siginfo.algorithmOid,e.certinfoSignatureParams,!1);h.signature=e.certSignature;f=[];void 0!==e.certValidity1UTCTime&&f.push(l.utcTimeToDate(e.certValidity1UTCTime));void 0!==e.certValidity2GeneralizedTime&&f.push(l.generalizedTimeToDate(e.certValidity2GeneralizedTime));void 0!==e.certValidity3UTCTime&&
|
685
|
+
f.push(l.utcTimeToDate(e.certValidity3UTCTime));void 0!==e.certValidity4GeneralizedTime&&f.push(l.generalizedTimeToDate(e.certValidity4GeneralizedTime));if(2<f.length)throw Error("Cannot read notBefore/notAfter validity times; more than two times were provided in the certificate.");if(2>f.length)throw Error("Cannot read notBefore/notAfter validity times; they were not provided as either UTCTime or GeneralizedTime.");h.validity.notBefore=f[0];h.validity.notAfter=f[1];h.tbsCertificate=e.tbsCertificate;
|
686
|
+
if(c){h.md=null;if(h.signatureOid in p)switch(f=p[h.signatureOid],f){case "sha1WithRSAEncryption":h.md=k.md.sha1.create();break;case "md5WithRSAEncryption":h.md=k.md.md5.create();break;case "sha256WithRSAEncryption":h.md=k.md.sha256.create();break;case "sha384WithRSAEncryption":h.md=k.md.sha384.create();break;case "sha512WithRSAEncryption":h.md=k.md.sha512.create();break;case "RSASSA-PSS":h.md=k.md.sha256.create()}if(null===h.md)throw e=Error("Could not compute certificate digest. Unknown signature OID."),
|
687
|
+
e.signatureOid=h.signatureOid,e;c=l.toDer(h.tbsCertificate);h.md.update(c.getBytes())}c=k.md.sha1.create();h.issuer.getField=function(a){return b(h.issuer,a)};h.issuer.addField=function(a){d([a]);h.issuer.attributes.push(a)};h.issuer.attributes=n.RDNAttributesAsArray(e.certIssuer,c);e.certIssuerUniqueId&&(h.issuer.uniqueId=e.certIssuerUniqueId);h.issuer.hash=c.digest().toHex();c=k.md.sha1.create();h.subject.getField=function(a){return b(h.subject,a)};h.subject.addField=function(a){d([a]);h.subject.attributes.push(a)};
|
688
|
+
h.subject.attributes=n.RDNAttributesAsArray(e.certSubject,c);e.certSubjectUniqueId&&(h.subject.uniqueId=e.certSubjectUniqueId);h.subject.hash=c.digest().toHex();h.extensions=e.certExtensions?n.certificateExtensionsFromAsn1(e.certExtensions):[];h.publicKey=n.publicKeyFromAsn1(e.subjectPublicKeyInfo);return h};n.certificateExtensionsFromAsn1=function(a){for(var b=[],c=0;c<a.value.length;++c)for(var d=a.value[c],e=0;e<d.value.length;++e)b.push(n.certificateExtensionFromAsn1(d.value[e]));return b};n.certificateExtensionFromAsn1=
|
689
|
+
function(a){var b={};b.id=l.derToOid(a.value[0].value);b.critical=!1;a.value[1].type===l.Type.BOOLEAN?(b.critical=0!==a.value[1].value.charCodeAt(0),b.value=a.value[2].value):b.value=a.value[1].value;if(b.id in p)if(b.name=p[b.id],"keyUsage"===b.name){a=l.fromDer(b.value);var c=0,d=0;1<a.value.length&&(c=a.value.charCodeAt(1),d=2<a.value.length?a.value.charCodeAt(2):0);b.digitalSignature=128===(c&128);b.nonRepudiation=64===(c&64);b.keyEncipherment=32===(c&32);b.dataEncipherment=16===(c&16);b.keyAgreement=
|
690
|
+
8===(c&8);b.keyCertSign=4===(c&4);b.cRLSign=2===(c&2);b.encipherOnly=1===(c&1);b.decipherOnly=128===(d&128)}else if("basicConstraints"===b.name)a=l.fromDer(b.value),b.cA=0<a.value.length&&a.value[0].type===l.Type.BOOLEAN?0!==a.value[0].value.charCodeAt(0):!1,c=null,0<a.value.length&&a.value[0].type===l.Type.INTEGER?c=a.value[0].value:1<a.value.length&&(c=a.value[1].value),null!==c&&(b.pathLenConstraint=l.derToInteger(c));else if("extKeyUsage"===b.name)for(a=l.fromDer(b.value),c=0;c<a.value.length;++c)d=
|
691
|
+
l.derToOid(a.value[c].value),d in p?b[p[d]]=!0:b[d]=!0;else if("nsCertType"===b.name)a=l.fromDer(b.value),c=0,1<a.value.length&&(c=a.value.charCodeAt(1)),b.client=128===(c&128),b.server=64===(c&64),b.email=32===(c&32),b.objsign=16===(c&16),b.reserved=8===(c&8),b.sslCA=4===(c&4),b.emailCA=2===(c&2),b.objCA=1===(c&1);else if("subjectAltName"===b.name||"issuerAltName"===b.name)for(b.altNames=[],a=l.fromDer(b.value),d=0;d<a.value.length;++d){c=a.value[d];var e={type:c.type,value:c.value};b.altNames.push(e);
|
692
|
+
switch(c.type){case 7:e.ip=k.util.bytesToIP(c.value);break;case 8:e.oid=l.derToOid(c.value)}}else"subjectKeyIdentifier"===b.name&&(a=l.fromDer(b.value),b.subjectKeyIdentifier=k.util.bytesToHex(a.value));return b};n.certificationRequestFromAsn1=function(a,c){var e={},f=[];if(!l.validate(a,v,e,f))throw e=Error("Cannot read PKCS#10 certificate request. ASN.1 object is not a PKCS#10 CertificationRequest."),e.errors=f,e;f=l.derToOid(e.publicKeyOid);if(f!==n.oids.rsaEncryption)throw Error("Cannot read public key. OID is not RSA.");
|
693
|
+
var h=n.createCertificationRequest();h.version=e.csrVersion?e.csrVersion.charCodeAt(0):0;h.signatureOid=k.asn1.derToOid(e.csrSignatureOid);h.signatureParameters=t(h.signatureOid,e.csrSignatureParams,!0);h.siginfo.algorithmOid=k.asn1.derToOid(e.csrSignatureOid);h.siginfo.parameters=t(h.siginfo.algorithmOid,e.csrSignatureParams,!1);h.signature=e.csrSignature;h.certificationRequestInfo=e.certificationRequestInfo;if(c){h.md=null;if(h.signatureOid in p)switch(f=p[h.signatureOid],f){case "sha1WithRSAEncryption":h.md=
|
694
|
+
k.md.sha1.create();break;case "md5WithRSAEncryption":h.md=k.md.md5.create();break;case "sha256WithRSAEncryption":h.md=k.md.sha256.create();break;case "sha384WithRSAEncryption":h.md=k.md.sha384.create();break;case "sha512WithRSAEncryption":h.md=k.md.sha512.create();break;case "RSASSA-PSS":h.md=k.md.sha256.create()}if(null===h.md)throw e=Error("Could not compute certification request digest. Unknown signature OID."),e.signatureOid=h.signatureOid,e;c=l.toDer(h.certificationRequestInfo);h.md.update(c.getBytes())}c=
|
695
|
+
k.md.sha1.create();h.subject.getField=function(a){return b(h.subject,a)};h.subject.addField=function(a){d([a]);h.subject.attributes.push(a)};h.subject.attributes=n.RDNAttributesAsArray(e.certificationRequestInfoSubject,c);h.subject.hash=c.digest().toHex();h.publicKey=n.publicKeyFromAsn1(e.subjectPublicKeyInfo);h.getAttribute=function(a){return b(h,a)};h.addAttribute=function(a){d([a]);h.attributes.push(a)};h.attributes=n.CRIAttributesAsArray(e.certificationRequestInfoAttributes||[]);return h};n.createCertificationRequest=
|
696
|
+
function(){var a={version:0,signatureOid:null,signature:null,siginfo:{}};a.siginfo.algorithmOid=null;a.subject={};a.subject.getField=function(c){return b(a.subject,c)};a.subject.addField=function(b){d([b]);a.subject.attributes.push(b)};a.subject.attributes=[];a.subject.hash=null;a.publicKey=null;a.attributes=[];a.getAttribute=function(c){return b(a,c)};a.addAttribute=function(b){d([b]);a.attributes.push(b)};a.md=null;a.setSubject=function(b){d(b);a.subject.attributes=b;a.subject.hash=null};a.setAttributes=
|
697
|
+
function(b){d(b);a.attributes=b};a.sign=function(b,c){a.md=c||k.md.sha1.create();c=p[a.md.algorithm+"WithRSAEncryption"];if(!c)throw b=Error("Could not compute certification request digest. Unknown message digest algorithm OID."),b.algorithm=a.md.algorithm,b;a.signatureOid=a.siginfo.algorithmOid=c;a.certificationRequestInfo=n.getCertificationRequestInfo(a);c=l.toDer(a.certificationRequestInfo);a.md.update(c.getBytes());a.signature=b.sign(a.md)};a.verify=function(){var b=!1,c=a.md;if(null===c){if(a.signatureOid in
|
698
|
+
p)switch(p[a.signatureOid]){case "sha1WithRSAEncryption":c=k.md.sha1.create();break;case "md5WithRSAEncryption":c=k.md.md5.create();break;case "sha256WithRSAEncryption":c=k.md.sha256.create();break;case "sha384WithRSAEncryption":c=k.md.sha384.create();break;case "sha512WithRSAEncryption":c=k.md.sha512.create();break;case "RSASSA-PSS":c=k.md.sha256.create()}if(null===c)throw c=Error("Could not compute certification request digest. Unknown signature OID."),c.signatureOid=a.signatureOid,c;var d=a.certificationRequestInfo||
|
699
|
+
n.getCertificationRequestInfo(a);d=l.toDer(d);c.update(d.getBytes())}if(null!==c){switch(a.signatureOid){case p["RSASSA-PSS"]:b=p[a.signatureParameters.mgf.hash.algorithmOid];if(void 0===b||void 0===k.md[b])throw c=Error("Unsupported MGF hash function."),c.oid=a.signatureParameters.mgf.hash.algorithmOid,c.name=b,c;var e=p[a.signatureParameters.mgf.algorithmOid];if(void 0===e||void 0===k.mgf[e])throw c=Error("Unsupported MGF function."),c.oid=a.signatureParameters.mgf.algorithmOid,c.name=e,c;e=k.mgf[e].create(k.md[b].create());
|
700
|
+
b=p[a.signatureParameters.hash.algorithmOid];if(void 0===b||void 0===k.md[b])throw c=Error("Unsupported RSASSA-PSS hash function."),c.oid=a.signatureParameters.hash.algorithmOid,c.name=b,c;e=k.pss.create(k.md[b].create(),e,a.signatureParameters.saltLength)}b=a.publicKey.verify(c.digest().getBytes(),a.signature,e)}return b};return a};var w=new Date("1950-01-01T00:00:00Z"),y=new Date("2050-01-01T00:00:00Z");n.getTBSCertificate=function(a){var b=m(a.validity.notBefore),d=m(a.validity.notAfter);b=l.create(l.Class.UNIVERSAL,
|
701
|
+
l.Type.SEQUENCE,!0,[l.create(l.Class.CONTEXT_SPECIFIC,0,!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(a.version).getBytes())]),l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,k.util.hexToBytes(a.serialNumber)),l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(a.siginfo.algorithmOid).getBytes()),f(a.siginfo.algorithmOid,a.siginfo.parameters)]),c(a.issuer),l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[b,d]),c(a.subject),n.publicKeyToAsn1(a.publicKey)]);
|
702
|
+
a.issuer.uniqueId&&b.value.push(l.create(l.Class.CONTEXT_SPECIFIC,1,!0,[l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+a.issuer.uniqueId)]));a.subject.uniqueId&&b.value.push(l.create(l.Class.CONTEXT_SPECIFIC,2,!0,[l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+a.subject.uniqueId)]));0<a.extensions.length&&b.value.push(n.certificateExtensionsToAsn1(a.extensions));return b};n.getCertificationRequestInfo=function(a){return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,
|
703
|
+
!0,[l.create(l.Class.UNIVERSAL,l.Type.INTEGER,!1,l.integerToDer(a.version).getBytes()),c(a.subject),n.publicKeyToAsn1(a.publicKey),h(a)])};n.distinguishedNameToAsn1=function(a){return c(a)};n.certificateToAsn1=function(a){var b=a.tbsCertificate||n.getTBSCertificate(a);return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[b,l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(a.signatureOid).getBytes()),f(a.signatureOid,a.signatureParameters)]),l.create(l.Class.UNIVERSAL,
|
704
|
+
l.Type.BITSTRING,!1,String.fromCharCode(0)+a.signature)])};n.certificateExtensionsToAsn1=function(a){var b=l.create(l.Class.CONTEXT_SPECIFIC,3,!0,[]),c=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);b.value.push(c);for(var d=0;d<a.length;++d)c.value.push(n.certificateExtensionToAsn1(a[d]));return b};n.certificateExtensionToAsn1=function(a){var b=l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[]);b.value.push(l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(a.id).getBytes()));a.critical&&b.value.push(l.create(l.Class.UNIVERSAL,
|
705
|
+
l.Type.BOOLEAN,!1,String.fromCharCode(255)));var c=a.value;"string"!==typeof a.value&&(c=l.toDer(c).getBytes());b.value.push(l.create(l.Class.UNIVERSAL,l.Type.OCTETSTRING,!1,c));return b};n.certificationRequestToAsn1=function(a){var b=a.certificationRequestInfo||n.getCertificationRequestInfo(a);return l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[b,l.create(l.Class.UNIVERSAL,l.Type.SEQUENCE,!0,[l.create(l.Class.UNIVERSAL,l.Type.OID,!1,l.oidToDer(a.signatureOid).getBytes()),f(a.signatureOid,a.signatureParameters)]),
|
706
|
+
l.create(l.Class.UNIVERSAL,l.Type.BITSTRING,!1,String.fromCharCode(0)+a.signature)])};n.createCaStore=function(a){function b(a){d(a);return e.certs[a.hash]||null}function d(a){if(!a.hash){var b=k.md.sha1.create();a.attributes=n.RDNAttributesAsArray(c(a),b);a.hash=b.digest().toHex()}}var e={certs:{},getIssuer:function(a){return b(a.issuer)},addCertificate:function(a){"string"===typeof a&&(a=k.pki.certificateFromPem(a));d(a.subject);if(!e.hasCertificate(a))if(a.subject.hash in e.certs){var b=e.certs[a.subject.hash];
|
707
|
+
k.util.isArray(b)||(b=[b]);b.push(a);e.certs[a.subject.hash]=b}else e.certs[a.subject.hash]=a},hasCertificate:function(a){"string"===typeof a&&(a=k.pki.certificateFromPem(a));var c=b(a.subject);if(!c)return!1;k.util.isArray(c)||(c=[c]);a=l.toDer(n.certificateToAsn1(a)).getBytes();for(var d=0;d<c.length;++d){var e=l.toDer(n.certificateToAsn1(c[d])).getBytes();if(a===e)return!0}return!1},listAllCertificates:function(){var a=[],b;for(b in e.certs)if(e.certs.hasOwnProperty(b)){var c=e.certs[b];if(k.util.isArray(c))for(var d=
|
708
|
+
0;d<c.length;++d)a.push(c[d]);else a.push(c)}return a},removeCertificate:function(a){"string"===typeof a&&(a=k.pki.certificateFromPem(a));d(a.subject);if(!e.hasCertificate(a))return null;var c=b(a.subject);if(!k.util.isArray(c)){var f=e.certs[a.subject.hash];delete e.certs[a.subject.hash];return f}for(var h=l.toDer(n.certificateToAsn1(a)).getBytes(),m=0;m<c.length;++m){var p=l.toDer(n.certificateToAsn1(c[m])).getBytes();h===p&&(f=c[m],c.splice(m,1))}0===c.length&&delete e.certs[a.subject.hash];return f}};
|
709
|
+
if(a)for(var f=0;f<a.length;++f)e.addCertificate(a[f]);return e};n.certificateError={bad_certificate:"forge.pki.BadCertificate",unsupported_certificate:"forge.pki.UnsupportedCertificate",certificate_revoked:"forge.pki.CertificateRevoked",certificate_expired:"forge.pki.CertificateExpired",certificate_unknown:"forge.pki.CertificateUnknown",unknown_ca:"forge.pki.UnknownCertificateAuthority"};n.verifyCertificateChain=function(a,b,c){"function"===typeof c&&(c={verify:c});c=c||{};b=b.slice(0);var d=b.slice(0),
|
710
|
+
e=c.validityCheckDate;"undefined"===typeof e&&(e=new Date);var f=!0,h=null,l=0;do{var m=b.shift(),p=null,r=!1;e&&(e<m.validity.notBefore||e>m.validity.notAfter)&&(h={message:"Certificate is not valid yet or has expired.",error:n.certificateError.certificate_expired,notBefore:m.validity.notBefore,notAfter:m.validity.notAfter,now:e});if(null===h){p=b[0]||a.getIssuer(m);null===p&&m.isIssuer(m)&&(r=!0,p=m);if(p){var q=p;k.util.isArray(q)||(q=[q]);for(var v=!1;!v&&0<q.length;){p=q.shift();try{v=p.verify(m)}catch(W){}}v||
|
711
|
+
(h={message:"Certificate signature is invalid.",error:n.certificateError.bad_certificate})}null!==h||p&&!r||a.hasCertificate(m)||(h={message:"Certificate is not trusted.",error:n.certificateError.unknown_ca})}null===h&&p&&!m.isIssuer(p)&&(h={message:"Certificate issuer is invalid.",error:n.certificateError.bad_certificate});if(null===h)for(q={keyUsage:!0,basicConstraints:!0},v=0;null===h&&v<m.extensions.length;++v){var x=m.extensions[v];!x.critical||x.name in q||(h={message:"Certificate has an unsupported critical extension.",
|
712
|
+
error:n.certificateError.unsupported_certificate})}null!==h||f&&(0!==b.length||p&&!r)||(f=m.getExtension("basicConstraints"),m=m.getExtension("keyUsage"),null!==m&&(m.keyCertSign&&null!==f||(h={message:"Certificate keyUsage or basicConstraints conflict or indicate that the certificate is not a CA. If the certificate is the only one in the chain or isn't the first then the certificate must be a valid CA.",error:n.certificateError.bad_certificate})),null!==h||null===f||f.cA||(h={message:"Certificate basicConstraints indicates the certificate is not a CA.",
|
713
|
+
error:n.certificateError.bad_certificate}),null===h&&null!==m&&"pathLenConstraint"in f&&l-1>f.pathLenConstraint&&(h={message:"Certificate basicConstraints pathLenConstraint violated.",error:n.certificateError.bad_certificate}));m=null===h?!0:h.error;f=c.verify?c.verify(m,l,d):m;if(!0===f)h=null;else{!0===m&&(h={message:"The application rejected the certificate.",error:n.certificateError.bad_certificate});if(f||0===f)"object"!==typeof f||k.util.isArray(f)?"string"===typeof f&&(h.error=f):(f.message&&
|
714
|
+
(h.message=f.message),f.error&&(h.error=f.error));throw h;}f=!1;++l}while(0<b.length);return!0}});C(function(a){function b(a,b,c,d){for(var e=[],f=0;f<a.length;f++)for(var h=0;h<a[f].safeBags.length;h++){var k=a[f].safeBags[h];if(void 0===d||k.type===d)null===b?e.push(k):void 0!==k.attributes[b]&&0<=k.attributes[b].indexOf(c)&&e.push(k)}return e}function c(a){if(a.composed||a.constructed){for(var b=k.util.createBuffer(),c=0;c<a.value.length;++c)b.putBytes(a.value[c].value);a.composed=a.constructed=
|
715
|
+
!1;a.value=b.getBytes()}return a}function d(a,b,d,f){b=h.fromDer(b,d);if(b.tagClass!==h.Class.UNIVERSAL||b.type!==h.Type.SEQUENCE||!0!==b.constructed)throw Error("PKCS#12 AuthenticatedSafe expected to be a SEQUENCE OF ContentInfo");for(var l=0;l<b.value.length;l++){var p={},r=[];if(!h.validate(b.value[l],n,p,r))throw a=Error("Cannot read ContentInfo."),a.errors=r,a;r={encrypted:!1};var q=p.content.value[0];switch(h.derToOid(p.contentType)){case m.oids.data:if(q.tagClass!==h.Class.UNIVERSAL||q.type!==
|
716
|
+
h.Type.OCTETSTRING)throw Error("PKCS#12 SafeContents Data is not an OCTET STRING.");p=c(q).value;break;case m.oids.encryptedData:var v=f;p={};var x=[];if(!h.validate(q,k.pkcs7.asn1.encryptedDataValidator,p,x))throw a=Error("Cannot read EncryptedContentInfo."),a.errors=x,a;q=h.derToOid(p.contentType);if(q!==m.oids.data)throw a=Error("PKCS#12 EncryptedContentInfo ContentType is not Data."),a.oid=q,a;q=h.derToOid(p.encAlgorithm);q=m.pbe.getCipher(q,p.encParameter,v);p=c(p.encryptedContentAsn1);p=k.util.createBuffer(p.value);
|
717
|
+
q.update(p);if(!q.finish())throw Error("Failed to decrypt PKCS#12 SafeContents.");p=q.output.getBytes();r.encrypted=!0;break;default:throw a=Error("Unsupported PKCS#12 contentType."),a.contentType=h.derToOid(p.contentType),a;}r.safeBags=e(p,d,f);a.safeContents.push(r)}}function e(a,b,c){if(!b&&0===a.length)return[];a=h.fromDer(a,b);if(a.tagClass!==h.Class.UNIVERSAL||a.type!==h.Type.SEQUENCE||!0!==a.constructed)throw Error("PKCS#12 SafeContents expected to be a SEQUENCE OF SafeBag.");for(var d=[],
|
718
|
+
e=0;e<a.value.length;e++){var k={},l=[];if(!h.validate(a.value[e],r,k,l))throw a=Error("Cannot read SafeBag."),a.errors=l,a;var n={type:h.derToOid(k.bagId),attributes:f(k.bagAttributes)};d.push(n);var p=k.bagValue.value[0];switch(n.type){case m.oids.pkcs8ShroudedKeyBag:if(p=m.decryptPrivateKeyInfo(p,c),null===p)throw Error("Unable to decrypt PKCS#8 ShroudedKeyBag, wrong password?");case m.oids.keyBag:try{n.key=m.privateKeyFromAsn1(p)}catch(uq){n.key=null,n.asn1=p}continue;case m.oids.certBag:var q=
|
719
|
+
u;var v=function(){if(h.derToOid(k.certId)!==m.oids.x509Certificate){var a=Error("Unsupported certificate type, only X.509 supported.");a.oid=h.derToOid(k.certId);throw a;}a=h.fromDer(k.cert,b);try{n.cert=m.certificateFromAsn1(a,!0)}catch(vq){n.cert=null,n.asn1=a}};break;default:throw a=Error("Unsupported PKCS#12 SafeBag type."),a.oid=n.type,a;}if(void 0!==q&&!h.validate(p,q,k,l))throw a=Error("Cannot read PKCS#12 "+q.name),a.errors=l,a;v()}return d}function f(a){var b={};if(void 0!==a)for(var c=
|
720
|
+
0;c<a.length;++c){var d={},e=[];if(!h.validate(a[c],q,d,e))throw a=Error("Cannot read PKCS#12 BagAttribute."),a.errors=e,a;e=h.derToOid(d.oid);if(void 0!==m.oids[e]){b[m.oids[e]]=[];for(var f=0;f<d.values.length;++f)b[m.oids[e]].push(d.values[f].value)}}return b}var h=k.asn1,m=k.pki,l=a.exports=k.pkcs12=k.pkcs12||{},n={name:"ContentInfo",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"ContentInfo.contentType",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1,capture:"contentType"},
|
721
|
+
{name:"ContentInfo.content",tagClass:h.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"content"}]},p={name:"PFX",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.version",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,capture:"version"},n,{name:"PFX.macData",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,optional:!0,captureAsn1:"mac",value:[{name:"PFX.macData.mac",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm",
|
722
|
+
tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"PFX.macData.mac.digestAlgorithm.algorithm",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1,capture:"macAlgorithm"},{name:"PFX.macData.mac.digestAlgorithm.parameters",tagClass:h.Class.UNIVERSAL,captureAsn1:"macAlgorithmParameters"}]},{name:"PFX.macData.mac.digest",tagClass:h.Class.UNIVERSAL,type:h.Type.OCTETSTRING,constructed:!1,capture:"macDigest"}]},{name:"PFX.macData.macSalt",tagClass:h.Class.UNIVERSAL,type:h.Type.OCTETSTRING,
|
723
|
+
constructed:!1,capture:"macSalt"},{name:"PFX.macData.iterations",tagClass:h.Class.UNIVERSAL,type:h.Type.INTEGER,constructed:!1,optional:!0,capture:"macIterations"}]}]},r={name:"SafeBag",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"SafeBag.bagId",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1,capture:"bagId"},{name:"SafeBag.bagValue",tagClass:h.Class.CONTEXT_SPECIFIC,constructed:!0,captureAsn1:"bagValue"},{name:"SafeBag.bagAttributes",tagClass:h.Class.UNIVERSAL,
|
724
|
+
type:h.Type.SET,constructed:!0,optional:!0,capture:"bagAttributes"}]},q={name:"Attribute",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"Attribute.attrId",tagClass:h.Class.UNIVERSAL,type:h.Type.OID,constructed:!1,capture:"oid"},{name:"Attribute.attrValues",tagClass:h.Class.UNIVERSAL,type:h.Type.SET,constructed:!0,capture:"values"}]},u={name:"CertBag",tagClass:h.Class.UNIVERSAL,type:h.Type.SEQUENCE,constructed:!0,value:[{name:"CertBag.certId",tagClass:h.Class.UNIVERSAL,
|
725
|
+
type:h.Type.OID,constructed:!1,capture:"certId"},{name:"CertBag.certValue",tagClass:h.Class.CONTEXT_SPECIFIC,constructed:!0,value:[{name:"CertBag.certValue[0]",tagClass:h.Class.UNIVERSAL,type:h.Class.OCTETSTRING,constructed:!1,capture:"cert"}]}]};l.pkcs12FromAsn1=function(a,e,f){"string"===typeof e?(f=e,e=!0):void 0===e&&(e=!0);var n={};if(!h.validate(a,p,n,[]))throw e=Error("Cannot read PKCS#12 PFX. ASN.1 object is not an PKCS#12 PFX."),e.errors=e,e;var r={version:n.version.charCodeAt(0),safeContents:[],
|
726
|
+
getBags:function(a){var c={},d;"localKeyId"in a?d=a.localKeyId:"localKeyIdHex"in a&&(d=k.util.hexToBytes(a.localKeyIdHex));void 0===d&&!("friendlyName"in a)&&"bagType"in a&&(c[a.bagType]=b(r.safeContents,null,null,a.bagType));void 0!==d&&(c.localKeyId=b(r.safeContents,"localKeyId",d,a.bagType));"friendlyName"in a&&(c.friendlyName=b(r.safeContents,"friendlyName",a.friendlyName,a.bagType));return c},getBagsByFriendlyName:function(a,c){return b(r.safeContents,"friendlyName",a,c)},getBagsByLocalKeyId:function(a,
|
727
|
+
c){return b(r.safeContents,"localKeyId",a,c)}};if(3!==n.version.charCodeAt(0))throw e=Error("PKCS#12 PFX of version other than 3 not supported."),e.version=n.version.charCodeAt(0),e;if(h.derToOid(n.contentType)!==m.oids.data)throw e=Error("Only PKCS#12 PFX in password integrity mode supported."),e.oid=h.derToOid(n.contentType),e;a=n.content.value[0];if(a.tagClass!==h.Class.UNIVERSAL||a.type!==h.Type.OCTETSTRING)throw Error("PKCS#12 authSafe content data is not an OCTET STRING.");a=c(a);if(n.mac){var q=
|
728
|
+
null,v=0,x=h.derToOid(n.macAlgorithm);switch(x){case m.oids.sha1:q=k.md.sha1.create();v=20;break;case m.oids.sha256:q=k.md.sha256.create();v=32;break;case m.oids.sha384:q=k.md.sha384.create();v=48;break;case m.oids.sha512:q=k.md.sha512.create();v=64;break;case m.oids.md5:q=k.md.md5.create(),v=16}if(null===q)throw Error("PKCS#12 uses unsupported MAC algorithm: "+x);x=new k.util.ByteBuffer(n.macSalt);var u="macIterations"in n?parseInt(k.util.bytesToHex(n.macIterations),16):1;v=l.generateKey(f,x,3,u,
|
729
|
+
v,q);x=k.hmac.create();x.start(q,v);x.update(a.value);if(x.getMac().getBytes()!==n.macDigest)throw Error("PKCS#12 MAC could not be verified. Invalid password?");}d(r,a.value,e,f);return r};l.toPkcs12Asn1=function(a,b,c,d){d=d||{};d.saltSize=d.saltSize||8;d.count=d.count||2048;d.algorithm=d.algorithm||d.encAlgorithm||"aes128";"useMac"in d||(d.useMac=!0);"localKeyId"in d||(d.localKeyId=null);"generateLocalKeyId"in d||(d.generateLocalKeyId=!0);var e=d.localKeyId,f;if(null!==e)e=k.util.hexToBytes(e);
|
730
|
+
else if(d.generateLocalKeyId)if(b){var n=k.util.isArray(b)?b[0]:b;"string"===typeof n&&(n=m.certificateFromPem(n));e=k.md.sha1.create();e.update(h.toDer(m.certificateToAsn1(n)).getBytes());e=e.digest().getBytes()}else e=k.random.getBytes(20);n=[];null!==e&&n.push(h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(m.oids.localKeyId).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.SET,!0,[h.create(h.Class.UNIVERSAL,h.Type.OCTETSTRING,!1,e)])]));"friendlyName"in
|
731
|
+
d&&n.push(h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(m.oids.friendlyName).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.SET,!0,[h.create(h.Class.UNIVERSAL,h.Type.BMPSTRING,!1,d.friendlyName)])]));0<n.length&&(f=h.create(h.Class.UNIVERSAL,h.Type.SET,!0,n));e=[];n=[];null!==b&&(n=k.util.isArray(b)?b:[b]);for(var p=[],r=0;r<n.length;++r){b=n[r];"string"===typeof b&&(b=m.certificateFromPem(b));var q=0===r?f:void 0;b=m.certificateToAsn1(b);b=h.create(h.Class.UNIVERSAL,
|
732
|
+
h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(m.oids.certBag).getBytes()),h.create(h.Class.CONTEXT_SPECIFIC,0,!0,[h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(m.oids.x509Certificate).getBytes()),h.create(h.Class.CONTEXT_SPECIFIC,0,!0,[h.create(h.Class.UNIVERSAL,h.Type.OCTETSTRING,!1,h.toDer(b).getBytes())])])]),q]);p.push(b)}0<p.length&&(b=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,p),b=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,
|
733
|
+
!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(m.oids.data).getBytes()),h.create(h.Class.CONTEXT_SPECIFIC,0,!0,[h.create(h.Class.UNIVERSAL,h.Type.OCTETSTRING,!1,h.toDer(b).getBytes())])]),e.push(b));null!==a&&(a=m.wrapRsaPrivateKey(m.privateKeyToAsn1(a)),a=null===c?h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(m.oids.keyBag).getBytes()),h.create(h.Class.CONTEXT_SPECIFIC,0,!0,[a]),f]):h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,
|
734
|
+
h.Type.OID,!1,h.oidToDer(m.oids.pkcs8ShroudedKeyBag).getBytes()),h.create(h.Class.CONTEXT_SPECIFIC,0,!0,[m.encryptPrivateKeyInfo(a,c,d)]),f]),a=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[a]),a=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(m.oids.data).getBytes()),h.create(h.Class.CONTEXT_SPECIFIC,0,!0,[h.create(h.Class.UNIVERSAL,h.Type.OCTETSTRING,!1,h.toDer(a).getBytes())])]),e.push(a));f=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,e);if(d.useMac){e=
|
735
|
+
k.md.sha1.create();var x=new k.util.ByteBuffer(k.random.getBytes(d.saltSize));d=d.count;a=l.generateKey(c,x,3,d,20);c=k.hmac.create();c.start(e,a);c.update(h.toDer(f).getBytes());c=c.getMac();x=h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(m.oids.sha1).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.NULL,!1,"")]),h.create(h.Class.UNIVERSAL,h.Type.OCTETSTRING,
|
736
|
+
!1,c.getBytes())]),h.create(h.Class.UNIVERSAL,h.Type.OCTETSTRING,!1,x.getBytes()),h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,h.integerToDer(d).getBytes())])}return h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.INTEGER,!1,h.integerToDer(3).getBytes()),h.create(h.Class.UNIVERSAL,h.Type.SEQUENCE,!0,[h.create(h.Class.UNIVERSAL,h.Type.OID,!1,h.oidToDer(m.oids.data).getBytes()),h.create(h.Class.CONTEXT_SPECIFIC,0,!0,[h.create(h.Class.UNIVERSAL,h.Type.OCTETSTRING,!1,
|
737
|
+
h.toDer(f).getBytes())])]),x])};l.generateKey=k.pbe.generatePkcs12Key});C(function(a){var b=k.asn1,c=a.exports=k.pki=k.pki||{};c.pemToDer=function(a){a=k.pem.decode(a)[0];if(a.procType&&"ENCRYPTED"===a.procType.type)throw Error("Could not convert PEM to DER; PEM is encrypted.");return k.util.createBuffer(a.body)};c.privateKeyFromPem=function(a){a=k.pem.decode(a)[0];if("PRIVATE KEY"!==a.type&&"RSA PRIVATE KEY"!==a.type){var d=Error('Could not convert private key from PEM; PEM header type is not "PRIVATE KEY" or "RSA PRIVATE KEY".');
|
738
|
+
d.headerType=a.type;throw d;}if(a.procType&&"ENCRYPTED"===a.procType.type)throw Error("Could not convert private key from PEM; PEM is encrypted.");a=b.fromDer(a.body);return c.privateKeyFromAsn1(a)};c.privateKeyToPem=function(a,e){a={type:"RSA PRIVATE KEY",body:b.toDer(c.privateKeyToAsn1(a)).getBytes()};return k.pem.encode(a,{maxline:e})};c.privateKeyInfoToPem=function(a,c){a={type:"PRIVATE KEY",body:b.toDer(a).getBytes()};return k.pem.encode(a,{maxline:c})}});var hd=function(a,b,c,d){var e=k.util.createBuffer(),
|
739
|
+
f=a.length>>1,h=f+(a.length&1),m=a.substr(0,h);h=a.substr(f,h);a=k.util.createBuffer();f=k.hmac.create();c=b+c;var l=Math.ceil(d/16);b=Math.ceil(d/20);f.start("MD5",m);m=k.util.createBuffer();a.putBytes(c);for(var n=0;n<l;++n)f.start(null,null),f.update(a.getBytes()),a.putBuffer(f.digest()),f.start(null,null),f.update(a.bytes()+c),m.putBuffer(f.digest());f.start("SHA1",h);h=k.util.createBuffer();a.clear();a.putBytes(c);for(n=0;n<b;++n)f.start(null,null),f.update(a.getBytes()),a.putBuffer(f.digest()),
|
740
|
+
f.start(null,null),f.update(a.bytes()+c),h.putBuffer(f.digest());e.putBytes(k.util.xorBytes(m.getBytes(),h.getBytes(),d));return e},Yp=function(a,b,c){c=!1;try{var d=a.deflate(b.fragment.getBytes());b.fragment=k.util.createBuffer(d);b.length=d.length;c=!0}catch(e){}return c},Zp=function(a,b,c){c=!1;try{var d=a.inflate(b.fragment.getBytes());b.fragment=k.util.createBuffer(d);b.length=d.length;c=!0}catch(e){}return c},Qa=function(a,b){var c=0;switch(b){case 1:c=a.getByte();break;case 2:c=a.getInt16();
|
741
|
+
break;case 3:c=a.getInt24();break;case 4:c=a.getInt32()}return k.util.createBuffer(a.getBytes(c))},Xa=function(a,b,c){a.putInt(c.length(),b<<3);a.putBuffer(c)},q={Versions:{TLS_1_0:{major:3,minor:1},TLS_1_1:{major:3,minor:2},TLS_1_2:{major:3,minor:3}}};q.SupportedVersions=[q.Versions.TLS_1_1,q.Versions.TLS_1_0];q.Version=q.SupportedVersions[0];q.MaxFragment=15360;q.ConnectionEnd={server:0,client:1};q.PRFAlgorithm={tls_prf_sha256:0};q.BulkCipherAlgorithm={none:null,rc4:0,des3:1,aes:2};q.CipherType=
|
742
|
+
{stream:0,block:1,aead:2};q.MACAlgorithm={none:null,hmac_md5:0,hmac_sha1:1,hmac_sha256:2,hmac_sha384:3,hmac_sha512:4};q.CompressionMethod={none:0,deflate:1};q.ContentType={change_cipher_spec:20,alert:21,handshake:22,application_data:23,heartbeat:24};q.HandshakeType={hello_request:0,client_hello:1,server_hello:2,certificate:11,server_key_exchange:12,certificate_request:13,server_hello_done:14,certificate_verify:15,client_key_exchange:16,finished:20};q.Alert={};q.Alert.Level={warning:1,fatal:2};q.Alert.Description=
|
743
|
+
{close_notify:0,unexpected_message:10,bad_record_mac:20,decryption_failed:21,record_overflow:22,decompression_failure:30,handshake_failure:40,bad_certificate:42,unsupported_certificate:43,certificate_revoked:44,certificate_expired:45,certificate_unknown:46,illegal_parameter:47,unknown_ca:48,access_denied:49,decode_error:50,decrypt_error:51,export_restriction:60,protocol_version:70,insufficient_security:71,internal_error:80,user_canceled:90,no_renegotiation:100};q.HeartbeatMessageType={heartbeat_request:1,
|
744
|
+
heartbeat_response:2};q.CipherSuites={};q.getCipherSuite=function(a){var b=null,c;for(c in q.CipherSuites){var d=q.CipherSuites[c];if(d.id[0]===a.charCodeAt(0)&&d.id[1]===a.charCodeAt(1)){b=d;break}}return b};q.handleUnexpected=function(a,b){(a.open||a.entity!==q.ConnectionEnd.client)&&a.error(a,{message:"Unexpected message. Received TLS record out of order.",send:!0,alert:{level:q.Alert.Level.fatal,description:q.Alert.Description.unexpected_message}})};q.handleHelloRequest=function(a,b,c){!a.handshaking&&
|
745
|
+
0<a.handshakes&&(q.queue(a,q.createAlert(a,{level:q.Alert.Level.warning,description:q.Alert.Description.no_renegotiation})),q.flush(a));a.process()};q.parseHelloMessage=function(a,b,c){var d=null,e=a.entity===q.ConnectionEnd.client;if(38>c)a.error(a,{message:e?"Invalid ServerHello message. Message too short.":"Invalid ClientHello message. Message too short.",send:!0,alert:{level:q.Alert.Level.fatal,description:q.Alert.Description.illegal_parameter}});else{b=b.fragment;var f=b.length();d={version:{major:b.getByte(),
|
746
|
+
minor:b.getByte()},random:k.util.createBuffer(b.getBytes(32)),session_id:Qa(b,1),extensions:[]};e?(d.cipher_suite=b.getBytes(2),d.compression_method=b.getByte()):(d.cipher_suites=Qa(b,2),d.compression_methods=Qa(b,1));f=c-(f-b.length());if(0<f){for(c=Qa(b,2);0<c.length();)d.extensions.push({type:[c.getByte(),c.getByte()],data:Qa(c,2)});if(!e)for(c=0;c<d.extensions.length;++c)if(b=d.extensions[c],0===b.type[0]&&0===b.type[1])for(b=Qa(b.data,2);0<b.length()&&0===b.getByte();)a.session.extensions.server_name.serverNameList.push(Qa(b,
|
747
|
+
2).getBytes())}if(a.session.version&&(d.version.major!==a.session.version.major||d.version.minor!==a.session.version.minor))return a.error(a,{message:"TLS version change is disallowed during renegotiation.",send:!0,alert:{level:q.Alert.Level.fatal,description:q.Alert.Description.protocol_version}});if(e)a.session.cipherSuite=q.getCipherSuite(d.cipher_suite);else for(c=k.util.createBuffer(d.cipher_suites.bytes());0<c.length()&&(a.session.cipherSuite=q.getCipherSuite(c.getBytes(2)),null===a.session.cipherSuite););
|
748
|
+
if(null===a.session.cipherSuite)return a.error(a,{message:"No cipher suites in common.",send:!0,alert:{level:q.Alert.Level.fatal,description:q.Alert.Description.handshake_failure},cipherSuite:k.util.bytesToHex(d.cipher_suite)});a.session.compressionMethod=e?d.compression_method:q.CompressionMethod.none}return d};q.createSecurityParameters=function(a,b){var c=a.entity===q.ConnectionEnd.client,d=b.random.bytes();b=c?a.session.sp.client_random:d;c=c?d:q.createRandom().getBytes();a.session.sp={entity:a.entity,
|
749
|
+
prf_algorithm:q.PRFAlgorithm.tls_prf_sha256,bulk_cipher_algorithm:null,cipher_type:null,enc_key_length:null,block_length:null,fixed_iv_length:null,record_iv_length:null,mac_algorithm:null,mac_length:null,mac_key_length:null,compression_algorithm:a.session.compressionMethod,pre_master_secret:null,master_secret:null,client_random:b,server_random:c}};q.handleServerHello=function(a,b,c){b=q.parseHelloMessage(a,b,c);if(!a.fail){if(b.version.minor<=a.version.minor)a.version.minor=b.version.minor;else return a.error(a,
|
750
|
+
{message:"Incompatible TLS version.",send:!0,alert:{level:q.Alert.Level.fatal,description:q.Alert.Description.protocol_version}});a.session.version=a.version;c=b.session_id.bytes();0<c.length&&c===a.session.id?(a.expect=mk,a.session.resuming=!0,a.session.sp.server_random=b.random.bytes()):(a.expect=$p,a.session.resuming=!1,q.createSecurityParameters(a,b));a.session.id=c;a.process()}};q.handleClientHello=function(a,b,c){b=q.parseHelloMessage(a,b,c);if(!a.fail){var d=b.session_id.bytes();c=null;if(a.sessionCache)if(c=
|
751
|
+
a.sessionCache.getSession(d),null===c)d="";else if(c.version.major!==b.version.major||c.version.minor>b.version.minor)c=null,d="";0===d.length&&(d=k.random.getBytes(32));a.session.id=d;a.session.clientHelloVersion=b.version;a.session.sp={};if(c)a.version=a.session.version=c.version,a.session.sp=c.sp;else{for(d=1;d<q.SupportedVersions.length;++d){var e=q.SupportedVersions[d];if(e.minor<=b.version.minor)break}a.version={major:e.major,minor:e.minor};a.session.version=a.version}null!==c?(a.expect=bg,
|
752
|
+
a.session.resuming=!0,a.session.sp.client_random=b.random.bytes()):(a.expect=!1!==a.verifyClient?aq:cg,a.session.resuming=!1,q.createSecurityParameters(a,b));a.open=!0;q.queue(a,q.createRecord(a,{type:q.ContentType.handshake,data:q.createServerHello(a)}));a.session.resuming?(q.queue(a,q.createRecord(a,{type:q.ContentType.change_cipher_spec,data:q.createChangeCipherSpec()})),a.state.pending=q.createConnectionState(a),a.state.current.write=a.state.pending.write,q.queue(a,q.createRecord(a,{type:q.ContentType.handshake,
|
753
|
+
data:q.createFinished(a)}))):(q.queue(a,q.createRecord(a,{type:q.ContentType.handshake,data:q.createCertificate(a)})),a.fail||(q.queue(a,q.createRecord(a,{type:q.ContentType.handshake,data:q.createServerKeyExchange(a)})),!1!==a.verifyClient&&q.queue(a,q.createRecord(a,{type:q.ContentType.handshake,data:q.createCertificateRequest(a)})),q.queue(a,q.createRecord(a,{type:q.ContentType.handshake,data:q.createServerHelloDone(a)}))));q.flush(a);a.process()}};q.handleCertificate=function(a,b,c){if(3>c)return a.error(a,
|
754
|
+
{message:"Invalid Certificate message. Message too short.",send:!0,alert:{level:q.Alert.Level.fatal,description:q.Alert.Description.illegal_parameter}});c=Qa(b.fragment,3);b=[];try{for(;0<c.length();){var d=Qa(c,3);var e=k.asn1.fromDer(d);d=k.pki.certificateFromAsn1(e,!0);b.push(d)}}catch(f){return a.error(a,{message:"Could not parse certificate list.",cause:f,send:!0,alert:{level:q.Alert.Level.fatal,description:q.Alert.Description.bad_certificate}})}d=a.entity===q.ConnectionEnd.client;!d&&!0!==a.verifyClient||
|
755
|
+
0!==b.length?0===b.length?a.expect=d?nk:cg:(d?a.session.serverCertificate=b[0]:a.session.clientCertificate=b[0],q.verifyCertificateChain(a,b)&&(a.expect=d?nk:cg)):a.error(a,{message:d?"No server certificate provided.":"No client certificate provided.",send:!0,alert:{level:q.Alert.Level.fatal,description:q.Alert.Description.illegal_parameter}});a.process()};q.handleServerKeyExchange=function(a,b,c){if(0<c)return a.error(a,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:q.Alert.Level.fatal,
|
756
|
+
description:q.Alert.Description.unsupported_certificate}});a.expect=bq;a.process()};q.handleClientKeyExchange=function(a,b,c){if(48>c)return a.error(a,{message:"Invalid key parameters. Only RSA is supported.",send:!0,alert:{level:q.Alert.Level.fatal,description:q.Alert.Description.unsupported_certificate}});b=Qa(b.fragment,2).getBytes();c=null;if(a.getPrivateKey)try{c=a.getPrivateKey(a,a.session.serverCertificate),c=k.pki.privateKeyFromPem(c)}catch(f){a.error(a,{message:"Could not get private key.",
|
757
|
+
cause:f,send:!0,alert:{level:q.Alert.Level.fatal,description:q.Alert.Description.internal_error}})}if(null===c)return a.error(a,{message:"No private key set.",send:!0,alert:{level:q.Alert.Level.fatal,description:q.Alert.Description.internal_error}});try{var d=a.session.sp;d.pre_master_secret=c.decrypt(b);var e=a.session.clientHelloVersion;if(e.major!==d.pre_master_secret.charCodeAt(0)||e.minor!==d.pre_master_secret.charCodeAt(1))throw Error("TLS version rollback attack detected.");}catch(f){d.pre_master_secret=
|
758
|
+
k.random.getBytes(48)}a.expect=bg;null!==a.session.clientCertificate&&(a.expect=cq);a.process()};q.handleCertificateRequest=function(a,b,c){if(3>c)return a.error(a,{message:"Invalid CertificateRequest. Message too short.",send:!0,alert:{level:q.Alert.Level.fatal,description:q.Alert.Description.illegal_parameter}});b=b.fragment;b={certificate_types:Qa(b,1),certificate_authorities:Qa(b,2)};a.session.certificateRequest=b;a.expect=dq;a.process()};q.handleCertificateVerify=function(a,b,c){if(2>c)return a.error(a,
|
759
|
+
{message:"Invalid CertificateVerify. Message too short.",send:!0,alert:{level:q.Alert.Level.fatal,description:q.Alert.Description.illegal_parameter}});c=b.fragment;c.read-=4;b=c.bytes();c.read+=4;c=Qa(c,2).getBytes();var d=k.util.createBuffer();d.putBuffer(a.session.md5.digest());d.putBuffer(a.session.sha1.digest());d=d.getBytes();try{if(!a.session.clientCertificate.publicKey.verify(d,c,"NONE"))throw Error("CertificateVerify signature does not match.");a.session.md5.update(b);a.session.sha1.update(b)}catch(e){return a.error(a,
|
760
|
+
{message:"Bad signature in CertificateVerify.",send:!0,alert:{level:q.Alert.Level.fatal,description:q.Alert.Description.handshake_failure}})}a.expect=bg;a.process()};q.handleServerHelloDone=function(a,b,c){if(0<c)return a.error(a,{message:"Invalid ServerHelloDone message. Invalid length.",send:!0,alert:{level:q.Alert.Level.fatal,description:q.Alert.Description.record_overflow}});if(null===a.serverCertificate&&(b={message:"No server certificate provided. Not enough security.",send:!0,alert:{level:q.Alert.Level.fatal,
|
761
|
+
description:q.Alert.Description.insufficient_security}},c=a.verify(a,b.alert.description,0,[]),!0!==c)){if(c||0===c)"object"!==typeof c||k.util.isArray(c)?"number"===typeof c&&(b.alert.description=c):(c.message&&(b.message=c.message),c.alert&&(b.alert.description=c.alert));return a.error(a,b)}null!==a.session.certificateRequest&&(b=q.createRecord(a,{type:q.ContentType.handshake,data:q.createCertificate(a)}),q.queue(a,b));b=q.createRecord(a,{type:q.ContentType.handshake,data:q.createClientKeyExchange(a)});
|
762
|
+
q.queue(a,b);a.expect=eq;b=function(a,b){null!==a.session.certificateRequest&&null!==a.session.clientCertificate&&q.queue(a,q.createRecord(a,{type:q.ContentType.handshake,data:q.createCertificateVerify(a,b)}));q.queue(a,q.createRecord(a,{type:q.ContentType.change_cipher_spec,data:q.createChangeCipherSpec()}));a.state.pending=q.createConnectionState(a);a.state.current.write=a.state.pending.write;q.queue(a,q.createRecord(a,{type:q.ContentType.handshake,data:q.createFinished(a)}));a.expect=mk;q.flush(a);
|
763
|
+
a.process()};if(null===a.session.certificateRequest||null===a.session.clientCertificate)return b(a,null);q.getClientSignature(a,b)};q.handleChangeCipherSpec=function(a,b){if(1!==b.fragment.getByte())return a.error(a,{message:"Invalid ChangeCipherSpec message received.",send:!0,alert:{level:q.Alert.Level.fatal,description:q.Alert.Description.illegal_parameter}});b=a.entity===q.ConnectionEnd.client;if(a.session.resuming&&b||!a.session.resuming&&!b)a.state.pending=q.createConnectionState(a);a.state.current.read=
|
764
|
+
a.state.pending.read;if(!a.session.resuming&&b||a.session.resuming&&!b)a.state.pending=null;a.expect=b?fq:gq;a.process()};q.handleFinished=function(a,b,c){c=b.fragment;c.read-=4;var d=c.bytes();c.read+=4;b=b.fragment.getBytes();c=k.util.createBuffer();c.putBuffer(a.session.md5.digest());c.putBuffer(a.session.sha1.digest());var e=a.entity===q.ConnectionEnd.client;c=hd(a.session.sp.master_secret,e?"server finished":"client finished",c.getBytes(),12);if(c.getBytes()!==b)return a.error(a,{message:"Invalid verify_data in Finished message.",
|
765
|
+
send:!0,alert:{level:q.Alert.Level.fatal,description:q.Alert.Description.decrypt_error}});a.session.md5.update(d);a.session.sha1.update(d);if(a.session.resuming&&e||!a.session.resuming&&!e)q.queue(a,q.createRecord(a,{type:q.ContentType.change_cipher_spec,data:q.createChangeCipherSpec()})),a.state.current.write=a.state.pending.write,a.state.pending=null,q.queue(a,q.createRecord(a,{type:q.ContentType.handshake,data:q.createFinished(a)}));a.expect=e?hq:iq;a.handshaking=!1;++a.handshakes;a.peerCertificate=
|
766
|
+
e?a.session.serverCertificate:a.session.clientCertificate;q.flush(a);a.isConnected=!0;a.connected(a);a.process()};q.handleAlert=function(a,b){b=b.fragment;b={level:b.getByte(),description:b.getByte()};switch(b.description){case q.Alert.Description.close_notify:var c="Connection closed.";break;case q.Alert.Description.unexpected_message:c="Unexpected message.";break;case q.Alert.Description.bad_record_mac:c="Bad record MAC.";break;case q.Alert.Description.decryption_failed:c="Decryption failed.";break;
|
767
|
+
case q.Alert.Description.record_overflow:c="Record overflow.";break;case q.Alert.Description.decompression_failure:c="Decompression failed.";break;case q.Alert.Description.handshake_failure:c="Handshake failure.";break;case q.Alert.Description.bad_certificate:c="Bad certificate.";break;case q.Alert.Description.unsupported_certificate:c="Unsupported certificate.";break;case q.Alert.Description.certificate_revoked:c="Certificate revoked.";break;case q.Alert.Description.certificate_expired:c="Certificate expired.";
|
768
|
+
break;case q.Alert.Description.certificate_unknown:c="Certificate unknown.";break;case q.Alert.Description.illegal_parameter:c="Illegal parameter.";break;case q.Alert.Description.unknown_ca:c="Unknown certificate authority.";break;case q.Alert.Description.access_denied:c="Access denied.";break;case q.Alert.Description.decode_error:c="Decode error.";break;case q.Alert.Description.decrypt_error:c="Decrypt error.";break;case q.Alert.Description.export_restriction:c="Export restriction.";break;case q.Alert.Description.protocol_version:c=
|
769
|
+
"Unsupported protocol version.";break;case q.Alert.Description.insufficient_security:c="Insufficient security.";break;case q.Alert.Description.internal_error:c="Internal error.";break;case q.Alert.Description.user_canceled:c="User canceled.";break;case q.Alert.Description.no_renegotiation:c="Renegotiation not supported.";break;default:c="Unknown error."}if(b.description===q.Alert.Description.close_notify)return a.close();a.error(a,{message:c,send:!1,origin:a.entity===q.ConnectionEnd.client?"server":
|
770
|
+
"client",alert:b});a.process()};q.handleHandshake=function(a,b){var c=b.fragment,d=c.getByte(),e=c.getInt24();if(e>c.length())return a.fragmented=b,b.fragment=k.util.createBuffer(),c.read-=4,a.process();a.fragmented=null;c.read-=4;var f=c.bytes(e+4);c.read+=4;d in re[a.entity][a.expect]?(a.entity!==q.ConnectionEnd.server||a.open||a.fail||(a.handshaking=!0,a.session={version:null,extensions:{server_name:{serverNameList:[]}},cipherSuite:null,compressionMethod:null,serverCertificate:null,clientCertificate:null,
|
771
|
+
md5:k.md.md5.create(),sha1:k.md.sha1.create()}),d!==q.HandshakeType.hello_request&&d!==q.HandshakeType.certificate_verify&&d!==q.HandshakeType.finished&&(a.session.md5.update(f),a.session.sha1.update(f)),re[a.entity][a.expect][d](a,b,e)):q.handleUnexpected(a,b)};q.handleApplicationData=function(a,b){a.data.putBuffer(b.fragment);a.dataReady(a);a.process()};q.handleHeartbeat=function(a,b){var c=b.fragment;b=c.getByte();var d=c.getInt16();c=c.getBytes(d);if(b===q.HeartbeatMessageType.heartbeat_request){if(a.handshaking||
|
772
|
+
d>c.length)return a.process();q.queue(a,q.createRecord(a,{type:q.ContentType.heartbeat,data:q.createHeartbeat(q.HeartbeatMessageType.heartbeat_response,c)}));q.flush(a)}else if(b===q.HeartbeatMessageType.heartbeat_response){if(c!==a.expectedHeartbeatPayload)return a.process();a.heartbeatReceived&&a.heartbeatReceived(a,k.util.createBuffer(c))}a.process()};var $p=1,nk=2,bq=3,dq=4,mk=5,fq=6,hq=7,eq=8,aq=1,cg=2,cq=3,bg=4,gq=5,iq=6,p=q.handleUnexpected,ok=q.handleChangeCipherSpec,qa=q.handleAlert,Da=q.handleHandshake,
|
773
|
+
pk=q.handleApplicationData,ra=q.handleHeartbeat,dg=[];dg[q.ConnectionEnd.client]=[[p,qa,Da,p,ra],[p,qa,Da,p,ra],[p,qa,Da,p,ra],[p,qa,Da,p,ra],[p,qa,Da,p,ra],[ok,qa,p,p,ra],[p,qa,Da,p,ra],[p,qa,Da,pk,ra],[p,qa,Da,p,ra]];dg[q.ConnectionEnd.server]=[[p,qa,Da,p,ra],[p,qa,Da,p,ra],[p,qa,Da,p,ra],[p,qa,Da,p,ra],[ok,qa,p,p,ra],[p,qa,Da,p,ra],[p,qa,Da,pk,ra],[p,qa,Da,p,ra]];var Hb=q.handleHelloRequest,qk=q.handleCertificate,rk=q.handleServerKeyExchange,eg=q.handleCertificateRequest,se=q.handleServerHelloDone,
|
774
|
+
sk=q.handleFinished,re=[];re[q.ConnectionEnd.client]=[[p,p,q.handleServerHello,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p],[Hb,p,p,p,p,p,p,p,p,p,p,qk,rk,eg,se,p,p,p,p,p,p],[Hb,p,p,p,p,p,p,p,p,p,p,p,rk,eg,se,p,p,p,p,p,p],[Hb,p,p,p,p,p,p,p,p,p,p,p,p,eg,se,p,p,p,p,p,p],[Hb,p,p,p,p,p,p,p,p,p,p,p,p,p,se,p,p,p,p,p,p],[Hb,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p],[Hb,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,sk],[Hb,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p],[Hb,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p]];re[q.ConnectionEnd.server]=
|
775
|
+
[[p,q.handleClientHello,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p],[p,p,p,p,p,p,p,p,p,p,p,qk,p,p,p,p,p,p,p,p,p],[p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,q.handleClientKeyExchange,p,p,p,p],[p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,q.handleCertificateVerify,p,p,p,p,p],[p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p],[p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,sk],[p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p],[p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p,p]];q.generateKeys=function(a,b){var c=b.client_random+b.server_random;a.session.resuming||
|
776
|
+
(b.master_secret=hd(b.pre_master_secret,"master secret",c,48).bytes(),b.pre_master_secret=null);c=b.server_random+b.client_random;var d=2*b.mac_key_length+2*b.enc_key_length;(a=a.version.major===q.Versions.TLS_1_0.major&&a.version.minor===q.Versions.TLS_1_0.minor)&&(d+=2*b.fixed_iv_length);c=hd(b.master_secret,"key expansion",c,d);d={client_write_MAC_key:c.getBytes(b.mac_key_length),server_write_MAC_key:c.getBytes(b.mac_key_length),client_write_key:c.getBytes(b.enc_key_length),server_write_key:c.getBytes(b.enc_key_length)};
|
777
|
+
a&&(d.client_write_IV=c.getBytes(b.fixed_iv_length),d.server_write_IV=c.getBytes(b.fixed_iv_length));return d};q.createConnectionState=function(a){var b=a.entity===q.ConnectionEnd.client,c=function(){var a={sequenceNumber:[0,0],macKey:null,macLength:0,macFunction:null,cipherState:null,cipherFunction:function(a){return!0},compressionState:null,compressFunction:function(a){return!0},updateSequenceNumber:function(){4294967295===a.sequenceNumber[1]?(a.sequenceNumber[1]=0,++a.sequenceNumber[0]):++a.sequenceNumber[1]}};
|
778
|
+
return a},d={read:c(),write:c()};d.read.update=function(a,b){d.read.cipherFunction(b,d.read)?d.read.compressFunction(a,b,d.read)||a.error(a,{message:"Could not decompress record.",send:!0,alert:{level:q.Alert.Level.fatal,description:q.Alert.Description.decompression_failure}}):a.error(a,{message:"Could not decrypt record or bad MAC.",send:!0,alert:{level:q.Alert.Level.fatal,description:q.Alert.Description.bad_record_mac}});return!a.fail};d.write.update=function(a,b){d.write.compressFunction(a,b,d.write)?
|
779
|
+
d.write.cipherFunction(b,d.write)||a.error(a,{message:"Could not encrypt record.",send:!1,alert:{level:q.Alert.Level.fatal,description:q.Alert.Description.internal_error}}):a.error(a,{message:"Could not compress record.",send:!1,alert:{level:q.Alert.Level.fatal,description:q.Alert.Description.internal_error}});return!a.fail};if(a.session)switch(c=a.session.sp,a.session.cipherSuite.initSecurityParameters(c),c.keys=q.generateKeys(a,c),d.read.macKey=b?c.keys.server_write_MAC_key:c.keys.client_write_MAC_key,
|
780
|
+
d.write.macKey=b?c.keys.client_write_MAC_key:c.keys.server_write_MAC_key,a.session.cipherSuite.initConnectionState(d,a,c),c.compression_algorithm){case q.CompressionMethod.none:break;case q.CompressionMethod.deflate:d.read.compressFunction=Zp;d.write.compressFunction=Yp;break;default:throw Error("Unsupported compression algorithm.");}return d};q.createRandom=function(){var a=new Date;a=+a+6E4*a.getTimezoneOffset();var b=k.util.createBuffer();b.putInt32(a);b.putBytes(k.random.getBytes(28));return b};
|
781
|
+
q.createRecord=function(a,b){return b.data?{type:b.type,version:{major:a.version.major,minor:a.version.minor},length:b.data.length(),fragment:b.data}:null};q.createAlert=function(a,b){var c=k.util.createBuffer();c.putByte(b.level);c.putByte(b.description);return q.createRecord(a,{type:q.ContentType.alert,data:c})};q.createClientHello=function(a){a.session.clientHelloVersion={major:a.version.major,minor:a.version.minor};for(var b=k.util.createBuffer(),c=0;c<a.cipherSuites.length;++c){var d=a.cipherSuites[c];
|
782
|
+
b.putByte(d.id[0]);b.putByte(d.id[1])}var e=b.length();c=k.util.createBuffer();c.putByte(q.CompressionMethod.none);var f=c.length();d=k.util.createBuffer();if(a.virtualHost){var h=k.util.createBuffer();h.putByte(0);h.putByte(0);var m=k.util.createBuffer();m.putByte(0);Xa(m,2,k.util.createBuffer(a.virtualHost));var l=k.util.createBuffer();Xa(l,2,m);Xa(h,2,l);d.putBuffer(h)}h=d.length();0<h&&(h+=2);m=a.session.id;e=m.length+1+2+4+28+2+e+1+f+h;f=k.util.createBuffer();f.putByte(q.HandshakeType.client_hello);
|
783
|
+
f.putInt24(e);f.putByte(a.version.major);f.putByte(a.version.minor);f.putBytes(a.session.sp.client_random);Xa(f,1,k.util.createBuffer(m));Xa(f,2,b);Xa(f,1,c);0<h&&Xa(f,2,d);return f};q.createServerHello=function(a){var b=a.session.id,c=b.length+1+2+4+28+2+1,d=k.util.createBuffer();d.putByte(q.HandshakeType.server_hello);d.putInt24(c);d.putByte(a.version.major);d.putByte(a.version.minor);d.putBytes(a.session.sp.server_random);Xa(d,1,k.util.createBuffer(b));d.putByte(a.session.cipherSuite.id[0]);d.putByte(a.session.cipherSuite.id[1]);
|
784
|
+
d.putByte(a.session.compressionMethod);return d};q.createCertificate=function(a){var b=a.entity===q.ConnectionEnd.client,c=null;a.getCertificate&&(c=a.getCertificate(a,b?a.session.certificateRequest:a.session.extensions.server_name.serverNameList));var d=k.util.createBuffer();if(null!==c)try{k.util.isArray(c)||(c=[c]);for(var e=null,f=0;f<c.length;++f){var h=k.pem.decode(c[f])[0];if("CERTIFICATE"!==h.type&&"X509 CERTIFICATE"!==h.type&&"TRUSTED CERTIFICATE"!==h.type){var m=Error('Could not convert certificate from PEM; PEM header type is not "CERTIFICATE", "X509 CERTIFICATE", or "TRUSTED CERTIFICATE".');
|
785
|
+
m.headerType=h.type;throw m;}if(h.procType&&"ENCRYPTED"===h.procType.type)throw Error("Could not convert certificate from PEM; PEM is encrypted.");var l=k.util.createBuffer(h.body);null===e&&(e=k.asn1.fromDer(l.bytes(),!1));var n=k.util.createBuffer();Xa(n,3,l);d.putBuffer(n)}c=k.pki.certificateFromAsn1(e);b?a.session.clientCertificate=c:a.session.serverCertificate=c}catch(X){return a.error(a,{message:"Could not send certificate list.",cause:X,send:!0,alert:{level:q.Alert.Level.fatal,description:q.Alert.Description.bad_certificate}})}a=
|
786
|
+
3+d.length();b=k.util.createBuffer();b.putByte(q.HandshakeType.certificate);b.putInt24(a);Xa(b,3,d);return b};q.createClientKeyExchange=function(a){var b=k.util.createBuffer();b.putByte(a.session.clientHelloVersion.major);b.putByte(a.session.clientHelloVersion.minor);b.putBytes(k.random.getBytes(46));var c=a.session.sp;c.pre_master_secret=b.getBytes();b=a.session.serverCertificate.publicKey.encrypt(c.pre_master_secret);a=b.length+2;c=k.util.createBuffer();c.putByte(q.HandshakeType.client_key_exchange);
|
787
|
+
c.putInt24(a);c.putInt16(b.length);c.putBytes(b);return c};q.createServerKeyExchange=function(a){return k.util.createBuffer()};q.getClientSignature=function(a,b){var c=k.util.createBuffer();c.putBuffer(a.session.md5.digest());c.putBuffer(a.session.sha1.digest());c=c.getBytes();a.getSignature=a.getSignature||function(a,b,c){var d=null;if(a.getPrivateKey)try{d=a.getPrivateKey(a,a.session.clientCertificate),d=k.pki.privateKeyFromPem(d)}catch(m){a.error(a,{message:"Could not get private key.",cause:m,
|
788
|
+
send:!0,alert:{level:q.Alert.Level.fatal,description:q.Alert.Description.internal_error}})}null===d?a.error(a,{message:"No private key set.",send:!0,alert:{level:q.Alert.Level.fatal,description:q.Alert.Description.internal_error}}):b=d.sign(b,null);c(a,b)};a.getSignature(a,c,b)};q.createCertificateVerify=function(a,b){a=b.length+2;var c=k.util.createBuffer();c.putByte(q.HandshakeType.certificate_verify);c.putInt24(a);c.putInt16(b.length);c.putBytes(b);return c};q.createCertificateRequest=function(a){var b=
|
789
|
+
k.util.createBuffer();b.putByte(1);var c=k.util.createBuffer();for(e in a.caStore.certs){var d=k.pki.distinguishedNameToAsn1(a.caStore.certs[e].subject);d=k.asn1.toDer(d);c.putInt16(d.length());c.putBuffer(d)}a=1+b.length()+2+c.length();var e=k.util.createBuffer();e.putByte(q.HandshakeType.certificate_request);e.putInt24(a);Xa(e,1,b);Xa(e,2,c);return e};q.createServerHelloDone=function(a){a=k.util.createBuffer();a.putByte(q.HandshakeType.server_hello_done);a.putInt24(0);return a};q.createChangeCipherSpec=
|
790
|
+
function(){var a=k.util.createBuffer();a.putByte(1);return a};q.createFinished=function(a){var b=k.util.createBuffer();b.putBuffer(a.session.md5.digest());b.putBuffer(a.session.sha1.digest());b=hd(a.session.sp.master_secret,a.entity===q.ConnectionEnd.client?"client finished":"server finished",b.getBytes(),12);a=k.util.createBuffer();a.putByte(q.HandshakeType.finished);a.putInt24(b.length());a.putBuffer(b);return a};q.createHeartbeat=function(a,b,c){"undefined"===typeof c&&(c=b.length);var d=k.util.createBuffer();
|
791
|
+
d.putByte(a);d.putInt16(c);d.putBytes(b);a=d.length();d.putBytes(k.random.getBytes(Math.max(16,a-c-3)));return d};q.queue=function(a,b){if(b&&(0!==b.fragment.length()||b.type!==q.ContentType.handshake&&b.type!==q.ContentType.alert&&b.type!==q.ContentType.change_cipher_spec)){if(b.type===q.ContentType.handshake){var c=b.fragment.bytes();a.session.md5.update(c);a.session.sha1.update(c)}if(b.fragment.length()<=q.MaxFragment)c=[b];else{c=[];for(var d=b.fragment.bytes();d.length>q.MaxFragment;)c.push(q.createRecord(a,
|
792
|
+
{type:b.type,data:k.util.createBuffer(d.slice(0,q.MaxFragment))})),d=d.slice(q.MaxFragment);0<d.length&&c.push(q.createRecord(a,{type:b.type,data:k.util.createBuffer(d)}))}for(b=0;b<c.length&&!a.fail;++b)d=c[b],a.state.current.write.update(a,d)&&a.records.push(d)}};q.flush=function(a){for(var b=0;b<a.records.length;++b){var c=a.records[b];a.tlsData.putByte(c.type);a.tlsData.putByte(c.version.major);a.tlsData.putByte(c.version.minor);a.tlsData.putInt16(c.fragment.length());a.tlsData.putBuffer(a.records[b].fragment)}a.records=
|
793
|
+
[];return a.tlsDataReady(a)};var fg=function(a){switch(a){case !0:return!0;case k.pki.certificateError.bad_certificate:return q.Alert.Description.bad_certificate;case k.pki.certificateError.unsupported_certificate:return q.Alert.Description.unsupported_certificate;case k.pki.certificateError.certificate_revoked:return q.Alert.Description.certificate_revoked;case k.pki.certificateError.certificate_expired:return q.Alert.Description.certificate_expired;case k.pki.certificateError.certificate_unknown:return q.Alert.Description.certificate_unknown;
|
794
|
+
case k.pki.certificateError.unknown_ca:return q.Alert.Description.unknown_ca;default:return q.Alert.Description.bad_certificate}},jq=function(a){switch(a){case !0:return!0;case q.Alert.Description.bad_certificate:return k.pki.certificateError.bad_certificate;case q.Alert.Description.unsupported_certificate:return k.pki.certificateError.unsupported_certificate;case q.Alert.Description.certificate_revoked:return k.pki.certificateError.certificate_revoked;case q.Alert.Description.certificate_expired:return k.pki.certificateError.certificate_expired;
|
795
|
+
case q.Alert.Description.certificate_unknown:return k.pki.certificateError.certificate_unknown;case q.Alert.Description.unknown_ca:return k.pki.certificateError.unknown_ca;default:return k.pki.certificateError.bad_certificate}};q.verifyCertificateChain=function(a,b){try{var c={},d;for(d in a.verifyOptions)c[d]=a.verifyOptions[d];c.verify=function(b,c,d){fg(b);c=a.verify(a,b,c,d);if(!0!==c){if("object"===typeof c&&!k.util.isArray(c))throw b=Error("The application rejected the certificate."),b.send=
|
796
|
+
!0,b.alert={level:q.Alert.Level.fatal,description:q.Alert.Description.bad_certificate},c.message&&(b.message=c.message),c.alert&&(b.alert.description=c.alert),b;c!==b&&(c=jq(c))}return c};k.pki.verifyCertificateChain(a.caStore,b,c)}catch(e){b=e;if("object"!==typeof b||k.util.isArray(b))b={send:!0,alert:{level:q.Alert.Level.fatal,description:fg(e)}};"send"in b||(b.send=!0);"alert"in b||(b.alert={level:q.Alert.Level.fatal,description:fg(b.error)});a.error(a,b)}return!a.fail};q.createSessionCache=function(a,
|
797
|
+
b){var c=null;if(a&&a.getSession&&a.setSession&&a.order)c=a;else{c={};c.cache=a||{};c.capacity=Math.max(b||100,1);c.order=[];for(var d in a)c.order.length<=b?c.order.push(d):delete a[d];c.getSession=function(a){var b=null,d=null;a?d=k.util.bytesToHex(a):0<c.order.length&&(d=c.order[0]);if(null!==d&&d in c.cache){b=c.cache[d];delete c.cache[d];for(var e in c.order)if(c.order[e]===d){c.order.splice(e,1);break}}return b};c.setSession=function(a,b){if(c.order.length===c.capacity){var d=c.order.shift();
|
798
|
+
delete c.cache[d]}d=k.util.bytesToHex(a);c.order.push(d);c.cache[d]=b}}return c};q.createConnection=function(a){var b=null;b=a.caStore?k.util.isArray(a.caStore)?k.pki.createCaStore(a.caStore):a.caStore:k.pki.createCaStore();var c=a.cipherSuites||null;if(null===c){c=[];for(var d in q.CipherSuites)c.push(q.CipherSuites[d])}d=a.server?q.ConnectionEnd.server:q.ConnectionEnd.client;var e=a.sessionCache?q.createSessionCache(a.sessionCache):null,f={version:{major:q.Version.major,minor:q.Version.minor},entity:d,
|
799
|
+
sessionId:a.sessionId,caStore:b,sessionCache:e,cipherSuites:c,connected:a.connected,virtualHost:a.virtualHost||null,verifyClient:a.verifyClient||!1,verify:a.verify||function(a,b,c,d){return b},verifyOptions:a.verifyOptions||{},getCertificate:a.getCertificate||null,getPrivateKey:a.getPrivateKey||null,getSignature:a.getSignature||null,input:k.util.createBuffer(),tlsData:k.util.createBuffer(),data:k.util.createBuffer(),tlsDataReady:a.tlsDataReady,dataReady:a.dataReady,heartbeatReceived:a.heartbeatReceived,
|
800
|
+
closed:a.closed,error:function(b,c){c.origin=c.origin||(b.entity===q.ConnectionEnd.client?"client":"server");c.send&&(q.queue(b,q.createAlert(b,c.alert)),q.flush(b));var d=!1!==c.fatal;d&&(b.fail=!0);a.error(b,c);d&&b.close(!1)},deflate:a.deflate||null,inflate:a.inflate||null,reset:function(a){f.version={major:q.Version.major,minor:q.Version.minor};f.record=null;f.session=null;f.peerCertificate=null;f.state={pending:null,current:null};f.expect=0;f.fragmented=null;f.records=[];f.open=!1;f.handshakes=
|
801
|
+
0;f.handshaking=!1;f.isConnected=!1;f.fail=!(a||"undefined"===typeof a);f.input.clear();f.tlsData.clear();f.data.clear();f.state.current=q.createConnectionState(f)}};f.reset();f.handshake=function(a){if(f.entity!==q.ConnectionEnd.client)f.error(f,{message:"Cannot initiate handshake as a server.",fatal:!1});else if(f.handshaking)f.error(f,{message:"Handshake already in progress.",fatal:!1});else{f.fail&&!f.open&&0===f.handshakes&&(f.fail=!1);f.handshaking=!0;a=a||"";var b=null;0<a.length&&(f.sessionCache&&
|
802
|
+
(b=f.sessionCache.getSession(a)),null===b&&(a=""));0===a.length&&f.sessionCache&&(b=f.sessionCache.getSession(),null!==b&&(a=b.id));f.session={id:a,version:null,cipherSuite:null,compressionMethod:null,serverCertificate:null,certificateRequest:null,clientCertificate:null,sp:{},md5:k.md.md5.create(),sha1:k.md.sha1.create()};b&&(f.version=b.version,f.session.sp=b.sp);f.session.sp.client_random=q.createRandom().getBytes();f.open=!0;q.queue(f,q.createRecord(f,{type:q.ContentType.handshake,data:q.createClientHello(f)}));
|
803
|
+
q.flush(f)}};f.process=function(a){var b=0;a&&f.input.putBytes(a);if(!f.fail){null!==f.record&&f.record.ready&&f.record.fragment.isEmpty()&&(f.record=null);if(null===f.record){b=0;a=f.input;var c=a.length();5>c?b=5-c:(f.record={type:a.getByte(),version:{major:a.getByte(),minor:a.getByte()},length:a.getInt16(),fragment:k.util.createBuffer(),ready:!1},(a=f.record.version.major===f.version.major)&&f.session&&f.session.version&&(a=f.record.version.minor===f.version.minor),a||f.error(f,{message:"Incompatible TLS version.",
|
804
|
+
send:!0,alert:{level:q.Alert.Level.fatal,description:q.Alert.Description.protocol_version}}))}if(!f.fail&&null!==f.record&&!f.record.ready){b=f;a=0;c=b.input;var d=c.length();d<b.record.length?a=b.record.length-d:(b.record.fragment.putBytes(c.getBytes(b.record.length)),c.compact(),b.state.current.read.update(b,b.record)&&(null!==b.fragmented&&(b.fragmented.type===b.record.type?(b.fragmented.fragment.putBuffer(b.record.fragment),b.record=b.fragmented):b.error(b,{message:"Invalid fragmented record.",
|
805
|
+
send:!0,alert:{level:q.Alert.Level.fatal,description:q.Alert.Description.unexpected_message}})),b.record.ready=!0));b=a}if(!f.fail&&null!==f.record&&f.record.ready)if(a=f.record,c=a.type-q.ContentType.change_cipher_spec,d=dg[f.entity][f.expect],c in d)d[c](f,a);else q.handleUnexpected(f,a)}return b};f.prepare=function(a){q.queue(f,q.createRecord(f,{type:q.ContentType.application_data,data:k.util.createBuffer(a)}));return q.flush(f)};f.prepareHeartbeatRequest=function(a,b){a instanceof k.util.ByteBuffer&&
|
806
|
+
(a=a.bytes());"undefined"===typeof b&&(b=a.length);f.expectedHeartbeatPayload=a;q.queue(f,q.createRecord(f,{type:q.ContentType.heartbeat,data:q.createHeartbeat(q.HeartbeatMessageType.heartbeat_request,a,b)}));return q.flush(f)};f.close=function(a){if(!f.fail&&f.sessionCache&&f.session){var b={id:f.session.id,version:f.session.version,sp:f.session.sp};b.sp.keys=null;f.sessionCache.setSession(b.id,b)}if(f.open){f.open=!1;f.input.clear();if(f.isConnected||f.handshaking)f.isConnected=f.handshaking=!1,
|
807
|
+
q.queue(f,q.createAlert(f,{level:q.Alert.Level.warning,description:q.Alert.Description.close_notify})),q.flush(f);f.closed(f)}f.reset(a)};return f};k.tls=k.tls||{};for(var gg in q)"function"!==typeof q[gg]&&(k.tls[gg]=q[gg]);k.tls.prf_tls1=hd;k.tls.hmac_sha1=function(a,b,c){var d=k.hmac.create();d.start("SHA1",a);a=k.util.createBuffer();a.putInt32(b[0]);a.putInt32(b[1]);a.putByte(c.type);a.putByte(c.version.major);a.putByte(c.version.minor);a.putInt16(c.length);a.putBytes(c.fragment.bytes());d.update(a.getBytes());
|
808
|
+
return d.digest().getBytes()};k.tls.createSessionCache=q.createSessionCache;k.tls.createConnection=q.createConnection;C(function(a){function b(a,b,d){b=b.entity===k.tls.ConnectionEnd.client;a.read.cipherState={init:!1,cipher:k.cipher.createDecipher("AES-CBC",b?d.keys.server_write_key:d.keys.client_write_key),iv:b?d.keys.server_write_IV:d.keys.client_write_IV};a.write.cipherState={init:!1,cipher:k.cipher.createCipher("AES-CBC",b?d.keys.client_write_key:d.keys.server_write_key),iv:b?d.keys.client_write_IV:
|
809
|
+
d.keys.server_write_IV};a.read.cipherFunction=f;a.write.cipherFunction=c;a.read.macLength=a.write.macLength=d.mac_length;a.read.macFunction=a.write.macFunction=h.hmac_sha1}function c(a,b){var c=!1,e=b.macFunction(b.macKey,b.sequenceNumber,a);a.fragment.putBytes(e);b.updateSequenceNumber();e=a.version.minor===h.Versions.TLS_1_0.minor?b.cipherState.init?null:b.cipherState.iv:k.random.getBytesSync(16);b.cipherState.init=!0;b=b.cipherState.cipher;b.start({iv:e});a.version.minor>=h.Versions.TLS_1_1.minor&&
|
810
|
+
b.output.putBytes(e);b.update(a.fragment);b.finish(d)&&(a.fragment=b.output,a.length=a.fragment.length(),c=!0);return c}function d(a,b,c){c||(a-=b.length()%a,b.fillWithByte(a-1,a));return!0}function e(a,b,c){a=!0;if(c){c=b.length();for(var d=b.last(),e=c-1-d;e<c-1;++e)a=a&&b.at(e)==d;a&&b.truncate(d+1)}return a}function f(a,b){var c=a.version.minor===h.Versions.TLS_1_0.minor?b.cipherState.init?null:b.cipherState.iv:a.fragment.getBytes(16);b.cipherState.init=!0;var d=b.cipherState.cipher;d.start({iv:c});
|
811
|
+
d.update(a.fragment);c=d.finish(e);var f=b.macLength,l=k.random.getBytesSync(f),m=d.output.length();m>=f?(a.fragment=d.output.getBytes(m-f),l=d.output.getBytes(f)):a.fragment=d.output.getBytes();a.fragment=k.util.createBuffer(a.fragment);a.length=a.fragment.length();a=b.macFunction(b.macKey,b.sequenceNumber,a);b.updateSequenceNumber();b=b.macKey;d=k.hmac.create();d.start("SHA1",b);d.update(l);l=d.digest().getBytes();d.start(null,null);d.update(a);a=d.digest().getBytes();return l===a&&c}var h=a.exports=
|
812
|
+
k.tls;h.CipherSuites.TLS_RSA_WITH_AES_128_CBC_SHA={id:[0,47],name:"TLS_RSA_WITH_AES_128_CBC_SHA",initSecurityParameters:function(a){a.bulk_cipher_algorithm=h.BulkCipherAlgorithm.aes;a.cipher_type=h.CipherType.block;a.enc_key_length=16;a.block_length=16;a.fixed_iv_length=16;a.record_iv_length=16;a.mac_algorithm=h.MACAlgorithm.hmac_sha1;a.mac_length=20;a.mac_key_length=20},initConnectionState:b};h.CipherSuites.TLS_RSA_WITH_AES_256_CBC_SHA={id:[0,53],name:"TLS_RSA_WITH_AES_256_CBC_SHA",initSecurityParameters:function(a){a.bulk_cipher_algorithm=
|
813
|
+
h.BulkCipherAlgorithm.aes;a.cipher_type=h.CipherType.block;a.enc_key_length=32;a.block_length=16;a.fixed_iv_length=16;a.record_iv_length=16;a.mac_algorithm=h.MACAlgorithm.hmac_sha1;a.mac_length=20;a.mac_key_length=20},initConnectionState:b}});k.debug=k.debug||{};k.debug.storage={};k.debug.get=function(a,b){var c;"undefined"===typeof a?c=k.debug.storage:a in k.debug.storage&&(c="undefined"===typeof b?k.debug.storage[a]:k.debug.storage[a][b]);return c};k.debug.set=function(a,b,c){a in k.debug.storage||
|
814
|
+
(k.debug.storage[a]={});k.debug.storage[a][b]=c};k.debug.clear=function(a,b){"undefined"===typeof a?k.debug.storage={}:a in k.debug.storage&&("undefined"===typeof b?delete k.debug.storage[a]:delete k.debug.storage[a][b])};C(function(a){function b(a,b,c){for(var d,e,h,k,l,n,m,p,q,t,w,y,z,A,B,E,C,D,F,G,T,V,W,Y,L,J=c.length();128<=J;){for(L=0;16>L;++L)b[L][0]=c.getInt32()>>>0,b[L][1]=c.getInt32()>>>0;for(;80>L;++L)l=b[L-2],q=l[0],l=l[1],d=((q>>>19|l<<13)^(l>>>29|q<<3)^q>>>6)>>>0,e=((q<<13|l>>>19)^(l<<
|
815
|
+
3|q>>>29)^(q<<26|l>>>6))>>>0,l=b[L-15],q=l[0],l=l[1],h=((q>>>1|l<<31)^(q>>>8|l<<24)^q>>>7)>>>0,k=((q<<31|l>>>1)^(q<<24|l>>>8)^(q<<25|l>>>7))>>>0,q=b[L-7],t=b[L-16],l=e+q[1]+k+t[1],b[L][0]=d+q[0]+h+t[0]+(l/4294967296>>>0)>>>0,b[L][1]=l>>>0;q=a[0][0];t=a[0][1];w=a[1][0];y=a[1][1];z=a[2][0];A=a[2][1];B=a[3][0];E=a[3][1];C=a[4][0];D=a[4][1];F=a[5][0];G=a[5][1];T=a[6][0];V=a[6][1];W=a[7][0];Y=a[7][1];for(L=0;80>L;++L)d=((C>>>14|D<<18)^(C>>>18|D<<14)^(D>>>9|C<<23))>>>0,l=((C<<18|D>>>14)^(C<<14|D>>>18)^
|
816
|
+
(D<<23|C>>>9))>>>0,e=(T^C&(F^T))>>>0,n=(V^D&(G^V))>>>0,h=((q>>>28|t<<4)^(t>>>2|q<<30)^(t>>>7|q<<25))>>>0,k=((q<<4|t>>>28)^(t<<30|q>>>2)^(t<<25|q>>>7))>>>0,m=(q&w|z&(q^w))>>>0,p=(t&y|A&(t^y))>>>0,l=Y+l+n+f[L][1]+b[L][1],d=W+d+e+f[L][0]+b[L][0]+(l/4294967296>>>0)>>>0,e=l>>>0,l=k+p,h=h+m+(l/4294967296>>>0)>>>0,k=l>>>0,W=T,Y=V,T=F,V=G,F=C,G=D,l=E+e,C=B+d+(l/4294967296>>>0)>>>0,D=l>>>0,B=z,E=A,z=w,A=y,w=q,y=t,l=e+k,q=d+h+(l/4294967296>>>0)>>>0,t=l>>>0;l=a[0][1]+t;a[0][0]=a[0][0]+q+(l/4294967296>>>0)>>>
|
817
|
+
0;a[0][1]=l>>>0;l=a[1][1]+y;a[1][0]=a[1][0]+w+(l/4294967296>>>0)>>>0;a[1][1]=l>>>0;l=a[2][1]+A;a[2][0]=a[2][0]+z+(l/4294967296>>>0)>>>0;a[2][1]=l>>>0;l=a[3][1]+E;a[3][0]=a[3][0]+B+(l/4294967296>>>0)>>>0;a[3][1]=l>>>0;l=a[4][1]+D;a[4][0]=a[4][0]+C+(l/4294967296>>>0)>>>0;a[4][1]=l>>>0;l=a[5][1]+G;a[5][0]=a[5][0]+F+(l/4294967296>>>0)>>>0;a[5][1]=l>>>0;l=a[6][1]+V;a[6][0]=a[6][0]+T+(l/4294967296>>>0)>>>0;a[6][1]=l>>>0;l=a[7][1]+Y;a[7][0]=a[7][0]+W+(l/4294967296>>>0)>>>0;a[7][1]=l>>>0;J-=128}}var c=a.exports=
|
818
|
+
k.sha512=k.sha512||{};k.md.sha512=k.md.algorithms.sha512=c;a=k.sha384=k.sha512.sha384=k.sha512.sha384||{};a.create=function(){return c.create("SHA-384")};k.md.sha384=k.md.algorithms.sha384=a;k.sha512.sha256=k.sha512.sha256||{create:function(){return c.create("SHA-512/256")}};k.md["sha512/256"]=k.md.algorithms["sha512/256"]=k.sha512.sha256;k.sha512.sha224=k.sha512.sha224||{create:function(){return c.create("SHA-512/224")}};k.md["sha512/224"]=k.md.algorithms["sha512/224"]=k.sha512.sha224;c.create=function(a){e||
|
819
|
+
(d=String.fromCharCode(128),d+=k.util.fillString(String.fromCharCode(0),128),f=[[1116352408,3609767458],[1899447441,602891725],[3049323471,3964484399],[3921009573,2173295548],[961987163,4081628472],[1508970993,3053834265],[2453635748,2937671579],[2870763221,3664609560],[3624381080,2734883394],[310598401,1164996542],[607225278,1323610764],[1426881987,3590304994],[1925078388,4068182383],[2162078206,991336113],[2614888103,633803317],[3248222580,3479774868],[3835390401,2666613458],[4022224774,944711139],
|
820
|
+
[264347078,2341262773],[604807628,2007800933],[770255983,1495990901],[1249150122,1856431235],[1555081692,3175218132],[1996064986,2198950837],[2554220882,3999719339],[2821834349,766784016],[2952996808,2566594879],[3210313671,3203337956],[3336571891,1034457026],[3584528711,2466948901],[113926993,3758326383],[338241895,168717936],[666307205,1188179964],[773529912,1546045734],[1294757372,1522805485],[1396182291,2643833823],[1695183700,2343527390],[1986661051,1014477480],[2177026350,1206759142],[2456956037,
|
821
|
+
344077627],[2730485921,1290863460],[2820302411,3158454273],[3259730800,3505952657],[3345764771,106217008],[3516065817,3606008344],[3600352804,1432725776],[4094571909,1467031594],[275423344,851169720],[430227734,3100823752],[506948616,1363258195],[659060556,3750685593],[883997877,3785050280],[958139571,3318307427],[1322822218,3812723403],[1537002063,2003034995],[1747873779,3602036899],[1955562222,1575990012],[2024104815,1125592928],[2227730452,2716904306],[2361852424,442776044],[2428436474,593698344],
|
822
|
+
[2756734187,3733110249],[3204031479,2999351573],[3329325298,3815920427],[3391569614,3928383900],[3515267271,566280711],[3940187606,3454069534],[4118630271,4000239992],[116418474,1914138554],[174292421,2731055270],[289380356,3203993006],[460393269,320620315],[685471733,587496836],[852142971,1086792851],[1017036298,365543100],[1126000580,2618297676],[1288033470,3409855158],[1501505948,4234509866],[1607167915,987167468],[1816402316,1246189591]],h={"SHA-512":[[1779033703,4089235720],[3144134277,2227873595],
|
823
|
+
[1013904242,4271175723],[2773480762,1595750129],[1359893119,2917565137],[2600822924,725511199],[528734635,4215389547],[1541459225,327033209]],"SHA-384":[[3418070365,3238371032],[1654270250,914150663],[2438529370,812702999],[355462360,4144912697],[1731405415,4290775857],[2394180231,1750603025],[3675008525,1694076839],[1203062813,3204075428]],"SHA-512/256":[[573645204,4230739756],[2673172387,3360449730],[596883563,1867755857],[2520282905,1497426621],[2519219938,2827943907],[3193839141,1401305490],[721525244,
|
824
|
+
746961066],[246885852,2177182882]],"SHA-512/224":[[2352822216,424955298],[1944164710,2312950998],[502970286,855612546],[1738396948,1479516111],[258812777,2077511080],[2011393907,79989058],[1067287976,1780299464],[286451373,2446758561]]},e=!0);"undefined"===typeof a&&(a="SHA-512");if(!(a in h))throw Error("Invalid SHA-512 algorithm: "+a);for(var c=h[a],n=null,m=k.util.createBuffer(),p=Array(80),q=0;80>q;++q)p[q]=Array(2);q=64;switch(a){case "SHA-384":q=48;break;case "SHA-512/256":q=32;break;case "SHA-512/224":q=
|
825
|
+
28}var u={algorithm:a.replace("-","").toLowerCase(),blockLength:128,digestLength:q,messageLength:0,fullMessageLength:null,messageLengthSize:16,start:function(){u.messageLength=0;u.fullMessageLength=u.messageLength128=[];for(var a=u.messageLengthSize/4,b=0;b<a;++b)u.fullMessageLength.push(0);m=k.util.createBuffer();n=Array(c.length);for(b=0;b<c.length;++b)n[b]=c[b].slice(0);return u}};u.start();u.update=function(a,c){"utf8"===c&&(a=k.util.encodeUtf8(a));c=a.length;u.messageLength+=c;c=[c/4294967296>>>
|
826
|
+
0,c>>>0];for(var d=u.fullMessageLength.length-1;0<=d;--d)u.fullMessageLength[d]+=c[1],c[1]=c[0]+(u.fullMessageLength[d]/4294967296>>>0),u.fullMessageLength[d]>>>=0,c[0]=c[1]/4294967296>>>0;m.putBytes(a);b(n,p,m);(2048<m.read||0===m.length())&&m.compact();return u};u.digest=function(){var c=k.util.createBuffer();c.putBytes(m.bytes());c.putBytes(d.substr(0,u.blockLength-(u.fullMessageLength[u.fullMessageLength.length-1]+u.messageLengthSize&u.blockLength-1)));for(var e,f,h=8*u.fullMessageLength[0],l=
|
827
|
+
0;l<u.fullMessageLength.length-1;++l)e=8*u.fullMessageLength[l+1],f=e/4294967296>>>0,h+=f,c.putInt32(h>>>0),h=e>>>0;c.putInt32(h);e=Array(n.length);for(l=0;l<n.length;++l)e[l]=n[l].slice(0);b(e,p,c);c=k.util.createBuffer();f="SHA-512"===a?e.length:"SHA-384"===a?e.length-2:e.length-4;for(l=0;l<f;++l)c.putInt32(e[l][0]),l===f-1&&"SHA-512/224"===a||c.putInt32(e[l][1]);return c};return u};var d=null,e=!1,f=null,h=null});var na=k.asn1,kq={name:"SubjectPublicKeyInfo",tagClass:na.Class.UNIVERSAL,type:na.Type.SEQUENCE,
|
828
|
+
constructed:!0,captureAsn1:"subjectPublicKeyInfo",value:[{name:"SubjectPublicKeyInfo.AlgorithmIdentifier",tagClass:na.Class.UNIVERSAL,type:na.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:na.Class.UNIVERSAL,type:na.Type.OID,constructed:!1,capture:"publicKeyOid"}]},{tagClass:na.Class.UNIVERSAL,type:na.Type.BITSTRING,constructed:!1,composed:!0,captureBitStringValue:"ed25519PublicKey"}]},lq={name:"PrivateKeyInfo",tagClass:na.Class.UNIVERSAL,type:na.Type.SEQUENCE,
|
829
|
+
constructed:!0,value:[{name:"PrivateKeyInfo.version",tagClass:na.Class.UNIVERSAL,type:na.Type.INTEGER,constructed:!1,capture:"privateKeyVersion"},{name:"PrivateKeyInfo.privateKeyAlgorithm",tagClass:na.Class.UNIVERSAL,type:na.Type.SEQUENCE,constructed:!0,value:[{name:"AlgorithmIdentifier.algorithm",tagClass:na.Class.UNIVERSAL,type:na.Type.OID,constructed:!1,capture:"privateKeyOid"}]},{name:"PrivateKeyInfo",tagClass:na.Class.UNIVERSAL,type:na.Type.OCTETSTRING,constructed:!1,capture:"privateKey"}]};
|
830
|
+
if("undefined"===typeof mq)var mq=k.jsbn.BigInteger;var Ke=k.util.ByteBuffer,Ga="undefined"===typeof Buffer?Uint8Array:Buffer;k.pki=k.pki||{};k.pki.ed25519=k.ed25519=k.ed25519||{};var D=k.ed25519;D.constants={};D.constants.PUBLIC_KEY_BYTE_LENGTH=32;D.constants.PRIVATE_KEY_BYTE_LENGTH=64;D.constants.SEED_BYTE_LENGTH=32;D.constants.SIGN_BYTE_LENGTH=64;D.constants.HASH_BYTE_LENGTH=64;D.generateKeyPair=function(a){a=a||{};var b=a.seed;if(void 0===b)b=k.random.getBytesSync(D.constants.SEED_BYTE_LENGTH);
|
831
|
+
else if("string"===typeof b){if(b.length!==D.constants.SEED_BYTE_LENGTH)throw new TypeError('"seed" must be '+D.constants.SEED_BYTE_LENGTH+" bytes in length.");}else if(!(b instanceof Uint8Array))throw new TypeError('"seed" must be a node.js Buffer, Uint8Array, or a binary string.');b=qb({message:b,encoding:"binary"});a=new Ga(D.constants.PUBLIC_KEY_BYTE_LENGTH);for(var c=new Ga(D.constants.PRIVATE_KEY_BYTE_LENGTH),d=0;32>d;++d)c[d]=b[d];b=[E(),E(),E(),E()];d=Kc(c,32);d[0]&=248;d[31]&=127;d[31]|=
|
832
|
+
64;Se(b,d);Oe(a,b);for(b=0;32>b;++b)c[b+32]=a[b];return{publicKey:a,privateKey:c}};D.privateKeyFromAsn1=function(a){var b={},c=[];if(!k.asn1.validate(a,lq,b,c))throw b=Error("Invalid Key."),b.errors=c,b;c=k.asn1.derToOid(b.privateKeyOid);a=k.oids.EdDSA25519;if(c!==a)throw Error('Invalid OID "'+c+'"; OID must be "'+a+'".');return{privateKeyBytes:qb({message:k.asn1.fromDer(b.privateKey).value,encoding:"binary"})}};D.publicKeyFromAsn1=function(a){var b={},c=[];if(!k.asn1.validate(a,kq,b,c))throw b=Error("Invalid Key."),
|
833
|
+
b.errors=c,b;c=k.asn1.derToOid(b.publicKeyOid);a=k.oids.EdDSA25519;if(c!==a)throw Error('Invalid OID "'+c+'"; OID must be "'+a+'".');b=b.ed25519PublicKey;if(b.length!==D.constants.PUBLIC_KEY_BYTE_LENGTH)throw Error("Key length is invalid.");return qb({message:b,encoding:"binary"})};D.publicKeyFromPrivateKey=function(a){a=a||{};a=qb({message:a.privateKey,encoding:"binary"});if(a.length!==D.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+D.constants.PRIVATE_KEY_BYTE_LENGTH);
|
834
|
+
for(var b=new Ga(D.constants.PUBLIC_KEY_BYTE_LENGTH),c=0;c<b.length;++c)b[c]=a[32+c];return b};D.sign=function(a){a=a||{};var b=qb(a),c=qb({message:a.privateKey,encoding:"binary"});if(c.length===D.constants.SEED_BYTE_LENGTH)c=D.generateKeyPair({seed:c}).privateKey;else if(c.length!==D.constants.PRIVATE_KEY_BYTE_LENGTH)throw new TypeError('"options.privateKey" must have a byte length of '+D.constants.SEED_BYTE_LENGTH+" or "+D.constants.PRIVATE_KEY_BYTE_LENGTH);a=new Ga(D.constants.SIGN_BYTE_LENGTH+
|
835
|
+
b.length);var d=b.length,e=c,f=new Float64Array(64),h=[E(),E(),E(),E()],k=Kc(e,32);k[0]&=248;k[31]&=127;k[31]|=64;for(c=0;c<d;++c)a[64+c]=b[c];for(c=0;32>c;++c)a[32+c]=k[32+c];b=Kc(a.subarray(32),d+32);Me(b);Se(h,b);Oe(a,h);for(c=32;64>c;++c)a[c]=e[c];d=Kc(a,d+64);Me(d);for(c=32;64>c;++c)f[c]=0;for(c=0;32>c;++c)f[c]=b[c];for(c=0;32>c;++c)for(b=0;32>b;b++)f[c+b]+=d[c]*k[b];fh(a.subarray(32),f);c=new Ga(D.constants.SIGN_BYTE_LENGTH);for(f=0;f<c.length;++f)c[f]=a[f];return c};D.verify=function(a){a=
|
836
|
+
a||{};var b=qb(a);if(void 0===a.signature)throw new TypeError('"options.signature" must be a node.js Buffer, a Uint8Array, a forge ByteBuffer, or a binary string.');var c=qb({message:a.signature,encoding:"binary"});if(c.length!==D.constants.SIGN_BYTE_LENGTH)throw new TypeError('"options.signature" must have a byte length of '+D.constants.SIGN_BYTE_LENGTH);var d=qb({message:a.publicKey,encoding:"binary"});if(d.length!==D.constants.PUBLIC_KEY_BYTE_LENGTH)throw new TypeError('"options.publicKey" must have a byte length of '+
|
837
|
+
D.constants.PUBLIC_KEY_BYTE_LENGTH);a=new Ga(D.constants.SIGN_BYTE_LENGTH+b.length);var e=new Ga(D.constants.SIGN_BYTE_LENGTH+b.length),f;for(f=0;f<D.constants.SIGN_BYTE_LENGTH;++f)a[f]=c[f];for(f=0;f<b.length;++f)a[f+D.constants.SIGN_BYTE_LENGTH]=b[f];b=a.length;c=new Ga(32);f=[E(),E(),E(),E()];var h=[E(),E(),E(),E()];if(64>b)a=-1;else{var k=E();var l=E();var n=E(),p=E(),q=E(),x=E(),u=E();Bb(h[2],Gd);var v=h[1],t;for(t=0;16>t;++t)v[t]=d[2*t]+(d[2*t+1]<<8);v[15]&=32767;v=h[1];P(n,v,v);P(p,n,nq);lc(n,
|
838
|
+
n,h[2]);mc(p,h[2],p);P(q,p,p);P(x,q,q);P(u,x,q);P(k,u,n);P(k,k,p);q=E();for(x=0;16>x;++x)q[x]=k[x];for(x=250;0<=x;--x)P(q,q,q),1!==x&&P(q,q,k);for(x=0;16>x;++x)k[x]=q[x];P(k,k,n);P(k,k,p);P(k,k,p);P(h[0],k,p);k=h[0];P(l,k,k);P(l,l,p);hh(l,n)&&P(h[0],h[0],oq);k=h[0];P(l,k,k);P(l,l,p);hh(l,n)?l=-1:(gh(h[0])===d[31]>>7&&lc(h[0],Re,h[0]),P(h[3],h[0],h[1]),l=0);if(l)a=-1;else{for(l=0;l<b;++l)e[l]=a[l];for(l=0;32>l;++l)e[l+32]=d[l];d=Kc(e,b);Me(d);jh(f,h,d);Se(h,a.subarray(32));Ne(f,h);Oe(c,f);b-=64;if(ih(a,
|
839
|
+
0,c,0)){for(l=0;l<b;++l)e[l]=0;a=-1}else{for(l=0;l<b;++l)e[l]=a[l+64];a=b}}}return 0<=a};var Re=E(),Gd=E([1]),nq=E([30883,4953,19914,30187,55467,16705,2637,112,59544,30585,16505,36039,65139,11119,27886,20995]),Fl=E([61785,9906,39828,60374,45398,33411,5274,224,53552,61171,33010,6542,64743,22239,55772,9222]),kh=E([54554,36645,11616,51542,42930,38181,51040,26924,56412,64982,57905,49316,21502,52590,14035,8553]),lh=E([26200,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,26214,
|
840
|
+
26214,26214]),Le=new Float64Array([237,211,245,92,26,99,18,88,214,156,247,162,222,249,222,20,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,16]),oq=E([41136,18958,6951,50414,58488,44335,6150,12099,55207,15867,153,11085,57099,20417,9344,11139]);k.kem=k.kem||{};var tk=k.jsbn.BigInteger;k.kem.rsa={};k.kem.rsa.create=function(a,b){b=b||{};var c=b.prng||k.random;return{encrypt:function(b,e){var d=Math.ceil(b.n.bitLength()/8);do var h=(new tk(k.util.bytesToHex(c.getBytesSync(d)),16)).mod(b.n);while(0>=h.compareTo(tk.ONE));
|
841
|
+
h=k.util.hexToBytes(h.toString(16));d-=h.length;0<d&&(h=k.util.fillString(String.fromCharCode(0),d)+h);b=b.encrypt(h,"NONE");e=a.generate(h,e);return{encapsulation:b,key:e}},decrypt:function(b,c,f){b=b.decrypt(c,"NONE");return a.generate(b,f)}}};k.kem.kdf1=function(a,b){nh(this,a,0,b||a.digestLength)};k.kem.kdf2=function(a,b){nh(this,a,1,b||a.digestLength)};k.log=k.log||{};k.log.levels="none error warning info debug verbose max".split(" ");var te={},hg=[],id=null;k.log.LEVEL_LOCKED=2;k.log.NO_LEVEL_CHECK=
|
842
|
+
4;k.log.INTERPOLATE=8;for(var Ib=0;Ib<k.log.levels.length;++Ib){var uk=k.log.levels[Ib];te[uk]={index:Ib,name:uk.toUpperCase()}}k.log.logMessage=function(a){for(var b=te[a.level].index,c=0;c<hg.length;++c){var d=hg[c];d.flags&k.log.NO_LEVEL_CHECK?d.f(a):b<=te[d.level].index&&d.f(d,a)}};k.log.prepareStandard=function(a){"standard"in a||(a.standard=te[a.level].name+" ["+a.category+"] "+a.message)};k.log.prepareFull=function(a){if(!("full"in a)){var b=[a.message];b=b.concat([]);a.full=k.util.format.apply(this,
|
843
|
+
b)}};k.log.prepareStandardFull=function(a){"standardFull"in a||(k.log.prepareStandard(a),a.standardFull=a.standard)};var vk=["error","warning","info","debug","verbose"];for(Ib=0;Ib<vk.length;++Ib)(function(a){k.log[a]=function(b,c){var d=Array.prototype.slice.call(arguments).slice(2);k.log.logMessage({timestamp:new Date,level:a,category:b,message:c,arguments:d})}})(vk[Ib]);k.log.makeLogger=function(a){a={flags:0,f:a};k.log.setLevel(a,"none");return a};k.log.setLevel=function(a,b){var c=!1;if(a&&!(a.flags&
|
844
|
+
k.log.LEVEL_LOCKED))for(var d=0;d<k.log.levels.length;++d)if(b==k.log.levels[d]){a.level=b;c=!0;break}return c};k.log.lock=function(a,b){a.flags="undefined"===typeof b||b?a.flags|k.log.LEVEL_LOCKED:a.flags&~k.log.LEVEL_LOCKED};k.log.addLogger=function(a){hg.push(a)};if("undefined"!==typeof console&&"log"in console){if(console.error&&console.warn&&console.info&&console.debug)var pq={error:console.error,warning:console.warn,info:console.info,debug:console.debug,verbose:console.debug},wk=function(a,
|
845
|
+
b){k.log.prepareStandard(b);a=pq[b.level];var c=[b.standard];c=c.concat(b.arguments.slice());a.apply(console,c)};else wk=function(a,b){k.log.prepareStandardFull(b);console.log(b.standardFull)};var ig=k.log.makeLogger(wk);k.log.setLevel(ig,"debug");k.log.addLogger(ig);id=ig}else console={log:function(){}};if(null!==id){var ue=k.util.getQueryVariables();"console.level"in ue&&k.log.setLevel(id,ue["console.level"].slice(-1)[0]);"console.lock"in ue&&"true"==ue["console.lock"].slice(-1)[0]&&k.log.lock(id)}k.log.consoleLogger=
|
846
|
+
id;C(function(a){function b(a){var b={},c=[];if(!n.validate(a,p.asn1.recipientInfoValidator,b,c))throw a=Error("Cannot read PKCS#7 RecipientInfo. ASN.1 object is not an PKCS#7 RecipientInfo."),a.errors=c,a;return{version:b.version.charCodeAt(0),issuer:k.pki.RDNAttributesAsArray(b.issuer),serialNumber:k.util.createBuffer(b.serial).toHex(),encryptedContent:{algorithm:n.derToOid(b.encAlgorithm),parameter:b.encParameter.value,content:b.encKey}}}function c(a){return n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,
|
847
|
+
!0,[n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,n.integerToDer(a.version).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[k.pki.distinguishedNameToAsn1({attributes:a.issuer}),n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,k.util.hexToBytes(a.serialNumber))]),n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(a.encryptedContent.algorithm).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.NULL,!1,"")]),n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,
|
848
|
+
!1,a.encryptedContent.content)])}function d(a){for(var b=[],d=0;d<a.length;++d)b.push(c(a[d]));return b}function e(a){var b=n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,n.integerToDer(a.version).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[k.pki.distinguishedNameToAsn1({attributes:a.issuer}),n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,k.util.hexToBytes(a.serialNumber))]),n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,
|
849
|
+
n.Type.OID,!1,n.oidToDer(a.digestAlgorithm).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.NULL,!1,"")])]);a.authenticatedAttributesAsn1&&b.value.push(a.authenticatedAttributesAsn1);b.value.push(n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(a.signatureAlgorithm).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.NULL,!1,"")]));b.value.push(n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,a.signature));if(0<a.unauthenticatedAttributes.length){for(var c=
|
850
|
+
n.create(n.Class.CONTEXT_SPECIFIC,1,!0,[]),d=0;d<a.unauthenticatedAttributes.length;++d)c.values.push(f(a.unauthenticatedAttributes[d]));b.value.push(c)}return b}function f(a){if(a.type===k.pki.oids.contentType)var b=n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(a.value).getBytes());else if(a.type===k.pki.oids.messageDigest)b=n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,a.value.bytes());else if(a.type===k.pki.oids.signingTime){b=new Date("1950-01-01T00:00:00Z");var c=new Date("2050-01-01T00:00:00Z"),
|
851
|
+
d=a.value;if("string"===typeof d){var e=Date.parse(d);d=isNaN(e)?13===d.length?n.utcTimeToDate(d):n.generalizedTimeToDate(d):new Date(e)}b=d>=b&&d<c?n.create(n.Class.UNIVERSAL,n.Type.UTCTIME,!1,n.dateToUtcTime(d)):n.create(n.Class.UNIVERSAL,n.Type.GENERALIZEDTIME,!1,n.dateToGeneralizedTime(d))}return n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(a.type).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.SET,!0,[b])])}function h(a){return[n.create(n.Class.UNIVERSAL,
|
852
|
+
n.Type.OID,!1,n.oidToDer(k.pki.oids.data).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(a.algorithm).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,a.parameter.getBytes())]),n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,a.content.getBytes())])]}function m(a,b,c){var d={};if(!n.validate(b,c,d,[]))throw a=Error("Cannot read PKCS#7 message. ASN.1 object is not a supported PKCS#7 message."),
|
853
|
+
a.errors=a,a;if(n.derToOid(d.contentType)!==k.pki.oids.data)throw Error("Unsupported PKCS#7 message. Only wrapped ContentType Data supported.");if(d.encryptedContent){b="";if(k.util.isArray(d.encryptedContent))for(c=0;c<d.encryptedContent.length;++c){if(d.encryptedContent[c].type!==n.Type.OCTETSTRING)throw Error("Malformed PKCS#7 message, expecting encrypted content constructed of only OCTET STRING objects.");b+=d.encryptedContent[c].value}else b=d.encryptedContent;a.encryptedContent={algorithm:n.derToOid(d.encAlgorithm),
|
854
|
+
parameter:k.util.createBuffer(d.encParameter.value),content:k.util.createBuffer(b)}}if(d.content){b="";if(k.util.isArray(d.content))for(c=0;c<d.content.length;++c){if(d.content[c].type!==n.Type.OCTETSTRING)throw Error("Malformed PKCS#7 message, expecting content constructed of only OCTET STRING objects.");b+=d.content[c].value}else b=d.content;a.content=k.util.createBuffer(b)}a.version=d.version.charCodeAt(0);return a.rawCapture=d}function l(a){if(void 0===a.encryptedContent.key)throw Error("Symmetric key not available.");
|
855
|
+
if(void 0===a.content){switch(a.encryptedContent.algorithm){case k.pki.oids["aes128-CBC"]:case k.pki.oids["aes192-CBC"]:case k.pki.oids["aes256-CBC"]:var b=k.aes.createDecryptionCipher(a.encryptedContent.key);break;case k.pki.oids.desCBC:case k.pki.oids["des-EDE3-CBC"]:b=k.des.createDecryptionCipher(a.encryptedContent.key);break;default:throw Error("Unsupported symmetric cipher, OID "+a.encryptedContent.algorithm);}b.start(a.encryptedContent.parameter);b.update(a.encryptedContent.content);if(!b.finish())throw Error("Symmetric decryption failed.");
|
856
|
+
a.content=b.output}}var n=k.asn1,p=a.exports=k.pkcs7=k.pkcs7||{};p.messageFromPem=function(a){a=k.pem.decode(a)[0];if("PKCS7"!==a.type){var b=Error('Could not convert PKCS#7 message from PEM; PEM header type is not "PKCS#7".');b.headerType=a.type;throw b;}if(a.procType&&"ENCRYPTED"===a.procType.type)throw Error("Could not convert PKCS#7 message from PEM; PEM is encrypted.");a=n.fromDer(a.body);return p.messageFromAsn1(a)};p.messageToPem=function(a,b){a={type:"PKCS7",body:n.toDer(a.toAsn1()).getBytes()};
|
857
|
+
return k.pem.encode(a,{maxline:b})};p.messageFromAsn1=function(a){var b={},c=[];if(!n.validate(a,p.asn1.contentInfoValidator,b,c))throw b=Error("Cannot read PKCS#7 message. ASN.1 object is not an PKCS#7 ContentInfo."),b.errors=c,b;c=n.derToOid(b.contentType);switch(c){case k.pki.oids.envelopedData:c=p.createEnvelopedData();break;case k.pki.oids.encryptedData:c=p.createEncryptedData();break;case k.pki.oids.signedData:c=p.createSignedData();break;default:throw Error("Cannot read PKCS#7 message. ContentType with OID "+
|
858
|
+
c+" is not (yet) supported.");}c.fromAsn1(b.content.value[0]);return c};p.createSignedData=function(){var a=null;return a={type:k.pki.oids.signedData,version:1,certificates:[],crls:[],signers:[],digestAlgorithmIdentifiers:[],contentInfo:null,signerInfos:[],fromAsn1:function(b){m(a,b,p.asn1.signedDataValidator);a.certificates=[];a.crls=[];a.digestAlgorithmIdentifiers=[];a.contentInfo=null;a.signerInfos=[];if(a.rawCapture.certificates){b=a.rawCapture.certificates.value;for(var c=0;c<b.length;++c)a.certificates.push(k.pki.certificateFromAsn1(b[c]))}},
|
859
|
+
toAsn1:function(){a.contentInfo||a.sign();for(var b=[],c=0;c<a.certificates.length;++c)b.push(k.pki.certificateToAsn1(a.certificates[c]));c=[];var d=n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,n.integerToDer(a.version).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.SET,!0,a.digestAlgorithmIdentifiers),a.contentInfo])]);0<b.length&&d.value[0].value.push(n.create(n.Class.CONTEXT_SPECIFIC,0,!0,b));0<c.length&&d.value[0].value.push(n.create(n.Class.CONTEXT_SPECIFIC,
|
860
|
+
1,!0,c));d.value[0].value.push(n.create(n.Class.UNIVERSAL,n.Type.SET,!0,a.signerInfos));return n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(a.type).getBytes()),d])},addSigner:function(b){var c=b.issuer,d=b.serialNumber;b.certificate&&(d=b.certificate,"string"===typeof d&&(d=k.pki.certificateFromPem(d)),c=d.issuer.attributes,d=d.serialNumber);var e=b.key;if(!e)throw Error("Could not add PKCS#7 signer; no private key specified.");"string"===typeof e&&
|
861
|
+
(e=k.pki.privateKeyFromPem(e));var f=b.digestAlgorithm||k.pki.oids.sha1;switch(f){case k.pki.oids.sha1:case k.pki.oids.sha256:case k.pki.oids.sha384:case k.pki.oids.sha512:case k.pki.oids.md5:break;default:throw Error("Could not add PKCS#7 signer; unknown message digest algorithm: "+f);}b=b.authenticatedAttributes||[];if(0<b.length){for(var h=!1,l=!1,n=0;n<b.length;++n){var m=b[n];if(!h&&m.type===k.pki.oids.contentType){if(h=!0,l)break}else if(!l&&m.type===k.pki.oids.messageDigest&&(l=!0,h))break}if(!h||
|
862
|
+
!l)throw Error("Invalid signer.authenticatedAttributes. If signer.authenticatedAttributes is specified, then it must contain at least two attributes, PKCS #9 content-type and PKCS #9 message-digest.");}a.signers.push({key:e,version:1,issuer:c,serialNumber:d,digestAlgorithm:f,signatureAlgorithm:k.pki.oids.rsaEncryption,signature:null,authenticatedAttributes:b,unauthenticatedAttributes:[]})},sign:function(b){b=b||{};if("object"!==typeof a.content||null===a.contentInfo)if(a.contentInfo=n.create(n.Class.UNIVERSAL,
|
863
|
+
n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(k.pki.oids.data).getBytes())]),"content"in a){var c;a.content instanceof k.util.ByteBuffer?c=a.content.bytes():"string"===typeof a.content&&(c=k.util.encodeUtf8(a.content));b.detached?a.detachedContent=n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,c):a.contentInfo.value.push(n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[n.create(n.Class.UNIVERSAL,n.Type.OCTETSTRING,!1,c)]))}if(0!==a.signers.length){b={};for(c=0;c<a.signers.length;++c){var d=
|
864
|
+
a.signers[c],h=d.digestAlgorithm;h in b||(b[h]=k.md[k.pki.oids[h]].create());d.md=0===d.authenticatedAttributes.length?b[h]:k.md[k.pki.oids[h]].create()}a.digestAlgorithmIdentifiers=[];for(h in b)a.digestAlgorithmIdentifiers.push(n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(h).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.NULL,!1,"")]));a.detachedContent?c=a.detachedContent:(c=a.contentInfo.value[1],c=c.value[0]);if(!c)throw Error("Could not sign PKCS#7 message; there is no content to sign.");
|
865
|
+
h=n.derToOid(a.contentInfo.value[0].value);var l=n.toDer(c);l.getByte();n.getBerValueLength(l);l=l.getBytes();for(var m in b)b[m].start().update(l);m=new Date;for(c=0;c<a.signers.length;++c){d=a.signers[c];if(0===d.authenticatedAttributes.length){if(h!==k.pki.oids.data)throw Error("Invalid signer; authenticatedAttributes must be present when the ContentInfo content type is not PKCS#7 Data.");}else{d.authenticatedAttributesAsn1=n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[]);l=n.create(n.Class.UNIVERSAL,
|
866
|
+
n.Type.SET,!0,[]);for(var p=0;p<d.authenticatedAttributes.length;++p){var q=d.authenticatedAttributes[p];q.type===k.pki.oids.messageDigest?q.value=b[d.digestAlgorithm].digest():q.type!==k.pki.oids.signingTime||q.value||(q.value=m);l.value.push(f(q));d.authenticatedAttributesAsn1.value.push(f(q))}l=n.toDer(l).getBytes();d.md.start().update(l)}d.signature=d.key.sign(d.md,"RSASSA-PKCS1-V1_5")}b=a;h=a.signers;m=[];for(c=0;c<h.length;++c)m.push(e(h[c]));b.signerInfos=m}},verify:function(){throw Error("PKCS#7 signature verification not yet implemented.");
|
867
|
+
},addCertificate:function(b){"string"===typeof b&&(b=k.pki.certificateFromPem(b));a.certificates.push(b)},addCertificateRevokationList:function(a){throw Error("PKCS#7 CRL support not yet implemented.");}}};p.createEncryptedData=function(){var a=null;return a={type:k.pki.oids.encryptedData,version:0,encryptedContent:{algorithm:k.pki.oids["aes256-CBC"]},fromAsn1:function(b){m(a,b,p.asn1.encryptedDataValidator)},decrypt:function(b){void 0!==b&&(a.encryptedContent.key=b);l(a)}}};p.createEnvelopedData=
|
868
|
+
function(){var a=null;return a={type:k.pki.oids.envelopedData,version:0,recipients:[],encryptedContent:{algorithm:k.pki.oids["aes256-CBC"]},fromAsn1:function(c){var d=m(a,c,p.asn1.envelopedDataValidator);c=a;d=d.recipientInfos.value;for(var e=[],f=0;f<d.length;++f)e.push(b(d[f]));c.recipients=e},toAsn1:function(){return n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.OID,!1,n.oidToDer(a.type).getBytes()),n.create(n.Class.CONTEXT_SPECIFIC,0,!0,[n.create(n.Class.UNIVERSAL,
|
869
|
+
n.Type.SEQUENCE,!0,[n.create(n.Class.UNIVERSAL,n.Type.INTEGER,!1,n.integerToDer(a.version).getBytes()),n.create(n.Class.UNIVERSAL,n.Type.SET,!0,d(a.recipients)),n.create(n.Class.UNIVERSAL,n.Type.SEQUENCE,!0,h(a.encryptedContent))])])])},findRecipient:function(b){for(var c=b.issuer.attributes,d=0;d<a.recipients.length;++d){var e=a.recipients[d],f=e.issuer;if(e.serialNumber===b.serialNumber&&f.length===c.length){for(var h=!0,k=0;k<c.length;++k)if(f[k].type!==c[k].type||f[k].value!==c[k].value){h=!1;
|
870
|
+
break}if(h)return e}}return null},decrypt:function(b,c){if(void 0===a.encryptedContent.key&&void 0!==b&&void 0!==c)switch(b.encryptedContent.algorithm){case k.pki.oids.rsaEncryption:case k.pki.oids.desCBC:b=c.decrypt(b.encryptedContent.content);a.encryptedContent.key=k.util.createBuffer(b);break;default:throw Error("Unsupported asymmetric cipher, OID "+b.encryptedContent.algorithm);}l(a)},addRecipient:function(b){a.recipients.push({version:0,issuer:b.issuer.attributes,serialNumber:b.serialNumber,
|
871
|
+
encryptedContent:{algorithm:k.pki.oids.rsaEncryption,key:b.publicKey}})},encrypt:function(b,c){if(void 0===a.encryptedContent.content){c=c||a.encryptedContent.algorithm;b=b||a.encryptedContent.key;var d;switch(c){case k.pki.oids["aes128-CBC"]:var e=d=16;var f=k.aes.createEncryptionCipher;break;case k.pki.oids["aes192-CBC"]:d=24;e=16;f=k.aes.createEncryptionCipher;break;case k.pki.oids["aes256-CBC"]:d=32;e=16;f=k.aes.createEncryptionCipher;break;case k.pki.oids["des-EDE3-CBC"]:d=24;e=8;f=k.des.createEncryptionCipher;
|
872
|
+
break;default:throw Error("Unsupported symmetric cipher, OID "+c);}if(void 0===b)b=k.util.createBuffer(k.random.getBytes(d));else if(b.length()!=d)throw Error("Symmetric key has wrong length; got "+b.length()+" bytes, expected "+d+".");a.encryptedContent.algorithm=c;a.encryptedContent.key=b;a.encryptedContent.parameter=k.util.createBuffer(k.random.getBytes(e));b=f(b);b.start(a.encryptedContent.parameter.copy());b.update(a.content);if(!b.finish())throw Error("Symmetric encryption failed.");a.encryptedContent.content=
|
873
|
+
b.output}for(b=0;b<a.recipients.length;++b)if(c=a.recipients[b],void 0===c.encryptedContent.content)switch(c.encryptedContent.algorithm){case k.pki.oids.rsaEncryption:c.encryptedContent.content=c.encryptedContent.key.encrypt(a.encryptedContent.key.data);break;default:throw Error("Unsupported asymmetric cipher, OID "+c.encryptedContent.algorithm);}}}}});C(function(a){function b(a,b){b=b.toString(16);"8"<=b[0]&&(b="00"+b);b=k.util.hexToBytes(b);a.putInt32(b.length);a.putBytes(b)}function c(a,b){a.putInt32(b.length);
|
874
|
+
a.putString(b)}function d(){for(var a=k.md.sha1.create(),b=arguments.length,c=0;c<b;++c)a.update(arguments[c]);return a.digest()}a=a.exports=k.ssh=k.ssh||{};a.privateKeyToPutty=function(a,f,h){h=h||"";f=f||"";var e=""===f?"none":"aes256-cbc";var l="PuTTY-User-Key-File-2: ssh-rsa\r\nEncryption: "+(e+"\r\nComment: ")+(h+"\r\n");var n=k.util.createBuffer();c(n,"ssh-rsa");b(n,a.e);b(n,a.n);var p=k.util.encode64(n.bytes(),64),q=Math.floor(p.length/66)+1;l+="Public-Lines: "+q+"\r\n";l+=p;p=k.util.createBuffer();
|
875
|
+
b(p,a.d);b(p,a.p);b(p,a.q);b(p,a.qInv);f?(q=p.length()+16-1,q-=q%16,a=d(p.bytes()),a.truncate(a.length()-q+p.length()),p.putBuffer(a),q=k.util.createBuffer(),q.putBuffer(d("\x00\x00\x00\x00",f)),q.putBuffer(d("\x00\x00\x00\u0001",f)),q=k.aes.createEncryptionCipher(q.truncate(8),"CBC"),q.start(k.util.createBuffer().fillWithByte(0,16)),q.update(p.copy()),q.finish(),q=q.output,q.truncate(16),a=k.util.encode64(q.bytes(),64)):a=k.util.encode64(p.bytes(),64);q=Math.floor(a.length/66)+1;l+="\r\nPrivate-Lines: "+
|
876
|
+
q+"\r\n";l+=a;f=d("putty-private-key-file-mac-key",f);q=k.util.createBuffer();c(q,"ssh-rsa");c(q,e);c(q,h);q.putInt32(n.length());q.putBuffer(n);q.putInt32(p.length());q.putBuffer(p);h=k.hmac.create();h.start("sha1",f);h.update(q.bytes());return l+="\r\nPrivate-MAC: "+h.digest().toHex()+"\r\n"};a.publicKeyToOpenSSH=function(a,d){d=d||"";var e=k.util.createBuffer();c(e,"ssh-rsa");b(e,a.e);b(e,a.n);return"ssh-rsa "+k.util.encode64(e.bytes())+" "+d};a.privateKeyToOpenSSH=function(a,b){return b?k.pki.encryptRsaPrivateKey(a,
|
877
|
+
b,{legacy:!0,algorithm:"aes128"}):k.pki.privateKeyToPem(a)};a.getPublicKeyFingerprint=function(a,d){d=d||{};var e=d.md||k.md.md5.create(),f=k.util.createBuffer();c(f,"ssh-rsa");b(f,a.e);b(f,a.n);e.start();e.update(f.getBytes());a=e.digest();if("hex"===d.encoding)return a=a.toHex(),d.delimiter?a.match(/.{2}/g).join(d.delimiter):a;if("binary"===d.encoding)return a.getBytes();if(d.encoding)throw Error('Unknown encoding "'+d.encoding+'".');return a}});var jg={},qq=0;k.debug.set("forge.task","tasks",jg);
|
878
|
+
var Ea={};k.debug.set("forge.task","queues",Ea);var A={ready:{}};A.ready.stop="ready";A.ready.start="running";A.ready.cancel="done";A.ready.fail="error";A.running={};A.running.stop="ready";A.running.start="running";A.running.block="blocked";A.running.unblock="running";A.running.sleep="sleeping";A.running.wakeup="running";A.running.cancel="done";A.running.fail="error";A.blocked={};A.blocked.stop="blocked";A.blocked.start="blocked";A.blocked.block="blocked";A.blocked.unblock="blocked";A.blocked.sleep=
|
879
|
+
"blocked";A.blocked.wakeup="blocked";A.blocked.cancel="done";A.blocked.fail="error";A.sleeping={};A.sleeping.stop="sleeping";A.sleeping.start="sleeping";A.sleeping.block="sleeping";A.sleeping.unblock="sleeping";A.sleeping.sleep="sleeping";A.sleeping.wakeup="sleeping";A.sleeping.cancel="done";A.sleeping.fail="error";A.done={};A.done.stop="done";A.done.start="done";A.done.block="done";A.done.unblock="done";A.done.sleep="done";A.done.wakeup="done";A.done.cancel="done";A.done.fail="error";A.error={};
|
880
|
+
A.error.stop="error";A.error.start="error";A.error.block="error";A.error.unblock="error";A.error.sleep="error";A.error.wakeup="error";A.error.cancel="error";A.error.fail="error";var La=function(a){this.id=-1;this.name=a.name||"?";this.parent=a.parent||null;this.run=a.run;this.subtasks=[];this.error=!1;this.state="ready";this.blocks=0;this.userData=this.swapTime=this.timeoutId=null;this.id=qq++;jg[this.id]=this};La.prototype.debug=function(a){k.log.debug("forge.task",a||"","[%s][%s] task:",this.id,
|
881
|
+
this.name,this,"subtasks:",this.subtasks.length,"queue:",Ea)};La.prototype.next=function(a,b){"function"===typeof a&&(b=a,a=this.name);a=new La({run:b,name:a,parent:this});a.state="running";a.type=this.type;a.successCallback=this.successCallback||null;a.failureCallback=this.failureCallback||null;this.subtasks.push(a);return this};La.prototype.parallel=function(a,b){k.util.isArray(a)&&(b=a,a=this.name);return this.next(a,function(c){c.block(b.length);for(var d=function(a,d){k.task.start({type:a,run:function(a){b[d](a)},
|
882
|
+
success:function(a){c.unblock()},failure:function(a){c.unblock()}})},e=0;e<b.length;e++)d(a+"__parallel-"+c.id+"-"+e,e)})};La.prototype.stop=function(){this.state=A[this.state].stop};La.prototype.start=function(){this.error=!1;this.state=A[this.state].start;"running"===this.state&&(this.start=new Date,this.run(this),Jb(this,0))};La.prototype.block=function(a){this.blocks+="undefined"===typeof a?1:a;0<this.blocks&&(this.state=A[this.state].block)};La.prototype.unblock=function(a){this.blocks-="undefined"===
|
883
|
+
typeof a?1:a;0===this.blocks&&"done"!==this.state&&(this.state="running",Jb(this,0));return this.blocks};La.prototype.sleep=function(a){this.state=A[this.state].sleep;var b=this;this.timeoutId=setTimeout(function(){b.timeoutId=null;b.state="running";Jb(b,0)},"undefined"===typeof a?0:a)};La.prototype.wait=function(a){a.wait(this)};La.prototype.wakeup=function(){"sleeping"===this.state&&(cancelTimeout(this.timeoutId),this.timeoutId=null,this.state="running",Jb(this,0))};La.prototype.cancel=function(){this.state=
|
884
|
+
A[this.state].cancel;this.permitsNeeded=0;null!==this.timeoutId&&(cancelTimeout(this.timeoutId),this.timeoutId=null);this.subtasks=[]};La.prototype.fail=function(a){this.error=!0;kg(this,!0);if(a)a.error=this.error,a.swapTime=this.swapTime,a.userData=this.userData,Jb(a,0);else{if(null!==this.parent){for(a=this.parent;null!==a.parent;)a.error=this.error,a.swapTime=this.swapTime,a.userData=this.userData,a=a.parent;kg(a,!0)}this.failureCallback&&this.failureCallback(this)}};var rq=function(a){a.error=
|
885
|
+
!1;a.state=A[a.state].start;setTimeout(function(){"running"===a.state&&(a.swapTime=+new Date,a.run(a),Jb(a,0))},0)},Jb=function(a,b){var c=30<b||20<+new Date-a.swapTime,d=function(b){b++;if("running"===a.state)if(c&&(a.swapTime=+new Date),0<a.subtasks.length){var d=a.subtasks.shift();d.error=a.error;d.swapTime=a.swapTime;d.userData=a.userData;d.run(d);d.error||Jb(d,b)}else kg(a),a.error||null===a.parent||(a.parent.error=a.error,a.parent.swapTime=a.swapTime,a.parent.userData=a.userData,Jb(a.parent,
|
886
|
+
b))};c?setTimeout(d,0):d(b)},kg=function(a,b){a.state="done";delete jg[a.id];null===a.parent&&(a.type in Ea?0===Ea[a.type].length?k.log.error("forge.task","[%s][%s] task queue empty [%s]",a.id,a.name,a.type):Ea[a.type][0]!==a?k.log.error("forge.task","[%s][%s] task not first in queue [%s]",a.id,a.name,a.type):(Ea[a.type].shift(),0===Ea[a.type].length?delete Ea[a.type]:Ea[a.type][0].start()):k.log.error("forge.task","[%s][%s] task queue missing [%s]",a.id,a.name,a.type),b||(a.error&&a.failureCallback?
|
887
|
+
a.failureCallback(a):!a.error&&a.successCallback&&a.successCallback(a)))};k.task=k.task||{};k.task.start=function(a){var b=new La({run:a.run,name:a.name||"?"});b.type=a.type;b.successCallback=a.success||null;b.failureCallback=a.failure||null;b.type in Ea?Ea[a.type].push(b):(Ea[b.type]=[b],rq(b))};k.task.cancel=function(a){a in Ea&&(Ea[a]=[Ea[a][0]])};k.task.createCondition=function(){var a={tasks:{},wait:function(b){b.id in a.tasks||(b.block(),a.tasks[b.id]=b)},notify:function(){var b=a.tasks;a.tasks=
|
888
|
+
{};for(var c in b)b[c].unblock()}};return a};var lg=k,sq=function(a,b){b=b.replace(/-/g,"");var c=lg.hmac.create();c.start("sha256",b);c.update(lg.util.encodeUtf8(a));a=c.digest();return"v1:"+lg.util.encode64(a.getBytes())};C(function(a){a=function(a){function b(a,b,c,d){b=Object.create((b&&b.prototype instanceof e?b:e).prototype);d=new u(d||[]);b._invoke=n(a,c,d);return b}function d(a,b,c){try{return{type:"normal",arg:a.call(b,c)}}catch(Y){return{type:"throw",arg:Y}}}function e(){}function f(){}
|
889
|
+
function h(){}function k(a){["next","throw","return"].forEach(function(b){a[b]=function(a){return this._invoke(b,a)}})}function l(a,b){function c(e,f,h,k){e=d(a[e],a,f);if("throw"===e.type)k(e.arg);else{var l=e.arg;return(e=l.value)&&"object"===typeof e&&z.call(e,"__await")?b.resolve(e.__await).then(function(a){c("next",a,h,k)},function(a){c("throw",a,h,k)}):b.resolve(e).then(function(a){l.value=a;h(l)},function(a){return c("throw",a,h,k)})}}var e;this._invoke=function(a,d){function f(){return new b(function(b,
|
890
|
+
e){c(a,d,b,e)})}return e=e?e.then(f,f):f()}}function n(a,b,c){var e=F;return function(f,h){if(e===J)throw Error("Generator is already running");if(e===K){if("throw"===f)throw h;return w()}c.method=f;for(c.arg=h;;){if(f=c.delegate)if(f=p(f,c)){if(f===H)continue;return f}if("next"===c.method)c.sent=c._sent=c.arg;else if("throw"===c.method){if(e===F)throw e=K,c.arg;c.dispatchException(c.arg)}else"return"===c.method&&c.abrupt("return",c.arg);e=J;f=d(a,b,c);if("normal"===f.type){e=c.done?K:G;if(f.arg===
|
891
|
+
H)continue;return{value:f.arg,done:c.done}}"throw"===f.type&&(e=K,c.method="throw",c.arg=f.arg)}}}function p(a,b){var c=a.iterator[b.method];if(c===A){b.delegate=null;if("throw"===b.method){if(a.iterator["return"]&&(b.method="return",b.arg=A,p(a,b),"throw"===b.method))return H;b.method="throw";b.arg=new TypeError("The iterator does not provide a 'throw' method")}return H}c=d(c,a.iterator,b.arg);if("throw"===c.type)return b.method="throw",b.arg=c.arg,b.delegate=null,H;c=c.arg;if(!c)return b.method=
|
892
|
+
"throw",b.arg=new TypeError("iterator result is not an object"),b.delegate=null,H;if(c.done)b[a.resultName]=c.value,b.next=a.nextLoc,"return"!==b.method&&(b.method="next",b.arg=A);else return c;b.delegate=null;return H}function q(a){var b={tryLoc:a[0]};1 in a&&(b.catchLoc=a[1]);2 in a&&(b.finallyLoc=a[2],b.afterLoc=a[3]);this.tryEntries.push(b)}function t(a){var b=a.completion||{};b.type="normal";delete b.arg;a.completion=b}function u(a){this.tryEntries=[{tryLoc:"root"}];a.forEach(q,this);this.reset(!0)}
|
893
|
+
function v(a){if(a){var b=a[C];if(b)return b.call(a);if("function"===typeof a.next)return a;if(!isNaN(a.length)){var c=-1;b=function L(){for(;++c<a.length;)if(z.call(a,c))return L.value=a[c],L.done=!1,L;L.value=A;L.done=!0;return L};return b.next=b}}return{next:w}}function w(){return{value:A,done:!0}}var y=Object.prototype,z=y.hasOwnProperty,A,B="function"===typeof Symbol?Symbol:{},C=B.iterator||"@@iterator",D=B.asyncIterator||"@@asyncIterator",E=B.toStringTag||"@@toStringTag";a.wrap=b;var F="suspendedStart",
|
894
|
+
G="suspendedYield",J="executing",K="completed",H={};B={};B[C]=function(){return this};var M=Object.getPrototypeOf;(M=M&&M(M(v([]))))&&M!==y&&z.call(M,C)&&(B=M);var P=h.prototype=e.prototype=Object.create(B);f.prototype=P.constructor=h;h.constructor=f;h[E]=f.displayName="GeneratorFunction";a.isGeneratorFunction=function(a){return(a="function"===typeof a&&a.constructor)?a===f||"GeneratorFunction"===(a.displayName||a.name):!1};a.mark=function(a){Object.setPrototypeOf?Object.setPrototypeOf(a,h):(a.__proto__=
|
895
|
+
h,E in a||(a[E]="GeneratorFunction"));a.prototype=Object.create(P);return a};a.awrap=function(a){return{__await:a}};k(l.prototype);l.prototype[D]=function(){return this};a.AsyncIterator=l;a.async=function(c,d,e,f,h){void 0===h&&(h=Promise);var k=new l(b(c,d,e,f),h);return a.isGeneratorFunction(d)?k:k.next().then(function(a){return a.done?a.value:k.next()})};k(P);P[E]="Generator";P[C]=function(){return this};P.toString=function(){return"[object Generator]"};a.keys=function(a){var b=[],c;for(c in a)b.push(c);
|
896
|
+
b.reverse();return function L(){for(;b.length;){var c=b.pop();if(c in a)return L.value=c,L.done=!1,L}L.done=!0;return L}};a.values=v;u.prototype={constructor:u,reset:function(a){this.next=this.prev=0;this.sent=this._sent=A;this.done=!1;this.delegate=null;this.method="next";this.arg=A;this.tryEntries.forEach(t);if(!a)for(var b in this)"t"===b.charAt(0)&&z.call(this,b)&&!isNaN(+b.slice(1))&&(this[b]=A)},stop:function(){this.done=!0;var a=this.tryEntries[0].completion;if("throw"===a.type)throw a.arg;
|
897
|
+
return this.rval},dispatchException:function(a){function b(b,d){f.type="throw";f.arg=a;c.next=b;d&&(c.method="next",c.arg=A);return!!d}if(this.done)throw a;for(var c=this,d=this.tryEntries.length-1;0<=d;--d){var e=this.tryEntries[d],f=e.completion;if("root"===e.tryLoc)return b("end");if(e.tryLoc<=this.prev){var h=z.call(e,"catchLoc"),k=z.call(e,"finallyLoc");if(h&&k){if(this.prev<e.catchLoc)return b(e.catchLoc,!0);if(this.prev<e.finallyLoc)return b(e.finallyLoc)}else if(h){if(this.prev<e.catchLoc)return b(e.catchLoc,
|
898
|
+
!0)}else if(k){if(this.prev<e.finallyLoc)return b(e.finallyLoc)}else throw Error("try statement without catch or finally");}}},abrupt:function(a,b){for(var c=this.tryEntries.length-1;0<=c;--c){var d=this.tryEntries[c];if(d.tryLoc<=this.prev&&z.call(d,"finallyLoc")&&this.prev<d.finallyLoc){var e=d;break}}e&&("break"===a||"continue"===a)&&e.tryLoc<=b&&b<=e.finallyLoc&&(e=null);c=e?e.completion:{};c.type=a;c.arg=b;return e?(this.method="next",this.next=e.finallyLoc,H):this.complete(c)},complete:function(a,
|
899
|
+
b){if("throw"===a.type)throw a.arg;"break"===a.type||"continue"===a.type?this.next=a.arg:"return"===a.type?(this.rval=this.arg=a.arg,this.method="return",this.next="end"):"normal"===a.type&&b&&(this.next=b);return H},finish:function(a){for(var b=this.tryEntries.length-1;0<=b;--b){var c=this.tryEntries[b];if(c.finallyLoc===a)return this.complete(c.completion,c.afterLoc),t(c),H}},"catch":function(a){for(var b=this.tryEntries.length-1;0<=b;--b){var c=this.tryEntries[b];if(c.tryLoc===a){a=c.completion;
|
900
|
+
if("throw"===a.type){var d=a.arg;t(c)}return d}}throw Error("illegal catch attempt");},delegateYield:function(a,b,c){this.delegate={iterator:v(a),resultName:b,nextLoc:c};"next"===this.method&&(this.arg=A);return H}};return a}(a.exports);try{regeneratorRuntime=a}catch(b){Function("r","regeneratorRuntime = r")(a)}});var tq={"data-api":C(function(a,b){function c(a,b,c){0===a.length&&c(null,null);for(var e=!1,f=0,h=null,k=0;k<a.length;k++)d(a[k],b,function(b,d){f++;b?h=b:d&&d.id&&!e&&(e=!0,c(null,d));
|
901
|
+
f!==a.length||e||c(h,null)})}function d(a,b,c){e("https://"+a+"/v1/id/"+b,function(b,d){b?c(b,null):c(null,{domain:a,id:d&&d.id||null})})}function e(a,b){var c=new XMLHttpRequest;c.open("GET",a,!0);c.withCredentials=!0;c.onreadystatechange=function(){c.readyState===XMLHttpRequest.DONE&&(200<=c.status&&300>c.status?b(null,c.responseText?window.JSON.parse(c.responseText):null):b(c.statusText||"Unknown Error",null))};c.send()}var f=oe.v4,h={maxage:31536E6,secure:!1,path:"/"},k={maxRetryDelay:36E4,minRetryDelay:1E3,
|
902
|
+
backoffFactor:2,maxAttempts:10,maxItems:100},l=b=a.exports=Dp("DataApi").option("apiKey","").option("env","staging").option("crossDomainIdServers",[]).option("retryQueue",!0).option("addBundledMetadata",!1).option("unbundledIntegrations",[]);b.storage=function(){return"file:"===fd()||"chrome-extension:"===fd()?Lg:Wb};b.global=window;b.sendJsonWithTimeout=async function(a,b,c,d,e){var f=window.JSON.stringify({batch:[b]});c["X-Request-ID"]=sq(f,b.apiKey);let h=new AbortController;var k;d&&0!==d&&(k=
|
903
|
+
setTimeout(()=>h.abort(),d));return await window.fetch(a,{method:"POST",headers:new Headers(c),body:f,keepalive:!0,signal:h.signal}).then(a=>{k&&clearTimeout(k);e&&(429===a.status||500<=a.status&&600>a.status?e(Error("HTTP Error "+a.status+" ("+a.statusText+")")):e(null,a))}).catch(a=>{e&&e(a)})};l.prototype.initialize=function(){var a=this;this.options.retryQueue&&(this._lsqueue=new Oa("dataapi",k,function(b,c){b.msg.sentAt=new Date;l.sendJsonWithTimeout(b.url,b.msg,b.headers,1E4,function(d,e){a.debug("sent %O, received %O",
|
904
|
+
b.msg,[d,e]);b.headers.hasOwnProperty("X-Request-ID")&&delete b.headers["X-Request-ID"];if(d)return c(d);c(null,e)})}),this._lsqueue.start());this.ready();this.dataApi.on("invoke",function(b){var c=b.action(),d="on"+b.action();a.debug("%s %o",c,b);if(a[d])a[d](b);a.ready()});this.options.crossDomainIdServers&&0<this.options.crossDomainIdServers.length&&this.retrieveCrossDomainId()};l.prototype.loaded=function(){return!0};l.prototype.onpage=function(a){a=a.json();a.apiMethod="page";this.enqueue(a)};
|
905
|
+
l.prototype.onidentify=function(a){a=a.json();a.apiMethod="identify";this.enqueue(a)};l.prototype.ongroup=function(a){a=a.json();a.apiMethod="group";this.enqueue(a)};l.prototype.ontrack=function(a){a=a.json();delete a.traits;a.eventName=a.event;delete a.event;a.apiMethod="track";this.enqueue(a)};l.prototype.onalias=function(a){a=a.json();var b=this.dataApi.user();a.previousEntityId=a.previousId||a.from||b.id()||b.anonymousId();a.userId=a.userId||a.to;delete a.from;delete a.to;a.apiMethod="alias";
|
906
|
+
this.enqueue(a)};l.prototype.normalize=function(a){this.debug("normalize %o",a);var c=this.dataApi.user(),d=b.global.location.search,e=a.context=a.context||a.options||{};delete a.options;a.apiKey=this.options.apiKey;e.userAgent=navigator.userAgent;e.library||(e.library={name:"data-api.js",version:this.dataApi.VERSION});var f=this.cookie("dapi_xid");f&&(e.traits?e.traits.crossDomainId||(e.traits.crossDomainId=f):e.traits={crossDomainId:f});d&&!e.campaign&&(e.campaign=De(d));this.referrerId(d,e);a.entityId=
|
907
|
+
a.userId||c.id();delete a.userId;a.entityType=a.entityType||c.entityType();a.anonymousId=c.anonymousId();a.sentAt=new Date;a.timestamp=new Date;c=this.dataApi.failedInitializations||[];0<c.length&&(a._metadata={failedInitializations:c});this.options.addBundledMetadata&&(c=sa(this.dataApi.Integrations),a._metadata=a._metadata||{},a._metadata.bundled=c,a._metadata.unbundled=this.options.unbundledIntegrations);this.debug("normalized %o",a);this.ampId(e);return a};l.prototype.ampId=function(a){var b=
|
908
|
+
this.cookie("data_api_amp_id");b&&(a.amp={id:b})};l.prototype.enqueue=function(a,b){var c="https://data-platform-staging.squarecloudservices.com/v1/batch";"production"===this.options.env&&(c="https://data-platform.squarecloudservices.com/v1/batch");var d={"Content-Type":"application/json",Authorization:"Basic "+window.btoa(this.options.apiKey+":")};a=this.normalize(a);32E3<window.JSON.stringify(a).length&&this.debug("message must be less than 32kb %O",a);this.debug("enqueueing %O",a);var e=this;this.options.retryQueue?
|
909
|
+
this._lsqueue.addItem({url:c,headers:d,msg:a}):l.sendJsonWithTimeout(c,a,d,0,function(c,d){e.debug("sent %O, received %O",a,[c,d]);if(b){if(c)return b(c);b(null,d)}})};l.prototype.cookie=function(a,c){var d=l.storage();if(1===arguments.length)return d(a);var e=b.global.location.href,f="."+gi(e);"."===f&&(f="");this.debug("store domain %s -> %s",e,f);e=Ce(h);e.domain=f;this.debug("store %s, %s, %o",a,c,e);d(a,c,e);d(a)||(delete e.domain,this.debug("fallback store %s, %s, %o",a,c,e),d(a,c,e))};l.prototype.referrerId=
|
910
|
+
function(a,b){var c=this.cookie("s:context.referrer");c&&(c=window.JSON.parse(c));if(a)a:{a=sp(a);for(var d in a)if(a.hasOwnProperty(d))for(var e in Wf)if(Wf.hasOwnProperty(e)&&d===e){var f={id:a[d],type:Wf[e]};break a}f=void 0}if(f=f||c)b.referrer=ff(b.referrer||{},f),this.cookie("s:context.referrer",window.JSON.stringify(f))};l.prototype.retrieveCrossDomainId=function(a){if(!this.options.crossDomainIdServers)a&&a("crossDomainId not enabled",null);else if(!this.cookie("dapi_xid")){for(var b=this,
|
911
|
+
d=this.options.apiKey,e=window.location.hostname.split(".").splice(-2).join("."),h=[],k=0;k<this.options.crossDomainIdServers.length;k++){var l=this.options.crossDomainIdServers[k];l.split(".").splice(-2).join(".")!==e&&h.push(l)}c(h,d,function(c,d){if(c)a&&a(c,null);else{d?(c=d.id,d=d.domain):(c=f(),d=window.location.hostname);var e=(new Date).getTime();b.cookie("dapi_xid",c);b.cookie("dapi_xid_fd",d);b.cookie("dapi_xid_ts",e);b.dataApi.identify({crossDomainId:c});a&&a(null,{crossDomainId:c,fromDomain:d,
|
912
|
+
timestamp:e})}})}}})},jd=new J;jd.VERSION="7.1.0";fa(function(a){jd.use(a)},tq);jd.load=function(a,b){jd.initialize({DataApi:{apiKey:a,env:b||"staging"}})};return jd})
|