CyberChef/PublicKey.js

175 lines
319 KiB
JavaScript
Executable File
Raw Blame History

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

/**
* CyberChef - The Cyber Swiss Army Knife
*
* @copyright Crown Copyright 2016
* @license Apache-2.0
*
* Copyright 2016 Crown Copyright
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/!function(t){var e={};function n(r){if(e[r])return e[r].exports;var i=e[r]={i:r,l:!1,exports:{}};return t[r].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=t,n.c=e,n.d=function(t,e,r){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(n.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(r,i,function(e){return t[e]}.bind(null,i));return r},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="",n(n.s=1505)}({0:function(t,e,n){"use strict";var r=n(15),i=n.n(r),s=n(10),a=n(7),o=n(19),u=n(18);function h(t,e,n,r,i,s,a){try{var o=t[s](a),u=o.value}catch(t){return void n(t)}o.done?e(u):Promise.resolve(u).then(r,i)}function c(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var s=t.apply(e,n);function a(t){h(s,r,i,a,o,"next",t)}function o(t){h(s,r,i,a,o,"throw",t)}a(void 0)})}}function l(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}
/**
* @author n1474335 [n1474335@gmail.com]
* @copyright Crown Copyright 2016
* @license Apache-2.0
*/
var f=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t)}var e,n,r;return e=t,n=null,r=[{key:"chr",value:function(t){if(t>65535){t-=65536;var e=String.fromCharCode(t>>>10&1023|55296);return t=56320|1023&t,e+String.fromCharCode(t)}return String.fromCharCode(t)}},{key:"ord",value:function(t){if(2===t.length){var e=t.charCodeAt(0),n=t.charCodeAt(1);if(e>=55296&&e<56320&&n>=56320&&n<57344)return 1024*(e-55296)+n-56320+65536}return t.charCodeAt(0)}},{key:"padBytesRight",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:0,r=new Array(e);return r.fill(n),Array.prototype.map.call(t,function(t,e){r[e]=t}),r}},{key:"truncate",value:function(t,e){var n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"...";return t.length>e&&(t=t.slice(0,e-n.length)+n),t}},{key:"hex",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2;return(e="string"==typeof e?t.ord(e):e).toString(16).padStart(n,"0")}},{key:"bin",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:8;return(e="string"==typeof e?t.ord(e):e).toString(2).padStart(n,"0")}},{key:"printable",value:function(e){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1];"object"==typeof window&&window.app&&!window.app.options.treatAsUtf8&&(e=t.byteArrayToChars(t.strToByteArray(e)));return e=e.replace(/[\0-\x08\x0B-\x0C\x0E-\x1F\x7F-\x9F\xAD\u0378\u0379\u037F-\u0383\u038B\u038D\u03A2\u0528-\u0530\u0557\u0558\u0560\u0588\u058B-\u058E\u0590\u05C8-\u05CF\u05EB-\u05EF\u05F5-\u0605\u061C\u061D\u06DD\u070E\u070F\u074B\u074C\u07B2-\u07BF\u07FB-\u07FF\u082E\u082F\u083F\u085C\u085D\u085F-\u089F\u08A1\u08AD-\u08E3\u08FF\u0978\u0980\u0984\u098D\u098E\u0991\u0992\u09A9\u09B1\u09B3-\u09B5\u09BA\u09BB\u09C5\u09C6\u09C9\u09CA\u09CF-\u09D6\u09D8-\u09DB\u09DE\u09E4\u09E5\u09FC-\u0A00\u0A04\u0A0B-\u0A0E\u0A11\u0A12\u0A29\u0A31\u0A34\u0A37\u0A3A\u0A3B\u0A3D\u0A43-\u0A46\u0A49\u0A4A\u0A4E-\u0A50\u0A52-\u0A58\u0A5D\u0A5F-\u0A65\u0A76-\u0A80\u0A84\u0A8E\u0A92\u0AA9\u0AB1\u0AB4\u0ABA\u0ABB\u0AC6\u0ACA\u0ACE\u0ACF\u0AD1-\u0ADF\u0AE4\u0AE5\u0AF2-\u0B00\u0B04\u0B0D\u0B0E\u0B11\u0B12\u0B29\u0B31\u0B34\u0B3A\u0B3B\u0B45\u0B46\u0B49\u0B4A\u0B4E-\u0B55\u0B58-\u0B5B\u0B5E\u0B64\u0B65\u0B78-\u0B81\u0B84\u0B8B-\u0B8D\u0B91\u0B96-\u0B98\u0B9B\u0B9D\u0BA0-\u0BA2\u0BA5-\u0BA7\u0BAB-\u0BAD\u0BBA-\u0BBD\u0BC3-\u0BC5\u0BC9\u0BCE\u0BCF\u0BD1-\u0BD6\u0BD8-\u0BE5\u0BFB-\u0C00\u0C04\u0C0D\u0C11\u0C29\u0C34\u0C3A-\u0C3C\u0C45\u0C49\u0C4E-\u0C54\u0C57\u0C5A-\u0C5F\u0C64\u0C65\u0C70-\u0C77\u0C80\u0C81\u0C84\u0C8D\u0C91\u0CA9\u0CB4\u0CBA\u0CBB\u0CC5\u0CC9\u0CCE-\u0CD4\u0CD7-\u0CDD\u0CDF\u0CE4\u0CE5\u0CF0\u0CF3-\u0D01\u0D04\u0D0D\u0D11\u0D3B\u0D3C\u0D45\u0D49\u0D4F-\u0D56\u0D58-\u0D5F\u0D64\u0D65\u0D76-\u0D78\u0D80\u0D81\u0D84\u0D97-\u0D99\u0DB2\u0DBC\u0DBE\u0DBF\u0DC7-\u0DC9\u0DCB-\u0DCE\u0DD5\u0DD7\u0DE0-\u0DF1\u0DF5-\u0E00\u0E3B-\u0E3E\u0E5C-\u0E80\u0E83\u0E85\u0E86\u0E89\u0E8B\u0E8C\u0E8E-\u0E93\u0E98\u0EA0\u0EA4\u0EA6\u0EA8\u0EA9\u0EAC\u0EBA\u0EBE\u0EBF\u0EC5\u0EC7\u0ECE\u0ECF\u0EDA\u0EDB\u0EE0-\u0EFF\u0F48\u0F6D-\u0F70\u0F98\u0FBD\u0FCD\u0FDB-\u0FFF\u10C6\u10C8-\u10CC\u10CE\u10CF\u1249\u124E\u124F\u1257\u1259\u125E\u125F\u1289\u128E\u128F\u12B1\u12B6\u12B7\u12BF\u12C1\u12C6\u12C7\u12D7\u1311\u1316\u1317\u135B\u135C\u137D-\u137F\u139A-\u139F\u13F5-\u13FF\u169D-\u169F\u16F1-\u16FF\u170D\u1715-\u171F\u1737-\u173F\u1754-\u175F\u176D\u1771\u1774-\u177F\u17DE\u17DF\u17EA-\u17EF\u17FA-\u17FF\u180F\u181A-\u181F\u1878-\u187F\u18AB-\u18AF\u18F6-\u18FF\u191D-\u191F\u192C-\u192F\u193C-\u193F\u1941-\u1943\u196E\u196F\u1975-\u197F\u19AC-\u19AF\u19CA-\u19CF\u19DB-\u19DD\u1A1C\u1A1D\u1A5F\u1A7D\u1A7E\u1A8A-\u1A8F\u1A9A-\u1A9F\u1AAE-\u1AFF\u1B4C-\u1B4F\u1B7D-\u1B7F\u1BF4-\u1BFB\u1C38-\u1C3A\u1C4A-\u1C4C\u1C80-\u1CBF\u1CC8-\u1CCF\u1CF7-\u1CFF\u1DE7-\u1DFB\u1F16\u1F17\u1F1E\u1F1F\u1F46\u1F47\u1F4E\u1F4F\u1F58\u1F5A\u1F5C\u1F5E\u1F7E\u1F7F\u1FB5\u1FC5\u1FD4\u1FD5\u1FDC\u1FF0\u1FF1\u1FF5\u1FFF\u200B-\u200F\u202A-\u202E\u2060-\u206F\u2072\u2073\u208F\u209D-\u209F\u20BB-\u20CF\u20F1-\u20FF\u218A-\u218F\u23F4-\u23FF\u2427-\u243F\u244B-\u245F\u2700\u2B4D-\u2B4F\u2B5A-\u2BFF\u2C2F\u2C5F\u2CF4-\u2CF8\u2D26\u2D28-\u2D2C\u2D2E\u2D2F\u2D68-\u2D6E\u2D71-\u2D7E\u2D97-\u2D9F\u2DA7\u2DAF\u2DB7\u2DBF\u2DC7\u2DCF\u2DD7\u2DDF\u2E3C-\u2E7F\u2E9A\u2EF4-\u2EFF\u2FD6-\u2FEF\u2FFC-\u2FFF\u3040\u3097\u3098\u3100-\u3104\u312E-\u3130\u318F\u31BB-\u31BF\u31E4-\u31EF\u321F\u32FF\u4DB6-\u4DBF\u9FCD-\u9FFF\uA48D-\uA48F\uA4C7-\uA4CF\uA62C-\uA63F\uA698-\uA69E\uA6F8-\uA6FF\uA78F\uA794-\uA79F\uA7AB-\uA7F7\uA82C-\uA82F\uA83A-\uA83F\uA878-\uA87F\uA8C5-\uA8CD\uA8DA-\uA8DF\uA8FC-\uA8FF\uA954-\uA95E\uA97D-\uA97F\uA9CE\uA9DA-\uA9DD\uA9E0-\uA9FF\uAA37-\uAA3F\uAA4E\uAA4F\uAA5A\uAA5B\uAA7C-\uAA7F\uAAC3-\uAADA\uAAF7-\uAB00\uAB07\uAB08\uAB0F\uAB10\uAB17-\uAB1F\uAB27\uAB2F-\uABBF\uABEE\uABEF\uABFA-\uABFF\uD7A4-\uD7AF\uD7C7-\uD7CA\uD7FC-\uD7FF\uE000-\uF8FF\uFA6E\uFA6F\uFADA-\uFAFF\uFB07-\uFB12\uFB18-\uFB1C\uFB37\uFB3D\uFB3F\uFB42\uFB45\uFBC2-\uFBD2\uFD40-\uFD4F\uFD90\uFD91\uFDC8-\uFDEF\uFDFE\uFDFF\uFE1A-\uFE1F\uFE27-\uFE2F\uFE53\uFE67\uFE6C-\uFE6F\uFE75\uFEFD-\uFF00\uFFBF-\uFFC1\uFFC8\uFFC9\uFFD0\uFFD1\uFFD8\uFFD9\uFFDD-\uFFDF\uFFE7\uFFEF-\uFFFB\uFFFE\uFFFF]/g,"."),n||(e=e.replace(/[\x09-\x10\x0D\u2028\u2029]/g,".")),e}},{key:"parseEscapedChars",value:function(t){return t.replace(/(\\)?\\([bfnrtv0'"]|x[\da-fA-F]{2}|u[\da-fA-F]{4}|u\{[\da-fA-F]{1,6}\})/g,function(t,e,n){if("\\"===e)return"\\"+n;switch(n[0]){case"0":return"\0";case"b":return"\b";case"t":return"\t";case"n":return"\n";case"v":return"\v";case"f":return"\f";case"r":return"\r";case'"':return'"';case"'":return"'";case"x":return String.fromCharCode(parseInt(n.substr(1),16));case"u":return"{"===n[1]?String.fromCodePoint(parseInt(n.slice(2,-1),16)):String.fromCharCode(parseInt(n.substr(1),16))}})}},{key:"escapeRegex",value:function(t){return t.replace(/([.*+?^=!:${}()|[\]\/\\])/g,"\\$1")}},{key:"expandAlphRange",value:function(e){for(var n=[],r=0;r<e.length;r++)if(r<e.length-2&&"-"===e[r+1]&&"\\"!==e[r]){for(var i=t.ord(e[r]),s=t.ord(e[r+2]),a=i;a<=s;a++)n.push(t.chr(a));r+=2}else r<e.length-2&&"\\"===e[r]&&"-"===e[r+1]?(n.push("-"),r++):n.push(e[r]);return n}},{key:"convertToByteArray",value:function(e,n){switch(n.toLowerCase()){case"binary":return Object(u.a)(e);case"hex":return Object(a.c)(e);case"decimal":return Object(o.a)(e);case"base64":return Object(s.b)(e,null,"byteArray");case"utf8":return t.strToUtf8ByteArray(e);case"latin1":default:return t.strToByteArray(e)}}},{key:"convertToByteString",value:function(e,n){switch(n.toLowerCase()){case"binary":return t.byteArrayToChars(Object(u.a)(e));case"hex":return t.byteArrayToChars(Object(a.c)(e));case"decimal":return t.byteArrayToChars(Object(o.a)(e));case"base64":return t.byteArrayToChars(Object(s.b)(e,null,"byteArray"));case"utf8":return i.a.encode(e);case"latin1":default:return e}}},{key:"strToByteArray",value:function(e){for(var n,r=new Array(e.length),i=e.length;i--;)if(n=e.charCodeAt(i),r[i]=n,n>255)return t.strToUtf8ByteArray(e);return r}},{key:"strToUtf8ByteArray",value:function(e){var n=i.a.encode(e);return e.length!==n.length&&("function"==typeof importScripts?self.setOption("attemptHighlight",!1):"object"==typeof window&&(window.app.options.attemptHighlight=!1)),t.strToByteArray(n)}},{key:"strToCharcode",value:function(e){for(var n=[],r=0;r<e.length;r++){var i=e.charCodeAt(r);if(r<e.length-1&&i>=55296&&i<56320){var s=e[r+1].charCodeAt(0);s>=56320&&s<57344&&(i=t.ord(e[r]+e[++r]))}n.push(i)}return n}},{key:"byteArrayToUtf8",value:function(e){var n=t.byteArrayToChars(e);try{var r=i.a.decode(n);return n.length!==r.length&&("function"==typeof importScripts?self.setOption("attemptHighlight",!1):"object"==typeof window&&(window.app.options.attemptHighlight=!1)),r}catch(t){return n}}},{key:"byteArrayToChars",value:function(t){if(!t)return"";for(var e="",n=0;n<t.length;)e+=String.fromCharCode(t[n++]);return e}},{key:"arrayBufferToStr",value:function(e){var n=!(arguments.length>1&&void 0!==arguments[1])||arguments[1],r=Array.prototype.slice.call(new Uint8Array(e));return n?t.byteArrayToUtf8(r):t.byteArrayToChars(r)}},{key:"parseCSV",value:function(t){var e,n,r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[","],i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:["\n","\r"],s=!1,a=!1,o="",u=[],h=[];t.length&&"\ufeff"===t[0]&&(t=t.substr(1));for(var c=0;c<t.length;c++)e=t[c],n=t[c+1]||"",s?(o+=e,s=!1):'"'!==e||a?'"'===e&&a?'"'===n?s=!0:a=!1:!a&&r.indexOf(e)>=0?(u.push(o),o=""):!a&&i.indexOf(e)>=0?(u.push(o),o="",h.push(u),u=[],i.indexOf(n)>=0&&n!==e&&c++):o+=e:a=!0;return u.length&&(u.push(o),h.push(u)),h}},{key:"stripHtmlTags",value:function(t){return arguments.length>1&&void 0!==arguments[1]&&arguments[1]&&(t=t.replace(/<(script|style)[^>]*>.*<\/(script|style)>/gim,"")),t.replace(/<[^>]+>/g,"")}},{key:"escapeHtml",value:function(t){var e={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","/":"&#x2F;","`":"&#x60;"};return t.replace(/[&<>"'\/`]/g,function(t){return e[t]})}},{key:"unescapeHtml",value:function(t){var e={"&amp;":"&","&lt;":"<","&gt;":">","&quot;":'"',"&#x27;":"'","&#x2F;":"/","&#x60;":"`"};return t.replace(/&#?x?[a-z0-9]{2,4};/gi,function(t){return e[t]||t})}},{key:"encodeURIFragment",value:function(t){var e={"%2D":"-","%2E":".","%5F":"_","%7E":"~","%21":"!","%24":"$","%27":"'","%28":"(","%29":")","%2A":"*","%2C":",","%3B":";","%3A":":","%40":"@","%2F":"/","%3F":"?"};return(t=encodeURIComponent(t)).replace(/%[0-9A-F]{2}/g,function(t){return e[t]||t})}},{key:"generatePrettyRecipe",value:function(t){var e=arguments.length>1&&void 0!==arguments[1]&&arguments[1],n="",r="",i="",s="",a="";return t.forEach(function(t){r=t.op.replace(/ /g,"_"),i=JSON.stringify(t.args).slice(1,-1).replace(/'/g,"\\'").replace(/"((?:[^"\\]|\\.)*)"/g,"'$1'").replace(/\\"/g,'"'),s=t.disabled?"/disabled":"",a=t.breakpoint?"/breakpoint":"",n+="".concat(r,"(").concat(i).concat(s).concat(a,")"),e&&(n+="\n")}),n}},{key:"parseRecipeConfig",value:function(t){if(0===(t=t.trim()).length)return[];if("["===t[0])return JSON.parse(t);var e,n;t=t.replace(/\n/g,"");for(var r=/([^(]+)\(((?:'[^'\\]*(?:\\.[^'\\]*)*'|[^)\/'])*)(\/[^)]+)?\)/g,i=[];e=r.exec(t);){n="["+(n=e[2].replace(/"/g,'\\"').replace(/(^|,|{|:)'/g,'$1"').replace(/([^\\]|[^\\]\\\\)'(,|:|}|$)/g,'$1"$2').replace(/\\'/g,"'"))+"]";var s={op:e[1].replace(/_/g," "),args:JSON.parse(n)};e[3]&&e[3].indexOf("disabled")>0&&(s.disabled=!0),e[3]&&e[3].indexOf("breakpoint")>0&&(s.breakpoint=!0),i.push(s)}return i}},{key:"displayFilesAsHTML",value:function(){var e=c(regeneratorRuntime.mark(function e(n){var r,i,a,o,u;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:r=function(e){return"<div class='card' style='white-space: normal;'>\n <div class='card-header'>\n <h6 class=\"mb-0\">\n ".concat(t.escapeHtml(e.name),"\n </h6>\n </div>\n </div>")},i=function(e,n){if(n.startsWith("image")){var r="data:";return r+=n+";","<img style='max-width: 100%;' src='"+(r+="base64,"+Object(s.c)(e))+"'>"}return"<pre>".concat(t.escapeHtml(t.arrayBufferToStr(e.buffer)),"</pre>")},a=function(){var e=c(regeneratorRuntime.mark(function e(n,r){var s,a,o;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:return e.next=2,t.readFile(n);case 2:return s=e.sent,a=new Blob([s],{type:"octet/stream"}),o="<div class='card' style='white-space: normal;'>\n <div class='card-header' id='heading".concat(r,"'>\n <h6 class='mb-0'>\n <a class='collapsed'\n data-toggle='collapse'\n href='#collapse").concat(r,"'\n aria-expanded='false'\n aria-controls='collapse").concat(r,"'\n title=\"Show/hide contents of '").concat(t.escapeHtml(n.name),"'\">\n ").concat(t.escapeHtml(n.name),"</a>\n <span class='float-right' style=\"margin-top: -3px\">\n ").concat(n.size.toLocaleString(),' bytes\n <a title="Download ').concat(t.escapeHtml(n.name),"\"\n href='").concat(URL.createObjectURL(a),"'\n download='").concat(t.escapeHtml(n.name),'\'>\n <i class="material-icons" style="vertical-align: bottom">save</i>\n </a>\n </span>\n </h6>\n </div>\n <div id=\'collapse').concat(r,"' class='collapse' aria-labelledby='heading").concat(r,"' data-parent=\"#files\">\n <div class='card-body'>\n ").concat(i(s,n.type),"\n </div>\n </div>\n </div>"),e.abrupt("return",o);case 6:case"end":return e.stop()}},e,this)}));return function(t,n){return e.apply(this,arguments)}}(),o="<div style='padding: 5px; white-space: normal;'>\n ".concat(n.length,' file(s) found\n </div><div id="files" style="padding: 20px">'),u=0;case 5:if(!(u<n.length)){e.next=17;break}if(!n[u].name.endsWith("/")){e.next=10;break}o+=r(n[u]),e.next=14;break;case 10:return e.t0=o,e.next=13,a(n[u],u);case 13:o=e.t0+=e.sent;case 14:u++,e.next=5;break;case 17:return e.abrupt("return",o+="</div>");case 18:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"parseURIParams",value:function(t){if(""===t)return{};"?"!==t[0]&&"#"!==t[0]||(t=t.substr(1));for(var e=t.split("&"),n={},r=0;r<e.length;r++){var i=e[r].split("=");2!==i.length?n[e[r]]=!0:n[i[0]]=decodeURIComponent(i[1].replace(/\+/g," "))}return n}},{key:"readFile",value:function(t){return new Promise(function(e,n){var r=new FileReader,i=new Uint8Array(t.size),s=0,a=function(){if(s>=t.size)e(i);else{var n=t.slice(s,s+10485760);r.readAsArrayBuffer(n)}};r.onload=function(t){i.set(new Uint8Array(r.result),s),s+=10485760,a()},r.onerror=function(t){n(r.error.message)},a()})}},{key:"mod",value:function(t,e){return(t%e+e)%e}},{key:"gcd",value:function(e,n){return n?t.gcd(n,e%n):e}},{key:"modInv",value:function(t,e){t%=e;for(var n=1;n<e;n++)if(t*n%26==1)return n}},{key:"charRep",value:function(t){return{Space:" ",Comma:",","Semi-colon":";",Colon:":","Line feed":"\n",CRLF:"\r\n","Forward slash":"/",Backslash:"\\","0x":"0x","\\x":"\\x","Nothing (separate chars)":"",None:""}[t]}},{key:"regexRep",value:function(t){return{Space:/\s+/g,Comma:/,/g,"Semi-colon":/;/g,Colon:/:/g,"Line feed":/\n/g,CRLF:/\r\n/g,"Forward slash":/\//g,Backslash:/\\/g,"0x":/0x/g,"\\x":/\\x/g,None:/\s+/g}[t]}}],n&&l(e.prototype,n),r&&l(e,r),t}();e.a=f,Array.prototype.unique=function(){for(var t={},e=[],n=0,r=this.length;n<r;n++)t.hasOwnProperty(this[n])||(e.push(this[n]),t[this[n]]=1);return e},Array.prototype.max=function(){return Math.max.apply(null,this)},Array.prototype.min=function(){return Math.min.apply(null,this)},Array.prototype.sum=function(){return this.reduce(function(t,e){return t+e},0)},Array.prototype.equals=function(t){if(!t)return!1;var e=this.length;if(e!==t.length)return!1;for(;e--;)if(this[e]!==t[e])return!1;return!0},String.prototype.count=function(t){return this.split(t).length-1},String.prototype.padStart||(String.prototype.padStart=function(t,e){return t>>=0,e=String(void 0!==e?e:" "),this.length>t?String(this):((t-=this.length)>e.length&&(e+=e.repeat(t/e.length)),e.slice(0,t)+String(this))}),String.prototype.padEnd||(String.prototype.padEnd=function(t,e){return t>>=0,e=String(void 0!==e?e:" "),this.length>t?String(this):((t-=this.length)>e.length&&(e+=e.repeat(t/e.length)),String(this)+e.slice(0,t))})},1:function(t,e,n){"use strict";var r=n(9),i=n(0),s=n(7);function a(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}
/**
* @author n1474335 [n1474335@gmail.com]
* @copyright Crown Copyright 2016
* @license Apache-2.0
*/
var o=function(){function t(e){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.name="",this.type="",this._value=null,this.disabled=!1,this.hint="",this.rows=0,this.toggleValues=[],this.target=null,this.defaultIndex=0,e&&this._parseConfig(e)}var e,n,r;return e=t,r=[{key:"prepare",value:function(t,e){var n;switch(e){case"binaryString":case"binaryShortString":case"editableOption":case"editableOptionShort":return i.a.parseEscapedChars(t);case"byteArray":return"string"==typeof t?(t=t.replace(/\s+/g,""),Object(s.c)(t)):t;case"number":if(n=parseFloat(t),isNaN(n))throw"Invalid ingredient value. Not a number: "+i.a.truncate(t.toString(),10);return n;default:return t}}}],(n=[{key:"_parseConfig",value:function(t){this.name=t.name,this.type=t.type,this.defaultValue=t.value,this.disabled=!!t.disabled,this.hint=t.hint||!1,this.rows=t.rows||!1,this.toggleValues=t.toggleValues,this.target=void 0!==t.target?t.target:null,this.defaultIndex=void 0!==t.defaultIndex?t.defaultIndex:0}},{key:"config",get:function(){return this._value}},{key:"value",set:function(e){this._value=t.prepare(e,this.type)},get:function(){return this._value}}])&&a(e.prototype,n),r&&a(e,r),t}();function u(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}
/**
* @author n1474335 [n1474335@gmail.com]
* @copyright Crown Copyright 2016
* @license Apache-2.0
*/
var h=function(){function t(){!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this._inputType=-1,this._outputType=-1,this._presentType=-1,this._breakpoint=!1,this._disabled=!1,this._flowControl=!1,this._manualBake=!1,this._ingList=[],this.name="",this.module="",this.description="",this.infoURL=null}var e,n,i;return e=t,(n=[{key:"run",value:function(t,e){return t}},{key:"highlight",value:function(t,e){return!1}},{key:"highlightReverse",value:function(t,e){return!1}},{key:"present",value:function(t,e){return t}},{key:"addIngredient",value:function(t){this._ingList.push(t)}},{key:"inputType",set:function(t){this._inputType=r.a.typeEnum(t)},get:function(){return r.a.enumLookup(this._inputType)}},{key:"outputType",set:function(t){this._outputType=r.a.typeEnum(t),this._presentType<0&&(this._presentType=this._outputType)},get:function(){return r.a.enumLookup(this._outputType)}},{key:"presentType",set:function(t){this._presentType=r.a.typeEnum(t)},get:function(){return r.a.enumLookup(this._presentType)}},{key:"args",set:function(t){var e=this;t.forEach(function(t){var n=new o(t);e.addIngredient(n)})},get:function(){return this._ingList.map(function(t){var e={name:t.name,type:t.type,value:t.defaultValue};return t.toggleValues&&(e.toggleValues=t.toggleValues),t.hint&&(e.hint=t.hint),t.rows&&(e.rows=t.rows),t.disabled&&(e.disabled=t.disabled),t.target&&(e.target=t.target),t.defaultIndex&&(e.defaultIndex=t.defaultIndex),e})}},{key:"config",get:function(){return{op:this.name,args:this._ingList.map(function(t){return t.config})}}},{key:"ingValues",set:function(t){var e=this;t.forEach(function(t,n){e._ingList[n].value=t})},get:function(){return this._ingList.map(function(t){return t.value})}},{key:"breakpoint",set:function(t){this._breakpoint=!!t},get:function(){return this._breakpoint}},{key:"disabled",set:function(t){this._disabled=!!t},get:function(){return this._disabled}},{key:"flowControl",get:function(){return this._flowControl},set:function(t){this._flowControl=!!t}},{key:"manualBake",get:function(){return this._manualBake},set:function(t){this._manualBake=!!t}}])&&u(e.prototype,n),i&&u(e,i),t}();e.a=h},10:function(t,e,n){"use strict";n.d(e,"c",function(){return i}),n.d(e,"b",function(){return s}),n.d(e,"a",function(){return a});var r=n(0);
/**
* Base64 functions.
*
* @author n1474335 [n1474335@gmail.com]
* @copyright Crown Copyright 2016
* @license Apache-2.0
*/function i(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"A-Za-z0-9+/=";if(!t)return"";"string"==typeof t&&(t=r.a.strToByteArray(t)),e=r.a.expandAlphRange(e).join("");for(var n,i,s,a,o,u,h,c="",l=0;l<t.length;)a=(n=t[l++])>>2,o=(3&n)<<4|(i=t[l++])>>4,u=(15&i)<<2|(s=t[l++])>>6,h=63&s,isNaN(i)?u=h=64:isNaN(s)&&(h=64),c+=e.charAt(a)+e.charAt(o)+e.charAt(u)+e.charAt(h);return c}function s(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"A-Za-z0-9+/=",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"string",i=!(arguments.length>3&&void 0!==arguments[3])||arguments[3];if(!t)return"string"===n?"":[];e=e||"A-Za-z0-9+/=",e=r.a.expandAlphRange(e).join("");var s,a,o,u,h,c,l=[],f=0;if(i){var d=new RegExp("[^"+e.replace(/[[\]\\\-^$]/g,"\\$&")+"]","g");t=t.replace(d,"")}for(;f<t.length;)s=e.indexOf(t.charAt(f++))<<2|(u=-1===(u=e.indexOf(t.charAt(f++)||"="))?64:u)>>4,a=(15&u)<<4|(h=-1===(h=e.indexOf(t.charAt(f++)||"="))?64:h)>>2,o=(3&h)<<6|(c=-1===(c=e.indexOf(t.charAt(f++)||"="))?64:c),l.push(s),64!==h&&l.push(a),64!==c&&l.push(o);return"string"===n?r.a.byteArrayToUtf8(l):l}var a=[{name:"Standard (RFC 4648): A-Za-z0-9+/=",value:"A-Za-z0-9+/="},{name:"URL safe (RFC 4648 §5): A-Za-z0-9-_",value:"A-Za-z0-9-_"},{name:"Filename safe: A-Za-z0-9+-=",value:"A-Za-z0-9+\\-="},{name:"itoa64: ./0-9A-Za-z=",value:"./0-9A-Za-z="},{name:"XML: A-Za-z0-9_.",value:"A-Za-z0-9_."},{name:"y64: A-Za-z0-9._-",value:"A-Za-z0-9._-"},{name:"z64: 0-9a-zA-Z+/=",value:"0-9a-zA-Z+/="},{name:"Radix-64 (RFC 4880): 0-9A-Za-z+/=",value:"0-9A-Za-z+/="},{name:"Uuencoding: [space]-_",value:" -_"},{name:"Xxencoding: +-0-9A-Za-z",value:"+\\-0-9A-Za-z"},{name:"BinHex: !-,-0-689@A-NP-VX-Z[`a-fh-mp-r",value:"!-,-0-689@A-NP-VX-Z[`a-fh-mp-r"},{name:"ROT13: N-ZA-Mn-za-m0-9+/=",value:"N-ZA-Mn-za-m0-9+/="},{name:"UNIX crypt: ./0-9A-Za-z",value:"./0-9A-Za-z"}]},12:function(t,e,n){"use strict";function r(t){return(r="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function i(t){return(i=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function s(t,e){return(s=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}function a(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}function o(t){function e(){var e=Reflect.construct(t,Array.from(arguments));return Object.setPrototypeOf(e,Object.getPrototypeOf(this)),e}return e.prototype=Object.create(t.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),Object.setPrototypeOf?Object.setPrototypeOf(e,t):e.__proto__=t,e}
/**
* Custom error type for handling Dish type errors.
* i.e. where the Dish cannot be successfully translated between types
*
* @author n1474335 [n1474335@gmail.com]
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/var u=function(t){function e(){var t,n,s,o;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e);for(var u=arguments.length,h=new Array(u),c=0;c<u;c++)h[c]=arguments[c];return s=this,(n=!(o=(t=i(e)).call.apply(t,[this].concat(h)))||"object"!==r(o)&&"function"!=typeof o?a(s):o).type="DishError",Error.captureStackTrace&&Error.captureStackTrace(a(a(n)),e),n}return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&s(t,e)}(e,o(Error)),e}();e.a=u},14:function(t,e,n){var r,i;!function(s,a){"use strict";void 0===(i="function"==typeof(r=function(){var t=function(){},e="undefined",n=["trace","debug","info","warn","error"];function r(t,e){var n=t[e];if("function"==typeof n.bind)return n.bind(t);try{return Function.prototype.bind.call(n,t)}catch(e){return function(){return Function.prototype.apply.apply(n,[t,arguments])}}}function i(e,r){for(var i=0;i<n.length;i++){var s=n[i];this[s]=i<e?t:this.methodFactory(s,e,r)}this.log=this.debug}function s(n,s,a){return function(n){"debug"===n&&(n="log");return typeof console!==e&&(void 0!==console[n]?r(console,n):void 0!==console.log?r(console,"log"):t)}(n)||function(t,n,r){return function(){typeof console!==e&&(i.call(this,n,r),this[t].apply(this,arguments))}}.apply(this,arguments)}function a(t,r,a){var o,u=this,h="loglevel";function c(){var t;if(typeof window!==e){try{t=window.localStorage[h]}catch(t){}if(typeof t===e)try{var n=window.document.cookie,r=n.indexOf(encodeURIComponent(h)+"=");-1!==r&&(t=/^([^;]+)/.exec(n.slice(r))[1])}catch(t){}return void 0===u.levels[t]&&(t=void 0),t}}t&&(h+=":"+t),u.name=t,u.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},u.methodFactory=a||s,u.getLevel=function(){return o},u.setLevel=function(r,s){if("string"==typeof r&&void 0!==u.levels[r.toUpperCase()]&&(r=u.levels[r.toUpperCase()]),!("number"==typeof r&&r>=0&&r<=u.levels.SILENT))throw"log.setLevel() called with invalid level: "+r;if(o=r,!1!==s&&function(t){var r=(n[t]||"silent").toUpperCase();if(typeof window===e)return;try{return void(window.localStorage[h]=r)}catch(t){}try{window.document.cookie=encodeURIComponent(h)+"="+r+";"}catch(t){}}(r),i.call(u,r,t),typeof console===e&&r<u.levels.SILENT)return"No console available for logging"},u.setDefaultLevel=function(t){c()||u.setLevel(t,!1)},u.enableAll=function(t){u.setLevel(u.levels.TRACE,t)},u.disableAll=function(t){u.setLevel(u.levels.SILENT,t)};var l=c();null==l&&(l=null==r?"WARN":r),u.setLevel(l,!1)}var o=new a,u={};o.getLogger=function(t){if("string"!=typeof t||""===t)throw new TypeError("You must supply a name when creating a logger.");var e=u[t];return e||(e=u[t]=new a(t,o.getLevel(),o.methodFactory)),e};var h=typeof window!==e?window.log:void 0;return o.noConflict=function(){return typeof window!==e&&window.log===o&&(window.log=h),o},o.getLoggers=function(){return u},o})?r.call(e,n,e,t):r)||(t.exports=i)}()},15:function(t,e,n){!function(t){var e,n,r,i=String.fromCharCode;function s(t){for(var e,n,r=[],i=0,s=t.length;i<s;)(e=t.charCodeAt(i++))>=55296&&e<=56319&&i<s?56320==(64512&(n=t.charCodeAt(i++)))?r.push(((1023&e)<<10)+(1023&n)+65536):(r.push(e),i--):r.push(e);return r}function a(t){if(t>=55296&&t<=57343)throw Error("Lone surrogate U+"+t.toString(16).toUpperCase()+" is not a scalar value")}function o(t,e){return i(t>>e&63|128)}function u(t){if(0==(4294967168&t))return i(t);var e="";return 0==(4294965248&t)?e=i(t>>6&31|192):0==(4294901760&t)?(a(t),e=i(t>>12&15|224),e+=o(t,6)):0==(4292870144&t)&&(e=i(t>>18&7|240),e+=o(t,12),e+=o(t,6)),e+=i(63&t|128)}function h(){if(r>=n)throw Error("Invalid byte index");var t=255&e[r];if(r++,128==(192&t))return 63&t;throw Error("Invalid continuation byte")}function c(){var t,i;if(r>n)throw Error("Invalid byte index");if(r==n)return!1;if(t=255&e[r],r++,0==(128&t))return t;if(192==(224&t)){if((i=(31&t)<<6|h())>=128)return i;throw Error("Invalid continuation byte")}if(224==(240&t)){if((i=(15&t)<<12|h()<<6|h())>=2048)return a(i),i;throw Error("Invalid continuation byte")}if(240==(248&t)&&(i=(7&t)<<18|h()<<12|h()<<6|h())>=65536&&i<=1114111)return i;throw Error("Invalid UTF-8 detected")}t.version="3.0.0",t.encode=function(t){for(var e=s(t),n=e.length,r=-1,i="";++r<n;)i+=u(e[r]);return i},t.decode=function(t){e=s(t),n=e.length,r=0;for(var a,o=[];!1!==(a=c());)o.push(a);return function(t){for(var e,n=t.length,r=-1,s="";++r<n;)(e=t[r])>65535&&(s+=i((e-=65536)>>>10&1023|55296),e=56320|1023&e),s+=i(e);return s}(o)}}(e)},1505:function(t,e,n){"use strict";n.r(e);var r=n(78),i=n.n(r),s=n(1);function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function o(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function u(t,e){return!e||"object"!==a(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function h(t){return(h=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function c(t,e){return(c=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}
/**
* @author n1474335 [n1474335@gmail.com]
* @copyright Crown Copyright 2016
* @license Apache-2.0
*/var l=function(t){function e(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=u(this,h(e).call(this))).name="Hex to Object Identifier",t.module="PublicKey",t.description="Converts a hexadecimal string into an object identifier (OID).",t.infoURL="https://wikipedia.org/wiki/Object_identifier",t.inputType="string",t.outputType="string",t.args=[],t}var n,r,a;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&c(t,e)}(e,s["a"]),n=e,(r=[{key:"run",value:function(t,e){return i.a.KJUR.asn1.ASN1Util.oidHexToInt(t.replace(/\s/g,""))}}])&&o(n.prototype,r),a&&o(n,a),e}();function f(t){return(f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function d(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function g(t,e){return!e||"object"!==f(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function p(t){return(p=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function y(t,e){return(y=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}
/**
* @author n1474335 [n1474335@gmail.com]
* @copyright Crown Copyright 2016
* @license Apache-2.0
*/var v=function(t){function e(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=g(this,p(e).call(this))).name="Hex to PEM",t.module="PublicKey",t.description="Converts a hexadecimal DER (Distinguished Encoding Rules) string into PEM (Privacy Enhanced Mail) format.",t.infoURL="https://wikipedia.org/wiki/Privacy-Enhanced_Mail",t.inputType="string",t.outputType="string",t.args=[{name:"Header string",type:"string",value:"CERTIFICATE"}],t}var n,r,a;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&y(t,e)}(e,s["a"]),n=e,(r=[{key:"run",value:function(t,e){return i.a.KJUR.asn1.ASN1Util.getPEMStringFromHex(t.replace(/\s/g,""),e[0])}}])&&d(n.prototype,r),a&&d(n,a),e}();function m(t){return(m="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function F(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function S(t,e){return!e||"object"!==m(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function b(t){return(b=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function A(t,e){return(A=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}
/**
* @author n1474335 [n1474335@gmail.com]
* @copyright Crown Copyright 2016
* @license Apache-2.0
*/var E=function(t){function e(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=S(this,b(e).call(this))).name="Object Identifier to Hex",t.module="PublicKey",t.description="Converts an object identifier (OID) into a hexadecimal string.",t.infoURL="https://wikipedia.org/wiki/Object_identifier",t.inputType="string",t.outputType="string",t.args=[],t}var n,r,a;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&A(t,e)}(e,s["a"]),n=e,(r=[{key:"run",value:function(t,e){return i.a.KJUR.asn1.ASN1Util.oidIntToHex(t)}}])&&F(n.prototype,r),a&&F(n,a),e}();function w(t){return(w="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function x(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function C(t,e){return!e||"object"!==w(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function D(t){return(D=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function B(t,e){return(B=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}
/**
* @author n1474335 [n1474335@gmail.com]
* @copyright Crown Copyright 2016
* @license Apache-2.0
*/var T=function(t){function e(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=C(this,D(e).call(this))).name="PEM to Hex",t.module="PublicKey",t.description="Converts PEM (Privacy Enhanced Mail) format to a hexadecimal DER (Distinguished Encoding Rules) string.",t.infoURL="https://en.wikipedia.org/wiki/X.690#DER_encoding",t.inputType="string",t.outputType="string",t.args=[],t}var n,r,a;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&B(t,e)}(e,s["a"]),n=e,(r=[{key:"run",value:function(t,e){t.indexOf("-----BEGIN")<0&&(t="-----BEGIN CERTIFICATE-----"+t),t.indexOf("-----END")<0&&(t+="-----END CERTIFICATE-----");var n=new i.a.X509;return n.readCertPEM(t),n.hex}}])&&x(n.prototype,r),a&&x(n,a),e}();function I(t){return(I="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function P(t,e){return function(t){if(Array.isArray(t))return t}(t)||function(t,e){var n=[],r=!0,i=!1,s=void 0;try{for(var a,o=t[Symbol.iterator]();!(r=(a=o.next()).done)&&(n.push(a.value),!e||n.length!==e);r=!0);}catch(t){i=!0,s=t}finally{try{r||null==o.return||o.return()}finally{if(i)throw s}}return n}(t,e)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function R(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function H(t,e){return!e||"object"!==I(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function N(t){return(N=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function O(t,e){return(O=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}
/**
* @author n1474335 [n1474335@gmail.com]
* @copyright Crown Copyright 2016
* @license Apache-2.0
*/var j=function(t){function e(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=H(this,N(e).call(this))).name="Parse ASN.1 hex string",t.module="PublicKey",t.description="Abstract Syntax Notation One (ASN.1) is a standard and notation that describes rules and structures for representing, encoding, transmitting, and decoding data in telecommunications and computer networking.<br><br>This operation parses arbitrary ASN.1 data and presents the resulting tree.",t.infoURL="https://wikipedia.org/wiki/Abstract_Syntax_Notation_One",t.inputType="string",t.outputType="string",t.args=[{name:"Starting index",type:"number",value:0},{name:"Truncate octet strings longer than",type:"number",value:32}],t}var n,r,a;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&O(t,e)}(e,s["a"]),n=e,(r=[{key:"run",value:function(t,e){var n=P(e,2),r=n[0],s=n[1];return i.a.ASN1HEX.dump(t.replace(/\s/g,""),{ommitLongOctet:s},r)}}])&&R(n.prototype,r),a&&R(n,a),e}(),L=n(10),k=n(7);
/**
* Public key resources.
*
* @author n1474335 [n1474335@gmail.com]
* @copyright Crown Copyright 2016
* @license Apache-2.0
*/
function _(t,e){var n,r,i,s,a=t.substr(1).replace(/([^\\])\//g,"$1$1/").split(/[^\\]\//),o="",u=0;for(i=0;i<a.length;i++)a[i].length&&(u=(n=a[i].split("=")[0]).length>u?n.length:u);for(i=0;i<a.length;i++)a[i].length&&(n=a[i].split("=")[0],r=a[i].split("=")[1],o+=(s=n.padEnd(u," ")+" = "+r+"\n").padStart(e+s.length," "));return o.slice(0,-1)}function V(t,e,n){t=Object(k.d)(Object(k.c)(t),":"),e*=3;for(var r="",i=0;i<t.length;i+=e){var s=t.slice(i,i+e)+"\n";r+=0===i?s:s.padStart(n+s.length," ")}return r.slice(0,r.length-1)}var M=n(0);function K(t){return(K="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}function U(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}function q(t,e){return!e||"object"!==K(e)&&"function"!=typeof e?function(t){if(void 0===t)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return t}(t):e}function z(t){return(z=Object.setPrototypeOf?Object.getPrototypeOf:function(t){return t.__proto__||Object.getPrototypeOf(t)})(t)}function Y(t,e){return(Y=Object.setPrototypeOf||function(t,e){return t.__proto__=e,t})(t,e)}
/**
* @author n1474335 [n1474335@gmail.com]
* @copyright Crown Copyright 2016
* @license Apache-2.0
*/function G(t){return 13===t.length&&(t=(t[0]<"5"?"20":"19")+t),t[6]+t[7]+"/"+t[4]+t[5]+"/"+t[0]+t[1]+t[2]+t[3]+" "+t[8]+t[9]+":"+t[10]+t[11]+":"+t[12]+t[13]}var J=function(t){function e(){var t;return function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,e),(t=q(this,z(e).call(this))).name="Parse X.509 certificate",t.module="PublicKey",t.description="X.509 is an ITU-T standard for a public key infrastructure (PKI) and Privilege Management Infrastructure (PMI). It is commonly involved with SSL/TLS security.<br><br>This operation displays the contents of a certificate in a human readable format, similar to the openssl command line tool.<br><br>Tags: X509, server hello, handshake",t.infoURL="https://wikipedia.org/wiki/X.509",t.inputType="string",t.outputType="string",t.args=[{name:"Input format",type:"option",value:["PEM","DER Hex","Base64","Raw"]}],t.patterns=[{match:"^-+BEGIN CERTIFICATE-+\\r?\\n[\\da-z+/\\n\\r]+-+END CERTIFICATE-+\\r?\\n?$",flags:"i",args:["PEM"]}],t}var n,r,a;return function(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function");t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,writable:!0,configurable:!0}}),e&&Y(t,e)}(e,s["a"]),n=e,(r=[{key:"run",value:function(t,e){if(!t.length)return"No input";var n=new i.a.X509;switch(e[0]){case"DER Hex":t=t.replace(/\s/g,""),n.readCertHex(t);break;case"PEM":n.readCertPEM(t);break;case"Base64":n.readCertHex(Object(k.d)(Object(L.b)(t,null,"byteArray"),""));break;case"Raw":n.readCertHex(Object(k.d)(M.a.strToByteArray(t),""));break;default:throw"Undefined input format"}var r=n.getSerialNumberHex(),s=n.getIssuerString(),a=n.getSubjectString(),o=n.getPublicKey(),u=[],h=n.getSignatureValueHex(),c="",l="",f="";u.push({key:"Algorithm",value:o.type}),"EC"===o.type?(u.push({key:"Curve Name",value:o.curveName}),u.push({key:"Length",value:(new i.a.BigInteger(o.pubKeyHex,16).bitLength()-3)/2+" bits"}),u.push({key:"pub",value:V(o.pubKeyHex,16,18)})):"DSA"===o.type?(u.push({key:"pub",value:V(o.y.toString(16),16,18)}),u.push({key:"P",value:V(o.p.toString(16),16,18)}),u.push({key:"Q",value:V(o.q.toString(16),16,18)}),u.push({key:"G",value:V(o.g.toString(16),16,18)})):o.e?(u.push({key:"Length",value:o.n.bitLength()+" bits"}),u.push({key:"Modulus",value:V(o.n.toString(16),16,18)}),u.push({key:"Exponent",value:o.e+" (0x"+o.e.toString(16)+")"})):u.push({key:"Error",value:"Unknown Public Key type"});for(var d=0;d<u.length;d++)c+=" ".concat(u[d].key,":").concat((u[d].value+"\n").padStart(18-(u[d].key.length+3)+u[d].value.length+1," "));var g=!1;try{g=0===i.a.ASN1HEX.dump(h).indexOf("SEQUENCE")}catch(t){}l=g?" r: ".concat(V(i.a.ASN1HEX.getV(h,4),16,18),"\n s: ").concat(V(i.a.ASN1HEX.getV(h,48),16,18)):" Signature: ".concat(V(h,16,18));try{f=n.getInfo().split("X509v3 Extensions:\n")[1].split("signature")[0]}catch(t){}var p=_(s,2),y=G(n.getNotBefore()),v=G(n.getNotAfter()),m=_(a,2);return"Version: ".concat(n.version," (0x").concat(M.a.hex(n.version-1),")\nSerial number: ").concat(new i.a.BigInteger(r,16).toString()," (0x").concat(r,")\nAlgorithm ID: ").concat(n.getSignatureAlgorithmField(),"\nValidity\n Not Before: ").concat(y," (dd-mm-yyyy hh:mm:ss) (").concat(n.getNotBefore(),")\n Not After: ").concat(v," (dd-mm-yyyy hh:mm:ss) (").concat(n.getNotAfter(),")\nIssuer\n").concat(p,"\nSubject\n").concat(m,"\nPublic Key\n").concat(c.slice(0,-1),"\nCertificate Signature\n Algorithm: ").concat(n.getSignatureAlgorithmName(),"\n").concat(l,"\n\nExtensions\n").concat(f)}}])&&U(n.prototype,r),a&&U(n,a),e}(),W="undefined"==typeof self?{}:self.OpModules||{};
/**
* THIS FILE IS AUTOMATICALLY GENERATED BY src/core/config/scripts/generateConfig.mjs
*
* @author n1474335 [n1474335@gmail.com]
* @copyright Crown Copyright 2019
* @license Apache-2.0
*/W.PublicKey={"Hex to Object Identifier":l,"Hex to PEM":v,"Object Identifier to Hex":E,"PEM to Hex":T,"Parse ASN.1 hex string":j,"Parse X.509 certificate":J};e.default=W},17:function(t,e){var n;n=function(){return this}();try{n=n||new Function("return this")()}catch(t){"object"==typeof window&&(n=window)}t.exports=n},18:function(t,e,n){"use strict";n.d(e,"b",function(){return i}),n.d(e,"a",function(){return s});var r=n(0);
/**
* Binary functions.
*
* @author n1474335 [n1474335@gmail.com]
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/function i(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Space",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:8;if(!t)return"";e=r.a.charRep(e);for(var i="",s=0;s<t.length;s++)i+=t[s].toString(2).padStart(n,"0")+e;return e.length?i.slice(0,-e.length):i}function s(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Space",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:8,i=r.a.regexRep(e);t=t.replace(i,"");for(var s=[],a=0;a<t.length;a+=n)s.push(parseInt(t.substr(a,n),2));return s}},19:function(t,e,n){"use strict";n.d(e,"a",function(){return i});var r=n(0);
/**
* Decimal functions.
*
* @author n1474335 [n1474335@gmail.com]
* @copyright Crown Copyright 2018
* @license Apache-2.0
*/function i(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Auto";e=r.a.charRep(e);var n=[],i=t.split(e);""===i[i.length-1]&&(i=i.slice(0,i.length-1));for(var s=0;s<i.length;s++)n[s]=parseInt(i[s],10);return n}},4:function(t,e,n){var r;!function(i){"use strict";var s,a=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:e[+-]?\d+)?$/i,o=Math.ceil,u=Math.floor,h="[BigNumber Error] ",c=h+"Number primitive has more than 15 significant digits: ",l=1e14,f=14,d=9007199254740991,g=[1,10,100,1e3,1e4,1e5,1e6,1e7,1e8,1e9,1e10,1e11,1e12,1e13],p=1e7,y=1e9;function v(t){var e=0|t;return t>0||t===e?e:e-1}function m(t){for(var e,n,r=1,i=t.length,s=t[0]+"";r<i;){for(e=t[r++]+"",n=f-e.length;n--;e="0"+e);s+=e}for(i=s.length;48===s.charCodeAt(--i););return s.slice(0,i+1||1)}function F(t,e){var n,r,i=t.c,s=e.c,a=t.s,o=e.s,u=t.e,h=e.e;if(!a||!o)return null;if(n=i&&!i[0],r=s&&!s[0],n||r)return n?r?0:-o:a;if(a!=o)return a;if(n=a<0,r=u==h,!i||!s)return r?0:!i^n?1:-1;if(!r)return u>h^n?1:-1;for(o=(u=i.length)<(h=s.length)?u:h,a=0;a<o;a++)if(i[a]!=s[a])return i[a]>s[a]^n?1:-1;return u==h?0:u>h^n?1:-1}function S(t,e,n,r){if(t<e||t>n||t!==(t<0?o(t):u(t)))throw Error(h+(r||"Argument")+("number"==typeof t?t<e||t>n?" out of range: ":" not an integer: ":" not a primitive number: ")+String(t))}function b(t){var e=t.c.length-1;return v(t.e/f)==e&&t.c[e]%2!=0}function A(t,e){return(t.length>1?t.charAt(0)+"."+t.slice(1):t)+(e<0?"e":"e+")+e}function E(t,e,n){var r,i;if(e<0){for(i=n+".";++e;i+=n);t=i+t}else if(++e>(r=t.length)){for(i=n,e-=r;--e;i+=n);t+=i}else e<r&&(t=t.slice(0,e)+"."+t.slice(e));return t}(s=function t(e){var n,r,i,s,w,x,C,D,B,T=K.prototype={constructor:K,toString:null,valueOf:null},I=new K(1),P=20,R=4,H=-7,N=21,O=-1e7,j=1e7,L=!1,k=1,_=0,V={prefix:"",groupSize:3,secondaryGroupSize:0,groupSeparator:",",decimalSeparator:".",fractionGroupSize:0,fractionGroupSeparator:" ",suffix:""},M="0123456789abcdefghijklmnopqrstuvwxyz";function K(t,e){var n,s,o,h,l,g,p,y,v=this;if(!(v instanceof K))return new K(t,e);if(null==e){if(t instanceof K)return v.s=t.s,v.e=t.e,void(v.c=(t=t.c)?t.slice():t);if((g="number"==typeof t)&&0*t==0){if(v.s=1/t<0?(t=-t,-1):1,t===~~t){for(h=0,l=t;l>=10;l/=10,h++);return v.e=h,void(v.c=[t])}y=String(t)}else{if(y=String(t),!a.test(y))return i(v,y,g);v.s=45==y.charCodeAt(0)?(y=y.slice(1),-1):1}(h=y.indexOf("."))>-1&&(y=y.replace(".","")),(l=y.search(/e/i))>0?(h<0&&(h=l),h+=+y.slice(l+1),y=y.substring(0,l)):h<0&&(h=y.length)}else{if(S(e,2,M.length,"Base"),y=String(t),10==e)return Y(v=new K(t instanceof K?t:y),P+v.e+1,R);if(g="number"==typeof t){if(0*t!=0)return i(v,y,g,e);if(v.s=1/t<0?(y=y.slice(1),-1):1,K.DEBUG&&y.replace(/^0\.0*|\./,"").length>15)throw Error(c+t);g=!1}else v.s=45===y.charCodeAt(0)?(y=y.slice(1),-1):1;for(n=M.slice(0,e),h=l=0,p=y.length;l<p;l++)if(n.indexOf(s=y.charAt(l))<0){if("."==s){if(l>h){h=p;continue}}else if(!o&&(y==y.toUpperCase()&&(y=y.toLowerCase())||y==y.toLowerCase()&&(y=y.toUpperCase()))){o=!0,l=-1,h=0;continue}return i(v,String(t),g,e)}(h=(y=r(y,e,10,v.s)).indexOf("."))>-1?y=y.replace(".",""):h=y.length}for(l=0;48===y.charCodeAt(l);l++);for(p=y.length;48===y.charCodeAt(--p););if(y=y.slice(l,++p)){if(p-=l,g&&K.DEBUG&&p>15&&(t>d||t!==u(t)))throw Error(c+v.s*t);if((h=h-l-1)>j)v.c=v.e=null;else if(h<O)v.c=[v.e=0];else{if(v.e=h,v.c=[],l=(h+1)%f,h<0&&(l+=f),l<p){for(l&&v.c.push(+y.slice(0,l)),p-=f;l<p;)v.c.push(+y.slice(l,l+=f));y=y.slice(l),l=f-y.length}else l-=p;for(;l--;y+="0");v.c.push(+y)}}else v.c=[v.e=0]}function U(t,e,n,r){var i,s,a,o,u;if(null==n?n=R:S(n,0,8),!t.c)return t.toString();if(i=t.c[0],a=t.e,null==e)u=m(t.c),u=1==r||2==r&&(a<=H||a>=N)?A(u,a):E(u,a,"0");else if(s=(t=Y(new K(t),e,n)).e,o=(u=m(t.c)).length,1==r||2==r&&(e<=s||s<=H)){for(;o<e;u+="0",o++);u=A(u,s)}else if(e-=a,u=E(u,s,"0"),s+1>o){if(--e>0)for(u+=".";e--;u+="0");}else if((e+=s-o)>0)for(s+1==o&&(u+=".");e--;u+="0");return t.s<0&&i?"-"+u:u}function q(t,e){for(var n,r=1,i=new K(t[0]);r<t.length;r++){if(!(n=new K(t[r])).s){i=n;break}e.call(i,n)&&(i=n)}return i}function z(t,e,n){for(var r=1,i=e.length;!e[--i];e.pop());for(i=e[0];i>=10;i/=10,r++);return(n=r+n*f-1)>j?t.c=t.e=null:n<O?t.c=[t.e=0]:(t.e=n,t.c=e),t}function Y(t,e,n,r){var i,s,a,h,c,d,p,y=t.c,v=g;if(y){t:{for(i=1,h=y[0];h>=10;h/=10,i++);if((s=e-i)<0)s+=f,a=e,p=(c=y[d=0])/v[i-a-1]%10|0;else if((d=o((s+1)/f))>=y.length){if(!r)break t;for(;y.length<=d;y.push(0));c=p=0,i=1,a=(s%=f)-f+1}else{for(c=h=y[d],i=1;h>=10;h/=10,i++);p=(a=(s%=f)-f+i)<0?0:c/v[i-a-1]%10|0}if(r=r||e<0||null!=y[d+1]||(a<0?c:c%v[i-a-1]),r=n<4?(p||r)&&(0==n||n==(t.s<0?3:2)):p>5||5==p&&(4==n||r||6==n&&(s>0?a>0?c/v[i-a]:0:y[d-1])%10&1||n==(t.s<0?8:7)),e<1||!y[0])return y.length=0,r?(e-=t.e+1,y[0]=v[(f-e%f)%f],t.e=-e||0):y[0]=t.e=0,t;if(0==s?(y.length=d,h=1,d--):(y.length=d+1,h=v[f-s],y[d]=a>0?u(c/v[i-a]%v[a])*h:0),r)for(;;){if(0==d){for(s=1,a=y[0];a>=10;a/=10,s++);for(a=y[0]+=h,h=1;a>=10;a/=10,h++);s!=h&&(t.e++,y[0]==l&&(y[0]=1));break}if(y[d]+=h,y[d]!=l)break;y[d--]=0,h=1}for(s=y.length;0===y[--s];y.pop());}t.e>j?t.c=t.e=null:t.e<O&&(t.c=[t.e=0])}return t}function G(t){var e,n=t.e;return null===n?t.toString():(e=m(t.c),e=n<=H||n>=N?A(e,n):E(e,n,"0"),t.s<0?"-"+e:e)}return K.clone=t,K.ROUND_UP=0,K.ROUND_DOWN=1,K.ROUND_CEIL=2,K.ROUND_FLOOR=3,K.ROUND_HALF_UP=4,K.ROUND_HALF_DOWN=5,K.ROUND_HALF_EVEN=6,K.ROUND_HALF_CEIL=7,K.ROUND_HALF_FLOOR=8,K.EUCLID=9,K.config=K.set=function(t){var e,n;if(null!=t){if("object"!=typeof t)throw Error(h+"Object expected: "+t);if(t.hasOwnProperty(e="DECIMAL_PLACES")&&(S(n=t[e],0,y,e),P=n),t.hasOwnProperty(e="ROUNDING_MODE")&&(S(n=t[e],0,8,e),R=n),t.hasOwnProperty(e="EXPONENTIAL_AT")&&((n=t[e])&&n.pop?(S(n[0],-y,0,e),S(n[1],0,y,e),H=n[0],N=n[1]):(S(n,-y,y,e),H=-(N=n<0?-n:n))),t.hasOwnProperty(e="RANGE"))if((n=t[e])&&n.pop)S(n[0],-y,-1,e),S(n[1],1,y,e),O=n[0],j=n[1];else{if(S(n,-y,y,e),!n)throw Error(h+e+" cannot be zero: "+n);O=-(j=n<0?-n:n)}if(t.hasOwnProperty(e="CRYPTO")){if((n=t[e])!==!!n)throw Error(h+e+" not true or false: "+n);if(n){if("undefined"==typeof crypto||!crypto||!crypto.getRandomValues&&!crypto.randomBytes)throw L=!n,Error(h+"crypto unavailable");L=n}else L=n}if(t.hasOwnProperty(e="MODULO_MODE")&&(S(n=t[e],0,9,e),k=n),t.hasOwnProperty(e="POW_PRECISION")&&(S(n=t[e],0,y,e),_=n),t.hasOwnProperty(e="FORMAT")){if("object"!=typeof(n=t[e]))throw Error(h+e+" not an object: "+n);V=n}if(t.hasOwnProperty(e="ALPHABET")){if("string"!=typeof(n=t[e])||/^.$|[+-.\s]|(.).*\1/.test(n))throw Error(h+e+" invalid: "+n);M=n}}return{DECIMAL_PLACES:P,ROUNDING_MODE:R,EXPONENTIAL_AT:[H,N],RANGE:[O,j],CRYPTO:L,MODULO_MODE:k,POW_PRECISION:_,FORMAT:V,ALPHABET:M}},K.isBigNumber=function(t){return t instanceof K||t&&!0===t._isBigNumber||!1},K.maximum=K.max=function(){return q(arguments,T.lt)},K.minimum=K.min=function(){return q(arguments,T.gt)},K.random=(s=9007199254740992*Math.random()&2097151?function(){return u(9007199254740992*Math.random())}:function(){return 8388608*(1073741824*Math.random()|0)+(8388608*Math.random()|0)},function(t){var e,n,r,i,a,c=0,l=[],d=new K(I);if(null==t?t=P:S(t,0,y),i=o(t/f),L)if(crypto.getRandomValues){for(e=crypto.getRandomValues(new Uint32Array(i*=2));c<i;)(a=131072*e[c]+(e[c+1]>>>11))>=9e15?(n=crypto.getRandomValues(new Uint32Array(2)),e[c]=n[0],e[c+1]=n[1]):(l.push(a%1e14),c+=2);c=i/2}else{if(!crypto.randomBytes)throw L=!1,Error(h+"crypto unavailable");for(e=crypto.randomBytes(i*=7);c<i;)(a=281474976710656*(31&e[c])+1099511627776*e[c+1]+4294967296*e[c+2]+16777216*e[c+3]+(e[c+4]<<16)+(e[c+5]<<8)+e[c+6])>=9e15?crypto.randomBytes(7).copy(e,c):(l.push(a%1e14),c+=7);c=i/7}if(!L)for(;c<i;)(a=s())<9e15&&(l[c++]=a%1e14);for(i=l[--c],t%=f,i&&t&&(a=g[f-t],l[c]=u(i/a)*a);0===l[c];l.pop(),c--);if(c<0)l=[r=0];else{for(r=-1;0===l[0];l.splice(0,1),r-=f);for(c=1,a=l[0];a>=10;a/=10,c++);c<f&&(r-=f-c)}return d.e=r,d.c=l,d}),K.sum=function(){for(var t=1,e=arguments,n=new K(e[0]);t<e.length;)n=n.plus(e[t++]);return n},r=function(){function t(t,e,n,r){for(var i,s,a=[0],o=0,u=t.length;o<u;){for(s=a.length;s--;a[s]*=e);for(a[0]+=r.indexOf(t.charAt(o++)),i=0;i<a.length;i++)a[i]>n-1&&(null==a[i+1]&&(a[i+1]=0),a[i+1]+=a[i]/n|0,a[i]%=n)}return a.reverse()}return function(e,r,i,s,a){var o,u,h,c,l,f,d,g,p=e.indexOf("."),y=P,v=R;for(p>=0&&(c=_,_=0,e=e.replace(".",""),f=(g=new K(r)).pow(e.length-p),_=c,g.c=t(E(m(f.c),f.e,"0"),10,i,"0123456789"),g.e=g.c.length),h=c=(d=t(e,r,i,a?(o=M,"0123456789"):(o="0123456789",M))).length;0==d[--c];d.pop());if(!d[0])return o.charAt(0);if(p<0?--h:(f.c=d,f.e=h,f.s=s,d=(f=n(f,g,y,v,i)).c,l=f.r,h=f.e),p=d[u=h+y+1],c=i/2,l=l||u<0||null!=d[u+1],l=v<4?(null!=p||l)&&(0==v||v==(f.s<0?3:2)):p>c||p==c&&(4==v||l||6==v&&1&d[u-1]||v==(f.s<0?8:7)),u<1||!d[0])e=l?E(o.charAt(1),-y,o.charAt(0)):o.charAt(0);else{if(d.length=u,l)for(--i;++d[--u]>i;)d[u]=0,u||(++h,d=[1].concat(d));for(c=d.length;!d[--c];);for(p=0,e="";p<=c;e+=o.charAt(d[p++]));e=E(e,h,o.charAt(0))}return e}}(),n=function(){function t(t,e,n){var r,i,s,a,o=0,u=t.length,h=e%p,c=e/p|0;for(t=t.slice();u--;)o=((i=h*(s=t[u]%p)+(r=c*s+(a=t[u]/p|0)*h)%p*p+o)/n|0)+(r/p|0)+c*a,t[u]=i%n;return o&&(t=[o].concat(t)),t}function e(t,e,n,r){var i,s;if(n!=r)s=n>r?1:-1;else for(i=s=0;i<n;i++)if(t[i]!=e[i]){s=t[i]>e[i]?1:-1;break}return s}function n(t,e,n,r){for(var i=0;n--;)t[n]-=i,i=t[n]<e[n]?1:0,t[n]=i*r+t[n]-e[n];for(;!t[0]&&t.length>1;t.splice(0,1));}return function(r,i,s,a,o){var h,c,d,g,p,y,m,F,S,b,A,E,w,x,C,D,B,T=r.s==i.s?1:-1,I=r.c,P=i.c;if(!(I&&I[0]&&P&&P[0]))return new K(r.s&&i.s&&(I?!P||I[0]!=P[0]:P)?I&&0==I[0]||!P?0*T:T/0:NaN);for(S=(F=new K(T)).c=[],T=s+(c=r.e-i.e)+1,o||(o=l,c=v(r.e/f)-v(i.e/f),T=T/f|0),d=0;P[d]==(I[d]||0);d++);if(P[d]>(I[d]||0)&&c--,T<0)S.push(1),g=!0;else{for(x=I.length,D=P.length,d=0,T+=2,(p=u(o/(P[0]+1)))>1&&(P=t(P,p,o),I=t(I,p,o),D=P.length,x=I.length),w=D,A=(b=I.slice(0,D)).length;A<D;b[A++]=0);B=P.slice(),B=[0].concat(B),C=P[0],P[1]>=o/2&&C++;do{if(p=0,(h=e(P,b,D,A))<0){if(E=b[0],D!=A&&(E=E*o+(b[1]||0)),(p=u(E/C))>1)for(p>=o&&(p=o-1),m=(y=t(P,p,o)).length,A=b.length;1==e(y,b,m,A);)p--,n(y,D<m?B:P,m,o),m=y.length,h=1;else 0==p&&(h=p=1),m=(y=P.slice()).length;if(m<A&&(y=[0].concat(y)),n(b,y,A,o),A=b.length,-1==h)for(;e(P,b,D,A)<1;)p++,n(b,D<A?B:P,A,o),A=b.length}else 0===h&&(p++,b=[0]);S[d++]=p,b[0]?b[A++]=I[w]||0:(b=[I[w]],A=1)}while((w++<x||null!=b[0])&&T--);g=null!=b[0],S[0]||S.splice(0,1)}if(o==l){for(d=1,T=S[0];T>=10;T/=10,d++);Y(F,s+(F.e=d+c*f-1)+1,a,g)}else F.e=c,F.r=+g;return F}}(),w=/^(-?)0([xbo])(?=\w[\w.]*$)/i,x=/^([^.]+)\.$/,C=/^\.([^.]+)$/,D=/^-?(Infinity|NaN)$/,B=/^\s*\+(?=[\w.])|^\s+|\s+$/g,i=function(t,e,n,r){var i,s=n?e:e.replace(B,"");if(D.test(s))t.s=isNaN(s)?null:s<0?-1:1,t.c=t.e=null;else{if(!n&&(s=s.replace(w,function(t,e,n){return i="x"==(n=n.toLowerCase())?16:"b"==n?2:8,r&&r!=i?t:e}),r&&(i=r,s=s.replace(x,"$1").replace(C,"0.$1")),e!=s))return new K(s,i);if(K.DEBUG)throw Error(h+"Not a"+(r?" base "+r:"")+" number: "+e);t.c=t.e=t.s=null}},T.absoluteValue=T.abs=function(){var t=new K(this);return t.s<0&&(t.s=1),t},T.comparedTo=function(t,e){return F(this,new K(t,e))},T.decimalPlaces=T.dp=function(t,e){var n,r,i,s=this;if(null!=t)return S(t,0,y),null==e?e=R:S(e,0,8),Y(new K(s),t+s.e+1,e);if(!(n=s.c))return null;if(r=((i=n.length-1)-v(this.e/f))*f,i=n[i])for(;i%10==0;i/=10,r--);return r<0&&(r=0),r},T.dividedBy=T.div=function(t,e){return n(this,new K(t,e),P,R)},T.dividedToIntegerBy=T.idiv=function(t,e){return n(this,new K(t,e),0,1)},T.exponentiatedBy=T.pow=function(t,e){var n,r,i,s,a,c,l,d,g=this;if((t=new K(t)).c&&!t.isInteger())throw Error(h+"Exponent not an integer: "+G(t));if(null!=e&&(e=new K(e)),a=t.e>14,!g.c||!g.c[0]||1==g.c[0]&&!g.e&&1==g.c.length||!t.c||!t.c[0])return d=new K(Math.pow(+G(g),a?2-b(t):+G(t))),e?d.mod(e):d;if(c=t.s<0,e){if(e.c?!e.c[0]:!e.s)return new K(NaN);(r=!c&&g.isInteger()&&e.isInteger())&&(g=g.mod(e))}else{if(t.e>9&&(g.e>0||g.e<-1||(0==g.e?g.c[0]>1||a&&g.c[1]>=24e7:g.c[0]<8e13||a&&g.c[0]<=9999975e7)))return s=g.s<0&&b(t)?-0:0,g.e>-1&&(s=1/s),new K(c?1/s:s);_&&(s=o(_/f+2))}for(a?(n=new K(.5),c&&(t.s=1),l=b(t)):l=(i=Math.abs(+G(t)))%2,d=new K(I);;){if(l){if(!(d=d.times(g)).c)break;s?d.c.length>s&&(d.c.length=s):r&&(d=d.mod(e))}if(i){if(0===(i=u(i/2)))break;l=i%2}else if(Y(t=t.times(n),t.e+1,1),t.e>14)l=b(t);else{if(0==(i=+G(t)))break;l=i%2}g=g.times(g),s?g.c&&g.c.length>s&&(g.c.length=s):r&&(g=g.mod(e))}return r?d:(c&&(d=I.div(d)),e?d.mod(e):s?Y(d,_,R,void 0):d)},T.integerValue=function(t){var e=new K(this);return null==t?t=R:S(t,0,8),Y(e,e.e+1,t)},T.isEqualTo=T.eq=function(t,e){return 0===F(this,new K(t,e))},T.isFinite=function(){return!!this.c},T.isGreaterThan=T.gt=function(t,e){return F(this,new K(t,e))>0},T.isGreaterThanOrEqualTo=T.gte=function(t,e){return 1===(e=F(this,new K(t,e)))||0===e},T.isInteger=function(){return!!this.c&&v(this.e/f)>this.c.length-2},T.isLessThan=T.lt=function(t,e){return F(this,new K(t,e))<0},T.isLessThanOrEqualTo=T.lte=function(t,e){return-1===(e=F(this,new K(t,e)))||0===e},T.isNaN=function(){return!this.s},T.isNegative=function(){return this.s<0},T.isPositive=function(){return this.s>0},T.isZero=function(){return!!this.c&&0==this.c[0]},T.minus=function(t,e){var n,r,i,s,a=this,o=a.s;if(e=(t=new K(t,e)).s,!o||!e)return new K(NaN);if(o!=e)return t.s=-e,a.plus(t);var u=a.e/f,h=t.e/f,c=a.c,d=t.c;if(!u||!h){if(!c||!d)return c?(t.s=-e,t):new K(d?a:NaN);if(!c[0]||!d[0])return d[0]?(t.s=-e,t):new K(c[0]?a:3==R?-0:0)}if(u=v(u),h=v(h),c=c.slice(),o=u-h){for((s=o<0)?(o=-o,i=c):(h=u,i=d),i.reverse(),e=o;e--;i.push(0));i.reverse()}else for(r=(s=(o=c.length)<(e=d.length))?o:e,o=e=0;e<r;e++)if(c[e]!=d[e]){s=c[e]<d[e];break}if(s&&(i=c,c=d,d=i,t.s=-t.s),(e=(r=d.length)-(n=c.length))>0)for(;e--;c[n++]=0);for(e=l-1;r>o;){if(c[--r]<d[r]){for(n=r;n&&!c[--n];c[n]=e);--c[n],c[r]+=l}c[r]-=d[r]}for(;0==c[0];c.splice(0,1),--h);return c[0]?z(t,c,h):(t.s=3==R?-1:1,t.c=[t.e=0],t)},T.modulo=T.mod=function(t,e){var r,i,s=this;return t=new K(t,e),!s.c||!t.s||t.c&&!t.c[0]?new K(NaN):!t.c||s.c&&!s.c[0]?new K(s):(9==k?(i=t.s,t.s=1,r=n(s,t,0,3),t.s=i,r.s*=i):r=n(s,t,0,k),(t=s.minus(r.times(t))).c[0]||1!=k||(t.s=s.s),t)},T.multipliedBy=T.times=function(t,e){var n,r,i,s,a,o,u,h,c,d,g,y,m,F,S,b=this,A=b.c,E=(t=new K(t,e)).c;if(!(A&&E&&A[0]&&E[0]))return!b.s||!t.s||A&&!A[0]&&!E||E&&!E[0]&&!A?t.c=t.e=t.s=null:(t.s*=b.s,A&&E?(t.c=[0],t.e=0):t.c=t.e=null),t;for(r=v(b.e/f)+v(t.e/f),t.s*=b.s,(u=A.length)<(d=E.length)&&(m=A,A=E,E=m,i=u,u=d,d=i),i=u+d,m=[];i--;m.push(0));for(F=l,S=p,i=d;--i>=0;){for(n=0,g=E[i]%S,y=E[i]/S|0,s=i+(a=u);s>i;)n=((h=g*(h=A[--a]%S)+(o=y*h+(c=A[a]/S|0)*g)%S*S+m[s]+n)/F|0)+(o/S|0)+y*c,m[s--]=h%F;m[s]=n}return n?++r:m.splice(0,1),z(t,m,r)},T.negated=function(){var t=new K(this);return t.s=-t.s||null,t},T.plus=function(t,e){var n,r=this,i=r.s;if(e=(t=new K(t,e)).s,!i||!e)return new K(NaN);if(i!=e)return t.s=-e,r.minus(t);var s=r.e/f,a=t.e/f,o=r.c,u=t.c;if(!s||!a){if(!o||!u)return new K(i/0);if(!o[0]||!u[0])return u[0]?t:new K(o[0]?r:0*i)}if(s=v(s),a=v(a),o=o.slice(),i=s-a){for(i>0?(a=s,n=u):(i=-i,n=o),n.reverse();i--;n.push(0));n.reverse()}for((i=o.length)-(e=u.length)<0&&(n=u,u=o,o=n,e=i),i=0;e;)i=(o[--e]=o[e]+u[e]+i)/l|0,o[e]=l===o[e]?0:o[e]%l;return i&&(o=[i].concat(o),++a),z(t,o,a)},T.precision=T.sd=function(t,e){var n,r,i,s=this;if(null!=t&&t!==!!t)return S(t,1,y),null==e?e=R:S(e,0,8),Y(new K(s),t,e);if(!(n=s.c))return null;if(r=(i=n.length-1)*f+1,i=n[i]){for(;i%10==0;i/=10,r--);for(i=n[0];i>=10;i/=10,r++);}return t&&s.e+1>r&&(r=s.e+1),r},T.shiftedBy=function(t){return S(t,-d,d),this.times("1e"+t)},T.squareRoot=T.sqrt=function(){var t,e,r,i,s,a=this,o=a.c,u=a.s,h=a.e,c=P+4,l=new K("0.5");if(1!==u||!o||!o[0])return new K(!u||u<0&&(!o||o[0])?NaN:o?a:1/0);if(0==(u=Math.sqrt(+G(a)))||u==1/0?(((e=m(o)).length+h)%2==0&&(e+="0"),u=Math.sqrt(+e),h=v((h+1)/2)-(h<0||h%2),r=new K(e=u==1/0?"1e"+h:(e=u.toExponential()).slice(0,e.indexOf("e")+1)+h)):r=new K(u+""),r.c[0])for((u=(h=r.e)+c)<3&&(u=0);;)if(s=r,r=l.times(s.plus(n(a,s,c,1))),m(s.c).slice(0,u)===(e=m(r.c)).slice(0,u)){if(r.e<h&&--u,"9999"!=(e=e.slice(u-3,u+1))&&(i||"4999"!=e)){+e&&(+e.slice(1)||"5"!=e.charAt(0))||(Y(r,r.e+P+2,1),t=!r.times(r).eq(a));break}if(!i&&(Y(s,s.e+P+2,0),s.times(s).eq(a))){r=s;break}c+=4,u+=4,i=1}return Y(r,r.e+P+1,R,t)},T.toExponential=function(t,e){return null!=t&&(S(t,0,y),t++),U(this,t,e,1)},T.toFixed=function(t,e){return null!=t&&(S(t,0,y),t=t+this.e+1),U(this,t,e)},T.toFormat=function(t,e,n){var r,i=this;if(null==n)null!=t&&e&&"object"==typeof e?(n=e,e=null):t&&"object"==typeof t?(n=t,t=e=null):n=V;else if("object"!=typeof n)throw Error(h+"Argument not an object: "+n);if(r=i.toFixed(t,e),i.c){var s,a=r.split("."),o=+n.groupSize,u=+n.secondaryGroupSize,c=n.groupSeparator||"",l=a[0],f=a[1],d=i.s<0,g=d?l.slice(1):l,p=g.length;if(u&&(s=o,o=u,u=s,p-=s),o>0&&p>0){for(s=p%o||o,l=g.substr(0,s);s<p;s+=o)l+=c+g.substr(s,o);u>0&&(l+=c+g.slice(s)),d&&(l="-"+l)}r=f?l+(n.decimalSeparator||"")+((u=+n.fractionGroupSize)?f.replace(new RegExp("\\d{"+u+"}\\B","g"),"$&"+(n.fractionGroupSeparator||"")):f):l}return(n.prefix||"")+r+(n.suffix||"")},T.toFraction=function(t){var e,r,i,s,a,o,u,c,l,d,p,y,v=this,F=v.c;if(null!=t&&(!(u=new K(t)).isInteger()&&(u.c||1!==u.s)||u.lt(I)))throw Error(h+"Argument "+(u.isInteger()?"out of range: ":"not an integer: ")+G(u));if(!F)return new K(v);for(e=new K(I),l=r=new K(I),i=c=new K(I),y=m(F),a=e.e=y.length-v.e-1,e.c[0]=g[(o=a%f)<0?f+o:o],t=!t||u.comparedTo(e)>0?a>0?e:l:u,o=j,j=1/0,u=new K(y),c.c[0]=0;d=n(u,e,0,1),1!=(s=r.plus(d.times(i))).comparedTo(t);)r=i,i=s,l=c.plus(d.times(s=l)),c=s,e=u.minus(d.times(s=e)),u=s;return s=n(t.minus(r),i,0,1),c=c.plus(s.times(l)),r=r.plus(s.times(i)),c.s=l.s=v.s,p=n(l,i,a*=2,R).minus(v).abs().comparedTo(n(c,r,a,R).minus(v).abs())<1?[l,i]:[c,r],j=o,p},T.toNumber=function(){return+G(this)},T.toPrecision=function(t,e){return null!=t&&S(t,1,y),U(this,t,e,2)},T.toString=function(t){var e,n=this,i=n.s,s=n.e;return null===s?i?(e="Infinity",i<0&&(e="-"+e)):e="NaN":(null==t?e=s<=H||s>=N?A(m(n.c),s):E(m(n.c),s,"0"):10===t?e=E(m((n=Y(new K(n),P+s+1,R)).c),n.e,"0"):(S(t,2,M.length,"Base"),e=r(E(m(n.c),s,"0"),10,t,i,!0)),i<0&&n.c[0]&&(e="-"+e)),e},T.valueOf=T.toJSON=function(){return G(this)},T._isBigNumber=!0,"function"==typeof Symbol&&"symbol"==typeof Symbol.iterator&&(T[Symbol.toStringTag]="BigNumber",T[Symbol.for("nodejs.util.inspect.custom")]=T.valueOf),null!=e&&K.set(e),K}()).default=s.BigNumber=s,void 0===(r=function(){return s}.call(e,n,e,t))||(t.exports=r)}()},5:function(t,e,n){"use strict";(function(t){
/*!
* The buffer module from node.js, for the browser.
*
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
* @license MIT
*/
var r=n(58),i=n(59),s=n(60);function a(){return u.TYPED_ARRAY_SUPPORT?2147483647:1073741823}function o(t,e){if(a()<e)throw new RangeError("Invalid typed array length");return u.TYPED_ARRAY_SUPPORT?(t=new Uint8Array(e)).__proto__=u.prototype:(null===t&&(t=new u(e)),t.length=e),t}function u(t,e,n){if(!(u.TYPED_ARRAY_SUPPORT||this instanceof u))return new u(t,e,n);if("number"==typeof t){if("string"==typeof e)throw new Error("If encoding is specified then the first argument must be a string");return l(this,t)}return h(this,t,e,n)}function h(t,e,n,r){if("number"==typeof e)throw new TypeError('"value" argument must not be a number');return"undefined"!=typeof ArrayBuffer&&e instanceof ArrayBuffer?function(t,e,n,r){if(e.byteLength,n<0||e.byteLength<n)throw new RangeError("'offset' is out of bounds");if(e.byteLength<n+(r||0))throw new RangeError("'length' is out of bounds");e=void 0===n&&void 0===r?new Uint8Array(e):void 0===r?new Uint8Array(e,n):new Uint8Array(e,n,r);u.TYPED_ARRAY_SUPPORT?(t=e).__proto__=u.prototype:t=f(t,e);return t}(t,e,n,r):"string"==typeof e?function(t,e,n){"string"==typeof n&&""!==n||(n="utf8");if(!u.isEncoding(n))throw new TypeError('"encoding" must be a valid string encoding');var r=0|g(e,n),i=(t=o(t,r)).write(e,n);i!==r&&(t=t.slice(0,i));return t}(t,e,n):function(t,e){if(u.isBuffer(e)){var n=0|d(e.length);return 0===(t=o(t,n)).length?t:(e.copy(t,0,0,n),t)}if(e){if("undefined"!=typeof ArrayBuffer&&e.buffer instanceof ArrayBuffer||"length"in e)return"number"!=typeof e.length||(r=e.length)!=r?o(t,0):f(t,e);if("Buffer"===e.type&&s(e.data))return f(t,e.data)}var r;throw new TypeError("First argument must be a string, Buffer, ArrayBuffer, Array, or array-like object.")}(t,e)}function c(t){if("number"!=typeof t)throw new TypeError('"size" argument must be a number');if(t<0)throw new RangeError('"size" argument must not be negative')}function l(t,e){if(c(e),t=o(t,e<0?0:0|d(e)),!u.TYPED_ARRAY_SUPPORT)for(var n=0;n<e;++n)t[n]=0;return t}function f(t,e){var n=e.length<0?0:0|d(e.length);t=o(t,n);for(var r=0;r<n;r+=1)t[r]=255&e[r];return t}function d(t){if(t>=a())throw new RangeError("Attempt to allocate Buffer larger than maximum size: 0x"+a().toString(16)+" bytes");return 0|t}function g(t,e){if(u.isBuffer(t))return t.length;if("undefined"!=typeof ArrayBuffer&&"function"==typeof ArrayBuffer.isView&&(ArrayBuffer.isView(t)||t instanceof ArrayBuffer))return t.byteLength;"string"!=typeof t&&(t=""+t);var n=t.length;if(0===n)return 0;for(var r=!1;;)switch(e){case"ascii":case"latin1":case"binary":return n;case"utf8":case"utf-8":case void 0:return V(t).length;case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return 2*n;case"hex":return n>>>1;case"base64":return M(t).length;default:if(r)return V(t).length;e=(""+e).toLowerCase(),r=!0}}function p(t,e,n){var r=t[e];t[e]=t[n],t[n]=r}function y(t,e,n,r,i){if(0===t.length)return-1;if("string"==typeof n?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,isNaN(n)&&(n=i?0:t.length-1),n<0&&(n=t.length+n),n>=t.length){if(i)return-1;n=t.length-1}else if(n<0){if(!i)return-1;n=0}if("string"==typeof e&&(e=u.from(e,r)),u.isBuffer(e))return 0===e.length?-1:v(t,e,n,r,i);if("number"==typeof e)return e&=255,u.TYPED_ARRAY_SUPPORT&&"function"==typeof Uint8Array.prototype.indexOf?i?Uint8Array.prototype.indexOf.call(t,e,n):Uint8Array.prototype.lastIndexOf.call(t,e,n):v(t,[e],n,r,i);throw new TypeError("val must be string, number or Buffer")}function v(t,e,n,r,i){var s,a=1,o=t.length,u=e.length;if(void 0!==r&&("ucs2"===(r=String(r).toLowerCase())||"ucs-2"===r||"utf16le"===r||"utf-16le"===r)){if(t.length<2||e.length<2)return-1;a=2,o/=2,u/=2,n/=2}function h(t,e){return 1===a?t[e]:t.readUInt16BE(e*a)}if(i){var c=-1;for(s=n;s<o;s++)if(h(t,s)===h(e,-1===c?0:s-c)){if(-1===c&&(c=s),s-c+1===u)return c*a}else-1!==c&&(s-=s-c),c=-1}else for(n+u>o&&(n=o-u),s=n;s>=0;s--){for(var l=!0,f=0;f<u;f++)if(h(t,s+f)!==h(e,f)){l=!1;break}if(l)return s}return-1}function m(t,e,n,r){n=Number(n)||0;var i=t.length-n;r?(r=Number(r))>i&&(r=i):r=i;var s=e.length;if(s%2!=0)throw new TypeError("Invalid hex string");r>s/2&&(r=s/2);for(var a=0;a<r;++a){var o=parseInt(e.substr(2*a,2),16);if(isNaN(o))return a;t[n+a]=o}return a}function F(t,e,n,r){return K(V(e,t.length-n),t,n,r)}function S(t,e,n,r){return K(function(t){for(var e=[],n=0;n<t.length;++n)e.push(255&t.charCodeAt(n));return e}(e),t,n,r)}function b(t,e,n,r){return S(t,e,n,r)}function A(t,e,n,r){return K(M(e),t,n,r)}function E(t,e,n,r){return K(function(t,e){for(var n,r,i,s=[],a=0;a<t.length&&!((e-=2)<0);++a)n=t.charCodeAt(a),r=n>>8,i=n%256,s.push(i),s.push(r);return s}(e,t.length-n),t,n,r)}function w(t,e,n){return 0===e&&n===t.length?r.fromByteArray(t):r.fromByteArray(t.slice(e,n))}function x(t,e,n){n=Math.min(t.length,n);for(var r=[],i=e;i<n;){var s,a,o,u,h=t[i],c=null,l=h>239?4:h>223?3:h>191?2:1;if(i+l<=n)switch(l){case 1:h<128&&(c=h);break;case 2:128==(192&(s=t[i+1]))&&(u=(31&h)<<6|63&s)>127&&(c=u);break;case 3:s=t[i+1],a=t[i+2],128==(192&s)&&128==(192&a)&&(u=(15&h)<<12|(63&s)<<6|63&a)>2047&&(u<55296||u>57343)&&(c=u);break;case 4:s=t[i+1],a=t[i+2],o=t[i+3],128==(192&s)&&128==(192&a)&&128==(192&o)&&(u=(15&h)<<18|(63&s)<<12|(63&a)<<6|63&o)>65535&&u<1114112&&(c=u)}null===c?(c=65533,l=1):c>65535&&(c-=65536,r.push(c>>>10&1023|55296),c=56320|1023&c),r.push(c),i+=l}return function(t){var e=t.length;if(e<=C)return String.fromCharCode.apply(String,t);var n="",r=0;for(;r<e;)n+=String.fromCharCode.apply(String,t.slice(r,r+=C));return n}(r)}e.Buffer=u,e.SlowBuffer=function(t){+t!=t&&(t=0);return u.alloc(+t)},e.INSPECT_MAX_BYTES=50,u.TYPED_ARRAY_SUPPORT=void 0!==t.TYPED_ARRAY_SUPPORT?t.TYPED_ARRAY_SUPPORT:function(){try{var t=new Uint8Array(1);return t.__proto__={__proto__:Uint8Array.prototype,foo:function(){return 42}},42===t.foo()&&"function"==typeof t.subarray&&0===t.subarray(1,1).byteLength}catch(t){return!1}}(),e.kMaxLength=a(),u.poolSize=8192,u._augment=function(t){return t.__proto__=u.prototype,t},u.from=function(t,e,n){return h(null,t,e,n)},u.TYPED_ARRAY_SUPPORT&&(u.prototype.__proto__=Uint8Array.prototype,u.__proto__=Uint8Array,"undefined"!=typeof Symbol&&Symbol.species&&u[Symbol.species]===u&&Object.defineProperty(u,Symbol.species,{value:null,configurable:!0})),u.alloc=function(t,e,n){return function(t,e,n,r){return c(e),e<=0?o(t,e):void 0!==n?"string"==typeof r?o(t,e).fill(n,r):o(t,e).fill(n):o(t,e)}(null,t,e,n)},u.allocUnsafe=function(t){return l(null,t)},u.allocUnsafeSlow=function(t){return l(null,t)},u.isBuffer=function(t){return!(null==t||!t._isBuffer)},u.compare=function(t,e){if(!u.isBuffer(t)||!u.isBuffer(e))throw new TypeError("Arguments must be Buffers");if(t===e)return 0;for(var n=t.length,r=e.length,i=0,s=Math.min(n,r);i<s;++i)if(t[i]!==e[i]){n=t[i],r=e[i];break}return n<r?-1:r<n?1:0},u.isEncoding=function(t){switch(String(t).toLowerCase()){case"hex":case"utf8":case"utf-8":case"ascii":case"latin1":case"binary":case"base64":case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return!0;default:return!1}},u.concat=function(t,e){if(!s(t))throw new TypeError('"list" argument must be an Array of Buffers');if(0===t.length)return u.alloc(0);var n;if(void 0===e)for(e=0,n=0;n<t.length;++n)e+=t[n].length;var r=u.allocUnsafe(e),i=0;for(n=0;n<t.length;++n){var a=t[n];if(!u.isBuffer(a))throw new TypeError('"list" argument must be an Array of Buffers');a.copy(r,i),i+=a.length}return r},u.byteLength=g,u.prototype._isBuffer=!0,u.prototype.swap16=function(){var t=this.length;if(t%2!=0)throw new RangeError("Buffer size must be a multiple of 16-bits");for(var e=0;e<t;e+=2)p(this,e,e+1);return this},u.prototype.swap32=function(){var t=this.length;if(t%4!=0)throw new RangeError("Buffer size must be a multiple of 32-bits");for(var e=0;e<t;e+=4)p(this,e,e+3),p(this,e+1,e+2);return this},u.prototype.swap64=function(){var t=this.length;if(t%8!=0)throw new RangeError("Buffer size must be a multiple of 64-bits");for(var e=0;e<t;e+=8)p(this,e,e+7),p(this,e+1,e+6),p(this,e+2,e+5),p(this,e+3,e+4);return this},u.prototype.toString=function(){var t=0|this.length;return 0===t?"":0===arguments.length?x(this,0,t):function(t,e,n){var r=!1;if((void 0===e||e<0)&&(e=0),e>this.length)return"";if((void 0===n||n>this.length)&&(n=this.length),n<=0)return"";if((n>>>=0)<=(e>>>=0))return"";for(t||(t="utf8");;)switch(t){case"hex":return T(this,e,n);case"utf8":case"utf-8":return x(this,e,n);case"ascii":return D(this,e,n);case"latin1":case"binary":return B(this,e,n);case"base64":return w(this,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return I(this,e,n);default:if(r)throw new TypeError("Unknown encoding: "+t);t=(t+"").toLowerCase(),r=!0}}.apply(this,arguments)},u.prototype.equals=function(t){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");return this===t||0===u.compare(this,t)},u.prototype.inspect=function(){var t="",n=e.INSPECT_MAX_BYTES;return this.length>0&&(t=this.toString("hex",0,n).match(/.{2}/g).join(" "),this.length>n&&(t+=" ... ")),"<Buffer "+t+">"},u.prototype.compare=function(t,e,n,r,i){if(!u.isBuffer(t))throw new TypeError("Argument must be a Buffer");if(void 0===e&&(e=0),void 0===n&&(n=t?t.length:0),void 0===r&&(r=0),void 0===i&&(i=this.length),e<0||n>t.length||r<0||i>this.length)throw new RangeError("out of range index");if(r>=i&&e>=n)return 0;if(r>=i)return-1;if(e>=n)return 1;if(this===t)return 0;for(var s=(i>>>=0)-(r>>>=0),a=(n>>>=0)-(e>>>=0),o=Math.min(s,a),h=this.slice(r,i),c=t.slice(e,n),l=0;l<o;++l)if(h[l]!==c[l]){s=h[l],a=c[l];break}return s<a?-1:a<s?1:0},u.prototype.includes=function(t,e,n){return-1!==this.indexOf(t,e,n)},u.prototype.indexOf=function(t,e,n){return y(this,t,e,n,!0)},u.prototype.lastIndexOf=function(t,e,n){return y(this,t,e,n,!1)},u.prototype.write=function(t,e,n,r){if(void 0===e)r="utf8",n=this.length,e=0;else if(void 0===n&&"string"==typeof e)r=e,n=this.length,e=0;else{if(!isFinite(e))throw new Error("Buffer.write(string, encoding, offset[, length]) is no longer supported");e|=0,isFinite(n)?(n|=0,void 0===r&&(r="utf8")):(r=n,n=void 0)}var i=this.length-e;if((void 0===n||n>i)&&(n=i),t.length>0&&(n<0||e<0)||e>this.length)throw new RangeError("Attempt to write outside buffer bounds");r||(r="utf8");for(var s=!1;;)switch(r){case"hex":return m(this,t,e,n);case"utf8":case"utf-8":return F(this,t,e,n);case"ascii":return S(this,t,e,n);case"latin1":case"binary":return b(this,t,e,n);case"base64":return A(this,t,e,n);case"ucs2":case"ucs-2":case"utf16le":case"utf-16le":return E(this,t,e,n);default:if(s)throw new TypeError("Unknown encoding: "+r);r=(""+r).toLowerCase(),s=!0}},u.prototype.toJSON=function(){return{type:"Buffer",data:Array.prototype.slice.call(this._arr||this,0)}};var C=4096;function D(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(127&t[i]);return r}function B(t,e,n){var r="";n=Math.min(t.length,n);for(var i=e;i<n;++i)r+=String.fromCharCode(t[i]);return r}function T(t,e,n){var r=t.length;(!e||e<0)&&(e=0),(!n||n<0||n>r)&&(n=r);for(var i="",s=e;s<n;++s)i+=_(t[s]);return i}function I(t,e,n){for(var r=t.slice(e,n),i="",s=0;s<r.length;s+=2)i+=String.fromCharCode(r[s]+256*r[s+1]);return i}function P(t,e,n){if(t%1!=0||t<0)throw new RangeError("offset is not uint");if(t+e>n)throw new RangeError("Trying to access beyond buffer length")}function R(t,e,n,r,i,s){if(!u.isBuffer(t))throw new TypeError('"buffer" argument must be a Buffer instance');if(e>i||e<s)throw new RangeError('"value" argument is out of bounds');if(n+r>t.length)throw new RangeError("Index out of range")}function H(t,e,n,r){e<0&&(e=65535+e+1);for(var i=0,s=Math.min(t.length-n,2);i<s;++i)t[n+i]=(e&255<<8*(r?i:1-i))>>>8*(r?i:1-i)}function N(t,e,n,r){e<0&&(e=4294967295+e+1);for(var i=0,s=Math.min(t.length-n,4);i<s;++i)t[n+i]=e>>>8*(r?i:3-i)&255}function O(t,e,n,r,i,s){if(n+r>t.length)throw new RangeError("Index out of range");if(n<0)throw new RangeError("Index out of range")}function j(t,e,n,r,s){return s||O(t,0,n,4),i.write(t,e,n,r,23,4),n+4}function L(t,e,n,r,s){return s||O(t,0,n,8),i.write(t,e,n,r,52,8),n+8}u.prototype.slice=function(t,e){var n,r=this.length;if((t=~~t)<0?(t+=r)<0&&(t=0):t>r&&(t=r),(e=void 0===e?r:~~e)<0?(e+=r)<0&&(e=0):e>r&&(e=r),e<t&&(e=t),u.TYPED_ARRAY_SUPPORT)(n=this.subarray(t,e)).__proto__=u.prototype;else{var i=e-t;n=new u(i,void 0);for(var s=0;s<i;++s)n[s]=this[s+t]}return n},u.prototype.readUIntLE=function(t,e,n){t|=0,e|=0,n||P(t,e,this.length);for(var r=this[t],i=1,s=0;++s<e&&(i*=256);)r+=this[t+s]*i;return r},u.prototype.readUIntBE=function(t,e,n){t|=0,e|=0,n||P(t,e,this.length);for(var r=this[t+--e],i=1;e>0&&(i*=256);)r+=this[t+--e]*i;return r},u.prototype.readUInt8=function(t,e){return e||P(t,1,this.length),this[t]},u.prototype.readUInt16LE=function(t,e){return e||P(t,2,this.length),this[t]|this[t+1]<<8},u.prototype.readUInt16BE=function(t,e){return e||P(t,2,this.length),this[t]<<8|this[t+1]},u.prototype.readUInt32LE=function(t,e){return e||P(t,4,this.length),(this[t]|this[t+1]<<8|this[t+2]<<16)+16777216*this[t+3]},u.prototype.readUInt32BE=function(t,e){return e||P(t,4,this.length),16777216*this[t]+(this[t+1]<<16|this[t+2]<<8|this[t+3])},u.prototype.readIntLE=function(t,e,n){t|=0,e|=0,n||P(t,e,this.length);for(var r=this[t],i=1,s=0;++s<e&&(i*=256);)r+=this[t+s]*i;return r>=(i*=128)&&(r-=Math.pow(2,8*e)),r},u.prototype.readIntBE=function(t,e,n){t|=0,e|=0,n||P(t,e,this.length);for(var r=e,i=1,s=this[t+--r];r>0&&(i*=256);)s+=this[t+--r]*i;return s>=(i*=128)&&(s-=Math.pow(2,8*e)),s},u.prototype.readInt8=function(t,e){return e||P(t,1,this.length),128&this[t]?-1*(255-this[t]+1):this[t]},u.prototype.readInt16LE=function(t,e){e||P(t,2,this.length);var n=this[t]|this[t+1]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt16BE=function(t,e){e||P(t,2,this.length);var n=this[t+1]|this[t]<<8;return 32768&n?4294901760|n:n},u.prototype.readInt32LE=function(t,e){return e||P(t,4,this.length),this[t]|this[t+1]<<8|this[t+2]<<16|this[t+3]<<24},u.prototype.readInt32BE=function(t,e){return e||P(t,4,this.length),this[t]<<24|this[t+1]<<16|this[t+2]<<8|this[t+3]},u.prototype.readFloatLE=function(t,e){return e||P(t,4,this.length),i.read(this,t,!0,23,4)},u.prototype.readFloatBE=function(t,e){return e||P(t,4,this.length),i.read(this,t,!1,23,4)},u.prototype.readDoubleLE=function(t,e){return e||P(t,8,this.length),i.read(this,t,!0,52,8)},u.prototype.readDoubleBE=function(t,e){return e||P(t,8,this.length),i.read(this,t,!1,52,8)},u.prototype.writeUIntLE=function(t,e,n,r){(t=+t,e|=0,n|=0,r)||R(this,t,e,n,Math.pow(2,8*n)-1,0);var i=1,s=0;for(this[e]=255&t;++s<n&&(i*=256);)this[e+s]=t/i&255;return e+n},u.prototype.writeUIntBE=function(t,e,n,r){(t=+t,e|=0,n|=0,r)||R(this,t,e,n,Math.pow(2,8*n)-1,0);var i=n-1,s=1;for(this[e+i]=255&t;--i>=0&&(s*=256);)this[e+i]=t/s&255;return e+n},u.prototype.writeUInt8=function(t,e,n){return t=+t,e|=0,n||R(this,t,e,1,255,0),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),this[e]=255&t,e+1},u.prototype.writeUInt16LE=function(t,e,n){return t=+t,e|=0,n||R(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):H(this,t,e,!0),e+2},u.prototype.writeUInt16BE=function(t,e,n){return t=+t,e|=0,n||R(this,t,e,2,65535,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):H(this,t,e,!1),e+2},u.prototype.writeUInt32LE=function(t,e,n){return t=+t,e|=0,n||R(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e+3]=t>>>24,this[e+2]=t>>>16,this[e+1]=t>>>8,this[e]=255&t):N(this,t,e,!0),e+4},u.prototype.writeUInt32BE=function(t,e,n){return t=+t,e|=0,n||R(this,t,e,4,4294967295,0),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):N(this,t,e,!1),e+4},u.prototype.writeIntLE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);R(this,t,e,n,i-1,-i)}var s=0,a=1,o=0;for(this[e]=255&t;++s<n&&(a*=256);)t<0&&0===o&&0!==this[e+s-1]&&(o=1),this[e+s]=(t/a>>0)-o&255;return e+n},u.prototype.writeIntBE=function(t,e,n,r){if(t=+t,e|=0,!r){var i=Math.pow(2,8*n-1);R(this,t,e,n,i-1,-i)}var s=n-1,a=1,o=0;for(this[e+s]=255&t;--s>=0&&(a*=256);)t<0&&0===o&&0!==this[e+s+1]&&(o=1),this[e+s]=(t/a>>0)-o&255;return e+n},u.prototype.writeInt8=function(t,e,n){return t=+t,e|=0,n||R(this,t,e,1,127,-128),u.TYPED_ARRAY_SUPPORT||(t=Math.floor(t)),t<0&&(t=255+t+1),this[e]=255&t,e+1},u.prototype.writeInt16LE=function(t,e,n){return t=+t,e|=0,n||R(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8):H(this,t,e,!0),e+2},u.prototype.writeInt16BE=function(t,e,n){return t=+t,e|=0,n||R(this,t,e,2,32767,-32768),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>8,this[e+1]=255&t):H(this,t,e,!1),e+2},u.prototype.writeInt32LE=function(t,e,n){return t=+t,e|=0,n||R(this,t,e,4,2147483647,-2147483648),u.TYPED_ARRAY_SUPPORT?(this[e]=255&t,this[e+1]=t>>>8,this[e+2]=t>>>16,this[e+3]=t>>>24):N(this,t,e,!0),e+4},u.prototype.writeInt32BE=function(t,e,n){return t=+t,e|=0,n||R(this,t,e,4,2147483647,-2147483648),t<0&&(t=4294967295+t+1),u.TYPED_ARRAY_SUPPORT?(this[e]=t>>>24,this[e+1]=t>>>16,this[e+2]=t>>>8,this[e+3]=255&t):N(this,t,e,!1),e+4},u.prototype.writeFloatLE=function(t,e,n){return j(this,t,e,!0,n)},u.prototype.writeFloatBE=function(t,e,n){return j(this,t,e,!1,n)},u.prototype.writeDoubleLE=function(t,e,n){return L(this,t,e,!0,n)},u.prototype.writeDoubleBE=function(t,e,n){return L(this,t,e,!1,n)},u.prototype.copy=function(t,e,n,r){if(n||(n=0),r||0===r||(r=this.length),e>=t.length&&(e=t.length),e||(e=0),r>0&&r<n&&(r=n),r===n)return 0;if(0===t.length||0===this.length)return 0;if(e<0)throw new RangeError("targetStart out of bounds");if(n<0||n>=this.length)throw new RangeError("sourceStart out of bounds");if(r<0)throw new RangeError("sourceEnd out of bounds");r>this.length&&(r=this.length),t.length-e<r-n&&(r=t.length-e+n);var i,s=r-n;if(this===t&&n<e&&e<r)for(i=s-1;i>=0;--i)t[i+e]=this[i+n];else if(s<1e3||!u.TYPED_ARRAY_SUPPORT)for(i=0;i<s;++i)t[i+e]=this[i+n];else Uint8Array.prototype.set.call(t,this.subarray(n,n+s),e);return s},u.prototype.fill=function(t,e,n,r){if("string"==typeof t){if("string"==typeof e?(r=e,e=0,n=this.length):"string"==typeof n&&(r=n,n=this.length),1===t.length){var i=t.charCodeAt(0);i<256&&(t=i)}if(void 0!==r&&"string"!=typeof r)throw new TypeError("encoding must be a string");if("string"==typeof r&&!u.isEncoding(r))throw new TypeError("Unknown encoding: "+r)}else"number"==typeof t&&(t&=255);if(e<0||this.length<e||this.length<n)throw new RangeError("Out of range index");if(n<=e)return this;var s;if(e>>>=0,n=void 0===n?this.length:n>>>0,t||(t=0),"number"==typeof t)for(s=e;s<n;++s)this[s]=t;else{var a=u.isBuffer(t)?t:V(new u(t,r).toString()),o=a.length;for(s=0;s<n-e;++s)this[s+e]=a[s%o]}return this};var k=/[^+\/0-9A-Za-z-_]/g;function _(t){return t<16?"0"+t.toString(16):t.toString(16)}function V(t,e){var n;e=e||1/0;for(var r=t.length,i=null,s=[],a=0;a<r;++a){if((n=t.charCodeAt(a))>55295&&n<57344){if(!i){if(n>56319){(e-=3)>-1&&s.push(239,191,189);continue}if(a+1===r){(e-=3)>-1&&s.push(239,191,189);continue}i=n;continue}if(n<56320){(e-=3)>-1&&s.push(239,191,189),i=n;continue}n=65536+(i-55296<<10|n-56320)}else i&&(e-=3)>-1&&s.push(239,191,189);if(i=null,n<128){if((e-=1)<0)break;s.push(n)}else if(n<2048){if((e-=2)<0)break;s.push(n>>6|192,63&n|128)}else if(n<65536){if((e-=3)<0)break;s.push(n>>12|224,n>>6&63|128,63&n|128)}else{if(!(n<1114112))throw new Error("Invalid code point");if((e-=4)<0)break;s.push(n>>18|240,n>>12&63|128,n>>6&63|128,63&n|128)}}return s}function M(t){return r.toByteArray(function(t){if((t=function(t){return t.trim?t.trim():t.replace(/^\s+|\s+$/g,"")}(t).replace(k,"")).length<2)return"";for(;t.length%4!=0;)t+="=";return t}(t))}function K(t,e,n,r){for(var i=0;i<r&&!(i+n>=e.length||i>=t.length);++i)e[i+n]=t[i];return i}}).call(this,n(17))},58:function(t,e,n){"use strict";e.byteLength=function(t){var e=h(t),n=e[0],r=e[1];return 3*(n+r)/4-r},e.toByteArray=function(t){for(var e,n=h(t),r=n[0],a=n[1],o=new s(function(t,e,n){return 3*(e+n)/4-n}(0,r,a)),u=0,c=a>0?r-4:r,l=0;l<c;l+=4)e=i[t.charCodeAt(l)]<<18|i[t.charCodeAt(l+1)]<<12|i[t.charCodeAt(l+2)]<<6|i[t.charCodeAt(l+3)],o[u++]=e>>16&255,o[u++]=e>>8&255,o[u++]=255&e;2===a&&(e=i[t.charCodeAt(l)]<<2|i[t.charCodeAt(l+1)]>>4,o[u++]=255&e);1===a&&(e=i[t.charCodeAt(l)]<<10|i[t.charCodeAt(l+1)]<<4|i[t.charCodeAt(l+2)]>>2,o[u++]=e>>8&255,o[u++]=255&e);return o},e.fromByteArray=function(t){for(var e,n=t.length,i=n%3,s=[],a=0,o=n-i;a<o;a+=16383)s.push(c(t,a,a+16383>o?o:a+16383));1===i?(e=t[n-1],s.push(r[e>>2]+r[e<<4&63]+"==")):2===i&&(e=(t[n-2]<<8)+t[n-1],s.push(r[e>>10]+r[e>>4&63]+r[e<<2&63]+"="));return s.join("")};for(var r=[],i=[],s="undefined"!=typeof Uint8Array?Uint8Array:Array,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=0,u=a.length;o<u;++o)r[o]=a[o],i[a.charCodeAt(o)]=o;function h(t){var e=t.length;if(e%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var n=t.indexOf("=");return-1===n&&(n=e),[n,n===e?0:4-n%4]}function c(t,e,n){for(var i,s,a=[],o=e;o<n;o+=3)i=(t[o]<<16&16711680)+(t[o+1]<<8&65280)+(255&t[o+2]),a.push(r[(s=i)>>18&63]+r[s>>12&63]+r[s>>6&63]+r[63&s]);return a.join("")}i["-".charCodeAt(0)]=62,i["_".charCodeAt(0)]=63},59:function(t,e){e.read=function(t,e,n,r,i){var s,a,o=8*i-r-1,u=(1<<o)-1,h=u>>1,c=-7,l=n?i-1:0,f=n?-1:1,d=t[e+l];for(l+=f,s=d&(1<<-c)-1,d>>=-c,c+=o;c>0;s=256*s+t[e+l],l+=f,c-=8);for(a=s&(1<<-c)-1,s>>=-c,c+=r;c>0;a=256*a+t[e+l],l+=f,c-=8);if(0===s)s=1-h;else{if(s===u)return a?NaN:1/0*(d?-1:1);a+=Math.pow(2,r),s-=h}return(d?-1:1)*a*Math.pow(2,s-r)},e.write=function(t,e,n,r,i,s){var a,o,u,h=8*s-i-1,c=(1<<h)-1,l=c>>1,f=23===i?Math.pow(2,-24)-Math.pow(2,-77):0,d=r?0:s-1,g=r?1:-1,p=e<0||0===e&&1/e<0?1:0;for(e=Math.abs(e),isNaN(e)||e===1/0?(o=isNaN(e)?1:0,a=c):(a=Math.floor(Math.log(e)/Math.LN2),e*(u=Math.pow(2,-a))<1&&(a--,u*=2),(e+=a+l>=1?f/u:f*Math.pow(2,1-l))*u>=2&&(a++,u/=2),a+l>=c?(o=0,a=c):a+l>=1?(o=(e*u-1)*Math.pow(2,i),a+=l):(o=e*Math.pow(2,l-1)*Math.pow(2,i),a=0));i>=8;t[n+d]=255&o,d+=g,o/=256,i-=8);for(a=a<<i|o,h+=i;h>0;t[n+d]=255&a,d+=g,a/=256,h-=8);t[n+d-g]|=128*p}},60:function(t,e){var n={}.toString;t.exports=Array.isArray||function(t){return"[object Array]"==n.call(t)}},7:function(t,e,n){"use strict";n.d(e,"d",function(){return i}),n.d(e,"e",function(){return s}),n.d(e,"c",function(){return a}),n.d(e,"b",function(){return o}),n.d(e,"a",function(){return u});var r=n(0);
/**
* Hexadecimal functions.
*
* @author n1474335 [n1474335@gmail.com]
* @copyright Crown Copyright 2016
* @license Apache-2.0
*/function i(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:" ",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2;if(!t)return"";for(var r="",i=0;i<t.length;i++)r+=t[i].toString(16).padStart(n,"0")+e;return"0x"===e&&(r="0x"+r),"\\x"===e&&(r="\\x"+r),e.length?r.slice(0,-e.length):r}function s(t){if(!t)return"";for(var e=[],n=0;n<t.length;n++)e.push((t[n]>>>4).toString(16)),e.push((15&t[n]).toString(16));return e.join("")}function a(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"Auto",n=arguments.length>2&&void 0!==arguments[2]?arguments[2]:2;if("None"!==e){var i="Auto"===e?/[^a-f\d]/gi:r.a.regexRep(e);t=t.replace(i,"")}for(var s=[],a=0;a<t.length;a+=n)s.push(parseInt(t.substr(a,n),16));return s}var o=["Space","Comma","Semi-colon","Colon","Line feed","CRLF","0x","\\x","None"],u=["Auto"].concat(o)},78:function(t,e,n){(function(t){var n={userAgent:!1},r={};
/*!
Copyright (c) 2011, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.com/yui/license.html
version: 2.9.0
*/
if(void 0===i)var i={};i.lang={extend:function(t,e,r){if(!e||!t)throw new Error("YAHOO.lang.extend failed, please check that all dependencies are included.");var i=function(){};if(i.prototype=e.prototype,t.prototype=new i,t.prototype.constructor=t,t.superclass=e.prototype,e.prototype.constructor==Object.prototype.constructor&&(e.prototype.constructor=e),r){var s;for(s in r)t.prototype[s]=r[s];var a=function(){},o=["toString","valueOf"];try{/MSIE/.test(n.userAgent)&&(a=function(t,e){for(s=0;s<o.length;s+=1){var n=o[s],r=e[n];"function"==typeof r&&r!=Object.prototype[n]&&(t[n]=r)}})}catch(t){}a(t.prototype,r)}}};
/*! CryptoJS v3.1.2 core-fix.js
* code.google.com/p/crypto-js
* (c) 2009-2013 by Jeff Mott. All rights reserved.
* code.google.com/p/crypto-js/wiki/License
* THIS IS FIX of 'core.js' to fix Hmac issue.
* https://code.google.com/p/crypto-js/issues/detail?id=84
* https://crypto-js.googlecode.com/svn-history/r667/branches/3.x/src/core.js
*/
var s,a,o,u,h,c,l,f,d,g,p,y=y||(s=Math,o=(a={}).lib={},u=o.Base=function(){function t(){}return{extend:function(e){t.prototype=this;var n=new t;return e&&n.mixIn(e),n.hasOwnProperty("init")||(n.init=function(){n.$super.init.apply(this,arguments)}),n.init.prototype=n,n.$super=this,n},create:function(){var t=this.extend();return t.init.apply(t,arguments),t},init:function(){},mixIn:function(t){for(var e in t)t.hasOwnProperty(e)&&(this[e]=t[e]);t.hasOwnProperty("toString")&&(this.toString=t.toString)},clone:function(){return this.init.prototype.extend(this)}}}(),h=o.WordArray=u.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:4*t.length},toString:function(t){return(t||l).stringify(this)},concat:function(t){var e=this.words,n=t.words,r=this.sigBytes,i=t.sigBytes;if(this.clamp(),r%4)for(var s=0;s<i;s++){var a=n[s>>>2]>>>24-s%4*8&255;e[r+s>>>2]|=a<<24-(r+s)%4*8}else for(s=0;s<i;s+=4)e[r+s>>>2]=n[s>>>2];return this.sigBytes+=i,this},clamp:function(){var t=this.words,e=this.sigBytes;t[e>>>2]&=4294967295<<32-e%4*8,t.length=s.ceil(e/4)},clone:function(){var t=u.clone.call(this);return t.words=this.words.slice(0),t},random:function(t){for(var e=[],n=0;n<t;n+=4)e.push(4294967296*s.random()|0);return new h.init(e,t)}}),c=a.enc={},l=c.Hex={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],i=0;i<n;i++){var s=e[i>>>2]>>>24-i%4*8&255;r.push((s>>>4).toString(16)),r.push((15&s).toString(16))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;r<e;r+=2)n[r>>>3]|=parseInt(t.substr(r,2),16)<<24-r%8*4;return new h.init(n,e/2)}},f=c.Latin1={stringify:function(t){for(var e=t.words,n=t.sigBytes,r=[],i=0;i<n;i++){var s=e[i>>>2]>>>24-i%4*8&255;r.push(String.fromCharCode(s))}return r.join("")},parse:function(t){for(var e=t.length,n=[],r=0;r<e;r++)n[r>>>2]|=(255&t.charCodeAt(r))<<24-r%4*8;return new h.init(n,e)}},d=c.Utf8={stringify:function(t){try{return decodeURIComponent(escape(f.stringify(t)))}catch(t){throw new Error("Malformed UTF-8 data")}},parse:function(t){return f.parse(unescape(encodeURIComponent(t)))}},g=o.BufferedBlockAlgorithm=u.extend({reset:function(){this._data=new h.init,this._nDataBytes=0},_append:function(t){"string"==typeof t&&(t=d.parse(t)),this._data.concat(t),this._nDataBytes+=t.sigBytes},_process:function(t){var e=this._data,n=e.words,r=e.sigBytes,i=this.blockSize,a=r/(4*i),o=(a=t?s.ceil(a):s.max((0|a)-this._minBufferSize,0))*i,u=s.min(4*o,r);if(o){for(var c=0;c<o;c+=i)this._doProcessBlock(n,c);var l=n.splice(0,o);e.sigBytes-=u}return new h.init(l,u)},clone:function(){var t=u.clone.call(this);return t._data=this._data.clone(),t},_minBufferSize:0}),o.Hasher=g.extend({cfg:u.extend(),init:function(t){this.cfg=this.cfg.extend(t),this.reset()},reset:function(){g.reset.call(this),this._doReset()},update:function(t){return this._append(t),this._process(),this},finalize:function(t){return t&&this._append(t),this._doFinalize()},blockSize:16,_createHelper:function(t){return function(e,n){return new t.init(n).finalize(e)}},_createHmacHelper:function(t){return function(e,n){return new p.HMAC.init(t,n).finalize(e)}}}),p=a.algo={},a);!function(t){var e,n=(e=y).lib,r=n.Base,i=n.WordArray;(e=e.x64={}).Word=r.extend({init:function(t,e){this.high=t,this.low=e}}),e.WordArray=r.extend({init:function(t,e){t=this.words=t||[],this.sigBytes=null!=e?e:8*t.length},toX32:function(){for(var t=this.words,e=t.length,n=[],r=0;r<e;r++){var s=t[r];n.push(s.high),n.push(s.low)}return i.create(n,this.sigBytes)},clone:function(){for(var t=r.clone.call(this),e=t.words=this.words.slice(0),n=e.length,i=0;i<n;i++)e[i]=e[i].clone();return t}})}(),y.lib.Cipher||function(t){var e=(d=y).lib,n=e.Base,r=e.WordArray,i=e.BufferedBlockAlgorithm,s=d.enc.Base64,a=d.algo.EvpKDF,o=e.Cipher=i.extend({cfg:n.extend(),createEncryptor:function(t,e){return this.create(this._ENC_XFORM_MODE,t,e)},createDecryptor:function(t,e){return this.create(this._DEC_XFORM_MODE,t,e)},init:function(t,e,n){this.cfg=this.cfg.extend(n),this._xformMode=t,this._key=e,this.reset()},reset:function(){i.reset.call(this),this._doReset()},process:function(t){return this._append(t),this._process()},finalize:function(t){return t&&this._append(t),this._doFinalize()},keySize:4,ivSize:4,_ENC_XFORM_MODE:1,_DEC_XFORM_MODE:2,_createHelper:function(t){return{encrypt:function(e,n,r){return("string"==typeof n?g:f).encrypt(t,e,n,r)},decrypt:function(e,n,r){return("string"==typeof n?g:f).decrypt(t,e,n,r)}}}});e.StreamCipher=o.extend({_doFinalize:function(){return this._process(!0)},blockSize:1});var u=d.mode={},h=function(t,e,n){var r=this._iv;r?this._iv=void 0:r=this._prevBlock;for(var i=0;i<n;i++)t[e+i]^=r[i]},c=(e.BlockCipherMode=n.extend({createEncryptor:function(t,e){return this.Encryptor.create(t,e)},createDecryptor:function(t,e){return this.Decryptor.create(t,e)},init:function(t,e){this._cipher=t,this._iv=e}})).extend();c.Encryptor=c.extend({processBlock:function(t,e){var n=this._cipher,r=n.blockSize;h.call(this,t,e,r),n.encryptBlock(t,e),this._prevBlock=t.slice(e,e+r)}}),c.Decryptor=c.extend({processBlock:function(t,e){var n=this._cipher,r=n.blockSize,i=t.slice(e,e+r);n.decryptBlock(t,e),h.call(this,t,e,r),this._prevBlock=i}}),u=u.CBC=c,c=(d.pad={}).Pkcs7={pad:function(t,e){for(var n,i=(n=(n=4*e)-t.sigBytes%n)<<24|n<<16|n<<8|n,s=[],a=0;a<n;a+=4)s.push(i);n=r.create(s,n),t.concat(n)},unpad:function(t){t.sigBytes-=255&t.words[t.sigBytes-1>>>2]}},e.BlockCipher=o.extend({cfg:o.cfg.extend({mode:u,padding:c}),reset:function(){o.reset.call(this);var t=(e=this.cfg).iv,e=e.mode;if(this._xformMode==this._ENC_XFORM_MODE)var n=e.createEncryptor;else n=e.createDecryptor,this._minBufferSize=1;this._mode=n.call(e,this,t&&t.words)},_doProcessBlock:function(t,e){this._mode.processBlock(t,e)},_doFinalize:function(){var t=this.cfg.padding;if(this._xformMode==this._ENC_XFORM_MODE){t.pad(this._data,this.blockSize);var e=this._process(!0)}else e=this._process(!0),t.unpad(e);return e},blockSize:4});var l=e.CipherParams=n.extend({init:function(t){this.mixIn(t)},toString:function(t){return(t||this.formatter).stringify(this)}}),f=(u=(d.format={}).OpenSSL={stringify:function(t){var e=t.ciphertext;return((t=t.salt)?r.create([1398893684,1701076831]).concat(t).concat(e):e).toString(s)},parse:function(t){var e=(t=s.parse(t)).words;if(1398893684==e[0]&&1701076831==e[1]){var n=r.create(e.slice(2,4));e.splice(0,4),t.sigBytes-=16}return l.create({ciphertext:t,salt:n})}},e.SerializableCipher=n.extend({cfg:n.extend({format:u}),encrypt:function(t,e,n,r){r=this.cfg.extend(r);var i=t.createEncryptor(n,r);return e=i.finalize(e),i=i.cfg,l.create({ciphertext:e,key:n,iv:i.iv,algorithm:t,mode:i.mode,padding:i.padding,blockSize:t.blockSize,formatter:r.format})},decrypt:function(t,e,n,r){return r=this.cfg.extend(r),e=this._parse(e,r.format),t.createDecryptor(n,r).finalize(e.ciphertext)},_parse:function(t,e){return"string"==typeof t?e.parse(t,this):t}})),d=(d.kdf={}).OpenSSL={execute:function(t,e,n,i){return i||(i=r.random(8)),t=a.create({keySize:e+n}).compute(t,i),n=r.create(t.words.slice(e),4*n),t.sigBytes=4*e,l.create({key:t,iv:n,salt:i})}},g=e.PasswordBasedCipher=f.extend({cfg:f.cfg.extend({kdf:d}),encrypt:function(t,e,n,r){return n=(r=this.cfg.extend(r)).kdf.execute(n,t.keySize,t.ivSize),r.iv=n.iv,(t=f.encrypt.call(this,t,e,n.key,r)).mixIn(n),t},decrypt:function(t,e,n,r){return r=this.cfg.extend(r),e=this._parse(e,r.format),n=r.kdf.execute(n,t.keySize,t.ivSize,e.salt),r.iv=n.iv,f.decrypt.call(this,t,e,n.key,r)}})}(),function(){for(var t=y,e=t.lib.BlockCipher,n=t.algo,r=[],i=[],s=[],a=[],o=[],u=[],h=[],c=[],l=[],f=[],d=[],g=0;256>g;g++)d[g]=128>g?g<<1:g<<1^283;var p=0,v=0;for(g=0;256>g;g++){var m=(m=v^v<<1^v<<2^v<<3^v<<4)>>>8^255&m^99;r[p]=m,i[m]=p;var F=d[p],S=d[F],b=d[S],A=257*d[m]^16843008*m;s[p]=A<<24|A>>>8,a[p]=A<<16|A>>>16,o[p]=A<<8|A>>>24,u[p]=A,A=16843009*b^65537*S^257*F^16843008*p,h[m]=A<<24|A>>>8,c[m]=A<<16|A>>>16,l[m]=A<<8|A>>>24,f[m]=A,p?(p=F^d[d[d[b^F]]],v^=d[d[v]]):p=v=1}var E=[0,1,2,4,8,16,32,64,128,27,54];n=n.AES=e.extend({_doReset:function(){for(var t=(n=this._key).words,e=n.sigBytes/4,n=4*((this._nRounds=e+6)+1),i=this._keySchedule=[],s=0;s<n;s++)if(s<e)i[s]=t[s];else{var a=i[s-1];s%e?6<e&&4==s%e&&(a=r[a>>>24]<<24|r[a>>>16&255]<<16|r[a>>>8&255]<<8|r[255&a]):(a=r[(a=a<<8|a>>>24)>>>24]<<24|r[a>>>16&255]<<16|r[a>>>8&255]<<8|r[255&a],a^=E[s/e|0]<<24),i[s]=i[s-e]^a}for(t=this._invKeySchedule=[],e=0;e<n;e++)s=n-e,a=e%4?i[s]:i[s-4],t[e]=4>e||4>=s?a:h[r[a>>>24]]^c[r[a>>>16&255]]^l[r[a>>>8&255]]^f[r[255&a]]},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._keySchedule,s,a,o,u,r)},decryptBlock:function(t,e){var n=t[e+1];t[e+1]=t[e+3],t[e+3]=n,this._doCryptBlock(t,e,this._invKeySchedule,h,c,l,f,i),n=t[e+1],t[e+1]=t[e+3],t[e+3]=n},_doCryptBlock:function(t,e,n,r,i,s,a,o){for(var u=this._nRounds,h=t[e]^n[0],c=t[e+1]^n[1],l=t[e+2]^n[2],f=t[e+3]^n[3],d=4,g=1;g<u;g++){var p=r[h>>>24]^i[c>>>16&255]^s[l>>>8&255]^a[255&f]^n[d++],y=r[c>>>24]^i[l>>>16&255]^s[f>>>8&255]^a[255&h]^n[d++],v=r[l>>>24]^i[f>>>16&255]^s[h>>>8&255]^a[255&c]^n[d++];f=r[f>>>24]^i[h>>>16&255]^s[c>>>8&255]^a[255&l]^n[d++],h=p,c=y,l=v}p=(o[h>>>24]<<24|o[c>>>16&255]<<16|o[l>>>8&255]<<8|o[255&f])^n[d++],y=(o[c>>>24]<<24|o[l>>>16&255]<<16|o[f>>>8&255]<<8|o[255&h])^n[d++],v=(o[l>>>24]<<24|o[f>>>16&255]<<16|o[h>>>8&255]<<8|o[255&c])^n[d++],f=(o[f>>>24]<<24|o[h>>>16&255]<<16|o[c>>>8&255]<<8|o[255&l])^n[d++],t[e]=p,t[e+1]=y,t[e+2]=v,t[e+3]=f},keySize:8});t.AES=e._createHelper(n)}(),function(){function t(t,e){var n=(this._lBlock>>>t^this._rBlock)&e;this._rBlock^=n,this._lBlock^=n<<t}function e(t,e){var n=(this._rBlock>>>t^this._lBlock)&e;this._lBlock^=n,this._rBlock^=n<<t}var n=y,r=(i=n.lib).WordArray,i=i.BlockCipher,s=n.algo,a=[57,49,41,33,25,17,9,1,58,50,42,34,26,18,10,2,59,51,43,35,27,19,11,3,60,52,44,36,63,55,47,39,31,23,15,7,62,54,46,38,30,22,14,6,61,53,45,37,29,21,13,5,28,20,12,4],o=[14,17,11,24,1,5,3,28,15,6,21,10,23,19,12,4,26,8,16,7,27,20,13,2,41,52,31,37,47,55,30,40,51,45,33,48,44,49,39,56,34,53,46,42,50,36,29,32],u=[1,2,4,6,8,10,12,14,15,17,19,21,23,25,27,28],h=[{0:8421888,268435456:32768,536870912:8421378,805306368:2,1073741824:512,1342177280:8421890,1610612736:8389122,1879048192:8388608,2147483648:514,2415919104:8389120,2684354560:33280,2952790016:8421376,3221225472:32770,3489660928:8388610,3758096384:0,4026531840:33282,134217728:0,402653184:8421890,671088640:33282,939524096:32768,1207959552:8421888,1476395008:512,1744830464:8421378,2013265920:2,2281701376:8389120,2550136832:33280,2818572288:8421376,3087007744:8389122,3355443200:8388610,3623878656:32770,3892314112:514,4160749568:8388608,1:32768,268435457:2,536870913:8421888,805306369:8388608,1073741825:8421378,1342177281:33280,1610612737:512,1879048193:8389122,2147483649:8421890,2415919105:8421376,2684354561:8388610,2952790017:33282,3221225473:514,3489660929:8389120,3758096385:32770,4026531841:0,134217729:8421890,402653185:8421376,671088641:8388608,939524097:512,1207959553:32768,1476395009:8388610,1744830465:2,2013265921:33282,2281701377:32770,2550136833:8389122,2818572289:514,3087007745:8421888,3355443201:8389120,3623878657:0,3892314113:33280,4160749569:8421378},{0:1074282512,16777216:16384,33554432:524288,50331648:1074266128,67108864:1073741840,83886080:1074282496,100663296:1073758208,117440512:16,134217728:540672,150994944:1073758224,167772160:1073741824,184549376:540688,201326592:524304,218103808:0,234881024:16400,251658240:1074266112,8388608:1073758208,25165824:540688,41943040:16,58720256:1073758224,75497472:1074282512,92274688:1073741824,109051904:524288,125829120:1074266128,142606336:524304,159383552:0,176160768:16384,192937984:1074266112,209715200:1073741840,226492416:540672,243269632:1074282496,260046848:16400,268435456:0,285212672:1074266128,301989888:1073758224,318767104:1074282496,335544320:1074266112,352321536:16,369098752:540688,385875968:16384,402653184:16400,419430400:524288,436207616:524304,452984832:1073741840,469762048:540672,486539264:1073758208,503316480:1073741824,520093696:1074282512,276824064:540688,293601280:524288,310378496:1074266112,327155712:16384,343932928:1073758208,360710144:1074282512,377487360:16,394264576:1073741824,411041792:1074282496,427819008:1073741840,444596224:1073758224,461373440:524304,478150656:0,494927872:16400,511705088:1074266128,528482304:540672},{0:260,1048576:0,2097152:67109120,3145728:65796,4194304:65540,5242880:67108868,6291456:67174660,7340032:67174400,8388608:67108864,9437184:67174656,10485760:65792,11534336:67174404,12582912:67109124,13631488:65536,14680064:4,15728640:256,524288:67174656,1572864:67174404,2621440:0,3670016:67109120,4718592:67108868,5767168:65536,6815744:65540,7864320:260,8912896:4,9961472:256,11010048:67174400,12058624:65796,13107200:65792,14155776:67109124,15204352:67174660,16252928:67108864,16777216:67174656,17825792:65540,18874368:65536,19922944:67109120,20971520:256,22020096:67174660,23068672:67108868,24117248:0,25165824:67109124,26214400:67108864,27262976:4,28311552:65792,29360128:67174400,30408704:260,31457280:65796,32505856:67174404,17301504:67108864,18350080:260,19398656:67174656,20447232:0,21495808:65540,22544384:67109120,23592960:256,24641536:67174404,25690112:65536,26738688:67174660,27787264:65796,28835840:67108868,29884416:67109124,30932992:67174400,31981568:4,33030144:65792},{0:2151682048,65536:2147487808,131072:4198464,196608:2151677952,262144:0,327680:4198400,393216:2147483712,458752:4194368,524288:2147483648,589824:4194304,655360:64,720896:2147487744,786432:2151678016,851968:4160,917504:4096,983040:2151682112,32768:2147487808,98304:64,163840:2151678016,229376:2147487744,294912:4198400,360448:2151682112,425984:0,491520:2151677952,557056:4096,622592:2151682048,688128:4194304,753664:4160,819200:2147483648,884736:4194368,950272:4198464,1015808:2147483712,1048576:4194368,1114112:4198400,1179648:2147483712,1245184:0,1310720:4160,1376256:2151678016,1441792:2151682048,1507328:2147487808,1572864:2151682112,1638400:2147483648,1703936:2151677952,1769472:4198464,1835008:2147487744,1900544:4194304,1966080:64,2031616:4096,1081344:2151677952,1146880:2151682112,1212416:0,1277952:4198400,1343488:4194368,1409024:2147483648,1474560:2147487808,1540096:64,1605632:2147483712,1671168:4096,1736704:2147487744,1802240:2151678016,1867776:4160,1933312:2151682048,1998848:4194304,2064384:4198464},{0:128,4096:17039360,8192:262144,12288:536870912,16384:537133184,20480:16777344,24576:553648256,28672:262272,32768:16777216,36864:537133056,40960:536871040,45056:553910400,49152:553910272,53248:0,57344:17039488,61440:553648128,2048:17039488,6144:553648256,10240:128,14336:17039360,18432:262144,22528:537133184,26624:553910272,30720:536870912,34816:537133056,38912:0,43008:553910400,47104:16777344,51200:536871040,55296:553648128,59392:16777216,63488:262272,65536:262144,69632:128,73728:536870912,77824:553648256,81920:16777344,86016:553910272,90112:537133184,94208:16777216,98304:553910400,102400:553648128,106496:17039360,110592:537133056,114688:262272,118784:536871040,122880:0,126976:17039488,67584:553648256,71680:16777216,75776:17039360,79872:537133184,83968:536870912,88064:17039488,92160:128,96256:553910272,100352:262272,104448:553910400,108544:0,112640:553648128,116736:16777344,120832:262144,124928:537133056,129024:536871040},{0:268435464,256:8192,512:270532608,768:270540808,1024:268443648,1280:2097152,1536:2097160,1792:268435456,2048:0,2304:268443656,2560:2105344,2816:8,3072:270532616,3328:2105352,3584:8200,3840:270540800,128:270532608,384:270540808,640:8,896:2097152,1152:2105352,1408:268435464,1664:268443648,1920:8200,2176:2097160,2432:8192,2688:268443656,2944:270532616,3200:0,3456:270540800,3712:2105344,3968:268435456,4096:268443648,4352:270532616,4608:270540808,4864:8200,5120:2097152,5376:268435456,5632:268435464,5888:2105344,6144:2105352,6400:0,6656:8,6912:270532608,7168:8192,7424:268443656,7680:270540800,7936:2097160,4224:8,4480:2105344,4736:2097152,4992:268435464,5248:268443648,5504:8200,5760:270540808,6016:270532608,6272:270540800,6528:270532616,6784:8192,7040:2105352,7296:2097160,7552:0,7808:268435456,8064:268443656},{0:1048576,16:33555457,32:1024,48:1049601,64:34604033,80:0,96:1,112:34603009,128:33555456,144:1048577,160:33554433,176:34604032,192:34603008,208:1025,224:1049600,240:33554432,8:34603009,24:0,40:33555457,56:34604032,72:1048576,88:33554433,104:33554432,120:1025,136:1049601,152:33555456,168:34603008,184:1048577,200:1024,216:34604033,232:1,248:1049600,256:33554432,272:1048576,288:33555457,304:34603009,320:1048577,336:33555456,352:34604032,368:1049601,384:1025,400:34604033,416:1049600,432:1,448:0,464:34603008,480:33554433,496:1024,264:1049600,280:33555457,296:34603009,312:1,328:33554432,344:1048576,360:1025,376:34604032,392:33554433,408:34603008,424:0,440:34604033,456:1049601,472:1024,488:33555456,504:1048577},{0:134219808,1:131072,2:134217728,3:32,4:131104,5:134350880,6:134350848,7:2048,8:134348800,9:134219776,10:133120,11:134348832,12:2080,13:0,14:134217760,15:133152,2147483648:2048,2147483649:134350880,2147483650:134219808,2147483651:134217728,2147483652:134348800,2147483653:133120,2147483654:133152,2147483655:32,2147483656:134217760,2147483657:2080,2147483658:131104,2147483659:134350848,2147483660:0,2147483661:134348832,2147483662:134219776,2147483663:131072,16:133152,17:134350848,18:32,19:2048,20:134219776,21:134217760,22:134348832,23:131072,24:0,25:131104,26:134348800,27:134219808,28:134350880,29:133120,30:2080,31:134217728,2147483664:131072,2147483665:2048,2147483666:134348832,2147483667:133152,2147483668:32,2147483669:134348800,2147483670:134217728,2147483671:134219808,2147483672:134350880,2147483673:134217760,2147483674:134219776,2147483675:0,2147483676:133120,2147483677:2080,2147483678:131104,2147483679:134350848}],c=[4160749569,528482304,33030144,2064384,129024,8064,504,2147483679],l=s.DES=i.extend({_doReset:function(){for(var t=this._key.words,e=[],n=0;56>n;n++){var r=a[n]-1;e[n]=t[r>>>5]>>>31-r%32&1}for(t=this._subKeys=[],r=0;16>r;r++){var i=t[r]=[],s=u[r];for(n=0;24>n;n++)i[n/6|0]|=e[(o[n]-1+s)%28]<<31-n%6,i[4+(n/6|0)]|=e[28+(o[n+24]-1+s)%28]<<31-n%6;for(i[0]=i[0]<<1|i[0]>>>31,n=1;7>n;n++)i[n]>>>=4*(n-1)+3;i[7]=i[7]<<5|i[7]>>>27}for(e=this._invSubKeys=[],n=0;16>n;n++)e[n]=t[15-n]},encryptBlock:function(t,e){this._doCryptBlock(t,e,this._subKeys)},decryptBlock:function(t,e){this._doCryptBlock(t,e,this._invSubKeys)},_doCryptBlock:function(n,r,i){this._lBlock=n[r],this._rBlock=n[r+1],t.call(this,4,252645135),t.call(this,16,65535),e.call(this,2,858993459),e.call(this,8,16711935),t.call(this,1,1431655765);for(var s=0;16>s;s++){for(var a=i[s],o=this._lBlock,u=this._rBlock,l=0,f=0;8>f;f++)l|=h[f][((u^a[f])&c[f])>>>0];this._lBlock=u,this._rBlock=o^l}i=this._lBlock,this._lBlock=this._rBlock,this._rBlock=i,t.call(this,1,1431655765),e.call(this,8,16711935),e.call(this,2,858993459),t.call(this,16,65535),t.call(this,4,252645135),n[r]=this._lBlock,n[r+1]=this._rBlock},keySize:2,ivSize:2,blockSize:2});n.DES=i._createHelper(l),s=s.TripleDES=i.extend({_doReset:function(){var t=this._key.words;this._des1=l.createEncryptor(r.create(t.slice(0,2))),this._des2=l.createEncryptor(r.create(t.slice(2,4))),this._des3=l.createEncryptor(r.create(t.slice(4,6)))},encryptBlock:function(t,e){this._des1.encryptBlock(t,e),this._des2.decryptBlock(t,e),this._des3.encryptBlock(t,e)},decryptBlock:function(t,e){this._des3.decryptBlock(t,e),this._des2.encryptBlock(t,e),this._des1.decryptBlock(t,e)},keySize:6,ivSize:2,blockSize:2}),n.TripleDES=i._createHelper(s)}(),function(){var t=y,e=t.lib.WordArray;t.enc.Base64={stringify:function(t){var e=t.words,n=t.sigBytes,r=this._map;t.clamp(),t=[];for(var i=0;i<n;i+=3)for(var s=(e[i>>>2]>>>24-i%4*8&255)<<16|(e[i+1>>>2]>>>24-(i+1)%4*8&255)<<8|e[i+2>>>2]>>>24-(i+2)%4*8&255,a=0;4>a&&i+.75*a<n;a++)t.push(r.charAt(s>>>6*(3-a)&63));if(e=r.charAt(64))for(;t.length%4;)t.push(e);return t.join("")},parse:function(t){var n=t.length,r=this._map;(i=r.charAt(64))&&(-1!=(i=t.indexOf(i))&&(n=i));for(var i=[],s=0,a=0;a<n;a++)if(a%4){var o=r.indexOf(t.charAt(a-1))<<a%4*2,u=r.indexOf(t.charAt(a))>>>6-a%4*2;i[s>>>2]|=(o|u)<<24-s%4*8,s++}return e.create(i,s)},_map:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="}}(),function(t){function e(t,e,n,r,i,s,a){return((t=t+(e&n|~e&r)+i+a)<<s|t>>>32-s)+e}function n(t,e,n,r,i,s,a){return((t=t+(e&r|n&~r)+i+a)<<s|t>>>32-s)+e}function r(t,e,n,r,i,s,a){return((t=t+(e^n^r)+i+a)<<s|t>>>32-s)+e}function i(t,e,n,r,i,s,a){return((t=t+(n^(e|~r))+i+a)<<s|t>>>32-s)+e}for(var s=y,a=(u=s.lib).WordArray,o=u.Hasher,u=s.algo,h=[],c=0;64>c;c++)h[c]=4294967296*t.abs(t.sin(c+1))|0;u=u.MD5=o.extend({_doReset:function(){this._hash=new a.init([1732584193,4023233417,2562383102,271733878])},_doProcessBlock:function(t,s){for(var a=0;16>a;a++){var o=t[u=s+a];t[u]=16711935&(o<<8|o>>>24)|4278255360&(o<<24|o>>>8)}a=this._hash.words;var u=t[s+0],c=(o=t[s+1],t[s+2]),l=t[s+3],f=t[s+4],d=t[s+5],g=t[s+6],p=t[s+7],y=t[s+8],v=t[s+9],m=t[s+10],F=t[s+11],S=t[s+12],b=t[s+13],A=t[s+14],E=t[s+15],w=e(w=a[0],D=a[1],C=a[2],x=a[3],u,7,h[0]),x=e(x,w,D,C,o,12,h[1]),C=e(C,x,w,D,c,17,h[2]),D=e(D,C,x,w,l,22,h[3]);w=e(w,D,C,x,f,7,h[4]),x=e(x,w,D,C,d,12,h[5]),C=e(C,x,w,D,g,17,h[6]),D=e(D,C,x,w,p,22,h[7]),w=e(w,D,C,x,y,7,h[8]),x=e(x,w,D,C,v,12,h[9]),C=e(C,x,w,D,m,17,h[10]),D=e(D,C,x,w,F,22,h[11]),w=e(w,D,C,x,S,7,h[12]),x=e(x,w,D,C,b,12,h[13]),C=e(C,x,w,D,A,17,h[14]),w=n(w,D=e(D,C,x,w,E,22,h[15]),C,x,o,5,h[16]),x=n(x,w,D,C,g,9,h[17]),C=n(C,x,w,D,F,14,h[18]),D=n(D,C,x,w,u,20,h[19]),w=n(w,D,C,x,d,5,h[20]),x=n(x,w,D,C,m,9,h[21]),C=n(C,x,w,D,E,14,h[22]),D=n(D,C,x,w,f,20,h[23]),w=n(w,D,C,x,v,5,h[24]),x=n(x,w,D,C,A,9,h[25]),C=n(C,x,w,D,l,14,h[26]),D=n(D,C,x,w,y,20,h[27]),w=n(w,D,C,x,b,5,h[28]),x=n(x,w,D,C,c,9,h[29]),C=n(C,x,w,D,p,14,h[30]),w=r(w,D=n(D,C,x,w,S,20,h[31]),C,x,d,4,h[32]),x=r(x,w,D,C,y,11,h[33]),C=r(C,x,w,D,F,16,h[34]),D=r(D,C,x,w,A,23,h[35]),w=r(w,D,C,x,o,4,h[36]),x=r(x,w,D,C,f,11,h[37]),C=r(C,x,w,D,p,16,h[38]),D=r(D,C,x,w,m,23,h[39]),w=r(w,D,C,x,b,4,h[40]),x=r(x,w,D,C,u,11,h[41]),C=r(C,x,w,D,l,16,h[42]),D=r(D,C,x,w,g,23,h[43]),w=r(w,D,C,x,v,4,h[44]),x=r(x,w,D,C,S,11,h[45]),C=r(C,x,w,D,E,16,h[46]),w=i(w,D=r(D,C,x,w,c,23,h[47]),C,x,u,6,h[48]),x=i(x,w,D,C,p,10,h[49]),C=i(C,x,w,D,A,15,h[50]),D=i(D,C,x,w,d,21,h[51]),w=i(w,D,C,x,S,6,h[52]),x=i(x,w,D,C,l,10,h[53]),C=i(C,x,w,D,m,15,h[54]),D=i(D,C,x,w,o,21,h[55]),w=i(w,D,C,x,y,6,h[56]),x=i(x,w,D,C,E,10,h[57]),C=i(C,x,w,D,g,15,h[58]),D=i(D,C,x,w,b,21,h[59]),w=i(w,D,C,x,f,6,h[60]),x=i(x,w,D,C,F,10,h[61]),C=i(C,x,w,D,c,15,h[62]),D=i(D,C,x,w,v,21,h[63]);a[0]=a[0]+w|0,a[1]=a[1]+D|0,a[2]=a[2]+C|0,a[3]=a[3]+x|0},_doFinalize:function(){var e=this._data,n=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;n[i>>>5]|=128<<24-i%32;var s=t.floor(r/4294967296);for(n[15+(i+64>>>9<<4)]=16711935&(s<<8|s>>>24)|4278255360&(s<<24|s>>>8),n[14+(i+64>>>9<<4)]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8),e.sigBytes=4*(n.length+1),this._process(),n=(e=this._hash).words,r=0;4>r;r++)i=n[r],n[r]=16711935&(i<<8|i>>>24)|4278255360&(i<<24|i>>>8);return e},clone:function(){var t=o.clone.call(this);return t._hash=this._hash.clone(),t}}),s.MD5=o._createHelper(u),s.HmacMD5=o._createHmacHelper(u)}(Math),function(){var t=y,e=(i=t.lib).WordArray,n=i.Hasher,r=[],i=t.algo.SHA1=n.extend({_doReset:function(){this._hash=new e.init([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var n=this._hash.words,i=n[0],s=n[1],a=n[2],o=n[3],u=n[4],h=0;80>h;h++){if(16>h)r[h]=0|t[e+h];else{var c=r[h-3]^r[h-8]^r[h-14]^r[h-16];r[h]=c<<1|c>>>31}c=(i<<5|i>>>27)+u+r[h],c=20>h?c+(1518500249+(s&a|~s&o)):40>h?c+(1859775393+(s^a^o)):60>h?c+((s&a|s&o|a&o)-1894007588):c+((s^a^o)-899497514),u=o,o=a,a=s<<30|s>>>2,s=i,i=c}n[0]=n[0]+i|0,n[1]=n[1]+s|0,n[2]=n[2]+a|0,n[3]=n[3]+o|0,n[4]=n[4]+u|0},_doFinalize:function(){var t=this._data,e=t.words,n=8*this._nDataBytes,r=8*t.sigBytes;return e[r>>>5]|=128<<24-r%32,e[14+(r+64>>>9<<4)]=Math.floor(n/4294967296),e[15+(r+64>>>9<<4)]=n,t.sigBytes=4*e.length,this._process(),this._hash},clone:function(){var t=n.clone.call(this);return t._hash=this._hash.clone(),t}});t.SHA1=n._createHelper(i),t.HmacSHA1=n._createHmacHelper(i)}(),function(t){for(var e=y,n=(i=e.lib).WordArray,r=i.Hasher,i=e.algo,s=[],a=[],o=function(t){return 4294967296*(t-(0|t))|0},u=2,h=0;64>h;){var c;t:{c=u;for(var l=t.sqrt(c),f=2;f<=l;f++)if(!(c%f)){c=!1;break t}c=!0}c&&(8>h&&(s[h]=o(t.pow(u,.5))),a[h]=o(t.pow(u,1/3)),h++),u++}var d=[];i=i.SHA256=r.extend({_doReset:function(){this._hash=new n.init(s.slice(0))},_doProcessBlock:function(t,e){for(var n=this._hash.words,r=n[0],i=n[1],s=n[2],o=n[3],u=n[4],h=n[5],c=n[6],l=n[7],f=0;64>f;f++){if(16>f)d[f]=0|t[e+f];else{var g=d[f-15],p=d[f-2];d[f]=((g<<25|g>>>7)^(g<<14|g>>>18)^g>>>3)+d[f-7]+((p<<15|p>>>17)^(p<<13|p>>>19)^p>>>10)+d[f-16]}g=l+((u<<26|u>>>6)^(u<<21|u>>>11)^(u<<7|u>>>25))+(u&h^~u&c)+a[f]+d[f],p=((r<<30|r>>>2)^(r<<19|r>>>13)^(r<<10|r>>>22))+(r&i^r&s^i&s),l=c,c=h,h=u,u=o+g|0,o=s,s=i,i=r,r=g+p|0}n[0]=n[0]+r|0,n[1]=n[1]+i|0,n[2]=n[2]+s|0,n[3]=n[3]+o|0,n[4]=n[4]+u|0,n[5]=n[5]+h|0,n[6]=n[6]+c|0,n[7]=n[7]+l|0},_doFinalize:function(){var e=this._data,n=e.words,r=8*this._nDataBytes,i=8*e.sigBytes;return n[i>>>5]|=128<<24-i%32,n[14+(i+64>>>9<<4)]=t.floor(r/4294967296),n[15+(i+64>>>9<<4)]=r,e.sigBytes=4*n.length,this._process(),this._hash},clone:function(){var t=r.clone.call(this);return t._hash=this._hash.clone(),t}});e.SHA256=r._createHelper(i),e.HmacSHA256=r._createHmacHelper(i)}(Math),function(){var t=y,e=t.lib.WordArray,n=(r=t.algo).SHA256,r=r.SHA224=n.extend({_doReset:function(){this._hash=new e.init([3238371032,914150663,812702999,4144912697,4290775857,1750603025,1694076839,3204075428])},_doFinalize:function(){var t=n._doFinalize.call(this);return t.sigBytes-=4,t}});t.SHA224=n._createHelper(r),t.HmacSHA224=n._createHmacHelper(r)}(),function(){function t(){return r.create.apply(r,arguments)}for(var e=y,n=e.lib.Hasher,r=(s=e.x64).Word,i=s.WordArray,s=e.algo,a=[t(1116352408,3609767458),t(1899447441,602891725),t(3049323471,3964484399),t(3921009573,2173295548),t(961987163,4081628472),t(1508970993,3053834265),t(2453635748,2937671579),t(2870763221,3664609560),t(3624381080,2734883394),t(310598401,1164996542),t(607225278,1323610764),t(1426881987,3590304994),t(1925078388,4068182383),t(2162078206,991336113),t(2614888103,633803317),t(3248222580,3479774868),t(3835390401,2666613458),t(4022224774,944711139),t(264347078,2341262773),t(604807628,2007800933),t(770255983,1495990901),t(1249150122,1856431235),t(1555081692,3175218132),t(1996064986,2198950837),t(2554220882,3999719339),t(2821834349,766784016),t(2952996808,2566594879),t(3210313671,3203337956),t(3336571891,1034457026),t(3584528711,2466948901),t(113926993,3758326383),t(338241895,168717936),t(666307205,1188179964),t(773529912,1546045734),t(1294757372,1522805485),t(1396182291,2643833823),t(1695183700,2343527390),t(1986661051,1014477480),t(2177026350,1206759142),t(2456956037,344077627),t(2730485921,1290863460),t(2820302411,3158454273),t(3259730800,3505952657),t(3345764771,106217008),t(3516065817,3606008344),t(3600352804,1432725776),t(4094571909,1467031594),t(275423344,851169720),t(430227734,3100823752),t(506948616,1363258195),t(659060556,3750685593),t(883997877,3785050280),t(958139571,3318307427),t(1322822218,3812723403),t(1537002063,2003034995),t(1747873779,3602036899),t(1955562222,1575990012),t(2024104815,1125592928),t(2227730452,2716904306),t(2361852424,442776044),t(2428436474,593698344),t(2756734187,3733110249),t(3204031479,2999351573),t(3329325298,3815920427),t(3391569614,3928383900),t(3515267271,566280711),t(3940187606,3454069534),t(4118630271,4000239992),t(116418474,1914138554),t(174292421,2731055270),t(289380356,3203993006),t(460393269,320620315),t(685471733,587496836),t(852142971,1086792851),t(1017036298,365543100),t(1126000580,2618297676),t(1288033470,3409855158),t(1501505948,4234509866),t(1607167915,987167468),t(1816402316,1246189591)],o=[],u=0;80>u;u++)o[u]=t();s=s.SHA512=n.extend({_doReset:function(){this._hash=new i.init([new r.init(1779033703,4089235720),new r.init(3144134277,2227873595),new r.init(1013904242,4271175723),new r.init(2773480762,1595750129),new r.init(1359893119,2917565137),new r.init(2600822924,725511199),new r.init(528734635,4215389547),new r.init(1541459225,327033209)])},_doProcessBlock:function(t,e){for(var n=(l=this._hash.words)[0],r=l[1],i=l[2],s=l[3],u=l[4],h=l[5],c=l[6],l=l[7],f=n.high,d=n.low,g=r.high,p=r.low,y=i.high,v=i.low,m=s.high,F=s.low,S=u.high,b=u.low,A=h.high,E=h.low,w=c.high,x=c.low,C=l.high,D=l.low,B=f,T=d,I=g,P=p,R=y,H=v,N=m,O=F,j=S,L=b,k=A,_=E,V=w,M=x,K=C,U=D,q=0;80>q;q++){var z=o[q];if(16>q)var Y=z.high=0|t[e+2*q],G=z.low=0|t[e+2*q+1];else{Y=((G=(Y=o[q-15]).high)>>>1|(J=Y.low)<<31)^(G>>>8|J<<24)^G>>>7;var J=(J>>>1|G<<31)^(J>>>8|G<<24)^(J>>>7|G<<25),W=((G=(W=o[q-2]).high)>>>19|(X=W.low)<<13)^(G<<3|X>>>29)^G>>>6,X=(X>>>19|G<<13)^(X<<3|G>>>29)^(X>>>6|G<<26),$=(G=o[q-7]).high,Z=(Q=o[q-16]).high,Q=Q.low;Y=(Y=(Y=Y+$+((G=J+G.low)>>>0<J>>>0?1:0))+W+((G=G+X)>>>0<X>>>0?1:0))+Z+((G=G+Q)>>>0<Q>>>0?1:0);z.high=Y,z.low=G}$=j&k^~j&V,Q=L&_^~L&M,z=B&I^B&R^I&R;var tt=T&P^T&H^P&H,et=(J=(B>>>28|T<<4)^(B<<30|T>>>2)^(B<<25|T>>>7),W=(T>>>28|B<<4)^(T<<30|B>>>2)^(T<<25|B>>>7),(X=a[q]).high),nt=X.low;Z=K+((j>>>14|L<<18)^(j>>>18|L<<14)^(j<<23|L>>>9))+((X=U+((L>>>14|j<<18)^(L>>>18|j<<14)^(L<<23|j>>>9)))>>>0<U>>>0?1:0),K=V,U=M,V=k,M=_,k=j,_=L,j=N+(Z=(Z=(Z=Z+$+((X=X+Q)>>>0<Q>>>0?1:0))+et+((X=X+nt)>>>0<nt>>>0?1:0))+Y+((X=X+G)>>>0<G>>>0?1:0))+((L=O+X|0)>>>0<O>>>0?1:0)|0,N=R,O=H,R=I,H=P,I=B,P=T,B=Z+(z=J+z+((G=W+tt)>>>0<W>>>0?1:0))+((T=X+G|0)>>>0<X>>>0?1:0)|0}d=n.low=d+T,n.high=f+B+(d>>>0<T>>>0?1:0),p=r.low=p+P,r.high=g+I+(p>>>0<P>>>0?1:0),v=i.low=v+H,i.high=y+R+(v>>>0<H>>>0?1:0),F=s.low=F+O,s.high=m+N+(F>>>0<O>>>0?1:0),b=u.low=b+L,u.high=S+j+(b>>>0<L>>>0?1:0),E=h.low=E+_,h.high=A+k+(E>>>0<_>>>0?1:0),x=c.low=x+M,c.high=w+V+(x>>>0<M>>>0?1:0),D=l.low=D+U,l.high=C+K+(D>>>0<U>>>0?1:0)},_doFinalize:function(){var t=this._data,e=t.words,n=8*this._nDataBytes,r=8*t.sigBytes;return e[r>>>5]|=128<<24-r%32,e[30+(r+128>>>10<<5)]=Math.floor(n/4294967296),e[31+(r+128>>>10<<5)]=n,t.sigBytes=4*e.length,this._process(),this._hash.toX32()},clone:function(){var t=n.clone.call(this);return t._hash=this._hash.clone(),t},blockSize:32}),e.SHA512=n._createHelper(s),e.HmacSHA512=n._createHmacHelper(s)}(),function(){var t=y,e=(i=t.x64).Word,n=i.WordArray,r=(i=t.algo).SHA512,i=i.SHA384=r.extend({_doReset:function(){this._hash=new n.init([new e.init(3418070365,3238371032),new e.init(1654270250,914150663),new e.init(2438529370,812702999),new e.init(355462360,4144912697),new e.init(1731405415,4290775857),new e.init(2394180231,1750603025),new e.init(3675008525,1694076839),new e.init(1203062813,3204075428)])},_doFinalize:function(){var t=r._doFinalize.call(this);return t.sigBytes-=16,t}});t.SHA384=r._createHelper(i),t.HmacSHA384=r._createHmacHelper(i)}(),function(){var t=y,e=(r=t.lib).WordArray,n=r.Hasher,r=t.algo,i=e.create([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,7,4,13,1,10,6,15,3,12,0,9,5,2,14,11,8,3,10,14,4,9,15,8,1,2,7,0,6,13,11,5,12,1,9,11,10,0,8,12,4,13,3,7,15,14,5,6,2,4,0,5,9,7,12,2,10,14,1,3,8,11,6,15,13]),s=e.create([5,14,7,0,9,2,11,4,13,6,15,8,1,10,3,12,6,11,3,7,0,13,5,10,14,15,8,12,4,9,1,2,15,5,1,3,7,14,6,9,11,8,12,2,10,0,4,13,8,6,4,1,3,11,15,0,5,12,2,13,9,7,10,14,12,15,10,4,1,5,8,7,6,2,13,14,0,3,9,11]),a=e.create([11,14,15,12,5,8,7,9,11,13,14,15,6,7,9,8,7,6,8,13,11,9,7,15,7,12,15,9,11,7,13,12,11,13,6,7,14,9,13,15,14,8,13,6,5,12,7,5,11,12,14,15,14,15,9,8,9,14,5,6,8,6,5,12,9,15,5,11,6,8,13,12,5,12,13,14,11,8,5,6]),o=e.create([8,9,9,11,13,15,15,5,7,7,8,11,14,14,12,6,9,13,15,7,12,8,9,11,7,7,12,7,6,15,13,11,9,7,15,11,8,6,6,14,12,13,5,14,13,13,7,5,15,5,8,11,14,14,6,14,6,9,12,9,12,5,15,8,8,5,12,9,12,5,14,6,8,13,6,5,15,13,11,11]),u=e.create([0,1518500249,1859775393,2400959708,2840853838]),h=e.create([1352829926,1548603684,1836072691,2053994217,0]);r=r.RIPEMD160=n.extend({_doReset:function(){this._hash=e.create([1732584193,4023233417,2562383102,271733878,3285377520])},_doProcessBlock:function(t,e){for(var n=0;16>n;n++){var r=t[S=e+n];t[S]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8)}var c,l,f,d,g,p,y,v,m,F,S=this._hash.words,b=(r=u.words,h.words),A=i.words,E=s.words,w=a.words,x=o.words;p=c=S[0],y=l=S[1],v=f=S[2],m=d=S[3],F=g=S[4];var C;for(n=0;80>n;n+=1)C=c+t[e+A[n]]|0,C=16>n?C+((l^f^d)+r[0]):32>n?C+((l&f|~l&d)+r[1]):48>n?C+(((l|~f)^d)+r[2]):64>n?C+((l&d|f&~d)+r[3]):C+((l^(f|~d))+r[4]),C=(C=(C|=0)<<w[n]|C>>>32-w[n])+g|0,c=g,g=d,d=f<<10|f>>>22,f=l,l=C,C=p+t[e+E[n]]|0,C=16>n?C+((y^(v|~m))+b[0]):32>n?C+((y&m|v&~m)+b[1]):48>n?C+(((y|~v)^m)+b[2]):64>n?C+((y&v|~y&m)+b[3]):C+((y^v^m)+b[4]),C=(C=(C|=0)<<x[n]|C>>>32-x[n])+F|0,p=F,F=m,m=v<<10|v>>>22,v=y,y=C;C=S[1]+f+m|0,S[1]=S[2]+d+F|0,S[2]=S[3]+g+p|0,S[3]=S[4]+c+y|0,S[4]=S[0]+l+v|0,S[0]=C},_doFinalize:function(){var t=this._data,e=t.words,n=8*this._nDataBytes,r=8*t.sigBytes;for(e[r>>>5]|=128<<24-r%32,e[14+(r+64>>>9<<4)]=16711935&(n<<8|n>>>24)|4278255360&(n<<24|n>>>8),t.sigBytes=4*(e.length+1),this._process(),e=(t=this._hash).words,n=0;5>n;n++)r=e[n],e[n]=16711935&(r<<8|r>>>24)|4278255360&(r<<24|r>>>8);return t},clone:function(){var t=n.clone.call(this);return t._hash=this._hash.clone(),t}});t.RIPEMD160=n._createHelper(r),t.HmacRIPEMD160=n._createHmacHelper(r)}(Math),function(){var t=y,e=t.enc.Utf8;t.algo.HMAC=t.lib.Base.extend({init:function(t,n){t=this._hasher=new t.init,"string"==typeof n&&(n=e.parse(n));var r=t.blockSize,i=4*r;n.sigBytes>i&&(n=t.finalize(n)),n.clamp();for(var s=this._oKey=n.clone(),a=this._iKey=n.clone(),o=s.words,u=a.words,h=0;h<r;h++)o[h]^=1549556828,u[h]^=909522486;s.sigBytes=a.sigBytes=i,this.reset()},reset:function(){var t=this._hasher;t.reset(),t.update(this._iKey)},update:function(t){return this._hasher.update(t),this},finalize:function(t){var e=this._hasher;return t=e.finalize(t),e.reset(),e.finalize(this._oKey.clone().concat(t))}})}(),function(){var t,e=y,n=(t=e.lib).Base,r=t.WordArray,i=(t=e.algo).HMAC,s=t.PBKDF2=n.extend({cfg:n.extend({keySize:4,hasher:t.SHA1,iterations:1}),init:function(t){this.cfg=this.cfg.extend(t)},compute:function(t,e){var n=this.cfg,s=i.create(n.hasher,t),a=r.create(),o=r.create([1]),u=a.words,h=o.words,c=n.keySize;for(n=n.iterations;u.length<c;){var l=s.update(e).finalize(o);s.reset();for(var f=l.words,d=f.length,g=l,p=1;p<n;p++){g=s.finalize(g),s.reset();for(var y=g.words,v=0;v<d;v++)f[v]^=y[v]}a.concat(l),h[0]++}return a.sigBytes=4*c,a}});e.PBKDF2=function(t,e,n){return s.create(n).compute(t,e)}}();
/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
*/
var v,m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",F="=";function S(t){var e,n,r="";for(e=0;e+3<=t.length;e+=3)n=parseInt(t.substring(e,e+3),16),r+=m.charAt(n>>6)+m.charAt(63&n);if(e+1==t.length?(n=parseInt(t.substring(e,e+1),16),r+=m.charAt(n<<2)):e+2==t.length&&(n=parseInt(t.substring(e,e+2),16),r+=m.charAt(n>>2)+m.charAt((3&n)<<4)),F)for(;(3&r.length)>0;)r+=F;return r}function b(t){var e,n,r,i="",s=0;for(e=0;e<t.length&&t.charAt(e)!=F;++e)(r=m.indexOf(t.charAt(e)))<0||(0==s?(i+=T(r>>2),n=3&r,s=1):1==s?(i+=T(n<<2|r>>4),n=15&r,s=2):2==s?(i+=T(n),i+=T(r>>2),n=3&r,s=3):(i+=T(n<<2|r>>4),i+=T(15&r),s=0));return 1==s&&(i+=T(n<<2)),i}function A(t){var e,n=b(t),r=new Array;for(e=0;2*e<n.length;++e)r[e]=parseInt(n.substring(2*e,2*e+2),16);return r}function E(t,e,n){null!=t&&("number"==typeof t?this.fromNumber(t,e,n):null==e&&"string"!=typeof t?this.fromString(t,256):this.fromString(t,e))}function w(){return new E(null)}"Microsoft Internet Explorer"==n.appName?(E.prototype.am=function(t,e,n,r,i,s){for(var a=32767&e,o=e>>15;--s>=0;){var u=32767&this[t],h=this[t++]>>15,c=o*u+h*a;i=((u=a*u+((32767&c)<<15)+n[r]+(1073741823&i))>>>30)+(c>>>15)+o*h+(i>>>30),n[r++]=1073741823&u}return i},v=30):"Netscape"!=n.appName?(E.prototype.am=function(t,e,n,r,i,s){for(;--s>=0;){var a=e*this[t++]+n[r]+i;i=Math.floor(a/67108864),n[r++]=67108863&a}return i},v=26):(E.prototype.am=function(t,e,n,r,i,s){for(var a=16383&e,o=e>>14;--s>=0;){var u=16383&this[t],h=this[t++]>>14,c=o*u+h*a;i=((u=a*u+((16383&c)<<14)+n[r]+i)>>28)+(c>>14)+o*h,n[r++]=268435455&u}return i},v=28),E.prototype.DB=v,E.prototype.DM=(1<<v)-1,E.prototype.DV=1<<v;E.prototype.FV=Math.pow(2,52),E.prototype.F1=52-v,E.prototype.F2=2*v-52;var x,C,D="0123456789abcdefghijklmnopqrstuvwxyz",B=new Array;for(x="0".charCodeAt(0),C=0;C<=9;++C)B[x++]=C;for(x="a".charCodeAt(0),C=10;C<36;++C)B[x++]=C;for(x="A".charCodeAt(0),C=10;C<36;++C)B[x++]=C;function T(t){return D.charAt(t)}function I(t,e){var n=B[t.charCodeAt(e)];return null==n?-1:n}function P(t){var e=w();return e.fromInt(t),e}function R(t){var e,n=1;return 0!=(e=t>>>16)&&(t=e,n+=16),0!=(e=t>>8)&&(t=e,n+=8),0!=(e=t>>4)&&(t=e,n+=4),0!=(e=t>>2)&&(t=e,n+=2),0!=(e=t>>1)&&(t=e,n+=1),n}function H(t){this.m=t}function N(t){this.m=t,this.mp=t.invDigit(),this.mpl=32767&this.mp,this.mph=this.mp>>15,this.um=(1<<t.DB-15)-1,this.mt2=2*t.t}function O(t,e){return t&e}function j(t,e){return t|e}function L(t,e){return t^e}function k(t,e){return t&~e}function _(t){if(0==t)return-1;var e=0;return 0==(65535&t)&&(t>>=16,e+=16),0==(255&t)&&(t>>=8,e+=8),0==(15&t)&&(t>>=4,e+=4),0==(3&t)&&(t>>=2,e+=2),0==(1&t)&&++e,e}function V(t){for(var e=0;0!=t;)t&=t-1,++e;return e}function M(){}function K(t){return t}function U(t){this.r2=w(),this.q3=w(),E.ONE.dlShiftTo(2*t.t,this.r2),this.mu=this.r2.divide(t),this.m=t}H.prototype.convert=function(t){return t.s<0||t.compareTo(this.m)>=0?t.mod(this.m):t},H.prototype.revert=function(t){return t},H.prototype.reduce=function(t){t.divRemTo(this.m,null,t)},H.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n),this.reduce(n)},H.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},N.prototype.convert=function(t){var e=w();return t.abs().dlShiftTo(this.m.t,e),e.divRemTo(this.m,null,e),t.s<0&&e.compareTo(E.ZERO)>0&&this.m.subTo(e,e),e},N.prototype.revert=function(t){var e=w();return t.copyTo(e),this.reduce(e),e},N.prototype.reduce=function(t){for(;t.t<=this.mt2;)t[t.t++]=0;for(var e=0;e<this.m.t;++e){var n=32767&t[e],r=n*this.mpl+((n*this.mph+(t[e]>>15)*this.mpl&this.um)<<15)&t.DM;for(t[n=e+this.m.t]+=this.m.am(0,r,t,e,0,this.m.t);t[n]>=t.DV;)t[n]-=t.DV,t[++n]++}t.clamp(),t.drShiftTo(this.m.t,t),t.compareTo(this.m)>=0&&t.subTo(this.m,t)},N.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n),this.reduce(n)},N.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)},E.prototype.copyTo=function(t){for(var e=this.t-1;e>=0;--e)t[e]=this[e];t.t=this.t,t.s=this.s},E.prototype.fromInt=function(t){this.t=1,this.s=t<0?-1:0,t>0?this[0]=t:t<-1?this[0]=t+this.DV:this.t=0},E.prototype.fromString=function(t,e){var n;if(16==e)n=4;else if(8==e)n=3;else if(256==e)n=8;else if(2==e)n=1;else if(32==e)n=5;else{if(4!=e)return void this.fromRadix(t,e);n=2}this.t=0,this.s=0;for(var r=t.length,i=!1,s=0;--r>=0;){var a=8==n?255&t[r]:I(t,r);a<0?"-"==t.charAt(r)&&(i=!0):(i=!1,0==s?this[this.t++]=a:s+n>this.DB?(this[this.t-1]|=(a&(1<<this.DB-s)-1)<<s,this[this.t++]=a>>this.DB-s):this[this.t-1]|=a<<s,(s+=n)>=this.DB&&(s-=this.DB))}8==n&&0!=(128&t[0])&&(this.s=-1,s>0&&(this[this.t-1]|=(1<<this.DB-s)-1<<s)),this.clamp(),i&&E.ZERO.subTo(this,this)},E.prototype.clamp=function(){for(var t=this.s&this.DM;this.t>0&&this[this.t-1]==t;)--this.t},E.prototype.dlShiftTo=function(t,e){var n;for(n=this.t-1;n>=0;--n)e[n+t]=this[n];for(n=t-1;n>=0;--n)e[n]=0;e.t=this.t+t,e.s=this.s},E.prototype.drShiftTo=function(t,e){for(var n=t;n<this.t;++n)e[n-t]=this[n];e.t=Math.max(this.t-t,0),e.s=this.s},E.prototype.lShiftTo=function(t,e){var n,r=t%this.DB,i=this.DB-r,s=(1<<i)-1,a=Math.floor(t/this.DB),o=this.s<<r&this.DM;for(n=this.t-1;n>=0;--n)e[n+a+1]=this[n]>>i|o,o=(this[n]&s)<<r;for(n=a-1;n>=0;--n)e[n]=0;e[a]=o,e.t=this.t+a+1,e.s=this.s,e.clamp()},E.prototype.rShiftTo=function(t,e){e.s=this.s;var n=Math.floor(t/this.DB);if(n>=this.t)e.t=0;else{var r=t%this.DB,i=this.DB-r,s=(1<<r)-1;e[0]=this[n]>>r;for(var a=n+1;a<this.t;++a)e[a-n-1]|=(this[a]&s)<<i,e[a-n]=this[a]>>r;r>0&&(e[this.t-n-1]|=(this.s&s)<<i),e.t=this.t-n,e.clamp()}},E.prototype.subTo=function(t,e){for(var n=0,r=0,i=Math.min(t.t,this.t);n<i;)r+=this[n]-t[n],e[n++]=r&this.DM,r>>=this.DB;if(t.t<this.t){for(r-=t.s;n<this.t;)r+=this[n],e[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<t.t;)r-=t[n],e[n++]=r&this.DM,r>>=this.DB;r-=t.s}e.s=r<0?-1:0,r<-1?e[n++]=this.DV+r:r>0&&(e[n++]=r),e.t=n,e.clamp()},E.prototype.multiplyTo=function(t,e){var n=this.abs(),r=t.abs(),i=n.t;for(e.t=i+r.t;--i>=0;)e[i]=0;for(i=0;i<r.t;++i)e[i+n.t]=n.am(0,r[i],e,i,0,n.t);e.s=0,e.clamp(),this.s!=t.s&&E.ZERO.subTo(e,e)},E.prototype.squareTo=function(t){for(var e=this.abs(),n=t.t=2*e.t;--n>=0;)t[n]=0;for(n=0;n<e.t-1;++n){var r=e.am(n,e[n],t,2*n,0,1);(t[n+e.t]+=e.am(n+1,2*e[n],t,2*n+1,r,e.t-n-1))>=e.DV&&(t[n+e.t]-=e.DV,t[n+e.t+1]=1)}t.t>0&&(t[t.t-1]+=e.am(n,e[n],t,2*n,0,1)),t.s=0,t.clamp()},E.prototype.divRemTo=function(t,e,n){var r=t.abs();if(!(r.t<=0)){var i=this.abs();if(i.t<r.t)return null!=e&&e.fromInt(0),void(null!=n&&this.copyTo(n));null==n&&(n=w());var s=w(),a=this.s,o=t.s,u=this.DB-R(r[r.t-1]);u>0?(r.lShiftTo(u,s),i.lShiftTo(u,n)):(r.copyTo(s),i.copyTo(n));var h=s.t,c=s[h-1];if(0!=c){var l=c*(1<<this.F1)+(h>1?s[h-2]>>this.F2:0),f=this.FV/l,d=(1<<this.F1)/l,g=1<<this.F2,p=n.t,y=p-h,v=null==e?w():e;for(s.dlShiftTo(y,v),n.compareTo(v)>=0&&(n[n.t++]=1,n.subTo(v,n)),E.ONE.dlShiftTo(h,v),v.subTo(s,s);s.t<h;)s[s.t++]=0;for(;--y>=0;){var m=n[--p]==c?this.DM:Math.floor(n[p]*f+(n[p-1]+g)*d);if((n[p]+=s.am(0,m,n,y,0,h))<m)for(s.dlShiftTo(y,v),n.subTo(v,n);n[p]<--m;)n.subTo(v,n)}null!=e&&(n.drShiftTo(h,e),a!=o&&E.ZERO.subTo(e,e)),n.t=h,n.clamp(),u>0&&n.rShiftTo(u,n),a<0&&E.ZERO.subTo(n,n)}}},E.prototype.invDigit=function(){if(this.t<1)return 0;var t=this[0];if(0==(1&t))return 0;var e=3&t;return(e=(e=(e=(e=e*(2-(15&t)*e)&15)*(2-(255&t)*e)&255)*(2-((65535&t)*e&65535))&65535)*(2-t*e%this.DV)%this.DV)>0?this.DV-e:-e},E.prototype.isEven=function(){return 0==(this.t>0?1&this[0]:this.s)},E.prototype.exp=function(t,e){if(t>4294967295||t<1)return E.ONE;var n=w(),r=w(),i=e.convert(this),s=R(t)-1;for(i.copyTo(n);--s>=0;)if(e.sqrTo(n,r),(t&1<<s)>0)e.mulTo(r,i,n);else{var a=n;n=r,r=a}return e.revert(n)},E.prototype.toString=function(t){if(this.s<0)return"-"+this.negate().toString(t);var e;if(16==t)e=4;else if(8==t)e=3;else if(2==t)e=1;else if(32==t)e=5;else{if(4!=t)return this.toRadix(t);e=2}var n,r=(1<<e)-1,i=!1,s="",a=this.t,o=this.DB-a*this.DB%e;if(a-- >0)for(o<this.DB&&(n=this[a]>>o)>0&&(i=!0,s=T(n));a>=0;)o<e?(n=(this[a]&(1<<o)-1)<<e-o,n|=this[--a]>>(o+=this.DB-e)):(n=this[a]>>(o-=e)&r,o<=0&&(o+=this.DB,--a)),n>0&&(i=!0),i&&(s+=T(n));return i?s:"0"},E.prototype.negate=function(){var t=w();return E.ZERO.subTo(this,t),t},E.prototype.abs=function(){return this.s<0?this.negate():this},E.prototype.compareTo=function(t){var e=this.s-t.s;if(0!=e)return e;var n=this.t;if(0!=(e=n-t.t))return this.s<0?-e:e;for(;--n>=0;)if(0!=(e=this[n]-t[n]))return e;return 0},E.prototype.bitLength=function(){return this.t<=0?0:this.DB*(this.t-1)+R(this[this.t-1]^this.s&this.DM)},E.prototype.mod=function(t){var e=w();return this.abs().divRemTo(t,null,e),this.s<0&&e.compareTo(E.ZERO)>0&&t.subTo(e,e),e},E.prototype.modPowInt=function(t,e){var n;return n=t<256||e.isEven()?new H(e):new N(e),this.exp(t,n)},E.ZERO=P(0),E.ONE=P(1),M.prototype.convert=K,M.prototype.revert=K,M.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n)},M.prototype.sqrTo=function(t,e){t.squareTo(e)},U.prototype.convert=function(t){if(t.s<0||t.t>2*this.m.t)return t.mod(this.m);if(t.compareTo(this.m)<0)return t;var e=w();return t.copyTo(e),this.reduce(e),e},U.prototype.revert=function(t){return t},U.prototype.reduce=function(t){for(t.drShiftTo(this.m.t-1,this.r2),t.t>this.m.t+1&&(t.t=this.m.t+1,t.clamp()),this.mu.multiplyUpperTo(this.r2,this.m.t+1,this.q3),this.m.multiplyLowerTo(this.q3,this.m.t+1,this.r2);t.compareTo(this.r2)<0;)t.dAddOffset(1,this.m.t+1);for(t.subTo(this.r2,t);t.compareTo(this.m)>=0;)t.subTo(this.m,t)},U.prototype.mulTo=function(t,e,n){t.multiplyTo(e,n),this.reduce(n)},U.prototype.sqrTo=function(t,e){t.squareTo(e),this.reduce(e)};var q=[2,3,5,7,11,13,17,19,23,29,31,37,41,43,47,53,59,61,67,71,73,79,83,89,97,101,103,107,109,113,127,131,137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,947,953,967,971,977,983,991,997],z=(1<<26)/q[q.length-1];
/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
*/
function Y(){this.i=0,this.j=0,this.S=new Array}E.prototype.chunkSize=function(t){return Math.floor(Math.LN2*this.DB/Math.log(t))},E.prototype.toRadix=function(t){if(null==t&&(t=10),0==this.signum()||t<2||t>36)return"0";var e=this.chunkSize(t),n=Math.pow(t,e),r=P(n),i=w(),s=w(),a="";for(this.divRemTo(r,i,s);i.signum()>0;)a=(n+s.intValue()).toString(t).substr(1)+a,i.divRemTo(r,i,s);return s.intValue().toString(t)+a},E.prototype.fromRadix=function(t,e){this.fromInt(0),null==e&&(e=10);for(var n=this.chunkSize(e),r=Math.pow(e,n),i=!1,s=0,a=0,o=0;o<t.length;++o){var u=I(t,o);u<0?"-"==t.charAt(o)&&0==this.signum()&&(i=!0):(a=e*a+u,++s>=n&&(this.dMultiply(r),this.dAddOffset(a,0),s=0,a=0))}s>0&&(this.dMultiply(Math.pow(e,s)),this.dAddOffset(a,0)),i&&E.ZERO.subTo(this,this)},E.prototype.fromNumber=function(t,e,n){if("number"==typeof e)if(t<2)this.fromInt(1);else for(this.fromNumber(t,n),this.testBit(t-1)||this.bitwiseTo(E.ONE.shiftLeft(t-1),j,this),this.isEven()&&this.dAddOffset(1,0);!this.isProbablePrime(e);)this.dAddOffset(2,0),this.bitLength()>t&&this.subTo(E.ONE.shiftLeft(t-1),this);else{var r=new Array,i=7&t;r.length=1+(t>>3),e.nextBytes(r),i>0?r[0]&=(1<<i)-1:r[0]=0,this.fromString(r,256)}},E.prototype.bitwiseTo=function(t,e,n){var r,i,s=Math.min(t.t,this.t);for(r=0;r<s;++r)n[r]=e(this[r],t[r]);if(t.t<this.t){for(i=t.s&this.DM,r=s;r<this.t;++r)n[r]=e(this[r],i);n.t=this.t}else{for(i=this.s&this.DM,r=s;r<t.t;++r)n[r]=e(i,t[r]);n.t=t.t}n.s=e(this.s,t.s),n.clamp()},E.prototype.changeBit=function(t,e){var n=E.ONE.shiftLeft(t);return this.bitwiseTo(n,e,n),n},E.prototype.addTo=function(t,e){for(var n=0,r=0,i=Math.min(t.t,this.t);n<i;)r+=this[n]+t[n],e[n++]=r&this.DM,r>>=this.DB;if(t.t<this.t){for(r+=t.s;n<this.t;)r+=this[n],e[n++]=r&this.DM,r>>=this.DB;r+=this.s}else{for(r+=this.s;n<t.t;)r+=t[n],e[n++]=r&this.DM,r>>=this.DB;r+=t.s}e.s=r<0?-1:0,r>0?e[n++]=r:r<-1&&(e[n++]=this.DV+r),e.t=n,e.clamp()},E.prototype.dMultiply=function(t){this[this.t]=this.am(0,t-1,this,0,0,this.t),++this.t,this.clamp()},E.prototype.dAddOffset=function(t,e){if(0!=t){for(;this.t<=e;)this[this.t++]=0;for(this[e]+=t;this[e]>=this.DV;)this[e]-=this.DV,++e>=this.t&&(this[this.t++]=0),++this[e]}},E.prototype.multiplyLowerTo=function(t,e,n){var r,i=Math.min(this.t+t.t,e);for(n.s=0,n.t=i;i>0;)n[--i]=0;for(r=n.t-this.t;i<r;++i)n[i+this.t]=this.am(0,t[i],n,i,0,this.t);for(r=Math.min(t.t,e);i<r;++i)this.am(0,t[i],n,i,0,e-i);n.clamp()},E.prototype.multiplyUpperTo=function(t,e,n){--e;var r=n.t=this.t+t.t-e;for(n.s=0;--r>=0;)n[r]=0;for(r=Math.max(e-this.t,0);r<t.t;++r)n[this.t+r-e]=this.am(e-r,t[r],n,0,0,this.t+r-e);n.clamp(),n.drShiftTo(1,n)},E.prototype.modInt=function(t){if(t<=0)return 0;var e=this.DV%t,n=this.s<0?t-1:0;if(this.t>0)if(0==e)n=this[0]%t;else for(var r=this.t-1;r>=0;--r)n=(e*n+this[r])%t;return n},E.prototype.millerRabin=function(t){var e=this.subtract(E.ONE),n=e.getLowestSetBit();if(n<=0)return!1;var r=e.shiftRight(n);(t=t+1>>1)>q.length&&(t=q.length);for(var i=w(),s=0;s<t;++s){i.fromInt(q[Math.floor(Math.random()*q.length)]);var a=i.modPow(r,this);if(0!=a.compareTo(E.ONE)&&0!=a.compareTo(e)){for(var o=1;o++<n&&0!=a.compareTo(e);)if(0==(a=a.modPowInt(2,this)).compareTo(E.ONE))return!1;if(0!=a.compareTo(e))return!1}}return!0},E.prototype.clone=
/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
*/
function(){var t=w();return this.copyTo(t),t},E.prototype.intValue=function(){if(this.s<0){if(1==this.t)return this[0]-this.DV;if(0==this.t)return-1}else{if(1==this.t)return this[0];if(0==this.t)return 0}return(this[1]&(1<<32-this.DB)-1)<<this.DB|this[0]},E.prototype.byteValue=function(){return 0==this.t?this.s:this[0]<<24>>24},E.prototype.shortValue=function(){return 0==this.t?this.s:this[0]<<16>>16},E.prototype.signum=function(){return this.s<0?-1:this.t<=0||1==this.t&&this[0]<=0?0:1},E.prototype.toByteArray=function(){var t=this.t,e=new Array;e[0]=this.s;var n,r=this.DB-t*this.DB%8,i=0;if(t-- >0)for(r<this.DB&&(n=this[t]>>r)!=(this.s&this.DM)>>r&&(e[i++]=n|this.s<<this.DB-r);t>=0;)r<8?(n=(this[t]&(1<<r)-1)<<8-r,n|=this[--t]>>(r+=this.DB-8)):(n=this[t]>>(r-=8)&255,r<=0&&(r+=this.DB,--t)),0!=(128&n)&&(n|=-256),0==i&&(128&this.s)!=(128&n)&&++i,(i>0||n!=this.s)&&(e[i++]=n);return e},E.prototype.equals=function(t){return 0==this.compareTo(t)},E.prototype.min=function(t){return this.compareTo(t)<0?this:t},E.prototype.max=function(t){return this.compareTo(t)>0?this:t},E.prototype.and=function(t){var e=w();return this.bitwiseTo(t,O,e),e},E.prototype.or=function(t){var e=w();return this.bitwiseTo(t,j,e),e},E.prototype.xor=function(t){var e=w();return this.bitwiseTo(t,L,e),e},E.prototype.andNot=function(t){var e=w();return this.bitwiseTo(t,k,e),e},E.prototype.not=function(){for(var t=w(),e=0;e<this.t;++e)t[e]=this.DM&~this[e];return t.t=this.t,t.s=~this.s,t},E.prototype.shiftLeft=function(t){var e=w();return t<0?this.rShiftTo(-t,e):this.lShiftTo(t,e),e},E.prototype.shiftRight=function(t){var e=w();return t<0?this.lShiftTo(-t,e):this.rShiftTo(t,e),e},E.prototype.getLowestSetBit=function(){for(var t=0;t<this.t;++t)if(0!=this[t])return t*this.DB+_(this[t]);return this.s<0?this.t*this.DB:-1},E.prototype.bitCount=function(){for(var t=0,e=this.s&this.DM,n=0;n<this.t;++n)t+=V(this[n]^e);return t},E.prototype.testBit=function(t){var e=Math.floor(t/this.DB);return e>=this.t?0!=this.s:0!=(this[e]&1<<t%this.DB)},E.prototype.setBit=function(t){return this.changeBit(t,j)},E.prototype.clearBit=function(t){return this.changeBit(t,k)},E.prototype.flipBit=function(t){return this.changeBit(t,L)},E.prototype.add=function(t){var e=w();return this.addTo(t,e),e},E.prototype.subtract=function(t){var e=w();return this.subTo(t,e),e},E.prototype.multiply=function(t){var e=w();return this.multiplyTo(t,e),e},E.prototype.divide=function(t){var e=w();return this.divRemTo(t,e,null),e},E.prototype.remainder=function(t){var e=w();return this.divRemTo(t,null,e),e},E.prototype.divideAndRemainder=function(t){var e=w(),n=w();return this.divRemTo(t,e,n),new Array(e,n)},E.prototype.modPow=function(t,e){var n,r,i=t.bitLength(),s=P(1);if(i<=0)return s;n=i<18?1:i<48?3:i<144?4:i<768?5:6,r=i<8?new H(e):e.isEven()?new U(e):new N(e);var a=new Array,o=3,u=n-1,h=(1<<n)-1;if(a[1]=r.convert(this),n>1){var c=w();for(r.sqrTo(a[1],c);o<=h;)a[o]=w(),r.mulTo(c,a[o-2],a[o]),o+=2}var l,f,d=t.t-1,g=!0,p=w();for(i=R(t[d])-1;d>=0;){for(i>=u?l=t[d]>>i-u&h:(l=(t[d]&(1<<i+1)-1)<<u-i,d>0&&(l|=t[d-1]>>this.DB+i-u)),o=n;0==(1&l);)l>>=1,--o;if((i-=o)<0&&(i+=this.DB,--d),g)a[l].copyTo(s),g=!1;else{for(;o>1;)r.sqrTo(s,p),r.sqrTo(p,s),o-=2;o>0?r.sqrTo(s,p):(f=s,s=p,p=f),r.mulTo(p,a[l],s)}for(;d>=0&&0==(t[d]&1<<i);)r.sqrTo(s,p),f=s,s=p,p=f,--i<0&&(i=this.DB-1,--d)}return r.revert(s)},E.prototype.modInverse=function(t){var e=t.isEven();if(this.isEven()&&e||0==t.signum())return E.ZERO;for(var n=t.clone(),r=this.clone(),i=P(1),s=P(0),a=P(0),o=P(1);0!=n.signum();){for(;n.isEven();)n.rShiftTo(1,n),e?(i.isEven()&&s.isEven()||(i.addTo(this,i),s.subTo(t,s)),i.rShiftTo(1,i)):s.isEven()||s.subTo(t,s),s.rShiftTo(1,s);for(;r.isEven();)r.rShiftTo(1,r),e?(a.isEven()&&o.isEven()||(a.addTo(this,a),o.subTo(t,o)),a.rShiftTo(1,a)):o.isEven()||o.subTo(t,o),o.rShiftTo(1,o);n.compareTo(r)>=0?(n.subTo(r,n),e&&i.subTo(a,i),s.subTo(o,s)):(r.subTo(n,r),e&&a.subTo(i,a),o.subTo(s,o))}return 0!=r.compareTo(E.ONE)?E.ZERO:o.compareTo(t)>=0?o.subtract(t):o.signum()<0?(o.addTo(t,o),o.signum()<0?o.add(t):o):o},E.prototype.pow=function(t){return this.exp(t,new M)},E.prototype.gcd=function(t){var e=this.s<0?this.negate():this.clone(),n=t.s<0?t.negate():t.clone();if(e.compareTo(n)<0){var r=e;e=n,n=r}var i=e.getLowestSetBit(),s=n.getLowestSetBit();if(s<0)return e;for(i<s&&(s=i),s>0&&(e.rShiftTo(s,e),n.rShiftTo(s,n));e.signum()>0;)(i=e.getLowestSetBit())>0&&e.rShiftTo(i,e),(i=n.getLowestSetBit())>0&&n.rShiftTo(i,n),e.compareTo(n)>=0?(e.subTo(n,e),e.rShiftTo(1,e)):(n.subTo(e,n),n.rShiftTo(1,n));return s>0&&n.lShiftTo(s,n),n},E.prototype.isProbablePrime=function(t){var e,n=this.abs();if(1==n.t&&n[0]<=q[q.length-1]){for(e=0;e<q.length;++e)if(n[0]==q[e])return!0;return!1}if(n.isEven())return!1;for(e=1;e<q.length;){for(var r=q[e],i=e+1;i<q.length&&r<z;)r*=q[i++];for(r=n.modInt(r);e<i;)if(r%q[e++]==0)return!1}return n.millerRabin(t)},E.prototype.square=function(){var t=w();return this.squareTo(t),t},Y.prototype.init=function(t){var e,n,r;for(e=0;e<256;++e)this.S[e]=e;for(n=0,e=0;e<256;++e)n=n+this.S[e]+t[e%t.length]&255,r=this.S[e],this.S[e]=this.S[n],this.S[n]=r;this.i=0,this.j=0},Y.prototype.next=function(){var t;return this.i=this.i+1&255,this.j=this.j+this.S[this.i]&255,t=this.S[this.i],this.S[this.i]=this.S[this.j],this.S[this.j]=t,this.S[t+this.S[this.i]&255]};var G,J,W,X=256;
/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
*/function $(){var t;t=(new Date).getTime(),J[W++]^=255&t,J[W++]^=t>>8&255,J[W++]^=t>>16&255,J[W++]^=t>>24&255,W>=X&&(W-=X)}if(null==J){var Z;if(J=new Array,W=0,void 0!==r&&(void 0!==r.crypto||void 0!==r.msCrypto)){var Q=r.crypto||r.msCrypto;if(Q.getRandomValues){var tt=new Uint8Array(32);for(Q.getRandomValues(tt),Z=0;Z<32;++Z)J[W++]=tt[Z]}else if("Netscape"==n.appName&&n.appVersion<"5"){var et=r.crypto.random(32);for(Z=0;Z<et.length;++Z)J[W++]=255&et.charCodeAt(Z)}}for(;W<X;)Z=Math.floor(65536*Math.random()),J[W++]=Z>>>8,J[W++]=255&Z;W=0,$()}function nt(){if(null==G){for($(),(G=new Y).init(J),W=0;W<J.length;++W)J[W]=0;W=0}return G.next()}function rt(){}
/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
*/
function it(t,e){return new E(t,e)}function st(t,e,n){for(var r="",i=0;r.length<e;)r+=n(String.fromCharCode.apply(String,t.concat([(4278190080&i)>>24,(16711680&i)>>16,(65280&i)>>8,255&i]))),i+=1;return r}function at(){this.n=null,this.e=0,this.d=null,this.p=null,this.q=null,this.dmp1=null,this.dmq1=null,this.coeff=null}function ot(t,e,n){for(var r="",i=0;r.length<e;)r+=n(t+String.fromCharCode.apply(String,[(4278190080&i)>>24,(16711680&i)>>16,(65280&i)>>8,255&i])),i+=1;return r}
/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
*/
function ut(t,e){this.x=e,this.q=t}function ht(t,e,n,r){this.curve=t,this.x=e,this.y=n,this.z=null==r?E.ONE:r,this.zinv=null}function ct(t,e,n){this.q=t,this.a=this.fromBigInteger(e),this.b=this.fromBigInteger(n),this.infinity=new ht(this,null,null)}rt.prototype.nextBytes=function(t){var e;for(e=0;e<t.length;++e)t[e]=nt()},at.prototype.doPublic=function(t){return t.modPowInt(this.e,this.n)},at.prototype.setPublic=function(t,e){if(this.isPublic=!0,this.isPrivate=!1,"string"!=typeof t)this.n=t,this.e=e;else{if(!(null!=t&&null!=e&&t.length>0&&e.length>0))throw"Invalid RSA public key";this.n=it(t,16),this.e=parseInt(e,16)}},at.prototype.encrypt=function(t){var e=function(t,e){if(e<t.length+11)throw"Message too long for RSA";for(var n=new Array,r=t.length-1;r>=0&&e>0;){var i=t.charCodeAt(r--);i<128?n[--e]=i:i>127&&i<2048?(n[--e]=63&i|128,n[--e]=i>>6|192):(n[--e]=63&i|128,n[--e]=i>>6&63|128,n[--e]=i>>12|224)}n[--e]=0;for(var s=new rt,a=new Array;e>2;){for(a[0]=0;0==a[0];)s.nextBytes(a);n[--e]=a[0]}return n[--e]=2,n[--e]=0,new E(n)}(t,this.n.bitLength()+7>>3);if(null==e)return null;var n=this.doPublic(e);if(null==n)return null;var r=n.toString(16);return 0==(1&r.length)?r:"0"+r},at.prototype.encryptOAEP=function(t,e,n){var r=function(t,e,n,r){var i=ft.crypto.MessageDigest,s=ft.crypto.Util,a=null;if(n||(n="sha1"),"string"==typeof n&&(a=i.getCanonicalAlgName(n),r=i.getHashLength(a),n=function(t){return Ct(s.hashHex(Dt(t),a))}),t.length+2*r+2>e)throw"Message too long for RSA";var o,u="";for(o=0;o<e-t.length-2*r-2;o+=1)u+="\0";var h=n("")+u+""+t,c=new Array(r);(new rt).nextBytes(c);var l=st(c,h.length,n),f=[];for(o=0;o<h.length;o+=1)f[o]=h.charCodeAt(o)^l.charCodeAt(o);var d=st(f,c.length,n),g=[0];for(o=0;o<c.length;o+=1)g[o+1]=c[o]^d.charCodeAt(o);return new E(g.concat(f))}(t,this.n.bitLength()+7>>3,e,n);if(null==r)return null;var i=this.doPublic(r);if(null==i)return null;var s=i.toString(16);return 0==(1&s.length)?s:"0"+s},at.prototype.type="RSA",at.prototype.doPrivate=function(t){if(null==this.p||null==this.q)return t.modPow(this.d,this.n);for(var e=t.mod(this.p).modPow(this.dmp1,this.p),n=t.mod(this.q).modPow(this.dmq1,this.q);e.compareTo(n)<0;)e=e.add(this.p);return e.subtract(n).multiply(this.coeff).mod(this.p).multiply(this.q).add(n)},at.prototype.setPrivate=function(t,e,n){if(this.isPrivate=!0,"string"!=typeof t)this.n=t,this.e=e,this.d=n;else{if(!(null!=t&&null!=e&&t.length>0&&e.length>0))throw"Invalid RSA private key";this.n=it(t,16),this.e=parseInt(e,16),this.d=it(n,16)}},at.prototype.setPrivateEx=function(t,e,n,r,i,s,a,o){if(this.isPrivate=!0,this.isPublic=!1,null==t)throw"RSASetPrivateEx N == null";if(null==e)throw"RSASetPrivateEx E == null";if(0==t.length)throw"RSASetPrivateEx N.length == 0";if(0==e.length)throw"RSASetPrivateEx E.length == 0";if(!(null!=t&&null!=e&&t.length>0&&e.length>0))throw"Invalid RSA private key in RSASetPrivateEx";this.n=it(t,16),this.e=parseInt(e,16),this.d=it(n,16),this.p=it(r,16),this.q=it(i,16),this.dmp1=it(s,16),this.dmq1=it(a,16),this.coeff=it(o,16)},at.prototype.generate=function(t,e){var n=new rt,r=t>>1;this.e=parseInt(e,16);for(var i=new E(e,16);;){for(;this.p=new E(t-r,1,n),0!=this.p.subtract(E.ONE).gcd(i).compareTo(E.ONE)||!this.p.isProbablePrime(10););for(;this.q=new E(r,1,n),0!=this.q.subtract(E.ONE).gcd(i).compareTo(E.ONE)||!this.q.isProbablePrime(10););if(this.p.compareTo(this.q)<=0){var s=this.p;this.p=this.q,this.q=s}var a=this.p.subtract(E.ONE),o=this.q.subtract(E.ONE),u=a.multiply(o);if(0==u.gcd(i).compareTo(E.ONE)){this.n=this.p.multiply(this.q),this.d=i.modInverse(u),this.dmp1=this.d.mod(a),this.dmq1=this.d.mod(o),this.coeff=this.q.modInverse(this.p);break}}this.isPrivate=!0},at.prototype.decrypt=function(t){var e=it(t,16),n=this.doPrivate(e);return null==n?null:
/*! (c) Tom Wu | http://www-cs-students.stanford.edu/~tjw/jsbn/
*/
function(t,e){for(var n=t.toByteArray(),r=0;r<n.length&&0==n[r];)++r;if(n.length-r!=e-1||2!=n[r])return null;for(++r;0!=n[r];)if(++r>=n.length)return null;for(var i="";++r<n.length;){var s=255&n[r];s<128?i+=String.fromCharCode(s):s>191&&s<224?(i+=String.fromCharCode((31&s)<<6|63&n[r+1]),++r):(i+=String.fromCharCode((15&s)<<12|(63&n[r+1])<<6|63&n[r+2]),r+=2)}return i}(n,this.n.bitLength()+7>>3)},at.prototype.decryptOAEP=function(t,e,n){var r=it(t,16),i=this.doPrivate(r);return null==i?null:function(t,e,n,r){var i=ft.crypto.MessageDigest,s=ft.crypto.Util,a=null;for(n||(n="sha1"),"string"==typeof n&&(a=i.getCanonicalAlgName(n),r=i.getHashLength(a),n=function(t){return Ct(s.hashHex(Dt(t),a))}),t=t.toByteArray(),o=0;o<t.length;o+=1)t[o]&=255;for(;t.length<e;)t.unshift(0);if((t=String.fromCharCode.apply(String,t)).length<2*r+2)throw"Cipher too short";var o,u=t.substr(1,r),h=t.substr(r+1),c=ot(h,r,n),l=[];for(o=0;o<u.length;o+=1)l[o]=u.charCodeAt(o)^c.charCodeAt(o);var f=ot(String.fromCharCode.apply(String,l),t.length-r,n),d=[];for(o=0;o<h.length;o+=1)d[o]=h.charCodeAt(o)^f.charCodeAt(o);if((d=String.fromCharCode.apply(String,d)).substr(0,r)!==n(""))throw"Hash mismatch";var g=(d=d.substr(r)).indexOf("");if((-1!=g?d.substr(0,g).lastIndexOf("\0"):-1)+1!=g)throw"Malformed data";return d.substr(g+1)}(i,this.n.bitLength()+7>>3,e,n)},ut.prototype.equals=function(t){return t==this||this.q.equals(t.q)&&this.x.equals(t.x)},ut.prototype.toBigInteger=function(){return this.x},ut.prototype.negate=function(){return new ut(this.q,this.x.negate().mod(this.q))},ut.prototype.add=function(t){return new ut(this.q,this.x.add(t.toBigInteger()).mod(this.q))},ut.prototype.subtract=function(t){return new ut(this.q,this.x.subtract(t.toBigInteger()).mod(this.q))},ut.prototype.multiply=function(t){return new ut(this.q,this.x.multiply(t.toBigInteger()).mod(this.q))},ut.prototype.square=function(){return new ut(this.q,this.x.square().mod(this.q))},ut.prototype.divide=function(t){return new ut(this.q,this.x.multiply(t.toBigInteger().modInverse(this.q)).mod(this.q))},ht.prototype.getX=function(){return null==this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.x.toBigInteger().multiply(this.zinv).mod(this.curve.q))},ht.prototype.getY=function(){return null==this.zinv&&(this.zinv=this.z.modInverse(this.curve.q)),this.curve.fromBigInteger(this.y.toBigInteger().multiply(this.zinv).mod(this.curve.q))},ht.prototype.equals=function(t){return t==this||(this.isInfinity()?t.isInfinity():t.isInfinity()?this.isInfinity():!!t.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(t.z)).mod(this.curve.q).equals(E.ZERO)&&t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.q).equals(E.ZERO))},ht.prototype.isInfinity=function(){return null==this.x&&null==this.y||this.z.equals(E.ZERO)&&!this.y.toBigInteger().equals(E.ZERO)},ht.prototype.negate=function(){return new ht(this.curve,this.x,this.y.negate(),this.z)},ht.prototype.add=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;var e=t.y.toBigInteger().multiply(this.z).subtract(this.y.toBigInteger().multiply(t.z)).mod(this.curve.q),n=t.x.toBigInteger().multiply(this.z).subtract(this.x.toBigInteger().multiply(t.z)).mod(this.curve.q);if(E.ZERO.equals(n))return E.ZERO.equals(e)?this.twice():this.curve.getInfinity();var r=new E("3"),i=this.x.toBigInteger(),s=this.y.toBigInteger(),a=(t.x.toBigInteger(),t.y.toBigInteger(),n.square()),o=a.multiply(n),u=i.multiply(a),h=e.square().multiply(this.z),c=h.subtract(u.shiftLeft(1)).multiply(t.z).subtract(o).multiply(n).mod(this.curve.q),l=u.multiply(r).multiply(e).subtract(s.multiply(o)).subtract(h.multiply(e)).multiply(t.z).add(e.multiply(o)).mod(this.curve.q),f=o.multiply(this.z).multiply(t.z).mod(this.curve.q);return new ht(this.curve,this.curve.fromBigInteger(c),this.curve.fromBigInteger(l),f)},ht.prototype.twice=function(){if(this.isInfinity())return this;if(0==this.y.toBigInteger().signum())return this.curve.getInfinity();var t=new E("3"),e=this.x.toBigInteger(),n=this.y.toBigInteger(),r=n.multiply(this.z),i=r.multiply(n).mod(this.curve.q),s=this.curve.a.toBigInteger(),a=e.square().multiply(t);E.ZERO.equals(s)||(a=a.add(this.z.square().multiply(s)));var o=(a=a.mod(this.curve.q)).square().subtract(e.shiftLeft(3).multiply(i)).shiftLeft(1).multiply(r).mod(this.curve.q),u=a.multiply(t).multiply(e).subtract(i.shiftLeft(1)).shiftLeft(2).multiply(i).subtract(a.square().multiply(a)).mod(this.curve.q),h=r.square().multiply(r).shiftLeft(3).mod(this.curve.q);return new ht(this.curve,this.curve.fromBigInteger(o),this.curve.fromBigInteger(u),h)},ht.prototype.multiply=function(t){if(this.isInfinity())return this;if(0==t.signum())return this.curve.getInfinity();var e,n=t,r=n.multiply(new E("3")),i=this.negate(),s=this;for(e=r.bitLength()-2;e>0;--e){s=s.twice();var a=r.testBit(e);a!=n.testBit(e)&&(s=s.add(a?this:i))}return s},ht.prototype.multiplyTwo=function(t,e,n){var r;r=t.bitLength()>n.bitLength()?t.bitLength()-1:n.bitLength()-1;for(var i=this.curve.getInfinity(),s=this.add(e);r>=0;)i=i.twice(),t.testBit(r)?i=n.testBit(r)?i.add(s):i.add(this):n.testBit(r)&&(i=i.add(e)),--r;return i},ct.prototype.getQ=function(){return this.q},ct.prototype.getA=function(){return this.a},ct.prototype.getB=function(){return this.b},ct.prototype.equals=function(t){return t==this||this.q.equals(t.q)&&this.a.equals(t.a)&&this.b.equals(t.b)},ct.prototype.getInfinity=function(){return this.infinity},ct.prototype.fromBigInteger=function(t){return new ut(this.q,t)},ct.prototype.decodePointHex=function(t){switch(parseInt(t.substr(0,2),16)){case 0:return this.infinity;case 2:case 3:return null;case 4:case 6:case 7:var e=(t.length-2)/2,n=t.substr(2,e),r=t.substr(e+2,e);return new ht(this,this.fromBigInteger(new E(n,16)),this.fromBigInteger(new E(r,16)));default:return null}},
/*! (c) Stefan Thomas | https://github.com/bitcoinjs/bitcoinjs-lib
*/
ut.prototype.getByteLength=function(){return Math.floor((this.toBigInteger().bitLength()+7)/8)},ht.prototype.getEncoded=function(t){var e=function(t,e){var n=t.toByteArrayUnsigned();if(e<n.length)n=n.slice(n.length-e);else for(;e>n.length;)n.unshift(0);return n},n=this.getX().toBigInteger(),r=this.getY().toBigInteger(),i=e(n,32);return t?r.isEven()?i.unshift(2):i.unshift(3):(i.unshift(4),i=i.concat(e(r,32))),i},ht.decodeFrom=function(t,e){e[0];var n=e.length-1,r=e.slice(1,1+n/2),i=e.slice(1+n/2,1+n);r.unshift(0),i.unshift(0);var s=new E(r),a=new E(i);return new ht(t,t.fromBigInteger(s),t.fromBigInteger(a))},ht.decodeFromHex=function(t,e){e.substr(0,2);var n=e.length-2,r=e.substr(2,n/2),i=e.substr(2+n/2,n/2),s=new E(r,16),a=new E(i,16);return new ht(t,t.fromBigInteger(s),t.fromBigInteger(a))},ht.prototype.add2D=function(t){if(this.isInfinity())return t;if(t.isInfinity())return this;if(this.x.equals(t.x))return this.y.equals(t.y)?this.twice():this.curve.getInfinity();var e=t.x.subtract(this.x),n=t.y.subtract(this.y).divide(e),r=n.square().subtract(this.x).subtract(t.x),i=n.multiply(this.x.subtract(r)).subtract(this.y);return new ht(this.curve,r,i)},ht.prototype.twice2D=function(){if(this.isInfinity())return this;if(0==this.y.toBigInteger().signum())return this.curve.getInfinity();var t=this.curve.fromBigInteger(E.valueOf(2)),e=this.curve.fromBigInteger(E.valueOf(3)),n=this.x.square().multiply(e).add(this.curve.a).divide(this.y.multiply(t)),r=n.square().subtract(this.x.multiply(t)),i=n.multiply(this.x.subtract(r)).subtract(this.y);return new ht(this.curve,r,i)},ht.prototype.multiply2D=function(t){if(this.isInfinity())return this;if(0==t.signum())return this.curve.getInfinity();var e,n=t,r=n.multiply(new E("3")),i=this.negate(),s=this;for(e=r.bitLength()-2;e>0;--e){s=s.twice();var a=r.testBit(e);a!=n.testBit(e)&&(s=s.add2D(a?this:i))}return s},ht.prototype.isOnCurve=function(){var t=this.getX().toBigInteger(),e=this.getY().toBigInteger(),n=this.curve.getA().toBigInteger(),r=this.curve.getB().toBigInteger(),i=this.curve.getQ(),s=e.multiply(e).mod(i),a=t.multiply(t).multiply(t).add(n.multiply(t)).add(r).mod(i);return s.equals(a)},ht.prototype.toString=function(){return"("+this.getX().toBigInteger().toString()+","+this.getY().toBigInteger().toString()+")"},ht.prototype.validate=function(){var t=this.curve.getQ();if(this.isInfinity())throw new Error("Point is at infinity.");var e=this.getX().toBigInteger(),n=this.getY().toBigInteger();if(e.compareTo(E.ONE)<0||e.compareTo(t.subtract(E.ONE))>0)throw new Error("x coordinate out of bounds");if(n.compareTo(E.ONE)<0||n.compareTo(t.subtract(E.ONE))>0)throw new Error("y coordinate out of bounds");if(!this.isOnCurve())throw new Error("Point is not on the curve.");if(this.multiply(t).isInfinity())throw new Error("Point is not a scalar multiple of G.");return!0};
/*! Mike Samuel (c) 2009 | code.google.com/p/json-sans-eval
*/
var lt=function(){var t=new RegExp('(?:false|true|null|[\\{\\}\\[\\]]|(?:-?\\b(?:0|[1-9][0-9]*)(?:\\.[0-9]+)?(?:[eE][+-]?[0-9]+)?\\b)|(?:"(?:[^\\0-\\x08\\x0a-\\x1f"\\\\]|\\\\(?:["/\\\\bfnrt]|u[0-9A-Fa-f]{4}))*"))',"g"),e=new RegExp("\\\\(?:([^u])|u(.{4}))","g"),n={'"':'"',"/":"/","\\":"\\",b:"\b",f:"\f",n:"\n",r:"\r",t:"\t"};function r(t,e,r){return e?n[e]:String.fromCharCode(parseInt(r,16))}var i=new String(""),s=(Object,Array,Object.hasOwnProperty);return function(n,a){var o,u,h=n.match(t),c=h[0],l=!1;"{"===c?o={}:"["===c?o=[]:(o=[],l=!0);for(var f=[o],d=1-l,g=h.length;d<g;++d){var p;switch((c=h[d]).charCodeAt(0)){default:(p=f[0])[u||p.length]=+c,u=void 0;break;case 34:if(-1!==(c=c.substring(1,c.length-1)).indexOf("\\")&&(c=c.replace(e,r)),p=f[0],!u){if(!(p instanceof Array)){u=c||i;break}u=p.length}p[u]=c,u=void 0;break;case 91:p=f[0],f.unshift(p[u||p.length]=[]),u=void 0;break;case 93:f.shift();break;case 102:(p=f[0])[u||p.length]=!1,u=void 0;break;case 110:(p=f[0])[u||p.length]=null,u=void 0;break;case 116:(p=f[0])[u||p.length]=!0,u=void 0;break;case 123:p=f[0],f.unshift(p[u||p.length]={}),u=void 0;break;case 125:f.shift()}}if(l){if(1!==f.length)throw new Error;o=o[0]}else if(f.length)throw new Error;if(a){var y=function(t,e){var n=t[e];if(n&&"object"==typeof n){var r=null;for(var i in n)if(s.call(n,i)&&n!==t){var o=y(n,i);void 0!==o?n[i]=o:(r||(r=[]),r.push(i))}if(r)for(var u=r.length;--u>=0;)delete n[r[u]]}return a.call(t,e,n)};o=y({"":o},"")}return o}}();void 0!==ft&&ft||(ft={}),void 0!==ft.asn1&&ft.asn1||(ft.asn1={}),ft.asn1.ASN1Util=new function(){this.integerToByteHex=function(t){var e=t.toString(16);return e.length%2==1&&(e="0"+e),e},this.bigIntToMinTwosComplementsHex=function(t){var e=t.toString(16);if("-"!=e.substr(0,1))e.length%2==1?e="0"+e:e.match(/^[0-7]/)||(e="00"+e);else{var n=e.substr(1).length;n%2==1?n+=1:e.match(/^[0-7]/)||(n+=2);for(var r="",i=0;i<n;i++)r+="f";e=new E(r,16).xor(t).add(E.ONE).toString(16).replace(/^-/,"")}return e},this.getPEMStringFromHex=function(t,e){return Pt(t,e)},this.newObject=function(t){var e=ft.asn1,n=e.DERBoolean,r=e.DERInteger,i=e.DERBitString,s=e.DEROctetString,a=e.DERNull,o=e.DERObjectIdentifier,u=e.DEREnumerated,h=e.DERUTF8String,c=e.DERNumericString,l=e.DERPrintableString,f=e.DERTeletexString,d=e.DERIA5String,g=e.DERUTCTime,p=e.DERGeneralizedTime,y=e.DERSequence,v=e.DERSet,m=e.DERTaggedObject,F=e.ASN1Util.newObject,S=Object.keys(t);if(1!=S.length)throw"key of param shall be only one.";var b=S[0];if(-1==":bool:int:bitstr:octstr:null:oid:enum:utf8str:numstr:prnstr:telstr:ia5str:utctime:gentime:seq:set:tag:".indexOf(":"+b+":"))throw"undefined key: "+b;if("bool"==b)return new n(t[b]);if("int"==b)return new r(t[b]);if("bitstr"==b)return new i(t[b]);if("octstr"==b)return new s(t[b]);if("null"==b)return new a(t[b]);if("oid"==b)return new o(t[b]);if("enum"==b)return new u(t[b]);if("utf8str"==b)return new h(t[b]);if("numstr"==b)return new c(t[b]);if("prnstr"==b)return new l(t[b]);if("telstr"==b)return new f(t[b]);if("ia5str"==b)return new d(t[b]);if("utctime"==b)return new g(t[b]);if("gentime"==b)return new p(t[b]);if("seq"==b){for(var A=t[b],E=[],w=0;w<A.length;w++){var x=F(A[w]);E.push(x)}return new y({array:E})}if("set"==b){for(A=t[b],E=[],w=0;w<A.length;w++){x=F(A[w]);E.push(x)}return new v({array:E})}if("tag"==b){var C=t[b];if("[object Array]"===Object.prototype.toString.call(C)&&3==C.length){var D=F(C[2]);return new m({tag:C[0],explicit:C[1],obj:D})}var B={};if(void 0!==C.explicit&&(B.explicit=C.explicit),void 0!==C.tag&&(B.tag=C.tag),void 0===C.obj)throw"obj shall be specified for 'tag'.";return B.obj=F(C.obj),new m(B)}},this.jsonToASN1HEX=function(t){return this.newObject(t).getEncodedHex()}},ft.asn1.ASN1Util.oidHexToInt=function(t){for(var e="",n=parseInt(t.substr(0,2),16),r=(e=Math.floor(n/40)+"."+n%40,""),i=2;i<t.length;i+=2){var s=("00000000"+parseInt(t.substr(i,2),16).toString(2)).slice(-8);if(r+=s.substr(1,7),"0"==s.substr(0,1))e=e+"."+new E(r,2).toString(10),r=""}return e},ft.asn1.ASN1Util.oidIntToHex=function(t){var e=function(t){var e=t.toString(16);return 1==e.length&&(e="0"+e),e},n=function(t){var n="",r=new E(t,10).toString(2),i=7-r.length%7;7==i&&(i=0);for(var s="",a=0;a<i;a++)s+="0";r=s+r;for(a=0;a<r.length-1;a+=7){var o=r.substr(a,7);a!=r.length-7&&(o="1"+o),n+=e(parseInt(o,2))}return n};if(!t.match(/^[0-9.]+$/))throw"malformed oid string: "+t;var r="",i=t.split("."),s=40*parseInt(i[0])+parseInt(i[1]);r+=e(s),i.splice(0,2);for(var a=0;a<i.length;a++)r+=n(i[a]);return r},ft.asn1.ASN1Object=function(){this.getLengthHexFromValue=function(){if(void 0===this.hV||null==this.hV)throw"this.hV is null or undefined.";if(this.hV.length%2==1)throw"value hex must be even length: n="+"".length+",v="+this.hV;var t=this.hV.length/2,e=t.toString(16);if(e.length%2==1&&(e="0"+e),t<128)return e;var n=e.length/2;if(n>15)throw"ASN.1 length too long to represent by 8x: n = "+t.toString(16);return(128+n).toString(16)+e},this.getEncodedHex=function(){return(null==this.hTLV||this.isModified)&&(this.hV=this.getFreshValueHex(),this.hL=this.getLengthHexFromValue(),this.hTLV=this.hT+this.hL+this.hV,this.isModified=!1),this.hTLV},this.getValueHex=function(){return this.getEncodedHex(),this.hV},this.getFreshValueHex=function(){return""}},ft.asn1.DERAbstractString=function(t){ft.asn1.DERAbstractString.superclass.constructor.call(this);this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=wt(this.s).toLowerCase()},this.setStringHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&("string"==typeof t?this.setString(t):void 0!==t.str?this.setString(t.str):void 0!==t.hex&&this.setStringHex(t.hex))},i.lang.extend(ft.asn1.DERAbstractString,ft.asn1.ASN1Object),ft.asn1.DERAbstractTime=function(t){ft.asn1.DERAbstractTime.superclass.constructor.call(this);this.localDateToUTC=function(t){return utc=t.getTime()+6e4*t.getTimezoneOffset(),new Date(utc)},this.formatDate=function(t,e,n){var r=this.zeroPadding,i=this.localDateToUTC(t),s=String(i.getFullYear());"utc"==e&&(s=s.substr(2,2));var a=s+r(String(i.getMonth()+1),2)+r(String(i.getDate()),2)+r(String(i.getHours()),2)+r(String(i.getMinutes()),2)+r(String(i.getSeconds()),2);if(!0===n){var o=i.getMilliseconds();if(0!=o){var u=r(String(o),3);a=a+"."+(u=u.replace(/[0]+$/,""))}}return a+"Z"},this.zeroPadding=function(t,e){return t.length>=e?t:new Array(e-t.length+1).join("0")+t},this.getString=function(){return this.s},this.setString=function(t){this.hTLV=null,this.isModified=!0,this.s=t,this.hV=Ft(t)},this.setByDateValue=function(t,e,n,r,i,s){var a=new Date(Date.UTC(t,e-1,n,r,i,s,0));this.setByDate(a)},this.getFreshValueHex=function(){return this.hV}},i.lang.extend(ft.asn1.DERAbstractTime,ft.asn1.ASN1Object),ft.asn1.DERAbstractStructured=function(t){ft.asn1.DERAbstractString.superclass.constructor.call(this);this.setByASN1ObjectArray=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array=t},this.appendASN1Object=function(t){this.hTLV=null,this.isModified=!0,this.asn1Array.push(t)},this.asn1Array=new Array,void 0!==t&&void 0!==t.array&&(this.asn1Array=t.array)},i.lang.extend(ft.asn1.DERAbstractStructured,ft.asn1.ASN1Object),ft.asn1.DERBoolean=function(){ft.asn1.DERBoolean.superclass.constructor.call(this),this.hT="01",this.hTLV="0101ff"},i.lang.extend(ft.asn1.DERBoolean,ft.asn1.ASN1Object),ft.asn1.DERInteger=function(t){ft.asn1.DERInteger.superclass.constructor.call(this),this.hT="02",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=ft.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var e=new E(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.bigint?this.setByBigInteger(t.bigint):void 0!==t.int?this.setByInteger(t.int):"number"==typeof t?this.setByInteger(t):void 0!==t.hex&&this.setValueHex(t.hex))},i.lang.extend(ft.asn1.DERInteger,ft.asn1.ASN1Object),ft.asn1.DERBitString=function(t){if(void 0!==t&&void 0!==t.obj){var e=ft.asn1.ASN1Util.newObject(t.obj);t.hex="00"+e.getEncodedHex()}ft.asn1.DERBitString.superclass.constructor.call(this),this.hT="03",this.setHexValueIncludingUnusedBits=function(t){this.hTLV=null,this.isModified=!0,this.hV=t},this.setUnusedBitsAndHexValue=function(t,e){if(t<0||7<t)throw"unused bits shall be from 0 to 7: u = "+t;var n="0"+t;this.hTLV=null,this.isModified=!0,this.hV=n+e},this.setByBinaryString=function(t){var e=8-(t=t.replace(/0+$/,"")).length%8;8==e&&(e=0);for(var n=0;n<=e;n++)t+="0";var r="";for(n=0;n<t.length-1;n+=8){var i=t.substr(n,8),s=parseInt(i,2).toString(16);1==s.length&&(s="0"+s),r+=s}this.hTLV=null,this.isModified=!0,this.hV="0"+e+r},this.setByBooleanArray=function(t){for(var e="",n=0;n<t.length;n++)1==t[n]?e+="1":e+="0";this.setByBinaryString(e)},this.newFalseArray=function(t){for(var e=new Array(t),n=0;n<t;n++)e[n]=!1;return e},this.getFreshValueHex=function(){return this.hV},void 0!==t&&("string"==typeof t&&t.toLowerCase().match(/^[0-9a-f]+$/)?this.setHexValueIncludingUnusedBits(t):void 0!==t.hex?this.setHexValueIncludingUnusedBits(t.hex):void 0!==t.bin?this.setByBinaryString(t.bin):void 0!==t.array&&this.setByBooleanArray(t.array))},i.lang.extend(ft.asn1.DERBitString,ft.asn1.ASN1Object),ft.asn1.DEROctetString=function(t){if(void 0!==t&&void 0!==t.obj){var e=ft.asn1.ASN1Util.newObject(t.obj);t.hex=e.getEncodedHex()}ft.asn1.DEROctetString.superclass.constructor.call(this,t),this.hT="04"},i.lang.extend(ft.asn1.DEROctetString,ft.asn1.DERAbstractString),ft.asn1.DERNull=function(){ft.asn1.DERNull.superclass.constructor.call(this),this.hT="05",this.hTLV="0500"},i.lang.extend(ft.asn1.DERNull,ft.asn1.ASN1Object),ft.asn1.DERObjectIdentifier=function(t){var e=function(t){var e=t.toString(16);return 1==e.length&&(e="0"+e),e},n=function(t){var n="",r=new E(t,10).toString(2),i=7-r.length%7;7==i&&(i=0);for(var s="",a=0;a<i;a++)s+="0";r=s+r;for(a=0;a<r.length-1;a+=7){var o=r.substr(a,7);a!=r.length-7&&(o="1"+o),n+=e(parseInt(o,2))}return n};ft.asn1.DERObjectIdentifier.superclass.constructor.call(this),this.hT="06",this.setValueHex=function(t){this.hTLV=null,this.isModified=!0,this.s=null,this.hV=t},this.setValueOidString=function(t){if(!t.match(/^[0-9.]+$/))throw"malformed oid string: "+t;var r="",i=t.split("."),s=40*parseInt(i[0])+parseInt(i[1]);r+=e(s),i.splice(0,2);for(var a=0;a<i.length;a++)r+=n(i[a]);this.hTLV=null,this.isModified=!0,this.s=null,this.hV=r},this.setValueName=function(t){var e=ft.asn1.x509.OID.name2oid(t);if(""===e)throw"DERObjectIdentifier oidName undefined: "+t;this.setValueOidString(e)},this.getFreshValueHex=function(){return this.hV},void 0!==t&&("string"==typeof t?t.match(/^[0-2].[0-9.]+$/)?this.setValueOidString(t):this.setValueName(t):void 0!==t.oid?this.setValueOidString(t.oid):void 0!==t.hex?this.setValueHex(t.hex):void 0!==t.name&&this.setValueName(t.name))},i.lang.extend(ft.asn1.DERObjectIdentifier,ft.asn1.ASN1Object),ft.asn1.DEREnumerated=function(t){ft.asn1.DEREnumerated.superclass.constructor.call(this),this.hT="0a",this.setByBigInteger=function(t){this.hTLV=null,this.isModified=!0,this.hV=ft.asn1.ASN1Util.bigIntToMinTwosComplementsHex(t)},this.setByInteger=function(t){var e=new E(String(t),10);this.setByBigInteger(e)},this.setValueHex=function(t){this.hV=t},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.int?this.setByInteger(t.int):"number"==typeof t?this.setByInteger(t):void 0!==t.hex&&this.setValueHex(t.hex))},i.lang.extend(ft.asn1.DEREnumerated,ft.asn1.ASN1Object),ft.asn1.DERUTF8String=function(t){ft.asn1.DERUTF8String.superclass.constructor.call(this,t),this.hT="0c"},i.lang.extend(ft.asn1.DERUTF8String,ft.asn1.DERAbstractString),ft.asn1.DERNumericString=function(t){ft.asn1.DERNumericString.superclass.constructor.call(this,t),this.hT="12"},i.lang.extend(ft.asn1.DERNumericString,ft.asn1.DERAbstractString),ft.asn1.DERPrintableString=function(t){ft.asn1.DERPrintableString.superclass.constructor.call(this,t),this.hT="13"},i.lang.extend(ft.asn1.DERPrintableString,ft.asn1.DERAbstractString),ft.asn1.DERTeletexString=function(t){ft.asn1.DERTeletexString.superclass.constructor.call(this,t),this.hT="14"},i.lang.extend(ft.asn1.DERTeletexString,ft.asn1.DERAbstractString),ft.asn1.DERIA5String=function(t){ft.asn1.DERIA5String.superclass.constructor.call(this,t),this.hT="16"},i.lang.extend(ft.asn1.DERIA5String,ft.asn1.DERAbstractString),ft.asn1.DERUTCTime=function(t){ft.asn1.DERUTCTime.superclass.constructor.call(this,t),this.hT="17",this.setByDate=function(t){this.hTLV=null,this.isModified=!0,this.date=t,this.s=this.formatDate(this.date,"utc"),this.hV=Ft(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"utc"),this.hV=Ft(this.s)),this.hV},void 0!==t&&(void 0!==t.str?this.setString(t.str):"string"==typeof t&&t.match(/^[0-9]{12}Z$/)?this.setString(t):void 0!==t.hex?this.setStringHex(t.hex):void 0!==t.date&&this.setByDate(t.date))},i.lang.extend(ft.asn1.DERUTCTime,ft.asn1.DERAbstractTime),ft.asn1.DERGeneralizedTime=function(t){ft.asn1.DERGeneralizedTime.superclass.constructor.call(this,t),this.hT="18",this.withMillis=!1,this.setByDate=function(t){this.hTLV=null,this.isModified=!0,this.date=t,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=Ft(this.s)},this.getFreshValueHex=function(){return void 0===this.date&&void 0===this.s&&(this.date=new Date,this.s=this.formatDate(this.date,"gen",this.withMillis),this.hV=Ft(this.s)),this.hV},void 0!==t&&(void 0!==t.str?this.setString(t.str):"string"==typeof t&&t.match(/^[0-9]{14}Z$/)?this.setString(t):void 0!==t.hex?this.setStringHex(t.hex):void 0!==t.date&&this.setByDate(t.date),!0===t.millis&&(this.withMillis=!0))},i.lang.extend(ft.asn1.DERGeneralizedTime,ft.asn1.DERAbstractTime),ft.asn1.DERSequence=function(t){ft.asn1.DERSequence.superclass.constructor.call(this,t),this.hT="30",this.getFreshValueHex=function(){for(var t="",e=0;e<this.asn1Array.length;e++){t+=this.asn1Array[e].getEncodedHex()}return this.hV=t,this.hV}},i.lang.extend(ft.asn1.DERSequence,ft.asn1.DERAbstractStructured),ft.asn1.DERSet=function(t){ft.asn1.DERSet.superclass.constructor.call(this,t),this.hT="31",this.sortFlag=!0,this.getFreshValueHex=function(){for(var t=new Array,e=0;e<this.asn1Array.length;e++){var n=this.asn1Array[e];t.push(n.getEncodedHex())}return 1==this.sortFlag&&t.sort(),this.hV=t.join(""),this.hV},void 0!==t&&void 0!==t.sortflag&&0==t.sortflag&&(this.sortFlag=!1)},i.lang.extend(ft.asn1.DERSet,ft.asn1.DERAbstractStructured),ft.asn1.DERTaggedObject=function(t){ft.asn1.DERTaggedObject.superclass.constructor.call(this),this.hT="a0",this.hV="",this.isExplicit=!0,this.asn1Object=null,this.setASN1Object=function(t,e,n){this.hT=e,this.isExplicit=t,this.asn1Object=n,this.isExplicit?(this.hV=this.asn1Object.getEncodedHex(),this.hTLV=null,this.isModified=!0):(this.hV=null,this.hTLV=n.getEncodedHex(),this.hTLV=this.hTLV.replace(/^../,e),this.isModified=!1)},this.getFreshValueHex=function(){return this.hV},void 0!==t&&(void 0!==t.tag&&(this.hT=t.tag),void 0!==t.explicit&&(this.isExplicit=t.explicit),void 0!==t.obj&&(this.asn1Object=t.obj,this.setASN1Object(this.isExplicit,this.hT,this.asn1Object)))},i.lang.extend(ft.asn1.DERTaggedObject,ft.asn1.ASN1Object);var ft,dt,gt,pt=new function(){};function yt(t){for(var e=new Array,n=0;n<t.length;n++)e[n]=t.charCodeAt(n);return e}function vt(t){for(var e="",n=0;n<t.length;n++)e+=String.fromCharCode(t[n]);return e}function mt(t){for(var e="",n=0;n<t.length;n++){var r=t[n].toString(16);1==r.length&&(r="0"+r),e+=r}return e}function Ft(t){return mt(yt(t))}function St(t){return t=(t=(t=t.replace(/\=/g,"")).replace(/\+/g,"-")).replace(/\//g,"_")}function bt(t){return t.length%4==2?t+="==":t.length%4==3&&(t+="="),t=(t=t.replace(/-/g,"+")).replace(/_/g,"/")}function At(t){return t.length%2==1&&(t="0"+t),St(S(t))}function Et(t){return b(bt(t))}function wt(t){return Ot(Vt(t))}function xt(t){return decodeURIComponent(jt(t))}function Ct(t){for(var e="",n=0;n<t.length-1;n+=2)e+=String.fromCharCode(parseInt(t.substr(n,2),16));return e}function Dt(t){for(var e="",n=0;n<t.length;n++)e+=("0"+t.charCodeAt(n).toString(16)).slice(-2);return e}function Bt(t){return S(t)}function Tt(t){var e=Bt(t).replace(/(.{64})/g,"$1\r\n");return e=e.replace(/\r\n$/,"")}function It(t){return b(t.replace(/[^0-9A-Za-z\/+=]*/g,""))}function Pt(t,e){return"-----BEGIN "+e+"-----\r\n"+Tt(t)+"\r\n-----END "+e+"-----\r\n"}function Rt(t,e){if(-1==t.indexOf("-----BEGIN "))throw"can't find PEM header: "+e;return It(t=void 0!==e?(t=t.replace("-----BEGIN "+e+"-----","")).replace("-----END "+e+"-----",""):(t=t.replace(/-----BEGIN [^-]+-----/,"")).replace(/-----END [^-]+-----/,""))}function Ht(t){var e,n,r,i,s,a,o,u,h,c,l;if(l=t.match(/^(\d{2}|\d{4})(\d\d)(\d\d)(\d\d)(\d\d)(\d\d)(|\.\d+)Z$/))return u=l[1],e=parseInt(u),2===u.length&&(50<=e&&e<100?e=1900+e:0<=e&&e<50&&(e=2e3+e)),n=parseInt(l[2])-1,r=parseInt(l[3]),i=parseInt(l[4]),s=parseInt(l[5]),a=parseInt(l[6]),o=0,""!==(h=l[7])&&(c=(h.substr(1)+"00").substr(0,3),o=parseInt(c)),Date.UTC(e,n,r,i,s,a,o);throw"unsupported zulu format: "+t}function Nt(t){return~~(Ht(t)/1e3)}function Ot(t){return t.replace(/%/g,"")}function jt(t){return t.replace(/(..)/g,"%$1")}function Lt(t){var e="malformed IPv6 address";if(!t.match(/^[0-9A-Fa-f:]+$/))throw e;var n=(t=t.toLowerCase()).split(":").length-1;if(n<2)throw e;var r=":".repeat(7-n+2),i=(t=t.replace("::",r)).split(":");if(8!=i.length)throw e;for(var s=0;s<8;s++)i[s]=("0000"+i[s]).slice(-4);return i.join("")}function kt(t){if(!t.match(/^[0-9A-Fa-f]{32}$/))throw"malformed IPv6 address octet";for(var e=(t=t.toLowerCase()).match(/.{1,4}/g),n=0;n<8;n++)e[n]=e[n].replace(/^0+/,""),""==e[n]&&(e[n]="0");var r=(t=":"+e.join(":")+":").match(/:(0:){2,}/g);if(null===r)return t.slice(1,-1);var i="";for(n=0;n<r.length;n++)r[n].length>i.length&&(i=r[n]);return(t=t.replace(i,"::")).slice(1,-1)}function _t(t){var e="malformed hex value";if(!t.match(/^([0-9A-Fa-f][0-9A-Fa-f]){1,}$/))throw e;if(8!=t.length)return 32==t.length?kt(t):t;try{return parseInt(t.substr(0,2),16)+"."+parseInt(t.substr(2,2),16)+"."+parseInt(t.substr(4,2),16)+"."+parseInt(t.substr(6,2),16)}catch(t){throw e}}function Vt(t){for(var e=encodeURIComponent(t),n="",r=0;r<e.length;r++)"%"==e[r]?(n+=e.substr(r,3),r+=2):n=n+"%"+Ft(e[r]);return n}function Mt(t){return t.length%2==1?"0"+t:t.substr(0,1)>"7"?"00"+t:t}function Kt(t){t=(t=(t=t.replace(/^\s*\[\s*/,"")).replace(/\s*\]\s*$/,"")).replace(/\s*/g,"");try{return t.split(/,/).map(function(t,e,n){var r=parseInt(t);if(r<0||255<r)throw"integer not in range 0-255";return("00"+r.toString(16)).slice(-2)}).join("")}catch(t){throw"malformed integer array string: "+t}}pt.getLblen=function(t,e){if("8"!=t.substr(e+2,1))return 1;var n=parseInt(t.substr(e+3,1));return 0==n?-1:0<n&&n<10?n+1:-2},pt.getL=function(t,e){var n=pt.getLblen(t,e);return n<1?"":t.substr(e+2,2*n)},pt.getVblen=function(t,e){var n;return""==(n=pt.getL(t,e))?-1:("8"===n.substr(0,1)?new E(n.substr(2),16):new E(n,16)).intValue()},pt.getVidx=function(t,e){var n=pt.getLblen(t,e);return n<0?n:e+2*(n+1)},pt.getV=function(t,e){var n=pt.getVidx(t,e),r=pt.getVblen(t,e);return t.substr(n,2*r)},pt.getTLV=function(t,e){return t.substr(e,2)+pt.getL(t,e)+pt.getV(t,e)},pt.getNextSiblingIdx=function(t,e){return pt.getVidx(t,e)+2*pt.getVblen(t,e)},pt.getChildIdx=function(t,e){var n=pt,r=new Array,i=n.getVidx(t,e);"03"==t.substr(e,2)?r.push(i+2):r.push(i);for(var s=n.getVblen(t,e),a=i,o=0;;){var u=n.getNextSiblingIdx(t,a);if(null==u||u-i>=2*s)break;if(o>=200)break;r.push(u),a=u,o++}return r},pt.getNthChildIdx=function(t,e,n){return pt.getChildIdx(t,e)[n]},pt.getIdxbyList=function(t,e,n,r){var i,s,a=pt;if(0==n.length){if(void 0!==r&&t.substr(e,2)!==r)throw"checking tag doesn't match: "+t.substr(e,2)+"!="+r;return e}return i=n.shift(),s=a.getChildIdx(t,e),a.getIdxbyList(t,s[i],n,r)},pt.getTLVbyList=function(t,e,n,r){var i=pt,s=i.getIdxbyList(t,e,n);if(void 0===s)throw"can't find nthList object";if(void 0!==r&&t.substr(s,2)!=r)throw"checking tag doesn't match: "+t.substr(s,2)+"!="+r;return i.getTLV(t,s)},pt.getVbyList=function(t,e,n,r,i){var s,a,o=pt;if(void 0===(s=o.getIdxbyList(t,e,n,r)))throw"can't find nthList object";return a=o.getV(t,s),!0===i&&(a=a.substr(2)),a},pt.hextooidstr=function(t){var e=function(t,e){return t.length>=e?t:new Array(e-t.length+1).join("0")+t},n=[],r=t.substr(0,2),i=parseInt(r,16);n[0]=new String(Math.floor(i/40)),n[1]=new String(i%40);for(var s=t.substr(2),a=[],o=0;o<s.length/2;o++)a.push(parseInt(s.substr(2*o,2),16));var u=[],h="";for(o=0;o<a.length;o++)128&a[o]?h+=e((127&a[o]).toString(2),7):(h+=e((127&a[o]).toString(2),7),u.push(new String(parseInt(h,2))),h="");var c=n.join(".");return u.length>0&&(c=c+"."+u.join(".")),c},pt.dump=function(t,e,n,r){var i=pt,s=i.getV,a=i.dump,o=i.getChildIdx,u=t;t instanceof ft.asn1.ASN1Object&&(u=t.getEncodedHex());var h=function(t,e){return t.length<=2*e?t:t.substr(0,e)+"..(total "+t.length/2+"bytes).."+t.substr(t.length-e,e)};void 0===e&&(e={ommit_long_octet:32}),void 0===n&&(n=0),void 0===r&&(r="");var c=e.ommit_long_octet;if("01"==u.substr(n,2))return"00"==(l=s(u,n))?r+"BOOLEAN FALSE\n":r+"BOOLEAN TRUE\n";if("02"==u.substr(n,2))return r+"INTEGER "+h(l=s(u,n),c)+"\n";if("03"==u.substr(n,2))return r+"BITSTRING "+h(l=s(u,n),c)+"\n";if("04"==u.substr(n,2)){var l=s(u,n);if(i.isASN1HEX(l)){var f=r+"OCTETSTRING, encapsulates\n";return f+=a(l,e,0,r+" ")}return r+"OCTETSTRING "+h(l,c)+"\n"}if("05"==u.substr(n,2))return r+"NULL\n";if("06"==u.substr(n,2)){var d=s(u,n),g=ft.asn1.ASN1Util.oidHexToInt(d),p=ft.asn1.x509.OID.oid2name(g),y=g.replace(/\./g," ");return""!=p?r+"ObjectIdentifier "+p+" ("+y+")\n":r+"ObjectIdentifier ("+y+")\n"}if("0c"==u.substr(n,2))return r+"UTF8String '"+xt(s(u,n))+"'\n";if("13"==u.substr(n,2))return r+"PrintableString '"+xt(s(u,n))+"'\n";if("14"==u.substr(n,2))return r+"TeletexString '"+xt(s(u,n))+"'\n";if("16"==u.substr(n,2))return r+"IA5String '"+xt(s(u,n))+"'\n";if("17"==u.substr(n,2))return r+"UTCTime "+xt(s(u,n))+"\n";if("18"==u.substr(n,2))return r+"GeneralizedTime "+xt(s(u,n))+"\n";if("30"==u.substr(n,2)){if("3000"==u.substr(n,4))return r+"SEQUENCE {}\n";f=r+"SEQUENCE\n";var v=e;if((2==(S=o(u,n)).length||3==S.length)&&"06"==u.substr(S[0],2)&&"04"==u.substr(S[S.length-1],2)){p=i.oidname(s(u,S[0]));var m=JSON.parse(JSON.stringify(e));m.x509ExtName=p,v=m}for(var F=0;F<S.length;F++)f+=a(u,v,S[F],r+" ");return f}if("31"==u.substr(n,2)){f=r+"SET\n";var S=o(u,n);for(F=0;F<S.length;F++)f+=a(u,e,S[F],r+" ");return f}var b=parseInt(u.substr(n,2),16);if(0!=(128&b)){var A=31&b;if(0!=(32&b)){var f=r+"["+A+"]\n";for(S=o(u,n),F=0;F<S.length;F++)f+=a(u,e,S[F],r+" ");return f}return"68747470"==(l=s(u,n)).substr(0,8)&&(l=xt(l)),"subjectAltName"===e.x509ExtName&&2==A&&(l=xt(l)),f=r+"["+A+"] "+l+"\n"}return r+"UNKNOWN("+u.substr(n,2)+") "+s(u,n)+"\n"},pt.isASN1HEX=function(t){var e=pt;if(t.length%2==1)return!1;var n=e.getVblen(t,0),r=t.substr(0,2),i=e.getL(t,0);return t.length-r.length-i.length==2*n},pt.oidname=function(t){var e=ft.asn1;ft.lang.String.isHex(t)&&(t=e.ASN1Util.oidHexToInt(t));var n=e.x509.OID.oid2name(t);return""===n&&(n=t),n},void 0!==ft&&ft||(ft={}),void 0!==ft.asn1&&ft.asn1||(ft.asn1={}),void 0!==ft.asn1.x509&&ft.asn1.x509||(ft.asn1.x509={}),ft.asn1.x509.Certificate=function(t){ft.asn1.x509.Certificate.superclass.constructor.call(this);var e=ft,n=(e.crypto,e.asn1),r=n.DERSequence,i=n.DERBitString;this.sign=function(){this.asn1SignatureAlg=this.asn1TBSCert.asn1SignatureAlg;var t=new ft.crypto.Signature({alg:this.asn1SignatureAlg.nameAlg});t.init(this.prvKey),t.updateHex(this.asn1TBSCert.getEncodedHex()),this.hexSig=t.sign(),this.asn1Sig=new i({hex:"00"+this.hexSig});var e=new r({array:[this.asn1TBSCert,this.asn1SignatureAlg,this.asn1Sig]});this.hTLV=e.getEncodedHex(),this.isModified=!1},this.setSignatureHex=function(t){this.asn1SignatureAlg=this.asn1TBSCert.asn1SignatureAlg,this.hexSig=t,this.asn1Sig=new i({hex:"00"+this.hexSig});var e=new r({array:[this.asn1TBSCert,this.asn1SignatureAlg,this.asn1Sig]});this.hTLV=e.getEncodedHex(),this.isModified=!1},this.getEncodedHex=function(){if(0==this.isModified&&null!=this.hTLV)return this.hTLV;throw"not signed yet"},this.getPEMString=function(){return"-----BEGIN CERTIFICATE-----\r\n"+Tt(this.getEncodedHex())+"\r\n-----END CERTIFICATE-----\r\n"},void 0!==t&&(void 0!==t.tbscertobj&&(this.asn1TBSCert=t.tbscertobj),void 0!==t.prvkeyobj&&(this.prvKey=t.prvkeyobj))},i.lang.extend(ft.asn1.x509.Certificate,ft.asn1.ASN1Object),ft.asn1.x509.TBSCertificate=function(t){ft.asn1.x509.TBSCertificate.superclass.constructor.call(this);var e=ft.asn1,n=e.DERSequence,r=e.DERInteger,i=e.DERTaggedObject,s=e.x509,a=s.Time,o=s.X500Name,u=s.SubjectPublicKeyInfo;this._initialize=function(){this.asn1Array=new Array,this.asn1Version=new i({obj:new r({int:2})}),this.asn1SerialNumber=null,this.asn1SignatureAlg=null,this.asn1Issuer=null,this.asn1NotBefore=null,this.asn1NotAfter=null,this.asn1Subject=null,this.asn1SubjPKey=null,this.extensionsArray=new Array},this.setSerialNumberByParam=function(t){this.asn1SerialNumber=new r(t)},this.setSignatureAlgByParam=function(t){this.asn1SignatureAlg=new s.AlgorithmIdentifier(t)},this.setIssuerByParam=function(t){this.asn1Issuer=new o(t)},this.setNotBeforeByParam=function(t){this.asn1NotBefore=new a(t)},this.setNotAfterByParam=function(t){this.asn1NotAfter=new a(t)},this.setSubjectByParam=function(t){this.asn1Subject=new o(t)},this.setSubjectPublicKey=function(t){this.asn1SubjPKey=new u(t)},this.setSubjectPublicKeyByGetKey=function(t){var e=Ut.getKey(t);this.asn1SubjPKey=new u(e)},this.appendExtension=function(t){this.extensionsArray.push(t)},this.appendExtensionByName=function(t,e){ft.asn1.x509.Extension.appendByNameToArray(t,e,this.extensionsArray)},this.getEncodedHex=function(){if(null==this.asn1NotBefore||null==this.asn1NotAfter)throw"notBefore and/or notAfter not set";var t=new n({array:[this.asn1NotBefore,this.asn1NotAfter]});if(this.asn1Array=new Array,this.asn1Array.push(this.asn1Version),this.asn1Array.push(this.asn1SerialNumber),this.asn1Array.push(this.asn1SignatureAlg),this.asn1Array.push(this.asn1Issuer),this.asn1Array.push(t),this.asn1Array.push(this.asn1Subject),this.asn1Array.push(this.asn1SubjPKey),this.extensionsArray.length>0){var e=new n({array:this.extensionsArray}),r=new i({explicit:!0,tag:"a3",obj:e});this.asn1Array.push(r)}var s=new n({array:this.asn1Array});return this.hTLV=s.getEncodedHex(),this.isModified=!1,this.hTLV},this._initialize()},i.lang.extend(ft.asn1.x509.TBSCertificate,ft.asn1.ASN1Object),ft.asn1.x509.Extension=function(t){ft.asn1.x509.Extension.superclass.constructor.call(this);var e=ft.asn1,n=e.DERObjectIdentifier,r=e.DEROctetString,i=(e.DERBitString,e.DERBoolean),s=e.DERSequence;this.getEncodedHex=function(){var t=new n({oid:this.oid}),e=new r({hex:this.getExtnValueHex()}),a=new Array;return a.push(t),this.critical&&a.push(new i),a.push(e),new s({array:a}).getEncodedHex()},this.critical=!1,void 0!==t&&void 0!==t.critical&&(this.critical=t.critical)},i.lang.extend(ft.asn1.x509.Extension,ft.asn1.ASN1Object),ft.asn1.x509.Extension.appendByNameToArray=function(t,e,n){var r=t.toLowerCase(),i=ft.asn1.x509;if("basicconstraints"==r){var s=new i.BasicConstraints(e);n.push(s)}else if("keyusage"==r){s=new i.KeyUsage(e);n.push(s)}else if("crldistributionpoints"==r){s=new i.CRLDistributionPoints(e);n.push(s)}else if("extkeyusage"==r){s=new i.ExtKeyUsage(e);n.push(s)}else if("authoritykeyidentifier"==r){s=new i.AuthorityKeyIdentifier(e);n.push(s)}else if("authorityinfoaccess"==r){s=new i.AuthorityInfoAccess(e);n.push(s)}else if("subjectaltname"==r){s=new i.SubjectAltName(e);n.push(s)}else{if("issueraltname"!=r)throw"unsupported extension name: "+t;s=new i.IssuerAltName(e);n.push(s)}},ft.asn1.x509.KeyUsage=function(t){ft.asn1.x509.KeyUsage.superclass.constructor.call(this,t);var e=Jt.KEYUSAGE_NAME;if(this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.15",void 0!==t&&(void 0!==t.bin&&(this.asn1ExtnValue=new ft.asn1.DERBitString(t)),void 0!==t.names&&void 0!==t.names.length)){for(var n=t.names,r="000000000",i=0;i<n.length;i++)for(var s=0;s<e.length;s++)n[i]===e[s]&&(r=r.substring(0,s)+"1"+r.substring(s+1,r.length));this.asn1ExtnValue=new ft.asn1.DERBitString({bin:r})}},i.lang.extend(ft.asn1.x509.KeyUsage,ft.asn1.x509.Extension),ft.asn1.x509.BasicConstraints=function(t){ft.asn1.x509.BasicConstraints.superclass.constructor.call(this,t);this.getExtnValueHex=function(){var t=new Array;this.cA&&t.push(new ft.asn1.DERBoolean),this.pathLen>-1&&t.push(new ft.asn1.DERInteger({int:this.pathLen}));var e=new ft.asn1.DERSequence({array:t});return this.asn1ExtnValue=e,this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.19",this.cA=!1,this.pathLen=-1,void 0!==t&&(void 0!==t.cA&&(this.cA=t.cA),void 0!==t.pathLen&&(this.pathLen=t.pathLen))},i.lang.extend(ft.asn1.x509.BasicConstraints,ft.asn1.x509.Extension),ft.asn1.x509.CRLDistributionPoints=function(t){ft.asn1.x509.CRLDistributionPoints.superclass.constructor.call(this,t);var e=ft.asn1,n=e.x509;this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.setByDPArray=function(t){this.asn1ExtnValue=new e.DERSequence({array:t})},this.setByOneURI=function(t){var e=new n.GeneralNames([{uri:t}]),r=new n.DistributionPointName(e),i=new n.DistributionPoint({dpobj:r});this.setByDPArray([i])},this.oid="2.5.29.31",void 0!==t&&(void 0!==t.array?this.setByDPArray(t.array):void 0!==t.uri&&this.setByOneURI(t.uri))},i.lang.extend(ft.asn1.x509.CRLDistributionPoints,ft.asn1.x509.Extension),ft.asn1.x509.ExtKeyUsage=function(t){ft.asn1.x509.ExtKeyUsage.superclass.constructor.call(this,t);var e=ft.asn1;this.setPurposeArray=function(t){this.asn1ExtnValue=new e.DERSequence;for(var n=0;n<t.length;n++){var r=new e.DERObjectIdentifier(t[n]);this.asn1ExtnValue.appendASN1Object(r)}},this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.37",void 0!==t&&void 0!==t.array&&this.setPurposeArray(t.array)},i.lang.extend(ft.asn1.x509.ExtKeyUsage,ft.asn1.x509.Extension),ft.asn1.x509.AuthorityKeyIdentifier=function(t){ft.asn1.x509.AuthorityKeyIdentifier.superclass.constructor.call(this,t);var e=ft.asn1,n=e.DERTaggedObject;this.asn1KID=null,this.asn1CertIssuer=null,this.asn1CertSN=null,this.getExtnValueHex=function(){var t=new Array;this.asn1KID&&t.push(new n({explicit:!1,tag:"80",obj:this.asn1KID})),this.asn1CertIssuer&&t.push(new n({explicit:!1,tag:"a1",obj:this.asn1CertIssuer})),this.asn1CertSN&&t.push(new n({explicit:!1,tag:"82",obj:this.asn1CertSN}));var r=new e.DERSequence({array:t});return this.asn1ExtnValue=r,this.asn1ExtnValue.getEncodedHex()},this.setKIDByParam=function(t){this.asn1KID=new ft.asn1.DEROctetString(t)},this.setCertIssuerByParam=function(t){this.asn1CertIssuer=new ft.asn1.x509.X500Name(t)},this.setCertSNByParam=function(t){this.asn1CertSN=new ft.asn1.DERInteger(t)},this.oid="2.5.29.35",void 0!==t&&(void 0!==t.kid&&this.setKIDByParam(t.kid),void 0!==t.issuer&&this.setCertIssuerByParam(t.issuer),void 0!==t.sn&&this.setCertSNByParam(t.sn))},i.lang.extend(ft.asn1.x509.AuthorityKeyIdentifier,ft.asn1.x509.Extension),ft.asn1.x509.AuthorityInfoAccess=function(t){ft.asn1.x509.AuthorityInfoAccess.superclass.constructor.call(this,t),this.setAccessDescriptionArray=function(t){for(var e=new Array,n=ft.asn1,r=n.DERSequence,i=0;i<t.length;i++){var s=new r({array:[new n.DERObjectIdentifier(t[i].accessMethod),new n.x509.GeneralName(t[i].accessLocation)]});e.push(s)}this.asn1ExtnValue=new r({array:e})},this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="1.3.6.1.5.5.7.1.1",void 0!==t&&void 0!==t.array&&this.setAccessDescriptionArray(t.array)},i.lang.extend(ft.asn1.x509.AuthorityInfoAccess,ft.asn1.x509.Extension),ft.asn1.x509.SubjectAltName=function(t){ft.asn1.x509.SubjectAltName.superclass.constructor.call(this,t),this.setNameArray=function(t){this.asn1ExtnValue=new ft.asn1.x509.GeneralNames(t)},this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.17",void 0!==t&&void 0!==t.array&&this.setNameArray(t.array)},i.lang.extend(ft.asn1.x509.SubjectAltName,ft.asn1.x509.Extension),ft.asn1.x509.IssuerAltName=function(t){ft.asn1.x509.IssuerAltName.superclass.constructor.call(this,t),this.setNameArray=function(t){this.asn1ExtnValue=new ft.asn1.x509.GeneralNames(t)},this.getExtnValueHex=function(){return this.asn1ExtnValue.getEncodedHex()},this.oid="2.5.29.18",void 0!==t&&void 0!==t.array&&this.setNameArray(t.array)},i.lang.extend(ft.asn1.x509.IssuerAltName,ft.asn1.x509.Extension),ft.asn1.x509.CRL=function(t){ft.asn1.x509.CRL.superclass.constructor.call(this);this.sign=function(){this.asn1SignatureAlg=this.asn1TBSCertList.asn1SignatureAlg,sig=new ft.crypto.Signature({alg:"SHA1withRSA",prov:"cryptojs/jsrsa"}),sig.init(this.prvKey),sig.updateHex(this.asn1TBSCertList.getEncodedHex()),this.hexSig=sig.sign(),this.asn1Sig=new ft.asn1.DERBitString({hex:"00"+this.hexSig});var t=new ft.asn1.DERSequence({array:[this.asn1TBSCertList,this.asn1SignatureAlg,this.asn1Sig]});this.hTLV=t.getEncodedHex(),this.isModified=!1},this.getEncodedHex=function(){if(0==this.isModified&&null!=this.hTLV)return this.hTLV;throw"not signed yet"},this.getPEMString=function(){return"-----BEGIN X509 CRL-----\r\n"+Tt(this.getEncodedHex())+"\r\n-----END X509 CRL-----\r\n"},void 0!==t&&(void 0!==t.tbsobj&&(this.asn1TBSCertList=t.tbsobj),void 0!==t.prvkeyobj&&(this.prvKey=t.prvkeyobj))},i.lang.extend(ft.asn1.x509.CRL,ft.asn1.ASN1Object),ft.asn1.x509.TBSCertList=function(t){ft.asn1.x509.TBSCertList.superclass.constructor.call(this);var e=ft.asn1,n=e.DERSequence,r=e.x509,i=r.Time;this.setSignatureAlgByParam=function(t){this.asn1SignatureAlg=new r.AlgorithmIdentifier(t)},this.setIssuerByParam=function(t){this.asn1Issuer=new r.X500Name(t)},this.setThisUpdateByParam=function(t){this.asn1ThisUpdate=new i(t)},this.setNextUpdateByParam=function(t){this.asn1NextUpdate=new i(t)},this.addRevokedCert=function(t,e){var n={};null!=t&&null!=t&&(n.sn=t),null!=e&&null!=e&&(n.time=e);var i=new r.CRLEntry(n);this.aRevokedCert.push(i)},this.getEncodedHex=function(){if(this.asn1Array=new Array,null!=this.asn1Version&&this.asn1Array.push(this.asn1Version),this.asn1Array.push(this.asn1SignatureAlg),this.asn1Array.push(this.asn1Issuer),this.asn1Array.push(this.asn1ThisUpdate),null!=this.asn1NextUpdate&&this.asn1Array.push(this.asn1NextUpdate),this.aRevokedCert.length>0){var t=new n({array:this.aRevokedCert});this.asn1Array.push(t)}var e=new n({array:this.asn1Array});return this.hTLV=e.getEncodedHex(),this.isModified=!1,this.hTLV},this._initialize=function(){this.asn1Version=null,this.asn1SignatureAlg=null,this.asn1Issuer=null,this.asn1ThisUpdate=null,this.asn1NextUpdate=null,this.aRevokedCert=new Array},this._initialize()},i.lang.extend(ft.asn1.x509.TBSCertList,ft.asn1.ASN1Object),ft.asn1.x509.CRLEntry=function(t){ft.asn1.x509.CRLEntry.superclass.constructor.call(this);var e=ft.asn1;this.setCertSerial=function(t){this.sn=new e.DERInteger(t)},this.setRevocationDate=function(t){this.time=new e.x509.Time(t)},this.getEncodedHex=function(){var t=new e.DERSequence({array:[this.sn,this.time]});return this.TLV=t.getEncodedHex(),this.TLV},void 0!==t&&(void 0!==t.time&&this.setRevocationDate(t.time),void 0!==t.sn&&this.setCertSerial(t.sn))},i.lang.extend(ft.asn1.x509.CRLEntry,ft.asn1.ASN1Object),ft.asn1.x509.X500Name=function(t){ft.asn1.x509.X500Name.superclass.constructor.call(this),this.asn1Array=new Array;var e=ft.asn1,n=e.x509,r=Rt;if(this.setByString=function(t){var e=t.split("/");e.shift();for(var r=[],i=0;i<e.length;i++)if(e[i].match(/^[^=]+=.+$/))r.push(e[i]);else{var s=r.length-1;r[s]=r[s]+"/"+e[i]}for(i=0;i<r.length;i++)this.asn1Array.push(new n.RDN({str:r[i]}))},this.setByLdapString=function(t){var e=n.X500Name.ldapToOneline(t);this.setByString(e)},this.setByObject=function(t){for(var e in t)if(t.hasOwnProperty(e)){var n=new ft.asn1.x509.RDN({str:e+"="+t[e]});this.asn1Array?this.asn1Array.push(n):this.asn1Array=[n]}},this.getEncodedHex=function(){if("string"==typeof this.hTLV)return this.hTLV;var t=new e.DERSequence({array:this.asn1Array});return this.hTLV=t.getEncodedHex(),this.hTLV},void 0!==t){var i;if(void 0!==t.str?this.setByString(t.str):void 0!==t.ldapstr?this.setByLdapString(t.ldapstr):"object"==typeof t&&this.setByObject(t),void 0!==t.certissuer)(i=new Jt).hex=r(t.certissuer),this.hTLV=i.getIssuerHex();if(void 0!==t.certsubject)(i=new Jt).hex=r(t.certsubject),this.hTLV=i.getSubjectHex()}},i.lang.extend(ft.asn1.x509.X500Name,ft.asn1.ASN1Object),ft.asn1.x509.X500Name.onelineToLDAP=function(t){if("/"!==t.substr(0,1))throw"malformed input";var e=(t=t.substr(1)).split("/");return e.reverse(),(e=e.map(function(t){return t.replace(/,/,"\\,")})).join(",")},ft.asn1.x509.X500Name.ldapToOneline=function(t){for(var e=t.split(","),n=!1,r=[],i=0;e.length>0;i++){var s=e.shift();if(!0===n){var a=(r.pop()+","+s).replace(/\\,/g,",");r.push(a),n=!1}else r.push(s);"\\"===s.substr(-1,1)&&(n=!0)}return(r=r.map(function(t){return t.replace("/","\\/")})).reverse(),"/"+r.join("/")},ft.asn1.x509.RDN=function(t){ft.asn1.x509.RDN.superclass.constructor.call(this),this.asn1Array=new Array,this.addByString=function(t){this.asn1Array.push(new ft.asn1.x509.AttributeTypeAndValue({str:t}))},this.addByMultiValuedString=function(t){for(var e=ft.asn1.x509.RDN.parseString(t),n=0;n<e.length;n++)this.addByString(e[n])},this.getEncodedHex=function(){var t=new ft.asn1.DERSet({array:this.asn1Array});return this.TLV=t.getEncodedHex(),this.TLV},void 0!==t&&void 0!==t.str&&this.addByMultiValuedString(t.str)},i.lang.extend(ft.asn1.x509.RDN,ft.asn1.ASN1Object),ft.asn1.x509.RDN.parseString=function(t){for(var e=t.split(/\+/),n=!1,r=[],i=0;e.length>0;i++){var s=e.shift();if(!0===n){var a=(r.pop()+"+"+s).replace(/\\\+/g,"+");r.push(a),n=!1}else r.push(s);"\\"===s.substr(-1,1)&&(n=!0)}var o=!1,u=[];for(i=0;r.length>0;i++){s=r.shift();if(!0===o){var h=u.pop();if(s.match(/"$/)){a=(h+"+"+s).replace(/^([^=]+)="(.*)"$/,"$1=$2");u.push(a),o=!1}else u.push(h+"+"+s)}else u.push(s);s.match(/^[^=]+="/)&&(o=!0)}return u},ft.asn1.x509.AttributeTypeAndValue=function(t){ft.asn1.x509.AttributeTypeAndValue.superclass.constructor.call(this);var e=ft.asn1;this.setByString=function(t){var e=t.match(/^([^=]+)=(.+)$/);if(!e)throw"malformed attrTypeAndValueStr: "+t;this.setByAttrTypeAndValueStr(e[1],e[2])},this.setByAttrTypeAndValueStr=function(t,e){this.typeObj=ft.asn1.x509.OID.atype2obj(t);var n="utf8";"C"==t&&(n="prn"),this.valueObj=this.getValueObj(n,e)},this.getValueObj=function(t,n){if("utf8"==t)return new e.DERUTF8String({str:n});if("prn"==t)return new e.DERPrintableString({str:n});if("tel"==t)return new e.DERTeletexString({str:n});if("ia5"==t)return new e.DERIA5String({str:n});throw"unsupported directory string type: type="+t+" value="+n},this.getEncodedHex=function(){var t=new e.DERSequence({array:[this.typeObj,this.valueObj]});return this.TLV=t.getEncodedHex(),this.TLV},void 0!==t&&void 0!==t.str&&this.setByString(t.str)},i.lang.extend(ft.asn1.x509.AttributeTypeAndValue,ft.asn1.ASN1Object),ft.asn1.x509.SubjectPublicKeyInfo=function(t){ft.asn1.x509.SubjectPublicKeyInfo.superclass.constructor.call(this);var e=ft,n=e.asn1,r=n.DERInteger,i=n.DERBitString,s=n.DERObjectIdentifier,a=n.DERSequence,o=n.ASN1Util.newObject,u=n.x509.AlgorithmIdentifier,h=e.crypto;h.ECDSA,h.DSA;this.getASN1Object=function(){if(null==this.asn1AlgId||null==this.asn1SubjPKey)throw"algId and/or subjPubKey not set";return new a({array:[this.asn1AlgId,this.asn1SubjPKey]})},this.getEncodedHex=function(){var t=this.getASN1Object();return this.hTLV=t.getEncodedHex(),this.hTLV},this.setPubKey=function(t){try{if(t instanceof at){var e=o({seq:[{int:{bigint:t.n}},{int:{int:t.e}}]}).getEncodedHex();this.asn1AlgId=new u({name:"rsaEncryption"}),this.asn1SubjPKey=new i({hex:"00"+e})}}catch(t){}try{if(t instanceof ft.crypto.ECDSA){var n=new s({name:t.curveName});this.asn1AlgId=new u({name:"ecPublicKey",asn1params:n}),this.asn1SubjPKey=new i({hex:"00"+t.pubKeyHex})}}catch(t){}try{if(t instanceof ft.crypto.DSA){n=new o({seq:[{int:{bigint:t.p}},{int:{bigint:t.q}},{int:{bigint:t.g}}]});this.asn1AlgId=new u({name:"dsa",asn1params:n});var a=new r({bigint:t.y});this.asn1SubjPKey=new i({hex:"00"+a.getEncodedHex()})}}catch(t){}},void 0!==t&&this.setPubKey(t)},i.lang.extend(ft.asn1.x509.SubjectPublicKeyInfo,ft.asn1.ASN1Object),ft.asn1.x509.Time=function(t){ft.asn1.x509.Time.superclass.constructor.call(this);var e=ft.asn1,n=e.DERUTCTime,r=e.DERGeneralizedTime;this.setTimeParams=function(t){this.timeParams=t},this.getEncodedHex=function(){var t=null;return t=null!=this.timeParams?"utc"==this.type?new n(this.timeParams):new r(this.timeParams):"utc"==this.type?new n:new r,this.TLV=t.getEncodedHex(),this.TLV},this.type="utc",void 0!==t&&(void 0!==t.type?this.type=t.type:void 0!==t.str&&(t.str.match(/^[0-9]{12}Z$/)&&(this.type="utc"),t.str.match(/^[0-9]{14}Z$/)&&(this.type="gen")),this.timeParams=t)},i.lang.extend(ft.asn1.x509.Time,ft.asn1.ASN1Object),ft.asn1.x509.AlgorithmIdentifier=function(t){ft.asn1.x509.AlgorithmIdentifier.superclass.constructor.call(this),this.nameAlg=null,this.asn1Alg=null,this.asn1Params=null,this.paramEmpty=!1;var e=ft.asn1;if(this.getEncodedHex=function(){if(null===this.nameAlg&&null===this.asn1Alg)throw"algorithm not specified";null!==this.nameAlg&&null===this.asn1Alg&&(this.asn1Alg=e.x509.OID.name2obj(this.nameAlg));var t=[this.asn1Alg];null!==this.asn1Params&&t.push(this.asn1Params);var n=new e.DERSequence({array:t});return this.hTLV=n.getEncodedHex(),this.hTLV},void 0!==t&&(void 0!==t.name&&(this.nameAlg=t.name),void 0!==t.asn1params&&(this.asn1Params=t.asn1params),void 0!==t.paramempty&&(this.paramEmpty=t.paramempty)),null===this.asn1Params&&!1===this.paramEmpty&&null!==this.nameAlg){var n=this.nameAlg.toLowerCase();"withdsa"!==n.substr(-7,7)&&"withecdsa"!==n.substr(-9,9)&&(this.asn1Params=new e.DERNull)}},i.lang.extend(ft.asn1.x509.AlgorithmIdentifier,ft.asn1.ASN1Object),ft.asn1.x509.GeneralName=function(t){ft.asn1.x509.GeneralName.superclass.constructor.call(this);var e={rfc822:"81",dns:"82",dn:"a4",uri:"86",ip:"87"},n=ft.asn1,r=(n.DERSequence,n.DEROctetString),i=n.DERIA5String,s=n.DERTaggedObject,a=n.ASN1Object,o=n.x509.X500Name,u=Rt;this.explicit=!1,this.setByParam=function(t){var n=null;if(void 0!==t){if(void 0!==t.rfc822&&(this.type="rfc822",n=new i({str:t[this.type]})),void 0!==t.dns&&(this.type="dns",n=new i({str:t[this.type]})),void 0!==t.uri&&(this.type="uri",n=new i({str:t[this.type]})),void 0!==t.dn&&(this.type="dn",this.explicit=!0,n=new o({str:t.dn})),void 0!==t.ldapdn&&(this.type="dn",this.explicit=!0,n=new o({ldapstr:t.ldapdn})),void 0!==t.certissuer){this.type="dn",this.explicit=!0;var h=null;if((l=t.certissuer).match(/^[0-9A-Fa-f]+$/),-1!=l.indexOf("-----BEGIN ")&&(h=u(l)),null==h)throw"certissuer param not cert";(f=new Jt).hex=h;var c=f.getIssuerHex();(n=new a).hTLV=c}if(void 0!==t.certsubj){this.type="dn",this.explicit=!0;var l,f;h=null;if((l=t.certsubj).match(/^[0-9A-Fa-f]+$/),-1!=l.indexOf("-----BEGIN ")&&(h=u(l)),null==h)throw"certsubj param not cert";(f=new Jt).hex=h;c=f.getSubjectHex();(n=new a).hTLV=c}if(void 0!==t.ip){this.type="ip",this.explicit=!1;var d,g=t.ip,p="malformed IP address";if(g.match(/^[0-9.]+[.][0-9.]+$/)){if(8!==(d=Kt("["+g.split(".").join(",")+"]")).length)throw p}else if(g.match(/^[0-9A-Fa-f:]+:[0-9A-Fa-f:]+$/))d=Lt(g);else{if(!g.match(/^([0-9A-Fa-f][0-9A-Fa-f]){1,}$/))throw p;d=g}n=new r({hex:d})}if(null==this.type)throw"unsupported type in params="+t;this.asn1Obj=new s({explicit:this.explicit,tag:e[this.type],obj:n})}},this.getEncodedHex=function(){return this.asn1Obj.getEncodedHex()},void 0!==t&&this.setByParam(t)},i.lang.extend(ft.asn1.x509.GeneralName,ft.asn1.ASN1Object),ft.asn1.x509.GeneralNames=function(t){ft.asn1.x509.GeneralNames.superclass.constructor.call(this);var e=ft.asn1;this.setByParamArray=function(t){for(var n=0;n<t.length;n++){var r=new e.x509.GeneralName(t[n]);this.asn1Array.push(r)}},this.getEncodedHex=function(){return new e.DERSequence({array:this.asn1Array}).getEncodedHex()},this.asn1Array=new Array,void 0!==t&&this.setByParamArray(t)},i.lang.extend(ft.asn1.x509.GeneralNames,ft.asn1.ASN1Object),ft.asn1.x509.DistributionPointName=function(t){ft.asn1.x509.DistributionPointName.superclass.constructor.call(this);var e=ft.asn1,n=e.DERTaggedObject;if(this.getEncodedHex=function(){if("full"!=this.type)throw"currently type shall be 'full': "+this.type;return this.asn1Obj=new n({explicit:!1,tag:this.tag,obj:this.asn1V}),this.hTLV=this.asn1Obj.getEncodedHex(),this.hTLV},void 0!==t){if(!e.x509.GeneralNames.prototype.isPrototypeOf(t))throw"This class supports GeneralNames only as argument";this.type="full",this.tag="a0",this.asn1V=t}},i.lang.extend(ft.asn1.x509.DistributionPointName,ft.asn1.ASN1Object),ft.asn1.x509.DistributionPoint=function(t){ft.asn1.x509.DistributionPoint.superclass.constructor.call(this);var e=ft.asn1;this.getEncodedHex=function(){var t=new e.DERSequence;if(null!=this.asn1DP){var n=new e.DERTaggedObject({explicit:!0,tag:"a0",obj:this.asn1DP});t.appendASN1Object(n)}return this.hTLV=t.getEncodedHex(),this.hTLV},void 0!==t&&void 0!==t.dpobj&&(this.asn1DP=t.dpobj)},i.lang.extend(ft.asn1.x509.DistributionPoint,ft.asn1.ASN1Object),ft.asn1.x509.OID=new function(t){this.atype2oidList={CN:"2.5.4.3",L:"2.5.4.7",ST:"2.5.4.8",O:"2.5.4.10",OU:"2.5.4.11",C:"2.5.4.6",STREET:"2.5.4.9",DC:"0.9.2342.19200300.100.1.25",UID:"0.9.2342.19200300.100.1.1",SN:"2.5.4.4",T:"2.5.4.12",DN:"2.5.4.49",E:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",serialNumber:"2.5.4.5",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3"},this.name2oidList={sha1:"1.3.14.3.2.26",sha256:"2.16.840.1.101.3.4.2.1",sha384:"2.16.840.1.101.3.4.2.2",sha512:"2.16.840.1.101.3.4.2.3",sha224:"2.16.840.1.101.3.4.2.4",md5:"1.2.840.113549.2.5",md2:"1.3.14.7.2.2.1",ripemd160:"1.3.36.3.2.1",MD2withRSA:"1.2.840.113549.1.1.2",MD4withRSA:"1.2.840.113549.1.1.3",MD5withRSA:"1.2.840.113549.1.1.4",SHA1withRSA:"1.2.840.113549.1.1.5",SHA224withRSA:"1.2.840.113549.1.1.14",SHA256withRSA:"1.2.840.113549.1.1.11",SHA384withRSA:"1.2.840.113549.1.1.12",SHA512withRSA:"1.2.840.113549.1.1.13",SHA1withECDSA:"1.2.840.10045.4.1",SHA224withECDSA:"1.2.840.10045.4.3.1",SHA256withECDSA:"1.2.840.10045.4.3.2",SHA384withECDSA:"1.2.840.10045.4.3.3",SHA512withECDSA:"1.2.840.10045.4.3.4",dsa:"1.2.840.10040.4.1",SHA1withDSA:"1.2.840.10040.4.3",SHA224withDSA:"2.16.840.1.101.3.4.3.1",SHA256withDSA:"2.16.840.1.101.3.4.3.2",rsaEncryption:"1.2.840.113549.1.1.1",commonName:"2.5.4.3",countryName:"2.5.4.6",localityName:"2.5.4.7",stateOrProvinceName:"2.5.4.8",streetAddress:"2.5.4.9",organizationName:"2.5.4.10",organizationalUnitName:"2.5.4.11",domainComponent:"0.9.2342.19200300.100.1.25",userId:"0.9.2342.19200300.100.1.1",surname:"2.5.4.4",title:"2.5.4.12",distinguishedName:"2.5.4.49",emailAddress:"1.2.840.113549.1.9.1",description:"2.5.4.13",businessCategory:"2.5.4.15",postalCode:"2.5.4.17",uniqueIdentifier:"2.5.4.45",organizationIdentifier:"2.5.4.97",jurisdictionOfIncorporationL:"1.3.6.1.4.1.311.60.2.1.1",jurisdictionOfIncorporationSP:"1.3.6.1.4.1.311.60.2.1.2",jurisdictionOfIncorporationC:"1.3.6.1.4.1.311.60.2.1.3",subjectKeyIdentifier:"2.5.29.14",keyUsage:"2.5.29.15",subjectAltName:"2.5.29.17",issuerAltName:"2.5.29.18",basicConstraints:"2.5.29.19",nameConstraints:"2.5.29.30",cRLDistributionPoints:"2.5.29.31",certificatePolicies:"2.5.29.32",authorityKeyIdentifier:"2.5.29.35",policyConstraints:"2.5.29.36",extKeyUsage:"2.5.29.37",authorityInfoAccess:"1.3.6.1.5.5.7.1.1",ocsp:"1.3.6.1.5.5.7.48.1",caIssuers:"1.3.6.1.5.5.7.48.2",anyExtendedKeyUsage:"2.5.29.37.0",serverAuth:"1.3.6.1.5.5.7.3.1",clientAuth:"1.3.6.1.5.5.7.3.2",codeSigning:"1.3.6.1.5.5.7.3.3",emailProtection:"1.3.6.1.5.5.7.3.4",timeStamping:"1.3.6.1.5.5.7.3.8",ocspSigning:"1.3.6.1.5.5.7.3.9",ecPublicKey:"1.2.840.10045.2.1",secp256r1:"1.2.840.10045.3.1.7",secp256k1:"1.3.132.0.10",secp384r1:"1.3.132.0.34",pkcs5PBES2:"1.2.840.113549.1.5.13",pkcs5PBKDF2:"1.2.840.113549.1.5.12","des-EDE3-CBC":"1.2.840.113549.3.7",data:"1.2.840.113549.1.7.1","signed-data":"1.2.840.113549.1.7.2","enveloped-data":"1.2.840.113549.1.7.3","digested-data":"1.2.840.113549.1.7.5","encrypted-data":"1.2.840.113549.1.7.6","authenticated-data":"1.2.840.113549.1.9.16.1.2",tstinfo:"1.2.840.113549.1.9.16.1.4",extensionRequest:"1.2.840.113549.1.9.14"},this.objCache={},this.name2obj=function(t){if(void 0!==this.objCache[t])return this.objCache[t];if(void 0===this.name2oidList[t])throw"Name of ObjectIdentifier not defined: "+t;var e=this.name2oidList[t],n=new ft.asn1.DERObjectIdentifier({oid:e});return this.objCache[t]=n,n},this.atype2obj=function(t){if(void 0!==this.objCache[t])return this.objCache[t];if(void 0===this.atype2oidList[t])throw"AttributeType name undefined: "+t;var e=this.atype2oidList[t],n=new ft.asn1.DERObjectIdentifier({oid:e});return this.objCache[t]=n,n}},ft.asn1.x509.OID.oid2name=function(t){var e=ft.asn1.x509.OID.name2oidList;for(var n in e)if(e[n]==t)return n;return""},ft.asn1.x509.OID.oid2atype=function(t){var e=ft.asn1.x509.OID.atype2oidList;for(var n in e)if(e[n]==t)return n;return t},ft.asn1.x509.OID.name2oid=function(t){var e=ft.asn1.x509.OID.name2oidList;return void 0===e[t]?"":e[t]},ft.asn1.x509.X509Util={},ft.asn1.x509.X509Util.newCertPEM=function(t){var e=ft.asn1.x509,n=e.TBSCertificate,r=e.Certificate,i=new n;if(void 0===t.serial)throw"serial number undefined.";if(i.setSerialNumberByParam(t.serial),"string"!=typeof t.sigalg.name)throw"unproper signature algorithm name";if(i.setSignatureAlgByParam(t.sigalg),void 0===t.issuer)throw"issuer name undefined.";if(i.setIssuerByParam(t.issuer),void 0===t.notbefore)throw"notbefore undefined.";if(i.setNotBeforeByParam(t.notbefore),void 0===t.notafter)throw"notafter undefined.";if(i.setNotAfterByParam(t.notafter),void 0===t.subject)throw"subject name undefined.";if(i.setSubjectByParam(t.subject),void 0===t.sbjpubkey)throw"subject public key undefined.";if(i.setSubjectPublicKeyByGetKey(t.sbjpubkey),void 0!==t.ext&&void 0!==t.ext.length)for(var s=0;s<t.ext.length;s++)for(key in t.ext[s])i.appendExtensionByName(key,t.ext[s][key]);if(void 0===t.cakey&&void 0===t.sighex)throw"param cakey and sighex undefined.";var a=null;return t.cakey&&(a=new r({tbscertobj:i,prvkeyobj:!0===t.cakey.isPrivate?t.cakey:Ut.getKey.apply(null,t.cakey)})).sign(),t.sighex&&(a=new r({tbscertobj:i})).setSignatureHex(t.sighex),a.getPEMString()},void 0!==ft&&ft||(ft={}),void 0!==ft.asn1&&ft.asn1||(ft.asn1={}),void 0!==ft.asn1.cms&&ft.asn1.cms||(ft.asn1.cms={}),ft.asn1.cms.Attribute=function(t){var e=ft.asn1;e.cms.Attribute.superclass.constructor.call(this),this.getEncodedHex=function(){var t,n,r;t=new e.DERObjectIdentifier({oid:this.attrTypeOid}),n=new e.DERSet({array:this.valueList});try{n.getEncodedHex()}catch(t){throw"fail valueSet.getEncodedHex in Attribute(1)/"+t}r=new e.DERSequence({array:[t,n]});try{this.hTLV=r.getEncodedHex()}catch(t){throw"failed seq.getEncodedHex in Attribute(2)/"+t}return this.hTLV}},i.lang.extend(ft.asn1.cms.Attribute,ft.asn1.ASN1Object),ft.asn1.cms.ContentType=function(t){var e=ft.asn1;e.cms.ContentType.superclass.constructor.call(this),this.attrTypeOid="1.2.840.113549.1.9.3";var n=null;if(void 0!==t){n=new e.DERObjectIdentifier(t);this.valueList=[n]}},i.lang.extend(ft.asn1.cms.ContentType,ft.asn1.cms.Attribute),ft.asn1.cms.MessageDigest=function(t){var e=ft,n=e.asn1,r=n.DEROctetString,i=n.cms;if(i.MessageDigest.superclass.constructor.call(this),this.attrTypeOid="1.2.840.113549.1.9.4",void 0!==t)if(t.eciObj instanceof i.EncapsulatedContentInfo&&"string"==typeof t.hashAlg){var s=t.eciObj.eContentValueHex,a=t.hashAlg;(o=new r({hex:e.crypto.Util.hashHex(s,a)})).getEncodedHex(),this.valueList=[o]}else{var o;(o=new r(t)).getEncodedHex(),this.valueList=[o]}},i.lang.extend(ft.asn1.cms.MessageDigest,ft.asn1.cms.Attribute),ft.asn1.cms.SigningTime=function(t){var e=ft.asn1;if(e.cms.SigningTime.superclass.constructor.call(this),this.attrTypeOid="1.2.840.113549.1.9.5",void 0!==t){var n=new e.x509.Time(t);try{n.getEncodedHex()}catch(t){throw"SigningTime.getEncodedHex() failed/"+t}this.valueList=[n]}},i.lang.extend(ft.asn1.cms.SigningTime,ft.asn1.cms.Attribute),ft.asn1.cms.SigningCertificate=function(t){var e=ft,n=e.asn1,r=n.DERSequence,i=n.cms;e.crypto;i.SigningCertificate.superclass.constructor.call(this),this.attrTypeOid="1.2.840.113549.1.9.16.2.12",this.setCerts=function(t){for(var s=[],a=0;a<t.length;a++){var o=Rt(t[a]),u=e.crypto.Util.hashHex(o,"sha1"),h=new n.DEROctetString({hex:u});h.getEncodedHex();var c=new i.IssuerAndSerialNumber({cert:t[a]});c.getEncodedHex();var l=new r({array:[h,c]});l.getEncodedHex(),s.push(l)}var f=new r({array:s});f.getEncodedHex(),this.valueList=[f]},void 0!==t&&"object"==typeof t.array&&this.setCerts(t.array)},i.lang.extend(ft.asn1.cms.SigningCertificate,ft.asn1.cms.Attribute),ft.asn1.cms.SigningCertificateV2=function(t){var e=ft,n=e.asn1,r=n.DERSequence,i=n.x509,s=n.cms,a=e.crypto;if(s.SigningCertificateV2.superclass.constructor.call(this),this.attrTypeOid="1.2.840.113549.1.9.16.2.47",this.setCerts=function(t,e){for(var o=[],u=0;u<t.length;u++){var h=Rt(t[u]),c=[];"sha256"!==e&&c.push(new i.AlgorithmIdentifier({name:e}));var l=a.Util.hashHex(h,e),f=new n.DEROctetString({hex:l});f.getEncodedHex(),c.push(f);var d=new s.IssuerAndSerialNumber({cert:t[u]});d.getEncodedHex(),c.push(d);var g=new r({array:c});g.getEncodedHex(),o.push(g)}var p=new r({array:o});p.getEncodedHex(),this.valueList=[p]},void 0!==t&&"object"==typeof t.array){var o="sha256";"string"==typeof t.hashAlg&&(o=t.hashAlg),this.setCerts(t.array,o)}},i.lang.extend(ft.asn1.cms.SigningCertificateV2,ft.asn1.cms.Attribute),ft.asn1.cms.IssuerAndSerialNumber=function(t){var e=ft.asn1,n=e.DERInteger,r=e.cms,i=e.x509.X500Name,s=Jt;r.IssuerAndSerialNumber.superclass.constructor.call(this);this.setByCertPEM=function(t){var e=Rt(t),r=new s;r.hex=e;var a=r.getIssuerHex();this.dIssuer=new i,this.dIssuer.hTLV=a;var o=r.getSerialNumberHex();this.dSerial=new n({hex:o})},this.getEncodedHex=function(){var t=new e.DERSequence({array:[this.dIssuer,this.dSerial]});return this.hTLV=t.getEncodedHex(),this.hTLV},void 0!==t&&("string"==typeof t&&-1!=t.indexOf("-----BEGIN ")&&this.setByCertPEM(t),t.issuer&&t.serial&&(t.issuer instanceof i?this.dIssuer=t.issuer:this.dIssuer=new i(t.issuer),t.serial instanceof n?this.dSerial=t.serial:this.dSerial=new n(t.serial)),"string"==typeof t.cert&&this.setByCertPEM(t.cert))},i.lang.extend(ft.asn1.cms.IssuerAndSerialNumber,ft.asn1.ASN1Object),ft.asn1.cms.AttributeList=function(t){var e=ft.asn1,n=e.cms;n.AttributeList.superclass.constructor.call(this),this.list=new Array,this.sortFlag=!0,this.add=function(t){t instanceof n.Attribute&&this.list.push(t)},this.length=function(){return this.list.length},this.clear=function(){this.list=new Array,this.hTLV=null,this.hV=null},this.getEncodedHex=function(){if("string"==typeof this.hTLV)return this.hTLV;var t=new e.DERSet({array:this.list,sortflag:this.sortFlag});return this.hTLV=t.getEncodedHex(),this.hTLV},void 0!==t&&void 0!==t.sortflag&&0==t.sortflag&&(this.sortFlag=!1)},i.lang.extend(ft.asn1.cms.AttributeList,ft.asn1.ASN1Object),ft.asn1.cms.SignerInfo=function(t){var e=ft,n=e.asn1,r=n.DERTaggedObject,i=n.cms,s=i.AttributeList,a=i.ContentType,o=i.EncapsulatedContentInfo,u=i.MessageDigest,h=i.SignedData,c=n.x509.AlgorithmIdentifier,l=e.crypto,f=Ut;i.SignerInfo.superclass.constructor.call(this),this.dCMSVersion=new n.DERInteger({int:1}),this.dSignerIdentifier=null,this.dDigestAlgorithm=null,this.dSignedAttrs=new s,this.dSigAlg=null,this.dSig=null,this.dUnsignedAttrs=new s,this.setSignerIdentifier=function(t){if("string"==typeof t&&-1!=t.indexOf("CERTIFICATE")&&-1!=t.indexOf("BEGIN")&&-1!=t.indexOf("END")){this.dSignerIdentifier=new i.IssuerAndSerialNumber({cert:t})}},this.setForContentAndHash=function(t){void 0!==t&&(t.eciObj instanceof o&&(this.dSignedAttrs.add(new a({oid:"1.2.840.113549.1.7.1"})),this.dSignedAttrs.add(new u({eciObj:t.eciObj,hashAlg:t.hashAlg}))),void 0!==t.sdObj&&t.sdObj instanceof h&&-1==t.sdObj.digestAlgNameList.join(":").indexOf(t.hashAlg)&&t.sdObj.digestAlgNameList.push(t.hashAlg),"string"==typeof t.hashAlg&&(this.dDigestAlgorithm=new c({name:t.hashAlg})))},this.sign=function(t,e){this.dSigAlg=new c({name:e});var r=this.dSignedAttrs.getEncodedHex(),i=f.getKey(t),s=new l.Signature({alg:e});s.init(i),s.updateHex(r);var a=s.sign();this.dSig=new n.DEROctetString({hex:a})},this.addUnsigned=function(t){this.hTLV=null,this.dUnsignedAttrs.hTLV=null,this.dUnsignedAttrs.add(t)},this.getEncodedHex=function(){if(this.dSignedAttrs instanceof s&&0==this.dSignedAttrs.length())throw"SignedAttrs length = 0 (empty)";var t=new r({obj:this.dSignedAttrs,tag:"a0",explicit:!1}),e=null;this.dUnsignedAttrs.length()>0&&(e=new r({obj:this.dUnsignedAttrs,tag:"a1",explicit:!1}));var i=[this.dCMSVersion,this.dSignerIdentifier,this.dDigestAlgorithm,t,this.dSigAlg,this.dSig];null!=e&&i.push(e);var a=new n.DERSequence({array:i});return this.hTLV=a.getEncodedHex(),this.hTLV}},i.lang.extend(ft.asn1.cms.SignerInfo,ft.asn1.ASN1Object),ft.asn1.cms.EncapsulatedContentInfo=function(t){var e=ft.asn1,n=e.DERTaggedObject,r=e.DERSequence,i=e.DERObjectIdentifier,s=e.DEROctetString;e.cms.EncapsulatedContentInfo.superclass.constructor.call(this),this.dEContentType=new i({name:"data"}),this.dEContent=null,this.isDetached=!1,this.eContentValueHex=null,this.setContentType=function(t){t.match(/^[0-2][.][0-9.]+$/)?this.dEContentType=new i({oid:t}):this.dEContentType=new i({name:t})},this.setContentValue=function(t){void 0!==t&&("string"==typeof t.hex?this.eContentValueHex=t.hex:"string"==typeof t.str&&(this.eContentValueHex=wt(t.str)))},this.setContentValueHex=function(t){this.eContentValueHex=t},this.setContentValueStr=function(t){this.eContentValueHex=wt(t)},this.getEncodedHex=function(){if("string"!=typeof this.eContentValueHex)throw"eContentValue not yet set";var t=new s({hex:this.eContentValueHex});this.dEContent=new n({obj:t,tag:"a0",explicit:!0});var e=[this.dEContentType];this.isDetached||e.push(this.dEContent);var i=new r({array:e});return this.hTLV=i.getEncodedHex(),this.hTLV}},i.lang.extend(ft.asn1.cms.EncapsulatedContentInfo,ft.asn1.ASN1Object),ft.asn1.cms.ContentInfo=function(t){var e=ft.asn1,n=e.DERTaggedObject,r=e.DERSequence,i=e.x509;ft.asn1.cms.ContentInfo.superclass.constructor.call(this),this.dContentType=null,this.dContent=null,this.setContentType=function(t){"string"==typeof t&&(this.dContentType=i.OID.name2obj(t))},this.getEncodedHex=function(){var t=new n({obj:this.dContent,tag:"a0",explicit:!0}),e=new r({array:[this.dContentType,t]});return this.hTLV=e.getEncodedHex(),this.hTLV},void 0!==t&&(t.type&&this.setContentType(t.type),t.obj&&t.obj instanceof e.ASN1Object&&(this.dContent=t.obj))},i.lang.extend(ft.asn1.cms.ContentInfo,ft.asn1.ASN1Object),ft.asn1.cms.SignedData=function(t){var e=ft.asn1,n=e.ASN1Object,r=e.DERInteger,i=e.DERSet,s=e.DERSequence,a=e.DERTaggedObject,o=e.cms,u=o.EncapsulatedContentInfo,h=o.SignerInfo,c=o.ContentInfo,l=e.x509.AlgorithmIdentifier;ft.asn1.cms.SignedData.superclass.constructor.call(this),this.dCMSVersion=new r({int:1}),this.dDigestAlgs=null,this.digestAlgNameList=[],this.dEncapContentInfo=new u,this.dCerts=null,this.certificateList=[],this.crlList=[],this.signerInfoList=[new h],this.addCertificatesByPEM=function(t){var e=Rt(t),r=new n;r.hTLV=e,this.certificateList.push(r)},this.getEncodedHex=function(){if("string"==typeof this.hTLV)return this.hTLV;if(null==this.dDigestAlgs){for(var t=[],e=0;e<this.digestAlgNameList.length;e++){var n=this.digestAlgNameList[e],r=new l({name:n});t.push(r)}this.dDigestAlgs=new i({array:t})}var o=[this.dCMSVersion,this.dDigestAlgs,this.dEncapContentInfo];if(null==this.dCerts&&this.certificateList.length>0){var u=new i({array:this.certificateList});this.dCerts=new a({obj:u,tag:"a0",explicit:!1})}null!=this.dCerts&&o.push(this.dCerts);var h=new i({array:this.signerInfoList});o.push(h);var c=new s({array:o});return this.hTLV=c.getEncodedHex(),this.hTLV},this.getContentInfo=function(){return this.getEncodedHex(),new c({type:"signed-data",obj:this})},this.getContentInfoEncodedHex=function(){return this.getContentInfo().getEncodedHex()},this.getPEM=function(){return Pt(this.getContentInfoEncodedHex(),"CMS")}},i.lang.extend(ft.asn1.cms.SignedData,ft.asn1.ASN1Object),ft.asn1.cms.CMSUtil=new function(){},ft.asn1.cms.CMSUtil.newSignedData=function(t){var e=ft.asn1,n=e.cms,r=n.SignerInfo,i=n.SignedData,s=n.SigningTime,a=n.SigningCertificate,o=n.SigningCertificateV2,u=e.cades.SignaturePolicyIdentifier,h=new i;if(h.dEncapContentInfo.setContentValue(t.content),"object"==typeof t.certs)for(var c=0;c<t.certs.length;c++)h.addCertificatesByPEM(t.certs[c]);h.signerInfoList=[];for(c=0;c<t.signerInfos.length;c++){var l=t.signerInfos[c],f=new r;for(attrName in f.setSignerIdentifier(l.signerCert),f.setForContentAndHash({sdObj:h,eciObj:h.dEncapContentInfo,hashAlg:l.hashAlg}),l.sAttr){var d=l.sAttr[attrName];if("SigningTime"==attrName){var g=new s(d);f.dSignedAttrs.add(g)}if("SigningCertificate"==attrName){g=new a(d);f.dSignedAttrs.add(g)}if("SigningCertificateV2"==attrName){g=new o(d);f.dSignedAttrs.add(g)}if("SignaturePolicyIdentifier"==attrName){g=new u(d);f.dSignedAttrs.add(g)}}f.sign(l.signerPrvKey,l.sigAlg),h.signerInfoList.push(f)}return h},ft.asn1.cms.CMSUtil.verifySignedData=function(t){var e=ft,n=e.asn1,r=n.cms,i=(r.SignerInfo,r.SignedData,r.SigningTime,r.SigningCertificate,r.SigningCertificateV2,n.cades.SignaturePolicyIdentifier,e.lang.String.isHex),s=pt,a=s.getVbyList,o=s.getTLVbyList,u=s.getIdxbyList,h=s.getChildIdx,c=s.getTLV,l=s.oidname,f=e.crypto.Util.hashHex;void 0===t.cms&&i(t.cms);var d=t.cms,g=function(t,e){var n=e.idx;e.signerid_issuer1=o(t,n,[1,0],"30"),e.signerid_serial1=a(t,n,[1,1],"02"),e.hashalg=l(a(t,n,[2,0],"06"));var r=u(t,n,[3],"a0");e.idxSignedAttrs=r,p(t,e,r);var i=h(t,n).length;if(i<6)throw"malformed SignerInfo";e.sigalg=l(a(t,n,[i-2,0],"06")),e.sigval=a(t,n,[i-1],"04")},p=function(t,e,n){var r=h(t,n);e.signedAttrIdxList=r;for(var i=0;i<r.length;i++){var s,o=r[i],u=a(t,o,[0],"06");"2a864886f70d010905"===u?(s=xt(a(t,o,[1,0])),e.saSigningTime=s):"2a864886f70d010904"===u&&(s=a(t,o,[1,0],"04"),e.saMessageDigest=s)}},y=function(t,e,n,r){n.verifyDetail={};var i=n.verifyDetail,s=e.parse.econtent,a=n.hashalg,o=n.saMessageDigest;i.validMessageDigest=!1,f(s,a)===o&&(i.validMessageDigest=!0),function(t,e,n,r){var i,s=e.parse.certsIdx;if(void 0===e.certs){i=[],e.certkeys=[];for(var a=h(t,s),o=0;o<a.length;o++){var u=c(t,a[o]),l=new Jt;l.readCertHex(u),i[o]=l,e.certkeys[o]=l.getPublicKey()}e.certs=i}else i=e.certs;e.cccc=i.length,e.cccci=a.length;for(o=0;o<i.length;o++){var f=l.getIssuerHex(),d=l.getSerialNumberHex();n.signerid_issuer1===f&&n.signerid_serial1===d&&(n.certkey_idx=o)}}(t,e,n),i.validSignatureValue=!1;var u=n.sigalg,l="31"+c(t,n.idxSignedAttrs).substr(2);n.signedattrshex=l;var d=e.certs[n.certkey_idx].getPublicKey(),g=new ft.crypto.Signature({alg:u});g.init(d),g.updateHex(l);var p=g.verify(n.sigval);i.validSignatureValue_isValid=p,!0===p&&(i.validSignatureValue=!0),n.isValid=!1,i.validMessageDigest&&i.validSignatureValue&&(n.isValid=!0)},v={isValid:!1,parse:{}};return function(t,e){if("2a864886f70d010702"!==a(t,0,[0],"06"))return e;e.cmsType="signedData",e.econtent=a(t,0,[1,0,2,1,0]),function(t,e){for(var n,r=3;r<6;r++)if(void 0!==(n=u(t,0,[1,0,r]))){var i=t.substr(n,2);"a0"===i&&(e.certsIdx=n),"a1"===i&&(e.revinfosIdx=n),"31"===i&&(e.signerinfosIdx=n)}}(t,e),e.signerInfos=[],function(t,e){var n=e.signerinfosIdx;if(void 0!==n){var r=h(t,n);e.signerInfoIdxList=r;for(var i=0;i<r.length;i++){var s={idx:r[i]};g(t,s),e.signerInfos.push(s)}}}(t,e)}(d,v.parse),function(t,e){for(var n=e.parse.signerInfos,r=n.length,i=!0,s=0;s<r;s++){var a=n[s];y(t,e,a,s),a.isValid||(i=!1)}e.isValid=i}(d,v),v},void 0!==ft&&ft||(ft={}),void 0!==ft.asn1&&ft.asn1||(ft.asn1={}),void 0!==ft.asn1.tsp&&ft.asn1.tsp||(ft.asn1.tsp={}),ft.asn1.tsp.Accuracy=function(t){var e=ft.asn1,n=e.DERInteger,r=e.DERSequence,i=e.DERTaggedObject;e.tsp.Accuracy.superclass.constructor.call(this),this.seconds=null,this.millis=null,this.micros=null,this.getEncodedHex=function(){var t=null,e=null,s=null,a=[];if(null!=this.seconds&&(t=new n({int:this.seconds}),a.push(t)),null!=this.millis){var o=new n({int:this.millis});e=new i({obj:o,tag:"80",explicit:!1}),a.push(e)}if(null!=this.micros){var u=new n({int:this.micros});s=new i({obj:u,tag:"81",explicit:!1}),a.push(s)}var h=new r({array:a});return this.hTLV=h.getEncodedHex(),this.hTLV},void 0!==t&&("number"==typeof t.seconds&&(this.seconds=t.seconds),"number"==typeof t.millis&&(this.millis=t.millis),"number"==typeof t.micros&&(this.micros=t.micros))},i.lang.extend(ft.asn1.tsp.Accuracy,ft.asn1.ASN1Object),ft.asn1.tsp.MessageImprint=function(t){var e=ft.asn1,n=e.DERSequence,r=e.DEROctetString,i=e.x509.AlgorithmIdentifier;e.tsp.MessageImprint.superclass.constructor.call(this),this.dHashAlg=null,this.dHashValue=null,this.getEncodedHex=function(){return"string"==typeof this.hTLV?this.hTLV:new n({array:[this.dHashAlg,this.dHashValue]}).getEncodedHex()},void 0!==t&&("string"==typeof t.hashAlg&&(this.dHashAlg=new i({name:t.hashAlg})),"string"==typeof t.hashValue&&(this.dHashValue=new r({hex:t.hashValue})))},i.lang.extend(ft.asn1.tsp.MessageImprint,ft.asn1.ASN1Object),ft.asn1.tsp.TimeStampReq=function(t){var e=ft.asn1,n=e.DERSequence,r=e.DERInteger,i=e.DERBoolean,s=e.DERObjectIdentifier,a=e.tsp,o=a.MessageImprint;a.TimeStampReq.superclass.constructor.call(this),this.dVersion=new r({int:1}),this.dMessageImprint=null,this.dPolicy=null,this.dNonce=null,this.certReq=!0,this.setMessageImprint=function(t){t instanceof o?this.dMessageImprint=t:"object"==typeof t&&(this.dMessageImprint=new o(t))},this.getEncodedHex=function(){if(null==this.dMessageImprint)throw"messageImprint shall be specified";var t=[this.dVersion,this.dMessageImprint];null!=this.dPolicy&&t.push(this.dPolicy),null!=this.dNonce&&t.push(this.dNonce),this.certReq&&t.push(new i);var e=new n({array:t});return this.hTLV=e.getEncodedHex(),this.hTLV},void 0!==t&&("object"==typeof t.mi&&this.setMessageImprint(t.mi),"object"==typeof t.policy&&(this.dPolicy=new s(t.policy)),"object"==typeof t.nonce&&(this.dNonce=new r(t.nonce)),"boolean"==typeof t.certreq&&(this.certReq=t.certreq))},i.lang.extend(ft.asn1.tsp.TimeStampReq,ft.asn1.ASN1Object),ft.asn1.tsp.TSTInfo=function(t){var e=ft.asn1,n=e.DERSequence,r=e.DERInteger,i=e.DERBoolean,s=e.DERGeneralizedTime,a=e.DERObjectIdentifier,o=e.tsp,u=o.MessageImprint,h=o.Accuracy,c=e.x509.X500Name;if(o.TSTInfo.superclass.constructor.call(this),this.dVersion=new r({int:1}),this.dPolicy=null,this.dMessageImprint=null,this.dSerialNumber=null,this.dGenTime=null,this.dAccuracy=null,this.dOrdering=null,this.dNonce=null,this.dTsa=null,this.getEncodedHex=function(){var t=[this.dVersion];if(null==this.dPolicy)throw"policy shall be specified.";if(t.push(this.dPolicy),null==this.dMessageImprint)throw"messageImprint shall be specified.";if(t.push(this.dMessageImprint),null==this.dSerialNumber)throw"serialNumber shall be specified.";if(t.push(this.dSerialNumber),null==this.dGenTime)throw"genTime shall be specified.";t.push(this.dGenTime),null!=this.dAccuracy&&t.push(this.dAccuracy),null!=this.dOrdering&&t.push(this.dOrdering),null!=this.dNonce&&t.push(this.dNonce),null!=this.dTsa&&t.push(this.dTsa);var e=new n({array:t});return this.hTLV=e.getEncodedHex(),this.hTLV},void 0!==t){if("string"==typeof t.policy){if(!t.policy.match(/^[0-9.]+$/))throw"policy shall be oid like 0.1.4.134";this.dPolicy=new a({oid:t.policy})}void 0!==t.messageImprint&&(this.dMessageImprint=new u(t.messageImprint)),void 0!==t.serialNumber&&(this.dSerialNumber=new r(t.serialNumber)),void 0!==t.genTime&&(this.dGenTime=new s(t.genTime)),void 0!==t.accuracy&&(this.dAccuracy=new h(t.accuracy)),void 0!==t.ordering&&1==t.ordering&&(this.dOrdering=new i),void 0!==t.nonce&&(this.dNonce=new r(t.nonce)),void 0!==t.tsa&&(this.dTsa=new c(t.tsa))}},i.lang.extend(ft.asn1.tsp.TSTInfo,ft.asn1.ASN1Object),ft.asn1.tsp.TimeStampResp=function(t){var e=ft.asn1,n=e.DERSequence,r=e.ASN1Object,i=e.tsp,s=i.PKIStatusInfo;i.TimeStampResp.superclass.constructor.call(this),this.dStatus=null,this.dTST=null,this.getEncodedHex=function(){if(null==this.dStatus)throw"status shall be specified";var t=[this.dStatus];null!=this.dTST&&t.push(this.dTST);var e=new n({array:t});return this.hTLV=e.getEncodedHex(),this.hTLV},void 0!==t&&("object"==typeof t.status&&(this.dStatus=new s(t.status)),void 0!==t.tst&&t.tst instanceof r&&(this.dTST=t.tst.getContentInfo()))},i.lang.extend(ft.asn1.tsp.TimeStampResp,ft.asn1.ASN1Object),ft.asn1.tsp.PKIStatusInfo=function(t){var e=ft.asn1,n=e.DERSequence,r=e.tsp,i=r.PKIStatus,s=r.PKIFreeText,a=r.PKIFailureInfo;r.PKIStatusInfo.superclass.constructor.call(this),this.dStatus=null,this.dStatusString=null,this.dFailureInfo=null,this.getEncodedHex=function(){if(null==this.dStatus)throw"status shall be specified";var t=[this.dStatus];null!=this.dStatusString&&t.push(this.dStatusString),null!=this.dFailureInfo&&t.push(this.dFailureInfo);var e=new n({array:t});return this.hTLV=e.getEncodedHex(),this.hTLV},void 0!==t&&("object"==typeof t.status&&(this.dStatus=new i(t.status)),"object"==typeof t.statstr&&(this.dStatusString=new s({array:t.statstr})),"object"==typeof t.failinfo&&(this.dFailureInfo=new a(t.failinfo)))},i.lang.extend(ft.asn1.tsp.PKIStatusInfo,ft.asn1.ASN1Object),ft.asn1.tsp.PKIStatus=function(t){var e=ft.asn1,n=e.DERInteger,r=e.tsp,i=r.PKIStatus;r.PKIStatus.superclass.constructor.call(this);if(this.getEncodedHex=function(){return this.hTLV=this.dStatus.getEncodedHex(),this.hTLV},void 0!==t)if(void 0!==t.name){var s=i.valueList;if(void 0===s[t.name])throw"name undefined: "+t.name;this.dStatus=new n({int:s[t.name]})}else this.dStatus=new n(t)},i.lang.extend(ft.asn1.tsp.PKIStatus,ft.asn1.ASN1Object),ft.asn1.tsp.PKIStatus.valueList={granted:0,grantedWithMods:1,rejection:2,waiting:3,revocationWarning:4,revocationNotification:5},ft.asn1.tsp.PKIFreeText=function(t){var e=ft.asn1,n=e.DERSequence,r=e.DERUTF8String;e.tsp.PKIFreeText.superclass.constructor.call(this),this.textList=[],this.getEncodedHex=function(){for(var t=[],e=0;e<this.textList.length;e++)t.push(new r({str:this.textList[e]}));var i=new n({array:t});return this.hTLV=i.getEncodedHex(),this.hTLV},void 0!==t&&"object"==typeof t.array&&(this.textList=t.array)},i.lang.extend(ft.asn1.tsp.PKIFreeText,ft.asn1.ASN1Object),ft.asn1.tsp.PKIFailureInfo=function(t){var e=ft.asn1,n=e.DERBitString,r=e.tsp.PKIFailureInfo;if(r.superclass.constructor.call(this),this.value=null,this.getEncodedHex=function(){if(null==this.value)throw"value shall be specified";var t=new Number(this.value).toString(2),e=new n;return e.setByBinaryString(t),this.hTLV=e.getEncodedHex(),this.hTLV},void 0!==t)if("string"==typeof t.name){var i=r.valueList;if(void 0===i[t.name])throw"name undefined: "+t.name;this.value=i[t.name]}else"number"==typeof t.int&&(this.value=t.int)},i.lang.extend(ft.asn1.tsp.PKIFailureInfo,ft.asn1.ASN1Object),ft.asn1.tsp.PKIFailureInfo.valueList={badAlg:0,badRequest:2,badDataFormat:5,timeNotAvailable:14,unacceptedPolicy:15,unacceptedExtension:16,addInfoNotAvailable:17,systemFailure:25},ft.asn1.tsp.AbstractTSAAdapter=function(t){this.getTSTHex=function(t,e){throw"not implemented yet"}},ft.asn1.tsp.SimpleTSAAdapter=function(t){var e=ft,n=e.asn1.tsp,r=e.crypto.Util.hashHex;n.SimpleTSAAdapter.superclass.constructor.call(this),this.params=null,this.serial=0,this.getTSTHex=function(t,e){var i=r(t,e);this.params.tstInfo.messageImprint={hashAlg:e,hashValue:i},this.params.tstInfo.serialNumber={int:this.serial++};var s=Math.floor(1e9*Math.random());return this.params.tstInfo.nonce={int:s},n.TSPUtil.newTimeStampToken(this.params).getContentInfoEncodedHex()},void 0!==t&&(this.params=t)},i.lang.extend(ft.asn1.tsp.SimpleTSAAdapter,ft.asn1.tsp.AbstractTSAAdapter),ft.asn1.tsp.FixedTSAAdapter=function(t){var e=ft,n=e.asn1.tsp,r=e.crypto.Util.hashHex;n.FixedTSAAdapter.superclass.constructor.call(this),this.params=null,this.getTSTHex=function(t,e){var i=r(t,e);return this.params.tstInfo.messageImprint={hashAlg:e,hashValue:i},n.TSPUtil.newTimeStampToken(this.params).getContentInfoEncodedHex()},void 0!==t&&(this.params=t)},i.lang.extend(ft.asn1.tsp.FixedTSAAdapter,ft.asn1.tsp.AbstractTSAAdapter),ft.asn1.tsp.TSPUtil=new function(){},ft.asn1.tsp.TSPUtil.newTimeStampToken=function(t){var e=ft.asn1,n=e.cms,r=(e.tsp,e.tsp.TSTInfo),i=new n.SignedData,s=new r(t.tstInfo).getEncodedHex();if(i.dEncapContentInfo.setContentValue({hex:s}),i.dEncapContentInfo.setContentType("tstinfo"),"object"==typeof t.certs)for(var a=0;a<t.certs.length;a++)i.addCertificatesByPEM(t.certs[a]);var o=i.signerInfoList[0];o.setSignerIdentifier(t.signerCert),o.setForContentAndHash({sdObj:i,eciObj:i.dEncapContentInfo,hashAlg:t.hashAlg});var u=new n.SigningCertificate({array:[t.signerCert]});return o.dSignedAttrs.add(u),o.sign(t.signerPrvKey,t.sigAlg),i},ft.asn1.tsp.TSPUtil.parseTimeStampReq=function(t){var e=pt,n=e.getChildIdx,r=e.getV,i=e.getTLV,s={certreq:!1},a=n(t,0);if(a.length<2)throw"TimeStampReq must have at least 2 items";var o=i(t,a[1]);s.mi=ft.asn1.tsp.TSPUtil.parseMessageImprint(o);for(var u=2;u<a.length;u++){var h=a[u],c=t.substr(h,2);if("06"==c){var l=r(t,h);s.policy=e.hextooidstr(l)}"02"==c&&(s.nonce=r(t,h)),"01"==c&&(s.certreq=!0)}return s},ft.asn1.tsp.TSPUtil.parseMessageImprint=function(t){var e=pt,n=e.getChildIdx,r=e.getV,i=e.getIdxbyList,s={};if("30"!=t.substr(0,2))throw"head of messageImprint hex shall be '30'";n(t,0);var a=r(t,i(t,0,[0,0])),o=e.hextooidstr(a),u=ft.asn1.x509.OID.oid2name(o);if(""==u)throw"hashAlg name undefined: "+o;var h=u,c=i(t,0,[1]);return s.hashAlg=h,s.hashValue=r(t,c),s},void 0!==ft&&ft||(ft={}),void 0!==ft.asn1&&ft.asn1||(ft.asn1={}),void 0!==ft.asn1.cades&&ft.asn1.cades||(ft.asn1.cades={}),ft.asn1.cades.SignaturePolicyIdentifier=function(t){var e=ft.asn1,n=e.DERObjectIdentifier,r=e.DERSequence,i=e.cades,s=i.OtherHashAlgAndValue;if(i.SignaturePolicyIdentifier.superclass.constructor.call(this),this.attrTypeOid="1.2.840.113549.1.9.16.2.15",void 0!==t&&"string"==typeof t.oid&&"object"==typeof t.hash){var a=new r({array:[new n({oid:t.oid}),new s(t.hash)]});this.valueList=[a]}},i.lang.extend(ft.asn1.cades.SignaturePolicyIdentifier,ft.asn1.cms.Attribute),ft.asn1.cades.OtherHashAlgAndValue=function(t){var e=ft.asn1,n=e.DERSequence,r=e.DEROctetString,i=e.x509.AlgorithmIdentifier;e.cades.OtherHashAlgAndValue.superclass.constructor.call(this),this.dAlg=null,this.dHash=null,this.getEncodedHex=function(){var t=new n({array:[this.dAlg,this.dHash]});return this.hTLV=t.getEncodedHex(),this.hTLV},void 0!==t&&"string"==typeof t.alg&&"string"==typeof t.hash&&(this.dAlg=new i({name:t.alg}),this.dHash=new r({hex:t.hash}))},i.lang.extend(ft.asn1.cades.OtherHashAlgAndValue,ft.asn1.ASN1Object),ft.asn1.cades.SignatureTimeStamp=function(t){var e=ft.asn1,n=e.ASN1Object;e.x509;if(e.cades.SignatureTimeStamp.superclass.constructor.call(this),this.attrTypeOid="1.2.840.113549.1.9.16.2.14",this.tstHex=null,void 0!==t){if(void 0!==t.res)if("string"==typeof t.res&&t.res.match(/^[0-9A-Fa-f]+$/));else if(!(t.res instanceof n))throw"res param shall be ASN1Object or hex string";if(void 0!==t.tst)if("string"==typeof t.tst&&t.tst.match(/^[0-9A-Fa-f]+$/)){var r=new n;this.tstHex=t.tst,r.hTLV=this.tstHex,r.getEncodedHex(),this.valueList=[r]}else if(!(t.tst instanceof n))throw"tst param shall be ASN1Object or hex string"}},i.lang.extend(ft.asn1.cades.SignatureTimeStamp,ft.asn1.cms.Attribute),ft.asn1.cades.CompleteCertificateRefs=function(t){var e=ft.asn1.cades;e.CompleteCertificateRefs.superclass.constructor.call(this),this.attrTypeOid="1.2.840.113549.1.9.16.2.21",this.setByArray=function(t){this.valueList=[];for(var n=0;n<t.length;n++){var r=new e.OtherCertID(t[n]);this.valueList.push(r)}},void 0!==t&&"object"==typeof t&&"number"==typeof t.length&&this.setByArray(t)},i.lang.extend(ft.asn1.cades.CompleteCertificateRefs,ft.asn1.cms.Attribute),ft.asn1.cades.OtherCertID=function(t){var e=ft.asn1,n=e.cms,r=e.cades;r.OtherCertID.superclass.constructor.call(this),this.hasIssuerSerial=!0,this.dOtherCertHash=null,this.dIssuerSerial=null,this.setByCertPEM=function(t){this.dOtherCertHash=new r.OtherHash(t),this.hasIssuerSerial&&(this.dIssuerSerial=new n.IssuerAndSerialNumber(t))},this.getEncodedHex=function(){if(null!=this.hTLV)return this.hTLV;if(null==this.dOtherCertHash)throw"otherCertHash not set";var t=[this.dOtherCertHash];null!=this.dIssuerSerial&&t.push(this.dIssuerSerial);var n=new e.DERSequence({array:t});return this.hTLV=n.getEncodedHex(),this.hTLV},void 0!==t&&("string"==typeof t&&-1!=t.indexOf("-----BEGIN ")&&this.setByCertPEM(t),"object"==typeof t&&(!1===t.hasis&&(this.hasIssuerSerial=!1),"string"==typeof t.cert&&this.setByCertPEM(t.cert)))},i.lang.extend(ft.asn1.cades.OtherCertID,ft.asn1.ASN1Object),ft.asn1.cades.OtherHash=function(t){var e=ft,n=e.asn1,r=(n.cms,n.cades),i=r.OtherHashAlgAndValue,s=e.crypto.Util.hashHex;if(r.OtherHash.superclass.constructor.call(this),this.alg="sha256",this.dOtherHash=null,this.setByCertPEM=function(t){if(-1==t.indexOf("-----BEGIN "))throw"certPEM not to seem PEM format";var e=Rt(t),n=s(e,this.alg);this.dOtherHash=new i({alg:this.alg,hash:n})},this.getEncodedHex=function(){if(null==this.dOtherHash)throw"OtherHash not set";return this.dOtherHash.getEncodedHex()},void 0!==t)if("string"==typeof t)if(-1!=t.indexOf("-----BEGIN "))this.setByCertPEM(t);else{if(!t.match(/^[0-9A-Fa-f]+$/))throw"unsupported string value for params";this.dOtherHash=new n.DEROctetString({hex:t})}else"object"==typeof t&&("string"==typeof t.cert?("string"==typeof t.alg&&(this.alg=t.alg),this.setByCertPEM(t.cert)):this.dOtherHash=new i(t))},i.lang.extend(ft.asn1.cades.OtherHash,ft.asn1.ASN1Object),ft.asn1.cades.CAdESUtil=new function(){},ft.asn1.cades.CAdESUtil.addSigTS=function(t,e,n){},ft.asn1.cades.CAdESUtil.parseSignedDataForAddingUnsigned=function(t){var e=pt,n=e.getChildIdx,r=e.getTLV,i=e.getTLVbyList,s=e.getIdxbyList,a=ft.asn1,o=a.ASN1Object,u=a.cms.SignedData,h=a.cades.CAdESUtil,c={};if("06092a864886f70d010702"!=i(t,0,[0]))throw"hex is not CMS SignedData";var l=n(t,s(t,0,[1,0]));if(l.length<4)throw"num of SignedData elem shall be 4 at least";var f=l.shift();c.version=r(t,f);var d=l.shift();c.algs=r(t,d);var g=l.shift();c.encapcontent=r(t,g),c.certs=null,c.revs=null,c.si=[];var p=l.shift();"a0"==t.substr(p,2)&&(c.certs=r(t,p),p=l.shift()),"a1"==t.substr(p,2)&&(c.revs=r(t,p),p=l.shift());var y=p;if("31"!=t.substr(y,2))throw"Can't find signerInfos";for(var v=n(t,y),m=0;m<v.length;m++){var F=v[m],S=h.parseSignerInfoForAddingUnsigned(t,F,m);c.si[m]=S}var b=null;c.obj=new u,(b=new o).hTLV=c.version,c.obj.dCMSVersion=b,(b=new o).hTLV=c.algs,c.obj.dDigestAlgs=b,(b=new o).hTLV=c.encapcontent,c.obj.dEncapContentInfo=b,(b=new o).hTLV=c.certs,c.obj.dCerts=b,c.obj.signerInfoList=[];for(m=0;m<c.si.length;m++)c.obj.signerInfoList.push(c.si[m].obj);return c},ft.asn1.cades.CAdESUtil.parseSignerInfoForAddingUnsigned=function(t,e,n){var r=pt,i=r.getChildIdx,s=r.getTLV,a=r.getV,o=ft.asn1,u=o.ASN1Object,h=o.cms,c=h.AttributeList,l=h.SignerInfo,f={},d=i(t,e);if(6!=d.length)throw"not supported items for SignerInfo (!=6)";var g=d.shift();f.version=s(t,g);var p=d.shift();f.si=s(t,p);var y=d.shift();f.digalg=s(t,y);var v=d.shift();f.sattrs=s(t,v);var m=d.shift();f.sigalg=s(t,m);var F=d.shift();f.sig=s(t,F),f.sigval=a(t,F);var S=null;return f.obj=new l,(S=new u).hTLV=f.version,f.obj.dCMSVersion=S,(S=new u).hTLV=f.si,f.obj.dSignerIdentifier=S,(S=new u).hTLV=f.digalg,f.obj.dDigestAlgorithm=S,(S=new u).hTLV=f.sattrs,f.obj.dSignedAttrs=S,(S=new u).hTLV=f.sigalg,f.obj.dSigAlg=S,(S=new u).hTLV=f.sig,f.obj.dSig=S,f.obj.dUnsignedAttrs=new c,f},void 0!==ft.asn1.csr&&ft.asn1.csr||(ft.asn1.csr={}),ft.asn1.csr.CertificationRequest=function(t){var e=ft,n=e.asn1,r=n.DERBitString,i=n.DERSequence,s=n.csr,a=n.x509;s.CertificationRequest.superclass.constructor.call(this);this.sign=function(t,n){null==this.prvKey&&(this.prvKey=n),this.asn1SignatureAlg=new a.AlgorithmIdentifier({name:t}),sig=new e.crypto.Signature({alg:t}),sig.init(this.prvKey),sig.updateHex(this.asn1CSRInfo.getEncodedHex()),this.hexSig=sig.sign(),this.asn1Sig=new r({hex:"00"+this.hexSig});var s=new i({array:[this.asn1CSRInfo,this.asn1SignatureAlg,this.asn1Sig]});this.hTLV=s.getEncodedHex(),this.isModified=!1},this.getPEMString=function(){return Pt(this.getEncodedHex(),"CERTIFICATE REQUEST")},this.getEncodedHex=function(){if(0==this.isModified&&null!=this.hTLV)return this.hTLV;throw"not signed yet"},void 0!==t&&void 0!==t.csrinfo&&(this.asn1CSRInfo=t.csrinfo)},i.lang.extend(ft.asn1.csr.CertificationRequest,ft.asn1.ASN1Object),ft.asn1.csr.CertificationRequestInfo=function(t){var e=ft.asn1,n=e.DERInteger,r=e.DERSequence,i=e.DERSet,s=e.DERNull,a=e.DERTaggedObject,o=e.DERObjectIdentifier,u=e.csr,h=e.x509,c=h.X500Name,l=h.Extension,f=Ut;u.CertificationRequestInfo.superclass.constructor.call(this),this._initialize=function(){this.asn1Array=new Array,this.asn1Version=new n({int:0}),this.asn1Subject=null,this.asn1SubjPKey=null,this.extensionsArray=new Array},this.setSubjectByParam=function(t){this.asn1Subject=new c(t)},this.setSubjectPublicKeyByGetKey=function(t){var e=f.getKey(t);this.asn1SubjPKey=new h.SubjectPublicKeyInfo(e)},this.appendExtensionByName=function(t,e){l.appendByNameToArray(t,e,this.extensionsArray)},this.getEncodedHex=function(){if(this.asn1Array=new Array,this.asn1Array.push(this.asn1Version),this.asn1Array.push(this.asn1Subject),this.asn1Array.push(this.asn1SubjPKey),this.extensionsArray.length>0){var t=new r({array:this.extensionsArray}),e=new i({array:[t]}),n=new r({array:[new o({oid:"1.2.840.113549.1.9.14"}),e]}),u=new a({explicit:!0,tag:"a0",obj:n});this.asn1Array.push(u)}else{u=new a({explicit:!1,tag:"a0",obj:new s});this.asn1Array.push(u)}var h=new r({array:this.asn1Array});return this.hTLV=h.getEncodedHex(),this.isModified=!1,this.hTLV},this._initialize()},i.lang.extend(ft.asn1.csr.CertificationRequestInfo,ft.asn1.ASN1Object),ft.asn1.csr.CSRUtil=new function(){},ft.asn1.csr.CSRUtil.newCSRPEM=function(t){var e=Ut,n=ft.asn1.csr;if(void 0===t.subject)throw"parameter subject undefined";if(void 0===t.sbjpubkey)throw"parameter sbjpubkey undefined";if(void 0===t.sigalg)throw"parameter sigalg undefined";if(void 0===t.sbjprvkey)throw"parameter sbjpubkey undefined";var r=new n.CertificationRequestInfo;if(r.setSubjectByParam(t.subject),r.setSubjectPublicKeyByGetKey(t.sbjpubkey),void 0!==t.ext&&void 0!==t.ext.length)for(var i=0;i<t.ext.length;i++)for(key in t.ext[i])r.appendExtensionByName(key,t.ext[i][key]);var s=new n.CertificationRequest({csrinfo:r}),a=e.getKey(t.sbjprvkey);return s.sign(t.sigalg,a),s.getPEMString()},ft.asn1.csr.CSRUtil.getInfo=function(t){var e=pt.getTLVbyList,n={subject:{},pubkey:{}};if(-1==t.indexOf("-----BEGIN CERTIFICATE REQUEST"))throw"argument is not PEM file";var r=Rt(t,"CERTIFICATE REQUEST");return n.subject.hex=e(r,0,[0,1]),n.subject.name=Jt.hex2dn(n.subject.hex),n.pubkey.hex=e(r,0,[0,2]),n.pubkey.obj=Ut.getKey(n.pubkey.hex,null,"pkcs8pub"),n},void 0!==ft&&ft||(ft={}),void 0!==ft.asn1&&ft.asn1||(ft.asn1={}),void 0!==ft.asn1.ocsp&&ft.asn1.ocsp||(ft.asn1.ocsp={}),ft.asn1.ocsp.DEFAULT_HASH="sha1",ft.asn1.ocsp.CertID=function(t){var e=ft,n=e.asn1,r=n.DEROctetString,i=n.DERInteger,s=n.DERSequence,a=n.x509.AlgorithmIdentifier,o=n.ocsp,u=o.DEFAULT_HASH,h=e.crypto.Util.hashHex,c=Jt,l=pt;if(o.CertID.superclass.constructor.call(this),this.dHashAlg=null,this.dIssuerNameHash=null,this.dIssuerKeyHash=null,this.dSerialNumber=null,this.setByValue=function(t,e,n,s){void 0===s&&(s=u),this.dHashAlg=new a({name:s}),this.dIssuerNameHash=new r({hex:t}),this.dIssuerKeyHash=new r({hex:e}),this.dSerialNumber=new i({hex:n})},this.setByCert=function(t,e,n){void 0===n&&(n=u);var r=new c;r.readCertPEM(e);var i=new c;i.readCertPEM(t);var s=i.getPublicKeyHex(),a=l.getTLVbyList(s,0,[1,0],"30"),o=r.getSerialNumberHex(),f=h(i.getSubjectHex(),n),d=h(a,n);this.setByValue(f,d,o,n),this.hoge=r.getSerialNumberHex()},this.getEncodedHex=function(){if(null===this.dHashAlg&&null===this.dIssuerNameHash&&null===this.dIssuerKeyHash&&null===this.dSerialNumber)throw"not yet set values";var t=[this.dHashAlg,this.dIssuerNameHash,this.dIssuerKeyHash,this.dSerialNumber],e=new s({array:t});return this.hTLV=e.getEncodedHex(),this.hTLV},void 0!==t){var f=t;if(void 0!==f.issuerCert&&void 0!==f.subjectCert){var d=u;void 0===f.alg&&(d=void 0),this.setByCert(f.issuerCert,f.subjectCert,d)}else{if(void 0===f.namehash||void 0===f.keyhash||void 0===f.serial)throw"invalid constructor arguments";d=u;void 0===f.alg&&(d=void 0),this.setByValue(f.namehash,f.keyhash,f.serial,d)}}},i.lang.extend(ft.asn1.ocsp.CertID,ft.asn1.ASN1Object),ft.asn1.ocsp.Request=function(t){var e=ft.asn1,n=e.DERSequence,r=e.ocsp;if(r.Request.superclass.constructor.call(this),this.dReqCert=null,this.dExt=null,this.getEncodedHex=function(){var t=[];if(null===this.dReqCert)throw"reqCert not set";t.push(this.dReqCert);var e=new n({array:t});return this.hTLV=e.getEncodedHex(),this.hTLV},void 0!==t){var i=new r.CertID(t);this.dReqCert=i}},i.lang.extend(ft.asn1.ocsp.Request,ft.asn1.ASN1Object),ft.asn1.ocsp.TBSRequest=function(t){var e=ft.asn1,n=e.DERSequence,r=e.ocsp;r.TBSRequest.superclass.constructor.call(this),this.version=0,this.dRequestorName=null,this.dRequestList=[],this.dRequestExt=null,this.setRequestListByParam=function(t){for(var e=[],n=0;n<t.length;n++){var i=new r.Request(t[0]);e.push(i)}this.dRequestList=e},this.getEncodedHex=function(){var t=[];if(0!==this.version)throw"not supported version: "+this.version;if(null!==this.dRequestorName)throw"requestorName not supported";var e=new n({array:this.dRequestList});if(t.push(e),null!==this.dRequestExt)throw"requestExtensions not supported";var r=new n({array:t});return this.hTLV=r.getEncodedHex(),this.hTLV},void 0!==t&&void 0!==t.reqList&&this.setRequestListByParam(t.reqList)},i.lang.extend(ft.asn1.ocsp.TBSRequest,ft.asn1.ASN1Object),ft.asn1.ocsp.OCSPRequest=function(t){var e=ft.asn1,n=e.DERSequence,r=e.ocsp;if(r.OCSPRequest.superclass.constructor.call(this),this.dTbsRequest=null,this.dOptionalSignature=null,this.getEncodedHex=function(){var t=[];if(null===this.dTbsRequest)throw"tbsRequest not set";if(t.push(this.dTbsRequest),null!==this.dOptionalSignature)throw"optionalSignature not supported";var e=new n({array:t});return this.hTLV=e.getEncodedHex(),this.hTLV},void 0!==t&&void 0!==t.reqList){var i=new r.TBSRequest(t);this.dTbsRequest=i}},i.lang.extend(ft.asn1.ocsp.OCSPRequest,ft.asn1.ASN1Object),ft.asn1.ocsp.OCSPUtil={},ft.asn1.ocsp.OCSPUtil.getRequestHex=function(t,e,n){var r=ft.asn1.ocsp;void 0===n&&(n=r.DEFAULT_HASH);var i={alg:n,issuerCert:t,subjectCert:e};return new r.OCSPRequest({reqList:[i]}).getEncodedHex()},ft.asn1.ocsp.OCSPUtil.getOCSPResponseInfo=function(t){var e=pt,n=e.getVbyList,r=e.getIdxbyList,i=(n=e.getVbyList,e.getV),s={};try{var a=n(t,0,[0],"0a");s.responseStatus=parseInt(a,16)}catch(t){}if(0!==s.responseStatus)return s;try{var o=r(t,0,[1,0,1,0,0,2,0,1]);"80"===t.substr(o,2)?s.certStatus="good":"a1"===t.substr(o,2)?(s.certStatus="revoked",s.revocationTime=xt(n(t,o,[0]))):"82"===t.substr(o,2)&&(s.certStatus="unknown")}catch(t){}try{var u=r(t,0,[1,0,1,0,0,2,0,2]);s.thisUpdate=xt(i(t,u))}catch(t){}try{var h=r(t,0,[1,0,1,0,0,2,0,3]);"a0"===t.substr(h,2)&&(s.nextUpdate=xt(n(t,h,[0])))}catch(t){}return s},void 0!==ft&&ft||(ft={}),void 0!==ft.lang&&ft.lang||(ft.lang={}),ft.lang.String=function(){},"function"==typeof t?(dt=function(e){return St(new t(e,"utf8").toString("base64"))},gt=function(e){return new t(bt(e),"base64").toString("utf8")}):(dt=function(t){return At(Ot(Vt(t)))},gt=function(t){return decodeURIComponent(jt(Et(t)))}),ft.lang.String.isInteger=function(t){return!!t.match(/^[0-9]+$/)||!!t.match(/^-[0-9]+$/)},ft.lang.String.isHex=function(t){return!(t.length%2!=0||!t.match(/^[0-9a-f]+$/)&&!t.match(/^[0-9A-F]+$/))},ft.lang.String.isBase64=function(t){return!(!(t=t.replace(/\s+/g,"")).match(/^[0-9A-Za-z+\/]+={0,3}$/)||t.length%4!=0)},ft.lang.String.isBase64URL=function(t){return!t.match(/[+\/=]/)&&(t=bt(t),ft.lang.String.isBase64(t))},ft.lang.String.isIntegerArray=function(t){return!!(t=t.replace(/\s+/g,"")).match(/^\[[0-9,]+\]$/)};void 0!==ft&&ft||(ft={}),void 0!==ft.crypto&&ft.crypto||(ft.crypto={}),ft.crypto.Util=new function(){this.DIGESTINFOHEAD={sha1:"3021300906052b0e03021a05000414",sha224:"302d300d06096086480165030402040500041c",sha256:"3031300d060960864801650304020105000420",sha384:"3041300d060960864801650304020205000430",sha512:"3051300d060960864801650304020305000440",md2:"3020300c06082a864886f70d020205000410",md5:"3020300c06082a864886f70d020505000410",ripemd160:"3021300906052b2403020105000414"},this.DEFAULTPROVIDER={md5:"cryptojs",sha1:"cryptojs",sha224:"cryptojs",sha256:"cryptojs",sha384:"cryptojs",sha512:"cryptojs",ripemd160:"cryptojs",hmacmd5:"cryptojs",hmacsha1:"cryptojs",hmacsha224:"cryptojs",hmacsha256:"cryptojs",hmacsha384:"cryptojs",hmacsha512:"cryptojs",hmacripemd160:"cryptojs",MD5withRSA:"cryptojs/jsrsa",SHA1withRSA:"cryptojs/jsrsa",SHA224withRSA:"cryptojs/jsrsa",SHA256withRSA:"cryptojs/jsrsa",SHA384withRSA:"cryptojs/jsrsa",SHA512withRSA:"cryptojs/jsrsa",RIPEMD160withRSA:"cryptojs/jsrsa",MD5withECDSA:"cryptojs/jsrsa",SHA1withECDSA:"cryptojs/jsrsa",SHA224withECDSA:"cryptojs/jsrsa",SHA256withECDSA:"cryptojs/jsrsa",SHA384withECDSA:"cryptojs/jsrsa",SHA512withECDSA:"cryptojs/jsrsa",RIPEMD160withECDSA:"cryptojs/jsrsa",SHA1withDSA:"cryptojs/jsrsa",SHA224withDSA:"cryptojs/jsrsa",SHA256withDSA:"cryptojs/jsrsa",MD5withRSAandMGF1:"cryptojs/jsrsa",SHA1withRSAandMGF1:"cryptojs/jsrsa",SHA224withRSAandMGF1:"cryptojs/jsrsa",SHA256withRSAandMGF1:"cryptojs/jsrsa",SHA384withRSAandMGF1:"cryptojs/jsrsa",SHA512withRSAandMGF1:"cryptojs/jsrsa",RIPEMD160withRSAandMGF1:"cryptojs/jsrsa"},this.CRYPTOJSMESSAGEDIGESTNAME={md5:y.algo.MD5,sha1:y.algo.SHA1,sha224:y.algo.SHA224,sha256:y.algo.SHA256,sha384:y.algo.SHA384,sha512:y.algo.SHA512,ripemd160:y.algo.RIPEMD160},this.getDigestInfoHex=function(t,e){if(void 0===this.DIGESTINFOHEAD[e])throw"alg not supported in Util.DIGESTINFOHEAD: "+e;return this.DIGESTINFOHEAD[e]+t},this.getPaddedDigestInfoHex=function(t,e,n){var r=this.getDigestInfoHex(t,e),i=n/4;if(r.length+22>i)throw"key is too short for SigAlg: keylen="+n+","+e;for(var s="0001",a="00"+r,o="",u=i-s.length-a.length,h=0;h<u;h+=2)o+="ff";return s+o+a},this.hashString=function(t,e){return new ft.crypto.MessageDigest({alg:e}).digestString(t)},this.hashHex=function(t,e){return new ft.crypto.MessageDigest({alg:e}).digestHex(t)},this.sha1=function(t){return new ft.crypto.MessageDigest({alg:"sha1",prov:"cryptojs"}).digestString(t)},this.sha256=function(t){return new ft.crypto.MessageDigest({alg:"sha256",prov:"cryptojs"}).digestString(t)},this.sha256Hex=function(t){return new ft.crypto.MessageDigest({alg:"sha256",prov:"cryptojs"}).digestHex(t)},this.sha512=function(t){return new ft.crypto.MessageDigest({alg:"sha512",prov:"cryptojs"}).digestString(t)},this.sha512Hex=function(t){return new ft.crypto.MessageDigest({alg:"sha512",prov:"cryptojs"}).digestHex(t)}},ft.crypto.Util.md5=function(t){return new ft.crypto.MessageDigest({alg:"md5",prov:"cryptojs"}).digestString(t)},ft.crypto.Util.ripemd160=function(t){return new ft.crypto.MessageDigest({alg:"ripemd160",prov:"cryptojs"}).digestString(t)},ft.crypto.Util.SECURERANDOMGEN=new rt,ft.crypto.Util.getRandomHexOfNbytes=function(t){var e=new Array(t);return ft.crypto.Util.SECURERANDOMGEN.nextBytes(e),mt(e)},ft.crypto.Util.getRandomBigIntegerOfNbytes=function(t){return new E(ft.crypto.Util.getRandomHexOfNbytes(t),16)},ft.crypto.Util.getRandomHexOfNbits=function(t){var e=t%8,n=new Array((t-e)/8+1);return ft.crypto.Util.SECURERANDOMGEN.nextBytes(n),n[0]=(255<<e&255^255)&n[0],mt(n)},ft.crypto.Util.getRandomBigIntegerOfNbits=function(t){return new E(ft.crypto.Util.getRandomHexOfNbits(t),16)},ft.crypto.Util.getRandomBigIntegerZeroToMax=function(t){for(var e=t.bitLength();;){var n=ft.crypto.Util.getRandomBigIntegerOfNbits(e);if(-1!=t.compareTo(n))return n}},ft.crypto.Util.getRandomBigIntegerMinToMax=function(t,e){var n=t.compareTo(e);if(1==n)throw"biMin is greater than biMax";if(0==n)return t;var r=e.subtract(t);return ft.crypto.Util.getRandomBigIntegerZeroToMax(r).add(t)},ft.crypto.MessageDigest=function(t){this.setAlgAndProvider=function(t,e){if(null!==(t=ft.crypto.MessageDigest.getCanonicalAlgName(t))&&void 0===e&&(e=ft.crypto.Util.DEFAULTPROVIDER[t]),-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(t)&&"cryptojs"==e){try{this.md=ft.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[t].create()}catch(e){throw"setAlgAndProvider hash alg set fail alg="+t+"/"+e}this.updateString=function(t){this.md.update(t)},this.updateHex=function(t){var e=y.enc.Hex.parse(t);this.md.update(e)},this.digest=function(){return this.md.finalize().toString(y.enc.Hex)},this.digestString=function(t){return this.updateString(t),this.digest()},this.digestHex=function(t){return this.updateHex(t),this.digest()}}if(-1!=":sha256:".indexOf(t)&&"sjcl"==e){try{this.md=new sjcl.hash.sha256}catch(e){throw"setAlgAndProvider hash alg set fail alg="+t+"/"+e}this.updateString=function(t){this.md.update(t)},this.updateHex=function(t){var e=sjcl.codec.hex.toBits(t);this.md.update(e)},this.digest=function(){var t=this.md.finalize();return sjcl.codec.hex.fromBits(t)},this.digestString=function(t){return this.updateString(t),this.digest()},this.digestHex=function(t){return this.updateHex(t),this.digest()}}},this.updateString=function(t){throw"updateString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.updateHex=function(t){throw"updateHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digest=function(){throw"digest() not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestString=function(t){throw"digestString(str) not supported for this alg/prov: "+this.algName+"/"+this.provName},this.digestHex=function(t){throw"digestHex(hex) not supported for this alg/prov: "+this.algName+"/"+this.provName},void 0!==t&&void 0!==t.alg&&(this.algName=t.alg,void 0===t.prov&&(this.provName=ft.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName))},ft.crypto.MessageDigest.getCanonicalAlgName=function(t){return"string"==typeof t&&(t=(t=t.toLowerCase()).replace(/-/,"")),t},ft.crypto.MessageDigest.getHashLength=function(t){var e=ft.crypto.MessageDigest,n=e.getCanonicalAlgName(t);if(void 0===e.HASHLENGTH[n])throw"not supported algorithm: "+t;return e.HASHLENGTH[n]},ft.crypto.MessageDigest.HASHLENGTH={md5:16,sha1:20,sha224:28,sha256:32,sha384:48,sha512:64,ripemd160:20},ft.crypto.Mac=function(t){this.setAlgAndProvider=function(t,e){if(null==(t=t.toLowerCase())&&(t="hmacsha1"),"hmac"!=(t=t.toLowerCase()).substr(0,4))throw"setAlgAndProvider unsupported HMAC alg: "+t;void 0===e&&(e=ft.crypto.Util.DEFAULTPROVIDER[t]),this.algProv=t+"/"+e;var n=t.substr(4);if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(n)&&"cryptojs"==e){try{var r=ft.crypto.Util.CRYPTOJSMESSAGEDIGESTNAME[n];this.mac=y.algo.HMAC.create(r,this.pass)}catch(t){throw"setAlgAndProvider hash alg set fail hashAlg="+n+"/"+t}this.updateString=function(t){this.mac.update(t)},this.updateHex=function(t){var e=y.enc.Hex.parse(t);this.mac.update(e)},this.doFinal=function(){return this.mac.finalize().toString(y.enc.Hex)},this.doFinalString=function(t){return this.updateString(t),this.doFinal()},this.doFinalHex=function(t){return this.updateHex(t),this.doFinal()}}},this.updateString=function(t){throw"updateString(str) not supported for this alg/prov: "+this.algProv},this.updateHex=function(t){throw"updateHex(hex) not supported for this alg/prov: "+this.algProv},this.doFinal=function(){throw"digest() not supported for this alg/prov: "+this.algProv},this.doFinalString=function(t){throw"digestString(str) not supported for this alg/prov: "+this.algProv},this.doFinalHex=function(t){throw"digestHex(hex) not supported for this alg/prov: "+this.algProv},this.setPassword=function(t){if("string"==typeof t){var e=t;return t.length%2!=1&&t.match(/^[0-9A-Fa-f]+$/)||(e=Dt(t)),void(this.pass=y.enc.Hex.parse(e))}if("object"!=typeof t)throw"KJUR.crypto.Mac unsupported password type: "+t;e=null;if(void 0!==t.hex){if(t.hex.length%2!=0||!t.hex.match(/^[0-9A-Fa-f]+$/))throw"Mac: wrong hex password: "+t.hex;e=t.hex}if(void 0!==t.utf8&&(e=wt(t.utf8)),void 0!==t.rstr&&(e=Dt(t.rstr)),void 0!==t.b64&&(e=b(t.b64)),void 0!==t.b64u&&(e=Et(t.b64u)),null==e)throw"KJUR.crypto.Mac unsupported password type: "+t;this.pass=y.enc.Hex.parse(e)},void 0!==t&&(void 0!==t.pass&&this.setPassword(t.pass),void 0!==t.alg&&(this.algName=t.alg,void 0===t.prov&&(this.provName=ft.crypto.Util.DEFAULTPROVIDER[this.algName]),this.setAlgAndProvider(this.algName,this.provName)))},ft.crypto.Signature=function(t){var e=null;if(this._setAlgNames=function(){var t=this.algName.match(/^(.+)with(.+)$/);t&&(this.mdAlgName=t[1].toLowerCase(),this.pubkeyAlgName=t[2].toLowerCase())},this._zeroPaddingOfSignature=function(t,e){for(var n="",r=e/4-t.length,i=0;i<r;i++)n+="0";return n+t},this.setAlgAndProvider=function(t,e){if(this._setAlgNames(),"cryptojs/jsrsa"!=e)throw"provider not supported: "+e;if(-1!=":md5:sha1:sha224:sha256:sha384:sha512:ripemd160:".indexOf(this.mdAlgName)){try{this.md=new ft.crypto.MessageDigest({alg:this.mdAlgName})}catch(t){throw"setAlgAndProvider hash alg set fail alg="+this.mdAlgName+"/"+t}this.init=function(t,e){var n=null;try{n=void 0===e?Ut.getKey(t):Ut.getKey(t,e)}catch(t){throw"init failed:"+t}if(!0===n.isPrivate)this.prvKey=n,this.state="SIGN";else{if(!0!==n.isPublic)throw"init failed.:"+n;this.pubKey=n,this.state="VERIFY"}},this.updateString=function(t){this.md.updateString(t)},this.updateHex=function(t){this.md.updateHex(t)},this.sign=function(){if(this.sHashHex=this.md.digest(),void 0!==this.ecprvhex&&void 0!==this.eccurvename){var t=new ft.crypto.ECDSA({curve:this.eccurvename});this.hSign=t.signHex(this.sHashHex,this.ecprvhex)}else if(this.prvKey instanceof at&&"rsaandmgf1"===this.pubkeyAlgName)this.hSign=this.prvKey.signWithMessageHashPSS(this.sHashHex,this.mdAlgName,this.pssSaltLen);else if(this.prvKey instanceof at&&"rsa"===this.pubkeyAlgName)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex,this.mdAlgName);else if(this.prvKey instanceof ft.crypto.ECDSA)this.hSign=this.prvKey.signWithMessageHash(this.sHashHex);else{if(!(this.prvKey instanceof ft.crypto.DSA))throw"Signature: unsupported private key alg: "+this.pubkeyAlgName;this.hSign=this.prvKey.signWithMessageHash(this.sHashHex)}return this.hSign},this.signString=function(t){return this.updateString(t),this.sign()},this.signHex=function(t){return this.updateHex(t),this.sign()},this.verify=function(t){if(this.sHashHex=this.md.digest(),void 0!==this.ecpubhex&&void 0!==this.eccurvename)return new ft.crypto.ECDSA({curve:this.eccurvename}).verifyHex(this.sHashHex,t,this.ecpubhex);if(this.pubKey instanceof at&&"rsaandmgf1"===this.pubkeyAlgName)return this.pubKey.verifyWithMessageHashPSS(this.sHashHex,t,this.mdAlgName,this.pssSaltLen);if(this.pubKey instanceof at&&"rsa"===this.pubkeyAlgName)return this.pubKey.verifyWithMessageHash(this.sHashHex,t);if(void 0!==ft.crypto.ECDSA&&this.pubKey instanceof ft.crypto.ECDSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,t);if(void 0!==ft.crypto.DSA&&this.pubKey instanceof ft.crypto.DSA)return this.pubKey.verifyWithMessageHash(this.sHashHex,t);throw"Signature: unsupported public key alg: "+this.pubkeyAlgName}}},this.init=function(t,e){throw"init(key, pass) not supported for this alg:prov="+this.algProvName},this.updateString=function(t){throw"updateString(str) not supported for this alg:prov="+this.algProvName},this.updateHex=function(t){throw"updateHex(hex) not supported for this alg:prov="+this.algProvName},this.sign=function(){throw"sign() not supported for this alg:prov="+this.algProvName},this.signString=function(t){throw"digestString(str) not supported for this alg:prov="+this.algProvName},this.signHex=function(t){throw"digestHex(hex) not supported for this alg:prov="+this.algProvName},this.verify=function(t){throw"verify(hSigVal) not supported for this alg:prov="+this.algProvName},this.initParams=t,void 0!==t&&(void 0!==t.alg&&(this.algName=t.alg,void 0===t.prov?this.provName=ft.crypto.Util.DEFAULTPROVIDER[this.algName]:this.provName=t.prov,this.algProvName=this.algName+":"+this.provName,this.setAlgAndProvider(this.algName,this.provName),this._setAlgNames()),void 0!==t.psssaltlen&&(this.pssSaltLen=t.psssaltlen),void 0!==t.prvkeypem)){if(void 0!==t.prvkeypas)throw"both prvkeypem and prvkeypas parameters not supported";try{e=Ut.getKey(t.prvkeypem);this.init(e)}catch(t){throw"fatal error to load pem private key: "+t}}},ft.crypto.Cipher=function(t){},ft.crypto.Cipher.encrypt=function(t,e,n){if(e instanceof at&&e.isPublic){var r=ft.crypto.Cipher.getAlgByKeyAndName(e,n);if("RSA"===r)return e.encrypt(t);if("RSAOAEP"===r)return e.encryptOAEP(t,"sha1");var i=r.match(/^RSAOAEP(\d+)$/);if(null!==i)return e.encryptOAEP(t,"sha"+i[1]);throw"Cipher.encrypt: unsupported algorithm for RSAKey: "+n}throw"Cipher.encrypt: unsupported key or algorithm"},ft.crypto.Cipher.decrypt=function(t,e,n){if(e instanceof at&&e.isPrivate){var r=ft.crypto.Cipher.getAlgByKeyAndName(e,n);if("RSA"===r)return e.decrypt(t);if("RSAOAEP"===r)return e.decryptOAEP(t,"sha1");var i=r.match(/^RSAOAEP(\d+)$/);if(null!==i)return e.decryptOAEP(t,"sha"+i[1]);throw"Cipher.decrypt: unsupported algorithm for RSAKey: "+n}throw"Cipher.decrypt: unsupported key or algorithm"},ft.crypto.Cipher.getAlgByKeyAndName=function(t,e){if(t instanceof at){if(-1!=":RSA:RSAOAEP:RSAOAEP224:RSAOAEP256:RSAOAEP384:RSAOAEP512:".indexOf(e))return e;if(null==e)return"RSA";throw"getAlgByKeyAndName: not supported algorithm name for RSAKey: "+e}throw"getAlgByKeyAndName: not supported algorithm name: "+e},ft.crypto.OID=new function(){this.oidhex2name={"2a864886f70d010101":"rsaEncryption","2a8648ce3d0201":"ecPublicKey","2a8648ce380401":"dsa","2a8648ce3d030107":"secp256r1","2b8104001f":"secp192k1","2b81040021":"secp224r1","2b8104000a":"secp256k1","2b81040023":"secp521r1","2b81040022":"secp384r1","2a8648ce380403":"SHA1withDSA","608648016503040301":"SHA224withDSA","608648016503040302":"SHA256withDSA"}},void 0!==ft&&ft||(ft={}),void 0!==ft.crypto&&ft.crypto||(ft.crypto={}),ft.crypto.ECDSA=function(t){var e=new rt;this.type="EC",this.isPrivate=!1,this.isPublic=!1,this.getBigRandom=function(t){return new E(t.bitLength(),e).mod(t.subtract(E.ONE)).add(E.ONE)},this.setNamedCurve=function(t){this.ecparams=ft.crypto.ECParameterDB.getByName(t),this.prvKeyHex=null,this.pubKeyHex=null,this.curveName=t},this.setPrivateKeyHex=function(t){this.isPrivate=!0,this.prvKeyHex=t},this.setPublicKeyHex=function(t){this.isPublic=!0,this.pubKeyHex=t},this.getPublicKeyXYHex=function(){var t=this.pubKeyHex;if("04"!==t.substr(0,2))throw"this method supports uncompressed format(04) only";var e=this.ecparams.keylen/4;if(t.length!==2+2*e)throw"malformed public key hex length";var n={};return n.x=t.substr(2,e),n.y=t.substr(2+e),n},this.getShortNISTPCurveName=function(){var t=this.curveName;return"secp256r1"===t||"NIST P-256"===t||"P-256"===t||"prime256v1"===t?"P-256":"secp384r1"===t||"NIST P-384"===t||"P-384"===t?"P-384":null},this.generateKeyPairHex=function(){var t=this.ecparams.n,e=this.getBigRandom(t),n=this.ecparams.G.multiply(e),r=n.getX().toBigInteger(),i=n.getY().toBigInteger(),s=this.ecparams.keylen/4,a=("0000000000"+e.toString(16)).slice(-s),o="04"+("0000000000"+r.toString(16)).slice(-s)+("0000000000"+i.toString(16)).slice(-s);return this.setPrivateKeyHex(a),this.setPublicKeyHex(o),{ecprvhex:a,ecpubhex:o}},this.signWithMessageHash=function(t){return this.signHex(t,this.prvKeyHex)},this.signHex=function(t,e){var n=new E(e,16),r=this.ecparams.n,i=new E(t,16);do{var s=this.getBigRandom(r),a=this.ecparams.G.multiply(s).getX().toBigInteger().mod(r)}while(a.compareTo(E.ZERO)<=0);var o=s.modInverse(r).multiply(i.add(n.multiply(a))).mod(r);return ft.crypto.ECDSA.biRSSigToASN1Sig(a,o)},this.sign=function(t,e){var n=e,r=this.ecparams.n,i=E.fromByteArrayUnsigned(t);do{var s=this.getBigRandom(r),a=this.ecparams.G.multiply(s).getX().toBigInteger().mod(r)}while(a.compareTo(E.ZERO)<=0);var o=s.modInverse(r).multiply(i.add(n.multiply(a))).mod(r);return this.serializeSig(a,o)},this.verifyWithMessageHash=function(t,e){return this.verifyHex(t,e,this.pubKeyHex)},this.verifyHex=function(t,e,n){var r,i,s,a=ft.crypto.ECDSA.parseSigHex(e);r=a.r,i=a.s,s=ht.decodeFromHex(this.ecparams.curve,n);var o=new E(t,16);return this.verifyRaw(o,r,i,s)},this.verify=function(t,e,n){var r,i,s;if(Bitcoin.Util.isArray(e)){var a=this.parseSig(e);r=a.r,i=a.s}else{if("object"!=typeof e||!e.r||!e.s)throw"Invalid value for signature";r=e.r,i=e.s}if(n instanceof ht)s=n;else{if(!Bitcoin.Util.isArray(n))throw"Invalid format for pubkey value, must be byte array or ECPointFp";s=ht.decodeFrom(this.ecparams.curve,n)}var o=E.fromByteArrayUnsigned(t);return this.verifyRaw(o,r,i,s)},this.verifyRaw=function(t,e,n,r){var i=this.ecparams.n,s=this.ecparams.G;if(e.compareTo(E.ONE)<0||e.compareTo(i)>=0)return!1;if(n.compareTo(E.ONE)<0||n.compareTo(i)>=0)return!1;var a=n.modInverse(i),o=t.multiply(a).mod(i),u=e.multiply(a).mod(i);return s.multiply(o).add(r.multiply(u)).getX().toBigInteger().mod(i).equals(e)},this.serializeSig=function(t,e){var n=t.toByteArraySigned(),r=e.toByteArraySigned(),i=[];return i.push(2),i.push(n.length),(i=i.concat(n)).push(2),i.push(r.length),(i=i.concat(r)).unshift(i.length),i.unshift(48),i},this.parseSig=function(t){var e;if(48!=t[0])throw new Error("Signature not a valid DERSequence");if(2!=t[e=2])throw new Error("First element in signature must be a DERInteger");var n=t.slice(e+2,e+2+t[e+1]);if(2!=t[e+=2+t[e+1]])throw new Error("Second element in signature must be a DERInteger");var r=t.slice(e+2,e+2+t[e+1]);return e+=2+t[e+1],{r:E.fromByteArrayUnsigned(n),s:E.fromByteArrayUnsigned(r)}},this.parseSigCompact=function(t){if(65!==t.length)throw"Signature has the wrong length";var e=t[0]-27;if(e<0||e>7)throw"Invalid signature type";var n=this.ecparams.n;return{r:E.fromByteArrayUnsigned(t.slice(1,33)).mod(n),s:E.fromByteArrayUnsigned(t.slice(33,65)).mod(n),i:e}},this.readPKCS5PrvKeyHex=function(t){var e,n,r,i=pt,s=ft.crypto.ECDSA.getName,a=i.getVbyList;if(!1===i.isASN1HEX(t))throw"not ASN.1 hex string";try{e=a(t,0,[2,0],"06"),n=a(t,0,[1],"04");try{r=a(t,0,[3,0],"03").substr(2)}catch(t){}}catch(t){throw"malformed PKCS#1/5 plain ECC private key"}if(this.curveName=s(e),void 0===this.curveName)throw"unsupported curve name";this.setNamedCurve(this.curveName),this.setPublicKeyHex(r),this.setPrivateKeyHex(n),this.isPublic=!1},this.readPKCS8PrvKeyHex=function(t){var e,n,r,i=pt,s=ft.crypto.ECDSA.getName,a=i.getVbyList;if(!1===i.isASN1HEX(t))throw"not ASN.1 hex string";try{a(t,0,[1,0],"06"),e=a(t,0,[1,1],"06"),n=a(t,0,[2,0,1],"04");try{r=a(t,0,[2,0,2,0],"03").substr(2)}catch(t){}}catch(t){throw"malformed PKCS#8 plain ECC private key"}if(this.curveName=s(e),void 0===this.curveName)throw"unsupported curve name";this.setNamedCurve(this.curveName),this.setPublicKeyHex(r),this.setPrivateKeyHex(n),this.isPublic=!1},this.readPKCS8PubKeyHex=function(t){var e,n,r=pt,i=ft.crypto.ECDSA.getName,s=r.getVbyList;if(!1===r.isASN1HEX(t))throw"not ASN.1 hex string";try{s(t,0,[0,0],"06"),e=s(t,0,[0,1],"06"),n=s(t,0,[1],"03").substr(2)}catch(t){throw"malformed PKCS#8 ECC public key"}if(this.curveName=i(e),null===this.curveName)throw"unsupported curve name";this.setNamedCurve(this.curveName),this.setPublicKeyHex(n)},this.readCertPubKeyHex=function(t,e){5!==e&&(e=6);var n,r,i=pt,s=ft.crypto.ECDSA.getName,a=i.getVbyList;if(!1===i.isASN1HEX(t))throw"not ASN.1 hex string";try{n=a(t,0,[0,e,0,1],"06"),r=a(t,0,[0,e,1],"03").substr(2)}catch(t){throw"malformed X.509 certificate ECC public key"}if(this.curveName=s(n),null===this.curveName)throw"unsupported curve name";this.setNamedCurve(this.curveName),this.setPublicKeyHex(r)},void 0!==t&&void 0!==t.curve&&(this.curveName=t.curve),void 0===this.curveName&&(this.curveName="secp256r1"),this.setNamedCurve(this.curveName),void 0!==t&&(void 0!==t.prv&&this.setPrivateKeyHex(t.prv),void 0!==t.pub&&this.setPublicKeyHex(t.pub))},ft.crypto.ECDSA.parseSigHex=function(t){var e=ft.crypto.ECDSA.parseSigHexInHexRS(t);return{r:new E(e.r,16),s:new E(e.s,16)}},ft.crypto.ECDSA.parseSigHexInHexRS=function(t){var e=pt,n=e.getChildIdx,r=e.getV;if("30"!=t.substr(0,2))throw"signature is not a ASN.1 sequence";var i=n(t,0);if(2!=i.length)throw"number of signature ASN.1 sequence elements seem wrong";var s=i[0],a=i[1];if("02"!=t.substr(s,2))throw"1st item of sequene of signature is not ASN.1 integer";if("02"!=t.substr(a,2))throw"2nd item of sequene of signature is not ASN.1 integer";return{r:r(t,s),s:r(t,a)}},ft.crypto.ECDSA.asn1SigToConcatSig=function(t){var e=ft.crypto.ECDSA.parseSigHexInHexRS(t),n=e.r,r=e.s;if("00"==n.substr(0,2)&&n.length%32==2&&(n=n.substr(2)),"00"==r.substr(0,2)&&r.length%32==2&&(r=r.substr(2)),n.length%32==30&&(n="00"+n),r.length%32==30&&(r="00"+r),n.length%32!=0)throw"unknown ECDSA sig r length error";if(r.length%32!=0)throw"unknown ECDSA sig s length error";return n+r},ft.crypto.ECDSA.concatSigToASN1Sig=function(t){if(t.length/2*8%128!=0)throw"unknown ECDSA concatinated r-s sig length error";var e=t.substr(0,t.length/2),n=t.substr(t.length/2);return ft.crypto.ECDSA.hexRSSigToASN1Sig(e,n)},ft.crypto.ECDSA.hexRSSigToASN1Sig=function(t,e){var n=new E(t,16),r=new E(e,16);return ft.crypto.ECDSA.biRSSigToASN1Sig(n,r)},ft.crypto.ECDSA.biRSSigToASN1Sig=function(t,e){var n=ft.asn1,r=new n.DERInteger({bigint:t}),i=new n.DERInteger({bigint:e});return new n.DERSequence({array:[r,i]}).getEncodedHex()},ft.crypto.ECDSA.getName=function(t){return"2a8648ce3d030107"===t?"secp256r1":"2b8104000a"===t?"secp256k1":"2b81040022"===t?"secp384r1":-1!=="|secp256r1|NIST P-256|P-256|prime256v1|".indexOf(t)?"secp256r1":-1!=="|secp256k1|".indexOf(t)?"secp256k1":-1!=="|secp384r1|NIST P-384|P-384|".indexOf(t)?"secp384r1":null},void 0!==ft&&ft||(ft={}),void 0!==ft.crypto&&ft.crypto||(ft.crypto={}),ft.crypto.ECParameterDB=new function(){var t={},e={};function n(t){return new E(t,16)}this.getByName=function(n){var r=n;if(void 0!==e[r]&&(r=e[n]),void 0!==t[r])return t[r];throw"unregistered EC curve name: "+r},this.regist=function(r,i,s,a,o,u,h,c,l,f,d,g){t[r]={};var p=n(s),y=n(a),v=n(o),m=n(u),F=n(h),S=new ct(p,y,v),b=S.decodePointHex("04"+c+l);t[r].name=r,t[r].keylen=i,t[r].curve=S,t[r].G=b,t[r].n=m,t[r].h=F,t[r].oid=d,t[r].info=g;for(var A=0;A<f.length;A++)e[f[A]]=r}},ft.crypto.ECParameterDB.regist("secp128r1",128,"FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFF","FFFFFFFDFFFFFFFFFFFFFFFFFFFFFFFC","E87579C11079F43DD824993C2CEE5ED3","FFFFFFFE0000000075A30D1B9038A115","1","161FF7528B899B2D0C28607CA52C5B86","CF5AC8395BAFEB13C02DA292DDED7A83",[],"","secp128r1 : SECG curve over a 128 bit prime field"),ft.crypto.ECParameterDB.regist("secp160k1",160,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFAC73","0","7","0100000000000000000001B8FA16DFAB9ACA16B6B3","1","3B4C382CE37AA192A4019E763036F4F5DD4D7EBB","938CF935318FDCED6BC28286531733C3F03C4FEE",[],"","secp160k1 : SECG curve over a 160 bit prime field"),ft.crypto.ECParameterDB.regist("secp160r1",160,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF7FFFFFFC","1C97BEFC54BD7A8B65ACF89F81D4D4ADC565FA45","0100000000000000000001F4C8F927AED3CA752257","1","4A96B5688EF573284664698968C38BB913CBFC82","23A628553168947D59DCC912042351377AC5FB32",[],"","secp160r1 : SECG curve over a 160 bit prime field"),ft.crypto.ECParameterDB.regist("secp192k1",192,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFEE37","0","3","FFFFFFFFFFFFFFFFFFFFFFFE26F2FC170F69466A74DEFD8D","1","DB4FF10EC057E9AE26B07D0280B7F4341DA5D1B1EAE06C7D","9B2F2F6D9C5628A7844163D015BE86344082AA88D95E2F9D",[]),ft.crypto.ECParameterDB.regist("secp192r1",192,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFC","64210519E59C80E70FA7E9AB72243049FEB8DEECC146B9B1","FFFFFFFFFFFFFFFFFFFFFFFF99DEF836146BC9B1B4D22831","1","188DA80EB03090F67CBF20EB43A18800F4FF0AFD82FF1012","07192B95FFC8DA78631011ED6B24CDD573F977A11E794811",[]),ft.crypto.ECParameterDB.regist("secp224r1",224,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF000000000000000000000001","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFFFFFFFFFFFFFFFFFE","B4050A850C04B3ABF54132565044B0B7D7BFD8BA270B39432355FFB4","FFFFFFFFFFFFFFFFFFFFFFFFFFFF16A2E0B8F03E13DD29455C5C2A3D","1","B70E0CBD6BB4BF7F321390B94A03C1D356C21122343280D6115C1D21","BD376388B5F723FB4C22DFE6CD4375A05A07476444D5819985007E34",[]),ft.crypto.ECParameterDB.regist("secp256k1",256,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F","0","7","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEBAAEDCE6AF48A03BBFD25E8CD0364141","1","79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798","483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8",[]),ft.crypto.ECParameterDB.regist("secp256r1",256,"FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFF","FFFFFFFF00000001000000000000000000000000FFFFFFFFFFFFFFFFFFFFFFFC","5AC635D8AA3A93E7B3EBBD55769886BC651D06B0CC53B0F63BCE3C3E27D2604B","FFFFFFFF00000000FFFFFFFFFFFFFFFFBCE6FAADA7179E84F3B9CAC2FC632551","1","6B17D1F2E12C4247F8BCE6E563A440F277037D812DEB33A0F4A13945D898C296","4FE342E2FE1A7F9B8EE7EB4A7C0F9E162BCE33576B315ECECBB6406837BF51F5",["NIST P-256","P-256","prime256v1"]),ft.crypto.ECParameterDB.regist("secp384r1",384,"FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFFFF0000000000000000FFFFFFFC","B3312FA7E23EE7E4988E056BE3F82D19181D9C6EFE8141120314088F5013875AC656398D8A2ED19D2A85C8EDD3EC2AEF","FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC7634D81F4372DDF581A0DB248B0A77AECEC196ACCC52973","1","AA87CA22BE8B05378EB1C71EF320AD746E1D3B628BA79B9859F741E082542A385502F25DBF55296C3A545E3872760AB7","3617de4a96262c6f5d9e98bf9292dc29f8f41dbd289a147ce9da3113b5f0b8c00a60b1ce1d7e819d7a431d7c90ea0e5f",["NIST P-384","P-384"]),ft.crypto.ECParameterDB.regist("secp521r1",521,"1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF","1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFC","051953EB9618E1C9A1F929A21A0B68540EEA2DA725B99B315F3B8B489918EF109E156193951EC7E937B1652C0BD3BB1BF073573DF883D2C34F1EF451FD46B503F00","1FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFA51868783BF2F966B7FCC0148F709A5D03BB5C9B8899C47AEBB6FB71E91386409","1","C6858E06B70404E9CD9E3ECB662395B4429C648139053FB521F828AF606B4D3DBAA14B5E77EFE75928FE1DC127A2FFA8DE3348B3C1856A429BF97E7E31C2E5BD66","011839296a789a3bc0045c8a5fb42c7d1bd998f54449579b446817afbd17273e662c97ee72995ef42640c550b9013fad0761353c7086a272c24088be94769fd16650",["NIST P-521","P-521"]),void 0!==ft&&ft||(ft={}),void 0!==ft.crypto&&ft.crypto||(ft.crypto={}),ft.crypto.DSA=function(){this.p=null,this.q=null,this.g=null,this.y=null,this.x=null,this.type="DSA",this.isPrivate=!1,this.isPublic=!1,this.setPrivate=function(t,e,n,r,i){this.isPrivate=!0,this.p=t,this.q=e,this.g=n,this.y=r,this.x=i},this.setPrivateHex=function(t,e,n,r,i){var s,a,o,u,h;s=new E(t,16),a=new E(e,16),o=new E(n,16),u="string"==typeof r&&r.length>1?new E(r,16):null,h=new E(i,16),this.setPrivate(s,a,o,u,h)},this.setPublic=function(t,e,n,r){this.isPublic=!0,this.p=t,this.q=e,this.g=n,this.y=r,this.x=null},this.setPublicHex=function(t,e,n,r){var i,s,a,o;i=new E(t,16),s=new E(e,16),a=new E(n,16),o=new E(r,16),this.setPublic(i,s,a,o)},this.signWithMessageHash=function(t){var e=this.p,n=this.q,r=this.g,i=(this.y,this.x),s=ft.crypto.Util.getRandomBigIntegerMinToMax(E.ONE.add(E.ONE),n.subtract(E.ONE)),a=new E(t.substr(0,n.bitLength()/4),16),o=r.modPow(s,e).mod(n),u=s.modInverse(n).multiply(a.add(i.multiply(o))).mod(n);return ft.asn1.ASN1Util.jsonToASN1HEX({seq:[{int:{bigint:o}},{int:{bigint:u}}]})},this.verifyWithMessageHash=function(t,e){var n=this.p,r=this.q,i=this.g,s=this.y,a=this.parseASN1Signature(e),o=a[0],u=a[1],h=new E(t.substr(0,r.bitLength()/4),16);if(E.ZERO.compareTo(o)>0||o.compareTo(r)>0)throw"invalid DSA signature";if(E.ZERO.compareTo(u)>=0||u.compareTo(r)>0)throw"invalid DSA signature";var c=u.modInverse(r),l=h.multiply(c).mod(r),f=o.multiply(c).mod(r);return 0==i.modPow(l,n).multiply(s.modPow(f,n)).mod(n).mod(r).compareTo(o)},this.parseASN1Signature=function(t){try{return[new E(pt.getVbyList(t,0,[0],"02"),16),new E(pt.getVbyList(t,0,[1],"02"),16)]}catch(t){throw"malformed ASN.1 DSA signature"}},this.readPKCS5PrvKeyHex=function(t){var e,n,r,i,s,a=pt,o=a.getVbyList;if(!1===a.isASN1HEX(t))throw"not ASN.1 hex string";try{e=o(t,0,[1],"02"),n=o(t,0,[2],"02"),r=o(t,0,[3],"02"),i=o(t,0,[4],"02"),s=o(t,0,[5],"02")}catch(t){throw console.log("EXCEPTION:"+t),"malformed PKCS#1/5 plain DSA private key"}this.setPrivateHex(e,n,r,i,s)},this.readPKCS8PrvKeyHex=function(t){var e,n,r,i,s=pt,a=s.getVbyList;if(!1===s.isASN1HEX(t))throw"not ASN.1 hex string";try{e=a(t,0,[1,1,0],"02"),n=a(t,0,[1,1,1],"02"),r=a(t,0,[1,1,2],"02"),i=a(t,0,[2,0],"02")}catch(t){throw console.log("EXCEPTION:"+t),"malformed PKCS#8 plain DSA private key"}this.setPrivateHex(e,n,r,null,i)},this.readPKCS8PubKeyHex=function(t){var e,n,r,i,s=pt,a=s.getVbyList;if(!1===s.isASN1HEX(t))throw"not ASN.1 hex string";try{e=a(t,0,[0,1,0],"02"),n=a(t,0,[0,1,1],"02"),r=a(t,0,[0,1,2],"02"),i=a(t,0,[1,0],"02")}catch(t){throw console.log("EXCEPTION:"+t),"malformed PKCS#8 DSA public key"}this.setPublicHex(e,n,r,i)},this.readCertPubKeyHex=function(t,e){var n,r,i,s;5!==e&&(e=6);var a=pt,o=a.getVbyList;if(!1===a.isASN1HEX(t))throw"not ASN.1 hex string";try{n=o(t,0,[0,e,0,1,0],"02"),r=o(t,0,[0,e,0,1,1],"02"),i=o(t,0,[0,e,0,1,2],"02"),s=o(t,0,[0,e,1,0],"02")}catch(t){throw console.log("EXCEPTION:"+t),"malformed X.509 certificate DSA public key"}this.setPublicHex(n,r,i,s)}};var Ut=function(){var t=function(t,n,r){return e(y.AES,t,n,r)},e=function(t,e,n,r){var i=y.enc.Hex.parse(e),s=y.enc.Hex.parse(n),a=y.enc.Hex.parse(r),o={};o.key=s,o.iv=a,o.ciphertext=i;var u=t.decrypt(o,s,{iv:a});return y.enc.Hex.stringify(u)},n=function(t,e,n){return r(y.AES,t,e,n)},r=function(t,e,n,r){var i=y.enc.Hex.parse(e),s=y.enc.Hex.parse(n),a=y.enc.Hex.parse(r),o=t.encrypt(i,s,{iv:a}),u=y.enc.Hex.parse(o.toString());return y.enc.Base64.stringify(u)},i={"AES-256-CBC":{proc:t,eproc:n,keylen:32,ivlen:16},"AES-192-CBC":{proc:t,eproc:n,keylen:24,ivlen:16},"AES-128-CBC":{proc:t,eproc:n,keylen:16,ivlen:16},"DES-EDE3-CBC":{proc:function(t,n,r){return e(y.TripleDES,t,n,r)},eproc:function(t,e,n){return r(y.TripleDES,t,e,n)},keylen:24,ivlen:8},"DES-CBC":{proc:function(t,n,r){return e(y.DES,t,n,r)},eproc:function(t,e,n){return r(y.DES,t,e,n)},keylen:8,ivlen:8}},s=function(t){var e={},n=t.match(new RegExp("DEK-Info: ([^,]+),([0-9A-Fa-f]+)","m"));n&&(e.cipher=n[1],e.ivsalt=n[2]);var r=t.match(new RegExp("-----BEGIN ([A-Z]+) PRIVATE KEY-----"));r&&(e.type=r[1]);var i=-1,s=0;-1!=t.indexOf("\r\n\r\n")&&(i=t.indexOf("\r\n\r\n"),s=2),-1!=t.indexOf("\n\n")&&(i=t.indexOf("\n\n"),s=1);var a=t.indexOf("-----END");if(-1!=i&&-1!=a){var o=t.substring(i+2*s,a-s);o=o.replace(/\s+/g,""),e.data=o}return e},a=function(t,e,n){for(var r=n.substring(0,16),s=y.enc.Hex.parse(r),a=y.enc.Utf8.parse(e),o=i[t].keylen+i[t].ivlen,u="",h=null;;){var c=y.algo.MD5.create();if(null!=h&&c.update(h),c.update(a),c.update(s),h=c.finalize(),(u+=y.enc.Hex.stringify(h)).length>=2*o)break}var l={};return l.keyhex=u.substr(0,2*i[t].keylen),l.ivhex=u.substr(2*i[t].keylen,2*i[t].ivlen),l},o=function(t,e,n,r){var s=y.enc.Base64.parse(t),a=y.enc.Hex.stringify(s);return(0,i[e].proc)(a,n,r)};return{version:"1.0.0",parsePKCS5PEM:function(t){return s(t)},getKeyAndUnusedIvByPasscodeAndIvsalt:function(t,e,n){return a(t,e,n)},decryptKeyB64:function(t,e,n,r){return o(t,e,n,r)},getDecryptedKeyHex:function(t,e){var n=s(t),r=(n.type,n.cipher),i=n.ivsalt,u=n.data,h=a(r,e,i).keyhex;return o(u,r,h,i)},getEncryptedPKCS5PEMFromPrvKeyHex:function(t,e,n,r,s){var o="";if(void 0!==r&&null!=r||(r="AES-256-CBC"),void 0===i[r])throw"KEYUTIL unsupported algorithm: "+r;void 0!==s&&null!=s||(s=function(t){var e=y.lib.WordArray.random(t);return y.enc.Hex.stringify(e)}(i[r].ivlen).toUpperCase());var u=function(t,e,n,r){return(0,i[e].eproc)(t,n,r)}(e,r,a(r,n,s).keyhex,s);o="-----BEGIN "+t+" PRIVATE KEY-----\r\n";return o+="Proc-Type: 4,ENCRYPTED\r\n",o+="DEK-Info: "+r+","+s+"\r\n",o+="\r\n",o+=u.replace(/(.{64})/g,"$1\r\n"),o+="\r\n-----END "+t+" PRIVATE KEY-----\r\n"},parseHexOfEncryptedPKCS8:function(t){var e=pt,n=e.getChildIdx,r=e.getV,i={},s=n(t,0);if(2!=s.length)throw"malformed format: SEQUENCE(0).items != 2: "+s.length;i.ciphertext=r(t,s[1]);var a=n(t,s[0]);if(2!=a.length)throw"malformed format: SEQUENCE(0.0).items != 2: "+a.length;if("2a864886f70d01050d"!=r(t,a[0]))throw"this only supports pkcs5PBES2";var o=n(t,a[1]);if(2!=a.length)throw"malformed format: SEQUENCE(0.0.1).items != 2: "+o.length;var u=n(t,o[1]);if(2!=u.length)throw"malformed format: SEQUENCE(0.0.1.1).items != 2: "+u.length;if("2a864886f70d0307"!=r(t,u[0]))throw"this only supports TripleDES";i.encryptionSchemeAlg="TripleDES",i.encryptionSchemeIV=r(t,u[1]);var h=n(t,o[0]);if(2!=h.length)throw"malformed format: SEQUENCE(0.0.1.0).items != 2: "+h.length;if("2a864886f70d01050c"!=r(t,h[0]))throw"this only supports pkcs5PBKDF2";var c=n(t,h[1]);if(c.length<2)throw"malformed format: SEQUENCE(0.0.1.0.1).items < 2: "+c.length;i.pbkdf2Salt=r(t,c[0]);var l=r(t,c[1]);try{i.pbkdf2Iter=parseInt(l,16)}catch(t){throw"malformed format pbkdf2Iter: "+l}return i},getPBKDF2KeyHexFromParam:function(t,e){var n=y.enc.Hex.parse(t.pbkdf2Salt),r=t.pbkdf2Iter,i=y.PBKDF2(e,n,{keySize:6,iterations:r});return y.enc.Hex.stringify(i)},_getPlainPKCS8HexFromEncryptedPKCS8PEM:function(t,e){var n=Rt(t,"ENCRYPTED PRIVATE KEY"),r=this.parseHexOfEncryptedPKCS8(n),i=Ut.getPBKDF2KeyHexFromParam(r,e),s={};s.ciphertext=y.enc.Hex.parse(r.ciphertext);var a=y.enc.Hex.parse(i),o=y.enc.Hex.parse(r.encryptionSchemeIV),u=y.TripleDES.decrypt(s,a,{iv:o});return y.enc.Hex.stringify(u)},getKeyFromEncryptedPKCS8PEM:function(t,e){var n=this._getPlainPKCS8HexFromEncryptedPKCS8PEM(t,e);return this.getKeyFromPlainPrivatePKCS8Hex(n)},parsePlainPrivatePKCS8Hex:function(t){var e=pt,n=e.getChildIdx,r=e.getV,i={algparam:null};if("30"!=t.substr(0,2))throw"malformed plain PKCS8 private key(code:001)";var s=n(t,0);if(3!=s.length)throw"malformed plain PKCS8 private key(code:002)";if("30"!=t.substr(s[1],2))throw"malformed PKCS8 private key(code:003)";var a=n(t,s[1]);if(2!=a.length)throw"malformed PKCS8 private key(code:004)";if("06"!=t.substr(a[0],2))throw"malformed PKCS8 private key(code:005)";if(i.algoid=r(t,a[0]),"06"==t.substr(a[1],2)&&(i.algparam=r(t,a[1])),"04"!=t.substr(s[2],2))throw"malformed PKCS8 private key(code:006)";return i.keyidx=e.getVidx(t,s[2]),i},getKeyFromPlainPrivatePKCS8PEM:function(t){var e=Rt(t,"PRIVATE KEY");return this.getKeyFromPlainPrivatePKCS8Hex(e)},getKeyFromPlainPrivatePKCS8Hex:function(t){var e,n=this.parsePlainPrivatePKCS8Hex(t);if("2a864886f70d010101"==n.algoid)e=new at;else if("2a8648ce380401"==n.algoid)e=new ft.crypto.DSA;else{if("2a8648ce3d0201"!=n.algoid)throw"unsupported private key algorithm";e=new ft.crypto.ECDSA}return e.readPKCS8PrvKeyHex(t),e},_getKeyFromPublicPKCS8Hex:function(t){var e,n=pt.getVbyList(t,0,[0,0],"06");if("2a864886f70d010101"===n)e=new at;else if("2a8648ce380401"===n)e=new ft.crypto.DSA;else{if("2a8648ce3d0201"!==n)throw"unsupported PKCS#8 public key hex";e=new ft.crypto.ECDSA}return e.readPKCS8PubKeyHex(t),e},parsePublicRawRSAKeyHex:function(t){var e=pt,n=e.getChildIdx,r=e.getV,i={};if("30"!=t.substr(0,2))throw"malformed RSA key(code:001)";var s=n(t,0);if(2!=s.length)throw"malformed RSA key(code:002)";if("02"!=t.substr(s[0],2))throw"malformed RSA key(code:003)";if(i.n=r(t,s[0]),"02"!=t.substr(s[1],2))throw"malformed RSA key(code:004)";return i.e=r(t,s[1]),i},parsePublicPKCS8Hex:function(t){var e=pt,n=e.getChildIdx,r=e.getV,i={algparam:null},s=n(t,0);if(2!=s.length)throw"outer DERSequence shall have 2 elements: "+s.length;var a=s[0];if("30"!=t.substr(a,2))throw"malformed PKCS8 public key(code:001)";var o=n(t,a);if(2!=o.length)throw"malformed PKCS8 public key(code:002)";if("06"!=t.substr(o[0],2))throw"malformed PKCS8 public key(code:003)";if(i.algoid=r(t,o[0]),"06"==t.substr(o[1],2)?i.algparam=r(t,o[1]):"30"==t.substr(o[1],2)&&(i.algparam={},i.algparam.p=e.getVbyList(t,o[1],[0],"02"),i.algparam.q=e.getVbyList(t,o[1],[1],"02"),i.algparam.g=e.getVbyList(t,o[1],[2],"02")),"03"!=t.substr(s[1],2))throw"malformed PKCS8 public key(code:004)";return i.key=r(t,s[1]).substr(2),i}}}();Ut.getKey=function(t,e,n){var r=(y=pt).getChildIdx,i=(y.getV,y.getVbyList),s=ft.crypto,a=s.ECDSA,o=s.DSA,u=at,h=Rt,c=Ut;if(void 0!==u&&t instanceof u)return t;if(void 0!==a&&t instanceof a)return t;if(void 0!==o&&t instanceof o)return t;if(void 0!==t.curve&&void 0!==t.xy&&void 0===t.d)return new a({pub:t.xy,curve:t.curve});if(void 0!==t.curve&&void 0!==t.d)return new a({prv:t.d,curve:t.curve});if(void 0===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0===t.d)return(B=new u).setPublic(t.n,t.e),B;if(void 0===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d&&void 0!==t.p&&void 0!==t.q&&void 0!==t.dp&&void 0!==t.dq&&void 0!==t.co&&void 0===t.qi)return(B=new u).setPrivateEx(t.n,t.e,t.d,t.p,t.q,t.dp,t.dq,t.co),B;if(void 0===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d&&void 0===t.p)return(B=new u).setPrivate(t.n,t.e,t.d),B;if(void 0!==t.p&&void 0!==t.q&&void 0!==t.g&&void 0!==t.y&&void 0===t.x)return(B=new o).setPublic(t.p,t.q,t.g,t.y),B;if(void 0!==t.p&&void 0!==t.q&&void 0!==t.g&&void 0!==t.y&&void 0!==t.x)return(B=new o).setPrivate(t.p,t.q,t.g,t.y,t.x),B;if("RSA"===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0===t.d)return(B=new u).setPublic(Et(t.n),Et(t.e)),B;if("RSA"===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d&&void 0!==t.p&&void 0!==t.q&&void 0!==t.dp&&void 0!==t.dq&&void 0!==t.qi)return(B=new u).setPrivateEx(Et(t.n),Et(t.e),Et(t.d),Et(t.p),Et(t.q),Et(t.dp),Et(t.dq),Et(t.qi)),B;if("RSA"===t.kty&&void 0!==t.n&&void 0!==t.e&&void 0!==t.d)return(B=new u).setPrivate(Et(t.n),Et(t.e),Et(t.d)),B;if("EC"===t.kty&&void 0!==t.crv&&void 0!==t.x&&void 0!==t.y&&void 0===t.d){var l=(D=new a({curve:t.crv})).ecparams.keylen/4,f="04"+("0000000000"+Et(t.x)).slice(-l)+("0000000000"+Et(t.y)).slice(-l);return D.setPublicKeyHex(f),D}if("EC"===t.kty&&void 0!==t.crv&&void 0!==t.x&&void 0!==t.y&&void 0!==t.d){l=(D=new a({curve:t.crv})).ecparams.keylen/4,f="04"+("0000000000"+Et(t.x)).slice(-l)+("0000000000"+Et(t.y)).slice(-l);var d=("0000000000"+Et(t.d)).slice(-l);return D.setPublicKeyHex(f),D.setPrivateKeyHex(d),D}if("pkcs5prv"===n){var g,p=t,y=pt;if(9===(g=r(p,0)).length)(B=new u).readPKCS5PrvKeyHex(p);else if(6===g.length)(B=new o).readPKCS5PrvKeyHex(p);else{if(!(g.length>2&&"04"===p.substr(g[1],2)))throw"unsupported PKCS#1/5 hexadecimal key";(B=new a).readPKCS5PrvKeyHex(p)}return B}if("pkcs8prv"===n)return B=c.getKeyFromPlainPrivatePKCS8Hex(t);if("pkcs8pub"===n)return c._getKeyFromPublicPKCS8Hex(t);if("x509pub"===n)return Jt.getPublicKeyFromCertHex(t);if(-1!=t.indexOf("-END CERTIFICATE-",0)||-1!=t.indexOf("-END X509 CERTIFICATE-",0)||-1!=t.indexOf("-END TRUSTED CERTIFICATE-",0))return Jt.getPublicKeyFromCertPEM(t);if(-1!=t.indexOf("-END PUBLIC KEY-")){var v=Rt(t,"PUBLIC KEY");return c._getKeyFromPublicPKCS8Hex(v)}if(-1!=t.indexOf("-END RSA PRIVATE KEY-")&&-1==t.indexOf("4,ENCRYPTED")){var m=h(t,"RSA PRIVATE KEY");return c.getKey(m,null,"pkcs5prv")}if(-1!=t.indexOf("-END DSA PRIVATE KEY-")&&-1==t.indexOf("4,ENCRYPTED")){var F=i(P=h(t,"DSA PRIVATE KEY"),0,[1],"02"),S=i(P,0,[2],"02"),b=i(P,0,[3],"02"),A=i(P,0,[4],"02"),w=i(P,0,[5],"02");return(B=new o).setPrivate(new E(F,16),new E(S,16),new E(b,16),new E(A,16),new E(w,16)),B}if(-1!=t.indexOf("-END PRIVATE KEY-"))return c.getKeyFromPlainPrivatePKCS8PEM(t);if(-1!=t.indexOf("-END RSA PRIVATE KEY-")&&-1!=t.indexOf("4,ENCRYPTED")){var x=c.getDecryptedKeyHex(t,e),C=new at;return C.readPKCS5PrvKeyHex(x),C}if(-1!=t.indexOf("-END EC PRIVATE KEY-")&&-1!=t.indexOf("4,ENCRYPTED")){var D,B=i(P=c.getDecryptedKeyHex(t,e),0,[1],"04"),T=i(P,0,[2,0],"06"),I=i(P,0,[3,0],"03").substr(2);if(void 0===ft.crypto.OID.oidhex2name[T])throw"undefined OID(hex) in KJUR.crypto.OID: "+T;return(D=new a({curve:ft.crypto.OID.oidhex2name[T]})).setPublicKeyHex(I),D.setPrivateKeyHex(B),D.isPublic=!1,D}if(-1!=t.indexOf("-END DSA PRIVATE KEY-")&&-1!=t.indexOf("4,ENCRYPTED")){var P;F=i(P=c.getDecryptedKeyHex(t,e),0,[1],"02"),S=i(P,0,[2],"02"),b=i(P,0,[3],"02"),A=i(P,0,[4],"02"),w=i(P,0,[5],"02");return(B=new o).setPrivate(new E(F,16),new E(S,16),new E(b,16),new E(A,16),new E(w,16)),B}if(-1!=t.indexOf("-END ENCRYPTED PRIVATE KEY-"))return c.getKeyFromEncryptedPKCS8PEM(t,e);throw"not supported argument"},Ut.generateKeypair=function(t,e){if("RSA"==t){var n=e;(a=new at).generate(n,"10001"),a.isPrivate=!0,a.isPublic=!0;var r=new at,i=a.n.toString(16),s=a.e.toString(16);return r.setPublic(i,s),r.isPrivate=!1,r.isPublic=!0,(o={}).prvKeyObj=a,o.pubKeyObj=r,o}if("EC"==t){var a,o,u=e,h=new ft.crypto.ECDSA({curve:u}).generateKeyPairHex();return(a=new ft.crypto.ECDSA({curve:u})).setPublicKeyHex(h.ecpubhex),a.setPrivateKeyHex(h.ecprvhex),a.isPrivate=!0,a.isPublic=!1,(r=new ft.crypto.ECDSA({curve:u})).setPublicKeyHex(h.ecpubhex),r.isPrivate=!1,r.isPublic=!0,(o={}).prvKeyObj=a,o.pubKeyObj=r,o}throw"unknown algorithm: "+t},Ut.getPEM=function(t,e,n,r,i,s){var a=ft,o=a.asn1,u=o.DERObjectIdentifier,h=o.DERInteger,c=o.ASN1Util.newObject,l=o.x509.SubjectPublicKeyInfo,f=a.crypto,d=f.DSA,g=f.ECDSA,p=at;function v(t){return c({seq:[{int:0},{int:{bigint:t.n}},{int:t.e},{int:{bigint:t.d}},{int:{bigint:t.p}},{int:{bigint:t.q}},{int:{bigint:t.dmp1}},{int:{bigint:t.dmq1}},{int:{bigint:t.coeff}}]})}function m(t){return c({seq:[{int:1},{octstr:{hex:t.prvKeyHex}},{tag:["a0",!0,{oid:{name:t.curveName}}]},{tag:["a1",!0,{bitstr:{hex:"00"+t.pubKeyHex}}]}]})}function F(t){return c({seq:[{int:0},{int:{bigint:t.p}},{int:{bigint:t.q}},{int:{bigint:t.g}},{int:{bigint:t.y}},{int:{bigint:t.x}}]})}if((void 0!==p&&t instanceof p||void 0!==d&&t instanceof d||void 0!==g&&t instanceof g)&&1==t.isPublic&&(void 0===e||"PKCS8PUB"==e))return Pt(E=new l(t).getEncodedHex(),"PUBLIC KEY");if("PKCS1PRV"==e&&void 0!==p&&t instanceof p&&(void 0===n||null==n)&&1==t.isPrivate)return Pt(E=v(t).getEncodedHex(),"RSA PRIVATE KEY");if("PKCS1PRV"==e&&void 0!==g&&t instanceof g&&(void 0===n||null==n)&&1==t.isPrivate){var S=new u({name:t.curveName}).getEncodedHex(),b=m(t).getEncodedHex(),A="";return A+=Pt(S,"EC PARAMETERS"),A+=Pt(b,"EC PRIVATE KEY")}if("PKCS1PRV"==e&&void 0!==d&&t instanceof d&&(void 0===n||null==n)&&1==t.isPrivate)return Pt(E=F(t).getEncodedHex(),"DSA PRIVATE KEY");if("PKCS5PRV"==e&&void 0!==p&&t instanceof p&&void 0!==n&&null!=n&&1==t.isPrivate){var E=v(t).getEncodedHex();return void 0===r&&(r="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("RSA",E,n,r,s)}if("PKCS5PRV"==e&&void 0!==g&&t instanceof g&&void 0!==n&&null!=n&&1==t.isPrivate){E=m(t).getEncodedHex();return void 0===r&&(r="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("EC",E,n,r,s)}if("PKCS5PRV"==e&&void 0!==d&&t instanceof d&&void 0!==n&&null!=n&&1==t.isPrivate){E=F(t).getEncodedHex();return void 0===r&&(r="DES-EDE3-CBC"),this.getEncryptedPKCS5PEMFromPrvKeyHex("DSA",E,n,r,s)}var w=function(t,e){var n=x(t,e);return new c({seq:[{seq:[{oid:{name:"pkcs5PBES2"}},{seq:[{seq:[{oid:{name:"pkcs5PBKDF2"}},{seq:[{octstr:{hex:n.pbkdf2Salt}},{int:n.pbkdf2Iter}]}]},{seq:[{oid:{name:"des-EDE3-CBC"}},{octstr:{hex:n.encryptionSchemeIV}}]}]}]},{octstr:{hex:n.ciphertext}}]}).getEncodedHex()},x=function(t,e){var n=y.lib.WordArray.random(8),r=y.lib.WordArray.random(8),i=y.PBKDF2(e,n,{keySize:6,iterations:100}),s=y.enc.Hex.parse(t),a=y.TripleDES.encrypt(s,i,{iv:r})+"",o={};return o.ciphertext=a,o.pbkdf2Salt=y.enc.Hex.stringify(n),o.pbkdf2Iter=100,o.encryptionSchemeAlg="DES-EDE3-CBC",o.encryptionSchemeIV=y.enc.Hex.stringify(r),o};if("PKCS8PRV"==e&&null!=p&&t instanceof p&&1==t.isPrivate){var C=v(t).getEncodedHex();E=c({seq:[{int:0},{seq:[{oid:{name:"rsaEncryption"}},{null:!0}]},{octstr:{hex:C}}]}).getEncodedHex();return void 0===n||null==n?Pt(E,"PRIVATE KEY"):Pt(b=w(E,n),"ENCRYPTED PRIVATE KEY")}if("PKCS8PRV"==e&&void 0!==g&&t instanceof g&&1==t.isPrivate){C=new c({seq:[{int:1},{octstr:{hex:t.prvKeyHex}},{tag:["a1",!0,{bitstr:{hex:"00"+t.pubKeyHex}}]}]}).getEncodedHex(),E=c({seq:[{int:0},{seq:[{oid:{name:"ecPublicKey"}},{oid:{name:t.curveName}}]},{octstr:{hex:C}}]}).getEncodedHex();return void 0===n||null==n?Pt(E,"PRIVATE KEY"):Pt(b=w(E,n),"ENCRYPTED PRIVATE KEY")}if("PKCS8PRV"==e&&void 0!==d&&t instanceof d&&1==t.isPrivate){C=new h({bigint:t.x}).getEncodedHex(),E=c({seq:[{int:0},{seq:[{oid:{name:"dsa"}},{seq:[{int:{bigint:t.p}},{int:{bigint:t.q}},{int:{bigint:t.g}}]}]},{octstr:{hex:C}}]}).getEncodedHex();return void 0===n||null==n?Pt(E,"PRIVATE KEY"):Pt(b=w(E,n),"ENCRYPTED PRIVATE KEY")}throw"unsupported object nor format"},Ut.getKeyFromCSRPEM=function(t){var e=Rt(t,"CERTIFICATE REQUEST");return Ut.getKeyFromCSRHex(e)},Ut.getKeyFromCSRHex=function(t){var e=Ut.parseCSRHex(t);return Ut.getKey(e.p8pubkeyhex,null,"pkcs8pub")},Ut.parseCSRHex=function(t){var e=pt,n=e.getChildIdx,r=e.getTLV,i={},s=t;if("30"!=s.substr(0,2))throw"malformed CSR(code:001)";var a=n(s,0);if(a.length<1)throw"malformed CSR(code:002)";if("30"!=s.substr(a[0],2))throw"malformed CSR(code:003)";var o=n(s,a[0]);if(o.length<3)throw"malformed CSR(code:004)";return i.p8pubkeyhex=r(s,o[2]),i},Ut.getJWKFromKey=function(t){var e={};if(t instanceof at&&t.isPrivate)return e.kty="RSA",e.n=At(t.n.toString(16)),e.e=At(t.e.toString(16)),e.d=At(t.d.toString(16)),e.p=At(t.p.toString(16)),e.q=At(t.q.toString(16)),e.dp=At(t.dmp1.toString(16)),e.dq=At(t.dmq1.toString(16)),e.qi=At(t.coeff.toString(16)),e;if(t instanceof at&&t.isPublic)return e.kty="RSA",e.n=At(t.n.toString(16)),e.e=At(t.e.toString(16)),e;if(t instanceof ft.crypto.ECDSA&&t.isPrivate){if("P-256"!==(r=t.getShortNISTPCurveName())&&"P-384"!==r)throw"unsupported curve name for JWT: "+r;var n=t.getPublicKeyXYHex();return e.kty="EC",e.crv=r,e.x=At(n.x),e.y=At(n.y),e.d=At(t.prvKeyHex),e}if(t instanceof ft.crypto.ECDSA&&t.isPublic){var r;if("P-256"!==(r=t.getShortNISTPCurveName())&&"P-384"!==r)throw"unsupported curve name for JWT: "+r;n=t.getPublicKeyXYHex();return e.kty="EC",e.crv=r,e.x=At(n.x),e.y=At(n.y),e}throw"not supported key object"},at.getPosArrayOfChildrenFromHex=function(t){return pt.getChildIdx(t,0)},at.getHexValueArrayOfChildrenFromHex=function(t){var e,n=pt.getV,r=n(t,(e=at.getPosArrayOfChildrenFromHex(t))[0]),i=n(t,e[1]),s=n(t,e[2]),a=n(t,e[3]),o=n(t,e[4]),u=n(t,e[5]),h=n(t,e[6]),c=n(t,e[7]),l=n(t,e[8]);return(e=new Array).push(r,i,s,a,o,u,h,c,l),e},at.prototype.readPrivateKeyFromPEMString=function(t){var e=Rt(t),n=at.getHexValueArrayOfChildrenFromHex(e);this.setPrivateEx(n[1],n[2],n[3],n[4],n[5],n[6],n[7],n[8])},at.prototype.readPKCS5PrvKeyHex=function(t){var e=at.getHexValueArrayOfChildrenFromHex(t);this.setPrivateEx(e[1],e[2],e[3],e[4],e[5],e[6],e[7],e[8])},at.prototype.readPKCS8PrvKeyHex=function(t){var e,n,r,i,s,a,o,u,h=pt,c=h.getVbyList;if(!1===h.isASN1HEX(t))throw"not ASN.1 hex string";try{e=c(t,0,[2,0,1],"02"),n=c(t,0,[2,0,2],"02"),r=c(t,0,[2,0,3],"02"),i=c(t,0,[2,0,4],"02"),s=c(t,0,[2,0,5],"02"),a=c(t,0,[2,0,6],"02"),o=c(t,0,[2,0,7],"02"),u=c(t,0,[2,0,8],"02")}catch(t){throw"malformed PKCS#8 plain RSA private key"}this.setPrivateEx(e,n,r,i,s,a,o,u)},at.prototype.readPKCS5PubKeyHex=function(t){var e=pt,n=e.getV;if(!1===e.isASN1HEX(t))throw"keyHex is not ASN.1 hex string";var r=e.getChildIdx(t,0);if(2!==r.length||"02"!==t.substr(r[0],2)||"02"!==t.substr(r[1],2))throw"wrong hex for PKCS#5 public key";var i=n(t,r[0]),s=n(t,r[1]);this.setPublic(i,s)},at.prototype.readPKCS8PubKeyHex=function(t){var e=pt;if(!1===e.isASN1HEX(t))throw"not ASN.1 hex string";if("06092a864886f70d010101"!==e.getTLVbyList(t,0,[0,0]))throw"not PKCS8 RSA public key";var n=e.getTLVbyList(t,0,[1,0]);this.readPKCS5PubKeyHex(n)},at.prototype.readCertPubKeyHex=function(t,e){var n,r;(n=new Jt).readCertHex(t),r=n.getPublicKeyHex(),this.readPKCS8PubKeyHex(r)};var qt=new RegExp("");function zt(t,e){for(var n="",r=e/4-t.length,i=0;i<r;i++)n+="0";return n+t}function Yt(t,e,n){for(var r="",i=0;r.length<e;)r+=Ct(n(Dt(t+String.fromCharCode.apply(String,[(4278190080&i)>>24,(16711680&i)>>16,(65280&i)>>8,255&i])))),i+=1;return r}function Gt(t){for(var e in ft.crypto.Util.DIGESTINFOHEAD){var n=ft.crypto.Util.DIGESTINFOHEAD[e],r=n.length;if(t.substring(0,r)==n)return[e,t.substring(r)]}return[]}function Jt(){var t=pt,e=t.getChildIdx,n=t.getV,r=t.getTLV,i=t.getVbyList,s=t.getTLVbyList,a=t.getIdxbyList,o=t.getVidx,u=t.oidname,h=Jt,c=Rt;this.hex=null,this.version=0,this.foffset=0,this.aExtInfo=null,this.getVersion=function(){return null===this.hex||0!==this.version?this.version:"a003020102"!==s(this.hex,0,[0,0])?(this.version=1,this.foffset=-1,1):(this.version=3,3)},this.getSerialNumberHex=function(){return i(this.hex,0,[0,1+this.foffset],"02")},this.getSignatureAlgorithmField=function(){return u(i(this.hex,0,[0,2+this.foffset,0],"06"))},this.getIssuerHex=function(){return s(this.hex,0,[0,3+this.foffset],"30")},this.getIssuerString=function(){return h.hex2dn(this.getIssuerHex())},this.getSubjectHex=function(){return s(this.hex,0,[0,5+this.foffset],"30")},this.getSubjectString=function(){return h.hex2dn(this.getSubjectHex())},this.getNotBefore=function(){var t=i(this.hex,0,[0,4+this.foffset,0]);return t=t.replace(/(..)/g,"%$1"),t=decodeURIComponent(t)},this.getNotAfter=function(){var t=i(this.hex,0,[0,4+this.foffset,1]);return t=t.replace(/(..)/g,"%$1"),t=decodeURIComponent(t)},this.getPublicKeyHex=function(){return t.getTLVbyList(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyIdx=function(){return a(this.hex,0,[0,6+this.foffset],"30")},this.getPublicKeyContentIdx=function(){var t=this.getPublicKeyIdx();return a(this.hex,t,[1,0],"30")},this.getPublicKey=function(){return Ut.getKey(this.getPublicKeyHex(),null,"pkcs8pub")},this.getSignatureAlgorithmName=function(){return u(i(this.hex,0,[1,0],"06"))},this.getSignatureValueHex=function(){return i(this.hex,0,[2],"03",!0)},this.verifySignature=function(t){var e=this.getSignatureAlgorithmName(),n=this.getSignatureValueHex(),r=s(this.hex,0,[0],"30"),i=new ft.crypto.Signature({alg:e});return i.init(t),i.updateHex(r),i.verify(n)},this.parseExt=function(){if(3!==this.version)return-1;var n=a(this.hex,0,[0,7,0],"30"),r=e(this.hex,n);this.aExtInfo=new Array;for(var s=0;s<r.length;s++){var u={critical:!1},h=0;3===e(this.hex,r[s]).length&&(u.critical=!0,h=1),u.oid=t.hextooidstr(i(this.hex,r[s],[0],"06"));var c=a(this.hex,r[s],[1+h]);u.vidx=o(this.hex,c),this.aExtInfo.push(u)}},this.getExtInfo=function(t){var e=this.aExtInfo,n=t;if(t.match(/^[0-9.]+$/)||(n=ft.asn1.x509.OID.name2oid(t)),""!==n)for(var r=0;r<e.length;r++)if(e[r].oid===n)return e[r]},this.getExtBasicConstraints=function(){var t=this.getExtInfo("basicConstraints");if(void 0===t)return t;var e=n(this.hex,t.vidx);if(""===e)return{};if("0101ff"===e)return{cA:!0};if("0101ff02"===e.substr(0,8)){var r=n(e,6);return{cA:!0,pathLen:parseInt(r,16)}}throw"basicConstraints parse error"},this.getExtKeyUsageBin=function(){var t=this.getExtInfo("keyUsage");if(void 0===t)return"";var e=n(this.hex,t.vidx);if(e.length%2!=0||e.length<=2)throw"malformed key usage value";var r=parseInt(e.substr(0,2)),i=parseInt(e.substr(2),16).toString(2);return i.substr(0,i.length-r)},this.getExtKeyUsageString=function(){for(var t=this.getExtKeyUsageBin(),e=new Array,n=0;n<t.length;n++)"1"==t.substr(n,1)&&e.push(Jt.KEYUSAGE_NAME[n]);return e.join(",")},this.getExtSubjectKeyIdentifier=function(){var t=this.getExtInfo("subjectKeyIdentifier");return void 0===t?t:n(this.hex,t.vidx)},this.getExtAuthorityKeyIdentifier=function(){var t=this.getExtInfo("authorityKeyIdentifier");if(void 0===t)return t;for(var i={},s=r(this.hex,t.vidx),a=e(s,0),o=0;o<a.length;o++)"80"===s.substr(a[o],2)&&(i.kid=n(s,a[o]));return i},this.getExtExtKeyUsageName=function(){var t=this.getExtInfo("extKeyUsage");if(void 0===t)return t;var i=new Array,s=r(this.hex,t.vidx);if(""===s)return i;for(var a=e(s,0),o=0;o<a.length;o++)i.push(u(n(s,a[o])));return i},this.getExtSubjectAltName=function(){for(var t=this.getExtSubjectAltName2(),e=new Array,n=0;n<t.length;n++)"DNS"===t[n][0]&&e.push(t[n][1]);return e},this.getExtSubjectAltName2=function(){var t,i,s,a=this.getExtInfo("subjectAltName");if(void 0===a)return a;for(var o=new Array,u=r(this.hex,a.vidx),h=e(u,0),c=0;c<h.length;c++)s=u.substr(h[c],2),t=n(u,h[c]),"81"===s&&(i=xt(t),o.push(["MAIL",i])),"82"===s&&(i=xt(t),o.push(["DNS",i])),"84"===s&&(i=Jt.hex2dn(t,0),o.push(["DN",i])),"86"===s&&(i=xt(t),o.push(["URI",i])),"87"===s&&(i=_t(t),o.push(["IP",i]));return o},this.getExtCRLDistributionPointsURI=function(){var t=this.getExtInfo("cRLDistributionPoints");if(void 0===t)return t;for(var n=new Array,r=e(this.hex,t.vidx),s=0;s<r.length;s++)try{var a=xt(i(this.hex,r[s],[0,0,0],"86"));n.push(a)}catch(t){}return n},this.getExtAIAInfo=function(){var t=this.getExtInfo("authorityInfoAccess");if(void 0===t)return t;for(var n={ocsp:[],caissuer:[]},r=e(this.hex,t.vidx),s=0;s<r.length;s++){var a=i(this.hex,r[s],[0],"06"),o=i(this.hex,r[s],[1],"86");"2b06010505073001"===a&&n.ocsp.push(xt(o)),"2b06010505073002"===a&&n.caissuer.push(xt(o))}return n},this.getExtCertificatePolicies=function(){var t=this.getExtInfo("certificatePolicies");if(void 0===t)return t;for(var s=r(this.hex,t.vidx),a=[],o=e(s,0),h=0;h<o.length;h++){var c={},l=e(s,o[h]);if(c.id=u(n(s,l[0])),2===l.length)for(var f=e(s,l[1]),d=0;d<f.length;d++){var g=i(s,f[d],[0],"06");"2b06010505070201"===g?c.cps=xt(i(s,f[d],[1])):"2b06010505070202"===g&&(c.unotice=xt(i(s,f[d],[1,0])))}a.push(c)}return a},this.readCertPEM=function(t){this.readCertHex(c(t))},this.readCertHex=function(t){this.hex=t,this.getVersion();try{a(this.hex,0,[0,7],"a3"),this.parseExt()}catch(t){}},this.getInfo=function(){var t,e,n;if(t="Basic Fields\n",t+=" serial number: "+this.getSerialNumberHex()+"\n",t+=" signature algorithm: "+this.getSignatureAlgorithmField()+"\n",t+=" issuer: "+this.getIssuerString()+"\n",t+=" notBefore: "+this.getNotBefore()+"\n",t+=" notAfter: "+this.getNotAfter()+"\n",t+=" subject: "+this.getSubjectString()+"\n",t+=" subject public key info: \n",t+=" key algorithm: "+(e=this.getPublicKey()).type+"\n","RSA"===e.type&&(t+=" n="+Mt(e.n.toString(16)).substr(0,16)+"...\n",t+=" e="+Mt(e.e.toString(16))+"\n"),null!=(n=this.aExtInfo)){t+="X509v3 Extensions:\n";for(var r=0;r<n.length;r++){var i=n[r],s=ft.asn1.x509.OID.oid2name(i.oid);""===s&&(s=i.oid);var a="";if(!0===i.critical&&(a="CRITICAL"),t+=" "+s+" "+a+":\n","basicConstraints"===s){var o=this.getExtBasicConstraints();void 0===o.cA?t+=" {}\n":(t+=" cA=true",void 0!==o.pathLen&&(t+=", pathLen="+o.pathLen),t+="\n")}else if("keyUsage"===s)t+=" "+this.getExtKeyUsageString()+"\n";else if("subjectKeyIdentifier"===s)t+=" "+this.getExtSubjectKeyIdentifier()+"\n";else if("authorityKeyIdentifier"===s){var u=this.getExtAuthorityKeyIdentifier();void 0!==u.kid&&(t+=" kid="+u.kid+"\n")}else{if("extKeyUsage"===s)t+=" "+this.getExtExtKeyUsageName().join(", ")+"\n";else if("subjectAltName"===s)t+=" "+this.getExtSubjectAltName2()+"\n";else if("cRLDistributionPoints"===s)t+=" "+this.getExtCRLDistributionPointsURI()+"\n";else if("authorityInfoAccess"===s){var h=this.getExtAIAInfo();void 0!==h.ocsp&&(t+=" ocsp: "+h.ocsp.join(",")+"\n"),void 0!==h.caissuer&&(t+=" caissuer: "+h.caissuer.join(",")+"\n")}else if("certificatePolicies"===s)for(var c=this.getExtCertificatePolicies(),l=0;l<c.length;l++)void 0!==c[l].id&&(t+=" policy oid: "+c[l].id+"\n"),void 0!==c[l].cps&&(t+=" cps: "+c[l].cps+"\n")}}}return t+="signature algorithm: "+this.getSignatureAlgorithmName()+"\n",t+="signature: "+this.getSignatureValueHex().substr(0,16)+"...\n"}}qt.compile("[^0-9a-f]","gi"),at.prototype.sign=function(t,e){var n,r=(n=t,ft.crypto.Util.hashString(n,e));return this.signWithMessageHash(r,e)},at.prototype.signWithMessageHash=function(t,e){var n=it(ft.crypto.Util.getPaddedDigestInfoHex(t,e,this.n.bitLength()),16);return zt(this.doPrivate(n).toString(16),this.n.bitLength())},at.prototype.signPSS=function(t,e,n){var r,i=(r=Dt(t),ft.crypto.Util.hashHex(r,e));return void 0===n&&(n=-1),this.signWithMessageHashPSS(i,e,n)},at.prototype.signWithMessageHashPSS=function(t,e,n){var r,i=Ct(t),s=i.length,a=this.n.bitLength()-1,o=Math.ceil(a/8),u=function(t){return ft.crypto.Util.hashHex(t,e)};if(-1===n||void 0===n)n=s;else if(-2===n)n=o-s-2;else if(n<-2)throw"invalid salt length";if(o<s+n+2)throw"data too long";var h="";n>0&&(h=new Array(n),(new rt).nextBytes(h),h=String.fromCharCode.apply(String,h));var c=Ct(u(Dt("\0\0\0\0\0\0\0\0"+i+h))),l=[];for(r=0;r<o-n-s-2;r+=1)l[r]=0;var f=String.fromCharCode.apply(String,l)+""+h,d=Yt(c,f.length,u),g=[];for(r=0;r<f.length;r+=1)g[r]=f.charCodeAt(r)^d.charCodeAt(r);var p=65280>>8*o-a&255;for(g[0]&=~p,r=0;r<s;r++)g.push(c.charCodeAt(r));return g.push(188),zt(this.doPrivate(new E(g)).toString(16),this.n.bitLength())},at.prototype.verify=function(t,e){var n=it(e=(e=e.replace(qt,"")).replace(/[ \n]+/g,""),16);if(n.bitLength()>this.n.bitLength())return 0;var r=Gt(this.doPublic(n).toString(16).replace(/^1f+00/,""));if(0==r.length)return!1;var i,s=r[0];return r[1]==(i=t,ft.crypto.Util.hashString(i,s))},at.prototype.verifyWithMessageHash=function(t,e){var n=it(e=(e=e.replace(qt,"")).replace(/[ \n]+/g,""),16);if(n.bitLength()>this.n.bitLength())return 0;var r=Gt(this.doPublic(n).toString(16).replace(/^1f+00/,""));if(0==r.length)return!1;r[0];return r[1]==t},at.prototype.verifyPSS=function(t,e,n,r){var i,s=(i=Dt(t),ft.crypto.Util.hashHex(i,n));return void 0===r&&(r=-1),this.verifyWithMessageHashPSS(s,e,n,r)},at.prototype.verifyWithMessageHashPSS=function(t,e,n,r){var i=new E(e,16);if(i.bitLength()>this.n.bitLength())return!1;var s,a=function(t){return ft.crypto.Util.hashHex(t,n)},o=Ct(t),u=o.length,h=this.n.bitLength()-1,c=Math.ceil(h/8);if(-1===r||void 0===r)r=u;else if(-2===r)r=c-u-2;else if(r<-2)throw"invalid salt length";if(c<u+r+2)throw"data too long";var l=this.doPublic(i).toByteArray();for(s=0;s<l.length;s+=1)l[s]&=255;for(;l.length<c;)l.unshift(0);if(188!==l[c-1])throw"encoded message does not end in 0xbc";var f=(l=String.fromCharCode.apply(String,l)).substr(0,c-u-1),d=l.substr(f.length,u),g=65280>>8*c-h&255;if(0!=(f.charCodeAt(0)&g))throw"bits beyond keysize not zero";var p=Yt(d,f.length,a),y=[];for(s=0;s<f.length;s+=1)y[s]=f.charCodeAt(s)^p.charCodeAt(s);y[0]&=~g;var v=c-u-r-2;for(s=0;s<v;s+=1)if(0!==y[s])throw"leftmost octets not zero";if(1!==y[v])throw"0x01 marker not found";return d===Ct(a(Dt("\0\0\0\0\0\0\0\0"+o+String.fromCharCode.apply(String,y.slice(-r)))))},at.SALT_LEN_HLEN=-1,at.SALT_LEN_MAX=-2,at.SALT_LEN_RECOVER=-2,Jt.hex2dn=function(t,e){if(void 0===e&&(e=0),"30"!==t.substr(e,2))throw"malformed DN";for(var n=new Array,r=pt.getChildIdx(t,e),i=0;i<r.length;i++)n.push(Jt.hex2rdn(t,r[i]));return"/"+(n=n.map(function(t){return t.replace("/","\\/")})).join("/")},Jt.hex2rdn=function(t,e){if(void 0===e&&(e=0),"31"!==t.substr(e,2))throw"malformed RDN";for(var n=new Array,r=pt.getChildIdx(t,e),i=0;i<r.length;i++)n.push(Jt.hex2attrTypeValue(t,r[i]));return(n=n.map(function(t){return t.replace("+","\\+")})).join("+")},Jt.hex2attrTypeValue=function(t,e){var n=pt,r=n.getV;if(void 0===e&&(e=0),"30"!==t.substr(e,2))throw"malformed attribute type and value";var i=n.getChildIdx(t,e);2!==i.length||t.substr(i[0],2);var s=r(t,i[0]),a=ft.asn1.ASN1Util.oidHexToInt(s);return ft.asn1.x509.OID.oid2atype(a)+"="+Ct(r(t,i[1]))},Jt.getPublicKeyFromCertHex=function(t){var e=new Jt;return e.readCertHex(t),e.getPublicKey()},Jt.getPublicKeyFromCertPEM=function(t){var e=new Jt;return e.readCertPEM(t),e.getPublicKey()},Jt.getPublicKeyInfoPropOfCertPEM=function(t){var e,n,r=pt.getVbyList,i={};return i.algparam=null,(e=new Jt).readCertPEM(t),n=e.getPublicKeyHex(),i.keyhex=r(n,0,[1],"03").substr(2),i.algoid=r(n,0,[0,0],"06"),"2a8648ce3d0201"===i.algoid&&(i.algparam=r(n,0,[0,1],"06")),i},Jt.KEYUSAGE_NAME=["digitalSignature","nonRepudiation","keyEncipherment","dataEncipherment","keyAgreement","keyCertSign","cRLSign","encipherOnly","decipherOnly"],void 0!==ft&&ft||(ft={}),void 0!==ft.jws&&ft.jws||(ft.jws={}),ft.jws.JWS=function(){var t=ft.jws.JWS.isSafeJSONString;this.parseJWS=function(e,n){if(void 0===this.parsedJWS||!n&&void 0===this.parsedJWS.sigvalH){var r=e.match(/^([^.]+)\.([^.]+)\.([^.]+)$/);if(null==r)throw"JWS signature is not a form of 'Head.Payload.SigValue'.";var i=r[1],s=r[2],a=r[3],o=i+"."+s;if(this.parsedJWS={},this.parsedJWS.headB64U=i,this.parsedJWS.payloadB64U=s,this.parsedJWS.sigvalB64U=a,this.parsedJWS.si=o,!n){var u=Et(a),h=it(u,16);this.parsedJWS.sigvalH=u,this.parsedJWS.sigvalBI=h}var c=gt(i),l=gt(s);if(this.parsedJWS.headS=c,this.parsedJWS.payloadS=l,!t(c,this.parsedJWS,"headP"))throw"malformed JSON string for JWS Head: "+c}}},ft.jws.JWS.sign=function(t,e,n,r,i){var s,a,o,u=ft,h=u.jws.JWS,c=h.readSafeJSONString,l=h.isSafeJSONString,f=u.crypto,d=(f.ECDSA,f.Mac),g=f.Signature,p=JSON;if("string"!=typeof e&&"object"!=typeof e)throw"spHeader must be JSON string or object: "+e;if("object"==typeof e&&(a=e,s=p.stringify(a)),"string"==typeof e){if(!l(s=e))throw"JWS Head is not safe JSON string: "+s;a=c(s)}if(o=n,"object"==typeof n&&(o=p.stringify(n)),""!=t&&null!=t||void 0===a.alg||(t=a.alg),""!=t&&null!=t&&void 0===a.alg&&(a.alg=t,s=p.stringify(a)),t!==a.alg)throw"alg and sHeader.alg doesn't match: "+t+"!="+a.alg;var y=null;if(void 0===h.jwsalg2sigalg[t])throw"unsupported alg name: "+t;y=h.jwsalg2sigalg[t];var v=dt(s)+"."+dt(o),m="";if("Hmac"==y.substr(0,4)){if(void 0===r)throw"mac key shall be specified for HS* alg";var F=new d({alg:y,prov:"cryptojs",pass:r});F.updateString(v),m=F.doFinal()}else{var S;if(-1!=y.indexOf("withECDSA"))(S=new g({alg:y})).init(r,i),S.updateString(v),hASN1Sig=S.sign(),m=ft.crypto.ECDSA.asn1SigToConcatSig(hASN1Sig);else if("none"!=y)(S=new g({alg:y})).init(r,i),S.updateString(v),m=S.sign()}return v+"."+At(m)},ft.jws.JWS.verify=function(t,e,n){var r,i=ft,s=i.jws.JWS,a=s.readSafeJSONString,o=i.crypto,u=o.ECDSA,h=o.Mac,c=o.Signature;r=at;var l=t.split(".");if(3!==l.length)return!1;var f=l[0]+"."+l[1],d=Et(l[2]),g=a(gt(l[0])),p=null,y=null;if(void 0===g.alg)throw"algorithm not specified in header";if((y=(p=g.alg).substr(0,2),null!=n&&"[object Array]"===Object.prototype.toString.call(n)&&n.length>0)&&-1==(":"+n.join(":")+":").indexOf(":"+p+":"))throw"algorithm '"+p+"' not accepted in the list";if("none"!=p&&null===e)throw"key shall be specified to verify.";if("string"==typeof e&&-1!=e.indexOf("-----BEGIN ")&&(e=Ut.getKey(e)),!("RS"!=y&&"PS"!=y||e instanceof r))throw"key shall be a RSAKey obj for RS* and PS* algs";if("ES"==y&&!(e instanceof u))throw"key shall be a ECDSA obj for ES* algs";var v=null;if(void 0===s.jwsalg2sigalg[g.alg])throw"unsupported alg name: "+p;if("none"==(v=s.jwsalg2sigalg[p]))throw"not supported";if("Hmac"==v.substr(0,4)){if(void 0===e)throw"hexadecimal key shall be specified for HMAC";var m=new h({alg:v,pass:e});return m.updateString(f),d==m.doFinal()}if(-1!=v.indexOf("withECDSA")){var F,S=null;try{S=u.concatSigToASN1Sig(d)}catch(t){return!1}return(F=new c({alg:v})).init(e),F.updateString(f),F.verify(S)}return(F=new c({alg:v})).init(e),F.updateString(f),F.verify(d)},ft.jws.JWS.parse=function(t){var e,n,r,i=t.split("."),s={};if(2!=i.length&&3!=i.length)throw"malformed sJWS: wrong number of '.' splitted elements";return e=i[0],n=i[1],3==i.length&&(r=i[2]),s.headerObj=ft.jws.JWS.readSafeJSONString(gt(e)),s.payloadObj=ft.jws.JWS.readSafeJSONString(gt(n)),s.headerPP=JSON.stringify(s.headerObj,null," "),null==s.payloadObj?s.payloadPP=gt(n):s.payloadPP=JSON.stringify(s.payloadObj,null," "),void 0!==r&&(s.sigHex=Et(r)),s},ft.jws.JWS.verifyJWT=function(t,e,n){var r=ft.jws,i=r.JWS,s=i.readSafeJSONString,a=i.inArray,o=i.includedArray,u=t.split("."),h=u[0],c=u[1],l=(Et(u[2]),s(gt(h))),f=s(gt(c));if(void 0===l.alg)return!1;if(void 0===n.alg)throw"acceptField.alg shall be specified";if(!a(l.alg,n.alg))return!1;if(void 0!==f.iss&&"object"==typeof n.iss&&!a(f.iss,n.iss))return!1;if(void 0!==f.sub&&"object"==typeof n.sub&&!a(f.sub,n.sub))return!1;if(void 0!==f.aud&&"object"==typeof n.aud)if("string"==typeof f.aud){if(!a(f.aud,n.aud))return!1}else if("object"==typeof f.aud&&!o(f.aud,n.aud))return!1;var d=r.IntDate.getNow();return void 0!==n.verifyAt&&"number"==typeof n.verifyAt&&(d=n.verifyAt),void 0!==n.gracePeriod&&"number"==typeof n.gracePeriod||(n.gracePeriod=0),!(void 0!==f.exp&&"number"==typeof f.exp&&f.exp+n.gracePeriod<d)&&(!(void 0!==f.nbf&&"number"==typeof f.nbf&&d<f.nbf-n.gracePeriod)&&(!(void 0!==f.iat&&"number"==typeof f.iat&&d<f.iat-n.gracePeriod)&&((void 0===f.jti||void 0===n.jti||f.jti===n.jti)&&!!i.verify(t,e,n.alg))))},ft.jws.JWS.includedArray=function(t,e){var n=ft.jws.JWS.inArray;if(null===t)return!1;if("object"!=typeof t)return!1;if("number"!=typeof t.length)return!1;for(var r=0;r<t.length;r++)if(!n(t[r],e))return!1;return!0},ft.jws.JWS.inArray=function(t,e){if(null===e)return!1;if("object"!=typeof e)return!1;if("number"!=typeof e.length)return!1;for(var n=0;n<e.length;n++)if(e[n]==t)return!0;return!1},ft.jws.JWS.jwsalg2sigalg={HS256:"HmacSHA256",HS384:"HmacSHA384",HS512:"HmacSHA512",RS256:"SHA256withRSA",RS384:"SHA384withRSA",RS512:"SHA512withRSA",ES256:"SHA256withECDSA",ES384:"SHA384withECDSA",PS256:"SHA256withRSAandMGF1",PS384:"SHA384withRSAandMGF1",PS512:"SHA512withRSAandMGF1",none:"none"},ft.jws.JWS.isSafeJSONString=function(t,e,n){var r=null;try{return"object"!=typeof(r=lt(t))?0:r.constructor===Array?0:(e&&(e[n]=r),1)}catch(t){return 0}},ft.jws.JWS.readSafeJSONString=function(t){var e=null;try{return"object"!=typeof(e=lt(t))?null:e.constructor===Array?null:e}catch(t){return null}},ft.jws.JWS.getEncodedSignatureValueFromJWS=function(t){var e=t.match(/^[^.]+\.[^.]+\.([^.]+)$/);if(null==e)throw"JWS signature is not a form of 'Head.Payload.SigValue'.";return e[1]},ft.jws.JWS.getJWKthumbprint=function(t){if("RSA"!==t.kty&&"EC"!==t.kty&&"oct"!==t.kty)throw"unsupported algorithm for JWK Thumprint";var e="{";if("RSA"===t.kty){if("string"!=typeof t.n||"string"!=typeof t.e)throw"wrong n and e value for RSA key";e+='"e":"'+t.e+'",',e+='"kty":"'+t.kty+'",',e+='"n":"'+t.n+'"}'}else if("EC"===t.kty){if("string"!=typeof t.crv||"string"!=typeof t.x||"string"!=typeof t.y)throw"wrong crv, x and y value for EC key";e+='"crv":"'+t.crv+'",',e+='"kty":"'+t.kty+'",',e+='"x":"'+t.x+'",',e+='"y":"'+t.y+'"}'}else if("oct"===t.kty){if("string"!=typeof t.k)throw"wrong k value for oct(symmetric) key";e+='"kty":"'+t.kty+'",',e+='"k":"'+t.k+'"}'}var n=Dt(e);return At(ft.crypto.Util.hashHex(n,"sha256"))},ft.jws.IntDate={},ft.jws.IntDate.get=function(t){var e=ft.jws.IntDate,n=e.getNow,r=e.getZulu;if("now"==t)return n();if("now + 1hour"==t)return n()+3600;if("now + 1day"==t)return n()+86400;if("now + 1month"==t)return n()+2592e3;if("now + 1year"==t)return n()+31536e3;if(t.match(/Z$/))return r(t);if(t.match(/^[0-9]+$/))return parseInt(t);throw"unsupported format: "+t},ft.jws.IntDate.getZulu=function(t){return Nt(t)},ft.jws.IntDate.getNow=function(){return~~(new Date/1e3)},ft.jws.IntDate.intDate2UTCString=function(t){return new Date(1e3*t).toUTCString()},ft.jws.IntDate.intDate2Zulu=function(t){var e=new Date(1e3*t);return("0000"+e.getUTCFullYear()).slice(-4)+("00"+(e.getUTCMonth()+1)).slice(-2)+("00"+e.getUTCDate()).slice(-2)+("00"+e.getUTCHours()).slice(-2)+("00"+e.getUTCMinutes()).slice(-2)+("00"+e.getUTCSeconds()).slice(-2)+"Z"},void 0!==ft&&ft||(ft={}),void 0!==ft.jws&&ft.jws||(ft.jws={}),ft.jws.JWSJS=function(){var t=ft.jws.JWS,e=t.readSafeJSONString;this.aHeader=[],this.sPayload="",this.aSignature=[],this.init=function(){this.aHeader=[],this.sPayload=void 0,this.aSignature=[]},this.initWithJWS=function(t){this.init();var e=t.split(".");if(3!=e.length)throw"malformed input JWS";this.aHeader.push(e[0]),this.sPayload=e[1],this.aSignature.push(e[2])},this.addSignature=function(t,e,n,r){if(void 0===this.sPayload||null===this.sPayload)throw"there's no JSON-JS signature to add.";var i=this.aHeader.length;if(this.aHeader.length!=this.aSignature.length)throw"aHeader.length != aSignature.length";try{var s=ft.jws.JWS.sign(t,e,this.sPayload,n,r).split(".");s[0],s[2];this.aHeader.push(s[0]),this.aSignature.push(s[2])}catch(t){throw this.aHeader.length>i&&this.aHeader.pop(),this.aSignature.length>i&&this.aSignature.pop(),"addSignature failed: "+t}},this.verifyAll=function(t){if(this.aHeader.length!==t.length||this.aSignature.length!==t.length)return!1;for(var e=0;e<t.length;e++){var n=t[e];if(2!==n.length)return!1;if(!1===this.verifyNth(e,n[0],n[1]))return!1}return!0},this.verifyNth=function(e,n,r){if(this.aHeader.length<=e||this.aSignature.length<=e)return!1;var i=this.aHeader[e],s=this.aSignature[e],a=i+"."+this.sPayload+"."+s,o=!1;try{o=t.verify(a,n,r)}catch(t){return!1}return o},this.readJWSJS=function(t){if("string"==typeof t){var n=e(t);if(null==n)throw"argument is not safe JSON object string";this.aHeader=n.headers,this.sPayload=n.payload,this.aSignature=n.signatures}else try{if(!(t.headers.length>0))throw"malformed header";if(this.aHeader=t.headers,"string"!=typeof t.payload)throw"malformed signatures";if(this.sPayload=t.payload,!(t.signatures.length>0))throw"malformed signatures";this.aSignatures=t.signatures}catch(t){throw"malformed JWS-JS JSON object: "+t}},this.getJSON=function(){return{headers:this.aHeader,payload:this.sPayload,signatures:this.aSignature}},this.isEmpty=function(){return 0==this.aHeader.length?1:0}},e.SecureRandom=rt,e.rng_seed_time=$,e.BigInteger=E,e.RSAKey=at,e.ECDSA=ft.crypto.ECDSA,e.DSA=ft.crypto.DSA,e.Signature=ft.crypto.Signature,e.MessageDigest=ft.crypto.MessageDigest,e.Mac=ft.crypto.Mac,e.Cipher=ft.crypto.Cipher,e.KEYUTIL=Ut,e.ASN1HEX=pt,e.X509=Jt,e.CryptoJS=y,e.b64tohex=b,e.b64toBA=A,e.stoBA=yt,e.BAtos=vt,e.BAtohex=mt,e.stohex=Ft,e.stob64=function(t){return S(Ft(t))},e.stob64u=function(t){return St(S(Ft(t)))},e.b64utos=function(t){return vt(A(bt(t)))},e.b64tob64u=St,e.b64utob64=bt,e.hex2b64=S,e.hextob64u=At,e.b64utohex=Et,e.utf8tob64u=dt,e.b64utoutf8=gt,e.utf8tob64=function(t){return S(Ot(Vt(t)))},e.b64toutf8=function(t){return decodeURIComponent(jt(b(t)))},e.utf8tohex=wt,e.hextoutf8=xt,e.hextorstr=Ct,e.rstrtohex=Dt,e.hextob64=Bt,e.hextob64nl=Tt,e.b64nltohex=It,e.hextopem=Pt,e.pemtohex=Rt,e.hextoArrayBuffer=function(t){if(t.length%2!=0)throw"input is not even length";if(null==t.match(/^[0-9A-Fa-f]+$/))throw"input is not hexadecimal";for(var e=new ArrayBuffer(t.length/2),n=new DataView(e),r=0;r<t.length/2;r++)n.setUint8(r,parseInt(t.substr(2*r,2),16));return e},e.ArrayBuffertohex=function(t){for(var e="",n=new DataView(t),r=0;r<t.byteLength;r++)e+=("00"+n.getUint8(r).toString(16)).slice(-2);return e},e.zulutomsec=Ht,e.zulutosec=Nt,e.zulutodate=function(t){return new Date(Ht(t))},e.datetozulu=function(t,e,n){var r,i=t.getUTCFullYear();if(e){if(i<1950||2049<i)throw"not proper year for UTCTime: "+i;r=(""+i).slice(-2)}else r=("000"+i).slice(-4);if(r+=("0"+(t.getUTCMonth()+1)).slice(-2),r+=("0"+t.getUTCDate()).slice(-2),r+=("0"+t.getUTCHours()).slice(-2),r+=("0"+t.getUTCMinutes()).slice(-2),r+=("0"+t.getUTCSeconds()).slice(-2),n){var s=t.getUTCMilliseconds();0!==s&&(r+="."+(s=(s=("00"+s).slice(-3)).replace(/0+$/g,"")))}return r+="Z"},e.uricmptohex=Ot,e.hextouricmp=jt,e.ipv6tohex=Lt,e.hextoipv6=kt,e.hextoip=_t,e.iptohex=function(t){var e="malformed IP address";if(!(t=t.toLowerCase(t)).match(/^[0-9.]+$/)){if(t.match(/^[0-9a-f:]+$/)&&-1!==t.indexOf(":"))return Lt(t);throw e}var n=t.split(".");if(4!==n.length)throw e;var r="";try{for(var i=0;i<4;i++)r+=("0"+parseInt(n[i]).toString(16)).slice(-2);return r}catch(t){throw e}},e.encodeURIComponentAll=Vt,e.newline_toUnix=function(t){return t=t.replace(/\r\n/gm,"\n")},e.newline_toDos=function(t){return t=(t=t.replace(/\r\n/gm,"\n")).replace(/\n/gm,"\r\n")},e.hextoposhex=Mt,e.intarystrtohex=Kt,e.strdiffidx=function(t,e){var n=t.length;t.length>e.length&&(n=e.length);for(var r=0;r<n;r++)if(t.charCodeAt(r)!=e.charCodeAt(r))return r;return t.length!=e.length?n:-1},e.KJUR=ft,e.crypto=ft.crypto,e.asn1=ft.asn1,e.jws=ft.jws,e.lang=ft.lang}).call(this,n(5).Buffer)},9:function(t,e,n){"use strict";var r=n(0),i=n(12),s=n(4),a=n.n(s),o=n(14),u=n.n(o);function h(t,e,n,r,i,s,a){try{var o=t[s](a),u=o.value}catch(t){return void n(t)}o.done?e(u):Promise.resolve(u).then(r,i)}function c(t){return function(){var e=this,n=arguments;return new Promise(function(r,i){var s=t.apply(e,n);function a(t){h(s,r,i,a,o,"next",t)}function o(t){h(s,r,i,a,o,"throw",t)}a(void 0)})}}function l(t,e){for(var n=0;n<e.length;n++){var r=e[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}
/**
* @author n1474335 [n1474335@gmail.com]
* @author Matt C [matt@artemisbot.uk]
* @copyright Crown Copyright 2016
* @license Apache-2.0
*/
var f=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:null;!function(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}(this,t),this.value=[],this.type=t.BYTE_ARRAY,e&&e.hasOwnProperty("value")&&e.hasOwnProperty("type")&&this.set(e.value,e.type)}var e,n,s;return e=t,n=[{key:"set",value:function(e,n){if("string"==typeof n&&(n=t.typeEnum(n)),u.a.debug("Dish type: "+t.enumLookup(n)),this.value=e,this.type=n,!this.valid()){var s=r.a.truncate(JSON.stringify(this.value),13);throw new i.a("Data is not a valid ".concat(t.enumLookup(n),": ").concat(s))}}},{key:"get",value:function(){var e=c(regeneratorRuntime.mark(function e(n){var r,i=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:if(r=i.length>1&&void 0!==i[1]&&i[1],"string"==typeof n&&(n=t.typeEnum(n)),this.type===n){e.next=5;break}return e.next=5,this._translate(n,r);case 5:return e.abrupt("return",this.value);case 6:case"end":return e.stop()}},e,this)}));return function(t){return e.apply(this,arguments)}}()},{key:"_translate",value:function(){var e=c(regeneratorRuntime.mark(function e(n){var s,o,h=arguments;return regeneratorRuntime.wrap(function(e){for(;;)switch(e.prev=e.next){case 0:s=h.length>1&&void 0!==h[1]&&h[1],u.a.debug("Translating Dish from ".concat(t.enumLookup(this.type)," to ").concat(t.enumLookup(n))),o=s?r.a.byteArrayToChars:r.a.byteArrayToUtf8,e.prev=3,e.t0=this.type,e.next=e.t0===t.STRING?7:e.t0===t.NUMBER?9:e.t0===t.HTML?11:e.t0===t.ARRAY_BUFFER?13:e.t0===t.BIG_NUMBER?15:e.t0===t.JSON?17:e.t0===t.FILE?19:e.t0===t.LIST_FILE?24:30;break;case 7:return this.value=this.value?r.a.strToByteArray(this.value):[],e.abrupt("break",31);case 9:return this.value="number"==typeof this.value?r.a.strToByteArray(this.value.toString()):[],e.abrupt("break",31);case 11:return this.value=this.value?r.a.strToByteArray(r.a.unescapeHtml(r.a.stripHtmlTags(this.value,!0))):[],e.abrupt("break",31);case 13:return this.value=Array.prototype.slice.call(new Uint8Array(this.value)),e.abrupt("break",31);case 15:return this.value=a.a.isBigNumber(this.value)?r.a.strToByteArray(this.value.toFixed()):[],e.abrupt("break",31);case 17:return this.value=this.value?r.a.strToByteArray(JSON.stringify(this.value,null,4)):[],e.abrupt("break",31);case 19:return e.next=21,r.a.readFile(this.value);case 21:return this.value=e.sent,this.value=Array.prototype.slice.call(this.value),e.abrupt("break",31);case 24:return e.next=26,Promise.all(this.value.map(function(){var t=c(regeneratorRuntime.mark(function t(e){return regeneratorRuntime.wrap(function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",r.a.readFile(e));case 1:case"end":return t.stop()}},t,this)}));return function(e){return t.apply(this,arguments)}}()));case 26:return this.value=e.sent,this.value=this.value.map(function(t){return Array.prototype.slice.call(t)}),this.value=[].concat.apply([],this.value),e.abrupt("break",31);case 30:return e.abrupt("break",31);case 31:e.next=36;break;case 33:throw e.prev=33,e.t1=e.catch(3),new i.a("Error translating from ".concat(t.enumLookup(this.type)," to byteArray: ").concat(e.t1));case 36:this.type=t.BYTE_ARRAY,e.prev=37,e.t2=n,e.next=e.t2===t.STRING?41:e.t2===t.HTML?41:e.t2===t.NUMBER?44:e.t2===t.ARRAY_BUFFER?47:e.t2===t.BIG_NUMBER?50:e.t2===t.JSON?53:e.t2===t.FILE?56:e.t2===t.LIST_FILE?58:61;break;case 41:return this.value=this.value?o(this.value):"",this.type=t.STRING,e.abrupt("break",62);case 44:return this.value=this.value?parseFloat(o(this.value)):0,this.type=t.NUMBER,e.abrupt("break",62);case 47:return this.value=new Uint8Array(this.value).buffer,this.type=t.ARRAY_BUFFER,e.abrupt("break",62);case 50:try{this.value=new a.a(o(this.value))}catch(t){this.value=new a.a(NaN)}return this.type=t.BIG_NUMBER,e.abrupt("break",62);case 53:return this.value=JSON.parse(o(this.value)),this.type=t.JSON,e.abrupt("break",62);case 56:return this.value=new File(this.value,"unknown"),e.abrupt("break",62);case 58:return this.value=[new File(this.value,"unknown")],this.type=t.LIST_FILE,e.abrupt("break",62);case 61:return e.abrupt("break",62);case 62:e.next=67;break;case 64:throw e.prev=64,e.t3=e.catch(37),new i.a("Error translating from byteArray to ".concat(t.enumLookup(n),": ").concat(e.t3));case 67:case"end":return e.stop()}},e,this,[[3,33],[37,64]])}));return function(t){return e.apply(this,arguments)}}()},{key:"valid",value:function(){switch(this.type){case t.BYTE_ARRAY:if(!(this.value instanceof Array))return!1;for(var e=0;e<this.value.length;e++)if("number"!=typeof this.value[e]||this.value[e]<0||this.value[e]>255)return!1;return!0;case t.STRING:case t.HTML:return"string"==typeof this.value;case t.NUMBER:return"number"==typeof this.value;case t.ARRAY_BUFFER:return this.value instanceof ArrayBuffer;case t.BIG_NUMBER:return a.a.isBigNumber(this.value);case t.JSON:return!0;case t.FILE:return this.value instanceof File;case t.LIST_FILE:return this.value instanceof Array&&this.value.reduce(function(t,e){return t&&e instanceof File},!0);default:return!1}}},{key:"clone",value:function(){var e=new t;switch(this.type){case t.STRING:case t.HTML:case t.NUMBER:case t.BIG_NUMBER:e.set(this.value,this.type);break;case t.BYTE_ARRAY:case t.JSON:e.set(JSON.parse(JSON.stringify(this.value)),this.type);break;case t.ARRAY_BUFFER:e.set(this.value.slice(0),this.type);break;case t.FILE:e.set(new File([this.value],this.value.name,{type:this.value.type,lastModified:this.value.lastModified}),this.type);break;case t.LIST_FILE:e.set(this.value.map(function(t){return new File([t],t.name,{type:t.type,lastModified:t.lastModified})}),this.type);break;default:throw new i.a("Cannot clone Dish, unknown type")}return e}},{key:"size",get:function(){switch(this.type){case t.BYTE_ARRAY:case t.STRING:case t.HTML:return this.value.length;case t.NUMBER:case t.BIG_NUMBER:return this.value.toString().length;case t.ARRAY_BUFFER:return this.value.byteLength;case t.JSON:return JSON.stringify(this.value).length;case t.FILE:return this.value.size;case t.LIST_FILE:return this.value.reduce(function(t,e){return t+e.size},0);default:return-1}}}],s=[{key:"typeEnum",value:function(e){switch(e.toLowerCase()){case"bytearray":case"byte array":return t.BYTE_ARRAY;case"string":return t.STRING;case"number":return t.NUMBER;case"html":return t.HTML;case"arraybuffer":case"array buffer":return t.ARRAY_BUFFER;case"bignumber":case"big number":return t.BIG_NUMBER;case"json":return t.JSON;case"file":return t.FILE;case"list<file>":return t.LIST_FILE;default:throw new i.a("Invalid data type string. No matching enum.")}}},{key:"enumLookup",value:function(e){switch(e){case t.BYTE_ARRAY:return"byteArray";case t.STRING:return"string";case t.NUMBER:return"number";case t.HTML:return"html";case t.ARRAY_BUFFER:return"ArrayBuffer";case t.BIG_NUMBER:return"BigNumber";case t.JSON:return"JSON";case t.FILE:return"File";case t.LIST_FILE:return"List<File>";default:throw new i.a("Invalid data type enum. No matching type.")}}}],n&&l(e.prototype,n),s&&l(e,s),t}();f.BYTE_ARRAY=0,f.STRING=1,f.NUMBER=2,f.HTML=3,f.ARRAY_BUFFER=4,f.BIG_NUMBER=5,f.JSON=6,f.FILE=7,f.LIST_FILE=8,e.a=f}});